/*
 * GoJS v2.1.34 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-2021 by Northwoods Software Corporation.  All Rights Reserved.
 * THIS SOFTWARE IS LICENSED.  THE LICENSE AGREEMENT IS AT: https://gojs.net/2.1.34/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.vB=b.prototype}var ma="undefined"!=typeof window&&window===self?self:"undefined"!=typeof global&&null!=global?global:self,na="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};
function oa(a){if(a){for(var b=ma,c=["Array","prototype","fill"],d=0;d<c.length-1;d++){var e=c[d];e in b||(b[e]={});b=b[e]}c=c[c.length-1];d=b[c];a=a(d);a!=d&&null!=a&&na(b,c,{writable:!0,value:a})}}oa(function(a){return a?a:function(a,c,d){var b=this.length||0;0>c&&(c=Math.max(0,b+c));if(null==d||d>b)d=b;d=Number(d);0>d&&(d=Math.max(0,b+d));for(c=Number(c||0);c<d;c++)this[c]=a;return this}});var x="object"===typeof self&&self.self===self&&self||"object"===typeof global&&global.global===global&&global||"object"===typeof window&&window.window===window&&window||{};void 0===x.requestAnimationFrame&&(void 0===x.setImmediate?x.requestAnimationFrame=function(a){x.setTimeout(a,0)}:x.requestAnimationFrame=x.setImmediate);function pa(){}function ra(a,b){var c=-1;return function(){var d=this,e=arguments;-1!==c&&x.clearTimeout(c);c=sa(function(){c=-1;a.apply(d,e)},b)}}
function sa(a,b){return x.setTimeout(a,b)}function ta(a){return x.document.createElement(a)}function B(a){throw Error(a);}function ua(a,b){a="The object is frozen, so its properties cannot be set: "+a.toString();void 0!==b&&(a+="  to value: "+b);B(a)}function va(a,b,c,d){c=null===c?"*":"string"===typeof c?c:"function"===typeof c&&"string"===typeof c.className?c.className:"";void 0!==d&&(c+="."+d);B(c+" is not in the range "+b+": "+a)}function wa(a){x.console&&x.console.log(a)}
function xa(){x.console&&x.console.log("Warning: List/Map/Set constructors no longer take an argument that enforces type.Instead they take an optional collection of Values to add to the collection. See 2.0 changelog for details.")}function ya(a){return"object"===typeof a&&null!==a}function 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):B("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):B("Cannot remove an object from an HTMLCollection or NodeList at "+b)}function Ea(){var a=Ga.pop();return void 0===a?[]:a}function Ha(a){a.length=0;Ga.push(a)}
function Ia(a){if("function"===typeof a){if(a.className)return a.className;if(a.name)return a.name;var b=a.toString();b=b.substring(9,b.indexOf("(")).trim();if(""!==b)return a._className=b}else if(ya(a)&&a.constructor)return Ia(a.constructor);return typeof a}
function Ja(a){var b=a;ya(a)&&(a.text?b=a.text:a.name?b=a.name:void 0!==a.key?b=a.key:void 0!==a.id?b=a.id:a.constructor===Object&&(a.Text?b=a.Text:a.Name?b=a.Name:void 0!==a.Key?b=a.Key:void 0!==a.Id?b=a.Id:void 0!==a.ID&&(b=a.ID)));return void 0===b?"undefined":null===b?"null":b.toString()}function Ka(a,b){if(a.hasOwnProperty(b))return!0;for(a=Object.getPrototypeOf(a);a&&a!==Function;){if(a.hasOwnProperty(b))return!0;var c=a.gB;if(c&&c[b])return!0;a=Object.getPrototypeOf(a)}return!1}
function La(a,b,c){Object.defineProperty(Oa.prototype,a,{get:b,set:c})}function Pa(){var a=Qa;if(void 0===x.document)return a;if(0===a.length)for(var b=x.document.getElementsByTagName("canvas"),c=b.length,d=0;d<c;d++){var e=b[d];e.parentElement&&e.parentElement.B&&a.push(e.parentElement.B)}return a}
function Ra(a){for(var b=[],c=0;256>c;c++)b["0123456789abcdef".charAt(c>>4)+"0123456789abcdef".charAt(c&15)]=String.fromCharCode(c);a.length%2&&(a="0"+a);c=[];for(var d=0,e=0;e<a.length;e+=2)c[d++]=b[a.substr(e,2)];a=c.join("");a=""===a?"0":a;b=[];for(c=0;256>c;c++)b[c]=c;for(c=d=0;256>c;c++)d=(d+b[c]+119)%256,e=b[c],b[c]=b[d],b[d]=e;d=c=0;for(var f="",g=0;g<a.length;g++)c=(c+1)%256,d=(d+b[c])%256,e=b[c],b[c]=b[d],b[d]=e,f+=String.fromCharCode(a.charCodeAt(g)^b[(b[c]+b[d])%256]);return f}
var Sa=void 0!==x.navigator&&0<x.navigator.userAgent.indexOf("MSIE 9.0"),Ta=void 0!==x.navigator&&0<x.navigator.userAgent.indexOf("MSIE 10.0"),Ua=void 0!==x.navigator&&0<x.navigator.userAgent.indexOf("Trident/7"),Va=void 0!==x.navigator&&0<x.navigator.userAgent.indexOf("Edge/"),Wa=void 0!==x.navigator&&void 0!==x.navigator.platform&&0<=x.navigator.platform.toUpperCase().indexOf("MAC"),Xa=void 0!==x.navigator&&void 0!==x.navigator.platform&&null!==x.navigator.platform.match(/(iPhone|iPod|iPad)/i),
Ga=[];Object.freeze([]);var Qa=[];pa.className="Util";pa.Dx="32ab5ff3b26f42dc0ed90f21442913b5";pa.adym="gojs.net";pa.vfo="28e647fdb062";pa.className="Util";function D(a,b,c){Ya(this);this.l=a;this.Qa=b;this.v=c}D.prototype.toString=function(){return"EnumValue."+this.Qa};function Za(a,b){return void 0===b||null===b||""===b?null:a[b]}
ma.Object.defineProperties(D.prototype,{classType:{get:function(){return this.l}},name:{get:function(){return this.Qa}},value:{get:function(){return this.v}}});D.className="EnumValue";function $a(){this.ox=[]}$a.prototype.toString=function(){return this.ox.join("")};$a.prototype.add=function(a){""!==a&&this.ox.push(a)};$a.className="StringBuilder";function ab(){}ab.className="PropertyCollection";
var eb={iB:!1,nB:!1,kB:!1,mB:!1,sB:!1,qB:!1,jy:!1,jB:null,trace:function(a){x.console&&x.console.log(a)},lB: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)},hB: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.Im=Object.getOwnPropertyNames(d.prototype);for(var e={wk:0};e.wk<b.Im.length;e={wk:e.wk},e.wk++){var f=Object.getOwnPropertyDescriptor(d.prototype,b.Im[e.wk]);void 0!==f.get&&void 0===f.set&&Object.defineProperty(d.prototype,
b.Im[e.wk],{set:function(a,b){return function(){throw Error("Property "+a.Im[b.wk]+" of "+a.x+" is read-only.");}}(b,e)})}}}b={Im:b.Im,x:b.x}}}};function fb(){}fb.prototype.reset=function(){};fb.prototype.next=function(){return!1};fb.prototype.ld=function(){return!1};fb.prototype.first=function(){return null};fb.prototype.any=function(){return!1};fb.prototype.all=function(){return!0};fb.prototype.each=function(){return this};fb.prototype.map=function(){return this};fb.prototype.filter=function(){return this};
fb.prototype.Kd=function(){};fb.prototype.toString=function(){return"EmptyIterator"};ma.Object.defineProperties(fb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return 0}}});fb.prototype.first=fb.prototype.first;fb.prototype.hasNext=fb.prototype.ld;fb.prototype.next=fb.prototype.next;fb.prototype.reset=fb.prototype.reset;var gb=null;fb.className="EmptyIterator";gb=new fb;function hb(a){this.key=-1;this.value=a}
hb.prototype.reset=function(){this.key=-1};hb.prototype.next=function(){return-1===this.key?(this.key=0,!0):!1};hb.prototype.ld=function(){return this.next()};hb.prototype.first=function(){this.key=0;return this.value};hb.prototype.any=function(a){this.key=-1;return a(this.value)};hb.prototype.all=function(a){this.key=-1;return a(this.value)};hb.prototype.each=function(a){this.key=-1;a(this.value);return this};hb.prototype.map=function(a){return new hb(a(this.value))};
hb.prototype.filter=function(a){return a(this.value)?new hb(this.value):gb};hb.prototype.Kd=function(){this.value=null};hb.prototype.toString=function(){return"SingletonIterator("+this.value+")"};ma.Object.defineProperties(hb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return 1}}});hb.prototype.first=hb.prototype.first;hb.prototype.hasNext=hb.prototype.ld;hb.prototype.next=hb.prototype.next;
hb.prototype.reset=hb.prototype.reset;hb.className="SingletonIterator";function ib(a){this.rb=a;this.ef=null;a.Ha=null;this.ia=a.Aa;this.Pa=-1}ib.prototype.reset=function(){var a=this.rb;a.Ha=null;this.ia=a.Aa;this.Pa=-1};ib.prototype.next=function(){var a=this.rb;if(a.Aa!==this.ia&&0>this.key)return!1;a=a.j;var b=a.length,c=++this.Pa,d=this.ef;if(null!==d)for(;c<b;){var e=a[c];if(d(e))return this.key=this.Pa=c,this.value=e,!0;c++}else{if(c<b)return this.key=c,this.value=a[c],!0;this.Kd()}return!1};
ib.prototype.ld=function(){return this.next()};ib.prototype.first=function(){var a=this.rb;this.ia=a.Aa;this.Pa=0;a=a.j;var b=a.length,c=this.ef;if(null!==c){for(var d=0;d<b;){var e=a[d];if(c(e))return this.key=this.Pa=d,this.value=e;d++}return null}return 0<b?(a=a[0],this.key=0,this.value=a):null};ib.prototype.any=function(a){var b=this.rb;b.Ha=null;this.Pa=-1;b=b.j;for(var c=b.length,d=this.ef,e=0;e<c;e++){var f=b[e];if((null===d||d(f))&&a(f))return!0}return!1};
ib.prototype.all=function(a){var b=this.rb;b.Ha=null;this.Pa=-1;b=b.j;for(var c=b.length,d=this.ef,e=0;e<c;e++){var f=b[e];if((null===d||d(f))&&!a(f))return!1}return!0};ib.prototype.each=function(a){var b=this.rb;b.Ha=null;this.Pa=-1;b=b.j;for(var c=b.length,d=this.ef,e=0;e<c;e++){var f=b[e];(null===d||d(f))&&a(f)}return this};
ib.prototype.map=function(a){var b=this.rb;b.Ha=null;this.Pa=-1;var c=[];b=b.j;for(var d=b.length,e=this.ef,f=0;f<d;f++){var g=b[f];(null===e||e(g))&&c.push(a(g))}a=new E;a.j=c;a.mb();return a.iterator};ib.prototype.filter=function(a){var b=this.rb;b.Ha=null;this.Pa=-1;var c=[];b=b.j;for(var d=b.length,e=this.ef,f=0;f<d;f++){var g=b[f];(null===e||e(g))&&a(g)&&c.push(g)}a=new E;a.j=c;a.mb();return a.iterator};
ib.prototype.Kd=function(){this.key=-1;this.value=null;this.ia=-1;this.ef=null;this.rb.Ha=this};ib.prototype.toString=function(){return"ListIterator@"+this.Pa+"/"+this.rb.count};
ma.Object.defineProperties(ib.prototype,{iterator:{get:function(){return this}},predicate:{get:function(){return this.ef},set:function(a){this.ef=a}},count:{get:function(){var a=this.ef;if(null!==a){for(var b=0,c=this.rb.j,d=c.length,e=0;e<d;e++)a(c[e])&&b++;return b}return this.rb.j.length}}});ib.prototype.first=ib.prototype.first;ib.prototype.hasNext=ib.prototype.ld;ib.prototype.next=ib.prototype.next;
ib.prototype.reset=ib.prototype.reset;ib.className="ListIterator";function lb(a){this.rb=a;a.fh=null;this.ia=a.Aa;this.Pa=a.j.length}lb.prototype.reset=function(){var a=this.rb;a.fh=null;this.ia=a.Aa;this.Pa=a.j.length};lb.prototype.next=function(){var a=this.rb;if(a.Aa!==this.ia&&0>this.key)return!1;var b=--this.Pa;if(0<=b)return this.key=b,this.value=a.j[b],!0;this.Kd();return!1};lb.prototype.ld=function(){return this.next()};
lb.prototype.first=function(){var a=this.rb;this.ia=a.Aa;var b=a.j;this.Pa=a=b.length-1;return 0<=a?(b=b[a],this.key=a,this.value=b):null};lb.prototype.any=function(a){var b=this.rb;b.fh=null;b=b.j;var c=b.length;this.Pa=c;for(--c;0<=c;c--)if(a(b[c]))return!0;return!1};lb.prototype.all=function(a){var b=this.rb;b.fh=null;b=b.j;var c=b.length;this.Pa=c;for(--c;0<=c;c--)if(!a(b[c]))return!1;return!0};
lb.prototype.each=function(a){var b=this.rb;b.fh=null;b=b.j;var c=b.length;this.Pa=c;for(--c;0<=c;c--)a(b[c]);return this};lb.prototype.map=function(a){var b=this.rb;b.fh=null;var c=[];b=b.j;var d=b.length;this.Pa=d;for(--d;0<=d;d--)c.push(a(b[d]));a=new E;a.j=c;a.mb();return a.iterator};lb.prototype.filter=function(a){var b=this.rb;b.fh=null;var c=[];b=b.j;var d=b.length;this.Pa=d;for(--d;0<=d;d--){var e=b[d];a(e)&&c.push(e)}a=new E;a.j=c;a.mb();return a.iterator};
lb.prototype.Kd=function(){this.key=-1;this.value=null;this.ia=-1;this.rb.fh=this};lb.prototype.toString=function(){return"ListIteratorBackwards("+this.Pa+"/"+this.rb.count+")"};ma.Object.defineProperties(lb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.rb.j.length}}});lb.prototype.first=lb.prototype.first;lb.prototype.hasNext=lb.prototype.ld;lb.prototype.next=lb.prototype.next;lb.prototype.reset=lb.prototype.reset;
lb.className="ListIteratorBackwards";function E(a){Ya(this);this.s=!1;this.j=[];this.Aa=0;this.fh=this.Ha=null;void 0!==a&&("function"===typeof a||"string"===typeof a?xa():this.addAll(a))}t=E.prototype;t.mb=function(){var a=this.Aa;a++;999999999<a&&(a=0);this.Aa=a};t.freeze=function(){this.s=!0;return this};t.ea=function(){this.s=!1;return this};t.toString=function(){return"List()#"+mb(this)};t.add=function(a){if(null===a)return this;this.s&&ua(this,a);this.j.push(a);this.mb();return this};
t.push=function(a){this.add(a)};t.addAll=function(a){if(null===a)return this;this.s&&ua(this);var b=this.j;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.mb();return this};t.clear=function(){this.s&&ua(this);this.j.length=0;this.mb()};t.contains=function(a){return null===a?!1:-1!==this.j.indexOf(a)};t.has=function(a){return this.contains(a)};t.indexOf=function(a){return null===a?-1:this.j.indexOf(a)};
t.L=function(a){var b=this.j;(0>a||a>=b.length)&&va(a,"0 <= i < length",E,"elt:i");return b[a]};t.get=function(a){return this.L(a)};t.nd=function(a,b){var c=this.j;(0>a||a>=c.length)&&va(a,"0 <= i < length",E,"setElt:i");this.s&&ua(this,a);c[a]=b};t.set=function(a,b){this.nd(a,b)};t.first=function(){var a=this.j;return 0===a.length?null:a[0]};t.Xb=function(){var a=this.j,b=a.length;return 0<b?a[b-1]:null};t.pop=function(){this.s&&ua(this);var a=this.j;return 0<a.length?a.pop():null};
E.prototype.any=function(a){for(var b=this.j,c=b.length,d=0;d<c;d++)if(a(b[d]))return!0;return!1};E.prototype.all=function(a){for(var b=this.j,c=b.length,d=0;d<c;d++)if(!a(b[d]))return!1;return!0};E.prototype.each=function(a){for(var b=this.j,c=b.length,d=0;d<c;d++)a(b[d]);return this};E.prototype.map=function(a){for(var b=new E,c=[],d=this.j,e=d.length,f=0;f<e;f++)c.push(a(d[f]));b.j=c;b.mb();return b};
E.prototype.filter=function(a){for(var b=new E,c=[],d=this.j,e=d.length,f=0;f<e;f++){var g=d[f];a(g)&&c.push(g)}b.j=c;b.mb();return b};t=E.prototype;t.vb=function(a,b){0>a&&va(a,">= 0",E,"insertAt:i");this.s&&ua(this,a);var c=this.j;a>=c.length?c.push(b):c.splice(a,0,b);this.mb()};t.remove=function(a){if(null===a)return!1;this.s&&ua(this,a);var b=this.j;a=b.indexOf(a);if(-1===a)return!1;a===b.length-1?b.pop():b.splice(a,1);this.mb();return!0};t.delete=function(a){return this.remove(a)};
t.bb=function(a){var b=this.j;(0>a||a>=b.length)&&va(a,"0 <= i < length",E,"removeAt:i");this.s&&ua(this,a);a===b.length-1?b.pop():b.splice(a,1);this.mb()};t.removeRange=function(a,b){var c=this.j,d=c.length;if(0>a)a=0;else if(a>=d)return this;if(0>b)return this;b>=d&&(b=d-1);if(a>b)return this;this.s&&ua(this);for(var e=a,f=b+1;f<d;)c[e++]=c[f++];c.length=d-(b-a+1);this.mb();return this};E.prototype.copy=function(){var a=new E,b=this.j;0<b.length&&(a.j=Array.prototype.slice.call(b));return a};
t=E.prototype;t.ma=function(){for(var a=this.j,b=this.count,c=Array(b),d=0;d<b;d++)c[d]=a[d];return c};t.Kw=function(){for(var a=new F,b=this.j,c=this.count,d=0;d<c;d++)a.add(b[d]);return a};t.sort=function(a){this.s&&ua(this);this.j.sort(a);this.mb();return this};
t.tj=function(a,b,c){var d=this.j,e=d.length;void 0===b&&(b=0);void 0===c&&(c=e);this.s&&ua(this);var f=c-b;if(1>=f)return this;(0>b||b>=e-1)&&va(b,"0 <= from < length",E,"sortRange:from");if(2===f)return c=d[b],e=d[b+1],0<a(c,e)&&(d[b]=e,d[b+1]=c,this.mb()),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.mb();return this};
t.reverse=function(){this.s&&ua(this);this.j.reverse();this.mb();return this};
ma.Object.defineProperties(E.prototype,{_dataArray:{get:function(){return this.j}},count:{get:function(){return this.j.length}},size:{get:function(){return this.j.length}},length:{get:function(){return this.j.length}},iterator:{get:function(){if(0>=this.j.length)return gb;var a=this.Ha;return null!==a?(a.reset(),a):new ib(this)}},iteratorBackwards:{
get:function(){if(0>=this.j.length)return gb;var a=this.fh;return null!==a?(a.reset(),a):new lb(this)}}});E.prototype.reverse=E.prototype.reverse;E.prototype.sortRange=E.prototype.tj;E.prototype.sort=E.prototype.sort;E.prototype.toSet=E.prototype.Kw;E.prototype.toArray=E.prototype.ma;E.prototype.removeRange=E.prototype.removeRange;E.prototype.removeAt=E.prototype.bb;E.prototype["delete"]=E.prototype.delete;E.prototype.remove=E.prototype.remove;E.prototype.insertAt=E.prototype.vb;
E.prototype.pop=E.prototype.pop;E.prototype.last=E.prototype.Xb;E.prototype.first=E.prototype.first;E.prototype.set=E.prototype.set;E.prototype.setElt=E.prototype.nd;E.prototype.get=E.prototype.get;E.prototype.elt=E.prototype.L;E.prototype.indexOf=E.prototype.indexOf;E.prototype.has=E.prototype.has;E.prototype.contains=E.prototype.contains;E.prototype.clear=E.prototype.clear;E.prototype.addAll=E.prototype.addAll;E.prototype.push=E.prototype.push;E.prototype.add=E.prototype.add;E.prototype.thaw=E.prototype.ea;
E.prototype.freeze=E.prototype.freeze;E.className="List";function nb(a){this.tg=a;a.Ha=null;this.ia=a.Aa;this.ka=null}nb.prototype.reset=function(){var a=this.tg;a.Ha=null;this.ia=a.Aa;this.ka=null};nb.prototype.next=function(){var a=this.tg;if(a.Aa!==this.ia&&null===this.key)return!1;var b=this.ka;b=null===b?a.ba:b.oa;if(null!==b)return this.ka=b,this.value=b.value,this.key=b.key,!0;this.Kd();return!1};nb.prototype.ld=function(){return this.next()};
nb.prototype.first=function(){var a=this.tg;this.ia=a.Aa;a=a.ba;if(null!==a){this.ka=a;var b=a.value;this.key=a.key;return this.value=b}return null};nb.prototype.any=function(a){var b=this.tg;this.ka=b.Ha=null;for(b=b.ba;null!==b;){if(a(b.value))return!0;b=b.oa}return!1};nb.prototype.all=function(a){var b=this.tg;this.ka=b.Ha=null;for(b=b.ba;null!==b;){if(!a(b.value))return!1;b=b.oa}return!0};nb.prototype.each=function(a){var b=this.tg;this.ka=b.Ha=null;for(b=b.ba;null!==b;)a(b.value),b=b.oa;return this};
nb.prototype.map=function(a){var b=this.tg;b.Ha=null;var c=new E;for(b=b.ba;null!==b;)c.add(a(b.value)),b=b.oa;return c.iterator};nb.prototype.filter=function(a){var b=this.tg;b.Ha=null;var c=new E;for(b=b.ba;null!==b;){var d=b.value;a(d)&&c.add(d);b=b.oa}return c.iterator};nb.prototype.Kd=function(){this.value=this.key=null;this.ia=-1;this.tg.Ha=this};nb.prototype.toString=function(){return null!==this.ka?"SetIterator@"+this.ka.value:"SetIterator"};
ma.Object.defineProperties(nb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.tg.Fb}}});nb.prototype.first=nb.prototype.first;nb.prototype.hasNext=nb.prototype.ld;nb.prototype.next=nb.prototype.next;nb.prototype.reset=nb.prototype.reset;nb.className="SetIterator";
function F(a){Ya(this);this.s=!1;this.Hb={};this.Fb=0;this.Ha=null;this.Aa=0;this.Ze=this.ba=null;void 0!==a&&("function"===typeof a||"string"===typeof a?xa():this.addAll(a))}t=F.prototype;t.mb=function(){var a=this.Aa;a++;999999999<a&&(a=0);this.Aa=a};t.freeze=function(){this.s=!0;return this};t.ea=function(){this.s=!1;return this};t.toString=function(){return"Set()#"+mb(this)};
t.add=function(a){if(null===a)return this;this.s&&ua(this,a);var b=a;ya(a)&&(b=ob(a));void 0===this.Hb[b]&&(this.Fb++,a=new pb(a,a),this.Hb[b]=a,b=this.Ze,null===b?this.ba=a:(a.Ql=b,b.oa=a),this.Ze=a,this.mb());return this};t.addAll=function(a){if(null===a)return this;this.s&&ua(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 ya(a)&&(b=mb(a),void 0===b)?!1:void 0!==this.Hb[b]};t.has=function(a){return this.contains(a)};t.zz=function(a){if(null===a)return!0;for(a=a.iterator;a.next();)if(!this.contains(a.value))return!1;return!0};t.Az=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.ba;return null===a?null:a.value};
F.prototype.any=function(a){for(var b=this.ba;null!==b;){if(a(b.value))return!0;b=b.oa}return!1};F.prototype.all=function(a){for(var b=this.ba;null!==b;){if(!a(b.value))return!1;b=b.oa}return!0};F.prototype.each=function(a){for(var b=this.ba;null!==b;)a(b.value),b=b.oa;return this};F.prototype.map=function(a){for(var b=new F,c=this.ba;null!==c;)b.add(a(c.value)),c=c.oa;return b};F.prototype.filter=function(a){for(var b=new F,c=this.ba;null!==c;){var d=c.value;a(d)&&b.add(d);c=c.oa}return b};t=F.prototype;
t.remove=function(a){if(null===a)return!1;this.s&&ua(this,a);var b=a;if(ya(a)&&(b=mb(a),void 0===b))return!1;a=this.Hb[b];if(void 0===a)return!1;var c=a.oa,d=a.Ql;null!==c&&(c.Ql=d);null!==d&&(d.oa=c);this.ba===a&&(this.ba=c);this.Ze===a&&(this.Ze=d);delete this.Hb[b];this.Fb--;this.mb();return!0};t.delete=function(a){return this.remove(a)};
t.$q=function(a){if(null===a)return this;this.s&&ua(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.RA=function(a){if(null===a||0===this.count)return this;this.s&&ua(this);var b=new F;b.addAll(a);a=[];for(var c=this.iterator;c.next();){var d=c.value;b.contains(d)||a.push(d)}this.$q(a);return this};t.clear=function(){this.s&&ua(this);this.Hb={};this.Fb=0;null!==this.Ha&&this.Ha.reset();this.Ze=this.ba=null;this.mb()};
F.prototype.copy=function(){var a=new F,b=this.Hb,c;for(c in b)a.add(b[c].value);return a};F.prototype.ma=function(){var a=Array(this.Fb),b=this.Hb,c=0,d;for(d in b)a[c]=b[d].value,c++;return a};F.prototype.Jw=function(){var a=new E,b=this.Hb,c;for(c in b)a.add(b[c].value);return a};function Ya(a){a.__gohashid=qb++}function ob(a){var b=a.__gohashid;void 0===b&&(b=qb++,a.__gohashid=b);return b}function mb(a){return a.__gohashid}
ma.Object.defineProperties(F.prototype,{count:{get:function(){return this.Fb}},size:{get:function(){return this.Fb}},iterator:{get:function(){if(0>=this.Fb)return gb;var a=this.Ha;return null!==a?(a.reset(),a):new nb(this)}}});F.prototype.toList=F.prototype.Jw;F.prototype.toArray=F.prototype.ma;F.prototype.clear=F.prototype.clear;F.prototype.retainAll=F.prototype.RA;F.prototype.removeAll=F.prototype.$q;
F.prototype["delete"]=F.prototype.delete;F.prototype.remove=F.prototype.remove;F.prototype.first=F.prototype.first;F.prototype.containsAny=F.prototype.Az;F.prototype.containsAll=F.prototype.zz;F.prototype.has=F.prototype.has;F.prototype.contains=F.prototype.contains;F.prototype.addAll=F.prototype.addAll;F.prototype.add=F.prototype.add;F.prototype.thaw=F.prototype.ea;F.prototype.freeze=F.prototype.freeze;var qb=1;F.className="Set";F.uniqueHash=Ya;F.hashIdUnique=ob;F.hashId=mb;
function rb(a){this.fa=a;this.ia=a.Aa;this.ka=null}rb.prototype.reset=function(){this.ia=this.fa.Aa;this.ka=null};rb.prototype.next=function(){var a=this.fa;if(a.Aa!==this.ia&&null===this.key)return!1;var b=this.ka;b=null===b?a.ba:b.oa;if(null!==b)return this.ka=b,this.value=this.key=a=b.key,!0;this.Kd();return!1};rb.prototype.ld=function(){return this.next()};rb.prototype.first=function(){var a=this.fa;this.ia=a.Aa;a=a.ba;return null!==a?(this.ka=a,this.value=this.key=a=a.key):null};
rb.prototype.any=function(a){var b=this.fa;this.ka=null;for(b=b.ba;null!==b;){if(a(b.key))return!0;b=b.oa}return!1};rb.prototype.all=function(a){var b=this.fa;this.ka=null;for(b=b.ba;null!==b;){if(!a(b.key))return!1;b=b.oa}return!0};rb.prototype.each=function(a){var b=this.fa;this.ka=null;for(b=b.ba;null!==b;)a(b.key),b=b.oa;return this};rb.prototype.map=function(a){var b=this.fa;this.ka=null;var c=new E;for(b=b.ba;null!==b;)c.add(a(b.key)),b=b.oa;return c.iterator};
rb.prototype.filter=function(a){var b=this.fa;this.ka=null;var c=new E;for(b=b.ba;null!==b;){var d=b.key;a(d)&&c.add(d);b=b.oa}return c.iterator};rb.prototype.Kd=function(){this.value=this.key=null;this.ia=-1};rb.prototype.toString=function(){return null!==this.ka?"MapKeySetIterator@"+this.ka.value:"MapKeySetIterator"};ma.Object.defineProperties(rb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.fa.Fb}}});
rb.prototype.first=rb.prototype.first;rb.prototype.hasNext=rb.prototype.ld;rb.prototype.next=rb.prototype.next;rb.prototype.reset=rb.prototype.reset;rb.className="MapKeySetIterator";function sb(a){F.call(this);Ya(this);this.s=!0;this.fa=a}la(sb,F);t=sb.prototype;t.freeze=function(){return this};t.ea=function(){return this};t.toString=function(){return"MapKeySet("+this.fa.toString()+")"};t.add=function(){B("This Set is read-only: "+this.toString());return this};t.contains=function(a){return this.fa.contains(a)};
t.has=function(a){return this.contains(a)};t.remove=function(){B("This Set is read-only: "+this.toString());return!1};t.delete=function(a){return this.remove(a)};t.clear=function(){B("This Set is read-only: "+this.toString())};t.first=function(){var a=this.fa.ba;return null!==a?a.key:null};sb.prototype.any=function(a){for(var b=this.fa.ba;null!==b;){if(a(b.key))return!0;b=b.oa}return!1};sb.prototype.all=function(a){for(var b=this.fa.ba;null!==b;){if(!a(b.key))return!1;b=b.oa}return!0};
sb.prototype.each=function(a){for(var b=this.fa.ba;null!==b;)a(b.key),b=b.oa;return this};sb.prototype.map=function(a){for(var b=new F,c=this.fa.ba;null!==c;)b.add(a(c.key)),c=c.oa;return b};sb.prototype.filter=function(a){for(var b=new F,c=this.fa.ba;null!==c;){var d=c.key;a(d)&&b.add(d);c=c.oa}return b};sb.prototype.copy=function(){return new sb(this.fa)};sb.prototype.Kw=function(){var a=new F,b=this.fa.Hb,c;for(c in b)a.add(b[c].key);return a};
sb.prototype.ma=function(){var a=this.fa.Hb,b=Array(this.fa.Fb),c=0,d;for(d in a)b[c]=a[d].key,c++;return b};sb.prototype.Jw=function(){var a=new E,b=this.fa.Hb,c;for(c in b)a.add(b[c].key);return a};ma.Object.defineProperties(sb.prototype,{count:{get:function(){return this.fa.Fb}},size:{get:function(){return this.fa.Fb}},iterator:{get:function(){return 0>=this.fa.Fb?gb:new rb(this.fa)}}});
sb.prototype.toList=sb.prototype.Jw;sb.prototype.toArray=sb.prototype.ma;sb.prototype.toSet=sb.prototype.Kw;sb.prototype.first=sb.prototype.first;sb.prototype.clear=sb.prototype.clear;sb.prototype["delete"]=sb.prototype.delete;sb.prototype.remove=sb.prototype.remove;sb.prototype.has=sb.prototype.has;sb.prototype.contains=sb.prototype.contains;sb.prototype.add=sb.prototype.add;sb.prototype.thaw=sb.prototype.ea;sb.prototype.freeze=sb.prototype.freeze;sb.className="MapKeySet";
function tb(a){this.fa=a;a.Ye=null;this.ia=a.Aa;this.ka=null}tb.prototype.reset=function(){var a=this.fa;a.Ye=null;this.ia=a.Aa;this.ka=null};tb.prototype.next=function(){var a=this.fa;if(a.Aa!==this.ia&&null===this.key)return!1;var b=this.ka;b=null===b?a.ba:b.oa;if(null!==b)return this.ka=b,this.value=b.value,this.key=b.key,!0;this.Kd();return!1};tb.prototype.ld=function(){return this.next()};
tb.prototype.first=function(){var a=this.fa;this.ia=a.Aa;a=a.ba;if(null!==a){this.ka=a;var b=a.value;this.key=a.key;return this.value=b}return null};tb.prototype.any=function(a){var b=this.fa;this.ka=b.Ye=null;for(b=b.ba;null!==b;){if(a(b.value))return!0;b=b.oa}return!1};tb.prototype.all=function(a){var b=this.fa;this.ka=b.Ye=null;for(b=b.ba;null!==b;){if(!a(b.value))return!1;b=b.oa}return!0};tb.prototype.each=function(a){var b=this.fa;this.ka=b.Ye=null;for(b=b.ba;null!==b;)a(b.value),b=b.oa;return this};
tb.prototype.map=function(a){var b=this.fa;this.ka=b.Ye=null;var c=new E;for(b=b.ba;null!==b;)c.add(a(b.value)),b=b.oa;return c.iterator};tb.prototype.filter=function(a){var b=this.fa;this.ka=b.Ye=null;var c=new E;for(b=b.ba;null!==b;){var d=b.value;a(d)&&c.add(d);b=b.oa}return c.iterator};tb.prototype.Kd=function(){this.value=this.key=null;this.ia=-1;this.fa.Ye=this};tb.prototype.toString=function(){return null!==this.ka?"MapValueSetIterator@"+this.ka.value:"MapValueSetIterator"};
ma.Object.defineProperties(tb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.fa.Fb}}});tb.prototype.first=tb.prototype.first;tb.prototype.hasNext=tb.prototype.ld;tb.prototype.next=tb.prototype.next;tb.prototype.reset=tb.prototype.reset;tb.className="MapValueSetIterator";function pb(a,b){this.key=a;this.value=b;this.Ql=this.oa=null}pb.prototype.toString=function(){return"{"+this.key+":"+this.value+"}"};
pb.className="KeyValuePair";function ub(a){this.fa=a;a.Ha=null;this.ia=a.Aa;this.ka=null}ub.prototype.reset=function(){var a=this.fa;a.Ha=null;this.ia=a.Aa;this.ka=null};ub.prototype.next=function(){var a=this.fa;if(a.Aa!==this.ia&&null===this.key)return!1;var b=this.ka;b=null===b?a.ba:b.oa;if(null!==b)return this.ka=b,this.key=b.key,this.value=b.value,!0;this.Kd();return!1};ub.prototype.ld=function(){return this.next()};
ub.prototype.first=function(){var a=this.fa;this.ia=a.Aa;a=a.ba;return null!==a?(this.ka=a,this.key=a.key,this.value=a.value,a):null};ub.prototype.any=function(a){var b=this.fa;this.ka=b.Ha=null;for(b=b.ba;null!==b;){if(a(b))return!0;b=b.oa}return!1};ub.prototype.all=function(a){var b=this.fa;this.ka=b.Ha=null;for(b=b.ba;null!==b;){if(!a(b))return!1;b=b.oa}return!0};ub.prototype.each=function(a){var b=this.fa;this.ka=b.Ha=null;for(b=b.ba;null!==b;)a(b),b=b.oa;return this};
ub.prototype.map=function(a){var b=this.fa;this.ka=b.Ha=null;var c=new E;for(b=b.ba;null!==b;)c.add(a(b)),b=b.oa;return c.iterator};ub.prototype.filter=function(a){var b=this.fa;this.ka=b.Ha=null;var c=new E;for(b=b.ba;null!==b;)a(b)&&c.add(b),b=b.oa;return c.iterator};ub.prototype.Kd=function(){this.value=this.key=null;this.ia=-1;this.fa.Ha=this};ub.prototype.toString=function(){return null!==this.ka?"MapIterator@"+this.ka:"MapIterator"};
ma.Object.defineProperties(ub.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.fa.Fb}}});ub.prototype.first=ub.prototype.first;ub.prototype.hasNext=ub.prototype.ld;ub.prototype.next=ub.prototype.next;ub.prototype.reset=ub.prototype.reset;ub.className="MapIterator";
function H(a){Ya(this);this.s=!1;this.Hb={};this.Fb=0;this.Ye=this.Ha=null;this.Aa=0;this.Ze=this.ba=null;void 0!==a&&("function"===typeof a||"string"===typeof a?xa():this.addAll(a))}t=H.prototype;t.mb=function(){var a=this.Aa;a++;999999999<a&&(a=0);this.Aa=a};t.freeze=function(){this.s=!0;return this};t.ea=function(){this.s=!1;return this};t.toString=function(){return"Map()#"+mb(this)};
t.add=function(a,b){this.s&&ua(this,a);var c=a;ya(a)&&(c=ob(a));var d=this.Hb[c];void 0===d?(this.Fb++,a=new pb(a,b),this.Hb[c]=a,c=this.Ze,null===c?this.ba=a:(a.Ql=c,c.oa=a),this.Ze=a,this.mb()):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 H)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.ba};H.prototype.any=function(a){for(var b=this.ba;null!==b;){if(a(b))return!0;b=b.oa}return!1};H.prototype.all=function(a){for(var b=this.ba;null!==b;){if(!a(b))return!1;b=b.oa}return!0};
H.prototype.each=function(a){for(var b=this.ba;null!==b;)a(b),b=b.oa;return this};H.prototype.map=function(a){for(var b=new H,c=this.ba;null!==c;)b.add(c.key,a(c)),c=c.oa;return b};H.prototype.filter=function(a){for(var b=new H,c=this.ba;null!==c;)a(c)&&b.add(c.key,c.value),c=c.oa;return b};t=H.prototype;t.contains=function(a){var b=a;return ya(a)&&(b=mb(a),void 0===b)?!1:void 0!==this.Hb[b]};t.has=function(a){return this.contains(a)};
t.H=function(a){var b=a;if(ya(a)&&(b=mb(a),void 0===b))return null;a=this.Hb[b];return void 0===a?null:a.value};t.get=function(a){return this.H(a)};t.remove=function(a){if(null===a)return!1;this.s&&ua(this,a);var b=a;if(ya(a)&&(b=mb(a),void 0===b))return!1;a=this.Hb[b];if(void 0===a)return!1;var c=a.oa,d=a.Ql;null!==c&&(c.Ql=d);null!==d&&(d.oa=c);this.ba===a&&(this.ba=c);this.Ze===a&&(this.Ze=d);delete this.Hb[b];this.Fb--;this.mb();return!0};t.delete=function(a){return this.remove(a)};
t.clear=function(){this.s&&ua(this);this.Hb={};this.Fb=0;null!==this.Ha&&this.Ha.reset();null!==this.Ye&&this.Ye.reset();this.Ze=this.ba=null;this.mb()};H.prototype.copy=function(){var a=new H,b=this.Hb,c;for(c in b){var d=b[c];a.add(d.key,d.value)}return a};H.prototype.ma=function(){var a=this.Hb,b=Array(this.Fb),c=0,d;for(d in a){var e=a[d];b[c]=new pb(e.key,e.value);c++}return b};H.prototype.Jf=function(){return new sb(this)};
ma.Object.defineProperties(H.prototype,{count:{get:function(){return this.Fb}},size:{get:function(){return this.Fb}},iterator:{get:function(){if(0>=this.count)return gb;var a=this.Ha;return null!==a?(a.reset(),a):new ub(this)}},iteratorKeys:{get:function(){return 0>=this.count?gb:new rb(this)}},iteratorValues:{get:function(){if(0>=this.count)return gb;
var a=this.Ye;return null!==a?(a.reset(),a):new tb(this)}}});H.prototype.toKeySet=H.prototype.Jf;H.prototype.toArray=H.prototype.ma;H.prototype.clear=H.prototype.clear;H.prototype["delete"]=H.prototype.delete;H.prototype.remove=H.prototype.remove;H.prototype.get=H.prototype.get;H.prototype.getValue=H.prototype.H;H.prototype.has=H.prototype.has;H.prototype.contains=H.prototype.contains;H.prototype.first=H.prototype.first;H.prototype.addAll=H.prototype.addAll;H.prototype.set=H.prototype.set;
H.prototype.add=H.prototype.add;H.prototype.thaw=H.prototype.ea;H.prototype.freeze=H.prototype.freeze;H.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):B("Invalid arguments to Point constructor: "+a+", "+b);this.s=!1}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.Ig=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.ca=function(){this.s=!0;Object.freeze(this);return this};t.G=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.s=!1;return this};
function vb(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));return new J(c,e)}return new J}function wb(a){return a.x.toString()+" "+a.y.toString()}t.toString=function(){return"Point("+this.x+","+this.y+")"};t.w=function(a){return a instanceof J?this.x===a.x&&this.y===a.y:!1};t.fj=function(a,b){return this.x===a&&this.y===b};t.Na=function(a){return K.A(this.x,a.x)&&K.A(this.y,a.y)};
t.add=function(a){this.x+=a.x;this.y+=a.y;return this};t.ce=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.Fe=function(a){var b=a.x-this.x;a=a.y-this.y;return b*b+a*a};t.kd=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.Sa=function(a){return xb(a.x-this.x,a.y-this.y)};t.direction=function(a,b){return xb(a-this.x,b-this.y)};
function xb(a,b){if(0===a)return 0<b?90:0>b?270:0;if(0===b)return 0<a?0:180;if(isNaN(a)||isNaN(b))return 0;var c=180*Math.atan(Math.abs(b/a))/Math.PI;0>a?c=0>b?c+180:180-c:0>b&&(c=360-c);return c}t.KA=function(a,b,c,d){K.Qh(a,b,c,d,this.x,this.y,this);return this};t.LA=function(a,b){K.Qh(a.x,a.y,b.x,b.y,this.x,this.y,this);return this};t.WA=function(a,b,c,d){K.Eq(this.x,this.y,a,b,c,d,this);return this};t.XA=function(a,b){K.Eq(this.x,this.y,a.x,a.y,b.width,b.height,this);return this};
t.sj=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.Lk=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.sa(this);return this};function Bb(a,b){b.Zd(a);return a}function Cb(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 Db(a,b,c,d){a=c-a;b=d-b;return a*a+b*b}
function Eb(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.u=function(){return isFinite(this.x)&&isFinite(this.y)};J.alloc=function(){var a=Fb.pop();return void 0===a?new J:a};J.allocAt=function(a,b){var c=Fb.pop();if(void 0===c)return new J(a,b);c.x=a;c.y=b;return c};J.free=function(a){Fb.push(a)};J.prototype.isReal=J.prototype.u;
J.prototype.setSpot=J.prototype.Lk;J.prototype.setRectSpot=J.prototype.sj;J.prototype.snapToGridPoint=J.prototype.XA;J.prototype.snapToGrid=J.prototype.WA;J.prototype.projectOntoLineSegmentPoint=J.prototype.LA;J.prototype.projectOntoLineSegment=J.prototype.KA;J.intersectingLineSegments=function(a,b,c,d,e,f,g,h){return K.Mq(a,b,c,d,e,f,g,h)};J.prototype.direction=J.prototype.direction;J.prototype.directionPoint=J.prototype.Sa;J.prototype.normalize=J.prototype.normalize;
J.prototype.distanceSquared=J.prototype.kd;J.prototype.distanceSquaredPoint=J.prototype.Fe;J.prototype.scale=J.prototype.scale;J.prototype.rotate=J.prototype.rotate;J.prototype.offset=J.prototype.offset;J.prototype.subtract=J.prototype.ce;J.prototype.add=J.prototype.add;J.prototype.equalsApprox=J.prototype.Na;J.prototype.equalTo=J.prototype.fj;J.prototype.equals=J.prototype.w;J.prototype.set=J.prototype.set;J.prototype.setTo=J.prototype.Ig;var Hb=null,Ib=null,Jb=null,Kb=null,Lb=null,Fb=[];
J.className="Point";J.parse=vb;J.stringify=wb;J.distanceLineSegmentSquared=Cb;J.distanceSquared=Db;J.direction=Eb;J.Origin=Hb=(new J(0,0)).ca();J.InfiniteTopLeft=Ib=(new J(-Infinity,-Infinity)).ca();J.InfiniteBottomRight=Jb=(new J(Infinity,Infinity)).ca();J.SixPoint=Kb=(new J(6,6)).ca();J.NoPoint=Lb=(new J(NaN,NaN)).ca();J.parse=vb;J.stringify=wb;J.distanceLineSegmentSquared=Cb;J.distanceSquared=Db;J.direction=Eb;
function M(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):B("Invalid arguments to Size constructor: "+a+", "+b);this.s=!1}var Mb,Nb,Ob,Pb,Qb,Rb,Sb;M.prototype.assign=function(a){this.width=a.width;this.height=a.height;return this};M.prototype.h=function(a,b){this.width=a;this.height=b;return this};M.prototype.Ig=function(a,b){this.width=a;this.height=b;return this};
M.prototype.set=function(a){this.width=a.width;this.height=a.height;return this};M.prototype.copy=function(){var a=new M;a.width=this.width;a.height=this.height;return a};t=M.prototype;t.ca=function(){this.s=!0;Object.freeze(this);return this};t.G=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.s=!1;return this};
function Tb(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));return new M(c,e)}return new M}function Ub(a){return a.width.toString()+" "+a.height.toString()}t.toString=function(){return"Size("+this.width+","+this.height+")"};t.w=function(a){return a instanceof M?this.width===a.width&&this.height===a.height:!1};t.fj=function(a,b){return this.width===a&&this.height===b};
t.Na=function(a){return K.A(this.width,a.width)&&K.A(this.height,a.height)};t.u=function(){return isFinite(this.width)&&isFinite(this.height)};M.alloc=function(){var a=Vb.pop();return void 0===a?new M:a};M.free=function(a){Vb.push(a)};M.prototype.isReal=M.prototype.u;M.prototype.equalsApprox=M.prototype.Na;M.prototype.equalTo=M.prototype.fj;M.prototype.equals=M.prototype.w;M.prototype.set=M.prototype.set;M.prototype.setTo=M.prototype.Ig;var Vb=[];M.className="Size";M.parse=Tb;M.stringify=Ub;
M.ZeroSize=Mb=(new M(0,0)).ca();M.OneSize=Nb=(new M(1,1)).ca();M.SixSize=Ob=(new M(6,6)).ca();M.EightSize=Pb=(new M(8,8)).ca();M.TenSize=Qb=(new M(10,10)).ca();M.InfiniteSize=Rb=(new M(Infinity,Infinity)).ca();M.NoSize=Sb=(new M(NaN,NaN)).ca();M.parse=Tb;M.stringify=Ub;
function N(a,b,c,d){void 0===a?this.height=this.width=this.y=this.x=0: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 M?(this.x=c,this.y=a,this.width=b.width,this.height=b.height):B("Incorrect arguments supplied to Rect constructor")):"number"===typeof a&&"number"===typeof b&&"number"===typeof c&&(0<=c||isNaN(c))&&"number"===typeof d&&(0<=d||isNaN(d))?(this.x=a,this.y=b,this.width=c,
this.height=d):B("Invalid arguments to Rect constructor: "+a+", "+b+", "+c+", "+d);this.s=!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 Wb(a,b,c){a.width=b;a.height=c}t.Ig=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.od=function(a){this.x=a.x;this.y=a.y;return this};t.VA=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.ca=function(){this.s=!0;Object.freeze(this);return this};t.G=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};
t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.s=!1;return this};function Xb(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));for(var f=0;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));for(var g=0;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));return new N(c,e,f,g)}return new N}
function Yb(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.w=function(a){return a instanceof N?this.x===a.x&&this.y===a.y&&this.width===a.width&&this.height===a.height:!1};t.fj=function(a,b,c,d){return this.x===a&&this.y===b&&this.width===c&&this.height===d};t.Na=function(a){return K.A(this.x,a.x)&&K.A(this.y,a.y)&&K.A(this.width,a.width)&&K.A(this.height,a.height)};
function ac(a,b){return K.$(a.x,b.x)&&K.$(a.y,b.y)&&K.$(a.width,b.width)&&K.$(a.height,b.height)}t.aa=function(a){return this.x<=a.x&&this.x+this.width>=a.x&&this.y<=a.y&&this.y+this.height>=a.y};t.De=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.Ic=function(a,b){return bc(this,b,a,b,a)};t.sq=function(a){return bc(this,a.top,a.right,a.bottom,a.left)};t.Iw=function(a){return bc(this,-a.top,-a.right,-a.bottom,-a.left)};t.nA=function(a,b,c,d){return bc(this,a,b,c,d)};function bc(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.sA=function(a){return cc(this,a.x,a.y,a.width,a.height)};t.aw=function(a,b,c,d){return cc(this,a,b,c,d)};
function cc(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.Lc=function(a){return this.bw(a.x,a.y,a.width,a.height)};t.bw=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 dc(a,b){var c=a.width,d=a.x,e=b.x-10;if(d>b.width+10+10+e||e>c+d)return!1;c=a.height;a=a.y;d=b.y-10;return a>b.height+10+10+d||d>c+a?!1:!0}t.Me=function(a){return fc(this,a.x,a.y,0,0)};t.Oc=function(a){return fc(this,a.x,a.y,a.width,a.height)};t.Pw=function(a,b,c,d){void 0===c&&(c=0);void 0===d&&(d=0);return fc(this,a,b,c,d)};
function fc(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.Lk=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 gc(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 hc(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.u=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)};t.uA=function(){return 0===this.width&&0===this.height};N.alloc=function(){var a=ic.pop();return void 0===a?new N:a};N.allocAt=function(a,b,c,d){var e=ic.pop();return void 0===e?new N(a,b,c,d):e.h(a,b,c,d)};N.free=function(a){ic.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 M(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.uA;N.prototype.isReal=N.prototype.u;N.intersectsLineSegment=function(a,b,c,d,e,f,g,h){return K.Ay(a,b,c,d,e,f,g,h)};N.prototype.setSpot=N.prototype.Lk;N.prototype.union=N.prototype.Pw;N.prototype.unionRect=N.prototype.Oc;N.prototype.unionPoint=N.prototype.Me;N.prototype.intersects=N.prototype.bw;
N.prototype.intersectsRect=N.prototype.Lc;N.prototype.intersect=N.prototype.aw;N.prototype.intersectRect=N.prototype.sA;N.prototype.grow=N.prototype.nA;N.prototype.subtractMargin=N.prototype.Iw;N.prototype.addMargin=N.prototype.sq;N.prototype.inflate=N.prototype.Ic;N.prototype.offset=N.prototype.offset;N.prototype.contains=N.prototype.contains;N.prototype.containsRect=N.prototype.De;N.prototype.containsPoint=N.prototype.aa;N.prototype.equalsApprox=N.prototype.Na;N.prototype.equalTo=N.prototype.fj;
N.prototype.equals=N.prototype.w;N.prototype.setSize=N.prototype.VA;N.prototype.setPoint=N.prototype.od;N.prototype.set=N.prototype.set;N.prototype.setTo=N.prototype.Ig;var jc=null,kc=null,ic=[];N.className="Rect";N.parse=Xb;N.stringify=Yb;N.contains=gc;N.intersects=hc;N.ZeroRect=jc=(new N(0,0,0,0)).ca();N.NoRect=kc=(new N(NaN,NaN,NaN,NaN)).ca();N.parse=Xb;N.stringify=Yb;N.contains=gc;N.intersects=hc;
function pc(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):B("Invalid arguments to Margin constructor: "+a+", "+b+", "+c+", "+d);this.s=!1}pc.prototype.assign=function(a){this.top=a.top;this.right=a.right;this.bottom=a.bottom;this.left=a.left;return this};
pc.prototype.Ig=function(a,b,c,d){this.top=a;this.right=b;this.bottom=c;this.left=d;return this};pc.prototype.set=function(a){this.top=a.top;this.right=a.right;this.bottom=a.bottom;this.left=a.left;return this};pc.prototype.copy=function(){var a=new pc;a.top=this.top;a.right=this.right;a.bottom=this.bottom;a.left=this.left;return a};t=pc.prototype;t.ca=function(){this.s=!0;Object.freeze(this);return this};t.G=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};
t.freeze=function(){this.s=!0;return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.s=!1;return this};
function qc(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=NaN;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));if(isNaN(c))return new pc;for(var e=NaN;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));if(isNaN(e))return new pc(c);for(var f=NaN;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));if(isNaN(f))return new pc(c,e);for(var g=NaN;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));return isNaN(g)?new pc(c,e):new pc(c,e,f,g)}return new pc}
function rc(a){return a.top.toString()+" "+a.right.toString()+" "+a.bottom.toString()+" "+a.left.toString()}t.toString=function(){return"Margin("+this.top+","+this.right+","+this.bottom+","+this.left+")"};t.w=function(a){return a instanceof pc?this.top===a.top&&this.right===a.right&&this.bottom===a.bottom&&this.left===a.left:!1};t.fj=function(a,b,c,d){return this.top===a&&this.right===b&&this.bottom===c&&this.left===d};
t.Na=function(a){return K.A(this.top,a.top)&&K.A(this.right,a.right)&&K.A(this.bottom,a.bottom)&&K.A(this.left,a.left)};t.u=function(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)};pc.alloc=function(){var a=sc.pop();return void 0===a?new pc:a};pc.free=function(a){sc.push(a)};pc.prototype.isReal=pc.prototype.u;pc.prototype.equalsApprox=pc.prototype.Na;pc.prototype.equalTo=pc.prototype.fj;pc.prototype.equals=pc.prototype.w;pc.prototype.set=pc.prototype.set;
pc.prototype.setTo=pc.prototype.Ig;var tc=null,uc=null,sc=[];pc.className="Margin";pc.parse=qc;pc.stringify=rc;pc.ZeroMargin=tc=(new pc(0,0,0,0)).ca();pc.TwoMargin=uc=(new pc(2,2,2,2)).ca();pc.parse=qc;pc.stringify=rc;function P(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.s=!1}
var vc,wc,yc,zc,Ac,Bc,Cc,Dc,Gc,Hc,Ic,Jc,Kc,Lc,Mc,Nc,Oc,Qc,Rc,Sc,Tc,Uc,Vc,Wc,$c,ad,bd,cd,dd,ed,fd,gd,hd,id,jd,kd;P.prototype.assign=function(a){this.x=a.x;this.y=a.y;this.offsetX=a.offsetX;this.offsetY=a.offsetY;return this};P.prototype.Ig=function(a,b,c,d){this.x=a;this.y=b;this.offsetX=c;this.offsetY=d;return this};P.prototype.set=function(a){this.x=a.x;this.y=a.y;this.offsetX=a.offsetX;this.offsetY=a.offsetY;return this};
P.prototype.copy=function(){var a=new P;a.x=this.x;a.y=this.y;a.offsetX=this.offsetX;a.offsetY=this.offsetY;return a};t=P.prototype;t.ca=function(){this.s=!0;Object.freeze(this);return this};t.G=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.s=!1;return this};function ld(a,b){a.x=NaN;a.y=NaN;a.offsetX=b;return a}
function md(a){if("string"===typeof a){a=a.trim();if("None"===a)return vc;if("TopLeft"===a)return wc;if("Top"===a||"TopCenter"===a||"MiddleTop"===a)return yc;if("TopRight"===a)return zc;if("Left"===a||"LeftCenter"===a||"MiddleLeft"===a)return Ac;if("Center"===a)return Bc;if("Right"===a||"RightCenter"===a||"MiddleRight"===a)return Cc;if("BottomLeft"===a)return Dc;if("Bottom"===a||"BottomCenter"===a||"MiddleBottom"===a)return Gc;if("BottomRight"===a)return Hc;if("TopSide"===a)return Ic;if("LeftSide"===
a)return Jc;if("RightSide"===a)return Kc;if("BottomSide"===a)return Lc;if("TopBottomSides"===a)return Mc;if("LeftRightSides"===a)return Nc;if("TopLeftSides"===a)return Oc;if("TopRightSides"===a)return Qc;if("BottomLeftSides"===a)return Rc;if("BottomRightSides"===a)return Sc;if("NotTopSide"===a)return Tc;if("NotLeftSide"===a)return Uc;if("NotRightSide"===a)return Vc;if("NotBottomSide"===a)return Wc;if("AllSides"===a)return $c;if("Default"===a)return ad;a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;
var d=a[b++];void 0!==d&&0<d.length&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(e=parseFloat(d));for(var f=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(f=parseFloat(d));for(var g=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(g=parseFloat(d));return new P(c,e,f,g)}return new P}function nd(a){return a.ib()?a.x.toString()+" "+a.y.toString()+" "+a.offsetX.toString()+" "+a.offsetY.toString():a.toString()}
t.toString=function(){return this.ib()?0===this.offsetX&&0===this.offsetY?"Spot("+this.x+","+this.y+")":"Spot("+this.x+","+this.y+","+this.offsetX+","+this.offsetY+")":this.w(vc)?"None":this.w(wc)?"TopLeft":this.w(yc)?"Top":this.w(zc)?"TopRight":this.w(Ac)?"Left":this.w(Bc)?"Center":this.w(Cc)?"Right":this.w(Dc)?"BottomLeft":this.w(Gc)?"Bottom":this.w(Hc)?"BottomRight":this.w(Ic)?"TopSide":this.w(Jc)?"LeftSide":this.w(Kc)?"RightSide":this.w(Lc)?"BottomSide":this.w(Mc)?"TopBottomSides":this.w(Nc)?
"LeftRightSides":this.w(Oc)?"TopLeftSides":this.w(Qc)?"TopRightSides":this.w(Rc)?"BottomLeftSides":this.w(Sc)?"BottomRightSides":this.w(Tc)?"NotTopSide":this.w(Uc)?"NotLeftSide":this.w(Vc)?"NotRightSide":this.w(Wc)?"NotBottomSide":this.w($c)?"AllSides":this.w(ad)?"Default":"None"};t.w=function(a){return a instanceof P?(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.kw=function(){return new P(.5-(this.x-.5),.5-(this.y-.5),-this.offsetX,-this.offsetY)};t.Df=function(a){if(!this.Mc())return!1;if(!a.Mc())if(a.w(bd))a=Jc;else if(a.w(cd))a=Kc;else if(a.w(dd))a=Ic;else if(a.w(ed))a=Lc;else return!1;a=a.offsetY;return(this.offsetY&a)===a};t.ib=function(){return!isNaN(this.x)&&!isNaN(this.y)};t.mc=function(){return isNaN(this.x)||isNaN(this.y)};t.Mc=function(){return isNaN(this.x)&&isNaN(this.y)&&1===this.offsetX&&0!==this.offsetY};
t.Vt=function(){return isNaN(this.x)&&isNaN(this.y)&&0===this.offsetX&&0===this.offsetY};t.Mb=function(){return isNaN(this.x)&&isNaN(this.y)&&-1===this.offsetX&&0===this.offsetY};P.alloc=function(){var a=qd.pop();return void 0===a?new P:a};P.free=function(a){qd.push(a)};P.prototype.isDefault=P.prototype.Mb;P.prototype.isNone=P.prototype.Vt;P.prototype.isSide=P.prototype.Mc;P.prototype.isNoSpot=P.prototype.mc;P.prototype.isSpot=P.prototype.ib;P.prototype.includesSide=P.prototype.Df;
P.prototype.opposite=P.prototype.kw;P.prototype.equals=P.prototype.w;P.prototype.set=P.prototype.set;P.prototype.setTo=P.prototype.Ig;var qd=[];P.className="Spot";P.parse=md;P.stringify=nd;P.None=vc=ld(new P(0,0,0,0),0).ca();P.Default=ad=ld(new P(0,0,-1,0),-1).ca();P.TopLeft=wc=(new P(0,0,0,0)).ca();P.TopCenter=yc=(new P(.5,0,0,0)).ca();P.TopRight=zc=(new P(1,0,0,0)).ca();P.LeftCenter=Ac=(new P(0,.5,0,0)).ca();P.Center=Bc=(new P(.5,.5,0,0)).ca();P.RightCenter=Cc=(new P(1,.5,0,0)).ca();
P.BottomLeft=Dc=(new P(0,1,0,0)).ca();P.BottomCenter=Gc=(new P(.5,1,0,0)).ca();P.BottomRight=Hc=(new P(1,1,0,0)).ca();P.MiddleTop=fd=yc;P.MiddleLeft=gd=Ac;P.MiddleRight=hd=Cc;P.MiddleBottom=id=Gc;P.Top=dd=yc;P.Left=bd=Ac;P.Right=cd=Cc;P.Bottom=ed=Gc;P.TopSide=Ic=ld(new P(0,0,1,1),1).ca();P.LeftSide=Jc=ld(new P(0,0,1,2),1).ca();P.RightSide=Kc=ld(new P(0,0,1,4),1).ca();P.BottomSide=Lc=ld(new P(0,0,1,8),1).ca();P.TopBottomSides=Mc=ld(new P(0,0,1,9),1).ca();P.LeftRightSides=Nc=ld(new P(0,0,1,6),1).ca();
P.TopLeftSides=Oc=ld(new P(0,0,1,3),1).ca();P.TopRightSides=Qc=ld(new P(0,0,1,5),1).ca();P.BottomLeftSides=Rc=ld(new P(0,0,1,10),1).ca();P.BottomRightSides=Sc=ld(new P(0,0,1,12),1).ca();P.NotTopSide=Tc=ld(new P(0,0,1,14),1).ca();P.NotLeftSide=Uc=ld(new P(0,0,1,13),1).ca();P.NotRightSide=Vc=ld(new P(0,0,1,11),1).ca();P.NotBottomSide=Wc=ld(new P(0,0,1,7),1).ca();P.AllSides=$c=ld(new P(0,0,1,15),1).ca();jd=(new P(.156,.156)).ca();kd=(new P(.844,.844)).ca();P.parse=md;P.stringify=nd;
function rd(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0}rd.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};rd.prototype.copy=function(){var a=new rd;a.m11=this.m11;a.m12=this.m12;a.m21=this.m21;a.m22=this.m22;a.dx=this.dx;a.dy=this.dy;return a};t=rd.prototype;t.toString=function(){return"Transform("+this.m11+","+this.m12+","+this.m21+","+this.m22+","+this.dx+","+this.dy+")"};
t.w=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};t.Tt=function(){return 0===this.dx&&0===this.dy&&1===this.m11&&0===this.m12&&0===this.m21&&1===this.m22};t.reset=function(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0;return this};
t.multiply=function(a){var b=this.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};
t.iw=function(a){var b=1/(a.m11*a.m22-a.m12*a.m21),c=a.m22*b,d=-a.m12*b,e=-a.m21*b,f=a.m11*b,g=b*(a.m21*a.dy-a.m22*a.dx);a=b*(a.m12*a.dx-a.m11*a.dy);b=this.m11*c+this.m21*d;c=this.m12*c+this.m22*d;d=this.m11*e+this.m21*f;e=this.m12*e+this.m22*f;this.dx=this.m11*g+this.m21*a+this.dx;this.dy=this.m12*g+this.m22*a+this.dy;this.m11=b;this.m12=c;this.m21=d;this.m22=e;return this};
t.St=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};
rd.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=rd.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.sa=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.Zd=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.Ow=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};rd.alloc=function(){var a=sd.pop();return void 0===a?new rd:a};
rd.free=function(a){sd.push(a)};rd.prototype.transformRect=rd.prototype.Ow;rd.prototype.invertedTransformPoint=rd.prototype.Zd;rd.prototype.transformPoint=rd.prototype.sa;rd.prototype.scale=rd.prototype.scale;rd.prototype.translate=rd.prototype.translate;rd.prototype.rotate=rd.prototype.rotate;rd.prototype.invert=rd.prototype.St;rd.prototype.multiplyInverted=rd.prototype.iw;rd.prototype.multiply=rd.prototype.multiply;rd.prototype.reset=rd.prototype.reset;rd.prototype.isIdentity=rd.prototype.Tt;
rd.prototype.equals=rd.prototype.w;rd.prototype.set=rd.prototype.set;var sd=[];rd.className="Transform";rd.xF="54a702f3e53909c447824c6706603faf4c";
var K={eB:"7da71ca0ad381e90",Kg:(Math.sqrt(2)-1)/3*4,hx:null,sqrt:function(a){if(0>=a)return 0;var b=K.hx;if(null===b){b=[];for(var c=0;2E3>=c;c++)b[c]=Math.sqrt(c);K.hx=b}return 1>a?(c=1/a,2E3>=c?1/b[c|0]:Math.sqrt(a)):2E3>=a?b[a|0]:Math.sqrt(a)},A:function(a,b){a-=b;return.5>a&&-.5<a},$:function(a,b){a-=b;return 5E-8>a&&-5E-8<a},Nb: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},yt:function(a,b,c,d,e,f,g,h,k,l,m,n){if(K.Nb(a,b,g,h,n,c,d)&&K.Nb(a,b,g,h,n,e,f))return K.Nb(a,b,g,h,n,l,m);var p=(a+c)/2,r=(b+d)/2,q=(c+e)/2,u=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(p+q)/2;c=(r+u)/2;q=(q+e)/2;u=(u+f)/2;var v=(d+q)/2,w=(c+u)/2;return K.yt(a,
b,p,r,d,c,v,w,k,l,m,n)||K.yt(v,w,q,u,e,f,g,h,k,l,m,n)},sz: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},rz:function(a,b,c,d,e,f,g,h){var k=(c+e)/2,l=(d+f)/2;return Eb(((a+c)/2+k)/2,((b+d)/2+l)/2,(k+(e+g)/2)/2,(l+(f+h)/2)/2)},pm:function(a,b,c,d,e,f,g,h,k,l){if(K.Nb(a,b,g,h,k,c,d)&&K.Nb(a,b,g,h,k,e,f))fc(l,a,b,0,0),fc(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.pm(a,b,m,n,d,c,q,u,k,l);K.pm(q,u,p,r,e,f,g,h,k,l)}return l},Ce:function(a,b,c,d,e,f,g,h,k,l){if(K.Nb(a,b,g,h,k,c,d)&&K.Nb(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.Ce(a,b,m,n,d,c,q,u,k,l);K.Ce(q,u,p,r,e,f,g,h,k,l)}return l},nw:function(a,b,c,d,e,f,g,h,k,l){if(K.Nb(a,b,e,f,l,c,d))return K.Nb(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.nw(a,b,m,n,p,r,g,h,k,l)||K.nw(p,r,c,d,e,f,g,h,k,l)},tB: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},mw:function(a,b,c,d,e,f,g,h){if(K.Nb(a,b,e,f,g,c,d))fc(h,a,b,0,0),fc(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.mw(a,b,k,l,m,n,g,h);K.mw(m,n,c,d,e,f,g,h)}return h},Wq:function(a,b,c,d,e,f,g,h){if(K.Nb(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.Wq(a,b,k,l,m,n,g,h);K.Wq(m,n,c,d,e,f,g,h)}return h},uq:function(a,b,c,d,e,f,g,h,k,l,m,n,p,r){if(K.Nb(a,b,g,h,p,c,d)&&K.Nb(a,b,g,h,p,e,f)){if(a<k&&g<k&&a<m&&g<m||a>k&&g>k&&a>m&&g>m||b<l&&h<l&&b<n&&h<n||b>l&&h>l&&b>n&&h>n)return!1;var q=(a-g)*(l-n)-(b-h)*(k-m);if(0===q)return!1;p=((a*h-b*g)*(k-m)-(a-g)*(k*n-l*m))/q;q=((a*h-b*g)*(l-n)-(b-h)*(k*n-l*m))/q;if((k>m?k-m:m-k)<(l>n?l-n:n-l)){if(b<h?g=b:
(g=h,h=b),1E-5+q<g||q>h+1E-5)return!1}else if(a<g?h=a:(h=g,g=a),1E-5+p<h||p>g+1E-5)return!1;r.h(p,q);return!0}q=(a+c)/2;var u=(b+d)/2,v=(c+e)/2,w=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(q+v)/2;c=(u+w)/2;v=(v+e)/2;w=(w+f)/2;var y=(d+v)/2,z=(c+w)/2,A=(m-k)*(m-k)+(n-l)*(n-l),C=!1,G=0,L=0;K.uq(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,C=!0,G=r.x,L=r.y));K.uq(y,z,v,w,e,f,g,h,k,l,m,n,p,r)&&(r.x-k)*(r.x-k)+(r.y-l)*(r.y-l)<A&&(C=!0,G=r.x,L=r.y);C&&(r.x=G,r.y=L);return C},vq:function(a,
b,c,d,e,f,g,h,k,l,m,n,p){var r=0;if(K.Nb(a,b,g,h,p,c,d)&&K.Nb(a,b,g,h,p,e,f)){p=(a-g)*(l-n)-(b-h)*(k-m);if(0===p)return r;var q=((a*h-b*g)*(k-m)-(a-g)*(k*n-l*m))/p,u=((a*h-b*g)*(l-n)-(b-h)*(k*n-l*m))/p;if(q>=m)return r;if((k>m?k-m:m-k)<(l>n?l-n:n-l)){if(b<h?(a=b,b=h):a=h,u<a||u>b)return r}else if(a<g?(b=a,a=g):b=g,q<b||q>a)return r;0<p?r++:0>p&&r--}else{q=(a+c)/2;u=(b+d)/2;var v=(c+e)/2,w=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(q+v)/2;c=(u+w)/2;v=(v+e)/2;w=(w+f)/2;var y=(d+v)/2,z=(c+w)/2;r+=K.vq(a,b,q,u,d,
c,y,z,k,l,m,n,p);r+=K.vq(y,z,v,w,e,f,g,h,k,l,m,n,p)}return r},Qh: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},Ie:function(a,b,c,d,e,f,g,h,k){if(K.A(a,c)&&K.A(b,d))return k.h(a,
b),!1;if(K.$(e,g))return K.$(a,c)?(K.Qh(a,b,c,d,e,f,k),!1):K.Qh(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.Qh(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.Qh(a,b,c,d,e,g*(e-a)+b,k)},rB:function(a,b,c,d,e){return K.Ie(c.x,c.y,d.x,d.y,a.x,a.y,b.x,
b.y,e)},pB: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},bd:function(a,b,c,d,e,f,g,h,k){var l=1E21,m=a,n=b;if(K.Ie(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.Ie(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.Ie(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.Ie(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},oB:function(a,b,c,d,e,f,g,h,k){c=a-c;g=e-g;0===c||0===g?0===c?(b=(f-h)/g,h=a,e=b*h+(f-b*e)):(f=(b-d)/c,h=e,e=f*h+(b-f*a)):(d=(b-d)/c,h=(f-h)/g,a=b-d*a,h=(f-h*e-a)/(d-h),e=d*h+a);k.h(h,e);return k},Qt:function(a,b,c){return K.Ay(a.x,a.y,a.width,a.height,b.x,b.y,c.x,c.y)},Ay: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):gc(a,b,c,d,e,f)||gc(a,b,c,d,g,h)||
K.Mq(a,b,k,b,e,f,g,h)||K.Mq(k,b,k,l,e,f,g,h)||K.Mq(k,l,a,l,e,f,g,h)||K.Mq(a,l,a,b,e,f,g,h)?!0:!1},Mq:function(a,b,c,d,e,f,g,h){return 0>=K.Bt(a,b,c,d,e,f)*K.Bt(a,b,c,d,g,h)&&0>=K.Bt(e,f,g,h,a,b)*K.Bt(e,f,g,h,c,d)},Bt:function(a,b,c,d,e,f){c-=a;d-=b;a=e-a;b=f-b;f=a*d-b*c;0===f&&(f=a*c+b*d,0<f&&(f=(a-c)*c+(b-d)*d,0>f&&(f=0)));return 0>f?-1:0<f?1:0},Tq:function(a){0>a&&(a+=360);360<=a&&(a-=360);return a},by: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.Cz(c,l,e,a,b)),d-=Math.abs(e-l),l=e;return f},Cz: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)]},Eq: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},qy: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},Hz: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.Iz(k,0===g?a:b,
l,c,0,0)},Iz: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},Oe:new ab,bn:new ab,Uh:new ab,Vh:0};K.za=K.eB;
function td(a){Ya(this);this.s=!1;void 0===a&&(a=ud);this.pa=a;this.nc=this.gc=this.$c=this.Zc=0;this.Gj=new E;this.Zr=this.Gj.Aa;this.Hr=(new N).freeze();this.qa=!0;this.jn=this.Uk=null;this.kn=NaN;this.nf=wc;this.pf=Hc;this.wl=this.xl=NaN;this.Rf=vd}
td.prototype.copy=function(){var a=new td;a.pa=this.pa;a.Zc=this.Zc;a.$c=this.$c;a.gc=this.gc;a.nc=this.nc;for(var b=this.Gj.j,c=b.length,d=a.Gj,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.Zr=this.Zr;a.Hr.assign(this.Hr);a.qa=this.qa;a.Uk=this.Uk;a.jn=this.jn;a.kn=this.kn;a.nf=this.nf.G();a.pf=this.pf.G();a.xl=this.xl;a.wl=this.wl;a.Rf=this.Rf;return a};t=td.prototype;t.ca=function(){this.freeze();Object.freeze(this);return this};
t.freeze=function(){this.s=!0;var a=this.figures;a.freeze();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].freeze();return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.s=!1;var a=this.figures;a.ea();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].ea();return this};
t.Na=function(a){if(!(a instanceof td))return!1;if(this.type!==a.type)return this.type===wd&&a.type===ud?xd(this,a):a.type===wd&&this.type===ud?xd(a,this):!1;if(this.type===ud){var b=this.figures.j;a=a.figures.j;var c=b.length;if(c!==a.length)return!1;for(var d=0;d<c;d++)if(!b[d].Na(a[d]))return!1;return!0}return K.A(this.startX,a.startX)&&K.A(this.startY,a.startY)&&K.A(this.endX,a.endX)&&K.A(this.endY,a.endY)};
function xd(a,b){return a.type!==wd||b.type!==ud?!1:1===b.figures.count&&(b=b.figures.L(0),1===b.segments.count&&K.A(a.startX,b.startX)&&K.A(a.startY,b.startY)&&(b=b.segments.L(0),b.type===yd&&K.A(a.endX,b.endX)&&K.A(a.endY,b.endY)))?!0:!1}function zd(a){return a.toString()}t.hb=function(a){a.classType===td&&(this.type=a)};
t.toString=function(a){void 0===a&&(a=-1);switch(this.type){case wd:return 0>a?"M"+this.startX.toString()+" "+this.startY.toString()+"L"+this.endX.toString()+" "+this.endY.toString():"M"+this.startX.toFixed(a)+" "+this.startY.toFixed(a)+"L"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);case Hd:var b=new N(this.startX,this.startY,0,0);b.Pw(this.endX,this.endY,0,0);return 0>a?"M"+b.x.toString()+" "+b.y.toString()+"H"+b.right.toString()+"V"+b.bottom.toString()+"H"+b.left.toString()+"z":"M"+b.x.toFixed(a)+
" "+b.y.toFixed(a)+"H"+b.right.toFixed(a)+"V"+b.bottom.toFixed(a)+"H"+b.left.toFixed(a)+"z";case Id:b=new N(this.startX,this.startY,0,0);b.Pw(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 ud:b="";c=this.figures.j;for(var d=c.length,e=0;e<d;e++){var f=c[e];0<e&&(b+=" x ");f.isFilled&&(b+="F ");b+=f.toString(a)}return b;default:return this.type.toString()}};
function Jd(a,b){function c(){return u>=A-1?!0:null!==k[u+1].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/)}function d(){u++;return k[u]}function e(){var a=new J(parseFloat(d()),parseFloat(d()));v===v.toLowerCase()&&(a.x=z.x+a.x,a.y=z.y+a.y);return a}function f(){return z=e()}function g(){return y=e()}function h(){var a=w.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);a=a.replace(/,/gm," ");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,
"$1 $2");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,"$1 $2");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([^\s])/gm,"$1 $2");a=a.replace(/([^\s])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,"$1 $2");a=a.replace(/([0-9])([+\-])/gm,"$1 $2");a=a.replace(/[\s\r\t\n]+/gm," ");a=a.replace(/^\s+|\s+$/g,"");var k=a.split(" ");for(a=0;a<k.length;a++){var l=k[a];if(null!==l.match(/(\.[0-9]*)(\.)/gm)){for(var m=Ea(),n="",p=!1,r=0;r<l.length;r++){var q=l[r];"."!==q||p?"."===q?(m.push(n),
n="."):n+=q:(p=!0,n+=q)}m.push(n);k.splice(a,1);for(l=0;l<m.length;l++)k.splice(a+l,0,m[l]);a+=m.length-1;Ha(m)}}var u=-1,v="",w="";m=new J(0,0);var y=new J(0,0),z=new J(0,0),A=k.length;a=Kd(null);n=l=!1;p=!0;for(r=null;!(u>=A-1);)if(w=v,v=d(),""!==v)switch(v.toUpperCase()){case "X":p=!0;n=l=!1;break;case "M":r=f();null===a.hc||!0===p?(Ld(a,r.x,r.y,l,!n),p=!1):a.moveTo(r.x,r.y);for(m=z;!c();)r=f(),a.lineTo(r.x,r.y);break;case "L":for(;!c();)r=f(),a.lineTo(r.x,r.y);break;case "H":for(;!c();)z=new J((v===
v.toLowerCase()?z.x:0)+parseFloat(d()),z.y),a.lineTo(z.x,z.y);break;case "V":for(;!c();)z=new J(z.x,(v===v.toLowerCase()?z.y:0)+parseFloat(d())),a.lineTo(z.x,z.y);break;case "C":for(;!c();){r=e();q=g();var C=f();Md(a,r.x,r.y,q.x,q.y,C.x,C.y)}break;case "S":for(;!c();)r=h(),q=g(),C=f(),Md(a,r.x,r.y,q.x,q.y,C.x,C.y);break;case "Q":for(;!c();)r=g(),q=f(),Rd(a,r.x,r.y,q.x,q.y);break;case "T":for(;!c();)y=r=h(),q=f(),Rd(a,r.x,r.y,q.x,q.y);break;case "B":for(;!c();){r=parseFloat(d());q=parseFloat(d());
C=parseFloat(d());var G=parseFloat(d()),L=parseFloat(d()),I=L,T=!1;c()||(I=parseFloat(d()),c()||(T=0!==parseFloat(d())));v===v.toLowerCase()&&(C+=z.x,G+=z.y);a.arcTo(r,q,C,G,L,I,T)}break;case "A":for(;!c();)r=Math.abs(parseFloat(d())),q=Math.abs(parseFloat(d())),C=parseFloat(d()),L=G=!1,T=I=0,I=d(),1===I.length?(G=!!parseFloat(I),L=!!parseFloat(d()),I=parseFloat(d())):2===I.length?(G=!!parseFloat(I[0]),L=!!parseFloat(I[1]),I=parseFloat(d())):(G=!!parseFloat(I[0]),L=!!parseFloat(I[1]),I=parseFloat(I.slice(2))),
T=parseFloat(d()),v===v.toLowerCase()&&(I=z.x+I,T=z.y+T),z.h(I,T),Sd(a,r,q,C,G,L,I,T);break;case "Z":Td(a);z=m;break;case "F":r="";for(q=1;k[u+q];)if(null!==k[u+q].match(/[Uu]/))q++;else if(null===k[u+q].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/))q++;else{r=k[u+q];break}r.match(/[Mm]/)?l=!0:0<a.hc.segments.length&&(a.hc.isFilled=!0);break;case "U":r="";for(q=1;k[u+q];)if(null!==k[u+q].match(/[Ff]/))q++;else if(null===k[u+q].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/))q++;else{r=k[u+q];break}r.match(/[Mm]/)?
n=!0:a.gr(!1)}m=a.Lt;Ud=a;if(b)for(b=m.figures.iterator;b.next();)b.value.isFilled=!0;return m}function Vd(a,b){for(var c=a.length,d=J.alloc(),e=0;e<c;e++){var f=a[e];d.x=f[0];d.y=f[1];b.sa(d);f[0]=d.x;f[1]=d.y;d.x=f[2];d.y=f[3];b.sa(d);f[2]=d.x;f[3]=d.y;d.x=f[4];d.y=f[5];b.sa(d);f[4]=d.x;f[5]=d.y;d.x=f[6];d.y=f[7];b.sa(d);f[6]=d.x;f[7]=d.y}J.free(d)}t.fw=function(){if(this.qa||this.Zr!==this.figures.Aa)return!0;for(var a=this.figures.j,b=a.length,c=0;c<b;c++)if(a[c].fw())return!0;return!1};
td.prototype.computeBounds=function(){this.qa=!1;this.jn=this.Uk=null;this.kn=NaN;this.Zr=this.figures.Aa;for(var a=this.figures.j,b=a.length,c=0;c<b;c++){var d=a[c];d.qa=!1;var e=d.segments;d.dt=e.Aa;d=e.j;e=d.length;for(var f=0;f<e;f++){var g=d[f];g.qa=!1;g.Qe=null}}a=this.Hr;a.ea();isNaN(this.xl)||isNaN(this.wl)?a.h(0,0,0,0):a.h(0,0,this.xl,this.wl);Wd(this,a,!1);fc(a,0,0,0,0);a.freeze()};td.prototype.ay=function(){var a=new N;Wd(this,a,!0);return a};
function Wd(a,b,c){switch(a.type){case wd:case Hd:case Id:c?b.h(a.Zc,a.$c,0,0):fc(b,a.Zc,a.$c,0,0);fc(b,a.gc,a.nc,0,0);break;case ud:var d=a.figures;a=d.j;d=d.length;for(var e=0;e<d;e++){var f=a[e];c&&0===e?b.h(f.startX,f.startY,0,0):fc(b,f.startX,f.startY,0,0);for(var g=f.segments.j,h=g.length,k=f.startX,l=f.startY,m=0;m<h;m++){var n=g[m];switch(n.type){case yd:case Xd:k=n.endX;l=n.endY;fc(b,k,l,0,0);break;case Yd:K.pm(k,l,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.5,b);k=n.endX;l=n.endY;
break;case Zd:K.mw(k,l,n.point1X,n.point1Y,n.endX,n.endY,.5,b);k=n.endX;l=n.endY;break;case $d:case ae:var p=n.type===$d?be(n,f):ce(n,f,k,l),r=p.length;if(0===r){k=n.centerX;l=n.centerY;fc(b,k,l,0,0);break}n=null;for(var q=0;q<r;q++)n=p[q],K.pm(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],.5,b);null!==n&&(k=n[6],l=n[7]);break;default:B("Unknown Segment type: "+n.type)}}}break;default:B("Unknown Geometry type: "+a.type)}}
td.prototype.normalize=function(){this.s&&ua(this);var a=this.ay();this.offset(-a.x,-a.y);return new J(-a.x,-a.y)};td.prototype.offset=function(a,b){this.s&&ua(this);this.transform(1,0,0,1,a,b);return this};td.prototype.scale=function(a,b){this.s&&ua(this);this.transform(a,0,0,b,0,0);return this};td.prototype.rotate=function(a,b,c){this.s&&ua(this);void 0===b&&(b=0);void 0===c&&(c=0);var d=rd.alloc();d.reset();d.rotate(a,b,c);this.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);rd.free(d);return this};
t=td.prototype;
t.transform=function(a,b,c,d,e,f){switch(this.type){case wd:case Hd:case Id:var g=this.Zc;var h=this.$c;this.Zc=g*a+h*c+e;this.$c=g*b+h*d+f;g=this.gc;h=this.nc;this.gc=g*a+h*c+e;this.nc=g*b+h*d+f;break;case ud:for(var k=this.figures.j,l=k.length,m=0;m<l;m++){var n=k[m];g=n.startX;h=n.startY;n.startX=g*a+h*c+e;n.startY=g*b+h*d+f;n=n.segments.j;for(var p=n.length,r=0;r<p;r++){var q=n[r];switch(q.type){case yd:case Xd:g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case Yd:g=q.point1X;h=q.point1Y;
q.point1X=g*a+h*c+e;q.point1Y=g*b+h*d+f;g=q.point2X;h=q.point2Y;q.point2X=g*a+h*c+e;q.point2Y=g*b+h*d+f;g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case Zd:g=q.point1X;h=q.point1Y;q.point1X=g*a+h*c+e;q.point1Y=g*b+h*d+f;g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case $d:g=q.centerX;h=q.centerY;q.centerX=g*a+h*c+e;q.centerY=g*b+h*d+f;0!==b&&(g=180*Math.atan2(b,a)/Math.PI,0>g&&(g+=360),q.startAngle+=g);0>a&&(q.startAngle=180-q.startAngle,q.sweepAngle=-q.sweepAngle);0>d&&
(q.startAngle=-q.startAngle,q.sweepAngle=-q.sweepAngle);q.radiusX*=Math.sqrt(a*a+c*c);void 0!==q.radiusY&&(q.radiusY*=Math.sqrt(b*b+d*d));break;case ae:g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;0!==b&&(g=180*Math.atan2(b,a)/Math.PI,0>g&&(g+=360),q.xAxisRotation+=g);0>a&&(q.xAxisRotation=180-q.xAxisRotation,q.isClockwiseArc=!q.isClockwiseArc);0>d&&(q.xAxisRotation=-q.xAxisRotation,q.isClockwiseArc=!q.isClockwiseArc);q.radiusX*=Math.sqrt(a*a+c*c);q.radiusY*=Math.sqrt(b*b+d*d);break;default:B("Unknown Segment type: "+
q.type)}}}}this.qa=!0;return this};
t.aa=function(a,b){void 0===b&&(b=0);var c=this.Zc,d=this.$c,e=this.gc,f=this.nc;switch(this.type){case wd:return K.Nb(c,d,e,f,b,a.x,a.y);case Hd: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.aa(a);N.free(g);return a;case Id: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 ud:return de(this,a,b,!0,!1);default:return!1}};
function de(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.j,r=p.length,q=0;q<r;q++){var u=p[q];if(u.isFilled){if(d&&u.aa(f,b,c))return!0;var v=u.segments;k=u.startX;l=u.startY;for(var w=k,y=l,z=v.j,A=0;A<=v.length;A++){var C=void 0;if(A!==v.length){C=z[A];var G=C.type;a=C.endX;n=C.endY}else G=yd,a=w,n=y;switch(G){case Xd:w=ee(f,b,g,b,k,l,w,y);if(isNaN(w))return!0;h+=w;w=a;y=n;break;case yd:k=ee(f,b,g,b,k,l,a,n);if(isNaN(k))return!0;h+=k;break;case Yd:m=K.vq(k,l,C.point1X,
C.point1Y,C.point2X,C.point2Y,a,n,g,b,f,b,.5);h+=m;break;case Zd:m=K.vq(k,l,(k+2*C.point1X)/3,(l+2*C.point1Y)/3,(2*C.point1X+a)/3,(2*C.point1Y+n)/3,a,n,g,b,f,b,.5);h+=m;break;case $d:case ae:G=C.type===$d?be(C,u):ce(C,u,k,l);var L=G.length;if(0===L){k=ee(f,b,g,b,k,l,C.centerX,C.centerY);if(isNaN(k))return!0;h+=k;break}C=null;for(var I=0;I<L;I++){C=G[I];if(0===I){m=ee(f,b,g,b,k,l,C[0],C[1]);if(isNaN(m))return!0;h+=m}m=K.vq(C[0],C[1],C[2],C[3],C[4],C[5],C[6],C[7],g,b,f,b,.5);h+=m}null!==C&&(a=C[6],
n=C[7]);break;default:B("Unknown Segment type: "+C.type)}k=a;l=n}if(0!==h)return!0;h=0}else if(u.aa(f,b,e?c:c+2))return!0}return 0!==h}function ee(a,b,c,d,e,f,g,h){if(K.Nb(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 fe(a,b,c,d){a=a.figures.j;for(var e=a.length,f=0;f<e;f++)if(a[f].aa(b,c,d))return!0;return!1}
t.Wv=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=new J);if(this.type===wd)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.sy=function(a){0>a?a=0:1<a&&(a=1);if(this.type===wd)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.Xv=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=[]);b.length=3;if(this.type===wd)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.ty=function(a){if(this.type===wd){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.Qh(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===Hd){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 v=
p[u],w=p[u+1];if(0!==u){K.Qh(l,m,v,w,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=v;m=w}J.free(d);a=g/f;return 0>a?0:1<a?1:a}return 0};
function ge(a){if(null===a.Uk){var b=a.Uk=[],c=a.jn=[],d=[],e=[];if(a.type===wd)d.push(a.startX),d.push(a.startY),d.push(a.endX),d.push(a.endY),b.push(d),e.push(Math.sqrt((a.startX-a.endX)*(a.startX-a.endX)+(a.startY-a.endY)*(a.startY-a.endY))),c.push(e);else if(a.type===Hd)d.push(a.startX),d.push(a.startY),d.push(a.endX),d.push(a.startY),d.push(a.endX),d.push(a.endY),d.push(a.startX),d.push(a.endY),d.push(a.startX),d.push(a.startY),b.push(d),e.push(Math.abs(a.startX-a.endX)),e.push(Math.abs(a.startY-
a.endY)),e.push(Math.abs(a.startX-a.endX)),e.push(Math.abs(a.startY-a.endY)),c.push(e);else if(a.type===Id){var f=new he;f.startX=a.endX;f.startY=(a.startY+a.endY)/2;var g=new pe($d);g.startAngle=0;g.sweepAngle=360;g.centerX=(a.startX+a.endX)/2;g.centerY=(a.startY+a.endY)/2;g.radiusX=Math.abs(a.startX-a.endX)/2;g.radiusY=Math.abs(a.startY-a.endY)/2;f.add(g);a=be(g,f);e=a.length;if(0===e)d.push(g.centerX),d.push(g.centerY);else{g=f.startX;f=f.startY;for(var h=0;h<e;h++){var k=a[h];K.Ce(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(qe(d))}else for(a=a.figures.iterator;a.next();){e=a.value;d=[];d.push(e.startX);d.push(e.startY);g=e.startX;f=e.startY;h=g;k=f;for(var l=e.segments.j,m=l.length,n=0;n<m;n++){var p=l[n];switch(p.type){case Xd:4<=d.length&&(b.push(d),c.push(qe(d)));d=[];d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;h=g;k=f;break;case yd:d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;break;case Yd:K.Ce(g,f,p.point1X,p.point1Y,p.point2X,p.point2Y,p.endX,p.endY,
.5,d);g=p.endX;f=p.endY;break;case Zd:K.Wq(g,f,p.point1X,p.point1Y,p.endX,p.endY,.5,d);g=p.endX;f=p.endY;break;case $d:var r=be(p,e),q=r.length;if(0===q){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(var u=0;u<q;u++){var v=r[u];K.Ce(g,f,v[2],v[3],v[4],v[5],v[6],v[7],.5,d);g=v[6];f=v[7]}break;case ae:r=ce(p,e,g,f);q=r.length;if(0===q){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(u=0;u<q;u++)v=r[u],K.Ce(g,f,v[2],v[3],v[4],v[5],v[6],v[7],.5,d),g=v[6],
f=v[7];break;default:B("Segment not of valid type: "+p.type)}p.isClosed&&(d.push(h),d.push(k))}4<=d.length&&(b.push(d),c.push(qe(d)))}}}function qe(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(Db(c,d,g,h)));c=g;d=h}return b}t.add=function(a){this.Gj.add(a);return this};t.Xm=function(a,b,c,d,e,f,g,h){this.s&&ua(this);this.nf=(new P(a,b,e,f)).freeze();this.pf=(new P(c,d,g,h)).freeze();return this};
ma.Object.defineProperties(td.prototype,{flattenedSegments:{get:function(){ge(this);return this.Uk}},flattenedLengths:{get:function(){ge(this);return this.jn}},flattenedTotalLength:{get:function(){var a=this.kn;if(isNaN(a)){if(this.type===wd){a=Math.abs(this.endX-this.startX);var b=Math.abs(this.endY-this.startY);a=Math.sqrt(a*a+b*b)}else if(this.type===Hd)a=2*Math.abs(this.endX-this.startX)+2*Math.abs(this.endY-
this.startY);else{b=this.flattenedLengths;for(var c=b.length,d=a=0;d<c;d++)for(var e=b[d],f=e.length,g=0;g<f;g++)a+=e[g]}this.kn=a}return a}},type:{get:function(){return this.pa},set:function(a){this.pa!==a&&(this.s&&ua(this,a),this.pa=a,this.qa=!0)}},startX:{get:function(){return this.Zc},set:function(a){this.Zc!==a&&(this.s&&ua(this,a),this.Zc=a,this.qa=!0)}},startY:{get:function(){return this.$c},set:function(a){this.$c!==
a&&(this.s&&ua(this,a),this.$c=a,this.qa=!0)}},endX:{get:function(){return this.gc},set:function(a){this.gc!==a&&(this.s&&ua(this,a),this.gc=a,this.qa=!0)}},endY:{get:function(){return this.nc},set:function(a){this.nc!==a&&(this.s&&ua(this,a),this.nc=a,this.qa=!0)}},figures:{get:function(){return this.Gj},set:function(a){this.Gj!==a&&(this.s&&ua(this,a),this.Gj=a,this.qa=!0)}},spot1:{
get:function(){return this.nf},set:function(a){this.s&&ua(this,a);this.nf=a.G()}},spot2:{get:function(){return this.pf},set:function(a){this.s&&ua(this,a);this.pf=a.G()}},defaultStretch:{get:function(){return this.Rf},set:function(a){this.s&&ua(this,a);this.Rf=a}},bounds:{get:function(){this.fw()&&this.computeBounds();return this.Hr}}});td.prototype.setSpots=td.prototype.Xm;td.prototype.add=td.prototype.add;
td.prototype.getFractionForPoint=td.prototype.ty;td.prototype.getPointAndAngleAlongPath=td.prototype.Xv;td.prototype.getAngleAlongPath=td.prototype.sy;td.prototype.getPointAlongPath=td.prototype.Wv;td.prototype.containsPoint=td.prototype.aa;td.prototype.transform=td.prototype.transform;td.prototype.rotate=td.prototype.rotate;td.prototype.scale=td.prototype.scale;td.prototype.offset=td.prototype.offset;td.prototype.normalize=td.prototype.normalize;td.prototype.computeBoundsWithoutOrigin=td.prototype.ay;
td.prototype.equalsApprox=td.prototype.Na;var wd=new D(td,"Line",0),Hd=new D(td,"Rectangle",1),Id=new D(td,"Ellipse",2),ud=new D(td,"Path",3);td.className="Geometry";td.stringify=zd;td.fillPath=function(a){a=a.split(/[Xx]/);for(var b=a.length,c="",d=0;d<b;d++){var e=a[d];c=null!==e.match(/[Ff]/)?0===d?c+e:c+("X"+(" "===e[0]?"":" ")+e):c+((0===d?"":"X ")+"F"+(" "===e[0]?"":" ")+e)}return c};td.parse=Jd;td.Line=wd;td.Rectangle=Hd;td.Ellipse=Id;td.Path=ud;
function he(a,b,c,d){Ya(this);this.s=!1;void 0===c&&(c=!0);this.ls=c;void 0===d&&(d=!0);this.qs=d;void 0!==a?this.Zc=a:this.Zc=0;void 0!==b?this.$c=b:this.$c=0;this.Yl=new E;this.dt=this.Yl.Aa;this.qa=!0}he.prototype.copy=function(){var a=new he;a.ls=this.ls;a.qs=this.qs;a.Zc=this.Zc;a.$c=this.$c;for(var b=this.Yl.j,c=b.length,d=a.Yl,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.dt=this.dt;a.qa=this.qa;return a};t=he.prototype;
t.Na=function(a){if(!(a instanceof he&&K.A(this.startX,a.startX)&&K.A(this.startY,a.startY)))return!1;var b=this.segments.j;a=a.segments.j;var c=b.length;if(c!==a.length)return!1;for(var d=0;d<c;d++)if(!b[d].Na(a[d]))return!1;return!0};t.toString=function(a){void 0===a&&(a=-1);var b=0>a?"M"+this.startX.toString()+" "+this.startY.toString():"M"+this.startX.toFixed(a)+" "+this.startY.toFixed(a);for(var c=this.segments.j,d=c.length,e=0;e<d;e++)b+=" "+c[e].toString(a);return b};
t.freeze=function(){this.s=!0;var a=this.segments;a.freeze();var b=a.j;a=a.length;for(var c=0;c<a;c++)b[c].freeze();return this};t.ea=function(){this.s=!1;var a=this.segments;a.ea();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].ea();return this};t.fw=function(){if(this.qa)return!0;var a=this.segments;if(this.dt!==a.Aa)return!0;a=a.j;for(var b=a.length,c=0;c<b;c++)if(a[c].qa)return!0;return!1};t.add=function(a){this.Yl.add(a);return this};
t.aa=function(a,b,c){for(var d=this.startX,e=this.startY,f=d,g=e,h=this.segments.j,k=h.length,l=0;l<k;l++){var m=h[l];switch(m.type){case Xd:f=m.endX;g=m.endY;d=m.endX;e=m.endY;break;case yd:if(K.Nb(d,e,m.endX,m.endY,c,a,b))return!0;d=m.endX;e=m.endY;break;case Yd:if(K.yt(d,e,m.point1X,m.point1Y,m.point2X,m.point2Y,m.endX,m.endY,.5,a,b,c))return!0;d=m.endX;e=m.endY;break;case Zd:if(K.nw(d,e,m.point1X,m.point1Y,m.endX,m.endY,.5,a,b,c))return!0;d=m.endX;e=m.endY;break;case $d:case ae:var n=m.type===
$d?be(m,this):ce(m,this,d,e),p=n.length;if(0===p){if(K.Nb(d,e,m.centerX,m.centerY,c,a,b))return!0;d=m.centerX;e=m.centerY;break}for(var r=null,q=0;q<p;q++)if(r=n[q],0===q&&K.Nb(d,e,r[0],r[1],c,a,b)||K.yt(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],.5,a,b,c))return!0;null!==r&&(d=r[6],e=r[7]);break;default:B("Unknown Segment type: "+m.type)}if(m.isClosed&&(d!==f||e!==g)&&K.Nb(d,e,f,g,c,a,b))return!0}return!1};
ma.Object.defineProperties(he.prototype,{isFilled:{get:function(){return this.ls},set:function(a){this.s&&ua(this,a);this.ls=a}},isShadowed:{get:function(){return this.qs},set:function(a){this.s&&ua(this,a);this.qs=a}},startX:{get:function(){return this.Zc},set:function(a){this.s&&ua(this,a);this.Zc=a;this.qa=!0}},startY:{get:function(){return this.$c},set:function(a){this.s&&ua(this,
a);this.$c=a;this.qa=!0}},segments:{get:function(){return this.Yl},set:function(a){this.s&&ua(this,a);this.Yl=a;this.qa=!0}}});he.prototype.add=he.prototype.add;he.prototype.equalsApprox=he.prototype.Na;he.className="PathFigure";
function pe(a,b,c,d,e,f,g,h){Ya(this);this.s=!1;void 0===a&&(a=yd);this.pa=a;void 0!==b?this.gc=b:this.gc=0;void 0!==c?this.nc=c:this.nc=0;void 0===d&&(d=0);void 0===e&&(e=0);void 0===f&&(f=0);void 0===g&&(g=0);a===ae?(a=f%360,0>a&&(a+=360),this.ye=a,this.Qi=0,this.Ri=Math.max(d,0),this.ph=Math.max(e,0),this.Fl="boolean"===typeof g?g:"number"===typeof g?!!g:!1,this.Yk=!!h):(this.ye=d,this.Qi=e,a===$d&&(f=Math.max(f,0)),this.Ri=f,"number"===typeof g?(a===$d&&(g=Math.max(g,0)),this.ph=g):this.ph=0,
this.Yk=this.Fl=!1);this.Lj=!1;this.qa=!0;this.Qe=null}pe.prototype.copy=function(){var a=new pe;a.pa=this.pa;a.gc=this.gc;a.nc=this.nc;a.ye=this.ye;a.Qi=this.Qi;a.Ri=this.Ri;a.ph=this.ph;a.Fl=this.Fl;a.Yk=this.Yk;a.Lj=this.Lj;a.qa=this.qa;return a};t=pe.prototype;
t.Na=function(a){if(!(a instanceof pe)||this.type!==a.type||this.isClosed!==a.isClosed)return!1;switch(this.type){case Xd:case yd:return K.A(this.endX,a.endX)&&K.A(this.endY,a.endY);case Yd:return K.A(this.endX,a.endX)&&K.A(this.endY,a.endY)&&K.A(this.point1X,a.point1X)&&K.A(this.point1Y,a.point1Y)&&K.A(this.point2X,a.point2X)&&K.A(this.point2Y,a.point2Y);case Zd:return K.A(this.endX,a.endX)&&K.A(this.endY,a.endY)&&K.A(this.point1X,a.point1X)&&K.A(this.point1Y,a.point1Y);case $d:return K.A(this.startAngle,
a.startAngle)&&K.A(this.sweepAngle,a.sweepAngle)&&K.A(this.centerX,a.centerX)&&K.A(this.centerY,a.centerY)&&K.A(this.radiusX,a.radiusX)&&K.A(this.radiusY,a.radiusY);case ae:return this.isClockwiseArc===a.isClockwiseArc&&this.isLargeArc===a.isLargeArc&&K.A(this.xAxisRotation,a.xAxisRotation)&&K.A(this.endX,a.endX)&&K.A(this.endY,a.endY)&&K.A(this.radiusX,a.radiusX)&&K.A(this.radiusY,a.radiusY);default:return!1}};t.hb=function(a){a.classType===pe&&(this.type=a)};
t.toString=function(a){void 0===a&&(a=-1);switch(this.type){case Xd:a=0>a?"M"+this.endX.toString()+" "+this.endY.toString():"M"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case yd:a=0>a?"L"+this.endX.toString()+" "+this.endY.toString():"L"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Yd:a=0>a?"C"+this.point1X.toString()+" "+this.point1Y.toString()+" "+this.point2X.toString()+" "+this.point2Y.toString()+" "+this.endX.toString()+" "+this.endY.toString():"C"+this.point1X.toFixed(a)+
" "+this.point1Y.toFixed(a)+" "+this.point2X.toFixed(a)+" "+this.point2Y.toFixed(a)+" "+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Zd:a=0>a?"Q"+this.point1X.toString()+" "+this.point1Y.toString()+" "+this.endX.toString()+" "+this.endY.toString():"Q"+this.point1X.toFixed(a)+" "+this.point1Y.toFixed(a)+" "+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case $d:a=0>a?"B"+this.startAngle.toString()+" "+this.sweepAngle.toString()+" "+this.centerX.toString()+" "+this.centerY.toString()+
" "+this.radiusX.toString()+" "+this.radiusY.toString():"B"+this.startAngle.toFixed(a)+" "+this.sweepAngle.toFixed(a)+" "+this.centerX.toFixed(a)+" "+this.centerY.toFixed(a)+" "+this.radiusX.toFixed(a)+" "+this.radiusY.toFixed(a);break;case ae:a=0>a?"A"+this.radiusX.toString()+" "+this.radiusY.toString()+" "+this.xAxisRotation.toString()+" "+(this.isLargeArc?1:0)+" "+(this.isClockwiseArc?1:0)+" "+this.endX.toString()+" "+this.endY.toString():"A"+this.radiusX.toFixed(a)+" "+this.radiusY.toFixed(a)+
" "+this.xAxisRotation.toFixed(a)+" "+(this.isLargeArc?1:0)+" "+(this.isClockwiseArc?1:0)+" "+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;default:a=this.type.toString()}return a+(this.Lj?"z":"")};t.freeze=function(){this.s=!0;return this};t.ea=function(){this.s=!1;return this};t.close=function(){this.Lj=!0;return this};
function be(a,b){if(null!==a.Qe&&!1===b.qa)return a.Qe;var c=a.radiusX,d=a.radiusY;void 0===d&&(d=c);if(0===c||0===d)return a.Qe=[],a.Qe;b=a.ye;var e=a.Qi,f=K.by(0,0,c<d?c:d,a.startAngle,a.startAngle+a.sweepAngle,!1);if(c!==d){var g=rd.alloc();g.reset();c<d?g.scale(1,d/c):g.scale(c/d,1);Vd(f,g);rd.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.Qe=f;return a.Qe}
function ce(a,b,c,d){function e(a,b,c,d){return(a*d<b*c?-1:1)*Math.acos((a*c+b*d)/(Math.sqrt(a*a+b*b)*Math.sqrt(c*c+d*d)))}if(null!==a.Qe&&!1===b.qa)return a.Qe;b=a.Ri;var f=a.ph;0===b&&(b=1E-4);0===f&&(f=1E-4);var g=Math.PI/180*a.ye,h=a.Fl,k=a.Yk,l=a.gc,m=a.nc,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.by(0,0,b>f?b:f,m,m+g,!0);f=rd.alloc();f.reset();f.translate(c,d);f.rotate(a.ye,0,0);f.scale(k,r);Vd(b,f);rd.free(f);a.Qe=b;return a.Qe}
ma.Object.defineProperties(pe.prototype,{isClosed:{get:function(){return this.Lj},set:function(a){this.Lj!==a&&(this.Lj=a,this.qa=!0)}},type:{get:function(){return this.pa},set:function(a){this.s&&ua(this,a);this.pa=a;this.qa=!0}},endX:{get:function(){return this.gc},set:function(a){this.s&&ua(this,a);this.gc=a;this.qa=!0}},endY:{get:function(){return this.nc},set:function(a){this.s&&
ua(this,a);this.nc=a;this.qa=!0}},point1X:{get:function(){return this.ye},set:function(a){this.s&&ua(this,a);this.ye=a;this.qa=!0}},point1Y:{get:function(){return this.Qi},set:function(a){this.s&&ua(this,a);this.Qi=a;this.qa=!0}},point2X:{get:function(){return this.Ri},set:function(a){this.s&&ua(this,a);this.Ri=a;this.qa=!0}},point2Y:{get:function(){return this.ph},set:function(a){this.s&&
ua(this,a);this.ph=a;this.qa=!0}},centerX:{get:function(){return this.ye},set:function(a){this.s&&ua(this,a);this.ye=a;this.qa=!0}},centerY:{get:function(){return this.Qi},set:function(a){this.s&&ua(this,a);this.Qi=a;this.qa=!0}},radiusX:{get:function(){return this.Ri},set:function(a){0>a&&va(a,">= zero",pe,"radiusX");this.s&&ua(this,a);this.Ri=a;this.qa=!0}},radiusY:{get:function(){return this.ph},
set:function(a){0>a&&va(a,">= zero",pe,"radiusY");this.s&&ua(this,a);this.ph=a;this.qa=!0}},startAngle:{get:function(){return this.gc},set:function(a){this.gc!==a&&(this.s&&ua(this,a),a%=360,0>a&&(a+=360),this.gc=a,this.qa=!0)}},sweepAngle:{get:function(){return this.nc},set:function(a){this.s&&ua(this,a);360<a&&(a=360);-360>a&&(a=-360);this.nc=a;this.qa=!0}},isClockwiseArc:{get:function(){return this.Yk},set:function(a){this.s&&
ua(this,a);this.Yk=a;this.qa=!0}},isLargeArc:{get:function(){return this.Fl},set:function(a){this.s&&ua(this,a);this.Fl=a;this.qa=!0}},xAxisRotation:{get:function(){return this.ye},set:function(a){a%=360;0>a&&(a+=360);this.s&&ua(this,a);this.ye=a;this.qa=!0}}});pe.prototype.equalsApprox=pe.prototype.Na;
var Xd=new D(pe,"Move",0),yd=new D(pe,"Line",1),Yd=new D(pe,"Bezier",2),Zd=new D(pe,"QuadraticBezier",3),$d=new D(pe,"Arc",4),ae=new D(pe,"SvgArc",4);pe.className="PathSegment";pe.Move=Xd;pe.Line=yd;pe.Bezier=Yd;pe.QuadraticBezier=Zd;pe.Arc=$d;pe.SvgArc=ae;function re(){this.B=null;this.yv=(new J(0,0)).freeze();this.Hu=(new J(0,0)).freeze();this.zr=this.Bs=0;this.Ar=1;this.Ci="";this.st=this.Tr=!1;this.Qr=this.Cr=0;this.Pg=this.ds=this.os=!1;this.Yr=null;this.nt=0;this.jd=this.mt=null}
re.prototype.copy=function(){var a=new re;return this.clone(a)};re.prototype.clone=function(a){a.B=this.B;a.yv.assign(this.viewPoint);a.Hu.assign(this.documentPoint);a.Bs=this.Bs;a.zr=this.zr;a.Ar=this.Ar;a.Ci=this.Ci;a.Tr=this.Tr;a.st=this.st;a.Cr=this.Cr;a.Qr=this.Qr;a.os=this.os;a.ds=this.ds;a.Pg=this.Pg;a.Yr=this.Yr;a.nt=this.nt;a.mt=this.mt;a.jd=this.jd;return a};
re.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};re.prototype.Hq=function(a,b){var c=this.diagram;if(null===c)return b;se(c,this.event,a,b);return b};
re.prototype.hA=function(a,b){var c=this.diagram;if(null===c)return b;se(c,this.event,a,b);b.assign(c.nu(b));return b};
ma.Object.defineProperties(re.prototype,{diagram:{get:function(){return this.B},set:function(a){this.B=a}},viewPoint:{get:function(){return this.yv},set:function(a){this.yv.assign(a)}},documentPoint:{get:function(){return this.Hu},set:function(a){this.Hu.assign(a)}},modifiers:{get:function(){return this.Bs},set:function(a){this.Bs=a}},button:{get:function(){return this.zr},
set:function(a){this.zr=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.Ar},set:function(a){this.Ar=a}},key:{get:function(){return this.Ci},set:function(a){this.Ci=a}},down:{get:function(){return this.Tr},set:function(a){this.Tr=a}},up:{get:function(){return this.st},set:function(a){this.st=
a}},clickCount:{get:function(){return this.Cr},set:function(a){this.Cr=a}},delta:{get:function(){return this.Qr},set:function(a){this.Qr=a}},isMultiTouch:{get:function(){return this.os},set:function(a){this.os=a}},handled:{get:function(){return this.ds},set:function(a){this.ds=a}},bubbles:{get:function(){return this.Pg},set:function(a){this.Pg=a}},event:{
get:function(){return this.Yr},set:function(a){this.Yr=a}},isTouchEvent:{get:function(){var a=x.TouchEvent,b=this.event;return a&&b instanceof a?!0:(a=x.PointerEvent)&&b instanceof a&&("touch"===b.pointerType||"pen"===b.pointerType)}},timestamp:{get:function(){return this.nt},set:function(a){this.nt=a}},targetDiagram:{get:function(){return this.mt},set:function(a){this.mt=a}},targetObject:{
get:function(){return this.jd},set:function(a){this.jd=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}}});
re.prototype.getMultiTouchDocumentPoint=re.prototype.hA;re.prototype.getMultiTouchViewPoint=re.prototype.Hq;re.className="InputEvent";function te(){this.B=null;this.Qa="";this.Ls=this.kt=null}te.prototype.copy=function(){var a=new te;a.B=this.B;a.Qa=this.Qa;a.kt=this.kt;a.Ls=this.Ls;return a};te.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(te.prototype,{diagram:{get:function(){return this.B},set:function(a){this.B=a}},name:{get:function(){return this.Qa},set:function(a){this.Qa=a}},subject:{get:function(){return this.kt},set:function(a){this.kt=a}},parameter:{get:function(){return this.Ls},set:function(a){this.Ls=a}}});te.className="DiagramEvent";
function ue(){this.vn=ve;this.ff=this.As="";this.cp=this.ep=this.kp=this.lp=this.jp=this.B=this.ac=null}ue.prototype.clear=function(){this.cp=this.ep=this.kp=this.lp=this.jp=this.B=this.ac=null};
ue.prototype.copy=function(){var a=new ue;a.vn=this.vn;a.As=this.As;a.ff=this.ff;a.ac=this.ac;a.B=this.B;a.jp=this.jp;var b=this.lp;a.lp=ya(b)&&"function"===typeof b.G?b.G():b;b=this.kp;a.kp=ya(b)&&"function"===typeof b.G?b.G():b;b=this.ep;a.ep=ya(b)&&"function"===typeof b.G?b.G():b;b=this.cp;a.cp=ya(b)&&"function"===typeof b.G?b.G():b;return a};ue.prototype.hb=function(a){a.classType===ue&&(this.change=a)};
ue.prototype.toString=function(){var a="";a=this.change===we?a+"* ":this.change===ve?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===we?null!==this.oldValue&&(a+=" "+this.oldValue):(null!==this.object&&(a+=Ja(this.object)),null!==this.oldValue&&(a+="  old: "+Ja(this.oldValue)),null!==
this.oldParam&&(a+=" "+this.oldParam),null!==this.newValue&&(a+="  new: "+Ja(this.newValue)),null!==this.newParam&&(a+=" "+this.newParam));return a};ue.prototype.H=function(a){return a?this.oldValue:this.newValue};ue.prototype.jA=function(a){return a?this.oldParam:this.newParam};ue.prototype.canUndo=function(){return null!==this.model||null!==this.diagram?!0:!1};
ue.prototype.undo=function(){this.canUndo()&&(null!==this.model?this.model.changeState(this,!0):null!==this.diagram&&this.diagram.changeState(this,!0))};ue.prototype.canRedo=function(){return null!==this.model||null!==this.diagram?!0:!1};ue.prototype.redo=function(){this.canRedo()&&(null!==this.model?this.model.changeState(this,!1):null!==this.diagram&&this.diagram.changeState(this,!1))};
ma.Object.defineProperties(ue.prototype,{model:{get:function(){return this.ac},set:function(a){this.ac=a}},diagram:{get:function(){return this.B},set:function(a){this.B=a}},change:{get:function(){return this.vn},set:function(a){this.vn=a}},modelChange:{get:function(){return this.As},set:function(a){this.As=a}},propertyName:{get:function(){return this.ff},
set:function(a){this.ff=a}},isTransactionFinished:{get:function(){return this.vn===we&&("CommittedTransaction"===this.ff||"FinishedUndo"===this.ff||"FinishedRedo"===this.ff)}},object:{get:function(){return this.jp},set:function(a){this.jp=a}},oldValue:{get:function(){return this.lp},set:function(a){this.lp=a}},oldParam:{get:function(){return this.kp},set:function(a){this.kp=a}},
newValue:{get:function(){return this.ep},set:function(a){this.ep=a}},newParam:{get:function(){return this.cp},set:function(a){this.cp=a}}});ue.prototype.redo=ue.prototype.redo;ue.prototype.canRedo=ue.prototype.canRedo;ue.prototype.undo=ue.prototype.undo;ue.prototype.canUndo=ue.prototype.canUndo;ue.prototype.getParam=ue.prototype.jA;ue.prototype.getValue=ue.prototype.H;ue.prototype.clear=ue.prototype.clear;
var we=new D(ue,"Transaction",-1),ve=new D(ue,"Property",0),xe=new D(ue,"Insert",1),ye=new D(ue,"Remove",2);ue.className="ChangedEvent";ue.Transaction=we;ue.Property=ve;ue.Insert=xe;ue.Remove=ye;function ze(){this.v=(new E).freeze();this.Qa="";this.l=!1}ze.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};
ze.prototype.clear=function(){var a=this.changes;a.ea();for(var b=a.count-1;0<=b;b--){var c=a.L(b);null!==c&&c.clear()}a.clear();a.freeze()};ze.prototype.canUndo=function(){return this.isComplete};ze.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()}};ze.prototype.canRedo=function(){return this.isComplete};
ze.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()}};ma.Object.defineProperties(ze.prototype,{changes:{get:function(){return this.v}},name:{get:function(){return this.Qa},set:function(a){this.Qa=a}},isComplete:{get:function(){return this.l},set:function(a){this.l=a}}});ze.prototype.redo=ze.prototype.redo;ze.prototype.canRedo=ze.prototype.canRedo;
ze.prototype.undo=ze.prototype.undo;ze.prototype.canUndo=ze.prototype.canUndo;ze.prototype.clear=ze.prototype.clear;ze.className="Transaction";function Ae(){this.fv=new F;this.gd=!1;this.I=(new E).freeze();this.Pd=-1;this.v=999;this.oe=!1;this.Nr=null;this.Yi=0;this.l=!1;this.ue=(new E).freeze();this.Nl=new E;this.Ou=!0;this.Vu=this.ms=this.Zu=this.Yu=!1}
Ae.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};
Ae.prototype.clear=function(){var a=this.history;a.ea();for(var b=a.count-1;0<=b;b--){var c=a.L(b);null!==c&&c.clear()}a.clear();this.Pd=-1;a.freeze();this.oe=!1;this.Nr=null;this.Yi=0;this.ue.ea();this.ue.clear();this.ue.freeze();this.Nl.clear();this.Vu=this.ms=this.Zu=this.Yu=!1};Ae.prototype.copyProperties=function(a){this.isEnabled=a.isEnabled;this.maxHistoryLength=a.maxHistoryLength;this.checksTransactionLevel=a.checksTransactionLevel};t=Ae.prototype;t.Ux=function(a){this.fv.add(a)};t.My=function(a){this.fv.remove(a)};
t.va=function(a){void 0===a&&(a="");null===a&&(a="");if(this.isUndoingRedoing)return!1;!0===this.Ou&&(this.Ou=!1,this.Yi++,this.isInternalTransaction||this.Bb("StartingFirstTransaction",a,this.currentTransaction),0<this.Yi&&this.Yi--);this.isEnabled&&(this.ue.ea(),this.ue.add(a),this.ue.freeze(),null===this.currentTransaction?this.Nl.add(0):this.Nl.add(this.currentTransaction.changes.count));this.Yi++;var b=1===this.transactionLevel;b&&(this.isInternalTransaction||this.Bb("StartedTransaction",a,this.currentTransaction));
return b};t.Wa=function(a){void 0===a&&(a="");return Be(this,!0,a)};t.Hf=function(){return Be(this,!1,"")};
function Be(a,b,c){if(a.isUndoingRedoing)return!1;a.checksTransactionLevel&&1>a.transactionLevel&&wa("Ending transaction without having started a transaction: "+c);var d=1===a.transactionLevel,e=a.currentTransaction;d&&b&&(a.isInternalTransaction||a.Bb("CommittingTransaction",c,e));var f=0;if(0<a.transactionLevel&&(a.Yi--,a.isEnabled)){var g=a.ue.count;0<g&&(""===c&&(c=a.ue.L(0)),a.ue.ea(),a.ue.bb(g-1),a.ue.freeze());g=a.Nl.count;0<g&&(f=a.Nl.L(g-1),a.Nl.bb(g-1))}if(d){if(b){a.ms=!1;null===e&&""!==
c&&(e=a.currentTransaction);if(a.isEnabled&&null!==e){e.isComplete||(e.isComplete=!0,e.name=c);b=a.history;b.ea();for(d=b.count-1;d>a.historyIndex;d--)f=b.L(d),null!==f&&f.clear(),b.bb(d),a.ms=!0;d=a.maxHistoryLength;0<=d&&(0===d?b.clear():b.count>=d&&(f=b.L(0),null!==f&&f.clear(),b.bb(0),a.Pd--));0===d||0!==b.count&&b.get(b.count-1)===e||(b.add(e),a.Pd++);b.freeze()}a.isInternalTransaction||a.Bb("CommittedTransaction",c,e)}else{a.oe=!0;try{a.isEnabled&&null!==e&&(e.isComplete=!0,e.undo())}finally{a.isInternalTransaction||
a.Bb("RolledBackTransaction",c,e),a.oe=!1}null!==e&&e.clear()}a.Nr=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.ea(),c.bb(e);c.freeze()}return!1}Ae.prototype.canUndo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToUndo;return null!==a&&a.canUndo()?!0:!1};
Ae.prototype.undo=function(){if(this.canUndo()){var a=this.transactionToUndo;try{this.oe=!0,this.Bb("StartingUndo","Undo",a),this.Pd--,a.undo()}catch(b){wa("undo error: "+b.toString())}finally{this.Bb("FinishedUndo","Undo",a),this.oe=!1}}};Ae.prototype.canRedo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToRedo;return null!==a&&a.canRedo()?!0:!1};
Ae.prototype.redo=function(){if(this.canRedo()){var a=this.transactionToRedo;try{this.oe=!0,this.Bb("StartingRedo","Redo",a),this.Pd++,a.redo()}catch(b){wa("redo error: "+b.toString())}finally{this.Bb("FinishedRedo","Redo",a),this.oe=!1}}};Ae.prototype.Bb=function(a,b,c){void 0===c&&(c=null);var d=new ue;d.change=we;d.propertyName=a;d.object=c;d.oldValue=b;for(a=this.models;a.next();)b=a.value,d.model=b,b.zt(d)};
Ae.prototype.$v=function(a){if(this.isEnabled&&!this.isUndoingRedoing&&!this.skipsEvent(a)){var b=this.currentTransaction;null===b&&(this.Nr=b=new ze);var c=a.copy();b=b.changes;b.ea();b.add(c);b.freeze();this.checksTransactionLevel&&0>=this.transactionLevel&&!this.Ou&&(a=a.diagram,null!==a&&!1===a.oj||wa("Change not within a transaction: "+c.toString()))}};
Ae.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(Ae.prototype,{models:{get:function(){return this.fv.iterator}},isEnabled:{get:function(){return this.gd},set:function(a){this.gd=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.oe}},history:{get:function(){return this.I}},maxHistoryLength:{get:function(){return this.v},set:function(a){this.v=a}},historyIndex:{get:function(){return this.Pd}},currentTransaction:{get:function(){return this.Nr}},transactionLevel:{
get:function(){return this.Yi}},isInTransaction:{get:function(){return 0<this.Yi}},checksTransactionLevel:{get:function(){return this.l},set:function(a){this.l=a}},nestedTransactionNames:{get:function(){return this.ue}},isPendingClear:{get:function(){return this.Yu},set:function(a){this.Yu=a}},isPendingUnmodified:{get:function(){return this.Zu},set:function(a){this.Zu=
a}},isInternalTransaction:{get:function(){return this.Vu},set:function(a){this.Vu=a}},isJustDiscarded:{get:function(){return this.ms}}});Ae.prototype.handleChanged=Ae.prototype.$v;Ae.prototype.redo=Ae.prototype.redo;Ae.prototype.undo=Ae.prototype.undo;Ae.prototype.canUndo=Ae.prototype.canUndo;Ae.prototype.rollbackTransaction=Ae.prototype.Hf;Ae.prototype.commitTransaction=Ae.prototype.Wa;Ae.prototype.startTransaction=Ae.prototype.va;
Ae.prototype.removeModel=Ae.prototype.My;Ae.prototype.addModel=Ae.prototype.Ux;Ae.prototype.clear=Ae.prototype.clear;Ae.className="UndoManager";function Ce(){Ya(this);this.B=De;this.Qa="";this.gd=!0;this.Pc=!1;this.gx=null;this.hz=new re;this.vt=-1}Ce.prototype.toString=function(){return""!==this.name?this.name+" Tool":Ia(this.constructor)};Ce.prototype.updateAdornments=function(){};Ce.prototype.canStart=function(){return this.isEnabled};Ce.prototype.doStart=function(){};
Ce.prototype.doActivate=function(){this.isActive=!0};Ce.prototype.doDeactivate=function(){this.isActive=!1};Ce.prototype.doStop=function(){};Ce.prototype.doCancel=function(){this.transactionResult=null;this.stopTool()};Ce.prototype.stopTool=function(){var a=this.diagram;a.currentTool===this&&(a.currentTool=null,a.currentCursor="")};Ce.prototype.doMouseDown=function(){!this.isActive&&this.canStart()&&this.doActivate()};Ce.prototype.doMouseMove=function(){};Ce.prototype.doMouseUp=function(){this.stopTool()};
Ce.prototype.doMouseWheel=function(){};Ce.prototype.canStartMultiTouch=function(){return!0};Ce.prototype.standardPinchZoomStart=function(){var a=this.diagram,b=a.lastInput,c=b.Hq(0,J.allocAt(NaN,NaN)),d=b.Hq(1,J.allocAt(NaN,NaN));if(c.u()&&d.u()&&(this.doCancel(),a.xm("hasGestureZoom"))){a.Pl=a.scale;var e=d.x-c.x,f=d.y-c.y;a.sv=Math.sqrt(e*e+f*f);b.bubbles=!1}J.free(c);J.free(d)};
Ce.prototype.standardPinchZoomMove=function(){var a=this.diagram,b=a.lastInput,c=b.Hq(0,J.allocAt(NaN,NaN)),d=b.Hq(1,J.allocAt(NaN,NaN));if(c.u()&&d.u()&&(this.doCancel(),a.xm("hasGestureZoom"))){var e=d.x-c.x,f=d.y-c.y;f=Math.sqrt(e*e+f*f)/a.sv;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.Pl;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)};
Ce.prototype.doKeyDown=function(){"Esc"===this.diagram.lastInput.key&&this.doCancel()};Ce.prototype.doKeyUp=function(){};Ce.prototype.va=function(a){void 0===a&&(a=this.name);this.transactionResult=null;return this.diagram.va(a)};Ce.prototype.Jg=function(){var a=this.diagram;return null===this.transactionResult?a.Hf():a.Wa(this.transactionResult)};
Ce.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.lastInput,c=a.um(b.documentPoint,!1);if(null!==c)if(Wa?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||(Wa?b.meta:b.control)||b.shift||a.clearSelection()}};Ce.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.Ub(d.documentPoint,a,b);d.targetObject=a;Ee(a,d,c);return d.handled};
function Ee(a,b,c){b.handled=!1;if(null===a||a.Hg()){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)}}}
Ce.prototype.standardMouseOver=function(){var a=this.diagram,b=a.lastInput;if(!0!==a.animationManager.rc){var c=a.skipsUndoManager;a.skipsUndoManager=!0;var d=a.viewportBounds.aa(b.documentPoint)?a.Ub(b.documentPoint,null,null):null;b.targetObject=d;var e=!1;if(d!==a.Bj){var f=a.Bj,g=f;a.Bj=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.Gg(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.Gg(d))break;g(b,d,f);e=!0;if(b.handled)break}d=d.panel}d=a.Bj}if(null!==d){f=d;for(g="";null!==f;){g=f.cursor;if(""!==g)break;f=f.panel}a.currentCursor=g;b.handled=!1;for(f=d;null!==f;){d=f.mouseOver;if(null!==d&&(d(b,f),e=!0,b.handled))break;f=f.panel}}else a.currentCursor="",d=a.mouseOver,null!==d&&(d(b),e=!0);e&&a.Db();a.skipsUndoManager=c}};Ce.prototype.doCurrentObjectChanged=function(){};
Ce.prototype.standardMouseWheel=function(){var a=this.diagram,b=a.lastInput,c=b.delta;if(0!==c&&a.documentBounds.u()){var d=a.commandHandler,e=a.toolManager.mouseWheelBehavior;if(null!==d&&(e===Fe&&!b.shift||e===Ge&&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===Fe&&b.shift||e===Ge&&!b.control){d=a.position.copy();var f=0<c?c:-c,g=b.event,h=g.deltaMode;e=g.deltaX;g=g.deltaY;
if(Ta||Ua||Va)h=1,0<e&&(e=3),0>e&&(e=-3),0<g&&(g=3),0>g&&(g=-3);if(void 0===h||void 0===e||void 0===g||0===e&&0===g||b.shift)!b.shift&&a.allowVerticalScroll?(f=3*f*a.scrollVerticalLineChange,0<c?a.scroll("pixel","up",f):a.scroll("pixel","down",f)):b.shift&&a.allowHorizontalScroll&&(f=3*f*a.scrollHorizontalLineChange,0<c?a.scroll("pixel","left",f):a.scroll("pixel","right",f));else{switch(h){case 0:c="pixel";break;case 1:c="line";break;case 2:c="page";break;default:c="pixel"}0!==e&&a.allowHorizontalScroll&&
(e*=a.scrollHorizontalLineChange/16,0<e?a.scroll(c,"left",-e):a.scroll(c,"right",e));0!==g&&a.allowVerticalScroll&&(g*=a.scrollVerticalLineChange/16,0<g?a.scroll(c,"up",-g):a.scroll(c,"down",g))}a.position.w(d)||(b.bubbles=!1)}}};Ce.prototype.standardWaitAfter=function(a,b){void 0===b&&(b=this.diagram.lastInput);this.cancelWaitAfter();var c=this,d=b.clone(this.hz);this.vt=sa(function(){c.doWaitAfter(d)},a)};Ce.prototype.cancelWaitAfter=function(){-1!==this.vt&&x.clearTimeout(this.vt);this.vt=-1};
Ce.prototype.doWaitAfter=function(){};Ce.prototype.findToolHandleAt=function(a,b){a=this.diagram.Ub(a,function(a){for(;null!==a&&!(a.panel instanceof He);)a=a.panel;return a});return null===a?null:a.part.category===b?a:null};Ce.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(Ce.prototype,{diagram:{get:function(){return this.B},set:function(a){a instanceof Q&&(this.B=a)}},name:{get:function(){return this.Qa},set:function(a){this.Qa=a}},isEnabled:{get:function(){return this.gd},set:function(a){this.gd=a}},isActive:{get:function(){return this.Pc},set:function(a){this.Pc=a}},transactionResult:{get:function(){return this.gx},
set:function(a){this.gx=a}}});Ce.prototype.stopTransaction=Ce.prototype.Jg;Ce.prototype.startTransaction=Ce.prototype.va;Ce.className="Tool";function Oa(){Ce.call(this);this.name="ToolManager";this.Bc=new E;this.Qc=new E;this.Gd=new E;this.T=this.Ja=850;this.v=(new M(2,2)).ca();this.cb=5E3;this.Ka=Ge;this.I=Me;this.Mr=this.l=null;this.fk=-1}la(Oa,Ce);Oa.prototype.initializeStandardTools=function(){};
Oa.prototype.updateAdornments=function(a){var b=this.currentToolTip;if(b instanceof He&&this.Mr===a){var c=b.adornedObject;(null!==a?c.part===a:null===c)?this.showToolTip(b,c):this.hideToolTip()}};
Oa.prototype.doMouseDown=function(){var a=this.diagram,b=a.lastInput;b.isTouchEvent&&this.gestureBehavior===Ne&&(b.bubbles=!1);if(b.isMultiTouch){this.cancelWaitAfter();if(this.gestureBehavior===Oe){b.bubbles=!0;return}if(this.gestureBehavior===Ne)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===Ge?this.mouseWheelBehavior=Fe:this.mouseWheelBehavior===Fe&&(this.mouseWheelBehavior=Ge));this.doActivate();this.standardWaitAfter(this.holdDelay,b)};
Oa.prototype.doMouseMove=function(){var a=this.diagram,b=a.lastInput;if(b.isMultiTouch){if(this.gestureBehavior===Oe){b.bubbles=!0;return}if(this.gestureBehavior===Ne)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}}Pe(this,
a);a=b.event;null===a||"mousemove"!==a.type&&"pointermove"!==a.type&&a.cancelable||(b.bubbles=!0)};function Pe(a,b){a.standardMouseOver();a.isBeyondDragSize()&&a.standardWaitAfter(a.isActive?a.holdDelay:a.hoverDelay,b.lastInput)}Oa.prototype.doCurrentObjectChanged=function(a,b){a=this.currentToolTip;null===a||null!==b&&a instanceof He&&(b===a||b.Gg(a))||this.hideToolTip()};
Oa.prototype.doWaitAfter=function(a){var b=this.diagram;b.ta&&(this.doMouseHover(),this.isActive||this.doToolTip(),a.isTouchEvent&&!b.lastInput.handled&&(a=a.copy(),a.button=2,a.buttons=2,b.lastInput=a,b.ek=!0,b.doMouseUp()))};
Oa.prototype.doMouseHover=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.Ub(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)};
Oa.prototype.doToolTip=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.Ub(b.documentPoint,null,null));b=b.targetObject;if(null!==b){if(a=this.currentToolTip,!(a instanceof He)||b!==a&&!b.Gg(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()};
Oa.prototype.showToolTip=function(a,b){var c=this.diagram;a!==this.currentToolTip&&this.hideToolTip();if(a instanceof He){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.Ta();this.positionToolTip(a,b)}else a instanceof Qe&&a!==this.currentToolTip&&a.show(b,c,this);this.currentToolTip=a;-1!==this.fk&&(x.clearTimeout(this.fk),
this.fk=-1);a=this.toolTipDuration;if(0<a&&Infinity!==a){var e=this;this.fk=sa(function(){e.hideToolTip()},a)}};Oa.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}};
Oa.prototype.hideToolTip=function(){-1!==this.fk&&(x.clearTimeout(this.fk),this.fk=-1);var a=this.diagram,b=this.currentToolTip;null!==b&&(b instanceof He?(a.remove(b),null!==this.Mr&&this.Mr.Gf(b.category),b.data=null,b.adornedObject=null):b instanceof Qe&&null!==b.hide&&b.hide(a,this),this.currentToolTip=null)};
Oa.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()};Oa.prototype.doMouseWheel=function(){this.standardMouseWheel()};Oa.prototype.doKeyDown=function(){var a=this.diagram;null!==a.commandHandler&&a.commandHandler.doKeyDown()};
Oa.prototype.doKeyUp=function(){var a=this.diagram;null!==a.commandHandler&&a.commandHandler.doKeyUp()};Oa.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};
Oa.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.nd(d,b):this.mouseDownTools.bb(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.nd(d,b):this.mouseMoveTools.bb(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.nd(d,
b):this.mouseUpTools.bb(d),e;return null};Oa.prototype.Xa=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(Oa.prototype,{mouseWheelBehavior:{get:function(){return this.Ka},set:function(a){this.Ka=a}},gestureBehavior:{get:function(){return this.I},set:function(a){this.I=a}},currentToolTip:{get:function(){return this.l},set:function(a){this.l=a;this.Mr=null!==a&&a instanceof He?a.adornedPart:null}},mouseDownTools:{get:function(){return this.Bc}},mouseMoveTools:{
get:function(){return this.Qc}},mouseUpTools:{get:function(){return this.Gd}},hoverDelay:{get:function(){return this.Ja},set:function(a){this.Ja=a}},holdDelay:{get:function(){return this.T},set:function(a){this.T=a}},dragSize:{get:function(){return this.v},set:function(a){this.v=a.G()}},toolTipDuration:{get:function(){return this.cb},set:function(a){this.cb=
a}}});Oa.prototype.replaceStandardTool=Oa.prototype.Xa;var Ge=new D(Oa,"WheelScroll",0),Fe=new D(Oa,"WheelZoom",1),Re=new D(Oa,"WheelNone",2),Me=new D(Oa,"GestureZoom",3),Ne=new D(Oa,"GestureCancel",4),Oe=new D(Oa,"GestureNone",5);Oa.className="ToolManager";Oa.WheelScroll=Ge;Oa.WheelZoom=Fe;Oa.WheelNone=Re;Oa.GestureZoom=Me;Oa.GestureCancel=Ne;Oa.GestureNone=Oe;
function Se(){Ce.call(this);this.name="Dragging";this.I=this.Qc=!0;this.v=this.cb=this.Ja=this.pg=null;this.Sn=this.Gd=!1;this.dm=new J(NaN,NaN);this.it=new J;this.Bc=!0;this.il=100;this.Wg=[];this.nr=(new F).freeze();this.Ka=new Te;this.Bo=null;this.T="copy";this.Wh="";this.Xh="no-drop"}la(Se,Ce);
Se.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.il)?!1:null!==this.findDraggablePart()};
Se.prototype.findDraggablePart=function(){var a=this.diagram;a=a.um(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};
Se.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.um(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,(Wa?b.meta:b.control)||b.shift||a.clearSelection(!0),this.currentPart.isSelected=!0,a.R("ChangedSelection",a.selection))}}};
Se.prototype.doActivate=function(){var a=this.diagram;this.Bo=null;null===this.currentPart&&this.standardMouseSelect();var b=this.currentPart;null!==b&&(b.canMove()||b.canCopy())&&(Ue=null,this.isActive=!0,this.dm.set(a.position),Ve(this,a.selection),this.Wg.length=0,a.animationManager.Nc(),this.draggedParts=this.computeEffectiveCollection(a.selection,this.dragOptions),a.mu=!0,!0===a.Ge("temporaryPixelRatio")&&30<a.Xx&&We(a),Xe(a,this.draggedParts),this.va("Drag"),this.startPoint=a.firstInput.documentPoint,
a.isMouseCaptured=!0,a.allowDragOut&&(this.isDragOutStarted=!0,this.Sn=!1,Ue=this,Ye=this.diagram,this.doSimulatedDragOut()))};function Ve(a,b){if(a.dragsLink){var c=a.diagram;c.allowRelink&&(c.model.xk()&&1===b.count&&b.first()instanceof S?(a.draggedLink=b.first(),a.draggedLink.canRelinkFrom()&&a.draggedLink.canRelinkTo()&&a.draggedLink.kk(),a.pg=c.toolManager.findTool("Relinking"),null===a.pg&&(a.pg=new Ze,a.pg.diagram=c)):(a.draggedLink=null,a.pg=null))}}
Se.prototype.computeEffectiveCollection=function(a,b){return this.diagram.commandHandler.computeEffectiveCollection(a,b)};Se.prototype.xd=function(a){return void 0===a?new $e(Hb):this.isGridSnapEnabled?new $e(new J(Math.round(1E3*a.x)/1E3,Math.round(1E3*a.y)/1E3)):new $e(a.copy())};
Se.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.If();af(this);ff(a,this.draggedParts);this.draggedParts=this.currentPart=this.Bo=null;this.Sn=this.isDragOutStarted=!1;if(0<gf.count){for(var b=gf,c=b.length,d=0;d<c;d++){var e=b.L(d);hf(e);jf(e);af(e);e.diagram.If()}b.clear()}hf(this);this.dm.h(NaN,NaN);Ue=Ye=null;jf(this);a.isMouseCaptured=!1;a.currentCursor="";a.mu=!1;this.Jg();kf(a,!0)};
function af(a){var b=a.diagram,c=b.skipsUndoManager;b.skipsUndoManager=!0;lf(a,b.lastInput,null);b.skipsUndoManager=c;a.Wg.length=0}function mf(){var a=Ue;jf(a);nf(a);var b=a.diagram;a.dm.u()&&(b.position=a.dm);b.If()}Se.prototype.doCancel=function(){jf(this);nf(this);var a=this.diagram;this.dm.u()&&(a.position=this.dm);this.stopTool()};Se.prototype.doKeyDown=function(){this.isActive&&("Esc"===this.diagram.lastInput.key?this.doCancel():this.doMouseMove())};
Se.prototype.doKeyUp=function(){this.isActive&&this.doMouseMove()};function of(a,b){var c=Infinity,d=Infinity,e=-Infinity,f=-Infinity;for(a=a.iterator;a.next();){var g=a.value;if(g.Wb()&&g.isVisible()){var h=g.location;g=h.x;h=h.y;isNaN(g)||isNaN(h)||(g<c&&(c=g),h<d&&(d=h),g>e&&(e=g),h>f&&(f=h))}}Infinity===c?b.h(0,0,0,0):b.h(c,d,e-c,f-d)}
function pf(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.Hf(),c.va("Drag")):nf(a);c.skipsUndoManager=!b;c.partManager.addsToTemporaryLayer=!b;a.startPoint=c.firstInput.documentPoint;b=a.copiesEffectiveCollection?a.draggedParts.Jf():c.selection;c=c.qk(b,c,!0);for(b=c.iterator;b.next();)b.value.location=
b.key.location;b=N.alloc();of(c,b);N.free(b);b=new H;for(d=a.draggedParts.iterator;d.next();){var e=d.key;e.Wb()&&e.canCopy()&&(e=c.H(e),null!==e&&(e.Ta(),b.add(e,a.xd(e.location))))}for(c=c.iterator;c.next();)d=c.value,d instanceof S&&d.canCopy()&&b.add(d,a.xd());a.copiedParts=b;Ve(a,b.Jf());null!==a.draggedLink&&(c=a.draggedLink,b=c.routeBounds,qf(c,a.startPoint.x-(b.x+b.width/2),a.startPoint.y-(b.y+b.height/2)))}}}
function jf(a){var b=a.diagram;if(null!==a.copiedParts&&(b.gu(a.copiedParts.Jf(),!1),a.copiedParts=null,null!==a.draggedParts))for(var c=a.draggedParts.iterator;c.next();)c.key instanceof S&&(c.value.point=new J(0,0));b.skipsUndoManager=!1;b.partManager.addsToTemporaryLayer=!1;a.startPoint=b.firstInput.documentPoint}
function hf(a){if(null!==a.draggedLink){if(a.dragsLink&&null!==a.pg){var b=a.pg;b.diagram.remove(b.temporaryFromNode);b.diagram.remove(b.temporaryToNode)}a.draggedLink=null;a.pg=null}}function rf(a,b,c){var d=a.diagram,e=a.startPoint,f=J.alloc();f.assign(d.lastInput.documentPoint);a.moveParts(b,f.ce(e),c);J.free(f);!0===d.Ge("temporaryPixelRatio")&&null===d.yh&&30<d.Xx&&(We(d),d.Zq())}Se.prototype.moveParts=function(a,b,c){var d=this.diagram;null!==d&&sf(d,a,b,this.dragOptions,c)};
function nf(a){if(null!==a.draggedParts){for(var b=a.diagram,c=a.draggedParts.iterator;c.next();){var d=c.key;d.Wb()&&(d.location=c.value.point)}for(c=a.draggedParts.iterator;c.next();)if(d=c.key,d instanceof S&&d.suspendsRouting){var e=c.value.point;a.draggedParts.add(d,a.xd());qf(d,-e.x,-e.y)}b.cd()}}
function tf(a,b){var c=a.diagram;a.dragsLink&&(null!==a.draggedLink&&(a.draggedLink.fromNode=null,a.draggedLink.toNode=null),uf(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=lf(a,e,d);if(!a.isActive&&null===Ue)return;var h=null!==d?d.part:null;if(null===h||c.handlesDragDropForTopLevelParts&&h.isTopLevel&&!(h instanceof vf)){var k=c.mouseDragOver;null!==k&&(k(e),g=!0)}if(!a.isActive&&null===Ue)return;
a.doDragOver(b,d);if(!a.isActive&&null===Ue)return}finally{c.skipsUndoManager=f,g&&c.cd()}a.Bo=d;c.isReadOnly||!c.allowMove&&!c.allowCopy||!c.allowHorizontalScroll&&!c.allowVerticalScroll||c.Ft(e.viewPoint)}Se.prototype.findDragOverObject=function(a){var b=this;return wf(this.diagram,a,null,function(a){null===a?a=!0:(a=a.part,a=null===a||a instanceof He||a.layer.isTemporary||b.draggedParts&&b.draggedParts.contains(a)||b.copiedParts&&b.copiedParts.contains(a)?!0:!1);return!a})};
Se.prototype.doUpdateCursor=function(a){var b=this.diagram;this.Bo!==a&&(!this.diagram.currentTool.isActive||this.mayCopy()?b.currentCursor=this.copyCursor:this.mayMove()?b.currentCursor=this.moveCursor:this.mayDragOut()&&(b.currentCursor=this.nodropCursor))};
function lf(a,b,c){var d=!1,e=a.Wg.length,f=0<e?a.Wg[0]:null;if(c===f)return!1;b.handled=!1;for(var g=0;g<e;g++){var h=a.Wg[g],k=h.mouseDragLeave;if(null!==k&&(k(b,h,c),d=!0,b.handled))break}a.Wg.length=0;if(!a.isActive&&null===Ue||null===c)return d;b.handled=!1;for(e=c;null!==e;)a.Wg.push(e),e=xf(e);e=a.Wg.length;for(c=0;c<e&&(g=a.Wg[c],h=g.mouseDragEnter,null===h||(h(b,g,f),d=!0,!b.handled));c++);return d}
function xf(a){var b=a.panel;return null!==b?b:a instanceof U&&!(a instanceof vf)&&(a=a.containingGroup,null!==a&&a.handlesDragDropForMembers)?a:null}function yf(a,b,c){var d=a.pg;if(null===d)return null;var e=a.diagram.Eg(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.ga(Bc,a);k=b.Fe(k);k<f&&(g=h,f=k)}}J.free(a);return g}
function uf(a,b){var c=a.draggedLink;if(null!==c&&!(2>c.pointsCount)){var d=a.diagram;if(!d.isReadOnly){var e=a.pg;if(null!==e){var f=null,g=null;null===c.fromNode&&(f=yf(a,c.i(0),!1),null!==f&&(g=f.part));var h=null,k=null;null===c.toNode&&(h=yf(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.Hy&&d.R("LinkRelinked",c,d.Hy),c.toPort!==d.Iy&&d.R("LinkRelinked",c,d.Iy)):zf(e,g,f,k,h):zf(e,null,null,null,null)}}}}Se.prototype.doDragOver=function(){};
function Af(a,b){var c=a.diagram;a.dragsLink&&uf(a,!0);af(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;Gf(a,e,f);f=xf(f)}}else f=c.mouseDrop,null!==f&&f(e);if(a.isActive||null!==Ue){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!==Ue){a=N.alloc();for(b=
c.selection.iterator;b.next();)d=b.value,d instanceof V&&Hf(c,d,a);N.free(a)}}}function Gf(a,b,c){a=a.diagram;c=c.part;!a.handlesDragDropForTopLevelParts||!c.isTopLevel||c instanceof vf||(c=a.mouseDrop,null!==c&&c(b))}function Hf(a,b,c){var d=!1;b.getAvoidableRect(c);a.viewportBounds.De(c)&&(d=!0);a=a.Uv(c,function(a){return a.part},function(a){return a instanceof S},!0,function(a){return a instanceof S},d);if(0!==a.count)for(a=a.iterator;a.next();)c=a.value,!c.Cd(b)&&c.isAvoiding&&c.Ua()}
Se.prototype.doDropOnto=function(){};Se.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()?(pf(this,!1),Xe(a,this.copiedParts),rf(this,this.copiedParts,!1),ff(a,this.copiedParts)):this.mayMove()?(jf(this),rf(this,this.draggedParts,!0)):this.mayDragOut()?(pf(this,!1),rf(this,this.copiedParts,!1)):jf(this),tf(this,a.lastInput.documentPoint))}};
Se.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?(jf(this),pf(this,!0),Xe(a,this.copiedParts),rf(this,this.copiedParts,!1),ff(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,jf(this),this.mayMove()&&(rf(this,this.draggedParts,
!0),tf(this,a.lastInput.documentPoint)));this.Sn=!0;Af(this,a.lastInput.documentPoint);if(this.isActive){var d=c?this.copiedParts.Jf():this.draggedParts.Jf();this.copiedParts=null;b&&If(this);a.Oa();ff(a,this.draggedParts);this.transactionResult=c?"Copy":"Move";a.R(c?"SelectionCopied":"SelectionMoved",d)}this.stopTool();c&&a.R("ChangedSelection",a.selection)}}};
Se.prototype.simulatedMouseMove=function(a,b,c){if(null===Ue)return!1;var d=Ue.diagram;c instanceof Q||(c=null);var e=Ye;c!==e&&(null!==e&&e!==d&&(e.If(),Ue.isDragOutStarted=!1,e=e.toolManager.findTool("Dragging"),null!==e&&e.doSimulatedDragLeave()),Ye=c,null!==c&&c!==d&&(mf(),e=c.toolManager.findTool("Dragging"),null!==e&&(gf.contains(e)||gf.add(e),e.doSimulatedDragEnter())));if(null===c||c===d||!c.allowDrop||c.isReadOnly||!c.allowInsert)return!1;d=c.toolManager.findTool("Dragging");null!==d&&(null!==
a&&(void 0!==a.targetTouches&&(0<a.targetTouches.length?a=a.targetTouches[0]:0<a.changedTouches.length&&(a=a.changedTouches[0])),b=c.getMouse(a)),c.lastInput.documentPoint=b,c.lastInput.viewPoint=c.ir(b),c.lastInput.down=!1,c.lastInput.up=!1,d.doSimulatedDragOver());return!0};
Se.prototype.simulatedMouseUp=function(a,b,c){if(null===Ue)return!1;var d=Ye,e=Ue.diagram;if(null===c)return Ue.doCancel(),!0;if(c!==d){var f=d.toolManager.findTool("Dragging");if(null!==d&&d!==e&&null!==f)return d.If(),Ue.isDragOutStarted=!1,f.doSimulatedDragLeave(),!1;Ye=c;d=c.toolManager.findTool("Dragging");null!==d&&(mf(),gf.contains(d)||gf.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.ir(b),c.lastInput.down=!1,c.lastInput.up=!0,a=c.toolManager.findTool("Dragging"),null!==a&&a.doSimulatedDrop(),a=Ue,null!==a&&(c=a.mayCopy(),a.transactionResult=c?"Copy":"Move",a.stopTool()),!0):!1};
function If(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.o())}}
Se.prototype.mayCopy=function(){if(!this.isCopyEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowCopy||(Wa?!a.lastInput.alt:!a.lastInput.control))return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.Wb()&&b.canCopy())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1};
Se.prototype.mayDragOut=function(){if(!this.isCopyEnabled)return!1;var a=this.diagram;if(!a.allowDragOut||!a.allowCopy||a.allowMove)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.Wb()&&b.canCopy())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1};
Se.prototype.mayMove=function(){var a=this.diagram;if(a.isReadOnly||!a.allowMove)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.Wb()&&b.canMove())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canMove()?!0:!1};Se.prototype.computeBorder=function(a,b,c){return this.Sn||null===this.draggedParts||this.draggedParts.contains(a)?null:c.assign(b)};Se.prototype.gA=function(){return Ue};
Se.prototype.mayDragIn=function(){var a=this.diagram;if(!a.allowDrop||a.isReadOnly||a.isModelReadOnly||!a.allowInsert)return!1;var b=Ue;return null===b||b.diagram.model.dataFormat!==a.model.dataFormat?!1:!0};Se.prototype.doSimulatedDragEnter=function(){if(this.mayDragIn()){var a=this.diagram;a.animationManager.Nc();Jf(a);a.animationManager.Nc();var b=Ue;null!==b&&(b.diagram.mu=!1);this.doUpdateCursor(a.grid)}};
Se.prototype.doSimulatedDragLeave=function(){var a=Ue;null!==a&&a.doSimulatedDragOut();this.doCancel()};Se.prototype.doSimulatedDragOver=function(){var a=this.diagram;a.animationManager.sn=!0;var b=Ue;if(null!==b&&null!==b.draggedParts){if(!this.mayDragIn())return;Kf(this,b.draggedParts.Jf(),!1,a.firstInput);rf(this,this.copiedParts,!1);tf(this,a.lastInput.documentPoint)}a.animationManager.sn=!1};
Se.prototype.doSimulatedDrop=function(){var a=this.diagram,b=Ue;if(null!==b){var c=b.diagram;b.Sn=!0;jf(this);if(!this.mayDragIn())return;a.animationManager.sn=!0;a.R("ChangingSelection",a.selection);this.va("Drop");Kf(this,b.draggedParts.Jf(),!0,a.lastInput);rf(this,this.copiedParts,!1);null!==this.copiedParts&&(a.clearSelection(!0),this.copiedParts.iteratorKeys.each(function(a){a.isSelected=!0}));Af(this,a.lastInput.documentPoint);a.Oa();b=a.selection;null!==this.copiedParts?this.transactionResult=
"ExternalCopy":b=new F;this.copiedParts=null;a.doFocus();a.R("ExternalObjectsDropped",b,c);this.Jg();a.R("ChangedSelection",a.selection)}a.animationManager.sn=!1};
function Kf(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.qk(b,e,!0);var f=N.alloc();of(b,f);d=f.x+f.width/2;e=f.y+f.height/2;N.free(f);f=a.it;var g=new H,h=J.alloc();for(b=b.iterator;b.next();){var k=b.value,l=c.H(k);k.Wb()&&k.canCopy()?(k=k.location,h.h(f.x-(d-k.x),f.y-(e-k.y)),l.location=h,l.Ta(),g.add(l,a.xd(h))):l instanceof S&&k.canCopy()&&(qf(l,f.x-d,f.y-e),
g.add(l,a.xd()))}J.free(h);a.copiedParts=g;Ve(a,g.Jf());null!==a.draggedLink&&(c=a.draggedLink,d=c.routeBounds,qf(c,a.startPoint.x-(d.x+d.width/2),a.startPoint.y-(d.y+d.height/2)))}}}Se.prototype.doSimulatedDragOut=function(){var a=this.diagram;a.mu=!1;this.mayCopy()||this.mayMove()?a.currentCursor="":a.currentCursor=this.nodropCursor;this.Bo=null};Se.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(Se.prototype,{isCopyEnabled:{get:function(){return this.Qc},set:function(a){this.Qc=a}},copiesEffectiveCollection:{get:function(){return this.I},set:function(a){this.I=a}},dragOptions:{get:function(){return this.Ka},set:function(a){this.Ka=a}},isGridSnapEnabled:{get:function(){return this.dragOptions.isGridSnapEnabled},set:function(a){this.dragOptions.isGridSnapEnabled=
a}},isComplexRoutingRealtime:{get:function(){return this.Bc},set:function(a){this.Bc=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.w(a)||(a=a.G(),this.dragOptions.gridSnapCellSize=a)}},gridSnapCellSpot:{
get:function(){return this.dragOptions.gridSnapCellSpot},set:function(a){this.dragOptions.gridSnapCellSpot.w(a)||(a=a.G(),this.dragOptions.gridSnapCellSpot=a)}},gridSnapOrigin:{get:function(){return this.dragOptions.gridSnapOrigin},set:function(a){this.dragOptions.gridSnapOrigin.w(a)||(a=a.G(),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.T},set:function(a){this.T=a}},moveCursor:{get:function(){return this.Wh},set:function(a){this.Wh=a}},nodropCursor:{get:function(){return this.Xh},set:function(a){this.Xh=a}},currentPart:{get:function(){return this.Ja},
set:function(a){this.Ja=a}},copiedParts:{get:function(){return this.v},set:function(a){this.v=a}},draggedParts:{get:function(){return this.cb},set:function(a){this.cb=a}},draggingParts:{get:function(){return null!==this.copiedParts?this.copiedParts.Jf():null!==this.draggedParts?this.draggedParts.Jf():this.nr}},draggedLink:{get:function(){return this.diagram.draggedLink},set:function(a){this.diagram.draggedLink=
a}},isDragOutStarted:{get:function(){return this.Gd},set:function(a){this.Gd=a}},startPoint:{get:function(){return this.it},set:function(a){this.it.w(a)||this.it.assign(a)}},delay:{get:function(){return this.il},set:function(a){this.il=a}}});Se.prototype.getDraggingSource=Se.prototype.gA;var gf=null,Ue=null,Ye=null;Se.className="DraggingTool";gf=new E;
La("draggingTool",function(){return this.findTool("Dragging")},function(a){this.Xa("Dragging",a,this.mouseMoveTools)});Oa.prototype.doCancel=function(){null!==Ue&&Ue.doCancel();Ce.prototype.doCancel.call(this)};
function Lf(){Ce.call(this);this.Xh=100;this.Ka=!1;this.oi="pointer";var a=new S,b=new W;b.isPanelMain=!0;b.stroke="blue";a.add(b);b=new W;b.toArrow="Standard";b.fill="blue";b.stroke="blue";a.add(b);a.layerName="Tool";this.bx=a;a=new V;b=new W;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke="magenta";b.strokeWidth=2;b.desiredSize=Nb;a.add(b);a.selectable=!1;a.layerName="Tool";this.ax=a;this.l=b;a=new V;b=new W;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke="magenta";b.strokeWidth=2;b.desiredSize=
Nb;a.add(b);a.selectable=!1;a.layerName="Tool";this.ex=a;this.v=b;this.Wh=this.Gd=this.Bc=this.cb=this.Qc=null;this.Ja=!0;this.$y=new H;this.nr=this.Hi=this.$w=null}la(Lf,Ce);Lf.prototype.doStop=function(){this.diagram.If();this.originalToPort=this.originalToNode=this.originalFromPort=this.originalFromNode=this.originalLink=null;this.validPortsCache.clear();this.targetPort=null};
Lf.prototype.copyPortProperties=function(a,b,c,d,e){if(null!==a&&null!==b&&null!==c&&null!==d){var f=b.Af(),g=M.alloc();g.width=b.naturalBounds.width*f;g.height=b.naturalBounds.height*f;d.desiredSize=g;M.free(g);e?(d.toSpot=b.toSpot,d.toEndSegmentLength=b.toEndSegmentLength):(d.fromSpot=b.fromSpot,d.fromEndSegmentLength=b.fromEndSegmentLength);c.locationSpot=Bc;f=J.alloc();c.location=b.ga(Bc,f);J.free(f);d.angle=b.lj();null!==this.portTargeted&&this.portTargeted(a,b,c,d,e)}};
Lf.prototype.setNoTargetPortProperties=function(a,b,c){null!==b&&(b.desiredSize=Nb,b.fromSpot=vc,b.toSpot=vc);null!==a&&(a.location=this.diagram.lastInput.documentPoint);null!==this.portTargeted&&this.portTargeted(null,null,a,b,c)};Lf.prototype.doMouseDown=function(){this.isActive&&this.doMouseMove()};
Lf.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.Ft(a.lastInput.viewPoint)}};Lf.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};
Lf.prototype.findTargetPort=function(a){var b=this.diagram,c=b.lastInput.documentPoint,d=this.portGravity;0>=d&&(d=.1);var e=this,f=b.Eg(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.ga(Bc,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.H(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};
Lf.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.Dq(b).count>=c)return!1}return!0};
Lf.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.Bd(b).count>=c)return!1}return!0};
Lf.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};Lf.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.Bd(b);b.next();)if(d=b.value,d.fromNode===c&&d.fromPortId===a)return!0;return!1};
Lf.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};Lf.prototype.isLabelDependentOnLink=function(a,b){if(null===a)return!1;var c=a.labeledLink;if(null===c)return!1;if(c===b)return!0;var d=new F;d.add(a);return Mf(this,c,b,d)};
function Mf(a,b,c,d){if(b===c)return!0;var e=b.fromNode;if(null!==e&&e.isLinkLabel&&(d.add(e),Mf(a,e.labeledLink,c,d)))return!0;b=b.toNode;return null!==b&&b.isLinkLabel&&(d.add(b),Mf(a,b.labeledLink,c,d))?!0:!1}
Lf.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!==Nf){if(d===Of){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!Pf(this,a,b,c,!0)}if(d===Qf){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!Pf(this,a,b,c,!0)}if(d===Rf)return a===b?a=!0:(d=new F,d.add(b),a=Sf(this,d,a,b,c)),!a;if(d===Tf)return!Pf(this,a,b,c,!1);if(d===Uf)return a===b?a=!0:(d=new F,d.add(b),a=Vf(this,d,a,b,c)),!a}return!0};function Pf(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&&Pf(a,g,c,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&&g.toNode===c&&(g=g.fromNode,g!==c&&Sf(a,b,g,d,e)))return!0}return!1}function Vf(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&&Vf(a,b,h,d,e))return!0}}return!1}
ma.Object.defineProperties(Lf.prototype,{portGravity:{get:function(){return this.Xh},set:function(a){0<=a&&(this.Xh=a)}},isUnconnectedLinkValid:{get:function(){return this.Ka},set:function(a){this.Ka=a}},linkingCursor:{get:function(){return this.oi},set:function(a){this.oi=a}},temporaryLink:{get:function(){return this.bx},set:function(a){this.bx=a}},temporaryFromNode:{
get:function(){return this.ax},set:function(a){if(this.ax=a)this.l=a.port}},temporaryFromPort:{get:function(){return this.l},set:function(a){if(null!==this.l){var b=this.l.panel;if(null!==b){var c=b.W.indexOf(this.l);b.bb(c);b.vb(c,a)}}this.l=a}},temporaryToNode:{get:function(){return this.ex},set:function(a){if(this.ex=a)this.v=a.port}},temporaryToPort:{get:function(){return this.v},set:function(a){if(null!==
this.v){var b=this.v.panel;if(null!==b){var c=b.W.indexOf(this.v);b.bb(c);b.vb(c,a)}}this.v=a}},originalLink:{get:function(){return this.Qc},set:function(a){this.Qc=a}},originalFromNode:{get:function(){return this.cb},set:function(a){this.cb=a}},originalFromPort:{get:function(){return this.Bc},set:function(a){this.Bc=a}},originalToNode:{get:function(){return this.Gd},set:function(a){this.Gd=
a}},originalToPort:{get:function(){return this.Wh},set:function(a){this.Wh=a}},isForwards:{get:function(){return this.Ja},set:function(a){this.Ja=a}},validPortsCache:{get:function(){return this.$y}},targetPort:{get:function(){return this.$w},set:function(a){this.$w=a}},linkValidation:{get:function(){return this.Hi},set:function(a){this.Hi=a}},portTargeted:{
get:function(){return this.nr},set:function(a){this.nr=a}}});Lf.className="LinkingBaseTool";function Wf(){Lf.call(this);this.name="Linking";this.T={};this.I=null;this.J=Xf;this.cn=null}la(Wf,Lf);Wf.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowLink||!a.model.Ut()||!a.lastInput.left||a.currentTool!==this&&!this.isBeyondDragSize()?!1:null!==this.findLinkablePort()};
Wf.prototype.findLinkablePort=function(){var a=this.diagram,b=this.startObject;null===b&&(b=a.Ub(a.firstInput.documentPoint,null,null));if(null===b||!(b.part instanceof V))return null;a=this.direction;if(a===Xf||a===Yf){var c=this.findValidLinkablePort(b,!1);if(null!==c)return this.isForwards=!0,c}if(a===Xf||a===Zf)if(b=this.findValidLinkablePort(b,!0),null!==b)return this.isForwards=!1,b;return null};
Wf.prototype.doActivate=function(){var a=this.diagram,b=this.findLinkablePort();null!==b&&(this.va(this.name),a.isMouseCaptured=!0,a.currentCursor=this.linkingCursor,this.isForwards?(null===this.temporaryToNode||this.temporaryToNode.location.u()||(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.u()||(this.temporaryFromNode.location=a.lastInput.documentPoint),this.originalToPort=b,b=this.originalToPort.part,b instanceof V&&(this.originalToNode=b),this.copyPortProperties(this.originalToNode,this.originalToPort,this.temporaryToNode,this.temporaryToPort,!0)),a.add(this.temporaryFromNode),a.add(this.temporaryToNode),null!==this.temporaryLink&&(null!==this.temporaryFromNode&&(this.temporaryLink.fromNode=this.temporaryFromNode),
null!==this.temporaryToNode&&(this.temporaryLink.toNode=this.temporaryToNode),this.temporaryLink.isTreeLink=this.isNewTreeLink(),this.temporaryLink.Ua(),a.add(this.temporaryLink)),this.isActive=!0)};Wf.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.Jg()};Wf.prototype.doStop=function(){Lf.prototype.doStop.call(this);this.startObject=null};
Wf.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var 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)}}};Wf.prototype.isNewTreeLink=function(){var a=this.archetypeLinkData;if(null===a)return!0;if(a instanceof S)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};
Wf.prototype.insertLink=function(a,b,c,d){return this.diagram.partManager.insertLink(a,b,c,d)};Wf.prototype.doNoLink=function(){};
ma.Object.defineProperties(Wf.prototype,{archetypeLinkData:{get:function(){return this.T},set:function(a){this.T=a}},archetypeLabelNodeData:{get:function(){return this.I},set:function(a){this.I=a}},direction:{get:function(){return this.J},set:function(a){this.J=a}},startObject:{get:function(){return this.cn},set:function(a){this.cn=a}}});
var Xf=new D(Wf,"Either",0),Yf=new D(Wf,"ForwardsOnly",0),Zf=new D(Wf,"BackwardsOnly",0);Wf.className="LinkingTool";Wf.Either=Xf;Wf.ForwardsOnly=Yf;Wf.BackwardsOnly=Zf;
function Ze(){Lf.call(this);this.name="Relinking";var a=new W;a.figure="Diamond";a.desiredSize=Pb;a.fill="lightblue";a.stroke="dodgerblue";a.cursor=this.linkingCursor;a.segmentIndex=0;this.T=a;a=new W;a.figure="Diamond";a.desiredSize=Pb;a.fill="lightblue";a.stroke="dodgerblue";a.cursor=this.linkingCursor;a.segmentIndex=-1;this.cn=a;this.I=null;this.Fx=new N}la(Ze,Lf);
Ze.prototype.updateAdornments=function(a){if(null!==a&&a instanceof S){var b="RelinkFrom",c=null;if(a.isSelected&&!this.diagram.isReadOnly){var d=a.selectionObject;null!==d&&a.canRelinkFrom()&&a.actualBounds.u()&&a.isVisible()&&d.actualBounds.u()&&d.Ff()&&(c=a.tk(b),null===c&&(c=this.makeAdornment(d,!1),a.Gh(b,c)))}null===c&&a.Gf(b);b="RelinkTo";c=null;a.isSelected&&!this.diagram.isReadOnly&&(d=a.selectionObject,null!==d&&a.canRelinkTo()&&a.actualBounds.u()&&a.isVisible()&&d.actualBounds.u()&&d.Ff()&&
(c=a.tk(b),null===c?(c=this.makeAdornment(d,!0),a.Gh(b,c)):c.o()));null===c&&a.Gf(b)}};Ze.prototype.makeAdornment=function(a,b){var c=new He;c.type=X.Link;b=b?this.toHandleArchetype:this.fromHandleArchetype;null!==b&&c.add(b.copy());c.adornedObject=a;return c};
Ze.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowRelink||!a.model.Ut()||!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};
Ze.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 He&&c.adornedPart instanceof S))return;this.handle=b;this.isForwards=null===c||"RelinkTo"===c.category;this.originalLink=c.adornedPart}this.va(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.Fx.set(this.originalLink.actualBounds);null!==this.originalLink&&0<this.originalLink.pointsCount&&(null===this.originalLink.fromNode&&(null!==this.temporaryFromPort&&(this.temporaryFromPort.desiredSize=Mb),null!==this.temporaryFromNode&&(this.temporaryFromNode.location=this.originalLink.i(0))),null===this.originalLink.toNode&&
(null!==this.temporaryToPort&&(this.temporaryToPort.desiredSize=Mb),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.Ua(),a.add(this.temporaryLink));this.isActive=!0};
Ze.prototype.copyLinkProperties=function(a,b){if(null!==a&&null!==b){b.adjusting=a.adjusting;b.corner=a.corner;var c=a.curve;if(c===$f||c===ag)c=bg;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}};
Ze.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.Jg()};Ze.prototype.doStop=function(){Lf.prototype.doStop.call(this);this.handle=null};
Ze.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram;this.transactionResult=null;var b=this.originalFromNode,c=this.originalFromPort,d=this.originalToNode,e=this.originalToPort,f=this.originalLink;this.targetPort=this.findTargetPort(this.isForwards);if(null!==this.targetPort){var g=this.targetPort.part;g instanceof V&&(this.isForwards?(d=g,e=this.targetPort):(b=g,c=this.targetPort))}else this.isUnconnectedLinkValid?this.isForwards?e=d=null:c=b=null:f=null;null!==f?(this.reconnectLink(f,
this.isForwards?d:b,this.isForwards?e:c,this.isForwards),null===this.targetPort&&(this.isForwards?f.defaultToPoint=a.lastInput.documentPoint:f.defaultFromPoint=a.lastInput.documentPoint,f.Ua()),a.allowSelect&&(f.isSelected=!0),this.transactionResult=this.name,a.R("LinkRelinked",f,this.isForwards?this.originalToPort:this.originalFromPort)):this.doNoRelink(this.originalLink,this.isForwards);this.originalLink.Nq(this.Fx)}this.stopTool()};
Ze.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};Ze.prototype.doNoRelink=function(){};
function zf(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(Ze.prototype,{fromHandleArchetype:{get:function(){return this.T},set:function(a){this.T=a}},toHandleArchetype:{get:function(){return this.cn},set:function(a){this.cn=a}},handle:{get:function(){return this.I},set:function(a){if(null!==a&&!(a.part instanceof He))throw Error("new handle is not in an Adornment: "+a);this.I=a}}});Ze.className="RelinkingTool";
La("linkingTool",function(){return this.findTool("Linking")},function(a){this.Xa("Linking",a,this.mouseMoveTools)});La("relinkingTool",function(){return this.findTool("Relinking")},function(a){this.Xa("Relinking",a,this.mouseDownTools)});
function cg(){Ce.call(this);this.name="LinkReshaping";var a=new W;a.figure="Rectangle";a.desiredSize=Ob;a.fill="lightblue";a.stroke="dodgerblue";this.v=a;a=new W;a.figure="Diamond";a.desiredSize=Pb;a.fill="lightblue";a.stroke="dodgerblue";a.cursor="move";this.I=a;this.T=3;this.vu=this.l=null;this.Gx=new J;this.Ks=new E}la(cg,Ce);cg.prototype.Yv=function(a){return a&&a.Rs&&0!==a.Rs.value?a.Rs:og};cg.prototype.Wm=function(a,b){a.Rs=b};
cg.prototype.updateAdornments=function(a){if(null!==a&&a instanceof S){var b=null;if(a.isSelected&&!this.diagram.isReadOnly){var c=a.path;null!==c&&a.canReshape()&&a.actualBounds.u()&&a.isVisible()&&c.actualBounds.u()&&c.Ff()&&(b=a.tk(this.name),null===b||b.Bx!==a.pointsCount||b.Qx!==a.resegmentable)&&(b=this.makeAdornment(c),null!==b&&(b.Bx=a.pointsCount,b.Qx=a.resegmentable,a.Gh(this.name,b)))}null===b&&a.Gf(this.name)}};
cg.prototype.makeAdornment=function(a){var b=a.part,c=b.pointsCount,d=b.isOrthogonal,e=null;if(null!==b.points&&1<c){e=new He;e.type=X.Link;c=b.firstPickIndex;var f=b.lastPickIndex,g=d?1:0;if(b.resegmentable&&b.computeCurve()!==pg)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.A(k.x,l.x)&&
K.A(k.y,l.y)&&(l=b.i(c-1));K.A(k.x,l.x)?(this.Wm(h,qg),h.cursor="n-resize"):K.A(k.y,l.y)&&(this.Wm(h,rg),h.cursor="w-resize")}else g===f-1&&d?(k=b.i(f-1),l=b.i(f),K.A(k.x,l.x)&&K.A(k.y,l.y)&&(k=b.i(f+1)),K.A(k.x,l.x)?(this.Wm(h,qg),h.cursor="n-resize"):K.A(k.y,l.y)&&(this.Wm(h,rg),h.cursor="w-resize")):g!==f&&(this.Wm(h,sg),h.cursor="move");e.add(h)}e.adornedObject=a}return e};cg.prototype.makeHandle=function(){var a=this.handleArchetype;return null===a?null:a.copy()};
cg.prototype.makeResegmentHandle=function(){var a=this.midHandleArchetype;return null===a?null:a.copy()};cg.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};
cg.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 S){this.vu=b;a.isMouseCaptured=!0;this.va(this.name);if(b.resegmentable&&999===this.handle.fromMaxLinks){var c=b.points.copy(),d=this.getResegmentingPoint();c.vb(this.handle.segmentIndex+1,d);b.isOrthogonal&&c.vb(this.handle.segmentIndex+1,d);b.points=c;b.Lb();b.updateAdornments();
this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name);if(null===this.handle){this.doDeactivate();return}}this.Gx=b.i(this.handle.segmentIndex);this.Ks=b.points.copy();this.isActive=!0}}};cg.prototype.doDeactivate=function(){this.Jg();this.vu=this.handle=null;this.isActive=this.diagram.isMouseCaptured=!1};cg.prototype.doCancel=function(){var a=this.adornedLink;null!==a&&(a.points=this.Ks);this.stopTool()};cg.prototype.getResegmentingPoint=function(){return this.handle.ga(Bc)};
cg.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeReshape(a.lastInput.documentPoint),this.reshape(a))};
cg.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&&(tg(this,g,d,e,f,!0)||tg(this,g,d,e,f,!1))){var h=b.points.copy();tg(this,g,d,
e,f,!0)?(h.nd(c-2,new J(g.x,(f.y+g.y)/2)),h.nd(c+1,new J(f.x,(f.y+g.y)/2))):(h.nd(c-2,new J((f.x+g.x)/2,g.y)),h.nd(c+1,new J((f.x+g.x)/2,f.y)));h.bb(c);h.bb(c-1);b.points=h;b.Lb()}else g=b.i(c+2),Math.abs(e.x-f.x)<this.resegmentingDistance&&Math.abs(e.y-f.y)<this.resegmentingDistance&&(tg(this,d,e,f,g,!0)||tg(this,d,e,f,g,!1))&&(h=b.points.copy(),tg(this,d,e,f,g,!0)?(h.nd(c-1,new J(d.x,(d.y+g.y)/2)),h.nd(c+2,new J(g.x,(d.y+g.y)/2))):(h.nd(c-1,new J((d.x+g.x)/2,d.y)),h.nd(c+2,new J((d.x+g.x)/2,g.y))),
h.bb(c+1),h.bb(c),b.points=h,b.Lb())}}else g=J.alloc(),K.Qh(d.x,d.y,f.x,f.y,e.x,e.y,g)&&g.Fe(e)<this.resegmentingDistance*this.resegmentingDistance&&(d=b.points.copy(),d.bb(c),b.points=d,b.Lb()),J.free(g)}a.Oa();this.transactionResult=this.name;a.R("LinkReshaped",this.adornedLink,this.Ks)}this.stopTool()};
function tg(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}
cg.prototype.reshape=function(a){var b=this.adornedLink;b.Th();var c=this.handle.segmentIndex,d=this.Yv(this.handle);if(b.isOrthogonal)if(c===b.firstPickIndex+1)c=b.firstPickIndex+1,d===qg?(b.K(c,b.i(c-1).x,a.y),b.K(c+1,b.i(c+2).x,a.y)):d===rg&&(b.K(c,a.x,b.i(c-1).y),b.K(c+1,a.x,b.i(c+2).y));else if(c===b.lastPickIndex-1)c=b.lastPickIndex-1,d===qg?(b.K(c-1,b.i(c-2).x,a.y),b.K(c,b.i(c+1).x,a.y)):d===rg&&(b.K(c-1,a.x,b.i(c-2).y),b.K(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.A(f.x,
e.x)&&K.A(e.y,g.y)?(K.A(f.x,b.i(d-2).x)&&!K.A(f.y,b.i(d-2).y)?(b.m(d,a.x,f.y),c++,d++):b.K(d-1,a.x,f.y),K.A(g.y,b.i(d+2).y)&&!K.A(g.x,b.i(d+2).x)?b.m(d+1,g.x,a.y):b.K(d+1,g.x,a.y)):K.A(f.y,e.y)&&K.A(e.x,g.x)?(K.A(f.y,b.i(d-2).y)&&!K.A(f.x,b.i(d-2).x)?(b.m(d,f.x,a.y),c++,d++):b.K(d-1,f.x,a.y),K.A(g.x,b.i(d+2).x)&&!K.A(g.y,b.i(d+2).y)?b.m(d+1,a.x,g.y):b.K(d+1,a.x,g.y)):K.A(f.x,e.x)&&K.A(e.x,g.x)?(K.A(f.x,b.i(d-2).x)&&!K.A(f.y,b.i(d-2).y)?(b.m(d,a.x,f.y),c++,d++):b.K(d-1,a.x,f.y),K.A(g.x,b.i(d+2).x)&&
!K.A(g.y,b.i(d+2).y)?b.m(d+1,a.x,g.y):b.K(d+1,a.x,g.y)):K.A(f.y,e.y)&&K.A(e.y,g.y)&&(K.A(f.y,b.i(d-2).y)&&!K.A(f.x,b.i(d-2).x)?(b.m(d,f.x,a.y),c++,d++):b.K(d-1,f.x,a.y),K.A(g.y,b.i(d+2).y)&&!K.A(g.x,b.i(d+2).x)?b.m(d+1,g.x,a.y):b.K(d+1,g.x,a.y));b.K(c,a.x,a.y)}else b.K(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).mc()&&(f=e.ga(Bc,J.alloc()),d=b.getLinkPointFromPoint(d,e,f,a,!0,J.alloc()),b.K(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).mc()&&(c=e.ga(Bc,J.alloc()),a=b.getLinkPointFromPoint(d,e,c,a,!1,J.alloc()),b.K(b.pointsCount-1,a.x,a.y),J.free(c),J.free(a));b.xf()};cg.prototype.computeReshape=function(a){var b=this.adornedLink,c=this.handle.segmentIndex;switch(this.Yv(this.handle)){case sg:return a;case qg:return new J(b.i(c).x,a.y);case rg:return new J(a.x,b.i(c).y);default:case og:return b.i(c)}};
ma.Object.defineProperties(cg.prototype,{handleArchetype:{get:function(){return this.v},set:function(a){this.v=a}},midHandleArchetype:{get:function(){return this.I},set:function(a){this.I=a}},handle:{get:function(){return this.l},set:function(a){if(null!==a&&!(a.part instanceof He))throw Error("new handle is not in an Adornment: "+a);this.l=a}},adornedLink:{get:function(){return this.vu}},
resegmentingDistance:{get:function(){return this.T},set:function(a){this.T=a}},originalPoint:{get:function(){return this.Gx}},originalPoints:{get:function(){return this.Ks}}});cg.prototype.setReshapingBehavior=cg.prototype.Wm;cg.prototype.getReshapingBehavior=cg.prototype.Yv;var og=new D(cg,"None",0),rg=new D(cg,"Horizontal",1),qg=new D(cg,"Vertical",2),sg=new D(cg,"All",3);cg.className="LinkReshapingTool";
cg.None=og;cg.Horizontal=rg;cg.Vertical=qg;cg.All=sg;La("linkReshapingTool",function(){return this.findTool("LinkReshaping")},function(a){this.Xa("LinkReshaping",a,this.mouseDownTools)});
function ug(){Ce.call(this);this.name="Resizing";this.fg=(new M(1,1)).freeze();this.eg=(new M(9999,9999)).freeze();this.Qg=(new M(NaN,NaN)).freeze();this.I=!1;this.T=!0;this.ee=null;var a=new W;a.alignmentFocus=Bc;a.figure="Rectangle";a.desiredSize=Ob;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.v=a;this.l=null;this.Js=new J;this.Ex=new M;this.mp=new J;this.Mu=new M(0,0);this.Lu=new M(Infinity,Infinity);this.Ku=new M(1,1);this.Ax=!0}la(ug,Ce);
ug.prototype.updateAdornments=function(a){if(!(null===a||a instanceof S)){if(a.isSelected&&!this.diagram.isReadOnly){var b=a.resizeObject,c=a.tk(this.name);if(null!==b&&a.canResize()&&a.actualBounds.u()&&a.isVisible()&&b.actualBounds.u()&&b.Ff()){if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){b=b.lj();vg(a)&&this.updateResizeHandles(c,b);a.Gh(this.name,c);return}}}a.Gf(this.name)}};
ug.prototype.makeAdornment=function(a){var b=a.part.resizeAdornmentTemplate;if(null===b){b=new He;b.type=X.Spot;b.locationSpot=Bc;var c=new wg;c.isPanelMain=!0;b.add(c);b.add(this.makeHandle(a,wc));b.add(this.makeHandle(a,zc));b.add(this.makeHandle(a,Hc));b.add(this.makeHandle(a,Dc));b.add(this.makeHandle(a,fd));b.add(this.makeHandle(a,hd));b.add(this.makeHandle(a,id));b.add(this.makeHandle(a,gd))}else if(xg(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};
ug.prototype.makeHandle=function(a,b){a=this.handleArchetype;if(null===a)return null;a=a.copy();a.alignment=b;return a};
ug.prototype.updateResizeHandles=function(a,b){if(null!==a)if(!a.alignment.Mb()&&("pointer"===a.cursor||0<a.cursor.indexOf("resize")))a:{var c=a.alignment;c.mc()&&(c=Bc);if(0>=c.x)b=0>=c.y?b+225:1<=c.y?b+135:b+180;else if(1<=c.x)0>=c.y?b+=315:1<=c.y&&(b+=45);else if(0>=c.y)b+=270;else if(1<=c.y)b+=90;else break a;0>b?b+=360:360<=b&&(b-=360);a.cursor=22.5>b?"e-resize":67.5>b?"se-resize":112.5>b?"s-resize":157.5>b?"sw-resize":202.5>b?"w-resize":247.5>b?"nw-resize":292.5>b?"n-resize":337.5>b?"ne-resize":
"e-resize"}else if(a instanceof X)for(a=a.elements;a.next();)this.updateResizeHandles(a.value,b)};ug.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};
ug.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,this.Ax=a.animationManager.isEnabled,a.animationManager.isEnabled=!1,this.va(this.name),this.Js.set(this.adornedObject.ga(this.handle.alignment.kw())),this.mp.set(this.adornedObject.part.location),this.Ex.set(this.adornedObject.desiredSize),
this.Ku=this.computeCellSize(),this.Mu=this.computeMinSize(),this.Lu=this.computeMaxSize(),this.isActive=!0))};ug.prototype.doDeactivate=function(){var a=this.diagram;this.Jg();this.ee=this.handle=null;this.isActive=a.isMouseCaptured=!1;a.animationManager.isEnabled=this.Ax};ug.prototype.doCancel=function(){null!==this.adornedObject&&(this.adornedObject.desiredSize=this.originalDesiredSize,this.adornedObject.part.location=this.originalLocation);this.stopTool()};
ug.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive){var b=this.Mu,c=this.Lu,d=this.Ku,e=this.adornedObject.Nt(a.lastInput.documentPoint,J.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);a.cd();J.free(e)}};
ug.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.Mu,c=this.Lu,d=this.Ku,e=this.adornedObject.Nt(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.Oa();this.transactionResult=this.name;a.R("PartResized",this.adornedObject,this.originalDesiredSize)}this.stopTool()};
ug.prototype.resize=function(a){var b=this.diagram,c=this.adornedObject;if(null!==c){c.desiredSize=a.size;a=c.part;a.Ta();c=c.ga(this.handle.alignment.kw());if(a instanceof vf){var d=new E;d.add(a);if(!this.dragsMembers&&null===a.placeholder){var e=new Te;e.dragsMembers=!1}b.moveParts(d,this.oppositePoint.copy().ce(c),!0,e)}else a.location=a.location.copy().ce(c).add(this.oppositePoint);b.cd()}};
ug.prototype.computeResize=function(a,b,c,d,e,f){b.mc()&&(b=Bc);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.Eq(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};ug.prototype.computeReshape=function(){var a=yg;this.adornedObject instanceof W&&(a=zg(this.adornedObject));return!(a===Ag||this.diagram.lastInput.shift)};
ug.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};ug.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};
ug.prototype.computeCellSize=function(){var a=new M(NaN,NaN),b=this.adornedObject.part;null!==b&&(b=b.resizeCellSize,!isNaN(b.width)&&0<b.width&&(a.width=b.width),!isNaN(b.height)&&0<b.height&&(a.height=b.height));b=this.cellSize;isNaN(a.width)&&!isNaN(b.width)&&0<b.width&&(a.width=b.width);isNaN(a.height)&&!isNaN(b.height)&&0<b.height&&(a.height=b.height);b=this.diagram;(isNaN(a.width)||isNaN(a.height))&&b&&(b=b.grid,null!==b&&b.visible&&this.isGridSnapEnabled&&(b=b.gridCellSize,isNaN(a.width)&&
!isNaN(b.width)&&0<b.width&&(a.width=b.width),isNaN(a.height)&&!isNaN(b.height)&&0<b.height&&(a.height=b.height)));if(isNaN(a.width)||0===a.width||Infinity===a.width)a.width=1;if(isNaN(a.height)||0===a.height||Infinity===a.height)a.height=1;return a};
ma.Object.defineProperties(ug.prototype,{handleArchetype:{get:function(){return this.v},set:function(a){this.v=a}},handle:{get:function(){return this.l},set:function(a){if(null!==a&&!(a.part instanceof He))throw Error("new handle is not in an Adornment: "+a);this.l=a}},adornedObject:{get:function(){return this.ee},set:function(a){if(null!==a&&a.part instanceof He)throw Error("new handle must not be in an Adornment: "+
a);this.ee=a}},minSize:{get:function(){return this.fg},set:function(a){if(!this.fg.w(a)){var b=a.width;isNaN(b)&&(b=0);a=a.height;isNaN(a)&&(a=0);this.fg.h(b,a)}}},maxSize:{get:function(){return this.eg},set:function(a){if(!this.eg.w(a)){var b=a.width;isNaN(b)&&(b=Infinity);a=a.height;isNaN(a)&&(a=Infinity);this.eg.h(b,a)}}},cellSize:{get:function(){return this.Qg},set:function(a){this.Qg.w(a)||this.Qg.assign(a)}},
isGridSnapEnabled:{get:function(){return this.I},set:function(a){this.I=a}},dragsMembers:{get:function(){return this.T},set:function(a){this.T=a}},oppositePoint:{get:function(){return this.Js},set:function(a){this.Js.w(a)||this.Js.assign(a)}},originalDesiredSize:{get:function(){return this.Ex}},originalLocation:{get:function(){return this.mp}}});
ug.className="ResizingTool";La("resizingTool",function(){return this.findTool("Resizing")},function(a){this.Xa("Resizing",a,this.mouseDownTools)});function Bg(){Ce.call(this);this.name="Rotating";this.Ka=45;this.Ja=2;this.mp=new J;this.ee=null;var a=new W;a.figure="Ellipse";a.desiredSize=Pb;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.v=a;this.l=null;this.Cx=0;this.mv=new J(NaN,NaN);this.I=0;this.T=50}la(Bg,Ce);
Bg.prototype.updateAdornments=function(a){if(null!==a){if(a.Ph()){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.u()&&a.isVisible()&&b.actualBounds.u()&&b.Ff())){var c=a.tk(this.name);if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){c.angle=b.lj();null===c.placeholder&&(c.location=this.computeAdornmentLocation(b));a.Gh(this.name,c);return}}a.Gf(this.name)}};
Bg.prototype.makeAdornment=function(a){var b=a.part.rotateAdornmentTemplate;if(null===b){b=new He;b.type=X.Position;b.locationSpot=Bc;var c=this.handleArchetype;null!==c&&b.add(c.copy())}else if(xg(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};Bg.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};
Bg.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.va(this.name),this.Cx=this.adornedObject.angle,this.mv=this.computeRotationPoint(this.adornedObject),this.mp=this.adornedObject.part.location.copy(),this.isActive=!0)};
Bg.prototype.computeRotationPoint=function(a){var b=a.part,c=b.locationObject;return b.rotationSpot.ib()?a.ga(b.rotationSpot):a===b||a===c?c.ga(b.locationSpot):a.ga(Bc)};
Bg.prototype.computeAdornmentLocation=function(a){var b=this.rotationPoint;b.u()||(b=this.computeRotationPoint(a));b=a.Nt(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.ga(b)};Bg.prototype.doDeactivate=function(){var a=this.diagram;this.Jg();this.ee=this.handle=null;this.mv=new J(NaN,NaN);this.isActive=a.isMouseCaptured=!1};Bg.prototype.doCancel=function(){this.diagram.delaysLayout=!1;this.rotate(this.originalAngle);this.stopTool()};Bg.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeRotate(a.lastInput.documentPoint),this.rotate(a))};
Bg.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){a.delaysLayout=!1;var b=this.computeRotate(a.lastInput.documentPoint);this.rotate(b);a.Oa();this.transactionResult=this.name;a.R("PartRotated",this.adornedObject,this.originalAngle)}this.stopTool()};
Bg.prototype.rotate=function(a){var b=this.adornedObject;if(null!==b){b.angle=a;b=b.part;b.Ta();var c=b.locationObject,d=b.rotateObject;if(c===d||c.Gg(d))c=this.mp.copy(),b.location=c.ce(this.rotationPoint).rotate(a-this.originalAngle).add(this.rotationPoint);this.diagram.cd()}};
Bg.prototype.computeRotate=function(a){a=this.rotationPoint.Sa(a)-this.handleAngle;var b=this.adornedObject.panel;null!==b&&(a-=b.lj());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(Bg.prototype,{handleArchetype:{get:function(){return this.v},set:function(a){this.v=a}},handle:{get:function(){return this.l},set:function(a){if(null!==a&&!(a.part instanceof He))throw Error("new handle is not in an Adornment: "+a);this.l=a}},adornedObject:{get:function(){return this.ee},set:function(a){if(null!==a&&a.part instanceof He)throw Error("new handle must not be in an Adornment: "+
a);this.ee=a}},snapAngleMultiple:{get:function(){return this.Ka},set:function(a){this.Ka=a}},snapAngleEpsilon:{get:function(){return this.Ja},set:function(a){this.Ja=a}},originalAngle:{get:function(){return this.Cx}},rotationPoint:{get:function(){return this.mv}},handleAngle:{get:function(){return this.I},set:function(a){this.I=a}},handleDistance:{
get:function(){return this.T},set:function(a){this.T=a}}});Bg.className="RotatingTool";La("rotatingTool",function(){return this.findTool("Rotating")},function(a){this.Xa("Rotating",a,this.mouseDownTools)});function Cg(){Ce.call(this);this.name="ClickSelecting"}la(Cg,Ce);Cg.prototype.canStart=function(){return!this.isEnabled||this.isBeyondDragSize()?!1:!0};
Cg.prototype.doMouseUp=function(){this.isActive&&(this.standardMouseSelect(),!this.standardMouseClick()&&this.diagram.lastInput.isTouchEvent&&this.diagram.toolManager.doToolTip());this.stopTool()};Cg.className="ClickSelectingTool";function Dg(){Ce.call(this);this.name="Action";this.Pk=null}la(Dg,Ce);
Dg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram,b=a.lastInput,c=a.Ub(b.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a});if(null!==c){if(!c.isActionable)return!1;this.Pk=c;a.Bj=a.Ub(b.documentPoint,null,null);return!0}return!1};Dg.prototype.doMouseDown=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Pk;null!==b&&(a.targetObject=b,null!==b.actionDown&&b.actionDown(a,b))}else this.canStart()&&this.doActivate()};
Dg.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Pk;null!==b&&(a.targetObject=b,null!==b.actionMove&&b.actionMove(a,b))}};Dg.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Pk;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()};
Dg.prototype.doCancel=function(){var a=this.diagram.lastInput,b=this.Pk;null!==b&&(a.targetObject=b,null!==b.actionCancel&&b.actionCancel(a,b),this.stopTool())};Dg.prototype.doStop=function(){this.Pk=null};Dg.className="ActionTool";function Eg(){Ce.call(this);this.name="ClickCreating";this.xj=null;this.v=!0;this.l=!1;this.ux=new J(0,0)}la(Eg,Ce);
Eg.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.ux=a.lastInput.viewPoint.copy()),2!==a.lastInput.clickCount||this.isBeyondDragSize(this.ux))return!1}else if(1!==a.lastInput.clickCount)return!1;return a.currentTool!==this&&null!==a.um(a.lastInput.documentPoint,!0)?!1:!0};
Eg.prototype.doMouseUp=function(){var a=this.diagram;this.isActive&&this.insertPart(a.lastInput.documentPoint);this.stopTool()};
Eg.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.va(this.name);if(c instanceof U)c.Wb()&&(xg(c),d=c.copy(),null!==d&&b.add(d));else if(null!==c){var e=b.model.copyNodeData(c);ya(e)&&(b.model.uf(e),d=b.yc(e))}if(null!==d){var f=J.allocAt(a.x,a.y);this.isGridSnapEnabled&&Fg(this.diagram,d,a,f);d.location=f;b.allowSelect&&(b.clearSelection(!0),d.isSelected=!0);J.free(f)}b.Oa();this.transactionResult=
this.name;b.R("PartCreated",d)}finally{this.Jg(),b.R("ChangedSelection",b.selection)}return d};ma.Object.defineProperties(Eg.prototype,{archetypeNodeData:{get:function(){return this.xj},set:function(a){this.xj=a}},isDoubleClick:{get:function(){return this.v},set:function(a){this.v=a}},isGridSnapEnabled:{get:function(){return this.l},set:function(a){this.l=a}}});Eg.className="ClickCreatingTool";
function Gg(){Ce.call(this);this.name="DragSelecting";this.il=175;this.v=!1;var a=new U;a.layerName="Tool";a.selectable=!1;var b=new W;b.name="SHAPE";b.figure="Rectangle";b.fill=null;b.stroke="magenta";a.add(b);this.l=a}la(Gg,Ce);
Gg.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.um(b.documentPoint,!0))?!1:!0};Gg.prototype.doActivate=function(){var a=this.diagram;this.isActive=!0;a.isMouseCaptured=!0;a.skipsUndoManager=!0;a.add(this.box);this.doMouseMove()};
Gg.prototype.doDeactivate=function(){var a=this.diagram;a.If();a.remove(this.box);a.skipsUndoManager=!1;this.isActive=a.isMouseCaptured=!1};Gg.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive&&null!==this.box){var b=this.computeBoxBounds(),c=this.box.$a("SHAPE");null===c&&(c=this.box.pb());var d=M.alloc().h(b.width,b.height);b=J.allocAt(b.x,b.y);c.desiredSize=d;this.box.position=b;M.free(d);J.free(b);(a.allowHorizontalScroll||a.allowVerticalScroll)&&a.Ft(a.lastInput.viewPoint)}};
Gg.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()};Gg.prototype.computeBoxBounds=function(){var a=this.diagram;return new N(a.firstInput.documentPoint,a.lastInput.documentPoint)};
Gg.prototype.selectInRect=function(a){var b=this.diagram,c=b.lastInput;a=b.py(a,this.isPartialInclusion);if(Wa?c.meta:c.control)if(c.shift)for(a=a.iterator;a.next();)b=a.value,b.isSelected&&(b.isSelected=!1);else for(a=a.iterator;a.next();)b=a.value,b.isSelected=!b.isSelected;else if(c.shift)for(a=a.iterator;a.next();)b=a.value,b.isSelected||(b.isSelected=!0);else{c=new E;for(b=b.selection.iterator;b.next();){var d=b.value;a.contains(d)||c.add(d)}for(b=c.iterator;b.next();)b.value.isSelected=!1;for(a=
a.iterator;a.next();)b=a.value,b.isSelected||(b.isSelected=!0)}};ma.Object.defineProperties(Gg.prototype,{delay:{get:function(){return this.il},set:function(a){this.il=a}},isPartialInclusion:{get:function(){return this.v},set:function(a){this.v=a}},box:{get:function(){return this.l},set:function(a){this.l=a}}});Gg.className="DragSelectingTool";
function Hg(){Ce.call(this);this.name="Panning";this.jv=new J;this.gz=new J;this.Pg=!1;var a=this;this.Jx=function(){var b=a.diagram;null!==b&&b.removeEventListener(x.document,"scroll",a.Jx,!1);a.stopTool()}}la(Hg,Ce);Hg.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};
Hg.prototype.doActivate=function(){var a=this.diagram;this.Pg?(a.lastInput.bubbles=!0,a.addEventListener(x.document,"scroll",this.Jx,!1)):(a.currentCursor="move",a.isMouseCaptured=!0,this.jv.assign(a.position));this.isActive=!0};Hg.prototype.doDeactivate=function(){var a=this.diagram;a.currentCursor="";this.isActive=a.isMouseCaptured=!1};Hg.prototype.doCancel=function(){var a=this.diagram;a.position=this.jv;a.isMouseCaptured=!1;this.stopTool()};Hg.prototype.doMouseMove=function(){this.move()};
Hg.prototype.doMouseUp=function(){this.move();this.stopTool()};Hg.prototype.move=function(){var a=this.diagram;if(this.isActive&&a)if(this.Pg)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.gz.h(e,c)}};
ma.Object.defineProperties(Hg.prototype,{bubbles:{get:function(){return this.Pg},set:function(a){this.Pg=a}},originalPosition:{get:function(){return this.jv}}});Hg.className="PanningTool";La("clickCreatingTool",function(){return this.findTool("ClickCreating")},function(a){this.Xa("ClickCreating",a,this.mouseUpTools)});La("clickSelectingTool",function(){return this.findTool("ClickSelecting")},function(a){this.Xa("ClickSelecting",a,this.mouseUpTools)});
La("panningTool",function(){return this.findTool("Panning")},function(a){this.Xa("Panning",a,this.mouseMoveTools)});La("dragSelectingTool",function(){return this.findTool("DragSelecting")},function(a){this.Xa("DragSelecting",a,this.mouseMoveTools)});La("actionTool",function(){return this.findTool("Action")},function(a){this.Xa("Action",a,this.mouseDownTools)});function Qe(){this.T=this.I=this.l=this.v=null}
ma.Object.defineProperties(Qe.prototype,{mainElement:{get:function(){return this.I},set:function(a){this.I=a}},show:{get:function(){return this.v},set:function(a){this.v!==a&&(this.v=a)}},hide:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a)}},valueFunction:{get:function(){return this.T},set:function(a){this.T=a}}});Qe.className="HTMLInfo";
function Ig(a,b,c){this.text=a;this.$x=b;this.visible=c}Ig.className="ContextMenuButtonInfo";function Jg(){Ce.call(this);this.name="ContextMenu";this.v=this.Bu=this.l=null;this.zx=new J;this.Cu=null;this.Xu=!1;var a=this;this.wv=function(){a.stopTool()}}la(Jg,Ce);
function Kg(a){var b=new Qe;b.show=function(a,b,c){c.showDefaultContextMenu()};b.hide=function(a,b){b.hideDefaultContextMenu()};Lg=b;a.wv=function(){a.stopTool()};b=ta("div");var c=ta("div");b.style.cssText="top: 0px;z-index:10002;position: fixed;display: none;text-align: center;left: 25%;width: 50%;background-color: #F5F5F5;padding: 16px;border: 16px solid #444;border-radius: 10px;margin-top: 10px";c.style.cssText="z-index:10001;position: fixed;display: none;top: 0;left: 0;width: 100%;height: 100%;background-color: black;opacity: 0.8;";
var d=ta("style");x.document.getElementsByTagName("head")[0].appendChild(d);d.sheet.insertRule(".goCXul { list-style: none; }",0);d.sheet.insertRule(".goCXli {font:700 1.5em Helvetica, Arial, sans-serif;position: relative;min-width: 60px; }",0);d.sheet.insertRule(".goCXa {color: #444;display: inline-block;padding: 4px;text-decoration: none;margin: 2px;border: 1px solid gray;border-radius: 10px; }",0);d=a.diagram;null!==d&&(d.addEventListener(b,"contextmenu",Mg,!1),d.addEventListener(b,"selectstart",
Mg,!1),d.addEventListener(c,"contextmenu",Mg,!1));b.className="goCXforeground";c.className="goCXbackground";x.document.body&&(x.document.body.appendChild(b),x.document.body.appendChild(c));Ng=b;Og=c;Pg=!0}function Mg(a){a.preventDefault();return!1}
Jg.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};Jg.prototype.doStart=function(){this.zx.set(this.diagram.firstInput.documentPoint)};Jg.prototype.doStop=function(){this.hideContextMenu();this.currentObject=null};
Jg.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.Ub(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};Jg.prototype.doActivate=function(){};
Jg.prototype.doMouseDown=function(){Ce.prototype.doMouseDown.call(this);if(this.isActive&&this.currentContextMenu instanceof He){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doMouseDown(),a.doDeactivate())}this.diagram.toolManager.mouseDownTools.contains(this)&&Qg(this)};
Jg.prototype.doMouseUp=function(){if(this.isActive&&this.currentContextMenu instanceof He){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doCancel(),a.doDeactivate())}Qg(this)};
function Qg(a){var b=a.diagram;if(a.isActive){var c=a.currentContextMenu;if(null!==c){if(!(c instanceof Qe)){var d=b.Ub(b.lastInput.documentPoint,null,null);null!==d&&d.Gg(c)&&a.standardMouseClick(null,null)}a.stopTool();a.canStart()&&(b.currentTool=a,a.doMouseUp())}}else a.canStart()&&(Rg(a,!0),a.isActive||a.stopTool())}
function Rg(a,b,c){void 0===c&&(c=null);if(!a.Xu&&(a.Xu=!0,b&&a.standardMouseSelect(),b=a.standardMouseClick(),a.Xu=!1,!b)){a.isActive=!0;b=Lg;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 He&&!a.currentContextMenu.visible&&a.stopTool()}}
Jg.prototype.doMouseMove=function(){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.doMouseMove();this.isActive&&this.diagram.toolManager.doMouseMove()};
Jg.prototype.showContextMenu=function(a,b){var c=this.diagram;a!==this.currentContextMenu&&this.hideContextMenu();if(a instanceof He){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.Ta();this.positionContextMenu(a,b)}else a instanceof Qe&&a.show(b,c,this);this.currentContextMenu=a};
Jg.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}};
Jg.prototype.hideContextMenu=function(){var a=this.diagram,b=this.currentContextMenu;null!==b&&(b instanceof He?(a.remove(b),null!==this.Bu&&this.Bu.Gf(b.category),b.data=null,b.adornedObject=null):b instanceof Qe&&(null!==b.hide?b.hide(a,this):null!==b.mainElement&&(b.mainElement.style.display="none")),this.currentContextMenu=null,this.standardMouseOver())};
function Sg(a){var b=new E;b.add(new Ig("Copy",function(a){a.commandHandler.copySelection()},function(a){return a.commandHandler.canCopySelection()}));b.add(new Ig("Cut",function(a){a.commandHandler.cutSelection()},function(a){return a.commandHandler.canCutSelection()}));b.add(new Ig("Delete",function(a){a.commandHandler.deleteSelection()},function(a){return a.commandHandler.canDeleteSelection()}));b.add(new Ig("Paste",function(b){b.commandHandler.pasteSelection(a.mouseDownPoint)},function(b){return b.commandHandler.canPasteSelection(a.mouseDownPoint)}));
b.add(new Ig("Select All",function(a){a.commandHandler.selectAll()},function(a){return a.commandHandler.canSelectAll()}));b.add(new Ig("Undo",function(a){a.commandHandler.undo()},function(a){return a.commandHandler.canUndo()}));b.add(new Ig("Redo",function(a){a.commandHandler.redo()},function(a){return a.commandHandler.canRedo()}));b.add(new Ig("Scroll To Part",function(a){a.commandHandler.scrollToPart()},function(a){return a.commandHandler.canScrollToPart()}));b.add(new Ig("Zoom To Fit",function(a){a.commandHandler.zoomToFit()},
function(a){return a.commandHandler.canZoomToFit()}));b.add(new Ig("Reset Zoom",function(a){a.commandHandler.resetZoom()},function(a){return a.commandHandler.canResetZoom()}));b.add(new Ig("Group Selection",function(a){a.commandHandler.groupSelection()},function(a){return a.commandHandler.canGroupSelection()}));b.add(new Ig("Ungroup Selection",function(a){a.commandHandler.ungroupSelection()},function(a){return a.commandHandler.canUngroupSelection()}));b.add(new Ig("Edit Text",function(a){a.commandHandler.editTextBlock()},
function(a){return a.commandHandler.canEditTextBlock()}));return b}
Jg.prototype.showDefaultContextMenu=function(){var a=this.diagram;null===this.Cu&&(this.Cu=Sg(this));Ng.innerHTML="";Og.addEventListener("click",this.wv,!1);var b=this,c=ta("ul");c.className="goCXul";Ng.appendChild(c);c.innerHTML="";for(var d=this.Cu.iterator;d.next();){var e=d.value,f=e.visible;if("function"===typeof e.$x&&("function"!==typeof f||f(a))){f=ta("li");f.className="goCXli";var g=ta("a");g.className="goCXa";g.href="#";g.az=e.$x;g.addEventListener("click",function(c){this.az(a);b.stopTool();
c.preventDefault();return!1},!1);g.textContent=e.text;f.appendChild(g);c.appendChild(f)}}Ng.style.display="block";Og.style.display="block"};Jg.prototype.hideDefaultContextMenu=function(){if(null!==this.currentContextMenu&&this.currentContextMenu===Lg){Ng.style.display="none";Og.style.display="none";var a=this.diagram;null!==a&&a.removeEventListener(Og,"click",this.wv,!1);this.currentContextMenu=null}};
ma.Object.defineProperties(Jg.prototype,{currentContextMenu:{get:function(){return this.l},set:function(a){this.l=a;this.Bu=a instanceof He?a.adornedPart:null}},defaultTouchContextMenu:{get:function(){!1===Pg&&null===Lg&&Tg&&Kg(this);return Lg},set:function(a){null===a&&(Pg=!0);Lg=a}},currentObject:{get:function(){return this.v},set:function(a){this.v=a}},mouseDownPoint:{get:function(){return this.zx}}});
var Lg=null,Pg=!1,Og=null,Ng=null;Jg.className="ContextMenuTool";La("contextMenuTool",function(){return this.findTool("ContextMenu")},function(a){this.Xa("ContextMenu",a,this.mouseUpTools)});function Ug(){Ce.call(this);this.name="TextEditing";this.zh=new Vg;this.Ka=null;this.Ja=Wg;this.Wi=null;this.ia=Xg;this.I=1;this.T=!0;this.v=null;this.l=new Qe;this.Gu=null;Yg(this,this.l)}la(Ug,Ce);
function Yg(a,b){if(Tg){var c=ta("textarea");a.Gu=c;c.addEventListener("input",function(){if(null!==a.textBlock){var b=a.Gy(this.value);this.style.width=20+b.measuredBounds.width*this.YA+"px";this.rows=b.lineCount}},!1);c.addEventListener("keydown",function(b){if(null!==a.textBlock){var c=b.which;13===c?(!1===a.textBlock.isMultiline&&b.preventDefault(),a.acceptText(Zg)):9===c?(a.acceptText($g),b.preventDefault()):27===c&&(a.doCancel(),null!==a.diagram&&a.diagram.doFocus())}},!1);c.addEventListener("focus",
function(){if(null!==a.currentTextEditor&&a.state!==Xg){var b=a.Gu;a.ia===ah&&(a.ia=bh);"function"===typeof b.select&&a.selectsTextOnActivate&&(b.select(),b.setSelectionRange(0,9999))}},!1);c.addEventListener("blur",function(){if(null!==a.currentTextEditor&&a.state!==Xg){var b=a.Gu;"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 Vg&&f instanceof Ug)if(f.state===ch)c.style.border="3px solid red",c.focus();else{var d=a.ga(Bc),e=b.position,k=b.scale,l=a.Af()*k;l<f.minimumEditorScale&&(l=f.minimumEditorScale);var m=a.naturalBounds.width*l+6,n=a.naturalBounds.height*l+2,p=(d.x-e.x)*k;d=(d.y-e.y)*k;c.value=a.text;b.div.style.font=a.font;c.style.position="absolute";c.style.zIndex="100";c.style.font="inherit";c.style.fontSize=100*l+"%";c.style.lineHeight="normal";c.style.width=m+"px";c.style.left=(p-m/2|0)-1+
"px";c.style.top=(d-n/2|0)-1+"px";c.style.textAlign=a.textAlign;c.style.margin="0";c.style.padding="1px";c.style.border="0";c.style.outline="none";c.style.whiteSpace="pre-wrap";c.style.overflow="hidden";c.rows=a.lineCount;c.YA=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)}}}
Ug.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(null===a||a.isReadOnly||dh&&dh!==this&&(dh.acceptText(eh),dh&&dh!==this)||!a.lastInput.left||this.isBeyondDragSize())return!1;var b=a.Ub(a.lastInput.documentPoint);if(!(null!==b&&b instanceof Vg&&b.editable&&b.part.canEdit()))return!1;b=b.part;return null===b||this.starting===Wg&&!b.isSelected||this.starting===fh&&2>a.lastInput.clickCount?!1:!0};Ug.prototype.doStart=function(){dh=this;null!==this.textBlock&&this.doActivate()};
Ug.prototype.doActivate=function(){if(!this.isActive){var a=this.diagram;if(null!==a){var b=this.textBlock;null===b&&(b=a.Ub(a.lastInput.documentPoint));if(null!==b&&b instanceof Vg&&(this.textBlock=b,null!==b.part)){this.isActive=!0;this.ia=ah;var c=this.defaultTextEditor;null!==b.textEditor&&(c=b.textEditor);this.zh=this.textBlock.copy();var d=new N(this.textBlock.ga(wc),this.textBlock.ga(Hc));a.zw(d);c.show(b,a,this);this.currentTextEditor=c}}}};Ug.prototype.doCancel=function(){this.stopTool()};
Ug.prototype.doMouseUp=function(){this.canStart()&&this.doActivate()};Ug.prototype.doMouseDown=function(){this.isActive&&this.acceptText(eh)};Ug.prototype.acceptText=function(a){switch(a){case eh:if(this.ia===gh)this.currentTextEditor instanceof HTMLElement&&this.currentTextEditor.focus();else if(this.ia===ah||this.ia===ch||this.ia===bh)this.ia=hh,ih(this);break;case jh:case Zg:case $g:if(Zg!==a||!0!==this.textBlock.isMultiline)if(this.ia===ah||this.ia===ch||this.ia===bh)this.ia=hh,ih(this)}};
function ih(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());if(a.isValidText(b,e,f))a.va(a.name),a.ia=gh,a.transactionResult=a.name,b.text=f,d=a.textBlock,null!==d.textEdited&&d.textEdited(d,e,f),null!==c&&c.R("TextEdited",b,e),a.Jg(),a.stopTool(),null!==c&&c.doFocus();else{a.ia=ch;var g=a.textBlock;null!==g.errorFunction&&g.errorFunction(a,e,f);d.show(b,c,a)}}}
Ug.prototype.doDeactivate=function(){var a=this.diagram;null!==a&&(this.ia=Xg,this.textBlock=null,null!==this.currentTextEditor&&this.currentTextEditor.hide(a,this),this.isActive=!1)};Ug.prototype.doStop=function(){dh=null};Ug.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};Ug.prototype.Gy=function(a){var b=this.zh;b.text=a;b.measure(this.textBlock.Di,Infinity);return b};
ma.Object.defineProperties(Ug.prototype,{textBlock:{get:function(){return this.Ka},set:function(a){this.Ka=a}},currentTextEditor:{get:function(){return this.v},set:function(a){this.v=a}},defaultTextEditor:{get:function(){return this.l},set:function(a){this.l=a}},starting:{get:function(){return this.Ja},set:function(a){this.Ja=a}},textValidation:{get:function(){return this.Wi},
set:function(a){this.Wi=a}},minimumEditorScale:{get:function(){return this.I},set:function(a){this.I=a}},selectsTextOnActivate:{get:function(){return this.T},set:function(a){this.T=a}},state:{get:function(){return this.ia},set:function(a){this.ia!==a&&(this.ia=a)}}});Ug.prototype.measureTemporaryTextBlock=Ug.prototype.Gy;
var jh=new D(Ug,"LostFocus",0),eh=new D(Ug,"MouseDown",1),$g=new D(Ug,"Tab",2),Zg=new D(Ug,"Enter",3),kh=new D(Ug,"SingleClick",0),Wg=new D(Ug,"SingleClickSelected",1),fh=new D(Ug,"DoubleClick",2),Xg=new D(Ug,"StateNone",0),ah=new D(Ug,"StateActive",1),bh=new D(Ug,"StateEditing",2),hh=new D(Ug,"StateValidating",3),ch=new D(Ug,"StateInvalid",4),gh=new D(Ug,"StateValidated",5),dh=null;Ug.className="TextEditingTool";Ug.LostFocus=jh;Ug.MouseDown=eh;Ug.Tab=$g;Ug.Enter=Zg;Ug.SingleClick=kh;
Ug.SingleClickSelected=Wg;Ug.DoubleClick=fh;Ug.StateNone=Xg;Ug.StateActive=ah;Ug.StateEditing=bh;Ug.StateValidating=hh;Ug.StateInvalid=ch;Ug.StateValidated=gh;La("textEditingTool",function(){return this.findTool("TextEditing")},function(a){this.Xa("TextEditing",a,this.mouseUpTools)});
function lh(){mh||(nh(),mh=!0);this.B=De;this.tl=this.df=this.rc=this.rs=this.ic=!1;this.Ox=!0;this.ul=oh;this.sn=!1;this.yi=this.gd=!0;this.Xg=600;this.mx=this.Nx=!1;this.Pe=new F;this.Jd=new ph;this.Jd.Rc=this;this.Qk=new F;this.tv=new F;this.ot=new F}lh.prototype.ae=function(a){this.B=a};lh.prototype.canStart=function(){return!0};function Ch(a,b){Dh(a,b)&&(a.df=!0)}function Dh(a,b){if(!a.gd||!a.canStart(b))return!1;a.Pe.add(b);a.defaultAnimation.isAnimating&&a.Nc();return a.rc=!0}
function Eh(a){if(a.gd&&a.rc){var b=a.Jd,c=a.B,d=a.Pe.contains("Model");d&&(a.tl=!0,a.ul===oh?(b.isViewportUnconstrained=!0,b.lc.clear(),b.add(c,"position",c.position.copy().offset(0,-200),c.position),b.add(c,"opacity",0,1)):a.ul===Fh&&b.lc.clear(),a.Ox=a.ul===Gh&&c.Vs.w(c.la)?!0:!1,c.R("InitialAnimationStarting",a));d&&!a.yi||0===b.lc.count?(a.Pe.clear(),a.rc=!1,a.df=!1,b.lc.clear(),Hh(b,c),a.tl=!1,c.M()):(a.Pe.clear(),c.Ae=!1,d=b.lc.get(c),c.autoScale!==Ih&&null!==d&&(delete d.start.scale,delete d.end.scale),
x.requestAnimationFrame(function(){!1===a.rc||b.ic||(c.Ge("temporaryPixelRatio")&&We(c),Jh(c),a.rc=!1,a.df=!1,b.start(),Kh(a),c.Oa(),Lh(b,0),Jf(c,!0),Mh(a),c.R("AnimationStarting",a))}))}}function Nh(a,b,c,d){b instanceof S&&(null!==b.fromNode||null!==b.toNode)||a.Jd.add(b,"position",c,d,!1)}t=lh.prototype;t.bu=function(a){return this.Jd.bu(a)};t.dw=function(a){return this.Jd.dw(a)};
function Oh(a,b){function c(){0<e.ot.count&&(d.addAll(e.ot),e.ot.clear(),e.ic=!0);if(!1!==e.ic&&0!==d.count){e.tv.addAll(d);for(var a=e.tv.iterator;a.next();){var b=a.value;if(!1!==b.ic){a:if(0<b.km.count)var h=!0;else{for(h=b.lc.iterator;h.next();){var k=h.key;if(k instanceof Y&&null!==k.diagram||k instanceof Q){h=!0;break a}}h=!1}h?Ph(b,!1):b.Cl=!0}}e.tv.clear();Kh(e);Jf(e.B);Mh(e);x.requestAnimationFrame(c)}}var d=a.Qk,e=a;a.ic?a.ot.add(b):(a.ic=!0,d.add(b),x.requestAnimationFrame(function(){c()}))}
function Qh(a){for(a=a.Qk.iterator;a.next();)a.value.Cl=!1}function Kh(a){if(!a.rs){var b=a.B;a.Nx=b.skipsUndoManager;a.mx=b.skipsModelSourceBindings;b.skipsUndoManager=!0;b.skipsModelSourceBindings=!0;a.rs=!0}}function Mh(a){var b=a.B;b.skipsUndoManager=a.Nx;b.skipsModelSourceBindings=a.mx;a.rs=!1}
t.Nc=function(a){var b=this.Jd;!0===this.rc&&(this.tl=this.df=this.rc=!1,this.Pe.clear(),0<b.lc.count&&this.B.Db());if(this.ic){if(b.rm(!0),b.lc.clear(),Hh(b,null),!0===a)for(a=this.Qk.ma(),b=0;b<a.length;b++)a[b].rm(!0)}else b.lc.clear(),Hh(b,this.B)};t.rm=function(a){a===this.defaultAnimation&&this.defaultAnimation.lc.clear();this.Qk.remove(a);0===this.Qk.count&&(this.ic=!1,this.B.Db());a===this.defaultAnimation&&(this.defaultAnimation.lc.clear(),this.B.R("AnimationFinished",this))};
t.ik=function(a,b){this.df&&(this.Pe.contains("Expand Tree")||this.Pe.contains("Expand SubGraph"))&&this.Jd.ik(a,b)};t.gk=function(a,b){this.df&&(this.Pe.contains("Collapse Tree")||this.Pe.contains("Collapse SubGraph"))&&(this.Jd.gk(a,b),Rh(this.Jd,b,"position",b.position,b.position))};function Sh(a,b,c){a.df&&!b.w(c)&&(a.B.oj||(b=c.copy()),Rh(a.Jd,a.B,"position",b,c))}
function Th(a,b,c,d,e){null===a&&(a="rgba(0,0,0,0)");null===b&&(b="rgba(0,0,0,0)");Uh(a);Vh();var f=Wh.l,g=Wh.I,h=Wh.v;a=Wh.T;Uh(b);Vh();var k=Wh.I,l=Wh.v;b=Wh.T;f=e(c,f,Wh.l-f,d);g=e(c,g,k-g,d);h=e(c,h,l-h,d);c=e(c,a,b-a,d);return"hsla("+f+", "+g+"%, "+h+"%, "+c+")"}
function nh(){var a=new H;a.add("position:diagram",function(a,c,d,e,f,g){a.position=new J(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g))});a.add("position",function(a,c,d,e,f,g){f<g?a.fr(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g),!1):a.position=new J(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g))});a.add("location",function(a,c,d,e,f,g){f<g?a.fr(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g),!0):a.location=new J(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g))});a.add("position:placeholder",function(a,c,d,e,f,g){f<g?a.fr(e(f,c.x,d.x-c.x,
g),e(f,c.y,d.y-c.y,g),!1):a.position=new J(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g))});a.add("position:node",function(a,c,d,e,f,g){var b=a.actualBounds,k=d.actualBounds;d=k.x+k.width/2-b.width/2;b=k.y+k.height/2-b.height/2;f<g?a.fr(e(f,c.x,d-c.x,g),e(f,c.y,b-c.y,g),!1):a.position=new J(e(f,c.x,d-c.x,g),e(f,c.y,b-c.y,g))});a.add("desiredSize",function(a,c,d,e,f,g){a.desiredSize=new N(e(f,c.width,d.width-c.width,g),e(f,c.height,d.height-c.height,g))});a.add("width",function(a,c,d,e,f,g){a.width=e(f,c,
d-c,g)});a.add("height",function(a,c,d,e,f,g){a.height=e(f,c,d-c,g)});a.add("fill",function(a,c,d,e,f,g){a.fill=Th(c,d,f,g,e)});a.add("stroke",function(a,c,d,e,f,g){a.stroke=Th(c,d,f,g,e)});a.add("strokeWidth",function(a,c,d,e,f,g){a.strokeWidth=e(f,c,d-c,g)});a.add("strokeDashOffset",function(a,c,d,e,f,g){a.strokeDashOffset=e(f,c,d-c,g)});a.add("background",function(a,c,d,e,f,g){a.background=Th(c,d,f,g,e)});a.add("areaBackground",function(a,c,d,e,f,g){a.areaBackground=Th(c,d,f,g,e)});a.add("opacity",
function(a,c,d,e,f,g){a.opacity=e(f,c,d-c,g)});a.add("scale",function(a,c,d,e,f,g){a.scale=e(f,c,d-c,g)});a.add("angle",function(a,c,d,e,f,g){a.angle=e(f,c,d-c,g)});Xh=a}
ma.Object.defineProperties(lh.prototype,{animationReasons:{get:function(){return this.Pe}},isEnabled:{get:function(){return this.gd},set:function(a){this.gd=a}},duration:{get:function(){return this.Xg},set:function(a){1>a&&va(a,">= 1",lh,"duration");this.Xg=a}},isAnimating:{get:function(){return this.ic}},isTicking:{get:function(){return this.rs}},isInitial:{
get:function(){return this.yi},set:function(a){this.yi=a}},defaultAnimation:{get:function(){return this.Jd}},activeAnimations:{get:function(){return this.Qk}},initialAnimationStyle:{get:function(){return this.ul},set:function(a){this.ul=a}}});lh.prototype.stopAnimation=lh.prototype.Nc;var Xh=null,mh=!1,oh=new D(lh,"Default",1),Gh=new D(lh,"AnimateLocations",2),Fh=new D(lh,"None",3);
lh.className="AnimationManager";lh.defineAnimationEffect=function(a,b){mh||(nh(),mh=!0);Xh.add(a,b)};lh.Default=oh;lh.AnimateLocations=Gh;lh.None=Fh;function ph(){this.xv=this.Mx=this.Rc=this.B=null;this.Cl=this.ic=this.l=!1;this.Yn=this.yd=0;this.Kr=this.Ju=Yh;this.Bl=this.Bp=!1;this.nv=1;this.lv=0;this.qd=this.Xg=NaN;this.px=0;this.Zn=null;this.v=Hb;this.lc=new H;this.hv=new H;this.km=new F;this.iv=new F;this.nx=Zh}ph.prototype.suspend=function(){this.Cl=!0};
ph.prototype.advanceTo=function(a,b){b&&(this.Cl=!1);this.Bp&&a>=this.qd&&(this.Bl=!0,a-=this.qd);this.px=a;Ph(this,!0);Kh(this.Rc);Jf(this.B);Mh(this.Rc);this.B.Je()};function Hh(a,b){a.hv.clear();a.Bl=!1;a.lv=0;a.qd=NaN;0<a.km.count&&a.km.clear();0<a.iv.count&&a.iv.clear();if(null!==b)for(a=b.links;a.next();)a.value.qg=null}t=ph.prototype;
t.start=function(){if(0!==this.lc.count&&!this.ic){for(var a=this.B,b=this.lc.iterator;b.next();){var c=b.value.end,d=b.key;if(c["position:placeholder"]){var e=d.findVisibleNode();if(e instanceof vf&&null!==e.placeholder){var f=e.placeholder;e=f.ga(wc);f=f.padding;e.x+=f.left;e.y+=f.top;c["position:placeholder"]=e}}null===a&&(d instanceof Q?a=d:d instanceof Y&&(a=d.diagram))}null!==a&&(this.B=a,b=this.Rc=a.animationManager,!1!==b.isEnabled&&(this.qd=isNaN(this.Xg)?b.duration:this.Xg,this.Kr=this.Ju,
b.tl&&b.ul===oh&&this===b.defaultAnimation&&(this.Kr=$h,this.qd=isNaN(this.Xg)?600===b.duration?900:b.duration:this.Xg),this.nx=a.scrollMode,this.isViewportUnconstrained&&(a.Ti=ai),Kh(b),this.km.each(function(b){b.data=null;a.add(b)}),Mh(b),this.ic=!0,this.yd=+new Date,this.Yn=this.yd+this.qd,Oh(b,this)))}};t.nz=function(a,b){a.Wb()&&(this.km.add(a),this.B=b)};
t.add=function(a,b,c,d,e){"position"===b&&c.w(d)||(null===this.B&&(a instanceof Q?this.B=a:a instanceof Y&&null!==a.diagram&&(this.B=a.diagram)),a instanceof U&&!a.isAnimated||Rh(this,a,b,c,d,e))};
function Rh(a,b,c,d,e,f){var g=a.lc;b instanceof Q&&"position"===c&&(c="position:diagram");if(g.contains(b)){var h=g.H(b);var k=h.start;var l=h.end;void 0===k[c]&&(k[c]=bi(d));l[c]=bi(e)}else k={},l={},k[c]=bi(d),l[c]=bi(e),h=k.position,b instanceof Y&&h instanceof J&&!h.u()&&b.diagram.animationManager.Pe.contains("Expand SubGraph")&&h.assign(l.position),h=new ci(k,l,f),g.add(b,h);g=k[c];g instanceof J&&!g.u()&&g.assign(a.v);f&&0===c.indexOf("position:")&&b instanceof U?h.Pv.location=bi(b.location):
f&&(h.Pv[c]=bi(d))}function bi(a){return a instanceof J?a.copy():a instanceof M?a.copy():a}t.bu=function(a){if(!this.ic)return!1;a=this.lc.H(a);return null!==a&&a.pw};t.dw=function(a){if(!this.ic)return!1;a=this.lc.H(a);return null!==a&&(a.start.position||a.start.location)};
function Ph(a,b){if(!a.Cl||b){var c=a.Rc;if(!1!==a.ic){var d=+new Date,e=d>a.Yn?a.qd:d-a.yd;b&&(e=a.px,e<a.qd?(a.yd=+new Date-e,a.Yn=a.yd+a.qd):e=a.qd);Kh(c);Lh(a,e);Jf(a.B,!0);Mh(c);d>a.Yn&&(a.Bp&&!a.Bl?(a.yd=+new Date,a.Yn=a.yd+a.qd,a.Bl=!0):a.rm(!1))}}}
function Lh(a,b){for(var c=a.qd,d=a.lc.iterator,e=a.Bl;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=Xh,l;for(l in g)"position"===l&&(g["position:placeholder"]||g["position:node"])||null===k.get(l)||k.get(l)(f,h[l],g[l],a.Kr,b,c,a)}}}t.stop=function(){this.ic&&this.rm(!0)};
t.rm=function(a){null!==this.xv&&this.xv.Ip.remove(this.Mx);if(this.ic){var b=this.B,c=this.Rc;this.Cl=this.ic=c.tl=!1;Kh(c);for(var d=this.lc,e=this.km.iterator;e.next();)b.remove(e.value);for(e=this.iv.iterator;e.next();)e.value.o();e=this.Bp;d=d.iterator;for(var f=Xh;d.next();){var g=d.key,h=d.value,k=e?h.end:h.start,l=e?h.start:h.end,m=h.Pv,n;for(n in l)if(null!==f.get(n)){var p=n;!h.Jv||"position:node"!==p&&"position:placeholder"!==p||(p="position");f.get(p)(g,k[n],void 0!==m[n]?m[n]:h.Jv?k[n]:
l[n],this.Kr,this.qd,this.qd,this)}h.Jv&&void 0!==m.location&&g instanceof U&&(g.location=m.location);h.pw&&g instanceof U&&g.Ob(!1)}if(c.defaultAnimation===this)for(n=this.B.links;n.next();)e=n.value,null===e.qg?(d=e.path,null!==d&&(e.dd=!1,e.o(),d.o())):(e.points=e.qg,e.qg=null);b.Xt.clear();kf(b,!1);b.Oa();b.M();Jf(b,!0);this.isViewportUnconstrained&&(b.scrollMode=this.nx);Mh(c);this.lv++;!a&&this.nv>this.lv?(this.Bl=!1,this.start()):(this.Zn&&this.Zn(this),Hh(this,null),c.rm(this),b.Db())}};
t.ik=function(a,b){var c=b.actualBounds,d=null;b instanceof vf&&(d=b.placeholder);null!==d?(c=d.ga(wc),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 vf)for(a=a.memberParts;a.next();)d=a.value,d instanceof V&&this.ik(d,b)};
t.gk=function(a,b){if(a.isVisible()){var c=null;b instanceof vf&&(c=b.placeholder);null!==c?this.add(a,"position:placeholder",a.position,c,!0):this.add(a,"position:node",a.position,b,!0);this.add(a,"scale",a.scale,.01,!0);c=this.lc;c.contains(a)&&(c.H(a).pw=!0);if(a instanceof vf)for(a=a.memberParts;a.next();)c=a.value,c instanceof V&&this.gk(c,b)}};t.kA=function(a){var b=this.hv.get(a);null===b&&(b={},this.hv.add(a,b));return b};
ma.Object.defineProperties(ph.prototype,{duration:{get:function(){return this.Xg},set:function(a){1>a&&va(a,">= 1",ph,"duration");this.Xg=a}},reversible:{get:function(){return this.Bp},set:function(a){this.Bp=a}},runCount:{get:function(){return this.nv},set:function(a){0<a?this.nv=a:B("Animation.runCount value must be a positive integer.")}},finished:{get:function(){return this.Zn},
set:function(a){this.Zn!==a&&(this.Zn=a)}},easing:{get:function(){return this.Ju},set:function(a){this.Ju=a}},isViewportUnconstrained:{get:function(){return this.l},set:function(a){this.l=a}},isAnimating:{get:function(){return this.ic}}});ph.prototype.getTemporaryState=ph.prototype.kA;ph.prototype.stop=ph.prototype.stop;ph.prototype.add=ph.prototype.add;ph.prototype.addTemporaryPart=ph.prototype.nz;
function Yh(a,b,c,d){a/=d/2;return 1>a?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b}function $h(a,b,c,d){return a===d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b}ph.className="Animation";ph.EaseLinear=function(a,b,c,d){return c*a/d+b};ph.EaseInOutQuad=Yh;ph.EaseInQuad=function(a,b,c,d){return c*(a/=d)*a+b};ph.EaseOutQuad=function(a,b,c,d){return-c*(a/=d)*(a-2)+b};ph.EaseInExpo=function(a,b,c,d){return 0===a?b:c*Math.pow(2,10*(a/d-1))+b};ph.EaseOutExpo=$h;
function ci(a,b,c){this.start=a;this.end=b;this.Pv={};this.Jv=c;this.pw=!1}ci.className="AnimationState";function di(a,b,c){this.jd=null;this.ff=a;this.aq=c||ei;this.Vk=null;void 0!==b&&(this.Vk=b,void 0===c&&(this.aq=fi))}di.prototype.copy=function(){var a=new di(this.ff);a.aq=this.aq;var b=this.Vk;if(null!==b){var c={};void 0!==b.duration&&(c.ky=b.duration);void 0!==b.finished&&(c.ky=b.finished);void 0!==b.easing&&(c.ky=b.easing);a.Vk=c}return a};
function gi(a,b){a=a.Vk;null!==a&&(a.duration&&(b.duration=a.duration),a.finished&&(b.finished=a.finished),a.easing&&(b.easing=a.easing))}ma.Object.defineProperties(di.prototype,{propertyName:{get:function(){return this.ff},set:function(a){this.ff=a}},animationSettings:{get:function(){return this.Vk},set:function(a){this.Vk=a}},startCondition:{get:function(){return this.aq},set:function(a){this.aq=a}}});
var ei=new D(di,"Default",1),fi=new D(di,"Immediate",2),hi=new D(di,"Bundled",3);di.className="AnimationTrigger";di.Default=ei;di.Immediate=fi;di.Bundled=hi;function ii(){Ya(this);this.B=null;this.Da=new E;this.Qa="";this.tb=1;this.v=!1;this.Oi=this.I=this.ii=this.hi=this.gi=this.fi=this.di=this.ei=this.ci=this.ki=this.bi=this.ji=this.ai=this.$h=!0;this.l=!1;this.np=[]}t=ii.prototype;t.clear=function(){this.Da.clear();this.np.length=0};t.ae=function(a){this.B=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.Da.iterator;h.next();){var k=h.value;k instanceof vf?e++:k instanceof V?d++:k instanceof S?f++:k instanceof He?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.Da.iterator;a.next();)c=a.value,h+="\n    "+c.toString(),d=c.data,null!==d&&mb(d)&&(h+=" #"+mb(d)),c instanceof V?h+=" "+
Ja(d):c instanceof S&&(h+=" "+Ja(c.fromNode)+" "+Ja(c.toNode));return b+" "+this.Da.count+": "+h};t.Ub=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);if(!1===this.Oi)return null;var d=!1;null!==this.diagram&&this.diagram.viewportBounds.aa(a)&&(d=!0);for(var e=J.alloc(),f=this.Da.j,g=f.length;g--;){var h=f[g];if((!0!==d||!1!==vg(h))&&h.isVisible()&&(e.assign(a),Bb(e,h.Ad),h=h.Ub(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.hj=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof E||d instanceof F||(d=new F);if(!1===this.Oi)return d;var e=!1;null!==this.diagram&&this.diagram.viewportBounds.aa(a)&&(e=!0);for(var f=J.alloc(),g=this.Da.j,h=g.length;h--;){var k=g[h];if((!0!==e||!1!==vg(k))&&k.isVisible()){f.assign(a);Bb(f,k.Ad);var l=k;k.hj(f,b,c,d)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||d.add(l))}}J.free(f);return d};
t.zf=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof E||e instanceof F||(e=new F);if(!1===this.Oi)return e;var f=!1;null!==this.diagram&&this.diagram.viewportBounds.De(a)&&(f=!0);for(var g=this.Da.j,h=g.length;h--;){var k=g[h];if((!0!==f||!1!==vg(k))&&k.isVisible()){var l=k;k.zf(a,b,c,d,e)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||e.add(l))}}return e};
t.Uv=function(a,b,c,d,e,f,g){if(!1===this.Oi)return e;for(var h=this.Da.j,k=h.length;k--;){var l=h[k];if((!0!==g||!1!==vg(l))&&f(l)&&l.isVisible()){var m=l;l.zf(a,b,c,d,e)&&(null!==b&&(m=b(m)),null===m||null!==c&&!c(m)||e.add(m))}}return e};
t.Eg=function(a,b,c,d,e,f){void 0===c&&(c=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof E||e instanceof F)f=e;e=!0}f instanceof E||f instanceof F||(f=new F);if(!1===this.Oi)return f;var g=!1;null!==this.diagram&&this.diagram.viewportBounds.aa(a)&&(g=!0);for(var h=J.alloc(),k=J.alloc(),l=this.Da.j,m=l.length;m--;){var n=l[m];if((!0!==g||!1!==vg(n))&&n.isVisible()){h.assign(a);Bb(h,n.Ad);k.h(a.x+b,a.y);Bb(k,n.Ad);var p=n;n.Eg(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.Fd=function(a,b){if(this.visible){var c=this.Da.j,d=c.length;if(0!==d){a=Ea();for(var e=Ea(),f=0;f<d;f++){var g=c[f];g.xx=f;if(g instanceof S){if(!1===g.dd)continue}else if(g instanceof He&&null!==g.adornedPart)continue;dc(g.actualBounds,b)?(g.Fd(!0),a.push(g)):(g.Fd(!1),null!==g.adornments&&0<g.adornments.count&&e.push(g))}for(b=0;b<a.length;b++)for(c=a[b],ji(c),c=c.adornments;c.next();)d=c.value,d.measure(Infinity,Infinity),d.arrange(),d.Fd(!0);for(b=0;b<e.length;b++)ji(e[b]);Ha(a);Ha(e)}}};
function ki(a,b){var c=1;1!==a.tb&&(c=b.globalAlpha,b.globalAlpha=c*a.tb);return c}t.bc=function(a,b,c){if(this.visible&&0!==this.tb&&(void 0===c&&(c=!0),c||!this.isTemporary)){c=this.Da.j;var d=c.length;if(0!==d){var e=ki(this,a),f=this.np;f.length=0;for(var g=b.scale,h=N.alloc(),k=0;k<d;k++)this.dj(a,c[k],b,f,g,h,!0);N.free(h);a.globalAlpha=e}}};
t.dj=function(a,b,c,d,e,f,g){if(!g||vg(b)){if(null!==d&&b instanceof S&&(b.isOrthogonal&&d.push(b),!1===b.dd))return;g=b.actualBounds;d=!1;var h=b.containingGroup;if(null!==h&&h.isClipping&&h.type!==X.Spot&&b.isVisible()){d=h.resizeObject;d instanceof X&&(d=d.pb());d.wm(f);d instanceof W&&f.Ic(-d.strokeWidth,-d.strokeWidth);if(!f.Lc(g))return;d=!f.De(g)}d&&(a.save(),a.beginPath(),a.rect(f.x,f.y,f.width,f.height),a.clip());g.width*e>c.To||g.height*e>c.To?b.bc(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&&(li(b,a,b.areaBackground,!0,!0,f,e),a.fillRect(e.x,e.y,e.width,e.height)),null===b.areaBackground&&null===b.background&&(li(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),li(b,a,b.background,!0,!1,f,e),a.fillRect(0,0,f.width/2,f.height/2),c.Tt()||(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.tc(!0))}};t.g=function(a,b,c,d,e){var f=this.diagram;null!==f&&f.ab(ve,a,this,b,c,d,e)};t.nj=function(a,b,c){var d=this.Da;b.Ei=this;if(a>=d.count)a=d.count;else if(d.L(a)===b)return-1;d.vb(a,b);b.Kq(c);d=this.diagram;null!==d&&(c?d.M():d.nj(b));mi(this,a,b);return a};
t.Kc=function(a,b,c){if(!c&&b.layer!==this&&null!==b.layer)return b.layer.Kc(a,b,c);var d=this.Da;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.Lq(c);d.bb(a);d=this.diagram;null!==d&&(c?d.M():d.Kc(b));b.Ei=null;return a};
function mi(a,b,c){b=ni(a,b,c);if(c instanceof vf&&null!==c&&isNaN(c.zOrder)){if(0!==c.memberParts.count){for(var d=-1,e=a.Da.j,f=e.length,g=0;g<f;g++){var h=e[g];if(h===c&&(b=g,0<=d))break;if(0>d&&h.containingGroup===c&&(d=g,0<=b))break}!(0>d)&&d<b&&(e=a.Da,e.bb(b),e.vb(d,c))}c=c.containingGroup;null!==c&&mi(a,-1,c)}}
function ni(a,b,c){var d=c.zOrder;if(isNaN(d))return b;a=a.Da;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.bb(b);a.vb(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.bb(b);a.vb(h,c);return h}for(k=NaN;++h<
e&&(k=a.L(h).zOrder,isNaN(k)););}return b}
ma.Object.defineProperties(ii.prototype,{parts:{get:function(){return this.Da.iterator}},partsBackwards:{get:function(){return this.Da.iteratorBackwards}},diagram:{get:function(){return this.B}},name:{get:function(){return this.Qa},set:function(a){var b=this.Qa;if(b!==a){var c=this.diagram;if(null!==c)for(""===b&&B("Cannot rename default Layer to: "+a),c=c.layers;c.next();)c.value.name===
a&&B("Layer.name is already present in this diagram: "+a);this.Qa=a;this.g("name",b,a);for(a=this.Da.iterator;a.next();)a.value.layerName=this.Qa}}},opacity:{get:function(){return this.tb},set:function(a){var b=this.tb;b!==a&&((0>a||1<a)&&va(a,"0 <= value <= 1",ii,"opacity"),this.tb=a,this.g("opacity",b,a),a=this.diagram,null!==a&&a.M())}},isTemporary:{get:function(){return this.v},set:function(a){var b=this.v;b!==a&&(this.v=a,this.g("isTemporary",
b,a))}},visible:{get:function(){return this.I},set:function(a){var b=this.I;if(b!==a){this.I=a;this.g("visible",b,a);for(b=this.Da.iterator;b.next();)b.value.Ob(a);a=this.diagram;null!==a&&a.M()}}},pickable:{get:function(){return this.Oi},set:function(a){var b=this.Oi;b!==a&&(this.Oi=a,this.g("pickable",b,a))}},isBoundsIncluded:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a,null!==this.diagram&&
this.diagram.Oa())}},allowCopy:{get:function(){return this.$h},set:function(a){var b=this.$h;b!==a&&(this.$h=a,this.g("allowCopy",b,a))}},allowDelete:{get:function(){return this.ai},set:function(a){var b=this.ai;b!==a&&(this.ai=a,this.g("allowDelete",b,a))}},allowTextEdit:{get:function(){return this.ji},set:function(a){var b=this.ji;b!==a&&(this.ji=a,this.g("allowTextEdit",b,a))}},allowGroup:{
get:function(){return this.bi},set:function(a){var b=this.bi;b!==a&&(this.bi=a,this.g("allowGroup",b,a))}},allowUngroup:{get:function(){return this.ki},set:function(a){var b=this.ki;b!==a&&(this.ki=a,this.g("allowUngroup",b,a))}},allowLink:{get:function(){return this.ci},set:function(a){var b=this.ci;b!==a&&(this.ci=a,this.g("allowLink",b,a))}},allowRelink:{get:function(){return this.ei},set:function(a){var b=
this.ei;b!==a&&(this.ei=a,this.g("allowRelink",b,a))}},allowMove:{get:function(){return this.di},set:function(a){var b=this.di;b!==a&&(this.di=a,this.g("allowMove",b,a))}},allowReshape:{get:function(){return this.fi},set:function(a){var b=this.fi;b!==a&&(this.fi=a,this.g("allowReshape",b,a))}},allowResize:{get:function(){return this.gi},set:function(a){var b=this.gi;b!==a&&(this.gi=a,this.g("allowResize",b,a))}},
allowRotate:{get:function(){return this.hi},set:function(a){var b=this.hi;b!==a&&(this.hi=a,this.g("allowRotate",b,a))}},allowSelect:{get:function(){return this.ii},set:function(a){var b=this.ii;b!==a&&(this.ii=a,this.g("allowSelect",b,a))}}});ii.prototype.findObjectsNear=ii.prototype.Eg;ii.prototype.findObjectsIn=ii.prototype.zf;ii.prototype.findObjectsAt=ii.prototype.hj;ii.prototype.findObjectAt=ii.prototype.Ub;ii.className="Layer";
function Q(a){1<arguments.length&&B("Diagram constructor can only take one optional argument, the DIV HTML element or its id.");oi||(pi(),oi=!0);Ya(this);De=this;Qa=[];this.Rb=!0;this.Rc=new lh;this.Rc.ae(this);this.nb=17;this.Al=this.pv=!1;this.Us="default";this.Ea=null;if(Tg){var b=this,c=function(){b.removeEventListener(x.document,"DOMContentLoaded",c,!1);b.setRTL()};null!==x.document.body?this.setRTL():b.addEventListener(x.document,"DOMContentLoaded",c,!1)}this.La=new E;this.wa=this.xa=0;this.Sl=
this.ta=null;this.Ix=new H;this.gf=this.Gb=null;this.ww();this.Kj=null;this.vw();this.tb=1;this.la=(new J(NaN,NaN)).freeze();this.Vs=new J(NaN,NaN);this.Pn=this.ya=1;this.gs=(new J(NaN,NaN)).freeze();this.hs=NaN;this.zs=1E-4;this.xs=100;this.ob=new rd;this.xt=(new J(NaN,NaN)).freeze();this.bs=(new N(NaN,NaN,NaN,NaN)).freeze();this.Si=(new pc(0,0,0,0)).freeze();this.Ti=Zh;this.ct=!1;this.Ws=this.Qs=null;this.Og=Ih;this.Aj=ad;this.Yf=Ih;this.qo=ad;this.js=this.fs=wc;this.Dc=!0;this.yl=!1;this.rd=new F;
this.Vg=new H;this.kl=!0;this.pn=250;this.yj=-1;this.rn=(new pc(16,16,16,16)).freeze();this.Ej=this.Ae=!1;this.Hj=!0;this.Vf=new re;this.Vf.diagram=this;this.Ud=new re;this.Ud.diagram=this;this.gh=new re;this.gh.diagram=this;this.se=this.Nf=null;this.ek=!1;this.Rr=this.Sr=null;this.ln=x.PointerEvent&&(Ta||Ua||Va)&&x.navigator&&!1!==x.navigator.msPointerEnabled;qi(this);this.Dh=new F;this.ss=!0;this.rt=ri;this.Tu=!1;this.tt=Nf;this.Ka=null;si.add("Model",ti);this.Lr=this.Or=this.pt=null;this.On=this.Jr=
"auto";this.gg=this.Cs=this.ig=this.jg=this.lg=this.Pf=this.Tf=this.Of=null;this.es=!1;this.Qf=this.wg=this.kg=this.hg=null;this.Ds=!1;this.Os={};this.Zj=[null,null];this.Dr=null;this.Pr=this.gt=this.rv=this.ug=!1;this.$u=!0;this.xi=this.jc=!1;this.ac=null;var d=this;this.Bc=function(a){var b=d.partManager;if(a.model===b.diagram.model&&b.diagram.Z){b.diagram.Z=!1;try{var c=a.change;""===a.modelChange&&c===ve&&b.updateDataBindings(a.object,a.propertyName)}finally{b.diagram.Z=!0}}};this.Qc=function(a){d.partManager.doModelChanged(a)};
this.zv=!0;this.Pd=-2;this.Pi=new H;this.Ns=new E;this.$f=!1;this.ai=this.$h=this.qr=this.gd=!0;this.rr=!1;this.xr=this.vr=this.ii=this.hi=this.gi=this.fi=this.di=this.ei=this.ci=this.ur=this.ki=this.bi=this.ji=this.sr=!0;this.Zf=this.Wu=!1;this.wr=this.tr=this.ql=this.pl=!0;this.bt=this.Ys=16;this.Xs=this.Kp=!1;this.Lp=this.$s=null;this.Zs=this.at=0;this.gb=(new pc(5)).freeze();this.qv=(new F).freeze();this.ys=999999999;this.Qu=(new F).freeze();this.wi=this.vi=this.ui=!0;this.Xe=this.le=!1;this.kc=
null;this.Ng=!0;this.me=!1;this.yx=new F;this.Ru=new F;this.Gc=null;this.Pl=1;this.sv=0;this.Vd={scale:1,position:new J,bounds:new N,gw:!1};this.Px=(new N(NaN,NaN,NaN,NaN)).freeze();this.mm=(new M(NaN,NaN)).freeze();this.Qn=(new N(NaN,NaN,NaN,NaN)).freeze();this.ts=!1;this.Ho=this.oo=this.gp=this.Eu=this.Du=this.Fu=this.bg=this.eh=this.cf=this.Vr=null;ui(this);this.Ib=null;this.no=!1;this.Bj=null;this.partManager=new ti;this.toolManager=new Oa;this.toolManager.initializeStandardTools();this.currentTool=
this.defaultTool=this.toolManager;this.Ur=null;this.dl=new Te;this.Is=this.Hs=null;this.cq=!1;this.commandHandler=vi();this.model=wi();this.ug=!0;xi(this);this.layout=new yi;this.ug=!1;this.qx=this.Iu=null;this.Sb=1;this.yh=null;this.To=1;this.Zo=0;this.gv=[0,0,0,0,0];this.$o=0;this.sd=1;this.Pj=0;this.Co=new J;this.qt=500;this.qn=new J;this.ne=!1;this.Gm=this.Hm=this.Fm=this.Em=this.Ek=this.Gk=this.Fk=this.Ck=this.Dk=this.Uw=this.Lw=this.Mw=this.Nw=this.sh=this.Ul=this.rh=this.Tl=null;this.Zq=function(){};
this.preventDefault=null;this.so=!1;this.ti=new zi;this.eq=!1;void 0!==a&&Hi(this,a);this.$n=null;this.ao=Lb;this.Rb=!1}Q.prototype.clear=function(){this.animationManager.Nc();this.model.clear();Ii=null;Ji="";Ki(this,!1);this.Oa();this.Ta();this.M()};
function Ki(a,b){a.animationManager.Nc(!0);a.qv=(new F).freeze();a.Qu=(new F).freeze();var c=a.skipsUndoManager;null!==a.model&&(a.skipsUndoManager=!0);var d=null;null!==a.Ib&&(d=a.Ib.part,null!==d&&a.remove(d));var e=[],f=a.La.length;if(b){for(b=0;b<f;b++)for(var g=a.La.j[b].parts;g.next();){var h=g.value;h!==d&&null===h.data&&e.push(h)}for(b=0;b<e.length;b++)a.remove(e[b])}for(b=0;b<f;b++)a.La.j[b].clear();a.partManager.clear();a.rd.clear();a.Vg.clear();a.Dh.clear();a.Bj=null;Ga=[];null!==d&&(a.add(d),
a.partManager.parts.remove(d));null!==a.model&&(a.skipsUndoManager=c);return e}function vi(){return null}
Q.prototype.reset=function(){this.clear();this.Rb=!0;this.Rc=new lh;this.Rc.ae(this);this.nb=17;this.Al=this.pv=!1;this.Us="default";this.La=new E;this.Ix=new H;this.gf=null;this.ww();this.Kj=null;this.vw();this.tb=1;this.la=(new J(NaN,NaN)).freeze();this.Vs=new J(NaN,NaN);this.Pn=this.ya=1;this.gs=(new J(NaN,NaN)).freeze();this.hs=NaN;this.zs=1E-4;this.xs=100;this.ob=new rd;this.xt=(new J(NaN,NaN)).freeze();this.bs=(new N(NaN,NaN,NaN,NaN)).freeze();this.Si=(new pc(0,0,0,0)).freeze();this.Ti=Zh;this.ct=
!1;this.Ws=this.Qs=null;this.Og=Ih;this.Aj=ad;this.Yf=Ih;this.qo=ad;this.js=this.fs=wc;this.Dc=!0;this.yl=!1;this.rd=new F;this.Vg=new H;this.kl=!0;this.pn=250;this.yj=-1;this.rn=(new pc(16,16,16,16)).freeze();this.Ej=this.Ae=!1;this.Hj=!0;this.Vf=new re;this.Vf.diagram=this;this.Ud=new re;this.Ud.diagram=this;this.gh=new re;this.gh.diagram=this;this.se=this.Nf=null;this.ek=!1;this.Rr=this.Sr=null;this.ln=x.PointerEvent&&(Ta||Ua||Va)&&x.navigator&&!1!==x.navigator.msPointerEnabled;qi(this);this.Dh=
new F;this.ss=!0;this.rt=ri;this.Tu=!1;this.tt=Nf;this.Lr=this.Or=this.pt=null;this.On=this.Jr="auto";this.gg=this.Cs=this.ig=this.jg=this.lg=this.Pf=this.Tf=this.Of=null;this.es=!1;this.Qf=this.wg=this.kg=this.hg=null;this.Ds=!1;this.Os={};this.Zj=[null,null];this.Dr=null;this.Pr=this.gt=this.rv=this.ug=!1;this.$u=!0;this.xi=this.jc=!1;this.zv=!0;this.Pd=-2;this.Pi=new H;this.Ns=new E;this.$f=!1;this.ai=this.$h=this.qr=this.gd=!0;this.rr=!1;this.xr=this.vr=this.ii=this.hi=this.gi=this.fi=this.di=
this.ei=this.ci=this.ur=this.ki=this.bi=this.ji=this.sr=!0;this.Zf=this.Wu=!1;this.wr=this.tr=this.ql=this.pl=!0;this.bt=this.Ys=16;this.Xs=this.Kp=!1;this.Zs=this.at=0;this.gb=(new pc(5)).freeze();this.qv=(new F).freeze();this.ys=999999999;this.Qu=(new F).freeze();this.wi=this.vi=this.ui=!0;this.Xe=this.le=!1;this.kc=null;this.Ng=!0;this.me=!1;this.yx=new F;this.Ru=new F;this.Gc=null;this.Pl=1;this.sv=0;this.Vd={scale:1,position:new J,bounds:new N,gw:!1};this.Px=(new N(NaN,NaN,NaN,NaN)).freeze();
this.mm=(new M(NaN,NaN)).freeze();this.Qn=(new N(NaN,NaN,NaN,NaN)).freeze();this.ts=!1;this.Ho=this.oo=this.gp=this.Eu=this.Du=this.Fu=this.bg=this.eh=this.cf=null;ui(this);this.Ib=null;this.no=!1;this.Bj=null;this.partManager=new ti;this.toolManager=new Oa;this.toolManager.initializeStandardTools();this.currentTool=this.defaultTool=this.toolManager;this.Ur=null;this.dl=new Te;this.Is=this.Hs=null;this.cq=!1;this.commandHandler=vi();this.ug=!0;xi(this);this.layout=new yi;this.ug=!1;this.model=wi();
this.model.undoManager=new Ae;this.me=!1;this.Hj=!0;this.Ae=!1;this.Sb=1;this.yh=null;this.To=1;this.Zo=0;this.gv=[0,0,0,0,0];this.$o=0;this.sd=1;this.Pj=0;this.Co=new J;this.qt=500;this.qn=new J;this.ne=!1;this.sh=this.Ul=this.rh=this.Tl=null;this.eq=this.so=!1;this.$n=null;this.ao=Lb;this.Rb=!1;this.M()};
function ui(a){a.cf=new H;var b=new V,c=new Vg;c.bind(new Li("text","",Ja));b.add(c);a.Fu=b;a.cf.add("",b);b=new V;c=new Vg;c.stroke="brown";c.bind(new Li("text","",Ja));b.add(c);a.cf.add("Comment",b);b=new V;b.selectable=!1;b.avoidable=!1;c=new W;c.figure="Ellipse";c.fill="black";c.stroke=null;c.desiredSize=(new M(3,3)).ca();b.add(c);a.cf.add("LinkLabel",b);a.eh=new H;b=new vf;b.selectionObjectName="GROUPPANEL";b.type=X.Vertical;c=new Vg;c.font="bold 12pt sans-serif";c.bind(new Li("text","",Ja));
b.add(c);c=new X(X.Auto);c.name="GROUPPANEL";var d=new W;d.figure="Rectangle";d.fill="rgba(128,128,128,0.2)";d.stroke="black";c.add(d);d=new wg;d.padding=(new pc(5,5,5,5)).ca();c.add(d);b.add(c);a.Du=b;a.eh.add("",b);a.bg=new H;b=new S;c=new W;c.isPanelMain=!0;b.add(c);c=new W;c.toArrow="Standard";c.fill="black";c.stroke=null;c.strokeWidth=0;b.add(c);a.Eu=b;a.bg.add("",b);b=new S;c=new W;c.isPanelMain=!0;c.stroke="brown";b.add(c);a.bg.add("Comment",b);b=new He;b.type=X.Auto;c=new W;c.fill=null;c.stroke=
"dodgerblue";c.strokeWidth=3;b.add(c);c=new wg;c.margin=(new pc(1.5,1.5,1.5,1.5)).ca();b.add(c);a.gp=b;a.oo=b;b=new He;b.type=X.Link;c=new W;c.isPanelMain=!0;c.fill=null;c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);a.Ho=b}
Q.prototype.setRTL=function(a){a=void 0===a?this.div:a;null===a&&(a=x.document.body);var b=ta("div");b.dir="rtl";b.style.cssText="font-size: 14px; width: 1px; height: 1px; position: absolute; top: -1000px; overflow: scroll;";b.textContent="A";a.appendChild(b);var c="reverse";0<b.scrollLeft?c="default":(b.scrollLeft=1,0===b.scrollLeft&&(c="negative"));a.removeChild(b);this.Us=c};
Q.prototype.setScrollWidth=function(a){a=void 0===a?this.div:a;null===a&&(a=x.document.body);var b=0;if(Tg){var c=Mi;b=Ni;null===c&&(c=Mi=ta("p"),c.style.width="100%",c.style.height="200px",c.style.boxSizing="content-box",b=Ni=ta("div"),b.style.position="absolute",b.style.visibility="hidden",b.style.width="200px",b.style.height="150px",b.style.boxSizing="content-box",b.appendChild(c));b.style.overflow="hidden";a.appendChild(b);var d=c.offsetWidth;b.style.overflow="scroll";c=c.offsetWidth;d===c&&(c=
b.clientWidth);a.removeChild(b);b=d-c;0!==b||Xa||(b=11)}this.nb=b;this.pv=!0};Q.prototype.hb=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.La.iterator;c.next();)b+="\n  "+c.value.toString(a-1);return b};Q.prototype.addEventListener=function(a,b,c,d){a.addEventListener(b,c,{capture:d,passive:!1})};
Q.prototype.removeEventListener=function(a,b,c,d){a.removeEventListener(b,c,{capture:d})};
function Oi(a){var b=a.ta.Ga;b instanceof HTMLCanvasElement&&(a.ln?(a.addEventListener(b,"pointerdown",a.Em,!1),a.addEventListener(b,"pointermove",a.Fm,!1),a.addEventListener(b,"pointerup",a.Hm,!1),a.addEventListener(b,"pointerout",a.Gm,!1)):(a.addEventListener(b,"touchstart",a.Nw,!1),a.addEventListener(b,"touchmove",a.Mw,!1),a.addEventListener(b,"touchend",a.Lw,!1),a.addEventListener(b,"mousemove",a.Dk,!1),a.addEventListener(b,"mousedown",a.Ck,!1),a.addEventListener(b,"mouseup",a.Fk,!1),a.addEventListener(b,
"mouseout",a.Ek,!1)),a.addEventListener(b,"mouseenter",a.Jz,!1),a.addEventListener(b,"mouseleave",a.Kz,!1),a.addEventListener(b,"wheel",a.Gk,!1),a.addEventListener(b,"keydown",a.xA,!1),a.addEventListener(b,"keyup",a.yA,!1),a.addEventListener(b,"blur",a.vz,!1),a.addEventListener(b,"focus",a.wz,!1),a.addEventListener(b,"selectstart",function(a){a.preventDefault();return!1},!1),a.addEventListener(b,"contextmenu",function(a){a.preventDefault();return!1},!1),a.addEventListener(b,"gesturestart",function(b){a.toolManager.gestureBehavior!==
Oe&&(a.toolManager.gestureBehavior===Ne?b.preventDefault():a.ne&&a.lastInput.handled||(b.preventDefault(),a.Pl=a.scale,a.currentTool.doCancel()))},!1),a.addEventListener(b,"gesturechange",function(b){if(a.toolManager.gestureBehavior!==Oe)if(a.toolManager.gestureBehavior===Ne)b.preventDefault();else if(!a.ne||!a.lastInput.handled){b.preventDefault();var c=b.scale;if(null!==a.Pl){var e=a.ta.getBoundingClientRect();b=new J(b.pageX-x.scrollX-a.xa/e.width*e.left,b.pageY-x.scrollY-a.wa/e.height*e.top);
c=a.Pl*c;e=a.commandHandler;if(c!==a.scale&&e.canResetZoom(c)){var f=a.zoomPoint;a.zoomPoint=b;e.resetZoom(c);a.zoomPoint=f}}}},!1),a.addEventListener(x,"resize",a.Uw,!1))}function We(a){30<a.Zo&&(a.yh=1)}function kf(a,b){null!==a.yh&&(a.yh=null,b&&a.Zq(),eb&&eb.jy||(a.Zo=0,a.gv=[0,0,0,0,0],a.$o=0))}Q.prototype.computePixelRatio=function(){return null!==this.yh?this.yh: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.ta)if(this.scrollsPageOnFocus)this.ta.focus();else{var a=x.scrollX||x.pageXOffset,b=x.scrollY||x.pageYOffset;this.ta.focus();x.scrollTo(a,b)}};Q.prototype.wz=function(){this.B.R("GainedFocus")};
Q.prototype.vz=function(){this.B.R("LostFocus")};function Jh(a){if(null!==a.ta){var b=a.Ea;if(0!==b.clientWidth&&0!==b.clientHeight){a.pv||a.setScrollWidth();var c=a.Xe?a.nb:0,d=a.le?a.nb:0,e=a.Sb;a.Sb=a.computePixelRatio();a.Sb!==e&&(a.yl=!0,a.Db());if(b.clientWidth!==a.xa+c||b.clientHeight!==a.wa+d)a.vi=!0,a.Dc=!0,b=a.layout,null!==b&&b.isViewportSized&&a.autoScale===Ih&&(a.Ej=!0,b.C()),a.jc||a.Db()}}}
function xi(a){var b=new ii;b.name="Background";a.om(b);b=new ii;b.name="";a.om(b);b=new ii;b.name="Foreground";a.om(b);b=new ii;b.name="Adornment";b.isTemporary=!0;a.om(b);b=new ii;b.name="Tool";b.isTemporary=!0;b.isBoundsIncluded=!0;a.om(b);b=new ii;b.name="Grid";b.allowSelect=!1;b.pickable=!1;b.isTemporary=!0;a.Sx(b,a.tm("Background"))}
function Pi(a){a.Ib=new X(X.Grid);a.Ib.name="GRID";var b=new W;b.figure="LineH";b.stroke="lightgray";b.strokeWidth=.5;b.interval=1;a.Ib.add(b);b=new W;b.figure="LineH";b.stroke="gray";b.strokeWidth=.5;b.interval=5;a.Ib.add(b);b=new W;b.figure="LineH";b.stroke="gray";b.strokeWidth=1;b.interval=10;a.Ib.add(b);b=new W;b.figure="LineV";b.stroke="lightgray";b.strokeWidth=.5;b.interval=1;a.Ib.add(b);b=new W;b.figure="LineV";b.stroke="gray";b.strokeWidth=.5;b.interval=5;a.Ib.add(b);b=new W;b.figure="LineV";
b.stroke="gray";b.strokeWidth=1;b.interval=10;a.Ib.add(b);b=new U;b.add(a.Ib);b.layerName="Grid";b.zOrder=0;b.isInDocumentBounds=!1;b.isAnimated=!1;b.pickable=!1;b.locationObjectName="GRID";a.add(b);a.partManager.parts.remove(b);a.Ib.visible=!1}function Qi(){this.B.Xs?this.B.Xs=!1:this.B.isEnabled?this.B.ey(this):Ri(this.B)}function Si(a){this.B.isEnabled?(this.B.at=a.target.scrollTop,this.B.Zs=a.target.scrollLeft):Ri(this.B)}
Q.prototype.ey=function(a){if(null!==this.ta){this.Kp=!0;var b=this.documentBounds,c=this.viewportBounds,d=this.Si,e=b.x-d.left,f=b.y-d.top,g=b.width+d.left+d.right,h=b.height+d.top+d.bottom,k=b.right+d.right;d=b.bottom+d.bottom;var l=c.x;b=c.y;var m=c.width,n=c.height,p=c.right,r=c.bottom;c=this.scale;var q=a.scrollLeft;if(this.Al)switch(this.Us){case "negative":q=q+a.scrollWidth-a.clientWidth;break;case "reverse":q=a.scrollWidth-q-a.clientWidth}var u=q;m<g||n<h?(q=J.allocAt(this.position.x,this.position.y),
this.allowHorizontalScroll&&this.Zs!==u&&(q.x=u/c+e,this.Zs=u),this.allowVerticalScroll&&this.at!==a.scrollTop&&(q.y=a.scrollTop/c+f,this.at=a.scrollTop),this.position=q,J.free(q),this.vi=this.Kp=!1):(q=J.alloc(),a.dz&&this.allowHorizontalScroll&&(e<l&&(this.position=q.h(u+e,this.position.y)),k>p&&(this.position=q.h(-(this.$s.scrollWidth-this.xa)+u-this.xa/c+k,this.position.y))),a.ez&&this.allowVerticalScroll&&(f<b&&(this.position=q.h(this.position.x,a.scrollTop+f)),d>r&&(this.position=q.h(this.position.x,
-(this.$s.scrollHeight-this.wa)+a.scrollTop-this.wa/c+d))),J.free(q),Ti(this),this.vi=this.Kp=!1,b=this.documentBounds,c=this.viewportBounds,k=b.right,p=c.right,d=b.bottom,r=c.bottom,e=b.x,l=c.x,f=b.y,b=c.y,m>=g&&e>=l&&k<=p&&(this.Lp.style.width="1px"),n>=h&&f>=b&&d<=r&&(this.Lp.style.height="1px"))}};Q.prototype.computeBounds=function(){0<this.rd.count&&Ui(this);return Vi(this)};
function Vi(a){if(a.fixedBounds.u()){var b=a.fixedBounds.copy();b.sq(a.gb);return b}for(var c=!0,d=a.La.j,e=d.length,f=0;f<e;f++){var g=d[f];if(g.visible&&(!g.isTemporary||g.isBoundsIncluded)){g=g.Da.j;for(var h=g.length,k=0;k<h;k++){var l=g[k];l.isInDocumentBounds&&l.isVisible()&&(l=l.actualBounds,l.u()&&(c?(c=!1,b=l.copy()):b.Oc(l)))}}}c&&(b=new N(0,0,0,0));b.sq(a.gb);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 S||(e.Ta(),null===c?c=e.actualBounds.copy():c.Oc(e.actualBounds))}else for(a=a.iterator;a.next();)d=a.value,!b&&d instanceof S||(d.Ta(),null===c?c=d.actualBounds.copy():c.Oc(d.actualBounds));return null===c?new N(NaN,NaN,0,0):c};
function Wi(a,b){if((b||a.me)&&!a.Rb&&null!==a.ta&&a.documentBounds.u()){if(b){var c=a.initialPosition;if(c.u()){a.position=c;return}c=J.alloc();c.sj(a.documentBounds,a.initialDocumentSpot);var d=a.viewportBounds;d=N.allocAt(0,0,d.width,d.height);var e=J.alloc();e.sj(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)}a.Rb=!0;c=a.Og;b&&a.Yf!==Ih&&(c=a.Yf);d=c!==Ih?Xi(a,c):a.scale;c=a.viewportBounds.copy();e=a.xa/d;var f=a.wa/d,g=a.Aj,h=a.qo;b&&!g.ib()&&(h.ib()||
h.Mb())&&(g=h.Mb()?Bc:h);Yi(a,a.documentBounds,e,f,g,b);b=a.scale;a.scale=d;a.Rb=!1;d=a.viewportBounds;d.Na(c)||a.Vq(c,d,b,!1);Zi(a);$i(a,!0,!1)}}
function Xi(a,b){var c=a.Pn;if(null===a.ta)return c;a.Ta();var d=a.documentBounds;if(!d.u())return c;var e=d.width;d=d.height;var f=a.xa+(a.Xe?a.nb:0),g=a.wa+(a.le?a.nb:0),h=f/e,k=g/d;return b===aj?(b=Math.min(k,h),b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):b===bj?(b=k>h?(g-a.nb)/d:(f-a.nb)/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.Ti;this.Ti=Zh;this.scale=Xi(this,aj);a!==Zh&&(Wi(this,!1),Yi(this,this.documentBounds,this.xa/this.ya,this.wa/this.ya,this.Aj,!1));this.Ti=a};t=Q.prototype;
t.fB=function(a,b){void 0===b&&(b=aj);var c=a.width,d=a.height;if(!(0===c||0===d||isNaN(c)&&isNaN(d))){var e=1;if(b===aj||b===bj)if(isNaN(c))e=this.viewportBounds.height*this.scale/d;else if(isNaN(d))e=this.viewportBounds.width*this.scale/c;else{e=this.xa;var f=this.wa;e=b===bj?f/d>e/c?(f-(this.le?this.nb:0))/d:(e-(this.Xe?this.nb:0))/c:Math.min(f/d,e/c)}this.scale=e;this.position=new J(a.x,a.y)}};
t.oz=function(a,b){this.Ta();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.fA=function(a){if(a instanceof Y){this.$n=a;var b=J.alloc();this.ao=this.ir(a.ga(wc,b));J.free(b)}else this.$n=null,this.ao=Lb};
function Yi(a,b,c,d,e,f){var g=J.allocAt(a.la.x,a.la.y),h=g.x,k=g.y;if(null!==a.$n){var l=J.alloc();l=a.$n.ga(wc,l);h=l.x-a.ao.x/a.scale;k=l.y-a.ao.y/a.scale;e=vc;J.free(l)}if(f||a.scrollMode===Zh)e.ib()&&(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.Si,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.gb.left;g.y=isFinite(k)?k:-a.gb.top;null!==a.positionComputation&&(b=a.positionComputation(a,g),g.x=b.x,g.y=b.y);a.Rc.rc&&Sh(a.Rc,a.la,g);a.la.h(g.x,g.y);J.free(g)}
t.um=function(a,b){void 0===b&&(b=!0);if(b){if(a=wf(this,a,function(a){return a.part},function(a){return a.canSelect()}),a instanceof U)return a}else if(a=wf(this,a,function(a){return a.part}),a instanceof U)return a;return null};t.Ub=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);Ui(this);for(var d=this.La.iteratorBackwards;d.next();){var e=d.value;if(e.visible&&(e=e.Ub(a,b,c),null!==e))return e}return null};
function wf(a,b,c,d){void 0===c&&(c=null);void 0===d&&(d=null);Ui(a);for(a=a.La.iteratorBackwards;a.next();){var e=a.value;if(e.visible&&!e.isTemporary&&(e=e.Ub(b,c,d),null!==e))return e}return null}t.Uz=function(a,b,c){void 0===b&&(b=!0);return cj(this,a,function(a){return a.part},b?function(a){return a instanceof U&&a.canSelect()}:null,c)};
function cj(a,b,c,d,e){void 0===c&&(c=null);void 0===d&&(d=null);e instanceof E||e instanceof F||(e=new F);Ui(a);for(a=a.La.iteratorBackwards;a.next();){var f=a.value;f.visible&&!f.isTemporary&&f.hj(b,c,d,e)}return e}t.hj=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof E||d instanceof F||(d=new F);Ui(this);for(var e=this.La.iteratorBackwards;e.next();){var f=e.value;f.visible&&f.hj(a,b,c,d)}return d};
t.py=function(a,b,c,d){void 0===b&&(b=!1);void 0===c&&(c=!0);return dj(this,a,function(a){return a instanceof U&&(!c||a.canSelect())},b,d)};t.zf=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof E||e instanceof F||(e=new F);Ui(this);for(var f=this.La.iteratorBackwards;f.next();){var g=f.value;g.visible&&g.zf(a,b,c,d,e)}return e};
t.Uv=function(a,b,c,d,e,f){var g=new F;Ui(this);for(var h=this.La.iteratorBackwards;h.next();){var k=h.value;k.visible&&k.Uv(a,b,c,d,g,e,f)}return g};function dj(a,b,c,d,e){var f=null;void 0===f&&(f=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof E||e instanceof F||(e=new F);Ui(a);for(a=a.La.iteratorBackwards;a.next();){var g=a.value;g.visible&&!g.isTemporary&&g.zf(b,f,c,d,e)}return e}
t.Vz=function(a,b,c,d,e){void 0===c&&(c=!0);void 0===d&&(d=!0);return ej(this,a,b,function(a){return a instanceof U&&(!d||a.canSelect())},c,e)};t.Eg=function(a,b,c,d,e,f){void 0===c&&(c=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof E||e instanceof F)f=e;e=!0}f instanceof E||f instanceof F||(f=new F);Ui(this);for(var g=this.La.iteratorBackwards;g.next();){var h=g.value;h.visible&&h.Eg(a,b,c,d,e,f)}return f};
function ej(a,b,c,d,e,f){var g=null;void 0===g&&(g=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof E||e instanceof F)f=e;e=!0}f instanceof E||f instanceof F||(f=new F);Ui(a);for(a=a.La.iteratorBackwards;a.next();){var h=a.value;h.visible&&!h.isTemporary&&h.Eg(b,c,g,d,e,f)}return f}Q.prototype.acceptEvent=function(a){return fj(this,a,a instanceof MouseEvent)};
function fj(a,b,c){var d=a.Ud;a.Ud=a.gh;a.gh=d;d.diagram=a;d.event=b;c?gj(a,b,d):(d.viewPoint=a.Ud.viewPoint,d.documentPoint=a.Ud.documentPoint);a=0;b.ctrlKey&&(a+=1);b.altKey&&(a+=2);b.shiftKey&&(a+=4);b.metaKey&&(a+=8);d.modifiers=a;d.button=b.button;void 0===b.buttons||Sa||(d.buttons=b.buttons);Wa&&0===b.button&&b.ctrlKey&&(d.button=2);d.down=!1;d.up=!1;d.clickCount=1;d.delta=0;d.handled=!1;d.bubbles=!1;d.timestamp=b.timeStamp;d.isMultiTouch=!1;d.targetDiagram=hj(b);d.targetObject=null;return d}
function hj(a){var b=a.target.B;if(!b){var c=a.path;c||"function"!==typeof a.composedPath||(c=a.composedPath());c&&c[0]&&(b=c[0].B)}return b?b:null}function ij(a,b,c,d){var e=jj(a,b,!0,!1,!0,d);gj(a,c,e);e.targetDiagram=hj(b);e.targetObject=null;d||e.clone(a.Vf);return e}
function kj(a,b,c,d){var e;d=jj(a,b,!1,!1,!1,d);null!==c?((e=x.document.elementFromPoint(c.clientX,c.clientY))&&e.B?(b=c,c=e.B):(b=void 0!==b.targetTouches?b.targetTouches[0]:b,c=a),d.targetDiagram=c,gj(a,b,d)):null!==a.Ud?(d.documentPoint=a.Ud.documentPoint,d.viewPoint=a.Ud.viewPoint,d.targetDiagram=a.Ud.targetDiagram):null!==a.Vf&&(d.documentPoint=a.Vf.documentPoint,d.viewPoint=a.Vf.viewPoint,d.targetDiagram=a.Vf.targetDiagram);d.targetObject=null;return d}
function jj(a,b,c,d,e,f){var g=a.Ud;a.Ud=a.gh;a.gh=g;g.diagram=a;g.clickCount=1;var h=g.delta=0;b.ctrlKey&&(h+=1);b.altKey&&(h+=2);b.shiftKey&&(h+=4);b.metaKey&&(h+=8);g.modifiers=h;g.button=0;g.buttons=1;g.event=b;g.timestamp=b.timeStamp;a.ln&&b instanceof x.PointerEvent&&"touch"!==b.pointerType&&(g.button=b.button,void 0===b.buttons||Sa||(g.buttons=b.buttons),Wa&&0===b.button&&b.ctrlKey&&(g.button=2));g.down=c;g.up=d;g.handled=!1;g.bubbles=e;g.isMultiTouch=f;return g}
function lj(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.xA=function(a){var b=this.B;if(!this.B.isEnabled)return!1;var c=fj(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 lj(c,a)};
Q.prototype.yA=function(a){var b=this.B;if(!b.isEnabled)return!1;var c=fj(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 lj(c,a)};
Q.prototype.Jz=function(a){var b=this.B;if(!b.isEnabled)return!1;var c=fj(b,a,!0);null!==b.mouseEnter&&b.mouseEnter(c);return lj(c,a)};Q.prototype.Kz=function(a){var b=this.B;if(!b.isEnabled)return!1;var c=fj(b,a,!0);null!==b.mouseLeave&&b.mouseLeave(c);return lj(c,a)};
Q.prototype.getMouse=function(a){var b=this.ta;if(null===b)return new J(0,0);var c=b.getBoundingClientRect();b=a.clientX-this.xa/c.width*c.left;a=a.clientY-this.wa/c.height*c.top;return null!==this.ob?Bb(new J(b,a),this.ob):new J(b,a)};
function gj(a,b,c){var d=a.ta,e=a.xa,f=a.wa,g=0,h=0;null!==d&&(d=d.getBoundingClientRect(),g=b.clientX-e/d.width*d.left,h=b.clientY-f/d.height*d.top);c.viewPoint.h(g,h);null!==a.ob?(b=J.allocAt(g,h),a.ob.Zd(b),c.documentPoint.assign(b),J.free(b)):c.documentPoint.h(g,h)}
function se(a,b,c,d){if(void 0!==b.targetTouches){if(2>b.targetTouches.length)return;b=b.targetTouches[c]}else if(null!==a.Zj[0])b=a.Zj[c];else return;c=a.ta;null!==c&&(c=c.getBoundingClientRect(),d.h(b.clientX-a.xa/c.width*c.left,b.clientY-a.wa/c.height*c.top))}t=Q.prototype;t.Oa=function(){this.ui||(this.ui=!0,this.Db(!0))};function mj(a){a.jc||Ui(a);a.Ta()}t.Je=function(){this.Rb||this.jc||(this.M(),Zi(this),Ti(this),this.Oa(),this.cd())};t.wA=function(){return this.Ae};
t.Ez=function(a){void 0===a&&(a=null);var b=this.animationManager,c=b.isEnabled;b.Nc();b.isEnabled=!1;Jf(this);this.me=!1;this.Vs=new J(NaN,NaN);b.isEnabled=c;this.jc=!0;var d=this;null!==a&&sa(function(){d.jc=!1;Ch(b,"Model");a()},1)};t.Db=function(a){void 0===a&&(a=!1);if(!0!==this.Ae&&!(this.Rb||!1===a&&this.jc)){this.Ae=!0;var b=this;x.requestAnimationFrame(function(){b.Ae&&b.cd()})}};t.cd=function(){if(!this.Hj||this.Ae)this.Hj&&(this.Hj=!1),Jf(this)};
function $i(a,b,c){a.animationManager.defaultAnimation.isAnimating||a.Rb||!a.vi||Ri(a)||(b&&Ui(a),c&&Wi(a,!1))}
function Jf(a,b){if(!a.jc&&(a.Ae=!1,null!==a.Ea||a.mm.u())){a.jc=!0;var c=a.animationManager,d=a.Ns;if(!c.isAnimating&&0!==d.length){for(var e=d.j,f=e.length,g=0;g<f;g++){var h=e[g];nj(h,!1);h.o()}d.clear()}d=a.Ru;0<d.count&&(d.each(function(a){a.Tw()}),d.clear());e=d=!1;c.isAnimating&&(e=!0,d=a.skipsUndoManager,a.skipsUndoManager=!0);c.rc||Jh(a);$i(a,!1,!0);null!==a.Ib&&(a.Ib.visible&&!a.no&&(oj(a),a.no=!0),!a.Ib.visible&&a.no&&(a.no=!1));Ui(a);f=!1;if(!a.me||a.Ng)a.me?pj(a,!a.Ej):(a.va("Initial Layout"),
!1===c.isEnabled&&c.Nc(),pj(a,!1)),f=!0;a.Ej=!1;Ui(a);a.gt||mj(a);$i(a,!0,!1);g=!1;f?(c=N.alloc(),c.assign(a.viewportBounds),a.me||(g=a.me=!0,a.skipsUndoManager||(a.undoManager.isPendingClear=!0),a.undoManager.isPendingUnmodified=!0,qj(a)),a.R("LayoutCompleted"),c.w(a.viewportBounds)||$i(a,!0,!1),N.free(c)):c.tl&&c.Ox&&(a.Yf!==Ih?a.scale=Xi(a,a.Yf):a.Og!==Ih?a.scale=Xi(a,a.Og):(c=a.initialScale,isFinite(c)&&0<c&&(a.scale=c)),Wi(a,!0));Ui(a);f&&g&&a.Wa("Initial Layout");a.Gv();b||a.bc(a.Gb);e&&(a.skipsUndoManager=
d);a.jc=!1}}function qj(a){var b=a.ya;if(a.Yf!==Ih)a.scale=Xi(a,a.Yf);else if(a.Og!==Ih)a.scale=Xi(a,a.Og);else{var c=a.initialScale;isFinite(c)&&0<c&&(a.scale=c)}a.ya!==b&&(Zi(a),$i(a,!0,!1));Wi(a,!0);b=a.La.j;a.Fd(b,b.length,a);a.R("InitialLayoutCompleted");a.Vs.assign(a.la);oj(a)}
function Ui(a){if((a.jc||!a.animationManager.isTicking)&&0!==a.rd.count){for(var b=0;23>b;b++){var c=a.rd.iterator;if(null===c||0===a.rd.count)break;a.rd=new F;a.Tw(c,a.rd)}a.nodes.each(function(a){a instanceof vf&&0!==(a.P&65536)!==!1&&(a.P=a.P^65536)})}}
t.Tw=function(a,b){for(a.reset();a.next();){var c=a.value;!c.Wb()||c instanceof vf||(c.qj()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))}for(a.reset();a.next();)c=a.value,c instanceof vf&&c.isVisible()&&rj(this,c);for(a.reset();a.next();)c=a.value,c instanceof S&&c.isVisible()&&(c.qj()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c));for(a.reset();a.next();)c=a.value,c instanceof He&&c.isVisible()&&(c.qj()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))};
function rj(a,b){for(var c=Ea(),d=Ea(),e=b.memberParts;e.next();){var f=e.value;f.isVisible()&&(f instanceof vf?(sj(f)||tj(f)||uj(f))&&rj(a,f):f instanceof S?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();Ha(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();Ha(d)}
t.Fd=function(a,b,c,d){if(this.wi||this.animationManager.isAnimating){void 0===d&&(d=c.viewportBounds);for(var e=0;e<b;e++)a[e].Fd(c,d)}};
t.bc=function(a,b){void 0===b&&(b=null);if(null!==this.Ea){null===this.ta&&B("No canvas specified");var c=this.animationManager;if(!c.rc&&(!c.isAnimating||c.isTicking)){var d=new Date;vj(this);if("0"!==this.Ea.style.opacity){var e=a!==this.Gb,f=this.La.j,g=f.length,h=this;this.Fd(f,g,h);if(e)a.tc(!0),Ti(this);else if(!this.Dc&&null===b&&!c.isAnimating)return;g=this.la;var k=this.ya,l=Math.round(g.x*k)/k,m=Math.round(g.y*k)/k;c=this.ob;c.reset();1!==k&&c.scale(k);0===g.x&&0===g.y||c.translate(-l,-m);
k=this.Sb;a.setTransform(1,0,0,1,0,0);a.scale(k,k);a.clearRect(0,0,this.xa,this.wa);a.setTransform(1,0,0,1,0,0);a.scale(k,k);a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy);wj(this,a);a.globalAlpha=this.tb;l=null!==b?function(c){var d=b;if(c.visible&&0!==c.tb){var e=c.Da.j,f=e.length;if(0!==f){var g=ki(c,a),k=c.np;k.length=0;for(var l=h.scale,m=N.alloc(),n=0;n<f;n++){var A=e[n];d.contains(A)||c.dj(a,A,h,k,l,m,!0)}N.free(m);a.globalAlpha=g}}}:function(b){b.bc(a,h)};g=f.length;for(m=0;m<g;m++)a.setTransform(1,
0,0,1,0,0),a.scale(k,k),a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy),l(f[m]);this.ti&&xj(this.ti,this)&&this.Vr();e?(this.Gb.tc(!0),Ti(this)):this.Dc=this.wi=!1;f=+new Date-+d;e=eb&&eb.jy;d=this.gv;if(e||null===this.yh){d[this.$o]=f;this.$o=(this.$o+1)%d.length;for(c=f=0;c<d.length;c++)f+=d[c];this.Zo=f/d.length}if(e)for(a.setTransform(1,0,0,1,0,0),e=0;e<d.length;e++)a.fillText(d[e].toString(),20,150+ +(20*e))}}}};
function yj(a,b,c,d,e,f,g,h,k,l){if(null!==a.Ea){null===a.ta&&B("No canvas specified");void 0===g&&(g=null);void 0===h&&(h=null);void 0===k&&(k=!1);void 0===l&&(l=!1);vj(a);a.Gb.tc(!0);Ti(a);a.xi=!0;var m=a.ya;a.ya=e;var n=a.La.j,p=n.length;try{var r=new N(f.x,f.y,d.width/e,d.height/e),q=r.copy();q.sq(c);oj(a,q);Ui(a);a.Fd(n,p,a,r);b.setTransform(1,0,0,1,0,0);b.clearRect(0,0,d.width,d.height);null!==h&&""!==h&&(b.fillStyle=h,b.fillRect(0,0,d.width,d.height));var u=a.Sb;b.scale(u,u);var v=rd.alloc();
v.reset();v.translate(c.left,c.top);v.scale(e);0===f.x&&0===f.y||v.translate(-f.x,-f.y);b.setTransform(v.m11,v.m12,v.m21,v.m22,v.dx,v.dy);rd.free(v);wj(a,b);b.globalAlpha=a.tb;if(null!==g){var w=new F,y=g.iterator;for(y.reset();y.next();){var z=y.value;!1===l&&"Grid"===z.layer.name||null===z||w.add(z)}var A=function(c){if(c.visible&&0!==c.tb&&(k||!c.isTemporary)){var d=c.Da.j,e=d.length;if(0!==e){var f=ki(c,b),g=c.np;g.length=0;for(var h=a.scale,l=N.alloc(),m=0;m<e;m++){var n=d[m];w.contains(n)&&
c.dj(b,n,a,g,h,l,!1)}N.free(l);b.globalAlpha=f}}}}else if(!k&&l){var C=a.grid.part,G=C.layer;A=function(c){c===G?C.bc(b,a):c.bc(b,a,k)}}else A=function(c){c.bc(b,a,k)};for(c=0;c<p;c++)A(n[c]);a.xi=!1;a.ti&&xj(a.ti,a)&&a.Vr()}finally{a.ya=m,a.Gb.tc(!0),Ti(a),a.Fd(n,p,a),oj(a)}}}t.Ge=function(a){return this.gf[a]};t.Qy=function(a,b){"minDrawingLength"===a&&(this.To=b);this.gf[a]=b;this.Je()};
t.ww=function(){this.gf=new ab;this.gf.drawShadows=!0;this.gf.textGreeking=!0;this.gf.viewportOptimizations=Xa||Ta||Ua?!1:!0;this.gf.temporaryPixelRatio=!0;this.gf.pictureRatioOptimization=!0;this.To=this.gf.minDrawingLength=1};function wj(a,b){a=a.gf;null!==a&&(void 0!==a.imageSmoothingEnabled&&b.Py(!!a.imageSmoothingEnabled),a=a.defaultFont,void 0!==a&&null!==a&&(b.font=a))}t.xm=function(a){return this.Kj[a]};t.UA=function(a,b){this.Kj[a]=b};
t.vw=function(){this.Kj=new ab;this.Kj.extraTouchArea=10;this.Kj.extraTouchThreshold=10;this.Kj.hasGestureZoom=!0};t.Ew=function(a){zj(this,a)};
function zj(a,b){var c=a instanceof X,d=a instanceof Q,e;for(e in b){""===e&&B("Setting properties requires non-empty property names");var f=a,g=e;if(c||d){var h=e.indexOf(".");if(0<h){var k=e.substring(0,h);if(c)f=a.$a(k);else if(f=a[k],void 0===f||null===f)f=a.toolManager[k];ya(f)?g=e.substr(h+1):B("Unable to find object named: "+k+" in "+a.toString()+" when trying to set property: "+e)}}if("_"!==g[0]&&!Ka(f,g))if(d&&"ModelChanged"===g){a.Vx(b[g]);continue}else if(d&&"Changed"===g){a.Hh(b[g]);continue}else if(d&&
Ka(a.toolManager,g))f=a.toolManager;else if(d&&Aj(a,g)){a.hk(g,b[g]);continue}else if(a instanceof Z&&"Changed"===g){a.Hh(b[g]);continue}else B('Trying to set undefined property "'+g+'" on object: '+f.toString());f[g]=b[e];"_"===g[0]&&f instanceof Y&&f.Rx(g)}}t.Gv=function(){if(0===this.undoManager.transactionLevel&&0!==this.Vg.count){for(;0<this.Vg.count;){var a=this.Vg;this.Vg=new H;for(a=a.iterator;a.next();){var b=a.key;b.Nq(a.value);b.cc()}}this.M()}};
t.M=function(a){void 0===a&&(a=null);if(null===a)this.Dc=!0,this.Db();else{var b=this.viewportBounds;null!==a&&a.u()&&b.Lc(a)&&(this.Dc=!0,this.Db())}this.R("InvalidateDraw")};
t.By=function(a,b){if(!0!==this.Dc){this.Dc=!0;var c=!0===this.Ge("temporaryPixelRatio");if(!0===this.Ge("viewportOptimizations")&&this.scrollMode!==ai&&this.Si.fj(0,0,0,0)&&b.width===a.width&&b.height===a.height){var d=this.scale,e=Math.max(a.x,b.x),f=Math.max(a.y,b.y);d=N.allocAt(e,f,Math.max(0,Math.min(a.x+a.width,b.x+b.width)-e)*d,Math.max(0,Math.min(a.y+a.height,b.y+b.height)-f)*d);if(!this.eq&&0<d.width&&0<d.height){if(!(this.jc||(this.Ae=!1,null===this.Ea||(this.jc=!0,this.Gv(),this.documentBounds.u()||
Bj(this,this.computeBounds()),e=this.ta,null===e||e instanceof Cj)))){var g=this.Sb;f=this.xa*g;var h=this.wa*g,k=this.scale*g,l=Math.round(Math.round(b.x*k)-Math.round(a.x*k));b=Math.round(Math.round(b.y*k)-Math.round(a.y*k));k=this.Iu;a=this.qx;k.width!==f&&(k.width=f);k.height!==h&&(k.height=h);a.clearRect(0,0,f,h);k=190*g;var m=70*g,n=Math.max(l,0),p=Math.max(b,0),r=Math.floor(f-n),q=Math.floor(h-p);a.drawImage(e.Ga,n,p,r,q,0,0,r,q);xj(this.ti,this)&&a.clearRect(0,0,k,m);e=Ea();a=Ea();q=Math.abs(l);
r=Math.abs(b);var u=0===n?0:f-q;n=J.allocAt(u,0);q=J.allocAt(q+u,h);a.push(new N(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));var v=this.ob;v.reset();v.scale(g,g);1!==this.ya&&v.scale(this.ya);g=this.la;(0!==g.x||0!==g.y)&&isFinite(g.x)&&isFinite(g.y)&&v.translate(-g.x,-g.y);Bb(n,v);Bb(q,v);e.push(new N(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));u=0===p?0:h-r;n.h(0,u);q.h(f,r+u);a.push(new N(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-
q.x),Math.abs(n.y-q.y)));Bb(n,v);Bb(q,v);e.push(new N(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));xj(this.ti,this)&&(f=0<l?0:-l,h=0<b?0:-b,n.h(f,h),q.h(k+f,m+h),a.push(new N(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y))),Bb(n,v),Bb(q,v),e.push(new N(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y))));J.free(n);J.free(q);$i(this,!1,!0);null===this.Ea&&B("No div specified");null===this.ta&&B("No canvas specified");if(!this.animationManager.rc&&
(f=this.Gb,this.Dc)){vj(this);h=this.Sb;f.setTransform(1,0,0,1,0,0);f.clearRect(0,0,this.xa*h,this.wa*h);f.drawImage(this.Iu.Ga,0<l?0:Math.round(-l),0<b?0:Math.round(-b));l=this.la;g=this.ya;k=Math.round(l.x*g)/g;m=Math.round(l.y*g)/g;b=this.ob;b.reset();1!==g&&b.scale(g);0===l.x&&0===l.y||b.translate(-k,-m);f.save();f.beginPath();l=a.length;for(g=0;g<l;g++)k=a[g],0!==k.width&&0!==k.height&&f.rect(Math.floor(k.x),Math.floor(k.y),Math.ceil(k.width),Math.ceil(k.height));f.clip();f.setTransform(1,0,
0,1,0,0);f.scale(h,h);f.transform(b.m11,b.m12,b.m21,b.m22,b.dx,b.dy);b=this.La.j;l=b.length;this.Fd(b,l,this);wj(this,f);f.globalAlpha=this.tb;for(h=0;h<l;h++)if(g=b[h],k=e,g.visible&&0!==g.tb){m=ki(g,f);p=g.np;p.length=0;n=this.scale;r=N.alloc();q=g.Da.j;v=q.length;u=k.length;for(var w=0;w<v;w++){var y=q[w],z=Dj(y,y.actualBounds);a:{for(var A=2/n,C=4/n,G=0;G<u;G++){var L=k[G];if(0!==L.width&&0!==L.height&&z.bw(L.x-A,L.y-A,L.width+C,L.height+C)){z=!0;break a}}z=!1}z&&g.dj(f,y,this,p,n,r,!0)}N.free(r);
f.globalAlpha=m}f.restore();f.tc(!0);this.ti&&xj(this.ti,this)&&this.Vr();this.Dc=this.wi=!1;this.Zq()}Ha(e);Ha(a);this.jc=!1}}else this.cd();N.free(d);c&&(We(this),this.cd(),kf(this,!0))}else c?(We(this),this.cd(),kf(this,!0)):this.cd()}};function Zi(a){!1===a.vi&&(a.vi=!0)}function Ti(a){!1===a.wi&&(a.wi=!0)}function vj(a){!1!==a.yl&&(a.yl=!1,Ej(a,a.xa,a.wa))}function Ej(a,b,c){var d=a.Sb;a.ta.resize(b*d,c*d,b,c)&&(a.Dc=!0,a.Gb.tc(!0))}
function Ri(a){var b=a.ta;if(null===b)return!0;var c=a.Ea,d=a.xa,e=a.wa,f=a.viewportBounds.copy();if(!f.u())return!0;var g=!1,h=a.Xe?a.nb:0,k=a.le?a.nb:0,l=c.clientWidth||d+h,m=c.clientHeight||e+k;if(l!==d+h||m!==e+k)a.Xe=!1,a.le=!1,k=h=0,a.xa=l,a.wa=m,g=a.yl=!0;if(!(g||a.Xe||a.le||a.pl||a.ql))return!0;a.vi=!1;var n=a.viewportBounds,p=a.documentBounds,r=0,q=0,u=0,v=0;c=n.width;var w=n.height,y=a.Si;a.contentAlignment.ib()?(p.width>c&&(r=y.left,q=y.right),p.height>w&&(u=y.top,v=y.bottom)):(r=y.left,
q=y.right,u=y.top,v=y.bottom);y=p.width+r+q;var z=p.height+u+v;r=p.x-r;var A=n.x;q=p.right+q;var C=n.right+h;u=p.y-u;var G=n.y;p=p.bottom+v;n=n.bottom+k;var L="1px",I="1px";v=a.scale;l=y>l/v;m=z>m/v;a.scrollMode===Zh&&(l||m)&&(l&&a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(l=1,r+1<A&&(l=Math.max((A-r)*v+a.xa,l)),q>C+1&&(l=Math.max((q-C)*v+a.xa,l)),c+h+1<y&&(l=Math.max((y-c)*v+a.xa,l)),L=l.toString()+"px"),m&&a.hasVerticalScrollbar&&a.allowVerticalScroll&&(l=1,u+1<G&&(l=Math.max((G-u)*v+a.wa,
l)),p>n+1&&(l=Math.max((p-n)*v+a.wa,l)),w+k+1<z&&(l=Math.max((z-w)*v+a.wa,l)),I=l.toString()+"px"));l="1px"!==L;m="1px"!==I;l&&m||!l&&!m||(m&&(C-=a.nb),l&&(n-=a.nb),y<c+h||!a.hasHorizontalScrollbar||!a.allowHorizontalScroll||(h=1,r+1<A&&(h=Math.max((A-r)*v+a.xa,h)),q>C+1&&(h=Math.max((q-C)*v+a.xa,h)),c+1<y&&(h=Math.max((y-c)*v+a.xa,h)),L=h.toString()+"px"),l="1px"!==L,h=a.wa,l!==a.le&&(h=l?a.wa-a.nb:a.wa+a.nb),z<w+k||!a.hasVerticalScrollbar||!a.allowVerticalScroll||(k=1,u+1<G&&(k=Math.max((G-u)*v+
h,k)),p>n+1&&(k=Math.max((p-n)*v+h,k)),w+1<z&&(k=Math.max((z-w)*v+h,k)),I=k.toString()+"px"),m="1px"!==I);if(a.Kp&&l===a.le&&m===a.Xe)return d===a.xa&&e===a.wa||a.cd(),!1;l!==a.le&&("1px"===L?a.wa=a.wa+a.nb:a.wa=Math.max(a.wa-a.nb,1),g=!0);a.le=l;a.Lp.style.width=L;m!==a.Xe&&("1px"===I?a.xa=a.xa+a.nb:a.xa=Math.max(a.xa-a.nb,1),g=!0,a.Al&&(k=J.alloc(),m?(b.style.left=a.nb+"px",a.position=k.h(a.la.x+a.nb/a.scale,a.la.y)):(b.style.left="0px",a.position=k.h(a.la.x-a.nb/a.scale,a.la.y)),J.free(k)));a.Xe=
m;a.Lp.style.height=I;a.Xs=!0;g&&(a.yl=!0);b=a.$s;k=b.scrollLeft;a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(c+1<y?k=(a.position.x-r)*v:r+1<A?k=b.scrollWidth-b.clientWidth:q>C+1&&(k=a.position.x*v));if(a.Al)switch(a.Us){case "negative":k=-(b.scrollWidth-k-b.clientWidth);break;case "reverse":k=b.scrollWidth-k-b.clientWidth}b.scrollLeft=k;a.hasVerticalScrollbar&&a.allowVerticalScroll&&(w+1<z?b.scrollTop=(a.position.y-u)*v:u+1<G?b.scrollTop=b.scrollHeight-b.clientHeight:p>n+1&&(b.scrollTop=a.position.y*
v));l=a.xa;m=a.wa;b.style.width=l+(a.Xe?a.nb:0)+"px";b.style.height=m+(a.le?a.nb:0)+"px";return d!==l||e!==m||a.animationManager.rc?(a.Vq(f,a.viewportBounds,v,g),!1):!0}
t.add=function(a){var b=a.diagram;if(b!==this&&(null!==b&&B("Cannot add part "+a.toString()+" to "+this.toString()+". It is already a part of "+b.toString()),b=this.tm(a.layerName),null===b&&(b=this.tm("")),null===b&&B('Cannot add a Part when unable find a Layer named "'+a.layerName+'" and there is no default Layer'),a.layer!==b)){var c=b.nj(99999999,a,a.diagram===this);0<=c&&this.ab(xe,"parts",b,null,a,null,c);b.isTemporary||this.Oa();a.C(1);c=a.layerChanged;null!==c&&c(a,null,b)}};
t.nj=function(a){this.partManager.nj(a);var b=this;Fj(a,function(a){Gj(b,a)});(a instanceof He||a instanceof vf&&null!==a.placeholder)&&a.o();null!==a.data&&Fj(a,function(a){Hj(b.partManager,a)});!0!==tj(a)&&!0!==uj(a)||this.rd.add(a);Ij(a,!0,this);Jj(a)?(a.actualBounds.u()&&this.M(Dj(a,a.actualBounds)),this.Oa()):a.isVisible()&&a.actualBounds.u()&&this.M(Dj(a,a.actualBounds));this.Db()};
t.Kc=function(a){a.kk();this.partManager.Kc(a);var b=this;null!==a.data&&Fj(a,function(a){Kj(b.partManager,a,b)});this.rd.remove(a);Jj(a)?(a.actualBounds.u()&&this.M(Dj(a,a.actualBounds)),this.Oa()):a.isVisible()&&a.actualBounds.u()&&this.M(Dj(a,a.actualBounds));this.Db()};t.remove=function(a){Lj(this,a,!0)};
function Lj(a,b,c){var d=b.layer;null!==d&&d.diagram===a&&(b.isSelected=!1,b.isHighlighted=!1,b.C(2),c&&b.rk(),c=d.Kc(-1,b,!1),0<=c&&a.ab(ye,"parts",d,b,null,c,null),a=b.layerChanged,null!==a&&a(b,d,null))}t.gu=function(a,b){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 F,c.addAll(a),a=c.iterator;a.next();)c=a.value,b&&!c.canDelete()||this.remove(c)};t.qk=function(a,b,c){return this.partManager.qk(a,b,c)};
Q.prototype.moveParts=function(a,b,c,d){void 0===d&&(d=Mj(this));if(null!==this.toolManager){var e=new H;if(null!==a)if(Aa(a))for(var f=0;f<a.length;f++)Nj(this,e,a[f],c,d);else for(a=a.iterator;a.next();)Nj(this,e,a.value,c,d);else{for(a=this.parts;a.next();)Nj(this,e,a.value,c,d);for(a=this.nodes;a.next();)Nj(this,e,a.value,c,d);for(a=this.links;a.next();)Nj(this,e,a.value,c,d)}sf(this,e,b,d,c)}};
function Nj(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=Mj(a)),c instanceof V){b.add(c,a.xd(e,c,c.location));if(c instanceof vf&&(null!==c.placeholder||e.dragsMembers))for(f=c.memberParts;f.next();)Nj(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)&&Nj(a,b,g,d,e)}}if(e.dragsTree)for(c=c.Vv();c.next();)Nj(a,b,
c.value,d,e)}else if(c instanceof S)for(b.add(c,a.xd(e,c)),c=c.labelNodes;c.next();)Nj(a,b,c.value,d,e);else c instanceof He||b.add(c,a.xd(e,c,c.location))}
function sf(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.cq)||Xe(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.Wb()){var r=Oj(a,n,b);if(null!==r)h.push(new Pj(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.ce(r))}else l.key instanceof S&&k.push(l.ka)}J.free(m);e=h.length;for(l=
0;l<e;l++)n=h[l],f.assign(n.info.point),void 0===n.Zv.shifted&&(n.Zv.shifted=new J),n.node.location=f.add(n.Zv.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 S)if(r.suspendsRouting){r.qg=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.xd(d,r,g)),qf(r,g.x-u.x,g.y-u.y);else{q=J.allocAt(0,0);(m=r.i(0))&&m.u()&&q.assign(m);var v=m=J.alloc().assign(q).add(g);d.isGridSnapEnabled&&
(d.isGridSnapRealtime||a.lastInput.up)&&(v=J.alloc(),Fg(a,r,m,v,d));m.assign(r.dragComputation(r,m,v)).ce(q);b.add(r,a.xd(d,r,m));qf(r,m.x-u.x,m.y-u.y);J.free(q);J.free(m);v!==m&&J.free(v)}else null!==m&&(e.assign(m.location),v=b.H(m),null!==v&&e.ce(v.point)),null!==u&&(l.assign(u.location),v=b.H(u),null!==v&&l.ce(v.point)),null!==m&&null!==u?e.Na(l)?(m=q.value.point,u=f,u.assign(e),u.ce(m),b.add(r,a.xd(d,r,e)),qf(r,u.x,u.y)):(r.suspendsRouting=!1,r.Ua()):(q=q.value.point,m=null!==m?e:null!==u?l:
g,b.add(r,a.xd(d,r,m)),qf(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.xd(d,r,g)),qf(r,g.x-m.x,g.y-m.y)}J.free(f);J.free(g);J.free(e);J.free(l);Ha(h);Ha(k);c||(Ui(a),ff(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(),Fg(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 Mj(a){var b=a.toolManager.findTool("Dragging");return null!==b?b.dragOptions:a.dl}
function Fg(a,b,c,d,e){void 0===e&&(e=Mj(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.Lk(0,0,a,b,e);K.Eq(c.x,c.y,h+f.x,g+f.y,a,b,d);J.free(f)}}function Xe(a,b){if(null!==b)for(a.cq=!0,a=b.iterator;a.next();)b=a.key,b instanceof S&&(b.suspendsRouting=!0)}
function ff(a,b){if(null!==b){for(b=b.iterator;b.next();){var c=b.key;c instanceof S&&(c.suspendsRouting=!1,Qj(c)&&c.Ua())}a.cq=!1}}function Oj(a,b,c){b=b.containingGroup;if(null!==b){a=Oj(a,b,c);if(null!==a)return a;a=c.H(b);if(null!==a)return a}return null}t=Q.prototype;t.xd=function(a,b,c){if(void 0===c)return new $e(Hb);var d=a.isGridSnapEnabled;a.groupsSnapMembers||null===b.containingGroup||(d=!1);return d?new $e(new J(Math.round(1E3*c.x)/1E3,Math.round(1E3*c.y)/1E3)):new $e(c.copy())};
function Rj(a,b,c){null!==b.diagram&&b.diagram!==a&&B("Cannot share a Layer with another Diagram: "+b+" of "+b.diagram);null===c?null!==b.diagram&&B("Cannot add an existing Layer to this Diagram again: "+b):(c.diagram!==a&&B("Existing Layer must be in this Diagram: "+c+" not in "+c.diagram),b===c&&B("Cannot move a Layer before or after itself: "+b));if(b.diagram!==a){b=b.name;a=a.La;c=a.count;for(var d=0;d<c;d++)a.L(d).name===b&&B("Cannot add Layer with the name '"+b+"'; a Layer with the same name is already present in this Diagram.")}}
t.om=function(a){Rj(this,a,null);a.ae(this);var b=this.La,c=b.count-1;if(!a.isTemporary)for(;0<=c&&b.L(c).isTemporary;)c--;b.vb(c+1,a);null!==this.ac&&this.ab(xe,"layers",this,null,a,null,c+1);this.M();this.Oa()};t.Sx=function(a,b){Rj(this,a,b);a.ae(this);var c=this.La,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.ac&&this.ab(ye,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.L(f)===b){c.vb(f,a);break}null!==this.ac&&this.ab(xe,"layers",this,null,a,null,f);this.M();0>d&&this.Oa()};
t.jz=function(a,b){Rj(this,a,b);a.ae(this);var c=this.La,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.ac&&this.ab(ye,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.L(f)===b){c.vb(f+1,a);break}null!==this.ac&&this.ab(xe,"layers",this,null,a,null,f+1);this.M();0>d&&this.Oa()};
t.NA=function(a){a.diagram!==this&&B("Cannot remove a Layer from another Diagram: "+a+" of "+a.diagram);if(""!==a.name){var b=this.La,c=b.indexOf(a);if(b.remove(a)){for(b=a.Da.copy().iterator;b.next();){var d=b.value,e=d.layerName;e!==a.name?d.layerName=e:d.layerName=""}null!==this.ac&&this.ab(ye,"layers",this,a,null,c,null);this.M();this.Oa()}}};t.tm=function(a){for(var b=this.layers;b.next();){var c=b.value;if(c.name===a)return c}return null};
t.Vx=function(a){null===this.se&&(this.se=new E);this.se.add(a);this.model.Hh(a)};t.PA=function(a){null!==this.se&&(this.se.remove(a),0===this.se.count&&(this.se=null));this.model.Kk(a)};t.Hh=function(a){null===this.Nf&&(this.Nf=new E);this.Nf.add(a)};t.Kk=function(a){null!==this.Nf&&(this.Nf.remove(a),0===this.Nf.count&&(this.Nf=null))};
t.zt=function(a){this.skipsUndoManager||this.model.skipsUndoManager||this.model.undoManager.$v(a);a.change!==we&&(this.isModified=!0);if(null!==this.Nf)for(var b=this.Nf,c=b.length,d=0;d<c;d++)b.L(d)(a)};t.ab=function(a,b,c,d,e,f,g){void 0===f&&(f=null);void 0===g&&(g=null);var h=new ue;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.zt(h)};t.g=function(a,b,c,d,e){this.ab(ve,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===ve){var e=a.object;Sj(e,a.propertyName,a.H(b));if(e instanceof Y){var f=e.part;null!==f&&f.Lb()}this.isModified=!0}else if(d===xe){var g=a.object,h=a.newParam,k=a.newValue;if(g instanceof X)if("number"===typeof h&&k instanceof Y){b?g.Kc(h):g.vb(h,k);var l=g.part;null!==l&&l.Lb()}else{if("number"===typeof h&&k instanceof Tj)if(b)k.isRow?
g.tw(h):g.rw(h);else{var m=k.isRow?g.getRowDefinition(k.index):g.getColumnDefinition(k.index);m.Dt(k)}}else if(g instanceof ii){var n=!0===a.oldParam;"number"===typeof h&&k instanceof U&&(b?(k.isSelected=!1,k.isHighlighted=!1,k.Lb(),g.Kc(n?h:-1,k,n)):g.nj(h,k,n))}else g instanceof Q?"number"===typeof h&&k instanceof ii&&(b?this.La.bb(h):(k.ae(this),this.La.vb(h,k))):B("unknown ChangedEvent.Insert object: "+a.toString());this.isModified=!0}else if(d===ye){var p=a.object,r=a.oldParam,q=a.oldValue;if(p instanceof
X)"number"===typeof r&&q instanceof Y?b?p.vb(r,q):p.Kc(r):"number"===typeof r&&q instanceof Tj&&(b?(m=q.isRow?p.getRowDefinition(q.index):p.getColumnDefinition(q.index),m.Dt(q)):q.isRow?p.tw(r):p.rw(r));else if(p instanceof ii){var u=!0===a.newParam;"number"===typeof r&&q instanceof U&&(b?0>p.Da.indexOf(q)&&p.nj(r,q,u):(q.isSelected=!1,q.isHighlighted=!1,q.Lb(),p.Kc(u?r:-1,q,u)))}else p instanceof Q?"number"===typeof r&&q instanceof ii&&(b?(q.ae(this),this.La.vb(r,q)):this.La.bb(r)):B("unknown ChangedEvent.Remove object: "+
a.toString());this.isModified=!0}else d!==we&&B("unknown ChangedEvent: "+a.toString())}finally{this.skipsModelSourceBindings=c}}};Q.prototype.va=function(a){return this.undoManager.va(a)};Q.prototype.Wa=function(a){return this.undoManager.Wa(a)};Q.prototype.Hf=function(){return this.undoManager.Hf()};
Q.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.va(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.Wa(b):this.undoManager.Hf(),this.skipsUndoManager=c}};Q.prototype.updateAllTargetBindings=function(a){this.partManager.updateAllTargetBindings(a)};Q.prototype.kr=function(){this.partManager.kr()};
function Uj(a,b,c){var d=a.animationManager;if(a.Rb||a.jc)a.ya=c,d.df&&d.Jd.add(d.B,"scale",b,a.ya);else if(null===a.ta)a.ya=c;else{a.Rb=!0;var e=a.viewportBounds.copy(),f=a.xa,g=a.wa;e.width=a.xa/b;e.height=a.wa/b;var h=a.zoomPoint.x,k=a.zoomPoint.y,l=a.contentAlignment;isNaN(h)&&(l.Mc()?l.Df(Jc)?h=0:l.Df(Kc)&&(h=f-1):h=l.ib()?l.x*(f-1):f/2);isNaN(k)&&(l.Mc()?l.Df(Ic)?k=0:l.Df(Lc)&&(k=g-1):k=l.ib()?l.y*(g-1):g/2);null===a.scaleComputation||a.animationManager.isAnimating||(c=a.scaleComputation(a,
c));c<a.minScale&&(c=a.minScale);c>a.maxScale&&(c=a.maxScale);f=J.allocAt(a.la.x+h/b-h/c,a.la.y+k/b-k/c);a.position=f;J.free(f);a.ya=c;a.Vq(e,a.viewportBounds,b,!1);a.Rb=!1;Wi(a,!1);d.df&&d.Jd.add(d.B,"scale",b,a.ya);a.M();Zi(a)}}
Q.prototype.Vq=function(a,b,c,d){if(!a.w(b)){void 0===d&&(d=!1);d||Zi(this);Ti(this);var e=this.layout;null===e||!e.isViewportSized||this.autoScale!==Ih||d||a.width===b.width&&a.height===b.height||e.C();e=this.currentTool;!0===this.Zf&&e instanceof Oa&&(this.lastInput.documentPoint=this.nu(this.lastInput.viewPoint),Pe(e,this));this.Rb||this.By(a,b);oj(this);this.Vd.scale=c;this.Vd.position.x=a.x;this.Vd.position.y=a.y;this.Vd.bounds.assign(a);this.Vd.gw=d;this.R("ViewportBoundsChanged",this.Vd,a);
this.isVirtualized&&this.links.each(function(a){a.isAvoiding&&a.actualBounds.Lc(b)&&a.Ua()})}};
function oj(a,b){void 0===b&&(b=null);var c=a.Ib;if(null!==c&&c.visible){for(var d=M.alloc(),e=1,f=1,g=c.W.j,h=g.length,k=0;k<h;k++){var l=g[k],m=l.interval;2>m||(Vj(l.figure)?f=f*m/K.qy(f,m):e=e*m/K.qy(e,m))}g=c.gridCellSize;d.h(f*g.width,e*g.height);if(null!==b)e=b.width,f=b.height,a=b.x,g=b.y;else{b=N.alloc();a=a.viewportBounds;b.h(a.x,a.y,a.width,a.height);if(!b.u()){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.Eq(a,g,0,0,
d.width,d.height,b);b.offset(-d.width,-d.height);M.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.ma(),d=c.length,e=0;e<d;e++)c[e].isSelected=!1;b.ea();b.clear();b.freeze();a||this.R("ChangedSelection",b)}};
Q.prototype.select=function(a){null!==a&&a.layer.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.TA=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||B("Diagram.selectCollection given something that is not a Part: "+d);d.isSelected=!0}else for(a=a.iterator;a.next();)b=a.value,b instanceof U||B("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.ma(),c=b.length,d=0;d<c;d++)b[d].isHighlighted=!1;a.ea();a.clear();a.freeze()}};t=Q.prototype;t.pA=function(a){null!==a&&a.layer.diagram===this&&(!a.isHighlighted||1<this.highlighteds.count)&&(this.clearHighlighteds(),a.isHighlighted=!0)};
t.qA=function(a){a=(new F).addAll(a);for(var b=this.highlighteds.copy().$q(a).iterator;b.next();)b.value.isHighlighted=!1;for(a=a.iterator;a.next();)b=a.value,b instanceof U||B("Diagram.highlightCollection given something that is not a Part: "+b),b.isHighlighted=!0};
t.scroll=function(a,b,c){void 0===c&&(c=1);var d="up"===b||"down"===b,e=0;if("pixel"===a)e=c;else if("line"===a)e=c*(d?this.scrollVerticalLineChange:this.scrollHorizontalLineChange);else if("page"===a)a=d?this.viewportBounds.height:this.viewportBounds.width,a*=this.scale,0!==a&&(e=c*Math.max(a-(d?this.scrollVerticalLineChange:this.scrollHorizontalLineChange),0));else{if("document"===a){e=this.documentBounds;c=this.viewportBounds;d=J.alloc();"up"===b?this.position=d.h(c.x,e.y):"left"===b?this.position=
d.h(e.x,c.y):"down"===b?this.position=d.h(c.x,e.bottom-c.height):"right"===b&&(this.position=d.h(e.right-c.width,c.y));J.free(d);return}B("scrolling unit must be 'pixel', 'line', 'page', or 'document', not: "+a)}e/=this.scale;c=this.position.copy();"up"===b?c.y=this.position.y-e:"down"===b?c.y=this.position.y+e:"left"===b?c.x=this.position.x-e:"right"===b?c.x=this.position.x+e:B("scrolling direction must be 'up', 'down', 'left', or 'right', not: "+b);this.position=c};
t.zw=function(a){var b=this.viewportBounds;b.De(a)||(a=a.center,a.x-=b.width/2,a.y-=b.height/2,this.position=a)};t.At=function(a){var b=this.viewportBounds;a=a.center;a.x-=b.width/2;a.y-=b.height/2;this.position=a};t.ir=function(a){var b=this.ob;b.reset();1!==this.ya&&b.scale(this.ya);var c=this.la;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return a.copy().transform(this.ob)};
t.bB=function(a){var b=this.ob,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.nu=function(a){var b=this.ob;b.reset();1!==this.ya&&b.scale(this.ya);var c=this.la;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return Bb(a.copy(),this.ob)};function Wj(a){var b=a.isModified;a.zv!==b&&(a.zv=b,a.R("Modified"))}function Xj(a){a=si.get(a);return null!==a?new a:new ti}
Q.prototype.doModelChanged=function(a){var b=this;if(a.model===this.model){var c=a.change,d=a.propertyName;if(c===we&&"S"===d[0])if("StartingFirstTransaction"===d){var e=this;a=this.toolManager;a.mouseDownTools.each(function(a){a.diagram=e});a.mouseMoveTools.each(function(a){a.diagram=e});a.mouseUpTools.each(function(a){a.diagram=e});this.jc||this.me||(this.Ej=!0,this.Hj&&(this.Ae=!0))}else"StartingUndo"===d||"StartingRedo"===d?(a=this.animationManager,a.defaultAnimation.isAnimating&&!this.skipsUndoManager&&
a.Nc(),this.R("ChangingSelection",this.selection)):"StartedTransaction"===d&&(a=this.animationManager,a.defaultAnimation.isAnimating&&!this.skipsUndoManager&&a.Nc());else if(this.Z){this.Z=!1;try{if(""===a.modelChange&&c===we){if("FinishedUndo"===d||"FinishedRedo"===d)this.R("ChangedSelection",this.selection),Ui(this);var f=this.animationManager;"RolledBackTransaction"===d&&f.Nc();this.Ej=!0;this.cd();0!==this.undoManager.transactionLevel&&1!==this.undoManager.transactionLevel||Eh(f);"CommittedTransaction"===
d&&this.undoManager.isJustDiscarded&&(this.Pd=Math.min(this.Pd,this.undoManager.historyIndex-1));"CommittedTransaction"!==d&&"RolledBackTransaction"!==d||!this.undoManager.isPendingUnmodified||setTimeout(function(){b.isModified=!1},1);var g=a.isTransactionFinished;g&&(Wj(this),this.Xt.clear(),Qh(this.animationManager));if(!this.Ds&&g&&this.lastInput.targetDiagram){this.Ds=!0;var h=this;sa(function(){h.currentTool.standardMouseOver();h.Ds=!1},10)}}}finally{this.Z=!0}}}};
function Gj(a,b){b=b.W.j;for(var c=b.length,d=0;d<c;d++)Yj(a,b[d])}function Yj(a,b){if(b instanceof Zj){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){var d=b.Yg;null!==d&&(d.ol instanceof Event&&null!==b.Cc&&b.Cc(b,d.ol),!0===d.ns&&(null!==b.qf&&b.qf(b,d.ov),null!==b.diagram&&b.diagram.Ns.add(b)));c=c.getAttribute("src");d=a.Pi.H(c);if(null===d)d=[],d.push(b),a.Pi.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}}
function ak(a,b){if(b instanceof Zj){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){c=c.getAttribute("src");var d=a.Pi.H(c);if(null!==d)for(var e=0;e<d.length;e++)if(d[e]===b){d.splice(e,1);0===d.length&&(a.Pi.remove(c),kk(c));break}}}}Q.prototype.Ed=function(){this.partManager.Ed()};Q.prototype.gk=function(a,b){this.Rc.gk(a,b)};Q.prototype.ik=function(a,b){this.Rc.ik(a,b)};Q.prototype.findPartForKey=function(a){return this.partManager.findPartForKey(a)};Q.prototype.Cb=function(a){return this.partManager.Cb(a)};
Q.prototype.findLinkForKey=function(a){return this.partManager.findLinkForKey(a)};t=Q.prototype;t.yc=function(a){return this.partManager.yc(a)};t.gj=function(a){return this.partManager.gj(a)};t.xc=function(a){return this.partManager.xc(a)};t.Jt=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.Jt.apply(this.partManager,b instanceof Array?b:da(ba(b)))};
t.It=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.It.apply(this.partManager,b instanceof Array?b:da(ba(b)))};function Bj(a,b){a.ui=!1;var c=a.Qn;c.w(b)||(b=b.G(),a.Qn=b,Wi(a,!1),a.R("DocumentBoundsChanged",null,c.copy()),Zi(a))}t.Ta=function(){this.ui&&Bj(this,this.computeBounds())};t.Zz=function(){for(var a=new F,b=this.nodes;b.next();){var c=b.value;c.isTopLevel&&a.add(c)}for(b=this.links;b.next();)c=b.value,c.isTopLevel&&a.add(c);return a.iterator};
t.Yz=function(){return this.Dh.iterator};t.AA=function(a){Ui(this);a&&ok(this,!0);this.Ej=!0;Jf(this)};function ok(a,b){for(var c=a.Dh.iterator;c.next();)pk(a,c.value,b);null!==a.layout&&(b?a.layout.isValidLayout=!1:a.layout.C())}function pk(a,b,c){if(null!==b){for(var d=b.Ml.iterator;d.next();)pk(a,d.value,c);null!==b.layout&&(c?b.layout.isValidLayout=!1:b.layout.C())}}
function pj(a,b){if(a.Ng&&!a.Pr){var c=a.Z;a.Z=!0;var d=a.undoManager.transactionLevel,e=a.layout,f=a.animationManager;try{0===d&&(a.undoManager.isInternalTransaction=!0,a.va("Layout"));1>=d&&!f.isAnimating&&!f.rc&&(b||Ch(f,"Layout"));a.Ng=!1;for(var g=a.Dh.iterator;g.next();)qk(a,g.value,b,d);e.isValidLayout||(!b||e.isRealtime||null===e.isRealtime||0===d?(e.doLayout(a),Ui(a),e.isValidLayout=!0):a.Ng=!0)}finally{b=a.undoManager.isInternalTransaction,0===d&&(a.Wa("Layout"),a.undoManager.isInternalTransaction=
!1),!b||0!==d&&1!==d||Eh(f),a.Z=c}}}function qk(a,b,c,d){if(null!==b){for(var e=b.Ml.iterator;e.next();)qk(a,e.value,c,d);e=b.layout;null===e||e.isValidLayout||(!c||e.isRealtime||0===d?(b.Rh=!b.location.u(),e.doLayout(b),b.C(32),rj(a,b),e.isValidLayout=!0):a.Ng=!0)}}t.eA=function(){for(var a=new E,b=this.nodes;b.next();){var c=b.value;c.isTopLevel&&null===c.jj()&&a.add(c)}return a.iterator};
function qi(a){function b(a){var b=a.toLowerCase(),e=new E;c.add(a,e);c.add(b,e);d.add(a,a);d.add(b,a)}var c=new H,d=new H;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.Sr=c;a.Rr=d}
function Aj(a,b){var c=a.Rr.H(b);return null!==c?c:a.Rr.H(b.toLowerCase())}function rk(a,b){var c=a.Sr.H(b);if(null!==c)return c;c=a.Sr.H(b.toLowerCase());if(null!==c)return c;B("Unknown DiagramEvent name: "+b)}t.hk=function(a,b){a=rk(this,a);null!==a&&a.add(b)};t.Km=function(a,b){a=rk(this,a);null!==a&&a.remove(b)};
t.R=function(a,b,c){var d=rk(this,a),e=new te;e.diagram=this;a=Aj(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.ma(),c=0;c<b;c++)(0,d[c])(e)};function sk(a){if(a.animationManager.isTicking)return!1;var b=a.currentTool;return b===a.toolManager.findTool("Dragging")?!a.cq||b.isComplexRoutingRealtime:!0}t.zk=function(a,b){void 0===b&&(b=null);return tk(this,!1,null,b).zk(a.x,a.y,a.width,a.height)};
Q.prototype.computeOccupiedArea=function(){return this.isVirtualized?this.viewportBounds.copy():this.ui?Vi(this):this.documentBounds.copy()};
function tk(a,b,c,d){null===a.Gc&&(a.Gc=new uk);if(a.Gc.Rt||a.Gc.group!==c||a.Gc.Sy!==d){if(null===c){b=a.computeOccupiedArea();b.Ic(100,100);a.Gc.initialize(b);b=N.alloc();for(var e=a.nodes;e.next();){var f=e.value,g=f.layer;null!==g&&g.visible&&!g.isTemporary&&vk(a,f,d,b)}N.free(b)}else{0<c.memberParts.count&&(b=a.computePartsBounds(c.memberParts,!1),b.Ic(20,20),a.Gc.initialize(b));b=N.alloc();for(e=c.memberParts;e.next();)f=e.value,f instanceof V&&vk(a,f,d,b);N.free(b)}a.Gc.group=c;a.Gc.Sy=d;a.Gc.Rt=
!1}else b&&wk(a.Gc);return a.Gc}function vk(a,b,c,d){if(b!==c)if(b.isVisible()&&b.avoidable&&!b.isLinkLabel){b=b.getAvoidableRect(d);a=a.Gc;var e=b.x,f=b.y;if(xk(a,e,f))for(c=(f-a.wd)/a.fc|0,d=Math.min((e+b.width-a.vd)/a.ec|0,a.Zi),b=Math.min((f+b.height-a.wd)/a.fc|0,a.$i),e=(e-a.vd)/a.ec|0;e<=d;e++)if(f=a.Qb[e],f.fill)f.fill(yk,c,b+1);else for(var g=c;g<=b;g++)f[g]=yk}else if(b instanceof vf)for(b=b.memberParts;b.next();)e=b.value,e instanceof V&&vk(a,e,c,d)}
function zk(a,b){null!==a.Gc&&!a.Gc.Rt&&(void 0===b&&(b=null),null===b||b.avoidable&&!b.isLinkLabel)&&(a.Gc.Rt=!0)}Q.prototype.Ft=function(a){this.qn.assign(a);this.computeAutoScrollPosition(this.qn).Na(this.position)?this.If():Ak(this)};
function Ak(a){-1===a.yj&&(a.yj=sa(function(){if(-1!==a.yj&&(a.If(),null!==a.lastInput.event)){var b=a.computeAutoScrollPosition(a.qn);b.Na(a.position)||(a.position=b,a.lastInput.documentPoint=a.nu(a.qn),a.doMouseMove(),a.ui=!0,Bj(a,a.documentBounds.copy().Oc(a.computeBounds())),a.Dc=!0,a.cd(),Ak(a))}},a.pn))}Q.prototype.If=function(){-1!==this.yj&&(x.clearTimeout(this.yj),this.yj=-1)};
Q.prototype.computeAutoScrollPosition=function(a){var b=this.position,c=this.rn;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.Na(Hb)||(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.Zt=function(){return null};t.hw=function(){return null};t.mz=function(a,b){this.Ix.add(a,b)};
function Bk(a,b,c){function d(){var a=+new Date;f=!0;for(g.reset();g.next();)if(!g.value[0].Il){f=!1;break}f||a-l>k?b(c,e,h):x.requestAnimationFrame(d)}for(var e=c.callback,f=!0,g=a.Pi.iterator;g.next();)if(!g.value[0].Il){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.CA=function(a){if(!Tg)return null;void 0===a&&(a=new ab);a.returnType="Image";return this.Ey(a)};
t.Ey=function(a){void 0===a&&(a=new ab);return Bk(this,this.DA,a)};
t.DA=function(a,b,c){var d=Ck(c,a,"canvas",null);if(null===d)return null;c=d.Y.canvas;var e=null;if(null!==c)switch(e=a.returnType,void 0===e?e="string":e=e.toLowerCase(),e){case "imagedata":e=d.getImageData(0,0,c.width,c.height);break;case "image":d=(a.document||document).createElement("img");d.src=c.toDataURL(a.type,a.details);e=d;break;case "blob":"function"!==typeof b&&B('Error: Diagram.makeImageData called with "returnType: toBlob", but no required "callback" function property defined.');if("function"===
typeof c.toBlob)return c.toBlob(b,a.type,a.details),"toBlob";if("function"===typeof c.msToBlob)return b(c.msToBlob()),"msToBlob";b(null);return null;default:e=c.toDataURL(a.type,a.details)}return"function"===typeof b?(b(e),null):e};
function Ck(a,b,c,d){a.animationManager.Nc();a.cd();if(null===a.ta)return null;"object"!==typeof b&&B("properties argument must be an Object.");var e=b.size||null,f=b.scale||null;void 0!==b.scale&&isNaN(b.scale)&&(f="NaN");var g=b.maxSize;void 0===b.maxSize&&(g="SVG"===c?new M(Infinity,Infinity):new M(2E3,2E3));var h=b.position||null,k=b.parts||null,l=void 0===b.padding?1:b.padding,m=b.background||null,n=b.omitTemporary;void 0===n&&(n=!0);var p=b.document||document,r=b.elementFinished||null,q=b.showTemporary;
void 0===q&&(q=!n);b=b.showGrid;void 0===b&&(b=q);null!==e&&isNaN(e.width)&&isNaN(e.height)&&(e=null);"number"===typeof l?l=new pc(l):l instanceof pc||B("MakeImage padding must be a Margin or a number.");l.left=Math.max(l.left,0);l.right=Math.max(l.right,0);l.top=Math.max(l.top,0);l.bottom=Math.max(l.bottom,0);a.Gb.tc(!0);n=new Dk(null,p);var u=n.context;if(!(e||f||k||h)){n.width=a.xa+Math.ceil(l.left+l.right);n.height=a.wa+Math.ceil(l.top+l.bottom);if("SVG"===c){if(null===d)return null;d.resize(n.width,
n.height,n.width,n.height);d.ownerDocument=p;d.Bq=r;yj(a,d.context,l,new M(n.width,n.height),a.ya,a.la,k,m,q,b);return d.context}a.kl=!1;yj(a,u,l,new M(n.width,n.height),a.ya,a.la,k,m,q,b);a.kl=!0;return n.context}var v=a.Pn,w=a.documentBounds.copy();w.Iw(a.gb);if(q)for(var y=a.La.j,z=y.length,A=0;A<z;A++){var C=y[A];if(C.visible&&C.isTemporary){C=C.Da.j;for(var G=C.length,L=0;L<G;L++){var I=C[L];I.isInDocumentBounds&&I.isVisible()&&(I=I.actualBounds,I.u()&&w.Oc(I))}}}y=new J(w.x,w.y);if(null!==k){z=
!0;A=k.iterator;for(A.reset();A.next();)if(C=A.value,C instanceof U&&(G=C.layer,(null===G||G.visible)&&(null===G||q||!G.isTemporary)&&C.isVisible()&&(C=C.actualBounds,C.u())))if(z){z=!1;var T=C.copy()}else T.Oc(C);z&&(T=new N(0,0,0,0));w.width=T.width;w.height=T.height;y.x=T.x;y.y=T.y}null!==h&&h.u()&&(y=h,f||(f=v));T=h=0;null!==l&&(h=l.left+l.right,T=l.top+l.bottom);z=A=0;null!==e&&(A=e.width,z=e.height,isFinite(A)&&(A=Math.max(0,A-h)),isFinite(z)&&(z=Math.max(0,z-T)));null!==e&&null!==f?("NaN"===
f&&(f=v),e.u()?(e=A,w=z):isNaN(z)?(e=A,w=w.height*f):(e=w.width*f,w=z)):null!==e?e.u()?(f=Math.min(A/w.width,z/w.height),e=A,w=z):isNaN(z)?(f=A/w.width,e=A,w=w.height*f):(f=z/w.height,e=w.width*f,w=z):null!==f?"NaN"===f&&g.u()?(f=Math.min((g.width-h)/w.width,(g.height-T)/w.height),f>v?(f=v,e=w.width,w=w.height):(e=g.width,w=g.height)):(e=w.width*f,w=w.height*f):(f=v,e=w.width,w=w.height);null!==l?(e+=h,w+=T):l=new pc(0);null!==g&&(v=g.width,g=g.height,isNaN(v)&&(v=2E3),isNaN(g)&&(g=2E3),isFinite(v)&&
(e=Math.min(e,v)),isFinite(g)&&(w=Math.min(w,g)));n.width=Math.ceil(e);n.height=Math.ceil(w);if("SVG"===c){if(null===d)return null;d.resize(n.width,n.height,n.width,n.height);d.ownerDocument=p;d.Bq=r;yj(a,d.context,l,new M(Math.ceil(e),Math.ceil(w)),f,y,k,m,q,b);return d.context}a.kl=!1;yj(a,u,l,new M(Math.ceil(e),Math.ceil(w)),f,y,k,m,q,b);a.kl=!0;return n.context}
ma.Object.defineProperties(Q.prototype,{div:{get:function(){return this.Ea},set:function(a){if(this.Ea!==a){Qa=[];var b=this.Ea;null!==b?(b.B=void 0,b.goDiagram=void 0,b.innerHTML="",null!==this.ta&&(b=this.ta.Ga,this.removeEventListener(b,"touchstart",this.Nw,!1),this.removeEventListener(b,"touchmove",this.Mw,!1),this.removeEventListener(b,"touchend",this.Lw,!1),this.ta.hy()),this.Sl&&(this.Sl.disconnect(),this.Sl=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.Gb=this.ta=null,this.removeEventListener(x,"resize",this.Uw,!1),this.removeEventListener(x,"mousemove",this.Dk,!0),this.removeEventListener(x,"mousedown",this.Ck,!0),this.removeEventListener(x,"mouseup",this.Fk,!0),this.removeEventListener(x,"wheel",this.Gk,!0),this.removeEventListener(x,"mouseout",this.Ek,!0),De===this&&(De=null)):this.me=
!1;this.Ea=null;if(null!==a){if(b=a.B)b.div=null;Hi(this,a);this.Je()}}}},Xx:{get:function(){return this.Zo}},oj:{get:function(){return this.me}},draggedLink:{get:function(){return this.Ur},set:function(a){this.Ur!==a&&(this.Ur=a,null!==a&&(this.Hs=a.fromPort,this.Is=a.toPort))}},Hy:{get:function(){return this.Hs},set:function(a){this.Hs=a}},Iy:{get:function(){return this.Is},
set:function(a){this.Is=a}},animationManager:{get:function(){return this.Rc}},undoManager:{get:function(){return this.ac.undoManager}},skipsUndoManager:{get:function(){return this.ug},set:function(a){this.ug=a;this.ac.skipsUndoManager=a}},delaysLayout:{get:function(){return this.Pr},set:function(a){this.Pr=a}},opacity:{get:function(){return this.tb},
set:function(a){var b=this.tb;b!==a&&((0>a||1<a)&&va(a,"0 <= value <= 1",Q,"opacity"),this.tb=a,this.g("opacity",b,a),this.M())}},validCycle:{get:function(){return this.tt},set:function(a){var b=this.tt;b!==a&&(this.tt=a,this.g("validCycle",b,a))}},layers:{get:function(){return this.La.iterator}},isModelReadOnly:{get:function(){var a=this.ac;return null===a?!1:a.isReadOnly},set:function(a){var b=this.ac;null!==
b&&(b.isReadOnly=a)}},isReadOnly:{get:function(){return this.$f},set:function(a){var b=this.$f;b!==a&&(this.$f=a,this.g("isReadOnly",b,a))}},isEnabled:{get:function(){return this.gd},set:function(a){var b=this.gd;b!==a&&(this.gd=a,this.g("isEnabled",b,a))}},allowClipboard:{get:function(){return this.qr},set:function(a){var b=this.qr;b!==a&&(this.qr=a,this.g("allowClipboard",b,a))}},allowCopy:{
get:function(){return this.$h},set:function(a){var b=this.$h;b!==a&&(this.$h=a,this.g("allowCopy",b,a))}},allowDelete:{get:function(){return this.ai},set:function(a){var b=this.ai;b!==a&&(this.ai=a,this.g("allowDelete",b,a))}},allowDragOut:{get:function(){return this.rr},set:function(a){var b=this.rr;b!==a&&(this.rr=a,this.g("allowDragOut",b,a))}},allowDrop:{get:function(){return this.sr},set:function(a){var b=
this.sr;b!==a&&(this.sr=a,this.g("allowDrop",b,a))}},allowTextEdit:{get:function(){return this.ji},set:function(a){var b=this.ji;b!==a&&(this.ji=a,this.g("allowTextEdit",b,a))}},allowGroup:{get:function(){return this.bi},set:function(a){var b=this.bi;b!==a&&(this.bi=a,this.g("allowGroup",b,a))}},allowUngroup:{get:function(){return this.ki},set:function(a){var b=this.ki;b!==a&&(this.ki=a,this.g("allowUngroup",
b,a))}},allowInsert:{get:function(){return this.ur},set:function(a){var b=this.ur;b!==a&&(this.ur=a,this.g("allowInsert",b,a))}},allowLink:{get:function(){return this.ci},set:function(a){var b=this.ci;b!==a&&(this.ci=a,this.g("allowLink",b,a))}},allowRelink:{get:function(){return this.ei},set:function(a){var b=this.ei;b!==a&&(this.ei=a,this.g("allowRelink",b,a))}},allowMove:{get:function(){return this.di},
set:function(a){var b=this.di;b!==a&&(this.di=a,this.g("allowMove",b,a))}},allowReshape:{get:function(){return this.fi},set:function(a){var b=this.fi;b!==a&&(this.fi=a,this.g("allowReshape",b,a))}},allowResize:{get:function(){return this.gi},set:function(a){var b=this.gi;b!==a&&(this.gi=a,this.g("allowResize",b,a))}},allowRotate:{get:function(){return this.hi},set:function(a){var b=this.hi;b!==a&&(this.hi=a,
this.g("allowRotate",b,a))}},allowSelect:{get:function(){return this.ii},set:function(a){var b=this.ii;b!==a&&(this.ii=a,this.g("allowSelect",b,a))}},allowUndo:{get:function(){return this.vr},set:function(a){var b=this.vr;b!==a&&(this.vr=a,this.g("allowUndo",b,a))}},allowZoom:{get:function(){return this.xr},set:function(a){var b=this.xr;b!==a&&(this.xr=a,this.g("allowZoom",b,a))}},hasVerticalScrollbar:{
get:function(){return this.ql},set:function(a){var b=this.ql;b!==a&&(this.ql=a,Zi(this),this.M(),this.g("hasVerticalScrollbar",b,a),Wi(this,!1))}},hasHorizontalScrollbar:{get:function(){return this.pl},set:function(a){var b=this.pl;b!==a&&(this.pl=a,Zi(this),this.M(),this.g("hasHorizontalScrollbar",b,a),Wi(this,!1))}},allowHorizontalScroll:{get:function(){return this.tr},set:function(a){var b=this.tr;b!==a&&(this.tr=a,this.g("allowHorizontalScroll",
b,a),Wi(this,!1))}},allowVerticalScroll:{get:function(){return this.wr},set:function(a){var b=this.wr;b!==a&&(this.wr=a,this.g("allowVerticalScroll",b,a),Wi(this,!1))}},scrollHorizontalLineChange:{get:function(){return this.Ys},set:function(a){var b=this.Ys;b!==a&&(0>a&&va(a,">= 0",Q,"scrollHorizontalLineChange"),this.Ys=a,this.g("scrollHorizontalLineChange",b,a))}},scrollVerticalLineChange:{get:function(){return this.bt},
set:function(a){var b=this.bt;b!==a&&(0>a&&va(a,">= 0",Q,"scrollVerticalLineChange"),this.bt=a,this.g("scrollVerticalLineChange",b,a))}},lastInput:{get:function(){return this.gh},set:function(a){this.gh=a}},firstInput:{get:function(){return this.Vf},set:function(a){this.Vf=a}},currentCursor:{get:function(){return this.Jr},set:function(a){""===a&&(a=this.On);if(this.Jr!==a){var b=this.ta,c=this.Ea;if(null!==b){this.Jr=
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.On},set:function(a){""===a&&(a="auto");var b=this.On;b!==a&&(this.On=a,this.g("defaultCursor",b,a))}},click:{get:function(){return this.Of},
set:function(a){var b=this.Of;b!==a&&(this.Of=a,this.g("click",b,a))}},doubleClick:{get:function(){return this.Tf},set:function(a){var b=this.Tf;b!==a&&(this.Tf=a,this.g("doubleClick",b,a))}},contextClick:{get:function(){return this.Pf},set:function(a){var b=this.Pf;b!==a&&(this.Pf=a,this.g("contextClick",b,a))}},mouseOver:{get:function(){return this.lg},set:function(a){var b=this.lg;b!==a&&(this.lg=a,this.g("mouseOver",
b,a))}},mouseHover:{get:function(){return this.jg},set:function(a){var b=this.jg;b!==a&&(this.jg=a,this.g("mouseHover",b,a))}},mouseHold:{get:function(){return this.ig},set:function(a){var b=this.ig;b!==a&&(this.ig=a,this.g("mouseHold",b,a))}},mouseDragOver:{get:function(){return this.Cs},set:function(a){var b=this.Cs;b!==a&&(this.Cs=a,this.g("mouseDragOver",b,a))}},mouseDrop:{get:function(){return this.gg},
set:function(a){var b=this.gg;b!==a&&(this.gg=a,this.g("mouseDrop",b,a))}},handlesDragDropForTopLevelParts:{get:function(){return this.es},set:function(a){var b=this.es;b!==a&&(this.es=a,this.g("handlesDragDropForTopLevelParts",b,a))}},mouseEnter:{get:function(){return this.hg},set:function(a){var b=this.hg;b!==a&&(this.hg=a,this.g("mouseEnter",b,a))}},mouseLeave:{get:function(){return this.kg},set:function(a){var b=
this.kg;b!==a&&(this.kg=a,this.g("mouseLeave",b,a))}},toolTip:{get:function(){return this.wg},set:function(a){var b=this.wg;b!==a&&(this.wg=a,this.g("toolTip",b,a))}},contextMenu:{get:function(){return this.Qf},set:function(a){var b=this.Qf;b!==a&&(this.Qf=a,this.g("contextMenu",b,a))}},commandHandler:{get:function(){return this.Dr},set:function(a){this.Dr!==a&&(this.Dr=a,a.ae(this))}},toolManager:{
get:function(){return this.pt},set:function(a){this.pt!==a&&(this.pt=a,a.diagram=this)}},defaultTool:{get:function(){return this.Or},set:function(a){var b=this.Or;b!==a&&(this.Or=a,a.diagram=this,this.currentTool===b&&(this.currentTool=a))}},currentTool:{get:function(){return this.Lr},set:function(a){var b=this.Lr;null!==b&&(b.isActive&&b.doDeactivate(),b.cancelWaitAfter(),b.doStop());null===a&&(a=this.defaultTool);null!==a&&
(this.Lr=a,a.diagram=this,a.doStart())}},selection:{get:function(){return this.qv}},maxSelectionCount:{get:function(){return this.ys},set:function(a){var b=this.ys;if(b!==a)if(0<=a&&!isNaN(a)){if(this.ys=a,this.g("maxSelectionCount",b,a),!this.undoManager.isUndoingRedoing&&(a=this.selection.count-a,0<a)){this.R("ChangingSelection",this.selection);b=this.selection.ma();for(var c=0;c<a;c++)b[c].isSelected=!1;this.R("ChangedSelection",this.selection)}}else va(a,
">= 0",Q,"maxSelectionCount")}},nodeSelectionAdornmentTemplate:{get:function(){return this.gp},set:function(a){var b=this.gp;b!==a&&(this.gp=a,this.g("nodeSelectionAdornmentTemplate",b,a))}},groupSelectionAdornmentTemplate:{get:function(){return this.oo},set:function(a){var b=this.oo;b!==a&&(this.oo=a,this.g("groupSelectionAdornmentTemplate",b,a))}},linkSelectionAdornmentTemplate:{get:function(){return this.Ho},
set:function(a){var b=this.Ho;b!==a&&(this.Ho=a,this.g("linkSelectionAdornmentTemplate",b,a))}},highlighteds:{get:function(){return this.Qu}},isModified:{get:function(){var a=this.undoManager;return a.isEnabled?null!==a.currentTransaction?!0:this.so&&this.Pd!==a.historyIndex:this.so},set:function(a){if(this.so!==a){this.so=a;var b=this.undoManager;!a&&b.isEnabled&&(this.Pd=b.historyIndex);a||Wj(this)}}},model:{
get:function(){return this.ac},set:function(a){var b=this.ac;if(b!==a){this.currentTool.doCancel();null!==b&&b.undoManager!==a.undoManager&&b.undoManager.isInTransaction&&B("Do not replace a Diagram.model while a transaction is in progress.");this.animationManager.Nc(!0);var c=Ki(this,!0);this.me=!1;this.Hj=!0;this.Pd=-2;this.Ae=!1;var d=this.jc;this.jc=!0;Ch(this.animationManager,"Model");null!==b&&(null!==this.se&&this.se.each(function(a){b.Kk(a)}),b.Kk(this.Qc));this.ac=a;this.partManager=Xj(this.ac.type);
for(var e=0;e<c.length;e++)this.add(c[e]);a.Hh(this.Bc);this.partManager.addAllModeledParts();a.Kk(this.Bc);a.Hh(this.Qc);null!==this.se&&this.se.each(function(b){a.Hh(b)});this.jc=d;this.Rb||this.M();null!==b&&a.undoManager.copyProperties(b.undoManager)}}},Z:{get:function(){return this.$u},set:function(a){this.$u=a}},Xt:{get:function(){return this.yx}},skipsModelSourceBindings:{get:function(){return this.rv},
set:function(a){this.rv=a}},mu:{get:function(){return this.gt},set:function(a){this.gt=a}},nodeTemplate:{get:function(){return this.cf.H("")},set:function(a){var b=this.cf.H("");b!==a&&(this.cf.add("",a),this.g("nodeTemplate",b,a),this.undoManager.isUndoingRedoing||this.Ed())}},nodeTemplateMap:{get:function(){return this.cf},set:function(a){var b=this.cf;b!==a&&(this.cf=a,this.g("nodeTemplateMap",b,a),this.undoManager.isUndoingRedoing||
this.Ed())}},groupTemplate:{get:function(){return this.eh.H("")},set:function(a){var b=this.eh.H("");b!==a&&(this.eh.add("",a),this.g("groupTemplate",b,a),this.undoManager.isUndoingRedoing||this.Ed())}},groupTemplateMap:{get:function(){return this.eh},set:function(a){var b=this.eh;b!==a&&(this.eh=a,this.g("groupTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Ed())}},linkTemplate:{get:function(){return this.bg.H("")},
set:function(a){var b=this.bg.H("");b!==a&&(this.bg.add("",a),this.g("linkTemplate",b,a),this.undoManager.isUndoingRedoing||this.Ed())}},linkTemplateMap:{get:function(){return this.bg},set:function(a){var b=this.bg;b!==a&&(this.bg=a,this.g("linkTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Ed())}},isMouseCaptured:{get:function(){return this.Wu},set:function(a){var b=this.ta;null!==b&&(b=b.Ga,b instanceof SVGElement||(a?(this.lastInput.bubbles=
!1,this.ln?(this.removeEventListener(b,"pointermove",this.Fm,!1),this.removeEventListener(b,"pointerdown",this.Em,!1),this.removeEventListener(b,"pointerup",this.Hm,!1),this.removeEventListener(b,"pointerout",this.Gm,!1),this.addEventListener(x,"pointermove",this.Fm,!0),this.addEventListener(x,"pointerdown",this.Em,!0),this.addEventListener(x,"pointerup",this.Hm,!0),this.addEventListener(x,"pointerout",this.Gm,!0)):(this.removeEventListener(b,"mousemove",this.Dk,!1),this.removeEventListener(b,"mousedown",
this.Ck,!1),this.removeEventListener(b,"mouseup",this.Fk,!1),this.removeEventListener(b,"mouseout",this.Ek,!1),this.addEventListener(x,"mousemove",this.Dk,!0),this.addEventListener(x,"mousedown",this.Ck,!0),this.addEventListener(x,"mouseup",this.Fk,!0),this.addEventListener(x,"mouseout",this.Ek,!0)),this.removeEventListener(b,"wheel",this.Gk,!1),this.addEventListener(x,"wheel",this.Gk,!0),this.addEventListener(x,"selectstart",this.preventDefault,!1)):(this.ln?(this.removeEventListener(x,"pointermove",
this.Fm,!0),this.removeEventListener(x,"pointerdown",this.Em,!0),this.removeEventListener(x,"pointerup",this.Hm,!0),this.removeEventListener(x,"pointerout",this.Gm,!0),this.addEventListener(b,"pointermove",this.Fm,!1),this.addEventListener(b,"pointerdown",this.Em,!1),this.addEventListener(b,"pointerup",this.Hm,!1),this.addEventListener(b,"pointerout",this.Gm,!1)):(this.removeEventListener(x,"mousemove",this.Dk,!0),this.removeEventListener(x,"mousedown",this.Ck,!0),this.removeEventListener(x,"mouseup",
this.Fk,!0),this.removeEventListener(x,"mouseout",this.Ek,!0),this.addEventListener(b,"mousemove",this.Dk,!1),this.addEventListener(b,"mousedown",this.Ck,!1),this.addEventListener(b,"mouseup",this.Fk,!1),this.addEventListener(b,"mouseout",this.Ek,!1)),this.removeEventListener(x,"wheel",this.Gk,!0),this.removeEventListener(x,"selectstart",this.preventDefault,!1),this.addEventListener(b,"wheel",this.Gk,!1)),this.Wu=a))}},position:{get:function(){return this.la},set:function(a){var b=
J.alloc().assign(this.la);if(!b.w(a)){var c=this.viewportBounds.copy();this.la.assign(a);Sh(this.animationManager,b,this.la);this.Rb||null===this.ta&&!this.mm.u()||(this.Rb=!0,a=this.scale,Yi(this,this.Qn,this.xa/a,this.wa/a,this.Aj,!1),this.Rb=!1);this.Rb||this.Vq(c,this.viewportBounds,this.ya,!1)}J.free(b)}},initialPosition:{get:function(){return this.gs},set:function(a){this.gs.w(a)||(this.gs=a.G())}},initialScale:{get:function(){return this.hs},
set:function(a){this.hs!==a&&(this.hs=a)}},grid:{get:function(){null===this.Ib&&Pi(this);return this.Ib},set:function(a){var b=this.Ib;if(b!==a){null===b&&(Pi(this),b=this.Ib);a.type!==X.Grid&&B("Diagram.grid must be a Panel of type Panel.Grid");var c=b.panel;null!==c&&c.remove(b);this.Ib=a;a.name="GRID";null!==c&&c.add(a);oj(this);this.M();this.g("grid",b,a)}}},viewportBounds:{get:function(){var a=this.Px,b=this.la,c=this.ya;if(null===this.ta)return this.mm.u()&&
a.h(b.x,b.y,this.xa/c,this.wa/c),a;a.h(b.x,b.y,Math.max(this.xa,0)/c,Math.max(this.wa,0)/c);return a}},viewSize:{get:function(){return this.mm},set:function(a){var b=this.viewSize;b.w(a)||(this.mm=a=a.G(),this.xa=a.width,this.wa=a.height,this.Oa(),this.g("viewSize",b,a))}},fixedBounds:{get:function(){return this.bs},set:function(a){var b=this.bs;b.w(a)||(-Infinity!==a.width&&Infinity!==a.height&&-Infinity!==a.height||B("fixedBounds width/height must not be Infinity"),
this.bs=a=a.G(),this.Oa(),this.g("fixedBounds",b,a))}},scrollMargin:{get:function(){return this.Si},set:function(a){"number"===typeof a&&(a=new pc(a));var b=this.Si;b.w(a)||(this.Si=a=a.G(),this.g("scrollMargin",b,a),this.Zq())}},scrollMode:{get:function(){return this.Ti},set:function(a){var b=this.Ti;b!==a&&(this.Ti=a,a===Zh&&Wi(this,!1),this.g("scrollMode",b,a),this.M())}},scrollsPageOnFocus:{get:function(){return this.ct},
set:function(a){var b=this.ct;b!==a&&(this.ct=a,this.g("scrollsPageOnFocus",b,a))}},positionComputation:{get:function(){return this.Qs},set:function(a){var b=this.Qs;b!==a&&(this.Qs=a,Wi(this,!1),this.g("positionComputation",b,a))}},scaleComputation:{get:function(){return this.Ws},set:function(a){var b=this.Ws;b!==a&&(this.Ws=a,Uj(this,this.scale,this.scale),this.g("scaleComputation",b,a))}},documentBounds:{
get:function(){return this.Qn}},isVirtualized:{get:function(){return this.ts},set:function(a){var b=this.ts;b!==a&&(this.ts=a,this.g("isVirtualized",b,a))}},scale:{get:function(){return this.ya},set:function(a){var b=this.ya;b!==a&&Uj(this,b,a)}},defaultScale:{get:function(){return this.Pn},set:function(a){this.Pn=a}},autoScale:{get:function(){return this.Og},set:function(a){var b=
this.Og;b!==a&&(this.Og=a,this.g("autoScale",b,a),a!==Ih&&Wi(this,!1))}},initialAutoScale:{get:function(){return this.Yf},set:function(a){var b=this.Yf;b!==a&&(this.Yf=a,this.g("initialAutoScale",b,a))}},initialViewportSpot:{get:function(){return this.js},set:function(a){var b=this.js;b!==a&&(a.ib()||B("initialViewportSpot must be a specific Spot: "+a),this.js=a,this.g("initialViewportSpot",b,a))}},initialDocumentSpot:{
get:function(){return this.fs},set:function(a){var b=this.fs;b!==a&&(a.ib()||B("initialViewportSpot must be a specific Spot: "+a),this.fs=a,this.g("initialDocumentSpot",b,a))}},minScale:{get:function(){return this.zs},set:function(a){var b=this.zs;b!==a&&(0<a?(this.zs=a,this.g("minScale",b,a),a>this.scale&&(this.scale=a)):va(a,"> 0",Q,"minScale"))}},maxScale:{get:function(){return this.xs},set:function(a){var b=this.xs;b!==a&&(0<a?(this.xs=
a,this.g("maxScale",b,a),a<this.scale&&(this.scale=a)):va(a,"> 0",Q,"maxScale"))}},zoomPoint:{get:function(){return this.xt},set:function(a){this.xt.w(a)||(this.xt=a=a.G())}},contentAlignment:{get:function(){return this.Aj},set:function(a){var b=this.Aj;b.w(a)||(this.Aj=a=a.G(),this.g("contentAlignment",b,a),Wi(this,!1))}},initialContentAlignment:{get:function(){return this.qo},set:function(a){var b=this.qo;
b.w(a)||(this.qo=a=a.G(),this.g("initialContentAlignment",b,a))}},padding:{get:function(){return this.gb},set:function(a){"number"===typeof a&&(a=new pc(a));var b=this.gb;b.w(a)||(this.gb=a=a.G(),this.Oa(),this.g("padding",b,a))}},partManager:{get:function(){return this.Ka},set:function(a){var b=this.Ka;b!==a&&(null!==a.diagram&&B("Cannot share PartManagers between Diagrams: "+a.toString()),null!==b&&b.ae(null),this.Ka=a,a.ae(this))}},nodes:{
get:function(){return this.partManager.nodes.iterator}},links:{get:function(){return this.partManager.links.iterator}},parts:{get:function(){return this.partManager.parts.iterator}},layout:{get:function(){return this.kc},set:function(a){var b=this.kc;b!==a&&(this.kc=a,a.diagram=this,a.group=null,this.Ng=!0,this.g("layout",b,a),this.Db())}},isTreePathToChildren:{get:function(){return this.ss},
set:function(a){var b=this.ss;if(b!==a&&(this.ss=a,this.g("isTreePathToChildren",b,a),!this.undoManager.isUndoingRedoing))for(a=this.nodes;a.next();)Ek(a.value)}},treeCollapsePolicy:{get:function(){return this.rt},set:function(a){var b=this.rt;b!==a&&(a!==ri&&a!==Fk&&a!==Gk&&B("Unknown Diagram.treeCollapsePolicy: "+a),this.rt=a,this.g("treeCollapsePolicy",b,a))}},He:{get:function(){return this.Tu},set:function(a){this.Tu=a}},autoScrollInterval:{
get:function(){return this.pn},set:function(a){var b=this.pn;b!==a&&(this.pn=a,this.g("autoScrollInterval",b,a))}},autoScrollRegion:{get:function(){return this.rn},set:function(a){"number"===typeof a&&(a=new pc(a));var b=this.rn;b.w(a)||(this.rn=a=a.G(),this.Oa(),this.g("autoScrollRegion",b,a))}}});
ma.Object.defineProperties(Q,{licenseKey:{get:function(){return Hk.Xb()},set:function(a){Hk.add(a)}},version:{get:function(){return Ik}}});Q.prototype.makeImageData=Q.prototype.Ey;Q.prototype.makeImage=Q.prototype.CA;Q.prototype.addRenderer=Q.prototype.mz;Q.prototype.makeSVG=Q.prototype.hw;Q.prototype.makeSvg=Q.prototype.Zt;Q.prototype.stopAutoScroll=Q.prototype.If;Q.prototype.doAutoScroll=Q.prototype.Ft;Q.prototype.isUnoccupied=Q.prototype.zk;
Q.prototype.raiseDiagramEvent=Q.prototype.R;Q.prototype.removeDiagramListener=Q.prototype.Km;Q.prototype.addDiagramListener=Q.prototype.hk;Q.prototype.findTreeRoots=Q.prototype.eA;Q.prototype.layoutDiagram=Q.prototype.AA;Q.prototype.findTopLevelGroups=Q.prototype.Yz;Q.prototype.findTopLevelNodesAndLinks=Q.prototype.Zz;Q.prototype.ensureBounds=Q.prototype.Ta;Q.prototype.findLinksByExample=Q.prototype.It;Q.prototype.findNodesByExample=Q.prototype.Jt;Q.prototype.findLinkForData=Q.prototype.xc;
Q.prototype.findNodeForData=Q.prototype.gj;Q.prototype.findPartForData=Q.prototype.yc;Q.prototype.findLinkForKey=Q.prototype.findLinkForKey;Q.prototype.findNodeForKey=Q.prototype.Cb;Q.prototype.findPartForKey=Q.prototype.findPartForKey;Q.prototype.rebuildParts=Q.prototype.Ed;Q.prototype.transformViewToDoc=Q.prototype.nu;Q.prototype.transformRectDocToView=Q.prototype.bB;Q.prototype.transformDocToView=Q.prototype.ir;Q.prototype.centerRect=Q.prototype.At;Q.prototype.scrollToRect=Q.prototype.zw;
Q.prototype.scroll=Q.prototype.scroll;Q.prototype.highlightCollection=Q.prototype.qA;Q.prototype.highlight=Q.prototype.pA;Q.prototype.selectCollection=Q.prototype.TA;Q.prototype.select=Q.prototype.select;Q.prototype.updateAllRelationshipsFromData=Q.prototype.kr;Q.prototype.updateAllTargetBindings=Q.prototype.updateAllTargetBindings;Q.prototype.commit=Q.prototype.commit;Q.prototype.rollbackTransaction=Q.prototype.Hf;Q.prototype.commitTransaction=Q.prototype.Wa;Q.prototype.startTransaction=Q.prototype.va;
Q.prototype.raiseChanged=Q.prototype.g;Q.prototype.raiseChangedEvent=Q.prototype.ab;Q.prototype.removeChangedListener=Q.prototype.Kk;Q.prototype.addChangedListener=Q.prototype.Hh;Q.prototype.removeModelChangedListener=Q.prototype.PA;Q.prototype.addModelChangedListener=Q.prototype.Vx;Q.prototype.findLayer=Q.prototype.tm;Q.prototype.removeLayer=Q.prototype.NA;Q.prototype.addLayerAfter=Q.prototype.jz;Q.prototype.addLayerBefore=Q.prototype.Sx;Q.prototype.addLayer=Q.prototype.om;
Q.prototype.moveParts=Q.prototype.moveParts;Q.prototype.copyParts=Q.prototype.qk;Q.prototype.removeParts=Q.prototype.gu;Q.prototype.remove=Q.prototype.remove;Q.prototype.add=Q.prototype.add;Q.prototype.clearDelayedGeometries=Q.prototype.Gv;Q.prototype.setProperties=Q.prototype.Ew;Q.prototype.resetInputOptions=Q.prototype.vw;Q.prototype.setInputOption=Q.prototype.UA;Q.prototype.getInputOption=Q.prototype.xm;Q.prototype.resetRenderingHints=Q.prototype.ww;Q.prototype.setRenderingHint=Q.prototype.Qy;
Q.prototype.getRenderingHint=Q.prototype.Ge;Q.prototype.maybeUpdate=Q.prototype.cd;Q.prototype.requestUpdate=Q.prototype.Db;Q.prototype.delayInitialization=Q.prototype.Ez;Q.prototype.isUpdateRequested=Q.prototype.wA;Q.prototype.redraw=Q.prototype.Je;Q.prototype.invalidateDocumentBounds=Q.prototype.Oa;Q.prototype.findObjectsNear=Q.prototype.Eg;Q.prototype.findPartsNear=Q.prototype.Vz;Q.prototype.findObjectsIn=Q.prototype.zf;Q.prototype.findPartsIn=Q.prototype.py;Q.prototype.findObjectsAt=Q.prototype.hj;
Q.prototype.findPartsAt=Q.prototype.Uz;Q.prototype.findObjectAt=Q.prototype.Ub;Q.prototype.findPartAt=Q.prototype.um;Q.prototype.focusObject=Q.prototype.fA;Q.prototype.alignDocument=Q.prototype.oz;Q.prototype.zoomToRect=Q.prototype.fB;Q.prototype.zoomToFit=Q.prototype.zoomToFit;Q.prototype.diagramScroll=Q.prototype.ey;Q.prototype.focus=Q.prototype.focus;Q.prototype.reset=Q.prototype.reset;Q.useDOM=function(a){Tg=a?void 0!==x.document:!1};Q.isUsingDOM=function(){return Tg};
var De=null,si=new H,Ni=null,Mi=null,Tg=void 0!==x.document,Ii=null,Ji="",Ih=new D(Q,"None",0),aj=new D(Q,"Uniform",1),bj=new D(Q,"UniformToFill",2),Nf=new D(Q,"CycleAll",10),Rf=new D(Q,"CycleNotDirected",11),Tf=new D(Q,"CycleNotDirectedFast",12),Uf=new D(Q,"CycleNotUndirected",13),Of=new D(Q,"CycleDestinationTree",14),Qf=new D(Q,"CycleSourceTree",15),Zh=new D(Q,"DocumentScroll",1),ai=new D(Q,"InfiniteScroll",2),ri=new D(Q,"TreeParentCollapsed",21),Fk=new D(Q,"AllParentsCollapsed",22),Gk=new D(Q,
"AnyParentsCollapsed",23),Hk=new E,Ik="2.1.34",Jk=null,oi=!1;
function pi(){if(Tg){var a=x.document.createElement("canvas"),b=a.getContext("2d"),c=Ra("7ca11abfd022028846");b[c]=Ra("398c3597c01238");for(var d=["5da73c80a36455d5038e4972187c3cae51fd22",pa.Dx+"4ae6247590da4bb21c324ba3a84e385776",rd.xF+"fb236cdfda5de14c134ba1a95a2d4c7cc6f93c1387",K.za],e=1;5>e;e++)b[Ra("7ca11abfd7330390")](Ra(d[e-1]),10,15*e);b[c]=Ra("39f046ebb36e4b");for(c=1;5>c;c++)b[Ra("7ca11abfd7330390")](Ra(d[c-1]),10,15*c);Jk=a}}Q.className="Diagram";
Q.fromDiv=function(a){var b=a;"string"===typeof a&&(b=x.document.getElementById(a));return b instanceof HTMLDivElement&&b.B instanceof Q?b.B: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.None=Ih;Q.Uniform=aj;Q.UniformToFill=bj;Q.CycleAll=Nf;Q.CycleNotDirected=Rf;Q.CycleNotDirectedFast=Tf;Q.CycleNotUndirected=Uf;
Q.CycleDestinationTree=Of;Q.CycleSourceTree=Qf;Q.DocumentScroll=Zh;Q.InfiniteScroll=ai;Q.TreeParentCollapsed=ri;Q.AllParentsCollapsed=Fk;Q.AnyParentsCollapsed=Gk;function zi(){this.fz=null;this.l="zz@orderNum";"63ad05bbe23a1786468a4c741b6d2"===this._tk?this.Ue=this.l=!0:this.Ue=null}
function xj(a,b){b.Gb.setTransform(b.Sb,0,0,b.Sb,0,0);if(null===a.Ue){b="f";var c=x[Ra("76a715b2f73f148a")][Ra("72ba13b5")];a.Ue=!0;if(Tg){var d=Q[Ra("76a115b6ed251eaf4692")];if(d)for(var e=Hk.iterator;e.next();){d=e.value;d=Ra(d).split(Ra("39e9"));if(6>d.length)break;var f=Ra(d[1]).split(".");if("7da71ca0"!==d[4])break;var g=Ra(pa[Ra("6cae19")]).split(".");if(f[0]>g[0]||f[0]===g[0]&&f[1]>=g[1]){f=c[Ra("76ad18b4f73e")];for(g=c[Ra("73a612b6fb191d")](Ra("35e7"))+2;g<f;g++)b+=c[g];f=b[Ra("73a612b6fb191d")](Ra(d[2]));
0>f&&Ra(d[2])!==Ra("7da71ca0ad381e90")&&(f=b[Ra("73a612b6fb191d")](Ra("76a715b2ef3e149757")));0>f&&(f=b[Ra("73a612b6fb191d")](Ra("76a715b2ef3e149757")));0>f&&(f=c[Ra("73a612b6fb191d")](Ra("7baa19a6f76c1988428554")));a.Ue=!(0<=f&&f<b[Ra("73a612b6fb191d")](Ra("35"))||-1===b[Ra("73a612b6fb191d")](Ra("35")));if(!a.Ue)break;f=Ra(d[2]);if("#"!==f[0])break;g=x.document.createElement("div");for(var h=d[0].replace(/[A-Za-z]/g,"");4>h.length;)h+="9";h=h.substr(h.length-4);d="";d+=["gsh","gsf"][parseInt(h.substr(0,
1),10)%2];d+=["Header","Background","Display","Feedback"][parseInt(h.substr(0,1),10)%4];g[Ra("79a417a0f0181a8946")]=d;if(x.document[Ra("78a712aa")]){x.document[Ra("78a712aa")][Ra("7bb806b6ed32388c4a875b")](g);h=x.getComputedStyle(g).getPropertyValue(Ra("78a704b7e62456904c9b12701b6532a8"));x.document[Ra("78a712aa")][Ra("68ad1bbcf533388c4a875b")](g);if(!h)break;if(-1!==h.indexOf(parseInt(f[1]+f[2],16))&&-1!==h.indexOf(parseInt(f[3]+f[4],16))){a.Ue=!1;break}else if(Sa||Ta||Ua||Va)for(d="."+d,f=0;f<document.styleSheets.length;f++){g=
document.styleSheets[f].rules||document.styleSheets[f].cssRules;for(var k in g)if(d===g[k].selectorText){a.Ue=!1;break}}}else a.Ue=null,a.Ue=!1}}else{k=c[Ra("76ad18b4f73e")];for(e=c[Ra("73a612b6fb191d")](Ra("35e7"))+2;e<k;e++)b+=c[e];c=b[Ra("73a612b6fb191d")](Ra("7da71ca0ad381e90"));a.Ue=!(0<=c&&c<b[Ra("73a612b6fb191d")](Ra("35")))}}}return 0<a.Ue&&a!==a.fz?!0:!1}
function Hi(a,b){if(Tg){void 0!==b&&null!==b||B("Diagram setup requires an argument DIV.");null!==a.Ea&&B("Diagram has already completed setup.");"string"===typeof b?a.Ea=x.document.getElementById(b):b instanceof HTMLDivElement?a.Ea=b:B("No DIV or DIV id supplied: "+b);null===a.Ea&&B("Invalid DIV id; could not get element with id: "+b);void 0!==a.Ea.B&&B("Invalid div id; div already has a Diagram associated with it.");if(!a.Sl&&x.ResizeObserver){var c=ra(function(){a.Db()},250);a.Sl=new x.ResizeObserver(function(){c()});
a.Sl.observe(a.Ea)}"static"===x.getComputedStyle(a.Ea,null).position&&(a.Ea.style.position="relative");a.Ea.style["-webkit-tap-highlight-color"]="rgba(255, 255, 255, 0)";a.Ea.style["-ms-touch-action"]="none";a.Ea.innerHTML="";a.Ea.B=a;a.Ea.goDiagram=a;a.Ea.go=x.go;var d=a.eq?new Cj(a):new Dk(a);void 0!==d.style&&(d.style.position="absolute",d.style.top="0px",d.style.left="0px","rtl"===x.getComputedStyle(a.Ea,null).getPropertyValue("direction")&&(a.Al=!0),d.style.zIndex="2",d.style.userSelect="none",
d.style.webkitUserSelect="none",d.style.MozUserSelect="none");a.ta=d;a.Gb=d.context;b=a.Gb;a.Sb=a.computePixelRatio();a.xa=a.Ea.clientWidth||1;a.wa=a.Ea.clientHeight||1;Ej(a,a.xa,a.wa);a.Vr=b.Y[Ra("7eba17a4ca3b1a8346")][Ra("78a118b7")](b.Y,Jk,4,4);a.Ea.insertBefore(d.Ga,a.Ea.firstChild);d=new Dk(null);d.width=1;d.height=1;a.Iu=d;a.qx=d.context;if(Tg){d=ta("div");var e=ta("div");d.style.position="absolute";d.style.overflow="auto";d.style.width=a.xa+"px";d.style.height=a.wa+"px";d.style.zIndex="1";
e.style.position="absolute";e.style.width="1px";e.style.height="1px";a.Ea.appendChild(d);d.appendChild(e);d.onscroll=Qi;d.addEventListener("mousedown",Si);d.addEventListener("touchstart",Si,{passive:!0});d.B=a;d.dz=!0;d.ez=!0;a.$s=d;a.Lp=e}a.Zq=ra(function(){a.yh=null;a.M()},300);a.Uw=ra(function(){Jh(a)},250);a.preventDefault=function(a){a.preventDefault();return!1};a.Dk=function(b){if(a.isEnabled){a.Zf=!0;var c=fj(a,b,!0);a.doMouseMove();a.currentTool.isBeyondDragSize()&&(a.sd=0);lj(c,b)}};a.Ck=
function(b){if(a.isEnabled)if(a.Zf=!0,a.ne)b.preventDefault();else{var c=fj(a,b,!0);c.down=!0;c.clickCount=b.detail;if(Ta||Ua)b.timeStamp-a.Pj<a.qt&&!a.currentTool.isBeyondDragSize()?a.sd++:a.sd=1,a.Pj=b.timeStamp,c.clickCount=a.sd;c.clone(a.firstInput);a.doMouseDown();1===b.button?b.preventDefault():lj(c,b)}};a.Fk=function(b){if(a.isEnabled)if(a.ne&&2===b.button)b.preventDefault();else if(a.ne&&0===b.button&&(a.ne=!1),a.ek)b.preventDefault();else{a.Zf=!0;var c=fj(a,b,!0);c.up=!0;c.clickCount=b.detail;
if(Ta||Ua)c.clickCount=a.sd;c.bubbles=b.bubbles;c.targetDiagram=hj(b);a.doMouseUp();a.If();lj(c,b)}};a.Gk=function(b){if(a.isEnabled){var c=fj(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();lj(c,b)}};a.Ek=function(b){a.isEnabled&&(a.Zf=!1,fj(a,b,!0),b=a.currentTool,b.cancelWaitAfter(),b.standardMouseOver())};a.Nw=function(b){if(a.isEnabled){a.ek=!1;a.ne=!0;var c=ij(a,b,b.targetTouches[0],1<b.touches.length),d=null;0<b.targetTouches.length?d=b.targetTouches[0]:0<b.changedTouches.length&&(d=b.changedTouches[0]);if(null!==d){var e=d.screenX;d=d.screenY;var f=a.Co;b.timeStamp-a.Pj<a.qt&&!(25<Math.abs(f.x-
e)||25<Math.abs(f.y-d))?a.sd++:a.sd=1;c.clickCount=a.sd;a.Pj=b.timeStamp;a.Co.h(e,d)}a.doMouseDown();lj(c,b)}};a.Mw=function(b){if(a.isEnabled){var c=null;0<b.targetTouches.length?c=b.targetTouches[0]:0<b.changedTouches.length&&(c=b.changedTouches[0]);c=kj(a,b,c,1<b.touches.length);a.doMouseMove();lj(c,b)}};a.Lw=function(b){if(a.isEnabled)if(a.ek)b.preventDefault();else if(!(1<b.touches.length)){var c=null,d=null;0<b.targetTouches.length?d=b.targetTouches[0]:0<b.changedTouches.length&&(d=b.changedTouches[0]);
var e=jj(a,b,!1,!0,!1,!1);null!==d&&(c=x.document.elementFromPoint(d.clientX,d.clientY),null!==c&&c.B instanceof Q&&c.B!==a&&gj(c.B,d,e),gj(a,d,e),e.clickCount=a.sd);null===c?e.targetDiagram=hj(b):c.B?e.targetDiagram=c.B:e.targetDiagram=null;e.targetObject=null;a.doMouseUp();lj(e,b);a.ne=!1}};a.Em=function(b){if(a.isEnabled){a.Zf=!0;var c=a.Os;void 0===c[b.pointerId]&&(c[b.pointerId]=b);c=a.Zj;var d=!1;if(null!==c[0]&&c[0].pointerId===b.pointerId)c[0]=b;else if(null!==c[1]&&c[1].pointerId===b.pointerId)c[1]=
b,d=!0;else if(null===c[0])c[0]=b;else if(null===c[1])c[1]=b,d=!0;else{b.preventDefault();return}if("touch"===b.pointerType||"pen"===b.pointerType)a.ek=!1,a.ne=!0;c=ij(a,b,b,d);d=a.Co;var e="touch"===b.pointerType||"pen"===b.pointerType?25:10;b.timeStamp-a.Pj<a.qt&&!(Math.abs(d.x-b.screenX)>e||Math.abs(d.y-b.screenY)>e)?a.sd++:a.sd=1;c.clickCount=a.sd;a.Pj=b.timeStamp;a.Co.Ig(b.screenX,b.screenY);a.doMouseDown();1===b.button?b.preventDefault():lj(c,b)}};a.Fm=function(b){if(a.isEnabled){a.Zf=!0;var c=
a.Zj;if(null!==c[0]&&c[0].pointerId===b.pointerId)c[0]=b;else{if(null!==c[1]&&c[1].pointerId===b.pointerId){c[1]=b;return}if(null===c[0])c[0]=b;else return}c[0].pointerId===b.pointerId&&(c=kj(a,b,b,null!==c[1]),c.targetDiagram=hj(b),a.doMouseMove(),lj(c,b))}};a.Hm=function(b){if(a.isEnabled){a.Zf=!0;var c="touch"===b.pointerType||"pen"===b.pointerType,d=a.Os;if(c&&a.ek)delete d[b.pointerId],b.preventDefault();else if(d=a.Zj,null!==d[0]&&d[0].pointerId===b.pointerId){d[0]=null;d=jj(a,b,!1,!0,!0,!1);
var e=x.document.elementFromPoint(b.clientX,b.clientY);null!==e&&e.B instanceof Q&&e.B!==a&&gj(e.B,b,d);gj(a,b,d);d.clickCount=a.sd;null===e?d.targetDiagram=hj(b):e.B?d.targetDiagram=e.B:d.targetDiagram=null;d.targetObject=null;a.doMouseUp();lj(d,b);c&&(a.ne=!1)}else null!==d[1]&&d[1].pointerId===b.pointerId&&(d[1]=null)}};a.Gm=function(b){if(a.isEnabled){a.Zf=!1;var c=a.Os;c[b.pointerId]&&delete c[b.pointerId];c=a.Zj;null!==c[0]&&c[0].pointerId===b.pointerId&&(c[0]=null);null!==c[1]&&c[1].pointerId===
b.pointerId&&(c[1]=null);"touch"!==b.pointerType&&"pen"!==b.pointerType&&(b=a.currentTool,b.cancelWaitAfter(),b.standardMouseOver())}};b.tc(!0);Oi(a)}}zi.className="DiagramHelper";function $e(a){this.l=void 0===a?new J:a;this.v=new J}ma.Object.defineProperties($e.prototype,{point:{get:function(){return this.l},set:function(a){this.l=a}},shifted:{get:function(){return this.v},set:function(a){this.v=a}}});$e.className="DraggingInfo";
function Pj(a,b,c){this.node=a;this.info=b;this.Zv=c}Pj.className="DraggingNodeInfoPair";function Te(){this.reset()}Te.prototype.reset=function(){this.isGridSnapEnabled=!1;this.isGridSnapRealtime=!0;this.gridSnapCellSize=(new M(NaN,NaN)).freeze();this.gridSnapCellSpot=wc;this.gridSnapOrigin=(new J(NaN,NaN)).freeze();this.groupsSnapMembers=this.dragsTree=this.dragsLink=!1;this.dragsMembers=this.groupsAlwaysMove=!0};Te.className="DraggingOptions";
function Kk(a){1<arguments.length&&B("Palette constructor can only take one optional argument, the DIV HTML element or its id.");Q.call(this,a);Lk(this)}la(Kk,Q);function Lk(a){a.allowDragOut=!0;a.allowMove=!1;a.isReadOnly=!0;a.contentAlignment=yc;a.layout=new Mk}Kk.prototype.reset=function(){Q.prototype.reset.call(this);Lk(this)};Kk.className="Palette";
function Nk(a){1<arguments.length&&B("Overview constructor can only take one optional argument, the DIV HTML element or its id.");Q.call(this,a);var b=this;this.animationManager.isEnabled=!1;this.Rb=!0;this.Ja=null;this.ql=this.pl=!1;this.v=this.I=!0;this.cb=0;this.T=!1;this.$l=null;this.Qy("drawShadows",!1);var c=new U,d=new W;d.stroke="magenta";d.strokeWidth=2;d.fill="transparent";d.name="BOXSHAPE";c.selectable=!0;c.selectionAdorned=!1;c.selectionObjectName="BOXSHAPE";c.locationObjectName="BOXSHAPE";
c.resizeObjectName="BOXSHAPE";c.cursor="move";c.add(d);this.l=c;this.allowDelete=this.allowCopy=!1;this.allowSelect=!0;this.autoScrollRegion=new pc(0,0,0,0);this.la.h(0,0);this.toolManager.Xa("Dragging",new Ok,this.toolManager.mouseMoveTools);this.click=function(){var a=b.observed;if(null!==a){var c=a.viewportBounds,d=b.lastInput.documentPoint;a.position=new J(d.x-c.width/2,d.y-c.height/2)}};this.Xh=function(){b.Oa();Pk(b)};this.Wh=function(){null!==b.observed&&(b.Oa(),b.M())};this.Pc=function(){1>
b.updateDelay?b.M():b.T||(b.T=!0,setTimeout(function(){b.T=!1;var a=b.ta,c=b.Gb;if(null!==a&&null!==c){vj(b);if(null===b.$l){var d=new Dk(null);d.width=a.width;d.height=a.height;b.$l=d}try{b.ta=b.$l,b.Gb=b.ta.context,b.Gb.tc(!0),b.Gb.setTransform(1,0,0,1,0,0),b.Gb.clearRect(0,0,b.ta.width,b.ta.height),Qk(b)}finally{b.ta=a,b.Gb=c}}b.M()},b.updateDelay))};this.Gd=function(){null!==b.observed&&Pk(b)};this.autoScale=aj;this.Rb=!1}la(Nk,Q);Nk.prototype.computePixelRatio=function(){return 1};
Nk.prototype.bc=function(){null===this.Ea&&B("No div specified");null===this.ta&&B("No canvas specified");if(!(this.ta instanceof Cj)&&(ji(this.box),this.Dc)){var a=this.observed;if(null!==a&&!a.animationManager.isAnimating&&a.oj){vj(this);var b=this.ta;a=this.Gb;a.tc(!0);a.setTransform(1,0,0,1,0,0);a.clearRect(0,0,b.width,b.height);1>this.updateDelay?Qk(this):null!==this.$l&&(a.drawImage(this.$l.Ga,0,0),b=this.ob,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.Sb,this.Sb),a.transform(b.m11,b.m12,b.m21,b.m22,b.dx,b.dy));b=this.La.j;for(var c=b.length,d=0;d<c;d++)b[d].bc(a,this);this.Dc=this.wi=!1}}};
function Qk(a){var b=a.observed;if(null!==b){var c=a.drawsTemporaryLayers,d=a.drawsGrid&&c,e=b.grid;d&&null!==e&&e.visible&&!isNaN(e.width)&&!isNaN(e.height)&&(e=N.alloc().assign(a.viewportBounds).Oc(b.viewportBounds),oj(b,e),N.free(e),Ui(b));var f=a.ob;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.Gb;e.scale(a.Sb,a.Sb);e.transform(f.m11,f.m12,f.m21,f.m22,f.dx,f.dy);b=b.La.j;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=ki(h,e),l.bc(e,k),e.globalAlpha=h);else{for(var m=ki(h,e),n=k.scale,p=N.alloc(),r=h.Da.j,q=r.length,u=0;u<q;u++){var v=r[u];(d||v!==l)&&h.dj(e,v,k,null,n,p,!1)}N.free(p);e.globalAlpha=m}}}}}
function Pk(a){var b=a.box;if(null!==b){var c=a.observed;if(null!==c){a.Dc=!0;c=c.viewportBounds;var d=b.selectionObject,e=M.alloc();e.h(c.width,c.height);d.desiredSize=e;M.free(e);a=2/a.scale;d instanceof W&&(d.strokeWidth=a);b.location=new J(c.x-a/2,c.y-a/2);b.isSelected=!0}}}Nk.prototype.computeBounds=function(){var a=this.observed;if(null===a)return jc;var b=a.documentBounds.copy();b.Oc(a.viewportBounds);return b};Nk.prototype.By=function(){!0!==this.Dc&&(this.Dc=!0,this.Db())};
Nk.prototype.Vq=function(a,b,c,d){this.Rb||(Ti(this),this.M(),Zi(this),this.Oa(),Pk(this),this.Vd.scale=c,this.Vd.position.x=a.x,this.Vd.position.y=a.y,this.Vd.bounds.assign(a),this.Vd.gw=d,this.R("ViewportBoundsChanged",this.Vd,a))};
ma.Object.defineProperties(Nk.prototype,{observed:{get:function(){return this.Ja},set:function(a){var b=this.Ja;a instanceof Nk&&B("Overview.observed Diagram may not be an Overview itself: "+a);if(b!==a){null!==b&&(this.remove(this.box),b.Km("ViewportBoundsChanged",this.Xh),b.Km("DocumentBoundsChanged",this.Wh),b.Km("InvalidateDraw",this.Pc),b.Km("AnimationFinished",this.Gd));this.Ja=a;null!==a&&(a.hk("ViewportBoundsChanged",this.Xh),a.hk("DocumentBoundsChanged",this.Wh),
a.hk("InvalidateDraw",this.Pc),a.hk("AnimationFinished",this.Gd),this.add(this.box));this.Oa();if(null===a){this.$l=null;var c=this.ta,d=this.Gb;c&&d&&(d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,c.width,c.height))}else this.Pc(null),Pk(this),this.M();this.g("observed",b,a)}}},box:{get:function(){return this.l},set:function(a){var b=this.l;b!==a&&(this.l=a,this.remove(b),this.add(this.l),Pk(this),this.g("box",b,a))}},drawsTemporaryLayers:{
get:function(){return this.I},set:function(a){this.I!==a&&(this.I=a,this.Je())}},drawsGrid:{get:function(){return this.v},set:function(a){this.v!==a&&(this.v=a,this.Je())}},updateDelay:{get:function(){return this.cb},set:function(a){0>a&&(a=0);this.cb!==a&&(this.cb=a)}}});Nk.className="Overview";function Ok(){Se.call(this);this.l=null}la(Ok,Se);
Ok.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(null===a||!a.allowMove||!a.allowSelect)return!1;var b=a.observed;if(null===b)return!1;var c=a.lastInput;if(!c.left||a.currentTool!==this&&(!this.isBeyondDragSize()||c.isTouchEvent&&c.timestamp-a.firstInput.timestamp<this.delay))return!1;null===this.findDraggablePart()&&(c=b.viewportBounds,this.l=new J(c.width/2,c.height/2),a=a.firstInput.documentPoint,b.position=new J(a.x-this.l.x,a.y-this.l.y));return!0};
Ok.prototype.doActivate=function(){this.l=null;Se.prototype.doActivate.call(this)};Ok.prototype.doUpdateCursor=function(){var a=this.diagram,b=a.box;null!==b&&b.cursor&&(a.currentCursor=b.cursor)};Ok.prototype.moveParts=function(){var a=this.diagram,b=a.observed;if(null!==b){var c=a.box;if(null!==c){if(null===this.l){var d=a.firstInput.documentPoint;c=c.location;this.l=new J(d.x-c.x,d.y-c.y)}a=a.lastInput.documentPoint;b.position=new J(a.x-this.l.x,a.y-this.l.y)}}};Ok.className="OverviewDraggingTool";
function Rk(){Ya(this);this.B=De;this.cb=this.I=this.v=!0;this.T=this.Ja=this.Pc=this.Ka=!1;this.Ji=this.l=null;this.Gd=1.05;this.av=NaN;this.wx=null;this.Bv=NaN;this.Av=jc;this.Bc=!0;this.rg=null;this.Qc=200}Rk.prototype.toString=function(){return"CommandHandler"};Rk.prototype.ae=function(a){this.B=a};
Rk.prototype.doKeyDown=function(){var a=this.diagram,b=a.lastInput,c=Wa?b.meta:b.control,d=b.shift,e=b.alt,f=b.key;!c||"C"!==f&&"Insert"!==f?c&&"X"===f||d&&"Del"===f?this.canCutSelection()&&this.cutSelection():c&&"V"===f||d&&"Insert"===f?this.canPasteSelection()&&this.pasteSelection():c&&"Y"===f||e&&d&&"Backspace"===f?this.canRedo()&&this.redo():c&&"Z"===f||e&&"Backspace"===f?this.canUndo()&&this.undo():"Del"===f||"Backspace"===f?this.canDeleteSelection()&&this.deleteSelection():c&&"A"===f?this.canSelectAll()&&
this.selectAll():"Esc"===f?this.canStopCommand()&&this.stopCommand():"Up"===f?a.allowVerticalScroll&&(c?a.scroll("pixel","up"):a.scroll("line","up")):"Down"===f?a.allowVerticalScroll&&(c?a.scroll("pixel","down"):a.scroll("line","down")):"Left"===f?a.allowHorizontalScroll&&(c?a.scroll("pixel","left"):a.scroll("line","left")):"Right"===f?a.allowHorizontalScroll&&(c?a.scroll("pixel","right"):a.scroll("line","right")):"PageUp"===f?d&&a.allowHorizontalScroll?a.scroll("page","left"):a.allowVerticalScroll&&
a.scroll("page","up"):"PageDown"===f?d&&a.allowHorizontalScroll?a.scroll("page","right"):a.allowVerticalScroll&&a.scroll("page","down"):"Home"===f?c&&a.allowVerticalScroll?a.scroll("document","up"):!c&&a.allowHorizontalScroll&&a.scroll("document","left"):"End"===f?c&&a.allowVerticalScroll?a.scroll("document","down"):!c&&a.allowHorizontalScroll&&a.scroll("document","right"):" "===f?this.canScrollToPart()&&this.scrollToPart():"Subtract"===f?this.canDecreaseZoom()&&this.decreaseZoom():"Add"===f?this.canIncreaseZoom()&&
this.increaseZoom():c&&"0"===f?this.canResetZoom()&&this.resetZoom():d&&"Z"===f?this.canZoomToFit()&&this.zoomToFit():c&&!d&&"G"===f?this.canGroupSelection()&&this.groupSelection():c&&d&&"G"===f?this.canUngroupSelection()&&this.ungroupSelection():b.event&&113===b.event.which?this.canEditTextBlock()&&this.editTextBlock():b.event&&93===b.event.which?this.canShowContextMenu()&&this.showContextMenu():b.bubbles=!0:this.canCopySelection()&&this.copySelection()};
Rk.prototype.doKeyUp=function(){this.diagram.lastInput.bubbles=!0};Rk.prototype.stopCommand=function(){var a=this.diagram,b=a.currentTool;b instanceof Oa&&a.allowSelect&&a.clearSelection();null!==b&&b.doCancel()};Rk.prototype.canStopCommand=function(){return!0};
Rk.prototype.selectAll=function(){var a=this.diagram;a.M();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=""}};Rk.prototype.canSelectAll=function(){return this.diagram.allowSelect};
Rk.prototype.deleteSelection=function(){var a=this.diagram;try{a.currentCursor="wait";a.R("ChangingSelection",a.selection);a.va("Delete");a.R("SelectionDeleting",a.selection);for(var b=new F,c=a.selection.iterator;c.next();)Sk(b,c.value,!0,this.deletesTree?Infinity:0,this.deletesConnectedLinks?null:!1,function(a){return a.canDelete()});a.gu(b,!0);a.R("SelectionDeleted",b)}finally{a.Wa("Delete"),a.R("ChangedSelection",a.selection),a.currentCursor=""}};
Rk.prototype.canDeleteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowDelete||0===a.selection.count?!1:!0};Rk.prototype.copySelection=function(){var a=this.diagram,b=new F;for(a=a.selection.iterator;a.next();)Sk(b,a.value,!0,this.copiesTree?Infinity:0,this.copiesConnectedLinks,function(a){return a.canCopy()});this.copyToClipboard(b)};Rk.prototype.canCopySelection=function(){var a=this.diagram;return a.allowCopy&&a.allowClipboard&&0!==a.selection.count?!0:!1};
Rk.prototype.cutSelection=function(){this.copySelection();this.deleteSelection()};Rk.prototype.canCutSelection=function(){var a=this.diagram;return!a.isReadOnly&&!a.isModelReadOnly&&a.allowCopy&&a.allowDelete&&a.allowClipboard&&0!==a.selection.count?!0:!1};
Rk.prototype.copyToClipboard=function(a){var b=this.diagram,c=null;if(null===a)Ii=null,Ji="";else{c=b.model;var d=!1,e=!1,f=null;try{c.Am()&&(d=c.pk,c.pk=this.copiesParentKey),c.xk()&&(e=c.nk,c.nk=this.copiesGroupKey),f=b.qk(a,null,!0)}finally{c.Am()&&(c.pk=d),c.xk()&&(c.nk=e),c=new E,c.addAll(f),Ii=c,Ji=b.model.dataFormat}}b.R("ClipboardChanged",c)};
Rk.prototype.pasteFromClipboard=function(){var a=new F,b=Ii;if(null===b)return a;var c=this.diagram;if(Ji!==c.model.dataFormat)return a;var d=c.model,e=!1,f=!1,g=null;try{d.Am()&&(e=d.pk,d.pk=this.copiesParentKey),d.xk()&&(f=d.nk,d.nk=this.copiesGroupKey),g=c.qk(b,c,!1)}finally{for(d.Am()&&(d.pk=e),d.xk()&&(d.nk=f),b=g.iterator;b.next();)c=b.value,d=b.key,c.location.u()||(d.location.u()?c.location=d.location:!c.position.u()&&d.position.u()&&(c.position=d.position)),a.add(c)}return a};
Rk.prototype.pasteSelection=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.currentCursor="wait";b.R("ChangingSelection",b.selection);b.va("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.u()){var f=this.computeEffectiveCollection(b.selection,b.dl);sf(b,f,new J(a.x-e.centerX,a.y-e.centerY),b.dl,!1)}}b.R("ClipboardPasted",c)}finally{b.Wa("Paste"),b.R("ChangedSelection",
b.selection),b.currentCursor=""}};Rk.prototype.canPasteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowClipboard||null===Ii||0===Ii.count||Ji!==a.model.dataFormat?!1:!0};Rk.prototype.undo=function(){this.diagram.undoManager.undo()};Rk.prototype.canUndo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canUndo()};Rk.prototype.redo=function(){this.diagram.undoManager.redo()};
Rk.prototype.canRedo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canRedo()};Rk.prototype.decreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);var b=this.diagram;b.autoScale===Ih&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};Rk.prototype.canDecreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);var b=this.diagram;if(b.autoScale!==Ih)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};
Rk.prototype.increaseZoom=function(a){void 0===a&&(a=this.zoomFactor);var b=this.diagram;b.autoScale===Ih&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};Rk.prototype.canIncreaseZoom=function(a){void 0===a&&(a=this.zoomFactor);var b=this.diagram;if(b.autoScale!==Ih)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};Rk.prototype.resetZoom=function(a){void 0===a&&(a=this.defaultScale);var b=this.diagram;a<b.minScale||a>b.maxScale||(b.scale=a)};
Rk.prototype.canResetZoom=function(a){void 0===a&&(a=this.defaultScale);var b=this.diagram;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};
Rk.prototype.zoomToFit=function(){var a=this.diagram,b=a.animationManager;b.Nc();a.Je();var c=a.position,d=a.scale;Ch(b,"Zoom To Fit");this.isZoomToFitRestoreEnabled&&d===this.Bv&&!isNaN(this.av)&&a.documentBounds.w(this.Av)?(a.scale=this.av,a.position=this.wx,this.Bv=NaN,this.Av=jc):(this.av=d,this.wx=c.copy(),a.zoomToFit(),this.Bv=a.scale,this.Av=a.documentBounds.copy());Eh(b)};Rk.prototype.canZoomToFit=function(){return this.diagram.allowZoom};
Rk.prototype.scrollToPart=function(a){void 0===a&&(a=null);var b=this.diagram;b.Ta();if(null===a){try{null!==this.rg&&(this.rg.next()?a=this.rg.value:this.rg=null)}catch(k){this.rg=null}null===a&&(0<b.highlighteds.count?this.rg=b.highlighteds.iterator:0<b.selection.count&&(this.rg=b.selection.iterator),null!==this.rg&&this.rg.next()&&(a=this.rg.value))}if(null!==a){var c=b.animationManager;Ch(c,"Scroll To Part");var d=this.scrollToPartPause;if(0<d){var e=Tk(this,a,[a]);if(1===e.length)b.va(),b.At(a.actualBounds),
b.Wa("Scroll To Part");else{var f=function(){b.va();for(var a=e.pop();0<e.length&&a instanceof V&&a.isTreeExpanded&&(!(a instanceof vf)||a.isSubGraphExpanded);)a=e.pop();0<e.length?(a instanceof U&&b.zw(a.actualBounds),a instanceof V&&!a.isTreeExpanded&&(a.isTreeExpanded=!0),a instanceof vf&&!a.isSubGraphExpanded&&(a.isSubGraphExpanded=!0)):(a instanceof U&&b.At(a.actualBounds),b.Km("LayoutCompleted",g));b.Wa("Scroll To Part")},g=function(){sa(f,(c.isEnabled?c.duration:0)+d)};b.hk("LayoutCompleted",
g);f()}}else{var h=b.position.copy();b.At(a.actualBounds);h.Na(b.position)&&c.Nc()}}};
function Tk(a,b,c){if(b.isVisible())return c;if(b instanceof He)Tk(a,b.adornedPart,c);else if(b instanceof S){var d=b.fromNode;null!==d&&Tk(a,d,c);b=b.toNode;null!==b&&Tk(a,b,c)}else b instanceof V&&(d=b.labeledLink,null!==d&&Tk(a,d,c),d=b.Fg(),null!==d&&(d.isTreeExpanded||d.wasTreeExpanded||c.push(d),Tk(a,d,c))),b=b.containingGroup,null!==b&&(b.isSubGraphExpanded||b.wasSubGraphExpanded||c.push(b),Tk(a,b,c));return c}
Rk.prototype.canScrollToPart=function(a){void 0===a&&(a=null);if(null!==a&&!(a instanceof U))return!1;a=this.diagram;return 0===a.selection.count&&0===a.highlighteds.count?!1:a.allowHorizontalScroll&&a.allowVerticalScroll};
Rk.prototype.collapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.va("Collapse Tree");Ch(b.animationManager,"Collapse Tree");var c=new E;if(null!==a&&a.isTreeExpanded)a.collapseTree(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof V&&e.isTreeExpanded&&(e.collapseTree(),c.add(e))}b.R("TreeCollapsed",c)}finally{b.Wa("Collapse Tree")}};
Rk.prototype.canCollapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a){if(!(a instanceof V&&a.isTreeExpanded))return!1;if(0<a.Fq().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof V&&b.isTreeExpanded&&0<b.Fq().count)return!0;return!1};
Rk.prototype.expandTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.va("Expand Tree");Ch(b.animationManager,"Expand Tree");var c=new E;if(null!==a&&!a.isTreeExpanded)a.expandTree(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof V&&!e.isTreeExpanded&&(e.expandTree(),c.add(e))}b.R("TreeExpanded",c)}finally{b.Wa("Expand Tree")}};
Rk.prototype.canExpandTree=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a){if(!(a instanceof V)||a.isTreeExpanded)return!1;if(0<a.Fq().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof V&&!b.isTreeExpanded&&0<b.Fq().count)return!0;return!1};
Rk.prototype.groupSelection=function(){var a=this.diagram,b=a.model;if(b.yk()){var c=this.archetypeGroupData;if(null!==c){var d=null;try{a.currentCursor="wait";a.R("ChangingSelection",a.selection);a.va("Group");for(var e=new E,f=a.selection.iterator;f.next();){var g=f.value;g.Wb()&&g.canGroup()&&e.add(g)}for(var h=new E,k=e.iterator;k.next();){var l=k.value;f=!1;for(var m=e.iterator;m.next();)if(l.Cd(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.Cd(n)){e=!0;break}if(e)n=n.containingGroup;else break}if(c instanceof vf)xg(c),d=c.copy(),null!==d&&a.add(d);else if(b.ew(c)){var r=b.copyNodeData(c);ya(r)&&(b.uf(r),d=a.gj(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.Wa("Group"),a.R("ChangedSelection",
a.selection),a.currentCursor=""}}}};Rk.prototype.canGroupSelection=function(){var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowGroup||!a.model.yk()||null===this.archetypeGroupData)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.Wb()&&b.canGroup())return!0}return!1};
function Uk(a){var b=Ea();for(a=a.iterator;a.next();){var c=a.value;c instanceof S||b.push(c)}a=new F;c=b.length;for(var d=0;d<c;d++){for(var e=b[d],f=!0,g=0;g<c;g++)if(e.Cd(b[g])){f=!1;break}f&&a.add(e)}Ha(b);return a}
Rk.prototype.isValidMember=function(a,b){if(null===b||a===b||b instanceof S)return!1;if(null!==a){if(a===b||a.Cd(b))return!1;var c=a.memberValidation;if(null!==c&&!c(a,b)||null===a.data&&null!==b.data||null!==a.data&&null===b.data)return!1}c=this.memberValidation;return null!==c?c(a,b):!0};
Rk.prototype.ungroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.model;if(c.yk())try{b.currentCursor="wait";b.R("ChangingSelection",b.selection);b.va("Ungroup");var d=new E;if(null!==a)d.add(a);else for(var e=b.selection.iterator;e.next();){var f=e.value;f instanceof vf&&f.canUngroup()&&d.add(f)}var g=new E;if(0<d.count){b.clearSelection(!0);for(var h=d.iterator;h.next();){var k=h.value;k.expandSubGraph();var l=k.containingGroup,m=null!==l&&null!==l.data?c.ja(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 S)){var r=p.data;null!==r?c.er(r,m):p.containingGroup=l}}b.remove(k)}}b.R("SelectionUngrouped",d,g)}finally{b.Wa("Ungroup"),b.R("ChangedSelection",b.selection),b.currentCursor=""}};
Rk.prototype.canUngroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly||b.isModelReadOnly||!b.allowDelete||!b.allowUngroup||!b.model.yk())return!1;if(null!==a){if(!(a instanceof vf))return!1;if(a.canUngroup())return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof vf&&b.canUngroup())return!0;return!1};
Rk.prototype.addTopLevelParts=function(a,b){var c=!0;for(a=Uk(a).iterator;a.next();){var d=a.value;null!==d.containingGroup&&(!b||this.isValidMember(null,d)?d.containingGroup=null:c=!1)}return c};
Rk.prototype.collapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.va("Collapse SubGraph");Ch(b.animationManager,"Collapse SubGraph");var c=new E;if(null!==a&&a.isSubGraphExpanded)a.collapseSubGraph(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof vf&&e.isSubGraphExpanded&&(e.collapseSubGraph(),c.add(e))}b.R("SubGraphCollapsed",c)}finally{b.Wa("Collapse SubGraph")}};
Rk.prototype.canCollapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof vf&&a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof vf&&b.isSubGraphExpanded)return!0;return!1};
Rk.prototype.expandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.va("Expand SubGraph");Ch(b.animationManager,"Expand SubGraph");var c=new E;if(null!==a&&!a.isSubGraphExpanded)a.expandSubGraph(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof vf&&!e.isSubGraphExpanded&&(e.expandSubGraph(),c.add(e))}b.R("SubGraphExpanded",c)}finally{b.Wa("Expand SubGraph")}};
Rk.prototype.canExpandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof vf&&!a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof vf&&!b.isSubGraphExpanded)return!0;return!1};
Rk.prototype.editTextBlock=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.toolManager.findTool("TextEditing");if(null!==c){if(null===a){a=null;for(var d=b.selection.iterator;d.next();){var e=d.value;if(e.canEdit()){a=e;break}}if(null===a)return;a=a.sm(function(a){return a instanceof Vg&&a.editable})}null!==a&&(b.currentTool=null,c.textBlock=a,b.currentTool=c)}};
Rk.prototype.canEditTextBlock=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly||b.isModelReadOnly||!b.allowTextEdit||null===b.toolManager.findTool("TextEditing"))return!1;if(null!==a){if(!(a instanceof Vg))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.sm(function(a){return a instanceof Vg&&a.editable}),null!==a))return!0;return!1};
Rk.prototype.showContextMenu=function(a){var b=this.diagram,c=b.toolManager.findTool("ContextMenu");if(null!==c&&(void 0===a&&(a=0<b.selection.count?b.selection.first():b),a=c.findObjectWithContextMenu(a),null!==a)){var d=b.lastInput,e=null;a instanceof Y?e=a.ga(Bc):b.viewportBounds.aa(d.documentPoint)||(e=b.viewportBounds,e=new J(e.x+e.width/2,e.y+e.height/2));null!==e&&(d.viewPoint=b.ir(e),d.documentPoint=e,d.left=!1,d.right=!0,d.up=!0);b.currentTool=c;Rg(c,!1,a)}};
Rk.prototype.canShowContextMenu=function(a){var b=this.diagram,c=b.toolManager.findTool("ContextMenu");if(null===c)return!1;void 0===a&&(a=0<b.selection.count?b.selection.first():b);return null===c.findObjectWithContextMenu(a)?!1:!0};
Rk.prototype.computeEffectiveCollection=function(a,b){var c=this.diagram,d=c.toolManager.findTool("Dragging"),e=c.currentTool===d;void 0===b&&(b=e?d.dragOptions:c.dl);d=new H;if(null===a)return d;for(var f=a.iterator;f.next();)Nj(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 S&&(b=a.fromNode,null===b||d.contains(b)?(b=a.toNode,null===b||d.contains(b)||d.remove(a)):d.remove(a));return d};
ma.Object.defineProperties(Rk.prototype,{diagram:{get:function(){return this.B}},copiesClipboardData:{get:function(){return this.v},set:function(a){this.v=a}},copiesConnectedLinks:{get:function(){return this.I},set:function(a){this.I=a}},deletesConnectedLinks:{get:function(){return this.cb},set:function(a){this.cb=a}},copiesTree:{get:function(){return this.Ka},
set:function(a){this.Ka=a}},deletesTree:{get:function(){return this.Pc},set:function(a){this.Pc=a}},copiesParentKey:{get:function(){return this.Ja},set:function(a){this.Ja=a}},copiesGroupKey:{get:function(){return this.T},set:function(a){this.T=a}},archetypeGroupData:{get:function(){return this.l},set:function(a){this.l=a}},memberValidation:{get:function(){return this.Ji},
set:function(a){this.Ji=a}},defaultScale:{get:function(){return this.diagram.defaultScale},set:function(a){this.diagram.defaultScale=a}},zoomFactor:{get:function(){return this.Gd},set:function(a){1<a||B("zoomFactor must be larger than 1.0, not: "+a);this.Gd=a}},isZoomToFitRestoreEnabled:{get:function(){return this.Bc},set:function(a){this.Bc=a}},scrollToPartPause:{get:function(){return this.Qc},
set:function(a){this.Qc=a}}});Rk.className="CommandHandler";vi=function(){return new Rk};
function Y(){Ya(this);this.F=4225027;this.tb=1;this.og=null;this.Qa="";this.dc=this.kb=null;this.la=(new J(NaN,NaN)).freeze();this.Uc=Sb;this.fg=Mb;this.eg=Rb;this.ob=new rd;this.Zh=new rd;this.cg=new rd;this.ya=this.jl=1;this.Yb=0;this.ze=Vk;this.ih=tc;this.pc=(new N(NaN,NaN,NaN,NaN)).freeze();this.xb=(new N(NaN,NaN,NaN,NaN)).freeze();this.qc=(new N(0,0,NaN,NaN)).freeze();this.O=this.sp=this.tp=null;this.Tk=this.yb=ad;this.Fp=0;this.Gp=1;this.Rg=0;this.yn=1;this.Zp=null;this.Mp=-Infinity;this.Vl=
0;this.Wl=Hb;this.Xl=bg;this.oi="";this.eb=this.N=null;this.Xk=-1;this.Zl=this.pd=this.ni=this.cm=null;this.Rs=yg;this.Ip=this.Mg=this.Yj=null}var vd,yg,Ag,Vk,Wk,Xk,Yk,Zk,$k,al;
Y.prototype.cloneProtected=function(a){a.F=this.F|6144;a.tb=this.tb;a.Qa=this.Qa;a.kb=this.kb;a.dc=this.dc;a.Mg=this.Mg;a.la.assign(this.la);a.Uc=this.Uc.G();a.fg=this.fg.G();a.eg=this.eg.G();a.cg=this.cg.copy();a.ya=this.ya;a.Yb=this.Yb;a.ze=this.ze;a.ih=this.ih.G();a.pc.assign(this.pc);a.xb.assign(this.xb);a.qc.assign(this.qc);a.sp=this.sp;null!==this.O&&(a.O=this.O.copy());a.yb=this.yb.G();a.Tk=this.Tk.G();a.Fp=this.Fp;a.Gp=this.Gp;a.Rg=this.Rg;a.yn=this.yn;a.Zp=this.Zp;a.Mp=this.Mp;a.Vl=this.Vl;
a.Wl=this.Wl.G();a.Xl=this.Xl;a.oi=this.oi;null!==this.N&&(a.N=this.N.copy());a.eb=this.eb;a.Xk=this.Xk;null!==this.ni&&(a.ni=Ba(this.ni));null!==this.pd&&(a.pd=this.pd.copy());a.Zl=this.Zl};Y.prototype.Rx=function(a){var b=this.ni;if(Aa(b))for(var c=0;c<b.length;c++){if(b[c]===a)return}else this.ni=b=[];b.push(a)};Y.prototype.yf=function(a){a.tp=null;a.Yj=null;a.o()};
Y.prototype.clone=function(){var a=new this.constructor;this.cloneProtected(a);if(null!==this.ni)for(var b=0;b<this.ni.length;b++){var c=this.ni[b];a[c]=this[c]}return a};Y.prototype.copy=function(){return this.clone()};t=Y.prototype;t.hb=function(a){a.classType===S?0===a.name.indexOf("Orient")?this.segmentOrientation=a:B("Unknown Link enum value for GraphObject.segmentOrientation property: "+a):a.classType===Y&&(this.stretch=a)};t.toString=function(){return Ia(this.constructor)+"#"+mb(this)};
function bl(a){null===a.N&&(a.N=new cl)}t.Jc=function(){if(null===this.O){var a=new dl;a.ah=vc;a.Ch=vc;a.Zg=10;a.Ah=10;a.$g=0;a.Bh=0;this.O=a}};
t.ab=function(a,b,c,d,e,f,g){var h=this.part;if(null!==h&&(h.Jk(a,b,c,d,e,f,g),c===this&&a===ve&&el(this)&&fl(this,h,b),f=this.diagram,null===this.Mg||null===f||!f.oj||f.undoManager.isUndoingRedoing||f.currentTool!==f.toolManager||f.animationManager.sn||(a=this.Mg.get(b),null!==a&&f.animationManager.isEnabled&&!f.animationManager.isTicking&&(null===this.Ip&&(this.Ip=new H),g=0===f.undoManager.transactionLevel,a.startCondition===fi?g=!0:a.startCondition===hi&&(g=!1),g?(f=new ph,gi(a,f),g=this.Ip.get(a),
null!==g&&g.stop(),this.Ip.add(a,f),f.xv=this,f.Mx=a,f.add(this,b,d,e),f.start()):(Dh(f.animationManager,"Trigger"),f.animationManager.defaultAnimation.add(this,b,d,e)))),this instanceof X&&c===h&&0!==(h.F&16777216)&&null!==h.data))for(c=this.W.j,d=c.length,e=0;e<d;e++)h=c[e],h instanceof X&&Fj(h,function(a){null!==a.data&&0!==(a.F&16777216)&&a.Ca(b)})};
function fl(a,b,c){var d=a.ij();if(null!==d)for(var e=a.eb.iterator;e.next();){var f=e.value,g=null;if(null!==f.sourceName){g=gl(f,d,a);if(null===g)continue;f.lr(a,g,c,null)}else if(f.isToModel){var h=b.diagram;null===h||h.skipsModelSourceBindings||f.lr(a,h.model.modelData,c,d)}else{h=d.data;if(null===h)continue;var k=b.diagram;null===k||k.skipsModelSourceBindings||f.lr(a,h,c,d)}g===a&&(h=d.Ht(f.vj),null!==h&&f.Rw(h,g,c))}}t.Ht=function(a){return this.Xk===a?this:null};
t.g=function(a,b,c){this.ab(ve,a,this,b,c)};function hl(a,b,c,d,e){var f=a.pc,g=a.cg;g.reset();il(a,g,b,c,d,e);a.cg=g;f.h(b,c,d,e);g.Tt()||g.Ow(f)}function jl(a,b,c,d){if(!1===a.pickable)return!1;d.multiply(a.transform);return c?a.Lc(b,d):a.Jh(b,d)}
t.oy=function(a,b,c){if(!1===this.pickable)return!1;var d=this.naturalBounds;b=a.Fe(b);return c?Cb(a.x,a.y,0,0,0,d.height)<=b||Cb(a.x,a.y,0,d.height,d.width,d.height)<=b||Cb(a.x,a.y,d.width,d.height,d.width,0)<=b||Cb(a.x,a.y,d.width,0,0,0)<=b:a.kd(0,0)<=b&&a.kd(0,d.height)<=b&&a.kd(d.width,0)<=b&&a.kd(d.width,d.height)<=b};t.de=function(){return!0};
t.aa=function(a){var b=J.alloc();b.assign(a);this.transform.sa(b);var c=this.actualBounds;if(!c.u())return J.free(b),!1;var d=this.diagram;if(null!==d&&d.ne){var e=d.xm("extraTouchThreshold"),f=d.xm("extraTouchArea"),g=f/2,h=this.naturalBounds;d=this.Af()*d.scale;var k=1/d;if(h.width*d<e&&h.height*d<e)return a=gc(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 He||this instanceof W?gc(c.x-5,c.y-5,c.width+10,c.height+10,b.x,b.y):c.aa(b))this.pd&&!this.pd.aa(b)?
e=!1:null!==this.dc&&c.aa(b)?e=!0:null!==this.kb&&this.qc.aa(a)?e=!0:e=this.Kh(a);J.free(b);return e};t.Kh=function(a){var b=this.naturalBounds;return gc(0,0,b.width,b.height,a.x,a.y)};
t.De=function(a){if(0===this.angle)return this.actualBounds.De(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.aa(c.Zd(e))&&(e.h(a.x,a.bottom),b.aa(c.Zd(e))&&(e.h(a.right,a.bottom),b.aa(c.Zd(e))&&(e.h(a.right,a.y),b.aa(c.Zd(e))&&(d=!0))));J.free(e);N.free(b);return d};
t.Jh=function(a,b){if(void 0===b)return a.De(this.actualBounds);var c=this.naturalBounds,d=!1,e=J.allocAt(0,0);a.aa(b.sa(e))&&(e.h(0,c.height),a.aa(b.sa(e))&&(e.h(c.width,c.height),a.aa(b.sa(e))&&(e.h(c.width,0),a.aa(b.sa(e))&&(d=!0))));J.free(e);return d};
t.Lc=function(a,b){if(void 0===b&&(b=this.transform,0===this.angle))return a.Lc(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.aa(b.sa(d))||a.aa(b.sa(e))||a.aa(b.sa(f))||a.aa(b.sa(g)))h=!0;else{c=N.allocAt(0,0,c.width,c.height);var k=J.allocAt(a.x,a.y);c.aa(b.Zd(k))?h=!0:(k.h(a.x,a.bottom),c.aa(b.Zd(k))?h=!0:(k.h(a.right,a.bottom),c.aa(b.Zd(k))?h=!0:(k.h(a.right,a.y),c.aa(b.Zd(k))&&(h=!0))));J.free(k);
N.free(c);!h&&(K.Qt(a,d,e)||K.Qt(a,e,f)||K.Qt(a,f,g)||K.Qt(a,g,d))&&(h=!0)}J.free(d);J.free(e);J.free(f);J.free(g);return h};t.ga=function(a,b){void 0===b&&(b=new J);if(a instanceof P){var c=this.naturalBounds;b.h(a.x*c.width+a.offsetX,a.y*c.height+a.offsetY)}else b.set(a);this.Ad.sa(b);return b};
t.wm=function(a){void 0===a&&(a=new N);var b=this.naturalBounds,c=this.Ad,d=J.allocAt(0,0).transform(c);a.h(d.x,d.y,0,0);d.h(b.width,0).transform(c);fc(a,d.x,d.y,0,0);d.h(b.width,b.height).transform(c);fc(a,d.x,d.y,0,0);d.h(0,b.height).transform(c);fc(a,d.x,d.y,0,0);J.free(d);return a};t.lj=function(){var a=this.Ad;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.Af=function(){if(0!==(this.F&4096)===!1)return this.jl;var a=this.ya;return null!==this.panel?a*this.panel.Af():a};t.Nt=function(a,b){void 0===b&&(b=new J);b.assign(a);this.Ad.Zd(b);return b};t.bd=function(a,b,c){return this.vk(a.x,a.y,b.x,b.y,c)};
t.vk=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.bd(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.bd(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!==sj(this)){var e=this.ih,f=e.right+e.left;e=e.top+e.bottom;a=Math.max(a-f,0);b=Math.max(b-e,0);c=Math.max((c||0)-f,0);d=Math.max((d||0)-e,0);f=this.angle;e=this.desiredSize;var g=0;this instanceof W&&(g=this.strokeWidth);90===f||270===f?(a=isFinite(e.height)?e.height+g:a,b=isFinite(e.width)?e.width+g:b):(a=isFinite(e.width)?e.width+g:a,b=isFinite(e.height)?e.height+g:b);e=c||0;g=d||0;var h=this instanceof X;switch(kl(this,!0)){case yg:g=e=0;h&&(b=a=Infinity);
break;case vd: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.pc.ea();this.Dm(a,b,c,d);this.pc.freeze();this.pc.u()||B("Non-real measuredBounds has been set. Object "+this+", measuredBounds: "+this.pc.toString());nj(this,!1)}};Y.prototype.Dm=function(){};Y.prototype.Ef=function(){return!1};
Y.prototype.arrange=function(a,b,c,d,e){this.zl();var f=N.alloc();f.assign(this.xb);this.xb.ea();!1===tj(this)?this.xb.h(a,b,c,d):this.Ih(a,b,c,d);this.xb.freeze();void 0===e?this.pd=null:this.pd=e;c=!1;if(void 0!==e)c=!0;else if(e=this.panel,null===e||e.type!==X.TableRow&&e.type!==X.TableColumn||(e=e.panel),null!==e&&(e=e.qc,d=this.measuredBounds,null!==this.areaBackground&&(d=this.xb),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 Vg&&(a=this.naturalBounds,
this.ws>a.height||this.sb>a.width)))c=!0;this.F=c?this.F|256:this.F&-257;this.xb.u()||B("Non-real actualBounds has been set. Object "+this+", actualBounds: "+this.xb.toString());this.cu(f,this.xb);ll(this,!1);N.free(f)};t=Y.prototype;t.Ih=function(){};
function ml(a,b,c,d,e){a.xb.h(b,c,d,e);if(!a.desiredSize.u()){var f=a.pc;c=a.ih;b=c.right+c.left;var g=c.top+c.bottom;c=f.width+b;f=f.height+g;d+=b;e+=g;b=kl(a,!0);c===d&&f===e&&(b=yg);switch(b){case yg:if(c>d||f>e)nj(a,!0),a.measure(c>d?d:c,f>e?e:f,0,0);break;case vd:nj(a,!0);a.measure(d,e,0,0);break;case Wk:nj(a,!0);a.measure(d,f,0,0);break;case Xk:nj(a,!0),a.measure(c,e,0,0)}}}
t.cu=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.M(),ac(a,b)||(c.Oh(),this.ip(c)))};t.ip=function(a){null!==this.portId&&(nl(a,!0),a instanceof V&&ol(a,this))};
t.bc=function(a,b){if(this.visible){var c=this instanceof X&&(this.type===X.TableRow||this.type===X.TableColumn),d=this.xb;if(c||0!==d.width&&0!==d.height&&!isNaN(d.x)&&!isNaN(d.y)){var e=this.opacity;if(0!==e){var f=1;1!==e&&(f=a.globalAlpha,a.globalAlpha=f*e);if(!this.iy(a,b))if(c)pl(this,a,b);else{this instanceof S&&this.Bk(!1);c=this.transform;var g=this.panel;0!==(this.F&4096)===!0&&ql(this);var h=this.part,k=!1,l=0;if(h&&b.Ge("drawShadows")&&(k=h.isShadowed)){var m=h.shadowOffset;l=Math.max(m.y,
m.x)*b.scale*b.Sb}if(!(m=b.xi||!this.Ef())){var n=this.naturalBounds;m=this.Zh;var p=m.m11,r=m.m21,q=m.dx,u=m.m12,v=m.m22,w=m.dy,y,z=y=0;m=y*p+z*r+q;var A=y*u+z*v+w;y=n.width+l;z=0;var C=y*p+z*r+q;y=y*u+z*v+w;z=Math.min(m,C);var G=Math.min(A,y);var L=Math.max(m+0,C)-z;var I=Math.max(A+0,y)-G;m=z;A=G;y=n.width+l;z=n.height+l;C=y*p+z*r+q;y=y*u+z*v+w;z=Math.min(m,C);G=Math.min(A,y);L=Math.max(m+L,C)-z;I=Math.max(A+I,y)-G;m=z;A=G;y=0;z=n.height+l;C=y*p+z*r+q;y=y*u+z*v+w;z=Math.min(m,C);G=Math.min(A,y);
L=Math.max(m+L,C)-z;I=Math.max(A+I,y)-G;m=z;A=G;l=b.viewportBounds;n=l.x;p=l.y;m=!(m>l.width+n||n>L+m||A>l.height+p||p>I+A)}if(m){m=0!==(this.F&256);a.clipInsteadOfFill&&(m=!1);this instanceof Vg&&(a.font=this.font);if(m){A=g.de()?g.naturalBounds:g.actualBounds;null!==this.pd?(n=this.pd,L=n.x,I=n.y,l=n.width,n=n.height):(L=Math.max(d.x,A.x),I=Math.max(d.y,A.y),l=Math.min(d.right,A.right)-L,n=Math.min(d.bottom,A.bottom)-I);if(L>d.width+d.x||d.x>A.width+A.x){1!==e&&(a.globalAlpha=f);return}a.save();
a.beginPath();a.rect(L,I,l,n);a.clip()}if(this.Ef()){if(!h.isVisible()){1!==e&&(a.globalAlpha=f);return}k&&(A=h.shadowOffset,a.Hw(A.x*b.scale*b.Sb,A.y*b.scale*b.Sb,h.shadowBlur),rl(a),a.shadowColor=h.shadowColor)}!0===this.shadowVisible?rl(a):!1===this.shadowVisible&&sl(a);h=this.naturalBounds;null!==this.dc&&(li(this,a,this.dc,!0,!0,h,d),this.dc instanceof tl&&this.dc.type===ul?(a.beginPath(),a.rect(d.x,d.y,d.width,d.height),a.Yd(this.dc)):a.fillRect(d.x,d.y,d.width,d.height));a.transform(c.m11,
c.m12,c.m21,c.m22,c.dx,c.dy);k&&(null!==g&&0!==(g.F&512)||null!==g&&(g.type===X.Auto||g.type===X.Spot)&&g.pb()!==this)&&null===this.shadowVisible&&sl(a);null!==this.kb&&(l=this.naturalBounds,L=A=0,I=l.width,l=l.height,n=0,this instanceof W&&(l=this.na.bounds,A=l.x,L=l.y,I=l.width,l=l.height,n=this.strokeWidth),li(this,a,this.kb,!0,!1,h,d),this.kb instanceof tl&&this.kb.type===ul?(a.beginPath(),a.rect(A-n/2,L-n/2,I+n,l+n),a.Yd(this.kb)):a.fillRect(A-n/2,L-n/2,I+n,l+n));k&&(null!==this.kb||null!==this.dc||
null!==g&&0!==(g.F&512)||null!==g&&(g.type===X.Auto||g.type===X.Spot)&&g.pb()!==this)?(vl(this,!0),null===this.shadowVisible&&sl(a)):vl(this,!1);this.ej(a,b);k&&0!==(this.F&512)===!0&&rl(a);this.Ef()&&k&&sl(a);m?(a.restore(),this instanceof X?a.tc(!0):a.tc(!1)):c.Tt()||(b=1/(c.m11*c.m22-c.m12*c.m21),a.transform(c.m22*b,-c.m12*b,-c.m21*b,c.m11*b,b*(c.m21*c.dy-c.m22*c.dx),b*(c.m12*c.dx-c.m11*c.dy)))}}1!==e&&(a.globalAlpha=f)}}}};t.iy=function(){return!1};
function pl(a,b,c){var d=a.xb,e=a.qc;null!==a.dc&&(li(a,b,a.dc,!0,!0,e,d),a.dc instanceof tl&&a.dc.type===ul?(b.beginPath(),b.rect(d.x,d.y,d.width,d.height),b.Yd(a.dc)):b.fillRect(d.x,d.y,d.width,d.height));null!==a.kb&&(li(a,b,a.kb,!0,!1,e,d),a.kb instanceof tl&&a.kb.type===ul?(b.beginPath(),b.rect(d.x,d.y,d.width,d.height),b.Yd(a.kb)):b.fillRect(d.x,d.y,d.width,d.height));a.ej(b,c)}t.ej=function(){};
function li(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===wl)d?b.fillStyle=c.color:b.strokeStyle=c.color;else{var l=0;a instanceof W&&(l=a.strokeWidth);h=f.width;k=f.height;e?(h=g.width,k=g.height):d||(h+=l,k+=l);if((f=b instanceof xl)&&c.ge&&(c.type===yl||c.$k===h&&c.zu===k))var m=c.ge;else{var n=0,p=0,r=0,q=0,u=0,v=0;v=u=0;e?(u=g.x,v=g.y):d||(u-=l/2,v-=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+=v;q+=v;if(c.type===zl)m=b.createLinearGradient(n,p,r,q);else if(c.type===ul)v=isNaN(c.endRadius)?Math.max(h,k)/2:c.endRadius,isNaN(c.startRadius)?(u=0,v=Math.max(h,k)/2):u=c.startRadius,m=b.createRadialGradient(n,p,u,r,q,v);else if(c.type===yl)try{m=b.createPattern(c.pattern,"repeat")}catch(y){m=null}if(c.type!==yl&&(e=c.colorStops,null!==e))for(e=e.iterator;e.next();)m.addColorStop(e.key,e.value);if(f&&(c.ge=m,null!==m&&(c.$k=h,c.zu=k),null===m&&c.type===yl&&
-1!==c.$k)){c.$k=-1;var w=a.diagram;null!==w&&-1===c.$k&&sa(function(){w.Je()},600)}}d?b.fillStyle=m:b.strokeStyle=m}}}t.Gg=function(a){if(a instanceof X)a:{if(this!==a&&null!==a)for(var b=this.panel;null!==b;){if(b===a){a=!0;break a}b=b.panel}a=!1}else a=!1;return a};t.Ff=function(){if(!this.visible)return!1;var a=this.panel;return null!==a?a.Ff():!0};t.Hg=function(){for(var a=this instanceof X?this:this.panel;null!==a&&a.isEnabled;)a=a.panel;return null===a};
function ql(a){if(0!==(a.F&2048)===!0){var b=a.ob;b.reset();if(!a.xb.u()||!a.pc.u()){Al(a,!1);return}b.translate(a.xb.x-a.pc.x,a.xb.y-a.pc.y);if(1!==a.scale||0!==a.angle){var c=a.naturalBounds;il(a,b,c.x,c.y,c.width,c.height)}Al(a,!1);Bl(a,!0)}0!==(a.F&4096)===!0&&(b=a.panel,null===b?(a.Zh.set(a.ob),a.jl=a.scale,Bl(a,!1)):null!==b.Ad&&(c=a.Zh,c.reset(),b.de()?c.multiply(b.Zh):null!==b.panel&&c.multiply(b.panel.Zh),c.multiply(a.ob),a.jl=a.scale*b.jl,Bl(a,!1)))}
function il(a,b,c,d,e,f){1!==a.scale&&b.scale(a.scale);if(0!==a.Yb){var g=Bc;a.Ef()&&a.locationSpot.ib()&&(g=a.locationSpot);var h=J.alloc();if(a instanceof U&&a.locationObject!==a)for(c=a.locationObject,d=c.naturalBounds,h.Lk(d.x,d.y,d.width,d.height,g),c.cg.sa(h),h.offset(-c.measuredBounds.x,-c.measuredBounds.y),g=c.panel;null!==g&&g!==a;)g.cg.sa(h),h.offset(-g.measuredBounds.x,-g.measuredBounds.y),g=g.panel;else h.Lk(c,d,e,f,g);b.rotate(a.Yb,h.x,h.y);J.free(h)}}
t.o=function(a){void 0===a&&(a=!1);if(!0!==sj(this)){nj(this,!0);ll(this,!0);var b=this.panel;null===b||a||b.o()}};t.zm=function(){!0!==sj(this)&&(nj(this,!0),ll(this,!0))};function Cl(a){if(!1===tj(a)){var b=a.panel;null!==b?b.o():a.Ef()&&(b=a.diagram,null!==b&&(b.rd.add(a),a instanceof V&&a.md(),b.Db()));ll(a,!0)}}t.zl=function(){0!==(this.F&2048)===!1&&(Al(this,!0),Bl(this,!0))};t.cw=function(){Bl(this,!0)};t.M=function(){var a=this.part;null!==a&&a.M()};
function kl(a,b){var c=a.stretch,d=a.panel;if(null!==d&&d.type===X.Table)return Dl(a,d.getRowDefinition(a.row),d.getColumnDefinition(a.column),b);if(null!==d&&d.type===X.Auto&&d.pb()===a)return El(a,vd,b);if(c===Vk){if(null!==d){if(d.type===X.Spot&&d.pb()===a)return El(a,vd,b);c=d.defaultStretch;return c===Vk?El(a,yg,b):El(a,c,b)}return El(a,yg,b)}return El(a,c,b)}
function Dl(a,b,c,d){var e=a.stretch;if(e!==Vk)return El(a,e,d);var f=e=null;switch(b.stretch){case Xk:f=!0;break;case vd:f=!0}switch(c.stretch){case Wk:e=!0;break;case vd:e=!0}b=a.panel.defaultStretch;null===e&&(e=b===Wk||b===vd);null===f&&(f=b===Xk||b===vd);return!0===e&&!0===f?El(a,vd,d):!0===e?El(a,Wk,d):!0===f?El(a,Xk,d):El(a,yg,d)}
function El(a,b,c){if(c)return b;if(b===yg)return yg;c=a.desiredSize;if(c.u())return yg;a=a.angle;if(!isNaN(c.width))if(90!==a&&270!==a){if(b===Wk)return yg;if(b===vd)return Xk}else{if(b===Xk)return yg;if(b===vd)return Wk}if(!isNaN(c.height))if(90!==a&&270!==a){if(b===Xk)return yg;if(b===vd)return Wk}else{if(b===Wk)return yg;if(b===vd)return Xk}return b}function vl(a,b){a.F=b?a.F|512:a.F&-513}function el(a){return 0!==(a.F&1024)}function Fl(a,b){a.F=b?a.F|1024:a.F&-1025}
function Al(a,b){a.F=b?a.F|2048:a.F&-2049}function Bl(a,b){a.F=b?a.F|4096:a.F&-4097}function sj(a){return 0!==(a.F&8192)}function nj(a,b){a.F=b?a.F|8192:a.F&-8193}function tj(a){return 0!==(a.F&16384)}function ll(a,b){a.F=b?a.F|16384:a.F&-16385}t.rj=function(a){this.og=a};t.lu=function(){};t.Dw=function(a){this.la.assign(a);Cl(this);return!0};t.fr=function(a,b){if(this.la.x!==a||this.la.y!==b)this.la.h(a,b),this.zl()};
function Gl(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 Hl(a){var b=a.diagram;null===b||b.undoManager.isUndoingRedoing||(a instanceof X?a instanceof V?a.md():a.Zm(a,function(a){Gl(a)}):Gl(a))}t.bind=function(a){a.jd=this;var b=this.ij();null!==b&&Il(b)&&B("Cannot add a Binding to a template that has already been copied: "+a);null===this.eb&&(this.eb=new E);this.eb.add(a)};
t.ij=function(){for(var a=this instanceof X?this:this.panel;null!==a;){if(null!==a.li)return a;a=a.panel}return null};t.Ew=function(a){zj(this,a)};function Jl(a,b){b.jd=a;null===a.Mg&&(a.Mg=new H);a.Mg.add(b.propertyName,b)}
function Kl(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=Ll.H(a);"function"===typeof f?(c=Ba(arguments),d=f(c),ya(d)||B('GraphObject.make invoked object builder "'+a+'", but it did not return an Object')):e=x.go[a]}null===d&&(void 0!==e&&null!==e&&e.constructor||B("GraphObject.make requires a class function or GoJS class name or name of an object builder, not: "+a),d=new e);e=1;if(d instanceof Q&&1<c.length){f=
d;var g=c[1];if("string"===typeof g||g instanceof HTMLDivElement)Hi(f,g),e++}for(;e<c.length;e++)f=c[e],void 0===f?B("Undefined value at argument "+e+" for object being constructed by GraphObject.make: "+d):Ml(d,f);return d}
function Ml(a,b){if("string"===typeof b)if(a instanceof Vg)a.text=b;else if(a instanceof W)a.figure=b;else if(a instanceof Zj)a.source=b;else if(a instanceof X)b=Nl.H(b),null!==b&&(a.type=b);else if(a instanceof tl){var c=Za(tl,b);null!==c?a.type=c:B("Unknown Brush type as an argument to GraphObject.make: "+b)}else a instanceof td?(b=Za(td,b),null!==b&&(a.type=b)):a instanceof pe&&(b=Za(pe,b),null!==b&&(a.type=b));else if(b instanceof Y)a instanceof X||B("A GraphObject can only be added to a Panel, not to: "+
a),a.add(b);else if(b instanceof Tj){var d;b.isRow&&"function"===typeof a.getRowDefinition?d=a.getRowDefinition(b.index):b.isRow||"function"!==typeof a.getColumnDefinition||(d=a.getColumnDefinition(b.index));d instanceof Tj?d.Dt(b):B("A RowColumnDefinition can only be added to an object that implements getRowDefinition/getColumnDefinition, not to: "+a)}else if(b instanceof D)"function"===typeof a.hb&&a.hb(b);else if(b instanceof Ol)a.type=b;else if(b instanceof Li)a instanceof Y?a.bind(b):a instanceof
Tj?a.bind(b):B("A Binding can only be applied to a GraphObject or RowColumnDefinition, not to: "+a);else if(b instanceof di)a instanceof Y?Jl(a,b):B("An AnimationTrigger can only be applied to a GraphObject, not to: "+a);else if(b instanceof he)a instanceof td?a.figures.add(b):B("A PathFigure can only be added to a Geometry, not to: "+a);else if(b instanceof pe)a instanceof he?a.segments.add(b):B("A PathSegment can only be added to a PathFigure, not to: "+a);else if(b instanceof yi)a instanceof Q?
a.layout=b:a instanceof vf?a.layout=b:B("A Layout can only be assigned to a Diagram or a Group, not to: "+a);else if(Array.isArray(b))for(c=0;c<b.length;c++)Ml(a,b[c]);else if("object"===typeof b&&null!==b)if(a instanceof tl){c=new ab;for(var e in b)d=parseFloat(e),isNaN(d)?c[e]=b[e]:a.addColorStop(d,b[e]);zj(a,c)}else if(a instanceof Tj){void 0!==b.row?(e=b.row,(void 0===e||null===e||Infinity===e||isNaN(e)||0>e)&&B("Must specify non-negative integer row for RowColumnDefinition "+b+", not: "+e),a.isRow=
!0,a.index=e):void 0!==b.column&&(e=b.column,(void 0===e||null===e||Infinity===e||isNaN(e)||0>e)&&B("Must specify non-negative integer column for RowColumnDefinition "+b+", not: "+e),a.isRow=!1,a.index=e);e=new ab;for(c in b)"row"!==c&&"column"!==c&&(e[c]=b[c]);zj(a,e)}else zj(a,b);else B('Unknown initializer "'+b+'" for object being constructed by GraphObject.make: '+a)}function Pl(a,b){Ll.add(a,b)}
function Ql(a,b,c){void 0===c&&(c=null);var d=a[1];if("function"===typeof c?c(d):"string"===typeof d)return a.splice(1,1),d;if(void 0===b)throw Error("no "+("function"===typeof c?"satisfactory":"string")+" argument for GraphObject builder "+a[0]);return b}
ma.Object.defineProperties(Y.prototype,{shadowVisible:{get:function(){return this.Zl},set:function(a){var b=this.Zl;b!==a&&(this.Zl=a,this.M(),this.g("shadowVisible",b,a))}},enabledChanged:{get:function(){return null!==this.N?this.N.Vn:null},set:function(a){bl(this);var b=this.N.Vn;b!==a&&(this.N.Vn=a,this.g("enabledChanged",b,a))}},segmentOrientation:{get:function(){return this.Xl},set:function(a){var b=this.Xl;
b!==a&&(this.Xl=a,this.o(),this.g("segmentOrientation",b,a),a===bg&&(this.angle=0))}},segmentIndex:{get:function(){return this.Mp},set:function(a){a=Math.round(a);var b=this.Mp;b!==a&&(this.Mp=a,this.o(),this.g("segmentIndex",b,a))}},segmentFraction:{get:function(){return this.Vl},set:function(a){isNaN(a)?a=0:0>a?a=0:1<a&&(a=1);var b=this.Vl;b!==a&&(this.Vl=a,this.o(),this.g("segmentFraction",b,a))}},segmentOffset:{
get:function(){return this.Wl},set:function(a){var b=this.Wl;b.w(a)||(this.Wl=a=a.G(),this.o(),this.g("segmentOffset",b,a))}},stretch:{get:function(){return this.ze},set:function(a){var b=this.ze;b!==a&&(this.ze=a,this.o(),this.g("stretch",b,a))}},name:{get:function(){return this.Qa},set:function(a){var b=this.Qa;b!==a&&(this.Qa=a,null!==this.part&&(this.part.Uj=null),this.g("name",b,a))}},opacity:{get:function(){return this.tb},
set:function(a){var b=this.tb;b!==a&&((0>a||1<a)&&va(a,"0 <= value <= 1",Y,"opacity"),this.tb=a,this.g("opacity",b,a),a=this.diagram,b=this.part,null!==a&&null!==b&&a.M(Dj(b,b.actualBounds)))}},visible:{get:function(){return 0!==(this.F&1)},set:function(a){var b=0!==(this.F&1);b!==a&&(this.F^=1,this.g("visible",b,a),b=this.panel,null!==b?b.o():this.Ef()&&this.Ob(a),this.M(),Hl(this))}},pickable:{get:function(){return 0!==(this.F&2)},set:function(a){var b=
0!==(this.F&2);b!==a&&(this.F^=2,this.g("pickable",b,a))}},fromLinkableDuplicates:{get:function(){return 0!==(this.F&4)},set:function(a){var b=0!==(this.F&4);b!==a&&(this.F^=4,this.g("fromLinkableDuplicates",b,a))}},fromLinkableSelfNode:{get:function(){return 0!==(this.F&8)},set:function(a){var b=0!==(this.F&8);b!==a&&(this.F^=8,this.g("fromLinkableSelfNode",b,a))}},toLinkableDuplicates:{get:function(){return 0!==
(this.F&16)},set:function(a){var b=0!==(this.F&16);b!==a&&(this.F^=16,this.g("toLinkableDuplicates",b,a))}},toLinkableSelfNode:{get:function(){return 0!==(this.F&32)},set:function(a){var b=0!==(this.F&32);b!==a&&(this.F^=32,this.g("toLinkableSelfNode",b,a))}},isPanelMain:{get:function(){return 0!==(this.F&64)},set:function(a){var b=0!==(this.F&64);b!==a&&(this.F^=64,this.o(),this.g("isPanelMain",b,a))}},isActionable:{
get:function(){return 0!==(this.F&128)},set:function(a){var b=0!==(this.F&128);b!==a&&(this.F^=128,this.g("isActionable",b,a))}},areaBackground:{get:function(){return this.dc},set:function(a){var b=this.dc;b!==a&&(null!==a&&Rl(a,"GraphObject.areaBackground"),a instanceof tl&&a.freeze(),this.dc=a,this.M(),this.g("areaBackground",b,a))}},background:{get:function(){return this.kb},set:function(a){var b=this.kb;b!==a&&(null!==a&&Rl(a,"GraphObject.background"),
a instanceof tl&&a.freeze(),this.kb=a,this.M(),this.g("background",b,a))}},part:{get:function(){if(this.Ef())return this;if(null!==this.Yj)return this.Yj;var a;for(a=this.panel;a;){if(a instanceof U)return this.Yj=a;a=a.panel}return null}},svg:{get:function(){return this.eq},set:function(a){this.eq=a}},panel:{get:function(){return this.og}},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.la},set:function(a){var b=a.x,c=a.y,d=this.la,e=d.x,f=d.y;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))?this.lu():(a=a.copy(),this.Dw(a,d)&&this.g("position",d.copy(),a.copy()))}},actualBounds:{get:function(){return this.xb}},scale:{
get:function(){return this.ya},set:function(a){var b=this.ya;b!==a&&(0>=a&&B("GraphObject.scale for "+this+" must be greater than zero, not: "+a),this.ya=a,this.o(),this.g("scale",b,a))}},angle:{get:function(){return this.Yb},set:function(a){var b=this.Yb;b!==a&&(a%=360,0>a&&(a+=360),b!==a&&(this.Yb=a,Hl(this),this.o(),this.g("angle",b,a)))}},desiredSize:{get:function(){return this.Uc},set:function(a){var b=a.width,c=a.height,d=this.Uc,e=
d.width,f=d.height;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))||(this.Uc=a=a.G(),this.o(),this instanceof W&&this.cc(),this.g("desiredSize",d,a),el(this)&&(a=this.part,null!==a&&(fl(this,a,"width"),fl(this,a,"height"))))}},width:{get:function(){return this.Uc.width},set:function(a){var b=this.Uc.width;b===a||isNaN(b)&&isNaN(a)||(b=this.Uc,this.Uc=a=(new M(a,this.Uc.height)).freeze(),this.o(),this instanceof W&&this.cc(),this.g("desiredSize",b,a),el(this)&&
(a=this.part,null!==a&&fl(this,a,"width")))}},height:{get:function(){return this.Uc.height},set:function(a){var b=this.Uc.height;b===a||isNaN(b)&&isNaN(a)||(b=this.Uc,this.Uc=a=(new M(this.Uc.width,a)).freeze(),this.o(),this instanceof W&&this.cc(),this.g("desiredSize",b,a),el(this)&&(a=this.part,null!==a&&fl(this,a,"height")))}},minSize:{get:function(){return this.fg},set:function(a){var b=this.fg;b.w(a)||(a=a.copy(),isNaN(a.width)&&(a.width=
0),isNaN(a.height)&&(a.height=0),a.freeze(),this.fg=a,this.o(),this.g("minSize",b,a))}},maxSize:{get:function(){return this.eg},set:function(a){var b=this.eg;b.w(a)||(a=a.copy(),isNaN(a.width)&&(a.width=Infinity),isNaN(a.height)&&(a.height=Infinity),a.freeze(),this.eg=a,this.o(),this.g("maxSize",b,a))}},measuredBounds:{get:function(){return this.pc}},naturalBounds:{get:function(){return this.qc}},margin:{
get:function(){return this.ih},set:function(a){"number"===typeof a&&(a=new pc(a));var b=this.ih;b.w(a)||(this.ih=a=a.G(),this.o(),this.g("margin",b,a))}},transform:{get:function(){0!==(this.F&2048)===!0&&ql(this);return this.ob}},Ad:{get:function(){0!==(this.F&4096)===!0&&ql(this);return this.Zh}},alignment:{get:function(){return this.yb},set:function(a){var b=this.yb;b.w(a)||(a.mc()&&!a.Mb()&&
B("GraphObject.alignment for "+this+" must be a real Spot or Spot.Default, not: "+a),this.yb=a=a.G(),Cl(this),this.g("alignment",b,a))}},column:{get:function(){return this.Rg},set:function(a){a=Math.round(a);var b=this.Rg;b!==a&&(0>a&&va(a,">= 0",Y,"column"),this.Rg=a,this.o(),this.g("column",b,a))}},columnSpan:{get:function(){return this.yn},set:function(a){a=Math.round(a);var b=this.yn;b!==a&&(1>a&&va(a,">= 1",Y,"columnSpan"),this.yn=a,
this.o(),this.g("columnSpan",b,a))}},row:{get:function(){return this.Fp},set:function(a){a=Math.round(a);var b=this.Fp;b!==a&&(0>a&&va(a,">= 0",Y,"row"),this.Fp=a,this.o(),this.g("row",b,a))}},rowSpan:{get:function(){return this.Gp},set:function(a){a=Math.round(a);var b=this.Gp;b!==a&&(1>a&&va(a,">= 1",Y,"rowSpan"),this.Gp=a,this.o(),this.g("rowSpan",b,a))}},spanAllocation:{get:function(){return this.Zp},set:function(a){var b=
this.Zp;b!==a&&(this.Zp=a,this.o(),this.g("spanAllocation",b,a))}},alignmentFocus:{get:function(){return this.Tk},set:function(a){var b=this.Tk;b.w(a)||(this.Tk=a=a.G(),this.o(),this.g("alignmentFocus",b,a))}},portId:{get:function(){return this.sp},set:function(a){var b=this.sp;if(b!==a){var c=this.part;null===c||c instanceof V||(B("Cannot set portID on a Link: "+a),c=null);null!==b&&null!==c&&Sl(c,this);this.sp=a;null!==a&&null!==c&&(c.Nh=
!0,Tl(c,this));this.g("portId",b,a)}}},toSpot:{get:function(){return null!==this.O?this.O.Ch:vc},set:function(a){this.Jc();var b=this.O.Ch;b.w(a)||(a=a.G(),this.O.Ch=a,this.g("toSpot",b,a),Gl(this))}},toEndSegmentLength:{get:function(){return null!==this.O?this.O.Ah:10},set:function(a){this.Jc();var b=this.O.Ah;b!==a&&(0>a&&va(a,">= 0",Y,"toEndSegmentLength"),this.O.Ah=a,this.g("toEndSegmentLength",b,a),Gl(this))}},toShortLength:{
get:function(){return null!==this.O?this.O.Bh:0},set:function(a){this.Jc();var b=this.O.Bh;b!==a&&(this.O.Bh=a,this.g("toShortLength",b,a),Gl(this))}},toLinkable:{get:function(){return null!==this.O?this.O.iq:null},set:function(a){this.Jc();var b=this.O.iq;b!==a&&(this.O.iq=a,this.g("toLinkable",b,a))}},toMaxLinks:{get:function(){return null!==this.O?this.O.jq:Infinity},set:function(a){this.Jc();var b=this.O.jq;b!==a&&(0>a&&
va(a,">= 0",Y,"toMaxLinks"),this.O.jq=a,this.g("toMaxLinks",b,a))}},fromSpot:{get:function(){return null!==this.O?this.O.ah:vc},set:function(a){this.Jc();var b=this.O.ah;b.w(a)||(a=a.G(),this.O.ah=a,this.g("fromSpot",b,a),Gl(this))}},fromEndSegmentLength:{get:function(){return null!==this.O?this.O.Zg:10},set:function(a){this.Jc();var b=this.O.Zg;b!==a&&(0>a&&va(a,">= 0",Y,"fromEndSegmentLength"),this.O.Zg=a,this.g("fromEndSegmentLength",
b,a),Gl(this))}},fromShortLength:{get:function(){return null!==this.O?this.O.$g:0},set:function(a){this.Jc();var b=this.O.$g;b!==a&&(this.O.$g=a,this.g("fromShortLength",b,a),Gl(this))}},fromLinkable:{get:function(){return null!==this.O?this.O.bo:null},set:function(a){this.Jc();var b=this.O.bo;b!==a&&(this.O.bo=a,this.g("fromLinkable",b,a))}},fromMaxLinks:{get:function(){return null!==this.O?this.O.co:Infinity},
set:function(a){this.Jc();var b=this.O.co;b!==a&&(0>a&&va(a,">= 0",Y,"fromMaxLinks"),this.O.co=a,this.g("fromMaxLinks",b,a))}},cursor:{get:function(){return this.oi},set:function(a){var b=this.oi;b!==a&&(this.oi=a,this.g("cursor",b,a))}},click:{get:function(){return null!==this.N?this.N.Of:null},set:function(a){bl(this);var b=this.N.Of;b!==a&&(this.N.Of=a,this.g("click",b,a))}},doubleClick:{get:function(){return null!==
this.N?this.N.Tf:null},set:function(a){bl(this);var b=this.N.Tf;b!==a&&(this.N.Tf=a,this.g("doubleClick",b,a))}},contextClick:{get:function(){return null!==this.N?this.N.Pf:null},set:function(a){bl(this);var b=this.N.Pf;b!==a&&(this.N.Pf=a,this.g("contextClick",b,a))}},mouseEnter:{get:function(){return null!==this.N?this.N.hg:null},set:function(a){bl(this);var b=this.N.hg;b!==a&&(this.N.hg=a,this.g("mouseEnter",b,a))}},mouseLeave:{
get:function(){return null!==this.N?this.N.kg:null},set:function(a){bl(this);var b=this.N.kg;b!==a&&(this.N.kg=a,this.g("mouseLeave",b,a))}},mouseOver:{get:function(){return null!==this.N?this.N.lg:null},set:function(a){bl(this);var b=this.N.lg;b!==a&&(this.N.lg=a,this.g("mouseOver",b,a))}},mouseHover:{get:function(){return null!==this.N?this.N.jg:null},set:function(a){bl(this);var b=this.N.jg;b!==a&&(this.N.jg=a,this.g("mouseHover",
b,a))}},mouseHold:{get:function(){return null!==this.N?this.N.ig:null},set:function(a){bl(this);var b=this.N.ig;b!==a&&(this.N.ig=a,this.g("mouseHold",b,a))}},mouseDragEnter:{get:function(){return null!==this.N?this.N.Wo:null},set:function(a){bl(this);var b=this.N.Wo;b!==a&&(this.N.Wo=a,this.g("mouseDragEnter",b,a))}},mouseDragLeave:{get:function(){return null!==this.N?this.N.Xo:null},set:function(a){bl(this);
var b=this.N.Xo;b!==a&&(this.N.Xo=a,this.g("mouseDragLeave",b,a))}},mouseDrop:{get:function(){return null!==this.N?this.N.gg:null},set:function(a){bl(this);var b=this.N.gg;b!==a&&(this.N.gg=a,this.g("mouseDrop",b,a))}},actionDown:{get:function(){return null!==this.N?this.N.en:null},set:function(a){bl(this);var b=this.N.en;b!==a&&(this.N.en=a,this.g("actionDown",b,a))}},actionMove:{get:function(){return null!==
this.N?this.N.fn:null},set:function(a){bl(this);var b=this.N.fn;b!==a&&(this.N.fn=a,this.g("actionMove",b,a))}},actionUp:{get:function(){return null!==this.N?this.N.gn:null},set:function(a){bl(this);var b=this.N.gn;b!==a&&(this.N.gn=a,this.g("actionUp",b,a))}},actionCancel:{get:function(){return null!==this.N?this.N.dn:null},set:function(a){bl(this);var b=this.N.dn;b!==a&&(this.N.dn=a,this.g("actionCancel",b,a))}},toolTip:{
get:function(){return null!==this.N?this.N.wg:null},set:function(a){bl(this);var b=this.N.wg;b!==a&&(this.N.wg=a,this.g("toolTip",b,a))}},contextMenu:{get:function(){return null!==this.N?this.N.Qf:null},set:function(a){bl(this);var b=this.N.Qf;b!==a&&(this.N.Qf=a,this.g("contextMenu",b,a))}}});Y.prototype.setProperties=Y.prototype.Ew;Y.prototype.findTemplateBinder=Y.prototype.ij;Y.prototype.bind=Y.prototype.bind;Y.prototype.isEnabledObject=Y.prototype.Hg;
Y.prototype.isVisibleObject=Y.prototype.Ff;Y.prototype.isContainedBy=Y.prototype.Gg;Y.prototype.getNearestIntersectionPoint=Y.prototype.bd;Y.prototype.getLocalPoint=Y.prototype.Nt;Y.prototype.getDocumentScale=Y.prototype.Af;Y.prototype.getDocumentAngle=Y.prototype.lj;Y.prototype.getDocumentBounds=Y.prototype.wm;Y.prototype.getDocumentPoint=Y.prototype.ga;Y.prototype.intersectsRect=Y.prototype.Lc;Y.prototype.containedInRect=Y.prototype.Jh;Y.prototype.containsRect=Y.prototype.De;
Y.prototype.containsPoint=Y.prototype.aa;Y.prototype.raiseChanged=Y.prototype.g;Y.prototype.raiseChangedEvent=Y.prototype.ab;Y.prototype.addCopyProperty=Y.prototype.Rx;var Ll=null;Y.className="GraphObject";Ll=new H;
Pl("Button",function(){function a(a,b){return null!==a.diagram.Ub(a.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a},function(a){return a===b})}var b=Kl(X,X.Auto,{isActionable:!0,enabledChanged:function(a,b){if(a instanceof X){var c=a.$a("ButtonBorder");null!==c&&(c.fill=b?a._buttonFillNormal:a._buttonFillDisabled)}},cursor:"pointer",_buttonFillNormal:"#F5F5F5",_buttonStrokeNormal:"#BDBDBD",_buttonFillOver:"#E0E0E0",_buttonStrokeOver:"#9E9E9E",_buttonFillPressed:"#BDBDBD",
_buttonStrokePressed:"#9E9E9E",_buttonFillDisabled:"#E5E5E5"},Kl(W,{name:"ButtonBorder",figure:"RoundedRectangle",spot1:new P(0,0,2.76142374915397,2.761423749153969),spot2:new P(1,1,-2.76142374915397,-2.761423749153969),parameter1:2,parameter2:2,fill:"#F5F5F5",stroke:"#BDBDBD"}));b.mouseEnter=function(a,b){if(b.Hg()&&b instanceof X&&(a=b.$a("ButtonBorder"),a instanceof W)){var c=b._buttonFillOver;b._buttonFillNormal=a.fill;a.fill=c;c=b._buttonStrokeOver;b._buttonStrokeNormal=a.stroke;a.stroke=c}};
b.mouseLeave=function(a,b){b.Hg()&&b instanceof X&&(a=b.$a("ButtonBorder"),a instanceof W&&(a.fill=b._buttonFillNormal,a.stroke=b._buttonStrokeNormal))};b.actionDown=function(a,b){if(b.Hg()&&b instanceof X&&null!==b._buttonFillPressed&&0===a.button){var c=b.$a("ButtonBorder");if(c instanceof W){a=a.diagram;var d=a.skipsUndoManager;a.skipsUndoManager=!0;var g=b._buttonFillPressed;b._buttonFillOver=c.fill;c.fill=g;g=b._buttonStrokePressed;b._buttonStrokeOver=c.stroke;c.stroke=g;a.skipsUndoManager=d}}};
b.actionUp=function(b,d){if(d.Hg()&&d instanceof X&&null!==d._buttonFillPressed&&0===b.button){var c=d.$a("ButtonBorder");if(c instanceof W){var f=b.diagram,g=f.skipsUndoManager;f.skipsUndoManager=!0;a(b,d)?(c.fill=d._buttonFillOver,c.stroke=d._buttonStrokeOver):(c.fill=d._buttonFillNormal,c.stroke=d._buttonStrokeNormal);f.skipsUndoManager=g}}};b.actionCancel=function(b,d){if(d.Hg()&&d instanceof X&&null!==d._buttonFillPressed){var c=d.$a("ButtonBorder");if(c instanceof W){var f=b.diagram,g=f.skipsUndoManager;
f.skipsUndoManager=!0;a(b,d)?(c.fill=d._buttonFillOver,c.stroke=d._buttonStrokeOver):(c.fill=d._buttonFillNormal,c.stroke=d._buttonStrokeNormal);f.skipsUndoManager=g}}};b.actionMove=function(b,d){if(d.Hg()&&d instanceof X&&null!==d._buttonFillPressed){var c=b.diagram;if(0===c.firstInput.button&&(c.currentTool.standardMouseOver(),a(b,d)&&(b=d.$a("ButtonBorder"),b instanceof W))){var f=c.skipsUndoManager;c.skipsUndoManager=!0;var g=d._buttonFillPressed;b.fill!==g&&(b.fill=g);g=d._buttonStrokePressed;
b.stroke!==g&&(b.stroke=g);c.skipsUndoManager=f}}};return b});
Pl("TreeExpanderButton",function(){var a=Kl("Button",{_treeExpandedFigure:"MinusLine",_treeCollapsedFigure:"PlusLine"},Kl(W,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:Pb},(new Li("figure","isTreeExpanded",function(a,c){c=c.panel;return a?c._treeExpandedFigure:c._treeCollapsedFigure})).Uq()),{visible:!1},(new Li("visible","isTreeLeaf",function(a){return!a})).Uq());a.click=function(a,c){c=c.part;c instanceof He&&(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});
Pl("SubGraphExpanderButton",function(){var a=Kl("Button",{_subGraphExpandedFigure:"MinusLine",_subGraphCollapsedFigure:"PlusLine"},Kl(W,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:Pb},(new Li("figure","isSubGraphExpanded",function(a,c){c=c.panel;return a?c._subGraphExpandedFigure:c._subGraphCollapsedFigure})).Uq()));a.click=function(a,c){c=c.part;c instanceof He&&(c=c.adornedPart);if(c instanceof vf){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});Pl("ToolTip",function(){return Kl(He,X.Auto,{isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new J(0,3),shadowBlur:5},Kl(W,{name:"Border",figure:"RoundedRectangle",parameter1:1,parameter2:1,fill:"#F5F5F5",stroke:"#F0F0F0",spot1:new P(0,0,4,6),spot2:new P(1,1,-4,-4)}))});
Pl("ContextMenu",function(){return Kl(He,X.Vertical,{background:"#F5F5F5",isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new J(0,3),shadowBlur:5},new Li("background","",function(a){return null!==a.adornedPart&&null!==a.placeholder?null:"#F5F5F5"}))});Pl("ContextMenuButton",function(){var a=Kl("Button");a.stretch=Wk;var b=a.$a("ButtonBorder");b instanceof W&&(b.figure="Rectangle",b.strokeWidth=0,b.spot1=new P(0,0,2,3),b.spot2=new P(1,1,-2,-2));return a});
Pl("PanelExpanderButton",function(a){var b=Ql(a,"COLLAPSIBLE"),c=Kl("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},Kl(W,{name:"ButtonIcon",strokeWidth:2},(new Li("geometryString","visible",function(a){return a?c._buttonExpandedFigure:c._buttonCollapsedFigure})).Uq(b)));
a=c.$a("ButtonBorder");a instanceof W&&(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.ij();null===e&&(e=c.part);null!==e&&(c=e.$a(b),null!==c&&(a.handled=!0,d.va("Collapse/Expand Panel"),c.visible=!c.visible,d.Wa("Collapse/Expand Panel")))}};return c});
Pl("CheckBoxButton",function(a){var b=Ql(a);a=Kl("Button",{desiredSize:new M(14,14)},Kl(W,{name:"ButtonIcon",geometryString:"M0 0 M0 8.85 L4.9 13.75 16.2 2.45 M16.2 16.2",strokeWidth:2,stretch:vd,geometryStretch:Ag,visible:!1},""!==b?(new Li("visible",b)).Fy():[]));a.click=function(a,d){if(d instanceof X){var c=a.diagram;if(!(null===c||c.isReadOnly||""!==b&&c.model.isReadOnly)){a.handled=!0;var f=d.$a("ButtonIcon");c.va("checkbox");f.visible=!f.visible;"function"===typeof d._doClick&&d._doClick(a,
d);c.Wa("checkbox")}}};return a});
Pl("CheckBox",function(a){a=Ql(a);a=Kl("CheckBoxButton",a,{name:"Button",isActionable:!1,margin:new pc(0,1,0,0)});var b=Kl(X,"Horizontal",a,{isActionable:!0,cursor:a.cursor,margin:1,_buttonFillNormal:a._buttonFillNormal,_buttonStrokeNormal:a._buttonStrokeNormal,_buttonFillOver:a._buttonFillOver,_buttonStrokeOver:a._buttonStrokeOver,_buttonFillPressed:a._buttonFillPressed,_buttonStrokePressed:a._buttonStrokePressed,_buttonFillDisabled:a._buttonFillDisabled,mouseEnter:a.mouseEnter,mouseLeave:a.mouseLeave,
actionDown:a.actionDown,actionUp:a.actionUp,actionCancel:a.actionCancel,actionMove:a.actionMove,click:a.click,_buttonClick:a.click});a.mouseEnter=null;a.mouseLeave=null;a.actionDown=null;a.actionUp=null;a.actionCancel=null;a.actionMove=null;a.click=null;return b});Y.None=yg=new D(Y,"None",0);Y.Default=Vk=new D(Y,"Default",0);Y.Vertical=Xk=new D(Y,"Vertical",4);Y.Horizontal=Wk=new D(Y,"Horizontal",5);Y.Fill=vd=new D(Y,"Fill",3);Y.Uniform=Ag=new D(Y,"Uniform",1);
Y.UniformToFill=Yk=new D(Y,"UniformToFill",2);Y.FlipVertical=Zk=new D(Y,"FlipVertical",1);Y.FlipHorizontal=$k=new D(Y,"FlipHorizontal",2);Y.FlipBoth=al=new D(Y,"FlipBoth",3);Y.make=Kl;Y.getBuilders=function(){var a=new H,b;for(b in Ll)if(b!==b.toLowerCase()){var c=Ll.H(b);"function"===typeof c&&a.add(b,c)}a.freeze();return a};Y.defineBuilder=Pl;Y.takeBuilderArgument=Ql;
function cl(){this.Vn=this.Qf=this.wg=this.dn=this.gn=this.fn=this.en=this.gg=this.Xo=this.Wo=this.ig=this.jg=this.lg=this.kg=this.hg=this.Pf=this.Tf=this.Of=null}cl.prototype.copy=function(){var a=new cl;a.Of=this.Of;a.Tf=this.Tf;a.Pf=this.Pf;a.hg=this.hg;a.kg=this.kg;a.lg=this.lg;a.jg=this.jg;a.ig=this.ig;a.Wo=this.Wo;a.Xo=this.Xo;a.gg=this.gg;a.en=this.en;a.fn=this.fn;a.gn=this.gn;a.dn=this.dn;a.wg=this.wg;a.Qf=this.Qf;a.Vn=this.Vn;return a};cl.className="GraphObjectEventHandlers";
function Ul(){this.Ma=[1,0,0,1,0,0]}Ul.prototype.copy=function(){var a=new Ul;a.Ma[0]=this.Ma[0];a.Ma[1]=this.Ma[1];a.Ma[2]=this.Ma[2];a.Ma[3]=this.Ma[3];a.Ma[4]=this.Ma[4];a.Ma[5]=this.Ma[5];return a};Ul.prototype.translate=function(a,b){this.Ma[4]+=this.Ma[0]*a+this.Ma[2]*b;this.Ma[5]+=this.Ma[1]*a+this.Ma[3]*b};Ul.prototype.scale=function(a,b){this.Ma[0]*=a;this.Ma[1]*=a;this.Ma[2]*=b;this.Ma[3]*=b};Ul.className="STransform";
function Vl(a){this.type=a;this.r2=this.y2=this.x2=this.r1=this.y1=this.x1=0;this.Zx=[];this.pattern=null}Vl.prototype.addColorStop=function(a,b){this.Zx.push({offset:a,color:b})};Vl.className="SGradient";
function Cj(a,b){this.ownerDocument=a=void 0===b?x.document:b;this.HA="http://www.w3.org/2000/svg";void 0!==a&&(this.Ga=this.wb("svg",{width:"1px",height:"1px",viewBox:"0 0 1 1"}),this.Ga.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns","http://www.w3.org/2000/svg"),this.Ga.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"));this.Bq=null;this.context=new Wl(this)}
Cj.prototype.resize=function(a,b,c,d){return this.width!==a||this.height!==b?(this.style.width=c+"px",this.style.height=d+"px",this.Ga.setAttributeNS(null,"width",c+"px"),this.Ga.setAttributeNS(null,"height",d+"px"),this.Ga.setAttributeNS(null,"viewBox","0 0 "+c+" "+d),this.context.cv.firstElementChild.setAttributeNS(null,"width",c+"px"),this.context.cv.firstElementChild.setAttributeNS(null,"height",d+"px"),!0):!1};
Cj.prototype.wb=function(a,b,c){a=this.ownerDocument.createElementNS(this.HA,a);if(ya(b))for(var d in b)a.setAttributeNS("href"===d?"http://www.w3.org/1999/xlink":"",d,b[d]);void 0!==c&&(a.textContent=c);return a};Cj.prototype.getBoundingClientRect=function(){return this.Ga.getBoundingClientRect()};Cj.prototype.focus=function(){this.Ga.focus()};Cj.prototype.hy=function(){this.ownerDocument=null};
ma.Object.defineProperties(Cj.prototype,{width:{get:function(){return this.Ga.width.baseVal.value},set:function(a){this.Ga.width=a}},height:{get:function(){return this.Ga.height.baseVal.value},set:function(a){this.Ga.height=a}},style:{get:function(){return this.Ga.style}}});Cj.className="SVGSurface";
function Wl(a){this.Mk=a;this.svg=a.Ga;this.stack=[];this.zc=[];this.fillStyle="#000000";this.font="10px sans-serif";this.globalAlpha=1;this.lineCap="butt";this.lineDashOffset=0;this.lineJoin="miter";this.lineWidth=1;this.miterLimit=10;this.shadowBlur=0;this.shadowColor="rgba(0, 0, 0, 0)";this.shadowOffsetY=this.shadowOffsetX=0;this.strokeStyle="#000000";this.textAlign="start";this.clipInsteadOfFill=!1;this.jf=this.Vp=this.Up=0;this.Oq=null;this.path=[];this.Uu=!1;this.vh=null;this.wh=0;this.Xd=new Ul;
Xl(this,1,0,0,1,0,0);var b=qb++,c=this.wb("clipPath",{id:"mainClip"+b});c.appendChild(this.wb("rect",{x:0,y:0,width:a.width,height:a.height}));this.cv=c;this.Mk.Ga.appendChild(c);this.zc[0].setAttributeNS(null,"clip-path","url(#mainClip"+b+")");this.JA={}}t=Wl.prototype;
t.reset=function(){this.stack=[];this.zc=[];this.fillStyle="#000000";this.font="10px sans-serif";this.globalAlpha=1;this.lineCap="butt";this.lineDashOffset=0;this.lineJoin="miter";this.lineWidth=1;this.miterLimit=10;this.shadowBlur=0;this.shadowColor="rgba(0, 0, 0, 0)";this.shadowOffsetY=this.shadowOffsetX=0;this.strokeStyle="#000000";this.textAlign="start";this.clipInsteadOfFill=!1;this.jf=this.Vp=this.Up=0;this.Oq=null;this.path=[];this.Xd=new Ul;Xl(this,1,0,0,1,0,0);var a=qb++,b=this.wb("clipPath",
{id:"mainClip"+a});b.appendChild(this.wb("rect",{x:0,y:0,width:this.Mk.width,height:this.Mk.height}));this.cv=b;this.Mk.Ga.appendChild(b);this.zc[0].setAttributeNS(null,"clip-path","url(#mainClip"+a+")")};
t.arc=function(a,b,c,d,e,f,g,h){var k=2*Math.PI,l=k-1E-6,m=c*Math.cos(d),n=c*Math.sin(d),p=a+m,r=b+n,q=f?0:1;d=f?d-e:e-d;(1E-6<Math.abs(g-p)||1E-6<Math.abs(h-r))&&this.path.push(["L",p,+r]);0>d&&(d=d%k+k);d>l?(this.path.push(["A",c,c,0,1,q,a-m,b-n]),this.path.push(["A",c,c,0,1,q,p,r])):1E-6<d&&this.path.push(["A",c,c,0,+(d>=Math.PI),q,a+c*Math.cos(e),b+c*Math.sin(e)])};t.beginPath=function(){this.path=[]};t.bezierCurveTo=function(a,b,c,d,e,f){this.path.push(["C",a,b,c,d,e,f])};t.clearRect=function(){};
t.clip=function(){this.addPath("clipPath",this.path,this.Xd);this.addPath("clipPath",this.path,new Ul)};t.closePath=function(){this.path.push(["z"])};t.createLinearGradient=function(a,b,c,d){var e=new Vl("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.JA;if(c[b])return"url(#"+c[b]+")";var d="PATTERN"+qb++,e={x:0,y:0,width:a.width,height:a.height,href:b};a=this.wb("pattern",{width:a.width,height:a.height,id:d,patternUnits:"userSpaceOnUse"});a.appendChild(this.wb("image",e));this.svg.appendChild(a);c[b]=d;return"url(#"+d+")"};
t.createRadialGradient=function(a,b,c,d,e,f){var g=new Vl("radial");g.x1=a;g.y1=b;g.r1=c;g.x2=d;g.y2=e;g.r2=f;return g};
t.drawImage=function(a,b,c,d,e,f,g,h,k){var l="";a instanceof HTMLCanvasElement&&(l=a.toDataURL());a instanceof HTMLImageElement&&(l=a.getAttribute("src"));var m=a instanceof HTMLImageElement?a.naturalWidth:a.width,n=a instanceof HTMLImageElement?a.naturalHeight:a.height;void 0===d&&(f=b,g=c,h=d=m,k=e=n);d=d||0;e=e||0;f=f||0;g=g||0;h=h||0;k=k||0;a={x:0,y:0,width:m||d,height:n||e,href:l};K.$(d,h)&&K.$(e,k)?-1===l.toLowerCase().indexOf(".svg")&&-1===l.toLowerCase().indexOf("data:image/svg")&&(a.preserveAspectRatio=
"xMidYMid slice"):a.preserveAspectRatio="none";l="";h/=d;k/=e;if(0!==f||0!==g)l+=" translate("+f+", "+g+")";if(1!==h||1!==k)l+=" scale("+h+", "+k+")";if(0!==b||0!==c)l+=" translate("+-b+", "+-c+")";if(0!==b||0!==c||d!==m||e!==n)f="CLIP"+qb++,g=this.wb("clipPath",{id:f}),g.appendChild(this.wb("rect",{x:b,y:c,width:d,height:e})),this.svg.appendChild(g),a["clip-path"]="url(#"+f+")";Yl(this,"image",a,this.Xd,l);this.addElement("image",a)};t.fill=function(){this.addPath("fill",this.path,this.Xd)};
t.Yd=function(){this.clipInsteadOfFill?this.clip():this.fill()};t.fillRect=function(a,b,c,d){a=[a,b,c,d];a={x:a[0],y:a[1],width:a[2],height:a[3]};Yl(this,"fill",a,this.Xd);this.addElement("rect",a)};t.fillText=function(a,b,c){a=[a,b,c];b=this.textAlign;"left"===b?b="start":"right"===b?b="end":"center"===b&&(b="middle");b={x:a[1],y:a[2],style:"font: "+this.font,"text-anchor":b};Yl(this,"fill",b,this.Xd);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.Xd=this.stack.pop();this.path=this.stack.pop();var a=this.stack.pop();this.fillStyle=a.fillStyle;this.font=a.font;this.globalAlpha=a.globalAlpha;this.lineCap=a.lineCap;this.lineDashOffset=a.lineDashOffset;this.lineJoin=a.lineJoin;this.lineWidth=a.lineWidth;this.miterLimit=a.miterLimit;this.shadowBlur=a.shadowBlur;this.shadowColor=a.shadowColor;this.shadowOffsetX=a.shadowOffsetX;this.shadowOffsetY=a.shadowOffsetY;this.strokeStyle=a.strokeStyle;this.textAlign=a.textAlign};
t.save=function(){this.stack.push({fillStyle:this.fillStyle,font:this.font,globalAlpha:this.globalAlpha,lineCap:this.lineCap,lineDashOffset:this.lineDashOffset,lineJoin:this.lineJoin,lineWidth:this.lineWidth,miterLimit:this.miterLimit,shadowBlur:this.shadowBlur,shadowColor:this.shadowColor,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,strokeStyle:this.strokeStyle,textAlign:this.textAlign});for(var a=[],b=0;b<this.path.length;b++)a.push(this.path[b]);this.stack.push(a);this.stack.push(this.Xd.copy())};
t.setTransform=function(a,b,c,d,e,f){1===a&&0===b&&0===c&&1===d&&0===e&&0===f||Xl(this,a,b,c,d,e,f)};t.scale=function(a,b){this.Xd.scale(a,b)};t.translate=function(a,b){this.Xd.translate(a,b)};t.transform=function(){};t.stroke=function(){this.addPath("stroke",this.path,this.Xd)};t.uj=function(){this.clipInsteadOfFill||this.stroke()};t.wb=function(a,b,c){return this.Mk.wb(a,b,c)};
t.addElement=function(a,b,c){a=this.wb(a,b,c);0<this.zc.length?this.zc[this.zc.length-1].appendChild(a):this.svg.appendChild(a);return this.Oq=a};
function Yl(a,b,c,d,e){1!==a.globalAlpha&&(c.opacity=a.globalAlpha);"fill"===b?(a.fillStyle instanceof Vl?c.fill=Zl(a,a.fillStyle):/^rgba\(/.test(a.fillStyle)?(a=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(a.fillStyle),c.fill="rgb("+a[1]+","+a[2]+","+a[3]+")",c["fill-opacity"]=a[4]):c.fill=a.fillStyle,c.stroke="none"):"stroke"===b&&(c.fill="none",a.strokeStyle instanceof Vl?c.stroke=Zl(a,a.strokeStyle):/^rgba\(/.test(a.strokeStyle)?(b=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(a.strokeStyle),
c.stroke="rgb("+b[1]+","+b[2]+","+b[3]+")",c["stroke-opacity"]=b[4]):c.stroke=a.strokeStyle,c["stroke-width"]=a.lineWidth,c["stroke-linecap"]=a.lineCap,c["stroke-linejoin"]=a.lineJoin,c["stroke-miterlimit"]=a.miterLimit);d=d.Ma;d="matrix("+d[0]+", "+d[1]+", "+d[2]+", "+d[3]+", "+d[4]+", "+d[5]+")";void 0!==e&&(d+=e);c.transform=d}
function Zl(a,b){var c="GRAD"+qb++;if("linear"===b.type)var d=a.wb("linearGradient",{x1:b.x1,x2:b.x2,y1:b.y1,y2:b.y2,id:c,gradientUnits:"userSpaceOnUse"});else if("radial"===b.type)d=a.wb("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.Zx;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.wb("stop",f[e]));a.svg.appendChild(d);return"url(#"+c+")"}
t.addPath=function(a,b,c){for(var d=[],e=0;e<b.length;e++){var f=Ba(b[e]),g=[f.shift()];if("A"===g[0])g.push(f.shift()+","+f.shift(),f.shift(),f.shift()+","+f.shift(),f.shift()+","+f.shift());else for(;f.length;)g.push(f.shift()+","+f.shift());d.push(g.join(" "))}b={d:d.join(" ")};"stroke"===a&&this.Uu&&(b["stroke-dasharray"]=this.vh.toString(),b["stroke-dashoffset"]=this.wh);Yl(this,a,b,c);"clipPath"===a?(a="CLIP"+qb++,c=this.wb("clipPath",{id:a}),c.appendChild(this.wb("path",b)),this.svg.appendChild(c),
0<this.zc.length&&this.zc[this.zc.length-1].setAttributeNS(null,"clip-path","url(#"+a+")")):this.addElement("path",b)};function Xl(a,b,c,d,e,f,g){var h=new Ul;h.Ma=[b,c,d,e,f,g];b={};Yl(a,"g",b,h);h=a.addElement("g",b);a.zc.push(h)}
t.gr=function(){if(0!==this.shadowOffsetX||0!==this.shadowOffsetY||0!==this.shadowBlur){var a="SHADOW"+qb++,b=this.addElement("filter",{id:a,x:"-100%",y:"-100%",width:"300%",height:"300%"},null);var c=this.wb("feGaussianBlur",{"in":"SourceAlpha",result:"blur",uB:this.shadowBlur/2});var d=this.wb("feFlood",{"in":"blur",result:"flood","flood-color":this.shadowColor});var e=this.wb("feComposite",{"in":"flood",in2:"blur",operator:"in",result:"comp"});var f=this.wb("feOffset",{"in":"comp",result:"offsetBlur",
dx:this.shadowOffsetX,dy:this.shadowOffsetY});var g=this.wb("feMerge",{});g.appendChild(this.wb("feMergeNode",{"in":"offsetBlur"}));g.appendChild(this.wb("feMergeNode",{"in":"SourceGraphic"}));b.appendChild(c);b.appendChild(d);b.appendChild(e);b.appendChild(f);b.appendChild(g);0<this.zc.length&&this.zc[this.zc.length-1].setAttributeNS(null,"filter","url(#"+a+")")}};t.Hw=function(a,b,c){this.Up=a;this.Vp=b;this.jf=c};function sl(a){a.shadowOffsetX=0;a.shadowOffsetY=0;a.shadowBlur=0}
function rl(a){a.shadowOffsetX=a.Up;a.shadowOffsetY=a.Vp;a.shadowBlur=a.jf}t.Gt=function(a,b){this.Uu=!0;this.vh=a;this.wh=b};t.Et=function(){this.Uu=!1};t.tc=function(){};t.Py=function(){};Wl.prototype.rotate=function(){};Wl.prototype.getImageData=function(){return null};Wl.prototype.measureText=function(){return null};Wl.className="SVGContext";
Q.prototype.Zt=function(a){var b=new Cj(this,x.document);void 0===a&&(a=new ab);var c=this;return Bk(this,function(a,e){a=Ck(c,a,"SVG",b);a=null!==a?a.svg:null;return"function"===typeof e?(e(a),null):a},a)};Q.prototype.makeSvg=Q.prototype.Zt;Q.prototype.hw=function(a){return this.Zt(a)};Q.prototype.makeSVG=Q.prototype.hw;
Y.prototype.iy=function(a,b){if(!(a instanceof Wl))return!1;if(!this.visible)return!0;var c=null,d=a.Oq;if(this instanceof X&&(this.type===X.TableRow||this.type===X.TableColumn))return pl(this,a,b),!0;var e=this.xb;if(0===e.width||0===e.height||isNaN(e.x)||isNaN(e.y))return!0;var f=this.transform,g=this.panel;0!==(this.F&4096)===!0&&ql(this);var h=0!==(this.F&256),k=!1;this instanceof Vg&&(a.font=this.font);if(h){k=g.de()?g.naturalBounds:g.actualBounds;if(null!==this.pd){var l=this.pd;var m=l.x;var n=
l.y;var p=l.width;l=l.height}else m=Math.max(e.x,k.x),n=Math.max(e.y,k.y),p=Math.min(e.right,k.right)-m,l=Math.min(e.bottom,k.bottom)-n;if(m>e.width+e.x||e.x>k.width+k.x||n>e.height+e.y||e.y>k.height+k.y)return!0;k=!0;Xl(a,1,0,0,1,0,0);a.save();a.beginPath();a.rect(m,n,p,l);a.clip()}if(this.Ef()&&!this.isVisible())return!0;a.Xd.Ma=[1,0,0,1,0,0];(this instanceof Vg&&1<this.lineCount||this instanceof W&&1<this.geometry.figures.length)&&Xl(a,1,0,0,1,0,0);m=!1;this.Ef()&&this.isShadowed&&b.Ge("drawShadows")&&
(n=this.shadowOffset,a.Hw(n.x*b.scale*b.Sb,n.y*b.scale*b.Sb,this.shadowBlur),rl(a),a.shadowColor=this.shadowColor);n=!1;this.part&&b.Ge("drawShadows")&&(n=this.part.isShadowed);!0===this.shadowVisible?(rl(a),!1===m&&n&&(Xl(a,1,0,0,1,0,0),a.gr(),m=!0)):!1===this.shadowVisible&&sl(a);p=this.naturalBounds;null!==this.areaBackground&&(li(this,a,this.areaBackground,!0,!0,p,e),!1===m&&n&&(Xl(a,1,0,0,1,0,0),a.gr(),m=!0),this.areaBackground instanceof tl&&this.areaBackground.type===ul?(a.beginPath(),a.rect(e.x,
e.y,e.width,e.height),a.Yd(this.areaBackground)):a.fillRect(e.x,e.y,e.width,e.height));this instanceof X?Xl(a,f.m11,f.m12,f.m21,f.m22,f.dx,f.dy):a.Xd.Ma=[f.m11,f.m12,f.m21,f.m22,f.dx,f.dy];if(null!==this.background){!1===m&&n&&(Xl(a,1,0,0,1,0,0),a.gr(),m=!0);var r=this.naturalBounds;l=f=0;var q=r.width;r=r.height;var u=0;this instanceof W&&(r=this.geometry.bounds,f=r.x,l=r.y,q=r.width,r=r.height,u=this.strokeWidth);li(this,a,this.background,!0,!1,p,e);this.background instanceof tl&&this.background.type===
ul?(a.beginPath(),a.rect(f-u/2,l-u/2,q+u,r+u),a.Yd(this.background)):a.fillRect(f-u/2,l-u/2,q+u,r+u)}n&&(null!==this.background||null!==this.areaBackground||null!==g&&0!==(g.F&512)||null!==g&&(g.type===X.Auto||g.type===X.Spot)&&g.pb()!==this)?(vl(this,!0),null===this.shadowVisible&&sl(a)):vl(this,!1);this.ej(a,b);n&&0!==(this.F&512)===!0&&rl(a);this.Ef()&&n&&sl(a);h&&(a.restore(),k&&a.zc.pop());this instanceof X&&(c=a.zc.pop());!0===m&&a.zc.pop();if(this instanceof Vg&&1<this.lineCount||this instanceof
W&&1<this.geometry.figures.length)c=a.zc.pop();null!==a.Mk.Bq&&(null===c&&(d===a.Oq?(Xl(a,1,0,0,1,0,0),c=a.zc.pop()):c=a.Oq),a.Mk.Bq(this,c));this.svg=c;return!0};function Dk(a,b){this.ownerDocument=b=void 0===b?x.document:b;this.Bq=null;b=b.createElement("canvas");b.tabIndex=0;this.Ga=b;this.Ga.innerHTML="This text is displayed if your browser does not support the Canvas HTML element.";this.context=new xl(b);b.B=a}
Dk.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};Dk.prototype.toDataURL=function(a,b){return this.Ga.toDataURL(a,b)};Dk.prototype.getBoundingClientRect=function(){return this.Ga.getBoundingClientRect()};Dk.prototype.focus=function(){this.Ga.focus()};Dk.prototype.hy=function(){this.ownerDocument=this.Ga.B=null};
ma.Object.defineProperties(Dk.prototype,{width:{get:function(){return this.Ga.width},set:function(a){this.Ga.width=a}},height:{get:function(){return this.Ga.height},set:function(a){this.Ga.height=a}},style:{get:function(){return this.Ga.style}}});Dk.className="CanvasSurface";
function xl(a){a.getContext&&a.getContext("2d")||B("Browser does not support HTML Canvas Element");this.Y=a.getContext("2d");this.wu=this.yu=this.xu="";this.xn=!1;this.jf=this.Vp=this.Up=0}t=xl.prototype;t.Py=function(a){this.Y.imageSmoothingEnabled=a};t.arc=function(a,b,c,d,e,f){this.Y.arc(a,b,c,d,e,f)};t.beginPath=function(){this.Y.beginPath()};t.bezierCurveTo=function(a,b,c,d,e,f){this.Y.bezierCurveTo(a,b,c,d,e,f)};t.clearRect=function(a,b,c,d){this.Y.clearRect(a,b,c,d)};t.clip=function(){this.Y.clip()};
t.closePath=function(){this.Y.closePath()};t.createLinearGradient=function(a,b,c,d){return this.Y.createLinearGradient(a,b,c,d)};t.createPattern=function(a,b){return this.Y.createPattern(a,b)};t.createRadialGradient=function(a,b,c,d,e,f){return this.Y.createRadialGradient(a,b,c,d,e,f)};t.drawImage=function(a,b,c,d,e,f,g,h,k){void 0===d?this.Y.drawImage(a,b,c):this.Y.drawImage(a,b,c,d,e,f,g,h,k)};t.fill=function(){this.Y.fill()};t.fillRect=function(a,b,c,d){this.Y.fillRect(a,b,c,d)};
t.fillText=function(a,b,c){this.Y.fillText(a,b,c)};t.getImageData=function(a,b,c,d){return this.Y.getImageData(a,b,c,d)};t.lineTo=function(a,b){this.Y.lineTo(a,b)};t.measureText=function(a){return this.Y.measureText(a)};t.moveTo=function(a,b){this.Y.moveTo(a,b)};t.quadraticCurveTo=function(a,b,c,d){this.Y.quadraticCurveTo(a,b,c,d)};t.rect=function(a,b,c,d){this.Y.rect(a,b,c,d)};t.restore=function(){this.Y.restore()};xl.prototype.rotate=function(a){this.Y.rotate(a)};t=xl.prototype;t.save=function(){this.Y.save()};
t.setTransform=function(a,b,c,d,e,f){this.Y.setTransform(a,b,c,d,e,f)};t.scale=function(a,b){this.Y.scale(a,b)};t.stroke=function(){this.Y.stroke()};t.transform=function(a,b,c,d,e,f){1===a&&0===b&&0===c&&1===d&&0===e&&0===f||this.Y.transform(a,b,c,d,e,f)};t.translate=function(a,b){this.Y.translate(a,b)};
t.Yd=function(a){if(a instanceof tl&&a.type===ul){var b=a.$k;a=a.zu;a>b?(this.scale(b/a,1),this.translate((a-b)/2,0)):b>a&&(this.scale(1,a/b),this.translate(0,(b-a)/2));this.xn?this.clip():this.fill();a>b?(this.translate(-(a-b)/2,0),this.scale(1/(b/a),1)):b>a&&(this.translate(0,-(b-a)/2),this.scale(1,1/(a/b)))}else this.xn?this.clip():this.fill()};t.uj=function(){this.xn||this.stroke()};t.Hw=function(a,b,c){this.Up=a;this.Vp=b;this.jf=c};
t.Gt=function(a,b){var c=this.Y;void 0!==c.setLineDash&&(c.setLineDash(a),c.lineDashOffset=b)};t.Et=function(){var a=this.Y;void 0!==a.setLineDash&&(a.setLineDash($l),a.lineDashOffset=0)};t.tc=function(a){a&&(this.xu="");this.wu=this.yu=""};
ma.Object.defineProperties(xl.prototype,{fillStyle:{get:function(){return this.Y.fillStyle},set:function(a){this.wu!==a&&(this.wu=this.Y.fillStyle=a)}},font:{get:function(){return this.Y.font},set:function(a){this.xu!==a&&(this.xu=this.Y.font=a)}},globalAlpha:{get:function(){return this.Y.globalAlpha},set:function(a){this.Y.globalAlpha=a}},lineCap:{get:function(){return this.Y.lineCap},
set:function(a){this.Y.lineCap=a}},lineDashOffset:{get:function(){return this.Y.lineDashOffset},set:function(a){this.Y.lineDashOffset=a}},lineJoin:{get:function(){return this.Y.lineJoin},set:function(a){this.Y.lineJoin=a}},lineWidth:{get:function(){return this.Y.lineWidth},set:function(a){this.Y.lineWidth=a}},miterLimit:{get:function(){return this.Y.miterLimit},set:function(a){this.Y.miterLimit=
a}},shadowBlur:{get:function(){return this.Y.shadowBlur},set:function(a){this.Y.shadowBlur=a}},shadowColor:{get:function(){return this.Y.shadowColor},set:function(a){this.Y.shadowColor=a}},shadowOffsetX:{get:function(){return this.Y.shadowOffsetX},set:function(a){this.Y.shadowOffsetX=a}},shadowOffsetY:{get:function(){return this.Y.shadowOffsetY},set:function(a){this.Y.shadowOffsetY=
a}},strokeStyle:{get:function(){return this.Y.strokeStyle},set:function(a){this.yu!==a&&(this.yu=this.Y.strokeStyle=a)}},textAlign:{get:function(){return this.Y.textAlign},set:function(a){this.Y.textAlign=a}},imageSmoothingEnabled:{get:function(){return this.Y.imageSmoothingEnabled},set:function(a){this.Y.imageSmoothingEnabled=a}},clipInsteadOfFill:{get:function(){return this.xn},
set:function(a){this.xn=a}}});var $l=Object.freeze([]);xl.className="CanvasSurfaceContext";function am(){this.T=this.v=this.I=this.l=0}am.className="ColorNumbers";function tl(a){bm||(cm(),bm=!0);Ya(this);this.s=!1;void 0===a?(this.pa=wl,this.Zk="black"):"string"===typeof a?(this.pa=wl,this.Zk=a):(this.pa=a,this.Zk="black");a=this.pa;a===zl?(this.yd=yc,this.ll=Gc):this.ll=a===ul?this.yd=Bc:this.yd=vc;this.jt=0;this.Xr=NaN;this.ge=this.Ms=this.fe=null;this.zu=this.$k=0}
tl.prototype.copy=function(){var a=new tl;a.pa=this.pa;a.Zk=this.Zk;a.yd=this.yd.G();a.ll=this.ll.G();a.jt=this.jt;a.Xr=this.Xr;null!==this.fe&&(a.fe=this.fe.copy());a.Ms=this.Ms;return a};t=tl.prototype;t.freeze=function(){this.s=!0;null!==this.fe&&this.fe.freeze();return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.s=!1;null!==this.fe&&this.fe.ea();return this};t.hb=function(a){a.classType===tl&&(this.type=a)};
t.toString=function(){var a="Brush(";if(this.type===wl)a+=this.color;else if(a=this.type===zl?a+"Linear ":this.type===ul?a+"Radial ":this.type===yl?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.s&&ua(this);("number"!==typeof a||!isFinite(a)||1<a||0>a)&&va(a,"0 <= loc <= 1",tl,"addColorStop:loc");null===this.fe&&(this.fe=new H);this.fe.add(a,b);this.pa===wl&&(this.type=zl);this.ge=null;return this};
t.BA=function(a,b){this.s&&ua(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?dm:b;if(this.type===wl)Uh(this.color),this.color=em(a,b);else if((this.type===zl||this.type===ul)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)Uh(c.value),this.addColorStop(c.key,em(a,b));return this};function fm(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?dm:c;Uh(a);return em(b,c)}
t.Dz=function(a,b){this.s&&ua(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?dm:b;if(this.type===wl)Uh(this.color),this.color=em(-a,b);else if((this.type===zl||this.type===ul)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)Uh(c.value),this.addColorStop(c.key,em(-a,b));return this};function gm(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?dm:c;Uh(a);return em(-b,c)}
function hm(a,b,c){Uh(a);a=im.l;var d=im.I,e=im.v,f=im.T;Uh(b);void 0===c&&(c=.5);return"rgba("+Math.round((im.l-a)*c+a)+", "+Math.round((im.I-d)*c+d)+", "+Math.round((im.v-e)*c+e)+", "+Math.round((im.T-f)*c+f)+")"}
t.Cy=function(){if(this.type===wl)return jm(this.color);if((this.type===zl||this.type===ul)&&null!==this.colorStops){var a=this.colorStops;if(this.type===ul)return jm(a.first().value);if(null!==a.get(.5))return jm(a.get(.5));if(2===a.count)return a=a.ma(),jm(hm(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 jm(hm(a.get(c),a.get(d),1-f/e))}return!1};
function jm(a){if(!a)return!1;if(a instanceof tl)return a.Cy();Uh(a);return 128>(299*im.l+587*im.I+114*im.v)/1E3}
function em(a,b){switch(b){case dm:b=100*km(im.l);var c=100*km(im.I),d=100*km(im.v);lm.l=.4124564*b+.3575761*c+.1804375*d;lm.I=.2126729*b+.7151522*c+.072175*d;lm.v=.0193339*b+.119192*c+.9503041*d;lm.T=im.T;b=mm(lm.l/nm[0]);c=mm(lm.I/nm[1]);d=mm(lm.v/nm[2]);om.l=116*c-16;om.I=500*(b-c);om.v=200*(c-d);om.T=lm.T;om.l=Math.min(100,Math.max(0,om.l+100*a));a=(om.l+16)/116;b=a-om.v/200;lm.l=nm[0]*pm(om.I/500+a);lm.I=nm[1]*(om.l>qm*rm?Math.pow(a,3):om.l/qm);lm.v=nm[2]*pm(b);lm.T=om.T;a=-.969266*lm.l+1.8760108*
lm.I+.041556*lm.v;b=.0556434*lm.l+-.2040259*lm.I+1.0572252*lm.v;im.l=255*sm((3.2404542*lm.l+-1.5371385*lm.I+-.4985314*lm.v)/100);im.I=255*sm(a/100);im.v=255*sm(b/100);im.T=lm.T;im.l=Math.round(im.l);255<im.l?im.l=255:0>im.l&&(im.l=0);im.I=Math.round(im.I);255<im.I?im.I=255:0>im.I&&(im.I=0);im.v=Math.round(im.v);255<im.v?im.v=255:0>im.v&&(im.v=0);return"rgba("+im.l+", "+im.I+", "+im.v+", "+im.T+")";case tm:return Vh(),Wh.v=Math.min(100,Math.max(0,Wh.v+100*a)),"hsla("+Wh.l+", "+Wh.I+"%, "+Wh.v+"%, "+
Wh.T+")";default:return B("Unknown color space: "+b),"rgba(0, 0, 0, 1)"}}function Uh(a){bm||(cm(),bm=!0);var b=um;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,im.l=a[0],im.I=a[1],im.v=a[2],im.T=a[3]/255):(b.fillStyle="#FFFFFF",b.fillStyle=a,im.l=0,im.I=0,im.v=0,im.T=1)}}
function Vh(){var a=im.l/255,b=im.I/255,c=im.v/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.l=Math.round(g);Wh.I=Math.round(100*a);Wh.v=Math.round(100*e);Wh.T=im.T}function km(a){a/=255;return.04045>=a?a/12.92:Math.pow((a+.055)/1.055,2.4)}function sm(a){return.0031308>=a?12.92*a:1.055*Math.pow(a,1/2.4)-.055}
function mm(a){return a>rm?Math.pow(a,1/3):(qm*a+16)/116}function pm(a){var b=a*a*a;return b>rm?b:(116*a-16)/qm}function Rl(a,b){"string"!==typeof a&&(a instanceof tl||B("Value for "+b+" must be a color string or a Brush, not "+a))}function cm(){um=Tg?(new Dk(null)).context:null}
ma.Object.defineProperties(tl.prototype,{type:{get:function(){return this.pa},set:function(a){this.s&&ua(this,a);this.pa=a;this.start.mc()&&(a===zl?this.start=yc:a===ul&&(this.start=Bc));this.end.mc()&&(a===zl?this.end=Gc:a===ul&&(this.end=Bc));this.ge=null}},color:{get:function(){return this.Zk},set:function(a){this.s&&ua(this,a);this.Zk=a;this.ge=null}},start:{get:function(){return this.yd},set:function(a){this.s&&
ua(this,a);this.yd=a.G();this.ge=null}},end:{get:function(){return this.ll},set:function(a){this.s&&ua(this,a);this.ll=a.G();this.ge=null}},startRadius:{get:function(){return this.jt},set:function(a){this.s&&ua(this,a);0>a&&va(a,">= zero",tl,"startRadius");this.jt=a;this.ge=null}},endRadius:{get:function(){return this.Xr},set:function(a){this.s&&ua(this,a);0>a&&va(a,">= zero",tl,"endRadius");this.Xr=a;this.ge=
null}},colorStops:{get:function(){return this.fe},set:function(a){this.s&&ua(this,a);this.fe=a;this.ge=null}},pattern:{get:function(){return this.Ms},set:function(a){this.s&&ua(this,a);this.Ms=a;this.ge=null}}});tl.prototype.isDark=tl.prototype.Cy;tl.prototype.darkenBy=tl.prototype.Dz;tl.prototype.lightenBy=tl.prototype.BA;tl.prototype.addColorStop=tl.prototype.addColorStop;
var rm=216/24389,qm=24389/27,nm=[95.047,100,108.883],um=null,im=new am,Wh=new am,lm=new am,om=new am,bm=!1;tl.className="Brush";var wl;tl.Solid=wl=new D(tl,"Solid",0);var zl;tl.Linear=zl=new D(tl,"Linear",1);var ul;tl.Radial=ul=new D(tl,"Radial",2);var yl;tl.Pattern=yl=new D(tl,"Pattern",4);var dm;tl.Lab=dm=new D(tl,"Lab",5);var tm;tl.HSL=tm=new D(tl,"HSL",6);
tl.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};
tl.isValidColor=function(a){if("black"===a)return!0;if(""===a)return!1;bm||(cm(),bm=!0);var b=um;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};tl.lighten=function(a){return fm(a)};tl.lightenBy=fm;tl.darken=function(a){return gm(a)};tl.darkenBy=gm;tl.mix=hm;tl.isDark=jm;function Ol(){this.name="Base"}Ol.prototype.measure=function(){};
Ol.prototype.EA=function(a,b,c,d,e){a.measure(b,c,d,e)};Ol.prototype.arrange=function(){};Ol.prototype.qz=function(a,b,c,d,e,f){a.arrange(b,c,d,e,f)};Ol.prototype.bc=function(){};ma.Object.defineProperties(Ol.prototype,{classType:{get:function(){return X}}});Ol.prototype.arrangeElement=Ol.prototype.qz;Ol.prototype.measureElement=Ol.prototype.EA;Ol.className="PanelLayout";function vm(){this.name="Base"}la(vm,Ol);
vm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;a=wm(a);for(var k=0;k<h;k++){var l=d[k];if(l.visible||l===a){var m=l.margin,n=m.right+m.left;m=m.top+m.bottom;l.measure(b,c,f,g);var p=l.measuredBounds;n=Math.max(p.width+n,0);m=Math.max(p.height+m,0);p=l.position.x;var r=l.position.y;isFinite(p)||(p=0);isFinite(r)||(r=0);l instanceof W&&l.isGeometryPositioned&&(l=l.strokeWidth/2,p-=l,r-=l);fc(e,p,r,n,m)}}};
vm.prototype.arrange=function(a,b,c){var d=b.length,e=a.padding;a=c.x-e.left;c=c.y-e.top;for(e=0;e<d;e++){var f=b[e],g=f.measuredBounds,h=f.margin,k=f.position.x,l=f.position.y;k=isNaN(k)?-a:k-a;l=isNaN(l)?-c:l-c;if(f instanceof W&&f.isGeometryPositioned){var m=f.strokeWidth/2;k-=m;l-=m}f.visible&&f.arrange(k+h.left,l+h.top,g.width,g.height)}};function xm(){this.name="Base"}la(xm,Ol);
xm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;b=Ea();f=wm(a);for(var k=0;k<h;k++){var l=d[k];if(l.visible||l===f){var m=kl(l,!1);if(m!==yg&&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);Ha(b)};
xm.prototype.arrange=function(a,b,c){for(var d=b.length,e=a.padding,f=e.top,g=a.isOpposite,h=g?c.width:e.left,k=0;k<d;k++){var l=f,m=b[k];if(m.visible){var n=m.measuredBounds,p=m.margin,r=p.top+p.bottom,q=f+e.bottom,u=n.height,v=kl(m,!1);if(isNaN(m.desiredSize.height)&&v===vd||v===Xk)u=Math.max(c.height-r-q,0);r=u+r+q;q=m.alignment;q.Mb()&&(q=a.defaultAlignment);q.ib()||(q=Bc);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 ym(){this.name="Base"}la(ym,Ol);
ym.prototype.measure=function(a,b,c,d,e,f){var g=d.length;c=Ea();for(var h=wm(a),k=0;k<g;k++){var l=d[k];if(l.visible||l===h){var m=kl(l,!1);if(m!==yg&&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;Wb(e,Math.max(e.width,Math.max(l.width+m,0)),e.height+Math.max(l.height+n,0))}}}d=c.length;if(0!==d){a.desiredSize.width?b=Math.min(a.desiredSize.width,a.maxSize.width):0!==e.width&&(b=Math.min(e.width,a.maxSize.width));for(a=0;a<d;a++)if(k=
c[a],k.visible||k===h)l=k.margin,g=l.right+l.left,l=l.top+l.bottom,k.measure(b,Infinity,f,0),k=k.measuredBounds,l=Math.max(k.height+l,0),e.width=Math.max(e.width,Math.max(k.width+g,0)),e.height+=l;Ha(c)}};
ym.prototype.arrange=function(a,b,c){for(var d=b.length,e=a.padding,f=e.left,g=a.isOpposite,h=g?c.height:e.top,k=0;k<d;k++){var l=f,m=b[k];if(m.visible){var n=m.measuredBounds,p=m.margin,r=p.left+p.right,q=f+e.right,u=n.width,v=kl(m,!1);if(isNaN(m.desiredSize.width)&&v===vd||v===Wk)u=Math.max(c.width-r-q,0);r=u+r+q;q=m.alignment;q.Mb()&&(q=a.defaultAlignment);q.ib()||(q=Bc);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 zm(){this.name="Base"}la(zm,Ol);
zm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.pb(),l=k.margin,m=l.right+l.left,n=l.top+l.bottom;k.measure(b,c,f,g);var p=k.measuredBounds;f=p.width;g=p.height;var r=Math.max(f+m,0);var q=Math.max(g+n,0);for(var u=a.isClipping,v=N.allocAt(-l.left,-l.top,r,q),w=!0,y=wm(a),z=0;z<h;z++){var A=d[z];if(A!==k&&(A.visible||A===y)){l=A.margin;r=l.right+l.left;q=l.top+l.bottom;p=kl(A,!1);switch(p){case vd:b=f;c=g;break;case Wk:b=f;break;case Xk:c=g}A.measure(b,c,0,0);p=A.measuredBounds;r=
Math.max(p.width+r,0);q=Math.max(p.height+q,0);var C=A.alignment;C.Mb()&&(C=a.defaultAlignment);C.ib()||(C=Bc);var G=A.alignmentFocus;G.Mb()&&(G=Bc);var L=null;A instanceof X&&""!==A.Lg&&(A.arrange(0,0,p.width,p.height),L=A.$a(A.Lg),L===A&&(L=null));if(null!==L){l=L.naturalBounds;p=L.margin;for(l=J.allocAt(G.x*l.width-G.offsetX-p.left,G.y*l.height-G.offsetY-p.top);L!==A;)L.transform.sa(l),L=L.panel;A=C.x*f+C.offsetX-l.x;p=C.y*g+C.offsetY-l.y;J.free(l)}else A=C.x*f+C.offsetX-(G.x*p.width+G.offsetX)-
l.left,p=C.y*g+C.offsetY-(G.y*p.height+G.offsetY)-l.top;w?(w=!1,e.h(A,p,r,q)):fc(e,A,p,r,q)}}w?e.assign(v):u?e.aw(v.x,v.y,v.width,v.height):fc(e,v.x,v.y,v.width,v.height);N.free(v);p=k.stretch;p===Vk&&(p=kl(k,!1));switch(p){case yg:return;case vd: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);for(b=0;b<h;b++)c=d[b],c===
k||!c.visible&&c!==y||(l=c.margin,r=l.right+l.left,q=l.top+l.bottom,p=c.measuredBounds,r=Math.max(p.width+r,0),q=Math.max(p.height+q,0),m=c.alignment,m.Mb()&&(m=a.defaultAlignment),m.ib()||(m=Bc),c=c.alignmentFocus,c.Mb()&&(c=Bc),w?(w=!1,e.h(m.x*f+m.offsetX-(c.x*p.width+c.offsetX)-l.left,m.y*g+m.offsetY-(c.y*p.height+c.offsetY)-l.top,r,q)):fc(e,m.x*f+m.offsetX-(c.x*p.width+c.offsetX)-l.left,m.y*g+m.offsetY-(c.y*p.height+c.offsetY)-l.top,r,q));w?e.assign(v):u?e.aw(v.x,v.y,v.width,v.height):fc(e,v.x,
v.y,v.width,v.height);N.free(v)};
zm.prototype.arrange=function(a,b,c){var d=b.length,e=a.pb(),f=e.measuredBounds,g=f.width;f=f.height;var h=a.padding,k=h.left;h=h.top;var l=k-c.x,m=h-c.y;e.arrange(l,m,g,f);for(var n=0;n<d;n++){var p=b[n];if(p!==e){var r=p.measuredBounds,q=r.width;r=r.height;m=p.alignment;m.Mb()&&(m=a.defaultAlignment);m.ib()||(m=Bc);var u=p.alignmentFocus;u.Mb()&&(u=Bc);l=null;p instanceof X&&""!==p.Lg&&(l=p.$a(p.Lg),l===p&&(l=null));if(null!==l){var v=l.naturalBounds;for(u=J.allocAt(u.x*v.width-u.offsetX,u.y*v.height-
u.offsetY);l!==p;)l.transform.sa(u),l=l.panel;l=m.x*g+m.offsetX-u.x;m=m.y*f+m.offsetY-u.y;J.free(u)}else l=m.x*g+m.offsetX-(u.x*q+u.offsetX),m=m.y*f+m.offsetY-(u.y*r+u.offsetY);l-=c.x;m-=c.y;p.visible&&p.arrange(k+l,h+m,q,r)}}};function Am(){this.name="Base"}la(Am,Ol);
Am.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.pb(),l=k.margin,m=b,n=c,p=l.right+l.left,r=l.top+l.bottom;k.measure(b,c,f,g);l=k.measuredBounds;var q=0,u=null;k instanceof W&&(u=k,q=u.strokeWidth*u.scale);var v=Math.max(l.width+p,0);l=Math.max(l.height+r,0);var w=Bm(k),y=w.x*v+w.offsetX;w=w.y*l+w.offsetY;var z=Cm(k),A=z.x*v+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(w-z)-q,0));q=M.alloc();q.h(0,0);a=wm(a);for(z=0;z<h;z++)w=
d[z],w===k||!w.visible&&w!==a||(l=w.margin,v=l.right+l.left,y=l.top+l.bottom,w.measure(m,n,0,0),l=w.measuredBounds,v=Math.max(l.width+v,0),l=Math.max(l.height+y,0),q.h(Math.max(v,q.width),Math.max(l,q.height)));if(1===h)e.width=v,e.height=l,M.free(q);else{w=Bm(k);z=Cm(k);h=d=0;z.x!==w.x&&z.y!==w.y&&(d=q.width/Math.abs(z.x-w.x),h=q.height/Math.abs(z.y-w.y));M.free(q);q=0;null!==u&&(q=u.strokeWidth*u.scale,zg(u)===Ag&&(d=h=Math.max(d,h)));d+=Math.abs(w.offsetX)+Math.abs(z.offsetX)+q;h+=Math.abs(w.offsetY)+
Math.abs(z.offsetY)+q;u=k.stretch;u===Vk&&(u=kl(k,!1));switch(u){case yg:g=f=0;break;case vd: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.zm();k.measure(d,h,f,g);e.width=k.measuredBounds.width+p;e.height=k.measuredBounds.height+r}};
Am.prototype.arrange=function(a,b){var c=b.length,d=a.pb(),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=Bm(d),n=Cm(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;fc(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.Mb()&&(p=a.defaultAlignment),p.ib()||(p=Bc),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&&(gc(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 Dm(){this.name="Base";this.name="Table"}la(Dm,Ol);
Dm.prototype.measure=function(a,b,c,d,e,f,g){for(var h=d.length,k=Ea(),l=Ea(),m=0;m<h;m++){var n=d[m],p=n instanceof X?n:null;if(null===p||p.type!==X.TableRow&&p.type!==X.TableColumn||!n.visible)k.push(n);else{l.push(p);for(var r=p.W.j,q=r.length,u=0;u<q;u++){var v=r[u];p.type===X.TableRow?v.row=n.row:p.type===X.TableColumn&&(v.column=n.column);k.push(v)}}}h=k.length;0===h&&(a.getRowDefinition(0),a.getColumnDefinition(0));for(var w=[],y=0;y<h;y++){var z=k[y];nj(z,!0);ll(z,!0);w[z.row]||(w[z.row]=
[]);w[z.row][z.column]||(w[z.row][z.column]=[]);w[z.row][z.column].push(z)}Ha(k);var A=Ea(),C=Ea(),G=Ea(),L={count:0},I={count:0},T=b,R=c,ca=a.ub;h=ca.length;for(var qa=0;qa<h;qa++){var O=ca[qa];void 0!==O&&(O.actual=0)}ca=a.qb;h=ca.length;for(var za=0;za<h;za++)O=ca[za],void 0!==O&&(O.actual=0);for(var Ma=w.length,jb=0,Fa=0;Fa<Ma;Fa++)w[Fa]&&(jb=Math.max(jb,w[Fa].length));var yb=Math.min(a.topIndex,Ma-1),Ad=Math.min(a.leftIndex,jb-1),kb=0;Ma=w.length;for(var Zb=wm(a),bb=0;bb<Ma;bb++)if(w[bb]){jb=
w[bb].length;for(var Nd=a.getRowDefinition(bb),xc=Nd.actual=0;xc<jb;xc++)if(w[bb][xc]){var Bf=a.getColumnDefinition(xc);void 0===A[xc]&&(Bf.actual=0,A[xc]=!0);for(var bf=w[bb][xc],Ie=bf.length,qh=0;qh<Ie;qh++){var Ec=bf[qh];if(Ec.visible||Ec===Zb){var Cf=1<Ec.rowSpan||1<Ec.columnSpan;Cf&&(bb<yb||xc<Ad||C.push(Ec));var cf=Ec.margin,Od=cf.right+cf.left,bk=cf.top+cf.bottom;var Gb=Dl(Ec,Nd,Bf,!1);var Df=Ec.desiredSize,Bd=!isNaN(Df.height),lc=!isNaN(Df.width)&&Bd;Cf||Gb===yg||lc||bb<yb||xc<Ad||(void 0!==
L[xc]||Gb!==vd&&Gb!==Wk||(L[xc]=-1,L.count++),void 0!==I[bb]||Gb!==vd&&Gb!==Xk||(I[bb]=-1,I.count++),G.push(Ec));Ec.measure(Infinity,Infinity,0,0);if(!(bb<yb||xc<Ad)){var df=Ec.measuredBounds,Xc=Math.max(df.width+Od,0),dg=Math.max(df.height+bk,0);if(1===Ec.rowSpan&&(Gb===yg||Gb===Wk)){O=a.getRowDefinition(bb);var rh=O.vc();kb=Math.max(dg-O.actual,0);kb+rh>R&&(kb=Math.max(R-rh,0));var wn=0===O.actual;O.actual=O.actual+kb;R=Math.max(R-(kb+(wn?rh:0)),0)}if(1===Ec.columnSpan&&(Gb===yg||Gb===Xk)){O=a.getColumnDefinition(xc);
var eg=O.vc();kb=Math.max(Xc-O.actual,0);kb+eg>T&&(kb=Math.max(T-eg,0));var ck=0===O.actual;O.actual=O.actual+kb;T=Math.max(T-(kb+(ck?eg:0)),0)}Cf&&Ec.zm()}}}}}Ha(A);var $b=0,Pc=0;h=a.columnCount;for(var ec=0;ec<h;ec++){var fg=a.qb[ec];void 0!==fg&&($b+=fg.ha,0!==fg.ha&&($b+=fg.vc()))}h=a.rowCount;for(var sh=0;sh<h;sh++){var ef=a.ub[sh];void 0!==ef&&(Pc+=ef.ha,0!==ef.ha&&(Pc+=ef.vc()))}T=Math.max(b-$b,0);var Ai=R=Math.max(c-Pc,0),ie=T;h=G.length;for(var Je=0;Je<h;Je++){var mc=G[Je],dk=a.getRowDefinition(mc.row),
xn=a.getColumnDefinition(mc.column),gg=mc.measuredBounds,zb=mc.margin,hg=zb.right+zb.left,ek=zb.top+zb.bottom;L[mc.column]=0===xn.actual&&void 0!==L[mc.column]?Math.max(gg.width+hg,L[mc.column]):null;I[mc.row]=0===dk.actual&&void 0!==I[mc.row]?Math.max(gg.height+ek,I[mc.row]):null}var Bi=0,ig=0,Ef;for(Ef in I)"count"!==Ef&&(Bi+=I[Ef]);for(Ef in L)"count"!==Ef&&(ig+=L[Ef]);for(var cb=M.alloc(),jg=0;jg<h;jg++){var nc=G[jg];if(nc.visible||nc===Zb){var Fc=a.getRowDefinition(nc.row),db=a.getColumnDefinition(nc.column),
Cd=0;isFinite(db.width)?Cd=db.width:(isFinite(T)&&null!==L[nc.column]?0===ig?Cd=db.actual+T:Cd=L[nc.column]/ig*ie:null!==L[nc.column]?Cd=T:Cd=db.actual||T,Cd=Math.max(0,Cd-db.vc()));var Dd=0;isFinite(Fc.height)?Dd=Fc.height:(isFinite(R)&&null!==I[nc.row]?0===Bi?Dd=Fc.actual+R:Dd=I[nc.row]/Bi*Ai:null!==I[nc.row]?Dd=R:Dd=Fc.actual||R,Dd=Math.max(0,Dd-Fc.vc()));cb.h(Math.max(db.minimum,Math.min(Cd,db.maximum)),Math.max(Fc.minimum,Math.min(Dd,Fc.maximum)));Gb=Dl(nc,Fc,db,!1);switch(Gb){case Wk:cb.height=
Math.max(cb.height,Fc.actual+R);break;case Xk:cb.width=Math.max(cb.width,db.actual+T)}var Pd=nc.margin,yn=Pd.right+Pd.left,th=Pd.top+Pd.bottom;nc.zm();nc.measure(cb.width,cb.height,db.minimum,Fc.minimum);var uh=nc.measuredBounds,vh=Math.max(uh.width+yn,0),wh=Math.max(uh.height+th,0);isFinite(T)&&(vh=Math.min(vh,cb.width));isFinite(R)&&(wh=Math.min(wh,cb.height));var kg=0;kg=Fc.actual;Fc.actual=Math.max(Fc.actual,wh);kb=Fc.actual-kg;R=Math.max(R-kb,0);kg=db.actual;db.actual=Math.max(db.actual,vh);
kb=db.actual-kg;T=Math.max(T-kb,0)}}Ha(G);var Ed=M.alloc(),Yc=Ea(),je=Ea();h=C.length;if(0!==h)for(var Ab=0;Ab<Ma;Ab++)if(w[Ab]){jb=w[Ab].length;var Ci=a.getRowDefinition(Ab);Yc[Ab]=Ci.actual;for(var Zc=0;Zc<jb;Zc++)if(w[Ab][Zc]){var zn=a.getColumnDefinition(Zc);je[Zc]=zn.actual}}for(var ke=0;ke<h;ke++){var Na=C[ke];if(Na.visible||Na===Zb){var Fd=a.getRowDefinition(Na.row),oc=a.getColumnDefinition(Na.column);cb.h(Math.max(oc.minimum,Math.min(b,oc.maximum)),Math.max(Fd.minimum,Math.min(c,Fd.maximum)));
Gb=Dl(Na,Fd,oc,!1);switch(Gb){case vd:0!==je[oc.index]&&(cb.width=Math.min(cb.width,je[oc.index]));0!==Yc[Fd.index]&&(cb.height=Math.min(cb.height,Yc[Fd.index]));break;case Wk:0!==je[oc.index]&&(cb.width=Math.min(cb.width,je[oc.index]));break;case Xk:0!==Yc[Fd.index]&&(cb.height=Math.min(cb.height,Yc[Fd.index]))}isFinite(oc.width)&&(cb.width=oc.width);isFinite(Fd.height)&&(cb.height=Fd.height);Ed.h(0,0);for(var le=1;le<Na.rowSpan&&!(Na.row+le>=a.rowCount);le++)O=a.getRowDefinition(Na.row+le),kb=0,
kb=Gb===vd||Gb===Xk?Math.max(O.minimum,0===Yc[Na.row+le]?O.maximum:Math.min(Yc[Na.row+le],O.maximum)):Math.max(O.minimum,isNaN(O.Xc)?O.maximum:Math.min(O.Xc,O.maximum)),Ed.height+=kb;for(var me=1;me<Na.columnSpan&&!(Na.column+me>=a.columnCount);me++)O=a.getColumnDefinition(Na.column+me),kb=0,kb=Gb===vd||Gb===Wk?Math.max(O.minimum,0===je[Na.column+me]?O.maximum:Math.min(je[Na.column+me],O.maximum)):Math.max(O.minimum,isNaN(O.Xc)?O.maximum:Math.min(O.Xc,O.maximum)),Ed.width+=kb;cb.width+=Ed.width;cb.height+=
Ed.height;var xh=Na.margin,yh=xh.right+xh.left,Qd=xh.top+xh.bottom;Na.measure(cb.width,cb.height,f,g);for(var ne=Na.measuredBounds,Ke=Math.max(ne.width+yh,0),Le=Math.max(ne.height+Qd,0),oe=0,od=0;od<Na.rowSpan&&!(Na.row+od>=a.rowCount);od++)O=a.getRowDefinition(Na.row+od),oe+=O.total||0;if(oe<Le){var Ff=Le-oe,lg=Le-oe;if(null!==Na.spanAllocation)for(var An=Na.spanAllocation,zh=0;zh<Na.rowSpan&&!(0>=Ff)&&!(Na.row+zh>=a.rowCount);zh++){O=a.getRowDefinition(Na.row+zh);var Gd=O.ha||0,Di=An(Na,O,lg);O.actual=
Math.min(O.maximum,Gd+Di);O.ha!==Gd&&(Ff-=O.ha-Gd)}for(;0<Ff;){var Ah=O.ha||0;isNaN(O.height)&&O.maximum>Ah&&(O.actual=Math.min(O.maximum,Ah+Ff),O.ha!==Ah&&(Ff-=O.ha-Ah));if(0===O.index)break;O=a.getRowDefinition(O.index-1)}}for(var Bh=0,fk=0;fk<Na.columnSpan&&!(Na.column+fk>=a.columnCount);fk++)O=a.getColumnDefinition(Na.column+fk),Bh+=O.total||0;if(Bh<Ke){var Ei=Ke-Bh,Xt=Ke-Bh;if(null!==Na.spanAllocation)for(var Yt=Na.spanAllocation,gk=0;gk<Na.columnSpan&&!(0>=Ei)&&!(Na.column+gk>=a.columnCount);gk++){O=
a.getColumnDefinition(Na.column+gk);var Bn=O.ha||0,Zt=Yt(Na,O,Xt);O.actual=Math.min(O.maximum,Bn+Zt);O.ha!==Bn&&(Ei-=O.ha-Bn)}for(;0<Ei;){var hk=O.ha||0;isNaN(O.width)&&O.maximum>hk&&(O.actual=Math.min(O.maximum,hk+Ei),O.ha!==hk&&(Ei-=O.ha-hk));if(0===O.index)break;O=a.getColumnDefinition(O.index-1)}}}}Ha(C);M.free(Ed);M.free(cb);void 0!==Yc&&Ha(Yc);void 0!==je&&Ha(je);var mg=0,ng=0,ik=a.desiredSize,kr=a.maxSize;Gb=kl(a,!0);var Fi=Pc=$b=0,Gi=0;h=a.columnCount;for(var jk=0;jk<h;jk++)void 0!==a.qb[jk]&&
(O=a.getColumnDefinition(jk),isFinite(O.width)?(Fi+=O.width,Fi+=O.vc()):Em(O)===Fm?(Fi+=O.ha,Fi+=O.vc()):0!==O.ha&&($b+=O.ha,$b+=O.vc()));isFinite(ik.width)?mg=Math.min(ik.width,kr.width):mg=Gb!==yg&&isFinite(b)?b:$b;mg=Math.max(mg,a.minSize.width);mg=Math.max(mg-Fi,0);for(var $t=0===$b?1:Math.max(mg/$b,1),lk=0;lk<h;lk++)void 0!==a.qb[lk]&&(O=a.getColumnDefinition(lk),isFinite(O.width)||Em(O)===Fm||(O.actual=O.ha*$t),O.position=e.width,0!==O.ha&&(e.width+=O.ha,e.width+=O.vc()));h=a.rowCount;for(var mk=
0;mk<h;mk++)void 0!==a.ub[mk]&&(O=a.getRowDefinition(mk),isFinite(O.height)?(Gi+=O.height,Gi+=O.vc()):Em(O)===Fm?(Gi+=O.ha,Gi+=O.vc()):0!==O.ha&&(Pc+=O.ha,0!==O.ha&&(Pc+=O.vc())));isFinite(ik.height)?ng=Math.min(ik.height,kr.height):ng=Gb!==yg&&isFinite(c)?c:Pc;ng=Math.max(ng,a.minSize.height);ng=Math.max(ng-Gi,0);for(var au=0===Pc?1:Math.max(ng/Pc,1),nk=0;nk<h;nk++)void 0!==a.ub[nk]&&(O=a.getRowDefinition(nk),isFinite(O.height)||Em(O)===Fm||(O.actual=O.ha*au),O.position=e.height,0!==O.ha&&(e.height+=
O.ha,0!==O.ha&&(e.height+=O.vc())));h=l.length;for(var Cn=0;Cn<h;Cn++){var pd=l[Cn],Dn=0,En=0;pd.type===X.TableRow?(Dn=e.width,O=a.getRowDefinition(pd.row),En=O.actual):(O=a.getColumnDefinition(pd.column),Dn=O.actual,En=e.height);pd.measuredBounds.h(0,0,Dn,En);nj(pd,!1);w[pd.row]||(w[pd.row]=[]);w[pd.row][pd.column]||(w[pd.row][pd.column]=[]);w[pd.row][pd.column].push(pd)}Ha(l);a.Hp=w};
Dm.prototype.arrange=function(a,b,c){var d=b.length,e=a.padding,f=e.left;e=e.top;for(var g=a.Hp,h,k,l=g.length,m=0,n=0;n<l;n++)g[n]&&(m=Math.max(m,g[n].length));for(n=Math.min(a.topIndex,l-1);n!==l&&(void 0===a.ub[n]||0===a.ub[n].ha);)n++;n=Math.min(n,l-1);n=-a.ub[n].position;for(h=Math.min(a.leftIndex,m-1);h!==m&&(void 0===a.qb[h]||0===a.qb[h].ha);)h++;h=Math.min(h,m-1);for(var p=-a.qb[h].position,r=M.alloc(),q=0;q<l;q++)if(g[q]){m=g[q].length;var u=a.getRowDefinition(q);k=u.position+n+e;0!==u.ha&&
(k+=u.Iv());for(var v=0;v<m;v++)if(g[q][v]){var w=a.getColumnDefinition(v);h=w.position+p+f;0!==w.ha&&(h+=w.Iv());for(var y=g[q][v],z=y.length,A=0;A<z;A++){var C=y[A],G=C.measuredBounds,L=C instanceof X?C:null;if(null===L||L.type!==X.TableRow&&L.type!==X.TableColumn){r.h(0,0);for(var I=1;I<C.rowSpan&&!(q+I>=a.rowCount);I++)L=a.getRowDefinition(q+I),r.height+=L.total;for(I=1;I<C.columnSpan&&!(v+I>=a.columnCount);I++)L=a.getColumnDefinition(v+I),r.width+=L.total;var T=w.ha+r.width,R=u.ha+r.height;I=
h;L=k;var ca=T,qa=R,O=h,za=k,Ma=T,jb=R;h+T>c.width&&(Ma=Math.max(c.width-h,0));k+R>c.height&&(jb=Math.max(c.height-k,0));var Fa=C.alignment;if(Fa.Mb()){Fa=a.defaultAlignment;Fa.ib()||(Fa=Bc);var yb=Fa.x;var Ad=Fa.y;var kb=Fa.offsetX;Fa=Fa.offsetY;var Zb=w.alignment,bb=u.alignment;Zb.ib()&&(yb=Zb.x,kb=Zb.offsetX);bb.ib()&&(Ad=bb.y,Fa=bb.offsetY)}else yb=Fa.x,Ad=Fa.y,kb=Fa.offsetX,Fa=Fa.offsetY;if(isNaN(yb)||isNaN(Ad))Ad=yb=.5,Fa=kb=0;Zb=G.width;bb=G.height;var Nd=C.margin,xc=Nd.left+Nd.right,Bf=Nd.top+
Nd.bottom,bf=Dl(C,u,w,!1);!isNaN(C.desiredSize.width)||bf!==vd&&bf!==Wk||(Zb=Math.max(T-xc,0));!isNaN(C.desiredSize.height)||bf!==vd&&bf!==Xk||(bb=Math.max(R-Bf,0));T=C.maxSize;R=C.minSize;Zb=Math.min(T.width,Zb);bb=Math.min(T.height,bb);Zb=Math.max(R.width,Zb);bb=Math.max(R.height,bb);T=bb+Bf;I+=ca*yb-(Zb+xc)*yb+kb+Nd.left;L+=qa*Ad-T*Ad+Fa+Nd.top;C.visible&&(gc(O,za,Ma,jb,I,L,G.width,G.height)?C.arrange(I,L,Zb,bb):C.arrange(I,L,Zb,bb,new N(O,za,Ma,jb)))}else C.zl(),C.actualBounds.ea(),ca=C.actualBounds,
I=N.allocAt(ca.x,ca.y,ca.width,ca.height),ca.x=L.type===X.TableRow?f:h,ca.y=L.type===X.TableColumn?e:k,ca.width=G.width,ca.height=G.height,C.actualBounds.freeze(),ll(C,!1),ac(I,ca)||(G=C.part,null!==G&&(G.Oh(),C.ip(G))),N.free(I)}}}M.free(r);for(a=0;a<d;a++)c=b[a],f=c instanceof X?c:null,null===f||f.type!==X.TableRow&&f.type!==X.TableColumn||(f=c.actualBounds,c.naturalBounds.ea(),c.naturalBounds.h(0,0,f.width,f.height),c.naturalBounds.freeze())};function Gm(){this.name="Base"}la(Gm,Ol);
Gm.prototype.measure=function(){};Gm.prototype.arrange=function(){};function Hm(){this.name="Base"}la(Hm,Ol);Hm.prototype.measure=function(){};Hm.prototype.arrange=function(){};function Im(){this.name="Base"}la(Im,Ol);
Im.prototype.measure=function(a,b,c,d,e,f,g){1<d.length&&B("Viewbox Panel cannot contain more than one GraphObject.");d=d[0];d.ya=1;d.zm();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===Ag?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.ya*=q;m!==d.scale&&(nj(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)};Im.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.Mb()&&(g=a.defaultAlignment);g.ib()||(g=Bc);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 Jm(){this.name="Base"}la(Jm,Ol);Jm.prototype.measure=function(){};
Jm.prototype.arrange=function(){};
Jm.prototype.bc=function(a,b,c){c=a.Af()*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;b.save();b.beginPath();b.rect(0,0,h,k);b.clip();for(var p=[],r=a.W.j,q=r.length,u=0;u<q;u++){var v=r[u],w=[];p.push(w);if(v.visible){var y=v.interval;if(!(0>y)){v=Vj(v.figure);for(var z=0;z<q;z++)if(z!==u){var A=r[z];A.visible&&Vj(A.figure)===v&&(A=A.interval,A>y&&w.push(A))}}}}r=a.W.j;q=
r.length;for(u=0;u<q;u++){var C=r[u];if(C.visible&&(w=C.interval,!(2>e*Math.abs(w)*c))){y=C.opacity;v=1;if(1!==y){if(0===y)continue;v=b.globalAlpha;b.globalAlpha=v*y}z=p[u];A=!1;var G=C.strokeDashArray;null!==G&&(A=!0,b.Gt(G,C.strokeDashOffset));if("LineV"===C.figure&&null!==C.stroke&&0<C.strokeWidth){b.lineWidth=C.strokeWidth;li(a,b,C.stroke,!1,!1,f,g);b.beginPath();for(G=C=Math.floor(-n.x/e);G<=C+l;G++){var L=G*e+n.x;0<=L&&L<=h&&Km(G,w,z)&&(b.moveTo(L,0),b.lineTo(L,k))}b.stroke()}else if("LineH"===
C.figure&&null!==C.stroke&&0<C.strokeWidth){b.lineWidth=C.strokeWidth;li(a,b,C.stroke,!1,!1,f,g);b.beginPath();for(G=C=Math.floor(-n.y/d);G<=C+m;G++)L=G*d+n.y,0<=L&&L<=k&&Km(G,w,z)&&(b.moveTo(0,L),b.lineTo(h,L));b.stroke()}else if("BarV"===C.figure&&null!==C.fill)for(li(a,b,C.fill,!0,!1,f,g),C=C.width,isNaN(C)&&(C=e),L=G=Math.floor(-n.x/e);L<=G+l;L++){var I=L*e+n.x;0<=I&&I<=h&&Km(L,w,z)&&b.fillRect(I,0,C,k)}else if("BarH"===C.figure&&null!==C.fill)for(li(a,b,C.fill,!0,!1,f,g),C=C.height,isNaN(C)&&
(C=d),L=G=Math.floor(-n.y/d);L<=G+m;L++)I=L*d+n.y,0<=I&&I<=k&&Km(L,w,z)&&b.fillRect(0,I,h,C);A&&b.Et();1!==y&&(b.globalAlpha=v)}}b.restore();b.tc(!1)};function Km(a,b,c){if(0>b)return 0===a%b;if(0!==a%b)return!1;b=c.length;for(var d=0;d<b;d++)if(0===a%c[d])return!1;return!0}function Lm(){this.name="Base"}la(Lm,Ol);
Lm.prototype.measure=function(a,b,c,d,e){c=d.length;if(a instanceof He||a instanceof S){var f=null,g=null,h=null;a instanceof S&&(g=f=a);a instanceof He&&(h=a,f=h.adornedPart);if(f instanceof S){var k=f;if(0===c)Wb(a.naturalBounds,0,0),a.measuredBounds.h(0,0,0,0);else{var l=a instanceof He?null:f.path,m=f.routeBounds;b=a.xg;b.h(0,0,m.width,m.height);var n=k.points;f=f.pointsCount;null!==h?h.Bk(!1):null!==g&&g.Bk(!1);var p=m.width,r=m.height;a.location.h(m.x,m.y);a.l.length=0;null!==l&&(Mm(a,p,r,l),
h=l.measuredBounds,b.Oc(h),a.l.push(h));h=rd.alloc();for(var q=J.alloc(),u=J.alloc(),v=0;v<c;v++){var w=d[v];if(w!==l)if(w.isPanelMain&&w instanceof W){Mm(a,p,r,w);var y=w.measuredBounds;b.Oc(y);a.l.push(y)}else if(2>f)w.measure(Infinity,Infinity,0,0),y=w.measuredBounds,b.Oc(y),a.l.push(y);else{var z=w.segmentIndex,A=w.segmentFraction,C=w.alignmentFocus;C.mc()&&(C=Bc);var G=w.segmentOrientation,L=w.segmentOffset;if(isNaN(z)){var I=k.na;y=Ea();I.Xv(A,y);var T=J.allocAt(y[0],y[1]);T.add(k.i(0));I.type===
wd?T.offset(-I.startX,-I.startY):(I=I.figures.first(),T.offset(-I.startX,-I.startY));I=y[2];if(G!==bg){var R=k.computeAngle(w,G,I);w.Yb=R}R=T.x-m.x;var ca=T.y-m.y;J.free(T);Ha(y)}else if(z<-f||z>=f)ca=k.midPoint,I=k.midAngle,G!==bg&&(R=k.computeAngle(w,G,I),w.Yb=R),R=ca.x-m.x,ca=ca.y-m.y;else{R=0;0<=z?(ca=n.L(z),y=z<f-1?n.L(z+1):ca):(R=f+z,ca=n.L(R),y=0<R?n.L(R-1):ca);if(ca.Na(y)){0<=z?(I=0<z?n.L(z-1):ca,R=z<f-2?n.L(z+2):y):(I=R<f-1?n.L(R+1):ca,R=1<R?n.L(R-2):y);T=I.Fe(ca);var qa=y.Fe(R);I=T>qa+10?
0<=z?I.Sa(ca):ca.Sa(I):qa>T+10?0<=z?y.Sa(R):R.Sa(y):0<=z?I.Sa(R):R.Sa(I)}else I=0<=z?ca.Sa(y):y.Sa(ca);G!==bg&&(R=k.computeAngle(w,G,I),w.Yb=R);R=ca.x+(y.x-ca.x)*A-m.x;ca=ca.y+(y.y-ca.y)*A-m.y}w.measure(Infinity,Infinity,0,0);y=w.measuredBounds;T=w.naturalBounds;var O=0;w instanceof W&&(O=w.strokeWidth);qa=T.width+O;var za=T.height+O;h.reset();h.translate(-y.x,-y.y);h.scale(w.scale,w.scale);h.rotate(G===bg?w.angle:I,qa/2,za/2);G!==Nm&&G!==Om||h.rotate(90,qa/2,za/2);G!==Pm&&G!==Qm||h.rotate(-90,qa/
2,za/2);G===Rm&&(45<I&&135>I||225<I&&315>I)&&h.rotate(-I,qa/2,za/2);T=new N(0,0,qa,za);q.sj(T,C);h.sa(q);C=-q.x+O/2*w.scale;w=-q.y+O/2*w.scale;u.assign(L);O=isNaN(L.x);var Ma=isNaN(L.y);if(O||Ma){qa=qa/2+3;za=za/2+3;var jb=45<=I&&135>=I,Fa=225<=I&&315>=I;G===bg&&(jb||Fa)?(u.x=Ma?qa:L.y,u.y=O?za:L.x,jb?0<=z||isNaN(z)&&.5>A||!O||(u.y=-za):Fa&&((0<=z||isNaN(z)&&.5>A)&&O&&(u.y=-za),Ma&&(u.x=-qa))):(O&&(u.x=0<=z||isNaN(z)&&.5>A?qa:-qa),Ma&&(u.y=-za),u.rotate(I))}else u.rotate(I);R+=u.x;ca+=u.y;T.set(y);
T.h(R+C,ca+w,y.width,y.height);a.l.push(T);b.Oc(T)}}if(null!==g)for(d=g.labelNodes;d.next();)d.value.measure(Infinity,Infinity);a.xg=b;a=a.location;a.h(a.x+b.x,a.y+b.y);Wb(e,b.width||0,b.height||0);rd.free(h);J.free(q);J.free(u)}}}};
Lm.prototype.arrange=function(a,b){var c=b.length;if(a instanceof He||a instanceof S){var d=null,e=null,f=null;a instanceof S&&(e=d=a);a instanceof He&&(f=a,d=f.adornedPart);var g=a instanceof He?null:d.path;if(0!==a.l.length){var h=a.l,k=0;if(null!==g&&k<a.l.length){var l=h[k];k++;g.arrange(l.x-a.xg.x,l.y-a.xg.y,l.width,l.height)}for(l=0;l<c;l++){var m=b[l];if(m!==g&&k<a.l.length){var n=h[k];k++;m.arrange(n.x-a.xg.x,n.y-a.xg.y,n.width,n.height)}}}b=d.points;c=b.count;if(2<=c&&a instanceof S)for(d=
a.labelNodes;d.next();){var p=a;g=d.value;h=g.segmentIndex;k=g.segmentFraction;var r=g.alignmentFocus;l=g.segmentOrientation;m=g.segmentOffset;if(isNaN(h)){n=p.na;var q=Ea();n.Xv(k,q);var u=J.allocAt(q[0],q[1]);u.add(p.i(0));n.type===wd?u.offset(-n.startX,-n.startY):(n=n.figures.first(),u.offset(-n.startX,-n.startY));n=q[2];l!==bg&&(p=p.computeAngle(g,l,n),g.angle=p);p=u.x;var v=u.y;J.free(u);Ha(q)}else if(h<-c||h>=c)v=p.midPoint,n=p.midAngle,l!==bg&&(p=p.computeAngle(g,l,n),g.angle=p),p=v.x,v=v.y;
else{u=0;0<=h?(q=b.j[h],v=h<c-1?b.j[h+1]:q):(u=c+h,q=b.j[u],v=0<u?b.j[u-1]:q);if(q.Na(v)){0<=h?(n=0<h?b.j[h-1]:q,u=h<c-2?b.j[h+2]:v):(n=u<c-1?b.j[u+1]:q,u=1<u?b.j[u-2]:v);var w=n.Fe(q),y=v.Fe(u);n=w>y+10?0<=h?n.Sa(q):q.Sa(n):y>w+10?0<=h?v.Sa(u):u.Sa(v):0<=h?n.Sa(u):u.Sa(n)}else n=0<=h?q.Sa(v):v.Sa(q);l!==bg&&(p=p.computeAngle(g,l,n),g.angle=p);p=q.x+(v.x-q.x)*k;v=q.y+(v.y-q.y)*k}if(r.Vt())g.location=new J(p,v);else{r.mc()&&(r=Bc);q=rd.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);w=J.alloc();w.sj(u,r);q.sa(w);r=-w.x;y=-w.y;var A=z.width,C=z.height;z=J.alloc();z.assign(m);var G=isNaN(m.x),L=isNaN(m.y);if(G||L){A=A/2+3;C=C/2+3;var I=45<=n&&135>=n,T=225<=n&&315>=n;l===bg&&(I||T)?(z.x=L?A:m.y,z.y=G?C:m.x,I?0<=h||isNaN(h)&&.5>k||!G||(z.y=-C):T&&((0<=h||isNaN(h)&&.5>k)&&G&&(z.y=-C),L&&(z.x=-A))):(G&&(z.x=0<=h||isNaN(h)&&.5>k?A:-A),L&&(z.y=-C),z.rotate(n))}else z.rotate(n);p+=z.x;v+=z.y;q.Ow(u);r+=u.x;y+=u.y;h=J.allocAt(p+
r,v+y);g.move(h);J.free(h);J.free(z);J.free(w);N.free(u);rd.free(q)}}null!==f?f.Bk(!1):null!==e&&e.Bk(!1)}};
function Mm(a,b,c,d){if(!1!==sj(d)){var e=d.strokeWidth;0===e&&a instanceof He&&a.type===X.Link&&a.adornedObject instanceof W&&(e=a.adornedObject.strokeWidth);e*=d.ya;a instanceof S&&null!==a.na?(a=a.na.bounds,hl(d,a.x-e/2,a.y-e/2,a.width+e,a.height+e)):a instanceof He&&null!==a.adornedPart.na?(a=a.adornedPart.na.bounds,hl(d,a.x-e/2,a.y-e/2,a.width+e,a.height+e)):hl(d,-(e/2),-(e/2),b+e,c+e);nj(d,!1)}}function Sm(){this.name="Base"}la(Sm,Ol);
Sm.prototype.measure=function(a,b,c,d,e,f,g){var h=a.pb();a.bh=[];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.bh.push(p);e.assign(p);for(var r=h.geometry,q=h.strokeWidth,u=r.flattenedSegments,v=r.flattenedLengths,w=r.flattenedTotalLength,y=u.length,z=0,A=0,C=Ea(),G=0;G<y;G++){var L=u[G],I=[];A=z=0;for(var T=L.length,R=0;R<T;R+=2){var ca=L[R],qa=L[R+1];if(0!==R){var O=180*Math.atan2(qa-
A,ca-z)/Math.PI;0>O&&(O+=360);I.push(O)}z=ca;A=qa}C.push(I)}if(null===a.dh){for(var za=[],Ma=a.W.j,jb=Ma.length,Fa=0;Fa<jb;Fa++){var yb=Ma[Fa],Ad=[];za.push(Ad);if(yb.visible){var kb=yb.interval;if(!(0>kb))for(var Zb=0;Zb<jb;Zb++)if(Zb!==Fa){var bb=Ma[Zb];if(bb.visible&&yb.constructor===bb.constructor){var Nd=bb.interval;Nd>kb&&Ad.push(Nd)}}}}a.dh=za}var xc=a.dh;var Bf=a.W.j,bf=Bf.length,Ie=0,qh=0,Ec=w;a.Jj=[];for(var Cf,cf=0;cf<bf;cf++){var Od=Bf[cf];Cf=[];if(Od.visible&&Od!==h){var bk=Math.abs(Od.interval),
Gb=a.graduatedTickUnit;if(!(2>Gb*bk*w/a.graduatedRange)){var Df=v[0][0],Bd=0,lc=0;qh=w*Od.graduatedStart-1E-4;Ec=w*Od.graduatedEnd+1E-4;var df=Gb*bk,Xc=a.graduatedTickBase;if(Xc<a.graduatedMin){var dg=(a.graduatedMin-Xc)/df;dg=0===dg%1?dg:Math.floor(dg+1);Xc+=dg*df}else Xc>a.graduatedMin+df&&(Xc-=Math.floor((Xc-a.graduatedMin)/df)*df);for(var rh=xc[cf];Xc<=a.graduatedMax;){a:{for(var wn=rh.length,eg=0;eg<wn;eg++)if(K.$((Xc-a.graduatedTickBase)%(rh[eg]*a.graduatedTickUnit),0)){var ck=!1;break a}ck=
!0}if(ck&&(null===Od.graduatedSkip||!Od.graduatedSkip(Xc))&&(Ie=(Xc-a.graduatedMin)*w/a.graduatedRange,Ie>w&&(Ie=w),qh<=Ie&&Ie<=Ec)){for(var $b=C[Bd][lc],Pc=v[Bd][lc];Bd<v.length;){for(;Ie>Df&&lc<v[Bd].length-1;)lc++,$b=C[Bd][lc],Pc=v[Bd][lc],Df+=Pc;if(Ie<=Df)break;Bd++;lc=0;$b=C[Bd][lc];Pc=v[Bd][lc];Df+=Pc}var ec=u[Bd],fg=ec[2*lc],sh=ec[2*lc+1],ef=(Ie-(Df-Pc))/Pc,Ai=new J(fg+(ec[2*lc+2]-fg)*ef+q/2-r.bounds.x,sh+(ec[2*lc+3]-sh)*ef+q/2-r.bounds.y);Ai.scale(h.scale,h.scale);var ie=$b,Je=C[Bd];1E-4>
ef?0<lc?ie=Je[lc-1]:K.$(ec[0],ec[ec.length-2])&&K.$(ec[1],ec[ec.length-1])&&(ie=Je[Je.length-1]):.9999<ef&&(lc+1<Je.length?ie=Je[lc+1]:K.$(ec[0],ec[ec.length-2])&&K.$(ec[1],ec[ec.length-1])&&(ie=Je[0]));$b!==ie&&(180<Math.abs($b-ie)&&($b<ie?$b+=360:ie+=360),$b=($b+ie)/2%360);if(Od instanceof Vg){var mc="";null!==Od.graduatedFunction?(mc=Od.graduatedFunction(Xc),mc=null!==mc&&void 0!==mc?mc.toString():""):mc=(+Xc.toFixed(2)).toString();""!==mc&&Cf.push({Jm:Ai,angle:$b,text:mc})}else Cf.push({Jm:Ai,
angle:$b})}Xc+=df}}}a.Jj.push(Cf)}Ha(C);var dk=a.Jj;if(null!==dk)for(var xn=d.length,gg=0;gg<xn;gg++){var zb=d[gg],hg=dk[gg];if(zb.visible&&zb!==h&&0!==hg.length){if(zb instanceof W){var ek=a,Bi=e,ig=zb.alignmentFocus;ig.mc()&&(ig=yc);var Ef=zb.angle;zb.Yb=0;zb.measure(Infinity,Infinity,0,0);zb.Yb=Ef;var cb=zb.measuredBounds,jg=cb.width,nc=cb.height,Fc=N.allocAt(0,0,jg,nc),db=J.alloc();db.sj(Fc,ig);N.free(Fc);for(var Cd=-db.x,Dd=-db.y,Pd=new N,yn=hg.length,th=0;th<yn;th++)for(var uh=hg[th],vh=uh.Jm.x,
wh=uh.Jm.y,kg=uh.angle,Ed=0;4>Ed;Ed++){switch(Ed){case 0:db.h(Cd,Dd);break;case 1:db.h(Cd+jg,Dd);break;case 2:db.h(Cd,Dd+nc);break;case 3:db.h(Cd+jg,Dd+nc)}db.rotate(kg+zb.angle);db.offset(vh,wh);0===th&&0===Ed?Pd.h(db.x,db.y,0,0):Pd.Me(db);db.offset(-vh,-wh);db.rotate(-kg-zb.angle)}J.free(db);null!==ek.bh&&ek.bh.push(Pd);fc(Bi,Pd.x,Pd.y,Pd.width,Pd.height)}else if(zb instanceof Vg){var Yc=a,je=e;null===Yc.zh&&(Yc.zh=new Vg);var Ab=Yc.zh;Tm(Ab,zb);var Ci=zb.alignmentFocus;Ci.mc()&&(Ci=yc);for(var Zc=
zb.segmentOrientation,zn=zb.segmentOffset,ke=new N,Na=0,Fd=0,oc=0,le=0,me=0,xh=hg.length,yh=0;yh<xh;yh++){var Qd=hg[yh];Na=Qd.Jm.x;Fd=Qd.Jm.y;oc=Qd.angle;me=le=zb.angle;Zc!==bg&&(me=Zc===Um||Zc===Vm?oc+zb.angle:oc,le=S.computeAngle(Zc,me));Ab.Yb=le;Ab.text=Qd.text||"";Ab.measure(Infinity,Infinity,0,0);var ne=Ab.measuredBounds,Ke=Ab.naturalBounds,Le=Ke.width,oe=Ke.height,od=rd.alloc();od.reset();od.translate(-ne.x,-ne.y);od.scale(Ab.scale,Ab.scale);od.rotate(me,Le/2,oe/2);Zc!==Nm&&Zc!==Om||od.rotate(90,
Le/2,oe/2);Zc!==Pm&&Zc!==Qm||od.rotate(-90,Le/2,oe/2);Zc===Rm&&(45<oc&&135>oc||225<oc&&315>oc)&&od.rotate(-oc,Le/2,oe/2);var Ff=N.allocAt(0,0,Le,oe),lg=J.alloc();lg.sj(Ff,Ci);od.sa(lg);var An=-lg.x,zh=-lg.y,Gd=J.alloc();Gd.assign(zn);isNaN(Gd.x)&&(Gd.x=Le/2+3);isNaN(Gd.y)&&(Gd.y=-(oe/2+3));Gd.rotate(oc);Na+=Gd.x+An;Fd+=Gd.y+zh;var Di=new N(Na,Fd,ne.width,ne.height),Ah=new N(ne.x,ne.y,ne.width,ne.height),Bh=new N(Ke.x,Ke.y,Ke.width,Ke.height);Qd.zA=le;Qd.lineCount=Ab.lineCount;Qd.lines=[Ab.sb,Ab.Di,
Ab.ke,Ab.xe,Ab.Pb,Ab.jb,Ab.ie];Qd.actualBounds=Di;Qd.measuredBounds=Ah;Qd.naturalBounds=Bh;0===yh?ke.assign(Di):ke.Oc(Di);J.free(Gd);J.free(lg);N.free(Ff);rd.free(od)}null!==Yc.bh&&Yc.bh.push(ke);fc(je,ke.x,ke.y,ke.width,ke.height)}nj(zb,!1)}}};
Sm.prototype.arrange=function(a,b,c){if(null!==a.bh){var d=a.pb(),e=a.Jj;if(null!==e){var f=a.bh,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.bh=null}}};
Sm.prototype.bc=function(a,b,c){var d=c.xi;c.xi=!0;var e=a.naturalBounds,f=e.width;e=e.height;b.save();b.beginPath();b.rect(-1,-1,f+1,e+1);b.clip();f=a.pb();f.bc(b,c);e=a.Af()*c.scale;0>=e&&(e=1);for(var g=f.actualBounds,h=a.W.j,k=a.Jj,l=h.length,m=0;m<l;m++){var n=h[m],p=k[m],r=p.length;if(n.visible&&n!==f&&0!==p.length)if(n instanceof W){if(!(2>a.graduatedTickUnit*n.interval*f.geometry.flattenedTotalLength/a.graduatedRange*e)){var q=n.measuredBounds,u=n.strokeWidth*n.scale,v=n.alignmentFocus;v.mc()&&
(v=yc);for(var w=0;w<r;w++){var y=p[w].Jm,z=p[w].angle,A=v,C=n.ob;C.reset();C.translate(y.x+g.x,y.y+g.y);C.rotate(z+n.angle,0,0);C.translate(-q.width*A.x+A.offsetX+u/2,-q.height*A.y+A.offsetY+u/2);C.scale(n.scale,n.scale);Al(n,!1);n.Zh.set(n.ob);n.jl=n.scale;Bl(n,!1);n.bc(b,c);n.ob.reset()}}}else if(n instanceof Vg)for(null===a.zh&&(a.zh=new Vg),q=a.zh,Tm(q,n),n=0;n<r;n++)u=p[n],u.actualBounds&&u.measuredBounds&&u.naturalBounds&&(q.Tb=u.text||"",q.Yb=u.zA||0,q.Vc=u.lineCount||0,v=u.lines,void 0!==
v&&(q.sb=v[0],q.Di=v[1],q.ke=v[2],q.xe=v[3],q.Pb=v[4],q.jb=v[5],q.ie=v[6]),u.naturalBounds&&(q.qc=u.naturalBounds),u.actualBounds&&(v=u.actualBounds,q.arrange(v.x,v.y,v.width,v.height)),v=u.actualBounds,q.arrange(v.x,v.y,v.width,v.height),w=u.measuredBounds,u=u.naturalBounds,y=q.ob,y.reset(),y.translate(v.x+g.x,v.y+g.y),y.translate(-w.x,-w.y),il(q,y,u.x,u.y,u.width,u.height),Al(q,!1),q.Zh.set(q.ob),q.jl=q.scale,Bl(q,!1),q.bc(b,c))}c.xi=d;b.restore();b.tc(!0)};
function X(a){Y.call(this);this.pa=void 0===a?X.Position:a;null===this.pa&&B("Panel type not specified or PanelLayout not loaded: "+a);this.W=new E;this.gb=tc;this.pa===X.Grid&&(this.isAtomic=!0);this.Ln=ad;this.Rf=Vk;this.pa===X.Table&&Wm(this);this.nq=Ag;this.lo=Qb;this.mo=Hb;this.io=0;this.ho=100;this.ko=10;this.jo=0;this.li=this.lb=this.dh=this.bh=this.Jj=null;this.zo=NaN;this.pe=this.Bi=null;this.Dl="category";this.Rd=null;this.xg=new N(NaN,NaN,NaN,NaN);this.zh=this.Hp=this.Ui=null;this.Lg=""}
la(X,Y);function Wm(a){a.Cj=tc;a.Ug=1;a.si=null;a.ri=null;a.Tg=1;a.Sg=null;a.pi=null;a.ub=[];a.qb=[];a.ak=Xm;a.zj=Xm;a.Xi=0;a.Fi=0}
X.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.pa=this.pa;a.gb=this.gb.G();a.Ln=this.Ln.G();a.Rf=this.Rf;if(a.pa===X.Table){a.Cj=this.Cj.G();a.Ug=this.Ug;a.si=this.si;a.ri=this.ri;a.Tg=this.Tg;a.Sg=this.Sg;a.pi=this.pi;var b=[];if(0<this.ub.length)for(var c=this.ub,d=c.length,e=0;e<d;e++)if(void 0!==c[e]){var f=c[e].copy();f.rj(a);b[e]=f}a.ub=b;b=[];if(0<this.qb.length)for(c=this.qb,d=c.length,e=0;e<d;e++)void 0!==c[e]&&(f=c[e].copy(),f.rj(a),b[e]=f);a.qb=b;a.ak=
this.ak;a.zj=this.zj;a.Xi=this.Xi;a.Fi=this.Fi}a.nq=this.nq;a.lo=this.lo.G();a.mo=this.mo.G();a.io=this.io;a.ho=this.ho;a.ko=this.ko;a.jo=this.jo;a.Jj=this.Jj;a.dh=this.dh;a.lb=this.lb;a.li=this.li;a.zo=this.zo;a.Bi=this.Bi;a.pe=this.pe;a.Dl=this.Dl;a.xg.assign(this.xg);a.Lg=this.Lg;null!==this.Hp&&(a.Hp=this.Hp)};X.prototype.yf=function(a){Y.prototype.yf.call(this,a);a.W=this.W;for(var b=a.W.j,c=b.length,d=0;d<c;d++)b[d].og=a;a.Ui=null};
X.prototype.copy=function(){var a=Y.prototype.copy.call(this);if(null!==a){for(var b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d].copy();e.rj(a);e.Yj=null;var f=a.W,g=f.count;f.vb(g,e);f=a.part;if(null!==f){f.Uj=null;null!==e.portId&&f instanceof V&&(f.Nh=!0);var h=a.diagram;null!==h&&h.undoManager.isUndoingRedoing||f.ab(xe,"elements",a,null,e,null,g)}}return a}return null};t=X.prototype;t.toString=function(){return"Panel("+this.type+")#"+mb(this)};
t.ip=function(a){Y.prototype.ip.call(this,a);for(var b=this.W.j,c=b.length,d=0;d<c;d++)b[d].ip(a)};
t.ej=function(a,b){if(this.pa===X.Grid)this.pa.bc(this,a,b);else if(this.pa===X.Graduated)this.pa.bc(this,a,b);else{this.pa===X.Table&&(a.lineCap="butt",Ym(this,a,!0,this.ub,!0),Ym(this,a,!1,this.qb,!0),Zm(this,a,!0,this.ub),Zm(this,a,!1,this.qb),Ym(this,a,!0,this.ub,!1),Ym(this,a,!1,this.qb,!1));var c=this.isClipping&&this.pa===X.Spot;c&&a.save();for(var d=this.pb(),e=this.W.j,f=e.length,g=0;g<f;g++){var h=e[g];c&&h===d&&(a.clipInsteadOfFill=!0);h.bc(a,b);c&&h===d&&(a.clipInsteadOfFill=!1)}c&&(a.restore(),
a.tc(!0))}};
function Zm(a,b,c,d){for(var e=d.length,f=a.actualBounds,g=a.naturalBounds,h=!0,k=0;k<e;k++){var l=d[k];if(void 0!==l)if(h)h=!1;else if(0!==l.actual){if(c){if(l.position>f.height)continue}else if(l.position>f.width)continue;var m=l.separatorStrokeWidth;isNaN(m)&&(m=c?a.Ug:a.Tg);var n=l.separatorStroke;null===n&&(n=c?a.si:a.Sg);if(0!==m&&null!==n){li(a,b,n,!1,!1,g,f);n=!1;var p=l.separatorDashArray;null===p&&(p=c?a.ri:a.pi);null!==p&&(n=!0,b.Gt(p,0));b.beginPath();p=l.position+m;c?p>f.height&&(m-=
p-f.height):p>f.width&&(m-=p-f.width);l=l.position+m/2;b.lineWidth=m;m=a.gb;c?(l+=m.top,p=f.width-m.right,b.moveTo(m.left,l),b.lineTo(p,l)):(l+=m.left,p=f.height-m.bottom,b.moveTo(l,m.top),b.lineTo(l,p));b.stroke();n&&b.Et()}}}}
function Ym(a,b,c,d,e){for(var f=d.length,g=a.actualBounds,h=a.naturalBounds,k=0;k<f;k++){var l=d[k];if(void 0!==l&&null!==l.background&&l.coversSeparators!==e&&0!==l.actual){var m=c?g.height:g.width;if(!(l.position>m)){var n=l.vc(),p=l.separatorStrokeWidth;isNaN(p)&&(p=c?a.Ug:a.Tg);var r=l.separatorStroke;null===r&&(r=c?a.si:a.Sg);null===r&&(p=0);n-=p;p=l.position+p;n+=l.actual;p+n>m&&(n=m-p);0>=n||(m=a.gb,li(a,b,l.background,!0,!1,h,g),c?b.fillRect(m.left,p+m.top,g.width-(m.left+m.right),n):b.fillRect(p+
m.left,m.top,n,g.height-(m.top+m.bottom)))}}}}function Vj(a){return"LineV"===a||"BarV"===a}
t.vk=function(a,b,c,d,e){var f=this.de(),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.bd(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.bd(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.W.j;r=n.length;m=J.alloc();p=null;b=Infinity;var q=null,u=this.isClipping&&this.pa===X.Spot;u&&(q=J.alloc(),p=this.pb(),(l=p.vk(h,a,k,c,q))&&(b=(h-q.x)*(h-q.x)+(a-q.y)*(a-q.y)));for(var v=0;v<r;v++){var w=n[v];w.visible&&w!==p&&w.vk(h,a,k,c,m)&&(l=!0,w=(h-m.x)*(h-m.x)+(a-m.y)*(a-m.y),w<d&&(d=w,e.set(m)))}u&&(b>d&&e.set(q),J.free(q));J.free(m);f&&e.transform(g);return l};
t.o=function(a){if(!0!==sj(this)){Y.prototype.o.call(this,a);a=null;if(this.pa===X.Auto||this.pa===X.Link)a=this.pb();for(var b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d];(e===a||e.isPanelMain)&&e.o(!0);if(!e.desiredSize.u()){var f=kl(e,!1);(e instanceof wg||e instanceof X||e instanceof Vg||f!==yg)&&e.o(!0)}}}};t.zm=function(){if(!1===sj(this)){nj(this,!0);ll(this,!0);for(var a=this.W.j,b=a.length,c=0;c<b;c++)a[c].zm()}};
t.zl=function(){if(0!==(this.F&2048)===!1){Al(this,!0);Bl(this,!0);for(var a=this.W.j,b=a.length,c=0;c<b;c++)a[c].cw()}};t.cw=function(){Bl(this,!0);for(var a=this.W.j,b=a.length,c=0;c<b;c++)a[c].cw()};
t.Dm=function(a,b,c,d){var e=this.xg;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.gb;a=Math.max(a-k.left-k.right,0);b=Math.max(b-k.top-k.bottom,0);var l=this.W.j;0!==l.length&&this.pa.measure(this,a,b,l,e,c,d);a=e.width+k.left+k.right;k=e.height+k.top+k.bottom;
isFinite(f.width)&&(a=f.width);isFinite(f.height)&&(k=f.height);a=Math.min(h.width,a);k=Math.min(h.height,k);a=Math.max(g.width,a);k=Math.max(g.height,k);a=Math.max(c,a);k=Math.max(d,k);Wb(e,a,k);Wb(this.naturalBounds,a,k);hl(this,0,0,a,k)};t.pb=function(){if(null===this.Ui){var a=this.W.j,b=a.length;if(0===b)return null;for(var c=0;c<b;c++){var d=a[c];if(!0===d.isPanelMain)return this.Ui=d}this.Ui=a[0]}return this.Ui};function wm(a){return null!==a.part?a.part.locationObject:null}
t.Ih=function(a,b,c,d){var e=this.W.j;this.actualBounds.h(a,b,c,d);if(0!==e.length){if(!this.desiredSize.u()){a=kl(this,!0);var f=this.measuredBounds;b=f.width;f=f.height;var g=this.ih,h=g.left+g.right;g=g.top+g.bottom;b===c&&f===d&&(a=yg);switch(a){case yg:if(b>c||f>d)this.o(),this.measure(b>c?c:b,f>d?d:f,0,0);break;case vd:this.o(!0);this.measure(c+h,d+g,0,0);break;case Wk:this.o(!0);this.measure(c+h,f+g,0,0);break;case Xk:this.o(!0),this.measure(b+h,d+g,0,0)}}this.pa.arrange(this,e,this.xg)}};
t.Kh=function(a){var b=this.naturalBounds,c=wm(this);if(gc(0,0,b.width,b.height,a.x,a.y)){b=this.W.j;for(var d=b.length,e=J.allocAt(0,0);d--;){var f=b[d];if(f.visible||f===c)if(Bb(e.set(a),f.transform),f.aa(e))return J.free(e),!0}J.free(e);return null===this.kb&&null===this.dc?!1:!0}return!1};t.Ht=function(a){if(this.Xk===a)return this;for(var b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d].Ht(a);if(null!==e)return e}return null};
t.Zm=function(a,b){b(this,a);if(a instanceof X){a=a.W.j;for(var c=a.length,d=0;d<c;d++)this.Zm(a[d],b)}};function Fj(a,b){$m(a,a,b)}function $m(a,b,c){c(b);b=b.W.j;for(var d=b.length,e=0;e<d;e++){var f=b[e];f instanceof X&&$m(a,f,c)}}function an(a,b){bn(a,a,b)}function bn(a,b,c){c(b);if(b instanceof X){b=b.W.j;for(var d=b.length,e=0;e<d;e++)bn(a,b[e],c)}}t.sm=function(a){return cn(this,this,a)};
function cn(a,b,c){if(c(b))return b;if(b instanceof X){b=b.W.j;for(var d=b.length,e=0;e<d;e++){var f=cn(a,b[e],c);if(null!==f)return f}}return null}t.$a=function(a){if(this.name===a)return this;var b=this.W.j,c=b.length;null===this.Bi&&null===this.pe||(c=dn(this));for(var d=0;d<c;d++){var e=b[d];if(e instanceof X){var f=e.$a(a);if(null!==f)return f}if(e.name===a)return e}return null};
function en(a){a=a.W.j;for(var b=a.length,c=0,d=0;d<b;d++){var e=a[d];e instanceof X?c=Math.max(c,en(e)):e instanceof W&&(c=Math.max(c,e.xh/2*e.dk*e.Af()))}return c}t.de=function(){return!(this.type===X.TableRow||this.type===X.TableColumn)};
t.Ub=function(a,b,c){if(!1===this.pickable)return null;void 0===b&&(b=null);void 0===c&&(c=null);if(tj(this))return null;var d=this.naturalBounds,e=1/this.Af(),f=this.de(),g=f?a:Bb(J.allocAt(a.x,a.y),this.transform),h=this.diagram,k=10,l=5;null!==h&&(k=h.xm("extraTouchArea"),l=k/2);if(gc(-(l*e),-(l*e),d.width+k*e,d.height+k*e,g.x,g.y)){if(!this.isAtomic){e=this.W.j;var m=e.length;h=J.alloc();l=(k=this.isClipping&&this.pa===X.Spot)?this.pb():null;if(k&&(l.de()?Bb(h.set(a),l.transform):h.set(a),!l.aa(h)))return J.free(h),
f||J.free(g),null;for(var n=wm(this);m--;){var p=e[m];if(p.visible||p===n)if(p.de()?Bb(h.set(a),p.transform):h.set(a),!k||p!==l){var r=null;p instanceof X?r=p.Ub(h,b,c):!0===p.pickable&&p.aa(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=gc(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.hj=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.de(),g=f?a:Bb(J.allocAt(a.x,a.y),this.transform);e=gc(0,0,e.width,e.height,g.x,g.y);if(this.type===X.TableRow||this.type===X.TableColumn||e){if(!this.isAtomic){for(var h=this.W.j,k=h.length,l=J.alloc(),m=wm(this);k--;){var n=h[k];if(n.visible||n===m){n.de()?Bb(l.set(a),n.transform):l.set(a);var p=n;n=n instanceof X?n:null;(null!==n?n.hj(l,b,c,d):p.aa(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.zf=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=rd.alloc(),g.reset());g.multiply(this.transform);if(this.Jh(a,g))return fn(this,b,c,e),void 0===f&&rd.free(g),!0;if(this.Lc(a,g)){if(!this.isAtomic)for(var h=wm(this),k=this.W.j,l=k.length;l--;){var m=k[l];if(m.visible||m===h){var n=m.actualBounds,p=this.naturalBounds;if(!(n.x>p.width||n.y>p.height||0>n.x+n.width||0>n.y+n.height)){n=m;m=m instanceof X?m:null;p=rd.alloc();p.set(g);
if(null!==m?m.zf(a,b,c,d,e,p):jl(n,a,d,p))null!==b&&(n=b(n)),null===n||null!==c&&!c(n)||e.add(n);rd.free(p)}}}void 0===f&&rd.free(g);return d}void 0===f&&rd.free(g);return!1};function fn(a,b,c,d){for(var e=a.W.j,f=e.length;f--;){var g=e[f];if(g.visible){var h=g.actualBounds,k=a.naturalBounds;h.x>k.width||h.y>k.height||0>h.x+h.width||0>h.y+h.height||(g instanceof X&&fn(g,b,c,d),null!==b&&(g=b(g)),null===g||null!==c&&!c(g)||d.add(g))}}}
t.Eg=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.de(),k=h?a:Bb(J.allocAt(a.x,a.y),this.transform),l=h?b:Bb(J.allocAt(b.x,b.y),this.transform),m=k.Fe(l),n=0<k.x&&k.x<g.width&&0<k.y&&k.y<g.height||Cb(k.x,k.y,0,0,0,g.height)<=m||Cb(k.x,k.y,0,g.height,g.width,g.height)<=m||Cb(k.x,k.y,g.width,g.height,g.width,0)<=m||Cb(k.x,k.y,g.width,0,0,0)<=m;g=k.kd(0,0)<=m&&k.kd(0,g.height)<=m&&k.kd(g.width,0)<=m&&k.kd(g.width,g.height)<=
m;h||(J.free(k),J.free(l));if(n){if(!this.isAtomic){k=J.alloc();l=J.alloc();m=wm(this);for(var p=this.W.j,r=p.length;r--;){var q=p[r];if(q.visible||q===m){var u=q.actualBounds,v=this.naturalBounds;if(!h||!(u.x>v.width||u.y>v.height||0>u.x+u.width||0>u.y+u.height))if(q.de()?(u=q.transform,Bb(k.set(a),u),Bb(l.set(b),u)):(k.set(a),l.set(b)),u=q,q=q instanceof X?q:null,null!==q?q.Eg(k,l,c,d,e,f):u.oy(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 Bm(a){var b=null;a instanceof W&&(b=a.spot1,b===ad&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot1));null===b&&(b=wc);return b}function Cm(a){var b=null;a instanceof W&&(b=a.spot2,b===ad&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot2));null===b&&(b=Hc);return b}t.add=function(a){this.vb(this.W.count,a)};t.L=function(a){return this.W.L(a)};
t.vb=function(a,b){b instanceof U&&B("Cannot add a Part to a Panel: "+b+"; use a Panel instead");if(this===b||this.Gg(b))this===b&&B("Cannot make a Panel contain itself: "+this.toString()),B("Cannot make a Panel indirectly contain itself: "+this.toString()+" already contains "+b.toString());var c=b.panel;null!==c&&c!==this&&B("Cannot add a GraphObject that already belongs to another Panel to this Panel: "+b.toString()+", already contained by "+c.toString()+", cannot be shared by this Panel: "+this.toString());
this.pa!==X.Grid||b instanceof W||B("Can only add Shapes to a Grid Panel, not: "+b);this.pa!==X.Graduated||b instanceof W||b instanceof Vg||B("Can only add Shapes or TextBlocks to a Graduated Panel, not: "+b);b.rj(this);b.Yj=null;if(null!==this.itemArray){var d=b.data;null!==d&&"object"===typeof d&&(null===this.Rd&&(this.Rd=new H),this.Rd.add(d,b))}var e=this.W;d=-1;if(c===this){for(var f=-1,g=this.W.j,h=g.length,k=0;k<h;k++)if(g[k]===b){f=k;break}if(-1!==f){if(f===a||f+1>=e.count&&a>=e.count)return;
e.bb(f);d=f}else B("element "+b.toString()+" has panel "+c.toString()+" but is not contained by it.")}if(0>a||a>e.count)a=e.count;e.vb(a,b);if(0===a||b.isPanelMain)this.Ui=null;sj(this)||this.o();b.o(!1);null!==b.portId?this.Nh=!0:b instanceof X&&!0===b.Nh&&(this.Nh=!0);this.dh=null;c=this.part;null!==c&&(c.Uj=null,c.jh=NaN,this.Nh&&c instanceof V&&(c.Nh=!0),c.Nh&&c instanceof V&&(c.sc=null),e=this.diagram,null!==e&&e.undoManager.isUndoingRedoing||(-1!==d&&c.ab(ye,"elements",this,b,null,d,null),c.ab(xe,
"elements",this,null,b,null,a),this.Hg()||gn(this,b,!1)))};function hn(a,b){a.F=b?a.F|16777216:a.F&-16777217}t.remove=function(a){for(var b=this.W.j,c=b.length,d=-1,e=0;e<c;e++)if(b[e]===a){d=e;break}-1!==d&&this.Kc(d,!0)};t.bb=function(a){0<=a&&this.Kc(a,!0)};
t.Kc=function(a,b){var c=this.W,d=c.L(a);d.Yj=null;d.rj(null);if(null!==this.Rd){var e=d.data;"object"===typeof e&&this.Rd.remove(e)}c.bb(a);nj(this,!1);this.o();this.Ui===d&&(this.Ui=null);this.dh=null;var f=this.part;null!==f&&(f.Uj=null,f.jh=NaN,f.Lb(),f instanceof V&&(d instanceof X?d.Zm(d,function(a,c){Sl(f,c,b)}):Sl(f,d,b)),c=this.diagram,null!==c&&c.undoManager.isUndoingRedoing||f.ab(ye,"elements",this,d,null,a,null))};
X.prototype.getRowDefinition=function(a){0>a&&va(a,">= 0",X,"getRowDefinition:idx");a=Math.round(a);var b=this.ub;if(void 0===b)return null;if(void 0===b[a]){var c=new Tj;c.rj(this);c.isRow=!0;c.index=a;b[a]=c}return b[a]};X.prototype.tw=function(a){0>a&&va(a,">= 0",X,"removeRowDefinition:idx");a=Math.round(a);var b=this.ub;void 0!==b&&(this.ab(ye,"coldefs",this,b[a],null,a,null),b[a]&&delete b[a],this.o())};
X.prototype.getColumnDefinition=function(a){0>a&&va(a,">= 0",X,"getColumnDefinition:idx");a=Math.round(a);var b=this.qb;if(void 0===b)return null;if(void 0===b[a]){var c=new Tj;c.rj(this);c.isRow=!1;c.index=a;b[a]=c}return b[a]};t=X.prototype;t.rw=function(a){0>a&&va(a,">= 0",X,"removeColumnDefinition:idx");a=Math.round(a);var b=this.qb;void 0!==b&&(this.ab(ye,"coldefs",this,b[a],null,a,null),b[a]&&delete b[a],this.o())};
t.Wz=function(a){if(0>a||this.type!==X.Table)return-1;for(var b=0,c=this.ub,d=c.length,e=this.Xi;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))break}return e};t.Oz=function(a){if(0>a||this.type!==X.Table)return-1;for(var b=0,c=this.qb,d=c.length,e=this.Fi;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))break}return e};
t.lA=function(a,b){void 0===b&&(b=new J(NaN,NaN));if(this.type!==X.Graduated)return b.h(NaN,NaN),b;a=Math.min(Math.max(a,this.graduatedMin),this.graduatedMax);var c=this.pb();c.geometry.Wv((a-this.graduatedMin)/this.graduatedRange,b);return c.transform.sa(b)};t.mA=function(a){if(this.type!==X.Graduated)return NaN;var b=this.pb();b.transform.Zd(a);return b.geometry.ty(a)*this.graduatedRange+this.graduatedMin};function Il(a){a=a.li;return null!==a&&a.s}
function xg(a){var b=a.li;if(null===b)null!==a.data&&B("Template cannot have .data be non-null: "+a),a.li=b=new E;else if(b.s)return;var c=new E;hn(a,!1);a.Zm(a,function(a,d){var e=d.eb;if(null!==e)for(Fl(d,!1),e=e.iterator;e.next();){var f=e.value;f.mode===jn&&Fl(d,!0);var g=f.sourceName;null!==g&&("/"===g&&hn(a,!0),g=gl(f,a,d),null!==g&&(c.add(g),null===g.cm&&(g.cm=new E),g.cm.add(f)));b.add(f)}if(d instanceof X&&d.type===X.Table){if(0<d.ub.length)for(a=d.ub,e=a.length,f=0;f<e;f++)if(g=a[f],void 0!==
g&&null!==g.eb)for(var h=g.eb.iterator;h.next();){var k=h.value;k.jd=g;k.fq=2;k.im=g.index;b.add(k)}if(0<d.qb.length)for(d=d.qb,a=d.length,e=0;e<a;e++)if(f=d[e],void 0!==f&&null!==f.eb)for(g=f.eb.iterator;g.next();)h=g.value,h.jd=f,h.fq=1,h.im=f.index,b.add(h)}});for(var d=c.iterator;d.next();){var e=d.value;if(null!==e.cm){Fl(e,!0);for(var f=e.cm.iterator;f.next();){var g=f.value;null===e.eb&&(e.eb=new E);e.eb.add(g)}}e.cm=null}for(d=b.iterator;d.next();)if(e=d.value,f=e.jd,null!==f){e.jd=null;var h=
e.targetProperty,k=h.indexOf(".");0<k&&f instanceof X&&(g=h.substring(0,k),h=h.substr(k+1),k=f.$a(g),null!==k?(f=k,e.targetProperty=h):wa('Warning: unable to find GraphObject named "'+g+'" for Binding: '+e.toString()));f instanceof Tj?(g=mb(f.panel),e.vj=void 0===g?-1:g,f.panel.Xk=e.vj):f instanceof Y?(g=mb(f),e.vj=void 0===g?-1:g,f.Xk=e.vj):B("Unknown type of binding target: "+f)}b.freeze();a instanceof U&&a.Wb()&&a.Ta()}
t.Bz=function(a){void 0===a&&(a=!1);var b=this.copy();an(b,function(a){a instanceof X&&(a.li=null,a.lb=null);var b=a.eb;null!==b&&(a.eb=null,b.each(function(b){a.bind(b.copy())}));b=a.Mg;null!==b&&(a.Mg=null,b.each(function(b){Jl(a,b.value.copy())}))});a&&xg(b);return b};
t.Ca=function(a){var b=this.li;if(null!==b)for(void 0===a&&(a=""),b=b.iterator;b.next();){var c=b.value,d=c.sourceProperty;if(""===a||""===d||d===a)if(d=c.targetProperty,null!==c.converter||""!==d){d=this.data;var e=c.sourceName;if(null!==e)d=""===e?this:"/"===e?this:"."===e?this:".."===e?this:this.$a(e);else{var f=this.diagram;null!==f&&c.isToModel&&(d=f.model.modelData)}if(null!==d){f=this;var g=c.vj;if(-1!==g){if(f=this.Ht(g),null===f)continue}else null!==c.jd&&(f=c.jd);"/"===e?d=f.part:"."===
e?d=f:".."===e&&(d=f.panel);e=c.fq;if(0!==e){if(!(f instanceof X))continue;1===e?f=f.getColumnDefinition(c.im):2===e&&(f=f.getRowDefinition(c.im))}void 0!==f&&c.Rw(f,d)}}}};function kn(a,b){a=a.W.j;for(var c=a.length,d=b.length,e=0,f=null;e<c&&!(f=a[e],f instanceof X&&null!==f.data);)e++,f=a[e];if(c-e!==d)return!0;if(null===f)return 0<d;for(var g=0;e<c&&g<d;){f=a[e];if(!(f instanceof X)||f.data!==b[g])return!0;e++;g++}return!1}
function dn(a){if(a.type===X.Spot||a.type===X.Auto)return Math.min(a.W.length,1);if(a.type===X.Link){a=a.W;for(var b=a.length,c=0;c<b;c++){var d=a.L(c);if(!(d instanceof W&&d.isPanelMain))break}return c}return a.type===X.Table&&0<a.W.length&&(a=a.W.L(0),a.isPanelMain&&a instanceof X&&(a.type===X.TableRow||a.type===X.TableColumn))?1:0}t.eu=function(){for(var a=dn(this);this.W.length>a;)this.Kc(this.W.length-1,!1);a=this.itemArray;if(null!==a)for(var b=a.length,c=0;c<b;c++)ln(this,a[c],c)};
t.ny=function(a){return void 0===a||null===a||null===this.Rd?null:this.Rd.H(a)};
function ln(a,b,c){if(!(void 0===b||null===b||0>c)){var d=mn(a,b),e=a.itemTemplateMap,f=null;null!==e&&(f=e.H(d));null===f&&(nn||(nn=!0,wa('No item template Panel found for category "'+d+'" on '+a),wa("  Using default item template."),d=new X,e=new Vg,e.bind(new Li("text","",Ja)),d.add(e),on=d),f=on);d=f;null!==d&&(xg(d),d=d.copy(),0!==(d.F&16777216)&&(e=a.ij(),null!==e&&hn(e,!0)),"object"===typeof b&&(null===a.Rd&&(a.Rd=new H),a.Rd.add(b,d)),e=c+dn(a),a.vb(e,d),d.lb=b,pn(a,e,c),d.lb=null,d.data=
b)}}function pn(a,b,c){for(a=a.W;b<a.length;){var d=a.L(b);if(d instanceof X){var e=b,f=c;d.type===X.TableRow?d.row=e:d.type===X.TableColumn&&(d.column=e);d.itemIndex=f}b++;c++}}function mn(a,b){if(null===b)return"";a=a.Dl;if("function"===typeof a)a=a(b);else if("string"===typeof a&&"object"===typeof b){if(""===a)return"";a=qn(b,a)}else return"";if(void 0===a)return"";if("string"===typeof a)return a;B("Panel.getCategoryForItemData found a non-string category for "+b+": "+a);return""}
function gn(a,b,c){var d=b.enabledChanged;null!==d&&d(b,c);if(b instanceof X){b=b.W.j;d=b.length;for(var e=0;e<d;e++){var f=b[e];c&&f instanceof X&&!f.isEnabled||gn(a,f,c)}}}function rn(a,b){b.name=a;Nl.add(a,b)}
ma.Object.defineProperties(X.prototype,{type:{get:function(){return this.pa},set:function(a){var b=this.pa;b!==a&&(this.pa=a,this.pa===X.Grid?this.isAtomic=!0:this.pa===X.Table&&Wm(this),this.o(),this.g("type",b,a))}},elements:{get:function(){return this.W.iterator}},naturalBounds:{get:function(){return this.qc}},padding:{get:function(){return this.gb},set:function(a){"number"===
typeof a?(0>a&&va(a,">= 0",X,"padding"),a=new pc(a)):(0>a.left&&va(a.left,">= 0",X,"padding:value.left"),0>a.right&&va(a.right,">= 0",X,"padding:value.right"),0>a.top&&va(a.top,">= 0",X,"padding:value.top"),0>a.bottom&&va(a.bottom,">= 0",X,"padding:value.bottom"));var b=this.gb;b.w(a)||(this.gb=a=a.G(),this.o(),this.g("padding",b,a))}},defaultAlignment:{get:function(){return this.Ln},set:function(a){var b=this.Ln;b.w(a)||(this.Ln=a=a.G(),this.o(),this.g("defaultAlignment",
b,a))}},defaultStretch:{get:function(){return this.Rf},set:function(a){var b=this.Rf;b!==a&&(this.Rf=a,this.o(),this.g("defaultStretch",b,a))}},defaultSeparatorPadding:{get:function(){return void 0===this.Cj?tc:this.Cj},set:function(a){if(void 0!==this.Cj){"number"===typeof a&&(a=new pc(a));var b=this.Cj;b.w(a)||(this.Cj=a=a.G(),this.o(),this.g("defaultSeparatorPadding",b,a))}}},defaultRowSeparatorStroke:{get:function(){return void 0===
this.si?null:this.si},set:function(a){var b=this.si;b!==a&&(null===a||"string"===typeof a||a instanceof tl)&&(a instanceof tl&&a.freeze(),this.si=a,this.M(),this.g("defaultRowSeparatorStroke",b,a))}},defaultRowSeparatorStrokeWidth:{get:function(){return void 0===this.Ug?1:this.Ug},set:function(a){if(void 0!==this.Ug){var b=this.Ug;b!==a&&isFinite(a)&&0<=a&&(this.Ug=a,this.o(),this.g("defaultRowSeparatorStrokeWidth",b,a))}}},defaultRowSeparatorDashArray:{
get:function(){return void 0===this.ri?null:this.ri},set:function(a){if(void 0!==this.ri){var b=this.ri;if(b!==a){if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];"number"===typeof f&&0<=f&&isFinite(f)||B("defaultRowSeparatorDashArray value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.ri=a;this.M();this.g("defaultRowSeparatorDashArray",b,a)}}}},defaultColumnSeparatorStroke:{get:function(){return void 0===
this.Sg?null:this.Sg},set:function(a){if(void 0!==this.Sg){var b=this.Sg;b!==a&&(null===a||"string"===typeof a||a instanceof tl)&&(a instanceof tl&&a.freeze(),this.Sg=a,this.M(),this.g("defaultColumnSeparatorStroke",b,a))}}},defaultColumnSeparatorStrokeWidth:{get:function(){return void 0===this.Tg?1:this.Tg},set:function(a){if(void 0!==this.Tg){var b=this.Tg;b!==a&&isFinite(a)&&0<=a&&(this.Tg=a,this.o(),this.g("defaultColumnSeparatorStrokeWidth",b,a))}}},defaultColumnSeparatorDashArray:{
get:function(){return void 0===this.pi?null:this.pi},set:function(a){if(void 0!==this.pi){var b=this.pi;if(b!==a){if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];"number"===typeof f&&0<=f&&isFinite(f)||B("defaultColumnSeparatorDashArray value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.pi=a;this.M();this.g("defaultColumnSeparatorDashArray",b,a)}}}},viewboxStretch:{get:function(){return this.nq},
set:function(a){var b=this.nq;b!==a&&(this.nq=a,this.o(),this.g("viewboxStretch",b,a))}},gridCellSize:{get:function(){return this.lo},set:function(a){var b=this.lo;if(!b.w(a)){a.u()&&0!==a.width&&0!==a.height||B("Invalid Panel.gridCellSize: "+a);this.lo=a.G();var c=this.diagram;null!==c&&this===c.grid&&oj(c);this.M();this.g("gridCellSize",b,a)}}},gridOrigin:{get:function(){return this.mo},set:function(a){var b=this.mo;if(!b.w(a)){a.u()||
B("Invalid Panel.gridOrigin: "+a);this.mo=a.G();var c=this.diagram;null!==c&&this===c.grid&&oj(c);this.M();this.g("gridOrigin",b,a)}}},graduatedMin:{get:function(){return this.io},set:function(a){var b=this.io;b!==a&&(this.io=a,this.o(),this.g("graduatedMin",b,a),el(this)&&(a=this.part,null!==a&&fl(this,a,"graduatedRange")))}},graduatedMax:{get:function(){return this.ho},set:function(a){var b=this.ho;b!==a&&(this.ho=a,this.o(),this.g("graduatedMax",
b,a),el(this)&&(a=this.part,null!==a&&fl(this,a,"graduatedRange")))}},graduatedRange:{get:function(){return this.graduatedMax-this.graduatedMin}},graduatedTickUnit:{get:function(){return this.ko},set:function(a){var b=this.ko;b!==a&&0<a&&(this.ko=a,this.o(),this.g("graduatedTickUnit",b,a))}},graduatedTickBase:{get:function(){return this.jo},set:function(a){var b=this.jo;b!==a&&(this.jo=a,this.o(),this.g("graduatedTickBase",
b,a))}},Nh:{get:function(){return 0!==(this.F&8388608)},set:function(a){0!==(this.F&8388608)!==a&&(this.F^=8388608)}},rowCount:{get:function(){return void 0===this.ub?0:this.ub.length}},columnCount:{get:function(){return void 0===this.qb?0:this.qb.length}},rowSizing:{get:function(){return void 0===this.ak?Xm:this.ak},set:function(a){if(void 0!==this.ak){var b=this.ak;b!==a&&(this.ak=
a,this.o(),this.g("rowSizing",b,a))}}},columnSizing:{get:function(){return void 0===this.zj?Xm:this.zj},set:function(a){if(void 0!==this.zj){var b=this.zj;b!==a&&(this.zj=a,this.o(),this.g("columnSizing",b,a))}}},topIndex:{get:function(){return void 0===this.Xi?0:this.Xi},set:function(a){if(void 0!==this.Xi){var b=this.Xi;b!==a&&((!isFinite(a)||0>a)&&B("Panel.topIndex must be greater than zero and a real number, not: "+a),this.Xi=a,this.o(),
this.g("topIndex",b,a))}}},leftIndex:{get:function(){return void 0===this.Fi?0:this.Fi},set:function(a){if(void 0!==this.Fi){var b=this.Fi;b!==a&&((!isFinite(a)||0>a)&&B("Panel.leftIndex must be greater than zero and a real number, not: "+a),this.Fi=a,this.o(),this.g("leftIndex",b,a))}}},data:{get:function(){return this.lb},set:function(a){var b=this.lb;if(b!==a){var c=this instanceof U&&!(this instanceof He);xg(this);this.lb=a;var d=this.diagram;
null!==d&&(c?(c=d.partManager,this instanceof S?(null!==b&&c.Se.remove(b),null!==a&&c.Se.add(a,this)):this instanceof U&&(null!==b&&c.Te.remove(b),null!==a&&c.Te.add(a,this))):(c=this.panel,null!==c&&null!==c.Rd&&(null!==b&&c.Rd.remove(b),null!==a&&c.Rd.add(a,this))));this.g("data",b,a);null!==d&&d.undoManager.isUndoingRedoing||null!==a&&this.Ca()}}},itemIndex:{get:function(){return this.zo},set:function(a){var b=this.zo;b!==a&&(this.zo=a,this.g("itemIndex",b,a))}},itemArray:{
get:function(){return this.Bi},set:function(a){var b=this.Bi;if(b!==a||null!==a&&kn(this,a)){var c=this.diagram;b!==a&&(null!==c&&null!==b&&Kj(c.partManager,this,c),this.Bi=a,null!==c&&null!==a&&Hj(c.partManager,this));this.g("itemArray",b,a);null!==c&&c.undoManager.isUndoingRedoing||this.eu()}}},itemTemplate:{get:function(){return null===this.pe?null:this.pe.H("")},set:function(a){if(null===this.pe){if(null===a)return;this.pe=new H}var b=this.pe.H("");
b!==a&&((a instanceof U||a.isPanelMain)&&B("Panel.itemTemplate must not be a Part or be Panel.isPanelMain: "+a),this.pe.add("",a),this.g("itemTemplate",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.eu())}},itemTemplateMap:{get:function(){return this.pe},set:function(a){var b=this.pe;if(b!==a){for(var c=a.iterator;c.next(););this.pe=a;this.g("itemTemplateMap",b,a);a=this.diagram;null!==a&&a.undoManager.isUndoingRedoing||this.eu()}}},itemCategoryProperty:{
get:function(){return this.Dl},set:function(a){var b=this.Dl;b!==a&&(this.Dl=a,this.g("itemCategoryProperty",b,a))}},isAtomic:{get:function(){return 0!==(this.F&1048576)},set:function(a){var b=0!==(this.F&1048576);b!==a&&(this.F^=1048576,this.g("isAtomic",b,a))}},isClipping:{get:function(){return 0!==(this.F&2097152)},set:function(a){var b=0!==(this.F&2097152);b!==a&&(a&&this.type!==X.Spot&&wa("Warning: Panel.isClipping set on non-Spot Panel: "+
this.toString()),this.F^=2097152,this.o(),this.g("isClipping",b,a))}},isOpposite:{get:function(){return 0!==(this.F&33554432)},set:function(a){var b=0!==(this.F&33554432);b!==a&&(this.F^=33554432,this.o(),this.g("isOpposite",b,a))}},isEnabled:{get:function(){return 0!==(this.F&4194304)},set:function(a){var b=0!==(this.F&4194304);if(b!==a){var c=null===this.panel||this.panel.Hg();this.F^=4194304;this.g("isEnabled",b,a);b=this.diagram;null!==
b&&b.undoManager.isUndoingRedoing||c&&gn(this,this,a)}}},alignmentFocusName:{get:function(){return this.Lg},set:function(a){var b=this.Lg;b!==a&&(this.Lg=a,this.o(),this.g("alignmentFocusName",b,a))}}});
ma.Object.defineProperties(X,{Position:{get:function(){return Nl.H("Position")}},Horizontal:{get:function(){return Nl.H("Horizontal")}},Vertical:{get:function(){return Nl.H("Vertical")}},Spot:{get:function(){return Nl.H("Spot")}},Auto:{get:function(){return Nl.H("Auto")}},Table:{get:function(){return Nl.H("Table")}},Viewbox:{
get:function(){return Nl.H("Viewbox")}},TableRow:{get:function(){return Nl.H("TableRow")}},TableColumn:{get:function(){return Nl.H("TableColumn")}},Link:{get:function(){return Nl.H("Link")}},Grid:{get:function(){return Nl.H("Grid")}},Graduated:{get:function(){return Nl.H("Graduated")}}});X.prototype.findItemPanelForData=X.prototype.ny;
X.prototype.rebuildItemElements=X.prototype.eu;X.prototype.updateTargetBindings=X.prototype.Ca;X.prototype.copyTemplate=X.prototype.Bz;X.prototype.graduatedValueForPoint=X.prototype.mA;X.prototype.graduatedPointForValue=X.prototype.lA;X.prototype.findColumnForLocalX=X.prototype.Oz;X.prototype.findRowForLocalY=X.prototype.Wz;X.prototype.removeColumnDefinition=X.prototype.rw;X.prototype.removeRowDefinition=X.prototype.tw;X.prototype.removeAt=X.prototype.bb;X.prototype.remove=X.prototype.remove;
X.prototype.insertAt=X.prototype.vb;X.prototype.elt=X.prototype.L;X.prototype.add=X.prototype.add;X.prototype.findObject=X.prototype.$a;X.prototype.findInVisualTree=X.prototype.sm;X.prototype.walkVisualTreeFrom=X.prototype.Zm;X.prototype.findMainElement=X.prototype.pb;var nn=!1,on=null,Nl=new H;X.className="Panel";X.definePanelLayout=rn;rn("Position",new vm);rn("Vertical",new ym);rn("Auto",new Am);rn("Link",new Lm);
function Tj(){Ya(this);this.og=null;this.ps=!0;this.Pa=0;this.Xc=NaN;this.mh=0;this.kh=Infinity;this.yb=ad;this.la=this.ha=0;this.eb=null;this.Wp=sn;this.ze=Vk;this.Qp=this.sg=null;this.Rp=NaN;this.kb=this.ck=null;this.Hn=!1}
Tj.prototype.copy=function(){var a=new Tj;a.ps=this.ps;a.Pa=this.Pa;a.Xc=this.Xc;a.mh=this.mh;a.kh=this.kh;a.yb=this.yb;a.ha=this.ha;a.la=this.la;a.ze=this.ze;a.Wp=this.Wp;null===this.sg?a.sg=null:a.sg=this.sg.G();a.Qp=this.Qp;a.Rp=this.Rp;a.ck=null;null!==this.ck&&(a.separatorDashArray=Ba(this.separatorDashArray));a.kb=this.kb;a.Hn=this.Hn;a.eb=this.eb;return a};t=Tj.prototype;
t.Dt=function(a){a.isRow?this.height=a.height:this.width=a.width;this.minimum=a.minimum;this.maximum=a.maximum;this.alignment=a.alignment;this.stretch=a.stretch;this.sizing=a.sizing;this.sg=null===a.separatorPadding?null:a.separatorPadding.G();this.separatorStroke=a.separatorStroke;this.separatorStrokeWidth=a.separatorStrokeWidth;this.ck=null;a.separatorDashArray&&(this.ck=Ba(a.separatorDashArray));this.background=a.background;this.coversSeparators=a.coversSeparators;this.eb=a.eb};
t.hb=function(a){a.classType===Tj&&(this.sizing=a)};t.toString=function(){return"RowColumnDefinition "+(this.isRow?"(Row ":"(Column ")+this.index+") #"+mb(this)};t.rj=function(a){this.og=a};
t.Iv=function(){var a=0,b=0,c=this.og,d=this.isRow;if(null!==c&&c.type===X.Table)for(var e=d?c.ub.length:c.qb.length,f=0;f<e;f++){var g=d?c.ub[f]:c.qb[f];if(void 0!==g){b=g.index;break}}this.index!==b&&(b=this.separatorStroke,null===b&&null!==c&&(b=this.isRow?c.defaultRowSeparatorStroke:c.defaultColumnSeparatorStroke),null!==b&&(a=this.separatorStrokeWidth,isNaN(a)&&(null!==c?a=this.isRow?c.defaultRowSeparatorStrokeWidth:c.defaultColumnSeparatorStrokeWidth:a=0)));b=this.sg;if(null===b)if(null!==c)b=
c.defaultSeparatorPadding;else return a;return a+(this.isRow?b.top:b.left)};
t.vc=function(){var a=0,b=this.og,c=0,d=this.isRow;if(null!==b&&b.type===X.Table)for(var e=d?b.ub.length:b.qb.length,f=0;f<e;f++){var g=d?b.ub[f]:b.qb[f];if(void 0!==g){c=g.index;break}}this.index!==c&&(c=this.separatorStroke,null===c&&null!==b&&(c=d?b.defaultRowSeparatorStroke:b.defaultColumnSeparatorStroke),null!==c&&(a=this.separatorStrokeWidth,isNaN(a)&&(null!==b?a=d?b.defaultRowSeparatorStrokeWidth:b.defaultColumnSeparatorStrokeWidth:a=0)));d=this.sg;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.Bb=function(a,b,c){var d=this.og;if(null!==d&&(d.ab(ve,a,this,b,c,void 0,void 0),null!==this.eb&&(b=d.diagram,null!==b&&!b.skipsModelSourceBindings&&(d=d.ij(),null!==d&&(b=d.data,null!==b)))))for(c=this.eb.iterator;c.next();)c.value.lr(this,b,a,d)};function Em(a){if(a.sizing===sn){var b=a.og;return a.isRow?b.rowSizing:b.columnSizing}return a.sizing}
t.bind=function(a){a.jd=this;var b=this.panel;if(null!==b){var c=b.ij();null!==c&&Il(c)&&B("Cannot add a Binding to a RowColumnDefinition that is already frozen: "+a+" on "+b)}null===this.eb&&(this.eb=new E);this.eb.add(a)};
ma.Object.defineProperties(Tj.prototype,{panel:{get:function(){return this.og}},isRow:{get:function(){return this.ps},set:function(a){this.ps=a}},index:{get:function(){return this.Pa},set:function(a){this.Pa=a}},height:{get:function(){return this.Xc},set:function(a){var b=this.Xc;b!==a&&(0>a&&va(a,">= 0",Tj,"height"),this.Xc=a,this.actual=this.ha,null!==this.panel&&this.panel.o(),
this.Bb("height",b,a))}},width:{get:function(){return this.Xc},set:function(a){var b=this.Xc;b!==a&&(0>a&&va(a,">= 0",Tj,"width"),this.Xc=a,this.actual=this.ha,null!==this.panel&&this.panel.o(),this.Bb("width",b,a))}},minimum:{get:function(){return this.mh},set:function(a){var b=this.mh;b!==a&&((0>a||!isFinite(a))&&va(a,">= 0",Tj,"minimum"),this.mh=a,this.actual=this.ha,null!==this.panel&&this.panel.o(),this.Bb("minimum",b,a))}},maximum:{
get:function(){return this.kh},set:function(a){var b=this.kh;b!==a&&(0>a&&va(a,">= 0",Tj,"maximum"),this.kh=a,this.actual=this.ha,null!==this.panel&&this.panel.o(),this.Bb("maximum",b,a))}},alignment:{get:function(){return this.yb},set:function(a){var b=this.yb;b.w(a)||(this.yb=a.G(),null!==this.panel&&this.panel.o(),this.Bb("alignment",b,a))}},stretch:{get:function(){return this.ze},set:function(a){var b=this.ze;b!==a&&(this.ze=
a,null!==this.panel&&this.panel.o(),this.Bb("stretch",b,a))}},separatorPadding:{get:function(){return this.sg},set:function(a){"number"===typeof a&&(a=new pc(a));var b=this.sg;null!==a&&null!==b&&b.w(a)||(null!==a&&(a=a.G()),this.sg=a,null!==this.panel&&this.panel.o(),this.Bb("separatorPadding",b,a))}},separatorStroke:{get:function(){return this.Qp},set:function(a){var b=this.Qp;b!==a&&(null!==a&&Rl(a,"RowColumnDefinition.separatorStroke"),
a instanceof tl&&a.freeze(),this.Qp=a,null!==this.panel&&this.panel.o(),this.Bb("separatorStroke",b,a))}},separatorStrokeWidth:{get:function(){return this.Rp},set:function(a){var b=this.Rp;b!==a&&(this.Rp=a,null!==this.panel&&this.panel.o(),this.Bb("separatorStrokeWidth",b,a))}},separatorDashArray:{get:function(){return this.ck},set:function(a){var b=this.ck;if(b!==a){if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];"number"===
typeof f&&0<=f&&isFinite(f)||B("separatorDashArray value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.ck=a;null!==this.panel&&this.panel.M();this.Bb("separatorDashArray",b,a)}}},background:{get:function(){return this.kb},set:function(a){var b=this.kb;b!==a&&(null!==a&&Rl(a,"RowColumnDefinition.background"),a instanceof tl&&a.freeze(),this.kb=a,null!==this.panel&&this.panel.M(),this.Bb("background",b,a))}},coversSeparators:{
get:function(){return this.Hn},set:function(a){var b=this.Hn;b!==a&&(this.Hn=a,null!==this.panel&&this.panel.M(),this.Bb("coversSeparators",b,a))}},sizing:{get:function(){return this.Wp},set:function(a){var b=this.Wp;b!==a&&(this.Wp=a,null!==this.panel&&this.panel.o(),this.Bb("sizing",b,a))}},actual:{get:function(){return this.ha},set:function(a){this.ha=isNaN(this.Xc)?Math.max(Math.min(this.kh,a),this.mh):Math.max(Math.min(this.kh,
this.Xc),this.mh)}},total:{get:function(){return this.ha+this.vc()},set:function(a){this.ha=isNaN(this.Xc)?Math.max(Math.min(this.kh,a),this.mh):Math.max(Math.min(this.kh,this.Xc),this.mh);this.ha=Math.max(0,this.ha-this.vc())}},position:{get:function(){return this.la},set:function(a){this.la=a}}});Tj.prototype.bind=Tj.prototype.bind;Tj.prototype.computeEffectiveSpacing=Tj.prototype.vc;Tj.prototype.computeEffectiveSpacingTop=Tj.prototype.Iv;
var sn=new D(Tj,"Default",0),Fm=new D(Tj,"None",1),Xm=new D(Tj,"ProportionalExtra",2);Tj.className="RowColumnDefinition";Tj.Default=sn;Tj.None=Fm;Tj.ProportionalExtra=Xm;function W(){Y.call(this);this.zd=this.na=null;this.Xn="None";this.fo=Vk;this.Hc=this.ml="black";this.xh=1;this.em="butt";this.fm="miter";this.dk=10;this.vh=null;this.wh=0;this.pf=this.nf=ad;this.pp=this.op=NaN;this.ro=!1;this.rp=null;this.nl=this.lm="None";this.Qd=1;this.Od=0;this.Md=1;this.Nd=null}la(W,Y);
W.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.na=this.na;a.Xn=this.Xn;a.fo=this.fo;a.zd=this.zd;a.ml=this.ml;a.Hc=this.Hc;a.xh=this.xh;a.em=this.em;a.fm=this.fm;a.dk=this.dk;null!==this.vh&&(a.vh=Ba(this.vh));a.wh=this.wh;a.nf=this.nf.G();a.pf=this.pf.G();a.op=this.op;a.pp=this.pp;a.ro=this.ro;a.rp=this.rp;a.lm=this.lm;a.nl=this.nl;a.Qd=this.Qd;a.Od=this.Od;a.Md=this.Md;a.Nd=this.Nd};t=W.prototype;
t.hb=function(a){a===yg||a===Ag||a===Yk||a===Vk?this.geometryStretch=a:Y.prototype.hb.call(this,a)};t.toString=function(){return"Shape("+("None"!==this.figure?this.figure:"None"!==this.toArrow?this.toArrow:this.fromArrow)+")#"+mb(this)};
function tn(a,b,c,d){var e=c.length;if(!(4>e)){var f=d.measuredBounds,g=Math.max(1,f.width);f=f.height;for(var h=c[0],k=c[1],l,m,n,p,r,q,u=0,v=Ea(),w=2;w<e;w+=2)l=c[w],m=c[w+1],n=l-h,h=m-k,0===n&&(n=.001),p=h/n,r=Math.atan2(h,n),q=Math.sqrt(n*n+h*h),v.push([n,r,p,q]),u+=q,h=l,k=m;h=c[0];k=c[1];n=d.measuredBounds.width;d instanceof W&&(n-=d.strokeWidth);1>n&&(n=1);e=c=n;l=g/2;m=0===l?!1:!0;w=0;q=v[w];n=q[0];r=q[1];p=q[2];q=q[3];for(var y=0;.1<=u;){0===y&&(m?(e=c,e-=l,u-=l,m=!1):e=c,0===e&&(e=1));if(e>
u){Ha(v);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.ej(a,b);a.translate(g/2,f/2);a.rotate(-r);a.translate(-h,-k);u-=e;q-=e;if(0!==y){w++;if(w===v.length){Ha(v);return}q=v[w];n=q[0];r=q[1];p=q[2];q=q[3];e=y}}Ha(v)}}
t.ej=function(a,b){var c=this.Hc,d=this.ml;if(null!==c||null!==d){var e=this.actualBounds,f=this.naturalBounds;null!==d&&li(this,a,d,!0,!1,f,e);var g=this.part,h=this.xh;null===c||0!==h||null===g||!this.isPanelMain&&g.pb()!==this||(h=g.type===X.Link&&g instanceof He&&"Selection"===g.category&&g.adornedObject instanceof W&&g.adornedPart.pb()===g.adornedObject?g.adornedObject.strokeWidth:0);null!==c&&0!==h&&(li(this,a,c,!1,!1,f,e),a.lineWidth=h,a.lineJoin=this.fm,a.lineCap=this.em,a.miterLimit=this.dk);
e=!1;g&&b.Ge("drawShadows")&&(e=g.isShadowed);g=!0;null===c||null!==d&&"transparent"!==d||(g=!1);f=!1;var k=this.strokeDashArray;null!==k&&(f=!0,a.Gt(k,this.wh));var l=this.na;if(null!==l){if(l.type===wd)a.beginPath(),a.moveTo(l.startX,l.startY),a.lineTo(l.endX,l.endY),null!==d&&a.Yd(d),0!==h&&null!==c&&a.uj();else if(l.type===Hd){var m=l.startX;k=l.startY;var n=l.endX,p=l.endY;l=Math.min(m,n);var r=Math.min(k,p);m=Math.abs(n-m);k=Math.abs(p-k);a.beginPath();a.rect(l,r,m,k);null!==d&&a.Yd(d);if(null!==
c){g&&e&&sl(a);if(0!==h){if(0===m||0===k)a.beginPath(),a.rect(l,r,Math.max(m,.1),Math.max(k,.1));a.uj()}g&&e&&rl(a)}}else if(l.type===Id)m=l.startX,k=l.startY,n=l.endX,p=l.endY,l=Math.abs(n-m)/2,r=Math.abs(p-k)/2,m=Math.min(m,n)+l,k=Math.min(k,p)+r,a.beginPath(),a.moveTo(m,k-r),a.bezierCurveTo(m+K.Kg*l,k-r,m+l,k-K.Kg*r,m+l,k),a.bezierCurveTo(m+l,k+K.Kg*r,m+K.Kg*l,k+r,m,k+r),a.bezierCurveTo(m-K.Kg*l,k+r,m-l,k+K.Kg*r,m-l,k),a.bezierCurveTo(m-l,k-K.Kg*r,m-K.Kg*l,k-r,m,k-r),a.closePath(),null!==d&&a.Yd(d),
0!==h&&null!==c&&(g&&e?(sl(a),a.uj(),rl(a)):a.uj());else if(l.type===ud)for(k=l.figures,l=k.length,r=0;r<l;r++){m=k.j[r];a.beginPath();a.moveTo(m.startX,m.startY);n=m.segments.j;p=n.length;for(var q=null,u=0;u<p;u++){var v=n[u];switch(v.type){case Xd:a.moveTo(v.endX,v.endY);break;case yd:a.lineTo(v.endX,v.endY);break;case Yd:a.bezierCurveTo(v.point1X,v.point1Y,v.point2X,v.point2Y,v.endX,v.endY);break;case Zd:a.quadraticCurveTo(v.point1X,v.point1Y,v.endX,v.endY);break;case $d:if(v.radiusX===v.radiusY){var w=
Math.PI/180;a.arc(v.point1X,v.point1Y,v.radiusX,v.startAngle*w,(v.startAngle+v.sweepAngle)*w,0>v.sweepAngle,null!==q?q.endX:m.startX,null!==q?q.endY:m.startY)}else if(q=be(v,m),w=q.length,0===w)a.lineTo(v.centerX,v.centerY);else for(var y=0;y<w;y++){var z=q[y];0===y&&a.lineTo(z[0],z[1]);a.bezierCurveTo(z[2],z[3],z[4],z[5],z[6],z[7])}break;case ae:y=w=0;if(null!==q&&q.type===$d){q=be(q,m);z=q.length;if(0===z){a.lineTo(v.centerX,v.centerY);break}q=q[z-1]||null;null!==q&&(w=q[6],y=q[7])}else w=null!==
q?q.endX:m.startX,y=null!==q?q.endY:m.startY;q=ce(v,m,w,y);w=q.length;if(0===w){a.lineTo(v.centerX,v.centerY);break}for(y=0;y<w;y++)z=q[y],a.bezierCurveTo(z[2],z[3],z[4],z[5],z[6],z[7]);break;default:B("Segment not of valid type: "+v.type)}v.isClosed&&a.closePath();q=v}e?m.isShadowed?(!0===m.isFilled&&"transparent"!==d&&null!==d&&a.Yd(d),0!==h&&null!==c&&(g&&sl(a),a.uj(),g&&rl(a))):(g&&sl(a),!0===m.isFilled&&"transparent"!==d&&null!==d&&a.Yd(d),0!==h&&null!==c&&a.uj(),g&&rl(a)):(!0===m.isFilled&&
null!==d&&a.Yd(d),0!==h&&null!==c&&a.uj())}f&&a.Et();if(null!==this.pathPattern){c=this.pathPattern;c.measure(Infinity,Infinity);d=c.measuredBounds;c.arrange(0,0,d.width,d.height);h=this.geometry;a.save();a.beginPath();d=Ea();if(h.type===wd)d.push(h.startX),d.push(h.startY),d.push(h.endX),d.push(h.endY),tn(a,b,d,c);else if(h.type===ud)for(h=h.figures.iterator;h.next();){e=h.value;d.length=0;d.push(e.startX);d.push(e.startY);g=e.startX;f=e.startY;k=g;l=f;r=e.segments.j;m=r.length;for(n=0;n<m;n++){p=
r[n];switch(p.type){case Xd:tn(a,b,d,c);d.length=0;d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;k=g;l=f;break;case yd:d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;break;case Yd:K.Ce(g,f,p.point1X,p.point1Y,p.point2X,p.point2Y,p.endX,p.endY,.5,d);g=p.endX;f=p.endY;break;case Zd:K.Wq(g,f,p.point1X,p.point1Y,p.endX,p.endY,.5,d);g=p.endX;f=p.endY;break;case $d:u=be(p,e);v=u.length;if(0===v){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(q=0;q<v;q++)w=u[q],K.Ce(g,f,w[2],w[3],
w[4],w[5],w[6],w[7],.5,d),g=w[6],f=w[7];break;case ae:u=ce(p,e,g,f);v=u.length;if(0===v){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(q=0;q<v;q++)w=u[q],K.Ce(g,f,w[2],w[3],w[4],w[5],w[6],w[7],.5,d),g=w[6],f=w[7];break;default:B("Segment not of valid type: "+p.type)}p.isClosed&&(d.push(k),d.push(l),tn(a,b,d,c))}tn(a,b,d,c)}else if(h.type===Hd)d.push(h.startX),d.push(h.startY),d.push(h.endX),d.push(h.startY),d.push(h.endX),d.push(h.endY),d.push(h.startX),d.push(h.endY),d.push(h.startX),
d.push(h.startY),tn(a,b,d,c);else if(h.type===Id){f=new he;f.startX=h.endX;f.startY=(h.startY+h.endY)/2;g=new pe($d);g.startAngle=0;g.sweepAngle=360;g.centerX=(h.startX+h.endX)/2;g.centerY=(h.startY+h.endY)/2;g.radiusX=Math.abs(h.startX-h.endX)/2;g.radiusY=Math.abs(h.startY-h.endY)/2;f.add(g);h=be(g,f);e=h.length;if(0===e)d.push(g.centerX),d.push(g.centerY);else for(g=f.startX,f=f.startY,k=0;k<e;k++)l=h[k],K.Ce(g,f,l[2],l[3],l[4],l[5],l[6],l[7],.5,d),g=l[6],f=l[7];tn(a,b,d,c)}Ha(d);a.restore();a.tc(!1)}}}};
t.ga=function(a,b){void 0===b&&(b=new J);if(a instanceof P){a.mc()&&B("getDocumentPoint Spot must be a real, specific Spot, not: "+a.toString());var c=this.naturalBounds,d=this.strokeWidth;b.h(a.x*(c.width+d)-d/2+c.x+a.offsetX,a.y*(c.height+d)-d/2+c.y+a.offsetY)}else b.set(a);this.Ad.sa(b);return b};
t.wm=function(a){void 0===a&&(a=new N);var b=this.naturalBounds,c=this.Ad;b=N.allocAt(b.x,b.y,b.width,b.height);var d=this.strokeWidth;b.Ic(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);fc(a,d.x,d.y,0,0);d.h(b.right,b.bottom).transform(c);fc(a,d.x,d.y,0,0);d.h(b.x,b.bottom).transform(c);fc(a,d.x,d.y,0,0);N.free(b);J.free(d);return a};
t.Kh=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!==wd||b||(e+=2);var f=N.alloc();f.assign(d);f.Ic(e+2,e+2);if(!f.aa(a))return N.free(f),!1;d=e+1E-4;if(c.type===wd){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.Nb(c.startX,c.startY,c.endX,c.endY,e,a.x,a.y)}if(c.type===
Hd){b=c.startX;var g=c.startY,h=c.endX;c=c.endY;f.x=Math.min(b,h);f.y=Math.min(g,c);f.width=Math.abs(h-b);f.height=Math.abs(c-g);if(null===this.fill){f.Ic(-d,-d);if(f.aa(a))return N.free(f),!1;f.Ic(d,d)}null!==this.stroke&&f.Ic(e,e);a=f.aa(a);N.free(f);return a}if(c.type===Id){g=c.startX;e=c.startY;h=c.endX;var k=c.endY;c=Math.min(g,h);b=Math.min(e,k);g=Math.abs(h-g)/2;e=Math.abs(k-e)/2;c=a.x-(c+g);b=a.y-(b+e);if(null===this.fill){g-=d;e-=d;if(0>=g||0>=e||1>=c*c/(g*g)+b*b/(e*e))return N.free(f),!1;
g+=d;e+=d}null!==this.stroke&&(g+=d,e+=d);N.free(f);return 0>=g||0>=e?!1:1>=c*c/(g*g)+b*b/(e*e)}if(c.type===ud)return N.free(f),null===this.fill?fe(c,a.x,a.y,e):de(c,a,e,1<this.strokeWidth,b);B("Unknown Geometry type: "+c.type);return!1};
t.Dm=function(a,b,c,d){var e=this.desiredSize,f=this.xh;a=Math.max(a,0);b=Math.max(b,0);if(null!==this.zd)var g=this.geometry.bounds;else{var h=this.figure,k=un[h];if(void 0===k){var l=K.Oe[h];"string"===typeof l&&(l=K.Oe[l]);"function"===typeof l?(k=l(null,100,100),un[h]=k):B("Unsupported Figure: "+h)}g=k.bounds}h=g.width;k=g.height;l=g.width;var m=g.height;switch(kl(this,!0)){case yg:d=c=0;break;case vd: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);e=this.maxSize;g=this.minSize;c=Math.max(c-f,g.width);d=Math.max(d-f,g.height);l=Math.min(e.width,l);m=Math.min(e.height,m);l=isFinite(l)?Math.max(c,l):Math.max(h,c);m=isFinite(m)?Math.max(d,m):Math.max(k,d);c=zg(this);switch(c){case yg:break;case vd:h=l;k=m;break;case Ag:c=Math.min(l/h,m/k);isFinite(c)||(c=1);h*=c;k*=c;break;default:B(c+" is not a valid geometryStretch.")}null!==this.zd?(h=Math.max(h,.01),k=Math.max(k,
.01),c=null!==this.zd?this.zd:this.na,e=c.bounds,d=h/e.width,e=k/e.height,isFinite(d)||(d=1),isFinite(e)||(e=1),this.na=1===d&&1===e?c:c.copy().scale(d,e)):null!==this.na&&K.$(this.na.xl,a-f)&&K.$(this.na.wl,b-f)||(this.na=W.makeGeometry(this,h,k));g=this.na.bounds;Infinity===a||Infinity===b?hl(this,g.x-f/2,g.y-f/2,0===a&&0===h?0:g.width+f,0===b&&0===k?0:g.height+f):hl(this,-(f/2),-(f/2),l+f,m+f)};
function zg(a){var b=a.geometryStretch;return null!==a.zd?b===Vk?vd:b:b===Vk?un[a.figure].defaultStretch:b}t.Ih=function(a,b,c,d){ml(this,a,b,c,d)};t.bd=function(a,b,c){return this.vk(a.x,a.y,b.x,b.y,c)};
t.vk=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.xh/2;l=this.na;null===l&&(this.measure(Infinity,Infinity),l=this.na);p=l.bounds;m=!1;if(l.type===wd)if(1.5>=this.strokeWidth)m=K.Ie(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.Ie(l.startX+d,l.startY+m,l.endX+d,l.endY+m,f,g,h,k,a)&&b.push(a);a=new J;K.Ie(l.startX-d,l.startY-m,l.endX-d,l.endY-m,f,g,h,k,a)&&b.push(a);a=new J;K.Ie(l.startX+d,l.startY+m,l.startX-d,l.startY-m,f,g,h,k,a)&&b.push(a);a=new J;K.Ie(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 Ha(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);Ha(b)}else if(l.type===Hd)m=K.bd(p.x-n,p.y-n,p.x+p.width+
n,p.y+p.height+n,f,g,h,k,e);else if(l.type===Id){b=N.allocAt(p.x,p.y,p.width,p.height).Ic(n,n);a:if(0===b.width)m=K.Ie(b.x,b.y,b.x,b.y+b.height,f,g,h,k,e);else if(0===b.height)m=K.Ie(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===ud){p=J.alloc();var r=h-f;var q=k-g;var u=r*r+q*q;e.x=h;e.y=k;for(var v=0;v<l.figures.count;v++){var w=l.figures.j[v],y=w.segments;r=w.startX;q=w.startY;for(var z=r,A=q,C=0;C<y.count;C++){var G=
y.j[C],L=G.type;var I=G.endX;var T=G.endY;var R=!1;switch(L){case Xd:z=I;A=T;break;case yd:R=vn(r,q,I,T,f,g,h,k,p);break;case Yd:R=K.uq(r,q,G.point1X,G.point1Y,G.point2X,G.point2Y,I,T,f,g,h,k,.6,p);break;case Zd:R=K.uq(r,q,r+2/3*(G.point1X-r),q+2/3*(G.point1Y-q),I+2/3*(G.point1X-I),T+2/3*(G.point1Y-T),I,T,f,g,h,k,.6,p);break;case $d:case ae:L=G.type===$d?be(G,w):ce(G,w,r,q);var ca=L.length;if(0===ca){R=vn(r,q,G.centerX,G.centerY,f,g,h,k,p);break}T=null;for(I=0;I<ca;I++){T=L[I];if(0===I&&vn(r,q,T[0],
T[1],f,g,h,k,p)){var qa=Fn(f,g,p,u,e);qa<u&&(u=qa,m=!0)}K.uq(T[0],T[1],T[2],T[3],T[4],T[5],T[6],T[7],f,g,h,k,.6,p)&&(qa=Fn(f,g,p,u,e),qa<u&&(u=qa,m=!0))}I=T[6];T=T[7];break;default:B("Unknown Segment type: "+L)}r=I;q=T;R&&(R=Fn(f,g,p,u,e),R<u&&(u=R,m=!0));G.isClosed&&(I=z,T=A,vn(r,q,I,T,f,g,h,k,p)&&(G=Fn(f,g,p,u,e),G<u&&(u=G,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 B("Unknown Geometry type: "+l.type);if(!m)return!1;this.transform.sa(e);return!0};
function Fn(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 vn(a,b,c,d,e,f,g,h,k){var l=!1,m=(e-g)*(b-d)-(f-h)*(a-c);if(0===m)return!1;k.x=((e*h-f*g)*(a-c)-(e-g)*(a*d-b*c))/m;k.y=((e*h-f*g)*(b-d)-(f-h)*(a*d-b*c))/m;(a>c?a-c:c-a)<(b>d?b-d:d-b)?(a=b<d?b:d,b=b<d?d:b,(k.y>a||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.Jh=function(a,b){if(void 0===b)return a.De(this.actualBounds);var c=this.na;null===c&&(this.measure(Infinity,Infinity),c=this.na);c=c.bounds;var d=this.strokeWidth/2,e=!1,f=J.alloc();f.h(c.x-d,c.y-d);a.aa(b.sa(f))&&(f.h(c.x-d,c.bottom+d),a.aa(b.sa(f))&&(f.h(c.right+d,c.bottom+d),a.aa(b.sa(f))&&(f.h(c.right+d,c.y-d),a.aa(b.sa(f))&&(e=!0))));J.free(f);return e};
t.Lc=function(a,b){if(this.Jh(a,b)||void 0===b&&(b=this.transform,a.De(this.actualBounds)))return!0;var c=rd.alloc();c.set(b);c.St();var d=a.left,e=a.right,f=a.top;a=a.bottom;var g=J.alloc();g.h(d,f);c.sa(g);if(this.Kh(g,!0))return J.free(g),!0;g.h(e,f);c.sa(g);if(this.Kh(g,!0))return J.free(g),!0;g.h(d,a);c.sa(g);if(this.Kh(g,!0))return J.free(g),!0;g.h(e,a);c.sa(g);if(this.Kh(g,!0))return J.free(g),!0;var h=J.alloc(),k=J.alloc();c.set(b);c.iw(this.transform);c.St();h.x=e;h.y=f;h.transform(c);g.x=
d;g.y=f;g.transform(c);b=!1;Gn(this,g,h,k)?b=!0:(g.x=e,g.y=a,g.transform(c),Gn(this,g,h,k)?b=!0:(h.x=d,h.y=a,h.transform(c),Gn(this,g,h,k)?b=!0:(g.x=d,g.y=f,g.transform(c),Gn(this,g,h,k)&&(b=!0))));J.free(g);rd.free(c);J.free(h);J.free(k);return b};function Gn(a,b,c,d){if(!a.bd(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.oy=function(a,b,c){function d(a,b){for(var c=a.length,d=0;d<c;d+=2)if(b.kd(a[d],a[d+1])>e)return!0;return!1}if(c&&null!==this.fill&&this.Kh(a,!0))return!0;var e=a.Fe(b),f=e;1.5<this.strokeWidth&&(e=this.strokeWidth/2+Math.sqrt(e),e*=e);b=this.na;if(null===b&&(this.measure(Infinity,Infinity),b=this.na,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(Db(a.x,a.y,h,k)<=e&&Db(a.x,a.y,l,k)<=e&&Db(a.x,a.y,h,g)<=e&&Db(a.x,a.y,l,g)<=e)return!0}h=b.startX;k=b.startY;l=
b.endX;g=b.endY;if(b.type===wd){if(c=(h-l)*(a.x-l)+(k-g)*(a.y-g),Cb(a.x,a.y,h,k,l,g)<=(0<=(l-h)*(a.x-h)+(g-k)*(a.y-k)&&0<=c?e:f))return!0}else{if(b.type===Hd)return b=!1,c&&(b=Cb(a.x,a.y,h,k,h,g)<=e||Cb(a.x,a.y,h,k,l,k)<=e||Cb(a.x,a.y,l,k,l,g)<=e||Cb(a.x,a.y,h,g,l,g)<=e),b;if(b.type===Id){b=a.x-(h+l)/2;f=a.y-(k+g)/2;var m=Math.abs(l-h)/2,n=Math.abs(g-k)/2;if(0===m||0===n)return Cb(a.x,a.y,h,k,l,g)<=e?!0:!1;if(c){if(a=K.Hz(m,n,b,f),a*a<=e)return!0}else return Db(b,f,-m,0)>=e||Db(b,f,0,-n)>=e||Db(b,
f,0,n)>=e||Db(b,f,m,0)>=e?!1:!0}else if(b.type===ud){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&&Cb(a.x,a.y,f,h,f,l)>e&&Cb(a.x,a.y,f,h,k,h)>e&&Cb(a.x,a.y,k,l,f,l)>e&&Cb(a.x,a.y,k,l,k,h)>e)return!1;f=Math.sqrt(e);if(c){if(null===this.fill?fe(b,a.x,a.y,f):de(b,a,f,!0,!1))return!0}else{c=b.figures;for(b=0;b<c.count;b++){f=c.j[b];g=f.startX;m=f.startY;if(a.kd(g,m)>e)return!1;h=f.segments.j;k=h.length;for(l=0;l<k;l++)switch(n=h[l],n.type){case Xd:case yd:g=n.endX;
m=n.endY;if(a.kd(g,m)>e)return!1;break;case Yd:var p=Ea();K.Ce(g,m,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.8,p);g=d(p,a);Ha(p);if(g)return!1;g=n.endX;m=n.endY;if(a.kd(g,m)>e)return!1;break;case Zd:p=Ea();K.Wq(g,m,n.point1X,n.point1Y,n.endX,n.endY,.8,p);g=d(p,a);Ha(p);if(g)return!1;g=n.endX;m=n.endY;if(a.kd(g,m)>e)return!1;break;case $d:case ae:p=n.type===$d?be(n,f):ce(n,f,g,m);var r=p.length;if(0===r){g=n.centerX;m=n.centerY;if(a.kd(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.Ce(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],.8,q),d(q,a))return Ha(q),!1;Ha(q);null!==n&&(g=n[6],m=n[7]);break;default:B("Unknown Segment type: "+n.type)}}return!0}}}return!1};t.cc=function(){this.na=null};function Hn(a){var b=a.diagram;null!==b&&b.undoManager.isUndoingRedoing||(a.segmentOrientation=Um,"None"!==a.lm?(a.segmentIndex=-1,a.alignmentFocus=hd):"None"!==a.nl&&(a.segmentIndex=0,a.alignmentFocus=new P(1-hd.x,hd.y)))}
W.makeGeometry=function(a,b,c){if("None"!==a.toArrow)var d=In[a.toArrow];else"None"!==a.fromArrow?d=In[a.fromArrow]:(d=K.Oe[a.figure],"string"===typeof d&&(d=K.Oe[d]),void 0===d&&B("Unknown Shape.figure: "+a.figure),d=d(a,b,c),d.xl=b,d.wl=c);if(null===d){var e=K.Oe.Rectangle;"function"===typeof e&&(d=e(a,b,c))}return d};
function Jn(a){var b=In[a];if(void 0===b){var c=a.toLowerCase();if("none"===c)return"None";b=In[c];if(void 0===b){var d=null,e;for(e in K.bn)if(e.toLowerCase()===c){d=e;break}if(null!==d)return a=Jd(K.bn[d],!1),In[d]=a,c!==d&&(In[c]=d),d}}return"string"===typeof b?b:b instanceof td?a:null}
ma.Object.defineProperties(W.prototype,{geometry:{get:function(){return null!==this.na?this.na:this.zd},set:function(a){var b=this.na,c=this.zd;if(b!==a){null!==a?this.zd=this.na=a.freeze():this.zd=this.na=null;var d=this.part;null!==d&&(d.jh=NaN);this.o();this.g("geometry",b||c,a);el(this)&&(a=this.part,null!==a&&fl(this,a,"geometryString"))}}},geometryString:{get:function(){return null===this.geometry?"":this.geometry.toString()},set:function(a){a=
Jd(a);var b=a.normalize();this.geometry=a;this.position=a=J.allocAt(-b.x,-b.y);J.free(a)}},isGeometryPositioned:{get:function(){return this.ro},set:function(a){var b=this.ro;b!==a&&(this.ro=a,this.o(),this.g("isGeometryPositioned",b,a))}},fill:{get:function(){return this.ml},set:function(a){var b=this.ml;b!==a&&(null!==a&&Rl(a,"Shape.fill"),a instanceof tl&&a.freeze(),this.ml=a,this.M(),this.g("fill",b,a))}},stroke:{
get:function(){return this.Hc},set:function(a){var b=this.Hc;b!==a&&(null!==a&&Rl(a,"Shape.stroke"),a instanceof tl&&a.freeze(),this.Hc=a,this.M(),this.g("stroke",b,a))}},strokeWidth:{get:function(){return this.xh},set:function(a){var b=this.xh;if(b!==a)if(0<=a){this.xh=a;this.o();var c=this.part;null!==c&&(c.jh=NaN);this.g("strokeWidth",b,a)}else va(a,"value >= 0",W,"strokeWidth:value")}},strokeCap:{get:function(){return this.em},set:function(a){var b=
this.em;b!==a&&("string"!==typeof a||"butt"!==a&&"round"!==a&&"square"!==a?va(a,'"butt", "round", or "square"',W,"strokeCap"):(this.em=a,this.M(),this.g("strokeCap",b,a)))}},strokeJoin:{get:function(){return this.fm},set:function(a){var b=this.fm;b!==a&&("string"!==typeof a||"miter"!==a&&"bevel"!==a&&"round"!==a?va(a,'"miter", "bevel", or "round"',W,"strokeJoin"):(this.fm=a,this.M(),this.g("strokeJoin",b,a)))}},strokeMiterLimit:{get:function(){return this.dk},
set:function(a){var b=this.dk;if(b!==a&&1<=a){this.dk=a;this.M();var c=this.part;null!==c&&(c.jh=NaN);this.g("strokeMiterLimit",b,a)}}},strokeDashArray:{get:function(){return this.vh},set:function(a){var b=this.vh;if(b!==a){if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];0<=f&&isFinite(f)||B("strokeDashArray:value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.vh=a;this.M();this.g("strokeDashArray",
b,a)}}},strokeDashOffset:{get:function(){return this.wh},set:function(a){var b=this.wh;b!==a&&0<=a&&(this.wh=a,this.M(),this.g("strokeDashOffset",b,a))}},figure:{get:function(){return this.Xn},set:function(a){var b=this.Xn;if(b!==a){var c=K.Oe[a];"function"===typeof c?c=a:(c=K.Oe[a.toLowerCase()])||B("Unknown Shape.figure: "+a);b!==c&&(a=this.part,null!==a&&(a.jh=NaN),this.Xn=c,this.zd=null,this.cc(),this.o(),this.g("figure",b,c))}}},toArrow:{
get:function(){return this.lm},set:function(a){var b=this.lm;!0===a?a="Standard":!1===a&&(a="");if(b!==a){var c=Jn(a);null===c?B("Unknown Shape.toArrow: "+a):b!==c&&(this.lm=c,this.zd=null,this.cc(),this.o(),Hn(this),this.g("toArrow",b,c))}}},fromArrow:{get:function(){return this.nl},set:function(a){var b=this.nl;!0===a?a="Standard":!1===a&&(a="");if(b!==a){var c=Jn(a);null===c?B("Unknown Shape.fromArrow: "+a):b!==c&&(this.nl=c,this.zd=null,this.cc(),this.o(),
Hn(this),this.g("fromArrow",b,c))}}},spot1:{get:function(){return this.nf},set:function(a){var b=this.nf;b.w(a)||(this.nf=a=a.G(),this.o(),this.g("spot1",b,a))}},spot2:{get:function(){return this.pf},set:function(a){var b=this.pf;b.w(a)||(this.pf=a=a.G(),this.o(),this.g("spot2",b,a))}},parameter1:{get:function(){return this.op},set:function(a){var b=this.op;b!==a&&(this.op=a,this.cc(),this.o(),this.g("parameter1",
b,a))}},parameter2:{get:function(){return this.pp},set:function(a){var b=this.pp;b!==a&&(this.pp=a,this.cc(),this.o(),this.g("parameter2",b,a))}},naturalBounds:{get:function(){if(null!==this.na)return this.qc.assign(this.na.bounds),this.qc;var a=this.desiredSize;return new N(0,0,a.width,a.height)}},pathPattern:{get:function(){return this.rp},set:function(a){var b=this.rp;b!==a&&(this.rp=a,this.M(),this.g("pathPattern",
b,a))}},geometryStretch:{get:function(){return this.fo},set:function(a){var b=this.fo;b!==a&&(this.fo=a,this.g("geometryStretch",b,a))}},interval:{get:function(){return this.Qd},set:function(a){var b=this.Qd;a=Math.round(a);if(b!==a&&0!==a&&isFinite(a)){this.Qd=a;var c=this.diagram;null!==c&&this.panel===c.grid&&oj(c);this.o();c=this.panel;null!==c&&(c.dh=null);this.g("interval",b,a)}}},graduatedStart:{get:function(){return this.Od},
set:function(a){var b=this.Od;b!==a&&(0>a?a=0:1<a&&(a=1),this.Od=a,this.o(),this.g("graduatedStart",b,a))}},graduatedEnd:{get:function(){return this.Md},set:function(a){var b=this.Md;b!==a&&(0>a?a=0:1<a&&(a=1),this.Md=a,this.o(),this.g("graduatedEnd",b,a))}},graduatedSkip:{get:function(){return this.Nd},set:function(a){var b=this.Nd;b!==a&&(this.Nd=a,this.o(),this.g("graduatedSkip",b,a))}}});W.prototype.intersectsRect=W.prototype.Lc;
W.prototype.containedInRect=W.prototype.Jh;W.prototype.getNearestIntersectionPoint=W.prototype.bd;W.prototype.getDocumentBounds=W.prototype.wm;W.prototype.getDocumentPoint=W.prototype.ga;var In=new ab,un=new ab;W.className="Shape";W.getFigureGenerators=function(){var a=new H,b;for(b in K.Oe)b!==b.toLowerCase()&&a.add(b,K.Oe[b]);a.freeze();return a};W.defineFigureGenerator=function(a,b){var c=a.toLowerCase(),d=K.Oe;d[a]=b;d[c]=a};
W.getArrowheadGeometries=function(){var a=new H;for(d in K.bn)if(void 0===In[d]){var b=Jd(K.bn[d],!1);In[d]=b;b=d.toLowerCase();b!==d&&(In[b]=d)}for(var c in In)if(c!==c.toLowerCase()){var d=In[c];d instanceof td&&a.add(c,d)}a.freeze();return a};W.defineArrowheadGeometry=function(a,b){var c=null;"string"===typeof b?c=Jd(b,!1):c=b;b=a.toLowerCase();"none"!==b&&a!==b||B("Shape.defineArrowheadGeometry name must not be empty or None or all-lower-case: "+a);var d=In;d[a]=c;d[b]=a};
function Vg(){Y.call(this);Kn||(Ln=Tg?(new Dk(null)).context:null,Kn=!0);this.Hx=this.Tb="";this.Hc="black";this.je="13px sans-serif";this.Vi="start";this.Ld=yg;this.aj=dd;this.Mj=!0;this.zi=this.Ai=!1;this.mg=Mn;this.zg=Nn;this.ws=this.sb=this.Vc=0;this.dv=this.ev=null;this.Un=!1;this.Cc=this.wn=this.gq=this.Wi=this.hq=null;this.mf=this.lf=0;this.re=Infinity;this.Di=0;this.ke=null;this.xe=0;this.ie=this.jb=this.Pb=null;this.Qd=1;this.Od=0;this.Md=1;this.Nd=this.Ij=null}la(Vg,Y);
Vg.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.Tb=this.Tb;a.Hx=this.Hx;a.Hc=this.Hc;a.je=this.je;a.Vi=this.Vi;a.Ld=this.Ld;a.aj=this.aj;a.Mj=this.Mj;a.Ai=this.Ai;a.zi=this.zi;a.mg=this.mg;a.zg=this.zg;a.Vc=this.Vc;a.ws=this.ws;a.sb=this.sb;a.ev=this.ev;a.dv=this.dv;a.Un=this.Un;a.hq=this.hq;a.Wi=this.Wi;a.gq=this.gq;a.wn=this.wn;a.Cc=this.Cc;a.lf=this.lf;a.mf=this.mf;a.re=this.re;a.ke=this.ke;a.xe=this.xe;a.Pb=this.Pb;a.jb=this.jb;a.ie=this.ie;a.Di=this.Di;a.Qd=
this.Qd;a.Od=this.Od;a.Md=this.Md;a.Ij=this.Ij;a.Nd=this.Nd};
function Tm(a,b){a.F=b.F|6144;a.tb=b.opacity;a.kb=b.background;a.dc=b.areaBackground;a.Uc=b.desiredSize.G();a.fg=b.minSize.G();a.eg=b.maxSize.G();a.cg=b.cg.copy();a.ya=b.scale;a.Yb=b.angle;a.ze=b.stretch;a.ih=b.margin.G();a.yb=b.alignment.G();a.Tk=b.alignmentFocus.G();a.Vl=b.segmentFraction;a.Wl=b.segmentOffset.G();a.Xl=b.segmentOrientation;null!==b.pd&&(a.pd=b.pd.copy());a.Zl=b.shadowVisible;b instanceof Vg&&(a.Tb=b.Tb,a.Hc=b.Hc,a.je=b.je,a.Vi=b.Vi,a.Ld=b.Ld,a.aj=b.aj,a.Mj=b.Mj,a.Ai=b.Ai,a.zi=b.zi,
a.mg=b.mg,a.zg=b.zg,a.ke=null,a.lf=b.lf,a.mf=b.mf,a.re=b.re,a.Di=b.Di,a.Qd=b.Qd,a.Od=b.Od,a.Md=b.Md,a.Ij=b.Ij,a.Nd=b.Nd)}t=Vg.prototype;t.hb=function(a){a.classType===Vg?this.wrap=a:Y.prototype.hb.call(this,a)};t.toString=function(){return 22<this.Tb.length?'TextBlock("'+this.Tb.substring(0,20)+'"...)':'TextBlock("'+this.Tb+'")'};t.o=function(){Y.prototype.o.call(this);this.dv=this.ev=null};
t.ej=function(a,b){if(null!==this.Hc&&0!==this.Tb.length&&null!==this.je){var c=this.naturalBounds,d=this.actualBounds,e=c.width,f=c.height,g=On(this),h=a.textAlign=this.Vi,k=b.Al;"start"===h?h=k?"right":"left":"end"===h&&(h=k?"left":"right");k=this.Ai;var l=this.zi;li(this,a,this.Hc,!0,!1,c,d);(k||l)&&li(this,a,this.Hc,!1,!1,c,d);d=0;c=!1;var m=J.allocAt(0,0);this.Ad.sa(m);var n=J.allocAt(0,g);this.Ad.sa(n);var p=m.Fe(n);J.free(m);J.free(n);m=b.scale;8>p*m*m&&(c=!0);b.Gb!==a&&(c=!1);!1===b.Ge("textGreeking")&&
(c=!1);b=this.lf;p=this.mf;switch(this.flip){case $k:a.translate(e,0);a.scale(-1,1);break;case Zk:a.translate(0,f);a.scale(1,-1);break;case al:a.translate(e,f),a.scale(-1,-1)}m=this.Vc;n=(b+g+p)*m;f>n&&(d=this.aj,d=d.y*f-d.y*n+d.offsetY);if(1===m&&null!==this.ie)p=this.sb,p>e&&(p=e),this.dj(this.ie,a,0,d+b,e,g,p,c,h,k,l);else if(null!==this.Pb&&null!==this.jb)for(n=0;n<m;n++){var r=this.Pb[n];r>e&&(r=e);d+=b;this.dj(this.jb[n],a,0,d,e,g,r,c,h,k,l);d+=g+p}switch(this.flip){case $k:a.scale(-1,1);a.translate(-e,
0);break;case Zk:a.scale(1,-1);a.translate(0,-f);break;case al:a.scale(-1,-1),a.translate(-e,-f)}}};
t.dj=function(a,b,c,d,e,f,g,h,k,l,m){var n=0;h?("left"===k?n=0:"right"===k?n=e-g:"center"===k&&(n=(e-g)/2),b.fillRect(c+n,d+.25*f,g,1)):("left"===k?n=0:"right"===k?n=e:"center"===k&&(n=e/2),e=null!==Pn?Pn(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),l&&(k=null!==Qn?Qn(this,f):.8*f,b.beginPath(),b.lineWidth=a,b.moveTo(c+n,d+k),b.lineTo(c+n+g,d+k),b.stroke()),m&&(b.beginPath(),b.lineWidth=a,d=d+f-f/2.2|0,0!==a%2&&(d+=.5),b.moveTo(c+n,d),b.lineTo(c+
n+g,d),b.stroke()))};
t.Dm=function(a,b,c,d){this.Di=a;var e=this.je;null!==Ln&&Rn!==e&&(Rn=Ln.font=e);this.sb=this.xe=0;this.ie=this.jb=this.Pb=this.ke=null;var f;if(isNaN(this.desiredSize.width)){e=this.Tb.replace(/\r\n/g,"\n").replace(/\r/g,"\n");if(0===e.length)e=0;else if(this.isMultiline){for(var g=f=0,h=!1;!h;){var k=e.indexOf("\n",g);-1===k&&(k=e.length,h=!0);f=Math.max(f,Sn(e.substr(g,k-g).trim()));g=k+1}e=f}else f=e.indexOf("\n",0),0<=f&&(e=e.substr(0,f)),e=Sn(e);e=Math.min(e,a/this.scale);e=Math.max(8,e)}else e=
this.desiredSize.width;null!==this.panel&&(e=Math.min(e,this.panel.maxSize.width));f=Tn(this,e);isNaN(this.desiredSize.height)?f=Math.min(f,b/this.scale):f=this.desiredSize.height;g=f;if(0!==this.sb&&null!==this.Pb&&null!==this.jb&&this.mg===Un&&(b=this.je,b=this.mg===Un?Vn(b):0,h=this.lf+this.mf,h=Math.max(0,On(this)+h),g=Math.min(this.maxLines-1,Math.max(Math.floor(g/h+.01)-1,0)),!(g+1>=this.jb.length))){h=this.jb[g];for(b=Math.max(1,a-b);Sn(h)>b&&1<h.length;)h=h.substr(0,h.length-1);h+=Wn;b=Sn(h);
this.jb[g]=h;this.jb=this.jb.slice(0,g+1);this.Pb[g]=b;this.Pb=this.Pb.slice(0,g+1);this.xe=this.jb.length;this.sb=Math.max(this.sb,b);this.Vc=this.xe;1===this.Vc&&(this.ie=this.jb[0])}if(this.wrap===Xn||isNaN(this.desiredSize.width))e=isNaN(a)?this.sb:Math.min(a,this.sb),isNaN(this.desiredSize.width)&&(e=Math.max(8,e));e=Math.max(c,e);f=Math.max(d,f);Wb(this.qc,e,f);hl(this,0,0,e,f)};t.Ih=function(a,b,c,d){ml(this,a,b,c,d)};
function Yn(a,b,c){if(null===a.ie)a.ie=b,a.sb=c;else{if(null===a.jb||null===a.Pb)a.jb=[],a.Pb=[],a.jb.push(a.ie),a.Pb.push(a.sb);a.jb.push(b);a.Pb.push(c)}}
function Zn(a,b,c,d){b=b.trim();var e=0;var f=a.je;var g=a.lf+a.mf;g=Math.max(0,On(a)+g);var h=a.mg===Un?Vn(f):0;if(a.Vc>=a.re)null!==d&&d.h(0,g);else{var k=b;if(a.zg===$n)if(a.xe=1,f=Sn(b),0===h||f<=c)a.sb=Math.max(a.sb,f),Yn(a,b,a.sb),null!==d&&d.h(f,g);else{e=ao(a,k);k=k.substr(e.length);b=ao(a,k);for(f=Sn(e+b);0<b.length&&f<=c;)e+=b,k=k.substr(b.length),b=ao(a,k),f=Sn((e+b).trim());e+=b.trim();for(c=Math.max(1,c-h);Sn(e)>c&&1<e.length;)e=e.substr(0,e.length-1);e+=Wn;b=Sn(e);a.sb=b;Yn(a,e,b);null!==
d&&d.h(b,g)}else{h=0;0===k.length&&(h=1,Yn(a,k,0));for(;0<k.length;){var l=ao(a,k);for(k=k.substr(l.length);Sn(l)>c;){var m=1;f=Sn(l.substr(0,m));for(b=0;f<=c;)m++,b=f,f=Sn(l.substr(0,m));if(1===m){var n=f;e=Math.max(e,f)}else n=b,e=Math.max(e,b);m--;1>m&&(m=1);Yn(a,l.substr(0,m),n);h++;l=l.substr(m);if(a.Vc+h>a.re)break}b=ao(a,k);for(f=Sn(l+b);0<b.length&&f<=c;)l+=b,k=k.substr(b.length),b=ao(a,k),f=Sn((l+b).trim());l=l.trim();if(""!==l&&("\u00ad"===l[l.length-1]&&(l=l.substring(0,l.length-1)+"\u2010"),
0===b.length?(m=f,e=Math.max(e,f)):(m=b=Sn(l),e=Math.max(e,b)),Yn(a,l,m),h++,a.Vc+h>a.re))break}a.xe=Math.min(a.re,h);a.sb=Math.max(a.sb,e);null!==d&&d.h(a.sb,g*a.xe)}}}function ao(a,b){if(a.zg===bo)return b.substr(0,1);a=b.length;for(var c=0,d=co;c<a&&!d.test(b.charAt(c));)c++;for(;c<a&&d.test(b.charAt(c));)c++;return c>=a?b:b.substr(0,c)}function Sn(a){return null===Ln?8*a.length:Ln.measureText(a).width}
function On(a){if(null!==a.ke)return a.ke;var b=a.je;if(null===Ln){var c=16;return a.ke=c}void 0!==eo[b]&&5E3>fo?c=eo[b]:(c=1.3*Ln.measureText("M").width,eo[b]=c,fo++);return a.ke=c}function Vn(a){if(null===Ln)return 6;if(void 0!==go[a]&&5E3>ho)var b=go[a];else b=Ln.measureText(Wn).width,go[a]=b,ho++;return b}
function Tn(a,b){var c=a.Tb.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),d=a.lf+a.mf;d=Math.max(0,On(a)+d);if(0===c.length)return a.sb=0,a.Vc=1,d;if(!a.isMultiline){var e=c.indexOf("\n",0);0<=e&&(c=c.substr(0,e))}e=0;for(var f=a.Vc=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.zg!==$n){a.xe=0;var k=M.alloc();Zn(a,f,b,k);e+=k.height;M.free(k);a.Vc+=a.xe}else Zn(a,f,b,null),e+=d,a.Vc++;a.Vc===a.re&&(h=!0)}f=g+1}return a.ws=e}
ma.Object.defineProperties(Vg.prototype,{font:{get:function(){return this.je},set:function(a){var b=this.je;b!==a&&(this.je=a,this.ke=null,this.o(),this.g("font",b,a))}},text:{get:function(){return this.Tb},set:function(a){var b=this.Tb;null!==a&&void 0!==a?a=a.toString():a="";b!==a&&(this.Tb=a,this.o(),this.g("text",b,a))}},textAlign:{get:function(){return this.Vi},set:function(a){var b=this.Vi;b===a||"start"!==
a&&"end"!==a&&"left"!==a&&"right"!==a&&"center"!==a||(this.Vi=a,this.M(),this.g("textAlign",b,a))}},flip:{get:function(){return this.Ld},set:function(a){var b=this.Ld;b!==a&&(this.Ld=a,this.M(),this.g("flip",b,a))}},verticalAlignment:{get:function(){return this.aj},set:function(a){var b=this.aj;b.w(a)||(this.aj=a=a.G(),Cl(this),this.g("verticalAlignment",b,a))}},naturalBounds:{get:function(){if(!this.qc.u()){var a=
M.alloc();Zn(this,this.Tb,999999,a);var b=a.width;M.free(a);a=Tn(this,b);var c=this.desiredSize;isNaN(c.width)||(b=c.width);isNaN(c.height)||(a=c.height);Wb(this.qc,b,a)}return this.qc}},isMultiline:{get:function(){return this.Mj},set:function(a){var b=this.Mj;b!==a&&(this.Mj=a,this.o(),this.g("isMultiline",b,a))}},isUnderline:{get:function(){return this.Ai},set:function(a){var b=this.Ai;b!==a&&(this.Ai=a,this.M(),this.g("isUnderline",b,
a))}},isStrikethrough:{get:function(){return this.zi},set:function(a){var b=this.zi;b!==a&&(this.zi=a,this.M(),this.g("isStrikethrough",b,a))}},wrap:{get:function(){return this.zg},set:function(a){var b=this.zg;b!==a&&(this.zg=a,this.o(),this.g("wrap",b,a))}},overflow:{get:function(){return this.mg},set:function(a){var b=this.mg;b!==a&&(this.mg=a,this.o(),this.g("overflow",b,a))}},stroke:{
get:function(){return this.Hc},set:function(a){var b=this.Hc;b!==a&&(null!==a&&Rl(a,"TextBlock.stroke"),a instanceof tl&&a.freeze(),this.Hc=a,this.M(),this.g("stroke",b,a))}},lineCount:{get:function(){return this.Vc}},editable:{get:function(){return this.Un},set:function(a){var b=this.Un;b!==a&&(this.Un=a,this.g("editable",b,a))}},textEditor:{get:function(){return this.hq},set:function(a){var b=this.hq;b!==a&&
(this.hq=a,this.g("textEditor",b,a))}},errorFunction:{get:function(){return this.Cc},set:function(a){var b=this.Cc;b!==a&&(this.Cc=a,this.g("errorFunction",b,a))}},interval:{get:function(){return this.Qd},set:function(a){var b=this.Qd;a=Math.round(a);if(b!==a&&0!==a&&isFinite(a)){this.Qd=a;this.o();var c=this.panel;null!==c&&(c.dh=null);this.g("interval",b,a)}}},graduatedStart:{get:function(){return this.Od},
set:function(a){var b=this.Od;b!==a&&(0>a?a=0:1<a&&(a=1),this.Od=a,this.o(),this.g("graduatedStart",b,a))}},graduatedEnd:{get:function(){return this.Md},set:function(a){var b=this.Md;b!==a&&(0>a?a=0:1<a&&(a=1),this.Md=a,this.o(),this.g("graduatedEnd",b,a))}},graduatedFunction:{get:function(){return this.Ij},set:function(a){var b=this.Ij;b!==a&&(this.Ij=a,this.o(),this.g("graduatedFunction",b,a))}},graduatedSkip:{
get:function(){return this.Nd},set:function(a){var b=this.Nd;b!==a&&(this.Nd=a,this.o(),this.g("graduatedSkip",b,a))}},textValidation:{get:function(){return this.Wi},set:function(a){var b=this.Wi;b!==a&&(this.Wi=a,this.g("textValidation",b,a))}},textEdited:{get:function(){return this.gq},set:function(a){var b=this.gq;b!==a&&(this.gq=a,this.g("textEdited",b,a))}},spacingAbove:{get:function(){return this.lf},set:function(a){var b=
this.lf;b!==a&&(this.lf=a,this.g("spacingAbove",b,a))}},spacingBelow:{get:function(){return this.mf},set:function(a){var b=this.mf;b!==a&&(this.mf=a,this.g("spacingBelow",b,a))}},maxLines:{get:function(){return this.re},set:function(a){var b=this.re;b!==a&&(a=Math.floor(a),0>=a&&va(a,"> 0",Vg,"maxLines"),this.re=a,this.g("maxLines",b,a),this.o())}},metrics:{get:function(){return{arrSize:null!==this.Pb?this.Pb:
[this.sb],arrText:null!==this.jb?this.jb:[this.ie],maxLineWidth:this.sb,fontHeight:this.ke}}},choices:{get:function(){return this.wn},set:function(a){var b=this.wn;b!==a&&(this.wn=a,this.g("choices",b,a))}}});
var Pn=null,Qn=null,$n=new D(Vg,"None",0),Xn=new D(Vg,"WrapFit",1),Nn=new D(Vg,"WrapDesiredSize",2),bo=new D(Vg,"WrapBreakAll",3),Mn=new D(Vg,"OverflowClip",0),Un=new D(Vg,"OverflowEllipsis",1),co=/[ \u200b\u00ad]/,eo=new ab,fo=0,go=new ab,ho=0,Wn="...",Rn="",Ln=null,Kn=!1;Vg.className="TextBlock";Vg.getEllipsis=function(){return Wn};Vg.setEllipsis=function(a){Wn=a;go=new ab;ho=0};Vg.getBaseline=function(){return Pn};Vg.setBaseline=function(a){Pn=a;a=Pa();for(var b=a.length,c=0;c<b;c++)a[c].Je()};
Vg.getUnderline=function(){return Qn};Vg.setUnderline=function(a){Qn=a;a=Pa();for(var b=a.length,c=0;c<b;c++)a[c].Je()};Vg.isValidFont=function(a){Kn||(Ln=Tg?(new Dk(null)).context:null,Kn=!0);if(null===Ln)return!0;var b=Ln.font;if(a===b||"10px sans-serif"===a)return!0;Ln.font="10px sans-serif";Ln.font=a;var c=Ln.font;if("10px sans-serif"!==c)return Ln.font=b,!0;Ln.font="19px serif";var d=Ln.font;Ln.font=a;c=Ln.font;Ln.font=b;return c!==d};Vg.None=$n;Vg.WrapFit=Xn;Vg.WrapDesiredSize=Nn;
Vg.WrapBreakAll=bo;Vg.OverflowClip=Mn;Vg.OverflowEllipsis=Un;function io(){this.Pb=[];this.jb=[]}io.prototype.reset=function(){this.Pb=[];this.jb=[]};io.prototype.Dt=function(a){this.Pb=Ba(a.Pb);this.jb=Ba(a.jb)};io.className="TextBlockMetrics";function Zj(){Y.call(this);this.Yg=null;this.Yp="";this.uh=kc;this.sl=vd;this.qf=this.Cc=null;this.rl=Bc;this.Ld=yg;this.hm=null;this.Su=!1;this.$r=!0;this.Il=!1;this.am=null}la(Zj,Y);
Zj.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.element=this.Yg;a.Yp=this.Yp;a.uh=this.uh.G();a.sl=this.sl;a.Ld=this.Ld;a.Cc=this.Cc;a.qf=this.qf;a.rl=this.rl.G();a.$r=this.$r;a.am=this.am};t=Zj.prototype;t.hb=function(a){a===yg||a===Ag||a===Yk?this.imageStretch=a:Y.prototype.hb.call(this,a)};t.toString=function(){return"Picture("+this.source+")#"+mb(this)};function kk(a){void 0===a&&(a="");""!==a?jo[a]&&(delete jo[a],ko--):(jo=new ab,ko=0)}
function lo(a,b){a.ns=!0;a.ol=!1;for(var c,d=Pa(),e=d.length,f=0;f<e;f++){var g=d[f];c=a.getAttribute("src");var h=g.Pi.H(c);if(null!==h)for(var k=h.length,l=0;l<k;l++)c=h[l],g.Ns.add(c),g.Db(),void 0===a.ov&&(a.ov=b,null!==c.qf&&c.qf(c,b))}}function mo(a,b){a.ol=b;for(var c,d=Pa(),e=d.length,f=0;f<e;f++){var g=d[f],h=a.getAttribute("src");c=g.Pi.H(h);if(null!==c){g=c.length;h=Ea();for(var k=0;k<g;k++)h.push(c[k]);for(k=0;k<g;k++)c=h[k],null!==c.Cc&&c.Cc(c,b);Ha(h)}}}
t.MA=function(){if(""!==this.source){kk(this.source);var a=this.source;this.source="";this.source=a}};t.Je=function(){this.M()};
t.ej=function(a,b){var c=this.Yg;if(null!==c){var d=c.getAttribute("src");if(!(c instanceof HTMLImageElement&&(null===d||""===d)||c.ol instanceof Event&&a instanceof xl)){d=this.naturalBounds;var e=0,f=0,g=this.Su,h=g?+c.width:c.naturalWidth;g=g?+c.height:c.naturalHeight;void 0===h&&c.videoWidth&&(h=c.videoWidth);void 0===g&&c.videoHeight&&(g=c.videoHeight);h=h||d.width;g=g||d.height;if(0!==h&&0!==g){var k=h,l=g;this.sourceRect.u()&&(e=this.uh.x,f=this.uh.y,h=this.uh.width,g=this.uh.height);var m=
h,n=g,p=this.sl,r=this.rl;switch(p){case yg:if(this.sourceRect.u())break;m>=d.width&&(e=e+r.offsetX+(m*r.x-d.width*r.x));n>=d.height&&(f=f+r.offsetY+(n*r.y-d.height*r.y));h=Math.min(d.width,m);g=Math.min(d.height,n);break;case vd:m=d.width;n=d.height;break;case Ag:case Yk:p===Ag?(p=Math.min(d.height/n,d.width/m),m*=p,n*=p):p===Yk&&(p=Math.max(d.height/n,d.width/m),m*=p,n*=p,m>=d.width&&(e=(e+r.offsetX+(m*r.x-d.width*r.x)/m)*h),n>=d.height&&(f=(f+r.offsetY+(n*r.y-d.height*r.y)/n)*g),h*=1/(m/d.width),
g*=1/(n/d.height),m=d.width,n=d.height)}p=this.Af()*b.scale;var q=m*p*n*p,u=h*g/q,v=c.__goCache;p=null;var w=no;if(c.ns&&void 0!==v&&4<q&&u>w*w)for(null===v.cj&&(oo(v,4,k,l,c),oo(v,16,k,l,c)),k=v.cj,l=k.length,q=0;q<l;q++)if(k[q].ratio*k[q].ratio<u)p=k[q];else break;if(!b.kl){if(null===this.hm)if(null===this.Yg)this.hm=!1;else{k=(new Dk(null)).context;k.drawImage(this.Yg,0,0);try{k.getImageData(0,0,1,1).data[3]&&(this.hm=!1),this.hm=!1}catch(y){this.hm=!0}}if(this.hm)return}k=0;m<d.width&&(k=r.offsetX+
(d.width*r.x-m*r.x));l=0;n<d.height&&(l=r.offsetY+(d.height*r.y-n*r.y));switch(this.flip){case $k:a.translate(Math.min(d.width,m),0);a.scale(-1,1);break;case Zk:a.translate(0,Math.min(d.height,n));a.scale(1,-1);break;case al:a.translate(Math.min(d.width,m),Math.min(d.height,n)),a.scale(-1,-1)}if(b.Ge("pictureRatioOptimization")&&!b.xi&&void 0!==v&&null!==p&&1!==p.ratio){a.save();b=p.ratio;try{a.drawImage(p.source,e/b,f/b,Math.min(p.source.width,h/b),Math.min(p.source.height,g/b),k,l,Math.min(d.width,
m),Math.min(d.height,n))}catch(y){this.$r=!1}a.restore()}else try{a.drawImage(c,e,f,h,g,k,l,Math.min(d.width,m),Math.min(d.height,n))}catch(y){this.$r=!1}switch(this.flip){case $k:a.scale(-1,1);a.translate(-Math.min(d.width,m),0);break;case Zk:a.scale(1,-1);a.translate(0,-Math.min(d.height,n));break;case al:a.scale(-1,-1),a.translate(-Math.min(d.width,m),-Math.min(d.height,n))}}}}};
t.Dm=function(a,b,c,d){var e=this.desiredSize,f=kl(this,!0),g=this.Yg,h=this.Su;if(h||!this.Il&&g&&g.complete)this.Il=!0;null===g&&(isFinite(e.width)||(a=0),isFinite(e.height)||(b=0));isFinite(e.width)||f===vd||f===Wk?(isFinite(a)||(a=this.sourceRect.u()?this.sourceRect.width:h?+g.width:g.naturalWidth),c=0):null!==g&&!1!==this.Il&&(a=this.sourceRect.u()?this.sourceRect.width:h?+g.width:g.naturalWidth);isFinite(e.height)||f===vd||f===Xk?(isFinite(b)||(b=this.sourceRect.u()?this.sourceRect.height:h?
+g.height:g.naturalHeight),d=0):null!==g&&!1!==this.Il&&(b=this.sourceRect.u()?this.sourceRect.height:h?+g.height:g.naturalHeight);isFinite(e.width)&&(a=e.width);isFinite(e.height)&&(b=e.height);e=this.maxSize;f=this.minSize;c=Math.max(c,f.width);d=Math.max(d,f.height);a=Math.min(e.width,a);b=Math.min(e.height,b);a=Math.max(c,a);b=Math.max(d,b);null===g||g.complete||(isFinite(a)||(a=0),isFinite(b)||(b=0));Wb(this.qc,a,b);hl(this,0,0,a,b)};t.Ih=function(a,b,c,d){ml(this,a,b,c,d)};
ma.Object.defineProperties(Zj.prototype,{element:{get:function(){return this.Yg},set:function(a){var b=this.Yg;if(b!==a){null===a||a instanceof HTMLImageElement||a instanceof HTMLVideoElement||a instanceof HTMLCanvasElement||B("Picture.element must be an instance of Image, Canvas, or Video, not: "+a);this.Su=a instanceof HTMLCanvasElement;this.Yg=a;if(null!==a)if(a instanceof HTMLCanvasElement||!0===a.complete)a.ol instanceof Event&&null!==this.Cc&&this.Cc(this,a.ol),
!0===a.ns&&null!==this.qf&&this.qf(this,a.ov),a.ns=!0,this.desiredSize.u()||(nj(this,!1),this.o());else{var c=this;a.vx||(a.addEventListener("load",function(b){lo(a,b);c.desiredSize.u()||(nj(c,!1),c.o())}),a.addEventListener("error",function(b){mo(a,b)}),a.vx=!0)}this.g("element",b,a);this.M()}}},source:{get:function(){return this.Yp},set:function(a){var b=this.Yp;if(b!==a){this.Yp=a;var c=jo,d=this.diagram;if(Tg){var e=null;if(void 0!==c[a])e=c[a];else if(""!==a){30<
ko&&(kk(),c=jo);e=ta("img");var f=this;e.addEventListener("load",function(a){lo(e,a);f.desiredSize.u()||(nj(f,!1),f.o())});e.addEventListener("error",function(a){mo(e,a)});e.vx=!0;var g=this.am;null!==g&&(e.crossOrigin=g(this));e.src=a;c[a]=e;ko++}null!==d&&ak(d,this);this.element=e;null!==d&&null!==e&&Yj(d,this);null!==e&&void 0===e.__goCache&&(e.__goCache=new po);this.o();this.M()}this.g("source",b,a)}}},sourceCrossOrigin:{get:function(){return this.am},set:function(a){if(this.am!==
a&&(this.am=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.uh},set:function(a){var b=this.uh;b.w(a)||(this.uh=a=a.G(),this.M(),this.g("sourceRect",b,a))}},imageStretch:{get:function(){return this.sl},set:function(a){var b=this.sl;b!==a&&(this.sl=a,this.M(),this.g("imageStretch",
b,a))}},flip:{get:function(){return this.Ld},set:function(a){var b=this.Ld;b!==a&&(this.Ld=a,this.M(),this.g("flip",b,a))}},imageAlignment:{get:function(){return this.rl},set:function(a){var b=this.rl;b.w(a)||(this.rl=a=a.G(),this.o(),this.g("imageAlignment",b,a))}},errorFunction:{get:function(){return this.Cc},set:function(a){var b=this.Cc;b!==a&&(this.Cc=a,this.g("errorFunction",b,a))}},successFunction:{
get:function(){return this.qf},set:function(a){var b=this.qf;b!==a&&(this.qf=a,this.g("successFunction",b,a))}},naturalBounds:{get:function(){return this.qc}}});Zj.prototype.redraw=Zj.prototype.Je;Zj.prototype.reloadSource=Zj.prototype.MA;var jo=null,ko=0,no=4;Zj.className="Picture";jo=new ab;Zj.clearCache=kk;function po(){this.cj=null}
function oo(a,b,c,d,e){null===a.cj&&(a.cj=[]);var f=new Dk(null),g=f.context,h=1/b;f.width=c/b;f.height=d/b;0!==f.width&&0!==f.height&&(b=new qo(f.Ga,b),c=1,0<a.cj.length&&(c=a.cj[a.cj.length-1],e=c.source,c=c.ratio),g.setTransform(h*c,0,0,h*c,0,0),g.drawImage(e,0,0),a.cj.push(b))}po.className="PictureCacheArray";function qo(a,b){this.source=a;this.ratio=b}qo.className="PictureCacheInstance";function ro(){this.Lt=new td;this.hc=null}t=ro.prototype;
t.reset=function(a){null!==a?(a.ea(),this.Lt=a,a.figures.clear()):this.Lt=new td;this.hc=null};function Ld(a,b,c,d,e){a.hc=new he;a.hc.startX=b;a.hc.startY=c;a.hc.isFilled=d;a.Lt.figures.add(a.hc);void 0!==e&&(a.hc.isShadowed=e)}function Td(a){var b=a.hc.segments.length;0<b&&a.hc.segments.L(b-1).close()}t.gr=function(a){this.hc.isShadowed=a};t.moveTo=function(a,b,c){void 0===c&&(c=!1);var d=new pe(Xd);d.endX=a;d.endY=b;c&&d.close();this.hc.segments.add(d)};
t.lineTo=function(a,b,c){void 0===c&&(c=!1);var d=new pe(yd);d.endX=a;d.endY=b;c&&d.close();this.hc.segments.add(d)};function Md(a,b,c,d,e,f,g){var h;void 0===h&&(h=!1);var k=new pe(Yd);k.point1X=b;k.point1Y=c;k.point2X=d;k.point2Y=e;k.endX=f;k.endY=g;h&&k.close();a.hc.segments.add(k)}function Rd(a,b,c,d,e){var f;void 0===f&&(f=!1);var g=new pe(Zd);g.point1X=b;g.point1Y=c;g.endX=d;g.endY=e;f&&g.close();a.hc.segments.add(g)}
t.arcTo=function(a,b,c,d,e,f,g){void 0===f&&(f=0);void 0===g&&(g=!1);var h=new pe($d);h.startAngle=a;h.sweepAngle=b;h.centerX=c;h.centerY=d;h.radiusX=e;h.radiusY=0!==f?f:e;g&&h.close();this.hc.segments.add(h)};function Sd(a,b,c,d,e,f,g,h){var k;void 0===k&&(k=!1);b=new pe(ae,g,h,b,c,d,e,f);k&&b.close();a.hc.segments.add(b)}function Kd(a){var b=Ud;if(null!==b)return Ud=null,b.reset(a),b;b=new ro;b.reset(a);return b}var Ud=null;ro.className="StreamGeometryContext";
function so(a,b){var c=a.toLowerCase(),d=K.Oe;d[a]=b;d[c]=a}so("Rectangle",function(a,b,c){a="r"+b+","+c;var d=K.Uh[a];if(void 0!==d)return d;d=new td(Hd);d.endX=b;d.endY=c;50>K.Vh&&(K.Uh[a]=d,K.Vh++);return d});so("Square",function(a,b,c){a="s"+b+","+c;var d=K.Uh[a];if(void 0!==d)return d;d=new td(Hd);d.endX=b;d.endY=c;d.defaultStretch=Ag;50>K.Vh&&(K.Uh[a]=d,K.Vh++);return d});
so("RoundedRectangle",function(a,b,c){var d=a?a.parameter1:NaN;if(isNaN(d)||0>d)d=5;d=Math.min(d,b/3);d=Math.min(d,c/3);a=d*K.Kg;b=(new td).add((new he(d,0,!0)).add(new pe(yd,b-d,0)).add(new pe(Yd,b,d,b-a,0,b,a)).add(new pe(yd,b,c-d)).add(new pe(Yd,b-d,c,b,c-a,b-a,c)).add(new pe(yd,d,c)).add(new pe(Yd,0,c-d,a,c,0,c-a)).add(new pe(yd,0,d)).add((new pe(Yd,d,0,0,a,a,0)).close()));1<a&&(b.spot1=new P(0,0,a,a),b.spot2=new P(1,1,-a,-a));return b});so("Border","RoundedRectangle");
so("Ellipse",function(a,b,c){a="e"+b+","+c;var d=K.Uh[a];if(void 0!==d)return d;d=new td(Id);d.endX=b;d.endY=c;d.spot1=jd;d.spot2=kd;50>K.Vh&&(K.Uh[a]=d,K.Vh++);return d});so("Circle",function(a,b,c){a="c"+b+","+c;var d=K.Uh[a];if(void 0!==d)return d;d=new td(Id);d.endX=b;d.endY=c;d.spot1=jd;d.spot2=kd;d.defaultStretch=Ag;50>K.Vh&&(K.Uh[a]=d,K.Vh++);return d});so("TriangleRight",function(a,b,c){return(new td).add((new he(0,0)).add(new pe(yd,b,.5*c)).add((new pe(yd,0,c)).close())).Xm(0,.25,.5,.75)});
so("TriangleDown",function(a,b,c){return(new td).add((new he(0,0)).add(new pe(yd,b,0)).add((new pe(yd,.5*b,c)).close())).Xm(.25,0,.75,.5)});so("TriangleLeft",function(a,b,c){return(new td).add((new he(b,c)).add(new pe(yd,0,.5*c)).add((new pe(yd,b,0)).close())).Xm(.5,.25,1,.75)});so("TriangleUp",function(a,b,c){return(new td).add((new he(b,c)).add(new pe(yd,0,c)).add((new pe(yd,.5*b,0)).close())).Xm(.25,.5,.75,1)});so("Triangle","TriangleUp");
so("Diamond",function(a,b,c){return(new td).add((new he(.5*b,0)).add(new pe(yd,0,.5*c)).add(new pe(yd,.5*b,c)).add((new pe(yd,b,.5*c)).close())).Xm(.25,.25,.75,.75)});so("LineH",function(a,b,c){a=new td(wd);a.startX=0;a.startY=c/2;a.endX=b;a.endY=c/2;return a});so("LineV",function(a,b,c){a=new td(wd);a.startX=b/2;a.startY=0;a.endX=b/2;a.endY=c;return a});so("None","Rectangle");so("BarH","Rectangle");so("BarV","Rectangle");so("MinusLine","LineH");
so("PlusLine",function(a,b,c){return(new td).add((new he(0,c/2,!1)).add(new pe(yd,b,c/2)).add(new pe(Xd,b/2,0)).add(new pe(yd,b/2,c)))});so("XLine",function(a,b,c){return(new td).add((new he(0,c,!1)).add(new pe(yd,b,0)).add(new pe(Xd,0,0)).add(new pe(yd,b,c)))});
K.bn={"":"",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 U(a){X.call(this,a);this.D=2408959;this.hh=this.Mf="";this.Cp=this.yp=this.Np=this.Do=null;this.Pp="";this.Kf=this.po=this.Op=this.th=null;this.Ap="";this.zp=Sb;this.Tb=this.Dp="";this.Ei=this.zn=this.mi=null;this.dg=(new J(NaN,NaN)).freeze();this.Ko="";this.bf=null;this.Lo=wc;this.Ep=ad;this.Uo=Ib;this.Mo=Jb;this.Rn=null;this.Eo=127;this.Tp=Kb;this.Sp="gray";this.jf=4;this.xx=-1;this.rq=NaN;this.bz=new N;this.Uj=null;this.jh=NaN}la(U,X);
U.prototype.cloneProtected=function(a){X.prototype.cloneProtected.call(this,a);a.D=this.D&-4097|49152;a.Mf=this.Mf;a.hh=this.hh;a.Do=this.Do;a.Np=this.Np;a.yp=this.yp;a.Cp=this.Cp;a.Pp=this.Pp;a.Op=this.Op;a.po=this.po;a.Kf=null;a.Ap=this.Ap;a.zp=this.zp.G();a.Dp=this.Dp;a.Ep=this.Ep.G();a.Tb=this.Tb;a.zn=this.zn;a.dg.assign(this.dg);a.Ko=this.Ko;a.Lo=this.Lo.G();a.Uo=this.Uo.G();a.Mo=this.Mo.G();a.Rn=this.Rn;a.Eo=this.Eo;a.Tp=this.Tp.G();a.Sp=this.Sp;a.jf=this.jf;a.rq=this.rq};
U.prototype.yf=function(a){X.prototype.yf.call(this,a);a.Oh();a.th=null;a.bf=null;a.Uj=null};U.prototype.toString=function(){var a=Ia(this.constructor)+"#"+mb(this);null!==this.data&&(a+="("+Ja(this.data)+")");return a};U.prototype.Jk=function(a,b,c,d,e,f,g){var h=this.diagram;null!==h&&(a===xe&&"elements"===b?e instanceof X?Fj(e,function(a){Hj(h.partManager,a);Gj(h,a)}):Yj(h,e):a===ye&&"elements"===b&&(e instanceof X?Fj(e,function(a){Kj(h.partManager,a,h)}):ak(h,e)),h.ab(a,b,c,d,e,f,g))};
U.prototype.Ca=function(a){X.prototype.Ca.call(this,a);if(null!==this.data){for(var b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d];e instanceof X&&Fj(e,function(a){null!==a.data&&a.Ca()})}for(b=this.adornments;b.next();)b.value.Ca(a)}};U.prototype.updateRelationshipsFromData=function(){null!==this.data&&this.diagram.partManager.updateRelationshipsFromData(this)};U.prototype.tk=function(a){var b=this.Kf;return null===b?null:b.H(a)};
U.prototype.Gh=function(a,b){if(null!==b){var c=null,d=this.Kf;null!==d&&(c=d.H(a));if(c!==b){if(null!==c){var e=c.diagram;null!==e&&e.remove(c)}null===d&&(this.Kf=d=new H);b.Mf!==a&&(b.category=a);d.add(a,b);a=this.diagram;null!==a&&(a.add(b),a=b.adornedObject,null!==a&&(a=a.ij(),null!==a&&(b.data=a.data)))}}};U.prototype.Gf=function(a){var b=this.Kf;if(null!==b){var c=b.H(a);if(null!==c){var d=c.diagram;null!==d&&d.remove(c)}b.remove(a);0===b.count&&(this.Kf=null)}};
U.prototype.kk=function(){var a=this.Kf;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.Gf(b[c]);Ha(b)}};
U.prototype.updateAdornments=function(){var a=this.diagram;if(null!==a){for(var b=this.adornments;b.next();){var c=b.value;c.o();c.placeholder&&c.placeholder.o()}a:{if(this.isSelected&&this.selectionAdorned&&(b=this.selectionObject,null!==b&&this.actualBounds.u()&&this.isVisible()&&b.Ff()&&b.actualBounds.u())){c=this.tk("Selection");if(null===c){c=this.selectionAdornmentTemplate;null===c&&(c=this.Ph()?a.linkSelectionAdornmentTemplate:this instanceof vf?a.groupSelectionAdornmentTemplate:a.nodeSelectionAdornmentTemplate);
if(!(c instanceof He))break a;xg(c);c=c.copy();null!==c&&(this.Ph()&&this.selectionObject===this.path&&(c.type=X.Link),c.adornedObject=b)}if(null!==c){c.type===X.Link&&c.o();this.Gh("Selection",c);break a}}this.Gf("Selection")}to(this,a);for(b=this.adornments;b.next();)b.value.Ca()}};U.prototype.Lb=function(){var a=this.diagram;null!==a&&(Ti(a),0!==(this.D&16384)!==!0&&(this.D|=16384,a.Db()))};function ji(a){0!==(a.D&16384)!==!1&&(a.updateAdornments(),a.D&=-16385)}
function to(a,b){b.toolManager.mouseDownTools.each(function(b){b.isEnabled&&b.updateAdornments(a)});b.toolManager.updateAdornments(a)}function uo(a){if(!1===uj(a)){vo(a,!0);a.zl();var b=a.diagram;null!==b&&(b.rd.add(a),b.Db())}}function wo(a){a.D|=2097152;if(!1!==uj(a)){var b=a.position,c=a.location;c.u()&&b.u()||xo(a,b,c);c=a.xb;var d=N.alloc().assign(c);c.ea();c.x=b.x;c.y=b.y;c.freeze();a.cu(d,c);N.free(d);vo(a,!1)}}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.bu(this))return!0}a=this.containingGroup;return null===a||a.isSubGraphExpanded&&a.isVisible()?!0:!1};t=U.prototype;t.Ob=function(a){var b=this.diagram;a?(this.C(4),this.Lb(),null!==b&&b.rd.add(this)):(this.C(8),this.kk());this.Oh();null!==b&&(b.Oa(),b.M())};
t.$a=function(a){if(this.name===a)return this;var b=this.Uj;null===b&&(this.Uj=b=new H);if(null!==b.H(a))return b.H(a);var c=X.prototype.$a.call(this,a);if(null!==c)return b.set(a,c),c;b.set(a,null);return null};t.Cf=function(a,b,c){void 0===c&&(c=new J);b=b.mc()?Bc:b;var d=a.naturalBounds;c.h(d.width*b.x+b.offsetX,d.height*b.y+b.offsetY);if(null===a||a===this)return c;a.transform.sa(c);for(a=a.panel;null!==a&&a!==this;)a.transform.sa(c),a=a.panel;this.cg.sa(c);c.offset(-this.pc.x,-this.pc.y);return c};
t.wm=function(a){void 0===a&&(a=new N);return a.assign(this.actualBounds)};t.Ta=function(){!0===sj(this)&&this.measure(Infinity,Infinity);this.arrange()};function Dj(a,b){var c=a.bz;isNaN(a.jh)&&(a.jh=en(a));var d=a.jh;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===tj(this))wo(this);else{ll(this,!1);var a=this.xb,b=N.alloc();b.assign(a);a.ea();var c=vg(this);this.Ih(0,0,this.pc.width,this.pc.height);var d=this.position;xo(this,d,this.location);a.x=d.x;a.y=d.y;a.freeze();this.cu(b,a);b.w(a)?this.Fd(c):!this.Wb()||K.A(b.width,a.width)&&K.A(b.height,a.height)||0<=this.xx&&this.C(16);N.free(b);vo(this,!1)}};t=U.prototype;
t.cu=function(a,b){var c=this.diagram;if(null!==c){var d=!1;if(!1===c.ui&&a.u()){var e=N.alloc();e.assign(c.documentBounds);e.Iw(c.padding);a.x>e.x&&a.y>e.y&&a.right<e.right&&a.bottom<e.bottom&&b.x>e.x&&b.y>e.y&&b.right<e.right&&b.bottom<e.bottom&&(d=!0);N.free(e)}0!==(this.D&65536)!==!0&&a.w(b)||Ij(this,d,c);c.M();ac(a,b)||(this instanceof V&&!c.undoManager.isUndoingRedoing&&this.md(),this.Oh())}};
t.Dw=function(a,b){if(this.Ph()||!a.u())return!1;var c=this.diagram;null!==c&&yo(this,c,a,b);this.la=a;this.D&=-2097153;var d=this.dg;!d.u()||null!==c&&!c.animationManager.isTicking&&c.undoManager.isUndoingRedoing||(c=d.copy(),d.h(d.x+(a.x-b.x),d.y+(a.y-b.y)),this.g("location",c,d.copy()));!1===uj(this)&&!1===tj(this)&&(uo(this),wo(this));return!0};function yo(a,b,c,d){null===b||a instanceof He||(b=b.animationManager,b.df&&Nh(b,a,d.copy(),c.copy()))}
t.fr=function(a,b,c){var d=this.dg,e=this.la;if(c){if(d.x===a&&d.y===b)return;uj(this)||tj(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;uj(this)||tj(this)?this.lu():d.h(d.x+a-e.x,d.y+b-e.y);e.h(a,b)}uo(this)};t.lu=function(){this.D&=-2097153;uo(this)};
function xo(a,b,c){var d=J.alloc(),e=a.locationSpot,f=a.locationObject;e.mc()&&B("determineOffset: Part's locationSpot must be real: "+e.toString());var g=f.naturalBounds,h=f instanceof W?f.strokeWidth:0;d.Lk(0,0,g.width+h,g.height+h,e);if(f!==a)for(d.offset(-h/2,-h/2),f.transform.sa(d),e=f.panel;null!==e&&e!==a;)e.transform.sa(d),e=e.panel;a.cg.sa(d);d.offset(-a.pc.x,-a.pc.y);e=a.diagram;f=c.u();g=b.u();f&&g?0!==(a.D&2097152)?zo(a,b,c,e,d):Ao(a,b,c,e,d):f?zo(a,b,c,e,d):g&&Ao(a,b,c,e,d);a.D|=2097152;
J.free(d);a.zl()}function zo(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.isAnimating)||!c.df||a instanceof He||Nh(c,a,new J(f,g),b),d||b.x===f&&b.y===g||a.g("position",new J(f,g),b.copy()))}function Ao(a,b,c,d,e){var f=c.copy();c.h(b.x+e.x,b.y+e.y);c.w(f)||null===d||a.g("location",f,c.copy())}
function Ij(a,b,c){nl(a,!1);a instanceof V&&zk(c,a);a.layer.isTemporary||b||c.Oa();b=a.xb;var d=c.viewportBounds;d.u()?vg(a)?(dc(b,d)||a.Fd(!1),a.updateAdornments()):b.Lc(d)?(a.Fd(!0),a.updateAdornments()):a.Lb():c.wi=!0}t.qj=function(){return!0};t.Wb=function(){return!0};t.Ph=function(){return!1};t.Ef=function(){return!0};
function Bo(a,b,c,d){b.constructor===a.constructor||Co||(Co=!0,wa('Should not change the class of the Part when changing category from "'+c+'" to "'+d+'"'),wa("  Old class: "+Ia(a.constructor)+", new class: "+Ia(b.constructor)+", part: "+a.toString()));a.kk();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.yf(a);b.cloneProtected(a);a.Mf=d;a.o();a.M();b=a.diagram;d=!0;null!==b&&(d=b.skipsUndoManager,
b.skipsUndoManager=!0);a.lb=e;a.D=f?a.D|4096:a.D&-4097;a.D=g?a.D|524288:a.D&-524289;a instanceof V&&(a.P=h?a.P|4:a.P&-5,a.P=k?a.P|1:a.P&-2,a.P=l?a.P|2:a.P&-3);null!==e&&a.Ca();e=a.layerName;e!==c&&(a.hh=c,a.layerName=e);null!==b&&(b.skipsUndoManager=d);a.Wb()&&a.C(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 uj(a){return 0!==(a.D&32768)}function vo(a,b){a.D=b?a.D|32768:a.D&-32769}function nl(a,b){a.D=b?a.D|65536:a.D&-65537}
function vg(a){return 0!==(a.D&131072)}t=U.prototype;t.Fd=function(a){this.D=a?this.D|131072:this.D&-131073};function Do(a,b){a.D=b?a.D|1048576:a.D&-1048577}t.Oh=function(){var a=this.containingGroup;null!==a&&(a.o(),null!==a.placeholder&&a.placeholder.o(),a.md())};t.M=function(){var a=this.diagram;null!==a&&!tj(this)&&!uj(this)&&this.isVisible()&&this.xb.u()&&a.M(Dj(this,this.xb))};
t.o=function(){X.prototype.o.call(this);var a=this.diagram;null!==a&&(a.rd.add(this),this instanceof V&&null!==this.labeledLink&&Cl(this.labeledLink),a.Db(!0))};t.Kq=function(a){a||(a=this.mi,null!==a&&Eo(a,this))};t.Lq=function(a){a||(a=this.mi,null!==a&&Fo(a,this))};t.rk=function(){var a=this.data;if(null!==a){var b=this.diagram;null!==b&&(b=b.model,null!==b&&b.Mm(a))}};t.Xz=function(){return Go(this,this)};
function Go(a,b){var c=b.containingGroup;return null!==c?1+Go(a,c):b instanceof V&&(b=b.labeledLink,null!==b)?Go(a,b):0}t.$z=function(){return Ho(this,this)};function Ho(a,b){var c=b.containingGroup;return null!==c||b instanceof V&&(c=b.labeledLink,null!==c)?Ho(a,c):b}t.Cd=function(a){return a instanceof vf?Io(this,this,a):!1};function Io(a,b,c){if(b===c||null===c)return!1;var d=b.containingGroup;return null===d||d!==c&&!Io(a,d,c)?b instanceof V&&(b=b.labeledLink,null!==b)?Io(a,b,c):!1:!0}
t.ly=function(a){if(null===a)return null;if(this===a)return this.containingGroup;for(var b=this;null!==b;){b instanceof vf&&Do(b,!0);if(b instanceof V){var c=b.labeledLink;null!==c&&(b=c)}b=b.containingGroup}c=null;for(b=a;null!==b;){if(0!==(b.D&1048576)){c=b;break}b instanceof V&&(a=b.labeledLink,null!==a&&(b=a));b=b.containingGroup}for(b=this;null!==b;)b instanceof vf&&Do(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.C=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.mi,null!==b){var c=b.layout;null!==c?c.C():b.C(a)}else a=this.diagram,null!==a&&(a=a.layout,null!==a&&a.C())};function Jj(a){if(!a.isVisible())return!1;a=a.layer;return null!==a&&a.isTemporary?!1:!0}
function Sk(a,b,c,d,e,f){void 0===f&&(f=null);if(!(a.contains(b)||null!==f&&!f(b)||b instanceof He))if(a.add(b),b instanceof V){if(c&&b instanceof vf)for(var g=b.memberParts;g.next();)Sk(a,g.value,c,d,e,f);if(!1!==e)for(g=b.linksConnected;g.next();){var h=g.value;if(!a.contains(h)){var k=h.fromNode,l=h.toNode;k=null===k||a.contains(k);l=null===l||a.contains(l);(e?k&&l:k||l)&&Sk(a,h,c,d,e,f)}}if(1<d)for(b=b.Vv();b.next();)Sk(a,b.value,c,d-1,e,f)}else if(b instanceof S)for(b=b.labelNodes;b.next();)Sk(a,
b.value,c,d,e,f)}
ma.Object.defineProperties(U.prototype,{key:{get:function(){var a=this.diagram;if(null!==a)return a.model.ja(this.data)}},adornments:{get:function(){return null===this.Kf?gb:this.Kf.iteratorValues}},layer:{get:function(){return this.Ei}},diagram:{get:function(){var a=this.Ei;return null!==a?a.diagram:null}},layerName:{get:function(){return this.hh},set:function(a){var b=
this.hh;if(b!==a){var c=this.diagram;if(null===c||null!==c.tm(a)&&!c.partManager.addsToTemporaryLayer)if(this.hh=a,null!==c&&c.Oa(),this.g("layerName",b,a),b=this.layer,null!==b&&b.name!==a&&(c=b.diagram,null!==c&&(a=c.tm(a),null!==a&&a!==b))){var d=b.Kc(-1,this,!0);0<=d&&c.ab(ye,"parts",b,this,null,d,!0);d=a.nj(99999999,this,!0);b.visible!==a.visible&&this.Ob(a.visible);0<=d&&c.ab(xe,"parts",a,null,this,!0,d);d=this.layerChanged;if(null!==d){var e=c.Z;c.Z=!0;d(this,b,a);c.Z=e}}}}},layerChanged:{
get:function(){return this.Do},set:function(a){var b=this.Do;b!==a&&(this.Do=a,this.g("layerChanged",b,a))}},zOrder:{get:function(){return this.rq},set:function(a){var b=this.rq;if(b!==a){this.rq=a;var c=this.layer;null!==c&&mi(c,-1,this);this.g("zOrder",b,a);a=this.diagram;null!==a&&a.M()}}},locationObject:{get:function(){if(null===this.bf){var a=this.locationObjectName;""!==a?(a=this.$a(a),null!==a?this.bf=a:this.bf=this):
this instanceof He?this.type!==X.Link&&null!==this.placeholder?this.bf=this.placeholder:this.bf=this:this.bf=this}return this.bf.visible?this.bf:this}},minLocation:{get:function(){return this.Uo},set:function(a){var b=this.Uo;b.w(a)||(this.Uo=a=a.G(),this.g("minLocation",b,a))}},maxLocation:{get:function(){return this.Mo},set:function(a){var b=this.Mo;b.w(a)||(this.Mo=a=a.G(),this.g("maxLocation",b,a))}},locationObjectName:{
get:function(){return this.Ko},set:function(a){var b=this.Ko;b!==a&&(this.Ko=a,this.bf=null,this.o(),this.g("locationObjectName",b,a))}},locationSpot:{get:function(){return this.Lo},set:function(a){var b=this.Lo;b.w(a)||(this.Lo=a=a.G(),this.o(),this.g("locationSpot",b,a))}},location:{get:function(){return this.dg},set:function(a){var b=a.x,c=a.y,d=this.dg,e=d.x,f=d.y;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))||
(a=a.copy(),b=a,this.Ph()?b=!1:(this.dg=b,this.D|=2097152,!1===tj(this)&&(uo(this),c=this.la,c.u()&&(e=this.diagram,null===e||e.animationManager.isTicking||!e.undoManager.isUndoingRedoing))&&(f=c.copy(),c.h(c.x+(b.x-d.x),c.y+(b.y-d.y)),yo(this,e,c,f),this.g("position",f,c.copy())),b=!0),b&&this.g("location",d.copy(),a.copy()))}},category:{get:function(){return this.Mf},set:function(a){var b=this.Mf;if(b!==a){var c=this.diagram,d=this.data,e=null;if(null!==c&&null!==d&&
!(this instanceof He)){var f=c.model.undoManager;f.isEnabled&&!f.isUndoingRedoing&&(e=this.clone(),e.W.addAll(this.W))}this.Mf=a;this.g("category",b,a);null===c||null===d||this instanceof He?this instanceof He&&(e=this.adornedPart,null!==e&&(a=e.Kf,null!==a&&a.remove(b),e.Gh(this.category,this))):(f=c.model,f.undoManager.isUndoingRedoing||(this.Ph()?(c.partManager.setLinkCategoryForData(d,a),c=c.partManager.findLinkTemplateForCategory(a),null!==c&&(xg(c),c=c.copy(),null!==c&&Bo(this,c,b,a))):(null!==
f&&f.Tm(d,a),c=Jo(c.partManager,d,a),null!==c&&(xg(c),c=c.copy(),null===c||c instanceof S||(d=this.location.copy(),Bo(this,c,b,a),this.location.u()||(this.location=d)))),null!==e&&(b=this.clone(),b.W.addAll(this.W),this.g("self",e,b))))}}},self:{get:function(){return this},set:function(a){Bo(this,a,this.category,a.category)}},copyable:{get:function(){return 0!==(this.D&1)},set:function(a){var b=0!==(this.D&1);b!==a&&(this.D^=1,this.g("copyable",
b,a))}},deletable:{get:function(){return 0!==(this.D&2)},set:function(a){var b=0!==(this.D&2);b!==a&&(this.D^=2,this.g("deletable",b,a))}},textEditable:{get:function(){return 0!==(this.D&4)},set:function(a){var b=0!==(this.D&4);b!==a&&(this.D^=4,this.g("textEditable",b,a),this.Lb())}},groupable:{get:function(){return 0!==(this.D&8)},set:function(a){var b=0!==(this.D&8);b!==a&&(this.D^=8,this.g("groupable",b,
a))}},movable:{get:function(){return 0!==(this.D&16)},set:function(a){var b=0!==(this.D&16);b!==a&&(this.D^=16,this.g("movable",b,a))}},selectionAdorned:{get:function(){return 0!==(this.D&32)},set:function(a){var b=0!==(this.D&32);b!==a&&(this.D^=32,this.g("selectionAdorned",b,a),this.Lb())}},isInDocumentBounds:{get:function(){return 0!==(this.D&64)},set:function(a){var b=0!==(this.D&64);if(b!==a){this.D^=64;
var c=this.diagram;null!==c&&c.Oa();this.g("isInDocumentBounds",b,a)}}},isLayoutPositioned:{get:function(){return 0!==(this.D&128)},set:function(a){var b=0!==(this.D&128);b!==a&&(this.D^=128,this.g("isLayoutPositioned",b,a),this.C(a?4:8))}},selectable:{get:function(){return 0!==(this.D&256)},set:function(a){var b=0!==(this.D&256);b!==a&&(this.D^=256,this.g("selectable",b,a),this.Lb())}},reshapable:{get:function(){return 0!==
(this.D&512)},set:function(a){var b=0!==(this.D&512);b!==a&&(this.D^=512,this.g("reshapable",b,a),this.Lb())}},resizable:{get:function(){return 0!==(this.D&1024)},set:function(a){var b=0!==(this.D&1024);b!==a&&(this.D^=1024,this.g("resizable",b,a),this.Lb())}},rotatable:{get:function(){return 0!==(this.D&2048)},set:function(a){var b=0!==(this.D&2048);b!==a&&(this.D^=2048,this.g("rotatable",b,a),this.Lb())}},isSelected:{
get:function(){return 0!==(this.D&4096)},set:function(a){var b=0!==(this.D&4096);if(b!==a){var c=this.diagram;if(!a||this.canSelect()&&!(null!==c&&c.selection.count>=c.maxSelectionCount)){this.D^=4096;var d=!1;if(null!==c){d=c.skipsUndoManager;c.skipsUndoManager=!0;var e=c.selection;e.ea();a?e.add(this):e.remove(this);e.freeze()}this.g("isSelected",b,a);this.Lb();a=this.selectionChanged;null!==a&&a(this);null!==c&&(c.Db(),c.skipsUndoManager=d)}}}},isHighlighted:{get:function(){return 0!==
(this.D&524288)},set:function(a){var b=0!==(this.D&524288);if(b!==a){this.D^=524288;var c=this.diagram;null!==c&&(c=c.highlighteds,c.ea(),a?c.add(this):c.remove(this),c.freeze());this.g("isHighlighted",b,a);this.M();a=this.highlightedChanged;null!==a&&a(this)}}},isShadowed:{get:function(){return 0!==(this.D&8192)},set:function(a){var b=0!==(this.D&8192);b!==a&&(this.D^=8192,this.g("isShadowed",b,a),this.M())}},isAnimated:{get:function(){return 0!==
(this.D&262144)},set:function(a){var b=0!==(this.D&262144);b!==a&&(this.D^=262144,this.g("isAnimated",b,a))}},highlightedChanged:{get:function(){return this.po},set:function(a){var b=this.po;b!==a&&(this.po=a,this.g("highlightedChanged",b,a))}},selectionObjectName:{get:function(){return this.Pp},set:function(a){var b=this.Pp;b!==a&&(this.Pp=a,this.th=null,this.g("selectionObjectName",b,a))}},selectionAdornmentTemplate:{
get:function(){return this.Np},set:function(a){var b=this.Np;b!==a&&(this.Np=a,this.g("selectionAdornmentTemplate",b,a))}},selectionObject:{get:function(){if(null===this.th){var a=this.selectionObjectName;null!==a&&""!==a?(a=this.$a(a),null!==a?this.th=a:this.th=this):this instanceof S?(a=this.path,null!==a?this.th=a:this.th=this):this.th=this}return this.th}},selectionChanged:{get:function(){return this.Op},set:function(a){var b=this.Op;
b!==a&&(this.Op=a,this.g("selectionChanged",b,a))}},resizeAdornmentTemplate:{get:function(){return this.yp},set:function(a){var b=this.yp;b!==a&&(this.yp=a,this.g("resizeAdornmentTemplate",b,a))}},resizeObjectName:{get:function(){return this.Ap},set:function(a){var b=this.Ap;b!==a&&(this.Ap=a,this.g("resizeObjectName",b,a))}},resizeObject:{get:function(){var a=this.resizeObjectName;return""!==a&&(a=this.$a(a),
null!==a)?a:this}},resizeCellSize:{get:function(){return this.zp},set:function(a){var b=this.zp;b.w(a)||(this.zp=a=a.G(),this.g("resizeCellSize",b,a))}},rotateAdornmentTemplate:{get:function(){return this.Cp},set:function(a){var b=this.Cp;b!==a&&(this.Cp=a,this.g("rotateAdornmentTemplate",b,a))}},rotateObjectName:{get:function(){return this.Dp},set:function(a){var b=this.Dp;b!==a&&(this.Dp=a,this.g("rotateObjectName",
b,a))}},rotateObject:{get:function(){var a=this.rotateObjectName;return""!==a&&(a=this.$a(a),null!==a)?a:this}},rotationSpot:{get:function(){return this.Ep},set:function(a){var b=this.Ep;b.w(a)||(this.Ep=a=a.G(),this.g("rotationSpot",b,a))}},text:{get:function(){return this.Tb},set:function(a){var b=this.Tb;b!==a&&(this.Tb=a,this.g("text",b,a))}},containingGroup:{get:function(){return this.mi},
set:function(a){if(this.Wb()){var b=this.mi;if(b!==a){null===a||this!==a&&!a.Cd(this)||(this===a&&B("Cannot make a Group a member of itself: "+this.toString()),B("Cannot make a Group indirectly contain itself: "+this.toString()+" already contains "+a.toString()));this.C(2);var c=this.diagram;null!==b?Fo(b,this):this instanceof vf&&null!==c&&c.Dh.remove(this);this.mi=a;null!==a?Eo(a,this):this instanceof vf&&null!==c&&c.Dh.add(this);this.C(1);if(null!==c&&c.Z){var d=this.data,e=c.model;if(null!==d&&
e.yk()){var f=e.ja(null!==a?a.data:null);e.er(d,f)}}d=this.containingGroupChanged;null!==d&&(e=!0,null!==c&&(e=c.Z,c.Z=!0),d(this,b,a),null!==c&&(c.Z=e));if(this instanceof vf)for(c=new F,Sk(c,this,!0,0,!0),c=c.iterator;c.next();)if(d=c.value,d instanceof V)for(d=d.linksConnected;d.next();)Ko(d.value);if(this instanceof V){for(c=this.linksConnected;c.next();)Ko(c.value);c=this.labeledLink;null!==c&&Ko(c)}this.g("containingGroup",b,a);null!==a&&(b=a.layer,null!==b&&mi(b,-1,a))}}else B("cannot set the Part.containingGroup of a Link or Adornment")}},
containingGroupChanged:{get:function(){return this.zn},set:function(a){var b=this.zn;b!==a&&(this.zn=a,this.g("containingGroupChanged",b,a))}},isTopLevel:{get:function(){return null!==this.containingGroup||this instanceof V&&null!==this.labeledLink?!1:!0}},layoutConditions:{get:function(){return this.Eo},set:function(a){var b=this.Eo;b!==a&&(this.Eo=a,this.g("layoutConditions",b,a))}},dragComputation:{
get:function(){return this.Rn},set:function(a){var b=this.Rn;b!==a&&(this.Rn=a,this.g("dragComputation",b,a))}},shadowOffset:{get:function(){return this.Tp},set:function(a){var b=this.Tp;b.w(a)||(this.Tp=a=a.G(),this.M(),this.g("shadowOffset",b,a))}},shadowColor:{get:function(){return this.Sp},set:function(a){var b=this.Sp;b!==a&&(this.Sp=a,this.M(),this.g("shadowColor",b,a))}},shadowBlur:{get:function(){return this.jf},
set:function(a){var b=this.jf;b!==a&&(this.jf=a,this.M(),this.g("shadowBlur",b,a))}}});U.prototype.invalidateLayout=U.prototype.C;U.prototype.findCommonContainingGroup=U.prototype.ly;U.prototype.isMemberOf=U.prototype.Cd;U.prototype.findTopLevelPart=U.prototype.$z;U.prototype.findSubGraphLevel=U.prototype.Xz;U.prototype.ensureBounds=U.prototype.Ta;U.prototype.getDocumentBounds=U.prototype.wm;U.prototype.getRelativePoint=U.prototype.Cf;U.prototype.findObject=U.prototype.$a;U.prototype.moveTo=U.prototype.moveTo;
U.prototype.invalidateAdornments=U.prototype.Lb;U.prototype.clearAdornments=U.prototype.kk;U.prototype.removeAdornment=U.prototype.Gf;U.prototype.addAdornment=U.prototype.Gh;U.prototype.findAdornment=U.prototype.tk;U.prototype.updateTargetBindings=U.prototype.Ca;var Co=!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 He(a){U.call(this,a);this.D&=-257;this.hh="Adornment";this.ee=null;this.Bx=0;this.Qx=!1;this.l=[];this.Ra=null}la(He,U);He.prototype.toString=function(){var a=this.adornedPart;return"Adornment("+this.category+")"+(null!==a?a.toString():"")};He.prototype.updateRelationshipsFromData=function(){};
He.prototype.Bk=function(a){var b=this.adornedObject.part;if(b instanceof S&&this.adornedObject instanceof W){var c=b.path;b.Bk(a);a=c.geometry;b=this.W.j;c=b.length;for(var d=0;d<c;d++){var e=b[d];e.isPanelMain&&e instanceof W&&(e.na=a)}}};He.prototype.qj=function(){var a=this.ee;if(null===a)return!0;a=a.part;return null===a||!tj(a)};He.prototype.Wb=function(){return!1};
He.prototype.Jk=function(a,b,c,d,e,f,g){if(a===xe&&"elements"===b)if(e instanceof wg)null===this.Ra&&(this.Ra=e);else{if(e instanceof X){var h=e.sm(function(a){return a instanceof wg});h instanceof wg&&null===this.Ra&&(this.Ra=h)}}else a===ye&&"elements"===b&&null!==this.Ra&&(d===this.Ra?this.Ra=null:d instanceof X&&this.Ra.Gg(d)&&(this.Ra=null));U.prototype.Jk.call(this,a,b,c,d,e,f,g)};He.prototype.updateAdornments=function(){};He.prototype.rk=function(){};
ma.Object.defineProperties(He.prototype,{placeholder:{get:function(){return this.Ra}},adornedObject:{get:function(){return this.ee},set:function(a){var b=this.adornedPart,c=null;null!==a&&(c=a.part);null===b||null!==a&&b===c||b.Gf(this.category);this.ee=a;null!==c&&c.Gh(this.category,this)}},adornedPart:{get:function(){var a=this.ee;return null!==a?a.part:null}},containingGroup:{
get:function(){return null}}});He.className="Adornment";function V(a){U.call(this,a);this.P=13;this.Ya=new E;this.lq=this.El=this.Hi=this.Go=this.Fo=null;this.Wk=uc;this.sc=this.Re=null;this.vp=Lo;this.Eh=!1}la(V,U);V.prototype.cloneProtected=function(a){U.prototype.cloneProtected.call(this,a);a.P=this.P;a.P=this.P&-17;a.Fo=this.Fo;a.Go=this.Go;a.Hi=this.Hi;a.lq=this.lq;a.Wk=this.Wk.G();a.vp=this.vp};t=V.prototype;t.yf=function(a){U.prototype.yf.call(this,a);a.md();a.Re=this.Re;a.sc=null};
function Mo(a,b){null!==b&&(null===a.Re&&(a.Re=new F),a.Re.add(b))}function No(a,b,c,d){if(null===b||null===a.Re)return null;for(var e=a.Re.iterator;e.next();){var f=e.value;if(f.$t===a&&f.jw===b&&f.Jy===c&&f.Ky===d||f.$t===b&&f.jw===a&&f.Jy===d&&f.Ky===c)return f}return null}t.tA=function(a,b,c){if(void 0===b||null===b)b="";if(void 0===c||null===c)c="";a=No(this,a,b,c);null!==a&&a.ym()};
t.Jk=function(a,b,c,d,e,f,g){a===xe&&"elements"===b?this.sc=null:a===ye&&"elements"===b&&(this.sc=null);U.prototype.Jk.call(this,a,b,c,d,e,f,g)};t.md=function(a){void 0===a&&(a=null);for(var b=this.linksConnected;b.next();){var c=b.value;null!==a&&a.contains(c)||(Oo(this,c.fromPort),Oo(this,c.toPort),c.Ua())}};function ol(a,b){for(var c=a.linksConnected;c.next();){var d=c.value;if(d.fromPort===b||d.toPort===b)Oo(a,d.fromPort),Oo(a,d.toPort),d.Ua()}}
function Oo(a,b){null!==b&&(b=b.tp,null!==b&&b.ym(),b=a.containingGroup,null===b||a.isVisible()||Oo(b,b.port))}t.qj=function(){return!0};V.prototype.getAvoidableRect=function(a){a.set(this.actualBounds);a.sq(this.Wk);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=ri,c=this.diagram;if(null!==c){if(c.animationManager.bu(this))return!0;a=c.isTreePathToChildren;b=c.treeCollapsePolicy}if(b===ri){if(a=this.Fg(),null!==a&&!a.isTreeExpanded)return!1}else if(b===Fk){if(a=a?this.Sv():this.Tv(),0<a.count&&a.all(function(a){return!a.isTreeExpanded}))return!1}else if(b===Gk&&(a=a?this.Sv():this.Tv(),0<a.count&&a.any(function(a){return!a.isTreeExpanded})))return!1;a=this.labeledLink;
return null!==a?a.isVisible():!0};V.prototype.Ob=function(a){U.prototype.Ob.call(this,a);for(var b=this.linksConnected;b.next();){var c=b.value;if(a&&null!==this.containingGroup){var d=c.Iq(this);null===d||d.Cd(this.containingGroup)||c.Ua()}c.Ob(a)}};V.prototype.my=function(){var a=new F,b=new F;Po(this,this,a,b);return b.iterator};
function Po(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)&&Po(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.Ya.iterator;var b=new ib(this.Ya),c=this;b.predicate=function(b){return b.fromNode===c&&b.fromPortId===a||b.toNode===c&&b.toPortId===a};return b};t=V.prototype;
t.Dq=function(a){void 0===a&&(a=null);var b=new ib(this.Ya),c=this;b.predicate=function(b){return b.fromNode!==c?!1:null===a?!0:b.fromPortId===a};return b};t.Bd=function(a){void 0===a&&(a=null);var b=new ib(this.Ya),c=this;b.predicate=function(b){return b.toNode!==c?!1:null===a?!0:b.toPortId===a};return b};
t.Rv=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.Ya.iterator;d.next();){var e=d.value;if(e.fromNode===this){if(null===a||e.fromPortId===a)e=e.toNode,null!==b?b.add(e):null!==c&&c!==e?(b=new F,b.add(c),b.add(e)):c=e}else e.toNode!==this||null!==a&&e.toPortId!==a||(e=e.fromNode,null!==b?b.add(e):null!==c&&c!==e?(b=new F,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new hb(c):gb};
t.Tv=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.Ya.iterator;d.next();){var e=d.value;e.fromNode!==this||null!==a&&e.fromPortId!==a||(e=e.toNode,null!==b?b.add(e):null!==c&&c!==e?(b=new F,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new hb(c):gb};
t.Sv=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.Ya.iterator;d.next();){var e=d.value;e.toNode!==this||null!==a&&e.toPortId!==a||(e=e.fromNode,null!==b?b.add(e):null!==c&&c!==e?(b=new F,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new hb(c):gb};
t.Sz=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);var d=new ib(this.Ya),e=this;d.predicate=function(d){return(d.fromNode!==e||d.toNode!==a||null!==b&&d.fromPortId!==b||null!==c&&d.toPortId!==c)&&(d.fromNode!==a||d.toNode!==e||null!==c&&d.fromPortId!==c||null!==b&&d.toPortId!==b)?!1:!0};return d};
t.Tz=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);var d=new ib(this.Ya),e=this;d.predicate=function(d){return d.fromNode!==e||d.toNode!==a||null!==b&&d.fromPortId!==b||null!==c&&d.toPortId!==c?!1:!0};return d};
function Qo(a,b,c){Oo(a,c);var d=a.Ya.contains(b);d||a.Ya.add(b);if(!d||b.fromNode===b.toNode){var e=a.linkConnected;if(null!==e){var f=!0,g=a.diagram;null!==g&&(f=g.Z,g.Z=!0);e(a,b,c);null!==g&&(g.Z=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.Eh||(e.Eh=f),!f.isTreeLeaf||null!==a&&a.undoManager.isUndoingRedoing||(d?c===f&&(f.isTreeLeaf=!1):b===f&&(f.isTreeLeaf=!1))))}
function Ro(a,b,c){Oo(a,c);var d=a.Ya.remove(b),e=null;if(d||b.toNode===b.fromNode){var f=a.linkDisconnected;e=a.diagram;if(null!==f){var g=!0;null!==e&&(g=e.Z,e.Z=!0);f(a,b,c);null!==e&&(e.Z=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.Eh=!1),null===b||b.isTreeLeaf||(0===b.Ya.count?(b.Eh=null,null!==e&&e.undoManager.isUndoingRedoing||(b.isTreeLeaf=!0)):Ek(b)))}
function Ek(a){a.Eh=!1;if(0!==a.Ya.count){var b=!0,c=a.diagram;if(null===c||!c.undoManager.isUndoingRedoing){null!==c&&(b=c.isTreePathToChildren);for(c=a.Ya.iterator;c.next();){var d=c.value;if(d.isTreeLink)if(b){if(d.fromNode===a){a.isTreeLeaf=!1;return}}else if(d.toNode===a){a.isTreeLeaf=!1;return}}a.isTreeLeaf=!0}}}V.prototype.updateRelationshipsFromData=function(){var a=this.diagram;null!==a&&a.partManager.updateRelationshipsFromData(this)};t=V.prototype;
t.Kq=function(a){U.prototype.Kq.call(this,a);a||(Ek(this),a=this.El,null!==a&&So(a,this))};t.Lq=function(a){U.prototype.Lq.call(this,a);a||(a=this.El,null!==a&&null!==a.hd&&(a.hd.remove(this),a.o()))};
t.rk=function(){if(0<this.Ya.count){var a=this.diagram;if(null!==a)for(var b=null!==a.commandHandler?a.commandHandler.deletesConnectedLinks:!0,c=this.Ya.copy().iterator;c.next();){var d=c.value;b?a.remove(d):(d.fromNode===this&&(d.fromNode=null),d.toNode===this&&(d.toNode=null))}}this.labeledLink=null;U.prototype.rk.call(this)};t.Kt=function(a){if(null===this.sc){if(""===a&&!1===this.Nh)return this;To(this)}var b=this.sc.H(a);return null!==b||""!==a&&(b=this.sc.H(""),null!==b)?b:this};
function To(a){null===a.sc?a.sc=new H:a.sc.clear();a.Zm(a,function(a,c){Tl(a,c)});0===a.sc.count&&a.sc.add("",a)}function Tl(a,b){var c=b.portId;null!==c&&null!==a.sc&&a.sc.add(c,b)}function Sl(a,b,c){var d=b.portId;if(null!==d&&(null!==a.sc&&a.sc.remove(d),b=a.diagram,null!==b&&c)){c=null;for(a=a.findLinksConnected(d);a.next();)d=a.value,null===c&&(c=Ea()),c.push(d);if(null!==c){for(a=0;a<c.length;a++)b.remove(c[a]);Ha(c)}}}
t.vA=function(a){if(null===a||a===this)return!1;var b=!0,c=this.diagram;null!==c&&(b=c.isTreePathToChildren);c=this;if(b)for(;c!==a;){b=null;for(var d=c.Ya.iterator;d.next();){var e=d.value;if(e.isTreeLink&&(b=e.fromNode,b!==c&&b!==this))break}if(b===this||null===b||b===c)return!1;c=b}else for(;c!==a;){b=null;for(d=c.Ya.iterator;d.next()&&(e=d.value,!e.isTreeLink||(b=e.toNode,b===c||b===this)););if(b===this||null===b||b===c)return!1;c=b}return!0};
t.dA=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this;if(a)for(;;){a=null;for(var c=b.Ya.iterator;c.next();){var d=c.value;if(d.isTreeLink&&(a=d.fromNode,a!==b&&a!==this))break}if(a===this)return this;if(null===a||a===b)return b;b=a}else for(;;){a=null;for(c=b.Ya.iterator;c.next()&&(d=c.value,!d.isTreeLink||(a=d.toNode,a===b||a===this)););if(a===this)return this;if(null===a||a===b)return b;b=a}};
t.Pz=function(a){if(null===a)return null;if(this===a)return this;for(var b=this;null!==b;)Do(b,!0),b=b.Fg();var c=null;for(b=a;null!==b;){if(0!==(b.D&1048576)){c=b;break}b=b.Fg()}for(b=this;null!==b;)Do(b,!1),b=b.Fg();return c};t.jj=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this.Ya.iterator;if(a)for(;b.next();){if(a=b.value,a.isTreeLink&&a.fromNode!==this)return a}else for(;b.next();)if(a=b.value,a.isTreeLink&&a.toNode!==this)return a;return null};
t.Fg=function(){var a=this.Eh;if(null===a)return null;if(a instanceof V)return a;var b=!0;a=this.diagram;null!==a&&(b=a.isTreePathToChildren);a=this.Ya.iterator;if(b)for(;a.next();){if(b=a.value,b.isTreeLink&&(b=b.fromNode,b!==this))return this.Eh=b}else for(;a.next();)if(b=a.value,b.isTreeLink&&(b=b.toNode,b!==this))return this.Eh=b;return this.Eh=null};t.bA=function(){function a(b,d){if(null!==b){d.add(b);var c=b.jj();null!==c&&(d.add(c),a(b.Fg(),d))}}var b=new F;a(this,b);return b};
t.aA=function(){return Uo(this,this)};function Uo(a,b){b=b.Fg();return null===b?0:1+Uo(a,b)}t.Fq=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=new ib(this.Ya);var c=this;b.predicate=a?function(a){return a.isTreeLink&&a.fromNode===c?!0:!1}:function(a){return a.isTreeLink&&a.toNode===c?!0:!1};return b};
t.Vv=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);var c=b=null,d=this.Ya.iterator;if(a)for(;d.next();)a=d.value,a.isTreeLink&&a.fromNode===this&&(a=a.toNode,null!==b?b.add(a):null!==c&&c!==a?(b=new E,b.add(c),b.add(a)):c=a);else for(;d.next();)a=d.value,a.isTreeLink&&a.toNode===this&&(a=a.fromNode,null!==b?b.add(a):null!==c&&c!==a?(b=new E,b.add(c),b.add(a)):c=a);return null!==b?b.iterator:null!==c?new hb(c):gb};
t.cA=function(a){void 0===a&&(a=Infinity);var b=new F;Sk(b,this,!1,a,!0);return b};V.prototype.collapseTree=function(a){void 0===a&&(a=1);1>a&&(a=1);var b=this.diagram;if(null!==b&&!b.He){b.He=!0;var c=new F;c.add(this);Vo(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===ri);b.He=!1}};function Vo(a,b,c,d,e,f,g){if(1<d)for(var h=c?a.Dq():a.Bd();h.next();){var k=h.value;k.isTreeLink&&(k=k.Iq(a),null===k||k===a||b.contains(k)||(b.add(k),Vo(k,b,c,d-1,e,f,g)))}else Wo(a,b,c,e,f,g)}
function Wo(a,b,c,d,e,f){for(var g=e===a?!0:a.isTreeExpanded,h=c?a.Dq():a.Bd();h.next();){var k=h.value;if(k.isTreeLink&&(k=k.Iq(a),null!==k&&k!==a)){var l=b.contains(k);l||b.add(k);g&&(f&&d.gk(k,e),k.Oh(),k.Ob(!1));k.isTreeExpanded&&(k.wasTreeExpanded=k.isTreeExpanded,l||Wo(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.He){b.He=!0;var c=new F;c.add(this);Xo(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===ri);b.He=!1}};
function Xo(a,b,c,d,e,f,g){for(var h=f===a?!1:a.isTreeExpanded,k=c?a.Dq():a.Bd();k.next();){var l=k.value;l.isTreeLink&&(h||l.dd||l.Ua(),l=l.Iq(a),null!==l&&l!==a&&!b.contains(l)&&(b.add(l),h||(l.Ob(!0),l.Oh(),g&&e.ik(l,f)),2<d||l.wasTreeExpanded))&&(l.wasTreeExpanded=!1,Xo(l,b,c,d-1,e,f,g))}a.isTreeExpanded=!0}
ma.Object.defineProperties(V.prototype,{portSpreading:{get:function(){return this.vp},set:function(a){var b=this.vp;b!==a&&(this.vp=a,this.g("portSpreading",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.md())}},avoidable:{get:function(){return 0!==(this.P&8)},set:function(a){var b=0!==(this.P&8);if(b!==a){this.P^=8;var c=this.diagram;null!==c&&zk(c,this);this.g("avoidable",b,a)}}},avoidableMargin:{
get:function(){return this.Wk},set:function(a){"number"===typeof a&&(a=new pc(a));var b=this.Wk;if(!b.w(a)){this.Wk=a=a.G();var c=this.diagram;null!==c&&zk(c,this);this.g("avoidableMargin",b,a)}}},linksConnected:{get:function(){return this.Ya.iterator}},linkConnected:{get:function(){return this.Fo},set:function(a){var b=this.Fo;b!==a&&(this.Fo=a,this.g("linkConnected",b,a))}},linkDisconnected:{get:function(){return this.Go},
set:function(a){var b=this.Go;b!==a&&(this.Go=a,this.g("linkDisconnected",b,a))}},linkValidation:{get:function(){return this.Hi},set:function(a){var b=this.Hi;b!==a&&(this.Hi=a,this.g("linkValidation",b,a))}},isLinkLabel:{get:function(){return null!==this.El}},labeledLink:{get:function(){return this.El},set:function(a){var b=this.El;if(b!==a){var c=this.diagram,d=this.data;if(null!==b){null!==b.hd&&(b.hd.remove(this),
b.o());if(null!==c&&null!==d&&!c.undoManager.isUndoingRedoing){var e=b.data,f=c.model;if(null!==e&&f.pj()){var g=f.ja(d);void 0!==g&&f.Ly(e,g)}}this.containingGroup=null}this.El=a;null!==a&&(So(a,this),null===c||null===d||c.undoManager.isUndoingRedoing||(e=a.data,c=c.model,null!==e&&c.pj()&&(d=c.ja(d),void 0!==d&&c.Dv(e,d))),this.containingGroup=a.containingGroup);Cl(this);this.g("labeledLink",b,a)}}},port:{get:function(){return this.Kt("")}},ports:{
get:function(){null===this.sc&&To(this);return this.sc.iteratorValues}},isTreeExpanded:{get:function(){return 0!==(this.P&1)},set:function(a){var b=0!==(this.P&1);if(b!==a){this.P^=1;var c=this.diagram;this.g("isTreeExpanded",b,a);b=this.treeExpandedChanged;if(null!==b){var d=!0;null!==c&&(d=c.Z,c.Z=!0);b(this);null!==c&&(c.Z=d)}null!==c&&c.undoManager.isUndoingRedoing?this.Ob(a):a?this.expandTree():this.collapseTree()}}},wasTreeExpanded:{
get:function(){return 0!==(this.P&2)},set:function(a){var b=0!==(this.P&2);b!==a&&(this.P^=2,this.g("wasTreeExpanded",b,a))}},treeExpandedChanged:{get:function(){return this.lq},set:function(a){var b=this.lq;b!==a&&(this.lq=a,this.g("treeExpandedChanged",b,a))}},isTreeLeaf:{get:function(){return 0!==(this.P&4)},set:function(a){var b=0!==(this.P&4);b!==a&&(this.P^=4,this.g("isTreeLeaf",b,a))}}});V.prototype.expandTree=V.prototype.expandTree;
V.prototype.collapseTree=V.prototype.collapseTree;V.prototype.findTreeParts=V.prototype.cA;V.prototype.findTreeChildrenNodes=V.prototype.Vv;V.prototype.findTreeChildrenLinks=V.prototype.Fq;V.prototype.findTreeLevel=V.prototype.aA;V.prototype.findTreeParentChain=V.prototype.bA;V.prototype.findTreeParentNode=V.prototype.Fg;V.prototype.findTreeParentLink=V.prototype.jj;V.prototype.findCommonTreeParent=V.prototype.Pz;V.prototype.findTreeRoot=V.prototype.dA;V.prototype.isInTreeOf=V.prototype.vA;
V.prototype.findPort=V.prototype.Kt;V.prototype.findLinksTo=V.prototype.Tz;V.prototype.findLinksBetween=V.prototype.Sz;V.prototype.findNodesInto=V.prototype.Sv;V.prototype.findNodesOutOf=V.prototype.Tv;V.prototype.findNodesConnected=V.prototype.Rv;V.prototype.findLinksInto=V.prototype.Bd;V.prototype.findLinksOutOf=V.prototype.Dq;V.prototype.findExternalTreeLinksConnected=V.prototype.my;V.prototype.invalidateConnectedLinks=V.prototype.md;V.prototype.invalidateLinkBundle=V.prototype.tA;
var Yo=new D(V,"SpreadingNone",10),Lo=new D(V,"SpreadingEvenly",11),Zo=new D(V,"SpreadingPacked",12);V.className="Node";V.SpreadingNone=Yo;V.SpreadingEvenly=Lo;V.SpreadingPacked=Zo;function vf(a){V.call(this,a);this.P|=4608;this.Ro=new F;this.Ml=new F;this.Ra=this.bq=this.Ji=this.So=this.Qo=null;this.kc=new yi;this.kc.group=this}la(vf,V);
vf.prototype.cloneProtected=function(a){V.prototype.cloneProtected.call(this,a);this.P=this.P&-32769;a.Qo=this.Qo;a.So=this.So;a.Ji=this.Ji;a.bq=this.bq;var b=a.sm(function(a){return a instanceof wg});b instanceof wg?a.Ra=b:a.Ra=null;null!==this.kc?(a.kc=this.kc.copy(),a.kc.group=a):(null!==a.kc&&(a.kc.group=null),a.kc=null)};t=vf.prototype;
t.yf=function(a){V.prototype.yf.call(this,a);var b=a.uk();for(a=a.memberParts;a.next();){var c=a.value;c.o();c.C(8);c.kk();if(c instanceof V)c.md(b);else if(c instanceof S)for(c=c.labelNodes;c.next();)c.value.md(b)}};
t.Jk=function(a,b,c,d,e,f,g){if(a===xe&&"elements"===b)if(e instanceof wg)null===this.Ra?this.Ra=e:this.Ra!==e&&B("Cannot insert a second Placeholder into the visual tree of a Group.");else{if(e instanceof X){var h=e.sm(function(a){return a instanceof wg});h instanceof wg&&(null===this.Ra?this.Ra=h:this.Ra!==h&&B("Cannot insert a second Placeholder into the visual tree of a Group."))}}else a===ye&&"elements"===b&&null!==this.Ra&&(d===this.Ra?this.Ra=null:d instanceof X&&this.Ra.Gg(d)&&(this.Ra=null));
V.prototype.Jk.call(this,a,b,c,d,e,f,g)};t.Ih=function(a,b,c,d){this.bf=this.Ra;V.prototype.Ih.call(this,a,b,c,d)};t.Ta=function(){var a=this;a.isSubGraphExpanded&&this.memberParts.each(function(b){!a.computesBoundsIncludingLinks&&b instanceof S||b.Ta()});V.prototype.Ta.call(this)};
t.qj=function(){if(!V.prototype.qj.call(this))return!1;for(var a=this.memberParts;a.next();){var b=a.value;if(b instanceof V){if(b.isVisible()&&tj(b))return!1}else if(b instanceof S&&b.isVisible()&&tj(b)&&b.fromNode!==this&&b.toNode!==this)return!1}return!0};
function Eo(a,b){if(a.Ro.add(b)){b instanceof vf&&a.Ml.add(b);var c=a.memberAdded;if(null!==c){var d=!0,e=a.diagram;null!==e&&(d=e.Z,e.Z=!0);c(a,b);null!==e&&(e.Z=d)}a.isVisible()&&a.isSubGraphExpanded||b.Ob(!1)}b instanceof S&&!a.computesBoundsIncludingLinks||(b=a.Ra,null===b&&(b=a),b.o())}
function Fo(a,b){if(a.Ro.remove(b)){b instanceof vf&&a.Ml.remove(b);var c=a.memberRemoved;if(null!==c){var d=!0,e=a.diagram;null!==e&&(d=e.Z,e.Z=!0);c(a,b);null!==e&&(e.Z=d)}a.isVisible()&&a.isSubGraphExpanded||b.Ob(!0)}b instanceof S&&!a.computesBoundsIncludingLinks||(b=a.Ra,null===b&&(b=a),b.o())}t.rk=function(){if(0<this.Ro.count){var a=this.diagram;if(null!==a)for(var b=this.Ro.copy().iterator;b.next();)a.remove(b.value)}V.prototype.rk.call(this)};
vf.prototype.canAddMembers=function(a){var b=this.diagram;if(null===b)return!1;b=b.commandHandler;for(a=Uk(a).iterator;a.next();)if(!b.isValidMember(this,a.value))return!1;return!0};vf.prototype.addMembers=function(a,b){var c=this.diagram;if(null===c)return!1;c=c.commandHandler;var d=!0;for(a=Uk(a).iterator;a.next();){var e=a.value;!b||c.isValidMember(this,e)?e.containingGroup=this:d=!1}return d};
vf.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=vf.prototype;
t.md=function(a){void 0===a&&(a=null);var b=0!==(this.P&65536);V.prototype.md.call(this,a);if(!b)for(0!==(this.P&65536)!==!0&&(this.P=this.P^65536),b=this.Qv();b.next();){var c=b.value;if(null===a||!a.contains(c)){var d=c.fromNode;null!==d&&d!==this&&d.Cd(this)&&!d.isVisible()?(Oo(d,c.fromPort),Oo(d,c.toPort),c.Ua()):(d=c.toNode,null!==d&&d!==this&&d.Cd(this)&&!d.isVisible()&&(Oo(d,c.fromPort),Oo(d,c.toPort),c.Ua()))}}};
t.Qv=function(){var a=this.uk();a.add(this);for(var b=new F,c=a.iterator;c.next();){var d=c.value;if(d instanceof V)for(d=d.linksConnected;d.next();){var e=d.value;a.contains(e)||b.add(e)}}return b.iterator};t.Rz=function(){var a=this.uk();a.add(this);for(var b=new F,c=a.iterator;c.next();){var d=c.value;if(d instanceof V)for(d=d.linksConnected;d.next();){var e=d.value,f=e.fromNode;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.Qz=function(){function a(b,d){null!==b&&(d.add(b),a(b.containingGroup,d))}var b=new F;a(this,b);return b};t.uk=function(){var a=new F;Sk(a,this,!0,0,!0);a.remove(this);return a};t.Ob=function(a){V.prototype.Ob.call(this,a);for(var b=this.memberParts;b.next();)b.value.Ob(a)};vf.prototype.collapseSubGraph=function(){var a=this.diagram;if(null!==a&&!a.He){a.He=!0;var b=this.uk();$o(this,b,a,this);a.He=!1}};
function $o(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Ob(!1);f instanceof vf&&f.isSubGraphExpanded&&(f.wasSubGraphExpanded=f.isSubGraphExpanded,$o(f,b,c,d));if(f instanceof V)f.md(b),c.gk(f,d);else if(f instanceof S)for(f=f.labelNodes;f.next();)f.value.md(b)}a.isSubGraphExpanded=!1}vf.prototype.expandSubGraph=function(){var a=this.diagram;if(null!==a&&!a.He){a.He=!0;var b=this.uk();ap(this,b,a,this);a.He=!1}};
function ap(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Ob(!0);f instanceof vf&&f.wasSubGraphExpanded&&(f.wasSubGraphExpanded=!1,ap(f,b,c,d));if(f instanceof V)f.md(b),c.ik(f,d);else if(f instanceof S)for(f=f.labelNodes;f.next();)f.value.md(b)}a.isSubGraphExpanded=!0}
vf.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 F;for(b=this.uk().iterator;b.next();)if(e=b.value,e instanceof S&&(e.suspendsRouting&&a.add(e),e.dd||e.fromNode!==this&&e.toNode!==this))e.suspendsRouting=!0;for(b.reset();b.next();)if(e=b.value,!(e.Ph()||e instanceof V&&e.isLinkLabel)){var g=
e.position,h=e.location;g.u()?(f.x=g.x+d,f.y=g.y+c,e.position=f):h.u()&&(f.x=h.x+d,f.y=h.y+c,e.location=f)}for(b.reset();b.next();)if(e=b.value,e instanceof S&&(e.suspendsRouting=a.contains(e),e.dd||e.fromNode!==this&&e.toNode!==this))g=e.position,f.x=g.x+d,f.y=g.y+c,f.u()?e.move(f):e.Ua(),Qj(e)&&e.Ua();J.free(f)}};
ma.Object.defineProperties(vf.prototype,{placeholder:{get:function(){return this.Ra}},computesBoundsAfterDrag:{get:function(){return 0!==(this.P&2048)},set:function(a){var b=0!==(this.P&2048);b!==a&&(this.P^=2048,this.g("computesBoundsAfterDrag",b,a))}},computesBoundsIncludingLinks:{get:function(){return 0!==(this.P&4096)},set:function(a){var b=0!==(this.P&4096);b!==a&&(this.P^=4096,this.g("computesBoundsIncludingLinks",
b,a))}},computesBoundsIncludingLocation:{get:function(){return 0!==(this.P&8192)},set:function(a){var b=0!==(this.P&8192);b!==a&&(this.P^=8192,this.g("computesBoundsIncludingLocation",b,a))}},handlesDragDropForMembers:{get:function(){return 0!==(this.P&16384)},set:function(a){var b=0!==(this.P&16384);b!==a&&(this.P^=16384,this.g("handlesDragDropForMembers",b,a))}},memberParts:{get:function(){return this.Ro.iterator}},
layout:{get:function(){return this.kc},set:function(a){var b=this.kc;if(b!==a){null!==b&&(b.diagram=null,b.group=null);this.kc=a;var c=this.diagram;null!==a&&(a.diagram=c,a.group=this);null!==c&&(c.Ng=!0);this.g("layout",b,a);null!==c&&c.Db()}}},memberAdded:{get:function(){return this.Qo},set:function(a){var b=this.Qo;b!==a&&(this.Qo=a,this.g("memberAdded",b,a))}},memberRemoved:{get:function(){return this.So},
set:function(a){var b=this.So;b!==a&&(this.So=a,this.g("memberRemoved",b,a))}},memberValidation:{get:function(){return this.Ji},set:function(a){var b=this.Ji;b!==a&&(this.Ji=a,this.g("memberValidation",b,a))}},ungroupable:{get:function(){return 0!==(this.P&256)},set:function(a){var b=0!==(this.P&256);b!==a&&(this.P^=256,this.g("ungroupable",b,a))}},isSubGraphExpanded:{get:function(){return 0!==(this.P&512)},
set:function(a){var b=0!==(this.P&512);if(b!==a){this.P^=512;var c=this.diagram;this.g("isSubGraphExpanded",b,a);b=this.subGraphExpandedChanged;if(null!==b){var d=!0;null!==c&&(d=c.Z,c.Z=!0);b(this);null!==c&&(c.Z=d)}null!==c&&c.undoManager.isUndoingRedoing?(null!==this.Ra&&this.Ra.o(),this.memberParts.each(function(a){a.updateAdornments()})):a?this.expandSubGraph():this.collapseSubGraph()}}},wasSubGraphExpanded:{get:function(){return 0!==(this.P&1024)},set:function(a){var b=
0!==(this.P&1024);b!==a&&(this.P^=1024,this.g("wasSubGraphExpanded",b,a))}},subGraphExpandedChanged:{get:function(){return this.bq},set:function(a){var b=this.bq;b!==a&&(this.bq=a,this.g("subGraphExpandedChanged",b,a))}},Rh:{get:function(){return 0!==(this.P&32768)},set:function(a){0!==(this.P&32768)!==a&&(this.P^=32768)}}});vf.prototype.expandSubGraph=vf.prototype.expandSubGraph;vf.prototype.collapseSubGraph=vf.prototype.collapseSubGraph;
vf.prototype.findSubGraphParts=vf.prototype.uk;vf.prototype.findContainingGroupChain=vf.prototype.Qz;vf.prototype.findExternalNodesConnected=vf.prototype.Rz;vf.prototype.findExternalLinksConnected=vf.prototype.Qv;vf.prototype.ensureBounds=vf.prototype.Ta;vf.className="Group";function wg(){Y.call(this);this.gb=tc;this.Jp=new N(NaN,NaN,NaN,NaN)}la(wg,Y);wg.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.gb=this.gb.G();a.Jp=this.Jp.copy()};
wg.prototype.Kh=function(a){if(null===this.background&&null===this.areaBackground)return!1;var b=this.naturalBounds;return gc(0,0,b.width,b.height,a.x,a.y)};
wg.prototype.Dm=function(){var a=this.part;null!==a&&(a instanceof vf||a instanceof He)||B("Placeholder is not inside a Group or Adornment.");if(a instanceof vf){var b=this.computeBorder(this.Jp),c=this.minSize,d=this.qc;Wb(d,(isFinite(c.width)?Math.max(c.width,b.width):b.width)||0,(isFinite(c.height)?Math.max(c.height,b.height):b.height)||0);hl(this,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.dw(a)||isNaN(b.x)||
isNaN(b.y)||(c=J.alloc(),c.sj(b,a.locationSpot),c.w(a.location)||(a.location=new J(c.x,c.y)),J.free(c))}else{b=this.qc;c=this.gb;d=c.left+c.right;var e=c.top+c.bottom,f=a.adornedObject;a.angle=f.lj();var g=0;f instanceof W&&(g=f.strokeWidth);var h=f.Af(),k=f.naturalBounds,l=(k.width+g)*h;g=(k.height+g)*h;a.type!==X.Link&&(f=f.ga("Selection"===a.category?wc:a.locationSpot,J.alloc()),a.location=f,J.free(f));isNaN(l)||isNaN(g)?(a=a.adornedObject,l=a.ga(wc,J.alloc()),f=N.allocAt(l.x,l.y,0,0),f.Me(a.ga(Hc,
l)),f.Me(a.ga(zc,l)),f.Me(a.ga(Dc,l)),Wb(b,f.width+d||0,f.height+e||0),hl(this,-c.left,-c.top,b.width,b.height),J.free(l),N.free(f)):(Wb(b,l+d||0,g+e||0),hl(this,-c.left,-c.top,b.width,b.height))}};wg.prototype.Ih=function(a,b,c,d){this.actualBounds.h(a,b,c,d)};
wg.prototype.computeBorder=function(a){var b=this.part,c=b.diagram;if(null!==c&&b instanceof vf&&!b.layer.isTemporary&&b.computesBoundsAfterDrag&&this.Jp.u()){var d=c.toolManager.findTool("Dragging");if(d===c.currentTool&&(c=d.computeBorder(b,this.Jp,a),null!==c))return c}c=N.alloc();d=this.computeMemberBounds(c);var e=this.gb;b instanceof vf&&!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 vf&&b.computesBoundsIncludingLocation&&b.location.u()&&a.Me(b.location);return a};
wg.prototype.computeMemberBounds=function(a){if(!(this.part instanceof vf))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 S){if(!b.computesBoundsIncludingLinks)continue;if(sj(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(wg.prototype,{padding:{get:function(){return this.gb},set:function(a){"number"===typeof a&&(a=new pc(a));var b=this.gb;b.w(a)||(this.gb=a=a.G(),this.g("padding",b,a),this.o())}}});wg.className="Placeholder";
function S(){U.call(this,X.Link);this.Fa=8;this.Ve=null;this.We="";this.rf=this.eo=null;this.sf="";this.kq=null;this.Rk=bg;this.Gn=0;this.In=bg;this.Jn=NaN;this.$j=bp;this.Xp=.5;this.hd=null;this.Ab=(new E).freeze();this.qg=this.oh=null;this.Rl=new N;this.na=new td;this.I=this.v=this.Lf=this.Uf=null;this.l=[];this.vv=new J;this.cs=this.Lx=this.Kx=null;this.Pu=NaN;this.O=null}la(S,U);
S.prototype.cloneProtected=function(a){U.prototype.cloneProtected.call(this,a);a.Fa=this.Fa&-113;a.We=this.We;a.eo=this.eo;a.sf=this.sf;a.kq=this.kq;a.Rk=this.Rk;a.Gn=this.Gn;a.In=this.In;a.Jn=this.Jn;a.$j=this.$j;a.Xp=this.Xp;null!==this.O&&(a.O=this.O.copy())};t=S.prototype;t.yf=function(a){U.prototype.yf.call(this,a);this.We=a.We;this.sf=a.sf;a.oh=null;a.Ua();a.Lf=this.Lf;var b=a.fromPort;null!==b&&Oo(a.fromNode,b);b=a.toPort;null!==b&&Oo(a.toNode,b)};
t.hb=function(a){a.classType===S?2===(a.value&2)?this.routing=a:a===pg||a===ag||a===$f?this.curve=a:a===cp||a===dp||a===ep?this.adjusting=a:a!==bp&&a!==bg&&B("Unknown Link enum value for a Link property: "+a):U.prototype.hb.call(this,a)};t.Jc=function(){null===this.O&&(this.O=new dl)};t.qj=function(){var a=this.fromNode;if(null!==a){var b=a.findVisibleNode();null!==b&&(a=b);if(tj(a)||uj(a))return!1}a=this.toNode;return null!==a&&(b=a.findVisibleNode(),null!==b&&(a=b),tj(a)||uj(a))?!1:!0};t.Dw=function(){return!1};
t.lu=function(){};t.Wb=function(){return!1};S.prototype.computeAngle=function(a,b,c){return S.computeAngle(b,c)};S.computeAngle=function(a,b){switch(a){default:case bg:a=0;break;case Um:a=b;break;case Nm:a=b+90;break;case Pm:a=b-90;break;case fp:a=b+180;break;case Vm:a=K.Tq(b);90<a&&270>a&&(a-=180);break;case Om:a=K.Tq(b+90);90<a&&270>a&&(a-=180);break;case Qm:a=K.Tq(b-90);90<a&&270>a&&(a-=180);break;case Rm:a=K.Tq(b);if(45<a&&135>a||225<a&&315>a)return 0;90<a&&270>a&&(a-=180)}return K.Tq(a)};
function Ko(a){var b=a.fromNode,c=a.toNode,d=null;null!==b?d=null!==c?b.ly(c):b.containingGroup:null!==c?d=c.containingGroup:d=null;b=d;c=a.mi;if(c!==b){null!==c&&Fo(c,a);a.mi=b;null!==b&&Eo(b,a);var e=a.containingGroupChanged;if(null!==e){var f=!0,g=a.diagram;null!==g&&(f=g.Z,g.Z=!0);e(a,c,b);null!==g&&(g.Z=f)}!a.dd||a.Kx!==c&&a.Lx!==c||a.Ua()}if(a.isLabeledLink)for(a=a.labelNodes;a.next();)a.value.containingGroup=d}t=S.prototype;
t.Oh=function(){var a=this.containingGroup;null!==a&&this.fromNode!==a&&this.toNode!==a&&a.computesBoundsIncludingLinks&&U.prototype.Oh.call(this)};t.Iq=function(a){var b=this.fromNode;return a===b?this.toNode:b};t.iA=function(a){var b=this.fromPort;return a===b?this.toPort:b};function So(a,b){null===a.hd&&(a.hd=new F);a.hd.add(b);a.o()}
t.Kq=function(a){U.prototype.Kq.call(this,a);gp(this)&&this.Nq(this.actualBounds);if(!a){a=this.Ve;var b=null;null!==a&&(b=this.fromPort,Qo(a,this,b));var c=this.rf;if(null!==c){var d=this.toPort;c===a&&d===b||Qo(c,this,d)}hp(this)}};t.Lq=function(a){U.prototype.Lq.call(this,a);gp(this)&&this.Nq(this.actualBounds);if(!a){a=this.Ve;var b=null;null!==a&&(b=this.fromPort,Ro(a,this,b));var c=this.rf;if(null!==c){var d=this.toPort;c===a&&d===b||Ro(c,this,d)}ip(this)}};
t.rk=function(){this.dd=!0;if(null!==this.hd){var a=this.diagram;if(null!==a)for(var b=this.hd.copy().iterator;b.next();)a.remove(b.value)}null!==this.data&&(a=this.diagram,null!==a&&a.partManager.removeDataForLink(this))};S.prototype.updateRelationshipsFromData=function(){if(null!==this.data){var a=this.diagram;null!==a&&a.partManager.updateRelationshipsFromData(this)}};
S.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));qf(this,d,e);for(a=this.labelNodes;a.next();)b=a.value,c=b.position,b.moveTo(c.x+d,c.y+e)};
S.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};S.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};
S.prototype.computeMidPoint=function(a){var b=this.pointsCount;if(0===b)return a.assign(Lb),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()===pg))return this.na.Wv(.5,a),a.add(this.i(0)),c=this.na.figures.first(),a.offset(-c.startX,-c.startY),a;if(this.computeCurve()===pg){if(3===b)return this.i(1);d=(b-1)/3|0;c=3*(d/2|0);if(1===d%2){d=this.i(c);var e=this.i(c+1),
f=this.i(c+2);c=this.i(c+3);K.sz(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};
S.prototype.computeMidAngle=function(){var a=this.pointsCount;if(2>a)return NaN;if(2===a)return this.i(0).Sa(this.i(1));if(this.isOrthogonal&&(15<=this.computeCorner()||this.computeCurve()===pg))return this.na.sy(.5);if(this.computeCurve()===pg&&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.rz(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).Sa(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).Sa(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.Sa(d)};t=S.prototype;t.i=function(a){return this.Ab.j[a]};t.od=function(a,b){this.Ab.nd(a,b)};t.K=function(a,b,c){this.Ab.nd(a,new J(b,c))};t.rA=function(a,b){this.Ab.vb(a,b)};
t.m=function(a,b,c){this.Ab.vb(a,new J(b,c))};t.Be=function(a){this.Ab.add(a)};t.vf=function(a,b){this.Ab.add(new J(a,b))};t.sw=function(a){this.Ab.bb(a)};t.lk=function(){this.Ab.clear()};
function qf(a,b,c){if(0!==b||0!==c){for(var d=a.dd,e=new E,f=a.Ab.iterator;f.next();){var g=f.value;e.add((new J(g.x+b,g.y+c)).freeze())}e.freeze();f=a.Ab;a.Ab=e;g=a.diagram;isNaN(b)||isNaN(c)||null!==g&&g.animationManager.rc?a.o():(a.dg.h(a.dg.x+b,a.dg.y+c),a.la.h(a.la.x+b,a.la.y+c),Cl(a));d&&jp(a);null!==g&&g.animationManager.rc&&(a.qg=e);a.g("points",f,e)}}t.Th=function(){null===this.oh&&(this.oh=this.Ab,this.Ab=this.Ab.copy())};
t.xf=function(){if(null!==this.oh){for(var a=this.oh,b=this.Ab,c=Infinity,d=Infinity,e=a.j,f=e.length,g=0;g<f;g++){var h=e[g];c=Math.min(h.x,c);d=Math.min(h.y,d)}h=g=Infinity;for(var k=b.j,l=k.length,m=0;m<l;m++){var n=k[m];g=Math.min(n.x,g);h=Math.min(n.y,h);n.freeze()}b.freeze();if(l===f)for(f=0;f<l;f++){if(m=e[f],n=k[f],m.x-c!==n.x-g||m.y-d!==n.y-h){this.cc();break}}else this.cc();this.oh=null;c=this.diagram;null!==c&&c.animationManager.rc&&(this.qg=b);jp(this);this.g("points",a,b)}};
t.xw=function(){null!==this.oh&&(this.Ab=this.oh,this.oh=null)};function jp(a){0===a.Ab.count?a.dd=!1:(a.dd=!0,a.cs=null,a.Pu=NaN,a.defaultFromPoint=a.i(0),a.defaultToPoint=a.i(a.pointsCount-1),kp(a,!1))}t.Ua=function(){if(!this.suspendsRouting){var a=this.diagram;if(a){if(a.Xt.contains(this)||a.undoManager.isUndoingRedoing)return;a=a.animationManager;if(a.isTicking&&!a.isAnimating)return;null!==this.qg&&!a.isTicking&&a.isAnimating&&(this.qg=null)}a=this.path;null!==a&&(this.dd=!1,this.o(),a.o())}};
t.wj=function(){if(!this.dd&&!this.Ct){var a=!0;try{this.Ct=!0,this.Th(),a=this.computePoints()}catch(b){this.Ct=!1,this.xw()}finally{this.Ct=!1,a?this.xf():this.xw()}}};
S.prototype.computePoints=function(){var a=this.diagram;if(null===a)return!1;var b=this.fromNode,c=null;null===b?(a.rh||(a.Tl=new W,a.Tl.desiredSize=Mb,a.Tl.strokeWidth=0,a.rh=new V,a.rh.add(a.Tl),a.rh.Ta()),this.defaultFromPoint&&(a.rh.position=a.rh.location=this.defaultFromPoint,a.rh.Ta(),b=a.rh,c=a.Tl)):c=this.fromPort;if(null!==c&&!b.isVisible()){var d=b.findVisibleNode();null!==d&&d!==b?(b=d,c=d.port):b=d}this.Kx=b;if(null===b||!b.location.u())return!1;for(;!(null===c||c.actualBounds.u()&&c.Ff());)c=
c.panel;if(null===c)return!1;var e=this.toNode,f=null;null===e?(a.sh||(a.Ul=new W,a.Ul.desiredSize=Mb,a.Ul.strokeWidth=0,a.sh=new V,a.sh.add(a.Ul),a.sh.Ta()),this.defaultToPoint&&(a.sh.position=a.sh.location=this.defaultToPoint,a.sh.Ta(),e=a.sh,f=a.Ul)):f=this.toPort;null===f||e.isVisible()||(a=e.findVisibleNode(),null!==a&&a!==e?(e=a,f=a.port):e=a);this.Lx=e;if(null===e||!e.location.u())return!1;for(;!(null===f||f.actualBounds.u()&&f.Ff());)f=f.panel;if(null===f)return!1;var g=this.pointsCount;d=
this.computeSpot(!0,c);a=this.computeSpot(!1,f);var h=lp(d),k=lp(a),l=c===f&&null!==c,m=this.isOrthogonal,n=this.curve===pg;this.Uf=l&&!m?n=!0:!1;var p=this.computeAdjusting()===bg||l;if(!m&&!l&&h&&k){if(h=!1,!p&&3<=g&&(p=this.getLinkPoint(b,c,d,!0,!1,e,f),k=this.getLinkPoint(e,f,a,!1,!1,b,c),h=this.adjustPoints(0,p,g-1,k))&&(p=this.getLinkPoint(b,c,d,!0,!1,e,f),k=this.getLinkPoint(e,f,a,!1,!1,b,c),this.adjustPoints(0,p,g-1,k)),!h)if(this.lk(),n){g=this.getLinkPoint(b,c,d,!0,!1,e,f);p=this.getLinkPoint(e,
f,a,!1,!1,b,c);h=p.x-g.x;k=p.y-g.y;l=this.computeCurviness();n=m=0;var r=g.x+h/3,q=g.y+k/3,u=r,v=q;K.A(k,0)?v=0<h?v-l:v+l:(m=-h/k,n=Math.sqrt(l*l/(m*m+1)),0>l&&(n=-n),u=(0>k?-1:1)*n+r,v=m*(u-r)+q);r=g.x+2*h/3;q=g.y+2*k/3;var w=r,y=q;K.A(k,0)?y=0<h?y-l:y+l:(w=(0>k?-1:1)*n+r,y=m*(w-r)+q);this.lk();this.Be(g);this.vf(u,v);this.vf(w,y);this.Be(p);this.od(0,this.getLinkPoint(b,c,d,!0,!1,e,f));this.od(3,this.getLinkPoint(e,f,a,!1,!1,b,c))}else d=this.getLinkPoint(b,c,d,!0,!1,e,f),a=this.getLinkPoint(e,
f,a,!1,!1,b,c),this.hasCurviness()?(p=a.x-d.x,e=a.y-d.y,f=this.computeCurviness(),b=d.x+p/2,c=d.y+e/2,g=b,h=c,K.A(e,0)?h=0<p?h-f:h+f:(p=-p/e,g=Math.sqrt(f*f/(p*p+1)),0>f&&(g=-g),g=(0>e?-1:1)*g+b,h=p*(g-b)+c),this.Be(d),this.vf(g,h)):this.Be(d),this.Be(a)}else{n=this.isAvoiding;p&&(m&&n||l)&&this.lk();var z=l?this.computeCurviness():0;n=this.getLinkPoint(b,c,d,!0,m,e,f);r=u=q=0;if(m||!h||l)v=this.computeEndSegmentLength(b,c,d,!0),r=this.getLinkDirection(b,c,n,d,!0,m,e,f),l&&(h||d.w(a)||!m&&1===d.x+
a.x&&1===d.y+a.y)&&(r-=m?90:30,0>z&&(r-=180)),0>r?r+=360:360<=r&&(r-=360),l&&(v+=Math.abs(z)*(m?1:2)),0===r?q=v:90===r?u=v:180===r?q=-v:270===r?u=-v:(q=v*Math.cos(r*Math.PI/180),u=v*Math.sin(r*Math.PI/180)),d.mc()&&l&&(v=c.ga(Bc,J.alloc()),w=J.allocAt(v.x+1E3*q,v.y+1E3*u),this.getLinkPointFromPoint(b,c,v,w,!0,n),J.free(v),J.free(w));v=this.getLinkPoint(e,f,a,!1,m,b,c);var A=y=w=0;if(m||!k||l){var C=this.computeEndSegmentLength(e,f,a,!1);A=this.getLinkDirection(e,f,v,a,!1,m,b,c);l&&(k||d.w(a)||!m&&
1===d.x+a.x&&1===d.y+a.y)&&(A+=m?0:30,0>z&&(A+=180));0>A?A+=360:360<=A&&(A-=360);l&&(C+=Math.abs(z)*(m?1:2));0===A?w=C:90===A?y=C:180===A?w=-C:270===A?y=-C:(w=C*Math.cos(A*Math.PI/180),y=C*Math.sin(A*Math.PI/180));a.mc()&&l&&(a=f.ga(Bc,J.alloc()),d=J.allocAt(a.x+1E3*w,a.y+1E3*y),this.getLinkPointFromPoint(e,f,a,d,!1,v),J.free(a),J.free(d))}a=n;if(m||!h||l)a=new J(n.x+q,n.y+u);d=v;if(m||!k||l)d=new J(v.x+w,v.y+y);!p&&!m&&h&&3<g&&this.adjustPoints(0,n,g-2,d)?this.od(g-1,v):!p&&!m&&k&&3<g&&this.adjustPoints(1,
a,g-1,v)?this.od(0,n):!p&&(m?6<=g:4<g)&&this.adjustPoints(1,a,g-2,d)?(this.od(0,n),this.od(g-1,v)):(this.lk(),this.Be(n),(m||!h||l)&&this.Be(a),m&&this.addOrthoPoints(a,r,d,A,b,e),(m||!k||l)&&this.Be(d),this.Be(v))}return!0};function mp(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}
S.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.de()||(e=e.panel);if(null===e){e=d.x;d=d.y;var g=c.x;c=c.y}else{a=e.Ad;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.vk(e,d,g,c,f);null!==
a&&f.transform(a);return f};function np(a,b){var c=b.tp;null===c&&(c=new op,c.port=b,c.node=b.part,b.tp=c);return pp(c,a)}
S.prototype.getLinkPoint=function(a,b,c,d,e,f,g,h){void 0===h&&(h=new J);if(c.ib()&&!lp(c))return b.ga(c,h),h;if(c.Mc()){var k=np(this,b);if(null!==k){h.assign(k.Qq);if(e&&this.routing===qp){var l=np(this,g);if(null!==l&&k.qm<l.qm){k=J.alloc();l=J.alloc();var m=new N(b.ga(wc,k),b.ga(Hc,l)),n=this.computeSpot(!d,g);a=this.getLinkPoint(f,g,n,!d,e,a,b,l);(c.Df(Jc)||c.Df(Kc))&&a.y>=m.y&&a.y<=m.y+m.height?h.y=a.y:(c.Df(Ic)||c.Df(Lc))&&a.x>=m.x&&a.x<=m.x+m.width&&(h.x=a.x);J.free(k);J.free(l)}}return h}}c=
b.ga(.5===c.x&&.5===c.y?c:Bc,J.alloc());this.pointsCount>(e?6:2)?(g=d?this.i(1):this.i(this.pointsCount-2),e&&(g=mp(c,g.copy()))):(k=this.computeSpot(!d,g),f=J.alloc(),g=g.ga(.5===k.x&&.5===k.y?k:Bc,f),e&&(g=mp(c,g)),J.free(f));this.getLinkPointFromPoint(a,b,c,g,d,h);J.free(c);return h};
S.prototype.getLinkDirection=function(a,b,c,d,e,f,g,h){a:if(d.ib())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.Mc()&&(k=np(this,b),null!==k))switch(k.Ac){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.ga(Bc,J.alloc());this.pointsCount>(f?6:2)?(h=e?this.i(1):this.i(this.pointsCount-2),h=f?mp(k,h.copy()):c):(c=J.alloc(),h=h.ga(Bc,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.mc()&&g.Cd(a)&&(k+=180,360<=k&&(k-=360));if(lp(d))return k;a=b.lj();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};S.prototype.computeEndSegmentLength=function(a,b,c,d){if(null!==b&&c.Mc()&&(a=np(this,b),null!==a))return a.Ov;a=d?this.fromEndSegmentLength:this.toEndSegmentLength;null!==b&&isNaN(a)&&(a=d?b.fromEndSegmentLength:b.toEndSegmentLength);isNaN(a)&&(a=10);return a};
S.prototype.computeSpot=function(a,b){void 0===b&&(b=null);a?(a=b?b:this.fromPort,null===a?a=Bc:(b=this.fromSpot,b.Mb()&&(b=a.fromSpot),a=b===ad?vc:b)):(a=b?b:this.toPort,null===a?a=Bc:(b=this.toSpot,b.Mb()&&(b=a.toSpot),a=b===ad?vc:b));return a};function lp(a){return a===vc||.5===a.x&&.5===a.y}S.prototype.computeOtherPoint=function(a,b){if(this.computeAdjusting()!==bg&&4<this.pointsCount)return this.computeMidPoint(new J);a=b.ga(Bc);b=b.tp;b=null!==b?pp(b,this):null;null!==b&&(a=b.Qq);return a};
S.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};
S.prototype.zf=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=rd.alloc(),g.reset());g.multiply(this.transform);if(this.Jh(a,g))return fn(this,b,c,e),void 0===f&&rd.free(g),!0;if(this.Lc(a,g)){var h=!1;if(!this.isAtomic)for(var k=this.W.j,l=k.length;l--;){var m=k[l];if(m.visible||m===this.locationObject){var n=m.actualBounds,p=this.naturalBounds;if(!(n.x>p.width||n.y>p.height||0>n.x+n.width||0>n.y+n.height)){n=rd.alloc();n.set(g);
if(m instanceof X)h=m.zf(a,b,c,d,e,n);else if(this.path===m){if(m instanceof W)if(h=a,p=d,!1===m.pickable)h=!1;else if(n.multiply(m.transform),p)b:{var r=h,q=n;if(m.Jh(r,q))h=!0;else{if(void 0===q&&(q=m.transform,r.De(m.actualBounds))){h=!0;break b}h=r.left;p=r.right;var u=r.top;r=r.bottom;var v=J.alloc(),w=J.alloc(),y=J.alloc(),z=rd.alloc();z.set(q);z.iw(m.transform);z.St();w.x=p;w.y=u;w.transform(z);v.x=h;v.y=u;v.transform(z);q=!1;Gn(m,v,w,y)?q=!0:(v.x=p,v.y=r,v.transform(z),Gn(m,v,w,y)?q=!0:(w.x=
h,w.y=r,w.transform(z),Gn(m,v,w,y)?q=!0:(v.x=h,v.y=u,v.transform(z),Gn(m,v,w,y)&&(q=!0))));rd.free(z);J.free(v);J.free(w);J.free(y);h=q}}else h=m.Jh(h,n)}else h=jl(m,a,d,n);h&&(p=m,null!==b&&(p=b(m)),p&&(null===c||c(p))&&e.add(p));rd.free(n)}}}void 0===f&&rd.free(g);return h||null!==this.background||null!==this.areaBackground}void 0===f&&rd.free(g);return!1};
S.prototype.computeCurve=function(){if(null===this.Uf){var a=this.fromPort,b=this.isOrthogonal;this.Uf=null!==a&&a===this.toPort&&!b}return this.Uf?pg:this.curve};S.prototype.computeCorner=function(){if(this.curve===pg)return 0;var a=this.corner;if(isNaN(a)||0>a)a=10;return a};
S.prototype.findMidLabel=function(){for(var a=this.path,b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d];if(e!==a&&!e.isPanelMain&&(-Infinity===e.segmentIndex||isNaN(e.segmentIndex)))return e}for(a=this.labelNodes;a.next();)if(b=a.value,-Infinity===b.segmentIndex||isNaN(b.segmentIndex))return b;return null};
S.prototype.computeSpacing=function(){if(!this.isVisible())return 0;var a=rp;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===Um||d===Vm||d===fp?a=Math.max(a,e):d===Pm||d===Qm||d===Nm||d===Om?a=Math.max(a,g):(b=b.ga(Bc).Sa(c.ga(Bc))/180*Math.PI,a=Math.max(a,
Math.abs(Math.sin(b)*g)+Math.abs(Math.cos(b)*e)+1));this.curve===pg&&(a*=1.333)}}return a};S.prototype.arrangeBundledLinks=function(a,b){if(b)for(b=0;b<a.length;b++){var c=a[b];c.computeAdjusting()===bg&&c.Ua()}};
S.prototype.computeCurviness=function(){var a=this.curviness;if(isNaN(a)){a=sp;var b=this.Lf;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.$t===this.fromNode&&(a=-a);Ha(c)}}return a};S.prototype.computeThickness=function(){if(!this.isVisible())return 0;var a=this.path;return null!==a?Math.max(a.strokeWidth,1):1};
S.prototype.hasCurviness=function(){return!isNaN(this.curviness)||null!==this.Lf};
S.prototype.adjustPoints=function(a,b,c,d){var e=this.computeAdjusting();if(this.isOrthogonal){if(e===dp)return!1;e===ep&&(e=cp)}switch(e){case dp:var f=this.i(a),g=this.i(c);if(!f.Na(b)||!g.Na(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.od(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.K(a,g+b*Math.cos(h),n+b*Math.sin(h)));this.od(c,d)}}return!0;case ep:f=this.i(a);n=this.i(c);if(!f.Na(b)||!n.Na(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.od(a,b);for(a+=1;a<c;a++){b=this.i(a);
var u=b.x,v=b.y,w=.5;0!==l&&(w=((e-u)*(e-g)+(f-v)*(f-n))/l);var y=e+w*(g-e),z=f+w*(n-f);b=Math.sqrt((u-y)*(u-y)+(v-z)*(v-z));v<q*(u-y)+z&&(b=-b);0<q&&(b=-b);u=h+w*(k-h);w=m+w*(p-m);0!==q?(b=u+b/r,this.K(a,b,w-(b-u)/q)):this.K(a,u,w+b)}this.od(c,d)}return!0;case cp: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.A(e.y,f.y)?K.A(f.x,g.x)?m=b.y:K.A(f.y,g.y)&&(h=b.x):K.A(e.x,f.x)&&(K.A(f.y,g.y)?h=b.x:K.A(f.x,g.x)&&(m=b.y)),this.K(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.A(e.y,f.y)?K.A(f.x,g.x)?m=d.y:K.A(f.y,g.y)&&(h=d.x):K.A(e.x,f.x)&&(K.A(f.y,g.y)?h=d.x:K.A(f.x,g.x)&&(m=d.y)),this.K(c-1,h,m),Qj(this))){this.K(a+1,n,l);this.K(c-1,k,p);c=!1;break a}this.od(a,b);this.od(c,d);c=!0}return c;default:return!1}};
S.prototype.addOrthoPoints=function(a,b,c,d,e,f){b=-45<=b&&45>b?0:45<=b&&135>b?90:135<=b&&225>b?180:270;d=-45<=d&&45>d?0:45<=d&&135>d?90:135<=d&&225>d?180:270;var g=e.actualBounds.copy(),h=f.actualBounds.copy();if(g.u()&&h.u()){g.Ic(tp,tp);h.Ic(tp,tp);g.Me(a);h.Me(c);if(0===b)if(c.x>a.x||270===d&&c.y<a.y&&h.right>a.x||90===d&&c.y>a.y&&h.right>a.x){var k=new J(c.x,a.y);var l=new J(c.x,(a.y+c.y)/2);180===d?(k.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1),l.x=k.x,l.y=c.y):270===d&&c.y<a.y||90===
d&&c.y>a.y?(k.x=a.x<h.left?this.computeMidOrthoPosition(a.x,a.y,h.left,c.y,!1):a.x<h.right&&(270===d&&a.y<h.top||90===d&&a.y>h.bottom)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):h.right,l.x=k.x,l.y=c.y):0===d&&a.x<h.left&&a.y>h.top&&a.y<h.bottom&&(k.x=a.x,k.y=a.y<c.y?Math.min(c.y,h.top):Math.max(c.y,h.bottom),l.y=k.y)}else{k=new J(a.x,c.y);l=new J((a.x+c.x)/2,c.y);if(180===d||90===d&&c.y<g.top||270===d&&c.y>g.bottom)180===d&&(h.aa(a)||g.aa(c))?k.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,
!0):c.y<a.y&&(180===d||90===d)?k.y=this.computeMidOrthoPosition(a.x,g.top,c.x,Math.max(c.y,h.bottom),!0):c.y>a.y&&(180===d||270===d)&&(k.y=this.computeMidOrthoPosition(a.x,g.bottom,c.x,Math.min(c.y,h.top),!0)),l.x=c.x,l.y=k.y;if(k.y>g.top&&k.y<g.bottom)if(c.x>=g.left&&c.x<=a.x||a.x<=h.right&&a.x>=c.x){if(90===d||270===d)k=new J(Math.max((a.x+c.x)/2,a.x),a.y),l=new J(k.x,c.y)}else k.y=270===d||(0===d||180===d)&&c.y<a.y?Math.min(c.y,0===d?g.top:Math.min(g.top,h.top)):Math.max(c.y,0===d?g.bottom:Math.max(g.bottom,
h.bottom)),l.x=c.x,l.y=k.y}else if(180===b)if(c.x<a.x||270===d&&c.y<a.y&&h.left<a.x||90===d&&c.y>a.y&&h.left<a.x)k=new J(c.x,a.y),l=new J(c.x,(a.y+c.y)/2),0===d?(k.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1),l.x=k.x,l.y=c.y):270===d&&c.y<a.y||90===d&&c.y>a.y?(k.x=a.x>h.right?this.computeMidOrthoPosition(a.x,a.y,h.right,c.y,!1):a.x>h.left&&(270===d&&a.y<h.top||90===d&&a.y>h.bottom)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):h.left,l.x=k.x,l.y=c.y):180===d&&a.x>h.right&&a.y>h.top&&a.y<
h.bottom&&(k.x=a.x,k.y=a.y<c.y?Math.min(c.y,h.top):Math.max(c.y,h.bottom),l.y=k.y);else{k=new J(a.x,c.y);l=new J((a.x+c.x)/2,c.y);if(0===d||90===d&&c.y<g.top||270===d&&c.y>g.bottom)0===d&&(h.aa(a)||g.aa(c))?k.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):c.y<a.y&&(0===d||90===d)?k.y=this.computeMidOrthoPosition(a.x,g.top,c.x,Math.max(c.y,h.bottom),!0):c.y>a.y&&(0===d||270===d)&&(k.y=this.computeMidOrthoPosition(a.x,g.bottom,c.x,Math.min(c.y,h.top),!0)),l.x=c.x,l.y=k.y;if(k.y>g.top&&k.y<g.bottom)if(c.x<=
g.right&&c.x>=a.x||a.x>=h.left&&a.x<=c.x){if(90===d||270===d)k=new J(Math.min((a.x+c.x)/2,a.x),a.y),l=new J(k.x,c.y)}else k.y=270===d||(0===d||180===d)&&c.y<a.y?Math.min(c.y,180===d?g.top:Math.min(g.top,h.top)):Math.max(c.y,180===d?g.bottom:Math.max(g.bottom,h.bottom)),l.x=c.x,l.y=k.y}else if(90===b)if(c.y>a.y||180===d&&c.x<a.x&&h.bottom>a.y||0===d&&c.x>a.x&&h.bottom>a.y)k=new J(a.x,c.y),l=new J((a.x+c.x)/2,c.y),270===d?(k.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0),l.x=c.x,l.y=k.y):180===
d&&c.x<a.x||0===d&&c.x>a.x?(k.y=a.y<h.top?this.computeMidOrthoPosition(a.x,a.y,c.x,h.top,!0):a.y<h.bottom&&(180===d&&a.x<h.left||0===d&&a.x>h.right)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):h.bottom,l.x=c.x,l.y=k.y):90===d&&a.y<h.top&&a.x>h.left&&a.x<h.right&&(k.x=a.x<c.x?Math.min(c.x,h.left):Math.max(c.x,h.right),k.y=a.y,l.x=k.x);else{k=new J(c.x,a.y);l=new J(c.x,(a.y+c.y)/2);if(270===d||0===d&&c.x<g.left||180===d&&c.x>g.right)270===d&&(h.aa(a)||g.aa(c))?k.x=this.computeMidOrthoPosition(a.x,
a.y,c.x,c.y,!1):c.x<a.x&&(270===d||0===d)?k.x=this.computeMidOrthoPosition(g.left,a.y,Math.max(c.x,h.right),c.y,!1):c.x>a.x&&(270===d||180===d)&&(k.x=this.computeMidOrthoPosition(g.right,a.y,Math.min(c.x,h.left),c.y,!1)),l.x=k.x,l.y=c.y;if(k.x>g.left&&k.x<g.right)if(c.y>=g.top&&c.y<=a.y||a.y<=h.bottom&&a.y>=c.y){if(0===d||180===d)k=new J(a.x,Math.max((a.y+c.y)/2,a.y)),l=new J(c.x,k.y)}else k.x=180===d||(90===d||270===d)&&c.x<a.x?Math.min(c.x,90===d?g.left:Math.min(g.left,h.left)):Math.max(c.x,90===
d?g.right:Math.max(g.right,h.right)),l.x=k.x,l.y=c.y}else if(c.y<a.y||180===d&&c.x<a.x&&h.top<a.y||0===d&&c.x>a.x&&h.top<a.y)k=new J(a.x,c.y),l=new J((a.x+c.x)/2,c.y),90===d?(k.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0),l.x=c.x,l.y=k.y):180===d&&c.x<a.x||0===d&&c.x>=a.x?(k.y=a.y>h.bottom?this.computeMidOrthoPosition(a.x,a.y,c.x,h.bottom,!0):a.y>h.top&&(180===d&&a.x<h.left||0===d&&a.x>h.right)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):h.top,l.x=c.x,l.y=k.y):270===d&&a.y>h.bottom&&a.x>
h.left&&a.x<h.right&&(k.x=a.x<c.x?Math.min(c.x,h.left):Math.max(c.x,h.right),k.y=a.y,l.x=k.x);else{k=new J(c.x,a.y);l=new J(c.x,(a.y+c.y)/2);if(90===d||0===d&&c.x<g.left||180===d&&c.x>g.right)90===d&&(h.aa(a)||g.aa(c))?k.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):c.x<a.x&&(90===d||0===d)?k.x=this.computeMidOrthoPosition(g.left,a.y,Math.max(c.x,h.right),c.y,!1):c.x>a.x&&(90===d||180===d)&&(k.x=this.computeMidOrthoPosition(g.right,a.y,Math.min(c.x,h.left),c.y,!1)),l.x=k.x,l.y=c.y;if(k.x>g.left&&
k.x<g.right)if(c.y<=g.bottom&&c.y>=a.y||a.y>=h.top&&a.y<=c.y){if(0===d||180===d)k=new J(a.x,Math.min((a.y+c.y)/2,a.y)),l=new J(c.x,k.y)}else k.x=180===d||(90===d||270===d)&&c.x<a.x?Math.min(c.x,270===d?g.left:Math.min(g.left,h.left)):Math.max(c.x,270===d?g.right:Math.max(g.right,h.right)),l.x=k.x,l.y=c.y}var m=k,n=l,p=c;if(this.isAvoiding){var r=this.diagram;if(null===r||!sk(r)||g.aa(p)&&!f.Cd(e)||h.aa(a)&&!e.Cd(f)||e===f||this.layer.isTemporary)b=!1;else{var q=tk(r,!0,this.containingGroup,null);
if(17!==this.segmentIndex&&q.zk(Math.min(a.x,m.x),Math.min(a.y,m.y),Math.abs(a.x-m.x),Math.abs(a.y-m.y))&&q.zk(Math.min(m.x,n.x),Math.min(m.y,n.y),Math.abs(m.x-n.x),Math.abs(m.y-n.y))&&q.zk(Math.min(n.x,p.x),Math.min(n.y,p.y),Math.abs(n.x-p.x),Math.abs(n.y-p.y)))b=!1;else{e=a;f=p;var u=c=null;if(r.isVirtualized){r=q.bounds.copy();r.Ic(-q.xq,-q.wq);var v=J.alloc();xk(q,a.x,a.y)||(K.bd(r.x,r.y,r.x+r.width,r.y+r.height,a.x,a.y,m.x,m.y,v)?(c=a=v.copy(),b=v.Sa(m)):K.bd(r.x,r.y,r.x+r.width,r.y+r.height,
m.x,m.y,n.x,n.y,v)?(c=a=v.copy(),b=v.Sa(n)):K.bd(r.x,r.y,r.x+r.width,r.y+r.height,n.x,n.y,p.x,p.y,v)&&(c=a=v.copy(),b=v.Sa(p)));xk(q,p.x,p.y)||(K.bd(r.x,r.y,r.x+r.width,r.y+r.height,p.x,p.y,n.x,n.y,v)?(u=p=v.copy(),d=n.Sa(v)):K.bd(r.x,r.y,r.x+r.width,r.y+r.height,n.x,n.y,m.x,m.y,v)?(u=p=v.copy(),d=m.Sa(v)):K.bd(r.x,r.y,r.x+r.width,r.y+r.height,m.x,m.y,a.x,a.y,v)&&(u=p=v.copy(),d=a.Sa(v)));J.free(v)}g=g.copy().Oc(h);g.Ic(q.xq*q.Ty,q.wq*q.Ty);up(q,a,b,p,d,g,!0);h=vp(q,p.x,p.y);!q.abort&&h>=wp&&(wk(q),
g.Ic(q.xq*q.Dy,q.wq*q.Dy),up(q,a,b,p,d,g,!1),h=vp(q,p.x,p.y));if(!q.abort&&h<wp&&vp(q,p.x,p.y)!==yk){xp(this,q,p.x,p.y,d,!0);h=this.i(2);if(4>this.pointsCount)0===b||180===b?(h.x=a.x,h.y=p.y):(h.x=p.x,h.y=a.y),this.K(2,h.x,h.y),this.m(3,h.x,h.y);else if(g=this.i(3),0===b||180===b)K.A(h.x,g.x)?(h=0===b?Math.max(h.x,a.x):Math.min(h.x,a.x),this.K(2,h,a.y),this.K(3,h,g.y)):K.A(h.y,g.y)?(Math.abs(a.y-h.y)<=q.wq/2&&(this.K(2,h.x,a.y),this.K(3,g.x,a.y)),this.m(2,h.x,a.y)):this.K(2,a.x,h.y);else if(90===
b||270===b)K.A(h.y,g.y)?(h=90===b?Math.max(h.y,a.y):Math.min(h.y,a.y),this.K(2,a.x,h),this.K(3,g.x,h)):K.A(h.x,g.x)?(Math.abs(a.x-h.x)<=q.xq/2&&(this.K(2,a.x,h.y),this.K(3,a.x,g.y)),this.m(2,a.x,h.y)):this.K(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.m(2,a.x,g.y):this.m(2,g.x,a.y):0===b||180===b?this.m(2,e.x,c.y):this.m(2,c.x,e.y));null!==u&&(0===d||180===d?this.vf(f.x,u.y):this.vf(u.x,f.y));b=!0}else b=!1}}}else b=!1;b||(this.Be(k),this.Be(l))}};
S.prototype.computeMidOrthoPosition=function(a,b,c,d,e){var f=0;!this.hasCurviness()||this.computeSpot(!0,this.fromPort).Mc()||this.computeSpot(!1,this.toPort).Mc()||(f=this.computeCurviness());return e?(b+d)/2+f:(a+c)/2+f};
function Qj(a){if(null===a.diagram||!a.isAvoiding||!sk(a.diagram))return!1;var b=a.points.j,c=b.length;if(4>c)return!1;a=tk(a.diagram,!0,a.containingGroup,null);for(var d=1;d<c-2;d++){var e=b[d],f=b[d+1];if(!a.zk(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 xp(a,b,c,d,e,f){var g=b.xq,h=b.wq,k=vp(b,c,d),l=c,m=d;for(0===e?l+=g:90===e?m+=h:180===e?l-=g:m-=h;k>yp&&vp(b,l,m)===k-1;)c=l,d=m,0===e?l+=g:90===e?m+=h:180===e?l-=g:m-=h,--k;if(f){if(k>yp)if(180===e||0===e)c=Math.floor(c/g)*g+g/2;else if(90===e||270===e)d=Math.floor(d/h)*h+h/2}else c=Math.floor(c/g)*g+g/2,d=Math.floor(d/h)*h+h/2;k>yp&&(f=e,l=c,m=d,0===e?(f=90,m+=h):90===e?(f=180,l-=g):180===e?(f=270,m-=h):270===e&&(f=0,l+=g),vp(b,l,m)===k-1?xp(a,b,l,m,f,!1):(l=c,m=d,0===e?(f=270,m-=h):90===
e?(f=0,l+=g):180===e?(f=90,m+=h):270===e&&(f=180,l-=g),vp(b,l,m)===k-1&&xp(a,b,l,m,f,!1)));a.vf(c,d)}S.prototype.Nz=function(a){var b=a.x;a=a.y;for(var c=this.i(0),d=this.i(1),e=Cb(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=Cb(b,a,d.x,d.y,c.x,c.y);d=c;h<e&&(f=g,e=h)}return f};S.prototype.cc=function(){this.Ym=!1;this.o()};
S.prototype.Bk=function(a){if(!a){if(!1===this.dd)return;a=this.pb();if(this.Ym&&(null===a||null!==a.geometry))return}this.na=this.makeGeometry();a=this.path;if(null!==a){a.na=this.na;for(var b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d];e!==a&&e.isPanelMain&&e instanceof W&&(e.na=this.na)}}};
S.prototype.makeGeometry=function(){var a=this.na,b=this.pointsCount;if(2>b)return a.type=wd,this.Ym=!0,a;var c=!1,d=this.diagram;null!==d&&gp(this)&&d.Vg.contains(this)&&(0!==this.Rl.width||0!==this.Rl.height)&&(c=!0);var e=this.i(0).copy(),f=e.copy();d=this.Ab.j;var g=this.computeCurve();if(g===pg&&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.vv.x;k-=this.vv.y;e.x-=d;e.y-=k;if(2!==b||gp(this)){a.type=ud;h=Kd(a);0!==this.computeShortLength(!0)&&(e=zp(this,e,!0,f));Ld(h,e.x,e.y,!1);if(g===pg&&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=zp(this,e,!1,f)),Md(h,b,c,b,c,e.x,e.y);else if(this.isOrthogonal){f=new J(d,k);e=this.i(1).copy();g=new J(d,k);b=new J(d,k);c=this.i(0);for(var l,m=this.smoothness/3,n=1;n<this.pointsCount-1;n++){l=this.i(n);var p=c,r=l,q=this.i(Ap(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 v=p.x;p=p.y;var w=r.x;r=r.y;var y=q.x;q=q.y;var z=u*Bp(v,p,w,r);u*=Bp(w,r,y,q);K.$(p,r)&&K.$(w,y)&&(w>v?q>r?(g.x=w-z,g.y=r-z,b.x=w+u,b.y=r+u):(g.x=
w-z,g.y=r+z,b.x=w+u,b.y=r-u):q>r?(g.x=w+z,g.y=r-z,b.x=w-u,b.y=r+u):(g.x=w+z,g.y=r+z,b.x=w-u,b.y=r-u));K.$(v,w)&&K.$(r,q)&&(r>p?(y>w?(g.x=w-z,g.y=r-z,b.x=w+u):(g.x=w+z,g.y=r-z,b.x=w-u),b.y=r+u):(y>w?(g.x=w-z,g.y=r+z,b.x=w+u):(g.x=w+z,g.y=r+z,b.x=w-u),b.y=r-u));if(K.$(v,w)&&K.$(w,y)||K.$(p,r)&&K.$(r,q))v=.5*(v+y),p=.5*(p+q),g.x=v,g.y=p,b.x=v,b.y=p;1===n?(e.x=.5*(c.x+l.x),e.y=.5*(c.y+l.y)):2===n&&K.$(c.x,this.i(0).x)&&K.$(c.y,this.i(0).y)&&(e.x=.5*(c.x+l.x),e.y=.5*(c.y+l.y));Md(h,e.x-d,e.y-k,g.x-d,g.y-
k,l.x-d,l.y-k);f.set(g);e.set(b);c=l}}f=c.x;c=c.y;e=this.i(this.pointsCount-1);0!==this.computeShortLength(!1)&&(e=zp(this,e.copy(),!1,Hb));f=.5*(f+e.x);c=.5*(c+e.y);Md(h,b.x-d,b.y-k,f-d,c-k,e.x-d,e.y-k)}else for(c=3;c<b;c+=3)f=this.i(c-2),c+3>=b&&(c=b-1),e=this.i(c-1),g=this.i(c),c===b-1&&0!==this.computeShortLength(!1)&&(g=zp(this,g.copy(),!1,Hb)),Md(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=Ap(this,
f,n,1<n);m=this.i(n);if(n>=b-1){if(!f.w(m))0!==this.computeShortLength(!1)&&(m=zp(this,m.copy(),!1,Hb)),Cp(this,h,-d,-k,f,m,c);else if(0===l)for(n=1;n<b;)e.assign(f),m=this.i(n++),Cp(this,h,-d,-k,f,m,c),f.assign(m);break}l=Ap(this,m,n+1,n<b-3);n=-d;v=-k;p=m;u=this.i(l);w=c;if(K.A(f.y,p.y)&&K.A(p.x,u.x))if(r=Math.min(g,Math.abs(p.x-e.x)/2),r=y=Math.min(r,Math.abs(u.y-p.y)/2),K.A(r,0))Cp(this,h,n,v,f,p,w),f.assign(p);else{q=p.x;z=p.y;var A=q,C=z;p.x>f.x?q=p.x-r:q=p.x+r;u.y>p.y?C=p.y+y:C=p.y-y;Cp(this,
h,n,v,f,new J(q,z),w);Rd(h,p.x+n,p.y+v,A+n,C+v);f.h(A,C)}else K.A(f.x,p.x)&&K.A(p.y,u.y)?(r=Math.min(g,Math.abs(p.y-e.y)/2),r=y=Math.min(r,Math.abs(u.x-p.x)/2),K.A(y,0)?(Cp(this,h,n,v,f,p,w),f.assign(p)):(q=p.x,z=p.y,A=q,C=z,p.y>f.y?z=p.y-r:z=p.y+r,u.x>p.x?A=p.x+y:A=p.x-y,Cp(this,h,n,v,f,new J(q,z),w),Rd(h,p.x+n,p.y+v,A+n,C+v),f.h(A,C))):(Cp(this,h,n,v,f,p,w),f.assign(p));e.assign(m);n=l}J.free(f)}Ud=h}else h=this.i(1).copy(),h.x-=d,h.y-=k,0!==this.computeShortLength(!0)&&(e=zp(this,e,!0,f)),0!==
this.computeShortLength(!1)&&(h=zp(this,h,!1,f)),a.type=wd,a.startX=e.x,a.startY=e.y,a.endX=h.x,a.endY=h.y;this.Ym=!0;return a};function Bp(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 zp(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=Bp(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=Bp(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 Ap(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}
function Cp(a,b,c,d,e,f,g){if(!g&&gp(a)){g=[];var h=0;a.isVisible()&&(h=Dp(a,e,f,g));if(0<h)if(K.A(e.y,f.y))if(e.x<f.x)for(var k=0;k<h;){var l=Math.max(e.x,Math.min(g[k++]-5,f.x-10));b.lineTo(l+c,f.y+d);var m=l+c;for(var n=Math.min(l+10,f.x);k<h;)if(l=g[k],l<n+10)k++,n=Math.min(l+5,f.x);else break;l=f.y-10+d;n+=c;var p=f.y+d;a.curve===ag?Ld(b,n,p,!1):Md(b,m,l,n,l,n,p)}else for(--h;0<=h;){k=Math.min(e.x,Math.max(g[h--]+5,f.x+10));b.lineTo(k+c,f.y+d);m=k+c;for(l=Math.max(k-10,f.x);0<=h;)if(k=g[h],k>
l-10)h--,l=Math.max(k-5,f.x);else break;k=f.y-10+d;l+=c;n=f.y+d;a.curve===ag?Ld(b,l,n,!1):Md(b,m,k,l,k,l,n)}else if(K.A(e.x,f.x))if(e.y<f.y)for(k=0;k<h;){l=Math.max(e.y,Math.min(g[k++]-5,f.y-10));b.lineTo(f.x+c,l+d);m=l+d;for(l=Math.min(l+10,f.y);k<h;)if(n=g[k],n<l+10)k++,l=Math.min(n+5,f.y);else break;n=f.x-10+c;p=f.x+c;l+=d;a.curve===ag?Ld(b,p,l,!1):Md(b,n,m,n,l,p,l)}else for(--h;0<=h;){k=Math.min(e.y,Math.max(g[h--]+5,f.y+10));b.lineTo(f.x+c,k+d);m=k+d;for(k=Math.max(k-10,f.y);0<=h;)if(l=g[h],
l>k-10)h--,k=Math.max(l-5,f.y);else break;l=f.x-10+c;n=f.x+c;k+=d;a.curve===ag?Ld(b,n,k,!1):Md(b,l,m,l,k,n,k)}}b.lineTo(f.x+c,f.y+d)}
function Dp(a,b,c,d){var e=a.diagram;if(null===e||b.w(c))return 0;for(e=e.layers;e.next();){var f=e.value;if(null!==f&&f.visible){f=f.Da.j;for(var g=f.length,h=0;h<g;h++){var k=f[h];if(k instanceof S){if(k===a)return 0<d.length&&d.sort(function(a,b){return a-b}),d.length;if(k.isVisible()&&gp(k)){var l=k.routeBounds;l.u()&&a.routeBounds.Lc(l)&&!a.usesSamePort(k)&&(l=k.path,null!==l&&l.Ff()&&Ep(b,c,d,k))}}}}}0<d.length&&d.sort(function(a,b){return a-b});return d.length}
function Ep(a,b,c,d){for(var e=K.A(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,v=l.y;if(!K.A(m,p)){if(K.A(n,r)&&K.A(q,u)&&Math.min(m,p)<q&&Math.max(m,p)>q&&Math.min(g,v)<n&&Math.max(g,v)>n&&!K.A(g,v)){h.x=q;h.y=n;m=!0;break a}}else if(!K.A(n,r)&&
K.A(g,v)&&Math.min(n,r)<g&&Math.max(n,r)>g&&Math.min(q,u)<m&&Math.max(q,u)>m&&!K.A(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 gp(a){a=a.curve;return a===$f||a===ag}function kp(a,b){if(b||gp(a))b=a.diagram,null===b||b.animationManager.isTicking||b.Vg.contains(a)||0===a.Rl.width&&0===a.Rl.height||b.Vg.add(a,a.Rl.copy())}
S.prototype.Nq=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.Da.j;for(var g=e.length,h=0;h<g;h++){var k=e[h];k instanceof S&&(k===this?f=!0:f&&Fp(this,k,a))}}else if(d)for(f=e.Da.j,e=f.length,g=0;g<e;g++)h=f[g],h instanceof S&&Fp(this,h,a)}}}};
function Fp(a,b,c){if(null!==b&&b.Ym&&b.dd&&gp(b)){var d=b.routeBounds;d.u()&&(a.routeBounds.Lc(d)||c.Lc(d))&&(a.usesSamePort(b)||b.cc())}}S.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.Na(e))return!0;b=this.i(b-1);a=a.i(c-1);if(b.Na(a)||d.Na(a)||b.Na(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};
S.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};S.prototype.Ob=function(a){U.prototype.Ob.call(this,a);null!==this.Lf&&this.Lf.ym();if(null!==this.hd)for(var b=this.hd.iterator;b.next();)b.value.Ob(a)};S.prototype.computeAdjusting=function(){return this.isAvoiding&&null!==this.diagram&&this.diagram.animationManager.isAnimating?cp:this.Rk};
function hp(a){var b=a.Ve;if(null!==b){var c=a.rf;if(null!==c){for(var d=a.We,e=a.sf,f=a=null,g=b.Ya.j,h=g.length,k=0;k<h;k++){var l=g[k];if(l.Ve===b&&l.We===d&&l.rf===c&&l.sf===e||l.Ve===c&&l.We===e&&l.rf===b&&l.sf===d)null===f?f=l:(null===a&&(a=[],a.push(f)),a.push(l))}if(null!==a){f=No(b,c,d,e);null===f&&(f=new Gp(b,d,c,e),Mo(b,f),Mo(c,f));f.links=a;for(b=0;b<a.length;b++)a[b].Lf=f;f.ym()}}}}function ip(a){var b=a.Lf;null!==b&&(a.Lf=null,a=b.links.indexOf(a),0<=a&&(Da(b.links,a),b.ym()))}
S.prototype.Ph=function(){return!0};
ma.Object.defineProperties(S.prototype,{fromNode:{get:function(){return this.Ve},set:function(a){var b=this.Ve;if(b!==a){var c=this.fromPort;null!==b&&(this.rf!==b&&Ro(b,this,c),ip(this),this.C(2));this.Ve=a;null!==a&&this.Ob(a.isVisible());this.Uf=null;this.Ua();var d=this.diagram;null!==d&&d.Z&&d.partManager.setFromNodeForLink(this,a,b);var e=this.fromPort,f=this.fromPortChanged;if(null!==f){var g=!0;null!==d&&(g=d.Z,d.Z=!0);f(this,c,e);null!==d&&(d.Z=g)}null!==a&&
(this.rf!==a&&Qo(a,this,e),hp(this),this.C(1));this.g("fromNode",b,a);Ko(this)}}},fromPortId:{get:function(){return this.We},set:function(a){var b=this.We;if(b!==a){var c=this.fromPort;null!==c&&Oo(this.fromNode,c);ip(this);this.We=a;var d=this.fromPort;null!==d&&Oo(this.fromNode,d);var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.pj()&&g.Bw(f,a)}c!==d&&(this.Uf=null,this.Ua(),f=this.fromPortChanged,null!==f&&(g=!0,null!==e&&(g=e.Z,e.Z=!0),f(this,
c,d),null!==e&&(e.Z=g)));hp(this);this.g("fromPortId",b,a)}}},fromPort:{get:function(){var a=this.Ve;return null===a?null:a.Kt(this.We)}},fromPortChanged:{get:function(){return this.eo},set:function(a){var b=this.eo;b!==a&&(this.eo=a,this.g("fromPortChanged",b,a))}},toNode:{get:function(){return this.rf},set:function(a){var b=this.rf;if(b!==a){var c=this.toPort;null!==b&&(this.Ve!==b&&Ro(b,this,c),ip(this),this.C(2));
this.rf=a;null!==a&&this.Ob(a.isVisible());this.Uf=null;this.Ua();var d=this.diagram;null!==d&&d.Z&&d.partManager.setToNodeForLink(this,a,b);var e=this.toPort,f=this.toPortChanged;if(null!==f){var g=!0;null!==d&&(g=d.Z,d.Z=!0);f(this,c,e);null!==d&&(d.Z=g)}null!==a&&(this.Ve!==a&&Qo(a,this,e),hp(this),this.C(1));this.g("toNode",b,a);Ko(this)}}},toPortId:{get:function(){return this.sf},set:function(a){var b=this.sf;if(b!==a){var c=this.toPort;null!==c&&Oo(this.toNode,
c);ip(this);this.sf=a;var d=this.toPort;null!==d&&Oo(this.toNode,d);var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.pj()&&g.Gw(f,a)}c!==d&&(this.Uf=null,this.Ua(),f=this.toPortChanged,null!==f&&(g=!0,null!==e&&(g=e.Z,e.Z=!0),f(this,c,d),null!==e&&(e.Z=g)));hp(this);this.g("toPortId",b,a)}}},toPort:{get:function(){var a=this.rf;return null===a?null:a.Kt(this.sf)}},toPortChanged:{get:function(){return this.kq},set:function(a){var b=
this.kq;b!==a&&(this.kq=a,this.g("toPortChanged",b,a))}},fromSpot:{get:function(){return null!==this.O?this.O.ah:ad},set:function(a){this.Jc();var b=this.O.ah;if(!b.w(a)){a=a.G();this.O.ah=a;this.g("fromSpot",b,a);if(b.Mc()||a.Mc())a=this.fromNode,null!==a&&Oo(a,this.fromPort);this.Ua()}}},fromEndSegmentLength:{get:function(){return null!==this.O?this.O.Zg:NaN},set:function(a){this.Jc();var b=this.O.Zg;b!==a&&(0>a&&va(a,">= 0",S,"fromEndSegmentLength"),
this.O.Zg=a,this.g("fromEndSegmentLength",b,a),this.Ua())}},fromShortLength:{get:function(){return null!==this.O?this.O.$g:NaN},set:function(a){this.Jc();var b=this.O.$g;b!==a&&(this.O.$g=a,this.cc(),this.g("fromShortLength",b,a))}},toSpot:{get:function(){return null!==this.O?this.O.Ch:ad},set:function(a){this.Jc();var b=this.O.Ch;if(!b.w(a)){a=a.G();this.O.Ch=a;this.g("toSpot",b,a);if(b.Mc()||a.Mc())a=this.toNode,null!==a&&Oo(a,this.toPort);
this.Ua()}}},toEndSegmentLength:{get:function(){return null!==this.O?this.O.Ah:NaN},set:function(a){this.Jc();var b=this.O.Ah;b!==a&&(0>a&&va(a,">= 0",S,"toEndSegmentLength"),this.O.Ah=a,this.g("toEndSegmentLength",b,a),this.Ua())}},toShortLength:{get:function(){return null!==this.O?this.O.Bh:NaN},set:function(a){this.Jc();var b=this.O.Bh;b!==a&&(this.O.Bh=a,this.cc(),this.g("toShortLength",b,a))}},isLabeledLink:{
get:function(){return null===this.hd?!1:0<this.hd.count}},labelNodes:{get:function(){return null===this.hd?gb:this.hd.iterator}},relinkableFrom:{get:function(){return 0!==(this.Fa&1)},set:function(a){var b=0!==(this.Fa&1);b!==a&&(this.Fa^=1,this.g("relinkableFrom",b,a),this.Lb())}},relinkableTo:{get:function(){return 0!==(this.Fa&2)},set:function(a){var b=0!==(this.Fa&2);b!==a&&(this.Fa^=2,this.g("relinkableTo",
b,a),this.Lb())}},resegmentable:{get:function(){return 0!==(this.Fa&4)},set:function(a){var b=0!==(this.Fa&4);b!==a&&(this.Fa^=4,this.g("resegmentable",b,a),this.Lb())}},isTreeLink:{get:function(){return 0!==(this.Fa&8)},set:function(a){var b=0!==(this.Fa&8);b!==a&&(this.Fa^=8,this.g("isTreeLink",b,a),null!==this.fromNode&&Ek(this.fromNode),null!==this.toNode&&Ek(this.toNode))}},path:{get:function(){var a=this.pb();
return a instanceof W?a:null}},routeBounds:{get:function(){this.wj();var a=this.Rl,b=Infinity,c=Infinity,d=this.pointsCount;if(0===d)a.h(NaN,NaN,0,0);else{if(1===d)d=this.i(0),b=Math.min(d.x,b),c=Math.min(d.y,c),a.h(d.x,d.y,0,0);else if(2===d){d=this.i(0);var e=this.i(1);b=Math.min(d.x,e.x);c=Math.min(d.y,e.y);a.h(d.x,d.y,0,0);a.Me(e)}else if(this.computeCurve()===pg&&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.pm(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.pm(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.Me(f),e=2;e<d;e++)f=this.i(e),b=Math.min(f.x,b),c=Math.min(f.y,c),a.Me(f);this.vv.h(b-a.x,c-a.y)}return a}},midPoint:{
get:function(){this.wj();return this.computeMidPoint(new J)}},midAngle:{get:function(){this.wj();return this.computeMidAngle()}},flattenedLengths:{get:function(){if(null===this.cs){this.dd||jp(this);for(var a=this.cs=[],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.Fe(e));a.push(d)}}return this.cs}},flattenedTotalLength:{
get:function(){var a=this.Pu;if(isNaN(a)){for(var b=this.flattenedLengths,c=b.length,d=a=0;d<c;d++)a+=b[d];this.Pu=a}return a}},points:{get:function(){return this.Ab},set:function(a){var b=this.Ab;if(b!==a){var c=null;if(Array.isArray(a)){var d=0===a.length%2;if(d)for(var e=0;e<a.length;e++)if("number"!==typeof a[e]||isNaN(a[e])){d=!1;break}if(d)for(c=new E,d=0;d<a.length/2;d++)e=(new 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(!ya(f)||"number"!==typeof f.x||isNaN(f.x)||"number"!==typeof f.y||isNaN(f.y)){d=!1;break}}if(d)for(c=new E,d=0;d<a.length;d++)e=a[d],c.add((new J(e.x,e.y)).freeze())}}else if(a instanceof E)for(c=a.copy(),a=c.iterator;a.next();)a.value.freeze();else B("Link.points value is not an instance of List or Array: "+a);c.freeze();this.Ab=c;this.cc();jp(this);a=this.diagram;null!==a&&(a.oj||a.undoManager.isUndoingRedoing||a.Xt.add(this),a.animationManager.rc&&(this.qg=c));this.g("points",b,c)}}},pointsCount:{
get:function(){return this.Ab.count}},dd:{get:function(){return 0!==(this.Fa&16)},set:function(a){0!==(this.Fa&16)!==a&&(this.Fa^=16)}},suspendsRouting:{get:function(){return 0!==(this.Fa&32)},set:function(a){0!==(this.Fa&32)!==a&&(this.Fa^=32)}},Ct:{get:function(){return 0!==(this.Fa&64)},set:function(a){0!==(this.Fa&64)!==a&&(this.Fa^=64)}},defaultFromPoint:{get:function(){return this.v},
set:function(a){this.v=a.copy()}},defaultToPoint:{get:function(){return this.I},set:function(a){this.I=a.copy()}},isOrthogonal:{get:function(){return 2===(this.$j.value&2)}},isAvoiding:{get:function(){return 4===(this.$j.value&4)}},Ym:{get:function(){return 0!==(this.Fa&128)},set:function(a){0!==(this.Fa&128)!==a&&(this.Fa^=128)}},geometry:{get:function(){this.Ym||
(this.wj(),this.na=this.makeGeometry());return this.na}},firstPickIndex:{get:function(){return 2>=this.pointsCount?0:this.isOrthogonal||!lp(this.computeSpot(!0))?1:0}},lastPickIndex:{get:function(){var a=this.pointsCount;return 0===a?0:2>=a?a-1:this.isOrthogonal||!lp(this.computeSpot(!1))?a-2:a-1}},adjusting:{get:function(){return this.Rk},set:function(a){var b=this.Rk;b!==a&&(this.Rk=a,this.g("adjusting",b,
a))}},corner:{get:function(){return this.Gn},set:function(a){var b=this.Gn;b!==a&&(this.Gn=a,this.cc(),this.g("corner",b,a))}},curve:{get:function(){return this.In},set:function(a){var b=this.In;b!==a&&(this.In=a,this.Ua(),this.cc(),kp(this,b===ag||b===$f||a===ag||a===$f),this.g("curve",b,a))}},curviness:{get:function(){return this.Jn},set:function(a){var b=this.Jn;b!==a&&(this.Jn=a,this.Ua(),this.cc(),this.g("curviness",
b,a))}},routing:{get:function(){return this.$j},set:function(a){var b=this.$j;b!==a&&(this.$j=a,this.Uf=null,this.Ua(),kp(this,2===(b.value&2)||2===(a.value&2)),this.g("routing",b,a))}},smoothness:{get:function(){return this.Xp},set:function(a){var b=this.Xp;b!==a&&(this.Xp=a,this.cc(),this.g("smoothness",b,a))}},key:{get:function(){var a=this.diagram;if(null!==a&&a.model.pj())return a.model.Vb(this.data)}}});
S.prototype.invalidateOtherJumpOvers=S.prototype.Nq;S.prototype.findClosestSegment=S.prototype.Nz;S.prototype.updateRoute=S.prototype.wj;S.prototype.invalidateRoute=S.prototype.Ua;S.prototype.rollbackRoute=S.prototype.xw;S.prototype.commitRoute=S.prototype.xf;S.prototype.startRoute=S.prototype.Th;S.prototype.clearPoints=S.prototype.lk;S.prototype.removePoint=S.prototype.sw;S.prototype.addPointAt=S.prototype.vf;S.prototype.addPoint=S.prototype.Be;S.prototype.insertPointAt=S.prototype.m;
S.prototype.insertPoint=S.prototype.rA;S.prototype.setPointAt=S.prototype.K;S.prototype.setPoint=S.prototype.od;S.prototype.getPoint=S.prototype.i;S.prototype.getOtherPort=S.prototype.iA;S.prototype.getOtherNode=S.prototype.Iq;
var bp=new D(S,"Normal",1),Hp=new D(S,"Orthogonal",2),Ip=new D(S,"AvoidsNodes",6),qp=new D(S,"AvoidsNodesStraight",7),bg=new D(S,"None",0),pg=new D(S,"Bezier",9),ag=new D(S,"JumpGap",10),$f=new D(S,"JumpOver",11),cp=new D(S,"End",17),dp=new D(S,"Scale",18),ep=new D(S,"Stretch",19),Um=new D(S,"OrientAlong",21),Nm=new D(S,"OrientPlus90",22),Pm=new D(S,"OrientMinus90",23),fp=new D(S,"OrientOpposite",24),Vm=new D(S,"OrientUpright",25),Om=new D(S,"OrientPlus90Upright",26),Qm=new D(S,"OrientMinus90Upright",
27),Rm=new D(S,"OrientUpright45",28),sp=16,rp=14,tp=8;S.className="Link";S.Normal=bp;S.Orthogonal=Hp;S.AvoidsNodes=Ip;S.AvoidsNodesStraight=qp;S.None=bg;S.Bezier=pg;S.JumpGap=ag;S.JumpOver=$f;S.End=cp;S.Scale=dp;S.Stretch=ep;S.OrientAlong=Um;S.OrientPlus90=Nm;S.OrientMinus90=Pm;S.OrientOpposite=fp;S.OrientUpright=Vm;S.OrientPlus90Upright=Om;S.OrientMinus90Upright=Qm;S.OrientUpright45=Rm;S.EndSegmentStep=8;S.CurvinessStart=sp;S.SpacingMin=rp;S.OrthoShortCut=tp;S.AvoidanceCell=8;S.AvoidanceLimit=999;
function Gp(a,b,c,d){Ya(this);this.oe=this.ks=!1;this.$t=a;this.Jy=b;this.jw=c;this.Ky=d;this.links=[]}Gp.prototype.ym=function(){if(!this.ks){var a=this.links;0<a.length&&(a=a[0].diagram,null!==a&&(a.Ru.add(this),this.oe=a.undoManager.isUndoingRedoing))}this.ks=!0};
Gp.prototype.Tw=function(){if(this.ks){this.ks=!1;var a=this.links;if(0<a.length){var b=a[0],c=b.diagram;c=null===c||c.oj&&!this.oe;this.oe=!1;b.arrangeBundledLinks(a,c);1===a.length&&(b.Lf=null,a.length=0)}0===a.length&&(a=this.$t,null!==this&&null!==a.Re&&a.Re.remove(this),a=this.jw,null!==this&&null!==a.Re&&a.Re.remove(this))}};Gp.className="LinkBundle";
function uk(){Ya(this);this.Sy=this.group=null;this.Rt=!0;this.abort=!1;this.wd=this.vd=1;this.Oo=this.No=-1;this.fc=this.ec=8;this.Qb=null;this.$i=this.Zi=0;this.Ty=11;this.Dy=124}
uk.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.vd=Math.floor((a.x-this.ec)/this.ec)*this.ec;this.wd=Math.floor((b-this.fc)/this.fc)*this.fc;this.No=Math.ceil((c+2*this.ec)/this.ec)*this.ec;this.Oo=Math.ceil((d+2*this.fc)/this.fc)*this.fc;a=1+(Math.ceil((this.No-this.vd)/this.ec)|0);b=1+(Math.ceil((this.Oo-this.wd)/this.fc)|0);if(null===this.Qb||this.Zi<a-1||this.$i<b-1){c=[];for(d=0;d<=a;d++)c[d]=new Uint32Array(b);this.Qb=c;this.Zi=
a-1;this.$i=b-1}a=Jp;if(null!==this.Qb)for(b=0;b<=this.Zi;b++)if(c=this.Qb[b],c.fill)c.fill(a);else for(d=0;d<=this.$i;d++)c[d]=a}};function xk(a,b,c){return a.vd<=b&&b<=a.No&&a.wd<=c&&c<=a.Oo}function vp(a,b,c){if(!xk(a,b,c))return Jp;b-=a.vd;b/=a.ec;c-=a.wd;c/=a.fc;return a.Qb[b|0][c|0]}function wk(a){if(null!==a.Qb)for(var b=0;b<=a.Zi;b++)for(var c=a.Qb[b],d=0;d<=a.$i;d++)c[d]>=yp&&(c[d]=Jp)}
uk.prototype.zk=function(a,b,c,d){if(a>this.No||a+c<this.vd||b>this.Oo||b+d<this.wd)return!0;a=(a-this.vd)/this.ec|0;b=(b-this.wd)/this.fc|0;c=Math.max(0,c)/this.ec+1|0;var e=Math.max(0,d)/this.fc+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.Zi)|0;for(c=Math.min(b+e-1,this.$i)|0;a<=d;a++){e=this.Qb[a];for(var f=b;f<=c;f++)if(e[f]===yk)return!1}return!0};
function Kp(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.Qb[l][m];if(n>=yp&&n<wp)for(e?m+=d:l+=d,n+=1;f<=l&&l<=g&&h<=m&&m<=k&&!(n>=a.Qb[l][m]);)a.Qb[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)Kp(a,b,c,1,!e,f,g,h,k),Kp(a,b,c,-1,!e,f,g,h,k);else for(c+=d;c>l;c+=d)Kp(a,b,c,1,!e,f,g,h,k),Kp(a,b,c,-1,!e,f,g,h,k);else if(0<d)for(b+=d;b<l;b+=d)Kp(a,b,c,1,!e,f,g,h,k),Kp(a,b,c,-1,!e,f,g,h,k);else for(b+=d;b>l;b+=d)Kp(a,b,c,1,!e,f,g,h,k),Kp(a,b,c,-1,!e,f,g,h,
k)}}function Lp(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=yk,m=yp;for(a.Qb[b][c]=m;l===yk&&b>f&&b<g&&c>h&&c<k;)m+=1,a.Qb[b][c]=m,e?c+=d:b+=d,l=a.Qb[b][c]}function Mp(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=yk,m=wp;for(a.Qb[b][c]=m;l===yk&&b>f&&b<g&&c>h&&c<k;)a.Qb[b][c]=m,e?c+=d:b+=d,l=a.Qb[b][c]}
function up(a,b,c,d,e,f,g){if(null!==a.Qb){a.abort=!1;var h=b.x,k=b.y;if(xk(a,h,k)){h-=a.vd;h/=a.ec;k-=a.wd;k/=a.fc;var l=d.x,m=d.y;if(xk(a,l,m))if(l-=a.vd,l/=a.ec,m-=a.wd,m/=a.fc,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.vd;n/=a.ec;d-=a.wd;d/=a.fc;b-=a.vd;b/=a.ec;p-=a.wd;p/=a.fc;f=Math.max(0,Math.min(a.Zi,n|0));b=Math.min(a.Zi,Math.max(0,b|0));n=Math.max(0,Math.min(a.$i,d|0));p=Math.min(a.$i,Math.max(0,p|0));d=a.Qb;h|=0;k|=0;l|=0;m|=
0;var r=0===c||90===c?1:-1;c=90===c||270===c;d[h][k]===yk?(Lp(a,h,k,r,c,f,b,n,p),Lp(a,h,k,1,!c,f,b,n,p),Lp(a,h,k,-1,!c,f,b,n,p)):Lp(a,h,k,r,c,h,k,h,k);d[l][m]===yk?(Mp(a,l,m,0===e||90===e?1:-1,90===e||270===e,f,b,n,p),Mp(a,l,m,1,!(90===e||270===e),f,b,n,p),Mp(a,l,m,-1,!(90===e||270===e),f,b,n,p)):Mp(a,l,m,r,c,l,m,l,m);c=Ea();if(g&&Np(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=yp;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 Kp(a,h,k,1,!1,f,b,n,p),Kp(a,h,k,-1,!1,f,b,n,p),Kp(a,h,k,1,!0,f,b,n,p),Kp(a,h,k,-1,!0,f,b,n,p);Ha(c)}}}}
function Np(a,b,c,d,e,f,g){for(var h=a.Qb,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===Op)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!==Op){g.push(k);g.push(l);if(Np(a,k,l,
m,e,f,g))return!0;g.pop();g.pop()}h[k][l]=Op;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(uk.prototype,{bounds:{get:function(){return new N(this.vd,this.wd,this.No-this.vd,this.Oo-this.wd)}},xq:{get:function(){return this.ec},set:function(a){0<a&&a!==this.ec&&(this.ec=a,this.initialize(this.bounds))}},wq:{get:function(){return this.fc},set:function(a){0<a&&a!==this.fc&&(this.fc=a,this.initialize(this.bounds))}}});var yk=0,yp=1,wp=999999,Jp=wp+1,Op=wp+2;uk.className="PositionArray";
function op(){Ya(this);this.port=this.node=null;this.$d=[];this.Sq=!1}op.prototype.toString=function(){for(var a=this.$d,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 Pp(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}op.prototype.ym=function(){this.$d.length=0};
function pp(a,b){var c=a.$d;if(0===c.length){a:if(!a.Sq){c=a.Sq;a.Sq=!0;var d=null,e=a.node,f=e instanceof vf?e:null;if(null===f||f.isSubGraphExpanded)var g=e.isTreeExpanded?e.findLinksConnected(a.port.portId):e.my();else{if(!f.actualBounds.u()){a.Sq=c;break a}d=f;g=d.Qv()}f=a.$d.length=0;var h=a.port.ga(wc,J.alloc()),k=a.port.ga(Hc,J.alloc());e=N.allocAt(h.x,h.y,0,0);e.Me(k);J.free(h);J.free(k);h=J.allocAt(e.x+e.width/2,e.y+e.height/2);k=a.port.lj();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.Cd(d),n=l.computeSpot(m,a.port);if(n.Mc()&&(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.Sa(m);p-=k;0>p?p+=360:360<=p&&(p-=360);n=Pp(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.$d[f];void 0===r?(r=new Qp(l,p,n),a.$d[f]=r):(r.link=l,r.angle=p,r.Ac=
n);r.lw.set(m);f++}}}}J.free(h);a.$d.sort(op.prototype.l);k=a.$d.length;d=-1;for(f=h=0;f<k;f++)g=a.$d[f],void 0!==g&&(g.Ac!==d&&(d=g.Ac,h=0),g.Jq=h,h++);d=-1;h=0;for(f=k-1;0<=f;f--)k=a.$d[f],void 0!==k&&(k.Ac!==d&&(d=k.Ac,h=k.Jq+1),k.qm=h);f=a.$d;n=a.port;d=a.node.portSpreading;h=J.alloc();k=J.alloc();g=J.alloc();l=J.alloc();n.ga(wc,h);n.ga(zc,k);n.ga(Hc,g);n.ga(Dc,l);r=p=m=n=0;if(d===Zo)for(var q=0;q<f.length;q++){var u=f[q];if(null!==u){var v=u.link.computeThickness();switch(u.Ac){case 8:p+=v;break;
case 2:r+=v;break;case 1:n+=v;break;default:case 4:m+=v}}}var w=q=0,y=1,z=u=0;for(v=0;v<f.length;v++){var A=f[v];if(null!==A){if(q!==A.Ac){q=A.Ac;switch(q){case 8:var C=g;w=l;break;case 2:C=l;w=h;break;case 1:C=h;w=k;break;default:case 4:C=k,w=g}u=w.x-C.x;z=w.y-C.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}w=0}var G=A.Qq;if(d===Zo){A=A.link.computeThickness();A*=y;G.set(C);switch(q){case 8:G.x=C.x+u/2+p/2-w-A/2;break;case 2:G.y=C.y+z/2+r/2-w-A/2;break;case 1:G.x=C.x+u/2-n/2+w+A/2;break;default:case 4:G.y=C.y+z/2-m/2+w+A/2}w+=A}else{var L=.5;d===Lo&&(L=(A.Jq+1)/(A.qm+1));G.x=C.x+u*L;G.y=C.y+z*L}}}J.free(h);J.free(k);J.free(g);J.free(l);C=a.$d;for(f=0;f<C.length;f++)d=C[f],null!==d&&(d.Ov=a.computeEndSegmentLength(d));a.Sq=c;N.free(e)}c=a.$d}for(a=0;a<c.length;a++)if(e=c[a],null!==
e&&e.link===b)return e;return null}op.prototype.l=function(a,b){return a===b?0:null===a?-1:null===b?1:a.Ac<b.Ac?-1:a.Ac>b.Ac?1:a.angle<b.angle?-1:a.angle>b.angle?1:0};
op.prototype.computeEndSegmentLength=function(a){var b=a.link,c=b.computeEndSegmentLength(this.node,this.port,vc,b.fromPort===this.port),d=a.Jq;if(0>d)return c;var e=a.qm;if(1>=e||!b.isOrthogonal)return c;b=a.lw;var f=a.Qq;if(2===a.Ac||8===a.Ac)d=e-1-d;return((a=2===a.Ac||4===a.Ac)?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)};op.className="Knot";function Qp(a,b,c){this.link=a;this.angle=b;this.Ac=c;this.lw=new J;this.qm=this.Jq=0;this.Qq=new J;this.Ov=0}
Qp.prototype.toString=function(){return this.link.toString()+" "+this.angle.toString()+" "+this.Ac.toString()+":"+this.Jq.toString()+"/"+this.qm.toString()+" "+this.Qq.toString()+" "+this.Ov.toString()+" "+this.lw.toString()};Qp.className="LinkInfo";function dl(){this.Ch=this.ah=ad;this.Bh=this.$g=this.Ah=this.Zg=NaN;this.iq=this.bo=null;this.jq=this.co=Infinity}
dl.prototype.copy=function(){var a=new dl;a.ah=this.ah.G();a.Ch=this.Ch.G();a.Zg=this.Zg;a.Ah=this.Ah;a.$g=this.$g;a.Bh=this.Bh;a.bo=this.bo;a.iq=this.iq;a.co=this.co;a.jq=this.jq;return a};dl.className="LinkSettings";function yi(){Ya(this);this.v=this.B=null;this.yi=this.to=!0;this.yo=!1;this.mn=(new J(0,0)).freeze();this.vo=!0;this.un=this.uo=null;this.xo=!1;this.l=null;this.I=0;this.Po=this.oq=null;this.wt=!1;this.yg=this.bk=null;this.lt=!1}
yi.prototype.cloneProtected=function(a){a.to=this.to;a.yi=this.yi;a.yo=this.yo;a.mn.assign(this.mn);a.vo=this.vo;a.uo=this.uo;a.un=this.un;a.xo=!0;a.Po=this.Po;a.oq=this.oq};yi.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};yi.prototype.serializeLayoutProperties=function(a){a.arrangementOrigin={x:this.arrangementOrigin.x,y:this.arrangementOrigin.y};a.isRouting=this.isRouting};
yi.prototype.deserializeLayoutProperties=function(a){null!==a&&(this.arrangementOrigin=new J(a.arrangementOrigin.x,a.arrangementOrigin.y),this.isRouting=a.isRouting)};yi.prototype.hb=function(){};yi.prototype.toString=function(){var a=Ia(this.constructor);a+="(";null!==this.group&&(a+=" in "+this.group);null!==this.diagram&&(a+=" for "+this.diagram);return a+")"};
yi.prototype.C=function(){if(this.isValidLayout){var a=this.diagram;if(null!==a&&!a.undoManager.isUndoingRedoing){var b=a.animationManager;!b.isTicking&&(b.defaultAnimation.isAnimating&&b.Nc(),this.isOngoing&&a.oj||this.isInitial&&!a.oj)&&(this.isValidLayout=!1,a.Db())}}};yi.prototype.createNetwork=function(){return new Rp(this)};yi.prototype.makeNetwork=function(a){var b=this.createNetwork();a instanceof Q?(b.Ag(a.nodes,!0),b.Ag(a.links,!0)):a instanceof vf?b.Ag(a.memberParts):b.Ag(a.iterator);return b};
yi.prototype.updateParts=function(){this.isValidLayout=!0;if(!this.workerLayout()){var a=this.diagram;if(null===a&&null!==this.network)for(var b=this.network.vertexes.iterator;b.next();){var c=b.value.node;if(null!==c&&(a=c.diagram,null!==a))break}try{null!==a&&a.va("Layout"),this.commitLayout()}finally{null!==a&&a.Wa("Layout")}}};yi.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()}};
yi.prototype.doLayout=function(a){var b=new F;a instanceof Q?(Sp(this,b,a.nodes,!0,this.Rh,!0,!1,!0),Sp(this,b,a.parts,!0,this.Rh,!0,!1,!0)):a instanceof vf?Sp(this,b,a.memberParts,!1,this.Rh,!0,!1,!0):b.addAll(a.iterator);0<b.count&&(a=this.diagram,null!==a&&a.va("Layout"),this.doMinimalNoNetworkLayout(b),null!==a&&a.Wa("Layout"));this.isValidLayout=!0};
yi.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;Tp(h);var k=h.measuredBounds,l=k.width;k=k.height;h.moveTo(d,e);h instanceof vf&&(h.Rh=!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++}};
yi.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 S)&&(Tp(h),this.Rh(h))){var k=h.measuredBounds,l=k.width;k=k.height;h.moveTo(c,d);h instanceof vf&&(h.Rh=!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++}}};yi.prototype.Rh=function(a){return!a.location.u()||a instanceof vf&&a.Rh?!0:!1};function Sp(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 vf?null===k.layout?Sp(a,b,k.memberParts,!1,e,f,g,h):(Tp(k),b.add(k)):(Tp(k),b.add(k))):g&&k instanceof S?b.add(k):!h||!k.Wb()||k instanceof V||(Tp(k),b.add(k)))}}
function Tp(a){var b=a.actualBounds;(0===b.width||0===b.height||isNaN(b.width)||isNaN(b.height))&&a.Ta()}yi.prototype.mj=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};
yi.prototype.Yx=function(a){var b=new F;a instanceof Q?(Sp(this,b,a.nodes,!0,null,!0,!0,!0),Sp(this,b,a.links,!0,null,!0,!0,!0),Sp(this,b,a.parts,!0,null,!0,!0,!0)):a instanceof vf?Sp(this,b,a.memberParts,!1,null,!0,!0,!0):Sp(this,b,a.iterator,!1,null,!0,!0,!0);return b};
yi.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.ga(wc),(isNaN(c.x)||isNaN(c.y))&&c.set(a),a=b.padding,c.x+=a.left,c.y+=a.top);return c}return a};yi.prototype.mayUseWorker=function(){return this.mayUseWorkerFunction?this.mayUseWorkerFunction(this):!1};yi.prototype.workerLayout=function(){return!1};
function Up(a,b){if(null!==a.workerStateChanged){var c={key:a.group?a.group.key:null};void 0!==b&&(c.time=b);null!==a.bk&&(c.running=Vp(a.bk));null!==a.yg&&(c.waiting=Vp(a.yg));a.workerStateChanged(c,a)}}function Vp(a){return{vertexes:a.vertexes.count,edges:a.edges.count}}yi.prototype.uz=function(){var a=Wp(this.constructor);a&&(null!==a.Ne&&a.Ne.terminate(),a.Ne=null,a.Bm.iteratorValues.each(function(a){a.wt=!1;a.bk=null;a.yg=null;a.lt=!1;Up(a)}),a.Bm.clear())};
function Xp(a,b){var c=Wp(a);if(c){if(b)for(var d in b)c[d]=b[d]}else throw Error("Unknown Layout class: "+a);}function Wp(a){var b=null;if("function"===typeof a){if(b=Yp.get(a),!b){var c=Ia(a);b=Yp.get(c);b||(b=new Zp,b.Kv=a,b.name=c,b.l=a.name,b.zy=$p,Yp.set(c,b),Yp.set(a,b),Yp.set(a.name,b))}}else"string"===typeof a&&(b=Yp.get(a));return b}
yi.prototype.Sw=function(){if("undefined"===typeof Worker||!aq||"undefined"===typeof self||"undefined"!==typeof self.DedicatedWorkerGlobalScope)return!1;if(!this.mayUseWorker())return this.wt&&(this.lt=!0,this.yg=this.bk=null,Up(this)),!1;var a=Wp(this.constructor);if(null===a)return!1;null===a.Ne&&(a.Ne=new Worker(aq),a.Ne.onerror=function(a){a.preventDefault();wa("Worker Error at: "+a.filename+" "+a.lineno+" "+a.colno+"\n  "+a.message)},a.Ne.l=function(a){wa("Worker serialization error: "+a)},a.Ne.onmessage=
function(b){var c=b.data;if("_GoJS"===c._GoJS)if(c.version)wa("GoJS v"+Q.version+"  Worker v"+c.version);else if(b=a.Bm.get(c.id)){a.Bm.remove(c.id);b.wt=!1;b.bk=null;if(b.lt)b.lt=!1,b.yg=null;else{var d=bq(b,c,!1);b.network=d;b.updateParts();b.network=null;b.isValidLayout=!0}Up(b,c.time);c=b.yg;if(null!==c)b.yg=null;else for(d=a.Bm.iteratorValues;d.next();){var e=d.value;c=e.yg;if(null!==c){e.yg=null;break}}null!==c&&cq(b,c)}},a.Ne.postMessage({_GoJS:"_GoJS",url:a.zy}),Array.isArray(a.scripts)&&
a.scripts.forEach(function(b){a.Ne.postMessage({_GoJS:"_GoJS",url:b})}),a.Ne.postMessage({_GoJS:"_GoJS",version:-1}));null!==this.bk?this.yg=this.network:cq(this,this.network);Up(this);this.doMinimalNetworkLayout();this.network=null;return this.isValidLayout=!0};function cq(a,b){a.wt=!0;var c=Wp(a.constructor),d=dq(a,b,!0);d._GoJS="_GoJS";c.Ne.postMessage(d);c.Bm.set(mb(a),a);a.bk=b}
function dq(a,b,c){a.onNetworkSerialization(1,c,b,null);var d={};a.serializeLayoutProperties(d,c);var e=[];b.vertexes.each(function(a){var b={};a.serializeVertexProperties(b,c);e.push(b)});var f=[];b.edges.each(function(a){var b={};a.serializeEdgeProperties(b,c);f.push(b)});d={id:c?mb(a):a.id,layout:Ia(a.constructor),p:d,cB:e,Lz:f};a.onNetworkSerialization(2,c,b,d);return d}
function bq(a,b,c){c&&(a.id=b.id);var d=a.diagram,e=a.createNetwork();a.onNetworkSerialization(3,c,e,b);var f=b.cB,g=new H;f&&f.forEach(function(a){var b=null;null===a.key||null===d||c||(b=d.Cb(a.key));null!==b?b=e.jk(b):(b=e.createVertex(),null!==a.key&&(b.data=b),e.Bg(b));c&&null!==b.data&&(b.data.Ci=a.key);g.set(a.id,b)});var h=b.Lz,k=new H;h&&h.forEach(function(a){var b=null;null===a.key||null===d||c||(b=d.findLinkForKey(a.key));null!==b?b=e.Tx(b):(b=e.createEdge(),null!==a.key&&(b.data=b),e.nm(b));
c&&null!==b.data&&(b.data.Ci=a.key);k.set(a.id,b)});a.deserializeLayoutProperties(b.p,g,k,c);f&&f.forEach(function(a){var b=g.get(a.id);b&&b.Aq(a,g,k,c)});h&&h.forEach(function(a){var b=k.get(a.id);b&&b.deserializeEdgeProperties(a,g,k,c)});a.onNetworkSerialization(4,c,e,b);return e}yi.prototype.onNetworkSerialization=function(){};
ma.Object.defineProperties(yi.prototype,{diagram:{get:function(){return this.B},set:function(a){this.B=a}},group:{get:function(){return this.v},set:function(a){this.v!==a&&(this.v=a,null!==a&&(this.B=a.diagram))}},isOngoing:{get:function(){return this.to},set:function(a){this.to!==a&&(this.to=a)}},isInitial:{get:function(){return this.yi},set:function(a){this.yi=a;a||(this.xo=!0)}},
isViewportSized:{get:function(){return this.yo},set:function(a){this.yo!==a&&(this.yo=a)&&this.C()}},isRouting:{get:function(){return this.vo},set:function(a){this.vo!==a&&(this.vo=a)}},isRealtime:{get:function(){return this.uo},set:function(a){this.uo!==a&&(this.uo=a)}},isValidLayout:{get:function(){return this.xo},set:function(a){this.xo!==a&&(this.xo=a,a||(a=this.diagram,null!==
a&&(a.Ng=!0)))}},network:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a,null!==a&&(a.layout=this))}},boundsComputation:{get:function(){return this.un},set:function(a){this.un!==a&&(this.un=a,this.C())}},arrangementOrigin:{get:function(){return this.mn},set:function(a){this.mn.w(a)||(this.mn.assign(a),this.C())}},id:{get:function(){return this.I},set:function(a){this.I=
a}},mayUseWorkerFunction:{get:function(){return this.Po},set:function(a){this.Po!==a&&(this.Po=a)}},workerStateChanged:{get:function(){return this.oq},set:function(a){this.oq!==a&&(this.oq=a)}}});yi.prototype.useWorker=yi.prototype.Sw;yi.declareWorkerLayout=Xp;yi.prototype.cancelWorker=yi.prototype.uz;yi.prototype.collectParts=yi.prototype.Yx;yi.prototype.getLayoutBounds=yi.prototype.mj;yi.prototype.invalidateLayout=yi.prototype.C;
var Yp=new H,$p="object"===typeof x.document&&x.document.currentScript?x.document.currentScript.src:"",aq="undefined"!==typeof URL&&"function"===typeof URL.createObjectURL&&"function"===typeof Blob?URL.createObjectURL(new Blob(["self.onmessage=function(e){if(e.data.url){\nimportScripts(e.data.url);}}"],{type:"text/javascript"})):"";yi.className="Layout";yi.GoJSScriptURL=$p;yi.declareWorkerLayout=Xp;
"undefined"!==typeof self&&"undefined"!==typeof self.DedicatedWorkerGlobalScope&&"undefined"!==typeof self&&"undefined"!==typeof self.DedicatedWorkerGlobalScope&&(self.onmessage=function(a){a=a.data;if("_GoJS"===a._GoJS)if(a.url)importScripts(a.url);else if(a.version)self.postMessage({_GoJS:"_GoJS",version:Q.version},void 0);else{var b=performance.now(),c=null;a.layout&&(c=Wp(a.layout));var d=null;c&&c.Kv&&(d=new c.Kv);if(!d)throw Error("no registered Worker Layout: "+a.layout);d.network=bq(d,a,!0);
d.workerLayout=function(){var a=dq(d,d.network,!1);a._GoJS="_GoJS";a.time=performance.now()-b;self.postMessage(a,void 0);return!0};d.doLayout(new E)}});function Zp(){this.Kv=null;this.zy=this.l=this.name="";this.scripts=[];this.Ne=null;this.Bm=new H}function Rp(a){Ya(this);this.kc=a;this.tf=new F;this.he=new F;this.au=new H;this.Wt=new H}
Rp.prototype.clear=function(){if(this.tf)for(var a=this.tf.iterator;a.next();)a.value.clear();if(this.he)for(a=this.he.iterator;a.next();)a.value.clear();this.tf=new F;this.he=new F;this.au=new H;this.Wt=new H};
Rp.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.tf.count+" edges: "+this.he.count;if(1<a){for(var c=this.tf.iterator;c.next();)b+="\n    "+c.value.toString(a-1);for(c=this.he.iterator;c.next();)b+="\n    "+c.value.toString(a-1)}return b};Rp.prototype.createVertex=function(){return new eq(this)};Rp.prototype.createEdge=function(){return new fq(this)};
Rp.prototype.Ag=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 S){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 vf&&null===d.layout)this.Ag(d.memberParts,!1);else if(null===this.kj(d)){var e=this.createVertex();e.node=
d;this.Bg(e)}}for(a.reset();a.next();)if(d=a.value,d instanceof S&&(!b||d.isTopLevel)&&d.canLayout()&&c(d)&&null===this.Cq(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.Ak(f,e,d))}}};Rp.prototype.findGroupVertex=function(a){if(null===a)return null;var b=a.findVisibleNode();if(null===b)return null;a=this.kj(b);if(null!==a)return a;for(b=b.containingGroup;null!==b;){a=this.kj(b);if(null!==a)return a;b=b.containingGroup}return null};
t=Rp.prototype;t.Bg=function(a){if(null!==a){this.tf.add(a);var b=a.node;null!==b&&this.au.add(b,a);a.network=this}};t.jk=function(a){if(null===a)return null;var b=this.kj(a);null===b&&(b=this.createVertex(),b.node=a,this.Bg(b));return b};t.Nv=function(a){if(null!==a&&gq(this,a)){for(var b=a.Le,c=b.count-1;0<=c;c--){var d=b.L(c);this.sk(d)}b=a.Ee;for(a=b.count-1;0<=a;a--)c=b.L(a),this.sk(c)}};
function gq(a,b){if(null===b)return!1;var c=a.tf.remove(b);c&&(b=b.node,null!==b&&a.au.remove(b));return c}t.Gz=function(a){null!==a&&(a=this.kj(a),null!==a&&this.Nv(a))};t.kj=function(a){return null===a?null:this.au.H(a)};t.nm=function(a){if(null!==a){hq(this,a);var b=a.toVertex;null!==b&&b.Ev(a);b=a.fromVertex;null!==b&&b.Cv(a)}};function hq(a,b){if(null!==b){a.he.add(b);var c=b.link;null!==c&&null===a.Cq(c)&&a.Wt.add(c,b);b.network=a}}
t.Tx=function(a){if(null===a)return null;var b=a.fromNode,c=a.toNode,d=this.Cq(a);null===d?(d=this.createEdge(),d.link=a,null!==b&&(d.fromVertex=this.jk(b)),null!==c&&(d.toVertex=this.jk(c)),this.nm(d)):(null!==b?d.fromVertex=this.jk(b):d.fromVertex=null,null!==c?d.toVertex=this.jk(c):d.toVertex=null);return d};t.sk=function(a){if(null!==a){var b=a.toVertex;null!==b&&b.Mv(a);b=a.fromVertex;null!==b&&b.Lv(a);iq(this,a)}};
function iq(a,b){null!==b&&a.he.remove(b)&&(b=b.link,null!==b&&a.Wt.remove(b))}t.Fz=function(a){null!==a&&(a=this.Cq(a),null!==a&&this.sk(a))};t.Cq=function(a){return null===a?null:this.Wt.H(a)};t.Ak=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.nm(d);return d}return null};t.Qm=function(a){if(null!==a){var b=a.fromVertex,c=a.toVertex;null!==b&&null!==c&&(b.Lv(a),c.Mv(a),a.Qm(),b.Ev(a),c.Cv(a))}};
t.zq=function(){for(var a=Ea(),b=this.he.iterator;b.next();){var c=b.value;c.fromVertex===c.toVertex&&a.push(c)}b=a.length;for(c=0;c<b;c++)this.sk(a[c]);Ha(a)};Rp.prototype.deleteArtificialVertexes=function(){for(var a=Ea(),b=this.tf.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.Nv(a[b]);b=Ea();for(c=this.he.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.sk(b[d]);Ha(a);Ha(b)};
function jq(a){for(var b=Ea(),c=a.he.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.sk(b[d]);Ha(b)}
Rp.prototype.Uy=function(a){void 0===a&&(a=!0);a&&(this.deleteArtificialVertexes(),jq(this),this.zq());a=new E;for(var b=!0;b;){b=!1;for(var c=this.tf.iterator;c.next();){var d=c.value;if(0<d.Le.count||0<d.Ee.count){b=this.layout.createNetwork();a.add(b);kq(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 kq(a,b,c){if(null!==c&&c.network!==b){gq(a,c);b.Bg(c);for(var d=c.sourceEdges;d.next();){var e=d.value;e.network!==b&&(iq(a,e),hq(b,e),kq(a,b,e.fromVertex))}for(d=c.destinationEdges;d.next();)c=d.value,c.network!==b&&(iq(a,c),hq(b,c),kq(a,b,c.toVertex))}}Rp.prototype.Mz=function(){for(var a=new F,b=this.tf.iterator;b.next();)a.add(b.value.node);for(b=this.he.iterator;b.next();)a.add(b.value.link);return a};
ma.Object.defineProperties(Rp.prototype,{layout:{get:function(){return this.kc},set:function(a){null!==a&&(this.kc=a)}},vertexes:{get:function(){return this.tf}},edges:{get:function(){return this.he}}});Rp.prototype.findAllParts=Rp.prototype.Mz;Rp.prototype.splitIntoSubNetworks=Rp.prototype.Uy;Rp.prototype.deleteSelfEdges=Rp.prototype.zq;Rp.prototype.reverseEdge=Rp.prototype.Qm;Rp.prototype.linkVertexes=Rp.prototype.Ak;
Rp.prototype.findEdge=Rp.prototype.Cq;Rp.prototype.deleteLink=Rp.prototype.Fz;Rp.prototype.deleteEdge=Rp.prototype.sk;Rp.prototype.addLink=Rp.prototype.Tx;Rp.prototype.addEdge=Rp.prototype.nm;Rp.prototype.findVertex=Rp.prototype.kj;Rp.prototype.deleteNode=Rp.prototype.Gz;Rp.prototype.deleteVertex=Rp.prototype.Nv;Rp.prototype.addNode=Rp.prototype.jk;Rp.prototype.addVertex=Rp.prototype.Bg;Rp.prototype.addParts=Rp.prototype.Ag;Rp.className="LayoutNetwork";
function eq(a){Ya(this);this.Qc=a;this.l=(new N(0,0,10,10)).freeze();this.v=(new J(5,5)).freeze();this.Li=this.lb=null;this.Le=new E;this.Ee=new E}
eq.prototype.serializeVertexProperties=function(a){a.id=mb(this);a.key=this.node?this.node.key:this.data?this.data.Ci:void 0;void 0===a.key&&(a.key=null);a.x=this.bounds.x;a.y=this.bounds.y;a.dB=this.bounds.width;a.oA=this.bounds.height;a.fx=this.focus.x;a.fy=this.focus.y;var b=[];this.Le.each(function(a){b.push(mb(a))});a.Ry=b;var c=[];this.Ee.each(function(a){c.push(mb(a))});a.gy=c};
eq.prototype.Aq=function(a,b,c){if(null!==a){this.x=a.x;this.y=a.y;this.width=a.dB;this.height=a.oA;this.focusX=a.fx;this.focusY=a.fy;var d=this;a.Ry&&a.Ry.forEach(function(a){(a=c.get(a))&&d.Le.add(a)});a.gy&&a.gy.forEach(function(a){(a=c.get(a))&&d.Ee.add(a)})}};eq.prototype.clear=function(){this.Li=this.lb=null;this.Le=new E;this.Ee=new E};
eq.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutVertex#"+mb(this);if(0<a&&(b+=null!==this.node?"("+this.node.toString()+")":"",1<a)){a="";for(var c=!0,d=this.Le.iterator;d.next();){var e=d.value;c?c=!1:a+=",";a+=e.toString(0)}e="";c=!0;for(d=this.Ee.iterator;d.next();){var f=d.value;c?c=!1:e+=",";e+=f.toString(0)}b+=" sources: "+a+" destinations: "+e}return b};
eq.prototype.commit=function(){var a=this.lb;if(null!==a){var b=this.bounds,c=a.bounds;ya(c)?(c.x=b.x,c.y=b.y,c.width=b.width,c.height=b.height):a.bounds=b.copy()}else if(a=this.node,null!==a){b=this.bounds;if(!(a instanceof vf)){c=N.alloc();var d=this.network.layout.mj(a,c),e=a.locationObject.ga(Bc);if(d.u()&&e.u()){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)}};eq.prototype.Ev=function(a){null!==a&&(this.Le.contains(a)||this.Le.add(a))};
eq.prototype.Mv=function(a){null!==a&&this.Le.remove(a)};eq.prototype.Cv=function(a){null!==a&&(this.Ee.contains(a)||this.Ee.add(a))};eq.prototype.Lv=function(a){null!==a&&this.Ee.remove(a)};function lq(a,b){a=a.Li;b=b.Li;return a?b?(a=a.text,b=b.text,a<b?-1:a>b?1:0):1:null!==b?-1:0}
ma.Object.defineProperties(eq.prototype,{sourceEdgesArrayAccess:{get:function(){return this.Le._dataArray}},destinationEdgesArrayAccess:{get:function(){return this.Ee._dataArray}},data:{get:function(){return this.lb},set:function(a){this.lb=a;if(null!==a&&a.bounds){var b=a.bounds;a=b.x;var c=b.y,d=b.width;b=b.height;this.v.h(d/2,b/2);this.l.h(a,c,d,b)}}},node:{get:function(){return this.Li},
set:function(a){if(this.Li!==a){this.Li=a;a.Ta();var b=this.network.layout,c=N.alloc(),d=b.mj(a,c);b=d.x;var e=d.y,f=d.width;d=d.height;isNaN(b)&&(b=0);isNaN(e)&&(e=0);this.l.h(b,e,f,d);N.free(c);if(!(a instanceof vf)&&(a=a.locationObject.ga(Bc),a.u())){this.v.h(a.x-b,a.y-e);return}this.v.h(f/2,d/2)}}},bounds:{get:function(){return this.l},set:function(a){this.l.w(a)||this.l.assign(a)}},focus:{get:function(){return this.v},set:function(a){this.v.w(a)||
this.v.assign(a)}},centerX:{get:function(){return this.l.x+this.v.x},set:function(a){var b=this.l;b.x+this.v.x!==a&&(b.ea(),b.x=a-this.v.x,b.freeze())}},centerY:{get:function(){return this.l.y+this.v.y},set:function(a){var b=this.l;b.y+this.v.y!==a&&(b.ea(),b.y=a-this.v.y,b.freeze())}},focusX:{get:function(){return this.v.x},set:function(a){var b=this.v;b.x!==a&&(b.ea(),b.x=a,b.freeze())}},focusY:{
get:function(){return this.v.y},set:function(a){var b=this.v;b.y!==a&&(b.ea(),b.y=a,b.freeze())}},x:{get:function(){return this.l.x},set:function(a){var b=this.l;b.x!==a&&(b.ea(),b.x=a,b.freeze())}},y:{get:function(){return this.l.y},set:function(a){var b=this.l;b.y!==a&&(b.ea(),b.y=a,b.freeze())}},width:{get:function(){return this.l.width},set:function(a){var b=this.l;b.width!==a&&(b.ea(),b.width=
a,b.freeze())}},height:{get:function(){return this.l.height},set:function(a){var b=this.l;b.height!==a&&(b.ea(),b.height=a,b.freeze())}},network:{get:function(){return this.Qc},set:function(a){this.Qc=a}},sourceVertexes:{get:function(){for(var a=new F,b=this.sourceEdges;b.next();)a.add(b.value.fromVertex);return a.iterator}},destinationVertexes:{get:function(){for(var a=new F,b=
this.destinationEdges;b.next();)a.add(b.value.toVertex);return a.iterator}},vertexes:{get:function(){for(var a=new F,b=this.sourceEdges;b.next();)a.add(b.value.fromVertex);for(b=this.destinationEdges;b.next();)a.add(b.value.toVertex);return a.iterator}},sourceEdges:{get:function(){return this.Le.iterator}},destinationEdges:{get:function(){return this.Ee.iterator}},edges:{get:function(){for(var a=
new E,b=this.sourceEdges;b.next();)a.add(b.value);for(b=this.destinationEdges;b.next();)a.add(b.value);return a.iterator}},edgesCount:{get:function(){return this.Le.count+this.Ee.count}}});eq.prototype.deleteDestinationEdge=eq.prototype.Lv;eq.prototype.addDestinationEdge=eq.prototype.Cv;eq.prototype.deleteSourceEdge=eq.prototype.Mv;eq.prototype.addSourceEdge=eq.prototype.Ev;eq.className="LayoutVertex";eq.standardComparer=lq;
eq.smartComparer=function(a,b){if(null!==a){if(null!==b){a=a.Li;var c=b.Li;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 fq(a){Ya(this);this.Pc=a;this.vg=this.Wf=this.Hl=this.lb=null}fq.prototype.clear=function(){this.vg=this.Wf=this.Hl=this.lb=null};
fq.prototype.serializeEdgeProperties=function(a){a.id=mb(this);a.key=this.link?this.link.key:this.data?this.data.Ci:void 0;void 0===a.key&&(a.key=null);a.from=this.fromVertex?mb(this.fromVertex):null;a.ZA=this.toVertex?mb(this.toVertex):null};fq.prototype.deserializeEdgeProperties=function(a,b){if(null!==a){var c=b.get(a.from);c&&(this.fromVertex=c);if(a=b.get(a.ZA))this.toVertex=a}};
fq.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutEdge#"+mb(this);0<a&&(b+=null!==this.Hl?"("+this.Hl.toString()+")":"",1<a&&(b+=" "+(this.Wf?this.Wf.toString():"null")+" --\x3e "+(this.vg?this.vg.toString():"null")));return b};fq.prototype.Qm=function(){var a=this.Wf;this.Wf=this.vg;this.vg=a};fq.prototype.commit=function(){};fq.prototype.wy=function(a){return this.vg===a?this.Wf:this.Wf===a?this.vg:null};
ma.Object.defineProperties(fq.prototype,{network:{get:function(){return this.Pc},set:function(a){this.Pc=a}},data:{get:function(){return this.lb},set:function(a){this.lb!==a&&(this.lb=a)}},link:{get:function(){return this.Hl},set:function(a){this.Hl!==a&&(this.Hl=a)}},fromVertex:{get:function(){return this.Wf},set:function(a){this.Wf!==a&&(this.Wf=a)}},toVertex:{
get:function(){return this.vg},set:function(a){this.vg!==a&&(this.vg=a)}}});fq.prototype.getOtherVertex=fq.prototype.wy;fq.className="LayoutEdge";function Mk(){yi.call(this);this.isViewportSized=!0;this.pq=this.qq=NaN;this.Qg=(new M(NaN,NaN)).freeze();this.kf=(new M(10,10)).freeze();this.yb=mq;this.Eb=nq;this.Yc=oq;this.Tc=pq}la(Mk,yi);
Mk.prototype.cloneProtected=function(a){yi.prototype.cloneProtected.call(this,a);a.qq=this.qq;a.pq=this.pq;a.Qg.assign(this.Qg);a.kf.assign(this.kf);a.yb=this.yb;a.Eb=this.Eb;a.Yc=this.Yc;a.Tc=this.Tc};Mk.prototype.hb=function(a){a.classType===Mk?a===oq||a===qq||a===rq||a===sq?this.sorting=a:a===nq||a===tq?this.arrangement=a:a===mq||a===uq?this.alignment=a:B("Unknown enum value: "+a):yi.prototype.hb.call(this,a)};
Mk.prototype.doLayout=function(a){this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);var b=this.Yx(a);a=this.diagram;for(var c=b.copy().iterator;c.next();){var d=c.value;if(!d.Ph()||null===d.fromNode&&null===d.toNode){if(d.Ta(),d instanceof vf)for(d=d.memberParts;d.next();)b.remove(d.value)}else b.remove(d)}var e=b.ma();if(0!==e.length){switch(this.sorting){case sq:e.reverse();break;case oq:e.sort(this.comparer);break;case qq: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.va("Layout");d=[];switch(this.alignment){case uq: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.mj(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.mj(e[p],l);n=Math.max(n,r.height)}n=Math.max(n+k,1);p=this.arrangement;for(var q=r=this.arrangementOrigin.x,u=this.arrangementOrigin.y,v=0,w=0,y=0;y<e.length;y++){var z=e[y],A=this.mj(z,l),C=Math.ceil((A.width+h)/m)*m,G=Math.ceil((A.height+k)/n)*n;switch(p){case tq:var L=Math.abs(q-A.width);break;default:L=q+A.width}if(0<f&&v>f-1||0<g&&0<v&&L-r>g)d.push(new N(0,u,g+h,w)),v=0,q=r,u+=w,w=0;w=Math.max(w,G);switch(p){case tq:A=-A.width;break;default:A=
0}z.moveTo(q+A,u);switch(p){case tq:q-=C;break;default:q+=C}v++}d.push(new N(0,u,g+h,w));N.free(l);break;case mq: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++)w=e[q],v=this.mj(w,g),w=w.Cf(w.locationObject,w.locationSpot,h),l=Math.max(l,w.x),u=Math.max(u,v.width-w.x),f=Math.max(f,w.y);q=this.arrangement;switch(q){case tq:l+=n;break;default:u+=n}r=isFinite(r)?Math.max(r+n,1):Math.max(l+u,1);var I=w=this.arrangementOrigin.x;y=this.arrangementOrigin.y;
u=0;k>=l&&(k-=l);l=z=0;C=Math.max(this.cellSize.height,1);A=f=0;G=!0;v=J.alloc();for(L=0;L<e.length;L++){var T=e[L],R=this.mj(T,g),ca=T.Cf(T.locationObject,T.locationSpot,h);if(0<u)switch(q){case tq:I=(I-w-(R.width-ca.x))/r;I=K.$(Math.round(I),I)?Math.round(I):Math.floor(I);I=I*r+w;break;default:I=(I-w+ca.x)/r,I=K.$(Math.round(I),I)?Math.round(I):Math.ceil(I),I=I*r+w}else switch(q){case tq:z=I+ca.x+R.width;break;default:z=I-ca.x}switch(q){case tq:var qa=-(I+ca.x)+z;break;default:qa=I+R.width-ca.x-
z}if(0<m&&u>m-1||0<k&&0<u&&qa>k){d.push(new N(0,G?y-f:y,k+n,A+f+p));for(I=0;I<u&&L!==u;I++){qa=e[L-u+I];var O=qa.Cf(qa.locationObject,qa.locationSpot,v);qa.moveTo(qa.position.x,qa.position.y+f-O.y)}A+=p;y=G?y+A:y+(A+f);u=A=f=0;I=w;G=!1}I===w&&(l=q===tq?Math.max(l,R.width-ca.x):Math.min(l,-ca.x));f=Math.max(f,ca.y);A=Math.max(A,R.height-ca.y);isFinite(C)&&(A=Math.max(A,Math.max(R.height,C)-ca.y));G?T.moveTo(I-ca.x,y-ca.y):T.moveTo(I-ca.x,y);switch(q){case tq:I-=ca.x+n;break;default:I+=R.width-ca.x+
n}u++}d.push(new N(0,y,k+n,(G?A:A+f)+p));if(e.length!==u)for(k=0;k<u;k++)m=e[e.length-u+k],n=m.Cf(m.locationObject,m.locationSpot,h),m.moveTo(m.position.x,m.position.y+f-n.y);J.free(h);J.free(v);if(q===tq)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===tq?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.Wa("Layout");this.isValidLayout=!0}};Mk.prototype.commitLayers=function(){};function pq(a,b){a=a.text;b=b.text;return a<b?-1:a>b?1:0}
ma.Object.defineProperties(Mk.prototype,{wrappingWidth:{get:function(){return this.qq},set:function(a){this.qq!==a&&(0<a||isNaN(a))&&(this.qq=a,this.isViewportSized=isNaN(a),this.C())}},wrappingColumn:{get:function(){return this.pq},set:function(a){this.pq!==a&&(0<a||isNaN(a))&&(this.pq=a,this.C())}},cellSize:{get:function(){return this.Qg},set:function(a){this.Qg.w(a)||(this.Qg.assign(a),this.C())}},spacing:{
get:function(){return this.kf},set:function(a){this.kf.w(a)||(this.kf.assign(a),this.C())}},alignment:{get:function(){return this.yb},set:function(a){this.yb===a||a!==mq&&a!==uq||(this.yb=a,this.C())}},arrangement:{get:function(){return this.Eb},set:function(a){this.Eb===a||a!==nq&&a!==tq||(this.Eb=a,this.C())}},sorting:{get:function(){return this.Yc},set:function(a){this.Yc===a||a!==rq&&a!==sq&&
a!==oq&&a!==qq||(this.Yc=a,this.C())}},comparer:{get:function(){return this.Tc},set:function(a){this.Tc!==a&&(this.Tc=a,this.C())}}});var uq=new D(Mk,"Position",0),mq=new D(Mk,"Location",1),nq=new D(Mk,"LeftToRight",2),tq=new D(Mk,"RightToLeft",3),rq=new D(Mk,"Forward",4),sq=new D(Mk,"Reverse",5),oq=new D(Mk,"Ascending",6),qq=new D(Mk,"Descending",7);Mk.className="GridLayout";Mk.standardComparer=pq;
Mk.smartComparer=function(a,b){if(null!==a){if(null!==b){a=a.text.toLocaleLowerCase().split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/);b=b.text.toLocaleLowerCase().split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/);for(var c=0;c<a.length;c++)if(""!==b[c]&&void 0!==b[c]){var d=parseFloat(a[c]),e=parseFloat(b[c]);if(isNaN(d))if(isNaN(e)){if(0!==a[c].localeCompare(b[c]))return a[c].localeCompare(b[c])}else return 1;else{if(isNaN(e))return-1;if(0!==d-e)return d-e}}else if(""!==a[c])return 1;return""!==
b[c]&&void 0!==b[c]?-1:0}return 1}return null!==b?-1:0};Mk.Position=uq;Mk.Location=mq;Mk.LeftToRight=nq;Mk.RightToLeft=tq;Mk.Forward=rq;Mk.Reverse=sq;Mk.Ascending=oq;Mk.Descending=qq;function ti(){this.hp=new F;this.Jo=new F;this.Da=new F;this.Te=new H;this.Se=new H;this.Nj=new H;this.B=null;this.pr=!1}t=ti.prototype;t.clear=function(){this.hp.clear();this.Jo.clear();this.Da.clear();this.Te.clear();this.Se.clear();this.Nj.clear()};t.ae=function(a){this.B=a};
t.nj=function(a){if(a instanceof V){if(this.hp.add(a),a instanceof vf){var b=a.containingGroup;null===b?this.B.Dh.add(a):b.Ml.add(a);b=a.layout;null!==b&&(b.diagram=this.B)}}else a instanceof S?this.Jo.add(a):a instanceof He||this.Da.add(a);b=a.data;null===b||a instanceof He||(a instanceof S?this.Se.add(b,a):this.Te.add(b,a))};
t.Kc=function(a){a.kk();if(a instanceof V){if(this.hp.remove(a),a instanceof vf){var b=a.containingGroup;null===b?this.B.Dh.remove(a):b.Ml.remove(a);b=a.layout;null!==b&&(b.diagram=null)}}else a instanceof S?this.Jo.remove(a):a instanceof He||this.Da.remove(a);b=a.data;null===b||a instanceof He||(a instanceof S?this.Se.remove(b):this.Te.remove(b))};
t.Ed=function(){for(var a=this.B.nodeTemplateMap.iterator;a.next();){var b=a.value,c=a.key;(!b.Wb()||b instanceof vf)&&B('Invalid node template in Diagram.nodeTemplateMap: template for "'+c+'" must be a Node or a simple Part, not a Group or Link: '+b)}for(a=this.B.groupTemplateMap.iterator;a.next();)b=a.value,c=a.key,b instanceof vf||B('Invalid group template in Diagram.groupTemplateMap: template for "'+c+'" must be a Group, not a normal Node or Link: '+b);for(a=this.B.linkTemplateMap.iterator;a.next();)b=
a.value,c=a.key,b instanceof S||B('Invalid link template in Diagram.linkTemplateMap: template for "'+c+'" must be a Link, not a normal Node or simple Part: '+b);a=Ea();for(b=this.B.selection.iterator;b.next();)(c=b.value.data)&&a.push(c);b=Ea();for(c=this.B.highlighteds.iterator;c.next();){var d=c.value.data;d&&b.push(d)}c=Ea();for(d=this.nodes.iterator;d.next();){var e=d.value;null!==e.data&&(c.push(e.data),c.push(e.location))}for(d=this.links.iterator;d.next();)e=d.value,null!==e.data&&(c.push(e.data),
c.push(e.location));for(d=this.parts.iterator;d.next();)e=d.value,null!==e.data&&(c.push(e.data),c.push(e.location));this.removeAllModeledParts();this.addAllModeledParts();for(d=0;d<a.length;d++)e=this.yc(a[d]),null!==e&&(e.isSelected=!0);for(d=0;d<b.length;d++)e=this.yc(b[d]),null!==e&&(e.isHighlighted=!0);for(d=0;d<c.length;d+=2)e=this.yc(c[d]),null!==e&&(e.location=c[d+1]);Ha(a);Ha(b);Ha(c)};ti.prototype.addAllModeledParts=function(){this.addModeledParts(this.diagram.model.nodeDataArray)};
ti.prototype.addModeledParts=function(a,b){var c=this,d=this.diagram.model;a.forEach(function(a){d.Za(a)&&vq(c,a,!1)});a.forEach(function(a){d.Za(a)&&c.resolveReferencesForData(a)});!1!==b&&ok(this.diagram,!1)};
function vq(a,b,c){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.Te.contains(b)){void 0===c&&(c=!0);a:{if(void 0!==b&&null!==b&&!a.B.undoManager.isUndoingRedoing&&!a.Te.contains(b)){var d=a.Gq(b);var e=Jo(a,b,d);if(null!==e&&(xg(e),e=e.copy(),null!==e)){var f=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.Mf=d;e.lb=b;a.pr&&(e.hh="Tool");a.diagram.add(e);e.lb=null;e.data=b;a.diagram.skipsModelSourceBindings=f;d=e;break a}}d=null}null!==d&&c&&a.resolveReferencesForData(b)}}
ti.prototype.insertLink=function(){return null};ti.prototype.resolveReferencesForData=function(){};ti.prototype.Gq=function(a){return this.B.model.Gq(a)};
function Jo(a,b,c){a=a.B;var d=a.model;d.yk()&&d.ew(b)?(b=a.groupTemplateMap.H(c),null===b&&(b=a.groupTemplateMap.H(""),null===b&&(wq||(wq=!0,wa('No Group template found for category "'+c+'"'),wa("  Using default group template")),b=a.Du))):(b=a.nodeTemplateMap.H(c),null===b&&(b=a.nodeTemplateMap.H(""),null===b&&(xq||(xq=!0,wa('No Node template found for category "'+c+'"'),wa("  Using default node template")),b=a.Fu)));return b}ti.prototype.getLinkCategoryForData=function(){return""};
ti.prototype.setLinkCategoryForData=function(){};ti.prototype.setFromNodeForLink=function(){};ti.prototype.setToNodeForLink=function(){};ti.prototype.findLinkTemplateForCategory=function(a){var b=this.B.linkTemplateMap.H(a);null===b&&(b=this.B.linkTemplateMap.H(""),null===b&&(yq||(yq=!0,wa('No Link template found for category "'+a+'"'),wa("  Using default link template")),b=this.B.Eu));return b};ti.prototype.removeAllModeledParts=function(){this.fu(this.diagram.model.nodeDataArray)};
ti.prototype.fu=function(a){var b=this;a.forEach(function(a){b.ar(a)})};ti.prototype.ar=function(a){a=this.yc(a);null!==a&&(Lj(this.diagram,a,!1),this.unresolveReferencesForPart(a))};ti.prototype.unresolveReferencesForPart=function(){};ti.prototype.removeDataForLink=function(){};ti.prototype.findPartForKey=function(a){if(null===a||void 0===a)return null;a=this.B.model.Kb(a);return null!==a?this.Te.H(a):null};
ti.prototype.Cb=function(a){if(null===a||void 0===a)return null;a=this.B.model.Kb(a);if(null===a)return null;a=this.Te.H(a);return a instanceof V?a:null};ti.prototype.findLinkForKey=function(){return null};t=ti.prototype;t.yc=function(a){if(null===a)return null;var b=this.Te.H(a);return null!==b?b:b=this.Se.H(a)};t.gj=function(a){if(null===a)return null;a=this.Te.H(a);return a instanceof V?a:null};t.xc=function(a){return null===a?null:this.Se.H(a)};
t.Jt=function(a){for(var b=0;b<arguments.length;++b);b=new F;for(var c=this.hp.iterator;c.next();){var d=c.value,e=d.data;if(null!==e)for(var f=0;f<arguments.length;f++){var g=arguments[f];if(ya(g)&&zq(this,e,g)){b.add(d);break}}}return b.iterator};t.It=function(a){for(var b=0;b<arguments.length;++b);b=new F;for(var c=this.Jo.iterator;c.next();){var d=c.value,e=d.data;if(null!==e)for(var f=0;f<arguments.length;f++){var g=arguments[f];if(ya(g)&&zq(this,e,g)){b.add(d);break}}}return b.iterator};
function zq(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&&!Aq(a,e[g],h))return!1}}else if(!Aq(a,e,f))return!1}return!0}function Aq(a,b,c){if("function"===typeof c){if(!c(b))return!1}else if(c instanceof RegExp){if(!b||!c.test(b.toString()))return!1}else if(ya(b)&&ya(c)){if(!zq(a,b,c))return!1}else if(b!==c)return!1;return!0}
ti.prototype.doModelChanged=function(a){if(this.B){var b=this.B;if(a.model===b.model){var c=a.change;b.doModelChanged(a);if(b.Z){b.Z=!1;try{var d=a.modelChange;if(""!==d)if(c===ve){if("nodeCategory"===d){var e=this.yc(a.object),f=a.newValue;null!==e&&"string"===typeof f&&(e.category=f)}else"nodeDataArray"===d&&(this.fu(a.oldValue),this.addModeledParts(a.newValue));b.isModified=!0}else if(c===xe){var g=a.newValue;"nodeDataArray"===d&&ya(g)&&vq(this,g);b.isModified=!0}else if(c===ye){var h=a.oldValue;
"nodeDataArray"===d&&ya(h)&&this.ar(h);b.isModified=!0}else c===we&&("SourceChanged"===d?null!==a.object?this.updateDataBindings(a.object,a.propertyName):(this.kr(),this.updateAllTargetBindings()):"ModelDisplaced"===d&&this.Ed());else if(c===ve){var k=a.propertyName,l=a.object;if(l===b.model){if("nodeKeyProperty"===k||"nodeCategoryProperty"===k)b.undoManager.isUndoingRedoing||this.Ed()}else this.updateDataBindings(l,k);b.isModified=!0}else if(c===xe||c===ye){var m=a.change===xe,n=m?a.newParam:a.oldParam,
p=m?a.newValue:a.oldValue,r=this.Nj.H(a.object);if(Array.isArray(r))for(a=0;a<r.length;a++){var q=r[a];if(m)ln(q,p,n);else if(!(0>n)){var u=n+dn(q);q.Kc(u,!0);pn(q,u,n)}}b.isModified=!0}}finally{b.Z=!0}}}}};ti.prototype.updateAllTargetBindings=function(a){void 0===a&&(a="");for(var b=this.parts.iterator;b.next();)b.value.Ca(a);for(b=this.nodes.iterator;b.next();)b.value.Ca(a);for(b=this.links.iterator;b.next();)b.value.Ca(a)};
ti.prototype.kr=function(){for(var a=this.B.model,b=new F,c=a.nodeDataArray,d=0;d<c.length;d++)b.add(c[d]);var e=[];this.nodes.each(function(a){null===a.data||b.contains(a.data)||e.push(a.data)});this.parts.each(function(a){null===a.data||b.contains(a.data)||e.push(a.data)});e.forEach(function(b){Bq(a,b,!1)});for(d=0;d<c.length;d++){var f=c[d];null===this.yc(f)&&Cq(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()};ti.prototype.refreshDataBoundLinks=function(){};ti.prototype.updateRelationshipsFromData=function(){};
ti.prototype.updateDataBindings=function(a,b){if("string"===typeof b){var c=this.yc(a);if(null!==c)c.Ca(b);else{c=null;for(var d=this.Nj.iterator;d.next();){for(var e=d.value,f=0;f<e.length;f++){var g=e[f].ny(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].Ca(b);Ha(c)}}a===this.diagram.model.modelData&&this.updateAllTargetBindings(b)}};
function Hj(a,b){var c=b.Bi;if(Aa(c)){var d=a.Nj.H(c);if(null===d)d=[],d.push(b),a.Nj.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}function Kj(a,b,c){Fj(b,function(a){a=a.W.j;for(var b=a.length,d=0;d<b;d++)ak(c,a[d])});var d=b.Bi;if(Aa(d)){var e=a.Nj.H(d);if(null!==e)for(var f=0;f<e.length;f++)if(e[f]===b){e.splice(f,1);0===e.length&&a.Nj.remove(d);break}}}
ti.prototype.qk=function(a,b,c){var d=new H;if(Aa(a))for(var e=0;e<a.length;e++)Dq(this,a[e],b,d,c);else for(a=a.iterator;a.next();)Dq(this,a.value,b,d,c);if(null!==b){c=b.model;a=b.toolManager.findTool("Dragging");a=null!==a?a.dragOptions.dragsLink:b.dl.dragsLink;e=new F;for(var f=new H,g=d.iterator;g.next();){var h=g.value;if(h instanceof S)a||null!==h.fromNode&&null!==h.toNode||e.add(h);else if(h instanceof V&&null!==h.data&&c.Am()){var k=h;h=g.key;var l=h.Fg();null!==l&&(l=d.H(l),null!==l?(c.be(k.data,
c.ja(l.data)),k=b.xc(k.data),h=h.jj(),null!==h&&null!==k&&f.add(h,k)):c.be(k.data,void 0))}}0<e.count&&b.gu(e,!1);if(0<f.count)for(c=f.iterator;c.next();)d.add(c.key,c.value)}if(null!==b&&null!==this.B&&(b=b.model,c=b.afterCopyFunction,null!==c)){var m=new H;d.each(function(a){null!==a.key.data&&m.add(a.key.data,a.value.data)});c(m,b,this.B.model)}for(b=d.iterator;b.next();)b.value.Ca();return d};
function Dq(a,b,c,d,e){if(null===b||e&&!b.canCopy())return null;if(d.contains(b))return d.H(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.H(h);null!==k&&(k.fromNode=f)}h.toNode===b&&(h=d.H(h),null!==h&&(h.toNode=f))}if(b instanceof vf&&f instanceof vf)for(b=b.memberParts;b.next();)g=Dq(a,b.value,c,d,e),g instanceof S||null===g||(g.containingGroup=
f)}else if(b instanceof S&&f instanceof S)for(g=b.fromNode,null!==g&&(g=d.H(g),null!==g&&(f.fromNode=g)),g=b.toNode,null!==g&&(g=d.H(g),null!==g&&(f.toNode=g)),b=b.labelNodes;b.next();)g=Dq(a,b.value,c,d,e),null!==g&&g instanceof V&&(g.labeledLink=f);return f}
ti.prototype.copyPartData=function(a,b){var c=null,d=a.data;if(null!==d&&null!==b){var e=b.model;a instanceof S||(d=e.copyNodeData(d),ya(d)&&(e.uf(d),c=b.yc(d)))}else xg(a),c=a.copy(),null!==c&&(e=this.B,null!==b?b.add(c):null!==d&&null!==e&&null!==e.commandHandler&&e.commandHandler.copiesClipboardData&&(b=e.model,e=null,c instanceof S||(e=b.copyNodeData(d)),ya(e)&&(c.data=e)));return c};
ma.Object.defineProperties(ti.prototype,{nodes:{get:function(){return this.hp}},links:{get:function(){return this.Jo}},parts:{get:function(){return this.Da}},diagram:{get:function(){return this.B}},addsToTemporaryLayer:{get:function(){return this.pr},set:function(a){this.pr=a}}});ti.prototype.updateAllRelationshipsFromData=ti.prototype.kr;
ti.prototype.findLinksByExample=ti.prototype.It;ti.prototype.findNodesByExample=ti.prototype.Jt;ti.prototype.findLinkForData=ti.prototype.xc;ti.prototype.findNodeForData=ti.prototype.gj;ti.prototype.findPartForData=ti.prototype.yc;ti.prototype.findNodeForKey=ti.prototype.Cb;ti.prototype.removeModeledPart=ti.prototype.ar;ti.prototype.removeModeledParts=ti.prototype.fu;ti.prototype.rebuildParts=ti.prototype.Ed;var xq=!1,wq=!1,yq=!1;ti.className="PartManager";
function Eq(a){ti.apply(this,arguments)}la(Eq,ti);Eq.prototype.addAllModeledParts=function(){var a=this.diagram.model;this.addModeledParts(a.nodeDataArray);Fq(this,a.linkDataArray)};Eq.prototype.addModeledParts=function(a){ti.prototype.addModeledParts.call(this,a,!1);for(a=this.links.iterator;a.next();)Ko(a.value);ok(this.diagram,!1)};function Fq(a,b){b.forEach(function(b){Gq(a,b)});ok(a.diagram,!1)}
function Gq(a,b){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.Se.contains(b)){var c=a.getLinkCategoryForData(b),d=a.findLinkTemplateForCategory(c);if(null!==d){xg(d);var e=d.copy();if(null!==e){d=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.Mf=c;e.lb=b;c=a.diagram.model;var f=Hq(c,b,!0);""!==f&&(e.fromPortId=f);f=Iq(c,b,!0);void 0!==f&&(f=a.Cb(f),f instanceof V&&(e.fromNode=f));f=Hq(c,b,!1);""!==f&&(e.toPortId=f);f=Iq(c,b,!1);void 0!==f&&(f=a.Cb(f),
f instanceof V&&(e.toNode=f));c=c.Bf(b);Array.isArray(c)&&c.forEach(function(b){b=a.Cb(b);null!==b&&(b.labeledLink=e)});a.pr&&(e.hh="Tool");a.diagram.add(e);e.lb=null;e.data=b;a.diagram.skipsModelSourceBindings=d}}}}Eq.prototype.removeAllModeledParts=function(){var a=this.diagram.model;Jq(this,a.linkDataArray);this.fu(a.nodeDataArray)};function Jq(a,b){b.forEach(function(b){a.ar(b)})}Eq.prototype.getLinkCategoryForData=function(a){return this.diagram.model.Mt(a)};
Eq.prototype.setLinkCategoryForData=function(a,b){return this.diagram.model.dr(a,b)};Eq.prototype.setFromNodeForLink=function(a,b){var c=this.diagram.model;c.Aw(a.data,c.ja(null!==b?b.data:null))};Eq.prototype.setToNodeForLink=function(a,b){var c=this.diagram.model;c.Fw(a.data,c.ja(null!==b?b.data:null))};Eq.prototype.removeDataForLink=function(a){this.diagram.model.Lm(a.data)};
Eq.prototype.findPartForKey=function(a){var b=ti.prototype.findPartForKey.call(this,a);return null===b&&(a=this.diagram.model.Dg(a),null!==a)?this.Se.H(a):b};Eq.prototype.findLinkForKey=function(a){if(null===a||void 0===a)return null;a=this.diagram.model.Dg(a);return null!==a?this.Se.H(a):null};
Eq.prototype.doModelChanged=function(a){var b=this;ti.prototype.doModelChanged.call(this,a);if(this.diagram){var c=this.diagram;if(a.model===c.model){var d=a.change;if(c.Z){c.Z=!1;try{var e=a.modelChange;if(""!==e)if(d===ve){if("linkFromKey"===e){var f=this.xc(a.object);if(null!==f){var g=this.Cb(a.newValue);f.fromNode=g}}else if("linkToKey"===e){var h=this.xc(a.object);if(null!==h){var k=this.Cb(a.newValue);h.toNode=k}}else if("linkFromPortId"===e){var l=this.xc(a.object);if(null!==l){var m=a.newValue;
"string"===typeof m&&(l.fromPortId=m)}}else if("linkToPortId"===e){var n=this.xc(a.object);if(null!==n){var p=a.newValue;"string"===typeof p&&(n.toPortId=p)}}else if("nodeGroupKey"===e){var r=this.yc(a.object);if(null!==r){var q=a.newValue;if(void 0!==q){var u=this.Cb(q);u instanceof vf?r.containingGroup=u:r.containingGroup=null}else r.containingGroup=null}}else if("linkLabelKeys"===e){var v=this.xc(a.object);if(null!==v){var w=a.oldValue,y=a.newValue;Array.isArray(w)&&w.forEach(function(a){0<=y.indexOf(a)||
(a=b.Cb(a),null!==a&&(a.labeledLink=null))});Array.isArray(y)&&y.forEach(function(a){a=b.Cb(a);null!==a&&(a.labeledLink=v)})}}else if("linkCategory"===e){var z=this.xc(a.object),A=a.newValue;null!==z&&"string"===typeof A&&(z.category=A)}else"linkDataArray"===e&&(Jq(this,a.oldValue),Fq(this,a.newValue));c.isModified=!0}else if(d===xe){var C=a.newValue;if("linkDataArray"===e&&"object"===typeof C&&null!==C)Gq(this,C);else if("linkLabelKeys"===e&&Kq(C)){var G=this.xc(a.object),L=this.Cb(C);null!==G&&
null!==L&&(L.labeledLink=G)}c.isModified=!0}else{if(d===ye){var I=a.oldValue;if("linkDataArray"===e&&"object"===typeof I&&null!==I)this.ar(I);else if("linkLabelKeys"===e&&Kq(I)){var T=this.Cb(I);null!==T&&(T.labeledLink=null)}c.isModified=!0}}else if(d===ve){var R=a.propertyName;a.object!==c.model||"linkFromKeyProperty"!==R&&"linkToKeyProperty"!==R&&"linkFromPortIdProperty"!==R&&"linkToPortIdProperty"!==R&&"linkLabelKeysProperty"!==R&&"nodeIsGroupProperty"!==R&&"nodeGroupKeyProperty"!==R&&"linkCategoryProperty"!==
R||c.undoManager.isUndoingRedoing||this.Ed();c.isModified=!0}}finally{c.Z=!0}}}}};Eq.prototype.refreshDataBoundLinks=function(){var a=this,b=this.diagram.model,c=new F,d=b.linkDataArray;d.forEach(function(a){c.add(a)});var e=[];this.links.each(function(a){null===a.data||c.contains(a.data)||e.push(a.data)});e.forEach(function(a){Lq(b,a,!1)});d.forEach(function(c){null===a.xc(c)&&Mq(b,c,!1)})};
Eq.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 S){var e=Iq(d,b,!0);e=c.Cb(e);a.fromNode=e;e=Iq(d,b,!1);e=c.Cb(e);a.toNode=e;b=d.Bf(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.ja(f.data)===e)return}e=(new F).addAll(b);var g=new F;a.labelNodes.each(function(a){null!==a.data&&(a=d.ja(a.data),void 0!==a&&g.add(a))});b=g.copy();b.$q(e);e=
e.copy();e.$q(g);if(0<b.count||0<e.count)b.each(function(b){b=c.Cb(b);null!==b&&b.labeledLink===a&&(b.labeledLink=null)}),e.each(function(b){b=c.Cb(b);null!==b&&b.labeledLink!==a&&(b.labeledLink=a)})}}else!(a instanceof He)&&(b=d.Lh(b),b=c.findPartForKey(b),null===b||b instanceof vf)&&(a.containingGroup=b)}}};
Eq.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.ja(a);if(void 0!==c){var d=Nq(b,c),e=this.yc(a);if(null!==d&&null!==e){d=d.iterator;for(var f={};d.next();){var g=d.value;b.Za(g)?e instanceof vf&&b.Lh(g)===c&&(g=this.yc(g),null!==g&&(g.containingGroup=e)):(f.link=this.xc(g),null!==f.link&&e instanceof V&&(Iq(b,g,!0)===c&&(f.link.fromNode=e),Iq(b,g,!1)===c&&(f.link.toNode=e),g=b.Bf(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}}Oq(b,c)}a=b.Lh(a);void 0!==a&&(a=this.Cb(a),a instanceof vf&&(e.containingGroup=a))}};Eq.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof V){var c=b.ja(a.data);if(void 0!==c){for(var d=a.linksConnected;d.next();)Pq(b,c,d.value.data);a.isLinkLabel&&(d=a.labeledLink,null!==d&&Pq(b,c,d.data));if(a instanceof vf)for(a=a.memberParts;a.next();)d=a.value.data,b.Za(d)&&Pq(b,c,d)}}};
Eq.prototype.copyPartData=function(a,b){var c=ti.prototype.copyPartData.call(this,a,b);if(a instanceof S)if(a=a.data,null!==a&&null!==b){var d=b.model;a=d.yq(a);"object"===typeof a&&null!==a&&(d.bj(a),c=b.xc(a))}else null!==c&&(b=this.diagram,null!==a&&null!==b&&null!==b.commandHandler&&b.commandHandler.copiesClipboardData&&(b=b.model.yq(a),"object"===typeof b&&null!==b&&(c.data=b)));return c};
Eq.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 S){if(xg(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&&(xg(a),a=a.copy(),null!==a&&(a.labeledLink=f,e.add(a))),f}else if(null!==d&&(d=f.yq(d),"object"===
typeof d&&null!==d))return null!==a&&Qq(f,d,f.ja(a.data),!0),Rq(f,d,h,!0),null!==c&&Qq(f,d,f.ja(c.data),!1),Rq(f,d,b,!1),f.bj(d),a=g.archetypeLabelNodeData,null===a||a instanceof V||(a=f.copyNodeData(a),"object"===typeof a&&null!==a&&(f.uf(a),a=f.ja(a),void 0!==a&&f.Dv(d,a))),e.xc(d);return null};Eq.prototype.findLinkForKey=Eq.prototype.findLinkForKey;Eq.prototype.findPartForKey=Eq.prototype.findPartForKey;Eq.prototype.removeAllModeledParts=Eq.prototype.removeAllModeledParts;
Eq.prototype.addModeledParts=Eq.prototype.addModeledParts;Eq.prototype.addAllModeledParts=Eq.prototype.addAllModeledParts;Eq.className="GraphLinksPartManager";function Sq(){ti.apply(this,arguments);this.qh=null}la(Sq,ti);
function Tq(a,b,c){if(null!==b&&null!==c){var d=a.diagram.toolManager.findTool("Linking"),e=b,f=c;if(a.diagram.isTreePathToChildren)for(b=f.linksConnected;b.next();){if(b.value.toNode===f)return}else for(e=c,f=b,b=e.linksConnected;b.next();)if(b.value.fromNode===e)return;if(null===d||!Pf(d,e,f,null,!0))if(d=a.getLinkCategoryForData(c.data),b=a.findLinkTemplateForCategory(d),null!==b&&(xg(b),b=b.copy(),null!==b)){var g=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;b.Mf=d;
b.lb=c.data;b.fromNode=e;b.toNode=f;a.diagram.add(b);b.lb=null;b.data=c.data;a.diagram.skipsModelSourceBindings=g}}}Sq.prototype.getLinkCategoryForData=function(a){return this.diagram.model.Ot(a)};Sq.prototype.setLinkCategoryForData=function(a,b){this.diagram.model.ku(a,b)};
Sq.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.be(a.data,d.ja(b));else{var e=this.qh;this.qh=a;null!==c&&d.be(c.data,void 0);d.be(b,d.ja(null!==a.toNode?a.toNode.data:null));this.qh=e}};
Sq.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.qh;this.qh=a;null!==c&&d.be(c.data,void 0);d.be(b,d.ja(null!==a.fromNode?a.fromNode.data:null));this.qh=e}else d.be(a.data,d.ja(b))};Sq.prototype.removeDataForLink=function(a){this.diagram.model.be(a.data,void 0)};
Sq.prototype.findLinkForKey=function(a){if(null===a||void 0===a)return null;a=this.diagram.model.Kb(a);return null!==a?this.Se.H(a):null};
Sq.prototype.doModelChanged=function(a){ti.prototype.doModelChanged.call(this,a);if(this.diagram){var b=this.diagram;if(a.model===b.model){var c=a.change;if(b.Z){b.Z=!1;try{var d=a.modelChange;if(""!==d){if(c===ve){if("nodeParentKey"===d){var e=a.object,f=this.Cb(a.newValue),g=this.gj(e);if(null!==this.qh)null!==f&&(this.qh.data=e,this.qh.category=this.getLinkCategoryForData(e));else if(null!==g){var h=g.jj();null!==h?null===f?b.remove(h):b.isTreePathToChildren?h.fromNode=f:h.toNode=f:Tq(this,f,g)}}else if("parentLinkCategory"===
d){var k=this.gj(a.object),l=a.newValue;if(null!==k&&"string"===typeof l){var m=k.jj();null!==m&&(m.category=l)}}b.isModified=!0}}else if(c===ve){var n=a.propertyName;a.object===b.model&&"nodeParentKeyProperty"===n&&(b.undoManager.isUndoingRedoing||this.Ed());b.isModified=!0}}finally{b.Z=!0}}}}};
Sq.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.Mh(b),b=c.Cb(b),d=a.Fg(),b!==d&&(d=a.jj(),null!==b?null!==d?c.isTreePathToChildren?d.fromNode=b:d.toNode=b:Tq(this,b,a):null!==d&&Lj(c,d,!1)))}}};Sq.prototype.updateDataBindings=function(a,b){ti.prototype.updateDataBindings.call(this,a,b);"string"===typeof b&&null!==this.yc(a)&&(a=this.xc(a),null!==a&&a.Ca(b))};
Sq.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.ja(a);if(void 0!==c){var d=Nq(b,c),e=this.yc(a);if(null!==d&&null!==e){for(d=d.iterator;d.next();){var f=d.value;b.Za(f)&&e instanceof V&&b.Mh(f)===c&&Tq(this,e,this.gj(f))}Oq(b,c)}a=b.Mh(a);void 0!==a&&e instanceof V&&(a=this.Cb(a),Tq(this,a,e))}};
Sq.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof V){var c=b.ja(a.data),d=this.xc(a.data);if(null!==d){d.isSelected=!1;d.isHighlighted=!1;var e=d.layer;if(null!==e){var f=e.Kc(-1,d,!1);0<=f&&this.diagram.ab(ye,"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.Za(e)&&Pq(b,c,e)}};
Sq.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.be(e.data,b.ja(d.data)),e.jj()):null};Sq.prototype.findLinkForKey=Sq.prototype.findLinkForKey;Sq.className="TreePartManager";
function Z(a){this.Ni=new F;this.Ki=new F;this.su=',\n  "insertedNodeKeys": ';this.jx=',\n  "modifiedNodeData": ';this.uu=',\n  "removedNodeKeys": ';this.Yh=null;Ya(this);this.Kn=this.Qa="";this.$f=!1;this.l={};this.Fc=[];this.Va=new H;this.Mi="key";this.bl=this.Jl=null;this.Bn=this.Cn=!1;this.En=!0;this.hn=null;this.Vj="category";this.Sf=new H;this.bv=new E;this.ug=!1;this.v=null;this.undoManager=new Ae;void 0!==a&&(this.nodeDataArray=a)}
Z.prototype.cloneProtected=function(a){a.Qa=this.Qa;a.Kn=this.Kn;a.$f=this.$f;a.Mi=this.Mi;a.Jl=this.Jl;a.bl=this.bl;a.Cn=this.Cn;a.Bn=this.Bn;a.En=this.En;a.hn=this.hn;a.Vj=this.Vj};Z.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};Z.prototype.clear=function(){this.Fc=[];this.Va.clear();this.Sf.clear();this.undoManager.clear()};
Z.prototype.toString=function(a){void 0===a&&(a=0);if(1<a)return this.hr();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.ja(e)+":"+Ja(e)}}return b};
Z.prototype.$A=function(a){a.change!==we&&B("Model.toIncrementalData argument is not a Transaction ChangedEvent:"+a.toString());var b=a.object;if(!(a.isTransactionFinished&&b instanceof ze))return null;Uq(this,b);a=this.Ww(b,"FinishedUndo"===a.propertyName);this.Yh=null;return a};
Z.prototype.Ww=function(a,b){var c=this,d=!1,e=new F,f=new F,g=new F,h=this.Yh;a.changes.each(function(a){a.model===c&&("nodeDataArray"===a.modelChange?a.change===xe?e.add(a.newValue):a.change===ye&&g.add(a.oldValue):c.Za(a.object)?f.add(a.object):a.change!==ve||c.modelData!==a.object&&"modelData"!==a.propertyName?null!==a.object&&(h&&h.contains(a.object)?h.get(a.object).each(function(a){c.Za(a)&&f.add(a)}):a.object instanceof Z||c.pj()&&c.wc(a.object)||Vq(c,a.object).each(function(a){f.add(a)})):
d=!0)});var k=this.Ki;k.clear();e.each(function(a){k.add(c.ja(a));b||f.add(a)});var l=this.Ni;l.clear();g.each(function(a){l.add(c.ja(a));b&&f.add(a)});a=c.cloneDeep(f.ma());var m=null;d&&(null===m&&(m={}),m.modelData=this.cloneDeep(this.modelData));0<k.count&&(null===m&&(m={}),b?m.removedNodeKeys=k.ma():m.insertedNodeKeys=k.ma());0<a.length&&(null===m&&(m={}),m.modifiedNodeData=a);0<l.count&&(null===m&&(m={}),b?m.insertedNodeKeys=l.ma():m.removedNodeKeys=l.ma());l.clear();k.clear();return m};
Z.prototype.cloneDeep=function(a){return Wq(this,a,!0)};
function Wq(a,b,c,d,e,f){function g(a,c){h?(void 0===a.__gohashid&&f.push(a),d.set(a,c)):(a=qb++,d.set(a,c),e.set(a,b))}if(!ya(b))return b;f||(f=[]);var h=Object.isExtensible(b);d||(d=new H);if(h){var k=d.get(b);if(k)return k}else for(e||(e=new H),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(Wq(a,b[m],!1,d,e,f))}else if(b instanceof J||b instanceof M||b instanceof N||b instanceof pc||b instanceof P)k=b.copy(),
g(b,k);else{if(b instanceof tl||b instanceof td||b instanceof D)return b;if(b instanceof E)k=(new E).addAll(Wq(a,b.ma(),!1,d,e,f)),g(b,k);else if(b instanceof F)k=(new F).addAll(Wq(a,b.ma(),!1,d,e,f)),g(b,k);else if(b instanceof H)k=(new H).addAll(Wq(a,b.ma(),!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]=Wq(a,b[m],!1,d,e,f))}c&&f.forEach(function(a){delete a.__gohashid});return k}t=Z.prototype;
t.Nk=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.Yq=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 Xq(a){return',\n  "modelData": '+Yq(a,a.modelData)}
function Zq(a,b){b=b.modelData;ya(b)&&(a.Nm(b),a.modelData=b)}t.Xw=function(){var a=this.modelData,b=!1,c;for(c in a)if(!$q(c,a[c])){b=!0;break}a="";b&&(a=Xq(this));return a+',\n  "nodeDataArray": '+ar(this,this.nodeDataArray,!0)};t.ow=function(a){Zq(this,a);a=a.nodeDataArray;Aa(a)&&(this.Nm(a),this.nodeDataArray=a)};
function br(a,b,c,d){if(b===c)return!0;if(typeof b!==typeof c||"function"===typeof b||"function"===typeof c)return!1;if(Array.isArray(b)&&Array.isArray(c)){if(d.H(b)===c)return!0;d.add(b,c);if(b.length!==c.length)return!1;for(var e=0;e<b.length;e++)if(!br(a,b[e],c[e],d))return!1;return!0}if(ya(b)&&ya(c)){if(d.H(b)===c)return!0;d.add(b,c);for(var f in b){var g=b[f];if(!$q(f,g)){var h=c[f];if(void 0===h||!br(a,g,h,d))return!1}}for(e in c)if(f=c[e],!$q(e,f)&&(g=b[e],void 0===g||!br(a,g,f,d)))return!1;
return!0}return!1}function cr(a,b,c){a[c]!==b[c]&&B("Model.computeJsonDifference: Model."+c+' is not the same in both models: "'+a[c]+'" and "'+b[c]+'"')}
t.mr=function(a){cr(this,a,"nodeKeyProperty");var b=this.Ki;b.clear();var c=new F,d=this.Ni;d.clear();d.addAll(this.Va.iteratorKeys);for(var e=new H,f=a.nodeDataArray,g=f.length,h=0;h<g;h++){var k=f[h],l=a.ja(k);if(void 0!==l){d.remove(l);var m=this.Kb(l);null===m?(b.add(l),c.add(k)):br(this,m,k,e)||c.add(k)}else this.Yt(k),l=this.ja(k),b.add(l),c.add(k)}f="";br(this,this.modelData,a.modelData,e)||(f+=Xq(this));0<b.count&&(f+=this.su+ar(this,b.ma(),!0));0<c.count&&(f+=this.jx+ar(this,c.ma(),!0));
0<d.count&&(f+=this.uu+ar(this,d.ma(),!0));d.clear();b.clear();return f};t.yz=function(a,b){void 0===b&&(b=dr(this,this));return'{ "class": '+this.quote(b)+', "incremental": 1'+this.Nk()+this.mr(a)+"}"};
function Uq(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 F,c.add(b),d.add(a,c)):c.add(b)}}var d=a.Yh;null===d&&(d=new H,b.changes.each(function(a){if(null!==a.diagram){var b=a.change;if(b===ve)(a=a.object.panel)&&(b=a.data)&&c(b,a);else if(b===xe||b===ye)a=a.object,(b=a.itemArray)&&c(b,a)}}),a.Yh=d)}function Vq(a,b){for(var c=new F,d=0;d<a.nodeDataArray.length;d++){var e=a.nodeDataArray[d];er(a,b,e,e,c)}return c}
function er(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(er(a,b,g,d,e))return!0}else if(ya(c)&&Object.getPrototypeOf(c)===Object.prototype)for(f in c){g=c[f];if(g===b)return e.add(d),!0;if(er(a,b,g,d,e))return!0}return!1}
t.Vw=function(a,b){var c=this,d=!1,e=new F,f=new F,g=new F,h=this.Yh;a.changes.each(function(a){a.model===c&&("nodeDataArray"===a.modelChange?a.change===xe?e.add(a.newValue):a.change===ye&&g.add(a.oldValue):c.Za(a.object)?f.add(a.object):a.change!==ve||c.modelData!==a.object&&"modelData"!==a.propertyName?null!==a.object&&(h&&h.contains(a.object)?h.get(a.object).each(function(a){c.Za(a)&&f.add(a)}):a.object instanceof Z||c.pj()&&c.wc(a.object)||Vq(c,a.object).each(function(a){f.add(a)})):d=!0)});var k=
this.Ki;k.clear();e.each(function(a){k.add(c.ja(a));b||f.add(a)});var l=this.Ni;l.clear();g.each(function(a){l.add(c.ja(a));b&&f.add(a)});a="";d&&(a+=Xq(this));0<k.count&&(a+=(b?this.uu:this.su)+ar(this,k.ma(),!0));0<f.count&&(a+=this.jx+ar(this,f.ma(),!0));0<l.count&&(a+=(b?this.su:this.uu)+ar(this,l.ma(),!0));l.clear();k.clear();return a};
t.Xq=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)&&
B("applyIncrementalJson cannot change Model properties");Zq(this,a);var b=a.insertedNodeKeys,c=a.modifiedNodeData,d=new H;if(Array.isArray(c))for(var e=0;e<c.length;e++){var f=c[e],g=this.ja(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.Kb(g);null===h&&(h=(h=d.get(g))?h:this.copyNodeData({}),this.Um(h,g),this.uf(h))}if(Array.isArray(c))for(b=c.length,d=0;d<b;d++)if(e=c[d],f=this.ja(e),f=this.Kb(f),null!==f){for(var k in e)"__gohashid"===k||k===
this.nodeKeyProperty||this.xk()&&k===this.nodeIsGroupProperty||this.setDataProperty(f,k,e[k]);this.Vm(e,f)}a=a.removedNodeKeys;if(Array.isArray(a))for(c=a.length,k=0;k<c;k++)b=this.Kb(a[k]),null!==b&&this.Mm(b)};
t.Vy=function(a,b){a.change!==we&&B("Model.toIncrementalJson argument is not a Transaction ChangedEvent:"+a.toString());var c=a.object;if(!(a.isTransactionFinished&&c instanceof ze))return'{ "incremental": 0 }';void 0===b&&(b=dr(this,this));Uq(this,c);a=this.Vw(c,"FinishedUndo"===a.propertyName);this.Yh=null;return"2"===b?'{ "incremental": 2'+a+"}":'{ "class": '+this.quote(b)+', "incremental": 1'+this.Nk()+a+"}"};t.aB=function(a,b){return this.Vy(a,b)};
t.hr=function(a){void 0===a&&(a=dr(this,this));return'{ "class": '+this.quote(a)+this.Nk()+this.Xw()+"}"};t.toJSON=function(a){return this.hr(a)};t.Wx=function(a){var b=null;if("string"===typeof a)try{b=x.JSON.parse(a)}catch(d){}else"object"===typeof a?b=a:B("Unable to modify a Model from: "+a);var c=b.incremental;"number"!==typeof c&&B("Unable to apply non-incremental changes to Model: "+a);0!==c&&(this.va("applyIncrementalJson"),this.Xq(b),this.Wa("applyIncrementalJson"))};t.pz=function(a){return this.Wx(a)};
Z.constructGraphLinksModel=function(){return new Z};t=Z.prototype;
t.Nm=function(a){if(Aa(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];if(ya(d)){var e=c;d=this.Nm(d);Array.isArray(a)?a[e]=d:B("Cannot replace an object in an HTMLCollection or NodeList at "+e)}}else if(ya(a)){for(c in a)if(e=a[c],ya(e)&&(e=this.Nm(e),a[c]=e,"points"===c&&Array.isArray(e))){d=0===e.length%2;for(var f=0;f<e.length;f++)if("number"!==typeof e[f]){d=!1;break}if(d){d=new E;for(f=0;f<e.length/2;f++)d.add(new J(e[2*f],e[2*f+1]));d.freeze();a[c]=d}}if("object"===typeof a){c=a;e=a["class"]||
"";0===e.indexOf("go.")&&(e=e.substr(3));if("NaN"===e)c=NaN;else if("Date"===e)c=new Date(a.value);else if("Point"===e)c=new J(fr(a.x),fr(a.y));else if("Size"===e)c=new M(fr(a.width),fr(a.height));else if("Rect"===e)c=new N(fr(a.x),fr(a.y),fr(a.width),fr(a.height));else if("Margin"===e)c=new pc(fr(a.top),fr(a.right),fr(a.bottom),fr(a.left));else if("Spot"===e)"string"===typeof a["enum"]?c=md(a["enum"]):c=new P(fr(a.x),fr(a.y),fr(a.offsetX),fr(a.offsetY));else if("Brush"===e){if(c=new tl,c.type=Za(tl,
a.type),"string"===typeof a.color&&(c.color=a.color),a.start instanceof P&&(c.start=a.start),a.end instanceof P&&(c.end=a.end),"number"===typeof a.startRadius&&(c.startRadius=fr(a.startRadius)),"number"===typeof a.endRadius&&(c.endRadius=fr(a.endRadius)),a=a.colorStops,ya(a))for(b in a)c.addColorStop(parseFloat(b),a[b])}else"Geometry"===e?(b=null,"string"===typeof a.path?b=Jd(a.path):b=new td,b.type=Za(td,a.type),"number"===typeof a.startX&&(b.startX=fr(a.startX)),"number"===typeof a.startY&&(b.startY=
fr(a.startY)),"number"===typeof a.endX&&(b.endX=fr(a.endX)),"number"===typeof a.endY&&(b.endY=fr(a.endY)),a.spot1 instanceof P&&(b.spot1=a.spot1),a.spot2 instanceof P&&(b.spot2=a.spot2),c=b):"EnumValue"===e&&(b=a.classType,0===b.indexOf("go.")&&(b=b.substr(3)),b=gr(b),"function"===typeof b&&(c=Za(b,a.name)));a=c}}return a};
t.quote=function(a){for(var b="",c=a.length,d=0;d<c;d++){var e=a[d];if('"'===e||"\\"===e)b+="\\"+e;else if("\b"===e)b+="\\b";else if("\f"===e)b+="\\f";else if("\n"===e)b+="\\n";else if("\r"===e)b+="\\r";else if("\t"===e)b+="\\t";else{var f=a.charCodeAt(d);b=16>f?b+("\\u000"+a.charCodeAt(d).toString(16)):32>f?b+("\\u00"+a.charCodeAt(d).toString(16)):8232===f?b+"\\u2028":8233===f?b+"\\u2029":b+e}}return'"'+b+'"'};
t.$m=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.$m(a.valueOf()):Aa(a)?ar(this,a):ya(a)?Yq(this,a):"function"===typeof a?"null":a.toString()};
function ar(a,b,c){void 0===c&&(c=!1);var d=b.length;if(0>=d)return"[]";var e=new $a;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.$m(g)))}c&&1<d&&e.add("\n");e.add(" ]");return e.toString()}function $q(a,b){return void 0===b||"__gohashid"===a||"_"===a[0]||"function"===typeof b?!0:!1}function hr(a){return isNaN(a)?"NaN":Infinity===a?"9e9999":-Infinity===a?"-9e9999":a}
function Yq(a,b){var c=b;if(c instanceof J)b={"class":"go.Point",x:hr(c.x),y:hr(c.y)};else if(c instanceof M)b={"class":"go.Size",width:hr(c.width),height:hr(c.height)};else if(c instanceof N)b={"class":"go.Rect",x:hr(c.x),y:hr(c.y),width:hr(c.width),height:hr(c.height)};else if(c instanceof pc)b={"class":"go.Margin",top:hr(c.top),right:hr(c.right),bottom:hr(c.bottom),left:hr(c.left)};else if(c instanceof P)c.ib()?b={"class":"go.Spot",x:hr(c.x),y:hr(c.y),offsetX:hr(c.offsetX),offsetY:hr(c.offsetY)}:
b={"class":"go.Spot","enum":c.toString()};else if(c instanceof tl){b={"class":"go.Brush",type:c.type.name};if(c.type===wl)b.color=c.color;else if(c.type===zl||c.type===ul)b.start=c.start,b.end=c.end,c.type===ul&&(0!==c.startRadius&&(b.startRadius=hr(c.startRadius)),isNaN(c.endRadius)||(b.endRadius=hr(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 td?(b={"class":"go.Geometry",type:c.type.name},0!==c.startX&&(b.startX=
hr(c.startX)),0!==c.startY&&(b.startY=hr(c.startY)),0!==c.endX&&(b.endX=hr(c.endX)),0!==c.endY&&(b.endY=hr(c.endY)),c.spot1.w(wc)||(b.spot1=c.spot1),c.spot2.w(Hc)||(b.spot2=c.spot2),c.type===ud&&(b.path=zd(c))):c instanceof D&&(b={"class":"go.EnumValue",classType:dr(a,c.classType),name:c.name});d="{";c=!0;for(var e in b){var f=qn(b,e);if(!$q(e,f))if(c?c=!1:d+=", ",d+='"'+e+'":',"points"===e&&f instanceof E){var g="[";for(f=f.iterator;f.next();){var h=f.value;1<g.length&&(g+=",");g+=a.$m(h.x);g+=",";
g+=a.$m(h.y)}g+="]";d+=g}else d+=a.$m(f)}return d+"}"}function fr(a){return"number"===typeof a?a:"NaN"===a?NaN:"9e9999"===a?Infinity:"-9e9999"===a?-Infinity:parseFloat(a)}t.Hh=function(a){this.bv.add(a)};t.Kk=function(a){this.bv.remove(a)};t.zt=function(a){this.skipsUndoManager||this.undoManager.$v(a);for(var b=this.bv,c=b.length,d=0;d<c;d++)b.L(d)(a)};t.ab=function(a,b,c,d,e,f,g){ir(this,"",a,b,c,d,e,f,g)};t.g=function(a,b,c,d,e){ir(this,"",ve,a,this,b,c,d,e)};
t.du=function(a,b,c,d,e,f){ir(this,"",ve,b,a,c,d,e,f)};function ir(a,b,c,d,e,f,g,h,k){void 0===h&&(h=null);void 0===k&&(k=null);var l=new ue;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.zt(l)}
Z.prototype.changeState=function(a,b){if(null!==a&&a.model===this)if(a.change===ve){var c=a.object,d=a.propertyName,e=a.H(b);d===this.nodeKeyProperty&&this.Za(c)&&(b=a.H(!b),void 0!==b&&this.Va.remove(b),void 0!==e&&this.Va.add(e,c));Sj(c,d,e)}else a.change===xe?(c=a.newParam,"nodeDataArray"===a.modelChange?(a=a.newValue,ya(a)&&"number"===typeof c&&(d=this.ja(a),b?(this.Fc[c]===a&&Da(this.Fc,c),void 0!==d&&this.Va.remove(d)):(this.Fc[c]!==a&&Ca(this.Fc,c,a),void 0!==d&&this.Va.add(d,a)))):""===a.modelChange?
((d=a.object)&&!Aa(d)&&a.propertyName&&(d=qn(a.object,a.propertyName)),Aa(d)&&"number"===typeof c&&(a=a.newValue,b?Da(d,c):Ca(d,c,a))):B("unknown ChangedEvent.Insert modelChange: "+a.toString())):a.change===ye?(c=a.oldParam,"nodeDataArray"===a.modelChange?(a=a.oldValue,ya(a)&&"number"===typeof c&&(d=this.ja(a),b?(this.Fc[c]!==a&&Ca(this.Fc,c,a),void 0!==d&&this.Va.add(d,a)):(this.Fc[c]===a&&Da(this.Fc,c),void 0!==d&&this.Va.remove(d)))):""===a.modelChange?((d=a.object)&&!Aa(d)&&a.propertyName&&(d=
qn(a.object,a.propertyName)),Aa(d)&&"number"===typeof c&&(a=a.oldValue,b?Ca(d,c,a):Da(d,c))):B("unknown ChangedEvent.Remove modelChange: "+a.toString())):a.change!==we&&B("unknown ChangedEvent: "+a.toString())};Z.prototype.va=function(a){return this.undoManager.va(a)};Z.prototype.Wa=function(a){return this.undoManager.Wa(a)};Z.prototype.Hf=function(){return this.undoManager.Hf()};
Z.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.va(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.Wa(b):this.undoManager.Hf(),this.skipsUndoManager=c}};t=Z.prototype;t.Ca=function(a,b){void 0===b&&(b="");ir(this,"SourceChanged",we,b,a,null,null)};
t.ja=function(a){if(null!==a){var b=this.Mi;if(""!==b&&(b=qn(a,b),void 0!==b)){if(Kq(b))return b;B("Key value for node data "+a+" is not a number or a string: "+b)}}};t.Um=function(a,b){if(null!==a){var c=this.Mi;if(""!==c)if(this.Za(a)){var d=qn(a,c);d!==b&&null===this.Kb(b)&&(Sj(a,c,b),void 0!==d&&this.Va.remove(d),this.Va.add(b,a),ir(this,"nodeKey",ve,c,a,d,b),"string"===typeof c&&this.Ca(a,c),this.br(d,b))}else Sj(a,c,b)}};function Kq(a){return"number"===typeof a||"string"===typeof a}
t.Za=function(a){var b=this.ja(a);return void 0===b?!1:this.Va.H(b)===a};t.Kb=function(a){null===a&&B("Model.findNodeDataForKey:key must not be null");return void 0!==a&&Kq(a)?this.Va.H(a):null};
t.Yt=function(a){if(null!==a){var b=this.Mi;if(""!==b){var c=this.ja(a);if(void 0===c||this.Va.contains(c)){var d=this.Jl;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.Va.contains(c))){Sj(a,b,c);return}if("string"===typeof c){for(d=2;this.Va.contains(c+d);)d++;Sj(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.Va.count-1;this.Va.contains(c);)c--;Sj(a,b,c)}}}}};t.uf=function(a){null!==a&&(ob(a),this.Za(a)||Cq(this,a,!0))};
function Cq(a,b,c){var d=a.ja(b);if(void 0===d||a.Va.H(d)!==b)a.Yt(b),d=a.ja(b),void 0===d?B("Model.makeNodeDataKeyUnique failed on "+b+".  Data not added to Model."):(a.Va.add(d,b),d=null,c&&(d=a.Fc.length,Ca(a.Fc,d,b)),ir(a,"nodeDataArray",xe,"nodeDataArray",a,null,b,null,d),a.Pm(b),a.Om(b))}t.lz=function(a){if(Aa(a))for(var b=a.length,c=0;c<b;c++)this.uf(a[c]);else for(a=a.iterator;a.next();)this.uf(a.value)};t.Mm=function(a){null!==a&&Bq(this,a,!0)};
function Bq(a,b,c){var d=a.ja(b);void 0!==d&&a.Va.remove(d);d=null;if(c){a:if(c=a.Fc,Array.isArray(c))d=c.indexOf(b);else{d=c.length;for(var e=0;e<d;e++)if(c[e]===b){d=e;break a}d=-1}if(0>d)return;Da(a.Fc,d)}ir(a,"nodeDataArray",ye,"nodeDataArray",a,b,null,d,null);a.jr(b)}t.QA=function(a){if(Aa(a))for(var b=a.length,c=0;c<b;c++)this.Mm(a[c]);else for(a=a.iterator;a.next();)this.Mm(a.value)};
t.GA=function(a){if(a!==this.nodeDataArray&&Aa(a)){var b=this.Ni;b.clear();b.addAll(this.Va.iteratorKeys);var c=this.Ki;c.clear();for(var d=a.length,e=0;e<d;e++){var f=a[e],g=this.ja(f);if(void 0!==g){c.add(g);var h=this.Kb(g);h!==f&&(null!==h?(this.tq(h,f),this.Vm(f,h)):(f=this.cloneDeep(f),this.Um(f,g),this.uf(f)))}else g=this.cloneDeep(f),this.uf(g),c.add(this.ja(g))}for(a=b.iterator;a.next();)d=a.value,c.contains(d)||(d=this.Kb(d))&&this.Mm(d);b.clear();c.clear()}};
t.br=function(a,b){void 0!==b&&(a=Nq(this,a),a instanceof F&&this.Sf.add(b,a))};t.Qw=function(){};t.Pm=function(){};t.Om=function(){};t.jr=function(){};function Pq(a,b,c){if(void 0!==b){var d=a.Sf.H(b);null===d&&(d=new F,a.Sf.add(b,d));d.add(c)}}function Oq(a,b,c){if(void 0!==b){var d=a.Sf.H(b);d instanceof F&&(void 0===c||null===c?a.Sf.remove(b):(d.remove(c),0===d.count&&a.Sf.remove(b)))}}function Nq(a,b){if(void 0===b)return null;a=a.Sf.H(b);return a instanceof F?a:null}
t.xz=function(a){void 0===a?this.Sf.clear():this.Sf.remove(a)};Z.prototype.copyNodeData=function(a){if(null===a)return null;var b=this.bl;a=null!==b?b(a,this):jr(this,a,!0);ya(a)&&Ya(a);return a};
function jr(a,b,c){if(a.copiesArrays&&Array.isArray(b)){var d=[];for(c=0;c<b.length;c++){var e=jr(a,b[c],a.copiesArrayObjects);d.push(e)}Ya(d);return d}if(c&&ya(b)){c=(c=b.constructor)?new c:{};e=a.copiesKey||"string"!==typeof a.nodeKeyProperty?null:a.nodeKeyProperty;for(d in b)if("__gohashid"===d)c.__gohashid=void 0;else if(d===e)c[e]=void 0;else{var f=qn(b,d),g=dr(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 Ae||f instanceof ze||f instanceof ue?Sj(c,d,f):(f=jr(a,f,!1),Sj(c,d,f))}Ya(c);return c}return b instanceof J?b.copy():b instanceof M?b.copy():b instanceof N?b.copy():b instanceof P?b.copy():b instanceof pc?b.copy():b}
Z.prototype.setDataProperty=function(a,b,c){if(this.Za(a)){if(b===this.nodeKeyProperty){this.Um(a,c);return}if(b===this.nodeCategoryProperty){this.Tm(a,c);return}}else!lr&&a instanceof Y&&(lr=!0,wa('Model.setDataProperty is modifying a GraphObject, "'+a.toString()+'"'),wa("  Is that really your intent?"));var d=qn(a,b);d!==c&&(Sj(a,b,c),this.du(a,b,d,c))};t=Z.prototype;t.set=function(a,b,c){this.setDataProperty(a,b,c)};
t.tq=function(a,b){if(b){var c=this.Za(a),d;for(d in b)"__gohashid"===d||c&&d===this.nodeKeyProperty||this.setDataProperty(a,d,b[d])}};t.iz=function(a,b){this.Pt(a,-1,b)};t.Pt=function(a,b,c){0>b&&(b=a.length);Ca(a,b,c);ir(this,"",xe,"",a,null,c,null,b)};t.qw=function(a,b){void 0===b&&(b=-1);a===this.Fc&&B("Model.removeArrayItem should not be called on the Model.nodeDataArray");-1===b&&(b=a.length-1);var c=a[b];Da(a,b);ir(this,"",ye,"",a,c,null,b,null)};
t.Gq=function(a){if(null===a)return"";var b=this.Vj;if(""===b)return"";b=qn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;B("getCategoryForNodeData found a non-string category for "+a+": "+b);return""};t.Tm=function(a,b){if(null!==a){var c=this.Vj;if(""!==c)if(this.Za(a)){var d=qn(a,c);void 0===d&&(d="");d!==b&&(Sj(a,c,b),ir(this,"nodeCategory",ve,c,a,d,b))}else Sj(a,c,b)}};t.Vm=function(a,b){this.Tm(b,this.Gq(a))};t.Am=function(){return!1};t.xk=function(){return!1};t.pj=function(){return!1};
t.Ut=function(){return!1};t.yk=function(){return!1};function wi(){return new Z}function dr(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 dr(a,b.constructor);return typeof b}function gr(a){return mr[a]?mr[a]:void 0!==x.go&&x.go[a]?x.go[a]:null}
function qn(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 Sj(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.Qa},set:function(a){var b=this.Qa;b!==a&&(this.Qa=a,this.g("name",b,a))}},dataFormat:{get:function(){return this.Kn},set:function(a){var b=this.Kn;b!==a&&(this.Kn=a,this.g("dataFormat",b,a))}},isReadOnly:{get:function(){return this.$f},set:function(a){var b=this.$f;b!==a&&(this.$f=a,this.g("isReadOnly",b,a))}},modelData:{
get:function(){return this.l},set:function(a){var b=this.l;b!==a&&(this.l=a,this.g("modelData",b,a),this.Ca(a))}},undoManager:{get:function(){return this.v},set:function(a){var b=this.v;b!==a&&(null!==b&&b.My(this),this.v=a,null!==a&&a.Ux(this))}},skipsUndoManager:{get:function(){return this.ug},set:function(a){this.ug=a}},nodeKeyProperty:{get:function(){return this.Mi},set:function(a){var b=this.Mi;
b!==a&&(""===a&&B("Model.nodeKeyProperty may not be the empty string"),0<this.Va.count&&B("Cannot set Model.nodeKeyProperty when there is existing node data"),this.Mi=a,this.g("nodeKeyProperty",b,a))}},makeUniqueKeyFunction:{get:function(){return this.Jl},set:function(a){var b=this.Jl;b!==a&&(this.Jl=a,this.g("makeUniqueKeyFunction",b,a))}},nodeDataArray:{get:function(){return this.Fc},set:function(a){var b=this.Fc;if(b!==a){this.Va.clear();
this.Qw();for(var c=a.length,d=0;d<c;d++){var e=a[d];if(!ya(e)){B("Model.nodeDataArray must only contain Objects, not: "+e);return}ob(e)}this.Fc=a;d=new E;for(e=0;e<c;e++){var f=a[e],g=this.ja(f);void 0===g?d.add(f):null!==this.Va.H(g)?d.add(f):this.Va.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.Yt(e),f=this.ja(e),void 0!==f&&this.Va.add(f,e);ir(this,"nodeDataArray",ve,"nodeDataArray",this,b,a);for(b=0;b<c;b++)d=a[b],this.Pm(d),this.Om(d);Array.isArray(a)||(this.isReadOnly=!0)}}},copyNodeDataFunction:{
get:function(){return this.bl},set:function(a){var b=this.bl;b!==a&&(this.bl=a,this.g("copyNodeDataFunction",b,a))}},copiesArrays:{get:function(){return this.Cn},set:function(a){var b=this.Cn;b!==a&&(this.Cn=a,this.g("copiesArrays",b,a))}},copiesArrayObjects:{get:function(){return this.Bn},set:function(a){var b=this.Bn;b!==a&&(this.Bn=a,this.g("copiesArrayObjects",b,a))}},copiesKey:{get:function(){return this.En},
set:function(a){var b=this.En;b!==a&&(this.En=a,this.g("copiesKey",b,a))}},afterCopyFunction:{get:function(){return this.hn},set:function(a){var b=this.hn;b!==a&&(this.hn=a,this.g("afterCopyFunction",b,a))}},nodeCategoryProperty:{get:function(){return this.Vj},set:function(a){var b=this.Vj;b!==a&&(this.Vj=a,this.g("nodeCategoryProperty",b,a))}},type:{get:function(){return"Model"}}});
Z.prototype.setCategoryForNodeData=Z.prototype.Tm;Z.prototype.getCategoryForNodeData=Z.prototype.Gq;Z.prototype.removeArrayItem=Z.prototype.qw;Z.prototype.insertArrayItem=Z.prototype.Pt;Z.prototype.addArrayItem=Z.prototype.iz;Z.prototype.assignAllDataProperties=Z.prototype.tq;Z.prototype.set=Z.prototype.set;Z.prototype.clearUnresolvedReferences=Z.prototype.xz;Z.prototype.mergeNodeDataArray=Z.prototype.GA;Z.prototype.removeNodeDataCollection=Z.prototype.QA;Z.prototype.removeNodeData=Z.prototype.Mm;
Z.prototype.addNodeDataCollection=Z.prototype.lz;Z.prototype.addNodeData=Z.prototype.uf;Z.prototype.makeNodeDataKeyUnique=Z.prototype.Yt;Z.prototype.findNodeDataForKey=Z.prototype.Kb;Z.prototype.containsNodeData=Z.prototype.Za;Z.prototype.setKeyForNodeData=Z.prototype.Um;Z.prototype.getKeyForNodeData=Z.prototype.ja;Z.prototype.updateTargetBindings=Z.prototype.Ca;Z.prototype.commit=Z.prototype.commit;Z.prototype.rollbackTransaction=Z.prototype.Hf;Z.prototype.commitTransaction=Z.prototype.Wa;
Z.prototype.startTransaction=Z.prototype.va;Z.prototype.raiseDataChanged=Z.prototype.du;Z.prototype.raiseChanged=Z.prototype.g;Z.prototype.raiseChangedEvent=Z.prototype.ab;Z.prototype.removeChangedListener=Z.prototype.Kk;Z.prototype.addChangedListener=Z.prototype.Hh;Z.prototype.writeJsonValue=Z.prototype.$m;Z.prototype.replaceJsonObjects=Z.prototype.Nm;Z.prototype.applyIncrementalJSON=Z.prototype.pz;Z.prototype.applyIncrementalJson=Z.prototype.Wx;Z.prototype.toJSON=Z.prototype.toJSON;
Z.prototype.toJson=Z.prototype.hr;Z.prototype.toIncrementalJSON=Z.prototype.aB;Z.prototype.toIncrementalJson=Z.prototype.Vy;Z.prototype.computeJsonDifference=Z.prototype.yz;Z.prototype.toIncrementalData=Z.prototype.$A;Z.prototype.clear=Z.prototype.clear;var lr=!1,mr={};Z.className="Model";
Z.fromJSON=Z.fromJson=function(a,b){void 0===b&&(b=null);var c=null;if("string"===typeof a)try{c=x.JSON.parse(a)}catch(f){}else"object"===typeof a?c=a:B("Unable to construct a Model from: "+a);if(null===b){a=null;var d=c["class"];if("string"===typeof d)try{var e=null;0===d.indexOf("go.")?(d=d.substr(3),e=gr(d)):(e=gr(d),null===e&&(e=x[d]));"function"===typeof e&&(a=new e)}catch(f){}null===a||a instanceof Z?b=a:B("Unable to construct a Model of declared class: "+c["class"])}null===b&&(b=Z.constructGraphLinksModel());
b.Yq(c);b.ow(c);return b};Z.safePropertyValue=qn;Z.safePropertySet=Sj;mr.Brush=tl;mr.ChangedEvent=ue;mr.Geometry=td;mr.Margin=pc;mr.Panel=X;mr.Point=J;mr.Rect=N;mr.Size=M;mr.Spot=P;mr.Transaction=ze;mr.UndoManager=Ae;function Li(a,b,c){Ya(this);this.s=!1;void 0===a&&(a="");void 0===b&&(b=a);void 0===c&&(c=null);this.l=-1;this.jd=null;this.jm=a;this.im=this.fq=0;this.ht=null;this.wo=!1;this.bm=b;this.An=c;this.Vo=nr;this.tn=null;this.Nu=new F}
Li.prototype.copy=function(){var a=new Li;a.jm=this.jm;a.fq=this.fq;a.im=this.im;a.ht=this.ht;a.wo=this.wo;a.bm=this.bm;a.An=this.An;a.Vo=this.Vo;a.tn=this.tn;return a};t=Li.prototype;t.hb=function(a){a.classType===Li&&(this.mode=a)};t.toString=function(){return"Binding("+this.targetProperty+":"+this.sourceProperty+(-1!==this.vj?" "+this.vj:"")+" "+this.mode.name+")"};t.freeze=function(){this.s=!0;return this};t.ea=function(){this.s=!1;return this};
t.Fy=function(a){void 0===a&&(a=null);this.mode=jn;this.backConverter=a;return this};t.Uq=function(a){void 0===a&&(a="");this.sourceName=a;this.isToModel=!1;return this};t.IA=function(){this.sourceName=null;this.isToModel=!0;return this};function gl(a,b,c){a=a.sourceName;return null===a||""===a?b:"/"===a?c.part:"."===a?c:".."===a?c.panel:b.$a(a)}
t.Rw=function(a,b,c){var d=this.bm;if(void 0===c||""===d||d===c){c=this.jm;var e=this.An;if(null===e&&""===c)wa("Binding error: target property is the empty string: "+this.toString());else{var f=b;""!==d&&(f=qn(b,d));if(void 0!==f)if(null===e)""!==c&&Sj(a,c,f);else try{if(""!==c){var g=e(f,a);Sj(a,c,g)}else e(f,a)}catch(h){}}}};
t.lr=function(a,b,c,d){if(this.Vo===jn){var e=this.jm;if(void 0===c||e===c){c=this.bm;var f=this.tn,g=a;""!==e&&(g=qn(a,e));if(void 0!==g&&!this.Nu.contains(a))try{this.Nu.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):Sj(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.qw(m,l);k.Pt(m,l,g)}}else try{if(""!==c){var n=f(g,b,k);null!==k?k.setDataProperty(b,
c,n):Sj(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.qw(q,r);k.Pt(q,r,p)}}}catch(u){}}finally{this.Nu.remove(a)}}}};
ma.Object.defineProperties(Li.prototype,{vj:{get:function(){return this.l},set:function(a){this.s&&ua(this);this.l=a}},targetProperty:{get:function(){return this.jm},set:function(a){this.s&&ua(this);this.jm=a}},sourceName:{get:function(){return this.ht},set:function(a){this.s&&ua(this);this.ht=a;null!==a&&(this.wo=!1)}},isToModel:{get:function(){return this.wo},set:function(a){this.s&&
ua(this);this.wo=a}},sourceProperty:{get:function(){return this.bm},set:function(a){this.s&&ua(this);this.bm=a}},converter:{get:function(){return this.An},set:function(a){this.s&&ua(this);this.An=a}},backConverter:{get:function(){return this.tn},set:function(a){this.s&&ua(this);this.tn=a}},mode:{get:function(){return this.Vo},set:function(a){this.s&&ua(this);this.Vo=a}}});
Li.prototype.updateSource=Li.prototype.lr;Li.prototype.updateTarget=Li.prototype.Rw;Li.prototype.ofModel=Li.prototype.IA;Li.prototype.ofObject=Li.prototype.Uq;Li.prototype.makeTwoWay=Li.prototype.Fy;var nr=new D(Li,"OneWay",1),jn=new D(Li,"TwoWay",2);Li.className="Binding";Li.parseEnum=function(a,b){return function(c){c=Za(a,c);return null===c?b:c}};Li.toString=Ja;Li.OneWay=nr;Li.TwoWay=jn;
function or(a,b){Z.call(this);this.ru=',\n  "insertedLinkKeys": ';this.ix=',\n  "modifiedLinkData": ';this.tu=',\n  "removedLinkKeys": ';this.Wc=[];this.ag=new F;this.fb=new H;this.Gi="";this.xj=this.al=this.Kl=null;this.$e="from";this.af="to";this.Sj=this.Rj="";this.Qj="category";this.Td="";this.Ol="isGroup";this.ve="group";this.Dn=!1;void 0!==a&&(this.nodeDataArray=a);void 0!==b&&(this.linkDataArray=b)}la(or,Z);or.constructGraphLinksModel=Z.constructGraphLinksModel;
or.prototype.cloneProtected=function(a){Z.prototype.cloneProtected.call(this,a);a.Gi=this.Gi;a.Kl=this.Kl;a.al=this.al;a.$e=this.$e;a.af=this.af;a.Rj=this.Rj;a.Sj=this.Sj;a.Qj=this.Qj;a.Td=this.Td;a.Ol=this.Ol;a.ve=this.ve;a.Dn=this.Dn};t=or.prototype;t.clear=function(){Z.prototype.clear.call(this);this.Wc=[];this.fb.clear();this.ag.clear()};
t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.hr();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.ja(e)+":"+Ja(e)}b+="\n link data:";a=this.linkDataArray;c=a.length;for(d=0;d<c;d++)e=a[d],b+=" "+Iq(this,e,!0)+"--\x3e"+Iq(this,e,!1)}return b};
t.Ww=function(a,b){""===this.linkKeyProperty&&B("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalData() to succeed.");var c=Z.prototype.Ww.call(this,a,b),d=this,e=new F,f=new F,g=new F,h=this.Yh;a.changes.each(function(a){a.model===d&&("linkDataArray"===a.modelChange?a.change===xe?e.add(a.newValue):a.change===ye&&g.add(a.oldValue):d.wc(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.wc(a)&&f.add(a)}):
a.object instanceof Z||d.Za(a.object)||pr(d,a.object).each(function(a){f.add(a)})))});var k=this.Ki;k.clear();e.each(function(a){k.add(d.Vb(a));b||f.add(a)});var l=this.Ni;l.clear();g.each(function(a){l.add(d.Vb(a));b&&f.add(a)});a=d.cloneDeep(f.ma());0<k.count&&(null===c&&(c={}),b?c.removedLinkKeys=k.ma():c.insertedLinkKeys=k.ma());0<a.length&&(null===c&&(c={}),c.modifiedLinkData=a);0<l.count&&(null===c&&(c={}),b?c.insertedLinkKeys=l.ma():c.removedLinkKeys=l.ma());l.clear();k.clear();return c};
t.Nk=function(){var a=Z.prototype.Nk.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.Yq=function(a){Z.prototype.Yq.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.Xw=function(){var a=Z.prototype.Xw.call(this),b=',\n  "linkDataArray": '+ar(this,this.linkDataArray,!0);return a+b};t.ow=function(a){Z.prototype.ow.call(this,a);a=a.linkDataArray;Array.isArray(a)&&(this.Nm(a),this.linkDataArray=a)};
t.mr=function(a){if(!(a instanceof or))return B("Model.computeJsonDifference: newmodel must be a GraphLinksModel"),"";""===this.linkKeyProperty&&B("GraphLinksModel.linkKeyProperty must not be an empty string for .computeJsonDifference() to succeed.");var b=Z.prototype.mr.call(this,a);cr(this,a,"linkKeyProperty");cr(this,a,"linkFromKeyProperty");cr(this,a,"linkToKeyProperty");cr(this,a,"linkLabelKeysProperty");cr(this,a,"nodeIsGroupProperty");cr(this,a,"nodeGroupKeyProperty");var c=this.Ki;c.clear();
var d=new F,e=this.Ni;e.clear();e.addAll(this.fb.iteratorKeys);for(var f=new H,g=a.linkDataArray,h=g.length,k=0;k<h;k++){var l=g[k],m=a.Vb(l);if(void 0!==m){e.remove(m);var n=this.Dg(m);null===n?(c.add(m),d.add(l)):br(this,n,l,f)||d.add(l)}else this.Rq(l),m=this.Vb(l),c.add(m),d.add(l)}a=b;0<c.count&&(a+=this.ru+ar(this,c.ma(),!0));0<d.count&&(a+=this.ix+ar(this,d.ma(),!0));0<e.count&&(a+=this.tu+ar(this,e.ma(),!0));e.clear();c.clear();return a};
function pr(a,b){for(var c=new F,d=0;d<a.linkDataArray.length;d++){var e=a.linkDataArray[d];er(a,b,e,e,c)}return c}
t.Vw=function(a,b){""===this.linkKeyProperty&&B("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalJson() to succeed.");var c=Z.prototype.Vw.call(this,a,b),d=this,e=new F,f=new F,g=new F,h=this.Yh;a.changes.each(function(a){a.model===d&&("linkDataArray"===a.modelChange?a.change===xe?e.add(a.newValue):a.change===ye&&g.add(a.oldValue):d.wc(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.wc(a)&&f.add(a)}):
a.object instanceof Z||d.Za(a.object)||pr(d,a.object).each(function(a){f.add(a)})))});var k=this.Ki;k.clear();e.each(function(a){k.add(d.Vb(a));b||f.add(a)});var l=this.Ni;l.clear();g.each(function(a){l.add(d.Vb(a));b&&f.add(a)});a=c;0<k.count&&(a+=(b?this.tu:this.ru)+ar(this,k.ma(),!0));0<f.count&&(a+=this.ix+ar(this,f.ma(),!0));0<l.count&&(a+=(b?this.ru:this.tu)+ar(this,l.ma(),!0));l.clear();k.clear();return a};
t.Xq=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)&&B("applyIncrementalJson cannot change Model properties");Z.prototype.Xq.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.Dg(e);null===f&&(f=this.yq({}),this.iu(f,e),this.bj(f))}b=a.modifiedLinkData;
if(Array.isArray(b))for(c=b.length,d=0;d<c;d++)if(e=b[d],f=this.Vb(e),f=this.Dg(f),null!==f){for(var g in e)"__gohashid"!==g&&g!==this.linkKeyProperty&&this.setDataProperty(f,g,e[g]);qr(this,e,f)}a=a.removedLinkKeys;if(Array.isArray(a))for(g=a.length,b=0;b<g;b++)c=this.Dg(a[b]),null!==c&&this.Lm(c)};
or.prototype.changeState=function(a,b){if(null!==a&&a.model===this){if(a.change===ve){var c=a.object,d=a.propertyName;if(d===this.linkKeyProperty&&this.wc(c)){var e=a.H(b);b=a.H(!b);void 0!==b&&this.fb.remove(b);void 0!==e&&this.fb.add(e,c);Sj(c,d,e);return}}else if(a.change===xe){c=a.newParam;if("linkDataArray"===a.modelChange){a=a.newValue;ya(a)&&"number"===typeof c&&(d=this.Vb(a),b?(this.ag.remove(a),this.Wc[c]===a&&this.Wc.splice(c,1),void 0!==d&&this.fb.remove(d)):(this.ag.add(a),this.Wc[c]!==
a&&this.Wc.splice(c,0,a),void 0!==d&&this.fb.add(d,a)));return}if("linkLabelKeys"===a.modelChange){d=this.Bf(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===ye){c=a.oldParam;if("linkDataArray"===a.modelChange){a=a.oldValue;ya(a)&&"number"===typeof c&&(d=this.Vb(a),b?(this.ag.add(a),this.Wc[c]!==a&&this.Wc.splice(c,0,a),void 0!==d&&this.fb.add(d,a)):(this.ag.remove(a),this.Wc[c]===
a&&this.Wc.splice(c,1),void 0!==d&&this.fb.remove(d)));return}if("linkLabelKeys"===a.modelChange){d=this.Bf(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=or.prototype;t.Cm=function(a){if(void 0!==a){var b=this.xj;if(null!==b){var c=this.Kb(a);null===c&&(c=this.copyNodeData(b),Sj(c,this.nodeKeyProperty,a),this.uf(c))}return a}};
t.uy=function(a){return Iq(this,a,!0)};t.Aw=function(a,b){Qq(this,a,b,!0)};t.xy=function(a){return Iq(this,a,!1)};t.Fw=function(a,b){Qq(this,a,b,!1)};function Iq(a,b,c){if(null!==b&&(a=c?a.$e:a.af,""!==a&&(a=qn(b,a),void 0!==a))){if(Kq(a))return a;B((c?"FromKey":"ToKey")+" value for link data "+b+" is not a number or a string: "+a)}}
function Qq(a,b,c,d){null===c&&(c=void 0);if(null!==b){var e=d?a.$e:a.af;if(""!==e)if(c=a.Cm(c),a.wc(b)){var f=qn(b,e);f!==c&&(Oq(a,f,b),Sj(b,e,c),null===a.Kb(c)&&Pq(a,c,b),ir(a,d?"linkFromKey":"linkToKey",ve,e,b,f,c),"string"===typeof e&&a.Ca(b,e))}else Sj(b,e,c)}}t.vy=function(a){return Hq(this,a,!0)};t.Bw=function(a,b){Rq(this,a,b,!0)};t.yy=function(a){return Hq(this,a,!1)};t.Gw=function(a,b){Rq(this,a,b,!1)};
function Hq(a,b,c){if(null===b)return"";a=c?a.Rj:a.Sj;if(""===a)return"";b=qn(b,a);return void 0===b?"":b}function Rq(a,b,c,d){if(null!==b){var e=d?a.Rj:a.Sj;if(""!==e)if(a.wc(b)){var f=qn(b,e);void 0===f&&(f="");f!==c&&(Sj(b,e,c),ir(a,d?"linkFromPortId":"linkToPortId",ve,e,b,f,c),"string"===typeof e&&a.Ca(b,e))}else Sj(b,e,c)}}t.Bf=function(a){if(null===a)return rr;var b=this.Td;if(""===b)return rr;a=qn(a,b);return void 0===a?rr:a};
t.ju=function(a,b){if(null!==a){var c=this.Td;if(""!==c)if(this.wc(a)){var d=qn(a,c);void 0===d&&(d=rr);if(d!==b){if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)Oq(this,d[f],a);Sj(a,c,b);e=b.length;for(f=0;f<e;f++){var g=b[f];null===this.Kb(g)&&Pq(this,g,a)}ir(this,"linkLabelKeys",ve,c,a,d,b);"string"===typeof c&&this.Ca(a,c)}}else Sj(a,c,b)}};
t.Dv=function(a,b){if(null!==b&&void 0!==b&&null!==a){var c=this.Td;if(""!==c){var d=qn(a,c);if(void 0===d)c=[],c.push(b),this.ju(a,c);else if(Array.isArray(d)){var e=d.indexOf(b);0<=e||(e=d.length,d.push(b),this.wc(a)&&(null===this.Kb(b)&&Pq(this,b,a),ir(this,"linkLabelKeys",xe,c,a,null,b,null,e)))}else B(c+" property is not an Array; cannot addLabelKeyForLinkData: "+a)}}};
t.Ly=function(a,b){if(null!==b&&void 0!==b&&null!==a){var c=this.Td;if(""!==c){var d=qn(a,c);if(Array.isArray(d)){var e=d.indexOf(b);0>e||(d.splice(e,1),this.wc(a)&&(Oq(this,b,a),ir(this,"linkLabelKeys",ye,c,a,b,null,e,null)))}else void 0!==d&&B(c+" property is not an Array; cannot removeLabelKeyforLinkData: "+a)}}};t.Vb=function(a){if(null!==a){var b=this.Gi;if(""!==b&&(b=qn(a,b),void 0!==b)){if(Kq(b))return b;B("Key value for link data "+a+" is not a number or a string: "+b)}}};
t.iu=function(a,b){if(null!==a){var c=this.Gi;if(""!==c)if(this.wc(a)){var d=qn(a,c);d!==b&&null===this.Dg(b)&&(Sj(a,c,b),void 0!==d&&this.fb.remove(d),this.fb.add(b,a),ir(this,"linkKey",ve,c,a,d,b),"string"===typeof c&&this.Ca(a,c))}else Sj(a,c,b)}};t.Dg=function(a){null===a&&B("GraphLinksModel.findLinkDataForKey:key must not be null");return void 0!==a&&Kq(a)?this.fb.H(a):null};
t.Rq=function(a){if(null!==a){var b=this.Gi;if(""!==b){var c=this.Vb(a);if(void 0===c||this.fb.contains(c)){var d=this.Kl;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.fb.contains(c))){Sj(a,b,c);return}if("string"===typeof c){for(d=2;this.fb.contains(c+d);)d++;Sj(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.fb.count-1;this.fb.contains(c);)c--;Sj(a,b,c)}}}}};t.wc=function(a){return null===a?!1:this.ag.contains(a)};t.bj=function(a){null!==a&&(ob(a),this.wc(a)||Mq(this,a,!0))};
function Mq(a,b,c){if(""!==a.linkKeyProperty){var d=a.Vb(b);if(void 0!==d&&a.fb.H(d)===b)return;a.Rq(b);d=a.Vb(b);if(void 0===d){B("GraphLinksModel.makeLinkDataKeyUnique failed on "+b+". Data not added to model.");return}a.fb.add(d,b)}a.ag.add(b);d=null;c&&(d=a.Wc.length,a.Wc.splice(d,0,b));ir(a,"linkDataArray",xe,"linkDataArray",a,null,b,null,d);sr(a,b)}t.kz=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.bj(a[c]);else for(a=a.iterator;a.next();)this.bj(a.value)};
t.Lm=function(a){null!==a&&Lq(this,a,!0)};function Lq(a,b,c){a.ag.remove(b);var d=a.Vb(b);void 0!==d&&a.fb.remove(d);d=null;if(c){d=a.Wc.indexOf(b);if(0>d)return;a.Wc.splice(d,1)}ir(a,"linkDataArray",ye,"linkDataArray",a,b,null,d,null);c=Iq(a,b,!0);Oq(a,c,b);c=Iq(a,b,!1);Oq(a,c,b);d=a.Bf(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],Oq(a,c,b)}t.OA=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.Lm(a[c]);else for(a=a.iterator;a.next();)this.Lm(a.value)};
t.FA=function(a){""===this.linkKeyProperty&&B("GraphLinksModel.linkKeyProperty must not be an empty string for .mergeLinkDataArray() to succeed.");if(a!==this.linkDataArray&&Aa(a)){var b=this.Ni;b.clear();b.addAll(this.fb.iteratorKeys);var c=this.Ki;c.clear();for(var d=a.length,e=0;e<d;e++){var f=a[e],g=this.Vb(f);if(void 0!==g){c.add(g);var h=this.Dg(g);h!==f&&(null!==h?(this.tq(h,f),qr(this,f,h)):(f=this.cloneDeep(f),this.iu(f,g),this.bj(f)))}else g=this.cloneDeep(f),this.bj(g),c.add(this.Vb(g))}for(a=
b.iterator;a.next();)d=a.value,c.contains(d)||(d=this.Dg(d))&&this.Lm(d);b.clear();c.clear()}};function sr(a,b){var c=Iq(a,b,!0);c=a.Cm(c);null===a.Kb(c)&&Pq(a,c,b);c=Iq(a,b,!1);c=a.Cm(c);null===a.Kb(c)&&Pq(a,c,b);var d=a.Bf(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],null===a.Kb(c)&&Pq(a,c,b)}
t.yq=function(a){if(null===a)return null;var b=this.al;a=null!==b?b(a,this):jr(this,a,!0);ya(a)&&(Ya(a),""!==this.$e&&Sj(a,this.$e,void 0),""!==this.af&&Sj(a,this.af,void 0),""!==this.Td&&Sj(a,this.Td,[]));return a};t.ew=function(a){if(null===a)return!1;var b=this.Ol;return""===b?!1:qn(a,b)?!0:!1};t.Lh=function(a){if(null!==a){var b=this.ve;if(""!==b&&(b=qn(a,b),void 0!==b)){if(Kq(b))return b;B("GroupKey value for node data "+a+" is not a number or a string: "+b)}}};
t.er=function(a,b){null===b&&(b=void 0);if(null!==a){var c=this.ve;if(""!==c)if(this.Za(a)){var d=qn(a,c);d!==b&&(Oq(this,d,a),Sj(a,c,b),null===this.Kb(b)&&Pq(this,b,a),ir(this,"nodeGroupKey",ve,c,a,d,b),"string"===typeof c&&this.Ca(a,c))}else Sj(a,c,b)}};or.prototype.copyNodeData=function(a){if(null===a)return null;a=Z.prototype.copyNodeData.call(this,a);this.nk||""===this.ve||void 0===qn(a,this.ve)||Sj(a,this.ve,void 0);return a};
or.prototype.setDataProperty=function(a,b,c){if(this.Za(a)){if(b===this.nodeKeyProperty){this.Um(a,c);return}if(b===this.nodeCategoryProperty){this.Tm(a,c);return}if(b===this.nodeGroupKeyProperty){this.er(a,c);return}}else if(this.wc(a)){if(b===this.linkFromKeyProperty){Qq(this,a,c,!0);return}if(b===this.linkToKeyProperty){Qq(this,a,c,!1);return}if(b===this.linkFromPortIdProperty){Rq(this,a,c,!0);return}if(b===this.linkToPortIdProperty){Rq(this,a,c,!1);return}if(b===this.linkKeyProperty){this.iu(a,
c);return}if(b===this.linkCategoryProperty){this.dr(a,c);return}if(b===this.linkLabelKeysProperty){this.ju(a,c);return}}var d=qn(a,b);d!==c&&(Sj(a,b,c),this.du(a,b,d,c))};t=or.prototype;t.tq=function(a,b){if(b){var c=this.Za(a),d=this.wc(a),e;for(e in b)"__gohashid"===e||c&&e===this.nodeKeyProperty||c&&e===this.nodeIsGroupProperty&&qn(a,e)===b[e]||d&&e===this.linkKeyProperty||this.setDataProperty(a,e,b[e])}};
t.br=function(a,b){Z.prototype.br.call(this,a,b);for(var c=this.Va.iterator;c.next();)this.uw(c.value,a,b);for(c=this.ag.iterator;c.next();){var d=c.value,e=a,f=b;if(Iq(this,d,!0)===e){var g=this.$e;Sj(d,g,f);ir(this,"linkFromKey",ve,g,d,e,f);"string"===typeof g&&this.Ca(d,g)}Iq(this,d,!1)===e&&(g=this.af,Sj(d,g,f),ir(this,"linkToKey",ve,g,d,e,f),"string"===typeof g&&this.Ca(d,g));g=this.Bf(d);if(Array.isArray(g))for(var h=g.length,k=this.Td,l=0;l<h;l++)g[l]===e&&(g[l]=f,ir(this,"linkLabelKeys",xe,
k,d,e,f,l,l))}};t.uw=function(a,b,c){if(this.Lh(a)===b){var d=this.ve;Sj(a,d,c);ir(this,"nodeGroupKey",ve,d,a,b,c);"string"===typeof d&&this.Ca(a,d)}};t.Qw=function(){Z.prototype.Qw.call(this);for(var a=this.linkDataArray,b=a.length,c=0;c<b;c++)sr(this,a[c])};
t.Pm=function(a){Z.prototype.Pm.call(this,a);a=this.ja(a);var b=Nq(this,a);if(null!==b){var c=Ea();for(b=b.iterator;b.next();){var d=b.value;if(this.Za(d)){if(this.Lh(d)===a){var e=this.ve;ir(this,"nodeGroupKey",ve,e,d,a,a);"string"===typeof e&&this.Ca(d,e);c.push(d)}}else if(Iq(this,d,!0)===a&&(e=this.$e,ir(this,"linkFromKey",ve,e,d,a,a),"string"===typeof e&&this.Ca(d,e),c.push(d)),Iq(this,d,!1)===a&&(e=this.af,ir(this,"linkToKey",ve,e,d,a,a),"string"===typeof e&&this.Ca(d,e),c.push(d)),e=this.Bf(d),
Array.isArray(e))for(var f=e.length,g=this.Td,h=0;h<f;h++)e[h]===a&&(ir(this,"linkLabelKeys",xe,g,d,a,a,h,h),c.push(d))}for(b=0;b<c.length;b++)Oq(this,a,c[b]);Ha(c)}};t.Om=function(a){Z.prototype.Om.call(this,a);var b=this.Lh(a);null===this.Kb(b)&&Pq(this,b,a)};t.jr=function(a){Z.prototype.jr.call(this,a);var b=this.Lh(a);Oq(this,b,a)};
t.Mt=function(a){if(null===a)return"";var b=this.Qj;if(""===b)return"";b=qn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;B("getCategoryForLinkData found a non-string category for "+a+": "+b);return""};or.prototype.getLinkCategoryForData=function(a){return this.Mt(a)};or.prototype.dr=function(a,b){if(null!==a){var c=this.Qj;if(""!==c)if(this.wc(a)){var d=qn(a,c);void 0===d&&(d="");d!==b&&(Sj(a,c,b),ir(this,"linkCategory",ve,c,a,d,b),"string"===typeof c&&this.Ca(a,c))}else Sj(a,c,b)}};
or.prototype.setLinkCategoryForData=function(a,b){this.dr(a,b)};t=or.prototype;t.Vm=function(a,b){Z.prototype.Vm.call(this,a,b);this.er(b,this.Lh(a))};function qr(a,b,c){a.dr(c,a.Mt(b));a.Aw(c,a.uy(b));a.Fw(c,a.xy(b));a.ju(c,a.Bf(b));a.Bw(c,a.vy(b));a.Gw(c,a.yy(b))}t.xk=function(){return!0};t.pj=function(){return!0};t.Ut=function(){return!0};t.yk=function(){return!0};
ma.Object.defineProperties(or.prototype,{archetypeNodeData:{get:function(){return this.xj},set:function(a){var b=this.xj;b!==a&&(this.xj=a,this.g("archetypeNodeData",b,a))}},linkFromKeyProperty:{get:function(){return this.$e},set:function(a){var b=this.$e;b!==a&&(this.$e=a,this.g("linkFromKeyProperty",b,a))}},linkToKeyProperty:{get:function(){return this.af},set:function(a){var b=this.af;b!==a&&(this.af=a,this.g("linkToKeyProperty",
b,a))}},linkFromPortIdProperty:{get:function(){return this.Rj},set:function(a){var b=this.Rj;b!==a&&(this.Rj=a,this.g("linkFromPortIdProperty",b,a))}},linkToPortIdProperty:{get:function(){return this.Sj},set:function(a){var b=this.Sj;b!==a&&(this.Sj=a,this.g("linkToPortIdProperty",b,a))}},linkLabelKeysProperty:{get:function(){return this.Td},set:function(a){var b=this.Td;b!==a&&(this.Td=a,this.g("linkLabelKeysProperty",
b,a))}},linkDataArray:{get:function(){return this.Wc},set:function(a){var b=this.Wc;if(b!==a){this.fb.clear();for(var c=a.length,d=0;d<c;d++){var e=a[d];if(!ya(e)){B("GraphLinksModel.linkDataArray must only contain Objects, not: "+e);return}ob(e)}this.Wc=a;if(""!==this.linkKeyProperty){d=new E;for(e=0;e<c;e++){var f=a[e],g=this.Vb(f);void 0===g?d.add(f):null!==this.fb.H(g)?d.add(f):this.fb.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.Rq(e),f=this.Vb(e),void 0!==
f&&this.fb.add(f,e)}d=new F;for(e=0;e<c;e++)d.add(a[e]);this.ag=d;ir(this,"linkDataArray",ve,"linkDataArray",this,b,a);for(b=0;b<c;b++)sr(this,a[b])}}},linkKeyProperty:{get:function(){return this.Gi},set:function(a){var b=this.Gi;if(b!==a){this.Gi=a;this.fb.clear();for(var c=this.linkDataArray.length,d=0;d<c;d++){var e=this.linkDataArray[d],f=this.Vb(e);void 0===f&&(this.Rq(e),f=this.Vb(e));void 0!==f&&this.fb.add(f,e)}this.g("linkKeyProperty",b,a)}}},makeUniqueLinkKeyFunction:{
get:function(){return this.Kl},set:function(a){var b=this.Kl;b!==a&&(this.Kl=a,this.g("makeUniqueLinkKeyFunction",b,a))}},copyLinkDataFunction:{get:function(){return this.al},set:function(a){var b=this.al;b!==a&&(this.al=a,this.g("copyLinkDataFunction",b,a))}},nodeIsGroupProperty:{get:function(){return this.Ol},set:function(a){var b=this.Ol;b!==a&&(this.Ol=a,this.g("nodeIsGroupProperty",b,a))}},nodeGroupKeyProperty:{
get:function(){return this.ve},set:function(a){var b=this.ve;b!==a&&(this.ve=a,this.g("nodeGroupKeyProperty",b,a))}},nk:{get:function(){return this.Dn},set:function(a){this.Dn!==a&&(this.Dn=a)}},linkCategoryProperty:{get:function(){return this.Qj},set:function(a){var b=this.Qj;b!==a&&(this.Qj=a,this.g("linkCategoryProperty",b,a))}},type:{get:function(){return"GraphLinksModel"}}});
or.prototype.setCategoryForLinkData=or.prototype.dr;or.prototype.getCategoryForLinkData=or.prototype.Mt;or.prototype.assignAllDataProperties=or.prototype.tq;or.prototype.setGroupKeyForNodeData=or.prototype.er;or.prototype.getGroupKeyForNodeData=or.prototype.Lh;or.prototype.isGroupForNodeData=or.prototype.ew;or.prototype.copyLinkData=or.prototype.yq;or.prototype.mergeLinkDataArray=or.prototype.FA;or.prototype.removeLinkDataCollection=or.prototype.OA;or.prototype.removeLinkData=or.prototype.Lm;
or.prototype.addLinkDataCollection=or.prototype.kz;or.prototype.addLinkData=or.prototype.bj;or.prototype.containsLinkData=or.prototype.wc;or.prototype.makeLinkDataKeyUnique=or.prototype.Rq;or.prototype.findLinkDataForKey=or.prototype.Dg;or.prototype.setKeyForLinkData=or.prototype.iu;or.prototype.getKeyForLinkData=or.prototype.Vb;or.prototype.removeLabelKeyForLinkData=or.prototype.Ly;or.prototype.addLabelKeyForLinkData=or.prototype.Dv;or.prototype.setLabelKeysForLinkData=or.prototype.ju;
or.prototype.getLabelKeysForLinkData=or.prototype.Bf;or.prototype.setToPortIdForLinkData=or.prototype.Gw;or.prototype.getToPortIdForLinkData=or.prototype.yy;or.prototype.setFromPortIdForLinkData=or.prototype.Bw;or.prototype.getFromPortIdForLinkData=or.prototype.vy;or.prototype.setToKeyForLinkData=or.prototype.Fw;or.prototype.getToKeyForLinkData=or.prototype.xy;or.prototype.setFromKeyForLinkData=or.prototype.Aw;or.prototype.getFromKeyForLinkData=or.prototype.uy;or.prototype.clear=or.prototype.clear;
var rr=Object.freeze([]);or.className="GraphLinksModel";mr.GraphLinksModel=or;Z.constructGraphLinksModel=Z.constructGraphLinksModel=function(){return new or};Z.initDiagramModel=wi=function(){return new or};function tr(a){Z.call(this);this.we="parent";this.Fn=!1;this.Xj="parentLinkCategory";void 0!==a&&(this.nodeDataArray=a)}la(tr,Z);tr.constructGraphLinksModel=Z.constructGraphLinksModel;
tr.prototype.cloneProtected=function(a){Z.prototype.cloneProtected.call(this,a);a.we=this.we;a.Fn=this.Fn;a.Xj=this.Xj};t=tr.prototype;t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.hr();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.ja(e)+":"+Ja(e)}}return b};
t.Nk=function(){var a=Z.prototype.Nk.call(this),b="";"parent"!==this.nodeParentKeyProperty&&"string"===typeof this.nodeParentKeyProperty&&(b+=',\n  "nodeParentKeyProperty": '+this.quote(this.nodeParentKeyProperty));return a+b};t.Yq=function(a){Z.prototype.Yq.call(this,a);a.nodeParentKeyProperty&&(this.nodeParentKeyProperty=a.nodeParentKeyProperty)};t.mr=function(a){cr(this,a,"nodeParentKeyProperty");return Z.prototype.mr.call(this,a)};
t.Xq=function(a){void 0!==a.nodeParentKeyProperty&&a.nodeParentKeyProperty!==this.nodeParentKeyProperty&&B("applyIncrementalJson cannot change Model properties");Z.prototype.Xq.call(this,a)};t.Cm=function(a){return a};t.Mh=function(a){if(null!==a){var b=this.we;if(""!==b&&(b=qn(a,b),void 0!==b)){if(Kq(b))return b;B("ParentKey value for node data "+a+" is not a number or a string: "+b)}}};
t.be=function(a,b){null===b&&(b=void 0);if(null!==a){var c=this.we;if(""!==c)if(b=this.Cm(b),this.Za(a)){var d=qn(a,c);d!==b&&(Oq(this,d,a),Sj(a,c,b),null===this.Kb(b)&&Pq(this,b,a),ir(this,"nodeParentKey",ve,c,a,d,b),"string"===typeof c&&this.Ca(a,c))}else Sj(a,c,b)}};t.Ot=function(a){if(null===a)return"";var b=this.Xj;if(""===b)return"";b=qn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;B("getParentLinkCategoryForNodeData found a non-string category for "+a+": "+b);return""};
tr.prototype.getLinkCategoryForData=function(a){return this.Ot(a)};tr.prototype.ku=function(a,b){if(null!==a){var c=this.Xj;if(""!==c)if(this.Za(a)){var d=qn(a,c);void 0===d&&(d="");d!==b&&(Sj(a,c,b),ir(this,"parentLinkCategory",ve,c,a,d,b),"string"===typeof c&&this.Ca(a,c))}else Sj(a,c,b)}};tr.prototype.setLinkCategoryForData=function(a,b){this.ku(a,b)};
tr.prototype.copyNodeData=function(a){if(null===a)return null;a=Z.prototype.copyNodeData.call(this,a);this.pk||""===this.we||void 0===qn(a,this.we)||Sj(a,this.we,void 0);return a};tr.prototype.setDataProperty=function(a,b,c){if(this.Za(a)){if(b===this.nodeKeyProperty){this.Um(a,c);return}if(b===this.nodeCategoryProperty){this.Tm(a,c);return}if(b===this.nodeParentKeyProperty){this.be(a,c);return}}var d=qn(a,b);d!==c&&(Sj(a,b,c),this.du(a,b,d,c))};t=tr.prototype;
t.br=function(a,b){Z.prototype.br.call(this,a,b);for(var c=this.Va.iterator;c.next();)this.uw(c.value,a,b)};t.uw=function(a,b,c){if(this.Mh(a)===b){var d=this.we;Sj(a,d,c);ir(this,"nodeParentKey",ve,d,a,b,c);"string"===typeof d&&this.Ca(a,d)}};
t.Pm=function(a){Z.prototype.Pm.call(this,a);a=this.ja(a);var b=Nq(this,a);if(null!==b){var c=Ea();for(b=b.iterator;b.next();){var d=b.value;if(this.Za(d)&&this.Mh(d)===a){var e=this.we;ir(this,"nodeParentKey",ve,e,d,a,a);"string"===typeof e&&this.Ca(d,e);c.push(d)}}for(b=0;b<c.length;b++)Oq(this,a,c[b]);Ha(c)}};t.Om=function(a){Z.prototype.Om.call(this,a);var b=this.Mh(a);b=this.Cm(b);null===this.Kb(b)&&Pq(this,b,a)};t.jr=function(a){Z.prototype.jr.call(this,a);var b=this.Mh(a);Oq(this,b,a)};
t.Vm=function(a,b){Z.prototype.Vm.call(this,a,b);this.ku(b,this.Ot(a));this.be(b,this.Mh(a))};t.Am=function(){return!0};t.Ut=function(){return!0};
ma.Object.defineProperties(tr.prototype,{nodeParentKeyProperty:{get:function(){return this.we},set:function(a){var b=this.we;b!==a&&(this.we=a,this.g("nodeParentKeyProperty",b,a))}},pk:{get:function(){return this.Fn},set:function(a){this.Fn!==a&&(this.Fn=a)}},parentLinkCategoryProperty:{get:function(){return this.Xj},set:function(a){var b=this.Xj;b!==a&&(this.Xj=a,this.g("parentLinkCategoryProperty",b,a))}},
linkCategoryProperty:{get:function(){return this.parentLinkCategoryProperty},set:function(a){this.parentLinkCategoryProperty=a}},type:{get:function(){return"TreeModel"}}});tr.prototype.setParentLinkCategoryForNodeData=tr.prototype.ku;tr.prototype.getParentLinkCategoryForNodeData=tr.prototype.Ot;tr.prototype.setParentKeyForNodeData=tr.prototype.be;tr.prototype.getParentKeyForNodeData=tr.prototype.Mh;tr.className="TreeModel";mr.TreeModel=tr;
function ur(){yi.call(this);this.tx=this.Tn=this.$b=0;this.Wr=360;this.sx=vr;this.Fj=0;this.kx=new J;this.Ir=this.Wd=0;this.ut=new wr;this.Au=this.Wj=0;this.cz=600;this.wp=NaN;this.on=1;this.$p=0;this.gm=360;this.Eb=vr;this.J=xr;this.Yc=yr;this.Tc=lq;this.kf=6;this.fp=zr}la(ur,yi);ur.prototype.cloneProtected=function(a){yi.prototype.cloneProtected.call(this,a);a.wp=this.wp;a.on=this.on;a.$p=this.$p;a.gm=this.gm;a.Eb=this.Eb;a.J=this.J;a.Yc=this.Yc;a.Tc=this.Tc;a.kf=this.kf;a.fp=this.fp};
ur.prototype.hb=function(a){if(a.classType===ur)if(a===Ar||a===Br||a===Cr||a===Dr||a===yr)this.sorting=a;else if(a===Er||a===Fr||a===xr||a===Gr)this.direction=a;else if(a===Hr||a===Ir||a===vr||a===Jr)this.arrangement=a;else{if(a===Kr||a===zr)this.nodeDiameterFormula=a}else yi.prototype.hb.call(this,a)};ur.prototype.createNetwork=function(){return new Lr(this)};
ur.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);a=this.network.vertexes;if(1>=a.count)1===a.count&&(a=a.first(),a.centerX=0,a.centerY=0);else{var b=new E;b.addAll(a.iterator);a=new E;var c=new E;var d=this.sort(b);var e,f,g=this.Ir;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===Jr&&k===Kr?h=vr:h===Jr&&k!==Kr&&(h=this.arrangement);if((this.direction===Er||this.direction===Fr)&&this.sorting!==yr){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===Er?(this.arrangement===Jr&&a.reverse(),d=new E,d.addAll(a),d.addAll(c)):(this.arrangement===Jr&&c.reverse(),d=new E,d.addAll(c),d.addAll(a))}k=d.length;for(var r=f=e=0;r<
d.length;r++){var q=n+p*f*(this.direction===xr?1:-1)/k,u=d.L(r).diameter;isNaN(u)&&(u=Mr(d.L(r),q));360>p&&(0===r||r===d.length-1)&&(u/=2);e+=u;f++}if(isNaN(l)||h===Jr){isNaN(b)&&(b=6);if(h!==vr&&h!==Jr){f=-Infinity;for(g=0;g<k;g++)r=d.L(g),e=d.L(g===k-1?0:g+1),isNaN(r.diameter)&&Mr(r,0),isNaN(e.diameter)&&Mr(e,0),f=Math.max(f,(r.diameter+e.diameter)/2);g=f+b;h===Hr?l=(f+b)/(2*Math.PI/k):l=Nr(this,g*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180)}else l=Nr(this,e+(360<=p?k:k-1)*(h!==Jr?b:1.6*b),m,n*
Math.PI/180,p*Math.PI/180);f=l*m}else if(f=l*m,r=Or(this,l,f,n*Math.PI/180,p*Math.PI/180),isNaN(b)){if(h===vr||h===Jr)b=(r-e)/(360<=p?k:k-1)}else if(h===vr||h===Jr)r=(r-e)/(360<=p?k:k-1),r<b?(l=Nr(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)&&Mr(q,0),isNaN(u.diameter)&&Mr(u,0),g=Math.max(g,(q.diameter+u.diameter)/2);g+=b;e=Nr(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.sx=h;this.$b=l;this.Tn=m;this.tx=n;this.Wr=p;this.Fj=b;this.Wd=f;this.Ir=g;b=d;d=this.sx;h=this.$b;l=this.tx;m=this.Wr;n=this.Fj;p=this.Wd;k=this.Ir;if(this.direction!==Er&&this.direction!==Fr||d!==Jr)if(this.direction===Er||this.direction===Fr){g=0;switch(d){case Ir:g=180*Pr(this,h,p,l,k)/Math.PI;break;case vr:k=b=0;g=a.first();null!==g&&(b=Mr(g,Math.PI/2));g=c.first();null!==g&&(k=Mr(g,Math.PI/2));g=180*Pr(this,h,p,l,n+(b+k)/2)/Math.PI;break;case Hr:g=m/b.length}if(this.direction===
Er){switch(d){case Ir:Qr(this,a,l,Gr);break;case vr:Rr(this,a,l,Gr);break;case Hr:Sr(this,a,m/2,l,Gr)}switch(d){case Ir:Qr(this,c,l+g,xr);break;case vr:Rr(this,c,l+g,xr);break;case Hr:Sr(this,c,m/2,l+g,xr)}}else{switch(d){case Ir:Qr(this,c,l,Gr);break;case vr:Rr(this,c,l,Gr);break;case Hr:Sr(this,c,m/2,l,Gr)}switch(d){case Ir:Qr(this,a,l+g,xr);break;case vr:Rr(this,a,l+g,xr);break;case Hr:Sr(this,a,m/2,l+g,xr)}}}else switch(d){case Ir:Qr(this,b,l,this.direction);break;case vr:Rr(this,b,l,this.direction);
break;case Hr:Sr(this,b,m,l,this.direction);break;case Jr:Tr(this,b,m,l,this.direction)}else Tr(this,b,m,l-m/2,xr)}this.updateParts();this.network=null;this.isValidLayout=!0};function Sr(a,b,c,d,e){var f=a.Wr,g=a.$b;a=a.Wd;d=d*Math.PI/180;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=d+(e===xr?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 Rr(a,b,c,d){var e=a.$b,f=a.Wd,g=a.Fj;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)&&Mr(l,0);isNaN(m.diameter)&&Mr(m,0);l=Pr(a,e,f,d===xr?c:-c,(l.diameter+m.diameter)/2+g);c+=d===xr?l:-l}}
function Qr(a,b,c,d){var e=a.$b,f=a.Wd,g=a.Ir;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=Pr(a,e,f,d===xr?c:-c,g);c+=d===xr?l:-l}}function Tr(a,b,c,d,e){var f=a.Wr;a.Wj=0;a.ut=new wr;if(360>c){for(f=d+(e===xr?f:-f);0>f;)f+=360;f%=360;180<f&&(f-=360);f*=Math.PI/180;a.Au=f;Ur(a,b,c,d,e)}else Vr(a,b,c,d,e);a.ut.commit(b)}
function Vr(a,b,c,d,e){var f=a.$b,g=a.Fj,h=a.Tn,k=f*Math.cos(d*Math.PI/180),l=a.Wd*Math.sin(d*Math.PI/180),m=b.ma();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;Wr(a,k,l,m,n,e,f)||Xr(a,k,l,m,n,e,f);k=f.x;l=f.y}J.free(f);a.Wj++;if(!(23<a.Wj)){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===xr?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.ut.compare(g,m);1<Math.abs(g)&&(a.$b=8>a.Wj?a.$b-g/(2*Math.PI):5>m.length&&10<g?a.$b/2:a.$b-(0<g?1.7:-2.3),a.Wd=a.$b*h,Vr(a,b,c,d,e))}}}
function Ur(a,b,c,d,e){for(var f=a.$b,g=a.Wd,h=a.Tn,k=f*Math.cos(d*Math.PI/180),l=g*Math.sin(d*Math.PI/180),m=J.alloc(),n=b.ma(),p=0;p<n.length;p++){n[p].centerX=k;n[p].centerY=l;if(p>=n.length-1)break;Wr(a,k,l,n,p,e,m)||Xr(a,k,l,n,p,e,m);k=m.x;l=m.y}J.free(m);a.Wj++;if(!(23<a.Wj)){k=Math.atan2(l,k);k=e===xr?a.Au-k:k-a.Au;k=Math.abs(k)<Math.abs(k-2*Math.PI)?k:k-2*Math.PI;f=k*(f+g)/2;g=a.ut;if(Math.abs(f)<Math.abs(g.vm))for(g.vm=f,g.Ok=[],g.an=[],k=0;k<n.length;k++)g.Ok[k]=n[k].bounds.x,g.an[k]=n[k].bounds.y;
1<Math.abs(f)&&(a.$b=8>a.Wj?a.$b-f/(2*Math.PI):a.$b-(0<f?1.7:-2.3),a.Wd=a.$b*h,Ur(a,b,c,d,e))}}function Wr(a,b,c,d,e,f,g){var h=a.$b,k=a.Wd,l=0;a=(d[e].width+d[e+1].width)/2+a.Fj;var m=!1;if(0<=c!==(f===xr)){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 Xr(a,b,c,d,e,f,g){var h=a.$b,k=a.Wd,l=0;a=(d[e].height+d[e+1].height)/2+a.Fj;d=!1;if(0<=b!==(f===xr)){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}ur.prototype.commitLayout=function(){this.commitNodes();this.isRouting&&this.commitLinks()};
ur.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.$b,c.y=this.arrangementOrigin.y+this.Wd);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.Ta(),a=this.group.position.copy(),c=this.group.location.copy(),b=b.ce(c.ce(a)),this.group.move(b),this.kx=b.ce(a))};
ur.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};function Or(a,b,c,d,e){var f=a.cz;if(.001>Math.abs(a.Tn-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 Nr(a,b,c,d,e){return b/(void 0!==d&&void 0!==e?Or(a,1,c,d,e):Or(a,1,c))}function Pr(a,b,c,d,e){if(.001>Math.abs(a.Tn-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}}
ur.prototype.sort=function(a){switch(this.sorting){case Cr:break;case Dr:a.reverse();break;case Ar:a.sort(this.comparer);break;case Br:a.sort(this.comparer);a.reverse();break;case yr:for(var b=[],c=0;c<a.length;c++)b.push(0);c=new E;for(var d=0;d<a.length;d++){var e=-1,f=-1;if(0===d)for(var g=0;g<a.length;g++){var h=a.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]++}a=[];for(b=0;b<c.length;b++){e=c.L(b);a[b]=[];for(f=e.destinationEdges;f.next();)d=c.indexOf(f.value.toVertex),d!==b&&0>a[b].indexOf(d)&&a[b].push(d);for(e=e.sourceEdges;e.next();)d=c.indexOf(e.value.fromVertex),d!==b&&0>a[b].indexOf(d)&&a[b].push(d)}f=[];for(b=0;b<a.length;b++)f[b]=0;b=[];g=[];h=[];e=[];d=new E;for(var k=0,l=0;l<a.length;l++){var m=a[l].length;if(1===m)e.push(l);else if(0===m)d.add(c.L(l));
else{if(0===k)b.push(l);else{for(var n=m=Infinity,p=-1,r=[],q=0;q<b.length;q++)0>a[b[q]].indexOf(b[q===b.length-1?0:q+1])&&r.push(q===b.length-1?0:q+1);if(0===r.length)for(q=0;q<b.length;q++)r.push(q);for(q=0;q<r.length;q++){for(var u=r[q],v=a[l],w=0,y=0;y<g.length;y++){var z=f[g[y]],A=f[h[y]];if(z<A){var C=z;z=A}else C=A;if(C<u&&u<=z)for(A=0;A<v.length;A++){var G=v[A];0>b.indexOf(G)||C<f[G]&&f[G]<z||C===f[G]||z===f[G]||w++}else for(A=0;A<v.length;A++)G=v[A],0>b.indexOf(G)||C<f[G]&&f[G]<z&&C!==f[G]&&
z!==f[G]&&w++}v=w;for(y=w=0;y<a[l].length;y++)C=b.indexOf(a[l][y]),0<=C&&(C=Math.abs(u-(C>=u?C+1:C)),w+=C<b.length+1-C?C:b.length+1-C);for(y=0;y<g.length;y++)C=f[g[y]],z=f[h[y]],C>=u&&C++,z>=u&&z++,C>z&&(A=z,z=C,C=A),z-C<(b.length+2)/2===(C<u&&u<=z)&&w++;if(v<m||v===m&&w<n)m=v,n=w,p=u}b.splice(p,0,l);for(m=0;m<b.length;m++)f[b[m]]=m;for(m=0;m<a[l].length;m++)n=a[l][m],0<=b.indexOf(n)&&(g.push(l),h.push(n))}k++}}for(g=b.length;;){f=!0;for(h=0;h<e.length;h++)if(k=e[h],l=a[k][0],m=b.indexOf(l),0<=m){for(p=
n=0;p<a[l].length;p++)r=b.indexOf(a[l][p]),0>r||r===m||(q=r>m?r-m:m-r,n+=r<m!==q>g-q?1:-1);b.splice(0>n?m:m+1,0,k);e.splice(h,1);h--}else f=!1;if(f)break;else b.push(e[0]),e.splice(0,1)}for(a=0;a<b.length;a++)d.add(c.L(b[a]));return d;default:B("Invalid sorting type.")}return a};
ma.Object.defineProperties(ur.prototype,{radius:{get:function(){return this.wp},set:function(a){this.wp!==a&&(0<a||isNaN(a))&&(this.wp=a,this.C())}},aspectRatio:{get:function(){return this.on},set:function(a){this.on!==a&&0<a&&(this.on=a,this.C())}},startAngle:{get:function(){return this.$p},set:function(a){this.$p!==a&&(this.$p=a,this.C())}},sweepAngle:{get:function(){return this.gm},
set:function(a){this.gm!==a&&(0<a&&360>=a?this.gm=a:this.gm=360,this.C())}},arrangement:{get:function(){return this.Eb},set:function(a){this.Eb===a||a!==Jr&&a!==vr&&a!==Ir&&a!==Hr||(this.Eb=a,this.C())}},direction:{get:function(){return this.J},set:function(a){this.J===a||a!==xr&&a!==Gr&&a!==Er&&a!==Fr||(this.J=a,this.C())}},sorting:{get:function(){return this.Yc},set:function(a){this.Yc===a||a!==Cr&&a!==Dr&&
a!==Ar&&!Br&&a!==yr||(this.Yc=a,this.C())}},comparer:{get:function(){return this.Tc},set:function(a){this.Tc!==a&&(this.Tc=a,this.C())}},spacing:{get:function(){return this.kf},set:function(a){this.kf!==a&&(this.kf=a,this.C())}},nodeDiameterFormula:{get:function(){return this.fp},set:function(a){this.fp===a||a!==zr&&a!==Kr||(this.fp=a,this.C())}},actualXRadius:{get:function(){return this.$b}},
actualYRadius:{get:function(){return this.Wd}},actualSpacing:{get:function(){return this.Fj}},actualCenter:{get:function(){return this.kx}}});
var vr=new D(ur,"ConstantSpacing",0),Ir=new D(ur,"ConstantDistance",1),Hr=new D(ur,"ConstantAngle",2),Jr=new D(ur,"Packed",3),xr=new D(ur,"Clockwise",4),Gr=new D(ur,"Counterclockwise",5),Er=new D(ur,"BidirectionalLeft",6),Fr=new D(ur,"BidirectionalRight",7),Cr=new D(ur,"Forwards",8),Dr=new D(ur,"Reverse",9),Ar=new D(ur,"Ascending",10),Br=new D(ur,"Descending",11),yr=new D(ur,"Optimized",12),zr=new D(ur,"Pythagorean",13),Kr=new D(ur,"Circular",14);ur.className="CircularLayout";ur.ConstantSpacing=vr;
ur.ConstantDistance=Ir;ur.ConstantAngle=Hr;ur.Packed=Jr;ur.Clockwise=xr;ur.Counterclockwise=Gr;ur.BidirectionalLeft=Er;ur.BidirectionalRight=Fr;ur.Forwards=Cr;ur.Reverse=Dr;ur.Ascending=Ar;ur.Descending=Br;ur.Optimized=yr;ur.Pythagorean=zr;ur.Circular=Kr;function wr(){this.vm=-Infinity;this.an=this.Ok=null}
wr.prototype.compare=function(a,b){if(0<a&&0>this.vm||Math.abs(a)<Math.abs(this.vm)&&!(0>a&&0<this.vm))for(this.vm=a,this.Ok=[],this.an=[],a=0;a<b.length;a++)this.Ok[a]=b[a].bounds.x,this.an[a]=b[a].bounds.y};wr.prototype.commit=function(a){if(null!==this.Ok&&null!==this.an)for(var b=0;b<this.Ok.length;b++){var c=a.L(b);c.x=this.Ok[b];c.y=this.an[b]}};wr.className="VertexArrangement";function Lr(a){Rp.call(this,a)}la(Lr,Rp);Lr.prototype.createVertex=function(){return new Yr(this)};
Lr.prototype.createEdge=function(){return new Zr(this)};Lr.className="CircularNetwork";function Yr(a){eq.call(this,a);this.I=this.Dj=NaN}la(Yr,eq);
function Mr(a,b){var c=a.network;if(null===c)return NaN;c=c.layout;if(null===c)return NaN;if(c.arrangement===Jr)if(c.nodeDiameterFormula===Kr)a.Dj=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.Dj=Math.min(a.height/c,a.width/b)}else a.Dj=c.nodeDiameterFormula===Kr?Math.max(a.width,a.height):Math.sqrt(a.width*a.width+a.height*a.height);return a.Dj}
ma.Object.defineProperties(Yr.prototype,{diameter:{get:function(){return this.Dj},set:function(a){this.Dj!==a&&(this.Dj=a)}},actualAngle:{get:function(){return this.I},set:function(a){this.I!==a&&(this.I=a)}}});Yr.className="CircularVertex";function Zr(a){fq.call(this,a)}la(Zr,fq);Zr.className="CircularEdge";
function $r(){yi.call(this);this.Fh=null;this.Ao=0;this.Hd=(new M(100,100)).freeze();this.nn=!1;this.hf=!0;this.ed=!1;this.Ll=100;this.Wn=1;this.Xf=1E3;this.Yo=10;this.xp=Math;this.hl=.05;this.gl=50;this.el=150;this.fl=0;this.Nn=10;this.Mn=5}la($r,yi);
$r.prototype.cloneProtected=function(a){yi.prototype.cloneProtected.call(this,a);a.Hd.assign(this.Hd);a.nn=this.nn;a.hf=this.hf;a.ed=this.ed;a.Ll=this.Ll;a.Wn=this.Wn;a.Xf=this.Xf;a.Yo=this.Yo;a.xp=this.xp;a.hl=this.hl;a.gl=this.gl;a.el=this.el;a.fl=this.fl;a.Nn=this.Nn;a.Mn=this.Mn};
$r.prototype.serializeLayoutProperties=function(a,b){yi.prototype.serializeLayoutProperties.call(this,a,b);a.arrangementSpacing={width:this.arrangementSpacing.width,height:this.arrangementSpacing.height};a.arrangesToOrigin=this.arrangesToOrigin;a.setsPortSpots=this.setsPortSpots;a.comments=this.comments;a.maxIterations=this.maxIterations;a.epsilonDistance=this.epsilonDistance;a.infinityDistance=this.infinityDistance;a.moveLimit=this.moveLimit;a.defaultSpringStiffness=this.defaultSpringStiffness;a.defaultSpringLength=
this.defaultSpringLength;a.defaultElectricalCharge=this.defaultElectricalCharge;a.defaultGravitationalMass=this.defaultGravitationalMass;a.defaultCommentSpringLength=this.defaultCommentSpringLength;a.defaultCommentElectricalCharge=this.defaultCommentElectricalCharge};
$r.prototype.deserializeLayoutProperties=function(a,b,c,d){yi.prototype.deserializeLayoutProperties.call(this,a,b,c,d);this.arrangementSpacing=new M(a.arrangementSpacing.width,a.arrangementSpacing.height);this.arrangesToOrigin=a.arrangesToOrigin;this.setsPortSpots=a.setsPortSpots;this.comments=a.comments;this.maxIterations=a.maxIterations;this.epsilonDistance=a.epsilonDistance;this.infinityDistance=a.infinityDistance;this.moveLimit=a.moveLimit;this.defaultSpringStiffness=a.defaultSpringStiffness;
this.defaultSpringLength=a.defaultSpringLength;this.defaultElectricalCharge=a.defaultElectricalCharge;this.defaultGravitationalMass=a.defaultGravitationalMass;this.defaultCommentSpringLength=a.defaultCommentSpringLength;this.defaultCommentElectricalCharge=a.defaultCommentElectricalCharge};$r.prototype.createNetwork=function(){return new as(this)};
$r.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));if(!this.Sw()){a=this.maxIterations;if(0<this.network.vertexes.count){this.network.zq();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.Fv();this.Ao=0;if(this.needsClusterLayout()){b=this.network;c=b.Uy();
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.Dd=f.vertexes.count;f.Sh=1;f.mk=null;f.Ke=null}bs(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=cs(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=cs(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);Ha(l);for(d=c.iterator;d.next();){c=d.value;for(e=c.vertexes.iterator;e.next();)b.Bg(e.value);for(c=c.edges.iterator;c.next();)b.nm(c.value)}}ds(this,a);this.updateParts()}this.Ll=a;this.network=null;this.isValidLayout=!0}};
$r.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.Lc(c)&&(a++,2<a))return!0;if(10<b)break;b++}return!1};$r.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.Oc(d.bounds)}return b};
function bs(a,b,c){if(es(a,b)){var d=a.Xf;a.Xf*=1+1/(b+1);var e=fs(a,b),f=Math.max(0,Math.max(Math.min(a.network.vertexes.count,c*(b+1)/11),10));a.maxIterations+=f;bs(a,b+1,c);ds(a,f);gs(a,e);b=e.vertexes.ma();b.sort(function(a,b){return null===a||null===b||a===b?0:b.Dd-a.Dd});for(c=0;c<b.length;c++)hs(a,b[c]);a.Xf=d}}
function es(a,b){if(10<b||3>a.network.vertexes.count)return!1;a.Fh=a.network.vertexes.ma();a=a.Fh;a.sort(function(a,b){return null===a||null===b||a===b?0:b.Dd-a.Dd});for(b=a.length-1;0<=b&&1>=a[b].Dd;)b--;return 1<a.length-b}
function fs(a,b){for(var c=a.network,d=new as(a),e=0;e<a.Fh.length;e++){var f=a.Fh[e];if(1<f.Dd){d.Bg(f);var g=new is;g.pu=f.Dd;g.qu=f.width;g.ou=f.height;g.Yw=f.focus.x;g.Zw=f.focus.y;null===f.Ke&&(f.Ke=new E);f.Ke.add(g);f.yw=f.Ke.count-1}else break}for(f=c.edges.iterator;f.next();){var h=f.value;e=h.fromVertex;g=h.toVertex;e.network===d&&g.network===d?d.nm(h):e.network===d?(h=e.mk,null===h&&(h=new E,e.mk=h),h.add(g),e.Dd--,e.Sh+=g.Sh):g.network===d&&(h=g.mk,null===h&&(h=new E,g.mk=h),h.add(e),
g.Dd--,g.Sh+=e.Sh)}for(e=d.edges.iterator;e.next();)f=e.value,f.length*=Math.max(1,K.sqrt((f.fromVertex.Sh+f.toVertex.Sh)/(4*b+1)));for(b=d.vertexes.iterator;b.next();){e=b.value;var k=e.mk;if(null!==k&&0<k.count&&(g=e.Ke.L(e.Ke.count-1).pu-e.Dd,!(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.wy(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 gs(a,b){for(var c=a.network.vertexes.iterator;c.next();){var d=c.value;d.network=b;if(null!==d.Ke){var e=d.Ke.L(d.yw);d.Dd=e.pu;var f=e.Yw,g=e.Zw;d.bounds=new N(d.centerX-f,d.centerY-g,e.qu,e.ou);d.focus=new J(f,g);d.yw--}}for(c=a.network.edges.iterator;c.next();)c.value.network=b;a.network=b}
function hs(a,b){var c=b.mk;if(null!==c&&0!==c.count){var d=b.centerX,e=b.centerY,f=b.width,g=b.height;null!==b.Ke&&0<b.Ke.count&&(g=b.Ke.L(0),f=g.qu,g=g.ou);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.Dd?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.Dd||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 cs(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}$r.prototype.Fv=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)};
$r.prototype.addComments=function(a){var b=a.node;if(null!==b)for(b=b.Rv();b.next();){var c=b.value;if("Comment"===c.category&&c.isVisible()){var d=this.network.kj(c);null===d&&(d=this.network.jk(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.Ak(a,d,null));c.length=this.defaultCommentSpringLength}}};
function js(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 ds(a,b){a.Fh=null;for(b=a.Ao+b;a.Ao<b&&(a.Ao++,ks(a)););a.Fh=null}
function ks(a){null===a.Fh&&(a.Fh=a.network.vertexes.ma());var b=a.Fh;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.Xf;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=js(g,p);1>q?(d=a.randomNumberGenerator,null===d&&(a.randomNumberGenerator=d=new ls),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=js(c,f),1>n?(n=a.randomNumberGenerator,null===n&&(a.randomNumberGenerator=n=new ls),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}$r.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};$r.prototype.moveFixedVertex=function(){};$r.prototype.commitLayout=function(){this.Cw();this.commitNodes();this.isRouting&&this.commitLinks()};
$r.prototype.Cw=function(){if(this.setsPortSpots)for(var a=this.network.edges.iterator;a.next();){var b=a.value.link;null!==b&&(b.fromSpot=ad,b.toSpot=ad)}};$r.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)};
$r.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};$r.prototype.springStiffness=function(a){a=a.stiffness;return isNaN(a)?this.hl:a};$r.prototype.springLength=function(a){a=a.length;return isNaN(a)?this.gl:a};$r.prototype.electricalCharge=function(a){a=a.charge;return isNaN(a)?this.el:a};$r.prototype.electricalFieldX=function(){return 0};$r.prototype.electricalFieldY=function(){return 0};
$r.prototype.gravitationalMass=function(a){a=a.mass;return isNaN(a)?this.fl:a};$r.prototype.gravitationalFieldX=function(){return 0};$r.prototype.gravitationalFieldY=function(){return 0};$r.prototype.isFixed=function(a){return a.isFixed};
ma.Object.defineProperties($r.prototype,{currentIteration:{get:function(){return this.Ao}},arrangementSpacing:{get:function(){return this.Hd},set:function(a){this.Hd.w(a)||(this.Hd.assign(a),this.C())}},arrangesToOrigin:{get:function(){return this.nn},set:function(a){this.nn!==a&&(this.nn=a,this.C())}},setsPortSpots:{get:function(){return this.hf},set:function(a){this.hf!==a&&(this.hf=
a,this.C())}},comments:{get:function(){return this.ed},set:function(a){this.ed!==a&&(this.ed=a,this.C())}},maxIterations:{get:function(){return this.Ll},set:function(a){this.Ll!==a&&0<=a&&(this.Ll=a,this.C())}},epsilonDistance:{get:function(){return this.Wn},set:function(a){this.Wn!==a&&0<a&&(this.Wn=a,this.C())}},infinityDistance:{get:function(){return this.Xf},set:function(a){this.Xf!==
a&&1<a&&(this.Xf=a,this.C())}},moveLimit:{get:function(){return this.Yo},set:function(a){this.Yo!==a&&1<a&&(this.Yo=a,this.C())}},randomNumberGenerator:{get:function(){return this.xp},set:function(a){this.xp!==a&&(null!==a&&"function"!==typeof a.random&&B('ForceDirectedLayout.randomNumberGenerator must have a "random()" function on it: '+a),this.xp=a)}},defaultSpringStiffness:{get:function(){return this.hl},
set:function(a){this.hl!==a&&(this.hl=a,this.C())}},defaultSpringLength:{get:function(){return this.gl},set:function(a){this.gl!==a&&(this.gl=a,this.C())}},defaultElectricalCharge:{get:function(){return this.el},set:function(a){this.el!==a&&(this.el=a,this.C())}},defaultGravitationalMass:{get:function(){return this.fl},set:function(a){this.fl!==a&&(this.fl=a,this.C())}},defaultCommentSpringLength:{
get:function(){return this.Nn},set:function(a){this.Nn!==a&&(this.Nn=a,this.C())}},defaultCommentElectricalCharge:{get:function(){return this.Mn},set:function(a){this.Mn!==a&&(this.Mn=a,this.C())}}});$r.className="ForceDirectedLayout";function is(){this.Zw=this.Yw=this.ou=this.qu=this.pu=0}is.className="ForceDirectedSubnet";function as(a){Rp.call(this,a)}la(as,Rp);as.prototype.createVertex=function(){return new ms(this)};as.prototype.createEdge=function(){return new ns(this)};
as.className="ForceDirectedNetwork";function ms(a){eq.call(this,a);this.Ka=!1;this.cb=this.I=NaN;this.Sh=this.Dd=this.Ja=this.T=0;this.Ke=this.mk=null;this.yw=0}la(ms,eq);ms.prototype.serializeVertexProperties=function(a,b){eq.prototype.serializeVertexProperties.call(this,a,b);a.isFixed=this.isFixed;a.charge=this.charge;a.mass=this.mass};ms.prototype.Aq=function(a,b,c,d){eq.prototype.Aq.call(this,a,b,c,d);this.isFixed=a.isFixed;this.charge=a.charge;this.mass=a.mass};
ma.Object.defineProperties(ms.prototype,{isFixed:{get:function(){return this.Ka},set:function(a){this.Ka!==a&&(this.Ka=a)}},charge:{get:function(){return this.I},set:function(a){this.I!==a&&(this.I=a)}},mass:{get:function(){return this.cb},set:function(a){this.cb!==a&&(this.cb=a)}},forceX:{get:function(){return this.T},set:function(a){this.T!==a&&(this.T=a)}},forceY:{
get:function(){return this.Ja},set:function(a){this.Ja!==a&&(this.Ja=a)}}});ms.className="ForceDirectedVertex";function ns(a){fq.call(this,a);this.l=this.v=NaN}la(ns,fq);ns.prototype.serializeEdgeProperties=function(a,b){fq.prototype.serializeEdgeProperties.call(this,a,b);a.stiffness=this.stiffness;a.length=this.length};ns.prototype.deserializeEdgeProperties=function(a,b,c,d){fq.prototype.deserializeEdgeProperties.call(this,a,b,c,d);this.stiffness=a.stiffness;this.length=a.length};
ma.Object.defineProperties(ns.prototype,{stiffness:{get:function(){return this.v},set:function(a){this.v!==a&&(this.v=a)}},length:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a)}}});ns.className="ForceDirectedEdge";function ls(){var a=0;void 0===a&&(a=42);this.seed=a;this.Wy=48271;this.Yy=2147483647;this.Q=44488.07041494893;this.Zy=3399;this.Xy=1/2147483647;this.random()}
ls.prototype.random=function(){var a=this.seed%this.Q*this.Wy-this.seed/this.Q*this.Zy;0<a?this.seed=a:this.seed=a+this.Yy;return this.seed*this.Xy};ls.className="RandomNumberGenerator";
function os(){yi.call(this);this.Zb=this.qe=25;this.J=0;this.cl=ps;this.Gl=qs;this.vl=rs;this.Oj=4;this.Sk=ss;this.ng=7;this.hf=!0;this.Io=4;this.Ba=this.Ii=this.ra=-1;this.oc=this.lh=0;this.Ia=this.td=this.ud=this.Sd=this.zb=null;this.nh=0;this.ap=this.Tj=null;this.Ec=0;this.bp=null;this.Sc=new J;this.te=[];this.te.length=100}la(os,yi);
os.prototype.cloneProtected=function(a){yi.prototype.cloneProtected.call(this,a);a.qe=this.qe;a.Zb=this.Zb;a.J=this.J;a.cl=this.cl;a.Gl=this.Gl;a.vl=this.vl;a.Oj=this.Oj;a.Sk=this.Sk;a.ng=this.ng;a.hf=this.hf;a.Io=this.Io};
os.prototype.serializeLayoutProperties=function(a,b){yi.prototype.serializeLayoutProperties.call(this,a,b);a.layerSpacing=this.layerSpacing;a.columnSpacing=this.columnSpacing;a.direction=this.direction;a.cycleRemoveOption=this.cycleRemoveOption.name;a.layeringOption=this.layeringOption.name;a.initializeOption=this.initializeOption.name;a.iterations=this.iterations;a.aggressiveOption=this.aggressiveOption.name;a.packOption=this.packOption;a.setsPortSpots=this.setsPortSpots;a.linkSpacing=this.linkSpacing;
a.ra=this.ra;a.Ii=this.Ii;a.Ba=this.Ba;a.lh=this.lh;a.oc=this.oc;a.zb=this.zb;a.nh=this.nh;a.Ec=this.Ec;a.Sc={x:this.Sc.x,y:this.Sc.y}};
os.prototype.deserializeLayoutProperties=function(a,b,c,d){yi.prototype.deserializeLayoutProperties.call(this,a,b,c,d);this.layerSpacing=a.layerSpacing;this.columnSpacing=a.columnSpacing;this.direction=a.direction;this.cycleRemoveOption=Za(os,a.cycleRemoveOption);this.layeringOption=Za(os,a.layeringOption);this.initializeOption=Za(os,a.initializeOption);this.iterations=a.iterations;this.aggressiveOption=Za(os,a.aggressiveOption);this.packOption=a.packOption;this.setsPortSpots=a.setsPortSpots;this.linkSpacing=
a.linkSpacing;this.ra=a.ra;this.Ii=a.Ii;this.Ba=a.Ba;this.lh=a.lh;this.oc=a.oc;this.zb=a.zb;this.nh=a.nh;this.Ec=a.Ec;this.Sc=new J(this.Sc.x,this.Sc.y)};os.prototype.hb=function(a){a.classType===os?0===a.name.indexOf("Aggressive")?this.aggressiveOption=a:0===a.name.indexOf("Cycle")?this.cycleRemoveOption=a:0===a.name.indexOf("Init")?this.initializeOption=a:0===a.name.indexOf("Layer")?this.layeringOption=a:B("Unknown enum value: "+a):yi.prototype.hb.call(this,a)};os.prototype.createNetwork=function(){return new ts(this)};
os.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);this.Ii=-1;this.oc=this.lh=0;this.bp=this.ap=this.Tj=null;for(a=0;a<this.te.length;a++)this.te[a]=null;if(0<this.network.vertexes.count){this.network.zq();if(this.Sw())return;this.cycleRemoveOption!==us&&this.removeCycles();for(a=this.network.vertexes.iterator;a.next();)a.value.layer=-1;this.ra=-1;this.assignLayers();for(a.reset();a.next();)this.ra=
Math.max(this.ra,a.value.layer);this.cycleRemoveOption===us&&this.removeCycles();a=this.network;for(var b=[],c=a.edges.iterator;c.next();){var d=c.value;d.valid=!1;b.push(d)}for(c=0;c<b.length;c++){d=b[c];var e=d.fromVertex,f=d.toVertex;if(!(d.valid||(null===e.node&&null===e.data||null===f.node&&null===f.data)&&e.layer===f.layer)){var g=0,h=0,k=0,l=0;if(null!==d.link){h=d.link;if(null===h)continue;var m=e.node;g=f.node;if(null===m||null===g)continue;var n=h.fromNode;k=h.toNode;var p=h.fromPort;h=
h.toPort;if(d.rev){l=n;var r=p;n=k;p=h;k=l;h=r}var q=e.focus;l=f.focus;var u=d.rev?f.bounds:e.bounds;r=J.alloc();m!==n?u.u()&&n.isVisible()?n.actualBounds.u()?(n.Cf(p,Bc,r),r.x+=n.actualBounds.x-u.x,r.y+=n.actualBounds.y-u.y):(n.Cf(p,Bc,r),r.u()||r.assign(q)):r.assign(q):u.u()?(n.Cf(p,Bc,r),r.u()||r.assign(q)):r.assign(q);n=d.rev?e.bounds:f.bounds;m=J.alloc();g!==k?n.u()&&k.isVisible()?k.actualBounds.u()?(k.Cf(h,Bc,m),m.x+=k.actualBounds.x-n.x,m.y+=k.actualBounds.y-n.y):(k.Cf(h,Bc,m),m.u()||m.assign(l)):
m.assign(l):n.u()?(k.Cf(h,Bc,m),m.u()||m.assign(l)):m.assign(l);90===this.J||270===this.J?(g=Math.round((r.x-q.x)/this.Zb),k=r.x,h=Math.round((m.x-l.x)/this.Zb),l=m.x):(g=Math.round((r.y-q.y)/this.Zb),k=r.y,h=Math.round((m.y-l.y)/this.Zb),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 v=u.fromPort,w=u.toPort;if(null!==v&&
null!==w){var y=u.fromNode;p=u.toNode;if(null!==y&&null!==p){var z=vs(this,!0),A=vs(this,!1),C=this.setsPortSpots?z:u.computeSpot(!0,v);q=this.setsPortSpots?A:u.computeSpot(!1,w);var G=u.isOrthogonal;C.Mc()&&C.Df(A)&&q.Mc()&&q.Df(z)?n=0:(z=u.getLinkPoint(y,v,C,!0,G,p,w,J.alloc()),A=u.getLinkDirection(y,v,z,C,!0,G,p,w),J.free(z),C.Vt()||A!==ws(this,d,!0)?this.setsPortSpots&&null!==y&&1===y.ports.count&&d.rev&&(n+=1):n+=1,C=u.getLinkPoint(p,w,q,!1,G,y,v,J.alloc()),u=u.getLinkDirection(p,w,C,q,!1,G,
y,v),J.free(C),q.Vt()||u!==ws(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.wf=1,q.layer=r,q.near=e,a.Bg(q),e=a.Ak(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.wf=2;q.layer=r-1;a.Bg(q);e=a.Ak(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.wf=3,q.layer=r-1,a.Bg(q),e=a.Ak(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.Ak(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.zb=[];for(b=0;b<=this.ra;b++)a[b]=0;for(b=this.network.vertexes.iterator;b.next();)b.value.index=
-1;this.initializeIndices();this.Ii=-1;for(c=this.oc=this.lh=0;c<=this.ra;c++)a[c]>a[this.oc]&&(this.Ii=a[c]-1,this.oc=c),a[c]<a[this.lh]&&(this.lh=c);this.bp=[];for(c=0;c<a.length;c++)this.bp[c]=[];for(b.reset();b.next();)a=b.value,this.bp[a.layer][a.index]=a;this.Ba=-1;for(a=0;a<=this.ra;a++){b=xs(this,a);c=0;d=this.zb[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.Ba=Math.max(this.Ba,c-1);ys(this,a,b)}this.reduceCrossings();this.straightenAndPack();
this.updateParts()}this.network=null;this.isValidLayout=!0};os.prototype.linkMinLength=function(){return 1};function zs(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}os.prototype.nodeMinLayerSpace=function(a,b){return null===a.node&&null===a.data?0:90===this.J||270===this.J?b?a.focus.y+10:a.bounds.height-a.focus.y+10:b?a.focus.x+10:a.bounds.width-a.focus.x+10};
os.prototype.nodeMinColumnSpace=function(a,b){if(null===a.node&&null===a.data)return 0;var c=b?a.Ik:a.Hk;if(null!==c)return c;c=this.J;return 90===c||270===c?b?a.Ik=a.focus.x/this.Zb+1|0:a.Hk=(a.bounds.width-a.focus.x)/this.Zb+1|0:b?a.Ik=a.focus.y/this.Zb+1|0:a.Hk=(a.bounds.height-a.focus.y)/this.Zb+1|0};function As(a){null===a.Tj&&(a.Tj=[]);for(var b=0,c=a.network.vertexes.iterator;c.next();){var d=c.value;a.Tj[b]=d.layer;b++;a.Tj[b]=d.column;b++;a.Tj[b]=d.index;b++}return a.Tj}
function Bs(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 Cs(a,b,c){var d=xs(a,b),e=a.zb[b];if(null===a.ap||a.ap.length<e*e)a.ap=[];for(var f=a.ap,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.wf===l.wf||h++}else for(m=g-1;m>k;m--)n=d[m],n.near===l&&n.wf===l.wf||h++;var p;if(0<=c)for(k=d[g].sourceEdgesArrayAccess,l=0;l<k.length;l++){var r=k[l];if(r.valid&&r.fromVertex.layer!==b)for(n=r.fromVertex.index,m=r.portToPos,r=r.portFromPos,p=l+1;p<k.length;p++){var q=
k[p];if(q.valid&&q.fromVertex.layer!==b){var u=q.fromVertex.index;var v=q.portToPos;q=q.portFromPos;m<v&&(n>u||n===u&&r>q)&&h++;v<m&&(u>n||u===n&&q>r)&&h++}}}if(0>=c)for(k=d[g].destinationEdgesArrayAccess,l=0;l<k.length;l++)if(r=k[l],r.valid&&r.toVertex.layer!==b)for(n=r.toVertex.index,m=r.portToPos,r=r.portFromPos,p=l+1;p<k.length;p++)q=k[p],q.valid&&q.toVertex.layer!==b&&(u=q.toVertex.index,v=q.portToPos,q=q.portFromPos,r<q&&(n>u||n===u&&m>v)&&h++,q<r&&(u>n||u===n&&v>m)&&h++);f[g*e+g]=h;for(k=g+
1;k<e;k++){var w=0,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)&&w++)}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,v=q.portToPos,(n<u||n===u&&m<v)&&y++,(u<n||u===n&&v<m)&&w++);f[g*e+k]=w;f[k*e+g]=y}}ys(a,b,d);return f}os.prototype.countCrossings=function(){for(var a=0,b=0;b<=this.ra;b++)for(var c=Cs(this,b,1),d=this.zb[b],e=0;e<d;e++)for(var f=e;f<d;f++)a+=c[e*d+f];return a};
function Ds(a){for(var b=0,c=0;c<=a.ra;c++){for(var d=a,e=c,f=xs(d,e),g=d.zb[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)*zs(n)}}}ys(d,e,f);b+=h}return b}
os.prototype.normalize=function(){var a=Infinity;this.Ba=-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.Ba=Math.max(this.Ba,c.column+this.nodeMinColumnSpace(c,!1))}for(b.reset();b.next();)b.value.column-=a;this.Ba-=a};
function Es(a,b,c){for(var d=xs(a,b),e=a.zb[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}ys(a,b,d);return f}
function Fs(a,b,c){for(var d=xs(a,b),e=a.zb[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)}ys(a,b,d);return f}function Gs(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&&Gs(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&&Gs(a,k,c,d,e,f)}}
function Hs(a,b,c,d,e,f){if(b.component===d){b.component=c;if(e)for(var g=b.destinationEdges;g.next();)Hs(a,g.value.toVertex,c,d,e,f);if(f)for(b=b.sourceEdges;b.next();)Hs(a,b.value.fromVertex,c,d,e,f)}}
os.prototype.removeCycles=function(){for(var a=this.network.edges.iterator;a.next();)a.value.rev=!1;switch(this.cl){default:case Is: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!==Js(a);){for(e=Ks(a);null!==e;)d[c]=e,c--,e.valid=!1,e=Ks(a);for(e=Ls(a);null!==e;)d[b]=e,b++,e.valid=!1,e=Ls(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.Qm(b),b.rev=!0);break;case ps:for(d=this.network.vertexes.iterator;d.next();)a=d.value,a.Cg=-1,a.finish=-1;for(a=this.network.edges.iterator;a.next();)a.value.forest=!1;this.nh=0;for(d.reset();d.next();)b=d.value,0===b.sourceEdges.count&&
Ms(this,b);for(d.reset();d.next();)b=d.value,-1===b.Cg&&Ms(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.Cg<b.Cg&&c<f&&(this.network.Qm(d),d.rev=!0));break;case us: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.Qm(b),b.rev=!0)}}};function Js(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid)return b}return null}function Ks(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 Ls(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 Ms(a,b){b.Cg=a.nh;a.nh++;for(var c=b.destinationEdges;c.next();){var d=c.value,e=d.toVertex;-1===e.Cg&&(d.forest=!0,Ms(a,e))}b.finish=a.nh;a.nh++}
os.prototype.assignLayers=function(){switch(this.Gl){case Ns:Os(this);break;case Ps:for(var a,b=this.network.vertexes.iterator;b.next();)a=Qs(this,b.value),this.ra=Math.max(a,this.ra);for(b.reset();b.next();)a=b.value,a.layer=this.ra-a.layer;break;default:case qs:Os(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&&Rs(this,a);a=Infinity;for(b.reset();b.next();)a=Math.min(a,b.value.layer);this.ra=-1;for(b.reset();b.next();){var c=
b.value;c.layer-=a;this.ra=Math.max(this.ra,c.layer)}}};function Os(a){for(var b=a.network.vertexes.iterator;b.next();){var c=Ss(a,b.value);a.ra=Math.max(c,a.ra)}}function Ss(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,Ss(a,f)+e)}b.layer=c}else c=b.layer;return c}
function Qs(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,Qs(a,f)+e)}b.layer=c}else c=b.layer;return c}
function Rs(a,b){if(!b.valid){b.valid=!0;for(var c=b.destinationEdges;c.next();)Rs(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&&Gs(a,h,0,-1,!0,!1)}for(Gs(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(Gs(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 ws(a,b,c){return 90===a.J?c&&!b.rev||!c&&b.rev?270:90:180===a.J?c&&!b.rev||!c&&b.rev?0:180:270===a.J?c&&!b.rev||!c&&b.rev?90:270:c&&!b.rev||!c&&b.rev?180:0}
os.prototype.initializeIndices=function(){switch(this.vl){default:case Ts:for(var a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;b.index=this.zb[c];this.zb[c]++}break;case rs:a=this.network.vertexes.iterator;for(b=this.ra;0<=b;b--)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&Us(this,c);break;case Vs:for(a=this.network.vertexes.iterator,b=0;b<=this.ra;b++)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&Ws(this,c)}};
function Us(a,b){var c=b.layer;b.index=a.zb[c];a.zb[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&&Us(a,d))}
function Ws(a,b){var c=b.layer;b.index=a.zb[c];a.zb[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&&Ws(a,d))}
os.prototype.reduceCrossings=function(){var a=this.countCrossings(),b=As(this),c,d;for(c=0;c<this.Oj;c++){for(d=0;d<=this.ra;d++)Xs(this,d,1),Ys(this,d,1);var e=this.countCrossings();e<a&&(a=e,b=As(this));for(d=this.ra;0<=d;d--)Xs(this,d,-1),Ys(this,d,-1);e=this.countCrossings();e<a&&(a=e,b=As(this))}Bs(this,b);for(c=0;c<this.Oj;c++){for(d=0;d<=this.ra;d++)Xs(this,d,0),Ys(this,d,0);e=this.countCrossings();e<a&&(a=e,b=As(this));for(d=this.ra;0<=d;d--)Xs(this,d,0),Ys(this,d,0);e=this.countCrossings();
e<a&&(a=e,b=As(this))}Bs(this,b);var f,g,h;switch(this.Sk){case Zs:break;case $s:for(h=a+1;(d=this.countCrossings())<h;)for(h=d,c=this.ra;0<=c;c--)for(g=0;g<=c;g++){for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Ys(this,d,-1)||f;e=this.countCrossings();e>=a?Bs(this,b):(a=e,b=As(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Ys(this,d,1)||f;e=this.countCrossings();e>=a?Bs(this,b):(a=e,b=As(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Ys(this,d,1)||f;e>=a?Bs(this,b):(a=e,b=As(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=
Ys(this,d,-1)||f;e>=a?Bs(this,b):(a=e,b=As(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Ys(this,d,0)||f;e>=a?Bs(this,b):(a=e,b=As(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Ys(this,d,0)||f;e>=a?Bs(this,b):(a=e,b=As(this))}break;default:case ss:for(c=this.ra,g=0,h=a+1;(d=this.countCrossings())<h;){h=d;for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Ys(this,d,-1)||f;e=this.countCrossings();e>=a?Bs(this,b):(a=e,b=As(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Ys(this,d,1)||f;e=this.countCrossings();e>=a?Bs(this,b):
(a=e,b=As(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Ys(this,d,1)||f;e>=a?Bs(this,b):(a=e,b=As(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Ys(this,d,-1)||f;e>=a?Bs(this,b):(a=e,b=As(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Ys(this,d,0)||f;e>=a?Bs(this,b):(a=e,b=As(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Ys(this,d,0)||f;e>=a?Bs(this,b):(a=e,b=As(this))}}Bs(this,b)};
function Xs(a,b,c){var d=xs(a,b),e=a.zb[b],f=Fs(a,b,c),g=Es(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);ys(a,b,d)}
function Ys(a,b,c){var d=xs(a,b),e=a.zb[b];c=Cs(a,b,c);var f;var g=[];for(f=0;f<e;f++)g[f]=-1;var h=[];for(f=0;f<e;f++)h[f]=-1;for(var k=!1,l=!0;l;)for(l=!1,f=0;f<e-1;f++){var m=c[d[f].index*e+d[f+1].index],n=c[d[f+1].index*e+d[f].index],p=0,r=0,q=d[f].column,u=d[f+1].column,v=a.nodeMinColumnSpace(d[f],!0),w=a.nodeMinColumnSpace(d[f],!1),y=a.nodeMinColumnSpace(d[f+1],!0),z=a.nodeMinColumnSpace(d[f+1],!1);v=q-v+y;w=u-w+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 C=h[d[f].index],G=g[d[f+1].index],L=h[d[f+1].index];-1!==A&&(z+=Math.abs(A-q),y+=Math.abs(A-w));-1!==C&&(z+=Math.abs(C-q),y+=Math.abs(C-w));-1!==G&&(z+=Math.abs(G-u),y+=Math.abs(G-v));-1!==L&&(z+=Math.abs(L-u),y+=Math.abs(L-v));if(r<p-.5||r===p&&n<m-.5||r===p&&n===m&&y<z-.5)l=k=!0,d[f].column=w,d[f+1].column=v,m=d[f],d[f]=d[f+1],d[f+1]=m}for(f=0;f<e;f++)d[f].index=
f;ys(a,b,d);return k}
os.prototype.straightenAndPack=function(){var a=0!==(this.ng&1);var b=7===this.ng;1E3<this.network.edges.count&&!b&&(a=!1);if(a){var c=[];for(b=0;b<=this.ra;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.Ba-c[b])>>1)+8*d;this.Ba*=8}if(0!==(this.ng&2))for(c=!0;c;){c=!1;for(b=this.oc+1;b<=this.ra;b++)c=at(this,b,1)||c;for(b=
this.oc-1;0<=b;b--)c=at(this,b,-1)||c;c=at(this,this.oc,0)||c}if(0!==(this.ng&4)){for(b=this.oc+1;b<=this.ra;b++)bt(this,b,1);for(b=this.oc-1;0<=b;b--)bt(this,b,-1);bt(this,this.oc,0)}a&&(ct(this,-1),ct(this,1));if(0!==(this.ng&2))for(c=!0;c;){c=!1;c=at(this,this.oc,0)||c;for(b=this.oc+1;b<=this.ra;b++)c=at(this,b,0)||c;for(b=this.oc-1;0<=b;b--)c=at(this,b,0)||c}};function at(a,b,c){for(var d=!1;dt(a,b,c);)d=!0;return d}
function dt(a,b,c){var d,e=xs(a,b),f=a.zb[b],g=Es(a,b,-1);if(0<c)for(d=0;d<f;d++)g[d]=-1;var h=Es(a,b,1);if(0>c)for(d=0;d<f;d++)h[d]=-1;for(var k=!1,l=!0;l;)for(l=!1,d=0;d<f;d++){var m=e[d].column,n=a.nodeMinColumnSpace(e[d],!0),p=a.nodeMinColumnSpace(e[d],!1),r=0;0>d-1||m-e[d-1].column-1>n+a.nodeMinColumnSpace(e[d-1],!1)?r=m-1:r=m;n=d+1>=f||e[d+1].column-m-1>p+a.nodeMinColumnSpace(e[d+1],!0)?m+1:m;var q=p=0,u=0;if(0>=c)for(var v=e[d].sourceEdges.iterator;v.next();){var w=v.value;var y=w.fromVertex;
if(w.valid&&y.layer!==b){var z=zs(w);var A=w.portFromColOffset;w=w.portToColOffset;y=y.column;p+=(Math.abs(m+w-(y+A))+1)*z;q+=(Math.abs(r+w-(y+A))+1)*z;u+=(Math.abs(n+w-(y+A))+1)*z}}if(0<=c)for(v=e[d].destinationEdges.iterator;v.next();)w=v.value,y=w.toVertex,w.valid&&y.layer!==b&&(z=zs(w),A=w.portFromColOffset,w=w.portToColOffset,y=y.column,p+=(Math.abs(m+A-(y+w))+1)*z,q+=(Math.abs(r+A-(y+w))+1)*z,u+=(Math.abs(n+A-(y+w))+1)*z);w=A=z=0;v=g[e[d].index];y=h[e[d].index];-1!==v&&(z+=Math.abs(v-m),A+=
Math.abs(v-r),w+=Math.abs(v-n));-1!==y&&(z+=Math.abs(y-m),A+=Math.abs(y-r),w+=Math.abs(y-n));if(q<p||q===p&&A<z)l=k=!0,e[d].column=r;else if(u<p||u===p&&w<z)l=k=!0,e[d].column=n}ys(a,b,e);a.normalize();return k}
function bt(a,b,c){var d=xs(a,b),e=a.zb[b],f=Fs(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)}ys(a,b,d);a.normalize()}
function et(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 ft(a,b){var c=b+1;var d,e=[],f=[];for(d=0;d<=a.ra;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.ra;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 ct(a,b){for(var c=0;c<=a.Ba;c++)for(;et(a,c););a.normalize();for(c=0;c<a.Ba;c++)for(;ft(a,c););a.normalize();var d;if(0<b)for(c=0;c<=a.Ba;c++){var e=As(a);var f=Ds(a);for(d=f+1;f<d;){d=f;gt(a,c,1);var g=Ds(a);g>f?Bs(a,e):g<f&&(f=g,e=As(a))}}if(0>b)for(c=a.Ba;0<=c;c--)for(e=As(a),f=Ds(a),d=f+1;f<d;)d=f,gt(a,c,-1),g=Ds(a),g>f?Bs(a,e):g<f&&(f=g,e=As(a));a.normalize()}
function gt(a,b,c){a.Ec=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.Ec)}if(0>c)for(d.reset();d.next();)e=d.value,e.column+a.nodeMinColumnSpace(e,!1)>=b&&(e.component=a.Ec);a.Ec++;for(d.reset();d.next();)b=d.value,-1===b.component&&(Hs(a,b,a.Ec,-1,!0,!0),a.Ec++);var f;b=[];for(f=0;f<a.Ec*a.Ec;f++)b[f]=!1;e=[];for(f=0;f<(a.ra+1)*(a.Ba+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.Ba,f.column+a.nodeMinColumnSpace(f,!1));h<=k;h++)e[g*(a.Ba+1)+h]=f.component}for(f=0;f<=a.ra;f++){if(0<c)for(g=0;g<a.Ba;g++)-1!==e[f*(a.Ba+1)+g]&&-1!==e[f*(a.Ba+1)+g+1]&&e[f*(a.Ba+1)+g]!==e[f*(a.Ba+1)+g+1]&&(b[e[f*(a.Ba+1)+g]*a.Ec+e[f*(a.Ba+1)+g+1]]=!0);if(0>c)for(g=a.Ba;0<g;g--)-1!==e[f*(a.Ba+1)+g]&&-1!==e[f*(a.Ba+1)+g-1]&&e[f*(a.Ba+1)+g]!==e[f*(a.Ba+1)+g-1]&&(b[e[f*(a.Ba+1)+g]*a.Ec+e[f*(a.Ba+1)+g-1]]=!0)}e=
[];for(f=0;f<a.Ec;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.Ec;f++)b[k*a.Ec+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)}
os.prototype.commitLayout=function(){if(this.setsPortSpots)for(var a=vs(this,!0),b=vs(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.Hv();this.isRouting&&this.commitLinks()};function vs(a,b){return 270===a.J?b?fd:id:90===a.J?b?id:fd:180===a.J?b?gd:hd:b?hd:gd}
os.prototype.commitNodes=function(){this.Sd=[];this.ud=[];this.td=[];this.Ia=[];for(var a=0;a<=this.ra;a++)this.Sd[a]=0,this.ud[a]=0,this.td[a]=0,this.Ia[a]=0;for(a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;this.Sd[c]=Math.max(this.Sd[c],this.nodeMinLayerSpace(b,!0));this.ud[c]=Math.max(this.ud[c],this.nodeMinLayerSpace(b,!1))}b=0;c=this.qe;for(var d=0;d<=this.ra;d++){var e=c;0>=this.Sd[d]+this.ud[d]&&(e=0);0<d&&(b+=e/2);90===this.J||0===this.J?(b+=this.ud[d],this.td[d]=b,
b+=this.Sd[d]):(b+=this.Sd[d],this.td[d]=b,b+=this.ud[d]);d<this.ra&&(b+=e/2);this.Ia[d]=b}c=b;b=this.arrangementOrigin;for(d=0;d<=this.ra;d++)270===this.J?this.td[d]=b.y+this.td[d]:90===this.J?(this.td[d]=b.y+c-this.td[d],this.Ia[d]=c-this.Ia[d]):180===this.J?this.td[d]=b.x+this.td[d]:(this.td[d]=b.x+c-this.td[d],this.Ia[d]=c-this.Ia[d]);a.reset();for(c=d=Infinity;a.next();){e=a.value;var f=e.layer,g=e.column|0;if(270===this.J||90===this.J){var h=b.x+this.Zb*g;f=this.td[f]}else h=this.td[f],f=b.y+
this.Zb*g;e.centerX=h;e.centerY=f;d=Math.min(e.x,d);c=Math.min(e.y,c)}d=b.x-d;b=b.y-c;this.Sc=new J(d,b);for(a.reset();a.next();)c=a.value,c.x+=d,c.y+=b,c.commit()};
os.prototype.Hv=function(){for(var a=0,b=this.qe,c=0;c<=this.ra;c++)a+=this.Sd[c],a+=this.ud[c];a+=this.ra*b;b=[];c=this.Zb*this.Ba;for(var d=this.maxLayer;0<=d;d--)270===this.J?0===d?b.push(new N(0,0,c,Math.abs(this.Ia[0]))):b.push(new N(0,this.Ia[d-1],c,Math.abs(this.Ia[d-1]-this.Ia[d]))):90===this.J?0===d?b.push(new N(0,this.Ia[0],c,Math.abs(this.Ia[0]-a))):b.push(new N(0,this.Ia[d],c,Math.abs(this.Ia[d-1]-this.Ia[d]))):180===this.J?0===d?b.push(new N(0,0,Math.abs(this.Ia[0]),c)):b.push(new N(this.Ia[d-
1],0,Math.abs(this.Ia[d-1]-this.Ia[d]),c)):0===d?b.push(new N(this.Ia[0],0,Math.abs(this.Ia[0]-a),c)):b.push(new N(this.Ia[d],0,Math.abs(this.Ia[d-1]-this.Ia[d]),c));this.commitLayers(b,this.Sc)};os.prototype.commitLayers=function(){};
os.prototype.commitLinks=function(){for(var a=this.network.edges.iterator,b;a.next();)b=a.value.link,null!==b&&(b.Th(),b.lk(),b.xf());for(a.reset();a.next();)b=a.value.link,null!==b&&b.wj();for(a.reset();a.next();){var c=a.value;b=c.link;if(null!==b){b.Th();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===pg&&4===b.pointsCount)if(m.column===n.column)c=b.getLinkPoint(e,g,l,!0,!1,f,h),g=b.getLinkPoint(f,h,k,!1,!1,e,g),c.u()||c.set(e.actualBounds.center),g.u()||g.set(f.actualBounds.center),b.lk(),b.vf(c.x,c.y),b.vf((2*c.x+g.x)/3,(2*c.y+g.y)/3),b.vf((c.x+2*g.x)/3,(c.y+2*g.y)/3),b.vf(g.x,g.y);else{var p=!1,r=!1;null!==g&&l===vc&&(p=!0);null!==h&&k===vc&&(r=!0);if(p||r){var q=b.i(0).x;c=b.i(0).y;m=b.i(3).x;d=b.i(3).y;p&&(90===this.J||270===this.J?(p=q,n=
(c+d)/2):(p=(q+m)/2,n=c),b.K(1,p,n),l=b.getLinkPoint(e,g,l,!0,!1,f,h),l.u()||l.set(e.actualBounds.center),b.K(0,l.x,l.y));r&&(90===this.J||270===this.J?(l=m,c=(c+d)/2):(l=(q+m)/2,c=d),b.K(2,l,c),e=b.getLinkPoint(f,h,k,!1,!1,e,g),e.u()||e.set(f.actualBounds.center),b.K(3,e.x,e.y))}}b.xf()}else if(m.layer===n.layer)b.xf();else{p=r=!1;q=b.firstPickIndex+1;if(b.isOrthogonal){p=!0;var u=b.pointsCount;4<u&&b.points.removeRange(2,u-3)}else if(b.curve===pg)r=!0,u=b.pointsCount,4<u&&b.points.removeRange(2,
u-3),4===u&&(q=2);else{u=b.pointsCount;var v=l===vc,w=k===vc;2<u&&v&&w?b.points.removeRange(1,u-2):3<u&&v&&!w?b.points.removeRange(1,u-3):3<u&&!v&&w?b.points.removeRange(2,u-2):4<u&&!v&&!w&&b.points.removeRange(2,u-3)}if(c.rev){for(;null!==n&&m!==n;){var y=u=null;for(v=n.sourceEdges.iterator;v.next()&&(w=v.value,w.link!==c.link||(u=w.fromVertex,y=w.toVertex,null!==u.node)););if(u!==m){v=b.i(q-1).x;w=b.i(q-1).y;var z=u.centerX;var A=u.centerY;if(p)180===this.J||0===this.J?q===b.firstPickIndex+1?(b.m(q++,
v,w),b.m(q++,v,A)):(null!==y?y.centerY:w)!==A&&(y=this.Ia[u.layer-1]+this.Sc.x,b.m(q++,y,w),b.m(q++,y,A)):q===b.firstPickIndex+1?(b.m(q++,v,w),b.m(q++,z,w)):(null!==y?y.centerX:v)!==z&&(y=this.Ia[u.layer-1]+this.Sc.y,b.m(q++,v,y),b.m(q++,z,y));else if(q===b.firstPickIndex+1){y=Math.max(10,this.Sd[n.layer]);var C=Math.max(10,this.ud[n.layer]);if(r)180===this.J?z<=n.bounds.x?(n=n.bounds.x,b.m(q++,n-y,A),b.m(q++,n,A),b.m(q++,n+C,A)):(b.m(q++,z-y,A),b.m(q++,z,A),b.m(q++,z+C,A)):90===this.J?A>=n.bounds.bottom?
(n=n.bounds.y+n.bounds.height,b.m(q++,z,n+C),b.m(q++,z,n),b.m(q++,z,n-y)):(b.m(q++,z,A+C),b.m(q++,z,A),b.m(q++,z,A-y)):270===this.J?A<=n.bounds.y?(n=n.bounds.y,b.m(q++,z,n-y),b.m(q++,z,n),b.m(q++,z,n+C)):(b.m(q++,z,A-y),b.m(q++,z,A),b.m(q++,z,A+C)):0===this.J&&(z>=n.bounds.right?(n=n.bounds.x+n.bounds.width,b.m(q++,n+C,A),b.m(q++,n,A),b.m(q++,n-y,A)):(b.m(q++,z+C,A),b.m(q++,z,A),b.m(q++,z-y,A)));else{b.m(q++,v,w);var G=0;if(180===this.J||0===this.J){if(180===this.J?z>=n.bounds.right:z<=n.bounds.x)G=
(0===this.J?-y:C)/2;b.m(q++,v+G,A)}else{if(270===this.J?A>=n.bounds.bottom:A<=n.bounds.y)G=(90===this.J?-y:C)/2;b.m(q++,z,w+G)}b.m(q++,z,A)}}else y=Math.max(10,this.Sd[u.layer]),C=Math.max(10,this.ud[u.layer]),180===this.J?(r&&b.m(q++,z-y,A),b.m(q++,z,A),r&&b.m(q++,z+C,A)):90===this.J?(r&&b.m(q++,z,A+C),b.m(q++,z,A),r&&b.m(q++,z,A-y)):270===this.J?(r&&b.m(q++,z,A-y),b.m(q++,z,A),r&&b.m(q++,z,A+C)):(r&&b.m(q++,z+C,A),b.m(q++,z,A),r&&b.m(q++,z-y,A))}n=u}if(null===h||l!==vc||p)if(v=b.i(q-1).x,w=b.i(q-
1).y,z=b.i(q).x,A=b.i(q).y,p)n=this.ud[m.layer],180===this.J||0===this.J?(p=w,p>=m.bounds.y&&p<=m.bounds.bottom&&(180===this.J?z>=m.bounds.x:z<=m.bounds.right)&&(n=m.centerX+(180===this.J?-n:n),p<m.bounds.y+m.bounds.height/2?p=m.bounds.y-this.Zb/2:p=m.bounds.bottom+this.Zb/2,b.m(q++,n,w),b.m(q++,n,p)),b.m(q++,z,p)):(p=v,p>=m.bounds.x&&p<=m.bounds.right&&(270===this.J?A>=m.bounds.y:A<=m.bounds.bottom)&&(n=m.centerY+(270===this.J?-n:n),p<m.bounds.x+m.bounds.width/2?p=m.bounds.x-this.Zb/2:p=m.bounds.right+
this.Zb/2,b.m(q++,v,n),b.m(q++,p,n)),b.m(q++,p,A)),b.m(q++,z,A);else if(r)y=Math.max(10,this.Sd[m.layer]),C=Math.max(10,this.ud[m.layer]),180===this.J&&z>=m.bounds.x?(n=m.bounds.x+m.bounds.width,b.K(q-2,n,w),b.K(q-1,n+C,w)):90===this.J&&A<=m.bounds.bottom?(n=m.bounds.y,b.K(q-2,v,n),b.K(q-1,v,n-y)):270===this.J&&A>=m.bounds.y?(n=m.bounds.y+m.bounds.height,b.K(q-2,v,n),b.K(q-1,v,n+C)):0===this.J&&z<=m.bounds.right&&(n=m.bounds.x,b.K(q-2,n,w),b.K(q-1,n-y,w));else{y=Math.max(10,this.Sd[m.layer]);C=Math.max(10,
this.ud[m.layer]);p=0;if(180===this.J||0===this.J){if(180===this.J?z<=m.bounds.x:z>=m.bounds.right)p=(0===this.J?C:-y)/2;b.m(q++,z+p,w)}else{if(270===this.J?A<=m.bounds.y:A>=m.bounds.bottom)p=(90===this.J?C:-y)/2;b.m(q++,v,A+p)}b.m(q++,z,A)}}else{for(;null!==m&&m!==n;){y=u=null;for(m=m.destinationEdges.iterator;m.next()&&(v=m.value,v.link!==c.link||(u=v.toVertex,y=v.fromVertex,null!==y.node&&(y=null),null!==u.node)););u!==n&&(v=b.i(q-1).x,w=b.i(q-1).y,z=u.centerX,A=u.centerY,p?180===this.J||0===this.J?
(null!==y?y.centerY:w)!==A&&(y=this.Ia[u.layer]+this.Sc.x,q===b.firstPickIndex+1&&(y=0===this.J?Math.max(y,v):Math.min(y,v)),b.m(q++,y,w),b.m(q++,y,A)):(null!==y?y.centerX:v)!==z&&(y=this.Ia[u.layer]+this.Sc.y,q===b.firstPickIndex+1&&(y=90===this.J?Math.max(y,w):Math.min(y,w)),b.m(q++,v,y),b.m(q++,z,y)):(y=Math.max(10,this.Sd[u.layer]),C=Math.max(10,this.ud[u.layer]),180===this.J?(b.m(q++,z+C,A),r&&b.m(q++,z,A),b.m(q++,z-y,A)):90===this.J?(b.m(q++,z,A-y),r&&b.m(q++,z,A),b.m(q++,z,A+C)):270===this.J?
(b.m(q++,z,A+C),r&&b.m(q++,z,A),b.m(q++,z,A-y)):(b.m(q++,z-y,A),r&&b.m(q++,z,A),b.m(q++,z+C,A))));m=u}p&&(v=b.i(q-1).x,w=b.i(q-1).y,z=b.i(q).x,A=b.i(q).y,180===this.J||0===this.J?w!==A&&(y=0===this.J?Math.min(Math.max((z+v)/2,this.Ia[n.layer]+this.Sc.x),z):Math.max(Math.min((z+v)/2,this.Ia[n.layer]+this.Sc.x),z),b.m(q++,y,w),b.m(q++,y,A)):v!==z&&(y=90===this.J?Math.min(Math.max((A+w)/2,this.Ia[n.layer]+this.Sc.y),A):Math.max(Math.min((A+w)/2,this.Ia[n.layer]+this.Sc.y),A),b.m(q++,v,y),b.m(q++,z,y)))}null!==
d&&r&&(null!==g&&(l===vc&&(l=b.i(0),d=b.i(2),l.w(d)||b.K(1,(l.x+d.x)/2,(l.y+d.y)/2)),l=b.getLinkPoint(e,g,vc,!0,!1,f,h),l.u()||l.set(e.actualBounds.center),b.K(0,l.x,l.y)),null!==h&&(k===vc&&(k=b.i(b.pointsCount-1),l=b.i(b.pointsCount-3),k.w(l)||b.K(b.pointsCount-2,(k.x+l.x)/2,(k.y+l.y)/2)),e=b.getLinkPoint(f,h,vc,!1,!1,e,g),e.u()||e.set(f.actualBounds.center),b.K(b.pointsCount-1,e.x,e.y)));b.xf();c.commit()}}}this.avoidOrthogonalOverlaps()};
os.prototype.avoidOrthogonalOverlaps=function(){if(!(0>=this.linkSpacing)){for(var a=new E,b=this.network.edges.iterator;b.next();){var c=b.value.link;null!==c&&c.isOrthogonal&&!a.contains(c)&&a.add(c)}if(0<a.count)if(90===this.J||270===this.J){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.A(f.y,g.y)&&!this.A(f.x,g.x)){var h=new ht;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.Xb=l.x*l.x+l.y;h.ad=Math.min(f.x,g.x);h.uc=Math.max(f.x,g.x);h.index=e;h.link=d;if(e+2<d.pointsCount){k=d.i(e-1);l=d.i(e+2);var m=0;k.y<f.y?m=l.y<f.y?3:f.x<g.x?2:1:k.y>f.y&&(m=l.y>f.y?0:g.x<f.x?2:1);h.l=m}c.push(h)}}}if(1<c.length)for(c.sort(this.Oy),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].uc;for(e=a+1;e<d&&c[e].ad<g;)g=Math.max(g,c[e].uc),e++;g=e-f;if(1<g){this.tj(c,this.hu,f,f+g);m=1;h=c[f].Xb;for(k=f;k<e;k++)l=c[k],l.Xb!==
h&&(m++,h=l.Xb);this.tj(c,this.Ny,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].Xb,this.tj(c,this.hu,f,f+g)):h=c[f].first;m=0;for(n=f;n<e;n++){var p=c[n];(k?p.first:p.Xb)!==h&&(m++,h=k?p.first:p.Xb);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.Th();r.K(p.index,f.x,f.y+q);r.K(p.index+1,g.x,g.y+q);r.xf()}}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.A(f.x,g.x)&&!this.A(f.y,g.y)&&(h=new ht,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.Xb=l.x+l.y*l.y,h.ad=Math.min(f.y,g.y),h.uc=Math.max(f.y,g.y),h.index=e,h.link=d,e+2<d.pointsCount&&(k=d.i(e-1),l=d.i(e+2),m=0,k.x<f.x?m=l.x<f.x?3:f.y<g.y?2:1:k.x>f.x&&(m=l.x>f.x?0:g.y<f.y?2:1),h.l=m),c.push(h));if(1<c.length)for(c.sort(this.Oy),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].uc;for(e=a+1;e<d&&c[e].ad<g;)g=Math.max(g,c[e].uc),e++;g=e-f;if(1<g){this.tj(c,this.hu,f,f+g);m=1;h=c[f].Xb;for(k=f;k<e;k++)l=c[k],l.Xb!==h&&(m++,h=l.Xb);this.tj(c,this.Ny,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].Xb,this.tj(c,this.hu,f,f+g)):h=c[f].first;m=0;for(n=f;n<e;n++)p=c[n],(k?p.first:p.Xb)!==h&&(m++,h=k?p.first:p.Xb),r=p.link,f=r.i(p.index),g=r.i(p.index+1),q=this.linkSpacing*(m-(l-1)/2),b++,r.Th(),r.K(p.index,
f.x+q,f.y),r.K(p.index+1,g.x+q,g.y),r.xf()}f=e}a=d}}}};t=os.prototype;t.Oy=function(a,b){return a instanceof ht&&b instanceof ht&&a!==b?a.layer<b.layer?-1:a.layer>b.layer?1:a.ad<b.ad?-1:a.ad>b.ad?1:a.uc<b.uc?-1:a.uc>b.uc?1:0:0};t.Ny=function(a,b){return a instanceof ht&&b instanceof ht&&a!==b?a.first<b.first?-1:a.first>b.first||a.l<b.l?1:a.l>b.l||a.ad<b.ad?-1:a.ad>b.ad?1:a.uc<b.uc?-1:a.uc>b.uc?1:0:0};
t.hu=function(a,b){return a instanceof ht&&b instanceof ht&&a!==b?a.Xb<b.Xb?-1:a.Xb>b.Xb||a.l<b.l?1:a.l>b.l||a.ad<b.ad?-1:a.ad>b.ad?1:a.uc<b.uc?-1:a.uc>b.uc?1:0:0};t.A=function(a,b){a-=b;return-1<a&&1>a};
t.tj=function(a,b,c,d){var e=a.length,f=d-c;if(!(1>=f))if((0>c||c>=e-1)&&B("not in range 0 <= from < length: "+c),2===f)d=a[c],e=a[c+1],0<b(d,e)&&(a[c]=e,a[c+1]=d);else if(0===c)if(d>=e)a.sort(b);else for(c=a.slice(0,d),c.sort(b),b=0;b<d;b++)a[b]=c[b];else if(d>=e)for(d=a.slice(c),d.sort(b),b=c;b<e;b++)a[b]=d[b-c];else for(e=a.slice(c,d),e.sort(b),b=c;b<d;b++)a[b]=e[b-c]};
function xs(a,b){var c=a.zb[b];if(c>=a.te.length){var d=[];for(var e=0;e<a.te.length;e++)d[e]=a.te[e];a.te=d}void 0===a.te[c]||null===a.te[c]?d=[]:(d=a.te[c],a.te[c]=null);a=a.bp[b];for(b=0;b<a.length;b++)c=a[b],d[c.index]=c;return d}function ys(a,b,c){a.te[a.zb[b]]=c}
ma.Object.defineProperties(os.prototype,{layerSpacing:{get:function(){return this.qe},set:function(a){this.qe!==a&&0<=a&&(this.qe=a,this.C())}},columnSpacing:{get:function(){return this.Zb},set:function(a){this.Zb!==a&&0<a&&(this.Zb=a,this.C())}},direction:{get:function(){return this.J},set:function(a){this.J!==a&&(0===a||90===a||180===a||270===a?(this.J=a,this.C()):B("LayeredDigraphLayout.direction must be 0, 90, 180, or 270"))}},
cycleRemoveOption:{get:function(){return this.cl},set:function(a){this.cl===a||a!==Is&&a!==ps&&a!==us||(this.cl=a,this.C())}},layeringOption:{get:function(){return this.Gl},set:function(a){this.Gl===a||a!==qs&&a!==Ns&&a!==Ps||(this.Gl=a,this.C())}},initializeOption:{get:function(){return this.vl},set:function(a){this.vl===a||a!==rs&&a!==Vs&&a!==Ts||(this.vl=a,this.C())}},iterations:{
get:function(){return this.Oj},set:function(a){this.Oj!==a&&0<=a&&(this.Oj=a,this.C())}},aggressiveOption:{get:function(){return this.Sk},set:function(a){this.Sk===a||a!==Zs&&a!==ss&&a!==$s||(this.Sk=a,this.C())}},packOption:{get:function(){return this.ng},set:function(a){this.ng!==a&&0<=a&&8>a&&(this.ng=a,this.C())}},setsPortSpots:{get:function(){return this.hf},set:function(a){this.hf!==a&&(this.hf=a,this.C())}},
linkSpacing:{get:function(){return this.Io},set:function(a){this.Io!==a&&0<=a&&(this.Io=a,this.C())}},maxLayer:{get:function(){return this.ra}},maxIndex:{get:function(){return this.Ii}},maxColumn:{get:function(){return this.Ba}},minIndexLayer:{get:function(){return this.lh}},maxIndexLayer:{get:function(){return this.oc}}});
var ps=new D(os,"CycleDepthFirst",0),Is=new D(os,"CycleGreedy",1),us=new D(os,"CycleFromLayers",2),qs=new D(os,"LayerOptimalLinkLength",0),Ns=new D(os,"LayerLongestPathSink",1),Ps=new D(os,"LayerLongestPathSource",2),rs=new D(os,"InitDepthFirstOut",0),Vs=new D(os,"InitDepthFirstIn",1),Ts=new D(os,"InitNaive",2),Zs=new D(os,"AggressiveNone",0),ss=new D(os,"AggressiveLess",1),$s=new D(os,"AggressiveMore",2);os.className="LayeredDigraphLayout";os.CycleDepthFirst=ps;os.CycleGreedy=Is;
os.CycleFromLayers=us;os.LayerOptimalLinkLength=qs;os.LayerLongestPathSink=Ns;os.LayerLongestPathSource=Ps;os.InitDepthFirstOut=rs;os.InitDepthFirstIn=Vs;os.InitNaive=Ts;os.AggressiveNone=Zs;os.AggressiveLess=ss;os.AggressiveMore=$s;os.PackNone=0;os.PackExpand=1;os.PackStraighten=2;os.PackMedian=4;os.PackAll=7;function ht(){this.index=this.uc=this.ad=this.Xb=this.first=this.layer=0;this.link=null;this.l=0}ht.className="SegInfo";function ts(a){Rp.call(this,a)}la(ts,Rp);ts.prototype.createVertex=function(){return new it(this)};
ts.prototype.createEdge=function(){return new jt(this)};ts.className="LayeredDigraphNetwork";function it(a){eq.call(this,a);this.Pa=this.Rg=this.Ei=-1;this.I=NaN;this.T=null;this.valid=!1;this.finish=this.Cg=NaN;this.wf=0;this.Hk=this.Ik=null}la(it,eq);
it.prototype.serializeVertexProperties=function(a,b){eq.prototype.serializeVertexProperties.call(this,a,b);a.layer=this.layer;a.column=this.column;a.index=this.index;a.component=this.component;a.near=this.near?mb(this.near):null;a.valid=this.valid;a.Cg=this.Cg;a.finish=this.finish;a.wf=this.wf;a.Ik=this.Ik;a.Hk=this.Hk};
it.prototype.Aq=function(a,b,c,d){eq.prototype.Aq.call(this,a,b,c,d);this.layer=a.layer;this.column=a.column;this.index=a.index;this.component=a.component;if(b=b.get(a.near))this.near=b;this.valid=a.valid;this.Cg=a.Cg;this.finish=a.finish;this.wf=a.wf;this.Ik=a.Ik;this.Hk=a.Hk};
ma.Object.defineProperties(it.prototype,{layer:{get:function(){return this.Ei},set:function(a){this.Ei!==a&&(this.Ei=a)}},column:{get:function(){return this.Rg},set:function(a){this.Rg!==a&&(this.Rg=a)}},index:{get:function(){return this.Pa},set:function(a){this.Pa!==a&&(this.Pa=a)}},component:{get:function(){return this.I},set:function(a){this.I!==a&&(this.I=a)}},near:{
get:function(){return this.T},set:function(a){this.T!==a&&(this.T=a)}}});it.className="LayeredDigraphVertex";function jt(a){fq.call(this,a);this.l=this.Ka=this.cb=!1;this.Ja=this.I=NaN;this.T=this.v=0}la(jt,fq);
jt.prototype.serializeEdgeProperties=function(a,b){fq.prototype.serializeEdgeProperties.call(this,a,b);a.valid=this.valid;a.rev=this.rev;a.forest=this.forest;a.portFromPos=this.portFromPos;a.portToPos=this.portToPos;a.portFromColOffset=this.portFromColOffset;a.portToColOffset=this.portToColOffset};
jt.prototype.deserializeEdgeProperties=function(a,b,c,d){fq.prototype.deserializeEdgeProperties.call(this,a,b,c,d);this.valid=a.valid;this.rev=a.rev;this.forest=a.forest;this.portFromPos=a.portFromPos;this.portToPos=a.portToPos;this.portFromColOffset=a.portFromColOffset;this.portToColOffset=a.portToColOffset};
ma.Object.defineProperties(jt.prototype,{valid:{get:function(){return this.cb},set:function(a){this.cb!==a&&(this.cb=a)}},rev:{get:function(){return this.Ka},set:function(a){this.Ka!==a&&(this.Ka=a)}},forest:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a)}},portFromPos:{get:function(){return this.I},set:function(a){this.I!==a&&(this.I=a)}},portToPos:{
get:function(){return this.Ja},set:function(a){this.Ja!==a&&(this.Ja=a)}},portFromColOffset:{get:function(){return this.v},set:function(a){this.v!==a&&(this.v=a)}},portToColOffset:{get:function(){return this.T},set:function(a){this.T!==a&&(this.T=a)}}});jt.className="LayeredDigraphEdge";
function kt(){yi.call(this);this.Jb=new F;this.qp=lt;this.fd=mt;this.mq=nt;this.vs=ot;this.lx=[];this.ed=!0;this.Eb=pt;this.Hd=(new M(10,10)).freeze();var a=new qt(this);this.U=new rt(a);this.V=new rt(a);this.uv=[]}la(kt,yi);kt.prototype.cloneProtected=function(a){yi.prototype.cloneProtected.call(this,a);a.qp=this.qp;a.mq=this.mq;a.vs=this.vs;a.ed=this.ed;a.Eb=this.Eb;a.Hd.assign(this.Hd);a.U.copyInheritedPropertiesFrom(this.U);a.V.copyInheritedPropertiesFrom(this.V)};
kt.prototype.hb=function(a){a.classType===kt?0===a.name.indexOf("Alignment")?this.alignment=a:0===a.name.indexOf("Arrangement")?this.arrangement=a:0===a.name.indexOf("Compaction")?this.compaction=a:0===a.name.indexOf("Path")?this.path=a:0===a.name.indexOf("Sorting")?this.sorting=a:0===a.name.indexOf("Style")?this.treeStyle=a:B("Unknown enum value: "+a):yi.prototype.hb.call(this,a)};kt.prototype.createNetwork=function(){return new qt(this)};
kt.prototype.makeNetwork=function(a){function b(a){if(a instanceof V)return!a.isLinkLabel&&"Comment"!==a.category;if(a instanceof S){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.Ag(a.nodes,!0,b),c.Ag(a.links,!0,b)):a instanceof vf?c.Ag(a.memberParts,!1,b):c.Ag(a.iterator,!1,b);return c};
kt.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));this.arrangement!==st&&(this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin));var b=this.diagram;null===b&&a instanceof Q&&(b=a);this.path===lt&&null!==b?this.fd=b.isTreePathToChildren?mt:tt:this.fd=this.path===lt?mt:this.path;if(0<this.network.vertexes.count){this.network.zq();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.Jb.count){a=
new F;for(b=this.Jb.iterator;b.next();){var c=b.value;c instanceof V?(c=this.network.kj(c),null!==c&&a.add(c)):c instanceof rt&&a.add(c)}this.Jb=a}0===this.Jb.count&&this.findRoots();for(a=this.Jb.copy().iterator;a.next();)b=a.value,b.initialized||(b.initialized=!0,ut(this,b));b=this.network.vertexes;for(a=null;a=vt(b),0<a.count;)b=wt(this,a),null!==b&&this.Jb.add(b),b.initialized=!0,ut(this,b),b=a;for(a=this.Jb.iterator;a.next();)b=a.value,b instanceof rt&&xt(this,b);for(a=this.Jb.iterator;a.next();)b=
a.value,b instanceof rt&&yt(this,b);for(a=this.Jb.iterator;a.next();)b=a.value,b instanceof rt&&zt(this,b);this.Fv();if(this.layerStyle===At){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.lx=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===Bt)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.Jb.iterator;a.next();)b=a.value,b instanceof rt&&this.layoutTree(b);this.arrangeTrees();this.updateParts()}this.network=null;this.Jb=new F;this.isValidLayout=!0};function vt(a){var b=new F;for(a=a.iterator;a.next();){var c=a.value;c.initialized||b.add(c)}return b}
kt.prototype.findRoots=function(){for(var a=this.network.vertexes,b=a.iterator;b.next();){var c=b.value;switch(this.fd){case mt:0===c.sourceEdges.count&&this.Jb.add(c);break;case tt:0===c.destinationEdges.count&&this.Jb.add(c);break;default:B("Unhandled path value "+this.fd.toString())}}0===this.Jb.count&&(a=wt(this,a),null!==a&&this.Jb.add(a))};
function wt(a,b){var c=999999,d=null;for(b=b.iterator;b.next();){var e=b.value;switch(a.fd){case mt:e.sourceEdges.count<c&&(c=e.sourceEdges.count,d=e);break;case tt:e.destinationEdges.count<c&&(c=e.destinationEdges.count,d=e);break;default:B("Unhandled path value "+a.fd.toString())}}return d}
function ut(a,b){if(null!==b){switch(a.fd){case mt:if(0<b.destinationEdges.count){for(var c=new E,d=b.destinationVertexes;d.next();){var e=d.value;Ct(a,b,e)&&c.add(e)}0<c.count&&(b.children=c.ma())}break;case tt:if(0<b.sourceEdges.count){c=new E;for(d=b.sourceVertexes;d.next();)e=d.value,Ct(a,b,e)&&c.add(e);0<c.count&&(b.children=c.ma())}break;default:B("Unhandled path value"+a.fd.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.Jb.remove(f)}for(b=
0;b<d;b++)ut(a,c[b])}}function Ct(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}kt.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 xt(a,b){if(null!==b){a.initializeTreeVertexValues(b);b.alignment===Dt&&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];xt(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 Et(a,b){switch(a.mq){default:case nt:return null!==b.parent?b.parent:a.U;case Ft:return null===b.parent?a.U:null===b.parent.parent?a.V:b.parent;case Gt:return null!==b.parent?null!==b.parent.parent?b.parent.parent:a.V:a.U;case Ht:var c=!0;if(0===b.childrenCount)c=!1;else for(var d=b.children,e=d.length,f=0;f<e;f++)if(0<d[f].childrenCount){c=!1;break}return c&&null!==b.parent?a.V:null!==b.parent?b.parent:a.U}}
kt.prototype.initializeTreeVertexValues=function(a){a.copyInheritedPropertiesFrom(Et(this,a));if(null!==a.parent&&a.parent.alignment===Dt){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 yt(a,b){if(null!==b){a.assignTreeVertexValues(b);b=b.children;for(var c=b.length,d=0;d<c;d++)yt(a,b[d])}}kt.prototype.assignTreeVertexValues=function(){};
function zt(a,b){if(null!==b){b.alignment!==Dt&&a.sortTreeVertexChildren(b);b=b.children;for(var c=b.length,d=0;d<c;d++)zt(a,b[d])}}kt.prototype.sortTreeVertexChildren=function(a){switch(a.sorting){case It:break;case Jt:a.children.reverse();break;case Kt:a.children.sort(a.comparer);break;case Lt:a.children.sort(a.comparer);a.children.reverse();break;default:B("Unhandled sorting value "+a.sorting.toString())}};kt.prototype.Fv=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)};
kt.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=Mt(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.Rv();l.next();){var m=l.value;"Comment"===m.category&&m.canLayout()&&(null===a.comments&&(a.comments=[]),a.comments.push(m),m.Ta(),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 Mt(a){return a===Nt||a===Dt||a===Ot||a===Pt}function Qt(a){return a===Nt||a===Dt}
function Rt(a){var b=a.parent;if(null!==b){var c=b.alignment;if(Mt(c)){if(Qt(c)){b=b.children;for(c=0;c<b.length&&a!==b[c];)c++;return 0===c%2}if(c===Ot)return!0}}return!1}
kt.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=Mt(f));d=90===d||270===d;c=90===e||270===e;for(var g=0===a.childrenCount,h=Rt(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.Bd();r.next();){var u=r.value;u.fromSpot=
gd;u.toSpot=hd}else for(n.h(a.bounds.x+2*a.focus.x-a.commentMargin,a.bounds.y+k),r.move(n),r=r.Bd();r.next();)u=r.value,u.fromSpot=hd,u.toSpot=gd;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.Bd();r.next();)u=r.value,u.fromSpot=hd,u.toSpot=gd;else for(n.h(a.bounds.x+a.commentMargin-q.width,a.bounds.y+k),r.move(n),r=r.Bd();r.next();)u=r.value,u.fromSpot=gd,u.toSpot=hd;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.Bd();r.next();)u=r.value,u.fromSpot=fd,u.toSpot=id;else for(n.h(a.bounds.x+k,a.bounds.y+2*a.focus.y-a.commentMargin),r.move(n),r=r.Bd();r.next();)u=r.value,u.fromSpot=id,u.toSpot=fd;else if(0<=a.commentMargin)for(n.h(a.bounds.x+k,a.bounds.y+2*a.focus.y+a.commentMargin),r.move(n),r=r.Bd();r.next();)u=r.value,u.fromSpot=id,u.toSpot=fd;else for(n.h(a.bounds.x+k,a.bounds.y+a.commentMargin-q.height),
r.move(n),r=r.Bd();r.next();)u=r.value,u.fromSpot=fd,u.toSpot=id;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.fd===mt)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)}};
kt.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 St:Tt(this,a);break;case Ut:if(a.alignment===Dt)Tt(this,a);else if(0===a.childrenCount)d=a.parent,c=!1,b=0,null!==d&&(b=d.angle,c=d.alignment,c=Mt(c)),d=Rt(a),a.S.h(0,0),a.ua.h(a.width,a.height),null===a.parent||null===a.comments||(180!==b&&270!==b||c)&&!d?a.da.h(0,0):180===b&&!c||(90===b||270===b)&&d?a.da.h(a.width-2*a.focus.x,0):a.da.h(0,a.height-2*a.focus.y),
a.Pq=null,a.cr=null;else{var e=Vt(a);b=90===e||270===e;var f=0,g=a.children,h=g.length;for(c=0;c<h;c++)d=g[c],f=Math.max(f,b?d.ua.width:d.ua.height);var k=a.alignment,l=k===Wt,m=Mt(k),n=Math.max(0,a.breadthLimit);c=bu(a);var p=a.nodeSpacing,r=cu(a),q=a.rowSpacing,u=0;if(k===du||l||a.Rm||a.Sm&&1===a.maxGenerationCount)u=Math.max(0,a.rowIndent);d=a.width;var v=a.height,w=0,y=0,z=0,A=null,C=null,G=0,L=0,I=0,T=0,R=0,ca=0,qa=0,O=0;m&&!Qt(k)&&135<e&&g.reverse();if(Qt(k))if(1<h)for(var za=0;za<h;za++)0===
za%2&&za!==h-1&&(O=Math.max(O,b?g[za].ua.width:g[za].ua.height));else 1===h&&(O=b?g[0].ua.width:g[0].ua.height);if(m){switch(k){case Nt:y=135>e?eu(a,g,O,w,y):fu(a,g,O,w,y);O=y.x;w=y.width;y=y.height;break;case Ot:for(A=0;A<h;A++)C=g[A],n=C.ua,z=0===ca?0:q,b?(C.S.h(f-n.width,T+z),w=Math.max(w,n.width),y=Math.max(y,T+z+n.height),T+=z+n.height):(C.S.h(I+z,f-n.height),w=Math.max(w,I+z+n.width),y=Math.max(y,n.height),I+=z+n.width),ca++;break;case Pt:for(A=0;A<h;A++)C=g[A],f=C.ua,n=0===ca?0:q,b?(C.S.h(p/
2+a.focus.x,T+n),w=Math.max(w,f.width),y=Math.max(y,T+n+f.height),T+=n+f.height):(C.S.h(I+n,p/2+a.focus.y),w=Math.max(w,I+n+f.width),y=Math.max(y,f.height),I+=n+f.width),ca++}A=gu(this,2);C=gu(this,2);b?(A[0].h(0,0),A[1].h(0,y),C[0].h(w,0)):(A[0].h(0,0),A[1].h(w,0),C[0].h(0,y));C[1].h(w,y)}else for(za=0;za<h;za++){var Ma=g[za],jb=Ma.ua;if(b){0<n&&0<ca&&I+p+jb.width>n&&(I<f&&hu(a,k,f-I,0,qa,za-1),R++,ca=0,qa=za,z=y,I=0,T=135<e?-y-q:y+q);iu(this,Ma,0,T);var Fa=0;if(0===ca){if(A=Ma.Pq,C=Ma.cr,G=jb.width,
L=jb.height,null===A||null===C||e!==Vt(Ma))A=gu(this,2),C=gu(this,2),A[0].h(0,0),A[1].h(0,L),C[0].h(G,0),C[1].h(G,L)}else{var yb=Ea();L=ju(this,a,Ma,A,C,G,L,yb);Fa=L.x;A=yb[0];C=yb[1];G=L.width;L=L.height;Ha(yb);I<jb.width&&0>Fa&&(ku(a,-Fa,0,qa,za-1),lu(A,-Fa,0),lu(C,-Fa,0),Fa=0)}Ma.S.h(Fa,T);w=Math.max(w,G);y=Math.max(y,z+(0===R?0:q)+jb.height);I=G}else{0<n&&0<ca&&T+p+jb.height>n&&(T<f&&hu(a,k,0,f-T,qa,za-1),R++,ca=0,qa=za,z=w,T=0,I=135<e?-w-q:w+q);iu(this,Ma,I,0);Fa=0;if(0===ca){if(A=Ma.Pq,C=Ma.cr,
G=jb.width,L=jb.height,null===A||null===C||e!==Vt(Ma))A=gu(this,2),C=gu(this,2),A[0].h(0,0),A[1].h(G,0),C[0].h(0,L),C[1].h(G,L)}else yb=Ea(),L=ju(this,a,Ma,A,C,G,L,yb),Fa=L.x,A=yb[0],C=yb[1],G=L.width,L=L.height,Ha(yb),T<jb.height&&0>Fa&&(ku(a,0,-Fa,qa,za-1),lu(A,0,-Fa),lu(C,0,-Fa),Fa=0);Ma.S.h(I,Fa);y=Math.max(y,L);w=Math.max(w,z+(0===R?0:q)+jb.width);T=L}ca++}0<R&&(b?(y+=Math.max(0,c),I<w&&hu(a,k,w-I,0,qa,h-1),0<u&&(l||ku(a,u,0,0,h-1),w+=u)):(w+=Math.max(0,c),T<y&&hu(a,k,0,y-T,qa,h-1),0<u&&(l||
ku(a,0,u,0,h-1),y+=u)));u=l=0;switch(k){case mu:b?l+=w/2-a.focus.x-r/2:u+=y/2-a.focus.y-r/2;break;case nu:0<R?b?l+=w/2-a.focus.x-r/2:u+=y/2-a.focus.y-r/2:b?(O=g[0].S.x+g[0].da.x,l+=O+(g[h-1].S.x+g[h-1].da.x+2*g[h-1].focus.x-O)/2-a.focus.x-r/2):(O=g[0].S.y+g[0].da.y,u+=O+(g[h-1].S.y+g[h-1].da.y+2*g[h-1].focus.y-O)/2-a.focus.y-r/2);break;case du:b?(l-=r,w+=r):(u-=r,y+=r);break;case Wt:b?(l+=w-a.width+r,w+=r):(u+=y-a.height+r,y+=r);break;case Nt:b?1<h?l+=O+p/2-a.focus.x:l+=g[0].focus.x-a.focus.x+g[0].da.x:
1<h?u+=O+p/2-a.focus.y:u+=g[0].focus.y-a.focus.y+g[0].da.y;break;case Ot:b?l+=w+p/2-a.focus.x:u+=y+p/2-a.focus.y;break;case Pt:break;default:B("Unhandled alignment value "+k.toString())}for(r=0;r<h;r++)O=g[r],b?O.S.h(O.S.x+O.da.x-l,O.S.y+(135<e?(m?-y:-O.ua.height)+O.da.y-c:v+c+O.da.y)):O.S.h(O.S.x+(135<e?(m?-w:-O.ua.width)+O.da.x-c:d+c+O.da.x),O.S.y+O.da.y-u);h=g=0;m?b?(w=ou(a,w,l),0>l&&(l=0),135<e&&(u+=y+c),y+=v+c,k===Pt&&(g+=p/2+a.focus.x),h+=v+c):(135<e&&(l+=w+c),w+=d+c,y=pu(a,y,u),0>u&&(u=0),
k===Pt&&(h+=p/2+a.focus.y),g+=d+c):b?(null===a.comments?d>w&&(w=qu(k,d-w,0),g=w.x,h=w.y,w=d,l=0):w=ou(a,w,l),0>l&&(g-=l,l=0),135<e&&(u+=y+c),y=Math.max(Math.max(y,v),y+v+c),h+=v+c):(135<e&&(l+=w+c),w=Math.max(Math.max(w,d),w+d+c),null===a.comments?v>y&&(y=qu(k,0,v-y),g=y.x,h=y.y,y=v,u=0):y=pu(a,y,u),0>u&&(h-=u,u=0),g+=d+c);if(0<R)e=gu(this,4),R=gu(this,4),b?(e[2].h(0,v+c),e[3].h(e[2].x,y),R[2].h(w,e[2].y),R[3].h(R[2].x,e[3].y)):(e[2].h(d+c,0),e[3].h(w,e[2].y),R[2].h(e[2].x,y),R[3].h(e[3].x,R[2].y));
else{e=gu(this,A.length+2);R=gu(this,C.length+2);for(k=0;k<A.length;k++)m=A[k],e[k+2].h(m.x+g,m.y+h);for(k=0;k<C.length;k++)m=C[k],R[k+2].h(m.x+g,m.y+h)}b?(e[0].h(l,0),e[1].h(e[0].x,v),e[2].y<e[1].y&&(e[2].x>e[0].x?e[2].assign(e[1]):e[1].assign(e[2])),e[3].y<e[2].y&&(e[3].x>e[0].x?e[3].assign(e[2]):e[2].assign(e[3])),R[0].h(l+d,0),R[1].h(R[0].x,v),R[2].y<R[1].y&&(R[2].x<R[0].x?R[2].assign(R[1]):R[1].assign(R[2])),R[3].y<R[2].y&&(R[3].x<R[0].x?R[3].assign(R[2]):R[2].assign(R[3])),e[2].y-=c/2,R[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])),R[0].h(0,u+v),R[1].h(d,R[0].y),R[2].x<R[1].x&&(R[2].y<R[0].y?R[2].assign(R[1]):R[1].assign(R[2])),R[3].x<R[2].x&&(R[3].y<R[0].y?R[3].assign(R[2]):R[2].assign(R[3])),e[2].x-=c/2,R[2].x-=c/2);ru(this,A);ru(this,C);a.Pq=e;a.cr=R;a.da.h(l,u);a.ua.h(w,y)}break;default:B("Unhandled compaction value "+a.compaction.toString())}}};
function Tt(a,b){if(0===b.childrenCount){var c=!1,d=0;null!==b.parent&&(d=b.parent.angle,c=b.parent.alignment,c=Mt(c));var e=Rt(b);b.S.h(0,0);b.ua.h(b.width,b.height);null===b.parent||null===b.comments||(180!==d&&270!==d||c)&&!e?b.da.h(0,0):180===d&&!c||(90===d||270===d)&&e?b.da.h(b.width-2*b.focus.x,0):b.da.h(0,b.height-2*b.focus.y)}else{d=Vt(b);c=90===d||270===d;var f=0;e=b.children;for(var g=e.length,h=0;h<g;h++){var k=e[h];f=Math.max(f,c?k.ua.width:k.ua.height)}var l=b.alignment,m=l===du,n=l===
Wt;h=Mt(l);var p=Math.max(0,b.breadthLimit);k=bu(b);var r=b.nodeSpacing,q=cu(b),u=m||n?0:q/2,v=b.rowSpacing,w=0;if(m||n||b.Rm||b.Sm&&1===b.maxGenerationCount)w=Math.max(0,b.rowIndent);m=b.width;var y=b.height,z=0,A=0,C=0,G=0,L=0,I=0,T=0,R=0,ca=0;h&&!Qt(l)&&135<d&&e.reverse();if(Qt(l))if(1<g)for(var qa=0;qa<g;qa++){var O=e[qa],za=O.ua;0===qa%2&&qa!==g-1&&(ca=Math.max(ca,(c?za.width:za.height)+su(O)-r))}else 1===g&&(ca=c?e[0].ua.width:e[0].ua.height);if(h)switch(l){case Nt:case Dt:A=135>d?eu(b,e,ca,
z,A):fu(b,e,ca,z,A);ca=A.x;z=A.width;A=A.height;break;case Ot:for(a=0;a<g;a++)p=e[a],u=p.ua,C=0===T?0:v,c?(p.S.h(f-u.width,L+C),z=Math.max(z,u.width),A=Math.max(A,L+C+u.height),L+=C+u.height):(p.S.h(G+C,f-u.height),z=Math.max(z,G+C+u.width),A=Math.max(A,u.height),G+=C+u.width),T++;break;case Pt:for(f=0;f<g;f++)a=e[f],p=a.ua,u=0===T?0:v,c?(a.S.h(r/2+b.focus.x,L+u),z=Math.max(z,p.width),A=Math.max(A,L+u+p.height),L+=u+p.height):(a.S.h(G+u,r/2+b.focus.y),z=Math.max(z,G+u+p.width),A=Math.max(A,p.height),
G+=u+p.width),T++}else for(qa=0;qa<g;qa++){O=e[qa];za=O.ua;if(c){0<p&&0<T&&G+r+za.width>p&&(G<f&&hu(b,l,f-G,0,R,qa-1),I++,T=0,R=qa,C=A,G=0,L=135<d?-A-v:A+v);var Ma=0===T?u:r;iu(a,O,0,L);O.S.h(G+Ma,L);z=Math.max(z,G+Ma+za.width);A=Math.max(A,C+(0===I?0:v)+za.height);G+=Ma+za.width}else 0<p&&0<T&&L+r+za.height>p&&(L<f&&hu(b,l,0,f-L,R,qa-1),I++,T=0,R=qa,C=z,L=0,G=135<d?-z-v:z+v),Ma=0===T?u:r,iu(a,O,G,0),O.S.h(G,L+Ma),A=Math.max(A,L+Ma+za.height),z=Math.max(z,C+(0===I?0:v)+za.width),L+=Ma+za.height;T++}0<
I&&(c?(A+=Math.max(0,k),G<z&&hu(b,l,z-G,0,R,g-1),0<w&&(n||ku(b,w,0,0,g-1),z+=w)):(z+=Math.max(0,k),L<A&&hu(b,l,0,A-L,R,g-1),0<w&&(n||ku(b,0,w,0,g-1),A+=w)));w=n=0;switch(l){case mu:c?n+=z/2-b.focus.x-q/2:w+=A/2-b.focus.y-q/2;break;case nu:0<I?c?n+=z/2-b.focus.x-q/2:w+=A/2-b.focus.y-q/2:c?(l=e[0].S.x+e[0].da.x,n+=l+(e[g-1].S.x+e[g-1].da.x+2*e[g-1].focus.x-l)/2-b.focus.x-q/2):(l=e[0].S.y+e[0].da.y,w+=l+(e[g-1].S.y+e[g-1].da.y+2*e[g-1].focus.y-l)/2-b.focus.y-q/2);break;case du:c?(n-=q,z+=q):(w-=q,A+=
q);break;case Wt:c?(n+=z-b.width+q,z+=q):(w+=A-b.height+q,A+=q);break;case Nt:case Dt:c?1<g?n+=ca+r/2-b.focus.x:n+=e[0].focus.x-b.focus.x+e[0].da.x:1<g?w+=ca+r/2-b.focus.y:w+=e[0].focus.y-b.focus.y+e[0].da.y;break;case Ot:c?n+=z+r/2-b.focus.x:w+=A+r/2-b.focus.y;break;case Pt:break;default:B("Unhandled alignment value "+l.toString())}for(q=0;q<g;q++)l=e[q],c?l.S.h(l.S.x+l.da.x-n,l.S.y+(135<d?(h?-A:-l.ua.height)+l.da.y-k:y+k+l.da.y)):l.S.h(l.S.x+(135<d?(h?-z:-l.ua.width)+l.da.x-k:m+k+l.da.x),l.S.y+
l.da.y-w);c?(z=ou(b,z,n),0>n&&(n=0),135<d&&(w+=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=pu(b,A,w),0>w&&(w=0));b.da.h(n,w);b.ua.h(z,A)}}
function eu(a,b,c,d,e){var f=b.length;if(0===f)return new N(c,0,d,e);if(1===f)return a=b[0],d=a.ua.width,e=a.ua.height,new N(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=90===Vt(a),l=0,m=0,n=0,p=0;p<f;p++)if(!(0!==p%2||1<f&&p===f-1)){var r=b[p],q=r.ua,u=0===l?0:h;if(k){var v=su(r)-g;r.S.h(c-(q.width+v),n+u);d=Math.max(d,q.width+v);e=Math.max(e,n+u+q.height);n+=u+q.height}else v=su(r)-g,r.S.h(m+u,c-(q.height+v)),e=Math.max(e,q.height+v),d=Math.max(d,m+u+q.width),m+=u+q.width;l++}l=0;r=m;p=n;k?
(m=c+g,n=0):(m=0,n=c+g);for(q=0;q<f;q++)if(0!==q%2){u=b[q];v=u.ua;var w=0===l?0:h;if(k){var y=su(u)-g;u.S.h(m+y,n+w);d=Math.max(d,m+v.width+y);e=Math.max(e,n+w+v.height);n+=w+v.height}else y=su(u)-g,u.S.h(m+w,n+y),d=Math.max(d,m+w+v.width),e=Math.max(e,n+v.height+y),m+=w+v.width;l++}1<f&&1===f%2&&(b=b[f-1],f=b.ua,h=null===b.parent?0:b.parent.rowSpacing,k?(b.S.h(c+g/2-b.focus.x-b.da.x,e+h),k=c+g/2-b.focus.x-b.da.x,d=Math.max(d,k+f.width),0>k&&(d-=k),e=Math.max(e,Math.max(p,n)+h+f.height),0>b.S.x&&
(c=tu(a,b.S.x,!1,c,g))):(b.S.h(d+h,c+g/2-b.focus.y-b.da.y),d=Math.max(d,Math.max(r,m)+h+f.width),n=c+g/2-b.focus.y-b.da.y,e=Math.max(e,n+f.height),0>n&&(e-=n),0>b.S.y&&(c=tu(a,b.S.y,!0,c,g))));return new N(c,0,d,e)}
function fu(a,b,c,d,e){var f=b.length;if(0===f)return new N(c,0,d,e);if(1===f)return b=b[0],d=b.ua.width,e=b.ua.height,new N(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=270===Vt(a),l=0,m=0,n=0,p=0;p<f;p++)if(!(0!==p%2||1<f&&p===f-1)){var r=b[p],q=r.ua,u=0===l?0:h;if(k){var v=su(r)-g;n-=u+q.height;r.S.h(c-(q.width+v),n);d=Math.max(d,q.width+v);e=Math.max(e,Math.abs(n))}else v=su(r)-g,m-=u+q.width,r.S.h(m,c-(q.height+v)),e=Math.max(e,q.height+v),d=Math.max(d,Math.abs(m));l++}l=0;r=m;p=n;k?(m=
c+g,n=0):(m=0,n=c+g);for(q=0;q<f;q++)if(0!==q%2){u=b[q];v=u.ua;var w=0===l?0:h;if(k){var y=su(u)-g;n-=w+v.height;u.S.h(m+y,n);d=Math.max(d,m+v.width+y);e=Math.max(e,Math.abs(n))}else y=su(u)-g,m-=w+v.width,u.S.h(m,n+y),e=Math.max(e,n+v.height+y),d=Math.max(d,Math.abs(m));l++}1<f&&1===f%2&&(h=b[f-1],l=h.ua,q=null===h.parent?0:h.parent.rowSpacing,k?(h.S.h(c+g/2-h.focus.x-h.da.x,-e-l.height-q),m=c+g/2-h.focus.x-h.da.x,d=Math.max(d,m+l.width),0>m&&(d-=m),e=Math.max(e,Math.abs(Math.min(p,n))+q+l.height),
0>h.S.x&&(c=tu(a,h.S.x,!1,c,g))):(h.S.h(-d-l.width-q,c+g/2-h.focus.y-h.da.y),d=Math.max(d,Math.abs(Math.min(r,m))+q+l.width),n=c+g/2-h.focus.y-h.da.y,e=Math.max(e,n+l.height),0>n&&(e-=n),0>h.S.y&&(c=tu(a,h.S.y,!0,c,g))));for(a=0;a<f;a++)g=b[a],k?g.S.h(g.S.x,g.S.y+e):g.S.h(g.S.x+d,g.S.y);return new N(c,0,d,e)}function su(a){return null===a.parent?0:a.parent.nodeSpacing}
function tu(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.da.y+b.focus.y-e/2:b.da.x+b.focus.x-e/2)}
function ou(a,b,c){switch(a.alignment){case nu:case mu:return c+a.width>b&&(b=c+a.width),0>c&&(b-=c),b;case du:return a.width>b?a.width:b;case Wt:return 2*a.focus.x>b?a.width:b+a.width-2*a.focus.x;case Nt:case Dt:return Math.max(a.width,Math.max(b,c+a.width)-Math.min(0,c));case Ot:return a.width-a.focus.x+a.nodeSpacing/2+b;case Pt:return Math.max(a.width,a.focus.x+a.nodeSpacing/2+b);default:return b}}
function pu(a,b,c){switch(a.alignment){case nu:case mu:return c+a.height>b&&(b=c+a.height),0>c&&(b-=c),b;case du:return a.height>b?a.height:b;case Wt:return 2*a.focus.y>b?a.height:b+a.height-2*a.focus.y;case Nt:case Dt:return Math.max(a.height,Math.max(b,c+a.height)-Math.min(0,c));case Ot:return a.height-a.focus.y+a.nodeSpacing/2+b;case Pt:return Math.max(a.height,a.focus.y+a.nodeSpacing/2+b);default:return b}}
function qu(a,b,c){switch(a){case mu:b/=2;c/=2;break;case nu:b/=2;c/=2;break;case du:c=b=0;break;case Wt:break;default:B("Unhandled alignment value "+a.toString())}return new J(b,c)}function hu(a,b,c,d,e,f){b=qu(b,c,d);ku(a,b.x,b.y,e,f)}function ku(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 iu(a,b,c,d){var e=b.parent;switch(a.fd){case mt:for(a=b.sourceEdges;a.next();)b=a.value,b.fromVertex===e&&b.relativePoint.h(c,d);break;case tt:for(a=b.destinationEdges;a.next();)b=a.value,b.toVertex===e&&b.relativePoint.h(c,d);break;default:B("Unhandled path value "+a.fd.toString())}}function lu(a,b,c){for(var d=0;d<a.length;d++){var e=a[d];e.x+=b;e.y+=c}}
function ju(a,b,c,d,e,f,g,h){var k=Vt(b),l=90===k||270===k,m=b.nodeSpacing;b=d;var n=e;d=f;var p=g,r=c.Pq,q=c.cr;g=c.ua;var u=l?Math.max(p,g.height):Math.max(d,g.width);if(null===r||k!==Vt(c))r=gu(a,2),q=gu(a,2),l?(r[0].h(0,0),r[1].h(0,g.height),q[0].h(g.width,0),q[1].h(q[0].x,r[1].y)):(r[0].h(0,0),r[1].h(g.width,0),q[0].h(0,g.height),q[1].h(r[1].x,q[0].y));if(l){p=9999999;if(!(null===n||2>n.length||null===r||2>r.length))for(e=c=0;c<n.length&&e<r.length;){f=n[c];var v=r[e];k=v.x;l=v.y;k+=d;var w=
f;c+1<n.length&&(w=n[c+1]);var y=v;v=y.x;y=y.y;e+1<r.length&&(y=r[e+1],v=y.x,y=y.y,v+=d);var z=p;f.y===l?z=k-f.x:f.y>l&&f.y<y?z=k+(f.y-l)/(y-l)*(v-k)-f.x:l>f.y&&l<w.y&&(z=k-(f.x+(l-f.y)/(w.y-f.y)*(w.x-f.x)));z<p&&(p=z);w.y<=f.y?c++:y<=l?e++:(w.y<=y&&c++,y<=w.y&&e++)}p=d-p;p+=m;c=r;e=p;if(null===b||2>b.length||null===c||2>c.length)d=null;else{m=gu(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=gu(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);ru(a,m);d=c}f=q;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=gu(a,n.length+f.length);for(e=l=c=0;c<n.length&&n[c].y<f[0].y;)w=n[c++],m[e++].h(w.x,w.y);for(;l<f.length;)w=f[l++],m[e++].h(w.x+k,w.y);for(f=f[f.length-1].y;c<n.length&&n[c].y<=f;)c++;for(;c<n.length&&n[c].y>f;)k=n[c++],m[e++].h(k.x,k.y);f=gu(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);ru(a,m);e=f}f=
Math.max(0,p)+g.width;g=u;ru(a,b);ru(a,r);ru(a,n);ru(a,q);h[0]=d;h[1]=e;return new N(p,0,f,g)}d=9999999;if(!(null===n||2>n.length||null===r||2>r.length))for(e=c=0;c<n.length&&e<r.length;)f=n[c],v=r[e],k=v.x,l=v.y,l+=p,w=f,c+1<n.length&&(w=n[c+1]),y=v,v=y.x,y=y.y,e+1<r.length&&(y=r[e+1],v=y.x,y=y.y,y+=p),z=d,f.x===k?z=l-f.y:f.x>k&&f.x<v?z=l+(f.x-k)/(v-k)*(y-l)-f.y:k>f.x&&k<w.x&&(z=l-(f.y+(k-f.x)/(w.x-f.x)*(w.y-f.y))),z<d&&(d=z),w.x<=f.x?c++:v<=k?e++:(w.x<=v&&c++,v<=w.x&&e++);p-=d;p+=m;c=r;e=p;if(null===
b||2>b.length||null===c||2>c.length)d=null;else{m=gu(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=gu(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);ru(a,m);d=c}f=q;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=gu(a,n.length+f.length);for(e=l=c=0;c<n.length&&n[c].x<f[0].x;)w=n[c++],m[e++].h(w.x,w.y);
for(;l<f.length;)w=f[l++],m[e++].h(w.x,w.y+k);for(f=f[f.length-1].x;c<n.length&&n[c].x<=f;)c++;for(;c<n.length&&n[c].x>f;)k=n[c++],m[e++].h(k.x,k.y);f=gu(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);ru(a,m);e=f}f=u;g=Math.max(0,p)+g.height;ru(a,b);ru(a,r);ru(a,n);ru(a,q);h[0]=d;h[1]=e;return new N(p,0,f,g)}function gu(a,b){a=a.uv[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 ru(a,b){var c=b.length,d=a.uv[c];void 0===d&&(d=[],a.uv[c]=d);d.push(b)}
kt.prototype.arrangeTrees=function(){if(this.Eb===st)for(var a=this.Jb.iterator;a.next();){var b=a.value;if(b instanceof rt){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);uu(this,b,c,d)}}}else{a=[];for(b=this.Jb.iterator;b.next();)c=b.value,c instanceof rt&&a.push(c);switch(this.sorting){case It:break;case Jt:a.reverse();break;case Kt:a.sort(this.comparer);break;case Lt:a.sort(this.comparer);a.reverse();break;default:B("Unhandled sorting value "+this.sorting.toString())}c=
this.arrangementOrigin;b=c.x;c=c.y;for(d=0;d<a.length;d++){var e=a[d];uu(this,e,b+e.da.x,c+e.da.y);switch(this.Eb){case pt:c+=e.ua.height+this.Hd.height;break;case vu:b+=e.ua.width+this.Hd.width;break;default:B("Unhandled arrangement value "+this.Eb.toString())}}}};function uu(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];uu(a,g,c+g.S.x,d+g.S.y)}}}kt.prototype.commitLayout=function(){this.Cw();this.commitNodes();this.Hv();this.isRouting&&this.commitLinks()};
kt.prototype.commitNodes=function(){for(var a=this.network.vertexes.iterator;a.next();)a.value.commit();for(a.reset();a.next();)this.layoutComments(a.value)};
kt.prototype.Hv=function(){if(this.layerStyle===At){for(var a=this.lx,b=[],c=null,d=this.network.vertexes.iterator;d.next();){var e=d.value;null===c?c=e.bounds.copy():c.Oc(e.bounds);var f=b[e.level];void 0===f?f=bu(e):f=Math.max(f,bu(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.Ic(this.nodeSpacing/2,this.layerSpacing),d=new J(-this.nodeSpacing/2,-this.layerSpacing/2)):(c.Ic(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)}};kt.prototype.commitLayers=function(){};kt.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};
kt.prototype.Cw=function(){for(var a=this.Jb.iterator;a.next();){var b=a.value;b instanceof rt&&wu(this,b)}};function wu(a,b){if(null!==b){a.setPortSpots(b);b=b.children;for(var c=b.length,d=0;d<c;d++)wu(a,b[d])}}
kt.prototype.setPortSpots=function(a){var b=a.alignment;if(Mt(b)){var c=this.fd===mt,d=Vt(a);switch(d){case 0:var e=hd;break;case 90:e=id;break;case 180:e=gd;break;default:e=fd}var f=a.children,g=f.length;switch(b){case Nt:case Dt: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?gd:fd;if(1===g||b===g-1&&1===g%2)switch(d){case 0:k=gd;break;case 90:k=fd;break;case 180:k=hd;break;default:k=id}else 0===b%2&&(k=90===d||270===
d?hd:id);c?(a.setsPortSpot&&(h.fromSpot=e),a.setsChildPortSpot&&(h.toSpot=k)):(a.setsPortSpot&&(h.fromSpot=k),a.setsChildPortSpot&&(h.toSpot=e))}}break;case Ot:d=90===d||270===d?hd:id;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 Pt:for(d=90===d||270===d?gd:fd,f=c?a.destinationEdges:a.sourceEdges;f.next();)g=f.value.link,
null!==g&&(c?(a.setsPortSpot&&(g.fromSpot=e),a.setsChildPortSpot&&(g.toSpot=d)):(a.setsPortSpot&&(g.fromSpot=d),a.setsChildPortSpot&&(g.toSpot=e)))}}else if(c=Vt(a),this.fd===mt)for(e=a.destinationEdges;e.next();){if(d=e.value.link,null!==d){if(a.setsPortSpot)if(a.portSpot.Mb())switch(c){case 0:d.fromSpot=hd;break;case 90:d.fromSpot=id;break;case 180:d.fromSpot=gd;break;default:d.fromSpot=fd}else d.fromSpot=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.Mb())switch(c){case 0:d.toSpot=gd;break;
case 90:d.toSpot=fd;break;case 180:d.toSpot=hd;break;default:d.toSpot=id}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.Mb())switch(c){case 0:d.toSpot=hd;break;case 90:d.toSpot=id;break;case 180:d.toSpot=gd;break;default:d.toSpot=fd}else d.toSpot=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.Mb())switch(c){case 0:d.fromSpot=gd;break;case 90:d.fromSpot=fd;break;case 180:d.fromSpot=hd;break;default:d.fromSpot=id}else d.fromSpot=
a.childPortSpot}};function Vt(a){a=a.angle;return 45>=a?0:135>=a?90:225>=a?180:315>=a?270:0}function bu(a){var b=Vt(a);b=90===b||270===b;var c=a.layerSpacing;if(0<a.layerSpacingParentOverlap){var d=Math.min(1,a.layerSpacingParentOverlap);c-=b?a.height*d:a.width*d}c<(b?-a.height:-a.width)&&(c=b?-a.height:-a.width);return c}function cu(a){var b=Vt(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(kt.prototype,{roots:{get:function(){return this.Jb},set:function(a){this.Jb!==a&&(this.Jb=a,this.C())}},path:{get:function(){return this.qp},set:function(a){this.qp!==a&&(this.qp=a,this.C())}},treeStyle:{get:function(){return this.mq},set:function(a){this.Eb===a||a!==nt&&a!==Gt&&a!==Ht&&a!==Ft||(this.mq=a,this.C())}},layerStyle:{get:function(){return this.vs},
set:function(a){this.Eb===a||a!==ot&&a!==Bt&&a!==At||(this.vs=a,this.C())}},comments:{get:function(){return this.ed},set:function(a){this.ed!==a&&(this.ed=a,this.C())}},arrangement:{get:function(){return this.Eb},set:function(a){this.Eb===a||a!==pt&&a!==vu&&a!==st||(this.Eb=a,this.C())}},arrangementSpacing:{get:function(){return this.Hd},set:function(a){this.Hd.w(a)||(this.Hd.assign(a),this.C())}},rootDefaults:{
get:function(){return this.U},set:function(a){this.U!==a&&(this.U=a,this.C())}},alternateDefaults:{get:function(){return this.V},set:function(a){this.V!==a&&(this.V=a,this.C())}},sorting:{get:function(){return this.U.sorting},set:function(a){this.U.sorting===a||a!==It&&a!==Jt&&a!==Kt&&!Lt||(this.U.sorting=a,this.C())}},comparer:{get:function(){return this.U.comparer},set:function(a){this.U.comparer!==
a&&(this.U.comparer=a,this.C())}},angle:{get:function(){return this.U.angle},set:function(a){this.U.angle!==a&&(0===a||90===a||180===a||270===a?(this.U.angle=a,this.C()):B("TreeLayout.angle must be 0, 90, 180, or 270"))}},alignment:{get:function(){return this.U.alignment},set:function(a){this.U.alignment!==a&&(this.U.alignment=a,this.C())}},nodeIndent:{get:function(){return this.U.nodeIndent},set:function(a){this.U.nodeIndent!==
a&&0<=a&&(this.U.nodeIndent=a,this.C())}},nodeIndentPastParent:{get:function(){return this.U.nodeIndentPastParent},set:function(a){this.U.nodeIndentPastParent!==a&&0<=a&&1>=a&&(this.U.nodeIndentPastParent=a,this.C())}},nodeSpacing:{get:function(){return this.U.nodeSpacing},set:function(a){this.U.nodeSpacing!==a&&(this.U.nodeSpacing=a,this.C())}},layerSpacing:{get:function(){return this.U.layerSpacing},set:function(a){this.U.layerSpacing!==
a&&(this.U.layerSpacing=a,this.C())}},layerSpacingParentOverlap:{get:function(){return this.U.layerSpacingParentOverlap},set:function(a){this.U.layerSpacingParentOverlap!==a&&0<=a&&1>=a&&(this.U.layerSpacingParentOverlap=a,this.C())}},compaction:{get:function(){return this.U.compaction},set:function(a){this.U.compaction===a||a!==St&&a!==Ut||(this.U.compaction=a,this.C())}},breadthLimit:{get:function(){return this.U.breadthLimit},
set:function(a){this.U.breadthLimit!==a&&0<=a&&(this.U.breadthLimit=a,this.C())}},rowSpacing:{get:function(){return this.U.rowSpacing},set:function(a){this.U.rowSpacing!==a&&(this.U.rowSpacing=a,this.C())}},rowIndent:{get:function(){return this.U.rowIndent},set:function(a){this.U.rowIndent!==a&&0<=a&&(this.U.rowIndent=a,this.C())}},commentSpacing:{get:function(){return this.U.commentSpacing},set:function(a){this.U.commentSpacing!==
a&&(this.U.commentSpacing=a,this.C())}},commentMargin:{get:function(){return this.U.commentMargin},set:function(a){this.U.commentMargin!==a&&(this.U.commentMargin=a,this.C())}},setsPortSpot:{get:function(){return this.U.setsPortSpot},set:function(a){this.U.setsPortSpot!==a&&(this.U.setsPortSpot=a,this.C())}},portSpot:{get:function(){return this.U.portSpot},set:function(a){this.U.portSpot.w(a)||(this.U.portSpot=
a,this.C())}},setsChildPortSpot:{get:function(){return this.U.setsChildPortSpot},set:function(a){this.U.setsChildPortSpot!==a&&(this.U.setsChildPortSpot=a,this.C())}},childPortSpot:{get:function(){return this.U.childPortSpot},set:function(a){this.U.childPortSpot.w(a)||(this.U.childPortSpot=a,this.C())}},alternateSorting:{get:function(){return this.V.sorting},set:function(a){this.V.sorting===a||a!==It&&a!==Jt&&
a!==Kt&&!Lt||(this.V.sorting=a,this.C())}},alternateComparer:{get:function(){return this.V.comparer},set:function(a){this.V.comparer!==a&&(this.V.comparer=a,this.C())}},alternateAngle:{get:function(){return this.V.angle},set:function(a){this.V.angle===a||0!==a&&90!==a&&180!==a&&270!==a||(this.V.angle=a,this.C())}},alternateAlignment:{get:function(){return this.V.alignment},set:function(a){this.V.alignment!==
a&&(this.V.alignment=a,this.C())}},alternateNodeIndent:{get:function(){return this.V.nodeIndent},set:function(a){this.V.nodeIndent!==a&&0<=a&&(this.V.nodeIndent=a,this.C())}},alternateNodeIndentPastParent:{get:function(){return this.V.nodeIndentPastParent},set:function(a){this.V.nodeIndentPastParent!==a&&0<=a&&1>=a&&(this.V.nodeIndentPastParent=a,this.C())}},alternateNodeSpacing:{get:function(){return this.V.nodeSpacing},
set:function(a){this.V.nodeSpacing!==a&&(this.V.nodeSpacing=a,this.C())}},alternateLayerSpacing:{get:function(){return this.V.layerSpacing},set:function(a){this.V.layerSpacing!==a&&(this.V.layerSpacing=a,this.C())}},alternateLayerSpacingParentOverlap:{get:function(){return this.V.layerSpacingParentOverlap},set:function(a){this.V.layerSpacingParentOverlap!==a&&0<=a&&1>=a&&(this.V.layerSpacingParentOverlap=a,this.C())}},alternateCompaction:{
get:function(){return this.V.compaction},set:function(a){this.V.compaction===a||a!==St&&a!==Ut||(this.V.compaction=a,this.C())}},alternateBreadthLimit:{get:function(){return this.V.breadthLimit},set:function(a){this.V.breadthLimit!==a&&0<=a&&(this.V.breadthLimit=a,this.C())}},alternateRowSpacing:{get:function(){return this.V.rowSpacing},set:function(a){this.V.rowSpacing!==a&&(this.V.rowSpacing=a,this.C())}},alternateRowIndent:{
get:function(){return this.V.rowIndent},set:function(a){this.V.rowIndent!==a&&0<=a&&(this.V.rowIndent=a,this.C())}},alternateCommentSpacing:{get:function(){return this.V.commentSpacing},set:function(a){this.V.commentSpacing!==a&&(this.V.commentSpacing=a,this.C())}},alternateCommentMargin:{get:function(){return this.V.commentMargin},set:function(a){this.V.commentMargin!==a&&(this.V.commentMargin=a,this.C())}},alternateSetsPortSpot:{
get:function(){return this.V.setsPortSpot},set:function(a){this.V.setsPortSpot!==a&&(this.V.setsPortSpot=a,this.C())}},alternatePortSpot:{get:function(){return this.V.portSpot},set:function(a){this.V.portSpot.w(a)||(this.V.portSpot=a,this.C())}},alternateSetsChildPortSpot:{get:function(){return this.V.setsChildPortSpot},set:function(a){this.V.setsChildPortSpot!==a&&(this.V.setsChildPortSpot=a,this.C())}},alternateChildPortSpot:{
get:function(){return this.V.childPortSpot},set:function(a){this.V.childPortSpot.w(a)||(this.V.childPortSpot=a,this.C())}}});
var lt=new D(kt,"PathDefault",-1),mt=new D(kt,"PathDestination",0),tt=new D(kt,"PathSource",1),It=new D(kt,"SortingForwards",10),Jt=new D(kt,"SortingReverse",11),Kt=new D(kt,"SortingAscending",12),Lt=new D(kt,"SortingDescending",13),mu=new D(kt,"AlignmentCenterSubtrees",20),nu=new D(kt,"AlignmentCenterChildren",21),du=new D(kt,"AlignmentStart",22),Wt=new D(kt,"AlignmentEnd",23),Nt=new D(kt,"AlignmentBus",24),Dt=new D(kt,"AlignmentBusBranching",25),Ot=new D(kt,"AlignmentTopLeftBus",26),Pt=new D(kt,
"AlignmentBottomRightBus",27),St=new D(kt,"CompactionNone",30),Ut=new D(kt,"CompactionBlock",31),nt=new D(kt,"StyleLayered",40),Ht=new D(kt,"StyleLastParents",41),Gt=new D(kt,"StyleAlternating",42),Ft=new D(kt,"StyleRootOnly",43),pt=new D(kt,"ArrangementVertical",50),vu=new D(kt,"ArrangementHorizontal",51),st=new D(kt,"ArrangementFixedRoots",52),ot=new D(kt,"LayerIndividual",60),Bt=new D(kt,"LayerSiblings",61),At=new D(kt,"LayerUniform",62);kt.className="TreeLayout";kt.PathDefault=lt;
kt.PathDestination=mt;kt.PathSource=tt;kt.SortingForwards=It;kt.SortingReverse=Jt;kt.SortingAscending=Kt;kt.SortingDescending=Lt;kt.AlignmentCenterSubtrees=mu;kt.AlignmentCenterChildren=nu;kt.AlignmentStart=du;kt.AlignmentEnd=Wt;kt.AlignmentBus=Nt;kt.AlignmentBusBranching=Dt;kt.AlignmentTopLeftBus=Ot;kt.AlignmentBottomRightBus=Pt;kt.CompactionNone=St;kt.CompactionBlock=Ut;kt.StyleLayered=nt;kt.StyleLastParents=Ht;kt.StyleAlternating=Gt;kt.StyleRootOnly=Ft;kt.ArrangementVertical=pt;
kt.ArrangementHorizontal=vu;kt.ArrangementFixedRoots=st;kt.LayerIndividual=ot;kt.LayerSiblings=Bt;kt.LayerUniform=At;function qt(a){Rp.call(this,a)}la(qt,Rp);qt.prototype.createVertex=function(){return new rt(this)};qt.prototype.createEdge=function(){return new xu(this)};qt.className="TreeNetwork";
function rt(a){eq.call(this,a);this.Ja=!1;this.Bc=null;this.I=[];this.Pc=this.cb=this.T=this.Ka=0;this.ed=null;this.S=new J(0,0);this.ua=new M(0,0);this.da=new J(0,0);this.Sm=this.Rm=this.SA=!1;this.cr=this.Pq=null;this.Yc=It;this.Tc=lq;this.Yb=0;this.yb=nu;this.Fs=this.Es=0;this.Gs=20;this.qe=50;this.us=0;this.Gr=Ut;this.yr=0;this.Ts=25;this.Fr=this.Ss=10;this.Er=20;this.ft=!0;this.Ps=ad;this.et=!0;this.Br=ad}la(rt,eq);
rt.prototype.copyInheritedPropertiesFrom=function(a){null!==a&&(this.Yc=a.sorting,this.Tc=a.comparer,this.Yb=a.angle,this.yb=a.alignment,this.Es=a.nodeIndent,this.Fs=a.nodeIndentPastParent,this.Gs=a.nodeSpacing,this.qe=a.layerSpacing,this.us=a.layerSpacingParentOverlap,this.Gr=a.compaction,this.yr=a.breadthLimit,this.Ts=a.rowSpacing,this.Ss=a.rowIndent,this.Fr=a.commentSpacing,this.Er=a.commentMargin,this.ft=a.setsPortSpot,this.Ps=a.portSpot,this.et=a.setsChildPortSpot,this.Br=a.childPortSpot)};
ma.Object.defineProperties(rt.prototype,{initialized:{get:function(){return this.Ja},set:function(a){this.Ja!==a&&(this.Ja=a)}},parent:{get:function(){return this.Bc},set:function(a){this.Bc!==a&&(this.Bc=a)}},children:{get:function(){return this.I},set:function(a){if(this.I!==a){if(null!==a)for(var b=a.length,c=0;c<b;c++);this.I=a}}},level:{get:function(){return this.Ka},set:function(a){this.Ka!==
a&&(this.Ka=a)}},descendantCount:{get:function(){return this.T},set:function(a){this.T!==a&&(this.T=a)}},maxChildrenCount:{get:function(){return this.cb},set:function(a){this.cb!==a&&(this.cb=a)}},maxGenerationCount:{get:function(){return this.Pc},set:function(a){this.Pc!==a&&(this.Pc=a)}},comments:{get:function(){return this.ed},set:function(a){if(this.ed!==a){if(null!==a)for(var b=
a.length,c=0;c<b;c++);this.ed=a}}},sorting:{get:function(){return this.Yc},set:function(a){this.Yc!==a&&(this.Yc=a)}},comparer:{get:function(){return this.Tc},set:function(a){this.Tc!==a&&(this.Tc=a)}},angle:{get:function(){return this.Yb},set:function(a){this.Yb!==a&&(this.Yb=a)}},alignment:{get:function(){return this.yb},set:function(a){this.yb!==a&&(this.yb=a)}},nodeIndent:{
get:function(){return this.Es},set:function(a){this.Es!==a&&(this.Es=a)}},nodeIndentPastParent:{get:function(){return this.Fs},set:function(a){this.Fs!==a&&(this.Fs=a)}},nodeSpacing:{get:function(){return this.Gs},set:function(a){this.Gs!==a&&(this.Gs=a)}},layerSpacing:{get:function(){return this.qe},set:function(a){this.qe!==a&&(this.qe=a)}},layerSpacingParentOverlap:{
get:function(){return this.us},set:function(a){this.us!==a&&(this.us=a)}},compaction:{get:function(){return this.Gr},set:function(a){this.Gr!==a&&(this.Gr=a)}},breadthLimit:{get:function(){return this.yr},set:function(a){this.yr!==a&&(this.yr=a)}},rowSpacing:{get:function(){return this.Ts},set:function(a){this.Ts!==a&&(this.Ts=a)}},rowIndent:{get:function(){return this.Ss},set:function(a){this.Ss!==
a&&(this.Ss=a)}},commentSpacing:{get:function(){return this.Fr},set:function(a){this.Fr!==a&&(this.Fr=a)}},commentMargin:{get:function(){return this.Er},set:function(a){this.Er!==a&&(this.Er=a)}},setsPortSpot:{get:function(){return this.ft},set:function(a){this.ft!==a&&(this.ft=a)}},portSpot:{get:function(){return this.Ps},set:function(a){this.Ps.w(a)||(this.Ps=a)}},setsChildPortSpot:{
get:function(){return this.et},set:function(a){this.et!==a&&(this.et=a)}},childPortSpot:{get:function(){return this.Br},set:function(a){this.Br.w(a)||(this.Br=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.ua},set:function(a){this.ua.set(a)}},
subtreeOffset:{get:function(){return this.da},set:function(a){this.da.set(a)}}});rt.className="TreeVertex";function xu(a){fq.call(this,a);this.kv=new J(0,0)}la(xu,fq);
xu.prototype.commit=function(){var a=this.link;if(null!==a&&!a.isAvoiding){var b=this.network.layout,c=null,d=null;switch(b.fd){case mt:c=this.fromVertex;d=this.toVertex;break;case tt:c=this.toVertex;d=this.fromVertex;break;default:B("Unhandled path value "+b.fd.toString())}if(null!==c&&null!==d)if(b=this.kv,0!==b.x||0!==b.y||c.SA){d=c.bounds;var e=Vt(c),f=bu(c),g=c.rowSpacing;a.wj();var h=a.curve===pg,k=a.isOrthogonal,l;a.Th();if(k||h){for(l=2;4<a.pointsCount;)a.sw(2);var m=a.i(1);var n=a.i(2)}else{for(l=
1;3<a.pointsCount;)a.sw(1);m=a.i(0);n=a.i(a.pointsCount-1)}var p=a.i(a.pointsCount-1);0===e?(c.alignment===Wt?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-cu(c))))):c.alignment===du?(e=d.top+b.y,0===b.y&&m.y<p.y-c.rowIndent&&(e=Math.max(e,Math.min(m.y,e+cu(c))))):e=c.Rm||c.Sm&&1===c.maxGenerationCount?d.top-c.da.y+b.y:d.y+d.height/2+b.y,h?(a.m(l,m.x,e),l++,a.m(l,d.right+f,e),l++,a.m(l,d.right+f+(b.x-g)/3,e),l++,a.m(l,d.right+f+2*(b.x-g)/3,e),l++,a.m(l,d.right+f+(b.x-
g),e),l++,a.m(l,n.x,e)):(k&&(a.m(l,d.right+f/2,m.y),l++),a.m(l,d.right+f/2,e),l++,a.m(l,d.right+f+b.x-(k?g/2:g),e),l++,k&&a.m(l,a.i(l-1).x,n.y))):90===e?(c.alignment===Wt?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-cu(c))))):c.alignment===du?(e=d.left+b.x,0===b.x&&m.x<p.x-c.rowIndent&&(e=Math.max(e,Math.min(m.x,e+cu(c))))):e=c.Rm||c.Sm&&1===c.maxGenerationCount?d.left-c.da.x+b.x:d.x+d.width/2+b.x,h?(a.m(l,e,m.y),l++,a.m(l,e,d.bottom+f),l++,a.m(l,e,d.bottom+f+(b.y-g)/
3),l++,a.m(l,e,d.bottom+f+2*(b.y-g)/3),l++,a.m(l,e,d.bottom+f+(b.y-g)),l++,a.m(l,e,n.y)):(k&&(a.m(l,m.x,d.bottom+f/2),l++),a.m(l,e,d.bottom+f/2),l++,a.m(l,e,d.bottom+f+b.y-(k?g/2:g)),l++,k&&a.m(l,n.x,a.i(l-1).y))):180===e?(c.alignment===Wt?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-cu(c))))):c.alignment===du?(e=d.top+b.y,0===b.y&&m.y<p.y-c.rowIndent&&(e=Math.max(e,Math.min(m.y,e+cu(c))))):e=c.Rm||c.Sm&&1===c.maxGenerationCount?d.top-c.da.y+b.y:d.y+d.height/2+b.y,h?
(a.m(l,m.x,e),l++,a.m(l,d.left-f,e),l++,a.m(l,d.left-f+(b.x+g)/3,e),l++,a.m(l,d.left-f+2*(b.x+g)/3,e),l++,a.m(l,d.left-f+(b.x+g),e),l++,a.m(l,n.x,e)):(k&&(a.m(l,d.left-f/2,m.y),l++),a.m(l,d.left-f/2,e),l++,a.m(l,d.left-f+b.x+(k?g/2:g),e),l++,k&&a.m(l,a.i(l-1).x,n.y))):270===e?(c.alignment===Wt?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-cu(c))))):c.alignment===du?(e=d.left+b.x,0===b.x&&m.x<p.x-c.rowIndent&&(e=Math.max(e,Math.min(m.x,e+cu(c))))):e=c.Rm||c.Sm&&1===c.maxGenerationCount?
d.left-c.da.x+b.x:d.x+d.width/2+b.x,h?(a.m(l,e,m.y),l++,a.m(l,e,d.top-f),l++,a.m(l,e,d.top-f+(b.y+g)/3),l++,a.m(l,e,d.top-f+2*(b.y+g)/3),l++,a.m(l,e,d.top-f+(b.y+g)),l++,a.m(l,e,n.y)):(k&&(a.m(l,m.x,d.top-f/2),l++),a.m(l,e,d.top-f/2),l++,a.m(l,e,d.top-f+b.y+(k?g/2:g)),l++,k&&a.m(l,n.x,a.i(l-1).y))):B("Invalid angle "+e);a.xf()}else a=this.link,f=Vt(c),f!==Vt(d)&&(g=bu(c),h=c.bounds,c=d.bounds,0===f&&c.left-h.right<g+1||90===f&&c.top-h.bottom<g+1||180===f&&h.left-c.right<g+1||270===f&&h.top-c.bottom<
g+1||(a.wj(),c=a.curve===pg,b=a.isOrthogonal,d=Mt(this.fromVertex.alignment),a.Th(),0===f?(f=h.right+g/2,c?4===a.pointsCount&&(c=a.i(3).y,a.K(1,f-20,a.i(1).y),a.m(2,f-20,c),a.m(3,f,c),a.m(4,f+20,c),a.K(5,a.i(5).x,c)):b?d?a.K(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.K(2,f,a.i(2).y),a.K(3,f,a.i(3).y)):4===a.pointsCount?a.m(2,f,a.i(2).y):3===a.pointsCount?a.K(1,f,a.i(2).y):2===a.pointsCount&&a.m(1,f,a.i(1).y)):90===f?(f=h.bottom+g/2,c?4===a.pointsCount&&(c=a.i(3).x,a.K(1,a.i(1).x,f-20),a.m(2,c,f-20),
a.m(3,c,f),a.m(4,c,f+20),a.K(5,c,a.i(5).y)):b?d?a.K(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.K(2,a.i(2).x,f),a.K(3,a.i(3).x,f)):4===a.pointsCount?a.m(2,a.i(2).x,f):3===a.pointsCount?a.K(1,a.i(2).x,f):2===a.pointsCount&&a.m(1,a.i(1).x,f)):180===f?(f=h.left-g/2,c?4===a.pointsCount&&(c=a.i(3).y,a.K(1,f+20,a.i(1).y),a.m(2,f+20,c),a.m(3,f,c),a.m(4,f-20,c),a.K(5,a.i(5).x,c)):b?d?a.K(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.K(2,f,a.i(2).y),a.K(3,f,a.i(3).y)):4===a.pointsCount?a.m(2,f,a.i(2).y):3===a.pointsCount?
a.K(1,f,a.i(2).y):2===a.pointsCount&&a.m(1,f,a.i(1).y)):270===f&&(f=h.top-g/2,c?4===a.pointsCount&&(c=a.i(3).x,a.K(1,a.i(1).x,f+20),a.m(2,c,f+20),a.m(3,c,f),a.m(4,c,f-20),a.K(5,c,a.i(5).y)):b?d?a.K(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.K(2,a.i(2).x,f),a.K(3,a.i(3).x,f)):4===a.pointsCount?a.m(2,a.i(2).x,f):3===a.pointsCount?a.K(1,a.i(2).x,f):2===a.pointsCount&&a.m(1,a.i(1).x,f)),a.xf()))}};
ma.Object.defineProperties(xu.prototype,{relativePoint:{get:function(){return this.kv},set:function(a){this.kv.set(a)}}});xu.className="TreeEdge";
Oa.prototype.initializeStandardTools=function(){this.Xa("Action",new Dg,this.mouseDownTools);this.Xa("Relinking",new Ze,this.mouseDownTools);this.Xa("LinkReshaping",new cg,this.mouseDownTools);this.Xa("Rotating",new Bg,this.mouseDownTools);this.Xa("Resizing",new ug,this.mouseDownTools);this.Xa("Linking",new Wf,this.mouseMoveTools);this.Xa("Dragging",new Se,this.mouseMoveTools);this.Xa("DragSelecting",new Gg,this.mouseMoveTools);this.Xa("Panning",new Hg,this.mouseMoveTools);this.Xa("ContextMenu",new Jg,
this.mouseUpTools);this.Xa("TextEditing",new Ug,this.mouseUpTools);this.Xa("ClickCreating",new Eg,this.mouseUpTools);this.Xa("ClickSelecting",new Cg,this.mouseUpTools)};rn("Horizontal",new xm);rn("Spot",new zm);rn("Table",new Dm);rn("Viewbox",new Im);rn("TableRow",new Gm);rn("TableColumn",new Hm);rn("Graduated",new Sm);rn("Grid",new Jm);si.add("GraphLinksModel",Eq);si.add("TreeModel",Sq);Xp($r,null);Xp(os,null);
var yu=x.go,zu={get licenseKey(){return Q.licenseKey},set licenseKey(a){Q.licenseKey=a},get version(){return Q.version},Group:vf,EnumValue:D,List:E,Set:F,Map:H,Point:J,Size:M,Rect:N,Margin:pc,Spot:P,Geometry:td,PathFigure:he,PathSegment:pe,InputEvent:re,DiagramEvent:te,ChangedEvent:ue,Model:Z,GraphLinksModel:or,TreeModel:tr,Binding:Li,Transaction:ze,UndoManager:Ae,CommandHandler:Rk,Tool:Ce,DraggingTool:Se,DraggingInfo:$e,DraggingOptions:Te,LinkingBaseTool:Lf,LinkingTool:Wf,RelinkingTool:Ze,LinkReshapingTool:cg,
ResizingTool:ug,RotatingTool:Bg,ClickSelectingTool:Cg,ActionTool:Dg,ClickCreatingTool:Eg,HTMLInfo:Qe,ContextMenuTool:Jg,DragSelectingTool:Gg,PanningTool:Hg,TextEditingTool:Ug,ToolManager:Oa,Animation:ph,AnimationManager:lh,AnimationTrigger:di,Layer:ii,Diagram:Q,Palette:Kk,Overview:Nk,Brush:tl,GraphObject:Y,Panel:X,RowColumnDefinition:Tj,Shape:W,TextBlock:Vg,TextBlockMetrics:io,Picture:Zj,Part:U,Adornment:He,Node:V,Link:S,Placeholder:wg,Layout:yi,LayoutNetwork:Rp,LayoutVertex:eq,LayoutEdge:fq,GridLayout:Mk,
PanelLayout:Ol,CircularLayout:ur,CircularNetwork:Lr,CircularVertex:Yr,CircularEdge:Zr,ForceDirectedLayout:$r,ForceDirectedNetwork:as,ForceDirectedVertex:ms,ForceDirectedEdge:ns,LayeredDigraphLayout:os,LayeredDigraphNetwork:ts,LayeredDigraphVertex:it,LayeredDigraphEdge:jt,TreeLayout:kt,TreeNetwork:qt,TreeVertex:rt,TreeEdge:xu};
"object"===typeof yu&&yu.version&&B("WARNING: a `go` object on the root object is already defined.  "+("Debug"in yu?"debug ":"")+"version: "+yu.version+", replaced with version: "+zu.version);Q.prototype.go=zu;x.go=zu;("undefined"===typeof x||"undefined"===typeof x.module||"object"!==typeof x.module.exports)&&x.define&&"function"===typeof x.define&&x.define.amd&&x.define(zu); 'undefined'!==typeof module&&'object'===typeof module.exports&&(module.exports='undefined'!==typeof global?global.go:self.go); })();


export const go = (typeof global !== "undefined") ? global.go : self.go;

export const Group = go.Group;
export const EnumValue = go.EnumValue;
export const List = go.List;
export const Set = go.Set;
export const Map = go.Map;
export const Point = go.Point;
export const Size = go.Size;
export const Rect = go.Rect;
export const Margin = go.Margin;
export const Spot = go.Spot;
export const Geometry = go.Geometry;
export const PathFigure = go.PathFigure;
export const PathSegment = go.PathSegment;
export const InputEvent = go.InputEvent;
export const DiagramEvent = go.DiagramEvent;
export const ChangedEvent = go.ChangedEvent;
export const Model = go.Model;
export const GraphLinksModel = go.GraphLinksModel;
export const TreeModel = go.TreeModel;
export const Binding = go.Binding;
export const Transaction = go.Transaction;
export const UndoManager = go.UndoManager;
export const CommandHandler = go.CommandHandler;
export const Tool = go.Tool;
export const DraggingTool = go.DraggingTool;
export const DraggingInfo = go.DraggingInfo;
export const LinkingBaseTool = go.LinkingBaseTool;
export const LinkingTool = go.LinkingTool;
export const RelinkingTool = go.RelinkingTool;
export const LinkReshapingTool = go.LinkReshapingTool;
export const ResizingTool = go.ResizingTool;
export const RotatingTool = go.RotatingTool;
export const ClickSelectingTool = go.ClickSelectingTool;
export const ActionTool = go.ActionTool;
export const ClickCreatingTool = go.ClickCreatingTool;
export const HTMLInfo = go.HTMLInfo;
export const ContextMenuTool = go.ContextMenuTool;
export const DragSelectingTool = go.DragSelectingTool;
export const PanningTool = go.PanningTool;
export const TextEditingTool = go.TextEditingTool;
export const ToolManager = go.ToolManager;
export const Animation = go.Animation;
export const AnimationManager = go.AnimationManager;
export const AnimationTrigger = go.AnimationTrigger;
export const Layer = go.Layer;
export const Diagram = go.Diagram;
export const Palette = go.Palette;
export const Overview = go.Overview;
export const Brush = go.Brush;
export const GraphObject = go.GraphObject;
export const Panel = go.Panel;
export const RowColumnDefinition = go.RowColumnDefinition;
export const Shape = go.Shape;
export const TextBlock = go.TextBlock;
export const TextBlockMetrics = go.TextBlockMetrics;
export const Picture = go.Picture;
export const Part = go.Part;
export const Adornment = go.Adornment;
export const Node = go.Node;
export const Link = go.Link;
export const Placeholder = go.Placeholder;
export const Layout = go.Layout;
export const LayoutNetwork = go.LayoutNetwork;
export const LayoutVertex = go.LayoutVertex;
export const LayoutEdge = go.LayoutEdge;
export const GridLayout = go.GridLayout;
export const PanelLayout = go.PanelLayout;
export const CircularLayout = go.CircularLayout;
export const CircularNetwork = go.CircularNetwork;
export const CircularVertex = go.CircularVertex;
export const CircularEdge = go.CircularEdge;
export const ForceDirectedLayout = go.ForceDirectedLayout;
export const ForceDirectedNetwork = go.ForceDirectedNetwork;
export const ForceDirectedVertex = go.ForceDirectedVertex;
export const ForceDirectedEdge = go.ForceDirectedEdge;
export const LayeredDigraphLayout = go.LayeredDigraphLayout;
export const LayeredDigraphNetwork = go.LayeredDigraphNetwork;
export const LayeredDigraphVertex = go.LayeredDigraphVertex;
export const LayeredDigraphEdge = go.LayeredDigraphEdge;
export const TreeLayout = go.TreeLayout;
export const TreeNetwork = go.TreeNetwork;
export const TreeVertex = go.TreeVertex;
export const TreeEdge = go.TreeEdge;
export const version = go.version;
