/*
 * GoJS v2.0.16 JavaScript Library for HTML Diagrams
 * Northwoods Software, https://www.nwoods.com/
 * GoJS and Northwoods Software are registered trademarks of Northwoods Software Corporation.
 * Copyright (C) 1998-2019 by Northwoods Software Corporation.  All Rights Reserved.
 * THIS SOFTWARE IS LICENSED.  THE LICENSE AGREEMENT IS AT: https://gojs.net/2.0.16/license.html.
 */
(function() { var t;function ba(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}function ca(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):{next:ba(a)}}function da(a){for(var b,c=[];!(b=a.next()).done;)c.push(b.value);return c}var fa="function"==typeof Object.create?Object.create:function(a){function b(){}b.prototype=a;return new b},ha;
if("function"==typeof Object.setPrototypeOf)ha=Object.setPrototypeOf;else{var ia;a:{var ja={a:!0},ka={};try{ka.__proto__=ja;ia=ka.a;break a}catch(a){}ia=!1}ha=ia?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null}var la=ha;
function ma(a,b){a.prototype=fa(b.prototype);a.prototype.constructor=a;if(la)la(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.yA=b.prototype}var na="undefined"!=typeof window&&window===self?self:"undefined"!=typeof global&&null!=global?global:self,oa="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=na,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&&oa(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 ra="object"===typeof self&&self.self===self&&self||"object"===typeof global&&global.global===global&&global||"object"===typeof window&&window.window===window&&window||{};void 0===ra.requestAnimationFrame&&(ra.requestAnimationFrame=ra.setImmediate);function sa(){}function va(a,b){var c=-1;return function(){var d=this,e=arguments;-1!==c&&ra.clearTimeout(c);c=wa(function(){c=-1;a.apply(d,e)},b)}}function wa(a,b){return ra.setTimeout(a,b)}function ya(a){return ra.document.createElement(a)}
function v(a){throw Error(a);}function za(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 w(a,b,c,d){a instanceof b||(c=Aa(c),void 0!==d&&(c+="."+d),Ba(a,b,c))}function z(a,b,c,d){typeof a!==b&&(c=Aa(c),void 0!==d&&(c+="."+d),Ba(a,b,c))}function B(a,b,c){"number"===typeof a&&isFinite(a)||(b=Aa(b),void 0!==c&&(b+="."+c),v(b+" must be a real number type, and not NaN or Infinity: "+a))}
function Ba(a,b,c,d){b=Aa(b);c=Aa(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 Ca(a,b,c,d){c=Aa(c);void 0!==d&&(c+="."+d);v(c+" is not in the range "+b+": "+a)}function Da(a){v(("string"===typeof a.className?a.className:"")+" constructor cannot take any arguments.")}
function Ea(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 Fa(a,b){v("No property to set for this enum value: "+b+" on "+a.toString())}function Ha(a){ra.console&&ra.console.log(a)}
function Ia(){ra.console&&ra.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 Ja(a){return"object"===typeof a&&null!==a}function Ka(a){return Array.isArray(a)||ra.NodeList&&a instanceof ra.NodeList||ra.HTMLCollection&&a instanceof ra.HTMLCollection}function La(a,b,c){Ka(a)||Ba(a,"Array or NodeList or HTMLCollection",b,c)}
function Ma(a){return Array.prototype.slice.call(a)}function Na(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 Oa(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 Qa(){var a=Ra.pop();return void 0===a?[]:a}function Ta(a){a.length=0;Ra.push(a)}
function Aa(a){return null===a?"*":"string"===typeof a?a:"function"===typeof a&&"string"===typeof a.className?a.className:""}function Va(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(Ja(a)&&a.constructor)return Va(a.constructor);return typeof a}
function Wa(a){var b=a;Ja(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 Ya(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.nA;if(c&&c[b])return!0;a=Object.getPrototypeOf(a)}return!1}
function Za(a,b,c){Object.defineProperty($a.prototype,a,{get:b,set:c})}function ab(){var a=bb;if(0===a.length)for(var b=ra.document.getElementsByTagName("canvas"),c=b.length,d=0;d<c;d++){var e=b[d];e.parentElement&&e.parentElement.D&&a.push(e.parentElement.D)}return a}
function eb(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 fb=void 0!==ra.navigator&&0<ra.navigator.userAgent.indexOf("MSIE 9.0"),gb=void 0!==ra.navigator&&0<ra.navigator.userAgent.indexOf("MSIE 10.0"),ib=void 0!==ra.navigator&&0<ra.navigator.userAgent.indexOf("Trident/7"),jb=void 0!==ra.navigator&&0<ra.navigator.userAgent.indexOf("Edge/"),kb=void 0!==ra.navigator&&void 0!==ra.navigator.platform&&0<=ra.navigator.platform.toUpperCase().indexOf("MAC"),lb=void 0!==ra.navigator&&void 0!==ra.navigator.platform&&null!==ra.navigator.platform.match(/(iPhone|iPod|iPad)/i),
Ra=[];Object.freeze([]);var bb=[];sa.className="Util";sa.Dx="32ab5ff3b26f42dc0ed90f224d2913b5";sa.adym="gojs.net";sa.vfo="28e646fdb260";sa.className="Util";function D(a,b,c){qb(this);this.l=a;this.Wa=b;this.w=c}D.prototype.toString=function(){return"EnumValue."+this.Wa};function sb(a,b){return void 0===b||null===b||""===b?null:a[b]}function tb(a,b,c,d){a.classType!==b&&(c=Aa(c),void 0!==d&&(c+="."+d),Ba(a,"function"==="a constant of class "+typeof b.className?b.className:"",c))}
na.Object.defineProperties(D.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}}});D.className="EnumValue";function ub(){this.sw=[]}ub.prototype.toString=function(){return this.sw.join("")};ub.prototype.add=function(a){""!==a&&this.sw.push(a)};ub.className="StringBuilder";function xb(){}xb.className="PropertyCollection";
var E={Gi:!1,av:!1,Py:!1,pA:!1,tA:!1,ux:!1,animationExperiments:!1,oA:null,trace:function(a){ra.console&&ra.console.log(a)},vy: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.rm=Object.getOwnPropertyNames(d.prototype);for(var e={gk:0};e.gk<b.rm.length;e={gk:e.gk},e.gk++){var f=Object.getOwnPropertyDescriptor(d.prototype,b.rm[e.gk]);void 0!==f.get&&void 0===f.set&&Object.defineProperty(d.prototype,b.rm[e.gk],{set:function(a,b){return function(){throw Error("Property "+
a.rm[b.gk]+" of "+a.x+" is read-only.");}}(b,e)})}}}b={rm:b.rm,x:b.x}}}};function Cb(){}Cb.prototype.reset=function(){};Cb.prototype.next=function(){return!1};Cb.prototype.fd=function(){return!1};Cb.prototype.first=function(){return null};Cb.prototype.any=function(){return!1};Cb.prototype.all=function(){return!0};Cb.prototype.each=function(){return this};Cb.prototype.map=function(){return this};Cb.prototype.filter=function(){return this};Cb.prototype.zd=function(){};Cb.prototype.toString=function(){return"EmptyIterator"};
na.Object.defineProperties(Cb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return 0}}});Cb.prototype.first=Cb.prototype.first;Cb.prototype.hasNext=Cb.prototype.fd;Cb.prototype.next=Cb.prototype.next;Cb.prototype.reset=Cb.prototype.reset;var Db=null;Cb.className="EmptyIterator";Db=new Cb;function Eb(a){this.key=-1;this.value=a}Eb.prototype.reset=function(){this.key=-1};
Eb.prototype.next=function(){return-1===this.key?(this.key=0,!0):!1};Eb.prototype.fd=function(){return this.next()};Eb.prototype.first=function(){this.key=0;return this.value};Eb.prototype.any=function(a){this.key=-1;return a(this.value)};Eb.prototype.all=function(a){this.key=-1;return a(this.value)};Eb.prototype.each=function(a){this.key=-1;a(this.value);return this};Eb.prototype.map=function(a){return new Eb(a(this.value))};
Eb.prototype.filter=function(a){return a(this.value)?new Eb(this.value):Db};Eb.prototype.zd=function(){this.value=null};Eb.prototype.toString=function(){return"SingletonIterator("+this.value+")"};na.Object.defineProperties(Eb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return 1}}});Eb.prototype.first=Eb.prototype.first;Eb.prototype.hasNext=Eb.prototype.fd;Eb.prototype.next=Eb.prototype.next;
Eb.prototype.reset=Eb.prototype.reset;Eb.className="SingletonIterator";function Gb(a){this.qb=a;this.$e=null;a.Ka=null;this.na=a.s;this.Ua=-1}Gb.prototype.reset=function(){var a=this.qb;a.Ka=null;this.na=a.s;this.Ua=-1};Gb.prototype.next=function(){var a=this.qb;if(a.s!==this.na){if(0>this.key)return!1;Ea(a)}a=a.j;var b=a.length,c=++this.Ua,d=this.$e;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.zd()}return!1};
Gb.prototype.fd=function(){return this.next()};Gb.prototype.first=function(){var a=this.qb;this.na=a.s;this.Ua=0;a=a.j;var b=a.length,c=this.$e;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};Gb.prototype.any=function(a){var b=this.qb;b.Ka=null;var c=b.s;this.Ua=-1;for(var d=b.j,e=d.length,f=this.$e,g=0;g<e;g++){var h=d[g];if(null===f||f(h)){if(a(h))return!0;b.s!==c&&Ea(b)}}return!1};
Gb.prototype.all=function(a){var b=this.qb;b.Ka=null;var c=b.s;this.Ua=-1;for(var d=b.j,e=d.length,f=this.$e,g=0;g<e;g++){var h=d[g];if(null===f||f(h)){if(!a(h))return!1;b.s!==c&&Ea(b)}}return!0};Gb.prototype.each=function(a){var b=this.qb;b.Ka=null;var c=b.s;this.Ua=-1;for(var d=b.j,e=d.length,f=this.$e,g=0;g<e;g++){var h=d[g];if(null===f||f(h))a(h),b.s!==c&&Ea(b)}return this};
Gb.prototype.map=function(a){var b=this.qb;b.Ka=null;var c=b.s;this.Ua=-1;for(var d=[],e=b.j,f=e.length,g=this.$e,h=0;h<f;h++){var k=e[h];if(null===g||g(k))d.push(a(k)),b.s!==c&&Ea(b)}a=new F;a.j=d;a.lb();return a.iterator};Gb.prototype.filter=function(a){var b=this.qb;b.Ka=null;var c=b.s;this.Ua=-1;for(var d=[],e=b.j,f=e.length,g=this.$e,h=0;h<f;h++){var k=e[h];if(null===g||g(k))a(k)&&d.push(k),b.s!==c&&Ea(b)}a=new F;a.j=d;a.lb();return a.iterator};
Gb.prototype.zd=function(){this.key=-1;this.value=null;this.na=-1;this.$e=null;this.qb.Ka=this};Gb.prototype.toString=function(){return"ListIterator@"+this.Ua+"/"+this.qb.count};
na.Object.defineProperties(Gb.prototype,{iterator:{configurable:!0,get:function(){return this}},predicate:{configurable:!0,get:function(){return this.$e},set:function(a){this.$e=a}},count:{configurable:!0,get:function(){var a=this.$e;if(null!==a){for(var b=0,c=this.qb.j,d=c.length,e=0;e<d;e++)a(c[e])&&b++;return b}return this.qb.j.length}}});Gb.prototype.first=Gb.prototype.first;Gb.prototype.hasNext=Gb.prototype.fd;Gb.prototype.next=Gb.prototype.next;
Gb.prototype.reset=Gb.prototype.reset;Gb.className="ListIterator";function Hb(a){this.qb=a;a.Ug=null;this.na=a.s;this.Ua=a.j.length}Hb.prototype.reset=function(){var a=this.qb;a.Ug=null;this.na=a.s;this.Ua=a.j.length};Hb.prototype.next=function(){var a=this.qb;if(a.s!==this.na){if(0>this.key)return!1;Ea(a)}var b=--this.Ua;if(0<=b)return this.key=b,this.value=a.j[b],!0;this.zd();return!1};Hb.prototype.fd=function(){return this.next()};
Hb.prototype.first=function(){var a=this.qb;this.na=a.s;var b=a.j;this.Ua=a=b.length-1;return 0<=a?(b=b[a],this.key=a,this.value=b):null};Hb.prototype.any=function(a){var b=this.qb;b.Ug=null;var c=b.s,d=b.j,e=d.length;this.Ua=e;for(--e;0<=e;e--){if(a(d[e]))return!0;b.s!==c&&Ea(b)}return!1};Hb.prototype.all=function(a){var b=this.qb;b.Ug=null;var c=b.s,d=b.j,e=d.length;this.Ua=e;for(--e;0<=e;e--){if(!a(d[e]))return!1;b.s!==c&&Ea(b)}return!0};
Hb.prototype.each=function(a){var b=this.qb;b.Ug=null;var c=b.s,d=b.j,e=d.length;this.Ua=e;for(--e;0<=e;e--)a(d[e]),b.s!==c&&Ea(b);return this};Hb.prototype.map=function(a){var b=this.qb;b.Ug=null;var c=b.s,d=[],e=b.j,f=e.length;this.Ua=f;for(--f;0<=f;f--)d.push(a(e[f])),b.s!==c&&Ea(b);a=new F;a.j=d;a.lb();return a.iterator};
Hb.prototype.filter=function(a){var b=this.qb;b.Ug=null;var c=b.s,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.s!==c&&Ea(b)}a=new F;a.j=d;a.lb();return a.iterator};Hb.prototype.zd=function(){this.key=-1;this.value=null;this.na=-1;this.qb.Ug=this};Hb.prototype.toString=function(){return"ListIteratorBackwards("+this.Ua+"/"+this.qb.count+")"};
na.Object.defineProperties(Hb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.qb.j.length}}});Hb.prototype.first=Hb.prototype.first;Hb.prototype.hasNext=Hb.prototype.fd;Hb.prototype.next=Hb.prototype.next;Hb.prototype.reset=Hb.prototype.reset;Hb.className="ListIteratorBackwards";
function F(a){qb(this);this.u=!1;this.j=[];this.s=0;this.Ug=this.Ka=null;void 0!==a&&("function"===typeof a||"string"===typeof a?Ia():this.addAll(a))}t=F.prototype;t.lb=function(){var a=this.s;a++;999999999<a&&(a=0);this.s=a};t.freeze=function(){this.u=!0;return this};t.ja=function(){this.u=!1;return this};t.toString=function(){return"List()#"+Jb(this)};t.add=function(a){if(null===a)return this;this.u&&za(this,a);this.j.push(a);this.lb();return this};t.push=function(a){this.add(a)};
t.addAll=function(a){if(null===a)return this;this.u&&za(this);var b=this.j;if(Ka(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.lb();return this};t.clear=function(){this.u&&za(this);this.j.length=0;this.lb()};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){E&&B(a,F,"elt:i");var b=this.j;(0>a||a>=b.length)&&Ca(a,"0 <= i < length",F,"elt:i");return b[a]};t.get=function(a){return this.O(a)};t.jd=function(a,b){E&&B(a,F,"setElt:i");var c=this.j;(0>a||a>=c.length)&&Ca(a,"0 <= i < length",F,"setElt:i");this.u&&za(this,a);c[a]=b};t.set=function(a,b){this.jd(a,b)};t.first=function(){var a=this.j;return 0===a.length?null:a[0]};t.Ub=function(){var a=this.j,b=a.length;return 0<b?a[b-1]:null};
t.pop=function(){this.u&&za(this);var a=this.j;return 0<a.length?a.pop():null};F.prototype.any=function(a){for(var b=this.j,c=this.s,d=b.length,e=0;e<d;e++){if(a(b[e]))return!0;this.s!==c&&Ea(this)}return!1};F.prototype.all=function(a){for(var b=this.j,c=this.s,d=b.length,e=0;e<d;e++){if(!a(b[e]))return!1;this.s!==c&&Ea(this)}return!0};F.prototype.each=function(a){for(var b=this.j,c=this.s,d=b.length,e=0;e<d;e++)a(b[e]),this.s!==c&&Ea(this);return this};
F.prototype.map=function(a){for(var b=new F,c=[],d=this.j,e=this.s,f=d.length,g=0;g<f;g++)c.push(a(d[g])),this.s!==e&&Ea(this);b.j=c;b.lb();return b};F.prototype.filter=function(a){for(var b=new F,c=[],d=this.j,e=this.s,f=d.length,g=0;g<f;g++){var h=d[g];a(h)&&c.push(h);this.s!==e&&Ea(this)}b.j=c;b.lb();return b};t=F.prototype;t.Lb=function(a,b){E&&B(a,F,"insertAt:i");0>a&&Ca(a,">= 0",F,"insertAt:i");this.u&&za(this,a);var c=this.j;a>=c.length?c.push(b):c.splice(a,0,b);this.lb()};
t.remove=function(a){if(null===a)return!1;this.u&&za(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.lb();return!0};t.delete=function(a){return this.remove(a)};t.nb=function(a){E&&B(a,F,"removeAt:i");var b=this.j;(0>a||a>=b.length)&&Ca(a,"0 <= i < length",F,"removeAt:i");this.u&&za(this,a);a===b.length-1?b.pop():b.splice(a,1);this.lb()};
t.removeRange=function(a,b){E&&(B(a,F,"removeRange:from"),B(b,F,"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.u&&za(this);for(var e=a,f=b+1;f<d;)c[e++]=c[f++];c.length=d-(b-a+1);this.lb();return this};F.prototype.copy=function(){var a=new F,b=this.j;0<b.length&&(a.j=Array.prototype.slice.call(b));return a};t=F.prototype;t.Oa=function(){for(var a=this.j,b=this.count,c=Array(b),d=0;d<b;d++)c[d]=a[d];return c};
t.Yv=function(){for(var a=new H,b=this.j,c=this.count,d=0;d<c;d++)a.add(b[d]);return a};t.sort=function(a){E&&z(a,"function",F,"sort:sortfunc");this.u&&za(this);this.j.sort(a);this.lb();return this};
t.Zi=function(a,b,c){var d=this.j,e=d.length;void 0===b&&(b=0);void 0===c&&(c=e);E&&(z(a,"function",F,"sortRange:sortfunc"),B(b,F,"sortRange:from"),B(c,F,"sortRange:to"));this.u&&za(this);var f=c-b;if(1>=f)return this;(0>b||b>=e-1)&&Ca(b,"0 <= from < length",F,"sortRange:from");if(2===f)return c=d[b],e=d[b+1],0<a(c,e)&&(d[b]=e,d[b+1]=c,this.lb()),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.lb();return this};t.reverse=function(){this.u&&za(this);this.j.reverse();this.lb();return this};
na.Object.defineProperties(F.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 Db;var a=this.Ka;return null!==a?(a.reset(),a):new Gb(this)}},iteratorBackwards:{configurable:!0,
enumerable:!0,get:function(){if(0>=this.j.length)return Db;var a=this.Ug;return null!==a?(a.reset(),a):new Hb(this)}}});F.prototype.reverse=F.prototype.reverse;F.prototype.sortRange=F.prototype.Zi;F.prototype.sort=F.prototype.sort;F.prototype.toSet=F.prototype.Yv;F.prototype.toArray=F.prototype.Oa;F.prototype.removeRange=F.prototype.removeRange;F.prototype.removeAt=F.prototype.nb;F.prototype["delete"]=F.prototype.delete;F.prototype.remove=F.prototype.remove;F.prototype.insertAt=F.prototype.Lb;
F.prototype.pop=F.prototype.pop;F.prototype.last=F.prototype.Ub;F.prototype.first=F.prototype.first;F.prototype.set=F.prototype.set;F.prototype.setElt=F.prototype.jd;F.prototype.get=F.prototype.get;F.prototype.elt=F.prototype.O;F.prototype.indexOf=F.prototype.indexOf;F.prototype.has=F.prototype.has;F.prototype.contains=F.prototype.contains;F.prototype.clear=F.prototype.clear;F.prototype.addAll=F.prototype.addAll;F.prototype.push=F.prototype.push;F.prototype.add=F.prototype.add;F.prototype.thaw=F.prototype.ja;
F.prototype.freeze=F.prototype.freeze;F.className="List";function Kb(a){this.jg=a;a.Ka=null;this.na=a.s;this.pa=null}Kb.prototype.reset=function(){var a=this.jg;a.Ka=null;this.na=a.s;this.pa=null};Kb.prototype.next=function(){var a=this.jg;if(a.s!==this.na){if(null===this.key)return!1;Ea(a)}var b=this.pa;b=null===b?a.ga:b.qa;if(null!==b)return this.pa=b,this.value=b.value,this.key=b.key,!0;this.zd();return!1};Kb.prototype.fd=function(){return this.next()};
Kb.prototype.first=function(){var a=this.jg;this.na=a.s;a=a.ga;if(null!==a){this.pa=a;var b=a.value;this.key=a.key;return this.value=b}return null};Kb.prototype.any=function(a){var b=this.jg;b.Ka=null;var c=b.s;this.pa=null;for(var d=b.ga;null!==d;){if(a(d.value))return!0;b.s!==c&&Ea(b);d=d.qa}return!1};Kb.prototype.all=function(a){var b=this.jg;b.Ka=null;var c=b.s;this.pa=null;for(var d=b.ga;null!==d;){if(!a(d.value))return!1;b.s!==c&&Ea(b);d=d.qa}return!0};
Kb.prototype.each=function(a){var b=this.jg;b.Ka=null;var c=b.s;this.pa=null;for(var d=b.ga;null!==d;)a(d.value),b.s!==c&&Ea(b),d=d.qa;return this};Kb.prototype.map=function(a){var b=this.jg;b.Ka=null;for(var c=new F,d=b.s,e=b.ga;null!==e;)c.add(a(e.value)),b.s!==d&&Ea(b),e=e.qa;return c.iterator};Kb.prototype.filter=function(a){var b=this.jg;b.Ka=null;for(var c=new F,d=b.s,e=b.ga;null!==e;){var f=e.value;a(f)&&c.add(f);b.s!==d&&Ea(b);e=e.qa}return c.iterator};
Kb.prototype.zd=function(){this.value=this.key=null;this.na=-1;this.jg.Ka=this};Kb.prototype.toString=function(){return null!==this.pa?"SetIterator@"+this.pa.value:"SetIterator"};na.Object.defineProperties(Kb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.jg.Fb}}});Kb.prototype.first=Kb.prototype.first;Kb.prototype.hasNext=Kb.prototype.fd;Kb.prototype.next=Kb.prototype.next;Kb.prototype.reset=Kb.prototype.reset;
Kb.className="SetIterator";function H(a){qb(this);this.u=!1;this.Gb={};this.Fb=0;this.Ka=null;this.s=0;this.We=this.ga=null;void 0!==a&&("function"===typeof a||"string"===typeof a?Ia():this.addAll(a))}t=H.prototype;t.lb=function(){var a=this.s;a++;999999999<a&&(a=0);this.s=a};t.freeze=function(){this.u=!0;return this};t.ja=function(){this.u=!1;return this};t.toString=function(){return"Set()#"+Jb(this)};
t.add=function(a){if(null===a)return this;this.u&&za(this,a);var b=a;Ja(a)&&(b=Nb(a));void 0===this.Gb[b]&&(this.Fb++,a=new Ob(a,a),this.Gb[b]=a,b=this.We,null===b?this.ga=a:(a.Bl=b,b.qa=a),this.We=a,this.lb());return this};t.addAll=function(a){if(null===a)return this;this.u&&za(this);if(Ka(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 Ja(a)&&(b=Jb(a),void 0===b)?!1:void 0!==this.Gb[b]};t.has=function(a){return this.contains(a)};t.By=function(a){if(null===a)return!0;for(a=a.iterator;a.next();)if(!this.contains(a.value))return!1;return!0};t.Cy=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};
H.prototype.any=function(a){for(var b=this.s,c=this.ga;null!==c;){if(a(c.value))return!0;this.s!==b&&Ea(this);c=c.qa}return!1};H.prototype.all=function(a){for(var b=this.s,c=this.ga;null!==c;){if(!a(c.value))return!1;this.s!==b&&Ea(this);c=c.qa}return!0};H.prototype.each=function(a){for(var b=this.s,c=this.ga;null!==c;)a(c.value),this.s!==b&&Ea(this),c=c.qa;return this};H.prototype.map=function(a){for(var b=new H,c=this.s,d=this.ga;null!==d;)b.add(a(d.value)),this.s!==c&&Ea(this),d=d.qa;return b};
H.prototype.filter=function(a){for(var b=new H,c=this.s,d=this.ga;null!==d;){var e=d.value;a(e)&&b.add(e);this.s!==c&&Ea(this);d=d.qa}return b};t=H.prototype;t.remove=function(a){if(null===a)return!1;this.u&&za(this,a);var b=a;if(Ja(a)&&(b=Jb(a),void 0===b))return!1;a=this.Gb[b];if(void 0===a)return!1;var c=a.qa,d=a.Bl;null!==c&&(c.Bl=d);null!==d&&(d.qa=c);this.ga===a&&(this.ga=c);this.We===a&&(this.We=d);delete this.Gb[b];this.Fb--;this.lb();return!0};t.delete=function(a){return this.remove(a)};
t.vq=function(a){if(null===a)return this;this.u&&za(this);if(Ka(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.aA=function(a){if(null===a||0===this.count)return this;this.u&&za(this);var b=new H;b.addAll(a);a=[];for(var c=this.iterator;c.next();){var d=c.value;b.contains(d)||a.push(d)}this.vq(a);return this};t.clear=function(){this.u&&za(this);this.Gb={};this.Fb=0;null!==this.Ka&&this.Ka.reset();this.We=this.ga=null;this.lb()};
H.prototype.copy=function(){var a=new H,b=this.Gb,c;for(c in b)a.add(b[c].value);return a};H.prototype.Oa=function(){var a=Array(this.Fb),b=this.Gb,c=0,d;for(d in b)a[c]=b[d].value,c++;return a};H.prototype.Xv=function(){var a=new F,b=this.Gb,c;for(c in b)a.add(b[c].value);return a};function qb(a){a.__gohashid=Pb++}function Nb(a){var b=a.__gohashid;void 0===b&&(b=Pb++,a.__gohashid=b);return b}function Jb(a){return a.__gohashid}
na.Object.defineProperties(H.prototype,{count:{configurable:!0,get:function(){return this.Fb}},size:{configurable:!0,get:function(){return this.Fb}},iterator:{configurable:!0,get:function(){if(0>=this.Fb)return Db;var a=this.Ka;return null!==a?(a.reset(),a):new Kb(this)}}});H.prototype.toList=H.prototype.Xv;H.prototype.toArray=H.prototype.Oa;H.prototype.clear=H.prototype.clear;H.prototype.retainAll=H.prototype.aA;H.prototype.removeAll=H.prototype.vq;
H.prototype["delete"]=H.prototype.delete;H.prototype.remove=H.prototype.remove;H.prototype.first=H.prototype.first;H.prototype.containsAny=H.prototype.Cy;H.prototype.containsAll=H.prototype.By;H.prototype.has=H.prototype.has;H.prototype.contains=H.prototype.contains;H.prototype.addAll=H.prototype.addAll;H.prototype.add=H.prototype.add;H.prototype.thaw=H.prototype.ja;H.prototype.freeze=H.prototype.freeze;var Pb=1;H.className="Set";H.uniqueHash=qb;H.hashIdUnique=Nb;H.hashId=Jb;
function Qb(a){this.la=a;this.na=a.s;this.pa=null}Qb.prototype.reset=function(){this.na=this.la.s;this.pa=null};Qb.prototype.next=function(){var a=this.la;if(a.s!==this.na){if(null===this.key)return!1;Ea(a)}var b=this.pa;b=null===b?a.ga:b.qa;if(null!==b)return this.pa=b,this.value=this.key=a=b.key,!0;this.zd();return!1};Qb.prototype.fd=function(){return this.next()};Qb.prototype.first=function(){var a=this.la;this.na=a.s;a=a.ga;return null!==a?(this.pa=a,this.value=this.key=a=a.key):null};
Qb.prototype.any=function(a){var b=this.la,c=b.s;this.pa=null;for(var d=b.ga;null!==d;){if(a(d.key))return!0;b.s!==c&&Ea(b);d=d.qa}return!1};Qb.prototype.all=function(a){var b=this.la,c=b.s;this.pa=null;for(var d=b.ga;null!==d;){if(!a(d.key))return!1;b.s!==c&&Ea(b);d=d.qa}return!0};Qb.prototype.each=function(a){var b=this.la,c=b.s;this.pa=null;for(var d=b.ga;null!==d;)a(d.key),b.s!==c&&Ea(b),d=d.qa;return this};
Qb.prototype.map=function(a){var b=this.la,c=b.s;this.pa=null;for(var d=new F,e=b.ga;null!==e;)d.add(a(e.key)),b.s!==c&&Ea(b),e=e.qa;return d.iterator};Qb.prototype.filter=function(a){var b=this.la,c=b.s;this.pa=null;for(var d=new F,e=b.ga;null!==e;){var f=e.key;a(f)&&d.add(f);b.s!==c&&Ea(b);e=e.qa}return d.iterator};Qb.prototype.zd=function(){this.value=this.key=null;this.na=-1};Qb.prototype.toString=function(){return null!==this.pa?"MapKeySetIterator@"+this.pa.value:"MapKeySetIterator"};
na.Object.defineProperties(Qb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.la.Fb}}});Qb.prototype.first=Qb.prototype.first;Qb.prototype.hasNext=Qb.prototype.fd;Qb.prototype.next=Qb.prototype.next;Qb.prototype.reset=Qb.prototype.reset;Qb.className="MapKeySetIterator";function Rb(a){H.call(this);qb(this);this.u=!0;this.la=a}ma(Rb,H);t=Rb.prototype;t.freeze=function(){return this};t.ja=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};
Rb.prototype.any=function(a){for(var b=this.la.ga;null!==b;){if(a(b.key))return!0;b=b.qa}return!1};Rb.prototype.all=function(a){for(var b=this.la.ga;null!==b;){if(!a(b.key))return!1;b=b.qa}return!0};Rb.prototype.each=function(a){for(var b=this.la.ga;null!==b;)a(b.key),b=b.qa;return this};Rb.prototype.map=function(a){for(var b=new H,c=this.la.ga;null!==c;)b.add(a(c.key)),c=c.qa;return b};Rb.prototype.filter=function(a){for(var b=new H,c=this.la.ga;null!==c;){var d=c.key;a(d)&&b.add(d);c=c.qa}return b};
Rb.prototype.copy=function(){return new Rb(this.la)};Rb.prototype.Yv=function(){var a=new H,b=this.la.Gb,c;for(c in b)a.add(b[c].key);return a};Rb.prototype.Oa=function(){var a=this.la.Gb,b=Array(this.la.Fb),c=0,d;for(d in a)b[c]=a[d].key,c++;return b};Rb.prototype.Xv=function(){var a=new F,b=this.la.Gb,c;for(c in b)a.add(b[c].key);return a};
na.Object.defineProperties(Rb.prototype,{count:{configurable:!0,get:function(){return this.la.Fb}},size:{configurable:!0,get:function(){return this.la.Fb}},iterator:{configurable:!0,get:function(){return 0>=this.la.Fb?Db:new Qb(this.la)}}});Rb.prototype.toList=Rb.prototype.Xv;Rb.prototype.toArray=Rb.prototype.Oa;Rb.prototype.toSet=Rb.prototype.Yv;Rb.prototype.first=Rb.prototype.first;Rb.prototype.clear=Rb.prototype.clear;Rb.prototype["delete"]=Rb.prototype.delete;
Rb.prototype.remove=Rb.prototype.remove;Rb.prototype.has=Rb.prototype.has;Rb.prototype.contains=Rb.prototype.contains;Rb.prototype.add=Rb.prototype.add;Rb.prototype.thaw=Rb.prototype.ja;Rb.prototype.freeze=Rb.prototype.freeze;Rb.className="MapKeySet";function Sb(a){this.la=a;a.Ve=null;this.na=a.s;this.pa=null}Sb.prototype.reset=function(){var a=this.la;a.Ve=null;this.na=a.s;this.pa=null};
Sb.prototype.next=function(){var a=this.la;if(a.s!==this.na){if(null===this.key)return!1;Ea(a)}var b=this.pa;b=null===b?a.ga:b.qa;if(null!==b)return this.pa=b,this.value=b.value,this.key=b.key,!0;this.zd();return!1};Sb.prototype.fd=function(){return this.next()};Sb.prototype.first=function(){var a=this.la;this.na=a.s;a=a.ga;if(null!==a){this.pa=a;var b=a.value;this.key=a.key;return this.value=b}return null};
Sb.prototype.any=function(a){var b=this.la;b.Ve=null;var c=b.s;this.pa=null;for(var d=b.ga;null!==d;){if(a(d.value))return!0;b.s!==c&&Ea(b);d=d.qa}return!1};Sb.prototype.all=function(a){var b=this.la;b.Ve=null;var c=b.s;this.pa=null;for(var d=b.ga;null!==d;){if(!a(d.value))return!1;b.s!==c&&Ea(b);d=d.qa}return!0};Sb.prototype.each=function(a){var b=this.la;b.Ve=null;var c=b.s;this.pa=null;for(var d=b.ga;null!==d;)a(d.value),b.s!==c&&Ea(b),d=d.qa;return this};
Sb.prototype.map=function(a){var b=this.la;b.Ve=null;var c=b.s;this.pa=null;for(var d=new F,e=b.ga;null!==e;)d.add(a(e.value)),b.s!==c&&Ea(b),e=e.qa;return d.iterator};Sb.prototype.filter=function(a){var b=this.la;b.Ve=null;var c=b.s;this.pa=null;for(var d=new F,e=b.ga;null!==e;){var f=e.value;a(f)&&d.add(f);b.s!==c&&Ea(b);e=e.qa}return d.iterator};Sb.prototype.zd=function(){this.value=this.key=null;this.na=-1;this.la.Ve=this};
Sb.prototype.toString=function(){return null!==this.pa?"MapValueSetIterator@"+this.pa.value:"MapValueSetIterator"};na.Object.defineProperties(Sb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.la.Fb}}});Sb.prototype.first=Sb.prototype.first;Sb.prototype.hasNext=Sb.prototype.fd;Sb.prototype.next=Sb.prototype.next;Sb.prototype.reset=Sb.prototype.reset;Sb.className="MapValueSetIterator";
function Ob(a,b){this.key=a;this.value=b;this.Bl=this.qa=null}Ob.prototype.toString=function(){return"{"+this.key+":"+this.value+"}"};Ob.className="KeyValuePair";function Tb(a){this.la=a;a.Ka=null;this.na=a.s;this.pa=null}Tb.prototype.reset=function(){var a=this.la;a.Ka=null;this.na=a.s;this.pa=null};
Tb.prototype.next=function(){var a=this.la;if(a.s!==this.na){if(null===this.key)return!1;Ea(a)}var b=this.pa;b=null===b?a.ga:b.qa;if(null!==b)return this.pa=b,this.key=b.key,this.value=b.value,!0;this.zd();return!1};Tb.prototype.fd=function(){return this.next()};Tb.prototype.first=function(){var a=this.la;this.na=a.s;a=a.ga;return null!==a?(this.pa=a,this.key=a.key,this.value=a.value,a):null};
Tb.prototype.any=function(a){var b=this.la;b.Ka=null;var c=b.s;this.pa=null;for(var d=b.ga;null!==d;){if(a(d))return!0;b.s!==c&&Ea(b);d=d.qa}return!1};Tb.prototype.all=function(a){var b=this.la;b.Ka=null;var c=b.s;this.pa=null;for(var d=b.ga;null!==d;){if(!a(d))return!1;b.s!==c&&Ea(b);d=d.qa}return!0};Tb.prototype.each=function(a){var b=this.la;b.Ka=null;var c=b.s;this.pa=null;for(var d=b.ga;null!==d;)a(d),b.s!==c&&Ea(b),d=d.qa;return this};
Tb.prototype.map=function(a){var b=this.la;b.Ka=null;var c=b.s;this.pa=null;for(var d=new F,e=b.ga;null!==e;)d.add(a(e)),b.s!==c&&Ea(b),e=e.qa;return d.iterator};Tb.prototype.filter=function(a){var b=this.la;b.Ka=null;var c=b.s;this.pa=null;for(var d=new F,e=b.ga;null!==e;)a(e)&&d.add(e),b.s!==c&&Ea(b),e=e.qa;return d.iterator};Tb.prototype.zd=function(){this.value=this.key=null;this.na=-1;this.la.Ka=this};Tb.prototype.toString=function(){return null!==this.pa?"MapIterator@"+this.pa:"MapIterator"};
na.Object.defineProperties(Tb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.la.Fb}}});Tb.prototype.first=Tb.prototype.first;Tb.prototype.hasNext=Tb.prototype.fd;Tb.prototype.next=Tb.prototype.next;Tb.prototype.reset=Tb.prototype.reset;Tb.className="MapIterator";
function Ub(a){qb(this);this.u=!1;this.Gb={};this.Fb=0;this.Ve=this.Ka=null;this.s=0;this.We=this.ga=null;void 0!==a&&("function"===typeof a||"string"===typeof a?Ia():this.addAll(a))}t=Ub.prototype;t.lb=function(){var a=this.s;a++;999999999<a&&(a=0);this.s=a};t.freeze=function(){this.u=!0;return this};t.ja=function(){this.u=!1;return this};t.toString=function(){return"Map()#"+Jb(this)};
t.add=function(a,b){this.u&&za(this,a);var c=a;Ja(a)&&(c=Nb(a));var d=this.Gb[c];void 0===d?(this.Fb++,a=new Ob(a,b),this.Gb[c]=a,c=this.We,null===c?this.ga=a:(a.Bl=c,c.qa=a),this.We=a,this.lb()):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(Ka(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];this.add(d.key,d.value)}else for(a=a.iterator;a.next();)b=a.value,this.add(b.key,b.value);return this};t.first=function(){return this.ga};
Ub.prototype.any=function(a){for(var b=this.s,c=this.ga;null!==c;){if(a(c))return!0;this.s!==b&&Ea(this);c=c.qa}return!1};Ub.prototype.all=function(a){for(var b=this.s,c=this.ga;null!==c;){if(!a(c))return!1;this.s!==b&&Ea(this);c=c.qa}return!0};Ub.prototype.each=function(a){for(var b=this.s,c=this.ga;null!==c;)a(c),this.s!==b&&Ea(this),c=c.qa;return this};Ub.prototype.map=function(a){for(var b=new Ub,c=this.s,d=this.ga;null!==d;)b.add(d.key,a(d)),this.s!==c&&Ea(this),d=d.qa;return b};
Ub.prototype.filter=function(a){for(var b=new Ub,c=this.s,d=this.ga;null!==d;)a(d)&&b.add(d.key,d.value),this.s!==c&&Ea(this),d=d.qa;return b};t=Ub.prototype;t.contains=function(a){var b=a;return Ja(a)&&(b=Jb(a),void 0===b)?!1:void 0!==this.Gb[b]};t.has=function(a){return this.contains(a)};t.K=function(a){var b=a;if(Ja(a)&&(b=Jb(a),void 0===b))return null;a=this.Gb[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.u&&za(this,a);var b=a;if(Ja(a)&&(b=Jb(a),void 0===b))return!1;a=this.Gb[b];if(void 0===a)return!1;var c=a.qa,d=a.Bl;null!==c&&(c.Bl=d);null!==d&&(d.qa=c);this.ga===a&&(this.ga=c);this.We===a&&(this.We=d);delete this.Gb[b];this.Fb--;this.lb();return!0};t.delete=function(a){return this.remove(a)};t.clear=function(){this.u&&za(this);this.Gb={};this.Fb=0;null!==this.Ka&&this.Ka.reset();null!==this.Ve&&this.Ve.reset();this.We=this.ga=null;this.lb()};
Ub.prototype.copy=function(){var a=new Ub,b=this.Gb,c;for(c in b){var d=b[c];a.add(d.key,d.value)}return a};Ub.prototype.Oa=function(){var a=this.Gb,b=Array(this.Fb),c=0,d;for(d in a){var e=a[d];b[c]=new Ob(e.key,e.value);c++}return b};Ub.prototype.$d=function(){return new Rb(this)};
na.Object.defineProperties(Ub.prototype,{count:{configurable:!0,get:function(){return this.Fb}},size:{configurable:!0,get:function(){return this.Fb}},iterator:{configurable:!0,get:function(){if(0>=this.count)return Db;var a=this.Ka;return null!==a?(a.reset(),a):new Tb(this)}},iteratorKeys:{configurable:!0,get:function(){return 0>=this.count?Db:new Qb(this)}},iteratorValues:{configurable:!0,get:function(){if(0>=this.count)return Db;
var a=this.Ve;return null!==a?(a.reset(),a):new Sb(this)}}});Ub.prototype.toKeySet=Ub.prototype.$d;Ub.prototype.toArray=Ub.prototype.Oa;Ub.prototype.clear=Ub.prototype.clear;Ub.prototype["delete"]=Ub.prototype.delete;Ub.prototype.remove=Ub.prototype.remove;Ub.prototype.get=Ub.prototype.get;Ub.prototype.getValue=Ub.prototype.K;Ub.prototype.has=Ub.prototype.has;Ub.prototype.contains=Ub.prototype.contains;Ub.prototype.first=Ub.prototype.first;Ub.prototype.addAll=Ub.prototype.addAll;
Ub.prototype.set=Ub.prototype.set;Ub.prototype.add=Ub.prototype.add;Ub.prototype.thaw=Ub.prototype.ja;Ub.prototype.freeze=Ub.prototype.freeze;Ub.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.u=!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.yg=function(a,b){E&&(z(a,"number",J,"setTo:x"),z(b,"number",J,"setTo:y"),this.ha());this.G=a;this.H=b;return this};J.prototype.set=function(a){E&&(w(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.u=!0;Object.freeze(this);return this};t.J=function(){return Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.u=!0;return this};
t.ja=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.u=!1;return this};t.ha=function(a){if(this.u){var b="The Point is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+="  to value: "+a);v(b)}};function Vb(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));return new J(c,e)}return new J}
function Xb(a){E&&w(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.Ii=function(a,b){return this.G===a&&this.H===b};t.Sa=function(a){return K.B(this.G,a.x)&&K.B(this.H,a.y)};t.add=function(a){E&&(w(a,J,J,"add:p"),this.ha());this.G+=a.x;this.H+=a.y;return this};t.Zd=function(a){E&&(w(a,J,J,"subtract:p"),this.ha());this.G-=a.x;this.H-=a.y;return this};
t.offset=function(a,b){E&&(B(a,J,"offset:dx"),B(b,J,"offset:dy"),this.ha());this.G+=a;this.H+=b;return this};J.prototype.rotate=function(a){E&&(B(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){E&&(B(a,J,"scale:sx"),B(b,J,"scale:sy"),this.ha());this.G*=a;this.H*=b;return this};t.Fe=function(a){E&&w(a,J,J,"distanceSquaredPoint:p");var b=a.x-this.G;a=a.y-this.H;return b*b+a*a};t.ed=function(a,b){E&&(B(a,J,"distanceSquared:px"),B(b,J,"distanceSquared:py"));a-=this.G;b-=this.H;return a*a+b*b};t.normalize=function(){E&&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){E&&w(a,J,J,"directionPoint:p");return Yb(a.x-this.G,a.y-this.H)};t.direction=function(a,b){E&&(B(a,J,"direction:px"),B(b,J,"direction:py"));return Yb(a-this.G,b-this.H)};function Yb(a,b){if(0===a)return 0<b?90:0>b?270:0;if(0===b)return 0<a?0:180;if(isNaN(a)||isNaN(b))return 0;var c=180*Math.atan(Math.abs(b/a))/Math.PI;0>a?c=0>b?c+180:180-c:0>b&&(c=360-c);return c}
t.Uz=function(a,b,c,d){E&&(B(a,J,"projectOntoLineSegment:px"),B(b,J,"projectOntoLineSegment:py"),B(c,J,"projectOntoLineSegment:qx"),B(d,J,"projectOntoLineSegment:qy"));K.Wi(a,b,c,d,this.G,this.H,this);return this};t.Vz=function(a,b){E&&(w(a,J,J,"projectOntoLineSegmentPoint:p"),w(b,J,J,"projectOntoLineSegmentPoint:q"));K.Wi(a.x,a.y,b.x,b.y,this.G,this.H,this);return this};
t.fA=function(a,b,c,d){E&&(B(a,J,"snapToGrid:originx"),B(b,J,"snapToGrid:originy"),B(c,J,"snapToGrid:cellwidth"),B(d,J,"snapToGrid:cellheight"));K.bq(this.G,this.H,a,b,c,d,this);return this};t.gA=function(a,b){E&&(w(a,J,J,"snapToGridPoint:p"),w(b,Zb,J,"snapToGridPoint:q"));K.bq(this.G,this.H,a.x,a.y,b.width,b.height,this);return this};t.Yi=function(a,b){E&&(w(a,L,J,"setRectSpot:r"),w(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.uk=function(a,b,c,d,e){E&&(B(a,J,"setSpot:x"),B(b,J,"setSpot:y"),B(c,J,"setSpot:w"),B(d,J,"setSpot:h"),(0>c||0>d)&&v("Point.setSpot:Width and height cannot be negative"),w(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){E&&w(a,$b,J,"transform:t");a.va(this);return this};function ac(a,b){E&&w(b,$b,J,"transformInverted:t");b.Wd(a);return a}
function cc(a,b,c,d,e,f){E&&(B(a,J,"distanceLineSegmentSquared:px"),B(b,J,"distanceLineSegmentSquared:py"),B(c,J,"distanceLineSegmentSquared:ax"),B(d,J,"distanceLineSegmentSquared:ay"),B(e,J,"distanceLineSegmentSquared:bx"),B(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 dc(a,b,c,d){E&&(B(a,J,"distanceSquared:px"),B(b,J,"distanceSquared:py"),B(c,J,"distanceSquared:qx"),B(d,J,"distanceSquared:qy"));a=c-a;b=d-b;return a*a+b*b}function ec(a,b,c,d){E&&(B(a,J,"direction:px"),B(b,J,"direction:py"),B(c,J,"direction:qx"),B(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=fc.pop();return void 0===a?new J:a};J.allocAt=function(a,b){var c=fc.pop();if(void 0===c)return new J(a,b);c.x=a;c.y=b;return c};J.free=function(a){fc.push(a)};
na.Object.defineProperties(J.prototype,{x:{configurable:!0,get:function(){return this.G},set:function(a){E&&(z(a,"number",J,"x"),this.ha(a));this.G=a}},y:{configurable:!0,get:function(){return this.H},set:function(a){E&&(z(a,"number",J,"y"),this.ha(a));this.H=a}}});J.prototype.isReal=J.prototype.o;J.prototype.setSpot=J.prototype.uk;J.prototype.setRectSpot=J.prototype.Yi;J.prototype.snapToGridPoint=J.prototype.gA;J.prototype.snapToGrid=J.prototype.fA;
J.prototype.projectOntoLineSegmentPoint=J.prototype.Vz;J.prototype.projectOntoLineSegment=J.prototype.Uz;J.prototype.direction=J.prototype.direction;J.prototype.directionPoint=J.prototype.Xa;J.prototype.normalize=J.prototype.normalize;J.prototype.distanceSquared=J.prototype.ed;J.prototype.distanceSquaredPoint=J.prototype.Fe;J.prototype.scale=J.prototype.scale;J.prototype.rotate=J.prototype.rotate;J.prototype.offset=J.prototype.offset;J.prototype.subtract=J.prototype.Zd;J.prototype.add=J.prototype.add;
J.prototype.equalsApprox=J.prototype.Sa;J.prototype.equalTo=J.prototype.Ii;J.prototype.equals=J.prototype.A;J.prototype.set=J.prototype.set;J.prototype.setTo=J.prototype.yg;var gc=null,hc=null,ic=null,jc=null,qc=null,fc=[];J.className="Point";J.parse=Vb;J.stringify=Xb;J.distanceLineSegmentSquared=cc;J.distanceSquared=dc;J.direction=ec;J.Origin=gc=(new J(0,0)).ia();J.InfiniteTopLeft=hc=(new J(-Infinity,-Infinity)).ia();J.InfiniteBottomRight=ic=(new J(Infinity,Infinity)).ia();
J.SixPoint=jc=(new J(6,6)).ia();J.NoPoint=qc=(new J(NaN,NaN)).ia();J.parse=Vb;J.stringify=Xb;J.distanceLineSegmentSquared=cc;J.distanceSquared=dc;J.direction=ec;function Zb(a,b){void 0===a?this.$=this.aa=0:"number"===typeof a&&(0<=a||isNaN(a))&&"number"===typeof b&&(0<=b||isNaN(b))?(this.aa=a,this.$=b):v("Invalid arguments to Size constructor: "+a+", "+b);this.u=!1}var rc,sc,tc,uc,vc,wc,xc;Zb.prototype.assign=function(a){this.aa=a.aa;this.$=a.$;return this};
Zb.prototype.h=function(a,b){this.aa=a;this.$=b;return this};Zb.prototype.yg=function(a,b){E&&(z(a,"number",Zb,"setTo:w"),z(b,"number",Zb,"setTo:h"),0>a&&Ca(a,">= 0",Zb,"setTo:w"),0>b&&Ca(b,">= 0",Zb,"setTo:h"),this.ha());this.aa=a;this.$=b;return this};Zb.prototype.set=function(a){E&&(w(a,Zb,Zb,"set:s"),this.ha());this.aa=a.aa;this.$=a.$;return this};Zb.prototype.copy=function(){var a=new Zb;a.aa=this.aa;a.$=this.$;return a};t=Zb.prototype;t.ia=function(){this.u=!0;Object.freeze(this);return this};
t.J=function(){return Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.u=!0;return this};t.ja=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.u=!1;return this};t.ha=function(a){if(this.u){var b="The Size is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+="  to value: "+a);v(b)}};
function yc(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 Zb(c,e)}return new Zb}function Ac(a){E&&w(a,Zb);return a.width.toString()+" "+a.height.toString()}t.toString=function(){return"Size("+this.width+","+this.height+")"};t.A=function(a){return a instanceof Zb?this.aa===a.width&&this.$===a.height:!1};t.Ii=function(a,b){return this.aa===a&&this.$===b};
t.Sa=function(a){return K.B(this.aa,a.width)&&K.B(this.$,a.height)};t.o=function(){return isFinite(this.width)&&isFinite(this.height)};Zb.alloc=function(){var a=Bc.pop();return void 0===a?new Zb:a};Zb.free=function(a){Bc.push(a)};
na.Object.defineProperties(Zb.prototype,{width:{configurable:!0,get:function(){return this.aa},set:function(a){E&&(z(a,"number",Zb,"width"),this.ha(a));0>a&&Ca(a,">= 0",Zb,"width");this.aa=a}},height:{configurable:!0,get:function(){return this.$},set:function(a){E&&(z(a,"number",Zb,"height"),this.ha(a));0>a&&Ca(a,">= 0",Zb,"height");this.$=a}}});Zb.prototype.isReal=Zb.prototype.o;Zb.prototype.equalsApprox=Zb.prototype.Sa;Zb.prototype.equalTo=Zb.prototype.Ii;
Zb.prototype.equals=Zb.prototype.A;Zb.prototype.set=Zb.prototype.set;Zb.prototype.setTo=Zb.prototype.yg;var Bc=[];Zb.className="Size";Zb.parse=yc;Zb.stringify=Ac;Zb.ZeroSize=rc=(new Zb(0,0)).ia();Zb.OneSize=sc=(new Zb(1,1)).ia();Zb.SixSize=tc=(new Zb(6,6)).ia();Zb.EightSize=uc=(new Zb(8,8)).ia();Zb.TenSize=vc=(new Zb(10,10)).ia();Zb.InfiniteSize=wc=(new Zb(Infinity,Infinity)).ia();Zb.NoSize=xc=(new Zb(NaN,NaN)).ia();Zb.parse=yc;Zb.stringify=Ac;
function L(a,b,c,d){void 0===a?this.$=this.aa=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.aa=Math.abs(c-d),this.$=Math.abs(a-b)):b instanceof Zb?(this.G=c,this.H=a,this.aa=b.aa,this.$=b.$):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.aa=c,this.$=d):v("Invalid arguments to Rect constructor: "+
a+", "+b+", "+c+", "+d);this.u=!1}t=L.prototype;t.assign=function(a){this.G=a.G;this.H=a.H;this.aa=a.aa;this.$=a.$;return this};t.h=function(a,b,c,d){this.G=a;this.H=b;this.aa=c;this.$=d;return this};function Cc(a,b,c){a.aa=b;a.$=c}t.yg=function(a,b,c,d){E&&(z(a,"number",L,"setTo:x"),z(b,"number",L,"setTo:y"),z(c,"number",L,"setTo:w"),z(d,"number",L,"setTo:h"),0>c&&Ca(c,">= 0",L,"setTo:w"),0>d&&Ca(d,">= 0",L,"setTo:h"),this.ha());this.G=a;this.H=b;this.aa=c;this.$=d;return this};
t.set=function(a){E&&(w(a,L,L,"set:r"),this.ha());this.G=a.G;this.H=a.H;this.aa=a.aa;this.$=a.$;return this};t.ld=function(a){E&&(w(a,J,L,"setPoint:p"),this.ha());this.G=a.x;this.H=a.y;return this};t.dA=function(a){E&&(w(a,Zb,L,"setSize:s"),this.ha());this.aa=a.aa;this.$=a.$;return this};L.prototype.copy=function(){var a=new L;a.G=this.G;a.H=this.H;a.aa=this.aa;a.$=this.$;return a};t=L.prototype;t.ia=function(){this.u=!0;Object.freeze(this);return this};
t.J=function(){return Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.u=!0;return this};t.ja=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.u=!1;return this};t.ha=function(a){if(this.u){var b="The Rect 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));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 Ec(a){E&&w(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.aa===a.width&&this.$===a.height:!1};t.Ii=function(a,b,c,d){return this.G===a&&this.H===b&&this.aa===c&&this.$===d};t.Sa=function(a){return K.B(this.G,a.x)&&K.B(this.H,a.y)&&K.B(this.aa,a.width)&&K.B(this.$,a.height)};function Fc(a,b){return K.da(a.G,b.x)&&K.da(a.H,b.y)&&K.da(a.aa,b.width)&&K.da(a.$,b.height)}
t.ea=function(a){E&&w(a,J,L,"containsPoint:p");return this.G<=a.x&&this.G+this.aa>=a.x&&this.H<=a.y&&this.H+this.$>=a.y};t.qf=function(a){E&&w(a,L,L,"containsRect:r");return this.G<=a.x&&a.x+a.width<=this.G+this.aa&&this.H<=a.y&&a.y+a.height<=this.H+this.$};
t.contains=function(a,b,c,d){E?(B(a,L,"contains:x"),B(b,L,"contains:y"),void 0===c?c=0:B(c,L,"contains:w"),void 0===d?d=0:B(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.aa&&this.H<=b&&b+d<=this.H+this.$};t.reset=function(){E&&this.ha();this.$=this.aa=this.H=this.G=0};t.offset=function(a,b){E&&(B(a,L,"offset:dx"),B(b,L,"offset:dy"),this.ha());this.G+=a;this.H+=b;return this};
t.Xc=function(a,b){E&&(B(a,L,"inflate:w"),B(b,L,"inflate:h"));return Gc(this,b,a,b,a)};t.Sp=function(a){E&&w(a,Hc,L,"addMargin:m");return Gc(this,a.top,a.right,a.bottom,a.left)};t.Wv=function(a){E&&w(a,Hc,L,"subtractMargin:m");return Gc(this,-a.top,-a.right,-a.bottom,-a.left)};t.xz=function(a,b,c,d){E&&(B(a,L,"grow:t"),B(b,L,"grow:r"),B(c,L,"grow:b"),B(d,L,"grow:l"));return Gc(this,a,b,c,d)};
function Gc(a,b,c,d,e){E&&a.ha();var f=a.aa;c+e<=-f?(a.G+=f/2,a.aa=0):(a.G-=e,a.aa+=c+e);c=a.$;b+d<=-c?(a.H+=c/2,a.$=0):(a.H-=b,a.$+=b+d);return a}t.Bz=function(a){E&&w(a,L,L,"intersectRect:r");return Kc(this,a.x,a.y,a.width,a.height)};t.pv=function(a,b,c,d){E&&(B(a,L,"intersect:x"),B(b,L,"intersect:y"),B(c,L,"intersect:w"),B(d,L,"intersect:h"),(0>c||0>d)&&v("Rect.intersect:Width and height cannot be negative"));return Kc(this,a,b,c,d)};
function Kc(a,b,c,d,e){E&&a.ha();var f=Math.max(a.G,b),g=Math.max(a.H,c);b=Math.min(a.G+a.aa,b+d);c=Math.min(a.H+a.$,c+e);a.G=f;a.H=g;a.aa=Math.max(0,b-f);a.$=Math.max(0,c-g);return a}t.Kc=function(a){E&&w(a,L,L,"intersectsRect:r");return this.qv(a.x,a.y,a.width,a.height)};
t.qv=function(a,b,c,d){E&&(B(a,L,"intersects:x"),B(b,L,"intersects:y"),B(a,L,"intersects:w"),B(b,L,"intersects:h"),(0>c||0>d)&&v("Rect.intersects:Width and height cannot be negative"));var e=this.aa,f=this.G;if(Infinity!==e&&Infinity!==c&&(e+=f,c+=a,isNaN(c)||isNaN(e)||f>c||a>e))return!1;a=this.$;c=this.H;return Infinity!==a&&Infinity!==d&&(a+=c,d+=b,isNaN(d)||isNaN(a)||c>d||b>a)?!1:!0};
function Lc(a,b,c){var d=a.aa,e=a.G,f=b.x-c;if(e>b.width+c+c+f||f>d+e)return!1;d=a.$;a=a.H;e=b.y-c;return a>b.height+c+c+e||e>d+a?!1:!0}t.Me=function(a){E&&w(a,J,L,"unionPoint:p");return Mc(this,a.x,a.y,0,0)};t.Lc=function(a){E&&w(a,L,L,"unionRect:r");return Mc(this,a.G,a.H,a.aa,a.$)};
t.cw=function(a,b,c,d){E?(B(a,L,"union:x"),B(b,L,"union:y"),void 0===c?c=0:B(c,L,"union:w"),void 0===d?d=0:B(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 Mc(this,a,b,c,d)};function Mc(a,b,c,d,e){var f=Math.min(a.G,b),g=Math.min(a.H,c);b=Math.max(a.G+a.aa,b+d);c=Math.max(a.H+a.$,c+e);a.G=f;a.H=g;a.aa=b-f;a.$=c-g;return a}
t.uk=function(a,b,c){E&&(B(a,L,"setSpot:x"),B(b,L,"setSpot:y"),w(c,M,L,"setSpot:spot"),this.ha());this.G=a-c.offsetX-c.x*this.aa;this.H=b-c.offsetY-c.y*this.$;return this};
function Qc(a,b,c,d,e,f,g,h){E?(B(a,L,"contains:rx"),B(b,L,"contains:ry"),B(c,L,"contains:rw"),B(d,L,"contains:rh"),B(e,L,"contains:x"),B(f,L,"contains:y"),void 0===g?g=0:B(g,L,"contains:w"),void 0===h?h=0:B(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 Rc(a,b,c,d,e,f,g,h){E&&(B(a,L,"intersects:rx"),B(b,L,"intersects:ry"),B(c,L,"intersects:rw"),B(d,L,"intersects:rh"),B(e,L,"intersects:x"),B(f,L,"intersects:y"),B(g,L,"intersects:w"),B(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.Dz=function(){return 0===this.width&&0===this.height};
L.alloc=function(){var a=Sc.pop();return void 0===a?new L:a};L.allocAt=function(a,b,c,d){var e=Sc.pop();return void 0===e?new L(a,b,c,d):e.h(a,b,c,d)};L.free=function(a){Sc.push(a)};
na.Object.defineProperties(L.prototype,{x:{configurable:!0,get:function(){return this.G},set:function(a){E&&(z(a,"number",L,"x"),this.ha(a));this.G=a}},y:{configurable:!0,get:function(){return this.H},set:function(a){E&&(z(a,"number",L,"y"),this.ha(a));this.H=a}},width:{configurable:!0,get:function(){return this.aa},set:function(a){E&&(z(a,"number",L,"width"),this.ha(a));0>a&&Ca(a,">= 0",L,"width");this.aa=a}},height:{configurable:!0,get:function(){return this.$},
set:function(a){E&&(z(a,"number",L,"height"),this.ha(a));0>a&&Ca(a,">= 0",L,"height");this.$=a}},left:{configurable:!0,get:function(){return this.G},set:function(a){E&&(z(a,"number",L,"left"),this.ha(a));this.G=a}},top:{configurable:!0,get:function(){return this.H},set:function(a){E&&(z(a,"number",L,"top"),this.ha(a));this.H=a}},right:{configurable:!0,get:function(){return this.G+this.aa},set:function(a){E&&(B(a,L,"right"),this.ha(a));this.G+=a-(this.G+this.aa)}},
bottom:{configurable:!0,get:function(){return this.H+this.$},set:function(a){E&&(B(a,L,"top"),this.ha(a));this.H+=a-(this.H+this.$)}},position:{configurable:!0,get:function(){return new J(this.G,this.H)},set:function(a){E&&(w(a,J,L,"position"),this.ha(a));this.G=a.x;this.H=a.y}},size:{configurable:!0,get:function(){return new Zb(this.aa,this.$)},set:function(a){E&&(w(a,Zb,L,"size"),this.ha(a));this.aa=a.width;this.$=a.height}},center:{configurable:!0,
get:function(){return new J(this.G+this.aa/2,this.H+this.$/2)},set:function(a){E&&(w(a,J,L,"center"),this.ha(a));this.G=a.x-this.aa/2;this.H=a.y-this.$/2}},centerX:{configurable:!0,get:function(){return this.G+this.aa/2},set:function(a){E&&(B(a,L,"centerX"),this.ha(a));this.G=a-this.aa/2}},centerY:{configurable:!0,get:function(){return this.H+this.$/2},set:function(a){E&&(B(a,L,"centerY"),this.ha(a));this.H=a-this.$/2}}});L.prototype.isEmpty=L.prototype.Dz;
L.prototype.isReal=L.prototype.o;L.prototype.setSpot=L.prototype.uk;L.prototype.union=L.prototype.cw;L.prototype.unionRect=L.prototype.Lc;L.prototype.unionPoint=L.prototype.Me;L.prototype.intersects=L.prototype.qv;L.prototype.intersectsRect=L.prototype.Kc;L.prototype.intersect=L.prototype.pv;L.prototype.intersectRect=L.prototype.Bz;L.prototype.grow=L.prototype.xz;L.prototype.subtractMargin=L.prototype.Wv;L.prototype.addMargin=L.prototype.Sp;L.prototype.inflate=L.prototype.Xc;L.prototype.offset=L.prototype.offset;
L.prototype.contains=L.prototype.contains;L.prototype.containsRect=L.prototype.qf;L.prototype.containsPoint=L.prototype.ea;L.prototype.equalsApprox=L.prototype.Sa;L.prototype.equalTo=L.prototype.Ii;L.prototype.equals=L.prototype.A;L.prototype.setSize=L.prototype.dA;L.prototype.setPoint=L.prototype.ld;L.prototype.set=L.prototype.set;L.prototype.setTo=L.prototype.yg;var Tc=null,Uc=null,Sc=[];L.className="Rect";L.parse=Dc;L.stringify=Ec;L.contains=Qc;L.intersects=Rc;L.ZeroRect=Tc=(new L(0,0,0,0)).ia();
L.NoRect=Uc=(new L(NaN,NaN,NaN,NaN)).ia();L.parse=Dc;L.stringify=Ec;L.contains=Qc;L.intersects=Rc;function Hc(a,b,c,d){void 0===a?this.oe=this.ee=this.ye=this.Ae=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.u=!1}
Hc.prototype.assign=function(a){this.Ae=a.Ae;this.ye=a.ye;this.ee=a.ee;this.oe=a.oe;return this};Hc.prototype.yg=function(a,b,c,d){E&&(z(a,"number",Hc,"setTo:t"),z(b,"number",Hc,"setTo:r"),z(c,"number",Hc,"setTo:b"),z(d,"number",Hc,"setTo:l"),this.ha());this.Ae=a;this.ye=b;this.ee=c;this.oe=d;return this};Hc.prototype.set=function(a){E&&(w(a,Hc,Hc,"assign:m"),this.ha());this.Ae=a.Ae;this.ye=a.ye;this.ee=a.ee;this.oe=a.oe;return this};
Hc.prototype.copy=function(){var a=new Hc;a.Ae=this.Ae;a.ye=this.ye;a.ee=this.ee;a.oe=this.oe;return a};t=Hc.prototype;t.ia=function(){this.u=!0;Object.freeze(this);return this};t.J=function(){return Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.u=!0;return this};t.ja=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.u=!1;return this};
t.ha=function(a){if(this.u){var b="The Margin is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+="  to value: "+a);v(b)}};
function Vc(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=NaN;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));if(isNaN(c))return new Hc;for(var e=NaN;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));if(isNaN(e))return new Hc(c);for(var f=NaN;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));if(isNaN(f))return new Hc(c,e);for(var g=NaN;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));return isNaN(g)?new Hc(c,e):new Hc(c,e,f,g)}return new Hc}
function Xc(a){E&&w(a,Hc);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 Hc?this.Ae===a.top&&this.ye===a.right&&this.ee===a.bottom&&this.oe===a.left:!1};t.Ii=function(a,b,c,d){return this.Ae===a&&this.ye===b&&this.ee===c&&this.oe===d};
t.Sa=function(a){return K.B(this.Ae,a.top)&&K.B(this.ye,a.right)&&K.B(this.ee,a.bottom)&&K.B(this.oe,a.left)};t.o=function(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)};Hc.alloc=function(){var a=Yc.pop();return void 0===a?new Hc:a};Hc.free=function(a){Yc.push(a)};
na.Object.defineProperties(Hc.prototype,{top:{configurable:!0,get:function(){return this.Ae},set:function(a){E&&(B(a,Hc,"top"),this.ha(a));this.Ae=a}},right:{configurable:!0,get:function(){return this.ye},set:function(a){E&&(B(a,Hc,"right"),this.ha(a));this.ye=a}},bottom:{configurable:!0,get:function(){return this.ee},set:function(a){E&&(B(a,Hc,"bottom"),this.ha(a));this.ee=a}},left:{configurable:!0,get:function(){return this.oe},set:function(a){E&&
(B(a,Hc,"left"),this.ha(a));this.oe=a}}});Hc.prototype.isReal=Hc.prototype.o;Hc.prototype.equalsApprox=Hc.prototype.Sa;Hc.prototype.equalTo=Hc.prototype.Ii;Hc.prototype.equals=Hc.prototype.A;Hc.prototype.set=Hc.prototype.set;Hc.prototype.setTo=Hc.prototype.yg;var Zc=null,$c=null,Yc=[];Hc.className="Margin";Hc.parse=Vc;Hc.stringify=Xc;Hc.ZeroMargin=Zc=(new Hc(0,0,0,0)).ia();Hc.TwoMargin=$c=(new Hc(2,2,2,2)).ia();Hc.parse=Vc;Hc.stringify=Xc;
function $b(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0}$b.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};$b.prototype.copy=function(){var a=new $b;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=$b.prototype;t.toString=function(){return"Transform("+this.m11+","+this.m12+","+this.m21+","+this.m22+","+this.dx+","+this.dy+")"};
t.A=function(a){return a instanceof $b?this.m11===a.m11&&this.m12===a.m12&&this.m21===a.m21&&this.m22===a.m22&&this.dx===a.dx&&this.dy===a.dy:!1};t.it=function(){return 0===this.dx&&0===this.dy&&1===this.m11&&0===this.m12&&0===this.m21&&1===this.m22};t.reset=function(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0;return this};
t.multiply=function(a){var b=this.m12*a.m11+this.m22*a.m12,c=this.m11*a.m21+this.m21*a.m22,d=this.m12*a.m21+this.m22*a.m22,e=this.m11*a.dx+this.m21*a.dy+this.dx,f=this.m12*a.dx+this.m22*a.dy+this.dy;this.m11=this.m11*a.m11+this.m21*a.m12;this.m12=b;this.m21=c;this.m22=d;this.dx=e;this.dy=f;return this};
t.vv=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.gt=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};
$b.prototype.rotate=function(a,b,c){E&&(B(a,$b,"rotate:angle"),B(b,$b,"rotate:rx"),B(c,$b,"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=$b.prototype;
t.translate=function(a,b){E&&(B(a,$b,"translate:x"),B(b,$b,"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);E&&(B(a,$b,"translate:sx"),B(b,$b,"translate:sy"));this.m11*=a;this.m12*=a;this.m21*=b;this.m22*=b;return this};t.va=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.Wd=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.bw=function(a){var b=a.G,c=a.H,d=b+a.aa,e=c+a.$,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,q=d*f+c*h+l,r=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,q);n=Math.max(n,q);q=Math.min(p,r);p=Math.max(p,r);e=Math.min(e,c);n=Math.max(n,c);q=Math.min(q,b);p=Math.max(p,b);e=Math.min(e,f);n=Math.max(n,f);q=Math.min(q,d);p=Math.max(p,d);a.G=e;a.H=q;a.aa=n-e;a.$=p-q;return a};
$b.alloc=function(){var a=dd.pop();return void 0===a?new $b:a};$b.free=function(a){dd.push(a)};$b.prototype.transformRect=$b.prototype.bw;$b.prototype.invertedTransformPoint=$b.prototype.Wd;$b.prototype.transformPoint=$b.prototype.va;$b.prototype.scale=$b.prototype.scale;$b.prototype.translate=$b.prototype.translate;$b.prototype.rotate=$b.prototype.rotate;$b.prototype.invert=$b.prototype.gt;$b.prototype.multiplyInverted=$b.prototype.vv;$b.prototype.multiply=$b.prototype.multiply;
$b.prototype.reset=$b.prototype.reset;$b.prototype.isIdentity=$b.prototype.it;$b.prototype.equals=$b.prototype.A;$b.prototype.set=$b.prototype.set;var dd=[];$b.className="Transform";$b.xF="54a702f3e53909c447824c6706603faf4c";function M(a,b,c,d){void 0===a?this.Pd=this.Od=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.u=!1}
var ed,fd,gd,hd,pd,qd,rd,sd,td,ud,vd,wd,Ad,Bd,Cd,Dd,Ed,Fd,Gd,Hd,Id,Md,Nd,Od,Pd,Qd,Rd,Sd,Td,Ud,Vd,Wd,Xd,de,ee,fe;M.prototype.assign=function(a){this.G=a.G;this.H=a.H;this.Od=a.Od;this.Pd=a.Pd;return this};M.prototype.yg=function(a,b,c,d){E&&(ge(a,"setTo:x"),ge(b,"setTo:y"),he(c,"setTo:offx"),he(d,"setTo:offy"),this.ha());this.G=a;this.H=b;this.Od=c;this.Pd=d;return this};M.prototype.set=function(a){E&&(w(a,M,M,"set:s"),this.ha());this.G=a.G;this.H=a.H;this.Od=a.Od;this.Pd=a.Pd;return this};
M.prototype.copy=function(){var a=new M;a.G=this.G;a.H=this.H;a.Od=this.Od;a.Pd=this.Pd;return a};t=M.prototype;t.ia=function(){this.u=!0;Object.freeze(this);return this};t.J=function(){return Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.u=!0;return this};t.ja=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.u=!1;return this};
t.ha=function(a){if(this.u){var b="The Spot is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+="  to value: "+a);v(b)}};function ie(a,b){a.G=NaN;a.H=NaN;a.Od=b;return a}function ge(a,b){(isNaN(a)||1<a||0>a)&&Ca(a,"0 <= "+b+" <= 1",M,b)}function he(a,b){(isNaN(a)||Infinity===a||-Infinity===a)&&Ca(a,"real number, not NaN or Infinity",M,b)}
function je(a){if("string"===typeof a){a=a.trim();if("None"===a)return ed;if("TopLeft"===a)return fd;if("Top"===a||"TopCenter"===a||"MiddleTop"===a)return gd;if("TopRight"===a)return hd;if("Left"===a||"LeftCenter"===a||"MiddleLeft"===a)return pd;if("Center"===a)return qd;if("Right"===a||"RightCenter"===a||"MiddleRight"===a)return rd;if("BottomLeft"===a)return sd;if("Bottom"===a||"BottomCenter"===a||"MiddleBottom"===a)return td;if("BottomRight"===a)return ud;if("TopSide"===a)return vd;if("LeftSide"===
a)return wd;if("RightSide"===a)return Ad;if("BottomSide"===a)return Bd;if("TopBottomSides"===a)return Cd;if("LeftRightSides"===a)return Dd;if("TopLeftSides"===a)return Ed;if("TopRightSides"===a)return Fd;if("BottomLeftSides"===a)return Gd;if("BottomRightSides"===a)return Hd;if("NotTopSide"===a)return Id;if("NotLeftSide"===a)return Md;if("NotRightSide"===a)return Nd;if("NotBottomSide"===a)return Od;if("AllSides"===a)return Pd;if("Default"===a)return Qd;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 ke(a){E&&w(a,M);return a.Za()?a.x.toString()+" "+a.y.toString()+" "+a.offsetX.toString()+" "+a.offsetY.toString():a.toString()}
t.toString=function(){return this.Za()?0===this.Od&&0===this.Pd?"Spot("+this.x+","+this.y+")":"Spot("+this.x+","+this.y+","+this.offsetX+","+this.offsetY+")":this.A(ed)?"None":this.A(fd)?"TopLeft":this.A(gd)?"Top":this.A(hd)?"TopRight":this.A(pd)?"Left":this.A(qd)?"Center":this.A(rd)?"Right":this.A(sd)?"BottomLeft":this.A(td)?"Bottom":this.A(ud)?"BottomRight":this.A(vd)?"TopSide":this.A(wd)?"LeftSide":this.A(Ad)?"RightSide":this.A(Bd)?"BottomSide":this.A(Cd)?"TopBottomSides":this.A(Dd)?"LeftRightSides":
this.A(Ed)?"TopLeftSides":this.A(Fd)?"TopRightSides":this.A(Gd)?"BottomLeftSides":this.A(Hd)?"BottomRightSides":this.A(Id)?"NotTopSide":this.A(Md)?"NotLeftSide":this.A(Nd)?"NotRightSide":this.A(Od)?"NotBottomSide":this.A(Pd)?"AllSides":this.A(Qd)?"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.Od===a.offsetX&&this.Pd===a.offsetY:!1};
t.zv=function(){return new M(.5-(this.G-.5),.5-(this.H-.5),-this.Od,-this.Pd)};t.tf=function(a){if(!this.uf())return!1;if(!a.uf())if(a.A(Rd))a=wd;else if(a.A(Sd))a=Ad;else if(a.A(Td))a=vd;else if(a.A(Ud))a=Bd;else return!1;a=a.offsetY;return(this.Pd&a)===a};t.Za=function(){return!isNaN(this.x)&&!isNaN(this.y)};t.Nb=function(){return isNaN(this.x)||isNaN(this.y)};t.uf=function(){return isNaN(this.x)&&isNaN(this.y)&&1===this.offsetX&&0!==this.offsetY};
t.kq=function(){return isNaN(this.x)&&isNaN(this.y)&&0===this.offsetX&&0===this.offsetY};t.Cb=function(){return isNaN(this.x)&&isNaN(this.y)&&-1===this.offsetX&&0===this.offsetY};M.alloc=function(){var a=le.pop();return void 0===a?new M:a};M.free=function(a){le.push(a)};
na.Object.defineProperties(M.prototype,{x:{configurable:!0,get:function(){return this.G},set:function(a){E&&(ge(a,"x"),this.ha(a));this.G=a}},y:{configurable:!0,get:function(){return this.H},set:function(a){E&&(ge(a,"y"),this.ha(a));this.H=a}},offsetX:{configurable:!0,get:function(){return this.Od},set:function(a){E&&(he(a,"offsetX"),this.ha(a));this.Od=a}},offsetY:{configurable:!0,get:function(){return this.Pd},set:function(a){E&&(he(a,"offsetY"),
this.ha(a));this.Pd=a}}});M.prototype.isDefault=M.prototype.Cb;M.prototype.isNone=M.prototype.kq;M.prototype.isSide=M.prototype.uf;M.prototype.isNoSpot=M.prototype.Nb;M.prototype.isSpot=M.prototype.Za;M.prototype.includesSide=M.prototype.tf;M.prototype.opposite=M.prototype.zv;M.prototype.equals=M.prototype.A;M.prototype.set=M.prototype.set;M.prototype.setTo=M.prototype.yg;var le=[];M.className="Spot";M.parse=je;M.stringify=ke;M.None=ed=ie(new M(0,0,0,0),0).ia();M.Default=Qd=ie(new M(0,0,-1,0),-1).ia();
M.TopLeft=fd=(new M(0,0,0,0)).ia();M.TopCenter=gd=(new M(.5,0,0,0)).ia();M.TopRight=hd=(new M(1,0,0,0)).ia();M.LeftCenter=pd=(new M(0,.5,0,0)).ia();M.Center=qd=(new M(.5,.5,0,0)).ia();M.RightCenter=rd=(new M(1,.5,0,0)).ia();M.BottomLeft=sd=(new M(0,1,0,0)).ia();M.BottomCenter=td=(new M(.5,1,0,0)).ia();M.BottomRight=ud=(new M(1,1,0,0)).ia();M.MiddleTop=Vd=gd;M.MiddleLeft=Wd=pd;M.MiddleRight=Xd=rd;M.MiddleBottom=de=td;M.Top=Td=gd;M.Left=Rd=pd;M.Right=Sd=rd;M.Bottom=Ud=td;
M.TopSide=vd=ie(new M(0,0,1,1),1).ia();M.LeftSide=wd=ie(new M(0,0,1,2),1).ia();M.RightSide=Ad=ie(new M(0,0,1,4),1).ia();M.BottomSide=Bd=ie(new M(0,0,1,8),1).ia();M.TopBottomSides=Cd=ie(new M(0,0,1,9),1).ia();M.LeftRightSides=Dd=ie(new M(0,0,1,6),1).ia();M.TopLeftSides=Ed=ie(new M(0,0,1,3),1).ia();M.TopRightSides=Fd=ie(new M(0,0,1,5),1).ia();M.BottomLeftSides=Gd=ie(new M(0,0,1,10),1).ia();M.BottomRightSides=Hd=ie(new M(0,0,1,12),1).ia();M.NotTopSide=Id=ie(new M(0,0,1,14),1).ia();
M.NotLeftSide=Md=ie(new M(0,0,1,13),1).ia();M.NotRightSide=Nd=ie(new M(0,0,1,11),1).ia();M.NotBottomSide=Od=ie(new M(0,0,1,7),1).ia();M.AllSides=Pd=ie(new M(0,0,1,15),1).ia();ee=(new M(.156,.156)).ia();fe=(new M(.844,.844)).ia();M.parse=je;M.stringify=ke;
var K={lA:"7da71ca0ad381e90",Cg:(Math.sqrt(2)-1)/3*4,kw:null,sqrt:function(a){if(0>=a)return 0;var b=K.kw;if(null===b){b=[];for(var c=0;2E3>=c;c++)b[c]=Math.sqrt(c);K.kw=b}return 1>a?(c=1/a,2E3>=c?1/b[c|0]:Math.sqrt(a)):2E3>=a?b[a|0]:Math.sqrt(a)},B:function(a,b){a-=b;return.5>a&&-.5<a},da:function(a,b){a-=b;return 5E-8>a&&-5E-8<a},Vb: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},Ps:function(a,b,c,d,e,f,g,h,k,l,m,n){if(K.Vb(a,b,g,h,n,c,d)&&K.Vb(a,b,g,h,n,e,f))return K.Vb(a,b,g,h,n,l,m);var p=(a+c)/2,q=(b+d)/2,r=(c+e)/2,u=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(p+r)/2;c=(q+u)/2;r=(r+e)/2;u=(u+f)/2;var x=(d+r)/2,y=(c+u)/2;return K.Ps(a,
b,p,q,d,c,x,y,k,l,m,n)||K.Ps(x,y,r,u,e,f,g,h,k,l,m,n)},xy: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},wy:function(a,b,c,d,e,f,g,h){var k=(c+e)/2,l=(d+f)/2;return ec(((a+c)/2+k)/2,((b+d)/2+l)/2,(k+(e+g)/2)/2,(l+(f+h)/2)/2)},Xl:function(a,b,c,d,e,f,g,h,k,l){if(K.Vb(a,b,g,h,k,c,d)&&K.Vb(a,b,g,h,k,e,f))Mc(l,a,b,0,0),Mc(l,g,h,0,0);else{var m=(a+c)/2,n=(b+d)/2,p=(c+e)/2,q=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(m+p)/2;c=(n+q)/
2;p=(p+e)/2;q=(q+f)/2;var r=(d+p)/2,u=(c+q)/2;K.Xl(a,b,m,n,d,c,r,u,k,l);K.Xl(r,u,p,q,e,f,g,h,k,l)}return l},De:function(a,b,c,d,e,f,g,h,k,l){if(K.Vb(a,b,g,h,k,c,d)&&K.Vb(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,q=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(m+p)/2;c=(n+q)/2;p=(p+e)/2;q=(q+f)/2;var r=(d+p)/2,u=(c+q)/2;K.De(a,b,m,n,d,c,r,u,k,l);K.De(r,u,p,q,e,f,g,h,k,l)}return l},Cv:function(a,b,c,d,e,f,g,h,k,l){if(K.Vb(a,b,e,f,l,c,d))return K.Vb(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,q=(n+d)/2;return K.Cv(a,b,m,n,p,q,g,h,k,l)||K.Cv(p,q,c,d,e,f,g,h,k,l)},wA: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},Bv:function(a,b,c,d,e,f,g,h){if(K.Vb(a,b,e,f,g,c,d))Mc(h,a,b,0,0),Mc(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.Bv(a,b,k,l,m,n,g,h);K.Bv(m,n,c,d,e,f,g,h)}return h},tq:function(a,b,c,d,e,f,g,h){if(K.Vb(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.tq(a,b,k,l,m,n,g,h);K.tq(m,n,c,d,e,f,g,h)}return h},Tp:function(a,b,c,d,e,f,g,h,k,l,m,n,p,q){if(K.Vb(a,b,g,h,p,c,d)&&K.Vb(a,b,g,h,p,e,f)){var r=(a-g)*(l-n)-(b-h)*(k-m);if(0===r)return!1;p=((a*h-b*g)*(k-m)-(a-g)*(k*n-l*m))/r;r=((a*h-b*g)*(l-n)-(b-h)*(k*n-l*m))/r;if((k>m?k-m:m-k)<(l>n?l-n:n-l)){if(b<h?g=b:(g=h,h=b),r<g||r>h)return!1}else if(a<g?h=a:(h=g,g=a),p<h||p>g)return!1;q.h(p,r);return!0}r=
(a+c)/2;var u=(b+d)/2;c=(c+e)/2;d=(d+f)/2;e=(e+g)/2;f=(f+h)/2;var x=(r+c)/2,y=(u+d)/2;c=(c+e)/2;d=(d+f)/2;var A=(x+c)/2,C=(y+d)/2,G=(m-k)*(m-k)+(n-l)*(n-l),I=!1;K.Tp(a,b,r,u,x,y,A,C,k,l,m,n,p,q)&&(a=(q.x-k)*(q.x-k)+(q.y-l)*(q.y-l),a<G&&(G=a,I=!0));a=q.x;b=q.y;K.Tp(A,C,c,d,e,f,g,h,k,l,m,n,p,q)&&((q.x-k)*(q.x-k)+(q.y-l)*(q.y-l)<G?I=!0:q.h(a,b));return I},Up:function(a,b,c,d,e,f,g,h,k,l,m,n,p){var q=0;if(K.Vb(a,b,g,h,p,c,d)&&K.Vb(a,b,g,h,p,e,f)){p=(a-g)*(l-n)-(b-h)*(k-m);if(0===p)return q;var r=((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(r>=m)return q;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 q}else if(a<g?(b=a,a=g):b=g,r<b||r>a)return q;0<p?q++:0>p&&q--}else{r=(a+c)/2;u=(b+d)/2;var x=(c+e)/2,y=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(r+x)/2;c=(u+y)/2;x=(x+e)/2;y=(y+f)/2;var A=(d+x)/2,C=(c+y)/2;q+=K.Up(a,b,r,u,d,c,A,C,k,l,m,n,p);q+=K.Up(A,C,x,y,e,f,g,h,k,l,m,n,p)}return q},Wi:function(a,b,c,d,e,f,g){if(K.da(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.da(b,d)){a<c?(d=a,a=c):d=c;if(e<d)return g.h(d,b),!1;if(e>a)return g.h(a,b),!1;g.h(e,b);return!0}e=((a-e)*(a-c)+(b-f)*(b-d))/((c-a)*(c-a)+(d-b)*(d-b));if(-5E-6>e)return g.h(a,b),!1;if(1.000005<e)return g.h(c,d),!1;g.h(a+e*(c-a),b+e*(d-b));return!0},Je:function(a,b,c,d,e,f,g,h,k){if(K.B(a,c)&&K.B(b,d))return k.h(a,b),!1;if(K.da(e,g))return K.da(a,c)?(K.Wi(a,b,c,d,e,f,k),!1):K.Wi(a,b,c,d,e,(d-b)/(c-a)*(e-a)+b,k);h=(h-f)/(g-e);if(K.da(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.da(h,g))return K.Wi(a,b,c,d,e,f,k),!1;e=(g*a-h*e+f-b)/(g-h);if(K.da(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.Wi(a,b,c,d,e,g*(e-a)+b,k)},sA:function(a,b,c,d,e){return K.Je(c.x,c.y,d.x,d.y,a.x,a.y,b.x,b.y,e)},rA: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,q=0,r=0,u=0;e<g?(p=e,q=g):(p=g,q=e);f<h?(r=e,u=g):(r=g,u=e);p=(q-p)/2+l;l=(u-r)/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},
Wc:function(a,b,c,d,e,f,g,h,k){var l=1E21,m=a,n=b;if(K.Je(a,b,a,d,e,f,g,h,k)){var p=(k.x-e)*(k.x-e)+(k.y-f)*(k.y-f);p<l&&(l=p,m=k.x,n=k.y)}K.Je(c,b,c,d,e,f,g,h,k)&&(p=(k.x-e)*(k.x-e)+(k.y-f)*(k.y-f),p<l&&(l=p,m=k.x,n=k.y));K.Je(a,b,c,b,e,f,g,h,k)&&(b=(k.x-e)*(k.x-e)+(k.y-f)*(k.y-f),b<l&&(l=b,m=k.x,n=k.y));K.Je(a,d,c,d,e,f,g,h,k)&&(a=(k.x-e)*(k.x-e)+(k.y-f)*(k.y-f),a<l&&(l=a,m=k.x,n=k.y));k.h(m,n);return 1E21>l},qA: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},et:function(a,b,c){var d=b.x,e=b.y,f=c.x,g=c.y,h=a.left,k=a.right,l=a.top,m=a.bottom;return d===f?(e<g?(f=e,e=g):f=g,h<=d&&d<=k&&f<=m&&e>=l):e===g?(d<f?(g=d,d=f):g=f,l<=e&&e<=m&&g<=k&&d>=h):a.ea(b)||a.ea(c)||K.dt(h,l,k,l,d,e,f,g)||K.dt(k,l,k,m,d,e,f,g)||K.dt(k,m,h,m,d,e,f,g)||K.dt(h,m,h,l,d,e,f,g)?!0:!1},dt:function(a,b,c,d,e,f,g,h){return 0>=K.Rs(a,b,c,d,e,f)*K.Rs(a,b,c,d,g,h)&&0>=K.Rs(e,
f,g,h,a,b)*K.Rs(e,f,g,h,c,d)},Rs: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},qq:function(a){0>a&&(a+=360);360<=a&&(a-=360);return a},ix: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.Ey(c,l,e,a,b)),d-=Math.abs(e-l),l=e;return f},Ey: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)]},bq: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},qx: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},Jy: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.Ky(k,0===g?a:b,l,c,0,0)},Ky: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},be:new xb,Gm:new xb};K.za=K.lA;
function me(a){E&&1<arguments.length&&v("Geometry constructor can take at most one optional argument, the Geometry type.");qb(this);this.u=!1;void 0===a?a=ne:E&&tb(a,me,me,"constructor:type");this.wa=a;this.Dc=this.nc=this.dd=this.cd=0;this.kj=new F;this.ur=this.kj.s;this.br=(new L).freeze();this.ta=!0;this.Sm=this.Dk=null;this.Tm=NaN;this.ff=fd;this.gf=ud;this.hl=this.jl=NaN;this.Hf=oe}
me.prototype.copy=function(){var a=new me;a.wa=this.wa;a.cd=this.cd;a.dd=this.dd;a.nc=this.nc;a.Dc=this.Dc;for(var b=this.kj.j,c=b.length,d=a.kj,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.ur=this.ur;a.br.assign(this.br);a.ta=this.ta;a.Dk=this.Dk;a.Sm=this.Sm;a.Tm=this.Tm;a.ff=this.ff.J();a.gf=this.gf.J();a.jl=this.jl;a.hl=this.hl;a.Hf=this.Hf;return a};t=me.prototype;t.ia=function(){this.freeze();Object.freeze(this);return this};
t.freeze=function(){this.u=!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.ja=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.u=!1;var a=this.figures;a.ja();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].ja();return this};
t.Sa=function(a){if(!(a instanceof me))return!1;if(this.type!==a.type)return this.type===pe&&a.type===ne?ue(this,a):a.type===pe&&this.type===ne?ue(a,this):!1;if(this.type===ne){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.B(this.startX,a.startX)&&K.B(this.startY,a.startY)&&K.B(this.endX,a.endX)&&K.B(this.endY,a.endY)};
function ue(a,b){return a.type!==pe||b.type!==ne?!1:1===b.figures.count&&(b=b.figures.O(0),1===b.segments.count&&K.B(a.startX,b.startX)&&K.B(a.startY,b.startY)&&(b=b.segments.O(0),b.type===ve&&K.B(a.endX,b.endX)&&K.B(a.endY,b.endY)))?!0:!1}function we(a){return a.toString()}t.hb=function(a){a.classType===me?this.type=a:Fa(this,a)};
t.toString=function(a){void 0===a&&(a=-1);switch(this.type){case pe: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 xe:var b=new L(this.startX,this.startY,0,0);b.cw(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 ye:b=new L(this.startX,this.startY,0,0);b.cw(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 ne: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 ze(a,b){function c(){return u>=G-1?!0:null!==k[u+1].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/)}function d(){u++;return k[u]}function e(){var a=new J(parseFloat(d()),parseFloat(d()));x===x.toLowerCase()&&(a.x=C.x+a.x,a.y=C.y+a.y);return a}function f(){return C=e()}function g(){return A=e()}function h(){var a=y.toLowerCase();return"c"!==a&&"s"!==a&&"q"!==a&&"t"!==a?C:new J(2*C.x-A.x,2*C.y-A.y)}void 0===b&&(b=!1);"string"!==typeof a&&Ba(a,"string",me,"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=
Qa(),n="",p=!1,q=0;q<l.length;q++){var r=l[q];"."!==r||p?"."===r?(m.push(n),n="."):n+=r:(p=!0,n+=r)}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;Ta(m)}}var u=-1,x="",y="";m=new J(0,0);var A=new J(0,0),C=new J(0,0),G=k.length;a=Ae(null);n=l=!1;p=!0;for(q=null;!(u>=G-1);)if(y=x,x=d(),""!==x)switch(x.toUpperCase()){case "X":p=!0;n=l=!1;break;case "M":q=f();null===a.gc||!0===p?(Be(a,q.x,q.y,l,!n),p=!1):a.moveTo(q.x,q.y);for(m=C;!c();)q=f(),a.lineTo(q.x,q.y);break;
case "L":for(;!c();)q=f(),a.lineTo(q.x,q.y);break;case "H":for(;!c();)C=new J((x===x.toLowerCase()?C.x:0)+parseFloat(d()),C.y),a.lineTo(C.x,C.y);break;case "V":for(;!c();)C=new J(C.x,(x===x.toLowerCase()?C.y:0)+parseFloat(d())),a.lineTo(C.x,C.y);break;case "C":for(;!c();){q=e();r=g();var I=f();Ce(a,q.x,q.y,r.x,r.y,I.x,I.y)}break;case "S":for(;!c();)q=h(),r=g(),I=f(),Ce(a,q.x,q.y,r.x,r.y,I.x,I.y);break;case "Q":for(;!c();)q=g(),r=f(),He(a,q.x,q.y,r.x,r.y);break;case "T":for(;!c();)A=q=h(),r=f(),He(a,
q.x,q.y,r.x,r.y);break;case "B":for(;!c();){q=parseFloat(d());r=parseFloat(d());I=parseFloat(d());var O=parseFloat(d()),R=parseFloat(d()),Q=R,ea=!1;c()||(Q=parseFloat(d()),c()||(ea=0!==parseFloat(d())));x===x.toLowerCase()&&(I+=C.x,O+=C.y);a.arcTo(q,r,I,O,R,Q,ea)}break;case "A":for(;!c();)q=Math.abs(parseFloat(d())),r=Math.abs(parseFloat(d())),I=parseFloat(d()),O=!!parseFloat(d()),R=!!parseFloat(d()),Q=f(),Ie(a,q,r,I,O,R,Q.x,Q.y);break;case "Z":Je(a);C=m;break;case "F":q="";for(r=1;k[u+r];)if(null!==
k[u+r].match(/[Uu]/))r++;else if(null===k[u+r].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/))r++;else{q=k[u+r];break}q.match(/[Mm]/)?l=!0:0<a.gc.segments.length&&(a.gc.isFilled=!0);break;case "U":q="";for(r=1;k[u+r];)if(null!==k[u+r].match(/[Ff]/))r++;else if(null===k[u+r].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/))r++;else{q=k[u+r];break}q.match(/[Mm]/)?n=!0:a.Aq(!1)}m=a.Zs;Ke=a;if(b)for(b=m.figures.iterator;b.next();)b.value.isFilled=!0;return m}
function Le(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.va(d);f[0]=d.x;f[1]=d.y;d.x=f[2];d.y=f[3];b.va(d);f[2]=d.x;f[3]=d.y;d.x=f[4];d.y=f[5];b.va(d);f[4]=d.x;f[5]=d.y;d.x=f[6];d.y=f[7];b.va(d);f[6]=d.x;f[7]=d.y}J.free(d)}t.tv=function(){if(this.ta||this.ur!==this.figures.s)return!0;for(var a=this.figures.j,b=a.length,c=0;c<b;c++)if(a[c].tv())return!0;return!1};
me.prototype.computeBounds=function(){this.ta=!1;this.Sm=this.Dk=null;this.Tm=NaN;this.ur=this.figures.s;for(var a=this.figures.j,b=a.length,c=0;c<b;c++){var d=a[c];d.ta=!1;var e=d.segments;d.zs=e.s;d=e.j;e=d.length;for(var f=0;f<e;f++){var g=d[f];g.ta=!1;g.Ne=null}}a=this.br;a.ja();isNaN(this.jl)||isNaN(this.hl)?a.h(0,0,0,0):a.h(0,0,this.jl,this.hl);Me(this,a,!1);Mc(a,0,0,0,0);a.freeze()};me.prototype.hx=function(){var a=new L;Me(this,a,!0);return a};
function Me(a,b,c){switch(a.type){case pe:case xe:case ye:c?b.h(a.cd,a.dd,0,0):Mc(b,a.cd,a.dd,0,0);Mc(b,a.nc,a.Dc,0,0);break;case ne: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):Mc(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 ve:case Ne:k=n.endX;l=n.endY;Mc(b,k,l,0,0);break;case Oe:K.Xl(k,l,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.5,b);k=n.endX;l=n.endY;
break;case Pe:K.Bv(k,l,n.point1X,n.point1Y,n.endX,n.endY,.5,b);k=n.endX;l=n.endY;break;case Qe:case Re:var p=n.type===Qe?Se(n,f):Te(n,f,k,l),q=p.length;if(0===q){k=n.centerX;l=n.centerY;Mc(b,k,l,0,0);break}n=null;for(var r=0;r<q;r++)n=p[r],K.Xl(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)}}
me.prototype.normalize=function(){this.u&&za(this);var a=this.hx();this.offset(-a.x,-a.y);return new J(-a.x,-a.y)};me.prototype.offset=function(a,b){this.u&&za(this);E&&(B(a,me,"offset"),B(b,me,"offset"));this.transform(1,0,0,1,a,b);return this};me.prototype.scale=function(a,b){this.u&&za(this);E&&(B(a,me,"scale:x"),B(b,me,"scale:y"),0===a&&Ca(a,"scale must be non-zero",me,"scale:x"),0===b&&Ca(b,"scale must be non-zero",me,"scale:y"));this.transform(a,0,0,b,0,0);return this};
me.prototype.rotate=function(a,b,c){this.u&&za(this);void 0===b&&(b=0);void 0===c&&(c=0);E&&(B(a,me,"rotate:angle"),B(b,me,"rotate:x"),B(c,me,"rotate:y"));var d=$b.alloc();d.reset();d.rotate(a,b,c);this.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);$b.free(d);return this};t=me.prototype;
t.transform=function(a,b,c,d,e,f){switch(this.type){case pe:case xe:case ye:var g=this.cd;var h=this.dd;this.cd=g*a+h*c+e;this.dd=g*b+h*d+f;g=this.nc;h=this.Dc;this.nc=g*a+h*c+e;this.Dc=g*b+h*d+f;break;case ne: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,q=0;q<p;q++){var r=n[q];switch(r.type){case ve:case Ne:g=r.endX;h=r.endY;r.endX=g*a+h*c+e;r.endY=g*b+h*d+f;break;case Oe:g=r.point1X;h=r.point1Y;
r.point1X=g*a+h*c+e;r.point1Y=g*b+h*d+f;g=r.point2X;h=r.point2Y;r.point2X=g*a+h*c+e;r.point2Y=g*b+h*d+f;g=r.endX;h=r.endY;r.endX=g*a+h*c+e;r.endY=g*b+h*d+f;break;case Pe:g=r.point1X;h=r.point1Y;r.point1X=g*a+h*c+e;r.point1Y=g*b+h*d+f;g=r.endX;h=r.endY;r.endX=g*a+h*c+e;r.endY=g*b+h*d+f;break;case Qe:g=r.centerX;h=r.centerY;r.centerX=g*a+h*c+e;r.centerY=g*b+h*d+f;0!==b&&(g=180*Math.atan2(b,a)/Math.PI,0>g&&(g+=360),r.startAngle+=g);0>a&&(r.startAngle=180-r.startAngle,r.sweepAngle=-r.sweepAngle);0>d&&
(r.startAngle=-r.startAngle,r.sweepAngle=-r.sweepAngle);r.radiusX*=Math.sqrt(a*a+c*c);void 0!==r.radiusY&&(r.radiusY*=Math.sqrt(b*b+d*d));break;case Re:g=r.endX;h=r.endY;r.endX=g*a+h*c+e;r.endY=g*b+h*d+f;0!==b&&(g=180*Math.atan2(b,a)/Math.PI,0>g&&(g+=360),r.xAxisRotation+=g);0>a&&(r.xAxisRotation=180-r.xAxisRotation,r.isClockwiseArc=!r.isClockwiseArc);0>d&&(r.xAxisRotation=-r.xAxisRotation,r.isClockwiseArc=!r.isClockwiseArc);r.radiusX*=Math.sqrt(a*a+c*c);r.radiusY*=Math.sqrt(b*b+d*d);break;default:v("Unknown Segment type: "+
r.type)}}}}this.ta=!0;return this};
t.ea=function(a,b,c,d){var e=a.x;a=a.y;for(var f=this.bounds.x-20,g=0,h,k,l,m,n,p=this.figures.j,q=p.length,r=0;r<q;r++){var u=p[r];if(u.isFilled){if(c&&u.ea(e,a,b))return!0;var x=u.segments;h=u.startX;k=u.startY;for(var y=h,A=k,C=x.j,G=0;G<=x.length;G++){var I=void 0;if(G!==x.length){I=C[G];var O=I.type;m=I.endX;n=I.endY}else O=ve,m=y,n=A;switch(O){case Ne:y=Ue(e,a,f,a,h,k,y,A);if(isNaN(y))return!0;g+=y;y=m;A=n;break;case ve:h=Ue(e,a,f,a,h,k,m,n);if(isNaN(h))return!0;g+=h;break;case Oe:l=K.Up(h,
k,I.point1X,I.point1Y,I.point2X,I.point2Y,m,n,f,a,e,a,.5);g+=l;break;case Pe:l=K.Up(h,k,(h+2*I.point1X)/3,(k+2*I.point1Y)/3,(2*I.point1X+m)/3,(2*I.point1Y+n)/3,m,n,f,a,e,a,.5);g+=l;break;case Qe:case Re:O=I.type===Qe?Se(I,u):Te(I,u,h,k);var R=O.length;if(0===R){h=Ue(e,a,f,a,h,k,I.centerX,I.centerY);if(isNaN(h))return!0;g+=h;break}I=null;for(var Q=0;Q<R;Q++){I=O[Q];if(0===Q){l=Ue(e,a,f,a,h,k,I[0],I[1]);if(isNaN(l))return!0;g+=l}l=K.Up(I[0],I[1],I[2],I[3],I[4],I[5],I[6],I[7],f,a,e,a,.5);g+=l}null!==
I&&(m=I[6],n=I[7]);break;default:v("Unknown Segment type: "+I.type)}h=m;k=n}if(0!==g)return!0;g=0}else if(u.ea(e,a,d?b:b+2))return!0}return 0!==g};function Ue(a,b,c,d,e,f,g,h){if(K.Vb(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 Ve(a,b,c,d){a=a.figures.j;for(var e=a.length,f=0;f<e;f++)if(a[f].ea(b,c,d))return!0;return!1}
t.lv=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=new J);if(this.type===pe)return b.h(this.startX+a*(this.endX-this.startX),this.startY+a*(this.endY-this.startY)),b;for(var c=this.flattenedSegments,d=this.flattenedLengths,e=c.length,f=this.flattenedTotalLength*a,g=0,h=0;h<e;h++){var k=d[h],l=k.length;for(a=0;a<l;a++){var m=k[a];if(g+m>=f)return d=(f-g)/m,c=c[h],e=c[2*a],h=c[2*a+1],b.h(e+(c[2*a+2]-e)*d,h+(c[2*a+3]-h)*d),b;g+=m}}b.h(NaN,NaN);return b};
t.sx=function(a){if(this.type===pe){var b=this.startX,c=this.startY,d=this.endX,e=this.endY;if(b!==d||c!==e){var f=a.x;a=a.y;if(b===d){if(c<e){var g=c;d=e}else g=e,d=c;return a<=g?g===c?0:1:a>=d?d===c?0:1:Math.abs(a-c)/(d-g)}return c===e?(b<d?g=b:(g=d,d=b),f<=g?g===b?0:1:f>=d?d===b?0:1:Math.abs(f-b)/(d-g)):((f-b)*(f-b)+(a-c)*(a-c))/((d-b)*(d-b)+(e-c)*(e-c))}}else if(this.type===xe){g=this.startX;var h=this.startY,k=this.endX;e=this.endY;if(g!==k||h!==e){b=k-g;c=e-h;f=2*b+2*c;d=a.x;a=a.y;d=Math.min(Math.max(d,
g),k);a=Math.min(Math.max(a,h),e);g=Math.abs(d-g);k=Math.abs(d-k);h=Math.abs(a-h);e=Math.abs(a-e);var l=Math.min(g,k,h,e);if(l===h)return d/f;if(l===k)return(b+a)/f;if(l===e)return(2*b+c-d)/f;if(l===g)return(2*b+2*c-a)/f}}else{b=this.flattenedSegments;c=this.flattenedLengths;f=this.flattenedTotalLength;d=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],q=c[n],r=p.length,u=0;u<r;u+=2){var x=p[u],y=p[u+1];if(0!==u){K.Wi(l,m,x,y,a.x,a.y,d);var A=(d.x-a.x)*(d.x-a.x)+(d.y-
a.y)*(d.y-a.y);A<e&&(e=A,g=h,g+=Math.sqrt((d.x-l)*(d.x-l)+(d.y-m)*(d.y-m)));h+=q[(u-2)/2]}l=x;m=y}J.free(d);a=g/f;return 0>a?0:1<a?1:a}return 0};
function We(a){if(null===a.Dk){var b=a.Dk=[],c=a.Sm=[],d=[],e=[];if(a.type===pe)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===xe)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===ye){var f=new Xe;f.startX=a.endX;f.startY=(a.startY+a.endY)/2;var g=new Ye(Qe);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=Se(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.De(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(jf(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 Ne:4<=d.length&&(b.push(d),c.push(jf(d)));d=[];d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;h=g;k=f;break;case ve:d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;break;case Oe:K.De(g,f,p.point1X,p.point1Y,p.point2X,p.point2Y,p.endX,p.endY,
.5,d);g=p.endX;f=p.endY;break;case Pe:K.tq(g,f,p.point1X,p.point1Y,p.endX,p.endY,.5,d);g=p.endX;f=p.endY;break;case Qe:var q=Se(p,e),r=q.length;if(0===r){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(var u=0;u<r;u++){var x=q[u];K.De(g,f,x[2],x[3],x[4],x[5],x[6],x[7],.5,d);g=x[6];f=x[7]}break;case Re:q=Te(p,e,g,f);r=q.length;if(0===r){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(u=0;u<r;u++)x=q[u],K.De(g,f,x[2],x[3],x[4],x[5],x[6],x[7],.5,d),g=x[6],
f=x[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(jf(d)))}}}function jf(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(dc(c,d,g,h)),b.push(c));c=g;d=h}return b}t.add=function(a){this.kj.add(a);return this};t.Dm=function(a,b,c,d,e,f,g,h){this.u&&za(this);this.ff=(new M(a,b,e,f)).freeze();this.gf=(new M(c,d,g,h)).freeze();return this};
na.Object.defineProperties(me.prototype,{flattenedSegments:{configurable:!0,get:function(){We(this);return this.Dk}},flattenedLengths:{configurable:!0,get:function(){We(this);return this.Sm}},flattenedTotalLength:{configurable:!0,get:function(){var a=this.Tm;if(isNaN(a)){if(this.type===pe){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===xe)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.Tm=a}return a}},type:{configurable:!0,get:function(){return this.wa},set:function(a){this.wa!==a&&(E&&tb(a,me,me,"type"),this.u&&za(this,a),this.wa=a,this.ta=!0)}},startX:{configurable:!0,get:function(){return this.cd},set:function(a){this.cd!==a&&(E&&B(a,me,"startX"),this.u&&za(this,a),this.cd=a,this.ta=!0)}},startY:{configurable:!0,
get:function(){return this.dd},set:function(a){this.dd!==a&&(E&&B(a,me,"startY"),this.u&&za(this,a),this.dd=a,this.ta=!0)}},endX:{configurable:!0,get:function(){return this.nc},set:function(a){this.nc!==a&&(E&&B(a,me,"endX"),this.u&&za(this,a),this.nc=a,this.ta=!0)}},endY:{configurable:!0,get:function(){return this.Dc},set:function(a){this.Dc!==a&&(E&&B(a,me,"endY"),this.u&&za(this,a),this.Dc=a,this.ta=!0)}},figures:{configurable:!0,get:function(){return this.kj},
set:function(a){this.kj!==a&&(E&&w(a,F,me,"figures"),this.u&&za(this,a),this.kj=a,this.ta=!0)}},spot1:{configurable:!0,get:function(){return this.ff},set:function(a){E&&w(a,M,me,"spot1");this.u&&za(this,a);this.ff=a.J()}},spot2:{configurable:!0,get:function(){return this.gf},set:function(a){E&&w(a,M,me,"spot2");this.u&&za(this,a);this.gf=a.J()}},defaultStretch:{configurable:!0,get:function(){return this.Hf},set:function(a){E&&tb(a,N,me,"stretch");this.u&&
za(this,a);this.Hf=a}},bounds:{configurable:!0,get:function(){this.tv()&&this.computeBounds();return this.br}}});me.prototype.setSpots=me.prototype.Dm;me.prototype.add=me.prototype.add;me.prototype.getFractionForPoint=me.prototype.sx;me.prototype.getPointAlongPath=me.prototype.lv;me.prototype.transform=me.prototype.transform;me.prototype.rotate=me.prototype.rotate;me.prototype.scale=me.prototype.scale;me.prototype.offset=me.prototype.offset;me.prototype.normalize=me.prototype.normalize;
me.prototype.computeBoundsWithoutOrigin=me.prototype.hx;me.prototype.equalsApprox=me.prototype.Sa;var pe=new D(me,"Line",0),xe=new D(me,"Rectangle",1),ye=new D(me,"Ellipse",2),ne=new D(me,"Path",3);me.className="Geometry";me.stringify=we;me.fillPath=function(a){"string"!==typeof a&&Ba(a,"string",me,"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};
me.parse=ze;me.Line=pe;me.Rectangle=xe;me.Ellipse=ye;me.Path=ne;function Xe(a,b,c,d){qb(this);this.u=!1;void 0===c&&(c=!0);this.Ir=c;void 0===d&&(d=!0);this.Mr=d;void 0!==a?(E&&B(a,Xe,"sx"),this.cd=a):this.cd=0;void 0!==b?(E&&B(b,Xe,"sy"),this.dd=b):this.dd=0;this.Gl=new F;this.zs=this.Gl.s;this.ta=!0}
Xe.prototype.copy=function(){var a=new Xe;a.Ir=this.Ir;a.Mr=this.Mr;a.cd=this.cd;a.dd=this.dd;for(var b=this.Gl.j,c=b.length,d=a.Gl,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.zs=this.zs;a.ta=this.ta;return a};t=Xe.prototype;t.Sa=function(a){if(!(a instanceof Xe&&K.B(this.startX,a.startX)&&K.B(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.u=!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.ja=function(){this.u=!1;var a=this.segments;a.ja();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].ja();return this};
t.tv=function(){if(this.ta)return!0;var a=this.segments;if(this.zs!==a.s)return!0;a=a.j;for(var b=a.length,c=0;c<b;c++)if(a[c].ta)return!0;return!1};t.add=function(a){this.Gl.add(a);return this};
t.ea=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 Ne:f=m.endX;g=m.endY;d=m.endX;e=m.endY;break;case ve:if(K.Vb(d,e,m.endX,m.endY,c,a,b))return!0;d=m.endX;e=m.endY;break;case Oe:if(K.Ps(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 Pe:if(K.Cv(d,e,m.point1X,m.point1Y,m.endX,m.endY,.5,a,b,c))return!0;d=m.endX;e=m.endY;break;case Qe:case Re:var n=m.type===
Qe?Se(m,this):Te(m,this,d,e),p=n.length;if(0===p){if(K.Vb(d,e,m.centerX,m.centerY,c,a,b))return!0;d=m.centerX;e=m.centerY;break}for(var q=null,r=0;r<p;r++)if(q=n[r],0===r&&K.Vb(d,e,q[0],q[1],c,a,b)||K.Ps(q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7],.5,a,b,c))return!0;null!==q&&(d=q[6],e=q[7]);break;default:v("Unknown Segment type: "+m.type)}if(m.isClosed&&(d!==f||e!==g)&&K.Vb(d,e,f,g,c,a,b))return!0}return!1};
na.Object.defineProperties(Xe.prototype,{isFilled:{configurable:!0,get:function(){return this.Ir},set:function(a){E&&z(a,"boolean",Xe,"isFilled");this.u&&za(this,a);this.Ir=a}},isShadowed:{configurable:!0,get:function(){return this.Mr},set:function(a){E&&z(a,"boolean",Xe,"isShadowed");this.u&&za(this,a);this.Mr=a}},startX:{configurable:!0,get:function(){return this.cd},set:function(a){E&&B(a,Xe,"startX");this.u&&za(this,a);this.cd=a;this.ta=!0}},startY:{configurable:!0,
enumerable:!0,get:function(){return this.dd},set:function(a){E&&B(a,Xe,"startY");this.u&&za(this,a);this.dd=a;this.ta=!0}},segments:{configurable:!0,get:function(){return this.Gl},set:function(a){E&&w(a,F,Xe,"segments");this.u&&za(this,a);this.Gl=a;this.ta=!0}}});Xe.prototype.add=Xe.prototype.add;Xe.prototype.equalsApprox=Xe.prototype.Sa;Xe.className="PathFigure";
function Ye(a,b,c,d,e,f,g,h){qb(this);this.u=!1;void 0===a?a=ve:E&&tb(a,Ye,Ye,"constructor:type");this.wa=a;void 0!==b?(E&&B(b,Ye,"ex"),this.nc=b):this.nc=0;void 0!==c?(E&&B(c,Ye,"ey"),this.Dc=c):this.Dc=0;void 0===d&&(d=0);void 0===e&&(e=0);void 0===f&&(f=0);void 0===g&&(g=0);a===Re?(a=f%360,0>a&&(a+=360),this.xe=a,this.ri=0,E&&B(d,Ye,"x1"),this.si=Math.max(d,0),E&&B(e,Ye,"y1"),this.ah=Math.max(e,0),this.nl="boolean"===typeof g?!!g:!1,this.Jk=!!h):(E&&B(d,Ye,"x1"),this.xe=d,E&&B(e,Ye,"y1"),this.ri=
e,E&&B(f,Ye,"x2"),a===Qe&&(f=Math.max(f,0)),this.si=f,"number"===typeof g?(a===Qe&&(g=Math.max(g,0)),this.ah=g):this.ah=0,this.Jk=this.nl=!1);this.pj=!1;this.ta=!0;this.Ne=null}Ye.prototype.copy=function(){var a=new Ye;a.wa=this.wa;a.nc=this.nc;a.Dc=this.Dc;a.xe=this.xe;a.ri=this.ri;a.si=this.si;a.ah=this.ah;a.nl=this.nl;a.Jk=this.Jk;a.pj=this.pj;a.ta=this.ta;return a};t=Ye.prototype;
t.Sa=function(a){if(!(a instanceof Ye)||this.type!==a.type||this.isClosed!==a.isClosed)return!1;switch(this.type){case Ne:case ve:return K.B(this.endX,a.endX)&&K.B(this.endY,a.endY);case Oe:return K.B(this.endX,a.endX)&&K.B(this.endY,a.endY)&&K.B(this.point1X,a.point1X)&&K.B(this.point1Y,a.point1Y)&&K.B(this.point2X,a.point2X)&&K.B(this.point2Y,a.point2Y);case Pe:return K.B(this.endX,a.endX)&&K.B(this.endY,a.endY)&&K.B(this.point1X,a.point1X)&&K.B(this.point1Y,a.point1Y);case Qe:return K.B(this.startAngle,
a.startAngle)&&K.B(this.sweepAngle,a.sweepAngle)&&K.B(this.centerX,a.centerX)&&K.B(this.centerY,a.centerY)&&K.B(this.radiusX,a.radiusX)&&K.B(this.radiusY,a.radiusY);case Re:return this.isClockwiseArc===a.isClockwiseArc&&this.isLargeArc===a.isLargeArc&&K.B(this.xAxisRotation,a.xAxisRotation)&&K.B(this.endX,a.endX)&&K.B(this.endY,a.endY)&&K.B(this.radiusX,a.radiusX)&&K.B(this.radiusY,a.radiusY);default:return!1}};t.hb=function(a){a.classType===Ye?this.type=a:Fa(this,a)};
t.toString=function(a){void 0===a&&(a=-1);switch(this.type){case Ne:a=0>a?"M"+this.endX.toString()+" "+this.endY.toString():"M"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case ve:a=0>a?"L"+this.endX.toString()+" "+this.endY.toString():"L"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Oe: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 Pe: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 Qe: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 Re: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.pj?"z":"")};t.freeze=function(){this.u=!0;return this};t.ja=function(){this.u=!1;return this};t.close=function(){this.pj=!0;return this};
function Se(a,b){if(null!==a.Ne&&!1===b.ta)return a.Ne;var c=a.radiusX,d=a.radiusY;void 0===d&&(d=c);if(0===c||0===d)return a.Ne=[],a.Ne;b=a.xe;var e=a.ri,f=K.ix(0,0,c<d?c:d,a.startAngle,a.startAngle+a.sweepAngle,!1);if(c!==d){var g=$b.alloc();g.reset();c<d?g.scale(1,d/c):g.scale(c/d,1);Le(f,g);$b.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.Ne=f;return a.Ne}
function Te(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.Ne&&!1===b.ta)return a.Ne;b=a.si;var f=a.ah;0===b&&(b=1E-4);0===f&&(f=1E-4);var g=Math.PI/180*a.xe,h=a.nl,k=a.Jk,l=a.nc,m=a.Dc,n=Math.cos(g),p=Math.sin(g),q=n*(c-l)/2+p*(d-m)/2;g=-p*(c-l)/2+n*(d-m)/2;var r=q*q/(b*b)+g*g/(f*f);1<r&&(b*=Math.sqrt(r),f*=Math.sqrt(r));r=(h===k?-1:1)*Math.sqrt((b*b*f*f-b*b*g*g-f*f*q*q)/(b*b*g*g+f*f*q*q));isNaN(r)&&(r=0);h=r*b*g/f;r=r*-f*
q/b;isNaN(h)&&(h=0);isNaN(r)&&(r=0);c=(c+l)/2+n*h-p*r;d=(d+m)/2+p*h+n*r;m=e(1,0,(q-h)/b,(g-r)/f);n=(q-h)/b;l=(g-r)/f;q=(-q-h)/b;h=(-g-r)/f;g=e(n,l,q,h);q=(n*q+l*h)/(Math.sqrt(n*n+l*l)*Math.sqrt(q*q+h*h));-1>=q?g=Math.PI:1<=q&&(g=0);!k&&0<g&&(g-=2*Math.PI);k&&0>g&&(g+=2*Math.PI);k=b>f?1:b/f;q=b>f?f/b:1;b=K.ix(0,0,b>f?b:f,m,m+g,!0);f=$b.alloc();f.reset();f.translate(c,d);f.rotate(a.xe,0,0);f.scale(k,q);Le(b,f);$b.free(f);a.Ne=b;return a.Ne}
na.Object.defineProperties(Ye.prototype,{isClosed:{configurable:!0,get:function(){return this.pj},set:function(a){this.pj!==a&&(this.pj=a,this.ta=!0)}},type:{configurable:!0,get:function(){return this.wa},set:function(a){E&&tb(a,Ye,Ye,"type");this.u&&za(this,a);this.wa=a;this.ta=!0}},endX:{configurable:!0,get:function(){return this.nc},set:function(a){E&&B(a,Ye,"endX");this.u&&za(this,a);this.nc=a;this.ta=!0}},endY:{configurable:!0,get:function(){return this.Dc},
set:function(a){E&&B(a,Ye,"endY");this.u&&za(this,a);this.Dc=a;this.ta=!0}},point1X:{configurable:!0,get:function(){return this.xe},set:function(a){E&&B(a,Ye,"point1X");this.u&&za(this,a);this.xe=a;this.ta=!0}},point1Y:{configurable:!0,get:function(){return this.ri},set:function(a){E&&B(a,Ye,"point1Y");this.u&&za(this,a);this.ri=a;this.ta=!0}},point2X:{configurable:!0,get:function(){return this.si},set:function(a){E&&B(a,Ye,"point2X");this.u&&za(this,a);this.si=
a;this.ta=!0}},point2Y:{configurable:!0,get:function(){return this.ah},set:function(a){E&&B(a,Ye,"point2Y");this.u&&za(this,a);this.ah=a;this.ta=!0}},centerX:{configurable:!0,get:function(){return this.xe},set:function(a){E&&B(a,Ye,"centerX");this.u&&za(this,a);this.xe=a;this.ta=!0}},centerY:{configurable:!0,get:function(){return this.ri},set:function(a){E&&B(a,Ye,"centerY");this.u&&za(this,a);this.ri=a;this.ta=!0}},radiusX:{configurable:!0,
get:function(){return this.si},set:function(a){E&&B(a,Ye,"radiusX");0>a&&Ca(a,">= zero",Ye,"radiusX");this.u&&za(this,a);this.si=a;this.ta=!0}},radiusY:{configurable:!0,get:function(){return this.ah},set:function(a){E&&B(a,Ye,"radiusY");0>a&&Ca(a,">= zero",Ye,"radiusY");this.u&&za(this,a);this.ah=a;this.ta=!0}},startAngle:{configurable:!0,get:function(){return this.nc},set:function(a){this.nc!==a&&(this.u&&za(this,a),E&&B(a,Ye,"startAngle"),a%=360,0>a&&(a+=360),this.nc=
a,this.ta=!0)}},sweepAngle:{configurable:!0,get:function(){return this.Dc},set:function(a){E&&B(a,Ye,"sweepAngle");this.u&&za(this,a);360<a&&(a=360);-360>a&&(a=-360);this.Dc=a;this.ta=!0}},isClockwiseArc:{configurable:!0,get:function(){return this.Jk},set:function(a){this.u&&za(this,a);this.Jk=a;this.ta=!0}},isLargeArc:{configurable:!0,get:function(){return this.nl},set:function(a){this.u&&za(this,a);this.nl=a;this.ta=!0}},xAxisRotation:{configurable:!0,
get:function(){return this.xe},set:function(a){E&&B(a,Ye,"xAxisRotation");a%=360;0>a&&(a+=360);this.u&&za(this,a);this.xe=a;this.ta=!0}}});Ye.prototype.equalsApprox=Ye.prototype.Sa;var Ne=new D(Ye,"Move",0),ve=new D(Ye,"Line",1),Oe=new D(Ye,"Bezier",2),Pe=new D(Ye,"QuadraticBezier",3),Qe=new D(Ye,"Arc",4),Re=new D(Ye,"SvgArc",4);Ye.className="PathSegment";Ye.Move=Ne;Ye.Line=ve;Ye.Bezier=Oe;Ye.QuadraticBezier=Pe;Ye.Arc=Qe;Ye.SvgArc=Re;
function kf(){this.D=null;this.Iu=(new J(0,0)).freeze();this.Yt=(new J(0,0)).freeze();this.Vq=this.bs=0;this.Wq=1;this.Qr="";this.Ks=this.mr=!1;this.lr=this.Yq=0;this.Fg=this.zr=this.Kr=!1;this.tr=null;this.Is=0;this.Sd=this.Hs=null}kf.prototype.copy=function(){var a=new kf;return this.clone(a)};
kf.prototype.clone=function(a){a.D=this.D;a.Iu.assign(this.viewPoint);a.Yt.assign(this.documentPoint);a.bs=this.bs;a.Vq=this.Vq;a.Wq=this.Wq;a.Qr=this.Qr;a.mr=this.mr;a.Ks=this.Ks;a.Yq=this.Yq;a.lr=this.lr;a.Kr=this.Kr;a.zr=this.zr;a.Fg=this.Fg;a.tr=this.tr;a.Is=this.Is;a.Hs=this.Hs;a.Sd=this.Sd;return a};
kf.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};kf.prototype.fq=function(a,b){var c=this.diagram;if(null===c)return b;lf(c,this.event,a,b);return b};
kf.prototype.nz=function(a,b){var c=this.diagram;if(null===c)return b;lf(c,this.event,a,b);b.assign(c.Dt(b));return b};
na.Object.defineProperties(kf.prototype,{diagram:{configurable:!0,get:function(){return this.D},set:function(a){this.D=a}},viewPoint:{configurable:!0,get:function(){return this.Iu},set:function(a){w(a,J,kf,"viewPoint");this.Iu.assign(a)}},documentPoint:{configurable:!0,get:function(){return this.Yt},set:function(a){w(a,J,kf,"documentPoint");this.Yt.assign(a)}},modifiers:{configurable:!0,get:function(){return this.bs},set:function(a){this.bs=
a}},button:{configurable:!0,get:function(){return this.Vq},set:function(a){this.Vq=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.Wq},set:function(a){this.Wq=a}},key:{configurable:!0,get:function(){return this.Qr},set:function(a){this.Qr=a}},down:{configurable:!0,get:function(){return this.mr},set:function(a){this.mr=a}},up:{configurable:!0,
enumerable:!0,get:function(){return this.Ks},set:function(a){this.Ks=a}},clickCount:{configurable:!0,get:function(){return this.Yq},set:function(a){this.Yq=a}},delta:{configurable:!0,get:function(){return this.lr},set:function(a){this.lr=a}},isMultiTouch:{configurable:!0,get:function(){return this.Kr},set:function(a){this.Kr=a}},handled:{configurable:!0,get:function(){return this.zr},set:function(a){this.zr=a}},bubbles:{configurable:!0,
get:function(){return this.Fg},set:function(a){this.Fg=a}},event:{configurable:!0,get:function(){return this.tr},set:function(a){this.tr=a}},isTouchEvent:{configurable:!0,get:function(){var a=ra.TouchEvent,b=this.event;return a&&b instanceof a?!0:(a=ra.PointerEvent)&&b instanceof a&&("touch"===b.pointerType||"pen"===b.pointerType)}},timestamp:{configurable:!0,get:function(){return this.Is},set:function(a){this.Is=a}},targetDiagram:{configurable:!0,
get:function(){return this.Hs},set:function(a){this.Hs=a}},targetObject:{configurable:!0,get:function(){return this.Sd},set:function(a){this.Sd=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}}});kf.prototype.getMultiTouchDocumentPoint=kf.prototype.nz;kf.prototype.getMultiTouchViewPoint=kf.prototype.fq;kf.className="InputEvent";function mf(){this.D=null;this.Wa="";this.ms=this.Fs=null}mf.prototype.copy=function(){var a=new mf;a.D=this.D;a.Wa=this.Wa;a.Fs=this.Fs;a.ms=this.ms;return a};
mf.prototype.toString=function(){var a="*"+this.name;null!==this.subject&&(a+=":"+this.subject.toString());null!==this.parameter&&(a+="("+this.parameter.toString()+")");return a};
na.Object.defineProperties(mf.prototype,{diagram:{configurable:!0,get:function(){return this.D},set:function(a){this.D=a}},name:{configurable:!0,get:function(){return this.Wa},set:function(a){this.Wa=a}},subject:{configurable:!0,get:function(){return this.Fs},set:function(a){this.Fs=a}},parameter:{configurable:!0,get:function(){return this.ms},set:function(a){this.ms=a}}});mf.className="DiagramEvent";
function nf(){this.$m=of;this.Hj=this.$r="";this.Go=this.Ho=this.Mo=this.No=this.Lo=this.D=this.ac=null}nf.prototype.clear=function(){this.Go=this.Ho=this.Mo=this.No=this.Lo=this.D=this.ac=null};
nf.prototype.copy=function(){var a=new nf;a.$m=this.$m;a.$r=this.$r;a.Hj=this.Hj;a.ac=this.ac;a.D=this.D;a.Lo=this.Lo;var b=this.No;a.No=Ja(b)&&"function"===typeof b.J?b.J():b;b=this.Mo;a.Mo=Ja(b)&&"function"===typeof b.J?b.J():b;b=this.Ho;a.Ho=Ja(b)&&"function"===typeof b.J?b.J():b;b=this.Go;a.Go=Ja(b)&&"function"===typeof b.J?b.J():b;return a};nf.prototype.hb=function(a){a.classType===nf?this.change=a:Fa(this,a)};
nf.prototype.toString=function(){var a="";a=this.change===pf?a+"* ":this.change===of?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===pf?null!==this.oldValue&&(a+=" "+this.oldValue):(null!==this.object&&(a+=Wa(this.object)),null!==this.oldValue&&(a+="  old: "+Wa(this.oldValue)),null!==
this.oldParam&&(a+=" "+this.oldParam),null!==this.newValue&&(a+="  new: "+Wa(this.newValue)),null!==this.newParam&&(a+=" "+this.newParam));return a};nf.prototype.K=function(a){return a?this.oldValue:this.newValue};nf.prototype.pz=function(a){return a?this.oldParam:this.newParam};nf.prototype.canUndo=function(){return null!==this.model||null!==this.diagram?!0:!1};nf.prototype.undo=function(){this.canUndo()&&(null!==this.model?this.model.Vj(this,!0):null!==this.diagram&&this.diagram.Vj(this,!0))};
nf.prototype.canRedo=function(){return null!==this.model||null!==this.diagram?!0:!1};nf.prototype.redo=function(){this.canRedo()&&(null!==this.model?this.model.Vj(this,!1):null!==this.diagram&&this.diagram.Vj(this,!1))};
na.Object.defineProperties(nf.prototype,{model:{configurable:!0,get:function(){return this.ac},set:function(a){this.ac=a}},diagram:{configurable:!0,get:function(){return this.D},set:function(a){this.D=a}},change:{configurable:!0,get:function(){return this.$m},set:function(a){E&&tb(a,nf,nf,"change");this.$m=a}},modelChange:{configurable:!0,get:function(){return this.$r},set:function(a){E&&z(a,"string",nf,"modelChange");this.$r=a}},propertyName:{configurable:!0,
enumerable:!0,get:function(){return this.Hj},set:function(a){E&&"string"!==typeof a&&z(a,"function",nf,"propertyName");this.Hj=a}},isTransactionFinished:{configurable:!0,get:function(){return this.$m===pf&&("CommittedTransaction"===this.Hj||"FinishedUndo"===this.Hj||"FinishedRedo"===this.Hj)}},object:{configurable:!0,get:function(){return this.Lo},set:function(a){this.Lo=a}},oldValue:{configurable:!0,get:function(){return this.No},set:function(a){this.No=
a}},oldParam:{configurable:!0,get:function(){return this.Mo},set:function(a){this.Mo=a}},newValue:{configurable:!0,get:function(){return this.Ho},set:function(a){this.Ho=a}},newParam:{configurable:!0,get:function(){return this.Go},set:function(a){this.Go=a}}});nf.prototype.redo=nf.prototype.redo;nf.prototype.canRedo=nf.prototype.canRedo;nf.prototype.undo=nf.prototype.undo;nf.prototype.canUndo=nf.prototype.canUndo;nf.prototype.getParam=nf.prototype.pz;
nf.prototype.getValue=nf.prototype.K;nf.prototype.clear=nf.prototype.clear;var pf=new D(nf,"Transaction",-1),of=new D(nf,"Property",0),qf=new D(nf,"Insert",1),rf=new D(nf,"Remove",2);nf.className="ChangedEvent";nf.Transaction=pf;nf.Property=of;nf.Insert=qf;nf.Remove=rf;function sf(){this.w=(new F).freeze();this.Wa="";this.l=!1}
sf.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};sf.prototype.clear=function(){var a=this.changes;a.ja();for(var b=a.count-1;0<=b;b--){var c=a.O(b);null!==c&&c.clear()}a.clear();a.freeze()};sf.prototype.canUndo=function(){return this.isComplete};
sf.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()}};sf.prototype.canRedo=function(){return this.isComplete};sf.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()}};
na.Object.defineProperties(sf.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}}});sf.prototype.redo=sf.prototype.redo;sf.prototype.canRedo=sf.prototype.canRedo;sf.prototype.undo=sf.prototype.undo;sf.prototype.canUndo=sf.prototype.canUndo;sf.prototype.clear=sf.prototype.clear;
sf.className="Transaction";function tf(){this.pu=new H;this.Fc=!1;this.L=(new F).freeze();this.je=-1;this.w=999;this.le=!1;this.jr=null;this.Ci=0;this.l=!1;E&&(this.l=!0);this.ue=(new F).freeze();this.xl=new F;this.eu=!0;this.ju=!1}
tf.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};
tf.prototype.clear=function(){var a=this.history;a.ja();for(var b=a.count-1;0<=b;b--){var c=a.O(b);null!==c&&c.clear()}a.clear();this.je=-1;a.freeze();this.le=!1;this.jr=null;this.Ci=0;this.ue.ja();this.ue.clear();this.ue.freeze();this.xl.clear()};tf.prototype.copyProperties=function(a){this.isEnabled=a.isEnabled;this.maxHistoryLength=a.maxHistoryLength;this.checksTransactionLevel=a.checksTransactionLevel};t=tf.prototype;t.Yw=function(a){this.pu.add(a)};t.Hx=function(a){this.pu.remove(a)};
t.Ca=function(a){void 0===a&&(a="");null===a&&(a="");if(this.isUndoingRedoing)return!1;!0===this.eu&&(this.eu=!1,this.Ci++,this.zb("StartingFirstTransaction",a,this.currentTransaction),0<this.Ci&&this.Ci--);this.isEnabled&&(this.ue.ja(),this.ue.add(a),this.ue.freeze(),null===this.currentTransaction?this.xl.add(0):this.xl.add(this.currentTransaction.changes.count));this.Ci++;var b=1===this.transactionLevel;b&&this.zb("StartedTransaction",a,this.currentTransaction);return b};
t.ab=function(a){void 0===a&&(a="");return uf(this,!0,a)};t.yf=function(){return uf(this,!1,"")};
function uf(a,b,c){if(a.isUndoingRedoing)return!1;a.checksTransactionLevel&&1>a.transactionLevel&&Ha("Ending transaction without having started a transaction: "+c);var d=1===a.transactionLevel;d&&b&&a.zb("CommittingTransaction",c,a.currentTransaction);var e=0;if(0<a.transactionLevel&&(a.Ci--,a.isEnabled)){var f=a.ue.count;0<f&&(""===c&&(c=a.ue.O(0)),a.ue.ja(),a.ue.nb(f-1),a.ue.freeze());f=a.xl.count;0<f&&(e=a.xl.O(f-1),a.xl.nb(f-1))}f=a.currentTransaction;if(d){if(b){a.ju=!1;if(a.isEnabled&&null!==
f){b=f;b.isComplete=!0;b.name=c;d=a.history;d.ja();for(e=d.count-1;e>a.historyIndex;e--)f=d.O(e),null!==f&&f.clear(),d.nb(e),a.ju=!0;e=a.maxHistoryLength;0<=e&&(0===e?d.clear():d.count>=e&&(f=d.O(0),null!==f&&f.clear(),d.nb(0),a.je--));0!==e&&(d.add(b),a.je++);d.freeze();f=b}a.zb("CommittedTransaction",c,f)}else{a.le=!0;try{a.isEnabled&&null!==f&&(f.isComplete=!0,f.undo())}finally{a.zb("RolledBackTransaction",c,f),a.le=!1}null!==f&&f.clear()}a.jr=null;return!0}if(a.isEnabled&&!b&&null!==f){a=e;c=
f.changes;for(b=c.count-1;b>=a;b--)d=c.O(b),null!==d&&d.undo(),c.ja(),c.nb(b);c.freeze()}return!1}tf.prototype.canUndo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToUndo;return null!==a&&a.canUndo()?!0:!1};tf.prototype.undo=function(){if(this.canUndo()){var a=this.transactionToUndo;try{this.le=!0,this.zb("StartingUndo","Undo",a),this.je--,a.undo()}catch(b){Ha("undo error: "+b.toString())}finally{this.zb("FinishedUndo","Undo",a),this.le=!1}}};
tf.prototype.canRedo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToRedo;return null!==a&&a.canRedo()?!0:!1};tf.prototype.redo=function(){if(this.canRedo()){var a=this.transactionToRedo;try{this.le=!0,this.zb("StartingRedo","Redo",a),this.je++,a.redo()}catch(b){Ha("redo error: "+b.toString())}finally{this.zb("FinishedRedo","Redo",a),this.le=!1}}};
tf.prototype.zb=function(a,b,c){void 0===c&&(c=null);var d=new nf;d.change=pf;d.propertyName=a;d.object=c;d.oldValue=b;for(a=this.models;a.next();)b=a.value,d.model=b,b.Qs(d)};
tf.prototype.ov=function(a){if(this.isEnabled&&!this.isUndoingRedoing&&!this.skipsEvent(a)){var b=this.currentTransaction;null===b&&(this.jr=b=new sf);var c=a.copy();b=b.changes;b.ja();b.add(c);b.freeze();this.checksTransactionLevel&&0>=this.transactionLevel&&!this.eu&&(a=a.diagram,null!==a&&!1===a.Ui||Ha("Change not within a transaction: "+c.toString()))}};
tf.prototype.skipsEvent=function(a){if(null===a||0>a.change.value)return!0;a=a.object;if(void 0!==a.layer){if(a=a.layer,null!==a&&a.isTemporary)return!0}else if(a.isTemporary)return!0;return!1};
na.Object.defineProperties(tf.prototype,{models:{configurable:!0,get:function(){return this.pu.iterator}},isEnabled:{configurable:!0,get:function(){return this.Fc},set:function(a){this.Fc=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.le}},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.je}},currentTransaction:{configurable:!0,get:function(){return this.jr}},transactionLevel:{configurable:!0,
get:function(){return this.Ci}},isInTransaction:{configurable:!0,get:function(){return 0<this.Ci}},checksTransactionLevel:{configurable:!0,get:function(){return this.l},set:function(a){this.l=a}},nestedTransactionNames:{configurable:!0,get:function(){return this.ue}}});tf.prototype.handleChanged=tf.prototype.ov;tf.prototype.redo=tf.prototype.redo;tf.prototype.undo=tf.prototype.undo;tf.prototype.canUndo=tf.prototype.canUndo;
tf.prototype.rollbackTransaction=tf.prototype.yf;tf.prototype.commitTransaction=tf.prototype.ab;tf.prototype.startTransaction=tf.prototype.Ca;tf.prototype.removeModel=tf.prototype.Hx;tf.prototype.addModel=tf.prototype.Yw;tf.prototype.clear=tf.prototype.clear;tf.className="UndoManager";function vf(){0<arguments.length&&Da(vf);qb(this);this.D=yf;this.Wa="";this.Fc=!0;this.Wb=!1;this.Iq=null;this.ky=new kf;this.Ns=-1}vf.prototype.ib=function(a){this.D=a};
vf.prototype.toString=function(){return""!==this.name?this.name+" Tool":Va(this.constructor)};vf.prototype.updateAdornments=function(){};vf.prototype.canStart=function(){return this.isEnabled};vf.prototype.doStart=function(){};vf.prototype.doActivate=function(){this.isActive=!0};vf.prototype.doDeactivate=function(){this.isActive=!1};vf.prototype.doStop=function(){};vf.prototype.doCancel=function(){this.transactionResult=null;this.stopTool()};
vf.prototype.stopTool=function(){var a=this.diagram;a.currentTool===this&&(a.currentTool=null,a.currentCursor="")};vf.prototype.doMouseDown=function(){!this.isActive&&this.canStart()&&this.doActivate()};vf.prototype.doMouseMove=function(){};vf.prototype.doMouseUp=function(){this.stopTool()};vf.prototype.doMouseWheel=function(){};vf.prototype.canStartMultiTouch=function(){return!0};
vf.prototype.standardPinchZoomStart=function(){var a=this.diagram,b=a.lastInput,c=b.fq(0,J.allocAt(NaN,NaN)),d=b.fq(1,J.allocAt(NaN,NaN));if(c.o()&&d.o()&&(this.doCancel(),a.gm("hasGestureZoom"))){a.Oo=a.scale;var e=d.x-c.x,f=d.y-c.y;a.Ow=Math.sqrt(e*e+f*f);b.bubbles=!1}J.free(c);J.free(d)};
vf.prototype.standardPinchZoomMove=function(){var a=this.diagram,b=a.lastInput,c=b.fq(0,J.allocAt(NaN,NaN)),d=b.fq(1,J.allocAt(NaN,NaN));if(c.o()&&d.o()&&(this.doCancel(),a.gm("hasGestureZoom"))){var e=d.x-c.x,f=d.y-c.y;f=Math.sqrt(e*e+f*f)/a.Ow;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.Oo;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)};
vf.prototype.doKeyDown=function(){"Esc"===this.diagram.lastInput.key&&this.doCancel()};vf.prototype.doKeyUp=function(){};vf.prototype.Ca=function(a){void 0===a&&(a=this.name);this.transactionResult=null;return this.diagram.Ca(a)};vf.prototype.Ag=function(){var a=this.diagram;return null===this.transactionResult?a.yf():a.ab(this.transactionResult)};
vf.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.lastInput,c=a.em(b.documentPoint,!1);if(null!==c)if(kb?b.meta:b.control){a.ba("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!b.isSelected);a.ba("ChangedSelection",a.selection)}else if(b.shift){if(!c.isSelected){a.ba("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!0);a.ba("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||(kb?b.meta:b.control)||b.shift||a.Vp()}};vf.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.Tb(d.documentPoint,a,b);d.targetObject=a;zf(a,d,c);return d.handled};
function zf(a,b,c){b.handled=!1;if(null===a||a.wg()){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.ba(e,a)}else{switch(d){case 1:e="BackgroundSingleClicked";break;case 2:e="BackgroundDoubleClicked";break;case 3:e="BackgroundContextClicked"}0!==d&&c.ba(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)}}}
vf.prototype.standardMouseOver=function(){var a=this.diagram,b=a.lastInput;if(!0!==a.animationManager.sb){var c=a.skipsUndoManager;a.skipsUndoManager=!0;var d=a.viewportBounds.ea(b.documentPoint)?a.Tb(b.documentPoint,null,null):null;b.targetObject=d;var e=!1;if(d!==a.Ok){var f=a.Ok,g=f;a.Ok=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.vg(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.vg(d))break;g(b,d,f);e=!0;if(b.handled)break}d=d.panel}d=a.Ok}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.ec();a.skipsUndoManager=c}};vf.prototype.doCurrentObjectChanged=function(){};
vf.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===Af&&!b.shift||e===Bf&&b.control)&&(0<c?d.canIncreaseZoom():d.canDecreaseZoom()))e=a.zoomPoint,a.zoomPoint=b.viewPoint,0<c?d.increaseZoom():d.decreaseZoom(),a.zoomPoint=e,b.bubbles=!1;else if(e===Af&&b.shift||e===Bf&&!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(gb||ib||jb)h=1,0<e&&(e=3),0>e&&(e=-3),0<g&&(g=3),0>g&&(g=-3);if(void 0===h||void 0===e||void 0===g||0===e&&0===g||b.shift)!b.shift&&a.allowVerticalScroll?(f=3*f*a.scrollVerticalLineChange,0<c?a.scroll("pixel","up",f):a.scroll("pixel","down",f)):b.shift&&a.allowHorizontalScroll&&(f=3*f*a.scrollHorizontalLineChange,0<c?a.scroll("pixel","left",f):a.scroll("pixel","right",f));else{switch(h){case 0:c="pixel";break;case 1:c="line";break;case 2:c="page";break;default:c="pixel"}0!==e&&a.allowHorizontalScroll&&
(0<e?a.scroll(c,"left",-e):a.scroll(c,"right",e));0!==g&&a.allowVerticalScroll&&(0<g?a.scroll(c,"up",-g):a.scroll(c,"down",g))}a.position.A(d)||(b.bubbles=!1)}}};vf.prototype.standardWaitAfter=function(a,b){E&&z(a,"number",vf,"standardWaitAfter:delay");void 0===b&&(b=this.diagram.lastInput);this.cancelWaitAfter();var c=this,d=b.clone(this.ky);this.Ns=wa(function(){c.doWaitAfter(d)},a)};vf.prototype.cancelWaitAfter=function(){-1!==this.Ns&&ra.clearTimeout(this.Ns);this.Ns=-1};
vf.prototype.doWaitAfter=function(){};vf.prototype.findToolHandleAt=function(a,b){a=this.diagram.Tb(a,function(a){for(;null!==a&&!(a.panel instanceof Cf);)a=a.panel;return a});return null===a?null:a.part.category===b?a:null};vf.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};
na.Object.defineProperties(vf.prototype,{diagram:{configurable:!0,get:function(){return this.D},set:function(a){a instanceof P&&(this.D=a)}},name:{configurable:!0,get:function(){return this.Wa},set:function(a){z(a,"string",vf,"name");this.Wa=a}},isEnabled:{configurable:!0,get:function(){return this.Fc},set:function(a){z(a,"boolean",vf,"isEnabled");this.Fc=a}},isActive:{configurable:!0,get:function(){return this.Wb},set:function(a){z(a,"boolean",
vf,"isActive");this.Wb=a}},transactionResult:{configurable:!0,get:function(){return this.Iq},set:function(a){null!==a&&z(a,"string",vf,"transactionResult");this.Iq=a}}});vf.prototype.stopTransaction=vf.prototype.Ag;vf.prototype.startTransaction=vf.prototype.Ca;vf.className="Tool";function $a(){vf.call(this);this.name="ToolManager";this.Nc=new F;this.Oc=new F;this.Bg=new F;this.ca=this.Ma=850;this.w=(new Zb(2,2)).ia();this.Xb=5E3;this.Na=Bf;this.L=Df;this.ir=this.l=null;this.Oj=-1}
ma($a,vf);$a.prototype.initializeStandardTools=function(){};$a.prototype.updateAdornments=function(a){var b=this.currentToolTip;if(b instanceof Cf&&this.ir===a){var c=b.adornedObject;(null!==a?c.part===a:null===c)?this.showToolTip(b,c):this.hideToolTip()}};
$a.prototype.doMouseDown=function(){var a=this.diagram,b=a.lastInput;b.isTouchEvent&&this.gestureBehavior===Ef&&(b.bubbles=!1);if(b.isMultiTouch){this.cancelWaitAfter();if(this.gestureBehavior===Ff){b.bubbles=!0;return}if(this.gestureBehavior===Ef)return;if(a.currentTool.canStartMultiTouch()){a.currentTool.standardPinchZoomStart();return}}var c=a.undoManager;E&&c.checksTransactionLevel&&0!==c.transactionLevel&&Ha("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.ib(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===Bf?this.mouseWheelBehavior=Af:this.mouseWheelBehavior===Af&&(this.mouseWheelBehavior=Bf));this.doActivate();this.standardWaitAfter(this.holdDelay,b)};
$a.prototype.doMouseMove=function(){var a=this.diagram,b=a.lastInput;if(b.isMultiTouch){if(this.gestureBehavior===Ff){b.bubbles=!0;return}if(this.gestureBehavior===Ef)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.ib(this.diagram);if(e.canStart()){a.doFocus();a.currentTool=e;a.currentTool===e&&(e.isActive||e.doActivate(),e.doMouseMove());return}}Gf(this,
a);a=b.event;null===a||"mousemove"!==a.type&&"pointermove"!==a.type&&a.cancelable||(b.bubbles=!0)};function Gf(a,b){a.standardMouseOver();a.isBeyondDragSize()&&a.standardWaitAfter(a.isActive?a.holdDelay:a.hoverDelay,b.lastInput)}$a.prototype.doCurrentObjectChanged=function(a,b){a=this.currentToolTip;null===a||null!==b&&a instanceof Cf&&(b===a||b.vg(a))||this.hideToolTip()};
$a.prototype.doWaitAfter=function(a){var b=this.diagram;b.Ea&&(this.doMouseHover(),this.isActive||this.doToolTip(),a.isTouchEvent&&!b.lastInput.handled&&(a=a.copy(),a.button=2,a.buttons=2,b.lastInput=a,b.Rl=!0,b.doMouseUp()))};
$a.prototype.doMouseHover=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.Tb(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)};
$a.prototype.doToolTip=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.Tb(b.documentPoint,null,null));b=b.targetObject;if(null!==b){if(a=this.currentToolTip,!(a instanceof Cf)||b!==a&&!b.vg(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()};
$a.prototype.showToolTip=function(a,b){!E||a instanceof Cf||a instanceof Hf||v("showToolTip:tooltip must be an Adornment or HTMLInfo.");null!==b&&w(b,N,$a,"showToolTip:obj");var c=this.diagram;a!==this.currentToolTip&&this.hideToolTip();if(a instanceof Cf){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.bc();this.positionToolTip(a,
b)}else a instanceof Hf&&a!==this.currentToolTip&&a.show(b,c,this);this.currentToolTip=a;-1!==this.Oj&&(ra.clearTimeout(this.Oj),this.Oj=-1);a=this.toolTipDuration;if(0<a&&Infinity!==a){var e=this;this.Oj=wa(function(){e.hideToolTip()},a)}};
$a.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}};
$a.prototype.hideToolTip=function(){-1!==this.Oj&&(ra.clearTimeout(this.Oj),this.Oj=-1);var a=this.diagram,b=this.currentToolTip;null!==b&&(b instanceof Cf?(a.remove(b),null!==this.ir&&this.ir.xf(b.category),b.data=null,b.adornedObject=null):b instanceof Hf&&null!==b.hide&&b.hide(a,this),this.currentToolTip=null)};
$a.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.ib(this.diagram);if(d.canStart()){a.doFocus();a.currentTool=d;a.currentTool===d&&(d.isActive||d.doActivate(),d.doMouseUp());return}}a.doFocus();this.doDeactivate()};$a.prototype.doMouseWheel=function(){this.standardMouseWheel()};$a.prototype.doKeyDown=function(){var a=this.diagram;null!==a.commandHandler&&a.commandHandler.doKeyDown()};
$a.prototype.doKeyUp=function(){var a=this.diagram;null!==a.commandHandler&&a.commandHandler.doKeyUp()};$a.prototype.findTool=function(a){z(a,"string",$a,"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};
$a.prototype.replaceTool=function(a,b){z(a,"string",$a,"replaceTool:name");null!==b&&(w(b,vf,$a,"replaceTool:newtool"),b.ib(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.jd(d,b):this.mouseDownTools.nb(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.jd(d,b):this.mouseMoveTools.nb(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.jd(d,b):this.mouseUpTools.nb(d),e;return null};function If(a,b,c,d){z(b,"string",$a,"replaceStandardTool:name");w(d,F,$a,"replaceStandardTool:list");null!==c&&(w(c,vf,$a,"replaceStandardTool:newtool"),c.name=b,c.ib(a.diagram));a.findTool(b)?a.replaceTool(b,c):null!==c&&d.add(c)}
na.Object.defineProperties($a.prototype,{mouseWheelBehavior:{configurable:!0,get:function(){return this.Na},set:function(a){tb(a,$a,$a,"mouseWheelBehavior");this.Na=a}},gestureBehavior:{configurable:!0,get:function(){return this.L},set:function(a){tb(a,$a,$a,"gestureBehavior");this.L=a}},currentToolTip:{configurable:!0,get:function(){return this.l},set:function(a){!E||null===a||a instanceof Cf||a instanceof Hf||v("ToolManager.currentToolTip must be an Adornment or HTMLInfo.");
this.l=a;this.ir=null!==a&&a instanceof Cf?a.adornedPart:null}},mouseDownTools:{configurable:!0,get:function(){return this.Nc}},mouseMoveTools:{configurable:!0,get:function(){return this.Oc}},mouseUpTools:{configurable:!0,get:function(){return this.Bg}},hoverDelay:{configurable:!0,get:function(){return this.Ma},set:function(a){z(a,"number",$a,"hoverDelay");this.Ma=a}},holdDelay:{configurable:!0,get:function(){return this.ca},set:function(a){z(a,
"number",$a,"holdDelay");this.ca=a}},dragSize:{configurable:!0,get:function(){return this.w},set:function(a){w(a,Zb,$a,"dragSize");this.w=a.J()}},toolTipDuration:{configurable:!0,get:function(){return this.Xb},set:function(a){z(a,"number",$a,"toolTipDuration");this.Xb=a}}});var Bf=new D($a,"WheelScroll",0),Af=new D($a,"WheelZoom",1),Jf=new D($a,"WheelNone",2),Df=new D($a,"GestureZoom",3),Ef=new D($a,"GestureCancel",4),Ff=new D($a,"GestureNone",5);$a.className="ToolManager";
$a.WheelScroll=Bf;$a.WheelZoom=Af;$a.WheelNone=Jf;$a.GestureZoom=Df;$a.GestureCancel=Ef;$a.GestureNone=Ff;function Kf(){vf.call(this);0<arguments.length&&Da(Kf);this.name="Dragging";this.L=this.Nc=!0;this.w=this.Na=this.ca=this.fg=null;this.Cn=this.Oc=!1;this.Ml=new J(NaN,NaN);this.Ds=new J;this.Xb=!0;this.Vk=100;this.Mg=[];this.Bg=(new H).freeze();this.Ma=new Lf}ma(Kf,vf);
Kf.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.Vk)?!1:null!==this.findDraggablePart()};
Kf.prototype.findDraggablePart=function(){var a=this.diagram;a=a.em(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};
Kf.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.em(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.ba("ChangingSelection",a.selection),b=a.lastInput,(kb?b.meta:b.control)||b.shift||Mf(a),this.currentPart.isSelected=!0,a.ba("ChangedSelection",a.selection))}}};
Kf.prototype.doActivate=function(){var a=this.diagram;null===this.currentPart&&this.standardMouseSelect();var b=this.currentPart;null!==b&&(b.canMove()||b.canCopy())&&(Nf=null,this.isActive=!0,this.Ml.set(a.position),Of(this,a.selection),this.Mg.length=0,this.draggedParts=this.computeEffectiveCollection(a.selection,this.dragOptions),a.vk=!0,!0===a.He("temporaryPixelRatio")&&30<a.ax&&Yf(a),Zf(a,this.draggedParts),this.Ca("Drag"),this.startPoint=a.firstInput.documentPoint,a.isMouseCaptured=!0,a.allowDragOut&&
(this.isDragOutStarted=!0,this.Cn=!1,Nf=this,$f=this.diagram,this.doSimulatedDragOut()))};function Of(a,b){if(a.dragsLink){var c=a.diagram;c.allowRelink&&(c.model.hk()&&1===b.count&&b.first()instanceof T?(a.draggedLink=b.first(),a.draggedLink.canRelinkFrom()&&a.draggedLink.canRelinkTo()&&a.draggedLink.Wj(),a.fg=c.toolManager.findTool("Relinking"),null===a.fg&&(a.fg=new ag,a.fg.ib(c))):(a.draggedLink=null,a.fg=null))}}
Kf.prototype.computeEffectiveCollection=function(a,b){return this.diagram.commandHandler.computeEffectiveCollection(a,b)};Kf.prototype.rd=function(a){return void 0===a?new bg(gc):this.isGridSnapEnabled?new bg(new J(Math.round(a.x),Math.round(a.y))):new bg(a.copy())};
Kf.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.zf();cg(this);dg(a,this.draggedParts);this.draggedParts=this.currentPart=null;this.Cn=this.isDragOutStarted=!1;if(0<eg.count){for(var b=eg,c=b.length,d=0;d<c;d++){var e=b.O(d);fg(e);gg(e);cg(e);e.diagram.zf()}b.clear()}fg(this);this.Ml.h(NaN,NaN);Nf=$f=null;gg(this);a.isMouseCaptured=!1;a.currentCursor="";a.vk=!1;this.Ag();hg(a,!0)};
function cg(a){var b=a.diagram,c=b.skipsUndoManager;b.skipsUndoManager=!0;ig(a,b.lastInput,null);b.skipsUndoManager=c;a.Mg.length=0}function jg(){var a=Nf;gg(a);kg(a);var b=a.diagram;a.Ml.o()&&(b.position=a.Ml);b.zf()}Kf.prototype.doCancel=function(){gg(this);kg(this);var a=this.diagram;this.Ml.o()&&(a.position=this.Ml);this.stopTool()};Kf.prototype.doKeyDown=function(){this.isActive&&("Esc"===this.diagram.lastInput.key?this.doCancel():this.doMouseMove())};
Kf.prototype.doKeyUp=function(){this.isActive&&this.doMouseMove()};function lg(a,b){var c=Infinity,d=Infinity,e=-Infinity,f=-Infinity;for(a=a.iterator;a.next();){var g=a.value;if(g.dc()&&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 mg(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.yf(),c.Ca("Drag")):kg(a);c.skipsUndoManager=!b;c.partManager.addsToTemporaryLayer=!b;a.startPoint=c.firstInput.documentPoint;b=a.copiesEffectiveCollection?a.draggedParts.$d():c.selection;c=c.ak(b,c,!0);for(b=c.iterator;b.next();)b.value.location=
b.key.location;b=L.alloc();lg(c,b);L.free(b);b=new Ub;for(d=a.draggedParts.iterator;d.next();){var e=d.key;e.dc()&&e.canCopy()&&(e=c.K(e),null!==e&&(e.bc(),b.add(e,a.rd(e.location))))}for(c=c.iterator;c.next();)d=c.value,d instanceof T&&d.canCopy()&&b.add(d,a.rd());a.copiedParts=b;Of(a,b.$d());null!==a.draggedLink&&(c=a.draggedLink,b=c.routeBounds,ng(c,a.startPoint.x-(b.x+b.width/2),a.startPoint.y-(b.y+b.height/2)))}}}
function gg(a){var b=a.diagram;if(null!==a.copiedParts&&(b.wt(a.copiedParts.$d(),!1),a.copiedParts=null,null!==a.draggedParts))for(var c=a.draggedParts.iterator;c.next();)c.key instanceof T&&(c.value.point=new J(0,0));b.skipsUndoManager=!1;b.partManager.addsToTemporaryLayer=!1;a.startPoint=b.firstInput.documentPoint}
function fg(a){if(null!==a.draggedLink){if(a.dragsLink&&null!==a.fg){var b=a.fg;b.diagram.remove(b.temporaryFromNode);b.diagram.remove(b.temporaryToNode)}a.draggedLink=null;a.fg=null}}function og(a,b,c){var d=a.diagram,e=a.startPoint,f=J.alloc();f.assign(d.lastInput.documentPoint);a.moveParts(b,f.Zd(e),c);J.free(f);!0===d.He("temporaryPixelRatio")&&null===d.kh&&30<d.ax&&(Yf(d),d.tt())}Kf.prototype.moveParts=function(a,b,c){var d=this.diagram;null!==d&&pg(d,a,b,this.dragOptions,c)};
function kg(a){if(null!==a.draggedParts){for(var b=a.diagram,c=a.draggedParts.iterator;c.next();){var d=c.key;d.dc()&&(d.location=c.value.point)}for(c=a.draggedParts.iterator;c.next();)if(d=c.key,d instanceof T&&d.suspendsRouting){var e=c.value.point;a.draggedParts.add(d,a.rd());ng(d,-e.x,-e.y)}b.hd()}}function qg(a,b){if(null===b)return!0;b=b.part;return null===b||b instanceof Cf||b.layer.isTemporary||a.draggedParts&&a.draggedParts.contains(b)||a.copiedParts&&a.copiedParts.contains(b)?!0:!1}
function tg(a,b){var c=a.diagram;a.dragsLink&&(null!==a.draggedLink&&(a.draggedLink.fromNode=null,a.draggedLink.toNode=null),ug(a,!1));var d=vg(c,b,null,function(b){return!qg(a,b)}),e=c.lastInput;e.targetObject=d;var f=c.skipsUndoManager,g=!1;try{c.skipsUndoManager=!0;g=ig(a,e,d);if(!a.isActive&&null===Nf)return;if(null===d||c.handlesDragDropForTopLevelParts){var h=c.mouseDragOver;null!==h&&(h(e),g=!0)}if(!a.isActive&&null===Nf)return;a.doDragOver(b,d);if(!a.isActive&&null===Nf)return}finally{c.skipsUndoManager=
f,g&&c.hd()}c.isReadOnly||!c.allowMove&&!c.allowCopy||!c.allowHorizontalScroll&&!c.allowVerticalScroll||c.Ts(e.viewPoint)}
function ig(a,b,c){var d=!1,e=a.Mg.length,f=0<e?a.Mg[0]:null;if(c===f)return!1;b.handled=!1;for(var g=0;g<e;g++){var h=a.Mg[g],k=h.mouseDragLeave;if(null!==k&&(k(b,h,c),d=!0,b.handled))break}a.Mg.length=0;if(!a.isActive&&null===Nf||null===c)return d;b.handled=!1;for(e=c;null!==e;)a.Mg.push(e),e=wg(e);e=a.Mg.length;for(c=0;c<e&&(g=a.Mg[c],h=g.mouseDragEnter,null===h||(h(b,g,f),d=!0,!b.handled));c++);return d}
function wg(a){var b=a.panel;return null!==b?b:a instanceof U&&!(a instanceof xg)&&(a=a.containingGroup,null!==a&&a.handlesDragDropForMembers)?a:null}function yg(a,b,c){var d=a.fg;if(null===d)return null;var e=a.diagram.sg(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.oa(qd,a);k=b.Fe(k);k<f&&(g=h,f=k)}}J.free(a);return g}
function ug(a,b){var c=a.draggedLink;if(null!==c&&!(2>c.pointsCount)){var d=a.diagram;if(!d.isReadOnly){var e=a.fg;if(null!==e){var f=null,g=null;null===c.fromNode&&(f=yg(a,c.i(0),!1),null!==f&&(g=f.part));var h=null,k=null;null===c.toNode&&(h=yg(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.Bx&&d.ba("LinkRelinked",c,d.Bx),c.toPort!==d.Cx&&d.ba("LinkRelinked",c,d.Cx)):zg(e,g,f,k,h):zg(e,null,null,null,null)}}}}Kf.prototype.doDragOver=function(){};
function Ag(a,b){var c=a.diagram;a.dragsLink&&ug(a,!0);cg(a);var d=vg(c,b,null,function(b){return!qg(a,b)}),e=c.lastInput;e.targetObject=d;if(null!==d){e.handled=!1;for(var f=d;null!==f;){var g=f.mouseDrop;if(null!==g&&(g(e,f),e.handled))break;Bg(a,e,f);f=wg(f)}}else f=c.mouseDrop,null!==f&&f(e);if(a.isActive||null!==Nf){for(e=(a.copiedParts||a.draggedParts).iterator;e.next();)f=e.key,f instanceof V&&f.linksConnected.each(function(a){a.suspendsRouting=!1});a.doDropOnto(b,d);if(a.isActive||null!==
Nf){b=L.alloc();for(d=c.selection.iterator;d.next();)e=d.value,e instanceof V&&Cg(a,c,e,b);L.free(b)}}}function Bg(a,b,c){a=a.diagram;c instanceof U&&null===c.containingGroup&&!(c instanceof xg)&&a.handlesDragDropForTopLevelParts&&(c=a.mouseDrop,null!==c&&c(b))}
function Cg(a,b,c,d){var e=!1;c.getAvoidableRect(d);b.viewportBounds.qf(d)&&(e=!0);b=b.links;for(a=a.copiedParts||a.draggedParts;b.next();){var f=b.value;if(!e||Dg(f))a.contains(f)&&a.contains(c)||!f.Xd(c)&&f.isAvoiding&&Lc(f.actualBounds,d,0)&&f.Ta()}}Kf.prototype.doDropOnto=function(){};
Kf.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram,b=a.lastInput;this.simulatedMouseMove(b.event,null,b.targetDiagram||null)||null===this.currentPart||null===this.draggedParts||(this.mayCopy()?(a.currentCursor="copy",mg(this,!1),Zf(a,this.copiedParts),og(this,this.copiedParts,!1),dg(a,this.copiedParts)):this.mayMove()?(a.currentCursor="",gg(this),og(this,this.draggedParts,!0)):this.mayDragOut()?(a.currentCursor="no-drop",mg(this,!1),og(this,this.copiedParts,!1)):gg(this),tg(this,
a.lastInput.documentPoint))}};
Kf.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram,b=a.lastInput;if(!this.simulatedMouseUp(b.event,null,b.documentPoint,b.targetDiagram)){var c=!1;(b=this.mayCopy())&&null!==this.copiedParts?(gg(this),mg(this,!0),Zf(a,this.copiedParts),og(this,this.copiedParts,!1),dg(a,this.copiedParts),null!==this.copiedParts&&a.Ov(this.copiedParts.$d())):(c=!0,gg(this),this.mayMove()&&(og(this,this.draggedParts,!0),tg(this,a.lastInput.documentPoint)));this.Cn=!0;Ag(this,a.lastInput.documentPoint);
if(this.isActive){var d=b?this.copiedParts.$d():this.draggedParts.$d();this.copiedParts=null;if(c&&null!==this.draggedParts)for(c=this.draggedParts.iterator;c.next();){var e=c.key;e instanceof V&&(e=e.containingGroup,null===e||null===e.placeholder||this.draggedParts.contains(e)||e.placeholder.v())}a.Ya();dg(a,this.draggedParts);this.transactionResult=b?"Copy":"Move";a.ba(b?"SelectionCopied":"SelectionMoved",d)}this.stopTool()}}};
Kf.prototype.simulatedMouseMove=function(a,b,c){if(null===Nf)return!1;var d=Nf.diagram;c instanceof P||(c=null);var e=$f;c!==e&&(null!==e&&e!==d&&(e.zf(),Nf.isDragOutStarted=!1,e=e.toolManager.findTool("Dragging"),null!==e&&e.doSimulatedDragLeave()),$f=c,null!==c&&c!==d&&(jg(),e=c.toolManager.findTool("Dragging"),null!==e&&(eg.contains(e)||eg.add(e),e.doSimulatedDragEnter())));if(null===c||c===d||!c.allowDrop||c.isReadOnly||!c.allowInsert)return!1;d=c.toolManager.findTool("Dragging");null!==d&&(null!==
a?(void 0!==a.targetTouches&&(0<a.targetTouches.length?a=a.targetTouches[0]:0<a.changedTouches.length&&(a=a.changedTouches[0])),b=c.getMouse(a)):null===b&&(b=new J),c.lastInput.documentPoint=b,c.lastInput.viewPoint=c.Ct(b),c.lastInput.down=!1,c.lastInput.up=!1,d.doSimulatedDragOver());return!0};
Kf.prototype.simulatedMouseUp=function(a,b,c,d){if(null===Nf)return!1;null===d&&(d=b);b=$f;var e=Nf.diagram;if(null===d)return Nf.doCancel(),!0;if(d!==b){var f=b.toolManager.findTool("Dragging");if(null!==b&&b!==e&&null!==f)return b.zf(),Nf.isDragOutStarted=!1,f.doSimulatedDragLeave(),!1;$f=d;b=d.toolManager.findTool("Dragging");null!==d&&null!==b&&(jg(),eg.contains(b)||eg.add(b),b.doSimulatedDragEnter())}return d!==this.diagram?(null!==a?(void 0!==a.targetTouches&&(0<a.targetTouches.length?a=a.targetTouches[0]:
0<a.changedTouches.length&&(a=a.changedTouches[0])),c=d.getMouse(a)):null===c&&(c=new J),d.lastInput.documentPoint=c,d.lastInput.viewPoint=d.Ct(c),d.lastInput.down=!1,d.lastInput.up=!0,a=d.toolManager.findTool("Dragging"),null!==a&&a.doSimulatedDrop(),a=Nf,null!==a&&(d=a.mayCopy(),a.transactionResult=d?"Copy":"Move",a.stopTool()),!0):!1};
Kf.prototype.mayCopy=function(){if(!this.isCopyEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowCopy||(kb?!a.lastInput.alt:!a.lastInput.control))return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.dc()&&b.canCopy())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1};
Kf.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.dc()&&b.canCopy())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1};
Kf.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.dc()&&b.canMove())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canMove()?!0:!1};Kf.prototype.computeBorder=function(a,b,c){return this.Cn||null===this.draggedParts||this.draggedParts.contains(a)?null:c.assign(b)};Kf.prototype.kz=function(){return Nf};
Kf.prototype.mayDragIn=function(){var a=this.diagram;if(!a.allowDrop||a.isReadOnly||a.isModelReadOnly||!a.allowInsert)return!1;var b=Nf;return null===b||b.diagram.model.dataFormat!==a.model.dataFormat?!1:!0};Kf.prototype.doSimulatedDragEnter=function(){if(this.mayDragIn()){var a=this.diagram;a.animationManager.xd();Eg(a);a.animationManager.xd();a=Nf;null!==a&&(a.diagram.currentCursor="copy",a.diagram.vk=!1)}};Kf.prototype.doSimulatedDragLeave=function(){var a=Nf;null!==a&&a.doSimulatedDragOut();this.doCancel()};
Kf.prototype.doSimulatedDragOver=function(){var a=this.diagram,b=Nf;null!==b&&null!==b.draggedParts&&this.mayDragIn()&&(a.currentCursor="copy",Fg(this,b.draggedParts.$d(),!1,a.firstInput),og(this,this.copiedParts,!1),tg(this,a.lastInput.documentPoint))};
Kf.prototype.doSimulatedDrop=function(){var a=this.diagram,b=Nf;if(null!==b){var c=b.diagram;b.Cn=!0;gg(this);this.mayDragIn()&&(this.Ca("Drop"),Fg(this,b.draggedParts.$d(),!0,a.lastInput),og(this,this.copiedParts,!1),null!==this.copiedParts&&a.Ov(this.copiedParts.$d()),Ag(this,a.lastInput.documentPoint),a.Ya(),b=a.selection,null!==this.copiedParts?this.transactionResult="ExternalCopy":b=new H,this.copiedParts=null,a.doFocus(),a.ba("ExternalObjectsDropped",b,c),this.Ag())}};
function Fg(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.ak(b,e,!0);var f=L.alloc();lg(b,f);d=f.x+f.width/2;e=f.y+f.height/2;L.free(f);f=a.Ds;var g=new Ub,h=J.alloc();for(b=b.iterator;b.next();){var k=b.value,l=c.K(k);k.dc()&&k.canCopy()?(k=k.location,h.h(f.x-(d-k.x),f.y-(e-k.y)),l.location=h,l.bc(),g.add(l,a.rd(h))):l instanceof T&&k.canCopy()&&(ng(l,f.x-d,f.y-e),
g.add(l,a.rd()))}J.free(h);a.copiedParts=g;Of(a,g.$d());null!==a.draggedLink&&(c=a.draggedLink,d=c.routeBounds,ng(c,a.startPoint.x-(d.x+d.width/2),a.startPoint.y-(d.y+d.height/2)))}}}Kf.prototype.doSimulatedDragOut=function(){var a=this.diagram;a.vk=!1;this.mayCopy()||this.mayMove()?a.currentCursor="":a.currentCursor="no-drop"};Kf.prototype.computeMove=function(a,b,c,d){c=this.diagram;return null!==c?c.computeMove(a,b,this.dragOptions,d):new J};
na.Object.defineProperties(Kf.prototype,{isCopyEnabled:{configurable:!0,get:function(){return this.Nc},set:function(a){z(a,"boolean",Kf,"isCopyEnabled");this.Nc=a}},copiesEffectiveCollection:{configurable:!0,get:function(){return this.L},set:function(a){z(a,"boolean",Kf,"copiesEffectiveCollection");this.L=a}},dragOptions:{configurable:!0,get:function(){return this.Ma},set:function(a){w(a,Lf,Kf,"dragOptions");this.Ma=a}},isGridSnapEnabled:{configurable:!0,
enumerable:!0,get:function(){return this.dragOptions.isGridSnapEnabled},set:function(a){z(a,"boolean",Kf,"isGridSnapEnabled");this.dragOptions.isGridSnapEnabled=a}},isComplexRoutingRealtime:{configurable:!0,get:function(){return this.Xb},set:function(a){z(a,"boolean",Kf,"isComplexRoutingRealtime");this.Xb=a}},isGridSnapRealtime:{configurable:!0,get:function(){return this.dragOptions.isGridSnapRealtime},set:function(a){z(a,"boolean",Kf,"isGridSnapRealtime");this.dragOptions.isGridSnapRealtime=
a}},gridSnapCellSize:{configurable:!0,get:function(){return this.dragOptions.gridSnapCellSize},set:function(a){w(a,Zb,Kf,"gridSnapCellSize");null===this.diagram||this.dragOptions.gridSnapCellSize.A(a)||(a=a.J(),this.dragOptions.gridSnapCellSize=a)}},gridSnapCellSpot:{configurable:!0,get:function(){return this.dragOptions.gridSnapCellSpot},set:function(a){w(a,M,Kf,"gridSnapCellSpot");this.dragOptions.gridSnapCellSpot.A(a)||(a=a.J(),this.dragOptions.gridSnapCellSpot=a)}},
gridSnapOrigin:{configurable:!0,get:function(){return this.dragOptions.gridSnapOrigin},set:function(a){w(a,J,Kf,"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){z(a,"boolean",Kf,"dragsLink");this.dragOptions.dragsLink=a}},dragsTree:{configurable:!0,get:function(){return this.dragOptions.dragsTree},set:function(a){z(a,
"boolean",Kf,"dragsTree");this.dragOptions.dragsTree=a}},currentPart:{configurable:!0,get:function(){return this.ca},set:function(a){null!==a&&w(a,U,Kf,"currentPart");this.ca=a}},copiedParts:{configurable:!0,get:function(){return this.w},set:function(a){this.w=a}},draggedParts:{configurable:!0,get:function(){return this.Na},set:function(a){this.Na=a}},draggingParts:{configurable:!0,get:function(){return null!==this.copiedParts?this.copiedParts.$d():
null!==this.draggedParts?this.draggedParts.$d():this.Bg}},draggedLink:{configurable:!0,get:function(){return this.diagram.draggedLink},set:function(a){null!==a&&w(a,T,Kf,"draggedLink");this.diagram.draggedLink=a}},isDragOutStarted:{configurable:!0,get:function(){return this.Oc},set:function(a){this.Oc=a}},startPoint:{configurable:!0,get:function(){return this.Ds},set:function(a){w(a,J,Kf,"startPoint");this.Ds.A(a)||this.Ds.assign(a)}},delay:{configurable:!0,
enumerable:!0,get:function(){return this.Vk},set:function(a){z(a,"number",Kf,"delay");this.Vk=a}}});Kf.prototype.getDraggingSource=Kf.prototype.kz;var eg=null,Nf=null,$f=null;Kf.className="DraggingTool";eg=new F;Za("draggingTool",function(){return this.findTool("Dragging")},function(a){If(this,"Dragging",a,this.mouseMoveTools)});$a.prototype.doCancel=function(){null!==Nf&&Nf.doCancel();vf.prototype.doCancel.call(this)};
function Gg(){0<arguments.length&&Da(Gg);vf.call(this);this.Bg=100;this.ca=!1;var a=new T,b=new Hg;b.isPanelMain=!0;b.stroke="blue";a.add(b);b=new Hg;b.toArrow="Standard";b.fill="blue";b.stroke="blue";a.add(b);a.layerName="Tool";this.Lm=a;a=new V;b=new Hg;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke="magenta";b.strokeWidth=2;b.desiredSize=sc;a.add(b);a.selectable=!1;a.layerName="Tool";this.Jm=a;this.Km=b;a=new V;b=new Hg;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke="magenta";b.strokeWidth=
2;b.desiredSize=sc;a.add(b);a.selectable=!1;a.layerName="Tool";this.Gq=a;this.Hq=b;this.Oc=this.Nc=this.Na=this.Ma=this.Xb=null;this.L=!0;this.Xx=new Ub;this.Hm=this.li=this.Im=null}ma(Gg,vf);Gg.prototype.doStop=function(){this.diagram.zf();this.originalToPort=this.originalToNode=this.originalFromPort=this.originalFromNode=this.originalLink=null;this.validPortsCache.clear();this.targetPort=null};
Gg.prototype.copyPortProperties=function(a,b,c,d,e){if(null!==a&&null!==b&&null!==c&&null!==d){var f=b.Ge(),g=Zb.alloc();g.width=b.naturalBounds.width*f;g.height=b.naturalBounds.height*f;d.desiredSize=g;Zb.free(g);e?(d.toSpot=b.toSpot,d.toEndSegmentLength=b.toEndSegmentLength):(d.fromSpot=b.fromSpot,d.fromEndSegmentLength=b.fromEndSegmentLength);c.locationSpot=qd;f=J.alloc();c.location=b.oa(qd,f);J.free(f);d.angle=b.Oi();null!==this.portTargeted&&this.portTargeted(a,b,c,d,e)}};
Gg.prototype.setNoTargetPortProperties=function(a,b,c){null!==b&&(b.desiredSize=sc,b.fromSpot=ed,b.toSpot=ed);null!==a&&(a.location=this.diagram.lastInput.documentPoint);null!==this.portTargeted&&this.portTargeted(null,null,a,b,c)};Gg.prototype.doMouseDown=function(){this.isActive&&this.doMouseMove()};
Gg.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram;this.targetPort=this.findTargetPort(this.isForwards);if(null!==this.targetPort&&this.targetPort.part instanceof V){var b=this.targetPort.part;this.isForwards?this.copyPortProperties(b,this.targetPort,this.temporaryToNode,this.temporaryToPort,!0):this.copyPortProperties(b,this.targetPort,this.temporaryFromNode,this.temporaryFromPort,!1)}else this.isForwards?this.setNoTargetPortProperties(this.temporaryToNode,this.temporaryToPort,
!0):this.setNoTargetPortProperties(this.temporaryFromNode,this.temporaryFromPort,!1);(a.allowHorizontalScroll||a.allowVerticalScroll)&&a.Ts(a.lastInput.viewPoint)}};Gg.prototype.findValidLinkablePort=function(a,b){if(null===a)return null;var c=a.part;if(!(c instanceof V))return null;for(;null!==a;){var d=b?a.toLinkable:a.fromLinkable;if(!0===d&&(null!==a.portId||a instanceof V)&&(b?this.isValidTo(c,a):this.isValidFrom(c,a)))return a;if(!1===d)break;a=a.panel}return null};
Gg.prototype.findTargetPort=function(a){var b=this.diagram,c=b.lastInput.documentPoint,d=this.portGravity;0>=d&&(d=.1);var e=this,f=b.sg(c,d,function(b){return e.findValidLinkablePort(b,a)},null,!0);d=Infinity;b=null;for(f=f.iterator;f.next();){var g=f.value,h=g.part;if(h instanceof V){var k=g.oa(qd,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 V&&(null===c.layer||c.layer.allowLink))?b:null};
Gg.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.aq(b).count>=c)return!1}return!0};
Gg.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.ud(b).count>=c)return!1}return!0};
Gg.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};Gg.prototype.isLinked=function(a,b){if(null===a||null===b)return!1;var c=a.part;if(!(c instanceof V))return!1;a=a.portId;null===a&&(a="");var d=b.part;if(!(d instanceof V))return!1;b=b.portId;null===b&&(b="");for(b=d.ud(b);b.next();)if(d=b.value,d.fromNode===c&&d.fromPortId===a)return!0;return!1};
Gg.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};Gg.prototype.isLabelDependentOnLink=function(a,b){if(null===a)return!1;var c=a.labeledLink;if(null===c)return!1;if(c===b)return!0;var d=new H;d.add(a);return Ig(this,c,b,d)};
function Ig(a,b,c,d){if(b===c)return!0;var e=b.fromNode;if(null!==e&&e.isLinkLabel&&(d.add(e),Ig(a,e.labeledLink,c,d)))return!0;b=b.toNode;return null!==b&&b.isLinkLabel&&(d.add(b),Ig(a,b.labeledLink,c,d))?!0:!1}
Gg.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!==Jg){if(d===Kg){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!Lg(this,a,b,c,!0)}if(d===Mg){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!Lg(this,a,b,c,!0)}if(d===Ng)return a===b?a=!0:(d=new H,d.add(b),a=Og(this,d,a,b,c)),!a;if(d===Pg)return!Lg(this,a,b,c,!1);if(d===Qg)return a===b?a=!0:(d=new H,d.add(b),a=Rg(this,d,a,b,c)),!a}return!0};function Lg(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&&Lg(a,g,c,d,e)))return!0}return!1}
function Og(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&&Og(a,b,g,d,e)))return!0}return!1}function Rg(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&&Rg(a,b,h,d,e))return!0}}return!1}
na.Object.defineProperties(Gg.prototype,{portGravity:{configurable:!0,get:function(){return this.Bg},set:function(a){z(a,"number",Gg,"portGravity");0<=a&&(this.Bg=a)}},isUnconnectedLinkValid:{configurable:!0,get:function(){return this.ca},set:function(a){z(a,"boolean",Gg,"isUnconnectedLinkValid");this.ca=a}},temporaryLink:{configurable:!0,get:function(){return this.Lm},set:function(a){w(a,T,Gg,"temporaryLink");this.Lm=a}},temporaryFromNode:{configurable:!0,
enumerable:!0,get:function(){return this.Jm},set:function(a){w(a,V,Gg,"temporaryFromNode");this.Jm=a}},temporaryFromPort:{configurable:!0,get:function(){return this.Km},set:function(a){w(a,N,Gg,"temporaryFromPort");this.Km=a}},temporaryToNode:{configurable:!0,get:function(){return this.Gq},set:function(a){w(a,V,Gg,"temporaryToNode");this.Gq=a}},temporaryToPort:{configurable:!0,get:function(){return this.Hq},set:function(a){w(a,N,Gg,"temporaryToPort");this.Hq=
a}},originalLink:{configurable:!0,get:function(){return this.Xb},set:function(a){null!==a&&w(a,T,Gg,"originalLink");this.Xb=a}},originalFromNode:{configurable:!0,get:function(){return this.Ma},set:function(a){null!==a&&w(a,V,Gg,"originalFromNode");this.Ma=a}},originalFromPort:{configurable:!0,get:function(){return this.Na},set:function(a){null!==a&&w(a,N,Gg,"originalFromPort");this.Na=a}},originalToNode:{configurable:!0,get:function(){return this.Nc},
set:function(a){null!==a&&w(a,V,Gg,"originalToNode");this.Nc=a}},originalToPort:{configurable:!0,get:function(){return this.Oc},set:function(a){null!==a&&w(a,N,Gg,"originalToPort");this.Oc=a}},isForwards:{configurable:!0,get:function(){return this.L},set:function(a){z(a,"boolean",Gg,"isForwards");this.L=a}},validPortsCache:{configurable:!0,get:function(){return this.Xx}},targetPort:{configurable:!0,get:function(){return this.Im},set:function(a){null!==
a&&w(a,N,Gg,"targetPort");this.Im=a}},linkValidation:{configurable:!0,get:function(){return this.li},set:function(a){null!==a&&z(a,"function",Gg,"linkValidation");this.li=a}},portTargeted:{configurable:!0,get:function(){return this.Hm},set:function(a){null!==a&&z(a,"function",Gg,"portTargeted");this.Hm=a}}});Gg.className="LinkingBaseTool";function Sg(){0<arguments.length&&Da(Sg);Gg.call(this);this.name="Linking";this.w={};this.l=null;this.M=Tg;this.Fh=null}ma(Sg,Gg);
Sg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowLink||!a.model.jt()||!a.lastInput.left||a.currentTool!==this&&!this.isBeyondDragSize()?!1:null!==this.findLinkablePort()};
Sg.prototype.findLinkablePort=function(){var a=this.diagram,b=this.startObject;null===b&&(b=a.Tb(a.firstInput.documentPoint,null,null));if(null===b||!(b.part instanceof V))return null;a=this.direction;if(a===Tg||a===Ug){var c=this.findValidLinkablePort(b,!1);if(null!==c)return this.isForwards=!0,c}if(a===Tg||a===$g)if(b=this.findValidLinkablePort(b,!0),null!==b)return this.isForwards=!1,b;return null};
Sg.prototype.doActivate=function(){var a=this.diagram,b=this.findLinkablePort();null!==b&&(this.Ca(this.name),a.isMouseCaptured=!0,a.currentCursor="pointer",this.isForwards?(null===this.temporaryToNode||this.temporaryToNode.location.o()||(this.temporaryToNode.location=a.lastInput.documentPoint),this.originalFromPort=b,b=this.originalFromPort.part,b instanceof V&&(this.originalFromNode=b),this.copyPortProperties(this.originalFromNode,this.originalFromPort,this.temporaryFromNode,this.temporaryFromPort,
!1)):(null===this.temporaryFromNode||this.temporaryFromNode.location.o()||(this.temporaryFromNode.location=a.lastInput.documentPoint),this.originalToPort=b,b=this.originalToPort.part,b instanceof V&&(this.originalToNode=b),this.copyPortProperties(this.originalToNode,this.originalToPort,this.temporaryToNode,this.temporaryToPort,!0)),a.add(this.temporaryFromNode),a.add(this.temporaryToNode),null!==this.temporaryLink&&(null!==this.temporaryFromNode&&(this.temporaryLink.fromNode=this.temporaryFromNode),
null!==this.temporaryToNode&&(this.temporaryLink.toNode=this.temporaryToNode),this.temporaryLink.isTreeLink=this.isNewTreeLink(),this.temporaryLink.Ta(),a.add(this.temporaryLink)),this.isActive=!0)};Sg.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.Ag()};Sg.prototype.doStop=function(){Gg.prototype.doStop.call(this);this.startObject=null};
Sg.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram,b=this.transactionResult=null,c=null,d=null,e=null,f=this.targetPort=this.findTargetPort(this.isForwards);if(null!==f){var g=f.part;g instanceof V&&(this.isForwards?(null!==this.originalFromNode&&(b=this.originalFromNode,c=this.originalFromPort),d=g,e=f):(b=g,c=f,null!==this.originalToNode&&(d=this.originalToNode,e=this.originalToPort)))}else this.isForwards?null!==this.originalFromNode&&this.isUnconnectedLinkValid&&(b=this.originalFromNode,
c=this.originalFromPort):null!==this.originalToNode&&this.isUnconnectedLinkValid&&(d=this.originalToNode,e=this.originalToPort);null!==b||null!==d?(g=this.insertLink(b,c,d,e),null!==g?(null===f&&(this.isForwards?g.defaultToPoint=a.lastInput.documentPoint:g.defaultFromPoint=a.lastInput.documentPoint),a.allowSelect&&a.select(g),this.transactionResult=this.name,a.ba("LinkDrawn",g)):(a.model.Su(),this.doNoLink(b,c,d,e))):this.isForwards?this.doNoLink(this.originalFromNode,this.originalFromPort,null,null):
this.doNoLink(null,null,this.originalToNode,this.originalToPort)}this.stopTool()};Sg.prototype.isNewTreeLink=function(){var a=this.archetypeLinkData;if(null===a)return!0;if(a instanceof T)return a.isTreeLink;var b=this.diagram;if(null===b)return!0;a=b.partManager.getLinkCategoryForData(a);b=b.partManager.findLinkTemplateForCategory(a);return null!==b?b.isTreeLink:!0};Sg.prototype.insertLink=function(a,b,c,d){return this.diagram.partManager.insertLink(a,b,c,d)};Sg.prototype.doNoLink=function(){};
na.Object.defineProperties(Sg.prototype,{archetypeLinkData:{configurable:!0,get:function(){return this.w},set:function(a){null!==a&&z(a,"object",Sg,"archetypeLinkData");a instanceof N&&w(a,T,Sg,"archetypeLinkData");this.w=a}},archetypeLabelNodeData:{configurable:!0,get:function(){return this.l},set:function(a){null!==a&&z(a,"object",Sg,"archetypeLabelNodeData");a instanceof N&&w(a,V,Sg,"archetypeLabelNodeData");this.l=a}},direction:{configurable:!0,get:function(){return this.M},
set:function(a){tb(a,Sg,Sg,"direction");this.M=a}},startObject:{configurable:!0,get:function(){return this.Fh},set:function(a){null!==a&&w(a,N,Sg,"startObject");this.Fh=a}}});var Tg=new D(Sg,"Either",0),Ug=new D(Sg,"ForwardsOnly",0),$g=new D(Sg,"BackwardsOnly",0);Sg.className="LinkingTool";Sg.Either=Tg;Sg.ForwardsOnly=Ug;Sg.BackwardsOnly=$g;
function ag(){0<arguments.length&&Da(ag);Gg.call(this);this.name="Relinking";var a=new Hg;a.figure="Diamond";a.desiredSize=uc;a.fill="lightblue";a.stroke="dodgerblue";a.cursor="pointer";a.segmentIndex=0;this.w=a;a=new Hg;a.figure="Diamond";a.desiredSize=uc;a.fill="lightblue";a.stroke="dodgerblue";a.cursor="pointer";a.segmentIndex=-1;this.Fh=a;this.l=null;this.Nw=new L}ma(ag,Gg);
ag.prototype.updateAdornments=function(a){if(null!==a&&a instanceof T){var b="RelinkFrom",c=null;if(a.isSelected&&!this.diagram.isReadOnly){var d=a.selectionObject;null!==d&&a.canRelinkFrom()&&a.actualBounds.o()&&a.isVisible()&&d.actualBounds.o()&&d.vf()&&(c=a.dk(b),null===c&&(c=this.makeAdornment(d,!1),a.rh(b,c)))}null===c&&a.xf(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.vf()&&
(c=a.dk(b),null===c?(c=this.makeAdornment(d,!0),a.rh(b,c)):c.v()));null===c&&a.xf(b)}};ag.prototype.makeAdornment=function(a,b){var c=new Cf;c.type=W.Link;b=b?this.toHandleArchetype:this.fromHandleArchetype;null!==b&&c.add(b.copy());c.adornedObject=a;return c};
ag.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowRelink||!a.model.jt()||!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};
ag.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 Cf&&c.adornedPart instanceof T))return;this.handle=b;this.isForwards=null===c||"RelinkTo"===c.category;this.originalLink=c.adornedPart}this.Ca(this.name);a.isMouseCaptured=!0;a.currentCursor="pointer";
this.originalFromPort=this.originalLink.fromPort;this.originalFromNode=this.originalLink.fromNode;this.originalToPort=this.originalLink.toPort;this.originalToNode=this.originalLink.toNode;this.Nw.set(this.originalLink.actualBounds);null!==this.originalLink&&0<this.originalLink.pointsCount&&(null===this.originalLink.fromNode&&(null!==this.temporaryFromPort&&(this.temporaryFromPort.desiredSize=rc),null!==this.temporaryFromNode&&(this.temporaryFromNode.location=this.originalLink.i(0))),null===this.originalLink.toNode&&
(null!==this.temporaryToPort&&(this.temporaryToPort.desiredSize=rc),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.Ta(),a.add(this.temporaryLink));this.isActive=!0};
ag.prototype.copyLinkProperties=function(a,b){if(null!==a&&null!==b){b.adjusting=a.adjusting;b.corner=a.corner;var c=a.curve;if(c===ah||c===bh)c=ch;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}};
ag.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.Ag()};ag.prototype.doStop=function(){Gg.prototype.doStop.call(this);this.handle=null};
ag.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram;this.transactionResult=null;var b=this.originalFromNode,c=this.originalFromPort,d=this.originalToNode,e=this.originalToPort,f=this.originalLink;this.targetPort=this.findTargetPort(this.isForwards);if(null!==this.targetPort){var g=this.targetPort.part;g instanceof V&&(this.isForwards?(d=g,e=this.targetPort):(b=g,c=this.targetPort))}else this.isUnconnectedLinkValid?this.isForwards?e=d=null:c=b=null:f=null;null!==f?(this.reconnectLink(f,
this.isForwards?d:b,this.isForwards?e:c,this.isForwards),null===this.targetPort&&(this.isForwards?f.defaultToPoint=a.lastInput.documentPoint:f.defaultFromPoint=a.lastInput.documentPoint,f.Ta()),a.allowSelect&&(f.isSelected=!0),this.transactionResult=this.name,a.ba("LinkRelinked",f,this.isForwards?this.originalToPort:this.originalFromPort)):this.doNoRelink(this.originalLink,this.isForwards);this.originalLink.jq(this.Nw)}this.stopTool()};
ag.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};ag.prototype.doNoRelink=function(){};
function zg(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)}
na.Object.defineProperties(ag.prototype,{fromHandleArchetype:{configurable:!0,get:function(){return this.w},set:function(a){null!==a&&w(a,N,ag,"fromHandleArchetype");this.w=a}},toHandleArchetype:{configurable:!0,get:function(){return this.Fh},set:function(a){null!==a&&w(a,N,ag,"toHandleArchetype");this.Fh=a}},handle:{configurable:!0,get:function(){return this.l},set:function(a){if(null!==a&&(w(a,N,ag,"handle"),!(a.part instanceof Cf)))throw Error("new handle is not in an Adornment: "+
a);this.l=a}}});ag.className="RelinkingTool";Za("linkingTool",function(){return this.findTool("Linking")},function(a){If(this,"Linking",a,this.mouseMoveTools)});Za("relinkingTool",function(){return this.findTool("Relinking")},function(a){If(this,"Relinking",a,this.mouseDownTools)});
function dh(){0<arguments.length&&Da(dh);vf.call(this);this.name="LinkReshaping";var a=new Hg;a.figure="Rectangle";a.desiredSize=tc;a.fill="lightblue";a.stroke="dodgerblue";this.w=a;a=new Hg;a.figure="Diamond";a.desiredSize=uc;a.fill="lightblue";a.stroke="dodgerblue";a.cursor="move";this.L=a;this.ca=3;this.Mt=this.l=null;this.zl=new J;this.ls=new F}ma(dh,vf);dh.prototype.mv=function(a){return a&&a.qs&&0!==a.qs.value?a.qs:eh};
dh.prototype.Cm=function(a,b){w(a,N,dh,"setReshapingBehavior:obj");tb(b,dh,dh,"setReshapingBehavior:behavior");a.qs=b};
dh.prototype.updateAdornments=function(a){if(null!==a&&a instanceof T){var b=null;if(a.isSelected&&!this.diagram.isReadOnly){var c=a.path;null!==c&&a.canReshape()&&a.actualBounds.o()&&a.isVisible()&&c.actualBounds.o()&&c.vf()&&(b=a.dk(this.name),null===b||b.Kw!==a.pointsCount||b.Vw!==a.resegmentable)&&(b=this.makeAdornment(c),null!==b&&(b.Kw=a.pointsCount,b.Vw=a.resegmentable,a.rh(this.name,b)))}null===b&&a.xf(this.name)}};
dh.prototype.makeAdornment=function(a){var b=a.part,c=b.pointsCount,d=b.isOrthogonal,e=null;if(null!==b.points&&1<c){e=new Cf;e.type=W.Link;c=b.firstPickIndex;var f=b.lastPickIndex,g=d?1:0;if(b.resegmentable&&b.computeCurve()!==fh)for(var h=c+g;h<f-g;h++){var k=this.makeResegmentHandle(a,h);null!==k&&(k.segmentIndex=h,k.segmentFraction=.5,k.fromMaxLinks=999,e.add(k))}for(g=c+1;g<f;g++)if(h=this.makeHandle(a,g),null!==h){h.segmentIndex=g;if(g!==c)if(g===c+1&&d){k=b.i(c);var l=b.i(c+1);K.B(k.x,l.x)&&
K.B(k.y,l.y)&&(l=b.i(c-1));K.B(k.x,l.x)?(this.Cm(h,gh),h.cursor="n-resize"):K.B(k.y,l.y)&&(this.Cm(h,hh),h.cursor="w-resize")}else g===f-1&&d?(k=b.i(f-1),l=b.i(f),K.B(k.x,l.x)&&K.B(k.y,l.y)&&(k=b.i(f+1)),K.B(k.x,l.x)?(this.Cm(h,gh),h.cursor="n-resize"):K.B(k.y,l.y)&&(this.Cm(h,hh),h.cursor="w-resize")):g!==f&&(this.Cm(h,ih),h.cursor="move");e.add(h)}e.adornedObject=a}return e};dh.prototype.makeHandle=function(){var a=this.handleArchetype;return null===a?null:a.copy()};
dh.prototype.makeResegmentHandle=function(){var a=this.midHandleArchetype;return null===a?null:a.copy()};dh.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};
dh.prototype.doActivate=function(){var a=this.diagram;null===this.handle&&(this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name));if(null!==this.handle){var b=this.handle.part.adornedPart;if(b instanceof T){this.Mt=b;a.isMouseCaptured=!0;this.Ca(this.name);if(b.resegmentable&&999===this.handle.fromMaxLinks){var c=b.points.copy(),d=this.getResegmentingPoint();c.Lb(this.handle.segmentIndex+1,d);b.isOrthogonal&&c.Lb(this.handle.segmentIndex+1,d);b.points=c;b.Mb();b.updateAdornments();
this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name);if(null===this.handle){this.doDeactivate();return}}this.zl=b.i(this.handle.segmentIndex);this.ls=b.points.copy();this.isActive=!0}}};dh.prototype.doDeactivate=function(){this.Ag();this.Mt=this.handle=null;this.isActive=this.diagram.isMouseCaptured=!1};dh.prototype.doCancel=function(){var a=this.adornedLink;null!==a&&(a.points=this.ls);this.stopTool()};dh.prototype.getResegmentingPoint=function(){return this.handle.oa(qd)};
dh.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeReshape(a.lastInput.documentPoint),this.reshape(a))};
dh.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&&(jh(this,g,d,e,f,!0)||jh(this,g,d,e,f,!1))){var h=b.points.copy();jh(this,g,d,
e,f,!0)?(h.jd(c-2,new J(g.x,(f.y+g.y)/2)),h.jd(c+1,new J(f.x,(f.y+g.y)/2))):(h.jd(c-2,new J((f.x+g.x)/2,g.y)),h.jd(c+1,new J((f.x+g.x)/2,f.y)));h.nb(c);h.nb(c-1);b.points=h;b.Mb()}else g=b.i(c+2),Math.abs(e.x-f.x)<this.resegmentingDistance&&Math.abs(e.y-f.y)<this.resegmentingDistance&&(jh(this,d,e,f,g,!0)||jh(this,d,e,f,g,!1))&&(h=b.points.copy(),jh(this,d,e,f,g,!0)?(h.jd(c-1,new J(d.x,(d.y+g.y)/2)),h.jd(c+2,new J(g.x,(d.y+g.y)/2))):(h.jd(c-1,new J((d.x+g.x)/2,d.y)),h.jd(c+2,new J((d.x+g.x)/2,g.y))),
h.nb(c+1),h.nb(c),b.points=h,b.Mb())}}else g=J.alloc(),K.Wi(d.x,d.y,f.x,f.y,e.x,e.y,g)&&g.Fe(e)<this.resegmentingDistance*this.resegmentingDistance&&(d=b.points.copy(),d.nb(c),b.points=d,b.Mb()),J.free(g)}a.Ya();this.transactionResult=this.name;a.ba("LinkReshaped",this.adornedLink,this.ls)}this.stopTool()};
function jh(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}
dh.prototype.reshape=function(a){var b=this.adornedLink;b.Eh();var c=this.handle.segmentIndex,d=this.mv(this.handle);if(b.isOrthogonal)if(c===b.firstPickIndex+1)c=b.firstPickIndex+1,d===gh?(b.N(c,b.i(c-1).x,a.y),b.N(c+1,b.i(c+2).x,a.y)):d===hh&&(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===gh?(b.N(c-1,b.i(c-2).x,a.y),b.N(c,b.i(c+1).x,a.y)):d===hh&&(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.B(f.x,
e.x)&&K.B(e.y,g.y)?(K.B(f.x,b.i(d-2).x)&&!K.B(f.y,b.i(d-2).y)?(b.m(d,a.x,f.y),c++,d++):b.N(d-1,a.x,f.y),K.B(g.y,b.i(d+2).y)&&!K.B(g.x,b.i(d+2).x)?b.m(d+1,g.x,a.y):b.N(d+1,g.x,a.y)):K.B(f.y,e.y)&&K.B(e.x,g.x)?(K.B(f.y,b.i(d-2).y)&&!K.B(f.x,b.i(d-2).x)?(b.m(d,f.x,a.y),c++,d++):b.N(d-1,f.x,a.y),K.B(g.x,b.i(d+2).x)&&!K.B(g.y,b.i(d+2).y)?b.m(d+1,a.x,g.y):b.N(d+1,a.x,g.y)):K.B(f.x,e.x)&&K.B(e.x,g.x)?(K.B(f.x,b.i(d-2).x)&&!K.B(f.y,b.i(d-2).y)?(b.m(d,a.x,f.y),c++,d++):b.N(d-1,a.x,f.y),K.B(g.x,b.i(d+2).x)&&
!K.B(g.y,b.i(d+2).y)?b.m(d+1,a.x,g.y):b.N(d+1,a.x,g.y)):K.B(f.y,e.y)&&K.B(e.y,g.y)&&(K.B(f.y,b.i(d-2).y)&&!K.B(f.x,b.i(d-2).x)?(b.m(d,f.x,a.y),c++,d++):b.N(d-1,f.x,a.y),K.B(g.y,b.i(d+2).y)&&!K.B(g.x,b.i(d+2).x)?b.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).Nb()&&(f=e.oa(qd,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).Nb()&&(c=e.oa(qd,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.pf()};dh.prototype.computeReshape=function(a){var b=this.adornedLink,c=this.handle.segmentIndex;switch(this.mv(this.handle)){case ih:return a;case gh:return new J(b.i(c).x,a.y);case hh:return new J(a.x,b.i(c).y);default:case eh:return b.i(c)}};
na.Object.defineProperties(dh.prototype,{handleArchetype:{configurable:!0,get:function(){return this.w},set:function(a){null!==a&&w(a,N,dh,"handleArchetype");this.w=a}},midHandleArchetype:{configurable:!0,get:function(){return this.L},set:function(a){null!==a&&w(a,N,dh,"midHandleArchetype");this.L=a}},handle:{configurable:!0,get:function(){return this.l},set:function(a){if(null!==a&&(w(a,N,dh,"handle"),!(a.part instanceof Cf)))throw Error("new handle is not in an Adornment: "+
a);this.l=a}},adornedLink:{configurable:!0,get:function(){return this.Mt}},resegmentingDistance:{configurable:!0,get:function(){return this.ca},set:function(a){z(a,"number",dh,"resegmentingDistance");this.ca=a}},originalPoint:{configurable:!0,get:function(){return this.zl}},originalPoints:{configurable:!0,get:function(){return this.ls}}});dh.prototype.setReshapingBehavior=dh.prototype.Cm;dh.prototype.getReshapingBehavior=dh.prototype.mv;
var eh=new D(dh,"None",0),hh=new D(dh,"Horizontal",1),gh=new D(dh,"Vertical",2),ih=new D(dh,"All",3);dh.className="LinkReshapingTool";dh.None=eh;dh.Horizontal=hh;dh.Vertical=gh;dh.All=ih;Za("linkReshapingTool",function(){return this.findTool("LinkReshaping")},function(a){If(this,"LinkReshaping",a,this.mouseDownTools)});
function kh(){0<arguments.length&&Da(kh);vf.call(this);this.name="Resizing";this.Uf=(new Zb(1,1)).freeze();this.Tf=(new Zb(9999,9999)).freeze();this.Gg=(new Zb(NaN,NaN)).freeze();this.L=!1;this.ce=null;var a=new Hg;a.alignmentFocus=qd;a.figure="Rectangle";a.desiredSize=tc;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.w=a;this.l=null;this.zl=new J;this.Mw=new Zb;this.Po=new J;this.cu=new Zb(0,0);this.bu=new Zb(Infinity,Infinity);this.au=new Zb(1,1);this.Jw=!0}
ma(kh,vf);kh.prototype.updateAdornments=function(a){if(!(null===a||a instanceof T)){if(a.isSelected&&!this.diagram.isReadOnly){var b=a.resizeObject,c=a.dk(this.name);if(null!==b&&a.canResize()&&a.actualBounds.o()&&a.isVisible()&&b.actualBounds.o()&&b.vf()){if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){b=b.Oi();Dg(a)&&this.updateResizeHandles(c,b);a.rh(this.name,c);return}}}a.xf(this.name)}};
kh.prototype.makeAdornment=function(a){var b=a.part.resizeAdornmentTemplate;if(null===b){b=new Cf;b.type=W.Spot;b.locationSpot=qd;var c=new lh;c.isPanelMain=!0;b.add(c);b.add(this.makeHandle(a,fd));b.add(this.makeHandle(a,hd));b.add(this.makeHandle(a,ud));b.add(this.makeHandle(a,sd));b.add(this.makeHandle(a,Vd));b.add(this.makeHandle(a,Xd));b.add(this.makeHandle(a,de));b.add(this.makeHandle(a,Wd))}else if(mh(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};
kh.prototype.makeHandle=function(a,b){a=this.handleArchetype;if(null===a)return null;a=a.copy();a.alignment=b;return a};
kh.prototype.updateResizeHandles=function(a,b){if(null!==a)if(!a.alignment.Cb()&&("pointer"===a.cursor||0<a.cursor.indexOf("resize")))a:{var c=a.alignment;c.Nb()&&(c=qd);if(0>=c.x)b=0>=c.y?b+225:1<=c.y?b+135:b+180;else if(1<=c.x)0>=c.y?b+=315:1<=c.y&&(b+=45);else if(0>=c.y)b+=270;else if(1<=c.y)b+=90;else break a;0>b?b+=360:360<=b&&(b-=360);a.cursor=22.5>b?"e-resize":67.5>b?"se-resize":112.5>b?"s-resize":157.5>b?"sw-resize":202.5>b?"w-resize":247.5>b?"nw-resize":292.5>b?"n-resize":337.5>b?"ne-resize":
"e-resize"}else if(a instanceof W)for(a=a.elements;a.next();)this.updateResizeHandles(a.value,b)};kh.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};
kh.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.zl.set(this.adornedObject.oa(this.handle.alignment.zv())),this.Po.set(this.adornedObject.part.location),this.Mw.set(this.adornedObject.desiredSize),this.au=this.computeCellSize(),this.cu=this.computeMinSize(),this.bu=this.computeMaxSize(),a.isMouseCaptured=
!0,this.Jw=a.animationManager.isEnabled,a.animationManager.isEnabled=!1,this.Ca(this.name),this.isActive=!0))};kh.prototype.doDeactivate=function(){var a=this.diagram;this.Ag();this.ce=this.handle=null;this.isActive=a.isMouseCaptured=!1;a.animationManager.isEnabled=this.Jw};kh.prototype.doCancel=function(){null!==this.adornedObject&&(this.adornedObject.desiredSize=this.originalDesiredSize,this.adornedObject.part.location=this.originalLocation);this.stopTool()};
kh.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive){var b=this.cu,c=this.bu,d=this.au,e=this.adornedObject.at(a.lastInput.documentPoint,J.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);a.hd();J.free(e)}};
kh.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.cu,c=this.bu,d=this.au,e=this.adornedObject.at(a.lastInput.documentPoint,J.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);J.free(e);a.Ya();this.transactionResult=this.name;a.ba("PartResized",this.adornedObject,this.originalDesiredSize)}this.stopTool()};
kh.prototype.resize=function(a){var b=this.diagram,c=this.adornedObject,d=c.part;c.desiredSize=a.size;d.bc();a=this.adornedObject.oa(this.handle.alignment.zv());d instanceof xg?(c=new F,c.add(d),b.moveParts(c,this.zl.copy().Zd(a),!0)):d.location=d.location.copy().Zd(a).add(this.zl)};
kh.prototype.computeResize=function(a,b,c,d,e,f){b.Nb()&&(b=qd);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.bq(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};kh.prototype.computeReshape=function(){var a=nh;this.adornedObject instanceof Hg&&(a=oh(this.adornedObject));return!(a===ph||this.diagram.lastInput.shift)};
kh.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};kh.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};
kh.prototype.computeCellSize=function(){var a=new Zb(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};
na.Object.defineProperties(kh.prototype,{handleArchetype:{configurable:!0,get:function(){return this.w},set:function(a){null!==a&&w(a,N,kh,"handleArchetype");this.w=a}},handle:{configurable:!0,get:function(){return this.l},set:function(a){if(null!==a&&(w(a,N,kh,"handle"),!(a.part instanceof Cf)))throw Error("new handle is not in an Adornment: "+a);this.l=a}},adornedObject:{configurable:!0,get:function(){return this.ce},set:function(a){if(null!==a&&(w(a,N,
kh,"handle"),a.part instanceof Cf))throw Error("new handle must not be in an Adornment: "+a);this.ce=a}},minSize:{configurable:!0,get:function(){return this.Uf},set:function(a){w(a,Zb,kh,"minSize");if(!this.Uf.A(a)){var b=a.width;isNaN(b)&&(b=0);a=a.height;isNaN(a)&&(a=0);this.Uf.h(b,a)}}},maxSize:{configurable:!0,get:function(){return this.Tf},set:function(a){w(a,Zb,kh,"maxSize");if(!this.Tf.A(a)){var b=a.width;isNaN(b)&&(b=Infinity);a=a.height;isNaN(a)&&(a=Infinity);
this.Tf.h(b,a)}}},cellSize:{configurable:!0,get:function(){return this.Gg},set:function(a){w(a,Zb,kh,"cellSize");this.Gg.A(a)||this.Gg.assign(a)}},isGridSnapEnabled:{configurable:!0,get:function(){return this.L},set:function(a){z(a,"boolean",kh,"isGridSnapEnabled");this.L=a}},originalDesiredSize:{configurable:!0,get:function(){return this.Mw}},originalLocation:{configurable:!0,get:function(){return this.Po}}});kh.className="ResizingTool";
Za("resizingTool",function(){return this.findTool("Resizing")},function(a){If(this,"Resizing",a,this.mouseDownTools)});function qh(){0<arguments.length&&Da(qh);vf.call(this);this.name="Rotating";this.Na=45;this.Ma=2;this.Po=new J;this.ce=null;var a=new Hg;a.figure="Ellipse";a.desiredSize=uc;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.w=a;this.l=null;this.Lw=0;this.wu=new J(NaN,NaN);this.L=0;this.ca=50}ma(qh,vf);
qh.prototype.updateAdornments=function(a){if(null!==a){if(a.Bh()){var b=a.rotateObject;if(b===a||b===a.path||b.isPanelMain)return}if(a.isSelected&&!this.diagram.isReadOnly&&(b=a.rotateObject,null!==b&&a.canRotate()&&a.actualBounds.o()&&a.isVisible()&&b.actualBounds.o()&&b.vf())){var c=a.dk(this.name);if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){c.angle=b.Oi();null===c.placeholder&&(c.location=this.computeAdornmentLocation(b));a.rh(this.name,c);return}}a.xf(this.name)}};
qh.prototype.makeAdornment=function(a){var b=a.part.rotateAdornmentTemplate;if(null===b){b=new Cf;b.type=W.Position;b.locationSpot=qd;var c=this.handleArchetype;null!==c&&b.add(c.copy())}else if(mh(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};qh.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};
qh.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.Lw=this.adornedObject.angle,this.wu=this.computeRotationPoint(this.adornedObject),this.Po=this.adornedObject.part.location.copy(),a.isMouseCaptured=!0,a.delaysLayout=!0,this.Ca(this.name),this.isActive=!0)};
qh.prototype.computeRotationPoint=function(a){var b=a.part,c=b.locationObject;return b.rotationSpot.Za()?a.oa(b.rotationSpot):a===b||a===c?c.oa(b.locationSpot):a.oa(qd)};
qh.prototype.computeAdornmentLocation=function(a){var b=this.rotationPoint;b.o()||(b=this.computeRotationPoint(a));b=a.at(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.oa(b)};qh.prototype.doDeactivate=function(){var a=this.diagram;this.Ag();this.ce=this.handle=null;this.wu=new J(NaN,NaN);this.isActive=a.isMouseCaptured=!1};qh.prototype.doCancel=function(){this.diagram.delaysLayout=!1;this.rotate(this.originalAngle);this.stopTool()};qh.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeRotate(a.lastInput.documentPoint),this.rotate(a))};
qh.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){a.delaysLayout=!1;var b=this.computeRotate(a.lastInput.documentPoint);this.rotate(b);a.Ya();this.transactionResult=this.name;a.ba("PartRotated",this.adornedObject,this.originalAngle)}this.stopTool()};
qh.prototype.rotate=function(a){E&&B(a,qh,"rotate:newangle");var b=this.adornedObject;if(null!==b){b.angle=a;b=b.part;b.bc();var c=b.locationObject,d=b.rotateObject;if(c===d||c.vg(d))c=this.Po.copy(),b.location=c.Zd(this.rotationPoint).rotate(a-this.originalAngle).add(this.rotationPoint)}};
qh.prototype.computeRotate=function(a){a=this.rotationPoint.Xa(a)-this.handleAngle;var b=this.adornedObject.panel;null!==b&&(a-=b.Oi());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};
na.Object.defineProperties(qh.prototype,{handleArchetype:{configurable:!0,get:function(){return this.w},set:function(a){null!==a&&w(a,N,qh,"handleArchetype");this.w=a}},handle:{configurable:!0,get:function(){return this.l},set:function(a){if(null!==a&&(w(a,N,qh,"handle"),!(a.part instanceof Cf)))throw Error("new handle is not in an Adornment: "+a);this.l=a}},adornedObject:{configurable:!0,get:function(){return this.ce},set:function(a){if(null!==a&&(w(a,N,
qh,"handle"),a.part instanceof Cf))throw Error("new handle must not be in an Adornment: "+a);this.ce=a}},snapAngleMultiple:{configurable:!0,get:function(){return this.Na},set:function(a){z(a,"number",qh,"snapAngleMultiple");this.Na=a}},snapAngleEpsilon:{configurable:!0,get:function(){return this.Ma},set:function(a){z(a,"number",qh,"snapAngleEpsilon");this.Ma=a}},originalAngle:{configurable:!0,get:function(){return this.Lw}},rotationPoint:{configurable:!0,
enumerable:!0,get:function(){return this.wu}},handleAngle:{configurable:!0,get:function(){return this.L},set:function(a){z(a,"number",qh,"handleAngle");this.L=a}},handleDistance:{configurable:!0,get:function(){return this.ca},set:function(a){z(a,"number",qh,"handleDistance");this.ca=a}}});qh.className="RotatingTool";Za("rotatingTool",function(){return this.findTool("Rotating")},function(a){If(this,"Rotating",a,this.mouseDownTools)});
function rh(){vf.call(this);0<arguments.length&&Da(rh);this.name="ClickSelecting"}ma(rh,vf);rh.prototype.canStart=function(){return!this.isEnabled||this.isBeyondDragSize()?!1:!0};rh.prototype.doMouseUp=function(){this.isActive&&(this.standardMouseSelect(),!this.standardMouseClick()&&this.diagram.lastInput.isTouchEvent&&this.diagram.toolManager.doToolTip());this.stopTool()};rh.className="ClickSelectingTool";function sh(){vf.call(this);0<arguments.length&&Da(sh);this.name="Action";this.Ak=null}
ma(sh,vf);sh.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram,b=a.lastInput,c=a.Tb(b.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a});if(null!==c){if(!c.isActionable)return!1;this.Ak=c;a.Ok=a.Tb(b.documentPoint,null,null);return!0}return!1};sh.prototype.doMouseDown=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Ak;null!==b&&(a.targetObject=b,null!==b.actionDown&&b.actionDown(a,b))}else this.canStart()&&this.doActivate()};
sh.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Ak;null!==b&&(a.targetObject=b,null!==b.actionMove&&b.actionMove(a,b))}};sh.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Ak;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()};
sh.prototype.doCancel=function(){var a=this.diagram.lastInput,b=this.Ak;null!==b&&(a.targetObject=b,null!==b.actionCancel&&b.actionCancel(a,b),this.stopTool())};sh.prototype.doStop=function(){this.Ak=null};sh.className="ActionTool";function th(){vf.call(this);0<arguments.length&&Da(th);this.name="ClickCreating";this.dj=null;this.w=!0;this.l=!1;this.Dw=new J(0,0)}ma(th,vf);
th.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.Dw=a.lastInput.viewPoint.copy()),2!==a.lastInput.clickCount||this.isBeyondDragSize(this.Dw))return!1}else if(1!==a.lastInput.clickCount)return!1;return a.currentTool!==this&&null!==a.em(a.lastInput.documentPoint,!0)?!1:!0};
th.prototype.doMouseUp=function(){var a=this.diagram;this.isActive&&this.insertPart(a.lastInput.documentPoint);this.stopTool()};
th.prototype.insertPart=function(a){var b=this.diagram,c=this.archetypeNodeData;if(null===c)return null;this.Ca(this.name);var d=null;c instanceof U?c.dc()&&(mh(c),d=c.copy(),null!==d&&b.add(d)):null!==c&&(c=b.model.copyNodeData(c),Ja(c)&&(b.model.mf(c),d=b.xc(c)));null!==d&&(c=J.allocAt(a.x,a.y),this.isGridSnapEnabled&&uh(this.diagram,d,a,c),d.location=c,b.allowSelect&&b.select(d),J.free(c));b.Ya();this.transactionResult=this.name;b.ba("PartCreated",d);this.Ag();return d};
na.Object.defineProperties(th.prototype,{archetypeNodeData:{configurable:!0,get:function(){return this.dj},set:function(a){null!==a&&z(a,"object",th,"archetypeNodeData");this.dj=a}},isDoubleClick:{configurable:!0,get:function(){return this.w},set:function(a){z(a,"boolean",th,"isDoubleClick");this.w=a}},isGridSnapEnabled:{configurable:!0,get:function(){return this.l},set:function(a){z(a,"boolean",th,"isGridSnapEnabled");this.l=a}}});th.className="ClickCreatingTool";
function vh(){vf.call(this);0<arguments.length&&Da(vh);this.name="DragSelecting";this.Vk=175;this.w=!1;var a=new U;a.layerName="Tool";a.selectable=!1;var b=new Hg;b.name="SHAPE";b.figure="Rectangle";b.fill=null;b.stroke="magenta";a.add(b);this.l=a}ma(vh,vf);
vh.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.em(b.documentPoint,!0))?!1:!0};vh.prototype.doActivate=function(){var a=this.diagram;this.isActive=!0;a.isMouseCaptured=!0;a.skipsUndoManager=!0;a.add(this.box);this.doMouseMove()};
vh.prototype.doDeactivate=function(){var a=this.diagram;a.zf();a.remove(this.box);a.skipsUndoManager=!1;this.isActive=a.isMouseCaptured=!1};vh.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive&&null!==this.box){var b=this.computeBoxBounds(),c=this.box.bb("SHAPE");null===c&&(c=this.box.Bb());var d=Zb.alloc().h(b.width,b.height);b=J.alloc().h(b.x,b.y);c.desiredSize=d;this.box.position=b;Zb.free(d);J.free(b);(a.allowHorizontalScroll||a.allowVerticalScroll)&&a.Ts(a.lastInput.viewPoint)}};
vh.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram;a.remove(this.box);try{a.currentCursor="wait",a.ba("ChangingSelection",a.selection),this.selectInRect(this.computeBoxBounds()),a.ba("ChangedSelection",a.selection)}finally{a.currentCursor=""}}this.stopTool()};vh.prototype.computeBoxBounds=function(){var a=this.diagram;return new L(a.firstInput.documentPoint,a.lastInput.documentPoint)};
vh.prototype.selectInRect=function(a){var b=this.diagram,c=b.lastInput;a=b.px(a,this.isPartialInclusion);if(kb?c.meta:c.control)if(c.shift)for(a=a.iterator;a.next();)b=a.value,b.isSelected&&(b.isSelected=!1);else for(a=a.iterator;a.next();)b=a.value,b.isSelected=!b.isSelected;else if(c.shift)for(a=a.iterator;a.next();)b=a.value,b.isSelected||(b.isSelected=!0);else{c=new F;for(b=b.selection.iterator;b.next();){var d=b.value;a.contains(d)||c.add(d)}for(b=c.iterator;b.next();)b.value.isSelected=!1;for(a=
a.iterator;a.next();)b=a.value,b.isSelected||(b.isSelected=!0)}};na.Object.defineProperties(vh.prototype,{delay:{configurable:!0,get:function(){return this.Vk},set:function(a){z(a,"number",vh,"delay");this.Vk=a}},isPartialInclusion:{configurable:!0,get:function(){return this.w},set:function(a){z(a,"boolean",vh,"isPartialInclusion");this.w=a}},box:{configurable:!0,get:function(){return this.l},set:function(a){null!==a&&w(a,U,vh,"box");this.l=a}}});
vh.className="DragSelectingTool";function wh(){vf.call(this);0<arguments.length&&Da(wh);this.name="Panning";this.ru=new J;this.jy=new J;this.Fg=!1;var a=this;this.Pw=function(){ra.document.removeEventListener("scroll",a.Pw,!1);a.stopTool()}}ma(wh,vf);wh.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};
wh.prototype.doActivate=function(){var a=this.diagram;this.Fg?(a.lastInput.bubbles=!0,ra.document.addEventListener("scroll",this.Pw,!1)):(a.currentCursor="move",a.isMouseCaptured=!0,this.ru.assign(a.position));this.isActive=!0};wh.prototype.doDeactivate=function(){var a=this.diagram;a.currentCursor="";this.isActive=a.isMouseCaptured=!1};wh.prototype.doCancel=function(){var a=this.diagram;a.position=this.ru;a.isMouseCaptured=!1;this.stopTool()};wh.prototype.doMouseMove=function(){this.move()};
wh.prototype.doMouseUp=function(){this.move();this.stopTool()};wh.prototype.move=function(){var a=this.diagram;if(this.isActive&&a)if(this.Fg)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.jy.h(e,c)}};
na.Object.defineProperties(wh.prototype,{bubbles:{configurable:!0,get:function(){return this.Fg},set:function(a){z(a,"boolean",wh,"bubbles");this.Fg=a}},originalPosition:{configurable:!0,get:function(){return this.ru}}});wh.className="PanningTool";Za("clickCreatingTool",function(){return this.findTool("ClickCreating")},function(a){If(this,"ClickCreating",a,this.mouseUpTools)});
Za("clickSelectingTool",function(){return this.findTool("ClickSelecting")},function(a){If(this,"ClickSelecting",a,this.mouseUpTools)});Za("panningTool",function(){return this.findTool("Panning")},function(a){If(this,"Panning",a,this.mouseMoveTools)});Za("dragSelectingTool",function(){return this.findTool("DragSelecting")},function(a){If(this,"DragSelecting",a,this.mouseMoveTools)});Za("actionTool",function(){return this.findTool("Action")},function(a){If(this,"Action",a,this.mouseDownTools)});
function Hf(){this.ca=this.L=this.l=this.w=null}
na.Object.defineProperties(Hf.prototype,{mainElement:{configurable:!0,get:function(){return this.L},set:function(a){null!==a&&w(a,HTMLElement,Hf,"mainElement");this.L=a}},show:{configurable:!0,get:function(){return this.w},set:function(a){this.w!==a&&(null!==a&&z(a,"function",Hf,"show"),this.w=a)}},hide:{configurable:!0,get:function(){return this.l},set:function(a){this.l!==a&&(null!==a&&z(a,"function",Hf,"hide"),this.l=a)}},valueFunction:{configurable:!0,
enumerable:!0,get:function(){return this.ca},set:function(a){this.ca=a}}});Hf.className="HTMLInfo";function xh(a,b,c){this.text=a;this.gx=b;this.visible=c}xh.className="ContextMenuButtonInfo";function yh(){vf.call(this);0<arguments.length&&Da(yh);this.name="ContextMenu";this.w=this.St=this.l=null;this.Iw=new J;this.Tt=null;this.iu=!1;var a=this;this.Gu=function(){a.stopTool()}}ma(yh,vf);
function zh(a){var b=new Hf;b.show=function(a,b,c){c.showDefaultContextMenu()};b.hide=function(a,b){b.hideDefaultContextMenu()};Ah=b;a.Gu=function(){a.stopTool()};b=ya("div");var c=ya("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=ya("style");ra.document.getElementsByTagName("head")[0].appendChild(d);d.sheet.insertRule(".goCXul { list-style: none; }",0);d.sheet.insertRule(".goCXli {font:700 1.5em Helvetica, Arial, sans-serif;position: relative;min-width: 60px; }",0);d.sheet.insertRule(".goCXa {color: #444;display: inline-block;padding: 4px;text-decoration: none;margin: 2px;border: 1px solid gray;border-radius: 10px; }",0);b.addEventListener("contextmenu",Bh,!1);b.addEventListener("selectstart",Bh,!1);c.addEventListener("contextmenu",
Bh,!1);b.className="goCXforeground";c.className="goCXbackground";ra.document.body&&(ra.document.body.appendChild(b),ra.document.body.appendChild(c));Ch=b;Dh=c;Eh=!0}function Bh(a){a.preventDefault();return!1}yh.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};yh.prototype.doStart=function(){this.Iw.set(this.diagram.firstInput.documentPoint)};
yh.prototype.doStop=function(){this.hideContextMenu();this.currentObject=null};yh.prototype.findObjectWithContextMenu=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.lastInput,d=null;a instanceof P||(a instanceof N?d=a:d=b.Tb(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};
yh.prototype.doActivate=function(){};yh.prototype.doMouseDown=function(){vf.prototype.doMouseDown.call(this);if(this.isActive&&this.currentContextMenu instanceof Cf){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doMouseDown(),a.doDeactivate())}this.diagram.toolManager.mouseDownTools.contains(this)&&Fh(this)};
yh.prototype.doMouseUp=function(){if(this.isActive&&this.currentContextMenu instanceof Cf){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doCancel(),a.doDeactivate())}Fh(this)};
function Fh(a){var b=a.diagram;if(a.isActive){var c=a.currentContextMenu;if(null!==c){if(!(c instanceof Hf)){var d=b.Tb(b.lastInput.documentPoint,null,null);null!==d&&d.vg(c)&&a.standardMouseClick(null,null)}a.stopTool();a.canStart()&&(b.currentTool=a,a.doMouseUp())}}else a.canStart()&&(Gh(a,!0),a.isActive||a.stopTool())}
function Gh(a,b,c){void 0===c&&(c=null);if(!a.iu&&(a.iu=!0,b&&a.standardMouseSelect(),b=a.standardMouseClick(),a.iu=!1,!b))if(a.isActive=!0,b=Ah,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)}
yh.prototype.doMouseMove=function(){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.doMouseMove();this.isActive&&this.diagram.toolManager.doMouseMove()};
yh.prototype.showContextMenu=function(a,b){!E||a instanceof Cf||a instanceof Hf||v("showContextMenu:contextMenu must be an Adornment or HTMLInfo.");null!==b&&w(b,N,yh,"showContextMenu:obj");var c=this.diagram;a!==this.currentContextMenu&&this.hideContextMenu();if(a instanceof Cf){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.bc();this.positionContextMenu(a,b)}else a instanceof Hf&&a.show(b,c,this);this.currentContextMenu=a};yh.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}};
yh.prototype.hideContextMenu=function(){var a=this.diagram,b=this.currentContextMenu;null!==b&&(b instanceof Cf?(a.remove(b),null!==this.St&&this.St.xf(b.category),b.data=null,b.adornedObject=null):b instanceof Hf&&(null!==b.hide?b.hide(a,this):null!==b.mainElement&&(b.mainElement.style.display="none")),this.currentContextMenu=null,this.standardMouseOver())};
function Hh(){var a=new F;a.add(new xh("Copy",function(a){a.commandHandler.copySelection()},function(a){return a.commandHandler.canCopySelection()}));a.add(new xh("Cut",function(a){a.commandHandler.cutSelection()},function(a){return a.commandHandler.canCutSelection()}));a.add(new xh("Delete",function(a){a.commandHandler.deleteSelection()},function(a){return a.commandHandler.canDeleteSelection()}));a.add(new xh("Paste",function(a){a.commandHandler.pasteSelection(a.lastInput.documentPoint)},function(a){return a.commandHandler.canPasteSelection()}));
a.add(new xh("Select All",function(a){a.commandHandler.selectAll()},function(a){return a.commandHandler.canSelectAll()}));a.add(new xh("Undo",function(a){a.commandHandler.undo()},function(a){return a.commandHandler.canUndo()}));a.add(new xh("Redo",function(a){a.commandHandler.redo()},function(a){return a.commandHandler.canRedo()}));a.add(new xh("Scroll To Part",function(a){a.commandHandler.scrollToPart()},function(a){return a.commandHandler.canScrollToPart()}));a.add(new xh("Zoom To Fit",function(a){a.commandHandler.zoomToFit()},
function(a){return a.commandHandler.canZoomToFit()}));a.add(new xh("Reset Zoom",function(a){a.commandHandler.resetZoom()},function(a){return a.commandHandler.canResetZoom()}));a.add(new xh("Group Selection",function(a){a.commandHandler.groupSelection()},function(a){return a.commandHandler.canGroupSelection()}));a.add(new xh("Ungroup Selection",function(a){a.commandHandler.ungroupSelection()},function(a){return a.commandHandler.canUngroupSelection()}));a.add(new xh("Edit Text",function(a){a.commandHandler.editTextBlock()},
function(a){return a.commandHandler.canEditTextBlock()}));return a}
yh.prototype.showDefaultContextMenu=function(){var a=this.diagram;null===this.Tt&&(this.Tt=Hh());Ch.innerHTML="";Dh.addEventListener("click",this.Gu,!1);var b=this,c=ya("ul");c.className="goCXul";Ch.appendChild(c);c.innerHTML="";for(var d=this.Tt.iterator;d.next();){var e=d.value,f=e.visible;if("function"===typeof e.gx&&("function"!==typeof f||f(a))){f=ya("li");f.className="goCXli";var g=ya("a");g.className="goCXa";g.href="#";g.Zx=e.gx;g.addEventListener("click",function(c){this.Zx(a);b.stopTool();
c.preventDefault();return!1},!1);g.textContent=e.text;f.appendChild(g);c.appendChild(f)}}Ch.style.display="block";Dh.style.display="block"};yh.prototype.hideDefaultContextMenu=function(){null!==this.currentContextMenu&&this.currentContextMenu===Ah&&(Ch.style.display="none",Dh.style.display="none",Dh.removeEventListener("click",this.Gu,!1),this.currentContextMenu=null)};
na.Object.defineProperties(yh.prototype,{currentContextMenu:{configurable:!0,get:function(){return this.l},set:function(a){!E||null===a||a instanceof Cf||a instanceof Hf||v("ContextMenuTool.currentContextMenu must be an Adornment or HTMLInfo.");this.l=a;this.St=a instanceof Cf?a.adornedPart:null}},defaultTouchContextMenu:{configurable:!0,get:function(){!1===Eh&&null===Ah&&Ih&&zh(this);return Ah},set:function(a){!E||null===a||a instanceof Cf||a instanceof Hf||v("ContextMenuTool.defaultTouchContextMenu must be an Adornment or HTMLInfo.");
null===a&&(Eh=!0);Ah=a}},currentObject:{configurable:!0,get:function(){return this.w},set:function(a){null!==a&&w(a,N,yh,"currentObject");this.w=a}},mouseDownPoint:{configurable:!0,get:function(){return this.Iw}}});var Ah=null,Eh=!1,Dh=null,Ch=null;yh.className="ContextMenuTool";Za("contextMenuTool",function(){return this.findTool("ContextMenu")},function(a){If(this,"ContextMenu",a,this.mouseUpTools)});
function Jh(){0<arguments.length&&Da(Jh);vf.call(this);this.name="TextEditing";this.lh=new Kh;this.Na=null;this.Ma=Lh;this.zi=null;this.na=Mh;this.L=1;this.ca=!0;this.w=null;this.l=new Hf;this.Ut=null;Nh(this,this.l)}ma(Jh,vf);
function Nh(a,b){if(Ih){var c=ya("textarea");a.Ut=c;c.addEventListener("input",function(){if(null!==a.textBlock){var b=a.Ax(this.value);this.style.width=20+b.measuredBounds.width*this.hA+"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(Oh)):9===c?(a.acceptText(Ph),b.preventDefault()):27===c&&(a.doCancel(),null!==a.diagram&&a.diagram.doFocus())}},!1);c.addEventListener("focus",
function(){if(null!==a.currentTextEditor&&a.state!==Mh){var b=a.Ut;a.na===Qh&&(a.na=Rh);"function"===typeof b.select&&a.selectsTextOnActivate&&(b.select(),b.setSelectionRange(0,9999))}},!1);c.addEventListener("blur",function(){if(null!==a.currentTextEditor&&a.state!==Mh){var b=a.Ut;"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 Kh&&f instanceof Jh)if(f.state===Sh)c.style.border="3px solid red",c.focus();else{var d=a.oa(qd),e=b.position,k=b.scale,l=a.Ge()*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.hA=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)}}}
Jh.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(null===a||a.isReadOnly||!a.lastInput.left||this.isBeyondDragSize())return!1;var b=a.Tb(a.lastInput.documentPoint);if(!(null!==b&&b instanceof Kh&&b.editable&&b.part.canEdit()))return!1;b=b.part;return null===b||this.starting===Lh&&!b.isSelected||this.starting===Th&&2>a.lastInput.clickCount?!1:!0};Jh.prototype.doStart=function(){this.isActive||null===this.textBlock||this.doActivate()};
Jh.prototype.doActivate=function(){if(!this.isActive){var a=this.diagram;if(null!==a){var b=this.textBlock;null===b&&(b=a.Tb(a.lastInput.documentPoint));if(null!==b&&b instanceof Kh&&(this.textBlock=b,null!==b.part)){this.isActive=!0;this.na=Qh;var c=this.defaultTextEditor;null!==b.textEditor&&(c=b.textEditor);this.lh=this.textBlock.copy();var d=new L(this.textBlock.oa(fd),this.textBlock.oa(ud));a.Nv(d);c.show(b,a,this);this.currentTextEditor=c}}}};Jh.prototype.doCancel=function(){this.stopTool()};
Jh.prototype.doMouseUp=function(){!this.isActive&&this.canStart()&&this.doActivate()};Jh.prototype.doMouseDown=function(){this.isActive&&this.acceptText(Uh)};
Jh.prototype.acceptText=function(a){switch(a){case Uh:if(this.na===Vh)this.currentTextEditor instanceof HTMLElement&&this.currentTextEditor.focus();else if(this.na===Qh||this.na===Sh||this.na===Rh)this.na=Wh,Xh(this);break;case Yh:case Oh:case Ph:if(Oh!==a||!0!==this.textBlock.isMultiline)if(this.na===Qh||this.na===Sh||this.na===Rh)this.na=Wh,Xh(this)}};
function Xh(a){var b=a.textBlock,c=a.diagram,d=a.currentTextEditor;if(null!==b&&null!==d){var e=b.text,f="";null!==d.valueFunction&&(f=d.valueFunction());a.isValidText(b,e,f)?(a.Ca(a.name),a.na=Vh,a.transactionResult=a.name,b.text=f,null!==b.textEdited&&b.textEdited(b,e,f),null!==c&&c.ba("TextEdited",b,e),a.Ag(),a.stopTool(),null!==c&&c.doFocus()):(a.na=Sh,null!==b.errorFunction&&b.errorFunction(a,e,f),d.show(b,c,a))}}
Jh.prototype.doDeactivate=function(){var a=this.diagram;null!==a&&(this.na=Mh,this.textBlock=null,null!==this.currentTextEditor&&this.currentTextEditor.hide(a,this),this.isActive=!1)};Jh.prototype.isValidText=function(a,b,c){w(a,Kh,Jh,"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};Jh.prototype.Ax=function(a){var b=this.lh;b.text=a;b.measure(this.textBlock.ol,Infinity);return b};
na.Object.defineProperties(Jh.prototype,{textBlock:{configurable:!0,get:function(){return this.Na},set:function(a){null!==a&&w(a,Kh,Jh,"textBlock");this.Na=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){!E||a instanceof Hf||v("TextEditingTool.defaultTextEditor must be an HTMLInfo.");this.l=a}},starting:{configurable:!0,
get:function(){return this.Ma},set:function(a){tb(a,Jh,Jh,"starting");this.Ma=a}},textValidation:{configurable:!0,get:function(){return this.zi},set:function(a){null!==a&&z(a,"function",Jh,"textValidation");this.zi=a}},minimumEditorScale:{configurable:!0,get:function(){return this.L},set:function(a){null!==a&&z(a,"number",Jh,"minimumEditorScale");this.L=a}},selectsTextOnActivate:{configurable:!0,get:function(){return this.ca},set:function(a){null!==a&&z(a,
"boolean",Jh,"selectsTextOnActivate");this.ca=a}},state:{configurable:!0,get:function(){return this.na},set:function(a){this.na!==a&&(tb(a,Jh,Jh,"starting"),this.na=a)}}});Jh.prototype.measureTemporaryTextBlock=Jh.prototype.Ax;
var Yh=new D(Jh,"LostFocus",0),Uh=new D(Jh,"MouseDown",1),Ph=new D(Jh,"Tab",2),Oh=new D(Jh,"Enter",3),ai=new D(Jh,"SingleClick",0),Lh=new D(Jh,"SingleClickSelected",1),Th=new D(Jh,"DoubleClick",2),Mh=new D(Jh,"StateNone",0),Qh=new D(Jh,"StateActive",1),Rh=new D(Jh,"StateEditing",2),Wh=new D(Jh,"StateValidating",3),Sh=new D(Jh,"StateInvalid",4),Vh=new D(Jh,"StateValidated",5);Jh.className="TextEditingTool";Jh.LostFocus=Yh;Jh.MouseDown=Uh;Jh.Tab=Ph;Jh.Enter=Oh;Jh.SingleClick=ai;
Jh.SingleClickSelected=Lh;Jh.DoubleClick=Th;Jh.StateNone=Mh;Jh.StateActive=Qh;Jh.StateEditing=Rh;Jh.StateValidating=Wh;Jh.StateInvalid=Sh;Jh.StateValidated=Vh;Za("textEditingTool",function(){return this.findTool("TextEditing")},function(a){If(this,"TextEditing",a,this.mouseUpTools)});
function bi(){ci||(di(),ci=!0);this.vw=ei;this.D=yf;this.vn=this.wn=null;this.cj=this.xn=this.yn=0;this.Fk=this.pi=this.sb=this.Nr=this.Of=!1;this.Pf=this.Fc=!0;this.fr=this.er=this.uw=null;this.tw=0;this.hr=new Ub;this.$t=600;this.ay=new J(0,0);this.rw=this.qw=this.Sw=!1;this.de=new H;this.Bj=new Ub;this.hs=new H;this.gr=null}function fi(a){a.cj=0;a.hr.clear();a.fr=null;a.er=null;a.wn=null;a.vn=null;a.yn=0;a.xn=0;a.Bj.clear();0<a.hs.count&&a.hs.clear();a.gr=null}
bi.prototype.ib=function(a){this.D=a};function ei(a,b,c,d){a/=d/2;return 1>a?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b}function gi(a,b,c,d){return a===d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b}bi.prototype.canStart=function(){return!0};t=bi.prototype;t.Dh=function(a,b){this.Fc&&(void 0!==b&&(this.gr=b),(this.Pf||this.D.Ui)&&this.canStart(a)&&(this.de.add(a),this.Of&&this.xd(),this.pi=this.sb=!0))};
t.Tz=function(a,b){this.Fc&&(void 0!==b&&(this.gr=b),this.Pf||this.D.Ui)&&(this.de.add(a),this.canStart(a)&&(this.Of&&this.xd(),this.sb=!0))};function hi(a){if(a.Fc)if(a.de.contains("Model")&&!a.Pf||!a.Fk)a.de.clear(),a.sb=!1,a.pi=!1,fi(a);else if(a.de.clear(),a.sb&&0===a.cj){var b=+new Date;a.cj=b;ra.requestAnimationFrame(function(){if(!1!==a.sb&&!a.Of&&a.cj===b){var c=a.D;c.He("temporaryPixelRatio")&&Yf(c);ii(c);a.sb=!1;a.pi=!1;c.ba("AnimationStarting");ji(a,b)}})}}
t.th=function(a,b,c,d,e,f){if(!(!this.sb||(E&&w(a,N,bi,"addToAnimation:obj"),"position"===b&&c.A(d))||a instanceof U&&!a.isAnimated)){var g=this.Bj;if(g.contains(a)){var h=g.K(a);g=h.start;var k=h.end;void 0===g[b]&&(g[b]=ki(c));k[b]=ki(d)}else h={},k={},h[b]=ki(c),k[b]=ki(d),d=h.position,d instanceof J&&!d.o()&&this.de.contains("Expand SubGraph")&&d.assign(k.position),h=new li(h,k,e),g.add(a,h);e&&0===b.indexOf("position:")&&a instanceof U?h.cv.location=ki(a.location):e&&(h.cv[b]=ki(c));f&&(h.ut=
!0);this.Fk=!0}};function ki(a){return a instanceof J?a.copy():a instanceof Zb?a.copy():a}function mi(a,b){if(!a.Of)return!1;a=a.Bj.K(b);return null!==a&&a.ut}
function ji(a,b){function c(){if(!1!==e.Of&&e.cj===b){var a=+new Date,f=a>r?l:a-q;ni(e);oi(e,d,p,g,f,l);e.er&&e.er();Eg(d);pi(e);a>r?qi(e):ra.requestAnimationFrame(c)}}var d=a.D;if(null!==d){var e=a,f=a.gr||{},g=f.Qy||a.vw,h=f.uA||null,k=f.vA||null,l=f.duration||a.$t,m=a.ay;for(f=a.Bj.iterator;f.next();){var n=f.value.start.position;n instanceof J&&(n.o()||n.assign(m))}a.uw=g;a.er=h;a.fr=k;a.tw=l;a.hr=a.Bj;var p=a.hr;for(f=p.iterator;f.next();)h=f.value.end,h["position:placeholder"]&&(k=f.key.findVisibleNode(),
k instanceof xg&&null!==k.placeholder&&(m=k.placeholder,k=m.oa(fd),m=m.padding,k.x+=m.left,k.y+=m.top,h["position:placeholder"]=k));a.Of=!0;ni(a);oi(a,d,p,g,0,l);Eg(a.D,!0);pi(a);var q=+new Date,r=q+l;e.cj===b&&ra.requestAnimationFrame(function(){c()})}}function ni(a){if(!a.Nr){var b=a.D;a.Sw=b.skipsUndoManager;a.qw=b.skipsModelSourceBindings;a.rw=b.vk;b.skipsUndoManager=!0;b.skipsModelSourceBindings=!0;b.vk=!0;a.Nr=!0}}
function pi(a){var b=a.D;b.skipsUndoManager=a.Sw;b.skipsModelSourceBindings=a.qw;b.vk=a.rw;a.Nr=!1}function oi(a,b,c,d,e,f){for(c=c.iterator;c.next();){var g=c.key,h=c.value,k=h.start,l=h.end,m=ri;for(n in l)"position"===n&&(l["position:placeholder"]||l["position:node"])||null===m.get(n)||m.get(n)(g,k[n],l[n],d,e,f,h)}d=b.sv;b.sv=!0;var n=a.vw;0!==a.yn&&0!==a.xn&&(c=a.yn,b.Da=n(e,c,a.xn-c,f));null!==a.wn&&null!==a.vn&&(c=a.wn,a=a.vn,b.ua=new J(n(e,c.x,a.x-c.x,f),n(e,c.y,a.y-c.y,f)));b.sv=d}
t.xd=function(){!0===this.sb&&(this.pi=this.sb=!1,this.de.clear(),this.cj=0,this.Fk&&this.D.ec());this.Of&&this.Fc&&qi(this)};
function qi(a){a.Of=!1;a.Fk=!1;ni(a);for(var b=a.D,c=a.uw,d=a.tw,e=a.hr,f=a.hs.iterator;f.next();)f.value.v();e=e.iterator;for(f=ri;e.next();){var g=e.key,h=e.value,k=h.start,l=h.end,m=h.cv,n;for(n in l)if(null!==f.get(n)){var p=n;!h.Wu||"position:node"!==p&&"position:placeholder"!==p||(p="position");f.get(p)(g,k[n],void 0!==m[n]?m[n]:h.Wu?k[n]:l[n],c,d,d)}h.Wu&&void 0!==m.location&&g instanceof U&&(g.location=m.location);h.ut&&g instanceof U&&g.Ob(!1)}for(c=a.D.links;c.next();)d=c.value,null!==d.dh&&
(d.points=d.dh,d.dh=null);b.lt.clear();hg(b,!1);b.Ya();b.S();b.hd();si(b);pi(a);a.fr&&a.fr();fi(a);b.ba("AnimationFinished");b.ec()}
t.Rp=function(a,b){if(this.pi&&(this.de.contains("Expand Tree")||this.de.contains("Expand SubGraph"))){var c=b.actualBounds,d=null;b instanceof xg&&(d=b.placeholder);null!==d?(c=d.oa(fd),d=d.padding,c.x+=d.left,c.y+=d.top,this.th(a,"position",c,a.position,!1)):this.th(a,"position",new J(c.x+c.width/2,c.y+c.height/2),a.position,!1);this.th(a,"scale",.01,a.scale,!1);if(a instanceof xg)for(a=a.memberParts;a.next();)d=a.value,d instanceof V&&this.Rp(d,b)}};
t.Qp=function(a,b){if(a.isVisible()&&this.pi&&(this.de.contains("Collapse Tree")||this.de.contains("Collapse SubGraph"))){var c=null;b instanceof xg&&(c=b.placeholder);null!==c?this.th(a,"position:placeholder",a.position,c,!0):this.th(a,"position:node",a.position,b,!0);this.th(a,"scale",a.scale,.01,!0);this.sb&&(c=this.Bj,c.contains(a)&&(c.K(a).ut=!0));if(a instanceof xg)for(a=a.memberParts;a.next();)c=a.value,c instanceof V&&this.Qp(c,b)}};
function ti(a,b,c){a.sb&&!b.A(c)&&(null===a.wn&&b.o()&&null===a.vn&&(a.wn=b.copy()),a.vn=c.copy(),a.Fk=!0)}function ui(a,b,c){a.sb&&a.D.Ui&&(0===a.yn&&0===a.xn&&(a.yn=b),a.xn=c,a.Fk=!0)}
function di(){var a=new Ub;a.add("position",function(a,c,d,e,f,g){f!==g?a.Bt(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,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:placeholder",function(a,c,d,e,f,g){f!==g?a.Bt(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,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: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.Bt(e(f,c.x,d-c.x,g),e(f,
c.y,b-c.y,g)):a.position=new J(e(f,c.x,d-c.x,g),e(f,c.y,b-c.y,g))});a.add("opacity",function(a,c,d,e,f,g){a.opacity=e(f,c,d-c,g)});a.add("scale",function(a,c,d,e,f,g){a.scale=e(f,c,d-c,g)});a.add("angle",function(a,c,d,e,f,g){a.angle=e(f,c,d-c,g)});a.add("visible",function(a,c,d,e,f,g){a.visible=f!==g?c:d});ri=a}
na.Object.defineProperties(bi.prototype,{animationReasons:{configurable:!0,get:function(){return this.de}},isEnabled:{configurable:!0,get:function(){return this.Fc},set:function(a){z(a,"boolean",bi,"isEnabled");this.Fc=a}},duration:{configurable:!0,get:function(){return this.$t},set:function(a){z(a,"number",bi,"duration");1>a&&Ca(a,">= 1",bi,"duration");this.$t=a}},isAnimating:{configurable:!0,get:function(){return this.Of}},isTicking:{configurable:!0,
enumerable:!0,get:function(){return this.Nr}},isInitial:{configurable:!0,get:function(){return this.Pf},set:function(a){z(a,"boolean",bi,"isInitial");this.Pf=a}}});bi.prototype.stopAnimation=bi.prototype.xd;bi.prototype.addToAnimation=bi.prototype.th;bi.prototype.prepareAnimation=bi.prototype.Tz;bi.prototype.prepareAutomaticAnimation=bi.prototype.Dh;var ri=null,ci=!1;bi.className="AnimationManager";function li(a,b,c){this.start=a;this.end=b;this.cv={};this.Wu=c;this.ut=!1}
li.className="AnimationStates";function vi(){0<arguments.length&&Da(vi);qb(this);this.D=null;this.Ga=new F;this.Wa="";this.mb=1;this.w=!1;this.Fj=this.L=this.Qh=this.Ph=this.Oh=this.Nh=this.Lh=this.Mh=this.Kh=this.Sh=this.Jh=this.Rh=this.Ih=this.Hh=!0;this.l=!1;this.Qo=[]}t=vi.prototype;t.ib=function(a){this.D=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.Ga.iterator;h.next();){var k=h.value;k instanceof xg?e++:k instanceof V?d++:k instanceof T?f++:k instanceof Cf?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.Ga.iterator;a.next();)c=a.value,h+="\n    "+c.toString(),d=c.data,null!==d&&Jb(d)&&(h+=" #"+Jb(d)),c instanceof V?h+=" "+
Wa(d):c instanceof T&&(h+=" "+Wa(c.fromNode)+" "+Wa(c.toNode));return b+" "+this.Ga.count+": "+h};
t.Tb=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);if(!1===this.Fj)return null;E&&!a.o()&&v("findObjectAt: Point must have a real value, not: "+a.toString());var d=!1;null!==this.diagram&&this.diagram.viewportBounds.ea(a)&&(d=!0);for(var e=J.alloc(),f=this.Ga.j,g=f.length;g--;){var h=f[g];if((!0!==d||!1!==Dg(h))&&h.isVisible()&&(e.assign(a),ac(e,h.td),h=h.Tb(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.Ki=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof F||d instanceof H||(d=new H);if(!1===this.Fj)return d;E&&!a.o()&&v("findObjectsAt: Point must have a real value, not: "+a.toString());var e=!1;null!==this.diagram&&this.diagram.viewportBounds.ea(a)&&(e=!0);for(var f=J.alloc(),g=this.Ga.j,h=g.length;h--;){var k=g[h];if((!0!==e||!1!==Dg(k))&&k.isVisible()){f.assign(a);ac(f,k.td);var l=k;k.Ki(f,b,c,d)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||d.add(l))}}J.free(f);return d};
t.rg=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof F||e instanceof H||(e=new H);if(!1===this.Fj)return e;E&&!a.o()&&v("findObjectsIn: Rect must have a real value, not: "+a.toString());var f=!1;null!==this.diagram&&this.diagram.viewportBounds.qf(a)&&(f=!0);for(var g=this.Ga.j,h=g.length;h--;){var k=g[h];if((!0!==f||!1!==Dg(k))&&k.isVisible()){var l=k;k.rg(a,b,c,d,e)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||e.add(l))}}return e};
t.sg=function(a,b,c,d,e,f){void 0===c&&(c=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof F||e instanceof H)f=e;e=!0}f instanceof F||f instanceof H||(f=new H);if(!1===this.Fj)return f;E&&!a.o()&&v("findObjectsNear: Point must have a real value, not: "+a.toString());var g=!1;null!==this.diagram&&this.diagram.viewportBounds.ea(a)&&(g=!0);for(var h=J.alloc(),k=J.alloc(),l=this.Ga.j,m=l.length;m--;){var n=l[m];if((!0!==g||!1!==Dg(n))&&n.isVisible()){h.assign(a);ac(h,n.td);
k.h(a.x+b,a.y);ac(k,n.td);var p=n;n.sg(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.kd=function(a,b){if(this.visible){var c=void 0===b?a.viewportBounds:b;var d=this.Ga.j,e=d.length;a=Qa();b=Qa();for(var f=0;f<e;f++){var g=d[f];g.Hw=f;g instanceof T&&!1===g.Mc||g instanceof Cf&&null!==g.adornedPart||(Lc(g.actualBounds,c,10)?(g.kd(!0),a.push(g)):(g.kd(!1),null!==g.adornments&&0<g.adornments.count&&b.push(g)))}for(c=0;c<a.length;c++)for(d=a[c],wi(d),d=d.adornments;d.next();)e=d.value,e.measure(Infinity,Infinity),e.arrange(),e.kd(!0);for(c=0;c<b.length;c++)d=b[c],d.updateAdornments(),
xi(d,!0);Ta(a);Ta(b)}};t.jc=function(a,b,c){if(this.visible&&0!==this.mb&&(void 0===c&&(c=!0),c||!this.isTemporary)){c=this.Ga.j;var d=c.length;if(0!==d){1!==this.mb&&(a.globalAlpha=this.mb);var e=this.Qo;e.length=0;for(var f=b.scale,g=0;g<d;g++){var h=c[g];if(Dg(h)){if(h instanceof T&&(h.isOrthogonal&&e.push(h),!1===h.Mc))continue;var k=h.actualBounds;k.width*f>b.re||k.height*f>b.re?h.jc(a,b):yi(a,h)}}a.globalAlpha=1}}};
function yi(a,b){var c=b.actualBounds,d=b.naturalBounds;if(0!==c.width&&0!==c.height&&!isNaN(c.x)&&!isNaN(c.y)&&b.isVisible()){var e=b.transform;null!==b.areaBackground&&(zi(b,a,b.areaBackground,!0,!0,d,c),a.fillRect(c.x,c.y,c.width,c.height));null===b.areaBackground&&null===b.background&&(zi(b,a,"rgba(0,0,0,0.3)",!0,!1,d,c),a.fillRect(c.x,c.y,c.width,c.height));null!==b.background&&(a.transform(e.m11,e.m12,e.m21,e.m22,e.dx,e.dy),zi(b,a,b.background,!0,!1,d,c),a.fillRect(0,0,d.width/2,d.height/2),
e.it()||(b=1/(e.m11*e.m22-e.m12*e.m21),a.transform(e.m22*b,-e.m12*b,-e.m21*b,e.m11*b,b*(e.m21*e.dy-e.m22*e.dx),b*(e.m12*e.dx-e.m11*e.dy))))}}t.g=function(a,b,c,d,e){var f=this.diagram;null!==f&&f.cb(of,a,this,b,c,d,e)};t.Si=function(a,b,c){var d=this.Ga;b.ii=this;if(a>=d.count)a=d.count;else if(d.O(a)===b)return-1;d.Lb(a,b);b.hq(c);d=this.diagram;null!==d&&(c?d.S():d.Si(b));Ai(this,a,b);return a};
t.zc=function(a,b,c){if(!c&&b.layer!==this&&null!==b.layer)return b.layer.zc(a,b,c);var d=this.Ga;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.iq(c);d.nb(a);d=this.diagram;null!==d&&(c?d.S():d.zc(b));b.ii=null;return a};
function Ai(a,b,c){b=Bi(a,b,c);if(c instanceof xg&&null!==c&&isNaN(c.zOrder)){if(0!==c.memberParts.count){for(var d=-1,e=a.Ga.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.Ga,e.nb(b),e.Lb(d,c))}c=c.containingGroup;null!==c&&Ai(a,-1,c)}}
function Bi(a,b,c){var d=c.zOrder;if(isNaN(d))return b;a=a.Ga;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.nb(b);a.Lb(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.nb(b);a.Lb(h,c);return h}for(k=NaN;++h<
e&&(k=a.O(h).zOrder,isNaN(k)););}return b}t.clear=function(){for(var a=this.Ga.Oa(),b=a.length,c=0;c<b;c++)a[c].kd(!1),this.zc(-1,a[c],!1);this.Qo.length=0};
na.Object.defineProperties(vi.prototype,{parts:{configurable:!0,get:function(){return this.Ga.iterator}},partsBackwards:{configurable:!0,get:function(){return this.Ga.iteratorBackwards}},diagram:{configurable:!0,get:function(){return this.D}},name:{configurable:!0,get:function(){return this.Wa},set:function(a){z(a,"string",vi,"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.Ga.iterator;a.next();)a.value.layerName=this.Wa}}},opacity:{configurable:!0,get:function(){return this.mb},set:function(a){var b=this.mb;b!==a&&(z(a,"number",vi,"opacity"),(0>a||1<a)&&Ca(a,"0 <= value <= 1",vi,"opacity"),this.mb=a,this.g("opacity",b,a),a=this.diagram,null!==a&&a.S())}},isTemporary:{configurable:!0,get:function(){return this.w},
set:function(a){var b=this.w;b!==a&&(z(a,"boolean",vi,"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){z(a,"boolean",vi,"visible");this.L=a;this.g("visible",b,a);for(b=this.Ga.iterator;b.next();)b.value.Ob(a);a=this.diagram;null!==a&&a.S()}}},pickable:{configurable:!0,get:function(){return this.Fj},set:function(a){var b=this.Fj;b!==a&&(z(a,"boolean",vi,"pickable"),this.Fj=
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.Ya())}},allowCopy:{configurable:!0,get:function(){return this.Hh},set:function(a){var b=this.Hh;b!==a&&(z(a,"boolean",vi,"allowCopy"),this.Hh=a,this.g("allowCopy",b,a))}},allowDelete:{configurable:!0,get:function(){return this.Ih},set:function(a){var b=this.Ih;b!==a&&(z(a,"boolean",vi,"allowDelete"),
this.Ih=a,this.g("allowDelete",b,a))}},allowTextEdit:{configurable:!0,get:function(){return this.Rh},set:function(a){var b=this.Rh;b!==a&&(z(a,"boolean",vi,"allowTextEdit"),this.Rh=a,this.g("allowTextEdit",b,a))}},allowGroup:{configurable:!0,get:function(){return this.Jh},set:function(a){var b=this.Jh;b!==a&&(z(a,"boolean",vi,"allowGroup"),this.Jh=a,this.g("allowGroup",b,a))}},allowUngroup:{configurable:!0,get:function(){return this.Sh},set:function(a){var b=
this.Sh;b!==a&&(z(a,"boolean",vi,"allowUngroup"),this.Sh=a,this.g("allowUngroup",b,a))}},allowLink:{configurable:!0,get:function(){return this.Kh},set:function(a){var b=this.Kh;b!==a&&(z(a,"boolean",vi,"allowLink"),this.Kh=a,this.g("allowLink",b,a))}},allowRelink:{configurable:!0,get:function(){return this.Mh},set:function(a){var b=this.Mh;b!==a&&(z(a,"boolean",vi,"allowRelink"),this.Mh=a,this.g("allowRelink",b,a))}},allowMove:{configurable:!0,get:function(){return this.Lh},
set:function(a){var b=this.Lh;b!==a&&(z(a,"boolean",vi,"allowMove"),this.Lh=a,this.g("allowMove",b,a))}},allowReshape:{configurable:!0,get:function(){return this.Nh},set:function(a){var b=this.Nh;b!==a&&(z(a,"boolean",vi,"allowReshape"),this.Nh=a,this.g("allowReshape",b,a))}},allowResize:{configurable:!0,get:function(){return this.Oh},set:function(a){var b=this.Oh;b!==a&&(z(a,"boolean",vi,"allowResize"),this.Oh=a,this.g("allowResize",b,a))}},allowRotate:{configurable:!0,
enumerable:!0,get:function(){return this.Ph},set:function(a){var b=this.Ph;b!==a&&(z(a,"boolean",vi,"allowRotate"),this.Ph=a,this.g("allowRotate",b,a))}},allowSelect:{configurable:!0,get:function(){return this.Qh},set:function(a){var b=this.Qh;b!==a&&(z(a,"boolean",vi,"allowSelect"),this.Qh=a,this.g("allowSelect",b,a))}}});vi.prototype.findObjectsNear=vi.prototype.sg;vi.prototype.findObjectsIn=vi.prototype.rg;vi.prototype.findObjectsAt=vi.prototype.Ki;vi.prototype.findObjectAt=vi.prototype.Tb;
vi.className="Layer";
function P(a){function b(){c.removeEventListener(ra.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.");Ci||(Di(),Ci=!0);qb(this);yf=this;bb=[];this.pb=!0;this.Ek=new bi;this.Ek.ib(this);this.Jb=17;this.Xn=!1;this.xu="default";this.Ja=null;var c=this;Ih&&(null!==ra.document.body?this.setRTL():c.addEventListener(ra.document,"DOMContentLoaded",b,!1));this.Ra=new F;this.ya=this.Aa=0;this.Ea=null;
this.vu=new Ub;this.gg=this.$c=null;this.Lv();this.il=null;this.Kv();this.ua=(new J(NaN,NaN)).freeze();this.kr=this.Da=1;this.Er=(new J(NaN,NaN)).freeze();this.Fr=NaN;this.Zr=1E-4;this.Xr=100;this.ub=new $b;this.Os=(new J(NaN,NaN)).freeze();this.vr=(new L(NaN,NaN,NaN,NaN)).freeze();this.vi=(new Hc(0,0,0,0)).freeze();this.Kj=Ei;this.ys=!1;this.ts=this.ps=null;this.ej=Fi;this.gj=Qd;this.di=Fi;this.Sn=Qd;this.Gr=this.Dr=fd;this.oc=!0;this.Tn=!1;this.Fd=new H;this.Zh=new Ub;this.Bn=!0;this.Xm=250;this.Gk=
-1;this.Ym=(new Hc(16,16,16,16)).freeze();this.Wk=this.sd=!1;this.bl=!0;this.$h=new kf;this.$h.diagram=this;this.af=new kf;this.af.diagram=this;this.uj=new kf;this.uj.diagram=this;this.se=this.Df=null;this.Rl=!1;this.Wt=this.Xt=null;this.Sq=ra.PointerEvent&&(gb||ib||jb)&&ra.navigator&&!1!==ra.navigator.msPointerEnabled;Gi(this);this.Bi=new H;this.Or=!0;this.Js=Hi;this.Xb=!1;this.Ls=Jg;this.Na=null;Ii.add("Model",Ji);this.ca=this.Ma=this.Wb=null;this.dr="";this.un="auto";this.Vf=this.cs=this.Xf=this.Yf=
this.$f=this.Ff=this.Jf=this.Ef=null;this.Ar=!1;this.Gf=this.lg=this.Zf=this.Wf=null;this.qu=!1;this.tu={};this.Al=[null,null];this.L=null;this.Vt=this.Cu=this.Fh=this.fh=!1;this.Oc=!0;this.qj=this.$b=!1;this.ac=null;var d=this;this.Bg=function(a){var b=d.partManager;if(a.model===b.diagram.model&&b.diagram.fa){b.diagram.fa=!1;try{var c=a.change;""===a.modelChange&&c===of&&b.updateDataBindings(a.object,a.propertyName)}finally{b.diagram.fa=!0}}};this.Hm=function(a){d.partManager.doModelChanged(a)};
this.Uw=!0;this.je=-2;this.Gj=new Ub;this.su=new F;this.Qf=!1;this.Ih=this.Hh=this.Kq=this.Fc=!0;this.Lq=!1;this.Rq=this.Pq=this.Qh=this.Ph=this.Oh=this.Nh=this.Lh=this.Mh=this.Kh=this.Oq=this.Sh=this.Jh=this.Rh=this.Mq=!0;this.Te=this.Nc=!1;this.Qq=this.Nq=this.Cr=this.Br=!0;this.xs=this.vs=16;this.zu=this.us=!1;this.mp=this.ws=null;this.Au=this.Bu=0;this.gb=(new Hc(5)).freeze();this.Iq=(new H).freeze();this.Yr=999999999;this.Gq=(new H).freeze();this.ei=this.oj=this.Tg=!0;this.bi=this.Sg=!1;this.ic=
null;this.Eg=!0;this.ke=!1;this.Hq=new H;this.Fw=new H;this.Qb=null;this.Oo=1;this.Ow=0;this.Be={scale:1,position:new J,bounds:new L,xx:!1};this.Tw=(new L(NaN,NaN,NaN,NaN)).freeze();this.Lp=(new Zb(NaN,NaN)).freeze();this.zn=(new L(NaN,NaN,NaN,NaN)).freeze();this.Pr=!1;this.pr=null;Ki(this);this.Ur=this.yr=this.fs=this.xw=this.ww=this.yw=this.Wg=this.ai=this.ag=null;Li(this);this.Hb=null;this.xr=!1;this.Ok=null;this.partManager=new Ji;this.toolManager=new $a;this.toolManager.initializeStandardTools();
this.currentTool=this.defaultTool=this.toolManager;this.nr=null;this.Qk=new Lf;this.ks=this.js=null;this.Cp=!1;this.commandHandler=Mi();this.model=Ni();this.fh=!0;this.layout=new Oi;this.fh=!1;this.Aw=this.Zt=null;this.Pb=1;this.kh=null;this.re=1;this.Ao=0;this.Bo=[0,0,0,0,0];this.Co=0;this.Hd=1;this.pl=0;this.Rr=new J;this.Hu=500;this.Tq=new J;this.Ue=!1;this.preventDefault=this.tt=this.pm=this.qm=this.om=this.nm=this.nk=this.qk=this.pk=this.lk=this.mk=this.gw=this.Zv=this.$v=this.aw=this.ui=this.hp=
this.ti=this.gp=null;this.w=!1;this.ci=new Pi;this.Gs=!1;void 0!==a&&Qi(this,a);this.pb=!1}P.prototype.clear=function(){this.model.clear();Ri=null;Si="";Ti(this,!1);this.zn=(new L(NaN,NaN,NaN,NaN)).freeze();this.S()};
function Ti(a,b){var c=null;null!==a.Hb&&(c=a.Hb.part);a.animationManager.xd();for(var d=[],e=a.Ra.length,f=0;f<e;f++){var g=a.Ra.j[f];if(b)for(var h=g.parts;h.next();){var k=h.value;k!==c&&null===k.data&&d.push(k)}g.clear()}a.partManager.clear();a.Fd.clear();a.Zh.clear();a.Bi.clear();a.Vp();a.Ru();a.Ok=null;Ra=[];null!==c&&(a.add(c),a.partManager.parts.remove(c));if(b)for(b=0;b<d.length;b++)a.add(d[b])}function Mi(){return null}
P.prototype.reset=function(){this.pb=!0;this.clear();this.Ek=new bi;this.Ek.ib(this);this.Ra=new F;this.Lv();this.Kv();this.ua=(new J(NaN,NaN)).freeze();this.Da=1;this.Er=(new J(NaN,NaN)).freeze();this.Fr=NaN;this.Zr=1E-4;this.Xr=100;this.Os=(new J(NaN,NaN)).freeze();this.vr=(new L(NaN,NaN,NaN,NaN)).freeze();this.vi=(new Hc(0,0,0,0)).freeze();this.Kj=Ei;this.ys=!1;this.ts=this.ps=null;this.ej=Fi;this.gj=Qd;this.di=Fi;this.Sn=Qd;this.Gr=this.Dr=fd;this.Xm=250;this.Ym=(new Hc(16,16,16,16)).freeze();
this.Or=!0;this.Js=Hi;this.Ls=Jg;this.un="auto";this.Vf=this.cs=this.Xf=this.Yf=this.$f=this.Ff=this.Jf=this.Ef=null;this.Ar=!1;this.Gf=this.lg=this.Zf=this.Wf=null;this.Qf=!1;this.Ih=this.Hh=this.Kq=this.Fc=!0;this.Lq=!1;this.Qq=this.Nq=this.Cr=this.Br=this.Rq=this.Pq=this.Qh=this.Ph=this.Oh=this.Nh=this.Lh=this.Mh=this.Kh=this.Oq=this.Sh=this.Jh=this.Rh=this.Mq=!0;this.xs=this.vs=16;this.gb=(new Hc(5)).freeze();this.Yr=999999999;this.ic=null;this.Pr=!1;this.Pb=1;this.kh=null;this.Ao=0;this.Bo=[0,
0,0,0,0];this.Co=0;Li(this);this.Hb=null;this.partManager=new Ji;this.toolManager=new $a;this.toolManager.initializeStandardTools();this.ks=this.js=this.nr=null;this.Cp=!1;this.Qk.reset();this.vu=new Ub;this.vu.clear();this.currentTool=this.defaultTool=this.toolManager;this.commandHandler=Mi();this.fh=!0;Ki(this);this.layout=new Oi;this.fh=!1;this.model=Ni();this.model.undoManager=new tf;this.ke=!1;this.bl=!0;this.pb=this.sd=!1;this.S();this.se=this.Df=null;Gi(this);this.dr=""};
function Li(a){a.ag=new Ub;var b=new V,c=new Kh;c.bind(new Ui("text","",Wa));b.add(c);a.yw=b;a.ag.add("",b);b=new V;c=new Kh;c.stroke="brown";c.bind(new Ui("text","",Wa));b.add(c);a.ag.add("Comment",b);b=new V;b.selectable=!1;b.avoidable=!1;c=new Hg;c.figure="Ellipse";c.fill="black";c.stroke=null;c.desiredSize=(new Zb(3,3)).ia();b.add(c);a.ag.add("LinkLabel",b);a.ai=new Ub;b=new xg;b.selectionObjectName="GROUPPANEL";b.type=W.Vertical;c=new Kh;c.font="bold 12pt sans-serif";c.bind(new Ui("text","",
Wa));b.add(c);c=new W(W.Auto);c.name="GROUPPANEL";var d=new Hg;d.figure="Rectangle";d.fill="rgba(128,128,128,0.2)";d.stroke="black";c.add(d);d=new lh;d.padding=(new Hc(5,5,5,5)).ia();c.add(d);b.add(c);a.ww=b;a.ai.add("",b);a.Wg=new Ub;b=new T;c=new Hg;c.isPanelMain=!0;b.add(c);c=new Hg;c.toArrow="Standard";c.fill="black";c.stroke=null;c.strokeWidth=0;b.add(c);a.xw=b;a.Wg.add("",b);b=new T;c=new Hg;c.isPanelMain=!0;c.stroke="brown";b.add(c);a.Wg.add("Comment",b);b=new Cf;b.type=W.Auto;c=new Hg;c.fill=
null;c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);c=new lh;c.margin=(new Hc(1.5,1.5,1.5,1.5)).ia();b.add(c);a.fs=b;a.yr=b;b=new Cf;b.type=W.Link;c=new Hg;c.isPanelMain=!0;c.fill=null;c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);a.Ur=b}
P.prototype.setRTL=function(a){a=void 0===a?this.div:a;null===a&&(a=ra.document.body);var b=ya("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.xu=c};
P.prototype.setScrollWidth=function(a){a=void 0===a?this.div:a;null===a&&(a=ra.document.body);var b=0;if(Ih){var c=Vi;b=Wi;null===c&&(c=Vi=ya("p"),c.style.width="100%",c.style.height="200px",c.style.boxSizing="content-box",b=Wi=ya("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||lb||(b=11)}this.Jb=b};P.prototype.hb=function(a){a.classType===P?this.autoScale=a:Fa(this,a)};P.prototype.toString=function(a){void 0===a&&(a=0);var b="";this.div&&this.div.id&&(b=this.div.id);b='Diagram "'+b+'"';if(0>=a)return b;for(var c=this.Ra.iterator;c.next();)b+="\n  "+c.value.toString(a-1);return b};P.prototype.addEventListener=function(a,b,c,d){a.addEventListener(b,c,d)};
P.prototype.removeEventListener=function(a,b,c,d){a.removeEventListener(b,c,d)};
function Xi(a){var b=a.Ea.Ha;b instanceof HTMLCanvasElement&&(a.Sq?(a.addEventListener(b,"pointerdown",a.nm,!1),a.addEventListener(b,"pointermove",a.om,!1),a.addEventListener(b,"pointerup",a.qm,!1),a.addEventListener(b,"pointerout",a.pm,!1)):(a.addEventListener(b,"touchstart",a.aw,!1),a.addEventListener(b,"touchmove",a.$v,!1),a.addEventListener(b,"touchend",a.Zv,!1),a.addEventListener(b,"mousemove",a.mk,!1),a.addEventListener(b,"mousedown",a.lk,!1),a.addEventListener(b,"mouseup",a.pk,!1),a.addEventListener(b,
"mouseout",a.nk,!1)),a.addEventListener(b,"mouseenter",a.Ly,!1),a.addEventListener(b,"mouseleave",a.My,!1),a.addEventListener(b,"wheel",a.qk,!1),a.addEventListener(b,"keydown",a.Gz,!1),a.addEventListener(b,"keyup",a.Hz,!1),a.addEventListener(b,"blur",a.yy,!1),a.addEventListener(b,"focus",a.zy,!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!==
Ff&&(a.toolManager.gestureBehavior===Ef?b.preventDefault():a.Ue&&a.lastInput.handled||(b.preventDefault(),a.Oo=a.scale,a.currentTool.doCancel()))},!1),a.addEventListener(b,"gesturechange",function(b){if(a.toolManager.gestureBehavior!==Ff)if(a.toolManager.gestureBehavior===Ef)b.preventDefault();else if(!a.Ue||!a.lastInput.handled){b.preventDefault();var c=b.scale;if(null!==a.Oo){var e=a.Ea.getBoundingClientRect();b=new J(b.pageX-window.scrollX-a.Aa/e.width*e.left,b.pageY-window.scrollY-a.ya/e.height*
e.top);c=a.Oo*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(ra,"resize",a.gw,!1))}function Yf(a){30<a.Ao&&(a.kh=1)}function hg(a,b){null!==a.kh&&(a.kh=null,b&&a.tt(),a.Ao=0,a.Bo=[0,0,0,0,0],a.Co=0)}P.prototype.computePixelRatio=function(){return null!==this.kh?this.kh:ra.devicePixelRatio||1};P.prototype.doMouseMove=function(){this.currentTool.doMouseMove()};P.prototype.doMouseDown=function(){this.currentTool.doMouseDown()};
P.prototype.doMouseUp=function(){this.currentTool.doMouseUp()};P.prototype.doMouseWheel=function(){this.currentTool.doMouseWheel()};P.prototype.doKeyDown=function(){this.currentTool.doKeyDown()};P.prototype.doKeyUp=function(){this.currentTool.doKeyUp()};P.prototype.doFocus=function(){this.focus()};P.prototype.focus=function(){if(this.Ea)if(this.scrollsPageOnFocus)this.Ea.focus();else{var a=ra.scrollX||ra.pageXOffset,b=ra.scrollY||ra.pageYOffset;this.Ea.focus();ra.scrollTo(a,b)}};P.prototype.zy=function(){this.D.ba("GainedFocus")};
P.prototype.yy=function(){this.D.ba("LostFocus")};function ii(a){if(null!==a.Ea){var b=a.Ja;if(0!==b.clientWidth&&0!==b.clientHeight){a.setScrollWidth();var c=a.bi?a.Jb:0,d=a.Sg?a.Jb:0,e=a.Pb;a.Pb=a.computePixelRatio();a.Pb!==e&&(a.Tn=!0,a.ec());if(b.clientWidth!==a.Aa+c||b.clientHeight!==a.ya+d)a.oj=!0,a.oc=!0,b=a.layout,null!==b&&b.isViewportSized&&a.autoScale===Fi&&(a.Wk=!0,b.C()),a.$b||a.ec()}}}
function Ki(a){var b=new vi;b.name="Background";a.Vl(b);b=new vi;b.name="";a.Vl(b);b=new vi;b.name="Foreground";a.Vl(b);b=new vi;b.name="Adornment";b.isTemporary=!0;a.Vl(b);b=new vi;b.name="Tool";b.isTemporary=!0;b.isBoundsIncluded=!0;a.Vl(b);b=new vi;b.name="Grid";b.allowSelect=!1;b.pickable=!1;b.isTemporary=!0;a.Xw(b,a.dm("Background"))}
function Yi(a){a.Hb=new W(W.Grid);a.Hb.name="GRID";var b=new Hg;b.figure="LineH";b.stroke="lightgray";b.strokeWidth=.5;b.interval=1;a.Hb.add(b);b=new Hg;b.figure="LineH";b.stroke="gray";b.strokeWidth=.5;b.interval=5;a.Hb.add(b);b=new Hg;b.figure="LineH";b.stroke="gray";b.strokeWidth=1;b.interval=10;a.Hb.add(b);b=new Hg;b.figure="LineV";b.stroke="lightgray";b.strokeWidth=.5;b.interval=1;a.Hb.add(b);b=new Hg;b.figure="LineV";b.stroke="gray";b.strokeWidth=.5;b.interval=5;a.Hb.add(b);b=new Hg;b.figure=
"LineV";b.stroke="gray";b.strokeWidth=1;b.interval=10;a.Hb.add(b);b=new U;b.add(a.Hb);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.Hb.visible=!1}function Zi(){this.D.zu?this.D.zu=!1:this.D.isEnabled?this.D.jx(this):cj(this.D)}function dj(a){this.D.isEnabled?(this.D.Bu=a.target.scrollTop,this.D.Au=a.target.scrollLeft):cj(this.D)}
P.prototype.jx=function(a){if(null!==this.Ea){this.us=!0;var b=this.documentBounds,c=this.viewportBounds,d=this.vi,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,q=c.bottom;c=this.scale;var r=a.scrollLeft;if(this.Xn)switch(this.xu){case "negative":r=r+a.scrollWidth-a.clientWidth;break;case "reverse":r=a.scrollWidth-r-a.clientWidth}var u=r;m<g||n<h?(r=J.allocAt(this.position.x,this.position.y),
this.allowHorizontalScroll&&this.Au!==u&&(r.x=u/c+e,this.Au=u),this.allowVerticalScroll&&this.Bu!==a.scrollTop&&(r.y=a.scrollTop/c+f,this.Bu=a.scrollTop),this.position=r,J.free(r),this.oj=this.us=!1):(r=J.alloc(),a.ey&&this.allowHorizontalScroll&&(e<l&&(this.position=r.h(u+e,this.position.y)),k>p&&(this.position=r.h(-(this.ws.scrollWidth-this.Aa)+u-this.Aa/c+k,this.position.y))),a.gy&&this.allowVerticalScroll&&(f<b&&(this.position=r.h(this.position.x,a.scrollTop+f)),d>q&&(this.position=r.h(this.position.x,
-(this.ws.scrollHeight-this.ya)+a.scrollTop-this.ya/c+d))),J.free(r),ej(this),this.oj=this.us=!1,b=this.documentBounds,c=this.viewportBounds,k=b.right,p=c.right,d=b.bottom,q=c.bottom,e=b.x,l=c.x,f=b.y,b=c.y,m>=g&&e>=l&&k<=p&&(this.mp.style.width="1px"),n>=h&&f>=b&&d<=q&&(this.mp.style.height="1px"))}};P.prototype.computeBounds=function(){0<this.Fd.count&&fj(this);return gj(this)};
function gj(a){if(a.fixedBounds.o()){var b=a.fixedBounds.copy();b.Sp(a.gb);return b}for(var c=!0,d=a.Ra.j,e=d.length,f=0;f<e;f++){var g=d[f];if(g.visible&&(!g.isTemporary||g.isBoundsIncluded)){g=g.Ga.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.Lc(l)))}}}c&&(b=new L(0,0,0,0));b.Sp(a.gb);return b}
P.prototype.computePartsBounds=function(a,b){void 0===b&&(b=!1);var c=null;if(Ka(a))for(var d=0;d<a.length;d++){var e=a[d];!b&&e instanceof T||(e.bc(),null===c?c=e.actualBounds.copy():c.Lc(e.actualBounds))}else for(a=a.iterator;a.next();)d=a.value,!b&&d instanceof T||(d.bc(),null===c?c=d.actualBounds.copy():c.Lc(d.actualBounds));return null===c?new L(NaN,NaN,0,0):c};
function hj(a,b){if((b||a.ke)&&!a.pb&&null!==a.Ea&&!a.animationManager.isAnimating&&a.documentBounds.o()){a.pb=!0;var c=a.ej;b&&a.di!==Fi&&(c=a.di);var d=c!==Fi?ij(a,c):a.scale;c=a.viewportBounds.copy();var e=a.Aa/d,f=a.ya/d,g=null,h=a.animationManager;h.sb&&(g=a.ua.copy());var k=a.gj,l=a.Sn;b&&!k.Za()&&(l.Za()||l.Cb())&&(k=l.Cb()?qd:l);jj(a,a.documentBounds,e,f,k,b);null!==g&&ti(h,g,a.ua);b=a.scale;a.scale=d;a.pb=!1;d=a.viewportBounds;d.Sa(c)||a.sq(c,d,b,!1)}}
function ij(a,b){var c=a.kr;if(null===a.Ea)return c;a.Tg&&kj(a,a.computeBounds());var d=a.documentBounds;if(!d.o())return c;var e=d.width;d=d.height;var f=a.Aa,g=a.ya,h=f/e,k=g/d;return b===lj?(b=Math.min(k,h),b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):b===mj?(b=k>h?(g-a.Jb)/d:(f-a.Jb)/e,b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):a.scale}
P.prototype.zoomToFit=function(){var a=this.Kj;this.Kj=Ei;this.scale=ij(this,lj);a!==Ei&&(hj(this,!1),jj(this,this.documentBounds,this.Aa/this.Da,this.ya/this.Da,this.gj,!1));this.Kj=a};t=P.prototype;
t.mA=function(a,b){void 0===b&&(b=lj);var c=a.width,d=a.height;if(!(0===c||0===d||isNaN(c)&&isNaN(d))){var e=1;if(b===lj||b===mj)if(isNaN(c))e=this.viewportBounds.height*this.scale/d;else if(isNaN(d))e=this.viewportBounds.width*this.scale/c;else{e=this.Aa;var f=this.ya;e=b===mj?f/d>e/c?(f-(this.Sg?this.Jb:0))/d:(e-(this.bi?this.Jb:0))/c:Math.min(f/d,e/c)}this.scale=e;this.position=new J(a.x,a.y)}};
t.sy=function(a,b){this.Tg&&kj(this,this.computeBounds());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))};
function jj(a,b,c,d,e,f){a.ua.ja();var g=a.ua,h=g.x,k=g.y;if(f||a.scrollMode===Ei)e.Za()&&(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.vi,f=c-b.width,c<b.width+e.left+e.right?(h=Math.min(h+c/2,b.right+Math.max(f,e.right)-c/2),h=Math.max(h,b.left-Math.max(f,e.left)+c/2),h-=c/2):h>b.left?h=b.left:h<b.right-c&&(h=b.right-c),c=d-b.height,d<b.height+e.top+e.bottom?(k=Math.min(k+d/2,b.bottom+Math.max(c,e.bottom)-d/2),k=
Math.max(k,b.top-Math.max(c,e.top)+d/2),k-=d/2):k>b.top?k=b.top:k<b.bottom-d&&(k=b.bottom-d);g.x=isFinite(h)?h:-a.gb.left;g.y=isFinite(k)?k:-a.gb.top;null!==a.positionComputation&&(b=a.positionComputation(a,g),g.x=b.x,g.y=b.y);a.ua.freeze()}t.em=function(a,b){void 0===b&&(b=!0);if(b){if(a=vg(this,a,function(a){return a.part},function(a){return a.canSelect()}),a instanceof U)return a}else if(a=vg(this,a,function(a){return a.part}),a instanceof U)return a;return null};
t.Tb=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);fj(this);for(var d=this.Ra.iteratorBackwards;d.next();){var e=d.value;if(e.visible&&(e=e.Tb(a,b,c),null!==e))return e}return null};function vg(a,b,c,d){void 0===c&&(c=null);void 0===d&&(d=null);fj(a);for(a=a.Ra.iteratorBackwards;a.next();){var e=a.value;if(e.visible&&!e.isTemporary&&(e=e.Tb(b,c,d),null!==e))return e}return null}
t.Zy=function(a,b,c){void 0===b&&(b=!0);return nj(this,a,function(a){return a.part},b?function(a){return a instanceof U&&a.canSelect()}:null,c)};function nj(a,b,c,d,e){void 0===c&&(c=null);void 0===d&&(d=null);e instanceof F||e instanceof H||(e=new H);fj(a);for(a=a.Ra.iteratorBackwards;a.next();){var f=a.value;f.visible&&!f.isTemporary&&f.Ki(b,c,d,e)}return e}
t.Ki=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof F||d instanceof H||(d=new H);fj(this);for(var e=this.Ra.iteratorBackwards;e.next();){var f=e.value;f.visible&&f.Ki(a,b,c,d)}return d};t.px=function(a,b,c,d){void 0===b&&(b=!1);void 0===c&&(c=!0);return oj(this,a,function(a){return a instanceof U&&(!c||a.canSelect())},b,d)};
t.rg=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof F||e instanceof H||(e=new H);fj(this);for(var f=this.Ra.iteratorBackwards;f.next();){var g=f.value;g.visible&&g.rg(a,b,c,d,e)}return e};function oj(a,b,c,d,e){var f=null;void 0===f&&(f=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof F||e instanceof H||(e=new H);fj(a);for(a=a.Ra.iteratorBackwards;a.next();){var g=a.value;g.visible&&!g.isTemporary&&g.rg(b,f,c,d,e)}return e}
t.$y=function(a,b,c,d,e){void 0===c&&(c=!0);void 0===d&&(d=!0);return pj(this,a,b,function(a){return a instanceof U&&(!d||a.canSelect())},c,e)};t.sg=function(a,b,c,d,e,f){void 0===c&&(c=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof F||e instanceof H)f=e;e=!0}f instanceof F||f instanceof H||(f=new H);fj(this);for(var g=this.Ra.iteratorBackwards;g.next();){var h=g.value;h.visible&&h.sg(a,b,c,d,e,f)}return f};
function pj(a,b,c,d,e,f){var g=null;void 0===g&&(g=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof F||e instanceof H)f=e;e=!0}f instanceof F||f instanceof H||(f=new H);fj(a);for(a=a.Ra.iteratorBackwards;a.next();){var h=a.value;h.visible&&!h.isTemporary&&h.sg(b,c,g,d,e,f)}return f}P.prototype.acceptEvent=function(a){return qj(this,a,a instanceof MouseEvent)};
function qj(a,b,c){var d=a.af;a.af=a.uj;a.uj=d;d.diagram=a;d.event=b;c?rj(a,b,d):(d.viewPoint=a.af.viewPoint,d.documentPoint=a.af.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||fb||(d.buttons=b.buttons);kb&&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=sj(b);d.targetObject=null;return d}
function sj(a){var b=a.target.D;if(!b){var c=a.path;c||"function"!==typeof a.composedPath||(c=a.composedPath());c&&c[0]&&(b=c[0].D)}return b?b:null}function tj(a,b,c,d){var e=uj(a,b,!0,!1,!0,d);rj(a,c,e);e.targetDiagram=sj(b);e.targetObject=null;d||e.clone(a.$h);return e}
function vj(a,b,c,d){var e;d=uj(a,b,!1,!1,!1,d);null!==c?((e=ra.document.elementFromPoint(c.clientX,c.clientY))&&e.D?(b=c,c=e.D):(b=void 0!==b.targetTouches?b.targetTouches[0]:b,c=a),d.targetDiagram=c,rj(a,b,d)):null!==a.af?(d.documentPoint=a.af.documentPoint,d.viewPoint=a.af.viewPoint,d.targetDiagram=a.af.targetDiagram):null!==a.$h&&(d.documentPoint=a.$h.documentPoint,d.viewPoint=a.$h.viewPoint,d.targetDiagram=a.$h.targetDiagram);d.targetObject=null;return d}
function uj(a,b,c,d,e,f){var g=a.af;a.af=a.uj;a.uj=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.Sq&&b instanceof ra.PointerEvent&&"touch"!==b.pointerType&&(g.button=b.button,void 0===b.buttons||fb||(g.buttons=b.buttons),kb&&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 wj(a,b,c){if(b.bubbles)return E&&E.ux&&Ha("NOT handled "+c.type+" "+b.toString()),!0;E&&E.ux&&Ha("handled "+c.type+" "+a.currentTool.name+" "+b.toString());void 0!==c.stopPropagation&&c.stopPropagation();!1!==c.cancelable&&c.preventDefault();c.cancelBubble=!0;return!1}
P.prototype.Gz=function(a){var b=this.D;if(!this.D.isEnabled)return!1;var c=qj(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 wj(b,c,a)};
P.prototype.Hz=function(a){var b=this.D;if(!b.isEnabled)return!1;var c=qj(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 wj(b,c,a)};
P.prototype.Ly=function(a){var b=this.D;if(!b.isEnabled)return!1;var c=qj(b,a,!0);null!==b.mouseEnter&&b.mouseEnter(c);return wj(b,c,a)};P.prototype.My=function(a){var b=this.D;if(!b.isEnabled)return!1;var c=qj(b,a,!0);null!==b.mouseLeave&&b.mouseLeave(c);return wj(b,c,a)};
P.prototype.getMouse=function(a){var b=this.Ea;if(null===b)return new J(0,0);var c=b.getBoundingClientRect();b=a.clientX-this.Aa/c.width*c.left;a=a.clientY-this.ya/c.height*c.top;return null!==this.ub?ac(new J(b,a),this.ub):new J(b,a)};
function rj(a,b,c){var d=a.Ea,e=a.Aa,f=a.ya,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.ub?(b=J.allocAt(g,h),a.ub.Wd(b),c.documentPoint.assign(b),J.free(b)):c.documentPoint.h(g,h)}
function lf(a,b,c,d){if(void 0!==b.targetTouches){if(2>b.targetTouches.length)return;b=b.targetTouches[c]}else if(null!==a.Al[0])b=a.Al[c];else return;c=a.Ea;null!==c&&(c=c.getBoundingClientRect(),d.h(b.clientX-a.Aa/c.width*c.left,b.clientY-a.ya/c.height*c.top))}t=P.prototype;t.Ya=function(){this.Tg||(this.Tg=!0,this.ec(!0))};function si(a){a.$b||fj(a);a.Tg&&kj(a,a.computeBounds())}t.wf=function(){this.pb||this.$b||(this.S(),xj(this),ej(this),this.Ya(),this.hd())};t.Fz=function(){return this.sd};
t.Gy=function(a){void 0===a&&(a=null);var b=this.animationManager,c=b.isEnabled;b.xd();b.isEnabled=!1;Eg(this);this.ke=!1;b.isEnabled=c;null!==a&&wa(a,1)};t.ec=function(a){void 0===a&&(a=!1);if(!0!==this.sd&&!(this.pb||!1===a&&this.$b)){this.sd=!0;var b=this;ra.requestAnimationFrame(function(){b.sd&&b.hd()})}};t.hd=function(){if(!this.bl||this.sd)this.bl&&(this.bl=!1),Eg(this)};function yj(a,b){a.animationManager.isAnimating||a.pb||!a.oj||cj(a)||(b&&fj(a),hj(a,!1))}
function Eg(a,b){if(!a.$b&&(a.sd=!1,null!==a.Ja||a.Lp.o())){a.$b=!0;var c=a.animationManager,d=a.su;if(!c.isTicking&&0!==d.length){for(var e=d.j,f=e.length,g=0;g<f;g++){var h=e[g];zj(h,!1);h.v()}d.clear()}d=a.Fw;0<d.count&&(d.each(function(a){a.fw()}),d.clear());e=d=!1;c.isAnimating&&(e=!0,d=a.skipsUndoManager,a.skipsUndoManager=!0);c.sb||ii(a);yj(a,!1);null!==a.Hb&&(a.Hb.visible&&!a.xr&&(Aj(a),a.xr=!0),!a.Hb.visible&&a.xr&&(a.xr=!1));fj(a);f=!1;if(!a.ke||a.Eg)a.ke?Bj(a,!a.Wk):(a.Ca("Initial Layout"),
!1===c.isEnabled&&c.xd(),Bj(a,!1)),f=!0;a.Wk=!1;fj(a);a.Cu||c.isAnimating||si(a);yj(a,!0);f&&(a.ke||Cj(a),a.ba("LayoutCompleted"));fj(a);f&&!a.ke&&(a.ke=!0,a.ab("Initial Layout"),a.skipsUndoManager||a.undoManager.clear(),wa(function(){a.isModified=!1},1));a.Qu();hi(c);b||a.jc(a.$c);e&&(a.skipsUndoManager=d);a.$b=!1}}
function Cj(a){var b=a.Ra.j;a.kd(b,b.length,a);a.di!==Fi?a.scale=ij(a,a.di):a.ej!==Fi?a.scale=ij(a,a.ej):(b=a.initialScale,isFinite(b)&&0<b&&(a.scale=b));b=a.initialPosition;if(b.o())a.position=b;else{b=J.alloc();b.Yi(a.documentBounds,a.initialDocumentSpot);var c=a.viewportBounds;c=L.allocAt(0,0,c.width,c.height);var d=J.alloc();d.Yi(c,a.initialViewportSpot);d.h(b.x-d.x,b.y-d.y);a.position=d;L.free(c);J.free(d);J.free(b);xj(a);yj(a,!0);hj(a,!0)}a.ba("InitialLayoutCompleted");Aj(a)}
function fj(a){if((a.$b||!a.animationManager.isAnimating)&&0!==a.Fd.count){for(var b=0;23>b;b++){var c=a.Fd.iterator;if(null===c||0===a.Fd.count)break;a.Fd=new H;a.fw(c,a.Fd);E&&22===b&&Ha("failure to validate parts")}a.nodes.each(function(a){a instanceof xg&&0!==(a.T&65536)!==!1&&(a.T=a.T^65536)})}}
t.fw=function(a,b){for(a.reset();a.next();){var c=a.value;!c.dc()||c instanceof xg||(c.Vi()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))}for(a.reset();a.next();)c=a.value,c instanceof xg&&c.isVisible()&&Dj(this,c);for(a.reset();a.next();)c=a.value,c instanceof T&&c.isVisible()&&(c.Vi()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c));for(a.reset();a.next();)c=a.value,c instanceof Cf&&c.isVisible()&&(c.Vi()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))};
function Dj(a,b){for(var c=Qa(),d=Qa(),e=b.memberParts;e.next();){var f=e.value;f.isVisible()&&(f instanceof xg?(Ej(f)||Fj(f)||Gj(f))&&Dj(a,f):f instanceof T?f.fromNode===b||f.toNode===b?d.push(f):c.push(f):(f.measure(Infinity,Infinity),f.arrange()))}a=c.length;for(e=0;e<a;e++)f=c[e],f.measure(Infinity,Infinity),f.arrange();Ta(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();Ta(d)}
t.kd=function(a,b,c,d){if(this.ei||this.animationManager.isAnimating)for(var e=0;e<b;e++)a[e].kd(c,d)};
t.jc=function(a,b){void 0===b&&(b=null);if(null!==this.Ja){null===this.Ea&&v("No canvas specified");var c=this.animationManager;if(!c.sb){var d=new Date;Hj(this);if("0"!==this.Ja.style.opacity){var e=a!==this.$c,f=this.Ra.j,g=f.length,h=this;this.kd(f,g,h);if(e)a.Uc(!0),ej(this);else if(!this.oc&&null===b&&!c.isAnimating)return;g=this.ua;var k=this.Da,l=Math.round(g.x*k)/k,m=Math.round(g.y*k)/k;c=this.ub;c.reset();1!==k&&c.scale(k);0===g.x&&0===g.y||c.translate(-l,-m);k=this.Pb;a.setTransform(1,0,
0,1,0,0);a.scale(k,k);a.clearRect(0,0,this.Aa,this.ya);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);E&&E.Gi&&E.$u&&E.$u(this,a);l=null!==b?function(c){var d=b;if(c.visible&&0!==c.mb){var e=c.Ga.j,f=e.length;if(0!==f){1!==c.mb&&(a.globalAlpha=c.mb);c=c.Qo;c.length=0;for(var g=h.scale,k=0;k<f;k++){var l=e[k];if(Dg(l)&&!d.contains(l)){if(l instanceof T&&(l.isOrthogonal&&c.push(l),!1===l.Mc))continue;var m=l.actualBounds;m.width*g>h.re||m.height*g>h.re?l.jc(a,
h):yi(a,l)}}a.globalAlpha=1}}}:function(b){b.jc(a,h)};Ij(this,a);g=f.length;for(m=0;m<g;m++)a.setTransform(1,0,0,1,0,0),a.scale(k,k),a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy),l(f[m]);this.ci&&Jj(this.ci,this)&&this.pr();E&&(E.av||E.Gi)&&E.Yp&&E.Yp(a,this,c);e?(this.$c.Uc(!0),ej(this)):this.oc=this.ei=!1;e=+new Date-+d;if(null===this.kh){d=this.Bo;d[this.Co]=e;this.Co=(this.Co+1)%d.length;for(f=e=0;f<this.Bo.length;f++)e+=this.Bo[f];this.Ao=e/d.length}}}}};
function Kj(a,b,c,d,e,f,g,h,k,l){if(null!==a.Ja){null===a.Ea&&v("No canvas specified");void 0===g&&(g=null);void 0===h&&(h=null);void 0===k&&(k=!1);void 0===l&&(l=!1);Hj(a);a.$c.Uc(!0);ej(a);a.qj=!0;var m=a.Da;a.Da=e;var n=a.Ra.j,p=n.length;try{var q=new L(f.x,f.y,d.width/e,d.height/e),r=q.copy();r.Sp(c);Aj(a,r);fj(a);a.kd(n,p,a,q);var u=a.Pb;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 x=$b.alloc();
x.reset();x.translate(c.left,c.top);x.scale(e);0===f.x&&0===f.y||x.translate(-f.x,-f.y);b.setTransform(x.m11,x.m12,x.m21,x.m22,x.dx,x.dy);$b.free(x);Ij(a,b);if(null!==g){var y=new H,A=g.iterator;for(A.reset();A.next();){var C=A.value;!1===l&&"Grid"===C.layer.name||null===C||y.add(C)}var G=function(c){var d=k;if(c.visible&&0!==c.mb&&(void 0===d&&(d=!0),d||!c.isTemporary)){d=c.Ga.j;var e=d.length;if(0!==e){1!==c.mb&&(b.globalAlpha=c.mb);c=c.Qo;c.length=0;for(var f=a.scale,g=0;g<e;g++){var h=d[g];if(Dg(h)&&
y.contains(h)){if(h instanceof T&&(h.isOrthogonal&&c.push(h),!1===h.Mc))continue;var l=h.actualBounds;l.width*f>a.re||l.height*f>a.re?h.jc(b,a):yi(b,h)}}b.globalAlpha=1}}}}else if(!k&&l){var I=a.grid.part,O=I.layer;G=function(c){c===O?I.jc(b,a):c.jc(b,a,k)}}else G=function(c){c.jc(b,a,k)};for(c=0;c<p;c++)G(n[c]);a.qj=!1;a.ci&&Jj(a.ci,a)&&a.pr()}finally{a.Da=m,a.$c.Uc(!0),ej(a),a.kd(n,p,a),Aj(a)}}}t.He=function(a){return this.gg[a]};
t.Ox=function(a,b){"minDrawingLength"===a&&(this.re=b);this.gg[a]=b;this.wf()};t.Lv=function(){this.gg=new xb;this.gg.drawShadows=!0;this.gg.textGreeking=!0;this.gg.viewportOptimizations=lb||gb||ib?!1:!0;this.gg.temporaryPixelRatio=!0;this.gg.pictureRatioOptimization=!0;this.re=this.gg.minDrawingLength=1};function Ij(a,b){a=a.gg;null!==a&&(void 0!==a.imageSmoothingEnabled&&b.Nx(!!a.imageSmoothingEnabled),a=a.defaultFont,void 0!==a&&null!==a&&(b.font=a))}t.gm=function(a){return this.il[a]};
t.cA=function(a,b){this.il[a]=b};t.Kv=function(){this.il=new xb;this.il.extraTouchArea=10;this.il.extraTouchThreshold=10;this.il.hasGestureZoom=!0};t.Uv=function(a){Lj(this,a)};
function Lj(a,b){var c=a instanceof W,d=a instanceof P,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.bb(k);else if(f=a[k],void 0===f||null===f)f=a.toolManager[k];Ja(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]&&!Ya(f,g))if(d&&"ModelChanged"===g){a.Zw(b[g]);continue}else if(d&&"Changed"===g){a.sh(b[g]);continue}else if(d&&
Ya(a.toolManager,g))f=a.toolManager;else if(d&&Mj(a,g)){a.Rj(g,b[g]);continue}else if(a instanceof X&&"Changed"===g){a.sh(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.Ww(g)}}t.Qu=function(){if(0===this.undoManager.transactionLevel&&0!==this.Zh.count){for(;0<this.Zh.count;){var a=this.Zh;this.Zh=new Ub;for(a=a.iterator;a.next();){var b=a.key;b.jq(a.value);b.cc()}}this.S()}};
t.S=function(a){void 0===a&&(a=null);if(null===a)this.oc=!0,this.ec();else{var b=this.viewportBounds;null!==a&&a.o()&&b.Kc(a)&&(this.oc=!0,this.ec())}this.ba("InvalidateDraw")};
t.vx=function(a,b){if(!0!==this.oc){this.oc=!0;var c=!0===this.He("temporaryPixelRatio");if(!0===this.He("viewportOptimizations")&&this.scrollMode!==Nj&&this.vi.Ii(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.Gs&&0<d.width&&0<d.height){if(!(this.$b||(this.sd=!1,null===this.Ja||(this.$b=!0,this.Qu(),this.documentBounds.o()||
kj(this,this.computeBounds()),e=this.Ea,null===e||e instanceof Oj)))){var g=this.Pb;f=this.Aa*g;var h=this.ya*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.Zt;a=this.Aw;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),q=Math.floor(f-n),r=Math.floor(h-p);a.drawImage(e.Ha,n,p,q,r,0,0,q,r);Jj(this.ci,this)&&a.clearRect(0,0,k,m);e=Qa();a=Qa();r=Math.abs(l);
q=Math.abs(b);var u=0===n?0:f-r;n=J.allocAt(u,0);r=J.allocAt(r+u,h);a.push(new L(Math.min(n.x,r.x),Math.min(n.y,r.y),Math.abs(n.x-r.x),Math.abs(n.y-r.y)));var x=this.ub;x.reset();x.scale(g,g);1!==this.Da&&x.scale(this.Da);g=this.ua;(0!==g.x||0!==g.y)&&isFinite(g.x)&&isFinite(g.y)&&x.translate(-g.x,-g.y);ac(n,x);ac(r,x);e.push(new L(Math.min(n.x,r.x),Math.min(n.y,r.y),Math.abs(n.x-r.x),Math.abs(n.y-r.y)));u=0===p?0:h-q;n.h(0,u);r.h(f,q+u);a.push(new L(Math.min(n.x,r.x),Math.min(n.y,r.y),Math.abs(n.x-
r.x),Math.abs(n.y-r.y)));ac(n,x);ac(r,x);e.push(new L(Math.min(n.x,r.x),Math.min(n.y,r.y),Math.abs(n.x-r.x),Math.abs(n.y-r.y)));Jj(this.ci,this)&&(f=0<l?0:-l,h=0<b?0:-b,n.h(f,h),r.h(k+f,m+h),a.push(new L(Math.min(n.x,r.x),Math.min(n.y,r.y),Math.abs(n.x-r.x),Math.abs(n.y-r.y))),ac(n,x),ac(r,x),e.push(new L(Math.min(n.x,r.x),Math.min(n.y,r.y),Math.abs(n.x-r.x),Math.abs(n.y-r.y))));J.free(n);J.free(r);yj(this,!1);null===this.Ja&&v("No div specified");null===this.Ea&&v("No canvas specified");if(!this.animationManager.sb&&
(f=this.$c,this.oc)){Hj(this);h=this.Pb;f.setTransform(1,0,0,1,0,0);f.clearRect(0,0,this.Aa*h,this.ya*h);f.drawImage(this.Zt.Ha,0<l?0:Math.round(-l),0<b?0:Math.round(-b));b=this.ua;g=this.Da;k=Math.round(b.x*g)/g;m=Math.round(b.y*g)/g;l=this.ub;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);E&&E.Gi&&E.$u&&E.$u(this,f);h=this.Ra.j;b=h.length;this.kd(h,b,this);Ij(this,f);for(g=0;g<b;g++)if(n=h[g],k=e,n.visible&&0!==n.mb){1!==n.mb&&(f.globalAlpha=n.mb);m=n.Qo;m.length=0;p=this.scale;n=n.Ga.j;q=n.length;r=k.length;for(x=0;x<q;x++)if(u=n[x],Dg(u)){if(u instanceof T&&(u.isOrthogonal&&m.push(u),!1===u.Mc))continue;var y=Pj(u,u.actualBounds);a:{var A=y;for(var C=k,G=r,I=2/p,O=4/p,R=0;R<G;R++){var Q=C[R];if(0!==Q.width&&0!==
Q.height&&A.qv(Q.x-I,Q.y-I,Q.width+O,Q.height+O)){A=!0;break a}}A=!1}A&&(y.width*p>this.re||y.height*p>this.re?u.jc(f,this):yi(f,u))}f.globalAlpha=1}f.restore();f.Uc(!0);E&&(E.av||E.Gi)&&E.Yp&&E.Yp(f,this,l);this.ci&&Jj(this.ci,this)&&this.pr();this.oc=this.ei=!1;this.tt()}Ta(e);Ta(a);this.$b=!1}}else this.hd();L.free(d);c&&(Yf(this),this.hd(),hg(this,!0))}else c?(Yf(this),this.hd(),hg(this,!0)):this.hd()}};function xj(a){!1===a.oj&&(a.oj=!0)}function ej(a){!1===a.ei&&(a.ei=!0)}
function Hj(a){!1!==a.Tn&&(a.Tn=!1,Qj(a,a.Aa,a.ya))}function Qj(a,b,c){var d=a.Pb;a.Ea.resize(b*d,c*d,b,c)&&(a.oc=!0,a.$c.Uc(!0))}
function cj(a){var b=a.Ea;if(null===b)return!0;var c=a.Ja,d=a.Aa,e=a.ya,f=a.Tw.copy();if(!f.o())return!0;var g=!1,h=a.bi?a.Jb:0,k=a.Sg?a.Jb:0,l=c.clientWidth||d+h;c=c.clientHeight||e+k;if(l!==d+h||c!==e+k)a.bi=!1,a.Sg=!1,k=h=0,a.Aa=l,a.ya=c,g=a.Tn=!0;a.oj=!1;var m=a.documentBounds,n=0,p=0,q=0,r=0;l=f.width;c=f.height;var u=a.vi;a.contentAlignment.Za()?(m.width>l&&(n=u.left,p=u.right),m.height>c&&(q=u.top,r=u.bottom)):(n=u.left,p=u.right,q=u.top,r=u.bottom);u=m.width+n+p;var x=m.height+q+r;n=m.x-n;
var y=f.x;p=m.right+p;var A=f.right+h;q=m.y-q;var C=f.y;r=m.bottom+r;var G=f.bottom+k,I="1px",O="1px";m=a.scale;var R=!(u<l+h),Q=!(x<c+k);a.scrollMode===Ei&&(R||Q)&&(R&&a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(I=1,n+1<y&&(I=Math.max((y-n)*m+a.Aa,I)),p>A+1&&(I=Math.max((p-A)*m+a.Aa,I)),l+h+1<u&&(I=Math.max((u-l+h)*m+a.Aa,I)),I=I.toString()+"px"),Q&&a.hasVerticalScrollbar&&a.allowVerticalScroll&&(O=1,q+1<C&&(O=Math.max((C-q)*m+a.ya,O)),r>G+1&&(O=Math.max((r-G)*m+a.ya,O)),c+k+1<x&&(O=Math.max((x-
c+k)*m+a.ya,O)),O=O.toString()+"px"));Q="1px"!==I;R="1px"!==O;Q&&R||!Q&&!R||(R&&(A-=a.Jb),Q&&(G-=a.Jb),u<l+h||!a.hasHorizontalScrollbar||!a.allowHorizontalScroll||(h=1,n+1<y&&(h=Math.max((y-n)*m+a.Aa,h)),p>A+1&&(h=Math.max((p-A)*m+a.Aa,h)),l+1<u&&(h=Math.max((u-l)*m+a.Aa,h)),I=h.toString()+"px"),Q="1px"!==I,h=a.ya,Q!==a.Sg&&(h=Q?a.ya-a.Jb:a.ya+a.Jb),x<c+k||!a.hasVerticalScrollbar||!a.allowVerticalScroll||(k=1,q+1<C&&(k=Math.max((C-q)*m+h,k)),r>G+1&&(k=Math.max((r-G)*m+h,k)),c+1<x&&(k=Math.max((x-
c)*m+h,k)),O=k.toString()+"px"),R="1px"!==O);if(a.us&&Q===a.Sg&&R===a.bi)return d===a.Aa&&e===a.ya||a.hd(),!1;Q!==a.Sg&&("1px"===I?a.ya=a.ya+a.Jb:a.ya=Math.max(a.ya-a.Jb,1),g=!0);a.Sg=Q;a.mp.style.width=I;R!==a.bi&&("1px"===O?a.Aa=a.Aa+a.Jb:a.Aa=Math.max(a.Aa-a.Jb,1),g=!0,a.Xn&&(k=J.alloc(),R?(b.style.left=a.Jb+"px",a.position=k.h(a.ua.x+a.Jb/a.scale,a.ua.y)):(b.style.left="0px",a.position=k.h(a.ua.x-a.Jb/a.scale,a.ua.y)),J.free(k)));a.bi=R;a.mp.style.height=O;a.zu=!0;g&&(a.Tn=!0);b=a.ws;k=b.scrollLeft;
a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(l+1<u?k=(a.position.x-n)*m:n+1<y?k=b.scrollWidth-b.clientWidth:p>A+1&&(k=a.position.x*m));if(a.Xn)switch(a.xu){case "negative":k=-(b.scrollWidth-k-b.clientWidth);break;case "reverse":k=b.scrollWidth-k-b.clientWidth}b.scrollLeft=k;a.hasVerticalScrollbar&&a.allowVerticalScroll&&(c+1<x?b.scrollTop=(a.position.y-q)*m:q+1<C?b.scrollTop=b.scrollHeight-b.clientHeight:r>G+1&&(b.scrollTop=a.position.y*m));l=a.Aa;c=a.ya;b.style.width=l+(a.bi?a.Jb:0)+"px";
b.style.height=c+(a.Sg?a.Jb:0)+"px";return d!==l||e!==c||a.animationManager.sb?(a.sq(f,a.viewportBounds,m,g),!1):!0}
t.add=function(a){w(a,U,P,"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.dm(a.layerName),null===b&&(b=this.dm("")),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.Si(99999999,a,a.diagram===this);0<=c&&this.cb(qf,"parts",b,null,a,null,c);b.isTemporary||this.Ya();a.C(1);c=a.layerChanged;null!==c&&c(a,null,
b)}};t.Si=function(a){this.partManager.Si(a);var b=this;Rj(a,function(a){Sj(b,a)});(a instanceof Cf||a instanceof xg&&null!==a.placeholder)&&a.v();null!==a.data&&Rj(a,function(a){Tj(b.partManager,a)});!0!==Fj(a)&&!0!==Gj(a)||this.Fd.add(a);Uj(a,!0,this);Vj(a)?(a.actualBounds.o()&&this.S(Pj(a,a.actualBounds)),this.Ya()):a.isVisible()&&a.actualBounds.o()&&this.S(Pj(a,a.actualBounds));this.ec()};
t.zc=function(a){a.Wj();this.partManager.zc(a);var b=this;null!==a.data&&Rj(a,function(a){Wj(b.partManager,a,b)});this.Fd.remove(a);Vj(a)?(a.actualBounds.o()&&this.S(Pj(a,a.actualBounds)),this.Ya()):a.isVisible()&&a.actualBounds.o()&&this.S(Pj(a,a.actualBounds));this.ec()};t.remove=function(a){w(a,U,P,"remove:part");Xj(this,a,!0)};
function Xj(a,b,c){var d=b.layer;null!==d&&d.diagram===a&&(b.isSelected=!1,b.isHighlighted=!1,b.C(2),c&&b.bk(),c=d.zc(-1,b,!1),0<=c&&a.cb(rf,"parts",d,b,null,c,null),a=b.layerChanged,null!==a&&a(b,d,null))}t.wt=function(a,b){if(Ka(a))for(var c=a.length,d=0;d<c;d++){var e=a[d];b&&!e.canDelete()||this.remove(e)}else for(c=new H,c.addAll(a),a=c.iterator;a.next();)c=a.value,b&&!c.canDelete()||this.remove(c)};t.ak=function(a,b,c){return this.partManager.ak(a,b,c)};
P.prototype.moveParts=function(a,b,c,d){void 0===d&&(d=Yj(this));w(b,J,P,"moveParts:offset");if(null!==this.toolManager){var e=new Ub;if(null!==a)if(Ka(a))for(var f=0;f<a.length;f++)Zj(this,e,a[f],c,d);else for(a=a.iterator;a.next();)Zj(this,e,a.value,c,d);else{for(a=this.parts;a.next();)Zj(this,e,a.value,c,d);for(a=this.nodes;a.next();)Zj(this,e,a.value,c,d);for(a=this.links;a.next();)Zj(this,e,a.value,c,d)}pg(this,e,b,d,c)}};
function Zj(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=Yj(a)),c instanceof V){b.add(c,a.rd(e,c,c.location));if(c instanceof xg)for(f=c.memberParts;f.next();)Zj(a,b,f.value,d,e,e.vz);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)&&Zj(a,b,g,d,e)}}if(e.dragsTree)for(c=c.iv();c.next();)Zj(a,b,c.value,d,e)}else if(c instanceof T)for(b.add(c,a.rd(e,
c)),c=c.labelNodes;c.next();)Zj(a,b,c.value,d,e);else c instanceof Cf||b.add(c,a.rd(e,c,c.location))}
function pg(a,b,c,d,e){if(null!==b&&(w(b,Ub,P,"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.Cp)||Zf(a,b);for(var h=Qa(),k=Qa(),l=b.iterator,m=J.alloc();l.next();){var n=l.key,p=l.value;if(n.dc()){var q=ak(a,n,b);if(null!==q)h.push(new bk(n,p,q));else if(!e||n.canMove())q=p.point,f.assign(q),a.computeMove(n,f.add(g),d,m),n.location=m,void 0===p.shifted&&(p.shifted=new J),p.shifted.assign(m.Zd(q))}else l.key instanceof T&&k.push(l.pa)}J.free(m);
e=h.length;for(l=0;l<e;l++)n=h[l],f.assign(n.info.point),void 0===n.nv.shifted&&(n.nv.shifted=new J),n.node.location=f.add(n.nv.shifted);e=J.alloc();l=J.alloc();n=k.length;for(p=0;p<n;p++){var r=k[p];q=r.key;if(q instanceof T)if(q.suspendsRouting){q.dh=null;m=q.fromNode;var u=q.toNode;if(null!==a.draggedLink&&d.dragsLink)if(u=r.value.point,null===q.dragComputation)b.add(q,a.rd(d,q,g)),ng(q,g.x-u.x,g.y-u.y);else{r=J.allocAt(0,0);(m=q.i(0))&&m.o()&&r.assign(m);var x=m=J.alloc().assign(r).add(g);d.isGridSnapEnabled&&
(d.isGridSnapRealtime||a.lastInput.up)&&(x=J.alloc(),uh(a,q,m,x,d));m.assign(q.dragComputation(q,m,x)).Zd(r);b.add(q,a.rd(d,q,m));ng(q,m.x-u.x,m.y-u.y);J.free(r);J.free(m);x!==m&&J.free(x)}else null!==m&&(e.assign(m.location),x=b.K(m),null!==x&&e.Zd(x.point)),null!==u&&(l.assign(u.location),x=b.K(u),null!==x&&l.Zd(x.point)),null!==m&&null!==u?e.Sa(l)?(m=r.value.point,u=f,u.assign(e),u.Zd(m),b.add(q,a.rd(d,q,e)),ng(q,u.x,u.y)):(q.suspendsRouting=!1,q.Ta()):(r=r.value.point,m=null!==m?e:null!==u?l:
g,b.add(q,a.rd(d,q,m)),ng(q,m.x-r.x,m.y-r.y))}else if(null===q.fromNode||null===q.toNode)m=r.value.point,b.add(q,a.rd(d,q,g)),ng(q,g.x-m.x,g.y-m.y)}J.free(f);J.free(g);J.free(e);J.free(l);Ta(h);Ta(k);c||(fj(a),dg(a,b))}}
P.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(),uh(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 Yj(a){var b=a.toolManager.findTool("Dragging");return null!==b?b.dragOptions:a.Qk}
function uh(a,b,c,d,e){void 0===e&&(e=Yj(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.uk(0,0,a,b,e);K.bq(c.x,c.y,h+f.x,g+f.y,a,b,d);J.free(f)}}function Zf(a,b){if(null!==b)for(a.Cp=!0,a=b.iterator;a.next();)b=a.key,b instanceof T&&(b.suspendsRouting=!0)}
function dg(a,b){if(null!==b){for(b=b.iterator;b.next();){var c=b.key;c instanceof T&&(c.suspendsRouting=!1,ck(c)&&c.Ta())}a.Cp=!1}}function ak(a,b,c){b=b.containingGroup;if(null!==b){a=ak(a,b,c);if(null!==a)return a;a=c.K(b);if(null!==a)return a}return null}t=P.prototype;t.rd=function(a,b,c){if(void 0===c)return new bg(gc);var d=a.isGridSnapEnabled;a.wz||null===b.containingGroup||(d=!1);return d?new bg(new J(Math.round(c.x),Math.round(c.y))):new bg(c.copy())};
function dk(a,b,c){w(b,vi,P,"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):(w(c,vi,P,"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.Ra;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.Vl=function(a){dk(this,a,null);a.ib(this);var b=this.Ra,c=b.count-1;if(!a.isTemporary)for(;0<=c&&b.O(c).isTemporary;)c--;b.Lb(c+1,a);null!==this.ac&&this.cb(qf,"layers",this,null,a,null,c+1);this.S();this.Ya()};
t.Xw=function(a,b){dk(this,a,b);a.ib(this);var c=this.Ra,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.ac&&this.cb(rf,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.O(f)===b){c.Lb(f,a);break}null!==this.ac&&this.cb(qf,"layers",this,null,a,null,f);this.S();0>d&&this.Ya()};
t.my=function(a,b){dk(this,a,b);a.ib(this);var c=this.Ra,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.ac&&this.cb(rf,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.O(f)===b){c.Lb(f+1,a);break}null!==this.ac&&this.cb(qf,"layers",this,null,a,null,f+1);this.S();0>d&&this.Ya()};
t.Xz=function(a){w(a,vi,P,"removeLayer:layer");a.diagram!==this&&v("Cannot remove a Layer from another Diagram: "+a+" of "+a.diagram);if(""!==a.name){var b=this.Ra,c=b.indexOf(a);if(b.remove(a)){for(b=a.Ga.copy().iterator;b.next();){var d=b.value,e=d.layerName;e!==a.name?d.layerName=e:d.layerName=""}null!==this.ac&&this.cb(rf,"layers",this,a,null,c,null);this.S();this.Ya()}}};t.dm=function(a){for(var b=this.layers;b.next();){var c=b.value;if(c.name===a)return c}return null};
t.Zw=function(a){z(a,"function",P,"addModelChangedListener:listener");null===this.se&&(this.se=new F);this.se.add(a);this.model.sh(a)};t.Zz=function(a){z(a,"function",P,"removeModelChangedListener:listener");null!==this.se&&(this.se.remove(a),0===this.se.count&&(this.se=null));this.model.tk(a)};t.sh=function(a){z(a,"function",P,"addChangedListener:listener");null===this.Df&&(this.Df=new F);this.Df.add(a)};
t.tk=function(a){z(a,"function",P,"removeChangedListener:listener");null!==this.Df&&(this.Df.remove(a),0===this.Df.count&&(this.Df=null))};t.Qs=function(a){this.skipsUndoManager||this.model.skipsUndoManager||this.model.undoManager.ov(a);a.change!==pf&&(this.isModified=!0);if(null!==this.Df)for(var b=this.Df,c=b.length,d=0;d<c;d++)b.O(d)(a)};
t.cb=function(a,b,c,d,e,f,g){void 0===f&&(f=null);void 0===g&&(g=null);var h=new nf;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.Qs(h)};t.g=function(a,b,c,d,e){this.cb(of,a,this,b,c,d,e)};
t.Vj=function(a,b){if(null!==a&&a.diagram===this){var c=this.skipsModelSourceBindings;try{this.skipsModelSourceBindings=!0;var d=a.change;if(d===of){var e=a.object;ek(e,a.propertyName,a.K(b));if(e instanceof N){var f=e.part;null!==f&&f.Mb()}this.isModified=!0}else if(d===qf){var g=a.object,h=a.newParam,k=a.newValue;if(g instanceof W)if("number"===typeof h&&k instanceof N){b?g.zc(h):g.Lb(h,k);var l=g.part;null!==l&&l.Mb()}else{if("number"===typeof h&&k instanceof fk)if(b)k.isRow?g.Iv(h):g.Gv(h);else{var m=
k.isRow?g.getRowDefinition(k.index):g.getColumnDefinition(k.index);m.$l(k)}}else if(g instanceof vi){var n=!0===a.oldParam;"number"===typeof h&&k instanceof U&&(b?(k.isSelected=!1,k.isHighlighted=!1,k.Mb(),g.zc(n?h:-1,k,n)):g.Si(h,k,n))}else g instanceof P?"number"===typeof h&&k instanceof vi&&(b?this.Ra.nb(h):(k.ib(this),this.Ra.Lb(h,k))):v("unknown ChangedEvent.Insert object: "+a.toString());this.isModified=!0}else if(d===rf){var p=a.object,q=a.oldParam,r=a.oldValue;if(p instanceof W)"number"===
typeof q&&r instanceof N?b?p.Lb(q,r):p.zc(q):"number"===typeof q&&r instanceof fk&&(b?(m=r.isRow?p.getRowDefinition(r.index):p.getColumnDefinition(r.index),m.$l(r)):r.isRow?p.Iv(q):p.Gv(q));else if(p instanceof vi){var u=!0===a.newParam;"number"===typeof q&&r instanceof U&&(b?0>p.Ga.indexOf(r)&&p.Si(q,r,u):(r.isSelected=!1,r.isHighlighted=!1,r.Mb(),p.zc(u?q:-1,r,u)))}else p instanceof P?"number"===typeof q&&r instanceof vi&&(b?(r.ib(this),this.Ra.Lb(q,r)):this.Ra.nb(q)):v("unknown ChangedEvent.Remove object: "+
a.toString());this.isModified=!0}else d!==pf&&v("unknown ChangedEvent: "+a.toString())}finally{this.skipsModelSourceBindings=c}}};t.Ca=function(a){return this.undoManager.Ca(a)};t.ab=function(a){return this.undoManager.ab(a)};t.yf=function(){return this.undoManager.yf()};
P.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.Ca(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.ab(b):this.undoManager.yf(),this.skipsUndoManager=c}};P.prototype.updateAllTargetBindings=function(a){this.partManager.updateAllTargetBindings(a)};t=P.prototype;t.Dq=function(){this.partManager.Dq()};
function gk(a,b,c){var d=a.animationManager;if(a.pb||a.$b)a.Da=c,ui(d,b,a.Da);else if(a.pb=!0,null===a.Ea)a.Da=c;else{var e=a.viewportBounds.copy(),f=a.Aa,g=a.ya;e.width=a.Aa/b;e.height=a.ya/b;var h=a.zoomPoint.x,k=a.zoomPoint.y,l=a.contentAlignment;isNaN(h)&&(l.uf()?l.tf(wd)?h=0:l.tf(Ad)&&(h=f-1):h=l.Za()?l.x*(f-1):f/2);isNaN(k)&&(l.uf()?l.tf(vd)?k=0:l.tf(Bd)&&(k=g-1):k=l.Za()?l.y*(g-1):g/2);null!==a.scaleComputation&&(c=a.scaleComputation(a,c));c<a.minScale&&(c=a.minScale);c>a.maxScale&&(c=a.maxScale);
f=J.allocAt(a.ua.x+h/b-h/c,a.ua.y+k/b-k/c);a.position=f;J.free(f);a.Da=c;a.sq(e,a.viewportBounds,b,!1);a.pb=!1;hj(a,!1);ui(d,b,a.Da);a.S();xj(a)}}
t.sq=function(a,b,c,d){if(!a.A(b)){void 0===d&&(d=!1);d||xj(this);ej(this);var e=this.layout;null===e||!e.isViewportSized||this.autoScale!==Fi||d||a.width===b.width&&a.height===b.height||e.C();e=this.currentTool;!0===this.Te&&e instanceof $a&&(this.lastInput.documentPoint=this.Dt(this.lastInput.viewPoint),Gf(e,this));this.pb||this.vx(a,b);Aj(this);this.Be.scale=c;this.Be.position.x=a.x;this.Be.position.y=a.y;this.Be.bounds.assign(a);this.Be.xx=d;this.ba("ViewportBoundsChanged",this.Be,a);this.isVirtualized&&
this.links.each(function(a){a.isAvoiding&&a.actualBounds.Kc(b)&&a.Ta()})}};
function Aj(a,b){void 0===b&&(b=null);var c=a.Hb;if(null!==c&&c.visible){for(var d=Zb.alloc(),e=1,f=1,g=c.Z.j,h=g.length,k=0;k<h;k++){var l=g[k],m=l.interval;2>m||(hk(l.figure)?f=f*m/K.qx(f,m):e=e*m/K.qx(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.bq(a,g,0,0,
d.width,d.height,b);b.offset(-d.width,-d.height);Zb.free(d);c.part.location=b;J.free(b)}}t.Vp=function(){var a=0<this.selection.count;a&&this.ba("ChangingSelection",this.selection);Mf(this);a&&this.ba("ChangedSelection",this.selection)};function Mf(a){a=a.selection;if(0<a.count){for(var b=a.Oa(),c=b.length,d=0;d<c;d++)b[d].isSelected=!1;a.ja();a.clear();a.freeze()}}
t.select=function(a){null!==a&&(w(a,U,P,"select:part"),a.layer.diagram===this&&(!a.isSelected||1<this.selection.count)&&(this.ba("ChangingSelection",this.selection),Mf(this),a.isSelected=!0,this.ba("ChangedSelection",this.selection)))};
t.Ov=function(a){this.ba("ChangingSelection",this.selection);Mf(this);if(Ka(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];d instanceof U||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 U||v("Diagram.selectCollection given something that is not a Part: "+b),b.isSelected=!0;this.ba("ChangedSelection",this.selection)};
t.Ru=function(){var a=this.highlighteds;if(0<a.count){for(var b=a.Oa(),c=b.length,d=0;d<c;d++)b[d].isHighlighted=!1;a.ja();a.clear();a.freeze()}};t.yz=function(a){null!==a&&a.layer.diagram===this&&(w(a,U,P,"highlight:part"),!a.isHighlighted||1<this.highlighteds.count)&&(this.Ru(),a.isHighlighted=!0)};
t.zz=function(a){a=(new H).addAll(a);for(var b=this.highlighteds.copy().vq(a).iterator;b.next();)b.value.isHighlighted=!1;for(a=a.iterator;a.next();)b=a.value,b instanceof U||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.Nv=function(a){var b=this.viewportBounds;b.qf(a)||(a=a.center,a.x-=b.width/2,a.y-=b.height/2,this.position=a)};t.Pu=function(a){var b=this.viewportBounds;a=a.center;a.x-=b.width/2;a.y-=b.height/2;this.position=a};t.Ct=function(a){var b=this.ub;b.reset();1!==this.Da&&b.scale(this.Da);var c=this.ua;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return a.copy().transform(this.ub)};
t.jA=function(a){var b=this.ub,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 q=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,q);p=Math.max(p,q);q=Math.min(b,a);b=Math.max(b,a);f=Math.min(f,d);p=Math.max(p,d);q=Math.min(q,c);b=Math.max(b,c);f=Math.min(f,g);p=Math.max(p,g);q=Math.min(q,e);b=Math.max(b,e);return new L(f,q,p-f,b-q)};
t.Dt=function(a){var b=this.ub;b.reset();1!==this.Da&&b.scale(this.Da);var c=this.ua;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return ac(a.copy(),this.ub)};function ik(a){var b=a.isModified;a.Uw!==b&&(a.Uw=b,a.ba("Modified"))}function jk(a){a=Ii.get(a);return null!==a?new a:new Ji}
P.prototype.doModelChanged=function(a){if(a.model===this.model){var b=a.change,c=a.propertyName;if(b===pf&&"S"===c[0])if("StartingFirstTransaction"===c){var d=this;a=this.toolManager;a.mouseDownTools.each(function(a){a.ib(d)});a.mouseMoveTools.each(function(a){a.ib(d)});a.mouseUpTools.each(function(a){a.ib(d)});this.$b||this.ke||(this.Wk=!0,this.bl&&(this.sd=!0))}else"StartingUndo"===c||"StartingRedo"===c?(a=this.animationManager,a.isAnimating&&!this.skipsUndoManager&&a.xd(),this.ba("ChangingSelection",
this.selection)):"StartedTransaction"===c&&(a=this.animationManager,a.isAnimating&&!this.skipsUndoManager&&a.xd());else if(this.fa){this.fa=!1;try{if(""===a.modelChange&&b===pf){if("FinishedUndo"===c||"FinishedRedo"===c)this.ba("ChangedSelection",this.selection),fj(this);var e=this.animationManager;"RolledBackTransaction"===c&&e.xd();this.Wk=!0;this.hd();0===this.undoManager.transactionLevel&&hi(e);"CommittedTransaction"===c&&this.undoManager.ju&&(this.je=Math.min(this.je,this.undoManager.historyIndex-
1));var f=a.isTransactionFinished;f&&(ik(this),this.lt.clear());if(!this.qu&&f){this.qu=!0;var g=this;wa(function(){g.currentTool.standardMouseOver();g.qu=!1},10)}}}finally{this.fa=!0}}}};function Sj(a,b){b=b.Z.j;for(var c=b.length,d=0;d<c;d++)kk(a,b[d])}
function kk(a,b){if(b instanceof lk){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){var d=b.Ng;null!==d&&(d.dl instanceof Event&&null!==b.Ec&&b.Ec(b,d.dl),!0===d.Jr&&(null!==b.hf&&b.hf(b,d.yu),null!==b.diagram&&b.diagram.su.add(b)));c=c.getAttribute("src");d=a.Gj.K(c);if(null===d)d=[],d.push(b),a.Gj.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}}
function pk(a,b){if(b instanceof lk){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){c=c.getAttribute("src");var d=a.Gj.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.Gj.remove(c),tk(c));break}}}}P.prototype.wd=function(){this.partManager.wd()};P.prototype.Qp=function(a,b){this.Ek.Qp(a,b)};P.prototype.Rp=function(a,b){this.Ek.Rp(a,b)};P.prototype.findPartForKey=function(a){return this.partManager.findPartForKey(a)};t=P.prototype;t.Kb=function(a){return this.partManager.Kb(a)};
t.xc=function(a){return this.partManager.xc(a)};t.Ji=function(a){return this.partManager.Ji(a)};t.wc=function(a){return this.partManager.wc(a)};t.Xs=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.Xs.apply(this.partManager,b instanceof Array?b:da(ca(b)))};t.Ws=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.Ws.apply(this.partManager,b instanceof Array?b:da(ca(b)))};
function kj(a,b){a.Tg=!1;var c=a.zn;c.A(b)||(b=b.J(),a.zn=b,hj(a,!1),a.ba("DocumentBoundsChanged",null,c.copy()),xj(a))}t.dz=function(){for(var a=new H,b=this.nodes;b.next();){var c=b.value;c.isTopLevel&&a.add(c)}for(b=this.links;b.next();)c=b.value,c.isTopLevel&&a.add(c);return a.iterator};t.cz=function(){return this.Bi.iterator};t.Jz=function(a){fj(this);a&&uk(this,!0);this.Wk=!0;Eg(this)};
function uk(a,b){for(var c=a.Bi.iterator;c.next();)vk(a,c.value,b);null!==a.layout&&(b?a.layout.isValidLayout=!1:a.layout.C())}function vk(a,b,c){if(null!==b){for(var d=b.wl.iterator;d.next();)vk(a,d.value,c);null!==b.layout&&(c?b.layout.isValidLayout=!1:b.layout.C())}}
function Bj(a,b){if(a.Eg&&!a.Vt){var c=a.fa;a.fa=!0;var d=a.undoManager.transactionLevel,e=a.layout;try{0===d&&a.Ca("Layout");var f=a.animationManager;1>=d&&!f.isAnimating&&!f.sb&&(b||f.Dh("Layout"));a.Eg=!1;for(var g=a.Bi.iterator;g.next();)wk(a,g.value,b,d);e.isValidLayout||(!b||e.isRealtime||null===e.isRealtime||0===d?(e.doLayout(a),fj(a),e.isValidLayout=!0):a.Eg=!0)}finally{0===d&&a.ab("Layout"),a.Eg=!e.isValidLayout,a.fa=c}}}
function wk(a,b,c,d){if(null!==b){for(var e=b.wl.iterator;e.next();)wk(a,e.value,c,d);e=b.layout;null===e||e.isValidLayout||(!c||e.isRealtime||0===d?(b.rk=!b.location.o(),e.doLayout(b),b.C(32),Dj(a,b),e.isValidLayout=!0):a.Eg=!0)}}t.jz=function(){for(var a=new F,b=this.nodes;b.next();){var c=b.value;c.isTopLevel&&null===c.Mi()&&a.add(c)}return a.iterator};
function Gi(a){function b(a){var b=a.toLowerCase(),e=new F;c.add(a,e);c.add(b,e);d.add(a,a);d.add(b,a)}var c=new Ub,d=new Ub;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.Xt=c;a.Wt=d}
function Mj(a,b){var c=a.Wt.K(b);return null!==c?c:a.Wt.K(b.toLowerCase())}function xk(a,b){var c=a.Xt.K(b);if(null!==c)return c;c=a.Xt.K(b.toLowerCase());if(null!==c)return c;v("Unknown DiagramEvent name: "+b);return null}t.Rj=function(a,b){z(a,"string",P,"addDiagramListener:name");z(b,"function",P,"addDiagramListener:listener");a=xk(this,a);null!==a&&a.add(b)};t.sm=function(a,b){z(a,"string",P,"removeDiagramListener:name");z(b,"function",P,"addDiagramListener:listener");a=xk(this,a);null!==a&&a.remove(b)};
t.ba=function(a,b,c){E&&z(a,"string",P,"raiseDiagramEvent:name");var d=xk(this,a),e=new mf;e.diagram=this;a=Mj(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.Oa(),c=0;c<b;c++)(0,d[c])(e)};function yk(a){if(a.animationManager.isAnimating)return!1;var b=a.currentTool;return b===a.toolManager.findTool("Dragging")?!a.Cp||b.isComplexRoutingRealtime:!0}
t.ik=function(a,b){void 0===b&&(b=null);return zk(this,!1,null,b).ik(a.x,a.y,a.width,a.height)};P.prototype.computeOccupiedArea=function(){return this.isVirtualized?this.viewportBounds.copy():this.Tg?gj(this):this.documentBounds.copy()};
function zk(a,b,c,d){null===a.Qb&&(a.Qb=new Ak);if(a.Qb.ft||a.Qb.group!==c||a.Qb.Rx!==d){if(null===c){b=a.computeOccupiedArea();b.Xc(100,100);a.Qb.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&&Bk(a,f,d,b)}L.free(b)}else{0<c.memberParts.count&&(b=a.computePartsBounds(c.memberParts,!1),b.Xc(20,20),a.Qb.initialize(b));b=L.alloc();for(e=c.memberParts;e.next();)f=e.value,f instanceof V&&Bk(a,f,d,b);L.free(b)}a.Qb.group=c;a.Qb.Rx=d;a.Qb.ft=
!1}else b&&Ck(a.Qb);return a.Qb}function Bk(a,b,c,d){if(b!==c)if(b.isVisible()&&b.avoidable&&!b.isLinkLabel){var e=b.getAvoidableRect(d),f=a.Qb.Zl;c=a.Qb.Yl;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)Dk(a.Qb,g,h);Dk(a.Qb,g,b)}for(e=e.y;e<b;e+=c)Dk(a.Qb,d,e);Dk(a.Qb,d,b)}else if(b instanceof xg)for(b=b.memberParts;b.next();)e=b.value,e instanceof V&&Bk(a,e,c,d)}
function Ek(a,b){null!==a.Qb&&!a.Qb.ft&&(void 0===b&&(b=null),null===b||b.avoidable&&!b.isLinkLabel)&&(a.Qb.ft=!0)}t=P.prototype;t.Ts=function(a){this.Tq.assign(a);Fk(this,this.Tq).Sa(this.position)?this.zf():Gk(this)};
function Gk(a){-1===a.Gk&&(a.Gk=wa(function(){if(-1!==a.Gk&&(a.zf(),null!==a.lastInput.event)){var b=Fk(a,a.Tq);b.Sa(a.position)||(a.position=b,a.lastInput.documentPoint=a.Dt(a.Tq),a.doMouseMove(),a.Tg=!0,kj(a,a.documentBounds.copy().Lc(a.computeBounds())),a.oc=!0,a.hd(),Gk(a))}},a.Xm))}t.zf=function(){-1!==this.Gk&&(ra.clearTimeout(this.Gk),this.Gk=-1)};
function Fk(a,b){var c=a.position,d=a.Ym;if(0>=d.top&&0>=d.left&&0>=d.right&&0>=d.bottom)return c;var e=a.viewportBounds,f=a.scale;e=L.allocAt(0,0,e.width*f,e.height*f);var g=J.allocAt(0,0);if(b.x>=e.x&&b.x<e.x+d.left){var h=Math.max(a.scrollHorizontalLineChange,1);h|=0;g.x-=h;b.x<e.x+d.left/2&&(g.x-=h);b.x<e.x+d.left/4&&(g.x-=4*h)}else b.x<=e.x+e.width&&b.x>e.x+e.width-d.right&&(h=Math.max(a.scrollHorizontalLineChange,1),h|=0,g.x+=h,b.x>e.x+e.width-d.right/2&&(g.x+=h),b.x>e.x+e.width-d.right/4&&
(g.x+=4*h));b.y>=e.y&&b.y<e.y+d.top?(a=Math.max(a.scrollVerticalLineChange,1),a|=0,g.y-=a,b.y<e.y+d.top/2&&(g.y-=a),b.y<e.y+d.top/4&&(g.y-=4*a)):b.y<=e.y+e.height&&b.y>e.y+e.height-d.bottom&&(a=Math.max(a.scrollVerticalLineChange,1),a|=0,g.y+=a,b.y>e.y+e.height-d.bottom/2&&(g.y+=a),b.y>e.y+e.height-d.bottom/4&&(g.y+=4*a));g.Sa(gc)||(c=new J(c.x+g.x/f,c.y+g.y/f));L.free(e);J.free(g);return c}t.nt=function(){return null};t.uv=function(){return null};t.qy=function(a,b){this.vu.add(a,b)};
function Hk(a,b,c){function d(){var a=+new Date;f=!0;for(g.reset();g.next();)if(!g.value[0].sl){f=!1;break}f||a-l>k?b(c,e,h):ra.requestAnimationFrame(d)}for(var e=c.callback,f=!0,g=a.Gj.iterator;g.next();)if(!g.value[0].sl){f=!1;break}if("function"!==typeof e||f)return b(c,e,a);var h=a,k=c.callbackTimeout||300,l=+new Date;ra.requestAnimationFrame(function(){d()});return null}t.Lz=function(a){if(!Ih)return null;void 0===a&&(a=new xb);a.returnType="Image";return this.yx(a)};
t.yx=function(a){void 0===a&&(a=new xb);return Hk(this,this.Mz,a)};
t.Mz=function(a,b,c){var d=Ik(c,a,"canvas",null);if(null===d)return null;c=d.Y.canvas;var e=null;if(null!==c)switch(e=a.returnType,void 0===e?e="string":e=e.toLowerCase(),e){case "imagedata":e=d.getImageData(0,0,c.width,c.height);break;case "image":d=(a.document||document).createElement("img");d.src=c.toDataURL(a.type,a.details);e=d;break;case "blob":"function"!==typeof b&&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 Ik(a,b,c,d){a.animationManager.xd();a.hd();if(null===a.Ea)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 Zb(Infinity,Infinity):new Zb(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 q=b.document||document,r=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 Hc(m):m instanceof Hc||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.$c.Uc(!0);p=new Jk(null,q);var x=p.context;if(!(f||g||l||k)){p.width=a.Aa+Math.ceil(m.left+m.right);p.height=a.ya+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=q;d.Zp=r;Kj(a,d.context,m,new Zb(p.width,p.height),a.Da,a.ua,l,n,u,b);return d.context}a.Bn=!1;Kj(a,x,m,new Zb(p.width,p.height),a.Da,a.ua,l,n,u,b);a.Bn=!0;return p.context}var y=a.kr,A=a.documentBounds.copy();A.Wv(a.gb);if(u)for(var C=a.Ra.j,G=C.length,I=0;I<G;I++){var O=C[I];if(O.visible&&O.isTemporary){O=O.Ga.j;for(var R=O.length,Q=0;Q<R;Q++){var ea=O[Q];ea.isInDocumentBounds&&ea.isVisible()&&(ea=ea.actualBounds,ea.o()&&
A.Lc(ea))}}}C=new J(A.x,A.y);if(null!==l){G=!0;I=l.iterator;for(I.reset();I.next();)if(O=I.value,O instanceof U&&(R=O.layer,(null===R||R.visible)&&(null===R||u||!R.isTemporary)&&O.isVisible()&&(O=O.actualBounds,O.o())))if(G){G=!1;var Z=O.copy()}else Z.Lc(O);G&&(Z=new L(0,0,0,0));A.width=Z.width;A.height=Z.height;C.x=Z.x;C.y=Z.y}null!==k&&k.o()&&(C=k,g||(g=y));Z=k=0;null!==m&&(k=m.left+m.right,Z=m.top+m.bottom);G=I=0;null!==f&&(I=f.width,G=f.height,isFinite(I)&&(I=Math.max(0,I-k)),isFinite(G)&&(G=
Math.max(0,G-Z)));null!==f&&null!==g?("NaN"===g&&(g=y),f.o()?(f=I,A=G):isNaN(G)?(f=I,A=A.height*g):(f=A.width*g,A=G)):null!==f?f.o()?(g=Math.min(I/A.width,G/A.height),f=I,A=G):isNaN(G)?(g=I/A.width,f=I,A=A.height*g):(g=G/A.height,f=A.width*g,A=G):null!==g?"NaN"===g&&h.o()?(g=Math.min((h.width-k)/A.width,(h.height-Z)/A.height),g>y?(g=y,f=A.width,A=A.height):(f=h.width,A=h.height)):(f=A.width*g,A=A.height*g):(g=y,f=A.width,A=A.height);null!==m?(f+=k,A+=Z):m=new Hc(0);null!==h&&(y=h.width,h=h.height,
"SVG"!==c&&e&&!Kk&&E&&(f>y||A>h)&&(Ha("Diagram.makeImage(data): Diagram width or height is larger than the default max size. ("+Math.ceil(f)+"x"+Math.ceil(A)+" vs 2000x2000) Consider increasing the max size."),Kk=!0),isNaN(y)&&(y=2E3),isNaN(h)&&(h=2E3),isFinite(y)&&(f=Math.min(f,y)),isFinite(h)&&(A=Math.min(A,h)));p.width=Math.ceil(f);p.height=Math.ceil(A);if("SVG"===c){if(null===d)return null;d.resize(p.width,p.height,p.width,p.height);d.ownerDocument=q;d.Zp=r;Kj(a,d.context,m,new Zb(Math.ceil(f),
Math.ceil(A)),g,C,l,n,u,b);return d.context}a.Bn=!1;Kj(a,x,m,new Zb(Math.ceil(f),Math.ceil(A)),g,C,l,n,u,b);a.Bn=!0;return p.context}
na.Object.defineProperties(P.prototype,{div:{configurable:!0,get:function(){return this.Ja},set:function(a){null!==a&&w(a,HTMLDivElement,P,"div");if(this.Ja!==a){bb=[];var b=this.Ja;null!==b?(b.D=void 0,b.innerHTML="",null!==this.Ea&&(b=this.Ea.Ha,this.removeEventListener(b,"touchstart",this.aw,!1),this.removeEventListener(b,"touchmove",this.$v,!1),this.removeEventListener(b,"touchend",this.Zv,!1),this.Ea.kx()),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.$c=this.Ea=null,this.removeEventListener(ra,"resize",this.gw,!1),this.removeEventListener(ra,"mousemove",this.mk,!0),this.removeEventListener(ra,"mousedown",this.lk,!0),this.removeEventListener(ra,"mouseup",this.pk,!0),this.removeEventListener(ra,"wheel",this.qk,!0),this.removeEventListener(ra,"mouseout",this.nk,!0),yf===this&&(yf=null)):
this.ke=!1;this.Ja=null;if(null!==a){if(b=a.D)b.div=null;Qi(this,a);this.wf()}}}},ax:{configurable:!0,get:function(){return this.Ao}},sv:{configurable:!0,get:function(){return this.pb},set:function(a){this.pb=a}},Ui:{configurable:!0,get:function(){return this.ke}},draggedLink:{configurable:!0,get:function(){return this.nr},set:function(a){this.nr!==a&&(this.nr=a,null!==a&&(this.js=a.fromPort,this.ks=a.toPort))}},Bx:{configurable:!0,
get:function(){return this.js},set:function(a){this.js=a}},Cx:{configurable:!0,get:function(){return this.ks},set:function(a){this.ks=a}},animationManager:{configurable:!0,get:function(){return this.Ek}},undoManager:{configurable:!0,get:function(){return this.ac.undoManager}},skipsUndoManager:{configurable:!0,get:function(){return this.fh},set:function(a){z(a,"boolean",P,"skipsUndoManager");this.fh=a;this.ac.skipsUndoManager=a}},delaysLayout:{configurable:!0,
enumerable:!0,get:function(){return this.Vt},set:function(a){this.Vt=a}},validCycle:{configurable:!0,get:function(){return this.Ls},set:function(a){var b=this.Ls;b!==a&&(tb(a,P,P,"validCycle"),this.Ls=a,this.g("validCycle",b,a))}},layers:{configurable:!0,get:function(){return this.Ra.iterator}},isModelReadOnly:{configurable:!0,get:function(){var a=this.ac;return null===a?!1:a.isReadOnly},set:function(a){var b=this.ac;null!==b&&(b.isReadOnly=a)}},isReadOnly:{configurable:!0,
enumerable:!0,get:function(){return this.Qf},set:function(a){var b=this.Qf;b!==a&&(z(a,"boolean",P,"isReadOnly"),this.Qf=a,this.g("isReadOnly",b,a))}},isEnabled:{configurable:!0,get:function(){return this.Fc},set:function(a){var b=this.Fc;b!==a&&(z(a,"boolean",P,"isEnabled"),this.Fc=a,this.g("isEnabled",b,a))}},allowClipboard:{configurable:!0,get:function(){return this.Kq},set:function(a){var b=this.Kq;b!==a&&(z(a,"boolean",P,"allowClipboard"),this.Kq=a,this.g("allowClipboard",
b,a))}},allowCopy:{configurable:!0,get:function(){return this.Hh},set:function(a){var b=this.Hh;b!==a&&(z(a,"boolean",P,"allowCopy"),this.Hh=a,this.g("allowCopy",b,a))}},allowDelete:{configurable:!0,get:function(){return this.Ih},set:function(a){var b=this.Ih;b!==a&&(z(a,"boolean",P,"allowDelete"),this.Ih=a,this.g("allowDelete",b,a))}},allowDragOut:{configurable:!0,get:function(){return this.Lq},set:function(a){var b=this.Lq;b!==a&&(z(a,"boolean",P,"allowDragOut"),
this.Lq=a,this.g("allowDragOut",b,a))}},allowDrop:{configurable:!0,get:function(){return this.Mq},set:function(a){var b=this.Mq;b!==a&&(z(a,"boolean",P,"allowDrop"),this.Mq=a,this.g("allowDrop",b,a))}},allowTextEdit:{configurable:!0,get:function(){return this.Rh},set:function(a){var b=this.Rh;b!==a&&(z(a,"boolean",P,"allowTextEdit"),this.Rh=a,this.g("allowTextEdit",b,a))}},allowGroup:{configurable:!0,get:function(){return this.Jh},set:function(a){var b=this.Jh;
b!==a&&(z(a,"boolean",P,"allowGroup"),this.Jh=a,this.g("allowGroup",b,a))}},allowUngroup:{configurable:!0,get:function(){return this.Sh},set:function(a){var b=this.Sh;b!==a&&(z(a,"boolean",P,"allowUngroup"),this.Sh=a,this.g("allowUngroup",b,a))}},allowInsert:{configurable:!0,get:function(){return this.Oq},set:function(a){var b=this.Oq;b!==a&&(z(a,"boolean",P,"allowInsert"),this.Oq=a,this.g("allowInsert",b,a))}},allowLink:{configurable:!0,get:function(){return this.Kh},
set:function(a){var b=this.Kh;b!==a&&(z(a,"boolean",P,"allowLink"),this.Kh=a,this.g("allowLink",b,a))}},allowRelink:{configurable:!0,get:function(){return this.Mh},set:function(a){var b=this.Mh;b!==a&&(z(a,"boolean",P,"allowRelink"),this.Mh=a,this.g("allowRelink",b,a))}},allowMove:{configurable:!0,get:function(){return this.Lh},set:function(a){var b=this.Lh;b!==a&&(z(a,"boolean",P,"allowMove"),this.Lh=a,this.g("allowMove",b,a))}},allowReshape:{configurable:!0,
get:function(){return this.Nh},set:function(a){var b=this.Nh;b!==a&&(z(a,"boolean",P,"allowReshape"),this.Nh=a,this.g("allowReshape",b,a))}},allowResize:{configurable:!0,get:function(){return this.Oh},set:function(a){var b=this.Oh;b!==a&&(z(a,"boolean",P,"allowResize"),this.Oh=a,this.g("allowResize",b,a))}},allowRotate:{configurable:!0,get:function(){return this.Ph},set:function(a){var b=this.Ph;b!==a&&(z(a,"boolean",P,"allowRotate"),this.Ph=a,this.g("allowRotate",b,a))}},
allowSelect:{configurable:!0,get:function(){return this.Qh},set:function(a){var b=this.Qh;b!==a&&(z(a,"boolean",P,"allowSelect"),this.Qh=a,this.g("allowSelect",b,a))}},allowUndo:{configurable:!0,get:function(){return this.Pq},set:function(a){var b=this.Pq;b!==a&&(z(a,"boolean",P,"allowUndo"),this.Pq=a,this.g("allowUndo",b,a))}},allowZoom:{configurable:!0,get:function(){return this.Rq},set:function(a){var b=this.Rq;b!==a&&(z(a,"boolean",P,"allowZoom"),this.Rq=
a,this.g("allowZoom",b,a))}},hasVerticalScrollbar:{configurable:!0,get:function(){return this.Cr},set:function(a){var b=this.Cr;b!==a&&(z(a,"boolean",P,"hasVerticalScrollbar"),this.Cr=a,xj(this),this.S(),this.g("hasVerticalScrollbar",b,a),hj(this,!1))}},hasHorizontalScrollbar:{configurable:!0,get:function(){return this.Br},set:function(a){var b=this.Br;b!==a&&(z(a,"boolean",P,"hasHorizontalScrollbar"),this.Br=a,xj(this),this.S(),this.g("hasHorizontalScrollbar",b,a),hj(this,
!1))}},allowHorizontalScroll:{configurable:!0,get:function(){return this.Nq},set:function(a){var b=this.Nq;b!==a&&(z(a,"boolean",P,"allowHorizontalScroll"),this.Nq=a,this.g("allowHorizontalScroll",b,a),hj(this,!1))}},allowVerticalScroll:{configurable:!0,get:function(){return this.Qq},set:function(a){var b=this.Qq;b!==a&&(z(a,"boolean",P,"allowVerticalScroll"),this.Qq=a,this.g("allowVerticalScroll",b,a),hj(this,!1))}},scrollHorizontalLineChange:{configurable:!0,
get:function(){return this.vs},set:function(a){var b=this.vs;b!==a&&(z(a,"number",P,"scrollHorizontalLineChange"),0>a&&Ca(a,">= 0",P,"scrollHorizontalLineChange"),this.vs=a,this.g("scrollHorizontalLineChange",b,a))}},scrollVerticalLineChange:{configurable:!0,get:function(){return this.xs},set:function(a){var b=this.xs;b!==a&&(z(a,"number",P,"scrollVerticalLineChange"),0>a&&Ca(a,">= 0",P,"scrollVerticalLineChange"),this.xs=a,this.g("scrollVerticalLineChange",b,a))}},lastInput:{configurable:!0,
enumerable:!0,get:function(){return this.uj},set:function(a){E&&w(a,kf,P,"lastInput");this.uj=a}},firstInput:{configurable:!0,get:function(){return this.$h},set:function(a){E&&w(a,kf,P,"firstInput");this.$h=a}},currentCursor:{configurable:!0,get:function(){return this.dr},set:function(a){""===a&&(a=this.un);if(this.dr!==a){z(a,"string",P,"currentCursor");var b=this.Ea,c=this.Ja;if(null!==b){this.dr=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.un},set:function(a){""===a&&(a="auto");var b=this.un;b!==a&&(z(a,"string",P,"defaultCursor"),this.un=a,this.g("defaultCursor",b,a))}},click:{configurable:!0,get:function(){return this.Ef},set:function(a){var b=this.Ef;b!==
a&&(null!==a&&z(a,"function",P,"click"),this.Ef=a,this.g("click",b,a))}},doubleClick:{configurable:!0,get:function(){return this.Jf},set:function(a){var b=this.Jf;b!==a&&(null!==a&&z(a,"function",P,"doubleClick"),this.Jf=a,this.g("doubleClick",b,a))}},contextClick:{configurable:!0,get:function(){return this.Ff},set:function(a){var b=this.Ff;b!==a&&(null!==a&&z(a,"function",P,"contextClick"),this.Ff=a,this.g("contextClick",b,a))}},mouseOver:{configurable:!0,
get:function(){return this.$f},set:function(a){var b=this.$f;b!==a&&(null!==a&&z(a,"function",P,"mouseOver"),this.$f=a,this.g("mouseOver",b,a))}},mouseHover:{configurable:!0,get:function(){return this.Yf},set:function(a){var b=this.Yf;b!==a&&(null!==a&&z(a,"function",P,"mouseHover"),this.Yf=a,this.g("mouseHover",b,a))}},mouseHold:{configurable:!0,get:function(){return this.Xf},set:function(a){var b=this.Xf;b!==a&&(null!==a&&z(a,"function",P,"mouseHold"),this.Xf=a,this.g("mouseHold",
b,a))}},mouseDragOver:{configurable:!0,get:function(){return this.cs},set:function(a){var b=this.cs;b!==a&&(null!==a&&z(a,"function",P,"mouseDragOver"),this.cs=a,this.g("mouseDragOver",b,a))}},mouseDrop:{configurable:!0,get:function(){return this.Vf},set:function(a){var b=this.Vf;b!==a&&(E&&null!==a&&z(a,"function",P,"mouseDrop"),this.Vf=a,this.g("mouseDrop",b,a))}},handlesDragDropForTopLevelParts:{configurable:!0,get:function(){return this.Ar},set:function(a){var b=
this.Ar;b!==a&&(z(a,"boolean",P,"handlesDragDropForTopLevelParts"),this.Ar=a,this.g("handlesDragDropForTopLevelParts",b,a))}},mouseEnter:{configurable:!0,get:function(){return this.Wf},set:function(a){var b=this.Wf;b!==a&&(null!==a&&z(a,"function",P,"mouseEnter"),this.Wf=a,this.g("mouseEnter",b,a))}},mouseLeave:{configurable:!0,get:function(){return this.Zf},set:function(a){var b=this.Zf;b!==a&&(null!==a&&z(a,"function",P,"mouseLeave"),this.Zf=a,this.g("mouseLeave",b,a))}},
toolTip:{configurable:!0,get:function(){return this.lg},set:function(a){var b=this.lg;b!==a&&(!E||null===a||a instanceof Cf||a instanceof Hf||v("Diagram.toolTip must be an Adornment or HTMLInfo."),this.lg=a,this.g("toolTip",b,a))}},contextMenu:{configurable:!0,get:function(){return this.Gf},set:function(a){var b=this.Gf;b!==a&&(!E||a instanceof Cf||a instanceof Hf||v("Diagram.contextMenu must be an Adornment or HTMLInfo."),this.Gf=a,this.g("contextMenu",b,a))}},commandHandler:{configurable:!0,
enumerable:!0,get:function(){return this.L},set:function(a){this.L!==a&&(this.L=a,a.ib(this))}},toolManager:{configurable:!0,get:function(){return this.Wb},set:function(a){this.Wb!==a&&(w(a,$a,P,"toolManager"),this.Wb=a,a.ib(this))}},defaultTool:{configurable:!0,get:function(){return this.Ma},set:function(a){var b=this.Ma;b!==a&&(w(a,vf,P,"defaultTool"),this.Ma=a,a.ib(this),this.currentTool===b&&(this.currentTool=a))}},currentTool:{configurable:!0,get:function(){return this.ca},
set:function(a){var b=this.ca;null!==b&&(b.isActive&&b.doDeactivate(),b.cancelWaitAfter(),b.doStop());null===a&&(a=this.defaultTool);null!==a&&(w(a,vf,P,"currentTool"),this.ca=a,a.ib(this),a.doStart())}},selection:{configurable:!0,get:function(){return this.Iq}},maxSelectionCount:{configurable:!0,get:function(){return this.Yr},set:function(a){var b=this.Yr;if(b!==a)if(z(a,"number",P,"maxSelectionCount"),0<=a&&!isNaN(a)){if(this.Yr=a,this.g("maxSelectionCount",b,a),!this.undoManager.isUndoingRedoing&&
(a=this.selection.count-a,0<a)){this.ba("ChangingSelection",this.selection);b=this.selection.Oa();for(var c=0;c<a;c++)b[c].isSelected=!1;this.ba("ChangedSelection",this.selection)}}else Ca(a,">= 0",P,"maxSelectionCount")}},nodeSelectionAdornmentTemplate:{configurable:!0,get:function(){return this.fs},set:function(a){var b=this.fs;b!==a&&(w(a,Cf,P,"nodeSelectionAdornmentTemplate"),this.fs=a,this.g("nodeSelectionAdornmentTemplate",b,a))}},groupSelectionAdornmentTemplate:{configurable:!0,
enumerable:!0,get:function(){return this.yr},set:function(a){var b=this.yr;b!==a&&(w(a,Cf,P,"groupSelectionAdornmentTemplate"),this.yr=a,this.g("groupSelectionAdornmentTemplate",b,a))}},linkSelectionAdornmentTemplate:{configurable:!0,get:function(){return this.Ur},set:function(a){var b=this.Ur;b!==a&&(w(a,Cf,P,"linkSelectionAdornmentTemplate"),this.Ur=a,this.g("linkSelectionAdornmentTemplate",b,a))}},highlighteds:{configurable:!0,get:function(){return this.Gq}},isModified:{configurable:!0,
enumerable:!0,get:function(){var a=this.undoManager;return a.isEnabled?null!==a.currentTransaction?!0:this.w&&this.je!==a.historyIndex:this.w},set:function(a){if(this.w!==a){z(a,"boolean",P,"isModified");this.w=a;var b=this.undoManager;!a&&b.isEnabled&&(this.je=b.historyIndex);a||ik(this)}}},model:{configurable:!0,get:function(){return this.ac},set:function(a){var b=this.ac;if(b!==a){w(a,X,P,"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.");Ti(this,!0);this.ke=!1;this.bl=!0;this.je=-2;this.sd=!1;var c=this.$b;this.$b=!0;this.animationManager.Dh("Model");null!==b&&(null!==this.se&&this.se.each(function(a){b.tk(a)}),b.tk(this.Hm));this.ac=a;this.partManager=jk(this.ac.constructor.type);a.sh(this.Bg);this.partManager.addAllModeledParts();a.tk(this.Bg);a.sh(this.Hm);null!==this.se&&this.se.each(function(b){a.sh(b)});this.$b=c;this.pb||this.S();null!==b&&a.undoManager.copyProperties(b.undoManager)}}},
fa:{configurable:!0,get:function(){return this.Oc},set:function(a){this.Oc=a}},lt:{configurable:!0,get:function(){return this.Hq}},skipsModelSourceBindings:{configurable:!0,get:function(){return this.Fh},set:function(a){this.Fh=a}},vk:{configurable:!0,get:function(){return this.Cu},set:function(a){this.Cu=a}},nodeTemplate:{configurable:!0,get:function(){return this.ag.K("")},set:function(a){var b=this.ag.K("");b!==a&&(w(a,U,P,"nodeTemplate"),
this.ag.add("",a),this.g("nodeTemplate",b,a),this.undoManager.isUndoingRedoing||this.wd())}},nodeTemplateMap:{configurable:!0,get:function(){return this.ag},set:function(a){var b=this.ag;b!==a&&(w(a,Ub,P,"nodeTemplateMap"),this.ag=a,this.g("nodeTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.wd())}},groupTemplate:{configurable:!0,get:function(){return this.ai.K("")},set:function(a){var b=this.ai.K("");b!==a&&(w(a,xg,P,"groupTemplate"),this.ai.add("",a),this.g("groupTemplate",
b,a),this.undoManager.isUndoingRedoing||this.wd())}},groupTemplateMap:{configurable:!0,get:function(){return this.ai},set:function(a){var b=this.ai;b!==a&&(w(a,Ub,P,"groupTemplateMap"),this.ai=a,this.g("groupTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.wd())}},linkTemplate:{configurable:!0,get:function(){return this.Wg.K("")},set:function(a){var b=this.Wg.K("");b!==a&&(w(a,T,P,"linkTemplate"),this.Wg.add("",a),this.g("linkTemplate",b,a),this.undoManager.isUndoingRedoing||
this.wd())}},linkTemplateMap:{configurable:!0,get:function(){return this.Wg},set:function(a){var b=this.Wg;b!==a&&(w(a,Ub,P,"linkTemplateMap"),this.Wg=a,this.g("linkTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.wd())}},isMouseOverDiagram:{configurable:!0,get:function(){return this.Te},set:function(a){this.Te=a}},isMouseCaptured:{configurable:!0,get:function(){return this.Nc},set:function(a){var b=this.Ea;null!==b&&(b=b.Ha,b instanceof SVGElement||
(a?(this.lastInput.bubbles=!1,this.Sq?(this.removeEventListener(b,"pointermove",this.om,!1),this.removeEventListener(b,"pointerdown",this.nm,!1),this.removeEventListener(b,"pointerup",this.qm,!1),this.removeEventListener(b,"pointerout",this.pm,!1),this.addEventListener(ra,"pointermove",this.om,!0),this.addEventListener(ra,"pointerdown",this.nm,!0),this.addEventListener(ra,"pointerup",this.qm,!0),this.addEventListener(ra,"pointerout",this.pm,!0)):(this.removeEventListener(b,"mousemove",this.mk,!1),
this.removeEventListener(b,"mousedown",this.lk,!1),this.removeEventListener(b,"mouseup",this.pk,!1),this.removeEventListener(b,"mouseout",this.nk,!1),this.addEventListener(ra,"mousemove",this.mk,!0),this.addEventListener(ra,"mousedown",this.lk,!0),this.addEventListener(ra,"mouseup",this.pk,!0),this.addEventListener(ra,"mouseout",this.nk,!0)),this.removeEventListener(b,"wheel",this.qk,!1),this.addEventListener(ra,"wheel",this.qk,!0),this.addEventListener(ra,"selectstart",this.preventDefault,!1)):(this.Sq?
(this.removeEventListener(ra,"pointermove",this.om,!0),this.removeEventListener(ra,"pointerdown",this.nm,!0),this.removeEventListener(ra,"pointerup",this.qm,!0),this.removeEventListener(ra,"pointerout",this.pm,!0),this.addEventListener(b,"pointermove",this.om,!1),this.addEventListener(b,"pointerdown",this.nm,!1),this.addEventListener(b,"pointerup",this.qm,!1),this.addEventListener(b,"pointerout",this.pm,!1)):(this.removeEventListener(ra,"mousemove",this.mk,!0),this.removeEventListener(ra,"mousedown",
this.lk,!0),this.removeEventListener(ra,"mouseup",this.pk,!0),this.removeEventListener(ra,"mouseout",this.nk,!0),this.addEventListener(b,"mousemove",this.mk,!1),this.addEventListener(b,"mousedown",this.lk,!1),this.addEventListener(b,"mouseup",this.pk,!1),this.addEventListener(b,"mouseout",this.nk,!1)),this.removeEventListener(ra,"wheel",this.qk,!0),this.removeEventListener(ra,"selectstart",this.preventDefault,!1),this.addEventListener(b,"wheel",this.qk,!1)),this.Nc=a))}},position:{configurable:!0,
enumerable:!0,get:function(){return this.ua},set:function(a){var b=J.alloc().assign(this.ua);if(!b.A(a)){w(a,J,P,"position");var c=this.viewportBounds.copy();this.ua.assign(a);this.pb||null===this.Ea&&!this.Lp.o()||(this.pb=!0,a=this.scale,jj(this,this.zn,this.Aa/a,this.ya/a,this.gj,!1),this.pb=!1);ti(this.animationManager,b,this.ua);this.pb||this.sq(c,this.viewportBounds,this.Da,!1)}J.free(b)}},initialPosition:{configurable:!0,get:function(){return this.Er},set:function(a){this.Er.A(a)||
(w(a,J,P,"initialPosition"),this.Er=a.J())}},initialScale:{configurable:!0,get:function(){return this.Fr},set:function(a){this.Fr!==a&&(z(a,"number",P,"initialScale"),this.Fr=a)}},grid:{configurable:!0,get:function(){null===this.Hb&&Yi(this);return this.Hb},set:function(a){var b=this.Hb;if(b!==a){null===b&&(Yi(this),b=this.Hb);w(a,W,P,"grid");a.type!==W.Grid&&v("Diagram.grid must be a Panel of type Panel.Grid");var c=b.panel;null!==c&&c.remove(b);this.Hb=a;a.name="GRID";
null!==c&&c.add(a);Aj(this);this.S();this.g("grid",b,a)}}},viewportBounds:{configurable:!0,get:function(){var a=this.Tw,b=this.ua,c=this.Da;if(null===this.Ea)return this.Lp.o()&&a.h(b.x,b.y,this.Aa/c,this.ya/c),a;a.h(b.x,b.y,Math.max(this.Aa,0)/c,Math.max(this.ya,0)/c);return a}},viewSize:{configurable:!0,get:function(){return this.Lp},set:function(a){var b=this.viewSize;b.A(a)||(w(a,Zb,P,"viewSize"),this.Lp=a=a.J(),this.Aa=a.width,this.ya=a.height,this.Ya(),this.g("viewSize",
b,a))}},fixedBounds:{configurable:!0,get:function(){return this.vr},set:function(a){var b=this.vr;b.A(a)||(w(a,L,P,"fixedBounds"),(E&&Infinity===a.width||-Infinity===a.width||Infinity===a.height||-Infinity===a.height)&&v("fixedBounds width/height must not be Infinity"),this.vr=a=a.J(),this.Ya(),this.g("fixedBounds",b,a))}},scrollMargin:{configurable:!0,get:function(){return this.vi},set:function(a){"number"===typeof a?a=new Hc(a):w(a,Hc,P,"scrollMargin");var b=this.vi;
b.A(a)||(this.vi=a=a.J(),this.g("scrollMargin",b,a),this.wf())}},scrollMode:{configurable:!0,get:function(){return this.Kj},set:function(a){var b=this.Kj;b!==a&&(tb(a,P,P,"scrollMode"),this.Kj=a,a===Ei&&hj(this,!1),this.g("scrollMode",b,a),this.wf())}},scrollsPageOnFocus:{configurable:!0,get:function(){return this.ys},set:function(a){var b=this.ys;b!==a&&(z(a,"boolean",P,"scrollsPageOnFocus"),this.ys=a,this.g("scrollsPageOnFocus",b,a))}},positionComputation:{configurable:!0,
enumerable:!0,get:function(){return this.ps},set:function(a){var b=this.ps;b!==a&&(null!==a&&z(a,"function",P,"positionComputation"),this.ps=a,hj(this,!1),this.g("positionComputation",b,a))}},scaleComputation:{configurable:!0,get:function(){return this.ts},set:function(a){var b=this.ts;b!==a&&(null!==a&&z(a,"function",P,"scaleComputation"),this.ts=a,gk(this,this.scale,this.scale),this.g("scaleComputation",b,a))}},documentBounds:{configurable:!0,get:function(){return this.zn}},
isVirtualized:{configurable:!0,get:function(){return this.Pr},set:function(a){var b=this.Pr;b!==a&&(z(a,"boolean",P,"isVirtualized"),this.Pr=a,this.g("isVirtualized",b,a))}},scale:{configurable:!0,get:function(){return this.Da},set:function(a){var b=this.Da;B(a,P,"scale");b!==a&&gk(this,b,a)}},defaultScale:{configurable:!0,get:function(){return this.kr},set:function(a){E&&B(a,P,"defaultScale");!E||0<a||v("defaultScale must be larger than zero, not: "+a);this.kr=
a}},autoScale:{configurable:!0,get:function(){return this.ej},set:function(a){var b=this.ej;b!==a&&(tb(a,P,P,"autoScale"),this.ej=a,this.g("autoScale",b,a),a!==Fi&&hj(this,!1))}},initialAutoScale:{configurable:!0,get:function(){return this.di},set:function(a){var b=this.di;b!==a&&(tb(a,P,P,"initialAutoScale"),this.di=a,this.g("initialAutoScale",b,a))}},initialViewportSpot:{configurable:!0,get:function(){return this.Gr},set:function(a){var b=this.Gr;b!==a&&
(w(a,M,P,"initialViewportSpot"),a.Za()||v("initialViewportSpot must be a specific Spot: "+a),this.Gr=a,this.g("initialViewportSpot",b,a))}},initialDocumentSpot:{configurable:!0,get:function(){return this.Dr},set:function(a){var b=this.Dr;b!==a&&(w(a,M,P,"initialDocumentSpot"),a.Za()||v("initialViewportSpot must be a specific Spot: "+a),this.Dr=a,this.g("initialDocumentSpot",b,a))}},minScale:{configurable:!0,get:function(){return this.Zr},set:function(a){B(a,P,"minScale");
var b=this.Zr;b!==a&&(0<a?(this.Zr=a,this.g("minScale",b,a),a>this.scale&&(this.scale=a)):Ca(a,"> 0",P,"minScale"))}},maxScale:{configurable:!0,get:function(){return this.Xr},set:function(a){B(a,P,"maxScale");var b=this.Xr;b!==a&&(0<a?(this.Xr=a,this.g("maxScale",b,a),a<this.scale&&(this.scale=a)):Ca(a,"> 0",P,"maxScale"))}},zoomPoint:{configurable:!0,get:function(){return this.Os},set:function(a){this.Os.A(a)||(w(a,J,P,"zoomPoint"),this.Os=a=a.J())}},contentAlignment:{configurable:!0,
enumerable:!0,get:function(){return this.gj},set:function(a){var b=this.gj;b.A(a)||(w(a,M,P,"contentAlignment"),this.gj=a=a.J(),this.g("contentAlignment",b,a),hj(this,!1))}},initialContentAlignment:{configurable:!0,get:function(){return this.Sn},set:function(a){var b=this.Sn;b.A(a)||(w(a,M,P,"initialContentAlignment"),this.Sn=a=a.J(),this.g("initialContentAlignment",b,a))}},padding:{configurable:!0,get:function(){return this.gb},set:function(a){"number"===typeof a?a=new Hc(a):
w(a,Hc,P,"padding");var b=this.gb;b.A(a)||(this.gb=a=a.J(),this.Ya(),this.g("padding",b,a))}},partManager:{configurable:!0,get:function(){return this.Na},set:function(a){var b=this.Na;b!==a&&(w(a,Ji,P,"partManager"),null!==a.diagram&&v("Cannot share PartManagers between Diagrams: "+a.toString()),null!==b&&b.ib(null),this.Na=a,a.ib(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.ic},set:function(a){var b=this.ic;b!==a&&(w(a,Oi,P,"layout"),this.ic=a,a.diagram=this,a.group=null,this.Eg=!0,this.g("layout",b,a),this.ec())}},isTreePathToChildren:{configurable:!0,get:function(){return this.Or},set:function(a){var b=this.Or;if(b!==a&&(z(a,"boolean",P,"isTreePathToChildren"),this.Or=a,this.g("isTreePathToChildren",
b,a),!this.undoManager.isUndoingRedoing))for(a=this.nodes;a.next();)Lk(a.value)}},treeCollapsePolicy:{configurable:!0,get:function(){return this.Js},set:function(a){var b=this.Js;b!==a&&(a!==Hi&&a!==Mk&&a!==Nk&&v("Unknown Diagram.treeCollapsePolicy: "+a),this.Js=a,this.g("treeCollapsePolicy",b,a))}},Ie:{configurable:!0,get:function(){return this.Xb},set:function(a){this.Xb=a}},autoScrollInterval:{configurable:!0,get:function(){return this.Xm},set:function(a){var b=
this.Xm;B(a,P,"scale");b!==a&&(this.Xm=a,this.g("autoScrollInterval",b,a))}},autoScrollRegion:{configurable:!0,get:function(){return this.Ym},set:function(a){"number"===typeof a?a=new Hc(a):w(a,Hc,P,"autoScrollRegion");var b=this.Ym;b.A(a)||(this.Ym=a=a.J(),this.Ya(),this.g("autoScrollRegion",b,a))}}});na.Object.defineProperties(P,{licenseKey:{configurable:!0,get:function(){return Ok.Ub()},set:function(a){Ok.add(a)}},version:{configurable:!0,get:function(){return Pk}}});
P.prototype.makeImageData=P.prototype.yx;P.prototype.makeImage=P.prototype.Lz;P.prototype.addRenderer=P.prototype.qy;P.prototype.makeSVG=P.prototype.uv;P.prototype.makeSvg=P.prototype.nt;P.prototype.stopAutoScroll=P.prototype.zf;P.prototype.doAutoScroll=P.prototype.Ts;P.prototype.isUnoccupied=P.prototype.ik;P.prototype.raiseDiagramEvent=P.prototype.ba;P.prototype.removeDiagramListener=P.prototype.sm;P.prototype.addDiagramListener=P.prototype.Rj;P.prototype.findTreeRoots=P.prototype.jz;
P.prototype.layoutDiagram=P.prototype.Jz;P.prototype.findTopLevelGroups=P.prototype.cz;P.prototype.findTopLevelNodesAndLinks=P.prototype.dz;P.prototype.findLinksByExample=P.prototype.Ws;P.prototype.findNodesByExample=P.prototype.Xs;P.prototype.findLinkForData=P.prototype.wc;P.prototype.findNodeForData=P.prototype.Ji;P.prototype.findPartForData=P.prototype.xc;P.prototype.findNodeForKey=P.prototype.Kb;P.prototype.findPartForKey=P.prototype.findPartForKey;P.prototype.rebuildParts=P.prototype.wd;
P.prototype.transformViewToDoc=P.prototype.Dt;P.prototype.transformRectDocToView=P.prototype.jA;P.prototype.transformDocToView=P.prototype.Ct;P.prototype.centerRect=P.prototype.Pu;P.prototype.scrollToRect=P.prototype.Nv;P.prototype.scroll=P.prototype.scroll;P.prototype.highlightCollection=P.prototype.zz;P.prototype.highlight=P.prototype.yz;P.prototype.clearHighlighteds=P.prototype.Ru;P.prototype.selectCollection=P.prototype.Ov;P.prototype.select=P.prototype.select;P.prototype.clearSelection=P.prototype.Vp;
P.prototype.updateAllRelationshipsFromData=P.prototype.Dq;P.prototype.updateAllTargetBindings=P.prototype.updateAllTargetBindings;P.prototype.commit=P.prototype.commit;P.prototype.rollbackTransaction=P.prototype.yf;P.prototype.commitTransaction=P.prototype.ab;P.prototype.startTransaction=P.prototype.Ca;P.prototype.raiseChanged=P.prototype.g;P.prototype.raiseChangedEvent=P.prototype.cb;P.prototype.removeChangedListener=P.prototype.tk;P.prototype.addChangedListener=P.prototype.sh;
P.prototype.removeModelChangedListener=P.prototype.Zz;P.prototype.addModelChangedListener=P.prototype.Zw;P.prototype.findLayer=P.prototype.dm;P.prototype.removeLayer=P.prototype.Xz;P.prototype.addLayerAfter=P.prototype.my;P.prototype.addLayerBefore=P.prototype.Xw;P.prototype.addLayer=P.prototype.Vl;P.prototype.moveParts=P.prototype.moveParts;P.prototype.copyParts=P.prototype.ak;P.prototype.removeParts=P.prototype.wt;P.prototype.remove=P.prototype.remove;P.prototype.add=P.prototype.add;
P.prototype.clearDelayedGeometries=P.prototype.Qu;P.prototype.setProperties=P.prototype.Uv;P.prototype.resetInputOptions=P.prototype.Kv;P.prototype.setInputOption=P.prototype.cA;P.prototype.getInputOption=P.prototype.gm;P.prototype.resetRenderingHints=P.prototype.Lv;P.prototype.setRenderingHint=P.prototype.Ox;P.prototype.getRenderingHint=P.prototype.He;P.prototype.maybeUpdate=P.prototype.hd;P.prototype.requestUpdate=P.prototype.ec;P.prototype.delayInitialization=P.prototype.Gy;
P.prototype.isUpdateRequested=P.prototype.Fz;P.prototype.redraw=P.prototype.wf;P.prototype.invalidateDocumentBounds=P.prototype.Ya;P.prototype.findObjectsNear=P.prototype.sg;P.prototype.findPartsNear=P.prototype.$y;P.prototype.findObjectsIn=P.prototype.rg;P.prototype.findPartsIn=P.prototype.px;P.prototype.findObjectsAt=P.prototype.Ki;P.prototype.findPartsAt=P.prototype.Zy;P.prototype.findObjectAt=P.prototype.Tb;P.prototype.findPartAt=P.prototype.em;P.prototype.alignDocument=P.prototype.sy;
P.prototype.zoomToRect=P.prototype.mA;P.prototype.zoomToFit=P.prototype.zoomToFit;P.prototype.diagramScroll=P.prototype.jx;P.prototype.focus=P.prototype.focus;P.prototype.reset=P.prototype.reset;P.useDOM=function(a){Ih=a?void 0!==ra.document:!1};P.isUsingDOM=function(){return Ih};
var yf=null,Ii=new Ub,Wi=null,Vi=null,Ih=void 0!==ra.document,Ri=null,Si="",Fi=new D(P,"None",0),lj=new D(P,"Uniform",1),mj=new D(P,"UniformToFill",2),Jg=new D(P,"CycleAll",10),Ng=new D(P,"CycleNotDirected",11),Pg=new D(P,"CycleNotDirectedFast",12),Qg=new D(P,"CycleNotUndirected",13),Kg=new D(P,"CycleDestinationTree",14),Mg=new D(P,"CycleSourceTree",15),Ei=new D(P,"DocumentScroll",1),Nj=new D(P,"InfiniteScroll",2),Hi=new D(P,"TreeParentCollapsed",21),Mk=new D(P,"AllParentsCollapsed",22),Nk=new D(P,
"AnyParentsCollapsed",23),Ok=new F,Pk="2.0.16",Kk=!1,Qk=null,Ci=!1;
function Di(){if(Ih){var a=ra.document.createElement("canvas"),b=a.getContext("2d"),c=eb("7ca11abfd022028846");b[c]=eb("398c3597c01238");for(var d=["5da73c80a36455d4038e4972187c3cae51fd22",sa.Dx+"4ae6247590da4bb21c324ba3a84e385776",$b.xF+"fb236cdfda5de14c134ba1a95a2d4c7cc6f93c1387",K.za],e=1;5>e;e++)b[eb("7ca11abfd7330390")](eb(d[e-1]),10,15*e);b[c]=eb("39f046ebb36e4b");for(c=1;5>c;c++)b[eb("7ca11abfd7330390")](eb(d[c-1]),10,15*c);Qk=a}}P.className="Diagram";
P.fromDiv=function(a){var b=a;"string"===typeof a&&(b=ra.document.getElementById(a));return b instanceof HTMLDivElement&&b.D instanceof P?b.D:null};P.inherit=function(a,b){function c(){}if(Object.getPrototypeOf(a).prototype)throw Error("Used go.Diagram.inherit defining already defined class \n"+a);z(a,"function",P,"inherit");z(b,"function",P,"inherit");c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a};P.None=Fi;P.Uniform=lj;P.UniformToFill=mj;P.CycleAll=Jg;P.CycleNotDirected=Ng;
P.CycleNotDirectedFast=Pg;P.CycleNotUndirected=Qg;P.CycleDestinationTree=Kg;P.CycleSourceTree=Mg;P.DocumentScroll=Ei;P.InfiniteScroll=Nj;P.TreeParentCollapsed=Hi;P.AllParentsCollapsed=Mk;P.AnyParentsCollapsed=Nk;function Pi(){this.hy=null;this.l="zz@orderNum";"63ad05bbe23a1786468a4c741b6d2"===this._tk?this.Qe=this.l=!0:this.Qe=null}
function Jj(a,b){b.$c.setTransform(b.Pb,0,0,b.Pb,0,0);if(null===a.Qe){b="f";var c=ra[eb("76a715b2f73f148a")][eb("72ba13b5")];a.Qe=!0;if(Ih){var d=P[eb("76a115b6ed251eaf4692")];if(d)for(var e=Ok.iterator;e.next();){d=e.value;d=eb(d).split(eb("39e9"));if(6>d.length)break;var f=eb(d[1]).split(".");if("7da71ca0"!==d[4])break;var g=eb(sa[eb("6cae19")]).split(".");if(f[0]>g[0]||f[0]===g[0]&&f[1]>=g[1]){f=c[eb("76ad18b4f73e")];for(g=c[eb("73a612b6fb191d")](eb("35e7"))+2;g<f;g++)b+=c[g];f=b[eb("73a612b6fb191d")](eb(d[2]));
0>f&&eb(d[2])!==eb("7da71ca0ad381e90")&&(f=b[eb("73a612b6fb191d")](eb("76a715b2ef3e149757")));0>f&&(f=b[eb("73a612b6fb191d")](eb("76a715b2ef3e149757")));a.Qe=!(0<=f&&f<b[eb("73a612b6fb191d")](eb("35")));if(!a.Qe)break;f=eb(d[2]);if("#"!==f[0])break;g=ra.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[eb("79a417a0f0181a8946")]=
d;if(ra.document[eb("78a712aa")]){ra.document[eb("78a712aa")][eb("7bb806b6ed32388c4a875b")](g);h=ra.getComputedStyle(g).getPropertyValue(eb("78a704b7e62456904c9b12701b6532a8"));ra.document[eb("78a712aa")][eb("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.Qe=!1;break}else if(fb||gb||ib||jb)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.Qe=!1;break}}}else a.Qe=null,a.Qe=!1}}else{k=c[eb("76ad18b4f73e")];for(e=c[eb("73a612b6fb191d")](eb("35e7"))+2;e<k;e++)b+=c[e];c=b[eb("73a612b6fb191d")](eb("7da71ca0ad381e90"));a.Qe=!(0<=c&&c<b[eb("73a612b6fb191d")](eb("35")))}}}return 0<a.Qe&&a!==a.hy?!0:!1}
function Qi(a,b){if(Ih){void 0!==b&&null!==b||v("Diagram setup requires an argument DIV.");null!==a.Ja&&v("Diagram has already completed setup.");"string"===typeof b?a.Ja=ra.document.getElementById(b):b instanceof HTMLDivElement?a.Ja=b:v("No DIV or DIV id supplied: "+b);null===a.Ja&&v("Invalid DIV id; could not get element with id: "+b);void 0!==a.Ja.D&&v("Invalid div id; div already has a Diagram associated with it.");"static"===ra.getComputedStyle(a.Ja,null).position&&(a.Ja.style.position="relative");
a.Ja.style["-webkit-tap-highlight-color"]="rgba(255, 255, 255, 0)";a.Ja.style["-ms-touch-action"]="none";a.Ja.innerHTML="";a.Ja.D=a;var c=a.Gs?new Oj(a):new Jk(a);void 0!==c.style&&(c.style.position="absolute",c.style.top="0px",c.style.left="0px","rtl"===ra.getComputedStyle(a.Ja,null).getPropertyValue("direction")&&(a.Xn=!0),c.style.zIndex="2",c.style.userSelect="none",c.style.webkitUserSelect="none",c.style.MozUserSelect="none");a.Ea=c;a.$c=c.context;b=a.$c;a.Pb=a.computePixelRatio();a.Aa=a.Ja.clientWidth||
1;a.ya=a.Ja.clientHeight||1;Qj(a,a.Aa,a.ya);a.pr=b.Y[eb("7eba17a4ca3b1a8346")][eb("78a118b7")](b.Y,Qk,4,4);a.Ja.insertBefore(c.Ha,a.Ja.firstChild);c=new Jk(null);c.width=1;c.height=1;a.Zt=c;a.Aw=c.context;if(Ih){c=ya("div");var d=ya("div");c.style.position="absolute";c.style.overflow="auto";c.style.width=a.Aa+"px";c.style.height=a.ya+"px";c.style.zIndex="1";d.style.position="absolute";d.style.width="1px";d.style.height="1px";a.Ja.appendChild(c);c.appendChild(d);c.onscroll=Zi;c.onmousedown=dj;c.ontouchstart=
dj;c.D=a;c.ey=!0;c.gy=!0;a.ws=c;a.mp=d}a.tt=va(function(){a.kh=null;a.S()},300);a.gw=va(function(){ii(a)},250);a.preventDefault=function(a){a.preventDefault();return!1};a.mk=function(b){if(a.isEnabled){a.Te=!0;var c=qj(a,b,!0);a.doMouseMove();a.currentTool.isBeyondDragSize()&&(a.Hd=0);wj(a,c,b)}};a.lk=function(b){if(a.isEnabled)if(a.Te=!0,a.Ue)b.preventDefault();else{var c=qj(a,b,!0);c.down=!0;c.clickCount=b.detail;if(gb||ib)b.timeStamp-a.pl<a.Hu&&!a.currentTool.isBeyondDragSize()?a.Hd++:a.Hd=1,a.pl=
b.timeStamp,c.clickCount=a.Hd;c.clone(a.firstInput);a.doMouseDown();1===b.button?b.preventDefault():wj(a,c,b)}};a.pk=function(b){if(a.isEnabled)if(a.Ue&&2===b.button)b.preventDefault();else if(a.Ue&&0===b.button&&(a.Ue=!1),a.Rl)b.preventDefault();else{a.Te=!0;var c=qj(a,b,!0);c.up=!0;c.clickCount=b.detail;if(gb||ib)c.clickCount=a.Hd;c.bubbles=b.bubbles;c.targetDiagram=sj(b);a.doMouseUp();a.zf();wj(a,c,b)}};a.qk=function(b){if(a.isEnabled){var c=qj(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();wj(a,c,b)}};a.nk=function(b){a.isEnabled&&(a.Te=!1,qj(a,b,!0),b=a.currentTool,b.cancelWaitAfter(),b.standardMouseOver())};
a.aw=function(b){if(a.isEnabled){a.Rl=!1;a.Ue=!0;var c=tj(a,b,b.targetTouches[0],1<b.touches.length),d=null;0<b.targetTouches.length?d=b.targetTouches[0]:0<b.changedTouches.length&&(d=b.changedTouches[0]);if(null!==d){var e=d.screenX;d=d.screenY;var k=a.Rr;b.timeStamp-a.pl<a.Hu&&!(25<Math.abs(k.x-e)||25<Math.abs(k.y-d))?a.Hd++:a.Hd=1;c.clickCount=a.Hd;a.pl=b.timeStamp;a.Rr.h(e,d)}a.doMouseDown();wj(a,c,b)}};a.$v=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=vj(a,b,c,1<b.touches.length);a.doMouseMove();wj(a,c,b)}};a.Zv=function(b){if(a.isEnabled)if(a.Rl)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=uj(a,b,!1,!0,!1,!1);null!==d&&(c=ra.document.elementFromPoint(d.clientX,d.clientY),null!==c&&c.D instanceof P&&c.D!==a&&rj(c.D,d,e),rj(a,d,e),e.clickCount=a.Hd);null===c?e.targetDiagram=
sj(b):c.D?e.targetDiagram=c.D:e.targetDiagram=null;e.targetObject=null;a.doMouseUp();wj(a,e,b);a.Ue=!1}};a.nm=function(b){if(a.isEnabled){a.Te=!0;var c=a.tu;void 0===c[b.pointerId]&&(c[b.pointerId]=b);c=a.Al;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.Rl=!1,a.Ue=!0;c=tj(a,b,b,d);
d=a.Rr;var e="touch"===b.pointerType||"pen"===b.pointerType?25:10;b.timeStamp-a.pl<a.Hu&&!(Math.abs(d.x-b.screenX)>e||Math.abs(d.y-b.screenY)>e)?a.Hd++:a.Hd=1;c.clickCount=a.Hd;a.pl=b.timeStamp;a.Rr.yg(b.screenX,b.screenY);a.doMouseDown();1===b.button?b.preventDefault():wj(a,c,b)}};a.om=function(b){if(a.isEnabled){a.Te=!0;var c=a.Al;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=vj(a,b,b,null!==c[1]),a.doMouseMove(),wj(a,c,b))}};a.qm=function(b){if(a.isEnabled){a.Te=!0;var c="touch"===b.pointerType||"pen"===b.pointerType,d=a.tu;if(c&&a.Rl)delete d[b.pointerId],b.preventDefault();else if(d=a.Al,null!==d[0]&&d[0].pointerId===b.pointerId){d[0]=null;d=uj(a,b,!1,!0,!0,!1);var e=ra.document.elementFromPoint(b.clientX,b.clientY);null!==e&&e.D instanceof P&&e.D!==a&&rj(e.D,b,d);rj(a,b,d);d.clickCount=a.Hd;null===e?d.targetDiagram=sj(b):e.D?d.targetDiagram=e.D:d.targetDiagram=
null;d.targetObject=null;a.doMouseUp();wj(a,d,b);c&&(a.Ue=!1)}else null!==d[1]&&d[1].pointerId===b.pointerId&&(d[1]=null)}};a.pm=function(b){if(a.isEnabled){a.Te=!1;var c=a.tu;c[b.pointerId]&&delete c[b.pointerId];c=a.Al;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.Uc(!0);Xi(a)}}Pi.className="DiagramHelper";
function bg(a){this.l=void 0===a?new J:a;this.w=new J}na.Object.defineProperties(bg.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}}});bg.className="DraggingInfo";function bk(a,b,c){this.node=a;this.info=b;this.nv=c}bk.className="DraggingNodeInfoPair";function Lf(){this.reset()}
Lf.prototype.reset=function(){this.isGridSnapEnabled=!1;this.isGridSnapRealtime=!0;this.gridSnapCellSize=(new Zb(NaN,NaN)).freeze();this.gridSnapCellSpot=fd;this.gridSnapOrigin=(new J(NaN,NaN)).freeze();this.wz=this.dragsTree=this.dragsLink=!1;this.vz=!0};
function Rk(a){1<arguments.length&&v("Palette constructor can only take one optional argument, the DIV HTML element or its id.");P.call(this,a);this.allowDragOut=!0;this.allowMove=!1;this.isReadOnly=!0;this.contentAlignment=gd;this.layout=new Sk}ma(Rk,P);Rk.className="Palette";
function Tk(a){1<arguments.length&&v("Overview constructor can only take one optional argument, the DIV HTML element or its id.");P.call(this,a);this.animationManager.isEnabled=!1;this.pb=!0;this.bg=null;this.qr=!0;this.Ox("drawShadows",!1);var b=new U,c=new Hg;c.stroke="magenta";c.strokeWidth=2;c.fill="transparent";c.name="BOXSHAPE";b.selectable=!0;b.selectionAdorned=!1;b.selectionObjectName="BOXSHAPE";b.locationObjectName="BOXSHAPE";b.resizeObjectName="BOXSHAPE";b.cursor="move";b.add(c);this.l=
b;this.allowDelete=this.allowCopy=!1;this.allowSelect=!0;this.autoScrollRegion=new Hc(0,0,0,0);this.Eu=new Jk(null);this.iy=this.Eu.context;If(this.toolManager,"Dragging",new Uk,this.toolManager.mouseMoveTools);var d=this;this.click=function(){var a=d.bg;if(null!==a){var b=a.viewportBounds,c=d.lastInput.documentPoint;a.position=new J(c.x-b.width/2,c.y-b.height/2)}};this.Lm=function(){d.Ya();Vk(d)};this.Jm=function(){null!==d.bg&&(d.Ya(),d.S())};this.Km=function(){d.S()};this.Im=function(){null!==
d.bg&&Vk(d)};this.autoScale=lj;this.pb=!1}ma(Tk,P);
function Wk(a){a.pb||a.$b||!1!==a.sd||(a.sd=!0,ra.requestAnimationFrame(function(){if(a.sd&&!a.$b&&(a.sd=!1,null!==a.Ja)){a.$b=!0;fj(a);a.documentBounds.o()||kj(a,a.computeBounds());null===a.Ja&&v("No div specified");null===a.Ea&&v("No canvas specified");wi(a.box);if(a.oc){var b=a.bg;if(null!==b&&!b.animationManager.isAnimating&&!b.animationManager.sb){b=a.$c;var c=a.Eu;b.setTransform(1,0,0,1,0,0);b.clearRect(0,0,a.Ea.width,a.Ea.height);b.drawImage(c.Ha,0,0);c=a.ub;c.reset();1!==a.scale&&c.scale(a.scale);
0===a.position.x&&0===a.position.y||c.translate(-a.position.x,-a.position.y);b.scale(a.Pb,a.Pb);b.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy);c=a.Ra.j;for(var d=c.length,e=0;e<d;e++)c[e].jc(b,a);a.ei=!1;a.oc=!1}}a.$b=!1}}))}Tk.prototype.computePixelRatio=function(){return 1};
Tk.prototype.jc=function(){null===this.Ja&&v("No div specified");null===this.Ea&&v("No canvas specified");if(!(this.Ea instanceof Oj)&&(wi(this.box),this.oc)){var a=this.bg;if(null!==a&&!a.animationManager.isAnimating){Hj(this);var b=a.grid;null===b||!b.visible||isNaN(b.width)||isNaN(b.height)||(b=L.alloc().assign(this.viewportBounds).Lc(a.viewportBounds),Aj(a,b),L.free(b),fj(a));var c=this.Ea;b=this.$c;var d=this.Eu,e=this.iy;d.width=c.width;d.height=c.height;b.Uc(!0);b.setTransform(1,0,0,1,0,0);
b.clearRect(0,0,c.width,c.height);var f=this.ub;f.reset();1!==this.scale&&f.scale(this.scale);0===this.position.x&&0===this.position.y||f.translate(-this.position.x,-this.position.y);b.scale(this.Pb,this.Pb);b.transform(f.m11,f.m12,f.m21,f.m22,f.dx,f.dy);var g=this.qr,h=this.viewportBounds;a=a.Ra.j;for(var k=a.length,l=0;l<k;l++){var m=a[l],n=g;if(m.visible&&0!==m.mb&&(void 0===n&&(n=!0),n||!m.isTemporary)){1!==m.mb&&(b.globalAlpha=m.mb);n=this.scale;m=m.Ga.j;for(var p=m.length,q=0;q<p;q++){var r=
m[q],u=r.actualBounds;u.Kc(h)&&(u.width*n>this.re||u.height*n>this.re?r.jc(b,this):yi(b,r))}b.globalAlpha=1}}e.drawImage(c.Ha,0,0);E&&E.Gi&&(e.fillStyle="red",e.fillRect(0,d.height/2,d.width,4));c=this.Ra.j;d=c.length;for(e=0;e<d;e++)c[e].jc(b,this);E&&(E.av||E.Gi)&&E.Yp&&E.Yp(b,this,f);this.oc=this.ei=!1}}};
function Vk(a){var b=a.box;if(null!==b){var c=a.bg;if(null!==c){a.oc=!0;c=c.viewportBounds;var d=b.selectionObject,e=Zb.alloc();e.h(c.width,c.height);d.desiredSize=e;Zb.free(e);a=2/a.scale;d instanceof Hg&&(d.strokeWidth=a);b.location=new J(c.x-a/2,c.y-a/2);b.isSelected=!0}}}Tk.prototype.computeBounds=function(){var a=this.bg;if(null===a)return Tc;var b=a.documentBounds.copy();b.Lc(a.viewportBounds);return b};Tk.prototype.vx=function(){!0!==this.oc&&(this.oc=!0,Wk(this))};
Tk.prototype.sq=function(a,b,c,d){this.pb||(ej(this),this.S(),xj(this),this.Ya(),Vk(this),this.Be.scale=c,this.Be.position.x=a.x,this.Be.position.y=a.y,this.Be.bounds.assign(a),this.Be.xx=d,this.ba("ViewportBoundsChanged",this.Be,a))};
na.Object.defineProperties(Tk.prototype,{observed:{configurable:!0,get:function(){return this.bg},set:function(a){var b=this.bg;null!==a&&w(a,P,Tk,"observed");a instanceof Tk&&v("Overview.observed Diagram may not be an Overview itself: "+a);b!==a&&(null!==b&&(this.remove(this.box),b.sm("ViewportBoundsChanged",this.Lm),b.sm("DocumentBoundsChanged",this.Jm),b.sm("InvalidateDraw",this.Km),b.sm("AnimationFinished",this.Im)),this.bg=a,null!==a&&(a.Rj("ViewportBoundsChanged",this.Lm),a.Rj("DocumentBoundsChanged",
this.Jm),a.Rj("InvalidateDraw",this.Km),a.Rj("AnimationFinished",this.Im),this.add(this.box),Vk(this)),this.Ya(),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),Vk(this),this.g("box",b,a))}},drawsTemporaryLayers:{configurable:!0,get:function(){return this.qr},set:function(a){this.qr!==a&&(this.qr=a,this.wf())}}});Tk.className="Overview";
function Uk(){Kf.call(this);this.l=null}ma(Uk,Kf);
Uk.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};
Uk.prototype.doActivate=function(){this.l=null;Kf.prototype.doActivate.call(this)};Uk.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)}}};Uk.className="OverviewDraggingTool";
function Xk(){0<arguments.length&&Da(Xk);qb(this);this.D=yf;this.Wb=this.L=this.w=!0;this.ca=this.Ma=this.Xb=this.Na=!1;this.mi=this.l=null;this.Oc=1.05;this.ku=NaN;this.Gw=null;this.Ku=NaN;this.Ju=Tc;this.hg=null;this.Nc=200}Xk.prototype.toString=function(){return"CommandHandler"};Xk.prototype.ib=function(a){this.D=a};
Xk.prototype.doKeyDown=function(){var a=this.diagram,b=a.lastInput,c=kb?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()};
Xk.prototype.doKeyUp=function(){this.diagram.lastInput.bubbles=!0};Xk.prototype.stopCommand=function(){var a=this.diagram,b=a.currentTool;b instanceof $a&&a.allowSelect&&a.Vp();null!==b&&b.doCancel()};Xk.prototype.canStopCommand=function(){return!0};
Xk.prototype.selectAll=function(){var a=this.diagram;a.S();try{a.currentCursor="wait";a.ba("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.ba("ChangedSelection",a.selection),a.currentCursor=""}};Xk.prototype.canSelectAll=function(){return this.diagram.allowSelect};
Xk.prototype.deleteSelection=function(){var a=this.diagram;try{a.currentCursor="wait";a.Ca("Delete");a.ba("ChangingSelection",a.selection);a.ba("SelectionDeleting",a.selection);for(var b=new H,c=a.selection.iterator;c.next();)Yk(b,c.value,!0,this.deletesTree?Infinity:0,this.deletesConnectedLinks?null:!1,function(a){return a.canDelete()});E&&!0===E.animationExperiments&&a.animationManager.Dh("Remove",{duration:300,Qy:gi});a.wt(b,!0);a.ba("SelectionDeleted",b)}finally{a.ba("ChangedSelection",a.selection),
a.ab("Delete"),a.currentCursor=""}};Xk.prototype.canDeleteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowDelete||0===a.selection.count?!1:!0};Xk.prototype.copySelection=function(){var a=this.diagram,b=new H;for(a=a.selection.iterator;a.next();)Yk(b,a.value,!0,this.copiesTree?Infinity:0,this.copiesConnectedLinks,function(a){return a.canCopy()});this.copyToClipboard(b)};
Xk.prototype.canCopySelection=function(){var a=this.diagram;return a.allowCopy&&a.allowClipboard&&0!==a.selection.count?!0:!1};Xk.prototype.cutSelection=function(){this.copySelection();this.deleteSelection()};Xk.prototype.canCutSelection=function(){var a=this.diagram;return!a.isReadOnly&&!a.isModelReadOnly&&a.allowCopy&&a.allowDelete&&a.allowClipboard&&0!==a.selection.count?!0:!1};
Xk.prototype.copyToClipboard=function(a){var b=this.diagram,c=null;if(null===a)Ri=null,Si="";else{c=b.model;var d=!1,e=!1,f=null;try{c.km()&&(d=c.$j,c.$j=this.copiesParentKey),c.hk()&&(e=c.Zj,c.Zj=this.copiesGroupKey),f=b.ak(a,null,!0)}finally{c.km()&&(c.$j=d),c.hk()&&(c.Zj=e),c=new F,c.addAll(f),Ri=c,Si=b.model.dataFormat}}b.ba("ClipboardChanged",c)};
Xk.prototype.pasteFromClipboard=function(){var a=new H,b=Ri;if(null===b)return a;var c=this.diagram;if(Si!==c.model.dataFormat)return a;var d=c.model,e=!1,f=!1,g=null;try{d.km()&&(e=d.$j,d.$j=this.copiesParentKey),d.hk()&&(f=d.Zj,d.Zj=this.copiesGroupKey),g=c.ak(b,c,!1)}finally{for(d.km()&&(d.$j=e),d.hk()&&(d.Zj=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};
Xk.prototype.pasteSelection=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.currentCursor="wait";b.Ca("Paste");b.ba("ChangingSelection",b.selection);var c=this.pasteFromClipboard();0<c.count&&Mf(b);for(var d=c.iterator;d.next();)d.value.isSelected=!0;b.ba("ChangedSelection",b.selection);if(null!==a){var e=b.computePartsBounds(b.selection);if(e.o()){var f=this.computeEffectiveCollection(b.selection,b.Qk);pg(b,f,new J(a.x-e.centerX,a.y-e.centerY),b.Qk,!1)}}b.ba("ClipboardPasted",c)}finally{b.ab("Paste"),
b.currentCursor=""}};Xk.prototype.canPasteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowClipboard||null===Ri||0===Ri.count||Si!==a.model.dataFormat?!1:!0};Xk.prototype.undo=function(){this.diagram.undoManager.undo()};Xk.prototype.canUndo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canUndo()};Xk.prototype.redo=function(){this.diagram.undoManager.redo()};
Xk.prototype.canRedo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canRedo()};Xk.prototype.decreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);B(a,Xk,"decreaseZoom:factor");var b=this.diagram;b.autoScale===Fi&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};
Xk.prototype.canDecreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);B(a,Xk,"canDecreaseZoom:factor");var b=this.diagram;if(b.autoScale!==Fi)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};Xk.prototype.increaseZoom=function(a){void 0===a&&(a=this.zoomFactor);B(a,Xk,"increaseZoom:factor");var b=this.diagram;b.autoScale===Fi&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};
Xk.prototype.canIncreaseZoom=function(a){void 0===a&&(a=this.zoomFactor);B(a,Xk,"canIncreaseZoom:factor");var b=this.diagram;if(b.autoScale!==Fi)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};Xk.prototype.resetZoom=function(a){void 0===a&&(a=this.defaultScale);B(a,Xk,"resetZoom:newscale");var b=this.diagram;a<b.minScale||a>b.maxScale||(b.scale=a)};
Xk.prototype.canResetZoom=function(a){void 0===a&&(a=this.defaultScale);B(a,Xk,"canResetZoom:newscale");var b=this.diagram;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};Xk.prototype.zoomToFit=function(){var a=this.diagram,b=a.scale,c=a.position;b===this.Ku&&!isNaN(this.ku)&&a.documentBounds.A(this.Ju)?(a.scale=this.ku,a.position=this.Gw,this.Ku=NaN,this.Ju=Tc):(this.ku=b,this.Gw=c.copy(),a.zoomToFit(),this.Ku=a.scale,this.Ju=a.documentBounds.copy())};Xk.prototype.canZoomToFit=function(){return this.diagram.allowZoom};
Xk.prototype.scrollToPart=function(a){void 0===a&&(a=null);null!==a&&w(a,U,Xk,"part");var b=this.diagram;if(null===a){try{null!==this.hg&&(this.hg.next()?a=this.hg.value:this.hg=null)}catch(k){this.hg=null}null===a&&(0<b.highlighteds.count?this.hg=b.highlighteds.iterator:0<b.selection.count&&(this.hg=b.selection.iterator),null!==this.hg&&this.hg.next()&&(a=this.hg.value))}if(null!==a){var c=b.animationManager;c.Dh("Scroll To Part");var d=this.scrollToPartPause;if(0<d){var e=Zk(this,a,[a]),f=function(){b.Ca();
for(var a=e.pop();0<e.length&&a instanceof V&&a.isTreeExpanded&&(!(a instanceof xg)||a.isSubGraphExpanded);)a=e.pop();0<e.length?(a instanceof U&&b.Nv(a.actualBounds),a instanceof V&&!a.isTreeExpanded&&(a.isTreeExpanded=!0),a instanceof xg&&!a.isSubGraphExpanded&&(a.isSubGraphExpanded=!0)):(a instanceof U&&b.Pu(a.actualBounds),b.sm("LayoutCompleted",g));b.ab("Scroll To Part")},g=function(){wa(f,(c.isEnabled?c.duration:0)+d)};b.Rj("LayoutCompleted",g);f()}else{var h=b.position.copy();b.Pu(a.actualBounds);
h.Sa(b.position)&&c.xd()}}};function Zk(a,b,c){if(b.isVisible())return c;if(b instanceof Cf)Zk(a,b.adornedPart,c);else if(b instanceof T){var d=b.fromNode;null!==d&&Zk(a,d,c);b=b.toNode;null!==b&&Zk(a,b,c)}else b instanceof V&&(d=b.labeledLink,null!==d&&Zk(a,d,c),d=b.tg(),null!==d&&(d.isTreeExpanded||d.wasTreeExpanded||c.push(d),Zk(a,d,c))),b=b.containingGroup,null!==b&&(b.isSubGraphExpanded||b.wasSubGraphExpanded||c.push(b),Zk(a,b,c));return c}
Xk.prototype.canScrollToPart=function(a){void 0===a&&(a=null);if(null!==a&&!(a instanceof U))return!1;a=this.diagram;return 0===a.selection.count&&0===a.highlighteds.count?!1:a.allowHorizontalScroll&&a.allowVerticalScroll};
Xk.prototype.collapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Ca("Collapse Tree");b.animationManager.Dh("Collapse Tree");var c=new F;if(null!==a&&a.isTreeExpanded)a.collapseTree(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof V&&e.isTreeExpanded&&(e.collapseTree(),c.add(e))}b.ba("TreeCollapsed",c)}finally{b.ab("Collapse Tree")}};
Xk.prototype.canCollapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a){if(!(a instanceof V&&a.isTreeExpanded))return!1;if(0<a.cq().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof V&&b.isTreeExpanded&&0<b.cq().count)return!0;return!1};
Xk.prototype.expandTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Ca("Expand Tree");b.animationManager.Dh("Expand Tree");var c=new F;if(null!==a&&!a.isTreeExpanded)a.expandTree(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof V&&!e.isTreeExpanded&&(e.expandTree(),c.add(e))}b.ba("TreeExpanded",c)}finally{b.ab("Expand Tree")}};
Xk.prototype.canExpandTree=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a){if(!(a instanceof V)||a.isTreeExpanded)return!1;if(0<a.cq().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof V&&!b.isTreeExpanded&&0<b.cq().count)return!0;return!1};
Xk.prototype.groupSelection=function(){var a=this.diagram,b=a.model;if(b.Ti()){var c=this.archetypeGroupData;if(null!==c){var d=null;try{a.currentCursor="wait";a.Ca("Group");a.ba("ChangingSelection",a.selection);for(var e=new F,f=a.selection.iterator;f.next();){var g=f.value;g.dc()&&g.canGroup()&&e.add(g)}for(var h=new F,k=e.iterator;k.next();){var l=k.value;f=!1;for(var m=e.iterator;m.next();)if(l.Xd(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.Xd(n)){e=!0;break}if(e)n=n.containingGroup;else break}if(c instanceof xg)mh(c),d=c.copy(),null!==d&&a.add(d);else if(b.ht(c)){var q=b.copyNodeData(c);Ja(q)&&(b.mf(q),d=a.Ji(q))}if(null!==d){null!==n&&this.isValidMember(n,d)&&(d.containingGroup=n);for(var r=h.iterator;r.next();){var u=r.value;this.isValidMember(d,u)&&(u.containingGroup=d)}a.select(d)}}a.ba("ChangedSelection",a.selection);a.ba("SelectionGrouped",d)}finally{a.ab("Group"),a.currentCursor=
""}}}};Xk.prototype.canGroupSelection=function(){var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowGroup||!a.model.Ti()||null===this.archetypeGroupData)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.dc()&&b.canGroup())return!0}return!1};
function $k(a){var b=Qa();for(a=a.iterator;a.next();){var c=a.value;c instanceof T||b.push(c)}a=new H;c=b.length;for(var d=0;d<c;d++){for(var e=b[d],f=!0,g=0;g<c;g++)if(e.Xd(b[g])){f=!1;break}f&&a.add(e)}Ta(b);return a}
Xk.prototype.isValidMember=function(a,b){if(null===b||a===b||b instanceof T)return!1;if(null!==a){if(a===b||a.Xd(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};
Xk.prototype.ungroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.model;if(c.Ti())try{b.currentCursor="wait";b.Ca("Ungroup");b.ba("ChangingSelection",b.selection);var d=new F;if(null!==a)d.add(a);else for(var e=b.selection.iterator;e.next();){var f=e.value;f instanceof xg&&f.canUngroup()&&d.add(f)}var g=new F;if(0<d.count){b.Vp();for(var h=d.iterator;h.next();){var k=h.value;k.expandSubGraph();var l=k.containingGroup,m=null!==l&&null!==l.data?c.ra(l.data):void 0;g.addAll(k.memberParts);
for(var n=g.iterator;n.next();){var p=n.value;p.isSelected=!0;if(!(p instanceof T)){var q=p.data;null!==q?c.zt(q,m):p.containingGroup=l}}b.remove(k)}}b.ba("ChangedSelection",b.selection);b.ba("SelectionUngrouped",d,g)}finally{b.ab("Ungroup"),b.currentCursor=""}};
Xk.prototype.canUngroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly||b.isModelReadOnly||!b.allowDelete||!b.allowUngroup||!b.model.Ti())return!1;if(null!==a){if(!(a instanceof xg))return!1;if(a.canUngroup())return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof xg&&b.canUngroup())return!0;return!1};
Xk.prototype.addTopLevelParts=function(a,b){var c=!0;for(a=$k(a).iterator;a.next();){var d=a.value;null!==d.containingGroup&&(!b||this.isValidMember(null,d)?d.containingGroup=null:c=!1)}return c};
Xk.prototype.collapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Ca("Collapse SubGraph");b.animationManager.Dh("Collapse SubGraph");var c=new F;if(null!==a&&a.isSubGraphExpanded)a.collapseSubGraph(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof xg&&e.isSubGraphExpanded&&(e.collapseSubGraph(),c.add(e))}b.ba("SubGraphCollapsed",c)}finally{b.ab("Collapse SubGraph")}};
Xk.prototype.canCollapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof xg&&a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof xg&&b.isSubGraphExpanded)return!0;return!1};
Xk.prototype.expandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Ca("Expand SubGraph");b.animationManager.Dh("Expand SubGraph");var c=new F;if(null!==a&&!a.isSubGraphExpanded)a.expandSubGraph(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof xg&&!e.isSubGraphExpanded&&(e.expandSubGraph(),c.add(e))}b.ba("SubGraphExpanded",c)}finally{b.ab("Expand SubGraph")}};
Xk.prototype.canExpandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof xg&&!a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof xg&&!b.isSubGraphExpanded)return!0;return!1};
Xk.prototype.editTextBlock=function(a){void 0===a&&(a=null);null!==a&&w(a,Kh,Xk,"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.cm(function(a){return a instanceof Kh&&a.editable})}null!==a&&(b.currentTool=null,c.textBlock=a,b.currentTool=c)}};
Xk.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 Kh))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.cm(function(a){return a instanceof Kh&&a.editable}),null!==a))return!0;return!1};
Xk.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.oa(qd):b.isMouseOverDiagram||(e=b.viewportBounds,e=new J(e.x+e.width/2,e.y+e.height/2));null!==e&&(d.viewPoint=b.Ct(e),d.documentPoint=e,d.left=!1,d.right=!0,d.up=!0);b.currentTool=c;Gh(c,!1,a)}};
Xk.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};
Xk.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.Qk);d=new Ub;if(null===a)return d;for(var f=a.iterator;f.next();)Zj(c,d,f.value,e,b);if(null!==c.draggedLink&&b.dragsLink)return d;for(f=a.iterator;f.next();)a=f.value,a instanceof T&&(b=a.fromNode,null===b||d.contains(b)?(b=a.toNode,null===b||d.contains(b)||d.remove(a)):d.remove(a));return d};
na.Object.defineProperties(Xk.prototype,{diagram:{configurable:!0,get:function(){return this.D}},copiesClipboardData:{configurable:!0,get:function(){return this.w},set:function(a){z(a,"boolean",Xk,"copiesClipboardData");this.w=a}},copiesConnectedLinks:{configurable:!0,get:function(){return this.L},set:function(a){z(a,"boolean",Xk,"copiesConnectedLinks");this.L=a}},deletesConnectedLinks:{configurable:!0,get:function(){return this.Wb},set:function(a){z(a,
"boolean",Xk,"deletesConnectedLinks");this.Wb=a}},copiesTree:{configurable:!0,get:function(){return this.Na},set:function(a){z(a,"boolean",Xk,"copiesTree");this.Na=a}},deletesTree:{configurable:!0,get:function(){return this.Xb},set:function(a){z(a,"boolean",Xk,"deletesTree");this.Xb=a}},copiesParentKey:{configurable:!0,get:function(){return this.Ma},set:function(a){z(a,"boolean",Xk,"copiesParentKey");this.Ma=a}},copiesGroupKey:{configurable:!0,
get:function(){return this.ca},set:function(a){z(a,"boolean",Xk,"copiesGroupKey");this.ca=a}},archetypeGroupData:{configurable:!0,get:function(){return this.l},set:function(a){null!==a&&z(a,"object",Xk,"archetypeGroupData");var b=this.diagram;E&&(b=b.model,!b.Ti()||a instanceof xg||b.ht(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.mi},set:function(a){null!==a&&z(a,"function",Xk,"memberValidation");this.mi=a}},defaultScale:{configurable:!0,get:function(){return this.diagram.defaultScale},set:function(a){this.diagram.defaultScale=a}},zoomFactor:{configurable:!0,get:function(){return this.Oc},set:function(a){B(a,Xk,"zoomFactor");1<a||v("zoomFactor must be larger than 1.0, not: "+a);this.Oc=a}},scrollToPartPause:{configurable:!0,get:function(){return this.Nc},
set:function(a){B(a,Xk,"scrollToPartPause");this.Nc=a}}});Xk.className="CommandHandler";Mi=function(){return new Xk};
function N(){qb(this);this.I=4225027;this.mb=1;this.eg=null;this.Wa="";this.fc=this.jb=null;this.ua=(new J(NaN,NaN)).freeze();this.Qc=xc;this.Uf=rc;this.Tf=wc;this.ub=new $b;this.Gh=new $b;this.Sf=new $b;this.Da=this.Xk=1;this.Bc=0;this.ze=al;this.Xg=Zc;this.qc=(new L(NaN,NaN,NaN,NaN)).freeze();this.wb=(new L(NaN,NaN,NaN,NaN)).freeze();this.rc=(new L(0,0,NaN,NaN)).freeze();this.R=this.Vo=this.Wo=null;this.Ck=this.xb=Qd;this.ip=0;this.jp=1;this.Hg=0;this.cn=1;this.zp=null;this.np=-Infinity;this.Dl=
0;this.El=gc;this.Fl=ch;this.nn="";this.eb=this.P=null;this.Ik=-1;this.Hl=this.md=this.Vh=this.Kl=null;this.qs=nh;this.Ej=null}var oe,nh,ph,al,bl,cl,dl,el,fl,gl;
N.prototype.cloneProtected=function(a){a.I=this.I|6144;a.mb=this.mb;a.Wa=this.Wa;a.jb=this.jb;a.fc=this.fc;a.ua.assign(this.ua);a.Qc=this.Qc.J();a.Uf=this.Uf.J();a.Tf=this.Tf.J();a.Sf=this.Sf.copy();a.Da=this.Da;a.Bc=this.Bc;a.ze=this.ze;a.Xg=this.Xg.J();a.qc.assign(this.qc);a.wb.assign(this.wb);a.rc.assign(this.rc);a.Vo=this.Vo;null!==this.R&&(a.R=this.R.copy());a.xb=this.xb.J();a.Ck=this.Ck.J();a.ip=this.ip;a.jp=this.jp;a.Hg=this.Hg;a.cn=this.cn;a.zp=this.zp;a.np=this.np;a.Dl=this.Dl;a.El=this.El.J();
a.Fl=this.Fl;a.nn=this.nn;null!==this.P&&(a.P=this.P.copy());a.eb=this.eb;a.Ik=this.Ik;null!==this.Vh&&(a.Vh=Ma(this.Vh));null!==this.md&&(a.md=this.md.copy());a.Hl=this.Hl};N.prototype.Ww=function(a){var b=this.Vh;if(Ka(b))for(var c=0;c<b.length;c++){if(b[c]===a)return}else this.Vh=b=[];b.push(a)};N.prototype.rf=function(a){a.Wo=null;a.Ej=null;a.v()};
N.prototype.clone=function(){var a=new this.constructor;this.cloneProtected(a);if(null!==this.Vh)for(var b=0;b<this.Vh.length;b++){var c=this.Vh[b];a[c]=this[c]}return a};N.prototype.copy=function(){return this.clone()};t=N.prototype;t.hb=function(a){a.classType===T?0===a.name.indexOf("Orient")?this.segmentOrientation=a:v("Unknown Link enum value for GraphObject.segmentOrientation property: "+a):a.classType===N?this.stretch=a:Fa(this,a)};t.toString=function(){return Va(this.constructor)+"#"+Jb(this)};
function hl(a){null===a.P&&(a.P=new il)}t.Jc=function(){if(null===this.R){var a=new jl;a.Qg=ed;a.oh=ed;a.Og=10;a.mh=10;a.Pg=0;a.nh=0;this.R=a}};t.cb=function(a,b,c,d,e,f,g){var h=this.part;if(null!==h&&(h.sk(a,b,c,d,e,f,g),c===this&&a===of&&kl(this)&&ll(this,h,b),this instanceof W&&c===h&&0!==(h.I&16777216)&&null!==h.data))for(a=this.Z.j,c=a.length,d=0;d<c;d++)e=a[d],e instanceof W&&Rj(e,function(a){null!==a.data&&0!==(a.I&16777216)&&a.Fa(b)})};
function ll(a,b,c){var d=a.Li();if(null!==d)for(var e=a.eb.iterator;e.next();){var f=e.value,g=null;if(null!==f.sourceName){g=ml(f,d,a);if(null===g)continue;f.Eq(a,g,c,null)}else if(f.isToModel){var h=b.diagram;null===h||h.skipsModelSourceBindings||f.Eq(a,h.model.modelData,c,d)}else{h=d.data;if(null===h)continue;var k=b.diagram;null===k||k.skipsModelSourceBindings||f.Eq(a,h,c,d)}g===a&&(h=d.Vs(f.aj),null!==h&&f.ew(h,g,c))}}t.Vs=function(a){return this.Ik===a?this:null};
t.g=function(a,b,c){this.cb(of,a,this,b,c)};function nl(a,b,c,d,e){var f=a.qc,g=a.Sf;g.reset();ol(a,g,b,c,d,e);a.Sf=g;f.h(b,c,d,e);g.it()||g.bw(f)}function pl(a,b,c,d){if(!1===a.pickable)return!1;d.multiply(a.transform);return c?a.Kc(b,d):a.wh(b,d)}
t.ox=function(a,b,c){if(!1===this.pickable)return!1;var d=this.naturalBounds;b=a.Fe(b);return c?cc(a.x,a.y,0,0,0,d.height)<=b||cc(a.x,a.y,0,d.height,d.width,d.height)<=b||cc(a.x,a.y,d.width,d.height,d.width,0)<=b||cc(a.x,a.y,d.width,0,0,0)<=b:a.ed(0,0)<=b&&a.ed(0,d.height)<=b&&a.ed(d.width,0)<=b&&a.ed(d.width,d.height)<=b};t.ae=function(){return!0};
t.ea=function(a){E&&w(a,J,N,"containsPoint:p");var b=J.alloc();b.assign(a);this.transform.va(b);var c=this.actualBounds;if(!c.o())return J.free(b),!1;var d=this.diagram;if(null!==d&&d.Ue){var e=d.gm("extraTouchThreshold"),f=d.gm("extraTouchArea"),g=f/2,h=this.naturalBounds;d=this.Ge()*d.scale;var k=1/d;if(h.width*d<e&&h.height*d<e)return a=Qc(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 Cf||this instanceof Hg?Qc(c.x-5,c.y-5,c.width+10,c.height+10,b.x,b.y):
c.ea(b))this.md&&!this.md.ea(b)?e=!1:null!==this.fc&&c.ea(b)?e=!0:null!==this.jb&&this.rc.ea(a)?e=!0:e=this.xh(a);J.free(b);return e};t.xh=function(a){var b=this.naturalBounds;return Qc(0,0,b.width,b.height,a.x,a.y)};
t.qf=function(a){E&&w(a,L,N,"containsRect:r");if(0===this.angle)return this.actualBounds.qf(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.ea(c.Wd(e))&&(e.h(a.x,a.bottom),b.ea(c.Wd(e))&&(e.h(a.right,a.bottom),b.ea(c.Wd(e))&&(e.h(a.right,a.y),b.ea(c.Wd(e))&&(d=!0))));J.free(e);L.free(b);return d};
t.wh=function(a,b){E&&w(a,L,N,"containedInRect:r");if(void 0===b)return a.qf(this.actualBounds);var c=this.naturalBounds,d=!1,e=J.allocAt(0,0);a.ea(b.va(e))&&(e.h(0,c.height),a.ea(b.va(e))&&(e.h(c.width,c.height),a.ea(b.va(e))&&(e.h(c.width,0),a.ea(b.va(e))&&(d=!0))));J.free(e);return d};
t.Kc=function(a,b){E&&w(a,L,N,"intersectsRect:r");if(void 0===b&&(b=this.transform,0===this.angle))return a.Kc(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.ea(b.va(d))||a.ea(b.va(e))||a.ea(b.va(f))||a.ea(b.va(g)))h=!0;else{c=L.allocAt(0,0,c.width,c.height);var k=J.allocAt(a.x,a.y);c.ea(b.Wd(k))?h=!0:(k.h(a.x,a.bottom),c.ea(b.Wd(k))?h=!0:(k.h(a.right,a.bottom),c.ea(b.Wd(k))?h=!0:(k.h(a.right,a.y),
c.ea(b.Wd(k))&&(h=!0))));J.free(k);L.free(c);!h&&(K.et(a,d,e)||K.et(a,e,f)||K.et(a,f,g)||K.et(a,g,d))&&(h=!0)}J.free(d);J.free(e);J.free(f);J.free(g);return h};t.oa=function(a,b){void 0===b&&(b=new J);if(a instanceof M){E&&a.Nb()&&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.td.va(b);return b};
t.eq=function(a){void 0===a&&(a=new L);var b=this.naturalBounds,c=this.td,d=J.allocAt(0,0).transform(c);a.h(d.x,d.y,0,0);d.h(b.width,0).transform(c);Mc(a,d.x,d.y,0,0);d.h(b.width,b.height).transform(c);Mc(a,d.x,d.y,0,0);d.h(0,b.height).transform(c);Mc(a,d.x,d.y,0,0);J.free(d);return a};t.Oi=function(){var a=this.td;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.Ge=function(){if(0!==(this.I&4096)===!1)return this.Xk;var a=this.Da;return null!==this.panel?a*this.panel.Ge():a};t.at=function(a,b){void 0===b&&(b=new J);b.assign(a);this.td.Wd(b);return b};t.Wc=function(a,b,c){return this.fk(a.x,a.y,b.x,b.y,c)};
t.fk=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.Wc(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.Wc(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!==Ej(this)){var e=this.Xg,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 Hg&&(g=this.strokeWidth);90===f||270===f?(a=isFinite(e.height)?e.height+g:a,b=isFinite(e.width)?e.width+g:b):(a=isFinite(e.width)?e.width+g:a,b=isFinite(e.height)?e.height+g:b);e=c||0;g=d||0;var h=this instanceof W;switch(ql(this,!0)){case nh:g=e=0;h&&(b=a=Infinity);
break;case oe:isFinite(a)&&a>c&&(e=a);isFinite(b)&&b>d&&(g=b);break;case bl:isFinite(a)&&a>c&&(e=a);g=0;h&&(b=Infinity);break;case cl:isFinite(b)&&b>d&&(g=b),e=0,h&&(a=Infinity)}h=this.maxSize;var k=this.minSize;e>h.width&&k.width<h.width&&(e=h.width);g>h.height&&k.height<h.height&&(g=h.height);c=Math.max(e/this.scale,k.width);d=Math.max(g/this.scale,k.height);h.width<c&&(c=Math.min(k.width,c));h.height<d&&(d=Math.min(k.height,d));a=Math.min(h.width,a);b=Math.min(h.height,b);a=Math.max(c,a);b=Math.max(d,
b);if(90===f||270===f)f=a,a=b,b=f,f=c,c=d,d=f;this.qc.ja();this.mm(a,b,c,d);this.qc.freeze();this.qc.o()||v("Non-real measuredBounds has been set. Object "+this+", measuredBounds: "+this.qc.toString());zj(this,!1)}};N.prototype.mm=function(){};N.prototype.xg=function(){return!1};
N.prototype.arrange=function(a,b,c,d,e){this.kl();var f=L.alloc();f.assign(this.wb);this.wb.ja();!1===Fj(this)?this.wb.h(a,b,c,d):this.vh(a,b,c,d);this.wb.freeze();void 0===e?this.md=null:this.md=e;c=!1;if(void 0!==e)c=!0;else if(e=this.panel,null===e||e.type!==W.TableRow&&e.type!==W.TableColumn||(e=e.panel),null!==e&&(e=e.rc,d=this.measuredBounds,null!==this.areaBackground&&(d=this.wb),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 Kh&&(a=this.naturalBounds,
this.Wr>a.height||this.metrics.maxLineWidth>a.width)))c=!0;this.I=c?this.I|256:this.I&-257;this.wb.o()||v("Non-real actualBounds has been set. Object "+this+", actualBounds: "+this.wb.toString());this.qt(f,this.wb);rl(this,!1);L.free(f)};t=N.prototype;t.vh=function(){};
function sl(a,b,c,d,e){a.wb.h(b,c,d,e);if(!a.desiredSize.o()){var f=a.qc;c=a.Xg;b=c.right+c.left;var g=c.top+c.bottom;c=f.width+b;f=f.height+g;d+=b;e+=g;b=ql(a,!0);c===d&&f===e&&(b=nh);switch(b){case nh:if(c>d||f>e)zj(a,!0),a.measure(c>d?d:c,f>e?e:f,0,0);break;case oe:zj(a,!0);a.measure(d,e,0,0);break;case bl:zj(a,!0);a.measure(d,f,0,0);break;case cl:zj(a,!0),a.measure(c,e,0,0)}}}
t.qt=function(a,b){var c=this.part;null!==c&&null!==c.diagram&&(c.selectionObject!==this&&c.resizeObject!==this&&c.rotateObject!==this||tl(c,!0),this.S(),Fc(a,b)||(c.Ah(),this.Ko(c)))};t.Ko=function(a){null!==this.portId&&(tl(a,!0),a instanceof V&&ul(a,this))};
t.jc=function(a,b){if(this.visible){var c=this instanceof W&&(this.type===W.TableRow||this.type===W.TableColumn),d=this.wb;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.lx(a,b))if(c)vl(this,a,b);else{this instanceof T&&this.kk(!1);E&&E.Gi&&E.Ny&&E.Ny(a,this);c=this.transform;var g=this.panel;0!==(this.I&4096)===!0&&wl(this);var h=this.part,k=!1,l=0;if(h&&b.He("drawShadows")&&(k=h.isShadowed)){var m=
h.wi;l=Math.max(m.y,m.x)*b.scale*b.Pb}if(!(m=b.qj)){var n=this.naturalBounds;m=this.Gh;var p=m.m11,q=m.m21,r=m.dx,u=m.m12,x=m.m22,y=m.dy,A,C=A=0;m=A*p+C*q+r;var G=A*u+C*x+y;A=n.width+l;C=0;var I=A*p+C*q+r;A=A*u+C*x+y;C=Math.min(m,I);var O=Math.min(G,A);var R=Math.max(m+0,I)-C;var Q=Math.max(G+0,A)-O;m=C;G=O;A=n.width+l;C=n.height+l;I=A*p+C*q+r;A=A*u+C*x+y;C=Math.min(m,I);O=Math.min(G,A);R=Math.max(m+R,I)-C;Q=Math.max(G+Q,A)-O;m=C;G=O;A=0;C=n.height+l;I=A*p+C*q+r;A=A*u+C*x+y;C=Math.min(m,I);O=Math.min(G,
A);R=Math.max(m+R,I)-C;Q=Math.max(G+Q,A)-O;m=C;G=O;l=b.viewportBounds;n=l.x;p=l.y;m=!(m>l.aa+n||n>R+m||G>l.$+p||p>Q+G)}if(m){m=0!==(this.I&256);a.clipInsteadOfFill&&(m=!1);this instanceof Kh&&(a.font=this.font);if(m){E&&E.Py&&Ha("clip"+this.toString());G=g.ae()?g.naturalBounds:g.actualBounds;null!==this.md?(n=this.md,R=n.x,Q=n.y,l=n.width,n=n.height):(R=Math.max(d.x,G.x),Q=Math.max(d.y,G.y),l=Math.min(d.right,G.right)-R,n=Math.min(d.bottom,G.bottom)-Q);if(R>d.width+d.x||d.x>G.width+G.x){1!==e&&(a.globalAlpha=
f);return}a.save();a.beginPath();a.rect(R,Q,l,n);a.clip()}if(this.xg()){if(!h.isVisible()){1!==e&&(a.globalAlpha=f);return}k&&(G=h.wi,a.Vv(G.x*b.scale*b.Pb,G.y*b.scale*b.Pb,h.Qd),xl(a),a.shadowColor=h.Mj)}!0===this.shadowVisible?xl(a):!1===this.shadowVisible&&yl(a);h=this.naturalBounds;null!==this.fc&&(zi(this,a,this.fc,!0,!0,h,d),this.fc instanceof zl&&this.fc.type===Al?(a.beginPath(),a.rect(d.x,d.y,d.width,d.height),a.Vd(this.fc)):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===W.Auto||g.type===W.Spot)&&g.Bb()!==this)&&null===this.shadowVisible&&yl(a);null!==this.jb&&(l=this.naturalBounds,R=G=0,Q=l.width,l=l.height,n=0,this instanceof Hg&&(l=this.sa.bounds,G=l.x,R=l.y,Q=l.width,l=l.height,n=this.strokeWidth),zi(this,a,this.jb,!0,!1,h,d),this.jb instanceof zl&&this.jb.type===Al?(a.beginPath(),a.rect(G-n/2,R-n/2,Q+n,l+n),a.Vd(this.jb)):a.fillRect(G-n/2,R-n/2,Q+n,l+n));E&&E.Gi&&E.Oy&&E.Oy(a,this);k&&(null!==
this.jb||null!==this.fc||null!==g&&0!==(g.I&512)||null!==g&&(g.type===W.Auto||g.type===W.Spot)&&g.Bb()!==this)?(Bl(this,!0),null===this.shadowVisible&&yl(a)):Bl(this,!1);this.Hi(a,b);k&&0!==(this.I&512)===!0&&xl(a);this.xg()&&k&&yl(a);m?(a.restore(),this instanceof W?a.Uc(!0):a.Uc(!1)):c.it()||(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.lx=function(){return!1};
function vl(a,b,c){var d=a.wb,e=a.rc;null!==a.fc&&(zi(a,b,a.fc,!0,!0,e,d),a.fc instanceof zl&&a.fc.type===Al?(b.beginPath(),b.rect(d.x,d.y,d.width,d.height),b.Vd(a.fc)):b.fillRect(d.x,d.y,d.width,d.height));null!==a.jb&&(zi(a,b,a.jb,!0,!1,e,d),a.jb instanceof zl&&a.jb.type===Al?(b.beginPath(),b.rect(d.x,d.y,d.width,d.height),b.Vd(a.jb)):b.fillRect(d.x,d.y,d.width,d.height));a.Hi(b,c)}t.Hi=function(){};
function zi(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===Cl)d?b.fillStyle=c.color:b.strokeStyle=c.color;else{h=f.width;k=f.height;e&&(h=g.width,k=g.height);if((f=b instanceof Dl)&&c.ge&&(c.type===El||c.Lk===h&&c.Qt===k))var l=c.ge;else{var m=0,n=0,p=0,q=0,r=0,u=0;u=r=0;e&&(r=g.x,u=g.y);m=c.start.x*h+c.start.offsetX;n=c.start.y*k+c.start.offsetY;p=c.end.x*h+c.end.offsetX;q=c.end.y*k+c.end.offsetY;m+=r;p+=r;n+=u;q+=u;if(c.type===Fl)l=
b.createLinearGradient(m,n,p,q);else if(c.type===Al)u=isNaN(c.endRadius)?Math.max(h,k)/2:c.endRadius,isNaN(c.startRadius)?(r=0,u=Math.max(h,k)/2):r=c.startRadius,l=b.createRadialGradient(m,n,r,p,q,u);else if(c.type===El)try{l=b.createPattern(c.pattern,"repeat")}catch(y){l=null}else Ba(c.type,"Brush type");if(c.type!==El&&(e=c.colorStops,null!==e))for(e=e.iterator;e.next();)l.addColorStop(e.key,e.value);if(f&&(c.ge=l,null!==l&&(c.Lk=h,c.Qt=k),null===l&&c.type===El&&-1!==c.Lk)){c.Lk=-1;var x=a.diagram;
null!==x&&-1===c.Lk&&wa(function(){x.wf()},600)}}d?b.fillStyle=l:b.strokeStyle=l}}}t.vg=function(a){if(a instanceof W)a:{if(this!==a&&null!==a)for(var b=this.panel;null!==b;){if(b===a){a=!0;break a}b=b.panel}a=!1}else a=!1;return a};t.vf=function(){if(!this.visible)return!1;var a=this.panel;return null!==a?a.vf():!0};t.wg=function(){for(var a=this instanceof W?this:this.panel;null!==a&&a.isEnabled;)a=a.panel;return null===a};
function wl(a){if(0!==(a.I&2048)===!0){var b=a.ub;b.reset();if(!a.wb.o()||!a.qc.o()){Gl(a,!1);return}b.translate(a.wb.x-a.qc.x,a.wb.y-a.qc.y);if(1!==a.scale||0!==a.angle){var c=a.naturalBounds;ol(a,b,c.x,c.y,c.width,c.height)}Gl(a,!1);Hl(a,!0)}0!==(a.I&4096)===!0&&(b=a.panel,null===b?(a.Gh.set(a.ub),a.Xk=a.scale,Hl(a,!1)):null!==b.td&&(c=a.Gh,c.reset(),b.ae()?c.multiply(b.Gh):null!==b.panel&&c.multiply(b.panel.Gh),c.multiply(a.ub),a.Xk=a.scale*b.Xk,Hl(a,!1)))}
function ol(a,b,c,d,e,f){1!==a.scale&&b.scale(a.scale);if(0!==a.angle){var g=qd;a.xg()&&a.locationSpot.Za()&&(g=a.locationSpot);var h=J.alloc();if(a instanceof U&&a.locationObject!==a)for(c=a.locationObject,d=c.naturalBounds,h.uk(d.x,d.y,d.width,d.height,g),c.Sf.va(h),h.offset(-c.measuredBounds.x,-c.measuredBounds.y),g=c.panel;null!==g&&g!==a;)g.Sf.va(h),h.offset(-g.measuredBounds.x,-g.measuredBounds.y),g=g.panel;else h.uk(c,d,e,f,g);b.rotate(a.angle,h.x,h.y);J.free(h)}}
t.v=function(a){void 0===a&&(a=!1);if(!0!==Ej(this)){zj(this,!0);rl(this,!0);var b=this.panel;null===b||a||b.v()}};t.im=function(){!0!==Ej(this)&&(zj(this,!0),rl(this,!0))};function Il(a){if(!1===Fj(a)){var b=a.panel;null!==b?b.v():a.xg()&&(b=a.diagram,null!==b&&(b.Fd.add(a),a instanceof V&&a.gd(),b.ec()));rl(a,!0)}}t.kl=function(){0!==(this.I&2048)===!1&&(Gl(this,!0),Hl(this,!0))};t.rv=function(){Hl(this,!0)};t.S=function(){var a=this.part;null!==a&&a.S()};
function ql(a,b){var c=a.stretch,d=a.panel;if(null!==d&&d.type===W.Table)return Jl(a,d.getRowDefinition(a.row),d.getColumnDefinition(a.column),b);if(null!==d&&d.type===W.Auto&&d.Bb()===a)return Kl(a,oe,b);if(c===al){if(null!==d){if(d.type===W.Spot&&d.Bb()===a)return Kl(a,oe,b);c=d.defaultStretch;return c===al?Kl(a,nh,b):Kl(a,c,b)}return Kl(a,nh,b)}return Kl(a,c,b)}
function Jl(a,b,c,d){var e=a.stretch;if(e!==al)return Kl(a,e,d);var f=e=null;switch(b.stretch){case cl:f=!0;break;case oe:f=!0}switch(c.stretch){case bl:e=!0;break;case oe:e=!0}b=a.panel.defaultStretch;null===e&&(e=b===bl||b===oe);null===f&&(f=b===cl||b===oe);return!0===e&&!0===f?Kl(a,oe,d):!0===e?Kl(a,bl,d):!0===f?Kl(a,cl,d):Kl(a,nh,d)}
function Kl(a,b,c){if(c)return b;if(b===nh)return nh;c=a.desiredSize;if(c.o())return nh;a=a.angle;if(!isNaN(c.width))if(90!==a&&270!==a){if(b===bl)return nh;if(b===oe)return cl}else{if(b===cl)return nh;if(b===oe)return bl}if(!isNaN(c.height))if(90!==a&&270!==a){if(b===cl)return nh;if(b===oe)return bl}else{if(b===bl)return nh;if(b===oe)return cl}return b}function Bl(a,b){a.I=b?a.I|512:a.I&-513}function kl(a){return 0!==(a.I&1024)}function Ll(a,b){a.I=b?a.I|1024:a.I&-1025}
function Gl(a,b){a.I=b?a.I|2048:a.I&-2049}function Hl(a,b){a.I=b?a.I|4096:a.I&-4097}function Ej(a){return 0!==(a.I&8192)}function zj(a,b){a.I=b?a.I|8192:a.I&-8193}function Fj(a){return 0!==(a.I&16384)}function rl(a,b){a.I=b?a.I|16384:a.I&-16385}t.Xi=function(a){this.eg=a};t.Tv=function(){};t.Sv=function(a){this.ua=a;Il(this);return!0};t.Bt=function(a,b){this.ua.h(a,b);this.kl()};
function Ml(a){var b=a.part;if(b instanceof V&&(null!==a.portId||a===b.port)){var c=b.diagram;null===c||c.undoManager.isUndoingRedoing||ul(b,a)}}function Nl(a){var b=a.diagram;null===b||b.undoManager.isUndoingRedoing||(a instanceof W?a instanceof V?a.gd():a.xk(a,function(a){Ml(a)}):Ml(a))}t.bind=function(a){a.Sd=this;var b=this.Li();null!==b&&Ol(b)&&v("Cannot add a Binding to a template that has already been copied: "+a);null===this.eb&&(this.eb=new F);this.eb.add(a)};
t.Li=function(){for(var a=this instanceof W?this:this.panel;null!==a;){if(null!==a.Th)return a;a=a.panel}return null};t.Uv=function(a){Lj(this,a)};
function Pl(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=Ql.K(a);"function"===typeof f?(c=Ma(arguments),d=f(c),Ja(d)||v('GraphObject.make invoked object builder "'+a+'", but it did not return an Object')):e=ra.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 P&&1<c.length){f=
d;var g=c[1];if("string"===typeof g||g instanceof HTMLDivElement)Qi(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):Rl(d,f);return d}
function Rl(a,b){if("string"===typeof b)if(a instanceof Kh)a.text=b;else if(a instanceof Hg)a.figure=b;else if(a instanceof lk)a.source=b;else if(a instanceof W){var c=Sl.K(b);null!==c?a.type=c:E&&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 zl?(c=sb(zl,b),null!==c?a.type=c:v("Unknown Brush type as an argument to GraphObject.make: "+b)):a instanceof me?(c=sb(me,b),null!==c?a.type=c:E&&v("Unknown Geometry type as an argument to GraphObject.make: "+
b)):a instanceof Ye?(c=sb(Ye,b),null!==c?a.type=c:E&&v("Unknown PathSegment type as an argument to GraphObject.make: "+b)):E&&v("Unable to use a string as an argument to GraphObject.make: "+b);else if(b instanceof N)a instanceof W||v("A GraphObject can only be added to a Panel, not to: "+a),a.add(b);else if(b instanceof fk){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
fk?d.$l(b):v("A RowColumnDefinition can only be added to an object that implements getRowDefinition/getColumnDefinition, not to: "+a)}else if(b instanceof D)"function"===typeof a.hb?a.hb(b):Fa(a,b);else if(b instanceof Tl)a.type=b;else if(b instanceof Ui)a instanceof N?a.bind(b):a instanceof fk?a.bind(b):v("A Binding can only be applied to a GraphObject or RowColumnDefinition, not to: "+a);else if(b instanceof Xe)a instanceof me?a.figures.add(b):v("A PathFigure can only be added to a Geometry, not to: "+
a);else if(b instanceof Ye)a instanceof Xe?a.segments.add(b):v("A PathSegment can only be added to a PathFigure, not to: "+a);else if(b instanceof Oi)a instanceof P?a.layout=b:a instanceof xg?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++)Rl(a,b[c]);else if("object"===typeof b&&null!==b)if(a instanceof zl){c=new xb;for(var e in b)d=parseFloat(e),isNaN(d)?c[e]=b[e]:a.addColorStop(d,b[e]);Lj(a,c)}else if(a instanceof
fk){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 xb;for(c in b)"row"!==c&&"column"!==c&&(e[c]=b[c]);Lj(a,e)}else Lj(a,b);else v('Unknown initializer "'+b+'" for object being constructed by GraphObject.make: '+
a)}function Ul(a,b){z(a,"string",N,"defineBuilder:name");z(b,"function",N,"defineBuilder:func");var c=a.toLowerCase();E&&(""===a||"none"===c||a===c)&&v("Shape.defineFigureGenerator name must not be empty or None or all-lower-case: "+a);Ql.add(a,b)}
function Vl(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}
na.Object.defineProperties(N.prototype,{shadowVisible:{configurable:!0,get:function(){return this.Hl},set:function(a){var b=this.Hl;b!==a&&(E&&null!==a&&z(a,"boolean",N,"shadowVisible"),this.Hl=a,this.S(),this.g("shadowVisible",b,a))}},enabledChanged:{configurable:!0,get:function(){return null!==this.P?this.P.Fn:null},set:function(a){hl(this);var b=this.P.Fn;b!==a&&(null!==a&&z(a,"function",N,"enabledChanged"),this.P.Fn=a,this.g("enabledChanged",b,a))}},segmentOrientation:{configurable:!0,
enumerable:!0,get:function(){return this.Fl},set:function(a){var b=this.Fl;b!==a&&(E&&tb(a,T,N,"segmentOrientation"),this.Fl=a,this.v(),this.g("segmentOrientation",b,a),a===ch&&(this.angle=0))}},segmentIndex:{configurable:!0,get:function(){return this.np},set:function(a){E&&z(a,"number",N,"segmentIndex");a=Math.round(a);var b=this.np;b!==a&&(this.np=a,this.v(),this.g("segmentIndex",b,a))}},segmentFraction:{configurable:!0,get:function(){return this.Dl},set:function(a){E&&
z(a,"number",N,"segmentFraction");isNaN(a)?a=0:0>a?a=0:1<a&&(a=1);var b=this.Dl;b!==a&&(this.Dl=a,this.v(),this.g("segmentFraction",b,a))}},segmentOffset:{configurable:!0,get:function(){return this.El},set:function(a){var b=this.El;b.A(a)||(E&&w(a,J,N,"segmentOffset"),this.El=a=a.J(),this.v(),this.g("segmentOffset",b,a))}},stretch:{configurable:!0,get:function(){return this.ze},set:function(a){var b=this.ze;b!==a&&(E&&tb(a,N,N,"stretch"),this.ze=a,this.v(),this.g("stretch",
b,a))}},name:{configurable:!0,get:function(){return this.Wa},set:function(a){var b=this.Wa;b!==a&&(E&&z(a,"string",N,"name"),this.Wa=a,null!==this.part&&(this.part.zj=null),this.g("name",b,a))}},opacity:{configurable:!0,get:function(){return this.mb},set:function(a){var b=this.mb;b!==a&&(z(a,"number",N,"opacity"),(0>a||1<a)&&Ca(a,"0 <= value <= 1",N,"opacity"),this.mb=a,this.g("opacity",b,a),a=this.diagram,b=this.part,null!==a&&null!==b&&a.S(Pj(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&&(E&&z(a,"boolean",N,"visible"),this.I^=1,this.g("visible",b,a),b=this.panel,null!==b?b.v():this.xg()&&this.Ob(a),this.S(),Nl(this))}},pickable:{configurable:!0,get:function(){return 0!==(this.I&2)},set:function(a){var b=0!==(this.I&2);b!==a&&(E&&z(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&&(E&&z(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&&(E&&z(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&&(E&&z(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&&(E&&z(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&&(E&&z(a,"boolean",N,"isPanelMain"),this.I^=64,this.v(),
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&&(E&&z(a,"boolean",N,"isActionable"),this.I^=128,this.g("isActionable",b,a))}},areaBackground:{configurable:!0,get:function(){return this.fc},set:function(a){var b=this.fc;b!==a&&(null!==a&&Wl(a,"GraphObject.areaBackground"),a instanceof zl&&a.freeze(),this.fc=a,this.S(),this.g("areaBackground",b,a))}},background:{configurable:!0,
enumerable:!0,get:function(){return this.jb},set:function(a){var b=this.jb;b!==a&&(null!==a&&Wl(a,"GraphObject.background"),a instanceof zl&&a.freeze(),this.jb=a,this.S(),this.g("background",b,a))}},part:{configurable:!0,get:function(){if(this.xg())return this;if(null!==this.Ej)return this.Ej;var a;for(a=this.panel;a;){if(a instanceof U)return this.Ej=a;a=a.panel}return null}},svg:{configurable:!0,get:function(){return this.Gs},set:function(a){this.Gs=a}},panel:{configurable:!0,
enumerable:!0,get:function(){return this.eg}},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.ua},set:function(a){E&&w(a,J,N,"position");var b=a.x,c=a.y,d=this.ua,e=d.x,f=d.y;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))?this.Tv():(a=a.J(),this.Sv(a,d)&&this.g("position",
d,a))}},actualBounds:{configurable:!0,get:function(){return this.wb}},scale:{configurable:!0,get:function(){return this.Da},set:function(a){var b=this.Da;b!==a&&(E&&B(a,N,"scale"),0>=a&&v("GraphObject.scale for "+this+" must be greater than zero, not: "+a),this.Da=a,this.v(),this.g("scale",b,a))}},angle:{configurable:!0,get:function(){return this.Bc},set:function(a){var b=this.Bc;b!==a&&(E&&B(a,N,"angle"),a%=360,0>a&&(a+=360),b!==a&&(this.Bc=a,Nl(this),this.v(),
this.g("angle",b,a)))}},desiredSize:{configurable:!0,get:function(){return this.Qc},set:function(a){E&&w(a,Zb,N,"desiredSize");var b=a.width,c=a.height,d=this.Qc,e=d.width,f=d.height;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))||(this.Qc=a=a.J(),this.v(),this instanceof Hg&&this.cc(),this.g("desiredSize",d,a),kl(this)&&(a=this.part,null!==a&&(ll(this,a,"width"),ll(this,a,"height"))))}},width:{configurable:!0,get:function(){return this.Qc.width},set:function(a){var b=
this.Qc.width;b===a||isNaN(b)&&isNaN(a)||(E&&z(a,"number",N,"width"),b=this.Qc,this.Qc=a=(new Zb(a,this.Qc.height)).freeze(),this.v(),this instanceof Hg&&this.cc(),this.g("desiredSize",b,a),kl(this)&&(a=this.part,null!==a&&ll(this,a,"width")))}},height:{configurable:!0,get:function(){return this.Qc.height},set:function(a){var b=this.Qc.height;b===a||isNaN(b)&&isNaN(a)||(E&&z(a,"number",N,"height"),b=this.Qc,this.Qc=a=(new Zb(this.Qc.width,a)).freeze(),this.v(),this instanceof Hg&&this.cc(),
this.g("desiredSize",b,a),kl(this)&&(a=this.part,null!==a&&ll(this,a,"height")))}},minSize:{configurable:!0,get:function(){return this.Uf},set:function(a){var b=this.Uf;b.A(a)||(E&&w(a,Zb,N,"minSize"),a=a.copy(),isNaN(a.width)&&(a.width=0),isNaN(a.height)&&(a.height=0),a.freeze(),this.Uf=a,this.v(),this.g("minSize",b,a))}},maxSize:{configurable:!0,get:function(){return this.Tf},set:function(a){var b=this.Tf;b.A(a)||(E&&w(a,Zb,N,"maxSize"),a=a.copy(),isNaN(a.width)&&(a.width=
Infinity),isNaN(a.height)&&(a.height=Infinity),a.freeze(),this.Tf=a,this.v(),this.g("maxSize",b,a))}},measuredBounds:{configurable:!0,get:function(){return this.qc}},naturalBounds:{configurable:!0,get:function(){return this.rc}},margin:{configurable:!0,get:function(){return this.Xg},set:function(a){"number"===typeof a?a=new Hc(a):E&&w(a,Hc,N,"margin");var b=this.Xg;b.A(a)||(this.Xg=a=a.J(),this.v(),this.g("margin",b,a))}},transform:{configurable:!0,
get:function(){0!==(this.I&2048)===!0&&wl(this);return this.ub}},td:{configurable:!0,get:function(){0!==(this.I&4096)===!0&&wl(this);return this.Gh}},alignment:{configurable:!0,get:function(){return this.xb},set:function(a){var b=this.xb;b.A(a)||(E&&w(a,M,N,"alignment"),a.Nb()&&!a.Cb()&&v("GraphObject.alignment for "+this+" must be a real Spot or Spot.Default, not: "+a),this.xb=a=a.J(),Il(this),this.g("alignment",b,a))}},column:{configurable:!0,get:function(){return this.Hg},
set:function(a){E&&B(a,N,"column");a=Math.round(a);var b=this.Hg;b!==a&&(0>a&&Ca(a,">= 0",N,"column"),this.Hg=a,this.v(),this.g("column",b,a))}},columnSpan:{configurable:!0,get:function(){return this.cn},set:function(a){E&&z(a,"number",N,"columnSpan");a=Math.round(a);var b=this.cn;b!==a&&(1>a&&Ca(a,">= 1",N,"columnSpan"),this.cn=a,this.v(),this.g("columnSpan",b,a))}},row:{configurable:!0,get:function(){return this.ip},set:function(a){E&&B(a,N,"row");a=Math.round(a);var b=
this.ip;b!==a&&(0>a&&Ca(a,">= 0",N,"row"),this.ip=a,this.v(),this.g("row",b,a))}},rowSpan:{configurable:!0,get:function(){return this.jp},set:function(a){E&&z(a,"number",N,"rowSpan");a=Math.round(a);var b=this.jp;b!==a&&(1>a&&Ca(a,">= 1",N,"rowSpan"),this.jp=a,this.v(),this.g("rowSpan",b,a))}},spanAllocation:{configurable:!0,get:function(){return this.zp},set:function(a){var b=this.zp;b!==a&&(null!==a&&z(a,"function",N,"spanAllocation"),this.zp=a,this.v(),this.g("spanAllocation",
b,a))}},alignmentFocus:{configurable:!0,get:function(){return this.Ck},set:function(a){var b=this.Ck;b.A(a)||(E&&w(a,M,N,"alignmentFocus"),!E||!a.Nb()||a.Cb()||a.kq()&&this instanceof V||v("GraphObject.alignmentFocus must be a real Spot or Spot.Default, not: "+a),this.Ck=a=a.J(),this.v(),this.g("alignmentFocus",b,a))}},portId:{configurable:!0,get:function(){return this.Vo},set:function(a){var b=this.Vo;if(b!==a){E&&null!==a&&z(a,"string",N,"portId");var c=this.part;null===
c||c instanceof V||(v("Cannot set portID on a Link: "+a),c=null);null!==b&&null!==c&&Xl(c,this);this.Vo=a;null!==a&&null!==c&&(c.zh=!0,Yl(c,this));this.g("portId",b,a)}}},toSpot:{configurable:!0,get:function(){return null!==this.R?this.R.oh:ed},set:function(a){this.Jc();var b=this.R.oh;b.A(a)||(E&&w(a,M,N,"toSpot"),a=a.J(),this.R.oh=a,this.g("toSpot",b,a),Ml(this))}},toEndSegmentLength:{configurable:!0,get:function(){return null!==this.R?this.R.mh:10},set:function(a){this.Jc();
var b=this.R.mh;b!==a&&(E&&z(a,"number",N,"toEndSegmentLength"),0>a&&Ca(a,">= 0",N,"toEndSegmentLength"),this.R.mh=a,this.g("toEndSegmentLength",b,a),Ml(this))}},toShortLength:{configurable:!0,get:function(){return null!==this.R?this.R.nh:0},set:function(a){this.Jc();var b=this.R.nh;b!==a&&(E&&z(a,"number",N,"toShortLength"),this.R.nh=a,this.g("toShortLength",b,a),Ml(this))}},toLinkable:{configurable:!0,get:function(){return null!==this.R?this.R.Gp:null},set:function(a){this.Jc();
var b=this.R.Gp;b!==a&&(E&&null!==a&&z(a,"boolean",N,"toLinkable"),this.R.Gp=a,this.g("toLinkable",b,a))}},toMaxLinks:{configurable:!0,get:function(){return null!==this.R?this.R.Hp:Infinity},set:function(a){this.Jc();var b=this.R.Hp;b!==a&&(E&&z(a,"number",N,"toMaxLinks"),0>a&&Ca(a,">= 0",N,"toMaxLinks"),this.R.Hp=a,this.g("toMaxLinks",b,a))}},fromSpot:{configurable:!0,get:function(){return null!==this.R?this.R.Qg:ed},set:function(a){this.Jc();var b=this.R.Qg;b.A(a)||(E&&
w(a,M,N,"fromSpot"),a=a.J(),this.R.Qg=a,this.g("fromSpot",b,a),Ml(this))}},fromEndSegmentLength:{configurable:!0,get:function(){return null!==this.R?this.R.Og:10},set:function(a){this.Jc();var b=this.R.Og;b!==a&&(E&&z(a,"number",N,"fromEndSegmentLength"),0>a&&Ca(a,">= 0",N,"fromEndSegmentLength"),this.R.Og=a,this.g("fromEndSegmentLength",b,a),Ml(this))}},fromShortLength:{configurable:!0,get:function(){return null!==this.R?this.R.Pg:0},set:function(a){this.Jc();var b=this.R.Pg;
b!==a&&(E&&z(a,"number",N,"fromShortLength"),this.R.Pg=a,this.g("fromShortLength",b,a),Ml(this))}},fromLinkable:{configurable:!0,get:function(){return null!==this.R?this.R.Hn:null},set:function(a){this.Jc();var b=this.R.Hn;b!==a&&(E&&null!==a&&z(a,"boolean",N,"fromLinkable"),this.R.Hn=a,this.g("fromLinkable",b,a))}},fromMaxLinks:{configurable:!0,get:function(){return null!==this.R?this.R.In:Infinity},set:function(a){this.Jc();var b=this.R.In;b!==a&&(E&&z(a,"number",N,"fromMaxLinks"),
0>a&&Ca(a,">= 0",N,"fromMaxLinks"),this.R.In=a,this.g("fromMaxLinks",b,a))}},cursor:{configurable:!0,get:function(){return this.nn},set:function(a){var b=this.nn;b!==a&&(z(a,"string",N,"cursor"),this.nn=a,this.g("cursor",b,a))}},click:{configurable:!0,get:function(){return null!==this.P?this.P.Ef:null},set:function(a){hl(this);var b=this.P.Ef;b!==a&&(null!==a&&z(a,"function",N,"click"),this.P.Ef=a,this.g("click",b,a))}},doubleClick:{configurable:!0,get:function(){return null!==
this.P?this.P.Jf:null},set:function(a){hl(this);var b=this.P.Jf;b!==a&&(null!==a&&z(a,"function",N,"doubleClick"),this.P.Jf=a,this.g("doubleClick",b,a))}},contextClick:{configurable:!0,get:function(){return null!==this.P?this.P.Ff:null},set:function(a){hl(this);var b=this.P.Ff;b!==a&&(null!==a&&z(a,"function",N,"contextClick"),this.P.Ff=a,this.g("contextClick",b,a))}},mouseEnter:{configurable:!0,get:function(){return null!==this.P?this.P.Wf:null},set:function(a){hl(this);
var b=this.P.Wf;b!==a&&(null!==a&&z(a,"function",N,"mouseEnter"),this.P.Wf=a,this.g("mouseEnter",b,a))}},mouseLeave:{configurable:!0,get:function(){return null!==this.P?this.P.Zf:null},set:function(a){hl(this);var b=this.P.Zf;b!==a&&(null!==a&&z(a,"function",N,"mouseLeave"),this.P.Zf=a,this.g("mouseLeave",b,a))}},mouseOver:{configurable:!0,get:function(){return null!==this.P?this.P.$f:null},set:function(a){hl(this);var b=this.P.$f;b!==a&&(null!==a&&z(a,"function",N,"mouseOver"),
this.P.$f=a,this.g("mouseOver",b,a))}},mouseHover:{configurable:!0,get:function(){return null!==this.P?this.P.Yf:null},set:function(a){hl(this);var b=this.P.Yf;b!==a&&(null!==a&&z(a,"function",N,"mouseHover"),this.P.Yf=a,this.g("mouseHover",b,a))}},mouseHold:{configurable:!0,get:function(){return null!==this.P?this.P.Xf:null},set:function(a){hl(this);var b=this.P.Xf;b!==a&&(null!==a&&z(a,"function",N,"mouseHold"),this.P.Xf=a,this.g("mouseHold",b,a))}},mouseDragEnter:{configurable:!0,
enumerable:!0,get:function(){return null!==this.P?this.P.xo:null},set:function(a){hl(this);var b=this.P.xo;b!==a&&(null!==a&&z(a,"function",N,"mouseDragEnter"),this.P.xo=a,this.g("mouseDragEnter",b,a))}},mouseDragLeave:{configurable:!0,get:function(){return null!==this.P?this.P.yo:null},set:function(a){hl(this);var b=this.P.yo;b!==a&&(null!==a&&z(a,"function",N,"mouseDragLeave"),this.P.yo=a,this.g("mouseDragLeave",b,a))}},mouseDrop:{configurable:!0,get:function(){return null!==
this.P?this.P.Vf:null},set:function(a){hl(this);var b=this.P.Vf;b!==a&&(null!==a&&z(a,"function",N,"mouseDrop"),this.P.Vf=a,this.g("mouseDrop",b,a))}},actionDown:{configurable:!0,get:function(){return null!==this.P?this.P.Nm:null},set:function(a){hl(this);var b=this.P.Nm;b!==a&&(null!==a&&z(a,"function",N,"actionDown"),this.P.Nm=a,this.g("actionDown",b,a))}},actionMove:{configurable:!0,get:function(){return null!==this.P?this.P.Om:null},set:function(a){hl(this);var b=this.P.Om;
b!==a&&(null!==a&&z(a,"function",N,"actionMove"),this.P.Om=a,this.g("actionMove",b,a))}},actionUp:{configurable:!0,get:function(){return null!==this.P?this.P.Pm:null},set:function(a){hl(this);var b=this.P.Pm;b!==a&&(null!==a&&z(a,"function",N,"actionUp"),this.P.Pm=a,this.g("actionUp",b,a))}},actionCancel:{configurable:!0,get:function(){return null!==this.P?this.P.Mm:null},set:function(a){hl(this);var b=this.P.Mm;b!==a&&(null!==a&&z(a,"function",N,"actionCancel"),this.P.Mm=
a,this.g("actionCancel",b,a))}},toolTip:{configurable:!0,get:function(){return null!==this.P?this.P.lg:null},set:function(a){hl(this);var b=this.P.lg;b!==a&&(!E||null===a||a instanceof Cf||a instanceof Hf||v("GraphObject.toolTip must be an Adornment or HTMLInfo."),this.P.lg=a,this.g("toolTip",b,a))}},contextMenu:{configurable:!0,get:function(){return null!==this.P?this.P.Gf:null},set:function(a){hl(this);var b=this.P.Gf;b!==a&&(!E||a instanceof Cf||a instanceof Hf||v("GraphObject.contextMenu must be an Adornment or HTMLInfo."),
this.P.Gf=a,this.g("contextMenu",b,a))}}});N.prototype.setProperties=N.prototype.Uv;N.prototype.findTemplateBinder=N.prototype.Li;N.prototype.bind=N.prototype.bind;N.prototype.isEnabledObject=N.prototype.wg;N.prototype.isVisibleObject=N.prototype.vf;N.prototype.isContainedBy=N.prototype.vg;N.prototype.getNearestIntersectionPoint=N.prototype.Wc;N.prototype.getLocalPoint=N.prototype.at;N.prototype.getDocumentScale=N.prototype.Ge;N.prototype.getDocumentAngle=N.prototype.Oi;
N.prototype.getDocumentBounds=N.prototype.eq;N.prototype.getDocumentPoint=N.prototype.oa;N.prototype.intersectsRect=N.prototype.Kc;N.prototype.containedInRect=N.prototype.wh;N.prototype.containsRect=N.prototype.qf;N.prototype.containsPoint=N.prototype.ea;N.prototype.raiseChanged=N.prototype.g;N.prototype.raiseChangedEvent=N.prototype.cb;N.prototype.addCopyProperty=N.prototype.Ww;var Ql=null;N.className="GraphObject";Ql=new Ub;
Ul("Button",function(){function a(a,b){return null!==a.diagram.Tb(a.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a},function(a){return a===b})}var b=Pl(W,W.Auto,{isActionable:!0,enabledChanged:function(a,b){if(a instanceof W){var c=a.bb("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"},Pl(Hg,{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.wg()&&b instanceof W&&(a=b.bb("ButtonBorder"),a instanceof Hg)){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.wg()&&b instanceof W&&(a=b.bb("ButtonBorder"),a instanceof Hg&&(a.fill=b._buttonFillNormal,a.stroke=b._buttonStrokeNormal))};b.actionDown=function(a,b){if(b.wg()&&b instanceof W&&null!==b._buttonFillPressed&&0===a.button){var c=b.bb("ButtonBorder");if(c instanceof Hg){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.wg()&&d instanceof W&&null!==d._buttonFillPressed&&0===b.button){var c=d.bb("ButtonBorder");if(c instanceof Hg){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.wg()&&d instanceof W&&null!==d._buttonFillPressed){var c=d.bb("ButtonBorder");if(c instanceof Hg){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.wg()&&d instanceof W&&null!==d._buttonFillPressed){var c=b.diagram;if(0===c.firstInput.button&&(c.currentTool.standardMouseOver(),a(b,d)&&(b=d.bb("ButtonBorder"),b instanceof Hg))){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});
Ul("TreeExpanderButton",function(){var a=Pl("Button",{_treeExpandedFigure:"MinusLine",_treeCollapsedFigure:"PlusLine"},Pl(Hg,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:uc},(new Ui("figure","isTreeExpanded",function(a,c){c=c.panel;return a?c._treeExpandedFigure:c._treeCollapsedFigure})).rq()),{visible:!1},(new Ui("visible","isTreeLeaf",function(a){return!a})).rq());a.click=function(a,c){c=c.part;c instanceof Cf&&(c=c.adornedPart);if(c instanceof V){var b=c.diagram;
if(null!==b){b=b.commandHandler;if(c.isTreeExpanded){if(!b.canCollapseTree(c))return}else if(!b.canExpandTree(c))return;a.handled=!0;c.isTreeExpanded?b.collapseTree(c):b.expandTree(c)}}};return a});
Ul("SubGraphExpanderButton",function(){var a=Pl("Button",{_subGraphExpandedFigure:"MinusLine",_subGraphCollapsedFigure:"PlusLine"},Pl(Hg,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:uc},(new Ui("figure","isSubGraphExpanded",function(a,c){c=c.panel;return a?c._subGraphExpandedFigure:c._subGraphCollapsedFigure})).rq()));a.click=function(a,c){c=c.part;c instanceof Cf&&(c=c.adornedPart);if(c instanceof xg){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});Ul("ToolTip",function(){return Pl(Cf,W.Auto,{isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new J(0,3),shadowBlur:5},Pl(Hg,{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)}))});
Ul("ContextMenu",function(){return Pl(Cf,W.Vertical,{background:"#F5F5F5",isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new J(0,3),shadowBlur:5},new Ui("background","",function(a){return null!==a.adornedPart&&null!==a.placeholder?null:"#F5F5F5"}))});Ul("ContextMenuButton",function(){var a=Pl("Button");a.stretch=bl;var b=a.bb("ButtonBorder");b instanceof Hg&&(b.figure="Rectangle",b.strokeWidth=0,b.spot1=new M(0,0,2,3),b.spot2=new M(1,1,-2,-2));return a});
Ul("PanelExpanderButton",function(a){var b=Vl(a,"COLLAPSIBLE"),c=Pl("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},Pl(Hg,{name:"ButtonIcon",strokeWidth:2},(new Ui("geometryString","visible",function(a){return a?c._buttonExpandedFigure:c._buttonCollapsedFigure})).rq(b)));
a=c.bb("ButtonBorder");a instanceof Hg&&(a.stroke=null,a.fill="rgba(0, 0, 0, 0)");c.click=function(a,c){a=c.diagram;if(null!==a&&!a.isReadOnly){var d=c.Li();null===d&&(d=c.part);null!==d&&(c=d.bb(b),null!==c&&(a.Ca("Collapse/Expand Panel"),c.visible=!c.visible,a.ab("Collapse/Expand Panel")))}};return c});
Ul("CheckBoxButton",function(a){var b=Vl(a);a=Pl("Button",{desiredSize:new Zb(14,14)},Pl(Hg,{name:"ButtonIcon",geometryString:"M0 0 M0 8.85 L4.9 13.75 16.2 2.45 M16.2 16.2",strokeWidth:2,stretch:oe,geometryStretch:ph,visible:!1},""!==b?(new Ui("visible",b)).zx():[]));a.click=function(a,d){if(d instanceof W){var c=a.diagram;if(!(null===c||c.isReadOnly||""!==b&&c.model.isReadOnly)){a.handled=!0;var f=d.bb("ButtonIcon");c.Ca("checkbox");f.visible=!f.visible;"function"===typeof d._doClick&&d._doClick(a,
d);c.ab("checkbox")}}};return a});
Ul("CheckBox",function(a){a=Vl(a);a=Pl("CheckBoxButton",a,{name:"Button",isActionable:!1,margin:new Hc(0,1,0,0)});var b=Pl(W,"Horizontal",a,{isActionable:!0,cursor:a.cursor,margin:1,_buttonFillNormal:a._buttonFillNormal,_buttonStrokeNormal:a._buttonStrokeNormal,_buttonFillOver:a._buttonFillOver,_buttonStrokeOver:a._buttonStrokeOver,_buttonFillPressed:a._buttonFillPressed,_buttonStrokePressed:a._buttonStrokePressed,_buttonFillDisabled:a._buttonFillDisabled,mouseEnter:a.mouseEnter,mouseLeave:a.mouseLeave,
actionDown:a.actionDown,actionUp:a.actionUp,actionCancel:a.actionCancel,actionMove:a.actionMove,click:a.click,_buttonClick:a.click});a.mouseEnter=null;a.mouseLeave=null;a.actionDown=null;a.actionUp=null;a.actionCancel=null;a.actionMove=null;a.click=null;return b});N.None=nh=new D(N,"None",0);N.Default=al=new D(N,"Default",0);N.Vertical=cl=new D(N,"Vertical",4);N.Horizontal=bl=new D(N,"Horizontal",5);N.Fill=oe=new D(N,"Fill",3);N.Uniform=ph=new D(N,"Uniform",1);
N.UniformToFill=dl=new D(N,"UniformToFill",2);N.FlipVertical=el=new D(N,"FlipVertical",1);N.FlipHorizontal=fl=new D(N,"FlipHorizontal",2);N.FlipBoth=gl=new D(N,"FlipBoth",3);N.make=Pl;N.getBuilders=function(){var a=new Ub,b;for(b in Ql)if(b!==b.toLowerCase()){var c=Ql.K(b);"function"===typeof c&&a.add(b,c)}a.freeze();return a};N.defineBuilder=Ul;N.takeBuilderArgument=Vl;
function il(){this.Fn=this.Gf=this.lg=this.Mm=this.Pm=this.Om=this.Nm=this.Vf=this.yo=this.xo=this.Xf=this.Yf=this.$f=this.Zf=this.Wf=this.Ff=this.Jf=this.Ef=null}il.prototype.copy=function(){var a=new il;a.Ef=this.Ef;a.Jf=this.Jf;a.Ff=this.Ff;a.Wf=this.Wf;a.Zf=this.Zf;a.$f=this.$f;a.Yf=this.Yf;a.Xf=this.Xf;a.xo=this.xo;a.yo=this.yo;a.Vf=this.Vf;a.Nm=this.Nm;a.Om=this.Om;a.Pm=this.Pm;a.Mm=this.Mm;a.lg=this.lg;a.Gf=this.Gf;a.Fn=this.Fn;return a};il.className="GraphObjectEventHandlers";
function Zl(){this.Qa=[1,0,0,1,0,0]}Zl.prototype.copy=function(){var a=new Zl;a.Qa[0]=this.Qa[0];a.Qa[1]=this.Qa[1];a.Qa[2]=this.Qa[2];a.Qa[3]=this.Qa[3];a.Qa[4]=this.Qa[4];a.Qa[5]=this.Qa[5];return a};Zl.prototype.translate=function(a,b){this.Qa[4]+=this.Qa[0]*a+this.Qa[2]*b;this.Qa[5]+=this.Qa[1]*a+this.Qa[3]*b};Zl.prototype.scale=function(a,b){this.Qa[0]*=a;this.Qa[1]*=a;this.Qa[2]*=b;this.Qa[3]*=b};Zl.className="STransform";
function $l(a){this.type=a;this.r2=this.y2=this.x2=this.r1=this.y1=this.x1=0;this.ex=[];this.pattern=null}$l.prototype.addColorStop=function(a,b){this.ex.push({offset:a,color:b})};$l.className="SGradient";
function Oj(a,b){this.ownerDocument=a=void 0===b?ra.document:b;this.Qz="http://www.w3.org/2000/svg";void 0!==a&&(this.Ha=this.vb("svg",{width:"1px",height:"1px",viewBox:"0 0 1 1"}),this.Ha.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns","http://www.w3.org/2000/svg"),this.Ha.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"));this.Zp=null;this.context=new am(this)}
Oj.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.Ha.setAttributeNS(null,"width",c+"px"),this.Ha.setAttributeNS(null,"height",d+"px"),this.Ha.setAttributeNS(null,"viewBox","0 0 "+c+" "+d),this.context.mu.firstElementChild.setAttributeNS(null,"width",c+"px"),this.context.mu.firstElementChild.setAttributeNS(null,"height",d+"px"),!0):!1};
Oj.prototype.vb=function(a,b,c){a=this.ownerDocument.createElementNS(this.Qz,a);if(Ja(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};Oj.prototype.getBoundingClientRect=function(){return this.Ha.getBoundingClientRect()};Oj.prototype.focus=function(){this.Ha.focus()};Oj.prototype.kx=function(){this.ownerDocument=null};
na.Object.defineProperties(Oj.prototype,{width:{configurable:!0,get:function(){return this.Ha.width.baseVal.value},set:function(a){this.Ha.width=a}},height:{configurable:!0,get:function(){return this.Ha.height.baseVal.value},set:function(a){this.Ha.height=a}},style:{configurable:!0,get:function(){return this.Ha.style}}});Oj.className="SVGSurface";
function am(a){this.wk=a;this.svg=a.Ha;this.stack=[];this.yc=[];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.Qd=this.vp=this.tp=0;this.lq=null;this.path=[];this.hu=!1;this.hh=null;this.ih=0;this.Ud=new Zl;
bm(this,1,0,0,1,0,0);var b=Pb++,c=this.vb("clipPath",{id:"mainClip"+b});c.appendChild(this.vb("rect",{x:0,y:0,width:a.width,height:a.height}));this.mu=c;this.wk.Ha.appendChild(c);this.yc[0].setAttributeNS(null,"clip-path","url(#mainClip"+b+")");this.Sz={}}t=am.prototype;
t.reset=function(){this.stack=[];this.yc=[];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.Qd=this.vp=this.tp=0;this.lq=null;this.path=[];this.Ud=new Zl;bm(this,1,0,0,1,0,0);var a=Pb++,b=this.vb("clipPath",
{id:"mainClip"+a});b.appendChild(this.vb("rect",{x:0,y:0,width:this.wk.width,height:this.wk.height}));this.mu=b;this.wk.Ha.appendChild(b);this.yc[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,q=b+n,r=f?0:1;d=f?d-e:e-d;(1E-6<Math.abs(g-p)||1E-6<Math.abs(h-q))&&this.path.push(["L",p,+q]);0>d&&(d=d%k+k);d>l?(this.path.push(["A",c,c,0,1,r,a-m,b-n]),this.path.push(["A",c,c,0,1,r,p,q])):1E-6<d&&this.path.push(["A",c,c,0,+(d>=Math.PI),r,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.Ud);this.addPath("clipPath",this.path,new Zl)};t.closePath=function(){this.path.push(["z"])};t.createLinearGradient=function(a,b,c,d){var e=new $l("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.Sz;if(c[b])return"url(#"+c[b]+")";var d="PATTERN"+Pb++,e={x:0,y:0,width:a.width,height:a.height,href:b};a=this.vb("pattern",{width:a.width,height:a.height,id:d,patternUnits:"userSpaceOnUse"});a.appendChild(this.vb("image",e));this.svg.appendChild(a);c[b]=d;return"url(#"+d+")"};
t.createRadialGradient=function(a,b,c,d,e,f){var g=new $l("radial");g.x1=a;g.y1=b;g.r1=c;g.x2=d;g.y2=e;g.r2=f;return g};
t.drawImage=function(a,b,c,d,e,f,g,h,k){var l="";a instanceof HTMLCanvasElement&&(l=a.toDataURL());a instanceof HTMLImageElement&&(l=a.getAttribute("src"));var m=a instanceof HTMLImageElement?a.naturalWidth:a.width,n=a instanceof HTMLImageElement?a.naturalHeight:a.height;void 0===d&&(f=b,g=c,h=d=m,k=e=n);d=d||0;e=e||0;f=f||0;g=g||0;h=h||0;k=k||0;l={x:0,y:0,width:m||d,height:n||e,href:l,preserveAspectRatio:"xMidYMid slice"};K.da(d,h)&&K.da(e,k)||(l.preserveAspectRatio="none");a="";h/=d;k/=e;if(0!==
f||0!==g)a+=" translate("+f+", "+g+")";if(1!==h||1!==k)a+=" scale("+h+", "+k+")";if(0!==b||0!==c)a+=" translate("+-b+", "+-c+")";if(0!==b||0!==c||d!==m||e!==n)f="CLIP"+Pb++,g=this.vb("clipPath",{id:f}),g.appendChild(this.vb("rect",{x:b,y:c,width:d,height:e})),this.svg.appendChild(g),l["clip-path"]="url(#"+f+")";cm(this,"image",l,this.Ud,a);this.addElement("image",l)};t.fill=function(){this.addPath("fill",this.path,this.Ud)};t.Vd=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]};cm(this,"fill",a,this.Ud);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};cm(this,"fill",b,this.Ud);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.Ud=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.Ud.copy())};
t.setTransform=function(a,b,c,d,e,f){1===a&&0===b&&0===c&&1===d&&0===e&&0===f||bm(this,a,b,c,d,e,f)};t.scale=function(a,b){this.Ud.scale(a,b)};t.translate=function(a,b){this.Ud.translate(a,b)};t.transform=function(){};t.stroke=function(){this.addPath("stroke",this.path,this.Ud)};t.$i=function(){this.clipInsteadOfFill||this.stroke()};t.vb=function(a,b,c){return this.wk.vb(a,b,c)};
t.addElement=function(a,b,c){a=this.vb(a,b,c);0<this.yc.length?this.yc[this.yc.length-1].appendChild(a):this.svg.appendChild(a);return this.lq=a};
function cm(a,b,c,d,e){1!==a.globalAlpha&&(c.opacity=a.globalAlpha);"fill"===b?(a.fillStyle instanceof $l?c.fill=dm(a,a.fillStyle):(/^rgba\(/.test(a.fillStyle)&&(b=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(a.fillStyle),c.fill="rgb("+b[1]+","+b[2]+","+b[3]+")",c["fill-opacity"]=b[4]),c.fill=a.fillStyle),c.stroke="none"):"stroke"===b&&(c.fill="none",a.strokeStyle instanceof $l?c.stroke=dm(a,a.strokeStyle):(/^rgba\(/.test(a.strokeStyle)&&(b=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(a.strokeStyle),
c.stroke="rgb("+b[1]+","+b[2]+","+b[3]+")",c["stroke-opacity"]=b[4]),c.stroke=a.strokeStyle),c["stroke-width"]=a.lineWidth,c["stroke-linecap"]=a.lineCap,c["stroke-linejoin"]=a.lineJoin,c["stroke-miterlimit"]=a.miterLimit);a=d.Qa;a="matrix("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+")";void 0!==e&&(a+=e);c.transform=a}
function dm(a,b){var c="GRAD"+Pb++;if("linear"===b.type)var d=a.vb("linearGradient",{x1:b.x1,x2:b.x2,y1:b.y1,y2:b.y2,id:c,gradientUnits:"userSpaceOnUse"});else if("radial"===b.type)d=a.vb("radialGradient",{x1:b.x1,x2:b.x2,y1:b.y1,y2:b.y2,r1:b.r1,r2:b.r2,id:c});else throw Error("invalid gradient");var e=b.ex;b=e.length;for(var f=[],g=0;g<b;g++){var h=e[g],k=h.color;h={offset:h.offset,"stop-color":k};/^rgba\(/.test(k)&&(k=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(k),
h["stop-color"]="rgb("+k[1]+","+k[2]+","+k[3]+")",h["stop-opacity"]=k[4]);f.push(h)}f.sort(function(a,b){return a.offset>b.offset?1:-1});for(e=0;e<b;e++)d.appendChild(a.vb("stop",f[e]));a.svg.appendChild(d);return"url(#"+c+")"}
t.addPath=function(a,b,c){for(var d=[],e=0;e<b.length;e++){var f=Ma(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.hu&&(b["stroke-dasharray"]=this.hh.toString(),b["stroke-dashoffset"]=this.ih);cm(this,a,b,c);"clipPath"===a?(a="CLIP"+Pb++,c=this.vb("clipPath",{id:a}),c.appendChild(this.vb("path",b)),this.svg.appendChild(c),
0<this.yc.length&&this.yc[this.yc.length-1].setAttributeNS(null,"clip-path","url(#"+a+")")):this.addElement("path",b)};function bm(a,b,c,d,e,f,g){var h=new Zl;h.Qa=[b,c,d,e,f,g];b={};cm(a,"g",b,h);h=a.addElement("g",b);a.yc.push(h)}
t.Aq=function(){if(0!==this.shadowOffsetX||0!==this.shadowOffsetY||0!==this.shadowBlur){var a="SHADOW"+Pb++,b=this.addElement("filter",{id:a,x:"-100%",y:"-100%",width:"300%",height:"300%"},null);var c=this.vb("feGaussianBlur",{"in":"SourceAlpha",result:"blur",xA:this.shadowBlur/2});var d=this.vb("feFlood",{"in":"blur",result:"flood","flood-color":this.shadowColor});var e=this.vb("feComposite",{"in":"flood",in2:"blur",operator:"in",result:"comp"});var f=this.vb("feOffset",{"in":"comp",result:"offsetBlur",
dx:this.shadowOffsetX,dy:this.shadowOffsetY});var g=this.vb("feMerge",{});g.appendChild(this.vb("feMergeNode",{"in":"offsetBlur"}));g.appendChild(this.vb("feMergeNode",{"in":"SourceGraphic"}));b.appendChild(c);b.appendChild(d);b.appendChild(e);b.appendChild(f);b.appendChild(g);0<this.yc.length&&this.yc[this.yc.length-1].setAttributeNS(null,"filter","url(#"+a+")")}};t.Vv=function(a,b,c){this.tp=a;this.vp=b;this.Qd=c};function yl(a){a.shadowOffsetX=0;a.shadowOffsetY=0;a.shadowBlur=0}
function xl(a){a.shadowOffsetX=a.tp;a.shadowOffsetY=a.vp;a.shadowBlur=a.Qd}t.Us=function(a,b){this.hu=!0;this.hh=a;this.ih=b};t.Ss=function(){this.hu=!1};t.Uc=function(){};t.Nx=function(){};am.prototype.rotate=function(){};am.prototype.getImageData=function(){return null};am.prototype.measureText=function(){return null};am.className="SVGContext";
P.prototype.nt=function(a){var b=new Oj(this,ra.document);void 0===a&&(a=new xb);var c=this;return Hk(this,function(a,e){a=Ik(c,a,"SVG",b);a=null!==a?a.svg:null;return"function"===typeof e?(e(a),null):a},a)};P.prototype.makeSvg=P.prototype.nt;P.prototype.uv=function(a){return this.nt(a)};P.prototype.makeSVG=P.prototype.uv;
N.prototype.lx=function(a,b){if(!(a instanceof am))return!1;if(!this.visible)return!0;var c=null,d=a.lq;if(this instanceof W&&(this.type===W.TableRow||this.type===W.TableColumn))return vl(this,a,b),!0;var e=this.wb;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&&wl(this);var h=0!==(this.I&256),k=!1;this instanceof Kh&&(a.font=this.font);if(h){k=g.ae()?g.naturalBounds:g.actualBounds;if(null!==this.md){var l=this.md;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;bm(a,1,0,0,1,0,0);a.save();a.beginPath();a.rect(m,n,p,l);a.clip()}if(this.xg()&&!this.isVisible())return!0;a.Ud.Qa=[1,0,0,1,0,0];(this instanceof Kh&&1<this.lineCount||this instanceof Hg&&1<this.geometry.figures.length)&&bm(a,1,0,0,1,0,0);m=!1;this.xg()&&this.isShadowed&&b.He("drawShadows")&&
(n=this.wi,a.Vv(n.x*b.scale*b.Pb,n.y*b.scale*b.Pb,this.Qd),xl(a),a.shadowColor=this.Mj);n=!1;this.part&&b.He("drawShadows")&&(n=this.part.isShadowed);!0===this.shadowVisible?(xl(a),!1===m&&n&&(bm(a,1,0,0,1,0,0),a.Aq(),m=!0)):!1===this.shadowVisible&&yl(a);p=this.naturalBounds;null!==this.areaBackground&&(zi(this,a,this.areaBackground,!0,!0,p,e),!1===m&&n&&(bm(a,1,0,0,1,0,0),a.Aq(),m=!0),this.areaBackground instanceof zl&&this.areaBackground.type===Al?(a.beginPath(),a.rect(e.x,e.y,e.width,e.height),
a.Vd(this.areaBackground)):a.fillRect(e.x,e.y,e.width,e.height));this instanceof W?bm(a,f.m11,f.m12,f.m21,f.m22,f.dx,f.dy):a.Ud.Qa=[f.m11,f.m12,f.m21,f.m22,f.dx,f.dy];if(null!==this.background){!1===m&&n&&(bm(a,1,0,0,1,0,0),a.Aq(),m=!0);var q=this.naturalBounds;l=f=0;var r=q.width;q=q.height;var u=0;this instanceof Hg&&(q=this.geometry.bounds,f=q.x,l=q.y,r=q.width,q=q.height,u=this.strokeWidth);zi(this,a,this.background,!0,!1,p,e);this.background instanceof zl&&this.background.type===Al?(a.beginPath(),
a.rect(f-u/2,l-u/2,r+u,q+u),a.Vd(this.background)):a.fillRect(f-u/2,l-u/2,r+u,q+u)}n&&(null!==this.background||null!==this.areaBackground||null!==g&&0!==(g.I&512)||null!==g&&(g.type===W.Auto||g.type===W.Spot)&&g.Bb()!==this)?(Bl(this,!0),null===this.shadowVisible&&yl(a)):Bl(this,!1);this.Hi(a,b);n&&0!==(this.I&512)===!0&&xl(a);this.xg()&&n&&yl(a);h&&(a.restore(),k&&a.yc.pop());this instanceof W&&(c=a.yc.pop());!0===m&&a.yc.pop();if(this instanceof Kh&&1<this.lineCount||this instanceof Hg&&1<this.geometry.figures.length)c=
a.yc.pop();null!==a.wk.Zp&&(null===c&&(d===a.lq?(bm(a,1,0,0,1,0,0),c=a.yc.pop()):c=a.lq),a.wk.Zp(this,c));this.svg=c;return!0};function Jk(a,b){this.ownerDocument=b=void 0===b?ra.document:b;this.Zp=null;b=b.createElement("canvas");b.tabIndex=0;this.Ha=b;this.Ha.innerHTML="This text is displayed if your browser does not support the Canvas HTML element.";this.context=new Dl(b);b.D=a}
Jk.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};Jk.prototype.toDataURL=function(a,b){return this.Ha.toDataURL(a,b)};Jk.prototype.getBoundingClientRect=function(){return this.Ha.getBoundingClientRect()};Jk.prototype.focus=function(){this.Ha.focus()};Jk.prototype.kx=function(){this.ownerDocument=this.Ha.D=null};
na.Object.defineProperties(Jk.prototype,{width:{configurable:!0,get:function(){return this.Ha.width},set:function(a){this.Ha.width=a}},height:{configurable:!0,get:function(){return this.Ha.height},set:function(a){this.Ha.height=a}},style:{configurable:!0,get:function(){return this.Ha.style}}});Jk.className="CanvasSurface";
function Dl(a){a.getContext&&a.getContext("2d")||v("Browser does not support HTML Canvas Element");this.Y=a.getContext("2d");this.Nt=this.Pt=this.Ot="";this.bn=!1;this.Qd=this.vp=this.tp=0}t=Dl.prototype;t.Nx=function(a){this.Y.imageSmoothingEnabled=a};t.arc=function(a,b,c,d,e,f){this.Y.arc(a,b,c,d,e,f)};t.beginPath=function(){this.Y.beginPath()};t.bezierCurveTo=function(a,b,c,d,e,f){this.Y.bezierCurveTo(a,b,c,d,e,f)};t.clearRect=function(a,b,c,d){this.Y.clearRect(a,b,c,d)};t.clip=function(){this.Y.clip()};
t.closePath=function(){this.Y.closePath()};t.createLinearGradient=function(a,b,c,d){return this.Y.createLinearGradient(a,b,c,d)};t.createPattern=function(a,b){return this.Y.createPattern(a,b)};t.createRadialGradient=function(a,b,c,d,e,f){return this.Y.createRadialGradient(a,b,c,d,e,f)};t.drawImage=function(a,b,c,d,e,f,g,h,k){void 0===d?this.Y.drawImage(a,b,c):this.Y.drawImage(a,b,c,d,e,f,g,h,k)};t.fill=function(){this.Y.fill()};t.fillRect=function(a,b,c,d){this.Y.fillRect(a,b,c,d)};
t.fillText=function(a,b,c){this.Y.fillText(a,b,c)};t.getImageData=function(a,b,c,d){return this.Y.getImageData(a,b,c,d)};t.lineTo=function(a,b){this.Y.lineTo(a,b)};t.measureText=function(a){return this.Y.measureText(a)};t.moveTo=function(a,b){this.Y.moveTo(a,b)};t.quadraticCurveTo=function(a,b,c,d){this.Y.quadraticCurveTo(a,b,c,d)};t.rect=function(a,b,c,d){this.Y.rect(a,b,c,d)};t.restore=function(){this.Y.restore()};Dl.prototype.rotate=function(a){this.Y.rotate(a)};t=Dl.prototype;t.save=function(){this.Y.save()};
t.setTransform=function(a,b,c,d,e,f){this.Y.setTransform(a,b,c,d,e,f)};t.scale=function(a,b){this.Y.scale(a,b)};t.stroke=function(){this.Y.stroke()};t.transform=function(a,b,c,d,e,f){1===a&&0===b&&0===c&&1===d&&0===e&&0===f||this.Y.transform(a,b,c,d,e,f)};t.translate=function(a,b){this.Y.translate(a,b)};
t.Vd=function(a){if(a instanceof zl&&a.type===Al){var b=a.Lk;a=a.Qt;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.bn?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.bn?this.clip():this.fill()};t.$i=function(){this.bn||this.stroke()};t.Vv=function(a,b,c){this.tp=a;this.vp=b;this.Qd=c};
t.Us=function(a,b){var c=this.Y;void 0!==c.setLineDash&&(c.setLineDash(a),c.lineDashOffset=b)};t.Ss=function(){var a=this.Y;void 0!==a.setLineDash&&(a.setLineDash(em),a.lineDashOffset=0)};t.Uc=function(a){a&&(this.Ot="");this.Nt=this.Pt=""};
na.Object.defineProperties(Dl.prototype,{fillStyle:{configurable:!0,get:function(){return this.Y.fillStyle},set:function(a){this.Nt!==a&&(this.Nt=this.Y.fillStyle=a)}},font:{configurable:!0,get:function(){return this.Y.font},set:function(a){this.Ot!==a&&(this.Ot=this.Y.font=a)}},globalAlpha:{configurable:!0,get:function(){return this.Y.globalAlpha},set:function(a){this.Y.globalAlpha=a}},lineCap:{configurable:!0,get:function(){return this.Y.lineCap},
set:function(a){this.Y.lineCap=a}},lineDashOffset:{configurable:!0,get:function(){return this.Y.lineDashOffset},set:function(a){this.Y.lineDashOffset=a}},lineJoin:{configurable:!0,get:function(){return this.Y.lineJoin},set:function(a){this.Y.lineJoin=a}},lineWidth:{configurable:!0,get:function(){return this.Y.lineWidth},set:function(a){this.Y.lineWidth=a}},miterLimit:{configurable:!0,get:function(){return this.Y.miterLimit},set:function(a){this.Y.miterLimit=
a}},shadowBlur:{configurable:!0,get:function(){return this.Y.shadowBlur},set:function(a){this.Y.shadowBlur=a}},shadowColor:{configurable:!0,get:function(){return this.Y.shadowColor},set:function(a){this.Y.shadowColor=a}},shadowOffsetX:{configurable:!0,get:function(){return this.Y.shadowOffsetX},set:function(a){this.Y.shadowOffsetX=a}},shadowOffsetY:{configurable:!0,get:function(){return this.Y.shadowOffsetY},set:function(a){this.Y.shadowOffsetY=
a}},strokeStyle:{configurable:!0,get:function(){return this.Y.strokeStyle},set:function(a){this.Pt!==a&&(this.Pt=this.Y.strokeStyle=a)}},textAlign:{configurable:!0,get:function(){return this.Y.textAlign},set:function(a){this.Y.textAlign=a}},imageSmoothingEnabled:{configurable:!0,get:function(){return this.Y.imageSmoothingEnabled},set:function(a){this.Y.imageSmoothingEnabled=a}},clipInsteadOfFill:{configurable:!0,get:function(){return this.bn},
set:function(a){this.bn=a}}});var em=Object.freeze([]);Dl.className="CanvasSurfaceContext";function fm(){this.ca=this.w=this.L=this.l=0}fm.className="ColorNumbers";
function zl(a){E&&1<arguments.length&&v("Brush constructor can take at most one optional argument, the Brush type.");gm||(hm(),gm=!0);qb(this);this.u=!1;void 0===a?(this.wa=Cl,this.Kk="black"):"string"===typeof a?(this.wa=Cl,E&&!im(a)&&v('Color "'+a+'" is not a valid color string for Brush constructor'),this.Kk=a):(E&&tb(a,zl,zl,"constructor:type"),this.wa=a,this.Kk="black");var b=this.wa;b===Fl?(this.Ll=gd,this.Yk=td):this.Yk=b===Al?this.Ll=qd:this.Ll=ed;this.Es=0;this.sr=NaN;this.ge=this.ns=this.fe=
null;this.Qt=this.Lk=0}zl.prototype.copy=function(){var a=new zl;a.wa=this.wa;a.Kk=this.Kk;a.Ll=this.Ll.J();a.Yk=this.Yk.J();a.Es=this.Es;a.sr=this.sr;null!==this.fe&&(a.fe=this.fe.copy());a.ns=this.ns;return a};t=zl.prototype;t.freeze=function(){this.u=!0;null!==this.fe&&this.fe.freeze();return this};t.ja=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.u=!1;null!==this.fe&&this.fe.ja();return this};t.hb=function(a){a.classType===zl?this.type=a:Fa(this,a)};
t.toString=function(){var a="Brush(";if(this.type===Cl)a+=this.color;else if(a=this.type===Fl?a+"Linear ":this.type===Al?a+"Radial ":this.type===El?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.u&&za(this);("number"!==typeof a||!isFinite(a)||1<a||0>a)&&Ca(a,"0 <= loc <= 1",zl,"addColorStop:loc");z(b,"string",zl,"addColorStop:color");E&&!im(b)&&v('Color "'+b+'" is not a valid color string for Brush.addColorStop');null===this.fe&&(this.fe=new Ub);this.fe.add(a,b);this.wa===Cl&&(this.type=Fl);this.ge=null;return this};
function im(a){if("black"===a)return!0;if(""===a)return!1;E&&z(a,"string",zl,"isValidColor");gm||(hm(),gm=!0);var b=jm;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.Kz=function(a,b){this.u&&za(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?km:b;if(this.type===Cl)lm(this.color),this.color=mm(a,b);else if((this.type===Fl||this.type===Al)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)lm(c.value),this.addColorStop(c.key,mm(a,b));return this};function nm(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?km:c;lm(a);return mm(b,c)}
t.Fy=function(a,b){this.u&&za(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?km:b;if(this.type===Cl)lm(this.color),this.color=mm(-a,b);else if((this.type===Fl||this.type===Al)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)lm(c.value),this.addColorStop(c.key,mm(-a,b));return this};function om(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?km:c;lm(a);return mm(-b,c)}
function pm(a,b,c){lm(a);a=qm.l;var d=qm.L,e=qm.w,f=qm.ca;lm(b);void 0===c&&(c=.5);return"rgba("+Math.round((qm.l-a)*c+a)+", "+Math.round((qm.L-d)*c+d)+", "+Math.round((qm.w-e)*c+e)+", "+Math.round((qm.ca-f)*c+f)+")"}
t.wx=function(){if(this.type===Cl)return rm(this.color);if((this.type===Fl||this.type===Al)&&null!==this.colorStops){var a=this.colorStops;if(this.type===Al)return rm(a.first().value);if(null!==a.get(.5))return rm(a.get(.5));if(2===a.count)return a=a.Oa(),rm(pm(a[0].value,a[1].value));for(var b=a.iterator,c=-1,d=-1,e=1,f=1;b.next();){var g=b.key,h=Math.abs(.5-b.key);e>f&&h<e?(c=g,e=h):f>=e&&h<f&&(d=g,f=h)}c>d&&(c=[d,d=c][0]);b=d-c;return rm(pm(a.get(c),a.get(d),1-e/b))}return!1};
function rm(a){if(null===a)return null;if(a instanceof zl)return a.wx();lm(a);return 128>(299*qm.l+587*qm.L+114*qm.w)/1E3}
function mm(a,b){switch(b){case km:var c=100*sm(qm.l);b=100*sm(qm.L);var d=100*sm(qm.w);tm.l=.4124564*c+.3575761*b+.1804375*d;tm.L=.2126729*c+.7151522*b+.072175*d;tm.w=.0193339*c+.119192*b+.9503041*d;tm.ca=qm.ca;c=um(tm.l/vm[0]);b=um(tm.L/vm[1]);d=um(tm.w/vm[2]);wm.l=116*b-16;wm.L=500*(c-b);wm.w=200*(b-d);wm.ca=tm.ca;wm.l=Math.min(100,Math.max(0,wm.l+100*a));a=(wm.l+16)/116;c=a-wm.w/200;tm.l=vm[0]*xm(wm.L/500+a);tm.L=vm[1]*(wm.l>ym*zm?Math.pow(a,3):wm.l/ym);tm.w=vm[2]*xm(c);tm.ca=wm.ca;a=-.969266*
tm.l+1.8760108*tm.L+.041556*tm.w;c=.0556434*tm.l+-.2040259*tm.L+1.0572252*tm.w;qm.l=255*Am((3.2404542*tm.l+-1.5371385*tm.L+-.4985314*tm.w)/100);qm.L=255*Am(a/100);qm.w=255*Am(c/100);qm.ca=tm.ca;qm.l=Math.round(qm.l);255<qm.l?qm.l=255:0>qm.l&&(qm.l=0);qm.L=Math.round(qm.L);255<qm.L?qm.L=255:0>qm.L&&(qm.L=0);qm.w=Math.round(qm.w);255<qm.w?qm.w=255:0>qm.w&&(qm.w=0);return"rgba("+qm.l+", "+qm.L+", "+qm.w+", "+qm.ca+")";case Bm:b=qm.l/255;d=qm.L/255;var e=qm.w/255,f=Math.max(b,d,e),g=Math.min(b,d,e),h=
f-g;g=(f+g)/2;if(0===h)c=b=0;else{switch(f){case b:c=(d-e)/h%6;break;case d:c=(e-b)/h+2;break;case e:c=(b-d)/h+4}c*=60;0>c&&(c+=360);b=h/(1-Math.abs(2*g-1))}Cm.l=Math.round(c);Cm.L=Math.round(100*b);Cm.w=Math.round(100*g);Cm.ca=qm.ca;Cm.w=Math.min(100,Math.max(0,Cm.w+100*a));return"hsla("+Cm.l+", "+Cm.L+"%, "+Cm.w+"%, "+Cm.ca+")";default:return v("Unknown color space: "+b),"rgba(0, 0, 0, 1)"}}
function lm(a){gm||(hm(),gm=!0);var b=jm;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,qm.l=a[0],qm.L=a[1],qm.w=a[2],qm.ca=a[3]/255):(b.fillStyle="#FFFFFF",c=b.fillStyle,b.fillStyle=a,b.fillStyle===c&&E&&v('Color "'+a+'" is not a valid color string for RGBA color conversion'),qm.l=0,qm.L=0,qm.w=0,qm.ca=1)}}function sm(a){a/=255;return.04045>=a?a/12.92:Math.pow((a+.055)/1.055,2.4)}
function Am(a){return.0031308>=a?12.92*a:1.055*Math.pow(a,1/2.4)-.055}function um(a){return a>zm?Math.pow(a,1/3):(ym*a+16)/116}function xm(a){var b=a*a*a;return b>zm?b:(116*a-16)/ym}function Wl(a,b){"string"===typeof a?E&&!im(a)&&v('Color "'+a+'" is not a valid color string for '+b):a instanceof zl||v("Value for "+b+" must be a color string or a Brush, not "+a)}function hm(){jm=Ih?(new Jk(null)).context:null}
na.Object.defineProperties(zl.prototype,{type:{configurable:!0,get:function(){return this.wa},set:function(a){this.u&&za(this,a);tb(a,zl,zl,"type");this.wa=a;this.start.Nb()&&(a===Fl?this.start=gd:a===Al&&(this.start=qd));this.end.Nb()&&(a===Fl?this.end=td:a===Al&&(this.end=qd));this.ge=null}},color:{configurable:!0,get:function(){return this.Kk},set:function(a){this.u&&za(this,a);E&&!im(a)&&v('Color "'+a+'" is not a valid color string for Brush.color');this.Kk=a;this.ge=
null}},start:{configurable:!0,get:function(){return this.Ll},set:function(a){this.u&&za(this,a);w(a,M,zl,"start");this.Ll=a.J();this.ge=null}},end:{configurable:!0,get:function(){return this.Yk},set:function(a){this.u&&za(this,a);w(a,M,zl,"end");this.Yk=a.J();this.ge=null}},startRadius:{configurable:!0,get:function(){return this.Es},set:function(a){this.u&&za(this,a);B(a,zl,"startRadius");0>a&&Ca(a,">= zero",zl,"startRadius");this.Es=a;this.ge=null}},endRadius:{configurable:!0,
enumerable:!0,get:function(){return this.sr},set:function(a){this.u&&za(this,a);B(a,zl,"endRadius");0>a&&Ca(a,">= zero",zl,"endRadius");this.sr=a;this.ge=null}},colorStops:{configurable:!0,get:function(){return this.fe},set:function(a){this.u&&za(this,a);E&&w(a,Ub,zl,"colorStops");this.fe=a;this.ge=null}},pattern:{configurable:!0,get:function(){return this.ns},set:function(a){this.u&&za(this,a);this.ns=a;this.ge=null}}});zl.prototype.isDark=zl.prototype.wx;
zl.prototype.darkenBy=zl.prototype.Fy;zl.prototype.lightenBy=zl.prototype.Kz;zl.prototype.addColorStop=zl.prototype.addColorStop;var zm=216/24389,ym=24389/27,vm=[95.047,100,108.883],jm=null,qm=new fm,Cm=new fm,tm=new fm,wm=new fm,gm=!1;zl.className="Brush";var Cl;zl.Solid=Cl=new D(zl,"Solid",0);var Fl;zl.Linear=Fl=new D(zl,"Linear",1);var Al;zl.Radial=Al=new D(zl,"Radial",2);var El;zl.Pattern=El=new D(zl,"Pattern",4);var km;zl.Lab=km=new D(zl,"Lab",5);var Bm;zl.HSL=Bm=new D(zl,"HSL",6);
zl.randomColor=function(a,b){void 0===a&&(a=128);E&&(B(a,zl,"randomColor:min"),(0>a||255<a)&&Ca(a,"0 <= min <= 255",zl,"randomColor:min"));void 0===b&&(b=Math.max(a,255));E&&(B(b,zl,"randomColor:max"),(b<a||255<b)&&Ca(b,"min <= max <= 255",zl,"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};zl.isValidColor=im;zl.lighten=function(a){return nm(a)};zl.lightenBy=nm;zl.darken=function(a){return om(a)};zl.darkenBy=om;zl.mix=pm;zl.isDark=rm;function Tl(){this.name="Base"}Tl.prototype.measure=function(){};Tl.prototype.Nz=function(a,b,c,d,e){a.measure(b,c,d,e)};Tl.prototype.arrange=function(){};Tl.prototype.uy=function(a,b,c,d,e,f){a.arrange(b,c,d,e,f)};na.Object.defineProperties(Tl.prototype,{classType:{configurable:!0,get:function(){return W}}});
Tl.prototype.arrangeElement=Tl.prototype.uy;Tl.prototype.measureElement=Tl.prototype.Nz;Tl.className="PanelLayout";function Dm(){this.name="Base";this.name="Position"}ma(Dm,Tl);
Dm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;a=Em(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 q=l.position.y;isFinite(p)||(p=0);isFinite(q)||(q=0);l instanceof Hg&&l.isGeometryPositioned&&(l=l.strokeWidth/2,p-=l,q-=l);Mc(e,p,q,n,m)}}};
Dm.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 Hg&&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 Fm(){this.name="Base";this.name="Horizontal"}ma(Fm,Tl);
Fm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;b=Qa();f=Em(a);for(var k=0;k<h;k++){var l=d[k];if(l.visible||l===f){var m=ql(l,!1);if(m!==nh&&m!==bl)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);Ta(b)};
Fm.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,q=p.top+p.bottom,r=f+e.bottom,u=n.height,x=ql(m,!1);if(isNaN(m.desiredSize.height)&&x===oe||x===cl)u=Math.max(c.height-q-r,0);q=u+q+r;r=m.alignment;r.Cb()&&(r=a.defaultAlignment);r.Za()||(r=qd);g&&(h-=n.width+p.left+p.right);m.arrange(h+r.offsetX+p.left,l+r.offsetY+p.top+(c.height*r.y-q*r.y),n.width,u);g||(h+=n.width+
p.left+p.right)}}};function Gm(){this.name="Base";this.name="Vertical"}ma(Gm,Tl);
Gm.prototype.measure=function(a,b,c,d,e,f){var g=d.length;c=Qa();for(var h=Em(a),k=0;k<g;k++){var l=d[k];if(l.visible||l===h){var m=ql(l,!1);if(m!==nh&&m!==cl)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;Cc(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;Ta(c)}};
Gm.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,q=p.left+p.right,r=f+e.right,u=n.width,x=ql(m,!1);if(isNaN(m.desiredSize.width)&&x===oe||x===bl)u=Math.max(c.width-q-r,0);q=u+q+r;r=m.alignment;r.Cb()&&(r=a.defaultAlignment);r.Za()||(r=qd);g&&(h-=n.height+p.bottom+p.top);m.arrange(l+r.offsetX+p.left+(c.width*r.x-q*r.x),h+r.offsetY+p.top,u,n.height);g||(h+=n.height+
p.bottom+p.top)}}};function Hm(){this.name="Base";this.name="Spot"}ma(Hm,Tl);
Hm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.Bb(),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 q=Math.max(f+m,0);var r=Math.max(g+n,0);for(var u=a.isClipping,x=L.allocAt(-l.left,-l.top,q,r),y=!0,A=Em(a),C=0;C<h;C++){var G=d[C];if(G!==k&&(G.visible||G===A)){l=G.margin;q=l.right+l.left;r=l.top+l.bottom;p=ql(G,!1);switch(p){case oe:b=f;c=g;break;case bl:b=f;break;case cl:c=g}G.measure(b,c,0,0);p=G.measuredBounds;q=
Math.max(p.width+q,0);r=Math.max(p.height+r,0);var I=G.alignment;I.Cb()&&(I=a.defaultAlignment);I.Za()||(I=qd);var O=G.alignmentFocus;O.Cb()&&(O=qd);var R=null;G instanceof W&&""!==G.Dg&&(G.arrange(0,0,p.width,p.height),R=G.bb(G.Dg),R===G&&(R=null));if(null!==R){l=R.naturalBounds;p=R.margin;for(l=J.allocAt(O.x*l.width-O.offsetX-p.left,O.y*l.height-O.offsetY-p.top);R!==G;)R.transform.va(l),R=R.panel;G=I.x*f+I.offsetX-l.x;p=I.y*g+I.offsetY-l.y;J.free(l)}else G=I.x*f+I.offsetX-(O.x*p.width+O.offsetX)-
l.left,p=I.y*g+I.offsetY-(O.y*p.height+O.offsetY)-l.top;y?(y=!1,e.h(G,p,q,r)):Mc(e,G,p,q,r)}}y?e.assign(x):u?e.pv(x.x,x.y,x.width,x.height):Mc(e,x.x,x.y,x.width,x.height);L.free(x);p=k.stretch;p===al&&(p=ql(k,!1));switch(p){case nh:return;case oe:if(!isFinite(b)&&!isFinite(c))return;break;case bl:if(!isFinite(b))return;break;case cl:if(!isFinite(c))return}p=k.measuredBounds;f=p.width;g=p.height;q=Math.max(f+m,0);r=Math.max(g+n,0);l=k.margin;x=L.allocAt(-l.left,-l.top,q,r);for(b=0;b<h;b++)c=d[b],c===
k||!c.visible&&c!==A||(l=c.margin,q=l.right+l.left,r=l.top+l.bottom,p=c.measuredBounds,q=Math.max(p.width+q,0),r=Math.max(p.height+r,0),m=c.alignment,m.Cb()&&(m=a.defaultAlignment),m.Za()||(m=qd),c=c.alignmentFocus,c.Cb()&&(c=qd),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,q,r)):Mc(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,q,r));y?e.assign(x):u?e.pv(x.x,x.y,x.width,x.height):Mc(e,x.x,
x.y,x.width,x.height);L.free(x)};
Hm.prototype.arrange=function(a,b,c){var d=b.length,e=a.Bb(),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 q=p.measuredBounds,r=q.width;q=q.height;m=p.alignment;m.Cb()&&(m=a.defaultAlignment);m.Za()||(m=qd);var u=p.alignmentFocus;u.Cb()&&(u=qd);l=null;p instanceof W&&""!==p.Dg&&(l=p.bb(p.Dg),l===p&&(l=null));if(null!==l){var x=l.naturalBounds;for(u=J.allocAt(u.x*x.width-u.offsetX,u.y*x.height-
u.offsetY);l!==p;)l.transform.va(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*r+u.offsetX),m=m.y*f+m.offsetY-(u.y*q+u.offsetY);l-=c.x;m-=c.y;p.visible&&p.arrange(k+l,h+m,r,q)}}};function Im(){this.name="Base";this.name="Auto"}ma(Im,Tl);
Im.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.Bb(),l=k.margin,m=b,n=c,p=l.right+l.left,q=l.top+l.bottom;k.measure(b,c,f,g);l=k.measuredBounds;var r=0,u=null;k instanceof Hg&&(u=k,r=u.strokeWidth*u.scale);var x=Math.max(l.width+p,0);l=Math.max(l.height+q,0);var y=Jm(k),A=y.x*x+y.offsetX;y=y.y*l+y.offsetY;var C=Km(k),G=C.x*x+C.offsetX;C=C.y*l+C.offsetY;isFinite(b)&&(m=Math.max(Math.abs(A-G)-r,0));isFinite(c)&&(n=Math.max(Math.abs(y-C)-r,0));r=Zb.alloc();r.h(0,0);a=Em(a);for(C=0;C<
h;C++)y=d[C],y===k||!y.visible&&y!==a||(l=y.margin,x=l.right+l.left,A=l.top+l.bottom,y.measure(m,n,0,0),l=y.measuredBounds,x=Math.max(l.width+x,0),l=Math.max(l.height+A,0),r.h(Math.max(x,r.width),Math.max(l,r.height)));if(1===h)e.width=x,e.height=l,Zb.free(r);else{y=Jm(k);C=Km(k);h=d=0;C.x!==y.x&&C.y!==y.y&&(d=r.width/Math.abs(C.x-y.x),h=r.height/Math.abs(C.y-y.y));Zb.free(r);r=0;null!==u&&(r=u.strokeWidth*u.scale,oh(u)===ph&&(d=h=Math.max(d,h)));d+=Math.abs(y.offsetX)+Math.abs(C.offsetX)+r;h+=Math.abs(y.offsetY)+
Math.abs(C.offsetY)+r;u=k.stretch;u===al&&(u=ql(k,!1));switch(u){case nh:g=f=0;break;case oe:isFinite(b)&&(d=b);isFinite(c)&&(h=c);break;case bl:isFinite(b)&&(d=b);g=0;break;case cl:f=0,isFinite(c)&&(h=c)}k.im();k.measure(d,h,f,g);e.width=k.measuredBounds.width+p;e.height=k.measuredBounds.height+q}};
Im.prototype.arrange=function(a,b){var c=b.length,d=a.Bb(),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=Jm(d),n=Km(d),p=m.y*e.height+m.offsetY,q=n.x*e.width+n.offsetX;n=n.y*e.height+n.offsetY;f.x=m.x*e.width+m.offsetX;f.y=p;Mc(f,q,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.Cb()&&(p=a.defaultAlignment),p.Za()||(p=qd),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&&(Qc(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 Lm(){this.name="Base";this.name="Table"}ma(Lm,Tl);
Lm.prototype.measure=function(a,b,c,d,e,f,g){for(var h=d.length,k=Qa(),l=Qa(),m=0;m<h;m++){var n=d[m],p=n instanceof W?n:null;if(null===p||p.type!==W.TableRow&&p.type!==W.TableColumn||!n.visible)k.push(n);else{E&&(p.desiredSize.o()&&v(p.toString()+" TableRow/TableColumn Panels cannot set a desiredSize: "+p.desiredSize.toString()),p.minSize.A(rc)||v(p.toString()+" TableRow/TableColumn Panels cannot set a minSize: "+p.minSize.toString()),p.maxSize.A(wc)||v(p.toString()+" TableRow/TableColumn Panels cannot set a maxSize: "+
p.maxSize.toString()));l.push(p);for(var q=p.Z.j,r=q.length,u=0;u<r;u++){var x=q[u];p.type===W.TableRow?x.row=n.row:p.type===W.TableColumn&&(x.column=n.column);k.push(x)}}}h=k.length;0===h&&(a.getRowDefinition(0),a.getColumnDefinition(0));for(var y=[],A=0;A<h;A++){var C=k[A];zj(C,!0);rl(C,!0);y[C.row]||(y[C.row]=[]);y[C.row][C.column]||(y[C.row][C.column]=[]);y[C.row][C.column].push(C)}Ta(k);var G=Qa(),I=Qa(),O=Qa(),R={count:0},Q={count:0},ea=b,Z=c,qa=a.tb;h=qa.length;for(var xa=0;xa<h;xa++){var S=
qa[xa];void 0!==S&&(S.actual=0)}qa=a.ob;h=qa.length;for(var aa=0;aa<h;aa++)S=qa[aa],void 0!==S&&(S.actual=0);for(var Ga=y.length,yb=0,Xa=0;Xa<Ga;Xa++)y[Xa]&&(yb=Math.max(yb,y[Xa].length));var Sa=Math.min(a.topIndex,Ga-1),Ua=Math.min(a.leftIndex,yb-1),hb=0;Ga=y.length;for(var kc=Em(a),rb=0;rb<Ga;rb++)if(y[rb]){yb=y[rb].length;for(var mb=a.getRowDefinition(rb),cb=mb.actual=0;cb<yb;cb++)if(y[rb][cb]){var ua=a.getColumnDefinition(cb);void 0===G[cb]&&(ua.actual=0,G[cb]=!0);for(var ta=y[rb][cb],wb=ta.length,
zb=0;zb<wb;zb++){var db=ta[zb];if(db.visible||db===kc){var qe=1<db.rowSpan||1<db.columnSpan;qe&&(rb<Sa||cb<Ua||I.push(db));var Yd=db.margin,Lb=Yd.right+Yd.left,Pf=Yd.top+Yd.bottom;var Wb=Jl(db,mb,ua,!1);var De=db.desiredSize,id=!isNaN(De.height),lc=!isNaN(De.width)&&id;qe||Wb===nh||lc||rb<Sa||cb<Ua||(void 0!==R[cb]||Wb!==oe&&Wb!==bl||(R[cb]=-1,R.count++),void 0!==Q[rb]||Wb!==oe&&Wb!==cl||(Q[rb]=-1,Q.count++),O.push(db));db.measure(Infinity,Infinity,0,0);if(!(rb<Sa||cb<Ua)){var Zd=db.measuredBounds,
Wc=Math.max(Zd.width+Lb,0),Ze=Math.max(Zd.height+Pf,0);if(1===db.rowSpan&&(Wb===nh||Wb===bl)){S=a.getRowDefinition(rb);var $e=S.vc();hb=Math.max(Ze-S.actual,0);hb+$e>Z&&(hb=Math.max(Z-$e,0));var Qf=0===S.actual;S.actual=S.actual+hb;Z=Math.max(Z-(hb+(Qf?$e:0)),0)}if(1===db.columnSpan&&(Wb===nh||Wb===cl)){S=a.getColumnDefinition(cb);var wf=S.vc();hb=Math.max(Wc-S.actual,0);hb+wf>ea&&(hb=Math.max(ea-wf,0));var Rf=0===S.actual;S.actual=S.actual+hb;ea=Math.max(ea-(hb+(Rf?wf:0)),0)}qe&&db.im()}}}}}Ta(G);
var mc=0,ob=0;h=a.columnCount;for(var nb=0;nb<h;nb++){var Nc=a.ob[nb];void 0!==Nc&&(mc+=Nc.ma,0!==Nc.ma&&(mc+=Nc.vc()))}h=a.rowCount;for(var Sf=0;Sf<h;Sf++){var zc=a.tb[Sf];void 0!==zc&&(ob+=zc.ma,0!==zc.ma&&(ob+=zc.vc()))}ea=Math.max(b-mc,0);var $d=Z=Math.max(c-ob,0),Ic=ea;h=O.length;for(var ae=0;ae<h;ae++){var nc=O[ae],Zh=a.getRowDefinition(nc.row),$h=a.getColumnDefinition(nc.column),af=nc.measuredBounds,Fb=nc.margin,Tf=Fb.right+Fb.left,bf=Fb.top+Fb.bottom;R[nc.column]=0===$h.actual&&void 0!==R[nc.column]?
Math.max(af.width+Tf,R[nc.column]):null;Q[nc.row]=0===Zh.actual&&void 0!==Q[nc.row]?Math.max(af.height+bf,Q[nc.row]):null}var oc=0,cf=0,ad;for(ad in Q)"count"!==ad&&(oc+=Q[ad]);for(ad in R)"count"!==ad&&(cf+=R[ad]);for(var vb=Zb.alloc(),df=0;df<h;df++){var Ib=O[df];if(Ib.visible||Ib===kc){var Jc=a.getRowDefinition(Ib.row),Ab=a.getColumnDefinition(Ib.column),jd=0;isFinite(Ab.width)?jd=Ab.width:(isFinite(ea)&&null!==R[Ib.column]?0===cf?jd=Ab.actual+ea:jd=R[Ib.column]/cf*Ic:null!==R[Ib.column]?jd=ea:
jd=Ab.actual||ea,jd=Math.max(0,jd-Ab.vc()));var kd=0;isFinite(Jc.height)?kd=Jc.height:(isFinite(Z)&&null!==Q[Ib.row]?0===oc?kd=Jc.actual+Z:kd=Q[Ib.row]/oc*$d:null!==Q[Ib.row]?kd=Z:kd=Jc.actual||Z,kd=Math.max(0,kd-Jc.vc()));vb.h(Math.max(Ab.minimum,Math.min(jd,Ab.maximum)),Math.max(Jc.minimum,Math.min(kd,Jc.maximum)));Wb=Jl(Ib,Jc,Ab,!1);switch(Wb){case bl:vb.height=Math.max(vb.height,Jc.actual+Z);break;case cl:vb.width=Math.max(vb.width,Ab.actual+ea)}var Jd=Ib.margin,Vg=Jd.right+Jd.left,Uf=Jd.top+
Jd.bottom;Ib.im();Ib.measure(vb.width,vb.height,Ab.minimum,Jc.minimum);var Vf=Ib.measuredBounds,xf=Math.max(Vf.width+Vg,0),xd=Math.max(Vf.height+Uf,0);isFinite(ea)&&(xf=Math.min(xf,vb.width));isFinite(Z)&&(xd=Math.min(xd,vb.height));var Kd=0;Kd=Jc.actual;Jc.actual=Math.max(Jc.actual,xd);hb=Jc.actual-Kd;Z=Math.max(Z-hb,0);Kd=Ab.actual;Ab.actual=Math.max(Ab.actual,xf);hb=Ab.actual-Kd;ea=Math.max(ea-hb,0)}}Ta(O);var bd=Zb.alloc(),yd=Qa(),Bb=Qa();h=I.length;if(0!==h)for(var pb=0;pb<Ga;pb++)if(y[pb]){yb=
y[pb].length;var cd=a.getRowDefinition(pb);yd[pb]=cd.actual;for(var ld=0;ld<yb;ld++)if(y[pb][ld]){var zd=a.getColumnDefinition(ld);Bb[ld]=zd.actual}}for(var Oc=0;Oc<h;Oc++){var Pa=I[Oc];if(Pa.visible||Pa===kc){var md=a.getRowDefinition(Pa.row),pc=a.getColumnDefinition(Pa.column);vb.h(Math.max(pc.minimum,Math.min(b,pc.maximum)),Math.max(md.minimum,Math.min(c,md.maximum)));Wb=Jl(Pa,md,pc,!1);switch(Wb){case oe:0!==Bb[pc.index]&&(vb.width=Math.min(vb.width,Bb[pc.index]));0!==yd[md.index]&&(vb.height=
Math.min(vb.height,yd[md.index]));break;case bl:0!==Bb[pc.index]&&(vb.width=Math.min(vb.width,Bb[pc.index]));break;case cl:0!==yd[md.index]&&(vb.height=Math.min(vb.height,yd[md.index]))}isFinite(pc.width)&&(vb.width=pc.width);isFinite(md.height)&&(vb.height=md.height);bd.h(0,0);for(var re=1;re<Pa.rowSpan&&!(Pa.row+re>=a.rowCount);re++)S=a.getRowDefinition(Pa.row+re),hb=0,hb=Wb===oe||Wb===cl?Math.max(S.minimum,0===yd[Pa.row+re]?S.maximum:Math.min(yd[Pa.row+re],S.maximum)):Math.max(S.minimum,isNaN(S.Sc)?
S.maximum:Math.min(S.Sc,S.maximum)),bd.height+=hb;for(var ef=1;ef<Pa.columnSpan&&!(Pa.column+ef>=a.columnCount);ef++)S=a.getColumnDefinition(Pa.column+ef),hb=0,hb=Wb===oe||Wb===bl?Math.max(S.minimum,0===Bb[Pa.column+ef]?S.maximum:Math.min(Bb[Pa.column+ef],S.maximum)):Math.max(S.minimum,isNaN(S.Sc)?S.maximum:Math.min(S.Sc,S.maximum)),bd.width+=hb;vb.width+=bd.width;vb.height+=bd.height;var se=Pa.margin,Pc=se.right+se.left,Ee=se.top+se.bottom;Pa.measure(vb.width,vb.height,f,g);for(var nd=Pa.measuredBounds,
Mb=Math.max(nd.width+Pc,0),be=Math.max(nd.height+Ee,0),bc=0,Fe=0;Fe<Pa.rowSpan&&!(Pa.row+Fe>=a.rowCount);Fe++)S=a.getRowDefinition(Pa.row+Fe),bc+=S.total||0;if(bc<be){var Ld=be-bc,te=be-bc;if(null!==Pa.spanAllocation)for(var Wg=Pa.spanAllocation,od=0;od<Pa.rowSpan&&!(0>=Ld)&&!(Pa.row+od>=a.rowCount);od++){S=a.getRowDefinition(Pa.row+od);var ff=S.ma||0,Wf=Wg(Pa,S,te);E&&"number"!==typeof Wf&&v(Pa+" spanAllocation does not return a number: "+Wf);S.actual=Math.min(S.maximum,ff+Wf);S.ma!==ff&&(Ld-=S.ma-
ff)}for(;0<Ld;){var Xf=S.ma||0;isNaN(S.height)&&S.maximum>Xf&&(S.actual=Math.min(S.maximum,Xf+Ld),S.ma!==Xf&&(Ld-=S.ma-Xf));if(0===S.index)break;S=a.getRowDefinition(S.index-1)}}for(var gf=0,Xg=0;Xg<Pa.columnSpan&&!(Pa.column+Xg>=a.columnCount);Xg++)S=a.getColumnDefinition(Pa.column+Xg),gf+=S.total||0;if(gf<Mb){var rg=Mb-gf,$i=Mb-gf;if(null!==Pa.spanAllocation)for(var hf=Pa.spanAllocation,Ge=0;Ge<Pa.columnSpan&&!(0>=rg)&&!(Pa.column+Ge>=a.columnCount);Ge++){S=a.getColumnDefinition(Pa.column+Ge);var sg=
S.ma||0,Cn=hf(Pa,S,$i);E&&"number"!==typeof Cn&&v(Pa+" spanAllocation does not return a number: "+Cn);S.actual=Math.min(S.maximum,sg+Cn);S.ma!==sg&&(rg-=S.ma-sg)}for(;0<rg;){var mk=S.ma||0;isNaN(S.width)&&S.maximum>mk&&(S.actual=Math.min(S.maximum,mk+rg),S.ma!==mk&&(rg-=S.ma-mk));if(0===S.index)break;S=a.getColumnDefinition(S.index-1)}}}}Ta(I);Zb.free(bd);Zb.free(vb);void 0!==yd&&Ta(yd);void 0!==Bb&&Ta(Bb);var Yg=0,Zg=0,nk=a.desiredSize,gr=a.maxSize;Wb=ql(a,!0);var aj=ob=mc=0,bj=0;h=a.columnCount;
for(var ok=0;ok<h;ok++)void 0!==a.ob[ok]&&(S=a.getColumnDefinition(ok),isFinite(S.width)?(aj+=S.width,aj+=S.vc()):Mm(S)===Nm?(aj+=S.ma,aj+=S.vc()):0!==S.ma&&(mc+=S.ma,mc+=S.vc()));isFinite(nk.width)?Yg=Math.min(nk.width,gr.width):Yg=Wb!==nh&&isFinite(b)?b:mc;Yg=Math.max(Yg,a.minSize.width);Yg=Math.max(Yg-aj,0);for(var Kt=0===mc?1:Math.max(Yg/mc,1),qk=0;qk<h;qk++)void 0!==a.ob[qk]&&(S=a.getColumnDefinition(qk),isFinite(S.width)||Mm(S)===Nm||(S.actual=S.ma*Kt),S.position=e.width,0!==S.ma&&(e.width+=
S.ma,e.width+=S.vc()));h=a.rowCount;for(var rk=0;rk<h;rk++)void 0!==a.tb[rk]&&(S=a.getRowDefinition(rk),isFinite(S.height)?(bj+=S.height,bj+=S.vc()):Mm(S)===Nm?(bj+=S.ma,bj+=S.vc()):0!==S.ma&&(ob+=S.ma,0!==S.ma&&(ob+=S.vc())));isFinite(nk.height)?Zg=Math.min(nk.height,gr.height):Zg=Wb!==nh&&isFinite(c)?c:ob;Zg=Math.max(Zg,a.minSize.height);Zg=Math.max(Zg-bj,0);for(var Lt=0===ob?1:Math.max(Zg/ob,1),sk=0;sk<h;sk++)void 0!==a.tb[sk]&&(S=a.getRowDefinition(sk),isFinite(S.height)||Mm(S)===Nm||(S.actual=
S.ma*Lt),S.position=e.height,0!==S.ma&&(e.height+=S.ma,0!==S.ma&&(e.height+=S.vc())));h=l.length;for(var Dn=0;Dn<h;Dn++){var ce=l[Dn],En=0,Fn=0;ce.type===W.TableRow?(En=e.width,S=a.getRowDefinition(ce.row),Fn=S.actual):(S=a.getColumnDefinition(ce.column),En=S.actual,Fn=e.height);ce.measuredBounds.h(0,0,En,Fn);zj(ce,!1);y[ce.row]||(y[ce.row]=[]);y[ce.row][ce.column]||(y[ce.row][ce.column]=[]);y[ce.row][ce.column].push(ce)}Ta(l);a.kp=y};
Lm.prototype.arrange=function(a,b,c){var d=b.length,e=a.padding,f=e.left;e=e.top;for(var g=a.kp,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.tb[n]||0===a.tb[n].ma);)n++;n=Math.min(n,l-1);n=-a.tb[n].position;for(h=Math.min(a.leftIndex,m-1);h!==m&&(void 0===a.ob[h]||0===a.ob[h].ma);)h++;h=Math.min(h,m-1);for(var p=-a.ob[h].position,q=Zb.alloc(),r=0;r<l;r++)if(g[r]){m=g[r].length;var u=a.getRowDefinition(r);k=u.position+n+e;0!==u.ma&&
(k+=u.Uu());for(var x=0;x<m;x++)if(g[r][x]){var y=a.getColumnDefinition(x);h=y.position+p+f;0!==y.ma&&(h+=y.Uu());for(var A=g[r][x],C=A.length,G=0;G<C;G++){var I=A[G],O=I.measuredBounds,R=I instanceof W?I:null;if(null===R||R.type!==W.TableRow&&R.type!==W.TableColumn){q.h(0,0);for(var Q=1;Q<I.rowSpan&&!(r+Q>=a.rowCount);Q++)R=a.getRowDefinition(r+Q),q.height+=R.total;for(Q=1;Q<I.columnSpan&&!(x+Q>=a.columnCount);Q++)R=a.getColumnDefinition(x+Q),q.width+=R.total;var ea=y.ma+q.width,Z=u.ma+q.height;
Q=h;R=k;var qa=ea,xa=Z,S=h,aa=k,Ga=ea,yb=Z;h+ea>c.width&&(Ga=Math.max(c.width-h,0));k+Z>c.height&&(yb=Math.max(c.height-k,0));var Xa=I.alignment;if(Xa.Cb()){Xa=a.defaultAlignment;Xa.Za()||(Xa=qd);var Sa=Xa.x;var Ua=Xa.y;var hb=Xa.offsetX;Xa=Xa.offsetY;var kc=y.alignment,rb=u.alignment;kc.Za()&&(Sa=kc.x,hb=kc.offsetX);rb.Za()&&(Ua=rb.y,Xa=rb.offsetY)}else Sa=Xa.x,Ua=Xa.y,hb=Xa.offsetX,Xa=Xa.offsetY;if(isNaN(Sa)||isNaN(Ua))Ua=Sa=.5,Xa=hb=0;kc=O.width;rb=O.height;var mb=I.margin,cb=mb.left+mb.right,
ua=mb.top+mb.bottom,ta=Jl(I,u,y,!1);!isNaN(I.desiredSize.width)||ta!==oe&&ta!==bl||(kc=Math.max(ea-cb,0));!isNaN(I.desiredSize.height)||ta!==oe&&ta!==cl||(rb=Math.max(Z-ua,0));ea=I.maxSize;Z=I.minSize;kc=Math.min(ea.width,kc);rb=Math.min(ea.height,rb);kc=Math.max(Z.width,kc);rb=Math.max(Z.height,rb);ea=rb+ua;Q+=qa*Sa-(kc+cb)*Sa+hb+mb.left;R+=xa*Ua-ea*Ua+Xa+mb.top;I.visible&&(Qc(S,aa,Ga,yb,Q,R,O.width,O.height)?I.arrange(Q,R,kc,rb):I.arrange(Q,R,kc,rb,new L(S,aa,Ga,yb)))}else I.kl(),I.actualBounds.ja(),
qa=I.actualBounds,Q=L.allocAt(qa.x,qa.y,qa.width,qa.height),qa.x=R.type===W.TableRow?f:h,qa.y=R.type===W.TableColumn?e:k,qa.width=O.width,qa.height=O.height,I.actualBounds.freeze(),rl(I,!1),Fc(Q,qa)||(O=I.part,null!==O&&(O.Ah(),I.Ko(O))),L.free(Q)}}}Zb.free(q);for(a=0;a<d;a++)c=b[a],f=c instanceof W?c:null,null===f||f.type!==W.TableRow&&f.type!==W.TableColumn||(f=c.actualBounds,c.naturalBounds.ja(),c.naturalBounds.h(0,0,f.width,f.height),c.naturalBounds.freeze())};
function Om(){this.name="Base";this.name="TableRow"}ma(Om,Tl);Om.prototype.measure=function(){};Om.prototype.arrange=function(){};function Pm(){this.name="Base";this.name="TableColumn"}ma(Pm,Tl);Pm.prototype.measure=function(){};Pm.prototype.arrange=function(){};function Qm(){this.name="Base";this.name="Viewbox"}ma(Qm,Tl);
Qm.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.Da=1;d.im();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),q=Math.max(c-k,0),r=1;a.viewboxStretch===ph?0!==n&&0!==h&&(r=Math.min(p/n,q/h)):0!==n&&0!==h&&(r=Math.max(p/n,q/h));0===r&&(r=1E-4);d.Da*=r;m!==d.scale&&(zj(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)};Qm.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.Cb()&&(g=a.defaultAlignment);g.Za()||(g=qd);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 Rm(){this.name="Base";this.name="Grid"}ma(Rm,Tl);
Rm.prototype.measure=function(){};Rm.prototype.arrange=function(){};function Sm(){this.name="Base";this.name="Link"}ma(Sm,Tl);
Sm.prototype.measure=function(a,b,c,d,e){c=d.length;if(a instanceof Cf||a instanceof T){var f=null,g=null,h=null;a instanceof T&&(g=f=a);a instanceof Cf&&(h=a,f=h.adornedPart);if(f instanceof T){var k=f;if(0===c)Cc(a.naturalBounds,0,0),a.measuredBounds.h(0,0,0,0);else{var l=a instanceof Cf?null:f.path,m=f.routeBounds;b=a.mg;b.h(0,0,m.width,m.height);var n=k.points;f=f.pointsCount;null!==h?h.kk(!1):null!==g&&g.kk(!1);var p=m.width,q=m.height;a.location.h(m.x,m.y);a.l.length=0;null!==l&&(Tm(a,p,q,l),
h=l.measuredBounds,b.Lc(h),a.l.push(h));h=$b.alloc();for(var r=J.alloc(),u=J.alloc(),x=0;x<c;x++){var y=d[x];if(y!==l)if(y.isPanelMain&&y instanceof Hg){Tm(a,p,q,y);var A=y.measuredBounds;b.Lc(A);a.l.push(A)}else if(2>f)y.measure(Infinity,Infinity,0,0),A=y.measuredBounds,b.Lc(A),a.l.push(A);else{var C=y.segmentIndex;A=y.segmentFraction;var G=y.alignmentFocus;G.Nb()&&(G=qd);var I=y.segmentOrientation,O=y.segmentOffset;if(C<-f||C>=f){A=k.midPoint;var R=k.midAngle;if(I!==ch){var Q=k.computeAngle(y,I,
R);y.Bc=Q}Q=A.x-m.x;var ea=A.y-m.y}else{Q=0;if(0<=C){ea=n.O(C);var Z=C<f-1?n.O(C+1):ea}else Q=f+C,ea=n.O(Q),Z=0<Q?n.O(Q-1):ea;if(ea.Sa(Z)){0<=C?(R=0<C?n.O(C-1):ea,Q=C<f-2?n.O(C+2):Z):(R=Q<f-1?n.O(Q+1):ea,Q=1<Q?n.O(Q-2):Z);var qa=R.Fe(ea),xa=Z.Fe(Q);R=qa>xa+10?0<=C?R.Xa(ea):ea.Xa(R):xa>qa+10?0<=C?Z.Xa(Q):Q.Xa(Z):0<=C?R.Xa(Q):Q.Xa(R)}else R=0<=C?ea.Xa(Z):Z.Xa(ea);I!==ch&&(Q=k.computeAngle(y,I,R),y.Bc=Q);Q=ea.x+(Z.x-ea.x)*A-m.x;ea=ea.y+(Z.y-ea.y)*A-m.y}y.measure(Infinity,Infinity,0,0);A=y.measuredBounds;
Z=y.naturalBounds;var S=0;y instanceof Hg&&(S=y.strokeWidth);qa=Z.width+S;xa=Z.height+S;h.reset();h.translate(-A.x,-A.y);h.scale(y.scale,y.scale);h.rotate(I===ch?y.angle:R,qa/2,xa/2);I!==Um&&I!==Vm||h.rotate(90,qa/2,xa/2);I!==Wm&&I!==Xm||h.rotate(-90,qa/2,xa/2);I===Ym&&(45<R&&135>R||225<R&&315>R)&&h.rotate(-R,qa/2,xa/2);Z=new L(0,0,qa,xa);r.Yi(Z,G);h.va(r);G=-r.x+S/2*y.scale;y=-r.y+S/2*y.scale;u.assign(O);S=isNaN(O.x);var aa=isNaN(O.y);if(S||aa){qa=qa/2+3;xa=xa/2+3;var Ga=45<=R&&135>=R,yb=225<=R&&
315>=R;I===ch&&(Ga||yb)?(u.x=aa?qa:O.y,u.y=S?xa:O.x,Ga?0<=C||!S||(u.y=-xa):yb&&(0<=C&&S&&(u.y=-xa),aa&&(u.x=-qa))):(S&&(u.x=0<=C?qa:-qa),aa&&(u.y=-xa),u.rotate(R))}else u.rotate(R);Q+=u.x;ea+=u.y;Z.set(A);Z.h(Q+G,ea+y,A.width,A.height);a.l.push(Z);b.Lc(Z)}}if(null!==g)for(d=g.labelNodes;d.next();)d.value.measure(Infinity,Infinity);a.mg=b;a=a.location;a.h(a.x+b.x,a.y+b.y);Cc(e,b.width||0,b.height||0);$b.free(h);J.free(r);J.free(u)}}}};
Sm.prototype.arrange=function(a,b){var c=b.length;if(a instanceof Cf||a instanceof T){var d=null,e=null,f=null;a instanceof T&&(e=d=a);a instanceof Cf&&(f=a,d=f.adornedPart);var g=a instanceof Cf?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.mg.x,l.y-a.mg.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.mg.x,n.y-a.mg.y,n.width,n.height)}}}b=d.points;c=b.count;if(2<=c&&a instanceof T)for(d=
a.labelNodes;d.next();){n=a;g=d.value;h=g.segmentIndex;var p=g.segmentFraction;l=g.alignmentFocus;var q=g.segmentOrientation;k=g.segmentOffset;if(h<-c||h>=c){var r=n.midPoint;m=n.midAngle;q!==ch&&(n=n.computeAngle(g,q,m),g.angle=n);n=r.x;var u=r.y}else{var x=0;0<=h?(u=b.j[h],r=h<c-1?b.j[h+1]:u):(x=c+h,u=b.j[x],r=0<x?b.j[x-1]:u);if(u.Sa(r)){0<=h?(m=0<h?b.j[h-1]:u,x=h<c-2?b.j[h+2]:r):(m=x<c-1?b.j[x+1]:u,x=1<x?b.j[x-2]:r);var y=m.Fe(u),A=r.Fe(x);m=y>A+10?0<=h?m.Xa(u):u.Xa(m):A>y+10?0<=h?r.Xa(x):x.Xa(r):
0<=h?m.Xa(x):x.Xa(m)}else m=0<=h?u.Xa(r):r.Xa(u);q!==ch&&(n=n.computeAngle(g,q,m),g.angle=n);n=u.x+(r.x-u.x)*p;u=u.y+(r.y-u.y)*p}l.kq()?g.location=new J(n,u):(l.Nb()&&(l=qd),r=$b.alloc(),r.reset(),r.scale(g.scale,g.scale),r.rotate(g.angle,0,0),p=g.naturalBounds,p=L.allocAt(0,0,p.width,p.height),q=J.alloc(),q.Yi(p,l),r.va(q),l=-q.x,x=-q.y,k=k.copy(),isNaN(k.x)&&(0<=h?k.x=q.x+3:k.x=-(q.x+3)),isNaN(k.y)&&(k.y=-(q.y+3)),k.rotate(m),n+=k.x,u+=k.y,r.bw(p),l+=p.x,x+=p.y,h=J.allocAt(n+l,u+x),g.move(h),J.free(h),
J.free(q),L.free(p),$b.free(r))}null!==f?f.kk(!1):null!==e&&e.kk(!1)}};function Tm(a,b,c,d){if(!1!==Ej(d)){var e=d.strokeWidth;0===e&&a instanceof Cf&&a.type===W.Link&&a.adornedObject instanceof Hg&&(e=a.adornedObject.strokeWidth);e*=d.Da;a instanceof T&&null!==a.sa?(a=a.sa.bounds,nl(d,a.x-e/2,a.y-e/2,a.width+e,a.height+e)):a instanceof Cf&&null!==a.adornedPart.sa?(a=a.adornedPart.sa.bounds,nl(d,a.x-e/2,a.y-e/2,a.width+e,a.height+e)):nl(d,-(e/2),-(e/2),b+e,c+e);zj(d,!1)}}
function Zm(){this.name="Base";this.name="Graduated"}ma(Zm,Tl);
Zm.prototype.measure=function(a,b,c,d,e,f,g){var h=a.Bb();a.lj=[];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.lj.push(p);e.assign(p);for(var q=h.geometry,r=h.strokeWidth,u=q.flattenedSegments,x=q.flattenedLengths,y=q.flattenedTotalLength,A=u.length,C=0,G=0,I=Qa(),O=0;O<A;O++){var R=u[O],Q=[];G=C=0;for(var ea=R.length,Z=0;Z<ea;Z+=2){var qa=R[Z],xa=R[Z+1];if(0!==Z){var S=180*Math.atan2(xa-
G,qa-C)/Math.PI;0>S&&(S+=360);Q.push(S)}C=qa;G=xa}I.push(Q)}if(null===a.Rg){for(var aa=[],Ga=a.Z.j,yb=Ga.length,Xa=0;Xa<yb;Xa++){var Sa=Ga[Xa],Ua=[];aa.push(Ua);if(Sa.visible)for(var hb=Sa.interval,kc=0;kc<yb;kc++){var rb=Ga[kc];if(rb.visible&&Sa!==rb&&!(Sa instanceof Hg&&!(rb instanceof Hg)||Sa instanceof Kh&&!(rb instanceof Kh))){var mb=rb.interval;mb>hb&&Ua.push(mb)}}}a.Rg=aa}var cb=a.Rg;var ua=a.Z.j,ta=ua.length,wb=0,zb=0,db=y;a.nj=[];for(var qe,Yd=0;Yd<ta;Yd++){var Lb=ua[Yd];qe=[];if(Lb.visible&&
Lb!==h){var Pf=Lb.interval,Wb=a.graduatedTickUnit;if(!(2>Wb*Pf*y/a.graduatedRange)){var De=x[0][0],id=0,lc=0;zb=y*Lb.graduatedStart-1E-4;db=y*Lb.graduatedEnd+1E-4;var Zd=Wb*Pf,Wc=a.graduatedTickBase;if(Wc<a.graduatedMin){var Ze=(a.graduatedMin-Wc)/Zd;Ze=0===Ze%1?Ze:Math.floor(Ze+1);Wc+=Ze*Zd}else Wc>a.graduatedMin+Zd&&(Wc-=Math.floor((Wc-a.graduatedMin)/Zd)*Zd);for(var $e=cb[Yd];Wc<=a.graduatedMax;){a:{for(var Qf=$e.length,wf=0;wf<Qf;wf++)if(K.da((Wc-a.graduatedTickBase)%($e[wf]*a.graduatedTickUnit),
0)){var Rf=!1;break a}Rf=!0}if(Rf&&(null===Lb.graduatedSkip||!Lb.graduatedSkip(Wc))&&(wb=(Wc-a.graduatedMin)*y/a.graduatedRange,wb>y&&(wb=y),zb<=wb&&wb<=db)){for(var mc=I[id][lc],ob=x[id][lc];id<x.length;){for(;wb>De&&lc<x[id].length-1;)lc++,mc=I[id][lc],ob=x[id][lc],De+=ob;if(wb<=De)break;id++;lc=0;mc=I[id][lc];ob=x[id][lc];De+=ob}var nb=u[id],Nc=nb[2*lc],Sf=nb[2*lc+1],zc=(wb-(De-ob))/ob,$d=new J(Nc+(nb[2*lc+2]-Nc)*zc+r/2-q.bounds.x,Sf+(nb[2*lc+3]-Sf)*zc+r/2-q.bounds.y);$d.scale(h.scale,h.scale);
var Ic=mc,ae=I[id];1E-4>zc?0<lc?Ic=ae[lc-1]:K.da(nb[0],nb[nb.length-2])&&K.da(nb[1],nb[nb.length-1])&&(Ic=ae[ae.length-1]):.9999<zc&&(lc+1<ae.length?Ic=ae[lc+1]:K.da(nb[0],nb[nb.length-2])&&K.da(nb[1],nb[nb.length-1])&&(Ic=ae[0]));mc!==Ic&&(180<Math.abs(mc-Ic)&&(mc<Ic?mc+=360:Ic+=360),mc=(mc+Ic)/2%360);if(Lb instanceof Kh){var nc="";null!==Lb.graduatedFunction?(nc=Lb.graduatedFunction(Wc),nc=null!==nc&&void 0!==nc?nc.toString():""):nc=(+Wc.toFixed(2)).toString();""!==nc&&qe.push([$d,mc,nc])}else qe.push([$d,
mc])}Wc+=Zd}}}a.nj.push(qe)}Ta(I);for(var Zh=a.nj,$h=d.length,af=0;af<$h;af++){var Fb=d[af],Tf=Zh[af];if(Fb.visible&&Fb!==h&&0!==Tf.length){if(Fb instanceof Hg){var bf=a,oc=e,cf=Fb.alignmentFocus;cf.Nb()&&(cf=gd);var ad=Fb.angle;Fb.Bc=0;Fb.measure(Infinity,Infinity,0,0);Fb.Bc=ad;var vb=Fb.measuredBounds,df=vb.width,Ib=vb.height,Jc=L.allocAt(0,0,df,Ib),Ab=J.alloc();Ab.Yi(Jc,cf);L.free(Jc);for(var jd=-Ab.x,kd=-Ab.y,Jd=new L,Vg=Tf.length,Uf=0;Uf<Vg;Uf++)for(var Vf=Tf[Uf],xf=Vf[0].x,xd=Vf[0].y,Kd=Vf[1],
bd=0;4>bd;bd++){switch(bd){case 0:Ab.h(jd,kd);break;case 1:Ab.h(jd+df,kd);break;case 2:Ab.h(jd,kd+Ib);break;case 3:Ab.h(jd+df,kd+Ib)}Ab.rotate(Kd+Fb.angle);Ab.offset(xf,xd);0===Uf&&0===bd?Jd.h(Ab.x,Ab.y,0,0):Jd.Me(Ab);Ab.offset(-xf,-xd);Ab.rotate(-Kd-Fb.angle)}J.free(Ab);bf.lj.push(Jd);Mc(oc,Jd.x,Jd.y,Jd.width,Jd.height)}else if(Fb instanceof Kh){var yd=a,Bb=e;null===yd.lh&&(yd.lh=new Kh);var pb=yd.lh;$m(pb,Fb);var cd=Fb.alignmentFocus;cd.Nb()&&(cd=gd);for(var ld=Fb.segmentOrientation,zd=Fb.segmentOffset,
Oc=null,Pa=0,md=0,pc=0,re=0,ef=Tf.length,se=0;se<ef;se++){var Pc=Tf[se];Pa=Pc[0].x;md=Pc[0].y;pc=Pc[1];ld!==ch&&(re=T.computeAngle(ld,pc),pb.Bc=re);pb.text=Pc[2];pb.measure(Infinity,Infinity,0,0);var Ee=pb.measuredBounds,nd=pb.naturalBounds,Mb=nd.width,be=nd.height,bc=$b.alloc();bc.reset();bc.translate(-Ee.x,-Ee.y);bc.scale(pb.scale,pb.scale);bc.rotate(ld===ch?pb.angle:pc,Mb/2,be/2);ld!==Um&&ld!==Vm||bc.rotate(90,Mb/2,be/2);ld!==Wm&&ld!==Xm||bc.rotate(-90,Mb/2,be/2);ld===Ym&&(45<pc&&135>pc||225<pc&&
315>pc)&&bc.rotate(-pc,Mb/2,be/2);var Fe=L.allocAt(0,0,Mb,be),Ld=J.alloc();Ld.Yi(Fe,cd);bc.va(Ld);var te=-Ld.x,Wg=-Ld.y,od=J.alloc();od.assign(zd);isNaN(od.x)&&(od.x=Mb/2+3);isNaN(od.y)&&(od.y=-(be/2+3));od.rotate(pc);Pa+=od.x+te;md+=od.y+Wg;var ff=new L(Pa,md,Ee.width,Ee.height),Wf=new L(Ee.x,Ee.y,Ee.width,Ee.height),Xf=new L(nd.x,nd.y,nd.width,nd.height),gf=new an;gf.$l(pb.metrics);Pc.push(re);Pc.push(pb.lineCount);Pc.push(gf);Pc.push(ff);Pc.push(Wf);Pc.push(Xf);0===se?Oc=ff.copy():Oc.Lc(ff);J.free(od);
J.free(Ld);L.free(Fe);$b.free(bc)}yd.lj.push(Oc);Mc(Bb,Oc.x,Oc.y,Oc.width,Oc.height)}zj(Fb,!1)}}};Zm.prototype.arrange=function(a,b,c){if(null!==a.lj){var d=a.Bb(),e=a.nj,f=a.lj,g=0,h=f[g];g++;d.arrange(h.x-c.x,h.y-c.y,h.width,h.height);for(var k=b.length,l=0;l<k;l++){var m=b[l];h=e[l];m.visible&&m!==d&&0!==h.length&&(h=f[g],g++,m.arrange(h.x-c.x,h.y-c.y,h.width,h.height))}a.lj=null}};
function W(a){N.call(this);void 0===a?this.wa=W.Position:(w(a,Tl,W,"type"),this.wa=a);null===this.wa&&v("Panel type not specified or PanelLayout not loaded: "+a);this.Z=new F;this.gb=Zc;this.wa===W.Grid&&(this.isAtomic=!0);this.rn=Qd;this.Hf=al;this.wa===W.Table&&bn(this);this.Mp=ph;this.Pn=vc;this.Qn=gc;this.Mn=0;this.Ln=100;this.On=10;this.Nn=0;this.Th=this.kb=this.Rg=this.lj=this.nj=null;this.co=NaN;this.me=this.hi=null;this.ll="category";this.Gd=null;this.mg=new L(NaN,NaN,NaN,NaN);this.lh=this.kp=
this.xi=null;this.Dg=""}ma(W,N);function bn(a){a.hj=Zc;a.Lg=1;a.Yh=null;a.Xh=null;a.Kg=1;a.Jg=null;a.Wh=null;a.tb=[];a.ob=[];a.Jj=cn;a.fj=cn;a.Ai=0;a.ji=0}
W.prototype.cloneProtected=function(a){N.prototype.cloneProtected.call(this,a);a.wa=this.wa;a.gb=this.gb.J();a.rn=this.rn.J();a.Hf=this.Hf;if(a.wa===W.Table){a.hj=this.hj.J();a.Lg=this.Lg;a.Yh=this.Yh;a.Xh=this.Xh;a.Kg=this.Kg;a.Jg=this.Jg;a.Wh=this.Wh;var b=[];if(0<this.tb.length)for(var c=this.tb,d=c.length,e=0;e<d;e++)if(void 0!==c[e]){var f=c[e].copy();f.Xi(a);b[e]=f}a.tb=b;b=[];if(0<this.ob.length)for(c=this.ob,d=c.length,e=0;e<d;e++)void 0!==c[e]&&(f=c[e].copy(),f.Xi(a),b[e]=f);a.ob=b;a.Jj=
this.Jj;a.fj=this.fj;a.Ai=this.Ai;a.ji=this.ji}a.Mp=this.Mp;a.Pn=this.Pn.J();a.Qn=this.Qn.J();a.Mn=this.Mn;a.Ln=this.Ln;a.On=this.On;a.Nn=this.Nn;a.nj=this.nj;a.Rg=this.Rg;a.kb=this.kb;a.Th=this.Th;a.co=this.co;a.hi=this.hi;a.me=this.me;a.ll=this.ll;a.mg.assign(this.mg);a.Dg=this.Dg;null!==this.kp&&(a.kp=this.kp)};W.prototype.rf=function(a){N.prototype.rf.call(this,a);a.Z=this.Z;for(var b=a.Z.j,c=b.length,d=0;d<c;d++)b[d].eg=a;a.xi=null};
W.prototype.copy=function(){var a=N.prototype.copy.call(this);if(null!==a){for(var b=this.Z.j,c=b.length,d=0;d<c;d++){var e=b[d].copy();e.Xi(a);e.Ej=null;var f=a.Z,g=f.count;f.Lb(g,e);f=a.part;if(null!==f){f.zj=null;null!==e.portId&&f instanceof V&&(f.zh=!0);var h=a.diagram;null!==h&&h.undoManager.isUndoingRedoing||f.cb(qf,"elements",a,null,e,null,g)}}return a}return null};t=W.prototype;t.toString=function(){return"Panel("+this.type+")#"+Jb(this)};
t.Ko=function(a){N.prototype.Ko.call(this,a);for(var b=this.Z.j,c=b.length,d=0;d<c;d++)b[d].Ko(a)};
t.Hi=function(a,b){if(this.wa===W.Grid){b=this.Ge()*b.scale;0>=b&&(b=1);var c=this.gridCellSize,d=c.width;c=c.height;var e=this.naturalBounds,f=this.actualBounds,g=e.width,h=e.height,k=Math.ceil(g/d),l=Math.ceil(h/c),m=this.gridOrigin;a.save();a.beginPath();a.rect(0,0,g,h);a.clip();for(var n=[],p=this.Z.j,q=p.length,r=0;r<q;r++){var u=p[r],x=[];n.push(x);if(u.visible){u=hk(u.figure);for(var y=r+1;y<q;y++){var A=p[y];A.visible&&hk(A.figure)===u&&(A=A.interval,2<=A&&x.push(A))}}}p=this.Z.j;q=p.length;
for(r=0;r<q;r++){var C=p[r];if(C.visible&&(x=C.interval,!(2>d*x*b))){u=C.opacity;y=1;if(1!==u){if(0===u)continue;y=a.globalAlpha;a.globalAlpha=y*u}A=n[r];var G=!1,I=C.strokeDashArray;null!==I&&(G=!0,a.Us(I,C.strokeDashOffset));if("LineV"===C.figure&&null!==C.stroke){a.lineWidth=C.strokeWidth;zi(this,a,C.stroke,!1,!1,e,f);a.beginPath();for(I=C=Math.floor(-m.x/d);I<=C+k;I++){var O=I*d+m.x;0<=O&&O<=g&&dn(I,x,A)&&(a.moveTo(O,0),a.lineTo(O,h))}a.stroke()}else if("LineH"===C.figure&&null!==C.stroke){a.lineWidth=
C.strokeWidth;zi(this,a,C.stroke,!1,!1,e,f);a.beginPath();for(I=C=Math.floor(-m.y/c);I<=C+l;I++)O=I*c+m.y,0<=O&&O<=h&&dn(I,x,A)&&(a.moveTo(0,O),a.lineTo(g,O));a.stroke()}else if("BarV"===C.figure&&null!==C.fill)for(zi(this,a,C.fill,!0,!1,e,f),C=C.width,isNaN(C)&&(C=d),O=I=Math.floor(-m.x/d);O<=I+k;O++){var R=O*d+m.x;0<=R&&R<=g&&dn(O,x,A)&&a.fillRect(R,0,C,h)}else if("BarH"===C.figure&&null!==C.fill)for(zi(this,a,C.fill,!0,!1,e,f),C=C.height,isNaN(C)&&(C=c),O=I=Math.floor(-m.y/c);O<=I+l;O++)R=O*c+
m.y,0<=R&&R<=h&&dn(O,x,A)&&a.fillRect(0,R,g,C);G&&a.Ss();1!==u&&(a.globalAlpha=y)}}a.restore();a.Uc(!1)}else if(this.wa===W.Graduated){d=b.qj;b.qj=!0;e=this.naturalBounds;c=e.width;e=e.height;a.save();a.beginPath();a.rect(-1,-1,c+1,e+1);a.clip();c=this.Bb();c.jc(a,b);e=this.Ge()*b.scale;0>=e&&(e=1);f=c.actualBounds;g=this.Z.j;h=this.nj;k=g.length;for(l=0;l<k;l++)if(p=g[l],m=h[l],n=m.length,p.visible&&p!==c&&0!==m.length)if(p instanceof Hg){if(!(2>this.graduatedTickUnit*p.interval*c.geometry.flattenedTotalLength/
this.graduatedRange*e))for(q=p.measuredBounds,r=p.strokeWidth*p.scale,x=p.alignmentFocus,x.Nb()&&(x=gd),u=0;u<n;u++)y=m[u][0],A=m[u][1],G=x,C=p.ub,C.reset(),C.translate(y.x+f.x,y.y+f.y),C.rotate(A+p.angle,0,0),C.translate(-q.width*G.x+G.offsetX+r/2,-q.height*G.y+G.offsetY+r/2),C.scale(p.scale,p.scale),Gl(p,!1),p.Gh.set(p.ub),p.Xk=p.scale,Hl(p,!1),p.jc(a,b),p.ub.reset()}else if(p instanceof Kh)for(null===this.lh&&(this.lh=new Kh),q=this.lh,$m(q,p),p=0;p<n;p++)u=m[p],3<u.length&&(r=u[6],q.Rb=u[2],q.Bc=
u[3],q.pc=u[4],q.pd=u[5],q.rc=u[8],q.arrange(r.x,r.y,r.width,r.height),r=u[6],q.arrange(r.x,r.y,r.width,r.height),x=u[7],u=u[8],y=q.ub,y.reset(),y.translate(r.x+f.x,r.y+f.y),y.translate(-x.x,-x.y),ol(q,y,u.x,u.y,u.width,u.height),Gl(q,!1),q.Gh.set(q.ub),q.Xk=q.scale,Hl(q,!1),q.jc(a,b));b.qj=d;a.restore();a.Uc(!0)}else{this.wa===W.Table&&(a.lineCap="butt",en(this,a,!0,this.tb,!0),en(this,a,!1,this.ob,!0),fn(this,a,!0,this.tb),fn(this,a,!1,this.ob),en(this,a,!0,this.tb,!1),en(this,a,!1,this.ob,!1));
if(d=this.isClipping)a.save(),E&&this.type!==W.Spot&&Ha("Warning: Panel.isClipping set on non-Spot Panel: "+this.toString());c=this.Bb();e=this.Z.j;f=e.length;for(g=0;g<f;g++)h=e[g],d&&h===c&&(a.clipInsteadOfFill=!0),h.jc(a,b),d&&h===c&&(a.clipInsteadOfFill=!1);d&&(a.restore(),a.Uc(!0))}};
function fn(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.Lg:a.Kg);var n=l.separatorStroke;null===n&&(n=c?a.Yh:a.Jg);if(0!==m&&null!==n){zi(a,b,n,!1,!1,g,f);n=!1;var p=l.separatorDashArray;null===p&&(p=c?a.Xh:a.Wh);null!==p&&(n=!0,b.Us(p,0));b.beginPath();p=l.position+m;c?p>f.height&&(m-=
p-f.height):p>f.width&&(m-=p-f.width);l=l.position+m/2;b.lineWidth=m;m=a.gb;c?(l+=m.top,p=f.width-m.right,b.moveTo(m.left,l),b.lineTo(p,l)):(l+=m.left,p=f.height-m.bottom,b.moveTo(l,m.top),b.lineTo(l,p));b.stroke();n&&b.Ss()}}}}
function en(a,b,c,d,e){for(var f=d.length,g=a.actualBounds,h=a.naturalBounds,k=0;k<f;k++){var l=d[k];if(void 0!==l&&null!==l.background&&l.coversSeparators!==e&&0!==l.actual){var m=c?g.height:g.width;if(!(l.position>m)){var n=l.vc(),p=l.separatorStrokeWidth;isNaN(p)&&(p=c?a.Lg:a.Kg);var q=l.separatorStroke;null===q&&(q=c?a.Yh:a.Jg);null===q&&(p=0);n-=p;p=l.position+p;n+=l.actual;p+n>m&&(n=m-p);0>=n||(m=a.gb,zi(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 dn(a,b,c){if(0!==a%b)return!1;b=c.length;for(var d=0;d<b;d++)if(0===a%c[d])return!1;return!0}function hk(a){return"LineV"===a||"BarV"===a}
t.fk=function(a,b,c,d,e){var f=this.ae(),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),q=h*(g.m12*g.dx-g.m11*g.dy);if(null!==this.areaBackground)return g=this.actualBounds,K.Wc(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+q,a=c*k+d*m+p,k=c*l+d*n+q,e.h(0,0),c=this.naturalBounds,f=K.Wc(0,0,c.width,c.height,f,h,a,k,e),e.transform(g),f;f||(k=1,m=l=0,n=1,q=p=0);h=a*k+b*m+p;a=a*l+b*
n+q;k=c*k+d*m+p;c=c*l+d*n+q;e.h(k,c);d=(k-h)*(k-h)+(c-a)*(c-a);l=!1;n=this.Z.j;q=n.length;m=J.alloc();p=null;b=Infinity;var r=null;this.isClipping&&(r=J.alloc(),p=this.Bb(),(l=p.fk(h,a,k,c,r))&&(b=(h-r.x)*(h-r.x)+(a-r.y)*(a-r.y)));for(var u=0;u<q;u++){var x=n[u];x.visible&&x!==p&&x.fk(h,a,k,c,m)&&(l=!0,x=(h-m.x)*(h-m.x)+(a-m.y)*(a-m.y),x<d&&(d=x,e.set(m)))}this.isClipping&&(b>d&&e.set(r),J.free(r));J.free(m);f&&e.transform(g);return l};
t.v=function(a){N.prototype.v.call(this,a);a=null;if(this.wa===W.Auto||this.wa===W.Link)a=this.Bb();for(var b=this.Z.j,c=b.length,d=0;d<c;d++){var e=b[d];(e===a||e.isPanelMain)&&e.v(!0);if(!e.desiredSize.o()){var f=ql(e,!1);(e instanceof lh||e instanceof W||e instanceof Kh||f!==nh)&&e.v(!0)}}};t.im=function(){if(!1===Ej(this)){zj(this,!0);rl(this,!0);for(var a=this.Z.j,b=a.length,c=0;c<b;c++)a[c].im()}};
t.kl=function(){if(0!==(this.I&2048)===!1){Gl(this,!0);Hl(this,!0);for(var a=this.Z.j,b=a.length,c=0;c<b;c++)a[c].rv()}};t.rv=function(){Hl(this,!0);for(var a=this.Z.j,b=a.length,c=0;c<b;c++)a[c].rv()};
t.mm=function(a,b,c,d){var e=this.mg;e.h(0,0,0,0);var f=this.desiredSize,g=this.minSize;void 0===c&&(c=g.width,d=g.height);c=Math.max(c,g.width);d=Math.max(d,g.height);var h=this.maxSize;isNaN(f.width)||(a=Math.min(f.width,h.width));isNaN(f.height)||(b=Math.min(f.height,h.height));a=Math.max(c,a);b=Math.max(d,b);var k=this.gb;a=Math.max(a-k.left-k.right,0);b=Math.max(b-k.top-k.bottom,0);var l=this.Z.j;0!==l.length&&this.wa.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);Cc(e,a,k);Cc(this.naturalBounds,a,k);nl(this,0,0,a,k)};t.Bb=function(){if(null===this.xi){var a=this.Z.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.xi=d}this.xi=a[0]}return this.xi};function Em(a){return null!==a.part?a.part.locationObject:null}
t.vh=function(a,b,c,d){var e=this.Z.j;this.actualBounds.h(a,b,c,d);if(0!==e.length){if(!this.desiredSize.o()){a=ql(this,!0);var f=this.measuredBounds;b=f.width;f=f.height;var g=this.Xg,h=g.left+g.right;g=g.top+g.bottom;b===c&&f===d&&(a=nh);switch(a){case nh:if(b>c||f>d)this.v(),this.measure(b>c?c:b,f>d?d:f,0,0);break;case oe:this.v(!0);this.measure(c+h,d+g,0,0);break;case bl:this.v(!0);this.measure(c+h,f+g,0,0);break;case cl:this.v(!0),this.measure(b+h,d+g,0,0)}}this.wa.arrange(this,e,this.mg)}};
t.xh=function(a){var b=this.naturalBounds,c=Em(this);if(Qc(0,0,b.width,b.height,a.x,a.y)){b=this.Z.j;for(var d=b.length,e=J.allocAt(0,0);d--;){var f=b[d];if(f.visible||f===c)if(ac(e.set(a),f.transform),f.ea(e))return J.free(e),!0}J.free(e);return null===this.jb&&null===this.fc?!1:!0}return!1};t.Vs=function(a){if(this.Ik===a)return this;for(var b=this.Z.j,c=b.length,d=0;d<c;d++){var e=b[d].Vs(a);if(null!==e)return e}return null};
t.xk=function(a,b){b(this,a);if(a instanceof W){a=a.Z.j;for(var c=a.length,d=0;d<c;d++)this.xk(a[d],b)}};function Rj(a,b){gn(a,a,b)}function gn(a,b,c){c(b);b=b.Z.j;for(var d=b.length,e=0;e<d;e++){var f=b[e];f instanceof W&&gn(a,f,c)}}function hn(a,b){jn(a,a,b)}function jn(a,b,c){c(b);if(b instanceof W){b=b.Z.j;for(var d=b.length,e=0;e<d;e++)jn(a,b[e],c)}}t.cm=function(a){return kn(this,this,a)};
function kn(a,b,c){if(c(b))return b;if(b instanceof W){b=b.Z.j;for(var d=b.length,e=0;e<d;e++){var f=kn(a,b[e],c);if(null!==f)return f}}return null}t.bb=function(a){if(this.name===a)return this;var b=this.Z.j,c=b.length;null===this.hi&&null===this.me||(c=ln(this));for(var d=0;d<c;d++){var e=b[d];if(e instanceof W){var f=e.bb(a);if(null!==f)return f}if(e.name===a)return e}return null};
function mn(a){a=a.Z.j;for(var b=a.length,c=0,d=0;d<b;d++){var e=a[d];if(e instanceof W)c=Math.max(c,mn(e));else if(e instanceof Hg){a:{switch(e.Zk){case "None":case "Square":case "Ellipse":case "Circle":case "LineH":case "LineV":case "FramedRectangle":case "RoundedRectangle":case "Line1":case "Line2":case "Border":case "Cube1":case "Cube2":case "Junction":case "Cylinder1":case "Cylinder2":case "Cylinder3":case "Cylinder4":case "PlusLine":case "XLine":case "ThinCross":case "ThickCross":e=0;break a}e=
e.jh/2*e.Nj*e.Ge()}c=Math.max(c,e)}}return c}t.ae=function(){return!(this.type===W.TableRow||this.type===W.TableColumn)};
t.Tb=function(a,b,c){if(!1===this.pickable)return null;void 0===b&&(b=null);void 0===c&&(c=null);if(Fj(this))return null;var d=this.naturalBounds,e=1/this.Ge(),f=this.ae(),g=f?a:ac(J.allocAt(a.x,a.y),this.transform),h=this.diagram,k=10,l=5;null!==h&&(k=h.gm("extraTouchArea"),l=k/2);if(Qc(-(l*e),-(l*e),d.width+k*e,d.height+k*e,g.x,g.y)){if(!this.isAtomic){e=this.Z.j;var m=e.length;h=J.alloc();l=(k=this.isClipping)?this.Bb():null;if(k&&(l.ae()?ac(h.set(a),l.transform):h.set(a),!l.ea(h)))return J.free(h),
f||J.free(g),null;for(var n=Em(this);m--;){var p=e[m];if(p.visible||p===n)if(p.ae()?ac(h.set(a),p.transform):h.set(a),!k||p!==l){var q=null;p instanceof W?q=p.Tb(h,b,c):!0===p.pickable&&p.ea(h)&&(q=p);if(null!==q&&(null!==b&&(q=b(q)),null!==q&&(null===c||c(q))))return J.free(h),f||J.free(g),q}}J.free(h)}if(null===this.background&&null===this.areaBackground)return f||J.free(g),null;a=Qc(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.Ki=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.ae(),g=f?a:ac(J.allocAt(a.x,a.y),this.transform),h=this.type===W.TableRow||this.type===W.TableColumn;e=Qc(0,0,e.width,e.height,g.x,g.y);if(h||e){if(!this.isAtomic){h=this.Z.j;for(var k=h.length,l=J.alloc(),m=Em(this);k--;){var n=h[k];if(n.visible||n===m){n.ae()?ac(l.set(a),n.transform):l.set(a);var p=n;n=n instanceof W?n:null;(null!==n?n.Ki(l,b,c,d):p.ea(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.rg=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=$b.alloc(),g.reset());g.multiply(this.transform);if(this.wh(a,g))return nn(this,b,c,e),void 0===f&&$b.free(g),!0;if(this.Kc(a,g)){if(!this.isAtomic)for(var h=Em(this),k=this.Z.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 W?m:null;p=$b.alloc();p.set(g);
if(null!==m?m.rg(a,b,c,d,e,p):pl(n,a,d,p))null!==b&&(n=b(n)),null===n||null!==c&&!c(n)||e.add(n);$b.free(p)}}}void 0===f&&$b.free(g);return d}void 0===f&&$b.free(g);return!1};function nn(a,b,c,d){for(var e=a.Z.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 W&&nn(g,b,c,d),null!==b&&(g=b(g)),null===g||null!==c&&!c(g)||d.add(g))}}}
t.sg=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.ae(),k=h?a:ac(J.allocAt(a.x,a.y),this.transform),l=h?b:ac(J.allocAt(b.x,b.y),this.transform),m=k.Fe(l),n=0<k.x&&k.x<g.width&&0<k.y&&k.y<g.height||cc(k.x,k.y,0,0,0,g.height)<=m||cc(k.x,k.y,0,g.height,g.width,g.height)<=m||cc(k.x,k.y,g.width,g.height,g.width,0)<=m||cc(k.x,k.y,g.width,0,0,0)<=m;g=k.ed(0,0)<=m&&k.ed(0,g.height)<=m&&k.ed(g.width,0)<=m&&k.ed(g.width,g.height)<=
m;h||(J.free(k),J.free(l));if(n){if(!this.isAtomic){k=J.alloc();l=J.alloc();m=Em(this);for(var p=this.Z.j,q=p.length;q--;){var r=p[q];if(r.visible||r===m){var u=r.actualBounds,x=this.naturalBounds;if(!h||!(u.x>x.width||u.y>x.height||0>u.x+u.width||0>u.y+u.height))if(r.ae()?(u=r.transform,ac(k.set(a),u),ac(l.set(b),u)):(k.set(a),l.set(b)),u=r,r=r instanceof W?r:null,null!==r?r.sg(k,l,c,d,e,f):u.ox(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 Jm(a){var b=null;a instanceof Hg&&(b=a.spot1,b===Qd&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot1));null===b&&(b=fd);return b}function Km(a){var b=null;a instanceof Hg&&(b=a.spot2,b===Qd&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot2));null===b&&(b=ud);return b}t.add=function(a){w(a,N,W,"add:element");this.Lb(this.Z.count,a)};t.O=function(a){return this.Z.O(a)};
t.Lb=function(a,b){b instanceof U&&v("Cannot add a Part to a Panel: "+b+"; use a Panel instead");if(this===b||this.vg(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.wa!==W.Grid||b instanceof Hg||v("Can only add Shapes to a Grid Panel, not: "+b);this.wa!==W.Graduated||b instanceof Hg||b instanceof Kh||v("Can only add Shapes or TextBlocks to a Graduated Panel, not: "+b);b.Xi(this);b.Ej=null;if(null!==this.itemArray){var d=b.data;null!==d&&"object"===typeof d&&(null===this.Gd&&(this.Gd=new Ub),this.Gd.add(d,b))}var e=this.Z;d=-1;if(c===this){for(var f=-1,g=this.Z.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.nb(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.Lb(a,b);if(0===a||b.isPanelMain)this.xi=null;Ej(this)||this.v();b.v(!1);null!==b.portId?this.zh=!0:b instanceof W&&!0===b.zh&&(this.zh=!0);this.Rg=null;c=this.part;null!==c&&(c.zj=null,c.Yg=NaN,this.zh&&c instanceof V&&(c.zh=!0),c.zh&&c instanceof V&&(c.tc=null),e=this.diagram,null!==e&&e.undoManager.isUndoingRedoing||(-1!==d&&c.cb(rf,"elements",this,b,null,d,null),c.cb(qf,
"elements",this,null,b,null,a),this.wg()||on(this,b,!1)))};function pn(a,b){a.I=b?a.I|16777216:a.I&-16777217}t.remove=function(a){w(a,N,W,"remove:element");for(var b=this.Z.j,c=b.length,d=-1,e=0;e<c;e++)if(b[e]===a){d=e;break}-1!==d&&this.zc(d,!0)};t.nb=function(a){E&&B(a,W,"removeAt:idx");0<=a&&this.zc(a,!0)};
t.zc=function(a,b){var c=this.Z,d=c.O(a);d.Ej=null;d.Xi(null);if(null!==this.Gd){var e=d.data;"object"===typeof e&&this.Gd.remove(e)}c.nb(a);zj(this,!1);this.v();this.xi===d&&(this.xi=null);this.Rg=null;var f=this.part;null!==f&&(f.zj=null,f.Yg=NaN,f.Mb(),f instanceof V&&(d instanceof W?d.xk(d,function(a,c){Xl(f,c,b)}):Xl(f,d,b)),c=this.diagram,null!==c&&c.undoManager.isUndoingRedoing||f.cb(rf,"elements",this,d,null,a,null))};
W.prototype.getRowDefinition=function(a){E&&B(a,W,"getRowDefinition:idx");0>a&&Ca(a,">= 0",W,"getRowDefinition:idx");a=Math.round(a);var b=this.tb;if(void 0===b)return null;if(void 0===b[a]){var c=new fk;c.Xi(this);c.isRow=!0;c.index=a;b[a]=c}return b[a]};W.prototype.Iv=function(a){E&&B(a,W,"removeRowDefinition:idx");0>a&&Ca(a,">= 0",W,"removeRowDefinition:idx");a=Math.round(a);var b=this.tb;void 0!==b&&(this.cb(rf,"coldefs",this,b[a],null,a,null),b[a]&&delete b[a],this.v())};
W.prototype.getColumnDefinition=function(a){E&&B(a,W,"getColumnDefinition:idx");0>a&&Ca(a,">= 0",W,"getColumnDefinition:idx");a=Math.round(a);var b=this.ob;if(void 0===b)return null;if(void 0===b[a]){var c=new fk;c.Xi(this);c.isRow=!1;c.index=a;b[a]=c}return b[a]};t=W.prototype;t.Gv=function(a){E&&B(a,W,"removeColumnDefinition:idx");0>a&&Ca(a,">= 0",W,"removeColumnDefinition:idx");a=Math.round(a);var b=this.ob;void 0!==b&&(this.cb(rf,"coldefs",this,b[a],null,a,null),b[a]&&delete b[a],this.v())};
t.az=function(a){if(0>a||this.type!==W.Table)return-1;for(var b=0,c=this.tb,d=c.length,e=this.Ai;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))break}return e};t.Ty=function(a){if(0>a||this.type!==W.Table)return-1;for(var b=0,c=this.ob,d=c.length,e=this.ji;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))break}return e};
t.sz=function(a,b){void 0===b&&(b=new J(NaN,NaN));if(this.type!==W.Graduated)return b.h(NaN,NaN),b;a=Math.min(Math.max(a,this.graduatedMin),this.graduatedMax);var c=this.Bb();c.geometry.lv((a-this.graduatedMin)/this.graduatedRange,b);return c.transform.va(b)};t.uz=function(a){if(this.type!==W.Graduated)return NaN;var b=this.Bb();b.transform.Wd(a);return b.geometry.sx(a)*this.graduatedRange+this.graduatedMin};function Ol(a){a=a.Th;return null!==a&&a.u}
function mh(a){var b=a.Th;if(null===b)null!==a.data&&v("Template cannot have .data be non-null: "+a),a.Th=b=new F;else if(b.u)return;var c=new F;pn(a,!1);a.xk(a,function(a,d){var e=d.eb;if(null!==e)for(Ll(d,!1),e=e.iterator;e.next();){var f=e.value;f.mode===qn&&Ll(d,!0);var g=f.sourceName;null!==g&&("/"===g&&pn(a,!0),g=ml(f,a,d),null!==g&&(c.add(g),null===g.Kl&&(g.Kl=new F),g.Kl.add(f)));b.add(f)}if(d instanceof W&&d.type===W.Table){if(0<d.tb.length)for(a=d.tb,e=a.length,f=0;f<e;f++)if(g=a[f],void 0!==
g&&null!==g.eb)for(var h=g.eb.iterator;h.next();){var k=h.value;k.Sd=g;k.Dp=2;k.Sl=g.index;b.add(k)}if(0<d.ob.length)for(d=d.ob,a=d.length,e=0;e<a;e++)if(f=d[e],void 0!==f&&null!==f.eb)for(g=f.eb.iterator;g.next();)h=g.value,h.Sd=f,h.Dp=1,h.Sl=f.index,b.add(h)}});for(var d=c.iterator;d.next();){var e=d.value;if(null!==e.Kl){Ll(e,!0);for(var f=e.Kl.iterator;f.next();){var g=f.value;null===e.eb&&(e.eb=new F);e.eb.add(g)}}e.Kl=null}for(var h=b.iterator;h.next();)if(d=h.value,e=d.Sd,null!==e){d.Sd=null;
g=d.targetProperty;var k=g.indexOf(".");0<k&&e instanceof W&&(f=g.substring(0,k),g=g.substr(k+1),k=e.bb(f),null!==k?(e=k,d.targetProperty=g):Ha('Warning: unable to find GraphObject named "'+f+'" for Binding: '+d.toString()));e instanceof fk?(f=Jb(e.panel),d.aj=void 0===f?-1:f,e.panel.Ik=d.aj):e instanceof N?(f=Jb(e),d.aj=void 0===f?-1:f,e.Ik=d.aj):v("Unknown type of binding target: "+e)}b.freeze();a instanceof U&&(a.dc()&&a.bc(),E&&!rn&&a.xk(a,function(a,c){if(c instanceof W&&(c.type===W.Auto||c.type===
W.Spot||c.type===W.Graduated)&&1>=c.elements.count&&!(c instanceof U)){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||(Ha("Auto, Spot, or Graduated Panel should not have zero or one elements: "+c.toString()+" in "+a.toString()),rn=!0)}}))}t.Dy=function(){var a=this.copy();hn(a,function(a){a instanceof W&&(a.Th=null,a.kb=null);var b=a.eb;null!==b&&(a.eb=null,b.each(function(b){a.bind(b.copy())}))});return a};
t.Fa=function(a){var b=this.Th;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.bb(e);else{var f=this.diagram;null!==f&&c.isToModel&&(d=f.model.modelData)}if(null===d)E&&Ha("Binding error: missing GraphObject named "+e+" in "+this.toString());else{f=this;var g=c.aj;if(-1!==g){if(f=
this.Vs(g),null===f)continue}else null!==c.Sd&&(f=c.Sd);"/"===e?d=f.part:"."===e?d=f:".."===e&&(d=f.panel);e=c.Dp;if(0!==e){if(!(f instanceof W))continue;1===e?f=f.getColumnDefinition(c.Sl):2===e&&(f=f.getRowDefinition(c.Sl))}void 0!==f&&c.ew(f,d)}}}};
function sn(a,b){a=a.Z.j;for(var c=a.length,d=b.length,e=0,f=null;e<c&&!(f=a[e],f instanceof W&&null!==f.data);)e++,f=a[e];if(c-e!==d)return!0;if(null===f)return 0<d;for(var g=0;e<c&&g<d;){f=a[e];if(!(f instanceof W)||f.data!==b[g])return!0;e++;g++}return!1}
function ln(a){if(a.type===W.Spot||a.type===W.Auto)return Math.min(a.Z.length,1);if(a.type===W.Link){a=a.Z;for(var b=a.length,c=0;c<b;c++){var d=a.O(c);if(!(d instanceof Hg&&d.isPanelMain))break}return c}return a.type===W.Table&&0<a.Z.length&&(a=a.Z.O(0),a.isPanelMain&&a instanceof W&&(a.type===W.TableRow||a.type===W.TableColumn))?1:0}t.st=function(){for(var a=ln(this);this.Z.length>a;)this.zc(this.Z.length-1,!1);a=this.itemArray;if(null!==a)for(var b=a.length,c=0;c<b;c++)tn(this,a[c],c)};
t.nx=function(a){if(void 0===a||null===a||null===this.Gd)return null;z(a,"object",W,"findItemPanelForData");return this.Gd.K(a)};
function tn(a,b,c){if(!(void 0===b||null===b||0>c)){var d=un(a,b),e=a.itemTemplateMap,f=null;null!==e&&(f=e.K(d));null===f&&(vn||(vn=!0,Ha('No item template Panel found for category "'+d+'" on '+a),Ha("  Using default item template."),d=new W,e=new Kh,e.bind(new Ui("text","",Wa)),d.add(e),wn=d),f=wn);d=f;null!==d&&(mh(d),d=d.copy(),0!==(d.I&16777216)&&(e=a.Li(),null!==e&&pn(e,!0)),"object"===typeof b&&(null===a.Gd&&(a.Gd=new Ub),a.Gd.add(b,d)),e=c+ln(a),a.Lb(e,d),d.kb=b,xn(a,e,c),d.kb=null,d.data=
b)}}function xn(a,b,c){for(a=a.Z;b<a.length;){var d=a.O(b);if(d instanceof W){var e=b,f=c;d.type===W.TableRow?d.row=e:d.type===W.TableColumn&&(d.column=e);d.itemIndex=f}b++;c++}}function un(a,b){if(null===b)return"";a=a.ll;if("function"===typeof a)a=a(b);else if("string"===typeof a&&"object"===typeof b){if(""===a)return"";a=yn(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 on(a,b,c){var d=b.enabledChanged;null!==d&&d(b,c);if(b instanceof W){b=b.Z.j;d=b.length;for(var e=0;e<d;e++){var f=b[e];c&&f instanceof W&&!f.isEnabled||on(a,f,c)}}}function zn(a,b){Sl.add(a,b)}
na.Object.defineProperties(W.prototype,{type:{configurable:!0,get:function(){return this.wa},set:function(a){var b=this.wa;b!==a&&(this.wa=a,this.wa===W.Grid?this.isAtomic=!0:this.wa===W.Table&&bn(this),this.v(),this.g("type",b,a))}},elements:{configurable:!0,get:function(){return this.Z.iterator}},naturalBounds:{configurable:!0,get:function(){return this.rc}},padding:{configurable:!0,get:function(){return this.gb},set:function(a){"number"===
typeof a?(0>a&&Ca(a,">= 0",W,"padding"),a=new Hc(a)):(w(a,Hc,W,"padding"),0>a.left&&Ca(a.left,">= 0",W,"padding:value.left"),0>a.right&&Ca(a.right,">= 0",W,"padding:value.right"),0>a.top&&Ca(a.top,">= 0",W,"padding:value.top"),0>a.bottom&&Ca(a.bottom,">= 0",W,"padding:value.bottom"));var b=this.gb;b.A(a)||(this.gb=a=a.J(),this.v(),this.g("padding",b,a))}},defaultAlignment:{configurable:!0,get:function(){return this.rn},set:function(a){var b=this.rn;b.A(a)||(E&&w(a,M,W,"defaultAlignment"),
this.rn=a=a.J(),this.v(),this.g("defaultAlignment",b,a))}},defaultStretch:{configurable:!0,get:function(){return this.Hf},set:function(a){var b=this.Hf;b!==a&&(tb(a,N,W,"defaultStretch"),this.Hf=a,this.v(),this.g("defaultStretch",b,a))}},defaultSeparatorPadding:{configurable:!0,get:function(){return void 0===this.hj?Zc:this.hj},set:function(a){if(void 0!==this.hj){"number"===typeof a?a=new Hc(a):E&&w(a,Hc,W,"defaultSeparatorPadding");var b=this.hj;b.A(a)||(this.hj=a=a.J(),
this.v(),this.g("defaultSeparatorPadding",b,a))}}},defaultRowSeparatorStroke:{configurable:!0,get:function(){return void 0===this.Yh?null:this.Yh},set:function(a){var b=this.Yh;b!==a&&(null===a||"string"===typeof a||a instanceof zl)&&(a instanceof zl&&a.freeze(),this.Yh=a,this.S(),this.g("defaultRowSeparatorStroke",b,a))}},defaultRowSeparatorStrokeWidth:{configurable:!0,get:function(){return void 0===this.Lg?1:this.Lg},set:function(a){if(void 0!==this.Lg){var b=this.Lg;
b!==a&&isFinite(a)&&0<=a&&(this.Lg=a,this.v(),this.g("defaultRowSeparatorStrokeWidth",b,a))}}},defaultRowSeparatorDashArray:{configurable:!0,get:function(){return void 0===this.Xh?null:this.Xh},set:function(a){if(void 0!==this.Xh){var b=this.Xh;if(b!==a){null===a||Array.isArray(a)||Ba(a,"Array",W,"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.Xh=a;this.S();this.g("defaultRowSeparatorDashArray",b,a)}}}},defaultColumnSeparatorStroke:{configurable:!0,get:function(){return void 0===this.Jg?null:this.Jg},set:function(a){if(void 0!==this.Jg){var b=this.Jg;b!==a&&(null===a||"string"===typeof a||a instanceof zl)&&(a instanceof zl&&a.freeze(),this.Jg=a,this.S(),this.g("defaultColumnSeparatorStroke",b,a))}}},defaultColumnSeparatorStrokeWidth:{configurable:!0,
enumerable:!0,get:function(){return void 0===this.Kg?1:this.Kg},set:function(a){if(void 0!==this.Kg){var b=this.Kg;b!==a&&isFinite(a)&&0<=a&&(this.Kg=a,this.v(),this.g("defaultColumnSeparatorStrokeWidth",b,a))}}},defaultColumnSeparatorDashArray:{configurable:!0,get:function(){return void 0===this.Wh?null:this.Wh},set:function(a){if(void 0!==this.Wh){var b=this.Wh;if(b!==a){null===a||Array.isArray(a)||Ba(a,"Array",W,"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.Wh=a;this.S();this.g("defaultColumnSeparatorDashArray",b,a)}}}},viewboxStretch:{configurable:!0,get:function(){return this.Mp},set:function(a){var b=this.Mp;b!==a&&(tb(a,N,W,"viewboxStretch"),this.Mp=a,this.v(),this.g("viewboxStretch",b,a))}},gridCellSize:{configurable:!0,
enumerable:!0,get:function(){return this.Pn},set:function(a){var b=this.Pn;if(!b.A(a)){w(a,Zb,W,"gridCellSize");a.o()&&0!==a.width&&0!==a.height||v("Invalid Panel.gridCellSize: "+a);this.Pn=a.J();var c=this.diagram;null!==c&&this===c.grid&&Aj(c);this.S();this.g("gridCellSize",b,a)}}},gridOrigin:{configurable:!0,get:function(){return this.Qn},set:function(a){var b=this.Qn;if(!b.A(a)){w(a,J,W,"gridOrigin");a.o()||v("Invalid Panel.gridOrigin: "+a);this.Qn=a.J();var c=this.diagram;null!==
c&&this===c.grid&&Aj(c);this.S();this.g("gridOrigin",b,a)}}},graduatedMin:{configurable:!0,get:function(){return this.Mn},set:function(a){B(a,W,"graduatedMin");var b=this.Mn;b!==a&&(this.Mn=a,this.v(),this.g("graduatedMin",b,a),kl(this)&&(a=this.part,null!==a&&ll(this,a,"graduatedRange")))}},graduatedMax:{configurable:!0,get:function(){return this.Ln},set:function(a){B(a,W,"graduatedMax");var b=this.Ln;b!==a&&(this.Ln=a,this.v(),this.g("graduatedMax",b,a),kl(this)&&(a=
this.part,null!==a&&ll(this,a,"graduatedRange")))}},graduatedRange:{configurable:!0,get:function(){return this.graduatedMax-this.graduatedMin}},graduatedTickUnit:{configurable:!0,get:function(){return this.On},set:function(a){B(a,W,"graduatedTickUnit");var b=this.On;b!==a&&0<a&&(this.On=a,this.v(),this.g("graduatedTickUnit",b,a))}},graduatedTickBase:{configurable:!0,get:function(){return this.Nn},set:function(a){B(a,W,"graduatedTickBase");var b=this.Nn;b!==
a&&(this.Nn=a,this.v(),this.g("graduatedTickBase",b,a))}},zh:{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.tb?0:this.tb.length}},columnCount:{configurable:!0,get:function(){return void 0===this.ob?0:this.ob.length}},rowSizing:{configurable:!0,get:function(){return void 0===this.Jj?cn:this.Jj},set:function(a){if(void 0!==
this.Jj){var b=this.Jj;b!==a&&(E&&a!==cn&&a!==Nm&&v("Panel.rowSizing must be RowColumnDefinition.ProportionalExtra or RowColumnDefinition.None, not: "+a),this.Jj=a,this.v(),this.g("rowSizing",b,a))}}},columnSizing:{configurable:!0,get:function(){return void 0===this.fj?cn:this.fj},set:function(a){if(void 0!==this.fj){var b=this.fj;b!==a&&(E&&a!==cn&&a!==Nm&&v("Panel.columnSizing must be RowColumnDefinition.ProportionalExtra or RowColumnDefinition.None, not: "+a),this.fj=a,this.v(),this.g("columnSizing",
b,a))}}},topIndex:{configurable:!0,get:function(){return void 0===this.Ai?0:this.Ai},set:function(a){if(void 0!==this.Ai){var b=this.Ai;b!==a&&((!isFinite(a)||0>a)&&v("Panel.topIndex must be greater than zero and a real number, not: "+a),this.Ai=a,this.v(),this.g("topIndex",b,a))}}},leftIndex:{configurable:!0,get:function(){return void 0===this.ji?0:this.ji},set:function(a){if(void 0!==this.ji){var b=this.ji;b!==a&&((!isFinite(a)||0>a)&&v("Panel.leftIndex must be greater than zero and a real number, not: "+
a),this.ji=a,this.v(),this.g("leftIndex",b,a))}}},data:{configurable:!0,get:function(){return this.kb},set:function(a){var b=this.kb;if(b!==a){var c=this instanceof U&&!(this instanceof Cf);c&&z(a,"object",W,"data");mh(this);this.kb=a;var d=this.diagram;null!==d&&(c?(c=d.partManager,this instanceof T?(null!==b&&c.Ig.remove(b),null!==a&&c.Ig.add(a,this)):this instanceof U&&(null!==b&&c.Pe.remove(b),null!==a&&c.Pe.add(a,this))):(c=this.panel,null!==c&&null!==c.Gd&&(null!==b&&c.Gd.remove(b),
null!==a&&c.Gd.add(a,this))));this.g("data",b,a);null!==d&&d.undoManager.isUndoingRedoing||null!==a&&this.Fa()}}},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.hi},set:function(a){var b=this.hi;if(b!==a||null!==a&&sn(this,a)){E&&null!==a&&!Ka(a)&&v("Panel.itemArray must be an Array-like object or null, not: "+a);var c=this.diagram;
b!==a&&(null!==c&&null!==b&&Wj(c.partManager,this,c),this.hi=a,null!==c&&null!==a&&Tj(c.partManager,this));this.g("itemArray",b,a);null!==c&&c.undoManager.isUndoingRedoing||this.st()}}},itemTemplate:{configurable:!0,get:function(){return null===this.me?null:this.me.K("")},set:function(a){if(null===this.me){if(null===a)return;this.me=new Ub}var b=this.me.K("");b!==a&&(w(a,W,W,"itemTemplate"),(a instanceof U||a.isPanelMain)&&v("Panel.itemTemplate must not be a Part or be Panel.isPanelMain: "+
a),this.me.add("",a),this.g("itemTemplate",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.st())}},itemTemplateMap:{configurable:!0,get:function(){return this.me},set:function(a){var b=this.me;if(b!==a){w(a,Ub,W,"itemTemplateMap");for(var c=a.iterator;c.next();){var d=c.value;E&&(d instanceof U||d.isPanelMain)&&v("Template in Panel.itemTemplateMap must not be a Part or be Panel.isPanelMain: "+d)}this.me=a;this.g("itemTemplateMap",b,a);a=this.diagram;null!==a&&a.undoManager.isUndoingRedoing||
this.st()}}},itemCategoryProperty:{configurable:!0,get:function(){return this.ll},set:function(a){var b=this.ll;b!==a&&("string"!==typeof a&&"function"!==typeof a&&Ba(a,"string or function",W,"itemCategoryProperty"),this.ll=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&&(z(a,"boolean",W,"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&&(z(a,"boolean",W,"isClipping"),this.I^=2097152,this.v(),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&&(z(a,"boolean",W,"isOpposite"),this.I^=33554432,this.v(),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){z(a,"boolean",W,"isEnabled");var c=null===this.panel||this.panel.wg();this.I^=4194304;this.g("isEnabled",b,a);b=this.diagram;null!==b&&b.undoManager.isUndoingRedoing||c&&on(this,this,a)}}},alignmentFocusName:{configurable:!0,get:function(){return this.Dg},set:function(a){var b=this.Dg;b!==a&&(E&&z(a,"string",W,"alignmentFocusName"),this.Dg=a,this.v(),this.g("alignmentFocusName",b,a))}}});
na.Object.defineProperties(W,{Position:{configurable:!0,get:function(){return Sl.K("Position")}},Horizontal:{configurable:!0,get:function(){return Sl.K("Horizontal")}},Vertical:{configurable:!0,get:function(){return Sl.K("Vertical")}},Spot:{configurable:!0,get:function(){return Sl.K("Spot")}},Auto:{configurable:!0,get:function(){return Sl.K("Auto")}},Table:{configurable:!0,get:function(){return Sl.K("Table")}},Viewbox:{configurable:!0,
enumerable:!0,get:function(){return Sl.K("Viewbox")}},TableRow:{configurable:!0,get:function(){return Sl.K("TableRow")}},TableColumn:{configurable:!0,get:function(){return Sl.K("TableColumn")}},Link:{configurable:!0,get:function(){return Sl.K("Link")}},Grid:{configurable:!0,get:function(){return Sl.K("Grid")}},Graduated:{configurable:!0,get:function(){return Sl.K("Graduated")}}});W.prototype.findItemPanelForData=W.prototype.nx;
W.prototype.rebuildItemElements=W.prototype.st;W.prototype.updateTargetBindings=W.prototype.Fa;W.prototype.copyTemplate=W.prototype.Dy;W.prototype.graduatedValueForPoint=W.prototype.uz;W.prototype.graduatedPointForValue=W.prototype.sz;W.prototype.findColumnForLocalX=W.prototype.Ty;W.prototype.findRowForLocalY=W.prototype.az;W.prototype.removeColumnDefinition=W.prototype.Gv;W.prototype.removeRowDefinition=W.prototype.Iv;W.prototype.removeAt=W.prototype.nb;W.prototype.remove=W.prototype.remove;
W.prototype.insertAt=W.prototype.Lb;W.prototype.elt=W.prototype.O;W.prototype.add=W.prototype.add;W.prototype.findObject=W.prototype.bb;W.prototype.findInVisualTree=W.prototype.cm;W.prototype.walkVisualTreeFrom=W.prototype.xk;W.prototype.findMainElement=W.prototype.Bb;var rn=!1,vn=!1,wn=null,Sl=new Ub;W.className="Panel";W.definePanelLayout=zn;zn("Position",new Dm);zn("Vertical",new Gm);zn("Auto",new Im);zn("Link",new Sm);zn("Grid",new Rm);
function fk(){qb(this);this.eg=null;this.Lr=!0;this.Ua=0;this.Sc=NaN;this.$g=0;this.Zg=Infinity;this.xb=Qd;this.ua=this.ma=0;this.eb=null;this.wp=An;this.ze=al;this.rp=this.ig=null;this.sp=NaN;this.jb=this.Lj=null;this.mn=!1}
fk.prototype.copy=function(){var a=new fk;a.Lr=this.Lr;a.Ua=this.Ua;a.Sc=this.Sc;a.$g=this.$g;a.Zg=this.Zg;a.xb=this.xb;a.ma=this.ma;a.ua=this.ua;a.ze=this.ze;a.wp=this.wp;null===this.ig?a.ig=null:a.ig=this.ig.J();a.rp=this.rp;a.sp=this.sp;a.Lj=null;null!==this.Lj&&(a.separatorDashArray=Ma(this.separatorDashArray));a.jb=this.jb;a.mn=this.mn;a.eb=this.eb;return a};t=fk.prototype;
t.$l=function(a){w(a,fk,fk,"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.ig=null===a.separatorPadding?null:a.separatorPadding.J();this.separatorStroke=a.separatorStroke;this.separatorStrokeWidth=a.separatorStrokeWidth;this.Lj=null;a.separatorDashArray&&(this.Lj=Ma(a.separatorDashArray));this.background=a.background;this.coversSeparators=a.coversSeparators;this.eb=
a.eb};t.hb=function(a){a.classType===fk?this.sizing=a:Fa(this,a)};t.toString=function(){return"RowColumnDefinition "+(this.isRow?"(Row ":"(Column ")+this.index+") #"+Jb(this)};t.Xi=function(a){this.eg=a};
t.Uu=function(){var a=0,b=0,c=this.eg,d=this.isRow;if(null!==c&&c.type===W.Table)for(var e=d?c.tb.length:c.ob.length,f=0;f<e;f++){var g=d?c.tb[f]:c.ob[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.ig;if(null===b)if(null!==c)b=
c.defaultSeparatorPadding;else return a;return a+(this.isRow?b.top:b.left)};
t.vc=function(){var a=0,b=this.eg,c=0,d=this.isRow;if(null!==b&&b.type===W.Table)for(var e=d?b.tb.length:b.ob.length,f=0;f<e;f++){var g=d?b.tb[f]:b.ob[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.ig;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.zb=function(a,b,c){var d=this.eg;if(null!==d&&(d.cb(of,a,this,b,c,void 0,void 0),null!==this.eb&&(b=d.diagram,null!==b&&!b.skipsModelSourceBindings&&(d=d.Li(),null!==d&&(b=d.data,null!==b)))))for(c=this.eb.iterator;c.next();)c.value.Eq(this,b,a,d)};function Mm(a){if(a.sizing===An){var b=a.eg;return a.isRow?b.rowSizing:b.columnSizing}return a.sizing}
t.bind=function(a){a.Sd=this;var b=this.panel;if(null!==b){var c=b.Li();null!==c&&Ol(c)&&v("Cannot add a Binding to a RowColumnDefinition that is already frozen: "+a+" on "+b)}null===this.eb&&(this.eb=new F);this.eb.add(a)};
na.Object.defineProperties(fk.prototype,{panel:{configurable:!0,get:function(){return this.eg}},isRow:{configurable:!0,get:function(){return this.Lr},set:function(a){this.Lr=a}},index:{configurable:!0,get:function(){return this.Ua},set:function(a){this.Ua=a}},height:{configurable:!0,get:function(){return this.Sc},set:function(a){var b=this.Sc;b!==a&&(E&&z(a,"number",fk,"height"),0>a&&Ca(a,">= 0",fk,"height"),this.Sc=a,this.actual=this.ma,null!==
this.panel&&this.panel.v(),this.zb("height",b,a))}},width:{configurable:!0,get:function(){return this.Sc},set:function(a){var b=this.Sc;b!==a&&(E&&z(a,"number",fk,"width"),0>a&&Ca(a,">= 0",fk,"width"),this.Sc=a,this.actual=this.ma,null!==this.panel&&this.panel.v(),this.zb("width",b,a))}},minimum:{configurable:!0,get:function(){return this.$g},set:function(a){var b=this.$g;b!==a&&(E&&z(a,"number",fk,"minimum"),(0>a||!isFinite(a))&&Ca(a,">= 0",fk,"minimum"),this.$g=a,this.actual=
this.ma,null!==this.panel&&this.panel.v(),this.zb("minimum",b,a))}},maximum:{configurable:!0,get:function(){return this.Zg},set:function(a){var b=this.Zg;b!==a&&(E&&z(a,"number",fk,"maximum"),0>a&&Ca(a,">= 0",fk,"maximum"),this.Zg=a,this.actual=this.ma,null!==this.panel&&this.panel.v(),this.zb("maximum",b,a))}},alignment:{configurable:!0,get:function(){return this.xb},set:function(a){var b=this.xb;b.A(a)||(E&&w(a,M,fk,"alignment"),this.xb=a.J(),null!==this.panel&&this.panel.v(),
this.zb("alignment",b,a))}},stretch:{configurable:!0,get:function(){return this.ze},set:function(a){var b=this.ze;b!==a&&(E&&tb(a,N,fk,"stretch"),this.ze=a,null!==this.panel&&this.panel.v(),this.zb("stretch",b,a))}},separatorPadding:{configurable:!0,get:function(){return this.ig},set:function(a){"number"===typeof a?a=new Hc(a):null!==a&&E&&w(a,Hc,fk,"separatorPadding");var b=this.ig;null!==a&&null!==b&&b.A(a)||(null!==a&&(a=a.J()),this.ig=a,null!==this.panel&&this.panel.v(),
this.zb("separatorPadding",b,a))}},separatorStroke:{configurable:!0,get:function(){return this.rp},set:function(a){var b=this.rp;b!==a&&(null!==a&&Wl(a,"RowColumnDefinition.separatorStroke"),a instanceof zl&&a.freeze(),this.rp=a,null!==this.panel&&this.panel.v(),this.zb("separatorStroke",b,a))}},separatorStrokeWidth:{configurable:!0,get:function(){return this.sp},set:function(a){var b=this.sp;b!==a&&(this.sp=a,null!==this.panel&&this.panel.v(),this.zb("separatorStrokeWidth",
b,a))}},separatorDashArray:{configurable:!0,get:function(){return this.Lj},set:function(a){var b=this.Lj;if(b!==a){null===a||Array.isArray(a)||Ba(a,"Array",fk,"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.Lj=a;null!==this.panel&&this.panel.S();this.zb("separatorDashArray",
b,a)}}},background:{configurable:!0,get:function(){return this.jb},set:function(a){var b=this.jb;b!==a&&(null!==a&&Wl(a,"RowColumnDefinition.background"),a instanceof zl&&a.freeze(),this.jb=a,null!==this.panel&&this.panel.S(),this.zb("background",b,a))}},coversSeparators:{configurable:!0,get:function(){return this.mn},set:function(a){var b=this.mn;b!==a&&(z(a,"boolean",fk,"coversSeparators"),this.mn=a,null!==this.panel&&this.panel.S(),this.zb("coversSeparators",b,a))}},
sizing:{configurable:!0,get:function(){return this.wp},set:function(a){var b=this.wp;b!==a&&(E&&tb(a,fk,fk,"sizing"),this.wp=a,null!==this.panel&&this.panel.v(),this.zb("sizing",b,a))}},actual:{configurable:!0,get:function(){return this.ma},set:function(a){this.ma=isNaN(this.Sc)?Math.max(Math.min(this.Zg,a),this.$g):Math.max(Math.min(this.Zg,this.Sc),this.$g)}},total:{configurable:!0,get:function(){return this.ma+this.vc()},set:function(a){this.ma=isNaN(this.Sc)?
Math.max(Math.min(this.Zg,a),this.$g):Math.max(Math.min(this.Zg,this.Sc),this.$g);this.ma=Math.max(0,this.ma-this.vc())}},position:{configurable:!0,get:function(){return this.ua},set:function(a){this.ua=a}}});fk.prototype.bind=fk.prototype.bind;fk.prototype.computeEffectiveSpacing=fk.prototype.vc;fk.prototype.computeEffectiveSpacingTop=fk.prototype.Uu;var An=new D(fk,"Default",0),Nm=new D(fk,"None",1),cn=new D(fk,"ProportionalExtra",2);fk.className="RowColumnDefinition";fk.Default=An;
fk.None=Nm;fk.ProportionalExtra=cn;function Hg(){N.call(this);this.Rd=this.sa=null;this.Zk="None";this.Kn=al;this.Ic=this.$k="black";this.jh=1;this.Nl="butt";this.Ol="miter";this.Nj=10;this.hh=null;this.ih=0;this.gf=this.ff=Qd;this.So=this.Ro=NaN;this.Vn=!1;this.Uo=null;this.cl=this.Ul="None";this.Ed=1;this.Dd=0;this.Bd=1;this.Cd=null}ma(Hg,N);
Hg.prototype.cloneProtected=function(a){N.prototype.cloneProtected.call(this,a);a.sa=this.sa;a.Zk=this.Zk;a.Kn=this.Kn;a.Rd=this.Rd;a.$k=this.$k;a.Ic=this.Ic;a.jh=this.jh;a.Nl=this.Nl;a.Ol=this.Ol;a.Nj=this.Nj;null!==this.hh&&(a.hh=Ma(this.hh));a.ih=this.ih;a.ff=this.ff.J();a.gf=this.gf.J();a.Ro=this.Ro;a.So=this.So;a.Vn=this.Vn;a.Uo=this.Uo;a.Ul=this.Ul;a.cl=this.cl;a.Ed=this.Ed;a.Dd=this.Dd;a.Bd=this.Bd;a.Cd=this.Cd};t=Hg.prototype;
t.hb=function(a){a===nh||a===ph||a===dl||a===al?this.geometryStretch=a:N.prototype.hb.call(this,a)};t.toString=function(){return"Shape("+("None"!==this.figure?this.figure:"None"!==this.toArrow?this.toArrow:this.fromArrow)+")#"+Jb(this)};
function Bn(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,q,r,u=0,x=Qa(),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,q=Math.atan2(h,n),r=Math.sqrt(n*n+h*h),x.push([n,q,p,r]),u+=r,h=l,k=m;h=c[0];k=c[1];n=d.measuredBounds.width;d instanceof Hg&&(n-=d.strokeWidth);1>n&&(n=1);e=c=n;l=g/2;m=0===l?!1:!0;y=0;r=x[y];n=r[0];q=r[1];p=r[2];r=r[3];for(var A=0;.1<=u;){0===A&&(m?(e=c,e-=l,u-=l,m=!1):e=c,0===e&&(e=1));
if(e>u){Ta(x);return}e>r?(A=e-r,e=r):A=0;var C=Math.sqrt(e*e/(1+p*p));0>n&&(C=-C);h+=C;k+=p*C;a.translate(h,k);a.rotate(q);a.translate(-(g/2),-(f/2));0===A&&d.Hi(a,b);a.translate(g/2,f/2);a.rotate(-q);a.translate(-h,-k);u-=e;r-=e;if(0!==A){y++;if(y===x.length){Ta(x);return}r=x[y];n=r[0];q=r[1];p=r[2];r=r[3];e=A}}Ta(x)}}
t.Hi=function(a,b){var c=this.Ic,d=this.$k;if(null!==c||null!==d){var e=this.actualBounds,f=this.naturalBounds;null!==d&&zi(this,a,d,!0,!1,f,e);null!==c&&zi(this,a,c,!1,!1,f,e);e=this.part;f=this.jh;0===f&&null!==e&&(f=e instanceof Cf&&e.type===W.Link&&"Selection"===e.category&&e.adornedObject instanceof Hg&&e.adornedPart.Bb()===e.adornedObject?e.adornedObject.strokeWidth:0);a.lineWidth=f;a.lineJoin=this.Ol;a.lineCap=this.Nl;a.miterLimit=this.Nj;var g=!1;e&&b.He("drawShadows")&&(g=e.isShadowed);var h=
!0;null!==c&&null===d&&(h=!1);e=!1;var k=this.strokeDashArray;null!==k&&(e=!0,a.Us(k,this.ih));var l=this.sa;if(null!==l){if(l.type===pe)a.beginPath(),a.moveTo(l.startX,l.startY),a.lineTo(l.endX,l.endY),null!==d&&a.Vd(d),0!==f&&null!==c&&a.$i();else if(l.type===xe){var m=l.startX,n=l.startY,p=l.endX,q=l.endY;k=Math.min(m,p);l=Math.min(n,q);m=Math.abs(p-m);n=Math.abs(q-n);a.beginPath();a.rect(k,l,m,n);null!==d&&a.Vd(d);if(null!==c){p=d=c=0;h&&g&&(c=a.shadowOffsetX,d=a.shadowOffsetY,p=a.shadowBlur,
a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0);if(0!==f){if(0===m||0===n)a.beginPath(),a.rect(k,l,Math.max(m,.1),Math.max(n,.1));a.$i()}h&&g&&(a.shadowOffsetX=c,a.shadowOffsetY=d,a.shadowBlur=p)}}else if(l.type===ye)n=l.startX,k=l.startY,p=l.endX,q=l.endY,l=Math.abs(p-n)/2,m=Math.abs(q-k)/2,n=Math.min(n,p)+l,k=Math.min(k,q)+m,a.beginPath(),a.moveTo(n,k-m),a.bezierCurveTo(n+K.Cg*l,k-m,n+l,k-K.Cg*m,n+l,k),a.bezierCurveTo(n+l,k+K.Cg*m,n+K.Cg*l,k+m,n,k+m),a.bezierCurveTo(n-K.Cg*l,k+m,n-l,k+K.Cg*
m,n-l,k),a.bezierCurveTo(n-l,k-K.Cg*m,n-K.Cg*l,k-m,n,k-m),a.closePath(),null!==d&&a.Vd(d),0!==f&&null!==c&&(h&&g?(f=a.shadowOffsetX,g=a.shadowOffsetY,c=a.shadowBlur,a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0,a.$i(),a.shadowOffsetX=f,a.shadowOffsetY=g,a.shadowBlur=c):a.$i());else if(l.type===ne)for(k=l.figures,l=k.length,m=0;m<l;m++){n=k.j[m];a.beginPath();a.moveTo(n.startX,n.startY);p=n.segments.j;q=p.length;for(var r=null,u=0;u<q;u++){var x=p[u];switch(x.type){case Ne:a.moveTo(x.endX,x.endY);
break;case ve:a.lineTo(x.endX,x.endY);break;case Oe:a.bezierCurveTo(x.point1X,x.point1Y,x.point2X,x.point2Y,x.endX,x.endY);break;case Pe:a.quadraticCurveTo(x.point1X,x.point1Y,x.endX,x.endY);break;case Qe:if(x.radiusX===x.radiusY){var y=Math.PI/180;a.arc(x.point1X,x.point1Y,x.radiusX,x.startAngle*y,(x.startAngle+x.sweepAngle)*y,0>x.sweepAngle,null!==r?r.endX:n.startX,null!==r?r.endY:n.startY)}else if(r=Se(x,n),y=r.length,0===y)a.lineTo(x.centerX,x.centerY);else for(var A=0;A<y;A++){var C=r[A];0===
A&&a.lineTo(C[0],C[1]);a.bezierCurveTo(C[2],C[3],C[4],C[5],C[6],C[7])}break;case Re:A=y=0;if(null!==r&&r.type===Qe){r=Se(r,n);C=r.length;if(0===C){a.lineTo(x.centerX,x.centerY);break}r=r[C-1]||null;null!==r&&(y=r[6],A=r[7])}else y=null!==r?r.endX:n.startX,A=null!==r?r.endY:n.startY;r=Te(x,n,y,A);y=r.length;if(0===y){a.lineTo(x.centerX,x.centerY);break}for(A=0;A<y;A++)C=r[A],a.bezierCurveTo(C[2],C[3],C[4],C[5],C[6],C[7]);break;default:v("Segment not of valid type: "+x.type)}x.isClosed&&a.closePath();
r=x}g?(u=q=p=0,n.isShadowed?(!0===n.isFilled&&null!==d?(a.Vd(d),h=!0):h=!1,0!==f&&null!==c&&(h&&(p=a.shadowOffsetX,q=a.shadowOffsetY,u=a.shadowBlur,a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0),a.$i(),h&&(a.shadowOffsetX=p,a.shadowOffsetY=q,a.shadowBlur=u))):(h&&(p=a.shadowOffsetX,q=a.shadowOffsetY,u=a.shadowBlur,a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0),!0===n.isFilled&&null!==d&&a.Vd(d),0!==f&&null!==c&&a.$i(),h&&(a.shadowOffsetX=p,a.shadowOffsetY=q,a.shadowBlur=u))):(!0===n.isFilled&&
null!==d&&a.Vd(d),0!==f&&null!==c&&a.$i())}e&&a.Ss();if(null!==this.pathPattern){e=this.pathPattern;e.measure(Infinity,Infinity);f=e.measuredBounds;e.arrange(0,0,f.width,f.height);g=this.geometry;a.save();a.beginPath();f=Qa();if(g.type===pe)f.push(g.startX),f.push(g.startY),f.push(g.endX),f.push(g.endY),Bn(a,b,f,e);else if(g.type===ne)for(g=g.figures.iterator;g.next();){c=g.value;f.length=0;f.push(c.startX);f.push(c.startY);d=c.startX;h=c.startY;k=d;l=h;m=c.segments.j;n=m.length;for(p=0;p<n;p++){q=
m[p];switch(q.type){case Ne:Bn(a,b,f,e);f.length=0;f.push(q.endX);f.push(q.endY);d=q.endX;h=q.endY;k=d;l=h;break;case ve:f.push(q.endX);f.push(q.endY);d=q.endX;h=q.endY;break;case Oe:K.De(d,h,q.point1X,q.point1Y,q.point2X,q.point2Y,q.endX,q.endY,.5,f);d=q.endX;h=q.endY;break;case Pe:K.tq(d,h,q.point1X,q.point1Y,q.endX,q.endY,.5,f);d=q.endX;h=q.endY;break;case Qe:u=Se(q,c);x=u.length;if(0===x){f.push(q.centerX);f.push(q.centerY);d=q.centerX;h=q.centerY;break}for(r=0;r<x;r++)y=u[r],K.De(d,h,y[2],y[3],
y[4],y[5],y[6],y[7],.5,f),d=y[6],h=y[7];break;case Re:u=Te(q,c,d,h);x=u.length;if(0===x){f.push(q.centerX);f.push(q.centerY);d=q.centerX;h=q.centerY;break}for(r=0;r<x;r++)y=u[r],K.De(d,h,y[2],y[3],y[4],y[5],y[6],y[7],.5,f),d=y[6],h=y[7];break;default:v("Segment not of valid type: "+q.type)}q.isClosed&&(f.push(k),f.push(l),Bn(a,b,f,e))}Bn(a,b,f,e)}else if(g.type===xe)f.push(g.startX),f.push(g.startY),f.push(g.endX),f.push(g.startY),f.push(g.endX),f.push(g.endY),f.push(g.startX),f.push(g.endY),f.push(g.startX),
f.push(g.startY),Bn(a,b,f,e);else if(g.type===ye){h=new Xe;h.startX=g.endX;h.startY=(g.startY+g.endY)/2;d=new Ye(Qe);d.startAngle=0;d.sweepAngle=360;d.centerX=(g.startX+g.endX)/2;d.centerY=(g.startY+g.endY)/2;d.radiusX=Math.abs(g.startX-g.endX)/2;d.radiusY=Math.abs(g.startY-g.endY)/2;h.add(d);g=Se(d,h);c=g.length;if(0===c)f.push(d.centerX),f.push(d.centerY);else for(d=h.startX,h=h.startY,k=0;k<c;k++)l=g[k],K.De(d,h,l[2],l[3],l[4],l[5],l[6],l[7],.5,f),d=l[6],h=l[7];Bn(a,b,f,e)}Ta(f);a.restore();a.Uc(!1)}}}};
t.oa=function(a,b){void 0===b&&(b=new J);if(a instanceof M){a.Nb()&&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.td.va(b);return b};
t.eq=function(a){void 0===a&&(a=new L);var b=this.naturalBounds,c=this.td;b=L.allocAt(b.x,b.y,b.width,b.height);var d=this.strokeWidth;b.Xc(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);Mc(a,d.x,d.y,0,0);d.h(b.right,b.bottom).transform(c);Mc(a,d.x,d.y,0,0);d.h(b.x,b.bottom).transform(c);Mc(a,d.x,d.y,0,0);L.free(b);J.free(d);return a};
t.xh=function(a,b){var c=this.geometry;if(null===c||null===this.fill&&null===this.stroke)return!1;var d=c.bounds,e=this.strokeWidth/2;c.type!==pe||b||(e+=2);var f=L.alloc();f.assign(d);f.Xc(e+2,e+2);if(!f.ea(a))return L.free(f),!1;d=e+1E-4;if(c.type===pe){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.Vb(c.startX,c.startY,c.endX,c.endY,e,a.x,a.y)}if(c.type===
xe){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.Xc(-d,-d);if(f.ea(a))return L.free(f),!1;f.Xc(d,d)}null!==this.stroke&&f.Xc(e,e);a=f.ea(a);L.free(f);return a}if(c.type===ye){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===ne)return L.free(f),null===this.fill?Ve(c,a.x,a.y,e):c.ea(a,e,1<this.strokeWidth,b);v("Unknown Geometry type: "+c.type);return!1};
t.mm=function(a,b,c,d){var e=this.desiredSize,f=this.jh;a=Math.max(a,0);b=Math.max(b,0);if(null!==this.Rd)var g=this.geometry.bounds;else{var h=this.figure,k=Gn[h];if(void 0===k){var l=K.be[h];"string"===typeof l&&(l=K.be[l]);"function"===typeof l?(k=l(null,100,100),Gn[h]=k):v("Unsupported Figure: "+h)}g=k.bounds}h=g.width;k=g.height;l=g.width;var m=g.height;switch(ql(this,!0)){case nh:d=c=0;break;case oe:l=Math.max(a-f,0);m=Math.max(b-f,0);break;case bl:l=Math.max(a-f,0);d=0;break;case cl: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=oh(this);switch(c){case nh:break;case oe:h=l;k=m;break;case ph: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.Rd?(h=Math.max(h,.01),k=Math.max(k,
.01),g=null!==this.Rd?this.Rd:this.sa,e=h,d=k,c=g.copy(),g=g.bounds,e/=g.width,d/=g.height,isFinite(e)||(e=1),isFinite(d)||(d=1),1===e&&1===d||c.scale(e,d),E&&c.freeze(),this.sa=c):null!==this.sa&&K.da(this.sa.jl,a-f)&&K.da(this.sa.hl,b-f)||(this.sa=Hg.makeGeometry(this,h,k));g=this.sa.bounds;Infinity===a||Infinity===b?nl(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):nl(this,-(f/2),-(f/2),l+f,m+f)};
function oh(a){var b=a.geometryStretch;return null!==a.Rd?b===al?oe:b:b===al?Gn[a.figure].defaultStretch:b}t.vh=function(a,b,c,d){sl(this,a,b,c,d)};t.Wc=function(a,b,c){return this.fk(a.x,a.y,b.x,b.y,c)};
t.fk=function(a,b,c,d,e){var f=this.transform,g=1/(f.m11*f.m22-f.m12*f.m21),h=f.m22*g,k=-f.m12*g,l=-f.m21*g,m=f.m11*g,n=g*(f.m21*f.dy-f.m22*f.dx),p=g*(f.m12*f.dx-f.m11*f.dy);f=a*h+b*l+n;g=a*k+b*m+p;h=c*h+d*l+n;k=c*k+d*m+p;n=this.jh/2;l=this.sa;null===l&&(this.measure(Infinity,Infinity),l=this.sa);p=l.bounds;m=!1;if(l.type===pe)if(1.5>=this.strokeWidth)m=K.Je(l.startX,l.startY,l.endX,l.endY,f,g,h,k,e);else{l.startX===l.endX?(d=n,m=0):(b=(l.endY-l.startY)/(l.endX-l.startX),m=n/Math.sqrt(1+b*b),d=m*
b);b=Qa();a=new J;K.Je(l.startX+d,l.startY+m,l.endX+d,l.endY+m,f,g,h,k,a)&&b.push(a);a=new J;K.Je(l.startX-d,l.startY-m,l.endX-d,l.endY-m,f,g,h,k,a)&&b.push(a);a=new J;K.Je(l.startX+d,l.startY+m,l.startX-d,l.startY-m,f,g,h,k,a)&&b.push(a);a=new J;K.Je(l.endX+d,l.endY+m,l.endX-d,l.endY-m,f,g,h,k,a)&&b.push(a);h=b.length;if(0===h)return Ta(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);Ta(b)}else if(l.type===xe)m=K.Wc(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===ye){b=L.allocAt(p.x,p.y,p.width,p.height).Xc(n,n);a:if(0===b.width)m=K.Je(b.x,b.y,b.x,b.y+b.height,f,g,h,k,e);else if(0===b.height)m=K.Je(b.x,b.y,b.x+b.width,b.y,f,g,h,k,e);else{a=b.width/2;l=b.height/2;d=b.x+a;m=b.y+l;c=9999;f!==h&&(c=(g-k)/(f-h));if(9999>Math.abs(c)){k=g-m-c*(f-d);if(0>a*a*c*c+l*l-k*k){e.x=NaN;e.y=NaN;m=!1;break a}n=Math.sqrt(a*a*c*c+l*l-k*k);h=(-(a*a*c*k)+a*l*n)/(l*l+a*a*c*c)+d;a=(-(a*a*c*k)-a*l*n)/(l*l+a*a*c*c)+d;l=c*(h-d)+k+m;k=c*
(a-d)+k+m;Math.abs((f-h)*(f-h))+Math.abs((g-l)*(g-l))<Math.abs((f-a)*(f-a))+Math.abs((g-k)*(g-k))?(e.x=h,e.y=l):(e.x=a,e.y=k)}else{h=l*l;k=f-d;h-=h/(a*a)*k*k;if(0>h){e.x=NaN;e.y=NaN;m=!1;break a}k=Math.sqrt(h);h=m+k;k=m-k;Math.abs(h-g)<Math.abs(k-g)?(e.x=f,e.y=h):(e.x=f,e.y=k)}m=!0}L.free(b)}else if(l.type===ne){p=J.alloc();var q=h-f;var r=k-g;var u=q*q+r*r;e.x=h;e.y=k;for(var x=0;x<l.figures.count;x++){var y=l.figures.j[x],A=y.segments;q=y.startX;r=y.startY;for(var C=q,G=r,I=0;I<A.count;I++){var O=
A.j[I],R=O.type;var Q=O.endX;var ea=O.endY;var Z=!1;switch(R){case Ne:C=Q;G=ea;break;case ve:Z=Hn(q,r,Q,ea,f,g,h,k,p);break;case Oe:Z=K.Tp(q,r,O.point1X,O.point1Y,O.point2X,O.point2Y,Q,ea,f,g,h,k,.6,p);break;case Pe:Z=K.Tp(q,r,(q+2*O.point1X)/3,(r+2*O.point1Y)/3,(2*O.point1X+Q)/3,(2*O.point1X+Q)/3,Q,ea,f,g,h,k,.6,p);break;case Qe:case Re:R=O.type===Qe?Se(O,y):Te(O,y,q,r);var qa=R.length;if(0===qa){Z=Hn(q,r,O.centerX,O.centerY,f,g,h,k,p);break}ea=null;for(Q=0;Q<qa;Q++){ea=R[Q];if(0===Q&&Hn(q,r,ea[0],
ea[1],f,g,h,k,p)){var xa=In(f,g,p,u,e);xa<u&&(u=xa,m=!0)}K.Tp(ea[0],ea[1],ea[2],ea[3],ea[4],ea[5],ea[6],ea[7],f,g,h,k,.6,p)&&(xa=In(f,g,p,u,e),xa<u&&(u=xa,m=!0))}Q=ea[6];ea=ea[7];break;default:v("Unknown Segment type: "+R)}q=Q;r=ea;Z&&(Z=In(f,g,p,u,e),Z<u&&(u=Z,m=!0));O.isClosed&&(Q=C,ea=G,Hn(q,r,Q,ea,f,g,h,k,p)&&(O=In(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.va(e);
return!0};function In(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 Hn(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.da(k.y,a))&&(k.y<b||K.da(k.y,b))&&(l=!0)):(b=a<c?a:c,a=a<c?c:a,(k.x>b||K.da(k.x,b))&&(k.x<a||K.da(k.x,a))&&(l=!0));return l}
t.wh=function(a,b){if(void 0===b)return a.qf(this.actualBounds);var c=this.sa;null===c&&(this.measure(Infinity,Infinity),c=this.sa);c=c.bounds;var d=this.strokeWidth/2,e=!1,f=J.alloc();f.h(c.x-d,c.y-d);a.ea(b.va(f))&&(f.h(c.x-d,c.bottom+d),a.ea(b.va(f))&&(f.h(c.right+d,c.bottom+d),a.ea(b.va(f))&&(f.h(c.right+d,c.y-d),a.ea(b.va(f))&&(e=!0))));J.free(f);return e};
t.Kc=function(a,b){if(this.wh(a,b)||void 0===b&&(b=this.transform,a.qf(this.actualBounds)))return!0;var c=$b.alloc();c.set(b);c.gt();var d=a.left,e=a.right,f=a.top;a=a.bottom;var g=J.alloc();g.h(d,f);c.va(g);if(this.xh(g,!0))return J.free(g),!0;g.h(e,f);c.va(g);if(this.xh(g,!0))return J.free(g),!0;g.h(d,a);c.va(g);if(this.xh(g,!0))return J.free(g),!0;g.h(e,a);c.va(g);if(this.xh(g,!0))return J.free(g),!0;var h=J.alloc(),k=J.alloc();c.set(b);c.vv(this.transform);c.gt();h.x=e;h.y=f;h.transform(c);g.x=
d;g.y=f;g.transform(c);b=!1;Jn(this,g,h,k)?b=!0:(g.x=e,g.y=a,g.transform(c),Jn(this,g,h,k)?b=!0:(h.x=d,h.y=a,h.transform(c),Jn(this,g,h,k)?b=!0:(g.x=d,g.y=f,g.transform(c),Jn(this,g,h,k)&&(b=!0))));J.free(g);$b.free(c);J.free(h);J.free(k);return b};function Jn(a,b,c,d){if(!a.Wc(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.ox=function(a,b,c){function d(a,b){for(var c=a.length,d=0;d<c;d+=2)if(b.ed(a[d],a[d+1])>e)return!0;return!1}if(c&&null!==this.fill&&this.xh(a,!0))return!0;var e=a.Fe(b),f=e;1.5<this.strokeWidth&&(e=this.strokeWidth/2+Math.sqrt(e),e*=e);b=this.sa;if(null===b&&(this.measure(Infinity,Infinity),b=this.sa,null===b))return!1;if(!c){var g=b.bounds,h=g.x,k=g.y,l=g.x+g.width;g=g.y+g.height;if(dc(a.x,a.y,h,k)<=e&&dc(a.x,a.y,l,k)<=e&&dc(a.x,a.y,h,g)<=e&&dc(a.x,a.y,l,g)<=e)return!0}h=b.startX;k=b.startY;l=
b.endX;g=b.endY;if(b.type===pe){if(c=cc(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===xe)return b=!1,c&&(b=cc(a.x,a.y,h,k,h,g)<=e||cc(a.x,a.y,h,k,l,k)<=e||cc(a.x,a.y,l,k,l,g)<=e||cc(a.x,a.y,h,g,l,g)<=e),b;if(b.type===ye){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 cc(a.x,a.y,h,k,l,g)<=e?!0:!1;if(c){if(a=K.Jy(m,n,b,f),a*a<=e)return!0}else return dc(b,f,-m,0)>=e||dc(b,f,0,-n)>=e||
dc(b,f,0,n)>=e||dc(b,f,m,0)>=e?!1:!0}else if(b.type===ne){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&&cc(a.x,a.y,f,h,f,l)>e&&cc(a.x,a.y,f,h,k,h)>e&&cc(a.x,a.y,k,l,f,l)>e&&cc(a.x,a.y,k,l,k,h)>e)return!1;f=Math.sqrt(e);if(c){if(null===this.fill?Ve(b,a.x,a.y,f):b.ea(a,f,!0))return!0}else{c=b.figures;for(b=0;b<c.count;b++){f=c.j[b];g=f.startX;m=f.startY;if(a.ed(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 Ne:case ve:g=n.endX;
m=n.endY;if(a.ed(g,m)>e)return!1;break;case Oe:var p=Qa();K.De(g,m,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.8,p);g=d(p,a);Ta(p);if(g)return!1;g=n.endX;m=n.endY;if(a.ed(g,m)>e)return!1;break;case Pe:p=Qa();K.tq(g,m,n.point1X,n.point1Y,n.endX,n.endY,.8,p);g=d(p,a);Ta(p);if(g)return!1;g=n.endX;m=n.endY;if(a.ed(g,m)>e)return!1;break;case Qe:case Re:p=n.type===Qe?Se(n,f):Te(n,f,g,m);var q=p.length;if(0===q){g=n.centerX;m=n.centerY;if(a.ed(g,m)>e)return!1;break}n=null;for(var r=Qa(),u=0;u<
q;u++)if(n=p[u],r.length=0,K.De(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],.8,r),d(r,a))return Ta(r),!1;Ta(r);null!==n&&(g=n[6],m=n[7]);break;default:v("Unknown Segment type: "+n.type)}}return!0}}}return!1};t.cc=function(){this.sa=null};function Kn(a){var b=a.diagram;null!==b&&b.undoManager.isUndoingRedoing||(a.segmentOrientation=Ln,"None"!==a.Ul?(a.segmentIndex=-1,a.alignmentFocus=Xd):"None"!==a.cl&&(a.segmentIndex=0,a.alignmentFocus=new M(1-Xd.x,Xd.y)))}
Hg.makeGeometry=function(a,b,c){if("None"!==a.toArrow)var d=Mn[a.toArrow];else"None"!==a.fromArrow?d=Mn[a.fromArrow]:(d=K.be[a.figure],"string"===typeof d&&(d=K.be[d]),void 0===d&&v("Unknown Shape.figure: "+a.figure),d=d(a,b,c),d.jl=b,d.hl=c);if(null===d){var e=K.be.Rectangle;"function"===typeof e&&(d=e(a,b,c))}E&&(d.bounds.width>b+1E-5||d.bounds.height>c+1E-5)&&v("Geometry made with figure"+a.figure+"has bounds that are too large for its given size. See documentation for Shape.defineFigureGenerator.");
return d};function Nn(a){var b=Mn[a];if(void 0===b){var c=a.toLowerCase();if("none"===c)return"None";b=Mn[c];if(void 0===b){var d=null,e;for(e in K.Gm)if(e.toLowerCase()===c){d=e;break}if(null!==d)return a=ze(K.Gm[d],!1),Mn[d]=a,c!==d&&(Mn[c]=d),d}}return"string"===typeof b?b:b instanceof me?a:null}
na.Object.defineProperties(Hg.prototype,{geometry:{configurable:!0,get:function(){return null!==this.sa?this.sa:this.Rd},set:function(a){var b=this.sa;if(b!==a){null!==a?(E&&w(a,me,Hg,"geometry"),this.Rd=this.sa=a.freeze()):this.Rd=this.sa=null;var c=this.part;null!==c&&(c.Yg=NaN);this.v();this.g("geometry",b,a);kl(this)&&(a=this.part,null!==a&&ll(this,a,"geometryString"))}}},geometryString:{configurable:!0,get:function(){return null===this.geometry?"":this.geometry.toString()},
set:function(a){a=ze(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.Vn},set:function(a){E&&z(a,"boolean",Hg,"isGeometryPositioned");var b=this.Vn;b!==a&&(this.Vn=a,this.v(),this.g("isGeometryPositioned",b,a))}},fill:{configurable:!0,get:function(){return this.$k},set:function(a){var b=this.$k;b!==a&&(null!==a&&Wl(a,"Shape.fill"),a instanceof zl&&a.freeze(),this.$k=
a,this.S(),this.g("fill",b,a))}},stroke:{configurable:!0,get:function(){return this.Ic},set:function(a){var b=this.Ic;b!==a&&(null!==a&&Wl(a,"Shape.stroke"),a instanceof zl&&a.freeze(),this.Ic=a,this.S(),this.g("stroke",b,a))}},strokeWidth:{configurable:!0,get:function(){return this.jh},set:function(a){var b=this.jh;if(b!==a)if(E&&B(a,Hg,"strokeWidth"),0<=a){this.jh=a;this.v();var c=this.part;null!==c&&(c.Yg=NaN);this.g("strokeWidth",b,a)}else Ca(a,"value >= 0",Hg,"strokeWidth:value")}},
strokeCap:{configurable:!0,get:function(){return this.Nl},set:function(a){var b=this.Nl;b!==a&&("string"!==typeof a||"butt"!==a&&"round"!==a&&"square"!==a?Ca(a,'"butt", "round", or "square"',Hg,"strokeCap"):(this.Nl=a,this.S(),this.g("strokeCap",b,a)))}},strokeJoin:{configurable:!0,get:function(){return this.Ol},set:function(a){var b=this.Ol;b!==a&&("string"!==typeof a||"miter"!==a&&"bevel"!==a&&"round"!==a?Ca(a,'"miter", "bevel", or "round"',Hg,"strokeJoin"):(this.Ol=
a,this.S(),this.g("strokeJoin",b,a)))}},strokeMiterLimit:{configurable:!0,get:function(){return this.Nj},set:function(a){var b=this.Nj;if(b!==a)if(E&&B(a,Hg,"strokeMiterLimit"),1<=a){this.Nj=a;this.S();var c=this.part;null!==c&&(c.Yg=NaN);this.g("strokeMiterLimit",b,a)}else E&&Ca(a,"value >= 1",Hg,"strokeWidth:value")}},strokeDashArray:{configurable:!0,get:function(){return this.hh},set:function(a){var b=this.hh;if(b!==a){null===a||Array.isArray(a)||Ba(a,"Array",Hg,"strokeDashArray:value");
if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];(!E||"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.hh=a;this.S();this.g("strokeDashArray",b,a)}}},strokeDashOffset:{configurable:!0,get:function(){return this.ih},set:function(a){var b=this.ih;b!==a&&(E&&B(a,Hg,"strokeDashOffset"),0<=a&&(this.ih=a,this.S(),this.g("strokeDashOffset",b,a)))}},figure:{configurable:!0,
enumerable:!0,get:function(){return this.Zk},set:function(a){var b=this.Zk;if(b!==a){E&&z(a,"string",Hg,"figure");var c=K.be[a];"function"===typeof c?c=a:(c=K.be[a.toLowerCase()])||v("Unknown Shape.figure: "+a);b!==c&&(a=this.part,null!==a&&(a.Yg=NaN),this.Zk=c,this.Rd=null,this.cc(),this.v(),this.g("figure",b,c))}}},toArrow:{configurable:!0,get:function(){return this.Ul},set:function(a){var b=this.Ul;!0===a?a="Standard":!1===a&&(a="");if(b!==a){E&&z(a,"string",Hg,"toArrow");var c=Nn(a);
null===c?v("Unknown Shape.toArrow: "+a):b!==c&&(this.Ul=c,this.Rd=null,this.cc(),this.v(),Kn(this),this.g("toArrow",b,c))}}},fromArrow:{configurable:!0,get:function(){return this.cl},set:function(a){var b=this.cl;!0===a?a="Standard":!1===a&&(a="");if(b!==a){E&&z(a,"string",Hg,"fromArrow");var c=Nn(a);null===c?v("Unknown Shape.fromArrow: "+a):b!==c&&(this.cl=c,this.Rd=null,this.cc(),this.v(),Kn(this),this.g("fromArrow",b,c))}}},spot1:{configurable:!0,get:function(){return this.ff},
set:function(a){w(a,M,Hg,"spot1");var b=this.ff;b.A(a)||(this.ff=a=a.J(),this.v(),this.g("spot1",b,a))}},spot2:{configurable:!0,get:function(){return this.gf},set:function(a){w(a,M,Hg,"spot2");var b=this.gf;b.A(a)||(this.gf=a=a.J(),this.v(),this.g("spot2",b,a))}},parameter1:{configurable:!0,get:function(){return this.Ro},set:function(a){var b=this.Ro;b!==a&&(this.Ro=a,this.cc(),this.v(),this.g("parameter1",b,a))}},parameter2:{configurable:!0,get:function(){return this.So},
set:function(a){var b=this.So;b!==a&&(this.So=a,this.cc(),this.v(),this.g("parameter2",b,a))}},naturalBounds:{configurable:!0,get:function(){if(null!==this.sa)return this.rc.assign(this.sa.bounds),this.rc;var a=this.desiredSize;return new L(0,0,a.width,a.height)}},pathPattern:{configurable:!0,get:function(){return this.Uo},set:function(a){var b=this.Uo;b!==a&&(E&&null!==a&&w(a,N,Hg,"pathPattern"),this.Uo=a,this.S(),this.g("pathPattern",b,a))}},geometryStretch:{configurable:!0,
enumerable:!0,get:function(){return this.Kn},set:function(a){var b=this.Kn;b!==a&&(tb(a,N,Hg,"geometryStretch"),this.Kn=a,this.g("geometryStretch",b,a))}},interval:{configurable:!0,get:function(){return this.Ed},set:function(a){var b=this.Ed;E&&B(a,Hg,"interval");a=Math.floor(a);if(b!==a&&0<=a){this.Ed=a;var c=this.diagram;null!==c&&this.panel===c.grid&&Aj(c);this.v();c=this.panel;null!==c&&(c.Rg=null);this.g("interval",b,a)}}},graduatedStart:{configurable:!0,get:function(){return this.Dd},
set:function(a){var b=this.Dd;E&&B(a,Hg,"graduatedStart");b!==a&&(0>a?a=0:1<a&&(a=1),this.Dd=a,this.v(),this.g("graduatedStart",b,a))}},graduatedEnd:{configurable:!0,get:function(){return this.Bd},set:function(a){var b=this.Bd;E&&B(a,Hg,"graduatedEnd");b!==a&&(0>a?a=0:1<a&&(a=1),this.Bd=a,this.v(),this.g("graduatedEnd",b,a))}},graduatedSkip:{configurable:!0,get:function(){return this.Cd},set:function(a){var b=this.Cd;b!==a&&(null!==a&&z(a,"function",Hg,"graduatedSkip"),
this.Cd=a,this.v(),this.g("graduatedSkip",b,a))}}});Hg.prototype.intersectsRect=Hg.prototype.Kc;Hg.prototype.containedInRect=Hg.prototype.wh;Hg.prototype.getNearestIntersectionPoint=Hg.prototype.Wc;Hg.prototype.getDocumentBounds=Hg.prototype.eq;Hg.prototype.getDocumentPoint=Hg.prototype.oa;var Mn=new xb,Gn=new xb;Hg.className="Shape";Hg.getFigureGenerators=function(){var a=new Ub,b;for(b in K.be)b!==b.toLowerCase()&&a.add(b,K.be[b]);a.freeze();return a};
Hg.defineFigureGenerator=function(a,b){z(a,"string",Hg,"defineFigureGenerator:name");"string"===typeof b?!E||""!==b&&K.be[b]||v("Shape.defineFigureGenerator synonym must not be empty or None or not a defined figure name: "+b):z(b,"function",Hg,"defineFigureGenerator:func");var c=a.toLowerCase();!E||""!==a&&a!==c||v("Shape.defineFigureGenerator name must not be empty or all-lower-case: "+a);var d=K.be;d[a]=b;d[c]=a};
Hg.getArrowheadGeometries=function(){var a=new Ub;for(d in K.Gm)if(void 0===Mn[d]){var b=ze(K.Gm[d],!1);Mn[d]=b;b=d.toLowerCase();b!==d&&(Mn[b]=d)}for(var c in Mn)if(c!==c.toLowerCase()){var d=Mn[c];d instanceof me&&a.add(c,d)}a.freeze();return a};
Hg.defineArrowheadGeometry=function(a,b){z(a,"string",Hg,"defineArrowheadGeometry:name");"string"===typeof b?(z(b,"string",Hg,"defineArrowheadGeometry:pathstr"),b=ze(b,!1)):w(b,me,Hg,"defineArrowheadGeometry:pathstr");var c=a.toLowerCase();(E&&""===a||"none"===c||a===c)&&v("Shape.defineArrowheadGeometry name must not be empty or None or all-lower-case: "+a);var d=Mn;d[a]=b;d[c]=a};
function Kh(){N.call(this);On||(Pn(),On=!0);this.Rb="";this.Ic="black";this.ie="13px sans-serif";this.yi="start";this.Ad=nh;this.Di=Td;this.rj=!0;this.fi=this.gi=!1;this.cg=Qn;this.og=Rn;this.Wr=this.pc=0;this.nu=this.ou=null;this.pd=new an;this.En=!1;this.Ec=this.an=this.Ep=this.zi=this.Fp=null;this.ef=this.df=0;this.qe=Infinity;this.ol=0;this.Ed=1;this.Dd=0;this.Bd=1;this.Cd=this.mj=null}ma(Kh,N);
Kh.prototype.cloneProtected=function(a){N.prototype.cloneProtected.call(this,a);a.Rb=this.Rb;a.Ic=this.Ic;a.ie=this.ie;a.yi=this.yi;a.Ad=this.Ad;a.Di=this.Di;a.rj=this.rj;a.gi=this.gi;a.fi=this.fi;a.cg=this.cg;a.og=this.og;a.pc=this.pc;a.Wr=this.Wr;a.ou=this.ou;a.nu=this.nu;a.pd.$l(this.pd);a.En=this.En;a.Fp=this.Fp;a.zi=this.zi;a.Ep=this.Ep;a.an=this.an;a.Ec=this.Ec;a.df=this.df;a.ef=this.ef;a.qe=this.qe;a.ol=this.ol;a.Ed=this.Ed;a.Dd=this.Dd;a.Bd=this.Bd;a.mj=this.mj;a.Cd=this.Cd};
function $m(a,b){a.I=b.I|6144;a.mb=b.opacity;a.jb=b.background;a.fc=b.areaBackground;a.Qc=b.desiredSize.J();a.Uf=b.minSize.J();a.Tf=b.maxSize.J();a.Sf=b.Sf.copy();a.Da=b.scale;a.Bc=b.angle;a.ze=b.stretch;a.Xg=b.margin.J();a.xb=b.alignment.J();a.Ck=b.alignmentFocus.J();a.Dl=b.segmentFraction;a.El=b.segmentOffset.J();a.Fl=b.segmentOrientation;null!==b.md&&(a.md=b.md.copy());a.Hl=b.shadowVisible;b instanceof Kh&&(a.Rb=b.Rb,a.Ic=b.Ic,a.ie=b.ie,a.yi=b.yi,a.Ad=b.Ad,a.Di=b.Di,a.rj=b.rj,a.gi=b.gi,a.fi=b.fi,
a.cg=b.cg,a.og=b.og,a.pd.Lf=null,a.df=b.df,a.ef=b.ef,a.qe=b.qe,a.ol=b.ol,a.Ed=b.Ed,a.Dd=b.Dd,a.Bd=b.Bd,a.mj=b.mj,a.Cd=b.Cd)}t=Kh.prototype;t.hb=function(a){a.classType===Kh?this.wrap=a:N.prototype.hb.call(this,a)};t.toString=function(){return 22<this.Rb.length?'TextBlock("'+this.Rb.substring(0,20)+'"...)':'TextBlock("'+this.Rb+'")'};t.v=function(){N.prototype.v.call(this);this.nu=this.ou=null};
function Sn(a){On||(Pn(),On=!0);if(null===Tn)return!0;var b=Tn.font;if(a===b||"10px sans-serif"===a)return!0;Tn.font="10px sans-serif";Tn.font=a;var c=Tn.font;if("10px sans-serif"!==c)return Tn.font=b,!0;Tn.font="19px serif";var d=Tn.font;Tn.font=a;c=Tn.font;Tn.font=b;return c!==d}
t.Hi=function(a,b){if(null!==this.Ic&&0!==this.Rb.length&&null!==this.ie){var c=this.naturalBounds,d=this.actualBounds,e=c.width,f=c.height,g=Un(this),h=a.textAlign=this.yi,k=b.Xn;"start"===h?h=k?"right":"left":"end"===h&&(h=k?"left":"right");k=this.gi;var l=this.fi;zi(this,a,this.Ic,!0,!1,c,d);(k||l)&&zi(this,a,this.Ic,!1,!1,c,d);d=0;c=!1;var m=J.allocAt(0,0);this.td.va(m);var n=J.allocAt(0,g);this.td.va(n);var p=m.Fe(n);J.free(m);J.free(n);m=b.scale;8>p*m*m&&(c=!0);b.$c!==a&&(c=!1);!1===b.He("textGreeking")&&
(c=!1);b=this.df;p=this.ef;switch(this.flip){case fl:a.translate(e,0);a.scale(-1,1);break;case el:a.translate(0,f);a.scale(1,-1);break;case gl:a.translate(e,f),a.scale(-1,-1)}m=this.pc;n=(b+g+p)*m;f>n&&(d=this.Di,d=d.y*f-d.y*n+d.offsetY);n=this.pd;for(var q=0;q<m;q++){var r=n.Yc[q];r>e&&(r=e);d+=b;var u=n.Cc[q],x=a,y=d,A=h,C=0;if(c)"left"===A?C=0:"right"===A?C=e-r:"center"===A&&(C=(e-r)/2),x.fillRect(0+C,y+.25*g,r,1);else{"left"===A?C=0:"right"===A?C=e:"center"===A&&(C=e/2);var G=null!==Vn?Vn(this,
g):.75*g;x.fillText(u,0+C,y+G);u=g/20|0;0===u&&(u=1);"right"===A?C-=r:"center"===A&&(C-=r/2);k&&(A=null!==Wn?Wn(this,g):.8*g,x.beginPath(),x.lineWidth=u,x.moveTo(0+C,y+A),x.lineTo(0+C+r,y+A),x.stroke());l&&(x.beginPath(),x.lineWidth=u,y=y+g-g/2.2|0,0!==u%2&&(y+=.5),x.moveTo(0+C,y),x.lineTo(0+C+r,y),x.stroke())}d+=g+p}switch(this.flip){case fl:a.scale(-1,1);a.translate(-e,0);break;case el:a.scale(1,-1);a.translate(0,-f);break;case gl:a.scale(-1,-1),a.translate(-e,-f)}}};
t.mm=function(a,b,c,d){this.ol=a;var e=this.ie;null!==Tn&&Xn!==e&&(Xn=Tn.font=e);e=this.pd;e.reset();var f;if(isNaN(this.desiredSize.width)){var g=this.Rb.replace(/\r\n/g,"\n").replace(/\r/g,"\n");if(0===g.length)g=0;else if(this.isMultiline){for(var h=f=0,k=!1;!k;){var l=g.indexOf("\n",h);-1===l&&(l=g.length,k=!0);f=Math.max(f,Yn(g.substr(h,l-h).trim()));h=l+1}g=f}else f=g.indexOf("\n",0),0<=f&&(g=g.substr(0,f)),g=Yn(g);g=Math.min(g,a/this.scale);g=Math.max(8,g)}else g=this.desiredSize.width;null!==
this.panel&&(g=Math.min(g,this.panel.maxSize.width));f=Zn(this,g,e);isNaN(this.desiredSize.height)?f=Math.min(f,b/this.scale):f=this.desiredSize.height;h=f;if(0!==e.Gc&&1!==e.Cc.length&&this.cg===$n&&(b=this.ie,b=this.cg===$n?ao(b):0,k=this.df+this.ef,k=Math.max(0,Un(this)+k),h=Math.min(this.maxLines-1,Math.max(Math.floor(h/k+.01)-1,0)),!(h+1>=e.Cc.length))){k=e.Cc[h];for(b=Math.max(1,a-b);Yn(k)>b&&1<k.length;)k=k.substr(0,k.length-1);k+=bo;b=Yn(k);e.Cc[h]=k;e.Cc=e.Cc.slice(0,h+1);e.Yc[h]=b;e.Yc=
e.Yc.slice(0,h+1);e.ng=e.Cc.length;e.Gc=Math.max(e.Gc,b);this.pc=e.ng}if(this.wrap===co||isNaN(this.desiredSize.width))g=isNaN(a)?e.Gc:Math.min(a,e.Gc),isNaN(this.desiredSize.width)&&(g=Math.max(8,g));g=Math.max(c,g);f=Math.max(d,f);Cc(this.rc,g,f);nl(this,0,0,g,f)};t.vh=function(a,b,c,d){sl(this,a,b,c,d)};
function eo(a,b,c,d,e){b=b.trim();var f=0;var g=a.ie;var h=a.df+a.ef;h=Math.max(0,Un(a)+h);var k=a.cg===$n?ao(g):0;if(a.pc>=a.qe)null!==e&&e.h(0,h);else{var l=b;if(a.og===fo)if(c.ng=1,g=Yn(b),0===k||g<=d)c.Gc=Math.max(c.Gc,g),c.Yc.push(c.Gc),c.Cc.push(b),null!==e&&e.h(g,h);else{f=go(a,l);l=l.substr(f.length);b=go(a,l);for(g=Yn(f+b);0<b.length&&g<=d;)f+=b,l=l.substr(b.length),b=go(a,l),g=Yn((f+b).trim());f+=b.trim();for(d=Math.max(1,d-k);Yn(f)>d&&1<f.length;)f=f.substr(0,f.length-1);f+=bo;b=Yn(f);
c.Yc.push(b);c.Gc=b;c.Cc.push(f);null!==e&&e.h(b,h)}else{k=0;0===l.length&&(k=1,c.Yc.push(0),c.Cc.push(l));for(;0<l.length;){var m=go(a,l);for(l=l.substr(m.length);Yn(m)>d;){var n=1;g=Yn(m.substr(0,n));for(b=0;g<=d;)n++,b=g,g=Yn(m.substr(0,n));1===n?(c.Yc[a.pc+k]=g,f=Math.max(f,g)):(c.Yc[a.pc+k]=b,f=Math.max(f,b));n--;1>n&&(n=1);c.Cc[a.pc+k]=m.substr(0,n);k++;m=m.substr(n);if(a.pc+k>a.qe)break}b=go(a,l);for(g=Yn(m+b);0<b.length&&g<=d;)m+=b,l=l.substr(b.length),b=go(a,l),g=Yn((m+b).trim());m=m.trim();
if(""!==m&&("\u00ad"===m[m.length-1]&&(m=m.substring(0,m.length-1)+"\u2010"),0===b.length?(c.Yc.push(g),f=Math.max(f,g)):(b=Yn(m),c.Yc.push(b),f=Math.max(f,b)),c.Cc.push(m),k++,a.pc+k>a.qe))break}c.ng=Math.min(a.qe,k);c.Gc=Math.max(c.Gc,f);null!==e&&e.h(c.Gc,h*c.ng)}}}function go(a,b){if(a.og===ho)return b.substr(0,1);a=b.length;for(var c=0,d=io;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 Yn(a){return null===Tn?8*a.length:Tn.measureText(a).width}function Un(a){if(null!==a.pd.Lf)return a.pd.Lf;var b=a.ie;if(null===Tn){var c=16;return a.pd.Lf=c}void 0!==jo[b]&&5E3>ko?c=jo[b]:(c=1.3*Tn.measureText("M").width,jo[b]=c,ko++);return a.pd.Lf=c}function ao(a){if(null===Tn)return 6;if(void 0!==lo[a]&&5E3>mo)var b=lo[a];else b=Tn.measureText(bo).width,lo[a]=b,mo++;return b}
function Zn(a,b,c){var d=a.Rb.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),e=a.df+a.ef;e=Math.max(0,Un(a)+e);if(0===d.length)return c.Gc=0,a.pc=1,e;if(!a.isMultiline){var f=d.indexOf("\n",0);0<=f&&(d=d.substr(0,f))}f=0;for(var g=a.pc=0,h,k=!1;!k;){h=d.indexOf("\n",g);-1===h&&(h=d.length,k=!0);if(g<=h){g=d.substr(g,h-g);if(a.og!==fo){c.ng=0;var l=Zb.alloc();eo(a,g,c,b,l);f+=l.height;Zb.free(l);a.pc+=c.ng}else eo(a,g,c,b,null),f+=e,a.pc++;a.pc===a.qe&&(k=!0)}g=h+1}return a.Wr=f}
function Pn(){io=/[ \u200b\u00ad]/;jo=new xb;lo=new xb;Tn=Ih?(new Jk(null)).context:null}
na.Object.defineProperties(Kh.prototype,{font:{configurable:!0,get:function(){return this.ie},set:function(a){var b=this.ie;b!==a&&(E&&(z(a,"string",Kh,"font"),Sn(a)||v('Not a valid font: "'+a+'"')),this.ie=a,this.pd.Lf=null,this.v(),this.g("font",b,a))}},text:{configurable:!0,get:function(){return this.Rb},set:function(a){var b=this.Rb;null!==a&&void 0!==a?a=a.toString():a="";b!==a&&(this.Rb=a,this.v(),this.g("text",b,a))}},textAlign:{configurable:!0,get:function(){return this.yi},
set:function(a){var b=this.yi;b!==a&&(E&&z(a,"string",Kh,"textAlign"),"start"===a||"end"===a||"left"===a||"right"===a||"center"===a?(this.yi=a,this.S(),this.g("textAlign",b,a)):E&&Ca(a,'"start", "end", "left", "right", or "center"',Kh,"textAlign"))}},flip:{configurable:!0,get:function(){return this.Ad},set:function(a){var b=this.Ad;b!==a&&(tb(a,N,Kh,"flip"),this.Ad=a,this.S(),this.g("flip",b,a))}},verticalAlignment:{configurable:!0,get:function(){return this.Di},set:function(a){var b=
this.Di;b.A(a)||(E&&(w(a,M,Kh,"verticalAlignment"),a.Nb()&&v("TextBlock.verticalAlignment for "+this+" must be a real Spot, not:"+a)),this.Di=a=a.J(),Il(this),this.g("verticalAlignment",b,a))}},naturalBounds:{configurable:!0,get:function(){if(!this.rc.o()){var a=Zb.alloc();eo(this,this.Rb,this.pd,999999,a);var b=a.width;Zb.free(a);a=Zn(this,b,this.pd);var c=this.desiredSize;isNaN(c.width)||(b=c.width);isNaN(c.height)||(a=c.height);Cc(this.rc,b,a)}return this.rc}},isMultiline:{configurable:!0,
enumerable:!0,get:function(){return this.rj},set:function(a){var b=this.rj;b!==a&&(E&&z(a,"boolean",Kh,"isMultiline"),this.rj=a,this.v(),this.g("isMultiline",b,a))}},isUnderline:{configurable:!0,get:function(){return this.gi},set:function(a){var b=this.gi;b!==a&&(E&&z(a,"boolean",Kh,"isUnderline"),this.gi=a,this.S(),this.g("isUnderline",b,a))}},isStrikethrough:{configurable:!0,get:function(){return this.fi},set:function(a){var b=this.fi;b!==a&&(E&&z(a,"boolean",Kh,"isStrikethrough"),
this.fi=a,this.S(),this.g("isStrikethrough",b,a))}},wrap:{configurable:!0,get:function(){return this.og},set:function(a){var b=this.og;b!==a&&(E&&tb(a,Kh,Kh,"wrap"),this.og=a,this.v(),this.g("wrap",b,a))}},overflow:{configurable:!0,get:function(){return this.cg},set:function(a){var b=this.cg;b!==a&&(E&&tb(a,Kh,Kh,"overflow"),this.cg=a,this.v(),this.g("overflow",b,a))}},stroke:{configurable:!0,get:function(){return this.Ic},set:function(a){var b=this.Ic;b!==
a&&(null!==a&&Wl(a,"TextBlock.stroke"),a instanceof zl&&a.freeze(),this.Ic=a,this.S(),this.g("stroke",b,a))}},lineCount:{configurable:!0,get:function(){return this.pc}},editable:{configurable:!0,get:function(){return this.En},set:function(a){var b=this.En;b!==a&&(E&&z(a,"boolean",Kh,"editable"),this.En=a,this.g("editable",b,a))}},textEditor:{configurable:!0,get:function(){return this.Fp},set:function(a){var b=this.Fp;b!==a&&(!E||a instanceof Hf||v("TextBlock.textEditor must be an HTMLInfo."),
this.Fp=a,this.g("textEditor",b,a))}},errorFunction:{configurable:!0,get:function(){return this.Ec},set:function(a){var b=this.Ec;b!==a&&(null!==a&&z(a,"function",Kh,"errorFunction"),this.Ec=a,this.g("errorFunction",b,a))}},interval:{configurable:!0,get:function(){return this.Ed},set:function(a){var b=this.Ed;E&&B(a,Kh,"interval");a=Math.floor(a);if(b!==a&&0<=a){this.Ed=a;this.v();var c=this.panel;null!==c&&(c.Rg=null);this.g("interval",b,a)}}},graduatedStart:{configurable:!0,
enumerable:!0,get:function(){return this.Dd},set:function(a){var b=this.Dd;E&&B(a,Kh,"graduatedStart");b!==a&&(0>a?a=0:1<a&&(a=1),this.Dd=a,this.v(),this.g("graduatedStart",b,a))}},graduatedEnd:{configurable:!0,get:function(){return this.Bd},set:function(a){var b=this.Bd;E&&B(a,Kh,"graduatedEnd");b!==a&&(0>a?a=0:1<a&&(a=1),this.Bd=a,this.v(),this.g("graduatedEnd",b,a))}},graduatedFunction:{configurable:!0,get:function(){return this.mj},set:function(a){var b=this.mj;b!==
a&&(null!==a&&z(a,"function",Kh,"graduatedFunction"),this.mj=a,this.v(),this.g("graduatedFunction",b,a))}},graduatedSkip:{configurable:!0,get:function(){return this.Cd},set:function(a){var b=this.Cd;b!==a&&(null!==a&&z(a,"function",Kh,"graduatedSkip"),this.Cd=a,this.v(),this.g("graduatedSkip",b,a))}},textValidation:{configurable:!0,get:function(){return this.zi},set:function(a){var b=this.zi;b!==a&&(null!==a&&z(a,"function",Kh,"textValidation"),this.zi=a,this.g("textValidation",
b,a))}},textEdited:{configurable:!0,get:function(){return this.Ep},set:function(a){var b=this.Ep;b!==a&&(null!==a&&z(a,"function",Kh,"textEdited"),this.Ep=a,this.g("textEdited",b,a))}},spacingAbove:{configurable:!0,get:function(){return this.df},set:function(a){var b=this.df;b!==a&&(E&&z(a,"number",Kh,"spacingAbove"),this.df=a,this.g("spacingAbove",b,a))}},spacingBelow:{configurable:!0,get:function(){return this.ef},set:function(a){var b=this.ef;b!==a&&(E&&
z(a,"number",Kh,"spacingBelow"),this.ef=a,this.g("spacingBelow",b,a))}},maxLines:{configurable:!0,get:function(){return this.qe},set:function(a){var b=this.qe;b!==a&&(E&&z(a,"number",Kh,"maxLines"),a=Math.floor(a),0>=a&&Ca(a,"> 0",Kh,"maxLines"),this.qe=a,this.g("maxLines",b,a),this.v())}},metrics:{configurable:!0,get:function(){return this.pd}},choices:{configurable:!0,get:function(){return this.an},set:function(a){var b=this.an;b!==a&&(E&&null!==a&&!Array.isArray(a)&&
Ba(a,"Array",Kh,"choices:value"),this.an=a,this.g("choices",b,a))}}});var Vn=null,Wn=null,fo=new D(Kh,"None",0),co=new D(Kh,"WrapFit",1),Rn=new D(Kh,"WrapDesiredSize",2),ho=new D(Kh,"WrapBreakAll",3),Qn=new D(Kh,"OverflowClip",0),$n=new D(Kh,"OverflowEllipsis",1),io=null,jo=null,ko=0,lo=null,mo=0,bo="...",Xn="",Tn=null,On=!1;Kh.className="TextBlock";Kh.getEllipsis=function(){return bo};Kh.setEllipsis=function(a){bo=a;lo=new xb;mo=0};Kh.getBaseline=function(){return Vn};
Kh.setBaseline=function(a){Vn=a;a=ab();for(var b=a.length,c=0;c<b;c++)a[c].wf()};Kh.getUnderline=function(){return Wn};Kh.setUnderline=function(a){Wn=a;a=ab();for(var b=a.length,c=0;c<b;c++)a[c].wf()};Kh.isValidFont=Sn;Kh.None=fo;Kh.WrapFit=co;Kh.WrapDesiredSize=Rn;Kh.WrapBreakAll=ho;Kh.OverflowClip=Qn;Kh.OverflowEllipsis=$n;function an(){this.Gc=this.ng=0;this.Yc=[];this.Cc=[];this.Lf=null}an.prototype.reset=function(){this.Gc=this.ng=0;this.Lf=null;this.Yc=[];this.Cc=[]};
an.prototype.$l=function(a){this.ng=a.ng;this.Lf=a.Lf;this.Gc=a.Gc;this.Yc=Ma(a.Yc);this.Cc=Ma(a.Cc)};na.Object.defineProperties(an.prototype,{arrSize:{configurable:!0,get:function(){return this.Yc}},arrText:{configurable:!0,get:function(){return this.Cc}},maxLineWidth:{configurable:!0,get:function(){return this.Gc}},fontHeight:{configurable:!0,get:function(){return this.Lf}}});an.className="TextBlockMetrics";
function lk(){N.call(this);this.Ng=null;this.yp="";this.gh=Uc;this.fl=oe;this.hf=this.Ec=null;this.el=qd;this.Ad=nh;this.Ql=null;this.gu=!1;this.al=!0;this.sl=!1;this.Il=null}ma(lk,N);lk.prototype.cloneProtected=function(a){N.prototype.cloneProtected.call(this,a);a.element=this.Ng;a.yp=this.yp;a.gh=this.gh.J();a.fl=this.fl;a.Ad=this.Ad;a.Ec=this.Ec;a.hf=this.hf;a.el=this.el.J();a.al=this.al;a.Il=this.Il};t=lk.prototype;
t.hb=function(a){a===nh||a===ph||a===dl?this.imageStretch=a:N.prototype.hb.call(this,a)};t.toString=function(){return"Picture("+this.source+")#"+Jb(this)};function tk(a){void 0===a&&(a="");z(a,"string",lk,"clearCache:url");""!==a?no[a]&&(delete no[a],oo--):(no=new xb,oo=0)}
function po(a,b){a.Jr=!0;a.dl=!1;for(var c,d=ab(),e=d.length,f=0;f<e;f++){var g=d[f];c=a.getAttribute("src");var h=g.Gj.K(c);if(null!==h)for(var k=h.length,l=0;l<k;l++)c=h[l],g.su.add(c),g.ec(),void 0===a.yu&&(a.yu=b,null!==c.hf&&c.hf(c,b))}}function qo(a,b){a.dl=b;for(var c,d=ab(),e=d.length,f=0;f<e;f++){var g=d[f],h=a.getAttribute("src");c=g.Gj.K(h);if(null!==c){g=c.length;h=Qa();for(var k=0;k<g;k++)h.push(c[k]);for(k=0;k<g;k++)c=h[k],null!==c.Ec&&c.Ec(c,b);Ta(h)}}}
t.Wz=function(){if(""!==this.source){tk(this.source);var a=this.source;this.source="";this.source=a}};t.wf=function(){this.S()};
t.Hi=function(a,b){var c=this.Ng;if(null!==c){var d=c.getAttribute("src");c instanceof HTMLImageElement&&(null===d||""===d)&&v('Element has no source ("src") attribute: '+c);if(!(c.dl instanceof Event)){d=this.naturalBounds;var e=0,f=0,g=this.gu,h=g?+c.width:c.naturalWidth;g=g?+c.height:c.naturalHeight;void 0===h&&c.videoWidth&&(h=c.videoWidth);void 0===g&&c.videoHeight&&(g=c.videoHeight);h=h||d.width;g=g||d.height;if(0!==h&&0!==g){var k=h,l=g;this.sourceRect.o()&&(e=this.gh.x,f=this.gh.y,h=this.gh.width,
g=this.gh.height);var m=h,n=g,p=this.fl,q=this.el;switch(p){case nh:if(this.sourceRect.o())break;m>=d.width&&(e=e+q.offsetX+(m*q.x-d.width*q.x));n>=d.height&&(f=f+q.offsetY+(n*q.y-d.height*q.y));h=Math.min(d.width,m);g=Math.min(d.height,n);break;case oe:m=d.width;n=d.height;break;case ph:case dl:p===ph?(p=Math.min(d.height/n,d.width/m),m*=p,n*=p):p===dl&&(p=Math.max(d.height/n,d.width/m),m*=p,n*=p,m>=d.width&&(e=(e+q.offsetX+(m*q.x-d.width*q.x)/m)*h),n>=d.height&&(f=(f+q.offsetY+(n*q.y-d.height*q.y)/
n)*g),h*=1/(m/d.width),g*=1/(n/d.height),m=d.width,n=d.height)}p=this.Ge()*b.scale;var r=m*p*n*p,u=h*g/r,x=c.__goCache;p=null;var y=ro;if(c.Jr&&void 0!==x&&4<r&&u>y*y)for(null===x.Fi&&(so(x,4,k,l,c),so(x,16,k,l,c)),k=x.Fi,l=k.length,r=0;r<l;r++)if(k[r].ratio*k[r].ratio<u)p=k[r];else break;if(!b.Bn){if(null===this.Ql)if(null===this.Ng)this.Ql=!1;else{k=(new Jk(null)).context;k.drawImage(this.Ng,0,0);try{k.getImageData(0,0,1,1).data[3]&&(this.Ql=!1),this.Ql=!1}catch(A){this.Ql=!0}}if(this.Ql)return}k=
0;m<d.width&&(k=q.offsetX+(d.width*q.x-m*q.x));l=0;n<d.height&&(l=q.offsetY+(d.height*q.y-n*q.y));switch(this.flip){case fl:a.translate(Math.min(d.width,m),0);a.scale(-1,1);break;case el:a.translate(0,Math.min(d.height,n));a.scale(1,-1);break;case gl:a.translate(Math.min(d.width,m),Math.min(d.height,n)),a.scale(-1,-1)}if(b.He("pictureRatioOptimization")&&!b.qj&&void 0!==x&&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(A){E&&this.al&&Ha(A.toString()),this.al=!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(A){E&&this.al&&Ha(A.toString()),this.al=!1}switch(this.flip){case fl:a.scale(-1,1);a.translate(-Math.min(d.width,m),0);break;case el:a.scale(1,-1);a.translate(0,-Math.min(d.height,n));break;case gl:a.scale(-1,-1),a.translate(-Math.min(d.width,m),-Math.min(d.height,n))}}}}};
t.mm=function(a,b,c,d){var e=this.desiredSize,f=ql(this,!0),g=this.Ng,h=this.gu;if(h||!this.sl&&g&&g.complete)this.sl=!0;null===g&&(isFinite(e.width)||(a=0),isFinite(e.height)||(b=0));isFinite(e.width)||f===oe||f===bl?(isFinite(a)||(a=this.sourceRect.o()?this.sourceRect.width:h?+g.width:g.naturalWidth),c=0):null!==g&&!1!==this.sl&&(a=this.sourceRect.o()?this.sourceRect.width:h?+g.width:g.naturalWidth);isFinite(e.height)||f===oe||f===cl?(isFinite(b)||(b=this.sourceRect.o()?this.sourceRect.height:h?
+g.height:g.naturalHeight),d=0):null!==g&&!1!==this.sl&&(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));Cc(this.rc,a,b);nl(this,0,0,a,b)};t.vh=function(a,b,c,d){sl(this,a,b,c,d)};
na.Object.defineProperties(lk.prototype,{element:{configurable:!0,get:function(){return this.Ng},set:function(a){var b=this.Ng;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.gu=a instanceof HTMLCanvasElement;this.Ng=a;if(null!==a)if(a instanceof HTMLCanvasElement||!0===a.complete)a.dl instanceof Event&&null!==this.Ec&&this.Ec(this,a.dl),
!0===a.Jr&&null!==this.hf&&this.hf(this,a.yu),a.Jr=!0,this.desiredSize.o()||(zj(this,!1),this.v());else{var c=this;a.Ew||(a.addEventListener("load",function(b){po(a,b);c.desiredSize.o()||(zj(c,!1),c.v())}),a.addEventListener("error",function(b){qo(a,b)}),a.Ew=!0)}this.g("element",b,a);this.S()}}},source:{configurable:!0,get:function(){return this.yp},set:function(a){var b=this.yp;if(b!==a){z(a,"string",lk,"source");this.yp=a;var c=no,d=this.diagram,e=null;if(void 0!==c[a])e=c[a];else{30<
oo&&(tk(),c=no);e=ya("img");var f=this;e.addEventListener("load",function(a){po(e,a);f.desiredSize.o()||(zj(f,!1),f.v())});e.addEventListener("error",function(a){qo(e,a)});e.Ew=!0;var g=this.Il;null!==g&&(e.crossOrigin=g(this));e.src=a;c[a]=e;oo++}null!==d&&pk(d,this);this.element=e;null!==d&&kk(d,this);void 0===e.__goCache&&(e.__goCache=new to);this.v();this.S();this.g("source",b,a)}}},sourceCrossOrigin:{configurable:!0,get:function(){return this.Il},set:function(a){if(this.Il!==a&&
(null!==a&&z(a,"function",lk,"sourceCrossOrigin"),this.Il=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.gh},set:function(a){var b=this.gh;b.A(a)||(w(a,L,lk,"sourceRect"),this.gh=a=a.J(),this.S(),this.g("sourceRect",b,a))}},imageStretch:{configurable:!0,get:function(){return this.fl},
set:function(a){var b=this.fl;b!==a&&(tb(a,N,lk,"imageStretch"),this.fl=a,this.S(),this.g("imageStretch",b,a))}},flip:{configurable:!0,get:function(){return this.Ad},set:function(a){var b=this.Ad;b!==a&&(tb(a,N,lk,"flip"),this.Ad=a,this.S(),this.g("flip",b,a))}},imageAlignment:{configurable:!0,get:function(){return this.el},set:function(a){w(a,M,lk,"imageAlignment");var b=this.el;b.A(a)||(this.el=a=a.J(),this.v(),this.g("imageAlignment",b,a))}},errorFunction:{configurable:!0,
enumerable:!0,get:function(){return this.Ec},set:function(a){var b=this.Ec;b!==a&&(null!==a&&z(a,"function",lk,"errorFunction"),this.Ec=a,this.g("errorFunction",b,a))}},successFunction:{configurable:!0,get:function(){return this.hf},set:function(a){var b=this.hf;b!==a&&(null!==a&&z(a,"function",lk,"successFunction"),this.hf=a,this.g("successFunction",b,a))}},naturalBounds:{configurable:!0,get:function(){return this.rc}}});lk.prototype.redraw=lk.prototype.wf;
lk.prototype.reloadSource=lk.prototype.Wz;var no=null,oo=0,ro=4;lk.className="Picture";no=new xb;lk.clearCache=tk;function to(){this.Fi=null}function so(a,b,c,d,e){null===a.Fi&&(a.Fi=[]);var f=new Jk(null),g=f.context,h=1/b;f.width=c/b;f.height=d/b;0!==f.width&&0!==f.height&&(b=new uo(f.Ha,b),c=1,0<a.Fi.length&&(c=a.Fi[a.Fi.length-1],e=c.source,c=c.ratio),g.setTransform(h*c,0,0,h*c,0,0),g.drawImage(e,0,0),a.Fi.push(b))}to.className="PictureCacheArray";function uo(a,b){this.source=a;this.ratio=b}
uo.className="PictureCacheInstance";function vo(){this.Zs=new me;this.gc=null}t=vo.prototype;t.reset=function(a){null!==a?(a.ja(),this.Zs=a,a.figures.clear()):this.Zs=new me;this.gc=null};function Be(a,b,c,d,e){a.gc=new Xe;a.gc.startX=b;a.gc.startY=c;a.gc.isFilled=d;a.Zs.figures.add(a.gc);void 0!==e&&(a.gc.isShadowed=e)}function Je(a){var b=a.gc.segments.length;0<b&&a.gc.segments.O(b-1).close()}t.Aq=function(a){this.gc.isShadowed=a};
t.moveTo=function(a,b,c){void 0===c&&(c=!1);var d=new Ye(Ne);d.endX=a;d.endY=b;c&&d.close();this.gc.segments.add(d)};t.lineTo=function(a,b,c){void 0===c&&(c=!1);var d=new Ye(ve);d.endX=a;d.endY=b;c&&d.close();this.gc.segments.add(d)};function Ce(a,b,c,d,e,f,g){var h;void 0===h&&(h=!1);var k=new Ye(Oe);k.point1X=b;k.point1Y=c;k.point2X=d;k.point2Y=e;k.endX=f;k.endY=g;h&&k.close();a.gc.segments.add(k)}
function He(a,b,c,d,e){var f;void 0===f&&(f=!1);var g=new Ye(Pe);g.point1X=b;g.point1Y=c;g.endX=d;g.endY=e;f&&g.close();a.gc.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 Ye(Qe);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.gc.segments.add(h)};function Ie(a,b,c,d,e,f,g,h){var k;void 0===k&&(k=!1);b=new Ye(Re,g,h,b,c,d,e,f);k&&b.close();a.gc.segments.add(b)}
function Ae(a){var b=Ke;if(null!==b)return Ke=null,b.reset(a),b;b=new vo;b.reset(a);return b}var Ke=null;vo.className="StreamGeometryContext";function wo(a,b){var c=a.toLowerCase(),d=K.be;d[a]=b;d[c]=a}wo("Rectangle",function(a,b,c){a=new me(xe);a.startX=0;a.startY=0;a.endX=b;a.endY=c;return a});wo("Square",function(a,b,c){a=new me(xe);a.startX=0;a.startY=0;a.endX=b;a.endY=c;a.defaultStretch=ph;return a});
wo("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.Cg;b=(new me).add((new Xe(d,0,!0)).add(new Ye(ve,b-d,0)).add(new Ye(Oe,b,d,b-a,0,b,a)).add(new Ye(ve,b,c-d)).add(new Ye(Oe,b-d,c,b,c-a,b-a,c)).add(new Ye(ve,d,c)).add(new Ye(Oe,0,c-d,a,c,0,c-a)).add(new Ye(ve,0,d)).add((new Ye(Oe,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});wo("Border","RoundedRectangle");
wo("Ellipse",function(a,b,c){a=new me(ye);a.startX=0;a.startY=0;a.endX=b;a.endY=c;a.spot1=ee;a.spot2=fe;return a});wo("Circle",function(a,b,c){a=new me(ye);a.startX=0;a.startY=0;a.endX=b;a.endY=c;a.spot1=ee;a.spot2=fe;a.defaultStretch=ph;return a});wo("TriangleRight",function(a,b,c){return(new me).add((new Xe(0,0)).add(new Ye(ve,b,.5*c)).add((new Ye(ve,0,c)).close())).Dm(0,.25,.5,.75)});
wo("TriangleDown",function(a,b,c){return(new me).add((new Xe(0,0)).add(new Ye(ve,b,0)).add((new Ye(ve,.5*b,c)).close())).Dm(.25,0,.75,.5)});wo("TriangleLeft",function(a,b,c){return(new me).add((new Xe(b,c)).add(new Ye(ve,0,.5*c)).add((new Ye(ve,b,0)).close())).Dm(.5,.25,1,.75)});wo("TriangleUp",function(a,b,c){return(new me).add((new Xe(b,c)).add(new Ye(ve,0,c)).add((new Ye(ve,.5*b,0)).close())).Dm(.25,.5,.75,1)});wo("Triangle","TriangleUp");
wo("Diamond",function(a,b,c){return(new me).add((new Xe(.5*b,0)).add(new Ye(ve,0,.5*c)).add(new Ye(ve,.5*b,c)).add((new Ye(ve,b,.5*c)).close())).Dm(.25,.25,.75,.75)});wo("LineH",function(a,b,c){a=new me(pe);a.startX=0;a.startY=c/2;a.endX=b;a.endY=c/2;return a});wo("LineV",function(a,b,c){a=new me(pe);a.startX=b/2;a.startY=0;a.endX=b/2;a.endY=c;return a});wo("None","Rectangle");wo("BarH","Rectangle");wo("BarV","Rectangle");wo("MinusLine","LineH");
wo("PlusLine",function(a,b,c){return(new me).add((new Xe(0,c/2,!1)).add(new Ye(ve,b,c/2)).add(new Ye(Ne,b/2,0)).add(new Ye(ve,b/2,c)))});wo("XLine",function(a,b,c){return(new me).add((new Xe(0,c,!1)).add(new Ye(ve,b,0)).add(new Ye(Ne,0,0)).add(new Ye(ve,b,c)))});
K.Gm={"":"",Standard:"F1 m 0,0 l 8,4 -8,4 2,-4 z",Backward:"F1 m 8,0 l -2,4 2,4 -8,-4 z",Triangle:"F1 m 0,0 l 8,4.62 -8,4.62 z",BackwardTriangle:"F1 m 8,4 l 0,4 -8,-4 8,-4 0,4 z",Boomerang:"F1 m 0,0 l 8,4 -8,4 4,-4 -4,-4 z",BackwardBoomerang:"F1 m 8,0 l -8,4 8,4 -4,-4 4,-4 z",SidewaysV:"m 0,0 l 8,4 -8,4 0,-1 6,-3 -6,-3 0,-1 z",BackwardV:"m 8,0 l -8,4 8,4 0,-1 -6,-3 6,-3 0,-1 z",OpenTriangle:"m 0,0 l 8,4 -8,4",BackwardOpenTriangle:"m 8,0 l -8,4 8,4",OpenTriangleLine:"m 0,0 l 8,4 -8,4 m 8.5,0 l 0,-8",
BackwardOpenTriangleLine:"m 8,0 l  -8,4 8,4 m -8.5,0 l 0,-8",OpenTriangleTop:"m 0,0 l 8,4 m 0,4",BackwardOpenTriangleTop:"m 8,0 l -8,4 m 0,4",OpenTriangleBottom:"m 0,8 l 8,-4",BackwardOpenTriangleBottom:"m 0,4 l 8,4",HalfTriangleTop:"F1 m 0,0 l 0,4 8,0 z m 0,8",BackwardHalfTriangleTop:"F1 m 8,0 l 0,4 -8,0 z m 0,8",HalfTriangleBottom:"F1 m 0,4 l 0,4 8,-4 z",BackwardHalfTriangleBottom:"F1 m 8,4 l 0,4 -8,-4 z",ForwardSemiCircle:"m 4,0 b 270 180 0 4 4",BackwardSemiCircle:"m 4,8 b 90 180 0 -4 4",Feather:"m 0,0 l 3,4 -3,4",
BackwardFeather:"m 3,0 l -3,4 3,4",DoubleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardDoubleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4",TripleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardTripleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4 m 3,-8 l -3,4 3,4",ForwardSlash:"m 0,8 l 5,-8",BackSlash:"m 0,0 l 5,8",DoubleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8",DoubleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8",TripleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8 m -2,8 l 4,-8",
TripleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8 m -2,-8 l 4,8",Fork:"m 0,4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4",LineFork:"m 0,0 l 0,8 m 0,-4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardLineFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4 m 8,-8 l 0,8",CircleFork:"F1 m 6,4 b 0 360 -3 0 3 z m 0,0 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",BackwardCircleFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 6,0 b 0 360 -3 0 3",CircleLineFork:"F1 m 6,4 b 0 360 -3 0 3 z m 1,-4 l 0,8 m 0,-4 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",
BackwardCircleLineFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 0,-4 l 0,8 m 7,-4 b 0 360 -3 0 3",Circle:"F1 m 8,4 b 0 360 -4 0 4 z",Block:"F1 m 0,0 l 0,8 8,0 0,-8 z",StretchedDiamond:"F1 m 0,3 l 5,-3 5,3 -5,3 -5,-3 z",Diamond:"F1 m 0,4 l 4,-4 4,4 -4,4 -4,-4 z",Chevron:"F1 m 0,0 l 5,0 3,4 -3,4 -5,0 3,-4 -3,-4 z",StretchedChevron:"F1 m 0,0 l 8,0 3,4 -3,4 -8,0 3,-4 -3,-4 z",NormalArrow:"F1 m 0,2 l 4,0 0,-2 4,4 -4,4 0,-2 -4,0 z",X:"m 0,0 l 8,8 m 0,-8 l -8,8",TailedNormalArrow:"F1 m 0,0 l 2,0 1,2 3,0 0,-2 2,4 -2,4 0,-2 -3,0 -1,2 -2,0 1,-4 -1,-4 z",
DoubleTriangle:"F1 m 0,0 l 4,4 -4,4 0,-8 z  m 4,0 l 4,4 -4,4 0,-8 z",BigEndArrow:"F1 m 0,0 l 5,2 0,-2 3,4 -3,4 0,-2 -5,2 0,-8 z",ConcaveTailArrow:"F1 m 0,2 h 4 v -2 l 4,4 -4,4 v -2 h -4 l 2,-2 -2,-2 z",RoundedTriangle:"F1 m 0,1 a 1,1 0 0 1 1,-1 l 7,3 a 0.5,1 0 0 1 0,2 l -7,3 a 1,1 0 0 1 -1,-1 l 0,-6 z",SimpleArrow:"F1 m 1,2 l -1,-2 2,0 1,2 -1,2 -2,0 1,-2 5,0 0,-2 2,2 -2,2 0,-2 z",AccelerationArrow:"F1 m 0,0 l 0,8 0.2,0 0,-8 -0.2,0 z m 2,0 l 0,8 1,0 0,-8 -1,0 z m 3,0 l 2,0 2,4 -2,4 -2,0 0,-8 z",BoxArrow:"F1 m 0,0 l 4,0 0,2 2,0 0,-2 2,4 -2,4 0,-2 -2,0 0,2 -4,0 0,-8 z",
TriangleLine:"F1 m 8,4 l -8,-4 0,8 8,-4 z m 0.5,4 l 0,-8",CircleEndedArrow:"F1 m 10,4 l -2,-3 0,2 -2,0 0,2 2,0 0,2 2,-3 z m -4,0 b 0 360 -3 0 3 z",DynamicWidthArrow:"F1 m 0,3 l 2,0 2,-1 2,-2 2,4 -2,4 -2,-2 -2,-1 -2,0 0,-2 z",EquilibriumArrow:"m 0,3 l 8,0 -3,-3 m 3,5 l -8,0 3,3",FastForward:"F1 m 0,0 l 3.5,4 0,-4 3.5,4 0,-4 1,0 0,8 -1,0 0,-4 -3.5,4 0,-4 -3.5,4 0,-8 z",Kite:"F1 m 0,4 l 2,-4 6,4 -6,4 -2,-4 z",HalfArrowTop:"F1 m 0,0 l 4,4 4,0 -8,-4 z m 0,8",HalfArrowBottom:"F1 m 0,8 l 4,-4 4,0 -8,4 z",
OpposingDirectionDoubleArrow:"F1 m 0,4 l 2,-4 0,2 4,0 0,-2 2,4 -2,4 0,-2 -4,0 0,2 -2,-4 z",PartialDoubleTriangle:"F1 m 0,0 4,3 0,-3 4,4 -4,4 0,-3 -4,3 0,-8 z",LineCircle:"F1 m 0,0 l 0,8 m 7 -4 b 0 360 -3 0 3 z",DoubleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",TripleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",CircleLine:"F1 m 6 4 b 0 360 -3 0 3 z m 1,-4 l 0,8",DiamondCircle:"F1 m 8,4 l -4,4 -4,-4 4,-4 4,4 m 8,0 b 0 360 -4 0 4 z",PlusCircle:"F1 m 8,4 b 0 360 -4 0 4 l -8 0 z m -4 -4 l 0 8",
OpenRightTriangleTop:"m 8,0 l 0,4 -8,0 m 0,4",OpenRightTriangleBottom:"m 8,8 l 0,-4 -8,0",Line:"m 0,0 l 0,8",DoubleLine:"m 0,0 l 0,8 m 2,0 l 0,-8",TripleLine:"m 0,0 l 0,8 m 2,0 l 0,-8 m 2,0 l 0,8",PentagonArrow:"F1 m 8,4 l -4,-4 -4,0 0,8 4,0 4,-4 z"};
function U(a){W.call(this,a);this.F=2408959;this.Vg=this.Cf="";this.cp=this.$o=this.op=this.fo=null;this.qp="";this.Af=this.Rn=this.pp=this.eh=null;this.bp="";this.ap=xc;this.Rb=this.ep="";this.ii=this.dn=this.Uh=null;this.pe=(new J(NaN,NaN)).freeze();this.mo="";this.Ze=null;this.no=fd;this.fp=Qd;this.vo=hc;this.oo=ic;this.An=null;this.ho=127;this.wi=jc;this.Mj="gray";this.Qd=4;this.Hw=-1;this.Pp=NaN;this.$x=new L;this.zj=null;this.Yg=NaN}ma(U,W);
U.prototype.cloneProtected=function(a){W.prototype.cloneProtected.call(this,a);a.F=this.F&-4097|49152;a.Cf=this.Cf;a.Vg=this.Vg;a.fo=this.fo;a.op=this.op;a.$o=this.$o;a.cp=this.cp;a.qp=this.qp;a.pp=this.pp;a.Rn=this.Rn;a.Af=null;a.bp=this.bp;a.ap=this.ap.J();a.ep=this.ep;a.fp=this.fp.J();a.Rb=this.Rb;a.dn=this.dn;a.pe.assign(this.pe);a.mo=this.mo;a.no=this.no.J();a.vo=this.vo.J();a.oo=this.oo.J();a.An=this.An;a.ho=this.ho;a.wi=this.wi.J();a.Mj=this.Mj;a.Qd=this.Qd;a.Pp=this.Pp};
U.prototype.rf=function(a){W.prototype.rf.call(this,a);a.Ah();a.eh=null;a.Ze=null;a.zj=null};U.prototype.toString=function(){var a=Va(this.constructor)+"#"+Jb(this);null!==this.data&&(a+="("+Wa(this.data)+")");return a};U.prototype.sk=function(a,b,c,d,e,f,g){var h=this.diagram;null!==h&&(a===qf&&"elements"===b?e instanceof W?Rj(e,function(a){Tj(h.partManager,a);Sj(h,a)}):kk(h,e):a===rf&&"elements"===b&&(e instanceof W?Rj(e,function(a){Wj(h.partManager,a,h)}):pk(h,e)),h.cb(a,b,c,d,e,f,g))};
U.prototype.Fa=function(a){W.prototype.Fa.call(this,a);if(null!==this.data){a=this.Z.j;for(var b=a.length,c=0;c<b;c++){var d=a[c];d instanceof W&&Rj(d,function(a){null!==a.data&&a.Fa()})}}};U.prototype.updateRelationshipsFromData=function(){null!==this.data&&this.diagram.partManager.updateRelationshipsFromData(this)};U.prototype.dk=function(a){E&&z(a,"string",U,"findAdornment:category");var b=this.Af;return null===b?null:b.K(a)};
U.prototype.rh=function(a,b){if(null!==b){E&&(z(a,"string",U,"addAdornment:category"),w(b,Cf,U,"addAdornment:ad"));var c=null,d=this.Af;null!==d&&(c=d.K(a));if(c!==b){if(null!==c){var e=c.diagram;null!==e&&e.remove(c)}null===d&&(this.Af=d=new Ub);b.Cf!==a&&(b.category=a);d.add(a,b);a=this.diagram;null!==a&&(a.add(b),a=b.adornedObject,null!==a&&(a=a.Li(),null!==a&&(b.data=a.data)))}}};
U.prototype.xf=function(a){E&&z(a,"string",U,"removeAdornment:category");var b=this.Af;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.Af=null)}};U.prototype.Wj=function(){var a=this.Af;if(null!==a){var b=Qa();for(a=a.iterator;a.next();)b.push(a.key);a=b.length;for(var c=0;c<a;c++)this.xf(b[c]);Ta(b)}};
U.prototype.updateAdornments=function(){var a=this.diagram;if(null!==a){for(var b=this.adornments;b.next();){var c=b.value;c.v();c.placeholder&&c.placeholder.v()}a:{if(this.isSelected&&this.selectionAdorned&&(b=this.selectionObject,null!==b&&this.actualBounds.o()&&this.isVisible()&&b.vf()&&b.actualBounds.o())){c=this.dk("Selection");if(null===c){c=this.selectionAdornmentTemplate;null===c&&(c=this.Bh()?a.linkSelectionAdornmentTemplate:this instanceof xg?a.groupSelectionAdornmentTemplate:a.nodeSelectionAdornmentTemplate);
if(!(c instanceof Cf))break a;mh(c);c=c.copy();null!==c&&(this.Bh()&&this.selectionObject===this.path&&(c.type=W.Link),c.adornedObject=b)}if(null!==c){if(null!==c.placeholder){var d=b.Ge(),e=0;b instanceof Hg&&(e=b.strokeWidth);var f=Zb.alloc();f.h((b.naturalBounds.width+e)*d,(b.naturalBounds.height+e)*d);Zb.free(f)}c.type===W.Link?c.v():(b=J.alloc(),J.free(b));this.rh("Selection",c);break a}}this.xf("Selection")}xo(this,a);for(b=this.adornments;b.next();)b.value.Fa()}};
U.prototype.Mb=function(){var a=this.diagram;null!==a&&(ej(a),0!==(this.F&16384)!==!0&&(xi(this,!0),a.ec()))};function wi(a){0!==(a.F&16384)!==!1&&(a.updateAdornments(),xi(a,!1))}function xo(a,b){b.toolManager.mouseDownTools.each(function(b){b.isEnabled&&b.updateAdornments(a)});b.toolManager.updateAdornments(a)}function yo(a){if(!1===Gj(a)){zo(a,!0);a.kl();var b=a.diagram;null!==b&&(b.Fd.add(a),b.ec())}}
function Ao(a){a.F|=2097152;if(!1!==Gj(a)){var b=a.position,c=a.location;c.o()&&b.o()||Bo(a,b,c);c=a.wb;var d=L.alloc().assign(c);c.ja();c.x=b.x;c.y=b.y;c.freeze();a.qt(d,c);L.free(d);zo(a,!1)}}U.prototype.move=function(a,b){!0===b?this.location=a:this.position=a};U.prototype.moveTo=function(a,b,c){a=J.allocAt(a,b);this.move(a,c);J.free(a)};
U.prototype.isVisible=function(){if(!this.visible)return!1;var a=this.layer;if(null!==a&&!a.visible)return!1;a=this.diagram;if(null!==a&&mi(a.animationManager,this))return!0;a=this.containingGroup;return null===a||a.isSubGraphExpanded&&a.isVisible()?!0:!1};t=U.prototype;t.Ob=function(a){var b=this.diagram;a?(this.C(4),this.Mb(),null!==b&&b.Fd.add(this)):(this.C(8),this.Wj());this.Ah();null!==b&&(b.Ya(),b.S())};
t.bb=function(a){if(this.name===a)return this;var b=this.zj;null===b&&(this.zj=b=new Ub);if(null!==b.K(a))return b.K(a);var c=W.prototype.bb.call(this,a);if(null!==c)return b.set(a,c),c;b.set(a,null);return null};t.sf=function(a,b,c){void 0===c&&(c=new J);b=b.Nb()?qd: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.va(c);for(a=a.panel;null!==a&&a!==this;)a.transform.va(c),a=a.panel;this.Sf.va(c);c.offset(-this.qc.x,-this.qc.y);return c};
t.eq=function(a){void 0===a&&(a=new L);return a.assign(this.actualBounds)};t.bc=function(){!0===Ej(this)&&(this instanceof xg&&this.memberParts.each(function(a){a.bc()}),this.measure(Infinity,Infinity));this.arrange()};
function Pj(a,b){var c=a.$x;isNaN(a.Yg)&&(a.Yg=mn(a));var d=a.Yg;var e=2*d;if(!a.isShadowed)return c.h(b.x-1-d,b.y-1-d,b.width+2+e,b.height+2+e),c;d=b.x;e=b.y;var f=b.width;b=b.height;var g=a.shadowBlur;a=a.shadowOffset;f+=g;b+=g;d-=g/2;e-=g/2;0<a.x?f+=a.x:(d+=a.x,f-=a.x);0<a.y?b+=a.y:(e+=a.y,b-=a.y);c.h(d-1,e-1,f+2,b+2);return c}
U.prototype.arrange=function(){if(!1===Fj(this))Ao(this);else{var a=this.wb,b=L.alloc();b.assign(a);a.ja();var c=Dg(this);this.vh(0,0,this.qc.width,this.qc.height);var d=this.position;Bo(this,d,this.location);a.x=d.x;a.y=d.y;a.freeze();this.qt(b,a);rl(this,!1);b.A(a)?this.kd(c):!this.dc()||K.B(b.width,a.width)&&K.B(b.height,a.height)||0<=this.Hw&&this.C(16);L.free(b);zo(this,!1)}};t=U.prototype;
t.qt=function(a,b){var c=this.diagram;if(null!==c){var d=!1;if(!1===c.Tg&&a.o()){var e=L.alloc();e.assign(c.documentBounds);e.Wv(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)||Uj(this,d,c);c.S();Fc(a,b)||(this instanceof V&&!c.undoManager.isUndoingRedoing&&this.gd(),this.Ah())}};
t.Sv=function(a,b){if(this.Bh()||!a.o())return!1;var c=this.diagram;if(null!==c&&(Co(this,c,a,b),!0===c.undoManager.isUndoingRedoing))return!0;this.ua=a;this.F&=-2097153;c=this.pe;c.o()&&(this.pe=new J(c.x+(a.x-b.x),c.y+(a.y-b.y)),this.g("location",c,this.pe));!1===Gj(this)&&!1===Fj(this)&&(yo(this),Ao(this));return!0};function Co(a,b,c,d){null===b||a instanceof Cf||(b=b.animationManager,b.pi&&b.th(a,"position",d.copy(),c.copy(),!1))}
t.Bt=function(a,b){var c=this.pe,d=this.ua;Gj(this)||Fj(this)?c.h(NaN,NaN):c.h(c.x+a-d.x,c.y+b-d.y);d.h(a,b);yo(this)};t.Tv=function(){this.F&=-2097153;yo(this)};
function Bo(a,b,c){var d=J.alloc(),e=a.locationSpot,f=a.locationObject;e.Nb()&&v("determineOffset: Part's locationSpot must be real: "+e.toString());var g=f.naturalBounds,h=f instanceof Hg?f.strokeWidth:0;d.uk(0,0,g.width+h,g.height+h,e);if(f!==a)for(d.offset(-h/2,-h/2),f.transform.va(d),e=f.panel;null!==e&&e!==a;)e.transform.va(d),e=e.panel;a.Sf.va(d);d.offset(-a.qc.x,-a.qc.y);e=a.diagram;f=c.o();g=b.o();f&&g?0!==(a.F&2097152)?Do(a,b,c,e,d):Eo(a,b,c,e,d):f?Do(a,b,c,e,d):g&&Eo(a,b,c,e,d);a.F|=2097152;
J.free(d);a.kl()}function Do(a,b,c,d,e){var f=b.x,g=b.y;b.h(c.x-e.x,c.y-e.y);null!==d&&(c=d.animationManager,(e=c.isAnimating)||!c.pi||a instanceof Cf||c.th(a,"position",new J(f,g),b,!1),e||b.x===f&&b.y===g||(c=d.skipsUndoManager,d.skipsUndoManager=!0,a.g("position",new J(f,g),b),d.skipsUndoManager=c))}function Eo(a,b,c,d,e){var f=c.copy();c.h(b.x+e.x,b.y+e.y);c.A(f)||null===d||(b=d.skipsUndoManager,d.skipsUndoManager=!0,a.g("location",f,c),d.skipsUndoManager=b)}
function Uj(a,b,c){tl(a,!1);a instanceof V&&Ek(c,a);a.layer.isTemporary||b||c.Ya();b=a.wb;var d=c.viewportBounds;d.o()?Dg(a)?(Lc(b,d,10)||a.kd(!1),a.updateAdornments()):b.Kc(d)?(a.kd(!0),a.updateAdornments()):a.Mb():c.ei=!0}t.Vi=function(){return!0};t.dc=function(){return!0};t.Bh=function(){return!1};t.xg=function(){return!0};
function Fo(a,b,c,d){b.constructor===a.constructor||Go||(Go=!0,Ha('Should not change the class of the Part when changing category from "'+c+'" to "'+d+'"'),Ha("  Old class: "+Va(a.constructor)+", new class: "+Va(b.constructor)+", part: "+a.toString()));a.Wj();var e=a.data;c=a.layerName;var f=a.isSelected,g=a.isHighlighted,h=!0,k=!0,l=!1;a instanceof V&&(h=a.isTreeLeaf,k=a.isTreeExpanded,l=a.wasTreeExpanded);b.rf(a);b.cloneProtected(a);a.Cf=d;a.v();a.S();b=a.diagram;d=!0;null!==b&&(d=b.skipsUndoManager,
b.skipsUndoManager=!0);a.kb=e;a.F=f?a.F|4096:a.F&-4097;a.F=g?a.F|524288:a.F&-524289;a instanceof V&&(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.Fa();e=a.layerName;e!==c&&(a.Vg=c,a.layerName=e);null!==b&&(b.skipsUndoManager=d);a.dc()&&a.C(64)}U.prototype.canCopy=function(){if(!this.copyable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowCopy)return!1;a=a.diagram;return null===a?!0:a.allowCopy?!0:!1};
U.prototype.canDelete=function(){if(!this.deletable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowDelete)return!1;a=a.diagram;return null===a?!0:a.allowDelete?!0:!1};U.prototype.canEdit=function(){if(!this.textEditable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowTextEdit)return!1;a=a.diagram;return null===a?!0:a.allowTextEdit?!0:!1};
U.prototype.canGroup=function(){if(!this.groupable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowGroup)return!1;a=a.diagram;return null===a?!0:a.allowGroup?!0:!1};U.prototype.canMove=function(){if(!this.movable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowMove)return!1;a=a.diagram;return null===a?!0:a.allowMove?!0:!1};
U.prototype.canReshape=function(){if(!this.reshapable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowReshape)return!1;a=a.diagram;return null===a?!0:a.allowReshape?!0:!1};U.prototype.canResize=function(){if(!this.resizable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowResize)return!1;a=a.diagram;return null===a?!0:a.allowResize?!0:!1};
U.prototype.canRotate=function(){if(!this.rotatable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowRotate)return!1;a=a.diagram;return null===a?!0:a.allowRotate?!0:!1};U.prototype.canSelect=function(){if(!this.selectable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowSelect)return!1;a=a.diagram;return null===a?!0:a.allowSelect?!0:!1};function xi(a,b){a.F=b?a.F|16384:a.F&-16385}function Gj(a){return 0!==(a.F&32768)}function zo(a,b){a.F=b?a.F|32768:a.F&-32769}
function tl(a,b){a.F=b?a.F|65536:a.F&-65537}function Dg(a){return 0!==(a.F&131072)}t=U.prototype;t.kd=function(a){this.F=a?this.F|131072:this.F&-131073};function Ho(a,b){a.F=b?a.F|1048576:a.F&-1048577}t.Ah=function(){var a=this.containingGroup;null!==a&&(a.v(),null!==a.placeholder&&a.placeholder.v(),a.gd())};t.S=function(){var a=this.diagram;null!==a&&!Fj(this)&&!Gj(this)&&this.isVisible()&&this.wb.o()&&a.S(Pj(this,this.wb))};
t.v=function(){W.prototype.v.call(this);var a=this.diagram;null!==a&&(a.Fd.add(this),this instanceof V&&null!==this.labeledLink&&Il(this.labeledLink),a.ec(!0))};t.hq=function(a){a||(a=this.Uh,null!==a&&Io(a,this))};t.iq=function(a){a||(a=this.Uh,null!==a&&Jo(a,this))};t.bk=function(){var a=this.data;if(null!==a){var b=this.diagram;null!==b&&(b=b.model,null!==b&&b.um(a))}};t.bz=function(){return Ko(this,this)};
function Ko(a,b){var c=b.containingGroup;return null!==c?1+Ko(a,c):b instanceof V&&(b=b.labeledLink,null!==b)?Ko(a,b):0}t.ez=function(){return Lo(this,this)};function Lo(a,b){var c=b.containingGroup;return null!==c||b instanceof V&&(c=b.labeledLink,null!==c)?Lo(a,c):b}t.Xd=function(a){return a instanceof xg?Mo(this,this,a):!1};function Mo(a,b,c){if(b===c||null===c)return!1;var d=b.containingGroup;return null===d||d!==c&&!Mo(a,d,c)?b instanceof V&&(b=b.labeledLink,null!==b)?Mo(a,b,c):!1:!0}
t.mx=function(a){if(null===a)return null;E&&w(a,U,U,"findCommonContainingGroup:other");if(this===a)return this.containingGroup;for(var b=this;null!==b;){b instanceof xg&&Ho(b,!0);if(b instanceof V){var c=b.labeledLink;null!==c&&(b=c)}b=b.containingGroup}c=null;for(b=a;null!==b;){if(0!==(b.F&1048576)){c=b;break}b instanceof V&&(a=b.labeledLink,null!==a&&(b=a));b=b.containingGroup}for(b=this;null!==b;)b instanceof xg&&Ho(b,!1),b instanceof V&&(a=b.labeledLink,null!==a&&(b=a)),b=b.containingGroup;return c};
U.prototype.canLayout=function(){if(!this.isLayoutPositioned||!this.isVisible())return!1;var a=this.layer;return null!==a&&a.isTemporary||this instanceof V&&this.isLinkLabel?!1:!0};
U.prototype.C=function(a){void 0===a&&(a=16777215);if(this.isLayoutPositioned&&0!==(a&this.layoutConditions)){var b=this.layer;null!==b&&b.isTemporary||this instanceof V&&this.isLinkLabel?b=!1:(b=this.diagram,b=null!==b&&b.undoManager.isUndoingRedoing?!1:!0)}else b=!1;if(b)if(b=this.Uh,null!==b){var c=b.layout;null!==c?c.C():b.C(a)}else a=this.diagram,null!==a&&(a=a.layout,null!==a&&a.C())};function Vj(a){if(!a.isVisible())return!1;a=a.layer;return null!==a&&a.isTemporary?!1:!0}
function Yk(a,b,c,d,e,f){void 0===f&&(f=null);if(!(a.contains(b)||null!==f&&!f(b)||b instanceof Cf))if(a.add(b),b instanceof V){if(c&&b instanceof xg)for(var g=b.memberParts;g.next();)Yk(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)&&Yk(a,h,c,d,e,f)}}if(1<d)for(b=b.iv();b.next();)Yk(a,b.value,c,d-1,e,f)}else if(b instanceof T)for(b=b.labelNodes;b.next();)Yk(a,
b.value,c,d,e,f)}
na.Object.defineProperties(U.prototype,{key:{configurable:!0,get:function(){var a=this.diagram;if(null!==a)return a.model.ra(this.data)}},adornments:{configurable:!0,get:function(){return null===this.Af?Db:this.Af.iteratorValues}},layer:{configurable:!0,get:function(){return this.ii}},diagram:{configurable:!0,get:function(){var a=this.ii;return null!==a?a.diagram:null}},layerName:{configurable:!0,get:function(){return this.Vg},set:function(a){var b=
this.Vg;if(b!==a){z(a,"string",U,"layerName");var c=this.diagram;if(null===c||null!==c.dm(a)&&!c.partManager.addsToTemporaryLayer)if(this.Vg=a,null!==c&&c.Ya(),this.g("layerName",b,a),b=this.layer,null!==b&&b.name!==a&&(c=b.diagram,null!==c&&(a=c.dm(a),null!==a&&a!==b))){var d=b.zc(-1,this,!0);0<=d&&c.cb(rf,"parts",b,this,null,d,!0);d=a.Si(99999999,this,!0);b.visible!==a.visible&&this.Ob(a.visible);0<=d&&c.cb(qf,"parts",a,null,this,!0,d);d=this.layerChanged;if(null!==d){var e=c.fa;c.fa=!0;d(this,
b,a);c.fa=e}}}}},layerChanged:{configurable:!0,get:function(){return this.fo},set:function(a){var b=this.fo;b!==a&&(null!==a&&z(a,"function",U,"layerChanged"),this.fo=a,this.g("layerChanged",b,a))}},zOrder:{configurable:!0,get:function(){return this.Pp},set:function(a){var b=this.Pp;if(b!==a){z(a,"number",U,"zOrder");this.Pp=a;var c=this.layer;null!==c&&Ai(c,-1,this);this.g("zOrder",b,a);a=this.diagram;null!==a&&a.S()}}},locationObject:{configurable:!0,get:function(){if(null===
this.Ze){var a=this.locationObjectName;""!==a?(a=this.bb(a),null!==a?this.Ze=a:this.Ze=this):this instanceof Cf?this.type!==W.Link&&null!==this.placeholder?this.Ze=this.placeholder:this.Ze=this:this.Ze=this}return this.Ze.visible?this.Ze:this}},minLocation:{configurable:!0,get:function(){return this.vo},set:function(a){var b=this.vo;b.A(a)||(E&&w(a,J,U,"minLocation"),this.vo=a=a.J(),this.g("minLocation",b,a))}},maxLocation:{configurable:!0,get:function(){return this.oo},
set:function(a){var b=this.oo;b.A(a)||(E&&w(a,J,U,"maxLocation"),this.oo=a=a.J(),this.g("maxLocation",b,a))}},locationObjectName:{configurable:!0,get:function(){return this.mo},set:function(a){var b=this.mo;b!==a&&(E&&z(a,"string",U,"locationObjectName"),this.mo=a,this.Ze=null,this.v(),this.g("locationObjectName",b,a))}},locationSpot:{configurable:!0,get:function(){return this.no},set:function(a){var b=this.no;b.A(a)||(E&&(w(a,M,U,"locationSpot"),a.Za()||v("Part.locationSpot must be a specific Spot value, not: "+
a)),this.no=a=a.J(),this.v(),this.g("locationSpot",b,a))}},location:{configurable:!0,get:function(){return this.pe},set:function(a){E&&w(a,J,U,"location");var b=a.x,c=a.y,d=this.pe,e=d.x,f=d.y;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))||(a=a.J(),b=a,this.Bh()?b=!1:(this.pe=b,this.F|=2097152,!1===Fj(this)&&(yo(this),c=this.ua,c.o()&&(e=c.copy(),c.h(c.x+(b.x-d.x),c.y+(b.y-d.y)),Co(this,this.diagram,c,e),this.g("position",e,c))),b=!0),b&&this.g("location",d,a))}},category:{configurable:!0,
enumerable:!0,get:function(){return this.Cf},set:function(a){var b=this.Cf;if(b!==a){z(a,"string",U,"category");var c=this.diagram,d=this.data,e=null;if(null!==c&&null!==d&&!(this instanceof Cf)){var f=c.model.undoManager;f.isEnabled&&!f.isUndoingRedoing&&(e=this.clone(),e.Z.addAll(this.Z))}this.Cf=a;this.g("category",b,a);null===c||null===d||this instanceof Cf?this instanceof Cf&&(e=this.adornedPart,null!==e&&(a=e.Af,null!==a&&a.remove(b),e.rh(this.category,this))):(f=c.model,f.undoManager.isUndoingRedoing||
(this.Bh()?(c.partManager.setLinkCategoryForData(d,a),c=c.partManager.findLinkTemplateForCategory(a),null!==c&&(mh(c),c=c.copy(),null!==c&&Fo(this,c,b,a))):(null!==f&&f.zq(d,a),c=No(c.partManager,d,a),null!==c&&(mh(c),c=c.copy(),null===c||c instanceof T||(d=this.location.copy(),Fo(this,c,b,a),this.location.o()||(this.location=d)))),null!==e&&(b=this.clone(),b.Z.addAll(this.Z),this.g("self",e,b))))}}},self:{configurable:!0,get:function(){return this},set:function(a){Fo(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&&(E&&z(a,"boolean",U,"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&&(E&&z(a,"boolean",U,"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&&(E&&z(a,"boolean",U,"textEditable"),this.F^=4,this.g("textEditable",b,a),this.Mb())}},groupable:{configurable:!0,get:function(){return 0!==(this.F&8)},set:function(a){var b=0!==(this.F&8);b!==a&&(E&&z(a,"boolean",U,"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&&(E&&z(a,"boolean",U,"movable"),this.F^=16,this.g("movable",b,a))}},selectionAdorned:{configurable:!0,
enumerable:!0,get:function(){return 0!==(this.F&32)},set:function(a){var b=0!==(this.F&32);b!==a&&(E&&z(a,"boolean",U,"selectionAdorned"),this.F^=32,this.g("selectionAdorned",b,a),this.Mb())}},isInDocumentBounds:{configurable:!0,get:function(){return 0!==(this.F&64)},set:function(a){var b=0!==(this.F&64);if(b!==a){E&&z(a,"boolean",U,"isInDocumentBounds");this.F^=64;var c=this.diagram;null!==c&&c.Ya();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&&(E&&z(a,"boolean",U,"isLayoutPositioned"),this.F^=128,this.g("isLayoutPositioned",b,a),this.C(a?4:8))}},selectable:{configurable:!0,get:function(){return 0!==(this.F&256)},set:function(a){var b=0!==(this.F&256);b!==a&&(E&&z(a,"boolean",U,"selectable"),this.F^=256,this.g("selectable",b,a),this.Mb())}},reshapable:{configurable:!0,get:function(){return 0!==(this.F&512)},set:function(a){var b=
0!==(this.F&512);b!==a&&(E&&z(a,"boolean",U,"reshapable"),this.F^=512,this.g("reshapable",b,a),this.Mb())}},resizable:{configurable:!0,get:function(){return 0!==(this.F&1024)},set:function(a){var b=0!==(this.F&1024);b!==a&&(E&&z(a,"boolean",U,"resizable"),this.F^=1024,this.g("resizable",b,a),this.Mb())}},rotatable:{configurable:!0,get:function(){return 0!==(this.F&2048)},set:function(a){var b=0!==(this.F&2048);b!==a&&(E&&z(a,"boolean",U,"rotatable"),this.F^=2048,this.g("rotatable",
b,a),this.Mb())}},isSelected:{configurable:!0,get:function(){return 0!==(this.F&4096)},set:function(a){var b=0!==(this.F&4096);if(b!==a){E&&z(a,"boolean",U,"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.ja();a?e.add(this):e.remove(this);e.freeze()}this.g("isSelected",b,a);this.Mb();a=this.selectionChanged;null!==a&&a(this);
null!==c&&(c.ec(),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){E&&z(a,"boolean",U,"isHighlighted");this.F^=524288;var c=this.diagram;null!==c&&(c=c.highlighteds,c.ja(),a?c.add(this):c.remove(this),c.freeze());this.g("isHighlighted",b,a);this.S();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&&(E&&z(a,"boolean",U,"isShadowed"),this.F^=8192,this.g("isShadowed",b,a),this.S())}},isAnimated:{configurable:!0,get:function(){return 0!==(this.F&262144)},set:function(a){var b=0!==(this.F&262144);b!==a&&(E&&z(a,"boolean",U,"isAnimated"),this.F^=262144,this.g("isAnimated",b,a))}},highlightedChanged:{configurable:!0,get:function(){return this.Rn},set:function(a){var b=this.Rn;b!==a&&(null!==a&&z(a,"function",U,"highlightedChanged"),this.Rn=a,this.g("highlightedChanged",
b,a))}},selectionObjectName:{configurable:!0,get:function(){return this.qp},set:function(a){var b=this.qp;b!==a&&(E&&z(a,"string",U,"selectionObjectName"),this.qp=a,this.eh=null,this.g("selectionObjectName",b,a))}},selectionAdornmentTemplate:{configurable:!0,get:function(){return this.op},set:function(a){var b=this.op;b!==a&&(E&&w(a,Cf,U,"selectionAdornmentTemplate"),this.op=a,this.g("selectionAdornmentTemplate",b,a))}},selectionObject:{configurable:!0,get:function(){if(null===
this.eh){var a=this.selectionObjectName;null!==a&&""!==a?(a=this.bb(a),null!==a?this.eh=a:this.eh=this):this instanceof T?(a=this.path,null!==a?this.eh=a:this.eh=this):this.eh=this}return this.eh}},selectionChanged:{configurable:!0,get:function(){return this.pp},set:function(a){var b=this.pp;b!==a&&(null!==a&&z(a,"function",U,"selectionChanged"),this.pp=a,this.g("selectionChanged",b,a))}},resizeAdornmentTemplate:{configurable:!0,get:function(){return this.$o},set:function(a){var b=
this.$o;b!==a&&(E&&w(a,Cf,U,"resizeAdornmentTemplate"),this.$o=a,this.g("resizeAdornmentTemplate",b,a))}},resizeObjectName:{configurable:!0,get:function(){return this.bp},set:function(a){var b=this.bp;b!==a&&(E&&z(a,"string",U,"resizeObjectName"),this.bp=a,this.g("resizeObjectName",b,a))}},resizeObject:{configurable:!0,get:function(){var a=this.resizeObjectName;return""!==a&&(a=this.bb(a),null!==a)?a:this}},resizeCellSize:{configurable:!0,get:function(){return this.ap},
set:function(a){var b=this.ap;b.A(a)||(E&&w(a,Zb,U,"resizeCellSize"),this.ap=a=a.J(),this.g("resizeCellSize",b,a))}},rotateAdornmentTemplate:{configurable:!0,get:function(){return this.cp},set:function(a){var b=this.cp;b!==a&&(E&&w(a,Cf,U,"rotateAdornmentTemplate"),this.cp=a,this.g("rotateAdornmentTemplate",b,a))}},rotateObjectName:{configurable:!0,get:function(){return this.ep},set:function(a){var b=this.ep;b!==a&&(E&&z(a,"string",U,"rotateObjectName"),this.ep=a,this.g("rotateObjectName",
b,a))}},rotateObject:{configurable:!0,get:function(){var a=this.rotateObjectName;return""!==a&&(a=this.bb(a),null!==a)?a:this}},rotationSpot:{configurable:!0,get:function(){return this.fp},set:function(a){var b=this.fp;b.A(a)||(E&&(w(a,M,U,"rotationSpot"),a===Qd||a.Za()||v("Part.rotationSpot must be a specific Spot value or Spot.Default, not: "+a)),this.fp=a=a.J(),this.g("rotationSpot",b,a))}},text:{configurable:!0,get:function(){return this.Rb},set:function(a){var b=
this.Rb;b!==a&&(E&&z(a,"string",U,"text"),this.Rb=a,this.g("text",b,a))}},containingGroup:{configurable:!0,get:function(){return this.Uh},set:function(a){if(this.dc()){var b=this.Uh;if(b!==a){E&&null!==a&&w(a,xg,U,"containingGroup");null===a||this!==a&&!a.Xd(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.C(2);var c=this.diagram;null!==b?Jo(b,this):
this instanceof xg&&null!==c&&c.Bi.remove(this);this.Uh=a;null!==a?Io(a,this):this instanceof xg&&null!==c&&c.Bi.add(this);this.C(1);if(null!==c){var d=this.data,e=c.model;if(null!==d&&e.Ti()){var f=e.ra(null!==a?a.data:null);e.zt(d,f)}}d=this.containingGroupChanged;null!==d&&(e=!0,null!==c&&(e=c.fa,c.fa=!0),d(this,b,a),null!==c&&(c.fa=e));if(this instanceof xg)for(c=new H,Yk(c,this,!0,0,!0),c=c.iterator;c.next();)if(d=c.value,d instanceof V)for(d=d.linksConnected;d.next();)Oo(d.value);if(this instanceof
V){for(c=this.linksConnected;c.next();)Oo(c.value);c=this.labeledLink;null!==c&&Oo(c)}this.g("containingGroup",b,a);null!==a&&(b=a.layer,null!==b&&Ai(b,-1,a))}}else v("cannot set the Part.containingGroup of a Link or Adornment")}},containingGroupChanged:{configurable:!0,get:function(){return this.dn},set:function(a){var b=this.dn;b!==a&&(null!==a&&z(a,"function",U,"containingGroupChanged"),this.dn=a,this.g("containingGroupChanged",b,a))}},isTopLevel:{configurable:!0,get:function(){return null!==
this.containingGroup||this instanceof V&&null!==this.labeledLink?!1:!0}},layoutConditions:{configurable:!0,get:function(){return this.ho},set:function(a){var b=this.ho;b!==a&&(E&&z(a,"number",U,"layoutConditions"),this.ho=a,this.g("layoutConditions",b,a))}},dragComputation:{configurable:!0,get:function(){return this.An},set:function(a){var b=this.An;b!==a&&(null!==a&&z(a,"function",U,"dragComputation"),this.An=a,this.g("dragComputation",b,a))}},shadowOffset:{configurable:!0,
enumerable:!0,get:function(){return this.wi},set:function(a){var b=this.wi;b.A(a)||(E&&w(a,J,U,"shadowOffset"),this.wi=a=a.J(),this.S(),this.g("shadowOffset",b,a))}},shadowColor:{configurable:!0,get:function(){return this.Mj},set:function(a){var b=this.Mj;b!==a&&(E&&z(a,"string",U,"shadowColor"),this.Mj=a,this.S(),this.g("shadowColor",b,a))}},shadowBlur:{configurable:!0,get:function(){return this.Qd},set:function(a){var b=this.Qd;b!==a&&(E&&z(a,"number",U,"shadowBlur"),
this.Qd=a,this.S(),this.g("shadowBlur",b,a))}}});U.prototype.invalidateLayout=U.prototype.C;U.prototype.findCommonContainingGroup=U.prototype.mx;U.prototype.isMemberOf=U.prototype.Xd;U.prototype.findTopLevelPart=U.prototype.ez;U.prototype.findSubGraphLevel=U.prototype.bz;U.prototype.ensureBounds=U.prototype.bc;U.prototype.getDocumentBounds=U.prototype.eq;U.prototype.getRelativePoint=U.prototype.sf;U.prototype.findObject=U.prototype.bb;U.prototype.moveTo=U.prototype.moveTo;
U.prototype.invalidateAdornments=U.prototype.Mb;U.prototype.clearAdornments=U.prototype.Wj;U.prototype.removeAdornment=U.prototype.xf;U.prototype.addAdornment=U.prototype.rh;U.prototype.findAdornment=U.prototype.dk;U.prototype.updateTargetBindings=U.prototype.Fa;var Go=!1;U.className="Part";U.LayoutNone=0;U.LayoutAdded=1;U.LayoutRemoved=2;U.LayoutShown=4;U.LayoutHidden=8;U.LayoutNodeSized=16;U.LayoutGroupLayout=32;U.LayoutNodeReplaced=64;U.LayoutStandard=127;U.LayoutAll=16777215;
function Cf(a){U.call(this,a);this.F&=-257;this.Vg="Adornment";this.ce=null;this.Kw=0;this.Vw=!1;this.l=[];this.Pa=null}ma(Cf,U);Cf.prototype.toString=function(){var a=this.adornedPart;return"Adornment("+this.category+")"+(null!==a?a.toString():"")};Cf.prototype.updateRelationshipsFromData=function(){};
Cf.prototype.kk=function(a){var b=this.adornedObject.part;if(b instanceof T&&this.adornedObject instanceof Hg){var c=b.path;b.kk(a);a=c.geometry;b=this.Z.j;c=b.length;for(var d=0;d<c;d++){var e=b[d];e.isPanelMain&&e instanceof Hg&&(e.sa=a)}}};Cf.prototype.Vi=function(){var a=this.ce;if(null===a)return!0;a=a.part;return null===a||!Fj(a)};Cf.prototype.dc=function(){return!1};
Cf.prototype.sk=function(a,b,c,d,e,f,g){if(a===qf&&"elements"===b)if(e instanceof lh)null===this.Pa?this.Pa=e:E&&this.Pa!==e&&v("Cannot insert a second Placeholder into the visual tree of an Adornment.");else{if(e instanceof W){var h=e.cm(function(a){return a instanceof lh});h instanceof lh&&(null===this.Pa?this.Pa=h:E&&this.Pa!==h&&v("Cannot insert a second Placeholder into the visual tree of an Adornment."))}}else a===rf&&"elements"===b&&null!==this.Pa&&(d===this.Pa?this.Pa=null:d instanceof W&&
this.Pa.vg(d)&&(this.Pa=null));U.prototype.sk.call(this,a,b,c,d,e,f,g)};Cf.prototype.updateAdornments=function(){};Cf.prototype.bk=function(){};
na.Object.defineProperties(Cf.prototype,{placeholder:{configurable:!0,get:function(){return this.Pa}},adornedObject:{configurable:!0,get:function(){return this.ce},set:function(a){E&&null!==a&&w(a,N,U,"adornedObject:value");var b=this.adornedPart,c=null;null!==a&&(c=a.part);null===b||null!==a&&b===c||b.xf(this.category);this.ce=a;null!==c&&c.rh(this.category,this)}},adornedPart:{configurable:!0,get:function(){var a=this.ce;return null!==a?a.part:null}},containingGroup:{configurable:!0,
enumerable:!0,get:function(){return null}}});Cf.className="Adornment";function V(a){U.call(this,a);this.T=13;this.$a=new F;this.Jp=this.ml=this.li=this.jo=this.io=null;this.Hk=$c;this.tc=this.Oe=null;this.Xo=Po;this.ph=!1}ma(V,U);V.prototype.cloneProtected=function(a){U.prototype.cloneProtected.call(this,a);a.T=this.T;a.T=this.T&-17;a.io=this.io;a.jo=this.jo;a.li=this.li;a.Jp=this.Jp;a.Hk=this.Hk.J();a.Xo=this.Xo};t=V.prototype;
t.rf=function(a){U.prototype.rf.call(this,a);a.gd();a.Oe=this.Oe;a.tc=null};function Qo(a,b){null!==b&&(null===a.Oe&&(a.Oe=new H),a.Oe.add(b))}function Ro(a,b,c,d){if(null===b||null===a.Oe)return null;for(var e=a.Oe.iterator;e.next();){var f=e.value;if(f.ot===a&&f.wv===b&&f.Ex===c&&f.Fx===d||f.ot===b&&f.wv===a&&f.Ex===d&&f.Fx===c)return f}return null}t.Cz=function(a,b,c){if(void 0===b||null===b)b="";if(void 0===c||null===c)c="";a=Ro(this,a,b,c);null!==a&&a.hm()};
t.sk=function(a,b,c,d,e,f,g){a===qf&&"elements"===b?this.tc=null:a===rf&&"elements"===b&&(this.tc=null);U.prototype.sk.call(this,a,b,c,d,e,f,g)};t.gd=function(a){void 0===a&&(a=null);for(var b=this.linksConnected;b.next();){var c=b.value;null!==a&&a.contains(c)||(So(this,c.fromPort),So(this,c.toPort),c.Ta())}};function ul(a,b){for(var c=a.linksConnected;c.next();){var d=c.value;if(d.fromPort===b||d.toPort===b)So(a,d.fromPort),So(a,d.toPort),d.Ta()}}
function So(a,b){null!==b&&(b=b.Wo,null!==b&&b.hm(),a=a.containingGroup,null===a||a.isSubGraphExpanded||So(a,a.port))}t.Vi=function(){return!0};V.prototype.getAvoidableRect=function(a){a.set(this.actualBounds);a.Sp(this.Hk);return a};V.prototype.findVisibleNode=function(){for(var a=this;null!==a&&!a.isVisible();)a=a.containingGroup;return a};
V.prototype.isVisible=function(){if(!U.prototype.isVisible.call(this))return!1;var a=!0,b=Hi,c=this.diagram;if(null!==c){if(mi(c.animationManager,this))return!0;a=c.isTreePathToChildren;b=c.treeCollapsePolicy}if(b===Hi){if(a=this.tg(),null!==a&&!a.isTreeExpanded)return!1}else if(b===Mk){if(a=a?this.gv():this.hv(),0<a.count&&a.all(function(a){return!a.isTreeExpanded}))return!1}else if(b===Nk&&(a=a?this.gv():this.hv(),0<a.count&&a.any(function(a){return!a.isTreeExpanded})))return!1;a=this.labeledLink;
return null!==a?a.isVisible():!0};t=V.prototype;t.Ob=function(a){U.prototype.Ob.call(this,a);for(var b=this.linksConnected;b.next();)b.value.Ob(a)};t.ev=function(a){void 0===a&&(a=null);if(null===a)return this.$a.iterator;E&&z(a,"string",V,"findLinksConnected:pid");var b=new Gb(this.$a),c=this;b.predicate=function(b){return b.fromNode===c&&b.fromPortId===a||b.toNode===c&&b.toPortId===a};return b};
t.aq=function(a){void 0===a&&(a=null);E&&null!==a&&z(a,"string",V,"findLinksOutOf:pid");var b=new Gb(this.$a),c=this;b.predicate=function(b){return b.fromNode!==c?!1:null===a?!0:b.fromPortId===a};return b};t.ud=function(a){void 0===a&&(a=null);E&&null!==a&&z(a,"string",V,"findLinksInto:pid");var b=new Gb(this.$a),c=this;b.predicate=function(b){return b.toNode!==c?!1:null===a?!0:b.toPortId===a};return b};
t.fv=function(a){void 0===a&&(a=null);E&&null!==a&&z(a,"string",V,"findNodesConnected:pid");for(var b=null,c=null,d=this.$a.iterator;d.next();){var e=d.value;if(e.fromNode===this){if(null===a||e.fromPortId===a)e=e.toNode,null!==b?b.add(e):null!==c&&c!==e?(b=new H,b.add(c),b.add(e)):c=e}else e.toNode!==this||null!==a&&e.toPortId!==a||(e=e.fromNode,null!==b?b.add(e):null!==c&&c!==e?(b=new H,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new Eb(c):Db};
t.hv=function(a){void 0===a&&(a=null);E&&null!==a&&z(a,"string",V,"findNodesOutOf:pid");for(var b=null,c=null,d=this.$a.iterator;d.next();){var e=d.value;e.fromNode!==this||null!==a&&e.fromPortId!==a||(e=e.toNode,null!==b?b.add(e):null!==c&&c!==e?(b=new H,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new Eb(c):Db};
t.gv=function(a){void 0===a&&(a=null);E&&null!==a&&z(a,"string",V,"findNodesInto:pid");for(var b=null,c=null,d=this.$a.iterator;d.next();){var e=d.value;e.toNode!==this||null!==a&&e.toPortId!==a||(e=e.fromNode,null!==b?b.add(e):null!==c&&c!==e?(b=new H,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new Eb(c):Db};
t.Xy=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);E&&(w(a,V,V,"findLinksBetween:othernode"),null!==b&&z(b,"string",V,"findLinksBetween:pid"),null!==c&&z(c,"string",V,"findLinksBetween:otherpid"));var d=new Gb(this.$a),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.Yy=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);E&&(w(a,V,V,"findLinksTo:othernode"),null!==b&&z(b,"string",V,"findLinksTo:pid"),null!==c&&z(c,"string",V,"findLinksTo:otherpid"));var d=new Gb(this.$a),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 To(a,b,c){So(a,c);var d=a.$a.contains(b);d||a.$a.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.fa,g.fa=!0);e(a,b,c);null!==g&&(g.fa=f)}}!d&&b.isTreeLink&&(c=b.fromNode,b=b.toNode,null!==c&&null!==b&&c!==b&&(d=!0,a=a.diagram,null!==a&&(d=a.isTreePathToChildren),e=d?b:c,f=d?c:b,e.ph||(e.ph=f),!f.isTreeLeaf||null!==a&&a.undoManager.isUndoingRedoing||(d?c===f&&(f.isTreeLeaf=!1):b===f&&(f.isTreeLeaf=!1))))}
function Uo(a,b,c){So(a,c);var d=a.$a.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.fa,e.fa=!0);f(a,b,c);null!==e&&(e.fa=g)}}d&&b.isTreeLink&&(c=!0,null!==e&&(c=e.isTreePathToChildren),a=c?b.toNode:b.fromNode,b=c?b.fromNode:b.toNode,null!==a&&(a.ph=!1),null===b||b.isTreeLeaf||(0===b.$a.count?(b.ph=null,null!==e&&e.undoManager.isUndoingRedoing||(b.isTreeLeaf=!0)):Lk(b)))}
function Lk(a){a.ph=!1;if(0!==a.$a.count){var b=!0,c=a.diagram;if(null===c||!c.undoManager.isUndoingRedoing){null!==c&&(b=c.isTreePathToChildren);for(c=a.$a.iterator;c.next();){var d=c.value;if(d.isTreeLink)if(b){if(d.fromNode===a){a.isTreeLeaf=!1;return}}else if(d.toNode===a){a.isTreeLeaf=!1;return}}a.isTreeLeaf=!0}}}V.prototype.updateRelationshipsFromData=function(){var a=this.diagram;null!==a&&a.partManager.updateRelationshipsFromData(this)};t=V.prototype;
t.hq=function(a){U.prototype.hq.call(this,a);a||(Lk(this),a=this.ml,null!==a&&Vo(a,this))};t.iq=function(a){U.prototype.iq.call(this,a);a||(a=this.ml,null!==a&&null!==a.bd&&(a.bd.remove(this),a.v()))};
t.bk=function(){if(0<this.$a.count){var a=this.diagram;if(null!==a)for(var b=null!==a.commandHandler?a.commandHandler.deletesConnectedLinks:!0,c=this.$a.copy().iterator;c.next();){var d=c.value;b?a.remove(d):(d.fromNode===this&&(d.fromNode=null),d.toNode===this&&(d.toNode=null))}}this.labeledLink=null;U.prototype.bk.call(this)};
t.Ys=function(a){E&&z(a,"string",V,"findPort:pid");if(null===this.tc){if(""===a&&!1===this.zh)return this;Wo(this)}var b=this.tc.K(a);return null!==b||""!==a&&(b=this.tc.K(""),null!==b)?b:this};function Wo(a){null===a.tc?a.tc=new Ub:a.tc.clear();a.xk(a,function(a,c){Yl(a,c)});0===a.tc.count&&a.tc.add("",a)}function Yl(a,b){var c=b.portId;null!==c&&null!==a.tc&&a.tc.add(c,b)}
function Xl(a,b,c){var d=b.portId;if(null!==d&&(null!==a.tc&&a.tc.remove(d),b=a.diagram,null!==b&&c)){c=null;for(a=a.ev(d);a.next();)d=a.value,null===c&&(c=Qa()),c.push(d);if(null!==c){for(a=0;a<c.length;a++)b.remove(c[a]);Ta(c)}}}
t.Ez=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.$a.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.$a.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.iz=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this;if(a)for(;;){a=null;for(var c=b.$a.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.$a.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.Uy=function(a){if(null===a)return null;E&&w(a,V,V,"findCommonTreeParent:other");if(this===a)return this;for(var b=this;null!==b;)Ho(b,!0),b=b.tg();var c=null;for(b=a;null!==b;){if(0!==(b.F&1048576)){c=b;break}b=b.tg()}for(b=this;null!==b;)Ho(b,!1),b=b.tg();return c};
t.Mi=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this.$a.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.tg=function(){var a=this.ph;if(null===a)return null;if(a instanceof V)return a;var b=!0;a=this.diagram;null!==a&&(b=a.isTreePathToChildren);a=this.$a.iterator;if(b)for(;a.next();){if(b=a.value,b.isTreeLink&&(b=b.fromNode,b!==this))return this.ph=b}else for(;a.next();)if(b=a.value,b.isTreeLink&&(b=b.toNode,b!==this))return this.ph=b;return this.ph=null};t.gz=function(){function a(b,d){if(null!==b){d.add(b);var c=b.Mi();null!==c&&(d.add(c),a(b.tg(),d))}}var b=new H;a(this,b);return b};
t.fz=function(){return Xo(this,this)};function Xo(a,b){b=b.tg();return null===b?0:1+Xo(a,b)}t.cq=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=new Gb(this.$a);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.iv=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);var c=b=null,d=this.$a.iterator;if(a)for(;d.next();)a=d.value,a.isTreeLink&&a.fromNode===this&&(a=a.toNode,null!==b?b.add(a):null!==c&&c!==a?(b=new F,b.add(c),b.add(a)):c=a);else for(;d.next();)a=d.value,a.isTreeLink&&a.toNode===this&&(a=a.fromNode,null!==b?b.add(a):null!==c&&c!==a?(b=new F,b.add(c),b.add(a)):c=a);return null!==b?b.iterator:null!==c?new Eb(c):Db};
t.hz=function(a){void 0===a&&(a=Infinity);z(a,"number",V,"findTreeParts:level");var b=new H;Yk(b,this,!1,a,!0);return b};V.prototype.collapseTree=function(a){void 0===a&&(a=1);B(a,V,"collapseTree:level");1>a&&(a=1);var b=this.diagram;if(null!==b&&!b.Ie){b.Ie=!0;var c=new H;c.add(this);Yo(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===Hi);b.Ie=!1}};
function Yo(a,b,c,d,e,f,g){if(1<d)for(var h=c?a.aq():a.ud();h.next();){var k=h.value;k.isTreeLink&&(k=k.bt(a),null===k||k===a||b.contains(k)||(b.add(k),Yo(k,b,c,d-1,e,f,g)))}else Zo(a,b,c,e,f,g)}
function Zo(a,b,c,d,e,f){for(var g=e===a?!0:a.isTreeExpanded,h=c?a.aq():a.ud();h.next();){var k=h.value;if(k.isTreeLink&&(k=k.bt(a),null!==k&&k!==a)){var l=b.contains(k);l||b.add(k);g&&(f&&d.Qp(k,e),k.Ah(),k.Ob(!1));k.isTreeExpanded&&(k.wasTreeExpanded=k.isTreeExpanded,l||Zo(k,b,c,d,e,f))}}a.isTreeExpanded=!1}
V.prototype.expandTree=function(a){void 0===a&&(a=2);B(a,V,"expandTree:level");2>a&&(a=2);var b=this.diagram;if(null!==b&&!b.Ie){b.Ie=!0;var c=new H;c.add(this);$o(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===Hi);b.Ie=!1}};
function $o(a,b,c,d,e,f,g){for(var h=f===a?!1:a.isTreeExpanded,k=c?a.aq():a.ud();k.next();){var l=k.value;l.isTreeLink&&(h||l.Mc||l.Ta(),l=l.bt(a),null!==l&&l!==a&&!b.contains(l)&&(b.add(l),h||(l.Ob(!0),l.Ah(),g&&e.Rp(l,f)),2<d||l.wasTreeExpanded))&&(l.wasTreeExpanded=!1,$o(l,b,c,d-1,e,f,g))}a.isTreeExpanded=!0}
na.Object.defineProperties(V.prototype,{portSpreading:{configurable:!0,get:function(){return this.Xo},set:function(a){var b=this.Xo;b!==a&&(E&&tb(a,V,V,"portSpreading"),this.Xo=a,this.g("portSpreading",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.gd())}},avoidable:{configurable:!0,get:function(){return 0!==(this.T&8)},set:function(a){var b=0!==(this.T&8);if(b!==a){E&&z(a,"boolean",V,"avoidable");this.T^=8;var c=this.diagram;null!==c&&Ek(c,this);this.g("avoidable",
b,a)}}},avoidableMargin:{configurable:!0,get:function(){return this.Hk},set:function(a){"number"===typeof a?a=new Hc(a):w(a,Hc,V,"avoidableMargin");var b=this.Hk;if(!b.A(a)){this.Hk=a=a.J();var c=this.diagram;null!==c&&Ek(c,this);this.g("avoidableMargin",b,a)}}},linksConnected:{configurable:!0,get:function(){return this.$a.iterator}},linkConnected:{configurable:!0,get:function(){return this.io},set:function(a){var b=this.io;b!==a&&(null!==a&&z(a,"function",
V,"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&&z(a,"function",V,"linkDisconnected"),this.jo=a,this.g("linkDisconnected",b,a))}},linkValidation:{configurable:!0,get:function(){return this.li},set:function(a){var b=this.li;b!==a&&(null!==a&&z(a,"function",V,"linkValidation"),this.li=a,this.g("linkValidation",b,a))}},isLinkLabel:{configurable:!0,
get:function(){return null!==this.ml}},labeledLink:{configurable:!0,get:function(){return this.ml},set:function(a){var b=this.ml;if(b!==a){E&&null!==a&&w(a,T,V,"labeledLink");var c=this.diagram,d=this.data;if(null!==b){null!==b.bd&&(b.bd.remove(this),b.v());if(null!==c&&null!==d&&!c.undoManager.isUndoingRedoing){var e=b.data,f=c.model;if(null!==e&&f.jm()){var g=f.ra(d);void 0!==g&&f.Gx(e,g)}}this.containingGroup=null}this.ml=a;null!==a&&(Vo(a,this),null===c||null===d||c.undoManager.isUndoingRedoing||
(e=a.data,c=c.model,null!==e&&c.jm()&&(d=c.ra(d),void 0!==d&&c.Mu(e,d))),this.containingGroup=a.containingGroup);Il(this);this.g("labeledLink",b,a)}}},port:{configurable:!0,get:function(){return this.Ys("")}},ports:{configurable:!0,get:function(){null===this.tc&&Wo(this);return this.tc.iteratorValues}},isTreeExpanded:{configurable:!0,get:function(){return 0!==(this.T&1)},set:function(a){var b=0!==(this.T&1);if(b!==a){E&&z(a,"boolean",V,"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.fa,c.fa=!0);b(this);null!==c&&(c.fa=d)}null!==c&&c.undoManager.isUndoingRedoing?this.Ob(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&&(E&&z(a,"boolean",V,"wasTreeExpanded"),this.T^=2,this.g("wasTreeExpanded",b,a))}},treeExpandedChanged:{configurable:!0,
get:function(){return this.Jp},set:function(a){var b=this.Jp;b!==a&&(null!==a&&z(a,"function",V,"treeExpandedChanged"),this.Jp=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&&(E&&z(a,"boolean",V,"isTreeLeaf"),this.T^=4,this.g("isTreeLeaf",b,a))}}});V.prototype.expandTree=V.prototype.expandTree;V.prototype.collapseTree=V.prototype.collapseTree;V.prototype.findTreeParts=V.prototype.hz;
V.prototype.findTreeChildrenNodes=V.prototype.iv;V.prototype.findTreeChildrenLinks=V.prototype.cq;V.prototype.findTreeLevel=V.prototype.fz;V.prototype.findTreeParentChain=V.prototype.gz;V.prototype.findTreeParentNode=V.prototype.tg;V.prototype.findTreeParentLink=V.prototype.Mi;V.prototype.findCommonTreeParent=V.prototype.Uy;V.prototype.findTreeRoot=V.prototype.iz;V.prototype.isInTreeOf=V.prototype.Ez;V.prototype.findPort=V.prototype.Ys;V.prototype.findLinksTo=V.prototype.Yy;
V.prototype.findLinksBetween=V.prototype.Xy;V.prototype.findNodesInto=V.prototype.gv;V.prototype.findNodesOutOf=V.prototype.hv;V.prototype.findNodesConnected=V.prototype.fv;V.prototype.findLinksInto=V.prototype.ud;V.prototype.findLinksOutOf=V.prototype.aq;V.prototype.findLinksConnected=V.prototype.ev;V.prototype.invalidateConnectedLinks=V.prototype.gd;V.prototype.invalidateLinkBundle=V.prototype.Cz;var ap=new D(V,"SpreadingNone",10),Po=new D(V,"SpreadingEvenly",11),bp=new D(V,"SpreadingPacked",12);
V.className="Node";V.SpreadingNone=ap;V.SpreadingEvenly=Po;V.SpreadingPacked=bp;function xg(a){V.call(this,a);this.T|=4608;this.so=new H;this.wl=new H;this.Pa=this.Bp=this.mi=this.to=this.ro=null;this.ic=new Oi;this.ic.group=this}ma(xg,V);
xg.prototype.cloneProtected=function(a){V.prototype.cloneProtected.call(this,a);this.T=this.T&-32769;a.ro=this.ro;a.to=this.to;a.mi=this.mi;a.Bp=this.Bp;var b=a.cm(function(a){return a instanceof lh});b instanceof lh?a.Pa=b:a.Pa=null;null!==this.ic?(a.ic=this.ic.copy(),a.ic.group=a):(null!==a.ic&&(a.ic.group=null),a.ic=null)};t=xg.prototype;
t.rf=function(a){V.prototype.rf.call(this,a);var b=a.ek();for(a=a.memberParts;a.next();){var c=a.value;c.v();c.C(8);c.Wj();if(c instanceof V)c.gd(b);else if(c instanceof T)for(c=c.labelNodes;c.next();)c.value.gd(b)}};
t.sk=function(a,b,c,d,e,f,g){if(a===qf&&"elements"===b)if(e instanceof lh)null===this.Pa?this.Pa=e:this.Pa!==e&&v("Cannot insert a second Placeholder into the visual tree of a Group.");else{if(e instanceof W){var h=e.cm(function(a){return a instanceof lh});h instanceof lh&&(null===this.Pa?this.Pa=h:this.Pa!==h&&v("Cannot insert a second Placeholder into the visual tree of a Group."))}}else a===rf&&"elements"===b&&null!==this.Pa&&(d===this.Pa?this.Pa=null:d instanceof W&&this.Pa.vg(d)&&(this.Pa=null));
V.prototype.sk.call(this,a,b,c,d,e,f,g)};t.vh=function(a,b,c,d){this.Ze=this.Pa;V.prototype.vh.call(this,a,b,c,d)};t.Vi=function(){if(!V.prototype.Vi.call(this))return!1;for(var a=this.memberParts;a.next();){var b=a.value;if(b instanceof V){if(b.isVisible()&&Fj(b))return!1}else if(b instanceof T&&b.isVisible()&&Fj(b)&&b.fromNode!==this&&b.toNode!==this)return!1}return!0};
function Io(a,b){if(a.so.add(b)){b instanceof xg&&a.wl.add(b);var c=a.memberAdded;if(null!==c){var d=!0,e=a.diagram;null!==e&&(d=e.fa,e.fa=!0);c(a,b);null!==e&&(e.fa=d)}a.isVisible()&&a.isSubGraphExpanded||b.Ob(!1)}b instanceof T&&!a.computesBoundsIncludingLinks||(b=a.Pa,null===b&&(b=a),b.v())}
function Jo(a,b){if(a.so.remove(b)){b instanceof xg&&a.wl.remove(b);var c=a.memberRemoved;if(null!==c){var d=!0,e=a.diagram;null!==e&&(d=e.fa,e.fa=!0);c(a,b);null!==e&&(e.fa=d)}a.isVisible()&&a.isSubGraphExpanded||b.Ob(!0)}b instanceof T&&!a.computesBoundsIncludingLinks||(b=a.Pa,null===b&&(b=a),b.v())}t.bk=function(){if(0<this.so.count){var a=this.diagram;if(null!==a)for(var b=this.so.copy().iterator;b.next();)a.remove(b.value)}V.prototype.bk.call(this)};
xg.prototype.canAddMembers=function(a){var b=this.diagram;if(null===b)return!1;b=b.commandHandler;for(a=$k(a).iterator;a.next();)if(!b.isValidMember(this,a.value))return!1;return!0};xg.prototype.addMembers=function(a,b){var c=this.diagram;if(null===c)return!1;c=c.commandHandler;var d=!0;for(a=$k(a).iterator;a.next();){var e=a.value;!b||c.isValidMember(this,e)?e.containingGroup=this:d=!1}return d};
xg.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=xg.prototype;
t.gd=function(a){void 0===a&&(a=null);var b=0!==(this.T&65536);V.prototype.gd.call(this,a);if(!b)for(0!==(this.T&65536)!==!0&&(this.T=this.T^65536),b=this.dv();b.next();){var c=b.value;if(null===a||!a.contains(c)){var d=c.fromNode;null!==d&&d!==this&&d.Xd(this)&&!d.isVisible()?(So(d,c.fromPort),So(d,c.toPort),c.Ta()):(d=c.toNode,null!==d&&d!==this&&d.Xd(this)&&!d.isVisible()&&(So(d,c.fromPort),So(d,c.toPort),c.Ta()))}}};
t.dv=function(){var a=this.ek();a.add(this);for(var b=new H,c=a.iterator;c.next();){var d=c.value;if(d instanceof V)for(d=d.linksConnected;d.next();){var e=d.value;a.contains(e)||b.add(e)}}return b.iterator};t.Wy=function(){var a=this.ek();a.add(this);for(var b=new H,c=a.iterator;c.next();){var d=c.value;if(d instanceof V)for(d=d.linksConnected;d.next();){var e=d.value,f=e.fromNode;a.contains(f)&&f!==this||b.add(f);e=e.toNode;a.contains(e)&&e!==this||b.add(e)}}return b.iterator};
t.Vy=function(){function a(b,d){null!==b&&(d.add(b),a(b.containingGroup,d))}var b=new H;a(this,b);return b};t.ek=function(){var a=new H;Yk(a,this,!0,0,!0);a.remove(this);return a};t.Ob=function(a){V.prototype.Ob.call(this,a);for(var b=this.memberParts;b.next();)b.value.Ob(a)};xg.prototype.collapseSubGraph=function(){var a=this.diagram;if(null!==a&&!a.Ie){a.Ie=!0;var b=this.ek();cp(this,b,a,this);a.Ie=!1}};
function cp(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Ob(!1);f instanceof xg&&f.isSubGraphExpanded&&(f.wasSubGraphExpanded=f.isSubGraphExpanded,cp(f,b,c,d));if(f instanceof V)f.gd(b),c.Qp(f,d);else if(f instanceof T)for(f=f.labelNodes;f.next();)f.value.gd(b)}a.isSubGraphExpanded=!1}xg.prototype.expandSubGraph=function(){var a=this.diagram;if(null!==a&&!a.Ie){a.Ie=!0;var b=this.ek();dp(this,b,a,this);a.Ie=!1}};
function dp(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Ob(!0);f instanceof xg&&f.wasSubGraphExpanded&&(f.wasSubGraphExpanded=!1,dp(f,b,c,d));if(f instanceof V)f.gd(b),c.Rp(f,d);else if(f instanceof T)for(f=f.labelNodes;f.next();)f.value.gd(b)}a.isSubGraphExpanded=!0}
xg.prototype.move=function(a,b){void 0===b&&(b=!1);var c=b?this.location:this.position,d=c.x;c=c.y;var e=a.x,f=a.y;if(!(d===e||isNaN(d)&&isNaN(e))||!(c===f||isNaN(c)&&isNaN(f))){d=e-(isNaN(d)?0:d);c=f-(isNaN(c)?0:c);f=J.alloc();V.prototype.move.call(this,a,b);a=new H;for(b=this.ek().iterator;b.next();)if(e=b.value,e instanceof T&&(e.suspendsRouting&&a.add(e),e.Mc||e.fromNode!==this&&e.toNode!==this))e.suspendsRouting=!0;for(b.reset();b.next();)if(e=b.value,!(e.Bh()||e instanceof V&&e.isLinkLabel)){var g=
e.position,h=e.location;g.o()?(f.x=g.x+d,f.y=g.y+c,e.position=f):h.o()&&(f.x=h.x+d,f.y=h.y+c,e.location=f)}for(b.reset();b.next();)if(e=b.value,e instanceof T&&(e.suspendsRouting=a.contains(e),e.Mc||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.Ta(),ck(e)&&e.Ta();J.free(f)}};
na.Object.defineProperties(xg.prototype,{placeholder:{configurable:!0,get:function(){return this.Pa}},computesBoundsAfterDrag:{configurable:!0,get:function(){return 0!==(this.T&2048)},set:function(a){var b=0!==(this.T&2048);b!==a&&(z(a,"boolean",xg,"computesBoundsAfterDrag"),this.T^=2048,this.g("computesBoundsAfterDrag",b,a))}},computesBoundsIncludingLinks:{configurable:!0,get:function(){return 0!==(this.T&4096)},set:function(a){z(a,"boolean",xg,"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){z(a,"boolean",xg,"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){z(a,"boolean",xg,"handlesDragDropForMembers");
var b=0!==(this.T&16384);b!==a&&(this.T^=16384,this.g("handlesDragDropForMembers",b,a))}},memberParts:{configurable:!0,get:function(){return this.so.iterator}},layout:{configurable:!0,get:function(){return this.ic},set:function(a){var b=this.ic;if(b!==a){null!==a&&w(a,Oi,xg,"layout");null!==b&&(b.diagram=null,b.group=null);this.ic=a;var c=this.diagram;null!==a&&(a.diagram=c,a.group=this);null!==c&&(c.Eg=!0);this.g("layout",b,a);null!==c&&c.ec()}}},memberAdded:{configurable:!0,
enumerable:!0,get:function(){return this.ro},set:function(a){var b=this.ro;b!==a&&(null!==a&&z(a,"function",xg,"memberAdded"),this.ro=a,this.g("memberAdded",b,a))}},memberRemoved:{configurable:!0,get:function(){return this.to},set:function(a){var b=this.to;b!==a&&(null!==a&&z(a,"function",xg,"memberRemoved"),this.to=a,this.g("memberRemoved",b,a))}},memberValidation:{configurable:!0,get:function(){return this.mi},set:function(a){var b=this.mi;b!==a&&(null!==a&&z(a,"function",
xg,"memberValidation"),this.mi=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&&(z(a,"boolean",xg,"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){z(a,"boolean",xg,"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.fa,c.fa=!0);b(this);null!==c&&(c.fa=d)}null!==c&&c.undoManager.isUndoingRedoing?(null!==this.Pa&&this.Pa.v(),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&&(z(a,"boolean",xg,"wasSubGraphExpanded"),this.T^=1024,this.g("wasSubGraphExpanded",
b,a))}},subGraphExpandedChanged:{configurable:!0,get:function(){return this.Bp},set:function(a){var b=this.Bp;b!==a&&(null!==a&&z(a,"function",xg,"subGraphExpandedChanged"),this.Bp=a,this.g("subGraphExpandedChanged",b,a))}},rk:{configurable:!0,get:function(){return 0!==(this.T&32768)},set:function(a){0!==(this.T&32768)!==a&&(this.T^=32768)}}});xg.prototype.expandSubGraph=xg.prototype.expandSubGraph;xg.prototype.collapseSubGraph=xg.prototype.collapseSubGraph;
xg.prototype.findSubGraphParts=xg.prototype.ek;xg.prototype.findContainingGroupChain=xg.prototype.Vy;xg.prototype.findExternalNodesConnected=xg.prototype.Wy;xg.prototype.findExternalLinksConnected=xg.prototype.dv;xg.className="Group";function lh(){N.call(this);this.gb=Zc;this.lp=new L(NaN,NaN,NaN,NaN)}ma(lh,N);lh.prototype.cloneProtected=function(a){N.prototype.cloneProtected.call(this,a);a.gb=this.gb.J();a.lp=this.lp.copy()};
lh.prototype.xh=function(a){if(null===this.background&&null===this.areaBackground)return!1;var b=this.naturalBounds;return Qc(0,0,b.width,b.height,a.x,a.y)};
lh.prototype.mm=function(){var a=this.part;null!==a&&(a instanceof xg||a instanceof Cf)||v("Placeholder is not inside a Group or Adornment.");if(a instanceof xg){var b=this.computeBorder(this.lp),c=this.minSize,d=this.rc;Cc(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);nl(this,0,0,d.width,d.height);c=a.memberParts;for(d=!1;c.next();)if(c.value.isVisible()){d=!0;break}c=a.diagram;(d=!d||null===c)||(d=c.animationManager,d.Of?
(d=d.Bj.K(a),d=null!==d&&(d.start.position||d.start.location)):d=!1);d||isNaN(b.x)||isNaN(b.y)?null!==c&&c.animationManager.isAnimating&&c.animationManager.hs.add(this):(c=J.alloc(),c.Yi(b,a.locationSpot),c.A(a.location)||(a.location=new J(c.x,c.y)),J.free(c))}else{b=this.rc;c=this.gb;d=c.left+c.right;var e=c.top+c.bottom,f=a.adornedObject;a.angle=f.Oi();var g=0;f instanceof Hg&&(g=f.strokeWidth);var h=f.Ge(),k=f.naturalBounds,l=(k.width+g)*h;g=(k.height+g)*h;a.type!==W.Link&&(f=f.oa("Selection"===
a.category?fd:a.locationSpot,J.alloc()),a.location=f,J.free(f));isNaN(l)||isNaN(g)?(a=a.adornedObject,l=a.oa(fd,J.alloc()),f=L.allocAt(l.x,l.y,0,0),f.Me(a.oa(ud,l)),f.Me(a.oa(hd,l)),f.Me(a.oa(sd,l)),Cc(b,f.width+d||0,f.height+e||0),nl(this,-c.left,-c.top,b.width,b.height),J.free(l),L.free(f)):(Cc(b,l+d||0,g+e||0),nl(this,-c.left,-c.top,b.width,b.height))}};lh.prototype.vh=function(a,b,c,d){this.actualBounds.h(a,b,c,d)};
lh.prototype.computeBorder=function(a){var b=this.part,c=b.diagram;if(null!==c&&b instanceof xg&&!b.layer.isTemporary&&b.computesBoundsAfterDrag&&this.lp.o()){var d=c.toolManager.findTool("Dragging");if(d===c.currentTool&&(c=d.computeBorder(b,this.lp,a),null!==c))return c}c=L.alloc();d=this.computeMemberBounds(c);var e=this.gb;b instanceof xg&&!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 xg&&b.computesBoundsIncludingLocation&&b.location.o()&&a.Me(b.location);return a};
lh.prototype.computeMemberBounds=function(a){if(!(this.part instanceof xg))return a.h(0,0,0,0),a;for(var b=this.part,c=Infinity,d=Infinity,e=-Infinity,f=-Infinity,g=b.memberParts;g.next();){var h=g.value;if(h.isVisible()){if(h instanceof T){if(!b.computesBoundsIncludingLinks)continue;if(Ej(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};na.Object.defineProperties(lh.prototype,{padding:{configurable:!0,get:function(){return this.gb},set:function(a){"number"===typeof a?a=new Hc(a):w(a,Hc,lh,"padding");var b=this.gb;b.A(a)||(this.gb=a=a.J(),this.g("padding",b,a))}}});lh.className="Placeholder";
function T(){U.call(this,W.Link);this.Va=8;this.Re=null;this.Se="";this.jf=this.Jn=null;this.kf="";this.Ip=null;this.Qm=ch;this.ln=0;this.on=ch;this.pn=NaN;this.Ij=ep;this.xp=.5;this.bd=null;this.yb=(new F).freeze();this.dh=this.Hc=null;this.Cl=new L;this.sa=new me;this.Un=!0;this.L=this.w=this.Bf=this.Kf=null;this.l=[];this.Fu=new J;this.wr=this.Rw=this.Qw=null;this.fu=NaN;this.R=null}ma(T,U);
T.prototype.cloneProtected=function(a){U.prototype.cloneProtected.call(this,a);a.Va=this.Va&-113;a.Se=this.Se;a.Jn=this.Jn;a.kf=this.kf;a.Ip=this.Ip;a.Qm=this.Qm;a.ln=this.ln;a.on=this.on;a.pn=this.pn;a.Ij=this.Ij;a.xp=this.xp;null!==this.R&&(a.R=this.R.copy())};t=T.prototype;t.rf=function(a){U.prototype.rf.call(this,a);this.Se=a.Se;this.kf=a.kf;a.Hc=null;a.Ta();a.Bf=this.Bf;var b=a.fromPort;null!==b&&So(a.fromNode,b);b=a.toPort;null!==b&&So(a.toNode,b)};
t.hb=function(a){a.classType===T?2===(a.value&2)?this.routing=a:a===fh||a===bh||a===ah?this.curve=a:a===fp||a===gp||a===hp?this.adjusting=a:a!==ep&&a!==ch&&v("Unknown Link enum value for a Link property: "+a):U.prototype.hb.call(this,a)};t.Jc=function(){null===this.R&&(this.R=new jl)};t.Vi=function(){var a=this.fromNode;if(null!==a){var b=a.findVisibleNode();null!==b&&(a=b);if(Fj(a)||Gj(a))return!1}a=this.toNode;return null!==a&&(b=a.findVisibleNode(),null!==b&&(a=b),Fj(a)||Gj(a))?!1:!0};t.Sv=function(){return!1};
t.Tv=function(){};t.dc=function(){return!1};T.prototype.computeAngle=function(a,b,c){return T.computeAngle(b,c)};T.computeAngle=function(a,b){switch(a){default:case ch:a=0;break;case Ln:a=b;break;case Um:a=b+90;break;case Wm:a=b-90;break;case ip:a=b+180;break;case jp:a=K.qq(b);90<a&&270>a&&(a-=180);break;case Vm:a=K.qq(b+90);90<a&&270>a&&(a-=180);break;case Xm:a=K.qq(b-90);90<a&&270>a&&(a-=180);break;case Ym:a=K.qq(b);if(45<a&&135>a||225<a&&315>a)return 0;90<a&&270>a&&(a-=180)}return K.qq(a)};
function Oo(a){var b=a.fromNode,c=a.toNode,d=null;null!==b?d=null!==c?b.mx(c):b.containingGroup:null!==c?d=c.containingGroup:d=null;b=d;c=a.Uh;if(c!==b){null!==c&&Jo(c,a);a.Uh=b;null!==b&&Io(b,a);var e=a.containingGroupChanged;if(null!==e){var f=!0,g=a.diagram;null!==g&&(f=g.fa,g.fa=!0);e(a,c,b);null!==g&&(g.fa=f)}!a.Mc||a.Qw!==c&&a.Rw!==c||a.Ta()}if(a.isLabeledLink)for(a=a.labelNodes;a.next();)a.value.containingGroup=d}t=T.prototype;
t.Ah=function(){var a=this.containingGroup;null!==a&&this.fromNode!==a&&this.toNode!==a&&a.computesBoundsIncludingLinks&&U.prototype.Ah.call(this)};t.bt=function(a){E&&w(a,V,T,"getOtherNode:node");var b=this.fromNode;return a===b?this.toNode:b};t.oz=function(a){E&&w(a,N,T,"getOtherPort:port");var b=this.fromPort;return a===b?this.toPort:b};function Vo(a,b){null===a.bd&&(a.bd=new H);a.bd.add(b);a.v()}
t.hq=function(a){U.prototype.hq.call(this,a);kp(this)&&this.jq(this.actualBounds);if(!a){a=this.Re;var b=null;null!==a&&(b=this.fromPort,To(a,this,b));var c=this.jf;if(null!==c){var d=this.toPort;c===a&&d===b||To(c,this,d)}lp(this)}};t.iq=function(a){U.prototype.iq.call(this,a);kp(this)&&this.jq(this.actualBounds);if(!a){a=this.Re;var b=null;null!==a&&(b=this.fromPort,Uo(a,this,b));var c=this.jf;if(null!==c){var d=this.toPort;c===a&&d===b||Uo(c,this,d)}mp(this)}};
t.bk=function(){this.Mc=!0;if(null!==this.bd){var a=this.diagram;if(null!==a)for(var b=this.bd.copy().iterator;b.next();)a.remove(b.value)}null!==this.data&&(a=this.diagram,null!==a&&a.partManager.removeDataForLink(this))};T.prototype.updateRelationshipsFromData=function(){if(null!==this.data){var a=this.diagram;null!==a&&a.partManager.updateRelationshipsFromData(this)}};
T.prototype.move=function(a,b){var c=b?this.location:this.position,d=c.x;isNaN(d)&&(d=0);var e=c.y;isNaN(e)&&(e=0);d=a.x-d;e=a.y-e;!0===b?U.prototype.move.call(this,a,!1):(a=J.allocAt(c.x+d,c.y+e),U.prototype.move.call(this,a,!1),J.free(a));ng(this,d,e);for(a=this.labelNodes;a.next();)b=a.value,c=b.position,b.moveTo(c.x+d,c.y+e)};
T.prototype.canRelinkFrom=function(){if(!this.relinkableFrom)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowRelink)return!1;a=a.diagram;return null===a||a.allowRelink?!0:!1};T.prototype.canRelinkTo=function(){if(!this.relinkableTo)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowRelink)return!1;a=a.diagram;return null===a||a.allowRelink?!0:!1};
T.prototype.computeMidPoint=function(a){var b=this.pointsCount;if(0===b)return a.assign(qc),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()===fh))return this.sa.lv(.5,a),a.add(this.i(0)),c=this.sa.figures.first(),a.offset(-c.startX,-c.startY),a;if(this.computeCurve()===fh){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.xy(d.x,d.y,e.x,e.y,f.x,f.y,c.x,c.y,a)}else a.assign(this.i(c));return a}var g=this.flattenedLengths;c=this.flattenedTotalLength;for(e=f=d=0;d<c/2&&f<b;){e=g[f];if(d+e>c/2)break;d+=e;f++}b=this.i(f);f=this.i(f+1);1>Math.abs(b.x-f.x)?b.y>f.y?a.h(b.x,b.y-(c/2-d)):a.h(b.x,b.y+(c/2-d)):1>Math.abs(b.y-f.y)?b.x>f.x?a.h(b.x-(c/2-d),b.y):a.h(b.x+(c/2-d),b.y):(c=(c/2-d)/e,a.h(b.x+c*(f.x-b.x),b.y+c*(f.y-b.y)));return a};
T.prototype.computeMidAngle=function(){var a=this.pointsCount;if(2>a)return NaN;if(2===a)return this.i(0).Xa(this.i(1));if(this.isOrthogonal&&(15<=this.computeCorner()||this.computeCurve()===fh)){a:{a=this.sa;var b=.5;0>b?b=0:1<b&&(b=1);if(a.type===pe)a=180*Math.atan2(a.endY-a.startY,a.endX-a.startX)/Math.PI;else{var c=a.flattenedSegments,d=a.flattenedLengths,e=c.length;b=a.flattenedTotalLength*b;for(var f=0,g=0;g<e;g++){var h=d[g],k=h.length;for(a=0;a<k;a++){var l=h[a];if(f+l>=b){b=c[g];c=b[2*a];
d=b[2*a+1];e=b[2*a+2];a=b[2*a+3];a=1>Math.abs(e-c)&&1>Math.abs(a-d)?0:1>Math.abs(e-c)?0<=a-d?90:270:1>Math.abs(a-d)?0<=e-c?0:180:180*Math.atan2(a-d,e-c)/Math.PI;break a}f+=l}}a=NaN}}return a}if(this.computeCurve()===fh&&4<=a){d=(a-1)/3|0;c=3*(d/2|0);if(1===d%2)return c=Math.floor(c),a=this.i(c),d=this.i(c+1),e=this.i(c+2),c=this.i(c+3),K.wy(a.x,a.y,d.x,d.y,e.x,e.y,c.x,c.y);if(0<c&&c+1<a)return this.i(c-1).Xa(this.i(c+1))}d=this.flattenedLengths;e=this.flattenedTotalLength;for(c=b=0;b<e/2&&c<a;){f=
d[c];if(b+f>e/2)break;b+=f;c++}d=this.i(c);e=this.i(c+1);if(1>Math.abs(d.x-e.x)&&1>Math.abs(d.y-e.y)){if(0<c&&c+2<a)return this.i(c-1).Xa(this.i(c+2))}else{if(1>Math.abs(d.x-e.x))return d.y>e.y?270:90;if(1>Math.abs(d.y-e.y))return d.x>e.x?180:0}return d.Xa(e)};t=T.prototype;t.i=function(a){return this.yb.j[a]};
t.ld=function(a,b){E&&(w(b,J,T,"setPoint"),b.o()||v("Link.setPoint called with a Point that does not have real numbers: "+b.toString()));E&&null===this.Hc&&v("Call Link.startRoute before modifying the points of the route.");this.yb.jd(a,b)};t.N=function(a,b,c){E&&(B(b,T,"setPointAt:x"),B(c,T,"setPointAt:y"));E&&null===this.Hc&&v("Call Link.startRoute before modifying the points of the route.");this.yb.jd(a,new J(b,c))};
t.Az=function(a,b){E&&(w(b,J,T,"insertPoint"),b.o()||v("Link.insertPoint called with a Point that does not have real numbers: "+b.toString()));E&&null===this.Hc&&v("Call Link.startRoute before modifying the points of the route.");this.yb.Lb(a,b)};t.m=function(a,b,c){E&&(B(b,T,"insertPointAt:x"),B(c,T,"insertPointAt:y"));E&&null===this.Hc&&v("Call Link.startRoute before modifying the points of the route.");this.yb.Lb(a,new J(b,c))};
t.Ce=function(a){E&&(w(a,J,T,"addPoint"),a.o()||v("Link.addPoint called with a Point that does not have real numbers: "+a.toString()));E&&null===this.Hc&&v("Call Link.startRoute before modifying the points of the route.");this.yb.add(a)};t.nf=function(a,b){E&&(B(a,T,"insertPointAt:x"),B(b,T,"insertPointAt:y"));E&&null===this.Hc&&v("Call Link.startRoute before modifying the points of the route.");this.yb.add(new J(a,b))};
t.Hv=function(a){E&&null===this.Hc&&v("Call Link.startRoute before modifying the points of the route.");this.yb.nb(a)};t.Xj=function(){E&&null===this.Hc&&v("Call Link.startRoute before modifying the points of the route.");this.yb.clear()};
function ng(a,b,c){if(0!==b||0!==c){for(var d=a.Mc,e=new F,f=a.yb.iterator;f.next();){var g=f.value;e.add((new J(g.x+b,g.y+c)).freeze())}e.freeze();f=a.yb;a.yb=e;isNaN(b)||isNaN(c)||a.diagram.animationManager.sb?a.v():(a.pe.h(a.pe.x+b,a.pe.y+c),a.ua.h(a.ua.x+b,a.ua.y+c),Il(a));d&&np(a);b=a.diagram;null!==b&&b.animationManager.sb&&(a.dh=e);a.g("points",f,e)}}t.Eh=function(){null===this.Hc&&(this.Hc=this.yb,this.yb=this.yb.copy())};
t.pf=function(){if(null!==this.Hc){for(var a=this.Hc,b=this.yb,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.v();this.cc();break}}else this.v(),this.cc();this.Hc=null;c=this.diagram;null!==c&&c.animationManager.sb&&(this.dh=b);np(this);this.g("points",
a,b)}};t.Ix=function(){null!==this.Hc&&(this.yb=this.Hc,this.Hc=null)};function np(a){0===a.yb.count?a.Mc=!1:(a.Mc=!0,a.wr=null,a.fu=NaN,a.defaultFromPoint=a.i(0),a.defaultToPoint=a.i(a.pointsCount-1),op(a,!1))}
t.Ta=function(){if(!this.suspendsRouting){var a=this.diagram;if(a){if(a.lt.contains(this)||a.undoManager.isUndoingRedoing)return;a=a.animationManager;if(a.isTicking&&!a.isAnimating)return;null!==this.dh&&!a.isTicking&&a.isAnimating&&(this.dh=null)}a=this.path;null!==a&&(this.Mc=!1,this.v(),a.v())}};t.bj=function(){if(!this.Mc&&!this.Vu){var a=!0;try{this.Vu=!0,this.Eh(),a=this.computePoints()}finally{this.Vu=!1,a?this.pf():this.Ix()}}};
T.prototype.computePoints=function(){var a=this.diagram;if(null===a)return!1;var b=this.fromNode,c=null;null===b?(a.ti||(a.gp=new Hg,a.gp.desiredSize=rc,a.gp.strokeWidth=0,a.ti=new V,a.ti.add(a.gp),a.ti.bc()),this.defaultFromPoint&&(a.ti.position=a.ti.location=this.defaultFromPoint,a.ti.bc(),b=a.ti,c=a.gp)):c=this.fromPort;if(null!==c&&!b.isVisible()){var d=b.findVisibleNode();null!==d&&d!==b?(b=d,c=d.port):b=d}this.Qw=b;if(null===b||!b.location.o())return!1;for(;!(null===c||c.actualBounds.o()&&c.vf());)c=
c.panel;if(null===c)return!1;var e=this.toNode,f=null;null===e?(a.ui||(a.hp=new Hg,a.hp.desiredSize=rc,a.hp.strokeWidth=0,a.ui=new V,a.ui.add(a.hp),a.ui.bc()),this.defaultToPoint&&(a.ui.position=a.ui.location=this.defaultToPoint,a.ui.bc(),e=a.ui,f=a.hp)):f=this.toPort;null===f||e.isVisible()||(a=e.findVisibleNode(),null!==a&&a!==e?(e=a,f=a.port):e=a);this.Rw=e;if(null===e||!e.location.o())return!1;for(;!(null===f||f.actualBounds.o()&&f.vf());)f=f.panel;if(null===f)return!1;var g=this.pointsCount;
d=this.computeSpot(!0,c);a=this.computeSpot(!1,f);var h=pp(d),k=pp(a),l=c===f&&null!==c,m=this.isOrthogonal,n=this.curve===fh;this.Kf=l&&!m?n=!0:!1;var p=this.adjusting===ch||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.Xj(),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 q=g.x+h/3,r=g.y+k/3,u=q,x=r;K.B(k,0)?x=0<h?x-l:x+l:(m=-h/k,n=Math.sqrt(l*l/(m*m+1)),0>l&&(n=-n),u=(0>k?-1:1)*n+q,x=m*(u-q)+r);q=g.x+2*h/3;r=g.y+2*k/3;var y=q,A=r;K.B(k,0)?A=0<h?A-l:A+l:(y=(0>k?-1:1)*n+q,A=m*(y-q)+r);this.Xj();this.Ce(g);this.nf(u,x);this.nf(y,A);this.Ce(p);this.ld(0,this.getLinkPoint(b,c,d,!0,!1,e,f));this.ld(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.B(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.Ce(d),this.nf(g,h)):this.Ce(d),this.Ce(a)}else{n=this.isAvoiding;p&&(m&&n||l)&&this.Xj();var C=l?this.computeCurviness():0;n=this.getLinkPoint(b,c,d,!0,m,e,f);q=u=r=0;if(m||!h||l)x=this.computeEndSegmentLength(b,c,d,!0),q=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)&&(q-=m?90:30,0>C&&(q-=180)),0>q?q+=360:360<=q&&(q-=360),l&&(x+=Math.abs(C)*(m?1:2)),0===q?r=x:90===q?u=x:180===q?r=-x:270===q?u=-x:(r=x*Math.cos(q*Math.PI/180),u=x*Math.sin(q*Math.PI/180)),d.Nb()&&l&&(x=c.oa(qd,J.alloc()),y=J.allocAt(x.x+1E3*r,x.y+1E3*u),this.getLinkPointFromPoint(b,c,x,y,!0,n),J.free(x),J.free(y));x=this.getLinkPoint(e,f,a,!1,m,b,c);var G=A=y=0;if(m||!k||l){var I=this.computeEndSegmentLength(e,f,a,!1);G=this.getLinkDirection(e,f,x,a,!1,m,b,c);l&&(k||d.A(a)||!m&&
1===d.x+a.x&&1===d.y+a.y)&&(G+=m?0:30,0>C&&(G+=180));0>G?G+=360:360<=G&&(G-=360);l&&(I+=Math.abs(C)*(m?1:2));0===G?y=I:90===G?A=I:180===G?y=-I:270===G?A=-I:(y=I*Math.cos(G*Math.PI/180),A=I*Math.sin(G*Math.PI/180));a.Nb()&&l&&(a=f.oa(qd,J.alloc()),d=J.allocAt(a.x+1E3*y,a.y+1E3*A),this.getLinkPointFromPoint(e,f,a,d,!1,x),J.free(a),J.free(d))}a=n;if(m||!h||l)a=new J(n.x+r,n.y+u);d=x;if(m||!k||l)d=new J(x.x+y,x.y+A);!p&&!m&&h&&3<g&&this.adjustPoints(0,n,g-2,d)?this.ld(g-1,x):!p&&!m&&k&&3<g&&this.adjustPoints(1,
a,g-1,x)?this.ld(0,n):!p&&(m?6<=g:4<g)&&this.adjustPoints(1,a,g-2,d)?(this.ld(0,n),this.ld(g-1,x)):(this.Xj(),this.Ce(n),(m||!h||l)&&this.Ce(a),m&&this.addOrthoPoints(a,q,d,G,b,e),(m||!k||l)&&this.Ce(d),this.Ce(x))}return!0};function qp(a,b){Math.abs(b.x-a.x)>Math.abs(b.y-a.y)?(b.x>=a.x?b.x=a.x+9E9:b.x=a.x-9E9,b.y=a.y):(b.y>=a.y?b.y=a.y+9E9:b.y=a.y-9E9,b.x=a.x);return b}
T.prototype.getLinkPointFromPoint=function(a,b,c,d,e,f){void 0===f&&(f=new J);if(null===a||null===b)return f.assign(c),f;a.isVisible()||(e=a.findVisibleNode(),null!==e&&e!==a&&(b=e.port));a=null;e=b.panel;null===e||e.ae()||(e=e.panel);if(null===e){e=d.x;d=d.y;var g=c.x;c=c.y}else{a=e.td;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.fk(e,d,g,c,f);null!==
a&&f.transform(a);return f};function rp(a,b){var c=b.Wo;null===c&&(c=new sp,c.port=b,c.node=b.part,b.Wo=c);return tp(c,a)}
T.prototype.getLinkPoint=function(a,b,c,d,e,f,g,h){void 0===h&&(h=new J);if(c.Za()&&!pp(c))return b.oa(c,h),h;if(c.uf()){var k=rp(this,b);if(null!==k){h.assign(k.nq);if(e&&this.routing===up){var l=rp(this,g);if(null!==l&&k.am<l.am){k=J.alloc();l=J.alloc();var m=new L(b.oa(fd,k),b.oa(ud,l)),n=this.computeSpot(!d,g);a=this.getLinkPoint(f,g,n,!d,e,a,b,l);(c.tf(wd)||c.tf(Ad))&&a.y>=m.y&&a.y<=m.y+m.height?h.y=a.y:(c.tf(vd)||c.tf(Bd))&&a.x>=m.x&&a.x<=m.x+m.width&&(h.x=a.x);J.free(k);J.free(l)}}return h}}c=
b.oa(.5===c.x&&.5===c.y?c:qd,J.alloc());this.pointsCount>(e?6:2)?(g=d?this.i(1):this.i(this.pointsCount-2),e&&(g=qp(c,g.copy()))):(k=this.computeSpot(!d,g),f=J.alloc(),g=g.oa(.5===k.x&&.5===k.y?k:qd,f),e&&(g=qp(c,g)),J.free(f));this.getLinkPointFromPoint(a,b,c,g,d,h);J.free(c);return h};
T.prototype.getLinkDirection=function(a,b,c,d,e,f,g,h){a:if(d.Za())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.uf()&&(k=rp(this,b),null!==k))switch(k.Ac){case 1:k=270;break a;case 2:k=180;break a;default:case 4:k=0;break a;case 8:k=90;break a}k=b.oa(qd,J.alloc());this.pointsCount>(f?6:2)?(h=e?this.i(1):this.i(this.pointsCount-2),h=f?qp(k,h.copy()):c):(c=J.alloc(),h=h.oa(qd,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.Nb()&&g.Xd(a)&&(k+=180,360<=k&&(k-=360));if(pp(d))return k;a=b.Oi();if(0===a)return k;45<=a&&135>a?k+=90:135<=a&&225>a?k+=180:225<=a&&315>a&&(k+=270);360<=k&&(k-=360);return k};T.prototype.computeEndSegmentLength=function(a,b,c,d){if(null!==b&&c.uf()&&(a=rp(this,b),null!==a))return a.bv;a=d?this.fromEndSegmentLength:this.toEndSegmentLength;null!==b&&isNaN(a)&&(a=d?b.fromEndSegmentLength:b.toEndSegmentLength);isNaN(a)&&(a=10);return a};
T.prototype.computeSpot=function(a,b){void 0===b&&(b=null);a?(a=b?b:this.fromPort,null===a?a=qd:(b=this.fromSpot,b.Cb()&&(b=a.fromSpot),a=b===Qd?ed:b)):(a=b?b:this.toPort,null===a?a=qd:(b=this.toSpot,b.Cb()&&(b=a.toSpot),a=b===Qd?ed:b));return a};function pp(a){return a===ed||.5===a.x&&.5===a.y}T.prototype.computeOtherPoint=function(a,b){a=b.oa(qd);b=b.Wo;b=null!==b?tp(b,this):null;null!==b&&(a=b.nq);return a};
T.prototype.computeShortLength=function(a){if(a){a=this.fromShortLength;if(isNaN(a)){var b=this.fromPort;null!==b&&(a=b.fromShortLength)}return isNaN(a)?0:a}a=this.toShortLength;isNaN(a)&&(b=this.toPort,null!==b&&(a=b.toShortLength));return isNaN(a)?0:a};
T.prototype.rg=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=$b.alloc(),g.reset());g.multiply(this.transform);if(this.wh(a,g))return nn(this,b,c,e),void 0===f&&$b.free(g),!0;if(this.Kc(a,g)){var h=!1;if(!this.isAtomic)for(var k=this.Z.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=$b.alloc();n.set(g);
if(m instanceof W)h=m.rg(a,b,c,d,e,n);else if(this.path===m){if(m instanceof Hg)if(h=a,p=d,!1===m.pickable)h=!1;else if(n.multiply(m.transform),p)b:{var q=h,r=n;if(m.wh(q,r))h=!0;else{if(void 0===r&&(r=m.transform,q.qf(m.actualBounds))){h=!0;break b}h=q.left;p=q.right;var u=q.top;q=q.bottom;var x=J.alloc(),y=J.alloc(),A=J.alloc(),C=$b.alloc();C.set(r);C.vv(m.transform);C.gt();y.x=p;y.y=u;y.transform(C);x.x=h;x.y=u;x.transform(C);r=!1;Jn(m,x,y,A)?r=!0:(x.x=p,x.y=q,x.transform(C),Jn(m,x,y,A)?r=!0:(y.x=
h,y.y=q,y.transform(C),Jn(m,x,y,A)?r=!0:(x.x=h,x.y=u,x.transform(C),Jn(m,x,y,A)&&(r=!0))));$b.free(C);J.free(x);J.free(y);J.free(A);h=r}}else h=m.wh(h,n)}else h=pl(m,a,d,n);h&&(p=m,null!==b&&(p=b(m)),p&&(null===c||c(p))&&e.add(p));$b.free(n)}}}void 0===f&&$b.free(g);return h||null!==this.background||null!==this.areaBackground}void 0===f&&$b.free(g);return!1};
T.prototype.computeCurve=function(){if(null===this.Kf){var a=this.fromPort,b=this.isOrthogonal;this.Kf=null!==a&&a===this.toPort&&!b}return this.Kf?fh:this.curve};T.prototype.computeCorner=function(){if(this.curve===fh)return 0;var a=this.corner;if(isNaN(a)||0>a)a=10;return a};
T.prototype.findMidLabel=function(){for(var a=this.path,b=this.Z.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};
T.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===jp||d===ip?a=Math.max(a,e):d===Wm||d===Xm||d===Um||d===Vm?a=Math.max(a,g):(b=b.oa(qd).Xa(c.oa(qd))/180*Math.PI,a=Math.max(a,
Math.abs(Math.sin(b)*g)+Math.abs(Math.cos(b)*e)+1));this.curve===fh&&(a*=1.333)}}return a};T.prototype.arrangeBundledLinks=function(a,b){if(b)for(b=0;b<a.length;b++){var c=a[b];c.adjusting===ch&&c.Ta()}};
T.prototype.computeCurviness=function(){var a=this.curviness;if(isNaN(a)){a=16;var b=this.Bf;if(null!==b){for(var c=Qa(),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.ot===this.fromNode&&(a=-a);Ta(c)}}return a};T.prototype.computeThickness=function(){if(!this.isVisible())return 0;var a=this.path;return null!==a?Math.max(a.strokeWidth,1):1};
T.prototype.hasCurviness=function(){return!isNaN(this.curviness)||null!==this.Bf};
T.prototype.adjustPoints=function(a,b,c,d){var e=this.adjusting;if(this.isOrthogonal){if(e===gp)return!1;e===hp&&(e=fp)}switch(e){case gp: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.da(l,0)){if(K.da(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.da(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.ld(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.da(b,0)||(K.da(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.ld(c,d)}}return!0;case hp: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 q=1;if(0!==k-h){var r=(p-m)/(k-h);q=Math.sqrt(1+1/(r*r))}else r=9E9;this.ld(a,b);for(a+=1;a<c;a++){b=this.i(a);
var u=b.x,x=b.y,y=.5;0!==l&&(y=((e-u)*(e-g)+(f-x)*(f-n))/l);var A=e+y*(g-e),C=f+y*(n-f);b=Math.sqrt((u-A)*(u-A)+(x-C)*(x-C));x<r*(u-A)+C&&(b=-b);0<r&&(b=-b);u=h+y*(k-h);y=m+y*(p-m);0!==r?(b=u+b/q,this.N(a,b,y-(b-u)/r)):this.N(a,u,y+b)}this.ld(c,d)}return!0;case fp:a:{if(this.isOrthogonal&&(e=this.i(a),f=this.i(a+1),g=this.i(a+2),h=f.x,m=f.y,n=h,l=m,K.B(e.y,f.y)?K.B(f.x,g.x)?m=b.y:K.B(f.y,g.y)&&(h=b.x):K.B(e.x,f.x)&&(K.B(f.y,g.y)?h=b.x:K.B(f.x,g.x)&&(m=b.y)),this.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.B(e.y,f.y)?K.B(f.x,g.x)?m=d.y:K.B(f.y,g.y)&&(h=d.x):K.B(e.x,f.x)&&(K.B(f.y,g.y)?h=d.x:K.B(f.x,g.x)&&(m=d.y)),this.N(c-1,h,m),ck(this))){this.N(a+1,n,l);this.N(c-1,k,p);c=!1;break a}this.ld(a,b);this.ld(c,d);c=!0}return c;default:return!1}};
T.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.Xc(8,8);h.Xc(8,8);g.Me(a);h.Me(c);if(0===b)if(c.x>a.x||270===d&&c.y<a.y&&h.right>a.x||90===d&&c.y>a.y&&h.right>a.x){var k=new J(c.x,a.y);var l=new J(c.x,(a.y+c.y)/2);180===d?(k.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1),l.x=k.x,l.y=c.y):270===d&&c.y<a.y||90===d&&
c.y>a.y?(k.x=a.x<h.left?this.computeMidOrthoPosition(a.x,a.y,h.left,c.y,!1):a.x<h.right&&(270===d&&a.y<h.top||90===d&&a.y>h.bottom)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):h.right,l.x=k.x,l.y=c.y):0===d&&a.x<h.left&&a.y>h.top&&a.y<h.bottom&&(k.x=a.x,k.y=a.y<c.y?Math.min(c.y,h.top):Math.max(c.y,h.bottom),l.y=k.y)}else{k=new J(a.x,c.y);l=new J((a.x+c.x)/2,c.y);if(180===d||90===d&&c.y<g.top||270===d&&c.y>g.bottom)180===d&&(h.ea(a)||g.ea(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.ea(a)||g.ea(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.ea(a)||g.ea(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.ea(a)||g.ea(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 q=this.diagram;if(null===q||!yk(q)||g.ea(p)&&!f.Xd(e)||h.ea(a)&&!e.Xd(f)||e===f||this.layer.isTemporary)b=!1;else{var r=zk(q,!0,this.containingGroup,null);
if(r.ik(Math.min(a.x,m.x),Math.min(a.y,m.y),Math.abs(a.x-m.x),Math.abs(a.y-m.y))&&r.ik(Math.min(m.x,n.x),Math.min(m.y,n.y),Math.abs(m.x-n.x),Math.abs(m.y-n.y))&&r.ik(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(q.isVirtualized){q=r.bounds.copy();q.Xc(-r.Zl,-r.Yl);var x=J.alloc();vp(r,a.x,a.y)||(K.Wc(q.x,q.y,q.x+q.width,q.y+q.height,a.x,a.y,m.x,m.y,x)?(c=a=x.copy(),b=x.Xa(m)):K.Wc(q.x,q.y,q.x+q.width,q.y+q.height,m.x,m.y,n.x,n.y,x)?(c=a=
x.copy(),b=x.Xa(n)):K.Wc(q.x,q.y,q.x+q.width,q.y+q.height,n.x,n.y,p.x,p.y,x)&&(c=a=x.copy(),b=x.Xa(p)));vp(r,p.x,p.y)||(K.Wc(q.x,q.y,q.x+q.width,q.y+q.height,p.x,p.y,n.x,n.y,x)?(u=p=x.copy(),d=n.Xa(x)):K.Wc(q.x,q.y,q.x+q.width,q.y+q.height,n.x,n.y,m.x,m.y,x)?(u=p=x.copy(),d=m.Xa(x)):K.Wc(q.x,q.y,q.x+q.width,q.y+q.height,m.x,m.y,a.x,a.y,x)&&(u=p=x.copy(),d=a.Xa(x)));J.free(x)}g=g.copy().Lc(h);h=r.eA;g.Xc(r.Zl*h,r.Yl*h);wp(r,a,b,p,d,g);h=xp(r,p.x,p.y);!r.abort&&h>=yp&&(Ck(r),h=r.Iz,g.Xc(r.Zl*h,r.Yl*
h),wp(r,a,b,p,d,g),h=xp(r,p.x,p.y));!r.abort&&h>=yp&&r.kA&&(Ck(r),wp(r,a,b,p,d,r.bounds),h=xp(r,p.x,p.y));if(!r.abort&&h<yp&&xp(r,p.x,p.y)!==zp){Ap(this,r,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.B(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.B(g.y,p.y)?(Math.abs(a.y-g.y)<=r.Yl/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.B(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.B(g.x,p.x)?(Math.abs(a.x-g.x)<=r.Zl/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.nf(f.x,u.y):this.nf(u.x,f.y));b=!0}else b=!1}}}else b=
!1;b||(this.Ce(k),this.Ce(l))}};T.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 ck(a){if(null===a.diagram||!a.isAvoiding||!yk(a.diagram))return!1;var b=a.points.j,c=b.length;if(4>c)return!1;a=zk(a.diagram,!0,a.containingGroup,null);for(var d=1;d<c-2;d++){var e=b[d],f=b[d+1];if(!a.ik(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 Ap(a,b,c,d,e,f){var g=b.Zl,h=b.Yl,k=xp(b,c,d),l=c,m=d;for(0===e?l+=g:90===e?m+=h:180===e?l-=g:m-=h;k>Bp&&xp(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>Bp)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>Bp&&(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),xp(b,l,m)===k-1?Ap(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),xp(b,l,m)===k-1&&Ap(a,b,l,m,f,!1)));a.nf(c,d)}T.prototype.Sy=function(a){E&&w(a,J,T,"findClosestSegment:p");var b=a.x;a=a.y;for(var c=this.i(0),d=this.i(1),e=cc(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=cc(b,a,d.x,d.y,c.x,c.y);d=c;h<e&&(f=g,e=h)}return f};T.prototype.cc=function(){this.Un=!0};
T.prototype.kk=function(a){if(!a){if(!1===this.Mc)return;a=this.Bb();if(!this.Un&&(null===a||null!==a.geometry))return}this.sa=this.makeGeometry();a=this.path;if(null!==a){a.sa=this.sa;for(var b=this.Z.j,c=b.length,d=0;d<c;d++){var e=b[d];e!==a&&e.isPanelMain&&e instanceof Hg&&(e.sa=this.sa)}}};
T.prototype.makeGeometry=function(){var a=this.sa,b=this.pointsCount;if(2>b)return a.type=pe,this.Un=!1,a;var c=!1,d=this.diagram;null!==d&&kp(this)&&d.Zh.contains(this)&&(0!==this.Cl.width||0!==this.Cl.height)&&(c=!0);var e=this.i(0).copy(),f=e.copy();d=this.yb.j;var g=this.computeCurve();if(g===fh&&3<=b&&!K.da(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.Fu.x;k-=this.Fu.y;e.x-=d;e.y-=k;if(2!==b||kp(this)){a.type=ne;h=Ae(a);0!==this.computeShortLength(!0)&&(e=Cp(this,e,!0,f));Be(h,e.x,e.y,!1);if(g===fh&&3<=b&&!K.da(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=Cp(this,e,!1,f)),Ce(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,q=l,r=this.i(Dp(this,l,n,!1));if(!K.da(p.x,q.x)||!K.da(q.x,r.x))if(!K.da(p.y,q.y)||!K.da(q.y,r.y)){var u=m;isNaN(u)&&(u=this.smoothness/3);var x=p.x;p=p.y;var y=q.x;q=q.y;var A=r.x;r=r.y;var C=u*Ep(x,p,y,q);u*=Ep(y,q,A,r);K.da(p,q)&&K.da(y,A)&&(y>x?r>q?(g.x=y-C,g.y=q-C,b.x=y+u,b.y=
q+u):(g.x=y-C,g.y=q+C,b.x=y+u,b.y=q-u):r>q?(g.x=y+C,g.y=q-C,b.x=y-u,b.y=q+u):(g.x=y+C,g.y=q+C,b.x=y-u,b.y=q-u));K.da(x,y)&&K.da(q,r)&&(q>p?(A>y?(g.x=y-C,g.y=q-C,b.x=y+u):(g.x=y+C,g.y=q-C,b.x=y-u),b.y=q+u):(A>y?(g.x=y-C,g.y=q+C,b.x=y+u):(g.x=y+C,g.y=q+C,b.x=y-u),b.y=q-u));if(K.da(x,y)&&K.da(y,A)||K.da(p,q)&&K.da(q,r))x=.5*(x+A),p=.5*(p+r),g.x=x,g.y=p,b.x=x,b.y=p;1===n?(e.x=.5*(c.x+l.x),e.y=.5*(c.y+l.y)):2===n&&K.da(c.x,this.i(0).x)&&K.da(c.y,this.i(0).y)&&(e.x=.5*(c.x+l.x),e.y=.5*(c.y+l.y));Ce(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=Cp(this,e.copy(),!1,gc));f=.5*(f+e.x);c=.5*(c+e.y);Ce(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=Cp(this,g.copy(),!1,gc)),Ce(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));g=1;for(e=0;g<b;){g=Dp(this,f,g,1<g);m=this.i(g);if(g>=
b-1){if(!f.A(m))0!==this.computeShortLength(!1)&&(m=Cp(this,m.copy(),!1,gc)),Fp(this,h,-d,-k,f,m,c);else if(0===e)for(g=1;g<b;)m=this.i(g++),Fp(this,h,-d,-k,f,m,c),f.assign(m);break}e=Dp(this,m,g+1,g<b-3);g=-d;l=-k;n=this.i(e);x=c;K.B(f.y,m.y)&&K.B(m.x,n.x)?(p=this.computeCorner(),p=Math.min(p,Math.abs(m.x-f.x)/2),p=u=Math.min(p,Math.abs(n.y-m.y)/2),K.B(p,0)?(Fp(this,h,g,l,f,m,x),f.assign(m)):(y=m.x,q=m.y,A=y,r=q,m.x>f.x?y=m.x-p:y=m.x+p,n.y>m.y?r=m.y+u:r=m.y-u,Fp(this,h,g,l,f,new J(y,q),x),He(h,m.x+
g,m.y+l,A+g,r+l),f.h(A,r))):K.B(f.x,m.x)&&K.B(m.y,n.y)?(p=this.computeCorner(),p=Math.min(p,Math.abs(m.y-f.y)/2),p=u=Math.min(p,Math.abs(n.x-m.x)/2),K.B(u,0)?(Fp(this,h,g,l,f,m,x),f.assign(m)):(y=m.x,q=m.y,A=y,r=q,m.y>f.y?q=m.y-p:q=m.y+p,n.x>m.x?A=m.x+u:A=m.x-u,Fp(this,h,g,l,f,new J(y,q),x),He(h,m.x+g,m.y+l,A+g,r+l),f.h(A,r))):(Fp(this,h,g,l,f,m,x),f.assign(m));g=e}J.free(f)}Ke=h}else h=this.i(1).copy(),h.x-=d,h.y-=k,0!==this.computeShortLength(!0)&&(e=Cp(this,e,!0,f)),0!==this.computeShortLength(!1)&&
(h=Cp(this,h,!1,f)),a.type=pe,a.startX=e.x,a.startY=e.y,a.endX=h.x,a.endY=h.y;this.Un=!1;return a};function Ep(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.da(a,0)?b:K.da(b,0)?a:Math.sqrt(a*a+b*b)}
function Cp(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=Ep(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=Ep(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 Dp(a,b,c,d){for(var e=a.pointsCount,f=b;K.da(b.x,f.x)&&K.da(b.y,f.y);){if(c>=e)return e-1;f=a.i(c++)}if(!K.da(b.x,f.x)&&!K.da(b.y,f.y))return c-1;for(var g=f;K.da(b.x,f.x)&&K.da(f.x,g.x)&&(!d||(b.y>=f.y?f.y>=g.y:f.y<=g.y))||K.da(b.y,f.y)&&K.da(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 Fp(a,b,c,d,e,f,g){if(!g&&kp(a)){g=[];var h=0;a.isVisible()&&(h=Gp(a,e,f,g));if(0<h)if(K.B(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===bh?Be(b,n,p,!1):Ce(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===bh?Be(b,l,n,!1):Ce(b,m,k,l,k,l,n)}else if(K.B(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===bh?Be(b,p,l,!1):Ce(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===bh?Be(b,n,k,!1):Ce(b,l,m,l,k,n,k)}}b.lineTo(f.x+c,f.y+d)}
function Gp(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.Ga.j;for(var g=f.length,h=0;h<g;h++){var k=f[h];if(k instanceof T){if(k===a)return 0<d.length&&d.sort(function(a,b){return a-b}),d.length;if(k.isVisible()&&kp(k)){var l=k.routeBounds;l.o()&&a.routeBounds.Kc(l)&&!a.usesSamePort(k)&&(l=k.path,null!==l&&l.vf()&&Hp(b,c,d,k))}}}}}0<d.length&&d.sort(function(a,b){return a-b});return d.length}
function Hp(a,b,c,d){for(var e=K.B(a.y,b.y),f=d.pointsCount,g=d.i(0),h=J.alloc(),k=1;k<f;k++){var l=d.i(k);if(k<f-1){var m=d.i(k+1);if(g.y===l.y&&l.y===m.y){if(l.x>g.x&&m.x>=l.x||l.x<g.x&&m.x<=l.x)continue}else if(g.x===l.x&&l.x===m.x&&(l.y>g.y&&m.y>=l.y||l.y<g.y&&m.y<=l.y))continue}a:{m=a.x;var n=a.y,p=b.x,q=b.y,r=g.x;g=g.y;var u=l.x,x=l.y;if(!K.B(m,p)){if(K.B(n,q)&&K.B(r,u)&&Math.min(m,p)<r&&Math.max(m,p)>r&&Math.min(g,x)<n&&Math.max(g,x)>n&&!K.B(g,x)){h.x=r;h.y=n;m=!0;break a}}else if(!K.B(n,q)&&
K.B(g,x)&&Math.min(n,q)<g&&Math.max(n,q)>g&&Math.min(r,u)<m&&Math.max(r,u)>m&&!K.B(r,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 kp(a){a=a.curve;return a===ah||a===bh}function op(a,b){if(b||kp(a))b=a.diagram,null===b||b.animationManager.isTicking||b.Zh.contains(a)||0===a.Cl.width&&0===a.Cl.height||b.Zh.add(a,a.Cl.copy())}
T.prototype.jq=function(a){var b=this.layer;if(null!==b&&b.visible&&!b.isTemporary){var c=b.diagram;if(null!==c&&!c.animationManager.isAnimating){var d=!1;for(c=c.layers;c.next();){var e=c.value;if(e.visible)if(e===b){d=!0;var f=!1;e=e.Ga.j;for(var g=e.length,h=0;h<g;h++){var k=e[h];k instanceof T&&(k===this?f=!0:f&&Ip(this,k,a))}}else if(d)for(f=e.Ga.j,e=f.length,g=0;g<e;g++)h=f[g],h instanceof T&&Ip(this,h,a)}}}};
function Ip(a,b,c){if(null!==b&&null!==b.sa&&kp(b)){var d=b.routeBounds;d.o()&&(a.routeBounds.Kc(d)||c.Kc(d))&&(a.usesSamePort(b)||b.cc())}}T.prototype.usesSamePort=function(a){var b=this.pointsCount,c=a.pointsCount;if(0<b&&0<c){var d=this.i(0),e=a.i(0);if(d.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};
T.prototype.isVisible=function(){if(!U.prototype.isVisible.call(this))return!1;var a=this.containingGroup,b=!0,c=this.diagram;null!==c&&(b=c.isTreePathToChildren);c=this.fromNode;if(null!==c){if(this.isTreeLink&&b&&!c.isTreeExpanded)return!1;if(c===a)return!0;for(var d=c;null!==d;){if(d.labeledLink===this)return!0;d=d.containingGroup}c=c.findVisibleNode();if(null===c||c===a)return!1}c=this.toNode;if(null!==c){if(this.isTreeLink&&!b&&!c.isTreeExpanded)return!1;if(c===a)return!0;for(b=c;null!==b;){if(b.labeledLink===
this)return!0;b=b.containingGroup}b=c.findVisibleNode();if(null===b||b===a)return!1}return!0};T.prototype.Ob=function(a){U.prototype.Ob.call(this,a);null!==this.Bf&&this.Bf.hm();if(null!==this.bd)for(var b=this.bd.iterator;b.next();)b.value.Ob(a)};
function lp(a){var b=a.Re;if(null!==b){var c=a.jf;if(null!==c){for(var d=a.Se,e=a.kf,f=a=null,g=b.$a.j,h=g.length,k=0;k<h;k++){var l=g[k];if(l.Re===b&&l.Se===d&&l.jf===c&&l.kf===e||l.Re===c&&l.Se===e&&l.jf===b&&l.kf===d)null===f?f=l:(null===a&&(a=[],a.push(f)),a.push(l))}if(null!==a){f=Ro(b,c,d,e);null===f&&(f=new Jp(b,d,c,e),Qo(b,f),Qo(c,f));f.links=a;for(b=0;b<a.length;b++)a[b].Bf=f;f.hm()}}}}function mp(a){var b=a.Bf;null!==b&&(a.Bf=null,a=b.links.indexOf(a),0<=a&&(Oa(b.links,a),b.hm()))}
T.prototype.Bh=function(){return!0};
na.Object.defineProperties(T.prototype,{fromNode:{configurable:!0,get:function(){return this.Re},set:function(a){var b=this.Re;if(b!==a){E&&null!==a&&w(a,V,T,"fromNode");var c=this.fromPort;null!==b&&(this.jf!==b&&Uo(b,this,c),mp(this),this.C(2));this.Re=a;null!==a&&this.Ob(a.isVisible());this.Kf=null;this.Ta();var d=this.diagram;null!==d&&d.partManager.setFromNodeForLink(this,a,b);var e=this.fromPort,f=this.fromPortChanged;if(null!==f){var g=!0;null!==d&&(g=d.fa,d.fa=!0);f(this,c,e);
null!==d&&(d.fa=g)}null!==a&&(this.jf!==a&&To(a,this,e),lp(this),this.C(1));this.g("fromNode",b,a);Oo(this)}}},fromPortId:{configurable:!0,get:function(){return this.Se},set:function(a){var b=this.Se;if(b!==a){E&&z(a,"string",T,"fromPortId");var c=this.fromPort;null!==c&&So(this.fromNode,c);mp(this);this.Se=a;var d=this.fromPort;null!==d&&So(this.fromNode,d);var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.jm()&&g.Mx(f,a)}c!==d&&(this.Kf=null,this.Ta(),f=this.fromPortChanged,
null!==f&&(g=!0,null!==e&&(g=e.fa,e.fa=!0),f(this,c,d),null!==e&&(e.fa=g)));lp(this);this.g("fromPortId",b,a)}}},fromPort:{configurable:!0,get:function(){var a=this.Re;return null===a?null:a.Ys(this.Se)}},fromPortChanged:{configurable:!0,get:function(){return this.Jn},set:function(a){var b=this.Jn;b!==a&&(null!==a&&z(a,"function",T,"fromPortChanged"),this.Jn=a,this.g("fromPortChanged",b,a))}},toNode:{configurable:!0,get:function(){return this.jf},set:function(a){var b=
this.jf;if(b!==a){E&&null!==a&&w(a,V,T,"toNode");var c=this.toPort;null!==b&&(this.Re!==b&&Uo(b,this,c),mp(this),this.C(2));this.jf=a;null!==a&&this.Ob(a.isVisible());this.Kf=null;this.Ta();var d=this.diagram;null!==d&&d.partManager.setToNodeForLink(this,a,b);var e=this.toPort,f=this.toPortChanged;if(null!==f){var g=!0;null!==d&&(g=d.fa,d.fa=!0);f(this,c,e);null!==d&&(d.fa=g)}null!==a&&(this.Re!==a&&To(a,this,e),lp(this),this.C(1));this.g("toNode",b,a);Oo(this)}}},toPortId:{configurable:!0,
get:function(){return this.kf},set:function(a){var b=this.kf;if(b!==a){E&&z(a,"string",T,"toPortId");var c=this.toPort;null!==c&&So(this.toNode,c);mp(this);this.kf=a;var d=this.toPort;null!==d&&So(this.toNode,d);var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.jm()&&g.Qx(f,a)}c!==d&&(this.Kf=null,this.Ta(),f=this.toPortChanged,null!==f&&(g=!0,null!==e&&(g=e.fa,e.fa=!0),f(this,c,d),null!==e&&(e.fa=g)));lp(this);this.g("toPortId",b,a)}}},toPort:{configurable:!0,get:function(){var a=
this.jf;return null===a?null:a.Ys(this.kf)}},toPortChanged:{configurable:!0,get:function(){return this.Ip},set:function(a){var b=this.Ip;b!==a&&(null!==a&&z(a,"function",T,"toPortChanged"),this.Ip=a,this.g("toPortChanged",b,a))}},fromSpot:{configurable:!0,get:function(){return null!==this.R?this.R.Qg:Qd},set:function(a){this.Jc();var b=this.R.Qg;b.A(a)||(E&&w(a,M,T,"fromSpot"),a=a.J(),this.R.Qg=a,this.g("fromSpot",b,a),this.Ta())}},fromEndSegmentLength:{configurable:!0,
enumerable:!0,get:function(){return null!==this.R?this.R.Og:NaN},set:function(a){this.Jc();var b=this.R.Og;b!==a&&(E&&z(a,"number",T,"fromEndSegmentLength"),0>a&&Ca(a,">= 0",T,"fromEndSegmentLength"),this.R.Og=a,this.g("fromEndSegmentLength",b,a),this.Ta())}},fromShortLength:{configurable:!0,get:function(){return null!==this.R?this.R.Pg:NaN},set:function(a){this.Jc();var b=this.R.Pg;b!==a&&(E&&z(a,"number",T,"fromShortLength"),this.R.Pg=a,this.g("fromShortLength",b,a),this.Ta(),this.cc())}},
toSpot:{configurable:!0,get:function(){return null!==this.R?this.R.oh:Qd},set:function(a){this.Jc();var b=this.R.oh;b.A(a)||(E&&w(a,M,T,"toSpot"),a=a.J(),this.R.oh=a,this.g("toSpot",b,a),this.Ta())}},toEndSegmentLength:{configurable:!0,get:function(){return null!==this.R?this.R.mh:NaN},set:function(a){this.Jc();var b=this.R.mh;b!==a&&(E&&z(a,"number",T,"toEndSegmentLength"),0>a&&Ca(a,">= 0",T,"toEndSegmentLength"),this.R.mh=a,this.g("toEndSegmentLength",b,a),this.Ta())}},
toShortLength:{configurable:!0,get:function(){return null!==this.R?this.R.nh:NaN},set:function(a){this.Jc();var b=this.R.nh;b!==a&&(E&&z(a,"number",T,"toShortLength"),this.R.nh=a,this.g("toShortLength",b,a),this.Ta(),this.cc())}},isLabeledLink:{configurable:!0,get:function(){return null===this.bd?!1:0<this.bd.count}},labelNodes:{configurable:!0,get:function(){return null===this.bd?Db:this.bd.iterator}},relinkableFrom:{configurable:!0,get:function(){return 0!==
(this.Va&1)},set:function(a){var b=0!==(this.Va&1);b!==a&&(E&&z(a,"boolean",T,"relinkableFrom"),this.Va^=1,this.g("relinkableFrom",b,a),this.Mb())}},relinkableTo:{configurable:!0,get:function(){return 0!==(this.Va&2)},set:function(a){var b=0!==(this.Va&2);b!==a&&(E&&z(a,"boolean",T,"relinkableTo"),this.Va^=2,this.g("relinkableTo",b,a),this.Mb())}},resegmentable:{configurable:!0,get:function(){return 0!==(this.Va&4)},set:function(a){var b=0!==(this.Va&4);b!==a&&(E&&z(a,
"boolean",T,"resegmentable"),this.Va^=4,this.g("resegmentable",b,a),this.Mb())}},isTreeLink:{configurable:!0,get:function(){return 0!==(this.Va&8)},set:function(a){var b=0!==(this.Va&8);b!==a&&(E&&z(a,"boolean",T,"isTreeLink"),this.Va^=8,this.g("isTreeLink",b,a),null!==this.fromNode&&Lk(this.fromNode),null!==this.toNode&&Lk(this.toNode))}},path:{configurable:!0,get:function(){var a=this.Bb();return a instanceof Hg?a:null}},routeBounds:{configurable:!0,get:function(){this.bj();
var a=this.Cl,b=Infinity,c=Infinity,d=this.pointsCount;if(0===d)a.h(NaN,NaN,0,0);else{if(1===d)d=this.i(0),b=Math.min(d.x,b),c=Math.min(d.y,c),a.h(d.x,d.y,0,0);else if(2===d){d=this.i(0);var e=this.i(1);b=Math.min(d.x,e.x);c=Math.min(d.y,e.y);a.h(d.x,d.y,0,0);a.Me(e)}else if(this.computeCurve()===fh&&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.Xl(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.Xl(e.x,e.y,g.x,g.y,h.x,h.y,k.x,k.y,.5,a);b=Math.min(k.x,b);c=Math.min(k.y,c);e=k}else for(e=this.i(0),f=this.i(1),b=Math.min(e.x,f.x),c=Math.min(e.y,f.y),a.h(e.x,e.y,0,0),a.Me(f),e=2;e<d;e++)f=this.i(e),b=Math.min(f.x,b),c=Math.min(f.y,c),a.Me(f);this.Fu.h(b-a.x,c-a.y)}return a}},midPoint:{configurable:!0,get:function(){this.bj();return this.computeMidPoint(new J)}},midAngle:{configurable:!0,
enumerable:!0,get:function(){this.bj();return this.computeMidAngle()}},flattenedLengths:{configurable:!0,get:function(){if(null===this.wr){this.Mc||np(this);for(var a=this.wr=[],b=this.pointsCount,c=0;c<b-1;c++){var d=this.i(c);var e=this.i(c+1);K.da(d.x,e.x)?(d=e.y-d.y,0>d&&(d=-d)):K.da(d.y,e.y)?(d=e.x-d.x,0>d&&(d=-d)):d=Math.sqrt(d.Fe(e));a.push(d)}}return this.wr}},flattenedTotalLength:{configurable:!0,get:function(){var a=this.fu;if(isNaN(a)){for(var b=this.flattenedLengths,
c=b.length,d=a=0;d<c;d++)a+=b[d];this.fu=a}return a}},points:{configurable:!0,get:function(){return this.yb},set:function(a){var b=this.yb;if(b!==a){var c=null;if(Array.isArray(a)){var d=0===a.length%2;if(d)for(var e=0;e<a.length;e++)if("number"!==typeof a[e]||isNaN(a[e])){d=!1;break}if(d)for(c=new F,d=0;d<a.length/2;d++)e=(new J(a[2*d],a[2*d+1])).freeze(),c.add(e);else{d=!0;for(e=0;e<a.length;e++){var f=a[e];if(!Ja(f)||"number"!==typeof f.x||isNaN(f.x)||"number"!==typeof f.y||isNaN(f.y)){d=
!1;break}}if(d)for(c=new F,d=0;d<a.length;d++)e=a[d],c.add((new J(e.x,e.y)).freeze());else E&&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 F)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.yb=c;this.cc();this.v();np(this);a=this.diagram;null!==a&&(a.Ui||a.undoManager.isUndoingRedoing||a.lt.add(this),a.animationManager.sb&&
(this.dh=c));this.g("points",b,c)}}},pointsCount:{configurable:!0,get:function(){return this.yb.count}},Mc:{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)}},Vu:{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.Ij.value&2)}},isAvoiding:{configurable:!0,get:function(){return 4===(this.Ij.value&4)}},geometry:{configurable:!0,get:function(){this.Un&&(this.bj(),this.sa=this.makeGeometry());
return this.sa}},firstPickIndex:{configurable:!0,get:function(){return 2>=this.pointsCount?0:this.isOrthogonal||!pp(this.computeSpot(!0))?1:0}},lastPickIndex:{configurable:!0,get:function(){var a=this.pointsCount;return 0===a?0:2>=a?a-1:this.isOrthogonal||!pp(this.computeSpot(!1))?a-2:a-1}},adjusting:{configurable:!0,get:function(){return this.Qm},set:function(a){var b=this.Qm;b!==a&&(E&&tb(a,T,T,"adjusting"),this.Qm=a,this.g("adjusting",b,a))}},corner:{configurable:!0,
enumerable:!0,get:function(){return this.ln},set:function(a){var b=this.ln;b!==a&&(E&&z(a,"number",T,"corner"),this.ln=a,this.cc(),this.g("corner",b,a))}},curve:{configurable:!0,get:function(){return this.on},set:function(a){var b=this.on;b!==a&&(E&&tb(a,T,T,"curve"),this.on=a,this.Ta(),this.cc(),op(this,b===bh||b===ah||a===bh||a===ah),this.g("curve",b,a))}},curviness:{configurable:!0,get:function(){return this.pn},set:function(a){var b=this.pn;b!==a&&(E&&z(a,"number",
T,"curviness"),this.pn=a,this.Ta(),this.cc(),this.g("curviness",b,a))}},routing:{configurable:!0,get:function(){return this.Ij},set:function(a){var b=this.Ij;b!==a&&(E&&tb(a,T,T,"routing"),this.Ij=a,this.Kf=null,this.Ta(),op(this,2===(b.value&2)||2===(a.value&2)),this.g("routing",b,a))}},smoothness:{configurable:!0,get:function(){return this.xp},set:function(a){var b=this.xp;b!==a&&(E&&z(a,"number",T,"smoothness"),this.xp=a,this.cc(),this.g("smoothness",b,a))}},key:{configurable:!0,
enumerable:!0,get:function(){var a=this.diagram;if(null!==a&&a.model.jm())return a.model.kc(this.data)}}});T.prototype.invalidateOtherJumpOvers=T.prototype.jq;T.prototype.findClosestSegment=T.prototype.Sy;T.prototype.updateRoute=T.prototype.bj;T.prototype.invalidateRoute=T.prototype.Ta;T.prototype.rollbackRoute=T.prototype.Ix;T.prototype.commitRoute=T.prototype.pf;T.prototype.startRoute=T.prototype.Eh;T.prototype.clearPoints=T.prototype.Xj;T.prototype.removePoint=T.prototype.Hv;
T.prototype.addPointAt=T.prototype.nf;T.prototype.addPoint=T.prototype.Ce;T.prototype.insertPointAt=T.prototype.m;T.prototype.insertPoint=T.prototype.Az;T.prototype.setPointAt=T.prototype.N;T.prototype.setPoint=T.prototype.ld;T.prototype.getPoint=T.prototype.i;T.prototype.getOtherPort=T.prototype.oz;T.prototype.getOtherNode=T.prototype.bt;
var ep=new D(T,"Normal",1),Kp=new D(T,"Orthogonal",2),Lp=new D(T,"AvoidsNodes",6),up=new D(T,"AvoidsNodesStraight",7),ch=new D(T,"None",0),fh=new D(T,"Bezier",9),bh=new D(T,"JumpGap",10),ah=new D(T,"JumpOver",11),fp=new D(T,"End",17),gp=new D(T,"Scale",18),hp=new D(T,"Stretch",19),Ln=new D(T,"OrientAlong",21),Um=new D(T,"OrientPlus90",22),Wm=new D(T,"OrientMinus90",23),ip=new D(T,"OrientOpposite",24),jp=new D(T,"OrientUpright",25),Vm=new D(T,"OrientPlus90Upright",26),Xm=new D(T,"OrientMinus90Upright",
27),Ym=new D(T,"OrientUpright45",28);T.className="Link";T.Normal=ep;T.Orthogonal=Kp;T.AvoidsNodes=Lp;T.AvoidsNodesStraight=up;T.None=ch;T.Bezier=fh;T.JumpGap=bh;T.JumpOver=ah;T.End=fp;T.Scale=gp;T.Stretch=hp;T.OrientAlong=Ln;T.OrientPlus90=Um;T.OrientMinus90=Wm;T.OrientOpposite=ip;T.OrientUpright=jp;T.OrientPlus90Upright=Vm;T.OrientMinus90Upright=Xm;T.OrientUpright45=Ym;function Jp(a,b,c,d){qb(this);this.le=this.Hr=!1;this.ot=a;this.Ex=b;this.wv=c;this.Fx=d;this.links=[]}
Jp.prototype.hm=function(){if(!this.Hr){var a=this.links;0<a.length&&(a=a[0].diagram,null!==a&&(a.Fw.add(this),this.le=a.undoManager.isUndoingRedoing))}this.Hr=!0};Jp.prototype.fw=function(){if(this.Hr){this.Hr=!1;var a=this.links;if(0<a.length){var b=a[0],c=b.diagram;c=null===c||c.Ui&&!this.le;this.le=!1;b.arrangeBundledLinks(a,c);1===a.length&&(b.Bf=null,a.length=0)}0===a.length&&(a=this.ot,null!==this&&null!==a.Oe&&a.Oe.remove(this),a=this.wv,null!==this&&null!==a.Oe&&a.Oe.remove(this))}};
Jp.className="LinkBundle";function Ak(){qb(this);this.Rx=this.group=null;this.ft=!0;this.abort=!1;this.Md=this.Ld=1;this.qo=this.po=-1;this.mc=this.lc=8;this.Eb=[[]];this.Qj=this.Pj=0;this.kA=!1;this.eA=22;this.Iz=111}
Ak.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.Ld=Math.floor((a.x-this.lc)/this.lc)*this.lc;this.Md=Math.floor((b-this.mc)/this.mc)*this.mc;this.po=Math.ceil((c+2*this.lc)/this.lc)*this.lc;this.qo=Math.ceil((d+2*this.mc)/this.mc)*this.mc;a=1+(Math.ceil((this.po-this.Ld)/this.lc)|0);b=1+(Math.ceil((this.qo-this.Md)/this.mc)|0);if(null===this.Eb||this.Pj<a-1||this.Qj<b-1){c=[];for(d=0;d<=a;d++)c[d]=[];this.Eb=c;this.Pj=a-1;this.Qj=b-1}a=
Mp;if(null!==this.Eb)for(b=0;b<=this.Pj;b++)for(c=0;c<=this.Qj;c++)this.Eb[b][c]=a}};function vp(a,b,c){return a.Ld<=b&&b<=a.po&&a.Md<=c&&c<=a.qo}function xp(a,b,c){if(!vp(a,b,c))return Mp;b-=a.Ld;b/=a.lc;c-=a.Md;c/=a.mc;return a.Eb[b|0][c|0]}function Dk(a,b,c){vp(a,b,c)&&(b-=a.Ld,b/=a.lc,c-=a.Md,c/=a.mc,a.Eb[b|0][c|0]=zp)}function Ck(a){if(null!==a.Eb)for(var b=0;b<=a.Pj;b++)for(var c=0;c<=a.Qj;c++)a.Eb[b][c]>=Bp&&(a.Eb[b][c]=Mp)}
Ak.prototype.ik=function(a,b,c,d){if(a>this.po||a+c<this.Ld||b>this.qo||b+d<this.Md)return!0;a=(a-this.Ld)/this.lc|0;b=(b-this.Md)/this.mc|0;c=Math.max(0,c)/this.lc+1|0;var e=Math.max(0,d)/this.mc+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.Pj)|0;for(c=Math.min(b+e-1,this.Qj)|0;a<=d;a++)for(e=b;e<=c;e++)if(this.Eb[a][e]===zp)return!1;return!0};
function Np(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.Eb[l][m];if(n>=Bp&&n<yp)for(e?m+=d:l+=d,n+=1;f<=l&&l<=g&&h<=m&&m<=k&&!(n>=a.Eb[l][m]);)a.Eb[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)Np(a,b,c,1,!e,f,g,h,k),Np(a,b,c,-1,!e,f,g,h,k);else for(c+=d;c>l;c+=d)Np(a,b,c,1,!e,f,g,h,k),Np(a,b,c,-1,!e,f,g,h,k);else if(0<d)for(b+=d;b<l;b+=d)Np(a,b,c,1,!e,f,g,h,k),Np(a,b,c,-1,!e,f,g,h,k);else for(b+=d;b>l;b+=d)Np(a,b,c,1,!e,f,g,h,k),Np(a,b,c,-1,!e,f,g,h,
k)}}function Op(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=zp,m=Bp;for(a.Eb[b][c]=m;l===zp&&b>f&&b<g&&c>h&&c<k;)m+=1,a.Eb[b][c]=m,e?c+=d:b+=d,l=a.Eb[b][c]}function Pp(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=zp,m=yp;for(a.Eb[b][c]=m;l===zp&&b>f&&b<g&&c>h&&c<k;)a.Eb[b][c]=m,e?c+=d:b+=d,l=a.Eb[b][c]}
function wp(a,b,c,d,e,f){if(null!==a.Eb){a.abort=!1;var g=b.x,h=b.y;if(vp(a,g,h)&&(g-=a.Ld,g/=a.lc,h-=a.Md,h/=a.mc,b=d.x,d=d.y,vp(a,b,d)))if(b-=a.Ld,b/=a.lc,d-=a.Md,d/=a.mc,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.Ld;k/=a.lc;l-=a.Md;l/=a.mc;m-=a.Ld;m/=a.lc;n-=a.Md;n/=a.mc;f=Math.max(0,Math.min(a.Pj,k|0));m=Math.min(a.Pj,Math.max(0,m|0));l=Math.max(0,Math.min(a.Qj,l|0));n=Math.min(a.Qj,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.Eb[g][h]===zp?(Op(a,g,h,k,c,f,m,l,n),Op(a,g,h,1,!c,f,m,l,n),Op(a,g,h,-1,!c,f,m,l,n)):Op(a,g,h,k,c,g,h,g,h);a.Eb[b][d]===zp?(Pp(a,b,d,0===e||90===e?1:-1,90===e||270===e,f,m,l,n),Pp(a,b,d,1,!(90===e||270===e),f,m,l,n),Pp(a,b,d,-1,!(90===e||270===e),f,m,l,n)):Pp(a,b,d,k,c,b,d,b,d);a.abort||(Np(a,g,h,1,!1,f,m,l,n),Np(a,g,h,-1,!1,f,m,l,n),Np(a,g,h,1,!0,f,m,l,n),Np(a,g,h,-1,!0,f,m,l,n))}}}
na.Object.defineProperties(Ak.prototype,{bounds:{configurable:!0,get:function(){return new L(this.Ld,this.Md,this.po-this.Ld,this.qo-this.Md)}},Zl:{configurable:!0,get:function(){return this.lc},set:function(a){0<a&&a!==this.lc&&(this.lc=a,this.initialize(this.bounds))}},Yl:{configurable:!0,get:function(){return this.mc},set:function(a){0<a&&a!==this.mc&&(this.mc=a,this.initialize(this.bounds))}}});var zp=0,Bp=1,yp=999999,Mp=yp+1;Ak.className="PositionArray";
function sp(){qb(this);this.port=this.node=null;this.Yd=[];this.pq=!1}sp.prototype.toString=function(){for(var a=this.Yd,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 Qp(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}sp.prototype.hm=function(){this.Yd.length=0};
function tp(a,b){var c=a.Yd;if(0===c.length){a:if(!a.pq){c=a.pq;a.pq=!0;var d=null,e=a.node;e=e instanceof xg?e:null;if(null===e||e.isSubGraphExpanded)var f=a.node.ev(a.port.portId);else{if(!e.actualBounds.o()){a.pq=c;break a}d=e;f=d.dv()}var g=a.Yd.length=0,h=a.port.oa(fd,J.alloc()),k=a.port.oa(ud,J.alloc());e=L.allocAt(h.x,h.y,0,0);e.Me(k);J.free(h);J.free(k);h=J.allocAt(e.x+e.width/2,e.y+e.height/2);k=a.port.Oi();for(f=f.iterator;f.next();){var l=f.value;if(l.isVisible()&&l.fromPort!==l.toPort){var m=
l.fromPort===a.port||null!==l.fromNode&&l.fromNode.Xd(d),n=l.computeSpot(m,a.port);if(n.uf()&&(m=m?l.toPort:l.fromPort,null!==m)){var p=m.part;if(null!==p){var q=p.findVisibleNode();null!==q&&q!==p&&(p=q,m=p.port);m=l.computeOtherPoint(p,m);p=h.Xa(m);p-=k;0>p&&(p+=360);n=Qp(e,n,p,l.isOrthogonal);0===n?(n=4,180<p&&(p-=360)):n=90===n?8:180===n?2:1;q=a.Yd[g];void 0===q?(q=new Rp(l,p,n),a.Yd[g]=q):(q.link=l,q.angle=p,q.Ac=n);q.Av.set(m);g++}}}}J.free(h);a.Yd.sort(sp.prototype.l);k=a.Yd.length;d=-1;for(g=
h=0;g<k;g++)f=a.Yd[g],void 0!==f&&(f.Ac!==d&&(d=f.Ac,h=0),f.gq=h,h++);d=-1;h=0;for(g=k-1;0<=g;g--)k=a.Yd[g],void 0!==k&&(k.Ac!==d&&(d=k.Ac,h=k.gq+1),k.am=h);g=a.Yd;n=a.port;d=a.node.portSpreading;h=J.alloc();k=J.alloc();f=J.alloc();l=J.alloc();n.oa(fd,h);n.oa(hd,k);n.oa(ud,f);n.oa(sd,l);q=p=m=n=0;if(d===bp)for(var r=0;r<g.length;r++){var u=g[r];if(null!==u){var x=u.link.computeThickness();switch(u.Ac){case 8:p+=x;break;case 2:q+=x;break;case 1:n+=x;break;default:case 4:m+=x}}}var y=r=0,A=1,C=u=0;
for(x=0;x<g.length;x++){var G=g[x];if(null!==G){if(r!==G.Ac){r=G.Ac;switch(r){case 8:var I=f;y=l;break;case 2:I=l;y=h;break;case 1:I=h;y=k;break;default:case 4:I=k,y=f}u=y.x-I.x;C=y.y-I.y;switch(r){case 8:p>Math.abs(u)?(A=Math.abs(u)/p,p=Math.abs(u)):A=1;break;case 2:q>Math.abs(C)?(A=Math.abs(C)/q,q=Math.abs(C)):A=1;break;case 1:n>Math.abs(u)?(A=Math.abs(u)/n,n=Math.abs(u)):A=1;break;default:case 4:m>Math.abs(C)?(A=Math.abs(C)/m,m=Math.abs(C)):A=1}y=0}var O=G.nq;if(d===bp){G=G.link.computeThickness();
G*=A;O.set(I);switch(r){case 8:O.x=I.x+u/2+p/2-y-G/2;break;case 2:O.y=I.y+C/2+q/2-y-G/2;break;case 1:O.x=I.x+u/2-n/2+y+G/2;break;default:case 4:O.y=I.y+C/2-m/2+y+G/2}y+=G}else{var R=.5;d===Po&&(R=(G.gq+1)/(G.am+1));O.x=I.x+u*R;O.y=I.y+C*R}}}J.free(h);J.free(k);J.free(f);J.free(l);I=a.Yd;for(g=0;g<I.length;g++)d=I[g],null!==d&&(d.bv=a.computeEndSegmentLength(d));a.pq=c;L.free(e)}c=a.Yd}for(a=0;a<c.length;a++)if(e=c[a],null!==e&&e.link===b)return e;return null}
sp.prototype.l=function(a,b){return a===b?0:null===a?-1:null===b?1:a.Ac<b.Ac?-1:a.Ac>b.Ac?1:a.angle<b.angle?-1:a.angle>b.angle?1:0};sp.prototype.computeEndSegmentLength=function(a){var b=a.link,c=b.computeEndSegmentLength(this.node,this.port,ed,b.fromPort===this.port),d=a.gq;if(0>d)return c;var e=a.am;if(1>=e||!b.isOrthogonal)return c;b=a.Av;var f=a.nq;if(2===a.Ac||8===a.Ac)d=e-1-d;return((a=2===a.Ac||4===a.Ac)?b.y<f.y:b.x<f.x)?c+8*d:(a?b.y===f.y:b.x===f.x)?c:c+8*(e-1-d)};sp.className="Knot";
function Rp(a,b,c){this.link=a;this.angle=b;this.Ac=c;this.Av=new J;this.am=this.gq=0;this.nq=new J;this.bv=0}Rp.prototype.toString=function(){return this.link.toString()+" "+this.angle.toString()+" "+this.Ac.toString()+":"+this.gq.toString()+"/"+this.am.toString()+" "+this.nq.toString()+" "+this.bv.toString()+" "+this.Av.toString()};Rp.className="LinkInfo";function jl(){this.oh=this.Qg=Qd;this.nh=this.Pg=this.mh=this.Og=NaN;this.Gp=this.Hn=null;this.Hp=this.In=Infinity}
jl.prototype.copy=function(){var a=new jl;a.Qg=this.Qg.J();a.oh=this.oh.J();a.Og=this.Og;a.mh=this.mh;a.Pg=this.Pg;a.nh=this.nh;a.Hn=this.Hn;a.Gp=this.Gp;a.In=this.In;a.Hp=this.Hp;return a};jl.className="LinkSettings";function Oi(){0<arguments.length&&Da(Oi);qb(this);this.L=this.D=null;this.Pf=this.Wn=!0;this.bo=!1;this.Um=(new J(0,0)).freeze();this.Zn=!0;this.Yn=null;this.zw="";this.w=null;this.ao=!1;this.l=null}
Oi.prototype.cloneProtected=function(a){a.Wn=this.Wn;a.Pf=this.Pf;a.bo=this.bo;a.Um.assign(this.Um);a.Zn=this.Zn;a.Yn=this.Yn;a.zw=this.zw;a.ao=!0};Oi.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};Oi.prototype.hb=function(a){Fa(this,a)};Oi.prototype.toString=function(){var a=Va(this.constructor);a+="(";null!==this.group&&(a+=" in "+this.group);null!==this.diagram&&(a+=" for "+this.diagram);return a+")"};
Oi.prototype.C=function(){if(this.isValidLayout){var a=this.diagram;if(null!==a&&!a.undoManager.isUndoingRedoing){var b=a.animationManager;!b.isTicking&&(b.isAnimating&&b.xd(),this.isOngoing&&a.Ui||this.isInitial&&!a.Ui)&&(this.isValidLayout=!1,a.ec())}}};Oi.prototype.createNetwork=function(){return new Sp(this)};Oi.prototype.makeNetwork=function(a){var b=this.createNetwork();a instanceof P?(b.pg(a.nodes,!0),b.pg(a.links,!0)):a instanceof xg?b.pg(a.memberParts):b.pg(a.iterator);return b};
Oi.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.Ca("Layout"),this.commitLayout()}finally{null!==a&&a.ab("Layout")}};Oi.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()}};
Oi.prototype.doLayout=function(a){E&&null===a&&v("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");var b=new H;a instanceof P?(Tp(this,b,a.nodes,!0,this.rk,!0,!1,!0),Tp(this,b,a.parts,!0,this.rk,!0,!1,!0)):a instanceof xg?Tp(this,b,a.memberParts,!1,this.rk,!0,!1,!0):b.addAll(a.iterator);var c=b.count;if(0<c){a=this.diagram;null!==a&&a.Ca("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;Up(k);var l=k.measuredBounds,m=l.width;l=l.height;k.moveTo(e,f);k instanceof xg&&(k.rk=!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};Oi.prototype.rk=function(a){return!a.location.o()||a instanceof xg&&a.rk?!0:!1};
function Tp(a,b,c,d,e,f,g,h){for(c=c.iterator;c.next();){var k=c.value;d&&!k.isTopLevel||null!==e&&!e(k)||!k.canLayout()||(f&&k instanceof V?k.isLinkLabel||(k instanceof xg?null===k.layout?Tp(a,b,k.memberParts,!1,e,f,g,h):(Up(k),b.add(k)):(Up(k),b.add(k))):g&&k instanceof T?b.add(k):!h||!k.dc()||k instanceof V||(Up(k),b.add(k)))}}function Up(a){var b=a.actualBounds;(0===b.width||0===b.height||isNaN(b.width)||isNaN(b.height))&&a.bc()}
Oi.prototype.Qi=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};Oi.prototype.bx=function(a){var b=new H;a instanceof P?(Tp(this,b,a.nodes,!0,null,!0,!0,!0),Tp(this,b,a.links,!0,null,!0,!0,!0),Tp(this,b,a.parts,!0,null,!0,!0,!0)):a instanceof xg?Tp(this,b,a.memberParts,!1,null,!0,!0,!0):Tp(this,b,a.iterator,!1,null,!0,!0,!0);return b};
Oi.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.oa(fd),(isNaN(c.x)||isNaN(c.y))&&c.set(a),a=b.padding,c.x+=a.left,c.y+=a.top);return c}return a};
na.Object.defineProperties(Oi.prototype,{diagram:{configurable:!0,get:function(){return this.D},set:function(a){null!==a&&w(a,P,Oi,"diagram");this.D=a}},group:{configurable:!0,get:function(){return this.L},set:function(a){this.L!==a&&(null!==a&&w(a,xg,Oi,"group"),this.L=a,null!==a&&(this.D=a.diagram))}},isOngoing:{configurable:!0,get:function(){return this.Wn},set:function(a){this.Wn!==a&&(z(a,"boolean",Oi,"isOngoing"),this.Wn=a)}},isInitial:{configurable:!0,
enumerable:!0,get:function(){return this.Pf},set:function(a){z(a,"boolean",Oi,"isInitial");this.Pf=a;a||(this.ao=!0)}},isViewportSized:{configurable:!0,get:function(){return this.bo},set:function(a){this.bo!==a&&(z(a,"boolean",Oi,"isViewportSized"),(this.bo=a)&&this.C())}},isRouting:{configurable:!0,get:function(){return this.Zn},set:function(a){this.Zn!==a&&(z(a,"boolean",Oi,"isRouting"),this.Zn=a)}},isRealtime:{configurable:!0,get:function(){return this.Yn},
set:function(a){this.Yn!==a&&(null!==a&&z(a,"boolean",Oi,"isRealtime"),this.Yn=a)}},isValidLayout:{configurable:!0,get:function(){return this.ao},set:function(a){this.ao!==a&&(z(a,"boolean",Oi,"isValidLayout"),this.ao=a,a||(a=this.diagram,null!==a&&(a.Eg=!0)))}},network:{configurable:!0,get:function(){return this.l},set:function(a){this.l!==a&&(null!==a&&w(a,Sp,Oi,"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&&z(a,"function",Oi,"boundsComputation"),this.w=a,this.C())}},arrangementOrigin:{configurable:!0,get:function(){return this.Um},set:function(a){w(a,J,Oi,"arrangementOrigin");this.Um.A(a)||(this.Um.assign(a),this.C())}}});Oi.prototype.collectParts=Oi.prototype.bx;Oi.prototype.getLayoutBounds=Oi.prototype.Qi;Oi.prototype.invalidateLayout=Oi.prototype.C;Oi.className="Layout";
function Sp(a){qb(this);E&&!a&&v("LayoutNetwork constructor requires non-null Layout argument");this.ic=a;this.lf=new H;this.he=new H;this.pt=new Ub;this.kt=new Ub}Sp.prototype.clear=function(){if(this.lf)for(var a=this.lf.iterator;a.next();)a.value.clear();if(this.he)for(a=this.he.iterator;a.next();)a.value.clear();this.lf=new H;this.he=new H;this.pt=new Ub;this.kt=new Ub};
Sp.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.lf.count+" edges: "+this.he.count;if(1<a){for(var c=this.lf.iterator;c.next();)b+="\n    "+c.value.toString(a-1);for(c=this.he.iterator;c.next();)b+="\n    "+c.value.toString(a-1)}return b};Sp.prototype.createVertex=function(){return new Vp(this)};Sp.prototype.createEdge=function(){return new Wp(this)};
Sp.prototype.pg=function(a,b,c){if(null!==a){void 0===b&&(b=!1);z(b,"boolean",Sp,"addParts:toplevelonly");void 0===c&&(c=null);null===c&&(c=function(a){if(a instanceof V)return!a.isLinkLabel;if(a instanceof T){var b=a.fromNode;if(null===b||b.isLinkLabel)return!1;a=a.toNode;return null===a||a.isLinkLabel?!1:!0}return!1});for(a=a.iterator;a.next();){var d=a.value;if(d instanceof V&&(!b||d.isTopLevel)&&d.canLayout()&&c(d))if(d instanceof xg&&null===d.layout)this.pg(d.memberParts,!1);else if(null===this.Ni(d)){var e=
this.createVertex();e.node=d;this.uh(e)}}for(a.reset();a.next();)if(d=a.value,d instanceof T&&(!b||d.isTopLevel)&&d.canLayout()&&c(d)&&null===this.$p(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.jk(f,e,d))}}};
Sp.prototype.findGroupVertex=function(a){if(null===a)return null;var b=a.findVisibleNode();if(null===b)return null;a=this.Ni(b);if(null!==a)return a;for(b=b.containingGroup;null!==b;){a=this.Ni(b);if(null!==a)return a;b=b.containingGroup}return null};t=Sp.prototype;t.uh=function(a){if(null!==a){E&&w(a,Vp,Sp,"addVertex:vertex");this.lf.add(a);var b=a.node;null!==b&&this.pt.add(b,a);a.network=this}};
t.Wl=function(a){if(null===a)return null;E&&w(a,V,Sp,"addNode:node");var b=this.Ni(a);null===b&&(b=this.createVertex(),b.node=a,this.uh(b));return b};t.Zu=function(a){if(null!==a&&(E&&w(a,Vp,Sp,"deleteVertex:vertex"),Xp(this,a))){for(var b=a.zg,c=b.count-1;0<=c;c--){var d=b.O(c);this.ck(d)}b=a.qg;for(a=b.count-1;0<=a;a--)c=b.O(a),this.ck(c)}};function Xp(a,b){if(null===b)return!1;var c=a.lf.remove(b);c&&a.pt.remove(b.node);return c}
t.Iy=function(a){null!==a&&(E&&w(a,V,Sp,"deleteNode:node"),a=this.Ni(a),null!==a&&this.Zu(a))};t.Ni=function(a){if(null===a)return null;E&&w(a,V,Sp,"findVertex:node");return this.pt.K(a)};t.Sj=function(a){if(null!==a){E&&w(a,Wp,Sp,"addEdge:edge");this.he.add(a);var b=a.link;null!==b&&null===this.$p(b)&&this.kt.add(b,a);b=a.toVertex;null!==b&&b.Nu(a);b=a.fromVertex;null!==b&&b.Lu(a);a.network=this}};
t.ny=function(a){if(null===a)return null;E&&w(a,T,Sp,"addLink:link");var b=a.fromNode,c=a.toNode,d=this.$p(a);null===d?(d=this.createEdge(),d.link=a,null!==b&&(d.fromVertex=this.Wl(b)),null!==c&&(d.toVertex=this.Wl(c)),this.Sj(d)):(null!==b?d.fromVertex=this.Wl(b):d.fromVertex=null,null!==c?d.toVertex=this.Wl(c):d.toVertex=null);return d};t.ck=function(a){if(null!==a){E&&w(a,Wp,Sp,"deleteEdge:edge");var b=a.toVertex;null!==b&&b.Yu(a);b=a.fromVertex;null!==b&&b.Xu(a);Yp(this,a)}};
function Yp(a,b){null!==b&&a.he.remove(b)&&a.kt.remove(b.link)}t.Hy=function(a){null!==a&&(E&&w(a,T,Sp,"deleteLink:link"),a=this.$p(a),null!==a&&this.ck(a))};t.$p=function(a){if(null===a)return null;E&&w(a,T,Sp,"findEdge:link");return this.kt.K(a)};
t.jk=function(a,b,c){if(null===a||null===b)return null;E&&(w(a,Vp,Sp,"linkVertexes:fromVertex"),w(b,Vp,Sp,"linkVertexes:toVertex"),null!==c&&w(c,T,Sp,"linkVertexes:link"));if(a.network===this&&b.network===this){var d=this.createEdge();d.link=c;d.fromVertex=a;d.toVertex=b;this.Sj(d);return d}return null};t.ym=function(a){if(null!==a){E&&w(a,Wp,Sp,"reverseEdge:edge");var b=a.fromVertex,c=a.toVertex;null!==b&&null!==c&&(b.Xu(a),c.Yu(a),a.ym(),b.Nu(a),c.Lu(a))}};
t.Xp=function(){for(var a=Qa(),b=this.he.iterator;b.next();){var c=b.value;c.fromVertex===c.toVertex&&a.push(c)}b=a.length;for(c=0;c<b;c++)this.ck(a[c]);Ta(a)};Sp.prototype.deleteArtificialVertexes=function(){for(var a=Qa(),b=this.lf.iterator;b.next();){var c=b.value;null===c.node&&a.push(c)}c=a.length;for(b=0;b<c;b++)this.Zu(a[b]);b=Qa();for(c=this.he.iterator;c.next();){var d=c.value;null===d.link&&b.push(d)}c=b.length;for(d=0;d<c;d++)this.ck(b[d]);Ta(a);Ta(b)};
function Zp(a){for(var b=Qa(),c=a.he.iterator;c.next();){var d=c.value;null!==d.fromVertex&&null!==d.toVertex||b.push(d)}c=b.length;for(d=0;d<c;d++)a.ck(b[d]);Ta(b)}
Sp.prototype.Sx=function(){this.deleteArtificialVertexes();Zp(this);this.Xp();for(var a=new F,b=!0;b;){b=!1;for(var c=this.lf.iterator;c.next();){var d=c.value;if(0<d.zg.count||0<d.qg.count){b=this.layout.createNetwork();a.add(b);$p(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 $p(a,b,c){if(null!==c&&c.network!==b){Xp(a,c);b.uh(c);for(var d=c.sourceEdges;d.next();){var e=d.value;e.network!==b&&(Yp(a,e),b.Sj(e),$p(a,b,e.fromVertex))}for(d=c.destinationEdges;d.next();)c=d.value,c.network!==b&&(Yp(a,c),b.Sj(c),$p(a,b,c.toVertex))}}Sp.prototype.Ry=function(){for(var a=new H,b=this.lf.iterator;b.next();)a.add(b.value.node);for(b=this.he.iterator;b.next();)a.add(b.value.link);return a};
na.Object.defineProperties(Sp.prototype,{layout:{configurable:!0,get:function(){return this.ic},set:function(a){null!==a&&(this.ic=a)}},vertexes:{configurable:!0,get:function(){return this.lf}},edges:{configurable:!0,get:function(){return this.he}}});Sp.prototype.findAllParts=Sp.prototype.Ry;Sp.prototype.splitIntoSubNetworks=Sp.prototype.Sx;Sp.prototype.deleteSelfEdges=Sp.prototype.Xp;Sp.prototype.reverseEdge=Sp.prototype.ym;Sp.prototype.linkVertexes=Sp.prototype.jk;
Sp.prototype.findEdge=Sp.prototype.$p;Sp.prototype.deleteLink=Sp.prototype.Hy;Sp.prototype.deleteEdge=Sp.prototype.ck;Sp.prototype.addLink=Sp.prototype.ny;Sp.prototype.addEdge=Sp.prototype.Sj;Sp.prototype.findVertex=Sp.prototype.Ni;Sp.prototype.deleteNode=Sp.prototype.Iy;Sp.prototype.deleteVertex=Sp.prototype.Zu;Sp.prototype.addNode=Sp.prototype.Wl;Sp.prototype.addVertex=Sp.prototype.uh;Sp.prototype.addParts=Sp.prototype.pg;Sp.className="LayoutNetwork";
function Vp(a){qb(this);E&&!a&&v("LayoutVertex constructor requires non-null LayoutNetwork argument");this.Oc=a;this.l=(new L(0,0,10,10)).freeze();this.w=(new J(5,5)).freeze();this.ni=this.kb=null;this.zg=new F;this.qg=new F}Vp.prototype.clear=function(){this.ni=this.kb=null;this.zg=new F;this.qg=new F};
Vp.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutVertex#"+Jb(this);if(0<a&&(b+=null!==this.node?"("+this.node.toString()+")":"",1<a)){a="";for(var c=!0,d=this.zg.iterator;d.next();){var e=d.value;c?c=!1:a+=",";a+=e.toString(0)}e="";c=!0;for(d=this.qg.iterator;d.next();){var f=d.value;c?c=!1:e+=",";e+=f.toString(0)}b+=" sources: "+a+" destinations: "+e}return b};
Vp.prototype.commit=function(){var a=this.kb;if(null!==a){var b=this.bounds,c=a.bounds;Ja(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 xg)){c=L.alloc();var d=this.network.layout.Qi(a,c),e=a.locationObject.oa(qd);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)}};
Vp.prototype.Nu=function(a){null!==a&&(E&&w(a,Wp,Vp,"addSourceEdge:edge"),this.zg.contains(a)||this.zg.add(a))};Vp.prototype.Yu=function(a){null!==a&&(E&&w(a,Wp,Vp,"deleteSourceEdge:edge"),this.zg.remove(a))};Vp.prototype.Lu=function(a){null!==a&&(E&&w(a,Wp,Vp,"addDestinationEdge:edge"),this.qg.contains(a)||this.qg.add(a))};Vp.prototype.Xu=function(a){null!==a&&(E&&w(a,Wp,Vp,"deleteDestinationEdge:edge"),this.qg.remove(a))};
function aq(a,b){E&&w(a,Vp,Vp,"standardComparer:m");E&&w(b,Vp,Vp,"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}
na.Object.defineProperties(Vp.prototype,{sourceEdgesArrayAccess:{configurable:!0,get:function(){return this.zg._dataArray}},destinationEdgesArrayAccess:{configurable:!0,get:function(){return this.qg._dataArray}},data:{configurable:!0,get:function(){return this.kb},set:function(a){this.kb=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){E&&null!==a&&w(a,V,Vp,"node");this.ni=a;a.bc();var b=this.network.layout,c=L.alloc(),d=b.Qi(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 xg)&&(a=a.locationObject.oa(qd),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)||(E&&w(a,L,Vp,"bounds"),this.l.assign(a))}},focus:{configurable:!0,
get:function(){return this.w},set:function(a){this.w.A(a)||(E&&w(a,J,Vp,"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&&(E&&B(a,Vp,"centerX"),b.ja(),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&&(E&&B(a,Vp,"centerY"),b.ja(),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.ja(),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.ja(),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.ja(),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.ja(),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.ja(),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.ja(),b.height=a,b.freeze())}},network:{configurable:!0,get:function(){return this.Oc},set:function(a){E&&w(a,Sp,Vp,"network");this.Oc=a}},sourceVertexes:{configurable:!0,get:function(){for(var a=new H,b=this.sourceEdges;b.next();)a.add(b.value.fromVertex);
return a.iterator}},destinationVertexes:{configurable:!0,get:function(){for(var a=new H,b=this.destinationEdges;b.next();)a.add(b.value.toVertex);return a.iterator}},vertexes:{configurable:!0,get:function(){for(var a=new H,b=this.sourceEdges;b.next();)a.add(b.value.fromVertex);for(b=this.destinationEdges;b.next();)a.add(b.value.toVertex);return a.iterator}},sourceEdges:{configurable:!0,get:function(){return this.zg.iterator}},destinationEdges:{configurable:!0,
enumerable:!0,get:function(){return this.qg.iterator}},edges:{configurable:!0,get:function(){for(var a=new F,b=this.sourceEdges;b.next();)a.add(b.value);for(b=this.destinationEdges;b.next();)a.add(b.value);return a.iterator}},edgesCount:{configurable:!0,get:function(){return this.zg.count+this.qg.count}}});Vp.prototype.deleteDestinationEdge=Vp.prototype.Xu;Vp.prototype.addDestinationEdge=Vp.prototype.Lu;Vp.prototype.deleteSourceEdge=Vp.prototype.Yu;
Vp.prototype.addSourceEdge=Vp.prototype.Nu;Vp.className="LayoutVertex";Vp.standardComparer=aq;
Vp.smartComparer=function(a,b){E&&w(a,Vp,Vp,"smartComparer:m");E&&w(b,Vp,Vp,"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 Wp(a){qb(this);E&&!a&&v("LayoutEdge constructor requires non-null LayoutNetwork argument");this.Xb=a;this.kg=this.Mf=this.rl=this.kb=null}Wp.prototype.clear=function(){this.kg=this.Mf=this.rl=this.kb=null};
Wp.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutEdge#"+Jb(this);0<a&&(b+=null!==this.rl?"("+this.rl.toString()+")":"",1<a&&(b+=" "+(this.Mf?this.Mf.toString():"null")+" --\x3e "+(this.kg?this.kg.toString():"null")));return b};Wp.prototype.ym=function(){var a=this.Mf;this.Mf=this.kg;this.kg=a};Wp.prototype.commit=function(){};Wp.prototype.tx=function(a){E&&w(a,Vp,Wp,"getOtherVertex:v");return this.kg===a?this.Mf:this.Mf===a?this.kg:null};
na.Object.defineProperties(Wp.prototype,{network:{configurable:!0,get:function(){return this.Xb},set:function(a){E&&w(a,Sp,Wp,"network");this.Xb=a}},data:{configurable:!0,get:function(){return this.kb},set:function(a){this.kb!==a&&(E&&null!==a&&z(a,"object",Wp,"data"),this.kb=a)}},link:{configurable:!0,get:function(){return this.rl},set:function(a){this.rl!==a&&(E&&null!==a&&w(a,T,Wp,"link"),this.rl=a)}},fromVertex:{configurable:!0,get:function(){return this.Mf},
set:function(a){this.Mf!==a&&(E&&null!==a&&w(a,Vp,Wp,"network"),this.Mf=a)}},toVertex:{configurable:!0,get:function(){return this.kg},set:function(a){this.kg!==a&&(E&&null!==a&&w(a,Vp,Wp,"network"),this.kg=a)}}});Wp.prototype.getOtherVertex=Wp.prototype.tx;Wp.className="LayoutEdge";
function Sk(){0<arguments.length&&Da(Sk);Oi.call(this);this.isViewportSized=!0;this.Np=this.Op=NaN;this.Gg=(new Zb(NaN,NaN)).freeze();this.cf=(new Zb(10,10)).freeze();this.xb=bq;this.Db=cq;this.Tc=dq;this.Pc=eq}ma(Sk,Oi);Sk.prototype.cloneProtected=function(a){Oi.prototype.cloneProtected.call(this,a);a.Op=this.Op;a.Np=this.Np;a.Gg.assign(this.Gg);a.cf.assign(this.cf);a.xb=this.xb;a.Db=this.Db;a.Tc=this.Tc;a.Pc=this.Pc};
Sk.prototype.hb=function(a){a.classType===Sk?a===dq||a===fq||a===gq||a===hq?this.sorting=a:a===cq||a===iq?this.arrangement=a:a===bq||a===jq?this.alignment=a:v("Unknown enum value: "+a):Oi.prototype.hb.call(this,a)};
Sk.prototype.doLayout=function(a){E&&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.bx(a);a=this.diagram;for(var c=b.copy().iterator;c.next();){var d=c.value;if(!d.Bh()||null===d.fromNode&&null===d.toNode){if(d.bc(),d instanceof xg)for(d=d.memberParts;d.next();)b.remove(d.value)}else b.remove(d)}var e=b.Oa();if(0!==e.length){switch(this.sorting){case hq:e.reverse();
break;case dq:e.sort(this.comparer);break;case fq: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.Ca("Layout");d=[];switch(this.alignment){case jq: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.Qi(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 q=this.Qi(e[p],l);n=Math.max(n,q.height)}n=Math.max(n+k,1);p=this.arrangement;for(var r=q=this.arrangementOrigin.x,u=this.arrangementOrigin.y,x=0,y=0,A=0;A<e.length;A++){var C=e[A],G=this.Qi(C,l),I=Math.ceil((G.width+h)/m)*m,O=Math.ceil((G.height+k)/n)*n;switch(p){case iq:var R=Math.abs(r-G.width);break;default:R=r+G.width}if(0<f&&x>f-1||
0<g&&0<x&&R-q>g)d.push(new L(0,u,g+h,y)),x=0,r=q,u+=y,y=0;y=Math.max(y,O);switch(p){case iq:G=-G.width;break;default:G=0}C.moveTo(r+G,u);switch(p){case iq:r-=I;break;default:r+=I}x++}d.push(new L(0,u,g+h,y));L.free(l);break;case bq:k=g;m=f;n=b;p=c;g=L.alloc();q=Math.max(this.cellSize.width,1);f=u=l=0;h=J.alloc();for(r=0;r<e.length;r++)y=e[r],x=this.Qi(y,g),y=y.sf(y.locationObject,y.locationSpot,h),l=Math.max(l,y.x),u=Math.max(u,x.width-y.x),f=Math.max(f,y.y);r=this.arrangement;switch(r){case iq:l+=
n;break;default:u+=n}q=isFinite(q)?Math.max(q+n,1):Math.max(l+u,1);var Q=y=this.arrangementOrigin.x;A=this.arrangementOrigin.y;u=0;k>=l&&(k-=l);l=C=0;I=Math.max(this.cellSize.height,1);G=f=0;O=!0;x=J.alloc();for(R=0;R<e.length;R++){var ea=e[R],Z=this.Qi(ea,g),qa=ea.sf(ea.locationObject,ea.locationSpot,h);if(0<u)switch(r){case iq:Q=(Q-y-(Z.width-qa.x))/q;Q=K.da(Math.round(Q),Q)?Math.round(Q):Math.floor(Q);Q=Q*q+y;break;default:Q=(Q-y+qa.x)/q,Q=K.da(Math.round(Q),Q)?Math.round(Q):Math.ceil(Q),Q=Q*q+
y}else switch(r){case iq:C=Q+qa.x+Z.width;break;default:C=Q-qa.x}switch(r){case iq:var xa=-(Q+qa.x)+C;break;default:xa=Q+Z.width-qa.x-C}if(0<m&&u>m-1||0<k&&0<u&&xa>k){d.push(new L(0,O?A-f:A,k+n,G+f+p));for(Q=0;Q<u&&R!==u;Q++){xa=e[R-u+Q];var S=xa.sf(xa.locationObject,xa.locationSpot,x);xa.moveTo(xa.position.x,xa.position.y+f-S.y)}G+=p;A=O?A+G:A+(G+f);u=G=f=0;Q=y;O=!1}Q===y&&(l=r===iq?Math.max(l,Z.width-qa.x):Math.min(l,-qa.x));f=Math.max(f,qa.y);G=Math.max(G,Z.height-qa.y);isFinite(I)&&(G=Math.max(G,
Math.max(Z.height,I)-qa.y));O?ea.moveTo(Q-qa.x,A-qa.y):ea.moveTo(Q-qa.x,A);switch(r){case iq:Q-=qa.x+n;break;default:Q+=Z.width-qa.x+n}u++}d.push(new L(0,A,k+n,(O?G:G+f)+p));if(e.length!==u)for(k=0;k<u;k++)m=e[e.length-u+k],n=m.sf(m.locationObject,m.locationSpot,h),m.moveTo(m.position.x,m.position.y+f-n.y);J.free(h);J.free(x);if(r===iq)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===iq?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}};Sk.prototype.commitLayers=function(){};function eq(a,b){E&&w(a,U,Sk,"standardComparer:a");E&&w(b,U,Sk,"standardComparer:b");a=a.text;b=b.text;return a<b?-1:a>b?1:0}
na.Object.defineProperties(Sk.prototype,{wrappingWidth:{configurable:!0,get:function(){return this.Op},set:function(a){this.Op!==a&&(z(a,"number",Sk,"wrappingWidth"),0<a||isNaN(a))&&(this.Op=a,this.isViewportSized=isNaN(a),this.C())}},wrappingColumn:{configurable:!0,get:function(){return this.Np},set:function(a){this.Np!==a&&(z(a,"number",Sk,"wrappingColumn"),0<a||isNaN(a))&&(this.Np=a,this.C())}},cellSize:{configurable:!0,get:function(){return this.Gg},set:function(a){w(a,
Zb,Sk,"cellSize");this.Gg.A(a)||(this.Gg.assign(a),this.C())}},spacing:{configurable:!0,get:function(){return this.cf},set:function(a){w(a,Zb,Sk,"spacing");this.cf.A(a)||(this.cf.assign(a),this.C())}},alignment:{configurable:!0,get:function(){return this.xb},set:function(a){this.xb!==a&&(tb(a,Sk,Sk,"alignment"),a===bq||a===jq)&&(this.xb=a,this.C())}},arrangement:{configurable:!0,get:function(){return this.Db},set:function(a){this.Db!==a&&(tb(a,Sk,Sk,"arrangement"),
a===cq||a===iq)&&(this.Db=a,this.C())}},sorting:{configurable:!0,get:function(){return this.Tc},set:function(a){this.Tc!==a&&(tb(a,Sk,Sk,"sorting"),a===gq||a===hq||a===dq||a===fq)&&(this.Tc=a,this.C())}},comparer:{configurable:!0,get:function(){return this.Pc},set:function(a){this.Pc!==a&&(z(a,"function",Sk,"comparer"),this.Pc=a,this.C())}}});
var jq=new D(Sk,"Position",0),bq=new D(Sk,"Location",1),cq=new D(Sk,"LeftToRight",2),iq=new D(Sk,"RightToLeft",3),gq=new D(Sk,"Forward",4),hq=new D(Sk,"Reverse",5),dq=new D(Sk,"Ascending",6),fq=new D(Sk,"Descending",7);Sk.className="GridLayout";Sk.standardComparer=eq;
Sk.smartComparer=function(a,b){E&&w(a,U,Sk,"standardComparer:a");E&&w(b,U,Sk,"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};Sk.Position=jq;Sk.Location=bq;Sk.LeftToRight=cq;Sk.RightToLeft=iq;Sk.Forward=gq;Sk.Reverse=hq;Sk.Ascending=dq;Sk.Descending=fq;function Ji(){this.Jo=new H;this.lo=new H;this.Ga=new H;this.Pe=new Ub;this.Ig=new Ub;this.sj=new Ub;this.D=null;this.Jq=!1}t=Ji.prototype;t.clear=function(){this.Jo.clear();this.lo.clear();this.Ga.clear();this.Pe.clear();this.Ig.clear();this.sj.clear()};
t.ib=function(a){E&&null!==a&&w(a,P,Ji,"setDiagram");this.D=a};t.Si=function(a){if(a instanceof V){if(this.Jo.add(a),a instanceof xg){var b=a.containingGroup;null===b?this.D.Bi.add(a):b.wl.add(a);b=a.layout;null!==b&&(b.diagram=this.D)}}else a instanceof T?this.lo.add(a):a instanceof Cf||this.Ga.add(a);b=a.data;null===b||a instanceof Cf||(a instanceof T?this.Ig.add(b,a):this.Pe.add(b,a))};
t.zc=function(a){a.Wj();if(a instanceof V){if(this.Jo.remove(a),a instanceof xg){var b=a.containingGroup;null===b?this.D.Bi.remove(a):b.wl.remove(a);b=a.layout;null!==b&&(b.diagram=null)}}else a instanceof T?this.lo.remove(a):a instanceof Cf||this.Ga.remove(a);b=a.data;null===b||a instanceof Cf||(a instanceof T?this.Ig.remove(b):this.Pe.remove(b))};
t.wd=function(){for(var a=this.D.nodeTemplateMap.iterator;a.next();){var b=a.value,c=a.key;(!b.dc()||b instanceof xg)&&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.D.groupTemplateMap.iterator;a.next();)b=a.value,c=a.key,b instanceof xg||v('Invalid group template in Diagram.groupTemplateMap: template for "'+c+'" must be a Group, not a normal Node or Link: '+b);for(a=this.D.linkTemplateMap.iterator;a.next();)b=
a.value,c=a.key,b instanceof T||v('Invalid link template in Diagram.linkTemplateMap: template for "'+c+'" must be a Link, not a normal Node or simple Part: '+b);a=Qa();for(b=this.D.selection.iterator;b.next();)(c=b.value.data)&&a.push(c);b=Qa();for(c=this.D.highlighteds.iterator;c.next();){var d=c.value.data;d&&b.push(d)}c=Qa();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.xc(a[d]),null!==e&&(e.isSelected=!0);for(d=0;d<b.length;d++)e=this.xc(b[d]),null!==e&&(e.isHighlighted=!0);for(d=0;d<c.length;d+=2)e=this.xc(c[d]),null!==e&&(e.location=c[d+1]);Ta(a);Ta(b);Ta(c)};Ji.prototype.addAllModeledParts=function(){this.addModeledParts(this.diagram.model.nodeDataArray)};
Ji.prototype.addModeledParts=function(a,b){var c=this,d=this.diagram.model;a.forEach(function(a){d.Ab(a)&&kq(c,a,!1)});a.forEach(function(a){d.Ab(a)&&c.resolveReferencesForData(a)});!1!==b&&uk(this.diagram,!1)};
function kq(a,b,c){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.Pe.contains(b)){void 0===c&&(c=!0);a:{if(void 0!==b&&null!==b&&!a.D.undoManager.isUndoingRedoing&&!a.Pe.contains(b)){var d=a.$s(b);var e=No(a,b,d);if(null!==e&&(mh(e),e=e.copy(),null!==e)){var f=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.Cf=d;e.kb=b;a.Jq&&(e.Vg="Tool");a.diagram.add(e);e.kb=null;e.data=b;a.diagram.skipsModelSourceBindings=f;d=e;break a}}d=null}null!==d&&c&&a.resolveReferencesForData(b)}}
Ji.prototype.insertLink=function(){return null};Ji.prototype.resolveReferencesForData=function(){};Ji.prototype.$s=function(a){return this.D.model.$s(a)};
function No(a,b,c){a=a.D;var d=a.model;d.Ti()&&d.ht(b)?(b=a.groupTemplateMap.K(c),null===b&&(b=a.groupTemplateMap.K(""),null===b&&(lq||(lq=!0,Ha('No Group template found for category "'+c+'"'),Ha("  Using default group template")),b=a.ww))):(b=a.nodeTemplateMap.K(c),null===b&&(b=a.nodeTemplateMap.K(""),null===b&&(mq||(mq=!0,Ha('No Node template found for category "'+c+'"'),Ha("  Using default node template")),b=a.yw)));return b}Ji.prototype.getLinkCategoryForData=function(){return""};
Ji.prototype.setLinkCategoryForData=function(){};Ji.prototype.setFromNodeForLink=function(){};Ji.prototype.setToNodeForLink=function(){};Ji.prototype.findLinkTemplateForCategory=function(a){var b=this.D.linkTemplateMap.K(a);null===b&&(b=this.D.linkTemplateMap.K(""),null===b&&(nq||(nq=!0,Ha('No Link template found for category "'+a+'"'),Ha("  Using default link template")),b=this.D.xw));return b};Ji.prototype.removeAllModeledParts=function(){this.vt(this.diagram.model.nodeDataArray)};
Ji.prototype.vt=function(a){var b=this;a.forEach(function(a){b.wq(a)})};Ji.prototype.wq=function(a){a=this.xc(a);null!==a&&(Xj(this.diagram,a,!1),this.unresolveReferencesForPart(a))};Ji.prototype.unresolveReferencesForPart=function(){};Ji.prototype.removeDataForLink=function(){};Ji.prototype.findPartForKey=function(a){if(null===a||void 0===a)return null;a=this.D.model.Sb(a);return null!==a?this.Pe.K(a):null};t=Ji.prototype;
t.Kb=function(a){if(null===a||void 0===a)return null;a=this.D.model.Sb(a);if(null===a)return null;a=this.Pe.K(a);return a instanceof V?a:null};t.xc=function(a){if(null===a)return null;var b=this.Pe.K(a);return null!==b?b:b=this.Ig.K(a)};t.Ji=function(a){if(null===a)return null;a=this.Pe.K(a);return a instanceof V?a:null};t.wc=function(a){return null===a?null:this.Ig.K(a)};
t.Xs=function(a){for(var b=0;b<arguments.length;++b);b=new H;for(var c=this.Jo.iterator;c.next();){var d=c.value,e=d.data;if(null!==e)for(var f=0;f<arguments.length;f++){var g=arguments[f];if(Ja(g)&&oq(this,e,g)){b.add(d);break}}}return b.iterator};t.Ws=function(a){for(var b=0;b<arguments.length;++b);b=new H;for(var c=this.lo.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(Ja(g)&&oq(this,e,g)){b.add(d);break}}}return b.iterator};
function oq(a,b,c){for(var d in c){var e=b[d],f=c[d];if(Ka(f)){if(!Ka(e)||e.length<f.length)return!1;for(var g=0;g<e.length;g++){var h=f[g];if(void 0!==h&&!pq(a,e[g],h))return!1}}else if(!pq(a,e,f))return!1}return!0}function pq(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(Ja(b)&&Ja(c)){if(!oq(a,b,c))return!1}else if(b!==c)return!1;return!0}
Ji.prototype.doModelChanged=function(a){if(this.D){var b=this.D;if(a.model===b.model){var c=a.change;b.doModelChanged(a);if(b.fa){b.fa=!1;try{var d=a.modelChange;if(""!==d)if(c===of){if("nodeCategory"===d){var e=this.xc(a.object),f=a.newValue;null!==e&&"string"===typeof f&&(e.category=f)}else"nodeDataArray"===d&&(this.vt(a.oldValue),this.addModeledParts(a.newValue));b.isModified=!0}else if(c===qf){var g=a.newValue;"nodeDataArray"===d&&Ja(g)&&kq(this,g);b.isModified=!0}else if(c===rf){var h=a.oldValue;
"nodeDataArray"===d&&Ja(h)&&this.wq(h);b.isModified=!0}else c===pf&&("SourceChanged"===d?null!==a.object?this.updateDataBindings(a.object,a.propertyName):(this.Dq(),this.updateAllTargetBindings()):"ModelDisplaced"===d&&this.wd());else if(c===of){var k=a.propertyName,l=a.object;if(l===b.model){if("nodeKeyProperty"===k||"nodeCategoryProperty"===k)b.undoManager.isUndoingRedoing||this.wd()}else this.updateDataBindings(l,k);b.isModified=!0}else if(c===qf||c===rf){var m=a.change===qf,n=m?a.newParam:a.oldParam,
p=m?a.newValue:a.oldValue,q=this.sj.K(a.object);if(Array.isArray(q))for(a=0;a<q.length;a++){var r=q[a];if(m)tn(r,p,n);else if(!(0>n)){var u=n+ln(r);r.zc(u,!0);xn(r,u,n)}}b.isModified=!0}}finally{b.fa=!0}}}}};Ji.prototype.updateAllTargetBindings=function(a){void 0===a&&(a="");for(var b=this.parts.iterator;b.next();)b.value.Fa(a);for(b=this.nodes.iterator;b.next();)b.value.Fa(a);for(b=this.links.iterator;b.next();)b.value.Fa(a)};
Ji.prototype.Dq=function(){for(var a=this.D.model,b=new H,c=a.nodeDataArray,d=0;d<c.length;d++)b.add(c[d]);var e=[];this.nodes.each(function(a){null===a.data||b.contains(a.data)||e.push(a.data)});this.parts.each(function(a){null===a.data||b.contains(a.data)||e.push(a.data)});e.forEach(function(b){qq(a,b,!1)});for(d=0;d<c.length;d++){var f=c[d];null===this.xc(f)&&rq(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()};Ji.prototype.refreshDataBoundLinks=function(){};Ji.prototype.updateRelationshipsFromData=function(){};
Ji.prototype.updateDataBindings=function(a,b){if("string"===typeof b){var c=this.xc(a);if(null!==c)c.Fa(b);else{c=null;for(var d=this.sj.iterator;d.next();){for(var e=d.value,f=0;f<e.length;f++){var g=e[f].nx(a);null!==g&&(null===c&&(c=Qa()),c.push(g))}if(null!==c)break}if(null!==c){for(d=0;d<c.length;d++)c[d].Fa(b);Ta(c)}}a===this.diagram.model.modelData&&this.updateAllTargetBindings(b)}};
function Tj(a,b){var c=b.hi;if(Ka(c)){var d=a.sj.K(c);if(null===d)d=[],d.push(b),a.sj.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}function Wj(a,b,c){Rj(b,function(a){a=a.Z.j;for(var b=a.length,d=0;d<b;d++)pk(c,a[d])});var d=b.hi;if(Ka(d)){var e=a.sj.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.sj.remove(d);break}}}
Ji.prototype.ak=function(a,b,c){var d=new Ub;if(Ka(a))for(var e=0;e<a.length;e++)sq(this,a[e],b,d,c);else for(a=a.iterator;a.next();)sq(this,a.value,b,d,c);if(null!==b){c=b.model;a=b.toolManager.findTool("Dragging");a=null!==a?a.dragOptions.dragsLink:b.Qk.dragsLink;e=new H;for(var f=new Ub,g=d.iterator;g.next();){var h=g.value;if(h instanceof T)a||null!==h.fromNode&&null!==h.toNode||e.add(h);else if(h instanceof V&&null!==h.data&&c.km()){var k=h;h=g.key;var l=h.tg();null!==l&&(l=d.K(l),null!==l?(c.Le(k.data,
c.ra(l.data)),k=b.wc(k.data),h=h.Mi(),null!==h&&null!==k&&f.add(h,k)):c.Le(k.data,void 0))}}0<e.count&&b.wt(e,!1);if(0<f.count)for(c=f.iterator;c.next();)d.add(c.key,c.value)}if(null!==b&&null!==this.D&&(b=b.model,c=b.afterCopyFunction,null!==c)){var m=new Ub;d.each(function(a){null!==a.key.data&&m.add(a.key.data,a.value.data)});c(m,b,this.D.model)}for(b=d.iterator;b.next();)b.value.Fa();return d};
function sq(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 U))return null;f.isSelected=!1;f.isHighlighted=!1;d.add(b,f);if(b instanceof V){for(var g=b.linksConnected;g.next();){var h=g.value;if(h.fromNode===b){var k=d.K(h);null!==k&&(k.fromNode=f)}h.toNode===b&&(h=d.K(h),null!==h&&(h.toNode=f))}if(b instanceof xg&&f instanceof xg)for(b=b.memberParts;b.next();)g=sq(a,b.value,c,d,e),g instanceof T||null===g||(g.containingGroup=
f)}else if(b instanceof T&&f instanceof T)for(g=b.fromNode,null!==g&&(g=d.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=sq(a,b.value,c,d,e),null!==g&&g instanceof V&&(g.labeledLink=f);return f}
Ji.prototype.copyPartData=function(a,b){var c=null,d=a.data;if(null!==d&&null!==b){var e=b.model;a instanceof T||(d=e.copyNodeData(d),Ja(d)&&(e.mf(d),c=b.xc(d)))}else mh(a),c=a.copy(),null!==c&&(e=this.D,null!==b?b.add(c):null!==d&&null!==e&&null!==e.commandHandler&&e.commandHandler.copiesClipboardData&&(b=e.model,e=null,c instanceof T||(e=b.copyNodeData(d)),Ja(e)&&(c.data=e)));return c};
na.Object.defineProperties(Ji.prototype,{nodes:{configurable:!0,get:function(){return this.Jo}},links:{configurable:!0,get:function(){return this.lo}},parts:{configurable:!0,get:function(){return this.Ga}},diagram:{configurable:!0,get:function(){return this.D}},addsToTemporaryLayer:{configurable:!0,get:function(){return this.Jq},set:function(a){z(a,"boolean",Ji,"addsToTemporaryLayer");this.Jq=a}}});
Ji.prototype.updateAllRelationshipsFromData=Ji.prototype.Dq;Ji.prototype.findLinksByExample=Ji.prototype.Ws;Ji.prototype.findNodesByExample=Ji.prototype.Xs;Ji.prototype.findLinkForData=Ji.prototype.wc;Ji.prototype.findNodeForData=Ji.prototype.Ji;Ji.prototype.findPartForData=Ji.prototype.xc;Ji.prototype.findNodeForKey=Ji.prototype.Kb;Ji.prototype.removeModeledPart=Ji.prototype.wq;Ji.prototype.removeModeledParts=Ji.prototype.vt;Ji.prototype.rebuildParts=Ji.prototype.wd;var mq=!1,lq=!1,nq=!1;
Ji.className="PartManager";function tq(a){Ji.apply(this,arguments)}ma(tq,Ji);tq.prototype.addAllModeledParts=function(){var a=this.diagram.model;this.addModeledParts(a.nodeDataArray);uq(this,a.linkDataArray)};tq.prototype.addModeledParts=function(a){Ji.prototype.addModeledParts.call(this,a,!1);for(a=this.links.iterator;a.next();)Oo(a.value);uk(this.diagram,!1)};function uq(a,b){b.forEach(function(b){vq(a,b)});uk(a.diagram,!1)}
function vq(a,b){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.Ig.contains(b)){var c=a.getLinkCategoryForData(b),d=a.findLinkTemplateForCategory(c);if(null!==d){mh(d);var e=d.copy();if(null!==e){d=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.Cf=c;e.kb=b;c=a.diagram.model;var f=wq(c,b,!0);""!==f&&(e.fromPortId=f);f=xq(c,b,!0);void 0!==f&&(f=a.Kb(f),f instanceof V&&(e.fromNode=f));f=wq(c,b,!1);""!==f&&(e.toPortId=f);f=xq(c,b,!1);void 0!==f&&(f=a.Kb(f),
f instanceof V&&(e.toNode=f));c=c.ug(b);Array.isArray(c)&&c.forEach(function(b){b=a.Kb(b);null!==b&&(b.labeledLink=e)});a.Jq&&(e.Vg="Tool");a.diagram.add(e);e.kb=null;e.data=b;a.diagram.skipsModelSourceBindings=d}}}}tq.prototype.removeAllModeledParts=function(){var a=this.diagram.model;yq(this,a.linkDataArray);this.vt(a.nodeDataArray)};function yq(a,b){b.forEach(function(b){a.wq(b)})}tq.prototype.getLinkCategoryForData=function(a){return this.diagram.model.jv(a)};
tq.prototype.setLinkCategoryForData=function(a,b){return this.diagram.model.yt(a,b)};tq.prototype.setFromNodeForLink=function(a,b){var c=this.diagram.model;c.Lx(a.data,c.ra(null!==b?b.data:null))};tq.prototype.setToNodeForLink=function(a,b){var c=this.diagram.model;c.Px(a.data,c.ra(null!==b?b.data:null))};tq.prototype.removeDataForLink=function(a){this.diagram.model.tm(a.data)};
tq.prototype.findPartForKey=function(a){var b=Ji.prototype.findPartForKey.call(this,a);return null===b&&(a=this.diagram.model.yh(a),null!==a)?this.Ig.K(a):b};
tq.prototype.doModelChanged=function(a){var b=this;Ji.prototype.doModelChanged.call(this,a);if(this.diagram){var c=this.diagram;if(a.model===c.model){var d=a.change;if(c.fa){c.fa=!1;try{var e=a.modelChange;if(""!==e)if(d===of){if("linkFromKey"===e){var f=this.wc(a.object);if(null!==f){var g=this.Kb(a.newValue);f.fromNode=g}}else if("linkToKey"===e){var h=this.wc(a.object);if(null!==h){var k=this.Kb(a.newValue);h.toNode=k}}else if("linkFromPortId"===e){var l=this.wc(a.object);if(null!==l){var m=a.newValue;
"string"===typeof m&&(l.fromPortId=m)}}else if("linkToPortId"===e){var n=this.wc(a.object);if(null!==n){var p=a.newValue;"string"===typeof p&&(n.toPortId=p)}}else if("nodeGroupKey"===e){var q=this.xc(a.object);if(null!==q){var r=a.newValue;if(void 0!==r){var u=this.Kb(r);u instanceof xg?q.containingGroup=u:q.containingGroup=null}else q.containingGroup=null}}else if("linkLabelKeys"===e){var x=this.wc(a.object);if(null!==x){var y=a.oldValue,A=a.newValue;Array.isArray(y)&&y.forEach(function(a){a=b.Kb(a);
null!==a&&(a.labeledLink=null)});Array.isArray(A)&&A.forEach(function(a){a=b.Kb(a);null!==a&&(a.labeledLink=x)})}}else if("linkCategory"===e){var C=this.wc(a.object),G=a.newValue;null!==C&&"string"===typeof G&&(C.category=G)}else"linkDataArray"===e&&(yq(this,a.oldValue),uq(this,a.newValue));c.isModified=!0}else if(d===qf){var I=a.newValue;if("linkDataArray"===e&&"object"===typeof I&&null!==I)vq(this,I);else if("linkLabelKeys"===e&&zq(I)){var O=this.wc(a.object),R=this.Kb(I);null!==O&&null!==R&&(R.labeledLink=
O)}c.isModified=!0}else{if(d===rf){var Q=a.oldValue;if("linkDataArray"===e&&"object"===typeof Q&&null!==Q)this.wq(Q);else if("linkLabelKeys"===e&&zq(Q)){var ea=this.Kb(Q);null!==ea&&(ea.labeledLink=null)}c.isModified=!0}}else if(d===of){var Z=a.propertyName,qa=a.object;if(qa===c.model){if("linkFromKeyProperty"===Z||"linkToKeyProperty"===Z||"linkFromPortIdProperty"===Z||"linkToPortIdProperty"===Z||"linkLabelKeysProperty"===Z||"nodeIsGroupProperty"===Z||"nodeGroupKeyProperty"===Z||"linkCategoryProperty"===
Z)c.undoManager.isUndoingRedoing||this.wd()}else this.updateDataBindings(qa,Z);c.isModified=!0}}finally{c.fa=!0}}}}};tq.prototype.refreshDataBoundLinks=function(){var a=this,b=this.diagram.model,c=new H,d=b.linkDataArray;d.forEach(function(a){c.add(a)});var e=[];this.links.each(function(a){null===a.data||c.contains(a.data)||e.push(a.data)});e.forEach(function(a){Aq(b,a,!1)});d.forEach(function(c){null===a.wc(c)&&Bq(b,c,!1)})};
tq.prototype.updateRelationshipsFromData=function(a){var b=a.data;if(null!==b){var c=a.diagram;if(null!==c){var d=c.model;if(a instanceof T){var e=xq(d,b,!0);e=c.Kb(e);a.fromNode=e;e=xq(d,b,!1);e=c.Kb(e);a.toNode=e;b=d.ug(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.ra(f.data)===e)return}e=(new H).addAll(b);var g=new H;a.labelNodes.each(function(a){null!==a.data&&(a=d.ra(a.data),void 0!==a&&g.add(a))});b=g.copy();b.vq(e);e=
e.copy();e.vq(g);if(0<b.count||0<e.count)b.each(function(b){b=c.Kb(b);null!==b&&b.labeledLink===a&&(b.labeledLink=null)}),e.each(function(b){b=c.Kb(b);null!==b&&b.labeledLink!==a&&(b.labeledLink=a)})}}else!(a instanceof Cf)&&(b=d.Pi(b),b=c.findPartForKey(b),null===b||b instanceof xg)&&(a.containingGroup=b)}}};
tq.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.ra(a);if(void 0!==c){var d=Cq(b,c),e=this.xc(a);if(null!==d&&null!==e){d=d.iterator;for(var f={};d.next();){var g=d.value;b.Ab(g)?e instanceof xg&&b.Pi(g)===c&&(g=this.xc(g),null!==g&&(g.containingGroup=e)):(f.link=this.wc(g),null!==f.link&&e instanceof V&&(xq(b,g,!0)===c&&(f.link.fromNode=e),xq(b,g,!1)===c&&(f.link.toNode=e),g=b.ug(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}}Dq(b,c)}a=b.Pi(a);void 0!==a&&(a=this.Kb(a),a instanceof xg&&(e.containingGroup=a))}};tq.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof V){var c=b.ra(a.data);if(void 0!==c){for(var d=a.linksConnected;d.next();)Eq(b,c,d.value.data);a.isLinkLabel&&(d=a.labeledLink,null!==d&&Eq(b,c,d.data));if(a instanceof xg)for(a=a.memberParts;a.next();)d=a.value.data,b.Ab(d)&&Eq(b,c,d)}}};
tq.prototype.copyPartData=function(a,b){var c=Ji.prototype.copyPartData.call(this,a,b);if(a instanceof T)if(a=a.data,null!==a&&null!==b){var d=b.model;a=d.Wp(a);"object"===typeof a&&null!==a&&(d.Ei(a),c=b.wc(a))}else null!==c&&(b=this.diagram,null!==a&&null!==b&&null!==b.commandHandler&&b.commandHandler.copiesClipboardData&&(b=b.model.Wp(a),"object"===typeof b&&null!==b&&(c.data=b)));return c};
tq.prototype.insertLink=function(a,b,c,d){var e=this.diagram,f=e.model,g=e.toolManager.findTool("Linking"),h="";null!==a&&(null===b&&(b=a),h=b.portId,null===h&&(h=""));b="";null!==c&&(null===d&&(d=c),b=d.portId,null===b&&(b=""));d=g.archetypeLinkData;if(d instanceof T){if(mh(d),f=d.copy(),null!==f)return f.fromNode=a,f.fromPortId=h,f.toNode=c,f.toPortId=b,e.add(f),a=g.archetypeLabelNodeData,a instanceof V&&(mh(a),a=a.copy(),null!==a&&(a.labeledLink=f,e.add(a))),f}else if(null!==d&&(d=f.Wp(d),"object"===
typeof d&&null!==d))return null!==a&&Fq(f,d,f.ra(a.data),!0),Gq(f,d,h,!0),null!==c&&Fq(f,d,f.ra(c.data),!1),Gq(f,d,b,!1),f.Ei(d),a=g.archetypeLabelNodeData,null===a||a instanceof V||(a=f.copyNodeData(a),"object"===typeof a&&null!==a&&(f.mf(a),a=f.ra(a),void 0!==a&&f.Mu(d,a))),e.wc(d);return null};tq.prototype.findPartForKey=tq.prototype.findPartForKey;tq.prototype.removeAllModeledParts=tq.prototype.removeAllModeledParts;tq.prototype.addModeledParts=tq.prototype.addModeledParts;
tq.prototype.addAllModeledParts=tq.prototype.addAllModeledParts;tq.className="GraphLinksPartManager";function Hq(){Ji.apply(this,arguments);this.bh=null}ma(Hq,Ji);
function Iq(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||!Lg(d,e,f,null,!0))if(d=a.getLinkCategoryForData(c.data),b=a.findLinkTemplateForCategory(d),null!==b&&(mh(b),b=b.copy(),null!==b)){var g=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;b.Cf=d;
b.kb=c.data;b.fromNode=e;b.toNode=f;a.diagram.add(b);b.kb=null;b.data=c.data;a.diagram.skipsModelSourceBindings=g}}}Hq.prototype.getLinkCategoryForData=function(a){return this.diagram.model.kv(a)};Hq.prototype.setLinkCategoryForData=function(a,b){this.diagram.model.Qv(a,b)};
Hq.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.Le(a.data,d.ra(b));else{var e=this.bh;this.bh=a;null!==c&&d.Le(c.data,void 0);d.Le(b,d.ra(null!==a.toNode?a.toNode.data:null));this.bh=e}};
Hq.prototype.setToNodeForLink=function(a,b,c){var d=this.diagram.model;void 0===c&&(c=null);b=null!==b?b.data:null;if(this.diagram.isTreePathToChildren){var e=this.bh;this.bh=a;null!==c&&d.Le(c.data,void 0);d.Le(b,d.ra(null!==a.fromNode?a.fromNode.data:null));this.bh=e}else d.Le(a.data,d.ra(b))};Hq.prototype.removeDataForLink=function(a){this.diagram.model.Le(a.data,void 0)};
Hq.prototype.doModelChanged=function(a){Ji.prototype.doModelChanged.call(this,a);if(this.diagram){var b=this.diagram;if(a.model===b.model){var c=a.change;if(b.fa){b.fa=!1;try{var d=a.modelChange;if(""!==d){if(c===of){if("nodeParentKey"===d){var e=a.object,f=this.Kb(a.newValue),g=this.Ji(e);if(null!==this.bh)null!==f&&(this.bh.data=e,this.bh.category=this.getLinkCategoryForData(e));else if(null!==g){var h=g.Mi();null!==h?null===f?b.remove(h):b.isTreePathToChildren?h.fromNode=f:h.toNode=f:Iq(this,f,
g)}}else if("parentLinkCategory"===d){var k=this.Ji(a.object),l=a.newValue;if(null!==k&&"string"===typeof l){var m=k.Mi();null!==m&&(m.category=l)}}b.isModified=!0}}else if(c===of){var n=a.propertyName,p=a.object;p===b.model?"nodeParentKeyProperty"===n&&(b.undoManager.isUndoingRedoing||this.wd()):this.updateDataBindings(p,n);b.isModified=!0}}finally{b.fa=!0}}}}};
Hq.prototype.updateRelationshipsFromData=function(a){var b=a.data;if(null!==b){var c=a.diagram;if(null!==c){var d=c.model;a instanceof V&&(b=d.Ri(b),b=c.Kb(b),d=a.tg(),b!==d&&(d=a.Mi(),null!==b?null!==d?c.isTreePathToChildren?d.fromNode=b:d.toNode=b:Iq(this,b,a):null!==d&&Xj(c,d,!1)))}}};Hq.prototype.updateDataBindings=function(a,b){Ji.prototype.updateDataBindings.call(this,a,b);"string"===typeof b&&null!==this.xc(a)&&(a=this.wc(a),null!==a&&a.Fa(b))};
Hq.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.ra(a);if(void 0!==c){var d=Cq(b,c),e=this.xc(a);if(null!==d&&null!==e){for(d=d.iterator;d.next();){var f=d.value;b.Ab(f)&&e instanceof V&&b.Ri(f)===c&&Iq(this,e,this.Ji(f))}Dq(b,c)}a=b.Ri(a);void 0!==a&&e instanceof V&&(a=this.Kb(a),Iq(this,a,e))}};
Hq.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof V){var c=b.ra(a.data),d=this.wc(a.data);if(null!==d){d.isSelected=!1;d.isHighlighted=!1;var e=d.layer;if(null!==e){var f=e.zc(-1,d,!1);0<=f&&this.diagram.cb(rf,"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.Ab(e)&&Eq(b,c,e)}};
Hq.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.Le(e.data,b.ra(d.data)),e.Mi()):null};Hq.className="TreePartManager";
function X(a){this.Jt=',\n  "insertedNodeKeys": ';this.mw=',\n  "modifiedNodeData": ';this.Lt=',\n  "removedNodeKeys": ';E&&1<arguments.length&&v("Model constructor can only take one optional argument, the Array of node data.");qb(this);this.qn=this.Wa="";this.Qf=!1;this.l={};this.sc=[];this.fb=new Ub;this.oi="key";this.Nk=this.tl=null;this.fn=this.gn=!1;this.jn=!0;this.Rm=null;this.Aj="category";this.If=new Ub;this.lu=new F;this.fh=!1;this.w=null;this.undoManager=new tf;void 0!==a&&(this.nodeDataArray=
a)}X.prototype.cloneProtected=function(a){a.Wa=this.Wa;a.qn=this.qn;a.Qf=this.Qf;a.oi=this.oi;a.tl=this.tl;a.Nk=this.Nk;a.gn=this.gn;a.fn=this.fn;a.jn=this.jn;a.Rm=this.Rm;a.Aj=this.Aj};X.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};t=X.prototype;t.clear=function(){this.sc=[];this.fb.clear();this.If.clear();this.undoManager.clear()};
t.toString=function(a){void 0===a&&(a=0);if(1<a)return this.Bq();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.ra(e)+":"+Wa(e)}}return b};
t.yk=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.uq=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 Jq(a){return',\n  "modelData": '+Kq(a,a.modelData)}
function Lq(a,b){b=b.modelData;Ja(b)&&(a.vm(b),a.modelData=b)}t.hw=function(){var a=this.modelData,b=!1,c;for(c in a)if(!Mq(c,a[c])){b=!0;break}a="";b&&(a=Jq(this));return a+',\n  "nodeDataArray": '+Nq(this,this.nodeDataArray,!0)};t.Ev=function(a){Lq(this,a);a=a.nodeDataArray;Ka(a)&&(this.vm(a),this.nodeDataArray=a)};
function Oq(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(!Oq(a,b[e],c[e],d))return!1;return!0}if(Ja(b)&&Ja(c)){if(d.K(b)===c)return!0;d.add(b,c);for(var f in b){var g=b[f];if(!Mq(f,g)){var h=c[f];if(void 0===h||!Oq(a,g,h,d))return!1}}for(e in c)if(f=c[e],!Mq(e,f)&&(g=b[e],void 0===g||!Oq(a,g,f,d)))return!1;
return!0}return!1}function Pq(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.Fq=function(a){Pq(this,a,"nodeKeyProperty");for(var b=new H,c=new H,d=(new H).addAll(this.fb.iteratorKeys),e=new Ub,f=a.nodeDataArray,g=f.length,h=0;h<g;h++){var k=f[h],l=a.ra(k);if(void 0!==l){d.remove(l);var m=this.Sb(l);null===m?(b.add(l),c.add(k)):Oq(this,m,k,e)||c.add(k)}else this.mt(k),l=this.ra(k),b.add(l),c.add(k)}f="";Oq(this,this.modelData,a.modelData,e)||(f+=Jq(this));0<b.count&&(f+=this.Jt+Nq(this,b.Oa(),!0));0<c.count&&(f+=this.mw+Nq(this,c.Oa(),!0));0<d.count&&(f+=this.Lt+Nq(this,
d.Oa(),!0));return f};t.Ay=function(a,b){w(a,X,X,"computeJsonDifference:newmodel");void 0===b&&(b=Qq(this,this));return'{ "class": '+this.quote(b)+', "incremental": 1'+this.yk()+this.Fq(a)+"}"};
t.Et=function(a,b){var c=this,d=!1,e=new H,f=new H,g=new H;a.changes.each(function(a){a.model===c&&("nodeDataArray"===a.modelChange?a.change===qf?e.add(a.newValue):a.change===rf&&g.add(a.oldValue):c.Ab(a.object)?f.add(a.object):c.modelData===a.object&&a.change===of&&(d=!0))});var h=new H;e.each(function(a){h.add(c.ra(a));b||f.add(a)});var k=new H;g.each(function(a){k.add(c.ra(a));b&&f.add(a)});a="";d&&(a+=Jq(this));0<h.count&&(a+=(b?this.Lt:this.Jt)+Nq(this,h.Oa(),!0));0<f.count&&(a+=this.mw+Nq(this,
f.Oa(),!0));0<k.count&&(a+=(b?this.Jt:this.Lt)+Nq(this,k.Oa(),!0));return a};
t.Dv=function(a){Lq(this,a);var b=a.insertedNodeKeys,c=a.modifiedNodeData,d=new Ub;if(Array.isArray(c))for(var e=0;e<c.length;e++){var f=c[e],g=this.ra(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.Sb(g);null===h&&(h=(h=d.get(g))?h:this.copyNodeData({}),this.Bm(h,g),this.mf(h))}if(Array.isArray(c))for(b=c.length,d=0;d<b;d++)if(e=c[d],f=this.ra(e),f=this.Sb(f),null!==f)for(var k in e)"__gohashid"===k||k===this.nodeKeyProperty||this.hk()&&k===
this.nodeIsGroupProperty||this.setDataProperty(f,k,e[k]);a=a.removedNodeKeys;if(Array.isArray(a))for(c=a.length,k=0;k<c;k++)b=this.Sb(a[k]),null!==b&&this.um(b)};
t.Tx=function(a,b){w(a,nf,X,"toIncrementalJson:e");a.change!==pf&&v("Model.toIncrementalJson argument is not a Transaction ChangedEvent:"+a.toString());var c=a.object;if(!(a.isTransactionFinished&&c instanceof sf))return'{ "incremental": 0 }';void 0===b&&(b=Qq(this,this));return"2"===b?'{ "incremental": 2'+this.Et(c,"FinishedUndo"===a.propertyName)+"}":'{ "class": '+this.quote(b)+', "incremental": 1'+this.yk()+this.Et(c,"FinishedUndo"===a.propertyName)+"}"};t.iA=function(a,b){return this.Tx(a,b)};
t.Bq=function(a){void 0===a&&(a=Qq(this,this));return'{ "class": '+this.quote(a)+this.yk()+this.hw()+"}"};t.toJSON=function(a){return this.Bq(a)};t.$w=function(a){var b=null;if("string"===typeof a)try{b=ra.JSON.parse(a)}catch(d){E&&Ha("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.Ca("applyIncrementalJson"),this.Dv(b),this.ab("applyIncrementalJson"))};
t.ty=function(a){return this.$w(a)};X.constructGraphLinksModel=function(){E&&v("Unable to construct a Model. Provided JSON requires GraphLinksModel, which is not loaded.");return new X};t=X.prototype;
t.vm=function(a){if(Ka(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];if(Ja(d)){var e=c;d=this.vm(d);Array.isArray(a)?a[e]=d:v("Cannot replace an object in an HTMLCollection or NodeList at "+e)}}else if(Ja(a)){for(c in a)if(e=a[c],Ja(e)&&(e=this.vm(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 F;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"];
if("NaN"===e)c=NaN;else if("Date"===e)c=new Date(a.value);else if("go.Point"===e)c=new J(Rq(a.x),Rq(a.y));else if("go.Size"===e)c=new Zb(Rq(a.width),Rq(a.height));else if("go.Rect"===e)c=new L(Rq(a.x),Rq(a.y),Rq(a.width),Rq(a.height));else if("go.Margin"===e)c=new Hc(Rq(a.top),Rq(a.right),Rq(a.bottom),Rq(a.left));else if("go.Spot"===e)"string"===typeof a["enum"]?c=je(a["enum"]):c=new M(Rq(a.x),Rq(a.y),Rq(a.offsetX),Rq(a.offsetY));else if("go.Brush"===e){if(c=new zl,c.type=sb(zl,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=Rq(a.startRadius)),"number"===typeof a.endRadius&&(c.endRadius=Rq(a.endRadius)),a=a.colorStops,Ja(a))for(b in a)c.addColorStop(parseFloat(b),a[b])}else"go.Geometry"===e?(b=null,"string"===typeof a.path?b=ze(a.path):b=new me,b.type=sb(me,a.type),"number"===typeof a.startX&&(b.startX=Rq(a.startX)),"number"===typeof a.startY&&(b.startY=Rq(a.startY)),
"number"===typeof a.endX&&(b.endX=Rq(a.endX)),"number"===typeof a.endY&&(b.endY=Rq(a.endY)),a.spot1 instanceof M&&(b.spot1=a.spot1),a.spot2 instanceof M&&(b.spot2=a.spot2),c=b):"go.EnumValue"===e&&(b=a.classType,0===b.indexOf("go.")&&(b=b.substr(3)),c=sb(Sq(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.Em=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.Em(a.valueOf()):Ka(a)?Nq(this,a):Ja(a)?Kq(this,a):"function"===typeof a?"null":a.toString()};
function Nq(a,b,c){void 0===c&&(c=!1);var d=b.length;if(0>=d)return"[]";var e=new ub;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.Em(g)))}c&&1<d&&e.add("\n");e.add(" ]");return e.toString()}function Mq(a,b){return void 0===b||"__gohashid"===a||"_"===a[0]||"function"===typeof b?!0:!1}function Tq(a){return isNaN(a)?"NaN":Infinity===a?"9e9999":-Infinity===a?"-9e9999":a}
function Kq(a,b){var c=b;if(c instanceof J)b={"class":"go.Point",x:Tq(c.x),y:Tq(c.y)};else if(c instanceof Zb)b={"class":"go.Size",width:Tq(c.width),height:Tq(c.height)};else if(c instanceof L)b={"class":"go.Rect",x:Tq(c.x),y:Tq(c.y),width:Tq(c.width),height:Tq(c.height)};else if(c instanceof Hc)b={"class":"go.Margin",top:Tq(c.top),right:Tq(c.right),bottom:Tq(c.bottom),left:Tq(c.left)};else if(c instanceof M)c.Za()?b={"class":"go.Spot",x:Tq(c.x),y:Tq(c.y),offsetX:Tq(c.offsetX),offsetY:Tq(c.offsetY)}:
b={"class":"go.Spot","enum":c.toString()};else if(c instanceof zl){b={"class":"go.Brush",type:c.type.name};if(c.type===Cl)b.color=c.color;else if(c.type===Fl||c.type===Al)b.start=c.start,b.end=c.end,c.type===Al&&(0!==c.startRadius&&(b.startRadius=Tq(c.startRadius)),isNaN(c.endRadius)||(b.endRadius=Tq(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 me)b={"class":"go.Geometry",type:c.type.name},0!==c.startX&&
(b.startX=Tq(c.startX)),0!==c.startY&&(b.startY=Tq(c.startY)),0!==c.endX&&(b.endX=Tq(c.endX)),0!==c.endY&&(b.endY=Tq(c.endY)),c.spot1.A(fd)||(b.spot1=c.spot1),c.spot2.A(ud)||(b.spot2=c.spot2),c.type===ne&&(b.path=we(c));else if(c instanceof D)b={"class":"go.EnumValue",classType:Qq(a,c.classType),name:c.name};else if(E&&null!==Sq(Qq(a,c)))return Ha("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=yn(b,e);if(!Mq(e,f))if(c?c=!1:d+=", ",d+='"'+e+'":',"points"===e&&f instanceof F){var g="[";for(f=f.iterator;f.next();){var h=f.value;1<g.length&&(g+=",");g+=a.Em(h.x);g+=",";g+=a.Em(h.y)}g+="]";d+=g}else d+=a.Em(f)}return d+"}"}function Rq(a){return"number"===typeof a?a:"NaN"===a?NaN:"9e9999"===a?Infinity:"-9e9999"===a?-Infinity:parseFloat(a)}t.sh=function(a){z(a,"function",X,"addChangedListener:listener");this.lu.add(a)};
t.tk=function(a){z(a,"function",X,"removeChangedListener:listener");this.lu.remove(a)};t.Qs=function(a){this.skipsUndoManager||this.undoManager.ov(a);for(var b=this.lu,c=b.length,d=0;d<c;d++)b.O(d)(a)};t.cb=function(a,b,c,d,e,f,g){Uq(this,"",a,b,c,d,e,f,g)};t.g=function(a,b,c,d,e){Uq(this,"",of,a,this,b,c,d,e)};t.rt=function(a,b,c,d,e,f){Uq(this,"",of,b,a,c,d,e,f)};
function Uq(a,b,c,d,e,f,g,h,k){void 0===h&&(h=null);void 0===k&&(k=null);var l=new nf;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.Qs(l)}
t.Vj=function(a,b){if(null!==a&&a.model===this)if(a.change===of)ek(a.object,a.propertyName,a.K(b));else if(a.change===qf){var c=a.newParam;if("nodeDataArray"===a.modelChange){if(a=a.newValue,Ja(a)&&"number"===typeof c){var d=this.ra(a);b?(this.sc[c]===a&&Oa(this.sc,c),void 0!==d&&this.fb.remove(d)):(this.sc[c]!==a&&Na(this.sc,c,a),void 0!==d&&this.fb.add(d,a))}}else""===a.modelChange?((d=a.object)&&!Ka(d)&&a.propertyName&&(d=yn(a.object,a.propertyName)),Ka(d)&&"number"===typeof c&&(a=a.newValue,b?
Oa(d,c):Na(d,c,a))):v("unknown ChangedEvent.Insert modelChange: "+a.toString())}else a.change===rf?(c=a.oldParam,"nodeDataArray"===a.modelChange?(a=a.oldValue,Ja(a)&&"number"===typeof c&&(d=this.ra(a),b?(this.sc[c]!==a&&Na(this.sc,c,a),void 0!==d&&this.fb.add(d,a)):(this.sc[c]===a&&Oa(this.sc,c),void 0!==d&&this.fb.remove(d)))):""===a.modelChange?((d=a.object)&&!Ka(d)&&a.propertyName&&(d=yn(a.object,a.propertyName)),Ka(d)&&"number"===typeof c&&(a=a.oldValue,b?Na(d,c,a):Oa(d,c))):v("unknown ChangedEvent.Remove modelChange: "+
a.toString())):a.change!==pf&&v("unknown ChangedEvent: "+a.toString())};t.Ca=function(a){return this.undoManager.Ca(a)};t.ab=function(a){return this.undoManager.ab(a)};t.yf=function(){return this.undoManager.yf()};X.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.Ca(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.ab(b):this.undoManager.yf(),this.skipsUndoManager=c}};t=X.prototype;
t.Fa=function(a,b){void 0===b&&(b="");Uq(this,"SourceChanged",pf,b,a,null,null)};function Vq(a,b,c){"string"!==typeof a&&"function"!==typeof a&&Ba(a,"string or function",b,c)}t.ra=function(a){if(null!==a){var b=this.oi;if(""!==b&&(b=yn(a,b),void 0!==b)){if(zq(b))return b;v("Key value for node data "+a+" is not a number or a string: "+b)}}};
t.Bm=function(a,b){void 0!==b&&null!==b&&zq(b)||Ba(b,"number or string",X,"setKeyForNodeData:key");if(null!==a){var c=this.oi;if(""!==c)if(this.Ab(a)){var d=yn(a,c);d!==b&&null===this.Sb(b)&&(ek(a,c,b),void 0!==d&&this.fb.remove(d),this.fb.add(b,a),Uq(this,"nodeKey",of,c,a,d,b),"string"===typeof c&&this.Fa(a,c),this.xq(d,b))}else ek(a,c,b)}};function zq(a){return"number"===typeof a||"string"===typeof a}t.Ab=function(a){var b=this.ra(a);return void 0===b?!1:this.fb.K(b)===a};
t.Sb=function(a){null===a&&v("Model.findNodeDataForKey:key must not be null");return void 0!==a&&zq(a)?this.fb.K(a):null};
t.mt=function(a){if(null!==a){var b=this.oi;if(""!==b){var c=this.ra(a);if(void 0===c||this.fb.contains(c)){var d=this.tl;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.fb.contains(c))){ek(a,b,c);return}if("string"===typeof c){for(d=2;this.fb.contains(c+d);)d++;ek(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.fb.count-1;this.fb.contains(c);)c--;ek(a,b,c)}else E&&v("Model.getKeyForNodeData returned something other than a string or a number: "+c)}}}};
t.mf=function(a){null!==a&&(Nb(a),this.Ab(a)||rq(this,a,!0))};function rq(a,b,c){var d=a.ra(b);if(void 0===d||a.fb.K(d)!==b)a.mt(b),d=a.ra(b),void 0===d?v("Model.makeNodeDataKeyUnique failed on "+b+".  Data not added to Model."):(a.fb.add(d,b),d=null,c&&(d=a.sc.length,Na(a.sc,d,b)),Uq(a,"nodeDataArray",qf,"nodeDataArray",a,null,b,null,d),a.xm(b),a.wm(b))}t.py=function(a){if(Ka(a))for(var b=a.length,c=0;c<b;c++)this.mf(a[c]);else for(a=a.iterator;a.next();)this.mf(a.value)};
t.um=function(a){null!==a&&qq(this,a,!0)};function qq(a,b,c){var d=a.ra(b);void 0!==d&&a.fb.remove(d);d=null;if(c){a:if(c=a.sc,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;Oa(a.sc,d)}Uq(a,"nodeDataArray",rf,"nodeDataArray",a,b,null,d,null);a.Cq(b)}t.$z=function(a){if(Ka(a))for(var b=a.length,c=0;c<b;c++)this.um(a[c]);else for(a=a.iterator;a.next();)this.um(a.value)};
t.Pz=function(a){if(Ka(a)){for(var b=new H(this.fb.iteratorKeys),c=new H,d=a.length,e=0;e<d;e++){var f=a[e],g=this.ra(f);if(void 0!==g){c.add(g);var h=this.Sb(g);null!==h?this.Uj(h,f):(h={},this.Bm(h,g),this.Uj(h,f),this.mf(h))}else this.mf(f),c.add(this.ra(f))}for(a=b.iterator;a.next();)b=a.value,c.contains(b)||(b=this.Sb(b))&&this.um(b)}};t.xq=function(a,b){void 0!==b&&(a=Cq(this,a),a instanceof H&&this.If.add(b,a))};t.dw=function(){};t.xm=function(){};t.wm=function(){};t.Cq=function(){};
function Eq(a,b,c){if(void 0!==b){var d=a.If.K(b);null===d&&(d=new H,a.If.add(b,d));d.add(c)}}function Dq(a,b,c){if(void 0!==b){var d=a.If.K(b);d instanceof H&&(void 0===c||null===c?a.If.remove(b):(d.remove(c),0===d.count&&a.If.remove(b)))}}function Cq(a,b){if(void 0===b)return null;a=a.If.K(b);return a instanceof H?a:null}t.Su=function(a){void 0===a?this.If.clear():this.If.remove(a)};
X.prototype.copyNodeData=function(a){if(null===a)return null;var b=this.Nk;a=null!==b?b(a,this):Wq(this,a,!0);Ja(a)&&qb(a);return a};
function Wq(a,b,c){if(a.copiesArrays&&Array.isArray(b)){var d=[];for(c=0;c<b.length;c++){var e=Wq(a,b[c],a.copiesArrayObjects);d.push(e)}qb(d);return d}if(c&&Ja(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=yn(b,d);var g=Qq(a,f);"GraphObject"===g||"Diagram"===g||"Layer"===g||"RowColumnDefinition"===g||"AnimationManager"===g||"Tool"===g||"CommandHandler"===
g||"Layout"===g||"InputEvent"===g||"DiagramEvent"===g?(E&&"_"!==d[0]&&Ha('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 X||f instanceof tf||f instanceof sf||f instanceof nf?!0:!1;g?ek(c,d,f):(f=Wq(a,f,!1),ek(c,d,f))}qb(c);return c}return b instanceof J?b.copy():b instanceof Zb?b.copy():b instanceof
L?b.copy():b instanceof M?b.copy():b instanceof Hc?b.copy():b}
X.prototype.setDataProperty=function(a,b,c){E&&(z(a,"object",X,"setDataProperty:data"),z(b,"string",X,"setDataProperty:propname"),""===b&&v("Model.setDataProperty: property name must not be an empty string when setting "+a+" to "+c));if(this.Ab(a))if(b===this.nodeKeyProperty)this.Bm(a,c);else{if(b===this.nodeCategoryProperty){this.zq(a,c);return}}else!Xq&&a instanceof N&&(Xq=!0,Ha('Model.setDataProperty is modifying a GraphObject, "'+a.toString()+'"'),Ha("  Is that really your intent?"));var d=yn(a,
b);d!==c&&(ek(a,b,c),this.rt(a,b,d,c))};t=X.prototype;t.set=function(a,b,c){this.setDataProperty(a,b,c)};t.Uj=function(a,b){if(b){var c=this.Ab(a),d;for(d in b)"__gohashid"===d||c&&d===this.nodeKeyProperty||this.setDataProperty(a,d,b[d])}};t.ly=function(a,b){this.ct(a,-1,b)};
t.ct=function(a,b,c){E&&(La(a,X,"insertArrayItem:arr"),B(b,X,"insertArrayItem:idx"),a===this.sc&&v("Model.insertArrayItem or Model.addArrayItem should not be called on the Model.nodeDataArray"));0>b&&(b=a.length);Na(a,b,c);Uq(this,"",qf,"",a,null,c,null,b)};
t.Fv=function(a,b){void 0===b&&(b=-1);E&&(La(a,X,"removeArrayItem:arr"),B(b,X,"removeArrayItem:idx"));a===this.sc&&v("Model.removeArrayItem should not be called on the Model.nodeDataArray");-1===b&&(b=a.length-1);var c=a[b];Oa(a,b);Uq(this,"",rf,"",a,c,null,b,null)};t.$s=function(a){if(null===a)return"";var b=this.Aj;if(""===b)return"";b=yn(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.zq=function(a,b){z(b,"string",X,"setCategoryForNodeData:cat");if(null!==a){var c=this.Aj;if(""!==c)if(this.Ab(a)){var d=yn(a,c);void 0===d&&(d="");d!==b&&(ek(a,c,b),Uq(this,"nodeCategory",of,c,a,d,b))}else ek(a,c,b)}};t.km=function(){return!1};t.hk=function(){return!1};t.jm=function(){return!1};t.jt=function(){return!1};t.Ti=function(){return!1};function Ni(){return new X}
function Qq(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 Qq(a,b.constructor);return typeof b}function Sq(a){return Yq[a]?Yq[a]:null}function yn(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){E&&Ha("property get error: "+d.toString())}return c}
function ek(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){E&&Ha("property set error: "+d.toString())}}
na.Object.defineProperties(X.prototype,{name:{configurable:!0,get:function(){return this.Wa},set:function(a){var b=this.Wa;b!==a&&(z(a,"string",X,"name"),this.Wa=a,this.g("name",b,a))}},dataFormat:{configurable:!0,get:function(){return this.qn},set:function(a){var b=this.qn;b!==a&&(z(a,"string",X,"dataFormat"),this.qn=a,this.g("dataFormat",b,a))}},isReadOnly:{configurable:!0,get:function(){return this.Qf},set:function(a){var b=this.Qf;b!==a&&(z(a,"boolean",
X,"isReadOnly"),this.Qf=a,this.g("isReadOnly",b,a))}},modelData:{configurable:!0,get:function(){return this.l},set:function(a){var b=this.l;b!==a&&(z(a,"object",X,"modelData"),this.l=a,this.g("modelData",b,a),this.Fa(a))}},undoManager:{configurable:!0,get:function(){return this.w},set:function(a){var b=this.w;b!==a&&(w(a,tf,X,"undoManager"),null!==b&&b.Hx(this),this.w=a,null!==a&&a.Yw(this))}},skipsUndoManager:{configurable:!0,get:function(){return this.fh},
set:function(a){z(a,"boolean",X,"skipsUndoManager");this.fh=a}},nodeKeyProperty:{configurable:!0,get:function(){return this.oi},set:function(a){var b=this.oi;b!==a&&(Vq(a,X,"nodeKeyProperty"),""===a&&v("Model.nodeKeyProperty may not be the empty string"),0<this.fb.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.tl},set:function(a){var b=
this.tl;b!==a&&(null!==a&&z(a,"function",X,"makeUniqueKeyFunction"),this.tl=a,this.g("makeUniqueKeyFunction",b,a))}},nodeDataArray:{configurable:!0,get:function(){return this.sc},set:function(a){var b=this.sc;if(b!==a){La(a,X,"nodeDataArray");this.fb.clear();this.dw();for(var c=a.length,d=0;d<c;d++){var e=a[d];if(!Ja(e)){v("Model.nodeDataArray must only contain Objects, not: "+e);return}Nb(e)}this.sc=a;d=new F;for(e=0;e<c;e++){var f=a[e],g=this.ra(f);void 0===g?d.add(f):null!==this.fb.K(g)?
d.add(f):this.fb.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.mt(e),f=this.ra(e),void 0!==f&&this.fb.add(f,e);Uq(this,"nodeDataArray",of,"nodeDataArray",this,b,a);for(b=0;b<c;b++)d=a[b],this.xm(d),this.wm(d);this.Su();Array.isArray(a)||(this.isReadOnly=!0)}}},copyNodeDataFunction:{configurable:!0,get:function(){return this.Nk},set:function(a){var b=this.Nk;b!==a&&(null!==a&&z(a,"function",X,"copyNodeDataFunction"),this.Nk=a,this.g("copyNodeDataFunction",b,a))}},copiesArrays:{configurable:!0,
enumerable:!0,get:function(){return this.gn},set:function(a){var b=this.gn;b!==a&&(null!==a&&z(a,"boolean",X,"copiesArrays"),this.gn=a,this.g("copiesArrays",b,a))}},copiesArrayObjects:{configurable:!0,get:function(){return this.fn},set:function(a){var b=this.fn;b!==a&&(null!==a&&z(a,"boolean",X,"copiesArrayObjects"),this.fn=a,this.g("copiesArrayObjects",b,a))}},copiesKey:{configurable:!0,get:function(){return this.jn},set:function(a){var b=this.jn;b!==a&&(null!==a&&z(a,
"boolean",X,"copiesKey"),this.jn=a,this.g("copiesKey",b,a))}},afterCopyFunction:{configurable:!0,get:function(){return this.Rm},set:function(a){var b=this.Rm;b!==a&&(null!==a&&z(a,"function",X,"afterCopyFunction"),this.Rm=a,this.g("afterCopyFunction",b,a))}},nodeCategoryProperty:{configurable:!0,get:function(){return this.Aj},set:function(a){var b=this.Aj;b!==a&&(Vq(a,X,"nodeCategoryProperty"),this.Aj=a,this.g("nodeCategoryProperty",b,a))}}});
na.Object.defineProperties(X,{type:{configurable:!0,get:function(){return"Model"}}});X.prototype.setCategoryForNodeData=X.prototype.zq;X.prototype.getCategoryForNodeData=X.prototype.$s;X.prototype.removeArrayItem=X.prototype.Fv;X.prototype.insertArrayItem=X.prototype.ct;X.prototype.addArrayItem=X.prototype.ly;X.prototype.assignAllDataProperties=X.prototype.Uj;X.prototype.set=X.prototype.set;X.prototype.clearUnresolvedReferences=X.prototype.Su;X.prototype.mergeNodeDataArray=X.prototype.Pz;
X.prototype.removeNodeDataCollection=X.prototype.$z;X.prototype.removeNodeData=X.prototype.um;X.prototype.addNodeDataCollection=X.prototype.py;X.prototype.addNodeData=X.prototype.mf;X.prototype.makeNodeDataKeyUnique=X.prototype.mt;X.prototype.findNodeDataForKey=X.prototype.Sb;X.prototype.containsNodeData=X.prototype.Ab;X.prototype.setKeyForNodeData=X.prototype.Bm;X.prototype.getKeyForNodeData=X.prototype.ra;X.prototype.updateTargetBindings=X.prototype.Fa;X.prototype.commit=X.prototype.commit;
X.prototype.rollbackTransaction=X.prototype.yf;X.prototype.commitTransaction=X.prototype.ab;X.prototype.startTransaction=X.prototype.Ca;X.prototype.raiseDataChanged=X.prototype.rt;X.prototype.raiseChanged=X.prototype.g;X.prototype.raiseChangedEvent=X.prototype.cb;X.prototype.removeChangedListener=X.prototype.tk;X.prototype.addChangedListener=X.prototype.sh;X.prototype.writeJsonValue=X.prototype.Em;X.prototype.replaceJsonObjects=X.prototype.vm;X.prototype.applyIncrementalJSON=X.prototype.ty;
X.prototype.applyIncrementalJson=X.prototype.$w;X.prototype.toJSON=X.prototype.toJSON;X.prototype.toJson=X.prototype.Bq;X.prototype.toIncrementalJSON=X.prototype.iA;X.prototype.toIncrementalJson=X.prototype.Tx;X.prototype.computeJsonDifference=X.prototype.Ay;X.prototype.clear=X.prototype.clear;var Xq=!1,Yq={};X.className="Model";
X.fromJSON=X.fromJson=function(a,b){void 0===b&&(b=null);null!==b&&w(b,X,X,"fromJson:model");var c=null;if("string"===typeof a)try{c=ra.JSON.parse(a)}catch(f){E&&Ha("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=Sq(d)):(e=Sq(d),void 0===e&&(e=ra[d]));"function"===typeof e&&(a=new e)}catch(f){}null===a||a instanceof X?b=a:v("Unable to construct a Model of declared class: "+
c["class"])}null===b&&(b=X.constructGraphLinksModel());b.uq(c);b.Ev(c);return b};X.safePropertyValue=yn;X.safePropertySet=ek;Yq.Brush=zl;Yq.ChangedEvent=nf;Yq.Geometry=me;Yq.GraphObject=N;Yq.Margin=Hc;Yq.Panel=W;Yq.Point=J;Yq.Rect=L;Yq.Size=Zb;Yq.Spot=M;Yq.Transaction=sf;Yq.UndoManager=tf;
function Ui(a,b,c){qb(this);this.u=!1;void 0===a?a="":z(a,"string",Ui,"constructor:targetprop");void 0===b?b=a:z(b,"string",Ui,"constructor:sourceprop");void 0===c?c=null:null!==c&&z(c,"function",Ui,"constructor:conv");this.l=-1;this.Sd=null;this.Tl=a;this.Sl=this.Dp=0;this.Cs=null;this.$n=!1;this.Jl=b;this.en=c;this.wo=Zq;this.Zm=null;this.du=new H}
Ui.prototype.copy=function(){var a=new Ui;a.Tl=this.Tl;a.Dp=this.Dp;a.Sl=this.Sl;a.Cs=this.Cs;a.$n=this.$n;a.Jl=this.Jl;a.en=this.en;a.wo=this.wo;a.Zm=this.Zm;return a};t=Ui.prototype;t.hb=function(a){a.classType===Ui?this.mode=a:Fa(this,a)};t.toString=function(){return"Binding("+this.targetProperty+":"+this.sourceProperty+(-1!==this.aj?" "+this.aj:"")+" "+this.mode.name+")"};t.freeze=function(){this.u=!0;return this};t.ja=function(){this.u=!1;return this};
t.zx=function(a){void 0===a&&(a=null);null!==a&&z(a,"function",Ui,"makeTwoWay");this.mode=qn;this.backConverter=a;return this};t.rq=function(a){void 0===a&&(a="");E&&z(a,"string",Ui,"ofObject:srcname");this.sourceName=a;this.isToModel=!1;return this};t.Rz=function(){this.sourceName=null;this.isToModel=!0;return this};function ml(a,b,c){a=a.sourceName;return null===a||""===a?b:"/"===a?c.part:"."===a?c:".."===a?c.panel:b.bb(a)}
t.ew=function(a,b,c){var d=this.Jl;if(void 0===c||""===d||d===c){c=this.Tl;var e=this.en;if(null===e&&""===c)Ha("Binding error: target property is the empty string: "+this.toString());else{E&&"string"===typeof c&&("function"!==typeof a.setAttribute&&0<c.length&&"_"!==c[0]&&!Ya(a,c)?Ha("Binding error: undefined target property: "+c+" on "+a.toString()):"name"===c&&a instanceof N&&Ha("Binding error: cannot modify GraphObject.name on "+a.toString()));var f=b;""!==d&&(f=yn(b,d));if(void 0!==f)if(null===
e)""!==c&&ek(a,c,f);else try{if(""!==c){var g=e(f,a);E&&void 0===g&&Ha('Binding warning: conversion function returned undefined when setting target property "'+c+'" on '+a.toString()+", function is: "+e);ek(a,c,g)}else e(f,a)}catch(h){E&&Ha("Binding error: "+h.toString()+' setting target property "'+c+'" on '+a.toString()+" with conversion function: "+e)}}}};
t.Eq=function(a,b,c,d){if(this.wo===qn){var e=this.Tl;if(void 0===c||e===c){c=this.Jl;var f=this.Zm,g=a;""!==e&&(g=yn(a,e));if(void 0!==g&&!this.du.contains(a))try{this.du.add(a);var h=null!==d?d.diagram:null,k=null!==h?h.model:null;if(null===f)if(""!==c)null!==k?(E&&k.nodeKeyProperty===c&&k.Ab(b)&&Ha("Binding error: cannot have TwoWay Binding on node data key property: "+this.toString()),k.setDataProperty(b,c,g)):ek(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.Fv(m,l);k.ct(m,l,g)}}else try{if(""!==c){var n=f(g,b,k);null!==k?(E&&(k.nodeKeyProperty===c&&k.Ab(b)&&Ha("Binding error: cannot have TwoWay Binding on node data key property: "+this.toString()),void 0===n&&Ha('Binding warning: conversion function returned undefined when setting source property "'+c+'" on '+b.toString()+", function is: "+f)),k.setDataProperty(b,c,n)):ek(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 q=
d.itemIndex,r=d.panel.itemArray;k.Fv(r,q);k.ct(r,q,p)}}}catch(u){E&&Ha("Binding error: "+u.toString()+' setting source property "'+c+'" on '+b.toString()+" with conversion function: "+f)}}finally{this.du.remove(a)}}}};
na.Object.defineProperties(Ui.prototype,{aj:{configurable:!0,get:function(){return this.l},set:function(a){this.u&&za(this);z(a,"number",Ui,"targetId");this.l=a}},targetProperty:{configurable:!0,get:function(){return this.Tl},set:function(a){this.u&&za(this);z(a,"string",Ui,"targetProperty");this.Tl=a}},sourceName:{configurable:!0,get:function(){return this.Cs},set:function(a){this.u&&za(this);null!==a&&z(a,"string",Ui,"sourceName");this.Cs=a;null!==a&&(this.$n=
!1)}},isToModel:{configurable:!0,get:function(){return this.$n},set:function(a){this.u&&za(this);z(a,"boolean",Ui,"isToModel");this.$n=a}},sourceProperty:{configurable:!0,get:function(){return this.Jl},set:function(a){this.u&&za(this);z(a,"string",Ui,"sourceProperty");this.Jl=a}},converter:{configurable:!0,get:function(){return this.en},set:function(a){this.u&&za(this);null!==a&&z(a,"function",Ui,"converter");this.en=a}},backConverter:{configurable:!0,
get:function(){return this.Zm},set:function(a){this.u&&za(this);null!==a&&z(a,"function",Ui,"backConverter");this.Zm=a}},mode:{configurable:!0,get:function(){return this.wo},set:function(a){this.u&&za(this);tb(a,Ui,Ui,"mode");this.wo=a}}});Ui.prototype.updateSource=Ui.prototype.Eq;Ui.prototype.updateTarget=Ui.prototype.ew;Ui.prototype.ofModel=Ui.prototype.Rz;Ui.prototype.ofObject=Ui.prototype.rq;Ui.prototype.makeTwoWay=Ui.prototype.zx;
var Zq=new D(Ui,"OneWay",1),qn=new D(Ui,"TwoWay",2);Ui.className="Binding";Ui.parseEnum=function(a,b){z(a,"function",Ui,"parseEnum:ctor");tb(b,a,Ui,"parseEnum:defval");return function(c){c=sb(a,c);return null===c?b:c}};Ui.toString=Wa;Ui.OneWay=Zq;Ui.TwoWay=qn;
function $q(a,b){X.call(this);this.It=',\n  "insertedLinkKeys": ';this.lw=',\n  "modifiedLinkData": ';this.Kt=',\n  "removedLinkKeys": ';E&&2<arguments.length&&v("GraphLinksModel constructor can only take two optional arguments, the Array of node data and the Array of link data.");this.Rc=[];this.Rf=new H;this.rb=new Ub;this.ki="";this.dj=this.Mk=this.ul=null;this.Xe="from";this.Ye="to";this.xj=this.wj="";this.vj="category";this.Kd="";this.yl="isGroup";this.ve="group";this.hn=!1;void 0!==a&&(this.nodeDataArray=
a);void 0!==b&&(this.linkDataArray=b)}ma($q,X);$q.constructGraphLinksModel=X.constructGraphLinksModel;$q.prototype.cloneProtected=function(a){X.prototype.cloneProtected.call(this,a);a.ki=this.ki;a.ul=this.ul;a.Mk=this.Mk;a.Xe=this.Xe;a.Ye=this.Ye;a.wj=this.wj;a.xj=this.xj;a.vj=this.vj;a.Kd=this.Kd;a.yl=this.yl;a.ve=this.ve;a.hn=this.hn};t=$q.prototype;t.clear=function(){X.prototype.clear.call(this);this.Rc=[];this.rb.clear();this.Rf.clear()};
t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.Bq();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.ra(e)+":"+Wa(e)}b+="\n link data:";a=this.linkDataArray;c=a.length;for(d=0;d<c;d++)e=a[d],b+=" "+xq(this,e,!0)+"--\x3e"+xq(this,e,!1)}return b};
t.yk=function(){var a=X.prototype.yk.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.uq=function(a){X.prototype.uq.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.hw=function(){var a=X.prototype.hw.call(this),b=',\n  "linkDataArray": '+Nq(this,this.linkDataArray,!0);return a+b};t.Ev=function(a){X.prototype.Ev.call(this,a);a=a.linkDataArray;Array.isArray(a)&&(this.vm(a),this.linkDataArray=a)};
t.Fq=function(a){if(!(a instanceof $q))return v("Model.computeJsonDifference: newmodel must be a GraphLinksModel"),"";E&&""===this.linkKeyProperty&&v("GraphLinksModel.linkKeyProperty must not be an empty string for .computeJsonDifference() to succeed.");var b=X.prototype.Fq.call(this,a);Pq(this,a,"linkKeyProperty");Pq(this,a,"linkFromKeyProperty");Pq(this,a,"linkToKeyProperty");Pq(this,a,"linkLabelKeysProperty");Pq(this,a,"nodeIsGroupProperty");Pq(this,a,"nodeGroupKeyProperty");for(var c=new H,d=
new H,e=(new H).addAll(this.rb.iteratorKeys),f=new Ub,g=a.linkDataArray,h=g.length,k=0;k<h;k++){var l=g[k],m=a.kc(l);if(void 0!==m){e.remove(m);var n=this.yh(m);null===n?(c.add(m),d.add(l)):Oq(this,n,l,f)||d.add(l)}else this.oq(l),m=this.kc(l),c.add(m),d.add(l)}a=b;0<c.count&&(a+=this.It+Nq(this,c.Oa(),!0));0<d.count&&(a+=this.lw+Nq(this,d.Oa(),!0));0<e.count&&(a+=this.Kt+Nq(this,e.Oa(),!0));return a};
t.Et=function(a,b){E&&""===this.linkKeyProperty&&v("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalJson() to succeed.");var c=X.prototype.Et.call(this,a,b),d=this,e=new H,f=new H,g=new H;a.changes.each(function(a){a.model===d&&("linkDataArray"===a.modelChange?a.change===qf?e.add(a.newValue):a.change===rf&&g.add(a.oldValue):d.Ee(a.object)&&f.add(a.object))});var h=new H;e.each(function(a){h.add(d.kc(a));b||f.add(a)});var k=new H;g.each(function(a){k.add(d.kc(a));b&&f.add(a)});
a=c;0<h.count&&(a+=(b?this.Kt:this.It)+Nq(this,h.Oa(),!0));0<f.count&&(a+=this.lw+Nq(this,f.Oa(),!0));0<k.count&&(a+=(b?this.It:this.Kt)+Nq(this,k.Oa(),!0));return a};
t.Dv=function(a){X.prototype.Dv.call(this,a);var b=a.insertedLinkKeys;if(Array.isArray(b))for(var c=b.length,d=0;d<c;d++){var e=b[d],f=this.yh(e);null===f&&(f=this.Wp({}),this.At(f,e),this.Ei(f))}b=a.modifiedLinkData;if(Array.isArray(b))for(c=b.length,d=0;d<c;d++)if(e=b[d],f=this.kc(e),f=this.yh(f),null!==f)for(var g in e)"__gohashid"!==g&&g!==this.linkKeyProperty&&this.setDataProperty(f,g,e[g]);a=a.removedLinkKeys;if(Array.isArray(a))for(g=a.length,b=0;b<g;b++)c=this.yh(a[b]),null!==c&&this.tm(c)};
t.Vj=function(a,b){if(a.change===qf){var c=a.newParam;if("linkDataArray"===a.modelChange){a=a.newValue;if(Ja(a)&&"number"===typeof c){var d=this.kc(a);b?(this.Rf.remove(a),this.Rc[c]===a&&this.Rc.splice(c,1),void 0!==d&&this.rb.remove(d)):(this.Rf.add(a),this.Rc[c]!==a&&this.Rc.splice(c,0,a),void 0!==d&&this.rb.add(d,a))}return}if("linkLabelKeys"===a.modelChange){d=this.ug(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===rf){c=a.oldParam;if("linkDataArray"===a.modelChange){a=a.oldValue;Ja(a)&&"number"===typeof c&&(d=this.kc(a),b?(this.Rf.add(a),this.Rc[c]!==a&&this.Rc.splice(c,0,a),void 0!==d&&this.rb.add(d,a)):(this.Rf.remove(a),this.Rc[c]===a&&this.Rc.splice(c,1),void 0!==d&&this.rb.remove(d)));return}if("linkLabelKeys"===a.modelChange){d=this.ug(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}}X.prototype.Vj.call(this,a,b)};t.lm=function(a){if(void 0!==a){var b=this.dj;if(null!==b){var c=this.Sb(a);null===c&&(c=this.copyNodeData(b),ek(c,this.nodeKeyProperty,a),this.mf(c))}return a}};t.lz=function(a){return xq(this,a,!0)};t.Lx=function(a,b){Fq(this,a,b,!0)};t.qz=function(a){return xq(this,a,!1)};t.Px=function(a,b){Fq(this,a,b,!1)};
function xq(a,b,c){if(null!==b&&(a=c?a.Xe:a.Ye,""!==a&&(a=yn(b,a),void 0!==a))){if(zq(a))return a;v((c?"FromKey":"ToKey")+" value for link data "+b+" is not a number or a string: "+a)}}
function Fq(a,b,c,d){null===c&&(c=void 0);void 0===c||zq(c)||Ba(c,"number or string",$q,d?"setFromKeyForLinkData:key":"setToKeyForLinkData:key");if(null!==b){var e=d?a.Xe:a.Ye;if(""!==e)if(c=a.lm(c),a.Ee(b)){var f=yn(b,e);f!==c&&(Dq(a,f,b),ek(b,e,c),null===a.Sb(c)&&Eq(a,c,b),Uq(a,d?"linkFromKey":"linkToKey",of,e,b,f,c),"string"===typeof e&&a.Fa(b,e))}else ek(b,e,c)}}t.mz=function(a){return wq(this,a,!0)};t.Mx=function(a,b){Gq(this,a,b,!0)};t.rz=function(a){return wq(this,a,!1)};
t.Qx=function(a,b){Gq(this,a,b,!1)};function wq(a,b,c){if(null===b)return"";a=c?a.wj:a.xj;if(""===a)return"";b=yn(b,a);return void 0===b?"":b}function Gq(a,b,c,d){z(c,"string",$q,d?"setFromPortIdForLinkData:portname":"setToPortIdForLinkData:portname");if(null!==b){var e=d?a.wj:a.xj;if(""!==e)if(a.Ee(b)){var f=yn(b,e);void 0===f&&(f="");f!==c&&(ek(b,e,c),Uq(a,d?"linkFromPortId":"linkToPortId",of,e,b,f,c),"string"===typeof e&&a.Fa(b,e))}else ek(b,e,c)}}
t.ug=function(a){if(null===a)return ar;var b=this.Kd;if(""===b)return ar;a=yn(a,b);return void 0===a?ar:a};t.Pv=function(a,b){La(b,$q,"setLabelKeysForLinkData:arr");if(null!==a){var c=this.Kd;if(""!==c)if(this.Ee(a)){var d=yn(a,c);void 0===d&&(d=ar);if(d!==b){if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)Dq(this,d[f],a);ek(a,c,b);e=b.length;for(f=0;f<e;f++){var g=b[f];null===this.Sb(g)&&Eq(this,g,a)}Uq(this,"linkLabelKeys",of,c,a,d,b);"string"===typeof c&&this.Fa(a,c)}}else ek(a,c,b)}};
t.Mu=function(a,b){if(null!==b&&void 0!==b&&(zq(b)||Ba(b,"number or string",$q,"addLabelKeyForLinkData:key"),null!==a)){var c=this.Kd;if(""!==c){var d=yn(a,c);if(void 0===d)c=[],c.push(b),this.Pv(a,c);else if(Array.isArray(d)){var e=d.indexOf(b);0<=e||(e=d.length,d.push(b),this.Ee(a)&&(null===this.Sb(b)&&Eq(this,b,a),Uq(this,"linkLabelKeys",qf,c,a,null,b,null,e)))}else v(c+" property is not an Array; cannot addLabelKeyForLinkData: "+a)}}};
t.Gx=function(a,b){if(null!==b&&void 0!==b&&(zq(b)||Ba(b,"number or string",$q,"removeLabelKeyForLinkData:key"),null!==a)){var c=this.Kd;if(""!==c){var d=yn(a,c);if(Array.isArray(d)){var e=d.indexOf(b);0>e||(d.splice(e,1),this.Ee(a)&&(Dq(this,b,a),Uq(this,"linkLabelKeys",rf,c,a,b,null,e,null)))}else void 0!==d&&v(c+" property is not an Array; cannot removeLabelKeyforLinkData: "+a)}}};
t.kc=function(a){if(null!==a){var b=this.ki;if(""!==b&&(b=yn(a,b),void 0!==b)){if(zq(b))return b;v("Key value for link data "+a+" is not a number or a string: "+b)}}};t.At=function(a,b){void 0!==b&&null!==b&&zq(b)||Ba(b,"number or string",$q,"setKeyForLinkData:key");if(null!==a){var c=this.ki;if(""!==c)if(this.Ee(a)){var d=yn(a,c);d!==b&&null===this.yh(b)&&(ek(a,c,b),void 0!==d&&this.rb.remove(d),this.rb.add(b,a),Uq(this,"linkKey",of,c,a,d,b),"string"===typeof c&&this.Fa(a,c))}else ek(a,c,b)}};
t.yh=function(a){null===a&&v("GraphLinksModel.findLinkDataForKey:key must not be null");return void 0!==a&&zq(a)?this.rb.K(a):null};
t.oq=function(a){if(null!==a){var b=this.ki;if(""!==b){var c=this.kc(a);if(void 0===c||this.rb.contains(c)){var d=this.ul;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.rb.contains(c))){ek(a,b,c);return}if("string"===typeof c){for(d=2;this.rb.contains(c+d);)d++;ek(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.rb.count-1;this.rb.contains(c);)c--;ek(a,b,c)}else E&&v("GraphLinksModel.getKeyForLinkData returned something other than a string or a number: "+c)}}}};
t.Ee=function(a){return null===a?!1:this.Rf.contains(a)};t.Ei=function(a){null!==a&&(Nb(a),this.Ee(a)||Bq(this,a,!0))};function Bq(a,b,c){if(""!==a.linkKeyProperty){var d=a.kc(b);if(void 0!==d&&a.rb.K(d)===b)return;a.oq(b);d=a.kc(b);if(void 0===d){v("GraphLinksModel.makeLinkDataKeyUnique failed on "+b+". Data not added to model.");return}a.rb.add(d,b)}a.Rf.add(b);d=null;c&&(d=a.Rc.length,a.Rc.splice(d,0,b));Uq(a,"linkDataArray",qf,"linkDataArray",a,null,b,null,d);br(a,b)}
t.oy=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.Ei(a[c]);else for(a=a.iterator;a.next();)this.Ei(a.value)};t.tm=function(a){null!==a&&Aq(this,a,!0)};function Aq(a,b,c){a.Rf.remove(b);var d=a.kc(b);void 0!==d&&a.rb.remove(d);d=null;if(c){d=a.Rc.indexOf(b);if(0>d)return;a.Rc.splice(d,1)}Uq(a,"linkDataArray",rf,"linkDataArray",a,b,null,d,null);c=xq(a,b,!0);Dq(a,c,b);c=xq(a,b,!1);Dq(a,c,b);d=a.ug(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],Dq(a,c,b)}
t.Yz=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.tm(a[c]);else for(a=a.iterator;a.next();)this.tm(a.value)};
t.Oz=function(a){E&&""===this.linkKeyProperty&&v("GraphLinksModel.linkKeyProperty must not be an empty string for .mergeLinkDataArray() to succeed.");if(Ka(a)){for(var b=new H(this.rb.iteratorKeys),c=new H,d=a.length,e=0;e<d;e++){var f=a[e],g=this.kc(f);if(void 0!==g){c.add(g);var h=this.yh(g);null!==h?this.Uj(h,f):(h={},this.At(h,g),this.Uj(h,f),this.Ei(h))}else this.Ei(f),c.add(this.kc(f))}for(a=b.iterator;a.next();)b=a.value,c.contains(b)||(b=this.yh(b))&&this.tm(b)}};
function br(a,b){var c=xq(a,b,!0);c=a.lm(c);null===a.Sb(c)&&Eq(a,c,b);c=xq(a,b,!1);c=a.lm(c);null===a.Sb(c)&&Eq(a,c,b);var d=a.ug(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],null===a.Sb(c)&&Eq(a,c,b)}t.Wp=function(a){if(null===a)return null;var b=this.Mk;a=null!==b?b(a,this):Wq(this,a,!0);Ja(a)&&(qb(a),""!==this.Xe&&ek(a,this.Xe,void 0),""!==this.Ye&&ek(a,this.Ye,void 0),""!==this.Kd&&ek(a,this.Kd,[]));return a};
t.ht=function(a){if(null===a)return!1;var b=this.yl;return""===b?!1:yn(a,b)?!0:!1};t.Pi=function(a){if(null!==a){var b=this.ve;if(""!==b&&(b=yn(a,b),void 0!==b)){if(zq(b))return b;v("GroupKey value for node data "+a+" is not a number or a string: "+b)}}};
t.zt=function(a,b){null===b&&(b=void 0);void 0===b||zq(b)||Ba(b,"number or string",$q,"setGroupKeyForNodeData:key");if(null!==a){var c=this.ve;if(""!==c)if(this.Ab(a)){var d=yn(a,c);d!==b&&(Dq(this,d,a),ek(a,c,b),null===this.Sb(b)&&Eq(this,b,a),Uq(this,"nodeGroupKey",of,c,a,d,b),"string"===typeof c&&this.Fa(a,c))}else ek(a,c,b)}};
$q.prototype.copyNodeData=function(a){if(null===a)return null;a=X.prototype.copyNodeData.call(this,a);this.Zj||""===this.ve||void 0===yn(a,this.ve)||ek(a,this.ve,void 0);return a};
$q.prototype.setDataProperty=function(a,b,c){E&&(z(a,"object",$q,"setDataProperty:data"),z(b,"string",$q,"setDataProperty:propname"),""===b&&v("GraphLinksModel.setDataProperty: property name must not be an empty string when setting "+a+" to "+c));if(this.Ab(a))if(b===this.nodeKeyProperty)this.Bm(a,c);else{if(b===this.nodeCategoryProperty){this.zq(a,c);return}if(b===this.nodeGroupKeyProperty){this.zt(a,c);return}E&&b===this.nodeIsGroupProperty&&v("GraphLinksModel.setDataProperty: property name must not be the nodeIsGroupProperty: "+
b)}else if(this.Ee(a)){if(b===this.linkFromKeyProperty){Fq(this,a,c,!0);return}if(b===this.linkToKeyProperty){Fq(this,a,c,!1);return}if(b===this.linkFromPortIdProperty){Gq(this,a,c,!0);return}if(b===this.linkToPortIdProperty){Gq(this,a,c,!1);return}if(b===this.linkKeyProperty){this.At(a,c);return}if(b===this.linkCategoryProperty){this.yt(a,c);return}if(b===this.linkLabelKeysProperty){this.Pv(a,c);return}}var d=yn(a,b);d!==c&&(ek(a,b,c),this.rt(a,b,d,c))};t=$q.prototype;
t.Uj=function(a,b){if(b){var c=this.Ab(a),d=this.Ee(a),e;for(e in b)"__gohashid"===e||c&&e===this.nodeKeyProperty||d&&e===this.linkKeyProperty||this.setDataProperty(a,e,b[e])}};
t.xq=function(a,b){X.prototype.xq.call(this,a,b);for(var c=this.fb.iterator;c.next();)this.Jv(c.value,a,b);for(c=this.Rf.iterator;c.next();){var d=c.value,e=a,f=b;if(xq(this,d,!0)===e){var g=this.Xe;ek(d,g,f);Uq(this,"linkFromKey",of,g,d,e,f);"string"===typeof g&&this.Fa(d,g)}xq(this,d,!1)===e&&(g=this.Ye,ek(d,g,f),Uq(this,"linkToKey",of,g,d,e,f),"string"===typeof g&&this.Fa(d,g));g=this.ug(d);if(Array.isArray(g))for(var h=g.length,k=this.Kd,l=0;l<h;l++)g[l]===e&&(g[l]=f,Uq(this,"linkLabelKeys",qf,
k,d,e,f,l,l))}};t.Jv=function(a,b,c){if(this.Pi(a)===b){var d=this.ve;ek(a,d,c);Uq(this,"nodeGroupKey",of,d,a,b,c);"string"===typeof d&&this.Fa(a,d)}};t.dw=function(){X.prototype.dw.call(this);for(var a=this.linkDataArray,b=a.length,c=0;c<b;c++)br(this,a[c])};
t.xm=function(a){X.prototype.xm.call(this,a);a=this.ra(a);var b=Cq(this,a);if(null!==b){var c=Qa();for(b=b.iterator;b.next();){var d=b.value;if(this.Ab(d)){if(this.Pi(d)===a){var e=this.ve;Uq(this,"nodeGroupKey",of,e,d,a,a);"string"===typeof e&&this.Fa(d,e);c.push(d)}}else if(xq(this,d,!0)===a&&(e=this.Xe,Uq(this,"linkFromKey",of,e,d,a,a),"string"===typeof e&&this.Fa(d,e),c.push(d)),xq(this,d,!1)===a&&(e=this.Ye,Uq(this,"linkToKey",of,e,d,a,a),"string"===typeof e&&this.Fa(d,e),c.push(d)),e=this.ug(d),
Array.isArray(e))for(var f=e.length,g=this.Kd,h=0;h<f;h++)e[h]===a&&(Uq(this,"linkLabelKeys",qf,g,d,a,a,h,h),c.push(d))}for(b=0;b<c.length;b++)Dq(this,a,c[b]);Ta(c)}};t.wm=function(a){X.prototype.wm.call(this,a);var b=this.Pi(a);null===this.Sb(b)&&Eq(this,b,a)};t.Cq=function(a){X.prototype.Cq.call(this,a);var b=this.Pi(a);Dq(this,b,a)};
t.jv=function(a){if(null===a)return"";var b=this.vj;if(""===b)return"";b=yn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;v("getCategoryForLinkData found a non-string category for "+a+": "+b);return""};$q.prototype.getLinkCategoryForData=function(a){return this.jv(a)};
$q.prototype.yt=function(a,b){z(b,"string",$q,"setCategoryForLinkData:cat");if(null!==a){var c=this.vj;if(""!==c)if(this.Ee(a)){var d=yn(a,c);void 0===d&&(d="");d!==b&&(ek(a,c,b),Uq(this,"linkCategory",of,c,a,d,b),"string"===typeof c&&this.Fa(a,c))}else ek(a,c,b)}};$q.prototype.setLinkCategoryForData=function(a,b){this.yt(a,b)};$q.prototype.hk=function(){return!0};$q.prototype.jm=function(){return!0};$q.prototype.jt=function(){return!0};$q.prototype.Ti=function(){return!0};
na.Object.defineProperties($q.prototype,{archetypeNodeData:{configurable:!0,get:function(){return this.dj},set:function(a){var b=this.dj;b!==a&&(null!==a&&z(a,"object",$q,"archetypeNodeData"),this.dj=a,this.g("archetypeNodeData",b,a))}},linkFromKeyProperty:{configurable:!0,get:function(){return this.Xe},set:function(a){var b=this.Xe;b!==a&&(Vq(a,$q,"linkFromKeyProperty"),this.Xe=a,this.g("linkFromKeyProperty",b,a))}},linkToKeyProperty:{configurable:!0,get:function(){return this.Ye},
set:function(a){var b=this.Ye;b!==a&&(Vq(a,$q,"linkToKeyProperty"),this.Ye=a,this.g("linkToKeyProperty",b,a))}},linkFromPortIdProperty:{configurable:!0,get:function(){return this.wj},set:function(a){var b=this.wj;b!==a&&(Vq(a,$q,"linkFromPortIdProperty"),!E||a!==this.linkFromKeyProperty&&a!==this.linkToKeyProperty||v("linkFromPortIdProperty name must not be the same as the GraphLinksModel.linkFromKeyProperty or linkToKeyProperty: "+a),this.wj=a,this.g("linkFromPortIdProperty",b,a))}},
linkToPortIdProperty:{configurable:!0,get:function(){return this.xj},set:function(a){var b=this.xj;b!==a&&(Vq(a,$q,"linkToPortIdProperty"),!E||a!==this.linkFromKeyProperty&&a!==this.linkToKeyProperty||v("linkFromPortIdProperty name must not be the same as the GraphLinksModel.linkFromKeyProperty or linkToKeyProperty: "+a),this.xj=a,this.g("linkToPortIdProperty",b,a))}},linkLabelKeysProperty:{configurable:!0,get:function(){return this.Kd},set:function(a){var b=this.Kd;b!==
a&&(Vq(a,$q,"linkLabelKeysProperty"),this.Kd=a,this.g("linkLabelKeysProperty",b,a))}},linkDataArray:{configurable:!0,get:function(){return this.Rc},set:function(a){var b=this.Rc;if(b!==a){La(a,$q,"linkDataArray");this.rb.clear();for(var c=a.length,d=0;d<c;d++){var e=a[d];if(!Ja(e)){v("GraphLinksModel.linkDataArray must only contain Objects, not: "+e);return}Nb(e)}this.Rc=a;if(""!==this.linkKeyProperty){d=new F;for(e=0;e<c;e++){var f=a[e],g=this.kc(f);void 0===g?d.add(f):null!==this.rb.K(g)?
d.add(f):this.rb.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.oq(e),f=this.kc(e),void 0!==f&&this.rb.add(f,e)}d=new H;for(e=0;e<c;e++)d.add(a[e]);this.Rf=d;Uq(this,"linkDataArray",of,"linkDataArray",this,b,a);for(b=0;b<c;b++)br(this,a[b])}}},linkKeyProperty:{configurable:!0,get:function(){return this.ki},set:function(a){var b=this.ki;if(b!==a){Vq(a,$q,"linkKeyProperty");this.ki=a;this.rb.clear();for(var c=this.linkDataArray.length,d=0;d<c;d++){var e=this.linkDataArray[d],f=this.kc(e);
void 0===f&&(this.oq(e),f=this.kc(e));void 0!==f&&this.rb.add(f,e)}this.g("linkKeyProperty",b,a)}}},makeUniqueLinkKeyFunction:{configurable:!0,get:function(){return this.ul},set:function(a){var b=this.ul;b!==a&&(null!==a&&z(a,"function",$q,"makeUniqueLinkKeyFunction"),this.ul=a,this.g("makeUniqueLinkKeyFunction",b,a))}},copyLinkDataFunction:{configurable:!0,get:function(){return this.Mk},set:function(a){var b=this.Mk;b!==a&&(null!==a&&z(a,"function",$q,"copyLinkDataFunction"),
this.Mk=a,this.g("copyLinkDataFunction",b,a))}},nodeIsGroupProperty:{configurable:!0,get:function(){return this.yl},set:function(a){var b=this.yl;b!==a&&(Vq(a,$q,"nodeIsGroupProperty"),this.yl=a,this.g("nodeIsGroupProperty",b,a))}},nodeGroupKeyProperty:{configurable:!0,get:function(){return this.ve},set:function(a){var b=this.ve;b!==a&&(Vq(a,$q,"nodeGroupKeyProperty"),this.ve=a,this.g("nodeGroupKeyProperty",b,a))}},Zj:{configurable:!0,get:function(){return this.hn},
set:function(a){this.hn!==a&&(z(a,"boolean",$q,"copiesGroupKeyOfNodeData"),this.hn=a)}},linkCategoryProperty:{configurable:!0,get:function(){return this.vj},set:function(a){var b=this.vj;b!==a&&(Vq(a,$q,"linkCategoryProperty"),this.vj=a,this.g("linkCategoryProperty",b,a))}}});na.Object.defineProperties($q,{type:{configurable:!0,get:function(){return"GraphLinksModel"}}});$q.prototype.setCategoryForLinkData=$q.prototype.yt;$q.prototype.getCategoryForLinkData=$q.prototype.jv;
$q.prototype.assignAllDataProperties=$q.prototype.Uj;$q.prototype.setGroupKeyForNodeData=$q.prototype.zt;$q.prototype.getGroupKeyForNodeData=$q.prototype.Pi;$q.prototype.isGroupForNodeData=$q.prototype.ht;$q.prototype.copyLinkData=$q.prototype.Wp;$q.prototype.mergeLinkDataArray=$q.prototype.Oz;$q.prototype.removeLinkDataCollection=$q.prototype.Yz;$q.prototype.removeLinkData=$q.prototype.tm;$q.prototype.addLinkDataCollection=$q.prototype.oy;$q.prototype.addLinkData=$q.prototype.Ei;
$q.prototype.containsLinkData=$q.prototype.Ee;$q.prototype.makeLinkDataKeyUnique=$q.prototype.oq;$q.prototype.findLinkDataForKey=$q.prototype.yh;$q.prototype.setKeyForLinkData=$q.prototype.At;$q.prototype.getKeyForLinkData=$q.prototype.kc;$q.prototype.removeLabelKeyForLinkData=$q.prototype.Gx;$q.prototype.addLabelKeyForLinkData=$q.prototype.Mu;$q.prototype.setLabelKeysForLinkData=$q.prototype.Pv;$q.prototype.getLabelKeysForLinkData=$q.prototype.ug;$q.prototype.setToPortIdForLinkData=$q.prototype.Qx;
$q.prototype.getToPortIdForLinkData=$q.prototype.rz;$q.prototype.setFromPortIdForLinkData=$q.prototype.Mx;$q.prototype.getFromPortIdForLinkData=$q.prototype.mz;$q.prototype.setToKeyForLinkData=$q.prototype.Px;$q.prototype.getToKeyForLinkData=$q.prototype.qz;$q.prototype.setFromKeyForLinkData=$q.prototype.Lx;$q.prototype.getFromKeyForLinkData=$q.prototype.lz;$q.prototype.clear=$q.prototype.clear;var ar=Object.freeze([]);$q.className="GraphLinksModel";Yq.GraphLinksModel=$q;
X.constructGraphLinksModel=X.constructGraphLinksModel=function(){return new $q};X.initDiagramModel=Ni=function(){return new $q};function cr(a){E&&1<arguments.length&&v("TreeModel constructor can only take one optional argument, the Array of node data.");X.call(this);this.we="parent";this.kn=!1;this.Dj="parentLinkCategory";void 0!==a&&(this.nodeDataArray=a)}ma(cr,X);cr.constructGraphLinksModel=X.constructGraphLinksModel;
cr.prototype.cloneProtected=function(a){X.prototype.cloneProtected.call(this,a);a.we=this.we;a.kn=this.kn;a.Dj=this.Dj};t=cr.prototype;t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.Bq();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.ra(e)+":"+Wa(e)}}return b};
t.yk=function(){var a=X.prototype.yk.call(this),b="";"parent"!==this.nodeParentKeyProperty&&"string"===typeof this.nodeParentKeyProperty&&(b+=',\n  "nodeParentKeyProperty": '+this.quote(this.nodeParentKeyProperty));return a+b};t.uq=function(a){X.prototype.uq.call(this,a);a.nodeParentKeyProperty&&(this.nodeParentKeyProperty=a.nodeParentKeyProperty)};t.Fq=function(a){Pq(this,a,"nodeParentKeyProperty");return X.prototype.Fq.call(this,a)};t.lm=function(a){return a};
t.Ri=function(a){if(null!==a){var b=this.we;if(""!==b&&(b=yn(a,b),void 0!==b)){if(zq(b))return b;v("ParentKey value for node data "+a+" is not a number or a string: "+b)}}};
t.Le=function(a,b){null===b&&(b=void 0);void 0===b||zq(b)||Ba(b,"number or string",cr,"setParentKeyForNodeData:key");if(null!==a){var c=this.we;if(""!==c)if(b=this.lm(b),this.Ab(a)){var d=yn(a,c);d!==b&&(Dq(this,d,a),ek(a,c,b),null===this.Sb(b)&&Eq(this,b,a),Uq(this,"nodeParentKey",of,c,a,d,b),"string"===typeof c&&this.Fa(a,c))}else ek(a,c,b)}};
t.kv=function(a){if(null===a)return"";var b=this.Dj;if(""===b)return"";b=yn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;v("getParentLinkCategoryForNodeData found a non-string category for "+a+": "+b);return""};cr.prototype.getLinkCategoryForData=function(a){return this.kv(a)};
cr.prototype.Qv=function(a,b){z(b,"string",cr,"setParentLinkCategoryForNodeData:cat");if(null!==a){var c=this.Dj;if(""!==c)if(this.Ab(a)){var d=yn(a,c);void 0===d&&(d="");d!==b&&(ek(a,c,b),Uq(this,"parentLinkCategory",of,c,a,d,b),"string"===typeof c&&this.Fa(a,c))}else ek(a,c,b)}};cr.prototype.setLinkCategoryForData=function(a,b){this.Qv(a,b)};
cr.prototype.copyNodeData=function(a){if(null===a)return null;a=X.prototype.copyNodeData.call(this,a);this.$j||""===this.we||void 0===yn(a,this.we)||ek(a,this.we,void 0);return a};
cr.prototype.setDataProperty=function(a,b,c){E&&(z(a,"object",cr,"setDataProperty:data"),z(b,"string",cr,"setDataProperty:propname"),""===b&&v("TreeModel.setDataProperty: property name must not be an empty string when setting "+a+" to "+c));if(this.Ab(a))if(b===this.nodeKeyProperty)this.Bm(a,c);else{if(b===this.nodeCategoryProperty){this.zq(a,c);return}if(b===this.nodeParentKeyProperty){this.Le(a,c);return}}var d=yn(a,b);d!==c&&(ek(a,b,c),this.rt(a,b,d,c))};t=cr.prototype;
t.xq=function(a,b){X.prototype.xq.call(this,a,b);for(var c=this.fb.iterator;c.next();)this.Jv(c.value,a,b)};t.Jv=function(a,b,c){if(this.Ri(a)===b){var d=this.we;ek(a,d,c);Uq(this,"nodeParentKey",of,d,a,b,c);"string"===typeof d&&this.Fa(a,d)}};
t.xm=function(a){X.prototype.xm.call(this,a);a=this.ra(a);var b=Cq(this,a);if(null!==b){var c=Qa();for(b=b.iterator;b.next();){var d=b.value;if(this.Ab(d)&&this.Ri(d)===a){var e=this.we;Uq(this,"nodeParentKey",of,e,d,a,a);"string"===typeof e&&this.Fa(d,e);c.push(d)}}for(b=0;b<c.length;b++)Dq(this,a,c[b]);Ta(c)}};t.wm=function(a){X.prototype.wm.call(this,a);var b=this.Ri(a);b=this.lm(b);null===this.Sb(b)&&Eq(this,b,a)};t.Cq=function(a){X.prototype.Cq.call(this,a);var b=this.Ri(a);Dq(this,b,a)};
t.km=function(){return!0};t.jt=function(){return!0};
na.Object.defineProperties(cr.prototype,{nodeParentKeyProperty:{configurable:!0,get:function(){return this.we},set:function(a){var b=this.we;b!==a&&(Vq(a,cr,"nodeParentKeyProperty"),this.we=a,this.g("nodeParentKeyProperty",b,a))}},$j:{configurable:!0,get:function(){return this.kn},set:function(a){this.kn!==a&&(z(a,"boolean",cr,"copiesParentKeyOfNodeData"),this.kn=a)}},parentLinkCategoryProperty:{configurable:!0,get:function(){return this.Dj},set:function(a){var b=
this.Dj;b!==a&&(Vq(a,cr,"parentLinkCategoryProperty"),this.Dj=a,this.g("parentLinkCategoryProperty",b,a))}},linkCategoryProperty:{configurable:!0,get:function(){return this.parentLinkCategoryProperty},set:function(a){this.parentLinkCategoryProperty=a}}});na.Object.defineProperties(cr,{type:{configurable:!0,get:function(){return"TreeModel"}}});cr.prototype.setParentLinkCategoryForNodeData=cr.prototype.Qv;cr.prototype.getParentLinkCategoryForNodeData=cr.prototype.kv;
cr.prototype.setParentKeyForNodeData=cr.prototype.Le;cr.prototype.getParentKeyForNodeData=cr.prototype.Ri;cr.className="TreeModel";Yq.TreeModel=cr;function dr(){0<arguments.length&&Da(dr);Oi.call(this);this.Cw=this.Dn=this.Zb=0;this.rr=360;this.Bw=er;this.jj=0;this.nw=new J;this.cr=this.Td=0;this.Ms=new fr;this.Rt=this.Cj=0;this.by=600;this.Yo=NaN;this.Wm=1;this.Ap=0;this.Pl=360;this.Db=er;this.M=hr;this.Tc=ir;this.Pc=aq;this.cf=6;this.Io=jr}ma(dr,Oi);
dr.prototype.cloneProtected=function(a){Oi.prototype.cloneProtected.call(this,a);a.Yo=this.Yo;a.Wm=this.Wm;a.Ap=this.Ap;a.Pl=this.Pl;a.Db=this.Db;a.M=this.M;a.Tc=this.Tc;a.Pc=this.Pc;a.cf=this.cf;a.Io=this.Io};
dr.prototype.hb=function(a){if(a.classType===dr)if(a===kr||a===lr||a===mr||a===nr||a===ir)this.sorting=a;else if(a===or||a===pr||a===hr||a===qr)this.direction=a;else if(a===rr||a===sr||a===er||a===tr)this.arrangement=a;else{if(a===ur||a===jr)this.nodeDiameterFormula=a}else Oi.prototype.hb.call(this,a)};dr.prototype.createNetwork=function(){return new vr(this)};
dr.prototype.doLayout=function(a){E&&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 F;b.addAll(a.iterator);a=new F;var c=new F;var d=this.sort(b);var e,f,g=this.cr;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===tr&&k===ur?h=er:h===tr&&k!==ur&&(h=this.arrangement);if((this.direction===or||this.direction===pr)&&this.sorting!==ir){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===or?(this.arrangement===tr&&a.reverse(),d=new F,d.addAll(a),
d.addAll(c)):(this.arrangement===tr&&c.reverse(),d=new F,d.addAll(c),d.addAll(a))}k=d.length;for(var q=f=e=0;q<d.length;q++){var r=n+p*f*(this.direction===hr?1:-1)/k,u=d.O(q).diameter;isNaN(u)&&(u=wr(d.O(q),r));360>p&&(0===q||q===d.length-1)&&(u/=2);e+=u;f++}if(isNaN(l)||h===tr){isNaN(b)&&(b=6);if(h!==er&&h!==tr){f=-Infinity;for(g=0;g<k;g++)q=d.O(g),e=d.O(g===k-1?0:g+1),isNaN(q.diameter)&&wr(q,0),isNaN(e.diameter)&&wr(e,0),f=Math.max(f,(q.diameter+e.diameter)/2);g=f+b;h===rr?l=(f+b)/(2*Math.PI/k):
l=xr(this,g*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180)}else l=xr(this,e+(360<=p?k:k-1)*(h!==tr?b:1.6*b),m,n*Math.PI/180,p*Math.PI/180);f=l*m}else if(f=l*m,q=yr(this,l,f,n*Math.PI/180,p*Math.PI/180),isNaN(b)){if(h===er||h===tr)b=(q-e)/(360<=p?k:k-1)}else if(h===er||h===tr)q=(q-e)/(360<=p?k:k-1),q<b?(l=xr(this,e+b*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180),f=l*m):b=q;else{g=-Infinity;for(e=0;e<k;e++)r=d.O(e),u=d.O(e===k-1?0:e+1),isNaN(r.diameter)&&wr(r,0),isNaN(u.diameter)&&wr(u,0),g=Math.max(g,
(r.diameter+u.diameter)/2);g+=b;e=xr(this,g*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180);e>l?(l=e,f=l*m):g=q/(360<=p?k:k-1)}this.Bw=h;this.Zb=l;this.Dn=m;this.Cw=n;this.rr=p;this.jj=b;this.Td=f;this.cr=g;b=d;d=this.Bw;h=this.Zb;l=this.Cw;m=this.rr;n=this.jj;p=this.Td;k=this.cr;if(this.direction!==or&&this.direction!==pr||d!==tr)if(this.direction===or||this.direction===pr){g=0;switch(d){case sr:g=180*zr(this,h,p,l,k)/Math.PI;break;case er:k=b=0;g=a.first();null!==g&&(b=wr(g,Math.PI/2));g=c.first();
null!==g&&(k=wr(g,Math.PI/2));g=180*zr(this,h,p,l,n+(b+k)/2)/Math.PI;break;case rr:g=m/b.length}if(this.direction===or){switch(d){case sr:Ar(this,a,l,qr);break;case er:Br(this,a,l,qr);break;case rr:Cr(this,a,m/2,l,qr)}switch(d){case sr:Ar(this,c,l+g,hr);break;case er:Br(this,c,l+g,hr);break;case rr:Cr(this,c,m/2,l+g,hr)}}else{switch(d){case sr:Ar(this,c,l,qr);break;case er:Br(this,c,l,qr);break;case rr:Cr(this,c,m/2,l,qr)}switch(d){case sr:Ar(this,a,l+g,hr);break;case er:Br(this,a,l+g,hr);break;case rr:Cr(this,
a,m/2,l+g,hr)}}}else switch(d){case sr:Ar(this,b,l,this.direction);break;case er:Br(this,b,l,this.direction);break;case rr:Cr(this,b,m,l,this.direction);break;case tr:Dr(this,b,m,l,this.direction)}else Dr(this,b,m,l-m/2,hr)}this.updateParts();this.network=null;this.isValidLayout=!0};
function Cr(a,b,c,d,e){var f=a.rr,g=a.Zb;a=a.Td;d=d*Math.PI/180;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=d+(e===hr?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 Br(a,b,c,d){var e=a.Zb,f=a.Td,g=a.jj;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)&&wr(l,0);isNaN(m.diameter)&&wr(m,0);l=zr(a,e,f,d===hr?c:-c,(l.diameter+m.diameter)/2+g);c+=d===hr?l:-l}}
function Ar(a,b,c,d){var e=a.Zb,f=a.Td,g=a.cr;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=zr(a,e,f,d===hr?c:-c,g);c+=d===hr?l:-l}}function Dr(a,b,c,d,e){var f=a.rr;a.Cj=0;a.Ms=new fr;if(360>c){for(f=d+(e===hr?f:-f);0>f;)f+=360;f%=360;180<f&&(f-=360);f*=Math.PI/180;a.Rt=f;Er(a,b,c,d,e)}else Fr(a,b,c,d,e);a.Ms.commit(b)}
function Fr(a,b,c,d,e){var f=a.Zb,g=a.jj,h=a.Dn,k=f*Math.cos(d*Math.PI/180),l=a.Td*Math.sin(d*Math.PI/180),m=b.Oa();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;Gr(a,k,l,m,n,e,f)||Hr(a,k,l,m,n,e,f);k=f.x;l=f.y}J.free(f);a.Cj++;if(!(23<a.Cj)){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),q=Math.abs(l-n)-((m[0].height+m[m.length-1].height)/2+g);g=0;1>Math.abs(q)?Math.abs(k-f)<(m[0].width+m[m.length-1].width)/2&&(g=0):g=0<q?q:1>Math.abs(p)?
0:p;k=Math.abs(f)>Math.abs(n)?0<f!==l>n:0<n!==k<f;if(k=e===hr?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.Ms.compare(g,m);1<Math.abs(g)&&(a.Zb=8>a.Cj?a.Zb-g/(2*Math.PI):5>m.length&&10<g?a.Zb/2:a.Zb-(0<g?1.7:-2.3),a.Td=a.Zb*h,Fr(a,b,c,d,e))}}}
function Er(a,b,c,d,e){for(var f=a.Zb,g=a.Td,h=a.Dn,k=f*Math.cos(d*Math.PI/180),l=g*Math.sin(d*Math.PI/180),m=J.alloc(),n=b.Oa(),p=0;p<n.length;p++){n[p].centerX=k;n[p].centerY=l;if(p>=n.length-1)break;Gr(a,k,l,n,p,e,m)||Hr(a,k,l,n,p,e,m);k=m.x;l=m.y}J.free(m);a.Cj++;if(!(23<a.Cj)){k=Math.atan2(l,k);k=e===hr?a.Rt-k:k-a.Rt;k=Math.abs(k)<Math.abs(k-2*Math.PI)?k:k-2*Math.PI;f=k*(f+g)/2;g=a.Ms;if(Math.abs(f)<Math.abs(g.fm))for(g.fm=f,g.zk=[],g.Fm=[],k=0;k<n.length;k++)g.zk[k]=n[k].bounds.x,g.Fm[k]=n[k].bounds.y;
1<Math.abs(f)&&(a.Zb=8>a.Cj?a.Zb-f/(2*Math.PI):a.Zb-(0<f?1.7:-2.3),a.Td=a.Zb*h,Er(a,b,c,d,e))}}function Gr(a,b,c,d,e,f,g){var h=a.Zb,k=a.Td,l=0;a=(d[e].width+d[e+1].width)/2+a.jj;var m=!1;if(0<=c!==(f===hr)){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 Hr(a,b,c,d,e,f,g){var h=a.Zb,k=a.Td,l=0;a=(d[e].height+d[e+1].height)/2+a.jj;d=!1;if(0<=b!==(f===hr)){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}dr.prototype.commitLayout=function(){this.commitNodes();this.isRouting&&this.commitLinks()};
dr.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.Zb,c.y=this.arrangementOrigin.y+this.Td);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.bc(),a=this.group.position.copy(),c=this.group.location.copy(),b=b.Zd(c.Zd(a)),this.group.move(b),this.nw=b.Zd(a))};
dr.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};function yr(a,b,c,d,e){var f=a.by;if(.001>Math.abs(a.Dn-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 xr(a,b,c,d,e){return b/(void 0!==d&&void 0!==e?yr(a,1,c,d,e):yr(a,1,c))}function zr(a,b,c,d,e){if(.001>Math.abs(a.Dn-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}}
dr.prototype.sort=function(a){switch(this.sorting){case mr:break;case nr:a.reverse();break;case kr:a.sort(this.comparer);break;case lr:a.sort(this.comparer);a.reverse();break;case ir:for(var b=[],c=0;c<a.length;c++)b.push(0);c=new F;for(var d=0;d<a.length;d++){var e=-1,f=-1;if(0===d)for(var g=0;g<a.length;g++){var h=a.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 F;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,q=[],r=0;r<b.length;r++)0>a[b[r]].indexOf(b[r===b.length-1?0:r+1])&&q.push(r===b.length-1?0:r+1);if(0===q.length)for(r=0;r<b.length;r++)q.push(r);for(r=0;r<q.length;r++){for(var u=q[r],x=a[l],y=0,A=0;A<g.length;A++){var C=f[g[A]],G=f[h[A]];if(C<G){var I=C;C=G}else I=G;if(I<u&&u<=C)for(G=0;G<x.length;G++){var O=x[G];0>b.indexOf(O)||I<f[O]&&f[O]<C||I===f[O]||C===f[O]||y++}else for(G=0;G<x.length;G++)O=x[G],0>b.indexOf(O)||I<f[O]&&f[O]<C&&I!==f[O]&&
C!==f[O]&&y++}x=y;for(A=y=0;A<a[l].length;A++)I=b.indexOf(a[l][A]),0<=I&&(I=Math.abs(u-(I>=u?I+1:I)),y+=I<b.length+1-I?I:b.length+1-I);for(A=0;A<g.length;A++)I=f[g[A]],C=f[h[A]],I>=u&&I++,C>=u&&C++,I>C&&(G=C,C=I,I=G),C-I<(b.length+2)/2===(I<u&&u<=C)&&y++;if(x<m||x===m&&y<n)m=x,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++)q=b.indexOf(a[l][p]),0>q||q===m||(r=q>m?q-m:m-q,n+=q<m!==r>g-r?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};
na.Object.defineProperties(dr.prototype,{radius:{configurable:!0,get:function(){return this.Yo},set:function(a){this.Yo!==a&&(z(a,"number",dr,"radius"),0<a||isNaN(a))&&(this.Yo=a,this.C())}},aspectRatio:{configurable:!0,get:function(){return this.Wm},set:function(a){this.Wm!==a&&(z(a,"number",dr,"aspectRatio"),0<a&&(this.Wm=a,this.C()))}},startAngle:{configurable:!0,get:function(){return this.Ap},set:function(a){this.Ap!==a&&(z(a,"number",dr,"startAngle"),
this.Ap=a,this.C())}},sweepAngle:{configurable:!0,get:function(){return this.Pl},set:function(a){this.Pl!==a&&(z(a,"number",dr,"sweepAngle"),0<a&&360>=a?this.Pl=a:this.Pl=360,this.C())}},arrangement:{configurable:!0,get:function(){return this.Db},set:function(a){this.Db!==a&&(tb(a,dr,dr,"arrangement"),a===tr||a===er||a===sr||a===rr)&&(this.Db=a,this.C())}},direction:{configurable:!0,get:function(){return this.M},set:function(a){this.M!==a&&(tb(a,dr,dr,"direction"),
a===hr||a===qr||a===or||a===pr)&&(this.M=a,this.C())}},sorting:{configurable:!0,get:function(){return this.Tc},set:function(a){this.Tc!==a&&(tb(a,dr,dr,"sorting"),a===mr||a===nr||a===kr||lr||a===ir)&&(this.Tc=a,this.C())}},comparer:{configurable:!0,get:function(){return this.Pc},set:function(a){this.Pc!==a&&(z(a,"function",dr,"comparer"),this.Pc=a,this.C())}},spacing:{configurable:!0,get:function(){return this.cf},set:function(a){this.cf!==a&&(z(a,"number",
dr,"spacing"),this.cf=a,this.C())}},nodeDiameterFormula:{configurable:!0,get:function(){return this.Io},set:function(a){this.Io!==a&&(tb(a,dr,dr,"nodeDiameterFormula"),a===jr||a===ur)&&(this.Io=a,this.C())}},actualXRadius:{configurable:!0,get:function(){return this.Zb}},actualYRadius:{configurable:!0,get:function(){return this.Td}},actualSpacing:{configurable:!0,get:function(){return this.jj}},actualCenter:{configurable:!0,get:function(){return this.nw}}});
var er=new D(dr,"ConstantSpacing",0),sr=new D(dr,"ConstantDistance",1),rr=new D(dr,"ConstantAngle",2),tr=new D(dr,"Packed",3),hr=new D(dr,"Clockwise",4),qr=new D(dr,"Counterclockwise",5),or=new D(dr,"BidirectionalLeft",6),pr=new D(dr,"BidirectionalRight",7),mr=new D(dr,"Forwards",8),nr=new D(dr,"Reverse",9),kr=new D(dr,"Ascending",10),lr=new D(dr,"Descending",11),ir=new D(dr,"Optimized",12),jr=new D(dr,"Pythagorean",13),ur=new D(dr,"Circular",14);dr.className="CircularLayout";dr.ConstantSpacing=er;
dr.ConstantDistance=sr;dr.ConstantAngle=rr;dr.Packed=tr;dr.Clockwise=hr;dr.Counterclockwise=qr;dr.BidirectionalLeft=or;dr.BidirectionalRight=pr;dr.Forwards=mr;dr.Reverse=nr;dr.Ascending=kr;dr.Descending=lr;dr.Optimized=ir;dr.Pythagorean=jr;dr.Circular=ur;function fr(){this.fm=-Infinity;this.Fm=this.zk=null}
fr.prototype.compare=function(a,b){if(0<a&&0>this.fm||Math.abs(a)<Math.abs(this.fm)&&!(0>a&&0<this.fm))for(this.fm=a,this.zk=[],this.Fm=[],a=0;a<b.length;a++)this.zk[a]=b[a].bounds.x,this.Fm[a]=b[a].bounds.y};fr.prototype.commit=function(a){if(null!==this.zk&&null!==this.Fm)for(var b=0;b<this.zk.length;b++){var c=a.O(b);c.x=this.zk[b];c.y=this.Fm[b]}};fr.className="VertexArrangement";function vr(a){Sp.call(this,a)}ma(vr,Sp);vr.prototype.createVertex=function(){return new Ir(this)};
vr.prototype.createEdge=function(){return new Jr(this)};vr.className="CircularNetwork";function Ir(a){Vp.call(this,a);this.L=this.ij=NaN}ma(Ir,Vp);
function wr(a,b){var c=a.network;if(null===c)return NaN;c=c.layout;if(null===c)return NaN;if(c.arrangement===tr)if(c.nodeDiameterFormula===ur)a.ij=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.ij=Math.min(a.height/c,a.width/b)}else a.ij=c.nodeDiameterFormula===ur?Math.max(a.width,a.height):Math.sqrt(a.width*a.width+a.height*a.height);return a.ij}
na.Object.defineProperties(Ir.prototype,{diameter:{configurable:!0,get:function(){return this.ij},set:function(a){this.ij!==a&&(z(a,"number",Ir,"diameter"),this.ij=a)}},actualAngle:{configurable:!0,get:function(){return this.L},set:function(a){this.L!==a&&(z(a,"number",Ir,"actualAngle"),this.L=a)}}});Ir.className="CircularVertex";function Jr(a){Wp.call(this,a)}ma(Jr,Wp);Jr.className="CircularEdge";
function Kr(){0<arguments.length&&Da(Kr);Oi.call(this);this.qh=null;this.eo=0;this.yd=(new Zb(100,100)).freeze();this.Vm=!1;this.bf=!0;this.Zc=!1;this.vl=100;this.Gn=1;this.Nf=1E3;this.zo=10;this.Zo=Math;this.Uk=.05;this.Tk=50;this.Rk=150;this.Sk=0;this.tn=10;this.sn=5}ma(Kr,Oi);
Kr.prototype.cloneProtected=function(a){Oi.prototype.cloneProtected.call(this,a);a.yd.assign(this.yd);a.Vm=this.Vm;a.bf=this.bf;a.Zc=this.Zc;a.vl=this.vl;a.Gn=this.Gn;a.Nf=this.Nf;a.zo=this.zo;a.Zo=this.Zo;a.Uk=this.Uk;a.Tk=this.Tk;a.Rk=this.Rk;a.Sk=this.Sk;a.tn=this.tn;a.sn=this.sn};Kr.prototype.createNetwork=function(){return new Lr(this)};
Kr.prototype.doLayout=function(a){E&&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.Xp();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.Ou();this.eo=0;if(this.needsClusterLayout()){b=this.network;for(c=b.Sx().iterator;c.next();){this.network=c.value;for(var d=this.network.vertexes.iterator;d.next();){var e=d.value;e.vd=e.vertexes.count;e.Ch=1;e.Yj=null;e.Ke=null}Mr(this,0,a)}this.network=b;c.reset();E&&w(b,Lr,Kr,"arrangeConnectedGraphs:singletons");d=this.arrangementSpacing;for(var f=c.count,g=!0,h=e=0,k=Qa(),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=Nr(k,f,e,h,m.width,m.height,d),p=k[n],q=new J(p.x+m.width+d.width,p.y),r=new J(p.x,p.y+m.height+d.height);n+1<f&&k.splice(n+1,0,null);k[n]=q;k[n+1]=r;f++;n=p.x-m.x;p=p.y-m.y;for(l=l.vertexes.iterator;l.next();)q=l.value,q.centerX+=n,q.centerY+=p}L.free(m);for(l=b.vertexes.iterator;l.next();)g=l.value,q=g.bounds,2>f?(e=q.x+q.width/2,h=q.y+
q.height/2,k[0]=new J(q.x+q.width+d.width,q.y),k[1]=new J(q.x,q.y+q.height+d.height),f=2):(m=Nr(k,f,e,h,q.width,q.height,d),p=k[m],n=new J(p.x+q.width+d.width,p.y),q=new J(p.x,p.y+q.height+d.height),m+1<f&&k.splice(m+1,0,null),k[m]=n,k[m+1]=q,f++,g.centerX=p.x+g.width/2,g.centerY=p.y+g.height/2);Ta(k);for(c.reset();c.next();){d=c.value;for(e=d.vertexes.iterator;e.next();)b.uh(e.value);for(d=d.edges.iterator;d.next();)b.Sj(d.value)}}Or(this,a);this.updateParts()}this.vl=a;this.network=null;this.isValidLayout=
!0};Kr.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.Kc(c)&&(a++,2<a))return!0;if(10<b)break;b++}return!1};Kr.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.Lc(d.bounds)}return b};
function Pr(a,b,c){E&&(B(b,Kr,"computeClusterLayoutIterations:level"),B(c,Kr,"computeClusterLayoutIterations:maxiter"));return Math.max(Math.min(a.network.vertexes.count,c*(b+1)/11),10)}
function Mr(a,b,c){E&&(B(b,Kr,"layoutClusters:level"),B(c,Kr,"layoutClusters:maxiter"));if(Qr(a,b)){var d=a.Nf;a.Nf*=1+1/(b+1);var e=Rr(a,b),f=Math.max(0,Pr(a,b,c));a.maxIterations+=f;Mr(a,b+1,c);Or(a,f);Sr(a,e,b);c=e.vertexes.Oa();c.sort(function(a,b){return null===a||null===b||a===b?0:b.vd-a.vd});for(e=0;e<c.length;e++)Tr(a,c[e],b);a.Nf=d}}
function Qr(a,b){E&&B(b,Kr,"hasClusters:level");if(10<b||3>a.network.vertexes.count)return!1;a.qh=a.network.vertexes.Oa();a=a.qh;a.sort(function(a,b){return null===a||null===b||a===b?0:b.vd-a.vd});for(b=a.length-1;0<=b&&1>=a[b].vd;)b--;return 1<a.length-b}
function Rr(a,b){E&&B(b,Kr,"pushSubNetwork:level");for(var c=a.network,d=new Lr(a),e=0;e<a.qh.length;e++){var f=a.qh[e];if(1<f.vd){d.uh(f);var g=new Ur;g.Gt=f.vd;g.Ht=f.width;g.Ft=f.height;g.iw=f.focus.x;g.jw=f.focus.y;null===f.Ke&&(f.Ke=new F);f.Ke.add(g);f.Mv=f.Ke.count-1}else break}for(f=c.edges.iterator;f.next();){var h=f.value;e=h.fromVertex;g=h.toVertex;e.network===d&&g.network===d?d.Sj(h):e.network===d?(h=e.Yj,null===h&&(h=new F,e.Yj=h),h.add(g),e.vd--,e.Ch+=g.Ch):g.network===d&&(h=g.Yj,null===
h&&(h=new F,g.Yj=h),h.add(e),g.vd--,g.Ch+=e.Ch)}for(e=d.edges.iterator;e.next();)f=e.value,f.length*=Math.max(1,K.sqrt((f.fromVertex.Ch+f.toVertex.Ch)/(4*b+1)));for(b=d.vertexes.iterator;b.next();){e=b.value;var k=e.Yj;if(null!==k&&0<k.count&&(g=e.Ke.O(e.Ke.count-1).Gt-e.vd,!(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 q=f.value;if(q.tx(n)===e){p=q;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;q=m*n;1>q&&(q=1);h=K.sqrt((h+q+l*l*4/(g*g))/q);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 Sr(a,b,c){E&&(w(b,Lr,Kr,"popNetwork:oldnet"),B(c,Kr,"popNetwork:level"));for(c=a.network.vertexes.iterator;c.next();){var d=c.value;d.network=b;if(null!==d.Ke){var e=d.Ke.O(d.Mv);d.vd=e.Gt;var f=e.iw,g=e.jw;d.bounds=new L(d.centerX-f,d.centerY-g,e.Ht,e.Ft);d.focus=new J(f,g);d.Mv--}}for(c=a.network.edges.iterator;c.next();)c.value.network=b;a.network=b}
function Tr(a,b,c){E&&(w(b,Vr,Kr,"surroundNode:oldnet"),B(c,Kr,"surroundNode:level"));var d=b.Yj;if(null!==d&&0!==d.count){c=b.centerX;var e=b.centerY,f=b.width,g=b.height;null!==b.Ke&&0<b.Ke.count&&(g=b.Ke.O(0),f=g.Ht,g=g.Ft);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.vd?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.vd||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 Nr(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}Kr.prototype.Ou=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)};
Kr.prototype.addComments=function(a){var b=a.node;if(null!==b)for(b=b.fv();b.next();){var c=b.value;if("Comment"===c.category&&c.isVisible()){var d=this.network.Ni(c);null===d&&(d=this.network.Wl(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.jk(a,d,null));c.length=this.defaultCommentSpringLength}}};
function Wr(a,b){E&&(w(a,Vr,Kr,"getNodeDistance:vertexA"),w(b,Vr,Kr,"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 Or(a,b){E&&B(b,Kr,"performIterations:num");a.qh=null;for(b=a.eo+b;a.eo<b&&(a.eo++,Xr(a)););a.qh=null}
function Xr(a){null===a.qh&&(a.qh=a.network.vertexes.Oa());var b=a.qh;if(0>=b.length)return!1;var c=b[0];c.forceX=0;c.forceY=0;for(var d=c.centerX,e=d,f=c=c.centerY,g=1;g<b.length;g++){var h=b[g];h.forceX=0;h.forceY=0;var k=h.centerX;h=h.centerY;d=Math.min(d,k);e=Math.max(e,k);c=Math.min(c,h);f=Math.max(f,h)}(e=e-d>f-c)?b.sort(function(a,b){return null===a||null===b||a===b?0:a.centerX-b.centerX}):b.sort(function(a,b){return null===a||null===b||a===b?0:a.centerY-b.centerY});c=a.Nf;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 q=d.y+h.y;if(k-l>c||l-k>c){if(e)break}else if(m-q>c||q-m>c){if(!e)break}else{var r=Wr(g,p);1>r?(d=a.randomNumberGenerator,null===d&&(a.randomNumberGenerator=d=new Yr),r=d.random(),
h=d.random(),k>l?(d=Math.abs(p.bounds.right-g.bounds.x),d=(1+d)*r):k<l?(d=Math.abs(p.bounds.x-g.bounds.right),d=-(1+d)*r):(d=Math.max(p.width,g.width),d=(1+d)*r-d/2),m>q?(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)/(r*r),d=(l-k)/r*h,l=(q-m)/r*h);g.forceX+=d;g.forceY+=l;p.forceX-=d;p.forceY-=l}}}}for(e=a.network.edges.iterator;e.next();)h=e.value,c=h.fromVertex,f=h.toVertex,
g=c.bounds,k=c.focus,d=g.x+k.x,g=g.y+k.y,m=f.bounds,n=f.focus,k=m.x+n.x,m=m.y+n.y,n=Wr(c,f),1>n?(n=a.randomNumberGenerator,null===n&&(a.randomNumberGenerator=n=new Yr),h=n.random(),n=n.random(),d=(d>k?1:-1)*(1+(f.width>c.width?f.width:c.width))*h,l=(g>m?1:-1)*(1+(f.height>c.height?f.height:c.height))*n):(h=h.stiffness*(n-h.length),d=(k-d)/n*h,l=(m-g)/n*h),c.forceX+=d,c.forceY+=l,f.forceX-=d,f.forceY-=l;d=0;e=a.moveLimit;for(c=0;c<b.length;c++)f=b[c],a.isFixed(f)?a.moveFixedVertex(f):(g=f.forceX,k=
f.forceY,g<-e?g=-e:g>e&&(g=e),k<-e?k=-e:k>e&&(k=e),f.centerX+=g,f.centerY+=k,d=Math.max(d,g*g+k*k));return d>a.epsilonDistance*a.epsilonDistance}Kr.prototype.moveFixedVertex=function(){};Kr.prototype.commitLayout=function(){this.Rv();this.commitNodes();this.isRouting&&this.commitLinks()};Kr.prototype.Rv=function(){if(this.setsPortSpots)for(var a=this.network.edges.iterator;a.next();){var b=a.value.link;null!==b&&(b.fromSpot=Qd,b.toSpot=Qd)}};
Kr.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)};Kr.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};
Kr.prototype.springStiffness=function(a){a=a.stiffness;return isNaN(a)?this.Uk:a};Kr.prototype.springLength=function(a){a=a.length;return isNaN(a)?this.Tk:a};Kr.prototype.electricalCharge=function(a){a=a.charge;return isNaN(a)?this.Rk:a};Kr.prototype.electricalFieldX=function(){return 0};Kr.prototype.electricalFieldY=function(){return 0};Kr.prototype.gravitationalMass=function(a){a=a.mass;return isNaN(a)?this.Sk:a};Kr.prototype.gravitationalFieldX=function(){return 0};
Kr.prototype.gravitationalFieldY=function(){return 0};Kr.prototype.isFixed=function(a){return a.isFixed};
na.Object.defineProperties(Kr.prototype,{currentIteration:{configurable:!0,get:function(){return this.eo}},arrangementSpacing:{configurable:!0,get:function(){return this.yd},set:function(a){w(a,Zb,Kr,"arrangementSpacing");this.yd.A(a)||(this.yd.assign(a),this.C())}},arrangesToOrigin:{configurable:!0,get:function(){return this.Vm},set:function(a){this.Vm!==a&&(z(a,"boolean",Kr,"arrangesToOrigin"),this.Vm=a,this.C())}},setsPortSpots:{configurable:!0,
get:function(){return this.bf},set:function(a){this.bf!==a&&(z(a,"boolean",Kr,"setsPortSpots"),this.bf=a,this.C())}},comments:{configurable:!0,get:function(){return this.Zc},set:function(a){this.Zc!==a&&(z(a,"boolean",Kr,"comments"),this.Zc=a,this.C())}},maxIterations:{configurable:!0,get:function(){return this.vl},set:function(a){this.vl!==a&&(z(a,"number",Kr,"maxIterations"),0<=a&&(this.vl=a,this.C()))}},epsilonDistance:{configurable:!0,get:function(){return this.Gn},
set:function(a){this.Gn!==a&&(z(a,"number",Kr,"epsilonDistance"),0<a&&(this.Gn=a,this.C()))}},infinityDistance:{configurable:!0,get:function(){return this.Nf},set:function(a){this.Nf!==a&&(z(a,"number",Kr,"infinityDistance"),1<a&&(this.Nf=a,this.C()))}},moveLimit:{configurable:!0,get:function(){return this.zo},set:function(a){this.zo!==a&&(z(a,"number",Kr,"moveLimit"),1<a&&(this.zo=a,this.C()))}},randomNumberGenerator:{configurable:!0,get:function(){return this.Zo},
set:function(a){this.Zo!==a&&(null!==a&&"function"!==typeof a.random&&v('ForceDirectedLayout.randomNumberGenerator must have a "random()" function on it: '+a),this.Zo=a)}},defaultSpringStiffness:{configurable:!0,get:function(){return this.Uk},set:function(a){this.Uk!==a&&(z(a,"number",Kr,"defaultSpringStiffness"),this.Uk=a,this.C())}},defaultSpringLength:{configurable:!0,get:function(){return this.Tk},set:function(a){this.Tk!==a&&(z(a,"number",Kr,"defaultSpringLength"),
this.Tk=a,this.C())}},defaultElectricalCharge:{configurable:!0,get:function(){return this.Rk},set:function(a){this.Rk!==a&&(z(a,"number",Kr,"defaultElectricalCharge"),this.Rk=a,this.C())}},defaultGravitationalMass:{configurable:!0,get:function(){return this.Sk},set:function(a){this.Sk!==a&&(z(a,"number",Kr,"defaultGravitationalMass"),this.Sk=a,this.C())}},defaultCommentSpringLength:{configurable:!0,get:function(){return this.tn},set:function(a){this.tn!==
a&&(z(a,"number",Kr,"defaultCommentSpringLength"),this.tn=a,this.C())}},defaultCommentElectricalCharge:{configurable:!0,get:function(){return this.sn},set:function(a){this.sn!==a&&(z(a,"number",Kr,"defaultCommentElectricalCharge"),this.sn=a,this.C())}}});Kr.className="ForceDirectedLayout";function Ur(){this.jw=this.iw=this.Ft=this.Ht=this.Gt=0}Ur.className="ForceDirectedSubnet";function Lr(a){Sp.call(this,a)}ma(Lr,Sp);Lr.prototype.createVertex=function(){return new Vr(this)};
Lr.prototype.createEdge=function(){return new Zr(this)};Lr.className="ForceDirectedNetwork";function Vr(a){Vp.call(this,a);this.Na=!1;this.Wb=this.L=NaN;this.Ch=this.vd=this.Ma=this.ca=0;this.Ke=this.Yj=null;this.Mv=0}ma(Vr,Vp);
na.Object.defineProperties(Vr.prototype,{isFixed:{configurable:!0,get:function(){return this.Na},set:function(a){this.Na!==a&&(z(a,"boolean",Vr,"isFixed"),this.Na=a)}},charge:{configurable:!0,get:function(){return this.L},set:function(a){this.L!==a&&(z(a,"number",Vr,"charge"),this.L=a)}},mass:{configurable:!0,get:function(){return this.Wb},set:function(a){this.Wb!==a&&(z(a,"number",Vr,"mass"),this.Wb=a)}},forceX:{configurable:!0,get:function(){return this.ca},
set:function(a){this.ca!==a&&(z(a,"number",Vr,"forceX"),this.ca=a)}},forceY:{configurable:!0,get:function(){return this.Ma},set:function(a){this.Ma!==a&&(z(a,"number",Vr,"forceY"),this.Ma=a)}}});Vr.className="ForceDirectedVertex";function Zr(a){Wp.call(this,a);this.l=this.w=NaN}ma(Zr,Wp);
na.Object.defineProperties(Zr.prototype,{stiffness:{configurable:!0,get:function(){return this.w},set:function(a){this.w!==a&&(z(a,"number",Zr,"stiffness"),this.w=a)}},length:{configurable:!0,get:function(){return this.l},set:function(a){this.l!==a&&(z(a,"number",Zr,"length"),this.l=a)}}});Zr.className="ForceDirectedEdge";
function Yr(){var a=0;void 0===a&&(a=42);this.seed=a;this.Ux=48271;this.Wx=2147483647;this.Q=44488.07041494893;this.Yx=3399;this.Vx=1/2147483647;this.random()}Yr.prototype.random=function(){var a=this.seed%this.Q*this.Ux-this.seed/this.Q*this.Yx;0<a?this.seed=a:this.seed=a+this.Wx;return this.seed*this.Vx};Yr.className="RandomNumberGenerator";
function $r(){0<arguments.length&&Da($r);Oi.call(this);this.Yb=this.ne=25;this.M=0;this.Pk=as;this.ql=bs;this.gl=cs;this.tj=4;this.Bk=ds;this.dg=7;this.bf=!0;this.ko=4;this.Ia=this.Vr=this.Ba=-1;this.qd=this.uo=0;this.La=this.nd=this.od=this.Jd=this.hc=null;this.Eo=0;this.Do=this.yj=null;this.Nd=0;this.Fo=null;this.pw=new J;this.te=[];this.te.length=100}ma($r,Oi);
$r.prototype.cloneProtected=function(a){Oi.prototype.cloneProtected.call(this,a);a.ne=this.ne;a.Yb=this.Yb;a.M=this.M;a.Pk=this.Pk;a.ql=this.ql;a.gl=this.gl;a.tj=this.tj;a.Bk=this.Bk;a.dg=this.dg;a.bf=this.bf;a.ko=this.ko};
$r.prototype.hb=function(a){a.classType===$r?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):Oi.prototype.hb.call(this,a)};$r.prototype.createNetwork=function(){return new es(this)};
$r.prototype.doLayout=function(a){E&&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.Vr=-1;this.qd=this.uo=0;this.Fo=this.Do=this.yj=null;for(a=0;a<this.te.length;a++)this.te[a]=null;if(0<this.network.vertexes.count){this.network.Xp();this.cycleRemoveOption!==fs&&this.removeCycles();for(a=this.network.vertexes.iterator;a.next();)a.value.layer=
-1;this.Ba=-1;this.assignLayers();for(a.reset();a.next();)this.Ba=Math.max(this.Ba,a.value.layer);this.cycleRemoveOption===fs&&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 q=p;n=k;p=h;k=l;h=q}var r=e.focus;l=f.focus;var u=d.rev?f.bounds:e.bounds;q=J.alloc();m!==n?u.o()&&n.isVisible()?n.actualBounds.o()?(n.sf(p,qd,q),q.x+=n.actualBounds.x-u.x,q.y+=n.actualBounds.y-u.y):(n.sf(p,qd,q),q.o()||q.assign(r)):q.assign(r):u.o()?(n.sf(p,qd,q),q.o()||q.assign(r)):q.assign(r);n=d.rev?e.bounds:f.bounds;m=J.alloc();g!==k?n.o()&&k.isVisible()?k.actualBounds.o()?(k.sf(h,qd,m),m.x+=k.actualBounds.x-n.x,m.y+=k.actualBounds.y-n.y):
(k.sf(h,qd,m),m.o()||m.assign(l)):m.assign(l):n.o()?(k.sf(h,qd,m),m.o()||m.assign(l)):m.assign(l);90===this.M||270===this.M?(g=Math.round((q.x-r.x)/this.Yb),k=q.x,h=Math.round((m.x-l.x)/this.Yb),l=m.x):(g=Math.round((q.y-r.y)/this.Yb),k=q.y,h=Math.round((m.y-l.y)/this.Yb),l=m.y);J.free(q);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;q=e.layer;m=f.layer;n=0;u=d.link;if(null!==u){var x=
u.fromPort,y=u.toPort;if(null!==x&&null!==y){var A=u.fromNode;p=u.toNode;if(null!==A&&null!==p){var C=gs(this,!0),G=gs(this,!1),I=this.setsPortSpots?C:u.computeSpot(!0,x);r=this.setsPortSpots?G:u.computeSpot(!1,y);var O=u.isOrthogonal;I.uf()&&I.tf(G)&&r.uf()&&r.tf(C)?n=0:(C=u.getLinkPoint(A,x,I,!0,O,p,y,J.alloc()),G=u.getLinkDirection(A,x,C,I,!0,O,p,y),J.free(C),I.kq()||G!==hs(this,d,!0)?this.setsPortSpots&&null!==A&&1===A.ports.count&&d.rev&&(n+=1):n+=1,I=u.getLinkPoint(p,y,r,!1,O,A,x,J.alloc()),
u=u.getLinkDirection(p,y,I,r,!1,O,A,x),J.free(I),r.kq()||u!==hs(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)r=a.createVertex(),r.node=null,r.Tj=1,r.layer=q,r.near=e,a.uh(r),e=a.jk(e,r,d.link),e.valid=!1,e.rev=d.rev,e.portFromColOffset=g,e.portToColOffset=0,e.portFromPos=k,e.portToPos=0,e=r;u=1;n&&u--;if(q-m>u&&0<q){d.valid=!1;r=a.createVertex();r.node=null;r.Tj=2;r.layer=q-1;a.uh(r);e=a.jk(e,r,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=r;for(q--;q-m>u&&0<q;)r=a.createVertex(),r.node=null,r.Tj=3,r.layer=q-1,a.uh(r),e=a.jk(e,r,d.link),e.valid=!0,e.rev=d.rev,e.portFromColOffset=0,e.portToColOffset=0,e.portFromPos=0,e.portToPos=0,e=r,q--;e=a.jk(r,f,d.link);e.valid=!n;n&&(r.near=f);e.rev=d.rev;e.portFromColOffset=0;e.portToColOffset=h;e.portFromPos=0;e.portToPos=l}else d.valid=!0}}a=this.hc=[];for(b=0;b<=this.Ba;b++)a[b]=0;for(b=this.network.vertexes.iterator;b.next();)b.value.index=
-1;this.initializeIndices();this.Vr=-1;for(c=this.qd=this.uo=0;c<=this.Ba;c++)a[c]>a[this.qd]&&(this.Vr=a[c]-1,this.qd=c),a[c]<a[this.uo]&&(this.uo=c);this.Fo=[];for(c=0;c<a.length;c++)this.Fo[c]=[];for(b.reset();b.next();)a=b.value,this.Fo[a.layer][a.index]=a;this.Ia=-1;for(a=0;a<=this.Ba;a++){b=is(this,a);c=0;d=this.hc[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.Ia=Math.max(this.Ia,c-1);js(this,a,b)}this.reduceCrossings();this.straightenAndPack();
this.updateParts()}this.network=null;this.isValidLayout=!0};$r.prototype.linkMinLength=function(){return 1};function ks(a){var b=a.fromVertex.node;a=a.toVertex.node;return null===b&&null===a?8:null===b||null===a?4:1}$r.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};
$r.prototype.nodeMinColumnSpace=function(a,b){if(null===a.node)return 0;var c=b?a.yv:a.xv;if(null!==c)return c;c=this.M;return 90===c||270===c?b?a.yv=a.focus.x/this.Yb+1|0:a.xv=(a.bounds.width-a.focus.x)/this.Yb+1|0:b?a.yv=a.focus.y/this.Yb+1|0:a.xv=(a.bounds.height-a.focus.y)/this.Yb+1|0};function ls(a){null===a.yj&&(a.yj=[]);for(var b=0,c=a.network.vertexes.iterator;c.next();){var d=c.value;a.yj[b]=d.layer;b++;a.yj[b]=d.column;b++;a.yj[b]=d.index;b++}return a.yj}
function ms(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 ns(a,b,c){E&&(B(b,$r,"crossingMatrix:unfixedLayer"),B(c,$r,"crossingMatrix:direction"));var d=is(a,b),e=a.hc[b];if(null===a.Do||a.Do.length<e*e)a.Do=[];for(var f=a.Do,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.Tj===l.Tj||h++}else for(m=g-1;m>k;m--)n=d[m],n.near===l&&n.Tj===l.Tj||h++;var p;if(0<=c)for(k=d[g].sourceEdgesArrayAccess,l=0;l<k.length;l++){var q=k[l];if(q.valid&&q.fromVertex.layer!==b)for(n=
q.fromVertex.index,m=q.portToPos,q=q.portFromPos,p=l+1;p<k.length;p++){var r=k[p];if(r.valid&&r.fromVertex.layer!==b){var u=r.fromVertex.index;var x=r.portToPos;r=r.portFromPos;m<x&&(n>u||n===u&&q>r)&&h++;x<m&&(u>n||u===n&&r>q)&&h++}}}if(0>=c)for(k=d[g].destinationEdgesArrayAccess,l=0;l<k.length;l++)if(q=k[l],q.valid&&q.toVertex.layer!==b)for(n=q.toVertex.index,m=q.portToPos,q=q.portFromPos,p=l+1;p<k.length;p++)r=k[p],r.valid&&r.toVertex.layer!==b&&(u=r.toVertex.index,x=r.portToPos,r=r.portFromPos,
q<r&&(n>u||n===u&&m>x)&&h++,r<q&&(u>n||u===n&&x>m)&&h++);f[g*e+g]=h;for(k=g+1;k<e;k++){var y=0,A=0;if(0<=c){h=d[g].sourceEdgesArrayAccess;var C=d[k].sourceEdgesArrayAccess;for(l=0;l<h.length;l++)if(q=h[l],q.valid&&q.fromVertex.layer!==b)for(n=q.fromVertex.index,q=q.portFromPos,p=0;p<C.length;p++)r=C[p],r.valid&&r.fromVertex.layer!==b&&(u=r.fromVertex.index,r=r.portFromPos,(n<u||n===u&&q<r)&&A++,(u<n||u===n&&r<q)&&y++)}if(0>=c)for(h=d[g].destinationEdgesArrayAccess,C=d[k].destinationEdgesArrayAccess,
l=0;l<h.length;l++)if(q=h[l],q.valid&&q.toVertex.layer!==b)for(n=q.toVertex.index,m=q.portToPos,p=0;p<C.length;p++)r=C[p],r.valid&&r.toVertex.layer!==b&&(u=r.toVertex.index,x=r.portToPos,(n<u||n===u&&m<x)&&A++,(u<n||u===n&&x<m)&&y++);f[g*e+k]=y;f[k*e+g]=A}}js(a,b,d);return f}$r.prototype.countCrossings=function(){for(var a=0,b=0;b<=this.Ba;b++)for(var c=ns(this,b,1),d=this.hc[b],e=0;e<d;e++)for(var f=e;f<d;f++)a+=c[e*d+f];return a};
function os(a){for(var b=0,c=0;c<=a.Ba;c++){for(var d=a,e=c,f=is(d,e),g=d.hc[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 q=n.toVertex.column+n.portToColOffset;h+=(Math.abs(p-q)+1)*ks(n)}}}js(d,e,f);b+=h}return b}
$r.prototype.normalize=function(){var a=Infinity;this.Ia=-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.Ia=Math.max(this.Ia,c.column+this.nodeMinColumnSpace(c,!1))}for(b.reset();b.next();)b.value.column-=a;this.Ia-=a};
function ps(a,b,c){E&&(B(b,$r,"barycenters:unfixedLayer"),B(c,$r,"barycenters:direction"));for(var d=is(a,b),e=a.hc[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 q=h.fromVertex;h.valid&&!h.rev&&q.layer!==b&&(m+=q.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}js(a,b,d);return f}
function qs(a,b,c){E&&(B(b,$r,"medians:unfixedLayer"),B(c,$r,"medians:direction"));for(var d=is(a,b),e=a.hc[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 q=h.fromVertex;h.valid&&!h.rev&&q.layer!==b&&(n[m]=q.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)}js(a,b,d);return f}
function rs(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&&rs(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&&rs(a,k,c,d,e,f)}}
function ss(a,b,c,d,e,f){if(b.component===d){b.component=c;if(e)for(var g=b.destinationEdges;g.next();)ss(a,g.value.toVertex,c,d,e,f);if(f)for(b=b.sourceEdges;b.next();)ss(a,b.value.fromVertex,c,d,e,f)}}
$r.prototype.removeCycles=function(){for(var a=this.network.edges.iterator;a.next();)a.value.rev=!1;switch(this.Pk){default:case ts: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!==us(a);){for(e=vs(a);null!==e;)d[c]=e,c--,e.valid=!1,e=vs(a);for(e=ws(a);null!==e;)d[b]=e,b++,e.valid=!1,e=ws(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.ym(b),b.rev=!0);break;case as:for(d=this.network.vertexes.iterator;d.next();)a=d.value,a.bm=-1,a.finish=-1;for(a=this.network.edges.iterator;a.next();)a.value.forest=!1;this.Eo=0;for(d.reset();d.next();)b=d.value,0===b.sourceEdges.count&&
xs(this,b);for(d.reset();d.next();)b=d.value,-1===b.bm&&xs(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.bm<b.bm&&c<f&&(this.network.ym(d),d.rev=!0));break;case fs: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.ym(b),b.rev=!0)}}};function us(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid)return b}return null}function vs(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 ws(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 xs(a,b){b.bm=a.Eo;a.Eo++;for(var c=b.destinationEdges;c.next();){var d=c.value,e=d.toVertex;-1===e.bm&&(d.forest=!0,xs(a,e))}b.finish=a.Eo;a.Eo++}
$r.prototype.assignLayers=function(){switch(this.ql){case ys:zs(this);break;case As:for(var a,b=this.network.vertexes.iterator;b.next();)a=Bs(this,b.value),this.Ba=Math.max(a,this.Ba);for(b.reset();b.next();)a=b.value,a.layer=this.Ba-a.layer;break;default:case bs:zs(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&&Cs(this,a);a=Infinity;for(b.reset();b.next();)a=Math.min(a,b.value.layer);this.Ba=-1;for(b.reset();b.next();){var c=
b.value;c.layer-=a;this.Ba=Math.max(this.Ba,c.layer)}}};function zs(a){for(var b=a.network.vertexes.iterator;b.next();){var c=Ds(a,b.value);a.Ba=Math.max(c,a.Ba)}}function Ds(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,Ds(a,f)+e)}b.layer=c}else c=b.layer;return c}
function Bs(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,Bs(a,f)+e)}b.layer=c}else c=b.layer;return c}
function Cs(a,b){if(!b.valid){b.valid=!0;for(var c=b.destinationEdges;c.next();)Cs(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&&rs(a,h,0,-1,!0,!1)}for(rs(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 q=0;q<e;q++){var r=p[q],u=r.fromVertex;m+=1;1!==u.component&&(f+=1,u=u.layer-l.layer,r=a.linkMinLength(r),d=Math.min(d,u-r))}p=l.destinationEdgesArrayAccess;e=p.length;for(q=0;q<e;q++)r=p[q].toVertex,--m,1!==r.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(rs(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(q=0;q<n;q++)r=p[q].fromVertex,l+=1,1!==r.component?d+=1:m=!0;p=g.destinationEdgesArrayAccess;n=p.length;for(q=0;q<n;q++)r=p[q],u=r.toVertex,--l,1!==u.component&&(--d,u=g.layer-u.layer,r=a.linkMinLength(r),e=Math.min(e,u-r));(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 hs(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}
$r.prototype.initializeIndices=function(){switch(this.gl){default:case Es:for(var a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;b.index=this.hc[c];this.hc[c]++}break;case cs:a=this.network.vertexes.iterator;for(b=this.Ba;0<=b;b--)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&Fs(this,c);break;case Gs:for(a=this.network.vertexes.iterator,b=0;b<=this.Ba;b++)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&Hs(this,c)}};
function Fs(a,b){var c=b.layer;b.index=a.hc[c];a.hc[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&&Fs(a,d))}
function Hs(a,b){var c=b.layer;b.index=a.hc[c];a.hc[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&&Hs(a,d))}
$r.prototype.reduceCrossings=function(){var a=this.countCrossings(),b=ls(this),c,d;for(c=0;c<this.tj;c++){for(d=0;d<=this.Ba;d++)Is(this,d,1),Js(this,d,1);var e=this.countCrossings();e<a&&(a=e,b=ls(this));for(d=this.Ba;0<=d;d--)Is(this,d,-1),Js(this,d,-1);e=this.countCrossings();e<a&&(a=e,b=ls(this))}ms(this,b);for(c=0;c<this.tj;c++){for(d=0;d<=this.Ba;d++)Is(this,d,0),Js(this,d,0);e=this.countCrossings();e<a&&(a=e,b=ls(this));for(d=this.Ba;0<=d;d--)Is(this,d,0),Js(this,d,0);e=this.countCrossings();
e<a&&(a=e,b=ls(this))}ms(this,b);var f,g,h;switch(this.Bk){case Ks:break;case Ls:for(h=a+1;(d=this.countCrossings())<h;)for(h=d,c=this.Ba;0<=c;c--)for(g=0;g<=c;g++){for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Js(this,d,-1)||f;e=this.countCrossings();e>=a?ms(this,b):(a=e,b=ls(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Js(this,d,1)||f;e=this.countCrossings();e>=a?ms(this,b):(a=e,b=ls(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Js(this,d,1)||f;e>=a?ms(this,b):(a=e,b=ls(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=
Js(this,d,-1)||f;e>=a?ms(this,b):(a=e,b=ls(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Js(this,d,0)||f;e>=a?ms(this,b):(a=e,b=ls(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Js(this,d,0)||f;e>=a?ms(this,b):(a=e,b=ls(this))}break;default:case ds:for(c=this.Ba,g=0,h=a+1;(d=this.countCrossings())<h;){h=d;for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Js(this,d,-1)||f;e=this.countCrossings();e>=a?ms(this,b):(a=e,b=ls(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Js(this,d,1)||f;e=this.countCrossings();e>=a?ms(this,b):
(a=e,b=ls(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Js(this,d,1)||f;e>=a?ms(this,b):(a=e,b=ls(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Js(this,d,-1)||f;e>=a?ms(this,b):(a=e,b=ls(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Js(this,d,0)||f;e>=a?ms(this,b):(a=e,b=ls(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Js(this,d,0)||f;e>=a?ms(this,b):(a=e,b=ls(this))}}ms(this,b)};
function Is(a,b,c){E&&(B(b,$r,"medianBarycenterCrossingReduction:unfixedLayer"),B(c,$r,"medianBarycenterCrossingReduction:direction"));var d=is(a,b),e=a.hc[b],f=qs(a,b,c),g=ps(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);js(a,b,d)}
function Js(a,b,c){var d=is(a,b),e=a.hc[b];c=ns(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,q=0,r=d[f].column,u=d[f+1].column,x=a.nodeMinColumnSpace(d[f],!0),y=a.nodeMinColumnSpace(d[f],!1),A=a.nodeMinColumnSpace(d[f+1],!0),C=a.nodeMinColumnSpace(d[f+1],!1);x=r-x+A;y=u-y+C;var G=d[f].sourceEdges.iterator;for(G.reset();G.next();)if(A=G.value,C=A.fromVertex,
A.valid&&C.layer===b){for(A=0;d[A]!==C;)A++;A<f&&(p+=2*(f-A),q+=2*(f+1-A));A===f+1&&(p+=1);A>f+1&&(p+=4*(A-f),q+=4*(A-(f+1)))}G=d[f].destinationEdges.iterator;for(G.reset();G.next();)if(A=G.value,C=A.toVertex,A.valid&&C.layer===b){for(A=0;d[A]!==C;)A++;A===f+1&&(q+=1)}G=d[f+1].sourceEdges.iterator;for(G.reset();G.next();)if(A=G.value,C=A.fromVertex,A.valid&&C.layer===b){for(A=0;d[A]!==C;)A++;A<f&&(p+=2*(f+1-A),q+=2*(f-A));A===f&&(q+=1);A>f+1&&(p+=4*(A-(f+1)),q+=4*(A-f))}G=d[f+1].destinationEdges.iterator;
for(G.reset();G.next();)if(A=G.value,C=A.toVertex,A.valid&&C.layer===b){for(A=0;d[A]!==C;)A++;A===f&&(p+=1)}A=C=0;G=g[d[f].index];var I=h[d[f].index],O=g[d[f+1].index],R=h[d[f+1].index];-1!==G&&(C+=Math.abs(G-r),A+=Math.abs(G-y));-1!==I&&(C+=Math.abs(I-r),A+=Math.abs(I-y));-1!==O&&(C+=Math.abs(O-u),A+=Math.abs(O-x));-1!==R&&(C+=Math.abs(R-u),A+=Math.abs(R-x));if(q<p-.5||q===p&&n<m-.5||q===p&&n===m&&A<C-.5)l=k=!0,d[f].column=y,d[f+1].column=x,m=d[f],d[f]=d[f+1],d[f+1]=m}for(f=0;f<e;f++)d[f].index=
f;js(a,b,d);return k}
$r.prototype.straightenAndPack=function(){var a=0!==(this.dg&1);var b=7===this.dg;1E3<this.network.edges.count&&!b&&(a=!1);if(a){var c=[];for(b=0;b<=this.Ba;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.Ia-c[b])>>1)+8*d;this.Ia*=8}if(0!==(this.dg&2))for(c=!0;c;){c=!1;for(b=this.qd+1;b<=this.Ba;b++)c=Ms(this,b,1)||c;for(b=
this.qd-1;0<=b;b--)c=Ms(this,b,-1)||c;c=Ms(this,this.qd,0)||c}if(0!==(this.dg&4)){for(b=this.qd+1;b<=this.Ba;b++)Ns(this,b,1);for(b=this.qd-1;0<=b;b--)Ns(this,b,-1);Ns(this,this.qd,0)}a&&(Os(this,-1),Os(this,1));if(0!==(this.dg&2))for(c=!0;c;){c=!1;c=Ms(this,this.qd,0)||c;for(b=this.qd+1;b<=this.Ba;b++)c=Ms(this,b,0)||c;for(b=this.qd-1;0<=b;b--)c=Ms(this,b,0)||c}};
function Ms(a,b,c){E&&(B(b,$r,"bendStraighten:unfixedLayer"),B(c,$r,"bendStraighten:direction"));for(var d=!1;Ps(a,b,c);)d=!0;return d}
function Ps(a,b,c){E&&(B(b,$r,"shiftbendStraighten:unfixedLayer"),B(c,$r,"shiftbendStraighten:direction"));var d,e=is(a,b),f=a.hc[b],g=ps(a,b,-1);if(0<c)for(d=0;d<f;d++)g[d]=-1;var h=ps(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),q=0;0>d-1||m-e[d-1].column-1>n+a.nodeMinColumnSpace(e[d-1],!1)?q=m-1:q=m;n=d+1>=f||e[d+1].column-m-1>p+a.nodeMinColumnSpace(e[d+1],!0)?m+1:m;var r=p=0,u=
0;if(0>=c)for(var x=e[d].sourceEdges.iterator;x.next();){var y=x.value;var A=y.fromVertex;if(y.valid&&A.layer!==b){var C=ks(y);var G=y.portFromColOffset;y=y.portToColOffset;A=A.column;p+=(Math.abs(m+y-(A+G))+1)*C;r+=(Math.abs(q+y-(A+G))+1)*C;u+=(Math.abs(n+y-(A+G))+1)*C}}if(0<=c)for(x=e[d].destinationEdges.iterator;x.next();)y=x.value,A=y.toVertex,y.valid&&A.layer!==b&&(C=ks(y),G=y.portFromColOffset,y=y.portToColOffset,A=A.column,p+=(Math.abs(m+G-(A+y))+1)*C,r+=(Math.abs(q+G-(A+y))+1)*C,u+=(Math.abs(n+
G-(A+y))+1)*C);y=G=C=0;x=g[e[d].index];A=h[e[d].index];-1!==x&&(C+=Math.abs(x-m),G+=Math.abs(x-q),y+=Math.abs(x-n));-1!==A&&(C+=Math.abs(A-m),G+=Math.abs(A-q),y+=Math.abs(A-n));if(r<p||r===p&&G<C)l=k=!0,e[d].column=q;else if(u<p||u===p&&y<C)l=k=!0,e[d].column=n}js(a,b,e);a.normalize();return k}
function Ns(a,b,c){E&&(B(b,$r,"medianStraighten:unfixedLayer"),B(c,$r,"medianStraighten:direction"));var d=is(a,b),e=a.hc[b],f=qs(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)}js(a,b,
d);a.normalize()}function Qs(a,b){E&&(B(b,$r,"packAux:column"),B(1,$r,"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 Rs(a,b){E&&(B(b,$r,"tightPackAux:column"),B(1,$r,"tightPackAux:direction"));var c=b+1;var d,e=[],f=[];for(d=0;d<=a.Ba;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.Ba;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 Os(a,b){E&&B(b,$r,"componentPack:direction");for(var c=0;c<=a.Ia;c++)for(;Qs(a,c););a.normalize();for(c=0;c<a.Ia;c++)for(;Rs(a,c););a.normalize();var d;if(0<b)for(c=0;c<=a.Ia;c++){var e=ls(a);var f=os(a);for(d=f+1;f<d;){d=f;Ss(a,c,1);var g=os(a);g>f?ms(a,e):g<f&&(f=g,e=ls(a))}}if(0>b)for(c=a.Ia;0<=c;c--)for(e=ls(a),f=os(a),d=f+1;f<d;)d=f,Ss(a,c,-1),g=os(a),g>f?ms(a,e):g<f&&(f=g,e=ls(a));a.normalize()}
function Ss(a,b,c){a.Nd=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.Nd)}if(0>c)for(d.reset();d.next();)e=d.value,e.column+a.nodeMinColumnSpace(e,!1)>=b&&(e.component=a.Nd);a.Nd++;for(d.reset();d.next();)b=d.value,-1===b.component&&(ss(a,b,a.Nd,-1,!0,!0),a.Nd++);var f;b=[];for(f=0;f<a.Nd*a.Nd;f++)b[f]=!1;e=[];for(f=0;f<(a.Ba+1)*(a.Ia+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.Ia,f.column+a.nodeMinColumnSpace(f,!1));h<=k;h++)e[g*(a.Ia+1)+h]=f.component}for(f=0;f<=a.Ba;f++){if(0<c)for(g=0;g<a.Ia;g++)-1!==e[f*(a.Ia+1)+g]&&-1!==e[f*(a.Ia+1)+g+1]&&e[f*(a.Ia+1)+g]!==e[f*(a.Ia+1)+g+1]&&(b[e[f*(a.Ia+1)+g]*a.Nd+e[f*(a.Ia+1)+g+1]]=!0);if(0>c)for(g=a.Ia;0<g;g--)-1!==e[f*(a.Ia+1)+g]&&-1!==e[f*(a.Ia+1)+g-1]&&e[f*(a.Ia+1)+g]!==e[f*(a.Ia+1)+g-1]&&(b[e[f*(a.Ia+1)+g]*a.Nd+e[f*(a.Ia+1)+g-1]]=!0)}e=
[];for(f=0;f<a.Nd;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.Nd;f++)b[k*a.Nd+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)}
$r.prototype.commitLayout=function(){if(this.setsPortSpots)for(var a=gs(this,!0),b=gs(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.Tu();this.isRouting&&this.commitLinks()};function gs(a,b){return 270===a.M?b?Vd:de:90===a.M?b?de:Vd:180===a.M?b?Wd:Xd:b?Xd:Wd}
$r.prototype.commitNodes=function(){this.Jd=[];this.od=[];this.nd=[];this.La=[];for(var a=0;a<=this.Ba;a++)this.Jd[a]=0,this.od[a]=0,this.nd[a]=0,this.La[a]=0;for(a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;this.Jd[c]=Math.max(this.Jd[c],this.nodeMinLayerSpace(b,!0));this.od[c]=Math.max(this.od[c],this.nodeMinLayerSpace(b,!1))}b=0;c=this.ne;for(var d=0;d<=this.Ba;d++){var e=c;0>=this.Jd[d]+this.od[d]&&(e=0);0<d&&(b+=e/2);90===this.M||0===this.M?(b+=this.od[d],this.nd[d]=b,
b+=this.Jd[d]):(b+=this.Jd[d],this.nd[d]=b,b+=this.od[d]);d<this.Ba&&(b+=e/2);this.La[d]=b}c=b;b=this.arrangementOrigin;for(d=0;d<=this.Ba;d++)270===this.M?this.nd[d]=b.y+this.nd[d]:90===this.M?(this.nd[d]=b.y+c-this.nd[d],this.La[d]=c-this.La[d]):180===this.M?this.nd[d]=b.x+this.nd[d]:(this.nd[d]=b.x+c-this.nd[d],this.La[d]=c-this.La[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.Yb*g;f=this.nd[f]}else h=this.nd[f],f=b.y+
this.Yb*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.pw=new J(d,b);for(a.reset();a.next();)c=a.value,c.x+=d,c.y+=b,c.commit()};
$r.prototype.Tu=function(){for(var a=0,b=this.ne,c=0;c<=this.Ba;c++)a+=this.Jd[c],a+=this.od[c];a+=this.Ba*b;b=[];c=this.Yb*this.Ia;for(var d=this.maxLayer;0<=d;d--)270===this.M?0===d?b.push(new L(0,0,c,Math.abs(this.La[0]))):b.push(new L(0,this.La[d-1],c,Math.abs(this.La[d-1]-this.La[d]))):90===this.M?0===d?b.push(new L(0,this.La[0],c,Math.abs(this.La[0]-a))):b.push(new L(0,this.La[d],c,Math.abs(this.La[d-1]-this.La[d]))):180===this.M?0===d?b.push(new L(0,0,Math.abs(this.La[0]),c)):b.push(new L(this.La[d-
1],0,Math.abs(this.La[d-1]-this.La[d]),c)):0===d?b.push(new L(this.La[0],0,Math.abs(this.La[0]-a),c)):b.push(new L(this.La[d],0,Math.abs(this.La[d-1]-this.La[d]),c));this.commitLayers(b,this.pw)};$r.prototype.commitLayers=function(){};
$r.prototype.commitLinks=function(){for(var a=this.network.edges.iterator,b;a.next();)b=a.value.link,null!==b&&(b.Eh(),b.Xj(),b.pf());for(a.reset();a.next();)b=a.value.link,null!==b&&b.bj();for(a.reset();a.next();){var c=a.value;b=c.link;if(null!==b){b.Eh();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)}if(null!==f){var l=f.findVisibleNode();null!==l&&l!==f&&(f=l,h=l.port)}var m=b.computeSpot(!0,g),n=b.computeSpot(!1,
h),p=c.fromVertex,q=c.toVertex;if(c.valid){if(b.curve===fh&&4===b.pointsCount)if(p.column===q.column){var r=b.getLinkPoint(e,g,m,!0,!1,f,h),u=b.getLinkPoint(f,h,n,!1,!1,e,g);r.o()||r.set(e.actualBounds.center);u.o()||u.set(f.actualBounds.center);b.Xj();b.nf(r.x,r.y);b.nf((2*r.x+u.x)/3,(2*r.y+u.y)/3);b.nf((r.x+2*u.x)/3,(r.y+2*u.y)/3);b.nf(u.x,u.y)}else{var x=!1,y=!1;null!==g&&m===ed&&(x=!0);null!==h&&n===ed&&(y=!0);if(x||y){var A=b.i(0).x,C=b.i(0).y,G=b.i(3).x,I=b.i(3).y;if(x){if(90===this.M||270===
this.M){var O=A;var R=(C+I)/2}else O=(A+G)/2,R=C;b.N(1,O,R);var Q=b.getLinkPoint(e,g,m,!0,!1,f,h);Q.o()||Q.set(e.actualBounds.center);b.N(0,Q.x,Q.y)}if(y){if(90===this.M||270===this.M){var ea=G;var Z=(C+I)/2}else ea=(A+G)/2,Z=I;b.N(2,ea,Z);var qa=b.getLinkPoint(f,h,n,!1,!1,e,g);qa.o()||qa.set(f.actualBounds.center);b.N(3,qa.x,qa.y)}}}b.pf()}else if(p.layer===q.layer)b.pf();else{var xa=!1,S=!1,aa=b.firstPickIndex+1;if(b.isOrthogonal){S=!0;var Ga=b.pointsCount;4<Ga&&b.points.removeRange(2,Ga-3)}else if(b.curve===
fh)xa=!0,Ga=b.pointsCount,4<Ga&&b.points.removeRange(2,Ga-3),4===Ga&&(aa=2);else{Ga=b.pointsCount;var yb=m===ed,Xa=n===ed;2<Ga&&yb&&Xa?b.points.removeRange(1,Ga-2):3<Ga&&yb&&!Xa?b.points.removeRange(1,Ga-3):3<Ga&&!yb&&Xa?b.points.removeRange(2,Ga-2):4<Ga&&!yb&&!Xa&&b.points.removeRange(2,Ga-3)}var Sa;if(c.rev){for(var Ua;null!==q&&p!==q;){var hb=Sa=null;for(var kc=q.sourceEdges.iterator;kc.next();){var rb=kc.value;if(rb.link===c.link&&(Sa=rb.fromVertex,hb=rb.toVertex,null===Sa.node))break}if(Sa!==
p){var mb=b.i(aa-1).x;var cb=b.i(aa-1).y;var ua=Sa.centerX;var ta=Sa.centerY;if(S)if(180===this.M||0===this.M)if(aa===b.firstPickIndex+1)b.m(aa++,mb,cb),b.m(aa++,mb,ta);else{if((null!==hb?hb.centerY:cb)!==ta){var wb=this.La[Sa.layer-1];b.m(aa++,wb,cb);b.m(aa++,wb,ta)}}else aa===b.firstPickIndex+1?(b.m(aa++,mb,cb),b.m(aa++,ua,cb)):(null!==hb?hb.centerX:mb)!==ua&&(wb=this.La[Sa.layer-1],b.m(aa++,mb,wb),b.m(aa++,ua,wb));else if(aa===b.firstPickIndex+1){var zb=Math.max(10,this.Jd[q.layer]);var db=Math.max(10,
this.od[q.layer]);if(xa)180===this.M?ua<=q.bounds.x?(Ua=q.bounds.x,b.m(aa++,Ua-zb,ta),b.m(aa++,Ua,ta),b.m(aa++,Ua+db,ta)):(b.m(aa++,ua-zb,ta),b.m(aa++,ua,ta),b.m(aa++,ua+db,ta)):90===this.M?ta>=q.bounds.bottom?(Ua=q.bounds.y+q.bounds.height,b.m(aa++,ua,Ua+db),b.m(aa++,ua,Ua),b.m(aa++,ua,Ua-zb)):(b.m(aa++,ua,ta+db),b.m(aa++,ua,ta),b.m(aa++,ua,ta-zb)):270===this.M?ta<=q.bounds.y?(Ua=q.bounds.y,b.m(aa++,ua,Ua-zb),b.m(aa++,ua,Ua),b.m(aa++,ua,Ua+db)):(b.m(aa++,ua,ta-zb),b.m(aa++,ua,ta),b.m(aa++,ua,ta+
db)):0===this.M&&(ua>=q.bounds.right?(Ua=q.bounds.x+q.bounds.width,b.m(aa++,Ua+db,ta),b.m(aa++,Ua,ta),b.m(aa++,Ua-zb,ta)):(b.m(aa++,ua+db,ta),b.m(aa++,ua,ta),b.m(aa++,ua-zb,ta)));else{b.m(aa++,mb,cb);var qe=0;if(180===this.M||0===this.M){if(180===this.M?ua>=q.bounds.right:ua<=q.bounds.x)qe=(0===this.M?-zb:db)/2;b.m(aa++,mb+qe,ta)}else{if(270===this.M?ta>=q.bounds.bottom:ta<=q.bounds.y)qe=(90===this.M?-zb:db)/2;b.m(aa++,ua,cb+qe)}b.m(aa++,ua,ta)}}else zb=Math.max(10,this.Jd[Sa.layer]),db=Math.max(10,
this.od[Sa.layer]),180===this.M?(xa&&b.m(aa++,ua-zb,ta),b.m(aa++,ua,ta),xa&&b.m(aa++,ua+db,ta)):90===this.M?(xa&&b.m(aa++,ua,ta+db),b.m(aa++,ua,ta),xa&&b.m(aa++,ua,ta-zb)):270===this.M?(xa&&b.m(aa++,ua,ta-zb),b.m(aa++,ua,ta),xa&&b.m(aa++,ua,ta+db)):(xa&&b.m(aa++,ua+db,ta),b.m(aa++,ua,ta),xa&&b.m(aa++,ua-zb,ta))}q=Sa}if(null===h||m!==ed||S)if(mb=b.i(aa-1).x,cb=b.i(aa-1).y,ua=b.i(aa).x,ta=b.i(aa).y,S){var Yd=this.od[p.layer];if(180===this.M||0===this.M){var Lb=cb;Lb>=p.bounds.y&&Lb<=p.bounds.bottom&&
(180===this.M?ua>=p.bounds.x:ua<=p.bounds.right)&&(Ua=p.centerX+(180===this.M?-Yd:Yd),Lb<p.bounds.y+p.bounds.height/2?Lb=p.bounds.y-this.Yb/2:Lb=p.bounds.bottom+this.Yb/2,b.m(aa++,Ua,cb),b.m(aa++,Ua,Lb));b.m(aa++,ua,Lb)}else Lb=mb,Lb>=p.bounds.x&&Lb<=p.bounds.right&&(270===this.M?ta>=p.bounds.y:ta<=p.bounds.bottom)&&(Ua=p.centerY+(270===this.M?-Yd:Yd),Lb<p.bounds.x+p.bounds.width/2?Lb=p.bounds.x-this.Yb/2:Lb=p.bounds.right+this.Yb/2,b.m(aa++,mb,Ua),b.m(aa++,Lb,Ua)),b.m(aa++,Lb,ta);b.m(aa++,ua,ta)}else if(xa)zb=
Math.max(10,this.Jd[p.layer]),db=Math.max(10,this.od[p.layer]),180===this.M&&ua>=p.bounds.x?(Ua=p.bounds.x+p.bounds.width,b.N(aa-2,Ua,cb),b.N(aa-1,Ua+db,cb)):90===this.M&&ta<=p.bounds.bottom?(Ua=p.bounds.y,b.N(aa-2,mb,Ua),b.N(aa-1,mb,Ua-zb)):270===this.M&&ta>=p.bounds.y?(Ua=p.bounds.y+p.bounds.height,b.N(aa-2,mb,Ua),b.N(aa-1,mb,Ua+db)):0===this.M&&ua<=p.bounds.right&&(Ua=p.bounds.x,b.N(aa-2,Ua,cb),b.N(aa-1,Ua-zb,cb));else{zb=Math.max(10,this.Jd[p.layer]);db=Math.max(10,this.od[p.layer]);var Pf=0;
if(180===this.M||0===this.M){if(180===this.M?ua<=p.bounds.x:ua>=p.bounds.right)Pf=(0===this.M?db:-zb)/2;b.m(aa++,ua+Pf,cb)}else{if(270===this.M?ta<=p.bounds.y:ta>=p.bounds.bottom)Pf=(90===this.M?db:-zb)/2;b.m(aa++,mb,ta+Pf)}b.m(aa++,ua,ta)}}else{for(;null!==p&&p!==q;){hb=Sa=null;for(var Wb=p.destinationEdges.iterator;Wb.next();){var De=Wb.value;if(De.link===c.link&&(Sa=De.toVertex,hb=De.fromVertex,null!==hb.node&&(hb=null),null===Sa.node))break}Sa!==q&&(mb=b.i(aa-1).x,cb=b.i(aa-1).y,ua=Sa.centerX,
ta=Sa.centerY,S?180===this.M||0===this.M?(null!==hb?hb.centerY:cb)!==ta&&(wb=this.La[Sa.layer],aa===b.firstPickIndex+1&&(wb=0===this.M?Math.max(wb,mb):Math.min(wb,mb)),b.m(aa++,wb,cb),b.m(aa++,wb,ta)):(null!==hb?hb.centerX:mb)!==ua&&(wb=this.La[Sa.layer],aa===b.firstPickIndex+1&&(wb=90===this.M?Math.max(wb,cb):Math.min(wb,cb)),b.m(aa++,mb,wb),b.m(aa++,ua,wb)):(zb=Math.max(10,this.Jd[Sa.layer]),db=Math.max(10,this.od[Sa.layer]),180===this.M?(b.m(aa++,ua+db,ta),xa&&b.m(aa++,ua,ta),b.m(aa++,ua-zb,ta)):
90===this.M?(b.m(aa++,ua,ta-zb),xa&&b.m(aa++,ua,ta),b.m(aa++,ua,ta+db)):270===this.M?(b.m(aa++,ua,ta+db),xa&&b.m(aa++,ua,ta),b.m(aa++,ua,ta-zb)):(b.m(aa++,ua-zb,ta),xa&&b.m(aa++,ua,ta),b.m(aa++,ua+db,ta))));p=Sa}S&&(mb=b.i(aa-1).x,cb=b.i(aa-1).y,ua=b.i(aa).x,ta=b.i(aa).y,180===this.M||0===this.M?cb!==ta&&(wb=0===this.M?Math.min(Math.max((ua+mb)/2,this.La[q.layer]),ua):Math.max(Math.min((ua+mb)/2,this.La[q.layer]),ua),b.m(aa++,wb,cb),b.m(aa++,wb,ta)):mb!==ua&&(wb=90===this.M?Math.min(Math.max((ta+
cb)/2,this.La[q.layer]),ta):Math.max(Math.min((ta+cb)/2,this.La[q.layer]),ta),b.m(aa++,mb,wb),b.m(aa++,ua,wb)))}if(null!==d&&xa){if(null!==g){if(m===ed){var id=b.i(0),lc=b.i(2);id.A(lc)||b.N(1,(id.x+lc.x)/2,(id.y+lc.y)/2)}var Zd=b.getLinkPoint(e,g,ed,!0,!1,f,h);Zd.o()||Zd.set(e.actualBounds.center);b.N(0,Zd.x,Zd.y)}if(null!==h){if(n===ed){var Wc=b.i(b.pointsCount-1),Ze=b.i(b.pointsCount-3);Wc.A(Ze)||b.N(b.pointsCount-2,(Wc.x+Ze.x)/2,(Wc.y+Ze.y)/2)}var $e=b.getLinkPoint(f,h,ed,!1,!1,e,g);$e.o()||$e.set(f.actualBounds.center);
b.N(b.pointsCount-1,$e.x,$e.y)}}b.pf();c.commit()}}}for(var Qf=new F,wf=this.network.edges.iterator;wf.next();){var Rf=wf.value.link;null!==Rf&&Rf.isOrthogonal&&!Qf.contains(Rf)&&Qf.add(Rf)}if(0<Qf.count)if(90===this.M||270===this.M){for(var mc=0,ob=[],nb,Nc,Sf=Qf.iterator;Sf.next();){var zc=Sf.value;if(null!==zc&&zc.isOrthogonal)for(var $d=2;$d<zc.pointsCount-3;$d++)if(nb=zc.i($d),Nc=zc.i($d+1),this.B(nb.y,Nc.y)&&!this.B(nb.x,Nc.x)){var Ic=new Ts;Ic.layer=Math.floor(nb.y/2);var ae=zc.i(0),nc=zc.i(zc.pointsCount-
1);Ic.first=ae.x*ae.x+ae.y;Ic.Ub=nc.x*nc.x+nc.y;Ic.Vc=Math.min(nb.x,Nc.x);Ic.uc=Math.max(nb.x,Nc.x);Ic.index=$d;Ic.link=zc;if($d+2<zc.pointsCount){var Zh=zc.i($d-1),$h=zc.i($d+2),af=0;Zh.y<nb.y?af=$h.y<nb.y?3:nb.x<Nc.x?2:1:Zh.y>nb.y&&(af=$h.y>nb.y?0:Nc.x<nb.x?2:1);Ic.l=af}ob.push(Ic)}}if(1<ob.length){ob.sort(this.Kx);for(var Fb=0;Fb<ob.length;){for(var Tf=ob[Fb].layer,bf=Fb+1;bf<ob.length&&ob[bf].layer===Tf;)bf++;if(1<bf-Fb)for(var oc=Fb;oc<bf;){for(var cf=ob[oc].uc,ad=Fb+1;ad<bf&&ob[ad].Vc<cf;)cf=
Math.max(cf,ob[ad].uc),ad++;var vb=ad-oc;if(1<vb){this.Zi(ob,this.xt,oc,oc+vb);for(var df=1,Ib=ob[oc].Ub,Jc=oc;Jc<ad;Jc++){var Ab=ob[Jc];Ab.Ub!==Ib&&(df++,Ib=Ab.Ub)}this.Zi(ob,this.Jx,oc,oc+vb);var jd=1;Ib=ob[oc].first;for(var kd=oc;kd<ad;kd++){var Jd=ob[kd];Jd.first!==Ib&&(jd++,Ib=Jd.first)}var Vg=!0,Uf=jd;df<jd?(Vg=!1,Uf=df,Ib=ob[oc].Ub,this.Zi(ob,this.xt,oc,oc+vb)):Ib=ob[oc].first;for(var Vf=0,xf=oc;xf<ad;xf++){var xd=ob[xf];(Vg?xd.first:xd.Ub)!==Ib&&(Vf++,Ib=Vg?xd.first:xd.Ub);var Kd=xd.link;
nb=Kd.i(xd.index);Nc=Kd.i(xd.index+1);var bd=this.linkSpacing*(Vf-(Uf-1)/2);if(!Kd.isAvoiding||Us(nb.x,nb.y+bd,Nc.x,Nc.y+bd))mc++,Kd.Eh(),Kd.N(xd.index,nb.x,nb.y+bd),Kd.N(xd.index+1,Nc.x,Nc.y+bd),Kd.pf()}}oc=ad}Fb=bf}}}else{for(var yd=0,Bb=[],pb,cd,ld=Qf.iterator;ld.next();){var zd=ld.value;if(null!==zd&&zd.isOrthogonal)for(var Oc=2;Oc<zd.pointsCount-3;Oc++)if(pb=zd.i(Oc),cd=zd.i(Oc+1),this.B(pb.x,cd.x)&&!this.B(pb.y,cd.y)){var Pa=new Ts;Pa.layer=Math.floor(pb.x/2);var md=zd.i(0),pc=zd.i(zd.pointsCount-
1);Pa.first=md.x+md.y*md.y;Pa.Ub=pc.x+pc.y*pc.y;Pa.Vc=Math.min(pb.y,cd.y);Pa.uc=Math.max(pb.y,cd.y);Pa.index=Oc;Pa.link=zd;if(Oc+2<zd.pointsCount){var re=zd.i(Oc-1),ef=zd.i(Oc+2),se=0;re.x<pb.x?se=ef.x<pb.x?3:pb.y<cd.y?2:1:re.x>pb.x&&(se=ef.x>pb.x?0:cd.y<pb.y?2:1);Pa.l=se}Bb.push(Pa)}}if(1<Bb.length){Bb.sort(this.Kx);for(var Pc=0;Pc<Bb.length;){for(var Ee=Bb[Pc].layer,nd=Pc+1;nd<Bb.length&&Bb[nd].layer===Ee;)nd++;if(1<nd-Pc)for(var Mb=Pc;Mb<nd;){for(var be=Bb[Mb].uc,bc=Pc+1;bc<nd&&Bb[bc].Vc<be;)be=
Math.max(be,Bb[bc].uc),bc++;var Fe=bc-Mb;if(1<Fe){this.Zi(Bb,this.xt,Mb,Mb+Fe);for(var Ld=1,te=Bb[Mb].Ub,Wg=Mb;Wg<bc;Wg++){var od=Bb[Wg];od.Ub!==te&&(Ld++,te=od.Ub)}this.Zi(Bb,this.Jx,Mb,Mb+Fe);var ff=1;te=Bb[Mb].first;for(var Wf=Mb;Wf<bc;Wf++){var Xf=Bb[Wf];Xf.first!==te&&(ff++,te=Xf.first)}var gf=!0,Xg=ff;Ld<ff?(gf=!1,Xg=Ld,te=Bb[Mb].Ub,this.Zi(Bb,this.xt,Mb,Mb+Fe)):te=Bb[Mb].first;for(var rg=0,$i=Mb;$i<bc;$i++){var hf=Bb[$i];(gf?hf.first:hf.Ub)!==te&&(rg++,te=gf?hf.first:hf.Ub);var Ge=hf.link;
pb=Ge.i(hf.index);cd=Ge.i(hf.index+1);var sg=this.linkSpacing*(rg-(Xg-1)/2);if(!Ge.isAvoiding||Us(pb.x+sg,pb.y,cd.x+sg,cd.y))yd++,Ge.Eh(),Ge.N(hf.index,pb.x+sg,pb.y),Ge.N(hf.index+1,cd.x+sg,cd.y),Ge.pf()}}Mb=bc}Pc=nd}}}};t=$r.prototype;t.Kx=function(a,b){return a instanceof Ts&&b instanceof Ts&&a!==b?a.layer<b.layer?-1:a.layer>b.layer?1:a.Vc<b.Vc?-1:a.Vc>b.Vc?1:a.uc<b.uc?-1:a.uc>b.uc?1:0:0};
t.Jx=function(a,b){return a instanceof Ts&&b instanceof Ts&&a!==b?a.first<b.first?-1:a.first>b.first||a.l<b.l?1:a.l>b.l||a.Vc<b.Vc?-1:a.Vc>b.Vc?1:a.uc<b.uc?-1:a.uc>b.uc?1:0:0};t.xt=function(a,b){return a instanceof Ts&&b instanceof Ts&&a!==b?a.Ub<b.Ub?-1:a.Ub>b.Ub||a.l<b.l?1:a.l>b.l||a.Vc<b.Vc?-1:a.Vc>b.Vc?1:a.uc<b.uc?-1:a.uc>b.uc?1:0:0};t.B=function(a,b){E&&(B(a,$r,"isApprox:a"),B(b,$r,"isApprox:b"));a-=b;return-1<a&&1>a};
t.Zi=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 Us(a,b,c,d){E&&(B(a,$r,"isUnoccupied2:px"),B(b,$r,"isUnoccupied2:py"),B(c,$r,"isUnoccupied2:qx"),B(d,$r,"isUnoccupied2:qy"));return!0}function is(a,b){var c=a.hc[b];if(c>=a.te.length){var d=[];for(var e=0;e<a.te.length;e++)d[e]=a.te[e];a.te=d}void 0===a.te[c]||null===a.te[c]?d=[]:(d=a.te[c],a.te[c]=null);a=a.Fo[b];for(b=0;b<a.length;b++)c=a[b],d[c.index]=c;return d}function js(a,b,c){a.te[a.hc[b]]=c}
na.Object.defineProperties($r.prototype,{layerSpacing:{configurable:!0,get:function(){return this.ne},set:function(a){this.ne!==a&&(z(a,"number",$r,"layerSpacing"),0<=a&&(this.ne=a,this.C()))}},columnSpacing:{configurable:!0,get:function(){return this.Yb},set:function(a){this.Yb!==a&&(z(a,"number",$r,"columnSpacing"),0<a&&(this.Yb=a,this.C()))}},direction:{configurable:!0,get:function(){return this.M},set:function(a){this.M!==a&&(z(a,"number",$r,"direction"),
0===a||90===a||180===a||270===a?(this.M=a,this.C()):v("LayeredDigraphLayout.direction must be 0, 90, 180, or 270"))}},cycleRemoveOption:{configurable:!0,get:function(){return this.Pk},set:function(a){this.Pk!==a&&(tb(a,$r,$r,"cycleRemoveOption"),a===ts||a===as||a===fs)&&(this.Pk=a,this.C())}},layeringOption:{configurable:!0,get:function(){return this.ql},set:function(a){this.ql!==a&&(tb(a,$r,$r,"layeringOption"),a===bs||a===ys||a===As)&&(this.ql=a,this.C())}},initializeOption:{configurable:!0,
enumerable:!0,get:function(){return this.gl},set:function(a){this.gl!==a&&(tb(a,$r,$r,"initializeOption"),a===cs||a===Gs||a===Es)&&(this.gl=a,this.C())}},iterations:{configurable:!0,get:function(){return this.tj},set:function(a){this.tj!==a&&(B(a,es,"iterations"),0<=a&&(this.tj=a,this.C()))}},aggressiveOption:{configurable:!0,get:function(){return this.Bk},set:function(a){this.Bk!==a&&(tb(a,$r,$r,"aggressiveOption"),a===Ks||a===ds||a===Ls)&&(this.Bk=a,this.C())}},packOption:{configurable:!0,
enumerable:!0,get:function(){return this.dg},set:function(a){this.dg!==a&&(z(a,"number",$r,"packOption"),0<=a&&8>a&&(this.dg=a,this.C()))}},setsPortSpots:{configurable:!0,get:function(){return this.bf},set:function(a){this.bf!==a&&(z(a,"boolean",$r,"setsPortSpots"),this.bf=a,this.C())}},linkSpacing:{configurable:!0,get:function(){return this.ko},set:function(a){this.ko!==a&&(z(a,"number",$r,"linkSpacing"),0<=a&&(this.ko=a,this.C()))}},maxLayer:{configurable:!0,
get:function(){return this.Ba}},maxIndex:{configurable:!0,get:function(){return this.Vr}},maxColumn:{configurable:!0,get:function(){return this.Ia}},minIndexLayer:{configurable:!0,get:function(){return this.uo}},maxIndexLayer:{configurable:!0,get:function(){return this.qd}}});
var as=new D($r,"CycleDepthFirst",0),ts=new D($r,"CycleGreedy",1),fs=new D($r,"CycleFromLayers",2),bs=new D($r,"LayerOptimalLinkLength",0),ys=new D($r,"LayerLongestPathSink",1),As=new D($r,"LayerLongestPathSource",2),cs=new D($r,"InitDepthFirstOut",0),Gs=new D($r,"InitDepthFirstIn",1),Es=new D($r,"InitNaive",2),Ks=new D($r,"AggressiveNone",0),ds=new D($r,"AggressiveLess",1),Ls=new D($r,"AggressiveMore",2);$r.className="LayeredDigraphLayout";$r.CycleDepthFirst=as;$r.CycleGreedy=ts;
$r.CycleFromLayers=fs;$r.LayerOptimalLinkLength=bs;$r.LayerLongestPathSink=ys;$r.LayerLongestPathSource=As;$r.InitDepthFirstOut=cs;$r.InitDepthFirstIn=Gs;$r.InitNaive=Es;$r.AggressiveNone=Ks;$r.AggressiveLess=ds;$r.AggressiveMore=Ls;$r.PackNone=0;$r.PackExpand=1;$r.PackStraighten=2;$r.PackMedian=4;$r.PackAll=7;function Ts(){this.index=this.uc=this.Vc=this.Ub=this.first=this.layer=0;this.link=null;this.l=0}Ts.className="SegInfo";function es(a){Sp.call(this,a)}ma(es,Sp);es.prototype.createVertex=function(){return new Vs(this)};
es.prototype.createEdge=function(){return new Ws(this)};es.className="LayeredDigraphNetwork";function Vs(a){Vp.call(this,a);this.Ua=this.Hg=this.ii=-1;this.L=NaN;this.ca=null;this.valid=!1;this.finish=this.bm=NaN;this.Tj=0;this.xv=this.yv=null}ma(Vs,Vp);
na.Object.defineProperties(Vs.prototype,{layer:{configurable:!0,get:function(){return this.ii},set:function(a){this.ii!==a&&(z(a,"number",Vs,"layer"),this.ii=a)}},column:{configurable:!0,get:function(){return this.Hg},set:function(a){this.Hg!==a&&(z(a,"number",Vs,"column"),this.Hg=a)}},index:{configurable:!0,get:function(){return this.Ua},set:function(a){this.Ua!==a&&(z(a,"number",Vs,"index"),this.Ua=a)}},component:{configurable:!0,get:function(){return this.L},
set:function(a){this.L!==a&&(z(a,"number",Vs,"component"),this.L=a)}},near:{configurable:!0,get:function(){return this.ca},set:function(a){this.ca!==a&&(E&&null!==a&&w(a,Vs,Vs,"near"),this.ca=a)}}});Vs.className="LayeredDigraphVertex";function Ws(a){Wp.call(this,a);this.l=this.Na=this.Wb=!1;this.Ma=this.L=NaN;this.ca=this.w=0}ma(Ws,Wp);
na.Object.defineProperties(Ws.prototype,{valid:{configurable:!0,get:function(){return this.Wb},set:function(a){this.Wb!==a&&(z(a,"boolean",Ws,"valid"),this.Wb=a)}},rev:{configurable:!0,get:function(){return this.Na},set:function(a){this.Na!==a&&(z(a,"boolean",Ws,"rev"),this.Na=a)}},forest:{configurable:!0,get:function(){return this.l},set:function(a){this.l!==a&&(z(a,"boolean",Ws,"forest"),this.l=a)}},portFromPos:{configurable:!0,get:function(){return this.L},
set:function(a){this.L!==a&&(z(a,"number",Ws,"portFromPos"),this.L=a)}},portToPos:{configurable:!0,get:function(){return this.Ma},set:function(a){this.Ma!==a&&(z(a,"number",Ws,"portToPos"),this.Ma=a)}},portFromColOffset:{configurable:!0,get:function(){return this.w},set:function(a){this.w!==a&&(z(a,"number",Ws,"portFromColOffset"),this.w=a)}},portToColOffset:{configurable:!0,get:function(){return this.ca},set:function(a){this.ca!==a&&(z(a,"number",Ws,"portToColOffset"),
this.ca=a)}}});Ws.className="LayeredDigraphEdge";function Y(){0<arguments.length&&Da(Y);Oi.call(this);this.Ib=new H;this.To=Xs;this.ad=Ys;this.Kp=Zs;this.Tr=$s;this.ow=[];this.Zc=!0;this.Db=at;this.yd=(new Zb(10,10)).freeze();var a=new bt(this);this.V=new ct(a);this.W=new ct(a);this.Du=[]}ma(Y,Oi);
Y.prototype.cloneProtected=function(a){Oi.prototype.cloneProtected.call(this,a);a.To=this.To;a.Kp=this.Kp;a.Tr=this.Tr;a.Zc=this.Zc;a.Db=this.Db;a.yd.assign(this.yd);a.V.copyInheritedPropertiesFrom(this.V);a.W.copyInheritedPropertiesFrom(this.W)};
Y.prototype.hb=function(a){a.classType===Y?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):Oi.prototype.hb.call(this,a)};Y.prototype.createNetwork=function(){return new bt(this)};
Y.prototype.makeNetwork=function(a){function b(a){if(a instanceof V)return!a.isLinkLabel&&"Comment"!==a.category;if(a instanceof T){var b=a.fromNode;if(null===b||b.isLinkLabel||"Comment"===b.category)return!1;a=a.toNode;return null===a||a.isLinkLabel||"Comment"===a.category?!1:!0}return!1}var c=this.createNetwork();a instanceof P?(c.pg(a.nodes,!0,b),c.pg(a.links,!0,b)):a instanceof xg?c.pg(a.memberParts,!1,b):c.pg(a.iterator,!1,b);return c};
Y.prototype.doLayout=function(a){E&&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!==dt&&(this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin));var b=this.diagram;null===b&&a instanceof P&&(b=a);this.path===Xs&&null!==b?this.ad=b.isTreePathToChildren?Ys:et:this.ad=this.path===Xs?Ys:this.path;if(0<this.network.vertexes.count){this.network.Xp();
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.Ib.count){a=new H;for(b=this.Ib.iterator;b.next();){var c=b.value;c instanceof V?(c=this.network.Ni(c),null!==c&&a.add(c)):c instanceof ct&&a.add(c)}this.Ib=a}0===this.Ib.count&&this.findRoots();for(a=this.Ib.copy().iterator;a.next();)b=a.value,b.initialized||(b.initialized=!0,ft(this,b));b=this.network.vertexes;for(a=null;a=gt(b),0<a.count;)b=ht(this,a),null!==b&&this.Ib.add(b),
b.initialized=!0,ft(this,b),b=a;for(a=this.Ib.iterator;a.next();)b=a.value,b instanceof ct&&it(this,b);for(a=this.Ib.iterator;a.next();)b=a.value,b instanceof ct&&jt(this,b);for(a=this.Ib.iterator;a.next();)b=a.value,b instanceof ct&&kt(this,b);this.Ou();if(this.layerStyle===lt){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.ow=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===mt)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.Ib.iterator;a.next();)b=a.value,b instanceof ct&&this.layoutTree(b);this.arrangeTrees();this.updateParts()}this.network=null;this.Ib=new H;this.isValidLayout=!0};function gt(a){var b=new H;for(a=a.iterator;a.next();){var c=a.value;c.initialized||b.add(c)}return b}
Y.prototype.findRoots=function(){for(var a=this.network.vertexes,b=a.iterator;b.next();){var c=b.value;switch(this.ad){case Ys:0===c.sourceEdges.count&&this.Ib.add(c);break;case et:0===c.destinationEdges.count&&this.Ib.add(c);break;default:v("Unhandled path value "+this.ad.toString())}}0===this.Ib.count&&(a=ht(this,a),null!==a&&this.Ib.add(a))};
function ht(a,b){var c=999999,d=null;for(b=b.iterator;b.next();){var e=b.value;switch(a.ad){case Ys:e.sourceEdges.count<c&&(c=e.sourceEdges.count,d=e);break;case et:e.destinationEdges.count<c&&(c=e.destinationEdges.count,d=e);break;default:v("Unhandled path value "+a.ad.toString())}}return d}
function ft(a,b){if(null!==b){E&&w(b,ct,Y,"walkTree:v");switch(a.ad){case Ys:if(0<b.destinationEdges.count){for(var c=new F,d=b.destinationVertexes;d.next();){var e=d.value;nt(a,b,e)&&c.add(e)}0<c.count&&(b.children=c.Oa())}break;case et:if(0<b.sourceEdges.count){c=new F;for(d=b.sourceVertexes;d.next();)e=d.value,nt(a,b,e)&&c.add(e);0<c.count&&(b.children=c.Oa())}break;default:v("Unhandled path value"+a.ad.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.Ib.remove(f)}for(b=0;b<d;b++)ft(a,c[b])}}function nt(a,b,c){E&&w(b,ct,Y,"walkOK:v");E&&w(c,ct,Y,"walkOK:c");if(c.initialized){if(null===b)var d=!1;else{E&&w(c,ct,Y,"isAncestor:a");E&&w(b,ct,Y,"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}
Y.prototype.removeChild=function(a,b){if(null!==a&&null!==b){E&&w(a,ct,Y,"removeChild:p");E&&w(b,ct,Y,"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 it(a,b){if(null!==b){E&&w(b,ct,Y,"initializeTree:v");a.initializeTreeVertexValues(b);b.alignment===ot&&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];it(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 pt(a,b){E&&w(b,ct,Y,"mom:v");switch(a.Kp){default:case Zs:return null!==b.parent?b.parent:a.V;case qt:return null===b.parent?a.V:null===b.parent.parent?a.W:b.parent;case rt:return null!==b.parent?null!==b.parent.parent?b.parent.parent:a.W:a.V;case st: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.W:null!==b.parent?b.parent:a.V}}
Y.prototype.initializeTreeVertexValues=function(a){E&&w(a,ct,Y,"initializeTreeVertexValues:v");var b=pt(this,a);a.copyInheritedPropertiesFrom(b);if(null!==a.parent&&a.parent.alignment===ot){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 jt(a,b){if(null!==b){E&&w(b,ct,Y,"assignTree:v");a.assignTreeVertexValues(b);b=b.children;for(var c=b.length,d=0;d<c;d++)jt(a,b[d])}}Y.prototype.assignTreeVertexValues=function(){};function kt(a,b){if(null!==b){E&&w(b,ct,Y,"sortTree:v");b.alignment!==ot&&a.sortTreeVertexChildren(b);b=b.children;for(var c=b.length,d=0;d<c;d++)kt(a,b[d])}}
Y.prototype.sortTreeVertexChildren=function(a){E&&w(a,ct,Y,"sortTreeVertexChildren:v");switch(a.sorting){case tt:break;case ut:a.children.reverse();break;case vt:a.children.sort(a.comparer);break;case wt:a.children.sort(a.comparer);a.children.reverse();break;default:v("Unhandled sorting value "+a.sorting.toString())}};Y.prototype.Ou=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)};
Y.prototype.addComments=function(a){E&&w(a,ct,Y,"addComments:v");var b=a.angle,c=a.parent,d=0;var e=!1;null!==c&&(d=c.angle,e=c.alignment,e=xt(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.fv();l.next();){var m=l.value;"Comment"===m.category&&m.canLayout()&&(null===a.comments&&(a.comments=[]),a.comments.push(m),m.bc(),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 xt(a){return a===yt||a===ot||a===zt||a===At}function Bt(a){return a===yt||a===ot}
function Ct(a){E&&w(a,ct,Y,"isLeftSideBus:v");var b=a.parent;if(null!==b){var c=b.alignment;if(xt(c)){if(Bt(c)){b=b.children;for(c=0;c<b.length&&a!==b[c];)c++;return 0===c%2}if(c===zt)return!0}}return!1}
Y.prototype.layoutComments=function(a){E&&w(a,ct,Y,"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=xt(f));d=90===d||270===d;c=90===e||270===e;for(var g=0===a.childrenCount,h=Ct(a),k=0,l=a.comments,m=l.length,n=J.alloc(),p=0;p<m;p++){var q=l[p],r=q.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-r.width,a.bounds.y+k),q.move(n),q=q.ud();q.next();){var u=
q.value;u.fromSpot=Wd;u.toSpot=Xd}else for(n.h(a.bounds.x+2*a.focus.x-a.commentMargin,a.bounds.y+k),q.move(n),q=q.ud();q.next();)u=q.value,u.fromSpot=Xd,u.toSpot=Wd;else if(0<=a.commentMargin)for(n.h(a.bounds.x+2*a.focus.x+a.commentMargin,a.bounds.y+k),q.move(n),q=q.ud();q.next();)u=q.value,u.fromSpot=Xd,u.toSpot=Wd;else for(n.h(a.bounds.x+a.commentMargin-r.width,a.bounds.y+k),q.move(n),q=q.ud();q.next();)u=q.value,u.fromSpot=Wd,u.toSpot=Xd;k=0<=a.commentSpacing?k+(r.height+a.commentSpacing):k+(a.commentSpacing-
r.height)}else{if(135<e&&!f||!c&&h)if(0<=a.commentMargin)for(n.h(a.bounds.x+k,a.bounds.y-a.commentMargin-r.height),q.move(n),q=q.ud();q.next();)u=q.value,u.fromSpot=Vd,u.toSpot=de;else for(n.h(a.bounds.x+k,a.bounds.y+2*a.focus.y-a.commentMargin),q.move(n),q=q.ud();q.next();)u=q.value,u.fromSpot=de,u.toSpot=Vd;else if(0<=a.commentMargin)for(n.h(a.bounds.x+k,a.bounds.y+2*a.focus.y+a.commentMargin),q.move(n),q=q.ud();q.next();)u=q.value,u.fromSpot=de,u.toSpot=Vd;else for(n.h(a.bounds.x+k,a.bounds.y+
a.commentMargin-r.height),q.move(n),q=q.ud();q.next();)u=q.value,u.fromSpot=Vd,u.toSpot=de;k=0<=a.commentSpacing?k+(r.width+a.commentSpacing):k+(a.commentSpacing-r.width)}}J.free(n);b=k-a.commentSpacing-(d?b.height:b.width);if(this.ad===Ys)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)}};
Y.prototype.layoutTree=function(a){if(null!==a){E&&w(a,ct,Y,"layoutTree:v");for(var b=a.children,c=b.length,d=0;d<c;d++)this.layoutTree(b[d]);switch(a.compaction){case Dt:Et(this,a);break;case Ft:if(a.alignment===ot)Et(this,a);else if(E&&w(a,ct,Y,"layoutTreeBlock:v"),0===a.childrenCount)d=a.parent,c=!1,b=0,null!==d&&(b=d.angle,c=d.alignment,c=xt(c)),d=Ct(a),a.U.h(0,0),a.xa.h(a.width,a.height),null===a.parent||null===a.comments||(180!==b&&270!==b||c)&&!d?a.ka.h(0,0):180===b&&!c||(90===b||270===b)&&
d?a.ka.h(a.width-2*a.focus.x,0):a.ka.h(0,a.height-2*a.focus.y),a.mq=null,a.yq=null;else{var e=Gt(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.xa.width:d.xa.height);var k=a.alignment;d=k===Ht;var l=k===It,m=xt(k),n=Math.max(0,a.breadthLimit);c=Jt(a);var p=a.nodeSpacing,q=Mt(a),r=a.rowSpacing,u=0;if(d||l||a.zm||a.Am&&1===a.maxGenerationCount)u=Math.max(0,a.rowIndent);d=a.width;var x=a.height,y=0,A=0,C=0,G=null,I=null,O=0,R=0,Q=0,ea=0,Z=0,qa=0,xa=0,S=0;
m&&!Bt(k)&&135<e&&g.reverse();if(Bt(k))if(1<h)for(var aa=0;aa<h;aa++)0===aa%2&&aa!==h-1&&(S=Math.max(S,b?g[aa].xa.width:g[aa].xa.height));else 1===h&&(S=b?g[0].xa.width:g[0].xa.height);if(m){switch(k){case yt:A=135>e?Nt(a,g,S,y,A):Ot(a,g,S,y,A);S=A.x;y=A.width;A=A.height;break;case zt:for(G=0;G<h;G++)I=g[G],n=I.xa,C=0===qa?0:r,b?(I.U.h(f-n.width,ea+C),y=Math.max(y,n.width),A=Math.max(A,ea+C+n.height),ea+=C+n.height):(I.U.h(Q+C,f-n.height),y=Math.max(y,Q+C+n.width),A=Math.max(A,n.height),Q+=C+n.width),
qa++;break;case At:for(G=0;G<h;G++)I=g[G],f=I.xa,n=0===qa?0:r,b?(I.U.h(p/2+a.focus.x,ea+n),y=Math.max(y,f.width),A=Math.max(A,ea+n+f.height),ea+=n+f.height):(I.U.h(Q+n,p/2+a.focus.y),y=Math.max(y,Q+n+f.width),A=Math.max(A,f.height),Q+=n+f.width),qa++}G=Pt(this,2);I=Pt(this,2);b?(G[0].h(0,0),G[1].h(0,A),I[0].h(y,0)):(G[0].h(0,0),G[1].h(y,0),I[0].h(0,A));I[1].h(y,A)}else for(aa=0;aa<h;aa++){var Ga=g[aa],yb=Ga.xa;if(b){0<n&&0<qa&&Q+p+yb.width>n&&(Q<f&&Qt(a,k,f-Q,0,xa,aa-1),Z++,qa=0,xa=aa,C=A,Q=0,ea=
135<e?-A-r:A+r);Rt(this,Ga,0,ea);var Xa=0;if(0===qa){if(G=Ga.mq,I=Ga.yq,O=yb.width,R=yb.height,null===G||null===I||e!==Gt(Ga))G=Pt(this,2),I=Pt(this,2),G[0].h(0,0),G[1].h(0,R),I[0].h(O,0),I[1].h(O,R)}else{var Sa=Qa();R=St(this,a,Ga,G,I,O,R,Sa);Xa=R.x;G=Sa[0];I=Sa[1];O=R.width;R=R.height;Ta(Sa);Q<yb.width&&0>Xa&&(Tt(a,-Xa,0,xa,aa-1),Ut(G,-Xa,0),Ut(I,-Xa,0),Xa=0)}Ga.U.h(Xa,ea);y=Math.max(y,O);A=Math.max(A,C+(0===Z?0:r)+yb.height);Q=O}else{0<n&&0<qa&&ea+p+yb.height>n&&(ea<f&&Qt(a,k,0,f-ea,xa,aa-1),Z++,
qa=0,xa=aa,C=y,ea=0,Q=135<e?-y-r:y+r);Rt(this,Ga,Q,0);Xa=0;if(0===qa){if(G=Ga.mq,I=Ga.yq,O=yb.width,R=yb.height,null===G||null===I||e!==Gt(Ga))G=Pt(this,2),I=Pt(this,2),G[0].h(0,0),G[1].h(O,0),I[0].h(0,R),I[1].h(O,R)}else Sa=Qa(),R=St(this,a,Ga,G,I,O,R,Sa),Xa=R.x,G=Sa[0],I=Sa[1],O=R.width,R=R.height,Ta(Sa),ea<yb.height&&0>Xa&&(Tt(a,0,-Xa,xa,aa-1),Ut(G,0,-Xa),Ut(I,0,-Xa),Xa=0);Ga.U.h(Q,Xa);A=Math.max(A,R);y=Math.max(y,C+(0===Z?0:r)+yb.width);ea=R}qa++}0<Z&&(b?(A+=Math.max(0,c),Q<y&&Qt(a,k,y-Q,0,xa,
h-1),0<u&&(l||Tt(a,u,0,0,h-1),y+=u)):(y+=Math.max(0,c),ea<A&&Qt(a,k,0,A-ea,xa,h-1),0<u&&(l||Tt(a,0,u,0,h-1),A+=u)));u=l=0;switch(k){case Vt:b?l+=y/2-a.focus.x-q/2:u+=A/2-a.focus.y-q/2;break;case Wt:0<Z?b?l+=y/2-a.focus.x-q/2:u+=A/2-a.focus.y-q/2:b?(S=g[0].U.x+g[0].ka.x,l+=S+(g[h-1].U.x+g[h-1].ka.x+2*g[h-1].focus.x-S)/2-a.focus.x-q/2):(S=g[0].U.y+g[0].ka.y,u+=S+(g[h-1].U.y+g[h-1].ka.y+2*g[h-1].focus.y-S)/2-a.focus.y-q/2);break;case Ht:b?(l-=q,y+=q):(u-=q,A+=q);break;case It:b?(l+=y-a.width+q,y+=q):
(u+=A-a.height+q,A+=q);break;case yt:b?1<h?l+=S+p/2-a.focus.x:l+=g[0].focus.x-a.focus.x+g[0].ka.x:1<h?u+=S+p/2-a.focus.y:u+=g[0].focus.y-a.focus.y+g[0].ka.y;break;case zt:b?l+=y+p/2-a.focus.x:u+=A+p/2-a.focus.y;break;case At:break;default:v("Unhandled alignment value "+k.toString())}for(q=0;q<h;q++)S=g[q],b?S.U.h(S.U.x+S.ka.x-l,S.U.y+(135<e?(m?-A:-S.xa.height)+S.ka.y-c:x+c+S.ka.y)):S.U.h(S.U.x+(135<e?(m?-y:-S.xa.width)+S.ka.x-c:d+c+S.ka.x),S.U.y+S.ka.y-u);h=g=0;m?b?(y=Xt(a,y,l),0>l&&(l=0),135<e&&
(u+=A+c),A+=x+c,k===At&&(g+=p/2+a.focus.x),h+=x+c):(135<e&&(l+=y+c),y+=d+c,A=Yt(a,A,u),0>u&&(u=0),k===At&&(h+=p/2+a.focus.y),g+=d+c):b?(null===a.comments?d>y&&(y=Zt(k,d-y,0),g=y.x,h=y.y,y=d,l=0):y=Xt(a,y,l),0>l&&(g-=l,l=0),135<e&&(u+=A+c),A=Math.max(Math.max(A,x),A+x+c),h+=x+c):(135<e&&(l+=y+c),y=Math.max(Math.max(y,d),y+d+c),null===a.comments?x>A&&(A=Zt(k,0,x-A),g=A.x,h=A.y,A=x,u=0):A=Yt(a,A,u),0>u&&(h-=u,u=0),g+=d+c);if(0<Z)e=Pt(this,4),Z=Pt(this,4),b?(e[2].h(0,x+c),e[3].h(e[2].x,A),Z[2].h(y,e[2].y),
Z[3].h(Z[2].x,e[3].y)):(e[2].h(d+c,0),e[3].h(y,e[2].y),Z[2].h(e[2].x,A),Z[3].h(e[3].x,Z[2].y));else{e=Pt(this,G.length+2);Z=Pt(this,I.length+2);for(k=0;k<G.length;k++)m=G[k],e[k+2].h(m.x+g,m.y+h);for(k=0;k<I.length;k++)m=I[k],Z[k+2].h(m.x+g,m.y+h)}b?(e[0].h(l,0),e[1].h(e[0].x,x),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])),Z[0].h(l+d,0),Z[1].h(Z[0].x,x),Z[2].y<Z[1].y&&(Z[2].x<Z[0].x?Z[2].assign(Z[1]):Z[1].assign(Z[2])),
Z[3].y<Z[2].y&&(Z[3].x<Z[0].x?Z[3].assign(Z[2]):Z[2].assign(Z[3])),e[2].y-=c/2,Z[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])),Z[0].h(0,u+x),Z[1].h(d,Z[0].y),Z[2].x<Z[1].x&&(Z[2].y<Z[0].y?Z[2].assign(Z[1]):Z[1].assign(Z[2])),Z[3].x<Z[2].x&&(Z[3].y<Z[0].y?Z[3].assign(Z[2]):Z[2].assign(Z[3])),e[2].x-=c/2,Z[2].x-=c/2);$t(this,G);$t(this,I);a.mq=e;a.yq=Z;a.ka.h(l,u);a.xa.h(y,
A)}break;default:v("Unhandled compaction value "+a.compaction.toString())}}};
function Et(a,b){E&&w(b,ct,Y,"layoutTreeNone:v");if(0===b.childrenCount){var c=!1,d=0;null!==b.parent&&(d=b.parent.angle,c=b.parent.alignment,c=xt(c));var e=Ct(b);b.U.h(0,0);b.xa.h(b.width,b.height);null===b.parent||null===b.comments||(180!==d&&270!==d||c)&&!e?b.ka.h(0,0):180===d&&!c||(90===d||270===d)&&e?b.ka.h(b.width-2*b.focus.x,0):b.ka.h(0,b.height-2*b.focus.y)}else{d=Gt(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.xa.width:k.xa.height)}var l=
b.alignment,m=l===Ht,n=l===It;h=xt(l);var p=Math.max(0,b.breadthLimit);k=Jt(b);var q=b.nodeSpacing,r=Mt(b),u=m||n?0:r/2,x=b.rowSpacing,y=0;if(m||n||b.zm||b.Am&&1===b.maxGenerationCount)y=Math.max(0,b.rowIndent);m=b.width;var A=b.height,C=0,G=0,I=0,O=0,R=0,Q=0,ea=0,Z=0,qa=0,xa=0;h&&!Bt(l)&&135<d&&e.reverse();if(Bt(l))if(1<g)for(var S=0;S<g;S++){var aa=e[S],Ga=aa.xa;0===S%2&&S!==g-1?qa=Math.max(qa,(c?Ga.width:Ga.height)+au(aa)-q):0!==S%2&&(xa=Math.max(xa,(c?Ga.width:Ga.height)+au(aa)-q))}else 1===g&&
(qa=c?e[0].xa.width:e[0].xa.height);if(h)switch(l){case yt:case ot:G=135>d?Nt(b,e,qa,C,G):Ot(b,e,qa,C,G);qa=G.x;C=G.width;G=G.height;break;case zt:for(a=0;a<g;a++)p=e[a],u=p.xa,I=0===ea?0:x,c?(p.U.h(f-u.width,R+I),C=Math.max(C,u.width),G=Math.max(G,R+I+u.height),R+=I+u.height):(p.U.h(O+I,f-u.height),C=Math.max(C,O+I+u.width),G=Math.max(G,u.height),O+=I+u.width),ea++;break;case At:for(f=0;f<g;f++)a=e[f],p=a.xa,u=0===ea?0:x,c?(a.U.h(q/2+b.focus.x,R+u),C=Math.max(C,p.width),G=Math.max(G,R+u+p.height),
R+=u+p.height):(a.U.h(O+u,q/2+b.focus.y),C=Math.max(C,O+u+p.width),G=Math.max(G,p.height),O+=u+p.width),ea++}else for(xa=0;xa<g;xa++)S=e[xa],aa=S.xa,c?(0<p&&0<ea&&O+q+aa.width>p&&(O<f&&Qt(b,l,f-O,0,Z,xa-1),Q++,ea=0,Z=xa,I=G,O=0,R=135<d?-G-x:G+x),Ga=0===ea?u:q,Rt(a,S,0,R),S.U.h(O+Ga,R),C=Math.max(C,O+Ga+aa.width),G=Math.max(G,I+(0===Q?0:x)+aa.height),O+=Ga+aa.width):(0<p&&0<ea&&R+q+aa.height>p&&(R<f&&Qt(b,l,0,f-R,Z,xa-1),Q++,ea=0,Z=xa,I=C,R=0,O=135<d?-C-x:C+x),Ga=0===ea?u:q,Rt(a,S,O,0),S.U.h(O,R+Ga),
G=Math.max(G,R+Ga+aa.height),C=Math.max(C,I+(0===Q?0:x)+aa.width),R+=Ga+aa.height),ea++;0<Q&&(c?(G+=Math.max(0,k),O<C&&Qt(b,l,C-O,0,Z,g-1),0<y&&(n||Tt(b,y,0,0,g-1),C+=y)):(C+=Math.max(0,k),R<G&&Qt(b,l,0,G-R,Z,g-1),0<y&&(n||Tt(b,0,y,0,g-1),G+=y)));y=n=0;switch(l){case Vt:c?n+=C/2-b.focus.x-r/2:y+=G/2-b.focus.y-r/2;break;case Wt:0<Q?c?n+=C/2-b.focus.x-r/2:y+=G/2-b.focus.y-r/2:c?(l=e[0].U.x+e[0].ka.x,n+=l+(e[g-1].U.x+e[g-1].ka.x+2*e[g-1].focus.x-l)/2-b.focus.x-r/2):(l=e[0].U.y+e[0].ka.y,y+=l+(e[g-1].U.y+
e[g-1].ka.y+2*e[g-1].focus.y-l)/2-b.focus.y-r/2);break;case Ht:c?(n-=r,C+=r):(y-=r,G+=r);break;case It:c?(n+=C-b.width+r,C+=r):(y+=G-b.height+r,G+=r);break;case yt:case ot:c?1<g?n+=qa+q/2-b.focus.x:n+=e[0].focus.x-b.focus.x+e[0].ka.x:1<g?y+=qa+q/2-b.focus.y:y+=e[0].focus.y-b.focus.y+e[0].ka.y;break;case zt:c?n+=C+q/2-b.focus.x:y+=G+q/2-b.focus.y;break;case At:break;default:v("Unhandled alignment value "+l.toString())}for(r=0;r<g;r++)l=e[r],c?l.U.h(l.U.x+l.ka.x-n,l.U.y+(135<d?(h?-G:-l.xa.height)+l.ka.y-
k:A+k+l.ka.y)):l.U.h(l.U.x+(135<d?(h?-C:-l.xa.width)+l.ka.x-k:m+k+l.ka.x),l.U.y+l.ka.y-y);c?(C=Xt(b,C,n),0>n&&(n=0),135<d&&(y+=G+k),G+=A+k):(135<d&&(n+=C+k),C+=m+k,G=Yt(b,G,y),0>y&&(y=0));b.ka.h(n,y);b.xa.h(C,G)}}
function Nt(a,b,c,d,e){E&&w(a,ct,Y,"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.xa.width,e=a.xa.height,new L(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=90===Gt(a),l=0,m=0,n=0,p=0;p<f;p++)if(!(0!==p%2||1<f&&p===f-1)){var q=b[p],r=q.xa,u=0===l?0:h;if(k){var x=au(q)-g;q.U.h(c-(r.width+x),n+u);d=Math.max(d,r.width+x);e=Math.max(e,n+u+r.height);n+=u+r.height}else x=au(q)-g,q.U.h(m+u,c-(r.height+x)),e=Math.max(e,r.height+x),d=Math.max(d,m+
u+r.width),m+=u+r.width;l++}l=0;q=m;p=n;k?(m=c+g,n=0):(m=0,n=c+g);for(r=0;r<f;r++)if(0!==r%2){u=b[r];x=u.xa;var y=0===l?0:h;if(k){var A=au(u)-g;u.U.h(m+A,n+y);d=Math.max(d,m+x.width+A);e=Math.max(e,n+y+x.height);n+=y+x.height}else A=au(u)-g,u.U.h(m+y,n+A),d=Math.max(d,m+y+x.width),e=Math.max(e,n+x.height+A),m+=y+x.width;l++}1<f&&1===f%2&&(b=b[f-1],f=b.xa,h=bu(b),k?(b.U.h(c+g/2-b.focus.x-b.ka.x,e+h),k=c+g/2-b.focus.x-b.ka.x,d=Math.max(d,k+f.width),0>k&&(d-=k),e=Math.max(e,Math.max(p,n)+h+f.height),
0>b.U.x&&(c=cu(a,b.U.x,!1,c,g))):(b.U.h(d+h,c+g/2-b.focus.y-b.ka.y),d=Math.max(d,Math.max(q,m)+h+f.width),n=c+g/2-b.focus.y-b.ka.y,e=Math.max(e,n+f.height),0>n&&(e-=n),0>b.U.y&&(c=cu(a,b.U.y,!0,c,g))));return new L(c,0,d,e)}
function Ot(a,b,c,d,e){E&&w(a,ct,Y,"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.xa.width,e=b.xa.height,new L(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=270===Gt(a),l=0,m=0,n=0,p=0;p<f;p++)if(!(0!==p%2||1<f&&p===f-1)){var q=b[p],r=q.xa,u=0===l?0:h;if(k){var x=au(q)-g;n-=u+r.height;q.U.h(c-(r.width+x),n);d=Math.max(d,r.width+x);e=Math.max(e,Math.abs(n))}else x=au(q)-g,m-=u+r.width,q.U.h(m,c-(r.height+x)),e=Math.max(e,r.height+x),d=Math.max(d,
Math.abs(m));l++}l=0;q=m;p=n;k?(m=c+g,n=0):(m=0,n=c+g);for(r=0;r<f;r++)if(0!==r%2){u=b[r];x=u.xa;var y=0===l?0:h;if(k){var A=au(u)-g;n-=y+x.height;u.U.h(m+A,n);d=Math.max(d,m+x.width+A);e=Math.max(e,Math.abs(n))}else A=au(u)-g,m-=y+x.width,u.U.h(m,n+A),e=Math.max(e,n+x.height+A),d=Math.max(d,Math.abs(m));l++}1<f&&1===f%2&&(h=b[f-1],l=h.xa,r=bu(h),k?(h.U.h(c+g/2-h.focus.x-h.ka.x,-e-l.height-r),m=c+g/2-h.focus.x-h.ka.x,d=Math.max(d,m+l.width),0>m&&(d-=m),e=Math.max(e,Math.abs(Math.min(p,n))+r+l.height),
0>h.U.x&&(c=cu(a,h.U.x,!1,c,g))):(h.U.h(-d-l.width-r,c+g/2-h.focus.y-h.ka.y),d=Math.max(d,Math.abs(Math.min(q,m))+r+l.width),n=c+g/2-h.focus.y-h.ka.y,e=Math.max(e,n+l.height),0>n&&(e-=n),0>h.U.y&&(c=cu(a,h.U.y,!0,c,g))));for(a=0;a<f;a++)g=b[a],k?g.U.h(g.U.x,g.U.y+e):g.U.h(g.U.x+d,g.U.y);return new L(c,0,d,e)}function au(a){E&&w(a,ct,Y,"fixRelativePostions:child");return null===a.parent?0:a.parent.nodeSpacing}
function bu(a){E&&w(a,ct,Y,"fixRelativePostions:lastchild");return null===a.parent?0:a.parent.rowSpacing}function cu(a,b,c,d,e){E&&w(a,ct,Y,"fixRelativePostions:v");a=a.children;for(var f=a.length,g=0;g<f;g++)c?a[g].U.h(a[g].U.x,a[g].U.y-b):a[g].U.h(a[g].U.x-b,a[g].U.y);b=a[f-1];return Math.max(d,c?b.ka.y+b.focus.y-e/2:b.ka.x+b.focus.x-e/2)}
function Xt(a,b,c){E&&w(a,ct,Y,"calculateSubwidth:v");switch(a.alignment){case Wt:case Vt:return c+a.width>b&&(b=c+a.width),0>c&&(b-=c),b;case Ht:return a.width>b?a.width:b;case It:return 2*a.focus.x>b?a.width:b+a.width-2*a.focus.x;case yt:case ot:return Math.max(a.width,Math.max(b,c+a.width)-Math.min(0,c));case zt:return a.width-a.focus.x+a.nodeSpacing/2+b;case At:return Math.max(a.width,a.focus.x+a.nodeSpacing/2+b);default:return b}}
function Yt(a,b,c){E&&w(a,ct,Y,"calculateSubheight:v");switch(a.alignment){case Wt:case Vt:return c+a.height>b&&(b=c+a.height),0>c&&(b-=c),b;case Ht:return a.height>b?a.height:b;case It:return 2*a.focus.y>b?a.height:b+a.height-2*a.focus.y;case yt:case ot:return Math.max(a.height,Math.max(b,c+a.height)-Math.min(0,c));case zt:return a.height-a.focus.y+a.nodeSpacing/2+b;case At:return Math.max(a.height,a.focus.y+a.nodeSpacing/2+b);default:return b}}
function Zt(a,b,c){E&&w(a,D,Y,"alignOffset:align");switch(a){case Vt:b/=2;c/=2;break;case Wt:b/=2;c/=2;break;case Ht:c=b=0;break;case It:break;default:v("Unhandled alignment value "+a.toString())}return new J(b,c)}function Qt(a,b,c,d,e,f){E&&w(a,ct,Y,"shiftRelPosAlign:v");E&&w(b,D,Y,"shiftRelPosAlign:align");b=Zt(b,c,d);Tt(a,b.x,b.y,e,f)}function Tt(a,b,c,d,e){E&&w(a,ct,Y,"shiftRelPos:v");if(0!==b||0!==c)for(a=a.children;d<=e;d++){var f=a[d].U;f.x+=b;f.y+=c}}
function Rt(a,b,c,d){E&&(w(b,ct,Y,"recordMidPoints:v"),z(c,"number",Y,"recordMidPoints:x"),z(d,"number",Y,"recordMidPoints:y"));var e=b.parent;switch(a.ad){case Ys:for(a=b.sourceEdges;a.next();)b=a.value,b.fromVertex===e&&b.relativePoint.h(c,d);break;case et:for(a=b.destinationEdges;a.next();)b=a.value,b.toVertex===e&&b.relativePoint.h(c,d);break;default:v("Unhandled path value "+a.ad.toString())}}function Ut(a,b,c){for(var d=0;d<a.length;d++){var e=a[d];e.x+=b;e.y+=c}}
function St(a,b,c,d,e,f,g,h){E&&w(b,ct,Y,"mergeFringes:parent");E&&w(c,ct,Y,"mergeFringes:child");var k=Gt(b),l=90===k||270===k,m=b.nodeSpacing;b=d;var n=e;d=f;var p=g,q=c.mq,r=c.yq;g=c.xa;var u=l?Math.max(p,g.height):Math.max(d,g.width);if(null===q||k!==Gt(c))q=Pt(a,2),r=Pt(a,2),l?(q[0].h(0,0),q[1].h(0,g.height),r[0].h(g.width,0),r[1].h(r[0].x,q[1].y)):(q[0].h(0,0),q[1].h(g.width,0),r[0].h(0,g.height),r[1].h(q[1].x,r[0].y));if(l){p=9999999;if(!(null===n||2>n.length||null===q||2>q.length))for(e=c=
0;c<n.length&&e<q.length;){f=n[c];var x=q[e];k=x.x;l=x.y;k+=d;var y=f;c+1<n.length&&(y=n[c+1]);var A=x;x=A.x;A=A.y;e+1<q.length&&(A=q[e+1],x=A.x,A=A.y,x+=d);var C=p;f.y===l?C=k-f.x:f.y>l&&f.y<A?C=k+(f.y-l)/(A-l)*(x-k)-f.x:l>f.y&&l<y.y&&(C=k-(f.x+(l-f.y)/(y.y-f.y)*(y.x-f.x)));C<p&&(p=C);y.y<=f.y?c++:A<=l?e++:(y.y<=A&&c++,A<=y.y&&e++)}p=d-p;p+=m;c=q;e=p;if(null===b||2>b.length||null===c||2>c.length)d=null;else{m=Pt(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=Pt(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);$t(a,m);d=c}f=r;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=Pt(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=Pt(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);$t(a,m);e=f}f=Math.max(0,p)+g.width;g=u;$t(a,b);$t(a,q);$t(a,n);$t(a,r);h[0]=d;h[1]=e;return new L(p,0,f,g)}d=9999999;if(!(null===n||2>n.length||null===q||2>q.length))for(e=c=0;c<n.length&&e<q.length;)f=n[c],x=q[e],k=x.x,l=x.y,l+=p,y=f,c+1<n.length&&(y=n[c+1]),A=x,x=A.x,A=A.y,e+1<q.length&&(A=q[e+1],x=A.x,A=A.y,A+=p),C=d,f.x===k?C=l-f.y:f.x>k&&f.x<x?C=l+(f.x-k)/(x-k)*(A-l)-f.y:k>f.x&&k<y.x&&(C=l-(f.y+(k-f.x)/(y.x-f.x)*(y.y-f.y))),C<d&&(d=C),y.x<=f.x?
c++:x<=k?e++:(y.x<=x&&c++,x<=y.x&&e++);p-=d;p+=m;c=q;e=p;if(null===b||2>b.length||null===c||2>c.length)d=null;else{m=Pt(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=Pt(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);$t(a,m);d=c}f=r;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=Pt(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=Pt(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);$t(a,m);e=f}f=u;g=Math.max(0,p)+g.height;$t(a,b);$t(a,q);$t(a,n);$t(a,r);h[0]=d;h[1]=e;return new L(p,0,f,g)}function Pt(a,b){a=a.Du[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 $t(a,b){var c=b.length,d=a.Du[c];void 0===d&&(d=[],a.Du[c]=d);d.push(b)}
Y.prototype.arrangeTrees=function(){if(this.Db===dt)for(var a=this.Ib.iterator;a.next();){var b=a.value;if(b instanceof ct){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);du(this,b,c,d)}}}else{a=[];for(b=this.Ib.iterator;b.next();)c=b.value,c instanceof ct&&a.push(c);switch(this.sorting){case tt:break;case ut:a.reverse();break;case vt:a.sort(this.comparer);break;case wt: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];du(this,e,b+e.ka.x,c+e.ka.y);switch(this.Db){case at:c+=e.xa.height+this.yd.height;break;case eu:b+=e.xa.width+this.yd.width;break;default:v("Unhandled arrangement value "+this.Db.toString())}}}};function du(a,b,c,d){if(null!==b){E&&w(b,ct,Y,"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];du(a,g,c+g.U.x,d+g.U.y)}}}
Y.prototype.commitLayout=function(){this.Rv();this.commitNodes();this.Tu();this.isRouting&&this.commitLinks()};Y.prototype.commitNodes=function(){for(var a=this.network.vertexes.iterator;a.next();)a.value.commit();for(a.reset();a.next();)this.layoutComments(a.value)};
Y.prototype.Tu=function(){if(this.layerStyle===lt){for(var a=this.ow,b=[],c=null,d=this.network.vertexes.iterator;d.next();){var e=d.value;null===c?c=e.bounds.copy():c.Lc(e.bounds);var f=b[e.level];void 0===f?f=Jt(e):f=Math.max(f,Jt(e));b[e.level]=f}for(d=0;d<b.length;d++)void 0===b[d]&&(b[d]=0);90===this.angle||270===this.angle?(c.Xc(this.nodeSpacing/2,this.layerSpacing),d=new J(-this.nodeSpacing/2,-this.layerSpacing/2)):(c.Xc(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)}};Y.prototype.commitLayers=function(){};Y.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};
Y.prototype.Rv=function(){for(var a=this.Ib.iterator;a.next();){var b=a.value;b instanceof ct&&fu(this,b)}};function fu(a,b){if(null!==b){E&&w(b,ct,Y,"setPortSpotsTree:v");a.setPortSpots(b);b=b.children;for(var c=b.length,d=0;d<c;d++)fu(a,b[d])}}
Y.prototype.setPortSpots=function(a){E&&w(a,ct,Y,"setPortSpots:v");var b=a.alignment;if(xt(b)){E&&w(a,ct,Y,"setPortSpotsBus:v");E&&w(b,D,Y,"setPortSpots:align");var c=this.ad===Ys,d=Gt(a);switch(d){case 0:var e=Xd;break;case 90:e=de;break;case 180:e=Wd;break;default:e=Vd}var f=a.children,g=f.length;switch(b){case yt:case ot: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?Wd:Vd;if(1===g||b===g-1&&1===g%2)switch(d){case 0:k=
Wd;break;case 90:k=Vd;break;case 180:k=Xd;break;default:k=de}else 0===b%2&&(k=90===d||270===d?Xd:de);c?(a.setsPortSpot&&(h.fromSpot=e),a.setsChildPortSpot&&(h.toSpot=k)):(a.setsPortSpot&&(h.fromSpot=k),a.setsChildPortSpot&&(h.toSpot=e))}}break;case zt:d=90===d||270===d?Xd:de;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 At:for(d=
90===d||270===d?Wd:Vd,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=Gt(a),this.ad===Ys)for(e=a.destinationEdges;e.next();){if(d=e.value.link,null!==d){if(a.setsPortSpot)if(a.portSpot.Cb())switch(c){case 0:d.fromSpot=Xd;break;case 90:d.fromSpot=de;break;case 180:d.fromSpot=Wd;break;default:d.fromSpot=Vd}else d.fromSpot=a.portSpot;
if(a.setsChildPortSpot)if(a.childPortSpot.Cb())switch(c){case 0:d.toSpot=Wd;break;case 90:d.toSpot=Vd;break;case 180:d.toSpot=Xd;break;default:d.toSpot=de}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.Cb())switch(c){case 0:d.toSpot=Xd;break;case 90:d.toSpot=de;break;case 180:d.toSpot=Wd;break;default:d.toSpot=Vd}else d.toSpot=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.Cb())switch(c){case 0:d.fromSpot=Wd;break;
case 90:d.fromSpot=Vd;break;case 180:d.fromSpot=Xd;break;default:d.fromSpot=de}else d.fromSpot=a.childPortSpot}};function Gt(a){a=a.angle;return 45>=a?0:135>=a?90:225>=a?180:315>=a?270:0}function Jt(a){E&&w(a,ct,Y,"computeLayerSpacing:v");var b=Gt(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 Mt(a){E&&w(a,ct,Y,"computeNodeIndent:v");var b=Gt(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)}
na.Object.defineProperties(Y.prototype,{roots:{configurable:!0,get:function(){return this.Ib},set:function(a){this.Ib!==a&&(w(a,H,Y,"roots"),this.Ib=a,this.C())}},path:{configurable:!0,get:function(){return this.To},set:function(a){this.To!==a&&(tb(a,Y,Y,"path"),this.To=a,this.C())}},treeStyle:{configurable:!0,get:function(){return this.Kp},set:function(a){this.Db!==a&&(tb(a,Y,Y,"treeStyle"),a===Zs||a===rt||a===st||a===qt)&&(this.Kp=a,this.C())}},layerStyle:{configurable:!0,
enumerable:!0,get:function(){return this.Tr},set:function(a){this.Db!==a&&(tb(a,Y,Y,"layerStyle"),a===$s||a===mt||a===lt)&&(this.Tr=a,this.C())}},comments:{configurable:!0,get:function(){return this.Zc},set:function(a){this.Zc!==a&&(z(a,"boolean",Y,"comments"),this.Zc=a,this.C())}},arrangement:{configurable:!0,get:function(){return this.Db},set:function(a){this.Db!==a&&(tb(a,Y,Y,"arrangement"),a===at||a===eu||a===dt)&&(this.Db=a,this.C())}},arrangementSpacing:{configurable:!0,
enumerable:!0,get:function(){return this.yd},set:function(a){w(a,Zb,Y,"arrangementSpacing");this.yd.A(a)||(this.yd.assign(a),this.C())}},rootDefaults:{configurable:!0,get:function(){return this.V},set:function(a){this.V!==a&&(w(a,ct,Y,"rootDefaults"),this.V=a,this.C())}},alternateDefaults:{configurable:!0,get:function(){return this.W},set:function(a){this.W!==a&&(w(a,ct,Y,"alternateDefaults"),this.W=a,this.C())}},sorting:{configurable:!0,get:function(){return this.V.sorting},
set:function(a){this.V.sorting!==a&&(tb(a,Y,Y,"sorting"),a===tt||a===ut||a===vt||wt)&&(this.V.sorting=a,this.C())}},comparer:{configurable:!0,get:function(){return this.V.comparer},set:function(a){this.V.comparer!==a&&(z(a,"function",Y,"comparer"),this.V.comparer=a,this.C())}},angle:{configurable:!0,get:function(){return this.V.angle},set:function(a){this.V.angle!==a&&(z(a,"number",Y,"angle"),0===a||90===a||180===a||270===a?(this.V.angle=a,this.C()):v("TreeLayout.angle must be 0, 90, 180, or 270"))}},
alignment:{configurable:!0,get:function(){return this.V.alignment},set:function(a){this.V.alignment!==a&&(tb(a,Y,Y,"alignment"),this.V.alignment=a,this.C())}},nodeIndent:{configurable:!0,get:function(){return this.V.nodeIndent},set:function(a){this.V.nodeIndent!==a&&(z(a,"number",Y,"nodeIndent"),0<=a&&(this.V.nodeIndent=a,this.C()))}},nodeIndentPastParent:{configurable:!0,get:function(){return this.V.nodeIndentPastParent},set:function(a){this.V.nodeIndentPastParent!==
a&&(z(a,"number",Y,"nodeIndentPastParent"),0<=a&&1>=a&&(this.V.nodeIndentPastParent=a,this.C()))}},nodeSpacing:{configurable:!0,get:function(){return this.V.nodeSpacing},set:function(a){this.V.nodeSpacing!==a&&(z(a,"number",Y,"nodeSpacing"),this.V.nodeSpacing=a,this.C())}},layerSpacing:{configurable:!0,get:function(){return this.V.layerSpacing},set:function(a){this.V.layerSpacing!==a&&(z(a,"number",Y,"layerSpacing"),this.V.layerSpacing=a,this.C())}},layerSpacingParentOverlap:{configurable:!0,
enumerable:!0,get:function(){return this.V.layerSpacingParentOverlap},set:function(a){this.V.layerSpacingParentOverlap!==a&&(z(a,"number",Y,"layerSpacingParentOverlap"),0<=a&&1>=a&&(this.V.layerSpacingParentOverlap=a,this.C()))}},compaction:{configurable:!0,get:function(){return this.V.compaction},set:function(a){this.V.compaction!==a&&(tb(a,Y,Y,"compaction"),a===Dt||a===Ft)&&(this.V.compaction=a,this.C())}},breadthLimit:{configurable:!0,get:function(){return this.V.breadthLimit},
set:function(a){this.V.breadthLimit!==a&&(z(a,"number",Y,"breadthLimit"),0<=a&&(this.V.breadthLimit=a,this.C()))}},rowSpacing:{configurable:!0,get:function(){return this.V.rowSpacing},set:function(a){this.V.rowSpacing!==a&&(z(a,"number",Y,"rowSpacing"),this.V.rowSpacing=a,this.C())}},rowIndent:{configurable:!0,get:function(){return this.V.rowIndent},set:function(a){this.V.rowIndent!==a&&(z(a,"number",Y,"rowIndent"),0<=a&&(this.V.rowIndent=a,this.C()))}},commentSpacing:{configurable:!0,
enumerable:!0,get:function(){return this.V.commentSpacing},set:function(a){this.V.commentSpacing!==a&&(z(a,"number",Y,"commentSpacing"),this.V.commentSpacing=a,this.C())}},commentMargin:{configurable:!0,get:function(){return this.V.commentMargin},set:function(a){this.V.commentMargin!==a&&(z(a,"number",Y,"commentMargin"),this.V.commentMargin=a,this.C())}},setsPortSpot:{configurable:!0,get:function(){return this.V.setsPortSpot},set:function(a){this.V.setsPortSpot!==a&&(z(a,
"boolean",Y,"setsPortSpot"),this.V.setsPortSpot=a,this.C())}},portSpot:{configurable:!0,get:function(){return this.V.portSpot},set:function(a){w(a,M,Y,"portSpot");this.V.portSpot.A(a)||(this.V.portSpot=a,this.C())}},setsChildPortSpot:{configurable:!0,get:function(){return this.V.setsChildPortSpot},set:function(a){this.V.setsChildPortSpot!==a&&(z(a,"boolean",Y,"setsChildPortSpot"),this.V.setsChildPortSpot=a,this.C())}},childPortSpot:{configurable:!0,get:function(){return this.V.childPortSpot},
set:function(a){w(a,M,Y,"childPortSpot");this.V.childPortSpot.A(a)||(this.V.childPortSpot=a,this.C())}},alternateSorting:{configurable:!0,get:function(){return this.W.sorting},set:function(a){this.W.sorting!==a&&(tb(a,Y,Y,"alternateSorting"),a===tt||a===ut||a===vt||wt)&&(this.W.sorting=a,this.C())}},alternateComparer:{configurable:!0,get:function(){return this.W.comparer},set:function(a){this.W.comparer!==a&&(z(a,"function",Y,"alternateComparer"),this.W.comparer=a,this.C())}},
alternateAngle:{configurable:!0,get:function(){return this.W.angle},set:function(a){this.W.angle!==a&&(z(a,"number",Y,"alternateAngle"),0===a||90===a||180===a||270===a)&&(this.W.angle=a,this.C())}},alternateAlignment:{configurable:!0,get:function(){return this.W.alignment},set:function(a){this.W.alignment!==a&&(tb(a,Y,Y,"alternateAlignment"),this.W.alignment=a,this.C())}},alternateNodeIndent:{configurable:!0,get:function(){return this.W.nodeIndent},set:function(a){this.W.nodeIndent!==
a&&(z(a,"number",Y,"alternateNodeIndent"),0<=a&&(this.W.nodeIndent=a,this.C()))}},alternateNodeIndentPastParent:{configurable:!0,get:function(){return this.W.nodeIndentPastParent},set:function(a){this.W.nodeIndentPastParent!==a&&(z(a,"number",Y,"alternateNodeIndentPastParent"),0<=a&&1>=a&&(this.W.nodeIndentPastParent=a,this.C()))}},alternateNodeSpacing:{configurable:!0,get:function(){return this.W.nodeSpacing},set:function(a){this.W.nodeSpacing!==a&&(z(a,"number",Y,"alternateNodeSpacing"),
this.W.nodeSpacing=a,this.C())}},alternateLayerSpacing:{configurable:!0,get:function(){return this.W.layerSpacing},set:function(a){this.W.layerSpacing!==a&&(z(a,"number",Y,"alternateLayerSpacing"),this.W.layerSpacing=a,this.C())}},alternateLayerSpacingParentOverlap:{configurable:!0,get:function(){return this.W.layerSpacingParentOverlap},set:function(a){this.W.layerSpacingParentOverlap!==a&&(z(a,"number",Y,"alternateLayerSpacingParentOverlap"),0<=a&&1>=a&&(this.W.layerSpacingParentOverlap=
a,this.C()))}},alternateCompaction:{configurable:!0,get:function(){return this.W.compaction},set:function(a){this.W.compaction!==a&&(tb(a,Y,Y,"alternateCompaction"),a===Dt||a===Ft)&&(this.W.compaction=a,this.C())}},alternateBreadthLimit:{configurable:!0,get:function(){return this.W.breadthLimit},set:function(a){this.W.breadthLimit!==a&&(z(a,"number",Y,"alternateBreadthLimit"),0<=a&&(this.W.breadthLimit=a,this.C()))}},alternateRowSpacing:{configurable:!0,get:function(){return this.W.rowSpacing},
set:function(a){this.W.rowSpacing!==a&&(z(a,"number",Y,"alternateRowSpacing"),this.W.rowSpacing=a,this.C())}},alternateRowIndent:{configurable:!0,get:function(){return this.W.rowIndent},set:function(a){this.W.rowIndent!==a&&(z(a,"number",Y,"alternateRowIndent"),0<=a&&(this.W.rowIndent=a,this.C()))}},alternateCommentSpacing:{configurable:!0,get:function(){return this.W.commentSpacing},set:function(a){this.W.commentSpacing!==a&&(z(a,"number",Y,"alternateCommentSpacing"),
this.W.commentSpacing=a,this.C())}},alternateCommentMargin:{configurable:!0,get:function(){return this.W.commentMargin},set:function(a){this.W.commentMargin!==a&&(z(a,"number",Y,"alternateCommentMargin"),this.W.commentMargin=a,this.C())}},alternateSetsPortSpot:{configurable:!0,get:function(){return this.W.setsPortSpot},set:function(a){this.W.setsPortSpot!==a&&(z(a,"boolean",Y,"alternateSetsPortSpot"),this.W.setsPortSpot=a,this.C())}},alternatePortSpot:{configurable:!0,
enumerable:!0,get:function(){return this.W.portSpot},set:function(a){w(a,M,Y,"alternatePortSpot");this.W.portSpot.A(a)||(this.W.portSpot=a,this.C())}},alternateSetsChildPortSpot:{configurable:!0,get:function(){return this.W.setsChildPortSpot},set:function(a){this.W.setsChildPortSpot!==a&&(z(a,"boolean",Y,"alternateSetsChildPortSpot"),this.W.setsChildPortSpot=a,this.C())}},alternateChildPortSpot:{configurable:!0,get:function(){return this.W.childPortSpot},set:function(a){w(a,
M,Y,"alternateChildPortSpot");this.W.childPortSpot.A(a)||(this.W.childPortSpot=a,this.C())}}});
var Xs=new D(Y,"PathDefault",-1),Ys=new D(Y,"PathDestination",0),et=new D(Y,"PathSource",1),tt=new D(Y,"SortingForwards",10),ut=new D(Y,"SortingReverse",11),vt=new D(Y,"SortingAscending",12),wt=new D(Y,"SortingDescending",13),Vt=new D(Y,"AlignmentCenterSubtrees",20),Wt=new D(Y,"AlignmentCenterChildren",21),Ht=new D(Y,"AlignmentStart",22),It=new D(Y,"AlignmentEnd",23),yt=new D(Y,"AlignmentBus",24),ot=new D(Y,"AlignmentBusBranching",25),zt=new D(Y,"AlignmentTopLeftBus",26),At=new D(Y,"AlignmentBottomRightBus",
27),Dt=new D(Y,"CompactionNone",30),Ft=new D(Y,"CompactionBlock",31),Zs=new D(Y,"StyleLayered",40),st=new D(Y,"StyleLastParents",41),rt=new D(Y,"StyleAlternating",42),qt=new D(Y,"StyleRootOnly",43),at=new D(Y,"ArrangementVertical",50),eu=new D(Y,"ArrangementHorizontal",51),dt=new D(Y,"ArrangementFixedRoots",52),$s=new D(Y,"LayerIndividual",60),mt=new D(Y,"LayerSiblings",61),lt=new D(Y,"LayerUniform",62);Y.className="TreeLayout";Y.PathDefault=Xs;Y.PathDestination=Ys;Y.PathSource=et;
Y.SortingForwards=tt;Y.SortingReverse=ut;Y.SortingAscending=vt;Y.SortingDescending=wt;Y.AlignmentCenterSubtrees=Vt;Y.AlignmentCenterChildren=Wt;Y.AlignmentStart=Ht;Y.AlignmentEnd=It;Y.AlignmentBus=yt;Y.AlignmentBusBranching=ot;Y.AlignmentTopLeftBus=zt;Y.AlignmentBottomRightBus=At;Y.CompactionNone=Dt;Y.CompactionBlock=Ft;Y.StyleLayered=Zs;Y.StyleLastParents=st;Y.StyleAlternating=rt;Y.StyleRootOnly=qt;Y.ArrangementVertical=at;Y.ArrangementHorizontal=eu;Y.ArrangementFixedRoots=dt;Y.LayerIndividual=$s;
Y.LayerSiblings=mt;Y.LayerUniform=lt;function bt(a){Sp.call(this,a)}ma(bt,Sp);bt.prototype.createVertex=function(){return new ct(this)};bt.prototype.createEdge=function(){return new gu(this)};bt.className="TreeNetwork";
function ct(a){Vp.call(this,a);this.Ma=!1;this.Nc=null;this.L=[];this.Xb=this.Wb=this.ca=this.Na=0;this.Zc=null;this.U=new J(0,0);this.xa=new Zb(0,0);this.ka=new J(0,0);this.Am=this.zm=this.bA=!1;this.yq=this.mq=null;this.Tc=tt;this.Pc=aq;this.Bc=0;this.xb=Wt;this.es=this.ds=0;this.gs=20;this.ne=50;this.Sr=0;this.ar=Ft;this.Uq=0;this.ss=25;this.$q=this.rs=10;this.Zq=20;this.Bs=!0;this.os=Qd;this.As=!0;this.Xq=Qd}ma(ct,Vp);
ct.prototype.copyInheritedPropertiesFrom=function(a){null!==a&&(this.Tc=a.sorting,this.Pc=a.comparer,this.Bc=a.angle,this.xb=a.alignment,this.ds=a.nodeIndent,this.es=a.nodeIndentPastParent,this.gs=a.nodeSpacing,this.ne=a.layerSpacing,this.Sr=a.layerSpacingParentOverlap,this.ar=a.compaction,this.Uq=a.breadthLimit,this.ss=a.rowSpacing,this.rs=a.rowIndent,this.$q=a.commentSpacing,this.Zq=a.commentMargin,this.Bs=a.setsPortSpot,this.os=a.portSpot,this.As=a.setsChildPortSpot,this.Xq=a.childPortSpot)};
na.Object.defineProperties(ct.prototype,{initialized:{configurable:!0,get:function(){return this.Ma},set:function(a){this.Ma!==a&&(z(a,"boolean",ct,"initialized"),this.Ma=a)}},parent:{configurable:!0,get:function(){return this.Nc},set:function(a){this.Nc!==a&&(E&&null!==a&&w(a,ct,ct,"parent"),this.Nc=a)}},children:{configurable:!0,get:function(){return this.L},set:function(a){if(this.L!==a){null===a||Array.isArray(a)||Ba(a,"Array",ct,"children:value");if(null!==
a)for(var b=a.length,c=0;c<b;c++){var d=a[c];E&&w(d,ct,ct,"children")}this.L=a}}},level:{configurable:!0,get:function(){return this.Na},set:function(a){this.Na!==a&&(z(a,"number",ct,"level"),this.Na=a)}},descendantCount:{configurable:!0,get:function(){return this.ca},set:function(a){this.ca!==a&&(z(a,"number",ct,"descendantCount"),this.ca=a)}},maxChildrenCount:{configurable:!0,get:function(){return this.Wb},set:function(a){this.Wb!==a&&(z(a,"number",ct,"maxChildrenCount"),
this.Wb=a)}},maxGenerationCount:{configurable:!0,get:function(){return this.Xb},set:function(a){this.Xb!==a&&(z(a,"number",ct,"maxGenerationCount"),this.Xb=a)}},comments:{configurable:!0,get:function(){return this.Zc},set:function(a){if(this.Zc!==a){null===a||Array.isArray(a)||Ba(a,"Array",ct,"comments:value");if(null!==a)for(var b=a.length,c=0;c<b;c++){var d=a[c];E&&w(d,V,ct,"comments")}this.Zc=a}}},sorting:{configurable:!0,get:function(){return this.Tc},
set:function(a){this.Tc!==a&&(tb(a,Y,ct,"sorting"),this.Tc=a)}},comparer:{configurable:!0,get:function(){return this.Pc},set:function(a){this.Pc!==a&&(z(a,"function",ct,"comparer"),this.Pc=a)}},angle:{configurable:!0,get:function(){return this.Bc},set:function(a){this.Bc!==a&&(z(a,"number",ct,"angle"),this.Bc=a)}},alignment:{configurable:!0,get:function(){return this.xb},set:function(a){this.xb!==a&&(tb(a,Y,ct,"alignment"),this.xb=a)}},nodeIndent:{configurable:!0,
enumerable:!0,get:function(){return this.ds},set:function(a){this.ds!==a&&(z(a,"number",ct,"nodeIndent"),this.ds=a)}},nodeIndentPastParent:{configurable:!0,get:function(){return this.es},set:function(a){this.es!==a&&(z(a,"number",ct,"nodeIndentPastParent"),this.es=a)}},nodeSpacing:{configurable:!0,get:function(){return this.gs},set:function(a){this.gs!==a&&(z(a,"number",ct,"nodeSpacing"),this.gs=a)}},layerSpacing:{configurable:!0,get:function(){return this.ne},
set:function(a){this.ne!==a&&(z(a,"number",ct,"layerSpacing"),this.ne=a)}},layerSpacingParentOverlap:{configurable:!0,get:function(){return this.Sr},set:function(a){this.Sr!==a&&(z(a,"number",ct,"layerSpacingParentOverlap"),this.Sr=a)}},compaction:{configurable:!0,get:function(){return this.ar},set:function(a){this.ar!==a&&(tb(a,Y,ct,"compaction"),this.ar=a)}},breadthLimit:{configurable:!0,get:function(){return this.Uq},set:function(a){this.Uq!==a&&(z(a,"number",
ct,"breadthLimit"),this.Uq=a)}},rowSpacing:{configurable:!0,get:function(){return this.ss},set:function(a){this.ss!==a&&(z(a,"number",ct,"rowSpacing"),this.ss=a)}},rowIndent:{configurable:!0,get:function(){return this.rs},set:function(a){this.rs!==a&&(z(a,"number",ct,"rowIndent"),this.rs=a)}},commentSpacing:{configurable:!0,get:function(){return this.$q},set:function(a){this.$q!==a&&(z(a,"number",ct,"commentSpacing"),this.$q=a)}},commentMargin:{configurable:!0,
enumerable:!0,get:function(){return this.Zq},set:function(a){this.Zq!==a&&(z(a,"number",ct,"commentMargin"),this.Zq=a)}},setsPortSpot:{configurable:!0,get:function(){return this.Bs},set:function(a){this.Bs!==a&&(z(a,"boolean",ct,"setsPortSpot"),this.Bs=a)}},portSpot:{configurable:!0,get:function(){return this.os},set:function(a){w(a,M,ct,"portSpot");this.os.A(a)||(this.os=a)}},setsChildPortSpot:{configurable:!0,get:function(){return this.As},set:function(a){this.As!==
a&&(z(a,"boolean",ct,"setsChildPortSpot"),this.As=a)}},childPortSpot:{configurable:!0,get:function(){return this.Xq},set:function(a){w(a,M,ct,"childPortSpot");this.Xq.A(a)||(this.Xq=a)}},childrenCount:{configurable:!0,get:function(){return this.children.length}},relativePosition:{configurable:!0,get:function(){return this.U},set:function(a){this.U.set(a)}},subtreeSize:{configurable:!0,get:function(){return this.xa},set:function(a){this.xa.set(a)}},
subtreeOffset:{configurable:!0,get:function(){return this.ka},set:function(a){this.ka.set(a)}}});ct.className="TreeVertex";function gu(a){Wp.call(this,a);this.uu=new J(0,0)}ma(gu,Wp);
gu.prototype.commit=function(){var a=this.link;if(null!==a&&!a.isAvoiding){var b=this.network.layout,c=null,d=null;switch(b.ad){case Ys:c=this.fromVertex;d=this.toVertex;break;case et:c=this.toVertex;d=this.fromVertex;break;default:v("Unhandled path value "+b.ad.toString())}if(null!==c&&null!==d)if(b=this.uu,0!==b.x||0!==b.y||c.bA){d=c.bounds;var e=Gt(c),f=Jt(c),g=c.rowSpacing;a.bj();var h=a.curve===fh,k=a.isOrthogonal,l;a.Eh();if(k||h){for(l=2;4<a.pointsCount;)a.Hv(2);var m=a.i(1);var n=a.i(2)}else{for(l=
1;3<a.pointsCount;)a.Hv(1);m=a.i(0);n=a.i(a.pointsCount-1)}var p=a.i(a.pointsCount-1);0===e?(c.alignment===It?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-Mt(c))))):c.alignment===Ht?(e=d.top+b.y,0===b.y&&m.y<p.y-c.rowIndent&&(e=Math.max(e,Math.min(m.y,e+Mt(c))))):e=c.zm||c.Am&&1===c.maxGenerationCount?d.top-c.ka.y+b.y:d.y+d.height/2+b.y,h?(a.m(l,m.x,e),l++,a.m(l,d.right+f,e),l++,a.m(l,d.right+f+(b.x-g)/3,e),l++,a.m(l,d.right+f+2*(b.x-g)/3,e),l++,a.m(l,d.right+f+(b.x-
g),e),l++,a.m(l,n.x,e)):(k&&(a.m(l,d.right+f/2,m.y),l++),a.m(l,d.right+f/2,e),l++,a.m(l,d.right+f+b.x-(k?g/2:g),e),l++,k&&a.m(l,a.i(l-1).x,n.y))):90===e?(c.alignment===It?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-Mt(c))))):c.alignment===Ht?(e=d.left+b.x,0===b.x&&m.x<p.x-c.rowIndent&&(e=Math.max(e,Math.min(m.x,e+Mt(c))))):e=c.zm||c.Am&&1===c.maxGenerationCount?d.left-c.ka.x+b.x:d.x+d.width/2+b.x,h?(a.m(l,e,m.y),l++,a.m(l,e,d.bottom+f),l++,a.m(l,e,d.bottom+f+(b.y-g)/
3),l++,a.m(l,e,d.bottom+f+2*(b.y-g)/3),l++,a.m(l,e,d.bottom+f+(b.y-g)),l++,a.m(l,e,n.y)):(k&&(a.m(l,m.x,d.bottom+f/2),l++),a.m(l,e,d.bottom+f/2),l++,a.m(l,e,d.bottom+f+b.y-(k?g/2:g)),l++,k&&a.m(l,n.x,a.i(l-1).y))):180===e?(c.alignment===It?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-Mt(c))))):c.alignment===Ht?(e=d.top+b.y,0===b.y&&m.y<p.y-c.rowIndent&&(e=Math.max(e,Math.min(m.y,e+Mt(c))))):e=c.zm||c.Am&&1===c.maxGenerationCount?d.top-c.ka.y+b.y:d.y+d.height/2+b.y,h?
(a.m(l,m.x,e),l++,a.m(l,d.left-f,e),l++,a.m(l,d.left-f+(b.x+g)/3,e),l++,a.m(l,d.left-f+2*(b.x+g)/3,e),l++,a.m(l,d.left-f+(b.x+g),e),l++,a.m(l,n.x,e)):(k&&(a.m(l,d.left-f/2,m.y),l++),a.m(l,d.left-f/2,e),l++,a.m(l,d.left-f+b.x+(k?g/2:g),e),l++,k&&a.m(l,a.i(l-1).x,n.y))):270===e?(c.alignment===It?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-Mt(c))))):c.alignment===Ht?(e=d.left+b.x,0===b.x&&m.x<p.x-c.rowIndent&&(e=Math.max(e,Math.min(m.x,e+Mt(c))))):e=c.zm||c.Am&&1===c.maxGenerationCount?
d.left-c.ka.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.pf()}else b=d,E&&w(c,ct,gu,"adjustRouteForAngleChange:parent"),E&&w(b,ct,gu,"adjustRouteForAngleChange:child"),a=this.link,f=Gt(c),f!==Gt(b)&&(g=Jt(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.bj(),c=a.curve===fh,b=a.isOrthogonal,d=xt(this.fromVertex.alignment),a.Eh(),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.pf()))}};
na.Object.defineProperties(gu.prototype,{relativePoint:{configurable:!0,get:function(){return this.uu},set:function(a){this.uu.set(a)}}});gu.className="TreeEdge";
$a.prototype.initializeStandardTools=function(){If(this,"Action",new sh,this.mouseDownTools);If(this,"Relinking",new ag,this.mouseDownTools);If(this,"LinkReshaping",new dh,this.mouseDownTools);If(this,"Rotating",new qh,this.mouseDownTools);If(this,"Resizing",new kh,this.mouseDownTools);If(this,"Linking",new Sg,this.mouseMoveTools);If(this,"Dragging",new Kf,this.mouseMoveTools);If(this,"DragSelecting",new vh,this.mouseMoveTools);If(this,"Panning",new wh,this.mouseMoveTools);If(this,"ContextMenu",new yh,
this.mouseUpTools);If(this,"TextEditing",new Jh,this.mouseUpTools);If(this,"ClickCreating",new th,this.mouseUpTools);If(this,"ClickSelecting",new rh,this.mouseUpTools)};zn("Horizontal",new Fm);zn("Spot",new Hm);zn("Table",new Lm);zn("Viewbox",new Qm);zn("TableRow",new Om);zn("TableColumn",new Pm);zn("Graduated",new Zm);Ii.add($q.type,tq);Ii.add(cr.type,Hq);
var hu=ra.go,iu={get licenseKey(){return P.licenseKey},set licenseKey(a){P.licenseKey=a},get version(){return P.version},Group:xg,EnumValue:D,List:F,Set:H,Map:Ub,Point:J,Size:Zb,Rect:L,Margin:Hc,Spot:M,Geometry:me,PathFigure:Xe,PathSegment:Ye,InputEvent:kf,DiagramEvent:mf,ChangedEvent:nf,Model:X,GraphLinksModel:$q,TreeModel:cr,Binding:Ui,Transaction:sf,UndoManager:tf,CommandHandler:Xk,Tool:vf,DraggingTool:Kf,DraggingInfo:bg,LinkingBaseTool:Gg,LinkingTool:Sg,RelinkingTool:ag,LinkReshapingTool:dh,ResizingTool:kh,
RotatingTool:qh,ClickSelectingTool:rh,ActionTool:sh,ClickCreatingTool:th,HTMLInfo:Hf,ContextMenuTool:yh,DragSelectingTool:vh,PanningTool:wh,TextEditingTool:Jh,ToolManager:$a,AnimationManager:bi,Layer:vi,Diagram:P,Palette:Rk,Overview:Tk,Brush:zl,GraphObject:N,Panel:W,RowColumnDefinition:fk,Shape:Hg,TextBlock:Kh,TextBlockMetrics:an,Picture:lk,Part:U,Adornment:Cf,Node:V,Link:T,Placeholder:lh,Layout:Oi,LayoutNetwork:Sp,LayoutVertex:Vp,LayoutEdge:Wp,GridLayout:Sk,PanelLayout:Tl,CircularLayout:dr,CircularNetwork:vr,
CircularVertex:Ir,CircularEdge:Jr,ForceDirectedLayout:Kr,ForceDirectedNetwork:Lr,ForceDirectedVertex:Vr,ForceDirectedEdge:Zr,LayeredDigraphLayout:$r,LayeredDigraphNetwork:es,LayeredDigraphVertex:Vs,LayeredDigraphEdge:Ws,TreeLayout:Y,TreeNetwork:bt,TreeVertex:ct,TreeEdge:gu};hu&&hu.version!==iu.version&&v("WARNING: a `go` object on the root object is already defined with a version mismatch."+hu.version+". Replaced with version: "+iu.version);ra.go=iu;
("undefined"===typeof ra||"undefined"===typeof ra.module||"object"!==typeof ra.module.exports)&&ra.define&&"function"===typeof ra.define&&ra.define.amd&&ra.define(iu);iu.Debug=E;E.vy(iu); 'undefined'!==typeof module&&'object'===typeof module.exports&&(module.exports='undefined'!==typeof global?global.go:self.go); })();


export const go = self.go;
