/*
 * GoJS v2.1.26 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-2020 by Northwoods Software Corporation. 
 * THIS SOFTWARE IS LICENSED.  THE LICENSE AGREEMENT IS AT: https://gojs.net/2.1.26/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.qB=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 pa(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,{configurable:!0,writable:!0,value:a})}}pa(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 qa="object"===typeof self&&self.self===self&&self||"object"===typeof global&&global.global===global&&global||"object"===typeof window&&window.window===window&&window||{};void 0===qa.requestAnimationFrame&&(qa.requestAnimationFrame=qa.setImmediate);function ra(){}function sa(a,b){var c=-1;return function(){var d=this,e=arguments;-1!==c&&qa.clearTimeout(c);c=ta(function(){c=-1;a.apply(d,e)},b)}}function ta(a,b){return qa.setTimeout(a,b)}function ua(a){return qa.document.createElement(a)}
function v(a){throw Error(a);}function va(a,b){a="The object is frozen, so its properties cannot be set: "+a.toString();void 0!==b&&(a+="  to value: "+b);v(a)}function x(a,b,c,d){a instanceof b||(c=wa(c),void 0!==d&&(c+="."+d),xa(a,b,c))}function A(a,b,c,d){typeof a!==b&&(c=wa(c),void 0!==d&&(c+="."+d),xa(a,b,c))}function C(a,b,c){"number"===typeof a&&isFinite(a)||(b=wa(b),void 0!==c&&(b+="."+c),v(b+" must be a real number type, and not NaN or Infinity: "+a))}
function xa(a,b,c,d){b=wa(b);c=wa(c);void 0!==d&&(c+="."+d);"string"===typeof a?v(c+" value is not an instance of "+b+': "'+a+'"'):v(c+" value is not an instance of "+b+": "+a)}function ya(a,b,c,d){c=wa(c);void 0!==d&&(c+="."+d);v(c+" is not in the range "+b+": "+a)}function za(a){v(("string"===typeof a.className?a.className:"")+" constructor cannot take any arguments.")}
function Aa(a){v("Collection was modified during iteration: "+a.toString()+"\n  Perhaps you should iterate over a copy of the collection,\n  or you could collect items to be removed from the collection after the iteration.")}function Ba(a,b){v("No property to set for this enum value: "+b+" on "+a.toString())}function Ca(a){qa.console&&qa.console.log(a)}
function Ea(){qa.console&&qa.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 Fa(a){return"object"===typeof a&&null!==a}function Ga(a){return Array.isArray(a)||qa.NodeList&&a instanceof qa.NodeList||qa.HTMLCollection&&a instanceof qa.HTMLCollection}function Ha(a,b,c){Ga(a)||xa(a,"Array or NodeList or HTMLCollection",b,c)}
function Ia(a){return Array.prototype.slice.call(a)}function Ja(a,b,c){Array.isArray(a)?b>=a.length?a.push(c):a.splice(b,0,c):v("Cannot insert an object into an HTMLCollection or NodeList: "+c+" at "+b)}function Ka(a,b){Array.isArray(a)?b>=a.length?a.pop():a.splice(b,1):v("Cannot remove an object from an HTMLCollection or NodeList at "+b)}function La(){var a=Na.pop();return void 0===a?[]:a}function Oa(a){a.length=0;Na.push(a)}
function wa(a){return null===a?"*":"string"===typeof a?a:"function"===typeof a&&"string"===typeof a.className?a.className:""}function Pa(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(Fa(a)&&a.constructor)return Pa(a.constructor);return typeof a}
function Qa(a){var b=a;Fa(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 Ra(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 Sa(a,b,c){Object.defineProperty(Ua.prototype,a,{get:b,set:c})}function Wa(){var a=Xa;if(0===a.length)for(var b=qa.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 Ya(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 Za=void 0!==qa.navigator&&0<qa.navigator.userAgent.indexOf("MSIE 9.0"),$a=void 0!==qa.navigator&&0<qa.navigator.userAgent.indexOf("MSIE 10.0"),bb=void 0!==qa.navigator&&0<qa.navigator.userAgent.indexOf("Trident/7"),cb=void 0!==qa.navigator&&0<qa.navigator.userAgent.indexOf("Edge/"),db=void 0!==qa.navigator&&void 0!==qa.navigator.platform&&0<=qa.navigator.platform.toUpperCase().indexOf("MAC"),eb=void 0!==qa.navigator&&void 0!==qa.navigator.platform&&null!==qa.navigator.platform.match(/(iPhone|iPod|iPad)/i),
Na=[];Object.freeze([]);var Xa=[];ra.className="Util";ra.Dx="32ab5ff3b26f42dc0ed90f21442913b5";ra.adym="gojs.net";ra.vfo="28e647fdb160";ra.className="Util";function E(a,b,c){fb(this);this.l=a;this.Wa=b;this.w=c}E.prototype.toString=function(){return"EnumValue."+this.Wa};function gb(a,b){return void 0===b||null===b||""===b?null:a[b]}function hb(a,b,c,d){a.classType!==b&&(c=wa(c),void 0!==d&&(c+="."+d),xa(a,"function"==="a constant of class "+typeof b.className?b.className:"",c))}
ma.Object.defineProperties(E.prototype,{classType:{configurable:!0,get:function(){return this.l}},name:{configurable:!0,get:function(){return this.Wa}},value:{configurable:!0,get:function(){return this.w}}});E.className="EnumValue";function ib(){this.qx=[]}ib.prototype.toString=function(){return this.qx.join("")};ib.prototype.add=function(a){""!==a&&this.qx.push(a)};ib.className="StringBuilder";function jb(){}jb.className="PropertyCollection";
var F={sm:!1,ky:!1,Mz:!1,jB:!1,nB:!1,Ay:!1,hB:null,trace:function(a){qa.console&&qa.console.log(a)},iB: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)},rz: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.Nm=Object.getOwnPropertyNames(d.prototype);for(var e={xk:0};e.xk<b.Nm.length;e={xk:e.xk},e.xk++){var f=Object.getOwnPropertyDescriptor(d.prototype,b.Nm[e.xk]);void 0!==f.get&&void 0===f.set&&Object.defineProperty(d.prototype,
b.Nm[e.xk],{set:function(a,b){return function(){throw Error("Property "+a.Nm[b.xk]+" of "+a.x+" is read-only.");}}(b,e)})}}}b={Nm:b.Nm,x:b.x}}}};function kb(){}kb.prototype.reset=function(){};kb.prototype.next=function(){return!1};kb.prototype.ld=function(){return!1};kb.prototype.first=function(){return null};kb.prototype.any=function(){return!1};kb.prototype.all=function(){return!0};kb.prototype.each=function(){return this};kb.prototype.map=function(){return this};kb.prototype.filter=function(){return this};
kb.prototype.Ld=function(){};kb.prototype.toString=function(){return"EmptyIterator"};ma.Object.defineProperties(kb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return 0}}});kb.prototype.first=kb.prototype.first;kb.prototype.hasNext=kb.prototype.ld;kb.prototype.next=kb.prototype.next;kb.prototype.reset=kb.prototype.reset;var lb=null;kb.className="EmptyIterator";lb=new kb;function mb(a){this.key=-1;this.value=a}
mb.prototype.reset=function(){this.key=-1};mb.prototype.next=function(){return-1===this.key?(this.key=0,!0):!1};mb.prototype.ld=function(){return this.next()};mb.prototype.first=function(){this.key=0;return this.value};mb.prototype.any=function(a){this.key=-1;return a(this.value)};mb.prototype.all=function(a){this.key=-1;return a(this.value)};mb.prototype.each=function(a){this.key=-1;a(this.value);return this};mb.prototype.map=function(a){return new mb(a(this.value))};
mb.prototype.filter=function(a){return a(this.value)?new mb(this.value):lb};mb.prototype.Ld=function(){this.value=null};mb.prototype.toString=function(){return"SingletonIterator("+this.value+")"};ma.Object.defineProperties(mb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return 1}}});mb.prototype.first=mb.prototype.first;mb.prototype.hasNext=mb.prototype.ld;mb.prototype.next=mb.prototype.next;
mb.prototype.reset=mb.prototype.reset;mb.className="SingletonIterator";function nb(a){this.ub=a;this.mf=null;a.La=null;this.oa=a.v;this.Ua=-1}nb.prototype.reset=function(){var a=this.ub;a.La=null;this.oa=a.v;this.Ua=-1};nb.prototype.next=function(){var a=this.ub;if(a.v!==this.oa){if(0>this.key)return!1;Aa(a)}a=a.j;var b=a.length,c=++this.Ua,d=this.mf;if(null!==d)for(;c<b;){var e=a[c];if(d(e))return this.key=this.Ua=c,this.value=e,!0;c++}else{if(c<b)return this.key=c,this.value=a[c],!0;this.Ld()}return!1};
nb.prototype.ld=function(){return this.next()};nb.prototype.first=function(){var a=this.ub;this.oa=a.v;this.Ua=0;a=a.j;var b=a.length,c=this.mf;if(null!==c){for(var d=0;d<b;){var e=a[d];if(c(e))return this.key=this.Ua=d,this.value=e;d++}return null}return 0<b?(a=a[0],this.key=0,this.value=a):null};nb.prototype.any=function(a){var b=this.ub;b.La=null;var c=b.v;this.Ua=-1;for(var d=b.j,e=d.length,f=this.mf,g=0;g<e;g++){var h=d[g];if(null===f||f(h)){if(a(h))return!0;b.v!==c&&Aa(b)}}return!1};
nb.prototype.all=function(a){var b=this.ub;b.La=null;var c=b.v;this.Ua=-1;for(var d=b.j,e=d.length,f=this.mf,g=0;g<e;g++){var h=d[g];if(null===f||f(h)){if(!a(h))return!1;b.v!==c&&Aa(b)}}return!0};nb.prototype.each=function(a){var b=this.ub;b.La=null;var c=b.v;this.Ua=-1;for(var d=b.j,e=d.length,f=this.mf,g=0;g<e;g++){var h=d[g];if(null===f||f(h))a(h),b.v!==c&&Aa(b)}return this};
nb.prototype.map=function(a){var b=this.ub;b.La=null;var c=b.v;this.Ua=-1;for(var d=[],e=b.j,f=e.length,g=this.mf,h=0;h<f;h++){var k=e[h];if(null===g||g(k))d.push(a(k)),b.v!==c&&Aa(b)}a=new H;a.j=d;a.qb();return a.iterator};nb.prototype.filter=function(a){var b=this.ub;b.La=null;var c=b.v;this.Ua=-1;for(var d=[],e=b.j,f=e.length,g=this.mf,h=0;h<f;h++){var k=e[h];if(null===g||g(k))a(k)&&d.push(k),b.v!==c&&Aa(b)}a=new H;a.j=d;a.qb();return a.iterator};
nb.prototype.Ld=function(){this.key=-1;this.value=null;this.oa=-1;this.mf=null;this.ub.La=this};nb.prototype.toString=function(){return"ListIterator@"+this.Ua+"/"+this.ub.count};
ma.Object.defineProperties(nb.prototype,{iterator:{configurable:!0,get:function(){return this}},predicate:{configurable:!0,get:function(){return this.mf},set:function(a){this.mf=a}},count:{configurable:!0,get:function(){var a=this.mf;if(null!==a){for(var b=0,c=this.ub.j,d=c.length,e=0;e<d;e++)a(c[e])&&b++;return b}return this.ub.j.length}}});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="ListIterator";function ob(a){this.ub=a;a.lh=null;this.oa=a.v;this.Ua=a.j.length}ob.prototype.reset=function(){var a=this.ub;a.lh=null;this.oa=a.v;this.Ua=a.j.length};ob.prototype.next=function(){var a=this.ub;if(a.v!==this.oa){if(0>this.key)return!1;Aa(a)}var b=--this.Ua;if(0<=b)return this.key=b,this.value=a.j[b],!0;this.Ld();return!1};ob.prototype.ld=function(){return this.next()};
ob.prototype.first=function(){var a=this.ub;this.oa=a.v;var b=a.j;this.Ua=a=b.length-1;return 0<=a?(b=b[a],this.key=a,this.value=b):null};ob.prototype.any=function(a){var b=this.ub;b.lh=null;var c=b.v,d=b.j,e=d.length;this.Ua=e;for(--e;0<=e;e--){if(a(d[e]))return!0;b.v!==c&&Aa(b)}return!1};ob.prototype.all=function(a){var b=this.ub;b.lh=null;var c=b.v,d=b.j,e=d.length;this.Ua=e;for(--e;0<=e;e--){if(!a(d[e]))return!1;b.v!==c&&Aa(b)}return!0};
ob.prototype.each=function(a){var b=this.ub;b.lh=null;var c=b.v,d=b.j,e=d.length;this.Ua=e;for(--e;0<=e;e--)a(d[e]),b.v!==c&&Aa(b);return this};ob.prototype.map=function(a){var b=this.ub;b.lh=null;var c=b.v,d=[],e=b.j,f=e.length;this.Ua=f;for(--f;0<=f;f--)d.push(a(e[f])),b.v!==c&&Aa(b);a=new H;a.j=d;a.qb();return a.iterator};
ob.prototype.filter=function(a){var b=this.ub;b.lh=null;var c=b.v,d=[],e=b.j,f=e.length;this.Ua=f;for(--f;0<=f;f--){var g=e[f];a(g)&&d.push(g);b.v!==c&&Aa(b)}a=new H;a.j=d;a.qb();return a.iterator};ob.prototype.Ld=function(){this.key=-1;this.value=null;this.oa=-1;this.ub.lh=this};ob.prototype.toString=function(){return"ListIteratorBackwards("+this.Ua+"/"+this.ub.count+")"};
ma.Object.defineProperties(ob.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.ub.j.length}}});ob.prototype.first=ob.prototype.first;ob.prototype.hasNext=ob.prototype.ld;ob.prototype.next=ob.prototype.next;ob.prototype.reset=ob.prototype.reset;ob.className="ListIteratorBackwards";
function H(a){fb(this);this.s=!1;this.j=[];this.v=0;this.lh=this.La=null;void 0!==a&&("function"===typeof a||"string"===typeof a?Ea():this.addAll(a))}t=H.prototype;t.qb=function(){var a=this.v;a++;999999999<a&&(a=0);this.v=a};t.freeze=function(){this.s=!0;return this};t.ka=function(){this.s=!1;return this};t.toString=function(){return"List()#"+sb(this)};t.add=function(a){if(null===a)return this;this.s&&va(this,a);this.j.push(a);this.qb();return this};t.push=function(a){this.add(a)};
t.addAll=function(a){if(null===a)return this;this.s&&va(this);var b=this.j;if(Ga(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.qb();return this};t.clear=function(){this.s&&va(this);this.j.length=0;this.qb()};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.O=function(a){F&&C(a,H,"elt:i");var b=this.j;(0>a||a>=b.length)&&ya(a,"0 <= i < length",H,"elt:i");return b[a]};t.get=function(a){return this.O(a)};t.od=function(a,b){F&&C(a,H,"setElt:i");var c=this.j;(0>a||a>=c.length)&&ya(a,"0 <= i < length",H,"setElt:i");this.s&&va(this,a);c[a]=b};t.set=function(a,b){this.od(a,b)};t.first=function(){var a=this.j;return 0===a.length?null:a[0]};t.cc=function(){var a=this.j,b=a.length;return 0<b?a[b-1]:null};
t.pop=function(){this.s&&va(this);var a=this.j;return 0<a.length?a.pop():null};H.prototype.any=function(a){for(var b=this.j,c=this.v,d=b.length,e=0;e<d;e++){if(a(b[e]))return!0;this.v!==c&&Aa(this)}return!1};H.prototype.all=function(a){for(var b=this.j,c=this.v,d=b.length,e=0;e<d;e++){if(!a(b[e]))return!1;this.v!==c&&Aa(this)}return!0};H.prototype.each=function(a){for(var b=this.j,c=this.v,d=b.length,e=0;e<d;e++)a(b[e]),this.v!==c&&Aa(this);return this};
H.prototype.map=function(a){for(var b=new H,c=[],d=this.j,e=this.v,f=d.length,g=0;g<f;g++)c.push(a(d[g])),this.v!==e&&Aa(this);b.j=c;b.qb();return b};H.prototype.filter=function(a){for(var b=new H,c=[],d=this.j,e=this.v,f=d.length,g=0;g<f;g++){var h=d[g];a(h)&&c.push(h);this.v!==e&&Aa(this)}b.j=c;b.qb();return b};t=H.prototype;t.zb=function(a,b){F&&C(a,H,"insertAt:i");0>a&&ya(a,">= 0",H,"insertAt:i");this.s&&va(this,a);var c=this.j;a>=c.length?c.push(b):c.splice(a,0,b);this.qb()};
t.remove=function(a){if(null===a)return!1;this.s&&va(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.qb();return!0};t.delete=function(a){return this.remove(a)};t.hb=function(a){F&&C(a,H,"removeAt:i");var b=this.j;(0>a||a>=b.length)&&ya(a,"0 <= i < length",H,"removeAt:i");this.s&&va(this,a);a===b.length-1?b.pop():b.splice(a,1);this.qb()};
t.removeRange=function(a,b){F&&(C(a,H,"removeRange:from"),C(b,H,"removeRange:to"));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&&va(this);for(var e=a,f=b+1;f<d;)c[e++]=c[f++];c.length=d-(b-a+1);this.qb();return this};H.prototype.copy=function(){var a=new H,b=this.j;0<b.length&&(a.j=Array.prototype.slice.call(b));return a};t=H.prototype;t.ua=function(){for(var a=this.j,b=this.count,c=Array(b),d=0;d<b;d++)c[d]=a[d];return c};
t.Nw=function(){for(var a=new I,b=this.j,c=this.count,d=0;d<c;d++)a.add(b[d]);return a};t.sort=function(a){F&&A(a,"function",H,"sort:sortfunc");this.s&&va(this);this.j.sort(a);this.qb();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);F&&(A(a,"function",H,"sortRange:sortfunc"),C(b,H,"sortRange:from"),C(c,H,"sortRange:to"));this.s&&va(this);var f=c-b;if(1>=f)return this;(0>b||b>=e-1)&&ya(b,"0 <= from < length",H,"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.qb()),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.qb();return this};t.reverse=function(){this.s&&va(this);this.j.reverse();this.qb();return this};
ma.Object.defineProperties(H.prototype,{_dataArray:{configurable:!0,get:function(){return this.j}},count:{configurable:!0,get:function(){return this.j.length}},size:{configurable:!0,get:function(){return this.j.length}},length:{configurable:!0,get:function(){return this.j.length}},iterator:{configurable:!0,get:function(){if(0>=this.j.length)return lb;var a=this.La;return null!==a?(a.reset(),a):new nb(this)}},iteratorBackwards:{configurable:!0,
enumerable:!0,get:function(){if(0>=this.j.length)return lb;var a=this.lh;return null!==a?(a.reset(),a):new ob(this)}}});H.prototype.reverse=H.prototype.reverse;H.prototype.sortRange=H.prototype.tj;H.prototype.sort=H.prototype.sort;H.prototype.toSet=H.prototype.Nw;H.prototype.toArray=H.prototype.ua;H.prototype.removeRange=H.prototype.removeRange;H.prototype.removeAt=H.prototype.hb;H.prototype["delete"]=H.prototype.delete;H.prototype.remove=H.prototype.remove;H.prototype.insertAt=H.prototype.zb;
H.prototype.pop=H.prototype.pop;H.prototype.last=H.prototype.cc;H.prototype.first=H.prototype.first;H.prototype.set=H.prototype.set;H.prototype.setElt=H.prototype.od;H.prototype.get=H.prototype.get;H.prototype.elt=H.prototype.O;H.prototype.indexOf=H.prototype.indexOf;H.prototype.has=H.prototype.has;H.prototype.contains=H.prototype.contains;H.prototype.clear=H.prototype.clear;H.prototype.addAll=H.prototype.addAll;H.prototype.push=H.prototype.push;H.prototype.add=H.prototype.add;H.prototype.thaw=H.prototype.ka;
H.prototype.freeze=H.prototype.freeze;H.className="List";function tb(a){this.Ag=a;a.La=null;this.oa=a.v;this.ra=null}tb.prototype.reset=function(){var a=this.Ag;a.La=null;this.oa=a.v;this.ra=null};tb.prototype.next=function(){var a=this.Ag;if(a.v!==this.oa){if(null===this.key)return!1;Aa(a)}var b=this.ra;b=null===b?a.ga:b.va;if(null!==b)return this.ra=b,this.value=b.value,this.key=b.key,!0;this.Ld();return!1};tb.prototype.ld=function(){return this.next()};
tb.prototype.first=function(){var a=this.Ag;this.oa=a.v;a=a.ga;if(null!==a){this.ra=a;var b=a.value;this.key=a.key;return this.value=b}return null};tb.prototype.any=function(a){var b=this.Ag;b.La=null;var c=b.v;this.ra=null;for(var d=b.ga;null!==d;){if(a(d.value))return!0;b.v!==c&&Aa(b);d=d.va}return!1};tb.prototype.all=function(a){var b=this.Ag;b.La=null;var c=b.v;this.ra=null;for(var d=b.ga;null!==d;){if(!a(d.value))return!1;b.v!==c&&Aa(b);d=d.va}return!0};
tb.prototype.each=function(a){var b=this.Ag;b.La=null;var c=b.v;this.ra=null;for(var d=b.ga;null!==d;)a(d.value),b.v!==c&&Aa(b),d=d.va;return this};tb.prototype.map=function(a){var b=this.Ag;b.La=null;for(var c=new H,d=b.v,e=b.ga;null!==e;)c.add(a(e.value)),b.v!==d&&Aa(b),e=e.va;return c.iterator};tb.prototype.filter=function(a){var b=this.Ag;b.La=null;for(var c=new H,d=b.v,e=b.ga;null!==e;){var f=e.value;a(f)&&c.add(f);b.v!==d&&Aa(b);e=e.va}return c.iterator};
tb.prototype.Ld=function(){this.value=this.key=null;this.oa=-1;this.Ag.La=this};tb.prototype.toString=function(){return null!==this.ra?"SetIterator@"+this.ra.value:"SetIterator"};ma.Object.defineProperties(tb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.Ag.Kb}}});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="SetIterator";function I(a){fb(this);this.s=!1;this.Mb={};this.Kb=0;this.La=null;this.v=0;this.ff=this.ga=null;void 0!==a&&("function"===typeof a||"string"===typeof a?Ea():this.addAll(a))}t=I.prototype;t.qb=function(){var a=this.v;a++;999999999<a&&(a=0);this.v=a};t.freeze=function(){this.s=!0;return this};t.ka=function(){this.s=!1;return this};t.toString=function(){return"Set()#"+sb(this)};
t.add=function(a){if(null===a)return this;this.s&&va(this,a);var b=a;Fa(a)&&(b=ub(a));void 0===this.Mb[b]&&(this.Kb++,a=new vb(a,a),this.Mb[b]=a,b=this.ff,null===b?this.ga=a:(a.Sl=b,b.va=a),this.ff=a,this.qb());return this};t.addAll=function(a){if(null===a)return this;this.s&&va(this);if(Ga(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 Fa(a)&&(b=sb(a),void 0===b)?!1:void 0!==this.Mb[b]};t.has=function(a){return this.contains(a)};t.yz=function(a){if(null===a)return!0;for(a=a.iterator;a.next();)if(!this.contains(a.value))return!1;return!0};t.zz=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.ga;return null===a?null:a.value};
I.prototype.any=function(a){for(var b=this.v,c=this.ga;null!==c;){if(a(c.value))return!0;this.v!==b&&Aa(this);c=c.va}return!1};I.prototype.all=function(a){for(var b=this.v,c=this.ga;null!==c;){if(!a(c.value))return!1;this.v!==b&&Aa(this);c=c.va}return!0};I.prototype.each=function(a){for(var b=this.v,c=this.ga;null!==c;)a(c.value),this.v!==b&&Aa(this),c=c.va;return this};I.prototype.map=function(a){for(var b=new I,c=this.v,d=this.ga;null!==d;)b.add(a(d.value)),this.v!==c&&Aa(this),d=d.va;return b};
I.prototype.filter=function(a){for(var b=new I,c=this.v,d=this.ga;null!==d;){var e=d.value;a(e)&&b.add(e);this.v!==c&&Aa(this);d=d.va}return b};t=I.prototype;t.remove=function(a){if(null===a)return!1;this.s&&va(this,a);var b=a;if(Fa(a)&&(b=sb(a),void 0===b))return!1;a=this.Mb[b];if(void 0===a)return!1;var c=a.va,d=a.Sl;null!==c&&(c.Sl=d);null!==d&&(d.va=c);this.ga===a&&(this.ga=c);this.ff===a&&(this.ff=d);delete this.Mb[b];this.Kb--;this.qb();return!0};t.delete=function(a){return this.remove(a)};
t.cr=function(a){if(null===a)return this;this.s&&va(this);if(Ga(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.SA=function(a){if(null===a||0===this.count)return this;this.s&&va(this);var b=new I;b.addAll(a);a=[];for(var c=this.iterator;c.next();){var d=c.value;b.contains(d)||a.push(d)}this.cr(a);return this};t.clear=function(){this.s&&va(this);this.Mb={};this.Kb=0;null!==this.La&&this.La.reset();this.ff=this.ga=null;this.qb()};
I.prototype.copy=function(){var a=new I,b=this.Mb,c;for(c in b)a.add(b[c].value);return a};I.prototype.ua=function(){var a=Array(this.Kb),b=this.Mb,c=0,d;for(d in b)a[c]=b[d].value,c++;return a};I.prototype.Mw=function(){var a=new H,b=this.Mb,c;for(c in b)a.add(b[c].value);return a};function fb(a){a.__gohashid=wb++}function ub(a){var b=a.__gohashid;void 0===b&&(b=wb++,a.__gohashid=b);return b}function sb(a){return a.__gohashid}
ma.Object.defineProperties(I.prototype,{count:{configurable:!0,get:function(){return this.Kb}},size:{configurable:!0,get:function(){return this.Kb}},iterator:{configurable:!0,get:function(){if(0>=this.Kb)return lb;var a=this.La;return null!==a?(a.reset(),a):new tb(this)}}});I.prototype.toList=I.prototype.Mw;I.prototype.toArray=I.prototype.ua;I.prototype.clear=I.prototype.clear;I.prototype.retainAll=I.prototype.SA;I.prototype.removeAll=I.prototype.cr;
I.prototype["delete"]=I.prototype.delete;I.prototype.remove=I.prototype.remove;I.prototype.first=I.prototype.first;I.prototype.containsAny=I.prototype.zz;I.prototype.containsAll=I.prototype.yz;I.prototype.has=I.prototype.has;I.prototype.contains=I.prototype.contains;I.prototype.addAll=I.prototype.addAll;I.prototype.add=I.prototype.add;I.prototype.thaw=I.prototype.ka;I.prototype.freeze=I.prototype.freeze;var wb=1;I.className="Set";I.uniqueHash=fb;I.hashIdUnique=ub;I.hashId=sb;
function zb(a){this.la=a;this.oa=a.v;this.ra=null}zb.prototype.reset=function(){this.oa=this.la.v;this.ra=null};zb.prototype.next=function(){var a=this.la;if(a.v!==this.oa){if(null===this.key)return!1;Aa(a)}var b=this.ra;b=null===b?a.ga:b.va;if(null!==b)return this.ra=b,this.value=this.key=a=b.key,!0;this.Ld();return!1};zb.prototype.ld=function(){return this.next()};zb.prototype.first=function(){var a=this.la;this.oa=a.v;a=a.ga;return null!==a?(this.ra=a,this.value=this.key=a=a.key):null};
zb.prototype.any=function(a){var b=this.la,c=b.v;this.ra=null;for(var d=b.ga;null!==d;){if(a(d.key))return!0;b.v!==c&&Aa(b);d=d.va}return!1};zb.prototype.all=function(a){var b=this.la,c=b.v;this.ra=null;for(var d=b.ga;null!==d;){if(!a(d.key))return!1;b.v!==c&&Aa(b);d=d.va}return!0};zb.prototype.each=function(a){var b=this.la,c=b.v;this.ra=null;for(var d=b.ga;null!==d;)a(d.key),b.v!==c&&Aa(b),d=d.va;return this};
zb.prototype.map=function(a){var b=this.la,c=b.v;this.ra=null;for(var d=new H,e=b.ga;null!==e;)d.add(a(e.key)),b.v!==c&&Aa(b),e=e.va;return d.iterator};zb.prototype.filter=function(a){var b=this.la,c=b.v;this.ra=null;for(var d=new H,e=b.ga;null!==e;){var f=e.key;a(f)&&d.add(f);b.v!==c&&Aa(b);e=e.va}return d.iterator};zb.prototype.Ld=function(){this.value=this.key=null;this.oa=-1};zb.prototype.toString=function(){return null!==this.ra?"MapKeySetIterator@"+this.ra.value:"MapKeySetIterator"};
ma.Object.defineProperties(zb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.la.Kb}}});zb.prototype.first=zb.prototype.first;zb.prototype.hasNext=zb.prototype.ld;zb.prototype.next=zb.prototype.next;zb.prototype.reset=zb.prototype.reset;zb.className="MapKeySetIterator";function Ab(a){I.call(this);fb(this);this.s=!0;this.la=a}la(Ab,I);t=Ab.prototype;t.freeze=function(){return this};t.ka=function(){return this};
t.toString=function(){return"MapKeySet("+this.la.toString()+")"};t.add=function(){v("This Set is read-only: "+this.toString());return this};t.contains=function(a){return this.la.contains(a)};t.has=function(a){return this.contains(a)};t.remove=function(){v("This Set is read-only: "+this.toString());return!1};t.delete=function(a){return this.remove(a)};t.clear=function(){v("This Set is read-only: "+this.toString())};t.first=function(){var a=this.la.ga;return null!==a?a.key:null};
Ab.prototype.any=function(a){for(var b=this.la.ga;null!==b;){if(a(b.key))return!0;b=b.va}return!1};Ab.prototype.all=function(a){for(var b=this.la.ga;null!==b;){if(!a(b.key))return!1;b=b.va}return!0};Ab.prototype.each=function(a){for(var b=this.la.ga;null!==b;)a(b.key),b=b.va;return this};Ab.prototype.map=function(a){for(var b=new I,c=this.la.ga;null!==c;)b.add(a(c.key)),c=c.va;return b};Ab.prototype.filter=function(a){for(var b=new I,c=this.la.ga;null!==c;){var d=c.key;a(d)&&b.add(d);c=c.va}return b};
Ab.prototype.copy=function(){return new Ab(this.la)};Ab.prototype.Nw=function(){var a=new I,b=this.la.Mb,c;for(c in b)a.add(b[c].key);return a};Ab.prototype.ua=function(){var a=this.la.Mb,b=Array(this.la.Kb),c=0,d;for(d in a)b[c]=a[d].key,c++;return b};Ab.prototype.Mw=function(){var a=new H,b=this.la.Mb,c;for(c in b)a.add(b[c].key);return a};
ma.Object.defineProperties(Ab.prototype,{count:{configurable:!0,get:function(){return this.la.Kb}},size:{configurable:!0,get:function(){return this.la.Kb}},iterator:{configurable:!0,get:function(){return 0>=this.la.Kb?lb:new zb(this.la)}}});Ab.prototype.toList=Ab.prototype.Mw;Ab.prototype.toArray=Ab.prototype.ua;Ab.prototype.toSet=Ab.prototype.Nw;Ab.prototype.first=Ab.prototype.first;Ab.prototype.clear=Ab.prototype.clear;Ab.prototype["delete"]=Ab.prototype.delete;
Ab.prototype.remove=Ab.prototype.remove;Ab.prototype.has=Ab.prototype.has;Ab.prototype.contains=Ab.prototype.contains;Ab.prototype.add=Ab.prototype.add;Ab.prototype.thaw=Ab.prototype.ka;Ab.prototype.freeze=Ab.prototype.freeze;Ab.className="MapKeySet";function Bb(a){this.la=a;a.ef=null;this.oa=a.v;this.ra=null}Bb.prototype.reset=function(){var a=this.la;a.ef=null;this.oa=a.v;this.ra=null};
Bb.prototype.next=function(){var a=this.la;if(a.v!==this.oa){if(null===this.key)return!1;Aa(a)}var b=this.ra;b=null===b?a.ga:b.va;if(null!==b)return this.ra=b,this.value=b.value,this.key=b.key,!0;this.Ld();return!1};Bb.prototype.ld=function(){return this.next()};Bb.prototype.first=function(){var a=this.la;this.oa=a.v;a=a.ga;if(null!==a){this.ra=a;var b=a.value;this.key=a.key;return this.value=b}return null};
Bb.prototype.any=function(a){var b=this.la;b.ef=null;var c=b.v;this.ra=null;for(var d=b.ga;null!==d;){if(a(d.value))return!0;b.v!==c&&Aa(b);d=d.va}return!1};Bb.prototype.all=function(a){var b=this.la;b.ef=null;var c=b.v;this.ra=null;for(var d=b.ga;null!==d;){if(!a(d.value))return!1;b.v!==c&&Aa(b);d=d.va}return!0};Bb.prototype.each=function(a){var b=this.la;b.ef=null;var c=b.v;this.ra=null;for(var d=b.ga;null!==d;)a(d.value),b.v!==c&&Aa(b),d=d.va;return this};
Bb.prototype.map=function(a){var b=this.la;b.ef=null;var c=b.v;this.ra=null;for(var d=new H,e=b.ga;null!==e;)d.add(a(e.value)),b.v!==c&&Aa(b),e=e.va;return d.iterator};Bb.prototype.filter=function(a){var b=this.la;b.ef=null;var c=b.v;this.ra=null;for(var d=new H,e=b.ga;null!==e;){var f=e.value;a(f)&&d.add(f);b.v!==c&&Aa(b);e=e.va}return d.iterator};Bb.prototype.Ld=function(){this.value=this.key=null;this.oa=-1;this.la.ef=this};
Bb.prototype.toString=function(){return null!==this.ra?"MapValueSetIterator@"+this.ra.value:"MapValueSetIterator"};ma.Object.defineProperties(Bb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.la.Kb}}});Bb.prototype.first=Bb.prototype.first;Bb.prototype.hasNext=Bb.prototype.ld;Bb.prototype.next=Bb.prototype.next;Bb.prototype.reset=Bb.prototype.reset;Bb.className="MapValueSetIterator";
function vb(a,b){this.key=a;this.value=b;this.Sl=this.va=null}vb.prototype.toString=function(){return"{"+this.key+":"+this.value+"}"};vb.className="KeyValuePair";function Cb(a){this.la=a;a.La=null;this.oa=a.v;this.ra=null}Cb.prototype.reset=function(){var a=this.la;a.La=null;this.oa=a.v;this.ra=null};
Cb.prototype.next=function(){var a=this.la;if(a.v!==this.oa){if(null===this.key)return!1;Aa(a)}var b=this.ra;b=null===b?a.ga:b.va;if(null!==b)return this.ra=b,this.key=b.key,this.value=b.value,!0;this.Ld();return!1};Cb.prototype.ld=function(){return this.next()};Cb.prototype.first=function(){var a=this.la;this.oa=a.v;a=a.ga;return null!==a?(this.ra=a,this.key=a.key,this.value=a.value,a):null};
Cb.prototype.any=function(a){var b=this.la;b.La=null;var c=b.v;this.ra=null;for(var d=b.ga;null!==d;){if(a(d))return!0;b.v!==c&&Aa(b);d=d.va}return!1};Cb.prototype.all=function(a){var b=this.la;b.La=null;var c=b.v;this.ra=null;for(var d=b.ga;null!==d;){if(!a(d))return!1;b.v!==c&&Aa(b);d=d.va}return!0};Cb.prototype.each=function(a){var b=this.la;b.La=null;var c=b.v;this.ra=null;for(var d=b.ga;null!==d;)a(d),b.v!==c&&Aa(b),d=d.va;return this};
Cb.prototype.map=function(a){var b=this.la;b.La=null;var c=b.v;this.ra=null;for(var d=new H,e=b.ga;null!==e;)d.add(a(e)),b.v!==c&&Aa(b),e=e.va;return d.iterator};Cb.prototype.filter=function(a){var b=this.la;b.La=null;var c=b.v;this.ra=null;for(var d=new H,e=b.ga;null!==e;)a(e)&&d.add(e),b.v!==c&&Aa(b),e=e.va;return d.iterator};Cb.prototype.Ld=function(){this.value=this.key=null;this.oa=-1;this.la.La=this};Cb.prototype.toString=function(){return null!==this.ra?"MapIterator@"+this.ra:"MapIterator"};
ma.Object.defineProperties(Cb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.la.Kb}}});Cb.prototype.first=Cb.prototype.first;Cb.prototype.hasNext=Cb.prototype.ld;Cb.prototype.next=Cb.prototype.next;Cb.prototype.reset=Cb.prototype.reset;Cb.className="MapIterator";
function Db(a){fb(this);this.s=!1;this.Mb={};this.Kb=0;this.ef=this.La=null;this.v=0;this.ff=this.ga=null;void 0!==a&&("function"===typeof a||"string"===typeof a?Ea():this.addAll(a))}t=Db.prototype;t.qb=function(){var a=this.v;a++;999999999<a&&(a=0);this.v=a};t.freeze=function(){this.s=!0;return this};t.ka=function(){this.s=!1;return this};t.toString=function(){return"Map()#"+sb(this)};
t.add=function(a,b){this.s&&va(this,a);var c=a;Fa(a)&&(c=ub(a));var d=this.Mb[c];void 0===d?(this.Kb++,a=new vb(a,b),this.Mb[c]=a,c=this.ff,null===c?this.ga=a:(a.Sl=c,c.va=a),this.ff=a,this.qb()):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(Ga(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 Db)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.ga};Db.prototype.any=function(a){for(var b=this.v,c=this.ga;null!==c;){if(a(c))return!0;this.v!==b&&Aa(this);c=c.va}return!1};
Db.prototype.all=function(a){for(var b=this.v,c=this.ga;null!==c;){if(!a(c))return!1;this.v!==b&&Aa(this);c=c.va}return!0};Db.prototype.each=function(a){for(var b=this.v,c=this.ga;null!==c;)a(c),this.v!==b&&Aa(this),c=c.va;return this};Db.prototype.map=function(a){for(var b=new Db,c=this.v,d=this.ga;null!==d;)b.add(d.key,a(d)),this.v!==c&&Aa(this),d=d.va;return b};Db.prototype.filter=function(a){for(var b=new Db,c=this.v,d=this.ga;null!==d;)a(d)&&b.add(d.key,d.value),this.v!==c&&Aa(this),d=d.va;return b};
t=Db.prototype;t.contains=function(a){var b=a;return Fa(a)&&(b=sb(a),void 0===b)?!1:void 0!==this.Mb[b]};t.has=function(a){return this.contains(a)};t.K=function(a){var b=a;if(Fa(a)&&(b=sb(a),void 0===b))return null;a=this.Mb[b];return void 0===a?null:a.value};t.get=function(a){return this.K(a)};
t.remove=function(a){if(null===a)return!1;this.s&&va(this,a);var b=a;if(Fa(a)&&(b=sb(a),void 0===b))return!1;a=this.Mb[b];if(void 0===a)return!1;var c=a.va,d=a.Sl;null!==c&&(c.Sl=d);null!==d&&(d.va=c);this.ga===a&&(this.ga=c);this.ff===a&&(this.ff=d);delete this.Mb[b];this.Kb--;this.qb();return!0};t.delete=function(a){return this.remove(a)};t.clear=function(){this.s&&va(this);this.Mb={};this.Kb=0;null!==this.La&&this.La.reset();null!==this.ef&&this.ef.reset();this.ff=this.ga=null;this.qb()};
Db.prototype.copy=function(){var a=new Db,b=this.Mb,c;for(c in b){var d=b[c];a.add(d.key,d.value)}return a};Db.prototype.ua=function(){var a=this.Mb,b=Array(this.Kb),c=0,d;for(d in a){var e=a[d];b[c]=new vb(e.key,e.value);c++}return b};Db.prototype.Pf=function(){return new Ab(this)};
ma.Object.defineProperties(Db.prototype,{count:{configurable:!0,get:function(){return this.Kb}},size:{configurable:!0,get:function(){return this.Kb}},iterator:{configurable:!0,get:function(){if(0>=this.count)return lb;var a=this.La;return null!==a?(a.reset(),a):new Cb(this)}},iteratorKeys:{configurable:!0,get:function(){return 0>=this.count?lb:new zb(this)}},iteratorValues:{configurable:!0,get:function(){if(0>=this.count)return lb;
var a=this.ef;return null!==a?(a.reset(),a):new Bb(this)}}});Db.prototype.toKeySet=Db.prototype.Pf;Db.prototype.toArray=Db.prototype.ua;Db.prototype.clear=Db.prototype.clear;Db.prototype["delete"]=Db.prototype.delete;Db.prototype.remove=Db.prototype.remove;Db.prototype.get=Db.prototype.get;Db.prototype.getValue=Db.prototype.K;Db.prototype.has=Db.prototype.has;Db.prototype.contains=Db.prototype.contains;Db.prototype.first=Db.prototype.first;Db.prototype.addAll=Db.prototype.addAll;
Db.prototype.set=Db.prototype.set;Db.prototype.add=Db.prototype.add;Db.prototype.thaw=Db.prototype.ka;Db.prototype.freeze=Db.prototype.freeze;Db.className="Map";function J(a,b){void 0===a?this.H=this.G=0:"number"===typeof a&&"number"===typeof b?(this.G=a,this.H=b):v("Invalid arguments to Point constructor: "+a+", "+b);this.s=!1}J.prototype.assign=function(a){this.G=a.G;this.H=a.H;return this};J.prototype.h=function(a,b){this.G=a;this.H=b;return this};
J.prototype.Ng=function(a,b){F&&(A(a,"number",J,"setTo:x"),A(b,"number",J,"setTo:y"),this.ha());this.G=a;this.H=b;return this};J.prototype.set=function(a){F&&(x(a,J,J,"set:p"),this.ha());this.G=a.G;this.H=a.H;return this};J.prototype.copy=function(){var a=new J;a.G=this.G;a.H=this.H;return a};t=J.prototype;t.ia=function(){this.s=!0;Object.freeze(this);return this};t.J=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};
t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.s=!1;return this};t.ha=function(a){if(F&&this.s){var b="The Point is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+="  to value: "+a);v(b)}};function Eb(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 Fb(a){F&&x(a,J);return a.x.toString()+" "+a.y.toString()}t.toString=function(){return"Point("+this.x+","+this.y+")"};t.A=function(a){return a instanceof J?this.G===a.x&&this.H===a.y:!1};t.fj=function(a,b){return this.G===a&&this.H===b};t.Sa=function(a){return K.C(this.G,a.x)&&K.C(this.H,a.y)};t.add=function(a){F&&(x(a,J,J,"add:p"),this.ha());this.G+=a.x;this.H+=a.y;return this};t.je=function(a){F&&(x(a,J,J,"subtract:p"),this.ha());this.G-=a.x;this.H-=a.y;return this};
t.offset=function(a,b){F&&(C(a,J,"offset:dx"),C(b,J,"offset:dy"),this.ha());this.G+=a;this.H+=b;return this};J.prototype.rotate=function(a){F&&(C(a,J,"rotate:angle"),this.ha());if(0===a)return this;var b=this.G,c=this.H;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.G=a*b-d*c;this.H=d*b+a*c;return this};t=J.prototype;
t.scale=function(a,b){F&&(C(a,J,"scale:sx"),C(b,J,"scale:sy"),this.ha());this.G*=a;this.H*=b;return this};t.Qe=function(a){F&&x(a,J,J,"distanceSquaredPoint:p");var b=a.x-this.G;a=a.y-this.H;return b*b+a*a};t.kd=function(a,b){F&&(C(a,J,"distanceSquared:px"),C(b,J,"distanceSquared:py"));a-=this.G;b-=this.H;return a*a+b*b};t.normalize=function(){F&&this.ha();var a=this.G,b=this.H,c=Math.sqrt(a*a+b*b);0<c&&(this.G=a/c,this.H=b/c);return this};
t.Xa=function(a){F&&x(a,J,J,"directionPoint:p");return Gb(a.x-this.G,a.y-this.H)};t.direction=function(a,b){F&&(C(a,J,"direction:px"),C(b,J,"direction:py"));return Gb(a-this.G,b-this.H)};function Gb(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.LA=function(a,b,c,d){F&&(C(a,J,"projectOntoLineSegment:px"),C(b,J,"projectOntoLineSegment:py"),C(c,J,"projectOntoLineSegment:qx"),C(d,J,"projectOntoLineSegment:qy"));K.Vh(a,b,c,d,this.G,this.H,this);return this};t.MA=function(a,b){F&&(x(a,J,J,"projectOntoLineSegmentPoint:p"),x(b,J,J,"projectOntoLineSegmentPoint:q"));K.Vh(a.x,a.y,b.x,b.y,this.G,this.H,this);return this};
t.YA=function(a,b,c,d){F&&(C(a,J,"snapToGrid:originx"),C(b,J,"snapToGrid:originy"),C(c,J,"snapToGrid:cellwidth"),C(d,J,"snapToGrid:cellheight"));K.Hq(this.G,this.H,a,b,c,d,this);return this};t.ZA=function(a,b){F&&(x(a,J,J,"snapToGridPoint:p"),x(b,Hb,J,"snapToGridPoint:q"));K.Hq(this.G,this.H,a.x,a.y,b.width,b.height,this);return this};t.sj=function(a,b){F&&(x(a,L,J,"setRectSpot:r"),x(b,M,J,"setRectSpot:spot"),this.ha());this.G=a.x+b.x*a.width+b.offsetX;this.H=a.y+b.y*a.height+b.offsetY;return this};
t.Lk=function(a,b,c,d,e){F&&(C(a,J,"setSpot:x"),C(b,J,"setSpot:y"),C(c,J,"setSpot:w"),C(d,J,"setSpot:h"),(0>c||0>d)&&v("Point.setSpot:Width and height cannot be negative"),x(e,M,J,"setSpot:spot"),this.ha());this.G=a+e.x*c+e.offsetX;this.H=b+e.y*d+e.offsetY;return this};t.transform=function(a){F&&x(a,Ib,J,"transform:t");a.xa(this);return this};function Jb(a,b){F&&x(b,Ib,J,"transformInverted:t");b.ee(a);return a}
function Kb(a,b,c,d,e,f){F&&(C(a,J,"distanceLineSegmentSquared:px"),C(b,J,"distanceLineSegmentSquared:py"),C(c,J,"distanceLineSegmentSquared:ax"),C(d,J,"distanceLineSegmentSquared:ay"),C(e,J,"distanceLineSegmentSquared:bx"),C(f,J,"distanceLineSegmentSquared:by"));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 Lb(a,b,c,d){F&&(C(a,J,"distanceSquared:px"),C(b,J,"distanceSquared:py"),C(c,J,"distanceSquared:qx"),C(d,J,"distanceSquared:qy"));a=c-a;b=d-b;return a*a+b*b}function Mb(a,b,c,d){F&&(C(a,J,"direction:px"),C(b,J,"direction:py"),C(c,J,"direction:qx"),C(d,J,"direction:qy"));a=c-a;b=d-b;if(0===a)return 0<b?90:0>b?270:0;if(0===b)return 0<a?0:180;if(isNaN(a)||isNaN(b))return 0;d=180*Math.atan(Math.abs(b/a))/Math.PI;0>a?d=0>b?d+180:180-d:0>b&&(d=360-d);return d}
t.o=function(){return isFinite(this.x)&&isFinite(this.y)};J.alloc=function(){var a=Nb.pop();return void 0===a?new J:a};J.allocAt=function(a,b){var c=Nb.pop();if(void 0===c)return new J(a,b);c.x=a;c.y=b;return c};J.free=function(a){Nb.push(a)};
ma.Object.defineProperties(J.prototype,{x:{configurable:!0,get:function(){return this.G},set:function(a){F&&(A(a,"number",J,"x"),this.ha(a));this.G=a}},y:{configurable:!0,get:function(){return this.H},set:function(a){F&&(A(a,"number",J,"y"),this.ha(a));this.H=a}}});J.prototype.isReal=J.prototype.o;J.prototype.setSpot=J.prototype.Lk;J.prototype.setRectSpot=J.prototype.sj;J.prototype.snapToGridPoint=J.prototype.ZA;J.prototype.snapToGrid=J.prototype.YA;
J.prototype.projectOntoLineSegmentPoint=J.prototype.MA;J.prototype.projectOntoLineSegment=J.prototype.LA;J.intersectingLineSegments=function(a,b,c,d,e,f,g,h){F&&(C(a,L,"intersectingLineSegments:a1x"),C(b,L,"intersectingLineSegments:a1y"),C(c,L,"intersectingLineSegments:a2x"),C(d,L,"intersectingLineSegments:a2y"),C(e,L,"intersectingLineSegments:b1x"),C(f,L,"intersectingLineSegments:b1y"),C(g,L,"intersectingLineSegments:b2x"),C(h,L,"intersectingLineSegments:b2y"));return K.Pq(a,b,c,d,e,f,g,h)};
J.prototype.direction=J.prototype.direction;J.prototype.directionPoint=J.prototype.Xa;J.prototype.normalize=J.prototype.normalize;J.prototype.distanceSquared=J.prototype.kd;J.prototype.distanceSquaredPoint=J.prototype.Qe;J.prototype.scale=J.prototype.scale;J.prototype.rotate=J.prototype.rotate;J.prototype.offset=J.prototype.offset;J.prototype.subtract=J.prototype.je;J.prototype.add=J.prototype.add;J.prototype.equalsApprox=J.prototype.Sa;J.prototype.equalTo=J.prototype.fj;J.prototype.equals=J.prototype.A;
J.prototype.set=J.prototype.set;J.prototype.setTo=J.prototype.Ng;var Rb=null,Sb=null,Tb=null,Ub=null,Vb=null,Nb=[];J.className="Point";J.parse=Eb;J.stringify=Fb;J.distanceLineSegmentSquared=Kb;J.distanceSquared=Lb;J.direction=Mb;J.Origin=Rb=(new J(0,0)).ia();J.InfiniteTopLeft=Sb=(new J(-Infinity,-Infinity)).ia();J.InfiniteBottomRight=Tb=(new J(Infinity,Infinity)).ia();J.SixPoint=Ub=(new J(6,6)).ia();J.NoPoint=Vb=(new J(NaN,NaN)).ia();J.parse=Eb;J.stringify=Fb;J.distanceLineSegmentSquared=Kb;
J.distanceSquared=Lb;J.direction=Mb;function Hb(a,b){void 0===a?this.da=this.ea=0:"number"===typeof a&&(0<=a||isNaN(a))&&"number"===typeof b&&(0<=b||isNaN(b))?(this.ea=a,this.da=b):v("Invalid arguments to Size constructor: "+a+", "+b);this.s=!1}var Wb,Xb,Zb,$b,ac,bc,cc;Hb.prototype.assign=function(a){this.ea=a.ea;this.da=a.da;return this};Hb.prototype.h=function(a,b){this.ea=a;this.da=b;return this};
Hb.prototype.Ng=function(a,b){F&&(A(a,"number",Hb,"setTo:w"),A(b,"number",Hb,"setTo:h"),0>a&&ya(a,">= 0",Hb,"setTo:w"),0>b&&ya(b,">= 0",Hb,"setTo:h"),this.ha());this.ea=a;this.da=b;return this};Hb.prototype.set=function(a){F&&(x(a,Hb,Hb,"set:s"),this.ha());this.ea=a.ea;this.da=a.da;return this};Hb.prototype.copy=function(){var a=new Hb;a.ea=this.ea;a.da=this.da;return a};t=Hb.prototype;t.ia=function(){this.s=!0;Object.freeze(this);return this};
t.J=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.s=!1;return this};t.ha=function(a){if(F&&this.s){var b="The Size is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+="  to value: "+a);v(b)}};
function dc(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 Hb(c,e)}return new Hb}function ec(a){F&&x(a,Hb);return a.width.toString()+" "+a.height.toString()}t.toString=function(){return"Size("+this.width+","+this.height+")"};t.A=function(a){return a instanceof Hb?this.ea===a.width&&this.da===a.height:!1};t.fj=function(a,b){return this.ea===a&&this.da===b};
t.Sa=function(a){return K.C(this.ea,a.width)&&K.C(this.da,a.height)};t.o=function(){return isFinite(this.width)&&isFinite(this.height)};Hb.alloc=function(){var a=fc.pop();return void 0===a?new Hb:a};Hb.free=function(a){fc.push(a)};
ma.Object.defineProperties(Hb.prototype,{width:{configurable:!0,get:function(){return this.ea},set:function(a){F&&(A(a,"number",Hb,"width"),this.ha(a));0>a&&ya(a,">= 0",Hb,"width");this.ea=a}},height:{configurable:!0,get:function(){return this.da},set:function(a){F&&(A(a,"number",Hb,"height"),this.ha(a));0>a&&ya(a,">= 0",Hb,"height");this.da=a}}});Hb.prototype.isReal=Hb.prototype.o;Hb.prototype.equalsApprox=Hb.prototype.Sa;Hb.prototype.equalTo=Hb.prototype.fj;
Hb.prototype.equals=Hb.prototype.A;Hb.prototype.set=Hb.prototype.set;Hb.prototype.setTo=Hb.prototype.Ng;var fc=[];Hb.className="Size";Hb.parse=dc;Hb.stringify=ec;Hb.ZeroSize=Wb=(new Hb(0,0)).ia();Hb.OneSize=Xb=(new Hb(1,1)).ia();Hb.SixSize=Zb=(new Hb(6,6)).ia();Hb.EightSize=$b=(new Hb(8,8)).ia();Hb.TenSize=ac=(new Hb(10,10)).ia();Hb.InfiniteSize=bc=(new Hb(Infinity,Infinity)).ia();Hb.NoSize=cc=(new Hb(NaN,NaN)).ia();Hb.parse=dc;Hb.stringify=ec;
function L(a,b,c,d){void 0===a?this.da=this.ea=this.H=this.G=0:a instanceof J?(c=a.x,a=a.y,b instanceof J?(d=b.x,b=b.y,this.G=Math.min(c,d),this.H=Math.min(a,b),this.ea=Math.abs(c-d),this.da=Math.abs(a-b)):b instanceof Hb?(this.G=c,this.H=a,this.ea=b.width,this.da=b.height):v("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.G=a,this.H=b,this.ea=c,this.da=d):v("Invalid arguments to Rect constructor: "+
a+", "+b+", "+c+", "+d);this.s=!1}t=L.prototype;t.assign=function(a){this.G=a.G;this.H=a.H;this.ea=a.ea;this.da=a.da;return this};t.h=function(a,b,c,d){this.G=a;this.H=b;this.ea=c;this.da=d;return this};function gc(a,b,c){a.ea=b;a.da=c}t.Ng=function(a,b,c,d){F&&(A(a,"number",L,"setTo:x"),A(b,"number",L,"setTo:y"),A(c,"number",L,"setTo:w"),A(d,"number",L,"setTo:h"),0>c&&ya(c,">= 0",L,"setTo:w"),0>d&&ya(d,">= 0",L,"setTo:h"),this.ha());this.G=a;this.H=b;this.ea=c;this.da=d;return this};
t.set=function(a){F&&(x(a,L,L,"set:r"),this.ha());this.G=a.G;this.H=a.H;this.ea=a.ea;this.da=a.da;return this};t.pd=function(a){F&&(x(a,J,L,"setPoint:p"),this.ha());this.G=a.x;this.H=a.y;return this};t.WA=function(a){F&&(x(a,Hb,L,"setSize:s"),this.ha());this.ea=a.width;this.da=a.height;return this};L.prototype.copy=function(){var a=new L;a.G=this.G;a.H=this.H;a.ea=this.ea;a.da=this.da;return a};t=L.prototype;t.ia=function(){this.s=!0;Object.freeze(this);return this};
t.J=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.s=!1;return this};t.ha=function(a){if(F&&this.s){var b="The Rect is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+="  to value: "+a);v(b)}};
function hc(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 L(c,e,f,g)}return new L}function ic(a){F&&x(a,L);return a.x.toString()+" "+a.y.toString()+" "+a.width.toString()+" "+a.height.toString()}
t.toString=function(){return"Rect("+this.x+","+this.y+","+this.width+","+this.height+")"};t.A=function(a){return a instanceof L?this.G===a.x&&this.H===a.y&&this.ea===a.width&&this.da===a.height:!1};t.fj=function(a,b,c,d){return this.G===a&&this.H===b&&this.ea===c&&this.da===d};t.Sa=function(a){return K.C(this.G,a.x)&&K.C(this.H,a.y)&&K.C(this.ea,a.width)&&K.C(this.da,a.height)};function jc(a,b){return K.ca(a.G,b.x)&&K.ca(a.H,b.y)&&K.ca(a.ea,b.width)&&K.ca(a.da,b.height)}
t.fa=function(a){F&&x(a,J,L,"containsPoint:p");return this.G<=a.x&&this.G+this.ea>=a.x&&this.H<=a.y&&this.H+this.da>=a.y};t.Pe=function(a){F&&x(a,L,L,"containsRect:r");return this.G<=a.x&&a.x+a.width<=this.G+this.ea&&this.H<=a.y&&a.y+a.height<=this.H+this.da};
t.contains=function(a,b,c,d){F?(C(a,L,"contains:x"),C(b,L,"contains:y"),void 0===c?c=0:C(c,L,"contains:w"),void 0===d?d=0:C(d,L,"contains:h"),(0>c||0>d)&&v("Rect.contains:Width and height cannot be negative")):(void 0===c&&(c=0),void 0===d&&(d=0));return this.G<=a&&a+c<=this.G+this.ea&&this.H<=b&&b+d<=this.H+this.da};t.offset=function(a,b){F&&(C(a,L,"offset:dx"),C(b,L,"offset:dy"),this.ha());this.G+=a;this.H+=b;return this};
t.Lc=function(a,b){F&&(C(a,L,"inflate:w"),C(b,L,"inflate:h"));return kc(this,b,a,b,a)};t.xq=function(a){F&&x(a,lc,L,"addMargin:m");return kc(this,a.top,a.right,a.bottom,a.left)};t.Lw=function(a){F&&x(a,lc,L,"subtractMargin:m");return kc(this,-a.top,-a.right,-a.bottom,-a.left)};t.oA=function(a,b,c,d){F&&(C(a,L,"grow:t"),C(b,L,"grow:r"),C(c,L,"grow:b"),C(d,L,"grow:l"));return kc(this,a,b,c,d)};
function kc(a,b,c,d,e){F&&a.ha();var f=a.ea;c+e<=-f?(a.G+=f/2,a.ea=0):(a.G-=e,a.ea+=c+e);c=a.da;b+d<=-c?(a.H+=c/2,a.da=0):(a.H-=b,a.da+=b+d);return a}t.sA=function(a){F&&x(a,L,L,"intersectRect:r");return mc(this,a.x,a.y,a.width,a.height)};t.dw=function(a,b,c,d){F&&(C(a,L,"intersect:x"),C(b,L,"intersect:y"),C(c,L,"intersect:w"),C(d,L,"intersect:h"),(0>c||0>d)&&v("Rect.intersect:Width and height cannot be negative"));return mc(this,a,b,c,d)};
function mc(a,b,c,d,e){F&&a.ha();var f=Math.max(a.G,b),g=Math.max(a.H,c);b=Math.min(a.G+a.ea,b+d);c=Math.min(a.H+a.da,c+e);a.G=f;a.H=g;a.ea=Math.max(0,b-f);a.da=Math.max(0,c-g);return a}t.Oc=function(a){F&&x(a,L,L,"intersectsRect:r");return this.ew(a.x,a.y,a.width,a.height)};
t.ew=function(a,b,c,d){F&&(C(a,L,"intersects:x"),C(b,L,"intersects:y"),C(a,L,"intersects:w"),C(b,L,"intersects:h"),(0>c||0>d)&&v("Rect.intersects:Width and height cannot be negative"));var e=this.ea,f=this.G;if(Infinity!==e&&Infinity!==c&&(e+=f,c+=a,isNaN(c)||isNaN(e)||f>c||a>e))return!1;a=this.da;c=this.H;return Infinity!==a&&Infinity!==d&&(a+=c,d+=b,isNaN(d)||isNaN(a)||c>d||b>a)?!1:!0};
function nc(a,b){var c=a.ea,d=a.G,e=b.x-10;if(d>b.width+10+10+e||e>c+d)return!1;c=a.da;a=a.H;d=b.y-10;return a>b.height+10+10+d||d>c+a?!1:!0}t.Ve=function(a){F&&x(a,J,L,"unionPoint:p");return qc(this,a.x,a.y,0,0)};t.Pc=function(a){F&&x(a,L,L,"unionRect:r");return qc(this,a.G,a.H,a.ea,a.da)};
t.Sw=function(a,b,c,d){F?(C(a,L,"union:x"),C(b,L,"union:y"),void 0===c?c=0:C(c,L,"union:w"),void 0===d?d=0:C(d,L,"union:h"),(0>c||0>d)&&v("Rect.union:Width and height cannot be negative"),this.ha()):(void 0===c&&(c=0),void 0===d&&(d=0));return qc(this,a,b,c,d)};function qc(a,b,c,d,e){var f=Math.min(a.G,b),g=Math.min(a.H,c);b=Math.max(a.G+a.ea,b+d);c=Math.max(a.H+a.da,c+e);a.G=f;a.H=g;a.ea=b-f;a.da=c-g;return a}
t.Lk=function(a,b,c){F&&(C(a,L,"setSpot:x"),C(b,L,"setSpot:y"),x(c,M,L,"setSpot:spot"),this.ha());this.G=a-c.offsetX-c.x*this.ea;this.H=b-c.offsetY-c.y*this.da;return this};
function rc(a,b,c,d,e,f,g,h){F?(C(a,L,"contains:rx"),C(b,L,"contains:ry"),C(c,L,"contains:rw"),C(d,L,"contains:rh"),C(e,L,"contains:x"),C(f,L,"contains:y"),void 0===g?g=0:C(g,L,"contains:w"),void 0===h?h=0:C(h,L,"contains:h"),(0>c||0>d||0>g||0>h)&&v("Rect.contains:Width and height cannot be negative")):(void 0===g&&(g=0),void 0===h&&(h=0));return a<=e&&e+g<=a+c&&b<=f&&f+h<=b+d}
function sc(a,b,c,d,e,f,g,h){F&&(C(a,L,"intersects:rx"),C(b,L,"intersects:ry"),C(c,L,"intersects:rw"),C(d,L,"intersects:rh"),C(e,L,"intersects:x"),C(f,L,"intersects:y"),C(g,L,"intersects:w"),C(h,L,"intersects:h"),(0>c||0>d||0>g||0>h)&&v("Rect.intersects:Width and height cannot be negative"));return a>g+e||e>c+a?!1:b>h+f||f>d+b?!1:!0}t.o=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)};t.uA=function(){return 0===this.width&&0===this.height};
L.alloc=function(){var a=uc.pop();return void 0===a?new L:a};L.allocAt=function(a,b,c,d){var e=uc.pop();return void 0===e?new L(a,b,c,d):e.h(a,b,c,d)};L.free=function(a){uc.push(a)};
ma.Object.defineProperties(L.prototype,{x:{configurable:!0,get:function(){return this.G},set:function(a){F&&(A(a,"number",L,"x"),this.ha(a));this.G=a}},y:{configurable:!0,get:function(){return this.H},set:function(a){F&&(A(a,"number",L,"y"),this.ha(a));this.H=a}},width:{configurable:!0,get:function(){return this.ea},set:function(a){F&&(A(a,"number",L,"width"),this.ha(a));0>a&&ya(a,">= 0",L,"width");this.ea=a}},height:{configurable:!0,get:function(){return this.da},
set:function(a){F&&(A(a,"number",L,"height"),this.ha(a));0>a&&ya(a,">= 0",L,"height");this.da=a}},left:{configurable:!0,get:function(){return this.G},set:function(a){F&&(A(a,"number",L,"left"),this.ha(a));this.G=a}},top:{configurable:!0,get:function(){return this.H},set:function(a){F&&(A(a,"number",L,"top"),this.ha(a));this.H=a}},right:{configurable:!0,get:function(){return this.G+this.ea},set:function(a){F&&(C(a,L,"right"),this.ha(a));this.G+=a-(this.G+this.ea)}},
bottom:{configurable:!0,get:function(){return this.H+this.da},set:function(a){F&&(C(a,L,"top"),this.ha(a));this.H+=a-(this.H+this.da)}},position:{configurable:!0,get:function(){return new J(this.G,this.H)},set:function(a){F&&(x(a,J,L,"position"),this.ha(a));this.G=a.x;this.H=a.y}},size:{configurable:!0,get:function(){return new Hb(this.ea,this.da)},set:function(a){F&&(x(a,Hb,L,"size"),this.ha(a));this.ea=a.width;this.da=a.height}},center:{configurable:!0,
enumerable:!0,get:function(){return new J(this.G+this.ea/2,this.H+this.da/2)},set:function(a){F&&(x(a,J,L,"center"),this.ha(a));this.G=a.x-this.ea/2;this.H=a.y-this.da/2}},centerX:{configurable:!0,get:function(){return this.G+this.ea/2},set:function(a){F&&(C(a,L,"centerX"),this.ha(a));this.G=a-this.ea/2}},centerY:{configurable:!0,get:function(){return this.H+this.da/2},set:function(a){F&&(C(a,L,"centerY"),this.ha(a));this.H=a-this.da/2}}});L.prototype.isEmpty=L.prototype.uA;
L.prototype.isReal=L.prototype.o;L.intersectsLineSegment=function(a,b,c,d,e,f,g,h){F&&(C(a,L,"intersectsLineSegment:x"),C(b,L,"intersectsLineSegment:y"),C(c,L,"intersectsLineSegment:w"),C(d,L,"intersectsLineSegment:h"),C(e,L,"intersectsLineSegment:p1x"),C(f,L,"intersectsLineSegment:p1y"),C(g,L,"intersectsLineSegment:p2x"),C(h,L,"intersectsLineSegment:p2y"),(0>c||0>d)&&v("Rect.intersectsLineSegment: width and height cannot be negative"));return K.By(a,b,c,d,e,f,g,h)};L.prototype.setSpot=L.prototype.Lk;
L.prototype.union=L.prototype.Sw;L.prototype.unionRect=L.prototype.Pc;L.prototype.unionPoint=L.prototype.Ve;L.prototype.intersects=L.prototype.ew;L.prototype.intersectsRect=L.prototype.Oc;L.prototype.intersect=L.prototype.dw;L.prototype.intersectRect=L.prototype.sA;L.prototype.grow=L.prototype.oA;L.prototype.subtractMargin=L.prototype.Lw;L.prototype.addMargin=L.prototype.xq;L.prototype.inflate=L.prototype.Lc;L.prototype.offset=L.prototype.offset;L.prototype.contains=L.prototype.contains;
L.prototype.containsRect=L.prototype.Pe;L.prototype.containsPoint=L.prototype.fa;L.prototype.equalsApprox=L.prototype.Sa;L.prototype.equalTo=L.prototype.fj;L.prototype.equals=L.prototype.A;L.prototype.setSize=L.prototype.WA;L.prototype.setPoint=L.prototype.pd;L.prototype.set=L.prototype.set;L.prototype.setTo=L.prototype.Ng;var vc=null,wc=null,uc=[];L.className="Rect";L.parse=hc;L.stringify=ic;L.contains=rc;L.intersects=sc;L.ZeroRect=vc=(new L(0,0,0,0)).ia();L.NoRect=wc=(new L(NaN,NaN,NaN,NaN)).ia();
L.parse=hc;L.stringify=ic;L.contains=rc;L.intersects=sc;function lc(a,b,c,d){void 0===a?this.Ae=this.ne=this.Je=this.Le=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):v("Invalid arguments to Margin constructor: "+a+", "+b+", "+c+", "+d);this.s=!1}lc.prototype.assign=function(a){this.Le=a.Le;this.Je=a.Je;this.ne=a.ne;this.Ae=a.Ae;return this};
lc.prototype.Ng=function(a,b,c,d){F&&(A(a,"number",lc,"setTo:t"),A(b,"number",lc,"setTo:r"),A(c,"number",lc,"setTo:b"),A(d,"number",lc,"setTo:l"),this.ha());this.Le=a;this.Je=b;this.ne=c;this.Ae=d;return this};lc.prototype.set=function(a){F&&(x(a,lc,lc,"assign:m"),this.ha());this.Le=a.Le;this.Je=a.Je;this.ne=a.ne;this.Ae=a.Ae;return this};lc.prototype.copy=function(){var a=new lc;a.Le=this.Le;a.Je=this.Je;a.ne=this.ne;a.Ae=this.Ae;return a};t=lc.prototype;
t.ia=function(){this.s=!0;Object.freeze(this);return this};t.J=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.s=!1;return this};t.ha=function(a){if(F&&this.s){var b="The Margin is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+="  to value: "+a);v(b)}};
function xc(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 lc;for(var e=NaN;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));if(isNaN(e))return new lc(c);for(var f=NaN;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));if(isNaN(f))return new lc(c,e);for(var g=NaN;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));return isNaN(g)?new lc(c,e):new lc(c,e,f,g)}return new lc}
function yc(a){F&&x(a,lc);return a.top.toString()+" "+a.right.toString()+" "+a.bottom.toString()+" "+a.left.toString()}t.toString=function(){return"Margin("+this.top+","+this.right+","+this.bottom+","+this.left+")"};t.A=function(a){return a instanceof lc?this.Le===a.top&&this.Je===a.right&&this.ne===a.bottom&&this.Ae===a.left:!1};t.fj=function(a,b,c,d){return this.Le===a&&this.Je===b&&this.ne===c&&this.Ae===d};
t.Sa=function(a){return K.C(this.Le,a.top)&&K.C(this.Je,a.right)&&K.C(this.ne,a.bottom)&&K.C(this.Ae,a.left)};t.o=function(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)};lc.alloc=function(){var a=zc.pop();return void 0===a?new lc:a};lc.free=function(a){zc.push(a)};
ma.Object.defineProperties(lc.prototype,{top:{configurable:!0,get:function(){return this.Le},set:function(a){F&&(C(a,lc,"top"),this.ha(a));this.Le=a}},right:{configurable:!0,get:function(){return this.Je},set:function(a){F&&(C(a,lc,"right"),this.ha(a));this.Je=a}},bottom:{configurable:!0,get:function(){return this.ne},set:function(a){F&&(C(a,lc,"bottom"),this.ha(a));this.ne=a}},left:{configurable:!0,get:function(){return this.Ae},set:function(a){F&&
(C(a,lc,"left"),this.ha(a));this.Ae=a}}});lc.prototype.isReal=lc.prototype.o;lc.prototype.equalsApprox=lc.prototype.Sa;lc.prototype.equalTo=lc.prototype.fj;lc.prototype.equals=lc.prototype.A;lc.prototype.set=lc.prototype.set;lc.prototype.setTo=lc.prototype.Ng;var Ec=null,Fc=null,zc=[];lc.className="Margin";lc.parse=xc;lc.stringify=yc;lc.ZeroMargin=Ec=(new lc(0,0,0,0)).ia();lc.TwoMargin=Fc=(new lc(2,2,2,2)).ia();lc.parse=xc;lc.stringify=yc;
function M(a,b,c,d){void 0===a?this.Zd=this.Yd=this.H=this.G=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 Gc,Hc,Ic,Jc,Lc,Mc,Nc,Oc,Pc,Sc,Tc,Uc,Vc,Wc,Xc,Yc,Zc,ad,bd,cd,dd,ed,fd,gd,kd,ld,md,nd,od,pd,qd,rd,sd,td,ud,vd;M.prototype.assign=function(a){this.G=a.G;this.H=a.H;this.Yd=a.Yd;this.Zd=a.Zd;return this};
M.prototype.Ng=function(a,b,c,d){F&&(wd(a,"setTo:x"),wd(b,"setTo:y"),xd(c,"setTo:offx"),xd(d,"setTo:offy"),this.ha());this.G=a;this.H=b;this.Yd=c;this.Zd=d;return this};M.prototype.set=function(a){F&&(x(a,M,M,"set:s"),this.ha());this.G=a.G;this.H=a.H;this.Yd=a.Yd;this.Zd=a.Zd;return this};M.prototype.copy=function(){var a=new M;a.G=this.G;a.H=this.H;a.Yd=this.Yd;a.Zd=this.Zd;return a};t=M.prototype;t.ia=function(){this.s=!0;Object.freeze(this);return this};
t.J=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.s=!1;return this};t.ha=function(a){if(F&&this.s){var b="The Spot is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+="  to value: "+a);v(b)}};function yd(a,b){a.G=NaN;a.H=NaN;a.Yd=b;return a}function wd(a,b){(isNaN(a)||1<a||0>a)&&ya(a,"0 <= "+b+" <= 1",M,b)}
function xd(a,b){(isNaN(a)||Infinity===a||-Infinity===a)&&ya(a,"real number, not NaN or Infinity",M,b)}
function zd(a){if("string"===typeof a){a=a.trim();if("None"===a)return Gc;if("TopLeft"===a)return Hc;if("Top"===a||"TopCenter"===a||"MiddleTop"===a)return Ic;if("TopRight"===a)return Jc;if("Left"===a||"LeftCenter"===a||"MiddleLeft"===a)return Lc;if("Center"===a)return Mc;if("Right"===a||"RightCenter"===a||"MiddleRight"===a)return Nc;if("BottomLeft"===a)return Oc;if("Bottom"===a||"BottomCenter"===a||"MiddleBottom"===a)return Pc;if("BottomRight"===a)return Sc;if("TopSide"===a)return Tc;if("LeftSide"===
a)return Uc;if("RightSide"===a)return Vc;if("BottomSide"===a)return Wc;if("TopBottomSides"===a)return Xc;if("LeftRightSides"===a)return Yc;if("TopLeftSides"===a)return Zc;if("TopRightSides"===a)return ad;if("BottomLeftSides"===a)return bd;if("BottomRightSides"===a)return cd;if("NotTopSide"===a)return dd;if("NotLeftSide"===a)return ed;if("NotRightSide"===a)return fd;if("NotBottomSide"===a)return gd;if("AllSides"===a)return kd;if("Default"===a)return ld;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 M(c,e,f,g)}return new M}function Ad(a){F&&x(a,M);return a.bb()?a.x.toString()+" "+a.y.toString()+" "+a.offsetX.toString()+" "+a.offsetY.toString():a.toString()}
t.toString=function(){return this.bb()?0===this.Yd&&0===this.Zd?"Spot("+this.x+","+this.y+")":"Spot("+this.x+","+this.y+","+this.offsetX+","+this.offsetY+")":this.A(Gc)?"None":this.A(Hc)?"TopLeft":this.A(Ic)?"Top":this.A(Jc)?"TopRight":this.A(Lc)?"Left":this.A(Mc)?"Center":this.A(Nc)?"Right":this.A(Oc)?"BottomLeft":this.A(Pc)?"Bottom":this.A(Sc)?"BottomRight":this.A(Tc)?"TopSide":this.A(Uc)?"LeftSide":this.A(Vc)?"RightSide":this.A(Wc)?"BottomSide":this.A(Xc)?"TopBottomSides":this.A(Yc)?"LeftRightSides":
this.A(Zc)?"TopLeftSides":this.A(ad)?"TopRightSides":this.A(bd)?"BottomLeftSides":this.A(cd)?"BottomRightSides":this.A(dd)?"NotTopSide":this.A(ed)?"NotLeftSide":this.A(fd)?"NotRightSide":this.A(gd)?"NotBottomSide":this.A(kd)?"AllSides":this.A(ld)?"Default":"None"};t.A=function(a){return a instanceof M?(this.G===a.x||isNaN(this.G)&&isNaN(a.x))&&(this.H===a.y||isNaN(this.H)&&isNaN(a.y))&&this.Yd===a.offsetX&&this.Zd===a.offsetY:!1};
t.ow=function(){return new M(.5-(this.G-.5),.5-(this.H-.5),-this.Yd,-this.Zd)};t.Jf=function(a){if(!this.nd())return!1;if(!a.nd())if(a.A(md))a=Uc;else if(a.A(nd))a=Vc;else if(a.A(od))a=Tc;else if(a.A(pd))a=Wc;else return!1;a=a.offsetY;return(this.Zd&a)===a};t.bb=function(){return!isNaN(this.x)&&!isNaN(this.y)};t.Tb=function(){return isNaN(this.x)||isNaN(this.y)};t.nd=function(){return isNaN(this.x)&&isNaN(this.y)&&1===this.offsetX&&0!==this.offsetY};
t.Rq=function(){return isNaN(this.x)&&isNaN(this.y)&&0===this.offsetX&&0===this.offsetY};t.Gb=function(){return isNaN(this.x)&&isNaN(this.y)&&-1===this.offsetX&&0===this.offsetY};M.alloc=function(){var a=Dd.pop();return void 0===a?new M:a};M.free=function(a){Dd.push(a)};
ma.Object.defineProperties(M.prototype,{x:{configurable:!0,get:function(){return this.G},set:function(a){F&&(wd(a,"x"),this.ha(a));this.G=a}},y:{configurable:!0,get:function(){return this.H},set:function(a){F&&(wd(a,"y"),this.ha(a));this.H=a}},offsetX:{configurable:!0,get:function(){return this.Yd},set:function(a){F&&(xd(a,"offsetX"),this.ha(a));this.Yd=a}},offsetY:{configurable:!0,get:function(){return this.Zd},set:function(a){F&&(xd(a,"offsetY"),
this.ha(a));this.Zd=a}}});M.prototype.isDefault=M.prototype.Gb;M.prototype.isNone=M.prototype.Rq;M.prototype.isSide=M.prototype.nd;M.prototype.isNoSpot=M.prototype.Tb;M.prototype.isSpot=M.prototype.bb;M.prototype.includesSide=M.prototype.Jf;M.prototype.opposite=M.prototype.ow;M.prototype.equals=M.prototype.A;M.prototype.set=M.prototype.set;M.prototype.setTo=M.prototype.Ng;var Dd=[];M.className="Spot";M.parse=zd;M.stringify=Ad;M.None=Gc=yd(new M(0,0,0,0),0).ia();M.Default=ld=yd(new M(0,0,-1,0),-1).ia();
M.TopLeft=Hc=(new M(0,0,0,0)).ia();M.TopCenter=Ic=(new M(.5,0,0,0)).ia();M.TopRight=Jc=(new M(1,0,0,0)).ia();M.LeftCenter=Lc=(new M(0,.5,0,0)).ia();M.Center=Mc=(new M(.5,.5,0,0)).ia();M.RightCenter=Nc=(new M(1,.5,0,0)).ia();M.BottomLeft=Oc=(new M(0,1,0,0)).ia();M.BottomCenter=Pc=(new M(.5,1,0,0)).ia();M.BottomRight=Sc=(new M(1,1,0,0)).ia();M.MiddleTop=qd=Ic;M.MiddleLeft=rd=Lc;M.MiddleRight=sd=Nc;M.MiddleBottom=td=Pc;M.Top=od=Ic;M.Left=md=Lc;M.Right=nd=Nc;M.Bottom=pd=Pc;
M.TopSide=Tc=yd(new M(0,0,1,1),1).ia();M.LeftSide=Uc=yd(new M(0,0,1,2),1).ia();M.RightSide=Vc=yd(new M(0,0,1,4),1).ia();M.BottomSide=Wc=yd(new M(0,0,1,8),1).ia();M.TopBottomSides=Xc=yd(new M(0,0,1,9),1).ia();M.LeftRightSides=Yc=yd(new M(0,0,1,6),1).ia();M.TopLeftSides=Zc=yd(new M(0,0,1,3),1).ia();M.TopRightSides=ad=yd(new M(0,0,1,5),1).ia();M.BottomLeftSides=bd=yd(new M(0,0,1,10),1).ia();M.BottomRightSides=cd=yd(new M(0,0,1,12),1).ia();M.NotTopSide=dd=yd(new M(0,0,1,14),1).ia();
M.NotLeftSide=ed=yd(new M(0,0,1,13),1).ia();M.NotRightSide=fd=yd(new M(0,0,1,11),1).ia();M.NotBottomSide=gd=yd(new M(0,0,1,7),1).ia();M.AllSides=kd=yd(new M(0,0,1,15),1).ia();ud=(new M(.156,.156)).ia();vd=(new M(.844,.844)).ia();M.parse=zd;M.stringify=Ad;function Ib(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0}Ib.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};
Ib.prototype.copy=function(){var a=new Ib;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=Ib.prototype;t.toString=function(){return"Transform("+this.m11+","+this.m12+","+this.m21+","+this.m22+","+this.dx+","+this.dy+")"};t.A=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.Vt=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.kw=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.Tt=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};
Ib.prototype.rotate=function(a,b,c){F&&(C(a,Ib,"rotate:angle"),C(b,Ib,"rotate:rx"),C(c,Ib,"rotate:ry"));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=Ib.prototype;
t.translate=function(a,b){F&&(C(a,Ib,"translate:x"),C(b,Ib,"translate:y"));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);F&&(C(a,Ib,"translate:sx"),C(b,Ib,"translate:sy"));this.m11*=a;this.m12*=a;this.m21*=b;this.m22*=b;return this};t.xa=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.ee=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.Rw=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};Ib.alloc=function(){var a=Ed.pop();return void 0===a?new Ib:a};
Ib.free=function(a){Ed.push(a)};Ib.prototype.transformRect=Ib.prototype.Rw;Ib.prototype.invertedTransformPoint=Ib.prototype.ee;Ib.prototype.transformPoint=Ib.prototype.xa;Ib.prototype.scale=Ib.prototype.scale;Ib.prototype.translate=Ib.prototype.translate;Ib.prototype.rotate=Ib.prototype.rotate;Ib.prototype.invert=Ib.prototype.Tt;Ib.prototype.multiplyInverted=Ib.prototype.kw;Ib.prototype.multiply=Ib.prototype.multiply;Ib.prototype.reset=Ib.prototype.reset;Ib.prototype.isIdentity=Ib.prototype.Vt;
Ib.prototype.equals=Ib.prototype.A;Ib.prototype.set=Ib.prototype.set;var Ed=[];Ib.className="Transform";Ib.xF="54a702f3e53909c447824c6706603faf4c";
var K={eB:"7da71ca0ad381e90",Qg:(Math.sqrt(2)-1)/3*4,jx:null,sqrt:function(a){if(0>=a)return 0;var b=K.jx;if(null===b){b=[];for(var c=0;2E3>=c;c++)b[c]=Math.sqrt(c);K.jx=b}return 1>a?(c=1/a,2E3>=c?1/b[c|0]:Math.sqrt(a)):2E3>=a?b[a|0]:Math.sqrt(a)},C:function(a,b){a-=b;return.5>a&&-.5<a},ca:function(a,b){a-=b;return 5E-8>a&&-5E-8<a},Ub: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},At:function(a,b,c,d,e,f,g,h,k,l,m,n){if(K.Ub(a,b,g,h,n,c,d)&&K.Ub(a,b,g,h,n,e,f))return K.Ub(a,b,g,h,n,l,m);var p=(a+c)/2,r=(b+d)/2,q=(c+e)/2,u=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(p+q)/2;c=(r+u)/2;q=(q+e)/2;u=(u+f)/2;var w=(d+q)/2,y=(c+u)/2;return K.At(a,
b,p,r,d,c,w,y,k,l,m,n)||K.At(w,y,q,u,e,f,g,h,k,l,m,n)},uz: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},sz:function(a,b,c,d,e,f,g,h){var k=(c+e)/2,l=(d+f)/2;return Mb(((a+c)/2+k)/2,((b+d)/2+l)/2,(k+(e+g)/2)/2,(l+(f+h)/2)/2)},rm:function(a,b,c,d,e,f,g,h,k,l){if(K.Ub(a,b,g,h,k,c,d)&&K.Ub(a,b,g,h,k,e,f))qc(l,a,b,0,0),qc(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.rm(a,b,m,n,d,c,q,u,k,l);K.rm(q,u,p,r,e,f,g,h,k,l)}return l},Oe:function(a,b,c,d,e,f,g,h,k,l){if(K.Ub(a,b,g,h,k,c,d)&&K.Ub(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.Oe(a,b,m,n,d,c,q,u,k,l);K.Oe(q,u,p,r,e,f,g,h,k,l)}return l},rw:function(a,b,c,d,e,f,g,h,k,l){if(K.Ub(a,b,e,f,l,c,d))return K.Ub(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.rw(a,b,m,n,p,r,g,h,k,l)||K.rw(p,r,c,d,e,f,g,h,k,l)},oB: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},qw:function(a,b,c,d,e,f,g,h){if(K.Ub(a,b,e,f,g,c,d))qc(h,a,b,0,0),qc(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.qw(a,b,k,l,m,n,g,h);K.qw(m,n,c,d,e,f,g,h)}return h},$q:function(a,b,c,d,e,f,g,h){if(K.Ub(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.$q(a,b,k,l,m,n,g,h);K.$q(m,n,c,d,e,f,g,h)}return h},zq:function(a,b,c,d,e,f,g,h,k,l,m,n,p,r){if(K.Ub(a,b,g,h,p,c,d)&&K.Ub(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),q<g||q>h)return!1}else if(a<g?h=a:(h=g,g=a),p<h||p>g)return!1;r.h(p,q);return!0}q=(a+c)/2;var u=(b+d)/2,w=(c+e)/2,y=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(q+w)/2;c=(u+y)/2;w=(w+e)/2;y=(y+f)/2;var z=(d+w)/2,B=(c+y)/2,D=(m-k)*(m-k)+(n-l)*(n-l),G=!1,O=0,V=0;K.zq(a,b,q,u,d,c,z,B,k,l,m,n,p,r)&&(a=(r.x-k)*(r.x-k)+(r.y-l)*(r.y-l),a<D&&(D=a,G=!0,O=r.x,V=r.y));K.zq(z,B,w,y,e,f,g,h,k,l,m,n,p,r)&&(r.x-k)*(r.x-k)+(r.y-l)*(r.y-l)<D&&(G=!0,O=r.x,V=r.y);G&&(r.x=O,r.y=V);return G},Aq:function(a,b,c,d,e,f,g,h,k,
l,m,n,p){var r=0;if(K.Ub(a,b,g,h,p,c,d)&&K.Ub(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 w=(c+e)/2,y=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(q+w)/2;c=(u+y)/2;w=(w+e)/2;y=(y+f)/2;var z=(d+w)/2,B=(c+y)/2;r+=K.Aq(a,b,q,u,d,c,z,B,k,l,m,n,p);
r+=K.Aq(z,B,w,y,e,f,g,h,k,l,m,n,p)}return r},Vh:function(a,b,c,d,e,f,g){if(K.ca(a,c)){b<d?(c=b,b=d):c=d;if(f<c)return g.h(a,c),!1;if(f>b)return g.h(a,b),!1;g.h(a,f);return!0}if(K.ca(b,d)){a<c?(d=a,a=c):d=c;if(e<d)return g.h(d,b),!1;if(e>a)return g.h(a,b),!1;g.h(e,b);return!0}e=((a-e)*(a-c)+(b-f)*(b-d))/((c-a)*(c-a)+(d-b)*(d-b));if(-5E-6>e)return g.h(a,b),!1;if(1.000005<e)return g.h(c,d),!1;g.h(a+e*(c-a),b+e*(d-b));return!0},Te:function(a,b,c,d,e,f,g,h,k){if(K.C(a,c)&&K.C(b,d))return k.h(a,b),!1;if(K.ca(e,
g))return K.ca(a,c)?(K.Vh(a,b,c,d,e,f,k),!1):K.Vh(a,b,c,d,e,(d-b)/(c-a)*(e-a)+b,k);h=(h-f)/(g-e);if(K.ca(a,c)){c=h*(a-e)+f;b<d?(e=b,b=d):e=d;if(c<e)return k.h(a,e),!1;if(c>b)return k.h(a,b),!1;k.h(a,c);return!0}g=(d-b)/(c-a);if(K.ca(h,g))return K.Vh(a,b,c,d,e,f,k),!1;e=(g*a-h*e+f-b)/(g-h);if(K.ca(g,0)){a<c?(d=a,a=c):d=c;if(e<d)return k.h(d,b),!1;if(e>a)return k.h(a,b),!1;k.h(e,b);return!0}return K.Vh(a,b,c,d,e,g*(e-a)+b,k)},mB:function(a,b,c,d,e){return K.Te(c.x,c.y,d.x,d.y,a.x,a.y,b.x,b.y,e)},lB: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.Te(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.Te(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.Te(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.Te(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},kB: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},Rt:function(a,b,c){return K.By(a.x,a.y,a.width,a.height,b.x,b.y,c.x,c.y)},By: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):rc(a,b,c,d,e,f)||rc(a,b,c,d,g,h)||K.Pq(a,b,k,b,e,f,g,h)||
K.Pq(k,b,k,l,e,f,g,h)||K.Pq(k,l,a,l,e,f,g,h)||K.Pq(a,l,a,b,e,f,g,h)?!0:!1},Pq:function(a,b,c,d,e,f,g,h){return 0>=K.Dt(a,b,c,d,e,f)*K.Dt(a,b,c,d,g,h)&&0>=K.Dt(e,f,g,h,a,b)*K.Dt(e,f,g,h,c,d)},Dt: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},Xq:function(a){0>a&&(a+=360);360<=a&&(a-=360);return a},gy: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.Bz(c,l,e,a,b)),d-=Math.abs(e-l),l=e;return f},Bz: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)]},Hq: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},sy: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},Gz: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.Hz(k,0===g?a:b,l,c,0,0)},Hz: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},le:new jb,en:new jb,Yh:new jb,Zh:0};K.za=K.eB;
function Fd(a){F&&1<arguments.length&&v("Geometry constructor can take at most one optional argument, the Geometry type.");fb(this);this.s=!1;void 0===a?a=Gd:F&&hb(a,Fd,Fd,"constructor:type");this.ta=a;this.sc=this.kc=this.$c=this.Zc=0;this.Gj=new H;this.cs=this.Gj.v;this.Kr=(new L).freeze();this.wa=!0;this.mn=this.Vk=null;this.nn=NaN;this.vf=Hc;this.wf=Sc;this.yl=this.zl=NaN;this.Zf=Hd}
Fd.prototype.copy=function(){var a=new Fd;a.ta=this.ta;a.Zc=this.Zc;a.$c=this.$c;a.kc=this.kc;a.sc=this.sc;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.cs=this.cs;a.Kr.assign(this.Kr);a.wa=this.wa;a.Vk=this.Vk;a.mn=this.mn;a.nn=this.nn;a.vf=this.vf.J();a.wf=this.wf.J();a.zl=this.zl;a.yl=this.yl;a.Zf=this.Zf;return a};t=Fd.prototype;t.ia=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.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.s=!1;var a=this.figures;a.ka();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].ka();return this};
t.Sa=function(a){if(!(a instanceof Fd))return!1;if(this.type!==a.type)return this.type===Id&&a.type===Gd?Jd(this,a):a.type===Id&&this.type===Gd?Jd(a,this):!1;if(this.type===Gd){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].Sa(a[d]))return!1;return!0}return K.C(this.startX,a.startX)&&K.C(this.startY,a.startY)&&K.C(this.endX,a.endX)&&K.C(this.endY,a.endY)};
function Jd(a,b){return a.type!==Id||b.type!==Gd?!1:1===b.figures.count&&(b=b.figures.O(0),1===b.segments.count&&K.C(a.startX,b.startX)&&K.C(a.startY,b.startY)&&(b=b.segments.O(0),b.type===Kd&&K.C(a.endX,b.endX)&&K.C(a.endY,b.endY)))?!0:!1}function Ld(a){return a.toString()}t.mb=function(a){a.classType===Fd?this.type=a:Ba(this,a)};
t.toString=function(a){void 0===a&&(a=-1);switch(this.type){case Id: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 Md:var b=new L(this.startX,this.startY,0,0);b.Sw(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 Ud:b=new L(this.startX,this.startY,0,0);b.Sw(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 Gd: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 Vd(a,b){function c(){return u>=D-1?!0:null!==k[u+1].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/)}function d(){u++;return k[u]}function e(){var a=new J(parseFloat(d()),parseFloat(d()));w===w.toLowerCase()&&(a.x=B.x+a.x,a.y=B.y+a.y);return a}function f(){return B=e()}function g(){return z=e()}function h(){var a=y.toLowerCase();return"c"!==a&&"s"!==a&&"q"!==a&&"t"!==a?B:new J(2*B.x-z.x,2*B.y-z.y)}void 0===b&&(b=!1);"string"!==typeof a&&xa(a,"string",Fd,"parse:str");a=a.replace(/,/gm," ");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,
"$1 $2");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,"$1 $2");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([^\s])/gm,"$1 $2");a=a.replace(/([^\s])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,"$1 $2");a=a.replace(/([0-9])([+\-])/gm,"$1 $2");a=a.replace(/([Aa](\s+[0-9]+){3})\s+([01])\s*([01])/gm,"$1 $3 $4 ");a=a.replace(/[\s\r\t\n]+/gm," ");a=a.replace(/^\s+|\s+$/g,"");var k=a.split(" ");for(a=0;a<k.length;a++){var l=k[a];if(null!==l.match(/(\.[0-9]*)(\.)/gm)){for(var m=
La(),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;Oa(m)}}var u=-1,w="",y="";m=new J(0,0);var z=new J(0,0),B=new J(0,0),D=k.length;a=Wd(null);n=l=!1;p=!0;for(r=null;!(u>=D-1);)if(y=w,w=d(),""!==w)switch(w.toUpperCase()){case "X":p=!0;n=l=!1;break;case "M":r=f();null===a.lc||!0===p?(Xd(a,r.x,r.y,l,!n),p=!1):a.moveTo(r.x,r.y);for(m=B;!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();)B=new J((w===w.toLowerCase()?B.x:0)+parseFloat(d()),B.y),a.lineTo(B.x,B.y);break;case "V":for(;!c();)B=new J(B.x,(w===w.toLowerCase()?B.y:0)+parseFloat(d())),a.lineTo(B.x,B.y);break;case "C":for(;!c();){r=e();q=g();var G=f();Yd(a,r.x,r.y,q.x,q.y,G.x,G.y)}break;case "S":for(;!c();)r=h(),q=g(),G=f(),Yd(a,r.x,r.y,q.x,q.y,G.x,G.y);break;case "Q":for(;!c();)r=g(),q=f(),Zd(a,r.x,r.y,q.x,q.y);break;case "T":for(;!c();)z=r=h(),q=f(),Zd(a,
r.x,r.y,q.x,q.y);break;case "B":for(;!c();){r=parseFloat(d());q=parseFloat(d());G=parseFloat(d());var O=parseFloat(d()),V=parseFloat(d()),P=V,ca=!1;c()||(P=parseFloat(d()),c()||(ca=0!==parseFloat(d())));w===w.toLowerCase()&&(G+=B.x,O+=B.y);a.arcTo(r,q,G,O,V,P,ca)}break;case "A":for(;!c();)r=Math.abs(parseFloat(d())),q=Math.abs(parseFloat(d())),G=parseFloat(d()),O=!!parseFloat(d()),V=!!parseFloat(d()),P=f(),de(a,r,q,G,O,V,P.x,P.y);break;case "Z":ee(a);B=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.lc.segments.length&&(a.lc.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.jr(!1)}m=a.Mt;fe=a;if(b)for(b=m.figures.iterator;b.next();)b.value.isFilled=!0;return m}
function ge(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.xa(d);f[0]=d.x;f[1]=d.y;d.x=f[2];d.y=f[3];b.xa(d);f[2]=d.x;f[3]=d.y;d.x=f[4];d.y=f[5];b.xa(d);f[4]=d.x;f[5]=d.y;d.x=f[6];d.y=f[7];b.xa(d);f[6]=d.x;f[7]=d.y}J.free(d)}t.hw=function(){if(this.wa||this.cs!==this.figures.v)return!0;for(var a=this.figures.j,b=a.length,c=0;c<b;c++)if(a[c].hw())return!0;return!1};
Fd.prototype.computeBounds=function(){this.wa=!1;this.mn=this.Vk=null;this.nn=NaN;this.cs=this.figures.v;for(var a=this.figures.j,b=a.length,c=0;c<b;c++){var d=a[c];d.wa=!1;var e=d.segments;d.ht=e.v;d=e.j;e=d.length;for(var f=0;f<e;f++){var g=d[f];g.wa=!1;g.Xe=null}}a=this.Kr;a.ka();isNaN(this.zl)||isNaN(this.yl)?a.h(0,0,0,0):a.h(0,0,this.zl,this.yl);he(this,a,!1);qc(a,0,0,0,0);a.freeze()};Fd.prototype.ey=function(){var a=new L;he(this,a,!0);return a};
function he(a,b,c){switch(a.type){case Id:case Md:case Ud:c?b.h(a.Zc,a.$c,0,0):qc(b,a.Zc,a.$c,0,0);qc(b,a.kc,a.sc,0,0);break;case Gd: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):qc(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 Kd:case ie:k=n.endX;l=n.endY;qc(b,k,l,0,0);break;case je:K.rm(k,l,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.5,b);k=n.endX;l=n.endY;
break;case ke:K.qw(k,l,n.point1X,n.point1Y,n.endX,n.endY,.5,b);k=n.endX;l=n.endY;break;case le:case me:var p=n.type===le?ne(n,f):oe(n,f,k,l),r=p.length;if(0===r){k=n.centerX;l=n.centerY;qc(b,k,l,0,0);break}n=null;for(var q=0;q<r;q++)n=p[q],K.rm(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:v("Unknown Segment type: "+n.type)}}}break;default:v("Unknown Geometry type: "+a.type)}}
Fd.prototype.normalize=function(){this.s&&va(this);var a=this.ey();this.offset(-a.x,-a.y);return new J(-a.x,-a.y)};Fd.prototype.offset=function(a,b){this.s&&va(this);F&&(C(a,Fd,"offset"),C(b,Fd,"offset"));this.transform(1,0,0,1,a,b);return this};Fd.prototype.scale=function(a,b){this.s&&va(this);F&&(C(a,Fd,"scale:x"),C(b,Fd,"scale:y"),0===a&&ya(a,"scale must be non-zero",Fd,"scale:x"),0===b&&ya(b,"scale must be non-zero",Fd,"scale:y"));this.transform(a,0,0,b,0,0);return this};
Fd.prototype.rotate=function(a,b,c){this.s&&va(this);void 0===b&&(b=0);void 0===c&&(c=0);F&&(C(a,Fd,"rotate:angle"),C(b,Fd,"rotate:x"),C(c,Fd,"rotate:y"));var d=Ib.alloc();d.reset();d.rotate(a,b,c);this.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);Ib.free(d);return this};t=Fd.prototype;
t.transform=function(a,b,c,d,e,f){switch(this.type){case Id:case Md:case Ud:var g=this.Zc;var h=this.$c;this.Zc=g*a+h*c+e;this.$c=g*b+h*d+f;g=this.kc;h=this.sc;this.kc=g*a+h*c+e;this.sc=g*b+h*d+f;break;case Gd: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 Kd:case ie:g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case je: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 ke: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 le: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 me: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:v("Unknown Segment type: "+
q.type)}}}}this.wa=!0;return this};
t.fa=function(a,b){void 0===b&&(b=0);var c=this.Zc,d=this.$c,e=this.kc,f=this.sc;switch(this.type){case Id:return K.Ub(c,d,e,f,b,a.x,a.y);case Md:var g=L.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.fa(a);L.free(g);return a;case Ud: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 Gd:return pe(this,a,b,!0,!1);default:return!1}};
function pe(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.fa(f,b,c))return!0;var w=u.segments;k=u.startX;l=u.startY;for(var y=k,z=l,B=w.j,D=0;D<=w.length;D++){var G=void 0;if(D!==w.length){G=B[D];var O=G.type;a=G.endX;n=G.endY}else O=Kd,a=y,n=z;switch(O){case ie:y=qe(f,b,g,b,k,l,y,z);if(isNaN(y))return!0;h+=y;y=a;z=n;break;case Kd:k=qe(f,b,g,b,k,l,a,n);if(isNaN(k))return!0;h+=k;break;case je:m=K.Aq(k,l,G.point1X,
G.point1Y,G.point2X,G.point2Y,a,n,g,b,f,b,.5);h+=m;break;case ke:m=K.Aq(k,l,(k+2*G.point1X)/3,(l+2*G.point1Y)/3,(2*G.point1X+a)/3,(2*G.point1Y+n)/3,a,n,g,b,f,b,.5);h+=m;break;case le:case me:O=G.type===le?ne(G,u):oe(G,u,k,l);var V=O.length;if(0===V){k=qe(f,b,g,b,k,l,G.centerX,G.centerY);if(isNaN(k))return!0;h+=k;break}G=null;for(var P=0;P<V;P++){G=O[P];if(0===P){m=qe(f,b,g,b,k,l,G[0],G[1]);if(isNaN(m))return!0;h+=m}m=K.Aq(G[0],G[1],G[2],G[3],G[4],G[5],G[6],G[7],g,b,f,b,.5);h+=m}null!==G&&(a=G[6],
n=G[7]);break;default:v("Unknown Segment type: "+G.type)}k=a;l=n}if(0!==h)return!0;h=0}else if(u.fa(f,b,e?c:c+2))return!0}return 0!==h}function qe(a,b,c,d,e,f,g,h){if(K.Ub(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 re(a,b,c,d){a=a.figures.j;for(var e=a.length,f=0;f<e;f++)if(a[f].fa(b,c,d))return!0;return!1}
t.Zv=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=new J);if(this.type===Id)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.ty=function(a){0>a?a=0:1<a&&(a=1);if(this.type===Id)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.$v=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=[]);b.length=3;if(this.type===Id)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.uy=function(a){if(this.type===Id){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.Vh(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===Md){g=this.startX;h=this.startY;var k=this.endX;
e=this.endY;if(g!==k||h!==e){b=k-g;c=e-h;f=2*b+2*c;d=a.x;a=a.y;d=Math.min(Math.max(d,g),k);a=Math.min(Math.max(a,h),e);g=Math.abs(d-g);k=Math.abs(d-k);h=Math.abs(a-h);e=Math.abs(a-e);var l=Math.min(g,k,h,e);if(l===h)return d/f;if(l===k)return(b+a)/f;if(l===e)return(2*b+c-d)/f;if(l===g)return(2*b+2*c-a)/f}}else{b=this.flattenedSegments;c=this.flattenedLengths;f=this.flattenedTotalLength;d=J.alloc();e=Infinity;h=g=0;k=b.length;for(var m=l=0,n=0;n<k;n++)for(var p=b[n],r=c[n],q=p.length,u=0;u<q;u+=2){var w=
p[u],y=p[u+1];if(0!==u){K.Vh(l,m,w,y,a.x,a.y,d);var z=(d.x-a.x)*(d.x-a.x)+(d.y-a.y)*(d.y-a.y);z<e&&(e=z,g=h,g+=Math.sqrt((d.x-l)*(d.x-l)+(d.y-m)*(d.y-m)));h+=r[(u-2)/2]}l=w;m=y}J.free(d);a=g/f;return 0>a?0:1<a?1:a}return 0};
function se(a){if(null===a.Vk){var b=a.Vk=[],c=a.mn=[],d=[],e=[];if(a.type===Id)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===Md)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===Ud){var f=new te;f.startX=a.endX;f.startY=(a.startY+a.endY)/2;var g=new ue(le);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=ne(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.Oe(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(ve(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 ie:4<=d.length&&(b.push(d),c.push(ve(d)));d=[];d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;h=g;k=f;break;case Kd:d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;break;case je:K.Oe(g,f,p.point1X,p.point1Y,p.point2X,p.point2Y,p.endX,p.endY,
.5,d);g=p.endX;f=p.endY;break;case ke:K.$q(g,f,p.point1X,p.point1Y,p.endX,p.endY,.5,d);g=p.endX;f=p.endY;break;case le:var r=ne(p,e),q=r.length;if(0===q){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(var u=0;u<q;u++){var w=r[u];K.Oe(g,f,w[2],w[3],w[4],w[5],w[6],w[7],.5,d);g=w[6];f=w[7]}break;case me:r=oe(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++)w=r[u],K.Oe(g,f,w[2],w[3],w[4],w[5],w[6],w[7],.5,d),g=w[6],
f=w[7];break;default:v("Segment not of valid type: "+p.type)}p.isClosed&&(d.push(h),d.push(k))}4<=d.length&&(b.push(d),c.push(ve(d)))}}}function ve(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&&(c=Math.sqrt(Lb(c,d,g,h)),b.push(c));c=g;d=h}return b}t.add=function(a){this.Gj.add(a);return this};t.bn=function(a,b,c,d,e,f,g,h){this.s&&va(this);this.vf=(new M(a,b,e,f)).freeze();this.wf=(new M(c,d,g,h)).freeze();return this};
ma.Object.defineProperties(Fd.prototype,{flattenedSegments:{configurable:!0,get:function(){se(this);return this.Vk}},flattenedLengths:{configurable:!0,get:function(){se(this);return this.mn}},flattenedTotalLength:{configurable:!0,get:function(){var a=this.nn;if(isNaN(a)){if(this.type===Id){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===Md)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.nn=a}return a}},type:{configurable:!0,get:function(){return this.ta},set:function(a){this.ta!==a&&(F&&hb(a,Fd,Fd,"type"),this.s&&va(this,a),this.ta=a,this.wa=!0)}},startX:{configurable:!0,get:function(){return this.Zc},set:function(a){this.Zc!==a&&(F&&C(a,Fd,"startX"),this.s&&va(this,a),this.Zc=a,this.wa=!0)}},startY:{configurable:!0,
get:function(){return this.$c},set:function(a){this.$c!==a&&(F&&C(a,Fd,"startY"),this.s&&va(this,a),this.$c=a,this.wa=!0)}},endX:{configurable:!0,get:function(){return this.kc},set:function(a){this.kc!==a&&(F&&C(a,Fd,"endX"),this.s&&va(this,a),this.kc=a,this.wa=!0)}},endY:{configurable:!0,get:function(){return this.sc},set:function(a){this.sc!==a&&(F&&C(a,Fd,"endY"),this.s&&va(this,a),this.sc=a,this.wa=!0)}},figures:{configurable:!0,get:function(){return this.Gj},
set:function(a){this.Gj!==a&&(F&&x(a,H,Fd,"figures"),this.s&&va(this,a),this.Gj=a,this.wa=!0)}},spot1:{configurable:!0,get:function(){return this.vf},set:function(a){F&&x(a,M,Fd,"spot1");this.s&&va(this,a);this.vf=a.J()}},spot2:{configurable:!0,get:function(){return this.wf},set:function(a){F&&x(a,M,Fd,"spot2");this.s&&va(this,a);this.wf=a.J()}},defaultStretch:{configurable:!0,get:function(){return this.Zf},set:function(a){F&&hb(a,N,Fd,"stretch");this.s&&
va(this,a);this.Zf=a}},bounds:{configurable:!0,get:function(){this.hw()&&this.computeBounds();return this.Kr}}});Fd.prototype.setSpots=Fd.prototype.bn;Fd.prototype.add=Fd.prototype.add;Fd.prototype.getFractionForPoint=Fd.prototype.uy;Fd.prototype.getPointAndAngleAlongPath=Fd.prototype.$v;Fd.prototype.getAngleAlongPath=Fd.prototype.ty;Fd.prototype.getPointAlongPath=Fd.prototype.Zv;Fd.prototype.containsPoint=Fd.prototype.fa;Fd.prototype.transform=Fd.prototype.transform;
Fd.prototype.rotate=Fd.prototype.rotate;Fd.prototype.scale=Fd.prototype.scale;Fd.prototype.offset=Fd.prototype.offset;Fd.prototype.normalize=Fd.prototype.normalize;Fd.prototype.computeBoundsWithoutOrigin=Fd.prototype.ey;Fd.prototype.equalsApprox=Fd.prototype.Sa;var Id=new E(Fd,"Line",0),Md=new E(Fd,"Rectangle",1),Ud=new E(Fd,"Ellipse",2),Gd=new E(Fd,"Path",3);Fd.className="Geometry";Fd.stringify=Ld;
Fd.fillPath=function(a){"string"!==typeof a&&xa(a,"string",Fd,"fillPath:str");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};Fd.parse=Vd;Fd.Line=Id;Fd.Rectangle=Md;Fd.Ellipse=Ud;Fd.Path=Gd;
function te(a,b,c,d){fb(this);this.s=!1;void 0===c&&(c=!0);this.ns=c;void 0===d&&(d=!0);this.ss=d;void 0!==a?(F&&C(a,te,"sx"),this.Zc=a):this.Zc=0;void 0!==b?(F&&C(b,te,"sy"),this.$c=b):this.$c=0;this.$l=new H;this.ht=this.$l.v;this.wa=!0}te.prototype.copy=function(){var a=new te;a.ns=this.ns;a.ss=this.ss;a.Zc=this.Zc;a.$c=this.$c;for(var b=this.$l.j,c=b.length,d=a.$l,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.ht=this.ht;a.wa=this.wa;return a};t=te.prototype;
t.Sa=function(a){if(!(a instanceof te&&K.C(this.startX,a.startX)&&K.C(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].Sa(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.ka=function(){this.s=!1;var a=this.segments;a.ka();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].ka();return this};t.hw=function(){if(this.wa)return!0;var a=this.segments;if(this.ht!==a.v)return!0;a=a.j;for(var b=a.length,c=0;c<b;c++)if(a[c].wa)return!0;return!1};t.add=function(a){this.$l.add(a);return this};
t.fa=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 ie:f=m.endX;g=m.endY;d=m.endX;e=m.endY;break;case Kd:if(K.Ub(d,e,m.endX,m.endY,c,a,b))return!0;d=m.endX;e=m.endY;break;case je:if(K.At(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 ke:if(K.rw(d,e,m.point1X,m.point1Y,m.endX,m.endY,.5,a,b,c))return!0;d=m.endX;e=m.endY;break;case le:case me:var n=m.type===
le?ne(m,this):oe(m,this,d,e),p=n.length;if(0===p){if(K.Ub(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.Ub(d,e,r[0],r[1],c,a,b)||K.At(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:v("Unknown Segment type: "+m.type)}if(m.isClosed&&(d!==f||e!==g)&&K.Ub(d,e,f,g,c,a,b))return!0}return!1};
ma.Object.defineProperties(te.prototype,{isFilled:{configurable:!0,get:function(){return this.ns},set:function(a){F&&A(a,"boolean",te,"isFilled");this.s&&va(this,a);this.ns=a}},isShadowed:{configurable:!0,get:function(){return this.ss},set:function(a){F&&A(a,"boolean",te,"isShadowed");this.s&&va(this,a);this.ss=a}},startX:{configurable:!0,get:function(){return this.Zc},set:function(a){F&&C(a,te,"startX");this.s&&va(this,a);this.Zc=a;this.wa=!0}},startY:{configurable:!0,
enumerable:!0,get:function(){return this.$c},set:function(a){F&&C(a,te,"startY");this.s&&va(this,a);this.$c=a;this.wa=!0}},segments:{configurable:!0,get:function(){return this.$l},set:function(a){F&&x(a,H,te,"segments");this.s&&va(this,a);this.$l=a;this.wa=!0}}});te.prototype.add=te.prototype.add;te.prototype.equalsApprox=te.prototype.Sa;te.className="PathFigure";
function ue(a,b,c,d,e,f,g,h){fb(this);this.s=!1;void 0===a?a=Kd:F&&hb(a,ue,ue,"constructor:type");this.ta=a;void 0!==b?(F&&C(b,ue,"ex"),this.kc=b):this.kc=0;void 0!==c?(F&&C(c,ue,"ey"),this.sc=c):this.sc=0;void 0===d&&(d=0);void 0===e&&(e=0);void 0===f&&(f=0);void 0===g&&(g=0);a===me?(a=f%360,0>a&&(a+=360),this.Ie=a,this.Si=0,F&&C(d,ue,"x1"),this.Ti=Math.max(d,0),F&&C(e,ue,"y1"),this.sh=Math.max(e,0),this.Hl="boolean"===typeof g?g:"number"===typeof g?!!g:!1,this.Zk=!!h):(F&&C(d,ue,"x1"),this.Ie=d,
F&&C(e,ue,"y1"),this.Si=e,F&&C(f,ue,"x2"),a===le&&(f=Math.max(f,0)),this.Ti=f,"number"===typeof g?(a===le&&(g=Math.max(g,0)),this.sh=g):this.sh=0,this.Zk=this.Hl=!1);this.Lj=!1;this.wa=!0;this.Xe=null}ue.prototype.copy=function(){var a=new ue;a.ta=this.ta;a.kc=this.kc;a.sc=this.sc;a.Ie=this.Ie;a.Si=this.Si;a.Ti=this.Ti;a.sh=this.sh;a.Hl=this.Hl;a.Zk=this.Zk;a.Lj=this.Lj;a.wa=this.wa;return a};t=ue.prototype;
t.Sa=function(a){if(!(a instanceof ue)||this.type!==a.type||this.isClosed!==a.isClosed)return!1;switch(this.type){case ie:case Kd:return K.C(this.endX,a.endX)&&K.C(this.endY,a.endY);case je:return K.C(this.endX,a.endX)&&K.C(this.endY,a.endY)&&K.C(this.point1X,a.point1X)&&K.C(this.point1Y,a.point1Y)&&K.C(this.point2X,a.point2X)&&K.C(this.point2Y,a.point2Y);case ke:return K.C(this.endX,a.endX)&&K.C(this.endY,a.endY)&&K.C(this.point1X,a.point1X)&&K.C(this.point1Y,a.point1Y);case le:return K.C(this.startAngle,
a.startAngle)&&K.C(this.sweepAngle,a.sweepAngle)&&K.C(this.centerX,a.centerX)&&K.C(this.centerY,a.centerY)&&K.C(this.radiusX,a.radiusX)&&K.C(this.radiusY,a.radiusY);case me:return this.isClockwiseArc===a.isClockwiseArc&&this.isLargeArc===a.isLargeArc&&K.C(this.xAxisRotation,a.xAxisRotation)&&K.C(this.endX,a.endX)&&K.C(this.endY,a.endY)&&K.C(this.radiusX,a.radiusX)&&K.C(this.radiusY,a.radiusY);default:return!1}};t.mb=function(a){a.classType===ue?this.type=a:Ba(this,a)};
t.toString=function(a){void 0===a&&(a=-1);switch(this.type){case ie:a=0>a?"M"+this.endX.toString()+" "+this.endY.toString():"M"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Kd:a=0>a?"L"+this.endX.toString()+" "+this.endY.toString():"L"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case je: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 ke: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 le: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 me: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.ka=function(){this.s=!1;return this};t.close=function(){this.Lj=!0;return this};
function ne(a,b){if(null!==a.Xe&&!1===b.wa)return a.Xe;var c=a.radiusX,d=a.radiusY;void 0===d&&(d=c);if(0===c||0===d)return a.Xe=[],a.Xe;b=a.Ie;var e=a.Si,f=K.gy(0,0,c<d?c:d,a.startAngle,a.startAngle+a.sweepAngle,!1);if(c!==d){var g=Ib.alloc();g.reset();c<d?g.scale(1,d/c):g.scale(c/d,1);ge(f,g);Ib.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.Xe=f;return a.Xe}
function oe(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.Xe&&!1===b.wa)return a.Xe;b=a.Ti;var f=a.sh;0===b&&(b=1E-4);0===f&&(f=1E-4);var g=Math.PI/180*a.Ie,h=a.Hl,k=a.Zk,l=a.kc,m=a.sc,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.gy(0,0,b>f?b:f,m,m+g,!0);f=Ib.alloc();f.reset();f.translate(c,d);f.rotate(a.Ie,0,0);f.scale(k,r);ge(b,f);Ib.free(f);a.Xe=b;return a.Xe}
ma.Object.defineProperties(ue.prototype,{isClosed:{configurable:!0,get:function(){return this.Lj},set:function(a){this.Lj!==a&&(this.Lj=a,this.wa=!0)}},type:{configurable:!0,get:function(){return this.ta},set:function(a){F&&hb(a,ue,ue,"type");this.s&&va(this,a);this.ta=a;this.wa=!0}},endX:{configurable:!0,get:function(){return this.kc},set:function(a){F&&C(a,ue,"endX");this.s&&va(this,a);this.kc=a;this.wa=!0}},endY:{configurable:!0,get:function(){return this.sc},
set:function(a){F&&C(a,ue,"endY");this.s&&va(this,a);this.sc=a;this.wa=!0}},point1X:{configurable:!0,get:function(){return this.Ie},set:function(a){F&&C(a,ue,"point1X");this.s&&va(this,a);this.Ie=a;this.wa=!0}},point1Y:{configurable:!0,get:function(){return this.Si},set:function(a){F&&C(a,ue,"point1Y");this.s&&va(this,a);this.Si=a;this.wa=!0}},point2X:{configurable:!0,get:function(){return this.Ti},set:function(a){F&&C(a,ue,"point2X");this.s&&va(this,a);this.Ti=
a;this.wa=!0}},point2Y:{configurable:!0,get:function(){return this.sh},set:function(a){F&&C(a,ue,"point2Y");this.s&&va(this,a);this.sh=a;this.wa=!0}},centerX:{configurable:!0,get:function(){return this.Ie},set:function(a){F&&C(a,ue,"centerX");this.s&&va(this,a);this.Ie=a;this.wa=!0}},centerY:{configurable:!0,get:function(){return this.Si},set:function(a){F&&C(a,ue,"centerY");this.s&&va(this,a);this.Si=a;this.wa=!0}},radiusX:{configurable:!0,
get:function(){return this.Ti},set:function(a){F&&C(a,ue,"radiusX");0>a&&ya(a,">= zero",ue,"radiusX");this.s&&va(this,a);this.Ti=a;this.wa=!0}},radiusY:{configurable:!0,get:function(){return this.sh},set:function(a){F&&C(a,ue,"radiusY");0>a&&ya(a,">= zero",ue,"radiusY");this.s&&va(this,a);this.sh=a;this.wa=!0}},startAngle:{configurable:!0,get:function(){return this.kc},set:function(a){this.kc!==a&&(this.s&&va(this,a),F&&C(a,ue,"startAngle"),a%=360,0>a&&(a+=360),this.kc=
a,this.wa=!0)}},sweepAngle:{configurable:!0,get:function(){return this.sc},set:function(a){F&&C(a,ue,"sweepAngle");this.s&&va(this,a);360<a&&(a=360);-360>a&&(a=-360);this.sc=a;this.wa=!0}},isClockwiseArc:{configurable:!0,get:function(){return this.Zk},set:function(a){this.s&&va(this,a);this.Zk=a;this.wa=!0}},isLargeArc:{configurable:!0,get:function(){return this.Hl},set:function(a){this.s&&va(this,a);this.Hl=a;this.wa=!0}},xAxisRotation:{configurable:!0,
get:function(){return this.Ie},set:function(a){F&&C(a,ue,"xAxisRotation");a%=360;0>a&&(a+=360);this.s&&va(this,a);this.Ie=a;this.wa=!0}}});ue.prototype.equalsApprox=ue.prototype.Sa;var ie=new E(ue,"Move",0),Kd=new E(ue,"Line",1),je=new E(ue,"Bezier",2),ke=new E(ue,"QuadraticBezier",3),le=new E(ue,"Arc",4),me=new E(ue,"SvgArc",4);ue.className="PathSegment";ue.Move=ie;ue.Line=Kd;ue.Bezier=je;ue.QuadraticBezier=ke;ue.Arc=le;ue.SvgArc=me;
function we(){this.B=null;this.zv=(new J(0,0)).freeze();this.Ju=(new J(0,0)).freeze();this.Cr=this.Fs=0;this.Dr=1;this.ws="";this.vt=this.Wr=!1;this.Tr=this.Fr=0;this.Vg=this.fs=this.qs=!1;this.bs=null;this.qt=0;this.jd=this.pt=null}we.prototype.copy=function(){var a=new we;return this.clone(a)};
we.prototype.clone=function(a){a.B=this.B;a.zv.assign(this.viewPoint);a.Ju.assign(this.documentPoint);a.Fs=this.Fs;a.Cr=this.Cr;a.Dr=this.Dr;a.ws=this.ws;a.Wr=this.Wr;a.vt=this.vt;a.Fr=this.Fr;a.Tr=this.Tr;a.qs=this.qs;a.fs=this.fs;a.Vg=this.Vg;a.bs=this.bs;a.qt=this.qt;a.pt=this.pt;a.jd=this.jd;return a};
we.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};we.prototype.Kq=function(a,b){var c=this.diagram;if(null===c)return b;Ee(c,this.event,a,b);return b};
we.prototype.iA=function(a,b){var c=this.diagram;if(null===c)return b;Ee(c,this.event,a,b);b.assign(c.pu(b));return b};
ma.Object.defineProperties(we.prototype,{diagram:{configurable:!0,get:function(){return this.B},set:function(a){this.B=a}},viewPoint:{configurable:!0,get:function(){return this.zv},set:function(a){x(a,J,we,"viewPoint");this.zv.assign(a)}},documentPoint:{configurable:!0,get:function(){return this.Ju},set:function(a){x(a,J,we,"documentPoint");this.Ju.assign(a)}},modifiers:{configurable:!0,get:function(){return this.Fs},set:function(a){this.Fs=
a}},button:{configurable:!0,get:function(){return this.Cr},set:function(a){this.Cr=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:{configurable:!0,get:function(){return this.Dr},set:function(a){this.Dr=a}},key:{configurable:!0,get:function(){return this.ws},set:function(a){this.ws=a}},down:{configurable:!0,get:function(){return this.Wr},set:function(a){this.Wr=a}},up:{configurable:!0,
enumerable:!0,get:function(){return this.vt},set:function(a){this.vt=a}},clickCount:{configurable:!0,get:function(){return this.Fr},set:function(a){this.Fr=a}},delta:{configurable:!0,get:function(){return this.Tr},set:function(a){this.Tr=a}},isMultiTouch:{configurable:!0,get:function(){return this.qs},set:function(a){this.qs=a}},handled:{configurable:!0,get:function(){return this.fs},set:function(a){this.fs=a}},bubbles:{configurable:!0,
get:function(){return this.Vg},set:function(a){this.Vg=a}},event:{configurable:!0,get:function(){return this.bs},set:function(a){this.bs=a}},isTouchEvent:{configurable:!0,get:function(){var a=qa.TouchEvent,b=this.event;return a&&b instanceof a?!0:(a=qa.PointerEvent)&&b instanceof a&&("touch"===b.pointerType||"pen"===b.pointerType)}},timestamp:{configurable:!0,get:function(){return this.qt},set:function(a){this.qt=a}},targetDiagram:{configurable:!0,
get:function(){return this.pt},set:function(a){this.pt=a}},targetObject:{configurable:!0,get:function(){return this.jd},set:function(a){this.jd=a}},control:{configurable:!0,get:function(){return 0!==(this.modifiers&1)},set:function(a){this.modifiers=a?this.modifiers|1:this.modifiers&-2}},shift:{configurable:!0,get:function(){return 0!==(this.modifiers&4)},set:function(a){this.modifiers=a?this.modifiers|4:this.modifiers&-5}},alt:{configurable:!0,
get:function(){return 0!==(this.modifiers&2)},set:function(a){this.modifiers=a?this.modifiers|2:this.modifiers&-3}},meta:{configurable:!0,get:function(){return 0!==(this.modifiers&8)},set:function(a){this.modifiers=a?this.modifiers|8:this.modifiers&-9}},left:{configurable:!0,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:{configurable:!0,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:{configurable:!0,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}}});we.prototype.getMultiTouchDocumentPoint=we.prototype.iA;we.prototype.getMultiTouchViewPoint=we.prototype.Kq;we.className="InputEvent";function Fe(){this.B=null;this.Wa="";this.Ps=this.ot=null}Fe.prototype.copy=function(){var a=new Fe;a.B=this.B;a.Wa=this.Wa;a.ot=this.ot;a.Ps=this.Ps;return a};
Fe.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(Fe.prototype,{diagram:{configurable:!0,get:function(){return this.B},set:function(a){this.B=a}},name:{configurable:!0,get:function(){return this.Wa},set:function(a){this.Wa=a}},subject:{configurable:!0,get:function(){return this.ot},set:function(a){this.ot=a}},parameter:{configurable:!0,get:function(){return this.Ps},set:function(a){this.Ps=a}}});Fe.className="DiagramEvent";
function Ge(){this.xn=He;this.nf=this.Es="";this.ip=this.jp=this.pp=this.qp=this.op=this.B=this.gc=null}Ge.prototype.clear=function(){this.ip=this.jp=this.pp=this.qp=this.op=this.B=this.gc=null};
Ge.prototype.copy=function(){var a=new Ge;a.xn=this.xn;a.Es=this.Es;a.nf=this.nf;a.gc=this.gc;a.B=this.B;a.op=this.op;var b=this.qp;a.qp=Fa(b)&&"function"===typeof b.J?b.J():b;b=this.pp;a.pp=Fa(b)&&"function"===typeof b.J?b.J():b;b=this.jp;a.jp=Fa(b)&&"function"===typeof b.J?b.J():b;b=this.ip;a.ip=Fa(b)&&"function"===typeof b.J?b.J():b;return a};Ge.prototype.mb=function(a){a.classType===Ge?this.change=a:Ba(this,a)};
Ge.prototype.toString=function(){var a="";a=this.change===Ie?a+"* ":this.change===He?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===Ie?null!==this.oldValue&&(a+=" "+this.oldValue):(null!==this.object&&(a+=Qa(this.object)),null!==this.oldValue&&(a+="  old: "+Qa(this.oldValue)),null!==
this.oldParam&&(a+=" "+this.oldParam),null!==this.newValue&&(a+="  new: "+Qa(this.newValue)),null!==this.newParam&&(a+=" "+this.newParam));return a};Ge.prototype.K=function(a){return a?this.oldValue:this.newValue};Ge.prototype.kA=function(a){return a?this.oldParam:this.newParam};Ge.prototype.canUndo=function(){return null!==this.model||null!==this.diagram?!0:!1};
Ge.prototype.undo=function(){this.canUndo()&&(null!==this.model?this.model.changeState(this,!0):null!==this.diagram&&this.diagram.changeState(this,!0))};Ge.prototype.canRedo=function(){return null!==this.model||null!==this.diagram?!0:!1};Ge.prototype.redo=function(){this.canRedo()&&(null!==this.model?this.model.changeState(this,!1):null!==this.diagram&&this.diagram.changeState(this,!1))};
ma.Object.defineProperties(Ge.prototype,{model:{configurable:!0,get:function(){return this.gc},set:function(a){this.gc=a}},diagram:{configurable:!0,get:function(){return this.B},set:function(a){this.B=a}},change:{configurable:!0,get:function(){return this.xn},set:function(a){F&&hb(a,Ge,Ge,"change");this.xn=a}},modelChange:{configurable:!0,get:function(){return this.Es},set:function(a){F&&A(a,"string",Ge,"modelChange");this.Es=a}},propertyName:{configurable:!0,
enumerable:!0,get:function(){return this.nf},set:function(a){F&&"string"!==typeof a&&A(a,"function",Ge,"propertyName");this.nf=a}},isTransactionFinished:{configurable:!0,get:function(){return this.xn===Ie&&("CommittedTransaction"===this.nf||"FinishedUndo"===this.nf||"FinishedRedo"===this.nf)}},object:{configurable:!0,get:function(){return this.op},set:function(a){this.op=a}},oldValue:{configurable:!0,get:function(){return this.qp},set:function(a){this.qp=
a}},oldParam:{configurable:!0,get:function(){return this.pp},set:function(a){this.pp=a}},newValue:{configurable:!0,get:function(){return this.jp},set:function(a){this.jp=a}},newParam:{configurable:!0,get:function(){return this.ip},set:function(a){this.ip=a}}});Ge.prototype.redo=Ge.prototype.redo;Ge.prototype.canRedo=Ge.prototype.canRedo;Ge.prototype.undo=Ge.prototype.undo;Ge.prototype.canUndo=Ge.prototype.canUndo;Ge.prototype.getParam=Ge.prototype.kA;
Ge.prototype.getValue=Ge.prototype.K;Ge.prototype.clear=Ge.prototype.clear;var Ie=new E(Ge,"Transaction",-1),He=new E(Ge,"Property",0),Je=new E(Ge,"Insert",1),Ke=new E(Ge,"Remove",2);Ge.className="ChangedEvent";Ge.Transaction=Ie;Ge.Property=He;Ge.Insert=Je;Ge.Remove=Ke;function Le(){this.w=(new H).freeze();this.Wa="";this.l=!1}
Le.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.O(c);null!==d&&(b+="\n  "+d.toString())}}return b};Le.prototype.clear=function(){var a=this.changes;a.ka();for(var b=a.count-1;0<=b;b--){var c=a.O(b);null!==c&&c.clear()}a.clear();a.freeze()};Le.prototype.canUndo=function(){return this.isComplete};
Le.prototype.undo=function(){if(this.canUndo())for(var a=this.changes.count-1;0<=a;a--){var b=this.changes.O(a);null!==b&&b.undo()}};Le.prototype.canRedo=function(){return this.isComplete};Le.prototype.redo=function(){if(this.canRedo())for(var a=this.changes.count,b=0;b<a;b++){var c=this.changes.O(b);null!==c&&c.redo()}};
ma.Object.defineProperties(Le.prototype,{changes:{configurable:!0,get:function(){return this.w}},name:{configurable:!0,get:function(){return this.Wa},set:function(a){this.Wa=a}},isComplete:{configurable:!0,get:function(){return this.l},set:function(a){this.l=a}}});Le.prototype.redo=Le.prototype.redo;Le.prototype.canRedo=Le.prototype.canRedo;Le.prototype.undo=Le.prototype.undo;Le.prototype.canUndo=Le.prototype.canUndo;Le.prototype.clear=Le.prototype.clear;
Le.className="Transaction";function Me(){this.hv=new I;this.gd=!1;this.L=(new H).freeze();this.Qd=-1;this.w=999;this.xe=!1;this.Qr=null;this.$i=0;this.l=!1;F&&(this.l=!0);this.Ee=(new H).freeze();this.Pl=new H;this.Qu=!0;this.Xu=this.os=this.av=this.$u=!1}
Me.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.O(d);b+="]";if(void 0!==a&&0<a)for(c=this.history.count,d=0;d<c;d++)b+="\n "+this.history.O(d).toString(a-1);return b};
Me.prototype.clear=function(){var a=this.history;a.ka();for(var b=a.count-1;0<=b;b--){var c=a.O(b);null!==c&&c.clear()}a.clear();this.Qd=-1;a.freeze();this.xe=!1;this.Qr=null;this.$i=0;this.Ee.ka();this.Ee.clear();this.Ee.freeze();this.Pl.clear();this.Xu=this.os=this.av=this.$u=!1};Me.prototype.copyProperties=function(a){this.isEnabled=a.isEnabled;this.maxHistoryLength=a.maxHistoryLength;this.checksTransactionLevel=a.checksTransactionLevel};t=Me.prototype;t.Wx=function(a){this.hv.add(a)};t.My=function(a){this.hv.remove(a)};
t.Ba=function(a){void 0===a&&(a="");null===a&&(a="");if(this.isUndoingRedoing)return!1;!0===this.Qu&&(this.Qu=!1,this.$i++,this.isInternalTransaction||this.Eb("StartingFirstTransaction",a,this.currentTransaction),0<this.$i&&this.$i--);this.isEnabled&&(this.Ee.ka(),this.Ee.add(a),this.Ee.freeze(),null===this.currentTransaction?this.Pl.add(0):this.Pl.add(this.currentTransaction.changes.count));this.$i++;var b=1===this.transactionLevel;b&&(this.isInternalTransaction||this.Eb("StartedTransaction",a,this.currentTransaction));
return b};t.ab=function(a){void 0===a&&(a="");return Ne(this,!0,a)};t.Nf=function(){return Ne(this,!1,"")};
function Ne(a,b,c){if(a.isUndoingRedoing)return!1;a.checksTransactionLevel&&1>a.transactionLevel&&Ca("Ending transaction without having started a transaction: "+c);var d=1===a.transactionLevel,e=a.currentTransaction;d&&b&&(a.isInternalTransaction||a.Eb("CommittingTransaction",c,e));var f=0;if(0<a.transactionLevel&&(a.$i--,a.isEnabled)){var g=a.Ee.count;0<g&&(""===c&&(c=a.Ee.O(0)),a.Ee.ka(),a.Ee.hb(g-1),a.Ee.freeze());g=a.Pl.count;0<g&&(f=a.Pl.O(g-1),a.Pl.hb(g-1))}if(d){if(b){a.os=!1;null===e&&""!==
c&&(e=a.currentTransaction);if(a.isEnabled&&null!==e){e.isComplete||(e.isComplete=!0,e.name=c);b=a.history;b.ka();for(d=b.count-1;d>a.historyIndex;d--)f=b.O(d),null!==f&&f.clear(),b.hb(d),a.os=!0;d=a.maxHistoryLength;0<=d&&(0===d?b.clear():b.count>=d&&(f=b.O(0),null!==f&&f.clear(),b.hb(0),a.Qd--));0===d||0!==b.count&&b.get(b.count-1)===e||(b.add(e),a.Qd++);b.freeze()}a.isInternalTransaction||a.Eb("CommittedTransaction",c,e)}else{a.xe=!0;try{a.isEnabled&&null!==e&&(e.isComplete=!0,e.undo())}finally{a.isInternalTransaction||
a.Eb("RolledBackTransaction",c,e),a.xe=!1}null!==e&&e.clear()}a.Qr=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.O(e),null!==b&&b.undo(),c.ka(),c.hb(e);c.freeze()}return!1}Me.prototype.canUndo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToUndo;return null!==a&&a.canUndo()?!0:!1};
Me.prototype.undo=function(){if(this.canUndo()){var a=this.transactionToUndo;try{this.xe=!0,this.Eb("StartingUndo","Undo",a),this.Qd--,a.undo()}catch(b){Ca("undo error: "+b.toString())}finally{this.Eb("FinishedUndo","Undo",a),this.xe=!1}}};Me.prototype.canRedo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToRedo;return null!==a&&a.canRedo()?!0:!1};
Me.prototype.redo=function(){if(this.canRedo()){var a=this.transactionToRedo;try{this.xe=!0,this.Eb("StartingRedo","Redo",a),this.Qd++,a.redo()}catch(b){Ca("redo error: "+b.toString())}finally{this.Eb("FinishedRedo","Redo",a),this.xe=!1}}};Me.prototype.Eb=function(a,b,c){void 0===c&&(c=null);var d=new Ge;d.change=Ie;d.propertyName=a;d.object=c;d.oldValue=b;for(a=this.models;a.next();)b=a.value,d.model=b,b.Bt(d)};
Me.prototype.cw=function(a){if(this.isEnabled&&!this.isUndoingRedoing&&!this.skipsEvent(a)){var b=this.currentTransaction;null===b&&(this.Qr=b=new Le);var c=a.copy();b=b.changes;b.ka();b.add(c);b.freeze();this.checksTransactionLevel&&0>=this.transactionLevel&&!this.Qu&&(a=a.diagram,null!==a&&!1===a.zk||Ca("Change not within a transaction: "+c.toString()))}};
Me.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(Me.prototype,{models:{configurable:!0,get:function(){return this.hv.iterator}},isEnabled:{configurable:!0,get:function(){return this.gd},set:function(a){this.gd=a}},transactionToUndo:{configurable:!0,get:function(){return 0<=this.historyIndex&&this.historyIndex<=this.history.count-1?this.history.O(this.historyIndex):null}},transactionToRedo:{configurable:!0,get:function(){return this.historyIndex<this.history.count-
1?this.history.O(this.historyIndex+1):null}},isUndoingRedoing:{configurable:!0,get:function(){return this.xe}},history:{configurable:!0,get:function(){return this.L}},maxHistoryLength:{configurable:!0,get:function(){return this.w},set:function(a){this.w=a}},historyIndex:{configurable:!0,get:function(){return this.Qd}},currentTransaction:{configurable:!0,get:function(){return this.Qr}},transactionLevel:{configurable:!0,
get:function(){return this.$i}},isInTransaction:{configurable:!0,get:function(){return 0<this.$i}},checksTransactionLevel:{configurable:!0,get:function(){return this.l},set:function(a){this.l=a}},nestedTransactionNames:{configurable:!0,get:function(){return this.Ee}},isPendingClear:{configurable:!0,get:function(){return this.$u},set:function(a){this.$u=a}},isPendingUnmodified:{configurable:!0,get:function(){return this.av},set:function(a){this.av=
a}},isInternalTransaction:{configurable:!0,get:function(){return this.Xu},set:function(a){this.Xu=a}},isJustDiscarded:{configurable:!0,get:function(){return this.os}}});Me.prototype.handleChanged=Me.prototype.cw;Me.prototype.redo=Me.prototype.redo;Me.prototype.undo=Me.prototype.undo;Me.prototype.canUndo=Me.prototype.canUndo;Me.prototype.rollbackTransaction=Me.prototype.Nf;Me.prototype.commitTransaction=Me.prototype.ab;Me.prototype.startTransaction=Me.prototype.Ba;
Me.prototype.removeModel=Me.prototype.My;Me.prototype.addModel=Me.prototype.Wx;Me.prototype.clear=Me.prototype.clear;Me.className="UndoManager";function Oe(){0<arguments.length&&za(Oe);fb(this);this.B=Pe;this.Wa="";this.gd=!0;this.qd=!1;this.ix=null;this.gz=new we;this.yt=-1}Oe.prototype.toString=function(){return""!==this.name?this.name+" Tool":Pa(this.constructor)};Oe.prototype.updateAdornments=function(){};Oe.prototype.canStart=function(){return this.isEnabled};Oe.prototype.doStart=function(){};
Oe.prototype.doActivate=function(){this.isActive=!0};Oe.prototype.doDeactivate=function(){this.isActive=!1};Oe.prototype.doStop=function(){};Oe.prototype.doCancel=function(){this.transactionResult=null;this.stopTool()};Oe.prototype.stopTool=function(){var a=this.diagram;a.currentTool===this&&(a.currentTool=null,a.currentCursor="")};Oe.prototype.doMouseDown=function(){!this.isActive&&this.canStart()&&this.doActivate()};Oe.prototype.doMouseMove=function(){};Oe.prototype.doMouseUp=function(){this.stopTool()};
Oe.prototype.doMouseWheel=function(){};Oe.prototype.canStartMultiTouch=function(){return!0};Oe.prototype.standardPinchZoomStart=function(){var a=this.diagram,b=a.lastInput,c=b.Kq(0,J.allocAt(NaN,NaN)),d=b.Kq(1,J.allocAt(NaN,NaN));if(c.o()&&d.o()&&(this.doCancel(),a.Dm("hasGestureZoom"))){a.Rl=a.scale;var e=d.x-c.x,f=d.y-c.y;a.tv=Math.sqrt(e*e+f*f);b.bubbles=!1}J.free(c);J.free(d)};
Oe.prototype.standardPinchZoomMove=function(){var a=this.diagram,b=a.lastInput,c=b.Kq(0,J.allocAt(NaN,NaN)),d=b.Kq(1,J.allocAt(NaN,NaN));if(c.o()&&d.o()&&(this.doCancel(),a.Dm("hasGestureZoom"))){var e=d.x-c.x,f=d.y-c.y;f=Math.sqrt(e*e+f*f)/a.tv;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.Rl;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)};
Oe.prototype.doKeyDown=function(){"Esc"===this.diagram.lastInput.key&&this.doCancel()};Oe.prototype.doKeyUp=function(){};Oe.prototype.Ba=function(a){void 0===a&&(a=this.name);this.transactionResult=null;return this.diagram.Ba(a)};Oe.prototype.Pg=function(){var a=this.diagram;return null===this.transactionResult?a.Nf():a.ab(this.transactionResult)};
Oe.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.lastInput,c=a.Am(b.documentPoint,!1);if(null!==c)if(db?b.meta:b.control){a.U("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!b.isSelected);a.U("ChangedSelection",a.selection)}else if(b.shift){if(!c.isSelected){a.U("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!0);a.U("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||(db?b.meta:b.control)||b.shift||a.clearSelection()}};Oe.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.$b(d.documentPoint,a,b);d.targetObject=a;Qe(a,d,c);return d.handled};
function Qe(a,b,c){b.handled=!1;if(null===a||a.Mg()){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.U(e,a)}else{switch(d){case 1:e="BackgroundSingleClicked";break;case 2:e="BackgroundDoubleClicked";break;case 3:e="BackgroundContextClicked"}0!==d&&c.U(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)}}}
Oe.prototype.standardMouseOver=function(){var a=this.diagram,b=a.lastInput;if(!0!==a.animationManager.wc){var c=a.skipsUndoManager;a.skipsUndoManager=!0;var d=a.viewportBounds.fa(b.documentPoint)?a.$b(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.Lg(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.Lg(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.Hb();a.skipsUndoManager=c}};Oe.prototype.doCurrentObjectChanged=function(){};
Oe.prototype.standardMouseWheel=function(){var a=this.diagram,b=a.lastInput,c=b.delta;if(0!==c&&a.documentBounds.o()){var d=a.commandHandler,e=a.toolManager.mouseWheelBehavior;if(null!==d&&(e===Re&&!b.shift||e===Se&&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===Re&&b.shift||e===Se&&!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($a||bb||cb)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.A(d)||(b.bubbles=!1)}}};Oe.prototype.standardWaitAfter=function(a,b){F&&A(a,"number",Oe,"standardWaitAfter:delay");void 0===b&&(b=this.diagram.lastInput);this.cancelWaitAfter();var c=this,d=b.clone(this.gz);this.yt=ta(function(){c.doWaitAfter(d)},a)};
Oe.prototype.cancelWaitAfter=function(){-1!==this.yt&&qa.clearTimeout(this.yt);this.yt=-1};Oe.prototype.doWaitAfter=function(){};Oe.prototype.findToolHandleAt=function(a,b){a=this.diagram.$b(a,function(a){for(;null!==a&&!(a.panel instanceof Te);)a=a.panel;return a});return null===a?null:a.part.category===b?a:null};
Oe.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(Oe.prototype,{diagram:{configurable:!0,get:function(){return this.B},set:function(a){a instanceof Q&&(this.B=a)}},name:{configurable:!0,get:function(){return this.Wa},set:function(a){A(a,"string",Oe,"name");this.Wa=a}},isEnabled:{configurable:!0,get:function(){return this.gd},set:function(a){A(a,"boolean",Oe,"isEnabled");this.gd=a}},isActive:{configurable:!0,get:function(){return this.qd},set:function(a){A(a,"boolean",
Oe,"isActive");this.qd=a}},transactionResult:{configurable:!0,get:function(){return this.ix},set:function(a){null!==a&&A(a,"string",Oe,"transactionResult");this.ix=a}}});Oe.prototype.stopTransaction=Oe.prototype.Pg;Oe.prototype.startTransaction=Oe.prototype.Ba;Oe.className="Tool";function Ua(){Oe.call(this);this.name="ToolManager";this.Qc=new H;this.Rc=new H;this.Qf=new H;this.W=this.Na=850;this.w=(new Hb(2,2)).ia();this.ib=5E3;this.Oa=Se;this.L=Ue;this.Pr=this.l=null;this.ek=-1}
la(Ua,Oe);Ua.prototype.initializeStandardTools=function(){};Ua.prototype.updateAdornments=function(a){var b=this.currentToolTip;if(b instanceof Te&&this.Pr===a){var c=b.adornedObject;(null!==a?c.part===a:null===c)?this.showToolTip(b,c):this.hideToolTip()}};
Ua.prototype.doMouseDown=function(){var a=this.diagram,b=a.lastInput;b.isTouchEvent&&this.gestureBehavior===Ze&&(b.bubbles=!1);if(b.isMultiTouch){this.cancelWaitAfter();if(this.gestureBehavior===$e){b.bubbles=!0;return}if(this.gestureBehavior===Ze)return;if(a.currentTool.canStartMultiTouch()){a.currentTool.standardPinchZoomStart();return}}var c=a.undoManager;F&&c.checksTransactionLevel&&0!==c.transactionLevel&&Ca("WARNING: In ToolManager.doMouseDown: UndoManager.transactionLevel is not zero");c=this.mouseDownTools.length;
for(var d=0;d<c;d++){var e=this.mouseDownTools.O(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===Se?this.mouseWheelBehavior=Re:this.mouseWheelBehavior===Re&&(this.mouseWheelBehavior=Se));this.doActivate();this.standardWaitAfter(this.holdDelay,b)};
Ua.prototype.doMouseMove=function(){var a=this.diagram,b=a.lastInput;if(b.isMultiTouch){if(this.gestureBehavior===$e){b.bubbles=!0;return}if(this.gestureBehavior===Ze)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.O(d);e.diagram=this.diagram;if(e.canStart()){a.doFocus();a.currentTool=e;a.currentTool===e&&(e.isActive||e.doActivate(),e.doMouseMove());return}}af(this,
a);a=b.event;null===a||"mousemove"!==a.type&&"pointermove"!==a.type&&a.cancelable||(b.bubbles=!0)};function af(a,b){a.standardMouseOver();a.isBeyondDragSize()&&a.standardWaitAfter(a.isActive?a.holdDelay:a.hoverDelay,b.lastInput)}Ua.prototype.doCurrentObjectChanged=function(a,b){a=this.currentToolTip;null===a||null!==b&&a instanceof Te&&(b===a||b.Lg(a))||this.hideToolTip()};
Ua.prototype.doWaitAfter=function(a){var b=this.diagram;b.ya&&(this.doMouseHover(),this.isActive||this.doToolTip(),a.isTouchEvent&&!b.lastInput.handled&&(a=a.copy(),a.button=2,a.buttons=2,b.lastInput=a,b.dk=!0,b.doMouseUp()))};
Ua.prototype.doMouseHover=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.$b(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)};
Ua.prototype.doToolTip=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.$b(b.documentPoint,null,null));b=b.targetObject;if(null!==b){if(a=this.currentToolTip,!(a instanceof Te)||b!==a&&!b.Lg(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()};
Ua.prototype.showToolTip=function(a,b){!F||a instanceof Te||a instanceof bf||v("showToolTip:tooltip must be an Adornment or HTMLInfo.");null!==b&&x(b,N,Ua,"showToolTip:obj");var c=this.diagram;a!==this.currentToolTip&&this.hideToolTip();if(a instanceof Te){a.layerName="Tool";a.selectable=!1;a.scale=1/c.scale;a.category="ToolTip";null!==a.placeholder&&(a.placeholder.scale=c.scale);var d=a.diagram;null!==d&&d!==c&&d.remove(a);c.add(a);null!==b?a.adornedObject=b:a.data=c.model;a.Fb();this.positionToolTip(a,
b)}else a instanceof bf&&a!==this.currentToolTip&&a.show(b,c,this);this.currentToolTip=a;-1!==this.ek&&(qa.clearTimeout(this.ek),this.ek=-1);a=this.toolTipDuration;if(0<a&&Infinity!==a){var e=this;this.ek=ta(function(){e.hideToolTip()},a)}};
Ua.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}};
Ua.prototype.hideToolTip=function(){-1!==this.ek&&(qa.clearTimeout(this.ek),this.ek=-1);var a=this.diagram,b=this.currentToolTip;null!==b&&(b instanceof Te?(a.remove(b),null!==this.Pr&&this.Pr.Mf(b.category),b.data=null,b.adornedObject=null):b instanceof bf&&null!==b.hide&&b.hide(a,this),this.currentToolTip=null)};
Ua.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.O(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()};Ua.prototype.doMouseWheel=function(){this.standardMouseWheel()};Ua.prototype.doKeyDown=function(){var a=this.diagram;null!==a.commandHandler&&a.commandHandler.doKeyDown()};
Ua.prototype.doKeyUp=function(){var a=this.diagram;null!==a.commandHandler&&a.commandHandler.doKeyUp()};Ua.prototype.findTool=function(a){A(a,"string",Ua,"findTool:name");for(var b=this.mouseDownTools.length,c=0;c<b;c++){var d=this.mouseDownTools.O(c);if(d.name===a)return d}b=this.mouseMoveTools.length;for(c=0;c<b;c++)if(d=this.mouseMoveTools.O(c),d.name===a)return d;b=this.mouseUpTools.length;for(c=0;c<b;c++)if(d=this.mouseUpTools.O(c),d.name===a)return d;return null};
Ua.prototype.replaceTool=function(a,b){A(a,"string",Ua,"replaceTool:name");null!==b&&(x(b,Oe,Ua,"replaceTool:newtool"),b.diagram=this.diagram);for(var c=this.mouseDownTools.length,d=0;d<c;d++){var e=this.mouseDownTools.O(d);if(e.name===a)return null!==b?this.mouseDownTools.od(d,b):this.mouseDownTools.hb(d),e}c=this.mouseMoveTools.length;for(d=0;d<c;d++)if(e=this.mouseMoveTools.O(d),e.name===a)return null!==b?this.mouseMoveTools.od(d,b):this.mouseMoveTools.hb(d),e;c=this.mouseUpTools.length;for(d=
0;d<c;d++)if(e=this.mouseUpTools.O(d),e.name===a)return null!==b?this.mouseUpTools.od(d,b):this.mouseUpTools.hb(d),e;return null};Ua.prototype.cb=function(a,b,c){A(a,"string",Ua,"replaceStandardTool:name");x(c,H,Ua,"replaceStandardTool:list");null!==b&&(x(b,Oe,Ua,"replaceStandardTool:newtool"),b.name=a,b.diagram=this.diagram);this.findTool(a)?this.replaceTool(a,b):null!==b&&c.add(b)};
ma.Object.defineProperties(Ua.prototype,{mouseWheelBehavior:{configurable:!0,get:function(){return this.Oa},set:function(a){hb(a,Ua,Ua,"mouseWheelBehavior");this.Oa=a}},gestureBehavior:{configurable:!0,get:function(){return this.L},set:function(a){hb(a,Ua,Ua,"gestureBehavior");this.L=a}},currentToolTip:{configurable:!0,get:function(){return this.l},set:function(a){!F||null===a||a instanceof Te||a instanceof bf||v("ToolManager.currentToolTip must be an Adornment or HTMLInfo.");
this.l=a;this.Pr=null!==a&&a instanceof Te?a.adornedPart:null}},mouseDownTools:{configurable:!0,get:function(){return this.Qc}},mouseMoveTools:{configurable:!0,get:function(){return this.Rc}},mouseUpTools:{configurable:!0,get:function(){return this.Qf}},hoverDelay:{configurable:!0,get:function(){return this.Na},set:function(a){A(a,"number",Ua,"hoverDelay");this.Na=a}},holdDelay:{configurable:!0,get:function(){return this.W},set:function(a){A(a,
"number",Ua,"holdDelay");this.W=a}},dragSize:{configurable:!0,get:function(){return this.w},set:function(a){x(a,Hb,Ua,"dragSize");this.w=a.J()}},toolTipDuration:{configurable:!0,get:function(){return this.ib},set:function(a){A(a,"number",Ua,"toolTipDuration");this.ib=a}}});Ua.prototype.replaceStandardTool=Ua.prototype.cb;
var Se=new E(Ua,"WheelScroll",0),Re=new E(Ua,"WheelZoom",1),cf=new E(Ua,"WheelNone",2),Ue=new E(Ua,"GestureZoom",3),Ze=new E(Ua,"GestureCancel",4),$e=new E(Ua,"GestureNone",5);Ua.className="ToolManager";Ua.WheelScroll=Se;Ua.WheelZoom=Re;Ua.WheelNone=cf;Ua.GestureZoom=Ue;Ua.GestureCancel=Ze;Ua.GestureNone=$e;
function df(){Oe.call(this);0<arguments.length&&za(df);this.name="Dragging";this.L=this.Rc=!0;this.w=this.ib=this.Na=this.xg=null;this.Un=this.Qf=!1;this.fm=new J(NaN,NaN);this.mt=new J;this.Qc=!0;this.jl=100;this.bh=[];this.rr=(new I).freeze();this.Oa=new ef;this.Eo=null;this.W="copy";this.$h="";this.ai="no-drop"}la(df,Oe);
df.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.jl)?!1:null!==this.findDraggablePart()};
df.prototype.findDraggablePart=function(){var a=this.diagram;a=a.Am(a.firstInput.documentPoint,!1);if(null===a)return null;for(;null!==a&&!a.canSelect();)a=a.containingGroup;return null!==a&&(a.canMove()||a.canCopy())?a:null};
df.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.Am(a.firstInput.documentPoint,!1);if(null!==b){for(;null!==b&&!b.canSelect();)b=b.containingGroup;this.currentPart=b;null===this.currentPart||this.currentPart.isSelected||(a.U("ChangingSelection",a.selection),b=a.lastInput,(db?b.meta:b.control)||b.shift||a.clearSelection(!0),this.currentPart.isSelected=!0,a.U("ChangedSelection",a.selection))}}};
df.prototype.doActivate=function(){var a=this.diagram;this.Eo=null;null===this.currentPart&&this.standardMouseSelect();var b=this.currentPart;null!==b&&(b.canMove()||b.canCopy())&&(ff=null,this.isActive=!0,this.fm.set(a.position),gf(this,a.selection),this.bh.length=0,this.draggedParts=this.computeEffectiveCollection(a.selection,this.dragOptions),a.ou=!0,!0===a.Re("temporaryPixelRatio")&&30<a.Zx&&hf(a),jf(a,this.draggedParts),this.Ba("Drag"),this.startPoint=a.firstInput.documentPoint,a.isMouseCaptured=
!0,a.allowDragOut&&(this.isDragOutStarted=!0,this.Un=!1,ff=this,kf=this.diagram,this.doSimulatedDragOut()))};function gf(a,b){if(a.dragsLink){var c=a.diagram;c.allowRelink&&(c.model.yk()&&1===b.count&&b.first()instanceof R?(a.draggedLink=b.first(),a.draggedLink.canRelinkFrom()&&a.draggedLink.canRelinkTo()&&a.draggedLink.lk(),a.xg=c.toolManager.findTool("Relinking"),null===a.xg&&(a.xg=new lf,a.xg.diagram=c)):(a.draggedLink=null,a.xg=null))}}
df.prototype.computeEffectiveCollection=function(a,b){return this.diagram.commandHandler.computeEffectiveCollection(a,b)};df.prototype.zd=function(a){return void 0===a?new mf(Rb):this.isGridSnapEnabled?new mf(new J(Math.round(a.x),Math.round(a.y))):new mf(a.copy())};
df.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.Of();nf(this);sf(a,this.draggedParts);this.draggedParts=this.currentPart=this.Eo=null;this.Un=this.isDragOutStarted=!1;if(0<tf.count){for(var b=tf,c=b.length,d=0;d<c;d++){var e=b.O(d);uf(e);vf(e);nf(e);e.diagram.Of()}b.clear()}uf(this);this.fm.h(NaN,NaN);ff=kf=null;vf(this);a.isMouseCaptured=!1;a.currentCursor="";a.ou=!1;this.Pg();wf(a,!0)};
function nf(a){var b=a.diagram,c=b.skipsUndoManager;b.skipsUndoManager=!0;xf(a,b.lastInput,null);b.skipsUndoManager=c;a.bh.length=0}function yf(){var a=ff;vf(a);zf(a);var b=a.diagram;a.fm.o()&&(b.position=a.fm);b.Of()}df.prototype.doCancel=function(){vf(this);zf(this);var a=this.diagram;this.fm.o()&&(a.position=this.fm);this.stopTool()};df.prototype.doKeyDown=function(){this.isActive&&("Esc"===this.diagram.lastInput.key?this.doCancel():this.doMouseMove())};
df.prototype.doKeyUp=function(){this.isActive&&this.doMouseMove()};function Af(a,b){var c=Infinity,d=Infinity,e=-Infinity,f=-Infinity;for(a=a.iterator;a.next();){var g=a.value;if(g.bc()&&g.isVisible()){var h=g.location;g=h.x;h=h.y;isNaN(g)||isNaN(h)||(g<c&&(c=g),h<d&&(d=h),g>e&&(e=g),h>f&&(f=h))}}Infinity===c?b.h(0,0,0,0):b.h(c,d,e-c,f-d)}
function Bf(a,b){if(null===a.copiedParts){var c=a.diagram;if((!b||!c.isReadOnly&&!c.isModelReadOnly)&&null!==a.draggedParts){var d=c.undoManager;d.isEnabled&&d.isInTransaction?null!==d.currentTransaction&&0<d.currentTransaction.changes.count&&(c.undoManager.Nf(),c.Ba("Drag")):zf(a);c.skipsUndoManager=!b;c.partManager.addsToTemporaryLayer=!b;a.startPoint=c.firstInput.documentPoint;b=a.copiesEffectiveCollection?a.draggedParts.Pf():c.selection;c=c.rk(b,c,!0);for(b=c.iterator;b.next();)b.value.location=
b.key.location;b=L.alloc();Af(c,b);L.free(b);b=new Db;for(d=a.draggedParts.iterator;d.next();){var e=d.key;e.bc()&&e.canCopy()&&(e=c.K(e),null!==e&&(e.Fb(),b.add(e,a.zd(e.location))))}for(c=c.iterator;c.next();)d=c.value,d instanceof R&&d.canCopy()&&b.add(d,a.zd());a.copiedParts=b;gf(a,b.Pf());null!==a.draggedLink&&(c=a.draggedLink,b=c.routeBounds,Cf(c,a.startPoint.x-(b.x+b.width/2),a.startPoint.y-(b.y+b.height/2)))}}}
function vf(a){var b=a.diagram;if(null!==a.copiedParts&&(b.iu(a.copiedParts.Pf(),!1),a.copiedParts=null,null!==a.draggedParts))for(var c=a.draggedParts.iterator;c.next();)c.key instanceof R&&(c.value.point=new J(0,0));b.skipsUndoManager=!1;b.partManager.addsToTemporaryLayer=!1;a.startPoint=b.firstInput.documentPoint}
function uf(a){if(null!==a.draggedLink){if(a.dragsLink&&null!==a.xg){var b=a.xg;b.diagram.remove(b.temporaryFromNode);b.diagram.remove(b.temporaryToNode)}a.draggedLink=null;a.xg=null}}function Df(a,b,c){var d=a.diagram,e=a.startPoint,f=J.alloc();f.assign(d.lastInput.documentPoint);a.moveParts(b,f.je(e),c);J.free(f);!0===d.Re("temporaryPixelRatio")&&null===d.Ch&&30<d.Zx&&(hf(d),d.gu())}df.prototype.moveParts=function(a,b,c){var d=this.diagram;null!==d&&Ef(d,a,b,this.dragOptions,c)};
function zf(a){if(null!==a.draggedParts){for(var b=a.diagram,c=a.draggedParts.iterator;c.next();){var d=c.key;d.bc()&&(d.location=c.value.point)}for(c=a.draggedParts.iterator;c.next();)if(d=c.key,d instanceof R&&d.suspendsRouting){var e=c.value.point;a.draggedParts.add(d,a.zd());Cf(d,-e.x,-e.y)}b.cd()}}
function Ff(a,b){var c=a.diagram;a.dragsLink&&(null!==a.draggedLink&&(a.draggedLink.fromNode=null,a.draggedLink.toNode=null),Gf(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=xf(a,e,d);if(!a.isActive&&null===ff)return;var h=null!==d?d.part:null;if(null===h||c.handlesDragDropForTopLevelParts&&h.isTopLevel&&!(h instanceof Hf)){var k=c.mouseDragOver;null!==k&&(k(e),g=!0)}if(!a.isActive&&null===ff)return;
a.doDragOver(b,d);if(!a.isActive&&null===ff)return}finally{c.skipsUndoManager=f,g&&c.cd()}a.Eo=d;c.isReadOnly||!c.allowMove&&!c.allowCopy||!c.allowHorizontalScroll&&!c.allowVerticalScroll||c.Gt(e.viewPoint)}df.prototype.findDragOverObject=function(a){var b=this;return If(this.diagram,a,null,function(a){null===a?a=!0:(a=a.part,a=null===a||a instanceof Te||a.layer.isTemporary||b.draggedParts&&b.draggedParts.contains(a)||b.copiedParts&&b.copiedParts.contains(a)?!0:!1);return!a})};
df.prototype.doUpdateCursor=function(a){var b=this.diagram;this.Eo!==a&&(!this.diagram.currentTool.isActive||this.mayCopy()?b.currentCursor=this.copyCursor:this.mayMove()?b.currentCursor=this.moveCursor:this.mayDragOut()&&(b.currentCursor=this.nodropCursor))};
function xf(a,b,c){var d=!1,e=a.bh.length,f=0<e?a.bh[0]:null;if(c===f)return!1;b.handled=!1;for(var g=0;g<e;g++){var h=a.bh[g],k=h.mouseDragLeave;if(null!==k&&(k(b,h,c),d=!0,b.handled))break}a.bh.length=0;if(!a.isActive&&null===ff||null===c)return d;b.handled=!1;for(e=c;null!==e;)a.bh.push(e),e=Jf(e);e=a.bh.length;for(c=0;c<e&&(g=a.bh[c],h=g.mouseDragEnter,null===h||(h(b,g,f),d=!0,!b.handled));c++);return d}
function Jf(a){var b=a.panel;return null!==b?b:a instanceof S&&!(a instanceof Hf)&&(a=a.containingGroup,null!==a&&a.handlesDragDropForMembers)?a:null}function Kf(a,b,c){var d=a.xg;if(null===d)return null;var e=a.diagram.Jg(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.ma(Mc,a);k=b.Qe(k);k<f&&(g=h,f=k)}}J.free(a);return g}
function Gf(a,b){var c=a.draggedLink;if(null!==c&&!(2>c.pointsCount)){var d=a.diagram;if(!d.isReadOnly){var e=a.xg;if(null!==e){var f=null,g=null;null===c.fromNode&&(f=Kf(a,c.i(0),!1),null!==f&&(g=f.part));var h=null,k=null;null===c.toNode&&(h=Kf(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.U("LinkRelinked",c,d.Hy),c.toPort!==d.Iy&&d.U("LinkRelinked",c,d.Iy)):Lf(e,g,f,k,h):Lf(e,null,null,null,null)}}}}df.prototype.doDragOver=function(){};
function Mf(a,b){var c=a.diagram;a.dragsLink&&Gf(a,!0);nf(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;Sf(a,e,f);f=Jf(f)}}else f=c.mouseDrop,null!==f&&f(e);if(a.isActive||null!==ff){for(e=(a.copiedParts||a.draggedParts).iterator;e.next();)f=e.key,f instanceof T&&f.linksConnected.each(function(a){a.suspendsRouting=!1});a.doDropOnto(b,d);if(a.isActive||null!==ff){a=L.alloc();for(b=
c.selection.iterator;b.next();)d=b.value,d instanceof T&&Tf(c,d,a);L.free(a)}}}function Sf(a,b,c){a=a.diagram;c=c.part;!a.handlesDragDropForTopLevelParts||!c.isTopLevel||c instanceof Hf||(c=a.mouseDrop,null!==c&&c(b))}function Tf(a,b,c){var d=!1;b.getAvoidableRect(c);a.viewportBounds.Pe(c)&&(d=!0);a=a.Xv(c,function(a){return a.part},function(a){return a instanceof R},!0,function(a){return a instanceof R},d);if(0!==a.count)for(a=a.iterator;a.next();)c=a.value,!c.Ed(b)&&c.isAvoiding&&c.Ya()}
df.prototype.doDropOnto=function(){};df.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram,b=a.lastInput;this.simulatedMouseMove(b.event,b.documentPoint,b.targetDiagram)||null===this.currentPart||null===this.draggedParts||(this.mayCopy()?(Bf(this,!1),jf(a,this.copiedParts),Df(this,this.copiedParts,!1),sf(a,this.copiedParts)):this.mayMove()?(vf(this),Df(this,this.draggedParts,!0)):this.mayDragOut()?(Bf(this,!1),Df(this,this.copiedParts,!1)):vf(this),Ff(this,a.lastInput.documentPoint))}};
df.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?(vf(this),Bf(this,!0),jf(a,this.copiedParts),Df(this,this.copiedParts,!1),sf(a,this.copiedParts),null!==this.copiedParts&&(a.U("ChangingSelection",a.selection),a.clearSelection(!0),this.copiedParts.iteratorKeys.each(function(a){a.isSelected=!0}))):(b=!0,vf(this),this.mayMove()&&(Df(this,this.draggedParts,
!0),Ff(this,a.lastInput.documentPoint)));this.Un=!0;Mf(this,a.lastInput.documentPoint);if(this.isActive){var d=c?this.copiedParts.Pf():this.draggedParts.Pf();this.copiedParts=null;b&&Uf(this);a.Ta();sf(a,this.draggedParts);this.transactionResult=c?"Copy":"Move";a.U(c?"SelectionCopied":"SelectionMoved",d)}this.stopTool();c&&a.U("ChangedSelection",a.selection)}}};
df.prototype.simulatedMouseMove=function(a,b,c){if(null===ff)return!1;var d=ff.diagram;c instanceof Q||(c=null);var e=kf;c!==e&&(null!==e&&e!==d&&(e.Of(),ff.isDragOutStarted=!1,e=e.toolManager.findTool("Dragging"),null!==e&&e.doSimulatedDragLeave()),kf=c,null!==c&&c!==d&&(yf(),e=c.toolManager.findTool("Dragging"),null!==e&&(tf.contains(e)||tf.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.lr(b),c.lastInput.down=!1,c.lastInput.up=!1,d.doSimulatedDragOver());return!0};
df.prototype.simulatedMouseUp=function(a,b,c){if(null===ff)return!1;var d=kf,e=ff.diagram;if(null===c)return ff.doCancel(),!0;if(c!==d){var f=d.toolManager.findTool("Dragging");if(null!==d&&d!==e&&null!==f)return d.Of(),ff.isDragOutStarted=!1,f.doSimulatedDragLeave(),!1;kf=c;d=c.toolManager.findTool("Dragging");null!==d&&(yf(),tf.contains(d)||tf.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.lr(b),c.lastInput.down=!1,c.lastInput.up=!0,a=c.toolManager.findTool("Dragging"),null!==a&&a.doSimulatedDrop(),a=ff,null!==a&&(c=a.mayCopy(),a.transactionResult=c?"Copy":"Move",a.stopTool()),!0):!1};
function Uf(a){if(null!==a.draggedParts)for(var b=a.draggedParts.iterator;b.next();){var c=b.key;c instanceof T&&(c=c.containingGroup,null===c||null===c.placeholder||a.draggedParts.contains(c)||c.placeholder.u())}}
df.prototype.mayCopy=function(){if(!this.isCopyEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowCopy||(db?!a.lastInput.alt:!a.lastInput.control))return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.bc()&&b.canCopy())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1};
df.prototype.mayDragOut=function(){if(!this.isCopyEnabled)return!1;var a=this.diagram;if(!a.allowDragOut||!a.allowCopy||a.allowMove)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.bc()&&b.canCopy())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1};
df.prototype.mayMove=function(){var a=this.diagram;if(a.isReadOnly||!a.allowMove)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.bc()&&b.canMove())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canMove()?!0:!1};df.prototype.computeBorder=function(a,b,c){return this.Un||null===this.draggedParts||this.draggedParts.contains(a)?null:c.assign(b)};df.prototype.hA=function(){return ff};
df.prototype.mayDragIn=function(){var a=this.diagram;if(!a.allowDrop||a.isReadOnly||a.isModelReadOnly||!a.allowInsert)return!1;var b=ff;return null===b||b.diagram.model.dataFormat!==a.model.dataFormat?!1:!0};df.prototype.doSimulatedDragEnter=function(){if(this.mayDragIn()){var a=this.diagram;a.animationManager.dd();Vf(a);a.animationManager.dd();var b=ff;null!==b&&(b.diagram.ou=!1);this.doUpdateCursor(a.grid)}};
df.prototype.doSimulatedDragLeave=function(){var a=ff;null!==a&&a.doSimulatedDragOut();this.doCancel()};df.prototype.doSimulatedDragOver=function(){var a=this.diagram;a.animationManager.vn=!0;var b=ff;if(null!==b&&null!==b.draggedParts){if(!this.mayDragIn())return;Wf(this,b.draggedParts.Pf(),!1,a.firstInput);Df(this,this.copiedParts,!1);Ff(this,a.lastInput.documentPoint)}a.animationManager.vn=!1};
df.prototype.doSimulatedDrop=function(){var a=this.diagram,b=ff;if(null!==b){var c=b.diagram;b.Un=!0;vf(this);if(!this.mayDragIn())return;a.animationManager.vn=!0;a.U("ChangingSelection",a.selection);this.Ba("Drop");Wf(this,b.draggedParts.Pf(),!0,a.lastInput);Df(this,this.copiedParts,!1);null!==this.copiedParts&&(a.clearSelection(!0),this.copiedParts.iteratorKeys.each(function(a){a.isSelected=!0}));Mf(this,a.lastInput.documentPoint);a.Ta();b=a.selection;null!==this.copiedParts?this.transactionResult=
"ExternalCopy":b=new I;this.copiedParts=null;a.doFocus();a.U("ExternalObjectsDropped",b,c);this.Pg();a.U("ChangedSelection",a.selection)}a.animationManager.vn=!1};
function Wf(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.rk(b,e,!0);var f=L.alloc();Af(b,f);d=f.x+f.width/2;e=f.y+f.height/2;L.free(f);f=a.mt;var g=new Db,h=J.alloc();for(b=b.iterator;b.next();){var k=b.value,l=c.K(k);k.bc()&&k.canCopy()?(k=k.location,h.h(f.x-(d-k.x),f.y-(e-k.y)),l.location=h,l.Fb(),g.add(l,a.zd(h))):l instanceof R&&k.canCopy()&&(Cf(l,f.x-d,f.y-e),
g.add(l,a.zd()))}J.free(h);a.copiedParts=g;gf(a,g.Pf());null!==a.draggedLink&&(c=a.draggedLink,d=c.routeBounds,Cf(c,a.startPoint.x-(d.x+d.width/2),a.startPoint.y-(d.y+d.height/2)))}}}df.prototype.doSimulatedDragOut=function(){var a=this.diagram;a.ou=!1;this.mayCopy()||this.mayMove()?a.currentCursor="":a.currentCursor=this.nodropCursor;this.Eo=null};df.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(df.prototype,{isCopyEnabled:{configurable:!0,get:function(){return this.Rc},set:function(a){A(a,"boolean",df,"isCopyEnabled");this.Rc=a}},copiesEffectiveCollection:{configurable:!0,get:function(){return this.L},set:function(a){A(a,"boolean",df,"copiesEffectiveCollection");this.L=a}},dragOptions:{configurable:!0,get:function(){return this.Oa},set:function(a){x(a,ef,df,"dragOptions");this.Oa=a}},isGridSnapEnabled:{configurable:!0,
enumerable:!0,get:function(){return this.dragOptions.isGridSnapEnabled},set:function(a){A(a,"boolean",df,"isGridSnapEnabled");this.dragOptions.isGridSnapEnabled=a}},isComplexRoutingRealtime:{configurable:!0,get:function(){return this.Qc},set:function(a){A(a,"boolean",df,"isComplexRoutingRealtime");this.Qc=a}},isGridSnapRealtime:{configurable:!0,get:function(){return this.dragOptions.isGridSnapRealtime},set:function(a){A(a,"boolean",df,"isGridSnapRealtime");this.dragOptions.isGridSnapRealtime=
a}},gridSnapCellSize:{configurable:!0,get:function(){return this.dragOptions.gridSnapCellSize},set:function(a){x(a,Hb,df,"gridSnapCellSize");this.dragOptions.gridSnapCellSize.A(a)||(a=a.J(),this.dragOptions.gridSnapCellSize=a)}},gridSnapCellSpot:{configurable:!0,get:function(){return this.dragOptions.gridSnapCellSpot},set:function(a){x(a,M,df,"gridSnapCellSpot");this.dragOptions.gridSnapCellSpot.A(a)||(a=a.J(),this.dragOptions.gridSnapCellSpot=a)}},gridSnapOrigin:{configurable:!0,
enumerable:!0,get:function(){return this.dragOptions.gridSnapOrigin},set:function(a){x(a,J,df,"gridSnapOrigin");this.dragOptions.gridSnapOrigin.A(a)||(a=a.J(),this.dragOptions.gridSnapOrigin=a)}},dragsLink:{configurable:!0,get:function(){return this.dragOptions.dragsLink},set:function(a){A(a,"boolean",df,"dragsLink");this.dragOptions.dragsLink=a}},dragsTree:{configurable:!0,get:function(){return this.dragOptions.dragsTree},set:function(a){A(a,"boolean",df,"dragsTree");
this.dragOptions.dragsTree=a}},copyCursor:{configurable:!0,get:function(){return this.W},set:function(a){this.W=a}},moveCursor:{configurable:!0,get:function(){return this.$h},set:function(a){this.$h=a}},nodropCursor:{configurable:!0,get:function(){return this.ai},set:function(a){this.ai=a}},currentPart:{configurable:!0,get:function(){return this.Na},set:function(a){null!==a&&x(a,S,df,"currentPart");this.Na=a}},copiedParts:{configurable:!0,
get:function(){return this.w},set:function(a){this.w=a}},draggedParts:{configurable:!0,get:function(){return this.ib},set:function(a){this.ib=a}},draggingParts:{configurable:!0,get:function(){return null!==this.copiedParts?this.copiedParts.Pf():null!==this.draggedParts?this.draggedParts.Pf():this.rr}},draggedLink:{configurable:!0,get:function(){return this.diagram.draggedLink},set:function(a){null!==a&&x(a,R,df,"draggedLink");this.diagram.draggedLink=a}},
isDragOutStarted:{configurable:!0,get:function(){return this.Qf},set:function(a){this.Qf=a}},startPoint:{configurable:!0,get:function(){return this.mt},set:function(a){x(a,J,df,"startPoint");this.mt.A(a)||this.mt.assign(a)}},delay:{configurable:!0,get:function(){return this.jl},set:function(a){A(a,"number",df,"delay");this.jl=a}}});df.prototype.getDraggingSource=df.prototype.hA;var tf=null,ff=null,kf=null;df.className="DraggingTool";tf=new H;
Sa("draggingTool",function(){return this.findTool("Dragging")},function(a){this.cb("Dragging",a,this.mouseMoveTools)});Ua.prototype.doCancel=function(){null!==ff&&ff.doCancel();Oe.prototype.doCancel.call(this)};
function Xf(){0<arguments.length&&za(Xf);Oe.call(this);this.ai=100;this.Oa=!1;this.ti="pointer";var a=new R,b=new Yf;b.isPanelMain=!0;b.stroke="blue";a.add(b);b=new Yf;b.toArrow="Standard";b.fill="blue";b.stroke="blue";a.add(b);a.layerName="Tool";this.gx=a;a=new T;b=new Yf;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke="magenta";b.strokeWidth=2;b.desiredSize=Xb;a.add(b);a.selectable=!1;a.layerName="Tool";this.ex=a;this.l=b;a=new T;b=new Yf;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke=
"magenta";b.strokeWidth=2;b.desiredSize=Xb;a.add(b);a.selectable=!1;a.layerName="Tool";this.hx=a;this.w=b;this.$h=this.Qf=this.Qc=this.ib=this.Rc=null;this.Na=!0;this.Yy=new Db;this.rr=this.Ki=this.bx=null}la(Xf,Oe);Xf.prototype.doStop=function(){this.diagram.Of();this.originalToPort=this.originalToNode=this.originalFromPort=this.originalFromNode=this.originalLink=null;this.validPortsCache.clear();this.targetPort=null};
Xf.prototype.copyPortProperties=function(a,b,c,d,e){if(null!==a&&null!==b&&null!==c&&null!==d){var f=b.Gf(),g=Hb.alloc();g.width=b.naturalBounds.width*f;g.height=b.naturalBounds.height*f;d.desiredSize=g;Hb.free(g);e?(d.toSpot=b.toSpot,d.toEndSegmentLength=b.toEndSegmentLength):(d.fromSpot=b.fromSpot,d.fromEndSegmentLength=b.fromEndSegmentLength);c.locationSpot=Mc;f=J.alloc();c.location=b.ma(Mc,f);J.free(f);d.angle=b.lj();null!==this.portTargeted&&this.portTargeted(a,b,c,d,e)}};
Xf.prototype.setNoTargetPortProperties=function(a,b,c){null!==b&&(b.desiredSize=Xb,b.fromSpot=Gc,b.toSpot=Gc);null!==a&&(a.location=this.diagram.lastInput.documentPoint);null!==this.portTargeted&&this.portTargeted(null,null,a,b,c)};Xf.prototype.doMouseDown=function(){this.isActive&&this.doMouseMove()};
Xf.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram;this.targetPort=this.findTargetPort(this.isForwards);if(null!==this.targetPort&&this.targetPort.part instanceof T){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.Gt(a.lastInput.viewPoint)}};Xf.prototype.findValidLinkablePort=function(a,b){if(null===a)return null;var c=a.part;if(!(c instanceof T))return null;for(;null!==a;){var d=b?a.toLinkable:a.fromLinkable;if(!0===d&&(null!==a.portId||a instanceof T)&&(b?this.isValidTo(c,a):this.isValidFrom(c,a)))return a;if(!1===d)break;a=a.panel}return null};
Xf.prototype.findTargetPort=function(a){var b=this.diagram,c=b.lastInput.documentPoint,d=this.portGravity;0>=d&&(d=.1);var e=this,f=b.Jg(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 T){var k=g.ma(Mc,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.K(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 T&&(null===c.layer||c.layer.allowLink))?b:null};
Xf.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.Gq(b).count>=c)return!1}return!0};
Xf.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.Dd(b).count>=c)return!1}return!0};
Xf.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};Xf.prototype.isLinked=function(a,b){if(null===a||null===b)return!1;var c=a.part;if(!(c instanceof T))return!1;a=a.portId;null===a&&(a="");var d=b.part;if(!(d instanceof T))return!1;b=b.portId;null===b&&(b="");for(b=d.Dd(b);b.next();)if(d=b.value,d.fromNode===c&&d.fromPortId===a)return!0;return!1};
Xf.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};Xf.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 I;d.add(a);return Zf(this,c,b,d)};
function Zf(a,b,c,d){if(b===c)return!0;var e=b.fromNode;if(null!==e&&e.isLinkLabel&&(d.add(e),Zf(a,e.labeledLink,c,d)))return!0;b=b.toNode;return null!==b&&b.isLinkLabel&&(d.add(b),Zf(a,b.labeledLink,c,d))?!0:!1}
Xf.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!==$f){if(d===ag){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!bg(this,a,b,c,!0)}if(d===cg){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!bg(this,a,b,c,!0)}if(d===dg)return a===b?a=!0:(d=new I,d.add(b),a=eg(this,d,a,b,c)),!a;if(d===fg)return!bg(this,a,b,c,!1);if(d===gg)return a===b?a=!0:(d=new I,d.add(b),a=hg(this,d,a,b,c)),!a}return!0};function bg(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&&bg(a,g,c,d,e)))return!0}return!1}
function eg(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&&eg(a,b,g,d,e)))return!0}return!1}function hg(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&&hg(a,b,h,d,e))return!0}}return!1}
ma.Object.defineProperties(Xf.prototype,{portGravity:{configurable:!0,get:function(){return this.ai},set:function(a){A(a,"number",Xf,"portGravity");0<=a&&(this.ai=a)}},isUnconnectedLinkValid:{configurable:!0,get:function(){return this.Oa},set:function(a){A(a,"boolean",Xf,"isUnconnectedLinkValid");this.Oa=a}},linkingCursor:{configurable:!0,get:function(){return this.ti},set:function(a){this.ti=a}},temporaryLink:{configurable:!0,get:function(){return this.gx},
set:function(a){x(a,R,Xf,"temporaryLink");this.gx=a}},temporaryFromNode:{configurable:!0,get:function(){return this.ex},set:function(a){x(a,T,Xf,"temporaryFromNode");if(this.ex=a)this.l=a.port}},temporaryFromPort:{configurable:!0,get:function(){return this.l},set:function(a){x(a,N,Xf,"temporaryFromPort");if(null!==this.l){var b=this.l.panel;if(null!==b){var c=b.$.indexOf(this.l);b.hb(c);b.zb(c,a)}}this.l=a}},temporaryToNode:{configurable:!0,get:function(){return this.hx},
set:function(a){x(a,T,Xf,"temporaryToNode");if(this.hx=a)this.w=a.port}},temporaryToPort:{configurable:!0,get:function(){return this.w},set:function(a){x(a,N,Xf,"temporaryToPort");if(null!==this.w){var b=this.w.panel;if(null!==b){var c=b.$.indexOf(this.w);b.hb(c);b.zb(c,a)}}this.w=a}},originalLink:{configurable:!0,get:function(){return this.Rc},set:function(a){null!==a&&x(a,R,Xf,"originalLink");this.Rc=a}},originalFromNode:{configurable:!0,get:function(){return this.ib},
set:function(a){null!==a&&x(a,T,Xf,"originalFromNode");this.ib=a}},originalFromPort:{configurable:!0,get:function(){return this.Qc},set:function(a){null!==a&&x(a,N,Xf,"originalFromPort");this.Qc=a}},originalToNode:{configurable:!0,get:function(){return this.Qf},set:function(a){null!==a&&x(a,T,Xf,"originalToNode");this.Qf=a}},originalToPort:{configurable:!0,get:function(){return this.$h},set:function(a){null!==a&&x(a,N,Xf,"originalToPort");this.$h=a}},isForwards:{configurable:!0,
enumerable:!0,get:function(){return this.Na},set:function(a){A(a,"boolean",Xf,"isForwards");this.Na=a}},validPortsCache:{configurable:!0,get:function(){return this.Yy}},targetPort:{configurable:!0,get:function(){return this.bx},set:function(a){null!==a&&x(a,N,Xf,"targetPort");this.bx=a}},linkValidation:{configurable:!0,get:function(){return this.Ki},set:function(a){null!==a&&A(a,"function",Xf,"linkValidation");this.Ki=a}},portTargeted:{configurable:!0,
get:function(){return this.rr},set:function(a){null!==a&&A(a,"function",Xf,"portTargeted");this.rr=a}}});Xf.className="LinkingBaseTool";function ig(){0<arguments.length&&za(ig);Xf.call(this);this.name="Linking";this.W={};this.L=null;this.M=jg;this.fn=null}la(ig,Xf);ig.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowLink||!a.model.Wt()||!a.lastInput.left||a.currentTool!==this&&!this.isBeyondDragSize()?!1:null!==this.findLinkablePort()};
ig.prototype.findLinkablePort=function(){var a=this.diagram,b=this.startObject;null===b&&(b=a.$b(a.firstInput.documentPoint,null,null));if(null===b||!(b.part instanceof T))return null;a=this.direction;if(a===jg||a===kg){var c=this.findValidLinkablePort(b,!1);if(null!==c)return this.isForwards=!0,c}if(a===jg||a===lg)if(b=this.findValidLinkablePort(b,!0),null!==b)return this.isForwards=!1,b;return null};
ig.prototype.doActivate=function(){var a=this.diagram,b=this.findLinkablePort();null!==b&&(this.Ba(this.name),a.isMouseCaptured=!0,a.currentCursor=this.linkingCursor,this.isForwards?(null===this.temporaryToNode||this.temporaryToNode.location.o()||(this.temporaryToNode.location=a.lastInput.documentPoint),this.originalFromPort=b,b=this.originalFromPort.part,b instanceof T&&(this.originalFromNode=b),this.copyPortProperties(this.originalFromNode,this.originalFromPort,this.temporaryFromNode,this.temporaryFromPort,
!1)):(null===this.temporaryFromNode||this.temporaryFromNode.location.o()||(this.temporaryFromNode.location=a.lastInput.documentPoint),this.originalToPort=b,b=this.originalToPort.part,b instanceof T&&(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.Ya(),a.add(this.temporaryLink)),this.isActive=!0)};ig.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.Pg()};ig.prototype.doStop=function(){Xf.prototype.doStop.call(this);this.startObject=null};
ig.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 T&&(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.U("ChangingSelection",a.selection),a.clearSelection(!0),f.isSelected=!0),this.transactionResult=this.name,a.U("LinkDrawn",f)):(a.model.Bq(),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.U("ChangedSelection",a.selection)}}};
ig.prototype.isNewTreeLink=function(){var a=this.archetypeLinkData;if(null===a)return!0;if(a instanceof R)return a.isTreeLink;var b=this.diagram;if(null===b)return!0;a=b.partManager.getLinkCategoryForData(a);b=b.partManager.findLinkTemplateForCategory(a);return null!==b?b.isTreeLink:!0};ig.prototype.insertLink=function(a,b,c,d){return this.diagram.partManager.insertLink(a,b,c,d)};ig.prototype.doNoLink=function(){};
ma.Object.defineProperties(ig.prototype,{archetypeLinkData:{configurable:!0,get:function(){return this.W},set:function(a){null!==a&&A(a,"object",ig,"archetypeLinkData");a instanceof N&&x(a,R,ig,"archetypeLinkData");this.W=a}},archetypeLabelNodeData:{configurable:!0,get:function(){return this.L},set:function(a){null!==a&&A(a,"object",ig,"archetypeLabelNodeData");a instanceof N&&x(a,T,ig,"archetypeLabelNodeData");this.L=a}},direction:{configurable:!0,get:function(){return this.M},
set:function(a){hb(a,ig,ig,"direction");this.M=a}},startObject:{configurable:!0,get:function(){return this.fn},set:function(a){null!==a&&x(a,N,ig,"startObject");this.fn=a}}});var jg=new E(ig,"Either",0),kg=new E(ig,"ForwardsOnly",0),lg=new E(ig,"BackwardsOnly",0);ig.className="LinkingTool";ig.Either=jg;ig.ForwardsOnly=kg;ig.BackwardsOnly=lg;
function lf(){0<arguments.length&&za(lf);Xf.call(this);this.name="Relinking";var a=new Yf;a.figure="Diamond";a.desiredSize=$b;a.fill="lightblue";a.stroke="dodgerblue";a.cursor=this.linkingCursor;a.segmentIndex=0;this.W=a;a=new Yf;a.figure="Diamond";a.desiredSize=$b;a.fill="lightblue";a.stroke="dodgerblue";a.cursor=this.linkingCursor;a.segmentIndex=-1;this.fn=a;this.L=null;this.Ix=new L}la(lf,Xf);
lf.prototype.updateAdornments=function(a){if(null!==a&&a instanceof R){var b="RelinkFrom",c=null;if(a.isSelected&&!this.diagram.isReadOnly){var d=a.selectionObject;null!==d&&a.canRelinkFrom()&&a.actualBounds.o()&&a.isVisible()&&d.actualBounds.o()&&d.Lf()&&(c=a.uk(b),null===c&&(c=this.makeAdornment(d,!1),a.Kh(b,c)))}null===c&&a.Mf(b);b="RelinkTo";c=null;a.isSelected&&!this.diagram.isReadOnly&&(d=a.selectionObject,null!==d&&a.canRelinkTo()&&a.actualBounds.o()&&a.isVisible()&&d.actualBounds.o()&&d.Lf()&&
(c=a.uk(b),null===c?(c=this.makeAdornment(d,!0),a.Kh(b,c)):c.u()));null===c&&a.Mf(b)}};lf.prototype.makeAdornment=function(a,b){var c=new Te;c.type=U.Link;b=b?this.toHandleArchetype:this.fromHandleArchetype;null!==b&&c.add(b.copy());c.adornedObject=a;return c};
lf.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowRelink||!a.model.Wt()||!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};
lf.prototype.doActivate=function(){var a=this.diagram;if(null===this.originalLink){var b=this.handle;null===b&&(b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkFrom"),null===b&&(b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkTo")));if(null===b)return;var c=b.part;if(!(c instanceof Te&&c.adornedPart instanceof R))return;this.handle=b;this.isForwards=null===c||"RelinkTo"===c.category;this.originalLink=c.adornedPart}this.Ba(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.Ix.set(this.originalLink.actualBounds);null!==this.originalLink&&0<this.originalLink.pointsCount&&(null===this.originalLink.fromNode&&(null!==this.temporaryFromPort&&(this.temporaryFromPort.desiredSize=Wb),null!==this.temporaryFromNode&&(this.temporaryFromNode.location=this.originalLink.i(0))),null===this.originalLink.toNode&&
(null!==this.temporaryToPort&&(this.temporaryToPort.desiredSize=Wb),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.Ya(),a.add(this.temporaryLink));this.isActive=!0};
lf.prototype.copyLinkProperties=function(a,b){if(null!==a&&null!==b){b.adjusting=a.adjusting;b.corner=a.corner;var c=a.curve;if(c===mg||c===ng)c=og;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}};
lf.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.Pg()};lf.prototype.doStop=function(){Xf.prototype.doStop.call(this);this.handle=null};
lf.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 T&&(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.Ya()),a.allowSelect&&(f.isSelected=!0),this.transactionResult=this.name,a.U("LinkRelinked",f,this.isForwards?this.originalToPort:this.originalFromPort)):this.doNoRelink(this.originalLink,this.isForwards);this.originalLink.Qq(this.Ix)}this.stopTool()};
lf.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};lf.prototype.doNoRelink=function(){};
function Lf(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(lf.prototype,{fromHandleArchetype:{configurable:!0,get:function(){return this.W},set:function(a){null!==a&&x(a,N,lf,"fromHandleArchetype");this.W=a}},toHandleArchetype:{configurable:!0,get:function(){return this.fn},set:function(a){null!==a&&x(a,N,lf,"toHandleArchetype");this.fn=a}},handle:{configurable:!0,get:function(){return this.L},set:function(a){if(null!==a&&(x(a,N,lf,"handle"),!(a.part instanceof Te)))throw Error("new handle is not in an Adornment: "+
a);this.L=a}}});lf.className="RelinkingTool";Sa("linkingTool",function(){return this.findTool("Linking")},function(a){this.cb("Linking",a,this.mouseMoveTools)});Sa("relinkingTool",function(){return this.findTool("Relinking")},function(a){this.cb("Relinking",a,this.mouseDownTools)});
function pg(){0<arguments.length&&za(pg);Oe.call(this);this.name="LinkReshaping";var a=new Yf;a.figure="Rectangle";a.desiredSize=Zb;a.fill="lightblue";a.stroke="dodgerblue";this.w=a;a=new Yf;a.figure="Diamond";a.desiredSize=$b;a.fill="lightblue";a.stroke="dodgerblue";a.cursor="move";this.L=a;this.W=3;this.xu=this.l=null;this.Jx=new J;this.Os=new H}la(pg,Oe);pg.prototype.aw=function(a){return a&&a.Vs&&0!==a.Vs.value?a.Vs:qg};
pg.prototype.an=function(a,b){x(a,N,pg,"setReshapingBehavior:obj");hb(b,pg,pg,"setReshapingBehavior:behavior");a.Vs=b};
pg.prototype.updateAdornments=function(a){if(null!==a&&a instanceof R){var b=null;if(a.isSelected&&!this.diagram.isReadOnly){var c=a.path;null!==c&&a.canReshape()&&a.actualBounds.o()&&a.isVisible()&&c.actualBounds.o()&&c.Lf()&&(b=a.uk(this.name),null===b||b.Fx!==a.pointsCount||b.Tx!==a.resegmentable)&&(b=this.makeAdornment(c),null!==b&&(b.Fx=a.pointsCount,b.Tx=a.resegmentable,a.Kh(this.name,b)))}null===b&&a.Mf(this.name)}};
pg.prototype.makeAdornment=function(a){var b=a.part,c=b.pointsCount,d=b.isOrthogonal,e=null;if(null!==b.points&&1<c){e=new Te;e.type=U.Link;c=b.firstPickIndex;var f=b.lastPickIndex,g=d?1:0;if(b.resegmentable&&b.computeCurve()!==rg)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.C(k.x,l.x)&&
K.C(k.y,l.y)&&(l=b.i(c-1));K.C(k.x,l.x)?(this.an(h,sg),h.cursor="n-resize"):K.C(k.y,l.y)&&(this.an(h,tg),h.cursor="w-resize")}else g===f-1&&d?(k=b.i(f-1),l=b.i(f),K.C(k.x,l.x)&&K.C(k.y,l.y)&&(k=b.i(f+1)),K.C(k.x,l.x)?(this.an(h,sg),h.cursor="n-resize"):K.C(k.y,l.y)&&(this.an(h,tg),h.cursor="w-resize")):g!==f&&(this.an(h,ug),h.cursor="move");e.add(h)}e.adornedObject=a}return e};pg.prototype.makeHandle=function(){var a=this.handleArchetype;return null===a?null:a.copy()};
pg.prototype.makeResegmentHandle=function(){var a=this.midHandleArchetype;return null===a?null:a.copy()};pg.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};
pg.prototype.doActivate=function(){var a=this.diagram;null===this.handle&&(this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name));if(null!==this.handle){var b=this.handle.part.adornedPart;if(b instanceof R){this.xu=b;a.isMouseCaptured=!0;this.Ba(this.name);if(b.resegmentable&&999===this.handle.fromMaxLinks){var c=b.points.copy(),d=this.getResegmentingPoint();c.zb(this.handle.segmentIndex+1,d);b.isOrthogonal&&c.zb(this.handle.segmentIndex+1,d);b.points=c;b.Sb();b.updateAdornments();
this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name);if(null===this.handle){this.doDeactivate();return}}this.Jx=b.i(this.handle.segmentIndex);this.Os=b.points.copy();this.isActive=!0}}};pg.prototype.doDeactivate=function(){this.Pg();this.xu=this.handle=null;this.isActive=this.diagram.isMouseCaptured=!1};pg.prototype.doCancel=function(){var a=this.adornedLink;null!==a&&(a.points=this.Os);this.stopTool()};pg.prototype.getResegmentingPoint=function(){return this.handle.ma(Mc)};
pg.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeReshape(a.lastInput.documentPoint),this.reshape(a))};
pg.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&&(vg(this,g,d,e,f,!0)||vg(this,g,d,e,f,!1))){var h=b.points.copy();vg(this,g,d,
e,f,!0)?(h.od(c-2,new J(g.x,(f.y+g.y)/2)),h.od(c+1,new J(f.x,(f.y+g.y)/2))):(h.od(c-2,new J((f.x+g.x)/2,g.y)),h.od(c+1,new J((f.x+g.x)/2,f.y)));h.hb(c);h.hb(c-1);b.points=h;b.Sb()}else g=b.i(c+2),Math.abs(e.x-f.x)<this.resegmentingDistance&&Math.abs(e.y-f.y)<this.resegmentingDistance&&(vg(this,d,e,f,g,!0)||vg(this,d,e,f,g,!1))&&(h=b.points.copy(),vg(this,d,e,f,g,!0)?(h.od(c-1,new J(d.x,(d.y+g.y)/2)),h.od(c+2,new J(g.x,(d.y+g.y)/2))):(h.od(c-1,new J((d.x+g.x)/2,d.y)),h.od(c+2,new J((d.x+g.x)/2,g.y))),
h.hb(c+1),h.hb(c),b.points=h,b.Sb())}}else g=J.alloc(),K.Vh(d.x,d.y,f.x,f.y,e.x,e.y,g)&&g.Qe(e)<this.resegmentingDistance*this.resegmentingDistance&&(d=b.points.copy(),d.hb(c),b.points=d,b.Sb()),J.free(g)}a.Ta();this.transactionResult=this.name;a.U("LinkReshaped",this.adornedLink,this.Os)}this.stopTool()};
function vg(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}
pg.prototype.reshape=function(a){var b=this.adornedLink;b.Xh();var c=this.handle.segmentIndex,d=this.aw(this.handle);if(b.isOrthogonal)if(c===b.firstPickIndex+1)c=b.firstPickIndex+1,d===sg?(b.N(c,b.i(c-1).x,a.y),b.N(c+1,b.i(c+2).x,a.y)):d===tg&&(b.N(c,a.x,b.i(c-1).y),b.N(c+1,a.x,b.i(c+2).y));else if(c===b.lastPickIndex-1)c=b.lastPickIndex-1,d===sg?(b.N(c-1,b.i(c-2).x,a.y),b.N(c,b.i(c+1).x,a.y)):d===tg&&(b.N(c-1,a.x,b.i(c-2).y),b.N(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.C(f.x,
e.x)&&K.C(e.y,g.y)?(K.C(f.x,b.i(d-2).x)&&!K.C(f.y,b.i(d-2).y)?(b.m(d,a.x,f.y),c++,d++):b.N(d-1,a.x,f.y),K.C(g.y,b.i(d+2).y)&&!K.C(g.x,b.i(d+2).x)?b.m(d+1,g.x,a.y):b.N(d+1,g.x,a.y)):K.C(f.y,e.y)&&K.C(e.x,g.x)?(K.C(f.y,b.i(d-2).y)&&!K.C(f.x,b.i(d-2).x)?(b.m(d,f.x,a.y),c++,d++):b.N(d-1,f.x,a.y),K.C(g.x,b.i(d+2).x)&&!K.C(g.y,b.i(d+2).y)?b.m(d+1,a.x,g.y):b.N(d+1,a.x,g.y)):K.C(f.x,e.x)&&K.C(e.x,g.x)?(K.C(f.x,b.i(d-2).x)&&!K.C(f.y,b.i(d-2).y)?(b.m(d,a.x,f.y),c++,d++):b.N(d-1,a.x,f.y),K.C(g.x,b.i(d+2).x)&&
!K.C(g.y,b.i(d+2).y)?b.m(d+1,a.x,g.y):b.N(d+1,a.x,g.y)):K.C(f.y,e.y)&&K.C(e.y,g.y)&&(K.C(f.y,b.i(d-2).y)&&!K.C(f.x,b.i(d-2).x)?(b.m(d,f.x,a.y),c++,d++):b.N(d-1,f.x,a.y),K.C(g.y,b.i(d+2).y)&&!K.C(g.x,b.i(d+2).x)?b.m(d+1,g.x,a.y):b.N(d+1,g.x,a.y));b.N(c,a.x,a.y)}else b.N(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).Tb()&&(f=e.ma(Mc,J.alloc()),d=b.getLinkPointFromPoint(d,e,f,a,!0,J.alloc()),b.N(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).Tb()&&(c=e.ma(Mc,J.alloc()),a=b.getLinkPointFromPoint(d,e,c,a,!1,J.alloc()),b.N(b.pointsCount-1,a.x,a.y),J.free(c),J.free(a));b.Df()};pg.prototype.computeReshape=function(a){var b=this.adornedLink,c=this.handle.segmentIndex;switch(this.aw(this.handle)){case ug:return a;case sg:return new J(b.i(c).x,a.y);case tg:return new J(a.x,b.i(c).y);default:case qg:return b.i(c)}};
ma.Object.defineProperties(pg.prototype,{handleArchetype:{configurable:!0,get:function(){return this.w},set:function(a){null!==a&&x(a,N,pg,"handleArchetype");this.w=a}},midHandleArchetype:{configurable:!0,get:function(){return this.L},set:function(a){null!==a&&x(a,N,pg,"midHandleArchetype");this.L=a}},handle:{configurable:!0,get:function(){return this.l},set:function(a){if(null!==a&&(x(a,N,pg,"handle"),!(a.part instanceof Te)))throw Error("new handle is not in an Adornment: "+
a);this.l=a}},adornedLink:{configurable:!0,get:function(){return this.xu}},resegmentingDistance:{configurable:!0,get:function(){return this.W},set:function(a){A(a,"number",pg,"resegmentingDistance");this.W=a}},originalPoint:{configurable:!0,get:function(){return this.Jx}},originalPoints:{configurable:!0,get:function(){return this.Os}}});pg.prototype.setReshapingBehavior=pg.prototype.an;pg.prototype.getReshapingBehavior=pg.prototype.aw;
var qg=new E(pg,"None",0),tg=new E(pg,"Horizontal",1),sg=new E(pg,"Vertical",2),ug=new E(pg,"All",3);pg.className="LinkReshapingTool";pg.None=qg;pg.Horizontal=tg;pg.Vertical=sg;pg.All=ug;Sa("linkReshapingTool",function(){return this.findTool("LinkReshaping")},function(a){this.cb("LinkReshaping",a,this.mouseDownTools)});
function Ig(){0<arguments.length&&za(Ig);Oe.call(this);this.name="Resizing";this.ng=(new Hb(1,1)).freeze();this.mg=(new Hb(9999,9999)).freeze();this.Wg=(new Hb(NaN,NaN)).freeze();this.L=!1;this.W=!0;this.me=null;var a=new Yf;a.alignmentFocus=Mc;a.figure="Rectangle";a.desiredSize=Zb;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.w=a;this.l=null;this.Ns=new J;this.Hx=new Hb;this.rp=new J;this.Ou=new Hb(0,0);this.Nu=new Hb(Infinity,Infinity);this.Mu=new Hb(1,1);this.Ex=
!0}la(Ig,Oe);Ig.prototype.updateAdornments=function(a){if(!(null===a||a instanceof R)){if(a.isSelected&&!this.diagram.isReadOnly){var b=a.resizeObject,c=a.uk(this.name);if(null!==b&&a.canResize()&&a.actualBounds.o()&&a.isVisible()&&b.actualBounds.o()&&b.Lf()){if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){b=b.lj();Jg(a)&&this.updateResizeHandles(c,b);a.Kh(this.name,c);return}}}a.Mf(this.name)}};
Ig.prototype.makeAdornment=function(a){var b=a.part.resizeAdornmentTemplate;if(null===b){b=new Te;b.type=U.Spot;b.locationSpot=Mc;var c=new Kg;c.isPanelMain=!0;b.add(c);b.add(this.makeHandle(a,Hc));b.add(this.makeHandle(a,Jc));b.add(this.makeHandle(a,Sc));b.add(this.makeHandle(a,Oc));b.add(this.makeHandle(a,qd));b.add(this.makeHandle(a,sd));b.add(this.makeHandle(a,td));b.add(this.makeHandle(a,rd))}else if(Lg(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};
Ig.prototype.makeHandle=function(a,b){a=this.handleArchetype;if(null===a)return null;a=a.copy();a.alignment=b;return a};
Ig.prototype.updateResizeHandles=function(a,b){if(null!==a)if(!a.alignment.Gb()&&("pointer"===a.cursor||0<a.cursor.indexOf("resize")))a:{var c=a.alignment;c.Tb()&&(c=Mc);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 U)for(a=a.elements;a.next();)this.updateResizeHandles(a.value,b)};Ig.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};
Ig.prototype.doActivate=function(){var a=this.diagram;null===this.handle&&(this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name));null!==this.handle&&(this.adornedObject=this.handle.part.adornedObject,null!==this.adornedObject&&(this.Ns.set(this.adornedObject.ma(this.handle.alignment.ow())),this.rp.set(this.adornedObject.part.location),this.Hx.set(this.adornedObject.desiredSize),this.Mu=this.computeCellSize(),this.Ou=this.computeMinSize(),this.Nu=this.computeMaxSize(),a.isMouseCaptured=
!0,this.Ex=a.animationManager.isEnabled,a.animationManager.isEnabled=!1,this.Ba(this.name),this.isActive=!0))};Ig.prototype.doDeactivate=function(){var a=this.diagram;this.Pg();this.me=this.handle=null;this.isActive=a.isMouseCaptured=!1;a.animationManager.isEnabled=this.Ex};Ig.prototype.doCancel=function(){null!==this.adornedObject&&(this.adornedObject.desiredSize=this.originalDesiredSize,this.adornedObject.part.location=this.originalLocation);this.stopTool()};
Ig.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive){var b=this.Ou,c=this.Nu,d=this.Mu,e=this.adornedObject.Ot(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)}};
Ig.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.Ou,c=this.Nu,d=this.Mu,e=this.adornedObject.Ot(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.Ta();this.transactionResult=this.name;a.U("PartResized",this.adornedObject,this.originalDesiredSize)}this.stopTool()};
Ig.prototype.resize=function(a){var b=this.diagram,c=this.adornedObject;if(null!==c){c.desiredSize=a.size;a=c.part;a.Fb();c=c.ma(this.handle.alignment.ow());if(a instanceof Hf){var d=new H;d.add(a);if(!this.dragsMembers&&null===a.placeholder){var e=new ef;e.dragsMembers=!1}b.moveParts(d,this.oppositePoint.copy().je(c),!0,e)}else a.location=a.location.copy().je(c).add(this.oppositePoint);b.cd()}};
Ig.prototype.computeResize=function(a,b,c,d,e,f){b.Tb()&&(b=Mc);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.Hq(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};Ig.prototype.computeReshape=function(){var a=Mg;this.adornedObject instanceof Yf&&(a=Ng(this.adornedObject));return!(a===Og||this.diagram.lastInput.shift)};
Ig.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};Ig.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};
Ig.prototype.computeCellSize=function(){var a=new Hb(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(Ig.prototype,{handleArchetype:{configurable:!0,get:function(){return this.w},set:function(a){null!==a&&x(a,N,Ig,"handleArchetype");this.w=a}},handle:{configurable:!0,get:function(){return this.l},set:function(a){if(null!==a&&(x(a,N,Ig,"handle"),!(a.part instanceof Te)))throw Error("new handle is not in an Adornment: "+a);this.l=a}},adornedObject:{configurable:!0,get:function(){return this.me},set:function(a){if(null!==a&&(x(a,N,
Ig,"handle"),a.part instanceof Te))throw Error("new handle must not be in an Adornment: "+a);this.me=a}},minSize:{configurable:!0,get:function(){return this.ng},set:function(a){x(a,Hb,Ig,"minSize");if(!this.ng.A(a)){var b=a.width;isNaN(b)&&(b=0);a=a.height;isNaN(a)&&(a=0);this.ng.h(b,a)}}},maxSize:{configurable:!0,get:function(){return this.mg},set:function(a){x(a,Hb,Ig,"maxSize");if(!this.mg.A(a)){var b=a.width;isNaN(b)&&(b=Infinity);a=a.height;isNaN(a)&&(a=Infinity);
this.mg.h(b,a)}}},cellSize:{configurable:!0,get:function(){return this.Wg},set:function(a){x(a,Hb,Ig,"cellSize");this.Wg.A(a)||this.Wg.assign(a)}},isGridSnapEnabled:{configurable:!0,get:function(){return this.L},set:function(a){A(a,"boolean",Ig,"isGridSnapEnabled");this.L=a}},dragsMembers:{configurable:!0,get:function(){return this.W},set:function(a){A(a,"boolean",Ig,"dragsMembers");this.W=a}},oppositePoint:{configurable:!0,get:function(){return this.Ns},
set:function(a){x(a,J,Ig,"oppositePoint");this.Ns.A(a)||this.Ns.assign(a)}},originalDesiredSize:{configurable:!0,get:function(){return this.Hx}},originalLocation:{configurable:!0,get:function(){return this.rp}}});Ig.className="ResizingTool";Sa("resizingTool",function(){return this.findTool("Resizing")},function(a){this.cb("Resizing",a,this.mouseDownTools)});
function Pg(){0<arguments.length&&za(Pg);Oe.call(this);this.name="Rotating";this.Oa=45;this.Na=2;this.rp=new J;this.me=null;var a=new Yf;a.figure="Ellipse";a.desiredSize=$b;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.w=a;this.l=null;this.Gx=0;this.nv=new J(NaN,NaN);this.L=0;this.W=50}la(Pg,Oe);
Pg.prototype.updateAdornments=function(a){if(null!==a){if(a.Uh()){var b=a.rotateObject;if(b===a||b===a.path||b.isPanelMain)return}if(a.isSelected&&!this.diagram.isReadOnly&&(b=a.rotateObject,null!==b&&a.canRotate()&&a.actualBounds.o()&&a.isVisible()&&b.actualBounds.o()&&b.Lf())){var c=a.uk(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.Kh(this.name,c);return}}a.Mf(this.name)}};
Pg.prototype.makeAdornment=function(a){var b=a.part.rotateAdornmentTemplate;if(null===b){b=new Te;b.type=U.Position;b.locationSpot=Mc;var c=this.handleArchetype;null!==c&&b.add(c.copy())}else if(Lg(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};Pg.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};
Pg.prototype.doActivate=function(){var a=this.diagram;if(null===this.adornedObject){null===this.handle&&(this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name));if(null===this.handle)return;this.adornedObject=this.handle.part.adornedObject}null!==this.adornedObject&&(this.Gx=this.adornedObject.angle,this.nv=this.computeRotationPoint(this.adornedObject),this.rp=this.adornedObject.part.location.copy(),a.isMouseCaptured=!0,a.delaysLayout=!0,this.Ba(this.name),this.isActive=!0)};
Pg.prototype.computeRotationPoint=function(a){var b=a.part,c=b.locationObject;return b.rotationSpot.bb()?a.ma(b.rotationSpot):a===b||a===c?c.ma(b.locationSpot):a.ma(Mc)};
Pg.prototype.computeAdornmentLocation=function(a){var b=this.rotationPoint;b.o()||(b=this.computeRotationPoint(a));b=a.Ot(b);var c=this.handleAngle;0>c?c+=360:360<=c&&(c-=360);c=Math.round(45*Math.round(c/45));var d=this.handleDistance;0===c?b.x=a.naturalBounds.width+d:45===c?(b.x=a.naturalBounds.width+d,b.y=a.naturalBounds.height+d):90===c?b.y=a.naturalBounds.height+d:135===c?(b.x=-d,b.y=a.naturalBounds.height+d):180===c?b.x=-d:225===c?(b.x=-d,b.y=-d):270===c?b.y=-d:315===c&&(b.x=a.naturalBounds.width+
d,b.y=-d);return a.ma(b)};Pg.prototype.doDeactivate=function(){var a=this.diagram;this.Pg();this.me=this.handle=null;this.nv=new J(NaN,NaN);this.isActive=a.isMouseCaptured=!1};Pg.prototype.doCancel=function(){this.diagram.delaysLayout=!1;this.rotate(this.originalAngle);this.stopTool()};Pg.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeRotate(a.lastInput.documentPoint),this.rotate(a))};
Pg.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){a.delaysLayout=!1;var b=this.computeRotate(a.lastInput.documentPoint);this.rotate(b);a.Ta();this.transactionResult=this.name;a.U("PartRotated",this.adornedObject,this.originalAngle)}this.stopTool()};
Pg.prototype.rotate=function(a){F&&C(a,Pg,"rotate:newangle");var b=this.adornedObject;if(null!==b){b.angle=a;b=b.part;b.Fb();var c=b.locationObject,d=b.rotateObject;if(c===d||c.Lg(d))c=this.rp.copy(),b.location=c.je(this.rotationPoint).rotate(a-this.originalAngle).add(this.rotationPoint);this.diagram.cd()}};
Pg.prototype.computeRotate=function(a){a=this.rotationPoint.Xa(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(Pg.prototype,{handleArchetype:{configurable:!0,get:function(){return this.w},set:function(a){null!==a&&x(a,N,Pg,"handleArchetype");this.w=a}},handle:{configurable:!0,get:function(){return this.l},set:function(a){if(null!==a&&(x(a,N,Pg,"handle"),!(a.part instanceof Te)))throw Error("new handle is not in an Adornment: "+a);this.l=a}},adornedObject:{configurable:!0,get:function(){return this.me},set:function(a){if(null!==a&&(x(a,N,
Pg,"handle"),a.part instanceof Te))throw Error("new handle must not be in an Adornment: "+a);this.me=a}},snapAngleMultiple:{configurable:!0,get:function(){return this.Oa},set:function(a){A(a,"number",Pg,"snapAngleMultiple");this.Oa=a}},snapAngleEpsilon:{configurable:!0,get:function(){return this.Na},set:function(a){A(a,"number",Pg,"snapAngleEpsilon");this.Na=a}},originalAngle:{configurable:!0,get:function(){return this.Gx}},rotationPoint:{configurable:!0,
enumerable:!0,get:function(){return this.nv}},handleAngle:{configurable:!0,get:function(){return this.L},set:function(a){A(a,"number",Pg,"handleAngle");this.L=a}},handleDistance:{configurable:!0,get:function(){return this.W},set:function(a){A(a,"number",Pg,"handleDistance");this.W=a}}});Pg.className="RotatingTool";Sa("rotatingTool",function(){return this.findTool("Rotating")},function(a){this.cb("Rotating",a,this.mouseDownTools)});
function Qg(){Oe.call(this);0<arguments.length&&za(Qg);this.name="ClickSelecting"}la(Qg,Oe);Qg.prototype.canStart=function(){return!this.isEnabled||this.isBeyondDragSize()?!1:!0};Qg.prototype.doMouseUp=function(){this.isActive&&(this.standardMouseSelect(),!this.standardMouseClick()&&this.diagram.lastInput.isTouchEvent&&this.diagram.toolManager.doToolTip());this.stopTool()};Qg.className="ClickSelectingTool";function Rg(){Oe.call(this);0<arguments.length&&za(Rg);this.name="Action";this.Qk=null}
la(Rg,Oe);Rg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram,b=a.lastInput,c=a.$b(b.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a});if(null!==c){if(!c.isActionable)return!1;this.Qk=c;a.Bj=a.$b(b.documentPoint,null,null);return!0}return!1};Rg.prototype.doMouseDown=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Qk;null!==b&&(a.targetObject=b,null!==b.actionDown&&b.actionDown(a,b))}else this.canStart()&&this.doActivate()};
Rg.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Qk;null!==b&&(a.targetObject=b,null!==b.actionMove&&b.actionMove(a,b))}};Rg.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Qk;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()};
Rg.prototype.doCancel=function(){var a=this.diagram.lastInput,b=this.Qk;null!==b&&(a.targetObject=b,null!==b.actionCancel&&b.actionCancel(a,b),this.stopTool())};Rg.prototype.doStop=function(){this.Qk=null};Rg.className="ActionTool";function Sg(){Oe.call(this);0<arguments.length&&za(Sg);this.name="ClickCreating";this.xj=null;this.w=!0;this.l=!1;this.xx=new J(0,0)}la(Sg,Oe);
Sg.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.xx=a.lastInput.viewPoint.copy()),2!==a.lastInput.clickCount||this.isBeyondDragSize(this.xx))return!1}else if(1!==a.lastInput.clickCount)return!1;return a.currentTool!==this&&null!==a.Am(a.lastInput.documentPoint,!0)?!1:!0};
Sg.prototype.doMouseUp=function(){var a=this.diagram;this.isActive&&this.insertPart(a.lastInput.documentPoint);this.stopTool()};
Sg.prototype.insertPart=function(a){var b=this.diagram,c=this.archetypeNodeData;if(null===c)return null;var d=null;try{b.U("ChangingSelection",b.selection);this.Ba(this.name);if(c instanceof S)c.bc()&&(Lg(c),d=c.copy(),null!==d&&b.add(d));else if(null!==c){var e=b.model.copyNodeData(c);Fa(e)&&(b.model.Bf(e),d=b.Dc(e))}if(null!==d){var f=J.allocAt(a.x,a.y);this.isGridSnapEnabled&&Tg(this.diagram,d,a,f);d.location=f;b.allowSelect&&(b.clearSelection(!0),d.isSelected=!0);J.free(f)}b.Ta();this.transactionResult=
this.name;b.U("PartCreated",d)}finally{this.Pg(),b.U("ChangedSelection",b.selection)}return d};
ma.Object.defineProperties(Sg.prototype,{archetypeNodeData:{configurable:!0,get:function(){return this.xj},set:function(a){null!==a&&A(a,"object",Sg,"archetypeNodeData");this.xj=a}},isDoubleClick:{configurable:!0,get:function(){return this.w},set:function(a){A(a,"boolean",Sg,"isDoubleClick");this.w=a}},isGridSnapEnabled:{configurable:!0,get:function(){return this.l},set:function(a){A(a,"boolean",Sg,"isGridSnapEnabled");this.l=a}}});Sg.className="ClickCreatingTool";
function Ug(){Oe.call(this);0<arguments.length&&za(Ug);this.name="DragSelecting";this.jl=175;this.w=!1;var a=new S;a.layerName="Tool";a.selectable=!1;var b=new Yf;b.name="SHAPE";b.figure="Rectangle";b.fill=null;b.stroke="magenta";a.add(b);this.l=a}la(Ug,Oe);
Ug.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(!a.allowSelect)return!1;var b=a.lastInput;return!b.left||a.currentTool!==this&&(!this.isBeyondDragSize()||b.timestamp-a.firstInput.timestamp<this.delay||null!==a.Am(b.documentPoint,!0))?!1:!0};Ug.prototype.doActivate=function(){var a=this.diagram;this.isActive=!0;a.isMouseCaptured=!0;a.skipsUndoManager=!0;a.add(this.box);this.doMouseMove()};
Ug.prototype.doDeactivate=function(){var a=this.diagram;a.Of();a.remove(this.box);a.skipsUndoManager=!1;this.isActive=a.isMouseCaptured=!1};Ug.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive&&null!==this.box){var b=this.computeBoxBounds(),c=this.box.fb("SHAPE");null===c&&(c=this.box.yb());var d=Hb.alloc().h(b.width,b.height);b=J.allocAt(b.x,b.y);c.desiredSize=d;this.box.position=b;Hb.free(d);J.free(b);(a.allowHorizontalScroll||a.allowVerticalScroll)&&a.Gt(a.lastInput.viewPoint)}};
Ug.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram;a.remove(this.box);try{a.currentCursor="wait",a.U("ChangingSelection",a.selection),this.selectInRect(this.computeBoxBounds()),a.U("ChangedSelection",a.selection)}finally{a.currentCursor=""}}this.stopTool()};Ug.prototype.computeBoxBounds=function(){var a=this.diagram;return new L(a.firstInput.documentPoint,a.lastInput.documentPoint)};
Ug.prototype.selectInRect=function(a){var b=this.diagram,c=b.lastInput;a=b.qy(a,this.isPartialInclusion);if(db?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 H;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(Ug.prototype,{delay:{configurable:!0,get:function(){return this.jl},set:function(a){A(a,"number",Ug,"delay");this.jl=a}},isPartialInclusion:{configurable:!0,get:function(){return this.w},set:function(a){A(a,"boolean",Ug,"isPartialInclusion");this.w=a}},box:{configurable:!0,get:function(){return this.l},set:function(a){null!==a&&x(a,S,Ug,"box");this.l=a}}});
Ug.className="DragSelectingTool";function Vg(){Oe.call(this);0<arguments.length&&za(Vg);this.name="Panning";this.kv=new J;this.fz=new J;this.Vg=!1;var a=this;this.Mx=function(){var b=a.diagram;null!==b&&b.removeEventListener(qa.document,"scroll",a.Mx,!1);a.stopTool()}}la(Vg,Oe);Vg.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};
Vg.prototype.doActivate=function(){var a=this.diagram;this.Vg?(a.lastInput.bubbles=!0,a.addEventListener(qa.document,"scroll",this.Mx,!1)):(a.currentCursor="move",a.isMouseCaptured=!0,this.kv.assign(a.position));this.isActive=!0};Vg.prototype.doDeactivate=function(){var a=this.diagram;a.currentCursor="";this.isActive=a.isMouseCaptured=!1};Vg.prototype.doCancel=function(){var a=this.diagram;a.position=this.kv;a.isMouseCaptured=!1;this.stopTool()};Vg.prototype.doMouseMove=function(){this.move()};
Vg.prototype.doMouseUp=function(){this.move();this.stopTool()};Vg.prototype.move=function(){var a=this.diagram;if(this.isActive&&a)if(this.Vg)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.fz.h(e,c)}};
ma.Object.defineProperties(Vg.prototype,{bubbles:{configurable:!0,get:function(){return this.Vg},set:function(a){A(a,"boolean",Vg,"bubbles");this.Vg=a}},originalPosition:{configurable:!0,get:function(){return this.kv}}});Vg.className="PanningTool";Sa("clickCreatingTool",function(){return this.findTool("ClickCreating")},function(a){this.cb("ClickCreating",a,this.mouseUpTools)});
Sa("clickSelectingTool",function(){return this.findTool("ClickSelecting")},function(a){this.cb("ClickSelecting",a,this.mouseUpTools)});Sa("panningTool",function(){return this.findTool("Panning")},function(a){this.cb("Panning",a,this.mouseMoveTools)});Sa("dragSelectingTool",function(){return this.findTool("DragSelecting")},function(a){this.cb("DragSelecting",a,this.mouseMoveTools)});Sa("actionTool",function(){return this.findTool("Action")},function(a){this.cb("Action",a,this.mouseDownTools)});
function bf(){this.W=this.L=this.l=this.w=null}
ma.Object.defineProperties(bf.prototype,{mainElement:{configurable:!0,get:function(){return this.L},set:function(a){null!==a&&x(a,HTMLElement,bf,"mainElement");this.L=a}},show:{configurable:!0,get:function(){return this.w},set:function(a){this.w!==a&&(null!==a&&A(a,"function",bf,"show"),this.w=a)}},hide:{configurable:!0,get:function(){return this.l},set:function(a){this.l!==a&&(null!==a&&A(a,"function",bf,"hide"),this.l=a)}},valueFunction:{configurable:!0,
enumerable:!0,get:function(){return this.W},set:function(a){this.W=a}}});bf.className="HTMLInfo";function Wg(a,b,c){this.text=a;this.by=b;this.visible=c}Wg.className="ContextMenuButtonInfo";function Xg(){Oe.call(this);0<arguments.length&&za(Xg);this.name="ContextMenu";this.w=this.Du=this.l=null;this.Cx=new J;this.Eu=null;this.Zu=!1;var a=this;this.xv=function(){a.stopTool()}}la(Xg,Oe);
function Yg(a){var b=new bf;b.show=function(a,b,c){c.showDefaultContextMenu()};b.hide=function(a,b){b.hideDefaultContextMenu()};Zg=b;a.xv=function(){a.stopTool()};b=ua("div");var c=ua("div");b.style.cssText="top: 0px;z-index:10002;position: fixed;display: none;text-align: center;left: 25%;width: 50%;background-color: #F5F5F5;padding: 16px;border: 16px solid #444;border-radius: 10px;margin-top: 10px";c.style.cssText="z-index:10001;position: fixed;display: none;top: 0;left: 0;width: 100%;height: 100%;background-color: black;opacity: 0.8;";
var d=ua("style");qa.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",$g,!1),d.addEventListener(b,"selectstart",
$g,!1),d.addEventListener(c,"contextmenu",$g,!1));b.className="goCXforeground";c.className="goCXbackground";qa.document.body&&(qa.document.body.appendChild(b),qa.document.body.appendChild(c));ah=b;bh=c;ch=!0}function $g(a){a.preventDefault();return!1}Xg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return this.isBeyondDragSize()||!a.lastInput.right?!1:a.lastInput.isTouchEvent&&null!==this.defaultTouchContextMenu||null!==this.findObjectWithContextMenu()?!0:!1};
Xg.prototype.doStart=function(){this.Cx.set(this.diagram.firstInput.documentPoint)};Xg.prototype.doStop=function(){this.hideContextMenu();this.currentObject=null};
Xg.prototype.findObjectWithContextMenu=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.lastInput,d=null;a instanceof Q||(a instanceof N?d=a:d=b.$b(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};Xg.prototype.doActivate=function(){};
Xg.prototype.doMouseDown=function(){Oe.prototype.doMouseDown.call(this);if(this.isActive&&this.currentContextMenu instanceof Te){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doMouseDown(),a.doDeactivate())}this.diagram.toolManager.mouseDownTools.contains(this)&&dh(this)};
Xg.prototype.doMouseUp=function(){if(this.isActive&&this.currentContextMenu instanceof Te){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doCancel(),a.doDeactivate())}dh(this)};
function dh(a){var b=a.diagram;if(a.isActive){var c=a.currentContextMenu;if(null!==c){if(!(c instanceof bf)){var d=b.$b(b.lastInput.documentPoint,null,null);null!==d&&d.Lg(c)&&a.standardMouseClick(null,null)}a.stopTool();a.canStart()&&(b.currentTool=a,a.doMouseUp())}}else a.canStart()&&(eh(a,!0),a.isActive||a.stopTool())}
function eh(a,b,c){void 0===c&&(c=null);if(!a.Zu&&(a.Zu=!0,b&&a.standardMouseSelect(),b=a.standardMouseClick(),a.Zu=!1,!b))if(a.isActive=!0,b=Zg,null===c&&(c=a.findObjectWithContextMenu()),null!==c){var d=c.contextMenu;null!==d?(a.currentObject=c instanceof N?c:null,a.showContextMenu(d,a.currentObject)):null!==b&&a.showContextMenu(b,a.currentObject)}else null!==b&&a.showContextMenu(b,null)}
Xg.prototype.doMouseMove=function(){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.doMouseMove();this.isActive&&this.diagram.toolManager.doMouseMove()};
Xg.prototype.showContextMenu=function(a,b){!F||a instanceof Te||a instanceof bf||v("showContextMenu:contextMenu must be an Adornment or HTMLInfo.");null!==b&&x(b,N,Xg,"showContextMenu:obj");var c=this.diagram;a!==this.currentContextMenu&&this.hideContextMenu();if(a instanceof Te){a.layerName="Tool";a.selectable=!1;a.scale=1/c.scale;a.category=this.name;null!==a.placeholder&&(a.placeholder.scale=c.scale);var d=a.diagram;null!==d&&d!==c&&d.remove(a);c.add(a);null!==b?a.adornedObject=b:a.data=c.model;
a.Fb();this.positionContextMenu(a,b)}else a instanceof bf&&a.show(b,c,this);this.currentContextMenu=a};Xg.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}};
Xg.prototype.hideContextMenu=function(){var a=this.diagram,b=this.currentContextMenu;null!==b&&(b instanceof Te?(a.remove(b),null!==this.Du&&this.Du.Mf(b.category),b.data=null,b.adornedObject=null):b instanceof bf&&(null!==b.hide?b.hide(a,this):null!==b.mainElement&&(b.mainElement.style.display="none")),this.currentContextMenu=null,this.standardMouseOver())};
function fh(a){var b=new H;b.add(new Wg("Copy",function(a){a.commandHandler.copySelection()},function(a){return a.commandHandler.canCopySelection()}));b.add(new Wg("Cut",function(a){a.commandHandler.cutSelection()},function(a){return a.commandHandler.canCutSelection()}));b.add(new Wg("Delete",function(a){a.commandHandler.deleteSelection()},function(a){return a.commandHandler.canDeleteSelection()}));b.add(new Wg("Paste",function(b){b.commandHandler.pasteSelection(a.mouseDownPoint)},function(b){return b.commandHandler.canPasteSelection(a.mouseDownPoint)}));
b.add(new Wg("Select All",function(a){a.commandHandler.selectAll()},function(a){return a.commandHandler.canSelectAll()}));b.add(new Wg("Undo",function(a){a.commandHandler.undo()},function(a){return a.commandHandler.canUndo()}));b.add(new Wg("Redo",function(a){a.commandHandler.redo()},function(a){return a.commandHandler.canRedo()}));b.add(new Wg("Scroll To Part",function(a){a.commandHandler.scrollToPart()},function(a){return a.commandHandler.canScrollToPart()}));b.add(new Wg("Zoom To Fit",function(a){a.commandHandler.zoomToFit()},
function(a){return a.commandHandler.canZoomToFit()}));b.add(new Wg("Reset Zoom",function(a){a.commandHandler.resetZoom()},function(a){return a.commandHandler.canResetZoom()}));b.add(new Wg("Group Selection",function(a){a.commandHandler.groupSelection()},function(a){return a.commandHandler.canGroupSelection()}));b.add(new Wg("Ungroup Selection",function(a){a.commandHandler.ungroupSelection()},function(a){return a.commandHandler.canUngroupSelection()}));b.add(new Wg("Edit Text",function(a){a.commandHandler.editTextBlock()},
function(a){return a.commandHandler.canEditTextBlock()}));return b}
Xg.prototype.showDefaultContextMenu=function(){var a=this.diagram;null===this.Eu&&(this.Eu=fh(this));ah.innerHTML="";bh.addEventListener("click",this.xv,!1);var b=this,c=ua("ul");c.className="goCXul";ah.appendChild(c);c.innerHTML="";for(var d=this.Eu.iterator;d.next();){var e=d.value,f=e.visible;if("function"===typeof e.by&&("function"!==typeof f||f(a))){f=ua("li");f.className="goCXli";var g=ua("a");g.className="goCXa";g.href="#";g.$y=e.by;g.addEventListener("click",function(c){this.$y(a);b.stopTool();
c.preventDefault();return!1},!1);g.textContent=e.text;f.appendChild(g);c.appendChild(f)}}ah.style.display="block";bh.style.display="block"};Xg.prototype.hideDefaultContextMenu=function(){if(null!==this.currentContextMenu&&this.currentContextMenu===Zg){ah.style.display="none";bh.style.display="none";var a=this.diagram;null!==a&&a.removeEventListener(bh,"click",this.xv,!1);this.currentContextMenu=null}};
ma.Object.defineProperties(Xg.prototype,{currentContextMenu:{configurable:!0,get:function(){return this.l},set:function(a){!F||null===a||a instanceof Te||a instanceof bf||v("ContextMenuTool.currentContextMenu must be an Adornment or HTMLInfo.");this.l=a;this.Du=a instanceof Te?a.adornedPart:null}},defaultTouchContextMenu:{configurable:!0,get:function(){!1===ch&&null===Zg&&gh&&Yg(this);return Zg},set:function(a){!F||null===a||a instanceof Te||a instanceof bf||v("ContextMenuTool.defaultTouchContextMenu must be an Adornment or HTMLInfo.");
null===a&&(ch=!0);Zg=a}},currentObject:{configurable:!0,get:function(){return this.w},set:function(a){null!==a&&x(a,N,Xg,"currentObject");this.w=a}},mouseDownPoint:{configurable:!0,get:function(){return this.Cx}}});var Zg=null,ch=!1,bh=null,ah=null;Xg.className="ContextMenuTool";Sa("contextMenuTool",function(){return this.findTool("ContextMenu")},function(a){this.cb("ContextMenu",a,this.mouseUpTools)});
function hh(){0<arguments.length&&za(hh);Oe.call(this);this.name="TextEditing";this.Dh=new ih;this.Oa=null;this.Na=jh;this.Yi=null;this.oa=kh;this.L=1;this.W=!0;this.w=null;this.l=new bf;this.Iu=null;lh(this,this.l)}la(hh,Oe);
function lh(a,b){if(gh){var c=ua("textarea");a.Iu=c;c.addEventListener("input",function(){if(null!==a.textBlock){var b=a.Gy(this.value);this.style.width=20+b.measuredBounds.width*this.$A+"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(mh)):9===c?(a.acceptText(nh),b.preventDefault()):27===c&&(a.doCancel(),null!==a.diagram&&a.diagram.doFocus())}},!1);c.addEventListener("focus",
function(){if(null!==a.currentTextEditor&&a.state!==kh){var b=a.Iu;a.oa===oh&&(a.oa=ph);"function"===typeof b.select&&a.selectsTextOnActivate&&(b.select(),b.setSelectionRange(0,9999))}},!1);c.addEventListener("blur",function(){if(null!==a.currentTextEditor&&a.state!==kh){var b=a.Iu;"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 ih&&f instanceof hh)if(f.state===qh)c.style.border="3px solid red",c.focus();else{var d=a.ma(Mc),e=b.position,k=b.scale,l=a.Gf()*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.$A=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)}}}
hh.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(null===a||a.isReadOnly||rh&&rh!==this&&(rh.acceptText(sh),rh&&rh!==this)||!a.lastInput.left||this.isBeyondDragSize())return!1;var b=a.$b(a.lastInput.documentPoint);if(!(null!==b&&b instanceof ih&&b.editable&&b.part.canEdit()))return!1;b=b.part;return null===b||this.starting===jh&&!b.isSelected||this.starting===th&&2>a.lastInput.clickCount?!1:!0};hh.prototype.doStart=function(){rh=this;null!==this.textBlock&&this.doActivate()};
hh.prototype.doActivate=function(){if(!this.isActive){var a=this.diagram;if(null!==a){var b=this.textBlock;null===b&&(b=a.$b(a.lastInput.documentPoint));if(null!==b&&b instanceof ih&&(this.textBlock=b,null!==b.part)){this.isActive=!0;this.oa=oh;var c=this.defaultTextEditor;null!==b.textEditor&&(c=b.textEditor);this.Dh=this.textBlock.copy();var d=new L(this.textBlock.ma(Hc),this.textBlock.ma(Sc));a.Cw(d);c.show(b,a,this);this.currentTextEditor=c}}}};hh.prototype.doCancel=function(){this.stopTool()};
hh.prototype.doMouseUp=function(){this.canStart()&&this.doActivate()};hh.prototype.doMouseDown=function(){this.isActive&&this.acceptText(sh)};hh.prototype.acceptText=function(a){switch(a){case sh:if(this.oa===uh)this.currentTextEditor instanceof HTMLElement&&this.currentTextEditor.focus();else if(this.oa===oh||this.oa===qh||this.oa===ph)this.oa=vh,wh(this);break;case xh:case mh:case nh:if(mh!==a||!0!==this.textBlock.isMultiline)if(this.oa===oh||this.oa===qh||this.oa===ph)this.oa=vh,wh(this)}};
function wh(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.Ba(a.name),a.oa=uh,a.transactionResult=a.name,b.text=f,d=a.textBlock,null!==d.textEdited&&d.textEdited(d,e,f),null!==c&&c.U("TextEdited",b,e),a.Pg(),a.stopTool(),null!==c&&c.doFocus();else{a.oa=qh;var g=a.textBlock;null!==g.errorFunction&&g.errorFunction(a,e,f);d.show(b,c,a)}}}
hh.prototype.doDeactivate=function(){var a=this.diagram;null!==a&&(this.oa=kh,this.textBlock=null,null!==this.currentTextEditor&&this.currentTextEditor.hide(a,this),this.isActive=!1)};hh.prototype.doStop=function(){rh=null};hh.prototype.isValidText=function(a,b,c){x(a,ih,hh,"isValidText:textblock");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};hh.prototype.Gy=function(a){var b=this.Dh;b.text=a;b.measure(this.textBlock.Gi,Infinity);return b};
ma.Object.defineProperties(hh.prototype,{textBlock:{configurable:!0,get:function(){return this.Oa},set:function(a){null!==a&&x(a,ih,hh,"textBlock");this.Oa=a}},currentTextEditor:{configurable:!0,get:function(){return this.w},set:function(a){this.w=a}},defaultTextEditor:{configurable:!0,get:function(){return this.l},set:function(a){!F||a instanceof bf||v("TextEditingTool.defaultTextEditor must be an HTMLInfo.");this.l=a}},starting:{configurable:!0,
get:function(){return this.Na},set:function(a){hb(a,hh,hh,"starting");this.Na=a}},textValidation:{configurable:!0,get:function(){return this.Yi},set:function(a){null!==a&&A(a,"function",hh,"textValidation");this.Yi=a}},minimumEditorScale:{configurable:!0,get:function(){return this.L},set:function(a){null!==a&&A(a,"number",hh,"minimumEditorScale");this.L=a}},selectsTextOnActivate:{configurable:!0,get:function(){return this.W},set:function(a){null!==a&&A(a,
"boolean",hh,"selectsTextOnActivate");this.W=a}},state:{configurable:!0,get:function(){return this.oa},set:function(a){this.oa!==a&&(hb(a,hh,hh,"starting"),this.oa=a)}}});hh.prototype.measureTemporaryTextBlock=hh.prototype.Gy;
var xh=new E(hh,"LostFocus",0),sh=new E(hh,"MouseDown",1),nh=new E(hh,"Tab",2),mh=new E(hh,"Enter",3),yh=new E(hh,"SingleClick",0),jh=new E(hh,"SingleClickSelected",1),th=new E(hh,"DoubleClick",2),kh=new E(hh,"StateNone",0),oh=new E(hh,"StateActive",1),ph=new E(hh,"StateEditing",2),vh=new E(hh,"StateValidating",3),qh=new E(hh,"StateInvalid",4),uh=new E(hh,"StateValidated",5),rh=null;hh.className="TextEditingTool";hh.LostFocus=xh;hh.MouseDown=sh;hh.Tab=nh;hh.Enter=mh;hh.SingleClick=yh;
hh.SingleClickSelected=jh;hh.DoubleClick=th;hh.StateNone=kh;hh.StateActive=oh;hh.StateEditing=ph;hh.StateValidating=vh;hh.StateInvalid=qh;hh.StateValidated=uh;Sa("textEditingTool",function(){return this.findTool("TextEditing")},function(a){this.cb("TextEditing",a,this.mouseUpTools)});
function zh(){Ah||(Bh(),Ah=!0);this.B=Pe;this.vl=this.lf=this.wc=this.ts=this.nc=!1;this.Rx=!0;this.wl=Ch;this.vn=!1;this.Ci=this.gd=!0;this.dh=600;this.ox=this.Qx=!1;this.We=new I;this.Kd=new Dh;this.Kd.Sc=this;this.Rk=new I;this.uv=new I;this.rt=new I}zh.prototype.he=function(a){this.B=a};zh.prototype.canStart=function(){return!0};function Eh(a,b){Fh(a,b)&&(a.lf=!0)}function Fh(a,b){if(!a.gd||!a.canStart(b))return!1;a.We.add(b);a.defaultAnimation.isAnimating&&a.dd();return a.wc=!0}
function Gh(a){if(a.gd&&a.wc){var b=a.Kd,c=a.B,d=a.We.contains("Model");d&&(a.vl=!0,a.wl===Ch?(b.isViewportUnconstrained=!0,b.pc.clear(),b.add(c,"position",c.position.copy().offset(0,-200),c.position),b.add(c,"opacity",0,1)):a.wl===Th&&b.pc.clear(),a.Rx=a.wl===Uh&&c.Zs.A(c.sa)?!0:!1,c.U("InitialAnimationStarting",a));d&&!a.Ci||0===b.pc.count?(a.We.clear(),a.wc=!1,a.lf=!1,b.pc.clear(),Vh(b),a.vl=!1,c.P()):(a.We.clear(),c.Me=!1,d=b.pc.get(c),c.autoScale!==Wh&&null!==d&&(delete d.start.scale,delete d.end.scale),
qa.requestAnimationFrame(function(){!1===a.wc||b.nc||(c.Re("temporaryPixelRatio")&&hf(c),Xh(c),a.wc=!1,a.lf=!1,b.start(),Yh(a),c.Ta(),Zh(b,0),Vf(c,!0),$h(a),c.U("AnimationStarting",a))}))}}function ai(a,b,c,d){b instanceof R&&(null!==b.fromNode||null!==b.toNode)||a.Kd.add(b,"position",c,d,!1)}t=zh.prototype;t.cu=function(a){return this.Kd.cu(a)};t.gw=function(a){return this.Kd.gw(a)};
function bi(a,b){function c(){0<e.rt.count&&(d.addAll(e.rt),e.rt.clear(),e.nc=!0);if(!1!==e.nc&&0!==d.count){e.uv.addAll(d);for(var a=e.uv.iterator;a.next();){var b=a.value;if(!1!==b.nc){a:if(0<b.mm.count)var h=!0;else{for(h=b.pc.iterator;h.next();){var k=h.key;if(k instanceof N&&null!==k.diagram||k instanceof Q){h=!0;break a}}h=!1}h?ci(b,!1):b.El=!0}}e.uv.clear();Yh(e);Vf(e.B);$h(e);qa.requestAnimationFrame(c)}}var d=a.Rk,e=a;a.nc?a.rt.add(b):(a.nc=!0,d.add(b),qa.requestAnimationFrame(function(){c()}))}
function di(a){for(a=a.Rk.iterator;a.next();)a.value.El=!1}function Yh(a){if(!a.ts){var b=a.B;a.Qx=b.skipsUndoManager;a.ox=b.skipsModelSourceBindings;b.skipsUndoManager=!0;b.skipsModelSourceBindings=!0;a.ts=!0}}function $h(a){var b=a.B;b.skipsUndoManager=a.Qx;b.skipsModelSourceBindings=a.ox;a.ts=!1}
t.dd=function(a){var b=this.Kd;!0===this.wc&&(this.vl=this.lf=this.wc=!1,this.We.clear(),0<b.pc.count&&this.B.Hb());if(this.nc){if(b.xm(!0),b.pc.clear(),Vh(b),!0===a)for(a=this.Rk.ua(),b=0;b<a.length;b++)a[b].xm(!0)}else b.pc.clear(),Vh(b)};t.xm=function(a){a===this.defaultAnimation&&this.defaultAnimation.pc.clear();this.Rk.remove(a);0===this.Rk.count&&(this.nc=!1,this.B.Hb());a===this.defaultAnimation&&(this.defaultAnimation.pc.clear(),this.B.U("AnimationFinished",this))};
t.jk=function(a,b){this.lf&&(this.We.contains("Expand Tree")||this.We.contains("Expand SubGraph"))&&this.Kd.jk(a,b)};t.hk=function(a,b){this.lf&&(this.We.contains("Collapse Tree")||this.We.contains("Collapse SubGraph"))&&(this.Kd.hk(a,b),ei(this.Kd,b,"position",b.position,b.position))};function fi(a,b,c){a.lf&&!b.A(c)&&(a.B.zk||(b=c.copy()),ei(a.Kd,a.B,"position",b,c))}
function gi(a,b,c,d,e){null===a&&(a="rgba(0,0,0,0)");null===b&&(b="rgba(0,0,0,0)");hi(a);ii();var f=ji.l,g=ji.L,h=ji.w;a=ji.W;hi(b);ii();var k=ji.L,l=ji.w;b=ji.W;f=e(c,f,ji.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 Bh(){var a=new Db;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.ir(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.ir(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.ir(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.ir(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 L(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=gi(c,d,f,g,e)});a.add("stroke",function(a,c,d,e,f,g){a.stroke=gi(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=gi(c,d,f,g,e)});a.add("areaBackground",function(a,c,d,e,f,g){a.areaBackground=gi(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)});ki=a}
ma.Object.defineProperties(zh.prototype,{animationReasons:{configurable:!0,get:function(){return this.We}},isEnabled:{configurable:!0,get:function(){return this.gd},set:function(a){A(a,"boolean",zh,"isEnabled");this.gd=a}},duration:{configurable:!0,get:function(){return this.dh},set:function(a){A(a,"number",zh,"duration");1>a&&ya(a,">= 1",zh,"duration");this.dh=a}},isAnimating:{configurable:!0,get:function(){return this.nc}},isTicking:{configurable:!0,
enumerable:!0,get:function(){return this.ts}},isInitial:{configurable:!0,get:function(){return this.Ci},set:function(a){A(a,"boolean",zh,"isInitial");this.Ci=a}},defaultAnimation:{configurable:!0,get:function(){return this.Kd}},activeAnimations:{configurable:!0,get:function(){return this.Rk}},initialAnimationStyle:{configurable:!0,get:function(){return this.wl},set:function(a){F&&hb(a,zh,zh,"initialAnimationStyle");this.wl=a}}});
zh.prototype.stopAnimation=zh.prototype.dd;var ki=null,Ah=!1,Ch=new E(zh,"Default",1),Uh=new E(zh,"AnimateLocations",2),Th=new E(zh,"None",3);zh.className="AnimationManager";zh.defineAnimationEffect=function(a,b){Ah||(Bh(),Ah=!0);ki.add(a,b)};zh.Default=Ch;zh.AnimateLocations=Uh;zh.None=Th;
function Dh(){this.yv=this.Px=this.Sc=this.B=null;this.El=this.nc=this.l=!1;this.$n=this.Ad=0;this.Nr=this.Lu=li;this.Dl=this.Gp=!1;this.ov=1;this.mv=0;this.td=this.dh=NaN;this.sx=0;this.ao=null;this.w=Rb;this.pc=new Db;this.iv=new Db;this.mm=new I;this.jv=new I;this.px=mi}Dh.prototype.suspend=function(){this.El=!0};Dh.prototype.advanceTo=function(a,b){b&&(this.El=!1);this.Gp&&a>=this.td&&(this.Dl=!0,a-=this.td);this.sx=a;ci(this,!0);Yh(this.Sc);Vf(this.B);$h(this.Sc);this.B.ge()};
function Vh(a){a.iv.clear();a.Dl=!1;a.mv=0;a.td=NaN;0<a.mm.count&&a.mm.clear();0<a.jv.count&&a.jv.clear()}t=Dh.prototype;
t.start=function(){if(0!==this.pc.count&&!this.nc){for(var a=this.B,b=this.pc.iterator;b.next();){var c=b.value.end,d=b.key;if(c["position:placeholder"]){var e=d.findVisibleNode();if(e instanceof Hf&&null!==e.placeholder){var f=e.placeholder;e=f.ma(Hc);f=f.padding;e.x+=f.left;e.y+=f.top;c["position:placeholder"]=e}}null===a&&(d instanceof Q?a=d:d instanceof N&&(a=d.diagram))}null!==a&&(this.B=a,b=this.Sc=a.animationManager,!1!==b.isEnabled&&(this.td=isNaN(this.dh)?b.duration:this.dh,this.Nr=this.Lu,
b.vl&&b.wl===Ch&&this===b.defaultAnimation&&(this.Nr=ni,this.td=isNaN(this.dh)?600===b.duration?900:b.duration:this.dh),this.px=a.scrollMode,this.isViewportUnconstrained&&(a.Vi=oi),Yh(b),this.mm.each(function(b){b.data=null;a.add(b)}),$h(b),this.nc=!0,this.Ad=+new Date,this.$n=this.Ad+this.td,bi(b,this)))}};
t.nz=function(a,b){a.bc()&&(F&&(void 0===b&&v("addTemporaryPart: Required Diagram argument missing"),a.diagram===b&&v("addTemporaryPart: Part already in Diagram, did you mean to pass in a copy?"),null!==this.B&&this.B!==b&&v("addTemporaryPart: A different Diagram is already associated with this Animation: "+this.B.toString())),this.mm.add(a),this.B=b)};
t.add=function(a,b,c,d,e){"position"===b&&c.A(d)||(null===this.B&&(a instanceof Q?this.B=a:a instanceof N&&null!==a.diagram&&(this.B=a.diagram)),a instanceof S&&!a.isAnimated||ei(this,a,b,c,d,e))};
function ei(a,b,c,d,e,f){var g=a.pc;b instanceof Q&&"position"===c&&(c="position:diagram");if(g.contains(b)){var h=g.K(b);var k=h.start;var l=h.end;void 0===k[c]&&(k[c]=pi(d));l[c]=pi(e)}else k={},l={},k[c]=pi(d),l[c]=pi(e),h=k.position,b instanceof N&&h instanceof J&&!h.o()&&b.diagram.animationManager.We.contains("Expand SubGraph")&&h.assign(l.position),h=new qi(k,l,f),g.add(b,h);g=k[c];g instanceof J&&!g.o()&&g.assign(a.w);f&&0===c.indexOf("position:")&&b instanceof S?h.Sv.location=pi(b.location):
f&&(h.Sv[c]=pi(d))}function pi(a){return a instanceof J?a.copy():a instanceof Hb?a.copy():a}t.cu=function(a){if(!this.nc)return!1;a=this.pc.K(a);return null!==a&&a.tw};t.gw=function(a){if(!this.nc)return!1;a=this.pc.K(a);return null!==a&&(a.start.position||a.start.location)};
function ci(a,b){if(!a.El||b){var c=a.Sc;if(!1!==a.nc){var d=+new Date,e=d>a.$n?a.td:d-a.Ad;b&&(e=a.sx,e<a.td?(a.Ad=+new Date-e,a.$n=a.Ad+a.td):e=a.td);Yh(c);Zh(a,e);Vf(a.B,!0);$h(c);d>a.$n&&(a.Gp&&!a.Dl?(a.Ad=+new Date,a.$n=a.Ad+a.td,a.Dl=!0):a.xm(!1))}}}
function Zh(a,b){for(var c=a.td,d=a.pc.iterator,e=a.Dl;d.next();){var f=d.key;if(!(f instanceof N&&null===f.diagram)){var g=d.value,h=e?g.end:g.start;g=e?g.start:g.end;var k=ki,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.Nr,b,c,a)}}}t.stop=function(){this.nc&&this.xm(!0)};
t.xm=function(a){null!==this.yv&&this.yv.Np.remove(this.Px);if(this.nc){var b=this.B,c=this.Sc;this.El=this.nc=c.vl=!1;Yh(c);for(var d=this.pc,e=this.mm.iterator;e.next();)b.remove(e.value);for(e=this.jv.iterator;e.next();)e.value.u();e=this.Gp;d=d.iterator;for(var f=ki;d.next();){var g=d.key,h=d.value,k=e?h.end:h.start,l=e?h.start:h.end,m=h.Sv,n;for(n in l)if(null!==f.get(n)){var p=n;!h.Lv||"position:node"!==p&&"position:placeholder"!==p||(p="position");f.get(p)(g,k[n],void 0!==m[n]?m[n]:h.Lv?k[n]:
l[n],this.Nr,this.td,this.td,this)}h.Lv&&void 0!==m.location&&g instanceof S&&(g.location=m.location);h.tw&&g instanceof S&&g.Vb(!1)}if(c.defaultAnimation===this)for(n=this.B.links;n.next();)e=n.value,null===e.wh?(d=e.path,null!==d&&(e.rd=!1,e.u(),d.u())):(e.points=e.wh,e.wh=null);b.Yt.clear();wf(b,!1);b.Ta();b.P();Vf(b,!0);this.isViewportUnconstrained&&(b.scrollMode=this.px);$h(c);this.mv++;!a&&this.ov>this.mv?(this.Dl=!1,this.start()):(this.ao&&this.ao(this),Vh(this),c.xm(this),b.Hb())}};
t.jk=function(a,b){var c=b.actualBounds,d=null;b instanceof Hf&&(d=b.placeholder);null!==d?(c=d.ma(Hc),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 Hf)for(a=a.memberParts;a.next();)d=a.value,d instanceof T&&this.jk(d,b)};
t.hk=function(a,b){if(a.isVisible()){var c=null;b instanceof Hf&&(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.pc;c.contains(a)&&(c.K(a).tw=!0);if(a instanceof Hf)for(a=a.memberParts;a.next();)c=a.value,c instanceof T&&this.hk(c,b)}};t.lA=function(a){var b=this.iv.get(a);null===b&&(b={},this.iv.add(a,b));return b};
ma.Object.defineProperties(Dh.prototype,{duration:{configurable:!0,get:function(){return this.dh},set:function(a){A(a,"number",Dh,"duration");1>a&&ya(a,">= 1",Dh,"duration");this.dh=a}},reversible:{configurable:!0,get:function(){return this.Gp},set:function(a){this.Gp=a}},runCount:{configurable:!0,get:function(){return this.ov},set:function(a){0<a?this.ov=a:v("Animation.runCount value must be a positive integer.")}},finished:{configurable:!0,
get:function(){return this.ao},set:function(a){this.ao!==a&&(null!==a&&A(a,"function",Q,"click"),this.ao=a)}},easing:{configurable:!0,get:function(){return this.Lu},set:function(a){this.Lu=a}},isViewportUnconstrained:{configurable:!0,get:function(){return this.l},set:function(a){this.l=a}},isAnimating:{configurable:!0,get:function(){return this.nc}}});Dh.prototype.getTemporaryState=Dh.prototype.lA;Dh.prototype.stop=Dh.prototype.stop;Dh.prototype.add=Dh.prototype.add;
Dh.prototype.addTemporaryPart=Dh.prototype.nz;function li(a,b,c,d){a/=d/2;return 1>a?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b}function ni(a,b,c,d){return a===d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b}Dh.className="Animation";Dh.EaseLinear=function(a,b,c,d){return c*a/d+b};Dh.EaseInOutQuad=li;Dh.EaseInQuad=function(a,b,c,d){return c*(a/=d)*a+b};Dh.EaseOutQuad=function(a,b,c,d){return-c*(a/=d)*(a-2)+b};Dh.EaseInExpo=function(a,b,c,d){return 0===a?b:c*Math.pow(2,10*(a/d-1))+b};Dh.EaseOutExpo=ni;
function qi(a,b,c){this.start=a;this.end=b;this.Sv={};this.Lv=c;this.tw=!1}qi.className="AnimationState";function ri(a,b,c){this.jd=null;this.nf=a;this.gq=c||si;this.Wk=null;void 0!==b&&(this.Wk=b,void 0===c&&(this.gq=ti))}ri.prototype.copy=function(){var a=new ri(this.nf);a.gq=this.gq;var b=this.Wk;if(null!==b){var c={};void 0!==b.duration&&(c.ly=b.duration);void 0!==b.finished&&(c.ly=b.finished);void 0!==b.easing&&(c.ly=b.easing);a.Wk=c}return a};
function ui(a,b){a=a.Wk;null!==a&&(a.duration&&(b.duration=a.duration),a.finished&&(b.finished=a.finished),a.easing&&(b.easing=a.easing))}
ma.Object.defineProperties(ri.prototype,{propertyName:{configurable:!0,get:function(){return this.nf},set:function(a){this.nf=a}},animationSettings:{configurable:!0,get:function(){return this.Wk},set:function(a){this.Wk=a}},startCondition:{configurable:!0,get:function(){return this.gq},set:function(a){F&&hb(a,ri,ri,"startCondition");this.gq=a}}});var si=new E(ri,"Default",1),ti=new E(ri,"Immediate",2),vi=new E(ri,"Bundled",3);ri.className="AnimationTrigger";
ri.Default=si;ri.Immediate=ti;ri.Bundled=vi;function wi(){0<arguments.length&&za(wi);fb(this);this.B=null;this.Ha=new H;this.Wa="";this.wb=1;this.w=!1;this.Qi=this.L=this.mi=this.li=this.ki=this.ji=this.hi=this.ii=this.gi=this.oi=this.fi=this.ni=this.ei=this.di=!0;this.l=!1;this.sp=[]}t=wi.prototype;t.clear=function(){this.Ha.clear();this.sp.length=0};t.he=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.Ha.iterator;h.next();){var k=h.value;k instanceof Hf?e++:k instanceof T?d++:k instanceof R?f++:k instanceof Te?g++:c++}h="";0<c&&(h+=c+" Parts ");0<d&&(h+=d+" Nodes ");0<e&&(h+=e+" Groups ");0<f&&(h+=f+" Links ");0<g&&(h+=g+" Adornments ");if(1<a)for(a=this.Ha.iterator;a.next();)c=a.value,h+="\n    "+c.toString(),d=c.data,null!==d&&sb(d)&&(h+=" #"+sb(d)),c instanceof T?h+=" "+
Qa(d):c instanceof R&&(h+=" "+Qa(c.fromNode)+" "+Qa(c.toNode));return b+" "+this.Ha.count+": "+h};
t.$b=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);if(!1===this.Qi)return null;F&&!a.o()&&v("findObjectAt: Point must have a real value, not: "+a.toString());var d=!1;null!==this.diagram&&this.diagram.viewportBounds.fa(a)&&(d=!0);for(var e=J.alloc(),f=this.Ha.j,g=f.length;g--;){var h=f[g];if((!0!==d||!1!==Jg(h))&&h.isVisible()&&(e.assign(a),Jb(e,h.Cd),h=h.$b(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 H||d instanceof I||(d=new I);if(!1===this.Qi)return d;F&&!a.o()&&v("findObjectsAt: Point must have a real value, not: "+a.toString());var e=!1;null!==this.diagram&&this.diagram.viewportBounds.fa(a)&&(e=!0);for(var f=J.alloc(),g=this.Ha.j,h=g.length;h--;){var k=g[h];if((!0!==e||!1!==Jg(k))&&k.isVisible()){f.assign(a);Jb(f,k.Cd);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.Ff=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof H||e instanceof I||(e=new I);if(!1===this.Qi)return e;F&&!a.o()&&v("findObjectsIn: Rect must have a real value, not: "+a.toString());var f=!1;null!==this.diagram&&this.diagram.viewportBounds.Pe(a)&&(f=!0);for(var g=this.Ha.j,h=g.length;h--;){var k=g[h];if((!0!==f||!1!==Jg(k))&&k.isVisible()){var l=k;k.Ff(a,b,c,d,e)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||e.add(l))}}return e};
t.Xv=function(a,b,c,d,e,f,g){if(!1===this.Qi)return e;for(var h=this.Ha.j,k=h.length;k--;){var l=h[k];if((!0!==g||!1!==Jg(l))&&f(l)&&l.isVisible()){var m=l;l.Ff(a,b,c,d,e)&&(null!==b&&(m=b(m)),null===m||null!==c&&!c(m)||e.add(m))}}return e};
t.Jg=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 H||e instanceof I)f=e;e=!0}f instanceof H||f instanceof I||(f=new I);if(!1===this.Qi)return f;F&&!a.o()&&v("findObjectsNear: Point must have a real value, not: "+a.toString());var g=!1;null!==this.diagram&&this.diagram.viewportBounds.fa(a)&&(g=!0);for(var h=J.alloc(),k=J.alloc(),l=this.Ha.j,m=l.length;m--;){var n=l[m];if((!0!==g||!1!==Jg(n))&&n.isVisible()){h.assign(a);Jb(h,n.Cd);
k.h(a.x+b,a.y);Jb(k,n.Cd);var p=n;n.Jg(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.Hd=function(a,b){if(this.visible){var c=void 0===b?a.viewportBounds:b;var d=this.Ha.j,e=d.length;a=La();b=La();for(var f=0;f<e;f++){var g=d[f];g.Ax=f;g instanceof R&&!1===g.rd||g instanceof Te&&null!==g.adornedPart||(nc(g.actualBounds,c)?(g.Hd(!0),a.push(g)):(g.Hd(!1),null!==g.adornments&&0<g.adornments.count&&b.push(g)))}for(c=0;c<a.length;c++)for(d=a[c],xi(d),d=d.adornments;d.next();)e=d.value,e.measure(Infinity,Infinity),e.arrange(),e.Hd(!0);for(c=0;c<b.length;c++)d=b[c],d.updateAdornments(),
yi(d,!0);Oa(a);Oa(b)}};function zi(a,b){var c=1;1!==a.wb&&(c=b.globalAlpha,b.globalAlpha=c*a.wb);return c}t.hc=function(a,b,c){if(this.visible&&0!==this.wb&&(void 0===c&&(c=!0),c||!this.isTemporary)){c=this.Ha.j;var d=c.length;if(0!==d){var e=zi(this,a),f=this.sp;f.length=0;for(var g=b.scale,h=L.alloc(),k=0;k<d;k++)this.dj(a,c[k],b,f,g,h);L.free(h);a.globalAlpha=e}}};
t.dj=function(a,b,c,d,e,f){if(null!==d&&b instanceof R&&(b.isOrthogonal&&d.push(b),!1===b.rd))return;var g=b.actualBounds;d=!1;var h=b.containingGroup;if(null!==h&&h.isClipping&&h.type!==U.Spot&&b.isVisible()){d=h.resizeObject;d instanceof U&&(d=d.yb());d.Cm(f);d instanceof Yf&&f.Lc(-d.strokeWidth,-d.strokeWidth);if(!f.Oc(g))return;d=!f.Pe(g)}d&&(a.save(),a.beginPath(),a.rect(f.x,f.y,f.width,f.height),a.clip());g.width*e>c.Vo||g.height*e>c.Vo?b.hc(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&&(Ai(b,a,b.areaBackground,!0,!0,f,e),a.fillRect(e.x,e.y,e.width,e.height)),null===b.areaBackground&&null===b.background&&(Ai(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),Ai(b,a,b.background,!0,!1,f,e),a.fillRect(0,0,f.width/2,f.height/2),c.Vt()||(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.yc(!0))};t.g=function(a,b,c,d,e){var f=this.diagram;null!==f&&f.gb(He,a,this,b,c,d,e)};t.nj=function(a,b,c){var d=this.Ha;b.Hi=this;if(a>=d.count)a=d.count;else if(d.O(a)===b)return-1;d.zb(a,b);b.Nq(c);d=this.diagram;null!==d&&(c?d.P():d.nj(b));Bi(this,a,b);return a};
t.Nc=function(a,b,c){if(!c&&b.layer!==this&&null!==b.layer)return b.layer.Nc(a,b,c);var d=this.Ha;if(0>a||a>=d.length){if(a=d.indexOf(b),0>a)return-1}else if(d.O(a)!==b&&(a=d.indexOf(b),0>a))return-1;b.Oq(c);d.hb(a);d=this.diagram;null!==d&&(c?d.P():d.Nc(b));b.Hi=null;return a};
function Bi(a,b,c){b=Ci(a,b,c);if(c instanceof Hf&&null!==c&&isNaN(c.zOrder)){if(0!==c.memberParts.count){for(var d=-1,e=a.Ha.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.Ha,e.hb(b),e.zb(d,c))}c=c.containingGroup;null!==c&&Bi(a,-1,c)}}
function Ci(a,b,c){var d=c.zOrder;if(isNaN(d))return b;a=a.Ha;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.O(f).zOrder;if(!isNaN(g))break;f--}for(var h=b+1,k=NaN;h<e;){k=a.O(h).zOrder;if(!isNaN(k))break;h++}if(!isNaN(g)&&g>d)for(;;){if(-1===f||g<=d){f++;if(f===b)break;a.hb(b);a.zb(f,c);return f}for(g=NaN;0<=--f&&(g=a.O(f).zOrder,isNaN(g)););}else if(!isNaN(k)&&k<d)for(;;){if(h===e||k>=d){h--;if(h===b)break;a.hb(b);a.zb(h,c);return h}for(k=NaN;++h<
e&&(k=a.O(h).zOrder,isNaN(k)););}return b}
ma.Object.defineProperties(wi.prototype,{parts:{configurable:!0,get:function(){return this.Ha.iterator}},partsBackwards:{configurable:!0,get:function(){return this.Ha.iteratorBackwards}},diagram:{configurable:!0,get:function(){return this.B}},name:{configurable:!0,get:function(){return this.Wa},set:function(a){A(a,"string",wi,"name");var b=this.Wa;if(b!==a){var c=this.diagram;if(null!==c)for(""===b&&v("Cannot rename default Layer to: "+a),c=
c.layers;c.next();)c.value.name===a&&v("Layer.name is already present in this diagram: "+a);this.Wa=a;this.g("name",b,a);for(a=this.Ha.iterator;a.next();)a.value.layerName=this.Wa}}},opacity:{configurable:!0,get:function(){return this.wb},set:function(a){var b=this.wb;b!==a&&(A(a,"number",wi,"opacity"),(0>a||1<a)&&ya(a,"0 <= value <= 1",wi,"opacity"),this.wb=a,this.g("opacity",b,a),a=this.diagram,null!==a&&a.P())}},isTemporary:{configurable:!0,get:function(){return this.w},
set:function(a){var b=this.w;b!==a&&(A(a,"boolean",wi,"isTemporary"),this.w=a,this.g("isTemporary",b,a))}},visible:{configurable:!0,get:function(){return this.L},set:function(a){var b=this.L;if(b!==a){A(a,"boolean",wi,"visible");this.L=a;this.g("visible",b,a);for(b=this.Ha.iterator;b.next();)b.value.Vb(a);a=this.diagram;null!==a&&a.P()}}},pickable:{configurable:!0,get:function(){return this.Qi},set:function(a){var b=this.Qi;b!==a&&(A(a,"boolean",wi,"pickable"),this.Qi=
a,this.g("pickable",b,a))}},isBoundsIncluded:{configurable:!0,get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a,null!==this.diagram&&this.diagram.Ta())}},allowCopy:{configurable:!0,get:function(){return this.di},set:function(a){var b=this.di;b!==a&&(A(a,"boolean",wi,"allowCopy"),this.di=a,this.g("allowCopy",b,a))}},allowDelete:{configurable:!0,get:function(){return this.ei},set:function(a){var b=this.ei;b!==a&&(A(a,"boolean",wi,"allowDelete"),
this.ei=a,this.g("allowDelete",b,a))}},allowTextEdit:{configurable:!0,get:function(){return this.ni},set:function(a){var b=this.ni;b!==a&&(A(a,"boolean",wi,"allowTextEdit"),this.ni=a,this.g("allowTextEdit",b,a))}},allowGroup:{configurable:!0,get:function(){return this.fi},set:function(a){var b=this.fi;b!==a&&(A(a,"boolean",wi,"allowGroup"),this.fi=a,this.g("allowGroup",b,a))}},allowUngroup:{configurable:!0,get:function(){return this.oi},set:function(a){var b=
this.oi;b!==a&&(A(a,"boolean",wi,"allowUngroup"),this.oi=a,this.g("allowUngroup",b,a))}},allowLink:{configurable:!0,get:function(){return this.gi},set:function(a){var b=this.gi;b!==a&&(A(a,"boolean",wi,"allowLink"),this.gi=a,this.g("allowLink",b,a))}},allowRelink:{configurable:!0,get:function(){return this.ii},set:function(a){var b=this.ii;b!==a&&(A(a,"boolean",wi,"allowRelink"),this.ii=a,this.g("allowRelink",b,a))}},allowMove:{configurable:!0,get:function(){return this.hi},
set:function(a){var b=this.hi;b!==a&&(A(a,"boolean",wi,"allowMove"),this.hi=a,this.g("allowMove",b,a))}},allowReshape:{configurable:!0,get:function(){return this.ji},set:function(a){var b=this.ji;b!==a&&(A(a,"boolean",wi,"allowReshape"),this.ji=a,this.g("allowReshape",b,a))}},allowResize:{configurable:!0,get:function(){return this.ki},set:function(a){var b=this.ki;b!==a&&(A(a,"boolean",wi,"allowResize"),this.ki=a,this.g("allowResize",b,a))}},allowRotate:{configurable:!0,
enumerable:!0,get:function(){return this.li},set:function(a){var b=this.li;b!==a&&(A(a,"boolean",wi,"allowRotate"),this.li=a,this.g("allowRotate",b,a))}},allowSelect:{configurable:!0,get:function(){return this.mi},set:function(a){var b=this.mi;b!==a&&(A(a,"boolean",wi,"allowSelect"),this.mi=a,this.g("allowSelect",b,a))}}});wi.prototype.findObjectsNear=wi.prototype.Jg;wi.prototype.findObjectsIn=wi.prototype.Ff;wi.prototype.findObjectsAt=wi.prototype.hj;wi.prototype.findObjectAt=wi.prototype.$b;
wi.className="Layer";
function Q(a){function b(){c.removeEventListener(qa.document,"DOMContentLoaded",b,!1);c.setRTL()}1<arguments.length&&v("Diagram constructor can only take one optional argument, the DIV HTML element or its id.");Di||(Ei(),Di=!0);fb(this);Pe=this;Xa=[];this.Xb=!0;this.Sc=new zh;this.Sc.he(this);this.rb=17;this.Cl=this.qv=!1;this.Ys="default";this.Ia=null;var c=this;gh&&(null!==qa.document.body?this.setRTL():c.addEventListener(qa.document,"DOMContentLoaded",b,!1));this.Pa=new H;this.Ca=this.Da=0;this.Ul=
this.ya=null;this.Lx=new Db;this.pf=this.Lb=null;this.Aw();this.Kj=null;this.zw();this.wb=1;this.sa=(new J(NaN,NaN)).freeze();this.Zs=new J(NaN,NaN);this.Rn=this.Fa=1;this.js=(new J(NaN,NaN)).freeze();this.ks=NaN;this.Ds=1E-4;this.Bs=100;this.sb=new Ib;this.zt=(new J(NaN,NaN)).freeze();this.ds=(new L(NaN,NaN,NaN,NaN)).freeze();this.Ui=(new lc(0,0,0,0)).freeze();this.Vi=mi;this.gt=!1;this.$s=this.Us=null;this.Ug=Wh;this.Aj=ld;this.fg=Wh;this.so=ld;this.ls=this.hs=Hc;this.Hc=!0;this.Al=!1;this.ud=new I;
this.ah=new Db;this.ll=!0;this.sn=250;this.yj=-1;this.un=(new lc(16,16,16,16)).freeze();this.Ej=this.Me=!1;this.Hj=!0;this.cg=new we;this.cg.diagram=this;this.$d=new we;this.$d.diagram=this;this.mh=new we;this.mh.diagram=this;this.Ce=this.Vf=null;this.dk=!1;this.Ur=this.Vr=null;this.on=qa.PointerEvent&&($a||bb||cb)&&qa.navigator&&!1!==qa.navigator.msPointerEnabled;Fi(this);this.Hh=new I;this.us=!0;this.ut=Gi;this.Vu=!1;this.wt=$f;this.Oa=null;Hi.add("Model",Ii);this.Or=this.Rr=this.st=null;this.Qn=
this.Mr="auto";this.og=this.Gs=this.qg=this.rg=this.tg=this.Xf=this.ag=this.Wf=null;this.gs=!1;this.Yf=this.Dg=this.sg=this.pg=null;this.Hs=!1;this.Ss={};this.Zj=[null,null];this.Gr=null;this.Sr=this.kt=this.sv=this.Bg=!1;this.bv=!0;this.Bi=this.Ic=!1;this.gc=null;var d=this;this.qd=function(a){var b=d.partManager;if(a.model===b.diagram.model&&b.diagram.ba){b.diagram.ba=!1;try{var c=a.change;""===a.modelChange&&c===He&&b.updateDataBindings(a.object,a.propertyName)}finally{b.diagram.ba=!0}}};this.Qc=
function(a){d.partManager.doModelChanged(a)};this.Av=!0;this.Qd=-2;this.Ri=new Db;this.Rs=new H;this.hg=!1;this.ei=this.di=this.tr=this.gd=!0;this.ur=!1;this.Ar=this.yr=this.mi=this.li=this.ki=this.ji=this.hi=this.ii=this.gi=this.xr=this.oi=this.fi=this.ni=this.vr=!0;this.gg=this.Yu=!1;this.zr=this.wr=this.sl=this.rl=!0;this.ft=this.bt=16;this.at=this.Pp=!1;this.Qp=this.dt=null;this.ct=this.et=0;this.lb=(new lc(5)).freeze();this.rv=(new I).freeze();this.Cs=999999999;this.Su=(new I).freeze();this.Ai=
this.zi=this.yi=!0;this.df=this.ue=!1;this.oc=null;this.Tg=!0;this.ve=!1;this.Bx=new I;this.Tu=new I;this.Ob=null;this.Rl=1;this.tv=0;this.ae={scale:1,position:new J,bounds:new L,iw:!1};this.Sx=(new L(NaN,NaN,NaN,NaN)).freeze();this.om=(new Hb(NaN,NaN)).freeze();this.Sn=(new L(NaN,NaN,NaN,NaN)).freeze();this.vs=!1;this.Ko=this.qo=this.lp=this.Gu=this.Fu=this.Hu=this.jg=this.kh=this.kf=this.Yr=null;Ji(this);this.Nb=null;this.po=!1;this.Bj=null;this.partManager=new Ii;this.toolManager=new Ua;this.toolManager.initializeStandardTools();
this.currentTool=this.defaultTool=this.toolManager;this.Xr=null;this.el=new ef;this.Ms=this.Ls=null;this.iq=!1;this.commandHandler=Ki();this.model=Li();this.Bg=!0;Mi(this);this.layout=new Ni;this.Bg=!1;this.ux=this.Ku=null;this.Yb=1;this.Ch=null;this.Vo=1;this.bp=0;this.cp=[0,0,0,0,0];this.ep=0;this.vd=1;this.Pj=0;this.Fo=new J;this.tt=500;this.tn=new J;this.we=!1;this.preventDefault=this.gu=this.Lm=this.Mm=this.Km=this.Jm=this.Fk=this.Hk=this.Gk=this.Dk=this.Ek=this.Ww=this.Ow=this.Pw=this.Qw=this.vh=
this.Wl=this.uh=this.Vl=null;this.vo=!1;this.xi=new Oi;this.jq=!1;void 0!==a&&Pi(this,a);this.bo=null;this.co=Vb;this.Xb=!1}Q.prototype.clear=function(){this.animationManager.dd();this.model.clear();Qi=null;Ri="";Yi(this,!1);this.Ta();Zi(this);this.P()};
function Yi(a,b){a.animationManager.dd(!0);a.rv=(new I).freeze();a.Su=(new I).freeze();var c=a.skipsUndoManager;null!==a.model&&(a.skipsUndoManager=!0);var d=null;null!==a.Nb&&(d=a.Nb.part,null!==d&&a.remove(d));var e=[],f=a.Pa.length;if(b){for(b=0;b<f;b++)for(var g=a.Pa.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.Pa.j[b].clear();a.partManager.clear();a.ud.clear();a.ah.clear();a.Hh.clear();a.Bj=null;Na=[];null!==d&&(a.add(d),
a.partManager.parts.remove(d));null!==a.model&&(a.skipsUndoManager=c);return e}function Ki(){return null}
Q.prototype.reset=function(){this.clear();this.Xb=!0;this.Sc=new zh;this.Sc.he(this);this.rb=17;this.Cl=this.qv=!1;this.Ys="default";this.Pa=new H;this.Lx=new Db;this.pf=null;this.Aw();this.Kj=null;this.zw();this.wb=1;this.sa=(new J(NaN,NaN)).freeze();this.Zs=new J(NaN,NaN);this.Rn=this.Fa=1;this.js=(new J(NaN,NaN)).freeze();this.ks=NaN;this.Ds=1E-4;this.Bs=100;this.sb=new Ib;this.zt=(new J(NaN,NaN)).freeze();this.ds=(new L(NaN,NaN,NaN,NaN)).freeze();this.Ui=(new lc(0,0,0,0)).freeze();this.Vi=mi;
this.gt=!1;this.$s=this.Us=null;this.Ug=Wh;this.Aj=ld;this.fg=Wh;this.so=ld;this.ls=this.hs=Hc;this.Hc=!0;this.Al=!1;this.ud=new I;this.ah=new Db;this.ll=!0;this.sn=250;this.yj=-1;this.un=(new lc(16,16,16,16)).freeze();this.Ej=this.Me=!1;this.Hj=!0;this.cg=new we;this.cg.diagram=this;this.$d=new we;this.$d.diagram=this;this.mh=new we;this.mh.diagram=this;this.Ce=this.Vf=null;this.dk=!1;this.Ur=this.Vr=null;this.on=qa.PointerEvent&&($a||bb||cb)&&qa.navigator&&!1!==qa.navigator.msPointerEnabled;Fi(this);
this.Hh=new I;this.us=!0;this.ut=Gi;this.Vu=!1;this.wt=$f;this.Or=this.Rr=this.st=null;this.Qn=this.Mr="auto";this.og=this.Gs=this.qg=this.rg=this.tg=this.Xf=this.ag=this.Wf=null;this.gs=!1;this.Yf=this.Dg=this.sg=this.pg=null;this.Hs=!1;this.Ss={};this.Zj=[null,null];this.Gr=null;this.Sr=this.kt=this.sv=this.Bg=!1;this.bv=!0;this.Bi=this.Ic=!1;this.Av=!0;this.Qd=-2;this.Ri=new Db;this.Rs=new H;this.hg=!1;this.ei=this.di=this.tr=this.gd=!0;this.ur=!1;this.Ar=this.yr=this.mi=this.li=this.ki=this.ji=
this.hi=this.ii=this.gi=this.xr=this.oi=this.fi=this.ni=this.vr=!0;this.gg=this.Yu=!1;this.zr=this.wr=this.sl=this.rl=!0;this.ft=this.bt=16;this.at=this.Pp=!1;this.ct=this.et=0;this.lb=(new lc(5)).freeze();this.rv=(new I).freeze();this.Cs=999999999;this.Su=(new I).freeze();this.Ai=this.zi=this.yi=!0;this.df=this.ue=!1;this.oc=null;this.Tg=!0;this.ve=!1;this.Bx=new I;this.Tu=new I;this.Ob=null;this.Rl=1;this.tv=0;this.ae={scale:1,position:new J,bounds:new L,iw:!1};this.Sx=(new L(NaN,NaN,NaN,NaN)).freeze();
this.om=(new Hb(NaN,NaN)).freeze();this.Sn=(new L(NaN,NaN,NaN,NaN)).freeze();this.vs=!1;this.Ko=this.qo=this.lp=this.Gu=this.Fu=this.Hu=this.jg=this.kh=this.kf=null;Ji(this);this.Nb=null;this.po=!1;this.Bj=null;this.partManager=new Ii;this.toolManager=new Ua;this.toolManager.initializeStandardTools();this.currentTool=this.defaultTool=this.toolManager;this.Xr=null;this.el=new ef;this.Ms=this.Ls=null;this.iq=!1;this.commandHandler=Ki();this.Bg=!0;Mi(this);this.layout=new Ni;this.Bg=!1;this.model=Li();
this.model.undoManager=new Me;this.ve=!1;this.Hj=!0;this.Me=!1;this.Yb=1;this.Ch=null;this.Vo=1;this.bp=0;this.cp=[0,0,0,0,0];this.ep=0;this.vd=1;this.Pj=0;this.Fo=new J;this.tt=500;this.tn=new J;this.we=!1;this.vh=this.Wl=this.uh=this.Vl=null;this.jq=this.vo=!1;this.bo=null;this.co=Vb;this.Xb=!1;this.P()};
function Ji(a){a.kf=new Db;var b=new T,c=new ih;c.bind(new $i("text","",Qa));b.add(c);a.Hu=b;a.kf.add("",b);b=new T;c=new ih;c.stroke="brown";c.bind(new $i("text","",Qa));b.add(c);a.kf.add("Comment",b);b=new T;b.selectable=!1;b.avoidable=!1;c=new Yf;c.figure="Ellipse";c.fill="black";c.stroke=null;c.desiredSize=(new Hb(3,3)).ia();b.add(c);a.kf.add("LinkLabel",b);a.kh=new Db;b=new Hf;b.selectionObjectName="GROUPPANEL";b.type=U.Vertical;c=new ih;c.font="bold 12pt sans-serif";c.bind(new $i("text","",
Qa));b.add(c);c=new U(U.Auto);c.name="GROUPPANEL";var d=new Yf;d.figure="Rectangle";d.fill="rgba(128,128,128,0.2)";d.stroke="black";c.add(d);d=new Kg;d.padding=(new lc(5,5,5,5)).ia();c.add(d);b.add(c);a.Fu=b;a.kh.add("",b);a.jg=new Db;b=new R;c=new Yf;c.isPanelMain=!0;b.add(c);c=new Yf;c.toArrow="Standard";c.fill="black";c.stroke=null;c.strokeWidth=0;b.add(c);a.Gu=b;a.jg.add("",b);b=new R;c=new Yf;c.isPanelMain=!0;c.stroke="brown";b.add(c);a.jg.add("Comment",b);b=new Te;b.type=U.Auto;c=new Yf;c.fill=
null;c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);c=new Kg;c.margin=(new lc(1.5,1.5,1.5,1.5)).ia();b.add(c);a.lp=b;a.qo=b;b=new Te;b.type=U.Link;c=new Yf;c.isPanelMain=!0;c.fill=null;c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);a.Ko=b}
Q.prototype.setRTL=function(a){a=void 0===a?this.div:a;null===a&&(a=qa.document.body);var b=ua("div");b.dir="rtl";b.style.cssText="font-size: 14px; width: 1px; height: 1px; position: absolute; top: -1000px; overflow: scroll;";b.textContent="A";a.appendChild(b);var c="reverse";0<b.scrollLeft?c="default":(b.scrollLeft=1,0===b.scrollLeft&&(c="negative"));a.removeChild(b);this.Ys=c};
Q.prototype.setScrollWidth=function(a){a=void 0===a?this.div:a;null===a&&(a=qa.document.body);var b=0;if(gh){var c=aj;b=bj;null===c&&(c=aj=ua("p"),c.style.width="100%",c.style.height="200px",c.style.boxSizing="content-box",b=bj=ua("div"),b.style.position="absolute",b.style.visibility="hidden",b.style.width="200px",b.style.height="150px",b.style.boxSizing="content-box",b.appendChild(c));b.style.overflow="hidden";a.appendChild(b);var d=c.offsetWidth;b.style.overflow="scroll";c=c.offsetWidth;d===c&&
(c=b.clientWidth);a.removeChild(b);b=d-c;0!==b||eb||(b=11)}this.rb=b;this.qv=!0};Q.prototype.mb=function(a){a.classType===Q?this.autoScale=a:Ba(this,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.Pa.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 cj(a){var b=a.ya.Ka;b instanceof HTMLCanvasElement&&(a.on?(a.addEventListener(b,"pointerdown",a.Jm,!1),a.addEventListener(b,"pointermove",a.Km,!1),a.addEventListener(b,"pointerup",a.Mm,!1),a.addEventListener(b,"pointerout",a.Lm,!1)):(a.addEventListener(b,"touchstart",a.Qw,!1),a.addEventListener(b,"touchmove",a.Pw,!1),a.addEventListener(b,"touchend",a.Ow,!1),a.addEventListener(b,"mousemove",a.Ek,!1),a.addEventListener(b,"mousedown",a.Dk,!1),a.addEventListener(b,"mouseup",a.Gk,!1),a.addEventListener(b,
"mouseout",a.Fk,!1)),a.addEventListener(b,"mouseenter",a.Iz,!1),a.addEventListener(b,"mouseleave",a.Jz,!1),a.addEventListener(b,"wheel",a.Hk,!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!==
$e&&(a.toolManager.gestureBehavior===Ze?b.preventDefault():a.we&&a.lastInput.handled||(b.preventDefault(),a.Rl=a.scale,a.currentTool.doCancel()))},!1),a.addEventListener(b,"gesturechange",function(b){if(a.toolManager.gestureBehavior!==$e)if(a.toolManager.gestureBehavior===Ze)b.preventDefault();else if(!a.we||!a.lastInput.handled){b.preventDefault();var c=b.scale;if(null!==a.Rl){var e=a.ya.getBoundingClientRect();b=new J(b.pageX-qa.scrollX-a.Da/e.width*e.left,b.pageY-qa.scrollY-a.Ca/e.height*e.top);
c=a.Rl*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(qa,"resize",a.Ww,!1))}function hf(a){30<a.bp&&(a.Ch=1)}function wf(a,b){null!==a.Ch&&(a.Ch=null,b&&a.gu(),a.bp=0,a.cp=[0,0,0,0,0],a.ep=0)}Q.prototype.computePixelRatio=function(){return null!==this.Ch?this.Ch:qa.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.ya)if(this.scrollsPageOnFocus)this.ya.focus();else{var a=qa.scrollX||qa.pageXOffset,b=qa.scrollY||qa.pageYOffset;this.ya.focus();qa.scrollTo(a,b)}};Q.prototype.wz=function(){this.B.U("GainedFocus")};
Q.prototype.vz=function(){this.B.U("LostFocus")};function Xh(a){if(null!==a.ya){var b=a.Ia;if(0!==b.clientWidth&&0!==b.clientHeight){a.qv||a.setScrollWidth();var c=a.df?a.rb:0,d=a.ue?a.rb:0,e=a.Yb;a.Yb=a.computePixelRatio();a.Yb!==e&&(a.Al=!0,a.Hb());if(b.clientWidth!==a.Da+c||b.clientHeight!==a.Ca+d)a.zi=!0,a.Hc=!0,b=a.layout,null!==b&&b.isViewportSized&&a.autoScale===Wh&&(a.Ej=!0,b.D()),a.Ic||a.Hb()}}}
function Mi(a){var b=new wi;b.name="Background";a.pm(b);b=new wi;b.name="";a.pm(b);b=new wi;b.name="Foreground";a.pm(b);b=new wi;b.name="Adornment";b.isTemporary=!0;a.pm(b);b=new wi;b.name="Tool";b.isTemporary=!0;b.isBoundsIncluded=!0;a.pm(b);b=new wi;b.name="Grid";b.allowSelect=!1;b.pickable=!1;b.isTemporary=!0;a.Vx(b,a.zm("Background"))}
function dj(a){a.Nb=new U(U.Grid);a.Nb.name="GRID";var b=new Yf;b.figure="LineH";b.stroke="lightgray";b.strokeWidth=.5;b.interval=1;a.Nb.add(b);b=new Yf;b.figure="LineH";b.stroke="gray";b.strokeWidth=.5;b.interval=5;a.Nb.add(b);b=new Yf;b.figure="LineH";b.stroke="gray";b.strokeWidth=1;b.interval=10;a.Nb.add(b);b=new Yf;b.figure="LineV";b.stroke="lightgray";b.strokeWidth=.5;b.interval=1;a.Nb.add(b);b=new Yf;b.figure="LineV";b.stroke="gray";b.strokeWidth=.5;b.interval=5;a.Nb.add(b);b=new Yf;b.figure=
"LineV";b.stroke="gray";b.strokeWidth=1;b.interval=10;a.Nb.add(b);b=new S;b.add(a.Nb);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.Nb.visible=!1}function ej(){this.B.at?this.B.at=!1:this.B.isEnabled?this.B.hy(this):fj(this.B)}function gj(a){this.B.isEnabled?(this.B.et=a.target.scrollTop,this.B.ct=a.target.scrollLeft):fj(this.B)}
Q.prototype.hy=function(a){if(null!==this.ya){this.Pp=!0;var b=this.documentBounds,c=this.viewportBounds,d=this.Ui,e=b.x-d.left,f=b.y-d.top,g=b.width+d.left+d.right,h=b.height+d.top+d.bottom,k=b.right+d.right;d=b.bottom+d.bottom;var l=c.x;b=c.y;var m=c.width,n=c.height,p=c.right,r=c.bottom;c=this.scale;var q=a.scrollLeft;if(this.Cl)switch(this.Ys){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.ct!==u&&(q.x=u/c+e,this.ct=u),this.allowVerticalScroll&&this.et!==a.scrollTop&&(q.y=a.scrollTop/c+f,this.et=a.scrollTop),this.position=q,J.free(q),this.zi=this.Pp=!1):(q=J.alloc(),a.cz&&this.allowHorizontalScroll&&(e<l&&(this.position=q.h(u+e,this.position.y)),k>p&&(this.position=q.h(-(this.dt.scrollWidth-this.Da)+u-this.Da/c+k,this.position.y))),a.dz&&this.allowVerticalScroll&&(f<b&&(this.position=q.h(this.position.x,a.scrollTop+f)),d>r&&(this.position=q.h(this.position.x,
-(this.dt.scrollHeight-this.Ca)+a.scrollTop-this.Ca/c+d))),J.free(q),hj(this),this.zi=this.Pp=!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.Qp.style.width="1px"),n>=h&&f>=b&&d<=r&&(this.Qp.style.height="1px"))}};Q.prototype.computeBounds=function(){0<this.ud.count&&ij(this);return jj(this)};
function jj(a){if(a.fixedBounds.o()){var b=a.fixedBounds.copy();b.xq(a.lb);return b}for(var c=!0,d=a.Pa.j,e=d.length,f=0;f<e;f++){var g=d[f];if(g.visible&&(!g.isTemporary||g.isBoundsIncluded)){g=g.Ha.j;for(var h=g.length,k=0;k<h;k++){var l=g[k];l.isInDocumentBounds&&l.isVisible()&&(l=l.actualBounds,l.o()&&(c?(c=!1,b=l.copy()):b.Pc(l)))}}}c&&(b=new L(0,0,0,0));b.xq(a.lb);return b}
Q.prototype.computePartsBounds=function(a,b){void 0===b&&(b=!1);var c=null;if(Ga(a))for(var d=0;d<a.length;d++){var e=a[d];!b&&e instanceof R||(e.Fb(),null===c?c=e.actualBounds.copy():c.Pc(e.actualBounds))}else for(a=a.iterator;a.next();)d=a.value,!b&&d instanceof R||(d.Fb(),null===c?c=d.actualBounds.copy():c.Pc(d.actualBounds));return null===c?new L(NaN,NaN,0,0):c};
function kj(a,b){if((b||a.ve)&&!a.Xb&&null!==a.ya&&a.documentBounds.o()){if(b){var c=a.initialPosition;if(c.o()){a.position=c;return}c=J.alloc();c.sj(a.documentBounds,a.initialDocumentSpot);var d=a.viewportBounds;d=L.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;L.free(d);J.free(e);J.free(c)}a.Xb=!0;c=a.Ug;b&&a.fg!==Wh&&(c=a.fg);d=c!==Wh?lj(a,c):a.scale;c=a.viewportBounds.copy();e=a.Da/d;var f=a.Ca/d,g=a.Aj,h=a.so;b&&!g.bb()&&(h.bb()||
h.Gb())&&(g=h.Gb()?Mc:h);mj(a,a.documentBounds,e,f,g,b);b=a.scale;a.scale=d;a.Xb=!1;d=a.viewportBounds;d.Sa(c)||a.Zq(c,d,b,!1);nj(a);oj(a,!0,!1)}}
function lj(a,b){var c=a.Rn;if(null===a.ya)return c;Zi(a);var d=a.documentBounds;if(!d.o())return c;var e=d.width;d=d.height;var f=a.Da+(a.df?a.rb:0),g=a.Ca+(a.ue?a.rb:0),h=f/e,k=g/d;return b===pj?(b=Math.min(k,h),b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):b===qj?(b=k>h?(g-a.rb)/d:(f-a.rb)/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.Vi;this.Vi=mi;this.scale=lj(this,pj);a!==mi&&(kj(this,!1),mj(this,this.documentBounds,this.Da/this.Fa,this.Ca/this.Fa,this.Aj,!1));this.Vi=a};t=Q.prototype;
t.fB=function(a,b){void 0===b&&(b=pj);var c=a.width,d=a.height;if(!(0===c||0===d||isNaN(c)&&isNaN(d))){var e=1;if(b===pj||b===qj)if(isNaN(c))e=this.viewportBounds.height*this.scale/d;else if(isNaN(d))e=this.viewportBounds.width*this.scale/c;else{e=this.Da;var f=this.Ca;e=b===qj?f/d>e/c?(f-(this.ue?this.rb:0))/d:(e-(this.df?this.rb:0))/c:Math.min(f/d,e/c)}this.scale=e;this.position=new J(a.x,a.y)}};
t.oz=function(a,b){Zi(this);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.gA=function(a){if(a instanceof N){this.bo=a;var b=J.alloc();this.co=this.lr(a.ma(Hc,b));J.free(b)}else this.bo=null,this.co=Vb};
function mj(a,b,c,d,e,f){var g=J.allocAt(a.sa.x,a.sa.y),h=g.x,k=g.y;if(null!==a.bo){var l=J.alloc();l=a.bo.ma(Hc,l);h=l.x-a.co.x/a.scale;k=l.y-a.co.y/a.scale;e=Gc;J.free(l)}if(f||a.scrollMode===mi)e.bb()&&(c>b.width&&(h=b.x+(e.x*b.width+e.offsetX)-(e.x*c-e.offsetX)),d>b.height&&(k=b.y+(e.y*b.height+e.offsetY)-(e.y*d-e.offsetY))),e=a.Ui,f=c-b.width,c<b.width+e.left+e.right?(h=Math.min(h+c/2,b.right+Math.max(f,e.right)-c/2),h=Math.max(h,b.left-Math.max(f,e.left)+c/2),h-=c/2):h>b.left?h=b.left:h<b.right-
c&&(h=b.right-c),c=d-b.height,d<b.height+e.top+e.bottom?(k=Math.min(k+d/2,b.bottom+Math.max(c,e.bottom)-d/2),k=Math.max(k,b.top-Math.max(c,e.top)+d/2),k-=d/2):k>b.top?k=b.top:k<b.bottom-d&&(k=b.bottom-d);g.x=isFinite(h)?h:-a.lb.left;g.y=isFinite(k)?k:-a.lb.top;null!==a.positionComputation&&(b=a.positionComputation(a,g),g.x=b.x,g.y=b.y);a.Sc.wc&&fi(a.Sc,a.sa,g);a.sa.h(g.x,g.y);J.free(g)}
t.Am=function(a,b){void 0===b&&(b=!0);if(b){if(a=If(this,a,function(a){return a.part},function(a){return a.canSelect()}),a instanceof S)return a}else if(a=If(this,a,function(a){return a.part}),a instanceof S)return a;return null};t.$b=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);ij(this);for(var d=this.Pa.iteratorBackwards;d.next();){var e=d.value;if(e.visible&&(e=e.$b(a,b,c),null!==e))return e}return null};
function If(a,b,c,d){void 0===c&&(c=null);void 0===d&&(d=null);ij(a);for(a=a.Pa.iteratorBackwards;a.next();){var e=a.value;if(e.visible&&!e.isTemporary&&(e=e.$b(b,c,d),null!==e))return e}return null}t.Vz=function(a,b,c){void 0===b&&(b=!0);return rj(this,a,function(a){return a.part},b?function(a){return a instanceof S&&a.canSelect()}:null,c)};
function rj(a,b,c,d,e){void 0===c&&(c=null);void 0===d&&(d=null);e instanceof H||e instanceof I||(e=new I);ij(a);for(a=a.Pa.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 H||d instanceof I||(d=new I);ij(this);for(var e=this.Pa.iteratorBackwards;e.next();){var f=e.value;f.visible&&f.hj(a,b,c,d)}return d};
t.qy=function(a,b,c,d){void 0===b&&(b=!1);void 0===c&&(c=!0);return sj(this,a,function(a){return a instanceof S&&(!c||a.canSelect())},b,d)};t.Ff=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof H||e instanceof I||(e=new I);ij(this);for(var f=this.Pa.iteratorBackwards;f.next();){var g=f.value;g.visible&&g.Ff(a,b,c,d,e)}return e};
t.Xv=function(a,b,c,d,e,f){var g=new I;ij(this);for(var h=this.Pa.iteratorBackwards;h.next();){var k=h.value;k.visible&&k.Xv(a,b,c,d,g,e,f)}return g};function sj(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 H||e instanceof I||(e=new I);ij(a);for(a=a.Pa.iteratorBackwards;a.next();){var g=a.value;g.visible&&!g.isTemporary&&g.Ff(b,f,c,d,e)}return e}
t.Wz=function(a,b,c,d,e){void 0===c&&(c=!0);void 0===d&&(d=!0);return tj(this,a,b,function(a){return a instanceof S&&(!d||a.canSelect())},c,e)};t.Jg=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 H||e instanceof I)f=e;e=!0}f instanceof H||f instanceof I||(f=new I);ij(this);for(var g=this.Pa.iteratorBackwards;g.next();){var h=g.value;h.visible&&h.Jg(a,b,c,d,e,f)}return f};
function tj(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 H||e instanceof I)f=e;e=!0}f instanceof H||f instanceof I||(f=new I);ij(a);for(a=a.Pa.iteratorBackwards;a.next();){var h=a.value;h.visible&&!h.isTemporary&&h.Jg(b,c,g,d,e,f)}return f}Q.prototype.acceptEvent=function(a){return uj(this,a,a instanceof MouseEvent)};
function uj(a,b,c){var d=a.$d;a.$d=a.mh;a.mh=d;d.diagram=a;d.event=b;c?vj(a,b,d):(d.viewPoint=a.$d.viewPoint,d.documentPoint=a.$d.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||Za||(d.buttons=b.buttons);db&&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=wj(b);d.targetObject=null;return d}
function wj(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 xj(a,b,c,d){var e=yj(a,b,!0,!1,!0,d);vj(a,c,e);e.targetDiagram=wj(b);e.targetObject=null;d||e.clone(a.cg);return e}
function zj(a,b,c,d){var e;d=yj(a,b,!1,!1,!1,d);null!==c?((e=qa.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,vj(a,b,d)):null!==a.$d?(d.documentPoint=a.$d.documentPoint,d.viewPoint=a.$d.viewPoint,d.targetDiagram=a.$d.targetDiagram):null!==a.cg&&(d.documentPoint=a.cg.documentPoint,d.viewPoint=a.cg.viewPoint,d.targetDiagram=a.cg.targetDiagram);d.targetObject=null;return d}
function yj(a,b,c,d,e,f){var g=a.$d;a.$d=a.mh;a.mh=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.on&&b instanceof qa.PointerEvent&&"touch"!==b.pointerType&&(g.button=b.button,void 0===b.buttons||Za||(g.buttons=b.buttons),db&&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 Aj(a,b,c){if(b.bubbles)return F&&F.Ay&&Ca("NOT handled "+c.type+" "+b.toString()),!0;F&&F.Ay&&Ca("handled "+c.type+" "+a.currentTool.name+" "+b.toString());void 0!==c.stopPropagation&&c.stopPropagation();!1!==c.cancelable&&c.preventDefault();c.cancelBubble=!0;return!1}
Q.prototype.xA=function(a){var b=this.B;if(!this.B.isEnabled)return!1;var c=uj(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 Aj(b,c,a)};
Q.prototype.yA=function(a){var b=this.B;if(!b.isEnabled)return!1;var c=uj(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 Aj(b,c,a)};
Q.prototype.Iz=function(a){var b=this.B;if(!b.isEnabled)return!1;var c=uj(b,a,!0);null!==b.mouseEnter&&b.mouseEnter(c);return Aj(b,c,a)};Q.prototype.Jz=function(a){var b=this.B;if(!b.isEnabled)return!1;var c=uj(b,a,!0);null!==b.mouseLeave&&b.mouseLeave(c);return Aj(b,c,a)};
Q.prototype.getMouse=function(a){var b=this.ya;if(null===b)return new J(0,0);var c=b.getBoundingClientRect();b=a.clientX-this.Da/c.width*c.left;a=a.clientY-this.Ca/c.height*c.top;return null!==this.sb?Jb(new J(b,a),this.sb):new J(b,a)};
function vj(a,b,c){var d=a.ya,e=a.Da,f=a.Ca,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.sb?(b=J.allocAt(g,h),a.sb.ee(b),c.documentPoint.assign(b),J.free(b)):c.documentPoint.h(g,h)}
function Ee(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.ya;null!==c&&(c=c.getBoundingClientRect(),d.h(b.clientX-a.Da/c.width*c.left,b.clientY-a.Ca/c.height*c.top))}t=Q.prototype;t.Ta=function(){this.yi||(this.yi=!0,this.Hb(!0))};function Bj(a){a.Ic||ij(a);Zi(a)}t.ge=function(){this.Xb||this.Ic||(this.P(),nj(this),hj(this),this.Ta(),this.cd())};t.wA=function(){return this.Me};
t.Dz=function(a){void 0===a&&(a=null);var b=this.animationManager,c=b.isEnabled;b.dd();b.isEnabled=!1;Vf(this);this.ve=!1;this.Zs=new J(NaN,NaN);b.isEnabled=c;null!==a&&ta(function(){Eh(b,"Model");a()},1)};t.Hb=function(a){void 0===a&&(a=!1);if(!0!==this.Me&&!(this.Xb||!1===a&&this.Ic)){this.Me=!0;var b=this;qa.requestAnimationFrame(function(){b.Me&&b.cd()})}};t.cd=function(){if(!this.Hj||this.Me)this.Hj&&(this.Hj=!1),Vf(this)};
function oj(a,b,c){a.animationManager.defaultAnimation.isAnimating||a.Xb||!a.zi||fj(a)||(b&&ij(a),c&&kj(a,!1))}
function Vf(a,b){if(!a.Ic&&(a.Me=!1,null!==a.Ia||a.om.o())){a.Ic=!0;var c=a.animationManager,d=a.Rs;if(!c.isAnimating&&0!==d.length){for(var e=d.j,f=e.length,g=0;g<f;g++){var h=e[g];Cj(h,!1);h.u()}d.clear()}d=a.Tu;0<d.count&&(d.each(function(a){a.Vw()}),d.clear());e=d=!1;c.isAnimating&&(e=!0,d=a.skipsUndoManager,a.skipsUndoManager=!0);c.wc||Xh(a);oj(a,!1,!0);null!==a.Nb&&(a.Nb.visible&&!a.po&&(Dj(a),a.po=!0),!a.Nb.visible&&a.po&&(a.po=!1));ij(a);f=!1;if(!a.ve||a.Tg)a.ve?Ej(a,!a.Ej):(a.Ba("Initial Layout"),
!1===c.isEnabled&&c.dd(),Ej(a,!1)),f=!0;a.Ej=!1;ij(a);a.kt||Bj(a);oj(a,!0,!1);g=!1;f?(c=L.alloc(),c.assign(a.viewportBounds),a.ve||(g=a.ve=!0,a.skipsUndoManager||(a.undoManager.isPendingClear=!0),a.undoManager.isPendingUnmodified=!0,Fj(a)),a.U("LayoutCompleted"),c.A(a.viewportBounds)||oj(a,!0,!1),L.free(c)):c.vl&&c.Rx&&(a.fg!==Wh?a.scale=lj(a,a.fg):a.Ug!==Wh?a.scale=lj(a,a.Ug):(c=a.initialScale,isFinite(c)&&0<c&&(a.scale=c)),kj(a,!0));ij(a);f&&g&&a.ab("Initial Layout");a.Hv();b||a.hc(a.Lb);e&&(a.skipsUndoManager=
d);a.Ic=!1}}function Fj(a){var b=a.Fa;if(a.fg!==Wh)a.scale=lj(a,a.fg);else if(a.Ug!==Wh)a.scale=lj(a,a.Ug);else{var c=a.initialScale;isFinite(c)&&0<c&&(a.scale=c)}a.Fa!==b&&(nj(a),oj(a,!0,!1));kj(a,!0);b=a.Pa.j;a.Hd(b,b.length,a);a.U("InitialLayoutCompleted");a.Zs.assign(a.sa);Dj(a)}
function ij(a){if((a.Ic||!a.animationManager.isTicking)&&0!==a.ud.count){for(var b=0;23>b;b++){var c=a.ud.iterator;if(null===c||0===a.ud.count)break;a.ud=new I;a.Vw(c,a.ud);F&&22===b&&Ca("failure to validate parts")}a.nodes.each(function(a){a instanceof Hf&&0!==(a.T&65536)!==!1&&(a.T=a.T^65536)})}}
t.Vw=function(a,b){for(a.reset();a.next();){var c=a.value;!c.bc()||c instanceof Hf||(c.qj()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))}for(a.reset();a.next();)c=a.value,c instanceof Hf&&c.isVisible()&&Gj(this,c);for(a.reset();a.next();)c=a.value,c instanceof R&&c.isVisible()&&(c.qj()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c));for(a.reset();a.next();)c=a.value,c instanceof Te&&c.isVisible()&&(c.qj()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))};
function Gj(a,b){for(var c=La(),d=La(),e=b.memberParts;e.next();){var f=e.value;f.isVisible()&&(f instanceof Hf?(Hj(f)||Ij(f)||Jj(f))&&Gj(a,f):f instanceof R?f.fromNode===b||f.toNode===b?d.push(f):c.push(f):(f.measure(Infinity,Infinity),f.arrange()))}a=c.length;for(e=0;e<a;e++)f=c[e],f.measure(Infinity,Infinity),f.arrange();Oa(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();Oa(d)}
t.Hd=function(a,b,c,d){if(this.Ai||this.animationManager.isAnimating)for(var e=0;e<b;e++)a[e].Hd(c,d)};
t.hc=function(a,b){void 0===b&&(b=null);if(null!==this.Ia){null===this.ya&&v("No canvas specified");var c=this.animationManager;if(!c.wc&&(!c.isAnimating||c.isTicking)){var d=new Date;Kj(this);if("0"!==this.Ia.style.opacity){var e=a!==this.Lb,f=this.Pa.j,g=f.length,h=this;this.Hd(f,g,h);if(e)a.yc(!0),hj(this);else if(!this.Hc&&null===b&&!c.isAnimating)return;g=this.sa;var k=this.Fa,l=Math.round(g.x*k)/k,m=Math.round(g.y*k)/k;c=this.sb;c.reset();1!==k&&c.scale(k);0===g.x&&0===g.y||c.translate(-l,-m);
k=this.Yb;a.setTransform(1,0,0,1,0,0);a.scale(k,k);a.clearRect(0,0,this.Da,this.Ca);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);F&&F.sm&&F.Pv&&F.Pv(this,a);Lj(this,a);a.globalAlpha=this.wb;l=null!==b?function(c){var d=b;if(c.visible&&0!==c.wb){var e=c.Ha.j,f=e.length;if(0!==f){var g=zi(c,a),k=c.sp;k.length=0;for(var l=h.scale,m=L.alloc(),n=0;n<f;n++){var D=e[n];d.contains(D)||c.dj(a,D,h,k,l,m)}L.free(m);a.globalAlpha=g}}}:function(b){b.hc(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.xi&&Mj(this.xi,this)&&this.Yr();F&&(F.ky||F.sm)&&F.Qv&&F.Qv(a,this,c);e?(this.Lb.yc(!0),hj(this)):this.Hc=this.Ai=!1;e=+new Date-+d;if(null===this.Ch){d=this.cp;d[this.ep]=e;this.ep=(this.ep+1)%d.length;for(f=e=0;f<this.cp.length;f++)e+=this.cp[f];this.bp=e/d.length}}}}};
function Nj(a,b,c,d,e,f,g,h,k,l){if(null!==a.Ia){null===a.ya&&v("No canvas specified");void 0===g&&(g=null);void 0===h&&(h=null);void 0===k&&(k=!1);void 0===l&&(l=!1);Kj(a);a.Lb.yc(!0);hj(a);a.Bi=!0;var m=a.Fa;a.Fa=e;var n=a.Pa.j,p=n.length;try{var r=new L(f.x,f.y,d.width/e,d.height/e),q=r.copy();q.xq(c);Dj(a,q);ij(a);a.Hd(n,p,a,r);var u=a.Yb;b.setTransform(1,0,0,1,0,0);b.scale(u,u);b.clearRect(0,0,d.width,d.height);null!==h&&""!==h&&(b.fillStyle=h,b.fillRect(0,0,d.width,d.height));var w=Ib.alloc();
w.reset();w.translate(c.left,c.top);w.scale(e);0===f.x&&0===f.y||w.translate(-f.x,-f.y);b.setTransform(w.m11,w.m12,w.m21,w.m22,w.dx,w.dy);Ib.free(w);Lj(a,b);b.globalAlpha=a.wb;if(null!==g){var y=new I,z=g.iterator;for(z.reset();z.next();){var B=z.value;!1===l&&"Grid"===B.layer.name||null===B||y.add(B)}var D=function(c){if(c.visible&&0!==c.wb&&(k||!c.isTemporary)){var d=c.Ha.j,e=d.length;if(0!==e){var f=zi(c,b),g=c.sp;g.length=0;for(var h=a.scale,l=L.alloc(),m=0;m<e;m++){var n=d[m];y.contains(n)&&
c.dj(b,n,a,g,h,l)}L.free(l);b.globalAlpha=f}}}}else if(!k&&l){var G=a.grid.part,O=G.layer;D=function(c){c===O?G.hc(b,a):c.hc(b,a,k)}}else D=function(c){c.hc(b,a,k)};for(c=0;c<p;c++)D(n[c]);a.Bi=!1;a.xi&&Mj(a.xi,a)&&a.Yr()}finally{a.Fa=m,a.Lb.yc(!0),hj(a),a.Hd(n,p,a),Dj(a)}}}t.Re=function(a){return this.pf[a]};t.Ry=function(a,b){"minDrawingLength"===a&&(this.Vo=b);this.pf[a]=b;this.ge()};
t.Aw=function(){this.pf=new jb;this.pf.drawShadows=!0;this.pf.textGreeking=!0;this.pf.viewportOptimizations=eb||$a||bb?!1:!0;this.pf.temporaryPixelRatio=!0;this.pf.pictureRatioOptimization=!0;this.Vo=this.pf.minDrawingLength=1};function Lj(a,b){a=a.pf;null!==a&&(void 0!==a.imageSmoothingEnabled&&b.Qy(!!a.imageSmoothingEnabled),a=a.defaultFont,void 0!==a&&null!==a&&(b.font=a))}t.Dm=function(a){return this.Kj[a]};t.VA=function(a,b){this.Kj[a]=b};
t.zw=function(){this.Kj=new jb;this.Kj.extraTouchArea=10;this.Kj.extraTouchThreshold=10;this.Kj.hasGestureZoom=!0};t.Hw=function(a){Oj(this,a)};
function Oj(a,b){var c=a instanceof U,d=a instanceof Q,e;for(e in b){""===e&&v("Setting properties requires non-empty property names");var f=a,g=e;if(c||d){var h=e.indexOf(".");if(0<h){var k=e.substring(0,h);if(c)f=a.fb(k);else if(f=a[k],void 0===f||null===f)f=a.toolManager[k];Fa(f)?g=e.substr(h+1):v("Unable to find object named: "+k+" in "+a.toString()+" when trying to set property: "+e)}}if("_"!==g[0]&&!Ra(f,g))if(d&&"ModelChanged"===g){a.Xx(b[g]);continue}else if(d&&"Changed"===g){a.Lh(b[g]);continue}else if(d&&
Ra(a.toolManager,g))f=a.toolManager;else if(d&&Pj(a,g)){a.ik(g,b[g]);continue}else if(a instanceof W&&"Changed"===g){a.Lh(b[g]);continue}else v('Trying to set undefined property "'+g+'" on object: '+f.toString());f[g]=b[e];"_"===g[0]&&f instanceof N&&f.Ux(g)}}t.Hv=function(){if(0===this.undoManager.transactionLevel&&0!==this.ah.count){for(;0<this.ah.count;){var a=this.ah;this.ah=new Db;for(a=a.iterator;a.next();){var b=a.key;b.Qq(a.value);b.ic()}}this.P()}};
t.P=function(a){void 0===a&&(a=null);if(null===a)this.Hc=!0,this.Hb();else{var b=this.viewportBounds;null!==a&&a.o()&&b.Oc(a)&&(this.Hc=!0,this.Hb())}this.U("InvalidateDraw")};
t.Cy=function(a,b){if(!0!==this.Hc){this.Hc=!0;var c=!0===this.Re("temporaryPixelRatio");if(!0===this.Re("viewportOptimizations")&&this.scrollMode!==oi&&this.Ui.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=L.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.jq&&0<d.width&&0<d.height){if(!(this.Ic||(this.Me=!1,null===this.Ia||(this.Ic=!0,this.Hv(),this.documentBounds.o()||
Qj(this,this.computeBounds()),e=this.ya,null===e||e instanceof Rj)))){var g=this.Yb;f=this.Da*g;var h=this.Ca*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.Ku;a=this.ux;k.width!==f&&(k.width=f);k.height!==h&&(k.height=h);a.clearRect(0,0,f,h);k=190*g;var m=70*g,n=Math.max(l,0),p=Math.max(b,0),r=Math.floor(f-n),q=Math.floor(h-p);a.drawImage(e.Ka,n,p,r,q,0,0,r,q);Mj(this.xi,this)&&a.clearRect(0,0,k,m);e=La();a=La();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 L(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));var w=this.sb;w.reset();w.scale(g,g);1!==this.Fa&&w.scale(this.Fa);g=this.sa;(0!==g.x||0!==g.y)&&isFinite(g.x)&&isFinite(g.y)&&w.translate(-g.x,-g.y);Jb(n,w);Jb(q,w);e.push(new L(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 L(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-
q.x),Math.abs(n.y-q.y)));Jb(n,w);Jb(q,w);e.push(new L(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));Mj(this.xi,this)&&(f=0<l?0:-l,h=0<b?0:-b,n.h(f,h),q.h(k+f,m+h),a.push(new L(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y))),Jb(n,w),Jb(q,w),e.push(new L(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);oj(this,!1,!0);null===this.Ia&&v("No div specified");null===this.ya&&v("No canvas specified");if(!this.animationManager.wc&&
(f=this.Lb,this.Hc)){Kj(this);h=this.Yb;f.setTransform(1,0,0,1,0,0);f.clearRect(0,0,this.Da*h,this.Ca*h);f.drawImage(this.Ku.Ka,0<l?0:Math.round(-l),0<b?0:Math.round(-b));b=this.sa;g=this.Fa;k=Math.round(b.x*g)/g;m=Math.round(b.y*g)/g;l=this.sb;l.reset();1!==g&&l.scale(g);0===b.x&&0===b.y||l.translate(-k,-m);f.save();f.beginPath();b=a.length;for(g=0;g<b;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(l.m11,l.m12,l.m21,l.m22,l.dx,l.dy);F&&F.sm&&F.Pv&&F.Pv(this,f);h=this.Pa.j;b=h.length;this.Hd(h,b,this);Lj(this,f);f.globalAlpha=this.wb;for(g=0;g<b;g++)if(k=h[g],m=e,k.visible&&0!==k.wb){p=zi(k,f);n=k.sp;n.length=0;r=this.scale;q=L.alloc();w=k.Ha.j;u=w.length;for(var y=m.length,z=0;z<u;z++){var B=w[z];a:{var D=Sj(B,B.actualBounds);for(var G=m,O=y,V=2/r,P=4/r,ca=0;ca<O;ca++){var Y=G[ca];if(0!==Y.width&&0!==Y.height&&D.ew(Y.x-V,Y.y-V,Y.width+P,Y.height+P)){D=!0;break a}}D=
!1}D&&k.dj(f,B,this,n,r,q)}L.free(q);f.globalAlpha=p}f.restore();f.yc(!0);F&&(F.ky||F.sm)&&F.Qv&&F.Qv(f,this,l);this.xi&&Mj(this.xi,this)&&this.Yr();this.Hc=this.Ai=!1;this.gu()}Oa(e);Oa(a);this.Ic=!1}}else this.cd();L.free(d);c&&(hf(this),this.cd(),wf(this,!0))}else c?(hf(this),this.cd(),wf(this,!0)):this.cd()}};function nj(a){!1===a.zi&&(a.zi=!0)}function hj(a){!1===a.Ai&&(a.Ai=!0)}function Kj(a){!1!==a.Al&&(a.Al=!1,Tj(a,a.Da,a.Ca))}
function Tj(a,b,c){var d=a.Yb;a.ya.resize(b*d,c*d,b,c)&&(a.Hc=!0,a.Lb.yc(!0))}
function fj(a){var b=a.ya;if(null===b)return!0;var c=a.Ia,d=a.Da,e=a.Ca,f=a.viewportBounds.copy();if(!f.o())return!0;var g=!1,h=a.df?a.rb:0,k=a.ue?a.rb:0,l=c.clientWidth||d+h,m=c.clientHeight||e+k;if(l!==d+h||m!==e+k)a.df=!1,a.ue=!1,k=h=0,a.Da=l,a.Ca=m,g=a.Al=!0;if(!(g||a.df||a.ue||a.rl||a.sl))return!0;a.zi=!1;var n=a.viewportBounds,p=a.documentBounds,r=0,q=0,u=0,w=0;c=n.width;var y=n.height,z=a.Ui;a.contentAlignment.bb()?(p.width>c&&(r=z.left,q=z.right),p.height>y&&(u=z.top,w=z.bottom)):(r=z.left,
q=z.right,u=z.top,w=z.bottom);z=p.width+r+q;var B=p.height+u+w;r=p.x-r;var D=n.x;q=p.right+q;var G=n.right+h;u=p.y-u;var O=n.y;p=p.bottom+w;n=n.bottom+k;var V="1px",P="1px";w=a.scale;l=z>l/w;m=B>m/w;a.scrollMode===mi&&(l||m)&&(l&&a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(l=1,r+1<D&&(l=Math.max((D-r)*w+a.Da,l)),q>G+1&&(l=Math.max((q-G)*w+a.Da,l)),c+h+1<z&&(l=Math.max((z-c)*w+a.Da,l)),V=l.toString()+"px"),m&&a.hasVerticalScrollbar&&a.allowVerticalScroll&&(l=1,u+1<O&&(l=Math.max((O-u)*w+a.Ca,
l)),p>n+1&&(l=Math.max((p-n)*w+a.Ca,l)),y+k+1<B&&(l=Math.max((B-y)*w+a.Ca,l)),P=l.toString()+"px"));l="1px"!==V;m="1px"!==P;l&&m||!l&&!m||(m&&(G-=a.rb),l&&(n-=a.rb),z<c+h||!a.hasHorizontalScrollbar||!a.allowHorizontalScroll||(h=1,r+1<D&&(h=Math.max((D-r)*w+a.Da,h)),q>G+1&&(h=Math.max((q-G)*w+a.Da,h)),c+1<z&&(h=Math.max((z-c)*w+a.Da,h)),V=h.toString()+"px"),l="1px"!==V,h=a.Ca,l!==a.ue&&(h=l?a.Ca-a.rb:a.Ca+a.rb),B<y+k||!a.hasVerticalScrollbar||!a.allowVerticalScroll||(k=1,u+1<O&&(k=Math.max((O-u)*w+
h,k)),p>n+1&&(k=Math.max((p-n)*w+h,k)),y+1<B&&(k=Math.max((B-y)*w+h,k)),P=k.toString()+"px"),m="1px"!==P);if(a.Pp&&l===a.ue&&m===a.df)return d===a.Da&&e===a.Ca||a.cd(),!1;l!==a.ue&&("1px"===V?a.Ca=a.Ca+a.rb:a.Ca=Math.max(a.Ca-a.rb,1),g=!0);a.ue=l;a.Qp.style.width=V;m!==a.df&&("1px"===P?a.Da=a.Da+a.rb:a.Da=Math.max(a.Da-a.rb,1),g=!0,a.Cl&&(k=J.alloc(),m?(b.style.left=a.rb+"px",a.position=k.h(a.sa.x+a.rb/a.scale,a.sa.y)):(b.style.left="0px",a.position=k.h(a.sa.x-a.rb/a.scale,a.sa.y)),J.free(k)));a.df=
m;a.Qp.style.height=P;a.at=!0;g&&(a.Al=!0);b=a.dt;k=b.scrollLeft;a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(c+1<z?k=(a.position.x-r)*w:r+1<D?k=b.scrollWidth-b.clientWidth:q>G+1&&(k=a.position.x*w));if(a.Cl)switch(a.Ys){case "negative":k=-(b.scrollWidth-k-b.clientWidth);break;case "reverse":k=b.scrollWidth-k-b.clientWidth}b.scrollLeft=k;a.hasVerticalScrollbar&&a.allowVerticalScroll&&(y+1<B?b.scrollTop=(a.position.y-u)*w:u+1<O?b.scrollTop=b.scrollHeight-b.clientHeight:p>n+1&&(b.scrollTop=a.position.y*
w));l=a.Da;m=a.Ca;b.style.width=l+(a.df?a.rb:0)+"px";b.style.height=m+(a.ue?a.rb:0)+"px";return d!==l||e!==m||a.animationManager.wc?(a.Zq(f,a.viewportBounds,w,g),!1):!0}
t.add=function(a){x(a,S,Q,"add:part");var b=a.diagram;if(b!==this&&(null!==b&&v("Cannot add part "+a.toString()+" to "+this.toString()+". It is already a part of "+b.toString()),b=this.zm(a.layerName),null===b&&(b=this.zm("")),null===b&&v('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.gb(Je,"parts",b,null,a,null,c);b.isTemporary||this.Ta();a.D(1);c=a.layerChanged;null!==c&&c(a,null,
b)}};t.nj=function(a){this.partManager.nj(a);var b=this;Uj(a,function(a){Vj(b,a)});(a instanceof Te||a instanceof Hf&&null!==a.placeholder)&&a.u();null!==a.data&&Uj(a,function(a){Wj(b.partManager,a)});!0!==Ij(a)&&!0!==Jj(a)||this.ud.add(a);Xj(a,!0,this);Yj(a)?(a.actualBounds.o()&&this.P(Sj(a,a.actualBounds)),this.Ta()):a.isVisible()&&a.actualBounds.o()&&this.P(Sj(a,a.actualBounds));this.Hb()};
t.Nc=function(a){a.lk();this.partManager.Nc(a);var b=this;null!==a.data&&Uj(a,function(a){Zj(b.partManager,a,b)});this.ud.remove(a);Yj(a)?(a.actualBounds.o()&&this.P(Sj(a,a.actualBounds)),this.Ta()):a.isVisible()&&a.actualBounds.o()&&this.P(Sj(a,a.actualBounds));this.Hb()};t.remove=function(a){x(a,S,Q,"remove:part");ak(this,a,!0)};
function ak(a,b,c){var d=b.layer;null!==d&&d.diagram===a&&(b.isSelected=!1,b.isHighlighted=!1,b.D(2),c&&b.sk(),c=d.Nc(-1,b,!1),0<=c&&a.gb(Ke,"parts",d,b,null,c,null),a=b.layerChanged,null!==a&&a(b,d,null))}t.iu=function(a,b){if(Ga(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 I,c.addAll(a),a=c.iterator;a.next();)c=a.value,b&&!c.canDelete()||this.remove(c)};t.rk=function(a,b,c){return this.partManager.rk(a,b,c)};
Q.prototype.moveParts=function(a,b,c,d){void 0===d&&(d=bk(this));x(b,J,Q,"moveParts:offset");if(null!==this.toolManager){var e=new Db;if(null!==a)if(Ga(a))for(var f=0;f<a.length;f++)ck(this,e,a[f],c,d);else for(a=a.iterator;a.next();)ck(this,e,a.value,c,d);else{for(a=this.parts;a.next();)ck(this,e,a.value,c,d);for(a=this.nodes;a.next();)ck(this,e,a.value,c,d);for(a=this.links;a.next();)ck(this,e,a.value,c,d)}Ef(this,e,b,d,c)}};
function ck(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=bk(a)),c instanceof T){b.add(c,a.zd(e,c,c.location));if(c instanceof Hf&&(null!==c.placeholder||e.dragsMembers))for(f=c.memberParts;f.next();)ck(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)&&ck(a,b,g,d,e)}}if(e.dragsTree)for(c=c.Yv();c.next();)ck(a,b,
c.value,d,e)}else if(c instanceof R)for(b.add(c,a.zd(e,c)),c=c.labelNodes;c.next();)ck(a,b,c.value,d,e);else c instanceof Te||b.add(c,a.zd(e,c,c.location))}
function Ef(a,b,c,d,e){if(null!==b&&(x(b,Db,Q,"moveParts:parts"),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.iq)||jf(a,b);for(var h=La(),k=La(),l=b.iterator,m=J.alloc();l.next();){var n=l.key,p=l.value;if(n.bc()){var r=dk(a,n,b);if(null!==r)h.push(new ek(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.je(r))}else l.key instanceof R&&k.push(l.ra)}J.free(m);
e=h.length;for(l=0;l<e;l++)n=h[l],f.assign(n.info.point),void 0===n.bw.shifted&&(n.bw.shifted=new J),n.node.location=f.add(n.bw.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 R)if(r.suspendsRouting){r.wh=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.zd(d,r,g)),Cf(r,g.x-u.x,g.y-u.y);else{q=J.allocAt(0,0);(m=r.i(0))&&m.o()&&q.assign(m);var w=m=J.alloc().assign(q).add(g);d.isGridSnapEnabled&&
(d.isGridSnapRealtime||a.lastInput.up)&&(w=J.alloc(),Tg(a,r,m,w,d));m.assign(r.dragComputation(r,m,w)).je(q);b.add(r,a.zd(d,r,m));Cf(r,m.x-u.x,m.y-u.y);J.free(q);J.free(m);w!==m&&J.free(w)}else null!==m&&(e.assign(m.location),w=b.K(m),null!==w&&e.je(w.point)),null!==u&&(l.assign(u.location),w=b.K(u),null!==w&&l.je(w.point)),null!==m&&null!==u?e.Sa(l)?(m=q.value.point,u=f,u.assign(e),u.je(m),b.add(r,a.zd(d,r,e)),Cf(r,u.x,u.y)):(r.suspendsRouting=!1,r.Ya()):(q=q.value.point,m=null!==m?e:null!==u?l:
g,b.add(r,a.zd(d,r,m)),Cf(r,m.x-q.x,m.y-q.y))}else if(null===r.fromNode||null===r.toNode)m=q.value.point,b.add(r,a.zd(d,r,g)),Cf(r,g.x-m.x,g.y-m.y)}J.free(f);J.free(g);J.free(e);J.free(l);Oa(h);Oa(k);c||(ij(a),sf(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(),Tg(this,a,b,e,c));c=null!==a.dragComputation?a.dragComputation(a,b,e):e;var g=a.minLocation,h=g.x;isNaN(h)&&(h=f?Math.round(a.location.x):a.location.x);g=g.y;isNaN(g)&&(g=f?Math.round(a.location.y):a.location.y);var k=a.maxLocation,l=k.x;isNaN(l)&&(l=f?Math.round(a.location.x):a.location.x);k=k.y;isNaN(k)&&(k=f?Math.round(a.location.y):
a.location.y);d.h(Math.max(h,Math.min(c.x,l)),Math.max(g,Math.min(c.y,k)));e!==b&&J.free(e);return d};function bk(a){var b=a.toolManager.findTool("Dragging");return null!==b?b.dragOptions:a.el}
function Tg(a,b,c,d,e){void 0===e&&(e=bk(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.Hq(c.x,c.y,h+f.x,g+f.y,a,b,d);J.free(f)}}function jf(a,b){if(null!==b)for(a.iq=!0,a=b.iterator;a.next();)b=a.key,b instanceof R&&(b.suspendsRouting=!0)}
function sf(a,b){if(null!==b){for(b=b.iterator;b.next();){var c=b.key;c instanceof R&&(c.suspendsRouting=!1,fk(c)&&c.Ya())}a.iq=!1}}function dk(a,b,c){b=b.containingGroup;if(null!==b){a=dk(a,b,c);if(null!==a)return a;a=c.K(b);if(null!==a)return a}return null}t=Q.prototype;t.zd=function(a,b,c){if(void 0===c)return new mf(Rb);var d=a.isGridSnapEnabled;a.groupsSnapMembers||null===b.containingGroup||(d=!1);return d?new mf(new J(Math.round(c.x),Math.round(c.y))):new mf(c.copy())};
function gk(a,b,c){x(b,wi,Q,"addLayer:layer");null!==b.diagram&&b.diagram!==a&&v("Cannot share a Layer with another Diagram: "+b+" of "+b.diagram);null===c?null!==b.diagram&&v("Cannot add an existing Layer to this Diagram again: "+b):(x(c,wi,Q,"addLayer:existingLayer"),c.diagram!==a&&v("Existing Layer must be in this Diagram: "+c+" not in "+c.diagram),b===c&&v("Cannot move a Layer before or after itself: "+b));if(b.diagram!==a){b=b.name;a=a.Pa;c=a.count;for(var d=0;d<c;d++)a.O(d).name===b&&v("Cannot add Layer with the name '"+
b+"'; a Layer with the same name is already present in this Diagram.")}}t.pm=function(a){gk(this,a,null);a.he(this);var b=this.Pa,c=b.count-1;if(!a.isTemporary)for(;0<=c&&b.O(c).isTemporary;)c--;b.zb(c+1,a);null!==this.gc&&this.gb(Je,"layers",this,null,a,null,c+1);this.P();this.Ta()};
t.Vx=function(a,b){gk(this,a,b);a.he(this);var c=this.Pa,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.gc&&this.gb(Ke,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.O(f)===b){c.zb(f,a);break}null!==this.gc&&this.gb(Je,"layers",this,null,a,null,f);this.P();0>d&&this.Ta()};
t.iz=function(a,b){gk(this,a,b);a.he(this);var c=this.Pa,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.gc&&this.gb(Ke,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.O(f)===b){c.zb(f+1,a);break}null!==this.gc&&this.gb(Je,"layers",this,null,a,null,f+1);this.P();0>d&&this.Ta()};
t.OA=function(a){x(a,wi,Q,"removeLayer:layer");a.diagram!==this&&v("Cannot remove a Layer from another Diagram: "+a+" of "+a.diagram);if(""!==a.name){var b=this.Pa,c=b.indexOf(a);if(b.remove(a)){for(b=a.Ha.copy().iterator;b.next();){var d=b.value,e=d.layerName;e!==a.name?d.layerName=e:d.layerName=""}null!==this.gc&&this.gb(Ke,"layers",this,a,null,c,null);this.P();this.Ta()}}};t.zm=function(a){for(var b=this.layers;b.next();){var c=b.value;if(c.name===a)return c}return null};
t.Xx=function(a){A(a,"function",Q,"addModelChangedListener:listener");null===this.Ce&&(this.Ce=new H);this.Ce.add(a);this.model.Lh(a)};t.QA=function(a){A(a,"function",Q,"removeModelChangedListener:listener");null!==this.Ce&&(this.Ce.remove(a),0===this.Ce.count&&(this.Ce=null));this.model.Kk(a)};t.Lh=function(a){A(a,"function",Q,"addChangedListener:listener");null===this.Vf&&(this.Vf=new H);this.Vf.add(a)};
t.Kk=function(a){A(a,"function",Q,"removeChangedListener:listener");null!==this.Vf&&(this.Vf.remove(a),0===this.Vf.count&&(this.Vf=null))};t.Bt=function(a){this.skipsUndoManager||this.model.skipsUndoManager||this.model.undoManager.cw(a);a.change!==Ie&&(this.isModified=!0);if(null!==this.Vf)for(var b=this.Vf,c=b.length,d=0;d<c;d++)b.O(d)(a)};
t.gb=function(a,b,c,d,e,f,g){void 0===f&&(f=null);void 0===g&&(g=null);var h=new Ge;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.Bt(h)};t.g=function(a,b,c,d,e){this.gb(He,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===He){var e=a.object;hk(e,a.propertyName,a.K(b));if(e instanceof N){var f=e.part;null!==f&&f.Sb()}this.isModified=!0}else if(d===Je){var g=a.object,h=a.newParam,k=a.newValue;if(g instanceof U)if("number"===typeof h&&k instanceof N){b?g.Nc(h):g.zb(h,k);var l=g.part;null!==l&&l.Sb()}else{if("number"===typeof h&&k instanceof ik)if(b)k.isRow?
g.xw(h):g.vw(h);else{var m=k.isRow?g.getRowDefinition(k.index):g.getColumnDefinition(k.index);m.Et(k)}}else if(g instanceof wi){var n=!0===a.oldParam;"number"===typeof h&&k instanceof S&&(b?(k.isSelected=!1,k.isHighlighted=!1,k.Sb(),g.Nc(n?h:-1,k,n)):g.nj(h,k,n))}else g instanceof Q?"number"===typeof h&&k instanceof wi&&(b?this.Pa.hb(h):(k.he(this),this.Pa.zb(h,k))):v("unknown ChangedEvent.Insert object: "+a.toString());this.isModified=!0}else if(d===Ke){var p=a.object,r=a.oldParam,q=a.oldValue;if(p instanceof
U)"number"===typeof r&&q instanceof N?b?p.zb(r,q):p.Nc(r):"number"===typeof r&&q instanceof ik&&(b?(m=q.isRow?p.getRowDefinition(q.index):p.getColumnDefinition(q.index),m.Et(q)):q.isRow?p.xw(r):p.vw(r));else if(p instanceof wi){var u=!0===a.newParam;"number"===typeof r&&q instanceof S&&(b?0>p.Ha.indexOf(q)&&p.nj(r,q,u):(q.isSelected=!1,q.isHighlighted=!1,q.Sb(),p.Nc(u?r:-1,q,u)))}else p instanceof Q?"number"===typeof r&&q instanceof wi&&(b?(q.he(this),this.Pa.zb(r,q)):this.Pa.hb(r)):v("unknown ChangedEvent.Remove object: "+
a.toString());this.isModified=!0}else d!==Ie&&v("unknown ChangedEvent: "+a.toString())}finally{this.skipsModelSourceBindings=c}}};Q.prototype.Ba=function(a){return this.undoManager.Ba(a)};Q.prototype.ab=function(a){return this.undoManager.ab(a)};Q.prototype.Nf=function(){return this.undoManager.Nf()};
Q.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.Ba(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.ab(b):this.undoManager.Nf(),this.skipsUndoManager=c}};Q.prototype.updateAllTargetBindings=function(a){this.partManager.updateAllTargetBindings(a)};Q.prototype.nr=function(){this.partManager.nr()};
function jk(a,b,c){var d=a.animationManager;if(a.Xb||a.Ic)a.Fa=c,d.lf&&d.Kd.add(d.B,"scale",b,a.Fa);else if(null===a.ya)a.Fa=c;else{a.Xb=!0;var e=a.viewportBounds.copy(),f=a.Da,g=a.Ca;e.width=a.Da/b;e.height=a.Ca/b;var h=a.zoomPoint.x,k=a.zoomPoint.y,l=a.contentAlignment;isNaN(h)&&(l.nd()?l.Jf(Uc)?h=0:l.Jf(Vc)&&(h=f-1):h=l.bb()?l.x*(f-1):f/2);isNaN(k)&&(l.nd()?l.Jf(Tc)?k=0:l.Jf(Wc)&&(k=g-1):k=l.bb()?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.sa.x+h/b-h/c,a.sa.y+k/b-k/c);a.position=f;J.free(f);a.Fa=c;a.Zq(e,a.viewportBounds,b,!1);a.Xb=!1;kj(a,!1);d.lf&&d.Kd.add(d.B,"scale",b,a.Fa);a.P();nj(a)}}
Q.prototype.Zq=function(a,b,c,d){if(!a.A(b)){void 0===d&&(d=!1);d||nj(this);hj(this);var e=this.layout;null===e||!e.isViewportSized||this.autoScale!==Wh||d||a.width===b.width&&a.height===b.height||e.D();e=this.currentTool;!0===this.gg&&e instanceof Ua&&(this.lastInput.documentPoint=this.pu(this.lastInput.viewPoint),af(e,this));this.Xb||this.Cy(a,b);Dj(this);this.ae.scale=c;this.ae.position.x=a.x;this.ae.position.y=a.y;this.ae.bounds.assign(a);this.ae.iw=d;this.U("ViewportBoundsChanged",this.ae,a);
this.isVirtualized&&this.links.each(function(a){a.isAvoiding&&a.actualBounds.Oc(b)&&a.Ya()})}};
function Dj(a,b){void 0===b&&(b=null);var c=a.Nb;if(null!==c&&c.visible){for(var d=Hb.alloc(),e=1,f=1,g=c.$.j,h=g.length,k=0;k<h;k++){var l=g[k],m=l.interval;2>m||(kk(l.figure)?f=f*m/K.sy(f,m):e=e*m/K.sy(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=L.alloc();a=a.viewportBounds;b.h(a.x,a.y,a.width,a.height);if(!b.o()){L.free(b);return}e=b.width;f=b.height;a=b.x;g=b.y;L.free(b)}c.width=e+2*d.width;c.height=f+2*d.height;b=J.alloc();K.Hq(a,g,0,0,
d.width,d.height,b);b.offset(-d.width,-d.height);Hb.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.U("ChangingSelection",b);for(var c=b.ua(),d=c.length,e=0;e<d;e++)c[e].isSelected=!1;b.ka();b.clear();b.freeze();a||this.U("ChangedSelection",b)}};
Q.prototype.select=function(a){null!==a&&(x(a,S,Q,"select:part"),a.layer.diagram===this&&(!a.isSelected||1<this.selection.count)&&(this.U("ChangingSelection",this.selection),this.clearSelection(!0),a.isSelected=!0,this.U("ChangedSelection",this.selection)))};
Q.prototype.UA=function(a){this.U("ChangingSelection",this.selection);this.clearSelection(!0);if(Ga(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];d instanceof S||v("Diagram.selectCollection given something that is not a Part: "+d);d.isSelected=!0}else for(a=a.iterator;a.next();)b=a.value,b instanceof S||v("Diagram.selectCollection given something that is not a Part: "+b),b.isSelected=!0;this.U("ChangedSelection",this.selection)};
Q.prototype.clearHighlighteds=function(){var a=this.highlighteds;if(0<a.count){for(var b=a.ua(),c=b.length,d=0;d<c;d++)b[d].isHighlighted=!1;a.ka();a.clear();a.freeze()}};t=Q.prototype;t.pA=function(a){null!==a&&a.layer.diagram===this&&(x(a,S,Q,"highlight:part"),!a.isHighlighted||1<this.highlighteds.count)&&(this.clearHighlighteds(),a.isHighlighted=!0)};
t.qA=function(a){a=(new I).addAll(a);for(var b=this.highlighteds.copy().cr(a).iterator;b.next();)b.value.isHighlighted=!1;for(a=a.iterator;a.next();)b=a.value,b instanceof S||v("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}v("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:v("scrolling direction must be 'up', 'down', 'left', or 'right', not: "+b);this.position=c};
t.Cw=function(a){var b=this.viewportBounds;b.Pe(a)||(a=a.center,a.x-=b.width/2,a.y-=b.height/2,this.position=a)};t.Ct=function(a){var b=this.viewportBounds;a=a.center;a.x-=b.width/2;a.y-=b.height/2;this.position=a};t.lr=function(a){var b=this.sb;b.reset();1!==this.Fa&&b.scale(this.Fa);var c=this.sa;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return a.copy().transform(this.sb)};
t.cB=function(a){var b=this.sb,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 L(f,r,p-f,b-r)};
t.pu=function(a){var b=this.sb;b.reset();1!==this.Fa&&b.scale(this.Fa);var c=this.sa;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return Jb(a.copy(),this.sb)};function lk(a){var b=a.isModified;a.Av!==b&&(a.Av=b,a.U("Modified"))}function mk(a){a=Hi.get(a);return null!==a?new a:new Ii}
Q.prototype.doModelChanged=function(a){var b=this;if(a.model===this.model){var c=a.change,d=a.propertyName;if(c===Ie&&"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.Ic||this.ve||(this.Ej=!0,this.Hj&&(this.Me=!0))}else"StartingUndo"===d||"StartingRedo"===d?(a=this.animationManager,a.defaultAnimation.isAnimating&&!this.skipsUndoManager&&
a.dd(),this.U("ChangingSelection",this.selection)):"StartedTransaction"===d&&(a=this.animationManager,a.defaultAnimation.isAnimating&&!this.skipsUndoManager&&a.dd());else if(this.ba){this.ba=!1;try{if(""===a.modelChange&&c===Ie){if("FinishedUndo"===d||"FinishedRedo"===d)this.U("ChangedSelection",this.selection),ij(this);var f=this.animationManager;"RolledBackTransaction"===d&&f.dd();this.Ej=!0;this.cd();0!==this.undoManager.transactionLevel&&1!==this.undoManager.transactionLevel||Gh(f);"CommittedTransaction"===
d&&this.undoManager.isJustDiscarded&&(this.Qd=Math.min(this.Qd,this.undoManager.historyIndex-1));"CommittedTransaction"!==d&&"RolledBackTransaction"!==d||!this.undoManager.isPendingUnmodified||setTimeout(function(){b.isModified=!1},1);var g=a.isTransactionFinished;g&&(lk(this),this.Yt.clear(),di(this.animationManager));if(!this.Hs&&g&&this.lastInput.targetDiagram){this.Hs=!0;var h=this;ta(function(){h.currentTool.standardMouseOver();h.Hs=!1},10)}}}finally{this.ba=!0}}}};
function Vj(a,b){b=b.$.j;for(var c=b.length,d=0;d<c;d++)nk(a,b[d])}function nk(a,b){if(b instanceof xk){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){var d=b.eh;null!==d&&(d.ql instanceof Event&&null!==b.Gc&&b.Gc(b,d.ql),!0===d.ps&&(null!==b.xf&&b.xf(b,d.pv),null!==b.diagram&&b.diagram.Rs.add(b)));c=c.getAttribute("src");d=a.Ri.K(c);if(null===d)d=[],d.push(b),a.Ri.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}}
function Bk(a,b){if(b instanceof xk){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){c=c.getAttribute("src");var d=a.Ri.K(c);if(null!==d)for(var e=0;e<d.length;e++)if(d[e]===b){d.splice(e,1);0===d.length&&(a.Ri.remove(c),Ck(c));break}}}}Q.prototype.Gd=function(){this.partManager.Gd()};Q.prototype.hk=function(a,b){this.Sc.hk(a,b)};Q.prototype.jk=function(a,b){this.Sc.jk(a,b)};Q.prototype.findPartForKey=function(a){return this.partManager.findPartForKey(a)};Q.prototype.Rb=function(a){return this.partManager.Rb(a)};
Q.prototype.findLinkForKey=function(a){return this.partManager.findLinkForKey(a)};t=Q.prototype;t.Dc=function(a){return this.partManager.Dc(a)};t.gj=function(a){return this.partManager.gj(a)};t.Cc=function(a){return this.partManager.Cc(a)};t.Kt=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.Kt.apply(this.partManager,b instanceof Array?b:da(ba(b)))};
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)))};function Qj(a,b){a.yi=!1;var c=a.Sn;c.A(b)||(b=b.J(),a.Sn=b,kj(a,!1),a.U("DocumentBoundsChanged",null,c.copy()),nj(a))}function Zi(a){a.yi&&Qj(a,a.computeBounds())}t.$z=function(){for(var a=new I,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.Zz=function(){return this.Hh.iterator};
t.BA=function(a){ij(this);a&&Dk(this,!0);this.Ej=!0;Vf(this)};function Dk(a,b){for(var c=a.Hh.iterator;c.next();)Ek(a,c.value,b);null!==a.layout&&(b?a.layout.isValidLayout=!1:a.layout.D())}function Ek(a,b,c){if(null!==b){for(var d=b.Ol.iterator;d.next();)Ek(a,d.value,c);null!==b.layout&&(c?b.layout.isValidLayout=!1:b.layout.D())}}
function Ej(a,b){if(a.Tg&&!a.Sr){var c=a.ba;a.ba=!0;var d=a.undoManager.transactionLevel,e=a.layout,f=a.animationManager;try{0===d&&(a.undoManager.isInternalTransaction=!0,a.Ba("Layout"));1>=d&&!f.isAnimating&&!f.wc&&(b||Eh(f,"Layout"));a.Tg=!1;for(var g=a.Hh.iterator;g.next();)Fk(a,g.value,b,d);e.isValidLayout||(!b||e.isRealtime||null===e.isRealtime||0===d?(e.doLayout(a),ij(a),e.isValidLayout=!0):a.Tg=!0)}finally{b=a.undoManager.isInternalTransaction,0===d&&(a.ab("Layout"),a.undoManager.isInternalTransaction=
!1),!b||0!==d&&1!==d||Gh(f),a.ba=c}}}function Fk(a,b,c,d){if(null!==b){for(var e=b.Ol.iterator;e.next();)Fk(a,e.value,c,d);e=b.layout;null===e||e.isValidLayout||(!c||e.isRealtime||0===d?(b.Ik=!b.location.o(),e.doLayout(b),b.D(32),Gj(a,b),e.isValidLayout=!0):a.Tg=!0)}}t.fA=function(){for(var a=new H,b=this.nodes;b.next();){var c=b.value;c.isTopLevel&&null===c.jj()&&a.add(c)}return a.iterator};
function Fi(a){function b(a){var b=a.toLowerCase(),e=new H;c.add(a,e);c.add(b,e);d.add(a,a);d.add(b,a)}var c=new Db,d=new Db;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.Vr=c;a.Ur=d}
function Pj(a,b){var c=a.Ur.K(b);return null!==c?c:a.Ur.K(b.toLowerCase())}function Gk(a,b){var c=a.Vr.K(b);if(null!==c)return c;c=a.Vr.K(b.toLowerCase());if(null!==c)return c;v("Unknown DiagramEvent name: "+b)}t.ik=function(a,b){A(a,"string",Q,"addDiagramListener:name");A(b,"function",Q,"addDiagramListener:listener");a=Gk(this,a);null!==a&&a.add(b)};t.Pm=function(a,b){A(a,"string",Q,"removeDiagramListener:name");A(b,"function",Q,"addDiagramListener:listener");a=Gk(this,a);null!==a&&a.remove(b)};
t.U=function(a,b,c){F&&A(a,"string",Q,"raiseDiagramEvent:name");var d=Gk(this,a),e=new Fe;e.diagram=this;a=Pj(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.O(0)(e);else if(0!==b)for(d=d.ua(),c=0;c<b;c++)(0,d[c])(e)};function Hk(a){if(a.animationManager.isTicking)return!1;var b=a.currentTool;return b===a.toolManager.findTool("Dragging")?!a.iq||b.isComplexRoutingRealtime:!0}
t.Ak=function(a,b){void 0===b&&(b=null);return Ik(this,!1,null,b).Ak(a.x,a.y,a.width,a.height)};Q.prototype.computeOccupiedArea=function(){return this.isVirtualized?this.viewportBounds.copy():this.yi?jj(this):this.documentBounds.copy()};
function Ik(a,b,c,d){null===a.Ob&&(a.Ob=new Jk);if(a.Ob.St||a.Ob.group!==c||a.Ob.Sy!==d){if(null===c){b=a.computeOccupiedArea();b.Lc(100,100);a.Ob.initialize(b);b=L.alloc();for(var e=a.nodes;e.next();){var f=e.value,g=f.layer;null!==g&&g.visible&&!g.isTemporary&&Kk(a,f,d,b)}L.free(b)}else{0<c.memberParts.count&&(b=a.computePartsBounds(c.memberParts,!1),b.Lc(20,20),a.Ob.initialize(b));b=L.alloc();for(e=c.memberParts;e.next();)f=e.value,f instanceof T&&Kk(a,f,d,b);L.free(b)}a.Ob.group=c;a.Ob.Sy=d;a.Ob.St=
!1}else b&&Lk(a.Ob);return a.Ob}function Kk(a,b,c,d){if(b!==c)if(b.isVisible()&&b.avoidable&&!b.isLinkLabel){var e=b.getAvoidableRect(d),f=a.Ob.um;c=a.Ob.tm;d=e.x+e.width;b=e.y+e.height;for(var g=e.x;g<d;g+=f){for(var h=e.y;h<b;h+=c)Mk(a.Ob,g,h);Mk(a.Ob,g,b)}for(e=e.y;e<b;e+=c)Mk(a.Ob,d,e);Mk(a.Ob,d,b)}else if(b instanceof Hf)for(b=b.memberParts;b.next();)e=b.value,e instanceof T&&Kk(a,e,c,d)}
function Nk(a,b){null!==a.Ob&&!a.Ob.St&&(void 0===b&&(b=null),null===b||b.avoidable&&!b.isLinkLabel)&&(a.Ob.St=!0)}Q.prototype.Gt=function(a){this.tn.assign(a);this.computeAutoScrollPosition(this.tn).Sa(this.position)?this.Of():Ok(this)};
function Ok(a){-1===a.yj&&(a.yj=ta(function(){if(-1!==a.yj&&(a.Of(),null!==a.lastInput.event)){var b=a.computeAutoScrollPosition(a.tn);b.Sa(a.position)||(a.position=b,a.lastInput.documentPoint=a.pu(a.tn),a.doMouseMove(),a.yi=!0,Qj(a,a.documentBounds.copy().Pc(a.computeBounds())),a.Hc=!0,a.cd(),Ok(a))}},a.sn))}Q.prototype.Of=function(){-1!==this.yj&&(qa.clearTimeout(this.yj),this.yj=-1)};
Q.prototype.computeAutoScrollPosition=function(a){var b=this.position,c=this.un;if(0>=c.top&&0>=c.left&&0>=c.right&&0>=c.bottom)return b;var d=this.viewportBounds,e=this.scale;d=L.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){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&&(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?(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&&(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.Sa(Rb)||(b=new J(b.x+f.x/e,b.y+f.y/e));L.free(d);J.free(f);return b};t=Q.prototype;t.$t=function(){return null};t.jw=function(){return null};
t.mz=function(a,b){this.Lx.add(a,b)};function Pk(a,b,c){function d(){var a=+new Date;f=!0;for(g.reset();g.next();)if(!g.value[0].Kl){f=!1;break}f||a-l>k?b(c,e,h):qa.requestAnimationFrame(d)}for(var e=c.callback,f=!0,g=a.Ri.iterator;g.next();)if(!g.value[0].Kl){f=!1;break}if("function"!==typeof e||f)return b(c,e,a);var h=a,k=c.callbackTimeout||300,l=+new Date;qa.requestAnimationFrame(function(){d()});return null}t.DA=function(a){if(!gh)return null;void 0===a&&(a=new jb);a.returnType="Image";return this.Ey(a)};
t.Ey=function(a){void 0===a&&(a=new jb);return Pk(this,this.EA,a)};
t.EA=function(a,b,c){var d=Qk(c,a,"canvas",null);if(null===d)return null;c=d.aa.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&&v('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 Qk(a,b,c,d){a.animationManager.dd();a.cd();if(null===a.ya)return null;"object"!==typeof b&&v("properties argument must be an Object.");var e=!1,f=b.size||null,g=b.scale||null;void 0!==b.scale&&isNaN(b.scale)&&(g="NaN");var h=b.maxSize;void 0===b.maxSize&&(e=!0,h="SVG"===c?new Hb(Infinity,Infinity):new Hb(2E3,2E3));var k=b.position||null,l=b.parts||null,m=void 0===b.padding?1:b.padding,n=b.background||null,p=b.omitTemporary;void 0===p&&(p=!0);var r=b.document||document,q=b.elementFinished||
null,u=b.showTemporary;void 0===u&&(u=!p);b=b.showGrid;void 0===b&&(b=u);null!==f&&isNaN(f.width)&&isNaN(f.height)&&(f=null);"number"===typeof m?m=new lc(m):m instanceof lc||v("MakeImage padding must be a Margin or a number.");m.left=Math.max(m.left,0);m.right=Math.max(m.right,0);m.top=Math.max(m.top,0);m.bottom=Math.max(m.bottom,0);a.Lb.yc(!0);p=new Rk(null,r);var w=p.context;if(!(f||g||l||k)){p.width=a.Da+Math.ceil(m.left+m.right);p.height=a.Ca+Math.ceil(m.top+m.bottom);if("SVG"===c){if(null===
d)return null;d.resize(p.width,p.height,p.width,p.height);d.ownerDocument=r;d.Eq=q;Nj(a,d.context,m,new Hb(p.width,p.height),a.Fa,a.sa,l,n,u,b);return d.context}a.ll=!1;Nj(a,w,m,new Hb(p.width,p.height),a.Fa,a.sa,l,n,u,b);a.ll=!0;return p.context}var y=a.Rn,z=a.documentBounds.copy();z.Lw(a.lb);if(u)for(var B=a.Pa.j,D=B.length,G=0;G<D;G++){var O=B[G];if(O.visible&&O.isTemporary){O=O.Ha.j;for(var V=O.length,P=0;P<V;P++){var ca=O[P];ca.isInDocumentBounds&&ca.isVisible()&&(ca=ca.actualBounds,ca.o()&&
z.Pc(ca))}}}B=new J(z.x,z.y);if(null!==l){D=!0;G=l.iterator;for(G.reset();G.next();)if(O=G.value,O instanceof S&&(V=O.layer,(null===V||V.visible)&&(null===V||u||!V.isTemporary)&&O.isVisible()&&(O=O.actualBounds,O.o())))if(D){D=!1;var Y=O.copy()}else Y.Pc(O);D&&(Y=new L(0,0,0,0));z.width=Y.width;z.height=Y.height;B.x=Y.x;B.y=Y.y}null!==k&&k.o()&&(B=k,g||(g=y));Y=k=0;null!==m&&(k=m.left+m.right,Y=m.top+m.bottom);D=G=0;null!==f&&(G=f.width,D=f.height,isFinite(G)&&(G=Math.max(0,G-k)),isFinite(D)&&(D=
Math.max(0,D-Y)));null!==f&&null!==g?("NaN"===g&&(g=y),f.o()?(f=G,z=D):isNaN(D)?(f=G,z=z.height*g):(f=z.width*g,z=D)):null!==f?f.o()?(g=Math.min(G/z.width,D/z.height),f=G,z=D):isNaN(D)?(g=G/z.width,f=G,z=z.height*g):(g=D/z.height,f=z.width*g,z=D):null!==g?"NaN"===g&&h.o()?(g=Math.min((h.width-k)/z.width,(h.height-Y)/z.height),g>y?(g=y,f=z.width,z=z.height):(f=h.width,z=h.height)):(f=z.width*g,z=z.height*g):(g=y,f=z.width,z=z.height);null!==m?(f+=k,z+=Y):m=new lc(0);null!==h&&(y=h.width,h=h.height,
"SVG"!==c&&e&&!Sk&&F&&(f>y||z>h)&&(Ca("Diagram.makeImage(data): Diagram width or height is larger than the default max size. ("+Math.ceil(f)+"x"+Math.ceil(z)+" vs 2000x2000) Consider increasing the max size."),Sk=!0),isNaN(y)&&(y=2E3),isNaN(h)&&(h=2E3),isFinite(y)&&(f=Math.min(f,y)),isFinite(h)&&(z=Math.min(z,h)));p.width=Math.ceil(f);p.height=Math.ceil(z);if("SVG"===c){if(null===d)return null;d.resize(p.width,p.height,p.width,p.height);d.ownerDocument=r;d.Eq=q;Nj(a,d.context,m,new Hb(Math.ceil(f),
Math.ceil(z)),g,B,l,n,u,b);return d.context}a.ll=!1;Nj(a,w,m,new Hb(Math.ceil(f),Math.ceil(z)),g,B,l,n,u,b);a.ll=!0;return p.context}
ma.Object.defineProperties(Q.prototype,{div:{configurable:!0,get:function(){return this.Ia},set:function(a){null!==a&&x(a,HTMLDivElement,Q,"div");if(this.Ia!==a){Xa=[];var b=this.Ia;null!==b?(b.B=void 0,b.goDiagram=void 0,b.innerHTML="",null!==this.ya&&(b=this.ya.Ka,this.removeEventListener(b,"touchstart",this.Qw,!1),this.removeEventListener(b,"touchmove",this.Pw,!1),this.removeEventListener(b,"touchend",this.Ow,!1),this.ya.iy()),this.Ul&&(this.Ul.disconnect(),this.Ul=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.Lb=this.ya=null,this.removeEventListener(qa,"resize",this.Ww,!1),this.removeEventListener(qa,"mousemove",this.Ek,!0),this.removeEventListener(qa,"mousedown",this.Dk,!0),this.removeEventListener(qa,"mouseup",this.Gk,!0),this.removeEventListener(qa,"wheel",this.Hk,!0),this.removeEventListener(qa,
"mouseout",this.Fk,!0),Pe===this&&(Pe=null)):this.ve=!1;this.Ia=null;if(null!==a){if(b=a.B)b.div=null;Pi(this,a);this.ge()}}}},Zx:{configurable:!0,get:function(){return this.bp}},zk:{configurable:!0,get:function(){return this.ve}},draggedLink:{configurable:!0,get:function(){return this.Xr},set:function(a){this.Xr!==a&&(this.Xr=a,null!==a&&(this.Ls=a.fromPort,this.Ms=a.toPort))}},Hy:{configurable:!0,get:function(){return this.Ls},set:function(a){this.Ls=
a}},Iy:{configurable:!0,get:function(){return this.Ms},set:function(a){this.Ms=a}},animationManager:{configurable:!0,get:function(){return this.Sc}},undoManager:{configurable:!0,get:function(){return this.gc.undoManager}},skipsUndoManager:{configurable:!0,get:function(){return this.Bg},set:function(a){A(a,"boolean",Q,"skipsUndoManager");this.Bg=a;this.gc.skipsUndoManager=a}},delaysLayout:{configurable:!0,get:function(){return this.Sr},
set:function(a){this.Sr=a}},opacity:{configurable:!0,get:function(){return this.wb},set:function(a){var b=this.wb;b!==a&&(A(a,"number",Q,"opacity"),(0>a||1<a)&&ya(a,"0 <= value <= 1",Q,"opacity"),this.wb=a,this.g("opacity",b,a),this.P())}},validCycle:{configurable:!0,get:function(){return this.wt},set:function(a){var b=this.wt;b!==a&&(hb(a,Q,Q,"validCycle"),this.wt=a,this.g("validCycle",b,a))}},layers:{configurable:!0,get:function(){return this.Pa.iterator}},
isModelReadOnly:{configurable:!0,get:function(){var a=this.gc;return null===a?!1:a.isReadOnly},set:function(a){var b=this.gc;null!==b&&(b.isReadOnly=a)}},isReadOnly:{configurable:!0,get:function(){return this.hg},set:function(a){var b=this.hg;b!==a&&(A(a,"boolean",Q,"isReadOnly"),this.hg=a,this.g("isReadOnly",b,a))}},isEnabled:{configurable:!0,get:function(){return this.gd},set:function(a){var b=this.gd;b!==a&&(A(a,"boolean",Q,"isEnabled"),this.gd=a,this.g("isEnabled",
b,a))}},allowClipboard:{configurable:!0,get:function(){return this.tr},set:function(a){var b=this.tr;b!==a&&(A(a,"boolean",Q,"allowClipboard"),this.tr=a,this.g("allowClipboard",b,a))}},allowCopy:{configurable:!0,get:function(){return this.di},set:function(a){var b=this.di;b!==a&&(A(a,"boolean",Q,"allowCopy"),this.di=a,this.g("allowCopy",b,a))}},allowDelete:{configurable:!0,get:function(){return this.ei},set:function(a){var b=this.ei;b!==a&&(A(a,"boolean",
Q,"allowDelete"),this.ei=a,this.g("allowDelete",b,a))}},allowDragOut:{configurable:!0,get:function(){return this.ur},set:function(a){var b=this.ur;b!==a&&(A(a,"boolean",Q,"allowDragOut"),this.ur=a,this.g("allowDragOut",b,a))}},allowDrop:{configurable:!0,get:function(){return this.vr},set:function(a){var b=this.vr;b!==a&&(A(a,"boolean",Q,"allowDrop"),this.vr=a,this.g("allowDrop",b,a))}},allowTextEdit:{configurable:!0,get:function(){return this.ni},set:function(a){var b=
this.ni;b!==a&&(A(a,"boolean",Q,"allowTextEdit"),this.ni=a,this.g("allowTextEdit",b,a))}},allowGroup:{configurable:!0,get:function(){return this.fi},set:function(a){var b=this.fi;b!==a&&(A(a,"boolean",Q,"allowGroup"),this.fi=a,this.g("allowGroup",b,a))}},allowUngroup:{configurable:!0,get:function(){return this.oi},set:function(a){var b=this.oi;b!==a&&(A(a,"boolean",Q,"allowUngroup"),this.oi=a,this.g("allowUngroup",b,a))}},allowInsert:{configurable:!0,get:function(){return this.xr},
set:function(a){var b=this.xr;b!==a&&(A(a,"boolean",Q,"allowInsert"),this.xr=a,this.g("allowInsert",b,a))}},allowLink:{configurable:!0,get:function(){return this.gi},set:function(a){var b=this.gi;b!==a&&(A(a,"boolean",Q,"allowLink"),this.gi=a,this.g("allowLink",b,a))}},allowRelink:{configurable:!0,get:function(){return this.ii},set:function(a){var b=this.ii;b!==a&&(A(a,"boolean",Q,"allowRelink"),this.ii=a,this.g("allowRelink",b,a))}},allowMove:{configurable:!0,
get:function(){return this.hi},set:function(a){var b=this.hi;b!==a&&(A(a,"boolean",Q,"allowMove"),this.hi=a,this.g("allowMove",b,a))}},allowReshape:{configurable:!0,get:function(){return this.ji},set:function(a){var b=this.ji;b!==a&&(A(a,"boolean",Q,"allowReshape"),this.ji=a,this.g("allowReshape",b,a))}},allowResize:{configurable:!0,get:function(){return this.ki},set:function(a){var b=this.ki;b!==a&&(A(a,"boolean",Q,"allowResize"),this.ki=a,this.g("allowResize",b,a))}},
allowRotate:{configurable:!0,get:function(){return this.li},set:function(a){var b=this.li;b!==a&&(A(a,"boolean",Q,"allowRotate"),this.li=a,this.g("allowRotate",b,a))}},allowSelect:{configurable:!0,get:function(){return this.mi},set:function(a){var b=this.mi;b!==a&&(A(a,"boolean",Q,"allowSelect"),this.mi=a,this.g("allowSelect",b,a))}},allowUndo:{configurable:!0,get:function(){return this.yr},set:function(a){var b=this.yr;b!==a&&(A(a,"boolean",Q,"allowUndo"),
this.yr=a,this.g("allowUndo",b,a))}},allowZoom:{configurable:!0,get:function(){return this.Ar},set:function(a){var b=this.Ar;b!==a&&(A(a,"boolean",Q,"allowZoom"),this.Ar=a,this.g("allowZoom",b,a))}},hasVerticalScrollbar:{configurable:!0,get:function(){return this.sl},set:function(a){var b=this.sl;b!==a&&(A(a,"boolean",Q,"hasVerticalScrollbar"),this.sl=a,nj(this),this.P(),this.g("hasVerticalScrollbar",b,a),kj(this,!1))}},hasHorizontalScrollbar:{configurable:!0,
get:function(){return this.rl},set:function(a){var b=this.rl;b!==a&&(A(a,"boolean",Q,"hasHorizontalScrollbar"),this.rl=a,nj(this),this.P(),this.g("hasHorizontalScrollbar",b,a),kj(this,!1))}},allowHorizontalScroll:{configurable:!0,get:function(){return this.wr},set:function(a){var b=this.wr;b!==a&&(A(a,"boolean",Q,"allowHorizontalScroll"),this.wr=a,this.g("allowHorizontalScroll",b,a),kj(this,!1))}},allowVerticalScroll:{configurable:!0,get:function(){return this.zr},set:function(a){var b=
this.zr;b!==a&&(A(a,"boolean",Q,"allowVerticalScroll"),this.zr=a,this.g("allowVerticalScroll",b,a),kj(this,!1))}},scrollHorizontalLineChange:{configurable:!0,get:function(){return this.bt},set:function(a){var b=this.bt;b!==a&&(A(a,"number",Q,"scrollHorizontalLineChange"),0>a&&ya(a,">= 0",Q,"scrollHorizontalLineChange"),this.bt=a,this.g("scrollHorizontalLineChange",b,a))}},scrollVerticalLineChange:{configurable:!0,get:function(){return this.ft},set:function(a){var b=this.ft;
b!==a&&(A(a,"number",Q,"scrollVerticalLineChange"),0>a&&ya(a,">= 0",Q,"scrollVerticalLineChange"),this.ft=a,this.g("scrollVerticalLineChange",b,a))}},lastInput:{configurable:!0,get:function(){return this.mh},set:function(a){F&&x(a,we,Q,"lastInput");this.mh=a}},firstInput:{configurable:!0,get:function(){return this.cg},set:function(a){F&&x(a,we,Q,"firstInput");this.cg=a}},currentCursor:{configurable:!0,get:function(){return this.Mr},set:function(a){""===a&&
(a=this.Qn);if(this.Mr!==a){A(a,"string",Q,"currentCursor");var b=this.ya,c=this.Ia;if(null!==b){this.Mr=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:{configurable:!0,get:function(){return this.Qn},set:function(a){""===a&&(a="auto");var b=this.Qn;b!==
a&&(A(a,"string",Q,"defaultCursor"),this.Qn=a,this.g("defaultCursor",b,a))}},click:{configurable:!0,get:function(){return this.Wf},set:function(a){var b=this.Wf;b!==a&&(null!==a&&A(a,"function",Q,"click"),this.Wf=a,this.g("click",b,a))}},doubleClick:{configurable:!0,get:function(){return this.ag},set:function(a){var b=this.ag;b!==a&&(null!==a&&A(a,"function",Q,"doubleClick"),this.ag=a,this.g("doubleClick",b,a))}},contextClick:{configurable:!0,get:function(){return this.Xf},
set:function(a){var b=this.Xf;b!==a&&(null!==a&&A(a,"function",Q,"contextClick"),this.Xf=a,this.g("contextClick",b,a))}},mouseOver:{configurable:!0,get:function(){return this.tg},set:function(a){var b=this.tg;b!==a&&(null!==a&&A(a,"function",Q,"mouseOver"),this.tg=a,this.g("mouseOver",b,a))}},mouseHover:{configurable:!0,get:function(){return this.rg},set:function(a){var b=this.rg;b!==a&&(null!==a&&A(a,"function",Q,"mouseHover"),this.rg=a,this.g("mouseHover",b,a))}},mouseHold:{configurable:!0,
enumerable:!0,get:function(){return this.qg},set:function(a){var b=this.qg;b!==a&&(null!==a&&A(a,"function",Q,"mouseHold"),this.qg=a,this.g("mouseHold",b,a))}},mouseDragOver:{configurable:!0,get:function(){return this.Gs},set:function(a){var b=this.Gs;b!==a&&(null!==a&&A(a,"function",Q,"mouseDragOver"),this.Gs=a,this.g("mouseDragOver",b,a))}},mouseDrop:{configurable:!0,get:function(){return this.og},set:function(a){var b=this.og;b!==a&&(F&&null!==a&&A(a,"function",Q,"mouseDrop"),
this.og=a,this.g("mouseDrop",b,a))}},handlesDragDropForTopLevelParts:{configurable:!0,get:function(){return this.gs},set:function(a){var b=this.gs;b!==a&&(A(a,"boolean",Q,"handlesDragDropForTopLevelParts"),this.gs=a,this.g("handlesDragDropForTopLevelParts",b,a))}},mouseEnter:{configurable:!0,get:function(){return this.pg},set:function(a){var b=this.pg;b!==a&&(null!==a&&A(a,"function",Q,"mouseEnter"),this.pg=a,this.g("mouseEnter",b,a))}},mouseLeave:{configurable:!0,
get:function(){return this.sg},set:function(a){var b=this.sg;b!==a&&(null!==a&&A(a,"function",Q,"mouseLeave"),this.sg=a,this.g("mouseLeave",b,a))}},toolTip:{configurable:!0,get:function(){return this.Dg},set:function(a){var b=this.Dg;b!==a&&(!F||null===a||a instanceof Te||a instanceof bf||v("Diagram.toolTip must be an Adornment or HTMLInfo."),this.Dg=a,this.g("toolTip",b,a))}},contextMenu:{configurable:!0,get:function(){return this.Yf},set:function(a){var b=this.Yf;b!==
a&&(!F||a instanceof Te||a instanceof bf||v("Diagram.contextMenu must be an Adornment or HTMLInfo."),this.Yf=a,this.g("contextMenu",b,a))}},commandHandler:{configurable:!0,get:function(){return this.Gr},set:function(a){this.Gr!==a&&(this.Gr=a,a.he(this))}},toolManager:{configurable:!0,get:function(){return this.st},set:function(a){this.st!==a&&(x(a,Ua,Q,"toolManager"),this.st=a,a.diagram=this)}},defaultTool:{configurable:!0,get:function(){return this.Rr},
set:function(a){var b=this.Rr;b!==a&&(x(a,Oe,Q,"defaultTool"),this.Rr=a,a.diagram=this,this.currentTool===b&&(this.currentTool=a))}},currentTool:{configurable:!0,get:function(){return this.Or},set:function(a){var b=this.Or;null!==b&&(b.isActive&&b.doDeactivate(),b.cancelWaitAfter(),b.doStop());null===a&&(a=this.defaultTool);null!==a&&(x(a,Oe,Q,"currentTool"),this.Or=a,a.diagram=this,a.doStart())}},selection:{configurable:!0,get:function(){return this.rv}},maxSelectionCount:{configurable:!0,
enumerable:!0,get:function(){return this.Cs},set:function(a){var b=this.Cs;if(b!==a)if(A(a,"number",Q,"maxSelectionCount"),0<=a&&!isNaN(a)){if(this.Cs=a,this.g("maxSelectionCount",b,a),!this.undoManager.isUndoingRedoing&&(a=this.selection.count-a,0<a)){this.U("ChangingSelection",this.selection);b=this.selection.ua();for(var c=0;c<a;c++)b[c].isSelected=!1;this.U("ChangedSelection",this.selection)}}else ya(a,">= 0",Q,"maxSelectionCount")}},nodeSelectionAdornmentTemplate:{configurable:!0,
get:function(){return this.lp},set:function(a){var b=this.lp;b!==a&&(x(a,Te,Q,"nodeSelectionAdornmentTemplate"),this.lp=a,this.g("nodeSelectionAdornmentTemplate",b,a))}},groupSelectionAdornmentTemplate:{configurable:!0,get:function(){return this.qo},set:function(a){var b=this.qo;b!==a&&(x(a,Te,Q,"groupSelectionAdornmentTemplate"),this.qo=a,this.g("groupSelectionAdornmentTemplate",b,a))}},linkSelectionAdornmentTemplate:{configurable:!0,get:function(){return this.Ko},set:function(a){var b=
this.Ko;b!==a&&(x(a,Te,Q,"linkSelectionAdornmentTemplate"),this.Ko=a,this.g("linkSelectionAdornmentTemplate",b,a))}},highlighteds:{configurable:!0,get:function(){return this.Su}},isModified:{configurable:!0,get:function(){var a=this.undoManager;return a.isEnabled?null!==a.currentTransaction?!0:this.vo&&this.Qd!==a.historyIndex:this.vo},set:function(a){if(this.vo!==a){A(a,"boolean",Q,"isModified");this.vo=a;var b=this.undoManager;!a&&b.isEnabled&&(this.Qd=b.historyIndex);
a||lk(this)}}},model:{configurable:!0,get:function(){return this.gc},set:function(a){var b=this.gc;if(b!==a){x(a,W,Q,"model");this.currentTool.doCancel();null!==b&&b.undoManager!==a.undoManager&&b.undoManager.isInTransaction&&v("Do not replace a Diagram.model while a transaction is in progress.");this.animationManager.dd(!0);var c=Yi(this,!0);this.ve=!1;this.Hj=!0;this.Qd=-2;this.Me=!1;var d=this.Ic;this.Ic=!0;Eh(this.animationManager,"Model");null!==b&&(null!==this.Ce&&this.Ce.each(function(a){b.Kk(a)}),
b.Kk(this.Qc));this.gc=a;this.partManager=mk(this.gc.type);for(var e=0;e<c.length;e++)this.add(c[e]);a.Lh(this.qd);this.partManager.addAllModeledParts();a.Kk(this.qd);a.Lh(this.Qc);null!==this.Ce&&this.Ce.each(function(b){a.Lh(b)});this.Ic=d;this.Xb||this.P();null!==b&&a.undoManager.copyProperties(b.undoManager)}}},ba:{configurable:!0,get:function(){return this.bv},set:function(a){this.bv=a}},Yt:{configurable:!0,get:function(){return this.Bx}},skipsModelSourceBindings:{configurable:!0,
enumerable:!0,get:function(){return this.sv},set:function(a){this.sv=a}},ou:{configurable:!0,get:function(){return this.kt},set:function(a){this.kt=a}},nodeTemplate:{configurable:!0,get:function(){return this.kf.K("")},set:function(a){var b=this.kf.K("");b!==a&&(x(a,S,Q,"nodeTemplate"),this.kf.add("",a),this.g("nodeTemplate",b,a),this.undoManager.isUndoingRedoing||this.Gd())}},nodeTemplateMap:{configurable:!0,get:function(){return this.kf},set:function(a){var b=
this.kf;b!==a&&(x(a,Db,Q,"nodeTemplateMap"),this.kf=a,this.g("nodeTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Gd())}},groupTemplate:{configurable:!0,get:function(){return this.kh.K("")},set:function(a){var b=this.kh.K("");b!==a&&(x(a,Hf,Q,"groupTemplate"),this.kh.add("",a),this.g("groupTemplate",b,a),this.undoManager.isUndoingRedoing||this.Gd())}},groupTemplateMap:{configurable:!0,get:function(){return this.kh},set:function(a){var b=this.kh;b!==a&&(x(a,Db,
Q,"groupTemplateMap"),this.kh=a,this.g("groupTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Gd())}},linkTemplate:{configurable:!0,get:function(){return this.jg.K("")},set:function(a){var b=this.jg.K("");b!==a&&(x(a,R,Q,"linkTemplate"),this.jg.add("",a),this.g("linkTemplate",b,a),this.undoManager.isUndoingRedoing||this.Gd())}},linkTemplateMap:{configurable:!0,get:function(){return this.jg},set:function(a){var b=this.jg;b!==a&&(x(a,Db,Q,"linkTemplateMap"),this.jg=
a,this.g("linkTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Gd())}},isMouseCaptured:{configurable:!0,get:function(){return this.Yu},set:function(a){var b=this.ya;null!==b&&(b=b.Ka,b instanceof SVGElement||(a?(this.lastInput.bubbles=!1,this.on?(this.removeEventListener(b,"pointermove",this.Km,!1),this.removeEventListener(b,"pointerdown",this.Jm,!1),this.removeEventListener(b,"pointerup",this.Mm,!1),this.removeEventListener(b,"pointerout",this.Lm,!1),this.addEventListener(qa,
"pointermove",this.Km,!0),this.addEventListener(qa,"pointerdown",this.Jm,!0),this.addEventListener(qa,"pointerup",this.Mm,!0),this.addEventListener(qa,"pointerout",this.Lm,!0)):(this.removeEventListener(b,"mousemove",this.Ek,!1),this.removeEventListener(b,"mousedown",this.Dk,!1),this.removeEventListener(b,"mouseup",this.Gk,!1),this.removeEventListener(b,"mouseout",this.Fk,!1),this.addEventListener(qa,"mousemove",this.Ek,!0),this.addEventListener(qa,"mousedown",this.Dk,!0),this.addEventListener(qa,
"mouseup",this.Gk,!0),this.addEventListener(qa,"mouseout",this.Fk,!0)),this.removeEventListener(b,"wheel",this.Hk,!1),this.addEventListener(qa,"wheel",this.Hk,!0),this.addEventListener(qa,"selectstart",this.preventDefault,!1)):(this.on?(this.removeEventListener(qa,"pointermove",this.Km,!0),this.removeEventListener(qa,"pointerdown",this.Jm,!0),this.removeEventListener(qa,"pointerup",this.Mm,!0),this.removeEventListener(qa,"pointerout",this.Lm,!0),this.addEventListener(b,"pointermove",this.Km,!1),this.addEventListener(b,
"pointerdown",this.Jm,!1),this.addEventListener(b,"pointerup",this.Mm,!1),this.addEventListener(b,"pointerout",this.Lm,!1)):(this.removeEventListener(qa,"mousemove",this.Ek,!0),this.removeEventListener(qa,"mousedown",this.Dk,!0),this.removeEventListener(qa,"mouseup",this.Gk,!0),this.removeEventListener(qa,"mouseout",this.Fk,!0),this.addEventListener(b,"mousemove",this.Ek,!1),this.addEventListener(b,"mousedown",this.Dk,!1),this.addEventListener(b,"mouseup",this.Gk,!1),this.addEventListener(b,"mouseout",
this.Fk,!1)),this.removeEventListener(qa,"wheel",this.Hk,!0),this.removeEventListener(qa,"selectstart",this.preventDefault,!1),this.addEventListener(b,"wheel",this.Hk,!1)),this.Yu=a))}},position:{configurable:!0,get:function(){return this.sa},set:function(a){var b=J.alloc().assign(this.sa);if(!b.A(a)){x(a,J,Q,"position");var c=this.viewportBounds.copy();this.sa.assign(a);fi(this.animationManager,b,this.sa);this.Xb||null===this.ya&&!this.om.o()||(this.Xb=!0,a=this.scale,mj(this,this.Sn,
this.Da/a,this.Ca/a,this.Aj,!1),this.Xb=!1);this.Xb||this.Zq(c,this.viewportBounds,this.Fa,!1)}J.free(b)}},initialPosition:{configurable:!0,get:function(){return this.js},set:function(a){this.js.A(a)||(x(a,J,Q,"initialPosition"),this.js=a.J())}},initialScale:{configurable:!0,get:function(){return this.ks},set:function(a){this.ks!==a&&(A(a,"number",Q,"initialScale"),this.ks=a)}},grid:{configurable:!0,get:function(){null===this.Nb&&dj(this);return this.Nb},
set:function(a){var b=this.Nb;if(b!==a){null===b&&(dj(this),b=this.Nb);x(a,U,Q,"grid");a.type!==U.Grid&&v("Diagram.grid must be a Panel of type Panel.Grid");var c=b.panel;null!==c&&c.remove(b);this.Nb=a;a.name="GRID";null!==c&&c.add(a);Dj(this);this.P();this.g("grid",b,a)}}},viewportBounds:{configurable:!0,get:function(){var a=this.Sx,b=this.sa,c=this.Fa;if(null===this.ya)return this.om.o()&&a.h(b.x,b.y,this.Da/c,this.Ca/c),a;a.h(b.x,b.y,Math.max(this.Da,0)/c,Math.max(this.Ca,0)/c);
return a}},viewSize:{configurable:!0,get:function(){return this.om},set:function(a){var b=this.viewSize;b.A(a)||(x(a,Hb,Q,"viewSize"),this.om=a=a.J(),this.Da=a.width,this.Ca=a.height,this.Ta(),this.g("viewSize",b,a))}},fixedBounds:{configurable:!0,get:function(){return this.ds},set:function(a){var b=this.ds;b.A(a)||(x(a,L,Q,"fixedBounds"),(F&&Infinity===a.width||-Infinity===a.width||Infinity===a.height||-Infinity===a.height)&&v("fixedBounds width/height must not be Infinity"),
this.ds=a=a.J(),this.Ta(),this.g("fixedBounds",b,a))}},scrollMargin:{configurable:!0,get:function(){return this.Ui},set:function(a){"number"===typeof a?a=new lc(a):x(a,lc,Q,"scrollMargin");var b=this.Ui;b.A(a)||(this.Ui=a=a.J(),this.g("scrollMargin",b,a),this.ge())}},scrollMode:{configurable:!0,get:function(){return this.Vi},set:function(a){var b=this.Vi;b!==a&&(hb(a,Q,Q,"scrollMode"),this.Vi=a,a===mi&&kj(this,!1),this.g("scrollMode",b,a),this.P())}},scrollsPageOnFocus:{configurable:!0,
enumerable:!0,get:function(){return this.gt},set:function(a){var b=this.gt;b!==a&&(A(a,"boolean",Q,"scrollsPageOnFocus"),this.gt=a,this.g("scrollsPageOnFocus",b,a))}},positionComputation:{configurable:!0,get:function(){return this.Us},set:function(a){var b=this.Us;b!==a&&(null!==a&&A(a,"function",Q,"positionComputation"),this.Us=a,kj(this,!1),this.g("positionComputation",b,a))}},scaleComputation:{configurable:!0,get:function(){return this.$s},set:function(a){var b=this.$s;
b!==a&&(null!==a&&A(a,"function",Q,"scaleComputation"),this.$s=a,jk(this,this.scale,this.scale),this.g("scaleComputation",b,a))}},documentBounds:{configurable:!0,get:function(){return this.Sn}},isVirtualized:{configurable:!0,get:function(){return this.vs},set:function(a){var b=this.vs;b!==a&&(A(a,"boolean",Q,"isVirtualized"),this.vs=a,this.g("isVirtualized",b,a))}},scale:{configurable:!0,get:function(){return this.Fa},set:function(a){var b=this.Fa;C(a,Q,"scale");
b!==a&&jk(this,b,a)}},defaultScale:{configurable:!0,get:function(){return this.Rn},set:function(a){F&&C(a,Q,"defaultScale");!F||0<a||v("defaultScale must be larger than zero, not: "+a);this.Rn=a}},autoScale:{configurable:!0,get:function(){return this.Ug},set:function(a){var b=this.Ug;b!==a&&(hb(a,Q,Q,"autoScale"),this.Ug=a,this.g("autoScale",b,a),a!==Wh&&kj(this,!1))}},initialAutoScale:{configurable:!0,get:function(){return this.fg},set:function(a){var b=
this.fg;b!==a&&(hb(a,Q,Q,"initialAutoScale"),this.fg=a,this.g("initialAutoScale",b,a))}},initialViewportSpot:{configurable:!0,get:function(){return this.ls},set:function(a){var b=this.ls;b!==a&&(x(a,M,Q,"initialViewportSpot"),a.bb()||v("initialViewportSpot must be a specific Spot: "+a),this.ls=a,this.g("initialViewportSpot",b,a))}},initialDocumentSpot:{configurable:!0,get:function(){return this.hs},set:function(a){var b=this.hs;b!==a&&(x(a,M,Q,"initialDocumentSpot"),a.bb()||
v("initialViewportSpot must be a specific Spot: "+a),this.hs=a,this.g("initialDocumentSpot",b,a))}},minScale:{configurable:!0,get:function(){return this.Ds},set:function(a){C(a,Q,"minScale");var b=this.Ds;b!==a&&(0<a?(this.Ds=a,this.g("minScale",b,a),a>this.scale&&(this.scale=a)):ya(a,"> 0",Q,"minScale"))}},maxScale:{configurable:!0,get:function(){return this.Bs},set:function(a){C(a,Q,"maxScale");var b=this.Bs;b!==a&&(0<a?(this.Bs=a,this.g("maxScale",b,a),a<this.scale&&
(this.scale=a)):ya(a,"> 0",Q,"maxScale"))}},zoomPoint:{configurable:!0,get:function(){return this.zt},set:function(a){this.zt.A(a)||(x(a,J,Q,"zoomPoint"),this.zt=a=a.J())}},contentAlignment:{configurable:!0,get:function(){return this.Aj},set:function(a){var b=this.Aj;b.A(a)||(x(a,M,Q,"contentAlignment"),this.Aj=a=a.J(),this.g("contentAlignment",b,a),kj(this,!1))}},initialContentAlignment:{configurable:!0,get:function(){return this.so},set:function(a){var b=
this.so;b.A(a)||(x(a,M,Q,"initialContentAlignment"),this.so=a=a.J(),this.g("initialContentAlignment",b,a))}},padding:{configurable:!0,get:function(){return this.lb},set:function(a){"number"===typeof a?a=new lc(a):x(a,lc,Q,"padding");var b=this.lb;b.A(a)||(this.lb=a=a.J(),this.Ta(),this.g("padding",b,a))}},partManager:{configurable:!0,get:function(){return this.Oa},set:function(a){var b=this.Oa;b!==a&&(x(a,Ii,Q,"partManager"),null!==a.diagram&&v("Cannot share PartManagers between Diagrams: "+
a.toString()),null!==b&&b.he(null),this.Oa=a,a.he(this))}},nodes:{configurable:!0,get:function(){return this.partManager.nodes.iterator}},links:{configurable:!0,get:function(){return this.partManager.links.iterator}},parts:{configurable:!0,get:function(){return this.partManager.parts.iterator}},layout:{configurable:!0,get:function(){return this.oc},set:function(a){var b=this.oc;b!==a&&(x(a,Ni,Q,"layout"),this.oc=a,a.diagram=this,a.group=null,
this.Tg=!0,this.g("layout",b,a),this.Hb())}},isTreePathToChildren:{configurable:!0,get:function(){return this.us},set:function(a){var b=this.us;if(b!==a&&(A(a,"boolean",Q,"isTreePathToChildren"),this.us=a,this.g("isTreePathToChildren",b,a),!this.undoManager.isUndoingRedoing))for(a=this.nodes;a.next();)Tk(a.value)}},treeCollapsePolicy:{configurable:!0,get:function(){return this.ut},set:function(a){var b=this.ut;b!==a&&(a!==Gi&&a!==Uk&&a!==Vk&&v("Unknown Diagram.treeCollapsePolicy: "+
a),this.ut=a,this.g("treeCollapsePolicy",b,a))}},Se:{configurable:!0,get:function(){return this.Vu},set:function(a){this.Vu=a}},autoScrollInterval:{configurable:!0,get:function(){return this.sn},set:function(a){var b=this.sn;C(a,Q,"scale");b!==a&&(this.sn=a,this.g("autoScrollInterval",b,a))}},autoScrollRegion:{configurable:!0,get:function(){return this.un},set:function(a){"number"===typeof a?a=new lc(a):x(a,lc,Q,"autoScrollRegion");var b=this.un;b.A(a)||(this.un=
a=a.J(),this.Ta(),this.g("autoScrollRegion",b,a))}}});ma.Object.defineProperties(Q,{licenseKey:{configurable:!0,get:function(){return Wk.cc()},set:function(a){Wk.add(a)}},version:{configurable:!0,get:function(){return Xk}}});Q.prototype.makeImageData=Q.prototype.Ey;Q.prototype.makeImage=Q.prototype.DA;Q.prototype.addRenderer=Q.prototype.mz;Q.prototype.makeSVG=Q.prototype.jw;Q.prototype.makeSvg=Q.prototype.$t;Q.prototype.stopAutoScroll=Q.prototype.Of;
Q.prototype.doAutoScroll=Q.prototype.Gt;Q.prototype.isUnoccupied=Q.prototype.Ak;Q.prototype.raiseDiagramEvent=Q.prototype.U;Q.prototype.removeDiagramListener=Q.prototype.Pm;Q.prototype.addDiagramListener=Q.prototype.ik;Q.prototype.findTreeRoots=Q.prototype.fA;Q.prototype.layoutDiagram=Q.prototype.BA;Q.prototype.findTopLevelGroups=Q.prototype.Zz;Q.prototype.findTopLevelNodesAndLinks=Q.prototype.$z;Q.prototype.findLinksByExample=Q.prototype.Jt;Q.prototype.findNodesByExample=Q.prototype.Kt;
Q.prototype.findLinkForData=Q.prototype.Cc;Q.prototype.findNodeForData=Q.prototype.gj;Q.prototype.findPartForData=Q.prototype.Dc;Q.prototype.findLinkForKey=Q.prototype.findLinkForKey;Q.prototype.findNodeForKey=Q.prototype.Rb;Q.prototype.findPartForKey=Q.prototype.findPartForKey;Q.prototype.rebuildParts=Q.prototype.Gd;Q.prototype.transformViewToDoc=Q.prototype.pu;Q.prototype.transformRectDocToView=Q.prototype.cB;Q.prototype.transformDocToView=Q.prototype.lr;Q.prototype.centerRect=Q.prototype.Ct;
Q.prototype.scrollToRect=Q.prototype.Cw;Q.prototype.scroll=Q.prototype.scroll;Q.prototype.highlightCollection=Q.prototype.qA;Q.prototype.highlight=Q.prototype.pA;Q.prototype.selectCollection=Q.prototype.UA;Q.prototype.select=Q.prototype.select;Q.prototype.updateAllRelationshipsFromData=Q.prototype.nr;Q.prototype.updateAllTargetBindings=Q.prototype.updateAllTargetBindings;Q.prototype.commit=Q.prototype.commit;Q.prototype.rollbackTransaction=Q.prototype.Nf;Q.prototype.commitTransaction=Q.prototype.ab;
Q.prototype.startTransaction=Q.prototype.Ba;Q.prototype.raiseChanged=Q.prototype.g;Q.prototype.raiseChangedEvent=Q.prototype.gb;Q.prototype.removeChangedListener=Q.prototype.Kk;Q.prototype.addChangedListener=Q.prototype.Lh;Q.prototype.removeModelChangedListener=Q.prototype.QA;Q.prototype.addModelChangedListener=Q.prototype.Xx;Q.prototype.findLayer=Q.prototype.zm;Q.prototype.removeLayer=Q.prototype.OA;Q.prototype.addLayerAfter=Q.prototype.iz;Q.prototype.addLayerBefore=Q.prototype.Vx;
Q.prototype.addLayer=Q.prototype.pm;Q.prototype.moveParts=Q.prototype.moveParts;Q.prototype.copyParts=Q.prototype.rk;Q.prototype.removeParts=Q.prototype.iu;Q.prototype.remove=Q.prototype.remove;Q.prototype.add=Q.prototype.add;Q.prototype.clearDelayedGeometries=Q.prototype.Hv;Q.prototype.setProperties=Q.prototype.Hw;Q.prototype.resetInputOptions=Q.prototype.zw;Q.prototype.setInputOption=Q.prototype.VA;Q.prototype.getInputOption=Q.prototype.Dm;Q.prototype.resetRenderingHints=Q.prototype.Aw;
Q.prototype.setRenderingHint=Q.prototype.Ry;Q.prototype.getRenderingHint=Q.prototype.Re;Q.prototype.maybeUpdate=Q.prototype.cd;Q.prototype.requestUpdate=Q.prototype.Hb;Q.prototype.delayInitialization=Q.prototype.Dz;Q.prototype.isUpdateRequested=Q.prototype.wA;Q.prototype.redraw=Q.prototype.ge;Q.prototype.invalidateDocumentBounds=Q.prototype.Ta;Q.prototype.findObjectsNear=Q.prototype.Jg;Q.prototype.findPartsNear=Q.prototype.Wz;Q.prototype.findObjectsIn=Q.prototype.Ff;Q.prototype.findPartsIn=Q.prototype.qy;
Q.prototype.findObjectsAt=Q.prototype.hj;Q.prototype.findPartsAt=Q.prototype.Vz;Q.prototype.findObjectAt=Q.prototype.$b;Q.prototype.findPartAt=Q.prototype.Am;Q.prototype.focusObject=Q.prototype.gA;Q.prototype.alignDocument=Q.prototype.oz;Q.prototype.zoomToRect=Q.prototype.fB;Q.prototype.zoomToFit=Q.prototype.zoomToFit;Q.prototype.diagramScroll=Q.prototype.hy;Q.prototype.focus=Q.prototype.focus;Q.prototype.reset=Q.prototype.reset;Q.useDOM=function(a){gh=a?void 0!==qa.document:!1};Q.isUsingDOM=function(){return gh};
var Pe=null,Hi=new Db,bj=null,aj=null,gh=void 0!==qa.document,Qi=null,Ri="",Wh=new E(Q,"None",0),pj=new E(Q,"Uniform",1),qj=new E(Q,"UniformToFill",2),$f=new E(Q,"CycleAll",10),dg=new E(Q,"CycleNotDirected",11),fg=new E(Q,"CycleNotDirectedFast",12),gg=new E(Q,"CycleNotUndirected",13),ag=new E(Q,"CycleDestinationTree",14),cg=new E(Q,"CycleSourceTree",15),mi=new E(Q,"DocumentScroll",1),oi=new E(Q,"InfiniteScroll",2),Gi=new E(Q,"TreeParentCollapsed",21),Uk=new E(Q,"AllParentsCollapsed",22),Vk=new E(Q,
"AnyParentsCollapsed",23),Wk=new H,Xk="2.1.26",Sk=!1,Yk=null,Di=!1;
function Ei(){if(gh){var a=qa.document.createElement("canvas");Yk=a}}Q.className="Diagram";
Q.fromDiv=function(a){var b=a;"string"===typeof a&&(b=qa.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);A(a,"function",Q,"inherit");A(b,"function",Q,"inherit");c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a};Q.None=Wh;Q.Uniform=pj;Q.UniformToFill=qj;Q.CycleAll=$f;Q.CycleNotDirected=dg;
Q.CycleNotDirectedFast=fg;Q.CycleNotUndirected=gg;Q.CycleDestinationTree=ag;Q.CycleSourceTree=cg;Q.DocumentScroll=mi;Q.InfiniteScroll=oi;Q.TreeParentCollapsed=Gi;Q.AllParentsCollapsed=Uk;Q.AnyParentsCollapsed=Vk;function Oi(){this.ez=null;this.l="zz@orderNum";"63ad05bbe23a1786468a4c741b6d2"===this._tk?this.af=this.l=!0:this.af=null}
function Mj(a,b){b.Lb.setTransform(b.Yb,0,0,b.Yb,0,0);if(null===a.af){b="f";var c=qa[Ya("76a715b2f73f148a")][Ya("72ba13b5")];a.af=!0;if(gh){var d=Q[Ya("76a115b6ed251eaf4692")];if(d)for(var e=Wk.iterator;e.next();){d=e.value;d=Ya(d).split(Ya("39e9"));if(6>d.length)break;var f=Ya(d[1]).split(".");if("7da71ca0"!==d[4])break;var g=Ya(ra[Ya("6cae19")]).split(".");if(f[0]>g[0]||f[0]===g[0]&&f[1]>=g[1]){f=c[Ya("76ad18b4f73e")];for(g=c[Ya("73a612b6fb191d")](Ya("35e7"))+2;g<f;g++)b+=c[g];f=b[Ya("73a612b6fb191d")](Ya(d[2]));
0>f&&Ya(d[2])!==Ya("7da71ca0ad381e90")&&(f=b[Ya("73a612b6fb191d")](Ya("76a715b2ef3e149757")));0>f&&(f=b[Ya("73a612b6fb191d")](Ya("76a715b2ef3e149757")));0>f&&(f=c[Ya("73a612b6fb191d")](Ya("7baa19a6f76c1988428554")));a.af=!(0<=f&&f<b[Ya("73a612b6fb191d")](Ya("35"))||-1===b[Ya("73a612b6fb191d")](Ya("35")));if(!a.af)break;f=Ya(d[2]);if("#"!==f[0])break;g=qa.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[Ya("79a417a0f0181a8946")]=d;if(qa.document[Ya("78a712aa")]){qa.document[Ya("78a712aa")][Ya("7bb806b6ed32388c4a875b")](g);h=qa.getComputedStyle(g).getPropertyValue(Ya("78a704b7e62456904c9b12701b6532a8"));qa.document[Ya("78a712aa")][Ya("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.af=!1;break}else if(Za||$a||bb||cb)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.af=!1;break}}}else a.af=null,a.af=!1}}else{k=c[Ya("76ad18b4f73e")];for(e=c[Ya("73a612b6fb191d")](Ya("35e7"))+2;e<k;e++)b+=c[e];c=b[Ya("73a612b6fb191d")](Ya("7da71ca0ad381e90"));a.af=!(0<=c&&c<b[Ya("73a612b6fb191d")](Ya("35")))}}}return 0<a.af&&a!==a.ez?!0:!1}
function Pi(a,b){if(gh){void 0!==b&&null!==b||v("Diagram setup requires an argument DIV.");null!==a.Ia&&v("Diagram has already completed setup.");"string"===typeof b?a.Ia=qa.document.getElementById(b):b instanceof HTMLDivElement?a.Ia=b:v("No DIV or DIV id supplied: "+b);null===a.Ia&&v("Invalid DIV id; could not get element with id: "+b);void 0!==a.Ia.B&&v("Invalid div id; div already has a Diagram associated with it.");if(!a.Ul&&qa.ResizeObserver){var c=sa(function(){a.Hb()},250);a.Ul=new qa.ResizeObserver(function(){c()});
a.Ul.observe(a.Ia)}"static"===qa.getComputedStyle(a.Ia,null).position&&(a.Ia.style.position="relative");a.Ia.style["-webkit-tap-highlight-color"]="rgba(255, 255, 255, 0)";a.Ia.style["-ms-touch-action"]="none";a.Ia.innerHTML="";a.Ia.B=a;a.Ia.goDiagram=a;a.Ia.go=qa.go;var d=a.jq?new Rj(a):new Rk(a);void 0!==d.style&&(d.style.position="absolute",d.style.top="0px",d.style.left="0px","rtl"===qa.getComputedStyle(a.Ia,null).getPropertyValue("direction")&&(a.Cl=!0),d.style.zIndex="2",d.style.userSelect="none",
d.style.webkitUserSelect="none",d.style.MozUserSelect="none");a.ya=d;a.Lb=d.context;b=a.Lb;a.Yb=a.computePixelRatio();a.Da=a.Ia.clientWidth||1;a.Ca=a.Ia.clientHeight||1;Tj(a,a.Da,a.Ca);a.Yr=b.aa[Ya("7eba17a4ca3b1a8346")][Ya("78a118b7")](b.aa,Yk,4,4);a.Ia.insertBefore(d.Ka,a.Ia.firstChild);d=new Rk(null);d.width=1;d.height=1;a.Ku=d;a.ux=d.context;if(gh){d=ua("div");var e=ua("div");d.style.position="absolute";d.style.overflow="auto";d.style.width=a.Da+"px";d.style.height=a.Ca+"px";d.style.zIndex="1";
e.style.position="absolute";e.style.width="1px";e.style.height="1px";a.Ia.appendChild(d);d.appendChild(e);d.onscroll=ej;d.addEventListener("mousedown",gj);d.addEventListener("touchstart",gj,{passive:!0});d.B=a;d.cz=!0;d.dz=!0;a.dt=d;a.Qp=e}a.gu=sa(function(){a.Ch=null;a.P()},300);a.Ww=sa(function(){Xh(a)},250);a.preventDefault=function(a){a.preventDefault();return!1};a.Ek=function(b){if(a.isEnabled){a.gg=!0;var c=uj(a,b,!0);a.doMouseMove();a.currentTool.isBeyondDragSize()&&(a.vd=0);Aj(a,c,b)}};a.Dk=
function(b){if(a.isEnabled)if(a.gg=!0,a.we)b.preventDefault();else{var c=uj(a,b,!0);c.down=!0;c.clickCount=b.detail;if($a||bb)b.timeStamp-a.Pj<a.tt&&!a.currentTool.isBeyondDragSize()?a.vd++:a.vd=1,a.Pj=b.timeStamp,c.clickCount=a.vd;c.clone(a.firstInput);a.doMouseDown();1===b.button?b.preventDefault():Aj(a,c,b)}};a.Gk=function(b){if(a.isEnabled)if(a.we&&2===b.button)b.preventDefault();else if(a.we&&0===b.button&&(a.we=!1),a.dk)b.preventDefault();else{a.gg=!0;var c=uj(a,b,!0);c.up=!0;c.clickCount=b.detail;
if($a||bb)c.clickCount=a.vd;c.bubbles=b.bubbles;c.targetDiagram=wj(b);a.doMouseUp();a.Of();Aj(a,c,b)}};a.Hk=function(b){if(a.isEnabled){var c=uj(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();Aj(a,c,b)}};a.Fk=function(b){a.isEnabled&&(a.gg=!1,uj(a,b,!0),b=a.currentTool,b.cancelWaitAfter(),b.standardMouseOver())};a.Qw=function(b){if(a.isEnabled){a.dk=!1;a.we=!0;var c=xj(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.Fo;b.timeStamp-a.Pj<a.tt&&!(25<Math.abs(f.x-
e)||25<Math.abs(f.y-d))?a.vd++:a.vd=1;c.clickCount=a.vd;a.Pj=b.timeStamp;a.Fo.h(e,d)}a.doMouseDown();Aj(a,c,b)}};a.Pw=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=zj(a,b,c,1<b.touches.length);a.doMouseMove();Aj(a,c,b)}};a.Ow=function(b){if(a.isEnabled)if(a.dk)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=yj(a,b,!1,!0,!1,!1);null!==d&&(c=qa.document.elementFromPoint(d.clientX,d.clientY),null!==c&&c.B instanceof Q&&c.B!==a&&vj(c.B,d,e),vj(a,d,e),e.clickCount=a.vd);null===c?e.targetDiagram=wj(b):c.B?e.targetDiagram=c.B:e.targetDiagram=null;e.targetObject=null;a.doMouseUp();Aj(a,e,b);a.we=!1}};a.Jm=function(b){if(a.isEnabled){a.gg=!0;var c=a.Ss;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.dk=!1,a.we=!0;c=xj(a,b,b,d);d=a.Fo;var e="touch"===b.pointerType||"pen"===b.pointerType?25:10;b.timeStamp-a.Pj<a.tt&&!(Math.abs(d.x-b.screenX)>e||Math.abs(d.y-b.screenY)>e)?a.vd++:a.vd=1;c.clickCount=a.vd;a.Pj=b.timeStamp;a.Fo.Ng(b.screenX,b.screenY);a.doMouseDown();1===b.button?b.preventDefault():Aj(a,c,b)}};a.Km=function(b){if(a.isEnabled){a.gg=!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=zj(a,b,b,null!==c[1]),c.targetDiagram=wj(b),a.doMouseMove(),Aj(a,c,b))}};a.Mm=function(b){if(a.isEnabled){a.gg=!0;var c="touch"===b.pointerType||"pen"===b.pointerType,d=a.Ss;if(c&&a.dk)delete d[b.pointerId],b.preventDefault();else if(d=a.Zj,null!==d[0]&&d[0].pointerId===b.pointerId){d[0]=null;d=yj(a,b,!1,
!0,!0,!1);var e=qa.document.elementFromPoint(b.clientX,b.clientY);null!==e&&e.B instanceof Q&&e.B!==a&&vj(e.B,b,d);vj(a,b,d);d.clickCount=a.vd;null===e?d.targetDiagram=wj(b):e.B?d.targetDiagram=e.B:d.targetDiagram=null;d.targetObject=null;a.doMouseUp();Aj(a,d,b);c&&(a.we=!1)}else null!==d[1]&&d[1].pointerId===b.pointerId&&(d[1]=null)}};a.Lm=function(b){if(a.isEnabled){a.gg=!1;var c=a.Ss;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.yc(!0);cj(a)}}Oi.className="DiagramHelper";function mf(a){this.l=void 0===a?new J:a;this.w=new J}ma.Object.defineProperties(mf.prototype,{point:{configurable:!0,get:function(){return this.l},set:function(a){this.l=a}},shifted:{configurable:!0,get:function(){return this.w},set:function(a){this.w=a}}});mf.className="DraggingInfo";
function ek(a,b,c){this.node=a;this.info=b;this.bw=c}ek.className="DraggingNodeInfoPair";function ef(){this.reset()}ef.prototype.reset=function(){this.isGridSnapEnabled=!1;this.isGridSnapRealtime=!0;this.gridSnapCellSize=(new Hb(NaN,NaN)).freeze();this.gridSnapCellSpot=Hc;this.gridSnapOrigin=(new J(NaN,NaN)).freeze();this.groupsSnapMembers=this.dragsTree=this.dragsLink=!1;this.dragsMembers=this.groupsAlwaysMove=!0};ef.className="DraggingOptions";
function Zk(a){1<arguments.length&&v("Palette constructor can only take one optional argument, the DIV HTML element or its id.");Q.call(this,a);$k(this)}la(Zk,Q);function $k(a){a.allowDragOut=!0;a.allowMove=!1;a.isReadOnly=!0;a.contentAlignment=Ic;a.layout=new al}Zk.prototype.reset=function(){Q.prototype.reset.call(this);$k(this)};Zk.className="Palette";
function bl(a){1<arguments.length&&v("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.Xb=!0;this.Na=null;this.sl=this.rl=!1;this.w=this.L=!0;this.ib=0;this.W=!1;this.bm=null;this.Ry("drawShadows",!1);var c=new S,d=new Yf;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 lc(0,0,0,0);this.sa.h(0,0);this.toolManager.cb("Dragging",new cl,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.ai=function(){b.Ta();dl(b)};this.Qf=function(){null!==b.observed&&(b.Ta(),b.P())};this.$h=function(){1>
b.updateDelay?b.P():b.W||(b.W=!0,setTimeout(function(){b.W=!1;el(b);b.P()},b.updateDelay))};this.Rc=function(){null!==b.observed&&dl(b)};this.autoScale=pj;this.Xb=!1}la(bl,Q);bl.prototype.computePixelRatio=function(){return 1};
bl.prototype.hc=function(){null===this.Ia&&v("No div specified");null===this.ya&&v("No canvas specified");if(!(this.ya instanceof Rj)&&(xi(this.box),this.Hc)){var a=this.observed;if(null!==a&&!a.animationManager.isAnimating){Kj(this);var b=this.ya;a=this.Lb;a.yc(!0);a.setTransform(1,0,0,1,0,0);a.clearRect(0,0,b.width,b.height);1>this.updateDelay?fl(this):null!==this.bm&&(a.drawImage(this.bm.Ka,0,0),b=this.sb,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.Yb,this.Yb),a.transform(b.m11,b.m12,b.m21,b.m22,b.dx,b.dy));b=this.Pa.j;for(var c=b.length,d=0;d<c;d++)b[d].hc(a,this);this.Hc=this.Ai=!1}}};function el(a){var b=a.ya,c=a.Lb;if(null!==b&&null!==c){Kj(a);if(null===a.bm){var d=new Rk(null);d.width=b.width;d.height=b.height;a.bm=d}try{a.ya=a.bm,a.Lb=a.ya.context,a.Lb.yc(!0),a.Lb.setTransform(1,0,0,1,0,0),a.Lb.clearRect(0,0,a.ya.width,a.ya.height),fl(a)}finally{a.ya=b,a.Lb=c}}}
function fl(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=L.alloc().assign(a.viewportBounds).Pc(b.viewportBounds),Dj(b,e),L.free(e),ij(b));var f=a.sb;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.Lb;e.scale(a.Yb,a.Yb);e.transform(f.m11,f.m12,f.m21,f.m22,f.dx,f.dy);b=b.Pa.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=zi(h,e),l.hc(e,k),e.globalAlpha=h);else{for(var m=zi(h,e),n=k.scale,p=L.alloc(),r=h.Ha.j,q=r.length,u=0;u<q;u++){var w=r[u];(d||w!==l)&&h.dj(e,w,k,null,n,p)}L.free(p);e.globalAlpha=m}}}}}
function dl(a){var b=a.box;if(null!==b){var c=a.observed;if(null!==c){a.Hc=!0;c=c.viewportBounds;var d=b.selectionObject,e=Hb.alloc();e.h(c.width,c.height);d.desiredSize=e;Hb.free(e);a=2/a.scale;d instanceof Yf&&(d.strokeWidth=a);b.location=new J(c.x-a/2,c.y-a/2);b.isSelected=!0}}}bl.prototype.computeBounds=function(){var a=this.observed;if(null===a)return vc;var b=a.documentBounds.copy();b.Pc(a.viewportBounds);return b};bl.prototype.Cy=function(){!0!==this.Hc&&(this.Hc=!0,this.Hb())};
bl.prototype.Zq=function(a,b,c,d){this.Xb||(hj(this),this.P(),nj(this),this.Ta(),dl(this),this.ae.scale=c,this.ae.position.x=a.x,this.ae.position.y=a.y,this.ae.bounds.assign(a),this.ae.iw=d,this.U("ViewportBoundsChanged",this.ae,a))};
ma.Object.defineProperties(bl.prototype,{observed:{configurable:!0,get:function(){return this.Na},set:function(a){var b=this.Na;null!==a&&x(a,Q,bl,"observed");a instanceof bl&&v("Overview.observed Diagram may not be an Overview itself: "+a);if(b!==a){null!==b&&(this.remove(this.box),b.Pm("ViewportBoundsChanged",this.ai),b.Pm("DocumentBoundsChanged",this.Qf),b.Pm("InvalidateDraw",this.$h),b.Pm("AnimationFinished",this.Rc));this.Na=a;null!==a&&(a.ik("ViewportBoundsChanged",this.ai),a.ik("DocumentBoundsChanged",
this.Qf),a.ik("InvalidateDraw",this.$h),a.ik("AnimationFinished",this.Rc),this.add(this.box),dl(this));this.Ta();if(null===a){this.bm=null;var c=this.ya,d=this.Lb;c&&d&&(d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,c.width,c.height))}else el(this),dl(this),this.P();this.g("observed",b,a)}}},box:{configurable:!0,get:function(){return this.l},set:function(a){var b=this.l;b!==a&&(this.l=a,this.remove(b),this.add(this.l),dl(this),this.g("box",b,a))}},drawsTemporaryLayers:{configurable:!0,
enumerable:!0,get:function(){return this.L},set:function(a){this.L!==a&&(this.L=a,this.ge())}},drawsGrid:{configurable:!0,get:function(){return this.w},set:function(a){this.w!==a&&(this.w=a,this.ge())}},updateDelay:{configurable:!0,get:function(){return this.ib},set:function(a){0>a&&(a=0);this.ib!==a&&(this.ib=a)}}});bl.className="Overview";function cl(){df.call(this);this.l=null}la(cl,df);
cl.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};
cl.prototype.doActivate=function(){this.l=null;df.prototype.doActivate.call(this)};cl.prototype.doUpdateCursor=function(){var a=this.diagram,b=a.box;null!==b&&b.cursor&&(a.currentCursor=b.cursor)};cl.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)}}};cl.className="OverviewDraggingTool";
function gl(){0<arguments.length&&za(gl);fb(this);this.B=Pe;this.ib=this.L=this.w=!0;this.W=this.Na=this.qd=this.Oa=!1;this.Li=this.l=null;this.Rc=1.05;this.cv=NaN;this.zx=null;this.Cv=NaN;this.Bv=vc;this.yg=null;this.Qc=200}gl.prototype.toString=function(){return"CommandHandler"};gl.prototype.he=function(a){this.B=a};
gl.prototype.doKeyDown=function(){var a=this.diagram,b=a.lastInput,c=db?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()};
gl.prototype.doKeyUp=function(){this.diagram.lastInput.bubbles=!0};gl.prototype.stopCommand=function(){var a=this.diagram,b=a.currentTool;b instanceof Ua&&a.allowSelect&&a.clearSelection();null!==b&&b.doCancel()};gl.prototype.canStopCommand=function(){return!0};
gl.prototype.selectAll=function(){var a=this.diagram;a.P();try{a.currentCursor="wait";a.U("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.U("ChangedSelection",a.selection),a.currentCursor=""}};gl.prototype.canSelectAll=function(){return this.diagram.allowSelect};
gl.prototype.deleteSelection=function(){var a=this.diagram;try{a.currentCursor="wait";a.U("ChangingSelection",a.selection);a.Ba("Delete");a.U("SelectionDeleting",a.selection);for(var b=new I,c=a.selection.iterator;c.next();)hl(b,c.value,!0,this.deletesTree?Infinity:0,this.deletesConnectedLinks?null:!1,function(a){return a.canDelete()});a.iu(b,!0);a.U("SelectionDeleted",b)}finally{a.ab("Delete"),a.U("ChangedSelection",a.selection),a.currentCursor=""}};
gl.prototype.canDeleteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowDelete||0===a.selection.count?!1:!0};gl.prototype.copySelection=function(){var a=this.diagram,b=new I;for(a=a.selection.iterator;a.next();)hl(b,a.value,!0,this.copiesTree?Infinity:0,this.copiesConnectedLinks,function(a){return a.canCopy()});this.copyToClipboard(b)};gl.prototype.canCopySelection=function(){var a=this.diagram;return a.allowCopy&&a.allowClipboard&&0!==a.selection.count?!0:!1};
gl.prototype.cutSelection=function(){this.copySelection();this.deleteSelection()};gl.prototype.canCutSelection=function(){var a=this.diagram;return!a.isReadOnly&&!a.isModelReadOnly&&a.allowCopy&&a.allowDelete&&a.allowClipboard&&0!==a.selection.count?!0:!1};
gl.prototype.copyToClipboard=function(a){var b=this.diagram,c=null;if(null===a)Qi=null,Ri="";else{c=b.model;var d=!1,e=!1,f=null;try{c.Gm()&&(d=c.qk,c.qk=this.copiesParentKey),c.yk()&&(e=c.pk,c.pk=this.copiesGroupKey),f=b.rk(a,null,!0)}finally{c.Gm()&&(c.qk=d),c.yk()&&(c.pk=e),c=new H,c.addAll(f),Qi=c,Ri=b.model.dataFormat}}b.U("ClipboardChanged",c)};
gl.prototype.pasteFromClipboard=function(){var a=new I,b=Qi;if(null===b)return a;var c=this.diagram;if(Ri!==c.model.dataFormat)return a;var d=c.model,e=!1,f=!1,g=null;try{d.Gm()&&(e=d.qk,d.qk=this.copiesParentKey),d.yk()&&(f=d.pk,d.pk=this.copiesGroupKey),g=c.rk(b,c,!1)}finally{for(d.Gm()&&(d.qk=e),d.yk()&&(d.pk=f),b=g.iterator;b.next();)c=b.value,d=b.key,c.location.o()||(d.location.o()?c.location=d.location:!c.position.o()&&d.position.o()&&(c.position=d.position)),a.add(c)}return a};
gl.prototype.pasteSelection=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.currentCursor="wait";b.U("ChangingSelection",b.selection);b.Ba("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.o()){var f=this.computeEffectiveCollection(b.selection,b.el);Ef(b,f,new J(a.x-e.centerX,a.y-e.centerY),b.el,!1)}}b.U("ClipboardPasted",c)}finally{b.ab("Paste"),b.U("ChangedSelection",
b.selection),b.currentCursor=""}};gl.prototype.canPasteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowClipboard||null===Qi||0===Qi.count||Ri!==a.model.dataFormat?!1:!0};gl.prototype.undo=function(){this.diagram.undoManager.undo()};gl.prototype.canUndo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canUndo()};gl.prototype.redo=function(){this.diagram.undoManager.redo()};
gl.prototype.canRedo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canRedo()};gl.prototype.decreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);C(a,gl,"decreaseZoom:factor");var b=this.diagram;b.autoScale===Wh&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};
gl.prototype.canDecreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);C(a,gl,"canDecreaseZoom:factor");var b=this.diagram;if(b.autoScale!==Wh)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};gl.prototype.increaseZoom=function(a){void 0===a&&(a=this.zoomFactor);C(a,gl,"increaseZoom:factor");var b=this.diagram;b.autoScale===Wh&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};
gl.prototype.canIncreaseZoom=function(a){void 0===a&&(a=this.zoomFactor);C(a,gl,"canIncreaseZoom:factor");var b=this.diagram;if(b.autoScale!==Wh)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};gl.prototype.resetZoom=function(a){void 0===a&&(a=this.defaultScale);C(a,gl,"resetZoom:newscale");var b=this.diagram;a<b.minScale||a>b.maxScale||(b.scale=a)};
gl.prototype.canResetZoom=function(a){void 0===a&&(a=this.defaultScale);C(a,gl,"canResetZoom:newscale");var b=this.diagram;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};
gl.prototype.zoomToFit=function(){var a=this.diagram,b=a.animationManager;b.dd();a.ge();var c=a.position,d=a.scale;Eh(b,"Zoom To Fit");d===this.Cv&&!isNaN(this.cv)&&a.documentBounds.A(this.Bv)?(a.scale=this.cv,a.position=this.zx,this.Cv=NaN,this.Bv=vc):(this.cv=d,this.zx=c.copy(),a.zoomToFit(),this.Cv=a.scale,this.Bv=a.documentBounds.copy());Gh(b)};gl.prototype.canZoomToFit=function(){return this.diagram.allowZoom};
gl.prototype.scrollToPart=function(a){void 0===a&&(a=null);null!==a&&x(a,S,gl,"part");var b=this.diagram;Zi(b);if(null===a){try{null!==this.yg&&(this.yg.next()?a=this.yg.value:this.yg=null)}catch(k){this.yg=null}null===a&&(0<b.highlighteds.count?this.yg=b.highlighteds.iterator:0<b.selection.count&&(this.yg=b.selection.iterator),null!==this.yg&&this.yg.next()&&(a=this.yg.value))}if(null!==a){var c=b.animationManager;Eh(c,"Scroll To Part");var d=this.scrollToPartPause;if(0<d){var e=il(this,a,[a]);if(1===
e.length)b.Ba(),b.Ct(a.actualBounds),b.ab("Scroll To Part");else{var f=function(){b.Ba();for(var a=e.pop();0<e.length&&a instanceof T&&a.isTreeExpanded&&(!(a instanceof Hf)||a.isSubGraphExpanded);)a=e.pop();0<e.length?(a instanceof S&&b.Cw(a.actualBounds),a instanceof T&&!a.isTreeExpanded&&(a.isTreeExpanded=!0),a instanceof Hf&&!a.isSubGraphExpanded&&(a.isSubGraphExpanded=!0)):(a instanceof S&&b.Ct(a.actualBounds),b.Pm("LayoutCompleted",g));b.ab("Scroll To Part")},g=function(){ta(f,(c.isEnabled?c.duration:
0)+d)};b.ik("LayoutCompleted",g);f()}}else{var h=b.position.copy();b.Ct(a.actualBounds);h.Sa(b.position)&&c.dd()}}};
function il(a,b,c){if(b.isVisible())return c;if(b instanceof Te)il(a,b.adornedPart,c);else if(b instanceof R){var d=b.fromNode;null!==d&&il(a,d,c);b=b.toNode;null!==b&&il(a,b,c)}else b instanceof T&&(d=b.labeledLink,null!==d&&il(a,d,c),d=b.Kg(),null!==d&&(d.isTreeExpanded||d.wasTreeExpanded||c.push(d),il(a,d,c))),b=b.containingGroup,null!==b&&(b.isSubGraphExpanded||b.wasSubGraphExpanded||c.push(b),il(a,b,c));return c}
gl.prototype.canScrollToPart=function(a){void 0===a&&(a=null);if(null!==a&&!(a instanceof S))return!1;a=this.diagram;return 0===a.selection.count&&0===a.highlighteds.count?!1:a.allowHorizontalScroll&&a.allowVerticalScroll};
gl.prototype.collapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Ba("Collapse Tree");Eh(b.animationManager,"Collapse Tree");var c=new H;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 T&&e.isTreeExpanded&&(e.collapseTree(),c.add(e))}b.U("TreeCollapsed",c)}finally{b.ab("Collapse Tree")}};
gl.prototype.canCollapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a){if(!(a instanceof T&&a.isTreeExpanded))return!1;if(0<a.Iq().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof T&&b.isTreeExpanded&&0<b.Iq().count)return!0;return!1};
gl.prototype.expandTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Ba("Expand Tree");Eh(b.animationManager,"Expand Tree");var c=new H;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 T&&!e.isTreeExpanded&&(e.expandTree(),c.add(e))}b.U("TreeExpanded",c)}finally{b.ab("Expand Tree")}};
gl.prototype.canExpandTree=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a){if(!(a instanceof T)||a.isTreeExpanded)return!1;if(0<a.Iq().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof T&&!b.isTreeExpanded&&0<b.Iq().count)return!0;return!1};
gl.prototype.groupSelection=function(){var a=this.diagram,b=a.model;if(b.oj()){var c=this.archetypeGroupData;if(null!==c){var d=null;try{a.currentCursor="wait";a.U("ChangingSelection",a.selection);a.Ba("Group");for(var e=new H,f=a.selection.iterator;f.next();){var g=f.value;g.bc()&&g.canGroup()&&e.add(g)}for(var h=new H,k=e.iterator;k.next();){var l=k.value;f=!1;for(var m=e.iterator;m.next();)if(l.Ed(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.Ed(n)){e=!0;break}if(e)n=n.containingGroup;else break}if(c instanceof Hf)Lg(c),d=c.copy(),null!==d&&a.add(d);else if(b.Ut(c)){var r=b.copyNodeData(c);Fa(r)&&(b.Bf(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.U("SelectionGrouped",d)}finally{a.ab("Group"),a.U("ChangedSelection",
a.selection),a.currentCursor=""}}}};gl.prototype.canGroupSelection=function(){var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowGroup||!a.model.oj()||null===this.archetypeGroupData)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.bc()&&b.canGroup())return!0}return!1};
function jl(a){var b=La();for(a=a.iterator;a.next();){var c=a.value;c instanceof R||b.push(c)}a=new I;c=b.length;for(var d=0;d<c;d++){for(var e=b[d],f=!0,g=0;g<c;g++)if(e.Ed(b[g])){f=!1;break}f&&a.add(e)}Oa(b);return a}
gl.prototype.isValidMember=function(a,b){if(null===b||a===b||b instanceof R)return!1;if(null!==a){if(a===b||a.Ed(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};
gl.prototype.ungroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.model;if(c.oj())try{b.currentCursor="wait";b.U("ChangingSelection",b.selection);b.Ba("Ungroup");var d=new H;if(null!==a)d.add(a);else for(var e=b.selection.iterator;e.next();){var f=e.value;f instanceof Hf&&f.canUngroup()&&d.add(f)}var g=new H;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.pa(l.data):void 0;g.addAll(k.memberParts);
for(var n=g.iterator;n.next();){var p=n.value;p.isSelected=!0;if(!(p instanceof R)){var r=p.data;null!==r?c.hr(r,m):p.containingGroup=l}}b.remove(k)}}b.U("SelectionUngrouped",d,g)}finally{b.ab("Ungroup"),b.U("ChangedSelection",b.selection),b.currentCursor=""}};
gl.prototype.canUngroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly||b.isModelReadOnly||!b.allowDelete||!b.allowUngroup||!b.model.oj())return!1;if(null!==a){if(!(a instanceof Hf))return!1;if(a.canUngroup())return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof Hf&&b.canUngroup())return!0;return!1};
gl.prototype.addTopLevelParts=function(a,b){var c=!0;for(a=jl(a).iterator;a.next();){var d=a.value;null!==d.containingGroup&&(!b||this.isValidMember(null,d)?d.containingGroup=null:c=!1)}return c};
gl.prototype.collapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Ba("Collapse SubGraph");Eh(b.animationManager,"Collapse SubGraph");var c=new H;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 Hf&&e.isSubGraphExpanded&&(e.collapseSubGraph(),c.add(e))}b.U("SubGraphCollapsed",c)}finally{b.ab("Collapse SubGraph")}};
gl.prototype.canCollapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof Hf&&a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof Hf&&b.isSubGraphExpanded)return!0;return!1};
gl.prototype.expandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Ba("Expand SubGraph");Eh(b.animationManager,"Expand SubGraph");var c=new H;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 Hf&&!e.isSubGraphExpanded&&(e.expandSubGraph(),c.add(e))}b.U("SubGraphExpanded",c)}finally{b.ab("Expand SubGraph")}};
gl.prototype.canExpandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof Hf&&!a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof Hf&&!b.isSubGraphExpanded)return!0;return!1};
gl.prototype.editTextBlock=function(a){void 0===a&&(a=null);null!==a&&x(a,ih,gl,"editTextBlock");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.ym(function(a){return a instanceof ih&&a.editable})}null!==a&&(b.currentTool=null,c.textBlock=a,b.currentTool=c)}};
gl.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 ih))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.ym(function(a){return a instanceof ih&&a.editable}),null!==a))return!0;return!1};
gl.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 N?e=a.ma(Mc):b.viewportBounds.fa(d.documentPoint)||(e=b.viewportBounds,e=new J(e.x+e.width/2,e.y+e.height/2));null!==e&&(d.viewPoint=b.lr(e),d.documentPoint=e,d.left=!1,d.right=!0,d.up=!0);b.currentTool=c;eh(c,!1,a)}};
gl.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};
gl.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.el);d=new Db;if(null===a)return d;for(var f=a.iterator;f.next();)ck(c,d,f.value,e,b);if(null!==c.draggedLink&&b.dragsLink)return d;for(f=a.iterator;f.next();)a=f.value,a instanceof R&&(b=a.fromNode,null===b||d.contains(b)?(b=a.toNode,null===b||d.contains(b)||d.remove(a)):d.remove(a));return d};
ma.Object.defineProperties(gl.prototype,{diagram:{configurable:!0,get:function(){return this.B}},copiesClipboardData:{configurable:!0,get:function(){return this.w},set:function(a){A(a,"boolean",gl,"copiesClipboardData");this.w=a}},copiesConnectedLinks:{configurable:!0,get:function(){return this.L},set:function(a){A(a,"boolean",gl,"copiesConnectedLinks");this.L=a}},deletesConnectedLinks:{configurable:!0,get:function(){return this.ib},set:function(a){A(a,
"boolean",gl,"deletesConnectedLinks");this.ib=a}},copiesTree:{configurable:!0,get:function(){return this.Oa},set:function(a){A(a,"boolean",gl,"copiesTree");this.Oa=a}},deletesTree:{configurable:!0,get:function(){return this.qd},set:function(a){A(a,"boolean",gl,"deletesTree");this.qd=a}},copiesParentKey:{configurable:!0,get:function(){return this.Na},set:function(a){A(a,"boolean",gl,"copiesParentKey");this.Na=a}},copiesGroupKey:{configurable:!0,
get:function(){return this.W},set:function(a){A(a,"boolean",gl,"copiesGroupKey");this.W=a}},archetypeGroupData:{configurable:!0,get:function(){return this.l},set:function(a){null!==a&&A(a,"object",gl,"archetypeGroupData");var b=this.diagram;F&&(b=b.model,!b.oj()||a instanceof Hf||b.Ut(a)||v("CommandHandler.archetypeGroupData must be either a Group or a data object for which GraphLinksModel.isGroupForNodeData is true: "+a));this.l=a}},memberValidation:{configurable:!0,get:function(){return this.Li},
set:function(a){null!==a&&A(a,"function",gl,"memberValidation");this.Li=a}},defaultScale:{configurable:!0,get:function(){return this.diagram.defaultScale},set:function(a){this.diagram.defaultScale=a}},zoomFactor:{configurable:!0,get:function(){return this.Rc},set:function(a){C(a,gl,"zoomFactor");1<a||v("zoomFactor must be larger than 1.0, not: "+a);this.Rc=a}},scrollToPartPause:{configurable:!0,get:function(){return this.Qc},set:function(a){C(a,gl,"scrollToPartPause");
this.Qc=a}}});gl.className="CommandHandler";Ki=function(){return new gl};
function N(){fb(this);this.I=4225027;this.wb=1;this.wg=null;this.Wa="";this.jc=this.ob=null;this.sa=(new J(NaN,NaN)).freeze();this.Uc=cc;this.ng=Wb;this.mg=bc;this.sb=new Ib;this.ci=new Ib;this.kg=new Ib;this.Fa=this.kl=1;this.dc=0;this.Ke=kl;this.oh=Ec;this.tc=(new L(NaN,NaN,NaN,NaN)).freeze();this.Bb=(new L(NaN,NaN,NaN,NaN)).freeze();this.uc=(new L(0,0,NaN,NaN)).freeze();this.S=this.yp=this.zp=null;this.Uk=this.Cb=ld;this.Kp=0;this.Lp=1;this.Xg=0;this.An=1;this.eq=null;this.Rp=-Infinity;this.Xl=
0;this.Yl=Rb;this.Zl=og;this.ti="";this.jb=this.R=null;this.Yk=-1;this.am=this.sd=this.si=this.em=null;this.Vs=Mg;this.Np=this.Sg=this.Yj=null}var Hd,Mg,Og,kl,ll,ml,nl,ol,pl,ql;
N.prototype.cloneProtected=function(a){a.I=this.I|6144;a.wb=this.wb;a.Wa=this.Wa;a.ob=this.ob;a.jc=this.jc;a.Sg=this.Sg;a.sa.assign(this.sa);a.Uc=this.Uc.J();a.ng=this.ng.J();a.mg=this.mg.J();a.kg=this.kg.copy();a.Fa=this.Fa;a.dc=this.dc;a.Ke=this.Ke;a.oh=this.oh.J();a.tc.assign(this.tc);a.Bb.assign(this.Bb);a.uc.assign(this.uc);a.yp=this.yp;null!==this.S&&(a.S=this.S.copy());a.Cb=this.Cb.J();a.Uk=this.Uk.J();a.Kp=this.Kp;a.Lp=this.Lp;a.Xg=this.Xg;a.An=this.An;a.eq=this.eq;a.Rp=this.Rp;a.Xl=this.Xl;
a.Yl=this.Yl.J();a.Zl=this.Zl;a.ti=this.ti;null!==this.R&&(a.R=this.R.copy());a.jb=this.jb;a.Yk=this.Yk;null!==this.si&&(a.si=Ia(this.si));null!==this.sd&&(a.sd=this.sd.copy());a.am=this.am};N.prototype.Ux=function(a){var b=this.si;if(Ga(b))for(var c=0;c<b.length;c++){if(b[c]===a)return}else this.si=b=[];b.push(a)};N.prototype.Ef=function(a){a.zp=null;a.Yj=null;a.u()};
N.prototype.clone=function(){var a=new this.constructor;this.cloneProtected(a);if(null!==this.si)for(var b=0;b<this.si.length;b++){var c=this.si[b];a[c]=this[c]}return a};N.prototype.copy=function(){return this.clone()};t=N.prototype;t.mb=function(a){a.classType===R?0===a.name.indexOf("Orient")?this.segmentOrientation=a:v("Unknown Link enum value for GraphObject.segmentOrientation property: "+a):a.classType===N?this.stretch=a:Ba(this,a)};t.toString=function(){return Pa(this.constructor)+"#"+sb(this)};
function rl(a){null===a.R&&(a.R=new sl)}t.Mc=function(){if(null===this.S){var a=new tl;a.hh=Gc;a.Gh=Gc;a.fh=10;a.Eh=10;a.gh=0;a.Fh=0;this.S=a}};
t.gb=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===He&&ul(this)&&vl(this,h,b),f=this.diagram,null===this.Sg||null===f||!f.zk||f.undoManager.isUndoingRedoing||f.currentTool!==f.toolManager||f.animationManager.vn||(a=this.Sg.get(b),null!==a&&f.animationManager.isEnabled&&!f.animationManager.isTicking&&(null===this.Np&&(this.Np=new Db),g=0===f.undoManager.transactionLevel,a.startCondition===ti?g=!0:a.startCondition===vi&&(g=!1),g?(f=new Dh,ui(a,f),g=this.Np.get(a),
null!==g&&g.stop(),this.Np.add(a,f),f.yv=this,f.Px=a,f.add(this,b,d,e),f.start()):(Fh(f.animationManager,"Trigger"),f.animationManager.defaultAnimation.add(this,b,d,e)))),this instanceof U&&c===h&&0!==(h.I&16777216)&&null!==h.data))for(c=this.$.j,d=c.length,e=0;e<d;e++)h=c[e],h instanceof U&&Uj(h,function(a){null!==a.data&&0!==(a.I&16777216)&&a.Ga(b)})};
function vl(a,b,c){var d=a.ij();if(null!==d)for(var e=a.jb.iterator;e.next();){var f=e.value,g=null;if(null!==f.sourceName){g=wl(f,d,a);if(null===g)continue;f.pr(a,g,c,null)}else if(f.isToModel){var h=b.diagram;null===h||h.skipsModelSourceBindings||f.pr(a,h.model.modelData,c,d)}else{h=d.data;if(null===h)continue;var k=b.diagram;null===k||k.skipsModelSourceBindings||f.pr(a,h,c,d)}g===a&&(h=d.It(f.vj),null!==h&&f.Uw(h,g,c))}}t.It=function(a){return this.Yk===a?this:null};
t.g=function(a,b,c){this.gb(He,a,this,b,c)};function xl(a,b,c,d,e){var f=a.tc,g=a.kg;g.reset();yl(a,g,b,c,d,e);a.kg=g;f.h(b,c,d,e);g.Vt()||g.Rw(f)}function zl(a,b,c,d){if(!1===a.pickable)return!1;d.multiply(a.transform);return c?a.Oc(b,d):a.Oh(b,d)}
t.py=function(a,b,c){if(!1===this.pickable)return!1;var d=this.naturalBounds;b=a.Qe(b);return c?Kb(a.x,a.y,0,0,0,d.height)<=b||Kb(a.x,a.y,0,d.height,d.width,d.height)<=b||Kb(a.x,a.y,d.width,d.height,d.width,0)<=b||Kb(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.ke=function(){return!0};
t.fa=function(a){F&&x(a,J,N,"containsPoint:p");var b=J.alloc();b.assign(a);this.transform.xa(b);var c=this.actualBounds;if(!c.o())return J.free(b),!1;var d=this.diagram;if(null!==d&&d.we){var e=d.Dm("extraTouchThreshold"),f=d.Dm("extraTouchArea"),g=f/2,h=this.naturalBounds;d=this.Gf()*d.scale;var k=1/d;if(h.width*d<e&&h.height*d<e)return a=rc(c.x-g*k,c.y-g*k,c.width+f*k,c.height+f*k,b.x,b.y),J.free(b),a}e=!1;if(this instanceof Te||this instanceof Yf?rc(c.x-5,c.y-5,c.width+10,c.height+10,b.x,b.y):
c.fa(b))this.sd&&!this.sd.fa(b)?e=!1:null!==this.jc&&c.fa(b)?e=!0:null!==this.ob&&this.uc.fa(a)?e=!0:e=this.Ph(a);J.free(b);return e};t.Ph=function(a){var b=this.naturalBounds;return rc(0,0,b.width,b.height,a.x,a.y)};
t.Pe=function(a){F&&x(a,L,N,"containsRect:r");if(0===this.angle)return this.actualBounds.Pe(a);var b=this.naturalBounds;b=L.allocAt(0,0,b.width,b.height);var c=this.transform,d=!1,e=J.allocAt(a.x,a.y);b.fa(c.ee(e))&&(e.h(a.x,a.bottom),b.fa(c.ee(e))&&(e.h(a.right,a.bottom),b.fa(c.ee(e))&&(e.h(a.right,a.y),b.fa(c.ee(e))&&(d=!0))));J.free(e);L.free(b);return d};
t.Oh=function(a,b){F&&x(a,L,N,"containedInRect:r");if(void 0===b)return a.Pe(this.actualBounds);var c=this.naturalBounds,d=!1,e=J.allocAt(0,0);a.fa(b.xa(e))&&(e.h(0,c.height),a.fa(b.xa(e))&&(e.h(c.width,c.height),a.fa(b.xa(e))&&(e.h(c.width,0),a.fa(b.xa(e))&&(d=!0))));J.free(e);return d};
t.Oc=function(a,b){F&&x(a,L,N,"intersectsRect:r");if(void 0===b&&(b=this.transform,0===this.angle))return a.Oc(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.fa(b.xa(d))||a.fa(b.xa(e))||a.fa(b.xa(f))||a.fa(b.xa(g)))h=!0;else{c=L.allocAt(0,0,c.width,c.height);var k=J.allocAt(a.x,a.y);c.fa(b.ee(k))?h=!0:(k.h(a.x,a.bottom),c.fa(b.ee(k))?h=!0:(k.h(a.right,a.bottom),c.fa(b.ee(k))?h=!0:(k.h(a.right,a.y),
c.fa(b.ee(k))&&(h=!0))));J.free(k);L.free(c);!h&&(K.Rt(a,d,e)||K.Rt(a,e,f)||K.Rt(a,f,g)||K.Rt(a,g,d))&&(h=!0)}J.free(d);J.free(e);J.free(f);J.free(g);return h};t.ma=function(a,b){void 0===b&&(b=new J);if(a instanceof M){F&&a.Tb()&&v("getDocumentPoint:s Spot must be specific: "+a.toString());var c=this.naturalBounds;b.h(a.x*c.width+a.offsetX,a.y*c.height+a.offsetY)}else b.set(a);this.Cd.xa(b);return b};
t.Cm=function(a){void 0===a&&(a=new L);var b=this.naturalBounds,c=this.Cd,d=J.allocAt(0,0).transform(c);a.h(d.x,d.y,0,0);d.h(b.width,0).transform(c);qc(a,d.x,d.y,0,0);d.h(b.width,b.height).transform(c);qc(a,d.x,d.y,0,0);d.h(0,b.height).transform(c);qc(a,d.x,d.y,0,0);J.free(d);return a};t.lj=function(){var a=this.Cd;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.Gf=function(){if(0!==(this.I&4096)===!1)return this.kl;var a=this.Fa;return null!==this.panel?a*this.panel.Gf():a};t.Ot=function(a,b){void 0===b&&(b=new J);b.assign(a);this.Cd.ee(b);return b};t.bd=function(a,b,c){return this.wk(a.x,a.y,b.x,b.y,c)};
t.wk=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};
N.prototype.measure=function(a,b,c,d){if(!1!==Hj(this)){var e=this.oh,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 Yf&&(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 U;switch(Al(this,!0)){case Mg:g=e=0;h&&(b=a=Infinity);
break;case Hd:isFinite(a)&&a>c&&(e=a);isFinite(b)&&b>d&&(g=b);break;case ll:isFinite(a)&&a>c&&(e=a);g=0;h&&(b=Infinity);break;case ml:isFinite(b)&&b>d&&(g=b),e=0,h&&(a=Infinity)}h=this.maxSize;var k=this.minSize;e>h.width&&k.width<h.width&&(e=h.width);g>h.height&&k.height<h.height&&(g=h.height);c=Math.max(e/this.scale,k.width);d=Math.max(g/this.scale,k.height);h.width<c&&(c=Math.min(k.width,c));h.height<d&&(d=Math.min(k.height,d));a=Math.min(h.width,a);b=Math.min(h.height,b);a=Math.max(c,a);b=Math.max(d,
b);if(90===f||270===f)f=a,a=b,b=f,f=c,c=d,d=f;this.tc.ka();this.Im(a,b,c,d);this.tc.freeze();this.tc.o()||v("Non-real measuredBounds has been set. Object "+this+", measuredBounds: "+this.tc.toString());Cj(this,!1)}};N.prototype.Im=function(){};N.prototype.Kf=function(){return!1};
N.prototype.arrange=function(a,b,c,d,e){this.Bl();var f=L.alloc();f.assign(this.Bb);this.Bb.ka();!1===Ij(this)?this.Bb.h(a,b,c,d):this.Nh(a,b,c,d);this.Bb.freeze();void 0===e?this.sd=null:this.sd=e;c=!1;if(void 0!==e)c=!0;else if(e=this.panel,null===e||e.type!==U.TableRow&&e.type!==U.TableColumn||(e=e.panel),null!==e&&(e=e.uc,d=this.measuredBounds,null!==this.areaBackground&&(d=this.Bb),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 ih&&(a=this.naturalBounds,
this.As>a.height||this.vb>a.width)))c=!0;this.I=c?this.I|256:this.I&-257;this.Bb.o()||v("Non-real actualBounds has been set. Object "+this+", actualBounds: "+this.Bb.toString());this.du(f,this.Bb);Bl(this,!1);L.free(f)};t=N.prototype;t.Nh=function(){};
function Cl(a,b,c,d,e){a.Bb.h(b,c,d,e);if(!a.desiredSize.o()){var f=a.tc;c=a.oh;b=c.right+c.left;var g=c.top+c.bottom;c=f.width+b;f=f.height+g;d+=b;e+=g;b=Al(a,!0);c===d&&f===e&&(b=Mg);switch(b){case Mg:if(c>d||f>e)Cj(a,!0),a.measure(c>d?d:c,f>e?e:f,0,0);break;case Hd:Cj(a,!0);a.measure(d,e,0,0);break;case ll:Cj(a,!0);a.measure(d,f,0,0);break;case ml:Cj(a,!0),a.measure(c,e,0,0)}}}
t.du=function(a,b){var c=this.part;null!==c&&null!==c.diagram&&(c.selectionObject!==this&&c.resizeObject!==this&&c.rotateObject!==this||Dl(c,!0),this.P(),jc(a,b)||(c.Th(),this.np(c)))};t.np=function(a){null!==this.portId&&(Dl(a,!0),a instanceof T&&El(a,this))};
t.hc=function(a,b){if(this.visible){var c=this instanceof U&&(this.type===U.TableRow||this.type===U.TableColumn),d=this.Bb;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.jy(a,b))if(c)Fl(this,a,b);else{this instanceof R&&this.Ck(!1);F&&F.sm&&F.Kz&&F.Kz(a,this);c=this.transform;var g=this.panel;0!==(this.I&4096)===!0&&Gl(this);var h=this.part,k=!1,l=0;if(h&&b.Re("drawShadows")&&(k=h.isShadowed)){var m=
h.shadowOffset;l=Math.max(m.y,m.x)*b.scale*b.Yb}if(!(m=b.Bi||!this.Kf())){var n=this.naturalBounds;m=this.ci;var p=m.m11,r=m.m21,q=m.dx,u=m.m12,w=m.m22,y=m.dy,z,B=z=0;m=z*p+B*r+q;var D=z*u+B*w+y;z=n.width+l;B=0;var G=z*p+B*r+q;z=z*u+B*w+y;B=Math.min(m,G);var O=Math.min(D,z);var V=Math.max(m+0,G)-B;var P=Math.max(D+0,z)-O;m=B;D=O;z=n.width+l;B=n.height+l;G=z*p+B*r+q;z=z*u+B*w+y;B=Math.min(m,G);O=Math.min(D,z);V=Math.max(m+V,G)-B;P=Math.max(D+P,z)-O;m=B;D=O;z=0;B=n.height+l;G=z*p+B*r+q;z=z*u+B*w+y;
B=Math.min(m,G);O=Math.min(D,z);V=Math.max(m+V,G)-B;P=Math.max(D+P,z)-O;m=B;D=O;l=b.viewportBounds;n=l.x;p=l.y;m=!(m>l.width+n||n>V+m||D>l.height+p||p>P+D)}if(m){m=0!==(this.I&256);a.clipInsteadOfFill&&(m=!1);this instanceof ih&&(a.font=this.font);if(m){F&&F.Mz&&Ca("clip"+this.toString());D=g.ke()?g.naturalBounds:g.actualBounds;null!==this.sd?(n=this.sd,V=n.x,P=n.y,l=n.width,n=n.height):(V=Math.max(d.x,D.x),P=Math.max(d.y,D.y),l=Math.min(d.right,D.right)-V,n=Math.min(d.bottom,D.bottom)-P);if(V>d.width+
d.x||d.x>D.width+D.x){1!==e&&(a.globalAlpha=f);return}a.save();a.beginPath();a.rect(V,P,l,n);a.clip()}if(this.Kf()){if(!h.isVisible()){1!==e&&(a.globalAlpha=f);return}k&&(D=h.shadowOffset,a.Kw(D.x*b.scale*b.Yb,D.y*b.scale*b.Yb,h.shadowBlur),Hl(a),a.shadowColor=h.shadowColor)}!0===this.shadowVisible?Hl(a):!1===this.shadowVisible&&Il(a);h=this.naturalBounds;null!==this.jc&&(Ai(this,a,this.jc,!0,!0,h,d),this.jc instanceof Jl&&this.jc.type===Kl?(a.beginPath(),a.rect(d.x,d.y,d.width,d.height),a.de(this.jc)):
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.I&512)||null!==g&&(g.type===U.Auto||g.type===U.Spot)&&g.yb()!==this)&&null===this.shadowVisible&&Il(a);null!==this.ob&&(l=this.naturalBounds,V=D=0,P=l.width,l=l.height,n=0,this instanceof Yf&&(l=this.qa.bounds,D=l.x,V=l.y,P=l.width,l=l.height,n=this.strokeWidth),Ai(this,a,this.ob,!0,!1,h,d),this.ob instanceof Jl&&this.ob.type===Kl?(a.beginPath(),a.rect(D-n/2,V-n/2,P+n,l+n),a.de(this.ob)):a.fillRect(D-
n/2,V-n/2,P+n,l+n));F&&F.sm&&F.Lz&&F.Lz(a,this);k&&(null!==this.ob||null!==this.jc||null!==g&&0!==(g.I&512)||null!==g&&(g.type===U.Auto||g.type===U.Spot)&&g.yb()!==this)?(Ll(this,!0),null===this.shadowVisible&&Il(a)):Ll(this,!1);this.ej(a,b);k&&0!==(this.I&512)===!0&&Hl(a);this.Kf()&&k&&Il(a);m?(a.restore(),this instanceof U?a.yc(!0):a.yc(!1)):c.Vt()||(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.jy=function(){return!1};function Fl(a,b,c){var d=a.Bb,e=a.uc;null!==a.jc&&(Ai(a,b,a.jc,!0,!0,e,d),a.jc instanceof Jl&&a.jc.type===Kl?(b.beginPath(),b.rect(d.x,d.y,d.width,d.height),b.de(a.jc)):b.fillRect(d.x,d.y,d.width,d.height));null!==a.ob&&(Ai(a,b,a.ob,!0,!1,e,d),a.ob instanceof Jl&&a.ob.type===Kl?(b.beginPath(),b.rect(d.x,d.y,d.width,d.height),b.de(a.ob)):b.fillRect(d.x,d.y,d.width,d.height));a.ej(b,c)}t.ej=function(){};
function Ai(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===Ml)d?b.fillStyle=c.color:b.strokeStyle=c.color;else{var l=0;a instanceof Yf&&(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 Nl)&&c.pe&&(c.type===Ol||c.al===h&&c.Bu===k))var m=c.pe;else{var n=0,p=0,r=0,q=0,u=0,w=0;w=u=0;e?(u=g.x,w=g.y):d||(u-=l/2,w-=l/2);n=c.start.x*h+c.start.offsetX;p=c.start.y*k+c.start.offsetY;r=c.end.x*h+
c.end.offsetX;q=c.end.y*k+c.end.offsetY;n+=u;r+=u;p+=w;q+=w;if(c.type===Pl)m=b.createLinearGradient(n,p,r,q);else if(c.type===Kl)w=isNaN(c.endRadius)?Math.max(h,k)/2:c.endRadius,isNaN(c.startRadius)?(u=0,w=Math.max(h,k)/2):u=c.startRadius,m=b.createRadialGradient(n,p,u,r,q,w);else if(c.type===Ol)try{m=b.createPattern(c.pattern,"repeat")}catch(z){m=null}else xa(c.type,"Brush type");if(c.type!==Ol&&(e=c.colorStops,null!==e))for(e=e.iterator;e.next();)m.addColorStop(e.key,e.value);if(f&&(c.pe=m,null!==
m&&(c.al=h,c.Bu=k),null===m&&c.type===Ol&&-1!==c.al)){c.al=-1;var y=a.diagram;null!==y&&-1===c.al&&ta(function(){y.ge()},600)}}d?b.fillStyle=m:b.strokeStyle=m}}}t.Lg=function(a){if(a instanceof U)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.Lf=function(){if(!this.visible)return!1;var a=this.panel;return null!==a?a.Lf():!0};
t.Mg=function(){for(var a=this instanceof U?this:this.panel;null!==a&&a.isEnabled;)a=a.panel;return null===a};
function Gl(a){if(0!==(a.I&2048)===!0){var b=a.sb;b.reset();if(!a.Bb.o()||!a.tc.o()){Ql(a,!1);return}b.translate(a.Bb.x-a.tc.x,a.Bb.y-a.tc.y);if(1!==a.scale||0!==a.angle){var c=a.naturalBounds;yl(a,b,c.x,c.y,c.width,c.height)}Ql(a,!1);Rl(a,!0)}0!==(a.I&4096)===!0&&(b=a.panel,null===b?(a.ci.set(a.sb),a.kl=a.scale,Rl(a,!1)):null!==b.Cd&&(c=a.ci,c.reset(),b.ke()?c.multiply(b.ci):null!==b.panel&&c.multiply(b.panel.ci),c.multiply(a.sb),a.kl=a.scale*b.kl,Rl(a,!1)))}
function yl(a,b,c,d,e,f){1!==a.scale&&b.scale(a.scale);if(0!==a.dc){var g=Mc;a.Kf()&&a.locationSpot.bb()&&(g=a.locationSpot);var h=J.alloc();if(a instanceof S&&a.locationObject!==a)for(c=a.locationObject,d=c.naturalBounds,h.Lk(d.x,d.y,d.width,d.height,g),c.kg.xa(h),h.offset(-c.measuredBounds.x,-c.measuredBounds.y),g=c.panel;null!==g&&g!==a;)g.kg.xa(h),h.offset(-g.measuredBounds.x,-g.measuredBounds.y),g=g.panel;else h.Lk(c,d,e,f,g);b.rotate(a.dc,h.x,h.y);J.free(h)}}
t.u=function(a){void 0===a&&(a=!1);if(!0!==Hj(this)){Cj(this,!0);Bl(this,!0);var b=this.panel;null===b||a||b.u()}};t.Fm=function(){!0!==Hj(this)&&(Cj(this,!0),Bl(this,!0))};function Sl(a){if(!1===Ij(a)){var b=a.panel;null!==b?b.u():a.Kf()&&(b=a.diagram,null!==b&&(b.ud.add(a),a instanceof T&&a.md(),b.Hb()));Bl(a,!0)}}t.Bl=function(){0!==(this.I&2048)===!1&&(Ql(this,!0),Rl(this,!0))};t.fw=function(){Rl(this,!0)};t.P=function(){var a=this.part;null!==a&&a.P()};
function Al(a,b){var c=a.stretch,d=a.panel;if(null!==d&&d.type===U.Table)return Tl(a,d.getRowDefinition(a.row),d.getColumnDefinition(a.column),b);if(null!==d&&d.type===U.Auto&&d.yb()===a)return Ul(a,Hd,b);if(c===kl){if(null!==d){if(d.type===U.Spot&&d.yb()===a)return Ul(a,Hd,b);c=d.defaultStretch;return c===kl?Ul(a,Mg,b):Ul(a,c,b)}return Ul(a,Mg,b)}return Ul(a,c,b)}
function Tl(a,b,c,d){var e=a.stretch;if(e!==kl)return Ul(a,e,d);var f=e=null;switch(b.stretch){case ml:f=!0;break;case Hd:f=!0}switch(c.stretch){case ll:e=!0;break;case Hd:e=!0}b=a.panel.defaultStretch;null===e&&(e=b===ll||b===Hd);null===f&&(f=b===ml||b===Hd);return!0===e&&!0===f?Ul(a,Hd,d):!0===e?Ul(a,ll,d):!0===f?Ul(a,ml,d):Ul(a,Mg,d)}
function Ul(a,b,c){if(c)return b;if(b===Mg)return Mg;c=a.desiredSize;if(c.o())return Mg;a=a.angle;if(!isNaN(c.width))if(90!==a&&270!==a){if(b===ll)return Mg;if(b===Hd)return ml}else{if(b===ml)return Mg;if(b===Hd)return ll}if(!isNaN(c.height))if(90!==a&&270!==a){if(b===ml)return Mg;if(b===Hd)return ll}else{if(b===ll)return Mg;if(b===Hd)return ml}return b}function Ll(a,b){a.I=b?a.I|512:a.I&-513}function ul(a){return 0!==(a.I&1024)}function Vl(a,b){a.I=b?a.I|1024:a.I&-1025}
function Ql(a,b){a.I=b?a.I|2048:a.I&-2049}function Rl(a,b){a.I=b?a.I|4096:a.I&-4097}function Hj(a){return 0!==(a.I&8192)}function Cj(a,b){a.I=b?a.I|8192:a.I&-8193}function Ij(a){return 0!==(a.I&16384)}function Bl(a,b){a.I=b?a.I|16384:a.I&-16385}t.rj=function(a){this.wg=a};t.nu=function(){};t.Gw=function(a){this.sa.assign(a);Sl(this);return!0};t.ir=function(a,b){if(this.sa.x!==a||this.sa.y!==b)this.sa.h(a,b),this.Bl()};
function Wl(a){var b=a.part;if(b instanceof T&&(null!==a.portId||a===b.port)){var c=b.diagram;null===c||c.undoManager.isUndoingRedoing||El(b,a)}}function Xl(a){var b=a.diagram;null===b||b.undoManager.isUndoingRedoing||(a instanceof U?a instanceof T?a.md():a.Nk(a,function(a){Wl(a)}):Wl(a))}t.bind=function(a){a.jd=this;var b=this.ij();null!==b&&Yl(b)&&v("Cannot add a Binding to a template that has already been copied: "+a);null===this.jb&&(this.jb=new H);this.jb.add(a)};
t.ij=function(){for(var a=this instanceof U?this:this.panel;null!==a;){if(null!==a.pi)return a;a=a.panel}return null};t.Hw=function(a){Oj(this,a)};function Zl(a,b){b.jd=a;null===a.Sg&&(a.Sg=new Db);a.Sg.add(b.propertyName,b)}
function $l(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=am.K(a);"function"===typeof f?(c=Ia(arguments),d=f(c),Fa(d)||v('GraphObject.make invoked object builder "'+a+'", but it did not return an Object')):e=qa.go[a]}null===d&&(void 0!==e&&null!==e&&e.constructor||v("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)Pi(f,g),e++}for(;e<c.length;e++)f=c[e],void 0===f?v("Undefined value at argument "+e+" for object being constructed by GraphObject.make: "+d):bm(d,f);return d}
function bm(a,b){if("string"===typeof b)if(a instanceof ih)a.text=b;else if(a instanceof Yf)a.figure=b;else if(a instanceof xk)a.source=b;else if(a instanceof U){var c=cm.K(b);null!==c?a.type=c:F&&v("Unknown Panel type as an argument to GraphObject.make: "+b+". If building from source, you may need to call Panel.definePanelLayout.")}else a instanceof Jl?(c=gb(Jl,b),null!==c?a.type=c:v("Unknown Brush type as an argument to GraphObject.make: "+b)):a instanceof Fd?(c=gb(Fd,b),null!==c?a.type=c:F&&v("Unknown Geometry type as an argument to GraphObject.make: "+
b)):a instanceof ue?(c=gb(ue,b),null!==c?a.type=c:F&&v("Unknown PathSegment type as an argument to GraphObject.make: "+b)):F&&v("Unable to use a string as an argument to GraphObject.make: "+b);else if(b instanceof N)a instanceof U||v("A GraphObject can only be added to a Panel, not to: "+a),a.add(b);else if(b instanceof ik){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
ik?d.Et(b):v("A RowColumnDefinition can only be added to an object that implements getRowDefinition/getColumnDefinition, not to: "+a)}else if(b instanceof E)"function"===typeof a.mb?a.mb(b):Ba(a,b);else if(b instanceof dm)a.type=b;else if(b instanceof $i)a instanceof N?a.bind(b):a instanceof ik?a.bind(b):v("A Binding can only be applied to a GraphObject or RowColumnDefinition, not to: "+a);else if(b instanceof ri)a instanceof N?Zl(a,b):v("An AnimationTrigger can only be applied to a GraphObject, not to: "+
a);else if(b instanceof te)a instanceof Fd?a.figures.add(b):v("A PathFigure can only be added to a Geometry, not to: "+a);else if(b instanceof ue)a instanceof te?a.segments.add(b):v("A PathSegment can only be added to a PathFigure, not to: "+a);else if(b instanceof Ni)a instanceof Q?a.layout=b:a instanceof Hf?a.layout=b:v("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++)bm(a,b[c]);else if("object"===typeof b&&null!==b)if(a instanceof
Jl){c=new jb;for(var e in b)d=parseFloat(e),isNaN(d)?c[e]=b[e]:a.addColorStop(d,b[e]);Oj(a,c)}else if(a instanceof ik){void 0!==b.row?(e=b.row,(void 0===e||null===e||Infinity===e||isNaN(e)||0>e)&&v("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)&&v("Must specify non-negative integer column for RowColumnDefinition "+b+", not: "+e),a.isRow=!1,a.index=e);e=new jb;for(c in b)"row"!==
c&&"column"!==c&&(e[c]=b[c]);Oj(a,e)}else Oj(a,b);else v('Unknown initializer "'+b+'" for object being constructed by GraphObject.make: '+a)}function em(a,b){A(a,"string",N,"defineBuilder:name");A(b,"function",N,"defineBuilder:func");var c=a.toLowerCase();F&&(""===a||"none"===c||a===c)&&v("Shape.defineFigureGenerator name must not be empty or None or all-lower-case: "+a);am.add(a,b)}
function fm(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(N.prototype,{shadowVisible:{configurable:!0,get:function(){return this.am},set:function(a){var b=this.am;b!==a&&(F&&null!==a&&A(a,"boolean",N,"shadowVisible"),this.am=a,this.P(),this.g("shadowVisible",b,a))}},enabledChanged:{configurable:!0,get:function(){return null!==this.R?this.R.Xn:null},set:function(a){rl(this);var b=this.R.Xn;b!==a&&(null!==a&&A(a,"function",N,"enabledChanged"),this.R.Xn=a,this.g("enabledChanged",b,a))}},segmentOrientation:{configurable:!0,
enumerable:!0,get:function(){return this.Zl},set:function(a){var b=this.Zl;b!==a&&(F&&hb(a,R,N,"segmentOrientation"),this.Zl=a,this.u(),this.g("segmentOrientation",b,a),a===og&&(this.angle=0))}},segmentIndex:{configurable:!0,get:function(){return this.Rp},set:function(a){F&&A(a,"number",N,"segmentIndex");a=Math.round(a);var b=this.Rp;b!==a&&(this.Rp=a,this.u(),this.g("segmentIndex",b,a))}},segmentFraction:{configurable:!0,get:function(){return this.Xl},set:function(a){F&&
A(a,"number",N,"segmentFraction");isNaN(a)?a=0:0>a?a=0:1<a&&(a=1);var b=this.Xl;b!==a&&(this.Xl=a,this.u(),this.g("segmentFraction",b,a))}},segmentOffset:{configurable:!0,get:function(){return this.Yl},set:function(a){var b=this.Yl;b.A(a)||(F&&x(a,J,N,"segmentOffset"),this.Yl=a=a.J(),this.u(),this.g("segmentOffset",b,a))}},stretch:{configurable:!0,get:function(){return this.Ke},set:function(a){var b=this.Ke;b!==a&&(F&&hb(a,N,N,"stretch"),this.Ke=a,this.u(),this.g("stretch",
b,a))}},name:{configurable:!0,get:function(){return this.Wa},set:function(a){var b=this.Wa;b!==a&&(F&&A(a,"string",N,"name"),this.Wa=a,null!==this.part&&(this.part.Uj=null),this.g("name",b,a))}},opacity:{configurable:!0,get:function(){return this.wb},set:function(a){var b=this.wb;b!==a&&(A(a,"number",N,"opacity"),(0>a||1<a)&&ya(a,"0 <= value <= 1",N,"opacity"),this.wb=a,this.g("opacity",b,a),a=this.diagram,b=this.part,null!==a&&null!==b&&a.P(Sj(b,b.actualBounds)))}},visible:{configurable:!0,
enumerable:!0,get:function(){return 0!==(this.I&1)},set:function(a){var b=0!==(this.I&1);b!==a&&(F&&A(a,"boolean",N,"visible"),this.I^=1,this.g("visible",b,a),b=this.panel,null!==b?b.u():this.Kf()&&this.Vb(a),this.P(),Xl(this))}},pickable:{configurable:!0,get:function(){return 0!==(this.I&2)},set:function(a){var b=0!==(this.I&2);b!==a&&(F&&A(a,"boolean",N,"pickable"),this.I^=2,this.g("pickable",b,a))}},fromLinkableDuplicates:{configurable:!0,get:function(){return 0!==(this.I&
4)},set:function(a){var b=0!==(this.I&4);b!==a&&(F&&A(a,"boolean",N,"fromLinkableDuplicates"),this.I^=4,this.g("fromLinkableDuplicates",b,a))}},fromLinkableSelfNode:{configurable:!0,get:function(){return 0!==(this.I&8)},set:function(a){var b=0!==(this.I&8);b!==a&&(F&&A(a,"boolean",N,"fromLinkableSelfNode"),this.I^=8,this.g("fromLinkableSelfNode",b,a))}},toLinkableDuplicates:{configurable:!0,get:function(){return 0!==(this.I&16)},set:function(a){var b=0!==(this.I&16);b!==
a&&(F&&A(a,"boolean",N,"toLinkableDuplicates"),this.I^=16,this.g("toLinkableDuplicates",b,a))}},toLinkableSelfNode:{configurable:!0,get:function(){return 0!==(this.I&32)},set:function(a){var b=0!==(this.I&32);b!==a&&(F&&A(a,"boolean",N,"toLinkableSelfNode"),this.I^=32,this.g("toLinkableSelfNode",b,a))}},isPanelMain:{configurable:!0,get:function(){return 0!==(this.I&64)},set:function(a){var b=0!==(this.I&64);b!==a&&(F&&A(a,"boolean",N,"isPanelMain"),this.I^=64,this.u(),
this.g("isPanelMain",b,a))}},isActionable:{configurable:!0,get:function(){return 0!==(this.I&128)},set:function(a){var b=0!==(this.I&128);b!==a&&(F&&A(a,"boolean",N,"isActionable"),this.I^=128,this.g("isActionable",b,a))}},areaBackground:{configurable:!0,get:function(){return this.jc},set:function(a){var b=this.jc;b!==a&&(null!==a&&gm(a,"GraphObject.areaBackground"),a instanceof Jl&&a.freeze(),this.jc=a,this.P(),this.g("areaBackground",b,a))}},background:{configurable:!0,
enumerable:!0,get:function(){return this.ob},set:function(a){var b=this.ob;b!==a&&(null!==a&&gm(a,"GraphObject.background"),a instanceof Jl&&a.freeze(),this.ob=a,this.P(),this.g("background",b,a))}},part:{configurable:!0,get:function(){if(this.Kf())return this;if(null!==this.Yj)return this.Yj;var a;for(a=this.panel;a;){if(a instanceof S)return this.Yj=a;a=a.panel}return null}},svg:{configurable:!0,get:function(){return this.jq},set:function(a){this.jq=a}},panel:{configurable:!0,
enumerable:!0,get:function(){return this.wg}},layer:{configurable:!0,get:function(){var a=this.part;return null!==a?a.layer:null}},diagram:{configurable:!0,get:function(){var a=this.part;return null!==a?a.diagram:null}},position:{configurable:!0,get:function(){return this.sa},set:function(a){F&&x(a,J,N,"position");var b=a.x,c=a.y,d=this.sa,e=d.x,f=d.y;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))?this.nu():(a=a.copy(),this.Gw(a,d)&&this.g("position",
d.copy(),a.copy()))}},actualBounds:{configurable:!0,get:function(){return this.Bb}},scale:{configurable:!0,get:function(){return this.Fa},set:function(a){var b=this.Fa;b!==a&&(F&&C(a,N,"scale"),0>=a&&v("GraphObject.scale for "+this+" must be greater than zero, not: "+a),this.Fa=a,this.u(),this.g("scale",b,a))}},angle:{configurable:!0,get:function(){return this.dc},set:function(a){var b=this.dc;b!==a&&(F&&C(a,N,"angle"),a%=360,0>a&&(a+=360),b!==a&&(this.dc=
a,Xl(this),this.u(),this.g("angle",b,a)))}},desiredSize:{configurable:!0,get:function(){return this.Uc},set:function(a){F&&x(a,Hb,N,"desiredSize");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.J(),this.u(),this instanceof Yf&&this.ic(),this.g("desiredSize",d,a),ul(this)&&(a=this.part,null!==a&&(vl(this,a,"width"),vl(this,a,"height"))))}},width:{configurable:!0,get:function(){return this.Uc.width},
set:function(a){var b=this.Uc.width;b===a||isNaN(b)&&isNaN(a)||(F&&A(a,"number",N,"width"),b=this.Uc,this.Uc=a=(new Hb(a,this.Uc.height)).freeze(),this.u(),this instanceof Yf&&this.ic(),this.g("desiredSize",b,a),ul(this)&&(a=this.part,null!==a&&vl(this,a,"width")))}},height:{configurable:!0,get:function(){return this.Uc.height},set:function(a){var b=this.Uc.height;b===a||isNaN(b)&&isNaN(a)||(F&&A(a,"number",N,"height"),b=this.Uc,this.Uc=a=(new Hb(this.Uc.width,a)).freeze(),this.u(),
this instanceof Yf&&this.ic(),this.g("desiredSize",b,a),ul(this)&&(a=this.part,null!==a&&vl(this,a,"height")))}},minSize:{configurable:!0,get:function(){return this.ng},set:function(a){var b=this.ng;b.A(a)||(F&&x(a,Hb,N,"minSize"),a=a.copy(),isNaN(a.width)&&(a.width=0),isNaN(a.height)&&(a.height=0),a.freeze(),this.ng=a,this.u(),this.g("minSize",b,a))}},maxSize:{configurable:!0,get:function(){return this.mg},set:function(a){var b=this.mg;b.A(a)||(F&&x(a,Hb,N,"maxSize"),
a=a.copy(),isNaN(a.width)&&(a.width=Infinity),isNaN(a.height)&&(a.height=Infinity),a.freeze(),this.mg=a,this.u(),this.g("maxSize",b,a))}},measuredBounds:{configurable:!0,get:function(){return this.tc}},naturalBounds:{configurable:!0,get:function(){return this.uc}},margin:{configurable:!0,get:function(){return this.oh},set:function(a){"number"===typeof a?a=new lc(a):F&&x(a,lc,N,"margin");var b=this.oh;b.A(a)||(this.oh=a=a.J(),this.u(),this.g("margin",b,a))}},
transform:{configurable:!0,get:function(){0!==(this.I&2048)===!0&&Gl(this);return this.sb}},Cd:{configurable:!0,get:function(){0!==(this.I&4096)===!0&&Gl(this);return this.ci}},alignment:{configurable:!0,get:function(){return this.Cb},set:function(a){var b=this.Cb;b.A(a)||(F&&x(a,M,N,"alignment"),a.Tb()&&!a.Gb()&&v("GraphObject.alignment for "+this+" must be a real Spot or Spot.Default, not: "+a),this.Cb=a=a.J(),Sl(this),this.g("alignment",b,a))}},column:{configurable:!0,
enumerable:!0,get:function(){return this.Xg},set:function(a){F&&C(a,N,"column");a=Math.round(a);var b=this.Xg;b!==a&&(0>a&&ya(a,">= 0",N,"column"),this.Xg=a,this.u(),this.g("column",b,a))}},columnSpan:{configurable:!0,get:function(){return this.An},set:function(a){F&&A(a,"number",N,"columnSpan");a=Math.round(a);var b=this.An;b!==a&&(1>a&&ya(a,">= 1",N,"columnSpan"),this.An=a,this.u(),this.g("columnSpan",b,a))}},row:{configurable:!0,get:function(){return this.Kp},set:function(a){F&&
C(a,N,"row");a=Math.round(a);var b=this.Kp;b!==a&&(0>a&&ya(a,">= 0",N,"row"),this.Kp=a,this.u(),this.g("row",b,a))}},rowSpan:{configurable:!0,get:function(){return this.Lp},set:function(a){F&&A(a,"number",N,"rowSpan");a=Math.round(a);var b=this.Lp;b!==a&&(1>a&&ya(a,">= 1",N,"rowSpan"),this.Lp=a,this.u(),this.g("rowSpan",b,a))}},spanAllocation:{configurable:!0,get:function(){return this.eq},set:function(a){var b=this.eq;b!==a&&(null!==a&&A(a,"function",N,"spanAllocation"),
this.eq=a,this.u(),this.g("spanAllocation",b,a))}},alignmentFocus:{configurable:!0,get:function(){return this.Uk},set:function(a){var b=this.Uk;b.A(a)||(F&&x(a,M,N,"alignmentFocus"),!F||!a.Tb()||a.Gb()||a.Rq()&&this instanceof T||v("GraphObject.alignmentFocus must be a real Spot or Spot.Default, not: "+a),this.Uk=a=a.J(),this.u(),this.g("alignmentFocus",b,a))}},portId:{configurable:!0,get:function(){return this.yp},set:function(a){var b=this.yp;if(b!==a){F&&null!==a&&A(a,
"string",N,"portId");var c=this.part;null===c||c instanceof T||(v("Cannot set portID on a Link: "+a),c=null);null!==b&&null!==c&&hm(c,this);this.yp=a;null!==a&&null!==c&&(c.Sh=!0,im(c,this));this.g("portId",b,a)}}},toSpot:{configurable:!0,get:function(){return null!==this.S?this.S.Gh:Gc},set:function(a){this.Mc();var b=this.S.Gh;b.A(a)||(F&&x(a,M,N,"toSpot"),a=a.J(),this.S.Gh=a,this.g("toSpot",b,a),Wl(this))}},toEndSegmentLength:{configurable:!0,get:function(){return null!==
this.S?this.S.Eh:10},set:function(a){this.Mc();var b=this.S.Eh;b!==a&&(F&&A(a,"number",N,"toEndSegmentLength"),0>a&&ya(a,">= 0",N,"toEndSegmentLength"),this.S.Eh=a,this.g("toEndSegmentLength",b,a),Wl(this))}},toShortLength:{configurable:!0,get:function(){return null!==this.S?this.S.Fh:0},set:function(a){this.Mc();var b=this.S.Fh;b!==a&&(F&&A(a,"number",N,"toShortLength"),this.S.Fh=a,this.g("toShortLength",b,a),Wl(this))}},toLinkable:{configurable:!0,get:function(){return null!==
this.S?this.S.nq:null},set:function(a){this.Mc();var b=this.S.nq;b!==a&&(F&&null!==a&&A(a,"boolean",N,"toLinkable"),this.S.nq=a,this.g("toLinkable",b,a))}},toMaxLinks:{configurable:!0,get:function(){return null!==this.S?this.S.oq:Infinity},set:function(a){this.Mc();var b=this.S.oq;b!==a&&(F&&A(a,"number",N,"toMaxLinks"),0>a&&ya(a,">= 0",N,"toMaxLinks"),this.S.oq=a,this.g("toMaxLinks",b,a))}},fromSpot:{configurable:!0,get:function(){return null!==this.S?this.S.hh:Gc},set:function(a){this.Mc();
var b=this.S.hh;b.A(a)||(F&&x(a,M,N,"fromSpot"),a=a.J(),this.S.hh=a,this.g("fromSpot",b,a),Wl(this))}},fromEndSegmentLength:{configurable:!0,get:function(){return null!==this.S?this.S.fh:10},set:function(a){this.Mc();var b=this.S.fh;b!==a&&(F&&A(a,"number",N,"fromEndSegmentLength"),0>a&&ya(a,">= 0",N,"fromEndSegmentLength"),this.S.fh=a,this.g("fromEndSegmentLength",b,a),Wl(this))}},fromShortLength:{configurable:!0,get:function(){return null!==this.S?this.S.gh:0},set:function(a){this.Mc();
var b=this.S.gh;b!==a&&(F&&A(a,"number",N,"fromShortLength"),this.S.gh=a,this.g("fromShortLength",b,a),Wl(this))}},fromLinkable:{configurable:!0,get:function(){return null!==this.S?this.S.eo:null},set:function(a){this.Mc();var b=this.S.eo;b!==a&&(F&&null!==a&&A(a,"boolean",N,"fromLinkable"),this.S.eo=a,this.g("fromLinkable",b,a))}},fromMaxLinks:{configurable:!0,get:function(){return null!==this.S?this.S.fo:Infinity},set:function(a){this.Mc();var b=this.S.fo;b!==a&&(F&&
A(a,"number",N,"fromMaxLinks"),0>a&&ya(a,">= 0",N,"fromMaxLinks"),this.S.fo=a,this.g("fromMaxLinks",b,a))}},cursor:{configurable:!0,get:function(){return this.ti},set:function(a){var b=this.ti;b!==a&&(A(a,"string",N,"cursor"),this.ti=a,this.g("cursor",b,a))}},click:{configurable:!0,get:function(){return null!==this.R?this.R.Wf:null},set:function(a){rl(this);var b=this.R.Wf;b!==a&&(null!==a&&A(a,"function",N,"click"),this.R.Wf=a,this.g("click",b,a))}},doubleClick:{configurable:!0,
enumerable:!0,get:function(){return null!==this.R?this.R.ag:null},set:function(a){rl(this);var b=this.R.ag;b!==a&&(null!==a&&A(a,"function",N,"doubleClick"),this.R.ag=a,this.g("doubleClick",b,a))}},contextClick:{configurable:!0,get:function(){return null!==this.R?this.R.Xf:null},set:function(a){rl(this);var b=this.R.Xf;b!==a&&(null!==a&&A(a,"function",N,"contextClick"),this.R.Xf=a,this.g("contextClick",b,a))}},mouseEnter:{configurable:!0,get:function(){return null!==this.R?
this.R.pg:null},set:function(a){rl(this);var b=this.R.pg;b!==a&&(null!==a&&A(a,"function",N,"mouseEnter"),this.R.pg=a,this.g("mouseEnter",b,a))}},mouseLeave:{configurable:!0,get:function(){return null!==this.R?this.R.sg:null},set:function(a){rl(this);var b=this.R.sg;b!==a&&(null!==a&&A(a,"function",N,"mouseLeave"),this.R.sg=a,this.g("mouseLeave",b,a))}},mouseOver:{configurable:!0,get:function(){return null!==this.R?this.R.tg:null},set:function(a){rl(this);var b=this.R.tg;
b!==a&&(null!==a&&A(a,"function",N,"mouseOver"),this.R.tg=a,this.g("mouseOver",b,a))}},mouseHover:{configurable:!0,get:function(){return null!==this.R?this.R.rg:null},set:function(a){rl(this);var b=this.R.rg;b!==a&&(null!==a&&A(a,"function",N,"mouseHover"),this.R.rg=a,this.g("mouseHover",b,a))}},mouseHold:{configurable:!0,get:function(){return null!==this.R?this.R.qg:null},set:function(a){rl(this);var b=this.R.qg;b!==a&&(null!==a&&A(a,"function",N,"mouseHold"),this.R.qg=
a,this.g("mouseHold",b,a))}},mouseDragEnter:{configurable:!0,get:function(){return null!==this.R?this.R.Zo:null},set:function(a){rl(this);var b=this.R.Zo;b!==a&&(null!==a&&A(a,"function",N,"mouseDragEnter"),this.R.Zo=a,this.g("mouseDragEnter",b,a))}},mouseDragLeave:{configurable:!0,get:function(){return null!==this.R?this.R.$o:null},set:function(a){rl(this);var b=this.R.$o;b!==a&&(null!==a&&A(a,"function",N,"mouseDragLeave"),this.R.$o=a,this.g("mouseDragLeave",b,a))}},
mouseDrop:{configurable:!0,get:function(){return null!==this.R?this.R.og:null},set:function(a){rl(this);var b=this.R.og;b!==a&&(null!==a&&A(a,"function",N,"mouseDrop"),this.R.og=a,this.g("mouseDrop",b,a))}},actionDown:{configurable:!0,get:function(){return null!==this.R?this.R.hn:null},set:function(a){rl(this);var b=this.R.hn;b!==a&&(null!==a&&A(a,"function",N,"actionDown"),this.R.hn=a,this.g("actionDown",b,a))}},actionMove:{configurable:!0,get:function(){return null!==
this.R?this.R.jn:null},set:function(a){rl(this);var b=this.R.jn;b!==a&&(null!==a&&A(a,"function",N,"actionMove"),this.R.jn=a,this.g("actionMove",b,a))}},actionUp:{configurable:!0,get:function(){return null!==this.R?this.R.kn:null},set:function(a){rl(this);var b=this.R.kn;b!==a&&(null!==a&&A(a,"function",N,"actionUp"),this.R.kn=a,this.g("actionUp",b,a))}},actionCancel:{configurable:!0,get:function(){return null!==this.R?this.R.gn:null},set:function(a){rl(this);var b=this.R.gn;
b!==a&&(null!==a&&A(a,"function",N,"actionCancel"),this.R.gn=a,this.g("actionCancel",b,a))}},toolTip:{configurable:!0,get:function(){return null!==this.R?this.R.Dg:null},set:function(a){rl(this);var b=this.R.Dg;b!==a&&(!F||null===a||a instanceof Te||a instanceof bf||v("GraphObject.toolTip must be an Adornment or HTMLInfo."),this.R.Dg=a,this.g("toolTip",b,a))}},contextMenu:{configurable:!0,get:function(){return null!==this.R?this.R.Yf:null},set:function(a){rl(this);var b=
this.R.Yf;b!==a&&(!F||a instanceof Te||a instanceof bf||v("GraphObject.contextMenu must be an Adornment or HTMLInfo."),this.R.Yf=a,this.g("contextMenu",b,a))}}});N.prototype.setProperties=N.prototype.Hw;N.prototype.findTemplateBinder=N.prototype.ij;N.prototype.bind=N.prototype.bind;N.prototype.isEnabledObject=N.prototype.Mg;N.prototype.isVisibleObject=N.prototype.Lf;N.prototype.isContainedBy=N.prototype.Lg;N.prototype.getNearestIntersectionPoint=N.prototype.bd;N.prototype.getLocalPoint=N.prototype.Ot;
N.prototype.getDocumentScale=N.prototype.Gf;N.prototype.getDocumentAngle=N.prototype.lj;N.prototype.getDocumentBounds=N.prototype.Cm;N.prototype.getDocumentPoint=N.prototype.ma;N.prototype.intersectsRect=N.prototype.Oc;N.prototype.containedInRect=N.prototype.Oh;N.prototype.containsRect=N.prototype.Pe;N.prototype.containsPoint=N.prototype.fa;N.prototype.raiseChanged=N.prototype.g;N.prototype.raiseChangedEvent=N.prototype.gb;N.prototype.addCopyProperty=N.prototype.Ux;var am=null;N.className="GraphObject";
am=new Db;
em("Button",function(){function a(a,b){return null!==a.diagram.$b(a.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a},function(a){return a===b})}var b=$l(U,U.Auto,{isActionable:!0,enabledChanged:function(a,b){if(a instanceof U){var c=a.fb("ButtonBorder");null!==c&&(c.fill=b?a._buttonFillNormal:a._buttonFillDisabled)}},cursor:"pointer",_buttonFillNormal:"#F5F5F5",_buttonStrokeNormal:"#BDBDBD",_buttonFillOver:"#E0E0E0",_buttonStrokeOver:"#9E9E9E",_buttonFillPressed:"#BDBDBD",_buttonStrokePressed:"#9E9E9E",
_buttonFillDisabled:"#E5E5E5"},$l(Yf,{name:"ButtonBorder",figure:"RoundedRectangle",spot1:new M(0,0,2.76142374915397,2.761423749153969),spot2:new M(1,1,-2.76142374915397,-2.761423749153969),parameter1:2,parameter2:2,fill:"#F5F5F5",stroke:"#BDBDBD"}));b.mouseEnter=function(a,b){if(b.Mg()&&b instanceof U&&(a=b.fb("ButtonBorder"),a instanceof Yf)){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.Mg()&&
b instanceof U&&(a=b.fb("ButtonBorder"),a instanceof Yf&&(a.fill=b._buttonFillNormal,a.stroke=b._buttonStrokeNormal))};b.actionDown=function(a,b){if(b.Mg()&&b instanceof U&&null!==b._buttonFillPressed&&0===a.button){var c=b.fb("ButtonBorder");if(c instanceof Yf){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.Mg()&&
d instanceof U&&null!==d._buttonFillPressed&&0===b.button){var c=d.fb("ButtonBorder");if(c instanceof Yf){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.Mg()&&d instanceof U&&null!==d._buttonFillPressed){var c=d.fb("ButtonBorder");if(c instanceof Yf){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.Mg()&&d instanceof U&&null!==d._buttonFillPressed){var c=b.diagram;if(0===c.firstInput.button&&(c.currentTool.standardMouseOver(),a(b,d)&&(b=d.fb("ButtonBorder"),b instanceof Yf))){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});
em("TreeExpanderButton",function(){var a=$l("Button",{_treeExpandedFigure:"MinusLine",_treeCollapsedFigure:"PlusLine"},$l(Yf,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:$b},(new $i("figure","isTreeExpanded",function(a,c){c=c.panel;return a?c._treeExpandedFigure:c._treeCollapsedFigure})).Yq()),{visible:!1},(new $i("visible","isTreeLeaf",function(a){return!a})).Yq());a.click=function(a,c){c=c.part;c instanceof Te&&(c=c.adornedPart);if(c instanceof T){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});
em("SubGraphExpanderButton",function(){var a=$l("Button",{_subGraphExpandedFigure:"MinusLine",_subGraphCollapsedFigure:"PlusLine"},$l(Yf,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:$b},(new $i("figure","isSubGraphExpanded",function(a,c){c=c.panel;return a?c._subGraphExpandedFigure:c._subGraphCollapsedFigure})).Yq()));a.click=function(a,c){c=c.part;c instanceof Te&&(c=c.adornedPart);if(c instanceof Hf){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});em("ToolTip",function(){return $l(Te,U.Auto,{isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new J(0,3),shadowBlur:5},$l(Yf,{name:"Border",figure:"RoundedRectangle",parameter1:1,parameter2:1,fill:"#F5F5F5",stroke:"#F0F0F0",spot1:new M(0,0,4,6),spot2:new M(1,1,-4,-4)}))});
em("ContextMenu",function(){return $l(Te,U.Vertical,{background:"#F5F5F5",isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new J(0,3),shadowBlur:5},new $i("background","",function(a){return null!==a.adornedPart&&null!==a.placeholder?null:"#F5F5F5"}))});em("ContextMenuButton",function(){var a=$l("Button");a.stretch=ll;var b=a.fb("ButtonBorder");b instanceof Yf&&(b.figure="Rectangle",b.strokeWidth=0,b.spot1=new M(0,0,2,3),b.spot2=new M(1,1,-2,-2));return a});
em("PanelExpanderButton",function(a){var b=fm(a,"COLLAPSIBLE"),c=$l("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},$l(Yf,{name:"ButtonIcon",strokeWidth:2},(new $i("geometryString","visible",function(a){return a?c._buttonExpandedFigure:c._buttonCollapsedFigure})).Yq(b)));
a=c.fb("ButtonBorder");a instanceof Yf&&(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.fb(b),null!==c&&(a.handled=!0,d.Ba("Collapse/Expand Panel"),c.visible=!c.visible,d.ab("Collapse/Expand Panel")))}};return c});
em("CheckBoxButton",function(a){var b=fm(a);a=$l("Button",{desiredSize:new Hb(14,14)},$l(Yf,{name:"ButtonIcon",geometryString:"M0 0 M0 8.85 L4.9 13.75 16.2 2.45 M16.2 16.2",strokeWidth:2,stretch:Hd,geometryStretch:Og,visible:!1},""!==b?(new $i("visible",b)).Fy():[]));a.click=function(a,d){if(d instanceof U){var c=a.diagram;if(!(null===c||c.isReadOnly||""!==b&&c.model.isReadOnly)){a.handled=!0;var f=d.fb("ButtonIcon");c.Ba("checkbox");f.visible=!f.visible;"function"===typeof d._doClick&&d._doClick(a,
d);c.ab("checkbox")}}};return a});
em("CheckBox",function(a){a=fm(a);a=$l("CheckBoxButton",a,{name:"Button",isActionable:!1,margin:new lc(0,1,0,0)});var b=$l(U,"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});N.None=Mg=new E(N,"None",0);N.Default=kl=new E(N,"Default",0);N.Vertical=ml=new E(N,"Vertical",4);N.Horizontal=ll=new E(N,"Horizontal",5);N.Fill=Hd=new E(N,"Fill",3);N.Uniform=Og=new E(N,"Uniform",1);
N.UniformToFill=nl=new E(N,"UniformToFill",2);N.FlipVertical=ol=new E(N,"FlipVertical",1);N.FlipHorizontal=pl=new E(N,"FlipHorizontal",2);N.FlipBoth=ql=new E(N,"FlipBoth",3);N.make=$l;N.getBuilders=function(){var a=new Db,b;for(b in am)if(b!==b.toLowerCase()){var c=am.K(b);"function"===typeof c&&a.add(b,c)}a.freeze();return a};N.defineBuilder=em;N.takeBuilderArgument=fm;
function sl(){this.Xn=this.Yf=this.Dg=this.gn=this.kn=this.jn=this.hn=this.og=this.$o=this.Zo=this.qg=this.rg=this.tg=this.sg=this.pg=this.Xf=this.ag=this.Wf=null}sl.prototype.copy=function(){var a=new sl;a.Wf=this.Wf;a.ag=this.ag;a.Xf=this.Xf;a.pg=this.pg;a.sg=this.sg;a.tg=this.tg;a.rg=this.rg;a.qg=this.qg;a.Zo=this.Zo;a.$o=this.$o;a.og=this.og;a.hn=this.hn;a.jn=this.jn;a.kn=this.kn;a.gn=this.gn;a.Dg=this.Dg;a.Yf=this.Yf;a.Xn=this.Xn;return a};sl.className="GraphObjectEventHandlers";
function jm(){this.Ra=[1,0,0,1,0,0]}jm.prototype.copy=function(){var a=new jm;a.Ra[0]=this.Ra[0];a.Ra[1]=this.Ra[1];a.Ra[2]=this.Ra[2];a.Ra[3]=this.Ra[3];a.Ra[4]=this.Ra[4];a.Ra[5]=this.Ra[5];return a};jm.prototype.translate=function(a,b){this.Ra[4]+=this.Ra[0]*a+this.Ra[2]*b;this.Ra[5]+=this.Ra[1]*a+this.Ra[3]*b};jm.prototype.scale=function(a,b){this.Ra[0]*=a;this.Ra[1]*=a;this.Ra[2]*=b;this.Ra[3]*=b};jm.className="STransform";
function km(a){this.type=a;this.r2=this.y2=this.x2=this.r1=this.y1=this.x1=0;this.ay=[];this.pattern=null}km.prototype.addColorStop=function(a,b){this.ay.push({offset:a,color:b})};km.className="SGradient";
function Rj(a,b){this.ownerDocument=a=void 0===b?qa.document:b;this.IA="http://www.w3.org/2000/svg";void 0!==a&&(this.Ka=this.Ab("svg",{width:"1px",height:"1px",viewBox:"0 0 1 1"}),this.Ka.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns","http://www.w3.org/2000/svg"),this.Ka.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"));this.Eq=null;this.context=new lm(this)}
Rj.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.Ka.setAttributeNS(null,"width",c+"px"),this.Ka.setAttributeNS(null,"height",d+"px"),this.Ka.setAttributeNS(null,"viewBox","0 0 "+c+" "+d),this.context.ev.firstElementChild.setAttributeNS(null,"width",c+"px"),this.context.ev.firstElementChild.setAttributeNS(null,"height",d+"px"),!0):!1};
Rj.prototype.Ab=function(a,b,c){a=this.ownerDocument.createElementNS(this.IA,a);if(Fa(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};Rj.prototype.getBoundingClientRect=function(){return this.Ka.getBoundingClientRect()};Rj.prototype.focus=function(){this.Ka.focus()};Rj.prototype.iy=function(){this.ownerDocument=null};
ma.Object.defineProperties(Rj.prototype,{width:{configurable:!0,get:function(){return this.Ka.width.baseVal.value},set:function(a){this.Ka.width=a}},height:{configurable:!0,get:function(){return this.Ka.height.baseVal.value},set:function(a){this.Ka.height=a}},style:{configurable:!0,get:function(){return this.Ka.style}}});Rj.className="SVGSurface";
function lm(a){this.Mk=a;this.svg=a.Ka;this.stack=[];this.Ec=[];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.rf=this.$p=this.Zp=0;this.Sq=null;this.path=[];this.Wu=!1;this.zh=null;this.Ah=0;this.ce=new jm;
mm(this,1,0,0,1,0,0);var b=wb++,c=this.Ab("clipPath",{id:"mainClip"+b});c.appendChild(this.Ab("rect",{x:0,y:0,width:a.width,height:a.height}));this.ev=c;this.Mk.Ka.appendChild(c);this.Ec[0].setAttributeNS(null,"clip-path","url(#mainClip"+b+")");this.KA={}}t=lm.prototype;
t.reset=function(){this.stack=[];this.Ec=[];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.rf=this.$p=this.Zp=0;this.Sq=null;this.path=[];this.ce=new jm;mm(this,1,0,0,1,0,0);var a=wb++,b=this.Ab("clipPath",
{id:"mainClip"+a});b.appendChild(this.Ab("rect",{x:0,y:0,width:this.Mk.width,height:this.Mk.height}));this.ev=b;this.Mk.Ka.appendChild(b);this.Ec[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.ce);this.addPath("clipPath",this.path,new jm)};t.closePath=function(){this.path.push(["z"])};t.createLinearGradient=function(a,b,c,d){var e=new km("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.KA;if(c[b])return"url(#"+c[b]+")";var d="PATTERN"+wb++,e={x:0,y:0,width:a.width,height:a.height,href:b};a=this.Ab("pattern",{width:a.width,height:a.height,id:d,patternUnits:"userSpaceOnUse"});a.appendChild(this.Ab("image",e));this.svg.appendChild(a);c[b]=d;return"url(#"+d+")"};
t.createRadialGradient=function(a,b,c,d,e,f){var g=new km("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.ca(d,h)&&K.ca(e,k)?-1===l.toLowerCase().indexOf(".svg")&&-1===l.toLowerCase().indexOf("data:image/svg")&&(a.preserveAspectRatio=
"xMidYMid slice"):a.preserveAspectRatio="none";l="";h/=d;k/=e;if(0!==f||0!==g)l+=" translate("+f+", "+g+")";if(1!==h||1!==k)l+=" scale("+h+", "+k+")";if(0!==b||0!==c)l+=" translate("+-b+", "+-c+")";if(0!==b||0!==c||d!==m||e!==n)f="CLIP"+wb++,g=this.Ab("clipPath",{id:f}),g.appendChild(this.Ab("rect",{x:b,y:c,width:d,height:e})),this.svg.appendChild(g),a["clip-path"]="url(#"+f+")";nm(this,"image",a,this.ce,l);this.addElement("image",a)};t.fill=function(){this.addPath("fill",this.path,this.ce)};
t.de=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]};nm(this,"fill",a,this.ce);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};nm(this,"fill",b,this.ce);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.ce=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.ce.copy())};
t.setTransform=function(a,b,c,d,e,f){1===a&&0===b&&0===c&&1===d&&0===e&&0===f||mm(this,a,b,c,d,e,f)};t.scale=function(a,b){this.ce.scale(a,b)};t.translate=function(a,b){this.ce.translate(a,b)};t.transform=function(){};t.stroke=function(){this.addPath("stroke",this.path,this.ce)};t.uj=function(){this.clipInsteadOfFill||this.stroke()};t.Ab=function(a,b,c){return this.Mk.Ab(a,b,c)};
t.addElement=function(a,b,c){a=this.Ab(a,b,c);0<this.Ec.length?this.Ec[this.Ec.length-1].appendChild(a):this.svg.appendChild(a);return this.Sq=a};
function nm(a,b,c,d,e){1!==a.globalAlpha&&(c.opacity=a.globalAlpha);"fill"===b?(a.fillStyle instanceof km?c.fill=om(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 km?c.stroke=om(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.Ra;d="matrix("+d[0]+", "+d[1]+", "+d[2]+", "+d[3]+", "+d[4]+", "+d[5]+")";void 0!==e&&(d+=e);c.transform=d}
function om(a,b){var c="GRAD"+wb++;if("linear"===b.type)var d=a.Ab("linearGradient",{x1:b.x1,x2:b.x2,y1:b.y1,y2:b.y2,id:c,gradientUnits:"userSpaceOnUse"});else if("radial"===b.type)d=a.Ab("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.ay;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.Ab("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=Ia(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.Wu&&(b["stroke-dasharray"]=this.zh.toString(),b["stroke-dashoffset"]=this.Ah);nm(this,a,b,c);"clipPath"===a?(a="CLIP"+wb++,c=this.Ab("clipPath",{id:a}),c.appendChild(this.Ab("path",b)),this.svg.appendChild(c),
0<this.Ec.length&&this.Ec[this.Ec.length-1].setAttributeNS(null,"clip-path","url(#"+a+")")):this.addElement("path",b)};function mm(a,b,c,d,e,f,g){var h=new jm;h.Ra=[b,c,d,e,f,g];b={};nm(a,"g",b,h);h=a.addElement("g",b);a.Ec.push(h)}
t.jr=function(){if(0!==this.shadowOffsetX||0!==this.shadowOffsetY||0!==this.shadowBlur){var a="SHADOW"+wb++,b=this.addElement("filter",{id:a,x:"-100%",y:"-100%",width:"300%",height:"300%"},null);var c=this.Ab("feGaussianBlur",{"in":"SourceAlpha",result:"blur",pB:this.shadowBlur/2});var d=this.Ab("feFlood",{"in":"blur",result:"flood","flood-color":this.shadowColor});var e=this.Ab("feComposite",{"in":"flood",in2:"blur",operator:"in",result:"comp"});var f=this.Ab("feOffset",{"in":"comp",result:"offsetBlur",
dx:this.shadowOffsetX,dy:this.shadowOffsetY});var g=this.Ab("feMerge",{});g.appendChild(this.Ab("feMergeNode",{"in":"offsetBlur"}));g.appendChild(this.Ab("feMergeNode",{"in":"SourceGraphic"}));b.appendChild(c);b.appendChild(d);b.appendChild(e);b.appendChild(f);b.appendChild(g);0<this.Ec.length&&this.Ec[this.Ec.length-1].setAttributeNS(null,"filter","url(#"+a+")")}};t.Kw=function(a,b,c){this.Zp=a;this.$p=b;this.rf=c};function Il(a){a.shadowOffsetX=0;a.shadowOffsetY=0;a.shadowBlur=0}
function Hl(a){a.shadowOffsetX=a.Zp;a.shadowOffsetY=a.$p;a.shadowBlur=a.rf}t.Ht=function(a,b){this.Wu=!0;this.zh=a;this.Ah=b};t.Ft=function(){this.Wu=!1};t.yc=function(){};t.Qy=function(){};lm.prototype.rotate=function(){};lm.prototype.getImageData=function(){return null};lm.prototype.measureText=function(){return null};lm.className="SVGContext";
Q.prototype.$t=function(a){var b=new Rj(this,qa.document);void 0===a&&(a=new jb);var c=this;return Pk(this,function(a,e){a=Qk(c,a,"SVG",b);a=null!==a?a.svg:null;return"function"===typeof e?(e(a),null):a},a)};Q.prototype.makeSvg=Q.prototype.$t;Q.prototype.jw=function(a){return this.$t(a)};Q.prototype.makeSVG=Q.prototype.jw;
N.prototype.jy=function(a,b){if(!(a instanceof lm))return!1;if(!this.visible)return!0;var c=null,d=a.Sq;if(this instanceof U&&(this.type===U.TableRow||this.type===U.TableColumn))return Fl(this,a,b),!0;var e=this.Bb;if(0===e.width||0===e.height||isNaN(e.x)||isNaN(e.y))return!0;var f=this.transform,g=this.panel;0!==(this.I&4096)===!0&&Gl(this);var h=0!==(this.I&256),k=!1;this instanceof ih&&(a.font=this.font);if(h){k=g.ke()?g.naturalBounds:g.actualBounds;if(null!==this.sd){var l=this.sd;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;mm(a,1,0,0,1,0,0);a.save();a.beginPath();a.rect(m,n,p,l);a.clip()}if(this.Kf()&&!this.isVisible())return!0;a.ce.Ra=[1,0,0,1,0,0];(this instanceof ih&&1<this.lineCount||this instanceof Yf&&1<this.geometry.figures.length)&&mm(a,1,0,0,1,0,0);m=!1;this.Kf()&&this.isShadowed&&b.Re("drawShadows")&&
(n=this.shadowOffset,a.Kw(n.x*b.scale*b.Yb,n.y*b.scale*b.Yb,this.shadowBlur),Hl(a),a.shadowColor=this.shadowColor);n=!1;this.part&&b.Re("drawShadows")&&(n=this.part.isShadowed);!0===this.shadowVisible?(Hl(a),!1===m&&n&&(mm(a,1,0,0,1,0,0),a.jr(),m=!0)):!1===this.shadowVisible&&Il(a);p=this.naturalBounds;null!==this.areaBackground&&(Ai(this,a,this.areaBackground,!0,!0,p,e),!1===m&&n&&(mm(a,1,0,0,1,0,0),a.jr(),m=!0),this.areaBackground instanceof Jl&&this.areaBackground.type===Kl?(a.beginPath(),a.rect(e.x,
e.y,e.width,e.height),a.de(this.areaBackground)):a.fillRect(e.x,e.y,e.width,e.height));this instanceof U?mm(a,f.m11,f.m12,f.m21,f.m22,f.dx,f.dy):a.ce.Ra=[f.m11,f.m12,f.m21,f.m22,f.dx,f.dy];if(null!==this.background){!1===m&&n&&(mm(a,1,0,0,1,0,0),a.jr(),m=!0);var r=this.naturalBounds;l=f=0;var q=r.width;r=r.height;var u=0;this instanceof Yf&&(r=this.geometry.bounds,f=r.x,l=r.y,q=r.width,r=r.height,u=this.strokeWidth);Ai(this,a,this.background,!0,!1,p,e);this.background instanceof Jl&&this.background.type===
Kl?(a.beginPath(),a.rect(f-u/2,l-u/2,q+u,r+u),a.de(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.I&512)||null!==g&&(g.type===U.Auto||g.type===U.Spot)&&g.yb()!==this)?(Ll(this,!0),null===this.shadowVisible&&Il(a)):Ll(this,!1);this.ej(a,b);n&&0!==(this.I&512)===!0&&Hl(a);this.Kf()&&n&&Il(a);h&&(a.restore(),k&&a.Ec.pop());this instanceof U&&(c=a.Ec.pop());!0===m&&a.Ec.pop();if(this instanceof ih&&1<this.lineCount||this instanceof
Yf&&1<this.geometry.figures.length)c=a.Ec.pop();null!==a.Mk.Eq&&(null===c&&(d===a.Sq?(mm(a,1,0,0,1,0,0),c=a.Ec.pop()):c=a.Sq),a.Mk.Eq(this,c));this.svg=c;return!0};function Rk(a,b){this.ownerDocument=b=void 0===b?qa.document:b;this.Eq=null;b=b.createElement("canvas");b.tabIndex=0;this.Ka=b;this.Ka.innerHTML="This text is displayed if your browser does not support the Canvas HTML element.";this.context=new Nl(b);b.B=a}
Rk.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};Rk.prototype.toDataURL=function(a,b){return this.Ka.toDataURL(a,b)};Rk.prototype.getBoundingClientRect=function(){return this.Ka.getBoundingClientRect()};Rk.prototype.focus=function(){this.Ka.focus()};Rk.prototype.iy=function(){this.ownerDocument=this.Ka.B=null};
ma.Object.defineProperties(Rk.prototype,{width:{configurable:!0,get:function(){return this.Ka.width},set:function(a){this.Ka.width=a}},height:{configurable:!0,get:function(){return this.Ka.height},set:function(a){this.Ka.height=a}},style:{configurable:!0,get:function(){return this.Ka.style}}});Rk.className="CanvasSurface";
function Nl(a){a.getContext&&a.getContext("2d")||v("Browser does not support HTML Canvas Element");this.aa=a.getContext("2d");this.yu=this.Au=this.zu="";this.zn=!1;this.rf=this.$p=this.Zp=0}t=Nl.prototype;t.Qy=function(a){this.aa.imageSmoothingEnabled=a};t.arc=function(a,b,c,d,e,f){this.aa.arc(a,b,c,d,e,f)};t.beginPath=function(){this.aa.beginPath()};t.bezierCurveTo=function(a,b,c,d,e,f){this.aa.bezierCurveTo(a,b,c,d,e,f)};t.clearRect=function(a,b,c,d){this.aa.clearRect(a,b,c,d)};t.clip=function(){this.aa.clip()};
t.closePath=function(){this.aa.closePath()};t.createLinearGradient=function(a,b,c,d){return this.aa.createLinearGradient(a,b,c,d)};t.createPattern=function(a,b){return this.aa.createPattern(a,b)};t.createRadialGradient=function(a,b,c,d,e,f){return this.aa.createRadialGradient(a,b,c,d,e,f)};t.drawImage=function(a,b,c,d,e,f,g,h,k){void 0===d?this.aa.drawImage(a,b,c):this.aa.drawImage(a,b,c,d,e,f,g,h,k)};t.fill=function(){this.aa.fill()};t.fillRect=function(a,b,c,d){this.aa.fillRect(a,b,c,d)};
t.fillText=function(a,b,c){this.aa.fillText(a,b,c)};t.getImageData=function(a,b,c,d){return this.aa.getImageData(a,b,c,d)};t.lineTo=function(a,b){this.aa.lineTo(a,b)};t.measureText=function(a){return this.aa.measureText(a)};t.moveTo=function(a,b){this.aa.moveTo(a,b)};t.quadraticCurveTo=function(a,b,c,d){this.aa.quadraticCurveTo(a,b,c,d)};t.rect=function(a,b,c,d){this.aa.rect(a,b,c,d)};t.restore=function(){this.aa.restore()};Nl.prototype.rotate=function(a){this.aa.rotate(a)};t=Nl.prototype;
t.save=function(){this.aa.save()};t.setTransform=function(a,b,c,d,e,f){this.aa.setTransform(a,b,c,d,e,f)};t.scale=function(a,b){this.aa.scale(a,b)};t.stroke=function(){this.aa.stroke()};t.transform=function(a,b,c,d,e,f){1===a&&0===b&&0===c&&1===d&&0===e&&0===f||this.aa.transform(a,b,c,d,e,f)};t.translate=function(a,b){this.aa.translate(a,b)};
t.de=function(a){if(a instanceof Jl&&a.type===Kl){var b=a.al;a=a.Bu;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.zn?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.zn?this.clip():this.fill()};t.uj=function(){this.zn||this.stroke()};t.Kw=function(a,b,c){this.Zp=a;this.$p=b;this.rf=c};
t.Ht=function(a,b){var c=this.aa;void 0!==c.setLineDash&&(c.setLineDash(a),c.lineDashOffset=b)};t.Ft=function(){var a=this.aa;void 0!==a.setLineDash&&(a.setLineDash(pm),a.lineDashOffset=0)};t.yc=function(a){a&&(this.zu="");this.yu=this.Au=""};
ma.Object.defineProperties(Nl.prototype,{fillStyle:{configurable:!0,get:function(){return this.aa.fillStyle},set:function(a){this.yu!==a&&(this.yu=this.aa.fillStyle=a)}},font:{configurable:!0,get:function(){return this.aa.font},set:function(a){this.zu!==a&&(this.zu=this.aa.font=a)}},globalAlpha:{configurable:!0,get:function(){return this.aa.globalAlpha},set:function(a){this.aa.globalAlpha=a}},lineCap:{configurable:!0,get:function(){return this.aa.lineCap},
set:function(a){this.aa.lineCap=a}},lineDashOffset:{configurable:!0,get:function(){return this.aa.lineDashOffset},set:function(a){this.aa.lineDashOffset=a}},lineJoin:{configurable:!0,get:function(){return this.aa.lineJoin},set:function(a){this.aa.lineJoin=a}},lineWidth:{configurable:!0,get:function(){return this.aa.lineWidth},set:function(a){this.aa.lineWidth=a}},miterLimit:{configurable:!0,get:function(){return this.aa.miterLimit},set:function(a){this.aa.miterLimit=
a}},shadowBlur:{configurable:!0,get:function(){return this.aa.shadowBlur},set:function(a){this.aa.shadowBlur=a}},shadowColor:{configurable:!0,get:function(){return this.aa.shadowColor},set:function(a){this.aa.shadowColor=a}},shadowOffsetX:{configurable:!0,get:function(){return this.aa.shadowOffsetX},set:function(a){this.aa.shadowOffsetX=a}},shadowOffsetY:{configurable:!0,get:function(){return this.aa.shadowOffsetY},set:function(a){this.aa.shadowOffsetY=
a}},strokeStyle:{configurable:!0,get:function(){return this.aa.strokeStyle},set:function(a){this.Au!==a&&(this.Au=this.aa.strokeStyle=a)}},textAlign:{configurable:!0,get:function(){return this.aa.textAlign},set:function(a){this.aa.textAlign=a}},imageSmoothingEnabled:{configurable:!0,get:function(){return this.aa.imageSmoothingEnabled},set:function(a){this.aa.imageSmoothingEnabled=a}},clipInsteadOfFill:{configurable:!0,get:function(){return this.zn},
set:function(a){this.zn=a}}});var pm=Object.freeze([]);Nl.className="CanvasSurfaceContext";function qm(){this.W=this.w=this.L=this.l=0}qm.className="ColorNumbers";
function Jl(a){F&&1<arguments.length&&v("Brush constructor can take at most one optional argument, the Brush type.");rm||(sm(),rm=!0);fb(this);this.s=!1;void 0===a?(this.ta=Ml,this.$k="black"):"string"===typeof a?(this.ta=Ml,F&&!tm(a)&&v('Color "'+a+'" is not a valid color string for Brush constructor'),this.$k=a):(F&&hb(a,Jl,Jl,"constructor:type"),this.ta=a,this.$k="black");var b=this.ta;b===Pl?(this.Ad=Ic,this.ml=Pc):this.ml=b===Kl?this.Ad=Mc:this.Ad=Gc;this.nt=0;this.$r=NaN;this.pe=this.Qs=this.oe=
null;this.Bu=this.al=0}Jl.prototype.copy=function(){var a=new Jl;a.ta=this.ta;a.$k=this.$k;a.Ad=this.Ad.J();a.ml=this.ml.J();a.nt=this.nt;a.$r=this.$r;null!==this.oe&&(a.oe=this.oe.copy());a.Qs=this.Qs;return a};t=Jl.prototype;t.freeze=function(){this.s=!0;null!==this.oe&&this.oe.freeze();return this};t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.s=!1;null!==this.oe&&this.oe.ka();return this};t.mb=function(a){a.classType===Jl?this.type=a:Ba(this,a)};
t.toString=function(){var a="Brush(";if(this.type===Ml)a+=this.color;else if(a=this.type===Pl?a+"Linear ":this.type===Kl?a+"Radial ":this.type===Ol?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&&va(this);("number"!==typeof a||!isFinite(a)||1<a||0>a)&&ya(a,"0 <= loc <= 1",Jl,"addColorStop:loc");A(b,"string",Jl,"addColorStop:color");F&&!tm(b)&&v('Color "'+b+'" is not a valid color string for Brush.addColorStop');null===this.oe&&(this.oe=new Db);this.oe.add(a,b);this.ta===Ml&&(this.type=Pl);this.pe=null;return this};
function tm(a){if("black"===a)return!0;if(""===a)return!1;F&&A(a,"string",Jl,"isValidColor");rm||(sm(),rm=!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}
t.CA=function(a,b){this.s&&va(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?vm:b;if(this.type===Ml)hi(this.color),this.color=wm(a,b);else if((this.type===Pl||this.type===Kl)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)hi(c.value),this.addColorStop(c.key,wm(a,b));return this};function xm(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?vm:c;hi(a);return wm(b,c)}
t.Cz=function(a,b){this.s&&va(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?vm:b;if(this.type===Ml)hi(this.color),this.color=wm(-a,b);else if((this.type===Pl||this.type===Kl)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)hi(c.value),this.addColorStop(c.key,wm(-a,b));return this};function ym(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?vm:c;hi(a);return wm(-b,c)}
function zm(a,b,c){hi(a);a=Am.l;var d=Am.L,e=Am.w,f=Am.W;hi(b);void 0===c&&(c=.5);return"rgba("+Math.round((Am.l-a)*c+a)+", "+Math.round((Am.L-d)*c+d)+", "+Math.round((Am.w-e)*c+e)+", "+Math.round((Am.W-f)*c+f)+")"}
t.Dy=function(){if(this.type===Ml)return Bm(this.color);if((this.type===Pl||this.type===Kl)&&null!==this.colorStops){var a=this.colorStops;if(this.type===Kl)return Bm(a.first().value);if(null!==a.get(.5))return Bm(a.get(.5));if(2===a.count)return a=a.ua(),Bm(zm(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 Bm(zm(a.get(c),a.get(d),1-f/e))}return!1};
function Bm(a){if(!a)return!1;if(a instanceof Jl)return a.Dy();hi(a);return 128>(299*Am.l+587*Am.L+114*Am.w)/1E3}
function wm(a,b){switch(b){case vm:b=100*Cm(Am.l);var c=100*Cm(Am.L),d=100*Cm(Am.w);Dm.l=.4124564*b+.3575761*c+.1804375*d;Dm.L=.2126729*b+.7151522*c+.072175*d;Dm.w=.0193339*b+.119192*c+.9503041*d;Dm.W=Am.W;b=Em(Dm.l/Fm[0]);c=Em(Dm.L/Fm[1]);d=Em(Dm.w/Fm[2]);Gm.l=116*c-16;Gm.L=500*(b-c);Gm.w=200*(c-d);Gm.W=Dm.W;Gm.l=Math.min(100,Math.max(0,Gm.l+100*a));a=(Gm.l+16)/116;b=a-Gm.w/200;Dm.l=Fm[0]*Hm(Gm.L/500+a);Dm.L=Fm[1]*(Gm.l>Im*Jm?Math.pow(a,3):Gm.l/Im);Dm.w=Fm[2]*Hm(b);Dm.W=Gm.W;a=-.969266*Dm.l+1.8760108*
Dm.L+.041556*Dm.w;b=.0556434*Dm.l+-.2040259*Dm.L+1.0572252*Dm.w;Am.l=255*Km((3.2404542*Dm.l+-1.5371385*Dm.L+-.4985314*Dm.w)/100);Am.L=255*Km(a/100);Am.w=255*Km(b/100);Am.W=Dm.W;Am.l=Math.round(Am.l);255<Am.l?Am.l=255:0>Am.l&&(Am.l=0);Am.L=Math.round(Am.L);255<Am.L?Am.L=255:0>Am.L&&(Am.L=0);Am.w=Math.round(Am.w);255<Am.w?Am.w=255:0>Am.w&&(Am.w=0);return"rgba("+Am.l+", "+Am.L+", "+Am.w+", "+Am.W+")";case Lm:return ii(),ji.w=Math.min(100,Math.max(0,ji.w+100*a)),"hsla("+ji.l+", "+ji.L+"%, "+ji.w+"%, "+
ji.W+")";default:return v("Unknown color space: "+b),"rgba(0, 0, 0, 1)"}}function hi(a){rm||(sm(),rm=!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,Am.l=a[0],Am.L=a[1],Am.w=a[2],Am.W=a[3]/255):(b.fillStyle="#FFFFFF",c=b.fillStyle,b.fillStyle=a,b.fillStyle===c&&F&&v('Color "'+a+'" is not a valid color string for RGBA color conversion'),Am.l=0,Am.L=0,Am.w=0,Am.W=1)}}
function ii(){var a=Am.l/255,b=Am.L/255,c=Am.w/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))}ji.l=Math.round(g);ji.L=Math.round(100*a);ji.w=Math.round(100*e);ji.W=Am.W}function Cm(a){a/=255;return.04045>=a?a/12.92:Math.pow((a+.055)/1.055,2.4)}function Km(a){return.0031308>=a?12.92*a:1.055*Math.pow(a,1/2.4)-.055}
function Em(a){return a>Jm?Math.pow(a,1/3):(Im*a+16)/116}function Hm(a){var b=a*a*a;return b>Jm?b:(116*a-16)/Im}function gm(a,b){"string"===typeof a?F&&!tm(a)&&v('Color "'+a+'" is not a valid color string for '+b):a instanceof Jl||v("Value for "+b+" must be a color string or a Brush, not "+a)}function sm(){um=gh?(new Rk(null)).context:null}
ma.Object.defineProperties(Jl.prototype,{type:{configurable:!0,get:function(){return this.ta},set:function(a){this.s&&va(this,a);hb(a,Jl,Jl,"type");this.ta=a;this.start.Tb()&&(a===Pl?this.start=Ic:a===Kl&&(this.start=Mc));this.end.Tb()&&(a===Pl?this.end=Pc:a===Kl&&(this.end=Mc));this.pe=null}},color:{configurable:!0,get:function(){return this.$k},set:function(a){this.s&&va(this,a);F&&!tm(a)&&v('Color "'+a+'" is not a valid color string for Brush.color');this.$k=a;this.pe=
null}},start:{configurable:!0,get:function(){return this.Ad},set:function(a){this.s&&va(this,a);x(a,M,Jl,"start");this.Ad=a.J();this.pe=null}},end:{configurable:!0,get:function(){return this.ml},set:function(a){this.s&&va(this,a);x(a,M,Jl,"end");this.ml=a.J();this.pe=null}},startRadius:{configurable:!0,get:function(){return this.nt},set:function(a){this.s&&va(this,a);C(a,Jl,"startRadius");0>a&&ya(a,">= zero",Jl,"startRadius");this.nt=a;this.pe=null}},endRadius:{configurable:!0,
enumerable:!0,get:function(){return this.$r},set:function(a){this.s&&va(this,a);C(a,Jl,"endRadius");0>a&&ya(a,">= zero",Jl,"endRadius");this.$r=a;this.pe=null}},colorStops:{configurable:!0,get:function(){return this.oe},set:function(a){this.s&&va(this,a);F&&x(a,Db,Jl,"colorStops");this.oe=a;this.pe=null}},pattern:{configurable:!0,get:function(){return this.Qs},set:function(a){this.s&&va(this,a);this.Qs=a;this.pe=null}}});Jl.prototype.isDark=Jl.prototype.Dy;
Jl.prototype.darkenBy=Jl.prototype.Cz;Jl.prototype.lightenBy=Jl.prototype.CA;Jl.prototype.addColorStop=Jl.prototype.addColorStop;var Jm=216/24389,Im=24389/27,Fm=[95.047,100,108.883],um=null,Am=new qm,ji=new qm,Dm=new qm,Gm=new qm,rm=!1;Jl.className="Brush";var Ml;Jl.Solid=Ml=new E(Jl,"Solid",0);var Pl;Jl.Linear=Pl=new E(Jl,"Linear",1);var Kl;Jl.Radial=Kl=new E(Jl,"Radial",2);var Ol;Jl.Pattern=Ol=new E(Jl,"Pattern",4);var vm;Jl.Lab=vm=new E(Jl,"Lab",5);var Lm;Jl.HSL=Lm=new E(Jl,"HSL",6);
Jl.randomColor=function(a,b){void 0===a&&(a=128);F&&(C(a,Jl,"randomColor:min"),(0>a||255<a)&&ya(a,"0 <= min <= 255",Jl,"randomColor:min"));void 0===b&&(b=Math.max(a,255));F&&(C(b,Jl,"randomColor:max"),(b<a||255<b)&&ya(b,"min <= max <= 255",Jl,"randomColor:max"));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};Jl.isValidColor=tm;Jl.lighten=function(a){return xm(a)};Jl.lightenBy=xm;Jl.darken=function(a){return ym(a)};Jl.darkenBy=ym;Jl.mix=zm;Jl.isDark=Bm;function dm(){this.name="Base"}dm.prototype.measure=function(){};dm.prototype.FA=function(a,b,c,d,e){a.measure(b,c,d,e)};dm.prototype.arrange=function(){};dm.prototype.qz=function(a,b,c,d,e,f){a.arrange(b,c,d,e,f)};dm.prototype.hc=function(){};ma.Object.defineProperties(dm.prototype,{classType:{configurable:!0,get:function(){return U}}});
dm.prototype.arrangeElement=dm.prototype.qz;dm.prototype.measureElement=dm.prototype.FA;dm.className="PanelLayout";function Mm(){this.name="Base"}la(Mm,dm);
Mm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;a=Nm(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 Yf&&l.isGeometryPositioned&&(l=l.strokeWidth/2,p-=l,r-=l);qc(e,p,r,n,m)}}};
Mm.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 Yf&&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 Om(){this.name="Base"}la(Om,dm);
Om.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;b=La();f=Nm(a);for(var k=0;k<h;k++){var l=d[k];if(l.visible||l===f){var m=Al(l,!1);if(m!==Mg&&m!==ll)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);Oa(b)};
Om.prototype.arrange=function(a,b,c){for(var d=b.length,e=a.padding,f=e.top,g=a.isOpposite,h=g?c.width:e.left,k=0;k<d;k++){var l=f,m=b[k];if(m.visible){var n=m.measuredBounds,p=m.margin,r=p.top+p.bottom,q=f+e.bottom,u=n.height,w=Al(m,!1);if(isNaN(m.desiredSize.height)&&w===Hd||w===ml)u=Math.max(c.height-r-q,0);r=u+r+q;q=m.alignment;q.Gb()&&(q=a.defaultAlignment);q.bb()||(q=Mc);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 Pm(){this.name="Base"}la(Pm,dm);
Pm.prototype.measure=function(a,b,c,d,e,f){var g=d.length;c=La();for(var h=Nm(a),k=0;k<g;k++){var l=d[k];if(l.visible||l===h){var m=Al(l,!1);if(m!==Mg&&m!==ml)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;gc(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;Oa(c)}};
Pm.prototype.arrange=function(a,b,c){for(var d=b.length,e=a.padding,f=e.left,g=a.isOpposite,h=g?c.height:e.top,k=0;k<d;k++){var l=f,m=b[k];if(m.visible){var n=m.measuredBounds,p=m.margin,r=p.left+p.right,q=f+e.right,u=n.width,w=Al(m,!1);if(isNaN(m.desiredSize.width)&&w===Hd||w===ll)u=Math.max(c.width-r-q,0);r=u+r+q;q=m.alignment;q.Gb()&&(q=a.defaultAlignment);q.bb()||(q=Mc);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 Qm(){this.name="Base"}la(Qm,dm);
Qm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.yb(),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,w=L.allocAt(-l.left,-l.top,r,q),y=!0,z=Nm(a),B=0;B<h;B++){var D=d[B];if(D!==k&&(D.visible||D===z)){l=D.margin;r=l.right+l.left;q=l.top+l.bottom;p=Al(D,!1);switch(p){case Hd:b=f;c=g;break;case ll:b=f;break;case ml:c=g}D.measure(b,c,0,0);p=D.measuredBounds;r=
Math.max(p.width+r,0);q=Math.max(p.height+q,0);var G=D.alignment;G.Gb()&&(G=a.defaultAlignment);G.bb()||(G=Mc);var O=D.alignmentFocus;O.Gb()&&(O=Mc);var V=null;D instanceof U&&""!==D.Rg&&(D.arrange(0,0,p.width,p.height),V=D.fb(D.Rg),V===D&&(V=null));if(null!==V){l=V.naturalBounds;p=V.margin;for(l=J.allocAt(O.x*l.width-O.offsetX-p.left,O.y*l.height-O.offsetY-p.top);V!==D;)V.transform.xa(l),V=V.panel;D=G.x*f+G.offsetX-l.x;p=G.y*g+G.offsetY-l.y;J.free(l)}else D=G.x*f+G.offsetX-(O.x*p.width+O.offsetX)-
l.left,p=G.y*g+G.offsetY-(O.y*p.height+O.offsetY)-l.top;y?(y=!1,e.h(D,p,r,q)):qc(e,D,p,r,q)}}y?e.assign(w):u?e.dw(w.x,w.y,w.width,w.height):qc(e,w.x,w.y,w.width,w.height);L.free(w);p=k.stretch;p===kl&&(p=Al(k,!1));switch(p){case Mg:return;case Hd:if(!isFinite(b)&&!isFinite(c))return;break;case ll:if(!isFinite(b))return;break;case ml: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;w=L.allocAt(-l.left,-l.top,r,q);for(b=0;b<h;b++)c=d[b],c===
k||!c.visible&&c!==z||(l=c.margin,r=l.right+l.left,q=l.top+l.bottom,p=c.measuredBounds,r=Math.max(p.width+r,0),q=Math.max(p.height+q,0),m=c.alignment,m.Gb()&&(m=a.defaultAlignment),m.bb()||(m=Mc),c=c.alignmentFocus,c.Gb()&&(c=Mc),y?(y=!1,e.h(m.x*f+m.offsetX-(c.x*p.width+c.offsetX)-l.left,m.y*g+m.offsetY-(c.y*p.height+c.offsetY)-l.top,r,q)):qc(e,m.x*f+m.offsetX-(c.x*p.width+c.offsetX)-l.left,m.y*g+m.offsetY-(c.y*p.height+c.offsetY)-l.top,r,q));y?e.assign(w):u?e.dw(w.x,w.y,w.width,w.height):qc(e,w.x,
w.y,w.width,w.height);L.free(w)};
Qm.prototype.arrange=function(a,b,c){var d=b.length,e=a.yb(),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.Gb()&&(m=a.defaultAlignment);m.bb()||(m=Mc);var u=p.alignmentFocus;u.Gb()&&(u=Mc);l=null;p instanceof U&&""!==p.Rg&&(l=p.fb(p.Rg),l===p&&(l=null));if(null!==l){var w=l.naturalBounds;for(u=J.allocAt(u.x*w.width-u.offsetX,u.y*w.height-
u.offsetY);l!==p;)l.transform.xa(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 Rm(){this.name="Base"}la(Rm,dm);
Rm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.yb(),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 Yf&&(u=k,q=u.strokeWidth*u.scale);var w=Math.max(l.width+p,0);l=Math.max(l.height+r,0);var y=Sm(k),z=y.x*w+y.offsetX;y=y.y*l+y.offsetY;var B=Tm(k),D=B.x*w+B.offsetX;B=B.y*l+B.offsetY;isFinite(b)&&(m=Math.max(Math.abs(z-D)-q,0));isFinite(c)&&(n=Math.max(Math.abs(y-B)-q,0));q=Hb.alloc();q.h(0,0);a=Nm(a);for(B=0;B<
h;B++)y=d[B],y===k||!y.visible&&y!==a||(l=y.margin,w=l.right+l.left,z=l.top+l.bottom,y.measure(m,n,0,0),l=y.measuredBounds,w=Math.max(l.width+w,0),l=Math.max(l.height+z,0),q.h(Math.max(w,q.width),Math.max(l,q.height)));if(1===h)e.width=w,e.height=l,Hb.free(q);else{y=Sm(k);B=Tm(k);h=d=0;B.x!==y.x&&B.y!==y.y&&(d=q.width/Math.abs(B.x-y.x),h=q.height/Math.abs(B.y-y.y));Hb.free(q);q=0;null!==u&&(q=u.strokeWidth*u.scale,Ng(u)===Og&&(d=h=Math.max(d,h)));d+=Math.abs(y.offsetX)+Math.abs(B.offsetX)+q;h+=Math.abs(y.offsetY)+
Math.abs(B.offsetY)+q;u=k.stretch;u===kl&&(u=Al(k,!1));switch(u){case Mg:g=f=0;break;case Hd:isFinite(b)&&(d=b);isFinite(c)&&(h=c);break;case ll:isFinite(b)&&(d=b);g=0;break;case ml:f=0,isFinite(c)&&(h=c)}k.Fm();k.measure(d,h,f,g);e.width=k.measuredBounds.width+p;e.height=k.measuredBounds.height+r}};
Rm.prototype.arrange=function(a,b){var c=b.length,d=a.yb(),e=d.measuredBounds,f=L.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=Sm(d),n=Tm(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;qc(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.Gb()&&(p=a.defaultAlignment),p.bb()||(p=Mc),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&&(rc(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 L(f.x,f.y,f.width,f.height))));L.free(f)};function Um(){this.name="Base";this.name="Table"}la(Um,dm);
Um.prototype.measure=function(a,b,c,d,e,f,g){for(var h=d.length,k=La(),l=La(),m=0;m<h;m++){var n=d[m],p=n instanceof U?n:null;if(null===p||p.type!==U.TableRow&&p.type!==U.TableColumn||!n.visible)k.push(n);else{F&&(p.desiredSize.o()&&v(p.toString()+" TableRow/TableColumn Panels cannot set a desiredSize: "+p.desiredSize.toString()),p.minSize.A(Wb)||v(p.toString()+" TableRow/TableColumn Panels cannot set a minSize: "+p.minSize.toString()),p.maxSize.A(bc)||v(p.toString()+" TableRow/TableColumn Panels cannot set a maxSize: "+
p.maxSize.toString()));l.push(p);for(var r=p.$.j,q=r.length,u=0;u<q;u++){var w=r[u];p.type===U.TableRow?w.row=n.row:p.type===U.TableColumn&&(w.column=n.column);k.push(w)}}}h=k.length;0===h&&(a.getRowDefinition(0),a.getColumnDefinition(0));for(var y=[],z=0;z<h;z++){var B=k[z];Cj(B,!0);Bl(B,!0);y[B.row]||(y[B.row]=[]);y[B.row][B.column]||(y[B.row][B.column]=[]);y[B.row][B.column].push(B)}Oa(k);var D=La(),G=La(),O=La(),V={count:0},P={count:0},ca=b,Y=c,oa=a.xb;h=oa.length;for(var Da=0;Da<h;Da++){var X=
oa[Da];void 0!==X&&(X.actual=0)}oa=a.tb;h=oa.length;for(var Ma=0;Ma<h;Ma++)X=oa[Ma],void 0!==X&&(X.actual=0);for(var Va=y.length,xb=0,Ta=0;Ta<Va;Ta++)y[Ta]&&(xb=Math.max(xb,y[Ta].length));var Ob=Math.min(a.topIndex,Va-1),Nd=Math.min(a.leftIndex,xb-1),yb=0;Va=y.length;for(var oc=Nm(a),pb=0;pb<Va;pb++)if(y[pb]){xb=y[pb].length;for(var $d=a.getRowDefinition(pb),Kc=$d.actual=0;Kc<xb;Kc++)if(y[pb][Kc]){var Nf=a.getColumnDefinition(Kc);void 0===D[Kc]&&(Nf.actual=0,D[Kc]=!0);for(var of=y[pb][Kc],Ve=of.length,
Hh=0;Hh<Ve;Hh++){var Qc=of[Hh];if(Qc.visible||Qc===oc){var Of=1<Qc.rowSpan||1<Qc.columnSpan;Of&&(pb<Ob||Kc<Nd||G.push(Qc));var pf=Qc.margin,ae=pf.right+pf.left,ok=pf.top+pf.bottom;var Yb=Tl(Qc,$d,Nf,!1);var Pf=Qc.desiredSize,Od=!isNaN(Pf.height),Ac=!isNaN(Pf.width)&&Od;Of||Yb===Mg||Ac||pb<Ob||Kc<Nd||(void 0!==V[Kc]||Yb!==Hd&&Yb!==ll||(V[Kc]=-1,V.count++),void 0!==P[pb]||Yb!==Hd&&Yb!==ml||(P[pb]=-1,P.count++),O.push(Qc));Qc.measure(Infinity,Infinity,0,0);if(!(pb<Ob||Kc<Nd)){var qf=Qc.measuredBounds,
hd=Math.max(qf.width+ae,0),wg=Math.max(qf.height+ok,0);if(1===Qc.rowSpan&&(Yb===Mg||Yb===ll)){X=a.getRowDefinition(pb);var Ih=X.Ac();yb=Math.max(wg-X.actual,0);yb+Ih>Y&&(yb=Math.max(Y-Ih,0));var Ln=0===X.actual;X.actual=X.actual+yb;Y=Math.max(Y-(yb+(Ln?Ih:0)),0)}if(1===Qc.columnSpan&&(Yb===Mg||Yb===ml)){X=a.getColumnDefinition(Kc);var xg=X.Ac();yb=Math.max(hd-X.actual,0);yb+xg>ca&&(yb=Math.max(ca-xg,0));var pk=0===X.actual;X.actual=X.actual+yb;ca=Math.max(ca-(yb+(pk?xg:0)),0)}Of&&Qc.Fm()}}}}}Oa(D);
var pc=0,$c=0;h=a.columnCount;for(var tc=0;tc<h;tc++){var yg=a.tb[tc];void 0!==yg&&(pc+=yg.na,0!==yg.na&&(pc+=yg.Ac()))}h=a.rowCount;for(var Jh=0;Jh<h;Jh++){var rf=a.xb[Jh];void 0!==rf&&($c+=rf.na,0!==rf.na&&($c+=rf.Ac()))}ca=Math.max(b-pc,0);var Si=Y=Math.max(c-$c,0),xe=ca;h=O.length;for(var We=0;We<h;We++){var Bc=O[We],qk=a.getRowDefinition(Bc.row),Mn=a.getColumnDefinition(Bc.column),zg=Bc.measuredBounds,Pb=Bc.margin,Ag=Pb.right+Pb.left,rk=Pb.top+Pb.bottom;V[Bc.column]=0===Mn.actual&&void 0!==V[Bc.column]?
Math.max(zg.width+Ag,V[Bc.column]):null;P[Bc.row]=0===qk.actual&&void 0!==P[Bc.row]?Math.max(zg.height+rk,P[Bc.row]):null}var Ti=0,Bg=0,Qf;for(Qf in P)"count"!==Qf&&(Ti+=P[Qf]);for(Qf in V)"count"!==Qf&&(Bg+=V[Qf]);for(var qb=Hb.alloc(),Cg=0;Cg<h;Cg++){var Cc=O[Cg];if(Cc.visible||Cc===oc){var Rc=a.getRowDefinition(Cc.row),rb=a.getColumnDefinition(Cc.column),Pd=0;isFinite(rb.width)?Pd=rb.width:(isFinite(ca)&&null!==V[Cc.column]?0===Bg?Pd=rb.actual+ca:Pd=V[Cc.column]/Bg*xe:null!==V[Cc.column]?Pd=ca:
Pd=rb.actual||ca,Pd=Math.max(0,Pd-rb.Ac()));var Qd=0;isFinite(Rc.height)?Qd=Rc.height:(isFinite(Y)&&null!==P[Cc.row]?0===Ti?Qd=Rc.actual+Y:Qd=P[Cc.row]/Ti*Si:null!==P[Cc.row]?Qd=Y:Qd=Rc.actual||Y,Qd=Math.max(0,Qd-Rc.Ac()));qb.h(Math.max(rb.minimum,Math.min(Pd,rb.maximum)),Math.max(Rc.minimum,Math.min(Qd,Rc.maximum)));Yb=Tl(Cc,Rc,rb,!1);switch(Yb){case ll:qb.height=Math.max(qb.height,Rc.actual+Y);break;case ml:qb.width=Math.max(qb.width,rb.actual+ca)}var be=Cc.margin,Nn=be.right+be.left,Kh=be.top+
be.bottom;Cc.Fm();Cc.measure(qb.width,qb.height,rb.minimum,Rc.minimum);var Lh=Cc.measuredBounds,Mh=Math.max(Lh.width+Nn,0),Nh=Math.max(Lh.height+Kh,0);isFinite(ca)&&(Mh=Math.min(Mh,qb.width));isFinite(Y)&&(Nh=Math.min(Nh,qb.height));var Dg=0;Dg=Rc.actual;Rc.actual=Math.max(Rc.actual,Nh);yb=Rc.actual-Dg;Y=Math.max(Y-yb,0);Dg=rb.actual;rb.actual=Math.max(rb.actual,Mh);yb=rb.actual-Dg;ca=Math.max(ca-yb,0)}}Oa(O);var Rd=Hb.alloc(),id=La(),ye=La();h=G.length;if(0!==h)for(var Qb=0;Qb<Va;Qb++)if(y[Qb]){xb=
y[Qb].length;var Ui=a.getRowDefinition(Qb);id[Qb]=Ui.actual;for(var jd=0;jd<xb;jd++)if(y[Qb][jd]){var On=a.getColumnDefinition(jd);ye[jd]=On.actual}}for(var ze=0;ze<h;ze++){var ab=G[ze];if(ab.visible||ab===oc){var Sd=a.getRowDefinition(ab.row),Dc=a.getColumnDefinition(ab.column);qb.h(Math.max(Dc.minimum,Math.min(b,Dc.maximum)),Math.max(Sd.minimum,Math.min(c,Sd.maximum)));Yb=Tl(ab,Sd,Dc,!1);switch(Yb){case Hd:0!==ye[Dc.index]&&(qb.width=Math.min(qb.width,ye[Dc.index]));0!==id[Sd.index]&&(qb.height=
Math.min(qb.height,id[Sd.index]));break;case ll:0!==ye[Dc.index]&&(qb.width=Math.min(qb.width,ye[Dc.index]));break;case ml:0!==id[Sd.index]&&(qb.height=Math.min(qb.height,id[Sd.index]))}isFinite(Dc.width)&&(qb.width=Dc.width);isFinite(Sd.height)&&(qb.height=Sd.height);Rd.h(0,0);for(var Ae=1;Ae<ab.rowSpan&&!(ab.row+Ae>=a.rowCount);Ae++)X=a.getRowDefinition(ab.row+Ae),yb=0,yb=Yb===Hd||Yb===ml?Math.max(X.minimum,0===id[ab.row+Ae]?X.maximum:Math.min(id[ab.row+Ae],X.maximum)):Math.max(X.minimum,isNaN(X.Xc)?
X.maximum:Math.min(X.Xc,X.maximum)),Rd.height+=yb;for(var Be=1;Be<ab.columnSpan&&!(ab.column+Be>=a.columnCount);Be++)X=a.getColumnDefinition(ab.column+Be),yb=0,yb=Yb===Hd||Yb===ll?Math.max(X.minimum,0===ye[ab.column+Be]?X.maximum:Math.min(ye[ab.column+Be],X.maximum)):Math.max(X.minimum,isNaN(X.Xc)?X.maximum:Math.min(X.Xc,X.maximum)),Rd.width+=yb;qb.width+=Rd.width;qb.height+=Rd.height;var Oh=ab.margin,Ph=Oh.right+Oh.left,ce=Oh.top+Oh.bottom;ab.measure(qb.width,qb.height,f,g);for(var Ce=ab.measuredBounds,
Xe=Math.max(Ce.width+Ph,0),Ye=Math.max(Ce.height+ce,0),De=0,Bd=0;Bd<ab.rowSpan&&!(ab.row+Bd>=a.rowCount);Bd++)X=a.getRowDefinition(ab.row+Bd),De+=X.total||0;if(De<Ye){var Rf=Ye-De,Eg=Ye-De;if(null!==ab.spanAllocation)for(var Pn=ab.spanAllocation,Qh=0;Qh<ab.rowSpan&&!(0>=Rf)&&!(ab.row+Qh>=a.rowCount);Qh++){X=a.getRowDefinition(ab.row+Qh);var Td=X.na||0,Fg=Pn(ab,X,Eg);F&&"number"!==typeof Fg&&v(ab+" spanAllocation does not return a number: "+Fg);X.actual=Math.min(X.maximum,Td+Fg);X.na!==Td&&(Rf-=X.na-
Td)}for(;0<Rf;){var Rh=X.na||0;isNaN(X.height)&&X.maximum>Rh&&(X.actual=Math.min(X.maximum,Rh+Rf),X.na!==Rh&&(Rf-=X.na-Rh));if(0===X.index)break;X=a.getRowDefinition(X.index-1)}}for(var Sh=0,sk=0;sk<ab.columnSpan&&!(ab.column+sk>=a.columnCount);sk++)X=a.getColumnDefinition(ab.column+sk),Sh+=X.total||0;if(Sh<Xe){var Vi=Xe-Sh,fu=Xe-Sh;if(null!==ab.spanAllocation)for(var gu=ab.spanAllocation,tk=0;tk<ab.columnSpan&&!(0>=Vi)&&!(ab.column+tk>=a.columnCount);tk++){X=a.getColumnDefinition(ab.column+tk);var Qn=
X.na||0,Rn=gu(ab,X,fu);F&&"number"!==typeof Rn&&v(ab+" spanAllocation does not return a number: "+Rn);X.actual=Math.min(X.maximum,Qn+Rn);X.na!==Qn&&(Vi-=X.na-Qn)}for(;0<Vi;){var uk=X.na||0;isNaN(X.width)&&X.maximum>uk&&(X.actual=Math.min(X.maximum,uk+Vi),X.na!==uk&&(Vi-=X.na-uk));if(0===X.index)break;X=a.getColumnDefinition(X.index-1)}}}}Oa(G);Hb.free(Rd);Hb.free(qb);void 0!==id&&Oa(id);void 0!==ye&&Oa(ye);var Gg=0,Hg=0,vk=a.desiredSize,zr=a.maxSize;Yb=Al(a,!0);var Wi=$c=pc=0,Xi=0;h=a.columnCount;
for(var wk=0;wk<h;wk++)void 0!==a.tb[wk]&&(X=a.getColumnDefinition(wk),isFinite(X.width)?(Wi+=X.width,Wi+=X.Ac()):Vm(X)===Wm?(Wi+=X.na,Wi+=X.Ac()):0!==X.na&&(pc+=X.na,pc+=X.Ac()));isFinite(vk.width)?Gg=Math.min(vk.width,zr.width):Gg=Yb!==Mg&&isFinite(b)?b:pc;Gg=Math.max(Gg,a.minSize.width);Gg=Math.max(Gg-Wi,0);for(var hu=0===pc?1:Math.max(Gg/pc,1),yk=0;yk<h;yk++)void 0!==a.tb[yk]&&(X=a.getColumnDefinition(yk),isFinite(X.width)||Vm(X)===Wm||(X.actual=X.na*hu),X.position=e.width,0!==X.na&&(e.width+=
X.na,e.width+=X.Ac()));h=a.rowCount;for(var zk=0;zk<h;zk++)void 0!==a.xb[zk]&&(X=a.getRowDefinition(zk),isFinite(X.height)?(Xi+=X.height,Xi+=X.Ac()):Vm(X)===Wm?(Xi+=X.na,Xi+=X.Ac()):0!==X.na&&($c+=X.na,0!==X.na&&($c+=X.Ac())));isFinite(vk.height)?Hg=Math.min(vk.height,zr.height):Hg=Yb!==Mg&&isFinite(c)?c:$c;Hg=Math.max(Hg,a.minSize.height);Hg=Math.max(Hg-Xi,0);for(var iu=0===$c?1:Math.max(Hg/$c,1),Ak=0;Ak<h;Ak++)void 0!==a.xb[Ak]&&(X=a.getRowDefinition(Ak),isFinite(X.height)||Vm(X)===Wm||(X.actual=
X.na*iu),X.position=e.height,0!==X.na&&(e.height+=X.na,0!==X.na&&(e.height+=X.Ac())));h=l.length;for(var Sn=0;Sn<h;Sn++){var Cd=l[Sn],Tn=0,Un=0;Cd.type===U.TableRow?(Tn=e.width,X=a.getRowDefinition(Cd.row),Un=X.actual):(X=a.getColumnDefinition(Cd.column),Tn=X.actual,Un=e.height);Cd.measuredBounds.h(0,0,Tn,Un);Cj(Cd,!1);y[Cd.row]||(y[Cd.row]=[]);y[Cd.row][Cd.column]||(y[Cd.row][Cd.column]=[]);y[Cd.row][Cd.column].push(Cd)}Oa(l);a.Mp=y};
Um.prototype.arrange=function(a,b,c){var d=b.length,e=a.padding,f=e.left;e=e.top;for(var g=a.Mp,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.xb[n]||0===a.xb[n].na);)n++;n=Math.min(n,l-1);n=-a.xb[n].position;for(h=Math.min(a.leftIndex,m-1);h!==m&&(void 0===a.tb[h]||0===a.tb[h].na);)h++;h=Math.min(h,m-1);for(var p=-a.tb[h].position,r=Hb.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.na&&
(k+=u.Jv());for(var w=0;w<m;w++)if(g[q][w]){var y=a.getColumnDefinition(w);h=y.position+p+f;0!==y.na&&(h+=y.Jv());for(var z=g[q][w],B=z.length,D=0;D<B;D++){var G=z[D],O=G.measuredBounds,V=G instanceof U?G:null;if(null===V||V.type!==U.TableRow&&V.type!==U.TableColumn){r.h(0,0);for(var P=1;P<G.rowSpan&&!(q+P>=a.rowCount);P++)V=a.getRowDefinition(q+P),r.height+=V.total;for(P=1;P<G.columnSpan&&!(w+P>=a.columnCount);P++)V=a.getColumnDefinition(w+P),r.width+=V.total;var ca=y.na+r.width,Y=u.na+r.height;
P=h;V=k;var oa=ca,Da=Y,X=h,Ma=k,Va=ca,xb=Y;h+ca>c.width&&(Va=Math.max(c.width-h,0));k+Y>c.height&&(xb=Math.max(c.height-k,0));var Ta=G.alignment;if(Ta.Gb()){Ta=a.defaultAlignment;Ta.bb()||(Ta=Mc);var Ob=Ta.x;var Nd=Ta.y;var yb=Ta.offsetX;Ta=Ta.offsetY;var oc=y.alignment,pb=u.alignment;oc.bb()&&(Ob=oc.x,yb=oc.offsetX);pb.bb()&&(Nd=pb.y,Ta=pb.offsetY)}else Ob=Ta.x,Nd=Ta.y,yb=Ta.offsetX,Ta=Ta.offsetY;if(isNaN(Ob)||isNaN(Nd))Nd=Ob=.5,Ta=yb=0;oc=O.width;pb=O.height;var $d=G.margin,Kc=$d.left+$d.right,
Nf=$d.top+$d.bottom,of=Tl(G,u,y,!1);!isNaN(G.desiredSize.width)||of!==Hd&&of!==ll||(oc=Math.max(ca-Kc,0));!isNaN(G.desiredSize.height)||of!==Hd&&of!==ml||(pb=Math.max(Y-Nf,0));ca=G.maxSize;Y=G.minSize;oc=Math.min(ca.width,oc);pb=Math.min(ca.height,pb);oc=Math.max(Y.width,oc);pb=Math.max(Y.height,pb);ca=pb+Nf;P+=oa*Ob-(oc+Kc)*Ob+yb+$d.left;V+=Da*Nd-ca*Nd+Ta+$d.top;G.visible&&(rc(X,Ma,Va,xb,P,V,O.width,O.height)?G.arrange(P,V,oc,pb):G.arrange(P,V,oc,pb,new L(X,Ma,Va,xb)))}else G.Bl(),G.actualBounds.ka(),
oa=G.actualBounds,P=L.allocAt(oa.x,oa.y,oa.width,oa.height),oa.x=V.type===U.TableRow?f:h,oa.y=V.type===U.TableColumn?e:k,oa.width=O.width,oa.height=O.height,G.actualBounds.freeze(),Bl(G,!1),jc(P,oa)||(O=G.part,null!==O&&(O.Th(),G.np(O))),L.free(P)}}}Hb.free(r);for(a=0;a<d;a++)c=b[a],f=c instanceof U?c:null,null===f||f.type!==U.TableRow&&f.type!==U.TableColumn||(f=c.actualBounds,c.naturalBounds.ka(),c.naturalBounds.h(0,0,f.width,f.height),c.naturalBounds.freeze())};function Xm(){this.name="Base"}
la(Xm,dm);Xm.prototype.measure=function(){};Xm.prototype.arrange=function(){};function Ym(){this.name="Base"}la(Ym,dm);Ym.prototype.measure=function(){};Ym.prototype.arrange=function(){};function Zm(){this.name="Base"}la(Zm,dm);
Zm.prototype.measure=function(a,b,c,d,e,f,g){1<d.length&&v("Viewbox Panel cannot contain more than one GraphObject.");d=d[0];d.Fa=1;d.Fm();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===Og?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.Fa*=q;m!==d.scale&&(Cj(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)};Zm.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.Gb()&&(g=a.defaultAlignment);g.bb()||(g=Mc);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 $m(){this.name="Base"}la($m,dm);$m.prototype.measure=function(){};
$m.prototype.arrange=function(){};
$m.prototype.hc=function(a,b,c){c=a.Gf()*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.$.j,q=r.length,u=0;u<q;u++){var w=r[u],y=[];p.push(y);if(w.visible){var z=w.interval;if(!(0>z)){w=kk(w.figure);for(var B=0;B<q;B++)if(B!==u){var D=r[B];D.visible&&kk(D.figure)===w&&(D=D.interval,D>z&&y.push(D))}}}}r=a.$.j;q=
r.length;for(u=0;u<q;u++){var G=r[u];if(G.visible&&(y=G.interval,!(2>e*Math.abs(y)*c))){z=G.opacity;w=1;if(1!==z){if(0===z)continue;w=b.globalAlpha;b.globalAlpha=w*z}B=p[u];D=!1;var O=G.strokeDashArray;null!==O&&(D=!0,b.Ht(O,G.strokeDashOffset));if("LineV"===G.figure&&null!==G.stroke&&0<G.strokeWidth){b.lineWidth=G.strokeWidth;Ai(a,b,G.stroke,!1,!1,f,g);b.beginPath();for(O=G=Math.floor(-n.x/e);O<=G+l;O++){var V=O*e+n.x;0<=V&&V<=h&&an(O,y,B)&&(b.moveTo(V,0),b.lineTo(V,k))}b.stroke()}else if("LineH"===
G.figure&&null!==G.stroke&&0<G.strokeWidth){b.lineWidth=G.strokeWidth;Ai(a,b,G.stroke,!1,!1,f,g);b.beginPath();for(O=G=Math.floor(-n.y/d);O<=G+m;O++)V=O*d+n.y,0<=V&&V<=k&&an(O,y,B)&&(b.moveTo(0,V),b.lineTo(h,V));b.stroke()}else if("BarV"===G.figure&&null!==G.fill)for(Ai(a,b,G.fill,!0,!1,f,g),G=G.width,isNaN(G)&&(G=e),V=O=Math.floor(-n.x/e);V<=O+l;V++){var P=V*e+n.x;0<=P&&P<=h&&an(V,y,B)&&b.fillRect(P,0,G,k)}else if("BarH"===G.figure&&null!==G.fill)for(Ai(a,b,G.fill,!0,!1,f,g),G=G.height,isNaN(G)&&
(G=d),V=O=Math.floor(-n.y/d);V<=O+m;V++)P=V*d+n.y,0<=P&&P<=k&&an(V,y,B)&&b.fillRect(0,P,h,G);D&&b.Ft();1!==z&&(b.globalAlpha=w)}}b.restore();b.yc(!1)};function an(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 bn(){this.name="Base"}la(bn,dm);
bn.prototype.measure=function(a,b,c,d,e){c=d.length;if(a instanceof Te||a instanceof R){var f=null,g=null,h=null;a instanceof R&&(g=f=a);a instanceof Te&&(h=a,f=h.adornedPart);if(f instanceof R){var k=f;if(0===c)gc(a.naturalBounds,0,0),a.measuredBounds.h(0,0,0,0);else{var l=a instanceof Te?null:f.path,m=f.routeBounds;b=a.Eg;b.h(0,0,m.width,m.height);var n=k.points;f=f.pointsCount;null!==h?h.Ck(!1):null!==g&&g.Ck(!1);var p=m.width,r=m.height;a.location.h(m.x,m.y);a.l.length=0;null!==l&&(cn(a,p,r,l),
h=l.measuredBounds,b.Pc(h),a.l.push(h));h=Ib.alloc();for(var q=J.alloc(),u=J.alloc(),w=0;w<c;w++){var y=d[w];if(y!==l)if(y.isPanelMain&&y instanceof Yf){cn(a,p,r,y);var z=y.measuredBounds;b.Pc(z);a.l.push(z)}else if(2>f)y.measure(Infinity,Infinity,0,0),z=y.measuredBounds,b.Pc(z),a.l.push(z);else{var B=y.segmentIndex,D=y.segmentFraction,G=y.alignmentFocus;G.Tb()&&(G=Mc);var O=y.segmentOrientation,V=y.segmentOffset;if(isNaN(B)){var P=k.qa;z=La();P.$v(D,z);var ca=J.allocAt(z[0],z[1]);ca.add(k.i(0));
P.type===Id?ca.offset(-P.startX,-P.startY):(P=P.figures.first(),ca.offset(-P.startX,-P.startY));P=z[2];if(O!==og){var Y=k.computeAngle(y,O,P);y.dc=Y}Y=ca.x-m.x;var oa=ca.y-m.y;J.free(ca);Oa(z)}else if(B<-f||B>=f)oa=k.midPoint,P=k.midAngle,O!==og&&(Y=k.computeAngle(y,O,P),y.dc=Y),Y=oa.x-m.x,oa=oa.y-m.y;else{Y=0;0<=B?(oa=n.O(B),z=B<f-1?n.O(B+1):oa):(Y=f+B,oa=n.O(Y),z=0<Y?n.O(Y-1):oa);if(oa.Sa(z)){0<=B?(P=0<B?n.O(B-1):oa,Y=B<f-2?n.O(B+2):z):(P=Y<f-1?n.O(Y+1):oa,Y=1<Y?n.O(Y-2):z);ca=P.Qe(oa);var Da=z.Qe(Y);
P=ca>Da+10?0<=B?P.Xa(oa):oa.Xa(P):Da>ca+10?0<=B?z.Xa(Y):Y.Xa(z):0<=B?P.Xa(Y):Y.Xa(P)}else P=0<=B?oa.Xa(z):z.Xa(oa);O!==og&&(Y=k.computeAngle(y,O,P),y.dc=Y);Y=oa.x+(z.x-oa.x)*D-m.x;oa=oa.y+(z.y-oa.y)*D-m.y}y.measure(Infinity,Infinity,0,0);z=y.measuredBounds;ca=y.naturalBounds;var X=0;y instanceof Yf&&(X=y.strokeWidth);Da=ca.width+X;var Ma=ca.height+X;h.reset();h.translate(-z.x,-z.y);h.scale(y.scale,y.scale);h.rotate(O===og?y.angle:P,Da/2,Ma/2);O!==dn&&O!==en||h.rotate(90,Da/2,Ma/2);O!==fn&&O!==gn||
h.rotate(-90,Da/2,Ma/2);O===hn&&(45<P&&135>P||225<P&&315>P)&&h.rotate(-P,Da/2,Ma/2);ca=new L(0,0,Da,Ma);q.sj(ca,G);h.xa(q);G=-q.x+X/2*y.scale;y=-q.y+X/2*y.scale;u.assign(V);X=isNaN(V.x);var Va=isNaN(V.y);if(X||Va){Da=Da/2+3;Ma=Ma/2+3;var xb=45<=P&&135>=P,Ta=225<=P&&315>=P;O===og&&(xb||Ta)?(u.x=Va?Da:V.y,u.y=X?Ma:V.x,xb?0<=B||isNaN(B)&&.5>D||!X||(u.y=-Ma):Ta&&((0<=B||isNaN(B)&&.5>D)&&X&&(u.y=-Ma),Va&&(u.x=-Da))):(X&&(u.x=0<=B||isNaN(B)&&.5>D?Da:-Da),Va&&(u.y=-Ma),u.rotate(P))}else u.rotate(P);Y+=u.x;
oa+=u.y;ca.set(z);ca.h(Y+G,oa+y,z.width,z.height);a.l.push(ca);b.Pc(ca)}}if(null!==g)for(d=g.labelNodes;d.next();)d.value.measure(Infinity,Infinity);a.Eg=b;a=a.location;a.h(a.x+b.x,a.y+b.y);gc(e,b.width||0,b.height||0);Ib.free(h);J.free(q);J.free(u)}}}};
bn.prototype.arrange=function(a,b){var c=b.length;if(a instanceof Te||a instanceof R){var d=null,e=null,f=null;a instanceof R&&(e=d=a);a instanceof Te&&(f=a,d=f.adornedPart);var g=a instanceof Te?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.Eg.x,l.y-a.Eg.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.Eg.x,n.y-a.Eg.y,n.width,n.height)}}}b=d.points;c=b.count;if(2<=c&&a instanceof R)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.qa;var q=La();n.$v(k,q);var u=J.allocAt(q[0],q[1]);u.add(p.i(0));n.type===Id?u.offset(-n.startX,-n.startY):(n=n.figures.first(),u.offset(-n.startX,-n.startY));n=q[2];l!==og&&(p=p.computeAngle(g,l,n),g.angle=p);p=u.x;var w=u.y;J.free(u);Oa(q)}else if(h<-c||h>=c)w=p.midPoint,n=p.midAngle,l!==og&&(p=p.computeAngle(g,l,n),g.angle=p),p=w.x,w=w.y;
else{u=0;0<=h?(q=b.j[h],w=h<c-1?b.j[h+1]:q):(u=c+h,q=b.j[u],w=0<u?b.j[u-1]:q);if(q.Sa(w)){0<=h?(n=0<h?b.j[h-1]:q,u=h<c-2?b.j[h+2]:w):(n=u<c-1?b.j[u+1]:q,u=1<u?b.j[u-2]:w);var y=n.Qe(q),z=w.Qe(u);n=y>z+10?0<=h?n.Xa(q):q.Xa(n):z>y+10?0<=h?w.Xa(u):u.Xa(w):0<=h?n.Xa(u):u.Xa(n)}else n=0<=h?q.Xa(w):w.Xa(q);l!==og&&(p=p.computeAngle(g,l,n),g.angle=p);p=q.x+(w.x-q.x)*k;w=q.y+(w.y-q.y)*k}if(r.Rq())g.location=new J(p,w);else{r.Tb()&&(r=Mc);q=Ib.alloc();q.reset();q.scale(g.scale,g.scale);q.rotate(g.angle,0,
0);var B=g.naturalBounds;u=L.allocAt(0,0,B.width,B.height);y=J.alloc();y.sj(u,r);q.xa(y);r=-y.x;z=-y.y;var D=B.width,G=B.height;B=J.alloc();B.assign(m);var O=isNaN(m.x),V=isNaN(m.y);if(O||V){D=D/2+3;G=G/2+3;var P=45<=n&&135>=n,ca=225<=n&&315>=n;l===og&&(P||ca)?(B.x=V?D:m.y,B.y=O?G:m.x,P?0<=h||isNaN(h)&&.5>k||!O||(B.y=-G):ca&&((0<=h||isNaN(h)&&.5>k)&&O&&(B.y=-G),V&&(B.x=-D))):(O&&(B.x=0<=h||isNaN(h)&&.5>k?D:-D),V&&(B.y=-G),B.rotate(n))}else B.rotate(n);p+=B.x;w+=B.y;q.Rw(u);r+=u.x;z+=u.y;h=J.allocAt(p+
r,w+z);g.move(h);J.free(h);J.free(B);J.free(y);L.free(u);Ib.free(q)}}null!==f?f.Ck(!1):null!==e&&e.Ck(!1)}};
function cn(a,b,c,d){if(!1!==Hj(d)){var e=d.strokeWidth;0===e&&a instanceof Te&&a.type===U.Link&&a.adornedObject instanceof Yf&&(e=a.adornedObject.strokeWidth);e*=d.Fa;a instanceof R&&null!==a.qa?(a=a.qa.bounds,xl(d,a.x-e/2,a.y-e/2,a.width+e,a.height+e)):a instanceof Te&&null!==a.adornedPart.qa?(a=a.adornedPart.qa.bounds,xl(d,a.x-e/2,a.y-e/2,a.width+e,a.height+e)):xl(d,-(e/2),-(e/2),b+e,c+e);Cj(d,!1)}}function jn(){this.name="Base"}la(jn,dm);
jn.prototype.measure=function(a,b,c,d,e,f,g){var h=a.yb();a.ih=[];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 L(-k.left,-k.top,Math.max(n.width+l,0),Math.max(n.height+m,0));a.ih.push(p);e.assign(p);for(var r=h.geometry,q=h.strokeWidth,u=r.flattenedSegments,w=r.flattenedLengths,y=r.flattenedTotalLength,z=u.length,B=0,D=0,G=La(),O=0;O<z;O++){var V=u[O],P=[];D=B=0;for(var ca=V.length,Y=0;Y<ca;Y+=2){var oa=V[Y],Da=V[Y+1];if(0!==Y){var X=180*Math.atan2(Da-
D,oa-B)/Math.PI;0>X&&(X+=360);P.push(X)}B=oa;D=Da}G.push(P)}if(null===a.jh){for(var Ma=[],Va=a.$.j,xb=Va.length,Ta=0;Ta<xb;Ta++){var Ob=Va[Ta],Nd=[];Ma.push(Nd);if(Ob.visible){var yb=Ob.interval;if(!(0>yb))for(var oc=0;oc<xb;oc++)if(oc!==Ta){var pb=Va[oc];if(pb.visible&&Ob.constructor===pb.constructor){var $d=pb.interval;$d>yb&&Nd.push($d)}}}}a.jh=Ma}var Kc=a.jh;var Nf=a.$.j,of=Nf.length,Ve=0,Hh=0,Qc=y;a.Jj=[];for(var Of,pf=0;pf<of;pf++){var ae=Nf[pf];Of=[];if(ae.visible&&ae!==h){var ok=Math.abs(ae.interval),
Yb=a.graduatedTickUnit;if(!(2>Yb*ok*y/a.graduatedRange)){var Pf=w[0][0],Od=0,Ac=0;Hh=y*ae.graduatedStart-1E-4;Qc=y*ae.graduatedEnd+1E-4;var qf=Yb*ok,hd=a.graduatedTickBase;if(hd<a.graduatedMin){var wg=(a.graduatedMin-hd)/qf;wg=0===wg%1?wg:Math.floor(wg+1);hd+=wg*qf}else hd>a.graduatedMin+qf&&(hd-=Math.floor((hd-a.graduatedMin)/qf)*qf);for(var Ih=Kc[pf];hd<=a.graduatedMax;){a:{for(var Ln=Ih.length,xg=0;xg<Ln;xg++)if(K.ca((hd-a.graduatedTickBase)%(Ih[xg]*a.graduatedTickUnit),0)){var pk=!1;break a}pk=
!0}if(pk&&(null===ae.graduatedSkip||!ae.graduatedSkip(hd))&&(Ve=(hd-a.graduatedMin)*y/a.graduatedRange,Ve>y&&(Ve=y),Hh<=Ve&&Ve<=Qc)){for(var pc=G[Od][Ac],$c=w[Od][Ac];Od<w.length;){for(;Ve>Pf&&Ac<w[Od].length-1;)Ac++,pc=G[Od][Ac],$c=w[Od][Ac],Pf+=$c;if(Ve<=Pf)break;Od++;Ac=0;pc=G[Od][Ac];$c=w[Od][Ac];Pf+=$c}var tc=u[Od],yg=tc[2*Ac],Jh=tc[2*Ac+1],rf=(Ve-(Pf-$c))/$c,Si=new J(yg+(tc[2*Ac+2]-yg)*rf+q/2-r.bounds.x,Jh+(tc[2*Ac+3]-Jh)*rf+q/2-r.bounds.y);Si.scale(h.scale,h.scale);var xe=pc,We=G[Od];1E-4>
rf?0<Ac?xe=We[Ac-1]:K.ca(tc[0],tc[tc.length-2])&&K.ca(tc[1],tc[tc.length-1])&&(xe=We[We.length-1]):.9999<rf&&(Ac+1<We.length?xe=We[Ac+1]:K.ca(tc[0],tc[tc.length-2])&&K.ca(tc[1],tc[tc.length-1])&&(xe=We[0]));pc!==xe&&(180<Math.abs(pc-xe)&&(pc<xe?pc+=360:xe+=360),pc=(pc+xe)/2%360);if(ae instanceof ih){var Bc="";null!==ae.graduatedFunction?(Bc=ae.graduatedFunction(hd),Bc=null!==Bc&&void 0!==Bc?Bc.toString():""):Bc=(+hd.toFixed(2)).toString();""!==Bc&&Of.push({Om:Si,angle:pc,text:Bc})}else Of.push({Om:Si,
angle:pc})}hd+=qf}}}a.Jj.push(Of)}Oa(G);var qk=a.Jj;if(null!==qk)for(var Mn=d.length,zg=0;zg<Mn;zg++){var Pb=d[zg],Ag=qk[zg];if(Pb.visible&&Pb!==h&&0!==Ag.length){if(Pb instanceof Yf){var rk=a,Ti=e,Bg=Pb.alignmentFocus;Bg.Tb()&&(Bg=Ic);var Qf=Pb.angle;Pb.dc=0;Pb.measure(Infinity,Infinity,0,0);Pb.dc=Qf;var qb=Pb.measuredBounds,Cg=qb.width,Cc=qb.height,Rc=L.allocAt(0,0,Cg,Cc),rb=J.alloc();rb.sj(Rc,Bg);L.free(Rc);for(var Pd=-rb.x,Qd=-rb.y,be=new L,Nn=Ag.length,Kh=0;Kh<Nn;Kh++)for(var Lh=Ag[Kh],Mh=Lh.Om.x,
Nh=Lh.Om.y,Dg=Lh.angle,Rd=0;4>Rd;Rd++){switch(Rd){case 0:rb.h(Pd,Qd);break;case 1:rb.h(Pd+Cg,Qd);break;case 2:rb.h(Pd,Qd+Cc);break;case 3:rb.h(Pd+Cg,Qd+Cc)}rb.rotate(Dg+Pb.angle);rb.offset(Mh,Nh);0===Kh&&0===Rd?be.h(rb.x,rb.y,0,0):be.Ve(rb);rb.offset(-Mh,-Nh);rb.rotate(-Dg-Pb.angle)}J.free(rb);null!==rk.ih&&rk.ih.push(be);qc(Ti,be.x,be.y,be.width,be.height)}else if(Pb instanceof ih){var id=a,ye=e;null===id.Dh&&(id.Dh=new ih);var Qb=id.Dh;kn(Qb,Pb);var Ui=Pb.alignmentFocus;Ui.Tb()&&(Ui=Ic);for(var jd=
Pb.segmentOrientation,On=Pb.segmentOffset,ze=new L,ab=0,Sd=0,Dc=0,Ae=0,Be=0,Oh=Ag.length,Ph=0;Ph<Oh;Ph++){var ce=Ag[Ph];ab=ce.Om.x;Sd=ce.Om.y;Dc=ce.angle;Be=Ae=Pb.angle;jd!==og&&(Be=jd===ln||jd===mn?Dc+Pb.angle:Dc,Ae=R.computeAngle(jd,Be));Qb.dc=Ae;Qb.text=ce.text||"";Qb.measure(Infinity,Infinity,0,0);var Ce=Qb.measuredBounds,Xe=Qb.naturalBounds,Ye=Xe.width,De=Xe.height,Bd=Ib.alloc();Bd.reset();Bd.translate(-Ce.x,-Ce.y);Bd.scale(Qb.scale,Qb.scale);Bd.rotate(Be,Ye/2,De/2);jd!==dn&&jd!==en||Bd.rotate(90,
Ye/2,De/2);jd!==fn&&jd!==gn||Bd.rotate(-90,Ye/2,De/2);jd===hn&&(45<Dc&&135>Dc||225<Dc&&315>Dc)&&Bd.rotate(-Dc,Ye/2,De/2);var Rf=L.allocAt(0,0,Ye,De),Eg=J.alloc();Eg.sj(Rf,Ui);Bd.xa(Eg);var Pn=-Eg.x,Qh=-Eg.y,Td=J.alloc();Td.assign(On);isNaN(Td.x)&&(Td.x=Ye/2+3);isNaN(Td.y)&&(Td.y=-(De/2+3));Td.rotate(Dc);ab+=Td.x+Pn;Sd+=Td.y+Qh;var Fg=new L(ab,Sd,Ce.width,Ce.height),Rh=new L(Ce.x,Ce.y,Ce.width,Ce.height),Sh=new L(Xe.x,Xe.y,Xe.width,Xe.height);ce.zA=Ae;ce.lineCount=Qb.lineCount;ce.lines=[Qb.vb,Qb.Gi,
Qb.te,Qb.He,Qb.Wb,Qb.nb,Qb.re];ce.actualBounds=Fg;ce.measuredBounds=Rh;ce.naturalBounds=Sh;0===Ph?ze.assign(Fg):ze.Pc(Fg);J.free(Td);J.free(Eg);L.free(Rf);Ib.free(Bd)}null!==id.ih&&id.ih.push(ze);qc(ye,ze.x,ze.y,ze.width,ze.height)}Cj(Pb,!1)}}};
jn.prototype.arrange=function(a,b,c){if(null!==a.ih){var d=a.yb(),e=a.Jj;if(null!==e){var f=a.ih,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.ih=null}}};
jn.prototype.hc=function(a,b,c){var d=c.Bi;c.Bi=!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.yb();f.hc(b,c);e=a.Gf()*c.scale;0>=e&&(e=1);for(var g=f.actualBounds,h=a.$.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 Yf){if(!(2>a.graduatedTickUnit*n.interval*f.geometry.flattenedTotalLength/a.graduatedRange*e)){var q=n.measuredBounds,u=n.strokeWidth*n.scale,w=n.alignmentFocus;w.Tb()&&
(w=Ic);for(var y=0;y<r;y++){var z=p[y].Om,B=p[y].angle,D=w,G=n.sb;G.reset();G.translate(z.x+g.x,z.y+g.y);G.rotate(B+n.angle,0,0);G.translate(-q.width*D.x+D.offsetX+u/2,-q.height*D.y+D.offsetY+u/2);G.scale(n.scale,n.scale);Ql(n,!1);n.ci.set(n.sb);n.kl=n.scale;Rl(n,!1);n.hc(b,c);n.sb.reset()}}}else if(n instanceof ih)for(null===a.Dh&&(a.Dh=new ih),q=a.Dh,kn(q,n),n=0;n<r;n++)u=p[n],u.actualBounds&&u.measuredBounds&&u.naturalBounds&&(q.Zb=u.text||"",q.dc=u.zA||0,q.Vc=u.lineCount||0,w=u.lines,void 0!==
w&&(q.vb=w[0],q.Gi=w[1],q.te=w[2],q.He=w[3],q.Wb=w[4],q.nb=w[5],q.re=w[6]),u.naturalBounds&&(q.uc=u.naturalBounds),u.actualBounds&&(w=u.actualBounds,q.arrange(w.x,w.y,w.width,w.height)),w=u.actualBounds,q.arrange(w.x,w.y,w.width,w.height),y=u.measuredBounds,u=u.naturalBounds,z=q.sb,z.reset(),z.translate(w.x+g.x,w.y+g.y),z.translate(-y.x,-y.y),yl(q,z,u.x,u.y,u.width,u.height),Ql(q,!1),q.ci.set(q.sb),q.kl=q.scale,Rl(q,!1),q.hc(b,c))}c.Bi=d;b.restore();b.yc(!0)};
function U(a){N.call(this);void 0===a?this.ta=U.Position:(x(a,dm,U,"type"),this.ta=a);null===this.ta&&v("Panel type not specified or PanelLayout not loaded: "+a);this.$=new H;this.lb=Ec;this.ta===U.Grid&&(this.isAtomic=!0);this.Nn=ld;this.Zf=kl;this.ta===U.Table&&nn(this);this.sq=Og;this.no=ac;this.oo=Rb;this.ko=0;this.jo=100;this.mo=10;this.lo=0;this.pi=this.pb=this.jh=this.ih=this.Jj=null;this.Co=NaN;this.ye=this.Fi=null;this.Fl="category";this.Sd=null;this.Eg=new L(NaN,NaN,NaN,NaN);this.Dh=this.Mp=
this.Wi=null;this.Rg=""}la(U,N);function nn(a){a.Cj=Ec;a.$g=1;a.wi=null;a.vi=null;a.Zg=1;a.Yg=null;a.ui=null;a.xb=[];a.tb=[];a.ak=on;a.zj=on;a.Zi=0;a.Ii=0}
U.prototype.cloneProtected=function(a){N.prototype.cloneProtected.call(this,a);a.ta=this.ta;a.lb=this.lb.J();a.Nn=this.Nn.J();a.Zf=this.Zf;if(a.ta===U.Table){a.Cj=this.Cj.J();a.$g=this.$g;a.wi=this.wi;a.vi=this.vi;a.Zg=this.Zg;a.Yg=this.Yg;a.ui=this.ui;var b=[];if(0<this.xb.length)for(var c=this.xb,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.xb=b;b=[];if(0<this.tb.length)for(c=this.tb,d=c.length,e=0;e<d;e++)void 0!==c[e]&&(f=c[e].copy(),f.rj(a),b[e]=f);a.tb=b;a.ak=
this.ak;a.zj=this.zj;a.Zi=this.Zi;a.Ii=this.Ii}a.sq=this.sq;a.no=this.no.J();a.oo=this.oo.J();a.ko=this.ko;a.jo=this.jo;a.mo=this.mo;a.lo=this.lo;a.Jj=this.Jj;a.jh=this.jh;a.pb=this.pb;a.pi=this.pi;a.Co=this.Co;a.Fi=this.Fi;a.ye=this.ye;a.Fl=this.Fl;a.Eg.assign(this.Eg);a.Rg=this.Rg;null!==this.Mp&&(a.Mp=this.Mp)};U.prototype.Ef=function(a){N.prototype.Ef.call(this,a);a.$=this.$;for(var b=a.$.j,c=b.length,d=0;d<c;d++)b[d].wg=a;a.Wi=null};
U.prototype.copy=function(){var a=N.prototype.copy.call(this);if(null!==a){for(var b=this.$.j,c=b.length,d=0;d<c;d++){var e=b[d].copy();e.rj(a);e.Yj=null;var f=a.$,g=f.count;f.zb(g,e);f=a.part;if(null!==f){f.Uj=null;null!==e.portId&&f instanceof T&&(f.Sh=!0);var h=a.diagram;null!==h&&h.undoManager.isUndoingRedoing||f.gb(Je,"elements",a,null,e,null,g)}}return a}return null};t=U.prototype;t.toString=function(){return"Panel("+this.type+")#"+sb(this)};
t.np=function(a){N.prototype.np.call(this,a);for(var b=this.$.j,c=b.length,d=0;d<c;d++)b[d].np(a)};
t.ej=function(a,b){if(this.ta===U.Grid)this.ta.hc(this,a,b);else if(this.ta===U.Graduated)this.ta.hc(this,a,b);else{this.ta===U.Table&&(a.lineCap="butt",pn(this,a,!0,this.xb,!0),pn(this,a,!1,this.tb,!0),qn(this,a,!0,this.xb),qn(this,a,!1,this.tb),pn(this,a,!0,this.xb,!1),pn(this,a,!1,this.tb,!1));var c=this.isClipping&&this.ta===U.Spot;c&&a.save();for(var d=this.yb(),e=this.$.j,f=e.length,g=0;g<f;g++){var h=e[g];c&&h===d&&(a.clipInsteadOfFill=!0);h.hc(a,b);c&&h===d&&(a.clipInsteadOfFill=!1)}c&&(a.restore(),
a.yc(!0))}};
function qn(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.$g:a.Zg);var n=l.separatorStroke;null===n&&(n=c?a.wi:a.Yg);if(0!==m&&null!==n){Ai(a,b,n,!1,!1,g,f);n=!1;var p=l.separatorDashArray;null===p&&(p=c?a.vi:a.ui);null!==p&&(n=!0,b.Ht(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.lb;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.Ft()}}}}
function pn(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.Ac(),p=l.separatorStrokeWidth;isNaN(p)&&(p=c?a.$g:a.Zg);var r=l.separatorStroke;null===r&&(r=c?a.wi:a.Yg);null===r&&(p=0);n-=p;p=l.position+p;n+=l.actual;p+n>m&&(n=m-p);0>=n||(m=a.lb,Ai(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 kk(a){return"LineV"===a||"BarV"===a}
t.wk=function(a,b,c,d,e){var f=this.ke(),g=this.transform,h=1/(g.m11*g.m22-g.m12*g.m21),k=g.m22*h,l=-g.m12*h,m=-g.m21*h,n=g.m11*h,p=h*(g.m21*g.dy-g.m22*g.dx),r=h*(g.m12*g.dx-g.m11*g.dy);if(null!==this.areaBackground)return g=this.actualBounds,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.$.j;r=n.length;m=J.alloc();p=null;b=Infinity;var q=null,u=this.isClipping&&this.ta===U.Spot;u&&(q=J.alloc(),p=this.yb(),(l=p.wk(h,a,k,c,q))&&(b=(h-q.x)*(h-q.x)+(a-q.y)*(a-q.y)));for(var w=0;w<r;w++){var y=n[w];y.visible&&y!==p&&y.wk(h,a,k,c,m)&&(l=!0,y=(h-m.x)*(h-m.x)+(a-m.y)*(a-m.y),y<d&&(d=y,e.set(m)))}u&&(b>d&&e.set(q),J.free(q));J.free(m);f&&e.transform(g);return l};
t.u=function(a){if(!0!==Hj(this)){N.prototype.u.call(this,a);a=null;if(this.ta===U.Auto||this.ta===U.Link)a=this.yb();for(var b=this.$.j,c=b.length,d=0;d<c;d++){var e=b[d];(e===a||e.isPanelMain)&&e.u(!0);if(!e.desiredSize.o()){var f=Al(e,!1);(e instanceof Kg||e instanceof U||e instanceof ih||f!==Mg)&&e.u(!0)}}}};t.Fm=function(){if(!1===Hj(this)){Cj(this,!0);Bl(this,!0);for(var a=this.$.j,b=a.length,c=0;c<b;c++)a[c].Fm()}};
t.Bl=function(){if(0!==(this.I&2048)===!1){Ql(this,!0);Rl(this,!0);for(var a=this.$.j,b=a.length,c=0;c<b;c++)a[c].fw()}};t.fw=function(){Rl(this,!0);for(var a=this.$.j,b=a.length,c=0;c<b;c++)a[c].fw()};
t.Im=function(a,b,c,d){var e=this.Eg;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.lb;a=Math.max(a-k.left-k.right,0);b=Math.max(b-k.top-k.bottom,0);var l=this.$.j;0!==l.length&&this.ta.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);gc(e,a,k);gc(this.naturalBounds,a,k);xl(this,0,0,a,k)};t.yb=function(){if(null===this.Wi){var a=this.$.j,b=a.length;if(0===b)return null;for(var c=0;c<b;c++){var d=a[c];if(!0===d.isPanelMain)return this.Wi=d}this.Wi=a[0]}return this.Wi};function Nm(a){return null!==a.part?a.part.locationObject:null}
t.Nh=function(a,b,c,d){var e=this.$.j;this.actualBounds.h(a,b,c,d);if(0!==e.length){if(!this.desiredSize.o()){a=Al(this,!0);var f=this.measuredBounds;b=f.width;f=f.height;var g=this.oh,h=g.left+g.right;g=g.top+g.bottom;b===c&&f===d&&(a=Mg);switch(a){case Mg:if(b>c||f>d)this.u(),this.measure(b>c?c:b,f>d?d:f,0,0);break;case Hd:this.u(!0);this.measure(c+h,d+g,0,0);break;case ll:this.u(!0);this.measure(c+h,f+g,0,0);break;case ml:this.u(!0),this.measure(b+h,d+g,0,0)}}this.ta.arrange(this,e,this.Eg)}};
t.Ph=function(a){var b=this.naturalBounds,c=Nm(this);if(rc(0,0,b.width,b.height,a.x,a.y)){b=this.$.j;for(var d=b.length,e=J.allocAt(0,0);d--;){var f=b[d];if(f.visible||f===c)if(Jb(e.set(a),f.transform),f.fa(e))return J.free(e),!0}J.free(e);return null===this.ob&&null===this.jc?!1:!0}return!1};t.It=function(a){if(this.Yk===a)return this;for(var b=this.$.j,c=b.length,d=0;d<c;d++){var e=b[d].It(a);if(null!==e)return e}return null};
t.Nk=function(a,b){b(this,a);if(a instanceof U){a=a.$.j;for(var c=a.length,d=0;d<c;d++)this.Nk(a[d],b)}};function Uj(a,b){rn(a,a,b)}function rn(a,b,c){c(b);b=b.$.j;for(var d=b.length,e=0;e<d;e++){var f=b[e];f instanceof U&&rn(a,f,c)}}function sn(a,b){tn(a,a,b)}function tn(a,b,c){c(b);if(b instanceof U){b=b.$.j;for(var d=b.length,e=0;e<d;e++)tn(a,b[e],c)}}t.ym=function(a){return un(this,this,a)};
function un(a,b,c){if(c(b))return b;if(b instanceof U){b=b.$.j;for(var d=b.length,e=0;e<d;e++){var f=un(a,b[e],c);if(null!==f)return f}}return null}t.fb=function(a){if(this.name===a)return this;var b=this.$.j,c=b.length;null===this.Fi&&null===this.ye||(c=vn(this));for(var d=0;d<c;d++){var e=b[d];if(e instanceof U){var f=e.fb(a);if(null!==f)return f}if(e.name===a)return e}return null};
function wn(a){a=a.$.j;for(var b=a.length,c=0,d=0;d<b;d++){var e=a[d];e instanceof U?c=Math.max(c,wn(e)):e instanceof Yf&&(c=Math.max(c,e.Bh/2*e.ck*e.Gf()))}return c}t.ke=function(){return!(this.type===U.TableRow||this.type===U.TableColumn)};
t.$b=function(a,b,c){if(!1===this.pickable)return null;void 0===b&&(b=null);void 0===c&&(c=null);if(Ij(this))return null;var d=this.naturalBounds,e=1/this.Gf(),f=this.ke(),g=f?a:Jb(J.allocAt(a.x,a.y),this.transform),h=this.diagram,k=10,l=5;null!==h&&(k=h.Dm("extraTouchArea"),l=k/2);if(rc(-(l*e),-(l*e),d.width+k*e,d.height+k*e,g.x,g.y)){if(!this.isAtomic){e=this.$.j;var m=e.length;h=J.alloc();l=(k=this.isClipping&&this.ta===U.Spot)?this.yb():null;if(k&&(l.ke()?Jb(h.set(a),l.transform):h.set(a),!l.fa(h)))return J.free(h),
f||J.free(g),null;for(var n=Nm(this);m--;){var p=e[m];if(p.visible||p===n)if(p.ke()?Jb(h.set(a),p.transform):h.set(a),!k||p!==l){var r=null;p instanceof U?r=p.$b(h,b,c):!0===p.pickable&&p.fa(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=rc(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.ke(),g=f?a:Jb(J.allocAt(a.x,a.y),this.transform),h=this.type===U.TableRow||this.type===U.TableColumn;e=rc(0,0,e.width,e.height,g.x,g.y);if(h||e){if(!this.isAtomic){h=this.$.j;for(var k=h.length,l=J.alloc(),m=Nm(this);k--;){var n=h[k];if(n.visible||n===m){n.ke()?Jb(l.set(a),n.transform):l.set(a);var p=n;n=n instanceof U?n:null;(null!==n?n.hj(l,b,c,d):p.fa(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.Ff=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=Ib.alloc(),g.reset());g.multiply(this.transform);if(this.Oh(a,g))return xn(this,b,c,e),void 0===f&&Ib.free(g),!0;if(this.Oc(a,g)){if(!this.isAtomic)for(var h=Nm(this),k=this.$.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 U?m:null;p=Ib.alloc();p.set(g);
if(null!==m?m.Ff(a,b,c,d,e,p):zl(n,a,d,p))null!==b&&(n=b(n)),null===n||null!==c&&!c(n)||e.add(n);Ib.free(p)}}}void 0===f&&Ib.free(g);return d}void 0===f&&Ib.free(g);return!1};function xn(a,b,c,d){for(var e=a.$.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 U&&xn(g,b,c,d),null!==b&&(g=b(g)),null===g||null!==c&&!c(g)||d.add(g))}}}
t.Jg=function(a,b,c,d,e,f){if(!1===this.pickable)return!1;void 0===c&&(c=null);void 0===d&&(d=null);var g=this.naturalBounds,h=this.ke(),k=h?a:Jb(J.allocAt(a.x,a.y),this.transform),l=h?b:Jb(J.allocAt(b.x,b.y),this.transform),m=k.Qe(l),n=0<k.x&&k.x<g.width&&0<k.y&&k.y<g.height||Kb(k.x,k.y,0,0,0,g.height)<=m||Kb(k.x,k.y,0,g.height,g.width,g.height)<=m||Kb(k.x,k.y,g.width,g.height,g.width,0)<=m||Kb(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=Nm(this);for(var p=this.$.j,r=p.length;r--;){var q=p[r];if(q.visible||q===m){var u=q.actualBounds,w=this.naturalBounds;if(!h||!(u.x>w.width||u.y>w.height||0>u.x+u.width||0>u.y+u.height))if(q.ke()?(u=q.transform,Jb(k.set(a),u),Jb(l.set(b),u)):(k.set(a),l.set(b)),u=q,q=q instanceof U?q:null,null!==q?q.Jg(k,l,c,d,e,f):u.py(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 Sm(a){var b=null;a instanceof Yf&&(b=a.spot1,b===ld&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot1));null===b&&(b=Hc);return b}function Tm(a){var b=null;a instanceof Yf&&(b=a.spot2,b===ld&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot2));null===b&&(b=Sc);return b}t.add=function(a){x(a,N,U,"add:element");this.zb(this.$.count,a)};t.O=function(a){return this.$.O(a)};
t.zb=function(a,b){b instanceof S&&v("Cannot add a Part to a Panel: "+b+"; use a Panel instead");if(this===b||this.Lg(b))this===b&&v("Cannot make a Panel contain itself: "+this.toString()),v("Cannot make a Panel indirectly contain itself: "+this.toString()+" already contains "+b.toString());var c=b.panel;null!==c&&c!==this&&v("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.ta!==U.Grid||b instanceof Yf||v("Can only add Shapes to a Grid Panel, not: "+b);this.ta!==U.Graduated||b instanceof Yf||b instanceof ih||v("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.Sd&&(this.Sd=new Db),this.Sd.add(d,b))}var e=this.$;d=-1;if(c===this){for(var f=-1,g=this.$.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.hb(f);d=f}else v("element "+b.toString()+" has panel "+c.toString()+" but is not contained by it.")}if(0>a||a>e.count)a=e.count;e.zb(a,b);if(0===a||b.isPanelMain)this.Wi=null;Hj(this)||this.u();b.u(!1);null!==b.portId?this.Sh=!0:b instanceof U&&!0===b.Sh&&(this.Sh=!0);this.jh=null;c=this.part;null!==c&&(c.Uj=null,c.ph=NaN,this.Sh&&c instanceof T&&(c.Sh=!0),c.Sh&&c instanceof T&&(c.xc=null),e=this.diagram,null!==e&&e.undoManager.isUndoingRedoing||(-1!==d&&c.gb(Ke,"elements",this,b,null,d,null),c.gb(Je,
"elements",this,null,b,null,a),this.Mg()||yn(this,b,!1)))};function zn(a,b){a.I=b?a.I|16777216:a.I&-16777217}t.remove=function(a){x(a,N,U,"remove:element");for(var b=this.$.j,c=b.length,d=-1,e=0;e<c;e++)if(b[e]===a){d=e;break}-1!==d&&this.Nc(d,!0)};t.hb=function(a){F&&C(a,U,"removeAt:idx");0<=a&&this.Nc(a,!0)};
t.Nc=function(a,b){var c=this.$,d=c.O(a);d.Yj=null;d.rj(null);if(null!==this.Sd){var e=d.data;"object"===typeof e&&this.Sd.remove(e)}c.hb(a);Cj(this,!1);this.u();this.Wi===d&&(this.Wi=null);this.jh=null;var f=this.part;null!==f&&(f.Uj=null,f.ph=NaN,f.Sb(),f instanceof T&&(d instanceof U?d.Nk(d,function(a,c){hm(f,c,b)}):hm(f,d,b)),c=this.diagram,null!==c&&c.undoManager.isUndoingRedoing||f.gb(Ke,"elements",this,d,null,a,null))};
U.prototype.getRowDefinition=function(a){F&&C(a,U,"getRowDefinition:idx");0>a&&ya(a,">= 0",U,"getRowDefinition:idx");a=Math.round(a);var b=this.xb;if(void 0===b)return null;if(void 0===b[a]){var c=new ik;c.rj(this);c.isRow=!0;c.index=a;b[a]=c}return b[a]};U.prototype.xw=function(a){F&&C(a,U,"removeRowDefinition:idx");0>a&&ya(a,">= 0",U,"removeRowDefinition:idx");a=Math.round(a);var b=this.xb;void 0!==b&&(this.gb(Ke,"coldefs",this,b[a],null,a,null),b[a]&&delete b[a],this.u())};
U.prototype.getColumnDefinition=function(a){F&&C(a,U,"getColumnDefinition:idx");0>a&&ya(a,">= 0",U,"getColumnDefinition:idx");a=Math.round(a);var b=this.tb;if(void 0===b)return null;if(void 0===b[a]){var c=new ik;c.rj(this);c.isRow=!1;c.index=a;b[a]=c}return b[a]};t=U.prototype;t.vw=function(a){F&&C(a,U,"removeColumnDefinition:idx");0>a&&ya(a,">= 0",U,"removeColumnDefinition:idx");a=Math.round(a);var b=this.tb;void 0!==b&&(this.gb(Ke,"coldefs",this,b[a],null,a,null),b[a]&&delete b[a],this.u())};
t.Xz=function(a){if(0>a||this.type!==U.Table)return-1;for(var b=0,c=this.xb,d=c.length,e=this.Zi;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))break}return e};t.Pz=function(a){if(0>a||this.type!==U.Table)return-1;for(var b=0,c=this.tb,d=c.length,e=this.Ii;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))break}return e};
t.mA=function(a,b){void 0===b&&(b=new J(NaN,NaN));if(this.type!==U.Graduated)return b.h(NaN,NaN),b;a=Math.min(Math.max(a,this.graduatedMin),this.graduatedMax);var c=this.yb();c.geometry.Zv((a-this.graduatedMin)/this.graduatedRange,b);return c.transform.xa(b)};t.nA=function(a){if(this.type!==U.Graduated)return NaN;var b=this.yb();b.transform.ee(a);return b.geometry.uy(a)*this.graduatedRange+this.graduatedMin};function Yl(a){a=a.pi;return null!==a&&a.s}
function Lg(a){var b=a.pi;if(null===b)null!==a.data&&v("Template cannot have .data be non-null: "+a),a.pi=b=new H;else if(b.s)return;var c=new H;zn(a,!1);a.Nk(a,function(a,d){var e=d.jb;if(null!==e)for(Vl(d,!1),e=e.iterator;e.next();){var f=e.value;f.mode===An&&Vl(d,!0);var g=f.sourceName;null!==g&&("/"===g&&zn(a,!0),g=wl(f,a,d),null!==g&&(c.add(g),null===g.em&&(g.em=new H),g.em.add(f)));b.add(f)}if(d instanceof U&&d.type===U.Table){if(0<d.xb.length)for(a=d.xb,e=a.length,f=0;f<e;f++)if(g=a[f],void 0!==
g&&null!==g.jb)for(var h=g.jb.iterator;h.next();){var k=h.value;k.jd=g;k.kq=2;k.km=g.index;b.add(k)}if(0<d.tb.length)for(d=d.tb,a=d.length,e=0;e<a;e++)if(f=d[e],void 0!==f&&null!==f.jb)for(g=f.jb.iterator;g.next();)h=g.value,h.jd=f,h.kq=1,h.km=f.index,b.add(h)}});for(var d=c.iterator;d.next();){var e=d.value;if(null!==e.em){Vl(e,!0);for(var f=e.em.iterator;f.next();){var g=f.value;null===e.jb&&(e.jb=new H);e.jb.add(g)}}e.em=null}for(var h=b.iterator;h.next();)if(d=h.value,e=d.jd,null!==e){d.jd=null;
g=d.targetProperty;var k=g.indexOf(".");0<k&&e instanceof U&&(f=g.substring(0,k),g=g.substr(k+1),k=e.fb(f),null!==k?(e=k,d.targetProperty=g):Ca('Warning: unable to find GraphObject named "'+f+'" for Binding: '+d.toString()));e instanceof ik?(f=sb(e.panel),d.vj=void 0===f?-1:f,e.panel.Yk=d.vj):e instanceof N?(f=sb(e),d.vj=void 0===f?-1:f,e.Yk=d.vj):v("Unknown type of binding target: "+e)}b.freeze();a instanceof S&&(a.bc()&&a.Fb(),F&&!Bn&&a.Nk(a,function(a,c){if(c instanceof U&&(c.type===U.Auto||c.type===
U.Spot||c.type===U.Graduated)&&1>=c.elements.count&&!(c instanceof S)){var d=!1;if(1===c.elements.count&&(d=null!==c.itemArray,!d))for(h=b.iterator;h.next();)if("itemArray"===h.value.targetProperty){d=!0;break}d||(Ca("Auto, Spot, or Graduated Panel should not have zero or one elements: "+c.toString()+" in "+a.toString()),Bn=!0)}}))}
t.Az=function(){var a=this.copy();sn(a,function(a){a instanceof U&&(a.pi=null,a.pb=null);var b=a.jb;null!==b&&(a.jb=null,b.each(function(b){a.bind(b.copy())}));b=a.Sg;null!==b&&(a.Sg=null,b.each(function(b){Zl(a,b.value.copy())}))});return a};
t.Ga=function(a){var b=this.pi;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.fb(e);else{var f=this.diagram;null!==f&&c.isToModel&&(d=f.model.modelData)}if(null===d)F&&Ca("Binding error: missing GraphObject named "+e+" in "+this.toString());else{f=this;var g=c.vj;if(-1!==g){if(f=
this.It(g),null===f)continue}else null!==c.jd&&(f=c.jd);"/"===e?d=f.part:"."===e?d=f:".."===e&&(d=f.panel);e=c.kq;if(0!==e){if(!(f instanceof U))continue;1===e?f=f.getColumnDefinition(c.km):2===e&&(f=f.getRowDefinition(c.km))}void 0!==f&&c.Uw(f,d)}}}};
function Cn(a,b){a=a.$.j;for(var c=a.length,d=b.length,e=0,f=null;e<c&&!(f=a[e],f instanceof U&&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 U)||f.data!==b[g])return!0;e++;g++}return!1}
function vn(a){if(a.type===U.Spot||a.type===U.Auto)return Math.min(a.$.length,1);if(a.type===U.Link){a=a.$;for(var b=a.length,c=0;c<b;c++){var d=a.O(c);if(!(d instanceof Yf&&d.isPanelMain))break}return c}return a.type===U.Table&&0<a.$.length&&(a=a.$.O(0),a.isPanelMain&&a instanceof U&&(a.type===U.TableRow||a.type===U.TableColumn))?1:0}t.fu=function(){for(var a=vn(this);this.$.length>a;)this.Nc(this.$.length-1,!1);a=this.itemArray;if(null!==a)for(var b=a.length,c=0;c<b;c++)Dn(this,a[c],c)};
t.oy=function(a){if(void 0===a||null===a||null===this.Sd)return null;A(a,"object",U,"findItemPanelForData");return this.Sd.K(a)};
function Dn(a,b,c){if(!(void 0===b||null===b||0>c)){var d=En(a,b),e=a.itemTemplateMap,f=null;null!==e&&(f=e.K(d));null===f&&(Fn||(Fn=!0,Ca('No item template Panel found for category "'+d+'" on '+a),Ca("  Using default item template."),d=new U,e=new ih,e.bind(new $i("text","",Qa)),d.add(e),Gn=d),f=Gn);d=f;null!==d&&(Lg(d),d=d.copy(),0!==(d.I&16777216)&&(e=a.ij(),null!==e&&zn(e,!0)),"object"===typeof b&&(null===a.Sd&&(a.Sd=new Db),a.Sd.add(b,d)),e=c+vn(a),a.zb(e,d),d.pb=b,Hn(a,e,c),d.pb=null,d.data=
b)}}function Hn(a,b,c){for(a=a.$;b<a.length;){var d=a.O(b);if(d instanceof U){var e=b,f=c;d.type===U.TableRow?d.row=e:d.type===U.TableColumn&&(d.column=e);d.itemIndex=f}b++;c++}}function En(a,b){if(null===b)return"";a=a.Fl;if("function"===typeof a)a=a(b);else if("string"===typeof a&&"object"===typeof b){if(""===a)return"";a=In(b,a)}else return"";if(void 0===a)return"";if("string"===typeof a)return a;v("Panel.getCategoryForItemData found a non-string category for "+b+": "+a);return""}
function yn(a,b,c){var d=b.enabledChanged;null!==d&&d(b,c);if(b instanceof U){b=b.$.j;d=b.length;for(var e=0;e<d;e++){var f=b[e];c&&f instanceof U&&!f.isEnabled||yn(a,f,c)}}}function Jn(a,b){b.name=a;cm.add(a,b)}
ma.Object.defineProperties(U.prototype,{type:{configurable:!0,get:function(){return this.ta},set:function(a){var b=this.ta;b!==a&&(this.ta=a,this.ta===U.Grid?this.isAtomic=!0:this.ta===U.Table&&nn(this),this.u(),this.g("type",b,a))}},elements:{configurable:!0,get:function(){return this.$.iterator}},naturalBounds:{configurable:!0,get:function(){return this.uc}},padding:{configurable:!0,get:function(){return this.lb},set:function(a){"number"===
typeof a?(0>a&&ya(a,">= 0",U,"padding"),a=new lc(a)):(x(a,lc,U,"padding"),0>a.left&&ya(a.left,">= 0",U,"padding:value.left"),0>a.right&&ya(a.right,">= 0",U,"padding:value.right"),0>a.top&&ya(a.top,">= 0",U,"padding:value.top"),0>a.bottom&&ya(a.bottom,">= 0",U,"padding:value.bottom"));var b=this.lb;b.A(a)||(this.lb=a=a.J(),this.u(),this.g("padding",b,a))}},defaultAlignment:{configurable:!0,get:function(){return this.Nn},set:function(a){var b=this.Nn;b.A(a)||(F&&x(a,M,U,"defaultAlignment"),
this.Nn=a=a.J(),this.u(),this.g("defaultAlignment",b,a))}},defaultStretch:{configurable:!0,get:function(){return this.Zf},set:function(a){var b=this.Zf;b!==a&&(hb(a,N,U,"defaultStretch"),this.Zf=a,this.u(),this.g("defaultStretch",b,a))}},defaultSeparatorPadding:{configurable:!0,get:function(){return void 0===this.Cj?Ec:this.Cj},set:function(a){if(void 0!==this.Cj){"number"===typeof a?a=new lc(a):F&&x(a,lc,U,"defaultSeparatorPadding");var b=this.Cj;b.A(a)||(this.Cj=a=a.J(),
this.u(),this.g("defaultSeparatorPadding",b,a))}}},defaultRowSeparatorStroke:{configurable:!0,get:function(){return void 0===this.wi?null:this.wi},set:function(a){var b=this.wi;b!==a&&(null===a||"string"===typeof a||a instanceof Jl)&&(a instanceof Jl&&a.freeze(),this.wi=a,this.P(),this.g("defaultRowSeparatorStroke",b,a))}},defaultRowSeparatorStrokeWidth:{configurable:!0,get:function(){return void 0===this.$g?1:this.$g},set:function(a){if(void 0!==this.$g){var b=this.$g;
b!==a&&isFinite(a)&&0<=a&&(this.$g=a,this.u(),this.g("defaultRowSeparatorStrokeWidth",b,a))}}},defaultRowSeparatorDashArray:{configurable:!0,get:function(){return void 0===this.vi?null:this.vi},set:function(a){if(void 0!==this.vi){var b=this.vi;if(b!==a){null===a||Array.isArray(a)||xa(a,"Array",U,"defaultRowSeparatorDashArray:value");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)||v("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.vi=a;this.P();this.g("defaultRowSeparatorDashArray",b,a)}}}},defaultColumnSeparatorStroke:{configurable:!0,get:function(){return void 0===this.Yg?null:this.Yg},set:function(a){if(void 0!==this.Yg){var b=this.Yg;b!==a&&(null===a||"string"===typeof a||a instanceof Jl)&&(a instanceof Jl&&a.freeze(),this.Yg=a,this.P(),this.g("defaultColumnSeparatorStroke",b,a))}}},defaultColumnSeparatorStrokeWidth:{configurable:!0,
enumerable:!0,get:function(){return void 0===this.Zg?1:this.Zg},set:function(a){if(void 0!==this.Zg){var b=this.Zg;b!==a&&isFinite(a)&&0<=a&&(this.Zg=a,this.u(),this.g("defaultColumnSeparatorStrokeWidth",b,a))}}},defaultColumnSeparatorDashArray:{configurable:!0,get:function(){return void 0===this.ui?null:this.ui},set:function(a){if(void 0!==this.ui){var b=this.ui;if(b!==a){null===a||Array.isArray(a)||xa(a,"Array",U,"defaultColumnSeparatorDashArray:value");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)||v("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.ui=a;this.P();this.g("defaultColumnSeparatorDashArray",b,a)}}}},viewboxStretch:{configurable:!0,get:function(){return this.sq},set:function(a){var b=this.sq;b!==a&&(hb(a,N,U,"viewboxStretch"),this.sq=a,this.u(),this.g("viewboxStretch",b,a))}},gridCellSize:{configurable:!0,
enumerable:!0,get:function(){return this.no},set:function(a){var b=this.no;if(!b.A(a)){x(a,Hb,U,"gridCellSize");a.o()&&0!==a.width&&0!==a.height||v("Invalid Panel.gridCellSize: "+a);this.no=a.J();var c=this.diagram;null!==c&&this===c.grid&&Dj(c);this.P();this.g("gridCellSize",b,a)}}},gridOrigin:{configurable:!0,get:function(){return this.oo},set:function(a){var b=this.oo;if(!b.A(a)){x(a,J,U,"gridOrigin");a.o()||v("Invalid Panel.gridOrigin: "+a);this.oo=a.J();var c=this.diagram;null!==
c&&this===c.grid&&Dj(c);this.P();this.g("gridOrigin",b,a)}}},graduatedMin:{configurable:!0,get:function(){return this.ko},set:function(a){C(a,U,"graduatedMin");var b=this.ko;b!==a&&(this.ko=a,this.u(),this.g("graduatedMin",b,a),ul(this)&&(a=this.part,null!==a&&vl(this,a,"graduatedRange")))}},graduatedMax:{configurable:!0,get:function(){return this.jo},set:function(a){C(a,U,"graduatedMax");var b=this.jo;b!==a&&(this.jo=a,this.u(),this.g("graduatedMax",b,a),ul(this)&&(a=
this.part,null!==a&&vl(this,a,"graduatedRange")))}},graduatedRange:{configurable:!0,get:function(){return this.graduatedMax-this.graduatedMin}},graduatedTickUnit:{configurable:!0,get:function(){return this.mo},set:function(a){C(a,U,"graduatedTickUnit");var b=this.mo;b!==a&&0<a&&(this.mo=a,this.u(),this.g("graduatedTickUnit",b,a))}},graduatedTickBase:{configurable:!0,get:function(){return this.lo},set:function(a){C(a,U,"graduatedTickBase");var b=this.lo;b!==
a&&(this.lo=a,this.u(),this.g("graduatedTickBase",b,a))}},Sh:{configurable:!0,get:function(){return 0!==(this.I&8388608)},set:function(a){0!==(this.I&8388608)!==a&&(this.I^=8388608)}},rowCount:{configurable:!0,get:function(){return void 0===this.xb?0:this.xb.length}},columnCount:{configurable:!0,get:function(){return void 0===this.tb?0:this.tb.length}},rowSizing:{configurable:!0,get:function(){return void 0===this.ak?on:this.ak},set:function(a){if(void 0!==
this.ak){var b=this.ak;b!==a&&(F&&a!==on&&a!==Wm&&v("Panel.rowSizing must be RowColumnDefinition.ProportionalExtra or RowColumnDefinition.None, not: "+a),this.ak=a,this.u(),this.g("rowSizing",b,a))}}},columnSizing:{configurable:!0,get:function(){return void 0===this.zj?on:this.zj},set:function(a){if(void 0!==this.zj){var b=this.zj;b!==a&&(F&&a!==on&&a!==Wm&&v("Panel.columnSizing must be RowColumnDefinition.ProportionalExtra or RowColumnDefinition.None, not: "+a),this.zj=a,this.u(),this.g("columnSizing",
b,a))}}},topIndex:{configurable:!0,get:function(){return void 0===this.Zi?0:this.Zi},set:function(a){if(void 0!==this.Zi){var b=this.Zi;b!==a&&((!isFinite(a)||0>a)&&v("Panel.topIndex must be greater than zero and a real number, not: "+a),this.Zi=a,this.u(),this.g("topIndex",b,a))}}},leftIndex:{configurable:!0,get:function(){return void 0===this.Ii?0:this.Ii},set:function(a){if(void 0!==this.Ii){var b=this.Ii;b!==a&&((!isFinite(a)||0>a)&&v("Panel.leftIndex must be greater than zero and a real number, not: "+
a),this.Ii=a,this.u(),this.g("leftIndex",b,a))}}},data:{configurable:!0,get:function(){return this.pb},set:function(a){var b=this.pb;if(b!==a){var c=this instanceof S&&!(this instanceof Te);c&&A(a,"object",U,"data");Lg(this);this.pb=a;var d=this.diagram;null!==d&&(c?(c=d.partManager,this instanceof R?(null!==b&&c.Ze.remove(b),null!==a&&c.Ze.add(a,this)):this instanceof S&&(null!==b&&c.$e.remove(b),null!==a&&c.$e.add(a,this))):(c=this.panel,null!==c&&null!==c.Sd&&(null!==b&&c.Sd.remove(b),
null!==a&&c.Sd.add(a,this))));this.g("data",b,a);null!==d&&d.undoManager.isUndoingRedoing||null!==a&&this.Ga()}}},itemIndex:{configurable:!0,get:function(){return this.Co},set:function(a){var b=this.Co;b!==a&&(this.Co=a,this.g("itemIndex",b,a))}},itemArray:{configurable:!0,get:function(){return this.Fi},set:function(a){var b=this.Fi;if(b!==a||null!==a&&Cn(this,a)){F&&null!==a&&!Ga(a)&&v("Panel.itemArray must be an Array-like object or null, not: "+a);var c=this.diagram;
b!==a&&(null!==c&&null!==b&&Zj(c.partManager,this,c),this.Fi=a,null!==c&&null!==a&&Wj(c.partManager,this));this.g("itemArray",b,a);null!==c&&c.undoManager.isUndoingRedoing||this.fu()}}},itemTemplate:{configurable:!0,get:function(){return null===this.ye?null:this.ye.K("")},set:function(a){if(null===this.ye){if(null===a)return;this.ye=new Db}var b=this.ye.K("");b!==a&&(x(a,U,U,"itemTemplate"),(a instanceof S||a.isPanelMain)&&v("Panel.itemTemplate must not be a Part or be Panel.isPanelMain: "+
a),this.ye.add("",a),this.g("itemTemplate",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.fu())}},itemTemplateMap:{configurable:!0,get:function(){return this.ye},set:function(a){var b=this.ye;if(b!==a){x(a,Db,U,"itemTemplateMap");for(var c=a.iterator;c.next();){var d=c.value;F&&(d instanceof S||d.isPanelMain)&&v("Template in Panel.itemTemplateMap must not be a Part or be Panel.isPanelMain: "+d)}this.ye=a;this.g("itemTemplateMap",b,a);a=this.diagram;null!==a&&a.undoManager.isUndoingRedoing||
this.fu()}}},itemCategoryProperty:{configurable:!0,get:function(){return this.Fl},set:function(a){var b=this.Fl;b!==a&&("string"!==typeof a&&"function"!==typeof a&&xa(a,"string or function",U,"itemCategoryProperty"),this.Fl=a,this.g("itemCategoryProperty",b,a))}},isAtomic:{configurable:!0,get:function(){return 0!==(this.I&1048576)},set:function(a){var b=0!==(this.I&1048576);b!==a&&(A(a,"boolean",U,"isAtomic"),this.I^=1048576,this.g("isAtomic",b,a))}},isClipping:{configurable:!0,
enumerable:!0,get:function(){return 0!==(this.I&2097152)},set:function(a){var b=0!==(this.I&2097152);b!==a&&(A(a,"boolean",U,"isClipping"),a&&this.type!==U.Spot&&Ca("Warning: Panel.isClipping set on non-Spot Panel: "+this.toString()),this.I^=2097152,this.u(),this.g("isClipping",b,a))}},isOpposite:{configurable:!0,get:function(){return 0!==(this.I&33554432)},set:function(a){var b=0!==(this.I&33554432);b!==a&&(A(a,"boolean",U,"isOpposite"),this.I^=33554432,this.u(),this.g("isOpposite",
b,a))}},isEnabled:{configurable:!0,get:function(){return 0!==(this.I&4194304)},set:function(a){var b=0!==(this.I&4194304);if(b!==a){A(a,"boolean",U,"isEnabled");var c=null===this.panel||this.panel.Mg();this.I^=4194304;this.g("isEnabled",b,a);b=this.diagram;null!==b&&b.undoManager.isUndoingRedoing||c&&yn(this,this,a)}}},alignmentFocusName:{configurable:!0,get:function(){return this.Rg},set:function(a){var b=this.Rg;b!==a&&(F&&A(a,"string",U,"alignmentFocusName"),this.Rg=
a,this.u(),this.g("alignmentFocusName",b,a))}}});
ma.Object.defineProperties(U,{Position:{configurable:!0,get:function(){return cm.K("Position")}},Horizontal:{configurable:!0,get:function(){return cm.K("Horizontal")}},Vertical:{configurable:!0,get:function(){return cm.K("Vertical")}},Spot:{configurable:!0,get:function(){return cm.K("Spot")}},Auto:{configurable:!0,get:function(){return cm.K("Auto")}},Table:{configurable:!0,get:function(){return cm.K("Table")}},Viewbox:{configurable:!0,
enumerable:!0,get:function(){return cm.K("Viewbox")}},TableRow:{configurable:!0,get:function(){return cm.K("TableRow")}},TableColumn:{configurable:!0,get:function(){return cm.K("TableColumn")}},Link:{configurable:!0,get:function(){return cm.K("Link")}},Grid:{configurable:!0,get:function(){return cm.K("Grid")}},Graduated:{configurable:!0,get:function(){return cm.K("Graduated")}}});U.prototype.findItemPanelForData=U.prototype.oy;
U.prototype.rebuildItemElements=U.prototype.fu;U.prototype.updateTargetBindings=U.prototype.Ga;U.prototype.copyTemplate=U.prototype.Az;U.prototype.graduatedValueForPoint=U.prototype.nA;U.prototype.graduatedPointForValue=U.prototype.mA;U.prototype.findColumnForLocalX=U.prototype.Pz;U.prototype.findRowForLocalY=U.prototype.Xz;U.prototype.removeColumnDefinition=U.prototype.vw;U.prototype.removeRowDefinition=U.prototype.xw;U.prototype.removeAt=U.prototype.hb;U.prototype.remove=U.prototype.remove;
U.prototype.insertAt=U.prototype.zb;U.prototype.elt=U.prototype.O;U.prototype.add=U.prototype.add;U.prototype.findObject=U.prototype.fb;U.prototype.findInVisualTree=U.prototype.ym;U.prototype.walkVisualTreeFrom=U.prototype.Nk;U.prototype.findMainElement=U.prototype.yb;var Bn=!1,Fn=!1,Gn=null,cm=new Db;U.className="Panel";U.definePanelLayout=Jn;Jn("Position",new Mm);Jn("Vertical",new Pm);Jn("Auto",new Rm);Jn("Link",new bn);
function ik(){fb(this);this.wg=null;this.rs=!0;this.Ua=0;this.Xc=NaN;this.rh=0;this.qh=Infinity;this.Cb=ld;this.sa=this.na=0;this.jb=null;this.aq=Kn;this.Ke=kl;this.Vp=this.zg=null;this.Wp=NaN;this.ob=this.bk=null;this.Jn=!1}
ik.prototype.copy=function(){var a=new ik;a.rs=this.rs;a.Ua=this.Ua;a.Xc=this.Xc;a.rh=this.rh;a.qh=this.qh;a.Cb=this.Cb;a.na=this.na;a.sa=this.sa;a.Ke=this.Ke;a.aq=this.aq;null===this.zg?a.zg=null:a.zg=this.zg.J();a.Vp=this.Vp;a.Wp=this.Wp;a.bk=null;null!==this.bk&&(a.separatorDashArray=Ia(this.separatorDashArray));a.ob=this.ob;a.Jn=this.Jn;a.jb=this.jb;return a};t=ik.prototype;
t.Et=function(a){x(a,ik,ik,"copyFrom:pd");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.zg=null===a.separatorPadding?null:a.separatorPadding.J();this.separatorStroke=a.separatorStroke;this.separatorStrokeWidth=a.separatorStrokeWidth;this.bk=null;a.separatorDashArray&&(this.bk=Ia(a.separatorDashArray));this.background=a.background;this.coversSeparators=a.coversSeparators;this.jb=
a.jb};t.mb=function(a){a.classType===ik?this.sizing=a:Ba(this,a)};t.toString=function(){return"RowColumnDefinition "+(this.isRow?"(Row ":"(Column ")+this.index+") #"+sb(this)};t.rj=function(a){this.wg=a};
t.Jv=function(){var a=0,b=0,c=this.wg,d=this.isRow;if(null!==c&&c.type===U.Table)for(var e=d?c.xb.length:c.tb.length,f=0;f<e;f++){var g=d?c.xb[f]:c.tb[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.zg;if(null===b)if(null!==c)b=
c.defaultSeparatorPadding;else return a;return a+(this.isRow?b.top:b.left)};
t.Ac=function(){var a=0,b=this.wg,c=0,d=this.isRow;if(null!==b&&b.type===U.Table)for(var e=d?b.xb.length:b.tb.length,f=0;f<e;f++){var g=d?b.xb[f]:b.tb[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.zg;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.Eb=function(a,b,c){var d=this.wg;if(null!==d&&(d.gb(He,a,this,b,c,void 0,void 0),null!==this.jb&&(b=d.diagram,null!==b&&!b.skipsModelSourceBindings&&(d=d.ij(),null!==d&&(b=d.data,null!==b)))))for(c=this.jb.iterator;c.next();)c.value.pr(this,b,a,d)};function Vm(a){if(a.sizing===Kn){var b=a.wg;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&&Yl(c)&&v("Cannot add a Binding to a RowColumnDefinition that is already frozen: "+a+" on "+b)}null===this.jb&&(this.jb=new H);this.jb.add(a)};
ma.Object.defineProperties(ik.prototype,{panel:{configurable:!0,get:function(){return this.wg}},isRow:{configurable:!0,get:function(){return this.rs},set:function(a){this.rs=a}},index:{configurable:!0,get:function(){return this.Ua},set:function(a){this.Ua=a}},height:{configurable:!0,get:function(){return this.Xc},set:function(a){var b=this.Xc;b!==a&&(F&&A(a,"number",ik,"height"),0>a&&ya(a,">= 0",ik,"height"),this.Xc=a,this.actual=this.na,null!==
this.panel&&this.panel.u(),this.Eb("height",b,a))}},width:{configurable:!0,get:function(){return this.Xc},set:function(a){var b=this.Xc;b!==a&&(F&&A(a,"number",ik,"width"),0>a&&ya(a,">= 0",ik,"width"),this.Xc=a,this.actual=this.na,null!==this.panel&&this.panel.u(),this.Eb("width",b,a))}},minimum:{configurable:!0,get:function(){return this.rh},set:function(a){var b=this.rh;b!==a&&(F&&A(a,"number",ik,"minimum"),(0>a||!isFinite(a))&&ya(a,">= 0",ik,"minimum"),this.rh=a,this.actual=
this.na,null!==this.panel&&this.panel.u(),this.Eb("minimum",b,a))}},maximum:{configurable:!0,get:function(){return this.qh},set:function(a){var b=this.qh;b!==a&&(F&&A(a,"number",ik,"maximum"),0>a&&ya(a,">= 0",ik,"maximum"),this.qh=a,this.actual=this.na,null!==this.panel&&this.panel.u(),this.Eb("maximum",b,a))}},alignment:{configurable:!0,get:function(){return this.Cb},set:function(a){var b=this.Cb;b.A(a)||(F&&x(a,M,ik,"alignment"),this.Cb=a.J(),null!==this.panel&&this.panel.u(),
this.Eb("alignment",b,a))}},stretch:{configurable:!0,get:function(){return this.Ke},set:function(a){var b=this.Ke;b!==a&&(F&&hb(a,N,ik,"stretch"),this.Ke=a,null!==this.panel&&this.panel.u(),this.Eb("stretch",b,a))}},separatorPadding:{configurable:!0,get:function(){return this.zg},set:function(a){"number"===typeof a?a=new lc(a):null!==a&&F&&x(a,lc,ik,"separatorPadding");var b=this.zg;null!==a&&null!==b&&b.A(a)||(null!==a&&(a=a.J()),this.zg=a,null!==this.panel&&this.panel.u(),
this.Eb("separatorPadding",b,a))}},separatorStroke:{configurable:!0,get:function(){return this.Vp},set:function(a){var b=this.Vp;b!==a&&(null!==a&&gm(a,"RowColumnDefinition.separatorStroke"),a instanceof Jl&&a.freeze(),this.Vp=a,null!==this.panel&&this.panel.u(),this.Eb("separatorStroke",b,a))}},separatorStrokeWidth:{configurable:!0,get:function(){return this.Wp},set:function(a){var b=this.Wp;b!==a&&(this.Wp=a,null!==this.panel&&this.panel.u(),this.Eb("separatorStrokeWidth",
b,a))}},separatorDashArray:{configurable:!0,get:function(){return this.bk},set:function(a){var b=this.bk;if(b!==a){null===a||Array.isArray(a)||xa(a,"Array",ik,"separatorDashArray:value");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)||v("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.bk=a;null!==this.panel&&this.panel.P();this.Eb("separatorDashArray",
b,a)}}},background:{configurable:!0,get:function(){return this.ob},set:function(a){var b=this.ob;b!==a&&(null!==a&&gm(a,"RowColumnDefinition.background"),a instanceof Jl&&a.freeze(),this.ob=a,null!==this.panel&&this.panel.P(),this.Eb("background",b,a))}},coversSeparators:{configurable:!0,get:function(){return this.Jn},set:function(a){var b=this.Jn;b!==a&&(A(a,"boolean",ik,"coversSeparators"),this.Jn=a,null!==this.panel&&this.panel.P(),this.Eb("coversSeparators",b,a))}},
sizing:{configurable:!0,get:function(){return this.aq},set:function(a){var b=this.aq;b!==a&&(F&&hb(a,ik,ik,"sizing"),this.aq=a,null!==this.panel&&this.panel.u(),this.Eb("sizing",b,a))}},actual:{configurable:!0,get:function(){return this.na},set:function(a){this.na=isNaN(this.Xc)?Math.max(Math.min(this.qh,a),this.rh):Math.max(Math.min(this.qh,this.Xc),this.rh)}},total:{configurable:!0,get:function(){return this.na+this.Ac()},set:function(a){this.na=isNaN(this.Xc)?
Math.max(Math.min(this.qh,a),this.rh):Math.max(Math.min(this.qh,this.Xc),this.rh);this.na=Math.max(0,this.na-this.Ac())}},position:{configurable:!0,get:function(){return this.sa},set:function(a){this.sa=a}}});ik.prototype.bind=ik.prototype.bind;ik.prototype.computeEffectiveSpacing=ik.prototype.Ac;ik.prototype.computeEffectiveSpacingTop=ik.prototype.Jv;var Kn=new E(ik,"Default",0),Wm=new E(ik,"None",1),on=new E(ik,"ProportionalExtra",2);ik.className="RowColumnDefinition";ik.Default=Kn;
ik.None=Wm;ik.ProportionalExtra=on;function Yf(){N.call(this);this.Bd=this.qa=null;this.Zn="None";this.io=kl;this.Kc=this.nl="black";this.Bh=1;this.gm="butt";this.hm="miter";this.ck=10;this.zh=null;this.Ah=0;this.wf=this.vf=ld;this.vp=this.tp=NaN;this.uo=!1;this.xp=null;this.pl=this.nm="None";this.Rd=1;this.Pd=0;this.Nd=1;this.Od=null}la(Yf,N);
Yf.prototype.cloneProtected=function(a){N.prototype.cloneProtected.call(this,a);a.qa=this.qa;a.Zn=this.Zn;a.io=this.io;a.Bd=this.Bd;a.nl=this.nl;a.Kc=this.Kc;a.Bh=this.Bh;a.gm=this.gm;a.hm=this.hm;a.ck=this.ck;null!==this.zh&&(a.zh=Ia(this.zh));a.Ah=this.Ah;a.vf=this.vf.J();a.wf=this.wf.J();a.tp=this.tp;a.vp=this.vp;a.uo=this.uo;a.xp=this.xp;a.nm=this.nm;a.pl=this.pl;a.Rd=this.Rd;a.Pd=this.Pd;a.Nd=this.Nd;a.Od=this.Od};t=Yf.prototype;
t.mb=function(a){a===Mg||a===Og||a===nl||a===kl?this.geometryStretch=a:N.prototype.mb.call(this,a)};t.toString=function(){return"Shape("+("None"!==this.figure?this.figure:"None"!==this.toArrow?this.toArrow:this.fromArrow)+")#"+sb(this)};
function Vn(a,b,c,d){var e=c.length;if(!(4>e)){var f=d.measuredBounds,g=Math.max(1,f.width);f=f.height;for(var h=c[0],k=c[1],l,m,n,p,r,q,u=0,w=La(),y=2;y<e;y+=2)l=c[y],m=c[y+1],n=l-h,h=m-k,0===n&&(n=.001),p=h/n,r=Math.atan2(h,n),q=Math.sqrt(n*n+h*h),w.push([n,r,p,q]),u+=q,h=l,k=m;h=c[0];k=c[1];n=d.measuredBounds.width;d instanceof Yf&&(n-=d.strokeWidth);1>n&&(n=1);e=c=n;l=g/2;m=0===l?!1:!0;y=0;q=w[y];n=q[0];r=q[1];p=q[2];q=q[3];for(var z=0;.1<=u;){0===z&&(m?(e=c,e-=l,u-=l,m=!1):e=c,0===e&&(e=1));
if(e>u){Oa(w);return}e>q?(z=e-q,e=q):z=0;var B=Math.sqrt(e*e/(1+p*p));0>n&&(B=-B);h+=B;k+=p*B;a.translate(h,k);a.rotate(r);a.translate(-(g/2),-(f/2));0===z&&d.ej(a,b);a.translate(g/2,f/2);a.rotate(-r);a.translate(-h,-k);u-=e;q-=e;if(0!==z){y++;if(y===w.length){Oa(w);return}q=w[y];n=q[0];r=q[1];p=q[2];q=q[3];e=z}}Oa(w)}}
t.ej=function(a,b){var c=this.Kc,d=this.nl;if(null!==c||null!==d){var e=this.actualBounds,f=this.naturalBounds;null!==d&&Ai(this,a,d,!0,!1,f,e);var g=this.part,h=this.Bh;null!==c&&0===h&&null!==g&&(h=g.type===U.Link&&g instanceof Te&&"Selection"===g.category&&g.adornedObject instanceof Yf&&g.adornedPart.yb()===g.adornedObject?g.adornedObject.strokeWidth:0);null!==c&&0!==h&&(Ai(this,a,c,!1,!1,f,e),a.lineWidth=h,a.lineJoin=this.hm,a.lineCap=this.gm,a.miterLimit=this.ck);e=!1;g&&b.Re("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.Ht(k,this.Ah));var l=this.qa;if(null!==l){if(l.type===Id)a.beginPath(),a.moveTo(l.startX,l.startY),a.lineTo(l.endX,l.endY),null!==d&&a.de(d),0!==h&&null!==c&&a.uj();else if(l.type===Md){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.de(d);if(null!==c){g&&e&&Il(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&&Hl(a)}}else if(l.type===Ud)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.Qg*l,k-r,m+l,k-K.Qg*r,m+l,k),a.bezierCurveTo(m+l,k+K.Qg*r,m+K.Qg*l,k+r,m,k+r),a.bezierCurveTo(m-K.Qg*l,k+r,m-l,k+K.Qg*r,m-l,k),a.bezierCurveTo(m-l,k-K.Qg*r,m-K.Qg*l,k-r,m,k-r),a.closePath(),null!==d&&a.de(d),0!==h&&null!==c&&(g&&e?(Il(a),
a.uj(),Hl(a)):a.uj());else if(l.type===Gd)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 w=n[u];switch(w.type){case ie:a.moveTo(w.endX,w.endY);break;case Kd:a.lineTo(w.endX,w.endY);break;case je:a.bezierCurveTo(w.point1X,w.point1Y,w.point2X,w.point2Y,w.endX,w.endY);break;case ke:a.quadraticCurveTo(w.point1X,w.point1Y,w.endX,w.endY);break;case le:if(w.radiusX===w.radiusY){var y=Math.PI/180;a.arc(w.point1X,
w.point1Y,w.radiusX,w.startAngle*y,(w.startAngle+w.sweepAngle)*y,0>w.sweepAngle,null!==q?q.endX:m.startX,null!==q?q.endY:m.startY)}else if(q=ne(w,m),y=q.length,0===y)a.lineTo(w.centerX,w.centerY);else for(var z=0;z<y;z++){var B=q[z];0===z&&a.lineTo(B[0],B[1]);a.bezierCurveTo(B[2],B[3],B[4],B[5],B[6],B[7])}break;case me:z=y=0;if(null!==q&&q.type===le){q=ne(q,m);B=q.length;if(0===B){a.lineTo(w.centerX,w.centerY);break}q=q[B-1]||null;null!==q&&(y=q[6],z=q[7])}else y=null!==q?q.endX:m.startX,z=null!==
q?q.endY:m.startY;q=oe(w,m,y,z);y=q.length;if(0===y){a.lineTo(w.centerX,w.centerY);break}for(z=0;z<y;z++)B=q[z],a.bezierCurveTo(B[2],B[3],B[4],B[5],B[6],B[7]);break;default:v("Segment not of valid type: "+w.type)}w.isClosed&&a.closePath();q=w}e?m.isShadowed?(!0===m.isFilled&&"transparent"!==d&&null!==d&&a.de(d),0!==h&&null!==c&&(g&&Il(a),a.uj(),g&&Hl(a))):(g&&Il(a),!0===m.isFilled&&"transparent"!==d&&null!==d&&a.de(d),0!==h&&null!==c&&a.uj(),g&&Hl(a)):(!0===m.isFilled&&null!==d&&a.de(d),0!==h&&null!==
c&&a.uj())}f&&a.Ft();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=La();if(h.type===Id)d.push(h.startX),d.push(h.startY),d.push(h.endX),d.push(h.endY),Vn(a,b,d,c);else if(h.type===Gd)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 ie:Vn(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 Kd:d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;break;case je:K.Oe(g,f,p.point1X,p.point1Y,p.point2X,p.point2Y,p.endX,p.endY,.5,d);g=p.endX;f=p.endY;break;case ke:K.$q(g,f,p.point1X,p.point1Y,p.endX,p.endY,.5,d);g=p.endX;f=p.endY;break;case le:u=ne(p,e);w=u.length;if(0===w){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(q=0;q<w;q++)y=u[q],K.Oe(g,f,y[2],y[3],y[4],y[5],y[6],y[7],.5,d),g=y[6],
f=y[7];break;case me:u=oe(p,e,g,f);w=u.length;if(0===w){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(q=0;q<w;q++)y=u[q],K.Oe(g,f,y[2],y[3],y[4],y[5],y[6],y[7],.5,d),g=y[6],f=y[7];break;default:v("Segment not of valid type: "+p.type)}p.isClosed&&(d.push(k),d.push(l),Vn(a,b,d,c))}Vn(a,b,d,c)}else if(h.type===Md)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),Vn(a,
b,d,c);else if(h.type===Ud){f=new te;f.startX=h.endX;f.startY=(h.startY+h.endY)/2;g=new ue(le);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=ne(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.Oe(g,f,l[2],l[3],l[4],l[5],l[6],l[7],.5,d),g=l[6],f=l[7];Vn(a,b,d,c)}Oa(d);a.restore();a.yc(!1)}}}};
t.ma=function(a,b){void 0===b&&(b=new J);if(a instanceof M){a.Tb()&&v("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.Cd.xa(b);return b};
t.Cm=function(a){void 0===a&&(a=new L);var b=this.naturalBounds,c=this.Cd;b=L.allocAt(b.x,b.y,b.width,b.height);var d=this.strokeWidth;b.Lc(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);qc(a,d.x,d.y,0,0);d.h(b.right,b.bottom).transform(c);qc(a,d.x,d.y,0,0);d.h(b.x,b.bottom).transform(c);qc(a,d.x,d.y,0,0);L.free(b);J.free(d);return a};
t.Ph=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!==Id||b||(e+=2);var f=L.alloc();f.assign(d);f.Lc(e+2,e+2);if(!f.fa(a))return L.free(f),!1;d=e+1E-4;if(c.type===Id){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;L.free(f);return K.Ub(c.startX,c.startY,c.endX,c.endY,e,a.x,a.y)}if(c.type===
Md){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.Lc(-d,-d);if(f.fa(a))return L.free(f),!1;f.Lc(d,d)}null!==this.stroke&&f.Lc(e,e);a=f.fa(a);L.free(f);return a}if(c.type===Ud){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 L.free(f),!1;
g+=d;e+=d}null!==this.stroke&&(g+=d,e+=d);L.free(f);return 0>=g||0>=e?!1:1>=c*c/(g*g)+b*b/(e*e)}if(c.type===Gd)return L.free(f),null===this.fill?re(c,a.x,a.y,e):pe(c,a,e,1<this.strokeWidth,b);v("Unknown Geometry type: "+c.type);return!1};
t.Im=function(a,b,c,d){var e=this.desiredSize,f=this.Bh;a=Math.max(a,0);b=Math.max(b,0);if(null!==this.Bd)var g=this.geometry.bounds;else{var h=this.figure,k=Wn[h];if(void 0===k){var l=K.le[h];"string"===typeof l&&(l=K.le[l]);"function"===typeof l?(k=l(null,100,100),Wn[h]=k):v("Unsupported Figure: "+h)}g=k.bounds}h=g.width;k=g.height;l=g.width;var m=g.height;switch(Al(this,!0)){case Mg:d=c=0;break;case Hd:l=Math.max(a-f,0);m=Math.max(b-f,0);break;case ll:l=Math.max(a-f,0);d=0;break;case ml: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=Ng(this);switch(c){case Mg:break;case Hd:h=l;k=m;break;case Og:c=Math.min(l/h,m/k);isFinite(c)||(c=1);h*=c;k*=c;break;default:v(c+" is not a valid geometryStretch.")}null!==this.Bd?(h=Math.max(h,.01),k=Math.max(k,
.01),c=null!==this.Bd?this.Bd:this.qa,e=c.bounds,d=h/e.width,e=k/e.height,isFinite(d)||(d=1),isFinite(e)||(e=1),c=1===d&&1===e?c:c.copy().scale(d,e),F&&c.freeze(),this.qa=c):null!==this.qa&&K.ca(this.qa.zl,a-f)&&K.ca(this.qa.yl,b-f)||(this.qa=Yf.makeGeometry(this,h,k));g=this.qa.bounds;Infinity===a||Infinity===b?xl(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):xl(this,-(f/2),-(f/2),l+f,m+f)};
function Ng(a){var b=a.geometryStretch;return null!==a.Bd?b===kl?Hd:b:b===kl?Wn[a.figure].defaultStretch:b}t.Nh=function(a,b,c,d){Cl(this,a,b,c,d)};t.bd=function(a,b,c){return this.wk(a.x,a.y,b.x,b.y,c)};
t.wk=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.Bh/2;l=this.qa;null===l&&(this.measure(Infinity,Infinity),l=this.qa);p=l.bounds;m=!1;if(l.type===Id)if(1.5>=this.strokeWidth)m=K.Te(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=La();a=new J;K.Te(l.startX+d,l.startY+m,l.endX+d,l.endY+m,f,g,h,k,a)&&b.push(a);a=new J;K.Te(l.startX-d,l.startY-m,l.endX-d,l.endY-m,f,g,h,k,a)&&b.push(a);a=new J;K.Te(l.startX+d,l.startY+m,l.startX-d,l.startY-m,f,g,h,k,a)&&b.push(a);a=new J;K.Te(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 Oa(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);Oa(b)}else if(l.type===Md)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===Ud){b=L.allocAt(p.x,p.y,p.width,p.height).Lc(n,n);a:if(0===b.width)m=K.Te(b.x,b.y,b.x,b.y+b.height,f,g,h,k,e);else if(0===b.height)m=K.Te(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}L.free(b)}else if(l.type===Gd){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 w=0;w<l.figures.count;w++){var y=l.figures.j[w],z=y.segments;r=y.startX;q=y.startY;for(var B=r,D=q,G=0;G<z.count;G++){var O=
z.j[G],V=O.type;var P=O.endX;var ca=O.endY;var Y=!1;switch(V){case ie:B=P;D=ca;break;case Kd:Y=Xn(r,q,P,ca,f,g,h,k,p);break;case je:Y=K.zq(r,q,O.point1X,O.point1Y,O.point2X,O.point2Y,P,ca,f,g,h,k,.6,p);break;case ke:Y=K.zq(r,q,r+2/3*(O.point1X-r),q+2/3*(O.point1Y-q),P+2/3*(O.point1X-P),ca+2/3*(O.point1Y-ca),P,ca,f,g,h,k,.6,p);break;case le:case me:V=O.type===le?ne(O,y):oe(O,y,r,q);var oa=V.length;if(0===oa){Y=Xn(r,q,O.centerX,O.centerY,f,g,h,k,p);break}ca=null;for(P=0;P<oa;P++){ca=V[P];if(0===P&&
Xn(r,q,ca[0],ca[1],f,g,h,k,p)){var Da=Yn(f,g,p,u,e);Da<u&&(u=Da,m=!0)}K.zq(ca[0],ca[1],ca[2],ca[3],ca[4],ca[5],ca[6],ca[7],f,g,h,k,.6,p)&&(Da=Yn(f,g,p,u,e),Da<u&&(u=Da,m=!0))}P=ca[6];ca=ca[7];break;default:v("Unknown Segment type: "+V)}r=P;q=ca;Y&&(Y=Yn(f,g,p,u,e),Y<u&&(u=Y,m=!0));O.isClosed&&(P=B,ca=D,Xn(r,q,P,ca,f,g,h,k,p)&&(O=Yn(f,g,p,u,e),O<u&&(u=O,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 v("Unknown Geometry type: "+l.type);if(!m)return!1;this.transform.xa(e);
return!0};function Yn(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 Xn(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.ca(k.y,a))&&(k.y<b||K.ca(k.y,b))&&(l=!0)):(b=a<c?a:c,a=a<c?c:a,(k.x>b||K.ca(k.x,b))&&(k.x<a||K.ca(k.x,a))&&(l=!0));return l}
t.Oh=function(a,b){if(void 0===b)return a.Pe(this.actualBounds);var c=this.qa;null===c&&(this.measure(Infinity,Infinity),c=this.qa);c=c.bounds;var d=this.strokeWidth/2,e=!1,f=J.alloc();f.h(c.x-d,c.y-d);a.fa(b.xa(f))&&(f.h(c.x-d,c.bottom+d),a.fa(b.xa(f))&&(f.h(c.right+d,c.bottom+d),a.fa(b.xa(f))&&(f.h(c.right+d,c.y-d),a.fa(b.xa(f))&&(e=!0))));J.free(f);return e};
t.Oc=function(a,b){if(this.Oh(a,b)||void 0===b&&(b=this.transform,a.Pe(this.actualBounds)))return!0;var c=Ib.alloc();c.set(b);c.Tt();var d=a.left,e=a.right,f=a.top;a=a.bottom;var g=J.alloc();g.h(d,f);c.xa(g);if(this.Ph(g,!0))return J.free(g),!0;g.h(e,f);c.xa(g);if(this.Ph(g,!0))return J.free(g),!0;g.h(d,a);c.xa(g);if(this.Ph(g,!0))return J.free(g),!0;g.h(e,a);c.xa(g);if(this.Ph(g,!0))return J.free(g),!0;var h=J.alloc(),k=J.alloc();c.set(b);c.kw(this.transform);c.Tt();h.x=e;h.y=f;h.transform(c);g.x=
d;g.y=f;g.transform(c);b=!1;Zn(this,g,h,k)?b=!0:(g.x=e,g.y=a,g.transform(c),Zn(this,g,h,k)?b=!0:(h.x=d,h.y=a,h.transform(c),Zn(this,g,h,k)?b=!0:(g.x=d,g.y=f,g.transform(c),Zn(this,g,h,k)&&(b=!0))));J.free(g);Ib.free(c);J.free(h);J.free(k);return b};function Zn(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.py=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.Ph(a,!0))return!0;var e=a.Qe(b),f=e;1.5<this.strokeWidth&&(e=this.strokeWidth/2+Math.sqrt(e),e*=e);b=this.qa;if(null===b&&(this.measure(Infinity,Infinity),b=this.qa,null===b))return!1;if(!c){var g=b.bounds,h=g.x,k=g.y,l=g.x+g.width;g=g.y+g.height;if(Lb(a.x,a.y,h,k)<=e&&Lb(a.x,a.y,l,k)<=e&&Lb(a.x,a.y,h,g)<=e&&Lb(a.x,a.y,l,g)<=e)return!0}h=b.startX;k=b.startY;l=
b.endX;g=b.endY;if(b.type===Id){if(c=Kb(a.x,a.y,h,k,l,g),b=(h-l)*(a.x-l)+(k-g)*(a.y-g),c<=(0<=(l-h)*(a.x-h)+(g-k)*(a.y-k)&&0<=b?e:f))return!0}else{if(b.type===Md)return b=!1,c&&(b=Kb(a.x,a.y,h,k,h,g)<=e||Kb(a.x,a.y,h,k,l,k)<=e||Kb(a.x,a.y,l,k,l,g)<=e||Kb(a.x,a.y,h,g,l,g)<=e),b;if(b.type===Ud){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 Kb(a.x,a.y,h,k,l,g)<=e?!0:!1;if(c){if(a=K.Gz(m,n,b,f),a*a<=e)return!0}else return Lb(b,f,-m,0)>=e||Lb(b,f,0,-n)>=e||
Lb(b,f,0,n)>=e||Lb(b,f,m,0)>=e?!1:!0}else if(b.type===Gd){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&&Kb(a.x,a.y,f,h,f,l)>e&&Kb(a.x,a.y,f,h,k,h)>e&&Kb(a.x,a.y,k,l,f,l)>e&&Kb(a.x,a.y,k,l,k,h)>e)return!1;f=Math.sqrt(e);if(c){if(null===this.fill?re(b,a.x,a.y,f):pe(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 ie:case Kd:g=n.endX;
m=n.endY;if(a.kd(g,m)>e)return!1;break;case je:var p=La();K.Oe(g,m,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.8,p);g=d(p,a);Oa(p);if(g)return!1;g=n.endX;m=n.endY;if(a.kd(g,m)>e)return!1;break;case ke:p=La();K.$q(g,m,n.point1X,n.point1Y,n.endX,n.endY,.8,p);g=d(p,a);Oa(p);if(g)return!1;g=n.endX;m=n.endY;if(a.kd(g,m)>e)return!1;break;case le:case me:p=n.type===le?ne(n,f):oe(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=La(),u=0;u<
r;u++)if(n=p[u],q.length=0,K.Oe(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],.8,q),d(q,a))return Oa(q),!1;Oa(q);null!==n&&(g=n[6],m=n[7]);break;default:v("Unknown Segment type: "+n.type)}}return!0}}}return!1};t.ic=function(){this.qa=null};function $n(a){var b=a.diagram;null!==b&&b.undoManager.isUndoingRedoing||(a.segmentOrientation=ln,"None"!==a.nm?(a.segmentIndex=-1,a.alignmentFocus=sd):"None"!==a.pl&&(a.segmentIndex=0,a.alignmentFocus=new M(1-sd.x,sd.y)))}
Yf.makeGeometry=function(a,b,c){if("None"!==a.toArrow)var d=ao[a.toArrow];else"None"!==a.fromArrow?d=ao[a.fromArrow]:(d=K.le[a.figure],"string"===typeof d&&(d=K.le[d]),void 0===d&&v("Unknown Shape.figure: "+a.figure),d=d(a,b,c),d.zl=b,d.yl=c);if(null===d){var e=K.le.Rectangle;"function"===typeof e&&(d=e(a,b,c))}F&&(d.bounds.width>b+1E-5||d.bounds.height>c+1E-5)&&v('Geometry made with figure "'+a.figure+'" has bounds '+d.bounds.toString()+" that are too large for the given size ("+b+","+c+"). See documentation for Shape.defineFigureGenerator.");
return d};function bo(a){var b=ao[a];if(void 0===b){var c=a.toLowerCase();if("none"===c)return"None";b=ao[c];if(void 0===b){var d=null,e;for(e in K.en)if(e.toLowerCase()===c){d=e;break}if(null!==d)return a=Vd(K.en[d],!1),ao[d]=a,c!==d&&(ao[c]=d),d}}return"string"===typeof b?b:b instanceof Fd?a:null}
ma.Object.defineProperties(Yf.prototype,{geometry:{configurable:!0,get:function(){return null!==this.qa?this.qa:this.Bd},set:function(a){var b=this.qa,c=this.Bd;if(b!==a){null!==a?(F&&x(a,Fd,Yf,"geometry"),this.Bd=this.qa=a.freeze()):this.Bd=this.qa=null;var d=this.part;null!==d&&(d.ph=NaN);this.u();this.g("geometry",b||c,a);ul(this)&&(a=this.part,null!==a&&vl(this,a,"geometryString"))}}},geometryString:{configurable:!0,get:function(){return null===this.geometry?"":this.geometry.toString()},
set:function(a){a=Vd(a);var b=a.normalize();this.geometry=a;this.position=a=J.allocAt(-b.x,-b.y);J.free(a)}},isGeometryPositioned:{configurable:!0,get:function(){return this.uo},set:function(a){F&&A(a,"boolean",Yf,"isGeometryPositioned");var b=this.uo;b!==a&&(this.uo=a,this.u(),this.g("isGeometryPositioned",b,a))}},fill:{configurable:!0,get:function(){return this.nl},set:function(a){var b=this.nl;b!==a&&(null!==a&&gm(a,"Shape.fill"),a instanceof Jl&&a.freeze(),this.nl=
a,this.P(),this.g("fill",b,a))}},stroke:{configurable:!0,get:function(){return this.Kc},set:function(a){var b=this.Kc;b!==a&&(null!==a&&gm(a,"Shape.stroke"),a instanceof Jl&&a.freeze(),this.Kc=a,this.P(),this.g("stroke",b,a))}},strokeWidth:{configurable:!0,get:function(){return this.Bh},set:function(a){var b=this.Bh;if(b!==a)if(F&&C(a,Yf,"strokeWidth"),0<=a){this.Bh=a;this.u();var c=this.part;null!==c&&(c.ph=NaN);this.g("strokeWidth",b,a)}else ya(a,"value >= 0",Yf,"strokeWidth:value")}},
strokeCap:{configurable:!0,get:function(){return this.gm},set:function(a){var b=this.gm;b!==a&&("string"!==typeof a||"butt"!==a&&"round"!==a&&"square"!==a?ya(a,'"butt", "round", or "square"',Yf,"strokeCap"):(this.gm=a,this.P(),this.g("strokeCap",b,a)))}},strokeJoin:{configurable:!0,get:function(){return this.hm},set:function(a){var b=this.hm;b!==a&&("string"!==typeof a||"miter"!==a&&"bevel"!==a&&"round"!==a?ya(a,'"miter", "bevel", or "round"',Yf,"strokeJoin"):(this.hm=
a,this.P(),this.g("strokeJoin",b,a)))}},strokeMiterLimit:{configurable:!0,get:function(){return this.ck},set:function(a){var b=this.ck;if(b!==a)if(F&&C(a,Yf,"strokeMiterLimit"),1<=a){this.ck=a;this.P();var c=this.part;null!==c&&(c.ph=NaN);this.g("strokeMiterLimit",b,a)}else F&&ya(a,"value >= 1",Yf,"strokeWidth:value")}},strokeDashArray:{configurable:!0,get:function(){return this.zh},set:function(a){var b=this.zh;if(b!==a){null===a||Array.isArray(a)||xa(a,"Array",Yf,"strokeDashArray:value");
if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];(!F||"number"===typeof f)&&0<=f&&isFinite(f)||v("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.zh=a;this.P();this.g("strokeDashArray",b,a)}}},strokeDashOffset:{configurable:!0,get:function(){return this.Ah},set:function(a){var b=this.Ah;b!==a&&(F&&C(a,Yf,"strokeDashOffset"),0<=a&&(this.Ah=a,this.P(),this.g("strokeDashOffset",b,a)))}},figure:{configurable:!0,
enumerable:!0,get:function(){return this.Zn},set:function(a){var b=this.Zn;if(b!==a){F&&A(a,"string",Yf,"figure");var c=K.le[a];"function"===typeof c?c=a:(c=K.le[a.toLowerCase()])||v("Unknown Shape.figure: "+a);b!==c&&(a=this.part,null!==a&&(a.ph=NaN),this.Zn=c,this.Bd=null,this.ic(),this.u(),this.g("figure",b,c))}}},toArrow:{configurable:!0,get:function(){return this.nm},set:function(a){var b=this.nm;!0===a?a="Standard":!1===a&&(a="");if(b!==a){F&&A(a,"string",Yf,"toArrow");var c=bo(a);
null===c?v("Unknown Shape.toArrow: "+a):b!==c&&(this.nm=c,this.Bd=null,this.ic(),this.u(),$n(this),this.g("toArrow",b,c))}}},fromArrow:{configurable:!0,get:function(){return this.pl},set:function(a){var b=this.pl;!0===a?a="Standard":!1===a&&(a="");if(b!==a){F&&A(a,"string",Yf,"fromArrow");var c=bo(a);null===c?v("Unknown Shape.fromArrow: "+a):b!==c&&(this.pl=c,this.Bd=null,this.ic(),this.u(),$n(this),this.g("fromArrow",b,c))}}},spot1:{configurable:!0,get:function(){return this.vf},
set:function(a){x(a,M,Yf,"spot1");var b=this.vf;b.A(a)||(this.vf=a=a.J(),this.u(),this.g("spot1",b,a))}},spot2:{configurable:!0,get:function(){return this.wf},set:function(a){x(a,M,Yf,"spot2");var b=this.wf;b.A(a)||(this.wf=a=a.J(),this.u(),this.g("spot2",b,a))}},parameter1:{configurable:!0,get:function(){return this.tp},set:function(a){var b=this.tp;b!==a&&(this.tp=a,this.ic(),this.u(),this.g("parameter1",b,a))}},parameter2:{configurable:!0,get:function(){return this.vp},
set:function(a){var b=this.vp;b!==a&&(this.vp=a,this.ic(),this.u(),this.g("parameter2",b,a))}},naturalBounds:{configurable:!0,get:function(){if(null!==this.qa)return this.uc.assign(this.qa.bounds),this.uc;var a=this.desiredSize;return new L(0,0,a.width,a.height)}},pathPattern:{configurable:!0,get:function(){return this.xp},set:function(a){var b=this.xp;b!==a&&(F&&null!==a&&x(a,N,Yf,"pathPattern"),this.xp=a,this.P(),this.g("pathPattern",b,a))}},geometryStretch:{configurable:!0,
enumerable:!0,get:function(){return this.io},set:function(a){var b=this.io;b!==a&&(hb(a,N,Yf,"geometryStretch"),this.io=a,this.g("geometryStretch",b,a))}},interval:{configurable:!0,get:function(){return this.Rd},set:function(a){var b=this.Rd;F&&C(a,Yf,"interval");a=Math.round(a);if(b!==a&&0!==a&&isFinite(a)){this.Rd=a;var c=this.diagram;null!==c&&this.panel===c.grid&&Dj(c);this.u();c=this.panel;null!==c&&(c.jh=null);this.g("interval",b,a)}}},graduatedStart:{configurable:!0,
get:function(){return this.Pd},set:function(a){var b=this.Pd;F&&C(a,Yf,"graduatedStart");b!==a&&(0>a?a=0:1<a&&(a=1),this.Pd=a,this.u(),this.g("graduatedStart",b,a))}},graduatedEnd:{configurable:!0,get:function(){return this.Nd},set:function(a){var b=this.Nd;F&&C(a,Yf,"graduatedEnd");b!==a&&(0>a?a=0:1<a&&(a=1),this.Nd=a,this.u(),this.g("graduatedEnd",b,a))}},graduatedSkip:{configurable:!0,get:function(){return this.Od},set:function(a){var b=this.Od;b!==a&&(null!==a&&A(a,
"function",Yf,"graduatedSkip"),this.Od=a,this.u(),this.g("graduatedSkip",b,a))}}});Yf.prototype.intersectsRect=Yf.prototype.Oc;Yf.prototype.containedInRect=Yf.prototype.Oh;Yf.prototype.getNearestIntersectionPoint=Yf.prototype.bd;Yf.prototype.getDocumentBounds=Yf.prototype.Cm;Yf.prototype.getDocumentPoint=Yf.prototype.ma;var ao=new jb,Wn=new jb;Yf.className="Shape";Yf.getFigureGenerators=function(){var a=new Db,b;for(b in K.le)b!==b.toLowerCase()&&a.add(b,K.le[b]);a.freeze();return a};
Yf.defineFigureGenerator=function(a,b){A(a,"string",Yf,"defineFigureGenerator:name");"string"===typeof b?!F||""!==b&&K.le[b]||v("Shape.defineFigureGenerator synonym must not be empty or None or not a defined figure name: "+b):A(b,"function",Yf,"defineFigureGenerator:func");var c=a.toLowerCase();!F||""!==a&&a!==c||v("Shape.defineFigureGenerator name must not be empty or all-lower-case: "+a);var d=K.le;d[a]=b;d[c]=a};
Yf.getArrowheadGeometries=function(){var a=new Db;for(d in K.en)if(void 0===ao[d]){var b=Vd(K.en[d],!1);ao[d]=b;b=d.toLowerCase();b!==d&&(ao[b]=d)}for(var c in ao)if(c!==c.toLowerCase()){var d=ao[c];d instanceof Fd&&a.add(c,d)}a.freeze();return a};
Yf.defineArrowheadGeometry=function(a,b){A(a,"string",Yf,"defineArrowheadGeometry:name");"string"===typeof b?(A(b,"string",Yf,"defineArrowheadGeometry:pathstr"),b=Vd(b,!1)):x(b,Fd,Yf,"defineArrowheadGeometry:pathstr");var c=a.toLowerCase();(F&&""===a||"none"===c||a===c)&&v("Shape.defineArrowheadGeometry name must not be empty or None or all-lower-case: "+a);var d=ao;d[a]=b;d[c]=a};
function ih(){N.call(this);co||(eo=gh?(new Rk(null)).context:null,co=!0);this.Kx=this.Zb="";this.Kc="black";this.se="13px sans-serif";this.Xi="start";this.Md=Mg;this.aj=od;this.Mj=!0;this.Di=this.Ei=!1;this.ug=fo;this.Fg=go;this.As=this.vb=this.Vc=0;this.fv=this.gv=null;this.Wn=!1;this.Gc=this.yn=this.lq=this.Yi=this.mq=null;this.uf=this.tf=0;this.Be=Infinity;this.Gi=0;this.te=null;this.He=0;this.re=this.nb=this.Wb=null;this.Rd=1;this.Pd=0;this.Nd=1;this.Od=this.Ij=null}la(ih,N);
ih.prototype.cloneProtected=function(a){N.prototype.cloneProtected.call(this,a);a.Zb=this.Zb;a.Kx=this.Kx;a.Kc=this.Kc;a.se=this.se;a.Xi=this.Xi;a.Md=this.Md;a.aj=this.aj;a.Mj=this.Mj;a.Ei=this.Ei;a.Di=this.Di;a.ug=this.ug;a.Fg=this.Fg;a.Vc=this.Vc;a.As=this.As;a.vb=this.vb;a.gv=this.gv;a.fv=this.fv;a.Wn=this.Wn;a.mq=this.mq;a.Yi=this.Yi;a.lq=this.lq;a.yn=this.yn;a.Gc=this.Gc;a.tf=this.tf;a.uf=this.uf;a.Be=this.Be;a.te=this.te;a.He=this.He;a.Wb=this.Wb;a.nb=this.nb;a.re=this.re;a.Gi=this.Gi;a.Rd=
this.Rd;a.Pd=this.Pd;a.Nd=this.Nd;a.Ij=this.Ij;a.Od=this.Od};
function kn(a,b){a.I=b.I|6144;a.wb=b.opacity;a.ob=b.background;a.jc=b.areaBackground;a.Uc=b.desiredSize.J();a.ng=b.minSize.J();a.mg=b.maxSize.J();a.kg=b.kg.copy();a.Fa=b.scale;a.dc=b.angle;a.Ke=b.stretch;a.oh=b.margin.J();a.Cb=b.alignment.J();a.Uk=b.alignmentFocus.J();a.Xl=b.segmentFraction;a.Yl=b.segmentOffset.J();a.Zl=b.segmentOrientation;null!==b.sd&&(a.sd=b.sd.copy());a.am=b.shadowVisible;b instanceof ih&&(a.Zb=b.Zb,a.Kc=b.Kc,a.se=b.se,a.Xi=b.Xi,a.Md=b.Md,a.aj=b.aj,a.Mj=b.Mj,a.Ei=b.Ei,a.Di=b.Di,
a.ug=b.ug,a.Fg=b.Fg,a.te=null,a.tf=b.tf,a.uf=b.uf,a.Be=b.Be,a.Gi=b.Gi,a.Rd=b.Rd,a.Pd=b.Pd,a.Nd=b.Nd,a.Ij=b.Ij,a.Od=b.Od)}t=ih.prototype;t.mb=function(a){a.classType===ih?this.wrap=a:N.prototype.mb.call(this,a)};t.toString=function(){return 22<this.Zb.length?'TextBlock("'+this.Zb.substring(0,20)+'"...)':'TextBlock("'+this.Zb+'")'};t.u=function(){N.prototype.u.call(this);this.fv=this.gv=null};
function ho(a){co||(eo=gh?(new Rk(null)).context:null,co=!0);if(null===eo)return!0;var b=eo.font;if(a===b||"10px sans-serif"===a)return!0;eo.font="10px sans-serif";eo.font=a;var c=eo.font;if("10px sans-serif"!==c)return eo.font=b,!0;eo.font="19px serif";var d=eo.font;eo.font=a;c=eo.font;eo.font=b;return c!==d}
t.ej=function(a,b){if(null!==this.Kc&&0!==this.Zb.length&&null!==this.se){var c=this.naturalBounds,d=this.actualBounds,e=c.width,f=c.height,g=io(this),h=a.textAlign=this.Xi,k=b.Cl;"start"===h?h=k?"right":"left":"end"===h&&(h=k?"left":"right");k=this.Ei;var l=this.Di;Ai(this,a,this.Kc,!0,!1,c,d);(k||l)&&Ai(this,a,this.Kc,!1,!1,c,d);d=0;c=!1;var m=J.allocAt(0,0);this.Cd.xa(m);var n=J.allocAt(0,g);this.Cd.xa(n);var p=m.Qe(n);J.free(m);J.free(n);m=b.scale;8>p*m*m&&(c=!0);b.Lb!==a&&(c=!1);!1===b.Re("textGreeking")&&
(c=!1);b=this.tf;p=this.uf;switch(this.flip){case pl:a.translate(e,0);a.scale(-1,1);break;case ol:a.translate(0,f);a.scale(1,-1);break;case ql: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.re)p=this.vb,p>e&&(p=e),this.dj(this.re,a,0,d+b,e,g,p,c,h,k,l);else if(null!==this.Wb&&null!==this.nb)for(n=0;n<m;n++){var r=this.Wb[n];r>e&&(r=e);d+=b;this.dj(this.nb[n],a,0,d,e,g,r,c,h,k,l);d+=g+p}switch(this.flip){case pl:a.scale(-1,1);a.translate(-e,
0);break;case ol:a.scale(1,-1);a.translate(0,-f);break;case ql: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!==jo?jo(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!==ko?ko(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.Im=function(a,b,c,d){this.Gi=a;var e=this.se;null!==eo&&lo!==e&&(lo=eo.font=e);this.vb=this.He=0;this.re=this.nb=this.Wb=this.te=null;var f;if(isNaN(this.desiredSize.width)){e=this.Zb.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,mo(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=mo(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=no(this,e);isNaN(this.desiredSize.height)?f=Math.min(f,b/this.scale):f=this.desiredSize.height;g=f;if(0!==this.vb&&null!==this.Wb&&null!==this.nb&&this.ug===oo&&(b=this.se,b=this.ug===oo?po(b):0,h=this.tf+this.uf,h=Math.max(0,io(this)+h),g=Math.min(this.maxLines-1,Math.max(Math.floor(g/h+.01)-1,0)),!(g+1>=this.nb.length))){h=this.nb[g];for(b=Math.max(1,a-b);mo(h)>b&&1<h.length;)h=h.substr(0,h.length-1);h+=qo;b=mo(h);
this.nb[g]=h;this.nb=this.nb.slice(0,g+1);this.Wb[g]=b;this.Wb=this.Wb.slice(0,g+1);this.He=this.nb.length;this.vb=Math.max(this.vb,b);this.Vc=this.He;1===this.Vc&&(this.re=this.nb[0])}if(this.wrap===ro||isNaN(this.desiredSize.width))e=isNaN(a)?this.vb:Math.min(a,this.vb),isNaN(this.desiredSize.width)&&(e=Math.max(8,e));e=Math.max(c,e);f=Math.max(d,f);gc(this.uc,e,f);xl(this,0,0,e,f)};t.Nh=function(a,b,c,d){Cl(this,a,b,c,d)};
function so(a,b,c){if(null===a.re)a.re=b,a.vb=c;else{if(null===a.nb||null===a.Wb)a.nb=[],a.Wb=[],a.nb.push(a.re),a.Wb.push(a.vb);a.nb.push(b);a.Wb.push(c)}}
function to(a,b,c,d){b=b.trim();var e=0;var f=a.se;var g=a.tf+a.uf;g=Math.max(0,io(a)+g);var h=a.ug===oo?po(f):0;if(a.Vc>=a.Be)null!==d&&d.h(0,g);else{var k=b;if(a.Fg===uo)if(a.He=1,f=mo(b),0===h||f<=c)a.vb=Math.max(a.vb,f),so(a,b,a.vb),null!==d&&d.h(f,g);else{e=vo(a,k);k=k.substr(e.length);b=vo(a,k);for(f=mo(e+b);0<b.length&&f<=c;)e+=b,k=k.substr(b.length),b=vo(a,k),f=mo((e+b).trim());e+=b.trim();for(c=Math.max(1,c-h);mo(e)>c&&1<e.length;)e=e.substr(0,e.length-1);e+=qo;b=mo(e);a.vb=b;so(a,e,b);null!==
d&&d.h(b,g)}else{h=0;0===k.length&&(h=1,so(a,k,0));for(;0<k.length;){var l=vo(a,k);for(k=k.substr(l.length);mo(l)>c;){var m=1;f=mo(l.substr(0,m));for(b=0;f<=c;)m++,b=f,f=mo(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);so(a,l.substr(0,m),n);h++;l=l.substr(m);if(a.Vc+h>a.Be)break}b=vo(a,k);for(f=mo(l+b);0<b.length&&f<=c;)l+=b,k=k.substr(b.length),b=vo(a,k),f=mo((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=mo(l),e=Math.max(e,b)),so(a,l,m),h++,a.Vc+h>a.Be))break}a.He=Math.min(a.Be,h);a.vb=Math.max(a.vb,e);null!==d&&d.h(a.vb,g*a.He)}}}function vo(a,b){if(a.Fg===wo)return b.substr(0,1);a=b.length;for(var c=0,d=xo;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 mo(a){return null===eo?8*a.length:eo.measureText(a).width}
function io(a){if(null!==a.te)return a.te;var b=a.se;if(null===eo){var c=16;return a.te=c}void 0!==yo[b]&&5E3>zo?c=yo[b]:(c=1.3*eo.measureText("M").width,yo[b]=c,zo++);return a.te=c}function po(a){if(null===eo)return 6;if(void 0!==Ao[a]&&5E3>Bo)var b=Ao[a];else b=eo.measureText(qo).width,Ao[a]=b,Bo++;return b}
function no(a,b){var c=a.Zb.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),d=a.tf+a.uf;d=Math.max(0,io(a)+d);if(0===c.length)return a.vb=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.Fg!==uo){a.He=0;var k=Hb.alloc();to(a,f,b,k);e+=k.height;Hb.free(k);a.Vc+=a.He}else to(a,f,b,null),e+=d,a.Vc++;a.Vc===a.Be&&(h=!0)}f=g+1}return a.As=e}
ma.Object.defineProperties(ih.prototype,{font:{configurable:!0,get:function(){return this.se},set:function(a){var b=this.se;b!==a&&(F&&(A(a,"string",ih,"font"),ho(a)||v('Not a valid font: "'+a+'"')),this.se=a,this.te=null,this.u(),this.g("font",b,a))}},text:{configurable:!0,get:function(){return this.Zb},set:function(a){var b=this.Zb;null!==a&&void 0!==a?a=a.toString():a="";b!==a&&(this.Zb=a,this.u(),this.g("text",b,a))}},textAlign:{configurable:!0,get:function(){return this.Xi},
set:function(a){var b=this.Xi;b!==a&&(F&&A(a,"string",ih,"textAlign"),"start"===a||"end"===a||"left"===a||"right"===a||"center"===a?(this.Xi=a,this.P(),this.g("textAlign",b,a)):F&&ya(a,'"start", "end", "left", "right", or "center"',ih,"textAlign"))}},flip:{configurable:!0,get:function(){return this.Md},set:function(a){var b=this.Md;b!==a&&(hb(a,N,ih,"flip"),this.Md=a,this.P(),this.g("flip",b,a))}},verticalAlignment:{configurable:!0,get:function(){return this.aj},set:function(a){var b=
this.aj;b.A(a)||(F&&(x(a,M,ih,"verticalAlignment"),a.Tb()&&v("TextBlock.verticalAlignment for "+this+" must be a real Spot, not:"+a)),this.aj=a=a.J(),Sl(this),this.g("verticalAlignment",b,a))}},naturalBounds:{configurable:!0,get:function(){if(!this.uc.o()){var a=Hb.alloc();to(this,this.Zb,999999,a);var b=a.width;Hb.free(a);a=no(this,b);var c=this.desiredSize;isNaN(c.width)||(b=c.width);isNaN(c.height)||(a=c.height);gc(this.uc,b,a)}return this.uc}},isMultiline:{configurable:!0,
get:function(){return this.Mj},set:function(a){var b=this.Mj;b!==a&&(F&&A(a,"boolean",ih,"isMultiline"),this.Mj=a,this.u(),this.g("isMultiline",b,a))}},isUnderline:{configurable:!0,get:function(){return this.Ei},set:function(a){var b=this.Ei;b!==a&&(F&&A(a,"boolean",ih,"isUnderline"),this.Ei=a,this.P(),this.g("isUnderline",b,a))}},isStrikethrough:{configurable:!0,get:function(){return this.Di},set:function(a){var b=this.Di;b!==a&&(F&&A(a,"boolean",ih,"isStrikethrough"),
this.Di=a,this.P(),this.g("isStrikethrough",b,a))}},wrap:{configurable:!0,get:function(){return this.Fg},set:function(a){var b=this.Fg;b!==a&&(F&&hb(a,ih,ih,"wrap"),this.Fg=a,this.u(),this.g("wrap",b,a))}},overflow:{configurable:!0,get:function(){return this.ug},set:function(a){var b=this.ug;b!==a&&(F&&hb(a,ih,ih,"overflow"),this.ug=a,this.u(),this.g("overflow",b,a))}},stroke:{configurable:!0,get:function(){return this.Kc},set:function(a){var b=this.Kc;b!==
a&&(null!==a&&gm(a,"TextBlock.stroke"),a instanceof Jl&&a.freeze(),this.Kc=a,this.P(),this.g("stroke",b,a))}},lineCount:{configurable:!0,get:function(){return this.Vc}},editable:{configurable:!0,get:function(){return this.Wn},set:function(a){var b=this.Wn;b!==a&&(F&&A(a,"boolean",ih,"editable"),this.Wn=a,this.g("editable",b,a))}},textEditor:{configurable:!0,get:function(){return this.mq},set:function(a){var b=this.mq;b!==a&&(!F||a instanceof bf||v("TextBlock.textEditor must be an HTMLInfo."),
this.mq=a,this.g("textEditor",b,a))}},errorFunction:{configurable:!0,get:function(){return this.Gc},set:function(a){var b=this.Gc;b!==a&&(null!==a&&A(a,"function",ih,"errorFunction"),this.Gc=a,this.g("errorFunction",b,a))}},interval:{configurable:!0,get:function(){return this.Rd},set:function(a){var b=this.Rd;F&&C(a,ih,"interval");a=Math.round(a);if(b!==a&&0!==a&&isFinite(a)){this.Rd=a;this.u();var c=this.panel;null!==c&&(c.jh=null);this.g("interval",b,a)}}},graduatedStart:{configurable:!0,
enumerable:!0,get:function(){return this.Pd},set:function(a){var b=this.Pd;F&&C(a,ih,"graduatedStart");b!==a&&(0>a?a=0:1<a&&(a=1),this.Pd=a,this.u(),this.g("graduatedStart",b,a))}},graduatedEnd:{configurable:!0,get:function(){return this.Nd},set:function(a){var b=this.Nd;F&&C(a,ih,"graduatedEnd");b!==a&&(0>a?a=0:1<a&&(a=1),this.Nd=a,this.u(),this.g("graduatedEnd",b,a))}},graduatedFunction:{configurable:!0,get:function(){return this.Ij},set:function(a){var b=this.Ij;b!==
a&&(null!==a&&A(a,"function",ih,"graduatedFunction"),this.Ij=a,this.u(),this.g("graduatedFunction",b,a))}},graduatedSkip:{configurable:!0,get:function(){return this.Od},set:function(a){var b=this.Od;b!==a&&(null!==a&&A(a,"function",ih,"graduatedSkip"),this.Od=a,this.u(),this.g("graduatedSkip",b,a))}},textValidation:{configurable:!0,get:function(){return this.Yi},set:function(a){var b=this.Yi;b!==a&&(null!==a&&A(a,"function",ih,"textValidation"),this.Yi=a,this.g("textValidation",
b,a))}},textEdited:{configurable:!0,get:function(){return this.lq},set:function(a){var b=this.lq;b!==a&&(null!==a&&A(a,"function",ih,"textEdited"),this.lq=a,this.g("textEdited",b,a))}},spacingAbove:{configurable:!0,get:function(){return this.tf},set:function(a){var b=this.tf;b!==a&&(F&&A(a,"number",ih,"spacingAbove"),this.tf=a,this.g("spacingAbove",b,a))}},spacingBelow:{configurable:!0,get:function(){return this.uf},set:function(a){var b=this.uf;b!==a&&(F&&
A(a,"number",ih,"spacingBelow"),this.uf=a,this.g("spacingBelow",b,a))}},maxLines:{configurable:!0,get:function(){return this.Be},set:function(a){var b=this.Be;b!==a&&(F&&A(a,"number",ih,"maxLines"),a=Math.floor(a),0>=a&&ya(a,"> 0",ih,"maxLines"),this.Be=a,this.g("maxLines",b,a),this.u())}},metrics:{configurable:!0,get:function(){return{arrSize:null!==this.Wb?this.Wb:[this.vb],arrText:null!==this.nb?this.nb:[this.re],maxLineWidth:this.vb,fontHeight:this.te}}},choices:{configurable:!0,
enumerable:!0,get:function(){return this.yn},set:function(a){var b=this.yn;b!==a&&(F&&null!==a&&!Array.isArray(a)&&xa(a,"Array",ih,"choices:value"),this.yn=a,this.g("choices",b,a))}}});var jo=null,ko=null,uo=new E(ih,"None",0),ro=new E(ih,"WrapFit",1),go=new E(ih,"WrapDesiredSize",2),wo=new E(ih,"WrapBreakAll",3),fo=new E(ih,"OverflowClip",0),oo=new E(ih,"OverflowEllipsis",1),xo=/[ \u200b\u00ad]/,yo=new jb,zo=0,Ao=new jb,Bo=0,qo="...",lo="",eo=null,co=!1;ih.className="TextBlock";ih.getEllipsis=function(){return qo};
ih.setEllipsis=function(a){qo=a;Ao=new jb;Bo=0};ih.getBaseline=function(){return jo};ih.setBaseline=function(a){jo=a;a=Wa();for(var b=a.length,c=0;c<b;c++)a[c].ge()};ih.getUnderline=function(){return ko};ih.setUnderline=function(a){ko=a;a=Wa();for(var b=a.length,c=0;c<b;c++)a[c].ge()};ih.isValidFont=ho;ih.None=uo;ih.WrapFit=ro;ih.WrapDesiredSize=go;ih.WrapBreakAll=wo;ih.OverflowClip=fo;ih.OverflowEllipsis=oo;function Co(){this.Wb=[];this.nb=[]}Co.prototype.reset=function(){this.Wb=[];this.nb=[]};
Co.prototype.Et=function(a){this.Wb=Ia(a.Wb);this.nb=Ia(a.nb)};Co.className="TextBlockMetrics";function xk(){N.call(this);this.eh=null;this.cq="";this.yh=wc;this.ul=Hd;this.xf=this.Gc=null;this.tl=Mc;this.Md=Mg;this.jm=null;this.Uu=!1;this.ol=!0;this.Kl=!1;this.cm=null}la(xk,N);xk.prototype.cloneProtected=function(a){N.prototype.cloneProtected.call(this,a);a.element=this.eh;a.cq=this.cq;a.yh=this.yh.J();a.ul=this.ul;a.Md=this.Md;a.Gc=this.Gc;a.xf=this.xf;a.tl=this.tl.J();a.ol=this.ol;a.cm=this.cm};
t=xk.prototype;t.mb=function(a){a===Mg||a===Og||a===nl?this.imageStretch=a:N.prototype.mb.call(this,a)};t.toString=function(){return"Picture("+this.source+")#"+sb(this)};function Ck(a){void 0===a&&(a="");A(a,"string",xk,"clearCache:url");""!==a?Do[a]&&(delete Do[a],Eo--):(Do=new jb,Eo=0)}
function Fo(a,b){a.ps=!0;a.ql=!1;for(var c,d=Wa(),e=d.length,f=0;f<e;f++){var g=d[f];c=a.getAttribute("src");var h=g.Ri.K(c);if(null!==h)for(var k=h.length,l=0;l<k;l++)c=h[l],g.Rs.add(c),g.Hb(),void 0===a.pv&&(a.pv=b,null!==c.xf&&c.xf(c,b))}}function Go(a,b){a.ql=b;for(var c,d=Wa(),e=d.length,f=0;f<e;f++){var g=d[f],h=a.getAttribute("src");c=g.Ri.K(h);if(null!==c){g=c.length;h=La();for(var k=0;k<g;k++)h.push(c[k]);for(k=0;k<g;k++)c=h[k],null!==c.Gc&&c.Gc(c,b);Oa(h)}}}
t.NA=function(){if(""!==this.source){Ck(this.source);var a=this.source;this.source="";this.source=a}};t.ge=function(){this.P()};
t.ej=function(a,b){var c=this.eh;if(null!==c){var d=c.getAttribute("src");c instanceof HTMLImageElement&&(null===d||""===d)&&v('Element has no source ("src") attribute: '+c);if(!(c.ql instanceof Event)){d=this.naturalBounds;var e=0,f=0,g=this.Uu,h=g?+c.width:c.naturalWidth;g=g?+c.height:c.naturalHeight;void 0===h&&c.videoWidth&&(h=c.videoWidth);void 0===g&&c.videoHeight&&(g=c.videoHeight);h=h||d.width;g=g||d.height;if(0!==h&&0!==g){var k=h,l=g;this.sourceRect.o()&&(e=this.yh.x,f=this.yh.y,h=this.yh.width,
g=this.yh.height);var m=h,n=g,p=this.ul,r=this.tl;switch(p){case Mg:if(this.sourceRect.o())break;m>=d.width&&(e=e+r.offsetX+(m*r.x-d.width*r.x));n>=d.height&&(f=f+r.offsetY+(n*r.y-d.height*r.y));h=Math.min(d.width,m);g=Math.min(d.height,n);break;case Hd:m=d.width;n=d.height;break;case Og:case nl:p===Og?(p=Math.min(d.height/n,d.width/m),m*=p,n*=p):p===nl&&(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.Gf()*b.scale;var q=m*p*n*p,u=h*g/q,w=c.__goCache;p=null;var y=Ho;if(c.ps&&void 0!==w&&4<q&&u>y*y)for(null===w.cj&&(Io(w,4,k,l,c),Io(w,16,k,l,c)),k=w.cj,l=k.length,q=0;q<l;q++)if(k[q].ratio*k[q].ratio<u)p=k[q];else break;if(!b.ll){if(null===this.jm)if(null===this.eh)this.jm=!1;else{k=(new Rk(null)).context;k.drawImage(this.eh,0,0);try{k.getImageData(0,0,1,1).data[3]&&(this.jm=!1),this.jm=!1}catch(z){this.jm=!0}}if(this.jm)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 pl:a.translate(Math.min(d.width,m),0);a.scale(-1,1);break;case ol:a.translate(0,Math.min(d.height,n));a.scale(1,-1);break;case ql:a.translate(Math.min(d.width,m),Math.min(d.height,n)),a.scale(-1,-1)}if(b.Re("pictureRatioOptimization")&&!b.Bi&&void 0!==w&&null!==p&&1!==p.ratio){a.save();b=p.ratio;try{a.drawImage(p.source,e/b,f/b,Math.min(p.source.width,h/b),Math.min(p.source.height,
g/b),k,l,Math.min(d.width,m),Math.min(d.height,n))}catch(z){F&&this.ol&&Ca(z.toString()),this.ol=!1}a.restore()}else try{a.drawImage(c,e,f,h,g,k,l,Math.min(d.width,m),Math.min(d.height,n))}catch(z){F&&this.ol&&Ca(z.toString()),this.ol=!1}switch(this.flip){case pl:a.scale(-1,1);a.translate(-Math.min(d.width,m),0);break;case ol:a.scale(1,-1);a.translate(0,-Math.min(d.height,n));break;case ql:a.scale(-1,-1),a.translate(-Math.min(d.width,m),-Math.min(d.height,n))}}}}};
t.Im=function(a,b,c,d){var e=this.desiredSize,f=Al(this,!0),g=this.eh,h=this.Uu;if(h||!this.Kl&&g&&g.complete)this.Kl=!0;null===g&&(isFinite(e.width)||(a=0),isFinite(e.height)||(b=0));isFinite(e.width)||f===Hd||f===ll?(isFinite(a)||(a=this.sourceRect.o()?this.sourceRect.width:h?+g.width:g.naturalWidth),c=0):null!==g&&!1!==this.Kl&&(a=this.sourceRect.o()?this.sourceRect.width:h?+g.width:g.naturalWidth);isFinite(e.height)||f===Hd||f===ml?(isFinite(b)||(b=this.sourceRect.o()?this.sourceRect.height:h?
+g.height:g.naturalHeight),d=0):null!==g&&!1!==this.Kl&&(b=this.sourceRect.o()?this.sourceRect.height:h?+g.height:g.naturalHeight);isFinite(e.width)&&(a=e.width);isFinite(e.height)&&(b=e.height);e=this.maxSize;f=this.minSize;c=Math.max(c,f.width);d=Math.max(d,f.height);a=Math.min(e.width,a);b=Math.min(e.height,b);a=Math.max(c,a);b=Math.max(d,b);null===g||g.complete||(isFinite(a)||(a=0),isFinite(b)||(b=0));gc(this.uc,a,b);xl(this,0,0,a,b)};t.Nh=function(a,b,c,d){Cl(this,a,b,c,d)};
ma.Object.defineProperties(xk.prototype,{element:{configurable:!0,get:function(){return this.eh},set:function(a){var b=this.eh;if(b!==a){null===a||a instanceof HTMLImageElement||a instanceof HTMLVideoElement||a instanceof HTMLCanvasElement||v("Picture.element must be an instance of Image, Canvas, or Video, not: "+a);this.Uu=a instanceof HTMLCanvasElement;this.eh=a;if(null!==a)if(a instanceof HTMLCanvasElement||!0===a.complete)a.ql instanceof Event&&null!==this.Gc&&this.Gc(this,a.ql),
!0===a.ps&&null!==this.xf&&this.xf(this,a.pv),a.ps=!0,this.desiredSize.o()||(Cj(this,!1),this.u());else{var c=this;a.yx||(a.addEventListener("load",function(b){Fo(a,b);c.desiredSize.o()||(Cj(c,!1),c.u())}),a.addEventListener("error",function(b){Go(a,b)}),a.yx=!0)}this.g("element",b,a);this.P()}}},source:{configurable:!0,get:function(){return this.cq},set:function(a){var b=this.cq;if(b!==a){A(a,"string",xk,"source");this.cq=a;var c=Do,d=this.diagram,e=null;if(void 0!==c[a])e=c[a];else{30<
Eo&&(Ck(),c=Do);e=ua("img");var f=this;e.addEventListener("load",function(a){Fo(e,a);f.desiredSize.o()||(Cj(f,!1),f.u())});e.addEventListener("error",function(a){Go(e,a)});e.yx=!0;var g=this.cm;null!==g&&(e.crossOrigin=g(this));e.src=a;c[a]=e;Eo++}null!==d&&Bk(d,this);this.element=e;null!==d&&nk(d,this);void 0===e.__goCache&&(e.__goCache=new Jo);this.u();this.P();this.g("source",b,a)}}},sourceCrossOrigin:{configurable:!0,get:function(){return this.cm},set:function(a){if(this.cm!==a&&
(null!==a&&A(a,"function",xk,"sourceCrossOrigin"),this.cm=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:{configurable:!0,get:function(){return this.yh},set:function(a){var b=this.yh;b.A(a)||(x(a,L,xk,"sourceRect"),this.yh=a=a.J(),this.P(),this.g("sourceRect",b,a))}},imageStretch:{configurable:!0,get:function(){return this.ul},
set:function(a){var b=this.ul;b!==a&&(hb(a,N,xk,"imageStretch"),this.ul=a,this.P(),this.g("imageStretch",b,a))}},flip:{configurable:!0,get:function(){return this.Md},set:function(a){var b=this.Md;b!==a&&(hb(a,N,xk,"flip"),this.Md=a,this.P(),this.g("flip",b,a))}},imageAlignment:{configurable:!0,get:function(){return this.tl},set:function(a){x(a,M,xk,"imageAlignment");var b=this.tl;b.A(a)||(this.tl=a=a.J(),this.u(),this.g("imageAlignment",b,a))}},errorFunction:{configurable:!0,
enumerable:!0,get:function(){return this.Gc},set:function(a){var b=this.Gc;b!==a&&(null!==a&&A(a,"function",xk,"errorFunction"),this.Gc=a,this.g("errorFunction",b,a))}},successFunction:{configurable:!0,get:function(){return this.xf},set:function(a){var b=this.xf;b!==a&&(null!==a&&A(a,"function",xk,"successFunction"),this.xf=a,this.g("successFunction",b,a))}},naturalBounds:{configurable:!0,get:function(){return this.uc}}});xk.prototype.redraw=xk.prototype.ge;
xk.prototype.reloadSource=xk.prototype.NA;var Do=null,Eo=0,Ho=4;xk.className="Picture";Do=new jb;xk.clearCache=Ck;function Jo(){this.cj=null}function Io(a,b,c,d,e){null===a.cj&&(a.cj=[]);var f=new Rk(null),g=f.context,h=1/b;f.width=c/b;f.height=d/b;0!==f.width&&0!==f.height&&(b=new Ko(f.Ka,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))}Jo.className="PictureCacheArray";function Ko(a,b){this.source=a;this.ratio=b}
Ko.className="PictureCacheInstance";function Lo(){this.Mt=new Fd;this.lc=null}t=Lo.prototype;t.reset=function(a){null!==a?(a.ka(),this.Mt=a,a.figures.clear()):this.Mt=new Fd;this.lc=null};function Xd(a,b,c,d,e){a.lc=new te;a.lc.startX=b;a.lc.startY=c;a.lc.isFilled=d;a.Mt.figures.add(a.lc);void 0!==e&&(a.lc.isShadowed=e)}function ee(a){var b=a.lc.segments.length;0<b&&a.lc.segments.O(b-1).close()}t.jr=function(a){this.lc.isShadowed=a};
t.moveTo=function(a,b,c){void 0===c&&(c=!1);var d=new ue(ie);d.endX=a;d.endY=b;c&&d.close();this.lc.segments.add(d)};t.lineTo=function(a,b,c){void 0===c&&(c=!1);var d=new ue(Kd);d.endX=a;d.endY=b;c&&d.close();this.lc.segments.add(d)};function Yd(a,b,c,d,e,f,g){var h;void 0===h&&(h=!1);var k=new ue(je);k.point1X=b;k.point1Y=c;k.point2X=d;k.point2Y=e;k.endX=f;k.endY=g;h&&k.close();a.lc.segments.add(k)}
function Zd(a,b,c,d,e){var f;void 0===f&&(f=!1);var g=new ue(ke);g.point1X=b;g.point1Y=c;g.endX=d;g.endY=e;f&&g.close();a.lc.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 ue(le);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.lc.segments.add(h)};function de(a,b,c,d,e,f,g,h){var k;void 0===k&&(k=!1);b=new ue(me,g,h,b,c,d,e,f);k&&b.close();a.lc.segments.add(b)}
function Wd(a){var b=fe;if(null!==b)return fe=null,b.reset(a),b;b=new Lo;b.reset(a);return b}var fe=null;Lo.className="StreamGeometryContext";function Mo(a,b){var c=a.toLowerCase(),d=K.le;d[a]=b;d[c]=a}Mo("Rectangle",function(a,b,c){a="r"+b+","+c;var d=K.Yh[a];if(void 0!==d)return d;d=new Fd(Md);d.endX=b;d.endY=c;50>K.Zh&&(K.Yh[a]=d,K.Zh++);return d});
Mo("Square",function(a,b,c){a="s"+b+","+c;var d=K.Yh[a];if(void 0!==d)return d;d=new Fd(Md);d.endX=b;d.endY=c;d.defaultStretch=Og;50>K.Zh&&(K.Yh[a]=d,K.Zh++);return d});
Mo("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.Qg;b=(new Fd).add((new te(d,0,!0)).add(new ue(Kd,b-d,0)).add(new ue(je,b,d,b-a,0,b,a)).add(new ue(Kd,b,c-d)).add(new ue(je,b-d,c,b,c-a,b-a,c)).add(new ue(Kd,d,c)).add(new ue(je,0,c-d,a,c,0,c-a)).add(new ue(Kd,0,d)).add((new ue(je,d,0,0,a,a,0)).close()));1<a&&(b.spot1=new M(0,0,a,a),b.spot2=new M(1,1,-a,-a));return b});Mo("Border","RoundedRectangle");
Mo("Ellipse",function(a,b,c){a="e"+b+","+c;var d=K.Yh[a];if(void 0!==d)return d;d=new Fd(Ud);d.endX=b;d.endY=c;d.spot1=ud;d.spot2=vd;50>K.Zh&&(K.Yh[a]=d,K.Zh++);return d});Mo("Circle",function(a,b,c){a="c"+b+","+c;var d=K.Yh[a];if(void 0!==d)return d;d=new Fd(Ud);d.endX=b;d.endY=c;d.spot1=ud;d.spot2=vd;d.defaultStretch=Og;50>K.Zh&&(K.Yh[a]=d,K.Zh++);return d});Mo("TriangleRight",function(a,b,c){return(new Fd).add((new te(0,0)).add(new ue(Kd,b,.5*c)).add((new ue(Kd,0,c)).close())).bn(0,.25,.5,.75)});
Mo("TriangleDown",function(a,b,c){return(new Fd).add((new te(0,0)).add(new ue(Kd,b,0)).add((new ue(Kd,.5*b,c)).close())).bn(.25,0,.75,.5)});Mo("TriangleLeft",function(a,b,c){return(new Fd).add((new te(b,c)).add(new ue(Kd,0,.5*c)).add((new ue(Kd,b,0)).close())).bn(.5,.25,1,.75)});Mo("TriangleUp",function(a,b,c){return(new Fd).add((new te(b,c)).add(new ue(Kd,0,c)).add((new ue(Kd,.5*b,0)).close())).bn(.25,.5,.75,1)});Mo("Triangle","TriangleUp");
Mo("Diamond",function(a,b,c){return(new Fd).add((new te(.5*b,0)).add(new ue(Kd,0,.5*c)).add(new ue(Kd,.5*b,c)).add((new ue(Kd,b,.5*c)).close())).bn(.25,.25,.75,.75)});Mo("LineH",function(a,b,c){a=new Fd(Id);a.startX=0;a.startY=c/2;a.endX=b;a.endY=c/2;return a});Mo("LineV",function(a,b,c){a=new Fd(Id);a.startX=b/2;a.startY=0;a.endX=b/2;a.endY=c;return a});Mo("None","Rectangle");Mo("BarH","Rectangle");Mo("BarV","Rectangle");Mo("MinusLine","LineH");
Mo("PlusLine",function(a,b,c){return(new Fd).add((new te(0,c/2,!1)).add(new ue(Kd,b,c/2)).add(new ue(ie,b/2,0)).add(new ue(Kd,b/2,c)))});Mo("XLine",function(a,b,c){return(new Fd).add((new te(0,c,!1)).add(new ue(Kd,b,0)).add(new ue(ie,0,0)).add(new ue(Kd,b,c)))});
K.en={"":"",Standard:"F1 m 0,0 l 8,4 -8,4 2,-4 z",Backward:"F1 m 8,0 l -2,4 2,4 -8,-4 z",Triangle:"F1 m 0,0 l 8,4.62 -8,4.62 z",BackwardTriangle:"F1 m 8,4 l 0,4 -8,-4 8,-4 0,4 z",Boomerang:"F1 m 0,0 l 8,4 -8,4 4,-4 -4,-4 z",BackwardBoomerang:"F1 m 8,0 l -8,4 8,4 -4,-4 4,-4 z",SidewaysV:"m 0,0 l 8,4 -8,4 0,-1 6,-3 -6,-3 0,-1 z",BackwardV:"m 8,0 l -8,4 8,4 0,-1 -6,-3 6,-3 0,-1 z",OpenTriangle:"m 0,0 l 8,4 -8,4",BackwardOpenTriangle:"m 8,0 l -8,4 8,4",OpenTriangleLine:"m 0,0 l 8,4 -8,4 m 8.5,0 l 0,-8",
BackwardOpenTriangleLine:"m 8,0 l  -8,4 8,4 m -8.5,0 l 0,-8",OpenTriangleTop:"m 0,0 l 8,4 m 0,4",BackwardOpenTriangleTop:"m 8,0 l -8,4 m 0,4",OpenTriangleBottom:"m 0,8 l 8,-4",BackwardOpenTriangleBottom:"m 0,4 l 8,4",HalfTriangleTop:"F1 m 0,0 l 0,4 8,0 z m 0,8",BackwardHalfTriangleTop:"F1 m 8,0 l 0,4 -8,0 z m 0,8",HalfTriangleBottom:"F1 m 0,4 l 0,4 8,-4 z",BackwardHalfTriangleBottom:"F1 m 8,4 l 0,4 -8,-4 z",ForwardSemiCircle:"m 4,0 b 270 180 0 4 4",BackwardSemiCircle:"m 4,8 b 90 180 0 -4 4",Feather:"m 0,0 l 3,4 -3,4",
BackwardFeather:"m 3,0 l -3,4 3,4",DoubleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardDoubleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4",TripleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardTripleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4 m 3,-8 l -3,4 3,4",ForwardSlash:"m 0,8 l 5,-8",BackSlash:"m 0,0 l 5,8",DoubleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8",DoubleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8",TripleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8 m -2,8 l 4,-8",
TripleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8 m -2,-8 l 4,8",Fork:"m 0,4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4",LineFork:"m 0,0 l 0,8 m 0,-4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardLineFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4 m 8,-8 l 0,8",CircleFork:"F1 m 6,4 b 0 360 -3 0 3 z m 0,0 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",BackwardCircleFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 6,0 b 0 360 -3 0 3",CircleLineFork:"F1 m 6,4 b 0 360 -3 0 3 z m 1,-4 l 0,8 m 0,-4 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",
BackwardCircleLineFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 0,-4 l 0,8 m 7,-4 b 0 360 -3 0 3",Circle:"F1 m 8,4 b 0 360 -4 0 4 z",Block:"F1 m 0,0 l 0,8 8,0 0,-8 z",StretchedDiamond:"F1 m 0,3 l 5,-3 5,3 -5,3 -5,-3 z",Diamond:"F1 m 0,4 l 4,-4 4,4 -4,4 -4,-4 z",Chevron:"F1 m 0,0 l 5,0 3,4 -3,4 -5,0 3,-4 -3,-4 z",StretchedChevron:"F1 m 0,0 l 8,0 3,4 -3,4 -8,0 3,-4 -3,-4 z",NormalArrow:"F1 m 0,2 l 4,0 0,-2 4,4 -4,4 0,-2 -4,0 z",X:"m 0,0 l 8,8 m 0,-8 l -8,8",TailedNormalArrow:"F1 m 0,0 l 2,0 1,2 3,0 0,-2 2,4 -2,4 0,-2 -3,0 -1,2 -2,0 1,-4 -1,-4 z",
DoubleTriangle:"F1 m 0,0 l 4,4 -4,4 0,-8 z  m 4,0 l 4,4 -4,4 0,-8 z",BigEndArrow:"F1 m 0,0 l 5,2 0,-2 3,4 -3,4 0,-2 -5,2 0,-8 z",ConcaveTailArrow:"F1 m 0,2 h 4 v -2 l 4,4 -4,4 v -2 h -4 l 2,-2 -2,-2 z",RoundedTriangle:"F1 m 0,1 a 1,1 0 0 1 1,-1 l 7,3 a 0.5,1 0 0 1 0,2 l -7,3 a 1,1 0 0 1 -1,-1 l 0,-6 z",SimpleArrow:"F1 m 1,2 l -1,-2 2,0 1,2 -1,2 -2,0 1,-2 5,0 0,-2 2,2 -2,2 0,-2 z",AccelerationArrow:"F1 m 0,0 l 0,8 0.2,0 0,-8 -0.2,0 z m 2,0 l 0,8 1,0 0,-8 -1,0 z m 3,0 l 2,0 2,4 -2,4 -2,0 0,-8 z",BoxArrow:"F1 m 0,0 l 4,0 0,2 2,0 0,-2 2,4 -2,4 0,-2 -2,0 0,2 -4,0 0,-8 z",
TriangleLine:"F1 m 8,4 l -8,-4 0,8 8,-4 z m 0.5,4 l 0,-8",CircleEndedArrow:"F1 m 10,4 l -2,-3 0,2 -2,0 0,2 2,0 0,2 2,-3 z m -4,0 b 0 360 -3 0 3 z",DynamicWidthArrow:"F1 m 0,3 l 2,0 2,-1 2,-2 2,4 -2,4 -2,-2 -2,-1 -2,0 0,-2 z",EquilibriumArrow:"m 0,3 l 8,0 -3,-3 m 3,5 l -8,0 3,3",FastForward:"F1 m 0,0 l 3.5,4 0,-4 3.5,4 0,-4 1,0 0,8 -1,0 0,-4 -3.5,4 0,-4 -3.5,4 0,-8 z",Kite:"F1 m 0,4 l 2,-4 6,4 -6,4 -2,-4 z",HalfArrowTop:"F1 m 0,0 l 4,4 4,0 -8,-4 z m 0,8",HalfArrowBottom:"F1 m 0,8 l 4,-4 4,0 -8,4 z",
OpposingDirectionDoubleArrow:"F1 m 0,4 l 2,-4 0,2 4,0 0,-2 2,4 -2,4 0,-2 -4,0 0,2 -2,-4 z",PartialDoubleTriangle:"F1 m 0,0 4,3 0,-3 4,4 -4,4 0,-3 -4,3 0,-8 z",LineCircle:"F1 m 0,0 l 0,8 m 7 -4 b 0 360 -3 0 3 z",DoubleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",TripleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",CircleLine:"F1 m 6 4 b 0 360 -3 0 3 z m 1,-4 l 0,8",DiamondCircle:"F1 m 8,4 l -4,4 -4,-4 4,-4 4,4 m 8,0 b 0 360 -4 0 4 z",PlusCircle:"F1 m 8,4 b 0 360 -4 0 4 l -8 0 z m -4 -4 l 0 8",
OpenRightTriangleTop:"m 8,0 l 0,4 -8,0 m 0,4",OpenRightTriangleBottom:"m 8,8 l 0,-4 -8,0",Line:"m 0,0 l 0,8",DoubleLine:"m 0,0 l 0,8 m 2,0 l 0,-8",TripleLine:"m 0,0 l 0,8 m 2,0 l 0,-8 m 2,0 l 0,8",PentagonArrow:"F1 m 8,4 l -4,-4 -4,0 0,8 4,0 4,-4 z"};
function S(a){U.call(this,a);this.F=2408959;this.nh=this.Uf="";this.Hp=this.Dp=this.Sp=this.Go=null;this.Up="";this.Rf=this.ro=this.Tp=this.xh=null;this.Fp="";this.Ep=cc;this.Zb=this.Ip="";this.Hi=this.Bn=this.ri=null;this.lg=(new J(NaN,NaN)).freeze();this.No="";this.jf=null;this.Oo=Hc;this.Jp=ld;this.Xo=Sb;this.Po=Tb;this.Tn=null;this.Ho=127;this.Yp=Ub;this.Xp="gray";this.rf=4;this.Ax=-1;this.vq=NaN;this.az=new L;this.Uj=null;this.ph=NaN}la(S,U);
S.prototype.cloneProtected=function(a){U.prototype.cloneProtected.call(this,a);a.F=this.F&-4097|49152;a.Uf=this.Uf;a.nh=this.nh;a.Go=this.Go;a.Sp=this.Sp;a.Dp=this.Dp;a.Hp=this.Hp;a.Up=this.Up;a.Tp=this.Tp;a.ro=this.ro;a.Rf=null;a.Fp=this.Fp;a.Ep=this.Ep.J();a.Ip=this.Ip;a.Jp=this.Jp.J();a.Zb=this.Zb;a.Bn=this.Bn;a.lg.assign(this.lg);a.No=this.No;a.Oo=this.Oo.J();a.Xo=this.Xo.J();a.Po=this.Po.J();a.Tn=this.Tn;a.Ho=this.Ho;a.Yp=this.Yp.J();a.Xp=this.Xp;a.rf=this.rf;a.vq=this.vq};
S.prototype.Ef=function(a){U.prototype.Ef.call(this,a);a.Th();a.xh=null;a.jf=null;a.Uj=null};S.prototype.toString=function(){var a=Pa(this.constructor)+"#"+sb(this);null!==this.data&&(a+="("+Qa(this.data)+")");return a};S.prototype.Jk=function(a,b,c,d,e,f,g){var h=this.diagram;null!==h&&(a===Je&&"elements"===b?e instanceof U?Uj(e,function(a){Wj(h.partManager,a);Vj(h,a)}):nk(h,e):a===Ke&&"elements"===b&&(e instanceof U?Uj(e,function(a){Zj(h.partManager,a,h)}):Bk(h,e)),h.gb(a,b,c,d,e,f,g))};
S.prototype.Ga=function(a){U.prototype.Ga.call(this,a);if(null!==this.data){for(var b=this.$.j,c=b.length,d=0;d<c;d++){var e=b[d];e instanceof U&&Uj(e,function(a){null!==a.data&&a.Ga()})}for(b=this.adornments;b.next();)b.value.Ga(a)}};S.prototype.updateRelationshipsFromData=function(){null!==this.data&&this.diagram.partManager.updateRelationshipsFromData(this)};S.prototype.uk=function(a){F&&A(a,"string",S,"findAdornment:category");var b=this.Rf;return null===b?null:b.K(a)};
S.prototype.Kh=function(a,b){if(null!==b){F&&(A(a,"string",S,"addAdornment:category"),x(b,Te,S,"addAdornment:ad"));var c=null,d=this.Rf;null!==d&&(c=d.K(a));if(c!==b){if(null!==c){var e=c.diagram;null!==e&&e.remove(c)}null===d&&(this.Rf=d=new Db);b.Uf!==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)))}}};
S.prototype.Mf=function(a){F&&A(a,"string",S,"removeAdornment:category");var b=this.Rf;if(null!==b){var c=b.K(a);if(null!==c){var d=c.diagram;null!==d&&d.remove(c)}b.remove(a);0===b.count&&(this.Rf=null)}};S.prototype.lk=function(){var a=this.Rf;if(null!==a){var b=La();for(a=a.iterator;a.next();)b.push(a.key);a=b.length;for(var c=0;c<a;c++)this.Mf(b[c]);Oa(b)}};
S.prototype.updateAdornments=function(){var a=this.diagram;if(null!==a){for(var b=this.adornments;b.next();){var c=b.value;c.u();c.placeholder&&c.placeholder.u()}a:{if(this.isSelected&&this.selectionAdorned&&(b=this.selectionObject,null!==b&&this.actualBounds.o()&&this.isVisible()&&b.Lf()&&b.actualBounds.o())){c=this.uk("Selection");if(null===c){c=this.selectionAdornmentTemplate;null===c&&(c=this.Uh()?a.linkSelectionAdornmentTemplate:this instanceof Hf?a.groupSelectionAdornmentTemplate:a.nodeSelectionAdornmentTemplate);
if(!(c instanceof Te))break a;Lg(c);c=c.copy();null!==c&&(this.Uh()&&this.selectionObject===this.path&&(c.type=U.Link),c.adornedObject=b)}if(null!==c){c.type===U.Link&&c.u();this.Kh("Selection",c);break a}}this.Mf("Selection")}No(this,a);for(b=this.adornments;b.next();)b.value.Ga()}};S.prototype.Sb=function(){var a=this.diagram;null!==a&&(hj(a),0!==(this.F&16384)!==!0&&(yi(this,!0),a.Hb()))};function xi(a){0!==(a.F&16384)!==!1&&(a.updateAdornments(),yi(a,!1))}
function No(a,b){b.toolManager.mouseDownTools.each(function(b){b.isEnabled&&b.updateAdornments(a)});b.toolManager.updateAdornments(a)}function Oo(a){if(!1===Jj(a)){Po(a,!0);a.Bl();var b=a.diagram;null!==b&&(b.ud.add(a),b.Hb())}}function Qo(a){a.F|=2097152;if(!1!==Jj(a)){var b=a.position,c=a.location;c.o()&&b.o()||Ro(a,b,c);c=a.Bb;var d=L.alloc().assign(c);c.ka();c.x=b.x;c.y=b.y;c.freeze();a.du(d,c);L.free(d);Po(a,!1)}}S.prototype.move=function(a,b){!0===b?this.location=a:this.position=a};
S.prototype.moveTo=function(a,b,c){a=J.allocAt(a,b);this.move(a,c);J.free(a)};S.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.cu(this))return!0}a=this.containingGroup;return null===a||a.isSubGraphExpanded&&a.isVisible()?!0:!1};t=S.prototype;t.Vb=function(a){var b=this.diagram;a?(this.D(4),this.Sb(),null!==b&&b.ud.add(this)):(this.D(8),this.lk());this.Th();null!==b&&(b.Ta(),b.P())};
t.fb=function(a){if(this.name===a)return this;var b=this.Uj;null===b&&(this.Uj=b=new Db);if(null!==b.K(a))return b.K(a);var c=U.prototype.fb.call(this,a);if(null!==c)return b.set(a,c),c;b.set(a,null);return null};t.If=function(a,b,c){void 0===c&&(c=new J);b=b.Tb()?Mc: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.xa(c);for(a=a.panel;null!==a&&a!==this;)a.transform.xa(c),a=a.panel;this.kg.xa(c);c.offset(-this.tc.x,-this.tc.y);return c};
t.Cm=function(a){void 0===a&&(a=new L);return a.assign(this.actualBounds)};t.Fb=function(){!0===Hj(this)&&this.measure(Infinity,Infinity);this.arrange()};function Sj(a,b){var c=a.az;isNaN(a.ph)&&(a.ph=wn(a));var d=a.ph;var e=2*d;if(!a.isShadowed)return c.h(b.x-1-d,b.y-1-d,b.width+2+e,b.height+2+e),c;d=b.x;e=b.y;var f=b.width;b=b.height;var g=a.shadowBlur;a=a.shadowOffset;f+=g;b+=g;d-=g/2;e-=g/2;0<a.x?f+=a.x:(d+=a.x,f-=a.x);0<a.y?b+=a.y:(e+=a.y,b-=a.y);c.h(d-1,e-1,f+2,b+2);return c}
S.prototype.arrange=function(){if(!1===Ij(this))Qo(this);else{Bl(this,!1);var a=this.Bb,b=L.alloc();b.assign(a);a.ka();var c=Jg(this);this.Nh(0,0,this.tc.width,this.tc.height);var d=this.position;Ro(this,d,this.location);a.x=d.x;a.y=d.y;a.freeze();this.du(b,a);b.A(a)?this.Hd(c):!this.bc()||K.C(b.width,a.width)&&K.C(b.height,a.height)||0<=this.Ax&&this.D(16);L.free(b);Po(this,!1)}};t=S.prototype;
t.du=function(a,b){var c=this.diagram;if(null!==c){var d=!1;if(!1===c.yi&&a.o()){var e=L.alloc();e.assign(c.documentBounds);e.Lw(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);L.free(e)}0!==(this.F&65536)!==!0&&a.A(b)||Xj(this,d,c);c.P();jc(a,b)||(this instanceof T&&!c.undoManager.isUndoingRedoing&&this.md(),this.Th())}};
t.Gw=function(a,b){if(this.Uh()||!a.o())return!1;var c=this.diagram;null!==c&&So(this,c,a,b);this.sa=a;this.F&=-2097153;var d=this.lg;!d.o()||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===Jj(this)&&!1===Ij(this)&&(Oo(this),Qo(this));return!0};function So(a,b,c,d){null===b||a instanceof Te||(b=b.animationManager,b.lf&&ai(b,a,d.copy(),c.copy()))}
t.ir=function(a,b,c){var d=this.lg,e=this.sa;if(c){if(d.x===a&&d.y===b)return;Jj(this)||Ij(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;Jj(this)||Ij(this)?this.nu():d.h(d.x+a-e.x,d.y+b-e.y);e.h(a,b)}Oo(this)};t.nu=function(){this.F&=-2097153;Oo(this)};
function Ro(a,b,c){var d=J.alloc(),e=a.locationSpot,f=a.locationObject;e.Tb()&&v("determineOffset: Part's locationSpot must be real: "+e.toString());var g=f.naturalBounds,h=f instanceof Yf?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.xa(d),e=f.panel;null!==e&&e!==a;)e.transform.xa(d),e=e.panel;a.kg.xa(d);d.offset(-a.tc.x,-a.tc.y);e=a.diagram;f=c.o();g=b.o();f&&g?0!==(a.F&2097152)?To(a,b,c,e,d):Uo(a,b,c,e,d):f?To(a,b,c,e,d):g&&Uo(a,b,c,e,d);a.F|=2097152;
J.free(d);a.Bl()}function To(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.lf||a instanceof Te||ai(c,a,new J(f,g),b),d||b.x===f&&b.y===g||a.g("position",new J(f,g),b.copy()))}function Uo(a,b,c,d,e){var f=c.copy();c.h(b.x+e.x,b.y+e.y);c.A(f)||null===d||a.g("location",f,c.copy())}
function Xj(a,b,c){Dl(a,!1);a instanceof T&&Nk(c,a);a.layer.isTemporary||b||c.Ta();b=a.Bb;var d=c.viewportBounds;d.o()?Jg(a)?(nc(b,d)||a.Hd(!1),a.updateAdornments()):b.Oc(d)?(a.Hd(!0),a.updateAdornments()):a.Sb():c.Ai=!0}t.qj=function(){return!0};t.bc=function(){return!0};t.Uh=function(){return!1};t.Kf=function(){return!0};
function Vo(a,b,c,d){b.constructor===a.constructor||Wo||(Wo=!0,Ca('Should not change the class of the Part when changing category from "'+c+'" to "'+d+'"'),Ca("  Old class: "+Pa(a.constructor)+", new class: "+Pa(b.constructor)+", part: "+a.toString()));a.lk();var e=a.data;c=a.layerName;var f=a.isSelected,g=a.isHighlighted,h=!0,k=!0,l=!1;a instanceof T&&(h=a.isTreeLeaf,k=a.isTreeExpanded,l=a.wasTreeExpanded);b.Ef(a);b.cloneProtected(a);a.Uf=d;a.u();a.P();b=a.diagram;d=!0;null!==b&&(d=b.skipsUndoManager,
b.skipsUndoManager=!0);a.pb=e;a.F=f?a.F|4096:a.F&-4097;a.F=g?a.F|524288:a.F&-524289;a instanceof T&&(a.T=h?a.T|4:a.T&-5,a.T=k?a.T|1:a.T&-2,a.T=l?a.T|2:a.T&-3);null!==e&&a.Ga();e=a.layerName;e!==c&&(a.nh=c,a.layerName=e);null!==b&&(b.skipsUndoManager=d);a.bc()&&a.D(64)}S.prototype.canCopy=function(){if(!this.copyable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowCopy)return!1;a=a.diagram;return null===a?!0:a.allowCopy?!0:!1};
S.prototype.canDelete=function(){if(!this.deletable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowDelete)return!1;a=a.diagram;return null===a?!0:a.allowDelete?!0:!1};S.prototype.canEdit=function(){if(!this.textEditable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowTextEdit)return!1;a=a.diagram;return null===a?!0:a.allowTextEdit?!0:!1};
S.prototype.canGroup=function(){if(!this.groupable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowGroup)return!1;a=a.diagram;return null===a?!0:a.allowGroup?!0:!1};S.prototype.canMove=function(){if(!this.movable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowMove)return!1;a=a.diagram;return null===a?!0:a.allowMove?!0:!1};
S.prototype.canReshape=function(){if(!this.reshapable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowReshape)return!1;a=a.diagram;return null===a?!0:a.allowReshape?!0:!1};S.prototype.canResize=function(){if(!this.resizable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowResize)return!1;a=a.diagram;return null===a?!0:a.allowResize?!0:!1};
S.prototype.canRotate=function(){if(!this.rotatable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowRotate)return!1;a=a.diagram;return null===a?!0:a.allowRotate?!0:!1};S.prototype.canSelect=function(){if(!this.selectable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowSelect)return!1;a=a.diagram;return null===a?!0:a.allowSelect?!0:!1};function yi(a,b){a.F=b?a.F|16384:a.F&-16385}function Jj(a){return 0!==(a.F&32768)}function Po(a,b){a.F=b?a.F|32768:a.F&-32769}
function Dl(a,b){a.F=b?a.F|65536:a.F&-65537}function Jg(a){return 0!==(a.F&131072)}t=S.prototype;t.Hd=function(a){this.F=a?this.F|131072:this.F&-131073};function Xo(a,b){a.F=b?a.F|1048576:a.F&-1048577}t.Th=function(){var a=this.containingGroup;null!==a&&(a.u(),null!==a.placeholder&&a.placeholder.u(),a.md())};t.P=function(){var a=this.diagram;null!==a&&!Ij(this)&&!Jj(this)&&this.isVisible()&&this.Bb.o()&&a.P(Sj(this,this.Bb))};
t.u=function(){U.prototype.u.call(this);var a=this.diagram;null!==a&&(a.ud.add(this),this instanceof T&&null!==this.labeledLink&&Sl(this.labeledLink),a.Hb(!0))};t.Nq=function(a){a||(a=this.ri,null!==a&&Yo(a,this))};t.Oq=function(a){a||(a=this.ri,null!==a&&Zo(a,this))};t.sk=function(){var a=this.data;if(null!==a){var b=this.diagram;null!==b&&(b=b.model,null!==b&&b.Rm(a))}};t.Yz=function(){return $o(this,this)};
function $o(a,b){var c=b.containingGroup;return null!==c?1+$o(a,c):b instanceof T&&(b=b.labeledLink,null!==b)?$o(a,b):0}t.aA=function(){return ap(this,this)};function ap(a,b){var c=b.containingGroup;return null!==c||b instanceof T&&(c=b.labeledLink,null!==c)?ap(a,c):b}t.Ed=function(a){return a instanceof Hf?bp(this,this,a):!1};function bp(a,b,c){if(b===c||null===c)return!1;var d=b.containingGroup;return null===d||d!==c&&!bp(a,d,c)?b instanceof T&&(b=b.labeledLink,null!==b)?bp(a,b,c):!1:!0}
t.my=function(a){if(null===a)return null;F&&x(a,S,S,"findCommonContainingGroup:other");if(this===a)return this.containingGroup;for(var b=this;null!==b;){b instanceof Hf&&Xo(b,!0);if(b instanceof T){var c=b.labeledLink;null!==c&&(b=c)}b=b.containingGroup}c=null;for(b=a;null!==b;){if(0!==(b.F&1048576)){c=b;break}b instanceof T&&(a=b.labeledLink,null!==a&&(b=a));b=b.containingGroup}for(b=this;null!==b;)b instanceof Hf&&Xo(b,!1),b instanceof T&&(a=b.labeledLink,null!==a&&(b=a)),b=b.containingGroup;return c};
S.prototype.canLayout=function(){if(!this.isLayoutPositioned||!this.isVisible())return!1;var a=this.layer;return null!==a&&a.isTemporary||this instanceof T&&this.isLinkLabel?!1:!0};
S.prototype.D=function(a){void 0===a&&(a=16777215);if(this.isLayoutPositioned&&0!==(a&this.layoutConditions)){var b=this.layer;null!==b&&b.isTemporary||this instanceof T&&this.isLinkLabel?b=!1:(b=this.diagram,b=null!==b&&b.undoManager.isUndoingRedoing?!1:!0)}else b=!1;if(b)if(b=this.ri,null!==b){var c=b.layout;null!==c?c.D():b.D(a)}else a=this.diagram,null!==a&&(a=a.layout,null!==a&&a.D())};function Yj(a){if(!a.isVisible())return!1;a=a.layer;return null!==a&&a.isTemporary?!1:!0}
function hl(a,b,c,d,e,f){void 0===f&&(f=null);if(!(a.contains(b)||null!==f&&!f(b)||b instanceof Te))if(a.add(b),b instanceof T){if(c&&b instanceof Hf)for(var g=b.memberParts;g.next();)hl(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)&&hl(a,h,c,d,e,f)}}if(1<d)for(b=b.Yv();b.next();)hl(a,b.value,c,d-1,e,f)}else if(b instanceof R)for(b=b.labelNodes;b.next();)hl(a,
b.value,c,d,e,f)}
ma.Object.defineProperties(S.prototype,{key:{configurable:!0,get:function(){var a=this.diagram;if(null!==a)return a.model.pa(this.data)}},adornments:{configurable:!0,get:function(){return null===this.Rf?lb:this.Rf.iteratorValues}},layer:{configurable:!0,get:function(){return this.Hi}},diagram:{configurable:!0,get:function(){var a=this.Hi;return null!==a?a.diagram:null}},layerName:{configurable:!0,get:function(){return this.nh},set:function(a){var b=
this.nh;if(b!==a){A(a,"string",S,"layerName");var c=this.diagram;if(null===c||null!==c.zm(a)&&!c.partManager.addsToTemporaryLayer)if(this.nh=a,null!==c&&c.Ta(),this.g("layerName",b,a),b=this.layer,null!==b&&b.name!==a&&(c=b.diagram,null!==c&&(a=c.zm(a),null!==a&&a!==b))){var d=b.Nc(-1,this,!0);0<=d&&c.gb(Ke,"parts",b,this,null,d,!0);d=a.nj(99999999,this,!0);b.visible!==a.visible&&this.Vb(a.visible);0<=d&&c.gb(Je,"parts",a,null,this,!0,d);d=this.layerChanged;if(null!==d){var e=c.ba;c.ba=!0;d(this,
b,a);c.ba=e}}}}},layerChanged:{configurable:!0,get:function(){return this.Go},set:function(a){var b=this.Go;b!==a&&(null!==a&&A(a,"function",S,"layerChanged"),this.Go=a,this.g("layerChanged",b,a))}},zOrder:{configurable:!0,get:function(){return this.vq},set:function(a){var b=this.vq;if(b!==a){A(a,"number",S,"zOrder");this.vq=a;var c=this.layer;null!==c&&Bi(c,-1,this);this.g("zOrder",b,a);a=this.diagram;null!==a&&a.P()}}},locationObject:{configurable:!0,get:function(){if(null===
this.jf){var a=this.locationObjectName;""!==a?(a=this.fb(a),null!==a?this.jf=a:this.jf=this):this instanceof Te?this.type!==U.Link&&null!==this.placeholder?this.jf=this.placeholder:this.jf=this:this.jf=this}return this.jf.visible?this.jf:this}},minLocation:{configurable:!0,get:function(){return this.Xo},set:function(a){var b=this.Xo;b.A(a)||(F&&x(a,J,S,"minLocation"),this.Xo=a=a.J(),this.g("minLocation",b,a))}},maxLocation:{configurable:!0,get:function(){return this.Po},
set:function(a){var b=this.Po;b.A(a)||(F&&x(a,J,S,"maxLocation"),this.Po=a=a.J(),this.g("maxLocation",b,a))}},locationObjectName:{configurable:!0,get:function(){return this.No},set:function(a){var b=this.No;b!==a&&(F&&A(a,"string",S,"locationObjectName"),this.No=a,this.jf=null,this.u(),this.g("locationObjectName",b,a))}},locationSpot:{configurable:!0,get:function(){return this.Oo},set:function(a){var b=this.Oo;b.A(a)||(F&&(x(a,M,S,"locationSpot"),a.bb()||v("Part.locationSpot must be a specific Spot value, not: "+
a)),this.Oo=a=a.J(),this.u(),this.g("locationSpot",b,a))}},location:{configurable:!0,get:function(){return this.lg},set:function(a){F&&x(a,J,S,"location");var b=a.x,c=a.y,d=this.lg,e=d.x,f=d.y;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))||(a=a.copy(),b=a,this.Uh()?b=!1:(this.lg=b,this.F|=2097152,!1===Ij(this)&&(Oo(this),c=this.sa,c.o()&&(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)),
So(this,e,c,f),this.g("position",f,c.copy())),b=!0),b&&this.g("location",d.copy(),a.copy()))}},category:{configurable:!0,get:function(){return this.Uf},set:function(a){var b=this.Uf;if(b!==a){A(a,"string",S,"category");var c=this.diagram,d=this.data,e=null;if(null!==c&&null!==d&&!(this instanceof Te)){var f=c.model.undoManager;f.isEnabled&&!f.isUndoingRedoing&&(e=this.clone(),e.$.addAll(this.$))}this.Uf=a;this.g("category",b,a);null===c||null===d||this instanceof Te?this instanceof Te&&
(e=this.adornedPart,null!==e&&(a=e.Rf,null!==a&&a.remove(b),e.Kh(this.category,this))):(f=c.model,f.undoManager.isUndoingRedoing||(this.Uh()?(c.partManager.setLinkCategoryForData(d,a),c=c.partManager.findLinkTemplateForCategory(a),null!==c&&(Lg(c),c=c.copy(),null!==c&&Vo(this,c,b,a))):(null!==f&&f.Ym(d,a),c=cp(c.partManager,d,a),null!==c&&(Lg(c),c=c.copy(),null===c||c instanceof R||(d=this.location.copy(),Vo(this,c,b,a),this.location.o()||(this.location=d)))),null!==e&&(b=this.clone(),b.$.addAll(this.$),
this.g("self",e,b))))}}},self:{configurable:!0,get:function(){return this},set:function(a){Vo(this,a,this.category,a.category)}},copyable:{configurable:!0,get:function(){return 0!==(this.F&1)},set:function(a){var b=0!==(this.F&1);b!==a&&(F&&A(a,"boolean",S,"copyable"),this.F^=1,this.g("copyable",b,a))}},deletable:{configurable:!0,get:function(){return 0!==(this.F&2)},set:function(a){var b=0!==(this.F&2);b!==a&&(F&&A(a,"boolean",S,"deletable"),this.F^=2,this.g("deletable",
b,a))}},textEditable:{configurable:!0,get:function(){return 0!==(this.F&4)},set:function(a){var b=0!==(this.F&4);b!==a&&(F&&A(a,"boolean",S,"textEditable"),this.F^=4,this.g("textEditable",b,a),this.Sb())}},groupable:{configurable:!0,get:function(){return 0!==(this.F&8)},set:function(a){var b=0!==(this.F&8);b!==a&&(F&&A(a,"boolean",S,"groupable"),this.F^=8,this.g("groupable",b,a))}},movable:{configurable:!0,get:function(){return 0!==(this.F&16)},set:function(a){var b=
0!==(this.F&16);b!==a&&(F&&A(a,"boolean",S,"movable"),this.F^=16,this.g("movable",b,a))}},selectionAdorned:{configurable:!0,get:function(){return 0!==(this.F&32)},set:function(a){var b=0!==(this.F&32);b!==a&&(F&&A(a,"boolean",S,"selectionAdorned"),this.F^=32,this.g("selectionAdorned",b,a),this.Sb())}},isInDocumentBounds:{configurable:!0,get:function(){return 0!==(this.F&64)},set:function(a){var b=0!==(this.F&64);if(b!==a){F&&A(a,"boolean",S,"isInDocumentBounds");this.F^=
64;var c=this.diagram;null!==c&&c.Ta();this.g("isInDocumentBounds",b,a)}}},isLayoutPositioned:{configurable:!0,get:function(){return 0!==(this.F&128)},set:function(a){var b=0!==(this.F&128);b!==a&&(F&&A(a,"boolean",S,"isLayoutPositioned"),this.F^=128,this.g("isLayoutPositioned",b,a),this.D(a?4:8))}},selectable:{configurable:!0,get:function(){return 0!==(this.F&256)},set:function(a){var b=0!==(this.F&256);b!==a&&(F&&A(a,"boolean",S,"selectable"),this.F^=256,this.g("selectable",
b,a),this.Sb())}},reshapable:{configurable:!0,get:function(){return 0!==(this.F&512)},set:function(a){var b=0!==(this.F&512);b!==a&&(F&&A(a,"boolean",S,"reshapable"),this.F^=512,this.g("reshapable",b,a),this.Sb())}},resizable:{configurable:!0,get:function(){return 0!==(this.F&1024)},set:function(a){var b=0!==(this.F&1024);b!==a&&(F&&A(a,"boolean",S,"resizable"),this.F^=1024,this.g("resizable",b,a),this.Sb())}},rotatable:{configurable:!0,get:function(){return 0!==
(this.F&2048)},set:function(a){var b=0!==(this.F&2048);b!==a&&(F&&A(a,"boolean",S,"rotatable"),this.F^=2048,this.g("rotatable",b,a),this.Sb())}},isSelected:{configurable:!0,get:function(){return 0!==(this.F&4096)},set:function(a){var b=0!==(this.F&4096);if(b!==a){F&&A(a,"boolean",S,"isSelected");var c=this.diagram;if(!a||this.canSelect()&&!(null!==c&&c.selection.count>=c.maxSelectionCount)){this.F^=4096;var d=!1;if(null!==c){d=c.skipsUndoManager;c.skipsUndoManager=!0;var e=c.selection;
e.ka();a?e.add(this):e.remove(this);e.freeze()}this.g("isSelected",b,a);this.Sb();a=this.selectionChanged;null!==a&&a(this);null!==c&&(c.Hb(),c.skipsUndoManager=d)}}}},isHighlighted:{configurable:!0,get:function(){return 0!==(this.F&524288)},set:function(a){var b=0!==(this.F&524288);if(b!==a){F&&A(a,"boolean",S,"isHighlighted");this.F^=524288;var c=this.diagram;null!==c&&(c=c.highlighteds,c.ka(),a?c.add(this):c.remove(this),c.freeze());this.g("isHighlighted",b,a);this.P();a=this.highlightedChanged;
null!==a&&a(this)}}},isShadowed:{configurable:!0,get:function(){return 0!==(this.F&8192)},set:function(a){var b=0!==(this.F&8192);b!==a&&(F&&A(a,"boolean",S,"isShadowed"),this.F^=8192,this.g("isShadowed",b,a),this.P())}},isAnimated:{configurable:!0,get:function(){return 0!==(this.F&262144)},set:function(a){var b=0!==(this.F&262144);b!==a&&(F&&A(a,"boolean",S,"isAnimated"),this.F^=262144,this.g("isAnimated",b,a))}},highlightedChanged:{configurable:!0,get:function(){return this.ro},
set:function(a){var b=this.ro;b!==a&&(null!==a&&A(a,"function",S,"highlightedChanged"),this.ro=a,this.g("highlightedChanged",b,a))}},selectionObjectName:{configurable:!0,get:function(){return this.Up},set:function(a){var b=this.Up;b!==a&&(F&&A(a,"string",S,"selectionObjectName"),this.Up=a,this.xh=null,this.g("selectionObjectName",b,a))}},selectionAdornmentTemplate:{configurable:!0,get:function(){return this.Sp},set:function(a){var b=this.Sp;b!==a&&(F&&x(a,Te,S,"selectionAdornmentTemplate"),
this.Sp=a,this.g("selectionAdornmentTemplate",b,a))}},selectionObject:{configurable:!0,get:function(){if(null===this.xh){var a=this.selectionObjectName;null!==a&&""!==a?(a=this.fb(a),null!==a?this.xh=a:this.xh=this):this instanceof R?(a=this.path,null!==a?this.xh=a:this.xh=this):this.xh=this}return this.xh}},selectionChanged:{configurable:!0,get:function(){return this.Tp},set:function(a){var b=this.Tp;b!==a&&(null!==a&&A(a,"function",S,"selectionChanged"),this.Tp=a,this.g("selectionChanged",
b,a))}},resizeAdornmentTemplate:{configurable:!0,get:function(){return this.Dp},set:function(a){var b=this.Dp;b!==a&&(F&&x(a,Te,S,"resizeAdornmentTemplate"),this.Dp=a,this.g("resizeAdornmentTemplate",b,a))}},resizeObjectName:{configurable:!0,get:function(){return this.Fp},set:function(a){var b=this.Fp;b!==a&&(F&&A(a,"string",S,"resizeObjectName"),this.Fp=a,this.g("resizeObjectName",b,a))}},resizeObject:{configurable:!0,get:function(){var a=this.resizeObjectName;
return""!==a&&(a=this.fb(a),null!==a)?a:this}},resizeCellSize:{configurable:!0,get:function(){return this.Ep},set:function(a){var b=this.Ep;b.A(a)||(F&&x(a,Hb,S,"resizeCellSize"),this.Ep=a=a.J(),this.g("resizeCellSize",b,a))}},rotateAdornmentTemplate:{configurable:!0,get:function(){return this.Hp},set:function(a){var b=this.Hp;b!==a&&(F&&x(a,Te,S,"rotateAdornmentTemplate"),this.Hp=a,this.g("rotateAdornmentTemplate",b,a))}},rotateObjectName:{configurable:!0,
get:function(){return this.Ip},set:function(a){var b=this.Ip;b!==a&&(F&&A(a,"string",S,"rotateObjectName"),this.Ip=a,this.g("rotateObjectName",b,a))}},rotateObject:{configurable:!0,get:function(){var a=this.rotateObjectName;return""!==a&&(a=this.fb(a),null!==a)?a:this}},rotationSpot:{configurable:!0,get:function(){return this.Jp},set:function(a){var b=this.Jp;b.A(a)||(F&&(x(a,M,S,"rotationSpot"),a===ld||a.bb()||v("Part.rotationSpot must be a specific Spot value or Spot.Default, not: "+
a)),this.Jp=a=a.J(),this.g("rotationSpot",b,a))}},text:{configurable:!0,get:function(){return this.Zb},set:function(a){var b=this.Zb;b!==a&&(F&&A(a,"string",S,"text"),this.Zb=a,this.g("text",b,a))}},containingGroup:{configurable:!0,get:function(){return this.ri},set:function(a){if(this.bc()){var b=this.ri;if(b!==a){F&&null!==a&&x(a,Hf,S,"containingGroup");null===a||this!==a&&!a.Ed(this)||(this===a&&v("Cannot make a Group a member of itself: "+this.toString()),v("Cannot make a Group indirectly contain itself: "+
this.toString()+" already contains "+a.toString()));this.D(2);var c=this.diagram;null!==b?Zo(b,this):this instanceof Hf&&null!==c&&c.Hh.remove(this);this.ri=a;null!==a?Yo(a,this):this instanceof Hf&&null!==c&&c.Hh.add(this);this.D(1);if(null!==c&&c.ba){var d=this.data,e=c.model;if(null!==d&&e.oj()){var f=e.pa(null!==a?a.data:null);e.hr(d,f)}}d=this.containingGroupChanged;null!==d&&(e=!0,null!==c&&(e=c.ba,c.ba=!0),d(this,b,a),null!==c&&(c.ba=e));if(this instanceof Hf)for(c=new I,hl(c,this,!0,0,!0),
c=c.iterator;c.next();)if(d=c.value,d instanceof T)for(d=d.linksConnected;d.next();)dp(d.value);if(this instanceof T){for(c=this.linksConnected;c.next();)dp(c.value);c=this.labeledLink;null!==c&&dp(c)}this.g("containingGroup",b,a);null!==a&&(b=a.layer,null!==b&&Bi(b,-1,a))}}else v("cannot set the Part.containingGroup of a Link or Adornment")}},containingGroupChanged:{configurable:!0,get:function(){return this.Bn},set:function(a){var b=this.Bn;b!==a&&(null!==a&&A(a,"function",S,"containingGroupChanged"),
this.Bn=a,this.g("containingGroupChanged",b,a))}},isTopLevel:{configurable:!0,get:function(){return null!==this.containingGroup||this instanceof T&&null!==this.labeledLink?!1:!0}},layoutConditions:{configurable:!0,get:function(){return this.Ho},set:function(a){var b=this.Ho;b!==a&&(F&&A(a,"number",S,"layoutConditions"),this.Ho=a,this.g("layoutConditions",b,a))}},dragComputation:{configurable:!0,get:function(){return this.Tn},set:function(a){var b=this.Tn;
b!==a&&(null!==a&&A(a,"function",S,"dragComputation"),this.Tn=a,this.g("dragComputation",b,a))}},shadowOffset:{configurable:!0,get:function(){return this.Yp},set:function(a){var b=this.Yp;b.A(a)||(F&&x(a,J,S,"shadowOffset"),this.Yp=a=a.J(),this.P(),this.g("shadowOffset",b,a))}},shadowColor:{configurable:!0,get:function(){return this.Xp},set:function(a){var b=this.Xp;b!==a&&(F&&A(a,"string",S,"shadowColor"),this.Xp=a,this.P(),this.g("shadowColor",b,a))}},shadowBlur:{configurable:!0,
enumerable:!0,get:function(){return this.rf},set:function(a){var b=this.rf;b!==a&&(F&&A(a,"number",S,"shadowBlur"),this.rf=a,this.P(),this.g("shadowBlur",b,a))}}});S.prototype.invalidateLayout=S.prototype.D;S.prototype.findCommonContainingGroup=S.prototype.my;S.prototype.isMemberOf=S.prototype.Ed;S.prototype.findTopLevelPart=S.prototype.aA;S.prototype.findSubGraphLevel=S.prototype.Yz;S.prototype.ensureBounds=S.prototype.Fb;S.prototype.getDocumentBounds=S.prototype.Cm;
S.prototype.getRelativePoint=S.prototype.If;S.prototype.findObject=S.prototype.fb;S.prototype.moveTo=S.prototype.moveTo;S.prototype.invalidateAdornments=S.prototype.Sb;S.prototype.clearAdornments=S.prototype.lk;S.prototype.removeAdornment=S.prototype.Mf;S.prototype.addAdornment=S.prototype.Kh;S.prototype.findAdornment=S.prototype.uk;S.prototype.updateTargetBindings=S.prototype.Ga;var Wo=!1;S.className="Part";S.LayoutNone=0;S.LayoutAdded=1;S.LayoutRemoved=2;S.LayoutShown=4;S.LayoutHidden=8;
S.LayoutNodeSized=16;S.LayoutGroupLayout=32;S.LayoutNodeReplaced=64;S.LayoutStandard=127;S.LayoutAll=16777215;function Te(a){S.call(this,a);this.F&=-257;this.nh="Adornment";this.me=null;this.Fx=0;this.Tx=!1;this.l=[];this.Qa=null}la(Te,S);Te.prototype.toString=function(){var a=this.adornedPart;return"Adornment("+this.category+")"+(null!==a?a.toString():"")};Te.prototype.updateRelationshipsFromData=function(){};
Te.prototype.Ck=function(a){var b=this.adornedObject.part;if(b instanceof R&&this.adornedObject instanceof Yf){var c=b.path;b.Ck(a);a=c.geometry;b=this.$.j;c=b.length;for(var d=0;d<c;d++){var e=b[d];e.isPanelMain&&e instanceof Yf&&(e.qa=a)}}};Te.prototype.qj=function(){var a=this.me;if(null===a)return!0;a=a.part;return null===a||!Ij(a)};Te.prototype.bc=function(){return!1};
Te.prototype.Jk=function(a,b,c,d,e,f,g){if(a===Je&&"elements"===b)if(e instanceof Kg)null===this.Qa?this.Qa=e:F&&this.Qa!==e&&v("Cannot insert a second Placeholder into the visual tree of an Adornment.");else{if(e instanceof U){var h=e.ym(function(a){return a instanceof Kg});h instanceof Kg&&(null===this.Qa?this.Qa=h:F&&this.Qa!==h&&v("Cannot insert a second Placeholder into the visual tree of an Adornment."))}}else a===Ke&&"elements"===b&&null!==this.Qa&&(d===this.Qa?this.Qa=null:d instanceof U&&
this.Qa.Lg(d)&&(this.Qa=null));S.prototype.Jk.call(this,a,b,c,d,e,f,g)};Te.prototype.updateAdornments=function(){};Te.prototype.sk=function(){};
ma.Object.defineProperties(Te.prototype,{placeholder:{configurable:!0,get:function(){return this.Qa}},adornedObject:{configurable:!0,get:function(){return this.me},set:function(a){F&&null!==a&&x(a,N,S,"adornedObject:value");var b=this.adornedPart,c=null;null!==a&&(c=a.part);null===b||null!==a&&b===c||b.Mf(this.category);this.me=a;null!==c&&c.Kh(this.category,this)}},adornedPart:{configurable:!0,get:function(){var a=this.me;return null!==a?a.part:null}},containingGroup:{configurable:!0,
enumerable:!0,get:function(){return null}}});Te.className="Adornment";function T(a){S.call(this,a);this.T=13;this.eb=new H;this.qq=this.Gl=this.Ki=this.Jo=this.Io=null;this.Xk=Fc;this.xc=this.Ye=null;this.Ap=ep;this.Ih=!1}la(T,S);T.prototype.cloneProtected=function(a){S.prototype.cloneProtected.call(this,a);a.T=this.T;a.T=this.T&-17;a.Io=this.Io;a.Jo=this.Jo;a.Ki=this.Ki;a.qq=this.qq;a.Xk=this.Xk.J();a.Ap=this.Ap};t=T.prototype;
t.Ef=function(a){S.prototype.Ef.call(this,a);a.md();a.Ye=this.Ye;a.xc=null};function fp(a,b){null!==b&&(null===a.Ye&&(a.Ye=new I),a.Ye.add(b))}function gp(a,b,c,d){if(null===b||null===a.Ye)return null;for(var e=a.Ye.iterator;e.next();){var f=e.value;if(f.au===a&&f.lw===b&&f.Jy===c&&f.Ky===d||f.au===b&&f.lw===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=gp(this,a,b,c);null!==a&&a.Em()};
t.Jk=function(a,b,c,d,e,f,g){a===Je&&"elements"===b?this.xc=null:a===Ke&&"elements"===b&&(this.xc=null);S.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)||(hp(this,c.fromPort),hp(this,c.toPort),c.Ya())}};function El(a,b){for(var c=a.linksConnected;c.next();){var d=c.value;if(d.fromPort===b||d.toPort===b)hp(a,d.fromPort),hp(a,d.toPort),d.Ya()}}
function hp(a,b){null!==b&&(b=b.zp,null!==b&&b.Em(),a=a.containingGroup,null===a||a.isSubGraphExpanded||hp(a,a.port))}t.qj=function(){return!0};T.prototype.getAvoidableRect=function(a){a.set(this.actualBounds);a.xq(this.Xk);return a};T.prototype.findVisibleNode=function(){for(var a=this;null!==a&&!a.isVisible();)a=a.containingGroup;return a};
T.prototype.isVisible=function(){if(!S.prototype.isVisible.call(this))return!1;var a=!0,b=Gi,c=this.diagram;if(null!==c){if(c.animationManager.cu(this))return!0;a=c.isTreePathToChildren;b=c.treeCollapsePolicy}if(b===Gi){if(a=this.Kg(),null!==a&&!a.isTreeExpanded)return!1}else if(b===Uk){if(a=a?this.Vv():this.Wv(),0<a.count&&a.all(function(a){return!a.isTreeExpanded}))return!1}else if(b===Vk&&(a=a?this.Vv():this.Wv(),0<a.count&&a.any(function(a){return!a.isTreeExpanded})))return!1;a=this.labeledLink;
return null!==a?a.isVisible():!0};T.prototype.Vb=function(a){S.prototype.Vb.call(this,a);for(var b=this.linksConnected;b.next();){var c=b.value;a&&null!==this.containingGroup&&(c.Lq(this).Ed(this.containingGroup)||c.Ya());c.Vb(a)}};T.prototype.ny=function(){var a=new I,b=new I;ip(this,this,a,b);return b.iterator};
function ip(a,b,c,d){if(!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)&&ip(a,e?f.toNode:f.fromNode,c,d):d.add(f)})}}T.prototype.findLinksConnected=function(a){void 0===a&&(a=null);if(null===a)return this.eb.iterator;F&&A(a,"string",T,"findLinksConnected:pid");var b=new nb(this.eb),c=this;b.predicate=function(b){return b.fromNode===c&&b.fromPortId===a||b.toNode===c&&b.toPortId===a};return b};
t=T.prototype;t.Gq=function(a){void 0===a&&(a=null);F&&null!==a&&A(a,"string",T,"findLinksOutOf:pid");var b=new nb(this.eb),c=this;b.predicate=function(b){return b.fromNode!==c?!1:null===a?!0:b.fromPortId===a};return b};t.Dd=function(a){void 0===a&&(a=null);F&&null!==a&&A(a,"string",T,"findLinksInto:pid");var b=new nb(this.eb),c=this;b.predicate=function(b){return b.toNode!==c?!1:null===a?!0:b.toPortId===a};return b};
t.Uv=function(a){void 0===a&&(a=null);F&&null!==a&&A(a,"string",T,"findNodesConnected:pid");for(var b=null,c=null,d=this.eb.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 I,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 I,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new mb(c):lb};
t.Wv=function(a){void 0===a&&(a=null);F&&null!==a&&A(a,"string",T,"findNodesOutOf:pid");for(var b=null,c=null,d=this.eb.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 I,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new mb(c):lb};
t.Vv=function(a){void 0===a&&(a=null);F&&null!==a&&A(a,"string",T,"findNodesInto:pid");for(var b=null,c=null,d=this.eb.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 I,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new mb(c):lb};
t.Tz=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);F&&(x(a,T,T,"findLinksBetween:othernode"),null!==b&&A(b,"string",T,"findLinksBetween:pid"),null!==c&&A(c,"string",T,"findLinksBetween:otherpid"));var d=new nb(this.eb),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.Uz=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);F&&(x(a,T,T,"findLinksTo:othernode"),null!==b&&A(b,"string",T,"findLinksTo:pid"),null!==c&&A(c,"string",T,"findLinksTo:otherpid"));var d=new nb(this.eb),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 jp(a,b,c){hp(a,c);var d=a.eb.contains(b);d||a.eb.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.ba,g.ba=!0);e(a,b,c);null!==g&&(g.ba=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.Ih||(e.Ih=f),!f.isTreeLeaf||null!==a&&a.undoManager.isUndoingRedoing||(d?c===f&&(f.isTreeLeaf=!1):b===f&&(f.isTreeLeaf=!1))))}
function kp(a,b,c){hp(a,c);var d=a.eb.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.ba,e.ba=!0);f(a,b,c);null!==e&&(e.ba=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.Ih=!1),null===b||b.isTreeLeaf||(0===b.eb.count?(b.Ih=null,null!==e&&e.undoManager.isUndoingRedoing||(b.isTreeLeaf=!0)):Tk(b)))}
function Tk(a){a.Ih=!1;if(0!==a.eb.count){var b=!0,c=a.diagram;if(null===c||!c.undoManager.isUndoingRedoing){null!==c&&(b=c.isTreePathToChildren);for(c=a.eb.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}}}T.prototype.updateRelationshipsFromData=function(){var a=this.diagram;null!==a&&a.partManager.updateRelationshipsFromData(this)};t=T.prototype;
t.Nq=function(a){S.prototype.Nq.call(this,a);a||(Tk(this),a=this.Gl,null!==a&&lp(a,this))};t.Oq=function(a){S.prototype.Oq.call(this,a);a||(a=this.Gl,null!==a&&null!==a.hd&&(a.hd.remove(this),a.u()))};
t.sk=function(){if(0<this.eb.count){var a=this.diagram;if(null!==a)for(var b=null!==a.commandHandler?a.commandHandler.deletesConnectedLinks:!0,c=this.eb.copy().iterator;c.next();){var d=c.value;b?a.remove(d):(d.fromNode===this&&(d.fromNode=null),d.toNode===this&&(d.toNode=null))}}this.labeledLink=null;S.prototype.sk.call(this)};
t.Lt=function(a){F&&A(a,"string",T,"findPort:pid");if(null===this.xc){if(""===a&&!1===this.Sh)return this;mp(this)}var b=this.xc.K(a);return null!==b||""!==a&&(b=this.xc.K(""),null!==b)?b:this};function mp(a){null===a.xc?a.xc=new Db:a.xc.clear();a.Nk(a,function(a,c){im(a,c)});0===a.xc.count&&a.xc.add("",a)}function im(a,b){var c=b.portId;null!==c&&null!==a.xc&&a.xc.add(c,b)}
function hm(a,b,c){var d=b.portId;if(null!==d&&(null!==a.xc&&a.xc.remove(d),b=a.diagram,null!==b&&c)){c=null;for(a=a.findLinksConnected(d);a.next();)d=a.value,null===c&&(c=La()),c.push(d);if(null!==c){for(a=0;a<c.length;a++)b.remove(c[a]);Oa(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.eb.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.eb.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.eA=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this;if(a)for(;;){a=null;for(var c=b.eb.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.eb.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.Qz=function(a){if(null===a)return null;F&&x(a,T,T,"findCommonTreeParent:other");if(this===a)return this;for(var b=this;null!==b;)Xo(b,!0),b=b.Kg();var c=null;for(b=a;null!==b;){if(0!==(b.F&1048576)){c=b;break}b=b.Kg()}for(b=this;null!==b;)Xo(b,!1),b=b.Kg();return c};
t.jj=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this.eb.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.Kg=function(){var a=this.Ih;if(null===a)return null;if(a instanceof T)return a;var b=!0;a=this.diagram;null!==a&&(b=a.isTreePathToChildren);a=this.eb.iterator;if(b)for(;a.next();){if(b=a.value,b.isTreeLink&&(b=b.fromNode,b!==this))return this.Ih=b}else for(;a.next();)if(b=a.value,b.isTreeLink&&(b=b.toNode,b!==this))return this.Ih=b;return this.Ih=null};t.cA=function(){function a(b,d){if(null!==b){d.add(b);var c=b.jj();null!==c&&(d.add(c),a(b.Kg(),d))}}var b=new I;a(this,b);return b};
t.bA=function(){return np(this,this)};function np(a,b){b=b.Kg();return null===b?0:1+np(a,b)}t.Iq=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=new nb(this.eb);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.Yv=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);var c=b=null,d=this.eb.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 H,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 H,b.add(c),b.add(a)):c=a);return null!==b?b.iterator:null!==c?new mb(c):lb};
t.dA=function(a){void 0===a&&(a=Infinity);A(a,"number",T,"findTreeParts:level");var b=new I;hl(b,this,!1,a,!0);return b};T.prototype.collapseTree=function(a){void 0===a&&(a=1);C(a,T,"collapseTree:level");1>a&&(a=1);var b=this.diagram;if(null!==b&&!b.Se){b.Se=!0;var c=new I;c.add(this);op(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===Gi);b.Se=!1}};
function op(a,b,c,d,e,f,g){if(1<d)for(var h=c?a.Gq():a.Dd();h.next();){var k=h.value;k.isTreeLink&&(k=k.Lq(a),null===k||k===a||b.contains(k)||(b.add(k),op(k,b,c,d-1,e,f,g)))}else pp(a,b,c,e,f,g)}
function pp(a,b,c,d,e,f){for(var g=e===a?!0:a.isTreeExpanded,h=c?a.Gq():a.Dd();h.next();){var k=h.value;if(k.isTreeLink&&(k=k.Lq(a),null!==k&&k!==a)){var l=b.contains(k);l||b.add(k);g&&(f&&d.hk(k,e),k.Th(),k.Vb(!1));k.isTreeExpanded&&(k.wasTreeExpanded=k.isTreeExpanded,l||pp(k,b,c,d,e,f))}}a.isTreeExpanded=!1}
T.prototype.expandTree=function(a){void 0===a&&(a=2);C(a,T,"expandTree:level");2>a&&(a=2);var b=this.diagram;if(null!==b&&!b.Se){b.Se=!0;var c=new I;c.add(this);qp(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===Gi);b.Se=!1}};
function qp(a,b,c,d,e,f,g){for(var h=f===a?!1:a.isTreeExpanded,k=c?a.Gq():a.Dd();k.next();){var l=k.value;l.isTreeLink&&(h||l.rd||l.Ya(),l=l.Lq(a),null!==l&&l!==a&&!b.contains(l)&&(b.add(l),h||(l.Vb(!0),l.Th(),g&&e.jk(l,f)),2<d||l.wasTreeExpanded))&&(l.wasTreeExpanded=!1,qp(l,b,c,d-1,e,f,g))}a.isTreeExpanded=!0}
ma.Object.defineProperties(T.prototype,{portSpreading:{configurable:!0,get:function(){return this.Ap},set:function(a){var b=this.Ap;b!==a&&(F&&hb(a,T,T,"portSpreading"),this.Ap=a,this.g("portSpreading",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.md())}},avoidable:{configurable:!0,get:function(){return 0!==(this.T&8)},set:function(a){var b=0!==(this.T&8);if(b!==a){F&&A(a,"boolean",T,"avoidable");this.T^=8;var c=this.diagram;null!==c&&Nk(c,this);this.g("avoidable",
b,a)}}},avoidableMargin:{configurable:!0,get:function(){return this.Xk},set:function(a){"number"===typeof a?a=new lc(a):x(a,lc,T,"avoidableMargin");var b=this.Xk;if(!b.A(a)){this.Xk=a=a.J();var c=this.diagram;null!==c&&Nk(c,this);this.g("avoidableMargin",b,a)}}},linksConnected:{configurable:!0,get:function(){return this.eb.iterator}},linkConnected:{configurable:!0,get:function(){return this.Io},set:function(a){var b=this.Io;b!==a&&(null!==a&&A(a,"function",
T,"linkConnected"),this.Io=a,this.g("linkConnected",b,a))}},linkDisconnected:{configurable:!0,get:function(){return this.Jo},set:function(a){var b=this.Jo;b!==a&&(null!==a&&A(a,"function",T,"linkDisconnected"),this.Jo=a,this.g("linkDisconnected",b,a))}},linkValidation:{configurable:!0,get:function(){return this.Ki},set:function(a){var b=this.Ki;b!==a&&(null!==a&&A(a,"function",T,"linkValidation"),this.Ki=a,this.g("linkValidation",b,a))}},isLinkLabel:{configurable:!0,
get:function(){return null!==this.Gl}},labeledLink:{configurable:!0,get:function(){return this.Gl},set:function(a){var b=this.Gl;if(b!==a){F&&null!==a&&x(a,R,T,"labeledLink");var c=this.diagram,d=this.data;if(null!==b){null!==b.hd&&(b.hd.remove(this),b.u());if(null!==c&&null!==d&&!c.undoManager.isUndoingRedoing){var e=b.data,f=c.model;if(null!==e&&f.pj()){var g=f.pa(d);void 0!==g&&f.Ly(e,g)}}this.containingGroup=null}this.Gl=a;null!==a&&(lp(a,this),null===c||null===d||c.undoManager.isUndoingRedoing||
(e=a.data,c=c.model,null!==e&&c.pj()&&(d=c.pa(d),void 0!==d&&c.Ev(e,d))),this.containingGroup=a.containingGroup);Sl(this);this.g("labeledLink",b,a)}}},port:{configurable:!0,get:function(){return this.Lt("")}},ports:{configurable:!0,get:function(){null===this.xc&&mp(this);return this.xc.iteratorValues}},isTreeExpanded:{configurable:!0,get:function(){return 0!==(this.T&1)},set:function(a){var b=0!==(this.T&1);if(b!==a){F&&A(a,"boolean",T,"isTreeExpanded");this.T^=
1;var c=this.diagram;this.g("isTreeExpanded",b,a);b=this.treeExpandedChanged;if(null!==b){var d=!0;null!==c&&(d=c.ba,c.ba=!0);b(this);null!==c&&(c.ba=d)}null!==c&&c.undoManager.isUndoingRedoing?this.Vb(a):a?this.expandTree():this.collapseTree()}}},wasTreeExpanded:{configurable:!0,get:function(){return 0!==(this.T&2)},set:function(a){var b=0!==(this.T&2);b!==a&&(F&&A(a,"boolean",T,"wasTreeExpanded"),this.T^=2,this.g("wasTreeExpanded",b,a))}},treeExpandedChanged:{configurable:!0,
get:function(){return this.qq},set:function(a){var b=this.qq;b!==a&&(null!==a&&A(a,"function",T,"treeExpandedChanged"),this.qq=a,this.g("treeExpandedChanged",b,a))}},isTreeLeaf:{configurable:!0,get:function(){return 0!==(this.T&4)},set:function(a){var b=0!==(this.T&4);b!==a&&(F&&A(a,"boolean",T,"isTreeLeaf"),this.T^=4,this.g("isTreeLeaf",b,a))}}});T.prototype.expandTree=T.prototype.expandTree;T.prototype.collapseTree=T.prototype.collapseTree;T.prototype.findTreeParts=T.prototype.dA;
T.prototype.findTreeChildrenNodes=T.prototype.Yv;T.prototype.findTreeChildrenLinks=T.prototype.Iq;T.prototype.findTreeLevel=T.prototype.bA;T.prototype.findTreeParentChain=T.prototype.cA;T.prototype.findTreeParentNode=T.prototype.Kg;T.prototype.findTreeParentLink=T.prototype.jj;T.prototype.findCommonTreeParent=T.prototype.Qz;T.prototype.findTreeRoot=T.prototype.eA;T.prototype.isInTreeOf=T.prototype.vA;T.prototype.findPort=T.prototype.Lt;T.prototype.findLinksTo=T.prototype.Uz;
T.prototype.findLinksBetween=T.prototype.Tz;T.prototype.findNodesInto=T.prototype.Vv;T.prototype.findNodesOutOf=T.prototype.Wv;T.prototype.findNodesConnected=T.prototype.Uv;T.prototype.findLinksInto=T.prototype.Dd;T.prototype.findLinksOutOf=T.prototype.Gq;T.prototype.findExternalTreeLinksConnected=T.prototype.ny;T.prototype.invalidateConnectedLinks=T.prototype.md;T.prototype.invalidateLinkBundle=T.prototype.tA;
var rp=new E(T,"SpreadingNone",10),ep=new E(T,"SpreadingEvenly",11),sp=new E(T,"SpreadingPacked",12);T.className="Node";T.SpreadingNone=rp;T.SpreadingEvenly=ep;T.SpreadingPacked=sp;function Hf(a){T.call(this,a);this.T|=4608;this.To=new I;this.Ol=new I;this.Qa=this.hq=this.Li=this.Uo=this.So=null;this.oc=new Ni;this.oc.group=this}la(Hf,T);
Hf.prototype.cloneProtected=function(a){T.prototype.cloneProtected.call(this,a);this.T=this.T&-32769;a.So=this.So;a.Uo=this.Uo;a.Li=this.Li;a.hq=this.hq;var b=a.ym(function(a){return a instanceof Kg});b instanceof Kg?a.Qa=b:a.Qa=null;null!==this.oc?(a.oc=this.oc.copy(),a.oc.group=a):(null!==a.oc&&(a.oc.group=null),a.oc=null)};t=Hf.prototype;
t.Ef=function(a){T.prototype.Ef.call(this,a);var b=a.vk();for(a=a.memberParts;a.next();){var c=a.value;c.u();c.D(8);c.lk();if(c instanceof T)c.md(b);else if(c instanceof R)for(c=c.labelNodes;c.next();)c.value.md(b)}};
t.Jk=function(a,b,c,d,e,f,g){if(a===Je&&"elements"===b)if(e instanceof Kg)null===this.Qa?this.Qa=e:this.Qa!==e&&v("Cannot insert a second Placeholder into the visual tree of a Group.");else{if(e instanceof U){var h=e.ym(function(a){return a instanceof Kg});h instanceof Kg&&(null===this.Qa?this.Qa=h:this.Qa!==h&&v("Cannot insert a second Placeholder into the visual tree of a Group."))}}else a===Ke&&"elements"===b&&null!==this.Qa&&(d===this.Qa?this.Qa=null:d instanceof U&&this.Qa.Lg(d)&&(this.Qa=null));
T.prototype.Jk.call(this,a,b,c,d,e,f,g)};t.Nh=function(a,b,c,d){this.jf=this.Qa;T.prototype.Nh.call(this,a,b,c,d)};t.Fb=function(){this.memberParts.each(function(a){a.Fb()});T.prototype.Fb.call(this)};t.qj=function(){if(!T.prototype.qj.call(this))return!1;for(var a=this.memberParts;a.next();){var b=a.value;if(b instanceof T){if(b.isVisible()&&Ij(b))return!1}else if(b instanceof R&&b.isVisible()&&Ij(b)&&b.fromNode!==this&&b.toNode!==this)return!1}return!0};
function Yo(a,b){if(a.To.add(b)){b instanceof Hf&&a.Ol.add(b);var c=a.memberAdded;if(null!==c){var d=!0,e=a.diagram;null!==e&&(d=e.ba,e.ba=!0);c(a,b);null!==e&&(e.ba=d)}a.isVisible()&&a.isSubGraphExpanded||b.Vb(!1)}b instanceof R&&!a.computesBoundsIncludingLinks||(b=a.Qa,null===b&&(b=a),b.u())}
function Zo(a,b){if(a.To.remove(b)){b instanceof Hf&&a.Ol.remove(b);var c=a.memberRemoved;if(null!==c){var d=!0,e=a.diagram;null!==e&&(d=e.ba,e.ba=!0);c(a,b);null!==e&&(e.ba=d)}a.isVisible()&&a.isSubGraphExpanded||b.Vb(!0)}b instanceof R&&!a.computesBoundsIncludingLinks||(b=a.Qa,null===b&&(b=a),b.u())}t.sk=function(){if(0<this.To.count){var a=this.diagram;if(null!==a)for(var b=this.To.copy().iterator;b.next();)a.remove(b.value)}T.prototype.sk.call(this)};
Hf.prototype.canAddMembers=function(a){var b=this.diagram;if(null===b)return!1;b=b.commandHandler;for(a=jl(a).iterator;a.next();)if(!b.isValidMember(this,a.value))return!1;return!0};Hf.prototype.addMembers=function(a,b){var c=this.diagram;if(null===c)return!1;c=c.commandHandler;var d=!0;for(a=jl(a).iterator;a.next();){var e=a.value;!b||c.isValidMember(this,e)?e.containingGroup=this:d=!1}return d};
Hf.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=Hf.prototype;
t.md=function(a){void 0===a&&(a=null);var b=0!==(this.T&65536);T.prototype.md.call(this,a);if(!b)for(0!==(this.T&65536)!==!0&&(this.T=this.T^65536),b=this.Tv();b.next();){var c=b.value;if(null===a||!a.contains(c)){var d=c.fromNode;null!==d&&d!==this&&d.Ed(this)&&!d.isVisible()?(hp(d,c.fromPort),hp(d,c.toPort),c.Ya()):(d=c.toNode,null!==d&&d!==this&&d.Ed(this)&&!d.isVisible()&&(hp(d,c.fromPort),hp(d,c.toPort),c.Ya()))}}};
t.Tv=function(){var a=this.vk();a.add(this);for(var b=new I,c=a.iterator;c.next();){var d=c.value;if(d instanceof T)for(d=d.linksConnected;d.next();){var e=d.value;a.contains(e)||b.add(e)}}return b.iterator};t.Sz=function(){var a=this.vk();a.add(this);for(var b=new I,c=a.iterator;c.next();){var d=c.value;if(d instanceof T)for(d=d.linksConnected;d.next();){var e=d.value,f=e.fromNode;a.contains(f)&&f!==this||b.add(f);e=e.toNode;a.contains(e)&&e!==this||b.add(e)}}return b.iterator};
t.Rz=function(){function a(b,d){null!==b&&(d.add(b),a(b.containingGroup,d))}var b=new I;a(this,b);return b};t.vk=function(){var a=new I;hl(a,this,!0,0,!0);a.remove(this);return a};t.Vb=function(a){T.prototype.Vb.call(this,a);for(var b=this.memberParts;b.next();)b.value.Vb(a)};Hf.prototype.collapseSubGraph=function(){var a=this.diagram;if(null!==a&&!a.Se){a.Se=!0;var b=this.vk();tp(this,b,a,this);a.Se=!1}};
function tp(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Vb(!1);f instanceof Hf&&f.isSubGraphExpanded&&(f.wasSubGraphExpanded=f.isSubGraphExpanded,tp(f,b,c,d));if(f instanceof T)f.md(b),c.hk(f,d);else if(f instanceof R)for(f=f.labelNodes;f.next();)f.value.md(b)}a.isSubGraphExpanded=!1}Hf.prototype.expandSubGraph=function(){var a=this.diagram;if(null!==a&&!a.Se){a.Se=!0;var b=this.vk();up(this,b,a,this);a.Se=!1}};
function up(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Vb(!0);f instanceof Hf&&f.wasSubGraphExpanded&&(f.wasSubGraphExpanded=!1,up(f,b,c,d));if(f instanceof T)f.md(b),c.jk(f,d);else if(f instanceof R)for(f=f.labelNodes;f.next();)f.value.md(b)}a.isSubGraphExpanded=!0}
Hf.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();T.prototype.move.call(this,a,b);a=new I;for(b=this.vk().iterator;b.next();)if(e=b.value,e instanceof R&&(e.suspendsRouting&&a.add(e),e.rd||e.fromNode!==this&&e.toNode!==this))e.suspendsRouting=!0;for(b.reset();b.next();)if(e=b.value,!(e.Uh()||e instanceof T&&e.isLinkLabel)){var g=
e.position,h=e.location;g.o()?(f.x=g.x+d,f.y=g.y+c,e.position=f):h.o()&&(f.x=h.x+d,f.y=h.y+c,e.location=f)}for(b.reset();b.next();)if(e=b.value,e instanceof R&&(e.suspendsRouting=a.contains(e),e.rd||e.fromNode!==this&&e.toNode!==this))g=e.position,f.x=g.x+d,f.y=g.y+c,f.o()?e.move(f):e.Ya(),fk(e)&&e.Ya();J.free(f)}};
ma.Object.defineProperties(Hf.prototype,{placeholder:{configurable:!0,get:function(){return this.Qa}},computesBoundsAfterDrag:{configurable:!0,get:function(){return 0!==(this.T&2048)},set:function(a){var b=0!==(this.T&2048);b!==a&&(A(a,"boolean",Hf,"computesBoundsAfterDrag"),this.T^=2048,this.g("computesBoundsAfterDrag",b,a))}},computesBoundsIncludingLinks:{configurable:!0,get:function(){return 0!==(this.T&4096)},set:function(a){A(a,"boolean",Hf,"computesBoundsIncludingLinks");
var b=0!==(this.T&4096);b!==a&&(this.T^=4096,this.g("computesBoundsIncludingLinks",b,a))}},computesBoundsIncludingLocation:{configurable:!0,get:function(){return 0!==(this.T&8192)},set:function(a){A(a,"boolean",Hf,"computesBoundsIncludingLocation");var b=0!==(this.T&8192);b!==a&&(this.T^=8192,this.g("computesBoundsIncludingLocation",b,a))}},handlesDragDropForMembers:{configurable:!0,get:function(){return 0!==(this.T&16384)},set:function(a){A(a,"boolean",Hf,"handlesDragDropForMembers");
var b=0!==(this.T&16384);b!==a&&(this.T^=16384,this.g("handlesDragDropForMembers",b,a))}},memberParts:{configurable:!0,get:function(){return this.To.iterator}},layout:{configurable:!0,get:function(){return this.oc},set:function(a){var b=this.oc;if(b!==a){null!==a&&x(a,Ni,Hf,"layout");null!==b&&(b.diagram=null,b.group=null);this.oc=a;var c=this.diagram;null!==a&&(a.diagram=c,a.group=this);null!==c&&(c.Tg=!0);this.g("layout",b,a);null!==c&&c.Hb()}}},memberAdded:{configurable:!0,
enumerable:!0,get:function(){return this.So},set:function(a){var b=this.So;b!==a&&(null!==a&&A(a,"function",Hf,"memberAdded"),this.So=a,this.g("memberAdded",b,a))}},memberRemoved:{configurable:!0,get:function(){return this.Uo},set:function(a){var b=this.Uo;b!==a&&(null!==a&&A(a,"function",Hf,"memberRemoved"),this.Uo=a,this.g("memberRemoved",b,a))}},memberValidation:{configurable:!0,get:function(){return this.Li},set:function(a){var b=this.Li;b!==a&&(null!==a&&A(a,"function",
Hf,"memberValidation"),this.Li=a,this.g("memberValidation",b,a))}},ungroupable:{configurable:!0,get:function(){return 0!==(this.T&256)},set:function(a){var b=0!==(this.T&256);b!==a&&(A(a,"boolean",Hf,"ungroupable"),this.T^=256,this.g("ungroupable",b,a))}},isSubGraphExpanded:{configurable:!0,get:function(){return 0!==(this.T&512)},set:function(a){var b=0!==(this.T&512);if(b!==a){A(a,"boolean",Hf,"isSubGraphExpanded");this.T^=512;var c=this.diagram;this.g("isSubGraphExpanded",
b,a);b=this.subGraphExpandedChanged;if(null!==b){var d=!0;null!==c&&(d=c.ba,c.ba=!0);b(this);null!==c&&(c.ba=d)}null!==c&&c.undoManager.isUndoingRedoing?(null!==this.Qa&&this.Qa.u(),this.memberParts.each(function(a){a.updateAdornments()})):a?this.expandSubGraph():this.collapseSubGraph()}}},wasSubGraphExpanded:{configurable:!0,get:function(){return 0!==(this.T&1024)},set:function(a){var b=0!==(this.T&1024);b!==a&&(A(a,"boolean",Hf,"wasSubGraphExpanded"),this.T^=1024,this.g("wasSubGraphExpanded",
b,a))}},subGraphExpandedChanged:{configurable:!0,get:function(){return this.hq},set:function(a){var b=this.hq;b!==a&&(null!==a&&A(a,"function",Hf,"subGraphExpandedChanged"),this.hq=a,this.g("subGraphExpandedChanged",b,a))}},Ik:{configurable:!0,get:function(){return 0!==(this.T&32768)},set:function(a){0!==(this.T&32768)!==a&&(this.T^=32768)}}});Hf.prototype.expandSubGraph=Hf.prototype.expandSubGraph;Hf.prototype.collapseSubGraph=Hf.prototype.collapseSubGraph;
Hf.prototype.findSubGraphParts=Hf.prototype.vk;Hf.prototype.findContainingGroupChain=Hf.prototype.Rz;Hf.prototype.findExternalNodesConnected=Hf.prototype.Sz;Hf.prototype.findExternalLinksConnected=Hf.prototype.Tv;Hf.prototype.ensureBounds=Hf.prototype.Fb;Hf.className="Group";function Kg(){N.call(this);this.lb=Ec;this.Op=new L(NaN,NaN,NaN,NaN)}la(Kg,N);Kg.prototype.cloneProtected=function(a){N.prototype.cloneProtected.call(this,a);a.lb=this.lb.J();a.Op=this.Op.copy()};
Kg.prototype.Ph=function(a){if(null===this.background&&null===this.areaBackground)return!1;var b=this.naturalBounds;return rc(0,0,b.width,b.height,a.x,a.y)};
Kg.prototype.Im=function(){var a=this.part;null!==a&&(a instanceof Hf||a instanceof Te)||v("Placeholder is not inside a Group or Adornment.");if(a instanceof Hf){var b=this.computeBorder(this.Op),c=this.minSize,d=this.uc;gc(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);xl(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.gw(a)||isNaN(b.x)||
isNaN(b.y)||(c=J.alloc(),c.sj(b,a.locationSpot),c.A(a.location)||(a.location=new J(c.x,c.y)),J.free(c))}else{b=this.uc;c=this.lb;d=c.left+c.right;var e=c.top+c.bottom,f=a.adornedObject;a.angle=f.lj();var g=0;f instanceof Yf&&(g=f.strokeWidth);var h=f.Gf(),k=f.naturalBounds,l=(k.width+g)*h;g=(k.height+g)*h;a.type!==U.Link&&(f=f.ma("Selection"===a.category?Hc:a.locationSpot,J.alloc()),a.location=f,J.free(f));isNaN(l)||isNaN(g)?(a=a.adornedObject,l=a.ma(Hc,J.alloc()),f=L.allocAt(l.x,l.y,0,0),f.Ve(a.ma(Sc,
l)),f.Ve(a.ma(Jc,l)),f.Ve(a.ma(Oc,l)),gc(b,f.width+d||0,f.height+e||0),xl(this,-c.left,-c.top,b.width,b.height),J.free(l),L.free(f)):(gc(b,l+d||0,g+e||0),xl(this,-c.left,-c.top,b.width,b.height))}};Kg.prototype.Nh=function(a,b,c,d){this.actualBounds.h(a,b,c,d)};
Kg.prototype.computeBorder=function(a){var b=this.part,c=b.diagram;if(null!==c&&b instanceof Hf&&!b.layer.isTemporary&&b.computesBoundsAfterDrag&&this.Op.o()){var d=c.toolManager.findTool("Dragging");if(d===c.currentTool&&(c=d.computeBorder(b,this.Op,a),null!==c))return c}c=L.alloc();d=this.computeMemberBounds(c);var e=this.lb;b instanceof Hf&&!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));L.free(c);
b instanceof Hf&&b.computesBoundsIncludingLocation&&b.location.o()&&a.Ve(b.location);return a};
Kg.prototype.computeMemberBounds=function(a){if(!(this.part instanceof Hf))return a.h(0,0,0,0),a;for(var b=this.part,c=Infinity,d=Infinity,e=-Infinity,f=-Infinity,g=b.memberParts;g.next();){var h=g.value;if(h.isVisible()){if(h instanceof R){if(!b.computesBoundsIncludingLinks)continue;if(Hj(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(Kg.prototype,{padding:{configurable:!0,get:function(){return this.lb},set:function(a){"number"===typeof a?a=new lc(a):x(a,lc,Kg,"padding");var b=this.lb;b.A(a)||(this.lb=a=a.J(),this.g("padding",b,a),this.u())}}});Kg.className="Placeholder";
function R(){S.call(this,U.Link);this.Va=8;this.bf=null;this.cf="";this.yf=this.ho=null;this.zf="";this.pq=null;this.Sk=og;this.In=0;this.Kn=og;this.Ln=NaN;this.$j=vp;this.bq=.5;this.hd=null;this.Db=(new H).freeze();this.wh=this.Jc=null;this.Tl=new L;this.qa=new Fd;this.to=!0;this.L=this.w=this.Tf=this.bg=null;this.l=[];this.wv=new J;this.es=this.Ox=this.Nx=null;this.Ru=NaN;this.S=null}la(R,S);
R.prototype.cloneProtected=function(a){S.prototype.cloneProtected.call(this,a);a.Va=this.Va&-113;a.cf=this.cf;a.ho=this.ho;a.zf=this.zf;a.pq=this.pq;a.Sk=this.Sk;a.In=this.In;a.Kn=this.Kn;a.Ln=this.Ln;a.$j=this.$j;a.bq=this.bq;null!==this.S&&(a.S=this.S.copy())};t=R.prototype;t.Ef=function(a){S.prototype.Ef.call(this,a);this.cf=a.cf;this.zf=a.zf;a.Jc=null;a.Ya();a.Tf=this.Tf;var b=a.fromPort;null!==b&&hp(a.fromNode,b);b=a.toPort;null!==b&&hp(a.toNode,b)};
t.mb=function(a){a.classType===R?2===(a.value&2)?this.routing=a:a===rg||a===ng||a===mg?this.curve=a:a===wp||a===xp||a===yp?this.adjusting=a:a!==vp&&a!==og&&v("Unknown Link enum value for a Link property: "+a):S.prototype.mb.call(this,a)};t.Mc=function(){null===this.S&&(this.S=new tl)};t.qj=function(){var a=this.fromNode;if(null!==a){var b=a.findVisibleNode();null!==b&&(a=b);if(Ij(a)||Jj(a))return!1}a=this.toNode;return null!==a&&(b=a.findVisibleNode(),null!==b&&(a=b),Ij(a)||Jj(a))?!1:!0};t.Gw=function(){return!1};
t.nu=function(){};t.bc=function(){return!1};R.prototype.computeAngle=function(a,b,c){return R.computeAngle(b,c)};R.computeAngle=function(a,b){switch(a){default:case og:a=0;break;case ln:a=b;break;case dn:a=b+90;break;case fn:a=b-90;break;case zp:a=b+180;break;case mn:a=K.Xq(b);90<a&&270>a&&(a-=180);break;case en:a=K.Xq(b+90);90<a&&270>a&&(a-=180);break;case gn:a=K.Xq(b-90);90<a&&270>a&&(a-=180);break;case hn:a=K.Xq(b);if(45<a&&135>a||225<a&&315>a)return 0;90<a&&270>a&&(a-=180)}return K.Xq(a)};
function dp(a){var b=a.fromNode,c=a.toNode,d=null;null!==b?d=null!==c?b.my(c):b.containingGroup:null!==c?d=c.containingGroup:d=null;b=d;c=a.ri;if(c!==b){null!==c&&Zo(c,a);a.ri=b;null!==b&&Yo(b,a);var e=a.containingGroupChanged;if(null!==e){var f=!0,g=a.diagram;null!==g&&(f=g.ba,g.ba=!0);e(a,c,b);null!==g&&(g.ba=f)}!a.rd||a.Nx!==c&&a.Ox!==c||a.Ya()}if(a.isLabeledLink)for(a=a.labelNodes;a.next();)a.value.containingGroup=d}t=R.prototype;
t.Th=function(){var a=this.containingGroup;null!==a&&this.fromNode!==a&&this.toNode!==a&&a.computesBoundsIncludingLinks&&S.prototype.Th.call(this)};t.Lq=function(a){F&&x(a,T,R,"getOtherNode:node");var b=this.fromNode;return a===b?this.toNode:b};t.jA=function(a){F&&x(a,N,R,"getOtherPort:port");var b=this.fromPort;return a===b?this.toPort:b};function lp(a,b){null===a.hd&&(a.hd=new I);a.hd.add(b);a.u()}
t.Nq=function(a){S.prototype.Nq.call(this,a);Ap(this)&&this.Qq(this.actualBounds);if(!a){a=this.bf;var b=null;null!==a&&(b=this.fromPort,jp(a,this,b));var c=this.yf;if(null!==c){var d=this.toPort;c===a&&d===b||jp(c,this,d)}Bp(this)}};t.Oq=function(a){S.prototype.Oq.call(this,a);Ap(this)&&this.Qq(this.actualBounds);if(!a){a=this.bf;var b=null;null!==a&&(b=this.fromPort,kp(a,this,b));var c=this.yf;if(null!==c){var d=this.toPort;c===a&&d===b||kp(c,this,d)}Cp(this)}};
t.sk=function(){this.rd=!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))};R.prototype.updateRelationshipsFromData=function(){if(null!==this.data){var a=this.diagram;null!==a&&a.partManager.updateRelationshipsFromData(this)}};
R.prototype.move=function(a,b){var c=b?this.location:this.position,d=c.x;isNaN(d)&&(d=0);var e=c.y;isNaN(e)&&(e=0);d=a.x-d;e=a.y-e;!0===b?S.prototype.move.call(this,a,!1):(a=J.allocAt(c.x+d,c.y+e),S.prototype.move.call(this,a,!1),J.free(a));Cf(this,d,e);for(a=this.labelNodes;a.next();)b=a.value,c=b.position,b.moveTo(c.x+d,c.y+e)};
R.prototype.canRelinkFrom=function(){if(!this.relinkableFrom)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowRelink)return!1;a=a.diagram;return null===a||a.allowRelink?!0:!1};R.prototype.canRelinkTo=function(){if(!this.relinkableTo)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowRelink)return!1;a=a.diagram;return null===a||a.allowRelink?!0:!1};
R.prototype.computeMidPoint=function(a){var b=this.pointsCount;if(0===b)return a.assign(Vb),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()===rg))return this.qa.Zv(.5,a),a.add(this.i(0)),c=this.qa.figures.first(),a.offset(-c.startX,-c.startY),a;if(this.computeCurve()===rg){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.uz(d.x,d.y,e.x,e.y,f.x,f.y,c.x,c.y,a)}else a.assign(this.i(c));return a}var g=this.flattenedLengths;c=this.flattenedTotalLength;for(e=f=d=0;d<c/2&&f<b;){e=g[f];if(d+e>c/2)break;d+=e;f++}b=this.i(f);f=this.i(f+1);1>Math.abs(b.x-f.x)?b.y>f.y?a.h(b.x,b.y-(c/2-d)):a.h(b.x,b.y+(c/2-d)):1>Math.abs(b.y-f.y)?b.x>f.x?a.h(b.x-(c/2-d),b.y):a.h(b.x+(c/2-d),b.y):(c=(c/2-d)/e,a.h(b.x+c*(f.x-b.x),b.y+c*(f.y-b.y)));return a};
R.prototype.computeMidAngle=function(){var a=this.pointsCount;if(2>a)return NaN;if(2===a)return this.i(0).Xa(this.i(1));if(this.isOrthogonal&&(15<=this.computeCorner()||this.computeCurve()===rg))return this.qa.ty(.5);if(this.computeCurve()===rg&&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.sz(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).Xa(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).Xa(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.Xa(d)};t=R.prototype;t.i=function(a){return this.Db.j[a]};
t.pd=function(a,b){F&&(x(b,J,R,"setPoint"),b.o()||v("Link.setPoint called with a Point that does not have real numbers: "+b.toString()));F&&null===this.Jc&&v("Call Link.startRoute before modifying the points of the route.");this.Db.od(a,b)};t.N=function(a,b,c){F&&(C(b,R,"setPointAt:x"),C(c,R,"setPointAt:y"));F&&null===this.Jc&&v("Call Link.startRoute before modifying the points of the route.");this.Db.od(a,new J(b,c))};
t.rA=function(a,b){F&&(x(b,J,R,"insertPoint"),b.o()||v("Link.insertPoint called with a Point that does not have real numbers: "+b.toString()));F&&null===this.Jc&&v("Call Link.startRoute before modifying the points of the route.");this.Db.zb(a,b)};t.m=function(a,b,c){F&&(C(b,R,"insertPointAt:x"),C(c,R,"insertPointAt:y"));F&&null===this.Jc&&v("Call Link.startRoute before modifying the points of the route.");this.Db.zb(a,new J(b,c))};
t.Ne=function(a){F&&(x(a,J,R,"addPoint"),a.o()||v("Link.addPoint called with a Point that does not have real numbers: "+a.toString()));F&&null===this.Jc&&v("Call Link.startRoute before modifying the points of the route.");this.Db.add(a)};t.Cf=function(a,b){F&&(C(a,R,"insertPointAt:x"),C(b,R,"insertPointAt:y"));F&&null===this.Jc&&v("Call Link.startRoute before modifying the points of the route.");this.Db.add(new J(a,b))};
t.ww=function(a){F&&null===this.Jc&&v("Call Link.startRoute before modifying the points of the route.");this.Db.hb(a)};t.mk=function(){F&&null===this.Jc&&v("Call Link.startRoute before modifying the points of the route.");this.Db.clear()};
function Cf(a,b,c){if(0!==b||0!==c){for(var d=a.rd,e=new H,f=a.Db.iterator;f.next();){var g=f.value;e.add((new J(g.x+b,g.y+c)).freeze())}e.freeze();f=a.Db;a.Db=e;g=a.diagram;isNaN(b)||isNaN(c)||null!==g&&g.animationManager.wc?a.u():(a.lg.h(a.lg.x+b,a.lg.y+c),a.sa.h(a.sa.x+b,a.sa.y+c),Sl(a));d&&Dp(a);null!==g&&g.animationManager.wc&&(a.wh=e);a.g("points",f,e)}}t.Xh=function(){null===this.Jc&&(this.Jc=this.Db,this.Db=this.Db.copy())};
t.Df=function(){if(null!==this.Jc){for(var a=this.Jc,b=this.Db,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.u();this.ic();break}}else this.u(),this.ic();this.Jc=null;c=this.diagram;null!==c&&c.animationManager.wc&&(this.wh=b);Dp(this);this.g("points",
a,b)}};t.Ny=function(){null!==this.Jc&&(this.Db=this.Jc,this.Jc=null)};function Dp(a){0===a.Db.count?a.rd=!1:(a.rd=!0,a.es=null,a.Ru=NaN,a.defaultFromPoint=a.i(0),a.defaultToPoint=a.i(a.pointsCount-1),Ep(a,!1))}
t.Ya=function(){if(!this.suspendsRouting){var a=this.diagram;if(a){if(a.Yt.contains(this)||a.undoManager.isUndoingRedoing)return;a=a.animationManager;if(a.isTicking&&!a.isAnimating)return;null!==this.wh&&!a.isTicking&&a.isAnimating&&(this.wh=null)}a=this.path;null!==a&&(this.rd=!1,this.u(),a.u())}};t.wj=function(){if(!this.rd&&!this.Kv){var a=!0;try{this.Kv=!0,this.Xh(),a=this.computePoints()}finally{this.Kv=!1,a?this.Df():this.Ny()}}};
R.prototype.computePoints=function(){var a=this.diagram;if(null===a)return!1;var b=this.fromNode,c=null;null===b?(a.uh||(a.Vl=new Yf,a.Vl.desiredSize=Wb,a.Vl.strokeWidth=0,a.uh=new T,a.uh.add(a.Vl),a.uh.Fb()),this.defaultFromPoint&&(a.uh.position=a.uh.location=this.defaultFromPoint,a.uh.Fb(),b=a.uh,c=a.Vl)):c=this.fromPort;if(null!==c&&!b.isVisible()){var d=b.findVisibleNode();null!==d&&d!==b?(b=d,c=d.port):b=d}this.Nx=b;if(null===b||!b.location.o())return!1;for(;!(null===c||c.actualBounds.o()&&c.Lf());)c=
c.panel;if(null===c)return!1;var e=this.toNode,f=null;null===e?(a.vh||(a.Wl=new Yf,a.Wl.desiredSize=Wb,a.Wl.strokeWidth=0,a.vh=new T,a.vh.add(a.Wl),a.vh.Fb()),this.defaultToPoint&&(a.vh.position=a.vh.location=this.defaultToPoint,a.vh.Fb(),e=a.vh,f=a.Wl)):f=this.toPort;null===f||e.isVisible()||(a=e.findVisibleNode(),null!==a&&a!==e?(e=a,f=a.port):e=a);this.Ox=e;if(null===e||!e.location.o())return!1;for(;!(null===f||f.actualBounds.o()&&f.Lf());)f=f.panel;if(null===f)return!1;var g=this.pointsCount;
d=this.computeSpot(!0,c);a=this.computeSpot(!1,f);var h=Fp(d),k=Fp(a),l=c===f&&null!==c,m=this.isOrthogonal,n=this.curve===rg;this.bg=l&&!m?n=!0:!1;var p=this.computeAdjusting()===og||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.mk(),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,w=q;K.C(k,0)?w=0<h?w-l:w+l:(m=-h/k,n=Math.sqrt(l*l/(m*m+1)),0>l&&(n=-n),u=(0>k?-1:1)*n+r,w=m*(u-r)+q);r=g.x+2*h/3;q=g.y+2*k/3;var y=r,z=q;K.C(k,0)?z=0<h?z-l:z+l:(y=(0>k?-1:1)*n+r,z=m*(y-r)+q);this.mk();this.Ne(g);this.Cf(u,w);this.Cf(y,z);this.Ne(p);this.pd(0,this.getLinkPoint(b,c,d,!0,!1,e,f));this.pd(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.C(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.Ne(d),this.Cf(g,h)):this.Ne(d),this.Ne(a)}else{n=this.isAvoiding;p&&(m&&n||l)&&this.mk();var B=l?this.computeCurviness():0;n=this.getLinkPoint(b,c,d,!0,m,e,f);r=u=q=0;if(m||!h||l)w=this.computeEndSegmentLength(b,c,d,!0),r=this.getLinkDirection(b,c,n,d,!0,m,e,f),l&&(h||d.A(a)||!m&&1===d.x+
a.x&&1===d.y+a.y)&&(r-=m?90:30,0>B&&(r-=180)),0>r?r+=360:360<=r&&(r-=360),l&&(w+=Math.abs(B)*(m?1:2)),0===r?q=w:90===r?u=w:180===r?q=-w:270===r?u=-w:(q=w*Math.cos(r*Math.PI/180),u=w*Math.sin(r*Math.PI/180)),d.Tb()&&l&&(w=c.ma(Mc,J.alloc()),y=J.allocAt(w.x+1E3*q,w.y+1E3*u),this.getLinkPointFromPoint(b,c,w,y,!0,n),J.free(w),J.free(y));w=this.getLinkPoint(e,f,a,!1,m,b,c);var D=z=y=0;if(m||!k||l){var G=this.computeEndSegmentLength(e,f,a,!1);D=this.getLinkDirection(e,f,w,a,!1,m,b,c);l&&(k||d.A(a)||!m&&
1===d.x+a.x&&1===d.y+a.y)&&(D+=m?0:30,0>B&&(D+=180));0>D?D+=360:360<=D&&(D-=360);l&&(G+=Math.abs(B)*(m?1:2));0===D?y=G:90===D?z=G:180===D?y=-G:270===D?z=-G:(y=G*Math.cos(D*Math.PI/180),z=G*Math.sin(D*Math.PI/180));a.Tb()&&l&&(a=f.ma(Mc,J.alloc()),d=J.allocAt(a.x+1E3*y,a.y+1E3*z),this.getLinkPointFromPoint(e,f,a,d,!1,w),J.free(a),J.free(d))}a=n;if(m||!h||l)a=new J(n.x+q,n.y+u);d=w;if(m||!k||l)d=new J(w.x+y,w.y+z);!p&&!m&&h&&3<g&&this.adjustPoints(0,n,g-2,d)?this.pd(g-1,w):!p&&!m&&k&&3<g&&this.adjustPoints(1,
a,g-1,w)?this.pd(0,n):!p&&(m?6<=g:4<g)&&this.adjustPoints(1,a,g-2,d)?(this.pd(0,n),this.pd(g-1,w)):(this.mk(),this.Ne(n),(m||!h||l)&&this.Ne(a),m&&this.addOrthoPoints(a,r,d,D,b,e),(m||!k||l)&&this.Ne(d),this.Ne(w))}return!0};function Gp(a,b){Math.abs(b.x-a.x)>Math.abs(b.y-a.y)?(b.x>=a.x?b.x=a.x+9E9:b.x=a.x-9E9,b.y=a.y):(b.y>=a.y?b.y=a.y+9E9:b.y=a.y-9E9,b.x=a.x);return b}
R.prototype.getLinkPointFromPoint=function(a,b,c,d,e,f){void 0===f&&(f=new 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.ke()||(e=e.panel);if(null===e){e=d.x;d=d.y;var g=c.x;c=c.y}else{a=e.Cd;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.wk(e,d,g,c,f);null!==
a&&f.transform(a);return f};function Hp(a,b){var c=b.zp;null===c&&(c=new Ip,c.port=b,c.node=b.part,b.zp=c);return Jp(c,a)}
R.prototype.getLinkPoint=function(a,b,c,d,e,f,g,h){void 0===h&&(h=new J);if(c.bb()&&!Fp(c))return b.ma(c,h),h;if(c.nd()){var k=Hp(this,b);if(null!==k){h.assign(k.Uq);if(e&&this.routing===Kp){var l=Hp(this,g);if(null!==l&&k.vm<l.vm){k=J.alloc();l=J.alloc();var m=new L(b.ma(Hc,k),b.ma(Sc,l)),n=this.computeSpot(!d,g);a=this.getLinkPoint(f,g,n,!d,e,a,b,l);(c.Jf(Uc)||c.Jf(Vc))&&a.y>=m.y&&a.y<=m.y+m.height?h.y=a.y:(c.Jf(Tc)||c.Jf(Wc))&&a.x>=m.x&&a.x<=m.x+m.width&&(h.x=a.x);J.free(k);J.free(l)}}return h}}c=
b.ma(.5===c.x&&.5===c.y?c:Mc,J.alloc());this.pointsCount>(e?6:2)?(g=d?this.i(1):this.i(this.pointsCount-2),e&&(g=Gp(c,g.copy()))):(k=this.computeSpot(!d,g),f=J.alloc(),g=g.ma(.5===k.x&&.5===k.y?k:Mc,f),e&&(g=Gp(c,g)),J.free(f));this.getLinkPointFromPoint(a,b,c,g,d,h);J.free(c);return h};
R.prototype.getLinkDirection=function(a,b,c,d,e,f,g,h){a:if(d.bb())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.nd()&&(k=Hp(this,b),null!==k))switch(k.Fc){case 1:k=270;break a;case 2:k=180;break a;default:case 4:k=0;break a;case 8:k=90;break a}k=b.ma(Mc,J.alloc());this.pointsCount>(f?6:2)?(h=e?this.i(1):this.i(this.pointsCount-2),h=f?Gp(k,h.copy()):c):(c=J.alloc(),h=h.ma(Mc,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.Tb()&&g.Ed(a)&&(k+=180,360<=k&&(k-=360));if(Fp(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};R.prototype.computeEndSegmentLength=function(a,b,c,d){if(null!==b&&c.nd()&&(a=Hp(this,b),null!==a))return a.Rv;a=d?this.fromEndSegmentLength:this.toEndSegmentLength;null!==b&&isNaN(a)&&(a=d?b.fromEndSegmentLength:b.toEndSegmentLength);isNaN(a)&&(a=10);return a};
R.prototype.computeSpot=function(a,b){void 0===b&&(b=null);a?(a=b?b:this.fromPort,null===a?a=Mc:(b=this.fromSpot,b.Gb()&&(b=a.fromSpot),a=b===ld?Gc:b)):(a=b?b:this.toPort,null===a?a=Mc:(b=this.toSpot,b.Gb()&&(b=a.toSpot),a=b===ld?Gc:b));return a};function Fp(a){return a===Gc||.5===a.x&&.5===a.y}R.prototype.computeOtherPoint=function(a,b){if(this.computeAdjusting()!==og&&4<this.pointsCount)return this.computeMidPoint(new J);a=b.ma(Mc);b=b.zp;b=null!==b?Jp(b,this):null;null!==b&&(a=b.Uq);return a};
R.prototype.computeShortLength=function(a){if(a){a=this.fromShortLength;if(isNaN(a)){var b=this.fromPort;null!==b&&(a=b.fromShortLength)}return isNaN(a)?0:a}a=this.toShortLength;isNaN(a)&&(b=this.toPort,null!==b&&(a=b.toShortLength));return isNaN(a)?0:a};
R.prototype.Ff=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=Ib.alloc(),g.reset());g.multiply(this.transform);if(this.Oh(a,g))return xn(this,b,c,e),void 0===f&&Ib.free(g),!0;if(this.Oc(a,g)){var h=!1;if(!this.isAtomic)for(var k=this.$.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=Ib.alloc();n.set(g);
if(m instanceof U)h=m.Ff(a,b,c,d,e,n);else if(this.path===m){if(m instanceof Yf)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.Oh(r,q))h=!0;else{if(void 0===q&&(q=m.transform,r.Pe(m.actualBounds))){h=!0;break b}h=r.left;p=r.right;var u=r.top;r=r.bottom;var w=J.alloc(),y=J.alloc(),z=J.alloc(),B=Ib.alloc();B.set(q);B.kw(m.transform);B.Tt();y.x=p;y.y=u;y.transform(B);w.x=h;w.y=u;w.transform(B);q=!1;Zn(m,w,y,z)?q=!0:(w.x=p,w.y=r,w.transform(B),Zn(m,w,y,z)?q=!0:(y.x=
h,y.y=r,y.transform(B),Zn(m,w,y,z)?q=!0:(w.x=h,w.y=u,w.transform(B),Zn(m,w,y,z)&&(q=!0))));Ib.free(B);J.free(w);J.free(y);J.free(z);h=q}}else h=m.Oh(h,n)}else h=zl(m,a,d,n);h&&(p=m,null!==b&&(p=b(m)),p&&(null===c||c(p))&&e.add(p));Ib.free(n)}}}void 0===f&&Ib.free(g);return h||null!==this.background||null!==this.areaBackground}void 0===f&&Ib.free(g);return!1};
R.prototype.computeCurve=function(){if(null===this.bg){var a=this.fromPort,b=this.isOrthogonal;this.bg=null!==a&&a===this.toPort&&!b}return this.bg?rg:this.curve};R.prototype.computeCorner=function(){if(this.curve===rg)return 0;var a=this.corner;if(isNaN(a)||0>a)a=10;return a};
R.prototype.findMidLabel=function(){for(var a=this.path,b=this.$.j,c=b.length,d=0;d<c;d++){var e=b[d];if(e!==a&&!e.isPanelMain&&(-Infinity===e.segmentIndex||isNaN(e.segmentIndex)))return e}for(a=this.labelNodes;a.next();)if(b=a.value,-Infinity===b.segmentIndex||isNaN(b.segmentIndex))return b;return null};
R.prototype.computeSpacing=function(){if(!this.isVisible())return 0;var a=Math.max(14,this.computeThickness());var b=this.fromPort,c=this.toPort;if(null!==b&&null!==c){var d=this.findMidLabel();if(null!==d){var e=d.naturalBounds,f=d.margin,g=isNaN(e.width)?30:e.width*d.scale+f.left+f.right;e=isNaN(e.height)?14:e.height*d.scale+f.top+f.bottom;d=d.segmentOrientation;d===ln||d===mn||d===zp?a=Math.max(a,e):d===fn||d===gn||d===dn||d===en?a=Math.max(a,g):(b=b.ma(Mc).Xa(c.ma(Mc))/180*Math.PI,a=Math.max(a,
Math.abs(Math.sin(b)*g)+Math.abs(Math.cos(b)*e)+1));this.curve===rg&&(a*=1.333)}}return a};R.prototype.arrangeBundledLinks=function(a,b){if(b)for(b=0;b<a.length;b++){var c=a[b];c.computeAdjusting()===og&&c.Ya()}};
R.prototype.computeCurviness=function(){var a=this.curviness;if(isNaN(a)){a=16;var b=this.Tf;if(null!==b){for(var c=La(),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.au===this.fromNode&&(a=-a);Oa(c)}}return a};R.prototype.computeThickness=function(){if(!this.isVisible())return 0;var a=this.path;return null!==a?Math.max(a.strokeWidth,1):1};
R.prototype.hasCurviness=function(){return!isNaN(this.curviness)||null!==this.Tf};
R.prototype.adjustPoints=function(a,b,c,d){var e=this.computeAdjusting();if(this.isOrthogonal){if(e===xp)return!1;e===yp&&(e=wp)}switch(e){case xp:var f=this.i(a),g=this.i(c);if(!f.Sa(b)||!g.Sa(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.ca(l,0)){if(K.ca(h,0))var m=0>k?-Math.PI/2:Math.PI/2;else m=Math.atan(k/Math.abs(h)),0>h&&(m=Math.PI-m);g=b.x;var n=b.y;h=d.x-g;var p=d.y-n;k=Math.sqrt(h*h+p*p);K.ca(h,0)?p=0>p?-Math.PI/2:Math.PI/2:(p=Math.atan(p/Math.abs(h)),0>h&&(p=Math.PI-p));
l=k/l;m=p-m;this.pd(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.ca(b,0)||(K.ca(h,0)?k=0>k?-Math.PI/2:Math.PI/2:(k=Math.atan(k/Math.abs(h)),0>h&&(k=Math.PI-k)),h=k+m,b*=l,this.N(a,g+b*Math.cos(h),n+b*Math.sin(h)));this.pd(c,d)}}return!0;case yp:f=this.i(a);n=this.i(c);if(!f.Sa(b)||!n.Sa(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.pd(a,b);for(a+=1;a<c;a++){b=this.i(a);
var u=b.x,w=b.y,y=.5;0!==l&&(y=((e-u)*(e-g)+(f-w)*(f-n))/l);var z=e+y*(g-e),B=f+y*(n-f);b=Math.sqrt((u-z)*(u-z)+(w-B)*(w-B));w<q*(u-z)+B&&(b=-b);0<q&&(b=-b);u=h+y*(k-h);y=m+y*(p-m);0!==q?(b=u+b/r,this.N(a,b,y-(b-u)/q)):this.N(a,u,y+b)}this.pd(c,d)}return!0;case wp: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.C(e.y,f.y)?K.C(f.x,g.x)?m=b.y:K.C(f.y,g.y)&&(h=b.x):K.C(e.x,f.x)&&(K.C(f.y,g.y)?h=b.x:K.C(f.x,g.x)&&(m=b.y)),this.N(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.C(e.y,f.y)?K.C(f.x,g.x)?m=d.y:K.C(f.y,g.y)&&(h=d.x):K.C(e.x,f.x)&&(K.C(f.y,g.y)?h=d.x:K.C(f.x,g.x)&&(m=d.y)),this.N(c-1,h,m),fk(this))){this.N(a+1,n,l);this.N(c-1,k,p);c=!1;break a}this.pd(a,b);this.pd(c,d);c=!0}return c;default:return!1}};
R.prototype.addOrthoPoints=function(a,b,c,d,e,f){b=-45<=b&&45>b?0:45<=b&&135>b?90:135<=b&&225>b?180:270;d=-45<=d&&45>d?0:45<=d&&135>d?90:135<=d&&225>d?180:270;var g=e.actualBounds.copy(),h=f.actualBounds.copy();if(g.o()&&h.o()){g.Lc(8,8);h.Lc(8,8);g.Ve(a);h.Ve(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.fa(a)||g.fa(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.fa(a)||g.fa(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.fa(a)||g.fa(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.fa(a)||g.fa(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||!Hk(r)||g.fa(p)&&!f.Ed(e)||h.fa(a)&&!e.Ed(f)||e===f||this.layer.isTemporary)b=!1;else{var q=Ik(r,!0,this.containingGroup,null);
if(17!==this.segmentIndex&&q.Ak(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.Ak(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.Ak(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.Lc(-q.um,-q.tm);var w=J.alloc();Lp(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,w)?(c=a=w.copy(),b=w.Xa(m)):K.bd(r.x,r.y,r.x+r.width,r.y+r.height,
m.x,m.y,n.x,n.y,w)?(c=a=w.copy(),b=w.Xa(n)):K.bd(r.x,r.y,r.x+r.width,r.y+r.height,n.x,n.y,p.x,p.y,w)&&(c=a=w.copy(),b=w.Xa(p)));Lp(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,w)?(u=p=w.copy(),d=n.Xa(w)):K.bd(r.x,r.y,r.x+r.width,r.y+r.height,n.x,n.y,m.x,m.y,w)?(u=p=w.copy(),d=m.Xa(w)):K.bd(r.x,r.y,r.x+r.width,r.y+r.height,m.x,m.y,a.x,a.y,w)&&(u=p=w.copy(),d=a.Xa(w)));J.free(w)}g=g.copy().Pc(h);h=q.XA;g.Lc(q.um*h,q.tm*h);Mp(q,a,b,p,d,g);h=Np(q,p.x,p.y);!q.abort&&h>=Op&&(Lk(q),
h=q.AA,g.Lc(q.um*h,q.tm*h),Mp(q,a,b,p,d,g),h=Np(q,p.x,p.y));!q.abort&&h>=Op&&q.dB&&(Lk(q),Mp(q,a,b,p,d,q.bounds),h=Np(q,p.x,p.y));if(!q.abort&&h<Op&&Np(q,p.x,p.y)!==Pp){Qp(this,q,p.x,p.y,d,!0);g=this.i(2);if(4>this.pointsCount)0===b||180===b?(g.x=a.x,g.y=p.y):(g.x=p.x,g.y=a.y),this.N(2,g.x,g.y),this.m(3,g.x,g.y);else if(p=this.i(3),0===b||180===b)K.C(g.x,p.x)?(g=0===b?Math.max(g.x,a.x):Math.min(g.x,a.x),this.N(2,g,a.y),this.N(3,g,p.y)):K.C(g.y,p.y)?(Math.abs(a.y-g.y)<=q.tm/2&&(this.N(2,g.x,a.y),this.N(3,
p.x,a.y)),this.m(2,g.x,a.y)):this.N(2,a.x,g.y);else if(90===b||270===b)K.C(g.y,p.y)?(g=90===b?Math.max(g.y,a.y):Math.min(g.y,a.y),this.N(2,a.x,g),this.N(3,p.x,g)):K.C(g.x,p.x)?(Math.abs(a.x-g.x)<=q.um/2&&(this.N(2,a.x,g.y),this.N(3,a.x,p.y)),this.m(2,a.x,g.y)):this.N(2,g.x,a.y);null!==c&&(a=this.i(1),p=this.i(2),a.x!==p.x&&a.y!==p.y?0===b||180===b?this.m(2,a.x,p.y):this.m(2,p.x,a.y):0===b||180===b?this.m(2,e.x,c.y):this.m(2,c.x,e.y));null!==u&&(0===d||180===d?this.Cf(f.x,u.y):this.Cf(u.x,f.y));b=
!0}else b=!1}}}else b=!1;b||(this.Ne(k),this.Ne(l))}};R.prototype.computeMidOrthoPosition=function(a,b,c,d,e){var f=0;this.hasCurviness()&&(f=this.computeCurviness());return e?(b+d)/2+f:(a+c)/2+f};
function fk(a){if(null===a.diagram||!a.isAvoiding||!Hk(a.diagram))return!1;var b=a.points.j,c=b.length;if(4>c)return!1;a=Ik(a.diagram,!0,a.containingGroup,null);for(var d=1;d<c-2;d++){var e=b[d],f=b[d+1];if(!a.Ak(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 Qp(a,b,c,d,e,f){var g=b.um,h=b.tm,k=Np(b,c,d),l=c,m=d;for(0===e?l+=g:90===e?m+=h:180===e?l-=g:m-=h;k>Rp&&Np(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>Rp)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>Rp&&(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),Np(b,l,m)===k-1?Qp(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),Np(b,l,m)===k-1&&Qp(a,b,l,m,f,!1)));a.Cf(c,d)}R.prototype.Oz=function(a){F&&x(a,J,R,"findClosestSegment:p");var b=a.x;a=a.y;for(var c=this.i(0),d=this.i(1),e=Kb(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=Kb(b,a,d.x,d.y,c.x,c.y);d=c;h<e&&(f=g,e=h)}return f};R.prototype.ic=function(){this.to=!0};
R.prototype.Ck=function(a){if(!a){if(!1===this.rd)return;a=this.yb();if(!this.to&&(null===a||null!==a.geometry))return}this.qa=this.makeGeometry();a=this.path;if(null!==a){a.qa=this.qa;for(var b=this.$.j,c=b.length,d=0;d<c;d++){var e=b[d];e!==a&&e.isPanelMain&&e instanceof Yf&&(e.qa=this.qa)}}};
R.prototype.makeGeometry=function(){var a=this.qa,b=this.pointsCount;if(2>b)return a.type=Id,this.to=!1,a;var c=!1,d=this.diagram;null!==d&&Ap(this)&&d.ah.contains(this)&&(0!==this.Tl.width||0!==this.Tl.height)&&(c=!0);var e=this.i(0).copy(),f=e.copy();d=this.Db.j;var g=this.computeCurve();if(g===rg&&3<=b&&!K.ca(this.smoothness,0))if(3===b){var h=this.i(1);d=Math.min(e.x,h.x);var k=Math.min(e.y,h.y);h=this.i(2);d=Math.min(d,h.x);k=Math.min(k,h.y)}else{if(this.isOrthogonal)for(k=0;k<b;k++)h=d[k],f.x=
Math.min(h.x,f.x),f.y=Math.min(h.y,f.y);else for(d=3;d<b;d+=3)d+3>=b&&(d=b-1),k=this.i(d),f.x=Math.min(k.x,f.x),f.y=Math.min(k.y,f.y);d=f.x;k=f.y}else{for(k=0;k<b;k++)h=d[k],f.x=Math.min(h.x,f.x),f.y=Math.min(h.y,f.y);d=f.x;k=f.y}d-=this.wv.x;k-=this.wv.y;e.x-=d;e.y-=k;if(2!==b||Ap(this)){a.type=Gd;h=Wd(a);0!==this.computeShortLength(!0)&&(e=Sp(this,e,!0,f));Xd(h,e.x,e.y,!1);if(g===rg&&3<=b&&!K.ca(this.smoothness,0))if(3===b)c=this.i(1),b=c.x-d,c=c.y-k,e=this.i(2).copy(),e.x-=d,e.y-=k,0!==this.computeShortLength(!1)&&
(e=Sp(this,e,!1,f)),Yd(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(Tp(this,l,n,!1));if(!K.ca(p.x,r.x)||!K.ca(r.x,q.x))if(!K.ca(p.y,r.y)||!K.ca(r.y,q.y)){var u=m;isNaN(u)&&(u=this.smoothness/3);var w=p.x;p=p.y;var y=r.x;r=r.y;var z=q.x;q=q.y;var B=u*Up(w,p,y,r);u*=Up(y,r,z,q);K.ca(p,r)&&K.ca(y,z)&&(y>w?q>r?(g.x=y-B,g.y=r-B,b.x=y+u,b.y=
r+u):(g.x=y-B,g.y=r+B,b.x=y+u,b.y=r-u):q>r?(g.x=y+B,g.y=r-B,b.x=y-u,b.y=r+u):(g.x=y+B,g.y=r+B,b.x=y-u,b.y=r-u));K.ca(w,y)&&K.ca(r,q)&&(r>p?(z>y?(g.x=y-B,g.y=r-B,b.x=y+u):(g.x=y+B,g.y=r-B,b.x=y-u),b.y=r+u):(z>y?(g.x=y-B,g.y=r+B,b.x=y+u):(g.x=y+B,g.y=r+B,b.x=y-u),b.y=r-u));if(K.ca(w,y)&&K.ca(y,z)||K.ca(p,r)&&K.ca(r,q))w=.5*(w+z),p=.5*(p+q),g.x=w,g.y=p,b.x=w,b.y=p;1===n?(e.x=.5*(c.x+l.x),e.y=.5*(c.y+l.y)):2===n&&K.ca(c.x,this.i(0).x)&&K.ca(c.y,this.i(0).y)&&(e.x=.5*(c.x+l.x),e.y=.5*(c.y+l.y));Yd(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=Sp(this,e.copy(),!1,Rb));f=.5*(f+e.x);c=.5*(c+e.y);Yd(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=Sp(this,g.copy(),!1,Rb)),Yd(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=Tp(this,f,n,1<n);m=this.i(n);if(n>=b-1){if(!f.A(m))0!==this.computeShortLength(!1)&&(m=Sp(this,m.copy(),!1,Rb)),Vp(this,h,-d,-k,f,m,c);else if(0===l)for(n=1;n<b;)e.assign(f),m=this.i(n++),Vp(this,h,-d,-k,f,m,c),f.assign(m);break}l=Tp(this,m,n+1,n<b-3);n=-d;w=-k;p=m;u=this.i(l);y=c;if(K.C(f.y,p.y)&&K.C(p.x,u.x))if(r=Math.min(g,Math.abs(p.x-e.x)/2),r=z=Math.min(r,Math.abs(u.y-p.y)/2),K.C(r,0))Vp(this,h,n,w,f,p,y),f.assign(p);else{q=p.x;B=p.y;var D=q,G=B;p.x>f.x?q=p.x-r:q=p.x+r;u.y>p.y?G=p.y+
z:G=p.y-z;Vp(this,h,n,w,f,new J(q,B),y);Zd(h,p.x+n,p.y+w,D+n,G+w);f.h(D,G)}else K.C(f.x,p.x)&&K.C(p.y,u.y)?(r=Math.min(g,Math.abs(p.y-e.y)/2),r=z=Math.min(r,Math.abs(u.x-p.x)/2),K.C(z,0)?(Vp(this,h,n,w,f,p,y),f.assign(p)):(q=p.x,B=p.y,D=q,G=B,p.y>f.y?B=p.y-r:B=p.y+r,u.x>p.x?D=p.x+z:D=p.x-z,Vp(this,h,n,w,f,new J(q,B),y),Zd(h,p.x+n,p.y+w,D+n,G+w),f.h(D,G))):(Vp(this,h,n,w,f,p,y),f.assign(p));e.assign(m);n=l}J.free(f)}fe=h}else h=this.i(1).copy(),h.x-=d,h.y-=k,0!==this.computeShortLength(!0)&&(e=Sp(this,
e,!0,f)),0!==this.computeShortLength(!1)&&(h=Sp(this,h,!1,f)),a.type=Id,a.startX=e.x,a.startY=e.y,a.endX=h.x,a.endY=h.y;this.to=!1;return a};function Up(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.ca(a,0)?b:K.ca(b,0)?a:Math.sqrt(a*a+b*b)}
function Sp(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=Up(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=Up(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 Tp(a,b,c,d){for(var e=a.pointsCount,f=b;K.ca(b.x,f.x)&&K.ca(b.y,f.y);){if(c>=e)return e-1;f=a.i(c++)}if(!K.ca(b.x,f.x)&&!K.ca(b.y,f.y))return c-1;for(var g=f;K.ca(b.x,f.x)&&K.ca(f.x,g.x)&&(!d||(b.y>=f.y?f.y>=g.y:f.y<=g.y))||K.ca(b.y,f.y)&&K.ca(f.y,g.y)&&(!d||(b.x>=f.x?f.x>=g.x:f.x<=g.x));){if(c>=e)return e-1;g=a.i(c++)}return c-2}
function Vp(a,b,c,d,e,f,g){if(!g&&Ap(a)){g=[];var h=0;a.isVisible()&&(h=Wp(a,e,f,g));if(0<h)if(K.C(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===ng?Xd(b,n,p,!1):Yd(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===ng?Xd(b,l,n,!1):Yd(b,m,k,l,k,l,n)}else if(K.C(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===ng?Xd(b,p,l,!1):Yd(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===ng?Xd(b,n,k,!1):Yd(b,l,m,l,k,n,k)}}b.lineTo(f.x+c,f.y+d)}
function Wp(a,b,c,d){var e=a.diagram;if(null===e||b.A(c))return 0;for(e=e.layers;e.next();){var f=e.value;if(null!==f&&f.visible){f=f.Ha.j;for(var g=f.length,h=0;h<g;h++){var k=f[h];if(k instanceof R){if(k===a)return 0<d.length&&d.sort(function(a,b){return a-b}),d.length;if(k.isVisible()&&Ap(k)){var l=k.routeBounds;l.o()&&a.routeBounds.Oc(l)&&!a.usesSamePort(k)&&(l=k.path,null!==l&&l.Lf()&&Xp(b,c,d,k))}}}}}0<d.length&&d.sort(function(a,b){return a-b});return d.length}
function Xp(a,b,c,d){for(var e=K.C(a.y,b.y),f=d.pointsCount,g=d.i(0),h=J.alloc(),k=1;k<f;k++){var l=d.i(k);if(k<f-1){var m=d.i(k+1);if(g.y===l.y&&l.y===m.y){if(l.x>g.x&&m.x>=l.x||l.x<g.x&&m.x<=l.x)continue}else if(g.x===l.x&&l.x===m.x&&(l.y>g.y&&m.y>=l.y||l.y<g.y&&m.y<=l.y))continue}a:{m=a.x;var n=a.y,p=b.x,r=b.y,q=g.x;g=g.y;var u=l.x,w=l.y;if(!K.C(m,p)){if(K.C(n,r)&&K.C(q,u)&&Math.min(m,p)<q&&Math.max(m,p)>q&&Math.min(g,w)<n&&Math.max(g,w)>n&&!K.C(g,w)){h.x=q;h.y=n;m=!0;break a}}else if(!K.C(n,r)&&
K.C(g,w)&&Math.min(n,r)<g&&Math.max(n,r)>g&&Math.min(q,u)<m&&Math.max(q,u)>m&&!K.C(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 Ap(a){a=a.curve;return a===mg||a===ng}function Ep(a,b){if(b||Ap(a))b=a.diagram,null===b||b.animationManager.isTicking||b.ah.contains(a)||0===a.Tl.width&&0===a.Tl.height||b.ah.add(a,a.Tl.copy())}
R.prototype.Qq=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.Ha.j;for(var g=e.length,h=0;h<g;h++){var k=e[h];k instanceof R&&(k===this?f=!0:f&&Yp(this,k,a))}}else if(d)for(f=e.Ha.j,e=f.length,g=0;g<e;g++)h=f[g],h instanceof R&&Yp(this,h,a)}}}};
function Yp(a,b,c){if(null!==b&&null!==b.qa&&Ap(b)){var d=b.routeBounds;d.o()&&(a.routeBounds.Oc(d)||c.Oc(d))&&(a.usesSamePort(b)||b.ic())}}R.prototype.usesSamePort=function(a){var b=this.pointsCount,c=a.pointsCount;if(0<b&&0<c){var d=this.i(0),e=a.i(0);if(d.Sa(e))return!0;b=this.i(b-1);a=a.i(c-1);if(b.Sa(a)||d.Sa(a)||b.Sa(e))return!0}else if(this.fromNode===a.fromNode||this.toNode===a.toNode||this.fromNode===a.toNode||this.toNode===a.fromNode)return!0;return!1};
R.prototype.isVisible=function(){if(!S.prototype.isVisible.call(this))return!1;var a=this.containingGroup,b=!0,c=this.diagram;null!==c&&(b=c.isTreePathToChildren);c=this.fromNode;if(null!==c){if(this.isTreeLink&&b&&!c.isTreeExpanded)return!1;if(c===a)return!0;for(var d=c;null!==d;){if(d.labeledLink===this)return!0;d=d.containingGroup}c=c.findVisibleNode();if(null===c||c===a)return!1}c=this.toNode;if(null!==c){if(this.isTreeLink&&!b&&!c.isTreeExpanded)return!1;if(c===a)return!0;for(b=c;null!==b;){if(b.labeledLink===
this)return!0;b=b.containingGroup}b=c.findVisibleNode();if(null===b||b===a)return!1}return!0};R.prototype.Vb=function(a){S.prototype.Vb.call(this,a);null!==this.Tf&&this.Tf.Em();if(null!==this.hd)for(var b=this.hd.iterator;b.next();)b.value.Vb(a)};R.prototype.computeAdjusting=function(){return null!==this.diagram&&this.diagram.animationManager.isAnimating?wp:this.Sk};
function Bp(a){var b=a.bf;if(null!==b){var c=a.yf;if(null!==c){for(var d=a.cf,e=a.zf,f=a=null,g=b.eb.j,h=g.length,k=0;k<h;k++){var l=g[k];if(l.bf===b&&l.cf===d&&l.yf===c&&l.zf===e||l.bf===c&&l.cf===e&&l.yf===b&&l.zf===d)null===f?f=l:(null===a&&(a=[],a.push(f)),a.push(l))}if(null!==a){f=gp(b,c,d,e);null===f&&(f=new Zp(b,d,c,e),fp(b,f),fp(c,f));f.links=a;for(b=0;b<a.length;b++)a[b].Tf=f;f.Em()}}}}function Cp(a){var b=a.Tf;null!==b&&(a.Tf=null,a=b.links.indexOf(a),0<=a&&(Ka(b.links,a),b.Em()))}
R.prototype.Uh=function(){return!0};
ma.Object.defineProperties(R.prototype,{fromNode:{configurable:!0,get:function(){return this.bf},set:function(a){var b=this.bf;if(b!==a){F&&null!==a&&x(a,T,R,"fromNode");var c=this.fromPort;null!==b&&(this.yf!==b&&kp(b,this,c),Cp(this),this.D(2));this.bf=a;null!==a&&this.Vb(a.isVisible());this.bg=null;this.Ya();var d=this.diagram;null!==d&&d.ba&&d.partManager.setFromNodeForLink(this,a,b);var e=this.fromPort,f=this.fromPortChanged;if(null!==f){var g=!0;null!==d&&(g=d.ba,d.ba=!0);f(this,
c,e);null!==d&&(d.ba=g)}null!==a&&(this.yf!==a&&jp(a,this,e),Bp(this),this.D(1));this.g("fromNode",b,a);dp(this)}}},fromPortId:{configurable:!0,get:function(){return this.cf},set:function(a){var b=this.cf;if(b!==a){F&&A(a,"string",R,"fromPortId");var c=this.fromPort;null!==c&&hp(this.fromNode,c);Cp(this);this.cf=a;var d=this.fromPort;null!==d&&hp(this.fromNode,d);var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.pj()&&g.Ew(f,a)}c!==d&&(this.bg=null,this.Ya(),f=this.fromPortChanged,
null!==f&&(g=!0,null!==e&&(g=e.ba,e.ba=!0),f(this,c,d),null!==e&&(e.ba=g)));Bp(this);this.g("fromPortId",b,a)}}},fromPort:{configurable:!0,get:function(){var a=this.bf;return null===a?null:a.Lt(this.cf)}},fromPortChanged:{configurable:!0,get:function(){return this.ho},set:function(a){var b=this.ho;b!==a&&(null!==a&&A(a,"function",R,"fromPortChanged"),this.ho=a,this.g("fromPortChanged",b,a))}},toNode:{configurable:!0,get:function(){return this.yf},set:function(a){var b=
this.yf;if(b!==a){F&&null!==a&&x(a,T,R,"toNode");var c=this.toPort;null!==b&&(this.bf!==b&&kp(b,this,c),Cp(this),this.D(2));this.yf=a;null!==a&&this.Vb(a.isVisible());this.bg=null;this.Ya();var d=this.diagram;null!==d&&d.ba&&d.partManager.setToNodeForLink(this,a,b);var e=this.toPort,f=this.toPortChanged;if(null!==f){var g=!0;null!==d&&(g=d.ba,d.ba=!0);f(this,c,e);null!==d&&(d.ba=g)}null!==a&&(this.bf!==a&&jp(a,this,e),Bp(this),this.D(1));this.g("toNode",b,a);dp(this)}}},toPortId:{configurable:!0,
enumerable:!0,get:function(){return this.zf},set:function(a){var b=this.zf;if(b!==a){F&&A(a,"string",R,"toPortId");var c=this.toPort;null!==c&&hp(this.toNode,c);Cp(this);this.zf=a;var d=this.toPort;null!==d&&hp(this.toNode,d);var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.pj()&&g.Jw(f,a)}c!==d&&(this.bg=null,this.Ya(),f=this.toPortChanged,null!==f&&(g=!0,null!==e&&(g=e.ba,e.ba=!0),f(this,c,d),null!==e&&(e.ba=g)));Bp(this);this.g("toPortId",b,a)}}},toPort:{configurable:!0,
get:function(){var a=this.yf;return null===a?null:a.Lt(this.zf)}},toPortChanged:{configurable:!0,get:function(){return this.pq},set:function(a){var b=this.pq;b!==a&&(null!==a&&A(a,"function",R,"toPortChanged"),this.pq=a,this.g("toPortChanged",b,a))}},fromSpot:{configurable:!0,get:function(){return null!==this.S?this.S.hh:ld},set:function(a){this.Mc();var b=this.S.hh;if(!b.A(a)){F&&x(a,M,R,"fromSpot");a=a.J();this.S.hh=a;this.g("fromSpot",b,a);if(b.nd()||a.nd())a=this.fromNode,
null!==a&&hp(a,this.fromPort);this.Ya()}}},fromEndSegmentLength:{configurable:!0,get:function(){return null!==this.S?this.S.fh:NaN},set:function(a){this.Mc();var b=this.S.fh;b!==a&&(F&&A(a,"number",R,"fromEndSegmentLength"),0>a&&ya(a,">= 0",R,"fromEndSegmentLength"),this.S.fh=a,this.g("fromEndSegmentLength",b,a),this.Ya())}},fromShortLength:{configurable:!0,get:function(){return null!==this.S?this.S.gh:NaN},set:function(a){this.Mc();var b=this.S.gh;b!==a&&(F&&A(a,"number",
R,"fromShortLength"),this.S.gh=a,this.g("fromShortLength",b,a),this.ic())}},toSpot:{configurable:!0,get:function(){return null!==this.S?this.S.Gh:ld},set:function(a){this.Mc();var b=this.S.Gh;if(!b.A(a)){F&&x(a,M,R,"toSpot");a=a.J();this.S.Gh=a;this.g("toSpot",b,a);if(b.nd()||a.nd())a=this.toNode,null!==a&&hp(a,this.toPort);this.Ya()}}},toEndSegmentLength:{configurable:!0,get:function(){return null!==this.S?this.S.Eh:NaN},set:function(a){this.Mc();var b=this.S.Eh;b!==a&&
(F&&A(a,"number",R,"toEndSegmentLength"),0>a&&ya(a,">= 0",R,"toEndSegmentLength"),this.S.Eh=a,this.g("toEndSegmentLength",b,a),this.Ya())}},toShortLength:{configurable:!0,get:function(){return null!==this.S?this.S.Fh:NaN},set:function(a){this.Mc();var b=this.S.Fh;b!==a&&(F&&A(a,"number",R,"toShortLength"),this.S.Fh=a,this.g("toShortLength",b,a),this.ic())}},isLabeledLink:{configurable:!0,get:function(){return null===this.hd?!1:0<this.hd.count}},labelNodes:{configurable:!0,
enumerable:!0,get:function(){return null===this.hd?lb:this.hd.iterator}},relinkableFrom:{configurable:!0,get:function(){return 0!==(this.Va&1)},set:function(a){var b=0!==(this.Va&1);b!==a&&(F&&A(a,"boolean",R,"relinkableFrom"),this.Va^=1,this.g("relinkableFrom",b,a),this.Sb())}},relinkableTo:{configurable:!0,get:function(){return 0!==(this.Va&2)},set:function(a){var b=0!==(this.Va&2);b!==a&&(F&&A(a,"boolean",R,"relinkableTo"),this.Va^=2,this.g("relinkableTo",b,a),this.Sb())}},
resegmentable:{configurable:!0,get:function(){return 0!==(this.Va&4)},set:function(a){var b=0!==(this.Va&4);b!==a&&(F&&A(a,"boolean",R,"resegmentable"),this.Va^=4,this.g("resegmentable",b,a),this.Sb())}},isTreeLink:{configurable:!0,get:function(){return 0!==(this.Va&8)},set:function(a){var b=0!==(this.Va&8);b!==a&&(F&&A(a,"boolean",R,"isTreeLink"),this.Va^=8,this.g("isTreeLink",b,a),null!==this.fromNode&&Tk(this.fromNode),null!==this.toNode&&Tk(this.toNode))}},path:{configurable:!0,
enumerable:!0,get:function(){var a=this.yb();return a instanceof Yf?a:null}},routeBounds:{configurable:!0,get:function(){this.wj();var a=this.Tl,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.Ve(e)}else if(this.computeCurve()===rg&&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.rm(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.rm(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.Ve(f),e=2;e<d;e++)f=this.i(e),b=Math.min(f.x,b),c=Math.min(f.y,c),a.Ve(f);this.wv.h(b-
a.x,c-a.y)}return a}},midPoint:{configurable:!0,get:function(){this.wj();return this.computeMidPoint(new J)}},midAngle:{configurable:!0,get:function(){this.wj();return this.computeMidAngle()}},flattenedLengths:{configurable:!0,get:function(){if(null===this.es){this.rd||Dp(this);for(var a=this.es=[],b=this.pointsCount,c=0;c<b-1;c++){var d=this.i(c);var e=this.i(c+1);K.ca(d.x,e.x)?(d=e.y-d.y,0>d&&(d=-d)):K.ca(d.y,e.y)?(d=e.x-d.x,0>d&&(d=-d)):d=Math.sqrt(d.Qe(e));
a.push(d)}}return this.es}},flattenedTotalLength:{configurable:!0,get:function(){var a=this.Ru;if(isNaN(a)){for(var b=this.flattenedLengths,c=b.length,d=a=0;d<c;d++)a+=b[d];this.Ru=a}return a}},points:{configurable:!0,get:function(){return this.Db},set:function(a){var b=this.Db;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 H,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(!Fa(f)||"number"!==typeof f.x||isNaN(f.x)||"number"!==typeof f.y||isNaN(f.y)){d=!1;break}}if(d)for(c=new H,d=0;d<a.length;d++)e=a[d],c.add((new J(e.x,e.y)).freeze());else F&&v("Link.points array must contain only an even number of numbers or objects with x and y properties, not: "+a)}}else if(a instanceof H)for(c=a.copy(),a=c.iterator;a.next();)a.value.freeze();else v("Link.points value is not an instance of List or Array: "+
a);c.freeze();this.Db=c;this.ic();this.u();Dp(this);a=this.diagram;null!==a&&(a.zk||a.undoManager.isUndoingRedoing||a.Yt.add(this),a.animationManager.wc&&(this.wh=c));this.g("points",b,c)}}},pointsCount:{configurable:!0,get:function(){return this.Db.count}},rd:{configurable:!0,get:function(){return 0!==(this.Va&16)},set:function(a){0!==(this.Va&16)!==a&&(this.Va^=16)}},suspendsRouting:{configurable:!0,get:function(){return 0!==(this.Va&32)},set:function(a){0!==
(this.Va&32)!==a&&(this.Va^=32)}},Kv:{configurable:!0,get:function(){return 0!==(this.Va&64)},set:function(a){0!==(this.Va&64)!==a&&(this.Va^=64)}},defaultFromPoint:{configurable:!0,get:function(){return this.w},set:function(a){this.w=a.copy()}},defaultToPoint:{configurable:!0,get:function(){return this.L},set:function(a){this.L=a.copy()}},isOrthogonal:{configurable:!0,get:function(){return 2===(this.$j.value&2)}},isAvoiding:{configurable:!0,
enumerable:!0,get:function(){return 4===(this.$j.value&4)}},geometry:{configurable:!0,get:function(){this.to&&(this.wj(),this.qa=this.makeGeometry());return this.qa}},firstPickIndex:{configurable:!0,get:function(){return 2>=this.pointsCount?0:this.isOrthogonal||!Fp(this.computeSpot(!0))?1:0}},lastPickIndex:{configurable:!0,get:function(){var a=this.pointsCount;return 0===a?0:2>=a?a-1:this.isOrthogonal||!Fp(this.computeSpot(!1))?a-2:a-1}},adjusting:{configurable:!0,
enumerable:!0,get:function(){return this.Sk},set:function(a){var b=this.Sk;b!==a&&(F&&hb(a,R,R,"adjusting"),this.Sk=a,this.g("adjusting",b,a))}},corner:{configurable:!0,get:function(){return this.In},set:function(a){var b=this.In;b!==a&&(F&&A(a,"number",R,"corner"),this.In=a,this.ic(),this.g("corner",b,a))}},curve:{configurable:!0,get:function(){return this.Kn},set:function(a){var b=this.Kn;b!==a&&(F&&hb(a,R,R,"curve"),this.Kn=a,this.Ya(),this.ic(),Ep(this,b===ng||b===
mg||a===ng||a===mg),this.g("curve",b,a))}},curviness:{configurable:!0,get:function(){return this.Ln},set:function(a){var b=this.Ln;b!==a&&(F&&A(a,"number",R,"curviness"),this.Ln=a,this.Ya(),this.ic(),this.g("curviness",b,a))}},routing:{configurable:!0,get:function(){return this.$j},set:function(a){var b=this.$j;b!==a&&(F&&hb(a,R,R,"routing"),this.$j=a,this.bg=null,this.Ya(),Ep(this,2===(b.value&2)||2===(a.value&2)),this.g("routing",b,a))}},smoothness:{configurable:!0,
get:function(){return this.bq},set:function(a){var b=this.bq;b!==a&&(F&&A(a,"number",R,"smoothness"),this.bq=a,this.ic(),this.g("smoothness",b,a))}},key:{configurable:!0,get:function(){var a=this.diagram;if(null!==a&&a.model.pj())return a.model.ac(this.data)}}});R.prototype.invalidateOtherJumpOvers=R.prototype.Qq;R.prototype.findClosestSegment=R.prototype.Oz;R.prototype.updateRoute=R.prototype.wj;R.prototype.invalidateRoute=R.prototype.Ya;R.prototype.rollbackRoute=R.prototype.Ny;
R.prototype.commitRoute=R.prototype.Df;R.prototype.startRoute=R.prototype.Xh;R.prototype.clearPoints=R.prototype.mk;R.prototype.removePoint=R.prototype.ww;R.prototype.addPointAt=R.prototype.Cf;R.prototype.addPoint=R.prototype.Ne;R.prototype.insertPointAt=R.prototype.m;R.prototype.insertPoint=R.prototype.rA;R.prototype.setPointAt=R.prototype.N;R.prototype.setPoint=R.prototype.pd;R.prototype.getPoint=R.prototype.i;R.prototype.getOtherPort=R.prototype.jA;R.prototype.getOtherNode=R.prototype.Lq;
var vp=new E(R,"Normal",1),$p=new E(R,"Orthogonal",2),aq=new E(R,"AvoidsNodes",6),Kp=new E(R,"AvoidsNodesStraight",7),og=new E(R,"None",0),rg=new E(R,"Bezier",9),ng=new E(R,"JumpGap",10),mg=new E(R,"JumpOver",11),wp=new E(R,"End",17),xp=new E(R,"Scale",18),yp=new E(R,"Stretch",19),ln=new E(R,"OrientAlong",21),dn=new E(R,"OrientPlus90",22),fn=new E(R,"OrientMinus90",23),zp=new E(R,"OrientOpposite",24),mn=new E(R,"OrientUpright",25),en=new E(R,"OrientPlus90Upright",26),gn=new E(R,"OrientMinus90Upright",
27),hn=new E(R,"OrientUpright45",28);R.className="Link";R.Normal=vp;R.Orthogonal=$p;R.AvoidsNodes=aq;R.AvoidsNodesStraight=Kp;R.None=og;R.Bezier=rg;R.JumpGap=ng;R.JumpOver=mg;R.End=wp;R.Scale=xp;R.Stretch=yp;R.OrientAlong=ln;R.OrientPlus90=dn;R.OrientMinus90=fn;R.OrientOpposite=zp;R.OrientUpright=mn;R.OrientPlus90Upright=en;R.OrientMinus90Upright=gn;R.OrientUpright45=hn;function Zp(a,b,c,d){fb(this);this.xe=this.ms=!1;this.au=a;this.Jy=b;this.lw=c;this.Ky=d;this.links=[]}
Zp.prototype.Em=function(){if(!this.ms){var a=this.links;0<a.length&&(a=a[0].diagram,null!==a&&(a.Tu.add(this),this.xe=a.undoManager.isUndoingRedoing))}this.ms=!0};Zp.prototype.Vw=function(){if(this.ms){this.ms=!1;var a=this.links;if(0<a.length){var b=a[0],c=b.diagram;c=null===c||c.zk&&!this.xe;this.xe=!1;b.arrangeBundledLinks(a,c);1===a.length&&(b.Tf=null,a.length=0)}0===a.length&&(a=this.au,null!==this&&null!==a.Ye&&a.Ye.remove(this),a=this.lw,null!==this&&null!==a.Ye&&a.Ye.remove(this))}};
Zp.className="LinkBundle";function Jk(){fb(this);this.Sy=this.group=null;this.St=!0;this.abort=!1;this.Wd=this.Vd=1;this.Ro=this.Qo=-1;this.rc=this.qc=8;this.Jb=[[]];this.gk=this.fk=0;this.dB=!1;this.XA=22;this.AA=111}
Jk.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.qc)/this.qc)*this.qc;this.Wd=Math.floor((b-this.rc)/this.rc)*this.rc;this.Qo=Math.ceil((c+2*this.qc)/this.qc)*this.qc;this.Ro=Math.ceil((d+2*this.rc)/this.rc)*this.rc;a=1+(Math.ceil((this.Qo-this.Vd)/this.qc)|0);b=1+(Math.ceil((this.Ro-this.Wd)/this.rc)|0);if(null===this.Jb||this.fk<a-1||this.gk<b-1){c=[];for(d=0;d<=a;d++)c[d]=[];this.Jb=c;this.fk=a-1;this.gk=b-1}a=
bq;if(null!==this.Jb)for(b=0;b<=this.fk;b++)for(c=0;c<=this.gk;c++)this.Jb[b][c]=a}};function Lp(a,b,c){return a.Vd<=b&&b<=a.Qo&&a.Wd<=c&&c<=a.Ro}function Np(a,b,c){if(!Lp(a,b,c))return bq;b-=a.Vd;b/=a.qc;c-=a.Wd;c/=a.rc;return a.Jb[b|0][c|0]}function Mk(a,b,c){Lp(a,b,c)&&(b-=a.Vd,b/=a.qc,c-=a.Wd,c/=a.rc,a.Jb[b|0][c|0]=Pp)}function Lk(a){if(null!==a.Jb)for(var b=0;b<=a.fk;b++)for(var c=0;c<=a.gk;c++)a.Jb[b][c]>=Rp&&(a.Jb[b][c]=bq)}
Jk.prototype.Ak=function(a,b,c,d){if(a>this.Qo||a+c<this.Vd||b>this.Ro||b+d<this.Wd)return!0;a=(a-this.Vd)/this.qc|0;b=(b-this.Wd)/this.rc|0;c=Math.max(0,c)/this.qc+1|0;var e=Math.max(0,d)/this.rc+1|0;0>a&&(c+=a,a=0);0>b&&(e+=b,b=0);if(0>c||0>e)return!0;d=Math.min(a+c-1,this.fk)|0;for(c=Math.min(b+e-1,this.gk)|0;a<=d;a++)for(e=b;e<=c;e++)if(this.Jb[a][e]===Pp)return!1;return!0};
function cq(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.Jb[l][m];if(n>=Rp&&n<Op)for(e?m+=d:l+=d,n+=1;f<=l&&l<=g&&h<=m&&m<=k&&!(n>=a.Jb[l][m]);)a.Jb[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)cq(a,b,c,1,!e,f,g,h,k),cq(a,b,c,-1,!e,f,g,h,k);else for(c+=d;c>l;c+=d)cq(a,b,c,1,!e,f,g,h,k),cq(a,b,c,-1,!e,f,g,h,k);else if(0<d)for(b+=d;b<l;b+=d)cq(a,b,c,1,!e,f,g,h,k),cq(a,b,c,-1,!e,f,g,h,k);else for(b+=d;b>l;b+=d)cq(a,b,c,1,!e,f,g,h,k),cq(a,b,c,-1,!e,f,g,h,
k)}}function dq(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=Pp,m=Rp;for(a.Jb[b][c]=m;l===Pp&&b>f&&b<g&&c>h&&c<k;)m+=1,a.Jb[b][c]=m,e?c+=d:b+=d,l=a.Jb[b][c]}function eq(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=Pp,m=Op;for(a.Jb[b][c]=m;l===Pp&&b>f&&b<g&&c>h&&c<k;)a.Jb[b][c]=m,e?c+=d:b+=d,l=a.Jb[b][c]}
function Mp(a,b,c,d,e,f){if(null!==a.Jb){a.abort=!1;var g=b.x,h=b.y;if(Lp(a,g,h)&&(g-=a.Vd,g/=a.qc,h-=a.Wd,h/=a.rc,b=d.x,d=d.y,Lp(a,b,d)))if(b-=a.Vd,b/=a.qc,d-=a.Wd,d/=a.rc,1>=Math.abs(g-b)&&1>=Math.abs(h-d))a.abort=!0;else{var k=f.x,l=f.y,m=f.x+f.width,n=f.y+f.height;k-=a.Vd;k/=a.qc;l-=a.Wd;l/=a.rc;m-=a.Vd;m/=a.qc;n-=a.Wd;n/=a.rc;f=Math.max(0,Math.min(a.fk,k|0));m=Math.min(a.fk,Math.max(0,m|0));l=Math.max(0,Math.min(a.gk,l|0));n=Math.min(a.gk,Math.max(0,n|0));g|=0;h|=0;b|=0;d|=0;k=0===c||90===c?
1:-1;c=90===c||270===c;a.Jb[g][h]===Pp?(dq(a,g,h,k,c,f,m,l,n),dq(a,g,h,1,!c,f,m,l,n),dq(a,g,h,-1,!c,f,m,l,n)):dq(a,g,h,k,c,g,h,g,h);a.Jb[b][d]===Pp?(eq(a,b,d,0===e||90===e?1:-1,90===e||270===e,f,m,l,n),eq(a,b,d,1,!(90===e||270===e),f,m,l,n),eq(a,b,d,-1,!(90===e||270===e),f,m,l,n)):eq(a,b,d,k,c,b,d,b,d);a.abort||(cq(a,g,h,1,!1,f,m,l,n),cq(a,g,h,-1,!1,f,m,l,n),cq(a,g,h,1,!0,f,m,l,n),cq(a,g,h,-1,!0,f,m,l,n))}}}
ma.Object.defineProperties(Jk.prototype,{bounds:{configurable:!0,get:function(){return new L(this.Vd,this.Wd,this.Qo-this.Vd,this.Ro-this.Wd)}},um:{configurable:!0,get:function(){return this.qc},set:function(a){0<a&&a!==this.qc&&(this.qc=a,this.initialize(this.bounds))}},tm:{configurable:!0,get:function(){return this.rc},set:function(a){0<a&&a!==this.rc&&(this.rc=a,this.initialize(this.bounds))}}});var Pp=0,Rp=1,Op=999999,bq=Op+1;Jk.className="PositionArray";
function Ip(){fb(this);this.port=this.node=null;this.fe=[];this.Wq=!1}Ip.prototype.toString=function(){for(var a=this.fe,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 fq(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}Ip.prototype.Em=function(){this.fe.length=0};
function Jp(a,b){var c=a.fe;if(0===c.length){a:if(!a.Wq){c=a.Wq;a.Wq=!0;var d=null,e=a.node,f=e instanceof Hf?e:null;if(null===f||f.isSubGraphExpanded)var g=e.isTreeExpanded?e.findLinksConnected(a.port.portId):e.ny();else{if(!f.actualBounds.o()){a.Wq=c;break a}d=f;g=d.Tv()}f=a.fe.length=0;var h=a.port.ma(Hc,J.alloc()),k=a.port.ma(Sc,J.alloc());e=L.allocAt(h.x,h.y,0,0);e.Ve(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.Ed(d),n=l.computeSpot(m,a.port);if(n.nd()&&(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.Xa(m);p-=k;0>p?p+=360:360<=p&&(p-=360);n=fq(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.fe[f];void 0===r?(r=new gq(l,p,n),a.fe[f]=r):(r.link=l,r.angle=p,r.Fc=
n);r.pw.set(m);f++}}}}J.free(h);a.fe.sort(Ip.prototype.l);k=a.fe.length;d=-1;for(f=h=0;f<k;f++)g=a.fe[f],void 0!==g&&(g.Fc!==d&&(d=g.Fc,h=0),g.Mq=h,h++);d=-1;h=0;for(f=k-1;0<=f;f--)k=a.fe[f],void 0!==k&&(k.Fc!==d&&(d=k.Fc,h=k.Mq+1),k.vm=h);f=a.fe;n=a.port;d=a.node.portSpreading;h=J.alloc();k=J.alloc();g=J.alloc();l=J.alloc();n.ma(Hc,h);n.ma(Jc,k);n.ma(Sc,g);n.ma(Oc,l);r=p=m=n=0;if(d===sp)for(var q=0;q<f.length;q++){var u=f[q];if(null!==u){var w=u.link.computeThickness();switch(u.Fc){case 8:p+=w;break;
case 2:r+=w;break;case 1:n+=w;break;default:case 4:m+=w}}}var y=q=0,z=1,B=u=0;for(w=0;w<f.length;w++){var D=f[w];if(null!==D){if(q!==D.Fc){q=D.Fc;switch(q){case 8:var G=g;y=l;break;case 2:G=l;y=h;break;case 1:G=h;y=k;break;default:case 4:G=k,y=g}u=y.x-G.x;B=y.y-G.y;switch(q){case 8:p>Math.abs(u)?(z=Math.abs(u)/p,p=Math.abs(u)):z=1;break;case 2:r>Math.abs(B)?(z=Math.abs(B)/r,r=Math.abs(B)):z=1;break;case 1:n>Math.abs(u)?(z=Math.abs(u)/n,n=Math.abs(u)):z=1;break;default:case 4:m>Math.abs(B)?(z=Math.abs(B)/
m,m=Math.abs(B)):z=1}y=0}var O=D.Uq;if(d===sp){D=D.link.computeThickness();D*=z;O.set(G);switch(q){case 8:O.x=G.x+u/2+p/2-y-D/2;break;case 2:O.y=G.y+B/2+r/2-y-D/2;break;case 1:O.x=G.x+u/2-n/2+y+D/2;break;default:case 4:O.y=G.y+B/2-m/2+y+D/2}y+=D}else{var V=.5;d===ep&&(V=(D.Mq+1)/(D.vm+1));O.x=G.x+u*V;O.y=G.y+B*V}}}J.free(h);J.free(k);J.free(g);J.free(l);G=a.fe;for(f=0;f<G.length;f++)d=G[f],null!==d&&(d.Rv=a.computeEndSegmentLength(d));a.Wq=c;L.free(e)}c=a.fe}for(a=0;a<c.length;a++)if(e=c[a],null!==
e&&e.link===b)return e;return null}Ip.prototype.l=function(a,b){return a===b?0:null===a?-1:null===b?1:a.Fc<b.Fc?-1:a.Fc>b.Fc?1:a.angle<b.angle?-1:a.angle>b.angle?1:0};
Ip.prototype.computeEndSegmentLength=function(a){var b=a.link,c=b.computeEndSegmentLength(this.node,this.port,Gc,b.fromPort===this.port),d=a.Mq;if(0>d)return c;var e=a.vm;if(1>=e||!b.isOrthogonal)return c;b=a.pw;var f=a.Uq;if(2===a.Fc||8===a.Fc)d=e-1-d;return((a=2===a.Fc||4===a.Fc)?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)};Ip.className="Knot";function gq(a,b,c){this.link=a;this.angle=b;this.Fc=c;this.pw=new J;this.vm=this.Mq=0;this.Uq=new J;this.Rv=0}
gq.prototype.toString=function(){return this.link.toString()+" "+this.angle.toString()+" "+this.Fc.toString()+":"+this.Mq.toString()+"/"+this.vm.toString()+" "+this.Uq.toString()+" "+this.Rv.toString()+" "+this.pw.toString()};gq.className="LinkInfo";function tl(){this.Gh=this.hh=ld;this.Fh=this.gh=this.Eh=this.fh=NaN;this.nq=this.eo=null;this.oq=this.fo=Infinity}
tl.prototype.copy=function(){var a=new tl;a.hh=this.hh.J();a.Gh=this.Gh.J();a.fh=this.fh;a.Eh=this.Eh;a.gh=this.gh;a.Fh=this.Fh;a.eo=this.eo;a.nq=this.nq;a.fo=this.fo;a.oq=this.oq;return a};tl.className="LinkSettings";function Ni(){0<arguments.length&&za(Ni);fb(this);this.L=this.B=null;this.Ci=this.wo=!0;this.Bo=!1;this.pn=(new J(0,0)).freeze();this.yo=!0;this.xo=null;this.tx="";this.w=null;this.Ao=!1;this.l=null}
Ni.prototype.cloneProtected=function(a){a.wo=this.wo;a.Ci=this.Ci;a.Bo=this.Bo;a.pn.assign(this.pn);a.yo=this.yo;a.xo=this.xo;a.tx=this.tx;a.Ao=!0};Ni.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};Ni.prototype.mb=function(a){Ba(this,a)};Ni.prototype.toString=function(){var a=Pa(this.constructor);a+="(";null!==this.group&&(a+=" in "+this.group);null!==this.diagram&&(a+=" for "+this.diagram);return a+")"};
Ni.prototype.D=function(){if(this.isValidLayout){var a=this.diagram;if(null!==a&&!a.undoManager.isUndoingRedoing){var b=a.animationManager;!b.isTicking&&(b.defaultAnimation.isAnimating&&b.dd(),this.isOngoing&&a.zk||this.isInitial&&!a.zk)&&(this.isValidLayout=!1,a.Hb())}}};Ni.prototype.createNetwork=function(){return new hq(this)};Ni.prototype.makeNetwork=function(a){var b=this.createNetwork();a instanceof Q?(b.Gg(a.nodes,!0),b.Gg(a.links,!0)):a instanceof Hf?b.Gg(a.memberParts):b.Gg(a.iterator);return b};
Ni.prototype.updateParts=function(){var a=this.diagram;if(null===a&&null!==this.network)for(var b=this.network.vertexes.iterator;b.next();){var c=b.value.node;if(null!==c&&(a=c.diagram,null!==a))break}this.isValidLayout=!0;try{null!==a&&a.Ba("Layout"),this.commitLayout()}finally{null!==a&&a.ab("Layout")}};Ni.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()}};
Ni.prototype.doLayout=function(a){F&&null===a&&v("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");var b=new I;a instanceof Q?(iq(this,b,a.nodes,!0,this.Ik,!0,!1,!0),iq(this,b,a.parts,!0,this.Ik,!0,!1,!0)):a instanceof Hf?iq(this,b,a.memberParts,!1,this.Ik,!0,!1,!0):b.addAll(a.iterator);var c=b.count;if(0<c){a=this.diagram;null!==a&&a.Ba("Layout");c=Math.ceil(Math.sqrt(c));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);var d=
this.arrangementOrigin.x,e=d,f=this.arrangementOrigin.y,g=0,h=0;for(b=b.iterator;b.next();){var k=b.value;jq(k);var l=k.measuredBounds,m=l.width;l=l.height;k.moveTo(e,f);k instanceof Hf&&(k.Ik=!1);e+=Math.max(m,50)+20;h=Math.max(h,Math.max(l,50));g>=c-1?(g=0,e=d,f+=h+20,h=0):g++}null!==a&&a.ab("Layout")}this.isValidLayout=!0};Ni.prototype.Ik=function(a){return!a.location.o()||a instanceof Hf&&a.Ik?!0:!1};
function iq(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 T?k.isLinkLabel||(k instanceof Hf?null===k.layout?iq(a,b,k.memberParts,!1,e,f,g,h):(jq(k),b.add(k)):(jq(k),b.add(k))):g&&k instanceof R?b.add(k):!h||!k.bc()||k instanceof T||(jq(k),b.add(k)))}}function jq(a){var b=a.actualBounds;(0===b.width||0===b.height||isNaN(b.width)||isNaN(b.height))&&a.Fb()}
Ni.prototype.mj=function(a,b){var c=this.boundsComputation;if(null!==c)return b||(b=new L),c(a,this,b);if(!b)return a.actualBounds;b.set(a.actualBounds);return b};Ni.prototype.$x=function(a){var b=new I;a instanceof Q?(iq(this,b,a.nodes,!0,null,!0,!0,!0),iq(this,b,a.links,!0,null,!0,!0,!0),iq(this,b,a.parts,!0,null,!0,!0,!0)):a instanceof Hf?iq(this,b,a.memberParts,!1,null,!0,!0,!0):iq(this,b,a.iterator,!1,null,!0,!0,!0);return b};
Ni.prototype.initialOrigin=function(a){var b=this.group;if(null!==b){var c=b.position.copy();(isNaN(c.x)||isNaN(c.y))&&c.set(a);b=b.placeholder;null!==b&&(c=b.ma(Hc),(isNaN(c.x)||isNaN(c.y))&&c.set(a),a=b.padding,c.x+=a.left,c.y+=a.top);return c}return a};
ma.Object.defineProperties(Ni.prototype,{diagram:{configurable:!0,get:function(){return this.B},set:function(a){null!==a&&x(a,Q,Ni,"diagram");this.B=a}},group:{configurable:!0,get:function(){return this.L},set:function(a){this.L!==a&&(null!==a&&x(a,Hf,Ni,"group"),this.L=a,null!==a&&(this.B=a.diagram))}},isOngoing:{configurable:!0,get:function(){return this.wo},set:function(a){this.wo!==a&&(A(a,"boolean",Ni,"isOngoing"),this.wo=a)}},isInitial:{configurable:!0,
enumerable:!0,get:function(){return this.Ci},set:function(a){A(a,"boolean",Ni,"isInitial");this.Ci=a;a||(this.Ao=!0)}},isViewportSized:{configurable:!0,get:function(){return this.Bo},set:function(a){this.Bo!==a&&(A(a,"boolean",Ni,"isViewportSized"),(this.Bo=a)&&this.D())}},isRouting:{configurable:!0,get:function(){return this.yo},set:function(a){this.yo!==a&&(A(a,"boolean",Ni,"isRouting"),this.yo=a)}},isRealtime:{configurable:!0,get:function(){return this.xo},
set:function(a){this.xo!==a&&(null!==a&&A(a,"boolean",Ni,"isRealtime"),this.xo=a)}},isValidLayout:{configurable:!0,get:function(){return this.Ao},set:function(a){this.Ao!==a&&(A(a,"boolean",Ni,"isValidLayout"),this.Ao=a,a||(a=this.diagram,null!==a&&(a.Tg=!0)))}},network:{configurable:!0,get:function(){return this.l},set:function(a){this.l!==a&&(null!==a&&x(a,hq,Ni,"network"),this.l=a,null!==a&&(a.layout=this))}},boundsComputation:{configurable:!0,get:function(){return this.w},
set:function(a){this.w!==a&&(null!==a&&A(a,"function",Ni,"boundsComputation"),this.w=a,this.D())}},arrangementOrigin:{configurable:!0,get:function(){return this.pn},set:function(a){x(a,J,Ni,"arrangementOrigin");this.pn.A(a)||(this.pn.assign(a),this.D())}}});Ni.prototype.collectParts=Ni.prototype.$x;Ni.prototype.getLayoutBounds=Ni.prototype.mj;Ni.prototype.invalidateLayout=Ni.prototype.D;Ni.className="Layout";
function hq(a){fb(this);F&&!a&&v("LayoutNetwork constructor requires non-null Layout argument");this.oc=a;this.Af=new I;this.qe=new I;this.bu=new Db;this.Xt=new Db}hq.prototype.clear=function(){if(this.Af)for(var a=this.Af.iterator;a.next();)a.value.clear();if(this.qe)for(a=this.qe.iterator;a.next();)a.value.clear();this.Af=new I;this.qe=new I;this.bu=new Db;this.Xt=new Db};
hq.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.Af.count+" edges: "+this.qe.count;if(1<a){for(var c=this.Af.iterator;c.next();)b+="\n    "+c.value.toString(a-1);for(c=this.qe.iterator;c.next();)b+="\n    "+c.value.toString(a-1)}return b};hq.prototype.createVertex=function(){return new kq(this)};hq.prototype.createEdge=function(){return new lq(this)};
hq.prototype.Gg=function(a,b,c){if(null!==a){void 0===b&&(b=!1);A(b,"boolean",hq,"addParts:toplevelonly");void 0===c&&(c=null);null===c&&(c=function(a){if(a instanceof T)return!a.isLinkLabel;if(a instanceof R){var b=a.fromNode;if(null===b||b.isLinkLabel)return!1;a=a.toNode;return null===a||a.isLinkLabel?!1:!0}return!1});for(a=a.iterator;a.next();){var d=a.value;if(d instanceof T&&(!b||d.isTopLevel)&&d.canLayout()&&c(d))if(d instanceof Hf&&null===d.layout)this.Gg(d.memberParts,!1);else if(null===this.kj(d)){var e=
this.createVertex();e.node=d;this.Mh(e)}}for(a.reset();a.next();)if(d=a.value,d instanceof R&&(!b||d.isTopLevel)&&d.canLayout()&&c(d)&&null===this.Fq(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.Bk(f,e,d))}}};
hq.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=hq.prototype;t.Mh=function(a){if(null!==a){F&&x(a,kq,hq,"addVertex:vertex");this.Af.add(a);var b=a.node;null!==b&&this.bu.add(b,a);a.network=this}};
t.qm=function(a){if(null===a)return null;F&&x(a,T,hq,"addNode:node");var b=this.kj(a);null===b&&(b=this.createVertex(),b.node=a,this.Mh(b));return b};t.Ov=function(a){if(null!==a&&(F&&x(a,kq,hq,"deleteVertex:vertex"),mq(this,a))){for(var b=a.Og,c=b.count-1;0<=c;c--){var d=b.O(c);this.tk(d)}b=a.Hg;for(a=b.count-1;0<=a;a--)c=b.O(a),this.tk(c)}};function mq(a,b){if(null===b)return!1;var c=a.Af.remove(b);c&&(b=b.node,null!==b&&a.bu.remove(b));return c}
t.Fz=function(a){null!==a&&(F&&x(a,T,hq,"deleteNode:node"),a=this.kj(a),null!==a&&this.Ov(a))};t.kj=function(a){if(null===a)return null;F&&x(a,T,hq,"findVertex:node");return this.bu.K(a)};t.wq=function(a){if(null!==a){F&&x(a,lq,hq,"addEdge:edge");nq(this,a);var b=a.toVertex;null!==b&&b.Fv(a);b=a.fromVertex;null!==b&&b.Dv(a)}};function nq(a,b){if(null!==b){a.qe.add(b);var c=b.link;null!==c&&null===a.Fq(c)&&a.Xt.add(c,b);b.network=a}}
t.jz=function(a){if(null===a)return null;F&&x(a,R,hq,"addLink:link");var b=a.fromNode,c=a.toNode,d=this.Fq(a);null===d?(d=this.createEdge(),d.link=a,null!==b&&(d.fromVertex=this.qm(b)),null!==c&&(d.toVertex=this.qm(c)),this.wq(d)):(null!==b?d.fromVertex=this.qm(b):d.fromVertex=null,null!==c?d.toVertex=this.qm(c):d.toVertex=null);return d};t.tk=function(a){if(null!==a){F&&x(a,lq,hq,"deleteEdge:edge");var b=a.toVertex;null!==b&&b.Nv(a);b=a.fromVertex;null!==b&&b.Mv(a);oq(this,a)}};
function oq(a,b){null!==b&&a.qe.remove(b)&&(b=b.link,null!==b&&a.Xt.remove(b))}t.Ez=function(a){null!==a&&(F&&x(a,R,hq,"deleteLink:link"),a=this.Fq(a),null!==a&&this.tk(a))};t.Fq=function(a){if(null===a)return null;F&&x(a,R,hq,"findEdge:link");return this.Xt.K(a)};
t.Bk=function(a,b,c){if(null===a||null===b)return null;F&&(x(a,kq,hq,"linkVertexes:fromVertex"),x(b,kq,hq,"linkVertexes:toVertex"),null!==c&&x(c,R,hq,"linkVertexes:link"));if(a.network===this&&b.network===this){var d=this.createEdge();d.link=c;d.fromVertex=a;d.toVertex=b;this.wq(d);return d}return null};t.Vm=function(a){if(null!==a){F&&x(a,lq,hq,"reverseEdge:edge");var b=a.fromVertex,c=a.toVertex;null!==b&&null!==c&&(b.Mv(a),c.Nv(a),a.Vm(),b.Fv(a),c.Dv(a))}};
t.Dq=function(){for(var a=La(),b=this.qe.iterator;b.next();){var c=b.value;c.fromVertex===c.toVertex&&a.push(c)}b=a.length;for(c=0;c<b;c++)this.tk(a[c]);Oa(a)};hq.prototype.deleteArtificialVertexes=function(){for(var a=La(),b=this.Af.iterator;b.next();){var c=b.value;null===c.node&&a.push(c)}c=a.length;for(b=0;b<c;b++)this.Ov(a[b]);b=La();for(c=this.qe.iterator;c.next();){var d=c.value;null===d.link&&b.push(d)}c=b.length;for(d=0;d<c;d++)this.tk(b[d]);Oa(a);Oa(b)};
function pq(a){for(var b=La(),c=a.qe.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.tk(b[d]);Oa(b)}
hq.prototype.Ty=function(a){void 0===a&&(a=!0);a&&(this.deleteArtificialVertexes(),pq(this),this.Dq());a=new H;for(var b=!0;b;){b=!1;for(var c=this.Af.iterator;c.next();){var d=c.value;if(0<d.Og.count||0<d.Hg.count){b=this.layout.createNetwork();a.add(b);qq(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 qq(a,b,c){if(null!==c&&c.network!==b){mq(a,c);b.Mh(c);for(var d=c.sourceEdges;d.next();){var e=d.value;e.network!==b&&(oq(a,e),nq(b,e),qq(a,b,e.fromVertex))}for(d=c.destinationEdges;d.next();)c=d.value,c.network!==b&&(oq(a,c),nq(b,c),qq(a,b,c.toVertex))}}hq.prototype.Nz=function(){for(var a=new I,b=this.Af.iterator;b.next();)a.add(b.value.node);for(b=this.qe.iterator;b.next();)a.add(b.value.link);return a};
ma.Object.defineProperties(hq.prototype,{layout:{configurable:!0,get:function(){return this.oc},set:function(a){null!==a&&(this.oc=a)}},vertexes:{configurable:!0,get:function(){return this.Af}},edges:{configurable:!0,get:function(){return this.qe}}});hq.prototype.findAllParts=hq.prototype.Nz;hq.prototype.splitIntoSubNetworks=hq.prototype.Ty;hq.prototype.deleteSelfEdges=hq.prototype.Dq;hq.prototype.reverseEdge=hq.prototype.Vm;hq.prototype.linkVertexes=hq.prototype.Bk;
hq.prototype.findEdge=hq.prototype.Fq;hq.prototype.deleteLink=hq.prototype.Ez;hq.prototype.deleteEdge=hq.prototype.tk;hq.prototype.addLink=hq.prototype.jz;hq.prototype.addEdge=hq.prototype.wq;hq.prototype.findVertex=hq.prototype.kj;hq.prototype.deleteNode=hq.prototype.Fz;hq.prototype.deleteVertex=hq.prototype.Ov;hq.prototype.addNode=hq.prototype.qm;hq.prototype.addVertex=hq.prototype.Mh;hq.prototype.addParts=hq.prototype.Gg;hq.className="LayoutNetwork";
function kq(a){fb(this);F&&!a&&v("LayoutVertex constructor requires non-null LayoutNetwork argument");this.Rc=a;this.l=(new L(0,0,10,10)).freeze();this.w=(new J(5,5)).freeze();this.Ni=this.pb=null;this.Og=new H;this.Hg=new H}kq.prototype.clear=function(){this.Ni=this.pb=null;this.Og=new H;this.Hg=new H};
kq.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutVertex#"+sb(this);if(0<a&&(b+=null!==this.node?"("+this.node.toString()+")":"",1<a)){a="";for(var c=!0,d=this.Og.iterator;d.next();){var e=d.value;c?c=!1:a+=",";a+=e.toString(0)}e="";c=!0;for(d=this.Hg.iterator;d.next();){var f=d.value;c?c=!1:e+=",";e+=f.toString(0)}b+=" sources: "+a+" destinations: "+e}return b};
kq.prototype.commit=function(){var a=this.pb;if(null!==a){var b=this.bounds,c=a.bounds;Fa(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 Hf)){c=L.alloc();var d=this.network.layout.mj(a,c),e=a.locationObject.ma(Mc);if(d.o()&&e.o()){a.moveTo(b.x+this.focusX-(e.x-d.x),b.y+this.focusY-(e.y-d.y));L.free(c);return}L.free(c)}a.moveTo(b.x,b.y)}};
kq.prototype.Fv=function(a){null!==a&&(F&&x(a,lq,kq,"addSourceEdge:edge"),this.Og.contains(a)||this.Og.add(a))};kq.prototype.Nv=function(a){null!==a&&(F&&x(a,lq,kq,"deleteSourceEdge:edge"),this.Og.remove(a))};kq.prototype.Dv=function(a){null!==a&&(F&&x(a,lq,kq,"addDestinationEdge:edge"),this.Hg.contains(a)||this.Hg.add(a))};kq.prototype.Mv=function(a){null!==a&&(F&&x(a,lq,kq,"deleteDestinationEdge:edge"),this.Hg.remove(a))};
function rq(a,b){F&&x(a,kq,kq,"standardComparer:m");F&&x(b,kq,kq,"standardComparer:n");a=a.Ni;b=b.Ni;return a?b?(a=a.text,b=b.text,a<b?-1:a>b?1:0):1:null!==b?-1:0}
ma.Object.defineProperties(kq.prototype,{sourceEdgesArrayAccess:{configurable:!0,get:function(){return this.Og._dataArray}},destinationEdgesArrayAccess:{configurable:!0,get:function(){return this.Hg._dataArray}},data:{configurable:!0,get:function(){return this.pb},set:function(a){this.pb=a;if(null!==a){var b=a.bounds;a=b.x;var c=b.y,d=b.width;b=b.height;this.w.h(d/2,b/2);this.l.h(a,c,d,b)}}},node:{configurable:!0,get:function(){return this.Ni},
set:function(a){if(this.Ni!==a){F&&null!==a&&x(a,T,kq,"node");this.Ni=a;a.Fb();var b=this.network.layout,c=L.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);L.free(c);if(!(a instanceof Hf)&&(a=a.locationObject.ma(Mc),a.o())){this.w.h(a.x-b,a.y-e);return}this.w.h(f/2,d/2)}}},bounds:{configurable:!0,get:function(){return this.l},set:function(a){this.l.A(a)||(F&&x(a,L,kq,"bounds"),this.l.assign(a))}},focus:{configurable:!0,
get:function(){return this.w},set:function(a){this.w.A(a)||(F&&x(a,J,kq,"focus"),this.w.assign(a))}},centerX:{configurable:!0,get:function(){return this.l.x+this.w.x},set:function(a){var b=this.l;b.x+this.w.x!==a&&(F&&C(a,kq,"centerX"),b.ka(),b.x=a-this.w.x,b.freeze())}},centerY:{configurable:!0,get:function(){return this.l.y+this.w.y},set:function(a){var b=this.l;b.y+this.w.y!==a&&(F&&C(a,kq,"centerY"),b.ka(),b.y=a-this.w.y,b.freeze())}},focusX:{configurable:!0,
get:function(){return this.w.x},set:function(a){var b=this.w;b.x!==a&&(b.ka(),b.x=a,b.freeze())}},focusY:{configurable:!0,get:function(){return this.w.y},set:function(a){var b=this.w;b.y!==a&&(b.ka(),b.y=a,b.freeze())}},x:{configurable:!0,get:function(){return this.l.x},set:function(a){var b=this.l;b.x!==a&&(b.ka(),b.x=a,b.freeze())}},y:{configurable:!0,get:function(){return this.l.y},set:function(a){var b=this.l;b.y!==a&&(b.ka(),b.y=a,b.freeze())}},width:{configurable:!0,
enumerable:!0,get:function(){return this.l.width},set:function(a){var b=this.l;b.width!==a&&(b.ka(),b.width=a,b.freeze())}},height:{configurable:!0,get:function(){return this.l.height},set:function(a){var b=this.l;b.height!==a&&(b.ka(),b.height=a,b.freeze())}},network:{configurable:!0,get:function(){return this.Rc},set:function(a){F&&x(a,hq,kq,"network");this.Rc=a}},sourceVertexes:{configurable:!0,get:function(){for(var a=new I,b=this.sourceEdges;b.next();)a.add(b.value.fromVertex);
return a.iterator}},destinationVertexes:{configurable:!0,get:function(){for(var a=new I,b=this.destinationEdges;b.next();)a.add(b.value.toVertex);return a.iterator}},vertexes:{configurable:!0,get:function(){for(var a=new I,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:{configurable:!0,get:function(){return this.Og.iterator}},destinationEdges:{configurable:!0,
enumerable:!0,get:function(){return this.Hg.iterator}},edges:{configurable:!0,get:function(){for(var a=new H,b=this.sourceEdges;b.next();)a.add(b.value);for(b=this.destinationEdges;b.next();)a.add(b.value);return a.iterator}},edgesCount:{configurable:!0,get:function(){return this.Og.count+this.Hg.count}}});kq.prototype.deleteDestinationEdge=kq.prototype.Mv;kq.prototype.addDestinationEdge=kq.prototype.Dv;kq.prototype.deleteSourceEdge=kq.prototype.Nv;
kq.prototype.addSourceEdge=kq.prototype.Fv;kq.className="LayoutVertex";kq.standardComparer=rq;
kq.smartComparer=function(a,b){F&&x(a,kq,kq,"smartComparer:m");F&&x(b,kq,kq,"smartComparer:n");if(null!==a){if(null!==b){a=a.Ni;var c=b.Ni;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 lq(a){fb(this);F&&!a&&v("LayoutEdge constructor requires non-null LayoutNetwork argument");this.qd=a;this.Cg=this.dg=this.Jl=this.pb=null}lq.prototype.clear=function(){this.Cg=this.dg=this.Jl=this.pb=null};
lq.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutEdge#"+sb(this);0<a&&(b+=null!==this.Jl?"("+this.Jl.toString()+")":"",1<a&&(b+=" "+(this.dg?this.dg.toString():"null")+" --\x3e "+(this.Cg?this.Cg.toString():"null")));return b};lq.prototype.Vm=function(){var a=this.dg;this.dg=this.Cg;this.Cg=a};lq.prototype.commit=function(){};lq.prototype.xy=function(a){F&&x(a,kq,lq,"getOtherVertex:v");return this.Cg===a?this.dg:this.dg===a?this.Cg:null};
ma.Object.defineProperties(lq.prototype,{network:{configurable:!0,get:function(){return this.qd},set:function(a){F&&x(a,hq,lq,"network");this.qd=a}},data:{configurable:!0,get:function(){return this.pb},set:function(a){this.pb!==a&&(F&&null!==a&&A(a,"object",lq,"data"),this.pb=a)}},link:{configurable:!0,get:function(){return this.Jl},set:function(a){this.Jl!==a&&(F&&null!==a&&x(a,R,lq,"link"),this.Jl=a)}},fromVertex:{configurable:!0,get:function(){return this.dg},
set:function(a){this.dg!==a&&(F&&null!==a&&x(a,kq,lq,"network"),this.dg=a)}},toVertex:{configurable:!0,get:function(){return this.Cg},set:function(a){this.Cg!==a&&(F&&null!==a&&x(a,kq,lq,"network"),this.Cg=a)}}});lq.prototype.getOtherVertex=lq.prototype.xy;lq.className="LayoutEdge";
function al(){0<arguments.length&&za(al);Ni.call(this);this.isViewportSized=!0;this.tq=this.uq=NaN;this.Wg=(new Hb(NaN,NaN)).freeze();this.sf=(new Hb(10,10)).freeze();this.Cb=sq;this.Ib=tq;this.Yc=uq;this.Tc=vq}la(al,Ni);al.prototype.cloneProtected=function(a){Ni.prototype.cloneProtected.call(this,a);a.uq=this.uq;a.tq=this.tq;a.Wg.assign(this.Wg);a.sf.assign(this.sf);a.Cb=this.Cb;a.Ib=this.Ib;a.Yc=this.Yc;a.Tc=this.Tc};
al.prototype.mb=function(a){a.classType===al?a===uq||a===wq||a===xq||a===yq?this.sorting=a:a===tq||a===zq?this.arrangement=a:a===sq||a===Aq?this.alignment=a:v("Unknown enum value: "+a):Ni.prototype.mb.call(this,a)};
al.prototype.doLayout=function(a){F&&null===a&&v("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);var b=this.$x(a);a=this.diagram;for(var c=b.copy().iterator;c.next();){var d=c.value;if(!d.Uh()||null===d.fromNode&&null===d.toNode){if(d.Fb(),d instanceof Hf)for(d=d.memberParts;d.next();)b.remove(d.value)}else b.remove(d)}var e=b.ua();if(0!==e.length){switch(this.sorting){case yq:e.reverse();
break;case uq:e.sort(this.comparer);break;case wq: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.Ba("Layout");d=[];switch(this.alignment){case Aq:var h=b,k=c,l=L.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,w=0,y=0,z=0;z<e.length;z++){var B=e[z],D=this.mj(B,l),G=Math.ceil((D.width+h)/m)*m,O=Math.ceil((D.height+k)/n)*n;switch(p){case zq:var V=Math.abs(q-D.width);break;default:V=q+D.width}if(0<f&&w>f-1||
0<g&&0<w&&V-r>g)d.push(new L(0,u,g+h,y)),w=0,q=r,u+=y,y=0;y=Math.max(y,O);switch(p){case zq:D=-D.width;break;default:D=0}B.moveTo(q+D,u);switch(p){case zq:q-=G;break;default:q+=G}w++}d.push(new L(0,u,g+h,y));L.free(l);break;case sq:k=g;m=f;n=b;p=c;g=L.alloc();r=Math.max(this.cellSize.width,1);f=u=l=0;h=J.alloc();for(q=0;q<e.length;q++)y=e[q],w=this.mj(y,g),y=y.If(y.locationObject,y.locationSpot,h),l=Math.max(l,y.x),u=Math.max(u,w.width-y.x),f=Math.max(f,y.y);q=this.arrangement;switch(q){case zq:l+=
n;break;default:u+=n}r=isFinite(r)?Math.max(r+n,1):Math.max(l+u,1);var P=y=this.arrangementOrigin.x;z=this.arrangementOrigin.y;u=0;k>=l&&(k-=l);l=B=0;G=Math.max(this.cellSize.height,1);D=f=0;O=!0;w=J.alloc();for(V=0;V<e.length;V++){var ca=e[V],Y=this.mj(ca,g),oa=ca.If(ca.locationObject,ca.locationSpot,h);if(0<u)switch(q){case zq:P=(P-y-(Y.width-oa.x))/r;P=K.ca(Math.round(P),P)?Math.round(P):Math.floor(P);P=P*r+y;break;default:P=(P-y+oa.x)/r,P=K.ca(Math.round(P),P)?Math.round(P):Math.ceil(P),P=P*r+
y}else switch(q){case zq:B=P+oa.x+Y.width;break;default:B=P-oa.x}switch(q){case zq:var Da=-(P+oa.x)+B;break;default:Da=P+Y.width-oa.x-B}if(0<m&&u>m-1||0<k&&0<u&&Da>k){d.push(new L(0,O?z-f:z,k+n,D+f+p));for(P=0;P<u&&V!==u;P++){Da=e[V-u+P];var X=Da.If(Da.locationObject,Da.locationSpot,w);Da.moveTo(Da.position.x,Da.position.y+f-X.y)}D+=p;z=O?z+D:z+(D+f);u=D=f=0;P=y;O=!1}P===y&&(l=q===zq?Math.max(l,Y.width-oa.x):Math.min(l,-oa.x));f=Math.max(f,oa.y);D=Math.max(D,Y.height-oa.y);isFinite(G)&&(D=Math.max(D,
Math.max(Y.height,G)-oa.y));O?ca.moveTo(P-oa.x,z-oa.y):ca.moveTo(P-oa.x,z);switch(q){case zq:P-=oa.x+n;break;default:P+=Y.width-oa.x+n}u++}d.push(new L(0,z,k+n,(O?D:D+f)+p));if(e.length!==u)for(k=0;k<u;k++)m=e[e.length-u+k],n=m.If(m.locationObject,m.locationSpot,h),m.moveTo(m.position.x,m.position.y+f-n.y);J.free(h);J.free(w);if(q===zq)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);L.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===zq?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.ab("Layout");this.isValidLayout=!0}};al.prototype.commitLayers=function(){};function vq(a,b){F&&x(a,S,al,"standardComparer:a");F&&x(b,S,al,"standardComparer:b");a=a.text;b=b.text;return a<b?-1:a>b?1:0}
ma.Object.defineProperties(al.prototype,{wrappingWidth:{configurable:!0,get:function(){return this.uq},set:function(a){this.uq!==a&&(A(a,"number",al,"wrappingWidth"),0<a||isNaN(a))&&(this.uq=a,this.isViewportSized=isNaN(a),this.D())}},wrappingColumn:{configurable:!0,get:function(){return this.tq},set:function(a){this.tq!==a&&(A(a,"number",al,"wrappingColumn"),0<a||isNaN(a))&&(this.tq=a,this.D())}},cellSize:{configurable:!0,get:function(){return this.Wg},set:function(a){x(a,
Hb,al,"cellSize");this.Wg.A(a)||(this.Wg.assign(a),this.D())}},spacing:{configurable:!0,get:function(){return this.sf},set:function(a){x(a,Hb,al,"spacing");this.sf.A(a)||(this.sf.assign(a),this.D())}},alignment:{configurable:!0,get:function(){return this.Cb},set:function(a){this.Cb!==a&&(hb(a,al,al,"alignment"),a===sq||a===Aq)&&(this.Cb=a,this.D())}},arrangement:{configurable:!0,get:function(){return this.Ib},set:function(a){this.Ib!==a&&(hb(a,al,al,"arrangement"),
a===tq||a===zq)&&(this.Ib=a,this.D())}},sorting:{configurable:!0,get:function(){return this.Yc},set:function(a){this.Yc!==a&&(hb(a,al,al,"sorting"),a===xq||a===yq||a===uq||a===wq)&&(this.Yc=a,this.D())}},comparer:{configurable:!0,get:function(){return this.Tc},set:function(a){this.Tc!==a&&(A(a,"function",al,"comparer"),this.Tc=a,this.D())}}});
var Aq=new E(al,"Position",0),sq=new E(al,"Location",1),tq=new E(al,"LeftToRight",2),zq=new E(al,"RightToLeft",3),xq=new E(al,"Forward",4),yq=new E(al,"Reverse",5),uq=new E(al,"Ascending",6),wq=new E(al,"Descending",7);al.className="GridLayout";al.standardComparer=vq;
al.smartComparer=function(a,b){F&&x(a,S,al,"standardComparer:a");F&&x(b,S,al,"standardComparer: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};al.Position=Aq;al.Location=sq;al.LeftToRight=tq;al.RightToLeft=zq;al.Forward=xq;al.Reverse=yq;al.Ascending=uq;al.Descending=wq;function Ii(){this.mp=new I;this.Mo=new I;this.Ha=new I;this.$e=new Db;this.Ze=new Db;this.Nj=new Db;this.B=null;this.sr=!1}t=Ii.prototype;t.clear=function(){this.mp.clear();this.Mo.clear();this.Ha.clear();this.$e.clear();this.Ze.clear();this.Nj.clear()};
t.he=function(a){F&&null!==a&&x(a,Q,Ii,"setDiagram");this.B=a};t.nj=function(a){if(a instanceof T){if(this.mp.add(a),a instanceof Hf){var b=a.containingGroup;null===b?this.B.Hh.add(a):b.Ol.add(a);b=a.layout;null!==b&&(b.diagram=this.B)}}else a instanceof R?this.Mo.add(a):a instanceof Te||this.Ha.add(a);b=a.data;null===b||a instanceof Te||(a instanceof R?this.Ze.add(b,a):this.$e.add(b,a))};
t.Nc=function(a){a.lk();if(a instanceof T){if(this.mp.remove(a),a instanceof Hf){var b=a.containingGroup;null===b?this.B.Hh.remove(a):b.Ol.remove(a);b=a.layout;null!==b&&(b.diagram=null)}}else a instanceof R?this.Mo.remove(a):a instanceof Te||this.Ha.remove(a);b=a.data;null===b||a instanceof Te||(a instanceof R?this.Ze.remove(b):this.$e.remove(b))};
t.Gd=function(){for(var a=this.B.nodeTemplateMap.iterator;a.next();){var b=a.value,c=a.key;(!b.bc()||b instanceof Hf)&&v('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 Hf||v('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 R||v('Invalid link template in Diagram.linkTemplateMap: template for "'+c+'" must be a Link, not a normal Node or simple Part: '+b);a=La();for(b=this.B.selection.iterator;b.next();)(c=b.value.data)&&a.push(c);b=La();for(c=this.B.highlighteds.iterator;c.next();){var d=c.value.data;d&&b.push(d)}c=La();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.Dc(a[d]),null!==e&&(e.isSelected=!0);for(d=0;d<b.length;d++)e=this.Dc(b[d]),null!==e&&(e.isHighlighted=!0);for(d=0;d<c.length;d+=2)e=this.Dc(c[d]),null!==e&&(e.location=c[d+1]);Oa(a);Oa(b);Oa(c)};Ii.prototype.addAllModeledParts=function(){this.addModeledParts(this.diagram.model.nodeDataArray)};
Ii.prototype.addModeledParts=function(a,b){var c=this,d=this.diagram.model;a.forEach(function(a){d.Za(a)&&Bq(c,a,!1)});a.forEach(function(a){d.Za(a)&&c.resolveReferencesForData(a)});!1!==b&&Dk(this.diagram,!1)};
function Bq(a,b,c){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.$e.contains(b)){void 0===c&&(c=!0);a:{if(void 0!==b&&null!==b&&!a.B.undoManager.isUndoingRedoing&&!a.$e.contains(b)){var d=a.Jq(b);var e=cp(a,b,d);if(null!==e&&(Lg(e),e=e.copy(),null!==e)){var f=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.Uf=d;e.pb=b;a.sr&&(e.nh="Tool");a.diagram.add(e);e.pb=null;e.data=b;a.diagram.skipsModelSourceBindings=f;d=e;break a}}d=null}null!==d&&c&&a.resolveReferencesForData(b)}}
Ii.prototype.insertLink=function(){return null};Ii.prototype.resolveReferencesForData=function(){};Ii.prototype.Jq=function(a){return this.B.model.Jq(a)};
function cp(a,b,c){a=a.B;var d=a.model;d.oj()&&d.Ut(b)?(b=a.groupTemplateMap.K(c),null===b&&(b=a.groupTemplateMap.K(""),null===b&&(Cq||(Cq=!0,Ca('No Group template found for category "'+c+'"'),Ca("  Using default group template")),b=a.Fu))):(b=a.nodeTemplateMap.K(c),null===b&&(b=a.nodeTemplateMap.K(""),null===b&&(Dq||(Dq=!0,Ca('No Node template found for category "'+c+'"'),Ca("  Using default node template")),b=a.Hu)));return b}Ii.prototype.getLinkCategoryForData=function(){return""};
Ii.prototype.setLinkCategoryForData=function(){};Ii.prototype.setFromNodeForLink=function(){};Ii.prototype.setToNodeForLink=function(){};Ii.prototype.findLinkTemplateForCategory=function(a){var b=this.B.linkTemplateMap.K(a);null===b&&(b=this.B.linkTemplateMap.K(""),null===b&&(Eq||(Eq=!0,Ca('No Link template found for category "'+a+'"'),Ca("  Using default link template")),b=this.B.Gu));return b};Ii.prototype.removeAllModeledParts=function(){this.hu(this.diagram.model.nodeDataArray)};
Ii.prototype.hu=function(a){var b=this;a.forEach(function(a){b.dr(a)})};Ii.prototype.dr=function(a){a=this.Dc(a);null!==a&&(ak(this.diagram,a,!1),this.unresolveReferencesForPart(a))};Ii.prototype.unresolveReferencesForPart=function(){};Ii.prototype.removeDataForLink=function(){};Ii.prototype.findPartForKey=function(a){if(null===a||void 0===a)return null;a=this.B.model.Qb(a);return null!==a?this.$e.K(a):null};
Ii.prototype.Rb=function(a){if(null===a||void 0===a)return null;a=this.B.model.Qb(a);if(null===a)return null;a=this.$e.K(a);return a instanceof T?a:null};Ii.prototype.findLinkForKey=function(){return null};t=Ii.prototype;t.Dc=function(a){if(null===a)return null;var b=this.$e.K(a);return null!==b?b:b=this.Ze.K(a)};t.gj=function(a){if(null===a)return null;a=this.$e.K(a);return a instanceof T?a:null};t.Cc=function(a){return null===a?null:this.Ze.K(a)};
t.Kt=function(a){for(var b=0;b<arguments.length;++b);b=new I;for(var c=this.mp.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(Fa(g)&&Fq(this,e,g)){b.add(d);break}}}return b.iterator};t.Jt=function(a){for(var b=0;b<arguments.length;++b);b=new I;for(var c=this.Mo.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(Fa(g)&&Fq(this,e,g)){b.add(d);break}}}return b.iterator};
function Fq(a,b,c){for(var d in c){var e=b[d],f=c[d];if(Ga(f)){if(!Ga(e)||e.length<f.length)return!1;for(var g=0;g<e.length;g++){var h=f[g];if(void 0!==h&&!Gq(a,e[g],h))return!1}}else if(!Gq(a,e,f))return!1}return!0}function Gq(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(Fa(b)&&Fa(c)){if(!Fq(a,b,c))return!1}else if(b!==c)return!1;return!0}
Ii.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.ba){b.ba=!1;try{var d=a.modelChange;if(""!==d)if(c===He){if("nodeCategory"===d){var e=this.Dc(a.object),f=a.newValue;null!==e&&"string"===typeof f&&(e.category=f)}else"nodeDataArray"===d&&(this.hu(a.oldValue),this.addModeledParts(a.newValue));b.isModified=!0}else if(c===Je){var g=a.newValue;"nodeDataArray"===d&&Fa(g)&&Bq(this,g);b.isModified=!0}else if(c===Ke){var h=a.oldValue;
"nodeDataArray"===d&&Fa(h)&&this.dr(h);b.isModified=!0}else c===Ie&&("SourceChanged"===d?null!==a.object?this.updateDataBindings(a.object,a.propertyName):(this.nr(),this.updateAllTargetBindings()):"ModelDisplaced"===d&&this.Gd());else if(c===He){var k=a.propertyName,l=a.object;if(l===b.model){if("nodeKeyProperty"===k||"nodeCategoryProperty"===k)b.undoManager.isUndoingRedoing||this.Gd()}else this.updateDataBindings(l,k);b.isModified=!0}else if(c===Je||c===Ke){var m=a.change===Je,n=m?a.newParam:a.oldParam,
p=m?a.newValue:a.oldValue,r=this.Nj.K(a.object);if(Array.isArray(r))for(a=0;a<r.length;a++){var q=r[a];if(m)Dn(q,p,n);else if(!(0>n)){var u=n+vn(q);q.Nc(u,!0);Hn(q,u,n)}}b.isModified=!0}}finally{b.ba=!0}}}}};Ii.prototype.updateAllTargetBindings=function(a){void 0===a&&(a="");for(var b=this.parts.iterator;b.next();)b.value.Ga(a);for(b=this.nodes.iterator;b.next();)b.value.Ga(a);for(b=this.links.iterator;b.next();)b.value.Ga(a)};
Ii.prototype.nr=function(){for(var a=this.B.model,b=new I,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){Hq(a,b,!1)});for(d=0;d<c.length;d++){var f=c[d];null===this.Dc(f)&&Iq(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()};Ii.prototype.refreshDataBoundLinks=function(){};Ii.prototype.updateRelationshipsFromData=function(){};
Ii.prototype.updateDataBindings=function(a,b){if("string"===typeof b){var c=this.Dc(a);if(null!==c)c.Ga(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].oy(a);null!==g&&(null===c&&(c=La()),c.push(g))}if(null!==c)break}if(null!==c){for(d=0;d<c.length;d++)c[d].Ga(b);Oa(c)}}a===this.diagram.model.modelData&&this.updateAllTargetBindings(b)}};
function Wj(a,b){var c=b.Fi;if(Ga(c)){var d=a.Nj.K(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 Zj(a,b,c){Uj(b,function(a){a=a.$.j;for(var b=a.length,d=0;d<b;d++)Bk(c,a[d])});var d=b.Fi;if(Ga(d)){var e=a.Nj.K(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}}}
Ii.prototype.rk=function(a,b,c){var d=new Db;if(Ga(a))for(var e=0;e<a.length;e++)Jq(this,a[e],b,d,c);else for(a=a.iterator;a.next();)Jq(this,a.value,b,d,c);if(null!==b){c=b.model;a=b.toolManager.findTool("Dragging");a=null!==a?a.dragOptions.dragsLink:b.el.dragsLink;e=new I;for(var f=new Db,g=d.iterator;g.next();){var h=g.value;if(h instanceof R)a||null!==h.fromNode&&null!==h.toNode||e.add(h);else if(h instanceof T&&null!==h.data&&c.Gm()){var k=h;h=g.key;var l=h.Kg();null!==l&&(l=d.K(l),null!==l?(c.ie(k.data,
c.pa(l.data)),k=b.Cc(k.data),h=h.jj(),null!==h&&null!==k&&f.add(h,k)):c.ie(k.data,void 0))}}0<e.count&&b.iu(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 Db;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.Ga();return d};
function Jq(a,b,c,d,e){if(null===b||e&&!b.canCopy())return null;if(d.contains(b))return d.K(b);var f=a.copyPartData(b,c);if(!(f instanceof S))return null;f.isSelected=!1;f.isHighlighted=!1;d.add(b,f);if(b instanceof T){for(var g=b.linksConnected;g.next();){var h=g.value;if(h.fromNode===b){var k=d.K(h);null!==k&&(k.fromNode=f)}h.toNode===b&&(h=d.K(h),null!==h&&(h.toNode=f))}if(b instanceof Hf&&f instanceof Hf)for(b=b.memberParts;b.next();)g=Jq(a,b.value,c,d,e),g instanceof R||null===g||(g.containingGroup=
f)}else if(b instanceof R&&f instanceof R)for(g=b.fromNode,null!==g&&(g=d.K(g),null!==g&&(f.fromNode=g)),g=b.toNode,null!==g&&(g=d.K(g),null!==g&&(f.toNode=g)),b=b.labelNodes;b.next();)g=Jq(a,b.value,c,d,e),null!==g&&g instanceof T&&(g.labeledLink=f);return f}
Ii.prototype.copyPartData=function(a,b){var c=null,d=a.data;if(null!==d&&null!==b){var e=b.model;a instanceof R||(d=e.copyNodeData(d),Fa(d)&&(e.Bf(d),c=b.Dc(d)))}else Lg(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 R||(e=b.copyNodeData(d)),Fa(e)&&(c.data=e)));return c};
ma.Object.defineProperties(Ii.prototype,{nodes:{configurable:!0,get:function(){return this.mp}},links:{configurable:!0,get:function(){return this.Mo}},parts:{configurable:!0,get:function(){return this.Ha}},diagram:{configurable:!0,get:function(){return this.B}},addsToTemporaryLayer:{configurable:!0,get:function(){return this.sr},set:function(a){A(a,"boolean",Ii,"addsToTemporaryLayer");this.sr=a}}});
Ii.prototype.updateAllRelationshipsFromData=Ii.prototype.nr;Ii.prototype.findLinksByExample=Ii.prototype.Jt;Ii.prototype.findNodesByExample=Ii.prototype.Kt;Ii.prototype.findLinkForData=Ii.prototype.Cc;Ii.prototype.findNodeForData=Ii.prototype.gj;Ii.prototype.findPartForData=Ii.prototype.Dc;Ii.prototype.findNodeForKey=Ii.prototype.Rb;Ii.prototype.removeModeledPart=Ii.prototype.dr;Ii.prototype.removeModeledParts=Ii.prototype.hu;Ii.prototype.rebuildParts=Ii.prototype.Gd;var Dq=!1,Cq=!1,Eq=!1;
Ii.className="PartManager";function Kq(a){Ii.apply(this,arguments)}la(Kq,Ii);Kq.prototype.addAllModeledParts=function(){var a=this.diagram.model;this.addModeledParts(a.nodeDataArray);Lq(this,a.linkDataArray)};Kq.prototype.addModeledParts=function(a){Ii.prototype.addModeledParts.call(this,a,!1);for(a=this.links.iterator;a.next();)dp(a.value);Dk(this.diagram,!1)};function Lq(a,b){b.forEach(function(b){Mq(a,b)});Dk(a.diagram,!1)}
function Mq(a,b){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.Ze.contains(b)){var c=a.getLinkCategoryForData(b),d=a.findLinkTemplateForCategory(c);if(null!==d){Lg(d);var e=d.copy();if(null!==e){d=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.Uf=c;e.pb=b;c=a.diagram.model;var f=Nq(c,b,!0);""!==f&&(e.fromPortId=f);f=Oq(c,b,!0);void 0!==f&&(f=a.Rb(f),f instanceof T&&(e.fromNode=f));f=Nq(c,b,!1);""!==f&&(e.toPortId=f);f=Oq(c,b,!1);void 0!==f&&(f=a.Rb(f),
f instanceof T&&(e.toNode=f));c=c.Hf(b);Array.isArray(c)&&c.forEach(function(b){b=a.Rb(b);null!==b&&(b.labeledLink=e)});a.sr&&(e.nh="Tool");a.diagram.add(e);e.pb=null;e.data=b;a.diagram.skipsModelSourceBindings=d}}}}Kq.prototype.removeAllModeledParts=function(){var a=this.diagram.model;Pq(this,a.linkDataArray);this.hu(a.nodeDataArray)};function Pq(a,b){b.forEach(function(b){a.dr(b)})}Kq.prototype.getLinkCategoryForData=function(a){return this.diagram.model.Nt(a)};
Kq.prototype.setLinkCategoryForData=function(a,b){return this.diagram.model.gr(a,b)};Kq.prototype.setFromNodeForLink=function(a,b){var c=this.diagram.model;c.Dw(a.data,c.pa(null!==b?b.data:null))};Kq.prototype.setToNodeForLink=function(a,b){var c=this.diagram.model;c.Iw(a.data,c.pa(null!==b?b.data:null))};Kq.prototype.removeDataForLink=function(a){this.diagram.model.Qm(a.data)};
Kq.prototype.findPartForKey=function(a){var b=Ii.prototype.findPartForKey.call(this,a);return null===b&&(a=this.diagram.model.Ig(a),null!==a)?this.Ze.K(a):b};Kq.prototype.findLinkForKey=function(a){if(null===a||void 0===a)return null;a=this.diagram.model.Ig(a);return null!==a?this.Ze.K(a):null};
Kq.prototype.doModelChanged=function(a){var b=this;Ii.prototype.doModelChanged.call(this,a);if(this.diagram){var c=this.diagram;if(a.model===c.model){var d=a.change;if(c.ba){c.ba=!1;try{var e=a.modelChange;if(""!==e)if(d===He){if("linkFromKey"===e){var f=this.Cc(a.object);if(null!==f){var g=this.Rb(a.newValue);f.fromNode=g}}else if("linkToKey"===e){var h=this.Cc(a.object);if(null!==h){var k=this.Rb(a.newValue);h.toNode=k}}else if("linkFromPortId"===e){var l=this.Cc(a.object);if(null!==l){var m=a.newValue;
"string"===typeof m&&(l.fromPortId=m)}}else if("linkToPortId"===e){var n=this.Cc(a.object);if(null!==n){var p=a.newValue;"string"===typeof p&&(n.toPortId=p)}}else if("nodeGroupKey"===e){var r=this.Dc(a.object);if(null!==r){var q=a.newValue;if(void 0!==q){var u=this.Rb(q);u instanceof Hf?r.containingGroup=u:r.containingGroup=null}else r.containingGroup=null}}else if("linkLabelKeys"===e){var w=this.Cc(a.object);if(null!==w){var y=a.oldValue,z=a.newValue;Array.isArray(y)&&y.forEach(function(a){0<=z.indexOf(a)||
(a=b.Rb(a),null!==a&&(a.labeledLink=null))});Array.isArray(z)&&z.forEach(function(a){a=b.Rb(a);null!==a&&(a.labeledLink=w)})}}else if("linkCategory"===e){var B=this.Cc(a.object),D=a.newValue;null!==B&&"string"===typeof D&&(B.category=D)}else"linkDataArray"===e&&(Pq(this,a.oldValue),Lq(this,a.newValue));c.isModified=!0}else if(d===Je){var G=a.newValue;if("linkDataArray"===e&&"object"===typeof G&&null!==G)Mq(this,G);else if("linkLabelKeys"===e&&Qq(G)){var O=this.Cc(a.object),V=this.Rb(G);null!==O&&
null!==V&&(V.labeledLink=O)}c.isModified=!0}else{if(d===Ke){var P=a.oldValue;if("linkDataArray"===e&&"object"===typeof P&&null!==P)this.dr(P);else if("linkLabelKeys"===e&&Qq(P)){var ca=this.Rb(P);null!==ca&&(ca.labeledLink=null)}c.isModified=!0}}else if(d===He){var Y=a.propertyName;a.object!==c.model||"linkFromKeyProperty"!==Y&&"linkToKeyProperty"!==Y&&"linkFromPortIdProperty"!==Y&&"linkToPortIdProperty"!==Y&&"linkLabelKeysProperty"!==Y&&"nodeIsGroupProperty"!==Y&&"nodeGroupKeyProperty"!==Y&&"linkCategoryProperty"!==
Y||c.undoManager.isUndoingRedoing||this.Gd();c.isModified=!0}}finally{c.ba=!0}}}}};Kq.prototype.refreshDataBoundLinks=function(){var a=this,b=this.diagram.model,c=new I,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){Rq(b,a,!1)});d.forEach(function(c){null===a.Cc(c)&&Sq(b,c,!1)})};
Kq.prototype.updateRelationshipsFromData=function(a){var b=a.data;if(null!==b){var c=a.diagram;if(null!==c){var d=c.model;if(a instanceof R){var e=Oq(d,b,!0);e=c.Rb(e);a.fromNode=e;e=Oq(d,b,!1);e=c.Rb(e);a.toNode=e;b=d.Hf(b);if(0<b.length||0<a.labelNodes.count){if(1===b.length&&1===a.labelNodes.count){e=b[0];var f=a.labelNodes.first();if(d.pa(f.data)===e)return}e=(new I).addAll(b);var g=new I;a.labelNodes.each(function(a){null!==a.data&&(a=d.pa(a.data),void 0!==a&&g.add(a))});b=g.copy();b.cr(e);e=
e.copy();e.cr(g);if(0<b.count||0<e.count)b.each(function(b){b=c.Rb(b);null!==b&&b.labeledLink===a&&(b.labeledLink=null)}),e.each(function(b){b=c.Rb(b);null!==b&&b.labeledLink!==a&&(b.labeledLink=a)})}}else!(a instanceof Te)&&(b=d.Qh(b),b=c.findPartForKey(b),null===b||b instanceof Hf)&&(a.containingGroup=b)}}};
Kq.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.pa(a);if(void 0!==c){var d=Tq(b,c),e=this.Dc(a);if(null!==d&&null!==e){d=d.iterator;for(var f={};d.next();){var g=d.value;b.Za(g)?e instanceof Hf&&b.Qh(g)===c&&(g=this.Dc(g),null!==g&&(g.containingGroup=e)):(f.link=this.Cc(g),null!==f.link&&e instanceof T&&(Oq(b,g,!0)===c&&(f.link.fromNode=e),Oq(b,g,!1)===c&&(f.link.toNode=e),g=b.Hf(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}}Uq(b,c)}a=b.Qh(a);void 0!==a&&(a=this.Rb(a),a instanceof Hf&&(e.containingGroup=a))}};Kq.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof T){var c=b.pa(a.data);if(void 0!==c){for(var d=a.linksConnected;d.next();)Vq(b,c,d.value.data);a.isLinkLabel&&(d=a.labeledLink,null!==d&&Vq(b,c,d.data));if(a instanceof Hf)for(a=a.memberParts;a.next();)d=a.value.data,b.Za(d)&&Vq(b,c,d)}}};
Kq.prototype.copyPartData=function(a,b){var c=Ii.prototype.copyPartData.call(this,a,b);if(a instanceof R)if(a=a.data,null!==a&&null!==b){var d=b.model;a=d.Cq(a);"object"===typeof a&&null!==a&&(d.bj(a),c=b.Cc(a))}else null!==c&&(b=this.diagram,null!==a&&null!==b&&null!==b.commandHandler&&b.commandHandler.copiesClipboardData&&(b=b.model.Cq(a),"object"===typeof b&&null!==b&&(c.data=b)));return c};
Kq.prototype.insertLink=function(a,b,c,d){var e=this.diagram,f=e.model,g=e.toolManager.findTool("Linking"),h="";null!==a&&(null===b&&(b=a),h=b.portId,null===h&&(h=""));b="";null!==c&&(null===d&&(d=c),b=d.portId,null===b&&(b=""));d=g.archetypeLinkData;if(d instanceof R){if(Lg(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 T&&(Lg(a),a=a.copy(),null!==a&&(a.labeledLink=f,e.add(a))),f}else if(null!==d&&(d=f.Cq(d),"object"===
typeof d&&null!==d))return null!==a&&Wq(f,d,f.pa(a.data),!0),Xq(f,d,h,!0),null!==c&&Wq(f,d,f.pa(c.data),!1),Xq(f,d,b,!1),f.bj(d),a=g.archetypeLabelNodeData,null===a||a instanceof T||(a=f.copyNodeData(a),"object"===typeof a&&null!==a&&(f.Bf(a),a=f.pa(a),void 0!==a&&f.Ev(d,a))),e.Cc(d);return null};Kq.prototype.findLinkForKey=Kq.prototype.findLinkForKey;Kq.prototype.findPartForKey=Kq.prototype.findPartForKey;Kq.prototype.removeAllModeledParts=Kq.prototype.removeAllModeledParts;
Kq.prototype.addModeledParts=Kq.prototype.addModeledParts;Kq.prototype.addAllModeledParts=Kq.prototype.addAllModeledParts;Kq.className="GraphLinksPartManager";function Yq(){Ii.apply(this,arguments);this.th=null}la(Yq,Ii);
function Zq(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||!bg(d,e,f,null,!0))if(d=a.getLinkCategoryForData(c.data),b=a.findLinkTemplateForCategory(d),null!==b&&(Lg(b),b=b.copy(),null!==b)){var g=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;b.Uf=d;
b.pb=c.data;b.fromNode=e;b.toNode=f;a.diagram.add(b);b.pb=null;b.data=c.data;a.diagram.skipsModelSourceBindings=g}}}Yq.prototype.getLinkCategoryForData=function(a){return this.diagram.model.Pt(a)};Yq.prototype.setLinkCategoryForData=function(a,b){this.diagram.model.mu(a,b)};
Yq.prototype.setFromNodeForLink=function(a,b,c){var d=this.diagram.model;void 0===c&&(c=null);b=null!==b?b.data:null;if(this.diagram.isTreePathToChildren)d.ie(a.data,d.pa(b));else{var e=this.th;this.th=a;null!==c&&d.ie(c.data,void 0);d.ie(b,d.pa(null!==a.toNode?a.toNode.data:null));this.th=e}};
Yq.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.th;this.th=a;null!==c&&d.ie(c.data,void 0);d.ie(b,d.pa(null!==a.fromNode?a.fromNode.data:null));this.th=e}else d.ie(a.data,d.pa(b))};Yq.prototype.removeDataForLink=function(a){this.diagram.model.ie(a.data,void 0)};
Yq.prototype.findLinkForKey=function(a){if(null===a||void 0===a)return null;a=this.diagram.model.Qb(a);return null!==a?this.Ze.K(a):null};
Yq.prototype.doModelChanged=function(a){Ii.prototype.doModelChanged.call(this,a);if(this.diagram){var b=this.diagram;if(a.model===b.model){var c=a.change;if(b.ba){b.ba=!1;try{var d=a.modelChange;if(""!==d){if(c===He){if("nodeParentKey"===d){var e=a.object,f=this.Rb(a.newValue),g=this.gj(e);if(null!==this.th)null!==f&&(this.th.data=e,this.th.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:Zq(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===He){var n=a.propertyName;a.object===b.model&&"nodeParentKeyProperty"===n&&(b.undoManager.isUndoingRedoing||this.Gd());b.isModified=!0}}finally{b.ba=!0}}}}};
Yq.prototype.updateRelationshipsFromData=function(a){var b=a.data;if(null!==b){var c=a.diagram;if(null!==c){var d=c.model;a instanceof T&&(b=d.Rh(b),b=c.Rb(b),d=a.Kg(),b!==d&&(d=a.jj(),null!==b?null!==d?c.isTreePathToChildren?d.fromNode=b:d.toNode=b:Zq(this,b,a):null!==d&&ak(c,d,!1)))}}};Yq.prototype.updateDataBindings=function(a,b){Ii.prototype.updateDataBindings.call(this,a,b);"string"===typeof b&&null!==this.Dc(a)&&(a=this.Cc(a),null!==a&&a.Ga(b))};
Yq.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.pa(a);if(void 0!==c){var d=Tq(b,c),e=this.Dc(a);if(null!==d&&null!==e){for(d=d.iterator;d.next();){var f=d.value;b.Za(f)&&e instanceof T&&b.Rh(f)===c&&Zq(this,e,this.gj(f))}Uq(b,c)}a=b.Rh(a);void 0!==a&&e instanceof T&&(a=this.Rb(a),Zq(this,a,e))}};
Yq.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof T){var c=b.pa(a.data),d=this.Cc(a.data);if(null!==d){d.isSelected=!1;d.isHighlighted=!1;var e=d.layer;if(null!==e){var f=e.Nc(-1,d,!1);0<=f&&this.diagram.gb(Ke,"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)&&Vq(b,c,e)}};
Yq.prototype.insertLink=function(a,b,c){b=this.diagram.model;var d=a,e=c;this.diagram.isTreePathToChildren||(d=c,e=a);return null!==d&&null!==e?(b.ie(e.data,b.pa(d.data)),e.jj()):null};Yq.prototype.findLinkForKey=Yq.prototype.findLinkForKey;Yq.className="TreePartManager";
function W(a){this.Pi=new I;this.Mi=new I;this.uu=',\n  "insertedNodeKeys": ';this.lx=',\n  "modifiedNodeData": ';this.wu=',\n  "removedNodeKeys": ';this.bi=null;F&&1<arguments.length&&v("Model constructor can only take one optional argument, the Array of node data.");fb(this);this.Mn=this.Wa="";this.hg=!1;this.l={};this.vc=[];this.$a=new Db;this.Oi="key";this.cl=this.Ll=null;this.Dn=this.En=!1;this.Gn=!0;this.ln=null;this.Vj="category";this.$f=new Db;this.dv=new H;this.Bg=!1;this.w=null;this.undoManager=
new Me;void 0!==a&&(this.nodeDataArray=a)}W.prototype.cloneProtected=function(a){a.Wa=this.Wa;a.Mn=this.Mn;a.hg=this.hg;a.Oi=this.Oi;a.Ll=this.Ll;a.cl=this.cl;a.En=this.En;a.Dn=this.Dn;a.Gn=this.Gn;a.ln=this.ln;a.Vj=this.Vj};W.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};W.prototype.clear=function(){this.vc=[];this.$a.clear();this.$f.clear();this.undoManager.clear()};
W.prototype.toString=function(a){void 0===a&&(a=0);if(1<a)return this.kr();var b=(""!==this.name?this.name:"")+" Model";if(0<a){b+="\n node data:";a=this.nodeDataArray;for(var c=a.length,d=0;d<c;d++){var e=a[d];b+=" "+this.pa(e)+":"+Qa(e)}}return b};
W.prototype.aB=function(a){x(a,Ge,W,"toIncrementalData:e");a.change!==Ie&&v("Model.toIncrementalData argument is not a Transaction ChangedEvent:"+a.toString());var b=a.object;if(!(a.isTransactionFinished&&b instanceof Le))return null;$q(this,b);a=this.Yw(b,"FinishedUndo"===a.propertyName);this.bi=null;return a};
W.prototype.Yw=function(a,b){var c=this,d=!1,e=new I,f=new I,g=new I,h=this.bi;a.changes.each(function(a){a.model===c&&("nodeDataArray"===a.modelChange?a.change===Je?e.add(a.newValue):a.change===Ke&&g.add(a.oldValue):c.Za(a.object)?f.add(a.object):a.change!==He||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 W||c.pj()&&c.Bc(a.object)||ar(c,a.object).each(function(a){f.add(a)})):
d=!0)});var k=this.Mi;k.clear();e.each(function(a){k.add(c.pa(a));b||f.add(a)});var l=this.Pi;l.clear();g.each(function(a){l.add(c.pa(a));b&&f.add(a)});a=c.cloneDeep(f.ua());var m=null;d&&(null===m&&(m={}),m.modelData=this.cloneDeep(this.modelData));0<k.count&&(null===m&&(m={}),b?m.removedNodeKeys=k.ua():m.insertedNodeKeys=k.ua());0<a.length&&(null===m&&(m={}),m.modifiedNodeData=a);0<l.count&&(null===m&&(m={}),b?m.insertedNodeKeys=l.ua():m.removedNodeKeys=l.ua());l.clear();k.clear();return m};
W.prototype.cloneDeep=function(a){return br(this,a,!0)};
function br(a,b,c,d,e,f){function g(a,c){h?(void 0===a.__gohashid&&f.push(a),d.set(a,c)):(a=wb++,d.set(a,c),e.set(a,b))}if(!Fa(b))return b;f||(f=[]);var h=Object.isExtensible(b);d||(d=new Db);if(h){var k=d.get(b);if(k)return k}else for(e||(e=new Db),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(br(a,b[m],!1,d,e,f))}else if(b instanceof J||b instanceof Hb||b instanceof L||b instanceof lc||b instanceof M)k=
b.copy(),g(b,k);else{if(b instanceof Jl||b instanceof Fd||b instanceof E)return b;if(b instanceof H)k=(new H).addAll(br(a,b.ua(),!1,d,e,f)),g(b,k);else if(b instanceof I)k=(new I).addAll(br(a,b.ua(),!1,d,e,f)),g(b,k);else if(b instanceof Db)k=(new Db).addAll(br(a,b.ua(),!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]=br(a,b[m],!1,d,e,f))}c&&f.forEach(function(a){delete a.__gohashid});return k}t=W.prototype;
t.Ok=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.br=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 cr(a){return',\n  "modelData": '+dr(a,a.modelData)}
function er(a,b){b=b.modelData;Fa(b)&&(a.Sm(b),a.modelData=b)}t.Zw=function(){var a=this.modelData,b=!1,c;for(c in a)if(!fr(c,a[c])){b=!0;break}a="";b&&(a=cr(this));return a+',\n  "nodeDataArray": '+gr(this,this.nodeDataArray,!0)};t.sw=function(a){er(this,a);a=a.nodeDataArray;Ga(a)&&(this.Sm(a),this.nodeDataArray=a)};
function hr(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.K(b)===c)return!0;d.add(b,c);if(b.length!==c.length)return!1;for(var e=0;e<b.length;e++)if(!hr(a,b[e],c[e],d))return!1;return!0}if(Fa(b)&&Fa(c)){if(d.K(b)===c)return!0;d.add(b,c);for(var f in b){var g=b[f];if(!fr(f,g)){var h=c[f];if(void 0===h||!hr(a,g,h,d))return!1}}for(e in c)if(f=c[e],!fr(e,f)&&(g=b[e],void 0===g||!hr(a,g,f,d)))return!1;
return!0}return!1}function ir(a,b,c){a[c]!==b[c]&&v("Model.computeJsonDifference: Model."+c+' is not the same in both models: "'+a[c]+'" and "'+b[c]+'"')}
t.qr=function(a){ir(this,a,"nodeKeyProperty");var b=this.Mi;b.clear();var c=new I,d=this.Pi;d.clear();d.addAll(this.$a.iteratorKeys);for(var e=new Db,f=a.nodeDataArray,g=f.length,h=0;h<g;h++){var k=f[h],l=a.pa(k);if(void 0!==l){d.remove(l);var m=this.Qb(l);null===m?(b.add(l),c.add(k)):hr(this,m,k,e)||c.add(k)}else this.Zt(k),l=this.pa(k),b.add(l),c.add(k)}f="";hr(this,this.modelData,a.modelData,e)||(f+=cr(this));0<b.count&&(f+=this.uu+gr(this,b.ua(),!0));0<c.count&&(f+=this.lx+gr(this,c.ua(),!0));
0<d.count&&(f+=this.wu+gr(this,d.ua(),!0));d.clear();b.clear();return f};t.xz=function(a,b){x(a,W,W,"computeJsonDifference:newmodel");void 0===b&&(b=jr(this,this));return'{ "class": '+this.quote(b)+', "incremental": 1'+this.Ok()+this.qr(a)+"}"};
function $q(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 I,c.add(b),d.add(a,c)):c.add(b)}}var d=a.bi;null===d&&(d=new Db,b.changes.each(function(a){if(null!==a.diagram){var b=a.change;if(b===He)(a=a.object.panel)&&(b=a.data)&&c(b,a);else if(b===Je||b===Ke)a=a.object,(b=a.itemArray)&&c(b,a)}}),a.bi=d)}function ar(a,b){for(var c=new I,d=0;d<a.nodeDataArray.length;d++){var e=a.nodeDataArray[d];kr(a,b,e,e,c)}return c}
function kr(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(kr(a,b,g,d,e))return!0}else if(Fa(c)&&Object.getPrototypeOf(c)===Object.prototype)for(f in c){g=c[f];if(g===b)return e.add(d),!0;if(kr(a,b,g,d,e))return!0}return!1}
t.Xw=function(a,b){var c=this,d=!1,e=new I,f=new I,g=new I,h=this.bi;a.changes.each(function(a){a.model===c&&("nodeDataArray"===a.modelChange?a.change===Je?e.add(a.newValue):a.change===Ke&&g.add(a.oldValue):c.Za(a.object)?f.add(a.object):a.change!==He||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 W||c.pj()&&c.Bc(a.object)||ar(c,a.object).each(function(a){f.add(a)})):d=!0)});var k=
this.Mi;k.clear();e.each(function(a){k.add(c.pa(a));b||f.add(a)});var l=this.Pi;l.clear();g.each(function(a){l.add(c.pa(a));b&&f.add(a)});a="";d&&(a+=cr(this));0<k.count&&(a+=(b?this.wu:this.uu)+gr(this,k.ua(),!0));0<f.count&&(a+=this.lx+gr(this,f.ua(),!0));0<l.count&&(a+=(b?this.uu:this.wu)+gr(this,l.ua(),!0));l.clear();k.clear();return a};
t.ar=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)&&
v("applyIncrementalJson cannot change Model properties");er(this,a);var b=a.insertedNodeKeys,c=a.modifiedNodeData,d=new Db;if(Array.isArray(c))for(var e=0;e<c.length;e++){var f=c[e],g=this.pa(f);void 0!==g&&null!==g&&d.set(g,f)}if(Array.isArray(b))for(e=b.length,f=0;f<e;f++){g=b[f];var h=this.Qb(g);null===h&&(h=(h=d.get(g))?h:this.copyNodeData({}),this.Zm(h,g),this.Bf(h))}if(Array.isArray(c))for(b=c.length,d=0;d<b;d++)if(e=c[d],f=this.pa(e),f=this.Qb(f),null!==f){for(var k in e)"__gohashid"===k||
k===this.nodeKeyProperty||this.yk()&&k===this.nodeIsGroupProperty||this.setDataProperty(f,k,e[k]);this.$m(e,f)}a=a.removedNodeKeys;if(Array.isArray(a))for(c=a.length,k=0;k<c;k++)b=this.Qb(a[k]),null!==b&&this.Rm(b)};
t.Uy=function(a,b){x(a,Ge,W,"toIncrementalJson:e");a.change!==Ie&&v("Model.toIncrementalJson argument is not a Transaction ChangedEvent:"+a.toString());var c=a.object;if(!(a.isTransactionFinished&&c instanceof Le))return'{ "incremental": 0 }';void 0===b&&(b=jr(this,this));$q(this,c);a=this.Xw(c,"FinishedUndo"===a.propertyName);this.bi=null;return"2"===b?'{ "incremental": 2'+a+"}":'{ "class": '+this.quote(b)+', "incremental": 1'+this.Ok()+a+"}"};t.bB=function(a,b){return this.Uy(a,b)};
t.kr=function(a){void 0===a&&(a=jr(this,this));return'{ "class": '+this.quote(a)+this.Ok()+this.Zw()+"}"};t.toJSON=function(a){return this.kr(a)};t.Yx=function(a){var b=null;if("string"===typeof a)try{b=qa.JSON.parse(a)}catch(d){F&&Ca("JSON.parse error: "+d.toString())}else"object"===typeof a?b=a:v("Unable to modify a Model from: "+a);var c=b.incremental;"number"!==typeof c&&v("Unable to apply non-incremental changes to Model: "+a);0!==c&&(this.Ba("applyIncrementalJson"),this.ar(b),this.ab("applyIncrementalJson"))};
t.pz=function(a){return this.Yx(a)};W.constructGraphLinksModel=function(){F&&v("Unable to construct a Model. Provided JSON requires GraphLinksModel, which is not loaded.");return new W};t=W.prototype;
t.Sm=function(a){if(Ga(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];if(Fa(d)){var e=c;d=this.Sm(d);Array.isArray(a)?a[e]=d:v("Cannot replace an object in an HTMLCollection or NodeList at "+e)}}else if(Fa(a)){for(c in a)if(e=a[c],Fa(e)&&(e=this.Sm(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 H;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(lr(a.x),lr(a.y));else if("Size"===e)c=new Hb(lr(a.width),lr(a.height));else if("Rect"===e)c=new L(lr(a.x),lr(a.y),lr(a.width),lr(a.height));else if("Margin"===e)c=new lc(lr(a.top),lr(a.right),lr(a.bottom),lr(a.left));else if("Spot"===e)"string"===typeof a["enum"]?c=zd(a["enum"]):c=new M(lr(a.x),lr(a.y),lr(a.offsetX),lr(a.offsetY));else if("Brush"===e){if(c=new Jl,c.type=gb(Jl,
a.type),"string"===typeof a.color&&(c.color=a.color),a.start instanceof M&&(c.start=a.start),a.end instanceof M&&(c.end=a.end),"number"===typeof a.startRadius&&(c.startRadius=lr(a.startRadius)),"number"===typeof a.endRadius&&(c.endRadius=lr(a.endRadius)),a=a.colorStops,Fa(a))for(b in a)c.addColorStop(parseFloat(b),a[b])}else"Geometry"===e?(b=null,"string"===typeof a.path?b=Vd(a.path):b=new Fd,b.type=gb(Fd,a.type),"number"===typeof a.startX&&(b.startX=lr(a.startX)),"number"===typeof a.startY&&(b.startY=
lr(a.startY)),"number"===typeof a.endX&&(b.endX=lr(a.endX)),"number"===typeof a.endY&&(b.endY=lr(a.endY)),a.spot1 instanceof M&&(b.spot1=a.spot1),a.spot2 instanceof M&&(b.spot2=a.spot2),c=b):"EnumValue"===e&&(b=a.classType,0===b.indexOf("go.")&&(b=b.substr(3)),b=mr(b),"function"===typeof b&&(c=gb(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.cn=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.cn(a.valueOf()):Ga(a)?gr(this,a):Fa(a)?dr(this,a):"function"===typeof a?"null":a.toString()};
function gr(a,b,c){void 0===c&&(c=!1);var d=b.length;if(0>=d)return"[]";var e=new ib;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.cn(g)))}c&&1<d&&e.add("\n");e.add(" ]");return e.toString()}function fr(a,b){return void 0===b||"__gohashid"===a||"_"===a[0]||"function"===typeof b?!0:!1}function nr(a){return isNaN(a)?"NaN":Infinity===a?"9e9999":-Infinity===a?"-9e9999":a}
function dr(a,b){var c=b;if(c instanceof J)b={"class":"go.Point",x:nr(c.x),y:nr(c.y)};else if(c instanceof Hb)b={"class":"go.Size",width:nr(c.width),height:nr(c.height)};else if(c instanceof L)b={"class":"go.Rect",x:nr(c.x),y:nr(c.y),width:nr(c.width),height:nr(c.height)};else if(c instanceof lc)b={"class":"go.Margin",top:nr(c.top),right:nr(c.right),bottom:nr(c.bottom),left:nr(c.left)};else if(c instanceof M)c.bb()?b={"class":"go.Spot",x:nr(c.x),y:nr(c.y),offsetX:nr(c.offsetX),offsetY:nr(c.offsetY)}:
b={"class":"go.Spot","enum":c.toString()};else if(c instanceof Jl){b={"class":"go.Brush",type:c.type.name};if(c.type===Ml)b.color=c.color;else if(c.type===Pl||c.type===Kl)b.start=c.start,b.end=c.end,c.type===Kl&&(0!==c.startRadius&&(b.startRadius=nr(c.startRadius)),isNaN(c.endRadius)||(b.endRadius=nr(c.endRadius)));if(null!==c.colorStops){var d={};for(c=c.colorStops.iterator;c.next();)d[c.key]=c.value;b.colorStops=d}}else if(c instanceof Fd)b={"class":"go.Geometry",type:c.type.name},0!==c.startX&&
(b.startX=nr(c.startX)),0!==c.startY&&(b.startY=nr(c.startY)),0!==c.endX&&(b.endX=nr(c.endX)),0!==c.endY&&(b.endY=nr(c.endY)),c.spot1.A(Hc)||(b.spot1=c.spot1),c.spot2.A(Sc)||(b.spot2=c.spot2),c.type===Gd&&(b.path=Ld(c));else if(c instanceof E)b={"class":"go.EnumValue",classType:jr(a,c.classType),name:c.name};else if(F&&null!==mr(jr(a,c)))return Ca("ERROR: trying to convert a GraphObject or Diagram or Model or Tool or Layout or UndoManager or other unknown data into JSON text: "+c.toString()),"{}";
d="{";c=!0;for(var e in b){var f=In(b,e);if(!fr(e,f))if(c?c=!1:d+=", ",d+='"'+e+'":',"points"===e&&f instanceof H){var g="[";for(f=f.iterator;f.next();){var h=f.value;1<g.length&&(g+=",");g+=a.cn(h.x);g+=",";g+=a.cn(h.y)}g+="]";d+=g}else d+=a.cn(f)}return d+"}"}function lr(a){return"number"===typeof a?a:"NaN"===a?NaN:"9e9999"===a?Infinity:"-9e9999"===a?-Infinity:parseFloat(a)}t.Lh=function(a){A(a,"function",W,"addChangedListener:listener");this.dv.add(a)};
t.Kk=function(a){A(a,"function",W,"removeChangedListener:listener");this.dv.remove(a)};t.Bt=function(a){this.skipsUndoManager||this.undoManager.cw(a);for(var b=this.dv,c=b.length,d=0;d<c;d++)b.O(d)(a)};t.gb=function(a,b,c,d,e,f,g){or(this,"",a,b,c,d,e,f,g)};t.g=function(a,b,c,d,e){or(this,"",He,a,this,b,c,d,e)};t.eu=function(a,b,c,d,e,f){or(this,"",He,b,a,c,d,e,f)};
function or(a,b,c,d,e,f,g,h,k){void 0===h&&(h=null);void 0===k&&(k=null);var l=new Ge;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.Bt(l)}
W.prototype.changeState=function(a,b){if(null!==a&&a.model===this)if(a.change===He){var c=a.object,d=a.propertyName,e=a.K(b);d===this.nodeKeyProperty&&this.Za(c)&&(b=a.K(!b),void 0!==b&&this.$a.remove(b),void 0!==e&&this.$a.add(e,c));hk(c,d,e)}else a.change===Je?(c=a.newParam,"nodeDataArray"===a.modelChange?(a=a.newValue,Fa(a)&&"number"===typeof c&&(d=this.pa(a),b?(this.vc[c]===a&&Ka(this.vc,c),void 0!==d&&this.$a.remove(d)):(this.vc[c]!==a&&Ja(this.vc,c,a),void 0!==d&&this.$a.add(d,a)))):""===a.modelChange?
((d=a.object)&&!Ga(d)&&a.propertyName&&(d=In(a.object,a.propertyName)),Ga(d)&&"number"===typeof c&&(a=a.newValue,b?Ka(d,c):Ja(d,c,a))):v("unknown ChangedEvent.Insert modelChange: "+a.toString())):a.change===Ke?(c=a.oldParam,"nodeDataArray"===a.modelChange?(a=a.oldValue,Fa(a)&&"number"===typeof c&&(d=this.pa(a),b?(this.vc[c]!==a&&Ja(this.vc,c,a),void 0!==d&&this.$a.add(d,a)):(this.vc[c]===a&&Ka(this.vc,c),void 0!==d&&this.$a.remove(d)))):""===a.modelChange?((d=a.object)&&!Ga(d)&&a.propertyName&&(d=
In(a.object,a.propertyName)),Ga(d)&&"number"===typeof c&&(a=a.oldValue,b?Ja(d,c,a):Ka(d,c))):v("unknown ChangedEvent.Remove modelChange: "+a.toString())):a.change!==Ie&&v("unknown ChangedEvent: "+a.toString())};W.prototype.Ba=function(a){return this.undoManager.Ba(a)};W.prototype.ab=function(a){return this.undoManager.ab(a)};W.prototype.Nf=function(){return this.undoManager.Nf()};
W.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.Ba(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.ab(b):this.undoManager.Nf(),this.skipsUndoManager=c}};t=W.prototype;t.Ga=function(a,b){void 0===b&&(b="");or(this,"SourceChanged",Ie,b,a,null,null)};function pr(a,b,c){"string"!==typeof a&&"function"!==typeof a&&xa(a,"string or function",b,c)}
t.pa=function(a){if(null!==a){var b=this.Oi;if(""!==b&&(b=In(a,b),void 0!==b)){if(Qq(b))return b;v("Key value for node data "+a+" is not a number or a string: "+b)}}};
t.Zm=function(a,b){void 0!==b&&null!==b&&Qq(b)||xa(b,"number or string",W,"setKeyForNodeData:key");if(null!==a){var c=this.Oi;if(""!==c)if(this.Za(a)){var d=In(a,c);d!==b&&null===this.Qb(b)&&(hk(a,c,b),void 0!==d&&this.$a.remove(d),this.$a.add(b,a),or(this,"nodeKey",He,c,a,d,b),"string"===typeof c&&this.Ga(a,c),this.er(d,b))}else hk(a,c,b)}};function Qq(a){return"number"===typeof a||"string"===typeof a}t.Za=function(a){var b=this.pa(a);return void 0===b?!1:this.$a.K(b)===a};
t.Qb=function(a){null===a&&v("Model.findNodeDataForKey:key must not be null");return void 0!==a&&Qq(a)?this.$a.K(a):null};
t.Zt=function(a){if(null!==a){var b=this.Oi;if(""!==b){var c=this.pa(a);if(void 0===c||this.$a.contains(c)){var d=this.Ll;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.$a.contains(c))){hk(a,b,c);return}if("string"===typeof c){for(d=2;this.$a.contains(c+d);)d++;hk(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.$a.count-1;this.$a.contains(c);)c--;hk(a,b,c)}else F&&v("Model.getKeyForNodeData returned something other than a string or a number: "+c)}}}};
t.Bf=function(a){null!==a&&(ub(a),this.Za(a)||Iq(this,a,!0))};function Iq(a,b,c){var d=a.pa(b);if(void 0===d||a.$a.K(d)!==b)a.Zt(b),d=a.pa(b),void 0===d?v("Model.makeNodeDataKeyUnique failed on "+b+".  Data not added to Model."):(a.$a.add(d,b),d=null,c&&(d=a.vc.length,Ja(a.vc,d,b)),or(a,"nodeDataArray",Je,"nodeDataArray",a,null,b,null,d),a.Um(b),a.Tm(b))}t.lz=function(a){if(Ga(a))for(var b=a.length,c=0;c<b;c++)this.Bf(a[c]);else for(a=a.iterator;a.next();)this.Bf(a.value)};
t.Rm=function(a){null!==a&&Hq(this,a,!0)};function Hq(a,b,c){var d=a.pa(b);void 0!==d&&a.$a.remove(d);d=null;if(c){a:if(c=a.vc,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;Ka(a.vc,d)}or(a,"nodeDataArray",Ke,"nodeDataArray",a,b,null,d,null);a.mr(b)}t.RA=function(a){if(Ga(a))for(var b=a.length,c=0;c<b;c++)this.Rm(a[c]);else for(a=a.iterator;a.next();)this.Rm(a.value)};
t.HA=function(a){if(a!==this.nodeDataArray&&Ga(a)){var b=this.Pi;b.clear();b.addAll(this.$a.iteratorKeys);var c=this.Mi;c.clear();for(var d=a.length,e=0;e<d;e++){var f=a[e],g=this.pa(f);if(void 0!==g){c.add(g);var h=this.Qb(g);h!==f&&(null!==h?(this.yq(h,f),this.$m(f,h)):(f=this.cloneDeep(f),this.Zm(f,g),this.Bf(f)))}else g=this.cloneDeep(f),this.Bf(g),c.add(this.pa(g))}for(a=b.iterator;a.next();)d=a.value,c.contains(d)||(d=this.Qb(d))&&this.Rm(d);this.Bq();b.clear();c.clear()}};
t.er=function(a,b){void 0!==b&&(a=Tq(this,a),a instanceof I&&this.$f.add(b,a))};t.Tw=function(){};t.Um=function(){};t.Tm=function(){};t.mr=function(){};function Vq(a,b,c){if(void 0!==b){var d=a.$f.K(b);null===d&&(d=new I,a.$f.add(b,d));d.add(c)}}function Uq(a,b,c){if(void 0!==b){var d=a.$f.K(b);d instanceof I&&(void 0===c||null===c?a.$f.remove(b):(d.remove(c),0===d.count&&a.$f.remove(b)))}}function Tq(a,b){if(void 0===b)return null;a=a.$f.K(b);return a instanceof I?a:null}
t.Bq=function(a){void 0===a?this.$f.clear():this.$f.remove(a)};W.prototype.copyNodeData=function(a){if(null===a)return null;var b=this.cl;a=null!==b?b(a,this):qr(this,a,!0);Fa(a)&&fb(a);return a};
function qr(a,b,c){if(a.copiesArrays&&Array.isArray(b)){var d=[];for(c=0;c<b.length;c++){var e=qr(a,b[c],a.copiesArrayObjects);d.push(e)}fb(d);return d}if(c&&Fa(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=In(b,d);var g=jr(a,f);"GraphObject"===g||"Diagram"===g||"Layer"===g||"RowColumnDefinition"===g||"AnimationManager"===g||"Tool"===g||"CommandHandler"===
g||"Layout"===g||"InputEvent"===g||"DiagramEvent"===g?(F&&"_"!==d[0]&&Ca('Warning: found GraphObject or Diagram reference when copying model data on property "'+d+'" of data object: '+b.toString()+"  \nModel data should not have any references to a Diagram or any part of a diagram, such as: "+f.toString()),g=!0):g=f instanceof W||f instanceof Me||f instanceof Le||f instanceof Ge?!0:!1;g?hk(c,d,f):(f=qr(a,f,!1),hk(c,d,f))}fb(c);return c}return b instanceof J?b.copy():b instanceof Hb?b.copy():b instanceof
L?b.copy():b instanceof M?b.copy():b instanceof lc?b.copy():b}
W.prototype.setDataProperty=function(a,b,c){F&&(A(a,"object",W,"setDataProperty:data"),A(b,"string",W,"setDataProperty:propname"),""===b&&v("Model.setDataProperty: property name must not be an empty string when setting "+a+" to "+c));if(this.Za(a)){if(b===this.nodeKeyProperty){this.Zm(a,c);return}if(b===this.nodeCategoryProperty){this.Ym(a,c);return}}else!rr&&a instanceof N&&(rr=!0,Ca('Model.setDataProperty is modifying a GraphObject, "'+a.toString()+'"'),Ca("  Is that really your intent?"));var d=
In(a,b);d!==c&&(hk(a,b,c),this.eu(a,b,d,c))};t=W.prototype;t.set=function(a,b,c){this.setDataProperty(a,b,c)};t.yq=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.hz=function(a,b){this.Qt(a,-1,b)};
t.Qt=function(a,b,c){F&&(Ha(a,W,"insertArrayItem:arr"),C(b,W,"insertArrayItem:idx"),a===this.vc&&v("Model.insertArrayItem or Model.addArrayItem should not be called on the Model.nodeDataArray"));0>b&&(b=a.length);Ja(a,b,c);or(this,"",Je,"",a,null,c,null,b)};
t.uw=function(a,b){void 0===b&&(b=-1);F&&(Ha(a,W,"removeArrayItem:arr"),C(b,W,"removeArrayItem:idx"));a===this.vc&&v("Model.removeArrayItem should not be called on the Model.nodeDataArray");-1===b&&(b=a.length-1);var c=a[b];Ka(a,b);or(this,"",Ke,"",a,c,null,b,null)};t.Jq=function(a){if(null===a)return"";var b=this.Vj;if(""===b)return"";b=In(a,b);if(void 0===b)return"";if("string"===typeof b)return b;v("getCategoryForNodeData found a non-string category for "+a+": "+b);return""};
t.Ym=function(a,b){A(b,"string",W,"setCategoryForNodeData:cat");if(null!==a){var c=this.Vj;if(""!==c)if(this.Za(a)){var d=In(a,c);void 0===d&&(d="");d!==b&&(hk(a,c,b),or(this,"nodeCategory",He,c,a,d,b))}else hk(a,c,b)}};t.$m=function(a,b){this.Ym(b,this.Jq(a))};t.Gm=function(){return!1};t.yk=function(){return!1};t.pj=function(){return!1};t.Wt=function(){return!1};t.oj=function(){return!1};function Li(){return new W}
function jr(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 jr(a,b.constructor);return typeof b}function mr(a){return sr[a]?sr[a]:void 0!==qa.go&&qa.go[a]?qa.go[a]:null}function In(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){F&&Ca("property get error: "+d.toString())}return c}
function hk(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){F&&Ca("property set error: "+d.toString())}}
ma.Object.defineProperties(W.prototype,{name:{configurable:!0,get:function(){return this.Wa},set:function(a){var b=this.Wa;b!==a&&(A(a,"string",W,"name"),this.Wa=a,this.g("name",b,a))}},dataFormat:{configurable:!0,get:function(){return this.Mn},set:function(a){var b=this.Mn;b!==a&&(A(a,"string",W,"dataFormat"),this.Mn=a,this.g("dataFormat",b,a))}},isReadOnly:{configurable:!0,get:function(){return this.hg},set:function(a){var b=this.hg;b!==a&&(A(a,"boolean",
W,"isReadOnly"),this.hg=a,this.g("isReadOnly",b,a))}},modelData:{configurable:!0,get:function(){return this.l},set:function(a){var b=this.l;b!==a&&(A(a,"object",W,"modelData"),this.l=a,this.g("modelData",b,a),this.Ga(a))}},undoManager:{configurable:!0,get:function(){return this.w},set:function(a){var b=this.w;b!==a&&(x(a,Me,W,"undoManager"),null!==b&&b.My(this),this.w=a,null!==a&&a.Wx(this))}},skipsUndoManager:{configurable:!0,get:function(){return this.Bg},
set:function(a){A(a,"boolean",W,"skipsUndoManager");this.Bg=a}},nodeKeyProperty:{configurable:!0,get:function(){return this.Oi},set:function(a){var b=this.Oi;b!==a&&(pr(a,W,"nodeKeyProperty"),""===a&&v("Model.nodeKeyProperty may not be the empty string"),0<this.$a.count&&v("Cannot set Model.nodeKeyProperty when there is existing node data"),this.Oi=a,this.g("nodeKeyProperty",b,a))}},makeUniqueKeyFunction:{configurable:!0,get:function(){return this.Ll},set:function(a){var b=
this.Ll;b!==a&&(null!==a&&A(a,"function",W,"makeUniqueKeyFunction"),this.Ll=a,this.g("makeUniqueKeyFunction",b,a))}},nodeDataArray:{configurable:!0,get:function(){return this.vc},set:function(a){var b=this.vc;if(b!==a){Ha(a,W,"nodeDataArray");this.$a.clear();this.Tw();for(var c=a.length,d=0;d<c;d++){var e=a[d];if(!Fa(e)){v("Model.nodeDataArray must only contain Objects, not: "+e);return}ub(e)}this.vc=a;d=new H;for(e=0;e<c;e++){var f=a[e],g=this.pa(f);void 0===g?d.add(f):null!==this.$a.K(g)?
d.add(f):this.$a.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.Zt(e),f=this.pa(e),void 0!==f&&this.$a.add(f,e);or(this,"nodeDataArray",He,"nodeDataArray",this,b,a);for(b=0;b<c;b++)d=a[b],this.Um(d),this.Tm(d);this.Bq();Array.isArray(a)||(this.isReadOnly=!0)}}},copyNodeDataFunction:{configurable:!0,get:function(){return this.cl},set:function(a){var b=this.cl;b!==a&&(null!==a&&A(a,"function",W,"copyNodeDataFunction"),this.cl=a,this.g("copyNodeDataFunction",b,a))}},copiesArrays:{configurable:!0,
enumerable:!0,get:function(){return this.En},set:function(a){var b=this.En;b!==a&&(null!==a&&A(a,"boolean",W,"copiesArrays"),this.En=a,this.g("copiesArrays",b,a))}},copiesArrayObjects:{configurable:!0,get:function(){return this.Dn},set:function(a){var b=this.Dn;b!==a&&(null!==a&&A(a,"boolean",W,"copiesArrayObjects"),this.Dn=a,this.g("copiesArrayObjects",b,a))}},copiesKey:{configurable:!0,get:function(){return this.Gn},set:function(a){var b=this.Gn;b!==a&&(null!==a&&A(a,
"boolean",W,"copiesKey"),this.Gn=a,this.g("copiesKey",b,a))}},afterCopyFunction:{configurable:!0,get:function(){return this.ln},set:function(a){var b=this.ln;b!==a&&(null!==a&&A(a,"function",W,"afterCopyFunction"),this.ln=a,this.g("afterCopyFunction",b,a))}},nodeCategoryProperty:{configurable:!0,get:function(){return this.Vj},set:function(a){var b=this.Vj;b!==a&&(pr(a,W,"nodeCategoryProperty"),this.Vj=a,this.g("nodeCategoryProperty",b,a))}},type:{configurable:!0,
get:function(){return"Model"}}});W.prototype.setCategoryForNodeData=W.prototype.Ym;W.prototype.getCategoryForNodeData=W.prototype.Jq;W.prototype.removeArrayItem=W.prototype.uw;W.prototype.insertArrayItem=W.prototype.Qt;W.prototype.addArrayItem=W.prototype.hz;W.prototype.assignAllDataProperties=W.prototype.yq;W.prototype.set=W.prototype.set;W.prototype.clearUnresolvedReferences=W.prototype.Bq;W.prototype.mergeNodeDataArray=W.prototype.HA;W.prototype.removeNodeDataCollection=W.prototype.RA;
W.prototype.removeNodeData=W.prototype.Rm;W.prototype.addNodeDataCollection=W.prototype.lz;W.prototype.addNodeData=W.prototype.Bf;W.prototype.makeNodeDataKeyUnique=W.prototype.Zt;W.prototype.findNodeDataForKey=W.prototype.Qb;W.prototype.containsNodeData=W.prototype.Za;W.prototype.setKeyForNodeData=W.prototype.Zm;W.prototype.getKeyForNodeData=W.prototype.pa;W.prototype.updateTargetBindings=W.prototype.Ga;W.prototype.commit=W.prototype.commit;W.prototype.rollbackTransaction=W.prototype.Nf;
W.prototype.commitTransaction=W.prototype.ab;W.prototype.startTransaction=W.prototype.Ba;W.prototype.raiseDataChanged=W.prototype.eu;W.prototype.raiseChanged=W.prototype.g;W.prototype.raiseChangedEvent=W.prototype.gb;W.prototype.removeChangedListener=W.prototype.Kk;W.prototype.addChangedListener=W.prototype.Lh;W.prototype.writeJsonValue=W.prototype.cn;W.prototype.replaceJsonObjects=W.prototype.Sm;W.prototype.applyIncrementalJSON=W.prototype.pz;W.prototype.applyIncrementalJson=W.prototype.Yx;
W.prototype.toJSON=W.prototype.toJSON;W.prototype.toJson=W.prototype.kr;W.prototype.toIncrementalJSON=W.prototype.bB;W.prototype.toIncrementalJson=W.prototype.Uy;W.prototype.computeJsonDifference=W.prototype.xz;W.prototype.toIncrementalData=W.prototype.aB;W.prototype.clear=W.prototype.clear;var rr=!1,sr={};W.className="Model";
W.fromJSON=W.fromJson=function(a,b){void 0===b&&(b=null);null!==b&&x(b,W,W,"fromJson:model");var c=null;if("string"===typeof a)try{c=qa.JSON.parse(a)}catch(f){F&&Ca("JSON.parse error: "+f.toString())}else"object"===typeof a?c=a:v("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=mr(d)):(e=mr(d),null===e&&(e=qa[d]));"function"===typeof e&&(a=new e)}catch(f){}null===a||a instanceof W?b=a:v("Unable to construct a Model of declared class: "+
c["class"])}null===b&&(b=W.constructGraphLinksModel());b.br(c);b.sw(c);return b};W.safePropertyValue=In;W.safePropertySet=hk;sr.Brush=Jl;sr.ChangedEvent=Ge;sr.Geometry=Fd;sr.Margin=lc;sr.Panel=U;sr.Point=J;sr.Rect=L;sr.Size=Hb;sr.Spot=M;sr.Transaction=Le;sr.UndoManager=Me;
function $i(a,b,c){fb(this);this.s=!1;void 0===a?a="":A(a,"string",$i,"constructor:targetprop");void 0===b?b=a:A(b,"string",$i,"constructor:sourceprop");void 0===c?c=null:null!==c&&A(c,"function",$i,"constructor:conv");this.l=-1;this.jd=null;this.lm=a;this.km=this.kq=0;this.lt=null;this.zo=!1;this.dm=b;this.Cn=c;this.Yo=tr;this.wn=null;this.Pu=new I}
$i.prototype.copy=function(){var a=new $i;a.lm=this.lm;a.kq=this.kq;a.km=this.km;a.lt=this.lt;a.zo=this.zo;a.dm=this.dm;a.Cn=this.Cn;a.Yo=this.Yo;a.wn=this.wn;return a};t=$i.prototype;t.mb=function(a){a.classType===$i?this.mode=a:Ba(this,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.ka=function(){this.s=!1;return this};
t.Fy=function(a){void 0===a&&(a=null);null!==a&&A(a,"function",$i,"makeTwoWay");this.mode=An;this.backConverter=a;return this};t.Yq=function(a){void 0===a&&(a="");F&&A(a,"string",$i,"ofObject:srcname");this.sourceName=a;this.isToModel=!1;return this};t.JA=function(){this.sourceName=null;this.isToModel=!0;return this};function wl(a,b,c){a=a.sourceName;return null===a||""===a?b:"/"===a?c.part:"."===a?c:".."===a?c.panel:b.fb(a)}
t.Uw=function(a,b,c){var d=this.dm;if(void 0===c||""===d||d===c){c=this.lm;var e=this.Cn;if(null===e&&""===c)Ca("Binding error: target property is the empty string: "+this.toString());else{F&&"string"===typeof c&&("function"!==typeof a.setAttribute&&0<c.length&&"_"!==c[0]&&!Ra(a,c)?Ca("Binding error: undefined target property: "+c+" on "+a.toString()):"name"===c&&a instanceof N&&Ca("Binding error: cannot modify GraphObject.name on "+a.toString()));var f=b;""!==d&&(f=In(b,d));if(void 0!==f)if(null===
e)""!==c&&hk(a,c,f);else try{if(""!==c){var g=e(f,a);F&&void 0===g&&Ca('Binding warning: conversion function returned undefined when setting target property "'+c+'" on '+a.toString()+", function is: "+e);hk(a,c,g)}else e(f,a)}catch(h){F&&Ca("Binding error: "+h.toString()+' setting target property "'+c+'" on '+a.toString()+" with conversion function: "+e)}}}};
t.pr=function(a,b,c,d){if(this.Yo===An){var e=this.lm;if(void 0===c||e===c){c=this.dm;var f=this.wn,g=a;""!==e&&(g=In(a,e));if(void 0!==g&&!this.Pu.contains(a))try{this.Pu.add(a);var h=null!==d?d.diagram:null,k=null!==h?h.model:null;if(null===f)if(""!==c)null!==k?(F&&k.nodeKeyProperty===c&&k.Za(b)&&Ca("Binding error: cannot have TwoWay Binding on node data key property: "+this.toString()),k.setDataProperty(b,c,g)):hk(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.uw(m,l);k.Qt(m,l,g)}}else try{if(""!==c){var n=f(g,b,k);null!==k?(F&&(k.nodeKeyProperty===c&&k.Za(b)&&Ca("Binding error: cannot have TwoWay Binding on node data key property: "+this.toString()),void 0===n&&Ca('Binding warning: conversion function returned undefined when setting source property "'+c+'" on '+b.toString()+", function is: "+f)),k.setDataProperty(b,c,n)):hk(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.uw(q,r);k.Qt(q,r,p)}}}catch(u){F&&Ca("Binding error: "+u.toString()+' setting source property "'+c+'" on '+b.toString()+" with conversion function: "+f)}}finally{this.Pu.remove(a)}}}};
ma.Object.defineProperties($i.prototype,{vj:{configurable:!0,get:function(){return this.l},set:function(a){this.s&&va(this);A(a,"number",$i,"targetId");this.l=a}},targetProperty:{configurable:!0,get:function(){return this.lm},set:function(a){this.s&&va(this);A(a,"string",$i,"targetProperty");this.lm=a}},sourceName:{configurable:!0,get:function(){return this.lt},set:function(a){this.s&&va(this);null!==a&&A(a,"string",$i,"sourceName");this.lt=a;null!==a&&(this.zo=
!1)}},isToModel:{configurable:!0,get:function(){return this.zo},set:function(a){this.s&&va(this);A(a,"boolean",$i,"isToModel");this.zo=a}},sourceProperty:{configurable:!0,get:function(){return this.dm},set:function(a){this.s&&va(this);A(a,"string",$i,"sourceProperty");this.dm=a}},converter:{configurable:!0,get:function(){return this.Cn},set:function(a){this.s&&va(this);null!==a&&A(a,"function",$i,"converter");this.Cn=a}},backConverter:{configurable:!0,
get:function(){return this.wn},set:function(a){this.s&&va(this);null!==a&&A(a,"function",$i,"backConverter");this.wn=a}},mode:{configurable:!0,get:function(){return this.Yo},set:function(a){this.s&&va(this);hb(a,$i,$i,"mode");this.Yo=a}}});$i.prototype.updateSource=$i.prototype.pr;$i.prototype.updateTarget=$i.prototype.Uw;$i.prototype.ofModel=$i.prototype.JA;$i.prototype.ofObject=$i.prototype.Yq;$i.prototype.makeTwoWay=$i.prototype.Fy;
var tr=new E($i,"OneWay",1),An=new E($i,"TwoWay",2);$i.className="Binding";$i.parseEnum=function(a,b){A(a,"function",$i,"parseEnum:ctor");hb(b,a,$i,"parseEnum:defval");return function(c){c=gb(a,c);return null===c?b:c}};$i.toString=Qa;$i.OneWay=tr;$i.TwoWay=An;
function ur(a,b){W.call(this);this.tu=',\n  "insertedLinkKeys": ';this.kx=',\n  "modifiedLinkData": ';this.vu=',\n  "removedLinkKeys": ';F&&2<arguments.length&&v("GraphLinksModel constructor can only take two optional arguments, the Array of node data and the Array of link data.");this.Wc=[];this.ig=new I;this.kb=new Db;this.Ji="";this.xj=this.bl=this.Ml=null;this.gf="from";this.hf="to";this.Sj=this.Rj="";this.Qj="category";this.Ud="";this.Ql="isGroup";this.Fe="group";this.Fn=!1;void 0!==a&&(this.nodeDataArray=
a);void 0!==b&&(this.linkDataArray=b)}la(ur,W);ur.constructGraphLinksModel=W.constructGraphLinksModel;ur.prototype.cloneProtected=function(a){W.prototype.cloneProtected.call(this,a);a.Ji=this.Ji;a.Ml=this.Ml;a.bl=this.bl;a.gf=this.gf;a.hf=this.hf;a.Rj=this.Rj;a.Sj=this.Sj;a.Qj=this.Qj;a.Ud=this.Ud;a.Ql=this.Ql;a.Fe=this.Fe;a.Fn=this.Fn};t=ur.prototype;t.clear=function(){W.prototype.clear.call(this);this.Wc=[];this.kb.clear();this.ig.clear()};
t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.kr();var b=(""!==this.name?this.name:"")+" GraphLinksModel";if(0<a){b+="\n node data:";a=this.nodeDataArray;var c=a.length,d;for(d=0;d<c;d++){var e=a[d];b+=" "+this.pa(e)+":"+Qa(e)}b+="\n link data:";a=this.linkDataArray;c=a.length;for(d=0;d<c;d++)e=a[d],b+=" "+Oq(this,e,!0)+"--\x3e"+Oq(this,e,!1)}return b};
t.Yw=function(a,b){""===this.linkKeyProperty&&v("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalData() to succeed.");var c=W.prototype.Yw.call(this,a,b),d=this,e=new I,f=new I,g=new I,h=this.bi;a.changes.each(function(a){a.model===d&&("linkDataArray"===a.modelChange?a.change===Je?e.add(a.newValue):a.change===Ke&&g.add(a.oldValue):d.Bc(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.Bc(a)&&f.add(a)}):
a.object instanceof W||d.Za(a.object)||vr(d,a.object).each(function(a){f.add(a)})))});var k=this.Mi;k.clear();e.each(function(a){k.add(d.ac(a));b||f.add(a)});var l=this.Pi;l.clear();g.each(function(a){l.add(d.ac(a));b&&f.add(a)});a=d.cloneDeep(f.ua());0<k.count&&(null===c&&(c={}),b?c.removedLinkKeys=k.ua():c.insertedLinkKeys=k.ua());0<a.length&&(null===c&&(c={}),c.modifiedLinkData=a);0<l.count&&(null===c&&(c={}),b?c.insertedLinkKeys=l.ua():c.removedLinkKeys=l.ua());l.clear();k.clear();return c};
t.Ok=function(){var a=W.prototype.Ok.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.br=function(a){W.prototype.br.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.Zw=function(){var a=W.prototype.Zw.call(this),b=',\n  "linkDataArray": '+gr(this,this.linkDataArray,!0);return a+b};t.sw=function(a){W.prototype.sw.call(this,a);a=a.linkDataArray;Array.isArray(a)&&(this.Sm(a),this.linkDataArray=a)};
t.qr=function(a){if(!(a instanceof ur))return v("Model.computeJsonDifference: newmodel must be a GraphLinksModel"),"";""===this.linkKeyProperty&&v("GraphLinksModel.linkKeyProperty must not be an empty string for .computeJsonDifference() to succeed.");var b=W.prototype.qr.call(this,a);ir(this,a,"linkKeyProperty");ir(this,a,"linkFromKeyProperty");ir(this,a,"linkToKeyProperty");ir(this,a,"linkLabelKeysProperty");ir(this,a,"nodeIsGroupProperty");ir(this,a,"nodeGroupKeyProperty");var c=this.Mi;c.clear();
var d=new I,e=this.Pi;e.clear();e.addAll(this.kb.iteratorKeys);for(var f=new Db,g=a.linkDataArray,h=g.length,k=0;k<h;k++){var l=g[k],m=a.ac(l);if(void 0!==m){e.remove(m);var n=this.Ig(m);null===n?(c.add(m),d.add(l)):hr(this,n,l,f)||d.add(l)}else this.Vq(l),m=this.ac(l),c.add(m),d.add(l)}a=b;0<c.count&&(a+=this.tu+gr(this,c.ua(),!0));0<d.count&&(a+=this.kx+gr(this,d.ua(),!0));0<e.count&&(a+=this.vu+gr(this,e.ua(),!0));e.clear();c.clear();return a};
function vr(a,b){for(var c=new I,d=0;d<a.linkDataArray.length;d++){var e=a.linkDataArray[d];kr(a,b,e,e,c)}return c}
t.Xw=function(a,b){""===this.linkKeyProperty&&v("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalJson() to succeed.");var c=W.prototype.Xw.call(this,a,b),d=this,e=new I,f=new I,g=new I,h=this.bi;a.changes.each(function(a){a.model===d&&("linkDataArray"===a.modelChange?a.change===Je?e.add(a.newValue):a.change===Ke&&g.add(a.oldValue):d.Bc(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.Bc(a)&&f.add(a)}):
a.object instanceof W||d.Za(a.object)||vr(d,a.object).each(function(a){f.add(a)})))});var k=this.Mi;k.clear();e.each(function(a){k.add(d.ac(a));b||f.add(a)});var l=this.Pi;l.clear();g.each(function(a){l.add(d.ac(a));b&&f.add(a)});a=c;0<k.count&&(a+=(b?this.vu:this.tu)+gr(this,k.ua(),!0));0<f.count&&(a+=this.kx+gr(this,f.ua(),!0));0<l.count&&(a+=(b?this.tu:this.vu)+gr(this,l.ua(),!0));l.clear();k.clear();return a};
t.ar=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)&&v("applyIncrementalJson cannot change Model properties");W.prototype.ar.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.Ig(e);null===f&&(f=this.Cq({}),this.ku(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.ac(e),f=this.Ig(f),null!==f){for(var g in e)"__gohashid"!==g&&g!==this.linkKeyProperty&&this.setDataProperty(f,g,e[g]);wr(this,e,f)}a=a.removedLinkKeys;if(Array.isArray(a))for(g=a.length,b=0;b<g;b++)c=this.Ig(a[b]),null!==c&&this.Qm(c)};
ur.prototype.changeState=function(a,b){if(null!==a&&a.model===this){if(a.change===He){var c=a.object,d=a.propertyName;if(d===this.linkKeyProperty&&this.Bc(c)){var e=a.K(b);b=a.K(!b);void 0!==b&&this.kb.remove(b);void 0!==e&&this.kb.add(e,c);hk(c,d,e);return}}else if(a.change===Je){c=a.newParam;if("linkDataArray"===a.modelChange){a=a.newValue;Fa(a)&&"number"===typeof c&&(d=this.ac(a),b?(this.ig.remove(a),this.Wc[c]===a&&this.Wc.splice(c,1),void 0!==d&&this.kb.remove(d)):(this.ig.add(a),this.Wc[c]!==
a&&this.Wc.splice(c,0,a),void 0!==d&&this.kb.add(d,a)));return}if("linkLabelKeys"===a.modelChange){d=this.Hf(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===Ke){c=a.oldParam;if("linkDataArray"===a.modelChange){a=a.oldValue;Fa(a)&&"number"===typeof c&&(d=this.ac(a),b?(this.ig.add(a),this.Wc[c]!==a&&this.Wc.splice(c,0,a),void 0!==d&&this.kb.add(d,a)):(this.ig.remove(a),this.Wc[c]===
a&&this.Wc.splice(c,1),void 0!==d&&this.kb.remove(d)));return}if("linkLabelKeys"===a.modelChange){d=this.Hf(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}}W.prototype.changeState.call(this,a,b)}};t=ur.prototype;t.Hm=function(a){if(void 0!==a){var b=this.xj;if(null!==b){var c=this.Qb(a);null===c&&(c=this.copyNodeData(b),hk(c,this.nodeKeyProperty,a),this.Bf(c))}return a}};
t.vy=function(a){return Oq(this,a,!0)};t.Dw=function(a,b){Wq(this,a,b,!0)};t.yy=function(a){return Oq(this,a,!1)};t.Iw=function(a,b){Wq(this,a,b,!1)};function Oq(a,b,c){if(null!==b&&(a=c?a.gf:a.hf,""!==a&&(a=In(b,a),void 0!==a))){if(Qq(a))return a;v((c?"FromKey":"ToKey")+" value for link data "+b+" is not a number or a string: "+a)}}
function Wq(a,b,c,d){null===c&&(c=void 0);void 0===c||Qq(c)||xa(c,"number or string",ur,d?"setFromKeyForLinkData:key":"setToKeyForLinkData:key");if(null!==b){var e=d?a.gf:a.hf;if(""!==e)if(c=a.Hm(c),a.Bc(b)){var f=In(b,e);f!==c&&(Uq(a,f,b),hk(b,e,c),null===a.Qb(c)&&Vq(a,c,b),or(a,d?"linkFromKey":"linkToKey",He,e,b,f,c),"string"===typeof e&&a.Ga(b,e))}else hk(b,e,c)}}t.wy=function(a){return Nq(this,a,!0)};t.Ew=function(a,b){Xq(this,a,b,!0)};t.zy=function(a){return Nq(this,a,!1)};
t.Jw=function(a,b){Xq(this,a,b,!1)};function Nq(a,b,c){if(null===b)return"";a=c?a.Rj:a.Sj;if(""===a)return"";b=In(b,a);return void 0===b?"":b}function Xq(a,b,c,d){A(c,"string",ur,d?"setFromPortIdForLinkData:portname":"setToPortIdForLinkData:portname");if(null!==b){var e=d?a.Rj:a.Sj;if(""!==e)if(a.Bc(b)){var f=In(b,e);void 0===f&&(f="");f!==c&&(hk(b,e,c),or(a,d?"linkFromPortId":"linkToPortId",He,e,b,f,c),"string"===typeof e&&a.Ga(b,e))}else hk(b,e,c)}}
t.Hf=function(a){if(null===a)return xr;var b=this.Ud;if(""===b)return xr;a=In(a,b);return void 0===a?xr:a};t.lu=function(a,b){Ha(b,ur,"setLabelKeysForLinkData:arr");if(null!==a){var c=this.Ud;if(""!==c)if(this.Bc(a)){var d=In(a,c);void 0===d&&(d=xr);if(d!==b){if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)Uq(this,d[f],a);hk(a,c,b);e=b.length;for(f=0;f<e;f++){var g=b[f];null===this.Qb(g)&&Vq(this,g,a)}or(this,"linkLabelKeys",He,c,a,d,b);"string"===typeof c&&this.Ga(a,c)}}else hk(a,c,b)}};
t.Ev=function(a,b){if(null!==b&&void 0!==b&&(Qq(b)||xa(b,"number or string",ur,"addLabelKeyForLinkData:key"),null!==a)){var c=this.Ud;if(""!==c){var d=In(a,c);if(void 0===d)c=[],c.push(b),this.lu(a,c);else if(Array.isArray(d)){var e=d.indexOf(b);0<=e||(e=d.length,d.push(b),this.Bc(a)&&(null===this.Qb(b)&&Vq(this,b,a),or(this,"linkLabelKeys",Je,c,a,null,b,null,e)))}else v(c+" property is not an Array; cannot addLabelKeyForLinkData: "+a)}}};
t.Ly=function(a,b){if(null!==b&&void 0!==b&&(Qq(b)||xa(b,"number or string",ur,"removeLabelKeyForLinkData:key"),null!==a)){var c=this.Ud;if(""!==c){var d=In(a,c);if(Array.isArray(d)){var e=d.indexOf(b);0>e||(d.splice(e,1),this.Bc(a)&&(Uq(this,b,a),or(this,"linkLabelKeys",Ke,c,a,b,null,e,null)))}else void 0!==d&&v(c+" property is not an Array; cannot removeLabelKeyforLinkData: "+a)}}};
t.ac=function(a){if(null!==a){var b=this.Ji;if(""!==b&&(b=In(a,b),void 0!==b)){if(Qq(b))return b;v("Key value for link data "+a+" is not a number or a string: "+b)}}};t.ku=function(a,b){void 0!==b&&null!==b&&Qq(b)||xa(b,"number or string",ur,"setKeyForLinkData:key");if(null!==a){var c=this.Ji;if(""!==c)if(this.Bc(a)){var d=In(a,c);d!==b&&null===this.Ig(b)&&(hk(a,c,b),void 0!==d&&this.kb.remove(d),this.kb.add(b,a),or(this,"linkKey",He,c,a,d,b),"string"===typeof c&&this.Ga(a,c))}else hk(a,c,b)}};
t.Ig=function(a){null===a&&v("GraphLinksModel.findLinkDataForKey:key must not be null");return void 0!==a&&Qq(a)?this.kb.K(a):null};
t.Vq=function(a){if(null!==a){var b=this.Ji;if(""!==b){var c=this.ac(a);if(void 0===c||this.kb.contains(c)){var d=this.Ml;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.kb.contains(c))){hk(a,b,c);return}if("string"===typeof c){for(d=2;this.kb.contains(c+d);)d++;hk(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.kb.count-1;this.kb.contains(c);)c--;hk(a,b,c)}else F&&v("GraphLinksModel.getKeyForLinkData returned something other than a string or a number: "+c)}}}};
t.Bc=function(a){return null===a?!1:this.ig.contains(a)};t.bj=function(a){null!==a&&(ub(a),this.Bc(a)||Sq(this,a,!0))};function Sq(a,b,c){if(""!==a.linkKeyProperty){var d=a.ac(b);if(void 0!==d&&a.kb.K(d)===b)return;a.Vq(b);d=a.ac(b);if(void 0===d){v("GraphLinksModel.makeLinkDataKeyUnique failed on "+b+". Data not added to model.");return}a.kb.add(d,b)}a.ig.add(b);d=null;c&&(d=a.Wc.length,a.Wc.splice(d,0,b));or(a,"linkDataArray",Je,"linkDataArray",a,null,b,null,d);yr(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.Qm=function(a){null!==a&&Rq(this,a,!0)};function Rq(a,b,c){a.ig.remove(b);var d=a.ac(b);void 0!==d&&a.kb.remove(d);d=null;if(c){d=a.Wc.indexOf(b);if(0>d)return;a.Wc.splice(d,1)}or(a,"linkDataArray",Ke,"linkDataArray",a,b,null,d,null);c=Oq(a,b,!0);Uq(a,c,b);c=Oq(a,b,!1);Uq(a,c,b);d=a.Hf(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],Uq(a,c,b)}
t.PA=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.Qm(a[c]);else for(a=a.iterator;a.next();)this.Qm(a.value)};
t.GA=function(a){""===this.linkKeyProperty&&v("GraphLinksModel.linkKeyProperty must not be an empty string for .mergeLinkDataArray() to succeed.");if(a!==this.linkDataArray&&Ga(a)){var b=this.Pi;b.clear();b.addAll(this.kb.iteratorKeys);var c=this.Mi;c.clear();for(var d=a.length,e=0;e<d;e++){var f=a[e],g=this.ac(f);if(void 0!==g){c.add(g);var h=this.Ig(g);h!==f&&(null!==h?(this.yq(h,f),wr(this,f,h)):(f=this.cloneDeep(f),this.ku(f,g),this.bj(f)))}else g=this.cloneDeep(f),this.bj(g),c.add(this.ac(g))}for(a=
b.iterator;a.next();)d=a.value,c.contains(d)||(d=this.Ig(d))&&this.Qm(d);this.Bq();b.clear();c.clear()}};function yr(a,b){var c=Oq(a,b,!0);c=a.Hm(c);null===a.Qb(c)&&Vq(a,c,b);c=Oq(a,b,!1);c=a.Hm(c);null===a.Qb(c)&&Vq(a,c,b);var d=a.Hf(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],null===a.Qb(c)&&Vq(a,c,b)}
t.Cq=function(a){if(null===a)return null;var b=this.bl;a=null!==b?b(a,this):qr(this,a,!0);Fa(a)&&(fb(a),""!==this.gf&&hk(a,this.gf,void 0),""!==this.hf&&hk(a,this.hf,void 0),""!==this.Ud&&hk(a,this.Ud,[]));return a};t.Ut=function(a){if(null===a)return!1;var b=this.Ql;return""===b?!1:In(a,b)?!0:!1};t.Qh=function(a){if(null!==a){var b=this.Fe;if(""!==b&&(b=In(a,b),void 0!==b)){if(Qq(b))return b;v("GroupKey value for node data "+a+" is not a number or a string: "+b)}}};
t.hr=function(a,b){null===b&&(b=void 0);void 0===b||Qq(b)||xa(b,"number or string",ur,"setGroupKeyForNodeData:key");if(null!==a){var c=this.Fe;if(""!==c)if(this.Za(a)){var d=In(a,c);d!==b&&(Uq(this,d,a),hk(a,c,b),null===this.Qb(b)&&Vq(this,b,a),or(this,"nodeGroupKey",He,c,a,d,b),"string"===typeof c&&this.Ga(a,c))}else hk(a,c,b)}};
ur.prototype.copyNodeData=function(a){if(null===a)return null;a=W.prototype.copyNodeData.call(this,a);this.pk||""===this.Fe||void 0===In(a,this.Fe)||hk(a,this.Fe,void 0);return a};
ur.prototype.setDataProperty=function(a,b,c){F&&(A(a,"object",ur,"setDataProperty:data"),A(b,"string",ur,"setDataProperty:propname"),""===b&&v("GraphLinksModel.setDataProperty: property name must not be an empty string when setting "+a+" to "+c));if(this.Za(a)){if(b===this.nodeKeyProperty){this.Zm(a,c);return}if(b===this.nodeCategoryProperty){this.Ym(a,c);return}if(b===this.nodeGroupKeyProperty){this.hr(a,c);return}F&&b===this.nodeIsGroupProperty&&v("GraphLinksModel.setDataProperty: property name must not be the nodeIsGroupProperty: "+
b)}else if(this.Bc(a)){if(b===this.linkFromKeyProperty){Wq(this,a,c,!0);return}if(b===this.linkToKeyProperty){Wq(this,a,c,!1);return}if(b===this.linkFromPortIdProperty){Xq(this,a,c,!0);return}if(b===this.linkToPortIdProperty){Xq(this,a,c,!1);return}if(b===this.linkKeyProperty){this.ku(a,c);return}if(b===this.linkCategoryProperty){this.gr(a,c);return}if(b===this.linkLabelKeysProperty){this.lu(a,c);return}}var d=In(a,b);d!==c&&(hk(a,b,c),this.eu(a,b,d,c))};t=ur.prototype;
t.yq=function(a,b){if(b){var c=this.Za(a),d=this.Bc(a),e;for(e in b)"__gohashid"===e||c&&e===this.nodeKeyProperty||c&&e===this.nodeIsGroupProperty&&In(a,e)===b[e]||d&&e===this.linkKeyProperty||this.setDataProperty(a,e,b[e])}};
t.er=function(a,b){W.prototype.er.call(this,a,b);for(var c=this.$a.iterator;c.next();)this.yw(c.value,a,b);for(c=this.ig.iterator;c.next();){var d=c.value,e=a,f=b;if(Oq(this,d,!0)===e){var g=this.gf;hk(d,g,f);or(this,"linkFromKey",He,g,d,e,f);"string"===typeof g&&this.Ga(d,g)}Oq(this,d,!1)===e&&(g=this.hf,hk(d,g,f),or(this,"linkToKey",He,g,d,e,f),"string"===typeof g&&this.Ga(d,g));g=this.Hf(d);if(Array.isArray(g))for(var h=g.length,k=this.Ud,l=0;l<h;l++)g[l]===e&&(g[l]=f,or(this,"linkLabelKeys",Je,
k,d,e,f,l,l))}};t.yw=function(a,b,c){if(this.Qh(a)===b){var d=this.Fe;hk(a,d,c);or(this,"nodeGroupKey",He,d,a,b,c);"string"===typeof d&&this.Ga(a,d)}};t.Tw=function(){W.prototype.Tw.call(this);for(var a=this.linkDataArray,b=a.length,c=0;c<b;c++)yr(this,a[c])};
t.Um=function(a){W.prototype.Um.call(this,a);a=this.pa(a);var b=Tq(this,a);if(null!==b){var c=La();for(b=b.iterator;b.next();){var d=b.value;if(this.Za(d)){if(this.Qh(d)===a){var e=this.Fe;or(this,"nodeGroupKey",He,e,d,a,a);"string"===typeof e&&this.Ga(d,e);c.push(d)}}else if(Oq(this,d,!0)===a&&(e=this.gf,or(this,"linkFromKey",He,e,d,a,a),"string"===typeof e&&this.Ga(d,e),c.push(d)),Oq(this,d,!1)===a&&(e=this.hf,or(this,"linkToKey",He,e,d,a,a),"string"===typeof e&&this.Ga(d,e),c.push(d)),e=this.Hf(d),
Array.isArray(e))for(var f=e.length,g=this.Ud,h=0;h<f;h++)e[h]===a&&(or(this,"linkLabelKeys",Je,g,d,a,a,h,h),c.push(d))}for(b=0;b<c.length;b++)Uq(this,a,c[b]);Oa(c)}};t.Tm=function(a){W.prototype.Tm.call(this,a);var b=this.Qh(a);null===this.Qb(b)&&Vq(this,b,a)};t.mr=function(a){W.prototype.mr.call(this,a);var b=this.Qh(a);Uq(this,b,a)};
t.Nt=function(a){if(null===a)return"";var b=this.Qj;if(""===b)return"";b=In(a,b);if(void 0===b)return"";if("string"===typeof b)return b;v("getCategoryForLinkData found a non-string category for "+a+": "+b);return""};ur.prototype.getLinkCategoryForData=function(a){return this.Nt(a)};
ur.prototype.gr=function(a,b){A(b,"string",ur,"setCategoryForLinkData:cat");if(null!==a){var c=this.Qj;if(""!==c)if(this.Bc(a)){var d=In(a,c);void 0===d&&(d="");d!==b&&(hk(a,c,b),or(this,"linkCategory",He,c,a,d,b),"string"===typeof c&&this.Ga(a,c))}else hk(a,c,b)}};ur.prototype.setLinkCategoryForData=function(a,b){this.gr(a,b)};t=ur.prototype;t.$m=function(a,b){W.prototype.$m.call(this,a,b);this.hr(b,this.Qh(a))};
function wr(a,b,c){a.gr(c,a.Nt(b));a.Dw(c,a.vy(b));a.Iw(c,a.yy(b));a.lu(c,a.Hf(b));a.Ew(c,a.wy(b));a.Jw(c,a.zy(b))}t.yk=function(){return!0};t.pj=function(){return!0};t.Wt=function(){return!0};t.oj=function(){return!0};
ma.Object.defineProperties(ur.prototype,{archetypeNodeData:{configurable:!0,get:function(){return this.xj},set:function(a){var b=this.xj;b!==a&&(null!==a&&A(a,"object",ur,"archetypeNodeData"),this.xj=a,this.g("archetypeNodeData",b,a))}},linkFromKeyProperty:{configurable:!0,get:function(){return this.gf},set:function(a){var b=this.gf;b!==a&&(pr(a,ur,"linkFromKeyProperty"),this.gf=a,this.g("linkFromKeyProperty",b,a))}},linkToKeyProperty:{configurable:!0,get:function(){return this.hf},
set:function(a){var b=this.hf;b!==a&&(pr(a,ur,"linkToKeyProperty"),this.hf=a,this.g("linkToKeyProperty",b,a))}},linkFromPortIdProperty:{configurable:!0,get:function(){return this.Rj},set:function(a){var b=this.Rj;b!==a&&(pr(a,ur,"linkFromPortIdProperty"),!F||a!==this.linkFromKeyProperty&&a!==this.linkToKeyProperty||v("linkFromPortIdProperty name must not be the same as the GraphLinksModel.linkFromKeyProperty or linkToKeyProperty: "+a),this.Rj=a,this.g("linkFromPortIdProperty",b,a))}},
linkToPortIdProperty:{configurable:!0,get:function(){return this.Sj},set:function(a){var b=this.Sj;b!==a&&(pr(a,ur,"linkToPortIdProperty"),!F||a!==this.linkFromKeyProperty&&a!==this.linkToKeyProperty||v("linkFromPortIdProperty name must not be the same as the GraphLinksModel.linkFromKeyProperty or linkToKeyProperty: "+a),this.Sj=a,this.g("linkToPortIdProperty",b,a))}},linkLabelKeysProperty:{configurable:!0,get:function(){return this.Ud},set:function(a){var b=this.Ud;b!==
a&&(pr(a,ur,"linkLabelKeysProperty"),this.Ud=a,this.g("linkLabelKeysProperty",b,a))}},linkDataArray:{configurable:!0,get:function(){return this.Wc},set:function(a){var b=this.Wc;if(b!==a){Ha(a,ur,"linkDataArray");this.kb.clear();for(var c=a.length,d=0;d<c;d++){var e=a[d];if(!Fa(e)){v("GraphLinksModel.linkDataArray must only contain Objects, not: "+e);return}ub(e)}this.Wc=a;if(""!==this.linkKeyProperty){d=new H;for(e=0;e<c;e++){var f=a[e],g=this.ac(f);void 0===g?d.add(f):null!==this.kb.K(g)?
d.add(f):this.kb.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.Vq(e),f=this.ac(e),void 0!==f&&this.kb.add(f,e)}d=new I;for(e=0;e<c;e++)d.add(a[e]);this.ig=d;or(this,"linkDataArray",He,"linkDataArray",this,b,a);for(b=0;b<c;b++)yr(this,a[b])}}},linkKeyProperty:{configurable:!0,get:function(){return this.Ji},set:function(a){var b=this.Ji;if(b!==a){pr(a,ur,"linkKeyProperty");this.Ji=a;this.kb.clear();for(var c=this.linkDataArray.length,d=0;d<c;d++){var e=this.linkDataArray[d],f=this.ac(e);
void 0===f&&(this.Vq(e),f=this.ac(e));void 0!==f&&this.kb.add(f,e)}this.g("linkKeyProperty",b,a)}}},makeUniqueLinkKeyFunction:{configurable:!0,get:function(){return this.Ml},set:function(a){var b=this.Ml;b!==a&&(null!==a&&A(a,"function",ur,"makeUniqueLinkKeyFunction"),this.Ml=a,this.g("makeUniqueLinkKeyFunction",b,a))}},copyLinkDataFunction:{configurable:!0,get:function(){return this.bl},set:function(a){var b=this.bl;b!==a&&(null!==a&&A(a,"function",ur,"copyLinkDataFunction"),
this.bl=a,this.g("copyLinkDataFunction",b,a))}},nodeIsGroupProperty:{configurable:!0,get:function(){return this.Ql},set:function(a){var b=this.Ql;b!==a&&(pr(a,ur,"nodeIsGroupProperty"),this.Ql=a,this.g("nodeIsGroupProperty",b,a))}},nodeGroupKeyProperty:{configurable:!0,get:function(){return this.Fe},set:function(a){var b=this.Fe;b!==a&&(pr(a,ur,"nodeGroupKeyProperty"),this.Fe=a,this.g("nodeGroupKeyProperty",b,a))}},pk:{configurable:!0,get:function(){return this.Fn},
set:function(a){this.Fn!==a&&(A(a,"boolean",ur,"copiesGroupKeyOfNodeData"),this.Fn=a)}},linkCategoryProperty:{configurable:!0,get:function(){return this.Qj},set:function(a){var b=this.Qj;b!==a&&(pr(a,ur,"linkCategoryProperty"),this.Qj=a,this.g("linkCategoryProperty",b,a))}},type:{configurable:!0,get:function(){return"GraphLinksModel"}}});ur.prototype.setCategoryForLinkData=ur.prototype.gr;ur.prototype.getCategoryForLinkData=ur.prototype.Nt;
ur.prototype.assignAllDataProperties=ur.prototype.yq;ur.prototype.setGroupKeyForNodeData=ur.prototype.hr;ur.prototype.getGroupKeyForNodeData=ur.prototype.Qh;ur.prototype.isGroupForNodeData=ur.prototype.Ut;ur.prototype.copyLinkData=ur.prototype.Cq;ur.prototype.mergeLinkDataArray=ur.prototype.GA;ur.prototype.removeLinkDataCollection=ur.prototype.PA;ur.prototype.removeLinkData=ur.prototype.Qm;ur.prototype.addLinkDataCollection=ur.prototype.kz;ur.prototype.addLinkData=ur.prototype.bj;
ur.prototype.containsLinkData=ur.prototype.Bc;ur.prototype.makeLinkDataKeyUnique=ur.prototype.Vq;ur.prototype.findLinkDataForKey=ur.prototype.Ig;ur.prototype.setKeyForLinkData=ur.prototype.ku;ur.prototype.getKeyForLinkData=ur.prototype.ac;ur.prototype.removeLabelKeyForLinkData=ur.prototype.Ly;ur.prototype.addLabelKeyForLinkData=ur.prototype.Ev;ur.prototype.setLabelKeysForLinkData=ur.prototype.lu;ur.prototype.getLabelKeysForLinkData=ur.prototype.Hf;ur.prototype.setToPortIdForLinkData=ur.prototype.Jw;
ur.prototype.getToPortIdForLinkData=ur.prototype.zy;ur.prototype.setFromPortIdForLinkData=ur.prototype.Ew;ur.prototype.getFromPortIdForLinkData=ur.prototype.wy;ur.prototype.setToKeyForLinkData=ur.prototype.Iw;ur.prototype.getToKeyForLinkData=ur.prototype.yy;ur.prototype.setFromKeyForLinkData=ur.prototype.Dw;ur.prototype.getFromKeyForLinkData=ur.prototype.vy;ur.prototype.clear=ur.prototype.clear;var xr=Object.freeze([]);ur.className="GraphLinksModel";sr.GraphLinksModel=ur;
W.constructGraphLinksModel=W.constructGraphLinksModel=function(){return new ur};W.initDiagramModel=Li=function(){return new ur};function Ar(a){F&&1<arguments.length&&v("TreeModel constructor can only take one optional argument, the Array of node data.");W.call(this);this.Ge="parent";this.Hn=!1;this.Xj="parentLinkCategory";void 0!==a&&(this.nodeDataArray=a)}la(Ar,W);Ar.constructGraphLinksModel=W.constructGraphLinksModel;
Ar.prototype.cloneProtected=function(a){W.prototype.cloneProtected.call(this,a);a.Ge=this.Ge;a.Hn=this.Hn;a.Xj=this.Xj};t=Ar.prototype;t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.kr();var b=(""!==this.name?this.name:"")+" TreeModel";if(0<a){b+="\n node data:";a=this.nodeDataArray;for(var c=a.length,d=0;d<c;d++){var e=a[d];b+=" "+this.pa(e)+":"+Qa(e)}}return b};
t.Ok=function(){var a=W.prototype.Ok.call(this),b="";"parent"!==this.nodeParentKeyProperty&&"string"===typeof this.nodeParentKeyProperty&&(b+=',\n  "nodeParentKeyProperty": '+this.quote(this.nodeParentKeyProperty));return a+b};t.br=function(a){W.prototype.br.call(this,a);a.nodeParentKeyProperty&&(this.nodeParentKeyProperty=a.nodeParentKeyProperty)};t.qr=function(a){ir(this,a,"nodeParentKeyProperty");return W.prototype.qr.call(this,a)};
t.ar=function(a){void 0!==a.nodeParentKeyProperty&&a.nodeParentKeyProperty!==this.nodeParentKeyProperty&&v("applyIncrementalJson cannot change Model properties");W.prototype.ar.call(this,a)};t.Hm=function(a){return a};t.Rh=function(a){if(null!==a){var b=this.Ge;if(""!==b&&(b=In(a,b),void 0!==b)){if(Qq(b))return b;v("ParentKey value for node data "+a+" is not a number or a string: "+b)}}};
t.ie=function(a,b){null===b&&(b=void 0);void 0===b||Qq(b)||xa(b,"number or string",Ar,"setParentKeyForNodeData:key");if(null!==a){var c=this.Ge;if(""!==c)if(b=this.Hm(b),this.Za(a)){var d=In(a,c);d!==b&&(Uq(this,d,a),hk(a,c,b),null===this.Qb(b)&&Vq(this,b,a),or(this,"nodeParentKey",He,c,a,d,b),"string"===typeof c&&this.Ga(a,c))}else hk(a,c,b)}};
t.Pt=function(a){if(null===a)return"";var b=this.Xj;if(""===b)return"";b=In(a,b);if(void 0===b)return"";if("string"===typeof b)return b;v("getParentLinkCategoryForNodeData found a non-string category for "+a+": "+b);return""};Ar.prototype.getLinkCategoryForData=function(a){return this.Pt(a)};
Ar.prototype.mu=function(a,b){A(b,"string",Ar,"setParentLinkCategoryForNodeData:cat");if(null!==a){var c=this.Xj;if(""!==c)if(this.Za(a)){var d=In(a,c);void 0===d&&(d="");d!==b&&(hk(a,c,b),or(this,"parentLinkCategory",He,c,a,d,b),"string"===typeof c&&this.Ga(a,c))}else hk(a,c,b)}};Ar.prototype.setLinkCategoryForData=function(a,b){this.mu(a,b)};
Ar.prototype.copyNodeData=function(a){if(null===a)return null;a=W.prototype.copyNodeData.call(this,a);this.qk||""===this.Ge||void 0===In(a,this.Ge)||hk(a,this.Ge,void 0);return a};
Ar.prototype.setDataProperty=function(a,b,c){F&&(A(a,"object",Ar,"setDataProperty:data"),A(b,"string",Ar,"setDataProperty:propname"),""===b&&v("TreeModel.setDataProperty: property name must not be an empty string when setting "+a+" to "+c));if(this.Za(a)){if(b===this.nodeKeyProperty){this.Zm(a,c);return}if(b===this.nodeCategoryProperty){this.Ym(a,c);return}if(b===this.nodeParentKeyProperty){this.ie(a,c);return}}var d=In(a,b);d!==c&&(hk(a,b,c),this.eu(a,b,d,c))};t=Ar.prototype;
t.er=function(a,b){W.prototype.er.call(this,a,b);for(var c=this.$a.iterator;c.next();)this.yw(c.value,a,b)};t.yw=function(a,b,c){if(this.Rh(a)===b){var d=this.Ge;hk(a,d,c);or(this,"nodeParentKey",He,d,a,b,c);"string"===typeof d&&this.Ga(a,d)}};
t.Um=function(a){W.prototype.Um.call(this,a);a=this.pa(a);var b=Tq(this,a);if(null!==b){var c=La();for(b=b.iterator;b.next();){var d=b.value;if(this.Za(d)&&this.Rh(d)===a){var e=this.Ge;or(this,"nodeParentKey",He,e,d,a,a);"string"===typeof e&&this.Ga(d,e);c.push(d)}}for(b=0;b<c.length;b++)Uq(this,a,c[b]);Oa(c)}};t.Tm=function(a){W.prototype.Tm.call(this,a);var b=this.Rh(a);b=this.Hm(b);null===this.Qb(b)&&Vq(this,b,a)};t.mr=function(a){W.prototype.mr.call(this,a);var b=this.Rh(a);Uq(this,b,a)};
t.$m=function(a,b){W.prototype.$m.call(this,a,b);this.mu(b,this.Pt(a));this.ie(b,this.Rh(a))};t.Gm=function(){return!0};t.Wt=function(){return!0};
ma.Object.defineProperties(Ar.prototype,{nodeParentKeyProperty:{configurable:!0,get:function(){return this.Ge},set:function(a){var b=this.Ge;b!==a&&(pr(a,Ar,"nodeParentKeyProperty"),this.Ge=a,this.g("nodeParentKeyProperty",b,a))}},qk:{configurable:!0,get:function(){return this.Hn},set:function(a){this.Hn!==a&&(A(a,"boolean",Ar,"copiesParentKeyOfNodeData"),this.Hn=a)}},parentLinkCategoryProperty:{configurable:!0,get:function(){return this.Xj},set:function(a){var b=
this.Xj;b!==a&&(pr(a,Ar,"parentLinkCategoryProperty"),this.Xj=a,this.g("parentLinkCategoryProperty",b,a))}},linkCategoryProperty:{configurable:!0,get:function(){return this.parentLinkCategoryProperty},set:function(a){this.parentLinkCategoryProperty=a}},type:{configurable:!0,get:function(){return"TreeModel"}}});Ar.prototype.setParentLinkCategoryForNodeData=Ar.prototype.mu;Ar.prototype.getParentLinkCategoryForNodeData=Ar.prototype.Pt;
Ar.prototype.setParentKeyForNodeData=Ar.prototype.ie;Ar.prototype.getParentKeyForNodeData=Ar.prototype.Rh;Ar.className="TreeModel";sr.TreeModel=Ar;function Br(){0<arguments.length&&za(Br);Ni.call(this);this.wx=this.Vn=this.fc=0;this.Zr=360;this.vx=Cr;this.Fj=0;this.mx=new J;this.Lr=this.be=0;this.xt=new Dr;this.Cu=this.Wj=0;this.bz=600;this.Bp=NaN;this.rn=1;this.fq=0;this.im=360;this.Ib=Cr;this.M=Er;this.Yc=Fr;this.Tc=rq;this.sf=6;this.kp=Gr}la(Br,Ni);
Br.prototype.cloneProtected=function(a){Ni.prototype.cloneProtected.call(this,a);a.Bp=this.Bp;a.rn=this.rn;a.fq=this.fq;a.im=this.im;a.Ib=this.Ib;a.M=this.M;a.Yc=this.Yc;a.Tc=this.Tc;a.sf=this.sf;a.kp=this.kp};
Br.prototype.mb=function(a){if(a.classType===Br)if(a===Hr||a===Ir||a===Jr||a===Kr||a===Fr)this.sorting=a;else if(a===Lr||a===Mr||a===Er||a===Nr)this.direction=a;else if(a===Or||a===Pr||a===Cr||a===Qr)this.arrangement=a;else{if(a===Rr||a===Gr)this.nodeDiameterFormula=a}else Ni.prototype.mb.call(this,a)};Br.prototype.createNetwork=function(){return new Sr(this)};
Br.prototype.doLayout=function(a){F&&null===a&&v("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");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 H;b.addAll(a.iterator);a=new H;var c=new H;var d=this.sort(b);var e,f,g=this.Lr;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===Qr&&k===Rr?h=Cr:h===Qr&&k!==Rr&&(h=this.arrangement);if((this.direction===Lr||this.direction===Mr)&&this.sorting!==Fr){for(k=0;!(k>=d.length);k+=2){a.add(d.O(k));if(k+1>=d.length)break;c.add(d.O(k+1))}this.direction===Lr?(this.arrangement===Qr&&a.reverse(),d=new H,d.addAll(a),
d.addAll(c)):(this.arrangement===Qr&&c.reverse(),d=new H,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===Er?1:-1)/k,u=d.O(r).diameter;isNaN(u)&&(u=Tr(d.O(r),q));360>p&&(0===r||r===d.length-1)&&(u/=2);e+=u;f++}if(isNaN(l)||h===Qr){isNaN(b)&&(b=6);if(h!==Cr&&h!==Qr){f=-Infinity;for(g=0;g<k;g++)r=d.O(g),e=d.O(g===k-1?0:g+1),isNaN(r.diameter)&&Tr(r,0),isNaN(e.diameter)&&Tr(e,0),f=Math.max(f,(r.diameter+e.diameter)/2);g=f+b;h===Or?l=(f+b)/(2*Math.PI/k):
l=Ur(this,g*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180)}else l=Ur(this,e+(360<=p?k:k-1)*(h!==Qr?b:1.6*b),m,n*Math.PI/180,p*Math.PI/180);f=l*m}else if(f=l*m,r=Vr(this,l,f,n*Math.PI/180,p*Math.PI/180),isNaN(b)){if(h===Cr||h===Qr)b=(r-e)/(360<=p?k:k-1)}else if(h===Cr||h===Qr)r=(r-e)/(360<=p?k:k-1),r<b?(l=Ur(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.O(e),u=d.O(e===k-1?0:e+1),isNaN(q.diameter)&&Tr(q,0),isNaN(u.diameter)&&Tr(u,0),g=Math.max(g,
(q.diameter+u.diameter)/2);g+=b;e=Ur(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.vx=h;this.fc=l;this.Vn=m;this.wx=n;this.Zr=p;this.Fj=b;this.be=f;this.Lr=g;b=d;d=this.vx;h=this.fc;l=this.wx;m=this.Zr;n=this.Fj;p=this.be;k=this.Lr;if(this.direction!==Lr&&this.direction!==Mr||d!==Qr)if(this.direction===Lr||this.direction===Mr){g=0;switch(d){case Pr:g=180*Wr(this,h,p,l,k)/Math.PI;break;case Cr:k=b=0;g=a.first();null!==g&&(b=Tr(g,Math.PI/2));g=c.first();
null!==g&&(k=Tr(g,Math.PI/2));g=180*Wr(this,h,p,l,n+(b+k)/2)/Math.PI;break;case Or:g=m/b.length}if(this.direction===Lr){switch(d){case Pr:Xr(this,a,l,Nr);break;case Cr:Yr(this,a,l,Nr);break;case Or:Zr(this,a,m/2,l,Nr)}switch(d){case Pr:Xr(this,c,l+g,Er);break;case Cr:Yr(this,c,l+g,Er);break;case Or:Zr(this,c,m/2,l+g,Er)}}else{switch(d){case Pr:Xr(this,c,l,Nr);break;case Cr:Yr(this,c,l,Nr);break;case Or:Zr(this,c,m/2,l,Nr)}switch(d){case Pr:Xr(this,a,l+g,Er);break;case Cr:Yr(this,a,l+g,Er);break;case Or:Zr(this,
a,m/2,l+g,Er)}}}else switch(d){case Pr:Xr(this,b,l,this.direction);break;case Cr:Yr(this,b,l,this.direction);break;case Or:Zr(this,b,m,l,this.direction);break;case Qr:$r(this,b,m,l,this.direction)}else $r(this,b,m,l-m/2,Er)}this.updateParts();this.network=null;this.isValidLayout=!0};
function Zr(a,b,c,d,e){var f=a.Zr,g=a.fc;a=a.be;d=d*Math.PI/180;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=d+(e===Er?k*c/(360<=f?h:h-1):-(k*c)/h),m=b.O(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 Yr(a,b,c,d){var e=a.fc,f=a.be,g=a.Fj;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=b.O(k),m=b.O(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)&&Tr(l,0);isNaN(m.diameter)&&Tr(m,0);l=Wr(a,e,f,d===Er?c:-c,(l.diameter+m.diameter)/2+g);c+=d===Er?l:-l}}
function Xr(a,b,c,d){var e=a.fc,f=a.be,g=a.Lr;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=b.O(k);l.centerX=e*Math.cos(c);l.centerY=f*Math.sin(c);l.actualAngle=180*c/Math.PI;l=Wr(a,e,f,d===Er?c:-c,g);c+=d===Er?l:-l}}function $r(a,b,c,d,e){var f=a.Zr;a.Wj=0;a.xt=new Dr;if(360>c){for(f=d+(e===Er?f:-f);0>f;)f+=360;f%=360;180<f&&(f-=360);f*=Math.PI/180;a.Cu=f;as(a,b,c,d,e)}else bs(a,b,c,d,e);a.xt.commit(b)}
function bs(a,b,c,d,e){var f=a.fc,g=a.Fj,h=a.Vn,k=f*Math.cos(d*Math.PI/180),l=a.be*Math.sin(d*Math.PI/180),m=b.ua();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;cs(a,k,l,m,n,e,f)||ds(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===Er?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.xt.compare(g,m);1<Math.abs(g)&&(a.fc=8>a.Wj?a.fc-g/(2*Math.PI):5>m.length&&10<g?a.fc/2:a.fc-(0<g?1.7:-2.3),a.be=a.fc*h,bs(a,b,c,d,e))}}}
function as(a,b,c,d,e){for(var f=a.fc,g=a.be,h=a.Vn,k=f*Math.cos(d*Math.PI/180),l=g*Math.sin(d*Math.PI/180),m=J.alloc(),n=b.ua(),p=0;p<n.length;p++){n[p].centerX=k;n[p].centerY=l;if(p>=n.length-1)break;cs(a,k,l,n,p,e,m)||ds(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===Er?a.Cu-k:k-a.Cu;k=Math.abs(k)<Math.abs(k-2*Math.PI)?k:k-2*Math.PI;f=k*(f+g)/2;g=a.xt;if(Math.abs(f)<Math.abs(g.Bm))for(g.Bm=f,g.Pk=[],g.dn=[],k=0;k<n.length;k++)g.Pk[k]=n[k].bounds.x,g.dn[k]=n[k].bounds.y;
1<Math.abs(f)&&(a.fc=8>a.Wj?a.fc-f/(2*Math.PI):a.fc-(0<f?1.7:-2.3),a.be=a.fc*h,as(a,b,c,d,e))}}function cs(a,b,c,d,e,f,g){var h=a.fc,k=a.be,l=0;a=(d[e].width+d[e+1].width)/2+a.Fj;var m=!1;if(0<=c!==(f===Er)){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 ds(a,b,c,d,e,f,g){var h=a.fc,k=a.be,l=0;a=(d[e].height+d[e+1].height)/2+a.Fj;d=!1;if(0<=b!==(f===Er)){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}Br.prototype.commitLayout=function(){this.commitNodes();this.isRouting&&this.commitLinks()};
Br.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.fc,c.y=this.arrangementOrigin.y+this.be);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.Fb(),a=this.group.position.copy(),c=this.group.location.copy(),b=b.je(c.je(a)),this.group.move(b),this.mx=b.je(a))};
Br.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};function Vr(a,b,c,d,e){var f=a.bz;if(.001>Math.abs(a.Vn-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 Ur(a,b,c,d,e){return b/(void 0!==d&&void 0!==e?Vr(a,1,c,d,e):Vr(a,1,c))}function Wr(a,b,c,d,e){if(.001>Math.abs(a.Vn-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}}
Br.prototype.sort=function(a){switch(this.sorting){case Jr:break;case Kr:a.reverse();break;case Hr:a.sort(this.comparer);break;case Ir:a.sort(this.comparer);a.reverse();break;case Fr:for(var b=[],c=0;c<a.length;c++)b.push(0);c=new H;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.O(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.O(f));b[f]=-1;f=a.O(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.O(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 H;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.O(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],w=a[l],y=0,z=0;z<g.length;z++){var B=f[g[z]],D=f[h[z]];if(B<D){var G=B;B=D}else G=D;if(G<u&&u<=B)for(D=0;D<w.length;D++){var O=w[D];0>b.indexOf(O)||G<f[O]&&f[O]<B||G===f[O]||B===f[O]||y++}else for(D=0;D<w.length;D++)O=w[D],0>b.indexOf(O)||G<f[O]&&f[O]<B&&G!==f[O]&&
B!==f[O]&&y++}w=y;for(z=y=0;z<a[l].length;z++)G=b.indexOf(a[l][z]),0<=G&&(G=Math.abs(u-(G>=u?G+1:G)),y+=G<b.length+1-G?G:b.length+1-G);for(z=0;z<g.length;z++)G=f[g[z]],B=f[h[z]],G>=u&&G++,B>=u&&B++,G>B&&(D=B,B=G,G=D),B-G<(b.length+2)/2===(G<u&&u<=B)&&y++;if(w<m||w===m&&y<n)m=w,n=y,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.O(b[a]));return d;default:v("Invalid sorting type.")}return a};
ma.Object.defineProperties(Br.prototype,{radius:{configurable:!0,get:function(){return this.Bp},set:function(a){this.Bp!==a&&(A(a,"number",Br,"radius"),0<a||isNaN(a))&&(this.Bp=a,this.D())}},aspectRatio:{configurable:!0,get:function(){return this.rn},set:function(a){this.rn!==a&&(A(a,"number",Br,"aspectRatio"),0<a&&(this.rn=a,this.D()))}},startAngle:{configurable:!0,get:function(){return this.fq},set:function(a){this.fq!==a&&(A(a,"number",Br,"startAngle"),
this.fq=a,this.D())}},sweepAngle:{configurable:!0,get:function(){return this.im},set:function(a){this.im!==a&&(A(a,"number",Br,"sweepAngle"),0<a&&360>=a?this.im=a:this.im=360,this.D())}},arrangement:{configurable:!0,get:function(){return this.Ib},set:function(a){this.Ib!==a&&(hb(a,Br,Br,"arrangement"),a===Qr||a===Cr||a===Pr||a===Or)&&(this.Ib=a,this.D())}},direction:{configurable:!0,get:function(){return this.M},set:function(a){this.M!==a&&(hb(a,Br,Br,"direction"),
a===Er||a===Nr||a===Lr||a===Mr)&&(this.M=a,this.D())}},sorting:{configurable:!0,get:function(){return this.Yc},set:function(a){this.Yc!==a&&(hb(a,Br,Br,"sorting"),a===Jr||a===Kr||a===Hr||Ir||a===Fr)&&(this.Yc=a,this.D())}},comparer:{configurable:!0,get:function(){return this.Tc},set:function(a){this.Tc!==a&&(A(a,"function",Br,"comparer"),this.Tc=a,this.D())}},spacing:{configurable:!0,get:function(){return this.sf},set:function(a){this.sf!==a&&(A(a,"number",
Br,"spacing"),this.sf=a,this.D())}},nodeDiameterFormula:{configurable:!0,get:function(){return this.kp},set:function(a){this.kp!==a&&(hb(a,Br,Br,"nodeDiameterFormula"),a===Gr||a===Rr)&&(this.kp=a,this.D())}},actualXRadius:{configurable:!0,get:function(){return this.fc}},actualYRadius:{configurable:!0,get:function(){return this.be}},actualSpacing:{configurable:!0,get:function(){return this.Fj}},actualCenter:{configurable:!0,get:function(){return this.mx}}});
var Cr=new E(Br,"ConstantSpacing",0),Pr=new E(Br,"ConstantDistance",1),Or=new E(Br,"ConstantAngle",2),Qr=new E(Br,"Packed",3),Er=new E(Br,"Clockwise",4),Nr=new E(Br,"Counterclockwise",5),Lr=new E(Br,"BidirectionalLeft",6),Mr=new E(Br,"BidirectionalRight",7),Jr=new E(Br,"Forwards",8),Kr=new E(Br,"Reverse",9),Hr=new E(Br,"Ascending",10),Ir=new E(Br,"Descending",11),Fr=new E(Br,"Optimized",12),Gr=new E(Br,"Pythagorean",13),Rr=new E(Br,"Circular",14);Br.className="CircularLayout";Br.ConstantSpacing=Cr;
Br.ConstantDistance=Pr;Br.ConstantAngle=Or;Br.Packed=Qr;Br.Clockwise=Er;Br.Counterclockwise=Nr;Br.BidirectionalLeft=Lr;Br.BidirectionalRight=Mr;Br.Forwards=Jr;Br.Reverse=Kr;Br.Ascending=Hr;Br.Descending=Ir;Br.Optimized=Fr;Br.Pythagorean=Gr;Br.Circular=Rr;function Dr(){this.Bm=-Infinity;this.dn=this.Pk=null}
Dr.prototype.compare=function(a,b){if(0<a&&0>this.Bm||Math.abs(a)<Math.abs(this.Bm)&&!(0>a&&0<this.Bm))for(this.Bm=a,this.Pk=[],this.dn=[],a=0;a<b.length;a++)this.Pk[a]=b[a].bounds.x,this.dn[a]=b[a].bounds.y};Dr.prototype.commit=function(a){if(null!==this.Pk&&null!==this.dn)for(var b=0;b<this.Pk.length;b++){var c=a.O(b);c.x=this.Pk[b];c.y=this.dn[b]}};Dr.className="VertexArrangement";function Sr(a){hq.call(this,a)}la(Sr,hq);Sr.prototype.createVertex=function(){return new es(this)};
Sr.prototype.createEdge=function(){return new fs(this)};Sr.className="CircularNetwork";function es(a){kq.call(this,a);this.L=this.Dj=NaN}la(es,kq);
function Tr(a,b){var c=a.network;if(null===c)return NaN;c=c.layout;if(null===c)return NaN;if(c.arrangement===Qr)if(c.nodeDiameterFormula===Rr)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===Rr?Math.max(a.width,a.height):Math.sqrt(a.width*a.width+a.height*a.height);return a.Dj}
ma.Object.defineProperties(es.prototype,{diameter:{configurable:!0,get:function(){return this.Dj},set:function(a){this.Dj!==a&&(A(a,"number",es,"diameter"),this.Dj=a)}},actualAngle:{configurable:!0,get:function(){return this.L},set:function(a){this.L!==a&&(A(a,"number",es,"actualAngle"),this.L=a)}}});es.className="CircularVertex";function fs(a){lq.call(this,a)}la(fs,lq);fs.className="CircularEdge";
function gs(){0<arguments.length&&za(gs);Ni.call(this);this.Jh=null;this.Do=0;this.Jd=(new Hb(100,100)).freeze();this.qn=!1;this.qf=!0;this.ed=!1;this.Nl=100;this.Yn=1;this.eg=1E3;this.ap=10;this.Cp=Math;this.il=.05;this.hl=50;this.fl=150;this.gl=0;this.Pn=10;this.On=5}la(gs,Ni);
gs.prototype.cloneProtected=function(a){Ni.prototype.cloneProtected.call(this,a);a.Jd.assign(this.Jd);a.qn=this.qn;a.qf=this.qf;a.ed=this.ed;a.Nl=this.Nl;a.Yn=this.Yn;a.eg=this.eg;a.ap=this.ap;a.Cp=this.Cp;a.il=this.il;a.hl=this.hl;a.fl=this.fl;a.gl=this.gl;a.Pn=this.Pn;a.On=this.On};gs.prototype.createNetwork=function(){return new hs(this)};
gs.prototype.doLayout=function(a){F&&null===a&&v("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");null===this.network&&(this.network=this.makeNetwork(a));a=this.maxIterations;if(0<this.network.vertexes.count){this.network.Dq();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.Gv();this.Do=0;if(this.needsClusterLayout()){b=this.network;for(c=b.Ty().iterator;c.next();){this.network=c.value;for(var d=this.network.vertexes.iterator;d.next();){var e=d.value;e.Fd=e.vertexes.count;e.Wh=1;e.nk=null;e.Ue=null}is(this,0,a)}this.network=b;c.reset();F&&x(b,hs,gs,"arrangeConnectedGraphs:singletons");d=this.arrangementSpacing;for(var f=c.count,g=!0,h=e=0,k=La(),l=0;l<f+b.vertexes.count+2;l++)k[l]=null;f=0;c.reset();for(var m=L.alloc();c.next();)if(l=
c.value,this.computeBounds(l,m),g)g=!1,e=m.x+m.width/2,h=m.y+m.height/2,k[0]=new J(m.x+m.width+d.width,m.y),k[1]=new J(m.x,m.y+m.height+d.height),f=2;else{var n=js(k,f,e,h,m.width,m.height,d),p=k[n],r=new J(p.x+m.width+d.width,p.y),q=new J(p.x,p.y+m.height+d.height);n+1<f&&k.splice(n+1,0,null);k[n]=r;k[n+1]=q;f++;n=p.x-m.x;p=p.y-m.y;for(l=l.vertexes.iterator;l.next();)r=l.value,r.centerX+=n,r.centerY+=p}L.free(m);for(l=b.vertexes.iterator;l.next();)g=l.value,r=g.bounds,2>f?(e=r.x+r.width/2,h=r.y+
r.height/2,k[0]=new J(r.x+r.width+d.width,r.y),k[1]=new J(r.x,r.y+r.height+d.height),f=2):(m=js(k,f,e,h,r.width,r.height,d),p=k[m],n=new J(p.x+r.width+d.width,p.y),r=new J(p.x,p.y+r.height+d.height),m+1<f&&k.splice(m+1,0,null),k[m]=n,k[m+1]=r,f++,g.centerX=p.x+g.width/2,g.centerY=p.y+g.height/2);Oa(k);for(c.reset();c.next();){d=c.value;for(e=d.vertexes.iterator;e.next();)b.Mh(e.value);for(d=d.edges.iterator;d.next();)b.wq(d.value)}}ks(this,a);this.updateParts()}this.Nl=a;this.network=null;this.isValidLayout=
!0};gs.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.Oc(c)&&(a++,2<a))return!0;if(10<b)break;b++}return!1};gs.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.Pc(d.bounds)}return b};
function ls(a,b,c){F&&(C(b,gs,"computeClusterLayoutIterations:level"),C(c,gs,"computeClusterLayoutIterations:maxiter"));return Math.max(Math.min(a.network.vertexes.count,c*(b+1)/11),10)}
function is(a,b,c){F&&(C(b,gs,"layoutClusters:level"),C(c,gs,"layoutClusters:maxiter"));if(ms(a,b)){var d=a.eg;a.eg*=1+1/(b+1);var e=ns(a,b),f=Math.max(0,ls(a,b,c));a.maxIterations+=f;is(a,b+1,c);ks(a,f);os(a,e,b);c=e.vertexes.ua();c.sort(function(a,b){return null===a||null===b||a===b?0:b.Fd-a.Fd});for(e=0;e<c.length;e++)ps(a,c[e],b);a.eg=d}}
function ms(a,b){F&&C(b,gs,"hasClusters:level");if(10<b||3>a.network.vertexes.count)return!1;a.Jh=a.network.vertexes.ua();a=a.Jh;a.sort(function(a,b){return null===a||null===b||a===b?0:b.Fd-a.Fd});for(b=a.length-1;0<=b&&1>=a[b].Fd;)b--;return 1<a.length-b}
function ns(a,b){F&&C(b,gs,"pushSubNetwork:level");for(var c=a.network,d=new hs(a),e=0;e<a.Jh.length;e++){var f=a.Jh[e];if(1<f.Fd){d.Mh(f);var g=new qs;g.ru=f.Fd;g.su=f.width;g.qu=f.height;g.$w=f.focus.x;g.ax=f.focus.y;null===f.Ue&&(f.Ue=new H);f.Ue.add(g);f.Bw=f.Ue.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.wq(h):e.network===d?(h=e.nk,null===h&&(h=new H,e.nk=h),h.add(g),e.Fd--,e.Wh+=g.Wh):g.network===d&&(h=g.nk,null===
h&&(h=new H,g.nk=h),h.add(e),g.Fd--,g.Wh+=e.Wh)}for(e=d.edges.iterator;e.next();)f=e.value,f.length*=Math.max(1,K.sqrt((f.fromVertex.Wh+f.toVertex.Wh)/(4*b+1)));for(b=d.vertexes.iterator;b.next();){e=b.value;var k=e.nk;if(null!==k&&0<k.count&&(g=e.Ue.O(e.Ue.count-1).ru-e.Fd,!(0>=g))){for(var l=h=0,m=k.count-g;m<k.count;m++){var n=k.O(m),p=null;for(f=n.edges.iterator;f.next();){var r=f.value;if(r.xy(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 L(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 os(a,b,c){F&&(x(b,hs,gs,"popNetwork:oldnet"),C(c,gs,"popNetwork:level"));for(c=a.network.vertexes.iterator;c.next();){var d=c.value;d.network=b;if(null!==d.Ue){var e=d.Ue.O(d.Bw);d.Fd=e.ru;var f=e.$w,g=e.ax;d.bounds=new L(d.centerX-f,d.centerY-g,e.su,e.qu);d.focus=new J(f,g);d.Bw--}}for(c=a.network.edges.iterator;c.next();)c.value.network=b;a.network=b}
function ps(a,b,c){F&&(x(b,rs,gs,"surroundNode:oldnet"),C(c,gs,"surroundNode:level"));var d=b.nk;if(null!==d&&0!==d.count){c=b.centerX;var e=b.centerY,f=b.width,g=b.height;null!==b.Ue&&0<b.Ue.count&&(g=b.Ue.O(0),f=g.su,g=g.qu);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.Fd?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<d.count&&d.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,d=d.iterator;d.next();)if(k=d.value,!(1<k.Fd||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=c+m*Math.cos(n);k.centerY=e+m*Math.sin(n);h++}}}
function js(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}gs.prototype.Gv=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)};
gs.prototype.addComments=function(a){var b=a.node;if(null!==b)for(b=b.Uv();b.next();){var c=b.value;if("Comment"===c.category&&c.isVisible()){var d=this.network.kj(c);null===d&&(d=this.network.qm(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.Bk(a,d,null));c.length=this.defaultCommentSpringLength}}};
function ss(a,b){F&&(x(a,rs,gs,"getNodeDistance:vertexA"),x(b,rs,gs,"getNodeDistance:vertexB"));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 ks(a,b){F&&C(b,gs,"performIterations:num");a.Jh=null;for(b=a.Do+b;a.Do<b&&(a.Do++,ts(a)););a.Jh=null}
function ts(a){null===a.Jh&&(a.Jh=a.network.vertexes.ua());var b=a.Jh;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.eg;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=ss(g,p);1>q?(d=a.randomNumberGenerator,null===d&&(a.randomNumberGenerator=d=new us),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=ss(c,f),1>n?(n=a.randomNumberGenerator,null===n&&(a.randomNumberGenerator=n=new us),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}gs.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};gs.prototype.moveFixedVertex=function(){};gs.prototype.commitLayout=function(){this.Fw();this.commitNodes();this.isRouting&&this.commitLinks()};
gs.prototype.Fw=function(){if(this.setsPortSpots)for(var a=this.network.edges.iterator;a.next();){var b=a.value.link;null!==b&&(b.fromSpot=ld,b.toSpot=ld)}};gs.prototype.commitNodes=function(){var a=0,b=0;if(this.arrangesToOrigin){var c=L.alloc();this.computeBounds(this.network,c);b=this.arrangementOrigin;a=b.x-c.x;b=b.y-c.y;L.free(c)}c=L.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()}L.free(c)};
gs.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};gs.prototype.springStiffness=function(a){a=a.stiffness;return isNaN(a)?this.il:a};gs.prototype.springLength=function(a){a=a.length;return isNaN(a)?this.hl:a};gs.prototype.electricalCharge=function(a){a=a.charge;return isNaN(a)?this.fl:a};gs.prototype.electricalFieldX=function(){return 0};gs.prototype.electricalFieldY=function(){return 0};
gs.prototype.gravitationalMass=function(a){a=a.mass;return isNaN(a)?this.gl:a};gs.prototype.gravitationalFieldX=function(){return 0};gs.prototype.gravitationalFieldY=function(){return 0};gs.prototype.isFixed=function(a){return a.isFixed};
ma.Object.defineProperties(gs.prototype,{currentIteration:{configurable:!0,get:function(){return this.Do}},arrangementSpacing:{configurable:!0,get:function(){return this.Jd},set:function(a){x(a,Hb,gs,"arrangementSpacing");this.Jd.A(a)||(this.Jd.assign(a),this.D())}},arrangesToOrigin:{configurable:!0,get:function(){return this.qn},set:function(a){this.qn!==a&&(A(a,"boolean",gs,"arrangesToOrigin"),this.qn=a,this.D())}},setsPortSpots:{configurable:!0,
get:function(){return this.qf},set:function(a){this.qf!==a&&(A(a,"boolean",gs,"setsPortSpots"),this.qf=a,this.D())}},comments:{configurable:!0,get:function(){return this.ed},set:function(a){this.ed!==a&&(A(a,"boolean",gs,"comments"),this.ed=a,this.D())}},maxIterations:{configurable:!0,get:function(){return this.Nl},set:function(a){this.Nl!==a&&(A(a,"number",gs,"maxIterations"),0<=a&&(this.Nl=a,this.D()))}},epsilonDistance:{configurable:!0,get:function(){return this.Yn},
set:function(a){this.Yn!==a&&(A(a,"number",gs,"epsilonDistance"),0<a&&(this.Yn=a,this.D()))}},infinityDistance:{configurable:!0,get:function(){return this.eg},set:function(a){this.eg!==a&&(A(a,"number",gs,"infinityDistance"),1<a&&(this.eg=a,this.D()))}},moveLimit:{configurable:!0,get:function(){return this.ap},set:function(a){this.ap!==a&&(A(a,"number",gs,"moveLimit"),1<a&&(this.ap=a,this.D()))}},randomNumberGenerator:{configurable:!0,get:function(){return this.Cp},
set:function(a){this.Cp!==a&&(null!==a&&"function"!==typeof a.random&&v('ForceDirectedLayout.randomNumberGenerator must have a "random()" function on it: '+a),this.Cp=a)}},defaultSpringStiffness:{configurable:!0,get:function(){return this.il},set:function(a){this.il!==a&&(A(a,"number",gs,"defaultSpringStiffness"),this.il=a,this.D())}},defaultSpringLength:{configurable:!0,get:function(){return this.hl},set:function(a){this.hl!==a&&(A(a,"number",gs,"defaultSpringLength"),
this.hl=a,this.D())}},defaultElectricalCharge:{configurable:!0,get:function(){return this.fl},set:function(a){this.fl!==a&&(A(a,"number",gs,"defaultElectricalCharge"),this.fl=a,this.D())}},defaultGravitationalMass:{configurable:!0,get:function(){return this.gl},set:function(a){this.gl!==a&&(A(a,"number",gs,"defaultGravitationalMass"),this.gl=a,this.D())}},defaultCommentSpringLength:{configurable:!0,get:function(){return this.Pn},set:function(a){this.Pn!==
a&&(A(a,"number",gs,"defaultCommentSpringLength"),this.Pn=a,this.D())}},defaultCommentElectricalCharge:{configurable:!0,get:function(){return this.On},set:function(a){this.On!==a&&(A(a,"number",gs,"defaultCommentElectricalCharge"),this.On=a,this.D())}}});gs.className="ForceDirectedLayout";function qs(){this.ax=this.$w=this.qu=this.su=this.ru=0}qs.className="ForceDirectedSubnet";function hs(a){hq.call(this,a)}la(hs,hq);hs.prototype.createVertex=function(){return new rs(this)};
hs.prototype.createEdge=function(){return new vs(this)};hs.className="ForceDirectedNetwork";function rs(a){kq.call(this,a);this.Oa=!1;this.ib=this.L=NaN;this.Wh=this.Fd=this.Na=this.W=0;this.Ue=this.nk=null;this.Bw=0}la(rs,kq);
ma.Object.defineProperties(rs.prototype,{isFixed:{configurable:!0,get:function(){return this.Oa},set:function(a){this.Oa!==a&&(A(a,"boolean",rs,"isFixed"),this.Oa=a)}},charge:{configurable:!0,get:function(){return this.L},set:function(a){this.L!==a&&(A(a,"number",rs,"charge"),this.L=a)}},mass:{configurable:!0,get:function(){return this.ib},set:function(a){this.ib!==a&&(A(a,"number",rs,"mass"),this.ib=a)}},forceX:{configurable:!0,get:function(){return this.W},
set:function(a){this.W!==a&&(A(a,"number",rs,"forceX"),this.W=a)}},forceY:{configurable:!0,get:function(){return this.Na},set:function(a){this.Na!==a&&(A(a,"number",rs,"forceY"),this.Na=a)}}});rs.className="ForceDirectedVertex";function vs(a){lq.call(this,a);this.l=this.w=NaN}la(vs,lq);
ma.Object.defineProperties(vs.prototype,{stiffness:{configurable:!0,get:function(){return this.w},set:function(a){this.w!==a&&(A(a,"number",vs,"stiffness"),this.w=a)}},length:{configurable:!0,get:function(){return this.l},set:function(a){this.l!==a&&(A(a,"number",vs,"length"),this.l=a)}}});vs.className="ForceDirectedEdge";
function us(){var a=0;void 0===a&&(a=42);this.seed=a;this.Vy=48271;this.Xy=2147483647;this.Q=44488.07041494893;this.Zy=3399;this.Wy=1/2147483647;this.random()}us.prototype.random=function(){var a=this.seed%this.Q*this.Vy-this.seed/this.Q*this.Zy;0<a?this.seed=a:this.seed=a+this.Xy;return this.seed*this.Wy};us.className="RandomNumberGenerator";
function ws(){0<arguments.length&&za(ws);Ni.call(this);this.ec=this.ze=25;this.M=0;this.dl=xs;this.Il=ys;this.xl=zs;this.Oj=4;this.Tk=As;this.vg=7;this.qf=!0;this.Lo=4;this.Ja=this.zs=this.Ea=-1;this.yd=this.Wo=0;this.Ma=this.wd=this.xd=this.Td=this.mc=null;this.gp=0;this.fp=this.Tj=null;this.Xd=0;this.hp=null;this.Sf=new J;this.De=[];this.De.length=100}la(ws,Ni);
ws.prototype.cloneProtected=function(a){Ni.prototype.cloneProtected.call(this,a);a.ze=this.ze;a.ec=this.ec;a.M=this.M;a.dl=this.dl;a.Il=this.Il;a.xl=this.xl;a.Oj=this.Oj;a.Tk=this.Tk;a.vg=this.vg;a.qf=this.qf;a.Lo=this.Lo};
ws.prototype.mb=function(a){a.classType===ws?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:v("Unknown enum value: "+a):Ni.prototype.mb.call(this,a)};ws.prototype.createNetwork=function(){return new Bs(this)};
ws.prototype.doLayout=function(a){F&&null===a&&v("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");null===this.network&&(this.network=this.makeNetwork(a));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);this.zs=-1;this.yd=this.Wo=0;this.hp=this.fp=this.Tj=null;for(a=0;a<this.De.length;a++)this.De[a]=null;if(0<this.network.vertexes.count){this.network.Dq();this.cycleRemoveOption!==Cs&&this.removeCycles();for(a=this.network.vertexes.iterator;a.next();)a.value.layer=
-1;this.Ea=-1;this.assignLayers();for(a.reset();a.next();)this.Ea=Math.max(this.Ea,a.value.layer);this.cycleRemoveOption===Cs&&this.removeCycles();a=this.network;for(var b=[],c=a.edges.iterator;c.next();){var d=c.value;d.valid=!1;b.push(d)}for(c=0;c<b.length;c++){d=b[c];var e=d.fromVertex,f=d.toVertex;if(!d.valid&&(null!==e.node&&null!==f.node||e.layer!==f.layer)){var g=0,h=0,k=0,l=0;if(null!==d.link){h=d.link;if(null===h)continue;var m=e.node;g=f.node;if(null===m||null===g)continue;var n=h.fromNode;
k=h.toNode;var p=h.fromPort;h=h.toPort;if(d.rev){l=n;var r=p;n=k;p=h;k=l;h=r}var q=e.focus;l=f.focus;var u=d.rev?f.bounds:e.bounds;r=J.alloc();m!==n?u.o()&&n.isVisible()?n.actualBounds.o()?(n.If(p,Mc,r),r.x+=n.actualBounds.x-u.x,r.y+=n.actualBounds.y-u.y):(n.If(p,Mc,r),r.o()||r.assign(q)):r.assign(q):u.o()?(n.If(p,Mc,r),r.o()||r.assign(q)):r.assign(q);n=d.rev?e.bounds:f.bounds;m=J.alloc();g!==k?n.o()&&k.isVisible()?k.actualBounds.o()?(k.If(h,Mc,m),m.x+=k.actualBounds.x-n.x,m.y+=k.actualBounds.y-n.y):
(k.If(h,Mc,m),m.o()||m.assign(l)):m.assign(l):n.o()?(k.If(h,Mc,m),m.o()||m.assign(l)):m.assign(l);90===this.M||270===this.M?(g=Math.round((r.x-q.x)/this.ec),k=r.x,h=Math.round((m.x-l.x)/this.ec),l=m.x):(g=Math.round((r.y-q.y)/this.ec),k=r.y,h=Math.round((m.y-l.y)/this.ec),l=m.y);J.free(r);J.free(m);d.portFromColOffset=g;d.portFromPos=k;d.portToColOffset=h;d.portToPos=l}else d.portFromColOffset=0,d.portFromPos=0,d.portToColOffset=0,d.portToPos=0;r=e.layer;m=f.layer;n=0;u=d.link;if(null!==u){var w=
u.fromPort,y=u.toPort;if(null!==w&&null!==y){var z=u.fromNode;p=u.toNode;if(null!==z&&null!==p){var B=Ds(this,!0),D=Ds(this,!1),G=this.setsPortSpots?B:u.computeSpot(!0,w);q=this.setsPortSpots?D:u.computeSpot(!1,y);var O=u.isOrthogonal;G.nd()&&G.Jf(D)&&q.nd()&&q.Jf(B)?n=0:(B=u.getLinkPoint(z,w,G,!0,O,p,y,J.alloc()),D=u.getLinkDirection(z,w,B,G,!0,O,p,y),J.free(B),G.Rq()||D!==Es(this,d,!0)?this.setsPortSpots&&null!==z&&1===z.ports.count&&d.rev&&(n+=1):n+=1,G=u.getLinkPoint(p,y,q,!1,O,z,w,J.alloc()),
u=u.getLinkDirection(p,y,G,q,!1,O,z,w),J.free(G),q.Rq()||u!==Es(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.kk=1,q.layer=r,q.near=e,a.Mh(q),e=a.Bk(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.kk=2;q.layer=r-1;a.Mh(q);e=a.Bk(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.kk=3,q.layer=r-1,a.Mh(q),e=a.Bk(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.Bk(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.mc=[];for(b=0;b<=this.Ea;b++)a[b]=0;for(b=this.network.vertexes.iterator;b.next();)b.value.index=
-1;this.initializeIndices();this.zs=-1;for(c=this.yd=this.Wo=0;c<=this.Ea;c++)a[c]>a[this.yd]&&(this.zs=a[c]-1,this.yd=c),a[c]<a[this.Wo]&&(this.Wo=c);this.hp=[];for(c=0;c<a.length;c++)this.hp[c]=[];for(b.reset();b.next();)a=b.value,this.hp[a.layer][a.index]=a;this.Ja=-1;for(a=0;a<=this.Ea;a++){b=Fs(this,a);c=0;d=this.mc[a];for(f=0;f<d;f++)e=b[f],c+=this.nodeMinColumnSpace(e,!0),e.column=c,c+=1,c+=this.nodeMinColumnSpace(e,!1);this.Ja=Math.max(this.Ja,c-1);Gs(this,a,b)}this.reduceCrossings();this.straightenAndPack();
this.updateParts()}this.network=null;this.isValidLayout=!0};ws.prototype.linkMinLength=function(){return 1};function Hs(a){var b=a.fromVertex.node;a=a.toVertex.node;return null===b&&null===a?8:null===b||null===a?4:1}ws.prototype.nodeMinLayerSpace=function(a,b){return null===a.node?0:90===this.M||270===this.M?b?a.focus.y+10:a.bounds.height-a.focus.y+10:b?a.focus.x+10:a.bounds.width-a.focus.x+10};
ws.prototype.nodeMinColumnSpace=function(a,b){if(null===a.node)return 0;var c=b?a.nw:a.mw;if(null!==c)return c;c=this.M;return 90===c||270===c?b?a.nw=a.focus.x/this.ec+1|0:a.mw=(a.bounds.width-a.focus.x)/this.ec+1|0:b?a.nw=a.focus.y/this.ec+1|0:a.mw=(a.bounds.height-a.focus.y)/this.ec+1|0};function Is(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 Js(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 Ks(a,b,c){F&&(C(b,ws,"crossingMatrix:unfixedLayer"),C(c,ws,"crossingMatrix:direction"));var d=Fs(a,b),e=a.mc[b];if(null===a.fp||a.fp.length<e*e)a.fp=[];for(var f=a.fp,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.kk===l.kk||h++}else for(m=g-1;m>k;m--)n=d[m],n.near===l&&n.kk===l.kk||h++;var p;if(0<=c)for(k=d[g].sourceEdgesArrayAccess,l=0;l<k.length;l++){var r=k[l];if(r.valid&&r.fromVertex.layer!==b)for(n=
r.fromVertex.index,m=r.portToPos,r=r.portFromPos,p=l+1;p<k.length;p++){var q=k[p];if(q.valid&&q.fromVertex.layer!==b){var u=q.fromVertex.index;var w=q.portToPos;q=q.portFromPos;m<w&&(n>u||n===u&&r>q)&&h++;w<m&&(u>n||u===n&&q>r)&&h++}}}if(0>=c)for(k=d[g].destinationEdgesArrayAccess,l=0;l<k.length;l++)if(r=k[l],r.valid&&r.toVertex.layer!==b)for(n=r.toVertex.index,m=r.portToPos,r=r.portFromPos,p=l+1;p<k.length;p++)q=k[p],q.valid&&q.toVertex.layer!==b&&(u=q.toVertex.index,w=q.portToPos,q=q.portFromPos,
r<q&&(n>u||n===u&&m>w)&&h++,q<r&&(u>n||u===n&&w>m)&&h++);f[g*e+g]=h;for(k=g+1;k<e;k++){var y=0,z=0;if(0<=c){h=d[g].sourceEdgesArrayAccess;var B=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<B.length;p++)q=B[p],q.valid&&q.fromVertex.layer!==b&&(u=q.fromVertex.index,q=q.portFromPos,(n<u||n===u&&r<q)&&z++,(u<n||u===n&&q<r)&&y++)}if(0>=c)for(h=d[g].destinationEdgesArrayAccess,B=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<B.length;p++)q=B[p],q.valid&&q.toVertex.layer!==b&&(u=q.toVertex.index,w=q.portToPos,(n<u||n===u&&m<w)&&z++,(u<n||u===n&&w<m)&&y++);f[g*e+k]=y;f[k*e+g]=z}}Gs(a,b,d);return f}ws.prototype.countCrossings=function(){for(var a=0,b=0;b<=this.Ea;b++)for(var c=Ks(this,b,1),d=this.mc[b],e=0;e<d;e++)for(var f=e;f<d;f++)a+=c[e*d+f];return a};
function Ls(a){for(var b=0,c=0;c<=a.Ea;c++){for(var d=a,e=c,f=Fs(d,e),g=d.mc[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)*Hs(n)}}}Gs(d,e,f);b+=h}return b}
ws.prototype.normalize=function(){var a=Infinity;this.Ja=-1;for(var b=this.network.vertexes.iterator;b.next();){var c=b.value;a=Math.min(a,c.column-this.nodeMinColumnSpace(c,!0));this.Ja=Math.max(this.Ja,c.column+this.nodeMinColumnSpace(c,!1))}for(b.reset();b.next();)b.value.column-=a;this.Ja-=a};
function Ms(a,b,c){F&&(C(b,ws,"barycenters:unfixedLayer"),C(c,ws,"barycenters:direction"));for(var d=Fs(a,b),e=a.mc[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}Gs(a,b,d);return f}
function Ns(a,b,c){F&&(C(b,ws,"medians:unfixedLayer"),C(c,ws,"medians:direction"));for(var d=Fs(a,b),e=a.mc[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)}Gs(a,b,d);return f}
function Os(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&&Os(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&&Os(a,k,c,d,e,f)}}
function Ps(a,b,c,d,e,f){if(b.component===d){b.component=c;if(e)for(var g=b.destinationEdges;g.next();)Ps(a,g.value.toVertex,c,d,e,f);if(f)for(b=b.sourceEdges;b.next();)Ps(a,b.value.fromVertex,c,d,e,f)}}
ws.prototype.removeCycles=function(){for(var a=this.network.edges.iterator;a.next();)a.value.rev=!1;switch(this.dl){default:case Qs: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!==Rs(a);){for(e=Ss(a);null!==e;)d[c]=e,c--,e.valid=!1,e=Ss(a);for(e=Ts(a);null!==e;)d[b]=e,b++,e.valid=!1,e=Ts(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.Vm(b),b.rev=!0);break;case xs:for(d=this.network.vertexes.iterator;d.next();)a=d.value,a.wm=-1,a.finish=-1;for(a=this.network.edges.iterator;a.next();)a.value.forest=!1;this.gp=0;for(d.reset();d.next();)b=d.value,0===b.sourceEdges.count&&
Us(this,b);for(d.reset();d.next();)b=d.value,-1===b.wm&&Us(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.wm<b.wm&&c<f&&(this.network.Vm(d),d.rev=!0));break;case Cs: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.Vm(b),b.rev=!0)}}};function Rs(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid)return b}return null}function Ss(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 Ts(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 Us(a,b){b.wm=a.gp;a.gp++;for(var c=b.destinationEdges;c.next();){var d=c.value,e=d.toVertex;-1===e.wm&&(d.forest=!0,Us(a,e))}b.finish=a.gp;a.gp++}
ws.prototype.assignLayers=function(){switch(this.Il){case Vs:Ws(this);break;case Xs:for(var a,b=this.network.vertexes.iterator;b.next();)a=Ys(this,b.value),this.Ea=Math.max(a,this.Ea);for(b.reset();b.next();)a=b.value,a.layer=this.Ea-a.layer;break;default:case ys:Ws(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&&Zs(this,a);a=Infinity;for(b.reset();b.next();)a=Math.min(a,b.value.layer);this.Ea=-1;for(b.reset();b.next();){var c=
b.value;c.layer-=a;this.Ea=Math.max(this.Ea,c.layer)}}};function Ws(a){for(var b=a.network.vertexes.iterator;b.next();){var c=$s(a,b.value);a.Ea=Math.max(c,a.Ea)}}function $s(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,$s(a,f)+e)}b.layer=c}else c=b.layer;return c}
function Ys(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,Ys(a,f)+e)}b.layer=c}else c=b.layer;return c}
function Zs(a,b){if(!b.valid){b.valid=!0;for(var c=b.destinationEdges;c.next();)Zs(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&&Os(a,h,0,-1,!0,!1)}for(Os(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(Os(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 Es(a,b,c){return 90===a.M?c&&!b.rev||!c&&b.rev?270:90:180===a.M?c&&!b.rev||!c&&b.rev?0:180:270===a.M?c&&!b.rev||!c&&b.rev?90:270:c&&!b.rev||!c&&b.rev?180:0}
ws.prototype.initializeIndices=function(){switch(this.xl){default:case at:for(var a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;b.index=this.mc[c];this.mc[c]++}break;case zs:a=this.network.vertexes.iterator;for(b=this.Ea;0<=b;b--)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&bt(this,c);break;case ct:for(a=this.network.vertexes.iterator,b=0;b<=this.Ea;b++)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&dt(this,c)}};
function bt(a,b){var c=b.layer;b.index=a.mc[c];a.mc[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&&bt(a,d))}
function dt(a,b){var c=b.layer;b.index=a.mc[c];a.mc[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&&dt(a,d))}
ws.prototype.reduceCrossings=function(){var a=this.countCrossings(),b=Is(this),c,d;for(c=0;c<this.Oj;c++){for(d=0;d<=this.Ea;d++)et(this,d,1),ft(this,d,1);var e=this.countCrossings();e<a&&(a=e,b=Is(this));for(d=this.Ea;0<=d;d--)et(this,d,-1),ft(this,d,-1);e=this.countCrossings();e<a&&(a=e,b=Is(this))}Js(this,b);for(c=0;c<this.Oj;c++){for(d=0;d<=this.Ea;d++)et(this,d,0),ft(this,d,0);e=this.countCrossings();e<a&&(a=e,b=Is(this));for(d=this.Ea;0<=d;d--)et(this,d,0),ft(this,d,0);e=this.countCrossings();
e<a&&(a=e,b=Is(this))}Js(this,b);var f,g,h;switch(this.Tk){case gt:break;case ht:for(h=a+1;(d=this.countCrossings())<h;)for(h=d,c=this.Ea;0<=c;c--)for(g=0;g<=c;g++){for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=ft(this,d,-1)||f;e=this.countCrossings();e>=a?Js(this,b):(a=e,b=Is(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=ft(this,d,1)||f;e=this.countCrossings();e>=a?Js(this,b):(a=e,b=Is(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=ft(this,d,1)||f;e>=a?Js(this,b):(a=e,b=Is(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=
ft(this,d,-1)||f;e>=a?Js(this,b):(a=e,b=Is(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=ft(this,d,0)||f;e>=a?Js(this,b):(a=e,b=Is(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=ft(this,d,0)||f;e>=a?Js(this,b):(a=e,b=Is(this))}break;default:case As:for(c=this.Ea,g=0,h=a+1;(d=this.countCrossings())<h;){h=d;for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=ft(this,d,-1)||f;e=this.countCrossings();e>=a?Js(this,b):(a=e,b=Is(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=ft(this,d,1)||f;e=this.countCrossings();e>=a?Js(this,b):
(a=e,b=Is(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=ft(this,d,1)||f;e>=a?Js(this,b):(a=e,b=Is(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=ft(this,d,-1)||f;e>=a?Js(this,b):(a=e,b=Is(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=ft(this,d,0)||f;e>=a?Js(this,b):(a=e,b=Is(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=ft(this,d,0)||f;e>=a?Js(this,b):(a=e,b=Is(this))}}Js(this,b)};
function et(a,b,c){F&&(C(b,ws,"medianBarycenterCrossingReduction:unfixedLayer"),C(c,ws,"medianBarycenterCrossingReduction:direction"));var d=Fs(a,b),e=a.mc[b],f=Ns(a,b,c),g=Ms(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);Gs(a,b,d)}
function ft(a,b,c){var d=Fs(a,b),e=a.mc[b];c=Ks(a,b,c);var f;var g=[];for(f=0;f<e;f++)g[f]=-1;var h=[];for(f=0;f<e;f++)h[f]=-1;for(var k=!1,l=!0;l;)for(l=!1,f=0;f<e-1;f++){var m=c[d[f].index*e+d[f+1].index],n=c[d[f+1].index*e+d[f].index],p=0,r=0,q=d[f].column,u=d[f+1].column,w=a.nodeMinColumnSpace(d[f],!0),y=a.nodeMinColumnSpace(d[f],!1),z=a.nodeMinColumnSpace(d[f+1],!0),B=a.nodeMinColumnSpace(d[f+1],!1);w=q-w+z;y=u-y+B;var D=d[f].sourceEdges.iterator;for(D.reset();D.next();)if(z=D.value,B=z.fromVertex,
z.valid&&B.layer===b){for(z=0;d[z]!==B;)z++;z<f&&(p+=2*(f-z),r+=2*(f+1-z));z===f+1&&(p+=1);z>f+1&&(p+=4*(z-f),r+=4*(z-(f+1)))}D=d[f].destinationEdges.iterator;for(D.reset();D.next();)if(z=D.value,B=z.toVertex,z.valid&&B.layer===b){for(z=0;d[z]!==B;)z++;z===f+1&&(r+=1)}D=d[f+1].sourceEdges.iterator;for(D.reset();D.next();)if(z=D.value,B=z.fromVertex,z.valid&&B.layer===b){for(z=0;d[z]!==B;)z++;z<f&&(p+=2*(f+1-z),r+=2*(f-z));z===f&&(r+=1);z>f+1&&(p+=4*(z-(f+1)),r+=4*(z-f))}D=d[f+1].destinationEdges.iterator;
for(D.reset();D.next();)if(z=D.value,B=z.toVertex,z.valid&&B.layer===b){for(z=0;d[z]!==B;)z++;z===f&&(p+=1)}z=B=0;D=g[d[f].index];var G=h[d[f].index],O=g[d[f+1].index],V=h[d[f+1].index];-1!==D&&(B+=Math.abs(D-q),z+=Math.abs(D-y));-1!==G&&(B+=Math.abs(G-q),z+=Math.abs(G-y));-1!==O&&(B+=Math.abs(O-u),z+=Math.abs(O-w));-1!==V&&(B+=Math.abs(V-u),z+=Math.abs(V-w));if(r<p-.5||r===p&&n<m-.5||r===p&&n===m&&z<B-.5)l=k=!0,d[f].column=y,d[f+1].column=w,m=d[f],d[f]=d[f+1],d[f+1]=m}for(f=0;f<e;f++)d[f].index=
f;Gs(a,b,d);return k}
ws.prototype.straightenAndPack=function(){var a=0!==(this.vg&1);var b=7===this.vg;1E3<this.network.edges.count&&!b&&(a=!1);if(a){var c=[];for(b=0;b<=this.Ea;b++)c[b]=0;for(var d,e=this.network.vertexes.iterator;e.next();){var f=e.value;b=f.layer;d=f.column;f=this.nodeMinColumnSpace(f,!1);c[b]=Math.max(c[b],d+f)}for(e.reset();e.next();)f=e.value,b=f.layer,d=f.column,f.column=(8*(this.Ja-c[b])>>1)+8*d;this.Ja*=8}if(0!==(this.vg&2))for(c=!0;c;){c=!1;for(b=this.yd+1;b<=this.Ea;b++)c=it(this,b,1)||c;for(b=
this.yd-1;0<=b;b--)c=it(this,b,-1)||c;c=it(this,this.yd,0)||c}if(0!==(this.vg&4)){for(b=this.yd+1;b<=this.Ea;b++)jt(this,b,1);for(b=this.yd-1;0<=b;b--)jt(this,b,-1);jt(this,this.yd,0)}a&&(kt(this,-1),kt(this,1));if(0!==(this.vg&2))for(c=!0;c;){c=!1;c=it(this,this.yd,0)||c;for(b=this.yd+1;b<=this.Ea;b++)c=it(this,b,0)||c;for(b=this.yd-1;0<=b;b--)c=it(this,b,0)||c}};
function it(a,b,c){F&&(C(b,ws,"bendStraighten:unfixedLayer"),C(c,ws,"bendStraighten:direction"));for(var d=!1;lt(a,b,c);)d=!0;return d}
function lt(a,b,c){F&&(C(b,ws,"shiftbendStraighten:unfixedLayer"),C(c,ws,"shiftbendStraighten:direction"));var d,e=Fs(a,b),f=a.mc[b],g=Ms(a,b,-1);if(0<c)for(d=0;d<f;d++)g[d]=-1;var h=Ms(a,b,1);if(0>c)for(d=0;d<f;d++)h[d]=-1;for(var k=!1,l=!0;l;)for(l=!1,d=0;d<f;d++){var m=e[d].column,n=a.nodeMinColumnSpace(e[d],!0),p=a.nodeMinColumnSpace(e[d],!1),r=0;0>d-1||m-e[d-1].column-1>n+a.nodeMinColumnSpace(e[d-1],!1)?r=m-1:r=m;n=d+1>=f||e[d+1].column-m-1>p+a.nodeMinColumnSpace(e[d+1],!0)?m+1:m;var q=p=0,u=
0;if(0>=c)for(var w=e[d].sourceEdges.iterator;w.next();){var y=w.value;var z=y.fromVertex;if(y.valid&&z.layer!==b){var B=Hs(y);var D=y.portFromColOffset;y=y.portToColOffset;z=z.column;p+=(Math.abs(m+y-(z+D))+1)*B;q+=(Math.abs(r+y-(z+D))+1)*B;u+=(Math.abs(n+y-(z+D))+1)*B}}if(0<=c)for(w=e[d].destinationEdges.iterator;w.next();)y=w.value,z=y.toVertex,y.valid&&z.layer!==b&&(B=Hs(y),D=y.portFromColOffset,y=y.portToColOffset,z=z.column,p+=(Math.abs(m+D-(z+y))+1)*B,q+=(Math.abs(r+D-(z+y))+1)*B,u+=(Math.abs(n+
D-(z+y))+1)*B);y=D=B=0;w=g[e[d].index];z=h[e[d].index];-1!==w&&(B+=Math.abs(w-m),D+=Math.abs(w-r),y+=Math.abs(w-n));-1!==z&&(B+=Math.abs(z-m),D+=Math.abs(z-r),y+=Math.abs(z-n));if(q<p||q===p&&D<B)l=k=!0,e[d].column=r;else if(u<p||u===p&&y<B)l=k=!0,e[d].column=n}Gs(a,b,e);a.normalize();return k}
function jt(a,b,c){F&&(C(b,ws,"medianStraighten:unfixedLayer"),C(c,ws,"medianStraighten:direction"));var d=Fs(a,b),e=a.mc[b],f=Ns(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)}Gs(a,b,
d);a.normalize()}function mt(a,b){F&&(C(b,ws,"packAux:column"),C(1,ws,"packAux:direction"));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 nt(a,b){F&&(C(b,ws,"tightPackAux:column"),C(1,ws,"tightPackAux:direction"));var c=b+1;var d,e=[],f=[];for(d=0;d<=a.Ea;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.Ea;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 kt(a,b){F&&C(b,ws,"componentPack:direction");for(var c=0;c<=a.Ja;c++)for(;mt(a,c););a.normalize();for(c=0;c<a.Ja;c++)for(;nt(a,c););a.normalize();var d;if(0<b)for(c=0;c<=a.Ja;c++){var e=Is(a);var f=Ls(a);for(d=f+1;f<d;){d=f;ot(a,c,1);var g=Ls(a);g>f?Js(a,e):g<f&&(f=g,e=Is(a))}}if(0>b)for(c=a.Ja;0<=c;c--)for(e=Is(a),f=Ls(a),d=f+1;f<d;)d=f,ot(a,c,-1),g=Ls(a),g>f?Js(a,e):g<f&&(f=g,e=Is(a));a.normalize()}
function ot(a,b,c){a.Xd=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.Xd)}if(0>c)for(d.reset();d.next();)e=d.value,e.column+a.nodeMinColumnSpace(e,!1)>=b&&(e.component=a.Xd);a.Xd++;for(d.reset();d.next();)b=d.value,-1===b.component&&(Ps(a,b,a.Xd,-1,!0,!0),a.Xd++);var f;b=[];for(f=0;f<a.Xd*a.Xd;f++)b[f]=!1;e=[];for(f=0;f<(a.Ea+1)*(a.Ja+1);f++)e[f]=-1;for(d.reset();d.next();){f=
d.value;for(var g=f.layer,h=Math.max(0,f.column-a.nodeMinColumnSpace(f,!0)),k=Math.min(a.Ja,f.column+a.nodeMinColumnSpace(f,!1));h<=k;h++)e[g*(a.Ja+1)+h]=f.component}for(f=0;f<=a.Ea;f++){if(0<c)for(g=0;g<a.Ja;g++)-1!==e[f*(a.Ja+1)+g]&&-1!==e[f*(a.Ja+1)+g+1]&&e[f*(a.Ja+1)+g]!==e[f*(a.Ja+1)+g+1]&&(b[e[f*(a.Ja+1)+g]*a.Xd+e[f*(a.Ja+1)+g+1]]=!0);if(0>c)for(g=a.Ja;0<g;g--)-1!==e[f*(a.Ja+1)+g]&&-1!==e[f*(a.Ja+1)+g-1]&&e[f*(a.Ja+1)+g]!==e[f*(a.Ja+1)+g-1]&&(b[e[f*(a.Ja+1)+g]*a.Xd+e[f*(a.Ja+1)+g-1]]=!0)}e=
[];for(f=0;f<a.Xd;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.Xd;f++)b[k*a.Xd+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)}
ws.prototype.commitLayout=function(){if(this.setsPortSpots)for(var a=Ds(this,!0),b=Ds(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.Iv();this.isRouting&&this.commitLinks()};function Ds(a,b){return 270===a.M?b?qd:td:90===a.M?b?td:qd:180===a.M?b?rd:sd:b?sd:rd}
ws.prototype.commitNodes=function(){this.Td=[];this.xd=[];this.wd=[];this.Ma=[];for(var a=0;a<=this.Ea;a++)this.Td[a]=0,this.xd[a]=0,this.wd[a]=0,this.Ma[a]=0;for(a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;this.Td[c]=Math.max(this.Td[c],this.nodeMinLayerSpace(b,!0));this.xd[c]=Math.max(this.xd[c],this.nodeMinLayerSpace(b,!1))}b=0;c=this.ze;for(var d=0;d<=this.Ea;d++){var e=c;0>=this.Td[d]+this.xd[d]&&(e=0);0<d&&(b+=e/2);90===this.M||0===this.M?(b+=this.xd[d],this.wd[d]=b,
b+=this.Td[d]):(b+=this.Td[d],this.wd[d]=b,b+=this.xd[d]);d<this.Ea&&(b+=e/2);this.Ma[d]=b}c=b;b=this.arrangementOrigin;for(d=0;d<=this.Ea;d++)270===this.M?this.wd[d]=b.y+this.wd[d]:90===this.M?(this.wd[d]=b.y+c-this.wd[d],this.Ma[d]=c-this.Ma[d]):180===this.M?this.wd[d]=b.x+this.wd[d]:(this.wd[d]=b.x+c-this.wd[d],this.Ma[d]=c-this.Ma[d]);a.reset();for(c=d=Infinity;a.next();){e=a.value;var f=e.layer,g=e.column|0;if(270===this.M||90===this.M){var h=b.x+this.ec*g;f=this.wd[f]}else h=this.wd[f],f=b.y+
this.ec*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.Sf=new J(d,b);for(a.reset();a.next();)c=a.value,c.x+=d,c.y+=b,c.commit()};
ws.prototype.Iv=function(){for(var a=0,b=this.ze,c=0;c<=this.Ea;c++)a+=this.Td[c],a+=this.xd[c];a+=this.Ea*b;b=[];c=this.ec*this.Ja;for(var d=this.maxLayer;0<=d;d--)270===this.M?0===d?b.push(new L(0,0,c,Math.abs(this.Ma[0]))):b.push(new L(0,this.Ma[d-1],c,Math.abs(this.Ma[d-1]-this.Ma[d]))):90===this.M?0===d?b.push(new L(0,this.Ma[0],c,Math.abs(this.Ma[0]-a))):b.push(new L(0,this.Ma[d],c,Math.abs(this.Ma[d-1]-this.Ma[d]))):180===this.M?0===d?b.push(new L(0,0,Math.abs(this.Ma[0]),c)):b.push(new L(this.Ma[d-
1],0,Math.abs(this.Ma[d-1]-this.Ma[d]),c)):0===d?b.push(new L(this.Ma[0],0,Math.abs(this.Ma[0]-a),c)):b.push(new L(this.Ma[d],0,Math.abs(this.Ma[d-1]-this.Ma[d]),c));this.commitLayers(b,this.Sf)};ws.prototype.commitLayers=function(){};
ws.prototype.commitLinks=function(){for(var a=this.network.edges.iterator,b;a.next();)b=a.value.link,null!==b&&(b.Xh(),b.mk(),b.Df());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.Xh();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===rg&&4===b.pointsCount)if(m.column===n.column)c=b.getLinkPoint(e,g,l,!0,!1,f,h),g=b.getLinkPoint(f,h,k,!1,!1,e,g),c.o()||c.set(e.actualBounds.center),g.o()||g.set(f.actualBounds.center),b.mk(),b.Cf(c.x,c.y),b.Cf((2*c.x+g.x)/3,(2*c.y+g.y)/3),b.Cf((c.x+2*g.x)/3,(c.y+2*g.y)/3),b.Cf(g.x,g.y);else{var p=!1,r=!1;null!==g&&l===Gc&&(p=!0);null!==h&&k===Gc&&(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.M||270===this.M?(p=q,n=
(c+d)/2):(p=(q+m)/2,n=c),b.N(1,p,n),l=b.getLinkPoint(e,g,l,!0,!1,f,h),l.o()||l.set(e.actualBounds.center),b.N(0,l.x,l.y));r&&(90===this.M||270===this.M?(l=m,c=(c+d)/2):(l=(q+m)/2,c=d),b.N(2,l,c),e=b.getLinkPoint(f,h,k,!1,!1,e,g),e.o()||e.set(f.actualBounds.center),b.N(3,e.x,e.y))}}b.Df()}else if(m.layer===n.layer)b.Df();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===rg)r=!0,u=b.pointsCount,4<u&&b.points.removeRange(2,
u-3),4===u&&(q=2);else{u=b.pointsCount;var w=l===Gc,y=k===Gc;2<u&&w&&y?b.points.removeRange(1,u-2):3<u&&w&&!y?b.points.removeRange(1,u-3):3<u&&!w&&y?b.points.removeRange(2,u-2):4<u&&!w&&!y&&b.points.removeRange(2,u-3)}if(c.rev){for(;null!==n&&m!==n;){var z=u=null;for(w=n.sourceEdges.iterator;w.next()&&(y=w.value,y.link!==c.link||(u=y.fromVertex,z=y.toVertex,null!==u.node)););if(u!==m){w=b.i(q-1).x;y=b.i(q-1).y;var B=u.centerX;var D=u.centerY;if(p)180===this.M||0===this.M?q===b.firstPickIndex+1?(b.m(q++,
w,y),b.m(q++,w,D)):(null!==z?z.centerY:y)!==D&&(z=this.Ma[u.layer-1]+this.Sf.x,b.m(q++,z,y),b.m(q++,z,D)):q===b.firstPickIndex+1?(b.m(q++,w,y),b.m(q++,B,y)):(null!==z?z.centerX:w)!==B&&(z=this.Ma[u.layer-1]+this.Sf.y,b.m(q++,w,z),b.m(q++,B,z));else if(q===b.firstPickIndex+1){z=Math.max(10,this.Td[n.layer]);var G=Math.max(10,this.xd[n.layer]);if(r)180===this.M?B<=n.bounds.x?(n=n.bounds.x,b.m(q++,n-z,D),b.m(q++,n,D),b.m(q++,n+G,D)):(b.m(q++,B-z,D),b.m(q++,B,D),b.m(q++,B+G,D)):90===this.M?D>=n.bounds.bottom?
(n=n.bounds.y+n.bounds.height,b.m(q++,B,n+G),b.m(q++,B,n),b.m(q++,B,n-z)):(b.m(q++,B,D+G),b.m(q++,B,D),b.m(q++,B,D-z)):270===this.M?D<=n.bounds.y?(n=n.bounds.y,b.m(q++,B,n-z),b.m(q++,B,n),b.m(q++,B,n+G)):(b.m(q++,B,D-z),b.m(q++,B,D),b.m(q++,B,D+G)):0===this.M&&(B>=n.bounds.right?(n=n.bounds.x+n.bounds.width,b.m(q++,n+G,D),b.m(q++,n,D),b.m(q++,n-z,D)):(b.m(q++,B+G,D),b.m(q++,B,D),b.m(q++,B-z,D)));else{b.m(q++,w,y);var O=0;if(180===this.M||0===this.M){if(180===this.M?B>=n.bounds.right:B<=n.bounds.x)O=
(0===this.M?-z:G)/2;b.m(q++,w+O,D)}else{if(270===this.M?D>=n.bounds.bottom:D<=n.bounds.y)O=(90===this.M?-z:G)/2;b.m(q++,B,y+O)}b.m(q++,B,D)}}else z=Math.max(10,this.Td[u.layer]),G=Math.max(10,this.xd[u.layer]),180===this.M?(r&&b.m(q++,B-z,D),b.m(q++,B,D),r&&b.m(q++,B+G,D)):90===this.M?(r&&b.m(q++,B,D+G),b.m(q++,B,D),r&&b.m(q++,B,D-z)):270===this.M?(r&&b.m(q++,B,D-z),b.m(q++,B,D),r&&b.m(q++,B,D+G)):(r&&b.m(q++,B+G,D),b.m(q++,B,D),r&&b.m(q++,B-z,D))}n=u}if(null===h||l!==Gc||p)if(w=b.i(q-1).x,y=b.i(q-
1).y,B=b.i(q).x,D=b.i(q).y,p)n=this.xd[m.layer],180===this.M||0===this.M?(p=y,p>=m.bounds.y&&p<=m.bounds.bottom&&(180===this.M?B>=m.bounds.x:B<=m.bounds.right)&&(n=m.centerX+(180===this.M?-n:n),p<m.bounds.y+m.bounds.height/2?p=m.bounds.y-this.ec/2:p=m.bounds.bottom+this.ec/2,b.m(q++,n,y),b.m(q++,n,p)),b.m(q++,B,p)):(p=w,p>=m.bounds.x&&p<=m.bounds.right&&(270===this.M?D>=m.bounds.y:D<=m.bounds.bottom)&&(n=m.centerY+(270===this.M?-n:n),p<m.bounds.x+m.bounds.width/2?p=m.bounds.x-this.ec/2:p=m.bounds.right+
this.ec/2,b.m(q++,w,n),b.m(q++,p,n)),b.m(q++,p,D)),b.m(q++,B,D);else if(r)z=Math.max(10,this.Td[m.layer]),G=Math.max(10,this.xd[m.layer]),180===this.M&&B>=m.bounds.x?(n=m.bounds.x+m.bounds.width,b.N(q-2,n,y),b.N(q-1,n+G,y)):90===this.M&&D<=m.bounds.bottom?(n=m.bounds.y,b.N(q-2,w,n),b.N(q-1,w,n-z)):270===this.M&&D>=m.bounds.y?(n=m.bounds.y+m.bounds.height,b.N(q-2,w,n),b.N(q-1,w,n+G)):0===this.M&&B<=m.bounds.right&&(n=m.bounds.x,b.N(q-2,n,y),b.N(q-1,n-z,y));else{z=Math.max(10,this.Td[m.layer]);G=Math.max(10,
this.xd[m.layer]);p=0;if(180===this.M||0===this.M){if(180===this.M?B<=m.bounds.x:B>=m.bounds.right)p=(0===this.M?G:-z)/2;b.m(q++,B+p,y)}else{if(270===this.M?D<=m.bounds.y:D>=m.bounds.bottom)p=(90===this.M?G:-z)/2;b.m(q++,w,D+p)}b.m(q++,B,D)}}else{for(;null!==m&&m!==n;){z=u=null;for(m=m.destinationEdges.iterator;m.next()&&(w=m.value,w.link!==c.link||(u=w.toVertex,z=w.fromVertex,null!==z.node&&(z=null),null!==u.node)););u!==n&&(w=b.i(q-1).x,y=b.i(q-1).y,B=u.centerX,D=u.centerY,p?180===this.M||0===this.M?
(null!==z?z.centerY:y)!==D&&(z=this.Ma[u.layer]+this.Sf.x,q===b.firstPickIndex+1&&(z=0===this.M?Math.max(z,w):Math.min(z,w)),b.m(q++,z,y),b.m(q++,z,D)):(null!==z?z.centerX:w)!==B&&(z=this.Ma[u.layer]+this.Sf.y,q===b.firstPickIndex+1&&(z=90===this.M?Math.max(z,y):Math.min(z,y)),b.m(q++,w,z),b.m(q++,B,z)):(z=Math.max(10,this.Td[u.layer]),G=Math.max(10,this.xd[u.layer]),180===this.M?(b.m(q++,B+G,D),r&&b.m(q++,B,D),b.m(q++,B-z,D)):90===this.M?(b.m(q++,B,D-z),r&&b.m(q++,B,D),b.m(q++,B,D+G)):270===this.M?
(b.m(q++,B,D+G),r&&b.m(q++,B,D),b.m(q++,B,D-z)):(b.m(q++,B-z,D),r&&b.m(q++,B,D),b.m(q++,B+G,D))));m=u}p&&(w=b.i(q-1).x,y=b.i(q-1).y,B=b.i(q).x,D=b.i(q).y,180===this.M||0===this.M?y!==D&&(z=0===this.M?Math.min(Math.max((B+w)/2,this.Ma[n.layer]+this.Sf.x),B):Math.max(Math.min((B+w)/2,this.Ma[n.layer]+this.Sf.x),B),b.m(q++,z,y),b.m(q++,z,D)):w!==B&&(z=90===this.M?Math.min(Math.max((D+y)/2,this.Ma[n.layer]+this.Sf.y),D):Math.max(Math.min((D+y)/2,this.Ma[n.layer]+this.Sf.y),D),b.m(q++,w,z),b.m(q++,B,z)))}null!==
d&&r&&(null!==g&&(l===Gc&&(l=b.i(0),d=b.i(2),l.A(d)||b.N(1,(l.x+d.x)/2,(l.y+d.y)/2)),l=b.getLinkPoint(e,g,Gc,!0,!1,f,h),l.o()||l.set(e.actualBounds.center),b.N(0,l.x,l.y)),null!==h&&(k===Gc&&(k=b.i(b.pointsCount-1),l=b.i(b.pointsCount-3),k.A(l)||b.N(b.pointsCount-2,(k.x+l.x)/2,(k.y+l.y)/2)),e=b.getLinkPoint(f,h,Gc,!1,!1,e,g),e.o()||e.set(f.actualBounds.center),b.N(b.pointsCount-1,e.x,e.y)));b.Df();c.commit()}}}this.avoidOrthogonalOverlaps()};
ws.prototype.avoidOrthogonalOverlaps=function(){if(!(0>=this.linkSpacing)){for(var a=new H,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.M||270===this.M){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.C(f.y,g.y)&&!this.C(f.x,g.x)){var h=new pt;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.cc=l.x*l.x+l.y;h.ad=Math.min(f.x,g.x);h.zc=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.Py),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].zc;for(e=a+1;e<d&&c[e].ad<g;)g=Math.max(g,c[e].zc),e++;g=e-f;if(1<g){this.tj(c,this.ju,f,f+g);m=1;h=c[f].cc;for(k=f;k<e;k++)l=c[k],l.cc!==
h&&(m++,h=l.cc);this.tj(c,this.Oy,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].cc,this.tj(c,this.ju,f,f+g)):h=c[f].first;m=0;for(n=f;n<e;n++){var p=c[n];(k?p.first:p.cc)!==h&&(m++,h=k?p.first:p.cc);var r=p.link;f=r.i(p.index);g=r.i(p.index+1);var q=this.linkSpacing*(m-(l-1)/2);if(!r.isAvoiding||qt(f.x,f.y+q,g.x,g.y+q))b++,r.Xh(),r.N(p.index,f.x,f.y+q),r.N(p.index+1,g.x,g.y+q),r.Df()}}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.C(f.x,g.x)&&!this.C(f.y,g.y)&&(h=new pt,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.cc=l.x+l.y*l.y,h.ad=Math.min(f.y,g.y),h.zc=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.Py),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].zc;for(e=a+1;e<d&&c[e].ad<g;)g=Math.max(g,c[e].zc),e++;g=e-f;if(1<g){this.tj(c,this.ju,f,f+g);m=1;h=c[f].cc;for(k=f;k<e;k++)l=c[k],l.cc!==h&&(m++,h=l.cc);this.tj(c,this.Oy,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].cc,this.tj(c,this.ju,f,f+g)):h=c[f].first;m=0;for(n=f;n<e;n++)if(p=c[n],(k?p.first:p.cc)!==h&&(m++,h=k?p.first:p.cc),r=p.link,f=r.i(p.index),g=r.i(p.index+1),q=this.linkSpacing*
(m-(l-1)/2),!r.isAvoiding||qt(f.x+q,f.y,g.x+q,g.y))b++,r.Xh(),r.N(p.index,f.x+q,f.y),r.N(p.index+1,g.x+q,g.y),r.Df()}f=e}a=d}}}};t=ws.prototype;t.Py=function(a,b){return a instanceof pt&&b instanceof pt&&a!==b?a.layer<b.layer?-1:a.layer>b.layer?1:a.ad<b.ad?-1:a.ad>b.ad?1:a.zc<b.zc?-1:a.zc>b.zc?1:0:0};t.Oy=function(a,b){return a instanceof pt&&b instanceof pt&&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.zc<b.zc?-1:a.zc>b.zc?1:0:0};
t.ju=function(a,b){return a instanceof pt&&b instanceof pt&&a!==b?a.cc<b.cc?-1:a.cc>b.cc||a.l<b.l?1:a.l>b.l||a.ad<b.ad?-1:a.ad>b.ad?1:a.zc<b.zc?-1:a.zc>b.zc?1:0:0};t.C=function(a,b){F&&(C(a,ws,"isApprox:a"),C(b,ws,"isApprox: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)&&v("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 qt(a,b,c,d){F&&(C(a,ws,"isUnoccupied2:px"),C(b,ws,"isUnoccupied2:py"),C(c,ws,"isUnoccupied2:qx"),C(d,ws,"isUnoccupied2:qy"));return!0}function Fs(a,b){var c=a.mc[b];if(c>=a.De.length){var d=[];for(var e=0;e<a.De.length;e++)d[e]=a.De[e];a.De=d}void 0===a.De[c]||null===a.De[c]?d=[]:(d=a.De[c],a.De[c]=null);a=a.hp[b];for(b=0;b<a.length;b++)c=a[b],d[c.index]=c;return d}function Gs(a,b,c){a.De[a.mc[b]]=c}
ma.Object.defineProperties(ws.prototype,{layerSpacing:{configurable:!0,get:function(){return this.ze},set:function(a){this.ze!==a&&(A(a,"number",ws,"layerSpacing"),0<=a&&(this.ze=a,this.D()))}},columnSpacing:{configurable:!0,get:function(){return this.ec},set:function(a){this.ec!==a&&(A(a,"number",ws,"columnSpacing"),0<a&&(this.ec=a,this.D()))}},direction:{configurable:!0,get:function(){return this.M},set:function(a){this.M!==a&&(A(a,"number",ws,"direction"),
0===a||90===a||180===a||270===a?(this.M=a,this.D()):v("LayeredDigraphLayout.direction must be 0, 90, 180, or 270"))}},cycleRemoveOption:{configurable:!0,get:function(){return this.dl},set:function(a){this.dl!==a&&(hb(a,ws,ws,"cycleRemoveOption"),a===Qs||a===xs||a===Cs)&&(this.dl=a,this.D())}},layeringOption:{configurable:!0,get:function(){return this.Il},set:function(a){this.Il!==a&&(hb(a,ws,ws,"layeringOption"),a===ys||a===Vs||a===Xs)&&(this.Il=a,this.D())}},initializeOption:{configurable:!0,
enumerable:!0,get:function(){return this.xl},set:function(a){this.xl!==a&&(hb(a,ws,ws,"initializeOption"),a===zs||a===ct||a===at)&&(this.xl=a,this.D())}},iterations:{configurable:!0,get:function(){return this.Oj},set:function(a){this.Oj!==a&&(C(a,Bs,"iterations"),0<=a&&(this.Oj=a,this.D()))}},aggressiveOption:{configurable:!0,get:function(){return this.Tk},set:function(a){this.Tk!==a&&(hb(a,ws,ws,"aggressiveOption"),a===gt||a===As||a===ht)&&(this.Tk=a,this.D())}},packOption:{configurable:!0,
enumerable:!0,get:function(){return this.vg},set:function(a){this.vg!==a&&(A(a,"number",ws,"packOption"),0<=a&&8>a&&(this.vg=a,this.D()))}},setsPortSpots:{configurable:!0,get:function(){return this.qf},set:function(a){this.qf!==a&&(A(a,"boolean",ws,"setsPortSpots"),this.qf=a,this.D())}},linkSpacing:{configurable:!0,get:function(){return this.Lo},set:function(a){this.Lo!==a&&(A(a,"number",ws,"linkSpacing"),0<=a&&(this.Lo=a,this.D()))}},maxLayer:{configurable:!0,
get:function(){return this.Ea}},maxIndex:{configurable:!0,get:function(){return this.zs}},maxColumn:{configurable:!0,get:function(){return this.Ja}},minIndexLayer:{configurable:!0,get:function(){return this.Wo}},maxIndexLayer:{configurable:!0,get:function(){return this.yd}}});
var xs=new E(ws,"CycleDepthFirst",0),Qs=new E(ws,"CycleGreedy",1),Cs=new E(ws,"CycleFromLayers",2),ys=new E(ws,"LayerOptimalLinkLength",0),Vs=new E(ws,"LayerLongestPathSink",1),Xs=new E(ws,"LayerLongestPathSource",2),zs=new E(ws,"InitDepthFirstOut",0),ct=new E(ws,"InitDepthFirstIn",1),at=new E(ws,"InitNaive",2),gt=new E(ws,"AggressiveNone",0),As=new E(ws,"AggressiveLess",1),ht=new E(ws,"AggressiveMore",2);ws.className="LayeredDigraphLayout";ws.CycleDepthFirst=xs;ws.CycleGreedy=Qs;
ws.CycleFromLayers=Cs;ws.LayerOptimalLinkLength=ys;ws.LayerLongestPathSink=Vs;ws.LayerLongestPathSource=Xs;ws.InitDepthFirstOut=zs;ws.InitDepthFirstIn=ct;ws.InitNaive=at;ws.AggressiveNone=gt;ws.AggressiveLess=As;ws.AggressiveMore=ht;ws.PackNone=0;ws.PackExpand=1;ws.PackStraighten=2;ws.PackMedian=4;ws.PackAll=7;function pt(){this.index=this.zc=this.ad=this.cc=this.first=this.layer=0;this.link=null;this.l=0}pt.className="SegInfo";function Bs(a){hq.call(this,a)}la(Bs,hq);Bs.prototype.createVertex=function(){return new rt(this)};
Bs.prototype.createEdge=function(){return new st(this)};Bs.className="LayeredDigraphNetwork";function rt(a){kq.call(this,a);this.Ua=this.Xg=this.Hi=-1;this.L=NaN;this.W=null;this.valid=!1;this.finish=this.wm=NaN;this.kk=0;this.mw=this.nw=null}la(rt,kq);
ma.Object.defineProperties(rt.prototype,{layer:{configurable:!0,get:function(){return this.Hi},set:function(a){this.Hi!==a&&(A(a,"number",rt,"layer"),this.Hi=a)}},column:{configurable:!0,get:function(){return this.Xg},set:function(a){this.Xg!==a&&(A(a,"number",rt,"column"),this.Xg=a)}},index:{configurable:!0,get:function(){return this.Ua},set:function(a){this.Ua!==a&&(A(a,"number",rt,"index"),this.Ua=a)}},component:{configurable:!0,get:function(){return this.L},
set:function(a){this.L!==a&&(A(a,"number",rt,"component"),this.L=a)}},near:{configurable:!0,get:function(){return this.W},set:function(a){this.W!==a&&(F&&null!==a&&x(a,rt,rt,"near"),this.W=a)}}});rt.className="LayeredDigraphVertex";function st(a){lq.call(this,a);this.l=this.Oa=this.ib=!1;this.Na=this.L=NaN;this.W=this.w=0}la(st,lq);
ma.Object.defineProperties(st.prototype,{valid:{configurable:!0,get:function(){return this.ib},set:function(a){this.ib!==a&&(A(a,"boolean",st,"valid"),this.ib=a)}},rev:{configurable:!0,get:function(){return this.Oa},set:function(a){this.Oa!==a&&(A(a,"boolean",st,"rev"),this.Oa=a)}},forest:{configurable:!0,get:function(){return this.l},set:function(a){this.l!==a&&(A(a,"boolean",st,"forest"),this.l=a)}},portFromPos:{configurable:!0,get:function(){return this.L},
set:function(a){this.L!==a&&(A(a,"number",st,"portFromPos"),this.L=a)}},portToPos:{configurable:!0,get:function(){return this.Na},set:function(a){this.Na!==a&&(A(a,"number",st,"portToPos"),this.Na=a)}},portFromColOffset:{configurable:!0,get:function(){return this.w},set:function(a){this.w!==a&&(A(a,"number",st,"portFromColOffset"),this.w=a)}},portToColOffset:{configurable:!0,get:function(){return this.W},set:function(a){this.W!==a&&(A(a,"number",st,"portToColOffset"),
this.W=a)}}});st.className="LayeredDigraphEdge";function Z(){0<arguments.length&&za(Z);Ni.call(this);this.Pb=new I;this.wp=tt;this.fd=ut;this.rq=vt;this.ys=wt;this.nx=[];this.ed=!0;this.Ib=xt;this.Jd=(new Hb(10,10)).freeze();var a=new yt(this);this.Y=new zt(a);this.Z=new zt(a);this.vv=[]}la(Z,Ni);
Z.prototype.cloneProtected=function(a){Ni.prototype.cloneProtected.call(this,a);a.wp=this.wp;a.rq=this.rq;a.ys=this.ys;a.ed=this.ed;a.Ib=this.Ib;a.Jd.assign(this.Jd);a.Y.copyInheritedPropertiesFrom(this.Y);a.Z.copyInheritedPropertiesFrom(this.Z)};
Z.prototype.mb=function(a){a.classType===Z?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:v("Unknown enum value: "+a):Ni.prototype.mb.call(this,a)};Z.prototype.createNetwork=function(){return new yt(this)};
Z.prototype.makeNetwork=function(a){function b(a){if(a instanceof T)return!a.isLinkLabel&&"Comment"!==a.category;if(a instanceof R){var b=a.fromNode;if(null===b||b.isLinkLabel||"Comment"===b.category)return!1;a=a.toNode;return null===a||a.isLinkLabel||"Comment"===a.category?!1:!0}return!1}var c=this.createNetwork();a instanceof Q?(c.Gg(a.nodes,!0,b),c.Gg(a.links,!0,b)):a instanceof Hf?c.Gg(a.memberParts,!1,b):c.Gg(a.iterator,!1,b);return c};
Z.prototype.doLayout=function(a){F&&null===a&&v("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");null===this.network&&(this.network=this.makeNetwork(a));this.arrangement!==At&&(this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin));var b=this.diagram;null===b&&a instanceof Q&&(b=a);this.path===tt&&null!==b?this.fd=b.isTreePathToChildren?ut:Bt:this.fd=this.path===tt?ut:this.path;if(0<this.network.vertexes.count){this.network.Dq();
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.Pb.count){a=new I;for(b=this.Pb.iterator;b.next();){var c=b.value;c instanceof T?(c=this.network.kj(c),null!==c&&a.add(c)):c instanceof zt&&a.add(c)}this.Pb=a}0===this.Pb.count&&this.findRoots();for(a=this.Pb.copy().iterator;a.next();)b=a.value,b.initialized||(b.initialized=!0,Ct(this,b));b=this.network.vertexes;for(a=null;a=Dt(b),0<a.count;)b=Et(this,a),null!==b&&this.Pb.add(b),
b.initialized=!0,Ct(this,b),b=a;for(a=this.Pb.iterator;a.next();)b=a.value,b instanceof zt&&Ft(this,b);for(a=this.Pb.iterator;a.next();)b=a.value,b instanceof zt&&Gt(this,b);for(a=this.Pb.iterator;a.next();)b=a.value,b instanceof zt&&Ht(this,b);this.Gv();if(this.layerStyle===It){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.nx=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===Jt)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.Pb.iterator;a.next();)b=a.value,b instanceof zt&&this.layoutTree(b);this.arrangeTrees();this.updateParts()}this.network=null;this.Pb=new I;this.isValidLayout=!0};function Dt(a){var b=new I;for(a=a.iterator;a.next();){var c=a.value;c.initialized||b.add(c)}return b}
Z.prototype.findRoots=function(){for(var a=this.network.vertexes,b=a.iterator;b.next();){var c=b.value;switch(this.fd){case ut:0===c.sourceEdges.count&&this.Pb.add(c);break;case Bt:0===c.destinationEdges.count&&this.Pb.add(c);break;default:v("Unhandled path value "+this.fd.toString())}}0===this.Pb.count&&(a=Et(this,a),null!==a&&this.Pb.add(a))};
function Et(a,b){var c=999999,d=null;for(b=b.iterator;b.next();){var e=b.value;switch(a.fd){case ut:e.sourceEdges.count<c&&(c=e.sourceEdges.count,d=e);break;case Bt:e.destinationEdges.count<c&&(c=e.destinationEdges.count,d=e);break;default:v("Unhandled path value "+a.fd.toString())}}return d}
function Ct(a,b){if(null!==b){F&&x(b,zt,Z,"walkTree:v");switch(a.fd){case ut:if(0<b.destinationEdges.count){for(var c=new H,d=b.destinationVertexes;d.next();){var e=d.value;Kt(a,b,e)&&c.add(e)}0<c.count&&(b.children=c.ua())}break;case Bt:if(0<b.sourceEdges.count){c=new H;for(d=b.sourceVertexes;d.next();)e=d.value,Kt(a,b,e)&&c.add(e);0<c.count&&(b.children=c.ua())}break;default:v("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.Pb.remove(f)}for(b=0;b<d;b++)Ct(a,c[b])}}function Kt(a,b,c){F&&x(b,zt,Z,"walkOK:v");F&&x(c,zt,Z,"walkOK:c");if(c.initialized){if(null===b)var d=!1;else{F&&x(c,zt,Z,"isAncestor:a");F&&x(b,zt,Z,"isAncestor:b");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}
Z.prototype.removeChild=function(a,b){if(null!==a&&null!==b){F&&x(a,zt,Z,"removeChild:p");F&&x(b,zt,Z,"removeChild:c");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 Ft(a,b){if(null!==b){F&&x(b,zt,Z,"initializeTree:v");a.initializeTreeVertexValues(b);b.alignment===Lt&&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];Ft(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 Mt(a,b){F&&x(b,zt,Z,"mom:v");switch(a.rq){default:case vt:return null!==b.parent?b.parent:a.Y;case Nt:return null===b.parent?a.Y:null===b.parent.parent?a.Z:b.parent;case Ot:return null!==b.parent?null!==b.parent.parent?b.parent.parent:a.Z:a.Y;case Pt: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.Z:null!==b.parent?b.parent:a.Y}}
Z.prototype.initializeTreeVertexValues=function(a){F&&x(a,zt,Z,"initializeTreeVertexValues:v");var b=Mt(this,a);a.copyInheritedPropertiesFrom(b);if(null!==a.parent&&a.parent.alignment===Lt){b=a.angle;for(var 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 Gt(a,b){if(null!==b){F&&x(b,zt,Z,"assignTree:v");a.assignTreeVertexValues(b);b=b.children;for(var c=b.length,d=0;d<c;d++)Gt(a,b[d])}}Z.prototype.assignTreeVertexValues=function(){};function Ht(a,b){if(null!==b){F&&x(b,zt,Z,"sortTree:v");b.alignment!==Lt&&a.sortTreeVertexChildren(b);b=b.children;for(var c=b.length,d=0;d<c;d++)Ht(a,b[d])}}
Z.prototype.sortTreeVertexChildren=function(a){F&&x(a,zt,Z,"sortTreeVertexChildren:v");switch(a.sorting){case Qt:break;case Rt:a.children.reverse();break;case St:a.children.sort(a.comparer);break;case Tt:a.children.sort(a.comparer);a.children.reverse();break;default:v("Unhandled sorting value "+a.sorting.toString())}};Z.prototype.Gv=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)};
Z.prototype.addComments=function(a){F&&x(a,zt,Z,"addComments:v");var b=a.angle,c=a.parent,d=0;var e=!1;null!==c&&(d=c.angle,e=c.alignment,e=Ut(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.Uv();l.next();){var m=l.value;"Comment"===m.category&&m.canLayout()&&(null===a.comments&&(a.comments=[]),a.comments.push(m),m.Fb(),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=L.allocAt(0,0,a.bounds.width+f,a.bounds.height+g),a.bounds=e,L.free(e))};function Ut(a){return a===Vt||a===Lt||a===Wt||a===Xt}function Yt(a){return a===Vt||a===Lt}
function Zt(a){F&&x(a,zt,Z,"isLeftSideBus:v");var b=a.parent;if(null!==b){var c=b.alignment;if(Ut(c)){if(Yt(c)){b=b.children;for(c=0;c<b.length&&a!==b[c];)c++;return 0===c%2}if(c===Wt)return!0}}return!1}
Z.prototype.layoutComments=function(a){F&&x(a,zt,Z,"layoutComments:v");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=Ut(f));d=90===d||270===d;c=90===e||270===e;for(var g=0===a.childrenCount,h=Zt(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.Dd();r.next();){var u=
r.value;u.fromSpot=rd;u.toSpot=sd}else for(n.h(a.bounds.x+2*a.focus.x-a.commentMargin,a.bounds.y+k),r.move(n),r=r.Dd();r.next();)u=r.value,u.fromSpot=sd,u.toSpot=rd;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.Dd();r.next();)u=r.value,u.fromSpot=sd,u.toSpot=rd;else for(n.h(a.bounds.x+a.commentMargin-q.width,a.bounds.y+k),r.move(n),r=r.Dd();r.next();)u=r.value,u.fromSpot=rd,u.toSpot=sd;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.Dd();r.next();)u=r.value,u.fromSpot=qd,u.toSpot=td;else for(n.h(a.bounds.x+k,a.bounds.y+2*a.focus.y-a.commentMargin),r.move(n),r=r.Dd();r.next();)u=r.value,u.fromSpot=td,u.toSpot=qd;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.Dd();r.next();)u=r.value,u.fromSpot=td,u.toSpot=qd;else for(n.h(a.bounds.x+k,a.bounds.y+
a.commentMargin-q.height),r.move(n),r=r.Dd();r.next();)u=r.value,u.fromSpot=qd,u.toSpot=td;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===ut)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)}};
Z.prototype.layoutTree=function(a){if(null!==a){F&&x(a,zt,Z,"layoutTree:v");for(var b=a.children,c=b.length,d=0;d<c;d++)this.layoutTree(b[d]);switch(a.compaction){case $t:au(this,a);break;case bu:if(a.alignment===Lt)au(this,a);else if(F&&x(a,zt,Z,"layoutTreeBlock:v"),0===a.childrenCount)d=a.parent,c=!1,b=0,null!==d&&(b=d.angle,c=d.alignment,c=Ut(c)),d=Zt(a),a.V.h(0,0),a.Aa.h(a.width,a.height),null===a.parent||null===a.comments||(180!==b&&270!==b||c)&&!d?a.ja.h(0,0):180===b&&!c||(90===b||270===b)&&
d?a.ja.h(a.width-2*a.focus.x,0):a.ja.h(0,a.height-2*a.focus.y),a.Tq=null,a.fr=null;else{var e=cu(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.Aa.width:d.Aa.height);var k=a.alignment;d=k===du;var l=k===eu,m=Ut(k),n=Math.max(0,a.breadthLimit);c=ju(a);var p=a.nodeSpacing,r=ku(a),q=a.rowSpacing,u=0;if(d||l||a.Wm||a.Xm&&1===a.maxGenerationCount)u=Math.max(0,a.rowIndent);d=a.width;var w=a.height,y=0,z=0,B=0,D=null,G=null,O=0,V=0,P=0,ca=0,Y=0,oa=0,Da=0,X=0;
m&&!Yt(k)&&135<e&&g.reverse();if(Yt(k))if(1<h)for(var Ma=0;Ma<h;Ma++)0===Ma%2&&Ma!==h-1&&(X=Math.max(X,b?g[Ma].Aa.width:g[Ma].Aa.height));else 1===h&&(X=b?g[0].Aa.width:g[0].Aa.height);if(m){switch(k){case Vt:z=135>e?lu(a,g,X,y,z):mu(a,g,X,y,z);X=z.x;y=z.width;z=z.height;break;case Wt:for(D=0;D<h;D++)G=g[D],n=G.Aa,B=0===oa?0:q,b?(G.V.h(f-n.width,ca+B),y=Math.max(y,n.width),z=Math.max(z,ca+B+n.height),ca+=B+n.height):(G.V.h(P+B,f-n.height),y=Math.max(y,P+B+n.width),z=Math.max(z,n.height),P+=B+n.width),
oa++;break;case Xt:for(D=0;D<h;D++)G=g[D],f=G.Aa,n=0===oa?0:q,b?(G.V.h(p/2+a.focus.x,ca+n),y=Math.max(y,f.width),z=Math.max(z,ca+n+f.height),ca+=n+f.height):(G.V.h(P+n,p/2+a.focus.y),y=Math.max(y,P+n+f.width),z=Math.max(z,f.height),P+=n+f.width),oa++}D=nu(this,2);G=nu(this,2);b?(D[0].h(0,0),D[1].h(0,z),G[0].h(y,0)):(D[0].h(0,0),D[1].h(y,0),G[0].h(0,z));G[1].h(y,z)}else for(Ma=0;Ma<h;Ma++){var Va=g[Ma],xb=Va.Aa;if(b){0<n&&0<oa&&P+p+xb.width>n&&(P<f&&ou(a,k,f-P,0,Da,Ma-1),Y++,oa=0,Da=Ma,B=z,P=0,ca=
135<e?-z-q:z+q);pu(this,Va,0,ca);var Ta=0;if(0===oa){if(D=Va.Tq,G=Va.fr,O=xb.width,V=xb.height,null===D||null===G||e!==cu(Va))D=nu(this,2),G=nu(this,2),D[0].h(0,0),D[1].h(0,V),G[0].h(O,0),G[1].h(O,V)}else{var Ob=La();V=qu(this,a,Va,D,G,O,V,Ob);Ta=V.x;D=Ob[0];G=Ob[1];O=V.width;V=V.height;Oa(Ob);P<xb.width&&0>Ta&&(ru(a,-Ta,0,Da,Ma-1),su(D,-Ta,0),su(G,-Ta,0),Ta=0)}Va.V.h(Ta,ca);y=Math.max(y,O);z=Math.max(z,B+(0===Y?0:q)+xb.height);P=O}else{0<n&&0<oa&&ca+p+xb.height>n&&(ca<f&&ou(a,k,0,f-ca,Da,Ma-1),Y++,
oa=0,Da=Ma,B=y,ca=0,P=135<e?-y-q:y+q);pu(this,Va,P,0);Ta=0;if(0===oa){if(D=Va.Tq,G=Va.fr,O=xb.width,V=xb.height,null===D||null===G||e!==cu(Va))D=nu(this,2),G=nu(this,2),D[0].h(0,0),D[1].h(O,0),G[0].h(0,V),G[1].h(O,V)}else Ob=La(),V=qu(this,a,Va,D,G,O,V,Ob),Ta=V.x,D=Ob[0],G=Ob[1],O=V.width,V=V.height,Oa(Ob),ca<xb.height&&0>Ta&&(ru(a,0,-Ta,Da,Ma-1),su(D,0,-Ta),su(G,0,-Ta),Ta=0);Va.V.h(P,Ta);z=Math.max(z,V);y=Math.max(y,B+(0===Y?0:q)+xb.width);ca=V}oa++}0<Y&&(b?(z+=Math.max(0,c),P<y&&ou(a,k,y-P,0,Da,
h-1),0<u&&(l||ru(a,u,0,0,h-1),y+=u)):(y+=Math.max(0,c),ca<z&&ou(a,k,0,z-ca,Da,h-1),0<u&&(l||ru(a,0,u,0,h-1),z+=u)));u=l=0;switch(k){case tu:b?l+=y/2-a.focus.x-r/2:u+=z/2-a.focus.y-r/2;break;case uu:0<Y?b?l+=y/2-a.focus.x-r/2:u+=z/2-a.focus.y-r/2:b?(X=g[0].V.x+g[0].ja.x,l+=X+(g[h-1].V.x+g[h-1].ja.x+2*g[h-1].focus.x-X)/2-a.focus.x-r/2):(X=g[0].V.y+g[0].ja.y,u+=X+(g[h-1].V.y+g[h-1].ja.y+2*g[h-1].focus.y-X)/2-a.focus.y-r/2);break;case du:b?(l-=r,y+=r):(u-=r,z+=r);break;case eu:b?(l+=y-a.width+r,y+=r):
(u+=z-a.height+r,z+=r);break;case Vt:b?1<h?l+=X+p/2-a.focus.x:l+=g[0].focus.x-a.focus.x+g[0].ja.x:1<h?u+=X+p/2-a.focus.y:u+=g[0].focus.y-a.focus.y+g[0].ja.y;break;case Wt:b?l+=y+p/2-a.focus.x:u+=z+p/2-a.focus.y;break;case Xt:break;default:v("Unhandled alignment value "+k.toString())}for(r=0;r<h;r++)X=g[r],b?X.V.h(X.V.x+X.ja.x-l,X.V.y+(135<e?(m?-z:-X.Aa.height)+X.ja.y-c:w+c+X.ja.y)):X.V.h(X.V.x+(135<e?(m?-y:-X.Aa.width)+X.ja.x-c:d+c+X.ja.x),X.V.y+X.ja.y-u);h=g=0;m?b?(y=vu(a,y,l),0>l&&(l=0),135<e&&
(u+=z+c),z+=w+c,k===Xt&&(g+=p/2+a.focus.x),h+=w+c):(135<e&&(l+=y+c),y+=d+c,z=wu(a,z,u),0>u&&(u=0),k===Xt&&(h+=p/2+a.focus.y),g+=d+c):b?(null===a.comments?d>y&&(y=xu(k,d-y,0),g=y.x,h=y.y,y=d,l=0):y=vu(a,y,l),0>l&&(g-=l,l=0),135<e&&(u+=z+c),z=Math.max(Math.max(z,w),z+w+c),h+=w+c):(135<e&&(l+=y+c),y=Math.max(Math.max(y,d),y+d+c),null===a.comments?w>z&&(z=xu(k,0,w-z),g=z.x,h=z.y,z=w,u=0):z=wu(a,z,u),0>u&&(h-=u,u=0),g+=d+c);if(0<Y)e=nu(this,4),Y=nu(this,4),b?(e[2].h(0,w+c),e[3].h(e[2].x,z),Y[2].h(y,e[2].y),
Y[3].h(Y[2].x,e[3].y)):(e[2].h(d+c,0),e[3].h(y,e[2].y),Y[2].h(e[2].x,z),Y[3].h(e[3].x,Y[2].y));else{e=nu(this,D.length+2);Y=nu(this,G.length+2);for(k=0;k<D.length;k++)m=D[k],e[k+2].h(m.x+g,m.y+h);for(k=0;k<G.length;k++)m=G[k],Y[k+2].h(m.x+g,m.y+h)}b?(e[0].h(l,0),e[1].h(e[0].x,w),e[2].y<e[1].y&&(e[2].x>e[0].x?e[2].assign(e[1]):e[1].assign(e[2])),e[3].y<e[2].y&&(e[3].x>e[0].x?e[3].assign(e[2]):e[2].assign(e[3])),Y[0].h(l+d,0),Y[1].h(Y[0].x,w),Y[2].y<Y[1].y&&(Y[2].x<Y[0].x?Y[2].assign(Y[1]):Y[1].assign(Y[2])),
Y[3].y<Y[2].y&&(Y[3].x<Y[0].x?Y[3].assign(Y[2]):Y[2].assign(Y[3])),e[2].y-=c/2,Y[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])),Y[0].h(0,u+w),Y[1].h(d,Y[0].y),Y[2].x<Y[1].x&&(Y[2].y<Y[0].y?Y[2].assign(Y[1]):Y[1].assign(Y[2])),Y[3].x<Y[2].x&&(Y[3].y<Y[0].y?Y[3].assign(Y[2]):Y[2].assign(Y[3])),e[2].x-=c/2,Y[2].x-=c/2);yu(this,D);yu(this,G);a.Tq=e;a.fr=Y;a.ja.h(l,u);a.Aa.h(y,
z)}break;default:v("Unhandled compaction value "+a.compaction.toString())}}};
function au(a,b){F&&x(b,zt,Z,"layoutTreeNone:v");if(0===b.childrenCount){var c=!1,d=0;null!==b.parent&&(d=b.parent.angle,c=b.parent.alignment,c=Ut(c));var e=Zt(b);b.V.h(0,0);b.Aa.h(b.width,b.height);null===b.parent||null===b.comments||(180!==d&&270!==d||c)&&!e?b.ja.h(0,0):180===d&&!c||(90===d||270===d)&&e?b.ja.h(b.width-2*b.focus.x,0):b.ja.h(0,b.height-2*b.focus.y)}else{d=cu(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.Aa.width:k.Aa.height)}var l=
b.alignment,m=l===du,n=l===eu;h=Ut(l);var p=Math.max(0,b.breadthLimit);k=ju(b);var r=b.nodeSpacing,q=ku(b),u=m||n?0:q/2,w=b.rowSpacing,y=0;if(m||n||b.Wm||b.Xm&&1===b.maxGenerationCount)y=Math.max(0,b.rowIndent);m=b.width;var z=b.height,B=0,D=0,G=0,O=0,V=0,P=0,ca=0,Y=0,oa=0,Da=0;h&&!Yt(l)&&135<d&&e.reverse();if(Yt(l))if(1<g)for(var X=0;X<g;X++){var Ma=e[X],Va=Ma.Aa;0===X%2&&X!==g-1?oa=Math.max(oa,(c?Va.width:Va.height)+zu(Ma)-r):0!==X%2&&(Da=Math.max(Da,(c?Va.width:Va.height)+zu(Ma)-r))}else 1===g&&
(oa=c?e[0].Aa.width:e[0].Aa.height);if(h)switch(l){case Vt:case Lt:D=135>d?lu(b,e,oa,B,D):mu(b,e,oa,B,D);oa=D.x;B=D.width;D=D.height;break;case Wt:for(a=0;a<g;a++)p=e[a],u=p.Aa,G=0===ca?0:w,c?(p.V.h(f-u.width,V+G),B=Math.max(B,u.width),D=Math.max(D,V+G+u.height),V+=G+u.height):(p.V.h(O+G,f-u.height),B=Math.max(B,O+G+u.width),D=Math.max(D,u.height),O+=G+u.width),ca++;break;case Xt:for(f=0;f<g;f++)a=e[f],p=a.Aa,u=0===ca?0:w,c?(a.V.h(r/2+b.focus.x,V+u),B=Math.max(B,p.width),D=Math.max(D,V+u+p.height),
V+=u+p.height):(a.V.h(O+u,r/2+b.focus.y),B=Math.max(B,O+u+p.width),D=Math.max(D,p.height),O+=u+p.width),ca++}else for(Da=0;Da<g;Da++)X=e[Da],Ma=X.Aa,c?(0<p&&0<ca&&O+r+Ma.width>p&&(O<f&&ou(b,l,f-O,0,Y,Da-1),P++,ca=0,Y=Da,G=D,O=0,V=135<d?-D-w:D+w),Va=0===ca?u:r,pu(a,X,0,V),X.V.h(O+Va,V),B=Math.max(B,O+Va+Ma.width),D=Math.max(D,G+(0===P?0:w)+Ma.height),O+=Va+Ma.width):(0<p&&0<ca&&V+r+Ma.height>p&&(V<f&&ou(b,l,0,f-V,Y,Da-1),P++,ca=0,Y=Da,G=B,V=0,O=135<d?-B-w:B+w),Va=0===ca?u:r,pu(a,X,O,0),X.V.h(O,V+Va),
D=Math.max(D,V+Va+Ma.height),B=Math.max(B,G+(0===P?0:w)+Ma.width),V+=Va+Ma.height),ca++;0<P&&(c?(D+=Math.max(0,k),O<B&&ou(b,l,B-O,0,Y,g-1),0<y&&(n||ru(b,y,0,0,g-1),B+=y)):(B+=Math.max(0,k),V<D&&ou(b,l,0,D-V,Y,g-1),0<y&&(n||ru(b,0,y,0,g-1),D+=y)));y=n=0;switch(l){case tu:c?n+=B/2-b.focus.x-q/2:y+=D/2-b.focus.y-q/2;break;case uu:0<P?c?n+=B/2-b.focus.x-q/2:y+=D/2-b.focus.y-q/2:c?(l=e[0].V.x+e[0].ja.x,n+=l+(e[g-1].V.x+e[g-1].ja.x+2*e[g-1].focus.x-l)/2-b.focus.x-q/2):(l=e[0].V.y+e[0].ja.y,y+=l+(e[g-1].V.y+
e[g-1].ja.y+2*e[g-1].focus.y-l)/2-b.focus.y-q/2);break;case du:c?(n-=q,B+=q):(y-=q,D+=q);break;case eu:c?(n+=B-b.width+q,B+=q):(y+=D-b.height+q,D+=q);break;case Vt:case Lt:c?1<g?n+=oa+r/2-b.focus.x:n+=e[0].focus.x-b.focus.x+e[0].ja.x:1<g?y+=oa+r/2-b.focus.y:y+=e[0].focus.y-b.focus.y+e[0].ja.y;break;case Wt:c?n+=B+r/2-b.focus.x:y+=D+r/2-b.focus.y;break;case Xt:break;default:v("Unhandled alignment value "+l.toString())}for(q=0;q<g;q++)l=e[q],c?l.V.h(l.V.x+l.ja.x-n,l.V.y+(135<d?(h?-D:-l.Aa.height)+l.ja.y-
k:z+k+l.ja.y)):l.V.h(l.V.x+(135<d?(h?-B:-l.Aa.width)+l.ja.x-k:m+k+l.ja.x),l.V.y+l.ja.y-y);c?(B=vu(b,B,n),0>n&&(n=0),135<d&&(y+=D+k),D=Math.max(Math.max(D,z),D+z+k)):(135<d&&(n+=B+k),B=Math.max(Math.max(B,m),B+m+k),D=wu(b,D,y),0>y&&(y=0));b.ja.h(n,y);b.Aa.h(B,D)}}
function lu(a,b,c,d,e){F&&x(a,zt,Z,"layoutBusChildrenPosDir:v");var f=b.length;if(0===f)return new L(c,0,d,e);if(1===f)return a=b[0],d=a.Aa.width,e=a.Aa.height,new L(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=90===cu(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.Aa,u=0===l?0:h;if(k){var w=zu(r)-g;r.V.h(c-(q.width+w),n+u);d=Math.max(d,q.width+w);e=Math.max(e,n+u+q.height);n+=u+q.height}else w=zu(r)-g,r.V.h(m+u,c-(q.height+w)),e=Math.max(e,q.height+w),d=Math.max(d,m+
u+q.width),m+=u+q.width;l++}l=0;r=m;p=n;k?(m=c+g,n=0):(m=0,n=c+g);for(q=0;q<f;q++)if(0!==q%2){u=b[q];w=u.Aa;var y=0===l?0:h;if(k){var z=zu(u)-g;u.V.h(m+z,n+y);d=Math.max(d,m+w.width+z);e=Math.max(e,n+y+w.height);n+=y+w.height}else z=zu(u)-g,u.V.h(m+y,n+z),d=Math.max(d,m+y+w.width),e=Math.max(e,n+w.height+z),m+=y+w.width;l++}1<f&&1===f%2&&(b=b[f-1],f=b.Aa,h=Au(b),k?(b.V.h(c+g/2-b.focus.x-b.ja.x,e+h),k=c+g/2-b.focus.x-b.ja.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.V.x&&(c=Bu(a,b.V.x,!1,c,g))):(b.V.h(d+h,c+g/2-b.focus.y-b.ja.y),d=Math.max(d,Math.max(r,m)+h+f.width),n=c+g/2-b.focus.y-b.ja.y,e=Math.max(e,n+f.height),0>n&&(e-=n),0>b.V.y&&(c=Bu(a,b.V.y,!0,c,g))));return new L(c,0,d,e)}
function mu(a,b,c,d,e){F&&x(a,zt,Z,"layoutBusChildrenNegDir:v");var f=b.length;if(0===f)return new L(c,0,d,e);if(1===f)return b=b[0],d=b.Aa.width,e=b.Aa.height,new L(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=270===cu(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.Aa,u=0===l?0:h;if(k){var w=zu(r)-g;n-=u+q.height;r.V.h(c-(q.width+w),n);d=Math.max(d,q.width+w);e=Math.max(e,Math.abs(n))}else w=zu(r)-g,m-=u+q.width,r.V.h(m,c-(q.height+w)),e=Math.max(e,q.height+w),d=Math.max(d,
Math.abs(m));l++}l=0;r=m;p=n;k?(m=c+g,n=0):(m=0,n=c+g);for(q=0;q<f;q++)if(0!==q%2){u=b[q];w=u.Aa;var y=0===l?0:h;if(k){var z=zu(u)-g;n-=y+w.height;u.V.h(m+z,n);d=Math.max(d,m+w.width+z);e=Math.max(e,Math.abs(n))}else z=zu(u)-g,m-=y+w.width,u.V.h(m,n+z),e=Math.max(e,n+w.height+z),d=Math.max(d,Math.abs(m));l++}1<f&&1===f%2&&(h=b[f-1],l=h.Aa,q=Au(h),k?(h.V.h(c+g/2-h.focus.x-h.ja.x,-e-l.height-q),m=c+g/2-h.focus.x-h.ja.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.V.x&&(c=Bu(a,h.V.x,!1,c,g))):(h.V.h(-d-l.width-q,c+g/2-h.focus.y-h.ja.y),d=Math.max(d,Math.abs(Math.min(r,m))+q+l.width),n=c+g/2-h.focus.y-h.ja.y,e=Math.max(e,n+l.height),0>n&&(e-=n),0>h.V.y&&(c=Bu(a,h.V.y,!0,c,g))));for(a=0;a<f;a++)g=b[a],k?g.V.h(g.V.x,g.V.y+e):g.V.h(g.V.x+d,g.V.y);return new L(c,0,d,e)}function zu(a){F&&x(a,zt,Z,"fixRelativePostions:child");return null===a.parent?0:a.parent.nodeSpacing}
function Au(a){F&&x(a,zt,Z,"fixRelativePostions:lastchild");return null===a.parent?0:a.parent.rowSpacing}function Bu(a,b,c,d,e){F&&x(a,zt,Z,"fixRelativePostions:v");a=a.children;for(var f=a.length,g=0;g<f;g++)c?a[g].V.h(a[g].V.x,a[g].V.y-b):a[g].V.h(a[g].V.x-b,a[g].V.y);b=a[f-1];return Math.max(d,c?b.ja.y+b.focus.y-e/2:b.ja.x+b.focus.x-e/2)}
function vu(a,b,c){F&&x(a,zt,Z,"calculateSubwidth:v");switch(a.alignment){case uu:case tu:return c+a.width>b&&(b=c+a.width),0>c&&(b-=c),b;case du:return a.width>b?a.width:b;case eu:return 2*a.focus.x>b?a.width:b+a.width-2*a.focus.x;case Vt:case Lt:return Math.max(a.width,Math.max(b,c+a.width)-Math.min(0,c));case Wt:return a.width-a.focus.x+a.nodeSpacing/2+b;case Xt:return Math.max(a.width,a.focus.x+a.nodeSpacing/2+b);default:return b}}
function wu(a,b,c){F&&x(a,zt,Z,"calculateSubheight:v");switch(a.alignment){case uu:case tu:return c+a.height>b&&(b=c+a.height),0>c&&(b-=c),b;case du:return a.height>b?a.height:b;case eu:return 2*a.focus.y>b?a.height:b+a.height-2*a.focus.y;case Vt:case Lt:return Math.max(a.height,Math.max(b,c+a.height)-Math.min(0,c));case Wt:return a.height-a.focus.y+a.nodeSpacing/2+b;case Xt:return Math.max(a.height,a.focus.y+a.nodeSpacing/2+b);default:return b}}
function xu(a,b,c){F&&x(a,E,Z,"alignOffset:align");switch(a){case tu:b/=2;c/=2;break;case uu:b/=2;c/=2;break;case du:c=b=0;break;case eu:break;default:v("Unhandled alignment value "+a.toString())}return new J(b,c)}function ou(a,b,c,d,e,f){F&&x(a,zt,Z,"shiftRelPosAlign:v");F&&x(b,E,Z,"shiftRelPosAlign:align");b=xu(b,c,d);ru(a,b.x,b.y,e,f)}function ru(a,b,c,d,e){F&&x(a,zt,Z,"shiftRelPos:v");if(0!==b||0!==c)for(a=a.children;d<=e;d++){var f=a[d].V;f.x+=b;f.y+=c}}
function pu(a,b,c,d){F&&(x(b,zt,Z,"recordMidPoints:v"),A(c,"number",Z,"recordMidPoints:x"),A(d,"number",Z,"recordMidPoints:y"));var e=b.parent;switch(a.fd){case ut:for(a=b.sourceEdges;a.next();)b=a.value,b.fromVertex===e&&b.relativePoint.h(c,d);break;case Bt:for(a=b.destinationEdges;a.next();)b=a.value,b.toVertex===e&&b.relativePoint.h(c,d);break;default:v("Unhandled path value "+a.fd.toString())}}function su(a,b,c){for(var d=0;d<a.length;d++){var e=a[d];e.x+=b;e.y+=c}}
function qu(a,b,c,d,e,f,g,h){F&&x(b,zt,Z,"mergeFringes:parent");F&&x(c,zt,Z,"mergeFringes:child");var k=cu(b),l=90===k||270===k,m=b.nodeSpacing;b=d;var n=e;d=f;var p=g,r=c.Tq,q=c.fr;g=c.Aa;var u=l?Math.max(p,g.height):Math.max(d,g.width);if(null===r||k!==cu(c))r=nu(a,2),q=nu(a,2),l?(r[0].h(0,0),r[1].h(0,g.height),q[0].h(g.width,0),q[1].h(q[0].x,r[1].y)):(r[0].h(0,0),r[1].h(g.width,0),q[0].h(0,g.height),q[1].h(r[1].x,q[0].y));if(l){p=9999999;if(!(null===n||2>n.length||null===r||2>r.length))for(e=c=
0;c<n.length&&e<r.length;){f=n[c];var w=r[e];k=w.x;l=w.y;k+=d;var y=f;c+1<n.length&&(y=n[c+1]);var z=w;w=z.x;z=z.y;e+1<r.length&&(z=r[e+1],w=z.x,z=z.y,w+=d);var B=p;f.y===l?B=k-f.x:f.y>l&&f.y<z?B=k+(f.y-l)/(z-l)*(w-k)-f.x:l>f.y&&l<y.y&&(B=k-(f.x+(l-f.y)/(y.y-f.y)*(y.x-f.x)));B<p&&(p=B);y.y<=f.y?c++:z<=l?e++:(y.y<=z&&c++,z<=y.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=nu(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=nu(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);yu(a,m);d=c}f=q;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=nu(a,n.length+f.length);for(e=l=c=0;c<n.length&&n[c].y<f[0].y;)y=n[c++],m[e++].h(y.x,y.y);for(;l<f.length;)y=f[l++],m[e++].h(y.x+k,y.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=nu(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);yu(a,m);e=f}f=Math.max(0,p)+g.width;g=u;yu(a,b);yu(a,r);yu(a,n);yu(a,q);h[0]=d;h[1]=e;return new L(p,0,f,g)}d=9999999;if(!(null===n||2>n.length||null===r||2>r.length))for(e=c=0;c<n.length&&e<r.length;)f=n[c],w=r[e],k=w.x,l=w.y,l+=p,y=f,c+1<n.length&&(y=n[c+1]),z=w,w=z.x,z=z.y,e+1<r.length&&(z=r[e+1],w=z.x,z=z.y,z+=p),B=d,f.x===k?B=l-f.y:f.x>k&&f.x<w?B=l+(f.x-k)/(w-k)*(z-l)-f.y:k>f.x&&k<y.x&&(B=l-(f.y+(k-f.x)/(y.x-f.x)*(y.y-f.y))),B<d&&(d=B),y.x<=f.x?
c++:w<=k?e++:(y.x<=w&&c++,w<=y.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=nu(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=nu(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);yu(a,m);d=c}f=q;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=nu(a,n.length+f.length);
for(e=l=c=0;c<n.length&&n[c].x<f[0].x;)y=n[c++],m[e++].h(y.x,y.y);for(;l<f.length;)y=f[l++],m[e++].h(y.x,y.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=nu(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);yu(a,m);e=f}f=u;g=Math.max(0,p)+g.height;yu(a,b);yu(a,r);yu(a,n);yu(a,q);h[0]=d;h[1]=e;return new L(p,0,f,g)}function nu(a,b){a=a.vv[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 yu(a,b){var c=b.length,d=a.vv[c];void 0===d&&(d=[],a.vv[c]=d);d.push(b)}
Z.prototype.arrangeTrees=function(){if(this.Ib===At)for(var a=this.Pb.iterator;a.next();){var b=a.value;if(b instanceof zt){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);Cu(this,b,c,d)}}}else{a=[];for(b=this.Pb.iterator;b.next();)c=b.value,c instanceof zt&&a.push(c);switch(this.sorting){case Qt:break;case Rt:a.reverse();break;case St:a.sort(this.comparer);break;case Tt:a.sort(this.comparer);a.reverse();break;default:v("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];Cu(this,e,b+e.ja.x,c+e.ja.y);switch(this.Ib){case xt:c+=e.Aa.height+this.Jd.height;break;case Du:b+=e.Aa.width+this.Jd.width;break;default:v("Unhandled arrangement value "+this.Ib.toString())}}}};function Cu(a,b,c,d){if(null!==b){F&&x(b,zt,Z,"assignAbsolutePositions:v");b.x=c;b.y=d;b=b.children;for(var e=b.length,f=0;f<e;f++){var g=b[f];Cu(a,g,c+g.V.x,d+g.V.y)}}}
Z.prototype.commitLayout=function(){this.Fw();this.commitNodes();this.Iv();this.isRouting&&this.commitLinks()};Z.prototype.commitNodes=function(){for(var a=this.network.vertexes.iterator;a.next();)a.value.commit();for(a.reset();a.next();)this.layoutComments(a.value)};
Z.prototype.Iv=function(){if(this.layerStyle===It){for(var a=this.nx,b=[],c=null,d=this.network.vertexes.iterator;d.next();){var e=d.value;null===c?c=e.bounds.copy():c.Pc(e.bounds);var f=b[e.level];void 0===f?f=ju(e):f=Math.max(f,ju(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.Lc(this.nodeSpacing/2,this.layerSpacing),d=new J(-this.nodeSpacing/2,-this.layerSpacing/2)):(c.Lc(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 L(0,f,c,h))):90===this.angle?(e.push(new L(0,f,c,h)),f+=h):180===this.angle?(f-=h,e.push(new L(f,0,h,c))):(e.push(new L(f,0,h,c)),f+=h)}this.commitLayers(e,d)}};Z.prototype.commitLayers=function(){};Z.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};
Z.prototype.Fw=function(){for(var a=this.Pb.iterator;a.next();){var b=a.value;b instanceof zt&&Eu(this,b)}};function Eu(a,b){if(null!==b){F&&x(b,zt,Z,"setPortSpotsTree:v");a.setPortSpots(b);b=b.children;for(var c=b.length,d=0;d<c;d++)Eu(a,b[d])}}
Z.prototype.setPortSpots=function(a){F&&x(a,zt,Z,"setPortSpots:v");var b=a.alignment;if(Ut(b)){F&&x(a,zt,Z,"setPortSpotsBus:v");F&&x(b,E,Z,"setPortSpots:align");var c=this.fd===ut,d=cu(a);switch(d){case 0:var e=sd;break;case 90:e=td;break;case 180:e=rd;break;default:e=qd}var f=a.children,g=f.length;switch(b){case Vt:case Lt: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?rd:qd;if(1===g||b===g-1&&1===g%2)switch(d){case 0:k=
rd;break;case 90:k=qd;break;case 180:k=sd;break;default:k=td}else 0===b%2&&(k=90===d||270===d?sd:td);c?(a.setsPortSpot&&(h.fromSpot=e),a.setsChildPortSpot&&(h.toSpot=k)):(a.setsPortSpot&&(h.fromSpot=k),a.setsChildPortSpot&&(h.toSpot=e))}}break;case Wt:d=90===d||270===d?sd:td;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 Xt:for(d=
90===d||270===d?rd:qd,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=cu(a),this.fd===ut)for(e=a.destinationEdges;e.next();){if(d=e.value.link,null!==d){if(a.setsPortSpot)if(a.portSpot.Gb())switch(c){case 0:d.fromSpot=sd;break;case 90:d.fromSpot=td;break;case 180:d.fromSpot=rd;break;default:d.fromSpot=qd}else d.fromSpot=a.portSpot;
if(a.setsChildPortSpot)if(a.childPortSpot.Gb())switch(c){case 0:d.toSpot=rd;break;case 90:d.toSpot=qd;break;case 180:d.toSpot=sd;break;default:d.toSpot=td}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.Gb())switch(c){case 0:d.toSpot=sd;break;case 90:d.toSpot=td;break;case 180:d.toSpot=rd;break;default:d.toSpot=qd}else d.toSpot=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.Gb())switch(c){case 0:d.fromSpot=rd;break;
case 90:d.fromSpot=qd;break;case 180:d.fromSpot=sd;break;default:d.fromSpot=td}else d.fromSpot=a.childPortSpot}};function cu(a){a=a.angle;return 45>=a?0:135>=a?90:225>=a?180:315>=a?270:0}function ju(a){F&&x(a,zt,Z,"computeLayerSpacing:v");var b=cu(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 ku(a){F&&x(a,zt,Z,"computeNodeIndent:v");var b=cu(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(Z.prototype,{roots:{configurable:!0,get:function(){return this.Pb},set:function(a){this.Pb!==a&&(x(a,I,Z,"roots"),this.Pb=a,this.D())}},path:{configurable:!0,get:function(){return this.wp},set:function(a){this.wp!==a&&(hb(a,Z,Z,"path"),this.wp=a,this.D())}},treeStyle:{configurable:!0,get:function(){return this.rq},set:function(a){this.Ib!==a&&(hb(a,Z,Z,"treeStyle"),a===vt||a===Ot||a===Pt||a===Nt)&&(this.rq=a,this.D())}},layerStyle:{configurable:!0,
enumerable:!0,get:function(){return this.ys},set:function(a){this.Ib!==a&&(hb(a,Z,Z,"layerStyle"),a===wt||a===Jt||a===It)&&(this.ys=a,this.D())}},comments:{configurable:!0,get:function(){return this.ed},set:function(a){this.ed!==a&&(A(a,"boolean",Z,"comments"),this.ed=a,this.D())}},arrangement:{configurable:!0,get:function(){return this.Ib},set:function(a){this.Ib!==a&&(hb(a,Z,Z,"arrangement"),a===xt||a===Du||a===At)&&(this.Ib=a,this.D())}},arrangementSpacing:{configurable:!0,
enumerable:!0,get:function(){return this.Jd},set:function(a){x(a,Hb,Z,"arrangementSpacing");this.Jd.A(a)||(this.Jd.assign(a),this.D())}},rootDefaults:{configurable:!0,get:function(){return this.Y},set:function(a){this.Y!==a&&(x(a,zt,Z,"rootDefaults"),this.Y=a,this.D())}},alternateDefaults:{configurable:!0,get:function(){return this.Z},set:function(a){this.Z!==a&&(x(a,zt,Z,"alternateDefaults"),this.Z=a,this.D())}},sorting:{configurable:!0,get:function(){return this.Y.sorting},
set:function(a){this.Y.sorting!==a&&(hb(a,Z,Z,"sorting"),a===Qt||a===Rt||a===St||Tt)&&(this.Y.sorting=a,this.D())}},comparer:{configurable:!0,get:function(){return this.Y.comparer},set:function(a){this.Y.comparer!==a&&(A(a,"function",Z,"comparer"),this.Y.comparer=a,this.D())}},angle:{configurable:!0,get:function(){return this.Y.angle},set:function(a){this.Y.angle!==a&&(A(a,"number",Z,"angle"),0===a||90===a||180===a||270===a?(this.Y.angle=a,this.D()):v("TreeLayout.angle must be 0, 90, 180, or 270"))}},
alignment:{configurable:!0,get:function(){return this.Y.alignment},set:function(a){this.Y.alignment!==a&&(hb(a,Z,Z,"alignment"),this.Y.alignment=a,this.D())}},nodeIndent:{configurable:!0,get:function(){return this.Y.nodeIndent},set:function(a){this.Y.nodeIndent!==a&&(A(a,"number",Z,"nodeIndent"),0<=a&&(this.Y.nodeIndent=a,this.D()))}},nodeIndentPastParent:{configurable:!0,get:function(){return this.Y.nodeIndentPastParent},set:function(a){this.Y.nodeIndentPastParent!==
a&&(A(a,"number",Z,"nodeIndentPastParent"),0<=a&&1>=a&&(this.Y.nodeIndentPastParent=a,this.D()))}},nodeSpacing:{configurable:!0,get:function(){return this.Y.nodeSpacing},set:function(a){this.Y.nodeSpacing!==a&&(A(a,"number",Z,"nodeSpacing"),this.Y.nodeSpacing=a,this.D())}},layerSpacing:{configurable:!0,get:function(){return this.Y.layerSpacing},set:function(a){this.Y.layerSpacing!==a&&(A(a,"number",Z,"layerSpacing"),this.Y.layerSpacing=a,this.D())}},layerSpacingParentOverlap:{configurable:!0,
enumerable:!0,get:function(){return this.Y.layerSpacingParentOverlap},set:function(a){this.Y.layerSpacingParentOverlap!==a&&(A(a,"number",Z,"layerSpacingParentOverlap"),0<=a&&1>=a&&(this.Y.layerSpacingParentOverlap=a,this.D()))}},compaction:{configurable:!0,get:function(){return this.Y.compaction},set:function(a){this.Y.compaction!==a&&(hb(a,Z,Z,"compaction"),a===$t||a===bu)&&(this.Y.compaction=a,this.D())}},breadthLimit:{configurable:!0,get:function(){return this.Y.breadthLimit},
set:function(a){this.Y.breadthLimit!==a&&(A(a,"number",Z,"breadthLimit"),0<=a&&(this.Y.breadthLimit=a,this.D()))}},rowSpacing:{configurable:!0,get:function(){return this.Y.rowSpacing},set:function(a){this.Y.rowSpacing!==a&&(A(a,"number",Z,"rowSpacing"),this.Y.rowSpacing=a,this.D())}},rowIndent:{configurable:!0,get:function(){return this.Y.rowIndent},set:function(a){this.Y.rowIndent!==a&&(A(a,"number",Z,"rowIndent"),0<=a&&(this.Y.rowIndent=a,this.D()))}},commentSpacing:{configurable:!0,
enumerable:!0,get:function(){return this.Y.commentSpacing},set:function(a){this.Y.commentSpacing!==a&&(A(a,"number",Z,"commentSpacing"),this.Y.commentSpacing=a,this.D())}},commentMargin:{configurable:!0,get:function(){return this.Y.commentMargin},set:function(a){this.Y.commentMargin!==a&&(A(a,"number",Z,"commentMargin"),this.Y.commentMargin=a,this.D())}},setsPortSpot:{configurable:!0,get:function(){return this.Y.setsPortSpot},set:function(a){this.Y.setsPortSpot!==a&&(A(a,
"boolean",Z,"setsPortSpot"),this.Y.setsPortSpot=a,this.D())}},portSpot:{configurable:!0,get:function(){return this.Y.portSpot},set:function(a){x(a,M,Z,"portSpot");this.Y.portSpot.A(a)||(this.Y.portSpot=a,this.D())}},setsChildPortSpot:{configurable:!0,get:function(){return this.Y.setsChildPortSpot},set:function(a){this.Y.setsChildPortSpot!==a&&(A(a,"boolean",Z,"setsChildPortSpot"),this.Y.setsChildPortSpot=a,this.D())}},childPortSpot:{configurable:!0,get:function(){return this.Y.childPortSpot},
set:function(a){x(a,M,Z,"childPortSpot");this.Y.childPortSpot.A(a)||(this.Y.childPortSpot=a,this.D())}},alternateSorting:{configurable:!0,get:function(){return this.Z.sorting},set:function(a){this.Z.sorting!==a&&(hb(a,Z,Z,"alternateSorting"),a===Qt||a===Rt||a===St||Tt)&&(this.Z.sorting=a,this.D())}},alternateComparer:{configurable:!0,get:function(){return this.Z.comparer},set:function(a){this.Z.comparer!==a&&(A(a,"function",Z,"alternateComparer"),this.Z.comparer=a,this.D())}},
alternateAngle:{configurable:!0,get:function(){return this.Z.angle},set:function(a){this.Z.angle!==a&&(A(a,"number",Z,"alternateAngle"),0===a||90===a||180===a||270===a)&&(this.Z.angle=a,this.D())}},alternateAlignment:{configurable:!0,get:function(){return this.Z.alignment},set:function(a){this.Z.alignment!==a&&(hb(a,Z,Z,"alternateAlignment"),this.Z.alignment=a,this.D())}},alternateNodeIndent:{configurable:!0,get:function(){return this.Z.nodeIndent},set:function(a){this.Z.nodeIndent!==
a&&(A(a,"number",Z,"alternateNodeIndent"),0<=a&&(this.Z.nodeIndent=a,this.D()))}},alternateNodeIndentPastParent:{configurable:!0,get:function(){return this.Z.nodeIndentPastParent},set:function(a){this.Z.nodeIndentPastParent!==a&&(A(a,"number",Z,"alternateNodeIndentPastParent"),0<=a&&1>=a&&(this.Z.nodeIndentPastParent=a,this.D()))}},alternateNodeSpacing:{configurable:!0,get:function(){return this.Z.nodeSpacing},set:function(a){this.Z.nodeSpacing!==a&&(A(a,"number",Z,"alternateNodeSpacing"),
this.Z.nodeSpacing=a,this.D())}},alternateLayerSpacing:{configurable:!0,get:function(){return this.Z.layerSpacing},set:function(a){this.Z.layerSpacing!==a&&(A(a,"number",Z,"alternateLayerSpacing"),this.Z.layerSpacing=a,this.D())}},alternateLayerSpacingParentOverlap:{configurable:!0,get:function(){return this.Z.layerSpacingParentOverlap},set:function(a){this.Z.layerSpacingParentOverlap!==a&&(A(a,"number",Z,"alternateLayerSpacingParentOverlap"),0<=a&&1>=a&&(this.Z.layerSpacingParentOverlap=
a,this.D()))}},alternateCompaction:{configurable:!0,get:function(){return this.Z.compaction},set:function(a){this.Z.compaction!==a&&(hb(a,Z,Z,"alternateCompaction"),a===$t||a===bu)&&(this.Z.compaction=a,this.D())}},alternateBreadthLimit:{configurable:!0,get:function(){return this.Z.breadthLimit},set:function(a){this.Z.breadthLimit!==a&&(A(a,"number",Z,"alternateBreadthLimit"),0<=a&&(this.Z.breadthLimit=a,this.D()))}},alternateRowSpacing:{configurable:!0,get:function(){return this.Z.rowSpacing},
set:function(a){this.Z.rowSpacing!==a&&(A(a,"number",Z,"alternateRowSpacing"),this.Z.rowSpacing=a,this.D())}},alternateRowIndent:{configurable:!0,get:function(){return this.Z.rowIndent},set:function(a){this.Z.rowIndent!==a&&(A(a,"number",Z,"alternateRowIndent"),0<=a&&(this.Z.rowIndent=a,this.D()))}},alternateCommentSpacing:{configurable:!0,get:function(){return this.Z.commentSpacing},set:function(a){this.Z.commentSpacing!==a&&(A(a,"number",Z,"alternateCommentSpacing"),
this.Z.commentSpacing=a,this.D())}},alternateCommentMargin:{configurable:!0,get:function(){return this.Z.commentMargin},set:function(a){this.Z.commentMargin!==a&&(A(a,"number",Z,"alternateCommentMargin"),this.Z.commentMargin=a,this.D())}},alternateSetsPortSpot:{configurable:!0,get:function(){return this.Z.setsPortSpot},set:function(a){this.Z.setsPortSpot!==a&&(A(a,"boolean",Z,"alternateSetsPortSpot"),this.Z.setsPortSpot=a,this.D())}},alternatePortSpot:{configurable:!0,
enumerable:!0,get:function(){return this.Z.portSpot},set:function(a){x(a,M,Z,"alternatePortSpot");this.Z.portSpot.A(a)||(this.Z.portSpot=a,this.D())}},alternateSetsChildPortSpot:{configurable:!0,get:function(){return this.Z.setsChildPortSpot},set:function(a){this.Z.setsChildPortSpot!==a&&(A(a,"boolean",Z,"alternateSetsChildPortSpot"),this.Z.setsChildPortSpot=a,this.D())}},alternateChildPortSpot:{configurable:!0,get:function(){return this.Z.childPortSpot},set:function(a){x(a,
M,Z,"alternateChildPortSpot");this.Z.childPortSpot.A(a)||(this.Z.childPortSpot=a,this.D())}}});
var tt=new E(Z,"PathDefault",-1),ut=new E(Z,"PathDestination",0),Bt=new E(Z,"PathSource",1),Qt=new E(Z,"SortingForwards",10),Rt=new E(Z,"SortingReverse",11),St=new E(Z,"SortingAscending",12),Tt=new E(Z,"SortingDescending",13),tu=new E(Z,"AlignmentCenterSubtrees",20),uu=new E(Z,"AlignmentCenterChildren",21),du=new E(Z,"AlignmentStart",22),eu=new E(Z,"AlignmentEnd",23),Vt=new E(Z,"AlignmentBus",24),Lt=new E(Z,"AlignmentBusBranching",25),Wt=new E(Z,"AlignmentTopLeftBus",26),Xt=new E(Z,"AlignmentBottomRightBus",
27),$t=new E(Z,"CompactionNone",30),bu=new E(Z,"CompactionBlock",31),vt=new E(Z,"StyleLayered",40),Pt=new E(Z,"StyleLastParents",41),Ot=new E(Z,"StyleAlternating",42),Nt=new E(Z,"StyleRootOnly",43),xt=new E(Z,"ArrangementVertical",50),Du=new E(Z,"ArrangementHorizontal",51),At=new E(Z,"ArrangementFixedRoots",52),wt=new E(Z,"LayerIndividual",60),Jt=new E(Z,"LayerSiblings",61),It=new E(Z,"LayerUniform",62);Z.className="TreeLayout";Z.PathDefault=tt;Z.PathDestination=ut;Z.PathSource=Bt;
Z.SortingForwards=Qt;Z.SortingReverse=Rt;Z.SortingAscending=St;Z.SortingDescending=Tt;Z.AlignmentCenterSubtrees=tu;Z.AlignmentCenterChildren=uu;Z.AlignmentStart=du;Z.AlignmentEnd=eu;Z.AlignmentBus=Vt;Z.AlignmentBusBranching=Lt;Z.AlignmentTopLeftBus=Wt;Z.AlignmentBottomRightBus=Xt;Z.CompactionNone=$t;Z.CompactionBlock=bu;Z.StyleLayered=vt;Z.StyleLastParents=Pt;Z.StyleAlternating=Ot;Z.StyleRootOnly=Nt;Z.ArrangementVertical=xt;Z.ArrangementHorizontal=Du;Z.ArrangementFixedRoots=At;Z.LayerIndividual=wt;
Z.LayerSiblings=Jt;Z.LayerUniform=It;function yt(a){hq.call(this,a)}la(yt,hq);yt.prototype.createVertex=function(){return new zt(this)};yt.prototype.createEdge=function(){return new Fu(this)};yt.className="TreeNetwork";
function zt(a){kq.call(this,a);this.Na=!1;this.Qc=null;this.L=[];this.qd=this.ib=this.W=this.Oa=0;this.ed=null;this.V=new J(0,0);this.Aa=new Hb(0,0);this.ja=new J(0,0);this.Xm=this.Wm=this.TA=!1;this.fr=this.Tq=null;this.Yc=Qt;this.Tc=rq;this.dc=0;this.Cb=uu;this.Js=this.Is=0;this.Ks=20;this.ze=50;this.xs=0;this.Jr=bu;this.Br=0;this.Xs=25;this.Ir=this.Ws=10;this.Hr=20;this.jt=!0;this.Ts=ld;this.it=!0;this.Er=ld}la(zt,kq);
zt.prototype.copyInheritedPropertiesFrom=function(a){null!==a&&(this.Yc=a.sorting,this.Tc=a.comparer,this.dc=a.angle,this.Cb=a.alignment,this.Is=a.nodeIndent,this.Js=a.nodeIndentPastParent,this.Ks=a.nodeSpacing,this.ze=a.layerSpacing,this.xs=a.layerSpacingParentOverlap,this.Jr=a.compaction,this.Br=a.breadthLimit,this.Xs=a.rowSpacing,this.Ws=a.rowIndent,this.Ir=a.commentSpacing,this.Hr=a.commentMargin,this.jt=a.setsPortSpot,this.Ts=a.portSpot,this.it=a.setsChildPortSpot,this.Er=a.childPortSpot)};
ma.Object.defineProperties(zt.prototype,{initialized:{configurable:!0,get:function(){return this.Na},set:function(a){this.Na!==a&&(A(a,"boolean",zt,"initialized"),this.Na=a)}},parent:{configurable:!0,get:function(){return this.Qc},set:function(a){this.Qc!==a&&(F&&null!==a&&x(a,zt,zt,"parent"),this.Qc=a)}},children:{configurable:!0,get:function(){return this.L},set:function(a){if(this.L!==a){null===a||Array.isArray(a)||xa(a,"Array",zt,"children:value");if(null!==
a)for(var b=a.length,c=0;c<b;c++){var d=a[c];F&&x(d,zt,zt,"children")}this.L=a}}},level:{configurable:!0,get:function(){return this.Oa},set:function(a){this.Oa!==a&&(A(a,"number",zt,"level"),this.Oa=a)}},descendantCount:{configurable:!0,get:function(){return this.W},set:function(a){this.W!==a&&(A(a,"number",zt,"descendantCount"),this.W=a)}},maxChildrenCount:{configurable:!0,get:function(){return this.ib},set:function(a){this.ib!==a&&(A(a,"number",zt,"maxChildrenCount"),
this.ib=a)}},maxGenerationCount:{configurable:!0,get:function(){return this.qd},set:function(a){this.qd!==a&&(A(a,"number",zt,"maxGenerationCount"),this.qd=a)}},comments:{configurable:!0,get:function(){return this.ed},set:function(a){if(this.ed!==a){null===a||Array.isArray(a)||xa(a,"Array",zt,"comments:value");if(null!==a)for(var b=a.length,c=0;c<b;c++){var d=a[c];F&&x(d,T,zt,"comments")}this.ed=a}}},sorting:{configurable:!0,get:function(){return this.Yc},
set:function(a){this.Yc!==a&&(hb(a,Z,zt,"sorting"),this.Yc=a)}},comparer:{configurable:!0,get:function(){return this.Tc},set:function(a){this.Tc!==a&&(A(a,"function",zt,"comparer"),this.Tc=a)}},angle:{configurable:!0,get:function(){return this.dc},set:function(a){this.dc!==a&&(A(a,"number",zt,"angle"),this.dc=a)}},alignment:{configurable:!0,get:function(){return this.Cb},set:function(a){this.Cb!==a&&(hb(a,Z,zt,"alignment"),this.Cb=a)}},nodeIndent:{configurable:!0,
enumerable:!0,get:function(){return this.Is},set:function(a){this.Is!==a&&(A(a,"number",zt,"nodeIndent"),this.Is=a)}},nodeIndentPastParent:{configurable:!0,get:function(){return this.Js},set:function(a){this.Js!==a&&(A(a,"number",zt,"nodeIndentPastParent"),this.Js=a)}},nodeSpacing:{configurable:!0,get:function(){return this.Ks},set:function(a){this.Ks!==a&&(A(a,"number",zt,"nodeSpacing"),this.Ks=a)}},layerSpacing:{configurable:!0,get:function(){return this.ze},
set:function(a){this.ze!==a&&(A(a,"number",zt,"layerSpacing"),this.ze=a)}},layerSpacingParentOverlap:{configurable:!0,get:function(){return this.xs},set:function(a){this.xs!==a&&(A(a,"number",zt,"layerSpacingParentOverlap"),this.xs=a)}},compaction:{configurable:!0,get:function(){return this.Jr},set:function(a){this.Jr!==a&&(hb(a,Z,zt,"compaction"),this.Jr=a)}},breadthLimit:{configurable:!0,get:function(){return this.Br},set:function(a){this.Br!==a&&(A(a,"number",
zt,"breadthLimit"),this.Br=a)}},rowSpacing:{configurable:!0,get:function(){return this.Xs},set:function(a){this.Xs!==a&&(A(a,"number",zt,"rowSpacing"),this.Xs=a)}},rowIndent:{configurable:!0,get:function(){return this.Ws},set:function(a){this.Ws!==a&&(A(a,"number",zt,"rowIndent"),this.Ws=a)}},commentSpacing:{configurable:!0,get:function(){return this.Ir},set:function(a){this.Ir!==a&&(A(a,"number",zt,"commentSpacing"),this.Ir=a)}},commentMargin:{configurable:!0,
enumerable:!0,get:function(){return this.Hr},set:function(a){this.Hr!==a&&(A(a,"number",zt,"commentMargin"),this.Hr=a)}},setsPortSpot:{configurable:!0,get:function(){return this.jt},set:function(a){this.jt!==a&&(A(a,"boolean",zt,"setsPortSpot"),this.jt=a)}},portSpot:{configurable:!0,get:function(){return this.Ts},set:function(a){x(a,M,zt,"portSpot");this.Ts.A(a)||(this.Ts=a)}},setsChildPortSpot:{configurable:!0,get:function(){return this.it},set:function(a){this.it!==
a&&(A(a,"boolean",zt,"setsChildPortSpot"),this.it=a)}},childPortSpot:{configurable:!0,get:function(){return this.Er},set:function(a){x(a,M,zt,"childPortSpot");this.Er.A(a)||(this.Er=a)}},childrenCount:{configurable:!0,get:function(){return this.children.length}},relativePosition:{configurable:!0,get:function(){return this.V},set:function(a){this.V.set(a)}},subtreeSize:{configurable:!0,get:function(){return this.Aa},set:function(a){this.Aa.set(a)}},
subtreeOffset:{configurable:!0,get:function(){return this.ja},set:function(a){this.ja.set(a)}}});zt.className="TreeVertex";function Fu(a){lq.call(this,a);this.lv=new J(0,0)}la(Fu,lq);
Fu.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 ut:c=this.fromVertex;d=this.toVertex;break;case Bt:c=this.toVertex;d=this.fromVertex;break;default:v("Unhandled path value "+b.fd.toString())}if(null!==c&&null!==d)if(b=this.lv,0!==b.x||0!==b.y||c.TA){d=c.bounds;var e=cu(c),f=ju(c),g=c.rowSpacing;a.wj();var h=a.curve===rg,k=a.isOrthogonal,l;a.Xh();if(k||h){for(l=2;4<a.pointsCount;)a.ww(2);var m=a.i(1);var n=a.i(2)}else{for(l=
1;3<a.pointsCount;)a.ww(1);m=a.i(0);n=a.i(a.pointsCount-1)}var p=a.i(a.pointsCount-1);0===e?(c.alignment===eu?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-ku(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+ku(c))))):e=c.Wm||c.Xm&&1===c.maxGenerationCount?d.top-c.ja.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===eu?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-ku(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+ku(c))))):e=c.Wm||c.Xm&&1===c.maxGenerationCount?d.left-c.ja.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===eu?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-ku(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+ku(c))))):e=c.Wm||c.Xm&&1===c.maxGenerationCount?d.top-c.ja.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===eu?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-ku(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+ku(c))))):e=c.Wm||c.Xm&&1===c.maxGenerationCount?
d.left-c.ja.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))):v("Invalid angle "+e);a.Df()}else b=d,F&&x(c,zt,Fu,"adjustRouteForAngleChange:parent"),F&&x(b,zt,Fu,"adjustRouteForAngleChange:child"),a=this.link,f=cu(c),f!==cu(b)&&(g=ju(c),h=c.bounds,c=b.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===rg,b=a.isOrthogonal,d=Ut(this.fromVertex.alignment),a.Xh(),0===f?(f=h.right+g/2,c?4===a.pointsCount&&(c=a.i(3).y,a.N(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.N(5,a.i(5).x,c)):b?d?a.N(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.N(2,f,a.i(2).y),a.N(3,f,a.i(3).y)):4===a.pointsCount?a.m(2,f,a.i(2).y):3===a.pointsCount?a.N(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.N(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.N(5,c,a.i(5).y)):b?d?a.N(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.N(2,a.i(2).x,f),a.N(3,a.i(3).x,f)):4===a.pointsCount?a.m(2,a.i(2).x,f):3===a.pointsCount?a.N(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.N(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.N(5,a.i(5).x,c)):b?d?a.N(3,a.i(2).x,a.i(4).y):
6===a.pointsCount&&(a.N(2,f,a.i(2).y),a.N(3,f,a.i(3).y)):4===a.pointsCount?a.m(2,f,a.i(2).y):3===a.pointsCount?a.N(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.N(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.N(5,c,a.i(5).y)):b?d?a.N(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.N(2,a.i(2).x,f),a.N(3,a.i(3).x,f)):4===a.pointsCount?a.m(2,a.i(2).x,f):3===a.pointsCount?a.N(1,a.i(2).x,f):2===a.pointsCount&&a.m(1,a.i(1).x,f)),a.Df()))}};
ma.Object.defineProperties(Fu.prototype,{relativePoint:{configurable:!0,get:function(){return this.lv},set:function(a){this.lv.set(a)}}});Fu.className="TreeEdge";
Ua.prototype.initializeStandardTools=function(){this.cb("Action",new Rg,this.mouseDownTools);this.cb("Relinking",new lf,this.mouseDownTools);this.cb("LinkReshaping",new pg,this.mouseDownTools);this.cb("Rotating",new Pg,this.mouseDownTools);this.cb("Resizing",new Ig,this.mouseDownTools);this.cb("Linking",new ig,this.mouseMoveTools);this.cb("Dragging",new df,this.mouseMoveTools);this.cb("DragSelecting",new Ug,this.mouseMoveTools);this.cb("Panning",new Vg,this.mouseMoveTools);this.cb("ContextMenu",new Xg,
this.mouseUpTools);this.cb("TextEditing",new hh,this.mouseUpTools);this.cb("ClickCreating",new Sg,this.mouseUpTools);this.cb("ClickSelecting",new Qg,this.mouseUpTools)};Jn("Horizontal",new Om);Jn("Spot",new Qm);Jn("Table",new Um);Jn("Viewbox",new Zm);Jn("TableRow",new Xm);Jn("TableColumn",new Ym);Jn("Graduated",new jn);Jn("Grid",new $m);Hi.add("GraphLinksModel",Kq);Hi.add("TreeModel",Yq);
var Gu=qa.go,Hu={get licenseKey(){return Q.licenseKey},set licenseKey(a){Q.licenseKey=a},get version(){return Q.version},Group:Hf,EnumValue:E,List:H,Set:I,Map:Db,Point:J,Size:Hb,Rect:L,Margin:lc,Spot:M,Geometry:Fd,PathFigure:te,PathSegment:ue,InputEvent:we,DiagramEvent:Fe,ChangedEvent:Ge,Model:W,GraphLinksModel:ur,TreeModel:Ar,Binding:$i,Transaction:Le,UndoManager:Me,CommandHandler:gl,Tool:Oe,DraggingTool:df,DraggingInfo:mf,DraggingOptions:ef,LinkingBaseTool:Xf,LinkingTool:ig,RelinkingTool:lf,LinkReshapingTool:pg,
ResizingTool:Ig,RotatingTool:Pg,ClickSelectingTool:Qg,ActionTool:Rg,ClickCreatingTool:Sg,HTMLInfo:bf,ContextMenuTool:Xg,DragSelectingTool:Ug,PanningTool:Vg,TextEditingTool:hh,ToolManager:Ua,Animation:Dh,AnimationManager:zh,AnimationTrigger:ri,Layer:wi,Diagram:Q,Palette:Zk,Overview:bl,Brush:Jl,GraphObject:N,Panel:U,RowColumnDefinition:ik,Shape:Yf,TextBlock:ih,TextBlockMetrics:Co,Picture:xk,Part:S,Adornment:Te,Node:T,Link:R,Placeholder:Kg,Layout:Ni,LayoutNetwork:hq,LayoutVertex:kq,LayoutEdge:lq,GridLayout:al,
PanelLayout:dm,CircularLayout:Br,CircularNetwork:Sr,CircularVertex:es,CircularEdge:fs,ForceDirectedLayout:gs,ForceDirectedNetwork:hs,ForceDirectedVertex:rs,ForceDirectedEdge:vs,LayeredDigraphLayout:ws,LayeredDigraphNetwork:Bs,LayeredDigraphVertex:rt,LayeredDigraphEdge:st,TreeLayout:Z,TreeNetwork:yt,TreeVertex:zt,TreeEdge:Fu};
"object"===typeof Gu&&Gu.version&&v("WARNING: a `go` object on the root object is already defined.  "+("Debug"in Gu?"debug ":"")+"version: "+Gu.version+", replaced with version: "+Hu.version);Q.prototype.go=Hu;qa.go=Hu;("undefined"===typeof qa||"undefined"===typeof qa.module||"object"!==typeof qa.module.exports)&&qa.define&&"function"===typeof qa.define&&qa.define.amd&&qa.define(Hu);Hu.Debug=F;F.rz(Hu); 'undefined'!==typeof module&&'object'===typeof module.exports&&(module.exports='undefined'!==typeof global?global.go:self.go); })();
