dist top-level constant
String
const dist
Implementation
const dist = r'''
/*
* GoJS v2.3.5 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-2023 by Northwoods Software Corporation. All Rights Reserved.
* THIS SOFTWARE IS LICENSED. THE LICENSE AGREEMENT IS AT: https://gojs.net/2.3.5/license.html.
* DO NOT MODIFY THIS FILE. DO NOT DISTRIBUTE A MODIFIED COPY OF THE CONTENTS OF THIS FILE.
*/
(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 da(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.PA=b.prototype}
var ma="undefined"!=typeof global&&null!=global?global:self,oa="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||oa});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 xa(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 ya(a){x.console&&x.console.log(a)}function za(a){return"object"===typeof a&&null!==a}
function Aa(a){return Array.isArray(a)||x.NodeList&&a instanceof x.NodeList||x.HTMLCollection&&a instanceof x.HTMLCollection}function Ba(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(za(a)&&a.constructor)return Ha(a.constructor);return typeof a}
function Ia(a){var b=a;za(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.BA;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"),Oa=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="32ab5ff3b26f42dc0ed90f21472913b5";ra.adym="gojs.net";ra.vfo="28e645fdb6";ra.className="Util";function E(a,b,c){Qa(this);this.j=a;this.wa=b;this.m=c}E.prototype.toString=function(){return"EnumValue."+this.wa};
function Ra(a,b){return void 0===b||null===b||""===b?null:a[b]}ma.Object.defineProperties(E.prototype,{classType:{get:function(){return this.j}},name:{get:function(){return this.wa}},value:{get:function(){return this.m}}});E.className="EnumValue";function Sa(){this.cw=[]}Sa.prototype.toString=function(){return this.cw.join("")};Sa.prototype.add=function(a){""!==a&&this.cw.push(a)};Sa.className="StringBuilder";
function Ta(){}Ta.className="PropertyCollection";
var Wa={DA:!1,IA:!1,FA:!1,HA:!1,MA:!1,KA:!1,nx:!1,EA:null,trace:function(a){x.console&&x.console.log(a)},GA: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)},CA: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.Xl=Object.getOwnPropertyNames(d.prototype);for(var e={Tj:0};e.Tj<b.Xl.length;e={Tj:e.Tj},e.Tj++){var f=Object.getOwnPropertyDescriptor(d.prototype,b.Xl[e.Tj]);void 0!==f.get&&void 0===f.set&&Object.defineProperty(d.prototype,
b.Xl[e.Tj],{set:function(a,b){return function(){throw Error("Property "+a.Xl[b.Tj]+" of "+a.x+" is read-only.");}}(b,e)})}}}b={Xl:b.Xl,x:b.x}}}};function Xa(){}Xa.prototype.reset=function(){};Xa.prototype.next=function(){return!1};Xa.prototype.yd=function(){return!1};Xa.prototype.first=function(){return null};Xa.prototype.any=function(){return!1};Xa.prototype.all=function(){return!0};Xa.prototype.each=function(){return this};Xa.prototype.map=function(){return this};Xa.prototype.filter=function(){return this};
Xa.prototype.be=function(){};Xa.prototype.toString=function(){return"EmptyIterator"};ma.Object.defineProperties(Xa.prototype,{iterator:{get:function(){return this}},count:{get:function(){return 0}}});Xa.prototype.first=Xa.prototype.first;Xa.prototype.hasNext=Xa.prototype.yd;Xa.prototype.next=Xa.prototype.next;Xa.prototype.reset=Xa.prototype.reset;var Ya=null;Xa.className="EmptyIterator";Ya=new Xa;function Za(a){this.key=-1;this.value=a}
Za.prototype.reset=function(){this.key=-1};Za.prototype.next=function(){return-1===this.key?(this.key=0,!0):!1};Za.prototype.yd=function(){return this.next()};Za.prototype.first=function(){this.key=0;return this.value};Za.prototype.any=function(a){this.key=-1;return a(this.value)};Za.prototype.all=function(a){this.key=-1;return a(this.value)};Za.prototype.each=function(a){this.key=-1;a(this.value);return this};Za.prototype.map=function(a){return new Za(a(this.value))};
Za.prototype.filter=function(a){return a(this.value)?new Za(this.value):Ya};Za.prototype.be=function(){this.value=null};Za.prototype.toString=function(){return"SingletonIterator("+this.value+")"};ma.Object.defineProperties(Za.prototype,{iterator:{get:function(){return this}},count:{get:function(){return 1}}});Za.prototype.first=Za.prototype.first;Za.prototype.hasNext=Za.prototype.yd;Za.prototype.next=Za.prototype.next;
Za.prototype.reset=Za.prototype.reset;Za.className="SingletonIterator";function $a(a){this.Db=a;this.pf=null;a.Sa=null;this.qa=a.Ja;this.Za=-1}$a.prototype.reset=function(){var a=this.Db;a.Sa=null;this.qa=a.Ja;this.Za=-1};$a.prototype.next=function(){var a=this.Db;if(a.Ja!==this.qa&&0>this.key)return!1;a=a.s;var b=a.length,c=++this.Za,d=this.pf;if(null!==d)for(;c<b;){var e=a[c];if(d(e))return this.key=this.Za=c,this.value=e,!0;c++}else{if(c<b)return this.key=c,this.value=a[c],!0;this.be()}return!1};
$a.prototype.yd=function(){return this.next()};$a.prototype.first=function(){var a=this.Db;this.qa=a.Ja;this.Za=0;a=a.s;var b=a.length,c=this.pf;if(null!==c){for(var d=0;d<b;){var e=a[d];if(c(e))return this.key=this.Za=d,this.value=e;d++}return null}return 0<b?(a=a[0],this.key=0,this.value=a):null};$a.prototype.any=function(a){var b=this.Db;b.Sa=null;this.Za=-1;b=b.s;for(var c=b.length,d=this.pf,e=0;e<c;e++){var f=b[e];if((null===d||d(f))&&a(f))return!0}return!1};
$a.prototype.all=function(a){var b=this.Db;b.Sa=null;this.Za=-1;b=b.s;for(var c=b.length,d=this.pf,e=0;e<c;e++){var f=b[e];if((null===d||d(f))&&!a(f))return!1}return!0};$a.prototype.each=function(a){var b=this.Db;b.Sa=null;this.Za=-1;b=b.s;for(var c=b.length,d=this.pf,e=0;e<c;e++){var f=b[e];(null===d||d(f))&&a(f)}return this};
$a.prototype.map=function(a){var b=this.Db;b.Sa=null;this.Za=-1;var c=[];b=b.s;for(var d=b.length,e=this.pf,f=0;f<d;f++){var g=b[f];(null===e||e(g))&&c.push(a(g))}a=new F;a.s=c;a.zb();return a.iterator};$a.prototype.filter=function(a){var b=this.Db;b.Sa=null;this.Za=-1;var c=[];b=b.s;for(var d=b.length,e=this.pf,f=0;f<d;f++){var g=b[f];(null===e||e(g))&&a(g)&&c.push(g)}a=new F;a.s=c;a.zb();return a.iterator};
$a.prototype.be=function(){this.key=-1;this.value=null;this.qa=-1;this.pf=null;this.Db.Sa=this};$a.prototype.toString=function(){return"ListIterator@"+this.Za+"/"+this.Db.count};
ma.Object.defineProperties($a.prototype,{iterator:{get:function(){return this}},predicate:{get:function(){return this.pf},set:function(a){this.pf=a}},count:{get:function(){var a=this.pf;if(null!==a){for(var b=0,c=this.Db.s,d=c.length,e=0;e<d;e++)a(c[e])&&b++;return b}return this.Db.s.length}}});$a.prototype.first=$a.prototype.first;$a.prototype.hasNext=$a.prototype.yd;$a.prototype.next=$a.prototype.next;
$a.prototype.reset=$a.prototype.reset;$a.className="ListIterator";function ab(a){this.Db=a;a.Gg=null;this.qa=a.Ja;this.Za=a.s.length}ab.prototype.reset=function(){var a=this.Db;a.Gg=null;this.qa=a.Ja;this.Za=a.s.length};ab.prototype.next=function(){var a=this.Db;if(a.Ja!==this.qa&&0>this.key)return!1;var b=--this.Za;if(0<=b)return this.key=b,this.value=a.s[b],!0;this.be();return!1};ab.prototype.yd=function(){return this.next()};
ab.prototype.first=function(){var a=this.Db;this.qa=a.Ja;var b=a.s;this.Za=a=b.length-1;return 0<=a?(b=b[a],this.key=a,this.value=b):null};ab.prototype.any=function(a){var b=this.Db;b.Gg=null;b=b.s;var c=b.length;this.Za=c;for(--c;0<=c;c--)if(a(b[c]))return!0;return!1};ab.prototype.all=function(a){var b=this.Db;b.Gg=null;b=b.s;var c=b.length;this.Za=c;for(--c;0<=c;c--)if(!a(b[c]))return!1;return!0};
ab.prototype.each=function(a){var b=this.Db;b.Gg=null;b=b.s;var c=b.length;this.Za=c;for(--c;0<=c;c--)a(b[c]);return this};ab.prototype.map=function(a){var b=this.Db;b.Gg=null;var c=[];b=b.s;var d=b.length;this.Za=d;for(--d;0<=d;d--)c.push(a(b[d]));a=new F;a.s=c;a.zb();return a.iterator};ab.prototype.filter=function(a){var b=this.Db;b.Gg=null;var c=[];b=b.s;var d=b.length;this.Za=d;for(--d;0<=d;d--){var e=b[d];a(e)&&c.push(e)}a=new F;a.s=c;a.zb();return a.iterator};
ab.prototype.be=function(){this.key=-1;this.value=null;this.qa=-1;this.Db.Gg=this};ab.prototype.toString=function(){return"ListIteratorBackwards("+this.Za+"/"+this.Db.count+")"};ma.Object.defineProperties(ab.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.Db.s.length}}});ab.prototype.first=ab.prototype.first;ab.prototype.hasNext=ab.prototype.yd;ab.prototype.next=ab.prototype.next;ab.prototype.reset=ab.prototype.reset;
ab.className="ListIteratorBackwards";function F(a){Qa(this);this._isFrozen=!1;this.s=[];this.Ja=0;this.Gg=this.Sa=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=F.prototype;t.zb=function(){var a=this.Ja;a++;999999999<a&&(a=0);this.Ja=a};t.freeze=function(){this._isFrozen=!0;return this};t.ja=function(){this._isFrozen=!1;return this};t.toString=function(){return"List()#"+bb(this)};
t.add=function(a){if(null===a)return this;this._isFrozen&&va(this,a);this.s.push(a);this.zb();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(Aa(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.zb();return this};t.clear=function(){this._isFrozen&&va(this);this.s.length=0;this.zb()};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.L=function(a){var b=this.s;(0>a||a>=b.length)&&xa(a,"0 <= i < length",F,"elt:i");return b[a]};t.get=function(a){return this.L(a)};t.Zc=function(a,b){var c=this.s;(0>a||a>=c.length)&&xa(a,"0 <= i < length",F,"setElt:i");this._isFrozen&&va(this,a);c[a]=b};t.set=function(a,b){this.Zc(a,b)};t.first=function(){var a=this.s;return 0===a.length?null:a[0]};t.hc=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};F.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};F.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};F.prototype.each=function(a){for(var b=this.s,c=b.length,d=0;d<c;d++)a(b[d]);return this};F.prototype.map=function(a){for(var b=new F,c=[],d=this.s,e=d.length,f=0;f<e;f++)c.push(a(d[f]));b.s=c;b.zb();return b};
F.prototype.filter=function(a){for(var b=new F,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.zb();return b};t=F.prototype;t.Gb=function(a,b){0>a&&xa(a,">= 0",F,"insertAt:i");this._isFrozen&&va(this,a);var c=this.s;a>=c.length?c.push(b):c.splice(a,0,b);this.zb()};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.zb();return!0};t.delete=function(a){return this.remove(a)};
t.nb=function(a){var b=this.s;(0>a||a>=b.length)&&xa(a,"0 <= i < length",F,"removeAt:i");this._isFrozen&&va(this,a);a===b.length-1?b.pop():b.splice(a,1);this.zb()};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.zb();return this};
F.prototype.copy=function(){var a=new F,b=this.s;0<b.length&&(a.s=Array.prototype.slice.call(b));return a};t=F.prototype;t.Fa=function(){for(var a=this.s,b=this.count,c=Array(b),d=0;d<b;d++)c[d]=a[d];return c};t.Gv=function(){for(var a=new H,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.zb();return this};
t.yi=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)&&xa(b,"0 <= from < length",F,"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.zb()),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.zb();return this};
t.reverse=function(){this._isFrozen&&va(this);this.s.reverse();this.zb();return this};
ma.Object.defineProperties(F.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 Ya;var a=this.Sa;return null!==a?(a.reset(),a):new $a(this)}},iteratorBackwards:{
get:function(){if(0>=this.s.length)return Ya;var a=this.Gg;return null!==a?(a.reset(),a):new ab(this)}}});F.prototype.reverse=F.prototype.reverse;F.prototype.sortRange=F.prototype.yi;F.prototype.sort=F.prototype.sort;F.prototype.toSet=F.prototype.Gv;F.prototype.toArray=F.prototype.Fa;F.prototype.removeRange=F.prototype.removeRange;F.prototype.removeAt=F.prototype.nb;F.prototype["delete"]=F.prototype.delete;F.prototype.remove=F.prototype.remove;F.prototype.insertAt=F.prototype.Gb;
F.prototype.pop=F.prototype.pop;F.prototype.last=F.prototype.hc;F.prototype.first=F.prototype.first;F.prototype.set=F.prototype.set;F.prototype.setElt=F.prototype.Zc;F.prototype.get=F.prototype.get;F.prototype.elt=F.prototype.L;F.prototype.indexOf=F.prototype.indexOf;F.prototype.has=F.prototype.has;F.prototype.contains=F.prototype.contains;F.prototype.clear=F.prototype.clear;F.prototype.addAll=F.prototype.addAll;F.prototype.push=F.prototype.push;F.prototype.add=F.prototype.add;F.prototype.thaw=F.prototype.ja;
F.prototype.freeze=F.prototype.freeze;F.className="List";function cb(a){this.dg=a;a.Sa=null;this.qa=a.Ja;this.sa=null}cb.prototype.reset=function(){var a=this.dg;a.Sa=null;this.qa=a.Ja;this.sa=null};cb.prototype.next=function(){var a=this.dg;if(a.Ja!==this.qa&&null===this.key)return!1;var b=this.sa;b=null===b?a.ea:b.ua;if(null!==b)return this.sa=b,this.value=b.value,this.key=b.key,!0;this.be();return!1};cb.prototype.yd=function(){return this.next()};
cb.prototype.first=function(){var a=this.dg;this.qa=a.Ja;a=a.ea;if(null!==a){this.sa=a;var b=a.value;this.key=a.key;return this.value=b}return null};cb.prototype.any=function(a){var b=this.dg;this.sa=b.Sa=null;for(b=b.ea;null!==b;){if(a(b.value))return!0;b=b.ua}return!1};cb.prototype.all=function(a){var b=this.dg;this.sa=b.Sa=null;for(b=b.ea;null!==b;){if(!a(b.value))return!1;b=b.ua}return!0};cb.prototype.each=function(a){var b=this.dg;this.sa=b.Sa=null;for(b=b.ea;null!==b;)a(b.value),b=b.ua;return this};
cb.prototype.map=function(a){var b=this.dg;b.Sa=null;var c=new F;for(b=b.ea;null!==b;)c.add(a(b.value)),b=b.ua;return c.iterator};cb.prototype.filter=function(a){var b=this.dg;b.Sa=null;var c=new F;for(b=b.ea;null!==b;){var d=b.value;a(d)&&c.add(d);b=b.ua}return c.iterator};cb.prototype.be=function(){this.value=this.key=null;this.qa=-1;this.dg.Sa=this};cb.prototype.toString=function(){return null!==this.sa?"SetIterator@"+this.sa.value:"SetIterator"};
ma.Object.defineProperties(cb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.dg.Pb}}});cb.prototype.first=cb.prototype.first;cb.prototype.hasNext=cb.prototype.yd;cb.prototype.next=cb.prototype.next;cb.prototype.reset=cb.prototype.reset;cb.className="SetIterator";
function H(a){Qa(this);this._isFrozen=!1;this.Qb={};this.Pb=0;this.Sa=null;this.Ja=0;this.jf=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=H.prototype;t.zb=function(){var a=this.Ja;a++;999999999<a&&(a=0);this.Ja=a};t.freeze=function(){this._isFrozen=!0;return this};t.ja=function(){this._isFrozen=!1;return this};t.toString=function(){return"Set()#"+bb(this)};
t.add=function(a){if(null===a)return this;this._isFrozen&&va(this,a);var b=a;za(a)&&(b=fb(a));void 0===this.Qb[b]&&(this.Pb++,a=new ib(a,a),this.Qb[b]=a,b=this.jf,null===b?this.ea=a:(a.jl=b,b.ua=a),this.jf=a,this.zb());return this};t.addAll=function(a){if(null===a)return this;this._isFrozen&&va(this);if(Aa(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 za(a)&&(b=bb(a),void 0===b)?!1:void 0!==this.Qb[b]};t.has=function(a){return this.contains(a)};t.Ty=function(a){if(null===a)return!0;for(a=a.iterator;a.next();)if(!this.contains(a.value))return!1;return!0};t.Uy=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};
H.prototype.any=function(a){for(var b=this.ea;null!==b;){if(a(b.value))return!0;b=b.ua}return!1};H.prototype.all=function(a){for(var b=this.ea;null!==b;){if(!a(b.value))return!1;b=b.ua}return!0};H.prototype.each=function(a){for(var b=this.ea;null!==b;)a(b.value),b=b.ua;return this};H.prototype.map=function(a){for(var b=new H,c=this.ea;null!==c;)b.add(a(c.value)),c=c.ua;return b};H.prototype.filter=function(a){for(var b=new H,c=this.ea;null!==c;){var d=c.value;a(d)&&b.add(d);c=c.ua}return b};t=H.prototype;
t.remove=function(a){if(null===a)return!1;this._isFrozen&&va(this,a);var b=a;if(za(a)&&(b=bb(a),void 0===b))return!1;a=this.Qb[b];if(void 0===a)return!1;var c=a.ua,d=a.jl;null!==c&&(c.jl=d);null!==d&&(d.ua=c);this.ea===a&&(this.ea=c);this.jf===a&&(this.jf=d);delete this.Qb[b];this.Pb--;this.zb();return!0};t.delete=function(a){return this.remove(a)};
t.ep=function(a){if(null===a)return this;this._isFrozen&&va(this);if(Aa(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.oA=function(a){if(null===a||0===this.count)return this;this._isFrozen&&va(this);var b=new H;b.addAll(a);a=[];for(var c=this.iterator;c.next();){var d=c.value;b.contains(d)||a.push(d)}this.ep(a);return this};
t.clear=function(){this._isFrozen&&va(this);this.Qb={};this.Pb=0;null!==this.Sa&&this.Sa.reset();this.jf=this.ea=null;this.zb()};H.prototype.copy=function(){var a=new H,b=this.Qb,c;for(c in b)a.add(b[c].value);return a};H.prototype.Fa=function(){var a=Array(this.Pb),b=this.Qb,c=0,d;for(d in b)a[c]=b[d].value,c++;return a};H.prototype.Fv=function(){var a=new F,b=this.Qb,c;for(c in b)a.add(b[c].value);return a};function Qa(a){a.__gohashid=jb++}
function fb(a){var b=a.__gohashid;void 0===b&&(b=jb++,a.__gohashid=b);return b}function bb(a){return a.__gohashid}ma.Object.defineProperties(H.prototype,{count:{get:function(){return this.Pb}},size:{get:function(){return this.Pb}},iterator:{get:function(){if(0>=this.Pb)return Ya;var a=this.Sa;return null!==a?(a.reset(),a):new cb(this)}}});H.prototype.toList=H.prototype.Fv;H.prototype.toArray=H.prototype.Fa;
H.prototype.clear=H.prototype.clear;H.prototype.retainAll=H.prototype.oA;H.prototype.removeAll=H.prototype.ep;H.prototype["delete"]=H.prototype.delete;H.prototype.remove=H.prototype.remove;H.prototype.first=H.prototype.first;H.prototype.containsAny=H.prototype.Uy;H.prototype.containsAll=H.prototype.Ty;H.prototype.has=H.prototype.has;H.prototype.contains=H.prototype.contains;H.prototype.addAll=H.prototype.addAll;H.prototype.add=H.prototype.add;H.prototype.thaw=H.prototype.ja;H.prototype.freeze=H.prototype.freeze;
var jb=1;H.className="Set";H.uniqueHash=Qa;H.hashIdUnique=fb;H.hashId=bb;function kb(a){this.ma=a;this.qa=a.Ja;this.sa=null}kb.prototype.reset=function(){this.qa=this.ma.Ja;this.sa=null};kb.prototype.next=function(){var a=this.ma;if(a.Ja!==this.qa&&null===this.key)return!1;var b=this.sa;b=null===b?a.ea:b.ua;if(null!==b)return this.sa=b,this.value=this.key=a=b.key,!0;this.be();return!1};kb.prototype.yd=function(){return this.next()};
kb.prototype.first=function(){var a=this.ma;this.qa=a.Ja;a=a.ea;return null!==a?(this.sa=a,this.value=this.key=a=a.key):null};kb.prototype.any=function(a){var b=this.ma;this.sa=null;for(b=b.ea;null!==b;){if(a(b.key))return!0;b=b.ua}return!1};kb.prototype.all=function(a){var b=this.ma;this.sa=null;for(b=b.ea;null!==b;){if(!a(b.key))return!1;b=b.ua}return!0};kb.prototype.each=function(a){var b=this.ma;this.sa=null;for(b=b.ea;null!==b;)a(b.key),b=b.ua;return this};
kb.prototype.map=function(a){var b=this.ma;this.sa=null;var c=new F;for(b=b.ea;null!==b;)c.add(a(b.key)),b=b.ua;return c.iterator};kb.prototype.filter=function(a){var b=this.ma;this.sa=null;var c=new F;for(b=b.ea;null!==b;){var d=b.key;a(d)&&c.add(d);b=b.ua}return c.iterator};kb.prototype.be=function(){this.value=this.key=null;this.qa=-1};kb.prototype.toString=function(){return null!==this.sa?"MapKeySetIterator@"+this.sa.value:"MapKeySetIterator"};
ma.Object.defineProperties(kb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ma.Pb}}});kb.prototype.first=kb.prototype.first;kb.prototype.hasNext=kb.prototype.yd;kb.prototype.next=kb.prototype.next;kb.prototype.reset=kb.prototype.reset;kb.className="MapKeySetIterator";function lb(a){H.call(this);Qa(this);this._isFrozen=!0;this.ma=a}la(lb,H);t=lb.prototype;t.freeze=function(){return this};t.ja=function(){return this};
t.toString=function(){return"MapKeySet("+this.ma.toString()+")"};t.add=function(){C("This Set is read-only: "+this.toString())};t.contains=function(a){return this.ma.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.ma.ea;return null!==a?a.key:null};
lb.prototype.any=function(a){for(var b=this.ma.ea;null!==b;){if(a(b.key))return!0;b=b.ua}return!1};lb.prototype.all=function(a){for(var b=this.ma.ea;null!==b;){if(!a(b.key))return!1;b=b.ua}return!0};lb.prototype.each=function(a){for(var b=this.ma.ea;null!==b;)a(b.key),b=b.ua;return this};lb.prototype.map=function(a){for(var b=new H,c=this.ma.ea;null!==c;)b.add(a(c.key)),c=c.ua;return b};lb.prototype.filter=function(a){for(var b=new H,c=this.ma.ea;null!==c;){var d=c.key;a(d)&&b.add(d);c=c.ua}return b};
lb.prototype.copy=function(){return new lb(this.ma)};lb.prototype.Gv=function(){var a=new H,b=this.ma.Qb,c;for(c in b)a.add(b[c].key);return a};lb.prototype.Fa=function(){var a=this.ma.Qb,b=Array(this.ma.Pb),c=0,d;for(d in a)b[c]=a[d].key,c++;return b};lb.prototype.Fv=function(){var a=new F,b=this.ma.Qb,c;for(c in b)a.add(b[c].key);return a};
ma.Object.defineProperties(lb.prototype,{count:{get:function(){return this.ma.Pb}},size:{get:function(){return this.ma.Pb}},iterator:{get:function(){return 0>=this.ma.Pb?Ya:new kb(this.ma)}}});lb.prototype.toList=lb.prototype.Fv;lb.prototype.toArray=lb.prototype.Fa;lb.prototype.toSet=lb.prototype.Gv;lb.prototype.first=lb.prototype.first;lb.prototype.clear=lb.prototype.clear;lb.prototype["delete"]=lb.prototype.delete;
lb.prototype.remove=lb.prototype.remove;lb.prototype.has=lb.prototype.has;lb.prototype.contains=lb.prototype.contains;lb.prototype.add=lb.prototype.add;lb.prototype.thaw=lb.prototype.ja;lb.prototype.freeze=lb.prototype.freeze;lb.className="MapKeySet";function mb(a){this.ma=a;a.hf=null;this.qa=a.Ja;this.sa=null}mb.prototype.reset=function(){var a=this.ma;a.hf=null;this.qa=a.Ja;this.sa=null};
mb.prototype.next=function(){var a=this.ma;if(a.Ja!==this.qa&&null===this.key)return!1;var b=this.sa;b=null===b?a.ea:b.ua;if(null!==b)return this.sa=b,this.value=b.value,this.key=b.key,!0;this.be();return!1};mb.prototype.yd=function(){return this.next()};mb.prototype.first=function(){var a=this.ma;this.qa=a.Ja;a=a.ea;if(null!==a){this.sa=a;var b=a.value;this.key=a.key;return this.value=b}return null};
mb.prototype.any=function(a){var b=this.ma;this.sa=b.hf=null;for(b=b.ea;null!==b;){if(a(b.value))return!0;b=b.ua}return!1};mb.prototype.all=function(a){var b=this.ma;this.sa=b.hf=null;for(b=b.ea;null!==b;){if(!a(b.value))return!1;b=b.ua}return!0};mb.prototype.each=function(a){var b=this.ma;this.sa=b.hf=null;for(b=b.ea;null!==b;)a(b.value),b=b.ua;return this};mb.prototype.map=function(a){var b=this.ma;this.sa=b.hf=null;var c=new F;for(b=b.ea;null!==b;)c.add(a(b.value)),b=b.ua;return c.iterator};
mb.prototype.filter=function(a){var b=this.ma;this.sa=b.hf=null;var c=new F;for(b=b.ea;null!==b;){var d=b.value;a(d)&&c.add(d);b=b.ua}return c.iterator};mb.prototype.be=function(){this.value=this.key=null;this.qa=-1;this.ma.hf=this};mb.prototype.toString=function(){return null!==this.sa?"MapValueSetIterator@"+this.sa.value:"MapValueSetIterator"};ma.Object.defineProperties(mb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ma.Pb}}});
mb.prototype.first=mb.prototype.first;mb.prototype.hasNext=mb.prototype.yd;mb.prototype.next=mb.prototype.next;mb.prototype.reset=mb.prototype.reset;mb.className="MapValueSetIterator";function ib(a,b){this.key=a;this.value=b;this.jl=this.ua=null}ib.prototype.toString=function(){return"{"+this.key+":"+this.value+"}"};ib.className="KeyValuePair";function nb(a){this.ma=a;a.Sa=null;this.qa=a.Ja;this.sa=null}nb.prototype.reset=function(){var a=this.ma;a.Sa=null;this.qa=a.Ja;this.sa=null};
nb.prototype.next=function(){var a=this.ma;if(a.Ja!==this.qa&&null===this.key)return!1;var b=this.sa;b=null===b?a.ea:b.ua;if(null!==b)return this.sa=b,this.key=b.key,this.value=b.value,!0;this.be();return!1};nb.prototype.yd=function(){return this.next()};nb.prototype.first=function(){var a=this.ma;this.qa=a.Ja;a=a.ea;return null!==a?(this.sa=a,this.key=a.key,this.value=a.value,a):null};nb.prototype.any=function(a){var b=this.ma;this.sa=b.Sa=null;for(b=b.ea;null!==b;){if(a(b))return!0;b=b.ua}return!1};
nb.prototype.all=function(a){var b=this.ma;this.sa=b.Sa=null;for(b=b.ea;null!==b;){if(!a(b))return!1;b=b.ua}return!0};nb.prototype.each=function(a){var b=this.ma;this.sa=b.Sa=null;for(b=b.ea;null!==b;)a(b),b=b.ua;return this};nb.prototype.map=function(a){var b=this.ma;this.sa=b.Sa=null;var c=new F;for(b=b.ea;null!==b;)c.add(a(b)),b=b.ua;return c.iterator};nb.prototype.filter=function(a){var b=this.ma;this.sa=b.Sa=null;var c=new F;for(b=b.ea;null!==b;)a(b)&&c.add(b),b=b.ua;return c.iterator};
nb.prototype.be=function(){this.value=this.key=null;this.qa=-1;this.ma.Sa=this};nb.prototype.toString=function(){return null!==this.sa?"MapIterator@"+this.sa:"MapIterator"};ma.Object.defineProperties(nb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ma.Pb}}});nb.prototype.first=nb.prototype.first;nb.prototype.hasNext=nb.prototype.yd;nb.prototype.next=nb.prototype.next;nb.prototype.reset=nb.prototype.reset;
nb.className="MapIterator";function ob(a){Qa(this);this._isFrozen=!1;this.Qb={};this.Pb=0;this.hf=this.Sa=null;this.Ja=0;this.jf=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=ob.prototype;t.zb=function(){var a=this.Ja;a++;999999999<a&&(a=0);this.Ja=a};t.freeze=function(){this._isFrozen=!0;return this};t.ja=function(){this._isFrozen=!1;return this};t.toString=function(){return"Map()#"+bb(this)};
t.add=function(a,b){this._isFrozen&&va(this,a);var c=a;za(a)&&(c=fb(a));var d=this.Qb[c];void 0===d?(this.Pb++,a=new ib(a,b),this.Qb[c]=a,c=this.jf,null===c?this.ea=a:(a.jl=c,c.ua=a),this.jf=a,this.zb()):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(Aa(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 ob)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};ob.prototype.any=function(a){for(var b=this.ea;null!==b;){if(a(b))return!0;b=b.ua}return!1};ob.prototype.all=function(a){for(var b=this.ea;null!==b;){if(!a(b))return!1;b=b.ua}return!0};
ob.prototype.each=function(a){for(var b=this.ea;null!==b;)a(b),b=b.ua;return this};ob.prototype.map=function(a){for(var b=new ob,c=this.ea;null!==c;)b.add(c.key,a(c)),c=c.ua;return b};ob.prototype.filter=function(a){for(var b=new ob,c=this.ea;null!==c;)a(c)&&b.add(c.key,c.value),c=c.ua;return b};t=ob.prototype;t.contains=function(a){var b=a;return za(a)&&(b=bb(a),void 0===b)?!1:void 0!==this.Qb[b]};t.has=function(a){return this.contains(a)};
t.I=function(a){var b=a;if(za(a)&&(b=bb(a),void 0===b))return null;a=this.Qb[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(za(a)&&(b=bb(a),void 0===b))return!1;a=this.Qb[b];if(void 0===a)return!1;var c=a.ua,d=a.jl;null!==c&&(c.jl=d);null!==d&&(d.ua=c);this.ea===a&&(this.ea=c);this.jf===a&&(this.jf=d);delete this.Qb[b];this.Pb--;this.zb();return!0};t.delete=function(a){return this.remove(a)};
t.clear=function(){this._isFrozen&&va(this);this.Qb={};this.Pb=0;null!==this.Sa&&this.Sa.reset();null!==this.hf&&this.hf.reset();this.jf=this.ea=null;this.zb()};ob.prototype.copy=function(){var a=new ob,b=this.Qb,c;for(c in b){var d=b[c];a.add(d.key,d.value)}return a};ob.prototype.Fa=function(){var a=this.Qb,b=Array(this.Pb),c=0,d;for(d in a){var e=a[d];b[c]=new ib(e.key,e.value);c++}return b};ob.prototype.Lf=function(){return new lb(this)};
ma.Object.defineProperties(ob.prototype,{count:{get:function(){return this.Pb}},size:{get:function(){return this.Pb}},iterator:{get:function(){if(0>=this.count)return Ya;var a=this.Sa;return null!==a?(a.reset(),a):new nb(this)}},iteratorKeys:{get:function(){return 0>=this.count?Ya:new kb(this)}},iteratorValues:{get:function(){if(0>=this.count)return Ya;
var a=this.hf;return null!==a?(a.reset(),a):new mb(this)}}});ob.prototype.toKeySet=ob.prototype.Lf;ob.prototype.toArray=ob.prototype.Fa;ob.prototype.clear=ob.prototype.clear;ob.prototype["delete"]=ob.prototype.delete;ob.prototype.remove=ob.prototype.remove;ob.prototype.get=ob.prototype.get;ob.prototype.getValue=ob.prototype.I;ob.prototype.has=ob.prototype.has;ob.prototype.contains=ob.prototype.contains;ob.prototype.first=ob.prototype.first;ob.prototype.addAll=ob.prototype.addAll;
ob.prototype.set=ob.prototype.set;ob.prototype.add=ob.prototype.add;ob.prototype.thaw=ob.prototype.ja;ob.prototype.freeze=ob.prototype.freeze;ob.className="Map";function J(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 pb,qb,rb,sb,tb;J.prototype.assign=function(a){this.x=a.x;this.y=a.y;return this};J.prototype.h=function(a,b){this.x=a;this.y=b;return this};
J.prototype.rg=function(a,b){this.x=a;this.y=b;return this};J.prototype.set=function(a){this.x=a.x;this.y=a.y;return this};J.prototype.copy=function(){var a=new J;a.x=this.x;a.y=this.y;return a};t=J.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 ub(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 J(c,e)}return new J}function vb(a){return a.x.toString()+" "+a.y.toString()}t.toString=function(){return"Point("+this.x+","+this.y+")"};t.C=function(a){return a instanceof J?this.x===a.x&&this.y===a.y:!1};
t.gi=function(a,b){return this.x===a&&this.y===b};t.Xa=function(a){return K.B(this.x,a.x)&&K.B(this.y,a.y)};t.add=function(a){this.x+=a.x;this.y+=a.y;return this};t.qe=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};
J.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=J.prototype;t.scale=function(a,b){this.x*=a;this.y*=b;return this};t.Bf=function(a){var b=a.x-this.x;a=a.y-this.y;return b*b+a*a};t.xd=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.ab=function(a){return wb(a.x-this.x,a.y-this.y)};t.direction=function(a,b){return wb(a-this.x,b-this.y)};function wb(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.Sy=function(a,b){return K.Dl(a.x,a.y,b.x,b.y,this.x,this.y)};
t.eA=function(a,b,c,d){K.oh(a,b,c,d,this.x,this.y,this);return this};t.fA=function(a,b){K.oh(a.x,a.y,b.x,b.y,this.x,this.y,this);return this};t.tA=function(a,b,c,d){K.Mo(this.x,this.y,a,b,c,d,this);return this};t.uA=function(a,b){K.Mo(this.x,this.y,a.x,a.y,b.width,b.height,this);return this};t.wi=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.xi=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.Ga(this);return this};function xb(a,b){b.Od(a);return a}function yb(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 zb(a,b,c,d){a=c-a;b=d-b;return a*a+b*b}function Ab(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.w=function(){return isFinite(this.x)&&isFinite(this.y)};J.alloc=function(){var a=Bb.pop();return void 0===a?new J:a};J.allocAt=function(a,b){var c=Bb.pop();if(void 0===c)return new J(a,b);c.x=a;c.y=b;return c};J.free=function(a){Bb.push(a)};J.prototype.isReal=J.prototype.w;J.prototype.setSpot=J.prototype.xi;J.prototype.setRectSpot=J.prototype.wi;J.prototype.snapToGridPoint=J.prototype.uA;J.prototype.snapToGrid=J.prototype.tA;J.prototype.projectOntoLineSegmentPoint=J.prototype.fA;
J.prototype.projectOntoLineSegment=J.prototype.eA;J.intersectingLineSegments=function(a,b,c,d,e,f,g,h){return K.Ol(a,b,c,d,e,f,g,h)};J.prototype.compareWithLineSegmentPoint=J.prototype.Sy;J.compareWithLineSegment=function(a,b,c,d,e,f){return K.Dl(a,b,c,d,e,f)};J.prototype.direction=J.prototype.direction;J.prototype.directionPoint=J.prototype.ab;J.prototype.normalize=J.prototype.normalize;J.prototype.distanceSquared=J.prototype.xd;J.prototype.distanceSquaredPoint=J.prototype.Bf;J.prototype.scale=J.prototype.scale;
J.prototype.rotate=J.prototype.rotate;J.prototype.offset=J.prototype.offset;J.prototype.subtract=J.prototype.qe;J.prototype.add=J.prototype.add;J.prototype.equalsApprox=J.prototype.Xa;J.prototype.equalTo=J.prototype.gi;J.prototype.equals=J.prototype.C;J.prototype.set=J.prototype.set;J.prototype.setTo=J.prototype.rg;var Bb=[];J.className="Point";J.parse=ub;J.stringify=vb;J.distanceLineSegmentSquared=yb;J.distanceSquared=zb;J.direction=Ab;J.Origin=pb=(new J(0,0)).ha();
J.InfiniteTopLeft=qb=(new J(-Infinity,-Infinity)).ha();J.InfiniteBottomRight=rb=(new J(Infinity,Infinity)).ha();J.SixPoint=sb=(new J(6,6)).ha();J.NoPoint=tb=(new J(NaN,NaN)).ha();J.parse=ub;J.stringify=vb;J.distanceLineSegmentSquared=yb;J.distanceSquared=zb;J.direction=Ab;
function L(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 Cb,Gb,Hb,Ib,Jb,Kb,Lb;L.prototype.assign=function(a){this.width=a.width;this.height=a.height;return this};L.prototype.h=function(a,b){this.width=a;this.height=b;return this};L.prototype.rg=function(a,b){this.width=a;this.height=b;return this};
L.prototype.set=function(a){this.width=a.width;this.height=a.height;return this};L.prototype.copy=function(){var a=new L;a.width=this.width;a.height=this.height;return a};t=L.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 Mb(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 L(c,e)}return new L}function Nb(a){return a.width.toString()+" "+a.height.toString()}t.toString=function(){return"Size("+this.width+","+this.height+")"};t.C=function(a){return a instanceof L?this.width===a.width&&this.height===a.height:!1};t.gi=function(a,b){return this.width===a&&this.height===b};
t.Xa=function(a){return K.B(this.width,a.width)&&K.B(this.height,a.height)};t.Ac=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.w=function(){return isFinite(this.width)&&isFinite(this.height)};L.alloc=function(){var a=Ob.pop();return void 0===a?new L:a};L.free=function(a){Ob.push(a)};L.prototype.isReal=L.prototype.w;L.prototype.inflate=L.prototype.Ac;L.prototype.equalsApprox=L.prototype.Xa;L.prototype.equalTo=L.prototype.gi;
L.prototype.equals=L.prototype.C;L.prototype.set=L.prototype.set;L.prototype.setTo=L.prototype.rg;var Ob=[];L.className="Size";L.parse=Mb;L.stringify=Nb;L.ZeroSize=Cb=(new L(0,0)).ha();L.OneSize=Gb=(new L(1,1)).ha();L.SixSize=Hb=(new L(6,6)).ha();L.EightSize=Ib=(new L(8,8)).ha();L.TenSize=Jb=(new L(10,10)).ha();L.InfiniteSize=Kb=(new L(Infinity,Infinity)).ha();L.NoSize=Lb=(new L(NaN,NaN)).ha();L.parse=Mb;L.stringify=Nb;
function N(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 J?(c=a.x,a=a.y,b instanceof J?(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 L?(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=N.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 Pb(a,b,c){a.width=b;a.height=c}t.rg=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.$c=function(a){this.x=a.x;this.y=a.y;return this};t.sA=function(a){this.width=a.width;this.height=a.height;return this};N.prototype.copy=function(){var a=new N;a.x=this.x;a.y=this.y;a.width=this.width;a.height=this.height;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 Qb(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));for(var f=0;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));for(var g=0;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));return new N(c,e,f,g)}return new N}
function Rb(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 N?this.x===a.x&&this.y===a.y&&this.width===a.width&&this.height===a.height:!1};t.gi=function(a,b,c,d){return this.x===a&&this.y===b&&this.width===c&&this.height===d};t.Xa=function(a){return K.B(this.x,a.x)&&K.B(this.y,a.y)&&K.B(this.width,a.width)&&K.B(this.height,a.height)};
function Ub(a,b){return K.$(a.x,b.x)&&K.$(a.y,b.y)&&K.$(a.width,b.width)&&K.$(a.height,b.height)}t.ca=function(a){return this.x<=a.x&&this.x+this.width>=a.x&&this.y<=a.y&&this.y+this.height>=a.y};t.Qe=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.Ac=function(a,b){return Vb(this,b,a,b,a)};t.Bo=function(a){return Vb(this,a.top,a.right,a.bottom,a.left)};t.Dv=function(a){return Vb(this,-a.top,-a.right,-a.bottom,-a.left)};t.Iz=function(a,b,c,d){return Vb(this,a,b,c,d)};function Vb(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.Ex=function(a){return Wb(this,a.x,a.y,a.width,a.height)};t.Uu=function(a,b,c,d){return Wb(this,a,b,c,d)};
function Wb(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.Vc=function(a){return this.Vu(a.x,a.y,a.width,a.height)};t.Vu=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 Xb(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.Xe=function(a){return Yb(this,a.x,a.y,0,0)};t.ad=function(a){return Yb(this,a.x,a.y,a.width,a.height)};t.Iv=function(a,b,c,d){void 0===c&&(c=0);void 0===d&&(d=0);return Yb(this,a,b,c,d)};
function Yb(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.xi=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 Zb(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 $b(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.w=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)};t.Nz=function(){return 0===this.width&&0===this.height};N.alloc=function(){var a=ac.pop();return void 0===a?new N:a};N.allocAt=function(a,b,c,d){var e=ac.pop();return void 0===e?new N(a,b,c,d):e.h(a,b,c,d)};N.free=function(a){ac.push(a)};
ma.Object.defineProperties(N.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 J(this.x,this.y)},set:function(a){this.x=a.x;this.y=a.y}},size:{get:function(){return new L(this.width,this.height)},set:function(a){this.width=a.width;this.height=a.height}},center:{get:function(){return new J(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}}});N.prototype.isEmpty=N.prototype.Nz;N.prototype.isReal=N.prototype.w;N.intersectsLineSegment=function(a,b,c,d,e,f,g,h){return K.Fx(a,b,c,d,e,f,g,h)};N.prototype.setSpot=N.prototype.xi;N.prototype.union=N.prototype.Iv;N.prototype.unionRect=N.prototype.ad;N.prototype.unionPoint=N.prototype.Xe;N.prototype.intersects=N.prototype.Vu;
N.prototype.intersectsRect=N.prototype.Vc;N.prototype.intersect=N.prototype.Uu;N.prototype.intersectRect=N.prototype.Ex;N.prototype.grow=N.prototype.Iz;N.prototype.subtractMargin=N.prototype.Dv;N.prototype.addMargin=N.prototype.Bo;N.prototype.inflate=N.prototype.Ac;N.prototype.offset=N.prototype.offset;N.prototype.contains=N.prototype.contains;N.prototype.containsRect=N.prototype.Qe;N.prototype.containsPoint=N.prototype.ca;N.prototype.equalsApprox=N.prototype.Xa;N.prototype.equalTo=N.prototype.gi;
N.prototype.equals=N.prototype.C;N.prototype.setSize=N.prototype.sA;N.prototype.setPoint=N.prototype.$c;N.prototype.set=N.prototype.set;N.prototype.setTo=N.prototype.rg;var bc=null,cc=null,ac=[];N.className="Rect";N.parse=Qb;N.stringify=Rb;N.contains=Zb;N.intersects=$b;N.ZeroRect=bc=(new N(0,0,0,0)).ha();N.NoRect=cc=(new N(NaN,NaN,NaN,NaN)).ha();N.parse=Qb;N.stringify=Rb;N.contains=Zb;N.intersects=$b;
function hc(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}hc.prototype.assign=function(a){this.top=a.top;this.right=a.right;this.bottom=a.bottom;this.left=a.left;return this};
hc.prototype.rg=function(a,b,c,d){this.top=a;this.right=b;this.bottom=c;this.left=d;return this};hc.prototype.set=function(a){this.top=a.top;this.right=a.right;this.bottom=a.bottom;this.left=a.left;return this};hc.prototype.copy=function(){var a=new hc;a.top=this.top;a.right=this.right;a.bottom=this.bottom;a.left=this.left;return a};t=hc.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 ic(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 hc;for(var e=NaN;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));if(isNaN(e))return new hc(c);for(var f=NaN;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));if(isNaN(f))return new hc(c,e);for(var g=NaN;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));return isNaN(g)?new hc(c,e):new hc(c,e,f,g)}return new hc}
function jc(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 hc?this.top===a.top&&this.right===a.right&&this.bottom===a.bottom&&this.left===a.left:!1};t.gi=function(a,b,c,d){return this.top===a&&this.right===b&&this.bottom===c&&this.left===d};
t.Xa=function(a){return K.B(this.top,a.top)&&K.B(this.right,a.right)&&K.B(this.bottom,a.bottom)&&K.B(this.left,a.left)};t.w=function(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)};hc.alloc=function(){var a=kc.pop();return void 0===a?new hc:a};hc.free=function(a){kc.push(a)};hc.prototype.isReal=hc.prototype.w;hc.prototype.equalsApprox=hc.prototype.Xa;hc.prototype.equalTo=hc.prototype.gi;hc.prototype.equals=hc.prototype.C;hc.prototype.set=hc.prototype.set;
hc.prototype.setTo=hc.prototype.rg;var pc=null,qc=null,kc=[];hc.className="Margin";hc.parse=ic;hc.stringify=jc;hc.ZeroMargin=pc=(new hc(0,0,0,0)).ha();hc.TwoMargin=qc=(new hc(2,2,2,2)).ha();hc.parse=ic;hc.stringify=jc;function O(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 rc,sc,tc,uc,vc,xc,yc,zc,Ac,Bc,Cc,Dc,Ec,Fc,Gc,Ic,Jc,Kc,Lc,Mc,Nc,Oc,Pc,Qc,Rc,Sc,Wc,Xc,Yc,Zc,$c,ad,bd,cd,dd,gd;O.prototype.assign=function(a){this.x=a.x;this.y=a.y;this.offsetX=a.offsetX;this.offsetY=a.offsetY;return this};O.prototype.rg=function(a,b,c,d){this.x=a;this.y=b;this.offsetX=c;this.offsetY=d;return this};O.prototype.set=function(a){this.x=a.x;this.y=a.y;this.offsetX=a.offsetX;this.offsetY=a.offsetY;return this};
O.prototype.copy=function(){var a=new O;a.x=this.x;a.y=this.y;a.offsetX=this.offsetX;a.offsetY=this.offsetY;return a};t=O.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 hd(a,b){a.x=NaN;a.y=NaN;a.offsetX=b;return a}
function id(a){if("string"===typeof a){a=a.trim();if("None"===a)return rc;if("TopLeft"===a)return sc;if("Top"===a||"TopCenter"===a||"MiddleTop"===a)return tc;if("TopRight"===a)return uc;if("Left"===a||"LeftCenter"===a||"MiddleLeft"===a)return vc;if("Center"===a)return xc;if("Right"===a||"RightCenter"===a||"MiddleRight"===a)return yc;if("BottomLeft"===a)return zc;if("Bottom"===a||"BottomCenter"===a||"MiddleBottom"===a)return Ac;if("BottomRight"===a)return Bc;if("TopSide"===a)return Cc;if("LeftSide"===
a)return Dc;if("RightSide"===a)return Ec;if("BottomSide"===a)return Fc;if("TopBottomSides"===a)return Gc;if("LeftRightSides"===a)return Ic;if("TopLeftSides"===a)return Jc;if("TopRightSides"===a)return Kc;if("BottomLeftSides"===a)return Lc;if("BottomRightSides"===a)return Mc;if("NotTopSide"===a)return Nc;if("NotLeftSide"===a)return Oc;if("NotRightSide"===a)return Pc;if("NotBottomSide"===a)return Qc;if("AllSides"===a)return Rc;if("Default"===a)return Sc;a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;
var d=a[b++];void 0!==d&&0<d.length&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(e=parseFloat(d));for(var f=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(f=parseFloat(d));for(var g=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(g=parseFloat(d));return new O(c,e,f,g)}return new O}function jd(a){return a.vb()?a.x.toString()+" "+a.y.toString()+" "+a.offsetX.toString()+" "+a.offsetY.toString():a.toString()}
t.toString=function(){return this.vb()?0===this.offsetX&&0===this.offsetY?"Spot("+this.x+","+this.y+")":"Spot("+this.x+","+this.y+","+this.offsetX+","+this.offsetY+")":this.C(rc)?"None":this.C(sc)?"TopLeft":this.C(tc)?"Top":this.C(uc)?"TopRight":this.C(vc)?"Left":this.C(xc)?"Center":this.C(yc)?"Right":this.C(zc)?"BottomLeft":this.C(Ac)?"Bottom":this.C(Bc)?"BottomRight":this.C(Cc)?"TopSide":this.C(Dc)?"LeftSide":this.C(Ec)?"RightSide":this.C(Fc)?"BottomSide":this.C(Gc)?"TopBottomSides":this.C(Ic)?
"LeftRightSides":this.C(Jc)?"TopLeftSides":this.C(Kc)?"TopRightSides":this.C(Lc)?"BottomLeftSides":this.C(Mc)?"BottomRightSides":this.C(Nc)?"NotTopSide":this.C(Oc)?"NotLeftSide":this.C(Pc)?"NotRightSide":this.C(Qc)?"NotBottomSide":this.C(Rc)?"AllSides":this.C(Sc)?"Default":"None"};t.C=function(a){return a instanceof O?(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.gv=function(){return new O(.5-(this.x-.5),.5-(this.y-.5),-this.offsetX,-this.offsetY)};t.Hf=function(a){if(!this.Xc())return!1;if(!a.Xc())if(a.C(Wc))a=Dc;else if(a.C(Xc))a=Ec;else if(a.C(Yc))a=Cc;else if(a.C(Zc))a=Fc;else return!1;a=a.offsetY;return(this.offsetY&a)===a};t.vb=function(){return!isNaN(this.x)&&!isNaN(this.y)};t.Lc=function(){return isNaN(this.x)||isNaN(this.y)};t.Xc=function(){return isNaN(this.x)&&isNaN(this.y)&&1===this.offsetX&&0!==this.offsetY};
t.vs=function(){return isNaN(this.x)&&isNaN(this.y)&&0===this.offsetX&&0===this.offsetY};t.Vb=function(){return isNaN(this.x)&&isNaN(this.y)&&-1===this.offsetX&&0===this.offsetY};O.alloc=function(){var a=kd.pop();return void 0===a?new O:a};O.free=function(a){kd.push(a)};O.prototype.isDefault=O.prototype.Vb;O.prototype.isNone=O.prototype.vs;O.prototype.isSide=O.prototype.Xc;O.prototype.isNoSpot=O.prototype.Lc;O.prototype.isSpot=O.prototype.vb;O.prototype.includesSide=O.prototype.Hf;
O.prototype.opposite=O.prototype.gv;O.prototype.equals=O.prototype.C;O.prototype.set=O.prototype.set;O.prototype.setTo=O.prototype.rg;var kd=[];O.className="Spot";O.parse=id;O.stringify=jd;O.None=rc=hd(new O(0,0,0,0),0).ha();O.Default=Sc=hd(new O(0,0,-1,0),-1).ha();O.TopLeft=sc=(new O(0,0,0,0)).ha();O.TopCenter=tc=(new O(.5,0,0,0)).ha();O.TopRight=uc=(new O(1,0,0,0)).ha();O.LeftCenter=vc=(new O(0,.5,0,0)).ha();O.Center=xc=(new O(.5,.5,0,0)).ha();O.RightCenter=yc=(new O(1,.5,0,0)).ha();
O.BottomLeft=zc=(new O(0,1,0,0)).ha();O.BottomCenter=Ac=(new O(.5,1,0,0)).ha();O.BottomRight=Bc=(new O(1,1,0,0)).ha();O.MiddleTop=$c=tc;O.MiddleLeft=ad=vc;O.MiddleRight=bd=yc;O.MiddleBottom=cd=Ac;O.Top=Yc=tc;O.Left=Wc=vc;O.Right=Xc=yc;O.Bottom=Zc=Ac;O.TopSide=Cc=hd(new O(0,0,1,1),1).ha();O.LeftSide=Dc=hd(new O(0,0,1,2),1).ha();O.RightSide=Ec=hd(new O(0,0,1,4),1).ha();O.BottomSide=Fc=hd(new O(0,0,1,8),1).ha();O.TopBottomSides=Gc=hd(new O(0,0,1,9),1).ha();O.LeftRightSides=Ic=hd(new O(0,0,1,6),1).ha();
O.TopLeftSides=Jc=hd(new O(0,0,1,3),1).ha();O.TopRightSides=Kc=hd(new O(0,0,1,5),1).ha();O.BottomLeftSides=Lc=hd(new O(0,0,1,10),1).ha();O.BottomRightSides=Mc=hd(new O(0,0,1,12),1).ha();O.NotTopSide=Nc=hd(new O(0,0,1,14),1).ha();O.NotLeftSide=Oc=hd(new O(0,0,1,13),1).ha();O.NotRightSide=Pc=hd(new O(0,0,1,11),1).ha();O.NotBottomSide=Qc=hd(new O(0,0,1,7),1).ha();O.AllSides=Rc=hd(new O(0,0,1,15),1).ha();dd=(new O(.156,.156)).ha();gd=(new O(.844,.844)).ha();O.parse=id;O.stringify=jd;
function ld(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0}ld.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};ld.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};ld.prototype.copy=function(){var a=new ld;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};
ld.prototype.toString=function(){return"Transform("+this.m11+","+this.m12+","+this.m21+","+this.m22+","+this.dx+","+this.dy+")"};ld.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};ld.prototype.ts=function(){return 0===this.dx&&0===this.dy&&1===this.m11&&0===this.m12&&0===this.m21&&1===this.m22};ld.prototype.reset=function(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0;return this};
ld.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};
ld.prototype.bv=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};
ld.prototype.Ql=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};
ld.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=ld.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.Ga=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.Od=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.Zw=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.mp=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};ld.alloc=function(){var a=md.pop();return void 0===a?new ld:a};
ld.free=function(a){md.push(a)};ld.prototype.transformRect=ld.prototype.mp;ld.prototype.transformPoint=ld.prototype.Ga;ld.prototype.scale=ld.prototype.scale;ld.prototype.translate=ld.prototype.translate;ld.prototype.rotate=ld.prototype.rotate;ld.prototype.invert=ld.prototype.Ql;ld.prototype.multiplyInverted=ld.prototype.bv;ld.prototype.multiply=ld.prototype.multiply;ld.prototype.reset=ld.prototype.reset;ld.prototype.isIdentity=ld.prototype.ts;ld.prototype.equals=ld.prototype.C;
ld.prototype.setTransform=ld.prototype.setTransform;ld.prototype.set=ld.prototype.set;var md=[];ld.className="Transform";ld.xF="54a702f3e53909c447824c6706603faf4c";
var K={zA:"7da71ca0ad381e90",vg:(Math.sqrt(2)-1)/3*4,Sv:null,sqrt:function(a){if(0>=a)return 0;var b=K.Sv;if(null===b){b=[];for(var c=0;2E3>=c;c++)b[c]=Math.sqrt(c);K.Sv=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.5>a&&-.5<a},$:function(a,b){a-=b;return 5E-8>a&&-5E-8<a},Wb: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},Yr:function(a,b,c,d,e,f,g,h,k,l,m,n){if(K.Wb(a,b,g,h,n,c,d)&&K.Wb(a,b,g,h,n,e,f))return K.Wb(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 K.Yr(a,
b,p,r,d,c,w,v,k,l,m,n)||K.Yr(w,v,q,u,e,f,g,h,k,l,m,n)},$w: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},Oy:function(a,b,c,d,e,f,g,h){var k=(c+e)/2,l=(d+f)/2;return Ab(((a+c)/2+k)/2,((b+d)/2+l)/2,(k+(e+g)/2)/2,(l+(f+h)/2)/2)},Bl:function(a,b,c,d,e,f,g,h,k,l){if(K.Wb(a,b,g,h,k,c,d)&&K.Wb(a,b,g,h,k,e,f))Yb(l,a,b,0,0),Yb(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;K.Bl(a,b,m,n,d,c,q,u,k,l);K.Bl(q,u,p,r,e,f,g,h,k,l)}return l},Pe:function(a,b,c,d,e,f,g,h,k,l){if(K.Wb(a,b,g,h,k,c,d)&&K.Wb(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;K.Pe(a,b,m,n,d,c,q,u,k,l);K.Pe(q,u,p,r,e,f,g,h,k,l)}return l},jv:function(a,b,c,d,e,f,g,h,k,l){if(K.Wb(a,b,e,f,l,c,d))return K.Wb(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 K.jv(a,b,m,n,p,r,g,h,k,l)||K.jv(p,r,c,d,e,f,g,h,k,l)},NA: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},iv:function(a,b,c,d,e,f,g,h){if(K.Wb(a,b,e,f,g,c,d))Yb(h,a,b,0,0),Yb(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;K.iv(a,b,k,l,m,n,g,h);K.iv(m,n,c,d,e,f,g,h)}return h},ap:function(a,b,c,d,e,f,g,h){if(K.Wb(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;K.ap(a,b,k,l,m,n,g,h);K.ap(m,n,c,d,e,f,g,h)}return h},Do:function(a,b,c,d,e,f,g,h,k,l,m,n,p,r){if(K.Wb(a,b,g,h,p,c,d)&&K.Wb(a,b,g,h,p,e,f)){if(!K.Ol(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 y=(d+w)/2,z=(c+v)/2,A=Infinity,B=!1,D=0,M=0;K.Do(a,b,q,u,d,c,y,z,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,D=r.x,M=r.y));K.Do(y,z,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,D=r.x,M=r.y);B&&(r.x=D,r.y=M);return B},Eo:function(a,b,c,d,e,f,g,h,k,l,m,n,p){var r=0;if(K.Wb(a,b,g,h,p,c,d)&&K.Wb(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 y=(d+w)/2,z=(c+v)/2;r+=K.Eo(a,b,q,u,d,c,y,z,k,l,m,n,p);r+=K.Eo(y,z,w,v,e,f,g,h,k,l,m,n,p)}return r},oh:function(a,b,c,d,e,f,g){if(K.$(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(K.$(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},Ue:function(a,b,c,d,e,f,g,h,k){if(K.B(a,c)&&K.B(b,d))return k.h(a,b),!1;if(K.$(e,g))return K.$(a,c)?(K.oh(a,b,c,d,e,f,k),!1):K.oh(a,b,c,d,e,(d-b)/(c-a)*(e-a)+b,k);h=(h-f)/(g-e);if(K.$(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(K.$(h,g))return K.oh(a,b,c,d,e,f,k),!1;e=(g*a-h*e+f-b)/(g-h);if(K.$(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 K.oh(a,b,c,d,e,g*(e-a)+b,k)},LA:function(a,b,c,d,e){return K.Ue(c.x,c.y,d.x,d.y,a.x,a.y,b.x,b.y,e)},JA:function(a,b,c,d,e,f,g,h,k,l){function m(c,d){var e=(c-a)*(c-a)+(d-b)*(d-b);e<n&&(n=e,k.h(c,d))}var n=Infinity;m(k.x,k.y);var p=0,r=0,q=0,u=0;e<g?(p=e,r=g):(p=g,r=e);f<h?(q=e,u=g):(q=g,u=e);p=(r-
p)/2+l;l=(u-q)/2+l;e=(e+g)/2;f=(f+h)/2;if(0===p||0===l)return k;if(.5>(c>a?c-a:a-c)){p=1-(c-e)*(c-e)/(p*p);if(0>p)return k;p=Math.sqrt(p);d=-l*p+f;m(c,l*p+f);m(c,d)}else{c=(d-b)/(c-a);d=1/(p*p)+c*c/(l*l);h=2*c*(b-c*a)/(l*l)-2*c*f/(l*l)-2*e/(p*p);p=h*h-4*d*(2*c*a*f/(l*l)-2*b*f/(l*l)+f*f/(l*l)+e*e/(p*p)-1+(b-c*a)*(b-c*a)/(l*l));if(0>p)return k;p=Math.sqrt(p);l=(-h+p)/(2*d);m(l,c*l-c*a+b);p=(-h-p)/(2*d);m(p,c*p-c*a+b)}return k},Ff:function(a,b,c,d,e,f,g,h,k){var l=1E21,m=a,n=b;if(K.Ue(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)}K.Ue(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));K.Ue(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));K.Ue(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},rs:function(a,b,c){return K.Fx(a.x,a.y,a.width,a.height,b.x,b.y,c.x,c.y)},Fx: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):Zb(a,b,c,d,e,f)||Zb(a,b,c,d,g,h)||K.Ol(a,b,k,b,e,f,g,h)||K.Ol(k,b,k,l,e,f,g,h)||K.Ol(k,l,a,l,e,f,g,h)||K.Ol(a,l,a,b,e,f,g,h)?!0:!1},Ol:function(a,b,c,d,e,f,g,h){return a===c&&b===d&&e===g&&f===h?a===e&&b===f:0>=K.Dl(a,b,c,d,e,f)*K.Dl(a,b,c,d,g,h)&&0>=K.Dl(e,f,g,h,a,b)*K.Dl(e,f,g,h,c,d)},Dl: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},Zo:function(a){0>a&&(a+=360);
360<=a&&(a-=360);return a},jx: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(K.Wy(c,l,e,a,b)),d-=Math.abs(e-l),l=e;return f},Wy: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)]},Mo: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},vx: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},az: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 K.bz(k,0===g?a:b,l,c,0,0)},bz:function(a,b,c,d,e,f){if(0<d)if(0<c){e=a*a;f=b*b;a*=c;var g=b*d,h=-f+g,k=-f+Math.sqrt(a*a+g*g);b=h;for(var l=0;9999999999>l;++l){b=.5*(h+k);if(b===h||b===k)break;var m=a/(b+e),n=g/(b+f);m=m*m+n*n-1;if(0<m)h=b;else if(0>m)k=b;else break}c=e*c/(b+e)-c;d=f*d/(b+f)-d;c=Math.sqrt(c*c+d*d)}else c=Math.abs(d-b);else d=a*a-b*b,f=a*c,f<d?(d=f/d,f=b*Math.sqrt(Math.abs(1-d*d)),c=a*d-
c,c=Math.sqrt(c*c+f*f)):c=Math.abs(c-a);return c},Ye:new Ta,tm:new Ta,Mf:new Ta,Nf:0,um:100};K.za=K.zA;function P(a){Qa(this);this.o=2;void 0===a&&(a=P.m);this.na=a;this.Dc=this.Cc=this.kd=this.jd=0;a===P.m?this.ce=new F:(null===P.V&&(P.V=(new F).freeze()),this.ce=P.V);this.Xp=this.ce.Ja;this.Fp=(new N).freeze();this.xm=this.rk=null;this.ym=NaN;this.eg=sc;this.fg=Bc;this.Pk=this.Qk=NaN;this.Uf=nd}
P.prototype.copy=function(){var a=new P;a.o=this.o&-2;a.na=this.na;a.jd=this.jd;a.kd=this.kd;a.Cc=this.Cc;a.Dc=this.Dc;if(this.na===P.m){for(var b=this.ce.s,c=a.ce,d=0;d<b.length;d++)c.add(b[d].copy());a.ce=c}else a.ce=this.ce;a.Xp=this.Xp;a.Fp.assign(this.Fp);a.rk=this.rk;a.xm=this.xm;a.ym=this.ym;a.eg=this.eg.J();a.fg=this.fg.J();a.Qk=this.Qk;a.Pk=this.Pk;a.Uf=this.Uf;return a};P.prototype.ha=function(){this.freeze();Object.freeze(this);return this};
P.prototype.freeze=function(){this._isFrozen=!0;if(this.type!==P.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};P.prototype.ja=function(){Object.isFrozen(this)&&C("cannot thaw constant: "+this);this._isFrozen=!1;if(this.type!==P.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};
P.prototype.Xa=function(a){if(!(a instanceof P))return!1;if(this.type!==a.type)return this.type===P.j&&a.type===P.m?od(this,a):a.type===P.j&&this.type===P.m?od(a,this):!1;if(this.type===P.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].Xa(a[d]))return!1;return!0}return K.B(this.startX,a.startX)&&K.B(this.startY,a.startY)&&K.B(this.endX,a.endX)&&K.B(this.endY,a.endY)};
function od(a,b){return a.type!==P.j||b.type!==P.m?!1:1===b.figures.count&&(b=b.figures.L(0),1===b.segments.count&&K.B(a.startX,b.startX)&&K.B(a.startY,b.startY)&&(b=b.segments.L(0),b.type===pd&&K.B(a.endX,b.endX)&&K.B(a.endY,b.endY)))?!0:!1}P.ga=function(a){return a.toString()};P.prototype.rb=function(a){a.classType===P&&(this.type=a)};
P.prototype.toString=function(a){void 0===a&&(a=-1);switch(this.type){case P.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 P.u:var b=new N(this.startX,this.startY,0,0);b.Iv(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 P.F:b=new N(this.startX,this.startY,0,0);b.Iv(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 P.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()}};
P.ob=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};
P.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=z.x+b,c=z.y+c);a.h(b,c)}function f(){e(z);return z}function g(){e(y);return y}function h(){var a=v.toLowerCase();return"c"!==a&&"s"!==a&&"q"!==a&&"t"!==a?z:new J(2*z.x-y.x,2*z.y-y.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 J(0,0);var y=new J(0,0),z=new J(0,0),A=l.length;a=qd(null);p=n=m=!1;r=!0;q=null;for(var B=/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/;!(u>=A-1);)if(v=w,w=d(),""!==w)switch(w.toUpperCase()){case "X":r=!0;n=m=!1;break;case "M":q=f();null===a.kc||!0===r?(wd(a,q.x,q.y,m,!n,p),r=!1):a.moveTo(q.x,q.y);for(k.assign(z);!c();)q=f(),a.lineTo(q.x,q.y);break;case "L":for(;!c();)q=f(),a.lineTo(q.x,q.y);break;case "H":for(;!c();)z=new J((w===w.toLowerCase()?z.x:0)+parseFloat(d()),
z.y),a.lineTo(z.x,z.y);break;case "V":for(;!c();)z=new J(z.x,(w===w.toLowerCase()?z.y:0)+parseFloat(d())),a.lineTo(z.x,z.y);break;case "C":for(;!c();){q=new J;e(q);var D=g(),M=f();xd(a,q.x,q.y,D.x,D.y,M.x,M.y)}break;case "S":for(;!c();)q=h(),D=g(),M=f(),xd(a,q.x,q.y,D.x,D.y,M.x,M.y);break;case "Q":for(;!c();)q=g(),D=f(),yd(a,q.x,q.y,D.x,D.y);break;case "T":for(;!c();)y=q=h(),D=f(),yd(a,q.x,q.y,D.x,D.y);break;case "B":for(;!c();){q=parseFloat(d());D=parseFloat(d());M=parseFloat(d());var S=parseFloat(d()),
R=parseFloat(d()),I=R,G=!1;c()||(I=parseFloat(d()),c()||(G=0!==parseFloat(d())));w===w.toLowerCase()&&(M+=z.x,S+=z.y);a.arcTo(q,D,M,S,R,I,G)}break;case "A":for(;!c();)q=Math.abs(parseFloat(d())),D=Math.abs(parseFloat(d())),M=parseFloat(d()),R=S=!1,G=I=0,I=d(),1===I.length?(S=!!parseFloat(I),R=!!parseFloat(d()),I=parseFloat(d())):2===I.length?(S=!!parseFloat(I[0]),R=!!parseFloat(I[1]),I=parseFloat(d())):(S=!!parseFloat(I[0]),R=!!parseFloat(I[1]),I=parseFloat(I.slice(2))),G=parseFloat(d()),w===w.toLowerCase()&&
(I=z.x+I,G=z.y+G),z.h(I,G),zd(a,q,D,M,S,R,I,G);break;case "Z":Ad(a);z.assign(k);break;case "F":q="";for(D=1;l[u+D];)if("0"===l[u+D])p=!0,D++;else if(null!==l[u+D].match(/[Uu]/))D++;else if(null===l[u+D].match(B))D++;else{q=l[u+D];break}q.match(/[Mm]/)?m=!0:0<a.kc.segments.length&&(a.kc.isFilled=!0);break;case "U":q="";for(D=1;l[u+D];)if(null!==l[u+D].match(/[Ff]/))D++;else if(null===l[u+D].match(B))D++;else{q=l[u+D];break}q.match(/[Mm]/)?n=!0:a.kc.isShadowed=!1}k=a.ls;Bd=a;if(b)for(b=k.figures.iterator;b.next();)b.value.isFilled=
!0;return k};P.Ha=function(a,b){for(var c=a.length,d=J.alloc(),e=0;e<c;e++){var f=a[e];d.x=f[0];d.y=f[1];b.Ga(d);f[0]=d.x;f[1]=d.y;d.x=f[2];d.y=f[3];b.Ga(d);f[2]=d.x;f[3]=d.y;d.x=f[4];d.y=f[5];b.Ga(d);f[4]=d.x;f[5]=d.y;d.x=f[6];d.y=f[7];b.Ga(d);f[6]=d.x;f[7]=d.y}J.free(d)};P.prototype.Zu=function(){if(this._isInvalidBounds)return!0;if(this.type===P.m){if(this.Xp!==this.figures.Ja)return!0;for(var a=this.figures.s,b=a.length,c=0;c<b;c++)if(a[c].Zu())return!0}return!1};
P.prototype.computeBounds=function(){this._isInvalidBounds=!1;this.xm=this.rk=null;this.ym=NaN;if(this.type===P.m){this.Xp=this.figures.Ja;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.nr=e.Ja;d=e.s;e=d.length;for(var f=0;f<e;f++){var g=d[f];g._isInvalidBounds=!1;g.Zd=null}}}a=this.Fp;a.ja();isNaN(this.Qk)||isNaN(this.Pk)?a.h(0,0,0,0):a.h(0,0,this.Qk,this.Pk);Cd(this,a,!1);Yb(a,0,0,0,0);a.freeze()};
P.prototype.ix=function(){var a=new N;Cd(this,a,!0);return a};
function Cd(a,b,c){switch(a.type){case P.j:case P.u:case P.F:c?b.h(a.jd,a.kd,0,0):Yb(b,a.jd,a.kd,0,0);Yb(b,a.Cc,a.Dc,0,0);break;case P.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):Yb(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 pd:case Dd:k=n.endX;l=n.endY;Yb(b,k,l,0,0);break;case Ed:K.Bl(k,l,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.5,b);k=n.endX;
l=n.endY;break;case Kd:K.iv(k,l,n.point1X,n.point1Y,n.endX,n.endY,.5,b);k=n.endX;l=n.endY;break;case Ld:case Md:var p=n.type===Ld?Nd(n,f):Od(n,f,k,l),r=p.length;if(0===r){k=n.type===Ld?n.centerX:n.endX;l=n.type===Ld?n.centerY:n.endY;Yb(b,k,l,0,0);break}n=null;for(var q=0;q<r;q++)n=p[q],K.Bl(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],.5,b);null!==n&&(k=n[6],l=n[7]);break;default:C("Unknown Segment type: "+n.type)}}}break;default:C("Unknown Geometry type: "+a.type)}}
P.prototype.normalize=function(){this._isFrozen&&va(this);var a=this.ix();this.offset(-a.x,-a.y);return new J(-a.x,-a.y)};P.prototype.offset=function(a,b){this._isFrozen&&va(this);this.transform(1,0,0,1,a,b);return this};P.prototype.scale=function(a,b){this._isFrozen&&va(this);this.transform(a,0,0,b,0,0);return this};
P.prototype.rotate=function(a,b,c){this._isFrozen&&va(this);void 0===b&&(b=0);void 0===c&&(c=0);var d=ld.alloc();d.reset();d.rotate(a,b,c);this.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);ld.free(d);return this};t=P.prototype;
t.transform=function(a,b,c,d,e,f){switch(this.type){case P.j:case P.u:case P.F:var g=this.jd;var h=this.kd;this.jd=g*a+h*c+e;this.kd=g*b+h*d+f;g=this.Cc;h=this.Dc;this.Cc=g*a+h*c+e;this.Dc=g*b+h*d+f;break;case P.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 pd:case Dd:g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case Ed: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 Kd: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 Ld: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 Md: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.ca=function(a,b){void 0===b&&(b=0);var c=this.jd,d=this.kd,e=this.Cc,f=this.Dc;switch(this.type){case P.j:return K.Wb(c,d,e,f,b,a.x,a.y);case P.u:var g=N.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.ca(a);N.free(g);return a;case P.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 P.m:return Pd(this,a,b,!0,!1);default:return!1}};
function Pd(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],w=!u.isEvenOdd;if(u.isFilled){if(d&&u.ca(f,b,c))return!0;var v=u.segments;k=u.startX;l=u.startY;for(var y=k,z=l,A=v.s,B=0;B<=v.length;B++){var D=void 0;if(B!==v.length){D=A[B];var M=D.type;a=D.endX;n=D.endY}else M=pd,a=y,n=z;switch(M){case Dd:y=Qd(f,b,g,b,k,l,y,z);if(isNaN(y))return!0;h+=y;y=a;z=n;break;case pd:k=Qd(f,b,g,b,k,l,a,n);if(isNaN(k))return!0;h+=k;break;case Ed:m=
K.Eo(k,l,D.point1X,D.point1Y,D.point2X,D.point2Y,a,n,g,b,f,b,.5);h+=m;break;case Kd:m=K.Eo(k,l,(k+2*D.point1X)/3,(l+2*D.point1Y)/3,(2*D.point1X+a)/3,(2*D.point1Y+n)/3,a,n,g,b,f,b,.5);h+=m;break;case Ld:case Md:M=D.type===Ld?Nd(D,u):Od(D,u,k,l);var S=M.length;if(0===S){k=Qd(f,b,g,b,k,l,D.type===Ld?D.centerX:D.endX,D.type===Ld?D.centerY:D.endY);if(isNaN(k))return!0;h+=k;break}D=null;for(var R=0;R<S;R++){D=M[R];if(0===R){m=Qd(f,b,g,b,k,l,D[0],D[1]);if(isNaN(m))return!0;h+=m}m=K.Eo(D[0],D[1],D[2],D[3],
D[4],D[5],D[6],D[7],g,b,f,b,.5);h+=m}null!==D&&(a=D[6],n=D[7]);break;default:C("Unknown Segment type: "+D.type)}k=a;l=n}if(w){if(0!==h)return!0}else if(0!==h%2)return!0;h=0}else if(u.ca(f,b,e?c:c+2))return!0}return!1}
function Qd(a,b,c,d,e,f,g,h){if(K.Wb(e,f,g,h,.05,a,b))return NaN;var k=(a-c)*(f-h);if(0===k)return 0;var l=((a*d-b*c)*(e-g)-(a-c)*(e*h-f*g))/k;b=(a*d-b*c)*(f-h)/k;if(l>=a)return 0;if((e>g?e-g:g-e)<(f>h?f-h:h-f))if(f<h){if(b<f||b>h)return 0}else{if(b<h||b>f)return 0}else if(e<g){if(l<e||l>g)return 0}else if(l<g||l>e)return 0;return 0<k?1:-1}function Rd(a,b,c,d){a=a.figures.s;for(var e=a.length,f=0;f<e;f++)if(a[f].ca(b,c,d))return!0;return!1}
t.Pu=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=new J);if(this.type===P.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.wx=function(a){0>a?a=0:1<a&&(a=1);if(this.type===P.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.Qu=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=[]);b.length=3;if(this.type===P.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.xx=function(a){if(this.type===P.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=J.alloc();K.oh(b,c,d,e,f,a,h);a=h.x;f=h.y;J.free(h);return Math.sqrt(((a-b)*(a-b)+(f-c)*(f-c))/g)}}else if(this.type===P.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=J.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){K.oh(l,m,w,v,a.x,a.y,d);var y=(d.x-a.x)*(d.x-a.x)+(d.y-a.y)*(d.y-a.y);y<e&&(e=y,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}J.free(d);a=g/f;return 0>a?0:1<a?1:a}return 0};
function Sd(a){if(null===a.rk){var b=a.rk=[],c=a.xm=[],d=[],e=[];if(a.type===P.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===P.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===P.F){var f=new Wd;f.startX=a.endX;f.startY=(a.startY+a.endY)/2;var g=new Xd(Ld);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=Nd(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];K.Pe(g,f,k[2],k[3],
k[4],k[5],k[6],k[7],.5,d);g=k[6];f=k[7]}}b.push(d);c.push(Yd(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 Dd:4<=d.length&&(b.push(d),c.push(Yd(d)));d=[];d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;h=g;k=f;break;case pd:d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;break;case Ed:K.Pe(g,f,p.point1X,p.point1Y,p.point2X,p.point2Y,p.endX,p.endY,
.5,d);g=p.endX;f=p.endY;break;case Kd:K.ap(g,f,p.point1X,p.point1Y,p.endX,p.endY,.5,d);g=p.endX;f=p.endY;break;case Ld:var r=Nd(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];K.Pe(g,f,w[2],w[3],w[4],w[5],w[6],w[7],.5,d);g=w[6];f=w[7]}break;case Md:r=Od(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],K.Pe(g,f,w[2],w[3],w[4],w[5],w[6],w[7],.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(Yd(d)))}}}function Yd(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(zb(c,d,g,h)));c=g;d=h}return b}t.add=function(a){this.ce.add(a);return this};t.om=function(a,b,c,d,e,f,g,h){this._isFrozen&&va(this);this.eg=(new O(a,b,e,f)).freeze();this.fg=(new O(c,d,g,h)).freeze();return this};
ma.Object.defineProperties(P.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(){Sd(this);return this.rk}},flattenedLengths:{get:function(){Sd(this);return this.xm}},flattenedTotalLength:{
get:function(){var a=this.ym;if(isNaN(a)){if(this.type===P.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===P.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.ym=a}return a}},type:{get:function(){return this.na},set:function(a){this.na!==a&&(this._isFrozen&&
va(this,a),this.na=a,a===P.m?this.ce=new F:(null===P.V&&(P.V=(new F).freeze()),this.ce=P.V),this._isInvalidBounds=!0)}},startX:{get:function(){return this.jd},set:function(a){this.jd!==a&&(this._isFrozen&&va(this,a),this.jd=a,this._isInvalidBounds=!0)}},startY:{get:function(){return this.kd},set:function(a){this.kd!==a&&(this._isFrozen&&va(this,a),this.kd=a,this._isInvalidBounds=!0)}},endX:{get:function(){return this.Cc},
set:function(a){this.Cc!==a&&(this._isFrozen&&va(this,a),this.Cc=a,this._isInvalidBounds=!0)}},endY:{get:function(){return this.Dc},set:function(a){this.Dc!==a&&(this._isFrozen&&va(this,a),this.Dc=a,this._isInvalidBounds=!0)}},figures:{get:function(){return this.ce},set:function(a){this.ce!==a&&(this._isFrozen&&va(this,a),this.ce=a,this._isInvalidBounds=!0)}},spot1:{get:function(){return this.eg},set:function(a){this._isFrozen&&
va(this,a);this.eg=a.J()}},spot2:{get:function(){return this.fg},set:function(a){this._isFrozen&&va(this,a);this.fg=a.J()}},defaultStretch:{get:function(){return this.Uf},set:function(a){this._isFrozen&&va(this,a);this.Uf=a}},bounds:{get:function(){this.Zu()&&this.computeBounds();return this.Fp}}});P.prototype.setSpots=P.prototype.om;P.prototype.add=P.prototype.add;P.prototype.getFractionForPoint=P.prototype.xx;
P.prototype.getPointAndAngleAlongPath=P.prototype.Qu;P.prototype.getAngleAlongPath=P.prototype.wx;P.prototype.getPointAlongPath=P.prototype.Pu;P.prototype.containsPoint=P.prototype.ca;P.prototype.transform=P.prototype.transform;P.prototype.rotate=P.prototype.rotate;P.prototype.scale=P.prototype.scale;P.prototype.offset=P.prototype.offset;P.prototype.normalize=P.prototype.normalize;P.prototype.computeBoundsWithoutOrigin=P.prototype.ix;P.prototype.equalsApprox=P.prototype.Xa;P.className="Geometry";
P.j=new E(P,"Line",0);P.u=new E(P,"Rectangle",1);P.F=new E(P,"Ellipse",2);P.m=new E(P,"Path",3);P.V=null;P.hb="UuBbMmZzLlHhVvCcSsQqTtAaFfXx";P.className="Geometry";P.stringify=P.ga;P.fillPath=P.ob;P.parse=P.parse;P.Line=P.j;P.Rectangle=P.u;P.Ellipse=P.F;P.Path=P.m;function Wd(a,b,c,d,e){Qa(this);void 0===c&&(c=!0);void 0===d&&(d=!0);void 0===e&&(e=!1);this.o=2|(c?4:0)|(d?8:0)|(e?16:0);void 0!==a?this.jd=a:this.jd=0;void 0!==b?this.kd=b:this.kd=0;this.nl=new F;this.nr=this.nl.Ja;this.dw=null}
Wd.prototype.copy=function(){var a=new Wd;a.o=this.o&-2;a.jd=this.jd;a.kd=this.kd;for(var b=this.nl.s,c=b.length,d=a.nl,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.nr=this.nr;a.dw=this.dw;return a};t=Wd.prototype;t.Xa=function(a){if(!(a instanceof Wd&&K.B(this.startX,a.startX)&&K.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].Xa(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.Zu=function(){if(this._isInvalidBounds)return!0;var a=this.segments;if(this.nr!==a.Ja)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.nl.add(a);return this};
t.ca=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 Dd:f=m.endX;g=m.endY;d=m.endX;e=m.endY;break;case pd:if(K.Wb(d,e,m.endX,m.endY,c,a,b))return!0;d=m.endX;e=m.endY;break;case Ed:if(K.Yr(d,e,m.point1X,m.point1Y,m.point2X,m.point2Y,m.endX,m.endY,.5,a,b,c))return!0;d=m.endX;e=m.endY;break;case Kd:if(K.jv(d,e,m.point1X,m.point1Y,m.endX,m.endY,.5,a,b,c))return!0;d=m.endX;e=m.endY;break;case Ld:case Md:var n=m.type===
Ld?Nd(m,this):Od(m,this,d,e),p=n.length,r=m.type===Ld?m.centerX:m.endX,q=m.type===Ld?m.centerY:m.endY;if(0===p){if(K.Wb(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&&K.Wb(d,e,r[0],r[1],c,a,b)||K.Yr(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],.5,a,b,c))return!0;null!==r&&(d=r[6],e=r[7]);break;default:C("Unknown Segment type: "+m.type)}if(m.isClosed&&(d!==f||e!==g)&&K.Wb(d,e,f,g,c,a,b))return!0}return!1};
ma.Object.defineProperties(Wd.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}},isEvenOdd:{get:function(){return 0!==(this.o&16)},set:function(a){this._isFrozen&&va(this,a);this.o=a?this.o|16:this.o&-17}},startX:{get:function(){return this.jd},set:function(a){this._isFrozen&&va(this,a);this.jd=a;this._isInvalidBounds=!0}},startY:{get:function(){return this.kd},set:function(a){this._isFrozen&&va(this,a);
this.kd=a;this._isInvalidBounds=!0}},segments:{get:function(){return this.nl},set:function(a){this._isFrozen&&va(this,a);this.nl=a;this._isInvalidBounds=!0}}});Wd.prototype.add=Wd.prototype.add;Wd.prototype.equalsApprox=Wd.prototype.Xa;Wd.className="PathFigure";
function Xd(a,b,c,d,e,f,g,h){Qa(this);void 0===a&&(a=pd);this.na=a;this.o=2;void 0!==b?this.Cc=b:this.Cc=0;void 0!==c?this.Dc=c:this.Dc=0;void 0===d&&(d=0);void 0===e&&(e=0);void 0===f&&(f=0);void 0===g&&(g=0);a===Md?(a=f%360,0>a&&(a+=360),this.Me=a,this.Uh=0,this.Vh=Math.max(d,0),this.Ng=Math.max(e,0),"boolean"===typeof g?g&&(this.isLargeArc=!0):"number"===typeof g&&g&&(this.isLargeArc=!0),h&&(this.isClockwiseArc=!0)):(this.Me=d,this.Uh=e,a===Ld&&(f=Math.max(f,0)),this.Vh=f,"number"===typeof g?(a===
Ld&&(g=Math.max(g,0)),this.Ng=g):this.Ng=0);this.Zd=null}Xd.prototype.copy=function(){var a=new Xd;a.na=this.na;a.o=this.o&-2;a.Cc=this.Cc;a.Dc=this.Dc;a.Me=this.Me;a.Uh=this.Uh;a.Vh=this.Vh;a.Ng=this.Ng;return a};t=Xd.prototype;
t.Xa=function(a){if(!(a instanceof Xd)||this.type!==a.type||this.isClosed!==a.isClosed)return!1;switch(this.type){case Dd:case pd:return K.B(this.endX,a.endX)&&K.B(this.endY,a.endY);case Ed:return K.B(this.endX,a.endX)&&K.B(this.endY,a.endY)&&K.B(this.point1X,a.point1X)&&K.B(this.point1Y,a.point1Y)&&K.B(this.point2X,a.point2X)&&K.B(this.point2Y,a.point2Y);case Kd:return K.B(this.endX,a.endX)&&K.B(this.endY,a.endY)&&K.B(this.point1X,a.point1X)&&K.B(this.point1Y,a.point1Y);case Ld:return K.B(this.startAngle,
a.startAngle)&&K.B(this.sweepAngle,a.sweepAngle)&&K.B(this.centerX,a.centerX)&&K.B(this.centerY,a.centerY)&&K.B(this.radiusX,a.radiusX)&&K.B(this.radiusY,a.radiusY);case Md:return this.isClockwiseArc===a.isClockwiseArc&&this.isLargeArc===a.isLargeArc&&K.B(this.xAxisRotation,a.xAxisRotation)&&K.B(this.endX,a.endX)&&K.B(this.endY,a.endY)&&K.B(this.radiusX,a.radiusX)&&K.B(this.radiusY,a.radiusY);default:return!1}};t.rb=function(a){a.classType===Xd&&(this.type=a)};
t.toString=function(a){void 0===a&&(a=-1);switch(this.type){case Dd:a=0>a?"M"+this.endX.toString()+" "+this.endY.toString():"M"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case pd:a=0>a?"L"+this.endX.toString()+" "+this.endY.toString():"L"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Ed: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 Kd: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 Ld: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 Md: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 Nd(a,b){if(null!==a.Zd&&!1===b._isInvalidBounds)return a.Zd;var c=a.radiusX,d=a.radiusY;void 0===d&&(d=c);if(0===c||0===d)return a.Zd=[],a.Zd;b=a.Me;var e=a.Uh,f=K.jx(0,0,c<d?c:d,a.startAngle,a.startAngle+a.sweepAngle,!1);if(c!==d){var g=ld.alloc();g.reset();c<d?g.scale(1,d/c):g.scale(c/d,1);P.Ha(f,g);ld.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.Zd=f;return a.Zd}
function Od(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.Zd&&!1===b._isInvalidBounds)return a.Zd;if(0===a.radiusX||0===a.radiusY)return a.Zd=[],a.Zd;b=a.Vh;var f=a.Ng;0===b&&(b=1E-4);0===f&&(f=1E-4);var g=Math.PI/180*a.Me,h=a.isLargeArc,k=a.isClockwiseArc,l=a.Cc,m=a.Dc,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=K.jx(0,0,b>f?b:f,m,m+g,!0);f=ld.alloc();f.reset();f.translate(c,d);f.rotate(a.Me,0,0);f.scale(k,r);P.Ha(b,f);
ld.free(f);a.Zd=b;return a.Zd}
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}},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.na},set:function(a){this._isFrozen&&va(this,a);this.na=a;this._isInvalidBounds=!0}},endX:{get:function(){return this.Cc},set:function(a){this._isFrozen&&va(this,a);this.Cc=a;this._isInvalidBounds=!0}},endY:{get:function(){return this.Dc},set:function(a){this._isFrozen&&va(this,a);this.Dc=a;this._isInvalidBounds=!0}},point1X:{get:function(){return this.Me},set:function(a){this._isFrozen&&
va(this,a);this.Me=a;this._isInvalidBounds=!0}},point1Y:{get:function(){return this.Uh},set:function(a){this._isFrozen&&va(this,a);this.Uh=a;this._isInvalidBounds=!0}},point2X:{get:function(){return this.Vh},set:function(a){this._isFrozen&&va(this,a);this.Vh=a;this._isInvalidBounds=!0}},point2Y:{get:function(){return this.Ng},set:function(a){this._isFrozen&&va(this,a);this.Ng=a;this._isInvalidBounds=!0}},centerX:{
get:function(){return this.Me},set:function(a){this._isFrozen&&va(this,a);this.Me=a;this._isInvalidBounds=!0}},centerY:{get:function(){return this.Uh},set:function(a){this._isFrozen&&va(this,a);this.Uh=a;this._isInvalidBounds=!0}},radiusX:{get:function(){return this.Vh},set:function(a){0>a&&xa(a,">= zero",Xd,"radiusX");this._isFrozen&&va(this,a);this.Vh=a;this._isInvalidBounds=!0}},radiusY:{get:function(){return this.Ng},
set:function(a){0>a&&xa(a,">= zero",Xd,"radiusY");this._isFrozen&&va(this,a);this.Ng=a;this._isInvalidBounds=!0}},startAngle:{get:function(){return this.Cc},set:function(a){this._isFrozen&&va(this,a);a%=360;0>a&&(a+=360);this.Cc=a;this._isInvalidBounds=!0}},sweepAngle:{get:function(){return this.Dc},set:function(a){this._isFrozen&&va(this,a);360<a&&(a=360);-360>a&&(a=-360);this.Dc=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.Me},set:function(a){this._isFrozen&&va(this,a);a%=360;0>a&&(a+=360);this.Me=a;this._isInvalidBounds=
!0}}});Xd.prototype.equalsApprox=Xd.prototype.Xa;var Dd=new E(Xd,"Move",0),pd=new E(Xd,"Line",1),Ed=new E(Xd,"Bezier",2),Kd=new E(Xd,"QuadraticBezier",3),Ld=new E(Xd,"Arc",4),Md=new E(Xd,"SvgArc",4);Xd.className="PathSegment";Xd.Move=Dd;Xd.Line=pd;Xd.Bezier=Ed;Xd.QuadraticBezier=Kd;Xd.Arc=Ld;Xd.SvgArc=Md;
function Zd(){this.H=null;this.wu=(new J(0,0)).freeze();this.it=(new J(0,0)).freeze();this.yp=this.Nq=0;this.zp=1;this.tq="";this.Sr=this.Qp=!1;this.Op=this.Bp=0;this.wg=this.jq=this.pq=!1;this.Vp=null;this.Nr=0;this.vd=this.Jr=null}Zd.prototype.copy=function(){var a=new Zd;return this.clone(a)};
Zd.prototype.clone=function(a){a.H=this.H;a.wu.assign(this.viewPoint);a.it.assign(this.documentPoint);a.Nq=this.Nq;a.yp=this.yp;a.zp=this.zp;a.tq=this.tq;a.Qp=this.Qp;a.Sr=this.Sr;a.Bp=this.Bp;a.Op=this.Op;a.pq=this.pq;a.jq=this.jq;a.wg=this.wg;a.Vp=this.Vp;a.Nr=this.Nr;a.Jr=this.Jr;a.vd=this.vd;return a};
Zd.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};Zd.prototype.Po=function(a,b){var c=this.diagram;if(null===c)return b;$d(c,a,b);return b};
Zd.prototype.Cz=function(a,b){var c=this.diagram;if(null===c)return b;$d(c,a,b);b.assign(c.Ms(b));return b};
ma.Object.defineProperties(Zd.prototype,{diagram:{get:function(){return this.H},set:function(a){this.H=a}},viewPoint:{get:function(){return this.wu},set:function(a){this.wu.assign(a)}},documentPoint:{get:function(){return this.it},set:function(a){this.it.assign(a)}},modifiers:{get:function(){return this.Nq},set:function(a){this.Nq=a}},button:{get:function(){return this.yp},
set:function(a){this.yp=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.zp},set:function(a){this.zp=a}},key:{get:function(){return this.tq},set:function(a){this.tq=a}},down:{get:function(){return this.Qp},set:function(a){this.Qp=a}},up:{get:function(){return this.Sr},set:function(a){this.Sr=
a}},clickCount:{get:function(){return this.Bp},set:function(a){this.Bp=a}},delta:{get:function(){return this.Op},set:function(a){this.Op=a}},isMultiTouch:{get:function(){return this.pq},set:function(a){this.pq=a}},handled:{get:function(){return this.jq},set:function(a){this.jq=a}},bubbles:{get:function(){return this.wg},set:function(a){this.wg=a}},event:{
get:function(){return this.Vp},set:function(a){this.Vp=a}},isTouchEvent:{get:function(){var a=this.event;return null===a?!1:"touch"===a.pointerType||"pen"===a.pointerType}},timestamp:{get:function(){return this.Nr},set:function(a){this.Nr=a}},targetDiagram:{get:function(){return this.Jr},set:function(a){this.Jr=a}},targetObject:{get:function(){return this.vd},set:function(a){this.vd=
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}}});Zd.prototype.getMultiTouchDocumentPoint=Zd.prototype.Cz;
Zd.prototype.getMultiTouchViewPoint=Zd.prototype.Po;Zd.className="InputEvent";function ae(){this.H=null;this.wa="";this.Xq=this.Hr=null}ae.prototype.copy=function(){var a=new ae;a.H=this.H;a.wa=this.wa;a.Hr=this.Hr;a.Xq=this.Xq;return a};ae.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(ae.prototype,{diagram:{get:function(){return this.H},set:function(a){this.H=a}},name:{get:function(){return this.wa},set:function(a){this.wa=a}},subject:{get:function(){return this.Hr},set:function(a){this.Hr=a}},parameter:{get:function(){return this.Xq},set:function(a){this.Xq=a}}});ae.className="DiagramEvent";
function be(){this.Em=ce;this.qf=this.Mq="";this.Kn=this.Ln=this.Qn=this.Rn=this.Pn=this.H=this.bc=null}be.prototype.clear=function(){this.Kn=this.Ln=this.Qn=this.Rn=this.Pn=this.H=this.bc=null};
be.prototype.copy=function(){var a=new be;a.Em=this.Em;a.Mq=this.Mq;a.qf=this.qf;a.bc=this.bc;a.H=this.H;a.Pn=this.Pn;var b=this.Rn;a.Rn=za(b)&&"function"===typeof b.J?b.J():b;b=this.Qn;a.Qn=za(b)&&"function"===typeof b.J?b.J():b;b=this.Ln;a.Ln=za(b)&&"function"===typeof b.J?b.J():b;b=this.Kn;a.Kn=za(b)&&"function"===typeof b.J?b.J():b;return a};be.prototype.rb=function(a){a.classType===be&&(this.change=a)};
be.prototype.toString=function(){var a="";a=this.change===de?a+"* ":this.change===ce?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===de?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};be.prototype.I=function(a){return a?this.oldValue:this.newValue};be.prototype.Ez=function(a){return a?this.oldParam:this.newParam};be.prototype.canUndo=function(){return null!==this.model||null!==this.diagram?!0:!1};
be.prototype.undo=function(){this.canUndo()&&(null!==this.model?this.model.changeState(this,!0):null!==this.diagram&&this.diagram.changeState(this,!0))};be.prototype.canRedo=function(){return null!==this.model||null!==this.diagram?!0:!1};be.prototype.redo=function(){this.canRedo()&&(null!==this.model?this.model.changeState(this,!1):null!==this.diagram&&this.diagram.changeState(this,!1))};
ma.Object.defineProperties(be.prototype,{model:{get:function(){return this.bc},set:function(a){this.bc=a}},diagram:{get:function(){return this.H},set:function(a){this.H=a}},change:{get:function(){return this.Em},set:function(a){this.Em=a}},modelChange:{get:function(){return this.Mq},set:function(a){this.Mq=a}},propertyName:{get:function(){return this.qf},
set:function(a){this.qf=a}},isTransactionFinished:{get:function(){return this.Em===de&&("CommittedTransaction"===this.qf||"FinishedUndo"===this.qf||"FinishedRedo"===this.qf)}},object:{get:function(){return this.Pn},set:function(a){this.Pn=a}},oldValue:{get:function(){return this.Rn},set:function(a){this.Rn=a}},oldParam:{get:function(){return this.Qn},set:function(a){this.Qn=a}},
newValue:{get:function(){return this.Ln},set:function(a){this.Ln=a}},newParam:{get:function(){return this.Kn},set:function(a){this.Kn=a}}});be.prototype.redo=be.prototype.redo;be.prototype.canRedo=be.prototype.canRedo;be.prototype.undo=be.prototype.undo;be.prototype.canUndo=be.prototype.canUndo;be.prototype.getParam=be.prototype.Ez;be.prototype.getValue=be.prototype.I;be.prototype.clear=be.prototype.clear;
var de=new E(be,"Transaction",-1),ce=new E(be,"Property",0),ee=new E(be,"Insert",1),fe=new E(be,"Remove",2);be.className="ChangedEvent";be.Transaction=de;be.Property=ce;be.Insert=ee;be.Remove=fe;function ge(){this.m=(new F).freeze();this.wa="";this.j=!1}ge.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.L(c);null!==d&&(b+="\n "+d.toString())}}return b};
ge.prototype.clear=function(){var a=this.changes;a.ja();for(var b=a.count-1;0<=b;b--){var c=a.L(b);null!==c&&c.clear()}a.clear();a.freeze()};ge.prototype.canUndo=function(){return this.isComplete};ge.prototype.undo=function(){if(this.canUndo())for(var a=this.changes.count-1;0<=a;a--){var b=this.changes.L(a);null!==b&&b.undo()}};ge.prototype.canRedo=function(){return this.isComplete};
ge.prototype.redo=function(){if(this.canRedo())for(var a=this.changes.count,b=0;b<a;b++){var c=this.changes.L(b);null!==c&&c.redo()}};
ge.prototype.$j=function(){if(this.isComplete){var a=this.changes;a.ja();for(var b=new ob,c=0;c<a.count;c++){var d=a.L(c);if(null!==d&&d.change===ce&&d.object){var e=b.get(d.object);e||(e=new ob,b.set(d.object,e));var f=e.get(d.propertyName);null===f?e.set(d.propertyName,-1):(0<f&&a.Zc(f,null),e.set(d.propertyName,c))}}for(c=b=0;c<a.count;c++)d=a.L(c),null!==d&&(c>b&&a.Zc(b,d),b++);for(;a.length>b;)a.pop();a.freeze()}};
ma.Object.defineProperties(ge.prototype,{changes:{get:function(){return this.m}},name:{get:function(){return this.wa},set:function(a){this.wa=a}},isComplete:{get:function(){return this.j},set:function(a){this.j=a}}});ge.prototype.optimize=ge.prototype.$j;ge.prototype.redo=ge.prototype.redo;ge.prototype.canRedo=ge.prototype.canRedo;ge.prototype.undo=ge.prototype.undo;ge.prototype.canUndo=ge.prototype.canUndo;
ge.prototype.clear=ge.prototype.clear;ge.className="Transaction";function he(){this.Ot=new H;this.Dd=!1;this.u=(new F).freeze();this.Be=-1;this.m=999;this.Ee=!1;this.Kp=null;this.ai=0;this.j=!1;this.He=(new F).freeze();this.fl=new F;this.qt=!0;this.At=this.nq=this.Dt=this.Ct=!1}
he.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.L(d);b+="]";if(void 0!==a&&0<a)for(c=this.history.count,d=0;d<c;d++)b+="\n "+this.history.L(d).toString(a-1);return b};
he.prototype.clear=function(){var a=this.history;a.ja();for(var b=a.count-1;0<=b;b--){var c=a.L(b);null!==c&&c.clear()}a.clear();this.Be=-1;a.freeze();this.Ee=!1;this.Kp=null;this.ai=0;this.He.ja();this.He.clear();this.He.freeze();this.fl.clear();this.At=this.nq=this.Dt=this.Ct=!1};he.prototype.copyProperties=function(a){this.isEnabled=a.isEnabled;this.maxHistoryLength=a.maxHistoryLength;this.checksTransactionLevel=a.checksTransactionLevel};t=he.prototype;t.Vw=function(a){this.Ot.add(a)};t.Tx=function(a){this.Ot.remove(a)};
t.Ea=function(a){void 0===a&&(a="");null===a&&(a="");if(this.isUndoingRedoing)return!1;!0===this.qt&&(this.qt=!1,this.ai++,this.isInternalTransaction||this.Nb("StartingFirstTransaction",a,this.currentTransaction),0<this.ai&&this.ai--);this.isEnabled&&(this.He.ja(),this.He.add(a),this.He.freeze(),null===this.currentTransaction?this.fl.add(0):this.fl.add(this.currentTransaction.changes.count));this.ai++;var b=1===this.transactionLevel;b&&(this.isInternalTransaction||this.Nb("StartedTransaction",a,this.currentTransaction));
return b};t.eb=function(a){void 0===a&&(a="");return ie(this,!0,a)};t.Kf=function(){return ie(this,!1,"")};
function ie(a,b,c){if(a.isUndoingRedoing)return!1;a.checksTransactionLevel&&1>a.transactionLevel&&ya("Ending transaction without having started a transaction: "+c);var d=1===a.transactionLevel,e=a.currentTransaction;d&&b&&(a.isInternalTransaction||a.Nb("CommittingTransaction",c,e));var f=0;if(0<a.transactionLevel&&(a.ai--,a.isEnabled)){var g=a.He.count;0<g&&(""===c&&(c=a.He.L(0)),a.He.ja(),a.He.nb(g-1),a.He.freeze());g=a.fl.count;0<g&&(f=a.fl.L(g-1),a.fl.nb(g-1))}if(d){if(b)a.nq=!1,null===e&&""!==
c&&(e=a.currentTransaction),a.isEnabled&&null!==e&&(e.isComplete||(e.isComplete=!0,e.name=c),a.lx(),b=a.history,b.ja(),d=a.maxHistoryLength,0<=d&&(0===d?b.clear():b.count>=d&&(f=b.L(0),null!==f&&f.clear(),b.nb(0),a.Be--)),0===d||0!==b.count&&b.get(b.count-1)===e||(b.add(e),a.Be++),b.freeze()),a.isInternalTransaction||a.Nb("CommittedTransaction",c,e);else{a.Ee=!0;try{a.isEnabled&&null!==e&&(e.isComplete=!0,e.undo())}finally{a.isInternalTransaction||a.Nb("RolledBackTransaction",c,e),a.Ee=!1}null!==
e&&e.clear()}a.Kp=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.L(e),null!==b&&b.undo(),c.ja(),c.nb(e);c.freeze()}return!1}t.lx=function(){if(!this.isUndoingRedoing&&this.canRedo()){var a=this.history;a.ja();for(var b=a.count-1;b>this.historyIndex;b--){var c=a.L(b);null!==c&&c.clear();a.nb(b);this.nq=!0}a.freeze()}};
he.prototype.canUndo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToUndo;return null!==a&&a.canUndo()?!0:!1};he.prototype.undo=function(){if(this.canUndo()){var a=this.transactionToUndo;try{this.Ee=!0,this.Nb("StartingUndo","Undo",a),this.Be--,a.undo()}catch(b){ya("undo error: "+b.toString())}finally{this.Nb("FinishedUndo","Undo",a),this.Ee=!1}}};
he.prototype.canRedo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToRedo;return null!==a&&a.canRedo()?!0:!1};he.prototype.redo=function(){if(this.canRedo()){var a=this.transactionToRedo;try{this.Ee=!0,this.Nb("StartingRedo","Redo",a),this.Be++,a.redo()}catch(b){ya("redo error: "+b.toString())}finally{this.Nb("FinishedRedo","Redo",a),this.Ee=!1}}};
he.prototype.Nb=function(a,b,c){void 0===c&&(c=null);var d=new be;d.change=de;d.propertyName=a;d.object=c;d.oldValue=b;for(a=this.models;a.next();)b=a.value,d.model=b,b.Zr(d)};
he.prototype.Tu=function(a){if(this.isEnabled&&!this.isUndoingRedoing&&!this.skipsEvent(a)){var b=this.currentTransaction;null===b&&(this.Kp=b=new ge);var c=a.copy();b=b.changes;b.ja();b.add(c);b.freeze();this.checksTransactionLevel&&0>=this.transactionLevel&&!this.qt&&(a=a.diagram,null!==a&&!1===a.oi||ya("Change not within a transaction: "+c.toString()))}};
he.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(he.prototype,{models:{get:function(){return this.Ot.iterator}},isEnabled:{get:function(){return this.Dd},set:function(a){this.Dd=a}},transactionToUndo:{get:function(){return 0<=this.historyIndex&&this.historyIndex<=this.history.count-1?this.history.L(this.historyIndex):null}},transactionToRedo:{get:function(){return this.historyIndex<this.history.count-
1?this.history.L(this.historyIndex+1):null}},isUndoingRedoing:{get:function(){return this.Ee}},history:{get:function(){return this.u}},maxHistoryLength:{get:function(){return this.m},set:function(a){this.m=a}},historyIndex:{get:function(){return this.Be}},currentTransaction:{get:function(){return this.Kp}},transactionLevel:{
get:function(){return this.ai}},isInTransaction:{get:function(){return 0<this.ai}},checksTransactionLevel:{get:function(){return this.j},set:function(a){this.j=a}},nestedTransactionNames:{get:function(){return this.He}},isPendingClear:{get:function(){return this.Ct},set:function(a){this.Ct=a}},isPendingUnmodified:{get:function(){return this.Dt},set:function(a){this.Dt=
a}},isInternalTransaction:{get:function(){return this.At},set:function(a){this.At=a}},isJustDiscarded:{get:function(){return this.nq}}});he.prototype.handleChanged=he.prototype.Tu;he.prototype.redo=he.prototype.redo;he.prototype.undo=he.prototype.undo;he.prototype.canUndo=he.prototype.canUndo;he.prototype.discardHistoryAfterIndex=he.prototype.lx;he.prototype.rollbackTransaction=he.prototype.Kf;he.prototype.commitTransaction=he.prototype.eb;
he.prototype.startTransaction=he.prototype.Ea;he.prototype.removeModel=he.prototype.Tx;he.prototype.addModel=he.prototype.Vw;he.prototype.clear=he.prototype.clear;he.className="UndoManager";function je(){Qa(this);this.H=ke;this.wa="";this.Dd=!0;this.ob=!1;this.vm=null;this.Ay=new Zd;this.Vr=-1}je.prototype.toString=function(){return""!==this.name?this.name+" Tool":Ha(this.constructor)};je.prototype.updateAdornments=function(){};je.prototype.canStart=function(){return this.isEnabled};
je.prototype.doStart=function(){};je.prototype.doActivate=function(){this.isActive=!0};je.prototype.doDeactivate=function(){this.isActive=!1};je.prototype.doStop=function(){};je.prototype.doCancel=function(){this.transactionResult=null;this.stopTool()};je.prototype.stopTool=function(){var a=this.diagram;a.currentTool===this&&(a.currentTool=null,a.currentCursor="")};je.prototype.doMouseDown=function(){!this.isActive&&this.canStart()&&this.doActivate()};je.prototype.doMouseMove=function(){};
je.prototype.doMouseUp=function(){this.stopTool()};je.prototype.doMouseWheel=function(){};je.prototype.canStartMultiTouch=function(){return!0};je.prototype.standardPinchZoomStart=function(){var a=this.diagram,b=a.lastInput,c=b.Po(0,J.allocAt(NaN,NaN)),d=b.Po(1,J.allocAt(NaN,NaN));if(c.w()&&d.w()&&(this.doCancel(),a.Nl("hasGestureZoom"))){a.zw=a.scale;var e=d.x-c.x,f=d.y-c.y;a.Hw=Math.sqrt(e*e+f*f);b.bubbles=!1}J.free(c);J.free(d)};
je.prototype.standardPinchZoomMove=function(){var a=this.diagram,b=a.lastInput,c=b.Po(0,J.allocAt(NaN,NaN)),d=b.Po(1,J.allocAt(NaN,NaN));if(c.w()&&d.w()&&(this.doCancel(),a.Nl("hasGestureZoom"))){var e=d.x-c.x,f=d.y-c.y;f=Math.sqrt(e*e+f*f)/a.Hw;e=new J((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.zw;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}J.free(c);J.free(d)};
je.prototype.doKeyDown=function(){"Esc"===this.diagram.lastInput.key&&this.doCancel()};je.prototype.doKeyUp=function(){};je.prototype.Ea=function(a){void 0===a&&(a=this.name);this.transactionResult=null;return this.diagram.Ea(a)};je.prototype.stopTransaction=function(){var a=this.diagram;return null===this.transactionResult?a.Kf():a.eb(this.transactionResult)};
je.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.lastInput,c=a.Ll(b.documentPoint,!1);if(null!==c)if(Oa?b.meta:b.control){a.R("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!b.isSelected);a.R("ChangedSelection",a.selection)}else if(b.shift){if(!c.isSelected){a.R("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!0);a.R("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||(Oa?b.meta:b.control)||b.shift||a.clearSelection()}};je.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.gc(d.documentPoint,a,b);d.targetObject=a;le(a,d,c);return d.handled};
function le(a,b,c){b.handled=!1;if(null===a||a.If()){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.R(e,a)}else{switch(d){case 1:e="BackgroundSingleClicked";break;case 2:e="BackgroundDoubleClicked";break;case 3:e="BackgroundContextClicked"}0!==d&&c.R(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)}}}
je.prototype.standardMouseOver=function(){var a=this.diagram,b=a.lastInput;if(!0!==a.animationManager.Bb){var c=a.skipsUndoManager;a.skipsUndoManager=!0;var d=a.viewportBounds.ca(b.documentPoint)?a.gc(b.documentPoint,null,null):null;!b.event||"pointercancel"!==b.event.type&&"pointerout"!==b.event.type||(d=null);b.targetObject=d;var e=!1;if(d!==a.Ak){var f=a.Ak,g=f;a.Ak=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.qg(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.qg(d))break;g(b,d,f);e=!0;if(b.handled)break}d=d.panel}d=a.Ak}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 this.doUpdateCursor(null),d=a.mouseOver,null!==d&&(d(b),e=!0);e&&a.Yb();a.skipsUndoManager=c}};
je.prototype.doUpdateCursor=function(){var a=this.diagram;a&&(a.currentCursor="")};je.prototype.doCurrentObjectChanged=function(){};
je.prototype.standardMouseWheel=function(){var a=this.diagram,b=a.lastInput,c=b.delta;if(0!==c&&a.documentBounds.w()){var d=a.commandHandler,e=a.toolManager.mouseWheelBehavior;if(null!==d&&(e===me&&!b.shift||e===ne&&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===me&&b.shift||e===ne&&!b.control){d=a.position.copy();var f=b.event;e=f.deltaMode;var g=f.deltaX;f=f.deltaY;var h=
"pixel";if(0===g&&0===f||b.shift)!b.shift&&a.allowVerticalScroll?(c=3*c*a.scrollVerticalLineChange,a.scroll(h,0<c?"up":"down",Math.abs(c))):b.shift&&a.allowHorizontalScroll&&(c=3*c*a.scrollHorizontalLineChange,a.scroll(h,0<c?"left":"right",Math.abs(c)));else{switch(e){case 0:h="pixel";break;case 1:h="line";break;case 2:h="page"}0!==g&&a.allowHorizontalScroll&&(g*=a.scrollHorizontalLineChange/16,a.scroll(h,0<g?"right":"left",Math.abs(g)));0!==f&&a.allowVerticalScroll&&(f*=a.scrollVerticalLineChange/
16,a.scroll(h,0<f?"down":"up",Math.abs(f)))}this.doWheelChange(a,d,b)}}};je.prototype.doWheelChange=function(a,b,c){a.position.C(b)&&0===c.event.wheelDeltaX||(c.bubbles=!1)};je.prototype.standardWaitAfter=function(a,b){void 0===b&&(b=this.diagram.lastInput);this.cancelWaitAfter();var c=this,d=b.clone(this.Ay);this.Vr=ta(function(){c.doWaitAfter(d)},a)};je.prototype.cancelWaitAfter=function(){-1!==this.Vr&&x.clearTimeout(this.Vr);this.Vr=-1};je.prototype.doWaitAfter=function(){};
je.prototype.findToolHandleAt=function(a,b){a=this.diagram.gc(a,function(a){for(;null!==a&&!(a.panel instanceof te);)a=a.panel;return a});return null===a?null:a.part.category===b?a:null};je.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(je.prototype,{diagram:{get:function(){return this.H},set:function(a){a instanceof Q&&(this.H=a)}},name:{get:function(){return this.wa},set:function(a){this.wa=a}},isEnabled:{get:function(){return this.Dd},set:function(a){this.Dd=a}},isActive:{get:function(){return this.ob},set:function(a){this.ob=a}},transactionResult:{get:function(){return this.vm},
set:function(a){this.vm=a}}});je.prototype.startTransaction=je.prototype.Ea;je.className="Tool";function La(){je.call(this);this.name="ToolManager";this.hb=new F;this.pb=new F;this.Hb=new F;this.F=this.V=850;this.m=(new L(2,2)).ha();this.Ha=5E3;this.ga=ne;this.u=ue;this.Jp=this.j=null;this.zj=-1}la(La,je);La.prototype.initializeStandardTools=function(){};
La.prototype.updateAdornments=function(a){var b=this.currentToolTip;if(b instanceof te&&this.Jp===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===ve&&(b.bubbles=!1);if(b.isMultiTouch){this.cancelWaitAfter();if(this.gestureBehavior===we){b.bubbles=!0;return}if(this.gestureBehavior===ve)return;if(a.currentTool.canStartMultiTouch()){a.currentTool.standardPinchZoomStart();return}}for(var c=this.mouseDownTools.length,d=0;d<c;d++){var e=this.mouseDownTools.L(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===ne?this.mouseWheelBehavior=me:this.mouseWheelBehavior===me&&(this.mouseWheelBehavior=ne));this.doActivate();this.standardWaitAfter(this.holdDelay,b)};
La.prototype.doMouseMove=function(){var a=this.diagram,b=a.lastInput;if(b.isMultiTouch){if(this.gestureBehavior===we){b.bubbles=!0;return}if(this.gestureBehavior===ve)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.L(d);e.diagram=this.diagram;if(e.canStart()){a.doFocus();a.currentTool=e;a.currentTool===e&&(e.isActive||e.doActivate(),e.doMouseMove());return}}xe(this,
a);a=b.event;null===a||"pointermove"!==a.type&&a.cancelable||(b.bubbles=!0)};function xe(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 te&&(b===a||b.qg(a))||this.hideToolTip()};
La.prototype.doWaitAfter=function(a){var b=this.diagram;null!==b.xa&&(this.doMouseHover(),this.isActive||this.doToolTip(),a.isTouchEvent&&!b.lastInput.handled&&(a=a.copy(),a.button=2,a.buttons=2,b.lastInput=a,b.pu=!0,b.doMouseUp()))};
La.prototype.doMouseHover=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.gc(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.gc(b.documentPoint,null,null));b=b.targetObject;if(null!==b){if(a=this.currentToolTip,!(a instanceof te)||b!==a&&!b.qg(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 te){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.Va();this.positionToolTip(a,b)}else a instanceof ye&&a!==this.currentToolTip&&a.show(b,c,this);this.currentToolTip=a;-1!==this.zj&&(x.clearTimeout(this.zj),
this.zj=-1);a=this.toolTipDuration;if(0<a&&Infinity!==a){var e=this;this.zj=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.zj&&(x.clearTimeout(this.zj),this.zj=-1);var a=this.diagram,b=this.currentToolTip;null!==b&&(b instanceof te?(a.remove(b),null!==this.Jp&&this.Jp.Jf(b.category),b.data=null,b.adornedObject=null):b instanceof ye&&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.L(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.L(c);if(d.name===a)return d}b=this.mouseMoveTools.length;for(c=0;c<b;c++)if(d=this.mouseMoveTools.L(c),d.name===a)return d;b=this.mouseUpTools.length;for(c=0;c<b;c++)if(d=this.mouseUpTools.L(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.L(d);if(e.name===a)return null!==b?this.mouseDownTools.Zc(d,b):this.mouseDownTools.nb(d),e}c=this.mouseMoveTools.length;for(d=0;d<c;d++)if(e=this.mouseMoveTools.L(d),e.name===a)return null!==b?this.mouseMoveTools.Zc(d,b):this.mouseMoveTools.nb(d),e;c=this.mouseUpTools.length;for(d=0;d<c;d++)if(e=this.mouseUpTools.L(d),e.name===a)return null!==b?this.mouseUpTools.Zc(d,
b):this.mouseUpTools.nb(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.Jp=null!==a&&a instanceof te?a.adornedPart:null}},mouseDownTools:{get:function(){return this.hb}},mouseMoveTools:{
get:function(){return this.pb}},mouseUpTools:{get:function(){return this.Hb}},hoverDelay:{get:function(){return this.V},set:function(a){this.V=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.Ha},set:function(a){this.Ha=
a}}});La.prototype.replaceStandardTool=La.prototype.gb;var ne=new E(La,"WheelScroll",0),me=new E(La,"WheelZoom",1),ze=new E(La,"WheelNone",2),ue=new E(La,"GestureZoom",3),ve=new E(La,"GestureCancel",4),we=new E(La,"GestureNone",5);La.className="ToolManager";La.WheelScroll=ne;La.WheelZoom=me;La.WheelNone=ze;La.GestureZoom=ue;La.GestureCancel=ve;La.GestureNone=we;
function Ae(){je.call(this);this.name="Dragging";this.u=this.Qw=this.pb=!0;this.m=this.Ha=this.V=this.Ne=null;this.Xm=this.Hb=!1;this.rl=new J(NaN,NaN);this.Br=new J;this.hb=!0;this.Gk=100;this.Bg=[];this.se=(new H).freeze();this.ga=new Be;this.An=null;this.F="copy";this.Nc="";this.Oc="no-drop"}var Ce;la(Ae,je);
Ae.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.Gk)?!1:null!==this.findDraggablePart()};
Ae.prototype.findDraggablePart=function(){var a=this.diagram;a=a.Ll(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};
Ae.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.Ll(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.R("ChangingSelection",a.selection),b=a.lastInput,(Oa?b.meta:b.control)||b.shift||a.clearSelection(!0),this.currentPart.isSelected=!0,a.R("ChangedSelection",a.selection))}}};
Ae.prototype.doActivate=function(){var a=this.diagram;this.An=null;null===this.currentPart&&this.standardMouseSelect();var b=this.currentPart;null!==b&&(b.canMove()||b.canCopy())&&(a.Du(!0),De=null,this.isActive=!0,this.rl.set(a.position),Ee(this,a.selection),this.Bg.length=0,a.animationManager.Bc(),this.draggedParts=this.computeEffectiveCollection(a.selection,this.dragOptions),this.Qw=this.diagram.layout.isRealtime,this.diagram.layout.isRealtime=!1,a.Ks=!0,!0===a.Gf("temporaryPixelRatio")&&30<a.Yw&&
Fe(a),Ge(a,this.draggedParts),this.Ea("Drag"),this.startPoint=a.firstInput.documentPoint,a.isMouseCaptured=!0,a.allowDragOut&&(this.isDragOutStarted=!0,this.Xm=!1,De=this,He=this.diagram,this.doSimulatedDragOut()))};
function Ee(a,b){if(a.dragsLink){var c=a.diagram;c.allowRelink&&(c.model.Vj()&&1===b.count&&b.first()instanceof T?(a.draggedLink=b.first(),a.draggedLink.canRelinkFrom()&&a.draggedLink.canRelinkTo()&&a.draggedLink.Ej(),a.Ne=c.toolManager.findTool("Relinking"),null===a.Ne&&(a.Ne=new Ie,a.Ne.diagram=c),a.Ne.originalLink=a.draggedLink):(a.draggedLink=null,a.Ne=null))}}Ae.prototype.computeEffectiveCollection=function(a,b){return this.diagram.commandHandler.computeEffectiveCollection(a,b)};
Ae.prototype.Kd=function(a){return void 0===a?new Je(pb):this.isGridSnapEnabled?new Je(new J(Math.round(1E3*a.x)/1E3,Math.round(1E3*a.y)/1E3)):new Je(a.copy())};
Ae.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;this.diagram.layout.isRealtime=this.Qw;a.Du(!1);a.tg();Te(this);Ue(a,this.draggedParts);this.draggedParts=this.currentPart=this.An=null;this.Xm=this.isDragOutStarted=!1;if(0<Ce.count){for(var b=Ce,c=b.length,d=0;d<c;d++){var e=b.L(d);Ve(e);We(e);Te(e);e.diagram.tg()}b.clear()}Ve(this);this.rl.h(NaN,NaN);null!==He&&(He.currentCursor="");De=He=null;We(this);a.isMouseCaptured=!1;a.currentCursor="";a.Ks=!1;this.stopTransaction();
Xe(a,!0)};Ae.prototype.stopTransaction=function(){var a=this.diagram,b=je.prototype.stopTransaction.call(this);b&&null!==a.undoManager.transactionToUndo&&a.undoManager.transactionToUndo.$j();return b};function Te(a){var b=a.diagram,c=b.skipsUndoManager;b.skipsUndoManager=!0;Ye(a,b.lastInput,null);b.skipsUndoManager=c;a.Bg.length=0}function Ze(){var a=De;We(a);$e(a);var b=a.diagram;a.rl.w()&&(b.position=a.rl);b.tg()}
Ae.prototype.doCancel=function(){We(this);$e(this);var a=this.diagram;this.rl.w()&&(a.position=this.rl);this.stopTool()};Ae.prototype.doKeyDown=function(){var a=this.diagram,b=a.lastInput;this.isActive&&("Esc"===b.key?this.doCancel():b.key!==a.previousInput.key&&this.doMouseMove())};Ae.prototype.doKeyUp=function(){this.isActive&&this.doMouseMove()};
function af(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.Kf(),c.Ea("Drag")):$e(a);c.skipsUndoManager=!b;c.partManager.addsToTemporaryLayer=!b;a.startPoint=c.firstInput.documentPoint;b=a.copiesEffectiveCollection?a.draggedParts.Lf():c.selection;b=c.Kj(b,c,!0);c=new ob;for(d=a.draggedParts.iterator;d.next();){var e=
d.key;if(e.Wc()&&e.canCopy()){var f=b.I(e);null!==f&&(f.location=e.location,f.Va(),c.add(f,a.Kd(f.location)))}}for(b=b.iterator;b.next();)d=b.value,d instanceof T&&d.canCopy()&&c.add(d,a.Kd());a.copiedParts=c;Ee(a,c.Lf());null!==a.draggedLink&&(c=a.draggedLink,b=c.routeBounds,bf(c,a.startPoint.x-(b.x+b.width/2),a.startPoint.y-(b.y+b.height/2)));a.doUpdateCursor(null)}}}
function We(a){var b=a.diagram;if(null!==a.copiedParts){b.Fs(a.copiedParts.Lf(),!1);a.copiedParts=null;if(null!==a.draggedParts)for(var c=a.draggedParts.iterator;c.next();)c.key instanceof T&&(c.value.point=new J(0,0));a.doUpdateCursor(null)}b.skipsUndoManager=!1;b.partManager.addsToTemporaryLayer=!1;a.startPoint=b.firstInput.documentPoint}
function Ve(a){if(null!==a.draggedLink){if(a.dragsLink&&null!==a.Ne){var b=a.Ne;b.diagram.remove(b.temporaryFromNode);b.diagram.remove(b.temporaryToNode);a.Ne.originalLink=null}a.draggedLink=null;a.Ne=null}}function cf(a,b,c){var d=a.diagram,e=a.startPoint,f=J.alloc();f.assign(d.lastInput.documentPoint);a.moveParts(b,f.qe(e),c);J.free(f);!0===d.Gf("temporaryPixelRatio")&&null===d.Xh&&30<d.Yw&&(Fe(d),d.Zl())}
Ae.prototype.moveParts=function(a,b,c){void 0===c&&(c=!1);var d=this.diagram;null!==d&&df(d,a,b,this.dragOptions,c)};function $e(a){if(null!==a.draggedParts){for(var b=a.diagram,c=a.draggedParts.iterator;c.next();){var d=c.key;d.Wc()&&(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.Kd());bf(d,-e.x,-e.y)}b.Yc()}}
function nf(a,b){var c=a.diagram;a.dragsLink&&(null!==a.draggedLink&&(a.draggedLink.fromNode=null,a.draggedLink.toNode=null),of(a,!1));var d=a.findDragOverObject(b),e=c.lastInput;e.targetObject=d;a.doUpdateCursor(d);var f=c.skipsUndoManager,g=!1;try{c.skipsUndoManager=!0;g=Ye(a,e,d);if(!a.isActive&&null===De)return;var h=null!==d?d.part:null;if(null===h||c.handlesDragDropForTopLevelParts&&h.isTopLevel&&!(h instanceof pf)){var k=c.mouseDragOver;null!==k&&(k(e),g=!0)}if(!a.isActive&&null===De)return;
a.doDragOver(b,d);if(!a.isActive&&null===De)return}finally{c.skipsUndoManager=f,g&&c.Yc()}a.An=d;c.isReadOnly||!c.allowMove&&!c.allowCopy||!c.allowHorizontalScroll&&!c.allowVerticalScroll||c.ds(e.viewPoint)}Ae.prototype.findDragOverObject=function(a){var b=this;return qf(this.diagram,a,null,function(a){null===a?a=!0:(a=a.part,a=null===a||a instanceof te||a.layer.isTemporary||b.draggedParts&&b.draggedParts.contains(a)||b.copiedParts&&b.copiedParts.contains(a)?!0:!1);return!a})};
Ae.prototype.doUpdateCursor=function(a){var b=this.diagram;if(null===a||this.An!==a)!this.diagram.currentTool.isActive||this.mayCopy()?b.currentCursor=this.copyCursor:this.mayMove()?b.currentCursor=this.moveCursor:this.mayDragOut()&&(b.currentCursor=this.nodropCursor)};
function Ye(a,b,c){var d=!1,e=a.Bg.length,f=0<e?a.Bg[0]:null;if(c===f)return!1;b.handled=!1;for(var g=0;g<e;g++){var h=a.Bg[g],k=h.mouseDragLeave;if(null!==k&&(k(b,h,c),d=!0,b.handled))break}a.Bg.length=0;if(!a.isActive&&null===De||null===c)return d;b.handled=!1;for(e=c;null!==e;)a.Bg.push(e),e=rf(e);e=a.Bg.length;for(c=0;c<e&&(g=a.Bg[c],h=g.mouseDragEnter,null===h||(h(b,g,f),d=!0,!b.handled));c++);return d}
function rf(a){var b=a.panel;return null!==b?b:a instanceof U&&!(a instanceof pf)&&(a=a.containingGroup,null!==a&&a.handlesDragDropForMembers)?a:null}function sf(a,b,c){var d=a.Ne;if(null===d)return null;var e=a.diagram.ng(b,d.portGravity,function(a){return d.findValidLinkablePort(a,c)});a=J.alloc();var f=Infinity,g=null;for(e=e.iterator;e.next();){var h=e.value;if(null!==h.part){var k=h.ka(xc,a);k=b.Bf(k);k<f&&(g=h,f=k)}}J.free(a);return g}
function of(a,b){var c=a.draggedLink;if(null!==c&&!(2>c.pointsCount)){var d=a.diagram;if(!d.isReadOnly){var e=a.Ne;if(null!==e){var f=null,g=null;null===c.fromNode&&(f=sf(a,c.i(0),!1),null!==f&&(g=f.part));var h=null,k=null;null===c.toNode&&(h=sf(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.Ox&&d.R("LinkRelinked",c,d.Ox),c.toPort!==d.Px&&d.R("LinkRelinked",c,d.Px)):tf(e,g,f,k,h):tf(e,null,null,null,null)}}}}Ae.prototype.doDragOver=function(){};
function uf(a,b){var c=a.diagram;a.dragsLink&&of(a,!0);Te(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;vf(a,e,f);f=rf(f)}}else f=c.mouseDrop,null!==f&&f(e);if(a.isActive||null!==De){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!==De){a=N.alloc();for(b=
c.selection.iterator;b.next();)d=b.value,d instanceof V&&wf(c,d,a);N.free(a)}}}function vf(a,b,c){a=a.diagram;c=c.part;!a.handlesDragDropForTopLevelParts||!c.isTopLevel||c instanceof pf||(c=a.mouseDrop,null!==c&&c(b))}function wf(a,b,c){var d=!1;c=b.getAvoidableRect(c);a.viewportBounds.Qe(c)&&(d=!0);a=a.Nu(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.Pd(b)&&c.isAvoiding&&c.bb()}
Ae.prototype.doDropOnto=function(){};Ae.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()?(af(this,!1),Ge(a,this.copiedParts),cf(this,this.copiedParts,!1),Ue(a,this.copiedParts)):this.mayMove()?(We(this),cf(this,this.draggedParts,!0)):this.mayDragOut()?(af(this,!1),cf(this,this.copiedParts,!1)):We(this),nf(this,a.lastInput.documentPoint))}};
Ae.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?(We(this),af(this,!0),Ge(a,this.copiedParts),cf(this,this.copiedParts,!1),Ue(a,this.copiedParts),null!==this.copiedParts&&(a.R("ChangingSelection",a.selection),a.clearSelection(!0),this.copiedParts.iteratorKeys.each(function(a){a.isSelected=!0}))):(b=!0,We(this),this.mayMove()&&(cf(this,this.draggedParts,
!0),nf(this,a.lastInput.documentPoint)));this.Xm=!0;uf(this,a.lastInput.documentPoint);if(this.isActive){var d=c?this.copiedParts.Lf():this.draggedParts.Lf();this.copiedParts=null;b&&xf(this);a.Ya();Ue(a,this.draggedParts);this.transactionResult=c?"Copy":"Move";a.R(c?"SelectionCopied":"SelectionMoved",d)}this.stopTool();c&&a.R("ChangedSelection",a.selection)}}};
Ae.prototype.simulatedMouseMove=function(a,b,c){if(null===De)return!1;var d=De.diagram;c instanceof Q||(c=null);var e=He;c!==e&&(null!==e&&e!==d&&(e.tg(),De.isDragOutStarted=!1,e=e.toolManager.findTool("Dragging"),null!==e&&e.doSimulatedDragLeave()),He=c,null!==c&&c!==d&&(Ze(),e=c.toolManager.findTool("Dragging"),null!==e&&(Ce.contains(e)||Ce.add(e),e.doSimulatedDragEnter())),this.doUpdateCursor(null));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.lp(b),c.lastInput.down=!1,c.lastInput.up=!1,d.doSimulatedDragOver());return!0};
Ae.prototype.simulatedMouseUp=function(a,b,c){if(null===De)return!1;var d=He,e=De.diagram;if(null===c)return De.doCancel(),!0;if(c!==d){var f=d.toolManager.findTool("Dragging");if(null!==d&&d!==e&&null!==f)return d.tg(),De.isDragOutStarted=!1,f.doSimulatedDragLeave(),!1;He=c;d=c.toolManager.findTool("Dragging");null!==d&&(Ze(),Ce.contains(d)||Ce.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 J),c.lastInput.documentPoint=b,c.lastInput.viewPoint=c.lp(b),c.lastInput.down=!1,c.lastInput.up=!0,a=c.toolManager.findTool("Dragging"),null!==a&&a.doSimulatedDrop(),a=De,null!==a&&(c=a.mayCopy(),a.transactionResult=c?"Copy":"Move",a.stopTool()),!0):!1};
function xf(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.v())}}
Ae.prototype.mayCopy=function(){if(!this.isCopyEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowCopy||(Oa?!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};
Ae.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};
Ae.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};Ae.prototype.computeBorder=function(a,b,c){return this.Xm||null===this.draggedParts||this.draggedParts.contains(a)?null:c.assign(b)};Ae.prototype.Bz=function(){return De};
Ae.prototype.mayDragIn=function(){var a=this.diagram;if(!a.allowDrop||a.isReadOnly||a.isModelReadOnly||!a.allowInsert)return!1;var b=De;return null===b||b.diagram.model.dataFormat!==a.model.dataFormat?!1:!0};Ae.prototype.doSimulatedDragEnter=function(){if(this.mayDragIn()){var a=this.diagram;a.animationManager.Bc();yf(a);a.animationManager.Bc();a=De;null!==a&&(a.diagram.Ks=!1);this.doUpdateCursor(null)}};Ae.prototype.doSimulatedDragLeave=function(){var a=De;null!==a&&a.doSimulatedDragOut();this.doCancel()};
Ae.prototype.doSimulatedDragOver=function(){var a=this.diagram;a.animationManager.Cm=!0;var b=De;if(null!==b&&null!==b.draggedParts){if(!this.mayDragIn())return;zf(this,b.draggedParts.Lf(),!1,a.firstInput);cf(this,this.copiedParts,!1);nf(this,a.lastInput.documentPoint)}a.animationManager.Cm=!1};
Ae.prototype.doSimulatedDrop=function(){var a=this.diagram,b=De;if(null!==b){var c=b.diagram;b.Xm=!0;We(this);if(!this.mayDragIn())return;a.animationManager.Cm=!0;a.R("ChangingSelection",a.selection);this.Ea("Drop");zf(this,b.draggedParts.Lf(),!0,a.lastInput);cf(this,this.copiedParts,!1);null!==this.copiedParts&&(a.clearSelection(!0),this.copiedParts.iteratorKeys.each(function(a){a.isSelected=!0}));uf(this,a.lastInput.documentPoint);a.Ya();b=a.selection;null!==this.copiedParts?this.transactionResult=
"ExternalCopy":b=new H;this.copiedParts=null;a.doFocus();a.R("ExternalObjectsDropped",b,c);this.stopTransaction();a.R("ChangedSelection",a.selection)}a.animationManager.Cm=!1};
function zf(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.Kj(b,e,!0);var f=N.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;N.free(f);
f=a.Br;g=new ob;h=J.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,bf(m,f.x-d,f.y-e),m.suspendsRouting=!0,g.add(m,a.Kd())));for(b=b.iterator;b.next();)l=b.value,l.Wc()&&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.Va(),g.add(k,a.Kd(h))));J.free(h);a.copiedParts=g;Ee(a,g.Lf());null!==a.draggedLink&&(c=a.draggedLink,b=c.routeBounds,bf(c,a.startPoint.x-(b.x+b.width/2),a.startPoint.y-(b.y+b.height/
2)));a.doUpdateCursor(null)}}}Ae.prototype.doSimulatedDragOut=function(){var a=this.diagram;a.Ks=!1;this.mayCopy()||this.mayMove()?a.currentCursor="":a.currentCursor=this.nodropCursor;this.An=null};Ae.prototype.computeMove=function(a,b,c,d){c=this.diagram;return null!==c?c.computeMove(a,b,this.dragOptions,d):new J};
ma.Object.defineProperties(Ae.prototype,{isCopyEnabled:{get:function(){return this.pb},set:function(a){this.pb=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.hb},set:function(a){this.hb=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.Nc},set:function(a){this.Nc=a}},nodropCursor:{get:function(){return this.Oc},set:function(a){this.Oc=a}},currentPart:{get:function(){return this.V},
set:function(a){this.V=a}},copiedParts:{get:function(){return this.m},set:function(a){this.m=a}},draggedParts:{get:function(){return this.Ha},set:function(a){this.Ha=a}},draggingParts:{get:function(){return null!==this.copiedParts?this.copiedParts.Lf():null!==this.draggedParts?this.draggedParts.Lf():this.se}},draggedLink:{get:function(){return this.diagram.draggedLink},set:function(a){this.diagram.draggedLink=
a}},isDragOutStarted:{get:function(){return this.Hb},set:function(a){this.Hb=a}},startPoint:{get:function(){return this.Br},set:function(a){this.Br.C(a)||this.Br.assign(a)}},delay:{get:function(){return this.Gk},set:function(a){this.Gk=a}}});Ae.prototype.getDraggingSource=Ae.prototype.Bz;var De=null,He=null;Ae.className="DraggingTool";Ce=new F;
Ka("draggingTool",function(){return this.findTool("Dragging")},function(a){this.gb("Dragging",a,this.mouseMoveTools)});La.prototype.doCancel=function(){null!==De&&De.doCancel();je.prototype.doCancel.call(this)};
function Af(){je.call(this);this.se=100;this.Ha=!1;this.u="pointer";var a=new T,b=new Bf;b.isPanelMain=!0;b.stroke="blue";a.add(b);b=new Bf;b.toArrow="Standard";b.fill="blue";b.stroke="blue";a.add(b);a.layerName="Tool";this.Bi=a;a=new V;b=new Bf;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke="magenta";b.strokeWidth=2;b.desiredSize=Gb;a.add(b);a.selectable=!1;a.layerName="Tool";this.Ai=a;this.j=b;a=new V;b=new Bf;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke="magenta";b.strokeWidth=
2;b.desiredSize=Gb;a.add(b);a.selectable=!1;a.layerName="Tool";this.Ci=a;this.m=b;this.Oc=this.Nc=this.pb=this.hb=this.Hb=null;this.ga=!0;this.jy=new ob;this.Of=this.gj=this.Pf=null}la(Af,je);Af.prototype.doStop=function(){this.diagram.tg();this.originalToPort=this.originalToNode=this.originalFromPort=this.originalFromNode=this.originalLink=null;this.validPortsCache.clear();this.targetPort=null};
Af.prototype.copyPortProperties=function(a,b,c,d,e){if(null!==a&&null!==b&&null!==c&&null!==d){var f=b.Df(),g=L.alloc();g.width=b.naturalBounds.width*f;g.height=b.naturalBounds.height*f;d.desiredSize=g;L.free(g);e?(d.toSpot=b.toSpot,d.toEndSegmentLength=b.toEndSegmentLength):(d.fromSpot=b.fromSpot,d.fromEndSegmentLength=b.fromEndSegmentLength);c.locationSpot=xc;f=J.alloc();c.location=b.ka(xc,f);J.free(f);d.angle=b.ki();null!==this.portTargeted&&this.portTargeted(a,b,c,d,e)}};
Af.prototype.setNoTargetPortProperties=function(a,b,c){null!==b&&(b.desiredSize=Gb,b.fromSpot=rc,b.toSpot=rc);null!==a&&(a.location=this.diagram.lastInput.documentPoint);null!==this.portTargeted&&this.portTargeted(null,null,a,b,c)};Af.prototype.doMouseDown=function(){this.isActive&&this.doMouseMove()};
Af.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.ds(a.lastInput.viewPoint)}};Af.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};
Af.prototype.findTargetPort=function(a){var b=this.diagram,c=b.lastInput.documentPoint,d=this.portGravity;0>=d&&(d=.1);var e=this,f=b.ng(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.ka(xc,J.alloc()),l=c.x-k.x,m=c.y-k.y;J.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};
Af.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.Lo(b).count>=c)return!1}return!0};
Af.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.Nd(b).count>=c)return!1}return!0};
Af.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};Af.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.Nd(b);b.next();)if(d=b.value,d.fromNode===c&&d.fromPortId===a)return!0;return!1};
Af.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};Af.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 H;d.add(a);return Cf(this,c,b,d)};
function Cf(a,b,c,d){if(b===c)return!0;var e=b.fromNode;if(null!==e&&e.isLinkLabel&&(d.add(e),Cf(a,e.labeledLink,c,d)))return!0;b=b.toNode;return null!==b&&b.isLinkLabel&&(d.add(b),Cf(a,b.labeledLink,c,d))?!0:!1}
Af.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!==Df){if(d===Ef){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!Ff(this,a,b,c,!0)}if(d===Gf){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!Ff(this,a,b,c,!0)}if(d===Hf)return a===b?a=!0:(d=new H,d.add(b),a=If(this,d,a,b,c)),!a;if(d===Jf)return!Ff(this,a,b,c,!1);if(d===Rf)return a===b?a=!0:(d=new H,d.add(b),a=Sf(this,d,a,b,c)),!a}return!0};function Ff(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&&Ff(a,g,c,d,e)))return!0}return!1}
function If(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&&If(a,b,g,d,e)))return!0}return!1}function Sf(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&&Sf(a,b,h,d,e))return!0}}return!1}
ma.Object.defineProperties(Af.prototype,{portGravity:{get:function(){return this.se},set:function(a){0<=a&&(this.se=a)}},isUnconnectedLinkValid:{get:function(){return this.Ha},set:function(a){this.Ha=a}},linkingCursor:{get:function(){return this.u},set:function(a){this.u=a}},temporaryLink:{get:function(){return this.Bi},set:function(a){this.Bi=a}},temporaryFromNode:{
get:function(){return this.Ai},set:function(a){if(this.Ai=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.O.indexOf(this.j);b.nb(c);b.Gb(c,a)}}this.j=a}},temporaryToNode:{get:function(){return this.Ci},set:function(a){if(this.Ci=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.O.indexOf(this.m);b.nb(c);b.Gb(c,a)}}this.m=a}},originalLink:{get:function(){return this.Hb},set:function(a){this.Hb=a}},originalFromNode:{get:function(){return this.hb},set:function(a){this.hb=a}},originalFromPort:{get:function(){return this.pb},set:function(a){this.pb=a}},originalToNode:{get:function(){return this.Nc},set:function(a){this.Nc=
a}},originalToPort:{get:function(){return this.Oc},set:function(a){this.Oc=a}},isForwards:{get:function(){return this.ga},set:function(a){this.ga=a}},validPortsCache:{get:function(){return this.jy}},targetPort:{get:function(){return this.Pf},set:function(a){this.Pf=a}},linkValidation:{get:function(){return this.gj},set:function(a){this.gj=a}},portTargeted:{
get:function(){return this.Of},set:function(a){this.Of=a}}});Af.className="LinkingBaseTool";function Tf(){Af.call(this);this.name="Linking";this.V={};this.F=null;this.K=Uf;this.Vd=null}la(Tf,Af);Tf.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowLink||!a.model.us()||!a.lastInput.left||a.currentTool!==this&&!this.isBeyondDragSize()?!1:null!==this.findLinkablePort()};
Tf.prototype.findLinkablePort=function(){var a=this.diagram,b=this.startObject;null===b&&(b=a.gc(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===Uf||c===Vf){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===Uf||c===Wf)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};
Tf.prototype.doActivate=function(){var a=this.diagram,b=this.findLinkablePort();null===b?this.stopTool():(this.Ea(this.name),a.isMouseCaptured=!0,a.currentCursor=this.linkingCursor,this.isForwards?(null!==this.temporaryToNode&&(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=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),this.temporaryFromNode&&this.temporaryFromNode.Va(),a.add(this.temporaryToNode),this.temporaryToNode&&this.temporaryToNode.Va(),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.bb(),a.add(this.temporaryLink)),this.isActive=!0)};Tf.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()};
Tf.prototype.doStop=function(){Af.prototype.doStop.call(this);this.startObject=null};
Tf.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.R("ChangingSelection",a.selection),a.clearSelection(!0),f.isSelected=!0),this.transactionResult=this.name,a.R("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.R("ChangedSelection",a.selection)}}};Tf.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};
Tf.prototype.insertLink=function(a,b,c,d){return this.diagram.partManager.insertLink(a,b,c,d)};Tf.prototype.doNoLink=function(){};
ma.Object.defineProperties(Tf.prototype,{archetypeLinkData:{get:function(){return this.V},set:function(a){this.V=a}},archetypeLabelNodeData:{get:function(){return this.F},set:function(a){this.F=a}},direction:{get:function(){return this.K},set:function(a){this.K=a}},startObject:{get:function(){return this.Vd},set:function(a){this.Vd=a}}});
var Uf=new E(Tf,"Either",0),Vf=new E(Tf,"ForwardsOnly",0),Wf=new E(Tf,"BackwardsOnly",0);Tf.className="LinkingTool";Tf.Either=Uf;Tf.ForwardsOnly=Vf;Tf.BackwardsOnly=Wf;
function Ie(){Af.call(this);this.name="Relinking";var a=new Bf;a.figure="Diamond";a.desiredSize=Ib;a.fill="lightblue";a.stroke="dodgerblue";a.cursor=this.linkingCursor;a.segmentIndex=0;this.V=a;a=new Bf;a.figure="Diamond";a.desiredSize=Ib;a.fill="lightblue";a.stroke="dodgerblue";a.cursor=this.linkingCursor;a.segmentIndex=-1;this.Vd=a;this.F=null;this.Cw=new N}la(Ie,Af);
Ie.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.w()&&a.isVisible()&&d.actualBounds.w()&&d.Qd()&&(c=a.Pj(b),null===c&&(c=this.makeAdornment(d,!1),a.$g(b,c)))}null===c&&a.Jf(b);b="RelinkTo";c=null;a.isSelected&&!this.diagram.isReadOnly&&(d=a.selectionObject,null!==d&&a.canRelinkTo()&&a.actualBounds.w()&&a.isVisible()&&d.actualBounds.w()&&d.Qd()&&
(c=a.Pj(b),null===c?(c=this.makeAdornment(d,!0),a.$g(b,c)):c.v()));null===c&&a.Jf(b)}};Ie.prototype.makeAdornment=function(a,b){var c=new te;c.type=W.Link;b=b?this.toHandleArchetype:this.fromHandleArchetype;null!==b&&c.add(b.copy());c.adornedObject=a;return c};
Ie.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowRelink||!a.model.us()||!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};
Ie.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 te&&c.adornedPart instanceof T))return;this.handle=b;this.isForwards=null===c||"RelinkTo"===c.category;this.originalLink=c.adornedPart}this.Ea(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.Cw.set(this.originalLink.actualBounds);null!==this.originalLink&&0<this.originalLink.pointsCount&&(null===this.originalLink.fromNode&&(null!==this.temporaryFromPort&&(this.temporaryFromPort.desiredSize=Cb),null!==this.temporaryFromNode&&(this.temporaryFromNode.location=this.originalLink.i(0))),null===this.originalLink.toNode&&
(null!==this.temporaryToPort&&(this.temporaryToPort.desiredSize=Cb),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.bb(),a.add(this.temporaryLink));this.isActive=!0};
Ie.prototype.copyLinkProperties=function(a,b){if(null!==a&&null!==b){b.adjusting=a.adjusting;b.corner=a.corner;var c=a.curve;if(c===Xf||c===Yf)c=Zf;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}};
Ie.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()};Ie.prototype.doStop=function(){Af.prototype.doStop.call(this);this.handle=null};
Ie.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.bb()),this.transactionResult=this.name,a.R("LinkRelinked",f,this.isForwards?this.originalToPort:this.originalFromPort)):this.doNoRelink(this.originalLink,this.isForwards);this.originalLink.Uo(this.Cw)}finally{this.stopTool()}}};
Ie.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};Ie.prototype.doNoRelink=function(){};
function tf(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(Ie.prototype,{fromHandleArchetype:{get:function(){return this.V},set:function(a){this.V=a}},toHandleArchetype:{get:function(){return this.Vd},set:function(a){this.Vd=a}},handle:{get:function(){return this.F},set:function(a){if(null!==a&&!(a.part instanceof te))throw Error("new handle is not in an Adornment: "+a);this.F=a}}});Ie.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 $f(){je.call(this);this.name="LinkReshaping";var a=new Bf;a.figure="Rectangle";a.desiredSize=Hb;a.fill="lightblue";a.stroke="dodgerblue";this.m=a;a=new Bf;a.figure="Diamond";a.desiredSize=Ib;a.fill="lightblue";a.stroke="dodgerblue";a.cursor="move";this.u=a;this.F=3;this.Qs=this.j=null;this.Dw=new J;this.Uq=new F}la($f,je);$f.prototype.Ru=function(a){return a&&0!==a.reshapingBehavior.value?a.reshapingBehavior:ag};$f.prototype.nm=function(a,b){a.reshapingBehavior=b};
$f.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.w()&&a.isVisible()&&c.actualBounds.w()&&c.Qd()&&(b=a.Pj(this.name),null===b||b.yw!==a.pointsCount||b.Sw!==a.resegmentable)&&(b=this.makeAdornment(c),null!==b&&(b.yw=a.pointsCount,b.Sw=a.resegmentable,a.$g(this.name,b)))}null===b&&a.Jf(this.name)}};
$f.prototype.makeAdornment=function(a){var b=a.part,c=b.pointsCount,d=b.isOrthogonal,e=null;if(null!==b.points&&1<c){e=new te;e.type=W.Link;c=b.firstPickIndex;var f=b.lastPickIndex,g=d?1:0;if(b.resegmentable&&b.computeCurve()!==bg)for(var h=c+g;h<f-g;h++){var k=this.makeResegmentHandle(a,h);null!==k&&(k.segmentIndex=h,k.segmentFraction=.5,k.fromMaxLinks=999,e.add(k))}for(g=c+1;g<f;g++)if(h=this.makeHandle(a,g),null!==h){h.segmentIndex=g;if(g!==c)if(g===c+1&&d){k=b.i(c);var l=b.i(c+1);K.B(k.x,l.x)&&
K.B(k.y,l.y)&&(l=b.i(c-1));K.B(k.x,l.x)?(this.nm(h,cg),h.cursor="n-resize"):K.B(k.y,l.y)&&(this.nm(h,dg),h.cursor="w-resize")}else g===f-1&&d?(k=b.i(f-1),l=b.i(f),K.B(k.x,l.x)&&K.B(k.y,l.y)&&(k=b.i(f+1)),K.B(k.x,l.x)?(this.nm(h,cg),h.cursor="n-resize"):K.B(k.y,l.y)&&(this.nm(h,dg),h.cursor="w-resize")):g!==f&&(this.nm(h,eg),h.cursor="move");e.add(h)}e.adornedObject=a}return e};$f.prototype.makeHandle=function(){var a=this.handleArchetype;return null===a?null:a.copy()};
$f.prototype.makeResegmentHandle=function(){var a=this.midHandleArchetype;return null===a?null:a.copy()};$f.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};
$f.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.Qs=b;a.isMouseCaptured=!0;this.Ea(this.name);if(b.resegmentable&&999===this.handle.fromMaxLinks){var c=b.points.copy(),d=this.getResegmentingPoint();c.Gb(this.handle.segmentIndex+1,d);b.isOrthogonal&&c.Gb(this.handle.segmentIndex+1,d);b.points=c;b.Ub();b.updateAdornments();
this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name);if(null===this.handle){this.doDeactivate();return}}this.Dw=b.i(this.handle.segmentIndex);this.Uq=b.points.copy();this.isActive=!0}}};$f.prototype.doDeactivate=function(){this.stopTransaction();this.Qs=this.handle=null;this.isActive=this.diagram.isMouseCaptured=!1};
$f.prototype.stopTransaction=function(){var a=this.diagram,b=je.prototype.stopTransaction.call(this);b&&null!==a.undoManager.transactionToUndo&&a.undoManager.transactionToUndo.$j();return b};$f.prototype.doCancel=function(){var a=this.adornedLink;null!==a&&(a.points=this.Uq);this.stopTool()};$f.prototype.getResegmentingPoint=function(){return this.handle.ka(xc)};$f.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeReshape(a.lastInput.documentPoint),this.reshape(a))};
$f.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&&(fg(this,g,d,e,f,!0)||fg(this,g,d,e,f,!1))){var h=b.points.copy();fg(this,g,d,
e,f,!0)?(h.Zc(c-2,new J(g.x,(f.y+g.y)/2)),h.Zc(c+1,new J(f.x,(f.y+g.y)/2))):(h.Zc(c-2,new J((f.x+g.x)/2,g.y)),h.Zc(c+1,new J((f.x+g.x)/2,f.y)));h.nb(c);h.nb(c-1);b.points=h;b.Ub()}else g=b.i(c+2),Math.abs(e.x-f.x)<this.resegmentingDistance&&Math.abs(e.y-f.y)<this.resegmentingDistance&&(fg(this,d,e,f,g,!0)||fg(this,d,e,f,g,!1))&&(h=b.points.copy(),fg(this,d,e,f,g,!0)?(h.Zc(c-1,new J(d.x,(d.y+g.y)/2)),h.Zc(c+2,new J(g.x,(d.y+g.y)/2))):(h.Zc(c-1,new J((d.x+g.x)/2,d.y)),h.Zc(c+2,new J((d.x+g.x)/2,g.y))),
h.nb(c+1),h.nb(c),b.points=h,b.Ub())}}else g=J.alloc(),K.oh(d.x,d.y,f.x,f.y,e.x,e.y,g)&&g.Bf(e)<this.resegmentingDistance*this.resegmentingDistance&&(d=b.points.copy(),d.nb(c),b.points=d,b.Ub()),J.free(g)}a.Ya();this.transactionResult=this.name;a.R("LinkReshaped",this.adornedLink,this.Uq)}this.stopTool()};
function fg(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}
$f.prototype.reshape=function(a){var b=this.adornedLink;b.sh();var c=this.handle.segmentIndex,d=this.Ru(this.handle);if(b.isOrthogonal)if(c===b.firstPickIndex+1)c=b.firstPickIndex+1,d===cg?(b.M(c,b.i(c-1).x,a.y),b.M(c+1,b.i(c+2).x,a.y)):d===dg&&(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===cg?(b.M(c-1,b.i(c-2).x,a.y),b.M(c,b.i(c+1).x,a.y)):d===dg&&(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);K.B(f.x,
e.x)&&K.B(e.y,g.y)?(K.B(f.x,b.i(d-2).x)&&!K.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),K.B(g.y,b.i(d+2).y)&&!K.B(g.x,b.i(d+2).x)?b.l(d+1,g.x,a.y):b.M(d+1,g.x,a.y)):K.B(f.y,e.y)&&K.B(e.x,g.x)?(K.B(f.y,b.i(d-2).y)&&!K.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),K.B(g.x,b.i(d+2).x)&&!K.B(g.y,b.i(d+2).y)?b.l(d+1,a.x,g.y):b.M(d+1,a.x,g.y)):K.B(f.x,e.x)&&K.B(e.x,g.x)?(K.B(f.x,b.i(d-2).x)&&!K.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),K.B(g.x,b.i(d+2).x)&&
!K.B(g.y,b.i(d+2).y)?b.l(d+1,a.x,g.y):b.M(d+1,a.x,g.y)):K.B(f.y,e.y)&&K.B(e.y,g.y)&&(K.B(f.y,b.i(d-2).y)&&!K.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),K.B(g.y,b.i(d+2).y)&&!K.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).Lc()&&(f=e.ka(xc,J.alloc()),d=b.getLinkPointFromPoint(d,e,f,a,!0,J.alloc()),b.M(0,d.x,d.y),J.free(f),
J.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).Lc()&&(c=e.ka(xc,J.alloc()),a=b.getLinkPointFromPoint(d,e,c,a,!1,J.alloc()),b.M(b.pointsCount-1,a.x,a.y),J.free(c),J.free(a));b.zf()};$f.prototype.computeReshape=function(a){var b=this.adornedLink,c=this.handle.segmentIndex;switch(this.Ru(this.handle)){case eg:return a;case cg:return new J(b.i(c).x,a.y);case dg:return new J(a.x,b.i(c).y);default:case ag:return b.i(c)}};
ma.Object.defineProperties($f.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 te))throw Error("new handle is not in an Adornment: "+a);this.j=a}},adornedLink:{get:function(){return this.Qs}},
resegmentingDistance:{get:function(){return this.F},set:function(a){this.F=a}},originalPoint:{get:function(){return this.Dw}},originalPoints:{get:function(){return this.Uq}}});$f.prototype.setReshapingBehavior=$f.prototype.nm;$f.prototype.getReshapingBehavior=$f.prototype.Ru;var ag=new E($f,"None",0),dg=new E($f,"Horizontal",1),cg=new E($f,"Vertical",2),eg=new E($f,"All",3);$f.className="LinkReshapingTool";
$f.None=ag;$f.Horizontal=dg;$f.Vertical=cg;$f.All=eg;Ka("linkReshapingTool",function(){return this.findTool("LinkReshaping")},function(a){this.gb("LinkReshaping",a,this.mouseDownTools)});
function gg(){je.call(this);this.name="Resizing";this.m=(new L(1,1)).freeze();this.j=(new L(9999,9999)).freeze();this.xg=(new L(NaN,NaN)).freeze();this.V=!1;this.ga=!0;this.te=null;var a=new Bf;a.alignmentFocus=xc;a.figure="Rectangle";a.desiredSize=Hb;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.F=a;this.u=null;this.Tq=new J;this.Bw=new L;this.Sn=new J;this.ot=new L(0,0);this.nt=new L(Infinity,Infinity);this.mt=new L(1,1)}la(gg,je);
gg.prototype.updateAdornments=function(a){if(!(null===a||a instanceof T)){if(a.isSelected&&!this.diagram.isReadOnly){var b=a.resizeObject,c=a.Pj(this.name);if(null!==b&&a.canResize()&&a.actualBounds.w()&&a.isVisible()&&b.actualBounds.w()&&b.Qd()){if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){b=b.ki();hg(a)&&this.updateResizeHandles(c,b);a.$g(this.name,c);return}}}a.Jf(this.name)}};
gg.prototype.makeAdornment=function(a){var b=a.part.resizeAdornmentTemplate;if(null===b){b=new te;b.type=W.Spot;b.locationSpot=xc;var c=new ig;c.isPanelMain=!0;b.add(c);b.add(this.makeHandle(a,sc));b.add(this.makeHandle(a,uc));b.add(this.makeHandle(a,Bc));b.add(this.makeHandle(a,zc));b.add(this.makeHandle(a,$c));b.add(this.makeHandle(a,bd));b.add(this.makeHandle(a,cd));b.add(this.makeHandle(a,ad))}else if(jg(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};
gg.prototype.makeHandle=function(a,b){a=this.handleArchetype;if(null===a)return null;a=a.copy();a.alignment=b;return a};
gg.prototype.updateResizeHandles=function(a,b){if(null!==a)if(!a.alignment.Vb()&&("pointer"===a.cursor||0<a.cursor.indexOf("resize")))a:{var c=a.alignment;c.Lc()&&(c=xc);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)};gg.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};
gg.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.Bc(),this.Ea(this.name),this.Tq.set(this.adornedObject.ka(this.handle.alignment.gv())),this.Sn.set(this.adornedObject.part.location),this.Bw.set(this.adornedObject.desiredSize),this.mt=this.computeCellSize(),this.ot=
this.computeMinSize(),this.nt=this.computeMaxSize(),this.isActive=!0))};gg.prototype.doDeactivate=function(){var a=this.diagram;this.stopTransaction();this.te=this.handle=null;this.isActive=a.isMouseCaptured=!1};gg.prototype.stopTransaction=function(){var a=this.diagram,b=je.prototype.stopTransaction.call(this);b&&null!==a.undoManager.transactionToUndo&&a.undoManager.transactionToUndo.$j();return b};
gg.prototype.doCancel=function(){null!==this.adornedObject&&(this.adornedObject.desiredSize=this.originalDesiredSize,this.adornedObject.part.location=this.originalLocation);this.stopTool()};gg.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive){var b=this.ot,c=this.nt,d=this.mt,e=this.adornedObject.ns(a.lastInput.documentPoint,J.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);a.Yc();J.free(e)}};
gg.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.ot,c=this.nt,d=this.mt,e=this.adornedObject.ns(a.lastInput.documentPoint,J.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);J.free(e);a.Ya();this.transactionResult=this.name;a.R("PartResized",this.adornedObject,this.originalDesiredSize)}this.stopTool()};
gg.prototype.resize=function(a){var b=this.diagram,c=this.adornedObject;if(null!==c){c.desiredSize=a.size;a=c.part;a.Va();c=c.ka(this.handle.alignment.gv());if(a instanceof pf){var d=new F;d.add(a);if(!this.dragsMembers&&null===a.placeholder){var e=new Be;e.dragsMembers=!1}b.moveParts(d,this.oppositePoint.copy().qe(c),!0,e)}else a.location=a.location.copy().qe(c).add(this.oppositePoint);b.Yc()}};
gg.prototype.computeResize=function(a,b,c,d,e,f){b.Lc()&&(b=xc);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=J.alloc();K.Mo(a.x,a.y,h,k,e.width,e.height,p);a=g.copy();0>=b.x?0>=b.y?(a.x=Math.max(p.x,l-d.width),a.x=Math.min(a.x,l-c.width),a.width=Math.max(l-a.x,c.width),a.y=Math.max(p.y,m-d.height),a.y=Math.min(a.y,m-c.height),a.height=Math.max(m-a.y,c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*
a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width),a.x=l-a.width,a.y=m-a.height)):1<=b.y?(a.x=Math.max(p.x,l-d.width),a.x=Math.min(a.x,l-c.width),a.width=Math.max(l-a.x,c.width),a.height=Math.max(Math.min(p.y-k,d.height),c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width),a.x=l-a.width)):(a.x=
Math.max(p.x,l-d.width),a.x=Math.min(a.x,l-c.width),a.width=l-a.x,f||(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n,a.y=k+.5*(m-k-a.height))):1<=b.x?0>=b.y?(a.width=Math.max(Math.min(p.x-h,d.width),c.width),a.y=Math.max(p.y,m-d.height),a.y=Math.min(a.y,m-c.height),a.height=Math.max(m-a.y,c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width),
a.y=m-a.height)):1<=b.y?(a.width=Math.max(Math.min(p.x-h,d.width),c.width),a.height=Math.max(Math.min(p.y-k,d.height),c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width))):(a.width=Math.max(Math.min(p.x-h,d.width),c.width),f||(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n,a.y=k+.5*(m-k-a.height))):0>=b.y?(a.y=Math.max(p.y,m-d.height),
a.y=Math.min(a.y,m-c.height),a.height=m-a.y,f||(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width,a.x=h+.5*(l-h-a.width))):1<=b.y&&(a.height=Math.max(Math.min(p.y-k,d.height),c.height),f||(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width,a.x=h+.5*(l-h-a.width)));J.free(p);return a};gg.prototype.computeReshape=function(){var a=kg;this.adornedObject instanceof Bf&&(a=lg(this.adornedObject));return!(a===mg||this.diagram.lastInput.shift)};
gg.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};gg.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};
gg.prototype.computeCellSize=function(){var a=new L(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(gg.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 te))throw Error("new handle is not in an Adornment: "+a);this.u=a}},adornedObject:{get:function(){return this.te},set:function(a){if(null!==a&&a.part instanceof te)throw Error("new handle must not be in an Adornment: "+
a);this.te=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.xg},set:function(a){this.xg.C(a)||this.xg.assign(a)}},
isGridSnapEnabled:{get:function(){return this.V},set:function(a){this.V=a}},dragsMembers:{get:function(){return this.ga},set:function(a){this.ga=a}},oppositePoint:{get:function(){return this.Tq},set:function(a){this.Tq.C(a)||this.Tq.assign(a)}},originalDesiredSize:{get:function(){return this.Bw}},originalLocation:{get:function(){return this.Sn}}});
gg.className="ResizingTool";Ka("resizingTool",function(){return this.findTool("Resizing")},function(a){this.gb("Resizing",a,this.mouseDownTools)});function ng(){je.call(this);this.name="Rotating";this.ga=45;this.V=2;this.Sn=new J;this.te=null;var a=new Bf;a.figure="Ellipse";a.desiredSize=Ib;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.m=a;this.j=null;this.Aw=0;this.gr=new J(NaN,NaN);this.u=0;this.F=50}la(ng,je);
ng.prototype.updateAdornments=function(a){if(null!==a){if(a.nh()){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.w()&&a.isVisible()&&b.actualBounds.w()&&b.Qd())){var c=a.Pj(this.name);if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){c.angle=b.ki();null===c.placeholder&&(c.location=this.computeAdornmentLocation(b));a.$g(this.name,c);return}}a.Jf(this.name)}};
ng.prototype.makeAdornment=function(a){var b=a.part.rotateAdornmentTemplate;if(null===b){b=new te;b.type=W.Position;b.locationSpot=xc;var c=this.handleArchetype;null!==c&&b.add(c.copy())}else if(jg(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};ng.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};
ng.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.Ea(this.name),this.Aw=this.adornedObject.angle,this.gr=this.computeRotationPoint(this.adornedObject),this.Sn=this.adornedObject.part.location.copy(),this.isActive=!0)};
ng.prototype.computeRotationPoint=function(a){var b=a.part,c=b.locationObject;return b.rotationSpot.vb()?a.ka(b.rotationSpot):a===b||a===c?c.ka(b.locationSpot):a.ka(xc)};
ng.prototype.computeAdornmentLocation=function(a){var b=this.rotationPoint;b.w()||(b=this.computeRotationPoint(a));b=a.ns(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.ka(b)};ng.prototype.doDeactivate=function(){var a=this.diagram;this.stopTransaction();this.te=this.handle=null;this.gr=new J(NaN,NaN);this.isActive=a.isMouseCaptured=!1};ng.prototype.stopTransaction=function(){var a=this.diagram,b=je.prototype.stopTransaction.call(this);b&&null!==a.undoManager.transactionToUndo&&a.undoManager.transactionToUndo.$j();return b};ng.prototype.doCancel=function(){this.diagram.delaysLayout=!1;this.rotate(this.originalAngle);this.stopTool()};
ng.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeRotate(a.lastInput.documentPoint),this.rotate(a))};ng.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){a.delaysLayout=!1;var b=this.computeRotate(a.lastInput.documentPoint);this.rotate(b);a.Ya();this.transactionResult=this.name;a.R("PartRotated",this.adornedObject,this.originalAngle)}this.stopTool()};
ng.prototype.rotate=function(a){var b=this.adornedObject;if(null!==b){b.angle=a;b=b.part;b.Va();var c=b.locationObject,d=b.rotateObject;if(c===d||c.qg(d))c=this.Sn.copy(),b.location=c.qe(this.rotationPoint).rotate(a-this.originalAngle).add(this.rotationPoint);this.diagram.Yc()}};
ng.prototype.computeRotate=function(a){a=this.rotationPoint.ab(a)-this.handleAngle;var b=this.adornedObject.panel;null!==b&&(a-=b.ki());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(ng.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 te))throw Error("new handle is not in an Adornment: "+a);this.j=a}},adornedObject:{get:function(){return this.te},set:function(a){if(null!==a&&a.part instanceof te)throw Error("new handle must not be in an Adornment: "+
a);this.te=a}},snapAngleMultiple:{get:function(){return this.ga},set:function(a){this.ga=a}},snapAngleEpsilon:{get:function(){return this.V},set:function(a){this.V=a}},originalAngle:{get:function(){return this.Aw}},rotationPoint:{get:function(){return this.gr},set:function(a){this.gr=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}}});ng.className="RotatingTool";Ka("rotatingTool",function(){return this.findTool("Rotating")},function(a){this.gb("Rotating",a,this.mouseDownTools)});function og(){je.call(this);this.name="ClickSelecting"}la(og,je);og.prototype.canStart=function(){return!this.isEnabled||this.isBeyondDragSize()?!1:!0};
og.prototype.doMouseUp=function(){this.isActive&&(this.standardMouseSelect(),!this.standardMouseClick()&&this.diagram.lastInput.isTouchEvent&&this.diagram.toolManager.doToolTip());this.stopTool()};og.className="ClickSelectingTool";function pg(){je.call(this);this.name="Action";this.mk=null}la(pg,je);
pg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram,b=a.lastInput,c=a.gc(b.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a});if(null!==c){if(!c.isActionable)return!1;this.mk=c;a.Ak=a.gc(b.documentPoint,null,null);return!0}return!1};pg.prototype.doMouseDown=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.mk;null!==b&&(a.targetObject=b,null!==b.actionDown&&b.actionDown(a,b))}else this.canStart()&&this.doActivate()};
pg.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.mk;null!==b&&(a.targetObject=b,null!==b.actionMove&&b.actionMove(a,b))}};pg.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.mk;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()};
pg.prototype.doCancel=function(){var a=this.diagram.lastInput,b=this.mk;null!==b&&(a.targetObject=b,null!==b.actionCancel&&b.actionCancel(a,b),this.stopTool())};pg.prototype.doStop=function(){this.mk=null};pg.className="ActionTool";function qg(){je.call(this);this.name="ClickCreating";this.Qi=null;this.m=!0;this.j=!1;this.kw=new J(0,0)}la(qg,je);
qg.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.kw=a.lastInput.viewPoint.copy()),2!==a.lastInput.clickCount||this.isBeyondDragSize(this.kw))return!1}else if(1!==a.lastInput.clickCount)return!1;return a.currentTool!==this&&null!==a.Ll(a.lastInput.documentPoint,!0)?!1:!0};
qg.prototype.doMouseUp=function(){var a=this.diagram;this.isActive&&this.insertPart(a.lastInput.documentPoint);this.stopTool()};
qg.prototype.insertPart=function(a){var b=this.diagram,c=this.archetypeNodeData;if(null===c)return null;var d=null;try{b.R("ChangingSelection",b.selection);this.Ea(this.name);if(c instanceof U)c.Wc()&&(jg(c),d=c.copy(),null!==d&&b.add(d));else if(null!==c){var e=b.model.copyNodeData(c);za(e)&&(b.model.xf(e),d=b.Kc(e))}if(null!==d){var f=J.allocAt(a.x,a.y);this.isGridSnapEnabled&&zg(this.diagram,d,a,f);d.location=f;b.allowSelect&&(b.clearSelection(!0),d.isSelected=!0);J.free(f)}b.Ya();this.transactionResult=
this.name;b.R("PartCreated",d)}finally{this.stopTransaction(),b.R("ChangedSelection",b.selection)}return d};ma.Object.defineProperties(qg.prototype,{archetypeNodeData:{get:function(){return this.Qi},set:function(a){this.Qi=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}}});qg.className="ClickCreatingTool";
function Ag(){je.call(this);this.name="DragSelecting";this.Gk=175;this.m=!1;var a=new U;a.layerName="Tool";a.selectable=!1;var b=new Bf;b.name="SHAPE";b.figure="Rectangle";b.fill=null;b.stroke="magenta";a.add(b);this.j=a}la(Ag,je);
Ag.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.Ll(b.documentPoint,!0))?!1:!0};Ag.prototype.doActivate=function(){var a=this.diagram;this.isActive=!0;a.isMouseCaptured=!0;a.skipsUndoManager=!0;a.add(this.box);this.doMouseMove()};
Ag.prototype.doDeactivate=function(){var a=this.diagram;a.tg();a.remove(this.box);a.skipsUndoManager=!1;this.isActive=a.isMouseCaptured=!1};Ag.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.sb());var d=L.alloc().h(b.width,b.height);c.desiredSize=d;this.box.lm(b.x,b.y,!1);L.free(d);(a.allowHorizontalScroll||a.allowVerticalScroll)&&a.ds(a.lastInput.viewPoint)}};
Ag.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram;a.remove(this.box);try{a.currentCursor="wait",a.R("ChangingSelection",a.selection),this.selectInRect(this.computeBoxBounds()),a.R("ChangedSelection",a.selection)}finally{a.currentCursor=""}}this.stopTool()};Ag.prototype.computeBoxBounds=function(){var a=this.diagram;return new N(a.firstInput.documentPoint,a.lastInput.documentPoint)};
Ag.prototype.selectInRect=function(a){var b=this.diagram,c=b.lastInput;a=b.ux(a,this.isPartialInclusion);if(Oa?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 F;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(Ag.prototype,{delay:{get:function(){return this.Gk},set:function(a){this.Gk=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}}});Ag.className="DragSelectingTool";
function Bg(){je.call(this);this.name="Panning";this.Wt=new J;this.zy=new J;this.wg=!1;var a=this;this.Iw=function(){var b=a.diagram;null!==b&&b.removeEventListener(x.document,"scroll",a.Iw,!1);a.stopTool()}}la(Bg,je);Bg.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};
Bg.prototype.doActivate=function(){var a=this.diagram;this.wg?(a.lastInput.bubbles=!0,a.addEventListener(x.document,"scroll",this.Iw,!1)):(a.currentCursor="move",a.isMouseCaptured=!0,this.Wt.assign(a.position));this.isActive=!0};Bg.prototype.doDeactivate=function(){var a=this.diagram;a.currentCursor="";this.isActive=a.isMouseCaptured=!1};Bg.prototype.doCancel=function(){var a=this.diagram;a.position=this.Wt;a.isMouseCaptured=!1;this.stopTool()};Bg.prototype.doMouseMove=function(){this.move()};
Bg.prototype.doMouseUp=function(){this.move();this.stopTool()};Bg.prototype.move=function(){var a=this.diagram;if(this.isActive&&a)if(this.wg)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.zy.h(e,c)}};
ma.Object.defineProperties(Bg.prototype,{bubbles:{get:function(){return this.wg},set:function(a){this.wg=a}},originalPosition:{get:function(){return this.Wt}}});Bg.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 ye(){this.F=this.u=this.j=this.m=null}
ma.Object.defineProperties(ye.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}}});ye.className="HTMLInfo";
function Cg(a,b,c){this.text=a;this.hx=b;this.visible=c}Cg.className="ContextMenuButtonInfo";function Dg(){je.call(this);this.name="ContextMenu";this.m=this.dt=this.j=null;this.ww=new J;this.ft=null;this.Bt=!1;var a=this;this.su=function(){a.stopTool()}}la(Dg,je);
function Eg(a){var b=new ye;b.show=function(a,b,c){c.showDefaultContextMenu()};b.hide=function(a,b){b.hideDefaultContextMenu()};Fg=b;a.su=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",Gg,!1),d.addEventListener(b,"selectstart",
Gg,!1),d.addEventListener(c,"contextmenu",Gg,!1));b.className="goCXforeground";c.className="goCXbackground";x.document.body&&(x.document.body.appendChild(b),x.document.body.appendChild(c));Hg=b;Ig=c;Jg=!0}function Gg(a){a.preventDefault();return!1}
Dg.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};Dg.prototype.doStart=function(){this.ww.set(this.diagram.firstInput.documentPoint)};Dg.prototype.doStop=function(){this.hideContextMenu();this.currentObject=null};
Dg.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.gc(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};Dg.prototype.doActivate=function(){};
Dg.prototype.doMouseDown=function(){je.prototype.doMouseDown.call(this);if(this.isActive&&this.currentContextMenu instanceof te){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doMouseDown(),a.doDeactivate())}this.diagram.toolManager.mouseDownTools.contains(this)&&Kg(this)};
Dg.prototype.doMouseUp=function(){if(this.isActive&&this.currentContextMenu instanceof te){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doCancel(),a.doDeactivate())}Kg(this)};
function Kg(a){var b=a.diagram;if(a.isActive){var c=a.currentContextMenu;if(null!==c){if(!(c instanceof ye)){var d=b.gc(b.lastInput.documentPoint,null,null);null!==d&&d.qg(c)&&a.standardMouseClick(null,null)}a.stopTool();a.canStart()&&(b.currentTool=a,a.doMouseUp())}}else a.canStart()&&(Lg(a,!0),a.isActive||a.stopTool())}
function Lg(a,b,c){void 0===c&&(c=null);if(!a.Bt&&(a.Bt=!0,b&&a.standardMouseSelect(),b=a.standardMouseClick(),a.Bt=!1,!b)){a.isActive=!0;b=Fg;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 te&&!a.currentContextMenu.visible&&a.stopTool()}}
Dg.prototype.doMouseMove=function(){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.doMouseMove();this.isActive&&this.diagram.toolManager.doMouseMove()};
Dg.prototype.showContextMenu=function(a,b){var c=this.diagram;a!==this.currentContextMenu&&this.hideContextMenu();if(a instanceof te){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.Va();this.positionContextMenu(a,b)}else a instanceof ye&&a.show(b,c,this);this.currentContextMenu=a};
Dg.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}};
Dg.prototype.hideContextMenu=function(){var a=this.diagram,b=this.currentContextMenu;null!==b&&(b instanceof te?(a.remove(b),null!==this.dt&&this.dt.Jf(b.category),b.data=null,b.adornedObject=null):b instanceof ye&&(null!==b.hide?b.hide(a,this):null!==b.mainElement&&(b.mainElement.style.display="none")),this.currentContextMenu=null,this.standardMouseOver())};
function Mg(a){var b=new F;b.add(new Cg("Copy",function(a){a.commandHandler.copySelection()},function(a){return a.commandHandler.canCopySelection()}));b.add(new Cg("Cut",function(a){a.commandHandler.cutSelection()},function(a){return a.commandHandler.canCutSelection()}));b.add(new Cg("Delete",function(a){a.commandHandler.deleteSelection()},function(a){return a.commandHandler.canDeleteSelection()}));b.add(new Cg("Paste",function(b){b.commandHandler.pasteSelection(a.mouseDownPoint)},function(b){return b.commandHandler.canPasteSelection(a.mouseDownPoint)}));
b.add(new Cg("Select All",function(a){a.commandHandler.selectAll()},function(a){return a.commandHandler.canSelectAll()}));b.add(new Cg("Undo",function(a){a.commandHandler.undo()},function(a){return a.commandHandler.canUndo()}));b.add(new Cg("Redo",function(a){a.commandHandler.redo()},function(a){return a.commandHandler.canRedo()}));b.add(new Cg("Scroll To Part",function(a){a.commandHandler.scrollToPart()},function(a){return a.commandHandler.canScrollToPart()}));b.add(new Cg("Zoom To Fit",function(a){a.commandHandler.zoomToFit()},
function(a){return a.commandHandler.canZoomToFit()}));b.add(new Cg("Reset Zoom",function(a){a.commandHandler.resetZoom()},function(a){return a.commandHandler.canResetZoom()}));b.add(new Cg("Group Selection",function(a){a.commandHandler.groupSelection()},function(a){return a.commandHandler.canGroupSelection()}));b.add(new Cg("Ungroup Selection",function(a){a.commandHandler.ungroupSelection()},function(a){return a.commandHandler.canUngroupSelection()}));b.add(new Cg("Edit Text",function(a){a.commandHandler.editTextBlock()},
function(a){return a.commandHandler.canEditTextBlock()}));return b}
Dg.prototype.showDefaultContextMenu=function(){var a=this.diagram;null===this.ft&&(this.ft=Mg(this));Hg.innerHTML="";Ig.addEventListener("pointerdown",this.su,!1);var b=this,c=ua("ul");c.className="goCXul";Hg.appendChild(c);c.innerHTML="";for(var d=this.ft.iterator;d.next();){var e=d.value,f=e.visible;if("function"===typeof e.hx&&("function"!==typeof f||f(a))){f=ua("li");f.className="goCXli";var g=ua("a");g.className="goCXa";g.href="#";g.my=e.hx;g.addEventListener("pointerdown",function(c){this.my(a);
b.stopTool();c.preventDefault();return!1},!1);g.textContent=e.text;f.appendChild(g);c.appendChild(f)}}Hg.style.display="block";Ig.style.display="block"};Dg.prototype.hideDefaultContextMenu=function(){if(null!==this.currentContextMenu&&this.currentContextMenu===Fg){Hg.style.display="none";Ig.style.display="none";var a=this.diagram;null!==a&&a.removeEventListener(Ig,"pointerdown",this.su,!1);this.currentContextMenu=null}};
ma.Object.defineProperties(Dg.prototype,{currentContextMenu:{get:function(){return this.j},set:function(a){this.j=a;this.dt=a instanceof te?a.adornedPart:null}},defaultTouchContextMenu:{get:function(){!1===Jg&&null===Fg&&Ng&&Eg(this);return Fg},set:function(a){null===a&&(Jg=!0);Fg=a}},currentObject:{get:function(){return this.m},set:function(a){this.m=a}},mouseDownPoint:{get:function(){return this.ww}}});
var Fg=null,Jg=!1,Ig=null,Hg=null;Dg.className="ContextMenuTool";Ka("contextMenuTool",function(){return this.findTool("ContextMenu")},function(a){this.gb("ContextMenu",a,this.mouseUpTools)});function Og(){je.call(this);this.name="TextEditing";this.Yh=new Pg;this.ga=null;this.V=Qg;this.vj=null;this.qa=Rg;this.u=1;this.F=!0;this.m=null;this.j=new ye;this.gt=null;Sg(this,this.j)}la(Og,je);
function Sg(a,b){if(Ng){var c=ua("textarea");a.gt=c;c.addEventListener("input",function(){if(null!==a.textBlock){var b=a.Mx(this.value);this.style.width=20+b.measuredBounds.width*this.vA+"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(Tg)):"Tab"===c?(a.acceptText(Ug),b.preventDefault()):"Escape"===c&&(a.doCancel(),null!==a.diagram&&a.diagram.doFocus())}},!1);c.addEventListener("focus",
function(){if(null!==a.currentTextEditor&&a.state!==Rg){var b=a.gt;a.qa===Vg&&(a.qa=Wg);"function"===typeof b.select&&a.selectsTextOnActivate&&(b.select(),b.setSelectionRange(0,9999))}},!1);c.addEventListener("blur",function(){if(null!==a.currentTextEditor&&a.state!==Rg){var b=a.gt;"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 Pg&&f instanceof Og)if(f.state===Xg)c.style.border="3px solid red",c.focus();else{var d=a.ka(xc),e=b.position,k=b.scale,l=a.Df()*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-(.5*n-.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.vA=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)}}}
Og.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(null===a||a.isReadOnly||Yg&&Yg!==this&&(Yg.acceptText(Zg),Yg&&Yg!==this)||!a.lastInput.left||this.isBeyondDragSize())return!1;var b=a.gc(a.lastInput.documentPoint);if(!(null!==b&&b instanceof Pg&&b.editable&&b.part.canEdit()))return!1;b=b.part;return null===b||this.starting===Qg&&!b.isSelected||this.starting===$g&&2>a.lastInput.clickCount?!1:!0};Og.prototype.doStart=function(){Yg=this;null!==this.textBlock&&this.doActivate()};
Og.prototype.doActivate=function(){if(!this.isActive){var a=this.diagram;if(null!==a){var b=this.textBlock;null===b&&(b=a.gc(a.lastInput.documentPoint));if(null!==b&&b instanceof Pg&&(this.textBlock=b,null!==b.part)){a.animationManager.Bc();this.isActive=!0;this.qa=Vg;var c=this.defaultTextEditor;null!==b.textEditor&&(c=b.textEditor);this.Yh=this.textBlock.copy();var d=new N(this.textBlock.ka(sc),this.textBlock.ka(Bc));a.tv(d);c.show(b,a,this);this.currentTextEditor=c}}}};Og.prototype.doCancel=function(){this.stopTool()};
Og.prototype.doMouseUp=function(){this.canStart()&&this.doActivate()};Og.prototype.doMouseDown=function(){this.isActive&&this.acceptText(Zg)};Og.prototype.acceptText=function(a){switch(a){case Zg:if(this.qa===ah)this.currentTextEditor instanceof HTMLElement&&this.currentTextEditor.focus();else if(this.qa===Vg||this.qa===Xg||this.qa===Wg)this.qa=bh,ch(this);break;case dh:case Tg:case Ug:if(Tg!==a||!0!==this.textBlock.isMultiline)if(this.qa===Vg||this.qa===Xg||this.qa===Wg)this.qa=bh,ch(this)}};
function ch(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.Ea(a.name),a.qa=ah,a.transactionResult=a.name,b.text=f,a.doSuccess(e,f),null!==c&&c.R("TextEdited",b,e),a.stopTransaction(),a.stopTool(),null!==c&&c.doFocus()):(a.qa=Xg,a.doError(e,f))}}
Og.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)};Og.prototype.doSuccess=function(a,b){var c=this.textBlock;null!==c.textEdited&&c.textEdited(c,a,b)};Og.prototype.doDeactivate=function(){var a=this.diagram;null!==a&&(this.qa=Rg,null!==this.currentTextEditor&&this.currentTextEditor.hide(a,this),this.textBlock=null,this.isActive=!1)};Og.prototype.doStop=function(){Yg=null};
Og.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};Og.prototype.Mx=function(a){var b=this.Yh;b.text=a;b.measure(this.textBlock.Hh,Infinity);return b};
ma.Object.defineProperties(Og.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.V},set:function(a){this.V=a}},textValidation:{get:function(){return this.vj},
set:function(a){this.vj=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.qa},set:function(a){this.qa!==a&&(this.qa=a)}}});Og.prototype.measureTemporaryTextBlock=Og.prototype.Mx;
var dh=new E(Og,"LostFocus",0),Zg=new E(Og,"MouseDown",1),Ug=new E(Og,"Tab",2),Tg=new E(Og,"Enter",3),eh=new E(Og,"SingleClick",0),Qg=new E(Og,"SingleClickSelected",1),$g=new E(Og,"DoubleClick",2),Rg=new E(Og,"StateNone",0),Vg=new E(Og,"StateActive",1),Wg=new E(Og,"StateEditing",2),bh=new E(Og,"StateValidating",3),Xg=new E(Og,"StateInvalid",4),ah=new E(Og,"StateValidated",5),Yg=null;Og.className="TextEditingTool";Og.LostFocus=dh;Og.MouseDown=Zg;Og.Tab=Ug;Og.Enter=Tg;Og.SingleClick=eh;
Og.SingleClickSelected=Qg;Og.DoubleClick=$g;Og.StateNone=Rg;Og.StateActive=Vg;Og.StateEditing=Wg;Og.StateValidating=bh;Og.StateInvalid=Xg;Og.StateValidated=ah;Ka("textEditingTool",function(){return this.findTool("TextEditing")},function(a){this.gb("TextEditing",a,this.mouseUpTools)});
function fh(a){gh||(hh(),gh=!0);this.H=ke;this.Mk=this.Bb=this.rq=this.ac=!1;this.Ow=!0;this.Nk=ih;this.Cm=!1;this.Fh=this.Dd=!0;this.Cg=600;this.aw=this.Mw=!1;this.Xd=new H;this.ae=new jh;this.ae.Wd=this;this.Di=new H;this.ou=new H;this.Or=new H;this.kr=new H;a&&Object.assign(this,a)}fh.prototype.We=function(a){this.H=a};fh.prototype.canStart=function(){return!0};function kh(a,b){a.Dd&&a.canStart(b)&&(a.Xd.add(b),a.defaultAnimation.isAnimating&&a.Bc(),lh(a.H),a.Bb=!0)}
function mh(a){if(a.Dd&&a.Bb){var b=a.ae,c=a.H,d=a.Xd.contains("Model");d&&(a.Mk=!0,a.Nk===ih?(b.isViewportUnconstrained=!0,b.uc.clear(),b.add(c,"position",c.position.copy().offset(0,-200),c.position),b.add(c,"opacity",0,1)):a.Nk===nh&&b.uc.clear(),a.Ow=a.Nk===oh&&c.cu.C(c.pa)?!0:!1,c.R("InitialAnimationStarting",a));d&&!a.Fh||0===b.uc.count?(a.Xd.clear(),a.Bb=!1,b.uc.clear(),ph(b,c),a.Mk=!1,c.N()):(a.Xd.clear(),c.jg=!1,d=b.uc.get(c),c.autoScale!==qh&&null!==d&&(delete d.start.scale,delete d.end.scale),
x.requestAnimationFrame(function(){!1===a.Bb||b.ac||(c.Gf("temporaryPixelRatio")&&Fe(c),rh(c),a.Bb=!1,b.start(),b.ac&&(sh(a),c.Ya(),th(b,0),yf(c,!0),uh(a),c.R("AnimationStarting",a)))}))}}function vh(a){return a.Xd.contains("Trigger")&&1===a.Xd.count}function Gh(a,b,c,d){a.isTicking||vh(a)||b instanceof T&&(null!==b.fromNode||null!==b.toNode)||a.ae.add(b,"position",c,d,!1)}t=fh.prototype;t.fv=function(a){return this.ae.fv(a)};t.Xu=function(a){return this.ae.Xu(a)};
function Hh(a,b){function c(){0<e.Or.count&&(d.addAll(e.Or),e.Or.clear(),e.ac=!0);if(!1!==e.ac&&0!==d.count){e.ou.addAll(d);for(var a=e.ou.iterator;a.next();){var b=a.value;if(!1!==b.ac){a:if(0<b.wl.count)var h=!0;else{for(h=b.uc.iterator;h.next();){var k=h.key;if(k instanceof Y&&null!==k.diagram||k instanceof Q){h=!0;break a}}h=!1}h?Ih(b,!1):b.Vk=!0}}e.ou.clear();!1!==e.ac&&(sh(e),yf(e.H),uh(e));x.requestAnimationFrame(c)}}var d=a.Di,e=a;a.ac?a.Or.add(b):(a.ac=!0,d.add(b),x.requestAnimationFrame(function(){c()}))}
function Jh(a){for(a=a.Di.iterator;a.next();)a.value.Vk=!1}function sh(a){if(!a.rq){var b=a.H;a.Mw=b.skipsUndoManager;a.aw=b.skipsModelSourceBindings;b.skipsUndoManager=!0;b.skipsModelSourceBindings=!0;a.rq=!0}}function uh(a){var b=a.H;b.skipsUndoManager=a.Mw;b.skipsModelSourceBindings=a.aw;a.rq=!1}
t.Bc=function(a){var b=this.ae;!0===this.Bb&&(this.Mk=this.Bb=!1,this.Xd.clear(),0<b.uc.count&&this.H.Yb());if(this.ac){if(b.Jl(!0),b.uc.clear(),ph(b,null),!0===a)for(a=this.Di.Fa(),b=0;b<a.length;b++)a[b].Jl(!0)}else b.uc.clear(),ph(b,this.H)};t.Jl=function(a){a===this.defaultAnimation&&this.defaultAnimation.uc.clear();this.Di.remove(a);0===this.Di.count&&(this.ac=!1,this.H.Yb());a===this.defaultAnimation&&(this.defaultAnimation.uc.clear(),this.H.R("AnimationFinished",this))};
t.Cj=function(a,b){this.Bb&&(this.Xd.contains("Expand Tree")||this.Xd.contains("Expand SubGraph"))&&(this.ae.Cj(a,b),Kh(this,a))};t.Aj=function(a,b){this.Bb&&(this.Xd.contains("Collapse Tree")||this.Xd.contains("Collapse SubGraph"))&&(this.ae.Aj(a,b),Lh(this.ae,b,"position",b.position,b.position),Kh(this,a))};function Mh(a,b,c){!a.Bb||b.C(c)||vh(a)||(a.H.oi||(b=c.copy()),Lh(a.ae,a.H,"position",b,c))}function Nh(a,b,c){b.bd&&(b.Rg=c,a.kr.add(b))}
function Kh(a,b){for(b=b.findLinksConnected();b.next();){var c=b.value;c.bd&&(c.Rg=c.points.copy(),a.kr.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 hh(){function a(a,b,e,f,g,h){a.position=new J(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h))}var b=new ob;b.add("position:diagram",a);b.add("position",a);b.add("position:part",function(a,b,e,f,g,h){g<h?a.lm(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h),!1):a.position=new J(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.lm(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h),!0):a.location=new J(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.lm(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h),!1):a.position=new J(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.lm(f(g,b.x,e-b.x,h),f(g,b.y,c-b.y,h),!1):a.position=new J(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 N(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(fh.prototype,{animationReasons:{get:function(){return this.Xd}},isEnabled:{get:function(){return this.Dd},set:function(a){(this.Dd=a)&&this.Di.each(function(a){a.isAnimating||Infinity!==a.runCount||a.start()})}},duration:{get:function(){return this.Cg},set:function(a){1>a&&xa(a,">= 1",fh,"duration");this.Cg=a}},isAnimating:{get:function(){return this.ac}},
isTicking:{get:function(){return this.rq}},isInitial:{get:function(){return this.Fh},set:function(a){this.Fh=a}},defaultAnimation:{get:function(){return this.ae}},activeAnimations:{get:function(){return this.Di}},initialAnimationStyle:{get:function(){return this.Nk},set:function(a){this.Nk=a}}});fh.prototype.stopAnimation=fh.prototype.Bc;
var Ph=null,gh=!1,ih=new E(fh,"Default",1),oh=new E(fh,"AnimateLocations",2),nh=new E(fh,"None",3);fh.className="AnimationManager";fh.defineAnimationEffect=function(a,b){gh||(hh(),gh=!0);Ph.add(a,b)};fh.Default=ih;fh.AnimateLocations=oh;fh.None=nh;
function jh(a){this.uu=this.Lw=this.Wd=this.H=null;this.Vk=this.ac=this.j=!1;this.bn=this.Ld=0;this.Ip=this.lt=Qh;this.Uk=this.fo=!1;this.bu=1;this.$t=0;this.Bd=this.Cg=NaN;this.ew=0;this.cn=null;this.m=pb;this.uc=new ob;this.St=new ob;this.wl=new H;this.Tt=new H;this.bw=Rh;a&&Object.assign(this,a)}jh.prototype.suspend=function(){this.Vk=!0};jh.prototype.advanceTo=function(a,b){b&&(this.Vk=!1);this.fo&&a>=this.Bd&&(this.Uk=!0,a-=this.Bd);this.ew=a;Ih(this,!0);sh(this.Wd);yf(this.H);uh(this.Wd);this.H.redraw()};
function ph(a,b){a.St.clear();a.Uk=!1;a.$t=0;a.Bd=NaN;0<a.wl.count&&a.wl.clear();0<a.Tt.count&&a.Tt.clear();if(null!==b)for(a=b.links;a.next();)a.value.Rg=null}t=jh.prototype;
t.start=function(){if(0===this.uc.count||this.ac)return this;for(var a=this.H,b=this.uc.iterator;b.next();){var c=b.key;null===a&&(c instanceof Q?a=c:c instanceof Y&&(a=c.diagram))}if(null!==a)this.H=a,this.Wd=a.animationManager;else return this;b=this.Wd;if(!1===b.isEnabled)return this;this.Bd=isNaN(this.Cg)?b.duration:this.Cg;this.Ip=this.lt;b.Mk&&b.Nk===ih&&this===b.defaultAnimation&&(this.Ip=Sh,this.Bd=isNaN(this.Cg)?600===b.duration?900:b.duration:this.Cg);this.bw=a.scrollMode;this.isViewportUnconstrained&&
(a.sj=Th);sh(b);this.wl.each(function(b){b.data=null;a.add(b)});uh(b);this.ac=!0;this.Ld=+new Date;this.bn=this.Ld+this.Bd;Hh(b,this);return this};t.Ky=function(a,b){if(!a.Wc())return this;this.wl.add(a);this.H=b;return this};t.add=function(a,b,c,d,e){if("position"===b&&c.Xa(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")}Lh(this,a,b,c,d,e);return this};
function Lh(a,b,c,d,e,f){var g=a.uc;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 J&&!h.w()&&b.diagram.animationManager.Xd.contains("Expand SubGraph")&&h.assign(l.position),h=new Yh(k,
l,f),g.add(b,h);g=k[c];g instanceof J&&!g.w()&&g.assign(a.m);f&&0===c.indexOf("position:")&&b instanceof U?h.Iu.location=Xh(b.location):f&&(h.Iu[c]=Xh(d))}function Xh(a){return a instanceof J?a.copy():a instanceof L?a.copy():a}t.fv=function(a){if(!this.ac)return!1;a=this.uc.I(a);return null!==a&&a.nv};t.Xu=function(a){if(!this.ac)return!1;a=this.uc.I(a);return null!==a&&(a.start.position||a.start.location)};
function Ih(a,b){if(!a.Vk||b){var c=a.Wd;if(!1!==a.ac){var d=+new Date,e=d>a.bn?a.Bd:d-a.Ld;b&&(e=a.ew,e<a.Bd?(a.Ld=+new Date-e,a.bn=a.Ld+a.Bd):e=a.Bd);sh(c);th(a,e);yf(a.H,!0);uh(c);d>a.bn&&(a.fo&&!a.Uk?(a.Ld=+new Date,a.bn=a.Ld+a.Bd,a.Uk=!0):a.Jl(!1))}}}
function th(a,b){for(var c=a.Bd,d=a.uc.iterator,e=a.Uk;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.Ip,b,c,a)}}}t.stop=function(){if(!this.ac)return this;this.Jl(!0);return this};
t.Jl=function(a){null!==this.uu&&this.uu.io.remove(this.Lw);if(this.ac){var b=this.H,c=this.Wd;this.Vk=this.ac=c.Mk=!1;sh(c);for(var d=this.uc,e=this.wl.iterator;e.next();)b.remove(e.value);for(e=this.Tt.iterator;e.next();)e.value.v();e=this.fo;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.Iu,n;for(n in l)if(null!==f.get(n)){var p=n;!h.Fu||"position:nodeCollapse"!==p&&"position:placeholder"!==p||(p="position");f.get(p)(g,k[n],void 0!==m[n]?m[n]:
h.Fu?k[n]:l[n],this.Ip,this.Bd,this.Bd,this)}h.Fu&&void 0!==m.location&&g instanceof U&&(g.location=m.location);h.nv&&g instanceof U&&g.Xb(!1)}b.xs.clear();Xe(b,!1);b.Ya();b.N();yf(b,!0);if(c.defaultAnimation===this){for(n=c.kr.iterator;n.next();)e=n.value,null!==e.Rg&&(e.points=e.Rg,e.Rg=null);c.kr.clear()}yf(b,!0);this.isViewportUnconstrained&&(b.scrollMode=this.bw);uh(c);this.$t++;!a&&this.bu>this.$t?(this.Uk=!1,this.start()):(this.cn&&this.cn(this),ph(this,null),c.Jl(this),b.Yb())}};
t.Cj=function(a,b){var c=b.actualBounds,d=null;b instanceof pf&&(d=b.placeholder);null!==d?(c=d.ka(sc),d=d.padding,c.x+=d.left,c.y+=d.top,this.add(a,"position",c,a.position,!1)):this.add(a,"position",new J(c.x+c.width/2,c.y+c.height/2),a.position,!1);this.add(a,"scale",.01,a.scale,!1);if(a instanceof pf)for(a=a.memberParts;a.next();)d=a.value,d instanceof V&&this.Cj(d,b)};
t.Aj=function(a,b){if(a.isVisible()){var c=null;b instanceof pf&&(c=b.placeholder);if(null!==c){var d=c.ka(sc);c=c.padding;d.x+=c.left;d.y+=c.top;this.add(a,"position:placeholder",a.position,d,!0)}else this.add(a,"position:nodeCollapse",a.position,b,!0);this.add(a,"scale",a.scale,.01,!0);d=this.uc;d.contains(a)&&(d.I(a).nv=!0);if(a instanceof pf)for(a=a.memberParts;a.next();)d=a.value,d instanceof V&&this.Aj(d,b)}};t.Fz=function(a){var b=this.St.get(a);null===b&&(b={},this.St.add(a,b));return b};
ma.Object.defineProperties(jh.prototype,{duration:{get:function(){return this.Cg},set:function(a){1>a&&xa(a,">= 1",jh,"duration");this.Cg=a}},reversible:{get:function(){return this.fo},set:function(a){this.fo=a}},runCount:{get:function(){return this.bu},set:function(a){0<a?this.bu=a:C("Animation.runCount value must be a positive integer.")}},finished:{get:function(){return this.cn},
set:function(a){this.cn!==a&&(this.cn=a)}},easing:{get:function(){return this.lt},set:function(a){this.lt=a}},isViewportUnconstrained:{get:function(){return this.j},set:function(a){this.j=a}},isAnimating:{get:function(){return this.ac}}});jh.prototype.getTemporaryState=jh.prototype.Fz;jh.prototype.stop=jh.prototype.stop;jh.prototype.add=jh.prototype.add;jh.prototype.addTemporaryPart=jh.prototype.Ky;
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}jh.className="Animation";jh.EaseLinear=function(a,b,c,d){return c*a/d+b};jh.EaseInOutQuad=Qh;jh.EaseInQuad=function(a,b,c,d){return c*(a/=d)*a+b};jh.EaseOutQuad=function(a,b,c,d){return-c*(a/=d)*(a-2)+b};jh.EaseInExpo=function(a,b,c,d){return 0===a?b:c*Math.pow(2,10*(a/d-1))+b};jh.EaseOutExpo=Sh;
function Yh(a,b,c){this.start=a;this.end=b;this.Iu={};this.Fu=c;this.nv=!1}Yh.className="AnimationState";function Zh(a,b,c){this.vd=null;this.qf=a;this.ro=c||$h;this.sk=null;void 0!==b&&(this.sk=b,void 0===c&&(this.ro=ai))}Zh.prototype.copy=function(){var a=new Zh(this.qf);a.ro=this.ro;var b=this.sk;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.sk=c}return a};
function bi(a,b){a=a.sk;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.qf},set:function(a){this.qf=a}},animationSettings:{get:function(){return this.sk},set:function(a){this.sk=a}},startCondition:{get:function(){return this.ro},set:function(a){this.ro=a}}});
var $h=new E(Zh,"Default",1),ai=new E(Zh,"Immediate",2),ci=new E(Zh,"Bundled",3);Zh.className="AnimationTrigger";Zh.Default=$h;Zh.Immediate=ai;Zh.Bundled=ci;function di(a){Qa(this);this.H=null;this.Pa=new F;this.wa="";this.qb=1;this.m=!1;this.j=this.Th=this.u=this.Ni=this.Mi=this.Li=this.Ki=this.Ii=this.Ji=this.Hi=this.Pi=this.Gi=this.Oi=this.Fi=this.Ei=!0;this.Vq=[];a&&Object.assign(this,a)}t=di.prototype;
t.clear=function(){for(var a=this.Pa,b=0;b<a.length;b++)ei(a.s[b],null);a.clear();this.Vq.length=0};t.We=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.Pa.iterator;h.next();){var k=h.value;k instanceof pf?e++:k instanceof V?d++:k instanceof T?f++:k instanceof te?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.Pa.iterator;a.next();)c=a.value,h+="\n "+c.toString(),d=c.data,null!==d&&bb(d)&&(h+=" #"+bb(d)),c instanceof V?h+=" "+
Ia(d):c instanceof T&&(h+=" "+Ia(c.fromNode)+" "+Ia(c.toNode));return b+" "+this.Pa.count+": "+h};t.gc=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);if(!1===this.Th)return null;var d=!1;null!==this.diagram&&this.diagram.viewportBounds.ca(a)&&(d=!0);for(var e=J.alloc(),f=this.Pa.s,g=f.length;g--;){var h=f[g];if((!0!==d||!1!==hg(h))&&h.isVisible()&&(e.assign(a),xb(e,h.me),h=h.gc(e,b,c),null!==h&&(null!==b&&(h=b(h)),null!==h&&(null===c||c(h)))))return J.free(e),h}J.free(e);return null};
t.ii=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof F||d instanceof H||(d=new H);if(!1===this.Th)return d;var e=!1;null!==this.diagram&&this.diagram.viewportBounds.ca(a)&&(e=!0);for(var f=J.alloc(),g=this.Pa.s,h=g.length;h--;){var k=g[h];if((!0!==e||!1!==hg(k))&&k.isVisible()){f.assign(a);xb(f,k.me);var l=k;k.ii(f,b,c,d)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||d.add(l))}}J.free(f);return d};
t.Cf=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof F||e instanceof H||(e=new H);if(!1===this.Th)return e;var f=!1;null!==this.diagram&&this.diagram.viewportBounds.Qe(a)&&(f=!0);for(var g=this.Pa.s,h=g.length;h--;){var k=g[h];if((!0!==f||!1!==hg(k))&&k.isVisible()){var l=k;k.Cf(a,b,c,d,e)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||e.add(l))}}return e};
t.Nu=function(a,b,c,d,e,f,g){if(!1===this.Th)return e;for(var h=this.Pa.s,k=h.length;k--;){var l=h[k];if((!0!==g||!1!==hg(l))&&f(l)&&l.isVisible()){var m=l;l.Cf(a,b,c,d,e)&&(null!==b&&(m=b(m)),null===m||null!==c&&!c(m)||e.add(m))}}return e};
t.ng=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 F||e instanceof H)f=e;e=!0}f instanceof F||f instanceof H||(f=new H);if(!1===this.Th)return f;var g=!1;null!==this.diagram&&this.diagram.viewportBounds.ca(a)&&(g=!0);for(var h=J.alloc(),k=J.alloc(),l=this.Pa.s,m=l.length;m--;){var n=l[m];if((!0!==g||!1!==hg(n))&&n.isVisible()){h.assign(a);xb(h,n.me);k.h(a.x+b,a.y);xb(k,n.me);var p=n;n.ng(h,k,c,d,e,f)&&(null!==c&&(p=c(p)),null===
p||null!==d&&!d(p)||f.add(p))}}J.free(h);J.free(k);return f};
t.Ad=function(a,b){if(this.visible){var c=this.Pa.s,d=c.length;if(0!==d){a=Ea();for(var e=Ea(),f=0;f<d;f++){var g=c[f];g.tw=f;if(g instanceof T){if(!1===g.bd)continue}else if(g instanceof te&&null!==g.adornedPart)continue;var h=g.actualBounds;g.isVisible()&&Xb(h,b)?(g.Ad(!0),a.push(g)):(g.Ad(!1),null!==g.adornments&&0<g.adornments.count&&e.push(g))}for(b=0;b<a.length;b++)for(c=a[b],fi(c),c=c.adornments;c.next();)d=c.value,d.measure(Infinity,Infinity),d.arrange(),d.Ad(!0);for(b=0;b<e.length;b++)fi(e[b]);
Ga(a);Ga(e)}}};function gi(a,b){var c=1;1!==a.qb&&(c=b.globalAlpha,b.globalAlpha=c*a.qb);return c}t.ec=function(a,b,c){if(this.visible&&0!==this.qb&&(void 0===c&&(c=!0),c||!this.isTemporary)){c=this.Pa.s;var d=c.length;if(0!==d){if(a.isTemporary)for(var e=0;e<d;e++)c[e].Gj();e=gi(this,a);var f=this.Vq;f.length=0;for(var g=b.scale,h=N.alloc(),k=0;k<d;k++)this.Oj(a,c[k],b,f,g,h,!0);N.free(h);if(a.isTemporary)for(b=0;b<d;b++)c[b].Gj();a.globalAlpha=e}}};
function hi(a,b,c,d,e){if(a.visible&&0!==a.qb&&(e||!a.isTemporary)){e=a.Pa.s;var f=e.length;if(0!==f){var g=gi(a,b),h=a.Vq;h.length=0;for(var k=c.scale,l=N.alloc(),m=0;m<f;m++){var n=e[m];d.contains(n)&&a.Oj(b,n,c,h,k,l,!1)}N.free(l);b.globalAlpha=g}}}
t.Oj=function(a,b,c,d,e,f,g){if(g&&!hg(b))a.Es(b);else{if(null!==d&&b instanceof T&&(b.isOrthogonal&&d.push(b),!1===b.bd)){a.Es(b);return}g=!1;for(d=b.containingGroup;null!==d;)g?null!==d.ib&&f.Ex(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.Vc(h)){a.Es(b);return}d=!f.Qe(h)}d&&(a.save(),a instanceof ii?a.ak=f.copy():(a.beginPath(),a.rect(f.x,f.y,f.width,f.height),a.clip()));h.width*e>c.Kq||h.height*e>c.Kq?b.ec(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&&(ji(b,a,b.areaBackground,!0,!0,f,e),a.fillRect(e.x,e.y,e.width,e.height)),null===b.areaBackground&&null===b.background&&(ji(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),ji(b,a,b.background,!0,!1,f,e),a.fillRect(0,0,f.width/2,f.height/2),c.ts()||(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.Sc(!0))}};t.g=function(a,b,c,d,e){var f=this.diagram;null!==f&&f.cb(ce,a,this,b,c,d,e)};t.ni=function(a,b,c){var d=this.Pa;ei(b,this);if(a>=d.count)a=d.count;else if(d.L(a)===b)return-1;d.Gb(a,b);b.So(c);d=this.diagram;null!==d&&(c?d.N():d.ni(b));ki(this,a,b);return a};
t.oc=function(a,b,c){if(!c&&b.layer!==this&&null!==b.layer)return b.layer.oc(a,b,c);var d=this.Pa;if(0>a||a>=d.length){if(a=d.indexOf(b),0>a)return-1}else if(d.L(a)!==b&&(a=d.indexOf(b),0>a))return-1;b.To(c);d.nb(a);d=this.diagram;null!==d&&(c?d.N():d.oc(b));ei(b,null);return a};
function ki(a,b,c){b=li(a,b,c);if(c instanceof pf&&null!==c&&isNaN(c.zOrder)){if(0!==c.memberParts.count){for(var d=-1,e=a.Pa.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.Pa,e.nb(b),e.Gb(d,c))}b=c.containingGroup;null!==b&&ki(a,-1,b)}null!==c.svg&&c.svg.remove()}
function li(a,b,c){var d=c.zOrder;if(isNaN(d))return b;a=a.Pa;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.L(f).zOrder;if(!isNaN(g))break;f--}for(var h=b+1,k=NaN;h<e;){k=a.L(h).zOrder;if(!isNaN(k))break;h++}if(!isNaN(g)&&g>d)for(;;){if(-1===f||g<=d){f++;if(f===b)break;a.nb(b);a.Gb(f,c);return f}for(g=NaN;0<=--f&&(g=a.L(f).zOrder,isNaN(g)););}else if(!isNaN(k)&&k<d)for(;;){if(h===e||k>=d){h--;if(h===b)break;a.nb(b);a.Gb(h,c);return h}for(k=NaN;++h<
e&&(k=a.L(h).zOrder,isNaN(k)););}return b}
ma.Object.defineProperties(di.prototype,{parts:{get:function(){return this.Pa.iterator}},partsBackwards:{get:function(){return this.Pa.iteratorBackwards}},diagram:{get:function(){return this.H}},name:{get:function(){return this.wa},set:function(a){var b=this.wa;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.wa=a;this.g("name",b,a);for(a=this.Pa.iterator;a.next();)a.value.layerName=this.wa}}},opacity:{get:function(){return this.qb},set:function(a){var b=this.qb;b!==a&&((0>a||1<a)&&xa(a,"0 <= value <= 1",di,"opacity"),this.qb=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.Pa.iterator;b.next();)b.value.Xb(a);a=this.diagram;null!==a&&a.N()}}},pickable:{get:function(){return this.Th},set:function(a){var b=this.Th;b!==a&&(this.Th=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.Ya())}},allowCopy:{get:function(){return this.Ei},set:function(a){var b=this.Ei;b!==a&&(this.Ei=a,this.g("allowCopy",b,a))}},allowDelete:{get:function(){return this.Fi},set:function(a){var b=this.Fi;b!==a&&(this.Fi=a,this.g("allowDelete",b,a))}},allowTextEdit:{get:function(){return this.Oi},set:function(a){var b=this.Oi;b!==a&&(this.Oi=a,this.g("allowTextEdit",b,
a))}},allowGroup:{get:function(){return this.Gi},set:function(a){var b=this.Gi;b!==a&&(this.Gi=a,this.g("allowGroup",b,a))}},allowUngroup:{get:function(){return this.Pi},set:function(a){var b=this.Pi;b!==a&&(this.Pi=a,this.g("allowUngroup",b,a))}},allowLink:{get:function(){return this.Hi},set:function(a){var b=this.Hi;b!==a&&(this.Hi=a,this.g("allowLink",b,a))}},allowRelink:{get:function(){return this.Ji},
set:function(a){var b=this.Ji;b!==a&&(this.Ji=a,this.g("allowRelink",b,a))}},allowMove:{get:function(){return this.Ii},set:function(a){var b=this.Ii;b!==a&&(this.Ii=a,this.g("allowMove",b,a))}},allowReshape:{get:function(){return this.Ki},set:function(a){var b=this.Ki;b!==a&&(this.Ki=a,this.g("allowReshape",b,a))}},allowResize:{get:function(){return this.Li},set:function(a){var b=this.Li;b!==a&&(this.Li=a,this.g("allowResize",
b,a))}},allowRotate:{get:function(){return this.Mi},set:function(a){var b=this.Mi;b!==a&&(this.Mi=a,this.g("allowRotate",b,a))}},allowSelect:{get:function(){return this.Ni},set:function(a){var b=this.Ni;b!==a&&(this.Ni=a,this.g("allowSelect",b,a))}}});di.prototype.findObjectsNear=di.prototype.ng;di.prototype.findObjectsIn=di.prototype.Cf;di.prototype.findObjectsAt=di.prototype.ii;di.prototype.findObjectAt=di.prototype.gc;di.className="Layer";
function Q(a,b){mi||(ni(),mi=!0);Qa(this);ke=this;this.xb=!0;this.Ka=null;this.Ba=this.Ca=0;this.xa=null;if(Ng){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.ml=null;oi.add("Model",pi);var e=this;this.Hb=function(a){var b=e.partManager;if(a.model===b.diagram.model&&b.diagram.aa){b.diagram.aa=!1;try{var c=a.change;""===a.modelChange&&c===ce&&b.updateDataBindings(a.object,
a.propertyName)}finally{b.diagram.aa=!0}}};this.Nc=function(a){e.partManager.doModelChanged(a)};this.gu=this.ju=null;qi(this);this.model=ri();this.Ug=!0;si(this);this.layout=new ti;this.Ug=!1;this.bk=this.dk=this.ek=this.ck=this.ti=this.aA=this.Zj=this.Mv=null;this.Zl=function(){};this.preventDefault=null;this.qn=!1;this.Eh=new ui;void 0!==a&&("string"===typeof a||x.Element&&a instanceof Element?vi(this,a):b=a);this.xb=!1;b&&this.mm(b);return this}var wi,ke;
function qi(a){a.Wd=new fh;a.Wd.We(a);a.Fb=17;a.Ew=!1;a.sn=!1;a.au="default";a.Wa=new F;a.pj=new ob;a.ll="default";a.Vx();a.Ux();a.qb=1;a.pa=(new J(NaN,NaN)).freeze();a.cu=new J(NaN,NaN);a.Aa=1;a.Mp=1;a.wt=(new J(NaN,NaN)).freeze();a.xt=NaN;a.Nt=1E-4;a.Jt=100;a.Cb=new ld;a.yu=(new J(NaN,NaN)).freeze();a.rt=(new N(NaN,NaN,NaN,NaN)).freeze();a.rj=(new hc(0,0,0,0)).freeze();a.sj=Rh;a.mu=!1;a.Yt=null;a.eu=null;a.wh=qh;a.xk=Sc;a.Eg=qh;a.lq=Sc;a.vt=sc;a.yt=sc;a.Ec=!0;a.on=!1;a.Ce=new H;a.Ch=new ob;a.Wm=
!0;a.rp=250;a.tk=-1;a.tp=(new hc(16,16,16,16)).freeze();a.jg=!1;a.Hk=!1;a.en=!0;a.Yp=new Zd;a.Yp.diagram=a;a.Og=new Zd;a.Og.diagram=a;a.bj=new Zd;a.bj.diagram=a;a.yg=null;a.nf=null;a.pu=!1;xi(a);a.$h=new H;a.Et=!0;a.tu=Fi;a.nw=!1;a.vu=Df;a.et="auto";a.Lp="auto";a.xh=null;a.Dh=null;a.zh=null;a.Ph=null;a.Nh=null;a.Mh=null;a.Pt=null;a.Kh=null;a.ut=!1;a.Lh=null;a.Oh=null;a.Zh=null;a.Ah=null;a.Qt=!1;a.Xt={};a.oj=[null,null];a.Ug=!1;a.Gw=!1;a.nu=!1;a.ht=!1;a.pw=!0;a.fd=!1;a.Zi=!1;a.Rw=!0;a.Be=-2;a.Mg=new ob;
a.Wn=new F;a.Fg=!1;a.Dd=!0;a.Rs=!0;a.Ei=!0;a.Fi=!0;a.Ss=!1;a.Ts=!0;a.Oi=!0;a.Gi=!0;a.Pi=!0;a.Vs=!0;a.Hi=!0;a.Ji=!0;a.Ii=!0;a.Ki=!0;a.Li=!0;a.Mi=!0;a.Ni=!0;a.Ws=!0;a.Ys=!0;a.ow=!1;a.Tk=!1;a.ln=!0;a.mn=!0;a.Us=!0;a.Xs=!0;a.hu=16;a.lu=16;a.lr=!1;a.fu=!1;a.ku=0;a.iu=0;a.Ab=(new hc(5)).freeze();a.Fw=(new H).freeze();a.Kt=999999999;a.lw=(new H).freeze();a.Yi=!0;a.De=!0;a.td=!0;a.Ae=!1;a.ff=!1;a.vh=!0;a.gf=!1;a.uy=new H;a.mw=new H;a.Wh=null;a.Zv=new L(8,8);a.$v=999;a.zw=1;a.Hw=0;a.md={scale:1,position:new J,
bounds:new N,ax:new L,Nx:new L,Hx:!1};a.Pw=(new N(NaN,NaN,NaN,NaN)).freeze();a.vo=(new L(NaN,NaN)).freeze();a.Pp=(new N(NaN,NaN,NaN,NaN)).freeze();a.Ft=!1;a.Jg=new ob;var b=new V,c=new Pg;c.bind(new Hi("text","",Ia));b.add(c);a.py=b;a.Jg.add("",b);b=new V;c=new Pg;c.stroke="brown";c.bind(new Hi("text","",Ia));b.add(c);a.Jg.add("Comment",b);b=new V;b.selectable=!1;b.avoidable=!1;c=new Bf;c.figure="Ellipse";c.fill="black";c.stroke=null;c.desiredSize=(new L(3,3)).ha();b.add(c);a.Jg.add("LinkLabel",b);
a.Xi=new ob;b=new pf;b.selectionObjectName="GROUPPANEL";b.type=W.Vertical;c=new Pg;c.font="bold 12pt sans-serif";c.bind(new Hi("text","",Ia));b.add(c);c=new W(W.Auto);c.name="GROUPPANEL";var d=new Bf;d.figure="Rectangle";d.fill="rgba(128,128,128,0.2)";d.stroke="black";c.add(d);d=new ig;d.padding=(new hc(5,5,5,5)).ha();c.add(d);b.add(c);a.ny=b;a.Xi.add("",b);a.Jh=new ob;b=new T;c=new Bf;c.isPanelMain=!0;b.add(c);c=new Bf;c.toArrow="Standard";c.fill="black";c.stroke=null;c.strokeWidth=0;b.add(c);a.oy=
b;a.Jh.add("",b);b=new T;c=new Bf;c.isPanelMain=!0;c.stroke="brown";b.add(c);a.Jh.add("Comment",b);b=new te;b.type=W.Auto;c=new Bf;c.fill=null;c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);c=new ig;c.margin=(new hc(1.5,1.5,1.5,1.5)).ha();b.add(c);a.Rt=b;a.tt=b;b=new te;b.type=W.Link;c=new Bf;c.isPanelMain=!0;c.fill=null;c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);a.Ht=b;a.de=null;a.iq=!1;a.Ak=null;a.partManager=new pi;a.toolManager=new La;a.toolManager.initializeStandardTools();a.defaultTool=
a.toolManager;a.currentTool=a.defaultTool;a.jt=null;a.Vm=new Be;a.Ut=null;a.Vt=null;a.Ir=!1;a.commandHandler=Ii();a.$p=null;a.aq=tb;a.Nw=!1;a.Rb=1;a.Xh=null;a.Kq=1;a.Oq=0;a.xw=[0,0,0,0,0];a.Pq=0;a.uq=1;a.rw=0;a.sw=new J;a.By=500;a.sp=new J;a.sq=!1}Q.prototype.clear=function(){this.animationManager.Bc();this.model.clear();Ji=null;Ki="";Li(this,!1);this.Wn.clear();Mi();this.Mg.clear();this.Wh=null;this.Ya();this.Va();this.N()};
function Li(a,b){a.animationManager.Bc(!0);a.Fw=(new H).freeze();a.lw=(new H).freeze();var c=a.skipsUndoManager,d=null!==a.bc&&void 0!==a.bc;d&&(a.skipsUndoManager=!0);var e=null;null!==a.de&&(e=a.de.part,null!==e&&a.remove(e));var f=[],g=a.Wa.length;if(b){for(b=0;b<g;b++)for(var h=a.Wa.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.Wa.s[b].clear();a.partManager.clear();a.Ce.clear();a.Ch.clear();a.$h.clear();a.Ak=null;a.Wn.clear();
Mi();a.Mg.clear();Fa=[];null!==e&&(a.add(e),a.partManager.parts.remove(e));d&&(a.skipsUndoManager=c);return f}function Ii(){return null}Q.prototype.reset=function(){this.clear();this.xb=!0;qi(this);Ni(this);this.Ug=!0;si(this);this.layout=new ti;this.Ug=!1;this.model=ri();this.model.undoManager=new he;this.xb=this.qn=!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.au=c};
Q.prototype.setScrollWidth=function(a){a=void 0===a?this.div:a;null===a&&(a=x.document.body);var b=0;if(Ng){var c=Oi;b=wi;null===c&&(c=Oi=ua("p"),c.style.width="100%",c.style.height="200px",c.style.boxSizing="content-box",b=wi=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||Oa||(b=11)}this.Fb=b;this.Ew=!0};Q.prototype.rb=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.Wa.iterator;c.next();)b+="\n "+c.value.toString(a-1);return b};
function vi(a,b){if(Ng){void 0!==b&&null!==b||C("Diagram setup requires an argument DIV.");null!==a.Ka&&C("Diagram has already completed setup.");"string"===typeof b?a.Ka=x.document.getElementById(b):b instanceof HTMLDivElement?a.Ka=b:C("No DIV or DIV id supplied: "+b);null===a.Ka&&C("Invalid DIV id; could not get element with id: "+b);void 0!==a.Ka.H&&C("Invalid div id; div already has a Diagram associated with it.");if(!a.ml&&x.ResizeObserver){var c=sa(function(){a.Yb()},250);a.ml=new x.ResizeObserver(function(){c()});
a.ml.observe(a.Ka)}"static"===x.getComputedStyle(a.Ka,null).position&&(a.Ka.style.position="relative");b=5;var d="rgba(2"+b+"5, 255, 255, 0)";b--;a.Ka.style["-webkit-tap-highlight-color"]=d;a.Ka.innerHTML="";a.Ka.H=a;a.Ka.goDiagram=a;a.Ka.go=x.go;var e=new Pi(a);void 0!==e.style&&(e.style.position="absolute",e.style.top="0px",e.style.left="0px","rtl"===x.getComputedStyle(a.Ka,null).getPropertyValue("direction")&&(a.sn=!0),e.style.zIndex="2",e.style.userSelect="none",e.style.MozUserSelect="none",e.style.touchAction=
"none");a.xa=e;a.jb=e.context;d=a.jb;a.Rb=a.computePixelRatio();a.viewSize.w()||(a.Ca=a.Ka.clientWidth||1,a.Ba=a.Ka.clientHeight||1);Qi(a,a.Ca,a.Ba);a.Ka.insertBefore(e.La,a.Ka.firstChild);e=new Pi(null);e.width=1;e.height=1;a.hw=e;a.qy=e.context;if(Ng){e=ua("div");var f=ua("div");e.style.position="absolute";e.style.overflow="auto";e.style.width=a.Ca+"px";e.style.height=a.Ba+"px";e.style.zIndex="1";f.style.position="absolute";f.style.width="1px";f.style.height="1px";a.Ka.appendChild(e);e.appendChild(f);
e.onscroll=Ri;e.addEventListener("pointerdown",Si);e.H=a;e.wy=!0;e.xy=!0;a.ju=e;a.gu=f}a.Zl=sa(function(){a.Xh=null;a.N()},300);a.Mv=sa(function(){rh(a)},250);a.preventDefault=function(a){a.preventDefault();return!1};a.Zj=function(b){if(a.isEnabled){var c=Ti(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();Ui(c,b)}};a.aA=function(b){a.isEnabled&&(a.Tk=!1,Ti(a,b,!0),b=a.currentTool,b.cancelWaitAfter(),b.standardMouseOver())};a.ti=function(b){if(a.isEnabled){a.Tk=!0;var c=a.Xt;void 0===c[b.pointerId]&&(c[b.pointerId]=b);c=a.oj;var d=!1;if(null===c[0]||c[0].pointerId!==b.pointerId&&c[0].pointerType===b.pointerType)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}else c[0]=b;if(c="touch"===b.pointerType||"pen"===b.pointerType)a.pu=!1,a.sq=!0;var e=d;d=Vi(a,b,!0,!1,!0,e);Wi(a,b,d);d.targetDiagram=Xi(b,b.target);d.targetObject=null;e||d.clone(a.Yp);e=a.sw;c=c?25:10;b.timeStamp-a.rw<a.By&&!(Math.abs(e.x-b.screenX)>c||Math.abs(e.y-b.screenY)>c)?a.uq++:a.uq=1;d.clickCount=a.uq;a.rw=b.timeStamp;a.sw.rg(b.screenX,b.screenY);a.doMouseDown();
1===b.button?b.preventDefault():Ui(d,b)}};a.ck=function(b){if(a.isEnabled){a.Tk=!0;var c=a.oj;if(null===c[0]||c[0].pointerId!==b.pointerId&&c[0].pointerType===b.pointerType){if(null!==c[1]&&c[1].pointerId===b.pointerId){c[1]=b;return}if(null===c[0])c[0]=b;else return}else c[0]=b;if(c[0].pointerId===b.pointerId){c=Vi(a,b,!1,!1,!1,null!==c[1]);var d=x.document.elementFromPoint(b.clientX,b.clientY)||null;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;Wi(a,f,c);c.targetObject=null;a.doMouseMove();Ui(c,b)}}};a.ek=function(b){if(a.isEnabled){a.Tk=!0;var c="touch"===b.pointerType||"pen"===b.pointerType,d=a.Xt;if(c&&a.pu)delete d[b.pointerId],b.preventDefault();else if(d=a.oj,null===d[0]||d[0].pointerId!==b.pointerId&&d[0].pointerType===b.pointerType)null!==d[1]&&d[1].pointerId===b.pointerId&&(d[1]=null);else{d[0]=null;d=Vi(a,b,!1,!0,!0,!1);var e=x.document.elementFromPoint(b.clientX,b.clientY)||
null;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&&Wi(e.H,b,d);null===e&&(e=b.target);Wi(a,b,d);d.clickCount=a.uq;d.targetDiagram=Xi(b,e);d.targetObject=null;a.doMouseUp();Ui(d,b);c&&(a.sq=!1)}}};a.dk=function(b){if(a.isEnabled){a.Tk=!1;var c=a.Xt;c[b.pointerId]&&delete c[b.pointerId];c=a.oj;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.bk=function(b){var c=a.oj;null!==c[0]&&c[0].pointerId===b.pointerId?(c[0]=null,a.sq=!1):null!==c[1]&&c[1].pointerId===b.pointerId&&(c[1]=null)};a.kt=d.Z["d"+Yi[1]+Yi[2]+"wI"+Zi.slice(1,5)]["b"+$i.slice(1,b)](d.Z,aj,b,b);d.Sc(!0);bj(a);"svg"===a.ll&&(b=a.pj.get("svg"),a.Ka.appendChild(b.La),a.jb=b.context)}}
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 bj(a){var b=a.xa.La;b instanceof HTMLCanvasElement||(b=a.div);a.addEventListener(b,"pointerdown",a.ti,!1);a.addEventListener(b,"pointermove",a.ck,!1);a.addEventListener(b,"pointerup",a.ek,!1);a.addEventListener(b,"pointerout",a.dk,!1);a.addEventListener(b,"pointercancel",a.bk,!1);a.addEventListener(b,"pointerenter",a.cz,!1);a.addEventListener(b,"pointerleave",a.dz,!1);a.addEventListener(b,"wheel",a.Zj,!1);a.addEventListener(b,"keydown",a.Qz,!1);a.addEventListener(b,"keyup",a.Rz,!1);a.addEventListener(b,
"blur",a.Py,!1);a.addEventListener(b,"focus",a.Qy,!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.Mv,!1)}function Fe(a){30<a.Oq&&(a.Xh=1)}function Xe(a,b){null!==a.Xh&&(a.Xh=null,b&&a.Zl(),Wa&&Wa.nx||(a.Oq=0,a.xw=[0,0,0,0,0],a.Pq=0))}Q.prototype.computePixelRatio=function(){return null!==this.Xh?this.Xh: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.xa)if(this.scrollsPageOnFocus)this.xa.focus();else{var a=x.scrollX||x.pageXOffset,b=x.scrollY||x.pageYOffset;this.xa.focus();x.scrollTo(a,b)}};Q.prototype.Qy=function(){this.H.R("GainedFocus")};Q.prototype.Py=function(){this.H.R("LostFocus")};
function rh(a){if(null!==a.xa){var b=a.Ka;if(null!==b&&0!==b.clientWidth&&0!==b.clientHeight){a.Ew||a.setScrollWidth();var c=a.ff?a.Fb:0,d=a.Ae?a.Fb:0,e=a.Rb;a.Rb=a.computePixelRatio();a.Rb!==e&&(a.on=!0,a.Yb());if(b.clientWidth!==a.Ca+c||b.clientHeight!==a.Ba+d)a.De=!0,a.Ec=!0,b=a.layout,null!==b&&b.isViewportSized&&a.autoScale===qh&&(a.Hk=!0,b.D()),a.fd||a.Yb()}}}
function si(a){var b=new di;b.name="Background";a.yl(b);b=new di;b.name="";a.yl(b);b=new di;b.name="Foreground";a.yl(b);b=new di;b.name="Adornment";b.isTemporary=!0;b.isInDocumentBounds=!1;a.yl(b);b=new di;b.name="Tool";b.isTemporary=!0;b.isInDocumentBounds=!0;a.yl(b);b=new di;b.name="Grid";b.allowSelect=!1;b.pickable=!1;b.isTemporary=!0;b.isInDocumentBounds=!1;a.Uw(b,a.Qj("Background"))}
function cj(a){var b=new W(W.Grid);b.name="GRID";var c=new Bf;c.figure="LineH";c.stroke="lightgray";c.strokeWidth=.5;c.interval=1;b.add(c);c=new Bf;c.figure="LineH";c.stroke="gray";c.strokeWidth=.5;c.interval=5;b.add(c);c=new Bf;c.figure="LineH";c.stroke="gray";c.strokeWidth=1;c.interval=10;b.add(c);c=new Bf;c.figure="LineV";c.stroke="lightgray";c.strokeWidth=.5;c.interval=1;b.add(c);c=new Bf;c.figure="LineV";c.stroke="gray";c.strokeWidth=.5;c.interval=5;b.add(c);c=new Bf;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 Ri(){this.H.fu?this.H.fu=!1:this.H.isEnabled?this.H.kx(this):dj(this.H)}function Si(a){this.H.isEnabled?(this.H.ku=a.target.scrollTop,this.H.iu=a.target.scrollLeft):dj(this.H)}
Q.prototype.kx=function(a){if(null!==this.xa){var b=this.ju,c=this.gu;this.lr=!0;var d=this.documentBounds,e=this.viewportBounds,f=this.rj,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.sn)switch(this.au){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=J.allocAt(this.position.x,
this.position.y),this.allowHorizontalScroll&&this.iu!==v&&(w.x=v/e+g,this.iu=v),this.allowVerticalScroll&&this.ku!==a.scrollTop&&(w.y=a.scrollTop/e+h,this.ku=a.scrollTop),this.position=w,J.free(w),this.De=this.lr=!1):(w=J.alloc(),a.wy&&this.allowHorizontalScroll&&(g<n&&(this.position=w.h(v+g,this.position.y)),m>q&&(this.position=w.h(-(b.scrollWidth-this.Ca)+v-this.Ca/e+m,this.position.y))),a.xy&&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.Ba)+a.scrollTop-this.Ba/e+f))),J.free(w),this.td=!0,this.De=this.lr=!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 N);lh(this);return ej(this,a)};
function ej(a,b){if(a.fixedBounds.w())return b.assign(a.fixedBounds),b.Bo(a.Ab),b;for(var c=!0,d=a.Wa.s,e=d.length,f=0;f<e;f++){var g=d[f];if(g.visible&&g.isInDocumentBounds){g=g.Pa.s;for(var h=g.length,k=0;k<h;k++){var l=g[k];l.isInDocumentBounds&&l.isVisible()&&(l=l.actualBounds,l.w()&&(c?(c=!1,b.assign(l)):b.ad(l)))}}}c&&b.h(0,0,0,0);b.Bo(a.Ab);return b}
Q.prototype.computePartsBounds=function(a,b){void 0===b&&(b=!1);var c=null;if(Aa(a))for(var d=0;d<a.length;d++){var e=a[d];!b&&e instanceof T||(e.Va(),null===c?c=e.actualBounds.copy():c.ad(e.actualBounds))}else for(a=a.iterator;a.next();)d=a.value,!b&&d instanceof T||(d.Va(),null===c?c=d.actualBounds.copy():c.ad(d.actualBounds));return null===c?new N(NaN,NaN,0,0):c};
function fj(a,b){if((b||a.gf)&&!a.xb&&null!==a.xa&&a.documentBounds.w()){a.xb=!0;if(b){var c=a.initialPosition;if(c.w()){a.xb=!1;a.position=c;return}c=J.alloc();c.wi(a.documentBounds,a.initialDocumentSpot);var d=a.viewportBounds;d=N.allocAt(0,0,d.width,d.height);var e=J.alloc();e.wi(d,a.initialViewportSpot);e.h(c.x-e.x,c.y-e.y);a.position=e;N.free(d);J.free(e);J.free(c)}c=a.wh;b&&a.Eg!==qh&&(c=a.Eg);var f=c!==qh?gj(a,c):a.scale;c=a.pa.x;d=a.pa.y;e=a.Ca/f;var g=a.Ba/f,h=a.xk,k=a.lq;b&&!h.vb()&&(k.vb()||
k.Vb())&&(h=k.Vb()?xc:k);hj(a,a.documentBounds,e,g,h,b);b=a.scale;a.scale=f;a.xb=!1;f=a.viewportBounds;if(!(K.B(f.x,c)&&K.B(f.y,d)&&K.B(f.width,e)&&K.B(f.height,g)))a.onViewportBoundsChanged(new N(c,d,e,g),f,b,!1)}}
function gj(a,b){var c=a.Mp;if(null===a.xa)return c;a.Va();var d=a.documentBounds;if(!d.w())return c;var e=d.width;d=d.height;var f=a.Ca+(a.ff?a.Fb:0),g=a.Ba+(a.Ae?a.Fb:0),h=f/e,k=g/d;return b===ij?(b=Math.min(k,h),b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):b===jj?(b=k>h?(g-a.Fb)/d:(f-a.Fb)/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.sj;this.sj=Rh;this.scale=gj(this,ij);a!==Rh&&(fj(this,!1),hj(this,this.documentBounds,this.Ca/this.Aa,this.Ba/this.Aa,this.xk,!1));this.sj=a};t=Q.prototype;
t.AA=function(a,b){void 0===b&&(b=ij);var c=a.width,d=a.height;if(!(0===c||0===d||isNaN(c)&&isNaN(d))){var e=1;if(b===ij||b===jj)if(isNaN(c))e=this.viewportBounds.height*this.scale/d;else if(isNaN(d))e=this.viewportBounds.width*this.scale/c;else{e=this.Ca;var f=this.Ba;e=b===jj?f/d>e/c?(f-(this.Ae?this.Fb:0))/d:(e-(this.ff?this.Fb:0))/c:Math.min(f/d,e/c)}this.scale=e;this.position=new J(a.x,a.y)}};
t.Ly=function(a,b){this.Va();var c=this.documentBounds,d=this.viewportBounds;this.position=new J(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.Az=function(a){if(a instanceof Y){this.$p=a;var b=J.alloc();this.aq=this.lp(a.ka(sc,b));J.free(b)}else this.$p=null,this.aq=tb};
function hj(a,b,c,d,e,f){var g=J.allocAt(a.pa.x,a.pa.y),h=g.x,k=g.y;if(null!==a.$p){var l=J.alloc();l=a.$p.ka(sc,l);h=l.x-a.aq.x/a.scale;k=l.y-a.aq.y/a.scale;e=rc;J.free(l)}if(f||a.scrollMode===Rh)e.vb()&&(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.rj,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.Ab.left;g.y=isFinite(k)?k:-a.Ab.top;null!==a.positionComputation&&(b=a.positionComputation(a,g),g.x=b.x,g.y=b.y);Mh(a.Wd,a.pa,g);a.pa.h(g.x,g.y);Ni(a);J.free(g)}
t.Ll=function(a,b){void 0===b&&(b=!0);if(b){if(a=qf(this,a,function(a){return a.part},function(a){return a.canSelect()}),a instanceof U)return a}else if(a=qf(this,a,function(a){return a.part}),a instanceof U)return a;return null};t.gc=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);lh(this);for(var d=this.Wa.iteratorBackwards;d.next();){var e=d.value;if(e.visible&&(e=e.gc(a,b,c),null!==e))return e}return null};
function qf(a,b,c,d){void 0===c&&(c=null);void 0===d&&(d=null);lh(a);for(a=a.Wa.iteratorBackwards;a.next();){var e=a.value;if(e.visible&&!e.isTemporary&&(e=e.gc(b,c,d),null!==e))return e}return null}t.mz=function(a,b,c){void 0===b&&(b=!0);return kj(this,a,function(a){return a.part},b?function(a){return a instanceof U&&a.canSelect()}:null,c)};
function kj(a,b,c,d,e){void 0===c&&(c=null);void 0===d&&(d=null);e instanceof F||e instanceof H||(e=new H);lh(a);for(a=a.Wa.iteratorBackwards;a.next();){var f=a.value;f.visible&&!f.isTemporary&&f.ii(b,c,d,e)}return e}t.ii=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof F||d instanceof H||(d=new H);lh(this);for(var e=this.Wa.iteratorBackwards;e.next();){var f=e.value;f.visible&&f.ii(a,b,c,d)}return d};
t.ux=function(a,b,c,d){void 0===b&&(b=!1);void 0===c&&(c=!0);return lj(this,a,function(a){return a instanceof U&&(!c||a.canSelect())},b,d)};t.Cf=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof F||e instanceof H||(e=new H);lh(this);for(var f=this.Wa.iteratorBackwards;f.next();){var g=f.value;g.visible&&g.Cf(a,b,c,d,e)}return e};
t.Nu=function(a,b,c,d,e,f){var g=new H;lh(this);for(var h=this.Wa.iteratorBackwards;h.next();){var k=h.value;k.visible&&k.Nu(a,b,c,d,g,e,f)}return g};function lj(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 F||e instanceof H||(e=new H);lh(a);for(a=a.Wa.iteratorBackwards;a.next();){var g=a.value;g.visible&&!g.isTemporary&&g.Cf(b,f,c,d,e)}return e}
t.nz=function(a,b,c,d,e){void 0===c&&(c=!0);void 0===d&&(d=!0);return mj(this,a,b,function(a){return a instanceof U&&(!d||a.canSelect())},c,e)};t.ng=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 F||e instanceof H)f=e;e=!0}f instanceof F||f instanceof H||(f=new H);lh(this);for(var g=this.Wa.iteratorBackwards;g.next();){var h=g.value;h.visible&&h.ng(a,b,c,d,e,f)}return f};
function mj(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 F||e instanceof H)f=e;e=!0}f instanceof F||f instanceof H||(f=new H);lh(a);for(a=a.Wa.iteratorBackwards;a.next();){var h=a.value;h.visible&&!h.isTemporary&&h.ng(b,c,g,d,e,f)}return f}Q.prototype.acceptEvent=function(a){return Ti(this,a,a instanceof MouseEvent)};
function Ti(a,b,c){var d=a.Og;a.Og=a.bj;a.bj=d;d.diagram=a;d.event=b;c?Wi(a,b,d):(d.viewPoint=a.Og.viewPoint,d.documentPoint=a.Og.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);Oa&&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=Xi(b,b.target);d.targetObject=null;return d}
function Xi(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 Vi(a,b,c,d,e,f){var g=a.Og;a.Og=a.bj;a.bj=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;Oa&&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 Ui(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.Qz=function(a){var b=this.H;if(!this.H.isEnabled)return!1;var c=Ti(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 Ui(c,a)};
Q.prototype.Rz=function(a){var b=this.H;if(!b.isEnabled)return!1;var c=Ti(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 Ui(c,a)};
Q.prototype.cz=function(a){var b=this.H;if(!b.isEnabled)return!1;var c=Ti(b,a,!0);null!==b.mouseEnter&&b.mouseEnter(c);b.currentTool.standardMouseOver();return Ui(c,a)};Q.prototype.dz=function(a){var b=this.H;if(!b.isEnabled)return!1;var c=Ti(b,a,!0);null!==b.mouseLeave&&b.mouseLeave(c);return Ui(c,a)};
Q.prototype.getMouse=function(a){var b=this.xa;if(null===b)return new J(0,0);var c=b.getBoundingClientRect();b=a.clientX-this.Ca/c.width*c.left;a=a.clientY-this.Ba/c.height*c.top;return null!==this.Cb?xb(new J(b,a),this.Cb):new J(b,a)};
function Wi(a,b,c){var d=a.xa,e=a.Ca,f=a.Ba,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.Cb?(b=J.allocAt(g,h),a.Cb.Od(b),c.documentPoint.assign(b),J.free(b)):c.documentPoint.h(g,h)}function $d(a,b,c){if(null!==a.oj[0]){b=a.oj[b];var d=a.xa;null!==d&&(d=d.getBoundingClientRect(),c.h(b.clientX-a.Ca/d.width*d.left,b.clientY-a.Ba/d.height*d.top))}}Q.prototype.Ya=function(){this.Yi||(this.Yi=!0,this.Yb(!1))};
function nj(a){a.fd||lh(a);a.Va()}Q.prototype.redraw=function(){this.xb||this.fd||(this.N(),this.Yc())};t=Q.prototype;t.Pz=function(){return this.jg};t.Yy=function(a){void 0===a&&(a=null);var b=this.animationManager,c=b.isEnabled;b.Bc();b.isEnabled=!1;yf(this);this.gf=!1;this.cu=new J(NaN,NaN);b.isEnabled=c;this.fd=!0;var d=this;null!==a&&ta(function(){d.fd=!1;kh(b,"Model");a(d)},1)};
t.Yb=function(a){void 0===a&&(a=!1);if(!0!==this.jg&&!(this.xb||!1===a&&this.fd)){this.jg=!0;var b=this;x.requestAnimationFrame(function(){b.jg&&b.Yc()})}};t.Yc=function(){if(!this.en||this.jg)this.en&&(this.en=!1),yf(this)};function oj(a,b,c){!a.De||a.xb||a.animationManager.defaultAnimation.isAnimating||dj(a)||(b&&lh(a),c&&fj(a,!1))}
function yf(a,b){if(!a.fd&&(a.jg=!1,null!==a.Ka||a.vo.w())){a.fd=!0;var c=a.animationManager,d=a.Wn;if(!c.isAnimating&&0!==d.length){for(var e=d.s,f=e.length,g=0;g<f;g++){var h=e[g];pj(h,!1);h.v()}d.clear()}d=a.mw;0<d.count&&(d.each(function(a){a.Lv()}),d.clear());e=d=!1;c.defaultAnimation.isAnimating&&(e=!0,d=a.skipsUndoManager,a.skipsUndoManager=!0);c.Bb||rh(a);oj(a,!1,!0);null!==a.de&&(a.de.visible&&!a.iq&&(qj(a),a.iq=!0),!a.de.visible&&a.iq&&(a.iq=!1));lh(a);f=!1;if(!a.gf||a.vh)a.gf?rj(a,!a.Hk):
(a.Ea("Initial Layout"),!1===c.isEnabled&&c.Bc(),rj(a,!1)),f=!0;a.Hk=!1;lh(a);a.nu||nj(a);oj(a,!0,!1);g=!1;f?(c=N.alloc(),c.assign(a.viewportBounds),a.gf||(g=a.gf=!0,a.skipsUndoManager||(a.undoManager.isPendingClear=!0),a.undoManager.isPendingUnmodified=!0,sj(a)),a.R("LayoutCompleted"),oj(a,!0,!1),N.free(c)):c.Mk&&c.Ow&&(a.Eg!==qh?a.scale=gj(a,a.Eg):a.wh!==qh?a.scale=gj(a,a.wh):(c=a.initialScale,isFinite(c)&&0<c&&(a.scale=c)),fj(a,!0));f&&g&&a.eb("Initial Layout");lh(a);b||a.ec(a.jb);e&&(a.skipsUndoManager=
d);a.fd=!1}}function sj(a){if(a.Eg!==qh)a.scale=gj(a,a.Eg);else if(a.wh!==qh)a.scale=gj(a,a.wh);else{var b=a.initialScale;isFinite(b)&&0<b&&(a.scale=b)}fj(a,!0);b=a.Wa.s;a.Ad(b,b.length,a,a.viewportBounds);a.R("InitialLayoutCompleted");a.cu.assign(a.pa);qj(a)}
function lh(a){if(0!==a.Ce.count&&(a.fd||!a.animationManager.isTicking)){for(var b=0;23>b;b++){var c=a.Ce.iterator;if(null===c||0===a.Ce.count)break;a.Ce=new H;a.Lv(c,a.Ce)}a.nodes.each(function(a){a instanceof pf&&0!==(a.U&65536)!==!1&&(a.U=a.U^65536)})}}
t.Lv=function(a,b){for(a.reset();a.next();){var c=a.value;!c.Wc()||c instanceof pf||(c.ri()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))}for(a.reset();a.next();)c=a.value,c instanceof pf&&c.isVisible()&&tj(this,c);for(a.reset();a.next();)c=a.value,c instanceof T&&c.isVisible()&&(c.ri()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c));for(a.reset();a.next();)c=a.value,c instanceof te&&c.isVisible()&&(c.ri()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))};
function tj(a,b){for(var c=Ea(),d=Ea(),e=b.memberParts;e.next();){var f=e.value;f.isVisible()&&(f instanceof pf?(uj(f)||vj(f)||wj(f))&&tj(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.Ad=function(a,b,c,d){if(this.td||this.animationManager.isAnimating)for(var e=0;e<b;e++)a[e].Ad(c,d)};
t.ec=function(a){if(null!==this.Ka)if(null===this.xa&&C("No canvas specified"),"svg"===this.ll){if(null!==this.Ka){var b=this.animationManager;if(!b.Bb&&(!b.isAnimating||b.isTicking)){xj(this);var c=this.Ca,d=this.Ba;a.Ev.resize(c,d,c,d);c=this.Wa.s;d=c.length;this.Ad(c,d,this,this.viewportBounds);if(this.Ec||b.isAnimating){b=this.pa;var e=this.Aa,f=Math.round(b.x*e)/e,g=Math.round(b.y*e)/e,h=this.Cb;h.reset();1!==e&&h.scale(e);0===b.x&&0===b.y||h.translate(-f,-g);a.si=null;yj(a,h.m11,h.m12,h.m21,
h.m22,h.dx,h.dy);1!==this.qb&&(a.globalAlpha=this.qb);zj(this,a);for(b=0;b<d;b++)c[b].ec(a,this);this.Ec=this.td=!1}}}}else a:if(f=this.animationManager,!f.Bb&&(!f.isAnimating||f.isTicking)&&(c=new Date,xj(this),"0"!==this.Ka.style.opacity)){d=a!==this.jb;b=this.Wa.s;e=b.length;this.Ad(b,e,this,this.viewportBounds);if(d)a.Sc(!0),this.td=!0;else if(!this.Ec&&!f.isAnimating)break a;g=this.pa;h=this.Aa;var k=Math.round(g.x*h)/h,l=Math.round(g.y*h)/h;f=this.Cb;f.reset();1!==h&&f.scale(h);0===g.x&&0===
g.y||f.translate(-k,-l);g=this.Rb;a.setTransform(g,0,0,g,0,0);a.clearRect(0,0,this.Ca,this.Ba);1!==this.qb&&(a.globalAlpha=this.qb);zj(this,a);for(h=0;h<e;h++)a.setTransform(g,0,0,g,0,0),a.transform(f.m11,f.m12,f.m21,f.m22,f.dx,f.dy),a.xc(),b[h].ec(a,this);b=!1;this.Eh?Aj(this.Eh,this)&&(b=this.kt()):b=!0;b&&(ld.prototype.Od=ld.prototype.Zw);d?(this.jb.Sc(!0),this.td=!0):this.Ec=this.td=!1;b=+new Date-+c;d=Wa&&Wa.nx;c=this.xw;if(d||null===this.Xh){c[this.Pq]=b;this.Pq=(this.Pq+1)%c.length;for(e=b=
0;e<c.length;e++)b+=c[e];this.Oq=b/c.length}1!==this.qb&&(a.globalAlpha=1);if(d)for(a.setTransform(1,0,0,1,0,0),d=0;d<c.length;d++)a.fillText(c[d].toString(),20,150+ +(20*d))}};
function Bj(a,b,c,d,e,f,g,h,k,l){if(null!==a.Ka){null===a.xa&&C("No canvas specified");void 0===g&&(g=null);void 0===h&&(h=null);void 0===k&&(k=!1);void 0===l&&(l=!1);xj(a);a.jb.Sc(!0);a.td=!0;a.Zi=!0;var m=a.Aa;a.Aa=e;var n=a.Wa.s,p=n.length;try{var r=new N(f.x,f.y,d.width/e,d.height/e),q=r.copy();q.Bo(c);qj(a,q);lh(a);a.Ad(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.ox(0,0,d.width,d.height));var u=a.Rb;b.scale(u,u);var w=ld.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.xc();b instanceof ii&&yj(b,w.m11,w.m12,w.m21,w.m22,w.dx,w.dy);ld.free(w);zj(a,b);b.globalAlpha=a.qb;var v=a.Qj("Grid");if(g){var y=new H,z=g.iterator;for(z.reset();z.next();){var A=z.value;A instanceof U&&(l||A.layer!==v)&&(A.Gj(),y.add(A))}for(l=0;l<p;l++)hi(n[l],b,a,y,k);y.each(function(a){return a.Gj()})}else for(y=0;y<p;y++){var B=n[y];B===v?l&&B.ec(b,a,!0):B.ec(b,
a,k)}a.Zi=!1;a.Eh&&Aj(a.Eh,a)&&a.kt()}finally{a.Aa=m,a.jb.Sc(!0),a.td=!0,a.Ad(n,p,a,a.viewportBounds),qj(a),a.jb instanceof ii&&(a.jb.Nj.OA(),a.redraw())}}}t.Gf=function(a){return this.Pg[a]};t.Zx=function(a,b){"minDrawingLength"===a&&(this.Kq=b);this.Pg[a]=b;this.redraw()};t.Vx=function(){this.Pg=new Ta;this.Pg.drawShadows=!0;this.Pg.textGreeking=!0;this.Pg.viewportOptimizations=Oa||Na?!1:!0;this.Pg.temporaryPixelRatio=!0;this.Pg.pictureRatioOptimization=!0;this.Kq=this.Pg.minDrawingLength=1};
function zj(a,b){a=a.Pg;null!==a&&(void 0!==a.imageSmoothingEnabled&&b.Yx(!!a.imageSmoothingEnabled),a=a.defaultFont,void 0!==a&&null!==a&&(b.font=a))}t.Nl=function(a){return this.nn[a]};t.rA=function(a,b){this.nn[a]=b};t.Ux=function(){this.nn=new Ta;this.nn.extraTouchArea=10;this.nn.extraTouchThreshold=10;this.nn.hasGestureZoom=!0};t.set=function(a){Object.assign(this,a);return this};t.Cu=function(a){return this.mm(a)};t.mm=function(a){Cj(this,a);return this};
function Cj(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];za(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.Ww(b[g]);continue}else if(d&&"Changed"===g){a.Oe(b[g]);continue}else if(d&&
Ja(a.toolManager,g))f=a.toolManager;else if(d&&Dj(a,g)){a.Bj(g,b[g]);continue}else if(a instanceof Z&&"Changed"===g){a.Oe(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.Tw(g)}}t.bx=function(){if(0!==this.Ch.count&&!(1<this.undoManager.transactionLevel)){for(;0<this.Ch.count;){var a=this.Ch;this.Ch=new ob;for(a=a.iterator;a.next();){var b=a.key;b.Uo(a.value);b.pc()}}this.N()}};
t.N=function(a){if(void 0===a)this.Ec=!0,this.Yb();else{var b=this.viewportBounds;a.w()&&b.Vc(a)&&(this.Ec=!0,this.Yb())}this.R("InvalidateDraw")};
Q.prototype.invalidateViewport=function(a,b){if(!0!==this.Ec)if(this.Ec=!0,"svg"===this.ll)this.Yc();else{var c=!0===this.Gf("temporaryPixelRatio");if(!0===this.Gf("viewportOptimizations")&&this.scrollMode!==Th&&this.rj.gi(0,0,0,0)&&b.width===a.width&&b.height===a.height){var d=this.scale,e=Math.max(a.y,b.y),f=Math.min(a.y+a.height,b.y+b.height);if(0<Math.max(0,Math.min(a.x+a.width,b.x+b.width)-Math.max(a.x,b.x))*d&&0<Math.max(0,f-e)*d){if(!(this.fd||(this.jg=!1,null===this.Ka||(this.fd=!0,this.documentBounds.w()||
(d=N.alloc(),Ej(this,this.computeBounds(d)),N.free(d)),d=this.xa,null===d||d instanceof Fj)))){var g=this.Rb;e=this.Ca*g;var h=this.Ba*g,k=this.scale*g;f=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.hw;a=this.qy;k.width!==e&&(k.width=e);k.height!==h&&(k.height=h);a.clearRect(0,0,e,h);k=190*g;var l=70*g,m=Math.max(f,0),n=Math.max(b,0),p=Math.floor(e-m),r=Math.floor(h-n);a.drawImage(d.La,m,n,p,r,0,0,p,r);Aj(this.Eh,this)&&a.clearRect(0,0,k,
l);d=Ea();a=Ea();r=Math.abs(f);p=Math.abs(b);var q=0===m?0:e-r;m=J.allocAt(q,0);r=J.allocAt(r+q,h);a.push(new N(Math.min(m.x,r.x),Math.min(m.y,r.y),Math.abs(m.x-r.x),Math.abs(m.y-r.y)));var u=this.Cb;u.reset();u.scale(g,g);1!==this.Aa&&u.scale(this.Aa);g=this.pa;(0!==g.x||0!==g.y)&&isFinite(g.x)&&isFinite(g.y)&&u.translate(-g.x,-g.y);xb(m,u);xb(r,u);d.push(new N(Math.min(m.x,r.x),Math.min(m.y,r.y),Math.abs(m.x-r.x),Math.abs(m.y-r.y)));q=0===n?0:h-p;m.h(0,q);r.h(e,p+q);a.push(new N(Math.min(m.x,r.x),
Math.min(m.y,r.y),Math.abs(m.x-r.x),Math.abs(m.y-r.y)));xb(m,u);xb(r,u);d.push(new N(Math.min(m.x,r.x),Math.min(m.y,r.y),Math.abs(m.x-r.x),Math.abs(m.y-r.y)));Aj(this.Eh,this)&&(e=0<f?0:-f,h=0<b?0:-b,m.h(e,h),r.h(k+e,l+h),a.push(new N(Math.min(m.x,r.x),Math.min(m.y,r.y),Math.abs(m.x-r.x),Math.abs(m.y-r.y))),xb(m,u),xb(r,u),d.push(new N(Math.min(m.x,r.x),Math.min(m.y,r.y),Math.abs(m.x-r.x),Math.abs(m.y-r.y))));J.free(m);J.free(r);oj(this,!1,!0);null===this.Ka&&C("No div specified");null===this.xa&&
C("No canvas specified");if(!this.animationManager.Bb&&(e=this.jb,this.Ec)){xj(this);h=this.Rb;e.setTransform(1,0,0,1,0,0);e.clearRect(0,0,this.Ca*h,this.Ba*h);e.drawImage(this.hw.La,0<f?0:Math.round(-f),0<b?0:Math.round(-b));f=this.pa;g=this.Aa;k=Math.round(f.x*g)/g;l=Math.round(f.y*g)/g;b=this.Cb;b.reset();1!==g&&b.scale(g);0===f.x&&0===f.y||b.translate(-k,-l);e.save();e.beginPath();f=a.length;for(g=0;g<f;g++)k=a[g],0!==k.width&&0!==k.height&&e.rect(Math.floor(k.x),Math.floor(k.y),Math.ceil(k.width),
Math.ceil(k.height));e.clip();e.setTransform(h,0,0,h,0,0);e.transform(b.m11,b.m12,b.m21,b.m22,b.dx,b.dy);e.xc();b=this.Wa.s;f=b.length;this.Ad(b,f,this,this.viewportBounds);zj(this,e);e.globalAlpha=this.qb;for(h=0;h<f;h++)if(g=b[h],k=d,g.visible&&0!==g.qb){l=gi(g,e);n=g.Vq;n.length=0;m=this.scale;p=N.alloc();r=g.Pa.s;u=r.length;q=k.length;for(var w=0;w<u;w++){var v=r[w],y=Gj(v,v.actualBounds);a:{for(var z=2/m,A=4/m,B=0;B<q;B++){var D=k[B];if(0!==D.width&&0!==D.height&&y.Vu(D.x-z,D.y-z,D.width+A,D.height+
A)){y=!0;break a}}y=!1}y&&g.Oj(e,v,this,n,m,p,!0)}N.free(p);e.globalAlpha=l}e.restore();e.Sc(!0);this.Eh&&Aj(this.Eh,this)&&this.kt();this.Ec=this.td=!1;this.Zl()}Ga(d);Ga(a);this.fd=!1}}else this.Yc();c&&(Fe(this),this.Yc(),Xe(this,!0))}else c?(Fe(this),this.Yc(),Xe(this,!0)):this.Yc()}};function xj(a){!1!==a.on&&(a.on=!1,Qi(a,a.Ca,a.Ba))}function Qi(a,b,c){Ni(a);var d=a.Rb;a.xa.resize(b*d,c*d,b,c)&&(a.Ec=!0,a.jb.Sc(!0))}
function dj(a){var b=a.xa;if(null===b||!a.gf||a.vo.w())return!0;var c=a.Ca,d=a.Ba,e=a.viewportBounds;if(!a.viewportBounds.w())return!0;var f=e.x,g=e.y,h=e.width,k=e.height,l=a.ju,m=a.gu,n=a.Ka,p=!1,r=a.ff?a.Fb:0,q=a.Ae?a.Fb:0,u=n.clientWidth||c+r,w=n.clientHeight||d+q;if(u!==c+r||w!==d+q)a.ff=!1,a.Ae=!1,q=r=0,a.Ca=u,a.Ba=w,p=a.on=!0,Ni(a);a.De=!1;if(!(p||a.ff||a.Ae||a.ln||a.mn))return!0;var v=a.documentBounds,y=0,z=0,A=0,B=0;n=e.width;var D=e.height,M=a.rj;a.contentAlignment.vb()?(v.width>n&&(y=M.left,
z=M.right),v.height>D&&(A=M.top,B=M.bottom)):(y=M.left,z=M.right,A=M.top,B=M.bottom);var S=v.width+y+z,R=v.height+A+B;M=a.scale;var I=S>u/M,G=R>w/M;if(!(p||a.ff||a.Ae||I||G))return!0;y=v.x-y;u=e.x;z=v.right+z;w=e.right+r;A=v.y-A;var ca=e.y;v=v.bottom+B;e=e.bottom+q;var X="1px";B="1px";a.scrollMode===Rh&&(I||G)&&(I&&a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(I=1,y+1<u&&(I=Math.max((u-y)*M+a.Ca,I)),z>w+1&&(I=Math.max((z-w)*M+a.Ca,I)),n+r+1<S&&(I=Math.max((S-n)*M+a.Ca,I)),X=I.toString()+"px"),
G&&a.hasVerticalScrollbar&&a.allowVerticalScroll&&(I=1,A+1<ca&&(I=Math.max((ca-A)*M+a.Ba,I)),v>e+1&&(I=Math.max((v-e)*M+a.Ba,I)),D+q+1<R&&(I=Math.max((R-D)*M+a.Ba,I)),B=I.toString()+"px"));I="1px"!==X;G="1px"!==B;I&&G||!I&&!G||(G&&(w-=a.Fb),I&&(e-=a.Fb),S<n+r||!a.hasHorizontalScrollbar||!a.allowHorizontalScroll||(r=1,y+1<u&&(r=Math.max((u-y)*M+a.Ca,r)),z>w+1&&(r=Math.max((z-w)*M+a.Ca,r)),n+1<S&&(r=Math.max((S-n)*M+a.Ca,r)),X=r.toString()+"px"),I="1px"!==X,r=a.Ba,I!==a.Ae&&(r=I?a.Ba-a.Fb:a.Ba+a.Fb),
R<D+q||!a.hasVerticalScrollbar||!a.allowVerticalScroll||(q=1,A+1<ca&&(q=Math.max((ca-A)*M+r,q)),v>e+1&&(q=Math.max((v-e)*M+r,q)),D+1<R&&(q=Math.max((R-D)*M+r,q)),B=q.toString()+"px"),G="1px"!==B);if(a.lr&&I===a.Ae&&G===a.ff)return c===a.Ca&&d===a.Ba||a.Yc(),!1;I!==a.Ae&&("1px"===X?a.Ba=a.Ba+a.Fb:a.Ba=Math.max(a.Ba-a.Fb,1),p=!0);a.Ae=I;m.style.width=X;G!==a.ff&&("1px"===B?a.Ca=a.Ca+a.Fb:a.Ca=Math.max(a.Ca-a.Fb,1),p=!0,a.sn&&(q=J.alloc(),G?(b.style.left=a.Fb+"px",a.position=q.h(a.pa.x+a.Fb/a.scale,
a.pa.y)):(b.style.left="0px",a.position=q.h(a.pa.x-a.Fb/a.scale,a.pa.y)),J.free(q)));p&&Ni(a);a.ff=G;m.style.height=B;a.fu=!0;p&&(a.on=!0);b=l.scrollLeft;a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(n+1<S?b=(a.position.x-y)*M:y+1<u?b=l.scrollWidth-l.clientWidth:z>w+1&&(b=a.position.x*M));if(a.sn)switch(a.au){case "negative":b=-(l.scrollWidth-b-l.clientWidth);break;case "reverse":b=l.scrollWidth-b-l.clientWidth}l.scrollLeft=b;a.hasVerticalScrollbar&&a.allowVerticalScroll&&(D+1<R?l.scrollTop=
(a.position.y-A)*M:A+1<ca?l.scrollTop=l.scrollHeight-l.clientHeight:v>e+1&&(l.scrollTop=a.position.y*M));u=a.Ca;w=a.Ba;l.style.width=u+(a.ff?a.Fb:0)+"px";l.style.height=w+(a.Ae?a.Fb:0)+"px";return c!==u||d!==w||a.animationManager.Bb?(c=N.allocAt(f,g,h,k),a.onViewportBoundsChanged(c,a.viewportBounds,M,p),N.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.Qj(a.layerName),null===b&&(b=this.Qj("")),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.ni(99999999,a,a.diagram===this);0<=c&&this.cb(ee,"parts",b,null,a,null,c);b.isTemporary||this.Ya();a.D(1);c=a.layerChanged;null!==c&&c(a,null,b)}};
t.ni=function(a){this.partManager.ni(a);var b=this;Hj(a,function(a){Ij(b,a)});(a instanceof te||a instanceof pf&&null!==a.placeholder)&&a.v();null!==a.data&&Hj(a,function(a){Jj(b.partManager,a)});!0!==vj(a)&&!0!==wj(a)||this.Ce.add(a);Kj(a,!0,this);Lj(a)?(a.actualBounds.w()&&this.N(Gj(a,a.actualBounds)),this.Ya()):a.isVisible()&&a.actualBounds.w()&&this.N(Gj(a,a.actualBounds));this.Yb()};
t.oc=function(a){a.Ej();this.partManager.oc(a);var b=this;null!==a.data&&Hj(a,function(a){Mj(b.partManager,a,b)});this.Ce.remove(a);Lj(a)?(a.actualBounds.w()&&this.N(Gj(a,a.actualBounds)),this.Ya()):a.isVisible()&&a.actualBounds.w()&&this.N(Gj(a,a.actualBounds));this.Yb()};t.remove=function(a){Nj(this,a,!0)};
function Nj(a,b,c){var d=b.layer;null!==d&&d.diagram===a&&(b.isSelected=!1,b.isHighlighted=!1,b.D(2),c&&b.Lj(),c=d.oc(-1,b,!1),0<=c&&a.cb(fe,"parts",d,b,null,c,null),a=b.layerChanged,null!==a&&a(b,d,null))}t.Fs=function(a,b){void 0===b&&(b=!1);if(Aa(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 H,c.addAll(a),a=c.iterator;a.next();)c=a.value,b&&!c.canDelete()||this.remove(c)};t.Kj=function(a,b,c){void 0===c&&(c=!1);return this.partManager.Kj(a,b,c)};
Q.prototype.moveParts=function(a,b,c,d){void 0===c&&(c=!1);void 0===d&&(d=Oj(this));if(null!==this.toolManager){var e=new ob;if(null!==a)if(Aa(a))for(var f=0;f<a.length;f++)Pj(this,e,a[f],c,d);else for(a=a.iterator;a.next();)Pj(this,e,a.value,c,d);else{for(a=this.parts;a.next();)Pj(this,e,a.value,c,d);for(a=this.nodes;a.next();)Pj(this,e,a.value,c,d);for(a=this.links;a.next();)Pj(this,e,a.value,c,d)}df(this,e,b,d,c)}};
function Pj(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=Oj(a)),c instanceof V){b.add(c,a.Kd(e,c,c.location));if(c instanceof pf&&(null!==c.placeholder||e.dragsMembers))for(f=c.memberParts;f.next();)Pj(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)&&Pj(a,b,g,d,e)}}if(e.dragsTree)for(c=c.Ou();c.next();)Pj(a,b,
c.value,d,e)}else if(c instanceof T)for(b.add(c,a.Kd(e,c)),c=c.labelNodes;c.next();)Pj(a,b,c.value,d,e);else c instanceof te||b.add(c,a.Kd(e,c,c.location))}
function df(a,b,c,d,e){if(null!==b&&0!==b.count){var f=J.alloc(),g=J.alloc();g.assign(c);isNaN(g.x)&&(g.x=0);isNaN(g.y)&&(g.y=0);(c=a.Ir)||Ge(a,b);for(var h=Ea(),k=Ea(),l=b.iterator,m=J.alloc();l.next();){var n=l.key,p=l.value;if(n.Wc()){var r=Qj(a,n,b);if(null!==r)h.push(new Rj(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 J),p.shifted.assign(m.qe(r))}else l.key instanceof T&&k.push(l.sa)}J.free(m);e=h.length;for(l=
0;l<e;l++)n=h[l],f.assign(n.info.point),void 0===n.Su.shifted&&(n.Su.shifted=new J),n.node.location=f.add(n.Su.shifted);e=J.alloc();l=J.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.Rg=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.Kd(d,r,g)),bf(r,g.x-u.x,g.y-u.y);else{q=J.allocAt(0,0);(m=r.i(0))&&m.w()&&q.assign(m);var w=m=J.alloc().assign(q).add(g);d.isGridSnapEnabled&&
(d.isGridSnapRealtime||a.lastInput.up)&&(w=J.alloc(),zg(a,r,m,w,d));m.assign(r.dragComputation(r,m,w)).qe(q);b.add(r,a.Kd(d,r,m));bf(r,m.x-u.x,m.y-u.y);J.free(q);J.free(m);w!==m&&J.free(w)}else null!==m&&(e.assign(m.location),w=b.I(m),null!==w&&e.qe(w.point)),null!==u&&(l.assign(u.location),w=b.I(u),null!==w&&l.qe(w.point)),null!==m&&null!==u?e.Xa(l)?(m=q.value.point,u=f,u.assign(e),u.qe(m),b.add(r,a.Kd(d,r,e)),bf(r,u.x,u.y)):(r.suspendsRouting=!1,r.bb()):(q=q.value.point,m=null!==m?e:null!==u?l:
g,b.add(r,a.Kd(d,r,m)),bf(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.Kd(d,r,g)),bf(r,g.x-m.x,g.y-m.y)}J.free(f);J.free(g);J.free(e);J.free(l);Ga(h);Ga(k);c||(lh(a),Ue(a,b))}}
Q.prototype.computeMove=function(a,b,c,d){void 0===d&&(d=new J);d.assign(b);if(null===a)return d;var e=b,f=c.isGridSnapEnabled;f&&(c.isGridSnapRealtime||this.lastInput.up)&&(e=J.alloc(),zg(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&&J.free(e);return d};function Oj(a){var b=a.toolManager.findTool("Dragging");return null!==b?b.dragOptions:a.Vm}
function zg(a,b,c,d,e){void 0===e&&(e=Oj(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=J.allocAt(0,0);f.xi(0,0,a,b,e);K.Mo(c.x,c.y,h+f.x,g+f.y,a,b,d);J.free(f)}}function Ge(a,b){if(null!==b)for(a.Ir=!0,a=b.iterator;a.next();)b=a.key,b instanceof T&&(b.suspendsRouting=!0)}
function Ue(a,b){if(null!==b){for(b=b.iterator;b.next();){var c=b.key;c instanceof T&&(c.suspendsRouting=!1,Sj(c)&&c.bb())}a.Ir=!1}}function Qj(a,b,c){b=b.containingGroup;if(null!==b){a=Qj(a,b,c);if(null!==a)return a;a=c.I(b);if(null!==a)return a}return null}t=Q.prototype;t.Kd=function(a,b,c){if(void 0===c)return new Je(pb);var d=a.isGridSnapEnabled;a.groupsSnapMembers||null===b.containingGroup||(d=!1);return d?new Je(new J(Math.round(1E3*c.x)/1E3,Math.round(1E3*c.y)/1E3)):new Je(c.copy())};
function Tj(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.Wa;c=a.count;for(var d=0;d<c;d++)a.L(d).name===b&&C("Cannot add Layer with the name '"+b+"'; a Layer with the same name is already present in this Diagram.")}}
t.yl=function(a){Tj(this,a,null);a.We(this);var b=this.Wa,c=b.count-1;if(!a.isTemporary)for(;0<=c&&b.L(c).isTemporary;)c--;b.Gb(c+1,a);null!==this.bc&&this.cb(ee,"layers",this,null,a,null,c+1);this.N();this.Ya();return this};
t.Uw=function(a,b){Tj(this,a,b);a.We(this);var c=this.Wa,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.bc&&this.cb(fe,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.L(f)===b){c.Gb(f,a);break}null!==this.bc&&this.cb(ee,"layers",this,null,a,null,f);this.N();0>d&&this.Ya();return this};
t.Ey=function(a,b){Tj(this,a,b);a.We(this);var c=this.Wa,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.bc&&this.cb(fe,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.L(f)===b){c.Gb(f+1,a);break}null!==this.bc&&this.cb(ee,"layers",this,null,a,null,f+1);this.N();0>d&&this.Ya();return this};
t.jA=function(a){a.diagram!==this&&C("Cannot remove a Layer from another Diagram: "+a+" of "+a.diagram);if(""!==a.name){var b=this.Wa,c=b.indexOf(a);if(b.remove(a)){for(b=a.Pa.copy().iterator;b.next();){var d=b.value,e=d.layerName;e!==a.name?d.layerName=e:d.layerName=""}null!==this.bc&&this.cb(fe,"layers",this,a,null,c,null);this.N();this.Ya()}}};t.Qj=function(a){for(var b=this.layers;b.next();){var c=b.value;if(c.name===a)return c}return null};
t.Ww=function(a){null===this.nf&&(this.nf=new F);this.nf.add(a);this.model.Oe(a);return this};t.lA=function(a){null!==this.nf&&(this.nf.remove(a),0===this.nf.count&&(this.nf=null));this.model.gk(a)};t.Oe=function(a){null===this.yg&&(this.yg=new F);this.yg.add(a);return this};t.gk=function(a){null!==this.yg&&(this.yg.remove(a),0===this.yg.count&&(this.yg=null))};
t.Zr=function(a){this.skipsUndoManager||this.model.skipsUndoManager||this.model.undoManager.Tu(a);a.change!==de&&(this.isModified=!0);if(null!==this.yg)for(var b=this.yg,c=b.length,d=0;d<c;d++)b.L(d)(a)};t.cb=function(a,b,c,d,e,f,g){void 0===f&&(f=null);void 0===g&&(g=null);var h=new be;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.Zr(h)};t.g=function(a,b,c,d,e){this.cb(ce,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===ce){var e=a.object;Uj(e,a.propertyName,a.I(b));if(e instanceof Y){var f=e.part;null!==f&&f.Ub()}this.isModified=!0}else if(d===ee){var g=a.object,h=a.newParam,k=a.newValue;if(g instanceof W)if("number"===typeof h&&k instanceof Y){b?g.oc(h):g.Gb(h,k);var l=g.part;null!==l&&l.Ub()}else"number"===typeof h&&k instanceof Vj&&(k.isRow?Wj(g,h,
b?void 0:k):Xj(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.Ub(),g.oc(m?h:-1,k,m)):g.ni(h,k,m))}else g instanceof Q?"number"===typeof h&&k instanceof di&&(b?this.Wa.nb(h):(k.We(this),this.Wa.Gb(h,k))):C("unknown ChangedEvent.Insert object: "+a.toString());this.isModified=!0}else if(d===fe){var n=a.object,p=a.oldParam,r=a.oldValue;if(n instanceof W)"number"===typeof p&&r instanceof Y?b?n.Gb(p,r):n.oc(p):
"number"===typeof p&&r instanceof Vj&&(r.isRow?Wj(n,p,b?r:void 0):Xj(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.Pa.indexOf(r)&&n.ni(p,r,q):(r.isSelected=!1,r.isHighlighted=!1,r.Ub(),n.oc(q?p:-1,r,q)))}else n instanceof Q?"number"===typeof p&&r instanceof di&&(b?(r.We(this),this.Wa.Gb(p,r)):this.Wa.nb(p)):C("unknown ChangedEvent.Remove object: "+a.toString());this.isModified=!0}else d!==de&&C("unknown ChangedEvent: "+a.toString())}finally{this.skipsModelSourceBindings=
c}}};Q.prototype.Ea=function(a){return this.undoManager.Ea(a)};Q.prototype.eb=function(a){return this.undoManager.eb(a)};Q.prototype.Kf=function(){return this.undoManager.Kf()};Q.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.Ea(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.eb(b):this.undoManager.Kf(),this.skipsUndoManager=c}};Q.prototype.updateAllTargetBindings=function(a){this.partManager.updateAllTargetBindings(a)};
Q.prototype.op=function(){this.partManager.op()};
function Yj(a,b,c){var d=a.animationManager;if(a.xb||a.fd)a.Aa=c,Ni(a),a.N(),a.De=!0,d.Bb&&(vh(d)||d.ae.add(d.H,"scale",b,a.Aa));else if(null===a.xa)a.Aa=c,Ni(a);else{a.xb=!0;var e=a.viewportBounds.copy(),f=a.Ca,g=a.Ba,h=a.zoomPoint.x,k=a.zoomPoint.y,l=a.contentAlignment;isNaN(h)&&(l.Xc()?l.Hf(Dc)?h=0:l.Hf(Ec)&&(h=f-1):h=l.vb()?l.x*(f-1):f/2);isNaN(k)&&(l.Xc()?l.Hf(Cc)?k=0:l.Hf(Fc)&&(k=g-1):k=l.vb()?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=J.allocAt(a.pa.x+h/b-h/c,a.pa.y+k/b-k/c);a.position=f;J.free(f);a.Aa=c;Ni(a);a.xb=!1;a.onViewportBoundsChanged(e,a.viewportBounds,b,!1);fj(a,!1);d.Bb&&(vh(d)||d.ae.add(d.H,"scale",b,a.Aa))}}
Q.prototype.onViewportBoundsChanged=function(a,b,c,d){if(!a.C(b)){void 0===d&&(d=!1);d||(this.De=!0);this.td=!0;var e=this.layout;null===e||!e.isViewportSized||this.autoScale!==qh||a.width===b.width&&a.height===b.height||e.D();e=this.currentTool;!0===this.Tk&&e instanceof La&&(this.lastInput.documentPoint=this.Ms(this.lastInput.viewPoint),xe(e,this));this.xb||this.invalidateViewport(a,b);qj(this);this.md.scale=c;this.md.position.x=a.x;this.md.position.y=a.y;this.md.bounds.assign(a);this.md.ax.width=
Math.round(a.width*c);this.md.ax.height=Math.round(a.height*c);this.md.Nx.width=this.Ca;this.md.Nx.height=this.Ba;this.md.Hx=d;this.R("ViewportBoundsChanged",this.md,a);this.isVirtualized&&this.links.each(function(a){a.isAvoiding&&a.actualBounds.Vc(b)&&a.bb()})}};
function qj(a,b){var c=a.de;if(null!==c&&c.visible){for(var d=L.alloc(),e=1,f=1,g=c.O.s,h=g.length,k=0;k<h;k++){var l=g[k],m=Math.abs(l.interval);2>m||(Zj(l.figure)?f=f*m/K.vx(f,m):e=e*m/K.vx(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=N.alloc();a=a.viewportBounds;b.h(a.x,a.y,a.width,a.height);if(!b.w()){N.free(b);return}e=b.width;f=b.height;a=b.x;g=b.y;N.free(b)}c.width=e+2*d.width;c.height=f+2*d.height;b=J.alloc();K.Mo(a,g,0,0,d.width,d.height,
b);b.offset(-d.width,-d.height);L.free(d);c.part.location=b;J.free(b)}}Q.prototype.clearSelection=function(a){void 0===a&&(a=!1);var b=this.selection;if(0!==b.count){a||this.R("ChangingSelection",b);for(var c=b.Fa(),d=c.length,e=0;e<d;e++)c[e].isSelected=!1;b.ja();b.clear();b.freeze();a||this.R("ChangedSelection",b)}};
Q.prototype.select=function(a){null!==a&&a.diagram===this&&(!a.isSelected||1<this.selection.count)&&(this.R("ChangingSelection",this.selection),this.clearSelection(!0),a.isSelected=!0,this.R("ChangedSelection",this.selection))};
Q.prototype.qA=function(a){this.R("ChangingSelection",this.selection);this.clearSelection(!0);if(Aa(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.R("ChangedSelection",this.selection)};
Q.prototype.clearHighlighteds=function(){var a=this.highlighteds;if(0<a.count){for(var b=a.Fa(),c=b.length,d=0;d<c;d++)b[d].isHighlighted=!1;a.ja();a.clear();a.freeze()}};t=Q.prototype;t.Jz=function(a){null!==a&&a.diagram===this&&(!a.isHighlighted||1<this.highlighteds.count)&&(this.clearHighlighteds(),a.isHighlighted=!0)};
t.Kz=function(a){a=(new H).addAll(a);for(var b=this.highlighteds.copy().ep(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,f=J.alloc();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;"up"===b?this.position=f.h(c.x,e.y):"left"===b?this.position=
f.h(e.x,c.y):"down"===b?this.position=f.h(c.x,e.bottom-c.height):"right"===b&&(this.position=f.h(e.right-c.width,c.y));J.free(f);return}C("scrolling unit must be 'pixel', 'line', 'page', or 'document', not: "+a)}e/=this.scale;c=this.position;"up"===b?this.position=f.h(c.x,c.y-e):"down"===b?this.position=f.h(c.x,c.y+e):"left"===b?this.position=f.h(c.x-e,c.y):"right"===b?this.position=f.h(c.x+e,c.y):C("scrolling direction must be 'up', 'down', 'left', or 'right', not: "+b);J.free(f)};
t.tv=function(a){var b=this.viewportBounds;b.Qe(a)||(a=a.center,a.x-=b.width/2,a.y-=b.height/2,this.position=a)};t.$r=function(a){var b=this.viewportBounds;a=a.center;a.x-=b.width/2;a.y-=b.height/2;this.position=a};t.lp=function(a){var b=this.Cb;b.reset();1!==this.Aa&&b.scale(this.Aa);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.Cb)};
t.yA=function(a){var b=this.Cb,c=a.x,d=a.y,e=c+a.width,f=d+a.height,g=b.m11,h=b.m12,k=b.m21,l=b.m22,m=b.dx,n=b.dy,p=c*g+d*k+m;b=c*h+d*l+n;var r=e*g+d*k+m;a=e*h+d*l+n;d=c*g+f*k+m;c=c*h+f*l+n;g=e*g+f*k+m;e=e*h+f*l+n;f=Math.min(p,r);p=Math.max(p,r);r=Math.min(b,a);b=Math.max(b,a);f=Math.min(f,d);p=Math.max(p,d);r=Math.min(r,c);b=Math.max(b,c);f=Math.min(f,g);p=Math.max(p,g);r=Math.min(r,e);b=Math.max(b,e);return new N(f,r,p-f,b-r)};
t.Ms=function(a){var b=this.Cb;b.reset();1!==this.Aa&&b.scale(this.Aa);var c=this.pa;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return xb(a.copy(),this.Cb)};function ak(a){var b=a.isModified;a.Rw!==b&&(a.Rw=b,a.R("Modified"))}function bk(a){a=oi.get(a);return null!==a?new a:new pi}
Q.prototype.doModelChanged=function(a){var b=this;if(a.model===this.model){var c=a.change,d=a.propertyName;if(c===de&&"S"===d[0])if("StartingFirstTransaction"===d){var e=this;a=this.toolManager;a.mouseDownTools.each(function(a){return a.diagram=e});a.mouseMoveTools.each(function(a){return a.diagram=e});a.mouseUpTools.each(function(a){return a.diagram=e});this.fd||this.gf||(this.Hk=!0,this.en&&(this.jg=!0))}else"StartingUndo"===d||"StartingRedo"===d?(a=this.animationManager,a.defaultAnimation.isAnimating&&
!this.skipsUndoManager&&a.Bc(),this.R("ChangingSelection",this.selection)):"StartedTransaction"===d&&(a=this.animationManager,a.defaultAnimation.isAnimating&&!this.skipsUndoManager&&a.Bc());else if(this.aa){this.aa=!1;try{if(""===a.modelChange&&c===de){if("FinishedUndo"===d||"FinishedRedo"===d)this.R("ChangedSelection",this.selection),lh(this);var f=this.animationManager;"RolledBackTransaction"===d&&f.Bc();this.bx();this.Hk=!0;this.Yc();0!==this.undoManager.transactionLevel&&1!==this.undoManager.transactionLevel||
mh(f);"CommittedTransaction"===d&&this.undoManager.isJustDiscarded&&(this.Be=Math.min(this.Be,this.undoManager.historyIndex-1));"CommittedTransaction"!==d&&"RolledBackTransaction"!==d||!this.undoManager.isPendingUnmodified||setTimeout(function(){b.isModified=!1},1);var g=a.isTransactionFinished;g&&(ak(this),this.xs.clear(),Jh(this.animationManager));if(!this.Qt&&g&&this.lastInput.targetDiagram){this.Qt=!0;var h=this;ta(function(){h.currentTool.standardMouseOver();h.Qt=!1},10)}}}finally{this.aa=!0}}}};
function Ij(a,b){b=b.O.s;for(var c=b.length,d=0;d<c;d++)ck(a,b[d])}function ck(a,b){if(b instanceof dk){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){c.Ag instanceof H&&c.Ag.add(a);var d=b.Dg;null!==d&&!0===d.oq&&null!==b.diagram&&b.diagram.Wn.add(b);if(c.gn)if(c=c.getAttribute("src")||"",d=a.Mg.I(c),null===d)d=[],d.push(b),a.Mg.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}}
function ek(a,b){if(b instanceof dk){var c=b.element;if(null!==c&&c instanceof HTMLImageElement&&c.gn){var d=c.getAttribute("src")||"",e=a.Mg.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.Mg.remove(d),c.Bq&&c.removeEventListener("load",c.Bq),c.Up&&c.removeEventListener("error",c.Up),delete c.Bq,delete c.Up,c.Ag instanceof H&&c.Ag.remove(a),Mi(d));break}}}}Q.prototype.Ud=function(){this.partManager.Ud()};Q.prototype.Aj=function(a,b){this.Wd.Aj(a,b)};
Q.prototype.Cj=function(a,b){this.Wd.Cj(a,b)};Q.prototype.findPartForKey=function(a){return this.partManager.findPartForKey(a)};Q.prototype.Tb=function(a){return this.partManager.Tb(a)};Q.prototype.findLinkForKey=function(a){return this.partManager.findLinkForKey(a)};t=Q.prototype;t.Kc=function(a){return this.partManager.Kc(a)};t.hi=function(a){return this.partManager.hi(a)};t.Jc=function(a){return this.partManager.Jc(a)};
t.js=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.js.apply(this.partManager,b instanceof Array?b:da(ba(b)))};t.hs=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.hs.apply(this.partManager,b instanceof Array?b:da(ba(b)))};function Ni(a){var b=a.pa,c=a.Aa;a.Pw.h(b.x,b.y,Math.max(a.Ca,0)/c,Math.max(a.Ba,0)/c);a.td=!0}
function Ej(a,b){a.Yi=!1;var c=a.Pp;c.C(b)||(c=c.copy(),a.Pp.assign(b),fj(a,!1),a.R("DocumentBoundsChanged",void 0,c),a.De=!0,a.N())}t.Va=function(){if(this.Yi){var a=N.alloc();Ej(this,this.computeBounds(a));N.free(a)}};t.sz=function(){for(var a=new H,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.rz=function(){return this.$h.iterator};
t.Uz=function(a){lh(this);a&&fk(this,!0);this.fd?rj(this,!1):(this.Hk=!0,yf(this))};function fk(a,b){for(var c=a.$h.iterator;c.next();)gk(a,c.value,b);a.layout&&(b?a.layout.isValidLayout=!1:a.layout.D())}function gk(a,b,c){if(null!==b){for(var d=b.el.iterator;d.next();)gk(a,d.value,c);null!==b.layout&&(c?b.layout.isValidLayout=!1:b.layout.D())}}
function rj(a,b){if(a.vh&&!a.ht){var c=a.aa;a.aa=!0;var d=a.undoManager.transactionLevel,e=a.layout,f=a.animationManager;try{0===d&&(a.undoManager.isInternalTransaction=!0,a.Ea("Layout"));1>=d&&!f.defaultAnimation.isAnimating&&!f.Bb&&(b||kh(f,"Layout"));a.vh=!1;for(var g=a.$h.iterator;g.next();)hk(a,g.value,b,d);e.isValidLayout||(!b||e.isRealtime||null===e.isRealtime||0===d?(e.doLayout(a),lh(a),e.isValidLayout=!0):a.vh=!0)}finally{b=a.undoManager.isInternalTransaction,0===d&&(a.eb("Layout"),a.undoManager.isInternalTransaction=
!1),!b||0!==d&&1!==d||mh(f),a.aa=c}}}function hk(a,b,c,d){if(null!==b){for(var e=b.el.iterator;e.next();)hk(a,e.value,c,d);e=b.layout;null===e||e.isValidLayout||(!c||e.isRealtime||0===d?(b.ph=!b.location.w(),e.doLayout(b),b.D(32),tj(a,b),e.isValidLayout=!0):a.vh=!0)}}t.zz=function(){for(var a=new F,b=this.nodes;b.next();){var c=b.value;c.isTopLevel&&null===c.ih()&&a.add(c)}return a.iterator};
function xi(a){function b(a){var b=a.toLowerCase(),e=new F;c.add(a,e);c.add(b,e);d.add(a,a);d.add(b,a)}var c=new ob,d=new ob;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.gw=c;a.fw=d}
function Dj(a,b){var c=a.fw.I(b);return null!==c?c:a.fw.I(b.toLowerCase())}function ik(a,b){var c=a.gw.I(b);if(null!==c)return c;c=a.gw.I(b.toLowerCase());if(null!==c)return c;C("Unknown DiagramEvent name: "+b)}t.Bj=function(a,b){a=ik(this,a);null!==a&&a.add(b);return this};t.$l=function(a,b){a=ik(this,a);null!==a&&a.remove(b)};
t.R=function(a,b,c){var d=ik(this,a),e=new ae;e.diagram=this;a=Dj(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.L(0)(e);else if(0!==b)for(d=d.Fa(),c=0;c<b;c++)(0,d[c])(e)};function jk(a){if(a.animationManager.isTicking)return!1;var b=a.currentTool;return b===a.toolManager.findTool("Dragging")?!a.Ir||b.isComplexRoutingRealtime:!0}t.Xj=function(a,b){return kk(this,!1,null,b||null).Xj(a.x,a.y,a.width,a.height)};
Q.prototype.computeOccupiedArea=function(a){return this.isVirtualized?this.viewportBounds.copy():this.Yi?ej(this,a):a.assign(this.documentBounds)};
function kk(a,b,c,d){var e=a.Wh;null===e&&(a.Wh=e=new lk(a.avoidanceCellSize));if(e.ss||e.group!==c||e.$x!==d){e.Ix=Math.max(e.Ls+1,Math.floor(a.avoidanceLimit/a.avoidanceCellSize.width));e.Jx=Math.max(e.Ls+1,Math.floor(a.avoidanceLimit/a.avoidanceCellSize.height));null!==c&&(c=uk(a,c));if(null===c){b=N.alloc();a.computeOccupiedArea(b);b.Ac(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&&yk(a,g,d,b)}N.free(b)}else{0<c.memberParts.count&&
(b=a.computePartsBounds(c.memberParts,!1),b.Ac(20,20),e.initialize(b));b=N.alloc();for(f=c.memberParts;f.next();)g=f.value,g instanceof V&&yk(a,g,d,b);N.free(b)}e.group=c;e.$x=d;e.ss=!1}else b&&zk(e);return e}function uk(a,b){return b.avoidable&&!b.isLinkLabel?b:null!==b.containingGroup?uk(a,b.containingGroup):null}
function yk(a,b,c,d){if(b!==c&&b.isVisible())if(b.avoidable&&!b.isLinkLabel){b=b.getAvoidableRect(d);a=a.Wh;var e=b.x,f=b.y;if(Ak(a,e,f))for(c=(f-a.Jd)/a.rc|0,d=Math.min((e+b.width-a.Hd)/a.qc|0,a.ci),b=Math.min((f+b.height-a.Jd)/a.rc|0,a.di),e=(e-a.Hd)/a.qc|0;e<=d;e++)if(f=a.$b[e],f.fill)f.fill(Bk,c,b+1);else for(var g=c;g<=b;g++)f[g]=Bk}else if(b instanceof pf)for(b=b.memberParts;b.next();)e=b.value,e instanceof V&&yk(a,e,c,d)}
function Ck(a,b){null===a.Wh||a.Wh.ss||void 0!==b&&(!b.avoidable||b.isLinkLabel)||(a.Wh.ss=!0)}Q.prototype.ds=function(a){this.sp.assign(a);this.computeAutoScrollPosition(this.sp).Xa(this.position)?this.tg():Dk(this)};
function Dk(a){-1===a.tk&&(a.tk=ta(function(){if(-1!==a.tk&&(a.tg(),null!==a.lastInput.event)){var b=a.computeAutoScrollPosition(a.sp);b.Xa(a.position)||(a.position=b,a.lastInput.documentPoint=a.Ms(a.sp),a.doMouseMove(),a.Yi=!0,b=N.alloc(),a.computeBounds(b),b.ad(a.documentBounds),Ej(a,b),N.free(b),a.Ec=!0,a.Yc(),Dk(a))}},a.rp))}Q.prototype.tg=function(){-1!==this.tk&&(x.clearTimeout(this.tk),this.tk=-1)};
Q.prototype.computeAutoScrollPosition=function(a){var b=this.position,c=this.tp;if(0>=c.top&&0>=c.left&&0>=c.right&&0>=c.bottom)return b;var d=this.viewportBounds,e=this.scale;d=N.allocAt(0,0,d.width*e,d.height*e);var f=J.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.Xa(pb)||(b=new J(b.x+f.x/e,b.y+f.y/e));
N.free(d);J.free(f);return b};t=Q.prototype;t.zs=function(){return null};t.av=function(){return null};t.Xr=function(a,b){this.pj.add(a,b)};t.Du=function(a){(this.Nw=a)||this.nodes.each(function(a){a instanceof pf&&(a.Wp=null)})};
function Ek(a,b,c){function d(){var a=+new Date;f=!0;for(g.reset();g.next();)if(!g.value[0].Zk){f=!1;break}f||a-l>k?b(c,e,h):x.requestAnimationFrame(d)}for(var e=c.callback,f=!0,g=a.Mg.iterator;g.next();)if(!g.value[0].Zk){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.Wz=function(a){if(!Ng)return null;void 0===a&&(a={});a.returnType="Image";return this.Kx(a)};
t.Kx=function(a){void 0===a&&(a={});return Ek(this,this.Xz,a)};
t.Xz=function(a,b,c){var d=Fk(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 Zi+"data":e=d.getImageData(0,0,c.width,c.height);break;case Zi: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";b(null);return null;default:e=c.toDataURL(a.type,a.details)}return"function"===typeof b?(b(e),null):e};
function Fk(a,b,c,d){a.animationManager.Bc();a.Yc();if(null===a.xa)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 L(Infinity,Infinity):new L(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 hc(l):l instanceof hc||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.jb.Sc(!0);n=new Pi(null,p,void 0,!0);var u=n.context;if(!(e||f||k||h)){n.width=a.Ca+Math.ceil(l.left+l.right);n.height=a.Ba+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.es=r;Bj(a,d.context,l,new L(n.width,n.height),a.Aa,a.pa,k,m,q,b);return d.context}a.Wm=!1;Bj(a,u,l,new L(n.width,n.height),a.Aa,a.pa,k,m,q,b);a.Wm=!0;return n.context}var w=a.Mp,v=a.documentBounds.copy();v.Dv(a.Ab);if(q)for(var y=a.Wa.s,z=y.length,A=0;A<z;A++){var B=y[A];if(B.visible&&B.isTemporary){B=B.Pa.s;for(var D=B.length,M=0;M<D;M++){var S=B[M];S.isInDocumentBounds&&S.isVisible()&&(S=S.actualBounds,S.w()&&v.ad(S))}}}y=new J(v.x,
v.y);if(null!==k){z=new N(0,0,0,0);A=!0;B=k.iterator;for(B.reset();B.next();)D=B.value,D instanceof U&&(M=D.layer,null!==M&&!M.visible||null!==M&&!q&&M.isTemporary||!D.isVisible()||(D=D.actualBounds,D.w()&&(A?(A=!1,z.assign(D)):z.ad(D))));v.width=z.width;v.height=z.height;y.x=z.x;y.y=z.y}null!==h&&h.w()&&(y=h,f||(f=w));z=h=0;null!==l&&(h=l.left+l.right,z=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-z)));null!==e&&null!==f?("NaN"===
f&&(f=w),e.w()?(e=B,v=A):isNaN(A)?(e=B,v=v.height*f):(e=v.width*f,v=A)):null!==e?e.w()?(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.w()?(f=Math.min((g.width-h)/v.width,(g.height-z)/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+=z):l=new hc(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.es=r;Bj(a,d.context,l,new L(Math.ceil(e),Math.ceil(v)),f,y,k,m,q,b);return d.context}a.Wm=!1;Bj(a,u,l,new L(Math.ceil(e),Math.ceil(v)),f,y,k,m,q,b);a.Wm=!0;return n.context}
ma.Object.defineProperties(Q.prototype,{renderer:{get:function(){return this.ll},set:function(a){this instanceof Gk||(""===a&&(a="default"),a=a.toLowerCase(),a!==this.ll&&(this.ll=a,"default"===a||"canvas"===a?(a=this.pj.get("svg"),null!==a&&a.La.remove(),this.xa&&(this.jb=this.xa.context)):"svg"===a?(this.pj.contains("svg")?a=this.pj.get("svg"):(a=new Fj(this,x.document),this.Xr("svg",a)),null!==this.div&&this.div.appendChild(a.La),this.jb=a.context,this.xa&&(this.xa.context.setTransform(this.Rb,
0,0,this.Rb,0,0),this.xa.context.clearRect(0,0,this.Ca,this.Ba))):"debug"!==a||this.pj.contains("SVG")||(a=new Fj(this,x.document),this.Xr("SVG",a),a.La.style.backgroundColor="whitesmoke",null!==this.div&&this.div.after(a.La)),this.Zl()))}},div:{get:function(){return this.Ka},set:function(a){if(this.Ka!==a){var b=this.Ka;null!==b?(b.H=void 0,b.goDiagram=void 0,b.go=void 0,b.innerHTML="",null!==this.xa&&(b=this.xa.La,this.removeEventListener(b,"pointermove",this.ck,!1),
this.removeEventListener(b,"pointerdown",this.ti,!1),this.removeEventListener(b,"pointerup",this.ek,!1),this.removeEventListener(b,"pointerout",this.dk,!1),this.removeEventListener(b,"pointercancel",this.bk,!1),this.xa.mx()),this.ml&&(this.ml.disconnect(),this.ml=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.xa=null,this.removeEventListener(x,"resize",this.Mv,!1),this.removeEventListener(x,"wheel",this.Zj,!0),ke===this&&(ke=null)):null===this.ti&&(this.gf=!1);this.Ka=null;if(null!==a){if(b=a.H)b.div=null;vi(this,a);this.redraw()}}}},Yw:{get:function(){return this.Oq}},oi:{get:function(){return this.gf}},draggedLink:{get:function(){return this.jt},set:function(a){this.jt!==a&&(this.jt=a,null!==a&&(this.Ut=a.fromPort,
this.Vt=a.toPort))}},Ox:{get:function(){return this.Ut},set:function(a){this.Ut=a}},Px:{get:function(){return this.Vt},set:function(a){this.Vt=a}},animationManager:{get:function(){return this.Wd}},undoManager:{get:function(){return this.bc.undoManager}},skipsUndoManager:{get:function(){return this.Ug},set:function(a){this.Ug=a;this.bc.skipsUndoManager=
a}},delaysLayout:{get:function(){return this.ht},set:function(a){this.ht=a}},opacity:{get:function(){return this.qb},set:function(a){var b=this.qb;b!==a&&((0>a||1<a)&&xa(a,"0 <= value <= 1",Q,"opacity"),this.qb=a,this.g("opacity",b,a),this.N())}},validCycle:{get:function(){return this.vu},set:function(a){var b=this.vu;b!==a&&(this.vu=a,this.g("validCycle",b,a))}},layers:{get:function(){return this.Wa.iterator}},
isModelReadOnly:{get:function(){var a=this.bc;return null===a?!1:a.isReadOnly},set:function(a){var b=this.bc;null!==b&&(b.isReadOnly=a)}},isReadOnly:{get:function(){return this.Fg},set:function(a){var b=this.Fg;b!==a&&(this.Fg=a,this.g("isReadOnly",b,a))}},isEnabled:{get:function(){return this.Dd},set:function(a){var b=this.Dd;b!==a&&(this.Dd=a,this.g("isEnabled",b,a))}},allowClipboard:{
get:function(){return this.Rs},set:function(a){var b=this.Rs;b!==a&&(this.Rs=a,this.g("allowClipboard",b,a))}},allowCopy:{get:function(){return this.Ei},set:function(a){var b=this.Ei;b!==a&&(this.Ei=a,this.g("allowCopy",b,a))}},allowDelete:{get:function(){return this.Fi},set:function(a){var b=this.Fi;b!==a&&(this.Fi=a,this.g("allowDelete",b,a))}},allowDragOut:{get:function(){return this.Ss},set:function(a){var b=
this.Ss;b!==a&&(this.Ss=a,this.g("allowDragOut",b,a))}},allowDrop:{get:function(){return this.Ts},set:function(a){var b=this.Ts;b!==a&&(this.Ts=a,this.g("allowDrop",b,a))}},allowTextEdit:{get:function(){return this.Oi},set:function(a){var b=this.Oi;b!==a&&(this.Oi=a,this.g("allowTextEdit",b,a))}},allowGroup:{get:function(){return this.Gi},set:function(a){var b=this.Gi;b!==a&&(this.Gi=a,this.g("allowGroup",b,
a))}},allowUngroup:{get:function(){return this.Pi},set:function(a){var b=this.Pi;b!==a&&(this.Pi=a,this.g("allowUngroup",b,a))}},allowInsert:{get:function(){return this.Vs},set:function(a){var b=this.Vs;b!==a&&(this.Vs=a,this.g("allowInsert",b,a))}},allowLink:{get:function(){return this.Hi},set:function(a){var b=this.Hi;b!==a&&(this.Hi=a,this.g("allowLink",b,a))}},allowRelink:{get:function(){return this.Ji},
set:function(a){var b=this.Ji;b!==a&&(this.Ji=a,this.g("allowRelink",b,a))}},allowMove:{get:function(){return this.Ii},set:function(a){var b=this.Ii;b!==a&&(this.Ii=a,this.g("allowMove",b,a))}},allowReshape:{get:function(){return this.Ki},set:function(a){var b=this.Ki;b!==a&&(this.Ki=a,this.g("allowReshape",b,a))}},allowResize:{get:function(){return this.Li},set:function(a){var b=this.Li;b!==a&&(this.Li=a,this.g("allowResize",
b,a))}},allowRotate:{get:function(){return this.Mi},set:function(a){var b=this.Mi;b!==a&&(this.Mi=a,this.g("allowRotate",b,a))}},allowSelect:{get:function(){return this.Ni},set:function(a){var b=this.Ni;b!==a&&(this.Ni=a,this.g("allowSelect",b,a))}},allowUndo:{get:function(){return this.Ws},set:function(a){var b=this.Ws;b!==a&&(this.Ws=a,this.g("allowUndo",b,a))}},allowZoom:{get:function(){return this.Ys},
set:function(a){var b=this.Ys;b!==a&&(this.Ys=a,this.g("allowZoom",b,a))}},hasVerticalScrollbar:{get:function(){return this.mn},set:function(a){var b=this.mn;b!==a&&(this.mn=a,this.De=!0,this.N(),this.g("hasVerticalScrollbar",b,a),fj(this,!1))}},hasHorizontalScrollbar:{get:function(){return this.ln},set:function(a){var b=this.ln;b!==a&&(this.ln=a,this.De=!0,this.N(),this.g("hasHorizontalScrollbar",b,a),fj(this,!1))}},allowHorizontalScroll:{
get:function(){return this.Us},set:function(a){var b=this.Us;b!==a&&(this.Us=a,this.g("allowHorizontalScroll",b,a),fj(this,!1))}},allowVerticalScroll:{get:function(){return this.Xs},set:function(a){var b=this.Xs;b!==a&&(this.Xs=a,this.g("allowVerticalScroll",b,a),fj(this,!1))}},scrollHorizontalLineChange:{get:function(){return this.hu},set:function(a){var b=this.hu;b!==a&&(0>a&&xa(a,">= 0",Q,"scrollHorizontalLineChange"),this.hu=
a,this.g("scrollHorizontalLineChange",b,a))}},scrollVerticalLineChange:{get:function(){return this.lu},set:function(a){var b=this.lu;b!==a&&(0>a&&xa(a,">= 0",Q,"scrollVerticalLineChange"),this.lu=a,this.g("scrollVerticalLineChange",b,a))}},lastInput:{get:function(){return this.bj},set:function(a){this.bj=a}},previousInput:{get:function(){return this.Og},set:function(a){this.Og=a}},firstInput:{
get:function(){return this.Yp},set:function(a){this.Yp=a}},currentCursor:{get:function(){return this.et},set:function(a){""===a&&(a=this.Lp);if(this.et!==a){var b=this.xa,c=this.Ka;if(null!==b&&null!==c){this.et=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.Lp},set:function(a){""===a&&(a="auto");var b=this.Lp;b!==a&&(this.Lp=a,this.g("defaultCursor",b,a))}},click:{get:function(){return this.xh},set:function(a){var b=this.xh;b!==a&&(this.xh=a,this.g("click",b,a))}},doubleClick:{get:function(){return this.Dh},set:function(a){var b=this.Dh;b!==a&&(this.Dh=a,this.g("doubleClick",b,a))}},contextClick:{
get:function(){return this.zh},set:function(a){var b=this.zh;b!==a&&(this.zh=a,this.g("contextClick",b,a))}},mouseOver:{get:function(){return this.Ph},set:function(a){var b=this.Ph;b!==a&&(this.Ph=a,this.g("mouseOver",b,a))}},mouseHover:{get:function(){return this.Nh},set:function(a){var b=this.Nh;b!==a&&(this.Nh=a,this.g("mouseHover",b,a))}},mouseHold:{get:function(){return this.Mh},set:function(a){var b=
this.Mh;b!==a&&(this.Mh=a,this.g("mouseHold",b,a))}},mouseDragOver:{get:function(){return this.Pt},set:function(a){var b=this.Pt;b!==a&&(this.Pt=a,this.g("mouseDragOver",b,a))}},mouseDrop:{get:function(){return this.Kh},set:function(a){var b=this.Kh;b!==a&&(this.Kh=a,this.g("mouseDrop",b,a))}},handlesDragDropForTopLevelParts:{get:function(){return this.ut},set:function(a){var b=this.ut;b!==a&&(this.ut=a,this.g("handlesDragDropForTopLevelParts",
b,a))}},mouseEnter:{get:function(){return this.Lh},set:function(a){var b=this.Lh;b!==a&&(this.Lh=a,this.g("mouseEnter",b,a))}},mouseLeave:{get:function(){return this.Oh},set:function(a){var b=this.Oh;b!==a&&(this.Oh=a,this.g("mouseLeave",b,a))}},toolTip:{get:function(){return this.Zh},set:function(a){var b=this.Zh;b!==a&&(this.Zh=a,this.g("toolTip",b,a))}},contextMenu:{get:function(){return this.Ah},
set:function(a){var b=this.Ah;b!==a&&(this.Ah=a,this.g("contextMenu",b,a))}},commandHandler:{get:function(){return this.ob},set:function(a){this.ob!==a&&(this.ob=a,a.We(this))}},toolManager:{get:function(){return this.se},set:function(a){this.se!==a&&(this.se=a,a.diagram=this)}},defaultTool:{get:function(){return this.pb},set:function(a){var b=this.pb;b!==a&&(this.pb=a,a.diagram=this,this.currentTool===b&&(this.currentTool=
a))}},currentTool:{get:function(){return this.hb},set:function(a){var b=this.hb;b&&(b.isActive&&b.doDeactivate(),b.cancelWaitAfter(),b.doStop());null===a&&(a=this.defaultTool);null!==a&&(this.hb=a,a.diagram=this,a.doStart())}},selection:{get:function(){return this.Fw}},maxSelectionCount:{get:function(){return this.Kt},set:function(a){var b=this.Kt;if(b!==a)if(0<=a&&!isNaN(a)){if(this.Kt=a,this.g("maxSelectionCount",
b,a),!this.undoManager.isUndoingRedoing&&(a=this.selection.count-a,0<a)){this.R("ChangingSelection",this.selection);b=this.selection.Fa();for(var c=0;c<a;c++)b[c].isSelected=!1;this.R("ChangedSelection",this.selection)}}else xa(a,">= 0",Q,"maxSelectionCount")}},nodeSelectionAdornmentTemplate:{get:function(){return this.Rt},set:function(a){var b=this.Rt;b!==a&&(this.Rt=a,this.g("nodeSelectionAdornmentTemplate",b,a))}},groupSelectionAdornmentTemplate:{
get:function(){return this.tt},set:function(a){var b=this.tt;b!==a&&(this.tt=a,this.g("groupSelectionAdornmentTemplate",b,a))}},linkSelectionAdornmentTemplate:{get:function(){return this.Ht},set:function(a){var b=this.Ht;b!==a&&(this.Ht=a,this.g("linkSelectionAdornmentTemplate",b,a))}},highlighteds:{get:function(){return this.lw}},isModified:{get:function(){var a=this.undoManager;return a.isEnabled?null!==a.currentTransaction?
!0:this.qn&&this.Be!==a.historyIndex:this.qn},set:function(a){if(this.qn!==a){this.qn=a;var b=this.undoManager;!a&&b.isEnabled&&(this.Be=b.historyIndex);a||ak(this)}}},model:{get:function(){return this.bc},set:function(a){var b=this.bc;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.Bc(!0);var c=Li(this,!0);this.gf=!1;this.en=
!0;this.Be=-2;this.jg=!1;var d=this.xb;this.xb=!0;kh(this.animationManager,"Model");b&&(null!==this.nf&&this.nf.each(function(a){return b.gk(a)}),b.gk(this.Nc));this.bc=a;this.partManager=bk(this.bc.type);for(var e=0;e<c.length;e++)this.add(c[e]);a.Oe(this.Hb);this.partManager.addAllModeledParts();a.gk(this.Hb);a.Oe(this.Nc);null!==this.nf&&this.nf.each(function(b){return a.Oe(b)});this.xb=d;this.Ya();this.xb||this.N();b&&a.undoManager.copyProperties(b.undoManager)}}},aa:{
get:function(){return this.pw},set:function(a){this.pw=a}},xs:{get:function(){return this.uy}},skipsModelSourceBindings:{get:function(){return this.Gw},set:function(a){this.Gw=a}},Ks:{get:function(){return this.nu},set:function(a){this.nu=a}},nodeTemplate:{get:function(){return this.Jg.I("")},set:function(a){var b=this.Jg.I("");b!==a&&(this.Jg.add("",a),this.g("nodeTemplate",b,a),
this.undoManager.isUndoingRedoing||this.Ud())}},nodeTemplateMap:{get:function(){return this.Jg},set:function(a){var b=this.Jg;b!==a&&(this.Jg=a,this.g("nodeTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Ud())}},groupTemplate:{get:function(){return this.Xi.I("")},set:function(a){var b=this.Xi.I("");b!==a&&(this.Xi.add("",a),this.g("groupTemplate",b,a),this.undoManager.isUndoingRedoing||this.Ud())}},groupTemplateMap:{
get:function(){return this.Xi},set:function(a){var b=this.Xi;b!==a&&(this.Xi=a,this.g("groupTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Ud())}},linkTemplate:{get:function(){return this.Jh.I("")},set:function(a){var b=this.Jh.I("");b!==a&&(this.Jh.add("",a),this.g("linkTemplate",b,a),this.undoManager.isUndoingRedoing||this.Ud())}},linkTemplateMap:{get:function(){return this.Jh},set:function(a){var b=this.Jh;b!==
a&&(this.Jh=a,this.g("linkTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Ud())}},isMouseCaptured:{get:function(){return this.ow},set:function(a){var b=this.xa;null!==b&&(b=b.La,b instanceof SVGElement||(a?(this.lastInput.bubbles=!1,this.removeEventListener(b,"pointermove",this.ck,!1),this.removeEventListener(b,"pointerdown",this.ti,!1),this.removeEventListener(b,"pointerup",this.ek,!1),this.removeEventListener(b,"pointerout",this.dk,!1),this.removeEventListener(b,
"pointercancel",this.bk,!1),this.addEventListener(x,"pointermove",this.ck,!0),this.addEventListener(x,"pointerdown",this.ti,!0),this.addEventListener(x,"pointerup",this.ek,!0),this.addEventListener(x,"pointerout",this.dk,!0),this.addEventListener(x,"pointercancel",this.bk,!0),this.removeEventListener(b,"wheel",this.Zj,!1),this.addEventListener(x,"wheel",this.Zj,!0),this.addEventListener(x,"selectstart",this.preventDefault,!1)):(this.removeEventListener(x,"pointermove",this.ck,!0),this.removeEventListener(x,
"pointerdown",this.ti,!0),this.removeEventListener(x,"pointerup",this.ek,!0),this.removeEventListener(x,"pointerout",this.dk,!0),this.removeEventListener(x,"pointercancel",this.bk,!0),this.addEventListener(b,"pointermove",this.ck,!1),this.addEventListener(b,"pointerdown",this.ti,!1),this.addEventListener(b,"pointerup",this.ek,!1),this.addEventListener(b,"pointerout",this.dk,!1),this.addEventListener(b,"pointercancel",this.bk,!1),this.removeEventListener(x,"wheel",this.Zj,!0),this.removeEventListener(x,
"selectstart",this.preventDefault,!1),this.addEventListener(b,"wheel",this.Zj,!1)),this.ow=a))}},position:{get:function(){return this.pa},set:function(a){var b=J.alloc().assign(this.pa);if(!b.C(a)){var c=this.viewportBounds.copy();this.pa.assign(a);Mh(this.animationManager,b,this.pa);this.xb||null===this.xa&&!this.vo.w()?Ni(this):(this.xb=!0,a=this.scale,hj(this,this.Pp,this.Ca/a,this.Ba/a,this.xk,!1),this.xb=!1);if(!this.xb)this.onViewportBoundsChanged(c,this.viewportBounds,
this.Aa,!1)}J.free(b)}},initialPosition:{get:function(){return this.wt},set:function(a){this.wt.C(a)||(this.wt=a.J())}},initialScale:{get:function(){return this.xt},set:function(a){this.xt!==a&&(this.xt=a)}},grid:{get:function(){null===this.de&&(this.de=cj(this));return this.de},set:function(a){var b=this.de;if(b!==a){null===b&&(b=this.de=cj(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.de=a;a.name="GRID";null!==c&&c.add(a);qj(this);this.N();this.g("grid",b,a)}}},viewportBounds:{get:function(){return this.Pw}},viewSize:{get:function(){return this.vo},set:function(a){var b=this.viewSize;b.C(a)||(this.vo=a=a.J(),this.Ba=this.Ca=0,a.w()?(this.Ca=a.width,this.Ba=a.height):null!==this.Ka&&(this.Ca=this.Ka.clientWidth||1,this.Ba=this.Ka.clientHeight||1),Ni(this),this.Ya(),this.g("viewSize",
b,a),this.redraw())}},fixedBounds:{get:function(){return this.rt},set:function(a){var b=this.rt;b.C(a)||(-Infinity!==a.width&&Infinity!==a.height&&-Infinity!==a.height||C("fixedBounds width/height must not be Infinity"),this.rt=a=a.J(),this.Ya(),this.g("fixedBounds",b,a))}},scrollMargin:{get:function(){return this.rj},set:function(a){"number"===typeof a&&(a=new hc(a));var b=this.rj;b.C(a)||(this.rj=a=a.J(),this.g("scrollMargin",b,a),this.Zl())}},
scrollMode:{get:function(){return this.sj},set:function(a){var b=this.sj;b!==a&&(this.sj=a,a===Rh&&fj(this,!1),this.g("scrollMode",b,a),this.De=!0,this.N())}},scrollsPageOnFocus:{get:function(){return this.mu},set:function(a){var b=this.mu;b!==a&&(this.mu=a,this.g("scrollsPageOnFocus",b,a))}},positionComputation:{get:function(){return this.Yt},set:function(a){var b=this.Yt;b!==a&&(this.Yt=a,fj(this,!1),this.g("positionComputation",
b,a))}},scaleComputation:{get:function(){return this.eu},set:function(a){var b=this.eu;b!==a&&(this.eu=a,Yj(this,this.scale,this.scale),this.g("scaleComputation",b,a))}},documentBounds:{get:function(){return this.Pp}},isVirtualized:{get:function(){return this.Ft},set:function(a){var b=this.Ft;b!==a&&(this.Ft=a,this.g("isVirtualized",b,a))}},scale:{get:function(){return this.Aa},
set:function(a){var b=this.Aa;b!==a&&Yj(this,b,a)}},defaultScale:{get:function(){return this.Mp},set:function(a){this.Mp=a}},autoScale:{get:function(){return this.wh},set:function(a){var b=this.wh;b!==a&&(this.wh=a,this.g("autoScale",b,a),a!==qh&&fj(this,!1))}},initialAutoScale:{get:function(){return this.Eg},set:function(a){var b=this.Eg;b!==a&&(this.Eg=a,this.g("initialAutoScale",b,a))}},initialViewportSpot:{
get:function(){return this.yt},set:function(a){var b=this.yt;b!==a&&(a.vb()||C("initialViewportSpot must be a specific Spot: "+a),this.yt=a,this.g("initialViewportSpot",b,a))}},initialDocumentSpot:{get:function(){return this.vt},set:function(a){var b=this.vt;b!==a&&(a.vb()||C("initialViewportSpot must be a specific Spot: "+a),this.vt=a,this.g("initialDocumentSpot",b,a))}},minScale:{get:function(){return this.Nt},set:function(a){var b=
this.Nt;b!==a&&(0<a?(this.Nt=a,this.g("minScale",b,a),a>this.scale&&(this.scale=a)):xa(a,"> 0",Q,"minScale"))}},maxScale:{get:function(){return this.Jt},set:function(a){var b=this.Jt;b!==a&&(0<a?(this.Jt=a,this.g("maxScale",b,a),a<this.scale&&(this.scale=a)):xa(a,"> 0",Q,"maxScale"))}},zoomPoint:{get:function(){return this.yu},set:function(a){this.yu.C(a)||(this.yu=a=a.J())}},contentAlignment:{get:function(){return this.xk},
set:function(a){var b=this.xk;b.C(a)||(this.xk=a=a.J(),this.g("contentAlignment",b,a),fj(this,!1))}},initialContentAlignment:{get:function(){return this.lq},set:function(a){var b=this.lq;b.C(a)||(this.lq=a=a.J(),this.g("initialContentAlignment",b,a))}},padding:{get:function(){return this.Ab},set:function(a){"number"===typeof a&&(a=new hc(a));var b=this.Ab;b.C(a)||(this.Ab=a=a.J(),this.Ya(),this.g("padding",b,a))}},partManager:{
get:function(){return this.Oc},set:function(a){var b=this.Oc;b!==a&&(null!==a.diagram&&C("Cannot share PartManagers between Diagrams: "+a.toString()),b&&b.We(null),this.Oc=a,a.We(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.Qc},set:function(a){var b=this.Qc;b!==a&&(this.Qc=a,a.diagram=this,a.group=null,this.vh=!0,this.g("layout",b,a),this.Yb())}},isTreePathToChildren:{get:function(){return this.Et},set:function(a){var b=this.Et;if(b!==a&&(this.Et=a,this.g("isTreePathToChildren",b,a),!this.undoManager.isUndoingRedoing))for(a=this.nodes;a.next();)Hk(a.value)}},treeCollapsePolicy:{get:function(){return this.tu},set:function(a){var b=
this.tu;b!==a&&(a!==Fi&&a!==Ik&&a!==Jk&&C("Unknown Diagram.treeCollapsePolicy: "+a),this.tu=a,this.g("treeCollapsePolicy",b,a))}},Te:{get:function(){return this.nw},set:function(a){this.nw=a}},avoidanceCellSize:{get:function(){return this.Zv},set:function(a){this.Wh=null;this.Zv=new L(Math.max(1,a.width),Math.max(1,a.height))}},avoidanceLimit:{get:function(){return this.$v},set:function(a){this.$v=Math.max(1,
a)}},autoScrollInterval:{get:function(){return this.rp},set:function(a){var b=this.rp;b!==a&&(this.rp=a,this.g("autoScrollInterval",b,a))}},autoScrollRegion:{get:function(){return this.tp},set:function(a){"number"===typeof a&&(a=new hc(a));var b=this.tp;b.C(a)||(this.tp=a=a.J(),this.Ya(),this.g("autoScrollRegion",b,a))}}});
ma.Object.defineProperties(Q,{licenseKey:{get:function(){return Kk.hc()},set:function(a){Kk.add(a.replace(/\s/g,""))}},version:{get:function(){return Lk}}});Q.prototype.makeImageData=Q.prototype.Kx;Q.prototype.makeImage=Q.prototype.Wz;Q.prototype.cacheGroupExternalLinks=Q.prototype.Du;Q.prototype.addRenderer=Q.prototype.Xr;Q.prototype.makeSVG=Q.prototype.av;Q.prototype.makeSvg=Q.prototype.zs;Q.prototype.stopAutoScroll=Q.prototype.tg;
Q.prototype.doAutoScroll=Q.prototype.ds;Q.prototype.isUnoccupied=Q.prototype.Xj;Q.prototype.raiseDiagramEvent=Q.prototype.R;Q.prototype.removeDiagramListener=Q.prototype.$l;Q.prototype.addDiagramListener=Q.prototype.Bj;Q.prototype.findTreeRoots=Q.prototype.zz;Q.prototype.layoutDiagram=Q.prototype.Uz;Q.prototype.findTopLevelGroups=Q.prototype.rz;Q.prototype.findTopLevelNodesAndLinks=Q.prototype.sz;Q.prototype.ensureBounds=Q.prototype.Va;Q.prototype.findLinksByExample=Q.prototype.hs;
Q.prototype.findNodesByExample=Q.prototype.js;Q.prototype.findLinkForData=Q.prototype.Jc;Q.prototype.findNodeForData=Q.prototype.hi;Q.prototype.findPartForData=Q.prototype.Kc;Q.prototype.findLinkForKey=Q.prototype.findLinkForKey;Q.prototype.findNodeForKey=Q.prototype.Tb;Q.prototype.findPartForKey=Q.prototype.findPartForKey;Q.prototype.rebuildParts=Q.prototype.Ud;Q.prototype.transformViewToDoc=Q.prototype.Ms;Q.prototype.transformRectDocToView=Q.prototype.yA;Q.prototype.transformDocToView=Q.prototype.lp;
Q.prototype.centerRect=Q.prototype.$r;Q.prototype.scrollToRect=Q.prototype.tv;Q.prototype.scroll=Q.prototype.scroll;Q.prototype.highlightCollection=Q.prototype.Kz;Q.prototype.highlight=Q.prototype.Jz;Q.prototype.selectCollection=Q.prototype.qA;Q.prototype.select=Q.prototype.select;Q.prototype.updateAllRelationshipsFromData=Q.prototype.op;Q.prototype.updateAllTargetBindings=Q.prototype.updateAllTargetBindings;Q.prototype.commit=Q.prototype.commit;Q.prototype.rollbackTransaction=Q.prototype.Kf;
Q.prototype.commitTransaction=Q.prototype.eb;Q.prototype.startTransaction=Q.prototype.Ea;Q.prototype.raiseChanged=Q.prototype.g;Q.prototype.raiseChangedEvent=Q.prototype.cb;Q.prototype.removeChangedListener=Q.prototype.gk;Q.prototype.addChangedListener=Q.prototype.Oe;Q.prototype.removeModelChangedListener=Q.prototype.lA;Q.prototype.addModelChangedListener=Q.prototype.Ww;Q.prototype.findLayer=Q.prototype.Qj;Q.prototype.removeLayer=Q.prototype.jA;Q.prototype.addLayerAfter=Q.prototype.Ey;
Q.prototype.addLayerBefore=Q.prototype.Uw;Q.prototype.addLayer=Q.prototype.yl;Q.prototype.moveParts=Q.prototype.moveParts;Q.prototype.copyParts=Q.prototype.Kj;Q.prototype.removeParts=Q.prototype.Fs;Q.prototype.remove=Q.prototype.remove;Q.prototype.add=Q.prototype.add;Q.prototype.clearDelayedGeometries=Q.prototype.bx;Q.prototype.setProperties=Q.prototype.mm;Q.prototype.attach=Q.prototype.Cu;Q.prototype.set=Q.prototype.set;Q.prototype.resetInputOptions=Q.prototype.Ux;Q.prototype.setInputOption=Q.prototype.rA;
Q.prototype.getInputOption=Q.prototype.Nl;Q.prototype.resetRenderingHints=Q.prototype.Vx;Q.prototype.setRenderingHint=Q.prototype.Zx;Q.prototype.getRenderingHint=Q.prototype.Gf;Q.prototype.maybeUpdate=Q.prototype.Yc;Q.prototype.requestUpdate=Q.prototype.Yb;Q.prototype.delayInitialization=Q.prototype.Yy;Q.prototype.isUpdateRequested=Q.prototype.Pz;Q.prototype.invalidateDocumentBounds=Q.prototype.Ya;Q.prototype.findObjectsNear=Q.prototype.ng;Q.prototype.findPartsNear=Q.prototype.nz;
Q.prototype.findObjectsIn=Q.prototype.Cf;Q.prototype.findPartsIn=Q.prototype.ux;Q.prototype.findObjectsAt=Q.prototype.ii;Q.prototype.findPartsAt=Q.prototype.mz;Q.prototype.findObjectAt=Q.prototype.gc;Q.prototype.findPartAt=Q.prototype.Ll;Q.prototype.focusObject=Q.prototype.Az;Q.prototype.alignDocument=Q.prototype.Ly;Q.prototype.zoomToRect=Q.prototype.AA;Q.prototype.zoomToFit=Q.prototype.zoomToFit;Q.prototype.diagramScroll=Q.prototype.kx;Q.prototype.focus=Q.prototype.focus;
var oi=new ob,Oi=null,Ng=void 0!==x.document,Ji=null,Ki="",qh=new E(Q,"None",0),ij=new E(Q,"Uniform",1),jj=new E(Q,"UniformToFill",2),Df=new E(Q,"CycleAll",10),Hf=new E(Q,"CycleNotDirected",11),Jf=new E(Q,"CycleNotDirectedFast",12),Rf=new E(Q,"CycleNotUndirected",13),Ef=new E(Q,"CycleDestinationTree",14),Gf=new E(Q,"CycleSourceTree",15),Rh=new E(Q,"DocumentScroll",1),Th=new E(Q,"InfiniteScroll",2),Fi=new E(Q,"TreeParentCollapsed",21),Ik=new E(Q,"AllParentsCollapsed",22),Jk=new E(Q,"AnyParentsCollapsed",
23),Kk=new F,Lk="2.3.5",Zi="image",aj=null,mi=!1;
function ni(){if(Ng){var a=x.document.createElement("canvas"),b=a.getContext("2d"),c=Ma("7ca11abfd022028846");b[c]=Ma("398c3597c01238");for(var d=["5da73c80a36455d7038e4972187c3cae51fd22",ra.Dx+"4ae6247590da4bb21c324ba3a84e385776",ld.xF+"fb236cdfda5de14c134ba1a95a2d4c7cc6f93c1387",K.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])ld.prototype.Od=ld.prototype.Zw;
aj=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){Ng=a?void 0!==x.document:!1};Q.isUsingDOM=function(){return Ng};Q.None=qh;Q.Uniform=ij;
Q.UniformToFill=jj;Q.CycleAll=Df;Q.CycleNotDirected=Hf;Q.CycleNotDirectedFast=Jf;Q.CycleNotUndirected=Rf;Q.CycleDestinationTree=Ef;Q.CycleSourceTree=Gf;Q.DocumentScroll=Rh;Q.InfiniteScroll=Th;Q.TreeParentCollapsed=Fi;Q.AllParentsCollapsed=Ik;Q.AnyParentsCollapsed=Jk;function ui(){this.yy=null;this.j="zz@orderNum";"63ad05bbe23a1786468a4c741b6d2"===this._tk?this.rd=this.j=!0:this.rd=null}
function Aj(a,b){b.jb.setTransform(b.Rb,0,0,b.Rb,0,0);b.jb.xc();if(null===a.rd)a:{b="f";var c=x[Ma("76a715b2f73f148a")][Ma("72ba13b5")];a.rd=!0;if(Ng){var d=Q[Ma("76a115b6ed251eaf4692")];if(d)for(var e=Kk.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.rd=!(-1<h&&h<g),!a.rd))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=b[Ma("73a612b6fb191d")](Ma("2bfa41fdb3784bca12")));0>g&&(g=c[Ma("73a612b6fb191d")](Ma("7baa19a6f76c1988428554")));a.rd=!(0<=g&&g<b[Ma("73a612b6fb191d")](Ma("35"))||
-1===b[Ma("73a612b6fb191d")](Ma("35")));if(!a.rd)break;if(c[Ma("73a612b6fb191d")](Ma("7fb002b6ed25128b4da25b2e"))&&c[Ma("73a612b6fb191d")](Ma("75ba1beee63a1e875799507d"))&&(a.rd=!(-1<c[Ma("73a612b6fb191d")](f)),!a.rd))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.rd=!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.rd=!1;break a}}}else a.rd=null,a.rd=!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.rd=!(0<=c&&c<b[Ma("73a612b6fb191d")](Ma("35")))}}}return 0<a.rd&&a!==a.yy?!0:!1}ui.className="DiagramHelper";function Je(a){this.j=void 0===a?new J:a;this.m=new J}
ma.Object.defineProperties(Je.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 Yi="DraggingInfo";Je.className="DraggingInfo";function Rj(a,b,c){this.node=a;this.info=b;this.Su=c}Rj.className="DraggingNodeInfoPair";function Be(){this.reset()}
Be.prototype.reset=function(){this.isGridSnapEnabled=!1;this.isGridSnapRealtime=!0;this.gridSnapCellSize=(new L(NaN,NaN)).freeze();this.gridSnapCellSpot=sc;this.gridSnapOrigin=(new J(NaN,NaN)).freeze();this.groupsSnapMembers=this.dragsTree=this.dragsLink=!1;this.dragsMembers=this.groupsAlwaysMove=!0};Be.className="DraggingOptions";function Mk(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;Nk(c);b&&c.mm(b);return c}la(Mk,Q);
function Nk(a){a.allowDragOut=!0;a.allowMove=!1;a.isReadOnly=!0;a.contentAlignment=tc;a.layout=new Ok}Mk.prototype.reset=function(){Q.prototype.reset.call(this);Nk(this)};Mk.className="Palette";
function Gk(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.xb=!0;c.V=null;c.ln=!1;c.mn=!1;c.F=!0;c.u=!0;c.ga=0;c.m=!1;c.ol=null;c.Zx("drawShadows",!1);a=new U;var e=new Bf;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 hc(0,0,0,0);c.pa.h(0,0);c.toolManager.gb("Dragging",new Pk,c.toolManager.mouseMoveTools);c.click=function(){var a=d.observed;if(null!==a){var b=a.viewportBounds,c=d.lastInput.documentPoint;a.position=new J(c.x-b.width/2,c.y-b.height/2)}};c.Pf=function(){d.Ya();Qk(d)};c.Vd=function(){null!==d.observed&&(d.Ya(),d.N())};c.Ha=function(){1>d.updateDelay?d.N():d.m||(d.m=!0,setTimeout(function(){return d.redraw()},
d.updateDelay))};c.Of=function(){null!==d.observed&&Qk(d)};c.autoScale=ij;c.xb=!1;b&&Object.assign(c,b);return c}la(Gk,Q);Gk.prototype.computePixelRatio=function(){return 1};
Gk.prototype.redraw=function(){if(this.m&&1<=this.updateDelay){this.m=!1;var a=this.xa,b=this.jb;if(null!==a&&null!==b){xj(this);if(null===this.ol){var c=new Pi(null);c.width=a.width;c.height=a.height;this.ol=c}try{this.xa=this.ol,this.jb=this.xa.context,this.jb.Sc(!0),this.jb.setTransform(1,0,0,1,0,0),this.jb.clearRect(0,0,this.xa.width,this.xa.height),Rk(this)}finally{this.xa=a,this.jb=b}}}Q.prototype.redraw.call(this)};
Gk.prototype.ec=function(){null===this.Ka&&C("No div specified");null===this.xa&&C("No canvas specified");if(!(this.xa instanceof Fj)&&(fi(this.box),this.Ec)){var a=this.observed;if(null!==a&&!a.animationManager.defaultAnimation.isAnimating&&a.oi){xj(this);var b=this.xa;a=this.jb;a.Sc(!0);a.setTransform(1,0,0,1,0,0);a.clearRect(0,0,b.width,b.height);1>this.updateDelay?Rk(this):null!==this.ol&&(a.drawImage(this.ol.La,0,0),b=this.Cb,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.Rb,this.Rb),a.transform(b.m11,b.m12,b.m21,b.m22,b.dx,b.dy),a.xc());b=this.Wa.s;for(var c=b.length,d=0;d<c;d++)b[d].ec(a,this);this.Ec=this.td=!1}}};
function Rk(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=N.alloc().assign(a.viewportBounds).ad(b.viewportBounds),qj(b,e),N.free(e),lh(b));var f=a.Cb;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.jb;e.scale(a.Rb,a.Rb);e.transform(f.m11,f.m12,f.m21,f.m22,f.dx,f.dy);e.xc();b=b.Wa.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=gi(h,e),l.ec(e,k),e.globalAlpha=h);else{for(var m=gi(h,e),n=k.scale,p=N.alloc(),r=h.Pa.s,q=r.length,u=0;u<q;u++){var w=r[u];(d||w!==l)&&h.Oj(e,w,k,null,n,p,!1)}N.free(p);e.globalAlpha=m}}}}}
function Qk(a){var b=a.box;if(null!==b){var c=a.observed;if(null!==c){a.Ec=!0;c=c.viewportBounds;var d=b.selectionObject,e=L.alloc();e.h(c.width,c.height);d.desiredSize=e;L.free(e);a=2/a.scale;d instanceof Bf&&(d.strokeWidth=a);b.location=new J(c.x-a/2,c.y-a/2);b.isSelected=!0}}}Gk.prototype.computeBounds=function(){var a=this.observed;if(null===a)return bc;var b=a.documentBounds.copy();b.ad(a.viewportBounds);return b};Gk.prototype.invalidateViewport=function(){!0!==this.Ec&&(this.Ec=!0,this.Yb())};
Gk.prototype.onViewportBoundsChanged=function(a,b,c,d){this.xb||(this.td=!0,this.N(),this.De=!0,this.Ya(),Qk(this),this.md.scale=c,this.md.position.x=a.x,this.md.position.y=a.y,this.md.bounds.assign(a),this.md.Hx=d,this.R("ViewportBoundsChanged",this.md,a))};
ma.Object.defineProperties(Gk.prototype,{observed:{get:function(){return this.V},set:function(a){var b=this.V;a instanceof Gk&&C("Overview.observed Diagram may not be an Overview itself: "+a);if(b!==a){null!==b&&(this.remove(this.box),b.$l("ViewportBoundsChanged",this.Pf),b.$l("DocumentBoundsChanged",this.Vd),b.$l("InvalidateDraw",this.Ha),b.$l("AnimationFinished",this.Of));this.V=a;null!==a&&(a.Bj("ViewportBoundsChanged",this.Pf),a.Bj("DocumentBoundsChanged",this.Vd),
a.Bj("InvalidateDraw",this.Ha),a.Bj("AnimationFinished",this.Of),this.add(this.box));this.Ya();if(null===a){this.ol=null;var c=this.xa,d=this.jb;c&&d&&(d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,c.width,c.height))}else this.Ha(null),Qk(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),Qk(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)}}});Gk.className="Overview";function Pk(){Ae.call(this);this.j=null}la(Pk,Ae);
Pk.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 J(c.width/2,c.height/2),a=a.firstInput.documentPoint,b.position=new J(a.x-this.j.x,a.y-this.j.y));return!0};
Pk.prototype.doActivate=function(){this.j=null;Ae.prototype.doActivate.call(this)};Pk.prototype.doUpdateCursor=function(){var a=this.diagram,b=a.box;null!==b&&b.cursor&&(a.currentCursor=b.cursor)};Pk.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 J(d.x-c.x,d.y-c.y)}a=a.lastInput.documentPoint;b.position=new J(a.x-this.j.x,a.y-this.j.y)}}};Pk.className="OverviewDraggingTool";
function Sk(){Qa(this);this.H=ke;this.Ha=this.u=this.m=!0;this.F=this.V=this.ob=this.ga=!1;this.ij=this.j=null;this.Hb=1.05;this.Gt=NaN;this.qw=null;this.zu=NaN;this.xu=bc;this.hb=!0;this.bg=null;this.pb=200}Sk.prototype.toString=function(){return"CommandHandler"};Sk.prototype.We=function(a){this.H=a};
Sk.prototype.doKeyDown=function(){var a=this.diagram,b=a.lastInput,c=Oa?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()};
Sk.prototype.doKeyUp=function(){this.diagram.lastInput.bubbles=!0};Sk.prototype.stopCommand=function(){var a=this.diagram,b=a.currentTool;b instanceof La&&a.allowSelect&&a.clearSelection();null!==b&&b.doCancel()};Sk.prototype.canStopCommand=function(){return!0};
Sk.prototype.selectAll=function(){var a=this.diagram;a.N();try{a.currentCursor="wait";a.R("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.R("ChangedSelection",a.selection),a.currentCursor=""}};Sk.prototype.canSelectAll=function(){return this.diagram.allowSelect};
Sk.prototype.deleteSelection=function(){var a=this.diagram;try{a.currentCursor="wait";a.R("ChangingSelection",a.selection);a.Ea("Delete");a.R("SelectionDeleting",a.selection);for(var b=new H,c=a.selection.iterator;c.next();)Tk(b,c.value,!0,this.deletesTree?Infinity:0,this.deletesConnectedLinks?null:!1,function(a){return a.canDelete()});a.Fs(b,!0);a.R("SelectionDeleted",b)}finally{a.eb("Delete"),a.R("ChangedSelection",a.selection),a.currentCursor=""}};
Sk.prototype.canDeleteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowDelete||0===a.selection.count?!1:!0};Sk.prototype.copySelection=function(){var a=this.diagram,b=new H;for(a=a.selection.iterator;a.next();)Tk(b,a.value,!0,this.copiesTree?Infinity:0,this.copiesConnectedLinks,function(a){return a.canCopy()});this.copyToClipboard(b)};Sk.prototype.canCopySelection=function(){var a=this.diagram;return a.allowCopy&&a.allowClipboard&&0!==a.selection.count?!0:!1};
Sk.prototype.cutSelection=function(){this.copySelection();this.deleteSelection()};Sk.prototype.canCutSelection=function(){var a=this.diagram;return!a.isReadOnly&&!a.isModelReadOnly&&a.allowCopy&&a.allowDelete&&a.allowClipboard&&0!==a.selection.count?!0:!1};
Sk.prototype.copyToClipboard=function(a){var b=this.diagram,c=null;if(null===a)Ji=null,Ki="";else{c=b.model;var d=!1,e=!1,f=null;try{c.Rl()&&(d=c.Jj,c.Jj=this.copiesParentKey),c.Vj()&&(e=c.Ij,c.Ij=this.copiesGroupKey),f=b.Kj(a,null,!0)}finally{c.Rl()&&(c.Jj=d),c.Vj()&&(c.Ij=e),c=new F,c.addAll(f),Ji=c,Ki=b.model.dataFormat}}b.R("ClipboardChanged",c)};
Sk.prototype.pasteFromClipboard=function(){var a=new H,b=Ji;if(null===b)return a;var c=this.diagram;if(Ki!==c.model.dataFormat)return a;var d=c.model,e=!1,f=!1,g=null;try{d.Rl()&&(e=d.Jj,d.Jj=this.copiesParentKey),d.Vj()&&(f=d.Ij,d.Ij=this.copiesGroupKey),g=c.Kj(b,c,!1)}finally{for(d.Rl()&&(d.Jj=e),d.Vj()&&(d.Ij=f),b=g.iterator;b.next();)c=b.value,d=b.key,c.location.w()||(d.location.w()?c.location=d.location:!c.position.w()&&d.position.w()&&(c.position=d.position)),a.add(c)}return a};
Sk.prototype.pasteSelection=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.currentCursor="wait";b.R("ChangingSelection",b.selection);b.Ea("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.w()){var f=this.computeEffectiveCollection(b.selection,b.Vm);df(b,f,new J(a.x-e.centerX,a.y-e.centerY),b.Vm,!1)}}b.R("ClipboardPasted",c)}finally{b.eb("Paste"),b.R("ChangedSelection",
b.selection),b.currentCursor=""}};Sk.prototype.canPasteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowClipboard||null===Ji||0===Ji.count||Ki!==a.model.dataFormat?!1:!0};Sk.prototype.undo=function(){this.diagram.undoManager.undo()};Sk.prototype.canUndo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canUndo()};Sk.prototype.redo=function(){this.diagram.undoManager.redo()};
Sk.prototype.canRedo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canRedo()};Sk.prototype.decreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);var b=this.diagram;b.autoScale===qh&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};Sk.prototype.canDecreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);var b=this.diagram;if(b.autoScale!==qh)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};
Sk.prototype.increaseZoom=function(a){void 0===a&&(a=this.zoomFactor);var b=this.diagram;b.autoScale===qh&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};Sk.prototype.canIncreaseZoom=function(a){void 0===a&&(a=this.zoomFactor);var b=this.diagram;if(b.autoScale!==qh)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};Sk.prototype.resetZoom=function(a){void 0===a&&(a=this.defaultScale);var b=this.diagram;a<b.minScale||a>b.maxScale||(b.scale=a)};
Sk.prototype.canResetZoom=function(a){void 0===a&&(a=this.defaultScale);var b=this.diagram;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};
Sk.prototype.zoomToFit=function(){var a=this.diagram,b=a.animationManager;b.Bc();a.redraw();var c=a.position,d=a.scale;kh(b,"Zoom To Fit");this.isZoomToFitRestoreEnabled&&d===this.zu&&!isNaN(this.Gt)&&a.documentBounds.C(this.xu)?(a.scale=this.Gt,a.position=this.qw,this.zu=NaN,this.xu=bc):(this.Gt=d,this.qw=c.copy(),a.zoomToFit(),this.zu=a.scale,this.xu=a.documentBounds.copy());mh(b)};Sk.prototype.canZoomToFit=function(){return this.diagram.allowZoom};
Sk.prototype.scrollToPart=function(a){void 0===a&&(a=null);var b=this.diagram;b.Va();if(null===a){try{null!==this.bg&&(this.bg.next()?a=this.bg.value:this.bg=null)}catch(k){this.bg=null}null===a&&(0<b.highlighteds.count?this.bg=b.highlighteds.iterator:0<b.selection.count&&(this.bg=b.selection.iterator),null!==this.bg&&this.bg.next()&&(a=this.bg.value))}if(null!==a){var c=b.animationManager;kh(c,"Scroll To Part");var d=this.scrollToPartPause;if(0<d){var e=Uk(this,a,[a]);if(1===e.length)b.Ea(),b.$r(a.actualBounds),
b.eb("Scroll To Part");else{var f=function(){b.Ea();for(var a=e.pop();0<e.length&&a instanceof V&&a.isTreeExpanded&&(!(a instanceof pf)||a.isSubGraphExpanded);)a=e.pop();0<e.length?(a instanceof U&&b.tv(a.actualBounds),a instanceof V&&!a.isTreeExpanded&&(a.isTreeExpanded=!0),a instanceof pf&&!a.isSubGraphExpanded&&(a.isSubGraphExpanded=!0)):(a instanceof U&&b.$r(a.actualBounds),b.$l("LayoutCompleted",g));b.eb("Scroll To Part")},g=function(){ta(f,(c.isEnabled?c.duration:0)+d)};b.Bj("LayoutCompleted",
g);f()}}else{var h=b.position.copy();b.$r(a.actualBounds);h.Xa(b.position)&&c.Bc()}}};
function Uk(a,b,c){if(b.isVisible())return c;if(b instanceof te)Uk(a,b.adornedPart,c);else if(b instanceof T){var d=b.fromNode;null!==d&&Uk(a,d,c);b=b.toNode;null!==b&&Uk(a,b,c)}else b instanceof V&&(d=b.labeledLink,null!==d&&Uk(a,d,c),d=b.og(),null!==d&&(d.isTreeExpanded||d.wasTreeExpanded||c.push(d),Uk(a,d,c))),b=b.containingGroup,null!==b&&(b.isSubGraphExpanded||b.wasSubGraphExpanded||c.push(b),Uk(a,b,c));return c}
Sk.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};
Sk.prototype.collapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Ea("Collapse Tree");kh(b.animationManager,"Collapse Tree");var c=new F;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.R("TreeCollapsed",c)}finally{b.eb("Collapse Tree")}};
Sk.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.No().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof V&&b.isTreeExpanded&&0<b.No().count)return!0;return!1};
Sk.prototype.expandTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Ea("Expand Tree");kh(b.animationManager,"Expand Tree");var c=new F;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.R("TreeExpanded",c)}finally{b.eb("Expand Tree")}};
Sk.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.No().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof V&&!b.isTreeExpanded&&0<b.No().count)return!0;return!1};
Sk.prototype.groupSelection=function(){var a=this.diagram,b=a.model;if(b.Wj()){var c=this.archetypeGroupData;if(null!==c){var d=null;try{a.currentCursor="wait";a.R("ChangingSelection",a.selection);a.Ea("Group");for(var e=new F,f=a.selection.iterator;f.next();){var g=f.value;g.Wc()&&g.canGroup()&&e.add(g)}for(var h=new F,k=e.iterator;k.next();){var l=k.value;f=!1;for(var m=e.iterator;m.next();)if(l.Pd(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.Pd(n)){e=!0;break}if(e)n=n.containingGroup;else break}if(c instanceof pf)jg(c),d=c.copy(),null!==d&&a.add(d);else if(b.Yu(c)){var r=b.copyNodeData(c);za(r)&&(b.xf(r),d=a.hi(r))}if(null!==d){null!==n&&this.isValidMember(n,d)&&(d.containingGroup=n);for(var q=h.iterator;q.next();){var u=q.value;this.isValidMember(d,u)&&(u.containingGroup=d)}a.clearSelection(!0);d.isSelected=!0}}a.R("SelectionGrouped",d)}finally{a.eb("Group"),a.R("ChangedSelection",
a.selection),a.currentCursor=""}}}};Sk.prototype.canGroupSelection=function(){var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowGroup||!a.model.Wj()||null===this.archetypeGroupData)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.Wc()&&b.canGroup())return!0}return!1};
function Vk(a){var b=Ea();for(a=a.iterator;a.next();){var c=a.value;c instanceof T||b.push(c)}a=new H;c=b.length;for(var d=0;d<c;d++){for(var e=b[d],f=!0,g=0;g<c;g++)if(e.Pd(b[g])){f=!1;break}f&&a.add(e)}Ga(b);return a}
Sk.prototype.isValidMember=function(a,b){if(null===b||a===b||b instanceof T)return!1;if(null!==a){if(a===b||a.Pd(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};
Sk.prototype.ungroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.model;if(c.Wj())try{b.currentCursor="wait";b.R("ChangingSelection",b.selection);b.Ea("Ungroup");var d=new F;if(null!==a)d.add(a);else for(var e=b.selection.iterator;e.next();){var f=e.value;f instanceof pf&&f.canUngroup()&&d.add(f)}var g=new F;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.va(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.jp(r,m):p.containingGroup=l}}b.remove(k)}}b.R("SelectionUngrouped",d,g)}finally{b.eb("Ungroup"),b.R("ChangedSelection",b.selection),b.currentCursor=""}};
Sk.prototype.canUngroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly||b.isModelReadOnly||!b.allowDelete||!b.allowUngroup||!b.model.Wj())return!1;if(null!==a){if(!(a instanceof pf))return!1;if(a.canUngroup())return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof pf&&b.canUngroup())return!0;return!1};
Sk.prototype.addTopLevelParts=function(a,b){var c=!0;for(a=Vk(a).iterator;a.next();){var d=a.value;null!==d.containingGroup&&(!b||this.isValidMember(null,d)?d.containingGroup=null:c=!1)}return c};
Sk.prototype.collapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Ea("Collapse SubGraph");kh(b.animationManager,"Collapse SubGraph");var c=new F;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 pf&&e.isSubGraphExpanded&&(e.collapseSubGraph(),c.add(e))}b.R("SubGraphCollapsed",c)}finally{b.eb("Collapse SubGraph")}};
Sk.prototype.canCollapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof pf&&a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof pf&&b.isSubGraphExpanded)return!0;return!1};
Sk.prototype.expandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Ea("Expand SubGraph");kh(b.animationManager,"Expand SubGraph");var c=new F;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 pf&&!e.isSubGraphExpanded&&(e.expandSubGraph(),c.add(e))}b.R("SubGraphExpanded",c)}finally{b.eb("Expand SubGraph")}};
Sk.prototype.canExpandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof pf&&!a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof pf&&!b.isSubGraphExpanded)return!0;return!1};
Sk.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.Kl(function(a){return a instanceof Pg&&a.editable})}null!==a&&(b.currentTool=null,c.textBlock=a,b.currentTool=c)}};
Sk.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 Pg))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.Kl(function(a){return a instanceof Pg&&a.editable}),null!==a))return!0;return!1};
Sk.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.ka(xc):b.viewportBounds.ca(d.documentPoint)||(e=b.viewportBounds,e=new J(e.x+e.width/2,e.y+e.height/2));null!==e&&(d.viewPoint=b.lp(e),d.documentPoint=e,d.left=!1,d.right=!0,d.up=!0);b.currentTool=c;Lg(c,!1,a)}};
Sk.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};
Sk.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.Vm);d=new ob;if(null===a)return d;for(var f=a.iterator;f.next();)Pj(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(Sk.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.Ha},set:function(a){this.Ha=a}},copiesTree:{get:function(){return this.ga},
set:function(a){this.ga=a}},deletesTree:{get:function(){return this.ob},set:function(a){this.ob=a}},copiesParentKey:{get:function(){return this.V},set:function(a){this.V=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.ij},
set:function(a){this.ij=a}},defaultScale:{get:function(){return this.diagram.defaultScale},set:function(a){this.diagram.defaultScale=a}},zoomFactor:{get:function(){return this.Hb},set:function(a){1<a||C("zoomFactor must be larger than 1.0, not: "+a);this.Hb=a}},isZoomToFitRestoreEnabled:{get:function(){return this.hb},set:function(a){this.hb=a}},scrollToPartPause:{get:function(){return this.pb},
set:function(a){this.pb=a}}});Sk.className="CommandHandler";Ii=function(){return new Sk};
function Y(){Qa(this);this.o=30723;this.qb=1;this.an="";this.Oa=this.Le=null;this.pa=(new J(NaN,NaN)).freeze();this.dd=Lb;this.Cb=new ld;this.uh=new ld;this.Lb=null;this.Aa=this.Ik=1;this.Kb=0;this.Ig=pc;this.tc=(new N(NaN,NaN,NaN,NaN)).freeze();this.Ib=(new N(NaN,NaN,NaN,NaN)).freeze();this.cc=(new N(0,0,NaN,NaN)).freeze();this.ba=this.Xn=this.Yn=null;this.qk=this.Jb=Sc;this.zg=this.ho=0;this.V=this.ib=this.Bh=this.A=this.Ua=null;this.rf=!1;this.io=this.Lg=null}var nd,kg,mg,Wk,Xk,Yk,Zk,$k,al,bl;
Y.prototype.cloneProtected=function(a){a.o=this.o|6144;a.qb=this.qb;a.an=this.an;a.Oa=this.Oa;a.pa.assign(this.pa);a.dd=this.dd.J();null!==this.Lb?a.Lb=this.Lb.copy():a.Lb=null;a.Aa=this.Aa;a.Kb=this.Kb;a.Ig=this.Ig.J();a.tc.assign(this.tc);a.Ib.assign(this.Ib);a.cc.assign(this.cc);a.Xn=this.Xn;null!==this.ba&&(a.ba=this.ba.copy());a.Jb=this.Jb.J();a.qk=this.qk.J();a.ho=this.ho;a.zg=this.zg;null!==this.Ua&&(a.Ua=this.Ua.copy());null!==this.A&&(a.A=this.A.lc?this.A:this.A.copy());null!==this.Bh&&(a.Bh=
Ba(this.Bh));null!==this.ib&&(a.ib=this.ib.copy())};Y.prototype.Tw=function(a){var b=this.Bh;if(Aa(b))for(var c=0;c<b.length;c++){if(b[c]===a)return}else this.Bh=b=[];b.push(a)};Y.prototype.Af=function(a){a.Yn=null;a.Lg=null;a.v()};Y.prototype.clone=function(){var a=new this.constructor;this.cloneProtected(a);if(null!==this.Bh)for(var b=0;b<this.Bh.length;b++){var c=this.Bh[b];a[c]=this[c]}return a};Y.prototype.copy=function(){return this.clone()};t=Y.prototype;
t.rb=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)+"#"+bb(this)};t.rh=function(){null!==this.A&&(this.A.lc=!0)};function cl(a){null===a.A?a.A=new dl:a.A.lc&&(a.A=a.A.copy())}t.Uc=function(){if(null===this.ba){var a=new el;a.Wi=rc;a.yj=rc;a.Ui=10;a.wj=10;a.Vi=0;a.xj=0;this.ba=a}};
t.cb=function(a,b,c,d,e,f,g){var h=this.part;if(null!==h&&(h.fk(a,b,c,d,e,f,g),c===this&&a===ce&&fl(this)&&gl(this,h,b),f=this.diagram,null===this.animationTriggers||null===f||!f.oi||f.undoManager.isUndoingRedoing||f.animationManager.Cm||(a=this.animationTriggers.get(b),null!==a&&f.animationManager.isEnabled&&!f.animationManager.isTicking&&(null===this.io&&(this.io=new ob),g=0===f.undoManager.transactionLevel,a.startCondition===ai?g=!0:a.startCondition===ci&&(g=!1),g?(f=new jh,bi(a,f),g=this.io.get(a),
null!==g&&g.stop(),this.io.add(a,f),f.uu=this,f.Lw=a,f.add(this,b,d,e),f.start()):(kh(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.O.s,d=c.length,e=0;e<d;e++)h=c[e],h instanceof W&&Hj(h,function(a){null!==a.data&&0!==(a.o&16777216)&&a.Ma(b)})};
function gl(a,b,c){var d=a.gh();if(null!==d)for(var e=a.localBindings.iterator;e.next();){var f=e.value,g=null;if(null!==f.sourceName){g=hl(f,d,a);if(null===g)continue;f.pp(a,g,c,null)}else if(f.isToModel){var h=b.diagram;null===h||h.skipsModelSourceBindings||f.pp(a,h.model.modelData,c,d)}else{h=d.data;if(null===h)continue;var k=b.diagram;null===k||k.skipsModelSourceBindings||f.pp(a,h,c,d)}g===a&&(h=d.gs(f.zi),null!==h&&f.Kv(h,g,c))}}t.gs=function(a){return this.bindingId===a?this:null};
t.g=function(a,b,c){this.cb(ce,a,this,b,c)};t.Fe=function(a,b,c,d){var e=this.tc;e.h(a,b,c,d);if(1!==this.Aa||0!==this.Kb){null===this.Lb&&(this.Lb=new ld);var f=this.Lb;f.reset();this.mo(f,a,b,c,d);f.mp(e)}};function il(a,b,c,d){if(!1===a.pickable)return!1;d.multiply(a.transform);return c?a.Vc(b,d):a.dh(b,d)}
t.tx=function(a,b,c){if(!1===this.pickable)return!1;var d=this.naturalBounds;b=a.Bf(b);return c?yb(a.x,a.y,0,0,0,d.height)<=b||yb(a.x,a.y,0,d.height,d.width,d.height)<=b||yb(a.x,a.y,d.width,d.height,d.width,0)<=b||yb(a.x,a.y,d.width,0,0,0)<=b:a.xd(0,0)<=b&&a.xd(0,d.height)<=b&&a.xd(d.width,0)<=b&&a.xd(d.width,d.height)<=b};t.re=function(){return!0};
t.ca=function(a){var b=J.alloc();b.assign(a);this.transform.Ga(b);var c=this.actualBounds;if(!c.w())return J.free(b),!1;var d=this.diagram;if(null!==d&&d.sq){var e=d.Nl("extraTouchThreshold"),f=d.Nl("extraTouchArea"),g=f/2,h=this.naturalBounds;d=this.Df()*d.scale;var k=1/d;if(h.width*d<e&&h.height*d<e)return a=Zb(c.x-g*k,c.y-g*k,c.width+f*k,c.height+f*k,b.x,b.y),J.free(b),a}e=!1;if(this instanceof te||this instanceof Bf?Zb(c.x-5,c.y-5,c.width+10,c.height+10,b.x,b.y):c.ca(b))this.ib&&!this.ib.ca(b)?
e=!1:null!==this.areaBackground&&c.ca(b)?e=!0:null!==this.Oa&&this.cc.ca(a)?e=!0:e=this.eh(a);J.free(b);return e};t.eh=function(a){var b=this.naturalBounds;return Zb(0,0,b.width,b.height,a.x,a.y)};
t.Qe=function(a){if(0===this.angle)return this.actualBounds.Qe(a);var b=this.naturalBounds;b=N.allocAt(0,0,b.width,b.height);var c=this.transform,d=!1,e=J.allocAt(a.x,a.y);b.ca(c.Od(e))&&(e.h(a.x,a.bottom),b.ca(c.Od(e))&&(e.h(a.right,a.bottom),b.ca(c.Od(e))&&(e.h(a.right,a.y),b.ca(c.Od(e))&&(d=!0))));J.free(e);N.free(b);return d};
t.dh=function(a,b){if(void 0===b)return a.Qe(this.actualBounds);var c=this.naturalBounds,d=!1,e=J.allocAt(0,0);a.ca(b.Ga(e))&&(e.h(0,c.height),a.ca(b.Ga(e))&&(e.h(c.width,c.height),a.ca(b.Ga(e))&&(e.h(c.width,0),a.ca(b.Ga(e))&&(d=!0))));J.free(e);return d};
t.Vc=function(a,b){if(void 0===b&&(b=this.transform,0===this.angle))return a.Vc(this.actualBounds);var c=this.naturalBounds,d=J.allocAt(0,0),e=J.allocAt(0,c.height),f=J.allocAt(c.width,c.height),g=J.allocAt(c.width,0),h=!1;if(a.ca(b.Ga(d))||a.ca(b.Ga(e))||a.ca(b.Ga(f))||a.ca(b.Ga(g)))h=!0;else{c=N.allocAt(0,0,c.width,c.height);var k=J.allocAt(a.x,a.y);c.ca(b.Od(k))?h=!0:(k.h(a.x,a.bottom),c.ca(b.Od(k))?h=!0:(k.h(a.right,a.bottom),c.ca(b.Od(k))?h=!0:(k.h(a.right,a.y),c.ca(b.Od(k))&&(h=!0))));J.free(k);
N.free(c);!h&&(K.rs(a,d,e)||K.rs(a,e,f)||K.rs(a,f,g)||K.rs(a,g,d))&&(h=!0)}J.free(d);J.free(e);J.free(f);J.free(g);return h};t.ka=function(a,b){void 0===b&&(b=new J);if(a instanceof O){var c=this.naturalBounds;b.h(a.x*c.width+a.offsetX,a.y*c.height+a.offsetY)}else b.set(a);this.me.Ga(b);return b};
t.li=function(a){void 0===a&&(a=new N);var b=this.naturalBounds,c=this.me,d=J.allocAt(0,0).transform(c);a.h(d.x,d.y,0,0);d.h(b.width,0).transform(c);Yb(a,d.x,d.y,0,0);d.h(b.width,b.height).transform(c);Yb(a,d.x,d.y,0,0);d.h(0,b.height).transform(c);Yb(a,d.x,d.y,0,0);J.free(d);return a};t.ki=function(){var a=this.me;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.Df=function(){if(0!==(this.o&4096)===!1)return this.Ik;var a=this.Aa;return null!==this.panel?a*this.panel.Df():a};t.ns=function(a,b){void 0===b&&(b=new J);b.assign(a);this.me.Od(b);return b};t.os=function(a,b,c){return this.Sj(a.x,a.y,b.x,b.y,c)};
t.Sj=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,K.Ff(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=K.Ff(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!==uj(this)){var e=this.Ig,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=this.gq();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(jl(this,!0)){case kg:g=e=0;h&&(b=a=Infinity);break;case nd:isFinite(a)&&
a>c&&(e=a);isFinite(b)&&b>d&&(g=b);break;case Wk:isFinite(a)&&a>c&&(e=a);g=0;h&&(b=Infinity);break;case Xk: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.tc.ja();this.Ul(a,b,c,d);this.tc.freeze();this.tc.w()||C("Non-real measuredBounds has been set. Object "+this+", measuredBounds: "+this.tc.toString());pj(this,!1)}};Y.prototype.Ul=function(){};Y.prototype.ne=function(){return!1};
Y.prototype.arrange=function(a,b,c,d,e){this.Sk();var f=N.alloc();f.assign(this.Ib);this.Ib.ja();!1===vj(this)?this.Ib.h(a,b,c,d):this.bh(a,b,c,d);this.Ib.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&&kl(e)&&(e=e.panel),null!==e&&(e=e.cc,d=this.measuredBounds,null!==this.areaBackground&&(d=this.Ib),c=b+d.height,d=a+d.width,c=!(0<=a+.05&&d<=e.width+.05&&0<=b+.05&&c<=e.height+.05),this instanceof Pg&&(a=this.naturalBounds,this.Hq>a.height||this.Eb>
a.width)))c=!0;this.o=c?this.o|256:this.o&-257;this.Ib.w()||C("Non-real actualBounds has been set. Object "+this+", actualBounds: "+this.Ib.toString());this.Vl(f,this.Ib);ll(this,!1);N.free(f)};t=Y.prototype;t.bh=function(){};
function ml(a,b,c,d,e){a.Ib.h(b,c,d,e);if(!a.desiredSize.w()){var f=a.tc;c=a.Ig;b=c.right+c.left;var g=c.top+c.bottom;c=f.width+b;f=f.height+g;d+=b;e+=g;b=jl(a,!0);c===d&&f===e&&(b=kg);switch(b){case kg:if(c>d||f>e)pj(a,!0),a.measure(c>d?d:c,f>e?e:f,0,0);break;case nd:pj(a,!0);a.measure(d,e,0,0);break;case Wk:pj(a,!0);a.measure(d,f,0,0);break;case Xk:pj(a,!0),a.measure(c,e,0,0)}}}
t.Vl=function(a,b){var c=this.part;null!==c&&null!==c.diagram&&(c.selectionObject!==this&&c.resizeObject!==this&&c.rotateObject!==this||nl(c,!0),this.N(),Ub(a,b)||(c.mh(),this.On(c)))};t.On=function(a){null!==this.portId&&(nl(a,!0),a instanceof V&&ol(a,this))};
t.ec=function(a,b){if(!pl(this,a,b)&&this.visible){var c=this.opacity;if(0!==c){var d=1;1!==c&&(d=a.globalAlpha,a.globalAlpha=d*c);var e="";""!==this.filter&&(e=a.filter,a.filter=this.filter);var f=this instanceof W&&kl(this),g=this.Ib;if(f){var h=this.Ib,k=this.cc,l=this.areaBackground,m=this.Oa;null===l&&null===m||a.xc();null!==l&&(ji(this,a,l,!0,!0,k,h),l instanceof ql&&l.type===rl?(a.beginPath(),a.rect(h.x,h.y,h.width,h.height),a.mg(l)):a.fillRect(h.x,h.y,h.width,h.height));null!==m&&(ji(this,
a,m,!0,!1,k,h),m instanceof ql&&m.type===rl?(a.beginPath(),a.rect(h.x,h.y,h.width,h.height),a.mg(m)):a.fillRect(h.x,h.y,h.width,h.height));this.fh(a,b)}if(!f&&(f||0!==g.width&&0!==g.height&&!isNaN(g.x)&&!isNaN(g.y))){f=this.transform;h=this.panel;0!==(this.o&4096)===!0&&sl(this);l=this.part;k=!1;var n=0;l&&b.Gf("drawShadows")&&(k=l.isShadowed)&&(m=l.shadowOffset,n=Math.max(m.y,m.x)*b.scale*b.Rb);m=this.ne();var p;if(!(p=b.Zi||!m)){var r=this.naturalBounds;p=this.uh;var q=p.m11,u=p.m21,w=p.dx,v=p.m12,
y=p.m22,z=p.dy,A,B=A=0;p=A*q+B*u+w;var D=A*v+B*y+z;A=r.width+n;B=0;var M=A*q+B*u+w;A=A*v+B*y+z;B=Math.min(p,M);var S=Math.min(D,A);var R=Math.max(p+0,M)-B;var I=Math.max(D+0,A)-S;p=B;D=S;A=r.width+n;B=r.height+n;M=A*q+B*u+w;A=A*v+B*y+z;B=Math.min(p,M);S=Math.min(D,A);R=Math.max(p+R,M)-B;I=Math.max(D+I,A)-S;p=B;D=S;A=0;B=r.height+n;M=A*q+B*u+w;A=A*v+B*y+z;B=Math.min(p,M);S=Math.min(D,A);R=Math.max(p+R,M)-B;I=Math.max(D+I,A)-S;p=B;D=S;n=b.viewportBounds;r=n.x;q=n.y;p=!(p>n.width+r||r>R+p||D>n.height+
q||q>I+D)}if(p){p=0!==(this.o&256);a.clipInsteadOfFill&&(p=!1);this instanceof Pg&&(a.font=this.font);if(p){D=h.re()?h.naturalBounds:h.actualBounds;null!==this.ib?(r=this.ib,R=r.x,I=r.y,n=r.width,r=r.height):(R=Math.max(g.x,D.x),I=Math.max(g.y,D.y),n=Math.min(g.right,D.right)-R,r=Math.min(g.bottom,D.bottom)-I);if(R>g.width+g.x||g.x>D.width+D.x){1!==c&&(a.globalAlpha=d);""!==this.filter&&(a.filter=e);return}a.save();a.beginPath();a.rect(R,I,n,r);a.clip()}if(m){if(!l.isVisible()){1!==c&&(a.globalAlpha=
d);""!==this.filter&&(a.filter=e);return}k&&(D=l.shadowOffset,a.Cv(D.x*b.scale*this.scale*b.Rb,D.y*b.scale*this.scale*b.Rb,l.shadowBlur),tl(a),a.shadowColor=l.shadowColor)}k&&!0===this.shadowVisible?tl(a):k&&!1===this.shadowVisible&&ul(a);l=this.naturalBounds;null!==this.areaBackground&&(a.xc(),vl(this,a,l,g));a.transform(f.m11,f.m12,f.m21,f.m22,f.dx,f.dy);k&&(null!==h&&0!==(h.o&512)||null!==h&&(h.type===W.Auto||h.type===W.Spot)&&h.sb()!==this)&&null===this.shadowVisible&&ul(a);null!==this.Oa&&(a.xc(),
wl(this,a,l,g));k&&(null!==this.Oa||null!==this.areaBackground||null!==h&&0!==(h.o&512)||null!==h&&(h.type===W.Auto||h.type===W.Spot)&&h.sb()!==this)?(xl(this,!0),null===this.shadowVisible&&ul(a)):xl(this,!1);this.fh(a,b);k&&0!==(this.o&512)===!0&&tl(a);m&&k&&ul(a);p&&(a.restore(),a.Sc(this instanceof W));f.ts()||(b=1/(f.m11*f.m22-f.m12*f.m21),a.transform(f.m22*b,-f.m12*b,-f.m21*b,f.m11*b,b*(f.m21*f.dy-f.m22*f.dx),b*(f.m12*f.dx-f.m11*f.dy)))}}1!==c&&(a.globalAlpha=d);""!==this.filter&&(a.filter=e)}}};
function yl(a,b,c,d){var e=a.part,f=!1;e&&b.Gf("drawShadows")&&(f=e.isShadowed);c.clipInsteadOfFill&&(f=!1);a.ne()&&f&&tl(c);f&&!0===a.shadowVisible?tl(c):f&&!1===a.shadowVisible&&ul(c);e=a.panel;f&&(null!==e&&0!==(e.o&512)||null!==e&&(e.type===W.Auto||e.type===W.Spot)&&e.sb()!==a)&&null===a.shadowVisible&&ul(c);c.Fl&&(b=b.computePixelRatio(),b="drop-shadow("+c.shadowOffsetX/b+"px "+c.shadowOffsetY/b+"px "+c.shadowBlur/b/2+"px "+c.shadowColor+")",null!==a.background&&d.Oa.setAttributeNS(null,"filter",
b),null!==a.areaBackground&&d.pd.setAttributeNS(null,"filter",b));f&&(null!==a.Oa||null!==a.areaBackground||null!==e&&0!==(e.o&512)||null!==e&&(e.type===W.Auto||e.type===W.Spot)&&e.sb()!==a)?(xl(a,!0),null===a.shadowVisible&&ul(c)):xl(a,!1);return f}function zl(a,b,c,d,e){d.Fl&&(c=c.computePixelRatio(),a.Bv(b,"drop-shadow("+d.shadowOffsetX/c+"px "+d.shadowOffsetY/c+"px "+d.shadowBlur/c/2+"px "+d.shadowColor+")"));e&&0!==(a.o&512)===!0&&tl(d);a.ne()&&ul(d)}t.Bv=function(){};
function vl(a,b,c,d){ji(a,b,a.areaBackground,!0,!0,c,d);a.areaBackground instanceof ql&&a.areaBackground.type===rl?(b.beginPath(),b.rect(d.x,d.y,d.width,d.height),b.mg(a.areaBackground)):b.fillRect(d.x,d.y,d.width,d.height)}function wl(a,b,c,d){var e=a.gq(),f=c.x,g=c.y,h=c.width+e,k=c.height+e;ji(a,b,a.Oa,!0,!1,c,d);a.Oa instanceof ql&&a.Oa.type===rl?(b.beginPath(),b.rect(f-e/2,g-e/2,h,k),b.mg(a.Oa)):b.fillRect(f-e/2,g-e/2,h,k)}
function Al(a,b,c){for(var d=b.O.s,e=d.length,f=-1,g=0;g<e;g++)if(d[g]===a){f=g;break}a=f;if(-1!==a)if(0===a)b.svg.pd?b.svg.pd.after(c):b.svg.Oa?b.svg.Oa.after(c):b.type===W.Table?(b=b.svg.getElementsByClassName("gojs-ts"),b=0!==b.length?b[0]:null,null!==b&&(b.innerHTML="",b.after(c))):b.svg.prepend(c);else{for(;0!==a&&!b.L(a-1).Qd();)a--;0===a?b.svg.prepend(c):(a=b.L(a-1).svg,null!==a?a.after(c):b.svg.appendChild(c))}}
function pl(a,b,c){if(!(b instanceof ii))return!1;if(!a.visible||0===a.opacity||a.ne()&&!a.isVisible())return null!==a.svg&&null!==a.svg.parentNode&&a.svg.remove(),!0;if(a.ne()&&a.isShadowed){var d=a.shadowOffset;b.Cv(d.x*c.scale*a.scale*c.Rb,d.y*c.scale*a.scale*c.Rb,a.shadowBlur);tl(b);b.shadowColor=a.shadowColor}d=a.panel;var e=a.lk(b);if(a.ik(b,c,e)){if(null!==a.svg.parentElement)return a.ne()&&(b.si=a.svg),!0;a.ne()?(null!==b.si?b.si.after(a.svg):b.Nj.prepend(a.svg),b.si=a.svg):d&&Al(a,d,a.svg);
return!0}a instanceof Pg&&(b.font=a.font);b.wd=null;var f=a.transform,g=a instanceof W;0!==(a.o&4096)===!0&&sl(a);var h=a.Ib;b.nc.ia=[1,0,0,1,0,0];b.m=!1;e&&(b.m=!0,a instanceof W&&kl(a)?Bl(b,1,0,0,1,0,0):Bl(b,f.m11,f.m12,f.m21,f.m22,f.dx,f.dy),g&&(a.svg=b.Rd));e=a.naturalBounds;if(null!==a.areaBackground){var k=f.copy().Ql();b.nc.ia=[k.m11,k.m12,k.m21,k.m22,k.dx,k.dy];vl(a,b,e,h);b.nc.ia=[1,0,0,1,0,0];b.wd.pd=b.Rd;b.wd.prepend(b.Rd)}g||b.m||(b.nc.ia=[f.m11,f.m12,f.m21,f.m22,f.dx,f.dy]);null!==a.background&&
(a instanceof W&&kl(a)?(b.nc.ia=[f.m11,f.m12,f.m21,f.m22,f.dx,f.dy],wl(a,b,e,h),b.nc.ia=[1,0,0,1,0,0]):wl(a,b,e,h),b.wd.Oa=b.Rd,b.wd.prepend(b.Rd));f=yl(a,c,b,b.wd);a.fh(b,c);g&&b.lh.pop();b.m&&b.lh.pop();e=b.Ev.es;k=g?a.svg:b.wd;if(!g&&null!==a.svg&&k!==a.svg&&a.svg.parentNode===a.panel.svg)return a.svg.replaceWith(k),a.svg=k,null!==k&&a.Xo(b,d,h,k),!0;a.svg=k;null!==e&&null===k&&(Cl(b),b.lh.pop());if(null===k)return!0;a.Xo(b,d,h,k);zl(a,k,c,b,f);1!==b.globalAlpha&&k.setAttributeNS(null,"opacity",
b.globalAlpha.toString());""!==a.filter&&k.setAttributeNS(null,"filter",a.filter);a.ne()?(b.si?b.si.after(k):b.Nj.prepend(k),b.si=k):null!==d&&Al(a,d,k);null!==e&&e(a,k);return!0}
t.Xo=function(a,b,c,d){var e=0!==(this.o&256);a.clipInsteadOfFill&&(e=!1);e?(b=b.re()?b.naturalBounds:b.actualBounds,a=Math.min(c.right,b.right)-Math.max(c.x,b.x),c=Math.min(c.bottom,b.bottom)-Math.max(c.y,b.y),null!==this.ib&&(c=this.ib,a=c.width,c=c.height),d.setAttributeNS(null,"clip-path","path('M 0,0 L "+a+" 0 L "+a+" "+c+" L 0 "+c+" z')")):d.removeAttributeNS(null,"clip-path")};t.fh=function(){};t.lv=function(){this.rf=!0};
t.ik=function(a,b,c){if(this.rf)return this.lv(),this.rf=!1;var d=this.svg;if(null===d)return!1;if(!this.visible)return d.remove(),!1;if("g"!==d.nodeName&&c||"g"===d.nodeName&&!c)return!1;c=this.transform;this instanceof W&&kl(this)||d.setAttributeNS(null,"transform","matrix("+c.m11+", "+c.m12+", "+c.m21+", "+c.m22+", "+c.dx+", "+c.dy+")");var e=a.globalAlpha.toString();"1"===e?d.removeAttribute("opacity"):d.setAttributeNS(null,"opacity",e);""===this.filter?d.removeAttribute("filter"):d.setAttributeNS(null,
"filter",this.filter);a.nc.ia=[1,0,0,1,0,0];if(null!==this.areaBackground||void 0!==d.pd){e=d.pd;if(null===this.areaBackground)d.pd.remove(),d.pd=void 0;else{var f=c.copy().Ql();a.nc.ia=[f.m11,f.m12,f.m21,f.m22,f.dx,f.dy];vl(this,a,this.naturalBounds,this.actualBounds);a.nc.ia=[1,0,0,1,0,0];d.pd?d.pd.replaceWith(a.Rd):d.prepend(a.Rd);d.pd=a.Rd}e&&Dl(a,e)}if(null!==this.background||void 0!==d.Oa)e=d.Oa,null===this.background?(Dl(a,d.Oa),d.Oa.remove(),d.Oa=void 0):(this instanceof W&&kl(this)&&(a.nc.ia=
[c.m11,c.m12,c.m21,c.m22,c.dx,c.dy]),wl(this,a,this.naturalBounds,this.actualBounds),d.Oa?(Dl(a,d.Oa),d.Oa.replaceWith(a.Rd)):d.prepend(a.Rd),d.Oa=a.Rd),e&&Dl(a,e);this.Xo(a,this.panel,this.actualBounds,d);c=yl(this,b,a,d);zl(this,d,b,a,c);return!0};t.lk=function(a){if(null!==this.background||null!==this.areaBackground)return!0;var b=0!==(this.o&256);a.clipInsteadOfFill&&(b=!1);return b?!0:!1};
function ji(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===El)d?b.fillStyle=c.color:b.strokeStyle=c.color;else{var l=a.gq();h=f.width;k=f.height;e?(h=g.width,k=g.height):d||(h+=l,k+=l);if((f=b instanceof Fl)&&c.we&&(c.type===Gl||c.wk===h&&c.bt===k))var m=c.we;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===Hl)m=b.createLinearGradient(n,p,r,q);else if(c.type===rl)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===Gl)try{m=b.createPattern(c.pattern,"repeat")}catch(y){m=null}if(c.type!==Gl&&(e=c.colorStops,null!==e))for(e=e.iterator;e.next();)m.addColorStop(e.key,e.value);if(f&&(c.we=m,null!==m&&(c.wk=h,c.bt=k),null===m&&c.type===Gl&&-1!==c.wk)){c.wk=-1;var v=
a.diagram;null!==v&&-1===c.wk&&ta(function(){v.redraw()},600)}}d?b.fillStyle=m:b.strokeStyle=m}}}t.qg=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.Qd=function(){if(!this.visible)return!1;var a=this.panel;return null!==a?a.Qd():!0};t.If=function(){for(var a=this instanceof W?this:this.panel;null!==a&&a.isEnabled;)a=a.panel;return null===a};
function sl(a){if(0!==(a.o&2048)===!0){var b=a.Cb;b.reset();if(!a.Ib.w()||!a.tc.w()){Il(a,!1);return}b.translate(a.Ib.x-a.tc.x,a.Ib.y-a.tc.y);if(1!==a.scale||0!==a.angle){var c=a.naturalBounds;a.mo(b,c.x,c.y,c.width,c.height)}Il(a,!1);Jl(a,!0)}0!==(a.o&4096)===!0&&(b=a.panel,null===b?(a.uh.set(a.Cb),a.Ik=a.scale,Jl(a,!1)):null!==b.me&&(c=a.uh,c.reset(),b.re()?c.multiply(b.uh):null!==b.panel&&c.multiply(b.panel.uh),c.multiply(a.Cb),a.Ik=a.scale*b.Ik,Jl(a,!1)))}
t.mo=function(a,b,c,d,e){1!==this.Aa&&a.scale(this.Aa);if(0!==this.Kb){var f=J.alloc();f.xi(b,c,d,e,xc);a.rotate(this.Kb,f.x,f.y);J.free(f)}};t.v=function(a){if(!uj(this)){void 0===a&&(a=!1);pj(this,!0);ll(this,!0);var b=this.panel;null===b||a||b.v()}};t.Uj=function(){uj(this)||(pj(this,!0),ll(this,!0))};function Kl(a){if(!vj(a)){var b=a.panel;null!==b?b.v():a.ne()&&(b=a.diagram,null!==b&&(b.Ce.add(a),a instanceof V&&a.zd(),b.Yb()));ll(a,!0)}}
t.Sk=function(){0!==(this.o&2048)===!1&&(Il(this,!0),Jl(this,!0))};t.Wu=function(){Jl(this,!0)};t.N=function(){var a=this.part;null!==a&&a.N()};function jl(a,b){var c=a.stretch,d=a.panel;if(null!==d&&d.type===W.Table)return Ll(a,d.ub(a.row),d.tb(a.column),b);if(null!==d&&d.type===W.Auto&&d.sb()===a)return Ml(a,nd,b);if(c===Yk){if(null!==d){if(d.type===W.Spot&&d.sb()===a)return Ml(a,nd,b);c=d.defaultStretch;return c===Yk?Ml(a,kg,b):Ml(a,c,b)}return Ml(a,kg,b)}return Ml(a,c,b)}
function Ll(a,b,c,d){var e=a.stretch;if(e!==Yk)return Ml(a,e,d);var f=e=null;switch(b.stretch){case Xk:f=!0;break;case nd:f=!0}switch(c.stretch){case Wk:e=!0;break;case nd:e=!0}b=a.panel.defaultStretch;null===e&&(e=b===Wk||b===nd);null===f&&(f=b===Xk||b===nd);return!0===e&&!0===f?Ml(a,nd,d):!0===e?Ml(a,Wk,d):!0===f?Ml(a,Xk,d):Ml(a,kg,d)}
function Ml(a,b,c){if(c)return b;if(b===kg)return kg;c=a.desiredSize;if(c.w())return kg;a=a.angle;if(!isNaN(c.width))if(90!==a&&270!==a){if(b===Wk)return kg;if(b===nd)return Xk}else{if(b===Xk)return kg;if(b===nd)return Wk}if(!isNaN(c.height))if(90!==a&&270!==a){if(b===Xk)return kg;if(b===nd)return Wk}else{if(b===Wk)return kg;if(b===nd)return Xk}return b}function xl(a,b){a.o=b?a.o|512:a.o&-513}function fl(a){return 0!==(a.o&1024)}function Nl(a,b){a.o=b?a.o|1024:a.o&-1025}
function Il(a,b){a.o=b?a.o|2048:a.o&-2049}function Jl(a,b){a.o=b?a.o|4096:a.o&-4097}function uj(a){return 0!==(a.o&8192)}function pj(a,b){a.o=b?a.o|8192:a.o&-8193}function vj(a){return 0!==(a.o&16384)}function ll(a,b){a.o=b?a.o|16384:a.o&-16385}t.Gj=function(){this.svg=null};t.vi=function(a){this.Le=a;null!==this.svg&&this.svg.remove()};t.yv=function(){};t.xv=function(a){this.pa=a;Kl(this);return!0};t.lm=function(a,b){if(this.pa.x!==a||this.pa.y!==b)this.pa.h(a,b),this.Sk()};t.gq=function(){return 0};
function Ol(a){var b=a.part;if(b instanceof V&&(null!==a.portId||a===b.port)){var c=b.diagram;null===c||c.undoManager.isUndoingRedoing||ol(b,a)}}function Pl(a){var b=a.diagram;null===b||b.undoManager.isUndoingRedoing||(a instanceof W?a instanceof V?a.zd():a.pm(a,function(a){Ol(a)}):Ol(a))}
t.bind=function(a,b,c,d){var e=null;"string"===typeof a?e=new Hi(a,b,c,d):e=a;e.vd=this;a=this.gh();null!==a&&Ql(a)&&C("Cannot add a Binding to a template that has already been copied: "+e);null===this.localBindings&&(this.localBindings=new F);this.localBindings.add(e);return this};t.set=function(a){Object.assign(this,a);return this};t.Cu=function(a){Rl(this,a);return this};t.apply=function(a){a(this);return this};t.mm=function(a){Cj(this,a);return this};t.qz=function(){return this.gh()};
t.gh=function(){for(var a=this instanceof W?this:this.panel;null!==a;){if(null!==a.allBindings)return a;a=a.panel}return null};t.Hv=function(a){a.vd=this;null===this.animationTriggers&&(this.animationTriggers=new ob);this.animationTriggers.add(a.propertyName,a);return this};
function Sl(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=Tl.I(a);"function"===typeof f?(c=Ba(arguments),d=f(c),za(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)vi(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):Rl(d,f);return d}
function Rl(a,b){if("string"===typeof b)if(a instanceof Pg)a.text=b;else if(a instanceof Bf)a.figure=b;else if(a instanceof dk)a.source=b;else if(a instanceof W)b=Ul.I(b),null!==b&&(a.type=b);else if(a instanceof ql){var c=Ra(ql,b);null!==c?a.type=c:C("Unknown Brush type as an argument to GraphObject.make: "+b)}else a instanceof P?(b=Ra(P,b),null!==b&&(a.type=b)):a instanceof Xd&&(b=Ra(Xd,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 Vj){var d;b.isRow&&"function"===typeof a.ub?d=a.ub(b.index):b.isRow||"function"!==typeof a.tb||(d=a.tb(b.index));d instanceof Vj?Vl(d,b):C("A RowColumnDefinition can only be added to an object that implements getRowDefinition/getColumnDefinition, not to: "+a)}else if(b instanceof E)"function"===typeof a.rb&&a.rb(b);else if(b instanceof Wl)a.type=b;else if(b instanceof Hi)a instanceof Y?a.bind(b):a instanceof Vj?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.Hv(b):C("An AnimationTrigger can only be applied to a GraphObject, not to: "+a);else if(b instanceof Wd)a instanceof P&&a.type===P.m?a.figures.add(b):C("A PathFigure can only be added to a Path Geometry, not to: "+a);else if(b instanceof Xd)a instanceof Wd?a.segments.add(b):C("A PathSegment can only be added to a PathFigure, not to: "+a);else if(b instanceof ti)a instanceof Q?a.layout=b:a instanceof pf?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++)Rl(a,b[c]);else if("object"===typeof b&&null!==b)if(a instanceof ql){c=new Ta;for(var e in b)d=parseFloat(e),isNaN(d)?c[e]=b[e]:a.addColorStop(d,b[e]);Cj(a,c)}else if(a instanceof Vj){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 Ta;for(c in b)"row"!==c&&"column"!==c&&(e[c]=b[c]);Cj(a,e)}else Cj(a,b);else C('Unknown initializer "'+b+'" for object being constructed by GraphObject.make: '+a)}function Xl(a,b){Tl.add(a,b)}function Yl(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.wp:-1},set:function(a){this.bindingId!==a&&(null===this.A&&(this.A=new dl),this.A.wp=a)}},localBindings:{get:function(){return null!==this.A?this.A.se:null},set:function(a){this.localBindings!==a&&(null===this.A&&(this.A=new dl),this.A.se=a)}},srcBindings:{get:function(){return null!==this.A?this.A.vm:null},set:function(a){this.srcBindings!==
a&&(null===this.A&&(this.A=new dl),this.A.vm=a)}},shadowVisible:{get:function(){return null!==this.A?this.A.Bi:null},set:function(a){var b=this.shadowVisible;b!==a&&(cl(this),this.A.Bi=a,this.N(),this.g("shadowVisible",b,a))}},enabledChanged:{get:function(){return null!==this.A?this.A.Hb:null},set:function(a){var b=this.enabledChanged;b!==a&&(cl(this),this.A.Hb=a,this.g("enabledChanged",b,a))}},segmentOrientation:{
get:function(){return null!==this.Ua?this.Ua.mr:Zf},set:function(a){var b=this.segmentOrientation;b!==a&&(null===this.Ua&&(this.Ua=new Zl),this.Ua.mr=a,this.v(),this.g("segmentOrientation",b,a),a===Zf&&(this.angle=0))}},segmentIndex:{get:function(){return null!==this.Ua?this.Ua.u:-Infinity},set:function(a){a=Math.round(a);var b=this.segmentIndex;b!==a&&(null===this.Ua&&(this.Ua=new Zl),this.Ua.u=a,this.v(),this.g("segmentIndex",b,a))}},segmentFraction:{
get:function(){return null!==this.Ua?this.Ua.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.Ua&&(this.Ua=new Zl),this.Ua.m=a,this.v(),this.g("segmentFraction",b,a))}},segmentOffset:{get:function(){return null!==this.Ua?this.Ua.F:pb},set:function(a){var b=this.segmentOffset;b.C(a)||(a=a.J(),null===this.Ua&&(this.Ua=new Zl),this.Ua.F=a,this.v(),this.g("segmentOffset",b,a))}},stretch:{
get:function(){return null!==this.A?this.A.gg:Yk},set:function(a){var b=this.stretch;b!==a&&(cl(this),this.A.gg=a,this.v(),this.g("stretch",b,a))}},name:{get:function(){return null!==this.A?this.A.wa:""},set:function(a){var b=this.name;b!==a&&(cl(this),this.A.wa=a,null!==this.part&&(this.part.Qh=null),this.g("name",b,a))}},opacity:{get:function(){return this.qb},set:function(a){var b=this.qb;b!==a&&((0>a||1<a)&&xa(a,"0 <= value <= 1",Y,"opacity"),
this.qb=a,this.g("opacity",b,a),a=this.diagram,b=this.part,null!==a&&null!==b&&a.N(Gj(b,b.actualBounds)))}},filter:{get:function(){return this.an},set:function(a){var b=this.an;b!==a&&(this.an=a,this.g("filter",b,a),a=this.diagram,b=this.part,null!==a&&null!==b&&a.N(Gj(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.v():
this.ne()&&this.Xb(a),this.N(),Pl(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.v(),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.pd:null},set:function(a){var b=this.areaBackground;b!==a&&(null!==a&&$l(a,"GraphObject.areaBackground"),a instanceof ql&&a.freeze(),
cl(this),this.A.pd=a,this.N(),this.g("areaBackground",b,a))}},background:{get:function(){return this.Oa},set:function(a){var b=this.Oa;b!==a&&(null!==a&&$l(a,"GraphObject.background"),a instanceof ql&&a.freeze(),this.Oa=a,this.N(),this.g("background",b,a))}},part:{get:function(){if(this.ne())return this;if(null!==this.Lg)return this.Lg;var a;for(a=this.panel;a;){if(a instanceof U)return this.Lg=a;a=a.panel}return null}},svg:{
get:function(){return this.V},set:function(a){this.V=a}},panel:{get:function(){return this.Le}},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.yv():(a=a.copy(),this.xv(a,e,d)&&this.g("position",new J(e,d),a))}},actualBounds:{get:function(){return this.Ib}},scale:{get:function(){return this.Aa},set:function(a){var b=this.Aa;b!==a&&(0>=a&&C("GraphObject.scale for "+this+" must be greater than zero, not: "+a),this.Aa=a,this.v(),this.g("scale",b,a))}},angle:{get:function(){return this.Kb},set:function(a){var b=this.Kb;b!==a&&
(a%=360,0>a&&(a+=360),b!==a&&(this.Kb=a,Pl(this),this.v(),this.g("angle",b,a)))}},desiredSize:{get:function(){return this.dd},set:function(a){var b=a.width,c=a.height,d=this.dd,e=d.width,f=d.height;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))||(this.dd=a=a.J(),this.v(),this instanceof Bf&&this.pc(),this.g("desiredSize",d,a),fl(this)&&(a=this.part,null!==a&&(gl(this,a,"width"),gl(this,a,"height"))))}},width:{get:function(){return this.dd.width},
set:function(a){var b=this.dd.width;b===a||isNaN(b)&&isNaN(a)||(b=this.dd,this.dd=a=(new L(a,this.dd.height)).freeze(),this.v(),this instanceof Bf&&this.pc(),this.g("desiredSize",b,a),fl(this)&&(a=this.part,null!==a&&gl(this,a,"width")))}},height:{get:function(){return this.dd.height},set:function(a){var b=this.dd.height;b===a||isNaN(b)&&isNaN(a)||(b=this.dd,this.dd=a=(new L(this.dd.width,a)).freeze(),this.v(),this instanceof Bf&&this.pc(),this.g("desiredSize",b,a),fl(this)&&
(a=this.part,null!==a&&gl(this,a,"height")))}},minSize:{get:function(){return null!==this.A?this.A.u:Cb},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(),cl(this),this.A.u=a,this.v(),this.g("minSize",b,a))}},maxSize:{get:function(){return null!==this.A?this.A.m:Kb},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(),cl(this),this.A.m=a,this.v(),this.g("maxSize",b,a))}},measuredBounds:{get:function(){return this.tc}},naturalBounds:{get:function(){return this.cc}},margin:{get:function(){return this.Ig},set:function(a){"number"===typeof a&&(a=new hc(a));var b=this.Ig;b.C(a)||(this.Ig=a=a.J(),this.v(),this.g("margin",b,a))}},transform:{get:function(){0!==(this.o&2048)===
!0&&sl(this);return this.Cb}},me:{get:function(){0!==(this.o&4096)===!0&&sl(this);return this.uh}},animationTriggers:{get:function(){return null!==this.A?this.A.hb:null},set:function(a){this.animationTriggers!==a&&(cl(this),this.A.hb=a)}},reshapingBehavior:{get:function(){return null!==this.A?this.A.Pf:kg},set:function(a){this.reshapingBehavior!==a&&(cl(this),this.A.Pf=a)}},alignment:{
get:function(){return this.Jb},set:function(a){var b=this.Jb;b.C(a)||(a.Lc()&&!a.Vb()&&C("GraphObject.alignment for "+this+" must be a real Spot or Spot.Default, not: "+a),this.Jb=a=a.J(),Kl(this),this.g("alignment",b,a))}},column:{get:function(){return this.zg},set:function(a){a=Math.round(a);var b=this.zg;b!==a&&(0>a&&xa(a,">= 0",Y,"column"),this.zg=a,this.v(),this.g("column",b,a),null!==this.svg&&this.svg.remove())}},columnSpan:{get:function(){return null!==
this.A?this.A.pb:1},set:function(a){a=Math.round(a);var b=this.columnSpan;b!==a&&(1>a&&xa(a,">= 1",Y,"columnSpan"),cl(this),this.A.pb=a,this.v(),this.g("columnSpan",b,a))}},row:{get:function(){return this.ho},set:function(a){a=Math.round(a);var b=this.ho;b!==a&&(0>a&&xa(a,">= 0",Y,"row"),this.ho=a,this.v(),this.g("row",b,a),null!==this.svg&&this.svg.remove())}},rowSpan:{get:function(){return null!==this.A?this.A.Ai:1},set:function(a){a=Math.round(a);
var b=this.rowSpan;b!==a&&(1>a&&xa(a,">= 1",Y,"rowSpan"),cl(this),this.A.Ai=a,this.v(),this.g("rowSpan",b,a))}},spanAllocation:{get:function(){return null!==this.A?this.A.Ci:null},set:function(a){var b=this.spanAllocation;b!==a&&(cl(this),this.A.Ci=a,this.v(),this.g("spanAllocation",b,a))}},alignmentFocus:{get:function(){return this.qk},set:function(a){var b=this.qk;b.C(a)||(this.qk=a=a.J(),this.v(),this.g("alignmentFocus",b,a))}},portId:{
get:function(){return this.Xn},set:function(a){var b=this.Xn;if(b!==a){var c=this.part;null===c||c instanceof V||C("Cannot set portID on a Link: "+a);null!==b&&null!==c&&am(c,this);this.Xn=a;null!==a&&null!==c&&(c.Se=!0,bm(c,this));this.g("portId",b,a)}}},toSpot:{get:function(){return null!==this.ba?this.ba.yj:rc},set:function(a){var b=this.toSpot;b.C(a)||(a=a.J(),this.Uc(),this.ba.yj=a,this.g("toSpot",b,a),Ol(this))}},toEndSegmentLength:{
get:function(){return null!==this.ba?this.ba.wj:10},set:function(a){var b=this.toEndSegmentLength;b!==a&&(0>a&&xa(a,">= 0",Y,"toEndSegmentLength"),this.Uc(),this.ba.wj=a,this.g("toEndSegmentLength",b,a),Ol(this))}},toShortLength:{get:function(){return null!==this.ba?this.ba.xj:0},set:function(a){var b=this.toShortLength;b!==a&&(this.Uc(),this.ba.xj=a,this.g("toShortLength",b,a),Ol(this))}},toLinkable:{get:function(){return null!==
this.ba?this.ba.Pr:null},set:function(a){var b=this.toLinkable;b!==a&&(this.Uc(),this.ba.Pr=a,this.g("toLinkable",b,a))}},toMaxLinks:{get:function(){return null!==this.ba?this.ba.Qr:Infinity},set:function(a){var b=this.toMaxLinks;b!==a&&(0>a&&xa(a,">= 0",Y,"toMaxLinks"),this.Uc(),this.ba.Qr=a,this.g("toMaxLinks",b,a))}},fromSpot:{get:function(){return null!==this.ba?this.ba.Wi:rc},set:function(a){var b=this.fromSpot;b.C(a)||(a=a.J(),this.Uc(),
this.ba.Wi=a,this.g("fromSpot",b,a),Ol(this))}},fromEndSegmentLength:{get:function(){return null!==this.ba?this.ba.Ui:10},set:function(a){var b=this.fromEndSegmentLength;b!==a&&(0>a&&xa(a,">= 0",Y,"fromEndSegmentLength"),this.Uc(),this.ba.Ui=a,this.g("fromEndSegmentLength",b,a),Ol(this))}},fromShortLength:{get:function(){return null!==this.ba?this.ba.Vi:0},set:function(a){var b=this.fromShortLength;b!==a&&(this.Uc(),this.ba.Vi=a,this.g("fromShortLength",
b,a),Ol(this))}},fromLinkable:{get:function(){return null!==this.ba?this.ba.cq:null},set:function(a){var b=this.fromLinkable;b!==a&&(this.Uc(),this.ba.cq=a,this.g("fromLinkable",b,a))}},fromMaxLinks:{get:function(){return null!==this.ba?this.ba.eq:Infinity},set:function(a){var b=this.fromMaxLinks;b!==a&&(0>a&&xa(a,">= 0",Y,"fromMaxLinks"),this.Uc(),this.ba.eq=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&&(cl(this),this.A.j=a,this.g("cursor",b,a))}},click:{get:function(){return null!==this.A?this.A.xh:null},set:function(a){var b=this.click;b!==a&&(cl(this),this.A.xh=a,this.g("click",b,a))}},doubleClick:{get:function(){return null!==this.A?this.A.Dh:null},set:function(a){var b=this.doubleClick;b!==a&&(cl(this),this.A.Dh=a,this.g("doubleClick",b,a))}},contextClick:{
get:function(){return null!==this.A?this.A.zh:null},set:function(a){var b=this.contextClick;b!==a&&(cl(this),this.A.zh=a,this.g("contextClick",b,a))}},mouseEnter:{get:function(){return null!==this.A?this.A.Lh:null},set:function(a){var b=this.mouseEnter;b!==a&&(cl(this),this.A.Lh=a,this.g("mouseEnter",b,a))}},mouseLeave:{get:function(){return null!==this.A?this.A.Oh:null},set:function(a){var b=this.mouseLeave;b!==a&&(cl(this),
this.A.Oh=a,this.g("mouseLeave",b,a))}},mouseOver:{get:function(){return null!==this.A?this.A.Ph:null},set:function(a){var b=this.mouseOver;b!==a&&(cl(this),this.A.Ph=a,this.g("mouseOver",b,a))}},mouseHover:{get:function(){return null!==this.A?this.A.Nh:null},set:function(a){var b=this.mouseHover;b!==a&&(cl(this),this.A.Nh=a,this.g("mouseHover",b,a))}},mouseHold:{get:function(){return null!==this.A?this.A.Mh:
null},set:function(a){var b=this.mouseHold;b!==a&&(cl(this),this.A.Mh=a,this.g("mouseHold",b,a))}},mouseDragEnter:{get:function(){return null!==this.A?this.A.Of:null},set:function(a){var b=this.mouseDragEnter;b!==a&&(cl(this),this.A.Of=a,this.g("mouseDragEnter",b,a))}},mouseDragLeave:{get:function(){return null!==this.A?this.A.Vd:null},set:function(a){var b=this.mouseDragLeave;b!==a&&(cl(this),this.A.Vd=a,this.g("mouseDragLeave",b,a))}},
mouseDrop:{get:function(){return null!==this.A?this.A.Kh:null},set:function(a){var b=this.mouseDrop;b!==a&&(cl(this),this.A.Kh=a,this.g("mouseDrop",b,a))}},actionDown:{get:function(){return null!==this.A?this.A.V:null},set:function(a){var b=this.actionDown;b!==a&&(cl(this),this.A.V=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&&(cl(this),this.A.ga=a,this.g("actionMove",b,a))}},actionUp:{get:function(){return null!==this.A?this.A.Ha:null},set:function(a){var b=this.actionUp;b!==a&&(cl(this),this.A.Ha=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&&(cl(this),this.A.F=a,this.g("actionCancel",b,a))}},toolTip:{get:function(){return null!==
this.A?this.A.Zh:null},set:function(a){var b=this.toolTip;b!==a&&(cl(this),this.A.Zh=a,this.g("toolTip",b,a))}},contextMenu:{get:function(){return null!==this.A?this.A.Ah:null},set:function(a){var b=this.contextMenu;b!==a&&(cl(this),this.A.Ah=a,this.g("contextMenu",b,a))}}});Y.prototype.trigger=Y.prototype.Hv;Y.prototype.findBindingPanel=Y.prototype.gh;Y.prototype.findTemplateBinder=Y.prototype.qz;Y.prototype.setProperties=Y.prototype.mm;Y.prototype.apply=Y.prototype.apply;
Y.prototype.attach=Y.prototype.Cu;Y.prototype.set=Y.prototype.set;Y.prototype.isEnabledObject=Y.prototype.If;Y.prototype.isVisibleObject=Y.prototype.Qd;Y.prototype.isContainedBy=Y.prototype.qg;Y.prototype.getNearestIntersectionPoint=Y.prototype.os;Y.prototype.getLocalPoint=Y.prototype.ns;Y.prototype.getDocumentScale=Y.prototype.Df;Y.prototype.getDocumentAngle=Y.prototype.ki;Y.prototype.getDocumentBounds=Y.prototype.li;Y.prototype.getDocumentPoint=Y.prototype.ka;Y.prototype.intersectsRect=Y.prototype.Vc;
Y.prototype.containedInRect=Y.prototype.dh;Y.prototype.containsRect=Y.prototype.Qe;Y.prototype.containsPoint=Y.prototype.ca;Y.prototype.raiseChanged=Y.prototype.g;Y.prototype.raiseChangedEvent=Y.prototype.cb;Y.prototype.addCopyProperty=Y.prototype.Tw;var Tl=null;Y.className="GraphObject";Tl=new ob;
Xl("Button",function(){function a(a,b){return null!==a.diagram.gc(a.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a},function(a){return a===b})}var b=Sl(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"},Sl(Bf,{name:"ButtonBorder",figure:"RoundedRectangle",spot1:new O(0,0,2.76142374915397,2.761423749153969),spot2:new O(1,1,-2.76142374915397,-2.761423749153969),parameter1:2,parameter2:2,fill:"#F5F5F5",stroke:"#BDBDBD"}));b.mouseEnter=function(a,b){if(b.If()&&b instanceof W&&(a=b.fb("ButtonBorder"),a instanceof Bf)){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.If()&&b instanceof W&&(a=b.fb("ButtonBorder"),a instanceof Bf&&(a.fill=b._buttonFillNormal,a.stroke=b._buttonStrokeNormal))};b.actionDown=function(a,b){if(b.If()&&b instanceof W&&null!==b._buttonFillPressed&&0===a.button){var c=b.fb("ButtonBorder");if(c instanceof Bf){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.If()&&d instanceof W&&null!==d._buttonFillPressed&&0===b.button){var c=d.fb("ButtonBorder");if(c instanceof Bf){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.If()&&d instanceof W&&null!==d._buttonFillPressed){var c=d.fb("ButtonBorder");if(c instanceof Bf){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.If()&&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 Bf))){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});
Xl("TreeExpanderButton",function(){var a=Sl("Button",{_treeExpandedFigure:"MinusLine",_treeCollapsedFigure:"PlusLine"},Sl(Bf,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:Ib},(new Hi("figure","isTreeExpanded",function(a,c){c=c.panel;return a?c._treeExpandedFigure:c._treeCollapsedFigure})).$o()),{visible:!1},(new Hi("visible","isTreeLeaf",function(a){return!a})).$o());a.click=function(a,c){c=c.part;c instanceof te&&(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});
Xl("SubGraphExpanderButton",function(){var a=Sl("Button",{_subGraphExpandedFigure:"MinusLine",_subGraphCollapsedFigure:"PlusLine"},Sl(Bf,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:Ib},(new Hi("figure","isSubGraphExpanded",function(a,c){c=c.panel;return a?c._subGraphExpandedFigure:c._subGraphCollapsedFigure})).$o()));a.click=function(a,c){c=c.part;c instanceof te&&(c=c.adornedPart);if(c instanceof pf){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});Xl("ToolTip",function(){return Sl(te,W.Auto,{isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new J(0,3),shadowBlur:5},Sl(Bf,{name:"Border",figure:"RoundedRectangle",parameter1:1,parameter2:1,fill:"#F5F5F5",stroke:"#F0F0F0",spot1:new O(0,0,4,6),spot2:new O(1,1,-4,-4)}))});
Xl("ContextMenu",function(){return Sl(te,W.Vertical,{background:"#F5F5F5",isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new J(0,3),shadowBlur:5},new Hi("background","",function(a){return null!==a.adornedPart&&null!==a.placeholder?null:"#F5F5F5"}))});Xl("ContextMenuButton",function(){var a=Sl("Button");a.stretch=Wk;var b=a.fb("ButtonBorder");b instanceof Bf&&(b.figure="Rectangle",b.strokeWidth=0,b.spot1=new O(0,0,2,3),b.spot2=new O(1,1,-2,-2));return a});
Xl("PanelExpanderButton",function(a){var b=Yl(a,"COLLAPSIBLE"),c=Sl("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},Sl(Bf,{name:"ButtonIcon",strokeWidth:2},(new Hi("geometryString","visible",function(a){return a?c._buttonExpandedFigure:c._buttonCollapsedFigure})).$o(b)));
a=c.fb("ButtonBorder");a instanceof Bf&&(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.gh();null===e&&(e=c.part);null!==e&&(c=e.fb(b),null!==c&&(a.handled=!0,d.Ea("Collapse/Expand Panel"),c.visible=!c.visible,d.eb("Collapse/Expand Panel")))}};return c});
Xl("CheckBoxButton",function(a){var b=Yl(a);a=Sl("Button",{desiredSize:new L(14,14)},Sl(Bf,{name:"ButtonIcon",geometryString:"M0 0 M0 8.85 L4.9 13.75 16.2 2.45 M16.2 16.2",strokeWidth:2,stretch:nd,geometryStretch:mg,visible:!1},""!==b?(new Hi("visible",b)).Lx():[]));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.Ea("checkbox");f.visible=!f.visible;"function"===typeof d._doClick&&d._doClick(a,
d);c.eb("checkbox")}}};return a});
Xl("CheckBox",function(a){a=Yl(a);a=Sl("CheckBoxButton",a,{name:"Button",isActionable:!1,margin:new hc(0,1,0,0)});var b=Sl(W,"Horizontal",a,{isActionable:!0,cursor:a.cursor,margin:new hc(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=kg=new E(Y,"None",0);Y.Default=Yk=new E(Y,"Default",0);Y.Vertical=Xk=new E(Y,"Vertical",4);Y.Horizontal=Wk=new E(Y,"Horizontal",5);Y.Fill=nd=new E(Y,"Fill",3);Y.Uniform=mg=new E(Y,"Uniform",1);
Y.UniformToFill=Zk=new E(Y,"UniformToFill",2);Y.FlipVertical=$k=new E(Y,"FlipVertical",1);Y.FlipHorizontal=al=new E(Y,"FlipHorizontal",2);Y.FlipBoth=bl=new E(Y,"FlipBoth",3);Y.make=Sl;Y.getBuilders=function(){var a=new ob,b;for(b in Tl)if(b!==b.toLowerCase()){var c=Tl.I(b);"function"===typeof c&&a.add(b,c)}a.freeze();return a};Y.defineBuilder=Xl;
Y.build=function(a,b,c){for(var d=[],e=2;e<arguments.length;++e)d[e-2]=arguments[e];e=Tl.I(a);if("function"===typeof e&&(d=e([a].concat(d)),d instanceof Y))return b&&d.set(b),d;C('GraphObject.build invoked object builder "'+a+'", but it did not return an Object')};Y.takeBuilderArgument=Yl;
function dl(){this.lc=!1;this.wa="";this.wp=-1;this.ob=this.vm=this.se=null;this.j="";this.hb=this.Ci=this.Hb=this.Ah=this.Zh=this.F=this.Ha=this.ga=this.V=this.Kh=this.Vd=this.Of=this.Mh=this.Nh=this.Ph=this.Oh=this.Lh=this.zh=this.Dh=this.xh=null;this.u=Cb;this.m=Kb;this.gg=Yk;this.pb=this.Ai=1;this.Pf=kg;this.Oc=this.Bi=this.pd=null;this.Nc="category"}
dl.prototype.copy=function(){var a=new dl;a.wa=this.wa;a.wp=this.wp;a.se=this.se;a.ob=this.ob;a.j=this.j;a.xh=this.xh;a.Dh=this.Dh;a.zh=this.zh;a.Lh=this.Lh;a.Oh=this.Oh;a.Ph=this.Ph;a.Nh=this.Nh;a.Mh=this.Mh;a.Of=this.Of;a.Vd=this.Vd;a.Kh=this.Kh;a.V=this.V;a.ga=this.ga;a.Ha=this.Ha;a.F=this.F;a.Zh=this.Zh;a.Ah=this.Ah;a.Hb=this.Hb;a.Ci=this.Ci;a.hb=this.hb;a.u=this.u.J();a.m=this.m.J();a.gg=this.gg;a.Ai=this.Ai;a.pb=this.pb;a.Pf=this.Pf;a.pd=this.pd;a.Bi=this.Bi;a.Oc=this.Oc;a.Nc=this.Nc;return a};
function Zl(){this.u=-Infinity;this.m=0;this.F=pb;this.mr=Zf;this.j=this.V="None"}Zl.prototype.copy=function(){var a=new Zl;a.u=this.u;a.m=this.m;a.F=this.F.J();a.mr=this.mr;a.V=this.V;a.j=this.j;return a};Zl.className="LinkElementSettings";function el(){this.yj=this.Wi=Sc;this.xj=this.Vi=this.wj=this.Ui=NaN;this.Pr=this.cq=null;this.Qr=this.eq=Infinity}
el.prototype.copy=function(){var a=new el;a.Wi=this.Wi.J();a.yj=this.yj.J();a.Ui=this.Ui;a.wj=this.wj;a.Vi=this.Vi;a.xj=this.xj;a.cq=this.cq;a.Pr=this.Pr;a.eq=this.eq;a.Qr=this.Qr;return a};el.className="LinkSettings";function cm(){this.ia=[1,0,0,1,0,0]}cm.prototype.copy=function(){var a=new cm;a.ia[0]=this.ia[0];a.ia[1]=this.ia[1];a.ia[2]=this.ia[2];a.ia[3]=this.ia[3];a.ia[4]=this.ia[4];a.ia[5]=this.ia[5];return a};
cm.prototype.translate=function(a,b){this.ia[4]+=this.ia[0]*a+this.ia[2]*b;this.ia[5]+=this.ia[1]*a+this.ia[3]*b};cm.prototype.scale=function(a,b){this.ia[0]*=a;this.ia[1]*=a;this.ia[2]*=b;this.ia[3]*=b};
cm.prototype.rotate=function(a,b,c){360<=a?a-=360:0>a&&(a+=360);if(0!==a){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.ia[1]*a+this.ia[3]*d,f=this.ia[0]*-d+this.ia[2]*a,g=this.ia[1]*-d+this.ia[3]*a;this.ia[0]=this.ia[0]*a+this.ia[2]*d;this.ia[1]=e;this.ia[2]=f;this.ia[3]=g;this.translate(-b,-c)}};cm.className="STransform";
function dm(a){this.type=a;this.r2=this.y2=this.x2=this.r1=this.y1=this.x1=0;this.gx=[];this.pattern=null}dm.prototype.addColorStop=function(a,b){this.gx.push({offset:a,color:b})};dm.className="SGradient";
function Fj(a,b,c){this.ownerDocument=a=void 0===b?x.document:b;this.bA="http://www.w3.org/2000/svg";void 0!==a&&(this.La=this.Sd("svg",{width:"1px",height:"1px",viewBox:"0 0 1 1"}),this.style.display="block",this.La.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns","http://www.w3.org/2000/svg"),this.La.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"));this.es=null;this.context=new ii(this,c)}
Fj.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",this.La.setAttributeNS(null,"width",c+"px"),this.La.setAttributeNS(null,"height",d+"px"),this.La.setAttributeNS(null,"viewBox","0 0 "+c+" "+d),this.context.uw.firstElementChild.setAttributeNS(null,"width",c+"px"),this.context.uw.firstElementChild.setAttributeNS(null,"height",d+"px"),!0):!1};
Fj.prototype.Sd=function(a,b,c){a=this.ownerDocument.createElementNS(this.bA,a);if(za(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};Fj.prototype.getBoundingClientRect=function(){return this.La.getBoundingClientRect()};Fj.prototype.focus=function(){this.La.focus()};Fj.prototype.mx=function(){this.ownerDocument=null};
ma.Object.defineProperties(Fj.prototype,{width:{get:function(){return this.La.width.baseVal.value},set:function(a){this.La.setAttribute("width",a+"px")}},height:{get:function(){return this.La.height.baseVal.value},set:function(a){this.La.setAttribute("height",a+"px")}},style:{get:function(){return this.La.style}}});Fj.className="SVGSurface";
function ii(a,b){this.Ev=a;this.svg=a.La;this.stack=[];this.lh=[];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.Fl=!1;this.strokeStyle="#000000";this.textAlign="start";this.clipInsteadOfFill=!1;this.Tg=this.xr=this.wr=0;this.wd=this.Rd=null;this.path=[];this.Wl={};this.zt=!1;
this.Wg=null;this.uj=0;this.nc=new cm;this.j=Cl(this);this.Nj=Cl(this,"gojs-diagram");this.bs=this.si=null;var c=jb++,d=this.Sd("clipPath",{id:"mainClip"+c});d.appendChild(this.Sd("rect",{x:0,y:0,width:a.width,height:a.height}));this.uw=d;this.svg.appendChild(this.j);this.j.appendChild(this.Nj);this.svg.appendChild(d);this.j.setAttributeNS(null,"clip-path","url(#mainClip"+c+")");this.dA={};this.isTemporary=!!b;this.filter="";this.ak=null}
function yj(a,b,c,d,e,f,g){void 0===a.Nj?Bl(a,b,c,d,e,f,g):a.Nj.setAttribute("transform","matrix("+b+", "+c+", "+d+", "+e+", "+f+", "+g+")")}t=ii.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=[];this.Wl={stroke:"none",fill:"none"}};t.Re=function(a){this.addPath(this.path,this.nc,a||0)};
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.Wl.clipPath=!0};t.closePath=function(){this.path.push(["z"])};t.createLinearGradient=function(a,b,c,d){var e=new dm("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.dA;if(c[b])return"url(#"+c[b]+")";var d="PATTERN"+jb++,e={x:0,y:0,width:a.width,height:a.height,href:b};a=this.Sd("pattern",{width:a.width,height:a.height,id:d,patternUnits:"userSpaceOnUse"});a.appendChild(this.Sd(Zi,e));this.svg.appendChild(a);c[b]=d;return"url(#"+d+")"};
t.createRadialGradient=function(a,b,c,d,e,f){var g=new dm("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){f="";a instanceof HTMLCanvasElement&&(f=a.toDataURL());a instanceof HTMLImageElement&&(f=a.getAttribute("src"));g=a instanceof HTMLImageElement?a.naturalWidth:a.width;var l=a instanceof HTMLImageElement?a.naturalHeight:a.height;void 0===d&&(h=d=g,k=e=l);d=d||0;e=e||0;h=h||0;k=k||0;a={x:0,y:0,width:h||g||d,height:k||l||e,href:f};K.$(d,h)&&K.$(e,k)?-1===f.toLowerCase().indexOf(".svg")&&-1===f.toLowerCase().indexOf("data:image/svg")&&(a.preserveAspectRatio="xMidYMid slice"):
a.preserveAspectRatio="none";if(0!==b||0!==c||d!==g||e!==l)h="CLIP"+jb++,k=this.Sd("clipPath",{id:h}),k.appendChild(this.Sd("rect",{x:b,y:c,width:d,height:e})),this.svg.appendChild(k),a["clip-path"]="url(#"+h+")";em(this,Zi,a,this.nc);this.addElement(Zi,a)};t.fill=function(a){a&&(this.Wl["fill-rule"]="evenodd");fm(this,this.Wl)};t.mg=function(a,b){this.clipInsteadOfFill?this.clip():this.fill(b)};
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]};em(this,"fill",a,this.nc);this.addElement("rect",a)};t.ox=function(a,b,c,d){a={x:a,y:b,width:c,height:d};em(this,"fill",a,this.nc);fm(this,a);this.svg.prepend(this.Sd("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};em(this,"fill",b,this.nc);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.nc=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;this.ak=
a.ak};
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,ak:this.ak});for(var a=[],b=0;b<this.path.length;b++)a.push(this.path[b]);this.stack.push(a);this.stack.push(this.nc.copy())};
t.setTransform=function(a,b,c,d,e,f){1===a&&0===b&&0===c&&1===d&&0===e&&0===f||Bl(this,a,b,c,d,e,f)};t.scale=function(a,b){this.nc.scale(a,b)};t.translate=function(a,b){this.nc.translate(a,b)};t.transform=function(){};t.xc=function(){};t.stroke=function(){gm(this,this.Wl)};t.hk=function(){this.clipInsteadOfFill||this.stroke()};t.Sd=function(a,b,c){return this.Ev.Sd(a,b,c)};t.addElement=function(a,b,c){a=this.Sd(a,b,c);null!==this.wd?this.wd.appendChild(a):this.wd=a;return this.Rd=a};
function em(a,b,c,d){"fill"===b?fm(a,c):"stroke"===b&&gm(a,c);null!==d&&(a=d.ia,c.transform="matrix("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+")")}function fm(a,b){a.fillStyle instanceof dm?b.fill=hm(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),b.fill="rgb("+a[1]+","+a[2]+","+a[3]+")",b["fill-opacity"]=a[4]):b.fill=a.fillStyle}
function im(a,b,c){c=c?"fill":"stroke";a.fillStyle instanceof dm?b.setAttributeNS(null,"fill",hm(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),b.setAttributeNS(null,c,"rgb("+a[1]+","+a[2]+","+a[3]+")"),b.setAttributeNS(null,c+"-opacity",a[4])):b.setAttributeNS(null,c,a.fillStyle)}
function gm(a,b){if(a.strokeStyle instanceof dm)b.stroke=hm(a,a.strokeStyle);else if(/^rgba\(/.test(a.strokeStyle)){var c=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(a.strokeStyle);b.stroke="rgb("+c[1]+","+c[2]+","+c[3]+")";b["stroke-opacity"]=c[4]}else b.stroke=a.strokeStyle;b["stroke-width"]=a.lineWidth;b["stroke-linecap"]=a.lineCap;b["stroke-linejoin"]=a.lineJoin;b["stroke-miterlimit"]=a.miterLimit;a.zt&&(b["stroke-dasharray"]=a.Wg.toString(),b["stroke-dashoffset"]=
a.uj)}
function hm(a,b){var c="GRAD"+jb++;if("linear"===b.type)var d=a.Sd("linearGradient",{x1:b.x1,x2:b.x2,y1:b.y1,y2:b.y2,id:c,gradientUnits:"userSpaceOnUse"});else if("radial"===b.type)d=a.Sd("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.gx;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.Sd("stop",f[e]));a.svg.appendChild(d);return"url(#"+c+")"}
t.addPath=function(a,b,c){var d=[];for(var e=0;e<a.length;e++){var f=Ba(a[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(" "))}d=d.join(" ");a=this.Wl;if(a.clipPath)0<this.lh.length&&this.lh[this.lh.length-1].setAttributeNS(null,"clip-path",'path("'+d+'")');else if(a.d=d,em(this,"",a,b),null!==this.bs)if(b=this.bs,"g"!==b.nodeName)for(var h in a)"transform"!==
h&&b.setAttributeNS(null,h,a[h]);else{h=b.getElementsByTagName("path");for(var k in a)"transform"!==k&&h[c].setAttributeNS(null,k,a[k])}else this.addElement("path",a)};function Bl(a,b,c,d,e,f,g){var h=new cm;h.ia=[b,c,d,e,f,g];b={};em(a,"g",b,h);h=a.addElement("g",b);a.lh.push(h)}function Cl(a,b){var c={};b&&(c["class"]=b);b=a.addElement("g",c);a.lh.push(b);return b}t.Cv=function(a,b,c){this.wr=a;this.xr=b;this.Tg=c};function ul(a){a.Fl=!1;a.shadowOffsetX=0;a.shadowOffsetY=0;a.shadowBlur=0}
function tl(a){a.Fl=!0;a.shadowOffsetX=a.wr;a.shadowOffsetY=a.xr;a.shadowBlur=a.Tg}t.fs=function(a,b){this.zt=!0;this.Wg=a;this.uj=b};t.cs=function(){this.zt=!1};t.Sc=function(){};t.Yx=function(){};ii.prototype.rotate=function(a){this.nc.rotate(57.2958*a,0,0)};ii.prototype.getImageData=function(){return null};ii.prototype.measureText=function(){return null};
function Dl(a,b){b=b.getAttribute("fill");null!==b&&(b=b.split("#"),1!==b.length&&(b=a.svg.getElementById(b[1].slice(0,-1)),null!==b&&1===a.svg.innerHTML.match(new RegExp(b.id,"g")).length&&b.remove()))}ii.prototype.Es=function(a){null!==a.svg&&a.svg.parentNode===this.Nj&&a.svg.remove()};ii.className="SVGContext";
Q.prototype.zs=function(a){this.pj.contains("SVG")||this.Xr("SVG",new Fj(this,x.document));var b=new Fj(this,x.document,!0);void 0===a&&(a=new Ta);var c=this;return Ek(this,function(a,e){a=Fk(c,a,"SVG",b);a=null!==a?a.svg:null;return"function"===typeof e?(e(a),null):a},a)};Q.prototype.makeSvg=Q.prototype.zs;Q.prototype.av=function(a){return this.zs(a)};Q.prototype.makeSVG=Q.prototype.av;
function Pi(a,b,c,d){this.ownerDocument=b=void 0===b?x.document:b;this.es=null;b=b.createElement("canvas");b.tabIndex=0;this.La=b;this.La.innerHTML="This text is displayed if your browser does not support the Canvas HTML element.";this.context=new Fl(b,c,d);b.H=a}Pi.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};Pi.prototype.toDataURL=function(a,b){return this.La.toDataURL(a,b)};
Pi.prototype.getBoundingClientRect=function(){return this.La.getBoundingClientRect()};Pi.prototype.focus=function(){this.La.focus()};Pi.prototype.mx=function(){this.ownerDocument=this.La.H=null};ma.Object.defineProperties(Pi.prototype,{width:{get:function(){return this.La.width},set:function(a){this.La.width=a}},height:{get:function(){return this.La.height},set:function(a){this.La.height=a}},style:{get:function(){return this.La.style}}});
Pi.className="CanvasSurface";function Fl(a,b,c){this.Z=a.getContext?a.getContext("2d",b):null;null===this.Z&&C("Browser does not support HTML Canvas Element");this.Zs=this.at=this.$s="";this.Gm=!1;this.Tg=this.xr=this.wr=0;this.Fl=!1;this.Cl=new ld;this.isTemporary=!!c}t=Fl.prototype;t.Yx=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.Re=function(){};
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.xc();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(a){this.Z.fill(a?"evenodd":"nonzero")};t.fillRect=function(a,b,c,d){this.Z.fillRect(a,b,c,d)};t.ox=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.xc();this.Z.save()};Fl.prototype.rotate=function(a){this.Cl.rotate(57.2958*a,0,0)};t=Fl.prototype;t.setTransform=function(a,b,c,d,e,f){this.Cl.setTransform(a,b,c,d,e,f)};t.scale=function(a,b){this.Cl.scale(a,b)};t.translate=function(a,b){this.Cl.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.Cl,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.xc=function(){var a=this.Cl;this.Z.setTransform(a.m11,a.m12,a.m21,a.m22,a.dx,a.dy)};
t.mg=function(a,b){if(a instanceof ql&&a.type===rl){var c=a.wk;a=a.bt;a>c?(this.scale(c/a,1),this.translate((a-c)/2,0)):c>a&&(this.scale(1,a/c),this.translate(0,(c-a)/2));this.Gm?this.clip():this.fill(b);a>c?(this.translate(-(a-c)/2,0),this.scale(1/(c/a),1)):c>a&&(this.translate(0,-(c-a)/2),this.scale(1,1/(a/c)))}else this.Gm?this.clip():this.fill(b)};t.hk=function(){this.Gm||this.stroke()};t.Cv=function(a,b,c){this.wr=a;this.xr=b;this.Tg=c};
t.fs=function(a,b){var c=this.Z;void 0!==c.setLineDash&&(c.setLineDash(a),c.lineDashOffset=b)};t.cs=function(){var a=this.Z;void 0!==a.setLineDash&&(a.setLineDash(jm),a.lineDashOffset=0)};t.Sc=function(a){a&&(this.$s="");this.Zs=this.at=""};t.Es=function(){};
ma.Object.defineProperties(Fl.prototype,{fillStyle:{get:function(){return this.Z.fillStyle},set:function(a){this.Zs!==a&&(this.Zs=this.Z.fillStyle=a)}},font:{get:function(){return this.Z.font},set:function(a){this.$s!==a&&(this.$s=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.at!==a&&(this.at=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}},filter:{get:function(){return this.Z.filter},set:function(a){this.Z.filter=
""===a?"none":a}},clipInsteadOfFill:{get:function(){return this.Gm},set:function(a){this.Gm=a}}});var jm=Object.freeze([]);Fl.className="CanvasSurfaceContext";function km(){this.F=this.m=this.u=this.j=0}km.className="ColorNumbers";
function ql(a,b){lm||(mm(),lm=!0);Qa(this);this._isFrozen=!1;void 0===a?(this.na=El,this.vk="black"):"string"===typeof a?(this.na=El,this.vk=a):(this.na=a,this.vk="black");a=this.na;a===Hl?(this.Ld=tc,this.Jk=Ac):this.Jk=a===rl?this.Ld=xc:this.Ld=rc;this.Cr=0;this.Tp=NaN;this.we=this.Zq=this.ve=null;this.bt=this.wk=0;b&&Object.assign(this,b)}
ql.prototype.copy=function(){var a=new ql;a.na=this.na;a.vk=this.vk;a.Ld=this.Ld.J();a.Jk=this.Jk.J();a.Cr=this.Cr;a.Tp=this.Tp;null!==this.ve&&(a.ve=this.ve.copy());a.Zq=this.Zq;return a};t=ql.prototype;t.freeze=function(){this._isFrozen=!0;null!==this.ve&&this.ve.freeze();return this};t.ja=function(){Object.isFrozen(this)&&C("cannot thaw constant: "+this);this._isFrozen=!1;null!==this.ve&&this.ve.ja();return this};t.rb=function(a){a.classType===ql&&(this.type=a)};
t.toString=function(){var a="Brush(";if(this.type===El)a+=this.color;else if(a=this.type===Hl?a+"Linear ":this.type===rl?a+"Radial ":this.type===Gl?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)&&xa(a,"0 <= loc <= 1",ql,"addColorStop:loc");null===this.ve&&(this.ve=new ob);this.ve.add(a,b);this.na===El&&(this.type=Hl);this.we=null;return this};
t.Vz=function(a,b){this._isFrozen&&va(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?nm:b;if(this.type===El)Uh(this.color),this.color=om(a,b);else if((this.type===Hl||this.type===rl)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)Uh(c.value),this.addColorStop(c.key,om(a,b));return this};function pm(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?nm:c;Uh(a);return om(b,c)}
t.Xy=function(a,b){this._isFrozen&&va(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?nm:b;if(this.type===El)Uh(this.color),this.color=om(-a,b);else if((this.type===Hl||this.type===rl)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)Uh(c.value),this.addColorStop(c.key,om(-a,b));return this};function qm(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?nm:c;Uh(a);return om(-b,c)}
function rm(a,b,c){Uh(a);a=sm.j;var d=sm.u,e=sm.m,f=sm.F;Uh(b);void 0===c&&(c=.5);return"rgba("+Math.round((sm.j-a)*c+a)+", "+Math.round((sm.u-d)*c+d)+", "+Math.round((sm.m-e)*c+e)+", "+Math.round((sm.F-f)*c+f)+")"}
t.Gx=function(){if(this.type===El)return tm(this.color);if((this.type===Hl||this.type===rl)&&null!==this.colorStops){var a=this.colorStops;if(this.type===rl)return tm(a.first().value);if(null!==a.get(.5))return tm(a.get(.5));if(2===a.count)return a=a.Fa(),tm(rm(a[0].value,a[1].value));for(var b=a.iterator,c=-1,d=-1,e=1,f=1;b.next();){var g=b.key,h=Math.abs(.5-b.key);e>f&&h<e?(c=g,e=h):f>=e&&h<f&&(d=g,f=h)}c>d&&(f=c,c=d,d=f,f=e);e=d-c;return tm(rm(a.get(c),a.get(d),1-f/e))}return!1};
function tm(a){if(!a)return!1;if(a instanceof ql)return a.Gx();Uh(a);return 128>(299*sm.j+587*sm.u+114*sm.m)/1E3}
function om(a,b){switch(b){case nm:b=100*um(sm.j);var c=100*um(sm.u),d=100*um(sm.m);vm.j=.4124564*b+.3575761*c+.1804375*d;vm.u=.2126729*b+.7151522*c+.072175*d;vm.m=.0193339*b+.119192*c+.9503041*d;vm.F=sm.F;b=wm(vm.j/xm[0]);c=wm(vm.u/xm[1]);d=wm(vm.m/xm[2]);ym.j=116*c-16;ym.u=500*(b-c);ym.m=200*(c-d);ym.F=vm.F;ym.j=Math.min(100,Math.max(0,ym.j+100*a));a=(ym.j+16)/116;b=a-ym.m/200;vm.j=xm[0]*zm(ym.u/500+a);vm.u=xm[1]*(ym.j>Am*Bm?Math.pow(a,3):ym.j/Am);vm.m=xm[2]*zm(b);vm.F=ym.F;a=-.969266*vm.j+1.8760108*
vm.u+.041556*vm.m;b=.0556434*vm.j+-.2040259*vm.u+1.0572252*vm.m;sm.j=255*Cm((3.2404542*vm.j+-1.5371385*vm.u+-.4985314*vm.m)/100);sm.u=255*Cm(a/100);sm.m=255*Cm(b/100);sm.F=vm.F;sm.j=Math.round(sm.j);255<sm.j?sm.j=255:0>sm.j&&(sm.j=0);sm.u=Math.round(sm.u);255<sm.u?sm.u=255:0>sm.u&&(sm.u=0);sm.m=Math.round(sm.m);255<sm.m?sm.m=255:0>sm.m&&(sm.m=0);return"rgba("+sm.j+", "+sm.u+", "+sm.m+", "+sm.F+")";case Dm: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){lm||(mm(),lm=!0);var b=Em;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,sm.j=a[0],sm.u=a[1],sm.m=a[2],sm.F=a[3]/255):(b.fillStyle="#FFFFFF",b.fillStyle=a,sm.j=0,sm.u=0,sm.m=0,sm.F=1)}}
function Vh(){var a=sm.j/255,b=sm.u/255,c=sm.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=sm.F}function um(a){a/=255;return.04045>=a?a/12.92:Math.pow((a+.055)/1.055,2.4)}function Cm(a){return.0031308>=a?12.92*a:1.055*Math.pow(a,1/2.4)-.055}
function wm(a){return a>Bm?Math.pow(a,1/3):(Am*a+16)/116}function zm(a){var b=a*a*a;return b>Bm?b:(116*a-16)/Am}function $l(a,b){"string"!==typeof a&&(a instanceof ql||C("Value for "+b+" must be a color string or a Brush, not "+a))}function mm(){Em=Ng?(new Pi(null,void 0,{willReadFrequently:!0})).context:null}
ma.Object.defineProperties(ql.prototype,{type:{get:function(){return this.na},set:function(a){this._isFrozen&&va(this,a);this.na=a;this.start.Lc()&&(a===Hl?this.start=tc:a===rl&&(this.start=xc));this.end.Lc()&&(a===Hl?this.end=Ac:a===rl&&(this.end=xc));this.we=null}},color:{get:function(){return this.vk},set:function(a){this._isFrozen&&va(this,a);this.vk=a;this.we=null}},start:{get:function(){return this.Ld},
set:function(a){this._isFrozen&&va(this,a);this.Ld=a.J();this.we=null}},end:{get:function(){return this.Jk},set:function(a){this._isFrozen&&va(this,a);this.Jk=a.J();this.we=null}},startRadius:{get:function(){return this.Cr},set:function(a){this._isFrozen&&va(this,a);0>a&&xa(a,">= zero",ql,"startRadius");this.Cr=a;this.we=null}},endRadius:{get:function(){return this.Tp},set:function(a){this._isFrozen&&va(this,
a);0>a&&xa(a,">= zero",ql,"endRadius");this.Tp=a;this.we=null}},colorStops:{get:function(){return this.ve},set:function(a){this._isFrozen&&va(this,a);this.ve=a;this.we=null}},pattern:{get:function(){return this.Zq},set:function(a){this._isFrozen&&va(this,a);this.Zq=a;this.we=null}}});ql.prototype.isDark=ql.prototype.Gx;ql.prototype.darkenBy=ql.prototype.Xy;ql.prototype.lightenBy=ql.prototype.Vz;ql.prototype.addColorStop=ql.prototype.addColorStop;
var Bm=216/24389,Am=24389/27,xm=[95.047,100,108.883],Em=null,sm=new km,Wh=new km,vm=new km,ym=new km,lm=!1;ql.className="Brush";var El;ql.Solid=El=new E(ql,"Solid",0);var Hl;ql.Linear=Hl=new E(ql,"Linear",1);var rl;ql.Radial=rl=new E(ql,"Radial",2);var Gl;ql.Pattern=Gl=new E(ql,"Pattern",4);var nm;ql.Lab=nm=new E(ql,"Lab",5);var Dm;ql.HSL=Dm=new E(ql,"HSL",6);
ql.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};
ql.isValidColor=function(a){if("black"===a)return!0;if(""===a)return!1;lm||(mm(),lm=!0);var b=Em;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};ql.lighten=function(a){return pm(a)};ql.lightenBy=pm;ql.darken=function(a){return qm(a)};ql.darkenBy=qm;ql.mix=rm;ql.isDark=tm;function Wl(){this.wa="Base"}Wl.prototype.measure=function(){};
Wl.prototype.Yz=function(a,b,c,d,e){a.measure(b,c,d,e)};Wl.prototype.arrange=function(){};Wl.prototype.Ny=function(a,b,c,d,e,f){a.arrange(b,c,d,e,f)};Wl.prototype.hA=function(a){a.Uj()};Wl.prototype.ec=function(){};ma.Object.defineProperties(Wl.prototype,{name:{get:function(){return this.wa},set:function(a){this.wa=a}},classType:{get:function(){return W}}});Wl.prototype.remeasureObject=Wl.prototype.hA;Wl.prototype.arrangeElement=Wl.prototype.Ny;
Wl.prototype.measureElement=Wl.prototype.Yz;Wl.className="PanelLayout";function Fm(){this.wa="Base"}la(Fm,Wl);
Fm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;a=Gm(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 Bf&&l.isGeometryPositioned&&(l=l.strokeWidth/2,p-=l,r-=l);Yb(e,p,r,n,m)}}};
Fm.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 Bf&&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 Hm(){this.wa="Base"}la(Hm,Wl);
Hm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;b=Ea();f=Gm(a);for(var k=0;k<h;k++){var l=d[k];if(l.visible||l===f){var m=jl(l,!1);if(m!==kg&&m!==Wk)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)};
Hm.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=jl(m,!1);if(isNaN(m.desiredSize.height)&&w===nd||w===Xk)u=Math.max(c.height-r-q,0);r=u+r+q;q=m.alignment;q.Vb()&&(q=a.defaultAlignment);q.vb()||(q=xc);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 Im(){this.wa="Base"}la(Im,Wl);
Im.prototype.measure=function(a,b,c,d,e,f){var g=d.length;c=Ea();for(var h=Gm(a),k=0;k<g;k++){var l=d[k];if(l.visible||l===h){var m=jl(l,!1);if(m!==kg&&m!==Xk)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;Pb(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)}};
Im.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=jl(m,!1);if(isNaN(m.desiredSize.width)&&w===nd||w===Wk)u=Math.max(c.width-r-q,0);r=u+r+q;q=m.alignment;q.Vb()&&(q=a.defaultAlignment);q.vb()||(q=xc);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 Jm(){this.wa="Base"}la(Jm,Wl);
Jm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.sb(),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=N.allocAt(-l.left,-l.top,r,q),v=N.allocAt(0,0,f,g);Km(k,v,!0);f=v.width;g=v.height;for(var y=!0,z=Gm(a),A=0;A<h;A++){var B=d[A];p=b;var D=c;if(B!==k&&(B.visible||B===z)){l=B.margin;var M=l.left,S=l.top;r=l.right+l.left;q=l.top+l.bottom;l=jl(B,!1);switch(l){case nd:p=
f;D=g;S=M=q=r=0;break;case Wk:p=f;M=r=0;break;case Xk:D=g,S=q=0}B.measure(p,D,0,0);p=B.measuredBounds;r=Math.max(p.width+r,0);q=Math.max(p.height+q,0);l=B.alignment;l.Vb()&&(l=a.defaultAlignment);l.vb()||(l=xc);var R=B.alignmentFocus;R.Vb()&&(R=xc);D=null;B instanceof W&&""!==B.Ze&&(D=B.fb(B.Ze),D===B&&(D=null));M=v.x-M;S=v.y-S;if(null!==D){B.arrange(0,0,p.width,p.height);p=D.actualBounds;p=J.allocAt(p.x+(R.x*p.width-R.offsetX),p.y+(R.y*p.height-R.offsetY));for(D=D.panel;D!==B;)D.transform.Ga(p),
D=D.panel;M+=l.x*f+l.offsetX-p.x;S+=l.y*g+l.offsetY-p.y;J.free(p)}else M+=l.x*f+l.offsetX-(R.x*p.width+R.offsetX),S+=l.y*g+l.offsetY-(R.y*p.height+R.offsetY);y?(y=!1,e.h(M,S,r,q)):Yb(e,M,S,r,q)}}y?e.assign(w):u?e.Uu(v.x,v.y,v.width,v.height):Yb(e,w.x,w.y,w.width,w.height);N.free(w);N.free(v);l=k.stretch;l===Yk&&(l=jl(k,!1));switch(l){case kg:return;case nd:if(!isFinite(b)&&!isFinite(c))return;break;case Wk:if(!isFinite(b))return;break;case Xk:if(!isFinite(c))return}p=k.measuredBounds;f=p.width;g=
p.height;r=Math.max(f+m,0);q=Math.max(g+n,0);l=k.margin;v=N.allocAt(-l.left,-l.top,r,q);Km(k,v,!0);f=v.width;g=v.height;for(b=0;b<h;b++)c=d[b],c===k||!c.visible&&c!==z||(l=c.margin,r=l.right+l.left,q=l.top+l.bottom,p=c.measuredBounds,r=Math.max(p.width+r,0),q=Math.max(p.height+q,0),m=c.alignment,m.Vb()&&(m=a.defaultAlignment),m.vb()||(m=xc),c=c.alignmentFocus,c.Vb()&&(c=xc),y?(y=!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)):Yb(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));y?e.assign(w):u?e.Uu(v.x,v.y,v.width,v.height):Yb(e,w.x,w.y,w.width,w.height);N.free(v)};
Jm.prototype.arrange=function(a,b,c){var d=b.length,e=a.sb(),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=N.allocAt(0,0,g,h);Km(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.Vb()&&(m=a.defaultAlignment);m.vb()||(m=xc);var q=n.alignmentFocus;q.Vb()&&(q=xc);l=null;n instanceof W&&""!==n.Ze&&(l=n.fb(n.Ze),l===n&&(l=null));if(null!==l){var u=l.actualBounds;q=J.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.Ga(q),l=l.panel;l=m.x*g.width+m.offsetX-q.x;m=m.y*g.height+m.offsetY-q.y;J.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)}}N.free(g)};
function Km(a,b,c){var d=null;a instanceof W&&""!==a.Ze&&(d=a.fb(a.Ze),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.mp(b),d=d.panel}function Lm(){this.wa="Base"}la(Lm,Wl);
Lm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.sb(),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 Bf&&(u=k,q=u.strokeWidth*u.scale);var w=Math.max(l.width+p,0);l=Math.max(l.height+r,0);var v=Mm(k),y=v.x*w+v.offsetX;v=v.y*l+v.offsetY;var z=Nm(k),A=z.x*w+z.offsetX;z=z.y*l+z.offsetY;isFinite(b)&&(m=Math.max(Math.abs(y-A)-q,0));isFinite(c)&&(n=Math.max(Math.abs(v-z)-q,0));q=L.alloc();q.h(0,0);a=Gm(a);for(z=0;z<h;z++)v=
d[z],v===k||!v.visible&&v!==a||(l=v.margin,w=l.right+l.left,y=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+y,0),q.h(Math.max(w,q.width),Math.max(l,q.height)));if(1===h)e.width=w,e.height=l,L.free(q);else{v=Mm(k);z=Nm(k);h=d=0;z.x!==v.x&&z.y!==v.y&&(d=q.width/Math.abs(z.x-v.x),h=q.height/Math.abs(z.y-v.y));L.free(q);q=0;null!==u&&(q=u.strokeWidth*u.scale,lg(u)===mg&&(d=h=Math.max(d,h)));d+=Math.abs(v.offsetX)+Math.abs(z.offsetX)+q;h+=Math.abs(v.offsetY)+
Math.abs(z.offsetY)+q;u=k.stretch;u===Yk&&(u=jl(k,!1));switch(u){case kg:g=f=0;break;case nd:isFinite(b)&&(d=b);isFinite(c)&&(h=c);break;case Wk:isFinite(b)&&(d=b);g=0;break;case Xk:f=0,isFinite(c)&&(h=c)}k.Uj();k.measure(d,h,f,g);e.width=k.measuredBounds.width+p;e.height=k.measuredBounds.height+r}};
Lm.prototype.arrange=function(a,b){var c=b.length,d=a.sb(),e=d.measuredBounds,f=N.alloc();f.h(0,0,1,1);var g=d.margin,h=g.left;g=g.top;var k=a.padding,l=k.left;k=k.top;d.arrange(l+h,k+g,e.width,e.height);var m=Mm(d),n=Nm(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;Yb(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.Vb()&&(p=a.defaultAlignment),p.vb()||(p=xc),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&&(Zb(f.x,f.y,f.width,f.height,k,g,l.width,l.height)?h.arrange(k,g,l.width,l.height):h.arrange(k,g,l.width,l.height,new N(f.x,f.y,f.width,f.height))));N.free(f)};function Om(){this.wa="Base";this.name="Table"}la(Om,Wl);
Om.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&&kl(m)&&l.visible){h.push(m);for(var n=m.O.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)}}else g.push(l)}f=g.length;0===f&&(a.ub(0),a.tb(0));for(var u=[],w=0;w<f;w++){var v=g[w];v.visible&&(pj(v,!0),ll(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 y=Ea(),z=Ea(),A=Ea(),B={count:0},D={count:0},M=b,S=c,R=a.rowDefs,I=a.colDefs,G=null;f=R.length;for(var ca=0;ca<f;ca++)G=R[ca],void 0!==G&&(G.actual=0);f=I.length;for(var X=0;X<f;X++)G=I[X],void 0!==G&&(G.actual=0);for(var na=u.length,wa=0,db=0;db<na;db++)u[db]&&(wa=Math.max(wa,u[db].length));var gb=Math.min(a.topIndex,na-1),Db=Math.min(a.leftIndex,wa-1),eb=0;na=u.length;for(var Ke=Gm(a),Ua=0;Ua<na;Ua++)if(u[Ua]){wa=u[Ua].length;var rd=a.ub(Ua);rd.actual=0;for(var Eb=rd.mc=0;Eb<wa;Eb++)if(u[Ua][Eb]){var Le=
a.tb(Eb);void 0===y[Eb]&&(Le.actual=0,Le.mc=0,y[Eb]=!0);for(var wc=u[Ua][Eb],Tc=wc.length,lc=0;lc<Tc;lc++){var dc=wc[lc];if(dc.visible||dc===Ke){var ef=1<dc.rowSpan||1<dc.columnSpan;ef&&(Ua<gb||Eb<Db||z.push(dc));var sd=dc.margin,wh=sd.right+sd.left,mc=sd.top+sd.bottom;var Fb=Ll(dc,rd,Le,!1);var yi=dc.desiredSize,rg=!isNaN(yi.height),Fd=!isNaN(yi.width)&&rg;ef||Fb===kg||Fd||Ua<gb||Eb<Db||(void 0!==B[Eb]||Fb!==nd&&Fb!==Wk||(B[Eb]=-1,B.count++),void 0!==D[Ua]||Fb!==nd&&Fb!==Xk||(D[Ua]=-1,D.count++),
A.push(dc));dc.measure(Infinity,Infinity,0,0);if(!(Ua<gb||Eb<Db)){var ec=dc.measuredBounds,Kf=Math.max(ec.width+wh,0),nc=Math.max(ec.height+mc,0);if(1===dc.rowSpan&&(Fb===kg||Fb===Wk)){G=a.ub(Ua);var ff=G.Tc();eb=Math.max(nc-G.actual,0);eb+ff>S&&(eb=Math.max(S-ff,0));var mk=0===G.oa;G.mc=G.mc+eb;G.actual=G.oa+eb;S=Math.max(S-(eb+(mk?ff:0)),0)}if(1===dc.columnSpan&&(Fb===kg||Fb===Xk)){G=a.tb(Eb);var zi=G.Tc();eb=Math.max(Kf-G.actual,0);eb+zi>M&&(eb=Math.max(M-zi,0));var Pn=0===G.oa;G.mc=G.mc+eb;G.actual=
G.oa+eb;M=Math.max(M-(eb+(Pn?zi:0)),0)}ef&&dc.Uj()}}}}}Ga(y);var Td=0,oe=0;f=a.columnCount;for(var sg=0;sg<f;sg++){var gf=I[sg];void 0!==gf&&(Td+=isNaN(gf.Gc)?gf.mc:gf.Gc,0!==gf.mc&&(Td+=gf.Tc()))}f=a.rowCount;for(var xh=0;xh<f;xh++){var hf=R[xh];void 0!==hf&&(oe+=isNaN(hf.Gc)?hf.mc:hf.Gc,0!==hf.mc&&(oe+=hf.Tc()))}M=Math.max(b-Td,0);var Ud=S=Math.max(c-oe,0),Me=M;f=A.length;for(var fc=0;fc<f;fc++){var Gd=A[fc],nk=a.ub(Gd.row),pe=a.tb(Gd.column),yh=Gd.measuredBounds,td=Gd.margin,Lf=td.right+td.left,
Hd=td.top+td.bottom;B[Gd.column]=0===pe.mc&&void 0!==B[Gd.column]?Math.max(yh.width+Lf,B[Gd.column]):null;D[Gd.row]=0===nk.mc&&void 0!==D[Gd.row]?Math.max(yh.height+Hd,D[Gd.row]):null}var tg=0,zh=0,ed;for(ed in D)"count"!==ed&&(tg+=D[ed]);for(ed in B)"count"!==ed&&(zh+=B[ed]);for(var hb=L.alloc(),Ai=0;Ai<f;Ai++){var Sb=A[Ai];if(Sb.visible||Sb===Ke){var Va=a.ub(Sb.row),Tb=a.tb(Sb.column),qe=0;isFinite(Tb.width)?qe=Tb.width:(isFinite(M)&&null!==B[Sb.column]?0===zh?qe=Tb.actual+M:qe=B[Sb.column]/zh*
Me:null!==B[Sb.column]?qe=M:qe=Tb.actual||M,qe=Math.max(0,qe-Tb.Tc()));var Ne=0;isFinite(Va.height)?Ne=Va.height:(isFinite(S)&&null!==D[Sb.row]?0===tg?Ne=Va.actual+S:Ne=D[Sb.row]/tg*Ud:null!==D[Sb.row]?Ne=S:Ne=Va.actual||S,Ne=Math.max(0,Ne-Va.Tc()));hb.h(Math.max(Tb.minimum,Math.min(qe,Tb.maximum)),Math.max(Va.minimum,Math.min(Ne,Va.maximum)));Fb=Ll(Sb,Va,Tb,!1);switch(Fb){case Wk:hb.height=Math.max(hb.height,Va.actual+S);break;case Xk:hb.width=Math.max(hb.width,Tb.actual+M)}var Mf=Sb.margin,Qn=Mf.right+
Mf.left,ok=Mf.top+Mf.bottom;Sb.Uj();Sb.measure(hb.width,hb.height,Tb.minimum,Va.minimum);var Ah=Sb.measuredBounds,Nf=Math.max(Ah.width+Qn,0),ug=Math.max(Ah.height+ok,0);isFinite(M)&&(Nf=Math.min(Nf,hb.width));isFinite(S)&&(ug=Math.min(ug,hb.height));var gc=0;gc=Va.actual;Va.actual=Math.max(Va.actual,ug);Va.mc=Math.max(Va.mc,ug);eb=Va.actual-gc;S=Math.max(S-eb,0);null===D[Sb.row]&&(Ud=Math.max(Ud-eb,0));gc=Tb.actual;Tb.actual=Math.max(Tb.actual,Nf);Tb.mc=Math.max(Tb.mc,Nf);eb=Tb.actual-gc;M=Math.max(M-
eb,0);null===B[Sb.column]&&(Me=Math.max(Me-eb,0))}}Ga(A);var Id=L.alloc(),ud=Ea(),Hc=Ea();f=z.length;if(0!==f)for(var jf=0;jf<na;jf++)if(u[jf]){wa=u[jf].length;var Bh=a.ub(jf);ud[jf]=Bh.actual;for(var kf=0;kf<wa;kf++)if(u[jf][kf]){var pk=a.tb(kf);Hc[kf]=pk.actual}}for(var Ch=0;Ch<f;Ch++){var Pa=z[Ch];if(Pa.visible||Pa===Ke){var fd=a.ub(Pa.row),Uc=a.tb(Pa.column);hb.h(Math.max(Uc.minimum,Math.min(b,Uc.maximum)),Math.max(fd.minimum,Math.min(c,fd.maximum)));Fb=Ll(Pa,fd,Uc,!1);switch(Fb){case nd:0!==
Hc[Uc.index]&&(hb.width=Math.min(hb.width,Hc[Uc.index]));0!==ud[fd.index]&&(hb.height=Math.min(hb.height,ud[fd.index]));break;case Wk:0!==Hc[Uc.index]&&(hb.width=Math.min(hb.width,Hc[Uc.index]));break;case Xk:0!==ud[fd.index]&&(hb.height=Math.min(hb.height,ud[fd.index]))}isFinite(Uc.width)&&(hb.width=Uc.width);isFinite(fd.height)&&(hb.height=fd.height);Id.h(0,0);for(var qk=Uc.minimum,oc=fd.minimum,Oe=1;Oe<Pa.rowSpan&&!(Pa.row+Oe>=a.rowCount);Oe++)G=a.ub(Pa.row+Oe),eb=0,eb=Fb===nd||Fb===Xk?Math.max(G.minimum,
0===ud[Pa.row+Oe]?G.maximum:Math.min(ud[Pa.row+Oe],G.maximum)):Math.max(G.minimum,isNaN(G.Gc)?G.maximum:Math.min(G.Gc,G.maximum)),Id.height+=eb,oc+=G.minimum;for(var Vc=1;Vc<Pa.columnSpan&&!(Pa.column+Vc>=a.columnCount);Vc++)G=a.tb(Pa.column+Vc),eb=0,eb=Fb===nd||Fb===Wk?Math.max(G.minimum,0===Hc[Pa.column+Vc]?G.maximum:Math.min(Hc[Pa.column+Vc],G.maximum)):Math.max(G.minimum,isNaN(G.Gc)?G.maximum:Math.min(G.Gc,G.maximum)),Id.width+=eb,qk+=G.minimum;hb.width+=Id.width;hb.height+=Id.height;var Dh=Pa.margin,
lf=Dh.right+Dh.left,Bi=Dh.top+Dh.bottom;Pa.measure(hb.width,hb.height,qk,oc);for(var Eh=Pa.measuredBounds,Jd=Math.max(Eh.width+lf,0),Of=Math.max(Eh.height+Bi,0),mf=0,Fh=0;Fh<Pa.rowSpan&&!(Pa.row+Fh>=a.rowCount);Fh++)G=a.ub(Pa.row+Fh),mf+=G.total||0;if(mf<Of){var Pe=Of-mf,Vd=Of-mf;if(null!==Pa.spanAllocation)for(var Qe=Pa.spanAllocation,re=0;re<Pa.rowSpan&&!(0>=Pe)&&!(Pa.row+re>=a.rowCount);re++){G=a.ub(Pa.row+re);var Re=G.oa||0,Pf=Qe(Pa,G,Vd);G.actual=Math.min(G.maximum,Re+Pf);G.oa!==Re&&(Pe-=G.oa-
Re)}for(;0<Pe;){var vd=G.oa||0;isNaN(G.height)&&G.maximum>vd&&(G.actual=Math.min(G.maximum,vd+Pe),G.oa!==vd&&(Pe-=G.oa-vd));if(0===G.index)break;G=a.ub(G.index-1)}}for(var vg=0,Se=0;Se<Pa.columnSpan&&!(Pa.column+Se>=a.columnCount);Se++)G=a.tb(Pa.column+Se),vg+=G.total||0;if(vg<Jd){var wg=Jd-vg,Rn=Jd-vg;if(null!==Pa.spanAllocation)for(var se=Pa.spanAllocation,Qf=0;Qf<Pa.columnSpan&&!(0>=wg)&&!(Pa.column+Qf>=a.columnCount);Qf++){G=a.tb(Pa.column+Qf);var Ci=G.oa||0,Sn=se(Pa,G,Rn);G.actual=Math.min(G.maximum,
Ci+Sn);G.oa!==Ci&&(wg-=G.oa-Ci)}for(;0<wg;){var rk=G.oa||0;isNaN(G.width)&&G.maximum>rk&&(G.actual=Math.min(G.maximum,rk+wg),G.oa!==rk&&(wg-=G.oa-rk));if(0===G.index)break;G=a.tb(G.index-1)}}}}Ga(z);L.free(Id);L.free(hb);void 0!==ud&&Ga(ud);void 0!==Hc&&Ga(Hc);var xg=0,yg=0,sk=a.desiredSize,Cr=a.maxSize;Fb=jl(a,!0);var Di=oe=Td=0,Ei=0;f=a.columnCount;for(var tk=0;tk<f;tk++)void 0!==I[tk]&&(G=a.tb(tk),isFinite(G.width)?(Di+=G.width,Di+=G.Tc()):Pm(G)===Qm?(Di+=G.oa,Di+=G.Tc()):0!==G.oa&&(Td+=G.oa,Td+=
G.Tc()));isFinite(sk.width)?xg=Math.min(sk.width,Cr.width):xg=Fb!==kg&&isFinite(b)?b:Td;xg=Math.max(xg,a.minSize.width);xg=Math.max(xg-Di,0);for(var pu=0===Td?1:Math.max(xg/Td,1),vk=0;vk<f;vk++)void 0!==I[vk]&&(G=a.tb(vk),isFinite(G.width)||Pm(G)===Qm||(G.actual=G.oa*pu),G.position=e.width,0!==G.oa&&(e.width+=G.oa,e.width+=G.Tc()));f=a.rowCount;for(var wk=0;wk<f;wk++)void 0!==R[wk]&&(G=a.ub(wk),isFinite(G.height)?(Ei+=G.height,Ei+=G.Tc()):Pm(G)===Qm?(Ei+=G.oa,Ei+=G.Tc()):0!==G.oa&&(oe+=G.oa,oe+=G.Tc()));
isFinite(sk.height)?yg=Math.min(sk.height,Cr.height):yg=Fb!==kg&&isFinite(c)?c:oe;yg=Math.max(yg,a.minSize.height);yg=Math.max(yg-Ei,0);for(var qu=0===oe?1:Math.max(yg/oe,1),xk=0;xk<f;xk++)void 0!==R[xk]&&(G=a.ub(xk),isFinite(G.height)||Pm(G)===Qm||(G.actual=G.oa*qu),G.position=e.height,0!==G.oa&&(e.height+=G.oa,e.height+=G.Tc()));f=h.length;for(var Tn=0;Tn<f;Tn++){var Gi=h[Tn],Un=0,Vn=0;Gi.type===W.TableRow?(Un=e.width,G=a.ub(Gi.row),Vn=G.actual):(G=a.tb(Gi.column),Un=G.actual,Vn=e.height);Gi.measuredBounds.h(0,
0,Un,Vn);pj(Gi,!1)}Ga(h);a.inRowsCols=u};
Om.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].oa);)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].oa);)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.ub(u);a.tb(w);for(var v=0;v<b.length;v++){var y=b[v];if(y instanceof W&&y.visible&&kl(y)){if(y.type===W.TableRow){h=a.ub(y.row);var z=a.tb(w)}else h=a.ub(u),z=a.tb(y.column);k=h.position+n+e;0!==h.oa&&(k+=h.Ho(Math.max(u,r)));h=z.position+p+f;0!==z.oa&&(h+=z.Ho(Math.max(w,q)));z=y.measuredBounds;y.Sk();y.actualBounds.ja();var A=y.actualBounds,B=N.allocAt(A.x,A.y,A.width,A.height);A.x=y.type===W.TableRow?f:h;A.y=y.type===W.TableColumn?
e:k;A.width=z.width;A.height=z.height;y.actualBounds.freeze();ll(y,!1);Ub(B,A)||null===m||(m.mh(),y.On(m));N.free(B)}}v=L.alloc();for(y=0;y<l;y++)if(g[y])for(m=g[y].length,z=a.ub(y),k=z.position+n+e,0!==z.oa&&(k+=z.Ho(Math.max(u,r))),A=0;A<m;A++)if(g[y][A]){B=a.tb(A);h=B.position+p+f;0!==B.oa&&(h+=B.Ho(Math.max(w,q)));for(var D=g[y][A],M=D.length,S=0;S<M;S++){var R=D[S],I=R.measuredBounds;v.h(0,0);for(var G=1;G<R.rowSpan&&!(y+G>=a.rowCount);G++){var ca=a.ub(y+G);0!==ca.oa&&(v.height+=ca.total)}for(G=
1;G<R.columnSpan&&!(A+G>=a.columnCount);G++)ca=a.tb(A+G),0!==ca.oa&&(v.width+=ca.total);var X=B.oa+v.width,na=z.oa+v.height;G=h;ca=k;var wa=X,db=na,gb=h,Db=k,eb=X,Ke=na;h+X>c.width&&(eb=Math.max(c.width-h,0));k+na>c.height&&(Ke=Math.max(c.height-k,0));var Ua=R.alignment;if(Ua.Vb()){Ua=a.defaultAlignment;Ua.vb()||(Ua=xc);var rd=Ua.x;var Eb=Ua.y;var Le=Ua.offsetX;Ua=Ua.offsetY;var wc=B.alignment,Tc=z.alignment;wc.vb()&&(rd=wc.x,Le=wc.offsetX);Tc.vb()&&(Eb=Tc.y,Ua=Tc.offsetY)}else rd=Ua.x,Eb=Ua.y,Le=
Ua.offsetX,Ua=Ua.offsetY;if(isNaN(rd)||isNaN(Eb))Eb=rd=.5,Ua=Le=0;wc=I.width;Tc=I.height;var lc=R.margin,dc=lc.left+lc.right,ef=lc.top+lc.bottom,sd=Ll(R,z,B,!1);!isNaN(R.desiredSize.width)||sd!==nd&&sd!==Wk||(wc=Math.max(X-dc,0));!isNaN(R.desiredSize.height)||sd!==nd&&sd!==Xk||(Tc=Math.max(na-ef,0));X=R.maxSize;na=R.minSize;wc=Math.min(X.width,wc);Tc=Math.min(X.height,Tc);wc=Math.max(na.width,wc);Tc=Math.max(na.height,Tc);X=Tc+ef;G+=wa*rd-(wc+dc)*rd+Le+lc.left;ca+=db*Eb-X*Eb+Ua+lc.top;R.visible&&
(Zb(gb,Db,eb,Ke,G,ca,I.width,I.height)?R.arrange(G,ca,wc,Tc):R.arrange(G,ca,wc,Tc,new N(gb,Db,eb,Ke)))}}L.free(v);for(a=0;a<d;a++)c=b[a],f=c instanceof W?c:null,null!==f&&kl(f)&&(f=c.actualBounds,c.naturalBounds.ja(),c.naturalBounds.h(0,0,f.width,f.height),c.naturalBounds.freeze())}};function Rm(){this.wa="Base"}la(Rm,Wl);Rm.prototype.measure=function(){};Rm.prototype.arrange=function(){};function Sm(){this.wa="Base"}la(Sm,Wl);Sm.prototype.measure=function(){};Sm.prototype.arrange=function(){};
function Tm(){this.wa="Base"}la(Tm,Wl);
Tm.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.Aa=1;d.Uj();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===mg?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.Aa*=q;m!==d.scale&&(pj(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)};Tm.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.Vb()&&(g=a.defaultAlignment);g.vb()||(g=xc);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 Um(){this.wa="Base"}la(Um,Wl);Um.prototype.measure=function(){};
Um.prototype.arrange=function(){};
Um.prototype.ec=function(a,b,c){c=a.Df()*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();b.Re();for(var r=[],q=a.O.s,u=q.length,w=0;w<u;w++){var v=q[w],y=[];r.push(y);if(v.visible){var z=v.interval;if(!(0>z)){v=Zj(v.figure);for(var A=0;A<u;A++)if(A!==w){var B=q[A];B.visible&&Zj(B.figure)===v&&(B=B.interval,B>z&&y.push(B))}}}}q=
a.O.s;u=q.length;for(w=0;w<u;w++){var D=q[w];if(D.visible&&(y=D.interval||1,v=Math.abs(y),!(2>e*v*c))){z=D.segmentIndex;if(!isFinite(z)||isNaN(z))z=0;0>z&&(z=v-Math.min(-z,v));z=Math.round(z%v);v=D.opacity;A=1;if(1!==v){if(0===v)continue;A=b.globalAlpha;b.globalAlpha=A*v}B=r[w];var M=!1,S=D.strokeDashArray;null!==S&&(M=!0,b.fs(S,D.strokeDashOffset));if("LineV"===D.figure&&null!==D.stroke&&0<D.strokeWidth){b.lineWidth=D.strokeWidth;ji(a,b,D.stroke,!1,!1,f,g);b.beginPath();for(S=D=Math.floor((p-e)/
e);S<=D+l;S++){var R=S*e+p;0<=R&&R<=h&&Vm(S,y,z,B)&&(b.moveTo(R,0),b.lineTo(R,k))}b.stroke();b.Re()}else if("LineH"===D.figure&&null!==D.stroke&&0<D.strokeWidth){b.lineWidth=D.strokeWidth;ji(a,b,D.stroke,!1,!1,f,g);b.beginPath();for(S=D=Math.floor((n-d)/d);S<=D+m;S++)R=S*d+n,0<=R&&R<=k&&Vm(S,y,z,B)&&(b.moveTo(0,R),b.lineTo(h,R));b.stroke();b.Re()}else if("BarV"===D.figure&&null!==D.fill)for(ji(a,b,D.fill,!0,!1,f,g),D=D.width,isNaN(D)&&(D=e),R=S=Math.floor((p-e)/e);R<=S+l;R++){var I=R*e+p;0<=I+D&&
I<=h&&Vm(R,y,z,B)&&b.fillRect(I,0,D,k)}else if("BarH"===D.figure&&null!==D.fill)for(ji(a,b,D.fill,!0,!1,f,g),D=D.height,isNaN(D)&&(D=d),R=S=Math.floor((n-d)/d);R<=S+m;R++)I=R*d+n,0<=I+D&&I<=k&&Vm(R,y,z,B)&&b.fillRect(0,I,h,D);M&&b.cs();1!==v&&(b.globalAlpha=A)}}b.restore();b.Sc(!1)};function Vm(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 Wm(){this.wa="Base"}la(Wm,Wl);
Wm.prototype.measure=function(a,b,c,d,e){var f=d.length;if(a instanceof te||a instanceof T){var g=null,h=null;a instanceof T&&(g=a);a instanceof te&&(h=a,g=h.adornedPart,null===a.j&&(a.j=[]));if(g instanceof T){var k=g;if(0===f)Pb(a.naturalBounds,0,0),a.measuredBounds.h(0,0,0,0);else{var l=a instanceof te?null:g.path;b=g.routeBounds;c=a.ig;c.h(0,0,b.width,b.height);var m=k.points,n=g.pointsCount;null!==h?h.Sl(!1):null!==g&&g.Sl(!1);h=b.width;var p=b.height,r=a.j;r.length=0;if(null!==l){Xm(a,h,p,l);
var q=l.measuredBounds;c.ad(q);r.push(q)}q=ld.alloc();for(var u=J.alloc(),w=J.alloc(),v=0;v<f;v++){var y=d[v];if(y!==l)if(y.isPanelMain&&y instanceof Bf){Xm(a,h,p,y);var z=y.measuredBounds;c.ad(z);r.push(z)}else if(2>n)y.measure(Infinity,Infinity,0,0),z=y.measuredBounds,c.ad(z),r.push(z);else{var A=y.segmentIndex,B=y.segmentFraction,D=y.alignmentFocus;D.Lc()&&(D=xc);var M=y.segmentOrientation,S=y.segmentOffset;if(isNaN(A)){var R=k.ta;z=Ea();R.Qu(B,z);var I=J.allocAt(z[0],z[1]);I.add(k.i(0));R.type===
P.j?I.offset(-R.startX,-R.startY):(R=R.figures.first(),null!==R&&I.offset(-R.startX,-R.startY));R=z[2];if(M!==Zf){var G=k.computeAngle(y,M,R);y.Kb=G}G=I.x-b.x;var ca=I.y-b.y;J.free(I);Ga(z)}else if(A<-n||A>=n)z=J.alloc(),k.ug(),k.computeMidPoint(z),R=k.midAngle,M!==Zf&&(G=k.computeAngle(y,M,R),y.Kb=G),G=z.x-b.x,ca=z.y-b.y,J.free(z);else{G=0;0<=A?(ca=m.L(A),z=A<n-1?m.L(A+1):ca):(G=n+A,ca=m.L(G),z=0<G?m.L(G-1):ca);if(ca.Xa(z)){0<=A?(R=0<A?m.L(A-1):ca,G=A<n-2?m.L(A+2):z):(R=G<n-1?m.L(G+1):ca,G=1<G?m.L(G-
2):z);I=R.Bf(ca);var X=z.Bf(G);R=I>X+10?0<=A?R.ab(ca):ca.ab(R):X>I+10?0<=A?z.ab(G):G.ab(z):0<=A?R.ab(G):G.ab(R)}else R=0<=A?ca.ab(z):z.ab(ca);M!==Zf&&(G=k.computeAngle(y,M,R),y.Kb=G);G=ca.x+(z.x-ca.x)*B-b.x;ca=ca.y+(z.y-ca.y)*B-b.y}y.measure(Infinity,Infinity,0,0);z=y.measuredBounds;I=y.naturalBounds;var na=0;y instanceof Bf&&(na=y.strokeWidth);X=I.width+na;var wa=I.height+na;q.reset();q.translate(-z.x,-z.y);q.scale(y.scale,y.scale);q.rotate(M===Zf?y.angle:R,X/2,wa/2);M!==Ym&&M!==Zm||q.rotate(90,
X/2,wa/2);M!==$m&&M!==an||q.rotate(-90,X/2,wa/2);M===bn&&(45<R&&135>R||225<R&&315>R)&&q.rotate(-R,X/2,wa/2);I=new N(0,0,X,wa);u.wi(I,D);q.Ga(u);D=-u.x+na/2*y.scale;y=-u.y+na/2*y.scale;w.assign(S);na=isNaN(S.x);var db=isNaN(S.y);if(na||db){X=X/2+3;wa=wa/2+3;var gb=45<=R&&135>=R,Db=225<=R&&315>=R;M===Zf&&(gb||Db)?(w.x=db?X:S.y,w.y=na?wa:S.x,gb?0<=A||isNaN(A)&&.5>B||!na||(w.y=-wa):Db&&((0<=A||isNaN(A)&&.5>B)&&na&&(w.y=-wa),db&&(w.x=-X))):(na&&(w.x=0<=A||isNaN(A)&&.5>B?X:-X),db&&(w.y=-wa),w.rotate(R))}else w.rotate(R);
G+=w.x;ca+=w.y;I.set(z);I.h(G+D,ca+y,z.width,z.height);r.push(I);c.ad(I)}}if(null!==g)for(d=g.labelNodes;d.next();)d.value.measure(Infinity,Infinity);a.ig=c;a.position.h(b.x+c.x,b.y+c.y);Pb(e,c.width||0,c.height||0);ld.free(q);J.free(u);J.free(w)}}}};
Wm.prototype.arrange=function(a,b){var c=b.length;if(a instanceof te||a instanceof T){var d=a,e=null;a instanceof te&&(e=a,d=e.adornedPart);var f=a instanceof te?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.ig.x,k.y-a.ig.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.ig.x,m.y-a.ig.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.ta;var q=Ea();r.Qu(k,q);var u=J.allocAt(q[0],q[1]);u.add(n.i(0));r.type===P.j?u.offset(-r.startX,-r.startY):(r=r.figures.first(),u.offset(-r.startX,-r.startY));r=q[2];l!==Zf&&(n=n.computeAngle(g,l,r),g.angle=n);n=u.x;var w=u.y;J.free(u);Ga(q)}else if(h<-c||h>=c)q=J.alloc(),r=n,w=q,r.ug(),r.computeMidPoint(w),r=n.midAngle,l!==Zf&&(n=n.computeAngle(g,l,r),g.angle=n),n=q.x,w=q.y,
J.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.Xa(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.Bf(q),y=w.Bf(u);r=v>y+10?0<=h?r.ab(q):q.ab(r):y>v+10?0<=h?w.ab(u):u.ab(w):0<=h?r.ab(u):u.ab(r)}else r=0<=h?q.ab(w):w.ab(q);l!==Zf&&(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.vs())g.location=new J(n,w);else{p.Lc()&&(p=xc);q=ld.alloc();q.reset();q.scale(g.scale,g.scale);q.rotate(g.angle,
0,0);var z=g.naturalBounds;u=N.allocAt(0,0,z.width,z.height);v=J.alloc();v.wi(u,p);q.Ga(v);p=-v.x;y=-v.y;var A=z.width,B=z.height;z=J.alloc();z.assign(m);var D=isNaN(m.x),M=isNaN(m.y);if(D||M){A=A/2+3;B=B/2+3;var S=45<=r&&135>=r,R=225<=r&&315>=r;l===Zf&&(S||R)?(z.x=M?A:m.y,z.y=D?B:m.x,S?0<=h||isNaN(h)&&.5>k||!D||(z.y=-B):R&&((0<=h||isNaN(h)&&.5>k)&&D&&(z.y=-B),M&&(z.x=-A))):(D&&(z.x=0<=h||isNaN(h)&&.5>k?A:-A),M&&(z.y=-B),z.rotate(r))}else z.rotate(r);n+=z.x;w+=z.y;q.mp(u);p+=u.x;y+=u.y;h=J.allocAt(n+
p,w+y);g.move(h);J.free(h);J.free(z);J.free(v);N.free(u);ld.free(q)}}null!==e?e.Sl(!1):d.Sl(!1);d=cn(a);a.location.h(a.position.x+d.x,a.position.y+d.y);J.free(d)}};
function Xm(a,b,c,d){if(!1!==uj(d)){var e=d.strokeWidth;0===e&&a instanceof te&&a.type===W.Link&&a.adornedObject instanceof Bf&&(e=a.adornedObject.strokeWidth);e*=d.Aa;a instanceof T&&null!==a.ta?(a=a.geometry.bounds,d.Fe(a.x-e/2,a.y-e/2,a.width+e,a.height+e)):a instanceof te&&null!==a.adornedPart.ta?(a=a.adornedPart.ta.bounds,d.Fe(a.x-e/2,a.y-e/2,a.width+e,a.height+e)):d.Fe(-(e/2),-(e/2),b+e,c+e);e=d.desiredSize;e.w()||null===d.ta?d.cc.h(0,0,e.width,e.height):d.cc.assign(d.ta.bounds);pj(d,!1)}}
function dn(){this.wa="Base"}la(dn,Wl);
dn.prototype.measure=function(a,b,c,d,e,f,g){var h=a.sb();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 N(-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,y=u.length,z=0,A=0,B=Ea(),D=0;D<y;D++){var M=u[D],S=[];A=z=0;for(var R=M.length,I=0;I<R;I+=2){var G=M[I],ca=M[I+1];if(0!==
I){var X=180*Math.atan2(ca-A,G-z)/Math.PI;0>X&&(X+=360);S.push(X)}z=G;A=ca}B.push(S)}if(null===a.graduatedIntervals){for(var na=[],wa=a.O.s,db=wa.length,gb=0;gb<db;gb++){var Db=wa[gb],eb=[];na.push(eb);if(Db.visible){var Ke=Db.interval;if(!(0>Ke))for(var Ua=0;Ua<db;Ua++)if(Ua!==gb){var rd=wa[Ua];if(rd.visible&&Db.constructor===rd.constructor){var Eb=rd.interval;Eb>Ke&&eb.push(Eb)}}}}a.graduatedIntervals=na}var Le=a.graduatedIntervals;var wc=a.O.s,Tc=wc.length,lc=0,dc=0,ef=v;a.graduatedMarks=[];for(var sd,
wh=0;wh<Tc;wh++){var mc=wc[wh];sd=[];if(mc.visible&&mc!==h){var Fb=Math.abs(mc.interval),yi=a.graduatedTickUnit;if(!(2>yi*Fb*v/a.graduatedRange&&null===mc.graduatedSkip)){var rg=w[0][0],Fd=0,ec=0;dc=v*mc.graduatedStart-1E-4;ef=v*mc.graduatedEnd+1E-4;var Kf=yi*Fb,nc=a.graduatedTickBase;if(nc<a.graduatedMin){var ff=(a.graduatedMin-nc)/Kf;ff=0===ff%1?ff:Math.floor(ff+1);nc+=ff*Kf}else nc>a.graduatedMin+Kf&&(nc-=Math.floor((nc-a.graduatedMin)/Kf)*Kf);for(var mk=Le[wh],zi=nc,Pn=1E-6*a.graduatedMax,Td=
1;nc<=a.graduatedMax+Pn;Td++){a:{for(var oe=mk.length,sg=0;sg<oe;sg++){var gf=(nc-a.graduatedTickBase)%(mk[sg]*a.graduatedTickUnit),xh=1E-6*a.graduatedTickUnit;if(gf<xh&&gf>-xh){var hf=!1;break a}}hf=!0}if(hf&&(nc>a.graduatedMax&&(nc=a.graduatedMax),null===mc.graduatedSkip||mc instanceof Pg&&!mc.graduatedSkip(nc,mc)||mc instanceof Bf&&!mc.graduatedSkip(nc,mc))&&(lc=(nc-a.graduatedMin)*v/a.graduatedRange,lc>v&&(lc=v),dc<=lc&&lc<=ef)){for(var Ud=B[Fd][ec],Me=w[Fd][ec];Fd<w.length;){for(;lc>rg&&ec<w[Fd].length-
1;)ec++,Ud=B[Fd][ec],Me=w[Fd][ec],rg+=Me;if(lc<=rg)break;Fd++;ec=0;Ud=B[Fd][ec];Me=w[Fd][ec];rg+=Me}var fc=u[Fd],Gd=fc[2*ec],nk=fc[2*ec+1],pe=(lc-(rg-Me))/Me,yh=new J(Gd+(fc[2*ec+2]-Gd)*pe+q/2-r.bounds.x,nk+(fc[2*ec+3]-nk)*pe+q/2-r.bounds.y);yh.scale(h.scale,h.scale);a:{var td=Ud,Lf=B[Fd];if(!(.5005>pe&&.4995<pe)){var Hd=td;.5>pe?0<ec?Hd=Lf[ec-1]:K.$(fc[0],fc[fc.length-2])&&K.$(fc[1],fc[fc.length-1])&&(Hd=Lf[Lf.length-1]):.5<pe&&(ec+1<Lf.length?Hd=Lf[ec+1]:K.$(fc[0],fc[fc.length-2])&&K.$(fc[1],fc[fc.length-
1])&&(Hd=Lf[0]));if(td!==Hd){var tg=Math.abs(td-Hd);180<tg&&(td<Hd?td+=360:Hd+=360,tg=Math.abs(td-Hd));if(5E-4>pe||.9995<pe){Ud=(td+Hd)/2%360;break a}if(10>tg){var zh=1-Math.abs(.5-pe);Ud=(td*zh+Hd*(1-zh))%360;break a}}}Ud=td}if(mc instanceof Pg){var ed="";null!==mc.graduatedFunction?(ed=mc.graduatedFunction(nc,mc),ed=null!==ed&&void 0!==ed?ed.toString():""):ed=(+nc.toFixed(2)).toString();""!==ed&&sd.push({Yl:yh,angle:Ud,text:ed})}else sd.push({Yl:yh,angle:Ud})}nc=zi+Td*Kf}}}a.graduatedMarks.push(sd)}Ga(B);
var hb=a.graduatedMarks;if(null!==hb)for(var Ai=d.length,Sb=0;Sb<Ai;Sb++){var Va=d[Sb],Tb=hb[Sb];if(Va.visible&&Va!==h&&0!==Tb.length){if(Va instanceof Bf){var qe=a,Ne=e,Mf=Va.alignmentFocus;Mf.Lc()&&(Mf=tc);var Qn=Va.angle;Va.Kb=0;Va.measure(Infinity,Infinity,0,0);Va.Kb=Qn;var ok=Va.measuredBounds,Ah=ok.width,Nf=ok.height,ug=N.allocAt(0,0,Ah,Nf),gc=J.alloc();gc.wi(ug,Mf);N.free(ug);for(var Id=-gc.x,ud=-gc.y,Hc=new N,jf=Tb.length,Bh=0;Bh<jf;Bh++)for(var kf=Tb[Bh],pk=kf.Yl.x,Ch=kf.Yl.y,Pa=kf.angle,
fd=0;4>fd;fd++){switch(fd){case 0:gc.h(Id,ud);break;case 1:gc.h(Id+Ah,ud);break;case 2:gc.h(Id,ud+Nf);break;case 3:gc.h(Id+Ah,ud+Nf)}gc.rotate(Pa+Va.angle);gc.offset(pk,Ch);0===Bh&&0===fd?Hc.h(gc.x,gc.y,0,0):Hc.Xe(gc);gc.offset(-pk,-Ch);gc.rotate(-Pa-Va.angle)}J.free(gc);null!==qe.graduatedBounds&&qe.graduatedBounds.push(Hc);Yb(Ne,Hc.x,Hc.y,Hc.width,Hc.height)}else if(Va instanceof Pg){var Uc=a,qk=e;null===Uc.temporaryTextBlock&&(Uc.temporaryTextBlock=new Pg);var oc=Uc.temporaryTextBlock;en(oc,Va);
var Oe=Va.alignmentFocus;Oe.Lc()&&(Oe=tc);for(var Vc=Va.segmentOrientation,Dh=Va.segmentOffset,lf=new N,Bi=0,Eh=0,Jd=0,Of=0,mf=0,Fh=Tb.length,Pe=0;Pe<Fh;Pe++){var Vd=Tb[Pe];Bi=Vd.Yl.x;Eh=Vd.Yl.y;Jd=Vd.angle;mf=Of=Va.angle;Vc!==Zf&&(mf=Vc===fn||Vc===gn?Jd+Va.angle:Jd,Of=T.computeAngle(Vc,mf));oc.Kb=Of;oc.text=Vd.text||"";oc.measure(Infinity,Infinity,0,0);var Qe=oc.measuredBounds,re=oc.naturalBounds,Re=re.width,Pf=re.height,vd=ld.alloc();vd.reset();vd.translate(-Qe.x,-Qe.y);vd.scale(oc.scale,oc.scale);
vd.rotate(mf,Re/2,Pf/2);Vc!==Ym&&Vc!==Zm||vd.rotate(90,Re/2,Pf/2);Vc!==$m&&Vc!==an||vd.rotate(-90,Re/2,Pf/2);Vc===bn&&(45<Jd&&135>Jd||225<Jd&&315>Jd)&&vd.rotate(-Jd,Re/2,Pf/2);var vg=N.allocAt(0,0,Re,Pf),Se=J.alloc();Se.wi(vg,Oe);vd.Ga(Se);var wg=-Se.x,Rn=-Se.y,se=J.alloc();se.assign(Dh);isNaN(se.x)&&(se.x=Re/2+3);isNaN(se.y)&&(se.y=-(Pf/2+3));se.rotate(Jd);Bi+=se.x+wg;Eh+=se.y+Rn;var Qf=new N(Bi,Eh,Qe.width,Qe.height),Ci=new N(Qe.x,Qe.y,Qe.width,Qe.height),Sn=new N(re.x,re.y,re.width,re.height);
Vd.Sz=Of;Vd.lineCount=oc.lineCount;Vd.lines=[oc.Eb,oc.Hh,oc.cf,oc.Ke,oc.Pc,oc.Zb,oc.ye];Vd.actualBounds=Qf;Vd.measuredBounds=Ci;Vd.naturalBounds=Sn;0===Pe?lf.assign(Qf):lf.ad(Qf);J.free(se);J.free(Se);N.free(vg);ld.free(vd)}null!==Uc.graduatedBounds&&Uc.graduatedBounds.push(lf);Yb(qk,lf.x,lf.y,lf.width,lf.height)}pj(Va,!1)}}};
dn.prototype.arrange=function(a,b,c){if(null!==a.graduatedBounds){var d=a.sb(),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}}};
dn.prototype.ec=function(a,b,c){var d=c.Zi;c.Zi=!0;var e=a.naturalBounds,f=e.width,g=e.height;e=b instanceof ii;b.save();b.beginPath();b.rect(-1,-1,f+1,g+1);b.clip();b.Re();f=a.sb();f.ec(b,c);g=a.Df()*c.scale;0>=g&&(g=1);for(var h=f.actualBounds,k=a.O.s,l=a.graduatedMarks,m=k.length,n=0;n<m;n++){var p=k[n],r=l[n],q=r.length;if(p.visible&&p!==f&&0!==r.length)if(p instanceof Bf){if(!(2>a.graduatedTickUnit*p.interval*f.geometry.flattenedTotalLength/a.graduatedRange*g&&null===p.graduatedSkip)){var u=
p.measuredBounds,w=p.strokeWidth*p.scale,v=p.alignmentFocus;v.Lc()&&(v=tc);for(var y=0;y<q;y++){var z=r[y].Yl,A=r[y].angle,B=v,D=p.Cb;D.reset();D.translate(z.x+h.x,z.y+h.y);D.rotate(A+p.angle,0,0);D.translate(-u.width*B.x+B.offsetX+w/2,-u.height*B.y+B.offsetY+w/2);D.scale(p.scale,p.scale);Il(p,!1);p.uh.set(p.Cb);p.Ik=p.scale;Jl(p,!1);p.ec(b,c);e&&(a.svg.appendChild(p.svg),p.svg=null);p.Cb.reset()}}}else if(p instanceof Pg)for(null===a.temporaryTextBlock&&(a.temporaryTextBlock=new Pg),u=a.temporaryTextBlock,
en(u,p),w=0;w<q;w++)v=r[w],v.actualBounds&&v.measuredBounds&&v.naturalBounds&&(u.dc=v.text||"",u.Kb=v.Sz||0,u.Fc=v.lineCount||0,y=v.lines,void 0!==y&&(u.Eb=y[0],u.Hh=y[1],u.cf=y[2],u.Ke=y[3],u.Pc=y[4],u.Zb=y[5],u.ye=y[6]),v.naturalBounds&&(u.cc=v.naturalBounds),v.actualBounds&&(y=v.actualBounds,u.arrange(y.x,y.y,y.width,y.height)),y=v.actualBounds,u.arrange(y.x,y.y,y.width,y.height),z=v.measuredBounds,v=v.naturalBounds,A=u.Cb,A.reset(),A.translate(y.x+h.x,y.y+h.y),A.translate(-z.x,-z.y),u.mo(A,v.x,
v.y,v.width,v.height),Il(u,!1),u.uh.set(u.Cb),u.Ik=u.scale,Jl(u,!1),u.Lg=p.part,u.Le=p.panel,u.ec(b,c),u.Le=null,u.Lg=null,e&&(a.svg.appendChild(u.svg),u.svg=null))}c.Zi=d;b.restore();b.Sc(!0)};
function W(a,b){Y.call(this);this.na=null;if(void 0===a)this.na=W.Position;else if("string"===typeof a){var c=Ul.I(a);null!==c&&(this.na=c)}else a instanceof Wl?this.na=a:a&&(this.na=W.Position,b=a);null===this.na&&C("Panel type not specified or PanelLayout not loaded: "+a);this.o=this.o|4194304|(this.na===W.Grid?1048576:0);this.O=new F;this.Ab=pc;this.Sm=Sc;this.Uf=Yk;this.Yg=null;this.Ze="";this.ig=new N(NaN,NaN,NaN,NaN);this.T=this.F=null;this.wo=mg;this.hn=Jb;this.jn=pb;this.wb=this.ra=null;this.yn=
NaN;this.ee=this.Gh=null;b&&Object.assign(this,b)}la(W,Y);W.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.na=this.na;a.Ab=this.Ab.J();a.Sm=this.Sm.J();a.Uf=this.Uf;a.Ze=this.Ze;a.ig.assign(this.ig);null!==this.T&&(a.T=this.T.copy(a));a.wo=this.wo;a.hn=this.hn.J();a.jn=this.jn.J();null!==this.ra&&(a.ra=this.ra.copy());a.wb=this.wb;a.yn=this.yn;a.Gh=this.Gh};
W.prototype.Af=function(a){Y.prototype.Af.call(this,a);a.O=this.O;for(var b=a.O.s,c=b.length,d=0;d<c;d++)b[d].Le=a;a.Yg=null};W.prototype.copy=function(){var a=Y.prototype.copy.call(this);if(null!==a){for(var b=this.O.s,c=b.length,d=0;d<c;d++){var e=b[d].copy();e.vi(a);e.Lg=null;var f=a.O,g=f.count;f.Gb(g,e);f=a.part;if(null!==f){f.Qh=null;null!==e.portId&&f instanceof V&&(f.Se=!0);var h=a.diagram;null!==h&&h.undoManager.isUndoingRedoing||f.cb(ee,"elements",a,null,e,null,g)}}return a}return null};
t=W.prototype;t.toString=function(){return"Panel("+this.type.name+")#"+bb(this)};t.On=function(a){Y.prototype.On.call(this,a);for(var b=this.O.s,c=b.length,d=0;d<c;d++)b[d].On(a)};
t.fh=function(a,b){if(this.na===W.Grid)a.xc(),this.na.ec(this,a,b);else if(this.na===W.Graduated)a.xc(),this.na.ec(this,a,b);else{if(this.na===W.Table)if(a.xc(),a instanceof ii){var c=a.wd;a.wd=Cl(a,"gojs-ts");hn(this,a);a.lh.pop();a.wd=c}else hn(this,a);(c=this.isClipping&&this.na===W.Spot)&&a.save();for(var d=this.sb(),e=this.O.s,f=e.length,g=0;g<f;g++){var h=e[g];c&&h===d&&(a.clipInsteadOfFill=!0);h.ec(a,b);c&&h===d&&(a.clipInsteadOfFill=!1)}c&&(a.restore(),a.Sc(!0))}};
function hn(a,b){b.lineCap="butt";var c=0<a.rowCount?a.rowDefs:null,d=0<a.columnCount?a.colDefs:null;null!==c&&jn(a,b,!0,c,!0);null!==d&&jn(a,b,!1,d,!0);null!==c&&kn(a,b,!0,c);null!==d&&kn(a,b,!1,d);null!==c&&jn(a,b,!0,c,!1);null!==d&&jn(a,b,!1,d,!1)}
function kn(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>g.height)continue}else if(l.position>g.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){ji(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.fs(p,0));b.beginPath();p=l.position+m;c?p>g.height&&(m-=p-g.height):p>g.width&&(m-=p-g.width);l=l.position+m/2;b.lineWidth=m;m=a.Ab;c?(l+=m.top,p=g.width-m.right,b.moveTo(m.left,l),b.lineTo(p,l)):(l+=m.left,p=g.height-m.bottom,b.moveTo(l,m.top),b.lineTo(l,p));b.stroke();b.Re();n&&b.cs()}}}}
function jn(a,b,c,d,e){for(var f=d.length,g=a.actualBounds,h=a.naturalBounds,k=ln(a,!0),l=ln(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.Tc(),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.Ab,ji(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 ln(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 Zj(a){return"LineV"===a||"BarV"===a}t.lv=function(){for(var a=this.O.s,b=a.length,c=0;c<b;c++)a[c].lv();this.rf=!0};
t.ik=function(a,b,c){if(!Y.prototype.ik.call(this,a,b,c))return!1;if(this.type===W.Table)c=this.svg.getElementsByClassName("gojs-ts"),c=0!==c.length?c[0]:null,null!==c&&(c.innerHTML=""),a.wd=c,hn(this,a),a.wd=null;else if(this.na===W.Grid||this.na===W.Graduated)return this.svg.innerHTML="",this.svg.remove(),!1;c=this.O.s;for(var d=c.length,e=0;e<d;e++)c[e].ec(a,b);return!0};t.lk=function(){return!0};
t.Xo=function(a,b,c,d){if(!this.isClipping)if(this.ne()&&null!==a.ak){a=a.ak;b=this.O.s;for(var e=0,f=0,g=0;g<b.length;g++){var h=b[g].actualBounds;e=0===g?h.x:Math.min(h.x,e);f=0===g?h.y:Math.min(h.y,f)}d.setAttributeNS(null,"clip-path","path('M "+(a.x-c.x-e)+","+(a.y-c.y-f)+" l "+a.width+" 0 l 0 "+a.height+" l -"+a.width+" 0 z')")}else Y.prototype.Xo.call(this,a,b,c,d)};
t.Sj=function(a,b,c,d,e){var f=this.re(),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,K.Ff(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=K.Ff(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.O.s;r=n.length;m=J.alloc();p=null;b=Infinity;var q=null,u=this.isClipping&&this.na===W.Spot;u&&(q=J.alloc(),p=this.sb(),(l=p.Sj(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.Sj(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),J.free(q));J.free(m);f&&e.transform(g);return l};
t.Gj=function(){for(var a=this.O.s,b=a.length,c=0;c<b;c++)a[c].Gj();Y.prototype.Gj.call(this)};t.v=function(a){if(!uj(this)){Y.prototype.v.call(this,a);a=null;if(this.na===W.Auto||this.na===W.Link)a=this.sb();for(var b=this.O.s,c=b.length,d=0;d<c;d++){var e=b[d];(e===a||e.isPanelMain)&&e.v(!0);if(!e.desiredSize.w()){var f=jl(e,!1);(e instanceof ig||e instanceof W||e instanceof Pg||f!==kg)&&e.v(!0)}}}};t.Uj=function(){if(!uj(this)){pj(this,!0);ll(this,!0);for(var a=this.O.s,b=a.length,c=0;c<b;c++)a[c].Uj()}};
t.Sk=function(){if(0!==(this.o&2048)===!1){Il(this,!0);Jl(this,!0);for(var a=this.O.s,b=a.length,c=0;c<b;c++)a[c].Wu()}};t.Wu=function(){Jl(this,!0);for(var a=this.O.s,b=a.length,c=0;c<b;c++)a[c].Wu()};
t.Ul=function(a,b,c,d){var e=this.ig;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.Ab;a=Math.max(a-k.left-k.right,0);b=Math.max(b-k.top-k.bottom,0);var l=this.O.s;0!==l.length&&this.na.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);Pb(e,a,k);Pb(this.naturalBounds,a,k);this.Fe(0,0,a,k)};t.sb=function(){if(null===this.Yg){var a=this.O.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.Yg=d}this.Yg=a[0]}return this.Yg};function Gm(a){return null!==a.part?a.part.locationObject:null}
t.bh=function(a,b,c,d){var e=this.O.s;this.actualBounds.h(a,b,c,d);if(0!==e.length){if(!this.desiredSize.w()){a=jl(this,!0);var f=this.measuredBounds;b=f.width;f=f.height;var g=this.Ig,h=g.left+g.right;g=g.top+g.bottom;b===c&&f===d&&(a=kg);switch(a){case kg:if(b>c||f>d)this.v(),this.measure(b>c?c:b,f>d?d:f,0,0);break;case nd:this.v(!0);this.measure(c+h,d+g,0,0);break;case Wk:this.v(!0);this.measure(c+h,f+g,0,0);break;case Xk:this.v(!0),this.measure(b+h,d+g,0,0)}}this.na.arrange(this,e,this.ig)}};
t.eh=function(a){var b=this.naturalBounds,c=Gm(this);if(Zb(0,0,b.width,b.height,a.x,a.y)){b=this.O.s;for(var d=b.length,e=J.allocAt(0,0);d--;){var f=b[d];if(f.visible||f===c)if(xb(e.set(a),f.transform),f.ca(e))return J.free(e),!0}J.free(e);return null===this.Oa&&null===this.areaBackground?!1:!0}return!1};t.gs=function(a){if(this.bindingId===a)return this;for(var b=this.O.s,c=b.length,d=0;d<c;d++){var e=b[d].gs(a);if(null!==e)return e}return null};
t.pm=function(a,b){b(this,a);if(a instanceof W){a=a.O.s;for(var c=a.length,d=0;d<c;d++)this.pm(a[d],b)}};function Hj(a,b){mn(a,a,b)}function mn(a,b,c){c(b);b=b.O.s;for(var d=b.length,e=0;e<d;e++){var f=b[e];f instanceof W&&mn(a,f,c)}}function nn(a,b){on(a,a,b)}function on(a,b,c){c(b);if(b instanceof W){b=b.O.s;for(var d=b.length,e=0;e<d;e++)on(a,b[e],c)}}t.Kl=function(a){return pn(this,this,a)};
function pn(a,b,c){if(c(b))return b;if(b instanceof W){b=b.O.s;for(var d=b.length,e=0;e<d;e++){var f=pn(a,b[e],c);if(null!==f)return f}}return null}t.fb=function(a){if(this.name===a)return this;var b=this.O.s,c=b.length;null===this.Gh&&null===this.itemTemplateMap||(c=qn(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 rn(a){a=a.O.s;for(var b=a.length,c=0,d=0;d<b;d++){var e=a[d];e instanceof W?c=Math.max(c,rn(e)):e instanceof Bf&&(c=Math.max(c,e.hg/2*e.strokeMiterLimit*e.Df()))}return c}t.re=function(){return!(this.type===W.TableRow||this.type===W.TableColumn)};function kl(a){return a.type===W.TableRow||a.type===W.TableColumn}
t.gc=function(a,b,c){if(!1===this.pickable)return null;void 0===b&&(b=null);void 0===c&&(c=null);if(vj(this))return null;var d=this.naturalBounds,e=1/this.Df(),f=this.re(),g=f?a:xb(J.allocAt(a.x,a.y),this.transform),h=this.diagram,k=10,l=5;null!==h&&(k=h.Nl("extraTouchArea"),l=k/2);if(Zb(-(l*e),-(l*e),d.width+k*e,d.height+k*e,g.x,g.y)){if(!this.isAtomic){e=this.O.s;var m=e.length;h=J.alloc();l=(k=this.isClipping&&this.na===W.Spot)?this.sb():null;if(k&&(l.re()?xb(h.set(a),l.transform):h.set(a),!l.ca(h)))return J.free(h),
f||J.free(g),null;for(var n=Gm(this);m--;){var p=e[m];if(p.visible||p===n)if(p.re()?xb(h.set(a),p.transform):h.set(a),!k||p!==l){var r=null;p instanceof W?r=p.gc(h,b,c):!0===p.pickable&&p.ca(h)&&(r=p);if(null!==r&&(null!==b&&(r=b(r)),null!==r&&(null===c||c(r))))return J.free(h),f||J.free(g),r}}J.free(h)}if(null===this.background&&null===this.areaBackground)return f||J.free(g),null;a=Zb(0,0,d.width,d.height,g.x,g.y)?this:null;f||J.free(g);return a}f||J.free(g);return null};
t.ii=function(a,b,c,d){if(!1===this.pickable)return!1;void 0===b&&(b=null);void 0===c&&(c=null);var e=this.naturalBounds,f=this.re(),g=f?a:xb(J.allocAt(a.x,a.y),this.transform);e=Zb(0,0,e.width,e.height,g.x,g.y);if(kl(this)||e){if(!this.isAtomic){for(var h=this.O.s,k=h.length,l=J.alloc(),m=Gm(this);k--;){var n=h[k];if(n.visible||n===m){n.re()?xb(l.set(a),n.transform):l.set(a);var p=n;n=n instanceof W?n:null;(null!==n?n.ii(l,b,c,d):p.ca(l))&&!1!==p.pickable&&(null!==b&&(p=b(p)),null===p||null!==c&&
!c(p)||d.add(p))}}J.free(l)}f||J.free(g);return e&&(null!==this.background||null!==this.areaBackground)}f||J.free(g);return!1};
t.Cf=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=ld.alloc(),g.reset());g.multiply(this.transform);if(this.dh(a,g))return sn(this,b,c,e),void 0===f&&ld.free(g),!0;if(this.Vc(a,g)){if(!this.isAtomic)for(var h=Gm(this),k=this.O.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=ld.alloc();p.set(g);
if(null!==m?m.Cf(a,b,c,d,e,p):il(n,a,d,p))null!==b&&(n=b(n)),null===n||null!==c&&!c(n)||e.add(n);ld.free(p)}}}void 0===f&&ld.free(g);return d}void 0===f&&ld.free(g);return!1};function sn(a,b,c,d){for(var e=a.O.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&&sn(g,b,c,d),null!==b&&(g=b(g)),null===g||null!==c&&!c(g)||d.add(g))}}}
t.ng=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.re(),k=h?a:xb(J.allocAt(a.x,a.y),this.transform),l=h?b:xb(J.allocAt(b.x,b.y),this.transform),m=k.Bf(l),n=0<k.x&&k.x<g.width&&0<k.y&&k.y<g.height||yb(k.x,k.y,0,0,0,g.height)<=m||yb(k.x,k.y,0,g.height,g.width,g.height)<=m||yb(k.x,k.y,g.width,g.height,g.width,0)<=m||yb(k.x,k.y,g.width,0,0,0)<=m;g=k.xd(0,0)<=m&&k.xd(0,g.height)<=m&&k.xd(g.width,0)<=m&&k.xd(g.width,g.height)<=
m;h||(J.free(k),J.free(l));if(n){if(!this.isAtomic){k=J.alloc();l=J.alloc();m=Gm(this);for(var p=this.O.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.re()?(u=q.transform,xb(k.set(a),u),xb(l.set(b),u)):(k.set(a),l.set(b)),u=q,q=q instanceof W?q:null,null!==q?q.ng(k,l,c,d,e,f):u.tx(k,l,e))null!==c&&(u=c(u)),null===u||null!==d&&!d(u)||f.add(u)}}J.free(k);J.free(l)}return e?n:g}return!1};
function Mm(a){var b=null;a instanceof Bf&&(b=a.spot1,b===Sc&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot1));null===b&&(b=sc);return b}function Nm(a){var b=null;a instanceof Bf&&(b=a.spot2,b===Sc&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot2));null===b&&(b=Bc);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.Gb(this.O.count,b[c]);return this};t.L=function(a){return this.O.L(a)};
t.Gb=function(a,b){b instanceof U&&C("Cannot add a Part to a Panel: "+b+"; use a Panel instead");if(this===b||this.qg(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.na!==W.Grid||b instanceof Bf||C("Can only add Shapes to a Grid Panel, not: "+b);this.na!==W.Graduated||b instanceof Bf||b instanceof Pg||C("Can only add Shapes or TextBlocks to a Graduated Panel, not: "+b);b.vi(this);b.Lg=null;if(null!==this.itemArray){var d=b.data;null!==d&&"object"===typeof d&&(null===this.ee&&(this.ee=new ob),this.ee.add(d,b))}var e=this.O;d=-1;if(c===this){for(var f=-1,g=this.O.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.nb(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.Gb(a,b);if(0===a||b.isPanelMain)this.Yg=null;uj(this)||this.v();b.v(!1);null!==b.portId?this.Se=!0:b instanceof W&&!0===b.Se&&(this.Se=!0);this.graduatedIntervals=null;this.If()||tn(this,b,!1);c=this.part;null!==c&&(c.Qh=null,c.$f=NaN,this.Se&&c instanceof V&&(c.Se=!0),c.Se&&c instanceof V&&(c.vc=null),e=this.diagram,null!==e&&e.undoManager.isUndoingRedoing||(-1!==d&&
c.cb(fe,"elements",this,b,null,d,null),c.cb(ee,"elements",this,null,b,null,a)))};function un(a,b){a.o=b?a.o|16777216:a.o&-16777217}t.remove=function(a){for(var b=this.O.s,c=b.length,d=-1,e=0;e<c;e++)if(b[e]===a){d=e;break}-1!==d&&this.oc(d,!0)};t.nb=function(a){0<=a&&this.oc(a,!0)};
t.oc=function(a,b){var c=this.O,d=c.L(a);d.Lg=null;d.vi(null);if(null!==this.ee){var e=d.data;"object"===typeof e&&this.ee.remove(e)}c.nb(a);pj(this,!1);this.v();this.Yg===d&&(this.Yg=null);this.graduatedIntervals=null;var f=this.part;null!==f&&(f.Qh=null,f.$f=NaN,f.Ub(),f instanceof V&&(d instanceof W?d.pm(d,function(a,c){am(f,c,b)}):am(f,d,b)),c=this.diagram,null!==c&&c.undoManager.isUndoingRedoing||f.cb(fe,"elements",this,d,null,a,null))};
t.ub=function(a){0>a&&xa(a,">= 0",W,"getRowDefinition:idx");a=Math.round(a);var b=this.rowDefs;if(void 0===b[a]){var c=new Vj;c.vi(this);c.isRow=!0;c.index=a;b[a]=c;this.cb(ee,"rowdefs",this,null,c,null,a)}return b[a]};t.nA=function(a){0>a&&xa(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.cb(fe,"rowdefs",this,c,null,a,null);this.v()}}};
function Wj(a,b,c){var d=a.rowDefs;if(!(0>b)){d[b]=c instanceof Vj?c:void 0;if(!c)for(b=d.length-1;0<=b&&void 0===d[b--];)d.length--;a.v()}}t.tb=function(a){0>a&&xa(a,">= 0",W,"getColumnDefinition:idx");a=Math.round(a);var b=this.colDefs;if(void 0===b[a]){var c=new Vj;c.vi(this);c.isRow=!1;c.index=a;b[a]=c;this.cb(ee,"coldefs",this,null,c,null,a)}return b[a]};
t.iA=function(a){0>a&&xa(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.cb(fe,"coldefs",this,c,null,a,null);this.v()}}};function Xj(a,b,c){var d=a.colDefs;if(!(0>b)){d[b]=c instanceof Vj?c:void 0;if(!c)for(b=d.length-1;0<=b&&void 0===d[b--];)d.length--;a.v()}}t.Iy=function(a){var b=null;a.isRow?b=this.ub(a.index):a.isRow||(b=this.tb(a.index));b&&Vl(b,a);return this};
t.Jy=function(a,b){(a=this.ub(a))&&Vl(a,new Vj(b));return this};t.Dy=function(a,b){(a=this.tb(a))&&Vl(a,new Vj(b));return this};t.oz=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.gz=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.Gz=function(a,b){void 0===b&&(b=new J(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.sb();c.geometry.Pu((a-this.graduatedMin)/this.graduatedRange,b);return c.transform.Ga(b)};
t.Hz=function(a){if(this.type!==W.Graduated)return NaN;var b=this.sb();b.transform.Od(a);return b.geometry.xx(a)*this.graduatedRange+this.graduatedMin};function Ql(a){a=a.allBindings;return null!==a&&a._isFrozen}
function jg(a){var b=a.allBindings;if(null===b)null!==a.data&&C("Template cannot have .data be non-null: "+a),a.allBindings=b=new F;else if(b._isFrozen)return;var c=new F;un(a,!1);a.pm(a,function(a,d){d.rh();var e=d.localBindings;if(null!==e)for(Nl(d,!1),e=e.iterator;e.next();){var f=e.value;f.mode===vn&&Nl(d,!0);var g=f.sourceName;null!==g&&("/"===g&&un(a,!0),g=hl(f,a,d),null!==g&&(c.add(g),null===g.srcBindings&&(g.srcBindings=new F),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.$d)for(var h=g.$d.iterator;h.next();){var k=h.value;k.vd=g;k.so=2;k.ul=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.$d)for(g=f.$d.iterator;g.next();)h=g.value,h.vd=f,h.so=1,h.ul=f.index,b.add(h)}});for(var d=c.iterator;d.next();){var e=d.value;if(null!==e.srcBindings){Nl(e,!0);for(var f=e.srcBindings.iterator;f.next();){var g=f.value;null===e.localBindings&&
(e.localBindings=new F);e.localBindings.add(g)}}e.srcBindings=null}for(d=b.iterator;d.next();)if(e=d.value,f=e.vd,null!==f){e.vd=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):ya('Warning: unable to find GraphObject named "'+g+'" for Binding: '+e.toString()));f instanceof Vj?(g=bb(f.panel),e.zi=void 0===g?-1:g,f.panel.bindingId=e.zi):f instanceof Y?(g=bb(f),e.zi=void 0===g?-1:g,f.bindingId=e.zi):C("Unknown type of binding target: "+
f)}b.freeze();a instanceof U&&a.Wc()&&a.Va()}t.Vy=function(a){void 0===a&&(a=!1);var b=this.copy();nn(b,function(a){a instanceof W&&(a.allBindings=null,a.wb=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.Hv(b.value.copy())}))});a&&jg(b);return b};
t.Ma=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.zi;if(-1!==g){if(f=this.gs(g),
null===f)continue}else null!==c.vd&&(f=c.vd);"/"===e?d=f.part:"."===e?d=f:".."===e&&(d=f.panel);e=c.so;if(0!==e){if(!(f instanceof W))continue;1===e?f=f.tb(c.ul):2===e&&(f=f.ub(c.ul))}void 0!==f&&c.Kv(f,d)}}};t.sx=function(a){return void 0===a||null===a||null===this.ee?null:this.ee.I(a)};
function wn(a,b){a=a.O.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 qn(a){if(a.type===W.Spot||a.type===W.Auto)return Math.min(a.O.length,1);if(a.type===W.Link){a=a.O;for(var b=a.length,c=0;c<b;c++){var d=a.L(c);if(!(d instanceof Bf&&d.isPanelMain))break}return c}return a.type===W.Table&&0<a.O.length&&(a=a.O.L(0),a.isPanelMain&&a instanceof W&&kl(a))?1:0}t.mv=function(){for(var a=qn(this);this.O.length>a;)this.oc(this.O.length-1,!1);xn(this,this.itemArray)};
function xn(a,b){var c=qn(a);if(null===b||0===b.length)for(;a.O.length>c;)a.oc(a.O.length-1,!1);else if(a.O.length<=c){c=b.length;for(var d=0;d<c;d++)yn(a,b[d],d,!0)}else{d=c;for(var e=0;e<b.length;e++,d++){var f=b[e],g=d<a.O.length?a.O.L(d):null;if(g instanceof W){if(g.data!==f){var h=zn(a,g.data),k=zn(a,f),l=k!==h;l||(h=An(a,h),l=An(a,k)!==h);l?(a.oc(d,!1),yn(a,f,e,!1)):g.data=f}}else yn(a,f,e,!1)}for(;d<a.O.length;)a.oc(d,!1);a.Yg=null;Bn(a,c,0);uj(a)||a.v();a.graduatedIntervals=null;a.If()||tn(a,
a,!1);b=a.part;null!==b&&(b.Qh=null,b.$f=NaN,a.Se&&b instanceof V&&(b.Se=!0),b.Se&&b instanceof V&&(b.vc=null))}}function yn(a,b,c,d){if(!(void 0===b||null===b||0>c)){var e=zn(a,b);e=An(a,e);if(null!==e){jg(e);e=e.copy();if(0!==(e.o&16777216)){var f=a.gh();null!==f&&un(f,!0)}"object"===typeof b&&(null===a.ee&&(a.ee=new ob),a.ee.add(b,e));f=c+qn(a);a.Gb(f,e);d&&(e.wb=b,Bn(a,f,c),e.wb=null);e.data=b}}}
function Bn(a,b,c){for(a=a.O;b<a.length;){var d=a.L(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 zn(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=Cn(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 An(a,b){var c=a.itemTemplateMap,d=null;null!==c&&(d=c.I(b));null===d&&(null!==c&&(d=c.I("")),null===d&&(Dn||(Dn=!0,ya('No item template Panel found for category "'+b+'" on '+a),ya(" Using default item template."),a=new W,b=new Pg,b.bind(new Hi("text","",Ia)),a.add(b),En=a),d=En));return d}function tn(a,b,c){var d=b.enabledChanged;null!==d&&d(b,c);if(b instanceof W){b=b.O.s;d=b.length;for(var e=0;e<d;e++){var f=b[e];c&&f instanceof W&&!f.isEnabled||tn(a,f,c)}}}
function Fn(a,b){b.name=a;Ul.add(a,b)}
ma.Object.defineProperties(W.prototype,{type:{get:function(){return this.na},set:function(a){var b=this.na;b!==a&&(this.na=a,this.isAtomic=this.na===W.Grid,this.v(),this.g("type",b,a))}},elements:{get:function(){return this.O.iterator}},naturalBounds:{get:function(){return this.cc}},padding:{get:function(){return this.Ab},set:function(a){"number"===typeof a?(0>a&&xa(a,">= 0",W,"padding"),
a=new hc(a)):(0>a.left&&xa(a.left,">= 0",W,"padding:value.left"),0>a.right&&xa(a.right,">= 0",W,"padding:value.right"),0>a.top&&xa(a.top,">= 0",W,"padding:value.top"),0>a.bottom&&xa(a.bottom,">= 0",W,"padding:value.bottom"));var b=this.Ab;b.C(a)||(this.Ab=a=a.J(),this.v(),this.g("padding",b,a))}},defaultAlignment:{get:function(){return this.Sm},set:function(a){var b=this.Sm;b.C(a)||(this.Sm=a=a.J(),this.v(),this.g("defaultAlignment",b,a))}},defaultStretch:{
get:function(){return this.Uf},set:function(a){var b=this.Uf;b!==a&&(this.Uf=a,this.v(),this.g("defaultStretch",b,a))}},defaultSeparatorPadding:{get:function(){return null!==this.T?this.T.Np:pc},set:function(a){"number"===typeof a&&(a=new hc(a));var b=this.defaultSeparatorPadding;b.C(a)||(a=a.J(),null===this.T&&(this.T=new Gn),this.T.Np=a,this.v(),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 ql)&&(a instanceof ql&&a.freeze(),null===this.T&&(this.T=new Gn),this.T.ga=a,this.N(),this.g("defaultRowSeparatorStroke",b,a))}},defaultRowSeparatorStrokeWidth:{get:function(){return null!==this.T?this.T.Ha:1},set:function(a){var b=this.defaultRowSeparatorStrokeWidth;b!==a&&isFinite(a)&&0<=a&&(null===this.T&&(this.T=new Gn),this.T.Ha=a,this.v(),
this.g("defaultRowSeparatorStrokeWidth",b,a))}},defaultRowSeparatorDashArray:{get:function(){return null!==this.T?this.T.V: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 Gn);this.T.V=
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 ql)&&(a instanceof ql&&a.freeze(),null===this.T&&(this.T=new Gn),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 Gn),this.T.F=a,this.v(),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 Gn);this.T.m=a;this.N();this.g("defaultColumnSeparatorDashArray",b,a)}}},inRowsCols:{get:function(){return null!==this.T?this.T.ob:null},set:function(a){null===this.T&&(this.T=new Gn);this.T.ob=a}},viewboxStretch:{get:function(){return this.wo},set:function(a){var b=this.wo;b!==a&&(this.wo=a,this.v(),this.g("viewboxStretch",
b,a))}},gridCellSize:{get:function(){return this.hn},set:function(a){var b=this.hn;if(!b.C(a)){a.w()&&0!==a.width&&0!==a.height||C("Invalid Panel.gridCellSize: "+a);this.hn=a.J();var c=this.diagram;null!==c&&this===c.grid&&qj(c);this.N();this.g("gridCellSize",b,a)}}},gridOrigin:{get:function(){return this.jn},set:function(a){var b=this.jn;if(!b.C(a)){a.w()||C("Invalid Panel.gridOrigin: "+a);this.jn=a.J();var c=this.diagram;null!==c&&this===
c.grid&&qj(c);this.N();this.g("gridOrigin",b,a)}}},graduatedMin:{get:function(){return null!==this.ra?this.ra.hq:0},set:function(a){var b=this.graduatedMin;b!==a&&(null===this.ra&&(this.ra=new Hn),this.ra.hq=a,this.v(),this.g("graduatedMin",b,a),fl(this)&&(a=this.part,null!==a&&gl(this,a,"graduatedRange")))}},graduatedMax:{get:function(){return null!==this.ra?this.ra.F:100},set:function(a){var b=this.graduatedMax;b!==a&&(null===this.ra&&
(this.ra=new Hn),this.ra.F=a,this.v(),this.g("graduatedMax",b,a),fl(this)&&(a=this.part,null!==a&&gl(this,a,"graduatedRange")))}},graduatedRange:{get:function(){return this.graduatedMax-this.graduatedMin}},graduatedTickUnit:{get:function(){return null!==this.ra?this.ra.ga:10},set:function(a){var b=this.graduatedTickUnit;b!==a&&0<a&&(null===this.ra&&(this.ra=new Hn),this.ra.ga=a,this.v(),this.g("graduatedTickUnit",b,a))}},graduatedTickBase:{
get:function(){return null!==this.ra?this.ra.V:0},set:function(a){var b=this.graduatedTickBase;b!==a&&(null===this.ra&&(this.ra=new Hn),this.ra.V=a,this.v(),this.g("graduatedTickBase",b,a))}},graduatedMarks:{get:function(){return null!==this.ra?this.ra.u:null},set:function(a){null!==this.ra?this.ra.u=a:null!==a&&(this.ra=new Hn,this.ra.u=a)}},graduatedBounds:{get:function(){return null!==this.ra?this.ra.j:null},set:function(a){null!==
this.ra?this.ra.j=a:null!==a&&(this.ra=new Hn,this.ra.j=a)}},graduatedIntervals:{get:function(){return null!==this.ra?this.ra.m:null},set:function(a){null!==this.ra?this.ra.m=a:null!==a&&(this.ra=new Hn,this.ra.m=a)}},temporaryTextBlock:{get:function(){return null!==this.ra?this.ra.Yh:null},set:function(a){null!==this.ra?this.ra.Yh=a:null!==a&&(this.ra=new Hn,this.ra.Yh=a)}},panelLayoutState:{get:function(){return this.F},
set:function(a){this.F=a}},Se:{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 Gn);return this.T.Oc}},rowCount:{get:function(){return null===this.T?0:this.rowDefs.length}},colDefs:{get:function(){null===this.T&&(this.T=new Gn);return this.T.Nc}},columnCount:{
get:function(){return null===this.T?0:this.colDefs.length}},rowSizing:{get:function(){return null!==this.T?this.T.pb:In},set:function(a){var b=this.rowSizing;b!==a&&(null===this.T&&(this.T=new Gn),this.T.pb=a,this.v(),this.g("rowSizing",b,a))}},columnSizing:{get:function(){return null!==this.T?this.T.j:In},set:function(a){var b=this.columnSizing;b!==a&&(null===this.T&&(this.T=new Gn),this.T.j=a,this.v(),this.g("columnSizing",
b,a))}},topIndex:{get:function(){return null!==this.T?this.T.Hb: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 Gn),this.T.Hb=a,this.v(),this.g("topIndex",b,a))}},leftIndex:{get:function(){return null!==this.T?this.T.hb: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 Gn),this.T.hb=a,this.v(),this.g("leftIndex",b,a))}},data:{get:function(){return this.wb},set:function(a){var b=this.wb;if(b!==a){var c=this instanceof U&&!(this instanceof te);jg(this);this.wb=a;var d=this.diagram;null!==d&&(c?(c=d.partManager,this instanceof T?(null!==b&&c.af.remove(b),null!==a&&c.af.add(a,this)):this instanceof U&&(null!==b&&c.bf.remove(b),null!==a&&c.bf.add(a,this))):(c=this.panel,null!==c&&null!==c.ee&&(null!==b&&c.ee.remove(b),
null!==a&&c.ee.add(a,this))));this.g("data",b,a);null!==d&&d.undoManager.isUndoingRedoing||null!==a&&this.Ma()}}},itemIndex:{get:function(){return this.yn},set:function(a){var b=this.yn;b!==a&&(this.yn=a,this.g("itemIndex",b,a))}},allBindings:{get:function(){return null!==this.A?this.A.ob:null},set:function(a){this.localBindings!==a&&(null===this.A&&(this.A=new dl),this.A.ob=a)}},itemArray:{get:function(){return this.Gh},
set:function(a){var b=this.Gh;if(b!==a||null!==a&&wn(this,a)){var c=this.diagram;b!==a&&(null!==c&&null!==b&&Mj(c.partManager,this,c),this.Gh=a,null!==c&&null!==a&&Jj(c.partManager,this));this.g("itemArray",b,a);null!==c&&c.undoManager.isUndoingRedoing||xn(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 ob}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.mv())}},itemTemplateMap:{get:function(){return null!==this.A?this.A.Oc:null},set:function(a){var b=this.itemTemplateMap;if(b!==a){for(var c=a.iterator;c.next(););cl(this);this.A.Oc=a;this.g("itemTemplateMap",b,a);a=this.diagram;null!==a&&a.undoManager.isUndoingRedoing||
this.mv()}}},itemCategoryProperty:{get:function(){return null!==this.A?this.A.Nc:"category"},set:function(a){var b=this.itemCategoryProperty;b!==a&&(cl(this),this.A.Nc=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 pf&&(this.ib=null),this.v(),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.v(),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.If();
this.o^=4194304;this.g("isEnabled",b,a);b=this.diagram;null!==b&&b.undoManager.isUndoingRedoing||c&&tn(this,this,a)}}},alignmentFocusName:{get:function(){return this.Ze},set:function(a){var b=this.Ze;b!==a&&(this.Ze=a,this.v(),this.g("alignmentFocusName",b,a))}}});
ma.Object.defineProperties(W,{Position:{get:function(){return Ul.I("Position")}},Horizontal:{get:function(){return Ul.I("Horizontal")}},Vertical:{get:function(){return Ul.I("Vertical")}},Spot:{get:function(){return Ul.I("Spot")}},Auto:{get:function(){return Ul.I("Auto")}},Table:{get:function(){return Ul.I("Table")}},Viewbox:{
get:function(){return Ul.I("Viewbox")}},TableRow:{get:function(){return Ul.I("TableRow")}},TableColumn:{get:function(){return Ul.I("TableColumn")}},Link:{get:function(){return Ul.I("Link")}},Grid:{get:function(){return Ul.I("Grid")}},Graduated:{get:function(){return Ul.I("Graduated")}}});W.prototype.rebuildItemElements=W.prototype.mv;
W.prototype.findItemPanelForData=W.prototype.sx;W.prototype.updateTargetBindings=W.prototype.Ma;W.prototype.copyTemplate=W.prototype.Vy;W.prototype.graduatedValueForPoint=W.prototype.Hz;W.prototype.graduatedPointForValue=W.prototype.Gz;W.prototype.findColumnForLocalX=W.prototype.gz;W.prototype.findRowForLocalY=W.prototype.oz;W.prototype.addColumnDefinition=W.prototype.Dy;W.prototype.addRowDefinition=W.prototype.Jy;W.prototype.addRowColumnDefinition=W.prototype.Iy;
W.prototype.removeColumnDefinition=W.prototype.iA;W.prototype.getColumnDefinition=W.prototype.tb;W.prototype.removeRowDefinition=W.prototype.nA;W.prototype.getRowDefinition=W.prototype.ub;W.prototype.removeAt=W.prototype.nb;W.prototype.remove=W.prototype.remove;W.prototype.insertAt=W.prototype.Gb;W.prototype.elt=W.prototype.L;W.prototype.add=W.prototype.add;W.prototype.findObject=W.prototype.fb;W.prototype.findInVisualTree=W.prototype.Kl;W.prototype.walkVisualTreeFrom=W.prototype.pm;
W.prototype.findMainElement=W.prototype.sb;var Dn=!1,En=null,Ul=new ob;W.className="Panel";W.definePanelLayout=Fn;Fn("Position",new Fm);Fn("Vertical",new Im);Fn("Auto",new Lm);Fn("Link",new Wm);function Hn(){this.hq=0;this.F=100;this.ga=10;this.V=0;this.Yh=this.m=this.j=this.u=null}Hn.prototype.copy=function(){var a=new Hn;a.hq=this.hq;a.F=this.F;a.ga=this.ga;a.V=this.V;a.u=this.u;a.j=this.j;a.m=this.m;a.Yh=this.Yh;return a};Hn.className="GradPanelSettings";
function Gn(){this.Oc=[];this.Nc=[];this.j=this.pb=In;this.hb=this.Hb=0;this.Np=pc;this.Ha=1;this.V=this.ga=null;this.F=1;this.ob=this.m=this.u=null}
Gn.prototype.copy=function(a){for(var b=new Gn,c=this.Oc,d=c.length,e=b.Oc,f=0;f<d;f++)if(void 0!==c[f]){var g=c[f].copy();g.vi(a);e[f]=g}c=this.Nc;d=c.length;e=b.Nc;for(f=0;f<d;f++)void 0!==c[f]&&(g=c[f].copy(),g.vi(a),e[f]=g);b.pb=this.pb;b.j=this.j;b.Hb=this.Hb;b.hb=this.hb;b.Np=this.Np.J();b.Ha=this.Ha;b.ga=this.ga;b.V=this.V;b.F=this.F;b.u=this.u;b.m=this.m;b.ob=this.ob;return b};Gn.className="TablePanelSettings";
function Vj(a){Qa(this);this.Le=null;this.qq=!0;this.Za=0;this.Gc=NaN;this.jj=0;this.hj=Infinity;this.Jb=Sc;this.pa=this.mc=this.oa=0;this.$d=null;this.no=Jn;this.gg=Yk;this.ko=this.cg=null;this.lo=NaN;this.Oa=this.tj=null;this.Om=!1;a&&(Object.assign(this,a),void 0!==a.column?(this.isRow=!1,this.index=a.column):void 0!==a.row&&(this.isRow=!0,this.index=a.row))}
Vj.prototype.copy=function(){var a=new Vj;a.qq=this.qq;a.Za=this.Za;a.Gc=this.Gc;a.jj=this.jj;a.hj=this.hj;a.Jb=this.Jb;a.oa=this.oa;a.mc=this.mc;a.pa=this.pa;a.gg=this.gg;a.no=this.no;null===this.cg?a.cg=null:a.cg=this.cg.J();a.ko=this.ko;a.lo=this.lo;a.tj=null;null!==this.tj&&(a.separatorDashArray=Ba(this.separatorDashArray));a.Oa=this.Oa;a.Om=this.Om;a.$d=this.$d;return a};
function Vl(a,b){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.cg=null===b.separatorPadding?null:b.separatorPadding.J();a.separatorStroke=b.separatorStroke;a.separatorStrokeWidth=b.separatorStrokeWidth;a.tj=null;b.separatorDashArray&&(a.tj=Ba(b.separatorDashArray));a.background=b.background;a.coversSeparators=b.coversSeparators;a.$d=b.$d}t=Vj.prototype;
t.rb=function(a){a.classType===Vj&&(this.sizing=a)};t.toString=function(){return"RowColumnDefinition "+(this.isRow?"(Row ":"(Column ")+this.index+") #"+bb(this)};t.vi=function(a){this.Le=a};
t.Ho=function(a){var b=0,c=this.Le;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.cg;if(null===a)if(null!==c)a=c.defaultSeparatorPadding;else return b;return b+(this.isRow?a.top:a.left)};
t.Tc=function(){var a=0,b=this.Le,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.oa){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.cg;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.Nb=function(a,b,c){var d=this.Le;if(null!==d&&(d.cb(ce,a,this,b,c,void 0,void 0),null!==this.$d&&(b=d.diagram,null!==b&&!b.skipsModelSourceBindings&&(d=d.gh(),null!==d&&(b=d.data,null!==b)))))for(c=this.$d.iterator;c.next();)c.value.pp(this,b,a,d)};function Pm(a){if(a.sizing===Jn){var b=a.Le;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 Hi(a,b,c,d):e=a;e.vd=this;a=this.panel;null!==a&&(b=a.gh(),null!==b&&Ql(b)&&C("Cannot add a Binding to a RowColumnDefinition that is already frozen: "+e+" on "+a));null===this.$d&&(this.$d=new F);this.$d.add(e);return this};
ma.Object.defineProperties(Vj.prototype,{panel:{get:function(){return this.Le}},isRow:{get:function(){return this.qq},set:function(a){this.qq=a}},index:{get:function(){return this.Za},set:function(a){this.Za=a}},height:{get:function(){return this.Gc},set:function(a){var b=this.Gc;b!==a&&(0>a&&xa(a,">= 0",Vj,"height"),this.Gc=a,this.actual=this.oa,null!==this.panel&&this.panel.v(),
this.Nb("height",b,a))}},width:{get:function(){return this.Gc},set:function(a){var b=this.Gc;b!==a&&(0>a&&xa(a,">= 0",Vj,"width"),this.Gc=a,this.actual=this.oa,null!==this.panel&&this.panel.v(),this.Nb("width",b,a))}},minimum:{get:function(){return this.jj},set:function(a){var b=this.jj;b!==a&&((0>a||!isFinite(a))&&xa(a,">= 0",Vj,"minimum"),this.jj=a,this.actual=this.oa,null!==this.panel&&this.panel.v(),this.Nb("minimum",b,a))}},maximum:{
get:function(){return this.hj},set:function(a){var b=this.hj;b!==a&&(0>a&&xa(a,">= 0",Vj,"maximum"),this.hj=a,this.actual=this.oa,null!==this.panel&&this.panel.v(),this.Nb("maximum",b,a))}},alignment:{get:function(){return this.Jb},set:function(a){var b=this.Jb;b.C(a)||(this.Jb=a.J(),null!==this.panel&&this.panel.v(),this.Nb("alignment",b,a))}},stretch:{get:function(){return this.gg},set:function(a){var b=this.gg;b!==a&&(this.gg=
a,null!==this.panel&&this.panel.v(),this.Nb("stretch",b,a))}},separatorPadding:{get:function(){return this.cg},set:function(a){"number"===typeof a&&(a=new hc(a));var b=this.cg;null!==a&&null!==b&&b.C(a)||(null!==a&&(a=a.J()),this.cg=a,null!==this.panel&&this.panel.v(),this.Nb("separatorPadding",b,a))}},separatorStroke:{get:function(){return this.ko},set:function(a){var b=this.ko;b!==a&&(null!==a&&$l(a,"RowColumnDefinition.separatorStroke"),
a instanceof ql&&a.freeze(),this.ko=a,null!==this.panel&&this.panel.v(),this.Nb("separatorStroke",b,a))}},separatorStrokeWidth:{get:function(){return this.lo},set:function(a){var b=this.lo;b!==a&&(this.lo=a,null!==this.panel&&this.panel.v(),this.Nb("separatorStrokeWidth",b,a))}},separatorDashArray:{get:function(){return this.tj},set:function(a){var b=this.tj;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.tj=a;null!==this.panel&&this.panel.N();this.Nb("separatorDashArray",b,a)}}},background:{get:function(){return this.Oa},set:function(a){var b=this.Oa;b!==a&&(null!==a&&$l(a,"RowColumnDefinition.background"),a instanceof ql&&a.freeze(),this.Oa=a,null!==this.panel&&this.panel.N(),this.Nb("background",b,a))}},coversSeparators:{
get:function(){return this.Om},set:function(a){var b=this.Om;b!==a&&(this.Om=a,null!==this.panel&&this.panel.N(),this.Nb("coversSeparators",b,a))}},sizing:{get:function(){return this.no},set:function(a){var b=this.no;b!==a&&(this.no=a,null!==this.panel&&this.panel.v(),this.Nb("sizing",b,a))}},actual:{get:function(){return this.oa},set:function(a){this.oa=isNaN(this.Gc)?Math.max(Math.min(this.hj,a),this.jj):Math.max(Math.min(this.hj,
this.Gc),this.jj)}},measured:{get:function(){return this.mc},set:function(a){this.mc=a}},total:{get:function(){return this.oa+this.Tc()}},position:{get:function(){return this.pa},set:function(a){this.pa=a}}});Vj.prototype.computeEffectiveSpacing=Vj.prototype.Tc;Vj.prototype.computeEffectiveSpacingTop=Vj.prototype.Ho;var Jn=new E(Vj,"Default",0),Qm=new E(Vj,"None",1),In=new E(Vj,"ProportionalExtra",2);
Vj.className="RowColumnDefinition";Vj.Default=Jn;Vj.None=Qm;Vj.ProportionalExtra=In;function Bf(a,b){Y.call(this);this.Md=this.ta=null;this.$m="None";this.wc=this.Ti="black";this.hg=1;this.Na=this.Wg=null;this.Un=this.Tn=NaN;this.fa=null;"string"===typeof a?this.figure=a:a&&Object.assign(this,a);b&&Object.assign(this,b)}la(Bf,Y);
Bf.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.ta=this.ta;a.Md=this.Md;a.$m=this.$m;a.Ti=this.Ti;a.wc=this.wc;a.hg=this.hg;null!==this.Wg&&(a.Wg=Ba(this.Wg));null!==this.Na&&(a.Na=this.Na.lc?this.Na:this.Na.copy());a.Tn=this.Tn;a.Un=this.Un;null!==this.fa&&(a.fa=this.fa.copy())};function Kn(a){null===a.Na?a.Na=new Ln:a.Na.lc&&(a.Na=a.Na.copy())}t=Bf.prototype;t.rh=function(){Y.prototype.rh.call(this);null!==this.Na&&(this.Na.lc=!0)};
t.rb=function(a){a===kg||a===mg||a===Zk||a===Yk?this.geometryStretch=a:Y.prototype.rb.call(this,a)};t.toString=function(){return"Shape("+("None"!==this.figure?this.figure:"None"!==this.toArrow?this.toArrow:this.fromArrow)+")#"+bb(this)};
function Mn(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=.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 Bf&&(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 y=0;.1<=u;){0===y&&(m?(e=c,e-=l,u-=l,m=!1):e=c,0===e&&(e=1));
if(e>u){Ga(w);return}e>q?(y=e-q,e=q):y=0;var z=Math.sqrt(e*e/(1+p*p));0>n&&(z=-z);h+=z;k+=p*z;a.translate(h,k);a.rotate(r);a.translate(-(g/2),-(f/2));0===y&&d.fh(a,b);a.translate(g/2,f/2);a.rotate(-r);a.translate(-h,-k);u-=e;q-=e;if(0!==y){v++;if(v===w.length){Ga(w);return}q=w[v];n=q[0];r=q[1];p=q[2];q=q[3];e=y}}Ga(w)}}
t.fh=function(a,b){var c=this.wc,d=this.Ti;if(null!==c||null!==d){var e=this.ta;if(null!==e){a.xc();var f=this.actualBounds,g=this.naturalBounds;null!==d&&ji(this,a,d,!0,!1,g,f);var h=this.part,k=this.hg;null===c||0!==k||null===h||!this.isPanelMain&&h.sb()!==this||(k=h.type===W.Link&&h instanceof te&&"Selection"===h.category&&h.adornedObject instanceof Bf&&h.adornedPart.sb()===h.adornedObject?h.adornedObject.strokeWidth:0);0===k&&(c=null);null!==c&&0!==k&&(ji(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.Gf("drawShadows")&&(f=h.isShadowed);!1===a.Fl&&(f=!1);h=!0;null===c||null!==d&&"transparent"!==d||(h=!1);g=!1;k=this.strokeDashArray;null!==k&&(g=!0,a.fs(k,this.strokeDashOffset));if(e.type===P.j)a.beginPath(),a.moveTo(e.startX,e.startY),a.lineTo(e.endX,e.endY),null!==c&&a.hk(),a.Re();else if(e.type===P.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.mg(d);null!==c&&(h&&f&&ul(a),a.hk(),h&&f&&tl(a));a.Re()}else if(e.type===P.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+K.vg*e,k-p,l+e,k-K.vg*p,l+e,k),a.bezierCurveTo(l+e,k+K.vg*p,l+K.vg*e,k+p,l,k+p),a.bezierCurveTo(l-K.vg*e,k+p,l-e,k+K.vg*p,l-e,k),a.bezierCurveTo(l-e,k-K.vg*p,l-K.vg*e,k-p,l,k-p),a.closePath(),null!==d&&a.mg(d),null!==c&&
(h&&f&&ul(a),a.hk(),h&&f&&tl(a)),a.Re();else if(e.type===P.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 Dd:a.moveTo(u.endX,u.endY);break;case pd:a.lineTo(u.endX,u.endY);break;case Ed:a.bezierCurveTo(u.point1X,u.point1Y,u.point2X,u.point2Y,u.endX,u.endY);break;case Kd:a.quadraticCurveTo(u.point1X,u.point1Y,u.endX,u.endY);break;case Ld: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=Nd(u,l),w=r.length,0===w)a.lineTo(u.centerX,u.centerY);else for(var v=0;v<w;v++){var y=r[v];0===v&&a.lineTo(y[0],y[1]);a.bezierCurveTo(y[2],y[3],y[4],y[5],y[6],y[7])}break;case Md:v=w=0;if(null!==r&&r.type===Ld){r=Nd(r,l);y=r.length;if(0===y){a.lineTo(u.endX,u.endY);break}r=r[y-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=Od(u,l,w,v);w=r.length;if(0===w){a.lineTo(u.endX,u.endY);break}for(v=0;v<w;v++)y=r[v],a.bezierCurveTo(y[2],y[3],y[4],y[5],y[6],y[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.mg(d,l.isEvenOdd),null!==c&&(m&&h&&ul(a),a.hk(),m&&h&&tl(a))):(ul(a),m&&"transparent"!==d&&null!==d&&a.mg(d,l.isEvenOdd),null!==c&&a.hk(),tl(a)):(m&&null!==d&&a.mg(d,l.isEvenOdd),
null!==c&&a.hk());a.Re(p)}g&&a.cs();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===P.j)d.push(f.startX),d.push(f.startY),d.push(f.endX),d.push(f.endY),Mn(a,b,d,c);else if(f.type===P.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 Dd:Mn(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 pd:d.push(q.endX);d.push(q.endY);g=q.endX;e=q.endY;break;case Ed:K.Pe(g,e,q.point1X,q.point1Y,q.point2X,q.point2Y,q.endX,q.endY,.5,d);g=q.endX;e=q.endY;break;case Kd:K.ap(g,e,q.point1X,q.point1Y,q.endX,q.endY,.5,d);g=q.endX;e=q.endY;break;case Ld:u=Nd(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],K.Pe(g,e,v[2],v[3],v[4],v[5],v[6],v[7],.5,d),g=v[6],
e=v[7];break;case Md:u=Od(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],K.Pe(g,e,v[2],v[3],v[4],v[5],v[6],v[7],.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),Mn(a,b,d,c))}Mn(a,b,d,c)}else if(f.type===P.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),Mn(a,b,d,c);else if(f.type===
P.F){e=new Wd;e.startX=f.endX;e.startY=(f.startY+f.endY)/2;g=new Xd(Ld);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=Nd(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],K.Pe(g,e,p[2],p[3],p[4],p[5],p[6],p[7],.5,d),g=p[6],e=p[7];Mn(a,b,d,c)}Ga(d);a.restore();a.Sc(!1)}}}};
t.ik=function(a,b,c){if(!Y.prototype.ik.call(this,a,b,c)||null===this.wc&&null===this.Ti||null===this.ta||null!==this.pathPattern)return!1;a.bs=this.svg;this.fh(a,b);a.bs=null;return!0};t.lk=function(a){return null!==this.geometry&&1<this.geometry.figures.length||null!==this.pathPattern?!0:Y.prototype.lk.call(this,a)};t.Bv=function(a,b){if("g"!==a.nodeName)a.setAttributeNS(null,"filter",b);else{a=a.getElementsByTagName("path");for(var c=0;c<a.length;c++)a[c].setAttributeNS(null,"filter",b)}};
t.ka=function(a,b){void 0===b&&(b=new J);if(a instanceof O){a.Lc()&&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.me.Ga(b);return b};
t.li=function(a){void 0===a&&(a=new N);var b=this.naturalBounds,c=this.me;b=N.allocAt(b.x,b.y,b.width,b.height);var d=this.strokeWidth;b.Ac(d/2,d/2);d=J.allocAt(b.x,b.y).transform(c);a.h(d.x,d.y,0,0);d.h(b.right,b.y).transform(c);Yb(a,d.x,d.y,0,0);d.h(b.right,b.bottom).transform(c);Yb(a,d.x,d.y,0,0);d.h(b.x,b.bottom).transform(c);Yb(a,d.x,d.y,0,0);N.free(b);J.free(d);return a};
t.eh=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!==P.j||b||(e+=2);var f=N.alloc();f.assign(d);f.Ac(e+2,e+2);if(!f.ca(a))return N.free(f),!1;d=e+1E-4;if(c.type===P.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;N.free(f);return K.Wb(c.startX,c.startY,c.endX,c.endY,e,a.x,a.y)}if(c.type===
P.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.Ac(-d,-d);if(f.ca(a))return N.free(f),!1;f.Ac(d,d)}null!==this.stroke&&f.Ac(e,e);a=f.ca(a);N.free(f);return a}if(c.type===P.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 N.free(f),
!1;g+=d;e+=d}null!==this.stroke&&(g+=d,e+=d);N.free(f);return 0>=g||0>=e?!1:1>=c*c/(g*g)+b*b/(e*e)}if(c.type===P.m)return N.free(f),null===this.fill?Rd(c,a.x,a.y,e):Pd(c,a,e,1<this.strokeWidth,b);C("Unknown Geometry type: "+c.type)};
t.Ul=function(a,b,c,d){var e=this.desiredSize,f=this.hg;a=Math.max(a,0);b=Math.max(b,0);if(null!==this.Md)var g=this.geometry.bounds;else{var h=this.figure,k=Nn[h];if(void 0===k){var l=K.Ye[h];"string"===typeof l&&(l=K.Ye[l]);"function"===typeof l?(k=l(null,100,100),Nn[h]=k):C("Unsupported Figure: "+h)}g=k.bounds}h=g.width;k=g.height;l=g.width;var m=g.height;switch(jl(this,!0)){case kg:d=c=0;break;case nd:l=Math.max(a-f,0);m=Math.max(b-f,0);break;case Wk:l=Math.max(a-f,0);d=0;break;case Xk:c=0,m=
Math.max(b-f,0)}isFinite(e.width)&&(l=e.width);isFinite(e.height)&&(m=e.height);var n=this.maxSize,p=this.minSize;c=Math.max(c-f,p.width);d=Math.max(d-f,p.height);l=Math.min(n.width,l);m=Math.min(n.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=lg(this);switch(c){case kg:break;case nd:h=l;k=m;break;case mg: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.Md?(0===h&&(h=.001),0===k&&(k=
.001),c=null!==this.Md?this.Md:this.ta,g=c.bounds,d=h/g.width,g=k/g.height,isFinite(d)||(d=1),isFinite(g)||(g=1),this.ta=1===d&&1===g?c:c.copy().scale(d,g)):null!==this.ta&&K.$(this.ta.Qk,a-f)&&K.$(this.ta.Pk,b-f)||(this.ta=Bf.makeGeometry(this,h,k));g=this.ta.bounds;Infinity===a||Infinity===b?this.Fe(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.Fe(-(f/2),-(f/2),l+f,m+f);e.w()?(l=e.width,m=e.height,l=Math.min(n.width,l),m=Math.min(n.height,m),l=Math.max(p.width,l),m=Math.max(p.height,
m),this.cc.h(0,0,l,m)):this.cc.assign(g)};function lg(a){var b=a.geometryStretch;return null!==a.Md?b===Yk?nd:b:b===Yk?Nn[a.figure].defaultStretch:b}t.bh=function(a,b,c,d){ml(this,a,b,c,d)};t.os=function(a,b,c){return this.Sj(a.x,a.y,b.x,b.y,c)};
t.Sj=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.hg/2;l=this.ta;null===l&&(this.measure(Infinity,Infinity),l=this.ta);var r=l.bounds;m=!1;if(l.type===P.j)if(1.5>=this.strokeWidth)m=K.Ue(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 J;K.Ue(l.startX+d,l.startY+m,l.endX+d,l.endY+m,f,g,h,k,a)&&b.push(a);a=new J;K.Ue(l.startX-d,l.startY-m,l.endX-d,l.endY-m,f,g,h,k,a)&&b.push(a);a=new J;K.Ue(l.startX+d,l.startY+m,l.startX-d,l.startY-m,f,g,h,k,a)&&b.push(a);a=new J;K.Ue(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===P.u)m=K.Ff(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===P.F){b=N.allocAt(r.x,r.y,r.width,r.height).Ac(n,n);a:if(0===b.width)m=K.Ue(b.x,b.y,b.x,b.y+b.height,f,g,h,k,e);else if(0===b.height)m=K.Ue(b.x,b.y,b.x+b.width,b.y,f,g,h,k,e);else{a=b.width/2;l=b.height/2;d=b.x+a;m=b.y+l;c=9999;f!==h&&(c=(g-k)/(f-h));if(9999>Math.abs(c)){k=g-m-c*(f-d);if(0>a*a*c*c+l*l-k*k){e.x=NaN;e.y=NaN;m=!1;break a}n=Math.sqrt(a*a*c*c+l*l-k*k);h=(-(a*a*c*k)+a*l*n)/(l*l+a*a*c*c)+d;a=(-(a*a*c*k)-a*l*n)/(l*l+a*a*c*c)+d;l=c*(h-d)+k+m;k=c*
(a-d)+k+m;Math.abs((f-h)*(f-h))+Math.abs((g-l)*(g-l))<Math.abs((f-a)*(f-a))+Math.abs((g-k)*(g-k))?(e.x=h,e.y=l):(e.x=a,e.y=k)}else{h=l*l;k=f-d;h-=h/(a*a)*k*k;if(0>h){e.x=NaN;e.y=NaN;m=!1;break a}k=Math.sqrt(h);h=m+k;k=m-k;Math.abs(h-g)<Math.abs(k-g)?(e.x=f,e.y=h):(e.x=f,e.y=k)}m=!0}N.free(b)}else if(l.type===P.m){p=J.alloc();var q=h-f;var u=k-g,w=q*q+u*u,v=f,y=g;if(0<w&&r.contains(v,y)&&(p.x=v,p.y=y,this.ca(p)))for(0!==q&&.5>Math.abs(q)?(u*=.5/q,q=.5):0!==u&&.5>Math.abs(u)&&(q*=.5/u,u=.5),v-=q,y-=
u;r.contains(v,y);)v-=q,y-=u;e.x=h;e.y=k;for(u=0;u<l.figures.count;u++){var z=l.figures.s[u],A=z.isFilled?v:f,B=z.isFilled?y:g,D=z.segments;r=z.startX;q=z.startY;for(var M=r,S=q,R=0;R<D.count;R++){var I=D.s[R],G=I.type;var ca=I.endX;var X=I.endY;var na=!1;switch(G){case Dd:M=ca;S=X;break;case pd:na=On(r,q,ca,X,A,B,h,k,p);break;case Ed:na=K.Do(r,q,I.point1X,I.point1Y,I.point2X,I.point2Y,ca,X,A,B,h,k,.6,p);break;case Kd:na=K.Do(r,q,r+2/3*(I.point1X-r),q+2/3*(I.point1Y-q),ca+2/3*(I.point1X-ca),X+2/3*
(I.point1Y-X),ca,X,A,B,h,k,.6,p);break;case Ld:case Md:G=I.type===Ld?Nd(I,z):Od(I,z,r,q);var wa=G.length;if(0===wa){na=On(r,q,I.type===Ld?I.centerX:I.endX,I.type===Ld?I.centerY:I.endY,A,B,h,k,p);break}X=null;for(ca=0;ca<wa;ca++){X=G[ca];if(0===ca&&On(r,q,X[0],X[1],A,B,h,k,p)){var db=Wn(A,B,p,w,e);db<w&&(w=db,m=!0)}K.Do(X[0],X[1],X[2],X[3],X[4],X[5],X[6],X[7],A,B,h,k,.6,p)&&(db=Wn(A,B,p,w,e),db<w&&(w=db,m=!0))}ca=X[6];X=X[7];break;default:C("Unknown Segment type: "+G)}r=ca;q=X;na&&(na=Wn(A,B,p,w,e),
na<w&&(w=na,m=!0));I.isClosed&&(ca=M,X=S,On(r,q,ca,X,A,B,h,k,p)&&(I=Wn(A,B,p,w,e),I<w&&(w=I,m=!0)))}}f=c-a;g=d-b;h=Math.sqrt(f*f+g*g);0!==h&&(f/=h,g/=h);e.x-=f*n;e.y-=g*n;J.free(p)}else C("Unknown Geometry type: "+l.type);if(!m)return!1;this.transform.Ga(e);return!0};function Wn(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 On(a,b,c,d,e,f,g,h,k){if(K.$(a,c)&&K.$(b,d)||K.$(e,g)&&K.$(f,h))return!1;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||K.$(k.y,a))&&(k.y<b||K.$(k.y,b))&&(l=!0)):(b=a<c?a:c,a=a<c?c:a,(k.x>b||K.$(k.x,b))&&(k.x<a||K.$(k.x,a))&&(l=!0));return l}
t.dh=function(a,b){if(void 0===b)return a.Qe(this.actualBounds);var c=this.ta;null===c&&(this.measure(Infinity,Infinity),c=this.ta);c=c.bounds;var d=this.strokeWidth/2,e=!1,f=J.alloc();f.h(c.x-d,c.y-d);a.ca(b.Ga(f))&&(f.h(c.x-d,c.bottom+d),a.ca(b.Ga(f))&&(f.h(c.right+d,c.bottom+d),a.ca(b.Ga(f))&&(f.h(c.right+d,c.y-d),a.ca(b.Ga(f))&&(e=!0))));J.free(f);return e};
t.Vc=function(a,b){if(this.dh(a,b)||void 0===b&&(b=this.transform,a.Qe(this.actualBounds)))return!0;var c=ld.alloc();c.set(b);c.Ql();var d=a.left,e=a.right,f=a.top;a=a.bottom;var g=J.alloc();g.h(d,f);c.Ga(g);if(this.eh(g,!0))return J.free(g),!0;g.h(e,f);c.Ga(g);if(this.eh(g,!0))return J.free(g),!0;g.h(d,a);c.Ga(g);if(this.eh(g,!0))return J.free(g),!0;g.h(e,a);c.Ga(g);if(this.eh(g,!0))return J.free(g),!0;var h=J.alloc(),k=J.alloc();c.set(b);c.bv(this.transform);c.Ql();h.x=e;h.y=f;h.transform(c);g.x=
d;g.y=f;g.transform(c);b=!1;Xn(this,g,h,k)?b=!0:(g.x=e,g.y=a,g.transform(c),Xn(this,g,h,k)?b=!0:(h.x=d,h.y=a,h.transform(c),Xn(this,g,h,k)?b=!0:(g.x=d,g.y=f,g.transform(c),Xn(this,g,h,k)&&(b=!0))));J.free(g);ld.free(c);J.free(h);J.free(k);return b};function Xn(a,b,c,d){if(!a.os(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.tx=function(a,b,c){function d(a,b){for(var c=a.length,d=0;d<c;d+=2)if(b.xd(a[d],a[d+1])>e)return!0;return!1}if(c&&null!==this.fill&&this.eh(a,!0))return!0;var e=a.Bf(b),f=e;1.5<this.strokeWidth&&(e=this.strokeWidth/2+Math.sqrt(e),e*=e);b=this.ta;if(null===b&&(this.measure(Infinity,Infinity),b=this.ta,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(zb(a.x,a.y,h,k)<=e&&zb(a.x,a.y,l,k)<=e&&zb(a.x,a.y,h,g)<=e&&zb(a.x,a.y,l,g)<=e)return!0}h=b.startX;k=b.startY;l=
b.endX;g=b.endY;if(b.type===P.j){if(c=(h-l)*(a.x-l)+(k-g)*(a.y-g),yb(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===P.u)return b=!1,c&&(b=yb(a.x,a.y,h,k,h,g)<=e||yb(a.x,a.y,h,k,l,k)<=e||yb(a.x,a.y,l,k,l,g)<=e||yb(a.x,a.y,h,g,l,g)<=e),b;if(b.type===P.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 yb(a.x,a.y,h,k,l,g)<=e?!0:!1;if(c){if(a=K.az(m,n,b,f),a*a<=e)return!0}else return zb(b,f,-m,0)>=e||zb(b,f,0,-n)>=e||zb(b,
f,0,n)>=e||zb(b,f,m,0)>=e?!1:!0}else if(b.type===P.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&&yb(a.x,a.y,f,h,f,l)>e&&yb(a.x,a.y,f,h,k,h)>e&&yb(a.x,a.y,k,l,f,l)>e&&yb(a.x,a.y,k,l,k,h)>e)return!1;f=Math.sqrt(e);if(c){if(null===this.fill?Rd(b,a.x,a.y,f):Pd(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.xd(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 Dd:case pd:g=n.endX;
m=n.endY;if(a.xd(g,m)>e)return!1;break;case Ed:var p=Ea();K.Pe(g,m,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.8,p);g=d(p,a);Ga(p);if(g)return!1;g=n.endX;m=n.endY;if(a.xd(g,m)>e)return!1;break;case Kd:p=Ea();K.ap(g,m,n.point1X,n.point1Y,n.endX,n.endY,.8,p);g=d(p,a);Ga(p);if(g)return!1;g=n.endX;m=n.endY;if(a.xd(g,m)>e)return!1;break;case Ld:case Md:p=n.type===Ld?Nd(n,f):Od(n,f,g,m);var r=p.length;if(0===r){g=n.type===Ld?n.centerX:n.endX;m=n.type===Ld?n.centerY:n.endY;if(a.xd(g,m)>e)return!1;
break}n=null;for(var q=Ea(),u=0;u<r;u++)if(n=p[u],q.length=0,K.Pe(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],.8,q),d(q,a))return Ga(q),!1;Ga(q);null!==n&&(g=n[6],m=n[7]);break;default:C("Unknown Segment type: "+n.type)}}return!0}}}return!1};t.pc=function(){this.ta=null};t.gq=function(){return this.hg};
function Yn(a){var b=a.diagram;null!==b&&b.undoManager.isUndoingRedoing||(a.segmentOrientation=fn,"None"!==a.toArrow?(a.segmentIndex=-1,a.alignmentFocus=bd):"None"!==a.fromArrow&&(a.segmentIndex=0,a.alignmentFocus=new O(1-bd.x,bd.y)))}
Bf.makeGeometry=function(a,b,c){if("None"!==a.toArrow)var d=Zn[a.toArrow];else"None"!==a.fromArrow?d=Zn[a.fromArrow]:(d=K.Ye[a.figure],"string"===typeof d&&(d=K.Ye[d]),void 0===d&&C("Unknown Shape.figure: "+a.figure),d=d(a,b,c),d.Qk=b,d.Pk=c);if(null===d){var e=K.Ye.Rectangle;"function"===typeof e&&(d=e(a,b,c))}return d};
function $n(a){var b=Zn[a];if(void 0===b){var c=a.toLowerCase();if("none"===c)return"None";b=Zn[c];if(void 0===b){var d=null,e;for(e in K.tm)if(e.toLowerCase()===c){d=e;break}if(null!==d)return a=P.parse(K.tm[d],!1),Zn[d]=a,c!==d&&(Zn[c]=d),d}}return"string"===typeof b?b:b instanceof P?a:null}
ma.Object.defineProperties(Bf.prototype,{geometry:{get:function(){return null!==this.ta?this.ta:this.Md},set:function(a){var b=this.ta,c=this.Md;if(b!==a){null!==a?this.Md=this.ta=a.freeze():this.Md=this.ta=null;var d=this.part;null!==d&&(d.$f=NaN);this.v();this.g("geometry",b||c,a);fl(this)&&(a=this.part,null!==a&&gl(this,a,"geometryString"))}}},geometryString:{get:function(){return null===this.geometry?"":this.geometry.toString()},set:function(a){a=
P.parse(a);var b=a.normalize();this.geometry=a;this.position=a=J.allocAt(-b.x,-b.y);J.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.v(),this.g("isGeometryPositioned",b,a))}},fill:{get:function(){return this.Ti},set:function(a){var b=this.Ti;b!==a&&(null!==a&&$l(a,"Shape.fill"),a instanceof ql&&a.freeze(),this.Ti=a,this.N(),this.g("fill",
b,a))}},stroke:{get:function(){return this.wc},set:function(a){var b=this.wc;b!==a&&(null!==a&&$l(a,"Shape.stroke"),a instanceof ql&&a.freeze(),this.wc=a,this.N(),this.g("stroke",b,a))}},strokeWidth:{get:function(){return this.hg},set:function(a){var b=this.hg;if(b!==a)if(0<=a){this.hg=a;this.v();var c=this.part;null!==c&&(c.$f=NaN);this.g("strokeWidth",b,a)}else xa(a,"value >= 0",Bf,"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?xa(a,'"butt", "round", or "square"',Bf,"strokeCap"):(Kn(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?xa(a,'"miter", "bevel", or "round"',
Bf,"strokeJoin"):(Kn(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){Kn(this);this.Na.Fr=a;this.N();var c=this.part;null!==c&&(c.$f=NaN);this.g("strokeMiterLimit",b,a)}}},strokeDashArray:{get:function(){return this.Wg},set:function(a){var b=this.Wg;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.Wg=a;this.N();this.g("strokeDashArray",b,a)}}},strokeDashOffset:{get:function(){return null!==this.Na?this.Na.uj:0},set:function(a){var b=this.strokeDashOffset;b!==a&&0<=a&&(Kn(this),this.Na.uj=a,this.N(),this.g("strokeDashOffset",b,a))}},figure:{get:function(){return this.$m},set:function(a){var b=
this.$m;if(b!==a){var c=K.Ye[a];"function"===typeof c?c=a:(c=K.Ye[a.toLowerCase()])||C("Unknown Shape.figure: "+a);b!==c&&(a=this.part,null!==a&&(a.$f=NaN),this.$m=c,this.Md=null,this.pc(),this.v(),this.g("figure",b,c))}}},toArrow:{get:function(){return null!==this.Ua?this.Ua.V:"None"},set:function(a){var b=this.toArrow;!0===a?a="Standard":!1===a&&(a="");if(b!==a){var c=$n(a);null===c?C("Unknown Shape.toArrow: "+a):b!==c&&(null===this.Ua&&(this.Ua=new Zl),this.Ua.V=c,
this.Md=null,this.pc(),this.v(),Yn(this),this.g("toArrow",b,c))}}},fromArrow:{get:function(){return null!==this.Ua?this.Ua.j:"None"},set:function(a){var b=this.fromArrow;!0===a?a="Standard":!1===a&&(a="");if(b!==a){var c=$n(a);null===c?C("Unknown Shape.fromArrow: "+a):b!==c&&(null===this.Ua&&(this.Ua=new Zl),this.Ua.j=c,this.Md=null,this.pc(),this.v(),Yn(this),this.g("fromArrow",b,c))}}},spot1:{get:function(){return null!==this.Na?this.Na.eg:
Sc},set:function(a){var b=this.spot1;b.C(a)||(a=a.J(),Kn(this),this.Na.eg=a,this.v(),this.g("spot1",b,a))}},spot2:{get:function(){return null!==this.Na?this.Na.fg:Sc},set:function(a){var b=this.spot2;b.C(a)||(a=a.J(),Kn(this),this.Na.fg=a,this.v(),this.g("spot2",b,a))}},parameter1:{get:function(){return this.Tn},set:function(a){var b=this.Tn;b!==a&&(this.Tn=a,this.pc(),this.v(),this.g("parameter1",b,a))}},parameter2:{
get:function(){return this.Un},set:function(a){var b=this.Un;b!==a&&(this.Un=a,this.pc(),this.v(),this.g("parameter2",b,a))}},naturalBounds:{get:function(){return this.cc}},pathPattern:{get:function(){return null!==this.Na?this.Na.Yq:null},set:function(a){var b=this.pathPattern;b!==a&&(Kn(this),this.Na.Yq=a,this.N(),this.g("pathPattern",b,a))}},geometryStretch:{get:function(){return null!==this.Na?this.Na.fq:
Yk},set:function(a){var b=this.geometryStretch;b!==a&&(Kn(this),this.Na.fq=a,this.v(),this.g("geometryStretch",b,a))}},interval:{get:function(){return null!==this.fa?this.fa.Rk: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 ao);this.fa.Rk=a;var c=this.diagram;null!==c&&this.panel===c.grid&&qj(c);this.v();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 ao),this.fa.u=a,this.v(),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 ao),this.fa.j=a,this.v(),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 ao),this.fa.m=a,this.v(),this.g("graduatedSkip",b,a))}}});Bf.prototype.intersectsRect=Bf.prototype.Vc;Bf.prototype.containedInRect=Bf.prototype.dh;Bf.prototype.getNearestIntersectionPoint=Bf.prototype.os;Bf.prototype.getDocumentBounds=Bf.prototype.li;Bf.prototype.getDocumentPoint=Bf.prototype.ka;var Zn=new Ta,Nn=new Ta;Bf.className="Shape";
Bf.getFigureGenerators=function(){var a=new ob,b;for(b in K.Ye)b!==b.toLowerCase()&&a.add(b,K.Ye[b]);a.freeze();return a};Bf.defineFigureGenerator=function(a,b){var c=a.toLowerCase(),d=K.Ye;d[a]=b;d[c]=a};Bf.getArrowheadGeometries=function(){var a=new ob;for(d in K.tm)if(void 0===Zn[d]){var b=P.parse(K.tm[d],!1);Zn[d]=b;b=d.toLowerCase();b!==d&&(Zn[b]=d)}for(var c in Zn)if(c!==c.toLowerCase()){var d=Zn[c];d instanceof P&&a.add(c,d)}a.freeze();return a};
Bf.defineArrowheadGeometry=function(a,b){var c=null;"string"===typeof b?c=P.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=Zn;d[a]=c;d[b]=a};function Ln(){this.lc=!1;this.Dr="butt";this.Er="miter";this.Fr=10;this.uj=0;this.Yq=null;this.fq=Yk;this.fg=this.eg=Sc}
Ln.prototype.copy=function(){var a=new Ln;a.Dr=this.Dr;a.Er=this.Er;a.Fr=this.Fr;a.uj=this.uj;a.Yq=this.Yq;a.fq=this.fq;a.eg=this.eg.J();a.fg=this.fg.J();return a};
function Pg(a,b){Y.call(this);bo||(co=Ng?(new Pi(null)).context:null,bo=!0);this.o|=2097152;this.dc="";this.wc="black";this.ze="13px sans-serif";this.Hq=this.Eb=this.Fc=0;this.da=this.fa=this.Fm=this.Lt=this.Mt=null;this.Hh=0;this.cf=null;this.Ke=0;this.ye=this.Zb=this.Pc=null;"string"===typeof a?this.text=a:a&&Object.assign(this,a);b&&Object.assign(this,b);return this}la(Pg,Y);
Pg.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.dc=this.dc;a.wc=this.wc;a.ze=this.ze;a.Fc=this.Fc;a.Eb=this.Eb;a.Hq=this.Hq;a.Mt=this.Mt;a.Lt=this.Lt;a.Fm=this.Fm;null!==this.fa&&(a.fa=this.fa.copy());null!==this.da&&(a.da=this.da.lc?this.da:this.da.copy());a.Hh=this.Hh;a.cf=this.cf;a.Ke=this.Ke;a.Pc=this.Pc;a.Zb=this.Zb;a.ye=this.ye};function eo(a){null===a.da?a.da=new fo:a.da.lc&&(a.da=a.da.copy())}t=Pg.prototype;
t.rh=function(){Y.prototype.rh.call(this);null!==this.da&&(this.da.lc=!0)};
function en(a,b){a.o=b.o|6144;a.qb=b.opacity;a.Oa=b.background;a.areaBackground=b.areaBackground;a.dd=b.desiredSize.J();a.minSize=b.minSize.J();a.maxSize=b.maxSize.J();null!==b.Lb?a.Lb=b.Lb.copy():a.Lb=null;a.Aa=b.scale;a.Kb=b.angle;a.stretch=b.stretch;a.Ig=b.margin.J();a.Jb=b.alignment.J();a.qk=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.dc=
b.dc;a.wc=b.wc;a.ze=b.ze;null!==a.fa&&(a.fa=b.fa.copy());null!==b.da&&(a.da=b.da.lc?b.da:b.da.copy());a.Hh=b.Hh}t.rb=function(a){a.classType===Pg?this.wrap=a:Y.prototype.rb.call(this,a)};t.toString=function(){return 22<this.dc.length?'TextBlock("'+this.dc.substring(0,20)+'"...)':'TextBlock("'+this.dc+'")'};t.v=function(){Y.prototype.v.call(this);this.Lt=this.Mt=null};
t.fh=function(a,b){if(null!==this.wc&&0!==this.dc.length&&null!==this.ze){var c=this.naturalBounds,d=this.actualBounds,e=c.width,f=c.height,g=go(this),h=a.textAlign=this.textAlign,k=b.sn;"start"===h?h=k?"right":"left":"end"===h&&(h=k?"left":"right");k=this.isUnderline;var l=this.isStrikethrough;ji(this,a,this.wc,!0,!1,c,d);(k||l)&&ji(this,a,this.wc,!1,!1,c,d);d=0;c=!1;var m=this.me,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.jb!==a&&(c=!1);b.jb instanceof ii&&
(c=!1);!1===b.Gf("textGreeking")&&(c=!1);b=this.spacingAbove;n=this.spacingBelow;switch(this.flip){case al:a.translate(e,0);a.scale(-1,1);break;case $k:a.translate(0,f);a.scale(1,-1);break;case bl:a.translate(e,f),a.scale(-1,-1)}a.xc();m=this.Fc;p=(b+g+n)*m;f>p&&(d=this.verticalAlignment,d=d.y*f-d.y*p+d.offsetY);if(1===m&&null!==this.ye)n=this.Eb,n>e&&(n=e),this.Oj(this.ye,a,0,d+b,e,g,n,c,h,k,l);else if(null!==this.Pc&&null!==this.Zb)for(p=0;p<m;p++){var r=this.Pc[p];r>e&&(r=e);d+=b;this.Oj(this.Zb[p],
a,0,d,e,g,r,c,h,k,l);d+=g+n}switch(this.flip){case al:a.scale(-1,1);a.translate(-e,0);break;case $k:a.scale(1,-1);a.translate(0,-f);break;case bl:a.scale(-1,-1),a.translate(-e,-f)}}};
t.Oj=function(a,b,c,d,e,f,g,h,k,l,m){var n=0;if(h)"left"===k?n=0:"right"===k?n=e-g:"center"===k&&(n=(e-g)/2),b.fillRect(c+n,d+.25*f,g,1);else{"left"===k?n=0:"right"===k?n=e:"center"===k&&(n=e/2);e=null!==ho?ho(this,f):.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);if(l){h=null!==io?io(this,f):.8*f;k=c+n;l=d+h;e=c+n+g;h=d+h;var p=a;b.beginPath();b.lineWidth=p;b.moveTo(k,l);b.lineTo(e,h);b.stroke();b.Re();b instanceof ii&&b.Rd.classList.add("gojs-td")}m&&(m=
d+f-f/2.2|0,0!==a%2&&(m+=.5),d=c+n,f=m,c=c+n+g,g=m,n=a,b.beginPath(),b.lineWidth=n,b.moveTo(d,f),b.lineTo(c,g),b.stroke(),b.Re(),b instanceof ii&&b.Rd.classList.add("gojs-td"))}};
t.ik=function(a,b,c){if(!Y.prototype.ik.call(this,a,b,c))return!1;ji(this,a,this.wc,!0,!1,this.naturalBounds,this.actualBounds);if(c){if(0===this.svg.getElementsByTagName("text").length)return!0;b=this.svg.getElementsByClassName("gojs-td");for(c=0;c<b.length;c++)im(a,b[c],!1)}else b=this.svg,b.innerHTML=this.text,im(a,b,!0);return!0};t.lk=function(a){return 1<this.lineCount||this.isUnderline||this.isStrikethrough?!0:Y.prototype.lk.call(this,a)};
t.Bv=function(a,b){if("g"!==a.nodeName)a.setAttributeNS(null,"filter",b);else{a=a.getElementsByTagName("text");for(var c=0;c<a.length;c++)a[c].setAttributeNS(null,"filter",b)}};
t.Ul=function(a,b,c,d){var e=this.Fc;this.Hh=a;var f=this.ze;null!==co&&jo!==f&&(jo=co.font=f);this.Eb=this.Ke=0;this.ye=this.Zb=this.Pc=this.cf=null;var g;if(isNaN(this.desiredSize.width)){f=this.dc.replace(/\r\n/g,"\n").replace(/\r/g,"\n");if(0===f.length)f=0;else if(this.isMultiline){for(var h=g=0,k=!1;!k;){var l=f.indexOf("\n",h);-1===l&&(l=f.length,k=!0);h=f.substr(h,l-h);this.formatting===ko&&(h=h.trim());g=Math.max(g,lo(h));h=l+1}f=g}else g=f.indexOf("\n",0),0<=g&&(f=f.substr(0,g)),f=lo(f);
f=Math.min(f,a/this.scale);f=Math.max(8,f)}else f=this.desiredSize.width;null!==this.panel&&(f=Math.min(f,this.panel.maxSize.width));g=mo(this,f);isNaN(this.desiredSize.height)?g=Math.min(g,b/this.scale):g=this.desiredSize.height;k=g;if(0!==this.Eb&&null!==this.Pc&&null!==this.Zb&&this.overflow===no&&(b=this.ze,b=this.overflow===no?oo(b):0,l=this.spacingAbove+this.spacingBelow,l=Math.max(0,go(this)+l),k=Math.min(this.maxLines-1,Math.max(Math.floor(k/l+.01)-1,0)),!(k+1>=this.Zb.length))){l=this.Zb[k];
for(b=Math.max(1,a-b);lo(l)>b&&1<l.length;)l=l.substr(0,l.length-1);l+=po;b=lo(l);this.Zb[k]=l;this.Zb=this.Zb.slice(0,k+1);this.Pc[k]=b;this.Pc=this.Pc.slice(0,k+1);this.Ke=this.Zb.length;this.Eb=Math.max(this.Eb,b);this.Fc=this.Ke;1===this.Fc&&(this.ye=this.Zb[0])}if(this.wrap===qo||isNaN(this.desiredSize.width))f=isNaN(a)?this.Eb:Math.min(a,this.Eb),isNaN(this.desiredSize.width)&&(f=Math.max(8,f));f=Math.max(c,f);g=Math.max(d,g);Pb(this.cc,f,g);this.Fe(0,0,f,g);null!==this.svg&&e!==this.Fc&&(this.rf=
!0)};t.bh=function(a,b,c,d){ml(this,a,b,c,d)};function ro(a,b,c){if(null===a.ye)a.ye=b,a.Eb=c;else{if(null===a.Zb||null===a.Pc)a.Zb=[],a.Pc=[],a.Zb.push(a.ye),a.Pc.push(a.Eb);a.Zb.push(b);a.Pc.push(c)}}
function so(a,b,c,d){var e=a.formatting===ko;e&&(b=b.trim());var f=0,g=a.ze,h=a.spacingAbove+a.spacingBelow;h=Math.max(0,go(a)+h);var k=a.overflow===no?oo(g):0;if(a.Fc>=a.maxLines)null!==d&&d.h(0,h);else if(g=b,a.wrap===to){a.Ke=1;var l=lo(b);if(0===k||l<=c)a.Eb=Math.max(a.Eb,l),ro(a,b,a.Eb),null!==d&&d.h(l,h);else{f=uo(a,g);g=g.substr(f.length);b=uo(a,g);for(l=lo(f+b);0<b.length&&l<=c;)f+=b,g=g.substr(b.length),b=uo(a,g),l=f+b,e&&(l=l.trim()),l=lo(l);e&&(b=b.trim());f+=b;for(c=Math.max(1,c-k);lo(f)>
c&&1<f.length;)f=f.substr(0,f.length-1);f+=po;var m=lo(f);a.Eb=m;ro(a,f,m);null!==d&&d.h(m,h)}}else{k=0;0===g.length&&(k=1,ro(a,g,0));for(;0<g.length;){b=uo(a,g);for(g=g.substr(b.length);lo(b)>c;){var n=1;l=lo(b.substr(0,n));for(m=0;l<=c;)n++,m=l,l=lo(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);ro(a,b.substr(0,n),p);k++;b=b.substr(n);if(a.Fc+k>a.maxLines)break}m=uo(a,g);for(l=lo(b+m);0<m.length&&l<=c;)b+=m,g=g.substr(m.length),m=uo(a,g),l=b+m,e&&(l=l.trim()),
l=lo(l);e&&(b=b.trim());if(""!==b&&("\u00ad"===b[b.length-1]&&(b=b.substring(0,b.length-1)+"\u2010"),0===m.length?(n=l,f=Math.max(f,l)):(n=m=lo(b),f=Math.max(f,m)),ro(a,b,n),k++,a.Fc+k>a.maxLines))break}a.Ke=Math.min(a.maxLines,k);a.Eb=Math.max(a.Eb,f);null!==d&&d.h(a.Eb,h*a.Ke)}}
function uo(a,b){if(a.wrap===vo)return b.substr(0,1);for(var c=b.length,d=0,e=wo;d<c&&!e.test(b.charAt(d));)d++;for(a.formatting===xo&&(c=Math.min(c,d+1));d<c&&e.test(b.charAt(d));)d++;return d>=b.length?b:b.substr(0,d)}function lo(a){return null===co?8*a.length:co.measureText(a).width}function go(a){if(null!==a.cf)return a.cf;var b=a.ze;if(null===co){var c=16;return a.cf=c}void 0!==yo[b]&&5E3>zo?c=yo[b]:(c=1.3*co.measureText("M").width,yo[b]=c,zo++);return a.cf=c}
function oo(a){if(null===co)return 6;if(void 0!==Ao[a]&&5E3>Bo)var b=Ao[a];else b=co.measureText(po).width,Ao[a]=b,Bo++;return b}
function mo(a,b){var c=a.dc.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),d=a.spacingAbove+a.spacingBelow;d=Math.max(0,go(a)+d);if(0===c.length)return a.Eb=0,a.Fc=1,d;if(!a.isMultiline){var e=c.indexOf("\n",0);0<=e&&(c=c.substr(0,e))}e=0;for(var f=a.Fc=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!==to){a.Ke=0;var k=L.alloc();so(a,f,b,k);e+=k.height;L.free(k);a.Fc+=a.Ke}else so(a,f,b,null),e+=d,a.Fc++;a.Fc===a.maxLines&&(h=!0)}f=g+1}return a.Hq=e}
ma.Object.defineProperties(Pg.prototype,{font:{get:function(){return this.ze},set:function(a){var b=this.ze;b!==a&&(this.ze=a,this.cf=null,this.v(),this.g("font",b,a))}},text:{get:function(){return this.dc},set:function(a){var b=this.dc;null!==a&&void 0!==a?a=a.toString():a="";b!==a&&(this.dc=a,this.v(),this.g("text",b,a),this.rf=!0)}},textAlign:{get:function(){return null!==this.da?this.da.Kr:"start"},set:function(a){var b=
this.textAlign;b===a||"start"!==a&&"end"!==a&&"left"!==a&&"right"!==a&&"center"!==a||(eo(this),this.da.Kr=a,this.N(),this.g("textAlign",b,a))}},flip:{get:function(){return null!==this.da?this.da.Xf:kg},set:function(a){var b=this.flip;b!==a&&(eo(this),this.da.Xf=a,this.N(),this.g("flip",b,a))}},verticalAlignment:{get:function(){return null!==this.da?this.da.Ur:Yc},set:function(a){var b=this.verticalAlignment;b.C(a)||(a=a.J(),eo(this),this.da.Ur=
a,Kl(this),this.g("verticalAlignment",b,a))}},naturalBounds:{get:function(){if(!this.cc.w()){var a=L.alloc();so(this,this.dc,999999,a);var b=a.width;L.free(a);a=mo(this,b);var c=this.desiredSize;isNaN(c.width)||(b=c.width);isNaN(c.height)||(a=c.height);Pb(this.cc,b,a)}return this.cc}},isMultiline:{get:function(){return 0!==(this.o&2097152)},set:function(a){var b=0!==(this.o&2097152);b!==a&&(this.o^=2097152,this.v(),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.rf=!0,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.rf=!0,this.N(),this.g("isStrikethrough",b,a))}},wrap:{get:function(){return null!==this.da?this.da.Wr:
Co},set:function(a){var b=this.wrap;b!==a&&(eo(this),this.da.Wr=a,this.v(),this.g("wrap",b,a))}},overflow:{get:function(){return null!==this.da?this.da.Wq:Do},set:function(a){var b=this.overflow;b!==a&&(eo(this),this.da.Wq=a,this.v(),this.g("overflow",b,a))}},stroke:{get:function(){return this.wc},set:function(a){var b=this.wc;b!==a&&(null!==a&&$l(a,"TextBlock.stroke"),a instanceof ql&&a.freeze(),this.wc=a,this.N(),this.g("stroke",b,a))}},
lineCount:{get:function(){return this.Fc}},lineHeight:{get:function(){return go(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.Mr:null},set:function(a){var b=this.textEditor;b!==a&&(eo(this),this.da.Mr=a,this.g("textEditor",
b,a))}},errorFunction:{get:function(){return null!==this.da?this.da.Cd:null},set:function(a){var b=this.errorFunction;b!==a&&(eo(this),this.da.Cd=a,this.g("errorFunction",b,a))}},interval:{get:function(){return null!==this.fa?this.fa.Rk: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 ao);this.fa.Rk=a;this.v();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 ao),this.fa.u=a,this.v(),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 ao),this.fa.j=a,this.v(),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 ao),this.fa.F=a,this.v(),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 ao),this.fa.m=a,this.v(),this.g("graduatedSkip",b,a))}},textValidation:{
get:function(){return null!==this.da?this.da.vj:null},set:function(a){var b=this.textValidation;b!==a&&(eo(this),this.da.vj=a,this.g("textValidation",b,a))}},textEdited:{get:function(){return null!==this.da?this.da.Lr:null},set:function(a){var b=this.textEdited;b!==a&&(eo(this),this.da.Lr=a,this.g("textEdited",b,a))}},spacingAbove:{get:function(){return null!==this.da?this.da.zr:0},set:function(a){var b=this.spacingAbove;b!==
a&&(eo(this),this.da.zr=a,this.v(),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&&(eo(this),this.da.Ar=a,this.v(),this.g("spacingBelow",b,a))}},formatting:{get:function(){return null!==this.da?this.da.bq:ko},set:function(a){var b=this.formatting;b!==a&&(eo(this),this.da.bq=a,this.v(),this.g("formatting",b,a))}},maxLines:{
get:function(){return null!==this.da?this.da.Fq:Infinity},set:function(a){var b=this.maxLines;b!==a&&(a=Math.floor(a),0>=a&&xa(a,"> 0",Pg,"maxLines"),eo(this),this.da.Fq=a,this.v(),this.g("maxLines",b,a))}},metrics:{get:function(){return{arrSize:null!==this.Pc?this.Pc:[this.Eb],arrText:null!==this.Zb?this.Zb:[this.ye],maxLineWidth:this.Eb,fontHeight:this.cf}}},choices:{get:function(){return this.Fm},set:function(a){var b=this.Fm;b!==a&&(this.Fm=
a,this.g("choices",b,a))}}});var ho=null,io=null,to=new E(Pg,"None",0),qo=new E(Pg,"WrapFit",1),Co=new E(Pg,"WrapDesiredSize",2),vo=new E(Pg,"WrapBreakAll",3),Do=new E(Pg,"OverflowClip",0),no=new E(Pg,"OverflowEllipsis",1),ko=new E(Pg,"FormatTrim",0),xo=new E(Pg,"FormatNone",0),wo=/[ \u200b\u00ad]/,yo=new Ta,zo=0,Ao=new Ta,Bo=0,po="...",jo="",co=null,bo=!1;Pg.className="TextBlock";
function fo(){this.lc=!1;this.Cd=null;this.Xf=kg;this.bq=ko;this.Fq=Infinity;this.Wq=Do;this.Ar=this.zr=0;this.Kr="start";this.vj=this.Mr=this.Lr=null;this.Ur=Yc;this.Wr=Co}fo.prototype.copy=function(){var a=new fo;a.Cd=this.Cd;a.Xf=this.Xf;a.bq=this.bq;a.Fq=this.Fq;a.Wq=this.Wq;a.zr=this.zr;a.Ar=this.Ar;a.Kr=this.Kr;a.Lr=this.Lr;a.Mr=this.Mr;a.vj=this.vj;a.Ur=this.Ur;a.Wr=this.Wr;return a};Pg.getEllipsis=function(){return po};Pg.setEllipsis=function(a){po=a;Ao=new Ta;Bo=0};Pg.getBaseline=function(){return ho};
Pg.setBaseline=function(a){ho=a};Pg.getUnderline=function(){return io};Pg.setUnderline=function(a){io=a};Pg.isValidFont=function(a){bo||(co=Ng?(new Pi(null)).context:null,bo=!0);if(null===co)return!0;var b=co.font;if(a===b||"10px sans-serif"===a)return!0;co.font="10px sans-serif";co.font=a;var c=co.font;if("10px sans-serif"!==c)return co.font=b,!0;co.font="19px serif";var d=co.font;co.font=a;c=co.font;co.font=b;return c!==d};Pg.FormatNone=xo;Pg.FormatTrim=ko;Pg.None=to;Pg.OverflowClip=Do;
Pg.OverflowEllipsis=no;Pg.WrapBreakAll=vo;Pg.WrapDesiredSize=Co;Pg.WrapFit=qo;function ao(){this.Rk=1;this.u=0;this.j=1;this.m=this.F=null}ao.prototype.copy=function(){var a=new ao;a.Rk=this.Rk;a.u=this.u;a.j=this.j;a.F=this.F;a.m=this.m;return a};ao.className="GradElementSettings";
function dk(a,b){Y.call(this);this.Dg=null;this.po="";this.Vg=cc;this.Lk=nd;this.Xg=this.Cd=null;this.Kk=xc;this.Xf=kg;this.tl=null;this.pn=!1;this.dn=!0;this.Zk=!1;this.pl=null;"string"===typeof a?this.source=a:a&&Object.assign(this,a);b&&Object.assign(this,b)}var Eo;la(dk,Y);dk.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.po=this.po;a.element=this.Dg;a.Vg=this.Vg.J();a.Lk=this.Lk;a.Xf=this.Xf;a.Cd=this.Cd;a.Xg=this.Xg;a.Kk=this.Kk.J();a.dn=this.dn;a.pl=this.pl};
dk.prototype.rb=function(a){a===kg||a===mg||a===Zk?this.imageStretch=a:Y.prototype.rb.call(this,a)};dk.prototype.toString=function(){return"Picture("+this.source+")#"+bb(this)};function Mi(a){void 0===a&&(a="");""!==a?Eo[a]&&(delete Eo[a],Fo--):(Eo=new Ta,Fo=0)}
function Go(a,b){b.ty||(b.Bq=function(c){b.oq=!0;b.kn=!1;var d=b.Ag.copy();if(null!==d&&void 0!==d){for(d=d.iterator;d.next();){var e=d.value;e.N();var f=b.getAttribute("src")||"";var g=e.Mg.I(f);if(null!==g)for(var h=g.length,k=0;k<h;k++)f=g[k],e.Wn.add(f),f.rf=!0,e.Yb(),b.gn&&(void 0===b.du&&(b.du=c),null!==f.Xg&&f.Xg(f,c))}b.Ag.clear()}a.desiredSize.w()||(pj(a,!1),a.v())},b.Up=function(a){b.kn=a;var c=b.Ag.copy();if(null!==c&&void 0!==c){for(c=c.iterator;c.next();){var e=c.value,f=b.getAttribute("src")||
"";var g=e.Mg.I(f);if(null!==g){e=g.length;f=Ea();for(var h=0;h<e;h++)f.push(g[h]);if(b.gn)for(h=0;h<e;h++)g=f[h],null!==g.Cd&&g.Cd(g,a);Ga(f)}}b.Ag.clear()}},b.addEventListener("load",b.Bq),b.addEventListener("error",b.Up),b.ty=!0)}dk.prototype.gA=function(){if(""!==this.source){Mi(this.source);var a=this.source;this.source="";this.source=a}};dk.prototype.redraw=function(){this.N()};
dk.prototype.fh=function(a,b){var c=this.Dg;if(null!==c){var d=c.getAttribute("src");if(!(c instanceof HTMLImageElement&&(null===d||""===d)||c.kn instanceof Event&&a instanceof Fl)){var e=a instanceof ii;d=this.naturalBounds;var f=0,g=0,h=this.pn,k=h?+c.width:c.naturalWidth;h=h?+c.height:c.naturalHeight;void 0===k&&c.videoWidth&&(k=c.videoWidth);void 0===h&&c.videoHeight&&(h=c.videoHeight);k=k||d.width;h=h||d.height;if(0!==k&&0!==h){var l=k,m=h;this.sourceRect.w()&&(f=this.Vg.x,g=this.Vg.y,k=this.Vg.width,
h=this.Vg.height);var n=k,p=h,r=this.Lk,q=this.Kk;switch(r){case kg:if(this.sourceRect.w())break;n>=d.width&&(f=f+q.offsetX+(n*q.x-d.width*q.x));p>=d.height&&(g=g+q.offsetY+(p*q.y-d.height*q.y));k=Math.min(d.width,n);h=Math.min(d.height,p);break;case nd:n=d.width;p=d.height;break;case mg:case Zk:r===mg?(r=Math.min(d.height/p,d.width/n),n*=r,p*=r):r===Zk&&(r=Math.max(d.height/p,d.width/n),n*=r,p*=r,n>=d.width&&(f=(f+q.offsetX+(n*q.x-d.width*q.x)/n)*k),p>=d.height&&(g=(g+q.offsetY+(p*q.y-d.height*q.y)/
p)*h),k*=1/(n/d.width),h*=1/(p/d.height),n=d.width,p=d.height)}r=this.Df()*b.scale;var u=n*r*p*r,w=k*h/u,v=c.__goCache;r=null;var y=Ho;if(!e){if(c.oq&&void 0!==v&&4<u&&w>y*y)for(null===v.fi&&(Io(v,4,l,m,c),Io(v,16,l,m,c)),e=v.fi,l=e.length,m=0;m<l;m++)if(e[m].ratio*e[m].ratio<w)r=e[m];else break;if(!b.Wm){if(null===this.tl)if(null===this.Dg)this.tl=!1;else{e=(new Pi(null)).context;try{e.drawImage(this.Dg,0,0)}catch(z){this.dn=!1}try{e.getImageData(0,0,1,1).data[3]&&(this.tl=!1),this.tl=!1}catch(z){this.tl=
!0}}if(this.tl)return}}e=n<d.width?q.offsetX+(d.width*q.x-n*q.x):0;q=p<d.height?q.offsetY+(d.height*q.y-p*q.y):0;switch(this.flip){case al:a.translate(Math.min(d.width,n),0);a.scale(-1,1);break;case $k:a.translate(0,Math.min(d.height,p));a.scale(1,-1);break;case bl:a.translate(Math.min(d.width,n),Math.min(d.height,p)),a.scale(-1,-1)}a.xc();if(b.Gf("pictureRatioOptimization")&&!b.Zi&&void 0!==v&&null!==r&&1!==r.ratio){a.save();b=r.ratio;try{a.drawImage(r.source,f/b,g/b,Math.min(r.source.width,k/b),
Math.min(r.source.height,h/b),e,q,Math.min(d.width,n),Math.min(d.height,p))}catch(z){this.dn=!1}a.restore()}else try{a.drawImage(c,f,g,k,h,e,q,Math.min(d.width,n),Math.min(d.height,p))}catch(z){this.dn=!1}switch(this.flip){case al:a.scale(-1,1);a.translate(-Math.min(d.width,n),0);break;case $k:a.scale(1,-1);a.translate(0,-Math.min(d.height,p));break;case bl:a.scale(-1,-1),a.translate(-Math.min(d.width,n),-Math.min(d.height,p))}}}}};
dk.prototype.Ul=function(a,b,c,d){var e=this.desiredSize,f=jl(this,!0),g=this.Dg,h=this.pn,k=0,l=0;if(h||!this.Zk&&g&&g.complete)this.Zk=!0;null===g?(isFinite(e.width)||(a=0),isFinite(e.height)||(b=0)):(k=h?+g.width:g.naturalWidth,l=h?+g.height:g.naturalHeight);isFinite(e.width)||f===nd||f===Wk?(isFinite(a)||(this.sourceRect.w()?a=this.sourceRect.width:null!==g&&(a=k)),c=0):null!==g&&!1!==this.Zk&&(a=this.sourceRect.w()?this.sourceRect.width:k);isFinite(e.height)||f===nd||f===Xk?(isFinite(b)||(this.sourceRect.w()?
b=this.sourceRect.height:null!==g&&(b=l)),d=0):null!==g&&!1!==this.Zk&&(b=this.sourceRect.w()?this.sourceRect.height:l);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));Pb(this.cc,a,b);this.Fe(0,0,a,b)};dk.prototype.bh=function(a,b,c,d){ml(this,a,b,c,d)};
ma.Object.defineProperties(dk.prototype,{element:{get:function(){return this.Dg},set:function(a){var b=this.Dg;if(b!==a){this.pn=a instanceof HTMLCanvasElement;var c=a instanceof HTMLImageElement;null===a||c||a instanceof HTMLVideoElement||this.pn||C("Picture.element must be an instance of Image, Canvas, or Video, not: "+a);var d=this.diagram;null!==d&&ek(d,this);this.Dg=a;null!==a&&c&&void 0===a.Ag&&(a.Ag=new H);null!==d&&c&&ck(d,this);null!==a&&(this.pn||!0===a.complete?
(a.gn&&(a.kn instanceof Event&&null!==this.Cd?this.Cd(this,a.kn):!0===a.oq&&!a.kn&&null!==this.Xg&&a.du&&this.Xg(this,a.du)),a.oq=!0,this.desiredSize.w()||(pj(this,!1),this.v())):c&&Go(this,a));this.g("element",b,a);this.N()}}},source:{get:function(){return this.po},set:function(a){var b=this.po;if(b!==a){this.po=a;var c=Eo;if(Ng){var d=null;if(void 0!==c[a])d=c[a];else if(""!==a){30<Fo&&(Mi(),c=Eo);d=ua("img");d.gn=!0;Go(this,d);var e=this.pl;null!==e&&(d.crossOrigin=
e(this));d.src=a;c[a]=d;Fo++}this.element=d;null!==d&&void 0===d.__goCache&&(d.__goCache=new Jo);this.v();this.N()}this.g("source",b,a)}}},sourceCrossOrigin:{get:function(){return this.pl},set:function(a){if(this.pl!==a&&(this.pl=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.Vg},
set:function(a){var b=this.Vg;b.C(a)||(this.Vg=a=a.J(),this.N(),this.g("sourceRect",b,a))}},imageStretch:{get:function(){return this.Lk},set:function(a){var b=this.Lk;b!==a&&(this.Lk=a,this.N(),this.g("imageStretch",b,a))}},flip:{get:function(){return this.Xf},set:function(a){var b=this.Xf;b!==a&&(this.Xf=a,this.N(),this.g("flip",b,a))}},imageAlignment:{get:function(){return this.Kk},set:function(a){var b=this.Kk;
b.C(a)||(this.Kk=a=a.J(),this.N(),this.g("imageAlignment",b,a))}},errorFunction:{get:function(){return this.Cd},set:function(a){var b=this.Cd;b!==a&&(this.Cd=a,this.g("errorFunction",b,a))}},successFunction:{get:function(){return this.Xg},set:function(a){var b=this.Xg;b!==a&&(this.Xg=a,this.g("successFunction",b,a))}},naturalBounds:{get:function(){return this.cc}}});dk.prototype.redraw=dk.prototype.redraw;
dk.prototype.reloadSource=dk.prototype.gA;var Fo=0,Ho=4;dk.className="Picture";Eo=new Ta;dk.clearCache=Mi;function Jo(){this.fi=null}function Io(a,b,c,d,e){null===a.fi&&(a.fi=[]);var f=new Pi(null),g=f.context,h=1/b;f.width=c/b;f.height=d/b;0!==f.width&&0!==f.height&&(b=new Ko(f.La,b),c=1,0<a.fi.length&&(c=a.fi[a.fi.length-1],e=c.source,c=c.ratio),g.setTransform(h*c,0,0,h*c,0,0),g.xc(),g.drawImage(e,0,0),a.fi.push(b))}Jo.className="PictureCacheArray";function Ko(a,b){this.source=a;this.ratio=b}
Ko.className="PictureCacheInstance";function Lo(){this.ls=new P;this.kc=null}Lo.prototype.reset=function(a){null!==a?(a.ja(),this.ls=a,a.figures.clear()):this.ls=new P;this.kc=null};function wd(a,b,c,d,e,f){a.kc=new Wd;a.kc.startX=b;a.kc.startY=c;a.kc.isFilled=d;a.kc.isEvenOdd=f||!1;a.ls.figures.add(a.kc);void 0!==e&&(a.kc.isShadowed=e)}function Ad(a){var b=a.kc.segments.length;0<b&&a.kc.segments.L(b-1).close()}
Lo.prototype.moveTo=function(a,b,c){void 0===c&&(c=!1);var d=new Xd(Dd);d.endX=a;d.endY=b;c&&d.close();this.kc.segments.add(d)};Lo.prototype.lineTo=function(a,b,c){void 0===c&&(c=!1);var d=new Xd(pd);d.endX=a;d.endY=b;c&&d.close();this.kc.segments.add(d)};function xd(a,b,c,d,e,f,g){var h;void 0===h&&(h=!1);var k=new Xd(Ed);k.point1X=b;k.point1Y=c;k.point2X=d;k.point2Y=e;k.endX=f;k.endY=g;h&&k.close();a.kc.segments.add(k)}
function yd(a,b,c,d,e){var f;void 0===f&&(f=!1);var g=new Xd(Kd);g.point1X=b;g.point1Y=c;g.endX=d;g.endY=e;f&&g.close();a.kc.segments.add(g)}Lo.prototype.arcTo=function(a,b,c,d,e,f,g){void 0===f&&(f=0);void 0===g&&(g=!1);var h=new Xd(Ld);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.kc.segments.add(h)};function zd(a,b,c,d,e,f,g,h){var k;void 0===k&&(k=!1);b=new Xd(Md,g,h,b,c,d,e,f);k&&b.close();a.kc.segments.add(b)}
function qd(a){var b=Bd;if(null!==b)return Bd=null,b.reset(a),b;b=new Lo;b.reset(a);return b}var Bd=null;Lo.className="StreamGeometryContext";function Mo(a,b){var c=a.toLowerCase(),d=K.Ye;d[a]=b;d[c]=a}Mo("Rectangle",function(a,b,c){a="r"+b+","+c;var d=K.Mf[a];if(void 0!==d)return d;d=new P(P.u);d.endX=b;d.endY=c;K.Nf<K.um&&(K.Mf[a]=d,K.Nf++);return d});
Mo("Square",function(a,b,c){a="s"+b+","+c;var d=K.Mf[a];if(void 0!==d)return d;d=new P(P.u);d.endX=b;d.endY=c;d.defaultStretch=mg;K.Nf<K.um&&(K.Mf[a]=d,K.Nf++);return d});
Mo("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=K.Mf[d];if(void 0!==e)return e;var f=a*K.vg;e=(new P).add((new Wd(a,0,!0)).add(new Xd(pd,b-a,0)).add(new Xd(Ed,b,a,b-f,0,b,f)).add(new Xd(pd,b,c-a)).add(new Xd(Ed,b-a,c,b,c-f,b-f,c)).add(new Xd(pd,a,c)).add(new Xd(Ed,0,c-a,f,c,0,c-f)).add(new Xd(pd,0,a)).add((new Xd(Ed,a,0,0,f,f,0)).close()));1<f&&(e.spot1=new O(0,0,f,f),e.spot2=new O(1,1,-f,-f));K.Nf<K.um&&
(K.Mf[d]=e,K.Nf++);return e});Mo("Border","RoundedRectangle");Mo("Ellipse",function(a,b,c){a="e"+b+","+c;var d=K.Mf[a];if(void 0!==d)return d;d=new P(P.F);d.endX=b;d.endY=c;d.spot1=dd;d.spot2=gd;K.Nf<K.um&&(K.Mf[a]=d,K.Nf++);return d});Mo("Circle",function(a,b,c){a="c"+b+","+c;var d=K.Mf[a];if(void 0!==d)return d;d=new P(P.F);d.endX=b;d.endY=c;d.spot1=dd;d.spot2=gd;d.defaultStretch=mg;K.Nf<K.um&&(K.Mf[a]=d,K.Nf++);return d});
Mo("TriangleRight",function(a,b,c){return(new P).add((new Wd(0,0)).add(new Xd(pd,b,.5*c)).add((new Xd(pd,0,c)).close())).om(0,.25,.5,.75)});Mo("TriangleDown",function(a,b,c){return(new P).add((new Wd(0,0)).add(new Xd(pd,b,0)).add((new Xd(pd,.5*b,c)).close())).om(.25,0,.75,.5)});Mo("TriangleLeft",function(a,b,c){return(new P).add((new Wd(b,c)).add(new Xd(pd,0,.5*c)).add((new Xd(pd,b,0)).close())).om(.5,.25,1,.75)});
Mo("TriangleUp",function(a,b,c){return(new P).add((new Wd(b,c)).add(new Xd(pd,0,c)).add((new Xd(pd,.5*b,0)).close())).om(.25,.5,.75,1)});Mo("Triangle","TriangleUp");Mo("Diamond",function(a,b,c){return(new P).add((new Wd(.5*b,0)).add(new Xd(pd,0,.5*c)).add(new Xd(pd,.5*b,c)).add((new Xd(pd,b,.5*c)).close())).om(.25,.25,.75,.75)});Mo("LineH",function(a,b,c){a=new P(P.j);a.startX=0;a.startY=c/2;a.endX=b;a.endY=c/2;return a});
Mo("LineV",function(a,b,c){a=new P(P.j);a.startX=b/2;a.startY=0;a.endX=b/2;a.endY=c;return a});Mo("None","Rectangle");Mo("BarH","Rectangle");Mo("BarV","Rectangle");Mo("MinusLine","LineH");Mo("PlusLine",function(a,b,c){return(new P).add((new Wd(0,c/2,!1)).add(new Xd(pd,b,c/2)).add(new Xd(Dd,b/2,0)).add(new Xd(pd,b/2,c)))});Mo("XLine",function(a,b,c){return(new P).add((new Wd(0,c,!1)).add(new Xd(pd,b,0)).add(new Xd(Dd,0,0)).add(new Xd(pd,b,c)))});
Mo("LineRight",function(a,b,c){return(new P).add((new Wd(.25*b,0,!1)).add(new Xd(pd,.75*b,.5*c)).add(new Xd(pd,.25*b,c)))});Mo("LineDown",function(a,b,c){return(new P).add((new Wd(0,.25*c,!1)).add(new Xd(pd,.5*b,.75*c)).add(new Xd(pd,b,.25*c)))});Mo("LineLeft",function(a,b,c){return(new P).add((new Wd(.75*b,0,!1)).add(new Xd(pd,.25*b,.5*c)).add(new Xd(pd,.75*b,c)))});Mo("LineUp",function(a,b,c){return(new P).add((new Wd(0,.75*c,!1)).add(new Xd(pd,.5*b,.25*c)).add(new Xd(pd,b,.75*c)))});
K.tm={"":"",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 No(){this.lc=!1;this.pr=this.Hp=this.vq=null;this.rr="";this.br=this.kq=this.qr=null;this.dr="";this.cr=Lb;this.er=null;this.fr="";this.hr=Sc;this.Cq="";this.Dq=sc;this.Lq=qb;this.Gq=rb;this.Rp=null;this.yq=127;this.vr=sb;this.ur="gray";this.Tg=4}
No.prototype.copy=function(){var a=new No;a.vq=this.vq;a.Hp=this.Hp;a.pr=this.pr;a.rr=this.rr;a.qr=this.qr;a.kq=this.kq;a.br=this.br;a.dr=this.dr;a.cr=this.cr.J();a.er=this.er;a.fr=this.fr;a.hr=this.hr.J();a.Cq=this.Cq;a.Dq=this.Dq.J();a.Lq=this.Lq.J();a.Gq=this.Gq.J();a.Rp=this.Rp;a.yq=this.yq;a.vr=this.vr.J();a.ur=this.ur;a.Tg=this.Tg;return a};
function U(a,b){void 0===a||a instanceof Wl||"string"===typeof a?W.call(this,a):(W.call(this),a&&(b=a));this.G=2408959;this.Tf="";this.P=null;this.Hg="";this.Qf=this.Sg=null;this.dc="";this.yh=this.cj=null;this.ie=(new J(NaN,NaN)).freeze();this.mf=null;this.zo=NaN;this.tw=-1;this.sy=new N;this.Qh=null;this.$f=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.Tf=this.Tf;null!==this.P&&(a.P=this.P.lc?this.P:this.P.copy());a.Hg=this.Hg;a.Qf=null;a.dc=this.dc;a.ie.assign(this.ie);a.zo=this.zo};t=U.prototype;t.Af=function(a){W.prototype.Af.call(this,a);a.mh();a.Sg=null;a.mf=null;a.Qh=null};t.toString=function(){var a=Ha(this.constructor)+"#"+bb(this);null!==this.data&&(a+="("+Ia(this.data)+")");return a};
function Oo(a){null===a.P?a.P=new No:a.P.lc&&(a.P=a.P.copy())}t.rh=function(){W.prototype.rh.call(this);null!==this.P&&(this.P.lc=!0)};t.fk=function(a,b,c,d,e,f,g){var h=this.diagram;null!==h&&(a===ee&&"elements"===b?e instanceof W?Hj(e,function(a){Jj(h.partManager,a);Ij(h,a)}):ck(h,e):a===fe&&"elements"===b&&(e instanceof W?Hj(e,function(a){Mj(h.partManager,a,h)}):ek(h,e)),h.cb(a,b,c,d,e,f,g))};
t.Ma=function(a){W.prototype.Ma.call(this,a);if(null!==this.data){for(var b=this.O.s,c=b.length,d=0;d<c;d++){var e=b[d];e instanceof W&&Hj(e,function(a){null!==a.data&&a.Ma()})}for(b=this.adornments;b.next();)b.value.Ma(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.Pj=function(a){var b=this.Qf;return null===b?null:b.I(a)};
U.prototype.$g=function(a,b){if(null!==b){var c=null,d=this.Qf;null!==d&&(c=d.I(a));if(c!==b){if(null!==c){var e=c.diagram;null!==e&&e.remove(c)}null===d&&(this.Qf=d=new ob);b.Tf!==a&&(b.category=a);d.add(a,b);a=this.diagram;null!==a&&(a.add(b),a=b.adornedObject,null!==a&&(a=a.gh(),null!==a&&(b.data=a.data)))}}};U.prototype.Jf=function(a){var b=this.Qf;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.Qf=null)}};
U.prototype.Ej=function(){var a=this.Qf;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.Jf(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.v();c.placeholder&&c.placeholder.v()}a:{if(this.isSelected&&this.selectionAdorned&&(b=this.selectionObject,null!==b&&this.actualBounds.w()&&this.isVisible()&&b.Qd()&&b.actualBounds.w())){c=this.Pj("Selection");if(null===c){c=this.selectionAdornmentTemplate;null===c&&(c=this.nh()?a.linkSelectionAdornmentTemplate:this instanceof pf?a.groupSelectionAdornmentTemplate:a.nodeSelectionAdornmentTemplate);
if(!(c instanceof te))break a;jg(c);c=c.copy();null!==c&&(this.nh()&&this.selectionObject===this.path&&(c.type=W.Link),c.adornedObject=b)}if(null!==c){c.type===W.Link&&c.v();this.$g("Selection",c);break a}}this.Jf("Selection")}Po(this,a);for(b=this.adornments;b.next();)b.value.Ma()}};U.prototype.Ub=function(){var a=this.diagram;null!==a&&(a.td=!0,0!==(this.G&16384)!==!0&&(this.G|=16384))};function fi(a){0!==(a.G&16384)!==!1&&(a.updateAdornments(),a.G&=-16385)}
function Po(a,b){b.toolManager.mouseDownTools.each(function(b){b.isEnabled&&b.updateAdornments(a)});b.toolManager.updateAdornments(a)}function ei(a,b){a.cj=b;null!==a.svg&&a.svg.remove()}function Qo(a){if(!1===wj(a)){Ro(a,!0);a.Sk();var b=a.diagram;null!==b&&(b.Ce.add(a),b.Yb())}}function So(a){a.G|=2097152;if(!1!==wj(a)){var b=a.position,c=a.location;c.w()&&b.w()||To(a,b,c);c=a.Ib;var d=N.alloc().assign(c);c.ja();c.x=b.x;c.y=b.y;c.freeze();a.Vl(d,c);N.free(d);Ro(a,!1)}}
U.prototype.Fe=function(a,b,c,d){var e=this.tc;e.h(a,b,c,d);null===this.Lb&&(this.Lb=new ld);var f=this.Lb;f.reset();this.mo(f,a,b,c,d);this.Lb=f;f.ts()||f.mp(e)};
U.prototype.mo=function(a,b,c,d,e){1!==this.Aa&&a.scale(this.Aa);if(0!==this.Kb){var f=xc;this.locationSpot.vb()&&(f=this.locationSpot);var g=J.alloc();if(this.locationObject!==this)for(b=this.locationObject,c=b.naturalBounds,g.xi(c.x,c.y,c.width,c.height,f),null!==b.Lb&&b.Lb.Ga(g),g.offset(-b.measuredBounds.x,-b.measuredBounds.y),f=b.panel;null!==f&&f!==this;)null!==f.Lb&&f.Lb.Ga(g),g.offset(-f.measuredBounds.x,-f.measuredBounds.y),f=f.panel;else g.xi(b,c,d,e,f);a.rotate(this.Kb,g.x,g.y);J.free(g)}};
U.prototype.move=function(a,b){!0===b?this.location=a:this.position=a};U.prototype.moveTo=function(a,b,c){a=J.allocAt(a,b);this.move(a,c);J.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.fv(this))return!0}a=this.containingGroup;return null===a||a.isSubGraphExpanded&&a.isVisible()?!0:!1};
U.prototype.Xb=function(a){var b=this.diagram;a?(this.D(4),this.Ub(),null!==b&&b.Ce.add(this)):(this.D(8),this.Ej());this.mh();null!==b&&(b.Ya(),b.N())};U.prototype.fb=function(a){if(this.name===a)return this;var b=this.Qh;null===b&&(this.Qh=b=new ob);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 Uo(a,b,c,d){void 0===d&&(d=new J);c=c.Lc()?xc: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.Ga(d);for(b=b.panel;null!==b&&b!==a;)b.transform.Ga(d),b=b.panel;null!==a.Lb&&a.Lb.Ga(d);d.offset(-a.tc.x,-a.tc.y);return d}U.prototype.li=function(a){void 0===a&&(a=new N);return a.assign(this.actualBounds)};U.prototype.Va=function(){this.measure(Infinity,Infinity);this.arrange()};
function cn(a){var b=J.alloc(),c=a.locationObject,d=c.naturalBounds,e=c instanceof Bf?c.strokeWidth:0;b.xi(0,0,d.width+e,d.height+e,a.locationSpot);if(c!==a)for(b.offset(-e/2,-e/2),c.transform.Ga(b),c=c.panel;null!==c&&c!==a;)c.transform.Ga(b),c=c.panel;null!==a.Lb&&a.Lb.Ga(b);b.offset(-a.tc.x,-a.tc.y);return b}
function Gj(a,b){var c=a.sy;isNaN(a.$f)&&(a.$f=rn(a));var d=a.$f;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===vj(this))So(this);else{ll(this,!1);var a=this.Ib,b=N.alloc();b.assign(a);var c=hg(this);this.bh(0,0,this.tc.width,this.tc.height);var d=this.position;To(this,d,this.location);a.ja();a.x=d.x;a.y=d.y;a.freeze();this.Vl(b,a);b.C(a)?this.Ad(c):!this.Wc()||K.B(b.width,a.width)&&K.B(b.height,a.height)||0<=this.tw&&this.D(16);N.free(b);Ro(this,!1)}};t=U.prototype;
t.Vl=function(a,b){var c=this.diagram;if(null!==c){var d=!1;if(!1===c.Yi&&a.w()){var e=N.alloc();e.assign(c.documentBounds);e.Dv(c.padding);a.x>e.x&&a.y>e.y&&a.right<e.right&&a.bottom<e.bottom&&b.x>e.x&&b.y>e.y&&b.right<e.right&&b.bottom<e.bottom&&(d=!0);N.free(e)}0!==(this.G&65536)!==!0&&a.C(b)||Kj(this,d,c);c.N();!a.w()&&!b.w()||Ub(a,b)||(this instanceof V&&!c.undoManager.isUndoingRedoing&&this.zd(),this.mh())}};
t.xv=function(a,b,c){if(this.nh()||!a.w())return!1;var d=this.diagram;null!==d&&Vo(this,d,a,b,c);this.pa=a;this.G&=-2097153;!this.ie.w()||null!==d&&!d.animationManager.isTicking&&d.undoManager.isUndoingRedoing||(d=this.ie,this.ie=new J(d.x+(a.x-b),d.y+(a.y-c)),this.g("location",d,this.ie.copy()));!1===wj(this)&&!1===vj(this)&&(Qo(this),So(this));return!0};function Vo(a,b,c,d,e){null===b||a instanceof te||(b=b.animationManager,b.Bb&&Gh(b,a,new J(d,e),c))}
t.lm=function(a,b,c){var d=this.ie,e=this.pa;if(c){if(d.x===a&&d.y===b)return;wj(this)||vj(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;d.h(d.x+a-e.x,d.y+b-e.y);e.h(a,b)}Qo(this)};t.yv=function(){this.G&=-2097153;Qo(this)};function To(a,b,c){var d=cn(a),e=a.diagram,f=c.w(),g=b.w();f&&g?0!==(a.G&2097152)?Wo(a,b,c,e,d):Xo(a,b,c,e,d):f?Wo(a,b,c,e,d):g&&Xo(a,b,c,e,d);a.G|=2097152;J.free(d);a.Sk()}
function Wo(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.Bb||a instanceof te||Gh(c,a,new J(f,g),b),d||b.x===f&&b.y===g||a.g("position",new J(f,g),b.copy()))}function Xo(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 Kj(a,b,c){nl(a,!1);a instanceof V&&Ck(c,a);a.layer.isTemporary||b||c.Ya();b=a.Ib;var d=c.viewportBounds;d.w()?hg(a)?(Xb(b,d)||a.Ad(!1),a.updateAdornments()):a.isVisible()&&b.Vc(d)?(a.Ad(!0),a.updateAdornments()):a.Ub():c.td=!0}t.ri=function(){return!0};t.Wc=function(){return!0};t.nh=function(){return!1};t.ne=function(){return!0};
function Yo(a,b,c,d){b.constructor===a.constructor||Zo||(Zo=!0,ya('Should not change the class of the Part when changing category from "'+c+'" to "'+d+'"'),ya(" Old class: "+Ha(a.constructor)+", new class: "+Ha(b.constructor)+", part: "+a.toString()));a.Ej();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.Af(a);b.cloneProtected(a);a.Tf=d;null!==a.svg&&(a.svg.remove(),a.svg=null,a.rf=!0);a.v();
a.N();b=a.diagram;d=!0;null!==b&&(d=b.skipsUndoManager,b.skipsUndoManager=!0);a.wb=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.Ma();e=a.layerName;e!==c&&(a.Hg=c,a.layerName=e);null!==b&&(b.skipsUndoManager=d);a.Wc()&&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 wj(a){return 0!==(a.G&32768)}function Ro(a,b){a.G=b?a.G|32768:a.G&-32769}function nl(a,b){a.G=b?a.G|65536:a.G&-65537}
function hg(a){return 0!==(a.G&131072)}t=U.prototype;t.Ad=function(a){this.G=a?this.G|131072:this.G&-131073};function $o(a,b){a.G=b?a.G|1048576:a.G&-1048577}t.mh=function(){var a=this.containingGroup;null!==a&&(a.v(),null!==a.placeholder&&a.placeholder.v(),a.zd())};t.N=function(){var a=this.diagram;null!==a&&!vj(this)&&!wj(this)&&this.isVisible()&&this.Ib.w()&&a.N(Gj(this,this.Ib))};
t.v=function(){W.prototype.v.call(this);var a=this.diagram;null!==a&&(a.Ce.add(this),this instanceof V&&null!==this.labeledLink&&Kl(this.labeledLink),a.Yb(!0))};t.So=function(a){a||(a=this.yh,null!==a&&ap(a,this))};t.To=function(a){a||(a=this.yh,null!==a&&bp(a,this))};t.Lj=function(){var a=this.data;if(null!==a){var b=this.diagram;null!==b&&(b=b.model,null!==b&&b.bm(a))}};t.pz=function(){return cp(this,this)};
function cp(a,b){var c=b.containingGroup;return null!==c?1+cp(a,c):b instanceof V&&(b=b.labeledLink,null!==b)?cp(a,b):0}t.uz=function(){return dp(this,this)};function dp(a,b){var c=b.containingGroup;return null!==c||b instanceof V&&(c=b.labeledLink,null!==c)?dp(a,c):b}t.Pd=function(a){return a instanceof pf?ep(this,this,a):!1};function ep(a,b,c){if(b===c||null===c)return!1;var d=b.containingGroup;return null===d||d!==c&&!ep(a,d,c)?b instanceof V&&(b=b.labeledLink,null!==b)?ep(a,b,c):!1:!0}
t.px=function(a){if(null===a)return null;if(this===a)return this.containingGroup;for(var b=this;null!==b;){b instanceof pf&&$o(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 pf&&$o(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.yh,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 Lj(a){if(!a.isVisible())return!1;a=a.layer;return null!==a&&a.isTemporary?!1:!0}
function Tk(a,b,c,d,e,f){void 0===f&&(f=null);if(!(a.contains(b)||null!==f&&!f(b)||b instanceof te))if(a.add(b),b instanceof V){if(c&&b instanceof pf)for(var g=b.memberParts;g.next();)Tk(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)&&Tk(a,h,c,d,e,f)}}if(1<d)for(b=b.Ou();b.next();)Tk(a,b.value,c,d-1,e,f)}else if(b instanceof T)for(b=b.labelNodes;b.next();)Tk(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.va(this.data)}},adornments:{get:function(){return null===this.Qf?Ya:this.Qf.iteratorValues}},layer:{get:function(){return this.cj}},diagram:{get:function(){var a=this.cj;return null===a||void 0===a?null:a.diagram}},layerName:{get:function(){return this.Hg},set:function(a){var b=
this.Hg;if(b!==a){var c=this.diagram;if(null===c||null!==c.Qj(a)&&!c.partManager.addsToTemporaryLayer)if(this.Hg=a,null!==c&&c.Ya(),this.g("layerName",b,a),b=this.layer,null!==b&&b.name!==a&&(c=b.diagram,null!==c&&(a=c.Qj(a),null!==a&&a!==b))){var d=b.oc(-1,this,!0);0<=d&&c.cb(fe,"parts",b,this,null,d,!0);d=a.ni(99999999,this,!0);b.visible!==a.visible&&this.Xb(a.visible);0<=d&&c.cb(ee,"parts",a,null,this,!0,d);d=this.layerChanged;if(null!==d){var e=c.aa;c.aa=!0;d(this,b,a);c.aa=e}}}}},layerChanged:{
get:function(){return null!==this.P?this.P.vq:null},set:function(a){var b=this.layerChanged;b!==a&&(Oo(this),this.P.vq=a,this.g("layerChanged",b,a))}},zOrder:{get:function(){return this.zo},set:function(a){var b=this.zo;if(b!==a){this.zo=a;var c=this.layer;null!==c&&ki(c,-1,this);this.g("zOrder",b,a);a=this.diagram;null!==a&&a.N()}}},locationObject:{get:function(){if(null===this.mf){var a=this.locationObjectName;""!==a?(a=this.fb(a),
null!==a?this.mf=a:this.mf=this):this instanceof te?this.type!==W.Link&&null!==this.placeholder?this.mf=this.placeholder:this.mf=this:this.mf=this}return this.mf.visible?this.mf:this}},minLocation:{get:function(){return null!==this.P?this.P.Lq:qb},set:function(a){var b=this.minLocation;b.C(a)||(a=a.J(),Oo(this),this.P.Lq=a,this.g("minLocation",b,a))}},maxLocation:{get:function(){return null!==this.P?this.P.Gq:rb},set:function(a){var b=this.maxLocation;
b.C(a)||(a=a.J(),Oo(this),this.P.Gq=a,this.g("maxLocation",b,a))}},locationObjectName:{get:function(){return null!==this.P?this.P.Cq:""},set:function(a){var b=this.locationObjectName;b!==a&&(Oo(this),this.P.Cq=a,this.mf=null,this.v(),this.g("locationObjectName",b,a))}},locationSpot:{get:function(){return null!==this.P?this.P.Dq:sc},set:function(a){var b=this.locationSpot;b.C(a)||(a=a.J(),Oo(this),this.P.Dq=a,this.v(),this.g("locationSpot",
b,a))}},location:{get:function(){return this.ie},set:function(a){var b=a.x,c=a.y,d=this.ie;if(!(d.x===b||isNaN(d.x)&&isNaN(b))||!(d.y===c||isNaN(d.y)&&isNaN(c))){a=a.copy();b=a;if(this.nh())b=!1;else{this.ie=b;this.G|=2097152;if(!1===vj(this)&&(Qo(this),c=this.pa,c.w())){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));Vo(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.Tf},set:function(a){var b=this.Tf;if(b!==a){null!==this.svg&&(this.svg.remove(),this.rf=!0);var c=this.diagram,d=this.data,e=null;if(null!==c&&null!==d&&!(this instanceof te)){var f=c.model.undoManager;f.isEnabled&&!f.isUndoingRedoing&&(e=this.clone(),e.O.addAll(this.O))}this.Tf=a;this.g("category",b,a);null===c||null===d||this instanceof te?this instanceof te&&(e=this.adornedPart,null!==e&&(a=e.Qf,
null!==a&&a.remove(b),e.$g(this.category,this))):(f=c.model,f.undoManager.isUndoingRedoing||(this.nh()?(c.partManager.setLinkCategoryForData(d,a),c=c.partManager.findLinkTemplateForCategory(a),null!==c&&(jg(c),c=c.copy(),null!==c&&Yo(this,c,b,a))):(null!==f&&f.im(d,a),c=fp(c.partManager,d,a),null!==c&&(jg(c),c=c.copy(),null===c||c instanceof T||(d=this.location.copy(),Yo(this,c,b,a),this.location.w()||(this.location=d)))),null!==e&&(b=this.clone(),b.O.addAll(this.O),this.g("self",e,b))))}}},self:{
get:function(){return this},set:function(a){Yo(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.Ub())}},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.Ub())}},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.Ya();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.Ub())}},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.Ub())}},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.Ub())}},
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.Ub())}},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.Ub();a=this.selectionChanged;null!==a&&a(this);null!==c&&(c.Yb(),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.P?this.P.kq:null},set:function(a){var b=this.highlightedChanged;
b!==a&&(Oo(this),this.P.kq=a,this.g("highlightedChanged",b,a))}},selectionObjectName:{get:function(){return null!==this.P?this.P.rr:""},set:function(a){var b=this.selectionObjectName;b!==a&&(Oo(this),this.P.rr=a,this.Sg=null,this.g("selectionObjectName",b,a))}},selectionAdornmentTemplate:{get:function(){return null!==this.P?this.P.pr:null},set:function(a){var b=this.selectionAdornmentTemplate;b!==a&&(Oo(this),this.P.pr=a,this.g("selectionAdornmentTemplate",
b,a))}},selectionObject:{get:function(){if(null===this.Sg){var a=this.selectionObjectName;null!==a&&""!==a?(a=this.fb(a),null!==a?this.Sg=a:this.Sg=this):this instanceof T?(a=this.path,null!==a?this.Sg=a:this.Sg=this):this.Sg=this}return this.Sg}},selectionChanged:{get:function(){return null!==this.P?this.P.qr:null},set:function(a){var b=this.selectionChanged;b!==a&&(Oo(this),this.P.qr=a,this.g("selectionChanged",b,a))}},resizeAdornmentTemplate:{
get:function(){return null!==this.P?this.P.br:null},set:function(a){var b=this.resizeAdornmentTemplate;b!==a&&(Oo(this),this.P.br=a,this.g("resizeAdornmentTemplate",b,a))}},resizeObjectName:{get:function(){return null!==this.P?this.P.dr:""},set:function(a){var b=this.resizeObjectName;b!==a&&(Oo(this),this.P.dr=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.P?this.P.cr:Lb},set:function(a){var b=this.resizeCellSize;b.C(a)||(a=a.J(),Oo(this),this.P.cr=a,this.g("resizeCellSize",b,a))}},rotateAdornmentTemplate:{get:function(){return null!==this.P?this.P.er:null},set:function(a){var b=this.rotateAdornmentTemplate;b!==a&&(Oo(this),this.P.er=a,this.g("rotateAdornmentTemplate",b,a))}},rotateObjectName:{
get:function(){return null!==this.P?this.P.fr:""},set:function(a){var b=this.rotateObjectName;b!==a&&(Oo(this),this.P.fr=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.P?this.P.hr:Sc},set:function(a){var b=this.rotationSpot;b.C(a)||(a=a.J(),Oo(this),this.P.hr=a,this.g("rotationSpot",b,a))}},text:{
get:function(){return this.dc},set:function(a){var b=this.dc;b!==a&&(this.dc=a,this.g("text",b,a))}},containingGroup:{get:function(){return this.yh},set:function(a){if(this.Wc()){var b=this.yh;if(b!==a){null===a||this!==a&&!a.Pd(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?bp(b,this):
this instanceof pf&&null!==c&&c.$h.remove(this);this.yh=a;null!==a?ap(a,this):this instanceof pf&&null!==c&&c.$h.add(this);this.D(1);if(null!==c&&c.aa){var d=this.data,e=c.model;if(null!==d&&e.Wj()){var f=e.va(null!==a?a.data:null);e.jp(d,f)}}d=this.containingGroupChanged;null!==d&&(e=!0,null!==c&&(e=c.aa,c.aa=!0),d(this,b,a),null!==c&&(c.aa=e));if(this instanceof pf)for(c=new H,Tk(c,this,!0,0,!0),c=c.iterator;c.next();)if(d=c.value,d instanceof V)for(d=d.linksConnected;d.next();)gp(d.value);if(this instanceof
V){for(c=this.linksConnected;c.next();)gp(c.value);c=this.labeledLink;null!==c&&gp(c)}this.g("containingGroup",b,a);null!==a&&(b=a.layer,null!==b&&ki(b,-1,a))}}else C("cannot set the Part.containingGroup of a Link or Adornment")}},containingGroupChanged:{get:function(){return null!==this.P?this.P.Hp:null},set:function(a){var b=this.containingGroupChanged;b!==a&&(Oo(this),this.P.Hp=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.P?this.P.yq:127},set:function(a){var b=this.layoutConditions;b!==a&&(Oo(this),this.P.yq=a,this.g("layoutConditions",b,a))}},dragComputation:{get:function(){return null!==this.P?this.P.Rp:null},set:function(a){var b=this.dragComputation;b!==a&&(Oo(this),this.P.Rp=a,this.g("dragComputation",b,a))}},shadowOffset:{
get:function(){return null!==this.P?this.P.vr:sb},set:function(a){var b=this.shadowOffset;b.C(a)||(a=a.J(),Oo(this),this.P.vr=a,this.N(),this.g("shadowOffset",b,a))}},shadowColor:{get:function(){return null!==this.P?this.P.ur:"gray"},set:function(a){var b=this.shadowColor;b!==a&&(Oo(this),this.P.ur=a,this.N(),this.g("shadowColor",b,a))}},shadowBlur:{get:function(){return null!==this.P?this.P.Tg:4},set:function(a){var b=this.shadowBlur;
b!==a&&(Oo(this),this.P.Tg=a,this.N(),this.g("shadowBlur",b,a))}}});U.prototype.invalidateLayout=U.prototype.D;U.prototype.findCommonContainingGroup=U.prototype.px;U.prototype.isMemberOf=U.prototype.Pd;U.prototype.findTopLevelPart=U.prototype.uz;U.prototype.findSubGraphLevel=U.prototype.pz;U.prototype.ensureBounds=U.prototype.Va;U.prototype.getDocumentBounds=U.prototype.li;U.prototype.findObject=U.prototype.fb;U.prototype.moveTo=U.prototype.moveTo;U.prototype.invalidateAdornments=U.prototype.Ub;
U.prototype.clearAdornments=U.prototype.Ej;U.prototype.removeAdornment=U.prototype.Jf;U.prototype.addAdornment=U.prototype.$g;U.prototype.findAdornment=U.prototype.Pj;U.prototype.updateTargetBindings=U.prototype.Ma;var Zo=!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 te(a,b){void 0===a||a instanceof Wl||"string"===typeof a?U.call(this,a):(U.call(this),a&&(b=a));this.G&=-257;this.Hg="Adornment";this.te=null;this.yw=0;this.Sw=!1;this.j=this.$a=null;b&&Object.assign(this,b)}la(te,U);te.prototype.toString=function(){var a=this.adornedPart;return"Adornment("+this.category+")"+(null!==a?a.toString():"")};te.prototype.updateRelationshipsFromData=function(){};
te.prototype.Sl=function(a){var b=this.adornedObject,c=null===b||void 0===b?void 0:b.part;if(c instanceof T&&b instanceof Bf){b=c.path;c.Sl(a);a=b.geometry;c=this.O.s;b=c.length;for(var d=0;d<b;d++){var e=c[d];e.isPanelMain&&e instanceof Bf&&(e.ta=a)}}};te.prototype.ri=function(){var a=this.te;if(null===a)return!0;a=a.part;return null===a||!vj(a)};te.prototype.Wc=function(){return!1};
te.prototype.fk=function(a,b,c,d,e,f,g){if(a===ee&&"elements"===b)if(e instanceof ig)null===this.$a&&(this.$a=e);else{if(e instanceof W){var h=e.Kl(function(a){return a instanceof ig});h instanceof ig&&null===this.$a&&(this.$a=h)}}else a===fe&&"elements"===b&&null!==this.$a&&(d===this.$a?this.$a=null:d instanceof W&&this.$a.qg(d)&&(this.$a=null));U.prototype.fk.call(this,a,b,c,d,e,f,g)};te.prototype.updateAdornments=function(){};te.prototype.Lj=function(){};
ma.Object.defineProperties(te.prototype,{placeholder:{get:function(){return this.$a}},adornedObject:{get:function(){return this.te},set:function(a){var b=this.adornedPart,c=null;null!==a&&(c=a.part);null===b||null!==a&&b===c||b.Jf(this.category);this.te=a;null!==c&&c.$g(this.category,this)}},adornedPart:{get:function(){var a=this.te;return null!==a?a.part:null}},containingGroup:{
get:function(){return null}}});te.className="Adornment";function hp(){this.lc=!1;this.Rr=this.gj=this.Aq=this.zq=null;this.vp=qc;this.ar=ip;this.Gr=this.ij=this.Jq=this.Iq=null}hp.prototype.copy=function(){var a=new hp;a.zq=this.zq;a.Aq=this.Aq;a.gj=this.gj;a.Rr=this.Rr;a.vp=this.vp.J();a.ar=this.ar;a.Iq=this.Iq;a.Jq=this.Jq;a.ij=this.ij;a.Gr=this.Gr;return a};
function V(a,b){void 0===a||a instanceof Wl||"string"===typeof a?U.call(this,a):(U.call(this),a&&(b=a));this.U=13;this.ya=null;this.kb=new F;this.vc=this.$e=this.Wk=null;this.bi=!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.lc?this.ya:this.ya.copy())};t=V.prototype;t.Af=function(a){U.prototype.Af.call(this,a);a.zd();a.$e=this.$e;a.vc=null};
function jp(a){null===a.ya?a.ya=new hp:a.ya.lc&&(a.ya=a.ya.copy())}t.rh=function(){U.prototype.rh.call(this);null!==this.ya&&(this.ya.lc=!0)};function kp(a,b){null!==b&&(null===a.$e&&(a.$e=new H),a.$e.add(b))}function lp(a,b,c,d){if(null===b||null===a.$e)return null;for(var e=a.$e.iterator;e.next();){var f=e.value;if(f.As===a&&f.cv===b&&f.Qx===c&&f.Rx===d||f.As===b&&f.cv===a&&f.Qx===d&&f.Rx===c)return f}return null}
t.Mz=function(a,b,c){if(void 0===b||null===b)b="";if(void 0===c||null===c)c="";a=lp(this,a,b,c);null!==a&&a.Pl()};t.fk=function(a,b,c,d,e,f,g){a===ee&&"elements"===b?this.vc=null:a===fe&&"elements"===b&&(this.vc=null);U.prototype.fk.call(this,a,b,c,d,e,f,g)};t.zd=function(a){for(var b=this.linksConnected;b.next();){var c=b.value;void 0!==a&&a.contains(c)||(mp(c.fromPort),mp(c.toPort),c.bb())}};
function ol(a,b){for(a=a.linksConnected;a.next();){var c=a.value;if(c.fromPort===b||c.toPort===b)mp(c.fromPort),mp(c.toPort),c.bb()}}function mp(a){if(null!==a){var b=a.Yn;null!==b&&b.Pl();a=a.part;b=a.containingGroup;null===b||a.isVisible()||mp(b.port)}}t.ri=function(){return!0};V.prototype.getAvoidableRect=function(a){a.set(this.actualBounds);a.Bo(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=Fi,c=this.diagram;null!==c&&(a=c.isTreePathToChildren,b=c.treeCollapsePolicy);if(b===Fi){if(a=this.og(),null!==a&&!a.isTreeExpanded)return!1}else if(b===Ik){if(a=a?this.Lu():this.Mu(),0<a.count&&a.all(function(a){return!a.isTreeExpanded}))return!1}else if(b===Jk&&(a=a?this.Lu():this.Mu(),0<a.count&&a.any(function(a){return!a.isTreeExpanded})))return!1;a=this.labeledLink;return null!==a?a.isVisible():!0};
V.prototype.Xb=function(a){U.prototype.Xb.call(this,a);for(var b=this.linksConnected;b.next();){var c=b.value;if(a&&null!==this.containingGroup){var d=c.Qo(this);null===d||d.Pd(this.containingGroup)||c.bb()}c.Xb(a)}};V.prototype.qx=function(){var a=new H,b=new H;np(this,this,a,b);return b.iterator};
function np(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)&&np(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.kb.iterator;var b=new $a(this.kb),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.Lo=function(a){void 0===a&&(a=null);var b=new $a(this.kb),c=this;b.predicate=function(b){return b.fromNode!==c?!1:null===a?!0:b.fromPortId===a};return b};t.Nd=function(a){void 0===a&&(a=null);var b=new $a(this.kb),c=this;b.predicate=function(b){return b.toNode!==c?!1:null===a?!0:b.toPortId===a};return b};
t.Ku=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.kb.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 H,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 H,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new Za(c):Ya};
t.Mu=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.kb.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 H,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new Za(c):Ya};
t.Lu=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.kb.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 H,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new Za(c):Ya};
t.kz=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);var d=new $a(this.kb),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.lz=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);var d=new $a(this.kb),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 op(a,b,c){mp(c);var d=a.kb.contains(b);d||a.kb.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.aa,g.aa=!0);e(a,b,c);null!==g&&(g.aa=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.bi||(e.bi=f),!f.isTreeLeaf||null!==a&&a.undoManager.isUndoingRedoing||(d?c===f&&(f.isTreeLeaf=!1):b===f&&(f.isTreeLeaf=!1))))}
function pp(a,b,c){mp(c);var d=a.kb.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.aa,e.aa=!0);f(a,b,c);null!==e&&(e.aa=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.bi=!1),null===b||b.isTreeLeaf||(0===b.kb.count?(b.bi=null,null!==e&&e.undoManager.isUndoingRedoing||(b.isTreeLeaf=!0)):Hk(b)))}
function Hk(a){a.bi=!1;if(0!==a.kb.count){var b=!0,c=a.diagram;if(null===c||!c.undoManager.isUndoingRedoing){null!==c&&(b=c.isTreePathToChildren);for(c=a.kb.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.So=function(a){U.prototype.So.call(this,a);a||(Hk(this),a=this.Wk,null!==a&&qp(a,this))};t.To=function(a){U.prototype.To.call(this,a);a||(a=this.Wk,null!==a&&null!==a.ud&&(a.ud.remove(this),a.v()))};
t.Lj=function(){if(0<this.kb.count){var a=this.diagram;if(null!==a)for(var b=null!==a.commandHandler?a.commandHandler.deletesConnectedLinks:!0,c=this.kb.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.Lj.call(this)};t.ks=function(a){if(null===this.vc){if(""===a&&!1===this.Se)return this;rp(this)}var b=this.vc.I(a);return null!==b||""!==a&&(b=this.vc.I(""),null!==b)?b:this};
function rp(a){null===a.vc?a.vc=new ob:a.vc.clear();a.pm(a,function(a,c){bm(a,c)});0===a.vc.count&&a.vc.add("",a)}function bm(a,b){var c=b.portId;null!==c&&null!==a.vc&&a.vc.add(c,b)}function am(a,b,c){var d=b.portId;if(null!==d&&(null!==a.vc&&a.vc.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.Oz=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.kb.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.kb.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.yz=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this;if(a)for(;;){a=null;for(var c=b.kb.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.kb.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.hz=function(a){if(null===a)return null;if(this===a)return this;for(var b=this;null!==b;)$o(b,!0),b=b.og();var c=null;for(b=a;null!==b;){if(0!==(b.G&1048576)){c=b;break}b=b.og()}for(b=this;null!==b;)$o(b,!1),b=b.og();return c};t.ih=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this.kb.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.og=function(){var a=this.bi;if(null===a)return null;if(a instanceof V)return a;a=this.diagram;a=null!==a?a.isTreePathToChildren:!0;for(var b=this.kb.iterator;b.next();){var c=b.value;if(c.isTreeLink&&(c=a?c.fromNode:c.toNode,c!==this))return this.bi=c}return this.bi=null};t.wz=function(){function a(b,d){d.add(b);var c=b.ih();null!==c&&(d.add(c),b=b.og(),null!==b&&a(b,d))}var b=new H;a(this,b);return b};t.vz=function(){return sp(this,this)};function sp(a,b){b=b.og();return null===b?0:1+sp(a,b)}
t.No=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=new $a(this.kb);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.Ou=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);var c=b=null,d=this.kb.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 F,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 F,b.add(c),b.add(a)):c=a);return null!==b?b.iterator:null!==c?new Za(c):Ya};
t.xz=function(a){void 0===a&&(a=Infinity);var b=new H;Tk(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.Te){b.Te=!0;var c=new H;c.add(this);tp(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===Fi);b.Te=!1}};function tp(a,b,c,d,e,f,g){if(1<d)for(var h=c?a.Lo():a.Nd();h.next();){var k=h.value;k.isTreeLink&&(k=k.Qo(a),null===k||k===a||b.contains(k)||(b.add(k),tp(k,b,c,d-1,e,f,g)))}else up(a,b,c,e,f,g)}
function up(a,b,c,d,e,f){for(var g=e===a?!0:a.isTreeExpanded,h=c?a.Lo():a.Nd();h.next();){var k=h.value;if(k.isTreeLink&&(k=k.Qo(a),null!==k&&k!==a)){var l=b.contains(k);l||b.add(k);g&&(f&&d.Aj(k,e),k.mh(),k.Xb(!1));k.isTreeExpanded&&(k.wasTreeExpanded=k.isTreeExpanded,l||up(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.Te){b.Te=!0;var c=new H;c.add(this);vp(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===Fi);b.Te=!1}};
function vp(a,b,c,d,e,f,g){for(var h=f===a?!1:a.isTreeExpanded,k=c?a.Lo():a.Nd();k.next();){var l=k.value;l.isTreeLink&&(h||l.bd||l.bb(),l=l.Qo(a),null!==l&&l!==a&&!b.contains(l)&&(b.add(l),h||(l.Xb(!0),l.mh(),g&&e.Cj(l,f)),2<d||l.wasTreeExpanded))&&(l.wasTreeExpanded=!1,vp(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.ar:ip},set:function(a){var b=this.portSpreading;b!==a&&(jp(this),this.ya.ar=a,this.g("portSpreading",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.zd())}},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&&Ck(c,this);this.g("avoidable",
b,a)}}},avoidableMargin:{get:function(){return null!==this.ya?this.ya.vp:qc},set:function(a){"number"===typeof a&&(a=new hc(a));var b=this.avoidableMargin;if(!b.C(a)){a=a.J();jp(this);this.ya.vp=a;var c=this.diagram;null!==c&&Ck(c,this);this.g("avoidableMargin",b,a)}}},linksConnected:{get:function(){return this.kb.iterator}},linkConnected:{get:function(){return null!==this.ya?this.ya.zq:null},set:function(a){var b=
this.linkConnected;b!==a&&(jp(this),this.ya.zq=a,this.g("linkConnected",b,a))}},linkDisconnected:{get:function(){return null!==this.ya?this.ya.Aq:null},set:function(a){var b=this.linkDisconnected;b!==a&&(jp(this),this.ya.Aq=a,this.g("linkDisconnected",b,a))}},linkValidation:{get:function(){return null!==this.ya?this.ya.gj:null},set:function(a){var b=this.linkValidation;b!==a&&(jp(this),this.ya.gj=a,this.g("linkValidation",b,a))}},isLinkLabel:{
get:function(){return null!==this.Wk}},labeledLink:{get:function(){return this.Wk},set:function(a){var b=this.Wk;if(b!==a){var c=this.diagram,d=this.data;if(null!==b){null!==b.ud&&(b.ud.remove(this),b.v());if(null!==c&&null!==d&&!c.undoManager.isUndoingRedoing){var e=b.data,f=c.model;if(null!==e&&f.pi()){var g=f.va(d);void 0!==g&&f.Sx(e,g)}}this.containingGroup=null}this.Wk=a;null!==a&&(qp(a,this),null===c||null===d||c.undoManager.isUndoingRedoing||(e=a.data,
c=c.model,null!==e&&c.pi()&&(d=c.va(d),void 0!==d&&c.Au(e,d))),this.containingGroup=a.containingGroup);Kl(this);this.g("labeledLink",b,a)}}},port:{get:function(){return this.ks("")}},ports:{get:function(){null===this.vc&&rp(this);return this.vc.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.aa,c.aa=!0);b(this);null!==c&&(c.aa=d)}null!==c&&c.undoManager.isUndoingRedoing?this.Xb(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.Rr:null},set:function(a){var b=
this.treeExpandedChanged;b!==a&&(jp(this),this.ya.Rr=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.xz;V.prototype.findTreeChildrenNodes=V.prototype.Ou;V.prototype.findTreeChildrenLinks=V.prototype.No;
V.prototype.findTreeLevel=V.prototype.vz;V.prototype.findTreeParentChain=V.prototype.wz;V.prototype.findTreeParentNode=V.prototype.og;V.prototype.findTreeParentLink=V.prototype.ih;V.prototype.findCommonTreeParent=V.prototype.hz;V.prototype.findTreeRoot=V.prototype.yz;V.prototype.isInTreeOf=V.prototype.Oz;V.prototype.findPort=V.prototype.ks;V.prototype.findLinksTo=V.prototype.lz;V.prototype.findLinksBetween=V.prototype.kz;V.prototype.findNodesInto=V.prototype.Lu;V.prototype.findNodesOutOf=V.prototype.Mu;
V.prototype.findNodesConnected=V.prototype.Ku;V.prototype.findLinksInto=V.prototype.Nd;V.prototype.findLinksOutOf=V.prototype.Lo;V.prototype.findExternalTreeLinksConnected=V.prototype.qx;V.prototype.invalidateConnectedLinks=V.prototype.zd;V.prototype.invalidateLinkBundle=V.prototype.Mz;var wp=new E(V,"SpreadingNone",10),ip=new E(V,"SpreadingEvenly",11),xp=new E(V,"SpreadingPacked",12);V.className="Node";V.SpreadingNone=wp;V.SpreadingEvenly=ip;V.SpreadingPacked=xp;
function pf(a,b){void 0===a||a instanceof Wl||"string"===typeof a?V.call(this,a):(V.call(this),a&&(b=a));this.U|=4608;this.Fn=new H;this.$a=null;this.Qc=new ti;this.Qc.group=this;this.el=new H;this.ib=this.Wp=null;b&&Object.assign(this,b)}la(pf,V);
pf.prototype.cloneProtected=function(a){V.prototype.cloneProtected.call(this,a);this.U=this.U&-32769;var b=a.Kl(function(a){return a instanceof ig});b instanceof ig?a.$a=b:a.$a=null;null!==this.Qc?(a.Qc=this.Qc.copy(),a.Qc.group=a):(null!==a.Qc&&(a.Qc.group=null),a.Qc=null);null!==this.ib&&(a.ib=this.ib.copy())};t=pf.prototype;
t.Af=function(a){V.prototype.Af.call(this,a);var b=a.Rj();for(a=a.memberParts;a.next();){var c=a.value;c.v();c.D(8);c.Ej();if(c instanceof V)c.zd(b);else if(c instanceof T)for(c=c.labelNodes;c.next();)c.value.zd(b)}};
t.fk=function(a,b,c,d,e,f,g){if(a===ee&&"elements"===b)if(e instanceof ig)null===this.$a?this.$a=e:this.$a!==e&&C("Cannot insert a second Placeholder into the visual tree of a Group.");else{if(e instanceof W){var h=e.Kl(function(a){return a instanceof ig});h instanceof ig&&(null===this.$a?this.$a=h:this.$a!==h&&C("Cannot insert a second Placeholder into the visual tree of a Group."))}}else a===fe&&"elements"===b&&null!==this.$a&&(d===this.$a?this.$a=null:d instanceof W&&this.$a.qg(d)&&(this.$a=null));
V.prototype.fk.call(this,a,b,c,d,e,f,g)};t.Vl=function(a,b){V.prototype.Vl.call(this,a,b);this.isClipping&&this.type!==W.Spot&&this.isSubGraphExpanded&&(a=this.resizeObject,a instanceof W&&(a=a.sb()),null===this.ib&&(this.ib=new N),a.li(this.ib),a instanceof Bf&&this.ib.Ac(-a.strokeWidth,-a.strokeWidth))};t.bh=function(a,b,c,d){this.mf=this.$a;V.prototype.bh.call(this,a,b,c,d)};
t.Va=function(){var a=this;a.isSubGraphExpanded&&this.memberParts.each(function(b){!a.computesBoundsIncludingLinks&&b instanceof T||b.Va()});V.prototype.Va.call(this)};t.ri=function(){if(!V.prototype.ri.call(this))return!1;for(var a=this.memberParts;a.next();){var b=a.value;if(b instanceof V){if(b.isVisible()&&vj(b))return!1}else if(b instanceof T&&b.isVisible()&&vj(b)&&b.fromNode!==this&&b.toNode!==this)return!1}return!0};
function ap(a,b){if(a.Fn.add(b)){b instanceof pf&&a.el.add(b);var c=a.memberAdded;if(null!==c){var d=!0,e=a.diagram;null!==e&&(d=e.aa,e.aa=!0);c(a,b);null!==e&&(e.aa=d)}a.isVisible()&&a.isSubGraphExpanded||b.Xb(!1)}b instanceof T&&!a.computesBoundsIncludingLinks||(b=a.$a,null===b&&(b=a),b.v())}
function bp(a,b){if(a.Fn.remove(b)){b instanceof pf&&a.el.remove(b);var c=a.memberRemoved;if(null!==c){var d=!0,e=a.diagram;null!==e&&(d=e.aa,e.aa=!0);c(a,b);null!==e&&(e.aa=d)}a.isVisible()&&a.isSubGraphExpanded||b.Xb(!0)}b instanceof T&&!a.computesBoundsIncludingLinks||(b=a.$a,null===b&&(b=a),b.v())}t.Lj=function(){if(0<this.Fn.count){var a=this.diagram;if(null!==a)for(var b=this.Fn.copy().iterator;b.next();)a.remove(b.value)}V.prototype.Lj.call(this)};
pf.prototype.canAddMembers=function(a){var b=this.diagram;if(null===b)return!1;b=b.commandHandler;for(a=Vk(a).iterator;a.next();)if(!b.isValidMember(this,a.value))return!1;return!0};pf.prototype.addMembers=function(a,b){var c=this.diagram;if(null===c)return!1;c=c.commandHandler;var d=!0;for(a=Vk(a).iterator;a.next();){var e=a.value;!b||c.isValidMember(this,e)?e.containingGroup=this:d=!1}return d};
pf.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=pf.prototype;
t.zd=function(a){var b=0!==(this.U&65536);V.prototype.zd.call(this,a);if(!b)for(0!==(this.U&65536)!==!0&&(this.U=this.U^65536),b=this.Ju();b.next();){var c=b.value;if(void 0===a||!a.contains(c)){var d=c.fromNode;null!==d&&d!==this&&d.Pd(this)&&!d.isVisible()?(mp(c.fromPort),mp(c.toPort),c.bb()):(d=c.toNode,null!==d&&d!==this&&d.Pd(this)&&!d.isVisible()&&(mp(c.fromPort),mp(c.toPort),c.bb()))}}};
t.Ju=function(){var a=null!==this.diagram&&this.diagram.Nw;if(a&&null!==this.Wp)return this.Wp.iterator;var b=this.Rj();b.add(this);for(var c=new H,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.Wp=c);return c.iterator};
t.jz=function(){var a=this.Rj();a.add(this);for(var b=new H,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.iz=function(){function a(b,d){null!==b&&(d.add(b),a(b.containingGroup,d))}var b=new H;a(this,b);return b};t.Rj=function(){var a=new H;Tk(a,this,!0,0,!0);a.remove(this);return a};
t.Xb=function(a){V.prototype.Xb.call(this,a);for(var b=this.memberParts;b.next();)b.value.Xb(a)};pf.prototype.collapseSubGraph=function(){var a=this.diagram;if(null!==a&&!a.Te){a.Te=!0;var b=this.Rj();yp(this,b,a,this);a.Te=!1}};
function yp(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Xb(!1);f instanceof pf&&f.isSubGraphExpanded&&(f.wasSubGraphExpanded=f.isSubGraphExpanded,yp(f,b,c,d));if(f instanceof V)f.zd(b),c.Aj(f,d);else if(f instanceof T)for(f=f.labelNodes;f.next();)f.value.zd(b)}a.isSubGraphExpanded=!1}pf.prototype.expandSubGraph=function(){var a=this.diagram;if(null!==a&&!a.Te){a.Te=!0;var b=this.Rj();zp(this,b,a,this);a.Te=!1}};
function zp(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Xb(!0);f instanceof pf&&f.wasSubGraphExpanded&&(f.wasSubGraphExpanded=!1,zp(f,b,c,d));if(f instanceof V)f.zd(b),c.Cj(f,d);else if(f instanceof T)for(f=f.labelNodes;f.next();)f.value.zd(b)}a.isSubGraphExpanded=!0}
pf.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=J.alloc();V.prototype.move.call(this,a,b);a=new H;for(b=this.Rj().iterator;b.next();)if(e=b.value,e instanceof T&&(e.suspendsRouting&&a.add(e),e.bd||e.fromNode!==this&&e.toNode!==this))e.suspendsRouting=!0;for(b.reset();b.next();)if(e=b.value,!(e.nh()||e instanceof V&&e.isLinkLabel)){var g=
e.position,h=e.location;g.w()?(f.x=g.x+d,f.y=g.y+c,e.position=f):h.w()&&(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.bd||e.fromNode!==this&&e.toNode!==this))g=e.position,f.x=g.x+d,f.y=g.y+c,f.w()?e.move(f):e.bb(),Sj(e)&&e.bb();J.free(f)}};
ma.Object.defineProperties(pf.prototype,{placeholder:{get:function(){return this.$a}},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.Fn.iterator}},
layout:{get:function(){return this.Qc},set:function(a){var b=this.Qc;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.Qc=a;var c=this.diagram;null!==a&&(a.diagram=c,a.group=this);null!==c&&(c.vh=!0);this.g("layout",b,a);null!==c&&c.Yb()}}},memberAdded:{get:function(){return null!==this.ya?this.ya.Iq:null},set:function(a){var b=
this.memberAdded;b!==a&&(jp(this),this.ya.Iq=a,this.g("memberAdded",b,a))}},memberRemoved:{get:function(){return null!==this.ya?this.ya.Jq:null},set:function(a){var b=this.memberRemoved;b!==a&&(jp(this),this.ya.Jq=a,this.g("memberRemoved",b,a))}},memberValidation:{get:function(){return null!==this.ya?this.ya.ij:null},set:function(a){var b=this.memberValidation;b!==a&&(jp(this),this.ya.ij=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.aa,c.aa=!0);b(this);null!==c&&(c.aa=d)}null!==c&&c.undoManager.isUndoingRedoing?(null!==
this.$a&&this.$a.v(),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&&(jp(this),this.ya.Gr=
a,this.g("subGraphExpandedChanged",b,a))}},ph:{get:function(){return 0!==(this.U&32768)},set:function(a){0!==(this.U&32768)!==a&&(this.U^=32768)}}});pf.prototype.expandSubGraph=pf.prototype.expandSubGraph;pf.prototype.collapseSubGraph=pf.prototype.collapseSubGraph;pf.prototype.findSubGraphParts=pf.prototype.Rj;pf.prototype.findContainingGroupChain=pf.prototype.iz;pf.prototype.findExternalNodesConnected=pf.prototype.jz;pf.prototype.findExternalLinksConnected=pf.prototype.Ju;
pf.prototype.ensureBounds=pf.prototype.Va;pf.className="Group";function ig(a){Y.call(this);this.Ab=pc;this.jo=new N(NaN,NaN,NaN,NaN);a&&Object.assign(this,a)}la(ig,Y);ig.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.Ab=this.Ab.J();a.jo=this.jo.copy()};ig.prototype.eh=function(a){if(null===this.background&&null===this.areaBackground)return!1;var b=this.naturalBounds;return Zb(0,0,b.width,b.height,a.x,a.y)};
ig.prototype.Ul=function(){var a=this.part;null!==a&&(a instanceof pf||a instanceof te)||C("Placeholder is not inside a Group or Adornment.");if(a instanceof pf){var b=this.computeBorder(this.jo),c=this.minSize,d=this.cc;Pb(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.Fe(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.Xu(a)||isNaN(b.x)||
isNaN(b.y)||(c=J.alloc(),c.wi(b,a.locationSpot),c.C(a.location)||(a.location=c),J.free(c))}else{b=this.cc;c=this.Ab;d=c.left+c.right;var e=c.top+c.bottom,f=a.adornedObject;a.angle=f.ki();var g=0;f instanceof Bf&&(g=f.strokeWidth);var h=f.Df(),k=f.naturalBounds,l=(k.width+g)*h;g=(k.height+g)*h;a.type!==W.Link&&(h=f.ka("Selection"===a.category?sc:a.locationSpot,J.alloc()),a.location=h,J.free(h));isNaN(l)||isNaN(g)?(a=f.ka(sc,J.alloc()),l=N.allocAt(a.x,a.y,0,0),l.Xe(f.ka(Bc,a)),l.Xe(f.ka(uc,a)),l.Xe(f.ka(zc,
a)),Pb(b,l.width+d||0,l.height+e||0),this.Fe(-c.left,-c.top,b.width,b.height),J.free(a),N.free(l)):(Pb(b,l+d||0,g+e||0),this.Fe(-c.left,-c.top,b.width,b.height))}};ig.prototype.bh=function(a,b,c,d){this.actualBounds.h(a,b,c,d)};
ig.prototype.computeBorder=function(a){var b=this.part,c=b.diagram;if(null!==c&&b instanceof pf&&!b.layer.isTemporary&&b.computesBoundsAfterDrag&&this.jo.w()){var d=c.toolManager.findTool("Dragging");if(d===c.currentTool&&(c=d.computeBorder(b,this.jo,a),null!==c))return c}c=N.alloc();d=this.computeMemberBounds(c);var e=this.Ab;b instanceof pf&&!b.isSubGraphExpanded?a.h(d.x-e.left,d.y-e.top,0,0):a.h(d.x-e.left,d.y-e.top,Math.max(d.width+e.left+e.right,0),Math.max(d.height+e.top+e.bottom,0));N.free(c);
b instanceof pf&&b.computesBoundsIncludingLocation&&b.location.w()&&a.Xe(b.location);return a};
ig.prototype.computeMemberBounds=function(a){if(!(this.part instanceof pf))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(uj(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(ig.prototype,{padding:{get:function(){return this.Ab},set:function(a){"number"===typeof a&&(a=new hc(a));var b=this.Ab;b.C(a)||(this.Ab=a=a.J(),this.g("padding",b,a),this.v())}}});ig.className="Placeholder";
function T(a){U.call(this,W.Link);this.Qa=8;this.df=null;this.ef="";this.uf=this.fn=null;this.vf="";this.to=null;this.nk=Zf;this.Nm=0;this.Pm=Zf;this.Qm=NaN;this.qj=Ap;this.oo=.5;this.ud=null;this.Mb=(new F).freeze();this.Rg=this.Kg=null;this.kl=new N;this.ta=new P;this.u=this.m=this.Sf=this.Wf=null;this.ru=new J;this.Zp=this.Kw=this.Jw=null;this.st=NaN;this.ba=null;this.j=[];a&&Object.assign(this,a)}la(T,U);
T.prototype.cloneProtected=function(a){U.prototype.cloneProtected.call(this,a);a.Qa=this.Qa&-113;a.ef=this.ef;a.fn=this.fn;a.vf=this.vf;a.to=this.to;a.nk=this.nk;a.Nm=this.Nm;a.Pm=this.Pm;a.Qm=this.Qm;a.qj=this.qj;a.oo=this.oo;null!==this.ba&&(a.ba=this.ba.copy())};t=T.prototype;t.Af=function(a){U.prototype.Af.call(this,a);this.ef=a.ef;this.vf=a.vf;a.Kg=null;a.bb();a.Sf=this.Sf;var b=a.fromPort;null!==b&&mp(b);a=a.toPort;null!==a&&mp(a)};
t.rb=function(a){a.classType===T?2===(a.value&2)?this.routing=a:a===bg||a===Yf||a===Xf?this.curve=a:a===Bp||a===Cp||a===Dp?this.adjusting=a:a!==Ap&&a!==Zf&&C("Unknown Link enum value for a Link property: "+a):U.prototype.rb.call(this,a)};t.Uc=function(){null===this.ba&&(this.ba=new el)};t.ri=function(){var a=this.fromNode;if(null!==a){var b=a.findVisibleNode();null!==b&&(a=b);if(vj(a)||wj(a))return!1}a=this.toNode;return null!==a&&(b=a.findVisibleNode(),null!==b&&(a=b),vj(a)||wj(a))?!1:!0};t.xv=function(){return!1};
t.yv=function(){};t.Wc=function(){return!1};T.prototype.computeAngle=function(a,b,c){return T.computeAngle(b,c)};T.computeAngle=function(a,b){switch(a){default:case Zf:a=0;break;case fn:a=b;break;case Ym:a=b+90;break;case $m:a=b-90;break;case Ep:a=b+180;break;case gn:a=K.Zo(b);90<a&&270>a&&(a-=180);break;case Zm:a=K.Zo(b+90);90<a&&270>a&&(a-=180);break;case an:a=K.Zo(b-90);90<a&&270>a&&(a-=180);break;case bn:a=K.Zo(b);if(45<a&&135>a||225<a&&315>a)return 0;90<a&&270>a&&(a-=180)}return K.Zo(a)};
function gp(a){var b=a.fromNode,c=a.toNode,d=null;null!==b?d=null!==c?b.px(c):b.containingGroup:null!==c?d=c.containingGroup:d=null;b=d;c=a.yh;if(c!==b){null!==c&&bp(c,a);a.yh=b;null!==b&&ap(b,a);var e=a.containingGroupChanged;if(null!==e){var f=!0,g=a.diagram;null!==g&&(f=g.aa,g.aa=!0);e(a,c,b);null!==g&&(g.aa=f)}!a.bd||a.Jw!==c&&a.Kw!==c||a.bb()}if(a.isLabeledLink)for(a=a.labelNodes;a.next();)a.value.containingGroup=d}t=T.prototype;
t.mh=function(){var a=this.containingGroup;null!==a&&this.fromNode!==a&&this.toNode!==a&&a.computesBoundsIncludingLinks&&U.prototype.mh.call(this)};t.Qo=function(a){var b=this.fromNode;return a===b?this.toNode:b};t.Dz=function(a){var b=this.fromPort;return a===b?this.toPort:b};function qp(a,b){null===a.ud&&(a.ud=new H);a.ud.add(b);a.v()}
t.So=function(a){U.prototype.So.call(this,a);Fp(this)&&this.Uo(this.actualBounds);if(!a){a=this.df;var b=null;null!==a&&(b=this.fromPort,op(a,this,b));var c=this.uf;if(null!==c){var d=this.toPort;c===a&&d===b||op(c,this,d)}Gp(this)}};t.To=function(a){U.prototype.To.call(this,a);Fp(this)&&this.Uo(this.actualBounds);if(!a){a=this.df;var b=null;null!==a&&(b=this.fromPort,pp(a,this,b));var c=this.uf;if(null!==c){var d=this.toPort;c===a&&d===b||pp(c,this,d)}Hp(this)}};
t.Lj=function(){this.bd=!0;if(null!==this.ud){var a=this.diagram;if(null!==a)for(var b=this.ud.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=J.allocAt(c.x+d,c.y+e),U.prototype.move.call(this,a,!1),J.free(a));bf(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(tb),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()===bg))return this.ta.Pu(.5,a),a.add(this.i(0)),c=this.ta.figures.first(),a.offset(-c.startX,-c.startY),a;if(this.computeCurve()===bg){if(3===b){c=this.i(0);d=this.i(1);var e=this.i(2);K.$w(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);K.$w(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).ab(this.i(1));if(this.isOrthogonal&&(15<=this.computeCorner()||this.computeCurve()===bg))return this.ta.wx(.5);if(this.computeCurve()===bg&&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 K.Oy(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).ab(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).ab(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.ab(d)};t=T.prototype;t.i=function(a){return this.Mb.s[a]};t.$c=function(a,b){this.Mb.Zc(a,b)};t.M=function(a,b,c){this.Mb.Zc(a,new J(b,c))};t.Lz=function(a,b){this.Mb.Gb(a,b)};
t.l=function(a,b,c){this.Mb.Gb(a,new J(b,c))};t.le=function(a){this.Mb.add(a)};t.yf=function(a,b){this.Mb.add(new J(a,b))};t.pv=function(a){this.Mb.nb(a)};t.Fj=function(){this.Mb.clear()};
function bf(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.bd,e=new F,f=a.Mb.iterator;f.next();){var g=f.value;e.add((new J(g.x+b,g.y+c)).freeze())}e.freeze();f=a.Mb;a.Mb=e;g=a.diagram;isNaN(b)||isNaN(c)||null!==g&&g.animationManager.Bb?a.v():(a.ie.h(a.ie.x+b,a.ie.y+c),a.pa.h(a.pa.x+b,a.pa.y+c),Kl(a));d?Ip(a):(a.defaultFromPoint&&(a.defaultFromPoint=a.i(0)),a.defaultToPoint&&(a.defaultToPoint=
a.i(a.pointsCount-1)));null!==g&&g.animationManager.Bb&&Nh(g.animationManager,a,e);a.g("points",f,e)}}t.sh=function(){null===this.Kg&&(this.Kg=this.Mb,this.Mb=this.Mb.copy())};
t.zf=function(){if(null!==this.Kg){for(var a=this.Kg,b=this.Mb,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.pc();break}}else this.pc();this.Kg=null;c=this.diagram;null!==c&&c.animationManager.Bb&&Nh(c.animationManager,this,b);Ip(this);this.g("points",
a,b)}};t.rv=function(){null!==this.Kg&&(this.Mb=this.Kg,this.Kg=null)};function Ip(a){0===a.Mb.count?a.bd=!1:(a.bd=!0,a.Zp=null,a.st=NaN,a.defaultFromPoint=a.i(0),a.defaultToPoint=a.i(a.pointsCount-1),Jp(a,!1))}t.bb=function(){if(!this.suspendsRouting){var a=this.diagram;if(a){if(a.xs.contains(this)||a.undoManager.isUndoingRedoing)return;a=a.animationManager;if(a.isTicking&&!a.isAnimating)return;null===this.Rg||a.isTicking||(this.Rg=null)}a=this.path;null!==a&&(this.bd=!1,this.v(),a.v())}};
t.ug=function(){if(!this.bd&&!this.computingPoints){var a=!0;try{this.computingPoints=!0,this.sh(),a=this.computePoints()}catch(b){this.computingPoints=!1,this.rv()}finally{this.computingPoints=!1,a?this.zf():this.rv()}}};
T.prototype.computePoints=function(){if(null===this.diagram)return!1;var a=this.fromNode,b=null;null===a?(Kp||(Kp=new V,Kp.desiredSize=Cb,Kp.Va()),this.defaultFromPoint&&(Kp.location=this.defaultFromPoint,Kp.Va(),b=a=Kp)):b=this.fromPort;if(null!==b&&!a.isVisible()){var c=a.findVisibleNode();null!==c&&c!==a?(a=c,b=c.port):a=c}this.Jw=a;if(null===a||!a.location.w())return!1;for(;!(null===b||b.actualBounds.w()&&b.Qd());)b=b.panel;if(null===b)return!1;var d=this.toNode,e=null;null===d?(Lp||(Lp=new V,
Lp.desiredSize=Cb,Lp.Va()),this.defaultToPoint&&(Lp.location=this.defaultToPoint,Lp.Va(),e=d=Lp)):e=this.toPort;null===e||d.isVisible()||(c=d.findVisibleNode(),null!==c&&c!==d?(d=c,e=c.port):d=c);this.Kw=d;if(null===d||!d.location.w())return!1;for(;!(null===e||e.actualBounds.w()&&e.Qd());)e=e.panel;if(null===e)return!1;var f=this.pointsCount,g=this.computeSpot(!0,b);c=this.computeSpot(!1,e);var h=Mp(g),k=Mp(c),l=b===e&&null!==b,m=this.isOrthogonal,n=this.curve===bg;this.Wf=l&&!m?n=!0:!1;var p=this.computeAdjusting()===
Zf||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.Fj(),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;K.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,y=q;K.B(k,0)?y=0<h?y-l:y+l:(v=(0>k?-1:1)*n+r,y=m*(v-r)+q);this.Fj();this.le(f);this.yf(u,w);this.yf(v,y);this.le(p);this.$c(0,this.getLinkPoint(a,b,g,!0,!1,d,e));this.$c(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,K.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.le(d),this.yf(f,h),this.le(e);else{this.le(d);this.le(e);h=N.alloc();b.li(h);k=h.ca(e);p.li(h);l=h.ca(d);if(k||l)g=b.ka(Np(g),new J),this.$c(0,this.getLinkPointFromPoint(a,b,g,e,!0,g)),c=p.ka(Np(c),new J),this.$c(1,this.getLinkPointFromPoint(f,p,c,d,!1,c));N.free(h)}}else{n=this.isAvoiding;p&&(m&&n||l)&&this.Fj();var z=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>z&&(r-=180)),0>r?r+=360:360<=r&&(r-=360),l&&(w+=Math.abs(z)*(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.Lc()&&l&&(w=b.ka(xc,J.alloc()),v=J.allocAt(w.x+1E3*q,w.y+1E3*u),this.getLinkPointFromPoint(a,b,w,v,!0,n),J.free(w),J.free(v));w=this.getLinkPoint(d,e,c,!1,m,a,b);var A=y=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>z&&(A+=180));0>A?A+=360:360<=A&&(A-=360);l&&(B+=Math.abs(z)*(m?1:2));0===A?v=B:90===A?y=B:180===A?v=-B:270===A?y=-B:(v=B*Math.cos(A*Math.PI/180),y=B*Math.sin(A*Math.PI/180));c.Lc()&&l&&(c=e.ka(xc,J.alloc()),g=J.allocAt(c.x+1E3*v,c.y+1E3*y),this.getLinkPointFromPoint(d,e,c,g,!1,w),J.free(c),J.free(g))}c=n;if(m||!h||l)c=new J(n.x+q,n.y+u);g=w;if(m||!k||l)g=new J(w.x+v,w.y+y);!p&&!m&&h&&3<f&&this.adjustPoints(0,
n,f-2,g)?this.$c(f-1,w):!p&&!m&&k&&3<f&&this.adjustPoints(1,c,f-1,w)?this.$c(0,n):!p&&(m?6<=f:4<f)&&this.adjustPoints(1,c,f-2,g)?(this.$c(0,n),this.$c(f-1,w)):(this.Fj(),this.le(n),(m||!h||l)&&this.le(c),m&&this.addOrthoPoints(c,r,g,A,a,d),(m||!k||l)&&this.le(g),this.le(w))}return!0};function Op(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 J);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.re()||(e=e.panel);if(null===e){e=d.x;d=d.y;var g=c.x;c=c.y}else{a=e.me;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.Sj(e,d,g,c,f);null!==
a&&f.transform(a);return f};function Pp(a,b){var c=b.Yn;null===c&&(c=new Qp,c.port=b,c.node=b.part,b.Yn=c);return Rp(c,a)}
T.prototype.getLinkPoint=function(a,b,c,d,e,f,g,h){void 0===h&&(h=new J);if(c.vb()&&!Mp(c))return b.ka(c,h),h;if(c.Xc()){var k=Pp(this,b);if(null!==k){h.assign(k.Wo);if(e&&this.routing===Sp){var l=Pp(this,g);if(null!==l&&k.El<l.El){k=J.alloc();l=J.alloc();var m=new N(b.ka(sc,k),b.ka(Bc,l)),n=this.computeSpot(!d,g);a=this.getLinkPoint(f,g,n,!d,e,a,b,l);(c.Hf(Dc)||c.Hf(Ec))&&a.y>=m.y&&a.y<=m.y+m.height?h.y=a.y:(c.Hf(Cc)||c.Hf(Fc))&&a.x>=m.x&&a.x<=m.x+m.width&&(h.x=a.x);J.free(k);J.free(l)}}return h}}c=
b.ka(Np(c),J.alloc());this.pointsCount>(e?6:2)?(g=d?this.i(1):this.i(this.pointsCount-2),e&&(g=Op(c,g.copy()))):(k=this.computeSpot(!d,g),f=J.alloc(),g=g.ka(Np(k),f),e&&(g=Op(c,g)),J.free(f));this.getLinkPointFromPoint(a,b,c,g,d,h);J.free(c);return h};
T.prototype.getLinkDirection=function(a,b,c,d,e,f,g,h){a:if(d.vb())var k=d.x>d.y?d.x>1-d.y?0:d.x<1-d.y?270:315:d.x<d.y?d.x>1-d.y?90:d.x<1-d.y?180:135:.5>d.x?225:.5<d.x?45:0;else{if(d.Xc()&&(k=Pp(this,b),null!==k))switch(k.Mc){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.ka(xc,J.alloc());this.pointsCount>(f?6:2)?(h=e?this.i(1):this.i(this.pointsCount-2),h=f?Op(k,h.copy()):c):(c=J.alloc(),h=h.ka(xc,c),J.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;J.free(k);k=c}d.Lc()&&g.Pd(a)&&(k+=180,360<=k&&(k-=360));if(Mp(d))return k;a=b.ki();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.Xc()&&(a=Pp(this,b),null!==a))return a.Hu;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=xc:(b=this.fromSpot,b.Vb()&&(b=a.fromSpot),a=b===Sc?rc:b)):(a=b?b:this.toPort,null===a?a=xc:(b=this.toSpot,b.Vb()&&(b=a.toSpot),a=b===Sc?rc:b));return a};function Mp(a){return a===rc||.5===a.x&&.5===a.y}function Np(a){return.5===a.x&&.5===a.y?a:xc}
T.prototype.computeOtherPoint=function(a,b){if(this.computeAdjusting()!==Zf&&4<this.pointsCount)return this.computeMidPoint(new J);a=b.Yn;a=null!==a?Rp(a,this):null;return null!==a?a.Wo:b.ka(xc)};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.Cf=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=ld.alloc(),g.reset());g.multiply(this.transform);if(this.dh(a,g))return sn(this,b,c,e),void 0===f&&ld.free(g),!0;if(this.Vc(a,g)){var h=!1;if(!this.isAtomic)for(var k=this.O.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=ld.alloc();n.set(g);
if(m instanceof W)h=m.Cf(a,b,c,d,e,n);else if(this.path===m){if(m instanceof Bf)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.dh(r,q))h=!0;else{if(void 0===q&&(q=m.transform,r.Qe(m.actualBounds))){h=!0;break b}h=r.left;p=r.right;var u=r.top;r=r.bottom;var w=J.alloc(),v=J.alloc(),y=J.alloc(),z=ld.alloc();z.set(q);z.bv(m.transform);z.Ql();v.x=p;v.y=u;v.transform(z);w.x=h;w.y=u;w.transform(z);q=!1;Xn(m,w,v,y)?q=!0:(w.x=p,w.y=r,w.transform(z),Xn(m,w,v,y)?q=!0:(v.x=
h,v.y=r,v.transform(z),Xn(m,w,v,y)?q=!0:(w.x=h,w.y=u,w.transform(z),Xn(m,w,v,y)&&(q=!0))));ld.free(z);J.free(w);J.free(v);J.free(y);h=q}}else h=m.dh(h,n)}else h=il(m,a,d,n);h&&(p=m,null!==b&&(p=b(m)),p&&(null===c||c(p))&&e.add(p));ld.free(n)}}}void 0===f&&ld.free(g);return h||null!==this.background||null!==this.areaBackground}void 0===f&&ld.free(g);return!1};
T.prototype.computeCurve=function(){if(null===this.Wf){var a=this.fromPort,b=this.isOrthogonal;this.Wf=null!==a&&a===this.toPort&&!b}return this.Wf?bg:this.curve};T.prototype.computeCorner=function(){if(this.curve===bg)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.O.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=Tp;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===fn||d===gn||d===Ep?a=Math.max(a,e):d===$m||d===an||d===Ym||d===Zm?a=Math.max(a,g):(b=b.ka(xc).ab(c.ka(xc))/180*Math.PI,a=Math.max(a,
Math.abs(Math.sin(b)*g)+Math.abs(Math.cos(b)*e)+1));this.curve===bg&&(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()===Zf&&c.bb()}};
T.prototype.computeCurviness=function(){var a=this.curviness;if(isNaN(a)){a=Up;var b=this.Sf;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.As===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.Sf};
T.prototype.adjustPoints=function(a,b,c,d){var e=this.computeAdjusting();if(this.isOrthogonal){if(e===Cp)return!1;e===Dp&&(e=Bp)}switch(e){case Cp:var f=this.i(a),g=this.i(c);if(!f.Xa(b)||!g.Xa(d)){e=f.x;f=f.y;var h=g.x-e,k=g.y-f,l=Math.sqrt(h*h+k*k);if(!K.$(l,0)){if(K.$(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);K.$(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.$c(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),K.$(b,0)||(K.$(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.$c(c,d)}}return!0;case Dp:f=this.i(a);n=this.i(c);if(!f.Xa(b)||!n.Xa(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.$c(a,b);for(a+=1;a<c;a++){b=this.i(a);
var u=b.x,w=b.y,v=.5;0!==l&&(v=((e-u)*(e-g)+(f-w)*(f-n))/l);var y=e+v*(g-e),z=f+v*(n-f);b=Math.sqrt((u-y)*(u-y)+(w-z)*(w-z));w<q*(u-y)+z&&(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.$c(c,d)}return!0;case Bp: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,K.B(e.y,f.y)?K.B(f.x,g.x)?m=b.y:K.B(f.y,g.y)&&(h=b.x):K.B(e.x,f.x)&&(K.B(f.y,g.y)?h=b.x:K.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,K.B(e.y,f.y)?K.B(f.x,g.x)?m=d.y:K.B(f.y,g.y)&&(h=d.x):K.B(e.x,f.x)&&(K.B(f.y,g.y)?h=d.x:K.B(f.x,g.x)&&(m=d.y)),this.M(c-1,h,m),Sj(this))){this.M(a+1,n,l);this.M(c-1,k,p);c=!1;break a}this.$c(a,b);this.$c(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.w()&&k.w()){h.Ac(Vp,Vp);k.Ac(Vp,Vp);h.Xe(a);k.Xe(c);var l=J.alloc(),m=J.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.ca(a)||h.ca(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.ca(a)||h.ca(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.ca(a)||h.ca(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.ca(a)||h.ca(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||!jk(p)||h.ca(n)&&!f.Pd(e)||k.ca(a)&&!e.Pd(f))b=!1;else{var r=kk(p,!0,this.containingGroup,null);if(17!==this.segmentIndex&&r.Xj(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.Xj(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.Xj(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.Ac(-r.Go,-r.Fo);var u=J.alloc();Ak(r,a.x,a.y)||(K.Ff(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.ab(l)):K.Ff(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.ab(m)):K.Ff(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.ab(n)));Ak(r,n.x,n.y)||(K.Ff(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.ab(u)):K.Ff(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.ab(u)):K.Ff(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.ab(u)));J.free(u)}h=h.copy().ad(k);h.Ac(r.Go*r.Ls,r.Fo*r.Ls);Wp(r,a,b,n,d,h,!0);k=Xp(r,n.x,n.y);!r.abort&&k>=Yp&&(zk(r),h.Ac(r.Go*r.Ix,r.Fo*r.Jx),Wp(r,a,b,n,d,h,!1),k=Xp(r,
n.x,n.y));if(!r.abort&&k<Yp&&Xp(r,n.x,n.y)!==Bk){Zp(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)K.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)):K.B(h.y,g.y)?(Math.abs(a.y-h.y)<=r.Fo/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)K.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)):K.B(h.x,g.x)?(Math.abs(a.x-h.x)<=r.Go/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.yf(f.x,q.y):this.yf(q.x,f.y));b=!0}else b=!1}}}else b=!1;b||(this.le(l.copy()),this.le(m.copy()));J.free(l);J.free(m)}};
T.prototype.computeMidOrthoPosition=function(a,b,c,d,e){var f=0;!this.hasCurviness()||this.computeSpot(!0,this.fromPort).Xc()||this.computeSpot(!1,this.toPort).Xc()||(f=this.computeCurviness());return e?(b+d)/2+f:(a+c)/2+f};
function Sj(a){if(null===a.diagram||!a.isAvoiding||!jk(a.diagram))return!1;var b=a.points.s,c=b.length;if(4>c)return!1;a=kk(a.diagram,!0,a.containingGroup,null);for(var d=1;d<c-2;d++){var e=b[d],f=b[d+1];if(!a.Xj(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 Zp(a,b,c,d,e,f,g){var h=b.Go,k=b.Fo,l=Xp(b,c,d),m=c,n=d;0===e?m+=h:90===e?n+=k:180===e?m-=h:n-=k;e!==g&&l>$p&&Xp(b,m,n)!==l-1&&(Xp(b,c-h,d)===l-1?(e=180,m=c-h,n=d):Xp(b,c+h,d)===l-1?(e=0,m=c+h,n=d):Xp(b,c,d-k)===l-1?(e=270,m=c,n=d-k):Xp(b,c,d+k)===l-1&&(e=90,m=c,n=d+k));for(;l>$p&&Xp(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>$p)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>$p&&(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),Xp(b,g,m)===l-1?Zp(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),Xp(b,g,m)===l-1&&Zp(a,b,g,m,f,!1,f)));a.yf(c,d)}T.prototype.fz=function(a){var b=a.x;a=a.y;for(var c=this.i(0),d=this.i(1),e=yb(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=yb(b,a,d.x,d.y,c.x,c.y);d=c;h<e&&(f=g,e=h)}return f};
T.prototype.pc=function(){this.jk=!1;this.v()};T.prototype.Sl=function(a){if(!a){if(!1===this.bd)return;a=this.sb();if(this.jk&&(null===a||null!==a.geometry))return}2>this.pointsCount?this.jk=!0:this.ta=this.makeGeometry();a=this.path;if(null!==a){a.ta=this.ta;for(var b=this.O.s,c=b.length,d=0;d<c;d++){var e=b[d];e!==a&&e.isPanelMain&&e instanceof Bf&&(e.ta=this.ta)}}};
T.prototype.makeGeometry=function(){var a=this.ta,b=this.pointsCount,c=!1,d=this.diagram;null!==d&&Fp(this)&&d.Ch.contains(this)&&(0!==this.kl.width||0!==this.kl.height)&&(d.animationManager.isAnimating||d.currentTool!==d.toolManager)&&(c=!0);var e=this.i(0).copy(),f=e.copy();d=this.Mb.s;var g=this.computeCurve();if(g===bg&&3<=b&&!K.$(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.ru.x;k-=this.ru.y;e.x-=d;e.y-=k;if(2!==b||Fp(this)){a.type=P.m;h=qd(a);0!==this.computeShortLength(!0)&&(e=aq(this,e,!0,f));wd(h,e.x,e.y,!1);if(g===bg&&3<=b&&!K.$(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=aq(this,e,!1,f)),xd(h,b,c,b,c,e.x,e.y);else if(this.isOrthogonal){b=J.allocAt(d,k);c=J.alloc();c.assign(this.i(1));f=J.allocAt(d,k);e=J.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(bq(this,l,n,!1));if(!K.$(p.x,r.x)||!K.$(r.x,q.x))if(!K.$(p.y,r.y)||!K.$(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 y=q.x;q=q.y;var z=u*cq(w,p,v,r);u*=cq(v,r,y,
q);K.$(p,r)&&K.$(v,y)&&(v>w?q>r?(f.x=v-z,f.y=r-z,e.x=v+u,e.y=r+u):(f.x=v-z,f.y=r+z,e.x=v+u,e.y=r-u):q>r?(f.x=v+z,f.y=r-z,e.x=v-u,e.y=r+u):(f.x=v+z,f.y=r+z,e.x=v-u,e.y=r-u));K.$(w,v)&&K.$(r,q)&&(r>p?(y>v?(f.x=v-z,f.y=r-z,e.x=v+u):(f.x=v+z,f.y=r-z,e.x=v-u),e.y=r+u):(y>v?(f.x=v-z,f.y=r+z,e.x=v+u):(f.x=v+z,f.y=r+z,e.x=v-u),e.y=r-u));if(K.$(w,v)&&K.$(v,y)||K.$(p,r)&&K.$(r,q))w=.5*(w+y),p=.5*(p+q),f.x=w,f.y=p,e.x=w,e.y=p;1===n?(c.x=.5*(g.x+l.x),c.y=.5*(g.y+l.y)):2===n&&K.$(g.x,this.i(0).x)&&K.$(g.y,this.i(0).y)&&
(c.x=.5*(g.x+l.x),c.y=.5*(g.y+l.y));xd(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=aq(this,m.copy(),!1,pb));l=.5*(l+m.x);g=.5*(g+m.y);xd(h,e.x-d,e.y-k,l-d,g-k,m.x-d,m.y-k);J.free(b);J.free(c);J.free(f);J.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=aq(this,g.copy(),!1,pb)),xd(h,f.x-d,f.y-k,e.x-d,e.y-k,g.x-d,g.y-k);else{f=
J.alloc();f.assign(this.i(0));e=J.alloc();e.assign(f);g=this.computeCorner();n=1;for(l=0;n<b;){n=bq(this,f,n,1<n);m=this.i(n);if(n>=b-1){if(!f.C(m))0!==this.computeShortLength(!1)&&(m=aq(this,m.copy(),!1,pb)),dq(this,h,-d,-k,f,m,c);else if(0===l)for(n=1;n<b;)e.assign(f),m=this.i(n++),dq(this,h,-d,-k,f,m,c),f.assign(m);break}l=bq(this,m,n+1,n<b-3);n=-d;w=-k;p=m;v=this.i(l);u=c;if(K.B(f.y,p.y)&&K.B(p.x,v.x))if(q=Math.min(g,Math.abs(p.x-e.x)/2),q=z=Math.min(q,Math.abs(v.y-p.y)/2),K.B(q,0))dq(this,h,
n,w,f,p,u),f.assign(p);else{var A=p.x,B=p.y;r=A;y=B;p.x>f.x?A=p.x-q:A=p.x+q;v.y>p.y?y=p.y+z:y=p.y-z;v=J.allocAt(A,B);dq(this,h,n,w,f,v,u);J.free(v);yd(h,p.x+n,p.y+w,r+n,y+w);f.h(r,y)}else K.B(f.x,p.x)&&K.B(p.y,v.y)?(q=Math.min(g,Math.abs(p.y-e.y)/2),q=z=Math.min(q,Math.abs(v.x-p.x)/2),K.B(z,0)?(dq(this,h,n,w,f,p,u),f.assign(p)):(A=p.x,B=p.y,r=A,y=B,p.y>f.y?B=p.y-q:B=p.y+q,v.x>p.x?r=p.x+z:r=p.x-z,v=J.allocAt(A,B),dq(this,h,n,w,f,v,u),J.free(v),yd(h,p.x+n,p.y+w,r+n,y+w),f.h(r,y))):(dq(this,h,n,w,f,
p,u),f.assign(p));e.assign(m);n=l}J.free(f)}Bd=h}else h=this.i(1).copy(),h.x-=d,h.y-=k,0!==this.computeShortLength(!0)&&(e=aq(this,e,!0,f)),0!==this.computeShortLength(!1)&&(h=aq(this,h,!1,f)),a.type=P.j,a.startX=e.x,a.startY=e.y,a.endX=h.x,a.endY=h.y;this.jk=!0;return a};function cq(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 K.$(a,0)?b:K.$(b,0)?a:Math.sqrt(a*a+b*b)}
function aq(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=cq(b.x,b.y,c,f);if(0===d)return b;e=2===e?.5*d:d;a=a.computeShortLength(!0);a>e&&(a=e);e=a*(f-b.y)/d;b.x+=a*(c-b.x)/d;b.y+=e}else{f=a.i(e-2);c=f.x-d.x;f=f.y-d.y;d=cq(b.x,b.y,c,f);if(0===d)return b;e=2===e?.5*d:d;a=a.computeShortLength(!1);a>e&&(a=e);e=a*(b.y-f)/d;b.x-=a*(b.x-c)/d;b.y-=e}return b}
function bq(a,b,c,d){for(var e=a.pointsCount,f=b;K.$(b.x,f.x)&&K.$(b.y,f.y);){if(c>=e)return e-1;f=a.i(c++)}if(!K.$(b.x,f.x)&&!K.$(b.y,f.y))return c-1;for(var g=f;K.$(b.x,f.x)&&K.$(f.x,g.x)&&(!d||(b.y>=f.y?f.y>=g.y:f.y<=g.y))||K.$(b.y,f.y)&&K.$(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 dq(a,b,c,d,e,f,g){if(!g&&Fp(a)){g=a.computeJumpLength();var h=g/2,k=[],l=0;a.isVisible()&&(l=eq(a,e,f,k));if(0<l)if(K.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===Yf?wd(b,r,q,!1):xd(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===Yf?wd(b,n,r,!1):xd(b,p,m,n,m,n,r)}else if(K.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===Yf?wd(b,q,n,!1):xd(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===Yf?wd(b,r,m,!1):xd(b,n,p,n,m,r,m)}}b.lineTo(f.x+c,f.y+d)}
function eq(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.Pa.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()&&Fp(k)){var l=k.routeBounds;l.w()&&a.routeBounds.Vc(l)&&!a.usesSamePort(k)&&(l=k.path,null!==l&&l.Qd()&&fq(b,c,d,k))}}}}}0<d.length&&d.sort(function(a,b){return a-b});return d.length}
function fq(a,b,c,d){for(var e=K.B(a.y,b.y),f=d.pointsCount,g=d.i(0),h=J.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(!K.B(m,p)){if(K.B(n,r)&&K.B(q,u)&&Math.min(m,p)<q&&Math.max(m,p)>q&&Math.min(g,w)<n&&Math.max(g,w)>n&&!K.B(g,w)){h.x=q;h.y=n;m=!0;break a}}else if(!K.B(n,r)&&
K.B(g,w)&&Math.min(n,r)<g&&Math.max(n,r)>g&&Math.min(q,u)<m&&Math.max(q,u)>m&&!K.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}J.free(h)}function Fp(a){a=a.curve;return a===Xf||a===Yf}function Jp(a,b){if(b||Fp(a))b=a.diagram,null===b||b.animationManager.isTicking||b.Ch.contains(a)||0===a.kl.width&&0===a.kl.height||b.Ch.add(a,a.kl.copy())}
T.prototype.Uo=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.Pa.s;for(var g=e.length,h=0;h<g;h++){var k=e[h];k instanceof T&&(k===this?f=!0:f&&gq(this,k,a))}}else if(d)for(f=e.Pa.s,e=f.length,g=0;g<e;g++)h=f[g],h instanceof T&&gq(this,h,a)}}}};
function gq(a,b,c){if(null!==b&&b.jk&&b.bd&&Fp(b)){var d=b.routeBounds;d.w()&&(a.routeBounds.Vc(d)||c.Vc(d))&&(a.usesSamePort(b)||b.pc())}}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.Xa(e))return!0;b=this.i(b-1);a=a.i(c-1);if(b.Xa(a)||d.Xa(a)||b.Xa(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.Xb=function(a){U.prototype.Xb.call(this,a);a&&Jp(this,!1);null!==this.Sf&&this.Sf.Pl();if(null!==this.ud)for(var b=this.ud.iterator;b.next();)b.value.Xb(a)};T.prototype.computeAdjusting=function(){return this.isAvoiding&&null!==this.diagram&&this.diagram.animationManager.defaultAnimation.isAnimating?Bp:this.nk};
function Gp(a){var b=a.df;if(null!==b){var c=a.uf;if(null!==c&&isNaN(a.curviness)){for(var d=a.ef,e=a.vf,f=a=null,g=b.kb.s,h=g.length,k=0;k<h;k++){var l=g[k];if(l.df===b&&l.ef===d&&l.uf===c&&l.vf===e||l.df===c&&l.ef===e&&l.uf===b&&l.vf===d)null===f?f=l:(null===a&&(a=[],a.push(f)),a.push(l))}if(null!==a){f=lp(b,c,d,e);null===f&&(f=new hq(b,d,c,e),kp(b,f),kp(c,f));f.links=a;for(b=0;b<a.length;b++)a[b].Sf=f;f.Pl()}}}}
function Hp(a){var b=a.Sf;null!==b&&isNaN(a.curviness)&&(a.Sf=null,a=b.links.indexOf(a),0<=a&&(Da(b.links,a),b.Pl()))}T.prototype.nh=function(){return!0};
ma.Object.defineProperties(T.prototype,{fromNode:{get:function(){return this.df},set:function(a){var b=this.df;if(b!==a){var c=this.fromPort;null!==b&&(this.uf!==b&&pp(b,this,c),Hp(this),this.D(2));this.df=a;null!==a&&this.Xb(a.isVisible());this.Wf=null;this.bb();var d=this.diagram;null!==d&&d.aa&&d.partManager.setFromNodeForLink(this,a,b);var e=this.fromPort,f=this.fromPortChanged;if(null!==f){var g=!0;null!==d&&(g=d.aa,d.aa=!0);f(this,c,e);null!==d&&(d.aa=g)}null!==
a&&(this.uf!==a&&op(a,this,e),Gp(this),this.D(1));this.g("fromNode",b,a);gp(this)}}},fromPortId:{get:function(){return this.ef},set:function(a){var b=this.ef;if(b!==a){var c=this.fromPort;null!==c&&mp(c);Hp(this);this.ef=a;var d=this.fromPort;null!==d&&mp(d);var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.pi()&&g.vv(f,a)}c!==d&&(this.Wf=null,this.bb(),f=this.fromPortChanged,null!==f&&(g=!0,null!==e&&(g=e.aa,e.aa=!0),f(this,c,d),null!==e&&(e.aa=g)));
Gp(this);this.g("fromPortId",b,a)}}},fromPort:{get:function(){var a=this.df;return null===a?null:a.ks(this.ef)}},fromPortChanged:{get:function(){return this.fn},set:function(a){var b=this.fn;b!==a&&(this.fn=a,this.g("fromPortChanged",b,a))}},toNode:{get:function(){return this.uf},set:function(a){var b=this.uf;if(b!==a){var c=this.toPort;null!==b&&(this.df!==b&&pp(b,this,c),Hp(this),this.D(2));this.uf=a;null!==
a&&this.Xb(a.isVisible());this.Wf=null;this.bb();var d=this.diagram;null!==d&&d.aa&&d.partManager.setToNodeForLink(this,a,b);var e=this.toPort,f=this.toPortChanged;if(null!==f){var g=!0;null!==d&&(g=d.aa,d.aa=!0);f(this,c,e);null!==d&&(d.aa=g)}null!==a&&(this.df!==a&&op(a,this,e),Gp(this),this.D(1));this.g("toNode",b,a);gp(this)}}},toPortId:{get:function(){return this.vf},set:function(a){var b=this.vf;if(b!==a){var c=this.toPort;null!==c&&mp(c);Hp(this);this.vf=a;var d=
this.toPort;null!==d&&mp(d);var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.pi()&&g.Av(f,a)}c!==d&&(this.Wf=null,this.bb(),f=this.toPortChanged,null!==f&&(g=!0,null!==e&&(g=e.aa,e.aa=!0),f(this,c,d),null!==e&&(e.aa=g)));Gp(this);this.g("toPortId",b,a)}}},toPort:{get:function(){var a=this.uf;return null===a?null:a.ks(this.vf)}},toPortChanged:{get:function(){return this.to},set:function(a){var b=this.to;b!==a&&(this.to=
a,this.g("toPortChanged",b,a))}},fromSpot:{get:function(){return null!==this.ba?this.ba.Wi:Sc},set:function(a){var b=this.fromSpot;b.C(a)||(a=a.J(),this.Uc(),this.ba.Wi=a,this.g("fromSpot",b,a),(b.Xc()||a.Xc())&&null!==this.fromNode&&mp(this.fromPort),this.bb())}},fromEndSegmentLength:{get:function(){return null!==this.ba?this.ba.Ui:NaN},set:function(a){var b=this.fromEndSegmentLength;b!==a&&(0>a&&xa(a,">= 0",T,"fromEndSegmentLength"),this.Uc(),
this.ba.Ui=a,this.g("fromEndSegmentLength",b,a),this.bb())}},fromShortLength:{get:function(){return null!==this.ba?this.ba.Vi:NaN},set:function(a){var b=this.fromShortLength;b!==a&&(this.Uc(),this.ba.Vi=a,this.pc(),this.g("fromShortLength",b,a))}},toSpot:{get:function(){return null!==this.ba?this.ba.yj:Sc},set:function(a){var b=this.toSpot;b.C(a)||(a=a.J(),this.Uc(),this.ba.yj=a,this.g("toSpot",b,a),(b.Xc()||a.Xc())&&null!==this.toNode&&
mp(this.toPort),this.bb())}},toEndSegmentLength:{get:function(){return null!==this.ba?this.ba.wj:NaN},set:function(a){var b=this.toEndSegmentLength;b!==a&&(0>a&&xa(a,">= 0",T,"toEndSegmentLength"),this.Uc(),this.ba.wj=a,this.g("toEndSegmentLength",b,a),this.bb())}},toShortLength:{get:function(){return null!==this.ba?this.ba.xj:NaN},set:function(a){var b=this.toShortLength;b!==a&&(this.Uc(),this.ba.xj=a,this.pc(),this.g("toShortLength",b,
a))}},isLabeledLink:{get:function(){return null===this.ud?!1:0<this.ud.count}},labelNodes:{get:function(){return null===this.ud?Ya:this.ud.iterator}},relinkableFrom:{get:function(){return 0!==(this.Qa&1)},set:function(a){var b=0!==(this.Qa&1);b!==a&&(this.Qa^=1,this.g("relinkableFrom",b,a),this.Ub())}},relinkableTo:{get:function(){return 0!==(this.Qa&2)},set:function(a){var b=0!==
(this.Qa&2);b!==a&&(this.Qa^=2,this.g("relinkableTo",b,a),this.Ub())}},resegmentable:{get:function(){return 0!==(this.Qa&4)},set:function(a){var b=0!==(this.Qa&4);b!==a&&(this.Qa^=4,this.g("resegmentable",b,a),this.Ub())}},isTreeLink:{get:function(){return 0!==(this.Qa&8)},set:function(a){var b=0!==(this.Qa&8);b!==a&&(this.Qa^=8,this.g("isTreeLink",b,a),null!==this.fromNode&&Hk(this.fromNode),null!==this.toNode&&Hk(this.toNode))}},path:{
get:function(){var a=this.sb();return a instanceof Bf?a:null}},routeBounds:{get:function(){this.ug();var a=this.kl,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.Xe(e)}else if(this.computeCurve()===bg&&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);K.Bl(e.x,e.y,d.x,d.y,d.x,d.y,f.x,f.y,.5,a)}else for(f=3;f<d;f+=3){var g=this.i(f-2);f+3>=d&&(f=d-1);var h=this.i(f-1),k=this.i(f);K.Bl(e.x,e.y,g.x,g.y,h.x,h.y,k.x,k.y,.5,a);b=Math.min(k.x,b);c=Math.min(k.y,c);e=k}else for(e=this.i(0),f=this.i(1),b=Math.min(e.x,f.x),c=Math.min(e.y,f.y),a.h(e.x,e.y,0,0),a.Xe(f),e=2;e<d;e++)f=this.i(e),b=Math.min(f.x,b),c=Math.min(f.y,c),a.Xe(f);this.ru.h(b-
a.x,c-a.y)}return a}},midPoint:{get:function(){this.ug();return this.computeMidPoint(new J)}},midAngle:{get:function(){this.ug();return this.computeMidAngle()}},flattenedLengths:{get:function(){if(null===this.Zp){this.bd||Ip(this);for(var a=this.Zp=[],b=this.pointsCount,c=0;c<b-1;c++){var d=this.i(c);var e=this.i(c+1);K.$(d.x,e.x)?(d=e.y-d.y,0>d&&(d=-d)):K.$(d.y,e.y)?(d=e.x-d.x,0>d&&(d=-d)):d=Math.sqrt(d.Bf(e));
a.push(d)}}return this.Zp}},flattenedTotalLength:{get:function(){var a=this.st;if(isNaN(a)){for(var b=this.flattenedLengths,c=b.length,d=a=0;d<c;d++)a+=b[d];this.st=a}return a}},points:{get:function(){return this.Mb},set:function(a){var b=this.Mb;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 F,d=0;d<a.length/2;d++)e=(new J(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(!za(f)||"number"!==typeof f.x||isNaN(f.x)||"number"!==typeof f.y||isNaN(f.y)){d=!1;break}}if(d)for(c=new F,d=0;d<a.length;d++)e=a[d],c.add((new J(e.x,e.y)).freeze())}}else if(a instanceof F)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.Mb=c;this.pc();Ip(this);a=this.diagram;null!==a&&(a.oi||a.undoManager.isUndoingRedoing||a.xs.add(this),
a.animationManager.Bb&&Nh(a.animationManager,this,c));this.g("points",b,c)}}},pointsCount:{get:function(){return this.Mb.count}},bd:{get:function(){return 0!==(this.Qa&16)},set:function(a){0!==(this.Qa&16)!==a&&(this.Qa^=16)}},suspendsRouting:{get:function(){return 0!==(this.Qa&32)},set:function(a){0!==(this.Qa&32)!==a&&(this.Qa^=32)}},computingPoints:{get:function(){return 0!==
(this.Qa&64)},set:function(a){0!==(this.Qa&64)!==a&&(this.Qa^=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.qj.value&2)}},isAvoiding:{get:function(){return 4===(this.qj.value&4)}},jk:{
get:function(){return 0!==(this.Qa&128)},set:function(a){0!==(this.Qa&128)!==a&&(this.Qa^=128)}},geometry:{get:function(){if(!this.jk){this.ug();if(2>this.pointsCount)return this.jk=!0,this.ta;this.ta=this.makeGeometry()}return this.ta}},firstPickIndex:{get:function(){return 2>=this.pointsCount?0:this.isOrthogonal||!Mp(this.computeSpot(!0))?1:0}},lastPickIndex:{get:function(){var a=this.pointsCount;return 0===
a?0:2>=a?a-1:this.isOrthogonal||!Mp(this.computeSpot(!1))?a-2:a-1}},adjusting:{get:function(){return this.nk},set:function(a){var b=this.nk;b!==a&&(this.nk=a,this.g("adjusting",b,a))}},corner:{get:function(){return this.Nm},set:function(a){var b=this.Nm;b!==a&&(this.Nm=a,this.pc(),this.g("corner",b,a))}},curve:{get:function(){return this.Pm},set:function(a){var b=this.Pm;b!==a&&(this.Pm=a,this.bb(),this.pc(),
Jp(this,b===Yf||b===Xf||a===Yf||a===Xf),this.g("curve",b,a))}},curviness:{get:function(){return this.Qm},set:function(a){var b=this.Qm;b!==a&&(this.Qm=a,this.bb(),this.pc(),this.g("curviness",b,a))}},routing:{get:function(){return this.qj},set:function(a){var b=this.qj;b!==a&&(this.qj=a,this.Wf=null,this.bb(),Jp(this,2===(b.value&2)||2===(a.value&2)),this.g("routing",b,a))}},smoothness:{get:function(){return this.oo},
set:function(a){var b=this.oo;b!==a&&(this.oo=a,this.pc(),this.g("smoothness",b,a))}},key:{get:function(){var a=this.diagram;if(null!==a&&a.model.pi())return a.model.zc(this.data)}}});T.prototype.invalidateOtherJumpOvers=T.prototype.Uo;T.prototype.findClosestSegment=T.prototype.fz;T.prototype.updateRoute=T.prototype.ug;T.prototype.invalidateRoute=T.prototype.bb;T.prototype.rollbackRoute=T.prototype.rv;T.prototype.commitRoute=T.prototype.zf;T.prototype.startRoute=T.prototype.sh;
T.prototype.clearPoints=T.prototype.Fj;T.prototype.removePoint=T.prototype.pv;T.prototype.addPointAt=T.prototype.yf;T.prototype.addPoint=T.prototype.le;T.prototype.insertPointAt=T.prototype.l;T.prototype.insertPoint=T.prototype.Lz;T.prototype.setPointAt=T.prototype.M;T.prototype.setPoint=T.prototype.$c;T.prototype.getPoint=T.prototype.i;T.prototype.getOtherPort=T.prototype.Dz;T.prototype.getOtherNode=T.prototype.Qo;
var Kp=null,Lp=null,Ap=new E(T,"Normal",1),iq=new E(T,"Orthogonal",2),jq=new E(T,"AvoidsNodes",6),Sp=new E(T,"AvoidsNodesStraight",7),Zf=new E(T,"None",0),bg=new E(T,"Bezier",9),Yf=new E(T,"JumpGap",10),Xf=new E(T,"JumpOver",11),Bp=new E(T,"End",17),Cp=new E(T,"Scale",18),Dp=new E(T,"Stretch",19),fn=new E(T,"OrientAlong",21),Ym=new E(T,"OrientPlus90",22),$m=new E(T,"OrientMinus90",23),Ep=new E(T,"OrientOpposite",24),gn=new E(T,"OrientUpright",25),Zm=new E(T,"OrientPlus90Upright",26),an=new E(T,"OrientMinus90Upright",
27),bn=new E(T,"OrientUpright45",28),Up=16,Tp=14,Vp=8;T.className="Link";T.Normal=Ap;T.Orthogonal=iq;T.AvoidsNodes=jq;T.AvoidsNodesStraight=Sp;T.None=Zf;T.Bezier=bg;T.JumpGap=Yf;T.JumpOver=Xf;T.End=Bp;T.Scale=Cp;T.Stretch=Dp;T.OrientAlong=fn;T.OrientPlus90=Ym;T.OrientMinus90=$m;T.OrientOpposite=Ep;T.OrientUpright=gn;T.OrientPlus90Upright=Zm;T.OrientMinus90Upright=an;T.OrientUpright45=bn;T.EndSegmentStep=8;T.CurvinessStart=Up;T.SpacingMin=Tp;T.OrthoShortCut=Vp;
function hq(a,b,c,d){Qa(this);this.Ee=this.mq=!1;this.As=a;this.Qx=b;this.cv=c;this.Rx=d;this.links=[]}hq.prototype.Pl=function(){if(!this.mq){var a=this.links;0<a.length&&(a=a[0].diagram,null!==a&&(a.mw.add(this),this.Ee=a.undoManager.isUndoingRedoing))}this.mq=!0};
hq.prototype.Lv=function(){if(this.mq){this.mq=!1;var a=this.links;if(0<a.length){var b=a[0],c=b.diagram;c=null===c||c.oi&&!this.Ee;this.Ee=!1;b.arrangeBundledLinks(a,c);1===a.length&&(b.Sf=null,a.length=0)}0===a.length&&(a=this.As,null!==this&&null!==a.$e&&a.$e.remove(this),a=this.cv,null!==this&&null!==a.$e&&a.$e.remove(this))}};hq.className="LinkBundle";
function lk(a){Qa(this);this.$x=this.group=null;this.ss=!0;this.abort=!1;this.Jd=this.Hd=1;this.En=this.Dn=-1;this.qc=a.width;this.rc=a.height;this.$b=null;this.di=this.ci=0;this.Ls=11;this.Jx=this.Ix=22}
lk.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.Hd=Math.floor((a.x-this.qc)/this.qc)*this.qc;this.Jd=Math.floor((b-this.rc)/this.rc)*this.rc;this.Dn=Math.ceil((c+2*this.qc)/this.qc)*this.qc;this.En=Math.ceil((d+2*this.rc)/this.rc)*this.rc;a=1+(Math.ceil((this.Dn-this.Hd)/this.qc)|0);b=1+(Math.ceil((this.En-this.Jd)/this.rc)|0);if(null===this.$b||this.ci<a-1||this.di<b-1){c=[];for(d=0;d<=a;d++)c[d]=new Uint32Array(b);this.$b=c;this.ci=
a-1;this.di=b-1}a=kq;if(null!==this.$b)for(b=0;b<=this.ci;b++)if(c=this.$b[b],c.fill)c.fill(a);else for(d=0;d<=this.di;d++)c[d]=a}};function Ak(a,b,c){return a.Hd<=b&&b<=a.Dn&&a.Jd<=c&&c<=a.En}function Xp(a,b,c){if(!Ak(a,b,c))return kq;b-=a.Hd;b/=a.qc;c-=a.Jd;c/=a.rc;return a.$b[b|0][c|0]}function zk(a){if(null!==a.$b)for(var b=0;b<=a.ci;b++)for(var c=a.$b[b],d=0;d<=a.di;d++)c[d]>=$p&&(c[d]=kq)}
lk.prototype.Xj=function(a,b,c,d){if(a>this.Dn||a+c<this.Hd||b>this.En||b+d<this.Jd)return!0;a=(a-this.Hd)/this.qc|0;b=(b-this.Jd)/this.rc|0;c=Math.max(0,c)/this.qc+1|0;var e=Math.max(0,d)/this.rc+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.ci)|0;for(c=Math.min(b+e-1,this.di)|0;a<=d;a++){e=this.$b[a];for(var f=b;f<=c;f++)if(e[f]===Bk)return!1}return!0};
function lq(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.$b[l][m];if(n>=$p&&n<Yp)for(e?m+=d:l+=d,n+=1;f<=l&&l<=g&&h<=m&&m<=k&&!(n>=a.$b[l][m]);)a.$b[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)lq(a,b,c,1,!e,f,g,h,k),lq(a,b,c,-1,!e,f,g,h,k);else for(c+=d;c>l;c+=d)lq(a,b,c,1,!e,f,g,h,k),lq(a,b,c,-1,!e,f,g,h,k);else if(0<d)for(b+=d;b<l;b+=d)lq(a,b,c,1,!e,f,g,h,k),lq(a,b,c,-1,!e,f,g,h,k);else for(b+=d;b>l;b+=d)lq(a,b,c,1,!e,f,g,h,k),lq(a,b,c,-1,!e,f,g,h,
k)}}function mq(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=Bk,m=$p;for(a.$b[b][c]=m;l===Bk&&b>f&&b<g&&c>h&&c<k;)m+=1,a.$b[b][c]=m,e?c+=d:b+=d,l=a.$b[b][c]}function nq(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=Bk,m=Yp;for(a.$b[b][c]=m;l===Bk&&b>f&&b<g&&c>h&&c<k;)a.$b[b][c]=m,e?c+=d:b+=d,l=a.$b[b][c]}
function Wp(a,b,c,d,e,f,g){if(null!==a.$b){a.abort=!1;var h=b.x,k=b.y;if(Ak(a,h,k)){h-=a.Hd;h/=a.qc;k-=a.Jd;k/=a.rc;var l=d.x,m=d.y;if(Ak(a,l,m))if(l-=a.Hd,l/=a.qc,m-=a.Jd,m/=a.rc,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.Hd;n/=a.qc;d-=a.Jd;d/=a.rc;b-=a.Hd;b/=a.qc;p-=a.Jd;p/=a.rc;f=Math.max(0,Math.min(a.ci,n|0));b=Math.min(a.ci,Math.max(0,b|0));n=Math.max(0,Math.min(a.di,d|0));p=Math.min(a.di,Math.max(0,p|0));d=a.$b;h|=0;k|=0;l|=0;m|=
0;var r=0===c||90===c?1:-1;c=90===c||270===c;d[h][k]===Bk?(mq(a,h,k,r,c,f,b,n,p),mq(a,h,k,1,!c,f,b,n,p),mq(a,h,k,-1,!c,f,b,n,p)):mq(a,h,k,r,c,h,k,h,k);d[l][m]===Bk?(nq(a,l,m,0===e||90===e?1:-1,90===e||270===e,f,b,n,p),nq(a,l,m,1,!(90===e||270===e),f,b,n,p),nq(a,l,m,-1,!(90===e||270===e),f,b,n,p)):nq(a,l,m,r,c,l,m,l,m);c=Ea();if(g&&oq(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=$p;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 lq(a,h,k,1,!1,f,b,n,p),lq(a,h,k,-1,!1,f,b,n,p),lq(a,h,k,1,!0,f,b,n,p),lq(a,h,k,-1,!0,f,b,n,p);Ga(c)}}}}
function oq(a,b,c,d,e,f,g){for(var h=a.$b,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===pq)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!==pq){g.push(k);g.push(l);if(oq(a,k,l,
m,e,f,g))return!0;g.pop();g.pop()}h[k][l]=pq;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(lk.prototype,{bounds:{get:function(){return new N(this.Hd,this.Jd,this.Dn-this.Hd,this.En-this.Jd)}},Go:{get:function(){return this.qc},set:function(a){0<a&&a!==this.qc&&(this.qc=a,this.initialize(this.bounds))}},Fo:{get:function(){return this.rc},set:function(a){0<a&&a!==this.rc&&(this.rc=a,this.initialize(this.bounds))}}});var Bk=0,$p=1,Yp=999999,kq=Yp+1,pq=Yp+2;lk.className="PositionArray";
function Qp(){Qa(this);this.port=this.node=null;this.oe=[];this.Yo=!1}Qp.prototype.toString=function(){for(var a=this.oe,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 qq(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}Qp.prototype.Pl=function(){this.oe.length=0};
function Rp(a,b){var c=a.oe;if(0===c.length){a:if(!a.Yo){c=a.Yo;a.Yo=!0;var d=null,e=a.node,f=e instanceof pf?e:null;if(null===f||f.isSubGraphExpanded)var g=e.isTreeExpanded?e.findLinksConnected(a.port.portId):e.qx();else{if(!f.actualBounds.w()){a.Yo=c;break a}d=f;g=d.Ju()}f=a.oe.length=0;var h=a.port.ka(sc,J.alloc()),k=a.port.ka(Bc,J.alloc());e=N.allocAt(h.x,h.y,0,0);e.Xe(k);J.free(h);J.free(k);h=J.allocAt(e.x+e.width/2,e.y+e.height/2);k=a.port.ki();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.Pd(d),n=l.computeSpot(m,a.port);if(n.Xc()&&(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.ab(m);p-=k;0>p?p+=360:360<=p&&(p-=360);n=qq(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.oe[f];void 0===r?(r=new rq(l,p,n),a.oe[f]=r):(r.link=l,r.angle=p,r.Mc=
n);r.hv.set(m);f++}}}}J.free(h);a.oe.sort(Qp.prototype.j);k=a.oe.length;d=-1;for(f=h=0;f<k;f++)g=a.oe[f],void 0!==g&&(g.Mc!==d&&(d=g.Mc,h=0),g.Ro=h,h++);d=-1;h=0;for(f=k-1;0<=f;f--)k=a.oe[f],void 0!==k&&(k.Mc!==d&&(d=k.Mc,h=k.Ro+1),k.El=h);f=a.oe;n=a.port;d=a.node.portSpreading;h=J.alloc();k=J.alloc();g=J.alloc();l=J.alloc();n.ka(sc,h);n.ka(uc,k);n.ka(Bc,g);n.ka(zc,l);r=p=m=n=0;if(d===xp)for(var q=0;q<f.length;q++){var u=f[q];if(null!==u){var w=u.link.computeThickness();switch(u.Mc){case 8:p+=w;break;
case 2:r+=w;break;case 1:n+=w;break;default:case 4:m+=w}}}var v=q=0,y=1,z=u=0;for(w=0;w<f.length;w++){var A=f[w];if(null!==A){if(q!==A.Mc){q=A.Mc;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;z=v.y-B.y;switch(q){case 8:p>Math.abs(u)?(y=Math.abs(u)/p,p=Math.abs(u)):y=1;break;case 2:r>Math.abs(z)?(y=Math.abs(z)/r,r=Math.abs(z)):y=1;break;case 1:n>Math.abs(u)?(y=Math.abs(u)/n,n=Math.abs(u)):y=1;break;default:case 4:m>Math.abs(z)?(y=Math.abs(z)/
m,m=Math.abs(z)):y=1}v=0}var D=A.Wo;if(d===xp){A=A.link.computeThickness();A*=y;D.set(B);switch(q){case 8:D.x=B.x+u/2+p/2-v-A/2;break;case 2:D.y=B.y+z/2+r/2-v-A/2;break;case 1:D.x=B.x+u/2-n/2+v+A/2;break;default:case 4:D.y=B.y+z/2-m/2+v+A/2}v+=A}else{var M=.5;d===ip&&(M=(A.Ro+1)/(A.El+1));D.x=B.x+u*M;D.y=B.y+z*M}}}J.free(h);J.free(k);J.free(g);J.free(l);B=a.oe;for(f=0;f<B.length;f++)d=B[f],null!==d&&(d.Hu=a.computeEndSegmentLength(d));a.Yo=c;N.free(e)}c=a.oe}for(a=0;a<c.length;a++)if(e=c[a],null!==
e&&e.link===b)return e;return null}Qp.prototype.j=function(a,b){return a===b?0:null===a?-1:null===b?1:a.Mc<b.Mc?-1:a.Mc>b.Mc?1:a.angle<b.angle?-1:a.angle>b.angle?1:0};
Qp.prototype.computeEndSegmentLength=function(a){var b=a.link,c=b.computeEndSegmentLength(this.node,this.port,rc,b.fromPort===this.port),d=a.Ro;if(0>d)return c;var e=a.El;if(1>=e||!b.isOrthogonal)return c;b=a.hv;var f=a.Wo;if(2===a.Mc||8===a.Mc)d=e-1-d;return((a=2===a.Mc||4===a.Mc)?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)};Qp.className="Knot";function rq(a,b,c){this.link=a;this.angle=b;this.Mc=c;this.hv=new J;this.El=this.Ro=0;this.Wo=new J;this.Hu=0}
rq.prototype.toString=function(){return this.link.toString()+" "+this.angle.toString()+" "+this.Mc.toString()+":"+this.Ro.toString()+"/"+this.El.toString()+" "+this.Wo.toString()+" "+this.Hu.toString()+" "+this.hv.toString()};rq.className="LinkInfo";function ti(a){Qa(this);this.m=this.H=null;this.Fh=this.rn=!0;this.xn=!1;this.zm=(new J(0,0)).freeze();this.un=!0;this.Dm=this.tn=null;this.wn=!1;this.j=null;a&&Object.assign(this,a)}
ti.prototype.cloneProtected=function(a){a.rn=this.rn;a.Fh=this.Fh;a.xn=this.xn;a.zm.assign(this.zm);a.un=this.un;a.tn=this.tn;a.Dm=this.Dm;a.wn=!0};ti.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};ti.prototype.rb=function(){};ti.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+")"};
ti.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.Bc(),this.isOngoing&&a.oi||this.isInitial&&!a.oi)&&(this.isValidLayout=!1,a.Yb())}}};ti.prototype.createNetwork=function(){return new sq(this)};ti.prototype.makeNetwork=function(a){var b=this.createNetwork();a instanceof Q?(b.kg(a.nodes,!0),b.kg(a.links,!0)):a instanceof pf?b.kg(a.memberParts):b.kg(a.iterator);return b};
ti.prototype.updateParts=function(){this.isValidLayout=!0;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.Ea("Layout"),this.commitLayout()}finally{null!==a&&a.eb("Layout")}};ti.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()}};
ti.prototype.doLayout=function(a){var b=new H;a instanceof Q?(tq(this,b,a.nodes,!0,this.ph,!0,!1,!0),tq(this,b,a.parts,!0,this.ph,!0,!1,!0)):a instanceof pf?tq(this,b,a.memberParts,!1,this.ph,!0,!1,!0):b.addAll(a.iterator);0<b.count&&(a=this.diagram,null!==a&&a.Ea("Layout"),this.doMinimalNoNetworkLayout(b),null!==a&&a.eb("Layout"));this.isValidLayout=!0};
ti.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;uq(h);var k=h.measuredBounds,l=k.width;k=k.height;h.moveTo(d,e);h instanceof pf&&(h.ph=!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++}};
ti.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)&&(uq(h),this.ph(h))){var k=h.measuredBounds,l=k.width;k=k.height;h.moveTo(c,d);h instanceof pf&&(h.ph=!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++}}};ti.prototype.ph=function(a){return!a.location.w()||a instanceof pf&&a.ph?!0:!1};function tq(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 pf?null===k.layout?tq(a,b,k.memberParts,!1,e,f,g,h):(uq(k),b.add(k)):(uq(k),b.add(k))):g&&k instanceof T?b.add(k):!h||!k.Wc()||k instanceof V||(uq(k),b.add(k)))}}
function uq(a){var b=a.actualBounds;(0===b.width||0===b.height||isNaN(b.width)||isNaN(b.height))&&a.Va()}ti.prototype.mi=function(a,b){var c=this.boundsComputation;if(null!==c)return b||(b=new N),c(a,this,b);if(!b)return a.actualBounds;b.set(a.actualBounds);return b};
ti.prototype.ex=function(a){var b=new H;a instanceof Q?(tq(this,b,a.nodes,!0,null,!0,!0,!0),tq(this,b,a.links,!0,null,!0,!0,!0),tq(this,b,a.parts,!0,null,!0,!0,!0)):a instanceof pf?tq(this,b,a.memberParts,!1,null,!0,!0,!0):tq(this,b,a.iterator,!1,null,!0,!0,!0);return b};
ti.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.ka(sc),(isNaN(c.x)||isNaN(c.y))&&c.set(a),a=b.padding,c.x+=a.left,c.y+=a.top);return c}return a};
ma.Object.defineProperties(ti.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.rn},set:function(a){this.rn!==a&&(this.rn=a)}},isInitial:{get:function(){return this.Fh},set:function(a){this.Fh=a;a||(this.wn=!0)}},
isViewportSized:{get:function(){return this.xn},set:function(a){this.xn!==a&&(this.xn=a)&&this.D()}},isRouting:{get:function(){return this.un},set:function(a){this.un!==a&&(this.un=a)}},isRealtime:{get:function(){return this.tn},set:function(a){this.tn!==a&&(this.tn=a)}},isValidLayout:{get:function(){return this.wn},set:function(a){this.wn!==a&&(this.wn=a,a||(a=this.diagram,null!==
a&&(a.vh=!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.Dm},set:function(a){this.Dm!==a&&(this.Dm=a,this.D())}},arrangementOrigin:{get:function(){return this.zm},set:function(a){this.zm.C(a)||(this.zm.assign(a),this.D())}}});ti.prototype.collectParts=ti.prototype.ex;ti.prototype.getLayoutBounds=ti.prototype.mi;
ti.prototype.invalidateLayout=ti.prototype.D;ti.className="Layout";function sq(a){Qa(this);this.Qc=a;this.wf=new H;this.xe=new H;this.Bs=new ob;this.ws=new ob}sq.prototype.clear=function(){if(this.wf)for(var a=this.wf.iterator;a.next();)a.value.clear();if(this.xe)for(a=this.xe.iterator;a.next();)a.value.clear();this.wf=new H;this.xe=new H;this.Bs=new ob;this.ws=new ob};
sq.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.wf.count+" edges: "+this.xe.count;if(1<a){for(var c=this.wf.iterator;c.next();)b+="\n "+c.value.toString(a-1);for(c=this.xe.iterator;c.next();)b+="\n "+c.value.toString(a-1)}return b};sq.prototype.createVertex=function(){return new vq(this)};sq.prototype.createEdge=function(){return new wq(this)};
sq.prototype.kg=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 pf&&null===d.layout)this.kg(d.memberParts,!1);else if(null===this.ji(d)){var e=this.createVertex();e.node=
d;this.ah(e)}}for(a.reset();a.next();)if(d=a.value,d instanceof T&&(!b||d.isTopLevel)&&d.canLayout()&&c(d)&&null===this.Ko(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.Yj(f,e,d))}}};sq.prototype.findGroupVertex=function(a){if(null===a)return null;var b=a.findVisibleNode();if(null===b)return null;a=this.ji(b);if(null!==a)return a;for(b=b.containingGroup;null!==b;){a=this.ji(b);if(null!==a)return a;b=b.containingGroup}return null};
t=sq.prototype;t.ah=function(a){if(null!==a){this.wf.add(a);var b=a.node;null!==b&&this.Bs.add(b,a);a.network=this}};t.zl=function(a){if(null===a)return null;var b=this.ji(a);null===b&&(b=this.createVertex(),b.node=a,this.ah(b));return b};t.Gu=function(a){if(null!==a&&xq(this,a)){for(var b=a.sg,c=b.count-1;0<=c;c--){var d=b.L(c);this.Mj(d)}b=a.lg;for(a=b.count-1;0<=a;a--)c=b.L(a),this.Mj(c)}};
function xq(a,b){if(null===b)return!1;var c=a.wf.remove(b);c&&(b=b.node,null!==b&&a.Bs.remove(b));return c}t.$y=function(a){null!==a&&(a=this.ji(a),null!==a&&this.Gu(a))};t.ji=function(a){return null===a?null:this.Bs.I(a)};t.Ao=function(a){if(null!==a){yq(this,a);var b=a.toVertex;null!==b&&b.Al(a);b=a.fromVertex;null!==b&&b.xl(a)}};function yq(a,b){if(null!==b){a.xe.add(b);var c=b.link;null!==c&&null===a.Ko(c)&&a.ws.add(c,b);b.network=a}}
t.Fy=function(a){if(null===a)return null;var b=a.fromNode,c=a.toNode,d=this.Ko(a);null===d?(d=this.createEdge(),d.link=a,null!==b&&(d.fromVertex=this.zl(b)),null!==c&&(d.toVertex=this.zl(c)),this.Ao(d)):(null!==b?d.fromVertex=this.zl(b):d.fromVertex=null,null!==c?d.toVertex=this.zl(c):d.toVertex=null);return d};t.Mj=function(a){if(null!==a){var b=a.toVertex;null!==b&&b.Hl(a);b=a.fromVertex;null!==b&&b.Gl(a);zq(this,a)}};
function zq(a,b){null!==b&&a.xe.remove(b)&&(b=b.link,null!==b&&a.ws.remove(b))}t.Zy=function(a){null!==a&&(a=this.Ko(a),null!==a&&this.Mj(a))};t.Ko=function(a){return null===a?null:this.ws.I(a)};t.Yj=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.Ao(d);return d}return null};t.fm=function(a){if(null!==a){var b=a.fromVertex,c=a.toVertex;null!==b&&null!==c&&(b.Gl(a),c.Hl(a),a.fm(),b.Al(a),c.xl(a))}};
t.Jo=function(){for(var a=Ea(),b=this.xe.iterator;b.next();){var c=b.value;c.fromVertex===c.toVertex&&a.push(c)}b=a.length;for(c=0;c<b;c++)this.Mj(a[c]);Ga(a)};sq.prototype.deleteArtificialVertexes=function(){for(var a=Ea(),b=this.wf.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.Gu(a[b]);b=Ea();for(c=this.xe.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.Mj(b[d]);Ga(a);Ga(b)};
function Aq(a){for(var b=Ea(),c=a.xe.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.Mj(b[d]);Ga(b)}
sq.prototype.ay=function(a){void 0===a&&(a=!0);a&&(this.deleteArtificialVertexes(),Aq(this),this.Jo());a=new F;for(var b=!0;b;){b=!1;for(var c=this.wf.iterator;c.next();){var d=c.value;if(0<d.sg.count||0<d.lg.count){b=this.layout.createNetwork();a.add(b);Bq(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 Bq(a,b,c){if(null!==c&&c.network!==b){xq(a,c);b.ah(c);for(var d=c.sourceEdges;d.next();){var e=d.value;e.network!==b&&(zq(a,e),yq(b,e),Bq(a,b,e.fromVertex))}for(d=c.destinationEdges;d.next();)c=d.value,c.network!==b&&(zq(a,c),yq(b,c),Bq(a,b,c.toVertex))}}sq.prototype.ez=function(){for(var a=new H,b=this.wf.iterator;b.next();)a.add(b.value.node);for(b=this.xe.iterator;b.next();)a.add(b.value.link);return a};
ma.Object.defineProperties(sq.prototype,{layout:{get:function(){return this.Qc},set:function(a){null!==a&&(this.Qc=a)}},vertexes:{get:function(){return this.wf}},edges:{get:function(){return this.xe}}});sq.prototype.findAllParts=sq.prototype.ez;sq.prototype.splitIntoSubNetworks=sq.prototype.ay;sq.prototype.deleteSelfEdges=sq.prototype.Jo;sq.prototype.reverseEdge=sq.prototype.fm;sq.prototype.linkVertexes=sq.prototype.Yj;
sq.prototype.findEdge=sq.prototype.Ko;sq.prototype.deleteLink=sq.prototype.Zy;sq.prototype.deleteEdge=sq.prototype.Mj;sq.prototype.addLink=sq.prototype.Fy;sq.prototype.addEdge=sq.prototype.Ao;sq.prototype.findVertex=sq.prototype.ji;sq.prototype.deleteNode=sq.prototype.$y;sq.prototype.deleteVertex=sq.prototype.Gu;sq.prototype.addNode=sq.prototype.zl;sq.prototype.addVertex=sq.prototype.ah;sq.prototype.addParts=sq.prototype.kg;sq.className="LayoutNetwork";
function vq(a){Qa(this);this.pb=a;this.j=(new N(0,0,10,10)).freeze();this.m=(new J(5,5)).freeze();this.Rh=this.wb=null;this.sg=new F;this.lg=new F}vq.prototype.clear=function(){this.Rh=this.wb=null;this.sg=new F;this.lg=new F};
vq.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutVertex#"+bb(this);if(0<a&&(b+=null!==this.node?"("+this.node.toString()+")":"",1<a)){a="";for(var c=!0,d=this.sg.iterator;d.next();){var e=d.value;c?c=!1:a+=",";a+=e.toString(0)}e="";c=!0;for(d=this.lg.iterator;d.next();){var f=d.value;c?c=!1:e+=",";e+=f.toString(0)}b+=" sources: "+a+" destinations: "+e}return b};
vq.prototype.commit=function(){var a=this.wb;if(null!==a){var b=this.bounds,c=a.bounds;za(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 pf)){c=N.alloc();a.Va();var d=this.network.layout.mi(a,c),e=a.locationObject.ka(xc);if(d.w()&&e.w()){a.moveTo(b.x+this.focusX-(e.x-d.x),b.y+this.focusY-(e.y-d.y));N.free(c);return}N.free(c)}a.moveTo(b.x,b.y)}};vq.prototype.Al=function(a){null!==a&&(this.sg.contains(a)||this.sg.add(a))};
vq.prototype.Hl=function(a){null!==a&&this.sg.remove(a)};vq.prototype.xl=function(a){null!==a&&(this.lg.contains(a)||this.lg.add(a))};vq.prototype.Gl=function(a){null!==a&&this.lg.remove(a)};function Cq(a,b){a=a.Rh;b=b.Rh;return a?b?(a=a.text,b=b.text,a<b?-1:a>b?1:0):1:null!==b?-1:0}
ma.Object.defineProperties(vq.prototype,{sourceEdgesArrayAccess:{get:function(){return this.sg._dataArray}},destinationEdgesArrayAccess:{get:function(){return this.lg._dataArray}},data:{get:function(){return this.wb},set:function(a){this.wb=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.Rh},
set:function(a){if(this.Rh!==a){this.Rh=a;a.Va();var b=this.network.layout,c=N.alloc(),d=b.mi(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);N.free(c);if(!(a instanceof pf)&&(a=a.locationObject.ka(xc),a.w())){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.pb},set:function(a){this.pb=a}},sourceVertexes:{get:function(){for(var a=new H,b=this.sourceEdges;b.next();)a.add(b.value.fromVertex);return a.iterator}},destinationVertexes:{get:function(){for(var a=new H,b=
this.destinationEdges;b.next();)a.add(b.value.toVertex);return a.iterator}},vertexes:{get:function(){for(var a=new H,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.sg.iterator}},destinationEdges:{get:function(){return this.lg.iterator}},edges:{get:function(){for(var a=
new F,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.sg.count+this.lg.count}}});vq.prototype.deleteDestinationEdge=vq.prototype.Gl;vq.prototype.addDestinationEdge=vq.prototype.xl;vq.prototype.deleteSourceEdge=vq.prototype.Hl;vq.prototype.addSourceEdge=vq.prototype.Al;vq.className="LayoutVertex";vq.standardComparer=Cq;
vq.smartComparer=function(a,b){if(null!==a){if(null!==b){a=a.Rh;var c=b.Rh;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 wq(a){Qa(this);this.ob=a;this.ld=this.ed=this.Yk=this.wb=null}wq.prototype.clear=function(){this.ld=this.ed=this.Yk=this.wb=null};wq.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutEdge#"+bb(this);0<a&&(b+=null!==this.Yk?"("+this.Yk.toString()+")":"",1<a&&(b+=" "+(this.ed?this.ed.toString():"null")+" --\x3e "+(this.ld?this.ld.toString():"null")));return b};
wq.prototype.fm=function(){var a=this.ed;this.ed=this.ld;this.ld=a};wq.prototype.commit=function(){};wq.prototype.Ax=function(a){return this.ld===a?this.ed:this.ed===a?this.ld:null};
ma.Object.defineProperties(wq.prototype,{network:{get:function(){return this.ob},set:function(a){this.ob=a}},data:{get:function(){return this.wb},set:function(a){this.wb!==a&&(this.wb=a)}},link:{get:function(){return this.Yk},set:function(a){this.Yk!==a&&(this.Yk=a)}},fromVertex:{get:function(){return this.ed},set:function(a){this.ed!==a&&(this.ed=a)}},toVertex:{
get:function(){return this.ld},set:function(a){this.ld!==a&&(this.ld=a)}}});wq.prototype.getOtherVertex=wq.prototype.Ax;wq.className="LayoutEdge";function Ok(a){ti.call(this);this.isViewportSized=!0;this.xo=this.yo=NaN;this.xg=(new L(NaN,NaN)).freeze();this.tf=(new L(10,10)).freeze();this.Jb=Dq;this.Ob=Eq;this.hd=Fq;this.cd=Gq;a&&Object.assign(this,a)}la(Ok,ti);
Ok.prototype.cloneProtected=function(a){ti.prototype.cloneProtected.call(this,a);a.yo=this.yo;a.xo=this.xo;a.xg.assign(this.xg);a.tf.assign(this.tf);a.Jb=this.Jb;a.Ob=this.Ob;a.hd=this.hd;a.cd=this.cd};Ok.prototype.rb=function(a){a.classType===Ok?a===Fq||a===Hq||a===Iq||a===Jq?this.sorting=a:a===Eq||a===Kq?this.arrangement=a:a===Dq||a===Lq?this.alignment=a:C("Unknown enum value: "+a):ti.prototype.rb.call(this,a)};
Ok.prototype.doLayout=function(a){this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);var b=this.ex(a);a=this.diagram;for(var c=b.copy().iterator;c.next();){var d=c.value;if(!d.nh()||null===d.fromNode&&null===d.toNode){if(d.Va(),d instanceof pf)for(d=d.memberParts;d.next();)b.remove(d.value)}else b.remove(d)}var e=b.Fa();if(0!==e.length){switch(this.sorting){case Jq:e.reverse();break;case Fq:e.sort(this.comparer);break;case Hq: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.Ea("Layout");d=[];switch(this.alignment){case Lq:var h=b,k=c,l=N.alloc(),m=Math.max(this.cellSize.width,1);if(!isFinite(m))for(var n=m=0;n<e.length;n++){var p=this.mi(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.mi(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,y=0;y<e.length;y++){var z=e[y],A=this.mi(z,l),B=Math.ceil((A.width+h)/m)*m,D=Math.ceil((A.height+k)/n)*n;switch(p){case Kq:var M=Math.abs(q-A.width);break;default:M=q+A.width}if(0<f&&w>f-1||0<g&&0<w&&M-r>g)d.push(new N(0,u,g+h,v)),w=0,q=r,u+=v,v=0;v=Math.max(v,D);switch(p){case Kq:A=-A.width;break;default:A=
0}z.moveTo(q+A,u);switch(p){case Kq:q-=B;break;default:q+=B}w++}d.push(new N(0,u,g+h,v));N.free(l);break;case Dq:k=g;m=f;n=b;p=c;g=N.alloc();r=Math.max(this.cellSize.width,1);f=u=l=0;h=J.alloc();for(q=0;q<e.length;q++)v=e[q],w=this.mi(v,g),v=Uo(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 Kq: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;y=this.arrangementOrigin.y;
u=0;k>=l&&(k-=l);l=z=0;B=Math.max(this.cellSize.height,1);A=f=0;D=!0;w=J.alloc();for(M=0;M<e.length;M++){var R=e[M],I=this.mi(R,g),G=Uo(R,R.locationObject,R.locationSpot,h);if(0<u)switch(q){case Kq:S=(S-v-(I.width-G.x))/r;S=K.$(Math.round(S),S)?Math.round(S):Math.floor(S);S=S*r+v;break;default:S=(S-v+G.x)/r,S=K.$(Math.round(S),S)?Math.round(S):Math.ceil(S),S=S*r+v}else switch(q){case Kq:z=S+G.x+I.width;break;default:z=S-G.x}switch(q){case Kq:var ca=-(S+G.x)+z;break;default:ca=S+I.width-G.x-z}if(0<
m&&u>m-1||0<k&&0<u&&ca>k){d.push(new N(0,D?y-f:y,k+n,A+f+p));for(S=0;S<u&&M!==u;S++){ca=e[M-u+S];var X=Uo(ca,ca.locationObject,ca.locationSpot,w);ca.moveTo(ca.position.x,ca.position.y+f-X.y)}A+=p;y=D?y+A:y+(A+f);u=A=f=0;S=v;D=!1}S===v&&(l=q===Kq?Math.max(l,I.width-G.x):Math.min(l,-G.x));f=Math.max(f,G.y);A=Math.max(A,I.height-G.y);isFinite(B)&&(A=Math.max(A,Math.max(I.height,B)-G.y));D?R.moveTo(S-G.x,y-G.y):R.moveTo(S-G.x,y);switch(q){case Kq:S-=G.x+n;break;default:S+=I.width-G.x+n}u++}d.push(new N(0,
y,k+n,(D?A:A+f)+p));if(e.length!==u)for(k=0;k<u;k++)m=e[e.length-u+k],n=Uo(m,m.locationObject,m.locationSpot,h),m.moveTo(m.position.x,m.position.y+f-n.y);J.free(h);J.free(w);if(q===Kq)for(e=0;e<d.length;e++)f=d[e],f.width+=l,f.x-=l;else for(e=0;e<d.length;e++)f=d[e],f.x>l&&(f.width+=f.x-l,f.x=l);N.free(g)}for(h=f=g=e=0;h<d.length;h++)k=d[h],e=Math.min(e,k.x),g=Math.min(g,k.y),f=Math.max(f,k.x+k.width);this.arrangement===Kq?this.commitLayers(d,new J(e+b/2-(f+e),g-c/2)):this.commitLayers(d,new J(e-
b/2,g-c/2));null!==a&&a.eb("Layout");this.isValidLayout=!0}};Ok.prototype.commitLayers=function(){};function Gq(a,b){a=a.text;b=b.text;return a<b?-1:a>b?1:0}
ma.Object.defineProperties(Ok.prototype,{wrappingWidth:{get:function(){return this.yo},set:function(a){this.yo!==a&&(0<a||isNaN(a))&&(this.yo=a,this.isViewportSized=isNaN(a),this.D())}},wrappingColumn:{get:function(){return this.xo},set:function(a){this.xo!==a&&(0<a||isNaN(a))&&(this.xo=a,this.D())}},cellSize:{get:function(){return this.xg},set:function(a){this.xg.C(a)||(this.xg.assign(a),this.D())}},spacing:{
get:function(){return this.tf},set:function(a){this.tf.C(a)||(this.tf.assign(a),this.D())}},alignment:{get:function(){return this.Jb},set:function(a){this.Jb===a||a!==Dq&&a!==Lq||(this.Jb=a,this.D())}},arrangement:{get:function(){return this.Ob},set:function(a){this.Ob===a||a!==Eq&&a!==Kq||(this.Ob=a,this.D())}},sorting:{get:function(){return this.hd},set:function(a){this.hd===a||a!==Iq&&a!==Jq&&
a!==Fq&&a!==Hq||(this.hd=a,this.D())}},comparer:{get:function(){return this.cd},set:function(a){this.cd!==a&&(this.cd=a,this.D())}}});var Lq=new E(Ok,"Position",0),Dq=new E(Ok,"Location",1),Eq=new E(Ok,"LeftToRight",2),Kq=new E(Ok,"RightToLeft",3),Iq=new E(Ok,"Forward",4),Jq=new E(Ok,"Reverse",5),Fq=new E(Ok,"Ascending",6),Hq=new E(Ok,"Descending",7);Ok.className="GridLayout";Ok.standardComparer=Gq;
Ok.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};Ok.Position=Lq;Ok.Location=Dq;Ok.LeftToRight=Eq;Ok.RightToLeft=Kq;Ok.Forward=Iq;Ok.Reverse=Jq;Ok.Ascending=Fq;Ok.Descending=Hq;function pi(){this.Nn=new H;this.Cn=new H;this.Pa=new H;this.bf=new ob;this.af=new ob;this.$i=new ob;this.H=null;this.qp=!1}t=pi.prototype;t.clear=function(){this.Nn.clear();this.Cn.clear();this.Pa.clear();this.bf.clear();this.af.clear();this.$i.clear()};t.We=function(a){this.H=a};
t.ni=function(a){if(a instanceof V){if(this.Nn.add(a),a instanceof pf){var b=a.containingGroup;null===b?this.H.$h.add(a):b.el.add(a);b=a.layout;null!==b&&(b.diagram=this.H)}}else a instanceof T?this.Cn.add(a):a instanceof te||this.Pa.add(a);b=a.data;null===b||a instanceof te||(a instanceof T?this.af.add(b,a):this.bf.add(b,a))};
t.oc=function(a){a.Ej();if(a instanceof V){if(this.Nn.remove(a),a instanceof pf){var b=a.containingGroup;null===b?this.H.$h.remove(a):b.el.remove(a);b=a.layout;null!==b&&(b.diagram=null)}}else a instanceof T?this.Cn.remove(a):a instanceof te||this.Pa.remove(a);b=a.data;null===b||a instanceof te||(a instanceof T?this.af.remove(b):this.bf.remove(b))};
t.Ud=function(){var a=this.H;if(null!==a){for(var b=a.nodeTemplateMap.iterator;b.next();){var c=b.value,d=b.key;(!c.Wc()||c instanceof pf)&&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 pf||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.Kc(b[d]),null!==e&&(e.isSelected=!0);for(d=0;d<c.length;d++)e=this.Kc(c[d]),null!==e&&(e.isHighlighted=!0);for(d=0;d<a.length;d+=2)e=this.Kc(a[d]),null!==e&&(e.location=a[d+1]);Ga(b);Ga(c);Ga(a)}};pi.prototype.addAllModeledParts=function(){this.addModeledParts(this.diagram.model.nodeDataArray)};
pi.prototype.addModeledParts=function(a,b){var c=this,d=this.diagram.model;a.forEach(function(a){d.mb(a)&&Mq(c,a,!1)});a.forEach(function(a){d.mb(a)&&c.resolveReferencesForData(a)});!1!==b&&fk(this.diagram,!1)};
function Mq(a,b,c){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.bf.contains(b)){void 0===c&&(c=!0);a:{if(void 0!==b&&null!==b&&!a.H.undoManager.isUndoingRedoing&&!a.bf.contains(b)){var d=a.Oo(b);var e=fp(a,b,d);if(null!==e&&(jg(e),e=e.copy(),null!==e)){var f=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.Tf=d;e.wb=b;a.qp&&(e.Hg="Tool");a.diagram.add(e);e.wb=null;e.data=b;a.diagram.skipsModelSourceBindings=f;d=e;break a}}d=null}null!==d&&c&&a.resolveReferencesForData(b)}}
pi.prototype.insertLink=function(){return null};pi.prototype.resolveReferencesForData=function(){};pi.prototype.Oo=function(a){return this.H.model.Oo(a)};
function fp(a,b,c){a=a.H;var d=a.model;d.Wj()&&d.Yu(b)?(b=a.groupTemplateMap.I(c),null===b&&(b=a.groupTemplateMap.I(""),null===b&&(Nq||(Nq=!0,ya('No Group template found for category "'+c+'"'),ya(" Using default group template")),b=a.ny))):(b=a.nodeTemplateMap.I(c),null===b&&(b=a.nodeTemplateMap.I(""),null===b&&(Oq||(Oq=!0,ya('No Node template found for category "'+c+'"'),ya(" Using default node template")),b=a.py)));return b}pi.prototype.getLinkCategoryForData=function(){return""};
pi.prototype.setLinkCategoryForData=function(){};pi.prototype.setFromNodeForLink=function(){};pi.prototype.setToNodeForLink=function(){};pi.prototype.findLinkTemplateForCategory=function(a){var b=this.H,c=b.linkTemplateMap.I(a);null===c&&(c=b.linkTemplateMap.I(""),null===c&&(Pq||(Pq=!0,ya('No Link template found for category "'+a+'"'),ya(" Using default link template")),c=b.oy));return c};pi.prototype.removeAllModeledParts=function(){this.Ds(this.diagram.model.nodeDataArray)};
pi.prototype.Ds=function(a){var b=this;a.forEach(function(a){b.fp(a)})};pi.prototype.fp=function(a){a=this.Kc(a);null!==a&&(Nj(this.diagram,a,!1),this.unresolveReferencesForPart(a))};pi.prototype.unresolveReferencesForPart=function(){};pi.prototype.removeDataForLink=function(){};pi.prototype.findPartForKey=function(a){if(null===a||void 0===a)return null;a=this.H.model.fc(a);return null!==a?this.bf.I(a):null};
pi.prototype.Tb=function(a){if(null===a||void 0===a)return null;a=this.H.model.fc(a);if(null===a)return null;a=this.bf.I(a);return a instanceof V?a:null};pi.prototype.findLinkForKey=function(){return null};t=pi.prototype;t.Kc=function(a){if(null===a)return null;var b=this.bf.I(a);return null!==b?b:b=this.af.I(a)};t.hi=function(a){if(null===a)return null;a=this.bf.I(a);return a instanceof V?a:null};t.Jc=function(a){return null===a?null:this.af.I(a)};
t.js=function(a){for(var b=0;b<arguments.length;++b);b=new H;for(var c=this.Nn.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(za(g)&&Qq(this,e,g)){b.add(d);break}}}return b.iterator};t.hs=function(a){for(var b=0;b<arguments.length;++b);b=new H;for(var c=this.Cn.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(za(g)&&Qq(this,e,g)){b.add(d);break}}}return b.iterator};
function Qq(a,b,c){for(var d in c){var e=b[d],f=c[d];if(Aa(f)){if(!Aa(e)||e.length<f.length)return!1;for(var g=0;g<e.length;g++){var h=f[g];if(void 0!==h&&!Rq(a,e[g],h))return!1}}else if(!Rq(a,e,f))return!1}return!0}function Rq(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(za(b)&&za(c)){if(!Qq(a,b,c))return!1}else if(b!==c)return!1;return!0}
pi.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.aa){b.aa=!1;try{var d=a.modelChange;if(""!==d)if(c===ce){if("nodeCategory"===d){var e=this.Kc(a.object),f=a.newValue;null!==e&&"string"===typeof f&&(e.category=f)}else"nodeDataArray"===d&&(this.Ds(a.oldValue),this.addModeledParts(a.newValue));b.isModified=!0}else if(c===ee){var g=a.newValue;"nodeDataArray"===d&&za(g)&&Mq(this,g);b.isModified=!0}else if(c===fe){var h=a.oldValue;
"nodeDataArray"===d&&za(h)&&this.fp(h);b.isModified=!0}else c===de&&("SourceChanged"===d?null!==a.object?this.updateDataBindings(a.object,a.propertyName):(this.op(),this.updateAllTargetBindings()):"ModelDisplaced"===d&&this.Ud());else if(c===ce){var k=a.propertyName,l=a.object;if(l===b.model){if("nodeKeyProperty"===k||"nodeCategoryProperty"===k)b.undoManager.isUndoingRedoing||this.Ud()}else this.updateDataBindings(l,k);b.isModified=!0}else if(c===ee||c===fe){var m=a.change===ee,n=m?a.newParam:a.oldParam,
p=m?a.newValue:a.oldValue,r=this.$i.I(a.object);if(Array.isArray(r))for(a=0;a<r.length;a++){var q=r[a];if(m)yn(q,p,n,!0);else if(!(0>n)){var u=n+qn(q);q.oc(u,!0);Bn(q,u,n)}}b.isModified=!0}}finally{b.aa=!0}}}}};pi.prototype.updateAllTargetBindings=function(a){void 0===a&&(a="");for(var b=this.parts.iterator;b.next();)b.value.Ma(a);for(b=this.nodes.iterator;b.next();)b.value.Ma(a);for(b=this.links.iterator;b.next();)b.value.Ma(a)};
pi.prototype.op=function(){for(var a=this.H.model,b=new H,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){Sq(a,b,!1)});for(d=0;d<c.length;d++){var f=c[d];null===this.Kc(f)&&Tq(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()};pi.prototype.refreshDataBoundLinks=function(){};pi.prototype.updateRelationshipsFromData=function(){};
pi.prototype.updateDataBindings=function(a,b){if("string"===typeof b){var c=this.Kc(a);if(null!==c)c.Ma(b);else{c=null;for(var d=this.$i.iterator;d.next();){for(var e=d.value,f=0;f<e.length;f++){var g=e[f].sx(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].Ma(b);Ga(c)}}a===this.diagram.model.modelData&&this.updateAllTargetBindings(b)}};
function Jj(a,b){var c=b.Gh;if(Aa(c)){var d=a.$i.I(c);if(null===d)d=[],d.push(b),a.$i.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}function Mj(a,b,c){Hj(b,function(a){a=a.O.s;for(var b=a.length,d=0;d<b;d++)ek(c,a[d])});var d=b.Gh;if(Aa(d)){var e=a.$i.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.$i.remove(d);break}}}
pi.prototype.Kj=function(a,b,c){void 0===c&&(c=!1);var d=new ob;if(Aa(a))for(var e=0;e<a.length;e++)Uq(this,a[e],b,d,c);else for(a=a.iterator;a.next();)Uq(this,a.value,b,d,c);if(null!==b){c=b.model;a=b.toolManager.findTool("Dragging");a=null!==a?a.dragOptions.dragsLink:b.Vm.dragsLink;e=new H;for(var f=new ob,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.Rl()){var k=h;h=g.key;var l=h.og();null!==l&&(l=
d.I(l),null!==l?(c.pe(k.data,c.va(l.data)),k=b.Jc(k.data),h=h.ih(),null!==h&&null!==k&&f.add(h,k)):c.pe(k.data,void 0))}}0<e.count&&b.Fs(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 ob;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.Ma();return d};
function Uq(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 pf&&f instanceof pf)for(b=b.memberParts;b.next();)g=Uq(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=Uq(a,b.value,c,d,e),null!==g&&g instanceof V&&(g.labeledLink=f);return f}
pi.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),za(d)&&(e.xf(d),c=b.Kc(d)))}else jg(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)),za(e)&&(c.data=e)));return c};
ma.Object.defineProperties(pi.prototype,{nodes:{get:function(){return this.Nn}},links:{get:function(){return this.Cn}},parts:{get:function(){return this.Pa}},diagram:{get:function(){return this.H}},addsToTemporaryLayer:{get:function(){return this.qp},set:function(a){this.qp=a}}});pi.prototype.updateAllRelationshipsFromData=pi.prototype.op;
pi.prototype.findLinksByExample=pi.prototype.hs;pi.prototype.findNodesByExample=pi.prototype.js;pi.prototype.findLinkForData=pi.prototype.Jc;pi.prototype.findNodeForData=pi.prototype.hi;pi.prototype.findPartForData=pi.prototype.Kc;pi.prototype.findNodeForKey=pi.prototype.Tb;pi.prototype.removeModeledPart=pi.prototype.fp;pi.prototype.removeModeledParts=pi.prototype.Ds;pi.prototype.rebuildParts=pi.prototype.Ud;var Oq=!1,Nq=!1,Pq=!1;pi.className="PartManager";
function Vq(a){pi.apply(this,arguments)}la(Vq,pi);Vq.prototype.addAllModeledParts=function(){var a=this.diagram.model;this.addModeledParts(a.nodeDataArray);Wq(this,a.linkDataArray)};Vq.prototype.addModeledParts=function(a){pi.prototype.addModeledParts.call(this,a,!1);for(a=this.links.iterator;a.next();)gp(a.value);fk(this.diagram,!1)};function Wq(a,b){b.forEach(function(b){Xq(a,b)});fk(a.diagram,!1)}
function Xq(a,b){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.af.contains(b)){var c=a.getLinkCategoryForData(b),d=a.findLinkTemplateForCategory(c);if(null!==d){jg(d);var e=d.copy();if(null!==e){d=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.Tf=c;e.wb=b;c=a.diagram.model;var f=Yq(c,b,!0);""!==f&&(e.fromPortId=f);f=Zq(c,b,!0);void 0!==f&&(f=a.Tb(f),f instanceof V&&(e.fromNode=f));f=Yq(c,b,!1);""!==f&&(e.toPortId=f);f=Zq(c,b,!1);void 0!==f&&(f=a.Tb(f),
f instanceof V&&(e.toNode=f));c=c.Ef(b);Array.isArray(c)&&c.forEach(function(b){b=a.Tb(b);null!==b&&(b.labeledLink=e)});a.qp&&(e.Hg="Tool");a.diagram.add(e);e.wb=null;e.data=b;a.diagram.skipsModelSourceBindings=d}}}}Vq.prototype.removeAllModeledParts=function(){var a=this.diagram.model;$q(this,a.linkDataArray);this.Ds(a.nodeDataArray)};function $q(a,b){b.forEach(function(b){a.fp(b)})}Vq.prototype.getLinkCategoryForData=function(a){return this.diagram.model.ms(a)};
Vq.prototype.setLinkCategoryForData=function(a,b){return this.diagram.model.ip(a,b)};Vq.prototype.setFromNodeForLink=function(a,b){var c=this.diagram.model;c.uv(a.data,c.va(null!==b?b.data:null))};Vq.prototype.setToNodeForLink=function(a,b){var c=this.diagram.model;c.zv(a.data,c.va(null!==b?b.data:null))};Vq.prototype.removeDataForLink=function(a){this.diagram.model.am(a.data)};
Vq.prototype.findPartForKey=function(a){var b=pi.prototype.findPartForKey.call(this,a);return null===b&&(a=this.diagram.model.hh(a),null!==a)?this.af.I(a):b};Vq.prototype.findLinkForKey=function(a){if(null===a||void 0===a)return null;a=this.diagram.model.hh(a);return null!==a?this.af.I(a):null};
Vq.prototype.doModelChanged=function(a){var b=this;pi.prototype.doModelChanged.call(this,a);if(this.diagram){var c=this.diagram;if(a.model===c.model){var d=a.change;if(c.aa){c.aa=!1;try{var e=a.modelChange;if(""!==e)if(d===ce){if("linkFromKey"===e){var f=this.Jc(a.object);if(null!==f){var g=this.Tb(a.newValue);f.fromNode=g}}else if("linkToKey"===e){var h=this.Jc(a.object);if(null!==h){var k=this.Tb(a.newValue);h.toNode=k}}else if("linkFromPortId"===e){var l=this.Jc(a.object);if(null!==l){var m=a.newValue;
"string"===typeof m&&(l.fromPortId=m)}}else if("linkToPortId"===e){var n=this.Jc(a.object);if(null!==n){var p=a.newValue;"string"===typeof p&&(n.toPortId=p)}}else if("nodeGroupKey"===e){var r=this.Kc(a.object);if(null!==r){var q=a.newValue;if(void 0!==q){var u=this.Tb(q);u instanceof pf?r.containingGroup=u:r.containingGroup=null}else r.containingGroup=null}}else if("linkLabelKeys"===e){var w=this.Jc(a.object);if(null!==w){var v=a.oldValue,y=a.newValue;Array.isArray(v)&&v.forEach(function(a){0<=y.indexOf(a)||
(a=b.Tb(a),null!==a&&(a.labeledLink=null))});Array.isArray(y)&&y.forEach(function(a){a=b.Tb(a);null!==a&&(a.labeledLink=w)})}}else if("linkCategory"===e){var z=this.Jc(a.object),A=a.newValue;null!==z&&"string"===typeof A&&(z.category=A)}else"linkDataArray"===e&&($q(this,a.oldValue),Wq(this,a.newValue));c.isModified=!0}else if(d===ee){var B=a.newValue;if("linkDataArray"===e&&"object"===typeof B&&null!==B)Xq(this,B);else if("linkLabelKeys"===e&&ar(B)){var D=this.Jc(a.object),M=this.Tb(B);null!==D&&
null!==M&&(M.labeledLink=D)}c.isModified=!0}else{if(d===fe){var S=a.oldValue;if("linkDataArray"===e&&"object"===typeof S&&null!==S)this.fp(S);else if("linkLabelKeys"===e&&ar(S)){var R=this.Tb(S);null!==R&&(R.labeledLink=null)}c.isModified=!0}}else if(d===ce){var I=a.propertyName;a.object!==c.model||"linkFromKeyProperty"!==I&&"linkToKeyProperty"!==I&&"linkFromPortIdProperty"!==I&&"linkToPortIdProperty"!==I&&"linkLabelKeysProperty"!==I&&"nodeIsGroupProperty"!==I&&"nodeGroupKeyProperty"!==I&&"linkCategoryProperty"!==
I||c.undoManager.isUndoingRedoing||this.Ud();c.isModified=!0}}finally{c.aa=!0}}}}};Vq.prototype.refreshDataBoundLinks=function(){var a=this,b=this.diagram.model,c=new H,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){br(b,a,!1)});d.forEach(function(c){null===a.Jc(c)&&cr(b,c,!1)})};
Vq.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=Zq(d,b,!0);e=c.Tb(e);a.fromNode=e;e=Zq(d,b,!1);e=c.Tb(e);a.toNode=e;b=d.Ef(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.va(f.data)===e)return}e=(new H).addAll(b);var g=new H;a.labelNodes.each(function(a){null!==a.data&&(a=d.va(a.data),void 0!==a&&g.add(a))});b=g.copy();b.ep(e);e=
e.copy();e.ep(g);if(0<b.count||0<e.count)b.each(function(b){b=c.Tb(b);null!==b&&b.labeledLink===a&&(b.labeledLink=null)}),e.each(function(b){b=c.Tb(b);null!==b&&b.labeledLink!==a&&(b.labeledLink=a)})}}else!(a instanceof te)&&(b=d.jh(b),b=c.findPartForKey(b),null===b||b instanceof pf)&&(a.containingGroup=b)}}};
Vq.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.va(a);if(void 0!==c){var d=dr(b,c),e=this.Kc(a);if(null!==d&&null!==e){d=d.iterator;for(var f={};d.next();){var g=d.value;b.mb(g)?e instanceof pf&&b.jh(g)===c&&(g=this.Kc(g),null!==g&&(g.containingGroup=e)):(f.link=this.Jc(g),null!==f.link&&e instanceof V&&(Zq(b,g,!0)===c&&(f.link.fromNode=e),Zq(b,g,!1)===c&&(f.link.toNode=e),g=b.Ef(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}}er(b,c)}a=b.jh(a);void 0!==a&&(a=this.Tb(a),a instanceof pf&&(e.containingGroup=a))}};Vq.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof V){var c=b.va(a.data);if(void 0!==c){for(var d=a.linksConnected;d.next();)fr(b,c,d.value.data);a.isLinkLabel&&(d=a.labeledLink,null!==d&&fr(b,c,d.data));if(a instanceof pf)for(a=a.memberParts;a.next();)d=a.value.data,b.mb(d)&&fr(b,c,d)}}};
Vq.prototype.copyPartData=function(a,b){var c=pi.prototype.copyPartData.call(this,a,b);if(a instanceof T)if(a=a.data,null!==a&&null!==b){var d=b.model;a=d.Io(a);"object"===typeof a&&null!==a&&(d.ei(a),c=b.Jc(a))}else null!==c&&(b=this.diagram,null!==a&&null!==b&&null!==b.commandHandler&&b.commandHandler.copiesClipboardData&&(b=b.model.Io(a),"object"===typeof b&&null!==b&&(c.data=b)));return c};
Vq.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(jg(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&&(jg(a),a=a.copy(),null!==a&&(a.labeledLink=f,e.add(a))),f}else if(null!==d&&(d=f.Io(d),"object"===
typeof d&&null!==d))return null!==a&&gr(f,d,f.va(a.data),!0),hr(f,d,h,!0),null!==c&&gr(f,d,f.va(c.data),!1),hr(f,d,b,!1),f.ei(d),a=g.archetypeLabelNodeData,null===a||a instanceof V||(a=f.copyNodeData(a),"object"===typeof a&&null!==a&&(f.xf(a),a=f.va(a),void 0!==a&&f.Au(d,a))),e.Jc(d);return null};Vq.prototype.findLinkForKey=Vq.prototype.findLinkForKey;Vq.prototype.findPartForKey=Vq.prototype.findPartForKey;Vq.prototype.removeAllModeledParts=Vq.prototype.removeAllModeledParts;
Vq.prototype.addModeledParts=Vq.prototype.addModeledParts;Vq.prototype.addAllModeledParts=Vq.prototype.addAllModeledParts;Vq.className="GraphLinksPartManager";function ir(){pi.apply(this,arguments);this.Qg=null}la(ir,pi);
function jr(a,b,c){if(null!==b&&null!==c&&null===c.ih()){var d=a.diagram.toolManager.findTool("Linking"),e=b,f=c;a.diagram.isTreePathToChildren||(e=c,f=b);if(null===d||!Ff(d,e,f,null,!0))if(b=a.getLinkCategoryForData(c.data),d=a.findLinkTemplateForCategory(b),null!==d&&(jg(d),d=d.copy(),null!==d)){var g=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;d.Tf=b;d.wb=c.data;d.fromNode=e;d.toNode=f;a.diagram.add(d);d.wb=null;d.data=c.data;a.diagram.skipsModelSourceBindings=g}}}
ir.prototype.getLinkCategoryForData=function(a){return this.diagram.model.ps(a)};ir.prototype.setLinkCategoryForData=function(a,b){this.diagram.model.Js(a,b)};ir.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.pe(a.data,d.va(b));else{var e=this.Qg;this.Qg=a;null!==c&&d.pe(c.data,void 0);d.pe(b,d.va(null!==a.toNode?a.toNode.data:null));this.Qg=e}};
ir.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.Qg;this.Qg=a;null!==c&&d.pe(c.data,void 0);d.pe(b,d.va(null!==a.fromNode?a.fromNode.data:null));this.Qg=e}else d.pe(a.data,d.va(b))};ir.prototype.removeDataForLink=function(a){this.diagram.model.pe(a.data,void 0)};
ir.prototype.findLinkForKey=function(a){if(null===a||void 0===a)return null;a=this.diagram.model.fc(a);return null!==a?this.af.I(a):null};
ir.prototype.doModelChanged=function(a){pi.prototype.doModelChanged.call(this,a);if(this.diagram){var b=this.diagram;if(a.model===b.model){var c=a.change;if(b.aa){b.aa=!1;try{var d=a.modelChange;if(""!==d){if(c===ce){if("nodeParentKey"===d){var e=a.object,f=this.Tb(a.newValue),g=this.hi(e);if(null!==this.Qg)null!==f&&(this.Qg.data=e,this.Qg.category=this.getLinkCategoryForData(e));else if(null!==g){var h=g.ih();null!==h?null===f?b.remove(h):b.isTreePathToChildren?h.fromNode=f:h.toNode=f:jr(this,f,
g)}}else if("parentLinkCategory"===d){var k=this.hi(a.object),l=a.newValue;if(null!==k&&"string"===typeof l){var m=k.ih();null!==m&&(m.category=l)}}b.isModified=!0}}else if(c===ce){var n=a.propertyName;a.object===b.model&&"nodeParentKeyProperty"===n&&(b.undoManager.isUndoingRedoing||this.Ud());b.isModified=!0}}finally{b.aa=!0}}}}};
ir.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.kh(b),b=c.Tb(b),d=a.og(),b!==d&&(d=a.ih(),null!==b?null!==d?c.isTreePathToChildren?d.fromNode=b:d.toNode=b:jr(this,b,a):null!==d&&Nj(c,d,!1)))}}};ir.prototype.updateDataBindings=function(a,b){pi.prototype.updateDataBindings.call(this,a,b);"string"===typeof b&&null!==this.Kc(a)&&(a=this.Jc(a),null!==a&&a.Ma(b))};
ir.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.va(a);if(void 0!==c){var d=dr(b,c),e=this.Kc(a);if(null!==d&&null!==e){for(d=d.iterator;d.next();){var f=d.value;b.mb(f)&&e instanceof V&&b.kh(f)===c&&jr(this,e,this.hi(f))}er(b,c)}a=b.kh(a);void 0!==a&&e instanceof V&&(a=this.Tb(a),jr(this,a,e))}};
ir.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof V){var c=b.va(a.data),d=this.Jc(a.data);if(null!==d){d.isSelected=!1;d.isHighlighted=!1;var e=d.layer;if(null!==e){var f=e.oc(-1,d,!1);0<=f&&this.diagram.cb(fe,"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.mb(e)&&fr(b,c,e)}};
ir.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.pe(e.data,b.va(d.data)),e.ih()):null};ir.prototype.findLinkForKey=ir.prototype.findLinkForKey;ir.className="TreePartManager";
function Z(a,b){this.il=new H;this.gl=new H;this.Uv=',\n "insertedNodeKeys": ';this.ly=',\n "modifiedNodeData": ';this.Wv=',\n "removedNodeKeys": ';this.th=null;Qa(this);this.Rm=this.wa="";this.Fg=!1;this.j={};this.Rc=[];this.lb=new ob;this.Sh="key";this.zk=this.$k=null;this.Im=this.Jm=!1;this.Lm=!0;this.wm=null;this.lj="category";this.Vf=new ob;this.It=new F;this.Ug=!1;this.m=null;this.undoManager=new he;void 0!==a&&(Aa(a)?this.nodeDataArray=a:b=a);b&&(Object.assign(this,b),a=b.Changed)&&(delete this.Changed,
this.Oe(a))}Z.prototype.cloneProtected=function(a){a.wa=this.wa;a.Rm=this.Rm;a.Fg=this.Fg;a.Sh=this.Sh;a.$k=this.$k;a.zk=this.zk;a.Jm=this.Jm;a.Im=this.Im;a.Lm=this.Lm;a.wm=this.wm;a.lj=this.lj};Z.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};Z.prototype.clear=function(){this.Rc=[];this.lb.clear();this.Vf.clear();this.undoManager.clear()};
Z.prototype.toString=function(a){void 0===a&&(a=0);if(1<a)return this.kp();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.va(e)+":"+Ia(e)}}return b};
Z.prototype.wA=function(a){a.change!==de&&C("Model.toIncrementalData argument is not a Transaction ChangedEvent:"+a.toString());var b=a.object;if(!(a.isTransactionFinished&&b instanceof ge))return null;kr(this,b);a=this.Ov(b,"FinishedUndo"===a.propertyName);this.th=null;return a};
Z.prototype.Ov=function(a,b){var c=this,d=!1,e=new H,f=new H,g=new H,h=this.th;a.changes.each(function(a){a.model===c&&("nodeDataArray"===a.modelChange?a.change===ee?e.add(a.newValue):a.change===fe&&g.add(a.oldValue):c.mb(a.object)?f.add(a.object):a.change!==ce||c.modelData!==a.object&&"modelData"!==a.propertyName?null!==a.object&&(h&&h.contains(a.object)?h.get(a.object).each(function(a){c.mb(a)&&f.add(a)}):a.object instanceof Z||c.pi()&&c.Ic(a.object)||lr(c,a.object).each(function(a){f.add(a)})):
d=!0)});var k=this.gl;k.clear();e.each(function(a){k.add(c.va(a));b||f.add(a)});var l=this.il;l.clear();g.each(function(a){l.add(c.va(a));b&&f.add(a)});a=c.cloneDeep(f.Fa());var m=null;d&&(null===m&&(m={}),m.modelData=this.cloneDeep(this.modelData));0<k.count&&(null===m&&(m={}),b?m.removedNodeKeys=k.Fa():m.insertedNodeKeys=k.Fa());0<a.length&&(null===m&&(m={}),m.modifiedNodeData=a);0<l.count&&(null===m&&(m={}),b?m.insertedNodeKeys=l.Fa():m.removedNodeKeys=l.Fa());l.clear();k.clear();return m};
Z.prototype.cloneDeep=function(a){return mr(this,a,!0)};
function mr(a,b,c,d,e,f){function g(a,c){h?(void 0===a.__gohashid&&f.push(a),d.set(a,c)):(a=jb++,d.set(a,c),e.set(a,b))}if(!za(b))return b;f||(f=[]);var h=Object.isExtensible(b);d||(d=new ob);if(h){var k=d.get(b);if(k)return k}else for(e||(e=new ob),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(mr(a,b[m],!1,d,e,f))}else if(b instanceof J||b instanceof L||b instanceof N||b instanceof hc||b instanceof O)k=
b.copy(),g(b,k);else{if(b instanceof ql||b instanceof P||b instanceof E)return b;if(b instanceof F)k=(new F).addAll(mr(a,b.Fa(),!1,d,e,f)),g(b,k);else if(b instanceof H)k=(new H).addAll(mr(a,b.Fa(),!1,d,e,f)),g(b,k);else if(b instanceof ob)k=(new ob).addAll(mr(a,b.Fa(),!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]=mr(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(/[\u007F-\uFFFF]/g,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).substr(-4)})};
t.qm=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.cp=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 nr(a,b){b=b.modelData;za(b)&&(a.cm(b),a.modelData=b)}
t.Pv=function(){var a=this.modelData,b=!1,c;for(c in a)if(!or(c,a[c])){b=!0;break}a="";b&&(a=',\n "modelData": '+pr(this,this.modelData));return a+',\n "nodeDataArray": '+qr(this,this.nodeDataArray,!0)};t.kv=function(a){nr(this,a);a=a.nodeDataArray;Aa(a)&&(this.cm(a),this.nodeDataArray=a)};
function kr(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 H,c.add(b),d.add(a,c)):c.add(b)}}var d=a.th;null===d&&(d=new ob,b.changes.each(function(a){if(null!==a.diagram){var b=a.change;if(b===ce)(a=a.object.panel)&&(b=a.data)&&c(b,a);else if(b===ee||b===fe)a=a.object,(b=a.itemArray)&&c(b,a)}}),a.th=d)}function lr(a,b){for(var c=new H,d=0;d<a.nodeDataArray.length;d++){var e=a.nodeDataArray[d];rr(a,b,e,e,c)}return c}
function rr(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(rr(a,b,g,d,e))return!0}else if(za(c)&&Object.getPrototypeOf(c)===Object.prototype)for(f in c){g=c[f];if(g===b)return e.add(d),!0;if(rr(a,b,g,d,e))return!0}return!1}
t.Nv=function(a,b){var c=this,d=!1,e=new H,f=new H,g=new H,h=this.th;a.changes.each(function(a){a.model===c&&("nodeDataArray"===a.modelChange?a.change===ee?e.add(a.newValue):a.change===fe&&g.add(a.oldValue):c.mb(a.object)?f.add(a.object):a.change!==ce||c.modelData!==a.object&&"modelData"!==a.propertyName?null!==a.object&&(h&&h.contains(a.object)?h.get(a.object).each(function(a){c.mb(a)&&f.add(a)}):a.object instanceof Z||c.pi()&&c.Ic(a.object)||lr(c,a.object).each(function(a){f.add(a)})):d=!0)});var k=
this.gl;k.clear();e.each(function(a){k.add(c.va(a));b||f.add(a)});var l=this.il;l.clear();g.each(function(a){l.add(c.va(a));b&&f.add(a)});a="";d&&(a+=',\n "modelData": '+pr(this,this.modelData));0<k.count&&(a+=(b?this.Wv:this.Uv)+qr(this,k.Fa(),!0));0<f.count&&(a+=this.ly+qr(this,f.Fa(),!0));0<l.count&&(a+=(b?this.Uv:this.Wv)+qr(this,l.Fa(),!0));l.clear();k.clear();return a};
t.bp=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");nr(this,a);var b=a.insertedNodeKeys,c=a.modifiedNodeData,d=new ob;if(Array.isArray(c))for(var e=0;e<c.length;e++){var f=c[e],g=this.va(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.fc(g);null===h&&(h=(h=d.get(g))?h:this.copyNodeData({}),this.jm(h,g),this.xf(h))}if(Array.isArray(c))for(b=c.length,d=0;d<b;d++)if(e=c[d],f=this.va(e),f=this.fc(f),null!==f){for(var k in e)"__gohashid"===k||
k===this.nodeKeyProperty||this.Vj()&&k===this.nodeIsGroupProperty||this.setDataProperty(f,k,e[k]);this.km(e,f)}a=a.removedNodeKeys;if(Array.isArray(a))for(c=a.length,k=0;k<c;k++)b=this.fc(a[k]),null!==b&&this.bm(b)};
t.by=function(a,b){a.change!==de&&C("Model.toIncrementalJson argument is not a Transaction ChangedEvent:"+a.toString());var c=a.object;if(!(a.isTransactionFinished&&c instanceof ge))return'{ "incremental": 0 }';void 0===b&&(b=sr(this,this));kr(this,c);a=this.Nv(c,"FinishedUndo"===a.propertyName);this.th=null;return"2"===b?'{ "incremental": 2'+a+"}":'{ "class": '+this.quote(b)+', "incremental": 1'+this.qm()+a+"}"};t.xA=function(a,b){return this.by(a,b)};
t.kp=function(a){void 0===a&&(a=sr(this,this));return'{ "class": '+this.quote(a)+this.qm()+this.Pv()+"}"};t.toJSON=function(a){return this.kp(a)};t.Xw=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.Ea("applyIncrementalJson"),this.bp(b),this.eb("applyIncrementalJson"))};t.My=function(a){return this.Xw(a)};
Z.constructGraphLinksModel=function(){return new Z};t=Z.prototype;
t.cm=function(a){if(Aa(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];if(za(d)){var e=c;d=this.cm(d);Array.isArray(a)?a[e]=d:C("Cannot replace an object in an HTMLCollection or NodeList at "+e)}}else if(za(a)){for(b in a)if(c=a[b],za(c)&&(c=this.cm(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 F;for(d=0;d<c.length/2;d++)e.add(new J(c[2*d],c[2*d+1]));e.freeze();a[b]=e}}return tr(a)}return a};
t.rm=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.rm(a.valueOf()):Aa(a)?qr(this,a):za(a)?pr(this,a):"function"===typeof a?"null":a.toString()};
function qr(a,b,c){void 0===c&&(c=!1);var d=b.length;if(0>=d)return"[]";var e=new Sa;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.rm(g)))}c&&1<d&&e.add("\n");e.add("]");return e.toString()}function or(a,b){return void 0===b||"__gohashid"===a||"_"===a[0]||"function"===typeof b?!0:!1}function ur(a){return isNaN(a)?"NaN":Infinity===a?"9e9999":-Infinity===a?"-9e9999":a}
function pr(a,b){var c=b;if(c instanceof J)b={"class":"go.Point",x:ur(c.x),y:ur(c.y)};else if(c instanceof L)b={"class":"go.Size",width:ur(c.width),height:ur(c.height)};else if(c instanceof N)b={"class":"go.Rect",x:ur(c.x),y:ur(c.y),width:ur(c.width),height:ur(c.height)};else if(c instanceof hc)b={"class":"go.Margin",top:ur(c.top),right:ur(c.right),bottom:ur(c.bottom),left:ur(c.left)};else if(c instanceof O)c.vb()?b={"class":"go.Spot",x:ur(c.x),y:ur(c.y),offsetX:ur(c.offsetX),offsetY:ur(c.offsetY)}:
b={"class":"go.Spot","enum":c.toString()};else if(c instanceof ql){b={"class":"go.Brush",type:c.type.name};if(c.type===El)b.color=c.color;else if(c.type===Hl||c.type===rl)b.start=c.start,b.end=c.end,c.type===rl&&(0!==c.startRadius&&(b.startRadius=ur(c.startRadius)),isNaN(c.endRadius)||(b.endRadius=ur(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 P?(b={"class":"go.Geometry",type:c.type.name},0!==c.startX&&(b.startX=
ur(c.startX)),0!==c.startY&&(b.startY=ur(c.startY)),0!==c.endX&&(b.endX=ur(c.endX)),0!==c.endY&&(b.endY=ur(c.endY)),c.spot1.C(sc)||(b.spot1=c.spot1),c.spot2.C(Bc)||(b.spot2=c.spot2),c.type===P.m&&(b.path=P.ga(c))):c instanceof E&&(b={"class":"go.EnumValue",classType:sr(a,c.classType),name:c.name});d="{";c=!0;for(var e in b){var f=Cn(b,e);if(!or(e,f))if(c?c=!1:d+=",",d+=a.quote(e)+":","points"===e&&f instanceof F){var g="[";for(f=f.iterator;f.next();){var h=f.value;1<g.length&&(g+=",");g+=a.rm(h.x);
g+=",";g+=a.rm(h.y)}g+="]";d+=g}else d+=a.rm(f)}return d+"}"}function vr(a){return"number"===typeof a?a:"NaN"===a?NaN:"9e9999"===a?Infinity:"-9e9999"===a?-Infinity:parseFloat(a)}
function tr(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 J(vr(a.x),vr(a.y));else if("Size"===b)c=new L(vr(a.width),vr(a.height));else if("Rect"===b)c=new N(vr(a.x),vr(a.y),vr(a.width),vr(a.height));else if("Margin"===b)c=new hc(vr(a.top),vr(a.right),vr(a.bottom),vr(a.left));else if("Spot"===b)"string"===typeof a["enum"]?c=id(a["enum"]):c=new O(vr(a.x),
vr(a.y),vr(a.offsetX),vr(a.offsetY));else if("Brush"===b){if(c=new ql,c.type=Ra(ql,a.type),"string"===typeof a.color&&(c.color=a.color),a.start instanceof O&&(c.start=a.start),a.end instanceof O&&(c.end=a.end),"number"===typeof a.startRadius&&(c.startRadius=vr(a.startRadius)),"number"===typeof a.endRadius&&(c.endRadius=vr(a.endRadius)),a=a.colorStops,za(a))for(var d in a)c.addColorStop(parseFloat(d),a[d])}else"Geometry"===b?(c=null,"string"===typeof a.path?c=P.parse(a.path):c=new P,c.type=Ra(P,a.type),
"number"===typeof a.startX&&(c.startX=vr(a.startX)),"number"===typeof a.startY&&(c.startY=vr(a.startY)),"number"===typeof a.endX&&(c.endX=vr(a.endX)),"number"===typeof a.endY&&(c.endY=vr(a.endY)),a.spot1 instanceof O&&(c.spot1=a.spot1),a.spot2 instanceof O&&(c.spot2=a.spot2)):"EnumValue"===b&&(d=a.classType,0===d.indexOf("go.")&&(d=d.substr(3)),d=wr(d),"function"===typeof d&&(c=Ra(d,a.name)));return c}t.Oe=function(a){this.It.add(a);return this};t.gk=function(a){this.It.remove(a)};
t.Zr=function(a){this.skipsUndoManager||this.undoManager.Tu(a);for(var b=this.It,c=b.length,d=0;d<c;d++)b.L(d)(a)};t.cb=function(a,b,c,d,e,f,g){xr(this,"",a,b,c,d,e,f,g)};t.g=function(a,b,c,d,e){xr(this,"",ce,a,this,b,c,d,e)};t.Cs=function(a,b,c,d,e,f){xr(this,"",ce,b,a,c,d,e,f)};function xr(a,b,c,d,e,f,g,h,k){void 0===h&&(h=null);void 0===k&&(k=null);var l=new be;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.Zr(l)}
Z.prototype.changeState=function(a,b){if(null!==a&&a.model===this)if(a.change===ce){var c=a.object,d=a.propertyName,e=a.I(b);d===this.nodeKeyProperty&&this.mb(c)&&(b=a.I(!b),void 0!==b&&this.lb.remove(b),void 0!==e&&this.lb.add(e,c));Uj(c,d,e)}else a.change===ee?(c=a.newParam,"nodeDataArray"===a.modelChange?(a=a.newValue,za(a)&&"number"===typeof c&&(d=this.va(a),b?(this.Rc[c]===a&&Da(this.Rc,c),void 0!==d&&this.lb.remove(d)):(this.Rc[c]!==a&&Ca(this.Rc,c,a),void 0!==d&&this.lb.add(d,a)))):""===a.modelChange?
((d=a.object)&&!Aa(d)&&a.propertyName&&(d=Cn(a.object,a.propertyName)),Aa(d)&&"number"===typeof c&&(a=a.newValue,b?Da(d,c):Ca(d,c,a))):C("unknown ChangedEvent.Insert modelChange: "+a.toString())):a.change===fe?(c=a.oldParam,"nodeDataArray"===a.modelChange?(a=a.oldValue,za(a)&&"number"===typeof c&&(d=this.va(a),b?(this.Rc[c]!==a&&Ca(this.Rc,c,a),void 0!==d&&this.lb.add(d,a)):(this.Rc[c]===a&&Da(this.Rc,c),void 0!==d&&this.lb.remove(d)))):""===a.modelChange?((d=a.object)&&!Aa(d)&&a.propertyName&&(d=
Cn(a.object,a.propertyName)),Aa(d)&&"number"===typeof c&&(a=a.oldValue,b?Ca(d,c,a):Da(d,c))):C("unknown ChangedEvent.Remove modelChange: "+a.toString())):a.change!==de&&C("unknown ChangedEvent: "+a.toString())};Z.prototype.Ea=function(a){return this.undoManager.Ea(a)};Z.prototype.eb=function(a){return this.undoManager.eb(a)};Z.prototype.Kf=function(){return this.undoManager.Kf()};
Z.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.Ea(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.eb(b):this.undoManager.Kf(),this.skipsUndoManager=c}};t=Z.prototype;t.Ma=function(a,b){void 0===b&&(b="");xr(this,"SourceChanged",de,b,a,null,null)};
t.va=function(a){if(null!==a){var b=this.Sh;if(""!==b&&(b=Cn(a,b),void 0!==b)){if(ar(b))return b;C("Key value for node data "+a+" is not a number or a string: "+b)}}};t.jm=function(a,b){if(null!==a){var c=this.Sh;if(""!==c)if(this.mb(a)){var d=Cn(a,c);d!==b&&null===this.fc(b)&&(Uj(a,c,b),void 0!==d&&this.lb.remove(d),this.lb.add(b,a),xr(this,"nodeKey",ce,c,a,d,b),"string"===typeof c&&this.Ma(a,c),this.gp(d,b))}else Uj(a,c,b)}};function ar(a){return"number"===typeof a||"string"===typeof a}
t.mb=function(a){var b=this.va(a);return void 0===b?!1:this.lb.I(b)===a};t.fc=function(a){null===a&&C("Model.findNodeDataForKey:key must not be null");return void 0!==a&&ar(a)?this.lb.I(a):null};
t.$u=function(a){if(null!==a){var b=this.Sh;if(""!==b){var c=this.va(a);if(void 0===c||this.lb.contains(c)){var d=this.$k;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.lb.contains(c))){Uj(a,b,c);return}if("string"===typeof c){for(d=2;this.lb.contains(c+d);)d++;Uj(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.lb.count-1;this.lb.contains(c);)c--;Uj(a,b,c)}}}}};t.xf=function(a){null!==a&&(fb(a),this.mb(a)||Tq(this,a,!0))};
function Tq(a,b,c){var d=a.va(b);if(void 0===d||a.lb.I(d)!==b)a.$u(b),d=a.va(b),void 0===d&&C("Model.makeNodeDataKeyUnique failed on "+b+". Data not added to Model."),a.lb.add(d,b),d=null,c&&(d=a.Rc.length,Ca(a.Rc,d,b)),xr(a,"nodeDataArray",ee,"nodeDataArray",a,null,b,null,d),a.em(b),a.dm(b)}t.Hy=function(a){if(Aa(a))for(var b=a.length,c=0;c<b;c++)this.xf(a[c]);else for(a=a.iterator;a.next();)this.xf(a.value)};t.bm=function(a){null!==a&&Sq(this,a,!0)};
function Sq(a,b,c){var d=a.va(b);void 0!==d&&a.lb.remove(d);d=null;if(c){a:if(c=a.Rc,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.Rc,d)}xr(a,"nodeDataArray",fe,"nodeDataArray",a,b,null,d,null);a.np(b)}t.mA=function(a){if(Aa(a))for(var b=a.length,c=0;c<b;c++)this.bm(a[c]);else for(a=a.iterator;a.next();)this.bm(a.value)};
t.$z=function(a){if(a!==this.nodeDataArray&&Aa(a)){var b=this.il;b.clear();b.addAll(this.lb.iteratorKeys);var c=this.gl;c.clear();for(var d=a.length,e=0;e<d;e++){var f=a[e],g=this.va(f);if(void 0!==g){c.add(g);var h=this.fc(g);h!==f&&(null!==h?(this.Co(h,f),this.km(f,h)):(f=this.cloneDeep(f),this.jm(f,g),this.xf(f)))}else g=this.cloneDeep(f),this.xf(g),c.add(this.va(g))}for(a=b.iterator;a.next();)d=a.value,c.contains(d)||(d=this.fc(d))&&this.bm(d);b.clear();c.clear()}};
t.gp=function(a,b){void 0!==b&&(a=dr(this,a),a instanceof H&&this.Vf.add(b,a))};t.Jv=function(){};t.em=function(){};t.dm=function(){};t.np=function(){};function fr(a,b,c){if(void 0!==b){var d=a.Vf.I(b);null===d&&(d=new H,a.Vf.add(b,d));d.add(c)}}function er(a,b,c){if(void 0!==b){var d=a.Vf.I(b);d instanceof H&&(void 0===c||null===c?a.Vf.remove(b):(d.remove(c),0===d.count&&a.Vf.remove(b)))}}function dr(a,b){if(void 0===b)return null;a=a.Vf.I(b);return a instanceof H?a:null}
t.Ry=function(a){void 0===a?this.Vf.clear():this.Vf.remove(a)};Z.prototype.copyNodeData=function(a){if(null===a)return null;var b=this.zk;a=null!==b?b(a,this):yr(this,a,!0);za(a)&&Qa(a);return a};
function yr(a,b,c){if(a.copiesArrays&&Array.isArray(b)){var d=[];for(c=0;c<b.length;c++){var e=yr(a,b[c],a.copiesArrayObjects);d.push(e)}Qa(d);return d}if(c&&za(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=Cn(b,d),g=sr(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 he||f instanceof ge||f instanceof be?Uj(c,d,f):(f=yr(a,f,!1),Uj(c,d,f))}Qa(c);return c}return b instanceof J?b.copy():b instanceof L?b.copy():b instanceof N?b.copy():b instanceof O?b.copy():b instanceof hc?b.copy():b}
Z.prototype.setDataProperty=function(a,b,c){if(this.mb(a)){if(b===this.nodeKeyProperty){this.jm(a,c);return}if(b===this.nodeCategoryProperty){this.im(a,c);return}}else!zr&&a instanceof Y&&(zr=!0,ya('Model.setDataProperty is modifying a GraphObject, "'+a.toString()+'"'),ya(" Is that really your intent?"));var d=Cn(a,b);d!==c&&(Uj(a,b,c),this.Cs(a,b,d,c))};t=Z.prototype;t.set=function(a,b,c){this.setDataProperty(a,b,c)};
t.Co=function(a,b){if(b){var c=this.mb(a),d;for(d in b)"__gohashid"===d||c&&d===this.nodeKeyProperty||this.setDataProperty(a,d,b[d])}};t.Cy=function(a,b){this.qs(a,-1,b)};t.qs=function(a,b,c){0>b&&(b=a.length);Ca(a,b,c);xr(this,"",ee,"",a,null,c,null,b)};t.ov=function(a,b){void 0===b&&(b=-1);a===this.Rc&&C("Model.removeArrayItem should not be called on the Model.nodeDataArray");-1===b&&(b=a.length-1);var c=a[b];Da(a,b);xr(this,"",fe,"",a,c,null,b,null)};
t.Oo=function(a){if(null===a)return"";var b=this.lj;if(""===b)return"";b=Cn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;C("getCategoryForNodeData found a non-string category for "+a+": "+b)};t.im=function(a,b){if(null!==a){var c=this.lj;if(""!==c)if(this.mb(a)){var d=Cn(a,c);void 0===d&&(d="");d!==b&&(Uj(a,c,b),xr(this,"nodeCategory",ce,c,a,d,b))}else Uj(a,c,b)}};t.km=function(a,b){this.im(b,this.Oo(a))};t.Rl=function(){return!1};t.Vj=function(){return!1};t.pi=function(){return!1};
t.us=function(){return!1};t.Wj=function(){return!1};function ri(){return new Z}function sr(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 sr(a,b.constructor);return typeof b}function wr(a){return Ar[a]?Ar[a]:void 0!==x.go&&x.go[a]?x.go[a]:null}
function Cn(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 Uj(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.wa},set:function(a){var b=this.wa;b!==a&&(this.wa=a,this.g("name",b,a))}},dataFormat:{get:function(){return this.Rm},set:function(a){var b=this.Rm;b!==a&&(this.Rm=a,this.g("dataFormat",b,a))}},isReadOnly:{get:function(){return this.Fg},set:function(a){var b=this.Fg;b!==a&&(this.Fg=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.Ma(a))}},undoManager:{get:function(){return this.m},set:function(a){var b=this.m;b!==a&&(null!==b&&b.Tx(this),this.m=a,null!==a&&a.Vw(this))}},skipsUndoManager:{get:function(){return this.Ug},set:function(a){this.Ug=a}},nodeKeyProperty:{get:function(){return this.Sh},set:function(a){var b=this.Sh;
b!==a&&(""===a&&C("Model.nodeKeyProperty may not be the empty string"),0<this.lb.count&&C("Cannot set Model.nodeKeyProperty when there is existing node data"),this.Sh=a,this.g("nodeKeyProperty",b,a))}},makeUniqueKeyFunction:{get:function(){return this.$k},set:function(a){var b=this.$k;b!==a&&(this.$k=a,this.g("makeUniqueKeyFunction",b,a))}},nodeDataArray:{get:function(){return this.Rc},set:function(a){var b=this.Rc;if(b!==a){this.lb.clear();
this.Jv();for(var c=a.length,d=0;d<c;d++){var e=a[d];za(e)||C("Model.nodeDataArray must only contain Objects, not: "+e);fb(e)}this.Rc=a;d=new F;for(e=0;e<c;e++){var f=a[e],g=this.va(f);void 0===g?d.add(f):null!==this.lb.I(g)?d.add(f):this.lb.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.$u(e),f=this.va(e),void 0!==f&&this.lb.add(f,e);xr(this,"nodeDataArray",ce,"nodeDataArray",this,b,a);for(b=0;b<c;b++)d=a[b],this.em(d),this.dm(d);Array.isArray(a)||(this.isReadOnly=!0)}}},copyNodeDataFunction:{
get:function(){return this.zk},set:function(a){var b=this.zk;b!==a&&(this.zk=a,this.g("copyNodeDataFunction",b,a))}},copiesArrays:{get:function(){return this.Jm},set:function(a){var b=this.Jm;b!==a&&(this.Jm=a,this.g("copiesArrays",b,a))}},copiesArrayObjects:{get:function(){return this.Im},set:function(a){var b=this.Im;b!==a&&(this.Im=a,this.g("copiesArrayObjects",b,a))}},copiesKey:{get:function(){return this.Lm},
set:function(a){var b=this.Lm;b!==a&&(this.Lm=a,this.g("copiesKey",b,a))}},afterCopyFunction:{get:function(){return this.wm},set:function(a){var b=this.wm;b!==a&&(this.wm=a,this.g("afterCopyFunction",b,a))}},nodeCategoryProperty:{get:function(){return this.lj},set:function(a){var b=this.lj;b!==a&&(this.lj=a,this.g("nodeCategoryProperty",b,a))}},type:{get:function(){return"Model"}}});
Z.prototype.setCategoryForNodeData=Z.prototype.im;Z.prototype.getCategoryForNodeData=Z.prototype.Oo;Z.prototype.removeArrayItem=Z.prototype.ov;Z.prototype.insertArrayItem=Z.prototype.qs;Z.prototype.addArrayItem=Z.prototype.Cy;Z.prototype.assignAllDataProperties=Z.prototype.Co;Z.prototype.set=Z.prototype.set;Z.prototype.clearUnresolvedReferences=Z.prototype.Ry;Z.prototype.mergeNodeDataArray=Z.prototype.$z;Z.prototype.removeNodeDataCollection=Z.prototype.mA;Z.prototype.removeNodeData=Z.prototype.bm;
Z.prototype.addNodeDataCollection=Z.prototype.Hy;Z.prototype.addNodeData=Z.prototype.xf;Z.prototype.makeNodeDataKeyUnique=Z.prototype.$u;Z.prototype.findNodeDataForKey=Z.prototype.fc;Z.prototype.containsNodeData=Z.prototype.mb;Z.prototype.setKeyForNodeData=Z.prototype.jm;Z.prototype.getKeyForNodeData=Z.prototype.va;Z.prototype.updateTargetBindings=Z.prototype.Ma;Z.prototype.commit=Z.prototype.commit;Z.prototype.rollbackTransaction=Z.prototype.Kf;Z.prototype.commitTransaction=Z.prototype.eb;
Z.prototype.startTransaction=Z.prototype.Ea;Z.prototype.raiseDataChanged=Z.prototype.Cs;Z.prototype.raiseChanged=Z.prototype.g;Z.prototype.raiseChangedEvent=Z.prototype.cb;Z.prototype.removeChangedListener=Z.prototype.gk;Z.prototype.addChangedListener=Z.prototype.Oe;Z.prototype.writeJsonValue=Z.prototype.rm;Z.prototype.replaceJsonObjects=Z.prototype.cm;Z.prototype.applyIncrementalJSON=Z.prototype.My;Z.prototype.applyIncrementalJson=Z.prototype.Xw;Z.prototype.toJSON=Z.prototype.toJSON;
Z.prototype.toJson=Z.prototype.kp;Z.prototype.toIncrementalJSON=Z.prototype.xA;Z.prototype.toIncrementalJson=Z.prototype.by;Z.prototype.toIncrementalData=Z.prototype.wA;Z.prototype.clear=Z.prototype.clear;var zr=!1,Ar={};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=wr(d)):(e=wr(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.cp(c);b.kv(c);return b};Z.safePropertyValue=Cn;Z.safePropertySet=Uj;Ar.Brush=ql;Ar.ChangedEvent=be;Ar.Geometry=P;Ar.Margin=hc;Ar.Panel=W;Ar.Point=J;Ar.Rect=N;Ar.Size=L;Ar.Spot=O;Ar.Transaction=ge;Ar.UndoManager=he;function Hi(a,b,c,d){Qa(this);this._isFrozen=!1;void 0===a&&(a="");void 0===b&&(b=a);void 0===c&&(c=null);this.j=-1;this.vd=null;this.vl=a;this.ul=this.so=0;this.yr=null;this.vn=!1;this.ql=b;this.Hm=c;void 0===d?(this.cl=Br,this.uk=null):(this.cl=vn,this.uk=d);this.pt=new H}
Hi.prototype.copy=function(){var a=new Hi;a.vl=this.vl;a.so=this.so;a.ul=this.ul;a.yr=this.yr;a.vn=this.vn;a.ql=this.ql;a.Hm=this.Hm;a.cl=this.cl;a.uk=this.uk;return a};t=Hi.prototype;t.rb=function(a){a.classType===Hi&&(this.mode=a)};t.toString=function(){return"Binding("+this.targetProperty+":"+this.sourceProperty+(-1!==this.zi?" "+this.zi:"")+" "+this.mode.name+")"};t.freeze=function(){this._isFrozen=!0;return this};t.ja=function(){this._isFrozen=!1;return this};
t.Lx=function(a){void 0===a&&(a=null);this.mode=vn;this.backConverter=a;return this};t.$o=function(a){void 0===a&&(a="");this.sourceName=a;this.isToModel=!1;return this};t.cA=function(){this.sourceName=null;this.isToModel=!0;return this};function hl(a,b,c){a=a.sourceName;return null===a||""===a?b:"/"===a?c.part:"."===a?c:".."===a?c.panel:b.fb(a)}
t.Kv=function(a,b,c){var d=this.ql;if(void 0===c||""===d||d===c){c=this.vl;var e=this.Hm;if(null===e&&""===c)ya("Binding error: target property is the empty string: "+this.toString());else{var f=b;""!==d&&(f=Cn(b,d));if(void 0!==f)if(null===e)""!==c&&Uj(a,c,f);else try{if(""!==c){var g=e(f,a);Uj(a,c,g)}else e(f,a)}catch(h){}}}};
t.pp=function(a,b,c,d){if(this.cl===vn){var e=this.vl;if(void 0===c||e===c){c=this.ql;var f=this.uk,g=a;""!==e&&(g=Cn(a,e));if(void 0!==g&&!this.pt.contains(a))try{this.pt.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):Uj(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.ov(m,l);k.qs(m,l,g)}}else try{if(""!==c){var n=f(g,b,k);null!==k?k.setDataProperty(b,
c,n):Uj(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.ov(q,r);k.qs(q,r,p)}}}catch(u){}}finally{this.pt.remove(a)}}}};
ma.Object.defineProperties(Hi.prototype,{zi:{get:function(){return this.j},set:function(a){this._isFrozen&&va(this);this.j=a}},targetProperty:{get:function(){return this.vl},set:function(a){this._isFrozen&&va(this);this.vl=a}},sourceName:{get:function(){return this.yr},set:function(a){this._isFrozen&&va(this);this.yr=a;null!==a&&(this.vn=!1)}},isToModel:{get:function(){return this.vn},
set:function(a){this._isFrozen&&va(this);this.vn=a}},sourceProperty:{get:function(){return this.ql},set:function(a){this._isFrozen&&va(this);this.ql=a}},converter:{get:function(){return this.Hm},set:function(a){this._isFrozen&&va(this);this.Hm=a}},backConverter:{get:function(){return this.uk},set:function(a){this._isFrozen&&va(this);this.uk=a}},mode:{get:function(){return this.cl},
set:function(a){this._isFrozen&&va(this);this.cl=a}}});Hi.prototype.updateSource=Hi.prototype.pp;Hi.prototype.updateTarget=Hi.prototype.Kv;Hi.prototype.ofModel=Hi.prototype.cA;Hi.prototype.ofObject=Hi.prototype.$o;Hi.prototype.makeTwoWay=Hi.prototype.Lx;var $i="Binding",Br=new E(Hi,"OneWay",1),vn=new E(Hi,"TwoWay",2);Hi.className="Binding";Hi.parseEnum=function(a,b){return function(c){c=Ra(a,c);return null===c?b:c}};Hi.toString=Ia;Hi.OneWay=Br;Hi.TwoWay=vn;
function Dr(a,b,c){Z.call(this);this.Tv=',\n "insertedLinkKeys": ';this.ky=',\n "modifiedLinkData": ';this.Vv=',\n "removedLinkKeys": ';this.gd=[];this.Zf=new H;this.yb=new ob;this.Ih="";this.Qi=this.yk=this.al=null;this.kf="from";this.lf="to";this.fj=this.ej="";this.dj="category";this.he="";this.hl="isGroup";this.Ie="group";this.Km=!1;void 0!==b&&(this.linkDataArray=b);void 0!==a&&(Aa(a)?this.nodeDataArray=a:c=a);c&&(Object.assign(this,c),a=c.Changed)&&(delete this.Changed,this.Oe(a))}la(Dr,Z);
Dr.constructGraphLinksModel=Z.constructGraphLinksModel;Dr.prototype.cloneProtected=function(a){Z.prototype.cloneProtected.call(this,a);a.Ih=this.Ih;a.al=this.al;a.yk=this.yk;a.kf=this.kf;a.lf=this.lf;a.ej=this.ej;a.fj=this.fj;a.dj=this.dj;a.he=this.he;a.hl=this.hl;a.Ie=this.Ie;a.Km=this.Km};t=Dr.prototype;t.clear=function(){Z.prototype.clear.call(this);this.gd=[];this.yb.clear();this.Zf.clear()};
t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.kp();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.va(e)+":"+Ia(e)}b+="\n link data:";a=this.linkDataArray;c=a.length;for(d=0;d<c;d++)e=a[d],b+=" "+Zq(this,e,!0)+"--\x3e"+Zq(this,e,!1)}return b};
t.Ov=function(a,b){""===this.linkKeyProperty&&C("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalData() to succeed.");var c=Z.prototype.Ov.call(this,a,b),d=this,e=new H,f=new H,g=new H,h=this.th;a.changes.each(function(a){a.model===d&&("linkDataArray"===a.modelChange?a.change===ee?e.add(a.newValue):a.change===fe&&g.add(a.oldValue):d.Ic(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.Ic(a)&&f.add(a)}):
a.object instanceof Z||d.mb(a.object)||Er(d,a.object).each(function(a){f.add(a)})))});var k=this.gl;k.clear();e.each(function(a){k.add(d.zc(a));b||f.add(a)});var l=this.il;l.clear();g.each(function(a){l.add(d.zc(a));b&&f.add(a)});a=d.cloneDeep(f.Fa());0<k.count&&(null===c&&(c={}),b?c.removedLinkKeys=k.Fa():c.insertedLinkKeys=k.Fa());0<a.length&&(null===c&&(c={}),c.modifiedLinkData=a);0<l.count&&(null===c&&(c={}),b?c.insertedLinkKeys=l.Fa():c.removedLinkKeys=l.Fa());l.clear();k.clear();return c};
t.qm=function(){var a=Z.prototype.qm.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.cp=function(a){Z.prototype.cp.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.Pv=function(){var a=Z.prototype.Pv.call(this),b=',\n "linkDataArray": '+qr(this,this.linkDataArray,!0);return a+b};t.kv=function(a){Z.prototype.kv.call(this,a);a=a.linkDataArray;Array.isArray(a)&&(this.cm(a),this.linkDataArray=a)};
function Er(a,b){for(var c=new H,d=0;d<a.linkDataArray.length;d++){var e=a.linkDataArray[d];rr(a,b,e,e,c)}return c}
t.Nv=function(a,b){""===this.linkKeyProperty&&C("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalJson() to succeed.");var c=Z.prototype.Nv.call(this,a,b),d=this,e=new H,f=new H,g=new H,h=this.th;a.changes.each(function(a){a.model===d&&("linkDataArray"===a.modelChange?a.change===ee?e.add(a.newValue):a.change===fe&&g.add(a.oldValue):d.Ic(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.Ic(a)&&f.add(a)}):
a.object instanceof Z||d.mb(a.object)||Er(d,a.object).each(function(a){f.add(a)})))});var k=this.gl;k.clear();e.each(function(a){k.add(d.zc(a));b||f.add(a)});var l=this.il;l.clear();g.each(function(a){l.add(d.zc(a));b&&f.add(a)});a=c;0<k.count&&(a+=(b?this.Vv:this.Tv)+qr(this,k.Fa(),!0));0<f.count&&(a+=this.ky+qr(this,f.Fa(),!0));0<l.count&&(a+=(b?this.Tv:this.Vv)+qr(this,l.Fa(),!0));l.clear();k.clear();return a};
t.bp=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.bp.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.hh(e);null===f&&(f=this.Io({}),this.Hs(f,e),this.ei(f))}b=a.modifiedLinkData;
if(Array.isArray(b))for(c=b.length,d=0;d<c;d++)if(e=b[d],f=this.zc(e),f=this.hh(f),null!==f){for(var g in e)"__gohashid"!==g&&g!==this.linkKeyProperty&&this.setDataProperty(f,g,e[g]);Fr(this,e,f)}a=a.removedLinkKeys;if(Array.isArray(a))for(g=a.length,b=0;b<g;b++)c=this.hh(a[b]),null!==c&&this.am(c)};
Dr.prototype.changeState=function(a,b){if(null!==a&&a.model===this){if(a.change===ce){var c=a.object,d=a.propertyName;if(d===this.linkKeyProperty&&this.Ic(c)){var e=a.I(b);b=a.I(!b);void 0!==b&&this.yb.remove(b);void 0!==e&&this.yb.add(e,c);Uj(c,d,e);return}}else if(a.change===ee){c=a.newParam;if("linkDataArray"===a.modelChange){a=a.newValue;za(a)&&"number"===typeof c&&(d=this.zc(a),b?(this.Zf.remove(a),this.gd[c]===a&&this.gd.splice(c,1),void 0!==d&&this.yb.remove(d)):(this.Zf.add(a),this.gd[c]!==
a&&this.gd.splice(c,0,a),void 0!==d&&this.yb.add(d,a)));return}if("linkLabelKeys"===a.modelChange){d=this.Ef(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===fe){c=a.oldParam;if("linkDataArray"===a.modelChange){a=a.oldValue;za(a)&&"number"===typeof c&&(d=this.zc(a),b?(this.Zf.add(a),this.gd[c]!==a&&this.gd.splice(c,0,a),void 0!==d&&this.yb.add(d,a)):(this.Zf.remove(a),this.gd[c]===
a&&this.gd.splice(c,1),void 0!==d&&this.yb.remove(d)));return}if("linkLabelKeys"===a.modelChange){d=this.Ef(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=Dr.prototype;t.Tl=function(a){if(void 0!==a){var b=this.Qi;if(null!==b){var c=this.fc(a);null===c&&(c=this.copyNodeData(b),Uj(c,this.nodeKeyProperty,a),this.xf(c))}return a}};
t.yx=function(a){return Zq(this,a,!0)};t.uv=function(a,b){gr(this,a,b,!0)};t.Bx=function(a){return Zq(this,a,!1)};t.zv=function(a,b){gr(this,a,b,!1)};function Zq(a,b,c){if(null!==b&&(a=c?a.kf:a.lf,""!==a&&(a=Cn(b,a),void 0!==a))){if(ar(a))return a;C((c?"FromKey":"ToKey")+" value for link data "+b+" is not a number or a string: "+a)}}
function gr(a,b,c,d){null===c&&(c=void 0);if(null!==b){var e=d?a.kf:a.lf;if(""!==e)if(c=a.Tl(c),a.Ic(b)){var f=Cn(b,e);f!==c&&(er(a,f,b),Uj(b,e,c),null===a.fc(c)&&fr(a,c,b),xr(a,d?"linkFromKey":"linkToKey",ce,e,b,f,c),"string"===typeof e&&a.Ma(b,e))}else Uj(b,e,c)}}t.zx=function(a){return Yq(this,a,!0)};t.vv=function(a,b){hr(this,a,b,!0)};t.Cx=function(a){return Yq(this,a,!1)};t.Av=function(a,b){hr(this,a,b,!1)};
function Yq(a,b,c){if(null===b)return"";a=c?a.ej:a.fj;if(""===a)return"";b=Cn(b,a);return void 0===b?"":b}function hr(a,b,c,d){if(null!==b){var e=d?a.ej:a.fj;if(""!==e)if(a.Ic(b)){var f=Cn(b,e);void 0===f&&(f="");f!==c&&(Uj(b,e,c),xr(a,d?"linkFromPortId":"linkToPortId",ce,e,b,f,c),"string"===typeof e&&a.Ma(b,e))}else Uj(b,e,c)}}t.Ef=function(a){if(null===a)return Gr;var b=this.he;if(""===b)return Gr;a=Cn(a,b);return void 0===a?Gr:a};
t.Is=function(a,b){if(null!==a){var c=this.he;if(""!==c)if(this.Ic(a)){var d=Cn(a,c);void 0===d&&(d=Gr);if(d!==b){if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)er(this,d[f],a);Uj(a,c,b);e=b.length;for(f=0;f<e;f++){var g=b[f];null===this.fc(g)&&fr(this,g,a)}xr(this,"linkLabelKeys",ce,c,a,d,b);"string"===typeof c&&this.Ma(a,c)}}else Uj(a,c,b)}};
t.Au=function(a,b){if(null!==b&&void 0!==b&&null!==a){var c=this.he;if(""!==c){var d=Cn(a,c);if(void 0===d)c=[],c.push(b),this.Is(a,c);else if(Array.isArray(d)){var e=d.indexOf(b);0<=e||(e=d.length,d.push(b),this.Ic(a)&&(null===this.fc(b)&&fr(this,b,a),xr(this,"linkLabelKeys",ee,c,a,null,b,null,e)))}else C(c+" property is not an Array; cannot addLabelKeyForLinkData: "+a)}}};
t.Sx=function(a,b){if(null!==b&&void 0!==b&&null!==a){var c=this.he;if(""!==c){var d=Cn(a,c);if(Array.isArray(d)){var e=d.indexOf(b);0>e||(d.splice(e,1),this.Ic(a)&&(er(this,b,a),xr(this,"linkLabelKeys",fe,c,a,b,null,e,null)))}else void 0!==d&&C(c+" property is not an Array; cannot removeLabelKeyforLinkData: "+a)}}};t.zc=function(a){if(null!==a){var b=this.Ih;if(""!==b&&(b=Cn(a,b),void 0!==b)){if(ar(b))return b;C("Key value for link data "+a+" is not a number or a string: "+b)}}};
t.Hs=function(a,b){if(null!==a){var c=this.Ih;if(""!==c)if(this.Ic(a)){var d=Cn(a,c);d!==b&&null===this.hh(b)&&(Uj(a,c,b),void 0!==d&&this.yb.remove(d),this.yb.add(b,a),xr(this,"linkKey",ce,c,a,d,b),"string"===typeof c&&this.Ma(a,c))}else Uj(a,c,b)}};t.hh=function(a){null===a&&C("GraphLinksModel.findLinkDataForKey:key must not be null");return void 0!==a&&ar(a)?this.yb.I(a):null};
t.ys=function(a){if(null!==a){var b=this.Ih;if(""!==b){var c=this.zc(a);if(void 0===c||this.yb.contains(c)){var d=this.al;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.yb.contains(c))){Uj(a,b,c);return}if("string"===typeof c){for(d=2;this.yb.contains(c+d);)d++;Uj(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.yb.count-1;this.yb.contains(c);)c--;Uj(a,b,c)}}}}};t.Ic=function(a){return null===a?!1:this.Zf.contains(a)};t.ei=function(a){null!==a&&(fb(a),this.Ic(a)||cr(this,a,!0))};
function cr(a,b,c){if(""!==a.linkKeyProperty){var d=a.zc(b);if(void 0!==d&&a.yb.I(d)===b)return;a.ys(b);d=a.zc(b);void 0===d&&C("GraphLinksModel.makeLinkDataKeyUnique failed on "+b+". Data not added to model.");a.yb.add(d,b)}a.Zf.add(b);d=null;c&&(d=a.gd.length,a.gd.splice(d,0,b));xr(a,"linkDataArray",ee,"linkDataArray",a,null,b,null,d);Hr(a,b)}t.Gy=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.ei(a[c]);else for(a=a.iterator;a.next();)this.ei(a.value)};
t.am=function(a){null!==a&&br(this,a,!0)};function br(a,b,c){a.Zf.remove(b);var d=a.zc(b);void 0!==d&&a.yb.remove(d);d=null;if(c){d=a.gd.indexOf(b);if(0>d)return;a.gd.splice(d,1)}xr(a,"linkDataArray",fe,"linkDataArray",a,b,null,d,null);c=Zq(a,b,!0);er(a,c,b);c=Zq(a,b,!1);er(a,c,b);d=a.Ef(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],er(a,c,b)}t.kA=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.am(a[c]);else for(a=a.iterator;a.next();)this.am(a.value)};
t.Zz=function(a){""===this.linkKeyProperty&&C("GraphLinksModel.linkKeyProperty must not be an empty string for .mergeLinkDataArray() to succeed.");if(a!==this.linkDataArray&&Aa(a)){var b=this.il;b.clear();b.addAll(this.yb.iteratorKeys);var c=this.gl;c.clear();for(var d=a.length,e=0;e<d;e++){var f=a[e],g=this.zc(f);if(void 0!==g){c.add(g);var h=this.hh(g);h!==f&&(null!==h?(this.Co(h,f),Fr(this,f,h)):(f=this.cloneDeep(f),this.Hs(f,g),this.ei(f)))}else g=this.cloneDeep(f),this.ei(g),c.add(this.zc(g))}for(a=
b.iterator;a.next();)d=a.value,c.contains(d)||(d=this.hh(d))&&this.am(d);b.clear();c.clear()}};function Hr(a,b){var c=Zq(a,b,!0);c=a.Tl(c);null===a.fc(c)&&fr(a,c,b);c=Zq(a,b,!1);c=a.Tl(c);null===a.fc(c)&&fr(a,c,b);var d=a.Ef(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],null===a.fc(c)&&fr(a,c,b)}
t.Io=function(a){if(null===a)return null;var b=this.yk;a=null!==b?b(a,this):yr(this,a,!0);za(a)&&(Qa(a),""!==this.kf&&Uj(a,this.kf,void 0),""!==this.lf&&Uj(a,this.lf,void 0),""!==this.he&&Uj(a,this.he,[]));return a};t.Yu=function(a){if(null===a)return!1;var b=this.hl;return""===b?!1:Cn(a,b)?!0:!1};t.jh=function(a){if(null!==a){var b=this.Ie;if(""!==b&&(b=Cn(a,b),void 0!==b)){if(ar(b))return b;C("GroupKey value for node data "+a+" is not a number or a string: "+b)}}};
t.jp=function(a,b){null===b&&(b=void 0);if(null!==a){var c=this.Ie;if(""!==c)if(this.mb(a)){var d=Cn(a,c);d!==b&&(er(this,d,a),Uj(a,c,b),null===this.fc(b)&&fr(this,b,a),xr(this,"nodeGroupKey",ce,c,a,d,b),"string"===typeof c&&this.Ma(a,c))}else Uj(a,c,b)}};Dr.prototype.copyNodeData=function(a){if(null===a)return null;a=Z.prototype.copyNodeData.call(this,a);this.Ij||""===this.Ie||void 0===Cn(a,this.Ie)||Uj(a,this.Ie,void 0);return a};
Dr.prototype.setDataProperty=function(a,b,c){if(this.mb(a)){if(b===this.nodeKeyProperty){this.jm(a,c);return}if(b===this.nodeCategoryProperty){this.im(a,c);return}if(b===this.nodeGroupKeyProperty){this.jp(a,c);return}}else if(this.Ic(a)){if(b===this.linkFromKeyProperty){gr(this,a,c,!0);return}if(b===this.linkToKeyProperty){gr(this,a,c,!1);return}if(b===this.linkFromPortIdProperty){hr(this,a,c,!0);return}if(b===this.linkToPortIdProperty){hr(this,a,c,!1);return}if(b===this.linkKeyProperty){this.Hs(a,
c);return}if(b===this.linkCategoryProperty){this.ip(a,c);return}if(b===this.linkLabelKeysProperty){this.Is(a,c);return}}var d=Cn(a,b);d!==c&&(Uj(a,b,c),this.Cs(a,b,d,c))};t=Dr.prototype;t.Co=function(a,b){if(b){var c=this.mb(a),d=this.Ic(a),e;for(e in b)"__gohashid"===e||c&&e===this.nodeKeyProperty||c&&e===this.nodeIsGroupProperty&&Cn(a,e)===b[e]||d&&e===this.linkKeyProperty||this.setDataProperty(a,e,b[e])}};
t.gp=function(a,b){Z.prototype.gp.call(this,a,b);for(var c=this.lb.iterator;c.next();)this.qv(c.value,a,b);for(c=this.Zf.iterator;c.next();){var d=c.value,e=a,f=b;if(Zq(this,d,!0)===e){var g=this.kf;Uj(d,g,f);xr(this,"linkFromKey",ce,g,d,e,f);"string"===typeof g&&this.Ma(d,g)}Zq(this,d,!1)===e&&(g=this.lf,Uj(d,g,f),xr(this,"linkToKey",ce,g,d,e,f),"string"===typeof g&&this.Ma(d,g));g=this.Ef(d);if(Array.isArray(g))for(var h=g.length,k=this.he,l=0;l<h;l++)g[l]===e&&(g[l]=f,xr(this,"linkLabelKeys",ee,
k,d,e,f,l,l))}};t.qv=function(a,b,c){if(this.jh(a)===b){var d=this.Ie;Uj(a,d,c);xr(this,"nodeGroupKey",ce,d,a,b,c);"string"===typeof d&&this.Ma(a,d)}};t.Jv=function(){Z.prototype.Jv.call(this);for(var a=this.linkDataArray,b=a.length,c=0;c<b;c++)Hr(this,a[c])};
t.em=function(a){Z.prototype.em.call(this,a);a=this.va(a);var b=dr(this,a);if(null!==b){var c=Ea();for(b=b.iterator;b.next();){var d=b.value;if(this.mb(d)){if(this.jh(d)===a){var e=this.Ie;xr(this,"nodeGroupKey",ce,e,d,a,a);"string"===typeof e&&this.Ma(d,e);c.push(d)}}else if(Zq(this,d,!0)===a&&(e=this.kf,xr(this,"linkFromKey",ce,e,d,a,a),"string"===typeof e&&this.Ma(d,e),c.push(d)),Zq(this,d,!1)===a&&(e=this.lf,xr(this,"linkToKey",ce,e,d,a,a),"string"===typeof e&&this.Ma(d,e),c.push(d)),e=this.Ef(d),
Array.isArray(e))for(var f=e.length,g=this.he,h=0;h<f;h++)e[h]===a&&(xr(this,"linkLabelKeys",ee,g,d,a,a,h,h),c.push(d))}for(b=0;b<c.length;b++)er(this,a,c[b]);Ga(c)}};t.dm=function(a){Z.prototype.dm.call(this,a);var b=this.jh(a);null===this.fc(b)&&fr(this,b,a)};t.np=function(a){Z.prototype.np.call(this,a);var b=this.jh(a);er(this,b,a)};
t.ms=function(a){if(null===a)return"";var b=this.dj;if(""===b)return"";b=Cn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;C("getCategoryForLinkData found a non-string category for "+a+": "+b)};Dr.prototype.getLinkCategoryForData=function(a){return this.ms(a)};Dr.prototype.ip=function(a,b){if(null!==a){var c=this.dj;if(""!==c)if(this.Ic(a)){var d=Cn(a,c);void 0===d&&(d="");d!==b&&(Uj(a,c,b),xr(this,"linkCategory",ce,c,a,d,b),"string"===typeof c&&this.Ma(a,c))}else Uj(a,c,b)}};
Dr.prototype.setLinkCategoryForData=function(a,b){this.ip(a,b)};t=Dr.prototype;t.km=function(a,b){Z.prototype.km.call(this,a,b);this.jp(b,this.jh(a))};function Fr(a,b,c){a.ip(c,a.ms(b));a.uv(c,a.yx(b));a.zv(c,a.Bx(b));a.Is(c,a.Ef(b));a.vv(c,a.zx(b));a.Av(c,a.Cx(b))}t.Vj=function(){return!0};t.pi=function(){return!0};t.us=function(){return!0};t.Wj=function(){return!0};
ma.Object.defineProperties(Dr.prototype,{archetypeNodeData:{get:function(){return this.Qi},set:function(a){var b=this.Qi;b!==a&&(this.Qi=a,this.g("archetypeNodeData",b,a))}},linkFromKeyProperty:{get:function(){return this.kf},set:function(a){var b=this.kf;b!==a&&(this.kf=a,this.g("linkFromKeyProperty",b,a))}},linkToKeyProperty:{get:function(){return this.lf},set:function(a){var b=this.lf;b!==a&&(this.lf=a,this.g("linkToKeyProperty",
b,a))}},linkFromPortIdProperty:{get:function(){return this.ej},set:function(a){var b=this.ej;b!==a&&(this.ej=a,this.g("linkFromPortIdProperty",b,a))}},linkToPortIdProperty:{get:function(){return this.fj},set:function(a){var b=this.fj;b!==a&&(this.fj=a,this.g("linkToPortIdProperty",b,a))}},linkLabelKeysProperty:{get:function(){return this.he},set:function(a){var b=this.he;b!==a&&(this.he=a,this.g("linkLabelKeysProperty",
b,a))}},linkDataArray:{get:function(){return this.gd},set:function(a){var b=this.gd;if(b!==a){this.yb.clear();for(var c=a.length,d=0;d<c;d++){var e=a[d];za(e)||C("GraphLinksModel.linkDataArray must only contain Objects, not: "+e);fb(e)}this.gd=a;if(""!==this.linkKeyProperty){d=new F;for(e=0;e<c;e++){var f=a[e],g=this.zc(f);void 0===g?d.add(f):null!==this.yb.I(g)?d.add(f):this.yb.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.ys(e),f=this.zc(e),void 0!==f&&this.yb.add(f,
e)}d=new H;for(e=0;e<c;e++)d.add(a[e]);this.Zf=d;xr(this,"linkDataArray",ce,"linkDataArray",this,b,a);for(b=0;b<c;b++)Hr(this,a[b])}}},linkKeyProperty:{get:function(){return this.Ih},set:function(a){var b=this.Ih;if(b!==a){this.Ih=a;this.yb.clear();for(var c=this.linkDataArray.length,d=0;d<c;d++){var e=this.linkDataArray[d],f=this.zc(e);void 0===f&&(this.ys(e),f=this.zc(e));void 0!==f&&this.yb.add(f,e)}this.g("linkKeyProperty",b,a)}}},makeUniqueLinkKeyFunction:{
get:function(){return this.al},set:function(a){var b=this.al;b!==a&&(this.al=a,this.g("makeUniqueLinkKeyFunction",b,a))}},copyLinkDataFunction:{get:function(){return this.yk},set:function(a){var b=this.yk;b!==a&&(this.yk=a,this.g("copyLinkDataFunction",b,a))}},nodeIsGroupProperty:{get:function(){return this.hl},set:function(a){var b=this.hl;b!==a&&(this.hl=a,this.g("nodeIsGroupProperty",b,a))}},nodeGroupKeyProperty:{
get:function(){return this.Ie},set:function(a){var b=this.Ie;b!==a&&(this.Ie=a,this.g("nodeGroupKeyProperty",b,a))}},Ij:{get:function(){return this.Km},set:function(a){this.Km!==a&&(this.Km=a)}},linkCategoryProperty:{get:function(){return this.dj},set:function(a){var b=this.dj;b!==a&&(this.dj=a,this.g("linkCategoryProperty",b,a))}},type:{get:function(){return"GraphLinksModel"}}});
Dr.prototype.setCategoryForLinkData=Dr.prototype.ip;Dr.prototype.getCategoryForLinkData=Dr.prototype.ms;Dr.prototype.assignAllDataProperties=Dr.prototype.Co;Dr.prototype.setGroupKeyForNodeData=Dr.prototype.jp;Dr.prototype.getGroupKeyForNodeData=Dr.prototype.jh;Dr.prototype.isGroupForNodeData=Dr.prototype.Yu;Dr.prototype.copyLinkData=Dr.prototype.Io;Dr.prototype.mergeLinkDataArray=Dr.prototype.Zz;Dr.prototype.removeLinkDataCollection=Dr.prototype.kA;Dr.prototype.removeLinkData=Dr.prototype.am;
Dr.prototype.addLinkDataCollection=Dr.prototype.Gy;Dr.prototype.addLinkData=Dr.prototype.ei;Dr.prototype.containsLinkData=Dr.prototype.Ic;Dr.prototype.makeLinkDataKeyUnique=Dr.prototype.ys;Dr.prototype.findLinkDataForKey=Dr.prototype.hh;Dr.prototype.setKeyForLinkData=Dr.prototype.Hs;Dr.prototype.getKeyForLinkData=Dr.prototype.zc;Dr.prototype.removeLabelKeyForLinkData=Dr.prototype.Sx;Dr.prototype.addLabelKeyForLinkData=Dr.prototype.Au;Dr.prototype.setLabelKeysForLinkData=Dr.prototype.Is;
Dr.prototype.getLabelKeysForLinkData=Dr.prototype.Ef;Dr.prototype.setToPortIdForLinkData=Dr.prototype.Av;Dr.prototype.getToPortIdForLinkData=Dr.prototype.Cx;Dr.prototype.setFromPortIdForLinkData=Dr.prototype.vv;Dr.prototype.getFromPortIdForLinkData=Dr.prototype.zx;Dr.prototype.setToKeyForLinkData=Dr.prototype.zv;Dr.prototype.getToKeyForLinkData=Dr.prototype.Bx;Dr.prototype.setFromKeyForLinkData=Dr.prototype.uv;Dr.prototype.getFromKeyForLinkData=Dr.prototype.yx;Dr.prototype.clear=Dr.prototype.clear;
var Gr=Object.freeze([]);Dr.className="GraphLinksModel";Ar.GraphLinksModel=Dr;Z.constructGraphLinksModel=Z.constructGraphLinksModel=function(){return new Dr};Z.initDiagramModel=ri=function(){return new Dr};function Ir(a,b){Z.call(this);this.Je="parent";this.Mm=!1;this.nj="parentLinkCategory";void 0!==a&&(Aa(a)?this.nodeDataArray=a:b=a);b&&(Object.assign(this,b),a=b.Changed)&&(delete this.Changed,this.Oe(a))}la(Ir,Z);Ir.constructGraphLinksModel=Z.constructGraphLinksModel;
Ir.prototype.cloneProtected=function(a){Z.prototype.cloneProtected.call(this,a);a.Je=this.Je;a.Mm=this.Mm;a.nj=this.nj};t=Ir.prototype;t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.kp();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.va(e)+":"+Ia(e)}}return b};
t.qm=function(){var a=Z.prototype.qm.call(this),b="";"parent"!==this.nodeParentKeyProperty&&"string"===typeof this.nodeParentKeyProperty&&(b+=',\n "nodeParentKeyProperty": '+this.quote(this.nodeParentKeyProperty));return a+b};t.cp=function(a){Z.prototype.cp.call(this,a);a.nodeParentKeyProperty&&(this.nodeParentKeyProperty=a.nodeParentKeyProperty)};
t.bp=function(a){void 0!==a.nodeParentKeyProperty&&a.nodeParentKeyProperty!==this.nodeParentKeyProperty&&C("applyIncrementalJson cannot change Model properties");Z.prototype.bp.call(this,a)};t.Tl=function(a){return a};t.kh=function(a){if(null!==a){var b=this.Je;if(""!==b&&(b=Cn(a,b),void 0!==b)){if(ar(b))return b;C("ParentKey value for node data "+a+" is not a number or a string: "+b)}}};
t.pe=function(a,b){null===b&&(b=void 0);if(null!==a){var c=this.Je;if(""!==c)if(b=this.Tl(b),this.mb(a)){var d=Cn(a,c);d!==b&&(er(this,d,a),Uj(a,c,b),null===this.fc(b)&&fr(this,b,a),xr(this,"nodeParentKey",ce,c,a,d,b),"string"===typeof c&&this.Ma(a,c))}else Uj(a,c,b)}};t.ps=function(a){if(null===a)return"";var b=this.nj;if(""===b)return"";b=Cn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;C("getParentLinkCategoryForNodeData found a non-string category for "+a+": "+b);return""};
Ir.prototype.getLinkCategoryForData=function(a){return this.ps(a)};Ir.prototype.Js=function(a,b){if(null!==a){var c=this.nj;if(""!==c)if(this.mb(a)){var d=Cn(a,c);void 0===d&&(d="");d!==b&&(Uj(a,c,b),xr(this,"parentLinkCategory",ce,c,a,d,b),"string"===typeof c&&this.Ma(a,c))}else Uj(a,c,b)}};Ir.prototype.setLinkCategoryForData=function(a,b){this.Js(a,b)};
Ir.prototype.copyNodeData=function(a){if(null===a)return null;a=Z.prototype.copyNodeData.call(this,a);this.Jj||""===this.Je||void 0===Cn(a,this.Je)||Uj(a,this.Je,void 0);return a};Ir.prototype.setDataProperty=function(a,b,c){if(this.mb(a)){if(b===this.nodeKeyProperty){this.jm(a,c);return}if(b===this.nodeCategoryProperty){this.im(a,c);return}if(b===this.nodeParentKeyProperty){this.pe(a,c);return}}var d=Cn(a,b);d!==c&&(Uj(a,b,c),this.Cs(a,b,d,c))};t=Ir.prototype;
t.gp=function(a,b){Z.prototype.gp.call(this,a,b);for(var c=this.lb.iterator;c.next();)this.qv(c.value,a,b)};t.qv=function(a,b,c){if(this.kh(a)===b){var d=this.Je;Uj(a,d,c);xr(this,"nodeParentKey",ce,d,a,b,c);"string"===typeof d&&this.Ma(a,d)}};
t.em=function(a){Z.prototype.em.call(this,a);a=this.va(a);var b=dr(this,a);if(null!==b){var c=Ea();for(b=b.iterator;b.next();){var d=b.value;if(this.mb(d)&&this.kh(d)===a){var e=this.Je;xr(this,"nodeParentKey",ce,e,d,a,a);"string"===typeof e&&this.Ma(d,e);c.push(d)}}for(b=0;b<c.length;b++)er(this,a,c[b]);Ga(c)}};t.dm=function(a){Z.prototype.dm.call(this,a);var b=this.kh(a);b=this.Tl(b);null===this.fc(b)&&fr(this,b,a)};t.np=function(a){Z.prototype.np.call(this,a);var b=this.kh(a);er(this,b,a)};
t.km=function(a,b){Z.prototype.km.call(this,a,b);this.Js(b,this.ps(a));this.pe(b,this.kh(a))};t.Rl=function(){return!0};t.us=function(){return!0};
ma.Object.defineProperties(Ir.prototype,{nodeParentKeyProperty:{get:function(){return this.Je},set:function(a){var b=this.Je;b!==a&&(this.Je=a,this.g("nodeParentKeyProperty",b,a))}},Jj:{get:function(){return this.Mm},set:function(a){this.Mm!==a&&(this.Mm=a)}},parentLinkCategoryProperty:{get:function(){return this.nj},set:function(a){var b=this.nj;b!==a&&(this.nj=a,this.g("parentLinkCategoryProperty",b,a))}},
linkCategoryProperty:{get:function(){return this.parentLinkCategoryProperty},set:function(a){this.parentLinkCategoryProperty=a}},type:{get:function(){return"TreeModel"}}});Ir.prototype.setParentLinkCategoryForNodeData=Ir.prototype.Js;Ir.prototype.getParentLinkCategoryForNodeData=Ir.prototype.ps;Ir.prototype.setParentKeyForNodeData=Ir.prototype.pe;Ir.prototype.getParentKeyForNodeData=Ir.prototype.kh;Ir.className="TreeModel";Ar.TreeModel=Ir;
function Jr(a){ti.call(this);this.jw=this.Ym=this.jc=0;this.Sp=360;this.iw=Kr;this.Si=0;this.Xv=new J;this.Gp=this.ke=0;this.Tr=new Lr;this.ct=this.mj=0;this.vy=600;this.co=NaN;this.Bm=1;this.qo=0;this.sl=360;this.Ob=Kr;this.K=Mr;this.hd=Nr;this.cd=Cq;this.tf=6;this.Mn=Or;a&&Object.assign(this,a)}la(Jr,ti);
Jr.prototype.cloneProtected=function(a){ti.prototype.cloneProtected.call(this,a);a.co=this.co;a.Bm=this.Bm;a.qo=this.qo;a.sl=this.sl;a.Ob=this.Ob;a.K=this.K;a.hd=this.hd;a.cd=this.cd;a.tf=this.tf;a.Mn=this.Mn};
Jr.prototype.rb=function(a){if(a.classType===Jr)if(a===Pr||a===Qr||a===Rr||a===Sr||a===Nr)this.sorting=a;else if(a===Tr||a===Ur||a===Mr||a===Vr)this.direction=a;else if(a===Wr||a===Xr||a===Kr||a===Yr)this.arrangement=a;else{if(a===Zr||a===Or)this.nodeDiameterFormula=a}else ti.prototype.rb.call(this,a)};Jr.prototype.createNetwork=function(){return new $r(this)};
Jr.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 F;b.addAll(a.iterator);a=new F;var c=new F;var d=this.sort(b);var e,f,g=this.Gp;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===Yr&&k===Zr?h=Kr:h===Yr&&k!==Zr&&(h=this.arrangement);if((this.direction===Tr||this.direction===Ur)&&this.sorting!==Nr){for(k=0;!(k>=d.length);k+=2){a.add(d.L(k));if(k+1>=d.length)break;c.add(d.L(k+1))}this.direction===Tr?(this.arrangement===Yr&&a.reverse(),d=new F,d.addAll(a),d.addAll(c)):(this.arrangement===Yr&&c.reverse(),d=new F,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===Mr?1:-1)/k,u=d.L(r).diameter;isNaN(u)&&(u=as(d.L(r),q));360>p&&(0===r||r===d.length-1)&&(u/=2);e+=u;f++}if(isNaN(l)||h===Yr){isNaN(b)&&(b=6);if(h!==Kr&&h!==Yr){f=-Infinity;for(g=0;g<k;g++)r=d.L(g),e=d.L(g===k-1?0:g+1),isNaN(r.diameter)&&as(r,0),isNaN(e.diameter)&&as(e,0),f=Math.max(f,(r.diameter+e.diameter)/2);g=f+b;h===Wr?l=(f+b)/(2*Math.PI/k):l=bs(this,g*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180)}else l=bs(this,e+(360<=p?k:k-1)*(h!==Yr?b:1.6*b),m,n*
Math.PI/180,p*Math.PI/180);f=l*m}else if(f=l*m,r=cs(this,l,f,n*Math.PI/180,p*Math.PI/180),isNaN(b)){if(h===Kr||h===Yr)b=(r-e)/(360<=p?k:k-1)}else if(h===Kr||h===Yr)r=(r-e)/(360<=p?k:k-1),r<b?(l=bs(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.L(e),u=d.L(e===k-1?0:e+1),isNaN(q.diameter)&&as(q,0),isNaN(u.diameter)&&as(u,0),g=Math.max(g,(q.diameter+u.diameter)/2);g+=b;e=bs(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.iw=h;this.jc=l;this.Ym=m;this.jw=n;this.Sp=p;this.Si=b;this.ke=f;this.Gp=g;b=d;d=this.iw;h=this.jc;l=this.jw;m=this.Sp;n=this.Si;p=this.ke;k=this.Gp;if(this.direction!==Tr&&this.direction!==Ur||d!==Yr)if(this.direction===Tr||this.direction===Ur){g=0;switch(d){case Xr:g=180*ds(this,h,p,l,k)/Math.PI;break;case Kr:k=b=0;g=a.first();null!==g&&(b=as(g,Math.PI/2));g=c.first();null!==g&&(k=as(g,Math.PI/2));g=180*ds(this,h,p,l,n+(b+k)/2)/Math.PI;break;case Wr:g=m/b.length}if(this.direction===
Tr){switch(d){case Xr:es(this,a,l,Vr);break;case Kr:fs(this,a,l,Vr);break;case Wr:gs(this,a,m/2,l,Vr)}switch(d){case Xr:es(this,c,l+g,Mr);break;case Kr:fs(this,c,l+g,Mr);break;case Wr:gs(this,c,m/2,l+g,Mr)}}else{switch(d){case Xr:es(this,c,l,Vr);break;case Kr:fs(this,c,l,Vr);break;case Wr:gs(this,c,m/2,l,Vr)}switch(d){case Xr:es(this,a,l+g,Mr);break;case Kr:fs(this,a,l+g,Mr);break;case Wr:gs(this,a,m/2,l+g,Mr)}}}else switch(d){case Xr:es(this,b,l,this.direction);break;case Kr:fs(this,b,l,this.direction);
break;case Wr:gs(this,b,m,l,this.direction);break;case Yr:hs(this,b,m,l,this.direction)}else hs(this,b,m,l-m/2,Mr)}this.updateParts();this.network=null;this.isValidLayout=!0};function gs(a,b,c,d,e){var f=a.Sp,g=a.jc;a=a.ke;d=d*Math.PI/180;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=d+(e===Mr?k*c/(360<=f?h:h-1):-(k*c)/h),m=b.L(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 fs(a,b,c,d){var e=a.jc,f=a.ke,g=a.Si;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=b.L(k),m=b.L(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)&&as(l,0);isNaN(m.diameter)&&as(m,0);l=ds(a,e,f,d===Mr?c:-c,(l.diameter+m.diameter)/2+g);c+=d===Mr?l:-l}}
function es(a,b,c,d){var e=a.jc,f=a.ke,g=a.Gp;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=b.L(k);l.centerX=e*Math.cos(c);l.centerY=f*Math.sin(c);l.actualAngle=180*c/Math.PI;l=ds(a,e,f,d===Mr?c:-c,g);c+=d===Mr?l:-l}}function hs(a,b,c,d,e){var f=a.Sp;a.mj=0;a.Tr=new Lr;if(360>c){for(f=d+(e===Mr?f:-f);0>f;)f+=360;f%=360;180<f&&(f-=360);f*=Math.PI/180;a.ct=f;is(a,b,c,d,e)}else js(a,b,c,d,e);a.Tr.commit(b)}
function js(a,b,c,d,e){var f=a.jc,g=a.Si,h=a.Ym,k=f*Math.cos(d*Math.PI/180),l=a.ke*Math.sin(d*Math.PI/180),m=b.Fa();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=J.alloc();for(var n=0;n<m.length;n++){m[n].centerX=k;m[n].centerY=l;if(n>=m.length-1)break;ks(a,k,l,m,n,e,f)||ls(a,k,l,m,n,e,f);k=f.x;l=f.y}J.free(f);a.mj++;if(!(23<a.mj)){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===Mr?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.Tr.compare(g,m);1<Math.abs(g)&&(a.jc=8>a.mj?a.jc-g/(2*Math.PI):5>m.length&&10<g?a.jc/2:a.jc-(0<g?1.7:-2.3),a.ke=a.jc*h,js(a,b,c,d,e))}}}
function is(a,b,c,d,e){for(var f=a.jc,g=a.ke,h=a.Ym,k=f*Math.cos(d*Math.PI/180),l=g*Math.sin(d*Math.PI/180),m=J.alloc(),n=b.Fa(),p=0;p<n.length;p++){n[p].centerX=k;n[p].centerY=l;if(p>=n.length-1)break;ks(a,k,l,n,p,e,m)||ls(a,k,l,n,p,e,m);k=m.x;l=m.y}J.free(m);a.mj++;if(!(23<a.mj)){k=Math.atan2(l,k);k=e===Mr?a.ct-k:k-a.ct;k=Math.abs(k)<Math.abs(k-2*Math.PI)?k:k-2*Math.PI;f=k*(f+g)/2;g=a.Tr;if(Math.abs(f)<Math.abs(g.Ml))for(g.Ml=f,g.kk=[],g.sm=[],k=0;k<n.length;k++)g.kk[k]=n[k].bounds.x,g.sm[k]=n[k].bounds.y;
1<Math.abs(f)&&(a.jc=8>a.mj?a.jc-f/(2*Math.PI):a.jc-(0<f?1.7:-2.3),a.ke=a.jc*h,is(a,b,c,d,e))}}function ks(a,b,c,d,e,f,g){var h=a.jc,k=a.ke,l=0;a=(d[e].width+d[e+1].width)/2+a.Si;var m=!1;if(0<=c!==(f===Mr)){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 ls(a,b,c,d,e,f,g){var h=a.jc,k=a.ke,l=0;a=(d[e].height+d[e+1].height)/2+a.Si;d=!1;if(0<=b!==(f===Mr)){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}Jr.prototype.commitLayout=function(){this.commitNodes();this.isRouting&&this.commitLinks()};
Jr.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 J(0,0):(c.x=this.arrangementOrigin.x+this.jc,c.y=this.arrangementOrigin.y+this.ke);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.Va(),a=this.group.position.copy(),c=this.group.location.copy(),b=b.qe(c.qe(a)),this.group.move(b),this.Xv=b.qe(a))};
Jr.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};function cs(a,b,c,d,e){var f=a.vy;if(.001>Math.abs(a.Ym-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 bs(a,b,c,d,e){return b/(void 0!==d&&void 0!==e?cs(a,1,c,d,e):cs(a,1,c))}function ds(a,b,c,d,e){if(.001>Math.abs(a.Ym-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}}
Jr.prototype.sort=function(a){switch(this.sorting){case Rr:break;case Sr:a.reverse();break;case Pr:a.sort(this.comparer);break;case Qr:a.sort(this.comparer);a.reverse();break;case Nr:return this.$j(ms(a));default:C("Invalid sorting type.")}return a};
function ms(a){for(var b=[],c=0;c<a.length;c++)b.push(0);c=new F;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.L(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.L(f));b[f]=-1;f=a.L(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}
Jr.prototype.$j=function(a){for(var b=[],c=0;c<a.length;c++){var d=a.L(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 F;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.L(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,y=0;y<g.length;y++){var z=f[g[y]],A=f[h[y]];if(z<A){var B=z;z=A}else B=A;if(B<u&&u<=z)for(A=0;A<w.length;A++){var D=w[A];0>c.indexOf(D)||B<f[D]&&f[D]<z||B===f[D]||z===f[D]||v++}else for(A=0;A<w.length;A++)D=w[A],0>c.indexOf(D)||B<f[D]&&f[D]<z&&B!==f[D]&&z!==f[D]&&v++}w=v;for(y=v=0;y<b[l].length;y++)B=
c.indexOf(b[l][y]),0<=B&&(B=Math.abs(u-(B>=u?B+1:B)),v+=B<c.length+1-B?B:c.length+1-B);for(y=0;y<g.length;y++)B=f[g[y]],z=f[h[y]],B>=u&&B++,z>=u&&z++,B>z&&(A=z,z=B,B=A),z-B<(c.length+2)/2===(B<u&&u<=z)&&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.L(c[b]));return e};
ma.Object.defineProperties(Jr.prototype,{radius:{get:function(){return this.co},set:function(a){this.co!==a&&(0<a||isNaN(a))&&(this.co=a,this.D())}},aspectRatio:{get:function(){return this.Bm},set:function(a){this.Bm!==a&&0<a&&(this.Bm=a,this.D())}},startAngle:{get:function(){return this.qo},set:function(a){this.qo!==a&&(this.qo=a,this.D())}},sweepAngle:{get:function(){return this.sl},
set:function(a){this.sl!==a&&(0<a&&360>=a?this.sl=a:this.sl=360,this.D())}},arrangement:{get:function(){return this.Ob},set:function(a){this.Ob===a||a!==Yr&&a!==Kr&&a!==Xr&&a!==Wr||(this.Ob=a,this.D())}},direction:{get:function(){return this.K},set:function(a){this.K===a||a!==Mr&&a!==Vr&&a!==Tr&&a!==Ur||(this.K=a,this.D())}},sorting:{get:function(){return this.hd},set:function(a){this.hd===a||a!==Rr&&a!==Sr&&
a!==Pr&&!Qr&&a!==Nr||(this.hd=a,this.D())}},comparer:{get:function(){return this.cd},set:function(a){this.cd!==a&&(this.cd=a,this.D())}},spacing:{get:function(){return this.tf},set:function(a){this.tf!==a&&(this.tf=a,this.D())}},nodeDiameterFormula:{get:function(){return this.Mn},set:function(a){this.Mn===a||a!==Or&&a!==Zr||(this.Mn=a,this.D())}},actualXRadius:{get:function(){return this.jc}},
actualYRadius:{get:function(){return this.ke}},actualSpacing:{get:function(){return this.Si}},actualCenter:{get:function(){return this.Xv}}});
var Kr=new E(Jr,"ConstantSpacing",0),Xr=new E(Jr,"ConstantDistance",1),Wr=new E(Jr,"ConstantAngle",2),Yr=new E(Jr,"Packed",3),Mr=new E(Jr,"Clockwise",4),Vr=new E(Jr,"Counterclockwise",5),Tr=new E(Jr,"BidirectionalLeft",6),Ur=new E(Jr,"BidirectionalRight",7),Rr=new E(Jr,"Forwards",8),Sr=new E(Jr,"Reverse",9),Pr=new E(Jr,"Ascending",10),Qr=new E(Jr,"Descending",11),Nr=new E(Jr,"Optimized",12),Or=new E(Jr,"Pythagorean",13),Zr=new E(Jr,"Circular",14);Jr.className="CircularLayout";Jr.ConstantSpacing=Kr;
Jr.ConstantDistance=Xr;Jr.ConstantAngle=Wr;Jr.Packed=Yr;Jr.Clockwise=Mr;Jr.Counterclockwise=Vr;Jr.BidirectionalLeft=Tr;Jr.BidirectionalRight=Ur;Jr.Forwards=Rr;Jr.Reverse=Sr;Jr.Ascending=Pr;Jr.Descending=Qr;Jr.Optimized=Nr;Jr.Pythagorean=Or;Jr.Circular=Zr;function Lr(){this.Ml=-Infinity;this.sm=this.kk=null}
Lr.prototype.compare=function(a,b){if(0<a&&0>this.Ml||Math.abs(a)<Math.abs(this.Ml)&&!(0>a&&0<this.Ml))for(this.Ml=a,this.kk=[],this.sm=[],a=0;a<b.length;a++)this.kk[a]=b[a].bounds.x,this.sm[a]=b[a].bounds.y};Lr.prototype.commit=function(a){if(null!==this.kk&&null!==this.sm)for(var b=0;b<this.kk.length;b++){var c=a.L(b);c.x=this.kk[b];c.y=this.sm[b]}};Lr.className="VertexArrangement";function $r(a){sq.call(this,a)}la($r,sq);$r.prototype.createVertex=function(){return new ns(this)};
$r.prototype.createEdge=function(){return new os(this)};$r.className="CircularNetwork";function ns(a){vq.call(this,a);this.u=this.Ri=NaN}la(ns,vq);
function as(a,b){var c=a.network;if(null===c)return NaN;c=c.layout;if(null===c)return NaN;if(c.arrangement===Yr)if(c.nodeDiameterFormula===Zr)a.Ri=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.Ri=Math.min(a.height/c,a.width/b)}else a.Ri=c.nodeDiameterFormula===Zr?Math.max(a.width,a.height):Math.sqrt(a.width*a.width+a.height*a.height);return a.Ri}
ma.Object.defineProperties(ns.prototype,{diameter:{get:function(){return this.Ri},set:function(a){this.Ri!==a&&(this.Ri=a)}},actualAngle:{get:function(){return this.u},set:function(a){this.u!==a&&(this.u=a)}}});ns.className="CircularVertex";function os(a){wq.call(this,a)}la(os,wq);os.className="CircularEdge";
function ps(a){ti.call(this);this.Zg=null;this.zn=0;this.Yd=(new L(100,100)).freeze();this.Am=!1;this.sf=!0;this.qd=!1;this.bl=100;this.Zm=1;this.Yf=1E3;this.Hn=10;this.eo=Math;this.Fk=.05;this.Ek=50;this.Ck=150;this.Dk=0;this.Um=10;this.Tm=5;a&&Object.assign(this,a)}la(ps,ti);
ps.prototype.cloneProtected=function(a){ti.prototype.cloneProtected.call(this,a);a.Yd.assign(this.Yd);a.Am=this.Am;a.sf=this.sf;a.qd=this.qd;a.bl=this.bl;a.Zm=this.Zm;a.Yf=this.Yf;a.Hn=this.Hn;a.eo=this.eo;a.Fk=this.Fk;a.Ek=this.Ek;a.Ck=this.Ck;a.Dk=this.Dk;a.Um=this.Um;a.Tm=this.Tm};ps.prototype.createNetwork=function(){return new qs(this)};
ps.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));a=this.maxIterations;if(0<this.network.vertexes.count){this.network.Jo();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.Bu();this.zn=0;if(this.needsClusterLayout()){b=this.network;c=b.ay();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.Td=f.vertexes.count;f.qh=1;f.Hj=null;f.Ve=null}rs(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=N.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 J(n.x+n.width+d.width,n.y),l[1]=new J(n.x,n.y+n.height+d.height),h=2;else{var p=ss(l,h,e,f,n.width,
n.height,d),r=l[p],q=new J(r.x+n.width+d.width,r.y),u=new J(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}N.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 J(p.x+p.width+d.width,p.y),l[1]=new J(p.x,p.y+p.height+d.height),h=2):(k=ss(l,h,e,f,p.width,p.height,d),n=l[k],r=new J(n.x+p.width+d.width,n.y),p=new J(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.ah(e.value);for(c=c.edges.iterator;c.next();)b.Ao(c.value)}}ts(this,a);this.updateParts()}this.bl=a;this.network=null;this.isValidLayout=!0};
ps.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.Vc(c)&&(a++,2<a))return!0;if(10<b)break;b++}return!1};ps.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.ad(d.bounds)}return b};
function rs(a,b,c){if(us(a,b)){var d=a.Yf;a.Yf*=1+1/(b+1);var e=vs(a,b),f=Math.max(0,Math.max(Math.min(a.network.vertexes.count,c*(b+1)/11),10));a.maxIterations+=f;rs(a,b+1,c);ts(a,f);ws(a,e);b=e.vertexes.Fa();b.sort(function(a,b){return null===a||null===b||a===b?0:b.Td-a.Td});for(c=0;c<b.length;c++)xs(a,b[c]);a.Yf=d}}
function us(a,b){if(10<b||3>a.network.vertexes.count)return!1;a.Zg=a.network.vertexes.Fa();a=a.Zg;a.sort(function(a,b){return null===a||null===b||a===b?0:b.Td-a.Td});for(b=a.length-1;0<=b&&1>=a[b].Td;)b--;return 1<a.length-b}
function vs(a,b){for(var c=a.network,d=new qs(a),e=0;e<a.Zg.length;e++){var f=a.Zg[e];if(1<f.Td){d.ah(f);var g=new ys;g.Os=f.Td;g.Ps=f.width;g.Ns=f.height;g.Qv=f.focus.x;g.Rv=f.focus.y;null===f.Ve&&(f.Ve=new F);f.Ve.add(g);f.sv=f.Ve.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.Ao(h):e.network===d?(h=e.Hj,null===h&&(h=new F,e.Hj=h),h.add(g),e.Td--,e.qh+=g.qh):g.network===d&&(h=g.Hj,null===h&&(h=new F,g.Hj=h),h.add(e),
g.Td--,g.qh+=e.qh)}for(e=d.edges.iterator;e.next();)f=e.value,f.length*=Math.max(1,K.sqrt((f.fromVertex.qh+f.toVertex.qh)/(4*b+1)));for(b=d.vertexes.iterator;b.next();){e=b.value;var k=e.Hj;if(null!==k&&0<k.count&&(g=e.Ve.L(e.Ve.count-1).Os-e.Td,!(0>=g))){for(var l=h=0,m=k.count-g;m<k.count;m++){var n=k.L(m),p=null;for(f=n.edges.iterator;f.next();){var r=f.value;if(r.Ax(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=K.sqrt((h+r+l*l*4/(g*g))/r);g=(h-1)*m/2;h=(h-1)*n/2;e.bounds=new N(f-p.x-g,k-p.y-h,m+2*g,n+2*h);e.focus=new J(p.x+g,p.y+h)}}a.network=d;return c}function ws(a,b){for(var c=a.network.vertexes.iterator;c.next();){var d=c.value;d.network=b;if(null!==d.Ve){var e=d.Ve.L(d.sv);d.Td=e.Os;var f=e.Qv,g=e.Rv;d.bounds=new N(d.centerX-f,d.centerY-g,e.Ps,e.Ns);d.focus=new J(f,g);d.sv--}}for(c=a.network.edges.iterator;c.next();)c.value.network=b;a.network=b}
function xs(a,b){var c=b.Hj;if(null!==c&&0!==c.count){var d=b.centerX,e=b.centerY,f=b.width,g=b.height;null!==b.Ve&&0<b.Ve.count&&(g=b.Ve.L(0),f=g.Ps,g=g.Ns);f=K.sqrt(f*f+g*g)/2;for(var h=!1,k=g=0,l=0,m=b.vertexes.iterator;m.next();){var n=m.value;1>=n.Td?k++:(h=!0,l++,g+=Math.atan2(b.centerY-n.centerY,b.centerX-n.centerX))}if(0!==k)for(0<l&&(g/=l),l=b=0,b=h?2*Math.PI/(k+1):2*Math.PI/k,0===k%2&&(l=b/2),1<c.count&&c.sort(function(a,b){return null===a||null===b||a===b?0:b.width*b.height-a.width*a.height}),
h=0===k%2?0:1,c=c.iterator;c.next();)if(k=c.value,!(1<k.Td||a.isFixed(k))){m=null;for(n=k.edges.iterator;n.next();){m=n.value;break}n=k.width;var p=k.height;n=K.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 ss(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}ps.prototype.Bu=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)};
ps.prototype.addComments=function(a){var b=a.node;if(null!==b)for(b=b.Ku();b.next();){var c=b.value;if("Comment"===c.category&&c.isVisible()){var d=this.network.ji(c);null===d&&(d=this.network.zl(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.Yj(a,d,null));c.length=this.defaultCommentSpringLength}}};
function zs(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,K.sqrt(c*c+a*a)):a+c<b?(d=d+e-g,a=a+c-b,K.sqrt(d*d+a*a)):g-(d+e):d>g+h?a>b+f?(c=d-g-h,a=a-b-f,K.sqrt(c*c+a*a)):a+c<b?(d=d-g-h,a=a+c-b,K.sqrt(d*d+a*a)):d-(g+h):a>b+f?a-(b+f):a+c<b?b-(a+c):.1}function ts(a,b){a.Zg=null;for(b=a.zn+b;a.zn<b&&(a.zn++,As(a)););a.Zg=null}
function As(a){null===a.Zg&&(a.Zg=a.network.vertexes.Fa());var b=a.Zg;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.Yf;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=zs(g,p);1>q?(d=a.randomNumberGenerator,null===d&&(a.randomNumberGenerator=d=new Bs),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=zs(c,f),1>n?(n=a.randomNumberGenerator,null===n&&(a.randomNumberGenerator=n=new Bs),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}ps.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};ps.prototype.moveFixedVertex=function(){};ps.prototype.commitLayout=function(){this.wv();this.commitNodes();this.isRouting&&this.commitLinks()};
ps.prototype.wv=function(){if(this.setsPortSpots)for(var a=this.network.edges.iterator;a.next();){var b=a.value.link;null!==b&&(b.fromSpot=Sc,b.toSpot=Sc)}};ps.prototype.commitNodes=function(){var a=0,b=0;if(this.arrangesToOrigin){var c=N.alloc();this.computeBounds(this.network,c);b=this.arrangementOrigin;a=b.x-c.x;b=b.y-c.y;N.free(c)}c=N.alloc();for(var d=this.network.vertexes.iterator;d.next();){var e=d.value;if(0!==a||0!==b)c.assign(e.bounds),c.x+=a,c.y+=b,e.bounds=c;e.commit()}N.free(c)};
ps.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};ps.prototype.springStiffness=function(a){a=a.stiffness;return isNaN(a)?this.Fk:a};ps.prototype.springLength=function(a){a=a.length;return isNaN(a)?this.Ek:a};ps.prototype.electricalCharge=function(a){a=a.charge;return isNaN(a)?this.Ck:a};ps.prototype.electricalFieldX=function(){return 0};ps.prototype.electricalFieldY=function(){return 0};
ps.prototype.gravitationalMass=function(a){a=a.mass;return isNaN(a)?this.Dk:a};ps.prototype.gravitationalFieldX=function(){return 0};ps.prototype.gravitationalFieldY=function(){return 0};ps.prototype.isFixed=function(a){return a.isFixed};
ma.Object.defineProperties(ps.prototype,{currentIteration:{get:function(){return this.zn}},arrangementSpacing:{get:function(){return this.Yd},set:function(a){this.Yd.C(a)||(this.Yd.assign(a),this.D())}},arrangesToOrigin:{get:function(){return this.Am},set:function(a){this.Am!==a&&(this.Am=a,this.D())}},setsPortSpots:{get:function(){return this.sf},set:function(a){this.sf!==a&&(this.sf=
a,this.D())}},comments:{get:function(){return this.qd},set:function(a){this.qd!==a&&(this.qd=a,this.D())}},maxIterations:{get:function(){return this.bl},set:function(a){this.bl!==a&&0<=a&&(this.bl=a,this.D())}},epsilonDistance:{get:function(){return this.Zm},set:function(a){this.Zm!==a&&0<a&&(this.Zm=a,this.D())}},infinityDistance:{get:function(){return this.Yf},set:function(a){this.Yf!==
a&&1<a&&(this.Yf=a,this.D())}},moveLimit:{get:function(){return this.Hn},set:function(a){this.Hn!==a&&1<a&&(this.Hn=a,this.D())}},randomNumberGenerator:{get:function(){return this.eo},set:function(a){this.eo!==a&&(null!==a&&"function"!==typeof a.random&&C('ForceDirectedLayout.randomNumberGenerator must have a "random()" function on it: '+a),this.eo=a)}},defaultSpringStiffness:{get:function(){return this.Fk},
set:function(a){this.Fk!==a&&(this.Fk=a,this.D())}},defaultSpringLength:{get:function(){return this.Ek},set:function(a){this.Ek!==a&&(this.Ek=a,this.D())}},defaultElectricalCharge:{get:function(){return this.Ck},set:function(a){this.Ck!==a&&(this.Ck=a,this.D())}},defaultGravitationalMass:{get:function(){return this.Dk},set:function(a){this.Dk!==a&&(this.Dk=a,this.D())}},defaultCommentSpringLength:{
get:function(){return this.Um},set:function(a){this.Um!==a&&(this.Um=a,this.D())}},defaultCommentElectricalCharge:{get:function(){return this.Tm},set:function(a){this.Tm!==a&&(this.Tm=a,this.D())}}});ps.className="ForceDirectedLayout";function ys(){this.Rv=this.Qv=this.Ns=this.Ps=this.Os=0}ys.className="ForceDirectedSubnet";function qs(a){sq.call(this,a)}la(qs,sq);qs.prototype.createVertex=function(){return new Cs(this)};qs.prototype.createEdge=function(){return new Ds(this)};
qs.className="ForceDirectedNetwork";function Cs(a){vq.call(this,a);this.ga=!1;this.Ha=this.u=NaN;this.qh=this.Td=this.V=this.F=0;this.Ve=this.Hj=null;this.sv=0}la(Cs,vq);
ma.Object.defineProperties(Cs.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.Ha},set:function(a){this.Ha!==a&&(this.Ha=a)}},forceX:{get:function(){return this.F},set:function(a){this.F!==a&&(this.F=a)}},forceY:{
get:function(){return this.V},set:function(a){this.V!==a&&(this.V=a)}}});Cs.className="ForceDirectedVertex";function Ds(a){wq.call(this,a);this.j=this.m=NaN}la(Ds,wq);ma.Object.defineProperties(Ds.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)}}});Ds.className="ForceDirectedEdge";
function Bs(){var a=0;void 0===a&&(a=42);this.seed=a;this.ey=48271;this.hy=2147483647;this.Q=44488.07041494893;this.iy=3399;this.gy=1/2147483647;this.random()}Bs.prototype.random=function(){var a=this.seed%this.Q*this.ey-this.seed/this.Q*this.iy;0<a?this.seed=a:this.seed=a+this.hy;return this.seed*this.gy};Bs.className="RandomNumberGenerator";
function Es(a){ti.call(this);this.ic=this.ge=25;this.K=0;this.Bk=Fs;this.Xk=Gs;this.Ok=Hs;this.aj=4;this.pk=Is;this.ag=15;this.sf=!0;this.Bn=4;this.Ra=this.Eq=this.Ia=-1;this.Gd=this.Gn=0;this.Ta=this.Ed=this.Fd=this.fe=this.sc=null;this.Jn=0;this.In=this.kj=null;this.je=0;this.dl=null;this.Rf=new J;this.Ge=[];this.Ge.length=100;this.vw=this.ue=0;a&&Object.assign(this,a)}la(Es,ti);
Es.prototype.cloneProtected=function(a){ti.prototype.cloneProtected.call(this,a);a.ge=this.ge;a.ic=this.ic;a.K=this.K;a.Bk=this.Bk;a.Xk=this.Xk;a.Ok=this.Ok;a.aj=this.aj;a.pk=this.pk;a.ag=this.ag;a.sf=this.sf;a.Bn=this.Bn;a.ue=this.ue};
Es.prototype.rb=function(a){a.classType===Es?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):ti.prototype.rb.call(this,a)};Es.prototype.createNetwork=function(){return new Js(this)};
Es.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);this.Eq=-1;this.Gd=this.Gn=0;this.dl=this.In=this.kj=null;for(a=0;a<this.Ge.length;a++)this.Ge[a]=null;if(0<this.network.vertexes.count){this.network.Jo();this.cycleRemoveOption!==Ks&&this.removeCycles();for(a=this.network.vertexes.iterator;a.next();)a.value.layer=-1;this.Ia=-1;this.assignLayers();for(a.reset();a.next();)this.Ia=Math.max(this.Ia,
a.value.layer);this.cycleRemoveOption===Ks&&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;for(var p=h.fromPort;null!==p&&!p.Qd();)p=
p.panel;for(h=h.toPort;null!==h&&!h.Qd();)h=h.panel;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=J.alloc();m!==n?u.w()&&n.isVisible()?n.actualBounds.w()?(Uo(n,p,xc,r),r.x+=n.actualBounds.x-u.x,r.y+=n.actualBounds.y-u.y):(Uo(n,p,xc,r),r.w()||r.assign(q)):r.assign(q):u.w()?(Uo(n,p,xc,r),r.w()||r.assign(q)):r.assign(q);n=d.rev?e.bounds:f.bounds;m=J.alloc();g!==k?n.w()&&k.isVisible()?k.actualBounds.w()?(Uo(k,h,xc,m),m.x+=k.actualBounds.x-n.x,m.y+=k.actualBounds.y-
n.y):(Uo(k,h,xc,m),m.w()||m.assign(l)):m.assign(l):n.w()?(Uo(k,h,xc,m),m.w()||m.assign(l)):m.assign(l);90===this.K||270===this.K?(g=Math.round((r.x-q.x)/this.ic),k=r.x,h=Math.round((m.x-l.x)/this.ic),l=m.x):(g=Math.round((r.y-q.y)/this.ic),k=r.y,h=Math.round((m.y-l.y)/this.ic),l=m.y);J.free(r);J.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 y=u.fromNode;p=u.toNode;if(null!==y&&null!==p){var z=Ls(this,!0),A=Ls(this,!1),B=this.setsPortSpots?z:u.computeSpot(!0,w);q=this.setsPortSpots?A:u.computeSpot(!1,v);var D=u.isOrthogonal;B.Xc()&&B.Hf(A)&&q.Xc()&&q.Hf(z)?n=0:(z=u.getLinkPoint(y,w,B,!0,D,p,v,J.alloc()),A=u.getLinkDirection(y,w,z,B,!0,D,p,v),J.free(z),B.vs()||A!==Ms(this,d,!0)?this.setsPortSpots&&null!==y&&1===y.ports.count&&d.rev&&(n+=1):n+=1,B=u.getLinkPoint(p,v,q,!1,D,y,w,J.alloc()),
u=u.getLinkDirection(p,v,B,q,!1,D,y,w),J.free(B),q.vs()||u!==Ms(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.Dj=1,q.layer=r,q.near=e,a.ah(q),e=a.Yj(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.Dj=2;q.layer=r-1;a.ah(q);e=a.Yj(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.Dj=3,q.layer=r-1,a.ah(q),e=a.Yj(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.Yj(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.sc=[];for(b=0;b<=this.Ia;b++)a[b]=0;for(b=this.network.vertexes.iterator;b.next();)b.value.index=
-1;this.initializeIndices();this.Eq=-1;for(c=this.Gd=this.Gn=0;c<=this.Ia;c++)a[c]>a[this.Gd]&&(this.Eq=a[c]-1,this.Gd=c),a[c]<a[this.Gn]&&(this.Gn=c);this.dl=[];for(c=0;c<a.length;c++)this.dl[c]=[];for(b.reset();b.next();)a=b.value,this.dl[a.layer][a.index]=a;this.Ra=-1;for(a=0;a<=this.Ia;a++){b=Ns(this,a);c=0;d=this.sc[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.Ra=Math.max(this.Ra,c-1);Os(this,a,b)}this.reduceCrossings();this.straightenAndPack();
this.updateParts()}this.network=null;this.isValidLayout=!0};Es.prototype.linkMinLength=function(){return 1};function Ps(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}Es.prototype.nodeMinLayerSpace=function(a,b){return null===a.node&&null===a.data?0:90===this.K||270===this.K?b?a.focus.y+10:a.bounds.height-a.focus.y+10:b?a.focus.x+10:a.bounds.width-a.focus.x+10};
Es.prototype.nodeMinColumnSpace=function(a,b){if(null===a.node&&null===a.data)return 0;var c=b?a.ev:a.dv;if(null!==c)return c;c=this.K;return 90===c||270===c?b?a.ev=a.focus.x/this.ic+1|0:a.dv=(a.bounds.width-a.focus.x)/this.ic+1|0:b?a.ev=a.focus.y/this.ic+1|0:a.dv=(a.bounds.height-a.focus.y)/this.ic+1|0};function Qs(a){null===a.kj&&(a.kj=[]);for(var b=0,c=a.network.vertexes.iterator;c.next();){var d=c.value;a.kj[b]=d.layer;b++;a.kj[b]=d.column;b++;a.kj[b]=d.index;b++}return a.kj}
function Rs(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 Ss(a,b,c){var d=Ns(a,b),e=a.sc[b];if(null===a.In||a.In.length<e*e)a.In=[];for(var f=a.In,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.Dj===l.Dj||h++}else for(m=g-1;m>k;m--)n=d[m],n.near===l&&n.Dj===l.Dj||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,y=0;if(0<=c){h=d[g].sourceEdgesArrayAccess;var z=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<z.length;p++)q=z[p],q.valid&&q.fromVertex.layer!==b&&(u=q.fromVertex.index,q=q.portFromPos,(n<u||n===u&&r<q)&&y++,(u<n||u===n&&q<r)&&v++)}if(0>=c)for(h=d[g].destinationEdgesArrayAccess,z=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<z.length;p++)q=z[p],q.valid&&q.toVertex.layer!==b&&(u=q.toVertex.index,w=q.portToPos,(n<u||n===u&&m<w)&&y++,(u<n||u===n&&w<m)&&v++);f[g*e+k]=v;f[k*e+g]=y}}Os(a,b,d);return f}Es.prototype.countCrossings=function(){for(var a=0,b=0;b<=this.Ia;b++)for(var c=Ss(this,b,1),d=this.sc[b],e=0;e<d;e++)for(var f=e;f<d;f++)a+=c[e*d+f];return a};
function Ts(a){for(var b=0,c=0;c<=a.Ia;c++){for(var d=a,e=c,f=Ns(d,e),g=d.sc[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)*Ps(n)}}}Os(d,e,f);b+=h}return b}
Es.prototype.normalize=function(){var a=Infinity;this.Ra=-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.Ra=Math.max(this.Ra,c.column+this.nodeMinColumnSpace(c,!1))}for(b.reset();b.next();)b.value.column-=a;this.Ra-=a};
function Us(a,b,c){for(var d=Ns(a,b),e=a.sc[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}Os(a,b,d);return f}
function Vs(a,b,c){for(var d=Ns(a,b),e=a.sc[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)}Os(a,b,d);return f}function Ws(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&&Ws(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&&Ws(a,k,c,d,e,f)}}
function Xs(a,b,c,d,e,f){if(b.component===d){b.component=c;if(e)for(var g=b.destinationEdges;g.next();)Xs(a,g.value.toVertex,c,d,e,f);if(f)for(b=b.sourceEdges;b.next();)Xs(a,b.value.fromVertex,c,d,e,f)}}
Es.prototype.removeCycles=function(){for(var a=this.network.edges.iterator;a.next();)a.value.rev=!1;switch(this.Bk){default:case Ys: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!==Zs(a);){for(e=$s(a);null!==e;)d[c]=e,c--,e.valid=!1,e=$s(a);for(e=at(a);null!==e;)d[b]=e,b++,e.valid=!1,e=at(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.fm(b),b.rev=!0);break;case Fs:for(d=this.network.vertexes.iterator;d.next();)a=d.value,a.Il=-1,a.finish=-1;for(a=this.network.edges.iterator;a.next();)a.value.forest=!1;this.Jn=0;for(d.reset();d.next();)b=d.value,0===b.sourceEdges.count&&
bt(this,b);for(d.reset();d.next();)b=d.value,-1===b.Il&&bt(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.Il<b.Il&&c<f&&(this.network.fm(d),d.rev=!0));break;case Ks: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.fm(b),b.rev=!0)}}};function Zs(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid)return b}return null}function $s(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 at(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 bt(a,b){b.Il=a.Jn;a.Jn++;for(var c=b.destinationEdges;c.next();){var d=c.value,e=d.toVertex;-1===e.Il&&(d.forest=!0,bt(a,e))}b.finish=a.Jn;a.Jn++}
Es.prototype.assignLayers=function(){switch(this.Xk){case ct:dt(this);break;case et:for(var a,b=this.network.vertexes.iterator;b.next();)a=ft(this,b.value),this.Ia=Math.max(a,this.Ia);for(b.reset();b.next();)a=b.value,a.layer=this.Ia-a.layer;break;default:case Gs:dt(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&>(this,a);a=Infinity;for(b.reset();b.next();)a=Math.min(a,b.value.layer);this.Ia=-1;for(b.reset();b.next();){var c=
b.value;c.layer-=a;this.Ia=Math.max(this.Ia,c.layer)}}};function dt(a){for(var b=a.network.vertexes.iterator;b.next();){var c=ht(a,b.value);a.Ia=Math.max(c,a.Ia)}}function ht(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,ht(a,f)+e)}b.layer=c}else c=b.layer;return c}
function ft(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,ft(a,f)+e)}b.layer=c}else c=b.layer;return c}
function gt(a,b){if(!b.valid){b.valid=!0;for(var c=b.destinationEdges;c.next();)gt(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&&Ws(a,h,0,-1,!0,!1)}for(Ws(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(Ws(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 Ms(a,b,c){return 90===a.K?c&&!b.rev||!c&&b.rev?270:90:180===a.K?c&&!b.rev||!c&&b.rev?0:180:270===a.K?c&&!b.rev||!c&&b.rev?90:270:c&&!b.rev||!c&&b.rev?180:0}
Es.prototype.initializeIndices=function(){switch(this.Ok){default:case it:for(var a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;b.index=this.sc[c];this.sc[c]++}break;case Hs:a=this.network.vertexes.iterator;for(b=this.Ia;0<=b;b--)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&jt(this,c);break;case kt:for(a=this.network.vertexes.iterator,b=0;b<=this.Ia;b++)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&<(this,c)}};
function jt(a,b){var c=b.layer;b.index=a.sc[c];a.sc[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&&jt(a,d))}
function lt(a,b){var c=b.layer;b.index=a.sc[c];a.sc[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&<(a,d))}
Es.prototype.reduceCrossings=function(){var a=this.countCrossings(),b=Qs(this),c,d;for(c=0;c<this.aj;c++){for(d=0;d<=this.Ia;d++)mt(this,d,1),nt(this,d,1);var e=this.countCrossings();e<a&&(a=e,b=Qs(this));for(d=this.Ia;0<=d;d--)mt(this,d,-1),nt(this,d,-1);e=this.countCrossings();e<a&&(a=e,b=Qs(this))}Rs(this,b);for(c=0;c<this.aj;c++){for(d=0;d<=this.Ia;d++)mt(this,d,0),nt(this,d,0);e=this.countCrossings();e<a&&(a=e,b=Qs(this));for(d=this.Ia;0<=d;d--)mt(this,d,0),nt(this,d,0);e=this.countCrossings();
e<a&&(a=e,b=Qs(this))}Rs(this,b);var f,g,h;switch(this.pk){case ot:break;case pt:for(h=a+1;(d=this.countCrossings())<h;)for(h=d,c=this.Ia;0<=c;c--)for(g=0;g<=c;g++){for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=nt(this,d,-1)||f;e=this.countCrossings();e>=a?Rs(this,b):(a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=nt(this,d,1)||f;e=this.countCrossings();e>=a?Rs(this,b):(a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=nt(this,d,1)||f;e>=a?Rs(this,b):(a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=
nt(this,d,-1)||f;e>=a?Rs(this,b):(a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=nt(this,d,0)||f;e>=a?Rs(this,b):(a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=nt(this,d,0)||f;e>=a?Rs(this,b):(a=e,b=Qs(this))}break;default:case Is:for(c=this.Ia,g=0,h=a+1;(d=this.countCrossings())<h;){h=d;for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=nt(this,d,-1)||f;e=this.countCrossings();e>=a?Rs(this,b):(a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=nt(this,d,1)||f;e=this.countCrossings();e>=a?Rs(this,b):
(a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=nt(this,d,1)||f;e>=a?Rs(this,b):(a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=nt(this,d,-1)||f;e>=a?Rs(this,b):(a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=nt(this,d,0)||f;e>=a?Rs(this,b):(a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=nt(this,d,0)||f;e>=a?Rs(this,b):(a=e,b=Qs(this))}}Rs(this,b)};
function mt(a,b,c){var d=Ns(a,b),e=a.sc[b],f=Vs(a,b,c),g=Us(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);Os(a,b,d)}
function nt(a,b,c){var d=Ns(a,b),e=a.sc[b];c=Ss(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),y=a.nodeMinColumnSpace(d[f+1],!0),z=a.nodeMinColumnSpace(d[f+1],!1);w=q-w+y;v=u-v+z;var A=d[f].sourceEdges.iterator;for(A.reset();A.next();)if(y=A.value,z=y.fromVertex,
y.valid&&z.layer===b){for(y=0;d[y]!==z;)y++;y<f&&(p+=2*(f-y),r+=2*(f+1-y));y===f+1&&(p+=1);y>f+1&&(p+=4*(y-f),r+=4*(y-(f+1)))}A=d[f].destinationEdges.iterator;for(A.reset();A.next();)if(y=A.value,z=y.toVertex,y.valid&&z.layer===b){for(y=0;d[y]!==z;)y++;y===f+1&&(r+=1)}A=d[f+1].sourceEdges.iterator;for(A.reset();A.next();)if(y=A.value,z=y.fromVertex,y.valid&&z.layer===b){for(y=0;d[y]!==z;)y++;y<f&&(p+=2*(f+1-y),r+=2*(f-y));y===f&&(r+=1);y>f+1&&(p+=4*(y-(f+1)),r+=4*(y-f))}A=d[f+1].destinationEdges.iterator;
for(A.reset();A.next();)if(y=A.value,z=y.toVertex,y.valid&&z.layer===b){for(y=0;d[y]!==z;)y++;y===f&&(p+=1)}y=z=0;A=g[d[f].index];var B=h[d[f].index],D=g[d[f+1].index],M=h[d[f+1].index];-1!==A&&(z+=Math.abs(A-q),y+=Math.abs(A-v));-1!==B&&(z+=Math.abs(B-q),y+=Math.abs(B-v));-1!==D&&(z+=Math.abs(D-u),y+=Math.abs(D-w));-1!==M&&(z+=Math.abs(M-u),y+=Math.abs(M-w));if(r<p-.5||r===p&&n<m-.5||r===p&&n===m&&y<z-.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;Os(a,b,d);return k}
Es.prototype.straightenAndPack=function(){if(0===this.ue){var a=0!==(this.ag&1);var b=0!==(this.ag&qt);1E3<this.network.edges.count&&b&&(a=!1);if(a){var c=[];for(b=0;b<=this.Ia;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.Ra-c[b])>>1)+8*d;this.Ra*=8}if(0!==(this.ag&2))for(c=!0;c;){c=!1;for(b=this.Gd+1;b<=this.Ia;b++)c=
rt(this,b,1)||c;for(b=this.Gd-1;0<=b;b--)c=rt(this,b,-1)||c;c=rt(this,this.Gd,0)||c}if(0!==(this.ag&4)){for(b=this.Gd+1;b<=this.Ia;b++)st(this,b,1);for(b=this.Gd-1;0<=b;b--)st(this,b,-1);st(this,this.Gd,0)}a&&(tt(this,-1),tt(this,1));if(0!==(this.ag&2))for(c=!0;c;){c=!1;c=rt(this,this.Gd,0)||c;for(b=this.Gd+1;b<=this.Ia;b++)c=rt(this,b,0)||c;for(b=this.Gd-1;0<=b;b--)c=rt(this,b,0)||c}}else ut(this)};function rt(a,b,c){for(var d=!1;vt(a,b,c);)d=!0;return d}
function vt(a,b,c){var d,e=Ns(a,b),f=a.sc[b],g=Us(a,b,-1);if(0<c)for(d=0;d<f;d++)g[d]=-1;var h=Us(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 y=v.fromVertex;
if(v.valid&&y.layer!==b){var z=Ps(v);var A=v.portFromColOffset;v=v.portToColOffset;y=y.column;p+=(Math.abs(m+v-(y+A))+1)*z;q+=(Math.abs(r+v-(y+A))+1)*z;u+=(Math.abs(n+v-(y+A))+1)*z}}if(0<=c)for(w=e[d].destinationEdges.iterator;w.next();)v=w.value,y=v.toVertex,v.valid&&y.layer!==b&&(z=Ps(v),A=v.portFromColOffset,v=v.portToColOffset,y=y.column,p+=(Math.abs(m+A-(y+v))+1)*z,q+=(Math.abs(r+A-(y+v))+1)*z,u+=(Math.abs(n+A-(y+v))+1)*z);v=A=z=0;w=g[e[d].index];y=h[e[d].index];-1!==w&&(z+=Math.abs(w-m),A+=
Math.abs(w-r),v+=Math.abs(w-n));-1!==y&&(z+=Math.abs(y-m),A+=Math.abs(y-r),v+=Math.abs(y-n));if(q<p||q===p&&A<z)l=k=!0,e[d].column=r;else if(u<p||u===p&&v<z)l=k=!0,e[d].column=n}Os(a,b,e);a.normalize();return k}
function st(a,b,c){var d=Ns(a,b),e=a.sc[b],f=Vs(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)}Os(a,b,d);a.normalize()}
function wt(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 xt(a,b){var c=b+1;var d,e=[],f=[];for(d=0;d<=a.Ia;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.Ia;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 tt(a,b){for(var c=0;c<=a.Ra;c++)for(;wt(a,c););a.normalize();for(c=0;c<a.Ra;c++)for(;xt(a,c););a.normalize();var d;if(0<b)for(c=0;c<=a.Ra;c++){var e=Qs(a);var f=Ts(a);for(d=f+1;f<d;){d=f;yt(a,c,1);var g=Ts(a);g>f?Rs(a,e):g<f&&(f=g,e=Qs(a))}}if(0>b)for(c=a.Ra;0<=c;c--)for(e=Qs(a),f=Ts(a),d=f+1;f<d;)d=f,yt(a,c,-1),g=Ts(a),g>f?Rs(a,e):g<f&&(f=g,e=Qs(a));a.normalize()}
function yt(a,b,c){a.je=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.je)}if(0>c)for(d.reset();d.next();)e=d.value,e.column+a.nodeMinColumnSpace(e,!1)>=b&&(e.component=a.je);a.je++;for(d.reset();d.next();)b=d.value,-1===b.component&&(Xs(a,b,a.je,-1,!0,!0),a.je++);var f;b=[];for(f=0;f<a.je*a.je;f++)b[f]=!1;e=[];for(f=0;f<(a.Ia+1)*(a.Ra+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.Ra,f.column+a.nodeMinColumnSpace(f,!1));h<=k;h++)e[g*(a.Ra+1)+h]=f.component}for(f=0;f<=a.Ia;f++){if(0<c)for(g=0;g<a.Ra;g++)-1!==e[f*(a.Ra+1)+g]&&-1!==e[f*(a.Ra+1)+g+1]&&e[f*(a.Ra+1)+g]!==e[f*(a.Ra+1)+g+1]&&(b[e[f*(a.Ra+1)+g]*a.je+e[f*(a.Ra+1)+g+1]]=!0);if(0>c)for(g=a.Ra;0<g;g--)-1!==e[f*(a.Ra+1)+g]&&-1!==e[f*(a.Ra+1)+g-1]&&e[f*(a.Ra+1)+g]!==e[f*(a.Ra+1)+g-1]&&(b[e[f*(a.Ra+1)+g]*a.je+e[f*(a.Ra+1)+g-1]]=!0)}e=
[];for(f=0;f<a.je;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.je;f++)b[k*a.je+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)}
function ut(a){for(var b=Ea(),c=a.dl.length,d=0;d<=c;d++)b[d]=[];for(d=a.network.vertexes.iterator;d.next();){var e=d.value;b[c-e.layer][e.index]=e}c=new H;zt(b,c);var f=null,g=null,h=null,k=null,l=0!==(a.ue&1),m=0!==(a.ue&2),n=0!==(a.ue&4),p=0!==(a.ue&8);l&&(a.verticalAlignment(b,c,!0),f=At(a,b,!0,!1));b.reverse();n&&(a.verticalAlignment(b,c,!1),h=At(a,b,!1,!1));d=ba(b);for(e=d.next();!e.done;e=d.next())e.value.reverse();p&&(a.verticalAlignment(b,c,!1),k=At(a,b,!1,!0));b.reverse();m&&(a.verticalAlignment(b,
c,!0),g=At(a,b,!0,!0));Ga(b);a.u(f,g,h,k);a.network.vertexes.each(function(a){var b=Ea();l&&b.push(f.get(a));m&&b.push(g.get(a));n&&b.push(h.get(a));p&&b.push(k.get(a));b.sort(function(a,b){return a-b});var c=b.length;c=(b[Math.floor((c-1)/2)]+b[Math.ceil((c-1)/2)])/2;Ga(b);a.yc=c})}
function zt(a,b){for(var c=a.length,d=1;d<c-1;d++)for(var e=0,f=0,g=a[d],h=a[d+1],k=0;f<h.length;k++){var l=h[k];a:{if(null===l.node){var m=Bt(l);if(0<m.length){m=null===m[0].node;break a}}m=!1}var n=m;if(k===h.length-1||n){m=g.length-1;n&&(m=Bt(l)[0].index);for(;f<=k;){l=h[f];if(!l.ao){n=[];for(var p=ba(l.sourceEdgesArrayAccess),r=p.next();!r.done;r=p.next())r=r.value,r.valid&&n.push(r);l.ao=n}l=ba(l.ao);for(n=l.next();!n.done;n=l.next())n=n.value,p=n.fromVertex.index,(p<e||p>m)&&b.add(n);f++}e=
m}}}Es.prototype.verticalAlignment=function(a,b,c){Ct(a);a=ba(a);for(var d=a.next();!d.done;d=a.next()){var e=-1;d=ba(d.value);for(var f=d.next();!f.done;f=d.next()){f=f.value;var g=c?Bt(f):Dt(f),h=g.length;if(0<h){g.sort(function(a,b){return a.ui-b.ui});var k=(h-1)/2;h=Math.floor(k);for(k=Math.ceil(k);h<=k;h++)if(f.align===f){var l=g[h],m=void 0;m=c?Et(l,f):Et(f,l);!b.contains(m)&&e<l.ui&&(l.align=f,f.root=l.root,f.align=l.root,e=l.ui)}}}}};
function Ct(a){for(var b=0;b<a.length;b++)for(var c=a[b],d=0;d<c.length;d++){var e=c[d];e.root=e;e.align=e;e.Tz=b;e.ui=d}}
function At(a,b,c,d){for(var e=90===a.K||270===a.K,f=ba(b),g=f.next();!g.done;g=f.next()){var h=ba(g.value);for(g=h.next();!g.done;g=h.next())g=g.value,g.od=g,g.shift=Infinity,g.yc=NaN,g.pg=0}g=90===a.K||270===a.K;f=ba(b);for(h=f.next();!h.done;h=f.next()){h=ba(h.value);for(var k=h.next();!k.done;k=h.next())if(k=k.value,k.root===k){for(var l=0,m=k;m.align!==k;){var n=m.align,p=g?m.width:m.height,r=g?n.width:n.height;if(c){var q=Et(m,n);var u=q.portFromPos;var w=q.portToPos;null!==q.link&&(m.node&&
m.node!==q.link.fromNode&&(u=g?m.focusX:m.focusY),n.node&&n.node!==q.link.toNode&&(w=g?n.focusX:n.focusY))}else q=Et(n,m),u=q.portToPos,w=q.portFromPos,null!==q.link&&(m.node&&m.node!==q.link.toNode&&(u=g?m.focusX:m.focusY),n.node&&n.node!==q.link.fromNode&&(w=g?n.focusX:n.focusY));p=d?m.pg+(p-u)-(r-w):m.pg+u-w;n.pg=p;l=Math.min(l,p);m=m.align}m=k;do m.pg=m.pg-l,m=m.align;while(m!==k)}}c=ba(b);for(g=c.next();!g.done;g=c.next())for(f=ba(g.value),g=f.next();!g.done;g=f.next())g=g.value,g.root===g&&
Ft(a,g,b);for(c=0;c<b.length;c++)if(!(0>=b[c].length)&&(g=b[c][0],g.od===g)){Infinity===g.od.shift&&(g.od.shift=0);g=c;h=0;do{for(f=b[g][h];f.align!==f.root;)f=f.align,g++,0<f.ui&&(h=Gt(f,b),h.od.shift=Math.min(h.od.shift,f.od.shift+f.yc+f.pg-(h.yc+h.pg+(e?h.width:h.height)+a.columnSpacing)));h=f.ui+1}while(g<b.length&&h<b[g].length&&f.od===b[g][h].od)}a=new ob;b=ba(b);for(g=b.next();!g.done;g=b.next())for(c=ba(g.value),g=c.next();!g.done;g=c.next())g=g.value,g.yc=g.yc+g.od.shift+g.pg,f=e?g.width:
g.height,a.add(g,d?-g.yc-f:g.yc);return a}function Ft(a,b,c){if(isNaN(b.yc)){b.yc=0;var d=b;do{if(0<d.ui){var e=Gt(d,c),f=e.root;Ft(a,f,c);b.od===b&&(b.od=f.od);var g=90===a.K||270===a.K?e.width:e.height;b.od===f.od&&(b.yc=Math.max(b.yc,f.yc+e.pg+g-d.pg+a.columnSpacing))}d=d.align}while(d!==b);for(;d.align!==b;)d=d.align,d.yc=b.yc,d.od=b.od}}function Gt(a,b){var c=a.Tz;a=a.ui;1>a&&C("Could not determine previous vertex in layer");return b[c][a-1]}
Es.prototype.u=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];c=-1;for(var d=Ea(),e=Ea(),f=Infinity,g=0;4>g;g++)if(b[g]){var h=Ht(this,b[g],d,e,g);h<f&&(c=g,f=h)}f={};for(g=0;4>g;f={delta:f.delta},g++)b[g]&&(f.delta=0===g||2===g?d[c]-d[g]:e[c]-e[g],0!==f.delta&&b[g].each(function(a){return function(b){b.value+=a.delta}}(f)));Ga(d);Ga(e)};
function Ht(a,b,c,d,e){if(!b||0===b.count)return c[e]=0,d[e]=0,Infinity;var f=Infinity,g=-Infinity;b.each(function(b){var c=b.key;b=b.value;c=90===a.K||270===a.K?c.width:c.height;b<f&&(f=b);b+c>g&&(g=b+c)});c[e]=f;d[e]=g;return g-f}Es.prototype.commitLayout=function(){if(this.setsPortSpots)for(var a=Ls(this,!0),b=Ls(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.Eu();this.isRouting&&this.commitLinks()};
function Ls(a,b){return 270===a.K?b?$c:cd:90===a.K?b?cd:$c:180===a.K?b?ad:bd:b?bd:ad}
Es.prototype.commitNodes=function(){this.fe=[];this.Fd=[];this.Ed=[];this.Ta=[];for(var a=0;a<=this.Ia;a++)this.fe[a]=0,this.Fd[a]=0,this.Ed[a]=0,this.Ta[a]=0;for(a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;this.fe[c]=Math.max(this.fe[c],this.nodeMinLayerSpace(b,!0));this.Fd[c]=Math.max(this.Fd[c],this.nodeMinLayerSpace(b,!1))}b=0;c=this.ge;for(var d=0;d<=this.Ia;d++){var e=c;0>=this.fe[d]+this.Fd[d]&&(e=0);0<d&&(b+=e/2);90===this.K||0===this.K?(b+=this.Fd[d],this.Ed[d]=b,
b+=this.fe[d]):(b+=this.fe[d],this.Ed[d]=b,b+=this.Fd[d]);d<this.Ia&&(b+=e/2);this.Ta[d]=b}c=b;b=this.arrangementOrigin;for(d=0;d<=this.Ia;d++)270===this.K?this.Ed[d]=b.y+this.Ed[d]:90===this.K?(this.Ed[d]=b.y+c-this.Ed[d],this.Ta[d]=c-this.Ta[d]):180===this.K?this.Ed[d]=b.x+this.Ed[d]:(this.Ed[d]=b.x+c-this.Ed[d],this.Ta[d]=c-this.Ta[d]);c=0!==this.ue;a.reset();d=270===this.K||90===this.K;for(var f=Infinity,g=e=Infinity,h=-Infinity;a.next();){var k=a.value,l=k.layer,m=k.column|0;d?(g=b.x+this.ic*
m,l=this.Ed[l]):(g=this.Ed[l],l=b.y+this.ic*m);k.centerX=g;k.centerY=l;c&&isFinite(k.yc)&&(d?k.node?k.x=b.x+k.yc:k.centerX=b.x+k.yc:k.node?k.y=b.y+k.yc:k.centerY=b.y+k.yc);f=Math.min(k.x,f);e=Math.min(k.y,e);d?(g=f,h=Math.max(h,k.bounds.right)):(g=e,h=Math.max(h,k.bounds.bottom))}this.vw=h-g;f=b.x-f;b=b.y-e;this.Rf=new J(c&&d?0:f,c&&!d?0:b);for(a.reset();a.next();)c=a.value,c.x+=f,c.y+=b,c.commit()};
Es.prototype.Eu=function(){for(var a=0,b=this.ge,c=0;c<=this.Ia;c++)a+=this.fe[c],a+=this.Fd[c];a+=this.Ia*b;b=[];c=0!==this.ue?this.vw:this.ic*this.Ra;for(var d=this.maxLayer;0<=d;d--)270===this.K?0===d?b.push(new N(0,0,c,Math.abs(this.Ta[0]))):b.push(new N(0,this.Ta[d-1],c,Math.abs(this.Ta[d-1]-this.Ta[d]))):90===this.K?0===d?b.push(new N(0,this.Ta[0],c,Math.abs(this.Ta[0]-a))):b.push(new N(0,this.Ta[d],c,Math.abs(this.Ta[d-1]-this.Ta[d]))):180===this.K?0===d?b.push(new N(0,0,Math.abs(this.Ta[0]),
c)):b.push(new N(this.Ta[d-1],0,Math.abs(this.Ta[d-1]-this.Ta[d]),c)):0===d?b.push(new N(this.Ta[0],0,Math.abs(this.Ta[0]-a),c)):b.push(new N(this.Ta[d],0,Math.abs(this.Ta[d-1]-this.Ta[d]),c));this.commitLayers(b,this.Rf)};Es.prototype.commitLayers=function(){};
Es.prototype.commitLinks=function(){for(var a=this.network.edges.iterator,b;a.next();)b=a.value.link,null!==b&&(b.sh(),b.Fj(),b.zf());for(a.reset();a.next();)b=a.value.link,null!==b&&b.ug();for(a.reset();a.next();){var c=a.value;b=c.link;if(null!==b){b.sh();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===bg&&4===b.pointsCount)if(m.column===n.column&&0===this.alignOption)c=b.getLinkPoint(e,g,l,!0,!1,f,h),g=b.getLinkPoint(f,h,k,!1,!1,e,g),c.w()||c.set(e.actualBounds.center),g.w()||g.set(f.actualBounds.center),b.Fj(),b.yf(c.x,c.y),b.yf((2*c.x+g.x)/3,(2*c.y+g.y)/3),b.yf((c.x+2*g.x)/3,(c.y+2*g.y)/3),b.yf(g.x,g.y);else{var p=!1,r=!1;null!==g&&l===rc&&(p=!0);null!==h&&k===rc&&(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.K||270===this.K){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.w()||l.set(e.actualBounds.center);b.M(0,l.x,l.y)}r&&(90===this.K||270===this.K?(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.w()||e.set(f.actualBounds.center),b.M(3,e.x,e.y))}}b.zf()}else if(m.layer===n.layer)b.zf();else{p=r=!1;u=this.ge;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===bg)r=!0,
w=b.pointsCount,4<w&&b.points.removeRange(2,w-3),4===w&&(q=2);else{w=b.pointsCount;var v=l===rc,y=k===rc;2<w&&v&&y?b.points.removeRange(1,w-2):3<w&&v&&!y?b.points.removeRange(1,w-3):3<w&&!v&&y?b.points.removeRange(2,w-2):4<w&&!v&&!y&&b.points.removeRange(2,w-3)}if(c.rev){for(;null!==n&&m!==n;){var z=w=null;for(v=n.sourceEdges.iterator;v.next()&&(y=v.value,y.link!==c.link||(w=y.fromVertex,z=y.toVertex,null!==w.node)););if(null===w)break;if(w!==m){v=b.i(q-1).x;y=b.i(q-1).y;var A=w.centerX;var B=w.centerY;
if(p)180===this.K||0===this.K?q===b.firstPickIndex+1?(b.l(q++,v,y),b.l(q++,v,B)):(null!==z?z.centerY:y)!==B&&(z=this.Ta[w.layer-1]+this.Rf.x,b.l(q++,z,y),b.l(q++,z,B)):q===b.firstPickIndex+1?(b.l(q++,v,y),b.l(q++,A,y)):(null!==z?z.centerX:v)!==A&&(z=this.Ta[w.layer-1]+this.Rf.y,b.l(q++,v,z),b.l(q++,A,z));else if(q===b.firstPickIndex+1){z=Math.max(10,this.fe[n.layer]);var D=Math.max(10,this.Fd[n.layer]);if(r)180===this.K?A<=n.bounds.x?(n=n.bounds.x,b.l(q++,n-z,B),b.l(q++,n,B),b.l(q++,n+D,B)):(b.l(q++,
A-z,B),b.l(q++,A,B),b.l(q++,A+D,B)):90===this.K?B>=n.bounds.bottom?(n=n.bounds.y+n.bounds.height,b.l(q++,A,n+D),b.l(q++,A,n),b.l(q++,A,n-z)):(b.l(q++,A,B+D),b.l(q++,A,B),b.l(q++,A,B-z)):270===this.K?B<=n.bounds.y?(n=n.bounds.y,b.l(q++,A,n-z),b.l(q++,A,n),b.l(q++,A,n+D)):(b.l(q++,A,B-z),b.l(q++,A,B),b.l(q++,A,B+D)):0===this.K&&(A>=n.bounds.right?(n=n.bounds.x+n.bounds.width,b.l(q++,n+D,B),b.l(q++,n,B),b.l(q++,n-z,B)):(b.l(q++,A+D,B),b.l(q++,A,B),b.l(q++,A-z,B)));else{b.l(q++,v,y);var M=0;if(180===
this.K||0===this.K){if(180===this.K?A>=n.bounds.right:A<=n.bounds.x)M=(0===this.K?-z:D)/2;b.l(q++,v+M,B)}else{if(270===this.K?B>=n.bounds.bottom:B<=n.bounds.y)M=(90===this.K?-z:D)/2;b.l(q++,A,y+M)}b.l(q++,A,B)}}else z=Math.max(10,this.fe[w.layer]),D=Math.max(10,this.Fd[w.layer]),r?180===this.K?(b.l(q++,A-z-u,B),b.l(q++,Math.min(A-z+u/2,A),B),b.l(q++,A,B),b.l(q++,A,B),b.l(q++,Math.max(A+D-u/2,A),B),b.l(q++,A+D+u,B)):90===this.K?(b.l(q++,A,B+D+u),b.l(q++,A,Math.max(B+D-u/2,B)),b.l(q++,A,B),b.l(q++,
A,B),b.l(q++,A,Math.min(B-z+u/2,B)),b.l(q++,A,B-z-u)):270===this.K?(b.l(q++,A,B-z-u),b.l(q++,A,Math.min(B-z+u/2,B)),b.l(q++,A,B),b.l(q++,A,B),b.l(q++,A,Math.max(B+D-u/2,B)),b.l(q++,A,B+D+u)):(b.l(q++,A+D+u,B),b.l(q++,Math.max(A+D-u/2,A),B),b.l(q++,A,B),b.l(q++,A,B),b.l(q++,Math.min(A-z+u/2,A),B),b.l(q++,A-z-u,B)):b.l(q++,A,B)}n=w}if(null===h||l!==rc||p)if(v=b.i(q-1).x,y=b.i(q-1).y,A=b.i(q).x,B=b.i(q).y,p)u=this.Fd[m.layer],180===this.K||0===this.K?(p=y,p>=m.bounds.y&&p<=m.bounds.bottom&&(180===this.K?
A>=m.bounds.x:A<=m.bounds.right)&&(n=m.centerX+(180===this.K?-u:u),p<m.bounds.y+m.bounds.height/2?p=m.bounds.y-this.ic/2:p=m.bounds.bottom+this.ic/2,b.l(q++,n,y),b.l(q++,n,p)),b.l(q++,A,p)):(p=v,p>=m.bounds.x&&p<=m.bounds.right&&(270===this.K?B>=m.bounds.y:B<=m.bounds.bottom)&&(n=m.centerY+(270===this.K?-u:u),p<m.bounds.x+m.bounds.width/2?p=m.bounds.x-this.ic/2:p=m.bounds.right+this.ic/2,b.l(q++,v,n),b.l(q++,p,n)),b.l(q++,p,B)),b.l(q++,A,B);else if(r)z=Math.max(10,this.fe[m.layer]),D=Math.max(10,
this.Fd[m.layer]),180===this.K&&A>=m.bounds.x?(n=m.bounds.x+m.bounds.width,b.M(q-2,n,y),b.M(q-1,n+D,y)):90===this.K&&B<=m.bounds.bottom?(n=m.bounds.y,b.M(q-2,v,n),b.M(q-1,v,n-z)):270===this.K&&B>=m.bounds.y?(n=m.bounds.y+m.bounds.height,b.M(q-2,v,n),b.M(q-1,v,n+D)):0===this.K&&A<=m.bounds.right&&(n=m.bounds.x,b.M(q-2,n,y),b.M(q-1,n-z,y));else{z=Math.max(10,this.fe[m.layer]);D=Math.max(10,this.Fd[m.layer]);p=0;if(180===this.K||0===this.K){if(180===this.K?A<=m.bounds.x:A>=m.bounds.right)p=(0===this.K?
D:-z)/2;b.l(q++,A+p,y)}else{if(270===this.K?B<=m.bounds.y:B>=m.bounds.bottom)p=(90===this.K?D:-z)/2;b.l(q++,v,B+p)}b.l(q++,A,B)}}else{for(;null!==m&&m!==n;){z=w=null;for(m=m.destinationEdges.iterator;m.next()&&(v=m.value,v.link!==c.link||(w=v.toVertex,z=v.fromVertex,null!==z.node&&(z=null),null!==w.node)););if(null===w)break;w!==n&&(v=b.i(q-1).x,y=b.i(q-1).y,A=w.centerX,B=w.centerY,p?180===this.K||0===this.K?(null!==z?z.centerY:y)!==B&&(z=this.Ta[w.layer]+this.Rf.x,q===b.firstPickIndex+1&&(z=0===
this.K?Math.max(z,v):Math.min(z,v)),b.l(q++,z,y),b.l(q++,z,B)):(null!==z?z.centerX:v)!==A&&(z=this.Ta[w.layer]+this.Rf.y,q===b.firstPickIndex+1&&(z=90===this.K?Math.max(z,y):Math.min(z,y)),b.l(q++,v,z),b.l(q++,A,z)):(z=Math.max(10,this.fe[w.layer]),D=Math.max(10,this.Fd[w.layer]),r?180===this.K?(b.l(q++,A+D+u,B),b.l(q++,Math.max(A+D-u/2,A),B),b.l(q++,A,B),b.l(q++,A,B),b.l(q++,Math.min(A-z+u/2,A),B),b.l(q++,A-z-u,B)):90===this.K?(b.l(q++,A,B-z-u),b.l(q++,A,Math.min(B-z+u/2,B)),b.l(q++,A,B),b.l(q++,
A,B),b.l(q++,A,Math.max(B+D-u/2,B)),b.l(q++,A,B+D+u)):270===this.K?(b.l(q++,A,B+D+u),b.l(q++,A,Math.max(B+D-u/2,B)),b.l(q++,A,B),b.l(q++,A,B),b.l(q++,A,Math.min(B-z+u/2,B)),b.l(q++,A,B-z-u)):(b.l(q++,A-z-u,B),b.l(q++,Math.min(A-z+u/2,A),B),b.l(q++,A,B),b.l(q++,A,B),b.l(q++,Math.max(A+D-u/2,A),B),b.l(q++,A+D+u,B)):180===this.K?(b.l(q++,A+D,B),b.l(q++,A-z,B)):90===this.K?(b.l(q++,A,B-z),b.l(q++,A,B+D)):270===this.K?(b.l(q++,A,B+D),b.l(q++,A,B-z)):(b.l(q++,A-z,B),b.l(q++,A+D,B))));m=w}p&&(v=b.i(q-1).x,
y=b.i(q-1).y,A=b.i(q).x,B=b.i(q).y,180===this.K||0===this.K?y!==B&&(z=0===this.K?Math.min(Math.max((A+v)/2,this.Ta[n.layer]+this.Rf.x),A):Math.max(Math.min((A+v)/2,this.Ta[n.layer]+this.Rf.x),A),b.l(q++,z,y),b.l(q++,z,B)):v!==A&&(z=90===this.K?Math.min(Math.max((B+y)/2,this.Ta[n.layer]+this.Rf.y),B):Math.max(Math.min((B+y)/2,this.Ta[n.layer]+this.Rf.y),B),b.l(q++,v,z),b.l(q++,A,z)))}null!==d&&r&&(null!==g&&(l===rc&&(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,rc,
!0,!1,f,h),l.w()||l.set(e.actualBounds.center),b.M(0,l.x,l.y)),null!==h&&(k===rc&&(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,rc,!1,!1,e,g),e.w()||e.set(f.actualBounds.center),b.M(b.pointsCount-1,e.x,e.y)));b.zf();c.commit()}}}this.avoidOrthogonalOverlaps()};
Es.prototype.avoidOrthogonalOverlaps=function(){if(!(0>=this.linkSpacing)){for(var a=new F,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.K||270===this.K){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 It;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.hc=l.x*l.x+l.y;h.nd=Math.min(f.x,g.x);h.Hc=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.Xx),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].Hc;for(e=a+1;e<d&&c[e].nd<g;)g=Math.max(g,c[e].Hc),e++;g=e-f;if(1<g){this.yi(c,this.Gs,f,f+g);m=1;h=c[f].hc;for(k=f;k<e;k++)l=c[k],l.hc!==
h&&(m++,h=l.hc);this.yi(c,this.Wx,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].hc,this.yi(c,this.Gs,f,f+g)):h=c[f].first;m=0;for(n=f;n<e;n++){var p=c[n];(k?p.first:p.hc)!==h&&(m++,h=k?p.first:p.hc);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.sh();r.M(p.index,f.x,f.y+q);r.M(p.index+1,g.x,g.y+q);r.zf()}}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 It,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.hc=l.x+l.y*l.y,h.nd=Math.min(f.y,g.y),h.Hc=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.Xx),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].Hc;for(e=a+1;e<d&&c[e].nd<g;)g=Math.max(g,c[e].Hc),e++;g=e-f;if(1<g){this.yi(c,this.Gs,f,f+g);m=1;h=c[f].hc;for(k=f;k<e;k++)l=c[k],l.hc!==h&&(m++,h=l.hc);this.yi(c,this.Wx,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].hc,this.yi(c,this.Gs,f,f+g)):h=c[f].first;m=0;for(n=f;n<e;n++)p=c[n],(k?p.first:p.hc)!==h&&(m++,h=k?p.first:p.hc),r=p.link,f=r.i(p.index),g=r.i(p.index+1),q=this.linkSpacing*(m-(l-1)/2),b++,r.sh(),r.M(p.index,
f.x+q,f.y),r.M(p.index+1,g.x+q,g.y),r.zf()}f=e}a=d}}}};t=Es.prototype;t.Xx=function(a,b){return a instanceof It&&b instanceof It&&a!==b?a.layer<b.layer?-1:a.layer>b.layer?1:a.nd<b.nd?-1:a.nd>b.nd?1:a.Hc<b.Hc?-1:a.Hc>b.Hc?1:0:0};t.Wx=function(a,b){return a instanceof It&&b instanceof It&&a!==b?a.first<b.first?-1:a.first>b.first||a.j<b.j?1:a.j>b.j||a.nd<b.nd?-1:a.nd>b.nd?1:a.Hc<b.Hc?-1:a.Hc>b.Hc?1:0:0};
t.Gs=function(a,b){return a instanceof It&&b instanceof It&&a!==b?a.hc<b.hc?-1:a.hc>b.hc||a.j<b.j?1:a.j>b.j||a.nd<b.nd?-1:a.nd>b.nd?1:a.Hc<b.Hc?-1:a.Hc>b.Hc?1:0:0};t.B=function(a,b){a-=b;return-1<a&&1>a};
t.yi=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 Ns(a,b){var c=a.sc[b];if(c>=a.Ge.length){var d=[];for(var e=0;e<a.Ge.length;e++)d[e]=a.Ge[e];a.Ge=d}void 0===a.Ge[c]||null===a.Ge[c]?d=[]:(d=a.Ge[c],a.Ge[c]=null);a=a.dl[b];for(b=0;b<a.length;b++)c=a[b],d[c.index]=c;return d}function Os(a,b,c){a.Ge[a.sc[b]]=c}
ma.Object.defineProperties(Es.prototype,{layerSpacing:{get:function(){return this.ge},set:function(a){this.ge!==a&&0<=a&&(this.ge=a,this.D())}},columnSpacing:{get:function(){return this.ic},set:function(a){this.ic!==a&&0<a&&(this.ic=a,this.D())}},direction:{get:function(){return this.K},set:function(a){this.K!==a&&(0===a||90===a||180===a||270===a?(this.K=a,this.D()):C("LayeredDigraphLayout.direction must be 0, 90, 180, or 270"))}},
cycleRemoveOption:{get:function(){return this.Bk},set:function(a){this.Bk===a||a!==Ys&&a!==Fs&&a!==Ks||(this.Bk=a,this.D())}},layeringOption:{get:function(){return this.Xk},set:function(a){this.Xk===a||a!==Gs&&a!==ct&&a!==et||(this.Xk=a,this.D())}},initializeOption:{get:function(){return this.Ok},set:function(a){this.Ok===a||a!==Hs&&a!==kt&&a!==it||(this.Ok=a,this.D())}},iterations:{
get:function(){return this.aj},set:function(a){this.aj!==a&&0<=a&&(this.aj=a,this.D())}},aggressiveOption:{get:function(){return this.pk},set:function(a){this.pk===a||a!==ot&&a!==Is&&a!==pt||(this.pk=a,this.D())}},packOption:{get:function(){return this.ag},set:function(a){this.ag!==a&&0<=a&&8>a&&(this.ag=a,this.D())}},alignOption:{get:function(){return this.ue},set:function(a){this.ue!==a&&0<=a&&16>a&&(this.ue=
a,this.D())}},setsPortSpots:{get:function(){return this.sf},set:function(a){this.sf!==a&&(this.sf=a,this.D())}},linkSpacing:{get:function(){return this.Bn},set:function(a){this.Bn!==a&&0<=a&&(this.Bn=a,this.D())}},maxLayer:{get:function(){return this.Ia}},maxIndex:{get:function(){return this.Eq}},maxColumn:{get:function(){return this.Ra}},minIndexLayer:{
get:function(){return this.Gn}},maxIndexLayer:{get:function(){return this.Gd}}});
var Fs=new E(Es,"CycleDepthFirst",0),Ys=new E(Es,"CycleGreedy",1),Ks=new E(Es,"CycleFromLayers",2),Gs=new E(Es,"LayerOptimalLinkLength",0),ct=new E(Es,"LayerLongestPathSink",1),et=new E(Es,"LayerLongestPathSource",2),Hs=new E(Es,"InitDepthFirstOut",0),kt=new E(Es,"InitDepthFirstIn",1),it=new E(Es,"InitNaive",2),ot=new E(Es,"AggressiveNone",0),Is=new E(Es,"AggressiveLess",1),pt=new E(Es,"AggressiveMore",2),qt=8;Es.className="LayeredDigraphLayout";Es.CycleDepthFirst=Fs;Es.CycleGreedy=Ys;
Es.CycleFromLayers=Ks;Es.LayerOptimalLinkLength=Gs;Es.LayerLongestPathSink=ct;Es.LayerLongestPathSource=et;Es.InitDepthFirstOut=Hs;Es.InitDepthFirstIn=kt;Es.InitNaive=it;Es.AggressiveNone=ot;Es.AggressiveLess=Is;Es.AggressiveMore=pt;Es.PackNone=0;Es.PackExpand=1;Es.PackStraighten=2;Es.PackMedian=4;Es.PackAll=15;Es.AlignNone=0;Es.AlignUpperLeft=1;Es.AlignUpperRight=2;Es.AlignLowerLeft=4;Es.AlignLowerRight=8;Es.AlignAll=15;
function It(){this.index=this.Hc=this.nd=this.hc=this.first=this.layer=0;this.link=null;this.j=0}It.className="SegInfo";function Js(a){sq.call(this,a)}la(Js,sq);Js.prototype.createVertex=function(){return new Jt(this)};Js.prototype.createEdge=function(){return new Kt(this)};Js.className="LayeredDigraphNetwork";function Jt(a){vq.call(this,a);this.Zn=this.ao=this.$n=this.bo=null;this.Za=this.zg=this.cj=-1;this.u=NaN;this.F=null;this.valid=!1;this.finish=this.Il=NaN;this.Dj=0;this.dv=this.ev=null}
la(Jt,vq);function Lt(a,b){return a.index-b.index}function Et(a,b){if(!a.Zn){for(var c=[],d=ba(a.destinationEdgesArrayAccess),e=d.next();!e.done;e=d.next())e=e.value,e.valid&&c.push(e);a.Zn=c}a=ba(a.Zn);for(c=a.next();!c.done;c=a.next())if(c=c.value,c.toVertex===b)return c;C("Unable to find destination edge to given vertex")}function Bt(a){if(!a.bo){for(var b=[],c=ba(a.sourceEdgesArrayAccess),d=c.next();!d.done;d=c.next())d=d.value,d.valid&&b.push(d.fromVertex);b.sort(Lt);a.bo=b}return a.bo}
function Dt(a){if(!a.$n){for(var b=[],c=ba(a.destinationEdgesArrayAccess),d=c.next();!d.done;d=c.next())d=d.value,d.valid&&b.push(d.toVertex);b.sort(Lt);a.$n=b}return a.$n}Jt.prototype.Al=function(a){vq.prototype.Al.call(this,a);this.ao=this.bo=null};Jt.prototype.Hl=function(a){vq.prototype.Hl.call(this,a);this.ao=this.bo=null};Jt.prototype.xl=function(a){vq.prototype.xl.call(this,a);this.Zn=this.$n=null};Jt.prototype.Gl=function(a){vq.prototype.Gl.call(this,a);this.Zn=this.$n=null};
ma.Object.defineProperties(Jt.prototype,{layer:{get:function(){return this.cj},set:function(a){this.cj!==a&&(this.cj=a)}},column:{get:function(){return this.zg},set:function(a){this.zg!==a&&(this.zg=a)}},index:{get:function(){return this.Za},set:function(a){this.Za!==a&&(this.Za=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)}}});Jt.prototype.deleteDestinationEdge=Jt.prototype.Gl;Jt.prototype.addDestinationEdge=Jt.prototype.xl;Jt.prototype.deleteSourceEdge=Jt.prototype.Hl;Jt.prototype.addSourceEdge=Jt.prototype.Al;Jt.className="LayeredDigraphVertex";function Kt(a){wq.call(this,a);this.j=this.ga=this.Ha=!1;this.V=this.u=NaN;this.F=this.m=0}la(Kt,wq);
ma.Object.defineProperties(Kt.prototype,{fromVertex:{get:function(){return this.ed},set:function(a){this.ed!==a&&(this.ed=a)}},toVertex:{get:function(){return this.ld},set:function(a){this.ld!==a&&(this.ld=a)}},valid:{get:function(){return this.Ha},set:function(a){this.Ha!==a&&(this.Ha=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.V},set:function(a){this.V!==a&&(this.V=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)}}});Kt.className="LayeredDigraphEdge";function Mt(a){ti.call(this);this.Sb=new H;this.Vn=Nt;this.sd=Ot;this.uo=Pt;this.xq=Qt;this.Yv=[];this.qd=!0;this.Ob=Rt;this.Yd=(new L(10,10)).freeze();var b=new St(this);this.W=new Tt(b);this.Y=new Tt(b);this.qu=[];a&&Object.assign(this,a)}la(Mt,ti);
Mt.prototype.cloneProtected=function(a){ti.prototype.cloneProtected.call(this,a);a.Vn=this.Vn;a.uo=this.uo;a.xq=this.xq;a.qd=this.qd;a.Ob=this.Ob;a.Yd.assign(this.Yd);a.W.copyInheritedPropertiesFrom(this.W);a.Y.copyInheritedPropertiesFrom(this.Y)};
Mt.prototype.rb=function(a){a.classType===Mt?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):ti.prototype.rb.call(this,a)};Mt.prototype.createNetwork=function(){return new St(this)};
Mt.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.kg(a.nodes,!0,b),c.kg(a.links,!0,b)):a instanceof pf?c.kg(a.memberParts,!1,b):c.kg(a.iterator,!1,b);return c};
Mt.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));this.arrangement!==Ut&&(this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin));var b=this.diagram;null===b&&a instanceof Q&&(b=a);this.path===Nt&&null!==b?this.sd=b.isTreePathToChildren?Ot:Vt:this.sd=this.path===Nt?Ot:this.path;if(0<this.network.vertexes.count){this.network.Jo();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.Sb.count){a=
new H;for(b=this.Sb.iterator;b.next();){var c=b.value;c instanceof V?(c=this.network.ji(c),null!==c&&a.add(c)):c instanceof Tt&&a.add(c)}this.Sb=a}0===this.Sb.count&&this.findRoots();for(a=this.Sb.copy().iterator;a.next();)b=a.value,b.initialized||(b.initialized=!0,Wt(this,b));b=this.network.vertexes;for(a=null;a=Xt(b),0<a.count;)b=Yt(this,a),null!==b&&this.Sb.add(b),b.initialized=!0,Wt(this,b),b=a;for(a=this.Sb.iterator;a.next();)b=a.value,b instanceof Tt&&Zt(this,b);for(a=this.Sb.iterator;a.next();)b=
a.value,b instanceof Tt&&$t(this,b);for(a=this.Sb.iterator;a.next();)b=a.value,b instanceof Tt&&au(this,b);this.Bu();if(this.layerStyle===bu){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.Yv=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===cu)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.Sb.iterator;a.next();)b=a.value,b instanceof Tt&&this.layoutTree(b);this.arrangeTrees();this.updateParts()}this.network=null;this.Sb=new H;this.isValidLayout=!0};function Xt(a){var b=new H;for(a=a.iterator;a.next();){var c=a.value;c.initialized||b.add(c)}return b}
Mt.prototype.findRoots=function(){for(var a=this.network.vertexes,b=a.iterator;b.next();){var c=b.value;switch(this.sd){case Ot:0===c.sourceEdges.count&&this.Sb.add(c);break;case Vt:0===c.destinationEdges.count&&this.Sb.add(c);break;default:C("Unhandled path value "+this.sd.toString())}}0===this.Sb.count&&(a=Yt(this,a),null!==a&&this.Sb.add(a))};
function Yt(a,b){var c=999999,d=null;for(b=b.iterator;b.next();){var e=b.value;switch(a.sd){case Ot:e.sourceEdges.count<c&&(c=e.sourceEdges.count,d=e);break;case Vt:e.destinationEdges.count<c&&(c=e.destinationEdges.count,d=e);break;default:C("Unhandled path value "+a.sd.toString())}}return d}
function Wt(a,b){if(null!==b){switch(a.sd){case Ot:if(0<b.destinationEdges.count){for(var c=new F,d=b.destinationVertexes;d.next();){var e=d.value;du(a,b,e)&&c.add(e)}0<c.count&&(b.children=c.Fa())}break;case Vt:if(0<b.sourceEdges.count){c=new F;for(d=b.sourceVertexes;d.next();)e=d.value,du(a,b,e)&&c.add(e);0<c.count&&(b.children=c.Fa())}break;default:C("Unhandled path value"+a.sd.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.Sb.remove(f)}for(b=
0;b<d;b++)Wt(a,c[b])}}function du(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}Mt.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 Zt(a,b){if(null!==b){a.initializeTreeVertexValues(b);b.alignment===eu&&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];Zt(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 fu(a,b){switch(a.uo){default:case Pt:return null!==b.parent?b.parent:a.W;case gu:return null===b.parent?a.W:null===b.parent.parent?a.Y:b.parent;case hu:return null!==b.parent?null!==b.parent.parent?b.parent.parent:a.Y:a.W;case iu: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.W}}
Mt.prototype.initializeTreeVertexValues=function(a){a.copyInheritedPropertiesFrom(fu(this,a));if(null!==a.parent&&a.parent.alignment===eu){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 $t(a,b){if(null!==b){a.assignTreeVertexValues(b);b=b.children;for(var c=b.length,d=0;d<c;d++)$t(a,b[d])}}Mt.prototype.assignTreeVertexValues=function(){};
function au(a,b){if(null!==b){b.alignment!==eu&&a.sortTreeVertexChildren(b);b=b.children;for(var c=b.length,d=0;d<c;d++)au(a,b[d])}}Mt.prototype.sortTreeVertexChildren=function(a){switch(a.sorting){case ju:break;case ku:a.children.reverse();break;case lu:a.children.sort(a.comparer);break;case mu:a.children.sort(a.comparer);a.children.reverse();break;default:C("Unhandled sorting value "+a.sorting.toString())}};Mt.prototype.Bu=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)};
Mt.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=nu(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.Ku();l.next();){var m=l.value;"Comment"===m.category&&m.canLayout()&&(null===a.comments&&(a.comments=[]),a.comments.push(m),m.Va(),m=m.measuredBounds,b&&!c||!e&&!d&&c||e&&d&&c?(f=Math.max(f,m.width),g+=m.height+Math.abs(h)):(f+=m.width+Math.abs(h),g=Math.max(g,
m.height)),h=k)}null!==a.comments&&(b&&!c||!e&&!d&&c||e&&d&&c?(f+=Math.abs(a.commentMargin),g=Math.max(0,g-a.height)):(g+=Math.abs(a.commentMargin),f=Math.max(0,f-a.width)),e=N.allocAt(0,0,a.bounds.width+f,a.bounds.height+g),a.bounds=e,N.free(e))};function nu(a){return a===ou||a===eu||a===ru||a===su}function tu(a){return a===ou||a===eu}
function uu(a){var b=a.parent;if(null!==b){var c=b.alignment;if(nu(c)){if(tu(c)){b=b.children;for(c=0;c<b.length&&a!==b[c];)c++;return 0===c%2}if(c===ru)return!0}}return!1}
Mt.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=nu(f));d=90===d||270===d;c=90===e||270===e;for(var g=0===a.childrenCount,h=uu(a),k=0,l=a.comments,m=l.length,n=J.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.Nd();r.next();){var u=r.value;u.fromSpot=
ad;u.toSpot=bd}else for(n.h(a.bounds.x+2*a.focus.x-a.commentMargin,a.bounds.y+k),r.move(n),r=r.Nd();r.next();)u=r.value,u.fromSpot=bd,u.toSpot=ad;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.Nd();r.next();)u=r.value,u.fromSpot=bd,u.toSpot=ad;else for(n.h(a.bounds.x+a.commentMargin-q.width,a.bounds.y+k),r.move(n),r=r.Nd();r.next();)u=r.value,u.fromSpot=ad,u.toSpot=bd;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.Nd();r.next();)u=r.value,u.fromSpot=$c,u.toSpot=cd;else for(n.h(a.bounds.x+k,a.bounds.y+2*a.focus.y-a.commentMargin),r.move(n),r=r.Nd();r.next();)u=r.value,u.fromSpot=cd,u.toSpot=$c;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.Nd();r.next();)u=r.value,u.fromSpot=cd,u.toSpot=$c;else for(n.h(a.bounds.x+k,a.bounds.y+a.commentMargin-q.height),
r.move(n),r=r.Nd();r.next();)u=r.value,u.fromSpot=$c,u.toSpot=cd;k=0<=a.commentSpacing?k+(q.width+a.commentSpacing):k+(a.commentSpacing-q.width)}}J.free(n);b=k-a.commentSpacing-(d?b.height:b.width);if(this.sd===Ot)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)}};
Mt.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 vu:wu(this,a);break;case xu:if(a.alignment===eu)wu(this,a);else if(0===a.childrenCount)d=a.parent,c=!1,b=0,null!==d&&(b=d.angle,c=d.alignment,c=nu(c)),d=uu(a),a.S.h(0,0),a.Da.h(a.width,a.height),null===a.parent||null===a.comments||(180!==b&&270!==b||c)&&!d?a.la.h(0,0):180===b&&!c||(90===b||270===b)&&d?a.la.h(a.width-2*a.focus.x,0):a.la.h(0,a.height-2*a.focus.y),
a.Vo=null,a.hp=null;else{var e=yu(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.Da.width:d.Da.height);var k=a.alignment;d=k===zu;var l=k===Au,m=nu(k),n=Math.max(0,a.breadthLimit);c=this.computeLayerSpacing(a);var p=a.nodeSpacing,r=this.computeNodeIndent(a),q=a.rowSpacing,u=0;if(d||l||a.gm||a.hm&&1===a.maxGenerationCount)u=Math.max(0,a.rowIndent);d=a.width;var w=a.height,v=0,y=0,z=0,A=null,B=null,D=0,M=0,S=0,R=0,I=0,G=0,ca=0,X=0;m&&!tu(k)&&135<e&&g.reverse();
if(tu(k))if(1<h)for(var na=0;na<h;na++)0===na%2&&na!==h-1&&(X=Math.max(X,b?g[na].Da.width:g[na].Da.height));else 1===h&&(X=b?g[0].Da.width:g[0].Da.height);if(m){switch(k){case ou:y=135>e?Bu(this,a,g,X,v,y):Cu(this,a,g,X,v,y);X=y.x;v=y.width;y=y.height;break;case ru:for(A=0;A<h;A++)B=g[A],n=B.Da,z=0===G?0:q,b?(B.S.h(f-n.width,R+z),v=Math.max(v,n.width),y=Math.max(y,R+z+n.height),R+=z+n.height):(B.S.h(S+z,f-n.height),v=Math.max(v,S+z+n.width),y=Math.max(y,n.height),S+=z+n.width),G++;break;case su:for(A=
0;A<h;A++)B=g[A],f=B.Da,n=0===G?0:q,b?(B.S.h(p/2+a.focus.x,R+n),v=Math.max(v,f.width),y=Math.max(y,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),y=Math.max(y,f.height),S+=n+f.width),G++}A=Du(this,2);B=Du(this,2);b?(A[0].h(0,0),A[1].h(0,y),B[0].h(v,0)):(A[0].h(0,0),A[1].h(v,0),B[0].h(0,y));B[1].h(v,y)}else for(na=0;na<h;na++){var wa=g[na],db=wa.Da;if(b){0<n&&0<G&&S+p+db.width>n&&(S<f&&Eu(a,k,f-S,0,ca,na-1),I++,G=0,ca=na,z=y,S=0,R=135<e?-y-q:y+q);Fu(this,wa,0,R);var gb=
0;if(0===G){if(A=wa.Vo,B=wa.hp,D=db.width,M=db.height,null===A||null===B||e!==yu(wa))A=Du(this,2),B=Du(this,2),A[0].h(0,0),A[1].h(0,M),B[0].h(D,0),B[1].h(D,M)}else{var Db=Ea();M=Gu(this,a,wa,A,B,D,M,Db);gb=M.x;A=Db[0];B=Db[1];D=M.width;M=M.height;Ga(Db);S<db.width&&0>gb&&(Hu(a,-gb,0,ca,na-1),Iu(A,-gb,0),Iu(B,-gb,0),gb=0)}wa.S.h(gb,R);v=Math.max(v,D);y=Math.max(y,z+(0===I?0:q)+db.height);S=D}else{0<n&&0<G&&R+p+db.height>n&&(R<f&&Eu(a,k,0,f-R,ca,na-1),I++,G=0,ca=na,z=v,R=0,S=135<e?-v-q:v+q);Fu(this,
wa,S,0);gb=0;if(0===G){if(A=wa.Vo,B=wa.hp,D=db.width,M=db.height,null===A||null===B||e!==yu(wa))A=Du(this,2),B=Du(this,2),A[0].h(0,0),A[1].h(D,0),B[0].h(0,M),B[1].h(D,M)}else Db=Ea(),M=Gu(this,a,wa,A,B,D,M,Db),gb=M.x,A=Db[0],B=Db[1],D=M.width,M=M.height,Ga(Db),R<db.height&&0>gb&&(Hu(a,0,-gb,ca,na-1),Iu(A,0,-gb),Iu(B,0,-gb),gb=0);wa.S.h(S,gb);y=Math.max(y,M);v=Math.max(v,z+(0===I?0:q)+db.width);R=M}G++}0<I&&(b?(y+=Math.max(0,c),S<v&&Eu(a,k,v-S,0,ca,h-1),0<u&&(l||Hu(a,u,0,0,h-1),v+=u)):(v+=Math.max(0,
c),R<y&&Eu(a,k,0,y-R,ca,h-1),0<u&&(l||Hu(a,0,u,0,h-1),y+=u)));u=l=0;switch(k){case Ju:b?l+=v/2-a.focus.x-r/2:u+=y/2-a.focus.y-r/2;break;case Ku:0<I?b?l+=v/2-a.focus.x-r/2:u+=y/2-a.focus.y-r/2:b?(X=g[0].S.x+g[0].la.x,l+=X+(g[h-1].S.x+g[h-1].la.x+2*g[h-1].focus.x-X)/2-a.focus.x-r/2):(X=g[0].S.y+g[0].la.y,u+=X+(g[h-1].S.y+g[h-1].la.y+2*g[h-1].focus.y-X)/2-a.focus.y-r/2);break;case zu:b?(l-=r,v+=r):(u-=r,y+=r);break;case Au:b?(l+=v-a.width+r,v+=r):(u+=y-a.height+r,y+=r);break;case ou:b?1<h?l+=X+p/2-a.focus.x:
l+=g[0].focus.x-a.focus.x+g[0].la.x:1<h?u+=X+p/2-a.focus.y:u+=g[0].focus.y-a.focus.y+g[0].la.y;break;case ru:b?l+=v+p/2-a.focus.x:u+=y+p/2-a.focus.y;break;case su:break;default:y=this.customAlignment(a,l,u,v,y),l=y[0],u=y[1],v=y[2],y=y[3]}for(r=0;r<h;r++)X=g[r],b?X.S.h(X.S.x+X.la.x-l,X.S.y+(135<e?(m?-y:-X.Da.height)+X.la.y-c:w+c+X.la.y)):X.S.h(X.S.x+(135<e?(m?-v:-X.Da.width)+X.la.x-c:d+c+X.la.x),X.S.y+X.la.y-u);h=g=0;m?b?(v=Lu(a,v,l),0>l&&(l=0),135<e&&(u+=y+c),y+=w+c,k===su&&(g+=p/2+a.focus.x),h+=
w+c):(135<e&&(l+=v+c),v+=d+c,y=Mu(a,y,u),0>u&&(u=0),k===su&&(h+=p/2+a.focus.y),g+=d+c):b?(null===a.comments?d>v&&(v=Nu(k,d-v,0),g=v.x,h=v.y,v=d,l=0):v=Lu(a,v,l),0>l&&(g-=l,l=0),135<e&&(u+=y+c),y=Math.max(Math.max(y,w),y+w+c),h+=w+c):(135<e&&(l+=v+c),v=Math.max(Math.max(v,d),v+d+c),null===a.comments?w>y&&(y=Nu(k,0,w-y),g=y.x,h=y.y,y=w,u=0):y=Mu(a,y,u),0>u&&(h-=u,u=0),g+=d+c);if(0<I)e=Du(this,4),I=Du(this,4),b?(e[2].h(0,w+c),e[3].h(e[2].x,y),I[2].h(v,e[2].y),I[3].h(I[2].x,e[3].y)):(e[2].h(d+c,0),e[3].h(v,
e[2].y),I[2].h(e[2].x,y),I[3].h(e[3].x,I[2].y));else{e=Du(this,A.length+2);I=Du(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],I[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])),I[0].h(l+d,0),I[1].h(I[0].x,w),I[2].y<I[1].y&&(I[2].x<I[0].x?I[2].assign(I[1]):I[1].assign(I[2])),I[3].y<I[2].y&&(I[3].x<I[0].x?I[3].assign(I[2]):
I[2].assign(I[3])),e[2].y-=c/2,I[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])),I[0].h(0,u+w),I[1].h(d,I[0].y),I[2].x<I[1].x&&(I[2].y<I[0].y?I[2].assign(I[1]):I[1].assign(I[2])),I[3].x<I[2].x&&(I[3].y<I[0].y?I[3].assign(I[2]):I[2].assign(I[3])),e[2].x-=c/2,I[2].x-=c/2);Ou(this,A);Ou(this,B);a.Vo=e;a.hp=I;a.la.h(l,u);a.Da.h(v,y)}break;default:C("Unhandled compaction value "+
a.compaction.toString())}}};
function wu(a,b){if(0===b.childrenCount){var c=!1,d=0;null!==b.parent&&(d=b.parent.angle,c=b.parent.alignment,c=nu(c));var e=uu(b);b.S.h(0,0);b.Da.h(b.width,b.height);null===b.parent||null===b.comments||(180!==d&&270!==d||c)&&!e?b.la.h(0,0):180===d&&!c||(90===d||270===d)&&e?b.la.h(b.width-2*b.focus.x,0):b.la.h(0,b.height-2*b.focus.y)}else{d=yu(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.Da.width:k.Da.height)}var l=b.alignment,m=l===zu,n=l===
Au;h=nu(l);var p=Math.max(0,b.breadthLimit);k=a.computeLayerSpacing(b);var r=b.nodeSpacing,q=a.computeNodeIndent(b),u=m||n?0:q/2,w=b.rowSpacing,v=0;if(m||n||b.gm||b.hm&&1===b.maxGenerationCount)v=Math.max(0,b.rowIndent);m=b.width;var y=b.height,z=0,A=0,B=0,D=0,M=0,S=0,R=0,I=0,G=0,ca=0;h&&!tu(l)&&135<d&&e.reverse();if(tu(l))if(1<g)for(var X=0;X<g;X++){var na=e[X],wa=na.Da;0===X%2&&X!==g-1?G=Math.max(G,(c?wa.width:wa.height)+a.computeBusNodeSpacing(na)-r):0!==X%2&&(ca=Math.max(ca,(c?wa.width:wa.height)+
a.computeBusNodeSpacing(na)-r))}else 1===g&&(G=c?e[0].Da.width:e[0].Da.height);if(h)switch(l){case ou:case eu:A=135>d?Bu(a,b,e,G,z,A):Cu(a,b,e,G,z,A);G=A.x;z=A.width;A=A.height;break;case ru:for(p=0;p<g;p++)u=e[p],B=u.Da,ca=0===R?0:w,c?(u.S.h(f-B.width,M+ca),z=Math.max(z,B.width),A=Math.max(A,M+ca+B.height),M+=ca+B.height):(u.S.h(D+ca,f-B.height),z=Math.max(z,D+ca+B.width),A=Math.max(A,B.height),D+=ca+B.width),R++;break;case su:for(f=0;f<g;f++)p=e[f],u=p.Da,B=0===R?0:w,c?(p.S.h(r/2+b.focus.x,M+B),
z=Math.max(z,u.width),A=Math.max(A,M+B+u.height),M+=B+u.height):(p.S.h(D+B,r/2+b.focus.y),z=Math.max(z,D+B+u.width),A=Math.max(A,u.height),D+=B+u.width),R++}else for(ca=0;ca<g;ca++)X=e[ca],na=X.Da,c?(0<p&&0<R&&D+r+na.width>p&&(D<f&&Eu(b,l,f-D,0,I,ca-1),S++,R=0,I=ca,B=A,D=0,M=135<d?-A-w:A+w),wa=0===R?u:r,Fu(a,X,0,M),X.S.h(D+wa,M),z=Math.max(z,D+wa+na.width),A=Math.max(A,B+(0===S?0:w)+na.height),D+=wa+na.width):(0<p&&0<R&&M+r+na.height>p&&(M<f&&Eu(b,l,0,f-M,I,ca-1),S++,R=0,I=ca,B=z,M=0,D=135<d?-z-w:
z+w),wa=0===R?u:r,Fu(a,X,D,0),X.S.h(D,M+wa),A=Math.max(A,M+wa+na.height),z=Math.max(z,B+(0===S?0:w)+na.width),M+=wa+na.height),R++;0<S&&(c?(A+=Math.max(0,k),D<z&&Eu(b,l,z-D,0,I,g-1),0<v&&(n||Hu(b,v,0,0,g-1),z+=v)):(z+=Math.max(0,k),M<A&&Eu(b,l,0,A-M,I,g-1),0<v&&(n||Hu(b,0,v,0,g-1),A+=v)));v=n=0;switch(l){case Ju:c?n+=z/2-b.focus.x-q/2:v+=A/2-b.focus.y-q/2;break;case Ku:0<S?c?n+=z/2-b.focus.x-q/2:v+=A/2-b.focus.y-q/2:c?(a=e[0].S.x+e[0].la.x,n+=a+(e[g-1].S.x+e[g-1].la.x+2*e[g-1].focus.x-a)/2-b.focus.x-
q/2):(a=e[0].S.y+e[0].la.y,v+=a+(e[g-1].S.y+e[g-1].la.y+2*e[g-1].focus.y-a)/2-b.focus.y-q/2);break;case zu:c?(n-=q,z+=q):(v-=q,A+=q);break;case Au:c?(n+=z-b.width+q,z+=q):(v+=A-b.height+q,A+=q);break;case ou:case eu:c?1<g?n+=G+r/2-b.focus.x:n+=e[0].focus.x-b.focus.x+e[0].la.x:1<g?v+=G+r/2-b.focus.y:v+=e[0].focus.y-b.focus.y+e[0].la.y;break;case ru:c?n+=z+r/2-b.focus.x:v+=A+r/2-b.focus.y;break;case su:break;default:a=a.customAlignment(b,n,v,z,A),n=a[0],v=a[1],z=a[2],A=a[3]}for(a=0;a<g;a++)q=e[a],c?
q.S.h(q.S.x+q.la.x-n,q.S.y+(135<d?(h?-A:-q.Da.height)+q.la.y-k:y+k+q.la.y)):q.S.h(q.S.x+(135<d?(h?-z:-q.Da.width)+q.la.x-k:m+k+q.la.x),q.S.y+q.la.y-v);c?(z=Lu(b,z,n),0>n&&(n=0),135<d&&(v+=A+k),A=Math.max(Math.max(A,y),A+y+k)):(135<d&&(n+=z+k),z=Math.max(Math.max(z,m),z+m+k),A=Mu(b,A,v),0>v&&(v=0));b.la.h(n,v);b.Da.h(z,A)}}Mt.prototype.customAlignment=function(a,b,c,d,e){return[b,c,d,e]};
function Bu(a,b,c,d,e,f){var g=c.length;if(0===g)return new N(d,0,e,f);if(1===g)return b=c[0],e=b.Da.width,f=b.Da.height,new N(d,0,e,f);for(var h=b.nodeSpacing,k=b.rowSpacing,l=90===yu(b),m=0,n=0,p=0,r=0;r<g;r++)if(!(0!==r%2||1<g&&r===g-1)){var q=c[r],u=q.Da,w=0===m?0:k;if(l){var v=a.computeBusNodeSpacing(q)-h;q.S.h(d-(u.width+v),p+w);e=Math.max(e,u.width+v);f=Math.max(f,p+w+u.height);p+=w+u.height}else v=a.computeBusNodeSpacing(q)-h,q.S.h(n+w,d-(u.height+v)),f=Math.max(f,u.height+v),e=Math.max(e,
n+w+u.width),n+=w+u.width;m++}m=0;q=n;r=p;l?(n=d+h,p=0):(n=0,p=d+h);for(u=0;u<g;u++)if(0!==u%2){w=c[u];v=w.Da;var y=0===m?0:k;if(l){var z=a.computeBusNodeSpacing(w)-h;w.S.h(n+z,p+y);e=Math.max(e,n+v.width+z);f=Math.max(f,p+y+v.height);p+=y+v.height}else z=a.computeBusNodeSpacing(w)-h,w.S.h(n+y,p+z),e=Math.max(e,n+y+v.width),f=Math.max(f,p+v.height+z),n+=y+v.width;m++}1<g&&1===g%2&&(c=c[g-1],g=c.Da,a=a.computeBusLastRowSpacing(c,l?Math.max(Math.abs(r),Math.abs(p)):Math.max(Math.abs(q),Math.abs(n))),
l?(c.S.h(d+h/2-c.focus.x-c.la.x,f+a),l=d+h/2-c.focus.x-c.la.x,e=Math.max(e,l+g.width),0>l&&(e-=l),f=Math.max(f,Math.max(r,p)+a+g.height),0>c.S.x&&(d=Pu(b,c.S.x,!1,d,h))):(c.S.h(e+a,d+h/2-c.focus.y-c.la.y),e=Math.max(e,Math.max(q,n)+a+g.width),p=d+h/2-c.focus.y-c.la.y,f=Math.max(f,p+g.height),0>p&&(f-=p),0>c.S.y&&(d=Pu(b,c.S.y,!0,d,h))));return new N(d,0,e,f)}
function Cu(a,b,c,d,e,f){var g=c.length;if(0===g)return new N(d,0,e,f);if(1===g)return c=c[0],e=c.Da.width,f=c.Da.height,new N(d,0,e,f);for(var h=b.nodeSpacing,k=b.rowSpacing,l=270===yu(b),m=0,n=0,p=0,r=0;r<g;r++)if(!(0!==r%2||1<g&&r===g-1)){var q=c[r],u=q.Da,w=0===m?0:k;if(l){var v=a.computeBusNodeSpacing(q)-h;p-=w+u.height;q.S.h(d-(u.width+v),p);e=Math.max(e,u.width+v);f=Math.max(f,Math.abs(p))}else v=a.computeBusNodeSpacing(q)-h,n-=w+u.width,q.S.h(n,d-(u.height+v)),f=Math.max(f,u.height+v),e=Math.max(e,
Math.abs(n));m++}m=0;q=n;r=p;l?(n=d+h,p=0):(n=0,p=d+h);for(u=0;u<g;u++)if(0!==u%2){w=c[u];v=w.Da;var y=0===m?0:k;if(l){var z=a.computeBusNodeSpacing(w)-h;p-=y+v.height;w.S.h(n+z,p);e=Math.max(e,n+v.width+z);f=Math.max(f,Math.abs(p))}else z=a.computeBusNodeSpacing(w)-h,n-=y+v.width,w.S.h(n,p+z),f=Math.max(f,p+v.height+z),e=Math.max(e,Math.abs(n));m++}1<g&&1===g%2&&(k=c[g-1],m=k.Da,a=a.computeBusLastRowSpacing(k,l?Math.max(Math.abs(r),Math.abs(p)):Math.max(Math.abs(q),Math.abs(n))),l?(k.S.h(d+h/2-k.focus.x-
k.la.x,-f-m.height-a),n=d+h/2-k.focus.x-k.la.x,e=Math.max(e,n+m.width),0>n&&(e-=n),f=Math.max(f,Math.abs(Math.min(r,p))+a+m.height),0>k.S.x&&(d=Pu(b,k.S.x,!1,d,h))):(k.S.h(-e-m.width-a,d+h/2-k.focus.y-k.la.y),e=Math.max(e,Math.abs(Math.min(q,n))+a+m.width),p=d+h/2-k.focus.y-k.la.y,f=Math.max(f,p+m.height),0>p&&(f-=p),0>k.S.y&&(d=Pu(b,k.S.y,!0,d,h))));for(b=0;b<g;b++)h=c[b],l?h.S.h(h.S.x,h.S.y+f):h.S.h(h.S.x+e,h.S.y);return new N(d,0,e,f)}
Mt.prototype.computeBusNodeSpacing=function(a){return null===a.parent?0:a.parent.nodeSpacing};Mt.prototype.computeBusLastRowSpacing=function(a){return null===a.parent?0:a.parent.rowSpacing};function Pu(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.la.y+b.focus.y-e/2:b.la.x+b.focus.x-e/2)}
function Lu(a,b,c){switch(a.alignment){case Ku:case Ju:return c+a.width>b&&(b=c+a.width),0>c&&(b-=c),b;case zu:return a.width>b?a.width:b;case Au:return 2*a.focus.x>b?a.width:b+a.width-2*a.focus.x;case ou:case eu:return Math.max(a.width,Math.max(b,c+a.width)-Math.min(0,c));case ru:return a.width-a.focus.x+a.nodeSpacing/2+b;case su:return Math.max(a.width,a.focus.x+a.nodeSpacing/2+b);default:return b}}
function Mu(a,b,c){switch(a.alignment){case Ku:case Ju:return c+a.height>b&&(b=c+a.height),0>c&&(b-=c),b;case zu:return a.height>b?a.height:b;case Au:return 2*a.focus.y>b?a.height:b+a.height-2*a.focus.y;case ou:case eu:return Math.max(a.height,Math.max(b,c+a.height)-Math.min(0,c));case ru:return a.height-a.focus.y+a.nodeSpacing/2+b;case su:return Math.max(a.height,a.focus.y+a.nodeSpacing/2+b);default:return b}}
function Nu(a,b,c){switch(a){case Ju:b/=2;c/=2;break;case Ku:b/=2;c/=2;break;case zu:c=b=0;break;case Au:break;default:C("Unhandled alignment value "+a.toString())}return new J(b,c)}function Eu(a,b,c,d,e,f){b=Nu(b,c,d);Hu(a,b.x,b.y,e,f)}function Hu(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 Fu(a,b,c,d){var e=b.parent;switch(a.sd){case Ot:for(a=b.sourceEdges;a.next();)b=a.value,b.fromVertex===e&&b.relativePoint.h(c,d);break;case Vt:for(a=b.destinationEdges;a.next();)b=a.value,b.toVertex===e&&b.relativePoint.h(c,d);break;default:C("Unhandled path value "+a.sd.toString())}}function Iu(a,b,c){for(var d=0;d<a.length;d++){var e=a[d];e.x+=b;e.y+=c}}
function Gu(a,b,c,d,e,f,g,h){var k=yu(b),l=90===k||270===k,m=b.nodeSpacing;b=d;var n=e;d=f;var p=g,r=c.Vo,q=c.hp;g=c.Da;var u=l?Math.max(p,g.height):Math.max(d,g.width);if(null===r||k!==yu(c))r=Du(a,2),q=Du(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 y=w;w=y.x;y=y.y;e+1<r.length&&(y=r[e+1],w=y.x,y=y.y,w+=d);var z=p;f.y===l?z=k-f.x:f.y>l&&f.y<y?z=k+(f.y-l)/(y-l)*(w-k)-f.x:l>f.y&&l<v.y&&(z=k-(f.x+(l-f.y)/(v.y-f.y)*(v.x-f.x)));z<p&&(p=z);v.y<=f.y?c++:y<=l?e++:(v.y<=y&&c++,y<=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=Du(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=Du(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);Ou(a,m);d=c}f=q;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=Du(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=Du(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);Ou(a,m);e=f}f=
Math.max(0,p)+g.width;g=u;Ou(a,b);Ou(a,r);Ou(a,n);Ou(a,q);h[0]=d;h[1]=e;return new N(p,0,f,g)}d=9999999;if(!(null===n||2>n.length||null===r||2>r.length))for(e=c=0;c<n.length&&e<r.length;)f=n[c],w=r[e],k=w.x,l=w.y,l+=p,v=f,c+1<n.length&&(v=n[c+1]),y=w,w=y.x,y=y.y,e+1<r.length&&(y=r[e+1],w=y.x,y=y.y,y+=p),z=d,f.x===k?z=l-f.y:f.x>k&&f.x<w?z=l+(f.x-k)/(w-k)*(y-l)-f.y:k>f.x&&k<v.x&&(z=l-(f.y+(k-f.x)/(v.x-f.x)*(v.y-f.y))),z<d&&(d=z),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=Du(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=Du(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);Ou(a,m);d=c}f=q;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=Du(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=Du(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);Ou(a,m);e=f}f=u;g=Math.max(0,p)+g.height;Ou(a,b);Ou(a,r);Ou(a,n);Ou(a,q);h[0]=d;h[1]=e;return new N(p,0,f,g)}function Du(a,b){a=a.qu[b];if(void 0!==a&&(a=a.pop(),void 0!==a))return a;a=[];for(var c=0;c<b;c++)a[c]=new J;return a}
function Ou(a,b){var c=b.length,d=a.qu[c];void 0===d&&(d=[],a.qu[c]=d);d.push(b)}
Mt.prototype.arrangeTrees=function(){if(this.Ob===Ut)for(var a=this.Sb.iterator;a.next();){var b=a.value;if(b instanceof Tt){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);Qu(this,b,c,d)}}}else{a=[];for(b=this.Sb.iterator;b.next();)c=b.value,c instanceof Tt&&a.push(c);switch(this.sorting){case ju:break;case ku:a.reverse();break;case lu:a.sort(this.comparer);break;case mu: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];Qu(this,e,b+e.la.x,c+e.la.y);switch(this.Ob){case Rt:c+=e.Da.height+this.Yd.height;break;case Ru:b+=e.Da.width+this.Yd.width;break;default:C("Unhandled arrangement value "+this.Ob.toString())}}}};function Qu(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];Qu(a,g,c+g.S.x,d+g.S.y)}}}Mt.prototype.commitLayout=function(){this.wv();this.commitNodes();this.Eu();this.isRouting&&this.commitLinks()};
Mt.prototype.commitNodes=function(){for(var a=this.network.vertexes.iterator;a.next();)a.value.commit();for(a.reset();a.next();)this.layoutComments(a.value)};
Mt.prototype.Eu=function(){if(this.layerStyle===bu){for(var a=this.Yv,b=[],c=null,d=this.network.vertexes.iterator;d.next();){var e=d.value;null===c?c=e.bounds.copy():c.ad(e.bounds);var f=b[e.level];void 0===f?f=this.computeLayerSpacing(e):f=Math.max(f,this.computeLayerSpacing(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.Ac(this.nodeSpacing/2,this.layerSpacing),d=new J(-this.nodeSpacing/2,-this.layerSpacing/2)):(c.Ac(this.layerSpacing,this.nodeSpacing/
2),d=new J(-this.layerSpacing/2,-this.nodeSpacing/2));e=[];c=90===this.angle||270===this.angle?c.width:c.height;f=0;if(180===this.angle||270===this.angle)for(var g=0;g<a.length;g++)f+=a[g]+b[g];for(g=0;g<a.length;g++){var h=a[g]+b[g];270===this.angle?(f-=h,e.push(new N(0,f,c,h))):90===this.angle?(e.push(new N(0,f,c,h)),f+=h):180===this.angle?(f-=h,e.push(new N(f,0,h,c))):(e.push(new N(f,0,h,c)),f+=h)}this.commitLayers(e,d)}};Mt.prototype.commitLayers=function(){};
Mt.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};Mt.prototype.wv=function(){for(var a=this.Sb.iterator;a.next();){var b=a.value;b instanceof Tt&&Su(this,b)}};function Su(a,b){if(null!==b){a.setPortSpots(b);b=b.children;for(var c=b.length,d=0;d<c;d++)Su(a,b[d])}}
Mt.prototype.setPortSpots=function(a){var b=a.alignment;if(nu(b)){var c=this.sd===Ot,d=yu(a);switch(d){case 0:var e=bd;break;case 90:e=cd;break;case 180:e=ad;break;default:e=$c}var f=a.children,g=f.length;switch(b){case ou:case eu: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?ad:$c;if(1===g||b===g-1&&1===g%2)switch(d){case 0:k=ad;break;case 90:k=$c;break;case 180:k=bd;break;default:k=cd}else 0===b%2&&(k=90===d||270===
d?bd:cd);c?(a.setsPortSpot&&(h.fromSpot=e),a.setsChildPortSpot&&(h.toSpot=k)):(a.setsPortSpot&&(h.fromSpot=k),a.setsChildPortSpot&&(h.toSpot=e))}}break;case ru:d=90===d||270===d?bd:cd;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 su:for(d=90===d||270===d?ad:$c,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=yu(a),this.sd===Ot)for(e=a.destinationEdges;e.next();){if(d=e.value.link,null!==d){if(a.setsPortSpot)if(a.portSpot.Vb())switch(c){case 0:d.fromSpot=bd;break;case 90:d.fromSpot=cd;break;case 180:d.fromSpot=ad;break;default:d.fromSpot=$c}else d.fromSpot=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.Vb())switch(c){case 0:d.toSpot=ad;break;
case 90:d.toSpot=$c;break;case 180:d.toSpot=bd;break;default:d.toSpot=cd}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.Vb())switch(c){case 0:d.toSpot=bd;break;case 90:d.toSpot=cd;break;case 180:d.toSpot=ad;break;default:d.toSpot=$c}else d.toSpot=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.Vb())switch(c){case 0:d.fromSpot=ad;break;case 90:d.fromSpot=$c;break;case 180:d.fromSpot=bd;break;default:d.fromSpot=cd}else d.fromSpot=
a.childPortSpot}};function yu(a){a=a.angle;return 45>=a?0:135>=a?90:225>=a?180:315>=a?270:0}Mt.prototype.computeLayerSpacing=function(a){var b=yu(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};
Mt.prototype.computeNodeIndent=function(a){var b=yu(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(Mt.prototype,{roots:{get:function(){return this.Sb},set:function(a){this.Sb!==a&&(this.Sb=a,this.D())}},path:{get:function(){return this.Vn},set:function(a){this.Vn!==a&&(this.Vn=a,this.D())}},treeStyle:{get:function(){return this.uo},set:function(a){this.Ob===a||a!==Pt&&a!==hu&&a!==iu&&a!==gu||(this.uo=a,this.D())}},layerStyle:{get:function(){return this.xq},
set:function(a){this.Ob===a||a!==Qt&&a!==cu&&a!==bu||(this.xq=a,this.D())}},comments:{get:function(){return this.qd},set:function(a){this.qd!==a&&(this.qd=a,this.D())}},arrangement:{get:function(){return this.Ob},set:function(a){this.Ob===a||a!==Rt&&a!==Ru&&a!==Ut||(this.Ob=a,this.D())}},arrangementSpacing:{get:function(){return this.Yd},set:function(a){this.Yd.C(a)||(this.Yd.assign(a),this.D())}},rootDefaults:{
get:function(){return this.W},set:function(a){this.W!==a&&(this.W=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.W.sorting},set:function(a){this.W.sorting===a||a!==ju&&a!==ku&&a!==lu&&!mu||(this.W.sorting=a,this.D())}},comparer:{get:function(){return this.W.comparer},set:function(a){this.W.comparer!==
a&&(this.W.comparer=a,this.D())}},angle:{get:function(){return this.W.angle},set:function(a){this.W.angle!==a&&(0===a||90===a||180===a||270===a?(this.W.angle=a,this.D()):C("TreeLayout.angle must be 0, 90, 180, or 270"))}},alignment:{get:function(){return this.W.alignment},set:function(a){this.W.alignment!==a&&(this.W.alignment=a,this.D())}},nodeIndent:{get:function(){return this.W.nodeIndent},set:function(a){this.W.nodeIndent!==
a&&0<=a&&(this.W.nodeIndent=a,this.D())}},nodeIndentPastParent:{get:function(){return this.W.nodeIndentPastParent},set:function(a){this.W.nodeIndentPastParent!==a&&0<=a&&1>=a&&(this.W.nodeIndentPastParent=a,this.D())}},nodeSpacing:{get:function(){return this.W.nodeSpacing},set:function(a){this.W.nodeSpacing!==a&&(this.W.nodeSpacing=a,this.D())}},layerSpacing:{get:function(){return this.W.layerSpacing},set:function(a){this.W.layerSpacing!==
a&&(this.W.layerSpacing=a,this.D())}},layerSpacingParentOverlap:{get:function(){return this.W.layerSpacingParentOverlap},set:function(a){this.W.layerSpacingParentOverlap!==a&&0<=a&&1>=a&&(this.W.layerSpacingParentOverlap=a,this.D())}},compaction:{get:function(){return this.W.compaction},set:function(a){this.W.compaction===a||a!==vu&&a!==xu||(this.W.compaction=a,this.D())}},breadthLimit:{get:function(){return this.W.breadthLimit},
set:function(a){this.W.breadthLimit!==a&&0<=a&&(this.W.breadthLimit=a,this.D())}},rowSpacing:{get:function(){return this.W.rowSpacing},set:function(a){this.W.rowSpacing!==a&&(this.W.rowSpacing=a,this.D())}},rowIndent:{get:function(){return this.W.rowIndent},set:function(a){this.W.rowIndent!==a&&0<=a&&(this.W.rowIndent=a,this.D())}},commentSpacing:{get:function(){return this.W.commentSpacing},set:function(a){this.W.commentSpacing!==
a&&(this.W.commentSpacing=a,this.D())}},commentMargin:{get:function(){return this.W.commentMargin},set:function(a){this.W.commentMargin!==a&&(this.W.commentMargin=a,this.D())}},setsPortSpot:{get:function(){return this.W.setsPortSpot},set:function(a){this.W.setsPortSpot!==a&&(this.W.setsPortSpot=a,this.D())}},portSpot:{get:function(){return this.W.portSpot},set:function(a){this.W.portSpot.C(a)||(this.W.portSpot=
a,this.D())}},setsChildPortSpot:{get:function(){return this.W.setsChildPortSpot},set:function(a){this.W.setsChildPortSpot!==a&&(this.W.setsChildPortSpot=a,this.D())}},childPortSpot:{get:function(){return this.W.childPortSpot},set:function(a){this.W.childPortSpot.C(a)||(this.W.childPortSpot=a,this.D())}},alternateSorting:{get:function(){return this.Y.sorting},set:function(a){this.Y.sorting===a||a!==ju&&a!==ku&&
a!==lu&&!mu||(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!==vu&&a!==xu||(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 Nt=new E(Mt,"PathDefault",-1),Ot=new E(Mt,"PathDestination",0),Vt=new E(Mt,"PathSource",1),ju=new E(Mt,"SortingForwards",10),ku=new E(Mt,"SortingReverse",11),lu=new E(Mt,"SortingAscending",12),mu=new E(Mt,"SortingDescending",13),Ju=new E(Mt,"AlignmentCenterSubtrees",20),Ku=new E(Mt,"AlignmentCenterChildren",21),zu=new E(Mt,"AlignmentStart",22),Au=new E(Mt,"AlignmentEnd",23),ou=new E(Mt,"AlignmentBus",24),eu=new E(Mt,"AlignmentBusBranching",25),ru=new E(Mt,"AlignmentTopLeftBus",26),su=new E(Mt,
"AlignmentBottomRightBus",27),vu=new E(Mt,"CompactionNone",30),xu=new E(Mt,"CompactionBlock",31),Pt=new E(Mt,"StyleLayered",40),iu=new E(Mt,"StyleLastParents",41),hu=new E(Mt,"StyleAlternating",42),gu=new E(Mt,"StyleRootOnly",43),Rt=new E(Mt,"ArrangementVertical",50),Ru=new E(Mt,"ArrangementHorizontal",51),Ut=new E(Mt,"ArrangementFixedRoots",52),Qt=new E(Mt,"LayerIndividual",60),cu=new E(Mt,"LayerSiblings",61),bu=new E(Mt,"LayerUniform",62);Mt.className="TreeLayout";Mt.PathDefault=Nt;
Mt.PathDestination=Ot;Mt.PathSource=Vt;Mt.SortingForwards=ju;Mt.SortingReverse=ku;Mt.SortingAscending=lu;Mt.SortingDescending=mu;Mt.AlignmentCenterSubtrees=Ju;Mt.AlignmentCenterChildren=Ku;Mt.AlignmentStart=zu;Mt.AlignmentEnd=Au;Mt.AlignmentBus=ou;Mt.AlignmentBusBranching=eu;Mt.AlignmentTopLeftBus=ru;Mt.AlignmentBottomRightBus=su;Mt.CompactionNone=vu;Mt.CompactionBlock=xu;Mt.StyleLayered=Pt;Mt.StyleLastParents=iu;Mt.StyleAlternating=hu;Mt.StyleRootOnly=gu;Mt.ArrangementVertical=Rt;
Mt.ArrangementHorizontal=Ru;Mt.ArrangementFixedRoots=Ut;Mt.LayerIndividual=Qt;Mt.LayerSiblings=cu;Mt.LayerUniform=bu;function St(a){sq.call(this,a)}la(St,sq);St.prototype.createVertex=function(){return new Tt(this)};St.prototype.createEdge=function(){return new Tu(this)};St.className="TreeNetwork";
function Tt(a){vq.call(this,a);this.V=!1;this.hb=null;this.u=[];this.ob=this.Ha=this.F=this.ga=0;this.qd=null;this.S=new J(0,0);this.Da=new L(0,0);this.la=new J(0,0);this.hm=this.gm=this.pA=!1;this.hp=this.Vo=null;this.hd=ju;this.cd=Cq;this.Kb=0;this.Jb=Ku;this.Rq=this.Qq=0;this.Sq=20;this.ge=50;this.wq=0;this.Ep=xu;this.xp=0;this.jr=25;this.Dp=this.ir=10;this.Cp=20;this.tr=!0;this.$q=Sc;this.sr=!0;this.Ap=Sc}la(Tt,vq);
Tt.prototype.copyInheritedPropertiesFrom=function(a){null!==a&&(this.hd=a.sorting,this.cd=a.comparer,this.Kb=a.angle,this.Jb=a.alignment,this.Qq=a.nodeIndent,this.Rq=a.nodeIndentPastParent,this.Sq=a.nodeSpacing,this.ge=a.layerSpacing,this.wq=a.layerSpacingParentOverlap,this.Ep=a.compaction,this.xp=a.breadthLimit,this.jr=a.rowSpacing,this.ir=a.rowIndent,this.Dp=a.commentSpacing,this.Cp=a.commentMargin,this.tr=a.setsPortSpot,this.$q=a.portSpot,this.sr=a.setsChildPortSpot,this.Ap=a.childPortSpot)};
ma.Object.defineProperties(Tt.prototype,{initialized:{get:function(){return this.V},set:function(a){this.V!==a&&(this.V=a)}},parent:{get:function(){return this.hb},set:function(a){this.hb!==a&&(this.hb=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.Ha},set:function(a){this.Ha!==a&&(this.Ha=a)}},maxGenerationCount:{get:function(){return this.ob},set:function(a){this.ob!==a&&(this.ob=a)}},comments:{get:function(){return this.qd},set:function(a){if(this.qd!==a){if(null!==a)for(var b=
a.length,c=0;c<b;c++);this.qd=a}}},sorting:{get:function(){return this.hd},set:function(a){this.hd!==a&&(this.hd=a)}},comparer:{get:function(){return this.cd},set:function(a){this.cd!==a&&(this.cd=a)}},angle:{get:function(){return this.Kb},set:function(a){this.Kb!==a&&(this.Kb=a)}},alignment:{get:function(){return this.Jb},set:function(a){this.Jb!==a&&(this.Jb=a)}},nodeIndent:{
get:function(){return this.Qq},set:function(a){this.Qq!==a&&(this.Qq=a)}},nodeIndentPastParent:{get:function(){return this.Rq},set:function(a){this.Rq!==a&&(this.Rq=a)}},nodeSpacing:{get:function(){return this.Sq},set:function(a){this.Sq!==a&&(this.Sq=a)}},layerSpacing:{get:function(){return this.ge},set:function(a){this.ge!==a&&(this.ge=a)}},layerSpacingParentOverlap:{
get:function(){return this.wq},set:function(a){this.wq!==a&&(this.wq=a)}},compaction:{get:function(){return this.Ep},set:function(a){this.Ep!==a&&(this.Ep=a)}},breadthLimit:{get:function(){return this.xp},set:function(a){this.xp!==a&&(this.xp=a)}},rowSpacing:{get:function(){return this.jr},set:function(a){this.jr!==a&&(this.jr=a)}},rowIndent:{get:function(){return this.ir},set:function(a){this.ir!==
a&&(this.ir=a)}},commentSpacing:{get:function(){return this.Dp},set:function(a){this.Dp!==a&&(this.Dp=a)}},commentMargin:{get:function(){return this.Cp},set:function(a){this.Cp!==a&&(this.Cp=a)}},setsPortSpot:{get:function(){return this.tr},set:function(a){this.tr!==a&&(this.tr=a)}},portSpot:{get:function(){return this.$q},set:function(a){this.$q.C(a)||(this.$q=a)}},setsChildPortSpot:{
get:function(){return this.sr},set:function(a){this.sr!==a&&(this.sr=a)}},childPortSpot:{get:function(){return this.Ap},set:function(a){this.Ap.C(a)||(this.Ap=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.Da},set:function(a){this.Da.set(a)}},
subtreeOffset:{get:function(){return this.la},set:function(a){this.la.set(a)}}});Tt.className="TreeVertex";function Tu(a){wq.call(this,a);this.Zt=new J(0,0)}la(Tu,wq);
Tu.prototype.commit=function(){var a=this.link;if(null!==a&&!a.isAvoiding){var b=this.network.layout,c=null,d=null;switch(b.sd){case Ot:c=this.fromVertex;d=this.toVertex;break;case Vt:c=this.toVertex;d=this.fromVertex;break;default:C("Unhandled path value "+b.sd.toString())}if(null!==c&&null!==d){var e=this.Zt;if(0!==e.x||0!==e.y||c.pA){d=c.bounds;var f=yu(c),g=b.computeLayerSpacing(c),h=c.rowSpacing;a.ug();var k=a.curve===bg,l=a.isOrthogonal,m;a.sh();if(l||k){for(m=2;4<a.pointsCount;)a.pv(2);var n=
a.i(1);var p=a.i(2)}else{for(m=1;3<a.pointsCount;)a.pv(1);n=a.i(0);p=a.i(a.pointsCount-1)}var r=a.i(a.pointsCount-1);0===f?(c.alignment===Au?(f=d.bottom+e.y,0===e.y&&n.y>r.y+c.rowIndent&&(f=Math.min(f,Math.max(n.y,f-b.computeNodeIndent(c))))):c.alignment===zu?(f=d.top+e.y,0===e.y&&n.y<r.y-c.rowIndent&&(f=Math.max(f,Math.min(n.y,f+b.computeNodeIndent(c))))):f=c.gm||c.hm&&1===c.maxGenerationCount?d.top-c.la.y+e.y:d.y+d.height/2+e.y,k?(a.l(m,n.x,f),m++,a.l(m,d.right+g,f),m++,a.l(m,d.right+g+(e.x-h)/
3,f),m++,a.l(m,d.right+g+2*(e.x-h)/3,f),m++,a.l(m,d.right+g+(e.x-h),f),m++,a.l(m,p.x,f)):(l&&(a.l(m,d.right+g/2,n.y),m++),a.l(m,d.right+g/2,f),m++,a.l(m,d.right+g+e.x-(l?h/2:h),f),m++,l&&a.l(m,a.i(m-1).x,p.y))):90===f?(c.alignment===Au?(f=d.right+e.x,0===e.x&&n.x>r.x+c.rowIndent&&(f=Math.min(f,Math.max(n.x,f-b.computeNodeIndent(c))))):c.alignment===zu?(f=d.left+e.x,0===e.x&&n.x<r.x-c.rowIndent&&(f=Math.max(f,Math.min(n.x,f+b.computeNodeIndent(c))))):f=c.gm||c.hm&&1===c.maxGenerationCount?d.left-c.la.x+
e.x:d.x+d.width/2+e.x,k?(a.l(m,f,n.y),m++,a.l(m,f,d.bottom+g),m++,a.l(m,f,d.bottom+g+(e.y-h)/3),m++,a.l(m,f,d.bottom+g+2*(e.y-h)/3),m++,a.l(m,f,d.bottom+g+(e.y-h)),m++,a.l(m,f,p.y)):(l&&(a.l(m,n.x,d.bottom+g/2),m++),a.l(m,f,d.bottom+g/2),m++,a.l(m,f,d.bottom+g+e.y-(l?h/2:h)),m++,l&&a.l(m,p.x,a.i(m-1).y))):180===f?(c.alignment===Au?(f=d.bottom+e.y,0===e.y&&n.y>r.y+c.rowIndent&&(f=Math.min(f,Math.max(n.y,f-b.computeNodeIndent(c))))):c.alignment===zu?(f=d.top+e.y,0===e.y&&n.y<r.y-c.rowIndent&&(f=Math.max(f,
Math.min(n.y,f+b.computeNodeIndent(c))))):f=c.gm||c.hm&&1===c.maxGenerationCount?d.top-c.la.y+e.y:d.y+d.height/2+e.y,k?(a.l(m,n.x,f),m++,a.l(m,d.left-g,f),m++,a.l(m,d.left-g+(e.x+h)/3,f),m++,a.l(m,d.left-g+2*(e.x+h)/3,f),m++,a.l(m,d.left-g+(e.x+h),f),m++,a.l(m,p.x,f)):(l&&(a.l(m,d.left-g/2,n.y),m++),a.l(m,d.left-g/2,f),m++,a.l(m,d.left-g+e.x+(l?h/2:h),f),m++,l&&a.l(m,a.i(m-1).x,p.y))):270===f?(c.alignment===Au?(f=d.right+e.x,0===e.x&&n.x>r.x+c.rowIndent&&(f=Math.min(f,Math.max(n.x,f-b.computeNodeIndent(c))))):
c.alignment===zu?(f=d.left+e.x,0===e.x&&n.x<r.x-c.rowIndent&&(f=Math.max(f,Math.min(n.x,f+b.computeNodeIndent(c))))):f=c.gm||c.hm&&1===c.maxGenerationCount?d.left-c.la.x+e.x:d.x+d.width/2+e.x,k?(a.l(m,f,n.y),m++,a.l(m,f,d.top-g),m++,a.l(m,f,d.top-g+(e.y+h)/3),m++,a.l(m,f,d.top-g+2*(e.y+h)/3),m++,a.l(m,f,d.top-g+(e.y+h)),m++,a.l(m,f,p.y)):(l&&(a.l(m,n.x,d.top-g/2),m++),a.l(m,f,d.top-g/2),m++,a.l(m,f,d.top-g+e.y+(l?h/2:h)),m++,l&&a.l(m,p.x,a.i(m-1).y))):C("Invalid angle "+f);a.zf()}else e=d,a=this.link,
d=this.network.layout,b=yu(c),b!==yu(e)&&(g=d.computeLayerSpacing(c),h=c.bounds,c=e.bounds,0===b&&c.left-h.right<g+1||90===b&&c.top-h.bottom<g+1||180===b&&h.left-c.right<g+1||270===b&&h.top-c.bottom<g+1||(a.ug(),c=a.curve===bg,e=a.isOrthogonal,d=nu(this.fromVertex.alignment),a.sh(),0===b?(b=h.right+g/2,c?4===a.pointsCount&&(c=a.i(3).y,a.M(1,b-20,a.i(1).y),a.l(2,b-20,c),a.l(3,b,c),a.l(4,b+20,c),a.M(5,a.i(5).x,c)):e?d?a.M(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.M(2,b,a.i(2).y),a.M(3,b,a.i(3).y)):
4===a.pointsCount?a.l(2,b,a.i(2).y):3===a.pointsCount?a.M(1,b,a.i(2).y):2===a.pointsCount&&a.l(1,b,a.i(1).y)):90===b?(b=h.bottom+g/2,c?4===a.pointsCount&&(c=a.i(3).x,a.M(1,a.i(1).x,b-20),a.l(2,c,b-20),a.l(3,c,b),a.l(4,c,b+20),a.M(5,c,a.i(5).y)):e?d?a.M(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.M(2,a.i(2).x,b),a.M(3,a.i(3).x,b)):4===a.pointsCount?a.l(2,a.i(2).x,b):3===a.pointsCount?a.M(1,a.i(2).x,b):2===a.pointsCount&&a.l(1,a.i(1).x,b)):180===b?(b=h.left-g/2,c?4===a.pointsCount&&(c=a.i(3).y,a.M(1,
b+20,a.i(1).y),a.l(2,b+20,c),a.l(3,b,c),a.l(4,b-20,c),a.M(5,a.i(5).x,c)):e?d?a.M(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.M(2,b,a.i(2).y),a.M(3,b,a.i(3).y)):4===a.pointsCount?a.l(2,b,a.i(2).y):3===a.pointsCount?a.M(1,b,a.i(2).y):2===a.pointsCount&&a.l(1,b,a.i(1).y)):270===b&&(b=h.top-g/2,c?4===a.pointsCount&&(c=a.i(3).x,a.M(1,a.i(1).x,b+20),a.l(2,c,b+20),a.l(3,c,b),a.l(4,c,b-20),a.M(5,c,a.i(5).y)):e?d?a.M(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.M(2,a.i(2).x,b),a.M(3,a.i(3).x,b)):4===a.pointsCount?
a.l(2,a.i(2).x,b):3===a.pointsCount?a.M(1,a.i(2).x,b):2===a.pointsCount&&a.l(1,a.i(1).x,b)),a.zf()))}}};ma.Object.defineProperties(Tu.prototype,{fromVertex:{get:function(){return this.ed},set:function(a){this.ed!==a&&(this.ed=a)}},toVertex:{get:function(){return this.ld},set:function(a){this.ld!==a&&(this.ld=a)}},relativePoint:{get:function(){return this.Zt},set:function(a){this.Zt.set(a)}}});Tu.className="TreeEdge";
La.prototype.initializeStandardTools=function(){this.gb("Action",new pg,this.mouseDownTools);this.gb("Relinking",new Ie,this.mouseDownTools);this.gb("LinkReshaping",new $f,this.mouseDownTools);this.gb("Rotating",new ng,this.mouseDownTools);this.gb("Resizing",new gg,this.mouseDownTools);this.gb("Linking",new Tf,this.mouseMoveTools);this.gb("Dragging",new Ae,this.mouseMoveTools);this.gb("DragSelecting",new Ag,this.mouseMoveTools);this.gb("Panning",new Bg,this.mouseMoveTools);this.gb("ContextMenu",new Dg,
this.mouseUpTools);this.gb("TextEditing",new Og,this.mouseUpTools);this.gb("ClickCreating",new qg,this.mouseUpTools);this.gb("ClickSelecting",new og,this.mouseUpTools)};Fn("Horizontal",new Hm);Fn("Spot",new Jm);Fn("Table",new Om);Fn("Viewbox",new Tm);Fn("TableRow",new Rm);Fn("TableColumn",new Sm);Fn("Graduated",new dn);Fn("Grid",new Um);oi.add("GraphLinksModel",Vq);oi.add("TreeModel",ir);
var Uu=x.go,Vu={get licenseKey(){return Q.licenseKey},set licenseKey(a){Q.licenseKey=a},get version(){return Q.version},Group:pf,EnumValue:E,List:F,Set:H,Map:ob,Point:J,Size:L,Rect:N,Margin:hc,Spot:O,Geometry:P,PathFigure:Wd,PathSegment:Xd,InputEvent:Zd,DiagramEvent:ae,ChangedEvent:be,Model:Z,GraphLinksModel:Dr,TreeModel:Ir,Binding:Hi,Transaction:ge,UndoManager:he,CommandHandler:Sk,Tool:je,DraggingTool:Ae,DraggingInfo:Je,DraggingOptions:Be,LinkingBaseTool:Af,LinkingTool:Tf,RelinkingTool:Ie,LinkReshapingTool:$f,
ResizingTool:gg,RotatingTool:ng,ClickSelectingTool:og,ActionTool:pg,ClickCreatingTool:qg,HTMLInfo:ye,ContextMenuTool:Dg,DragSelectingTool:Ag,PanningTool:Bg,TextEditingTool:Og,ToolManager:La,Animation:jh,AnimationManager:fh,AnimationTrigger:Zh,Layer:di,Diagram:Q,Palette:Mk,Overview:Gk,Brush:ql,GraphObject:Y,Panel:W,RowColumnDefinition:Vj,Shape:Bf,TextBlock:Pg,Picture:dk,Part:U,Adornment:te,Node:V,Link:T,Placeholder:ig,Layout:ti,LayoutNetwork:sq,LayoutVertex:vq,LayoutEdge:wq,GridLayout:Ok,PanelLayout:Wl,
CircularLayout:Jr,CircularNetwork:$r,CircularVertex:ns,CircularEdge:os,ForceDirectedLayout:ps,ForceDirectedNetwork:qs,ForceDirectedVertex:Cs,ForceDirectedEdge:Ds,LayeredDigraphLayout:Es,LayeredDigraphNetwork:Js,LayeredDigraphVertex:Jt,LayeredDigraphEdge:Kt,TreeLayout:Mt,TreeNetwork:St,TreeVertex:Tt,TreeEdge:Tu};"object"===typeof Uu&&Uu.version&&ya("WARNING: a `go` object on the root object is already defined. "+("Debug"in Uu?"debug ":"")+"version: "+Uu.version+", replaced with version: "+Vu.version);
Q.prototype.go=Vu;x.go=Vu; '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);
''';