/*
 * GoJS v2.1.26 JavaScript Library for HTML Diagrams, https://gojs.net
 * GoJS and Northwoods Software are registered trademarks of Northwoods Software Corporation, https://www.nwoods.com.
 * Copyright (C) 1998-2020 by Northwoods Software Corporation.  All Rights Reserved..
 * THIS SOFTWARE IS LICENSED.  THE LICENSE AGREEMENT IS AT: https://gojs.net/2.1.26/license.html.
 * DO NOT MODIFY THIS FILE.  DO NOT DISTRIBUTE A MODIFIED COPY OF THE CONTENTS OF THIS FILE.
 */
(function() { var t;function aa(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}function ba(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):{next:aa(a)}}function da(a){for(var b,c=[];!(b=a.next()).done;)c.push(b.value);return c}var ea="function"==typeof Object.create?Object.create:function(a){function b(){}b.prototype=a;return new b},fa;
if("function"==typeof Object.setPrototypeOf)fa=Object.setPrototypeOf;else{var ha;a:{var ia={a:!0},ja={};try{ja.__proto__=ia;ha=ja.a;break a}catch(a){}ha=!1}fa=ha?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null}var ka=fa;
function la(a,b){a.prototype=ea(b.prototype);a.prototype.constructor=a;if(ka)ka(a,b);else for(var c in b)if("prototype"!=c)if(Object.defineProperties){var d=Object.getOwnPropertyDescriptor(b,c);d&&Object.defineProperty(a,c,d)}else a[c]=b[c];a.RA=b.prototype}var ma="undefined"!=typeof window&&window===self?self:"undefined"!=typeof global&&null!=global?global:self,na="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};
function oa(a){if(a){for(var b=ma,c=["Array","prototype","fill"],d=0;d<c.length-1;d++){var e=c[d];e in b||(b[e]={});b=b[e]}c=c[c.length-1];d=b[c];a=a(d);a!=d&&null!=a&&na(b,c,{writable:!0,value:a})}}oa(function(a){return a?a:function(a,c,d){var b=this.length||0;0>c&&(c=Math.max(0,b+c));if(null==d||d>b)d=b;d=Number(d);0>d&&(d=Math.max(0,b+d));for(c=Number(c||0);c<d;c++)this[c]=a;return this}});var x="object"===typeof self&&self.self===self&&self||"object"===typeof global&&global.global===global&&global||"object"===typeof window&&window.window===window&&window||{};void 0===x.requestAnimationFrame&&(x.requestAnimationFrame=x.setImmediate);function qa(){}function ra(a,b){var c=-1;return function(){var d=this,e=arguments;-1!==c&&x.clearTimeout(c);c=sa(function(){c=-1;a.apply(d,e)},b)}}function sa(a,b){return x.setTimeout(a,b)}function ta(a){return x.document.createElement(a)}
function B(a){throw Error(a);}function ua(a,b){a="The object is frozen, so its properties cannot be set: "+a.toString();void 0!==b&&(a+="  to value: "+b);B(a)}function va(a,b,c,d){c=null===c?"*":"string"===typeof c?c:"function"===typeof c&&"string"===typeof c.className?c.className:"";void 0!==d&&(c+="."+d);B(c+" is not in the range "+b+": "+a)}function wa(a){x.console&&x.console.log(a)}
function ya(){x.console&&x.console.log("Warning: List/Map/Set constructors no longer take an argument that enforces type.Instead they take an optional collection of Values to add to the collection. See 2.0 changelog for details.")}function za(a){return"object"===typeof a&&null!==a}function Aa(a){return Array.isArray(a)||x.NodeList&&a instanceof x.NodeList||x.HTMLCollection&&a instanceof x.HTMLCollection}function Ba(a){return Array.prototype.slice.call(a)}
function Ca(a,b,c){Array.isArray(a)?b>=a.length?a.push(c):a.splice(b,0,c):B("Cannot insert an object into an HTMLCollection or NodeList: "+c+" at "+b)}function Da(a,b){Array.isArray(a)?b>=a.length?a.pop():a.splice(b,1):B("Cannot remove an object from an HTMLCollection or NodeList at "+b)}function Fa(){var a=Ga.pop();return void 0===a?[]:a}function Ha(a){a.length=0;Ga.push(a)}
function Ia(a){if("function"===typeof a){if(a.className)return a.className;if(a.name)return a.name;var b=a.toString();b=b.substring(9,b.indexOf("(")).trim();if(""!==b)return a._className=b}else if(za(a)&&a.constructor)return Ia(a.constructor);return typeof a}
function Ja(a){var b=a;za(a)&&(a.text?b=a.text:a.name?b=a.name:void 0!==a.key?b=a.key:void 0!==a.id?b=a.id:a.constructor===Object&&(a.Text?b=a.Text:a.Name?b=a.Name:void 0!==a.Key?b=a.Key:void 0!==a.Id?b=a.Id:void 0!==a.ID&&(b=a.ID)));return void 0===b?"undefined":null===b?"null":b.toString()}function Ka(a,b){if(a.hasOwnProperty(b))return!0;for(a=Object.getPrototypeOf(a);a&&a!==Function;){if(a.hasOwnProperty(b))return!0;var c=a.LA;if(c&&c[b])return!0;a=Object.getPrototypeOf(a)}return!1}
function La(a,b,c){Object.defineProperty(Oa.prototype,a,{get:b,set:c})}function Pa(){var a=Qa;if(0===a.length)for(var b=x.document.getElementsByTagName("canvas"),c=b.length,d=0;d<c;d++){var e=b[d];e.parentElement&&e.parentElement.B&&a.push(e.parentElement.B)}return a}
function Ra(a){for(var b=[],c=0;256>c;c++)b["0123456789abcdef".charAt(c>>4)+"0123456789abcdef".charAt(c&15)]=String.fromCharCode(c);a.length%2&&(a="0"+a);c=[];for(var d=0,e=0;e<a.length;e+=2)c[d++]=b[a.substr(e,2)];a=c.join("");a=""===a?"0":a;b=[];for(c=0;256>c;c++)b[c]=c;for(c=d=0;256>c;c++)d=(d+b[c]+119)%256,e=b[c],b[c]=b[d],b[d]=e;d=c=0;for(var f="",g=0;g<a.length;g++)c=(c+1)%256,d=(d+b[c])%256,e=b[c],b[c]=b[d],b[d]=e,f+=String.fromCharCode(a.charCodeAt(g)^b[(b[c]+b[d])%256]);return f}
var Sa=void 0!==x.navigator&&0<x.navigator.userAgent.indexOf("MSIE 9.0"),Ta=void 0!==x.navigator&&0<x.navigator.userAgent.indexOf("MSIE 10.0"),Ua=void 0!==x.navigator&&0<x.navigator.userAgent.indexOf("Trident/7"),Va=void 0!==x.navigator&&0<x.navigator.userAgent.indexOf("Edge/"),Wa=void 0!==x.navigator&&void 0!==x.navigator.platform&&0<=x.navigator.platform.toUpperCase().indexOf("MAC"),Xa=void 0!==x.navigator&&void 0!==x.navigator.platform&&null!==x.navigator.platform.match(/(iPhone|iPod|iPad)/i),
Ga=[];Object.freeze([]);var Qa=[];qa.className="Util";qa.Dx="32ab5ff3b26f42dc0ed90f21442913b5";qa.adym="gojs.net";qa.vfo="28e647fdb160";qa.className="Util";function D(a,b,c){Ya(this);this.l=a;this.Qa=b;this.u=c}D.prototype.toString=function(){return"EnumValue."+this.Qa};function Za(a,b){return void 0===b||null===b||""===b?null:a[b]}
ma.Object.defineProperties(D.prototype,{classType:{get:function(){return this.l}},name:{get:function(){return this.Qa}},value:{get:function(){return this.u}}});D.className="EnumValue";function cb(){this.Yw=[]}cb.prototype.toString=function(){return this.Yw.join("")};cb.prototype.add=function(a){""!==a&&this.Yw.push(a)};cb.className="StringBuilder";function db(){}db.className="PropertyCollection";
function eb(){}eb.prototype.reset=function(){};eb.prototype.next=function(){return!1};eb.prototype.ed=function(){return!1};eb.prototype.first=function(){return null};eb.prototype.any=function(){return!1};eb.prototype.all=function(){return!0};eb.prototype.each=function(){return this};eb.prototype.map=function(){return this};eb.prototype.filter=function(){return this};eb.prototype.Ed=function(){};eb.prototype.toString=function(){return"EmptyIterator"};
ma.Object.defineProperties(eb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return 0}}});eb.prototype.first=eb.prototype.first;eb.prototype.hasNext=eb.prototype.ed;eb.prototype.next=eb.prototype.next;eb.prototype.reset=eb.prototype.reset;var fb=null;eb.className="EmptyIterator";fb=new eb;function gb(a){this.key=-1;this.value=a}gb.prototype.reset=function(){this.key=-1};
gb.prototype.next=function(){return-1===this.key?(this.key=0,!0):!1};gb.prototype.ed=function(){return this.next()};gb.prototype.first=function(){this.key=0;return this.value};gb.prototype.any=function(a){this.key=-1;return a(this.value)};gb.prototype.all=function(a){this.key=-1;return a(this.value)};gb.prototype.each=function(a){this.key=-1;a(this.value);return this};gb.prototype.map=function(a){return new gb(a(this.value))};
gb.prototype.filter=function(a){return a(this.value)?new gb(this.value):fb};gb.prototype.Ed=function(){this.value=null};gb.prototype.toString=function(){return"SingletonIterator("+this.value+")"};ma.Object.defineProperties(gb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return 1}}});gb.prototype.first=gb.prototype.first;gb.prototype.hasNext=gb.prototype.ed;gb.prototype.next=gb.prototype.next;
gb.prototype.reset=gb.prototype.reset;gb.className="SingletonIterator";function jb(a){this.pb=a;this.$e=null;a.Ga=null;this.ia=a.Aa;this.Oa=-1}jb.prototype.reset=function(){var a=this.pb;a.Ga=null;this.ia=a.Aa;this.Oa=-1};jb.prototype.next=function(){var a=this.pb;if(a.Aa!==this.ia&&0>this.key)return!1;a=a.j;var b=a.length,c=++this.Oa,d=this.$e;if(null!==d)for(;c<b;){var e=a[c];if(d(e))return this.key=this.Oa=c,this.value=e,!0;c++}else{if(c<b)return this.key=c,this.value=a[c],!0;this.Ed()}return!1};
jb.prototype.ed=function(){return this.next()};jb.prototype.first=function(){var a=this.pb;this.ia=a.Aa;this.Oa=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.Oa=d,this.value=e;d++}return null}return 0<b?(a=a[0],this.key=0,this.value=a):null};jb.prototype.any=function(a){var b=this.pb;b.Ga=null;this.Oa=-1;b=b.j;for(var c=b.length,d=this.$e,e=0;e<c;e++){var f=b[e];if((null===d||d(f))&&a(f))return!0}return!1};
jb.prototype.all=function(a){var b=this.pb;b.Ga=null;this.Oa=-1;b=b.j;for(var c=b.length,d=this.$e,e=0;e<c;e++){var f=b[e];if((null===d||d(f))&&!a(f))return!1}return!0};jb.prototype.each=function(a){var b=this.pb;b.Ga=null;this.Oa=-1;b=b.j;for(var c=b.length,d=this.$e,e=0;e<c;e++){var f=b[e];(null===d||d(f))&&a(f)}return this};
jb.prototype.map=function(a){var b=this.pb;b.Ga=null;this.Oa=-1;var c=[];b=b.j;for(var d=b.length,e=this.$e,f=0;f<d;f++){var g=b[f];(null===e||e(g))&&c.push(a(g))}a=new E;a.j=c;a.lb();return a.iterator};jb.prototype.filter=function(a){var b=this.pb;b.Ga=null;this.Oa=-1;var c=[];b=b.j;for(var d=b.length,e=this.$e,f=0;f<d;f++){var g=b[f];(null===e||e(g))&&a(g)&&c.push(g)}a=new E;a.j=c;a.lb();return a.iterator};
jb.prototype.Ed=function(){this.key=-1;this.value=null;this.ia=-1;this.$e=null;this.pb.Ga=this};jb.prototype.toString=function(){return"ListIterator@"+this.Oa+"/"+this.pb.count};
ma.Object.defineProperties(jb.prototype,{iterator:{get:function(){return this}},predicate:{get:function(){return this.$e},set:function(a){this.$e=a}},count:{get:function(){var a=this.$e;if(null!==a){for(var b=0,c=this.pb.j,d=c.length,e=0;e<d;e++)a(c[e])&&b++;return b}return this.pb.j.length}}});jb.prototype.first=jb.prototype.first;jb.prototype.hasNext=jb.prototype.ed;jb.prototype.next=jb.prototype.next;
jb.prototype.reset=jb.prototype.reset;jb.className="ListIterator";function kb(a){this.pb=a;a.Zg=null;this.ia=a.Aa;this.Oa=a.j.length}kb.prototype.reset=function(){var a=this.pb;a.Zg=null;this.ia=a.Aa;this.Oa=a.j.length};kb.prototype.next=function(){var a=this.pb;if(a.Aa!==this.ia&&0>this.key)return!1;var b=--this.Oa;if(0<=b)return this.key=b,this.value=a.j[b],!0;this.Ed();return!1};kb.prototype.ed=function(){return this.next()};
kb.prototype.first=function(){var a=this.pb;this.ia=a.Aa;var b=a.j;this.Oa=a=b.length-1;return 0<=a?(b=b[a],this.key=a,this.value=b):null};kb.prototype.any=function(a){var b=this.pb;b.Zg=null;b=b.j;var c=b.length;this.Oa=c;for(--c;0<=c;c--)if(a(b[c]))return!0;return!1};kb.prototype.all=function(a){var b=this.pb;b.Zg=null;b=b.j;var c=b.length;this.Oa=c;for(--c;0<=c;c--)if(!a(b[c]))return!1;return!0};
kb.prototype.each=function(a){var b=this.pb;b.Zg=null;b=b.j;var c=b.length;this.Oa=c;for(--c;0<=c;c--)a(b[c]);return this};kb.prototype.map=function(a){var b=this.pb;b.Zg=null;var c=[];b=b.j;var d=b.length;this.Oa=d;for(--d;0<=d;d--)c.push(a(b[d]));a=new E;a.j=c;a.lb();return a.iterator};kb.prototype.filter=function(a){var b=this.pb;b.Zg=null;var c=[];b=b.j;var d=b.length;this.Oa=d;for(--d;0<=d;d--){var e=b[d];a(e)&&c.push(e)}a=new E;a.j=c;a.lb();return a.iterator};
kb.prototype.Ed=function(){this.key=-1;this.value=null;this.ia=-1;this.pb.Zg=this};kb.prototype.toString=function(){return"ListIteratorBackwards("+this.Oa+"/"+this.pb.count+")"};ma.Object.defineProperties(kb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.pb.j.length}}});kb.prototype.first=kb.prototype.first;kb.prototype.hasNext=kb.prototype.ed;kb.prototype.next=kb.prototype.next;kb.prototype.reset=kb.prototype.reset;
kb.className="ListIteratorBackwards";function E(a){Ya(this);this.s=!1;this.j=[];this.Aa=0;this.Zg=this.Ga=null;void 0!==a&&("function"===typeof a||"string"===typeof a?ya():this.addAll(a))}t=E.prototype;t.lb=function(){var a=this.Aa;a++;999999999<a&&(a=0);this.Aa=a};t.freeze=function(){this.s=!0;return this};t.ea=function(){this.s=!1;return this};t.toString=function(){return"List()#"+lb(this)};t.add=function(a){if(null===a)return this;this.s&&ua(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.s&&ua(this);var b=this.j;if(Aa(a))for(var c=a.length,d=0;d<c;d++)b.push(a[d]);else for(a=a.iterator;a.next();)b.push(a.value);this.lb();return this};t.clear=function(){this.s&&ua(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.L=function(a){var b=this.j;(0>a||a>=b.length)&&va(a,"0 <= i < length",E,"elt:i");return b[a]};t.get=function(a){return this.L(a)};t.hd=function(a,b){var c=this.j;(0>a||a>=c.length)&&va(a,"0 <= i < length",E,"setElt:i");this.s&&ua(this,a);c[a]=b};t.set=function(a,b){this.hd(a,b)};t.first=function(){var a=this.j;return 0===a.length?null:a[0]};t.Xb=function(){var a=this.j,b=a.length;return 0<b?a[b-1]:null};t.pop=function(){this.s&&ua(this);var a=this.j;return 0<a.length?a.pop():null};
E.prototype.any=function(a){for(var b=this.j,c=b.length,d=0;d<c;d++)if(a(b[d]))return!0;return!1};E.prototype.all=function(a){for(var b=this.j,c=b.length,d=0;d<c;d++)if(!a(b[d]))return!1;return!0};E.prototype.each=function(a){for(var b=this.j,c=b.length,d=0;d<c;d++)a(b[d]);return this};E.prototype.map=function(a){for(var b=new E,c=[],d=this.j,e=d.length,f=0;f<e;f++)c.push(a(d[f]));b.j=c;b.lb();return b};
E.prototype.filter=function(a){for(var b=new E,c=[],d=this.j,e=d.length,f=0;f<e;f++){var g=d[f];a(g)&&c.push(g)}b.j=c;b.lb();return b};t=E.prototype;t.ub=function(a,b){0>a&&va(a,">= 0",E,"insertAt:i");this.s&&ua(this,a);var c=this.j;a>=c.length?c.push(b):c.splice(a,0,b);this.lb()};t.remove=function(a){if(null===a)return!1;this.s&&ua(this,a);var b=this.j;a=b.indexOf(a);if(-1===a)return!1;a===b.length-1?b.pop():b.splice(a,1);this.lb();return!0};t.delete=function(a){return this.remove(a)};
t.ab=function(a){var b=this.j;(0>a||a>=b.length)&&va(a,"0 <= i < length",E,"removeAt:i");this.s&&ua(this,a);a===b.length-1?b.pop():b.splice(a,1);this.lb()};t.removeRange=function(a,b){var c=this.j,d=c.length;if(0>a)a=0;else if(a>=d)return this;if(0>b)return this;b>=d&&(b=d-1);if(a>b)return this;this.s&&ua(this);for(var e=a,f=b+1;f<d;)c[e++]=c[f++];c.length=d-(b-a+1);this.lb();return this};E.prototype.copy=function(){var a=new E,b=this.j;0<b.length&&(a.j=Array.prototype.slice.call(b));return a};
t=E.prototype;t.na=function(){for(var a=this.j,b=this.count,c=Array(b),d=0;d<b;d++)c[d]=a[d];return c};t.xw=function(){for(var a=new F,b=this.j,c=this.count,d=0;d<c;d++)a.add(b[d]);return a};t.sort=function(a){this.s&&ua(this);this.j.sort(a);this.lb();return this};
t.hj=function(a,b,c){var d=this.j,e=d.length;void 0===b&&(b=0);void 0===c&&(c=e);this.s&&ua(this);var f=c-b;if(1>=f)return this;(0>b||b>=e-1)&&va(b,"0 <= from < length",E,"sortRange:from");if(2===f)return c=d[b],e=d[b+1],0<a(c,e)&&(d[b]=e,d[b+1]=c,this.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.s&&ua(this);this.j.reverse();this.lb();return this};
ma.Object.defineProperties(E.prototype,{_dataArray:{get:function(){return this.j}},count:{get:function(){return this.j.length}},size:{get:function(){return this.j.length}},length:{get:function(){return this.j.length}},iterator:{get:function(){if(0>=this.j.length)return fb;var a=this.Ga;return null!==a?(a.reset(),a):new jb(this)}},iteratorBackwards:{
get:function(){if(0>=this.j.length)return fb;var a=this.Zg;return null!==a?(a.reset(),a):new kb(this)}}});E.prototype.reverse=E.prototype.reverse;E.prototype.sortRange=E.prototype.hj;E.prototype.sort=E.prototype.sort;E.prototype.toSet=E.prototype.xw;E.prototype.toArray=E.prototype.na;E.prototype.removeRange=E.prototype.removeRange;E.prototype.removeAt=E.prototype.ab;E.prototype["delete"]=E.prototype.delete;E.prototype.remove=E.prototype.remove;E.prototype.insertAt=E.prototype.ub;
E.prototype.pop=E.prototype.pop;E.prototype.last=E.prototype.Xb;E.prototype.first=E.prototype.first;E.prototype.set=E.prototype.set;E.prototype.setElt=E.prototype.hd;E.prototype.get=E.prototype.get;E.prototype.elt=E.prototype.L;E.prototype.indexOf=E.prototype.indexOf;E.prototype.has=E.prototype.has;E.prototype.contains=E.prototype.contains;E.prototype.clear=E.prototype.clear;E.prototype.addAll=E.prototype.addAll;E.prototype.push=E.prototype.push;E.prototype.add=E.prototype.add;E.prototype.thaw=E.prototype.ea;
E.prototype.freeze=E.prototype.freeze;E.className="List";function mb(a){this.og=a;a.Ga=null;this.ia=a.Aa;this.la=null}mb.prototype.reset=function(){var a=this.og;a.Ga=null;this.ia=a.Aa;this.la=null};mb.prototype.next=function(){var a=this.og;if(a.Aa!==this.ia&&null===this.key)return!1;var b=this.la;b=null===b?a.ba:b.oa;if(null!==b)return this.la=b,this.value=b.value,this.key=b.key,!0;this.Ed();return!1};mb.prototype.ed=function(){return this.next()};
mb.prototype.first=function(){var a=this.og;this.ia=a.Aa;a=a.ba;if(null!==a){this.la=a;var b=a.value;this.key=a.key;return this.value=b}return null};mb.prototype.any=function(a){var b=this.og;this.la=b.Ga=null;for(b=b.ba;null!==b;){if(a(b.value))return!0;b=b.oa}return!1};mb.prototype.all=function(a){var b=this.og;this.la=b.Ga=null;for(b=b.ba;null!==b;){if(!a(b.value))return!1;b=b.oa}return!0};mb.prototype.each=function(a){var b=this.og;this.la=b.Ga=null;for(b=b.ba;null!==b;)a(b.value),b=b.oa;return this};
mb.prototype.map=function(a){var b=this.og;b.Ga=null;var c=new E;for(b=b.ba;null!==b;)c.add(a(b.value)),b=b.oa;return c.iterator};mb.prototype.filter=function(a){var b=this.og;b.Ga=null;var c=new E;for(b=b.ba;null!==b;){var d=b.value;a(d)&&c.add(d);b=b.oa}return c.iterator};mb.prototype.Ed=function(){this.value=this.key=null;this.ia=-1;this.og.Ga=this};mb.prototype.toString=function(){return null!==this.la?"SetIterator@"+this.la.value:"SetIterator"};
ma.Object.defineProperties(mb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.og.Eb}}});mb.prototype.first=mb.prototype.first;mb.prototype.hasNext=mb.prototype.ed;mb.prototype.next=mb.prototype.next;mb.prototype.reset=mb.prototype.reset;mb.className="SetIterator";
function F(a){Ya(this);this.s=!1;this.Gb={};this.Eb=0;this.Ga=null;this.Aa=0;this.Ue=this.ba=null;void 0!==a&&("function"===typeof a||"string"===typeof a?ya():this.addAll(a))}t=F.prototype;t.lb=function(){var a=this.Aa;a++;999999999<a&&(a=0);this.Aa=a};t.freeze=function(){this.s=!0;return this};t.ea=function(){this.s=!1;return this};t.toString=function(){return"Set()#"+lb(this)};
t.add=function(a){if(null===a)return this;this.s&&ua(this,a);var b=a;za(a)&&(b=nb(a));void 0===this.Gb[b]&&(this.Eb++,a=new ob(a,a),this.Gb[b]=a,b=this.Ue,null===b?this.ba=a:(a.El=b,b.oa=a),this.Ue=a,this.lb());return this};t.addAll=function(a){if(null===a)return this;this.s&&ua(this);if(Aa(a))for(var b=a.length,c=0;c<b;c++)this.add(a[c]);else for(a=a.iterator;a.next();)this.add(a.value);return this};
t.contains=function(a){if(null===a)return!1;var b=a;return za(a)&&(b=lb(a),void 0===b)?!1:void 0!==this.Gb[b]};t.has=function(a){return this.contains(a)};t.ez=function(a){if(null===a)return!0;for(a=a.iterator;a.next();)if(!this.contains(a.value))return!1;return!0};t.fz=function(a){if(null===a)return!0;for(a=a.iterator;a.next();)if(this.contains(a.value))return!0;return!1};t.first=function(){var a=this.ba;return null===a?null:a.value};
F.prototype.any=function(a){for(var b=this.ba;null!==b;){if(a(b.value))return!0;b=b.oa}return!1};F.prototype.all=function(a){for(var b=this.ba;null!==b;){if(!a(b.value))return!1;b=b.oa}return!0};F.prototype.each=function(a){for(var b=this.ba;null!==b;)a(b.value),b=b.oa;return this};F.prototype.map=function(a){for(var b=new F,c=this.ba;null!==c;)b.add(a(c.value)),c=c.oa;return b};F.prototype.filter=function(a){for(var b=new F,c=this.ba;null!==c;){var d=c.value;a(d)&&b.add(d);c=c.oa}return b};t=F.prototype;
t.remove=function(a){if(null===a)return!1;this.s&&ua(this,a);var b=a;if(za(a)&&(b=lb(a),void 0===b))return!1;a=this.Gb[b];if(void 0===a)return!1;var c=a.oa,d=a.El;null!==c&&(c.El=d);null!==d&&(d.oa=c);this.ba===a&&(this.ba=c);this.Ue===a&&(this.Ue=d);delete this.Gb[b];this.Eb--;this.lb();return!0};t.delete=function(a){return this.remove(a)};
t.Nq=function(a){if(null===a)return this;this.s&&ua(this);if(Aa(a))for(var b=a.length,c=0;c<b;c++)this.remove(a[c]);else for(a=a.iterator;a.next();)this.remove(a.value);return this};t.wA=function(a){if(null===a||0===this.count)return this;this.s&&ua(this);var b=new F;b.addAll(a);a=[];for(var c=this.iterator;c.next();){var d=c.value;b.contains(d)||a.push(d)}this.Nq(a);return this};t.clear=function(){this.s&&ua(this);this.Gb={};this.Eb=0;null!==this.Ga&&this.Ga.reset();this.Ue=this.ba=null;this.lb()};
F.prototype.copy=function(){var a=new F,b=this.Gb,c;for(c in b)a.add(b[c].value);return a};F.prototype.na=function(){var a=Array(this.Eb),b=this.Gb,c=0,d;for(d in b)a[c]=b[d].value,c++;return a};F.prototype.ww=function(){var a=new E,b=this.Gb,c;for(c in b)a.add(b[c].value);return a};function Ya(a){a.__gohashid=pb++}function nb(a){var b=a.__gohashid;void 0===b&&(b=pb++,a.__gohashid=b);return b}function lb(a){return a.__gohashid}
ma.Object.defineProperties(F.prototype,{count:{get:function(){return this.Eb}},size:{get:function(){return this.Eb}},iterator:{get:function(){if(0>=this.Eb)return fb;var a=this.Ga;return null!==a?(a.reset(),a):new mb(this)}}});F.prototype.toList=F.prototype.ww;F.prototype.toArray=F.prototype.na;F.prototype.clear=F.prototype.clear;F.prototype.retainAll=F.prototype.wA;F.prototype.removeAll=F.prototype.Nq;
F.prototype["delete"]=F.prototype.delete;F.prototype.remove=F.prototype.remove;F.prototype.first=F.prototype.first;F.prototype.containsAny=F.prototype.fz;F.prototype.containsAll=F.prototype.ez;F.prototype.has=F.prototype.has;F.prototype.contains=F.prototype.contains;F.prototype.addAll=F.prototype.addAll;F.prototype.add=F.prototype.add;F.prototype.thaw=F.prototype.ea;F.prototype.freeze=F.prototype.freeze;var pb=1;F.className="Set";F.uniqueHash=Ya;F.hashIdUnique=nb;F.hashId=lb;
function qb(a){this.fa=a;this.ia=a.Aa;this.la=null}qb.prototype.reset=function(){this.ia=this.fa.Aa;this.la=null};qb.prototype.next=function(){var a=this.fa;if(a.Aa!==this.ia&&null===this.key)return!1;var b=this.la;b=null===b?a.ba:b.oa;if(null!==b)return this.la=b,this.value=this.key=a=b.key,!0;this.Ed();return!1};qb.prototype.ed=function(){return this.next()};qb.prototype.first=function(){var a=this.fa;this.ia=a.Aa;a=a.ba;return null!==a?(this.la=a,this.value=this.key=a=a.key):null};
qb.prototype.any=function(a){var b=this.fa;this.la=null;for(b=b.ba;null!==b;){if(a(b.key))return!0;b=b.oa}return!1};qb.prototype.all=function(a){var b=this.fa;this.la=null;for(b=b.ba;null!==b;){if(!a(b.key))return!1;b=b.oa}return!0};qb.prototype.each=function(a){var b=this.fa;this.la=null;for(b=b.ba;null!==b;)a(b.key),b=b.oa;return this};qb.prototype.map=function(a){var b=this.fa;this.la=null;var c=new E;for(b=b.ba;null!==b;)c.add(a(b.key)),b=b.oa;return c.iterator};
qb.prototype.filter=function(a){var b=this.fa;this.la=null;var c=new E;for(b=b.ba;null!==b;){var d=b.key;a(d)&&c.add(d);b=b.oa}return c.iterator};qb.prototype.Ed=function(){this.value=this.key=null;this.ia=-1};qb.prototype.toString=function(){return null!==this.la?"MapKeySetIterator@"+this.la.value:"MapKeySetIterator"};ma.Object.defineProperties(qb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.fa.Eb}}});
qb.prototype.first=qb.prototype.first;qb.prototype.hasNext=qb.prototype.ed;qb.prototype.next=qb.prototype.next;qb.prototype.reset=qb.prototype.reset;qb.className="MapKeySetIterator";function rb(a){F.call(this);Ya(this);this.s=!0;this.fa=a}la(rb,F);t=rb.prototype;t.freeze=function(){return this};t.ea=function(){return this};t.toString=function(){return"MapKeySet("+this.fa.toString()+")"};t.add=function(){B("This Set is read-only: "+this.toString());return this};t.contains=function(a){return this.fa.contains(a)};
t.has=function(a){return this.contains(a)};t.remove=function(){B("This Set is read-only: "+this.toString());return!1};t.delete=function(a){return this.remove(a)};t.clear=function(){B("This Set is read-only: "+this.toString())};t.first=function(){var a=this.fa.ba;return null!==a?a.key:null};rb.prototype.any=function(a){for(var b=this.fa.ba;null!==b;){if(a(b.key))return!0;b=b.oa}return!1};rb.prototype.all=function(a){for(var b=this.fa.ba;null!==b;){if(!a(b.key))return!1;b=b.oa}return!0};
rb.prototype.each=function(a){for(var b=this.fa.ba;null!==b;)a(b.key),b=b.oa;return this};rb.prototype.map=function(a){for(var b=new F,c=this.fa.ba;null!==c;)b.add(a(c.key)),c=c.oa;return b};rb.prototype.filter=function(a){for(var b=new F,c=this.fa.ba;null!==c;){var d=c.key;a(d)&&b.add(d);c=c.oa}return b};rb.prototype.copy=function(){return new rb(this.fa)};rb.prototype.xw=function(){var a=new F,b=this.fa.Gb,c;for(c in b)a.add(b[c].key);return a};
rb.prototype.na=function(){var a=this.fa.Gb,b=Array(this.fa.Eb),c=0,d;for(d in a)b[c]=a[d].key,c++;return b};rb.prototype.ww=function(){var a=new E,b=this.fa.Gb,c;for(c in b)a.add(b[c].key);return a};ma.Object.defineProperties(rb.prototype,{count:{get:function(){return this.fa.Eb}},size:{get:function(){return this.fa.Eb}},iterator:{get:function(){return 0>=this.fa.Eb?fb:new qb(this.fa)}}});
rb.prototype.toList=rb.prototype.ww;rb.prototype.toArray=rb.prototype.na;rb.prototype.toSet=rb.prototype.xw;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.ea;rb.prototype.freeze=rb.prototype.freeze;rb.className="MapKeySet";
function sb(a){this.fa=a;a.Te=null;this.ia=a.Aa;this.la=null}sb.prototype.reset=function(){var a=this.fa;a.Te=null;this.ia=a.Aa;this.la=null};sb.prototype.next=function(){var a=this.fa;if(a.Aa!==this.ia&&null===this.key)return!1;var b=this.la;b=null===b?a.ba:b.oa;if(null!==b)return this.la=b,this.value=b.value,this.key=b.key,!0;this.Ed();return!1};sb.prototype.ed=function(){return this.next()};
sb.prototype.first=function(){var a=this.fa;this.ia=a.Aa;a=a.ba;if(null!==a){this.la=a;var b=a.value;this.key=a.key;return this.value=b}return null};sb.prototype.any=function(a){var b=this.fa;this.la=b.Te=null;for(b=b.ba;null!==b;){if(a(b.value))return!0;b=b.oa}return!1};sb.prototype.all=function(a){var b=this.fa;this.la=b.Te=null;for(b=b.ba;null!==b;){if(!a(b.value))return!1;b=b.oa}return!0};sb.prototype.each=function(a){var b=this.fa;this.la=b.Te=null;for(b=b.ba;null!==b;)a(b.value),b=b.oa;return this};
sb.prototype.map=function(a){var b=this.fa;this.la=b.Te=null;var c=new E;for(b=b.ba;null!==b;)c.add(a(b.value)),b=b.oa;return c.iterator};sb.prototype.filter=function(a){var b=this.fa;this.la=b.Te=null;var c=new E;for(b=b.ba;null!==b;){var d=b.value;a(d)&&c.add(d);b=b.oa}return c.iterator};sb.prototype.Ed=function(){this.value=this.key=null;this.ia=-1;this.fa.Te=this};sb.prototype.toString=function(){return null!==this.la?"MapValueSetIterator@"+this.la.value:"MapValueSetIterator"};
ma.Object.defineProperties(sb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.fa.Eb}}});sb.prototype.first=sb.prototype.first;sb.prototype.hasNext=sb.prototype.ed;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.El=this.oa=null}ob.prototype.toString=function(){return"{"+this.key+":"+this.value+"}"};
ob.className="KeyValuePair";function tb(a){this.fa=a;a.Ga=null;this.ia=a.Aa;this.la=null}tb.prototype.reset=function(){var a=this.fa;a.Ga=null;this.ia=a.Aa;this.la=null};tb.prototype.next=function(){var a=this.fa;if(a.Aa!==this.ia&&null===this.key)return!1;var b=this.la;b=null===b?a.ba:b.oa;if(null!==b)return this.la=b,this.key=b.key,this.value=b.value,!0;this.Ed();return!1};tb.prototype.ed=function(){return this.next()};
tb.prototype.first=function(){var a=this.fa;this.ia=a.Aa;a=a.ba;return null!==a?(this.la=a,this.key=a.key,this.value=a.value,a):null};tb.prototype.any=function(a){var b=this.fa;this.la=b.Ga=null;for(b=b.ba;null!==b;){if(a(b))return!0;b=b.oa}return!1};tb.prototype.all=function(a){var b=this.fa;this.la=b.Ga=null;for(b=b.ba;null!==b;){if(!a(b))return!1;b=b.oa}return!0};tb.prototype.each=function(a){var b=this.fa;this.la=b.Ga=null;for(b=b.ba;null!==b;)a(b),b=b.oa;return this};
tb.prototype.map=function(a){var b=this.fa;this.la=b.Ga=null;var c=new E;for(b=b.ba;null!==b;)c.add(a(b)),b=b.oa;return c.iterator};tb.prototype.filter=function(a){var b=this.fa;this.la=b.Ga=null;var c=new E;for(b=b.ba;null!==b;)a(b)&&c.add(b),b=b.oa;return c.iterator};tb.prototype.Ed=function(){this.value=this.key=null;this.ia=-1;this.fa.Ga=this};tb.prototype.toString=function(){return null!==this.la?"MapIterator@"+this.la:"MapIterator"};
ma.Object.defineProperties(tb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.fa.Eb}}});tb.prototype.first=tb.prototype.first;tb.prototype.hasNext=tb.prototype.ed;tb.prototype.next=tb.prototype.next;tb.prototype.reset=tb.prototype.reset;tb.className="MapIterator";
function H(a){Ya(this);this.s=!1;this.Gb={};this.Eb=0;this.Te=this.Ga=null;this.Aa=0;this.Ue=this.ba=null;void 0!==a&&("function"===typeof a||"string"===typeof a?ya():this.addAll(a))}t=H.prototype;t.lb=function(){var a=this.Aa;a++;999999999<a&&(a=0);this.Aa=a};t.freeze=function(){this.s=!0;return this};t.ea=function(){this.s=!1;return this};t.toString=function(){return"Map()#"+lb(this)};
t.add=function(a,b){this.s&&ua(this,a);var c=a;za(a)&&(c=nb(a));var d=this.Gb[c];void 0===d?(this.Eb++,a=new ob(a,b),this.Gb[c]=a,c=this.Ue,null===c?this.ba=a:(a.El=c,c.oa=a),this.Ue=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(Aa(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];this.add(d.key,d.value)}else if(a instanceof H)for(a=a.iterator;a.next();)this.add(a.key,a.value);else for(a=a.iterator;a.next();)b=a.value,this.add(b.key,b.value);return this};t.first=function(){return this.ba};H.prototype.any=function(a){for(var b=this.ba;null!==b;){if(a(b))return!0;b=b.oa}return!1};H.prototype.all=function(a){for(var b=this.ba;null!==b;){if(!a(b))return!1;b=b.oa}return!0};
H.prototype.each=function(a){for(var b=this.ba;null!==b;)a(b),b=b.oa;return this};H.prototype.map=function(a){for(var b=new H,c=this.ba;null!==c;)b.add(c.key,a(c)),c=c.oa;return b};H.prototype.filter=function(a){for(var b=new H,c=this.ba;null!==c;)a(c)&&b.add(c.key,c.value),c=c.oa;return b};t=H.prototype;t.contains=function(a){var b=a;return za(a)&&(b=lb(a),void 0===b)?!1:void 0!==this.Gb[b]};t.has=function(a){return this.contains(a)};
t.H=function(a){var b=a;if(za(a)&&(b=lb(a),void 0===b))return null;a=this.Gb[b];return void 0===a?null:a.value};t.get=function(a){return this.H(a)};t.remove=function(a){if(null===a)return!1;this.s&&ua(this,a);var b=a;if(za(a)&&(b=lb(a),void 0===b))return!1;a=this.Gb[b];if(void 0===a)return!1;var c=a.oa,d=a.El;null!==c&&(c.El=d);null!==d&&(d.oa=c);this.ba===a&&(this.ba=c);this.Ue===a&&(this.Ue=d);delete this.Gb[b];this.Eb--;this.lb();return!0};t.delete=function(a){return this.remove(a)};
t.clear=function(){this.s&&ua(this);this.Gb={};this.Eb=0;null!==this.Ga&&this.Ga.reset();null!==this.Te&&this.Te.reset();this.Ue=this.ba=null;this.lb()};H.prototype.copy=function(){var a=new H,b=this.Gb,c;for(c in b){var d=b[c];a.add(d.key,d.value)}return a};H.prototype.na=function(){var a=this.Gb,b=Array(this.Eb),c=0,d;for(d in a){var e=a[d];b[c]=new ob(e.key,e.value);c++}return b};H.prototype.Df=function(){return new rb(this)};
ma.Object.defineProperties(H.prototype,{count:{get:function(){return this.Eb}},size:{get:function(){return this.Eb}},iterator:{get:function(){if(0>=this.count)return fb;var a=this.Ga;return null!==a?(a.reset(),a):new tb(this)}},iteratorKeys:{get:function(){return 0>=this.count?fb:new qb(this)}},iteratorValues:{get:function(){if(0>=this.count)return fb;
var a=this.Te;return null!==a?(a.reset(),a):new sb(this)}}});H.prototype.toKeySet=H.prototype.Df;H.prototype.toArray=H.prototype.na;H.prototype.clear=H.prototype.clear;H.prototype["delete"]=H.prototype.delete;H.prototype.remove=H.prototype.remove;H.prototype.get=H.prototype.get;H.prototype.getValue=H.prototype.H;H.prototype.has=H.prototype.has;H.prototype.contains=H.prototype.contains;H.prototype.first=H.prototype.first;H.prototype.addAll=H.prototype.addAll;H.prototype.set=H.prototype.set;
H.prototype.add=H.prototype.add;H.prototype.thaw=H.prototype.ea;H.prototype.freeze=H.prototype.freeze;H.className="Map";function I(a,b){void 0===a?this.y=this.x=0:"number"===typeof a&&"number"===typeof b?(this.x=a,this.y=b):B("Invalid arguments to Point constructor: "+a+", "+b);this.s=!1}I.prototype.assign=function(a){this.x=a.x;this.y=a.y;return this};I.prototype.h=function(a,b){this.x=a;this.y=b;return this};I.prototype.Bg=function(a,b){this.x=a;this.y=b;return this};
I.prototype.set=function(a){this.x=a.x;this.y=a.y;return this};I.prototype.copy=function(){var a=new I;a.x=this.x;a.y=this.y;return a};t=I.prototype;t.ca=function(){this.s=!0;Object.freeze(this);return this};t.G=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.s=!1;return this};
function ub(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));return new I(c,e)}return new I}function vb(a){return a.x.toString()+" "+a.y.toString()}t.toString=function(){return"Point("+this.x+","+this.y+")"};t.w=function(a){return a instanceof I?this.x===a.x&&this.y===a.y:!1};t.Vi=function(a,b){return this.x===a&&this.y===b};t.Ma=function(a){return K.A(this.x,a.x)&&K.A(this.y,a.y)};
t.add=function(a){this.x+=a.x;this.y+=a.y;return this};t.be=function(a){this.x-=a.x;this.y-=a.y;return this};t.offset=function(a,b){this.x+=a;this.y+=b;return this};I.prototype.rotate=function(a){if(0===a)return this;var b=this.x,c=this.y;if(0===b&&0===c)return this;360<=a?a-=360:0>a&&(a+=360);if(90===a){a=0;var d=1}else 180===a?(a=-1,d=0):270===a?(a=0,d=-1):(d=a*Math.PI/180,a=Math.cos(d),d=Math.sin(d));this.x=a*b-d*c;this.y=d*b+a*c;return this};t=I.prototype;
t.scale=function(a,b){this.x*=a;this.y*=b;return this};t.De=function(a){var b=a.x-this.x;a=a.y-this.y;return b*b+a*a};t.dd=function(a,b){a-=this.x;b-=this.y;return a*a+b*b};t.normalize=function(){var a=this.x,b=this.y,c=Math.sqrt(a*a+b*b);0<c&&(this.x=a/c,this.y=b/c);return this};t.Sa=function(a){return zb(a.x-this.x,a.y-this.y)};t.direction=function(a,b){return zb(a-this.x,b-this.y)};
function zb(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.pA=function(a,b,c,d){K.Kh(a,b,c,d,this.x,this.y,this);return this};t.qA=function(a,b){K.Kh(a.x,a.y,b.x,b.y,this.x,this.y,this);return this};t.CA=function(a,b,c,d){K.sq(this.x,this.y,a,b,c,d,this);return this};t.DA=function(a,b){K.sq(this.x,this.y,a.x,a.y,b.width,b.height,this);return this};
t.gj=function(a,b){this.x=a.x+b.x*a.width+b.offsetX;this.y=a.y+b.y*a.height+b.offsetY;return this};t.zk=function(a,b,c,d,e){this.x=a+e.x*c+e.offsetX;this.y=b+e.y*d+e.offsetY;return this};t.transform=function(a){a.ra(this);return this};function Ab(a,b){b.Xd(a);return a}function Bb(a,b,c,d,e,f){var g=e-c,h=f-d,k=g*g+h*h;c-=a;d-=b;var l=-c*g-d*h;if(0>=l||l>=k)return g=e-a,h=f-b,Math.min(c*c+d*d,g*g+h*h);a=g*d-h*c;return a*a/k}function Cb(a,b,c,d){a=c-a;b=d-b;return a*a+b*b}
function Db(a,b,c,d){a=c-a;b=d-b;if(0===a)return 0<b?90:0>b?270:0;if(0===b)return 0<a?0:180;if(isNaN(a)||isNaN(b))return 0;d=180*Math.atan(Math.abs(b/a))/Math.PI;0>a?d=0>b?d+180:180-d:0>b&&(d=360-d);return d}t.v=function(){return isFinite(this.x)&&isFinite(this.y)};I.alloc=function(){var a=Fb.pop();return void 0===a?new I:a};I.allocAt=function(a,b){var c=Fb.pop();if(void 0===c)return new I(a,b);c.x=a;c.y=b;return c};I.free=function(a){Fb.push(a)};I.prototype.isReal=I.prototype.v;
I.prototype.setSpot=I.prototype.zk;I.prototype.setRectSpot=I.prototype.gj;I.prototype.snapToGridPoint=I.prototype.DA;I.prototype.snapToGrid=I.prototype.CA;I.prototype.projectOntoLineSegmentPoint=I.prototype.qA;I.prototype.projectOntoLineSegment=I.prototype.pA;I.intersectingLineSegments=function(a,b,c,d,e,f,g,h){return K.Aq(a,b,c,d,e,f,g,h)};I.prototype.direction=I.prototype.direction;I.prototype.directionPoint=I.prototype.Sa;I.prototype.normalize=I.prototype.normalize;
I.prototype.distanceSquared=I.prototype.dd;I.prototype.distanceSquaredPoint=I.prototype.De;I.prototype.scale=I.prototype.scale;I.prototype.rotate=I.prototype.rotate;I.prototype.offset=I.prototype.offset;I.prototype.subtract=I.prototype.be;I.prototype.add=I.prototype.add;I.prototype.equalsApprox=I.prototype.Ma;I.prototype.equalTo=I.prototype.Vi;I.prototype.equals=I.prototype.w;I.prototype.set=I.prototype.set;I.prototype.setTo=I.prototype.Bg;var Gb=null,Hb=null,Ib=null,Jb=null,Kb=null,Fb=[];
I.className="Point";I.parse=ub;I.stringify=vb;I.distanceLineSegmentSquared=Bb;I.distanceSquared=Cb;I.direction=Db;I.Origin=Gb=(new I(0,0)).ca();I.InfiniteTopLeft=Hb=(new I(-Infinity,-Infinity)).ca();I.InfiniteBottomRight=Ib=(new I(Infinity,Infinity)).ca();I.SixPoint=Jb=(new I(6,6)).ca();I.NoPoint=Kb=(new I(NaN,NaN)).ca();I.parse=ub;I.stringify=vb;I.distanceLineSegmentSquared=Bb;I.distanceSquared=Cb;I.direction=Db;
function M(a,b){void 0===a?this.height=this.width=0:"number"===typeof a&&(0<=a||isNaN(a))&&"number"===typeof b&&(0<=b||isNaN(b))?(this.width=a,this.height=b):B("Invalid arguments to Size constructor: "+a+", "+b);this.s=!1}var Lb,Mb,Nb,Ob,Pb,Qb,Rb;M.prototype.assign=function(a){this.width=a.width;this.height=a.height;return this};M.prototype.h=function(a,b){this.width=a;this.height=b;return this};M.prototype.Bg=function(a,b){this.width=a;this.height=b;return this};
M.prototype.set=function(a){this.width=a.width;this.height=a.height;return this};M.prototype.copy=function(){var a=new M;a.width=this.width;a.height=this.height;return a};t=M.prototype;t.ca=function(){this.s=!0;Object.freeze(this);return this};t.G=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.s=!1;return this};
function Sb(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));return new M(c,e)}return new M}function Tb(a){return a.width.toString()+" "+a.height.toString()}t.toString=function(){return"Size("+this.width+","+this.height+")"};t.w=function(a){return a instanceof M?this.width===a.width&&this.height===a.height:!1};t.Vi=function(a,b){return this.width===a&&this.height===b};
t.Ma=function(a){return K.A(this.width,a.width)&&K.A(this.height,a.height)};t.v=function(){return isFinite(this.width)&&isFinite(this.height)};M.alloc=function(){var a=Ub.pop();return void 0===a?new M:a};M.free=function(a){Ub.push(a)};M.prototype.isReal=M.prototype.v;M.prototype.equalsApprox=M.prototype.Ma;M.prototype.equalTo=M.prototype.Vi;M.prototype.equals=M.prototype.w;M.prototype.set=M.prototype.set;M.prototype.setTo=M.prototype.Bg;var Ub=[];M.className="Size";M.parse=Sb;M.stringify=Tb;
M.ZeroSize=Lb=(new M(0,0)).ca();M.OneSize=Mb=(new M(1,1)).ca();M.SixSize=Nb=(new M(6,6)).ca();M.EightSize=Ob=(new M(8,8)).ca();M.TenSize=Pb=(new M(10,10)).ca();M.InfiniteSize=Qb=(new M(Infinity,Infinity)).ca();M.NoSize=Rb=(new M(NaN,NaN)).ca();M.parse=Sb;M.stringify=Tb;
function N(a,b,c,d){void 0===a?this.height=this.width=this.y=this.x=0:a instanceof I?(c=a.x,a=a.y,b instanceof I?(d=b.x,b=b.y,this.x=Math.min(c,d),this.y=Math.min(a,b),this.width=Math.abs(c-d),this.height=Math.abs(a-b)):b instanceof M?(this.x=c,this.y=a,this.width=b.width,this.height=b.height):B("Incorrect arguments supplied to Rect constructor")):"number"===typeof a&&"number"===typeof b&&"number"===typeof c&&(0<=c||isNaN(c))&&"number"===typeof d&&(0<=d||isNaN(d))?(this.x=a,this.y=b,this.width=c,
this.height=d):B("Invalid arguments to Rect constructor: "+a+", "+b+", "+c+", "+d);this.s=!1}t=N.prototype;t.assign=function(a){this.x=a.x;this.y=a.y;this.width=a.width;this.height=a.height;return this};t.h=function(a,b,c,d){this.x=a;this.y=b;this.width=c;this.height=d;return this};function Vb(a,b,c){a.width=b;a.height=c}t.Bg=function(a,b,c,d){this.x=a;this.y=b;this.width=c;this.height=d;return this};t.set=function(a){this.x=a.x;this.y=a.y;this.width=a.width;this.height=a.height;return this};
t.jd=function(a){this.x=a.x;this.y=a.y;return this};t.AA=function(a){this.width=a.width;this.height=a.height;return this};N.prototype.copy=function(){var a=new N;a.x=this.x;a.y=this.y;a.width=this.width;a.height=this.height;return a};t=N.prototype;t.ca=function(){this.s=!0;Object.freeze(this);return this};t.G=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};
t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.s=!1;return this};function Wb(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));for(var f=0;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));for(var g=0;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));return new N(c,e,f,g)}return new N}
function Zb(a){return a.x.toString()+" "+a.y.toString()+" "+a.width.toString()+" "+a.height.toString()}t.toString=function(){return"Rect("+this.x+","+this.y+","+this.width+","+this.height+")"};t.w=function(a){return a instanceof N?this.x===a.x&&this.y===a.y&&this.width===a.width&&this.height===a.height:!1};t.Vi=function(a,b,c,d){return this.x===a&&this.y===b&&this.width===c&&this.height===d};t.Ma=function(a){return K.A(this.x,a.x)&&K.A(this.y,a.y)&&K.A(this.width,a.width)&&K.A(this.height,a.height)};
function $b(a,b){return K.$(a.x,b.x)&&K.$(a.y,b.y)&&K.$(a.width,b.width)&&K.$(a.height,b.height)}t.aa=function(a){return this.x<=a.x&&this.x+this.width>=a.x&&this.y<=a.y&&this.y+this.height>=a.y};t.Ce=function(a){return this.x<=a.x&&a.x+a.width<=this.x+this.width&&this.y<=a.y&&a.y+a.height<=this.y+this.height};t.contains=function(a,b,c,d){void 0===c&&(c=0);void 0===d&&(d=0);return this.x<=a&&a+c<=this.x+this.width&&this.y<=b&&b+d<=this.y+this.height};t.offset=function(a,b){this.x+=a;this.y+=b;return this};
t.Fc=function(a,b){return ac(this,b,a,b,a)};t.iq=function(a){return ac(this,a.top,a.right,a.bottom,a.left)};t.vw=function(a){return ac(this,-a.top,-a.right,-a.bottom,-a.left)};t.Tz=function(a,b,c,d){return ac(this,a,b,c,d)};function ac(a,b,c,d,e){var f=a.width;c+e<=-f?(a.x+=f/2,a.width=0):(a.x-=e,a.width+=c+e);c=a.height;b+d<=-c?(a.y+=c/2,a.height=0):(a.y-=b,a.height+=b+d);return a}t.Xz=function(a){return bc(this,a.x,a.y,a.width,a.height)};t.Nv=function(a,b,c,d){return bc(this,a,b,c,d)};
function bc(a,b,c,d,e){var f=Math.max(a.x,b),g=Math.max(a.y,c);b=Math.min(a.x+a.width,b+d);c=Math.min(a.y+a.height,c+e);a.x=f;a.y=g;a.width=Math.max(0,b-f);a.height=Math.max(0,c-g);return a}t.Ic=function(a){return this.Ov(a.x,a.y,a.width,a.height)};t.Ov=function(a,b,c,d){var e=this.width,f=this.x;if(Infinity!==e&&Infinity!==c&&(e+=f,c+=a,isNaN(c)||isNaN(e)||f>c||a>e))return!1;a=this.height;c=this.y;return Infinity!==a&&Infinity!==d&&(a+=c,d+=b,isNaN(d)||isNaN(a)||c>d||b>a)?!1:!0};
function dc(a,b){var c=a.width,d=a.x,e=b.x-10;if(d>b.width+10+10+e||e>c+d)return!1;c=a.height;a=a.y;d=b.y-10;return a>b.height+10+10+d||d>c+a?!1:!0}t.Ie=function(a){return ec(this,a.x,a.y,0,0)};t.Jc=function(a){return ec(this,a.x,a.y,a.width,a.height)};t.Cw=function(a,b,c,d){void 0===c&&(c=0);void 0===d&&(d=0);return ec(this,a,b,c,d)};
function ec(a,b,c,d,e){var f=Math.min(a.x,b),g=Math.min(a.y,c);b=Math.max(a.x+a.width,b+d);c=Math.max(a.y+a.height,c+e);a.x=f;a.y=g;a.width=b-f;a.height=c-g;return a}t.zk=function(a,b,c){this.x=a-c.offsetX-c.x*this.width;this.y=b-c.offsetY-c.y*this.height;return this};function fc(a,b,c,d,e,f,g,h){void 0===g&&(g=0);void 0===h&&(h=0);return a<=e&&e+g<=a+c&&b<=f&&f+h<=b+d}function gc(a,b,c,d,e,f,g,h){return a>g+e||e>c+a?!1:b>h+f||f>d+b?!1:!0}
t.v=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)};t.Zz=function(){return 0===this.width&&0===this.height};N.alloc=function(){var a=hc.pop();return void 0===a?new N:a};N.allocAt=function(a,b,c,d){var e=hc.pop();return void 0===e?new N(a,b,c,d):e.h(a,b,c,d)};N.free=function(a){hc.push(a)};
ma.Object.defineProperties(N.prototype,{left:{get:function(){return this.x},set:function(a){this.x=a}},top:{get:function(){return this.y},set:function(a){this.y=a}},right:{get:function(){return this.x+this.width},set:function(a){this.x+=a-(this.x+this.width)}},bottom:{get:function(){return this.y+this.height},set:function(a){this.y+=a-(this.y+this.height)}},position:{
get:function(){return new I(this.x,this.y)},set:function(a){this.x=a.x;this.y=a.y}},size:{get:function(){return new M(this.width,this.height)},set:function(a){this.width=a.width;this.height=a.height}},center:{get:function(){return new I(this.x+this.width/2,this.y+this.height/2)},set:function(a){this.x=a.x-this.width/2;this.y=a.y-this.height/2}},centerX:{get:function(){return this.x+this.width/2},
set:function(a){this.x=a-this.width/2}},centerY:{get:function(){return this.y+this.height/2},set:function(a){this.y=a-this.height/2}}});N.prototype.isEmpty=N.prototype.Zz;N.prototype.isReal=N.prototype.v;N.intersectsLineSegment=function(a,b,c,d,e,f,g,h){return K.iy(a,b,c,d,e,f,g,h)};N.prototype.setSpot=N.prototype.zk;N.prototype.union=N.prototype.Cw;N.prototype.unionRect=N.prototype.Jc;N.prototype.unionPoint=N.prototype.Ie;N.prototype.intersects=N.prototype.Ov;
N.prototype.intersectsRect=N.prototype.Ic;N.prototype.intersect=N.prototype.Nv;N.prototype.intersectRect=N.prototype.Xz;N.prototype.grow=N.prototype.Tz;N.prototype.subtractMargin=N.prototype.vw;N.prototype.addMargin=N.prototype.iq;N.prototype.inflate=N.prototype.Fc;N.prototype.offset=N.prototype.offset;N.prototype.contains=N.prototype.contains;N.prototype.containsRect=N.prototype.Ce;N.prototype.containsPoint=N.prototype.aa;N.prototype.equalsApprox=N.prototype.Ma;N.prototype.equalTo=N.prototype.Vi;
N.prototype.equals=N.prototype.w;N.prototype.setSize=N.prototype.AA;N.prototype.setPoint=N.prototype.jd;N.prototype.set=N.prototype.set;N.prototype.setTo=N.prototype.Bg;var ic=null,jc=null,hc=[];N.className="Rect";N.parse=Wb;N.stringify=Zb;N.contains=fc;N.intersects=gc;N.ZeroRect=ic=(new N(0,0,0,0)).ca();N.NoRect=jc=(new N(NaN,NaN,NaN,NaN)).ca();N.parse=Wb;N.stringify=Zb;N.contains=fc;N.intersects=gc;
function oc(a,b,c,d){void 0===a?this.left=this.bottom=this.right=this.top=0:void 0===b?this.left=this.bottom=this.right=this.top=a:void 0===c?(this.top=a,this.right=b,this.bottom=a,this.left=b):void 0!==d?(this.top=a,this.right=b,this.bottom=c,this.left=d):B("Invalid arguments to Margin constructor: "+a+", "+b+", "+c+", "+d);this.s=!1}oc.prototype.assign=function(a){this.top=a.top;this.right=a.right;this.bottom=a.bottom;this.left=a.left;return this};
oc.prototype.Bg=function(a,b,c,d){this.top=a;this.right=b;this.bottom=c;this.left=d;return this};oc.prototype.set=function(a){this.top=a.top;this.right=a.right;this.bottom=a.bottom;this.left=a.left;return this};oc.prototype.copy=function(){var a=new oc;a.top=this.top;a.right=this.right;a.bottom=this.bottom;a.left=this.left;return a};t=oc.prototype;t.ca=function(){this.s=!0;Object.freeze(this);return this};t.G=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};
t.freeze=function(){this.s=!0;return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.s=!1;return this};
function pc(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 oc;for(var e=NaN;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));if(isNaN(e))return new oc(c);for(var f=NaN;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));if(isNaN(f))return new oc(c,e);for(var g=NaN;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));return isNaN(g)?new oc(c,e):new oc(c,e,f,g)}return new oc}
function qc(a){return a.top.toString()+" "+a.right.toString()+" "+a.bottom.toString()+" "+a.left.toString()}t.toString=function(){return"Margin("+this.top+","+this.right+","+this.bottom+","+this.left+")"};t.w=function(a){return a instanceof oc?this.top===a.top&&this.right===a.right&&this.bottom===a.bottom&&this.left===a.left:!1};t.Vi=function(a,b,c,d){return this.top===a&&this.right===b&&this.bottom===c&&this.left===d};
t.Ma=function(a){return K.A(this.top,a.top)&&K.A(this.right,a.right)&&K.A(this.bottom,a.bottom)&&K.A(this.left,a.left)};t.v=function(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)};oc.alloc=function(){var a=rc.pop();return void 0===a?new oc:a};oc.free=function(a){rc.push(a)};oc.prototype.isReal=oc.prototype.v;oc.prototype.equalsApprox=oc.prototype.Ma;oc.prototype.equalTo=oc.prototype.Vi;oc.prototype.equals=oc.prototype.w;oc.prototype.set=oc.prototype.set;
oc.prototype.setTo=oc.prototype.Bg;var sc=null,tc=null,rc=[];oc.className="Margin";oc.parse=pc;oc.stringify=qc;oc.ZeroMargin=sc=(new oc(0,0,0,0)).ca();oc.TwoMargin=tc=(new oc(2,2,2,2)).ca();oc.parse=pc;oc.stringify=qc;function P(a,b,c,d){void 0===a?this.offsetY=this.offsetX=this.y=this.x=0:(void 0===b&&(b=0),void 0===c&&(c=0),void 0===d&&(d=0),this.x=a,this.y=b,this.offsetX=c,this.offsetY=d);this.s=!1}
var uc,vc,wc,yc,zc,Ac,Bc,Cc,Dc,Gc,Hc,Ic,Jc,Kc,Lc,Mc,Nc,Pc,Qc,Rc,Sc,Tc,Uc,Vc,Zc,$c,ad,bd,cd,dd,ed,fd,gd,hd,id,jd;P.prototype.assign=function(a){this.x=a.x;this.y=a.y;this.offsetX=a.offsetX;this.offsetY=a.offsetY;return this};P.prototype.Bg=function(a,b,c,d){this.x=a;this.y=b;this.offsetX=c;this.offsetY=d;return this};P.prototype.set=function(a){this.x=a.x;this.y=a.y;this.offsetX=a.offsetX;this.offsetY=a.offsetY;return this};
P.prototype.copy=function(){var a=new P;a.x=this.x;a.y=this.y;a.offsetX=this.offsetX;a.offsetY=this.offsetY;return a};t=P.prototype;t.ca=function(){this.s=!0;Object.freeze(this);return this};t.G=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.s=!1;return this};function kd(a,b){a.x=NaN;a.y=NaN;a.offsetX=b;return a}
function ld(a){if("string"===typeof a){a=a.trim();if("None"===a)return uc;if("TopLeft"===a)return vc;if("Top"===a||"TopCenter"===a||"MiddleTop"===a)return wc;if("TopRight"===a)return yc;if("Left"===a||"LeftCenter"===a||"MiddleLeft"===a)return zc;if("Center"===a)return Ac;if("Right"===a||"RightCenter"===a||"MiddleRight"===a)return Bc;if("BottomLeft"===a)return Cc;if("Bottom"===a||"BottomCenter"===a||"MiddleBottom"===a)return Dc;if("BottomRight"===a)return Gc;if("TopSide"===a)return Hc;if("LeftSide"===
a)return Ic;if("RightSide"===a)return Jc;if("BottomSide"===a)return Kc;if("TopBottomSides"===a)return Lc;if("LeftRightSides"===a)return Mc;if("TopLeftSides"===a)return Nc;if("TopRightSides"===a)return Pc;if("BottomLeftSides"===a)return Qc;if("BottomRightSides"===a)return Rc;if("NotTopSide"===a)return Sc;if("NotLeftSide"===a)return Tc;if("NotRightSide"===a)return Uc;if("NotBottomSide"===a)return Vc;if("AllSides"===a)return Zc;if("Default"===a)return $c;a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;
var d=a[b++];void 0!==d&&0<d.length&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(e=parseFloat(d));for(var f=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(f=parseFloat(d));for(var g=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(g=parseFloat(d));return new P(c,e,f,g)}return new P}function md(a){return a.hb()?a.x.toString()+" "+a.y.toString()+" "+a.offsetX.toString()+" "+a.offsetY.toString():a.toString()}
t.toString=function(){return this.hb()?0===this.offsetX&&0===this.offsetY?"Spot("+this.x+","+this.y+")":"Spot("+this.x+","+this.y+","+this.offsetX+","+this.offsetY+")":this.w(uc)?"None":this.w(vc)?"TopLeft":this.w(wc)?"Top":this.w(yc)?"TopRight":this.w(zc)?"Left":this.w(Ac)?"Center":this.w(Bc)?"Right":this.w(Cc)?"BottomLeft":this.w(Dc)?"Bottom":this.w(Gc)?"BottomRight":this.w(Hc)?"TopSide":this.w(Ic)?"LeftSide":this.w(Jc)?"RightSide":this.w(Kc)?"BottomSide":this.w(Lc)?"TopBottomSides":this.w(Mc)?
"LeftRightSides":this.w(Nc)?"TopLeftSides":this.w(Pc)?"TopRightSides":this.w(Qc)?"BottomLeftSides":this.w(Rc)?"BottomRightSides":this.w(Sc)?"NotTopSide":this.w(Tc)?"NotLeftSide":this.w(Uc)?"NotRightSide":this.w(Vc)?"NotBottomSide":this.w(Zc)?"AllSides":this.w($c)?"Default":"None"};t.w=function(a){return a instanceof P?(this.x===a.x||isNaN(this.x)&&isNaN(a.x))&&(this.y===a.y||isNaN(this.y)&&isNaN(a.y))&&this.offsetX===a.offsetX&&this.offsetY===a.offsetY:!1};
t.Zv=function(){return new P(.5-(this.x-.5),.5-(this.y-.5),-this.offsetX,-this.offsetY)};t.xf=function(a){if(!this.gd())return!1;if(!a.gd())if(a.w(ad))a=Ic;else if(a.w(bd))a=Jc;else if(a.w(cd))a=Hc;else if(a.w(dd))a=Kc;else return!1;a=a.offsetY;return(this.offsetY&a)===a};t.hb=function(){return!isNaN(this.x)&&!isNaN(this.y)};t.kc=function(){return isNaN(this.x)||isNaN(this.y)};t.gd=function(){return isNaN(this.x)&&isNaN(this.y)&&1===this.offsetX&&0!==this.offsetY};
t.Ht=function(){return isNaN(this.x)&&isNaN(this.y)&&0===this.offsetX&&0===this.offsetY};t.Nb=function(){return isNaN(this.x)&&isNaN(this.y)&&-1===this.offsetX&&0===this.offsetY};P.alloc=function(){var a=nd.pop();return void 0===a?new P:a};P.free=function(a){nd.push(a)};P.prototype.isDefault=P.prototype.Nb;P.prototype.isNone=P.prototype.Ht;P.prototype.isSide=P.prototype.gd;P.prototype.isNoSpot=P.prototype.kc;P.prototype.isSpot=P.prototype.hb;P.prototype.includesSide=P.prototype.xf;
P.prototype.opposite=P.prototype.Zv;P.prototype.equals=P.prototype.w;P.prototype.set=P.prototype.set;P.prototype.setTo=P.prototype.Bg;var nd=[];P.className="Spot";P.parse=ld;P.stringify=md;P.None=uc=kd(new P(0,0,0,0),0).ca();P.Default=$c=kd(new P(0,0,-1,0),-1).ca();P.TopLeft=vc=(new P(0,0,0,0)).ca();P.TopCenter=wc=(new P(.5,0,0,0)).ca();P.TopRight=yc=(new P(1,0,0,0)).ca();P.LeftCenter=zc=(new P(0,.5,0,0)).ca();P.Center=Ac=(new P(.5,.5,0,0)).ca();P.RightCenter=Bc=(new P(1,.5,0,0)).ca();
P.BottomLeft=Cc=(new P(0,1,0,0)).ca();P.BottomCenter=Dc=(new P(.5,1,0,0)).ca();P.BottomRight=Gc=(new P(1,1,0,0)).ca();P.MiddleTop=ed=wc;P.MiddleLeft=fd=zc;P.MiddleRight=gd=Bc;P.MiddleBottom=hd=Dc;P.Top=cd=wc;P.Left=ad=zc;P.Right=bd=Bc;P.Bottom=dd=Dc;P.TopSide=Hc=kd(new P(0,0,1,1),1).ca();P.LeftSide=Ic=kd(new P(0,0,1,2),1).ca();P.RightSide=Jc=kd(new P(0,0,1,4),1).ca();P.BottomSide=Kc=kd(new P(0,0,1,8),1).ca();P.TopBottomSides=Lc=kd(new P(0,0,1,9),1).ca();P.LeftRightSides=Mc=kd(new P(0,0,1,6),1).ca();
P.TopLeftSides=Nc=kd(new P(0,0,1,3),1).ca();P.TopRightSides=Pc=kd(new P(0,0,1,5),1).ca();P.BottomLeftSides=Qc=kd(new P(0,0,1,10),1).ca();P.BottomRightSides=Rc=kd(new P(0,0,1,12),1).ca();P.NotTopSide=Sc=kd(new P(0,0,1,14),1).ca();P.NotLeftSide=Tc=kd(new P(0,0,1,13),1).ca();P.NotRightSide=Uc=kd(new P(0,0,1,11),1).ca();P.NotBottomSide=Vc=kd(new P(0,0,1,7),1).ca();P.AllSides=Zc=kd(new P(0,0,1,15),1).ca();id=(new P(.156,.156)).ca();jd=(new P(.844,.844)).ca();P.parse=ld;P.stringify=md;
function qd(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0}qd.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};qd.prototype.copy=function(){var a=new qd;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=qd.prototype;t.toString=function(){return"Transform("+this.m11+","+this.m12+","+this.m21+","+this.m22+","+this.dx+","+this.dy+")"};
t.w=function(a){return this.m11===a.m11&&this.m12===a.m12&&this.m21===a.m21&&this.m22===a.m22&&this.dx===a.dx&&this.dy===a.dy};t.Ft=function(){return 0===this.dx&&0===this.dy&&1===this.m11&&0===this.m12&&0===this.m21&&1===this.m22};t.reset=function(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0;return this};
t.multiply=function(a){var b=this.m11*a.m11+this.m21*a.m12,c=this.m12*a.m11+this.m22*a.m12,d=this.m11*a.m21+this.m21*a.m22,e=this.m12*a.m21+this.m22*a.m22;this.dx=this.m11*a.dx+this.m21*a.dy+this.dx;this.dy=this.m12*a.dx+this.m22*a.dy+this.dy;this.m11=b;this.m12=c;this.m21=d;this.m22=e;return this};
t.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.Et=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};
qd.prototype.rotate=function(a,b,c){360<=a?a-=360:0>a&&(a+=360);if(0===a)return this;this.translate(b,c);if(90===a){a=0;var d=1}else 180===a?(a=-1,d=0):270===a?(a=0,d=-1):(d=a*Math.PI/180,a=Math.cos(d),d=Math.sin(d));var e=this.m12*a+this.m22*d,f=this.m11*-d+this.m21*a,g=this.m12*-d+this.m22*a;this.m11=this.m11*a+this.m21*d;this.m12=e;this.m21=f;this.m22=g;this.translate(-b,-c);return this};t=qd.prototype;t.translate=function(a,b){this.dx+=this.m11*a+this.m21*b;this.dy+=this.m12*a+this.m22*b;return this};
t.scale=function(a,b){void 0===b&&(b=a);this.m11*=a;this.m12*=a;this.m21*=b;this.m22*=b;return this};t.ra=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.Xd=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.x,c=a.y,d=b+a.width,e=c+a.height,f=this.m11,g=this.m12,h=this.m21,k=this.m22,l=this.dx,m=this.dy,n=b*f+c*h+l,p=b*g+c*k+m,r=d*f+c*h+l,q=d*g+c*k+m;c=b*f+e*h+l;b=b*g+e*k+m;f=d*f+e*h+l;d=d*g+e*k+m;e=Math.min(n,r);n=Math.max(n,r);r=Math.min(p,q);p=Math.max(p,q);e=Math.min(e,c);n=Math.max(n,c);r=Math.min(r,b);p=Math.max(p,b);e=Math.min(e,f);n=Math.max(n,f);r=Math.min(r,d);p=Math.max(p,d);a.h(e,r,n-e,p-r);return a};qd.alloc=function(){var a=rd.pop();return void 0===a?new qd:a};
qd.free=function(a){rd.push(a)};qd.prototype.transformRect=qd.prototype.Bw;qd.prototype.invertedTransformPoint=qd.prototype.Xd;qd.prototype.transformPoint=qd.prototype.ra;qd.prototype.scale=qd.prototype.scale;qd.prototype.translate=qd.prototype.translate;qd.prototype.rotate=qd.prototype.rotate;qd.prototype.invert=qd.prototype.Et;qd.prototype.multiplyInverted=qd.prototype.Vv;qd.prototype.multiply=qd.prototype.multiply;qd.prototype.reset=qd.prototype.reset;qd.prototype.isIdentity=qd.prototype.Ft;
qd.prototype.equals=qd.prototype.w;qd.prototype.set=qd.prototype.set;var rd=[];qd.className="Transform";qd.xF="54a702f3e53909c447824c6706603faf4c";
var K={JA:"7da71ca0ad381e90",Eg:(Math.sqrt(2)-1)/3*4,Rw:null,sqrt:function(a){if(0>=a)return 0;var b=K.Rw;if(null===b){b=[];for(var c=0;2E3>=c;c++)b[c]=Math.sqrt(c);K.Rw=b}return 1>a?(c=1/a,2E3>=c?1/b[c|0]:Math.sqrt(a)):2E3>=a?b[a|0]:Math.sqrt(a)},A:function(a,b){a-=b;return.5>a&&-.5<a},$:function(a,b){a-=b;return 5E-8>a&&-5E-8<a},Ob: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},lt:function(a,b,c,d,e,f,g,h,k,l,m,n){if(K.Ob(a,b,g,h,n,c,d)&&K.Ob(a,b,g,h,n,e,f))return K.Ob(a,b,g,h,n,l,m);var p=(a+c)/2,r=(b+d)/2,q=(c+e)/2,u=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(p+q)/2;c=(r+u)/2;q=(q+e)/2;u=(u+f)/2;var v=(d+q)/2,w=(c+u)/2;return K.lt(a,
b,p,r,d,c,v,w,k,l,m,n)||K.lt(v,w,q,u,e,f,g,h,k,l,m,n)},az: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},$y:function(a,b,c,d,e,f,g,h){var k=(c+e)/2,l=(d+f)/2;return Db(((a+c)/2+k)/2,((b+d)/2+l)/2,(k+(e+g)/2)/2,(l+(f+h)/2)/2)},dm:function(a,b,c,d,e,f,g,h,k,l){if(K.Ob(a,b,g,h,k,c,d)&&K.Ob(a,b,g,h,k,e,f))ec(l,a,b,0,0),ec(l,g,h,0,0);else{var m=(a+c)/2,n=(b+d)/2,p=(c+e)/2,r=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(m+p)/2;c=(n+r)/
2;p=(p+e)/2;r=(r+f)/2;var q=(d+p)/2,u=(c+r)/2;K.dm(a,b,m,n,d,c,q,u,k,l);K.dm(q,u,p,r,e,f,g,h,k,l)}return l},Be:function(a,b,c,d,e,f,g,h,k,l){if(K.Ob(a,b,g,h,k,c,d)&&K.Ob(a,b,g,h,k,e,f))0===l.length&&(l.push(a),l.push(b)),l.push(g),l.push(h);else{var m=(a+c)/2,n=(b+d)/2,p=(c+e)/2,r=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(m+p)/2;c=(n+r)/2;p=(p+e)/2;r=(r+f)/2;var q=(d+p)/2,u=(c+r)/2;K.Be(a,b,m,n,d,c,q,u,k,l);K.Be(q,u,p,r,e,f,g,h,k,l)}return l},bw:function(a,b,c,d,e,f,g,h,k,l){if(K.Ob(a,b,e,f,l,c,d))return K.Ob(a,
b,e,f,l,h,k);var m=(a+c)/2,n=(b+d)/2;c=(c+e)/2;d=(d+f)/2;var p=(m+c)/2,r=(n+d)/2;return K.bw(a,b,m,n,p,r,g,h,k,l)||K.bw(p,r,c,d,e,f,g,h,k,l)},PA: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},aw:function(a,b,c,d,e,f,g,h){if(K.Ob(a,b,e,f,g,c,d))ec(h,a,b,0,0),ec(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.aw(a,b,k,l,m,n,g,h);K.aw(m,n,c,d,e,f,g,h)}return h},Kq:function(a,b,c,d,e,f,g,h){if(K.Ob(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.Kq(a,b,k,l,m,n,g,h);K.Kq(m,n,c,d,e,f,g,h)}return h},kq:function(a,b,c,d,e,f,g,h,k,l,m,n,p,r){if(K.Ob(a,b,g,h,p,c,d)&&K.Ob(a,b,g,h,p,e,f)){if(a<k&&g<k&&a<m&&g<m||a>k&&g>k&&a>m&&g>m||b<l&&h<l&&b<n&&h<n||b>l&&h>l&&b>n&&h>n)return!1;var q=(a-g)*(l-n)-(b-h)*(k-m);if(0===q)return!1;p=((a*h-b*g)*(k-m)-(a-g)*(k*n-l*m))/q;q=((a*h-b*g)*(l-n)-(b-h)*(k*n-l*m))/q;if((k>m?k-m:m-k)<(l>n?l-n:n-l)){if(b<h?g=b:
(g=h,h=b),q<g||q>h)return!1}else if(a<g?h=a:(h=g,g=a),p<h||p>g)return!1;r.h(p,q);return!0}q=(a+c)/2;var u=(b+d)/2,v=(c+e)/2,w=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(q+v)/2;c=(u+w)/2;v=(v+e)/2;w=(w+f)/2;var y=(d+v)/2,z=(c+w)/2,A=(m-k)*(m-k)+(n-l)*(n-l),C=!1,G=0,L=0;K.kq(a,b,q,u,d,c,y,z,k,l,m,n,p,r)&&(a=(r.x-k)*(r.x-k)+(r.y-l)*(r.y-l),a<A&&(A=a,C=!0,G=r.x,L=r.y));K.kq(y,z,v,w,e,f,g,h,k,l,m,n,p,r)&&(r.x-k)*(r.x-k)+(r.y-l)*(r.y-l)<A&&(C=!0,G=r.x,L=r.y);C&&(r.x=G,r.y=L);return C},lq:function(a,b,c,d,e,f,g,h,k,
l,m,n,p){var r=0;if(K.Ob(a,b,g,h,p,c,d)&&K.Ob(a,b,g,h,p,e,f)){p=(a-g)*(l-n)-(b-h)*(k-m);if(0===p)return r;var q=((a*h-b*g)*(k-m)-(a-g)*(k*n-l*m))/p,u=((a*h-b*g)*(l-n)-(b-h)*(k*n-l*m))/p;if(q>=m)return r;if((k>m?k-m:m-k)<(l>n?l-n:n-l)){if(b<h?(a=b,b=h):a=h,u<a||u>b)return r}else if(a<g?(b=a,a=g):b=g,q<b||q>a)return r;0<p?r++:0>p&&r--}else{q=(a+c)/2;u=(b+d)/2;var v=(c+e)/2,w=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(q+v)/2;c=(u+w)/2;v=(v+e)/2;w=(w+f)/2;var y=(d+v)/2,z=(c+w)/2;r+=K.lq(a,b,q,u,d,c,y,z,k,l,m,n,p);
r+=K.lq(y,z,v,w,e,f,g,h,k,l,m,n,p)}return r},Kh:function(a,b,c,d,e,f,g){if(K.$(a,c)){b<d?(c=b,b=d):c=d;if(f<c)return g.h(a,c),!1;if(f>b)return g.h(a,b),!1;g.h(a,f);return!0}if(K.$(b,d)){a<c?(d=a,a=c):d=c;if(e<d)return g.h(d,b),!1;if(e>a)return g.h(a,b),!1;g.h(e,b);return!0}e=((a-e)*(a-c)+(b-f)*(b-d))/((c-a)*(c-a)+(d-b)*(d-b));if(-5E-6>e)return g.h(a,b),!1;if(1.000005<e)return g.h(c,d),!1;g.h(a+e*(c-a),b+e*(d-b));return!0},Ge:function(a,b,c,d,e,f,g,h,k){if(K.A(a,c)&&K.A(b,d))return k.h(a,b),!1;if(K.$(e,
g))return K.$(a,c)?(K.Kh(a,b,c,d,e,f,k),!1):K.Kh(a,b,c,d,e,(d-b)/(c-a)*(e-a)+b,k);h=(h-f)/(g-e);if(K.$(a,c)){c=h*(a-e)+f;b<d?(e=b,b=d):e=d;if(c<e)return k.h(a,e),!1;if(c>b)return k.h(a,b),!1;k.h(a,c);return!0}g=(d-b)/(c-a);if(K.$(h,g))return K.Kh(a,b,c,d,e,f,k),!1;e=(g*a-h*e+f-b)/(g-h);if(K.$(g,0)){a<c?(d=a,a=c):d=c;if(e<d)return k.h(d,b),!1;if(e>a)return k.h(a,b),!1;k.h(e,b);return!0}return K.Kh(a,b,c,d,e,g*(e-a)+b,k)},OA:function(a,b,c,d,e){return K.Ge(c.x,c.y,d.x,d.y,a.x,a.y,b.x,b.y,e)},NA:function(a,
b,c,d,e,f,g,h,k,l){function m(c,d){var e=(c-a)*(c-a)+(d-b)*(d-b);e<n&&(n=e,k.h(c,d))}var n=Infinity;m(k.x,k.y);var p=0,r=0,q=0,u=0;e<g?(p=e,r=g):(p=g,r=e);f<h?(q=e,u=g):(q=g,u=e);p=(r-p)/2+l;l=(u-q)/2+l;e=(e+g)/2;f=(f+h)/2;if(0===p||0===l)return k;if(.5>(c>a?c-a:a-c)){p=1-(c-e)*(c-e)/(p*p);if(0>p)return k;p=Math.sqrt(p);d=-l*p+f;m(c,l*p+f);m(c,d)}else{c=(d-b)/(c-a);d=1/(p*p)+c*c/(l*l);h=2*c*(b-c*a)/(l*l)-2*c*f/(l*l)-2*e/(p*p);p=h*h-4*d*(2*c*a*f/(l*l)-2*b*f/(l*l)+f*f/(l*l)+e*e/(p*p)-1+(b-c*a)*(b-c*
a)/(l*l));if(0>p)return k;p=Math.sqrt(p);l=(-h+p)/(2*d);m(l,c*l-c*a+b);p=(-h-p)/(2*d);m(p,c*p-c*a+b)}return k},Vc:function(a,b,c,d,e,f,g,h,k){var l=1E21,m=a,n=b;if(K.Ge(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.Ge(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.Ge(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.Ge(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},MA: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},Ct:function(a,b,c){return K.iy(a.x,a.y,a.width,a.height,b.x,b.y,c.x,c.y)},iy:function(a,b,c,d,e,f,g,h){var k=a+c,l=b+d;return e===g?(f<h?(g=f,f=h):g=h,a<=e&&e<=k&&g<=l&&f>=b):f===h?(e<g?(h=e,e=g):h=g,b<=f&&f<=l&&h<=k&&e>=a):fc(a,b,c,d,e,f)||fc(a,b,c,d,g,h)||K.Aq(a,b,k,b,e,f,g,h)||
K.Aq(k,b,k,l,e,f,g,h)||K.Aq(k,l,a,l,e,f,g,h)||K.Aq(a,l,a,b,e,f,g,h)?!0:!1},Aq:function(a,b,c,d,e,f,g,h){return 0>=K.ot(a,b,c,d,e,f)*K.ot(a,b,c,d,g,h)&&0>=K.ot(e,f,g,h,a,b)*K.ot(e,f,g,h,c,d)},ot: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},Hq:function(a){0>a&&(a+=360);360<=a&&(a-=360);return a},Ox: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.hz(c,l,e,a,b)),d-=Math.abs(e-l),l=e;return f},hz: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)]},sq: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},Yx: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},mz: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.nz(k,0===g?a:b,l,c,0,0)},nz: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},Je:new db,Qm:new db,Oh:new db,Ph:0};K.za=K.JA;
function sd(a){Ya(this);this.s=!1;void 0===a&&(a=td);this.pa=a;this.nc=this.ec=this.Tc=this.Sc=0;this.uj=new E;this.Mr=this.uj.Aa;this.ur=(new N).freeze();this.qa=!0;this.Xm=this.Ik=null;this.Ym=NaN;this.hf=vc;this.jf=Gc;this.kl=this.ll=NaN;this.Nf=ud}
sd.prototype.copy=function(){var a=new sd;a.pa=this.pa;a.Sc=this.Sc;a.Tc=this.Tc;a.ec=this.ec;a.nc=this.nc;for(var b=this.uj.j,c=b.length,d=a.uj,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.Mr=this.Mr;a.ur.assign(this.ur);a.qa=this.qa;a.Ik=this.Ik;a.Xm=this.Xm;a.Ym=this.Ym;a.hf=this.hf.G();a.jf=this.jf.G();a.ll=this.ll;a.kl=this.kl;a.Nf=this.Nf;return a};t=sd.prototype;t.ca=function(){this.freeze();Object.freeze(this);return this};
t.freeze=function(){this.s=!0;var a=this.figures;a.freeze();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].freeze();return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.s=!1;var a=this.figures;a.ea();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].ea();return this};
t.Ma=function(a){if(!(a instanceof sd))return!1;if(this.type!==a.type)return this.type===vd&&a.type===td?wd(this,a):a.type===vd&&this.type===td?wd(a,this):!1;if(this.type===td){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].Ma(a[d]))return!1;return!0}return K.A(this.startX,a.startX)&&K.A(this.startY,a.startY)&&K.A(this.endX,a.endX)&&K.A(this.endY,a.endY)};
function wd(a,b){return a.type!==vd||b.type!==td?!1:1===b.figures.count&&(b=b.figures.L(0),1===b.segments.count&&K.A(a.startX,b.startX)&&K.A(a.startY,b.startY)&&(b=b.segments.L(0),b.type===xd&&K.A(a.endX,b.endX)&&K.A(a.endY,b.endY)))?!0:!1}function yd(a){return a.toString()}t.gb=function(a){a.classType===sd&&(this.type=a)};
t.toString=function(a){void 0===a&&(a=-1);switch(this.type){case vd: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 zd:var b=new N(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 Hd:b=new N(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 td: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 Id(a,b){function c(){return u>=A-1?!0:null!==k[u+1].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/)}function d(){u++;return k[u]}function e(){var a=new I(parseFloat(d()),parseFloat(d()));v===v.toLowerCase()&&(a.x=z.x+a.x,a.y=z.y+a.y);return a}function f(){return z=e()}function g(){return y=e()}function h(){var a=w.toLowerCase();return"c"!==a&&"s"!==a&&"q"!==a&&"t"!==a?z:new I(2*z.x-y.x,2*z.y-y.y)}void 0===b&&(b=!1);a=a.replace(/,/gm," ");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,
"$1 $2");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,"$1 $2");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([^\s])/gm,"$1 $2");a=a.replace(/([^\s])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,"$1 $2");a=a.replace(/([0-9])([+\-])/gm,"$1 $2");a=a.replace(/([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=
Fa(),n="",p=!1,r=0;r<l.length;r++){var q=l[r];"."!==q||p?"."===q?(m.push(n),n="."):n+=q:(p=!0,n+=q)}m.push(n);k.splice(a,1);for(l=0;l<m.length;l++)k.splice(a+l,0,m[l]);a+=m.length-1;Ha(m)}}var u=-1,v="",w="";m=new I(0,0);var y=new I(0,0),z=new I(0,0),A=k.length;a=Jd(null);n=l=!1;p=!0;for(r=null;!(u>=A-1);)if(w=v,v=d(),""!==v)switch(v.toUpperCase()){case "X":p=!0;n=l=!1;break;case "M":r=f();null===a.fc||!0===p?(Kd(a,r.x,r.y,l,!n),p=!1):a.moveTo(r.x,r.y);for(m=z;!c();)r=f(),a.lineTo(r.x,r.y);break;
case "L":for(;!c();)r=f(),a.lineTo(r.x,r.y);break;case "H":for(;!c();)z=new I((v===v.toLowerCase()?z.x:0)+parseFloat(d()),z.y),a.lineTo(z.x,z.y);break;case "V":for(;!c();)z=new I(z.x,(v===v.toLowerCase()?z.y:0)+parseFloat(d())),a.lineTo(z.x,z.y);break;case "C":for(;!c();){r=e();q=g();var C=f();Ld(a,r.x,r.y,q.x,q.y,C.x,C.y)}break;case "S":for(;!c();)r=h(),q=g(),C=f(),Ld(a,r.x,r.y,q.x,q.y,C.x,C.y);break;case "Q":for(;!c();)r=g(),q=f(),Md(a,r.x,r.y,q.x,q.y);break;case "T":for(;!c();)y=r=h(),q=f(),Md(a,
r.x,r.y,q.x,q.y);break;case "B":for(;!c();){r=parseFloat(d());q=parseFloat(d());C=parseFloat(d());var G=parseFloat(d()),L=parseFloat(d()),J=L,U=!1;c()||(J=parseFloat(d()),c()||(U=0!==parseFloat(d())));v===v.toLowerCase()&&(C+=z.x,G+=z.y);a.arcTo(r,q,C,G,L,J,U)}break;case "A":for(;!c();)r=Math.abs(parseFloat(d())),q=Math.abs(parseFloat(d())),C=parseFloat(d()),G=!!parseFloat(d()),L=!!parseFloat(d()),J=f(),Rd(a,r,q,C,G,L,J.x,J.y);break;case "Z":Sd(a);z=m;break;case "F":r="";for(q=1;k[u+q];)if(null!==
k[u+q].match(/[Uu]/))q++;else if(null===k[u+q].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/))q++;else{r=k[u+q];break}r.match(/[Mm]/)?l=!0:0<a.fc.segments.length&&(a.fc.isFilled=!0);break;case "U":r="";for(q=1;k[u+q];)if(null!==k[u+q].match(/[Ff]/))q++;else if(null===k[u+q].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/))q++;else{r=k[u+q];break}r.match(/[Mm]/)?n=!0:a.Uq(!1)}m=a.xt;Td=a;if(b)for(b=m.figures.iterator;b.next();)b.value.isFilled=!0;return m}
function Ud(a,b){for(var c=a.length,d=I.alloc(),e=0;e<c;e++){var f=a[e];d.x=f[0];d.y=f[1];b.ra(d);f[0]=d.x;f[1]=d.y;d.x=f[2];d.y=f[3];b.ra(d);f[2]=d.x;f[3]=d.y;d.x=f[4];d.y=f[5];b.ra(d);f[4]=d.x;f[5]=d.y;d.x=f[6];d.y=f[7];b.ra(d);f[6]=d.x;f[7]=d.y}I.free(d)}t.Sv=function(){if(this.qa||this.Mr!==this.figures.Aa)return!0;for(var a=this.figures.j,b=a.length,c=0;c<b;c++)if(a[c].Sv())return!0;return!1};
sd.prototype.computeBounds=function(){this.qa=!1;this.Xm=this.Ik=null;this.Ym=NaN;this.Mr=this.figures.Aa;for(var a=this.figures.j,b=a.length,c=0;c<b;c++){var d=a[c];d.qa=!1;var e=d.segments;d.Ts=e.Aa;d=e.j;e=d.length;for(var f=0;f<e;f++){var g=d[f];g.qa=!1;g.Le=null}}a=this.ur;a.ea();isNaN(this.ll)||isNaN(this.kl)?a.h(0,0,0,0):a.h(0,0,this.ll,this.kl);Vd(this,a,!1);ec(a,0,0,0,0);a.freeze()};sd.prototype.Nx=function(){var a=new N;Vd(this,a,!0);return a};
function Vd(a,b,c){switch(a.type){case vd:case zd:case Hd:c?b.h(a.Sc,a.Tc,0,0):ec(b,a.Sc,a.Tc,0,0);ec(b,a.ec,a.nc,0,0);break;case td: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):ec(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 xd:case Wd:k=n.endX;l=n.endY;ec(b,k,l,0,0);break;case Xd:K.dm(k,l,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.5,b);k=n.endX;l=n.endY;
break;case Yd:K.aw(k,l,n.point1X,n.point1Y,n.endX,n.endY,.5,b);k=n.endX;l=n.endY;break;case Zd:case $d:var p=n.type===Zd?ae(n,f):be(n,f,k,l),r=p.length;if(0===r){k=n.centerX;l=n.centerY;ec(b,k,l,0,0);break}n=null;for(var q=0;q<r;q++)n=p[q],K.dm(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],.5,b);null!==n&&(k=n[6],l=n[7]);break;default:B("Unknown Segment type: "+n.type)}}}break;default:B("Unknown Geometry type: "+a.type)}}
sd.prototype.normalize=function(){this.s&&ua(this);var a=this.Nx();this.offset(-a.x,-a.y);return new I(-a.x,-a.y)};sd.prototype.offset=function(a,b){this.s&&ua(this);this.transform(1,0,0,1,a,b);return this};sd.prototype.scale=function(a,b){this.s&&ua(this);this.transform(a,0,0,b,0,0);return this};sd.prototype.rotate=function(a,b,c){this.s&&ua(this);void 0===b&&(b=0);void 0===c&&(c=0);var d=qd.alloc();d.reset();d.rotate(a,b,c);this.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);qd.free(d);return this};
t=sd.prototype;
t.transform=function(a,b,c,d,e,f){switch(this.type){case vd:case zd:case Hd:var g=this.Sc;var h=this.Tc;this.Sc=g*a+h*c+e;this.Tc=g*b+h*d+f;g=this.ec;h=this.nc;this.ec=g*a+h*c+e;this.nc=g*b+h*d+f;break;case td:for(var k=this.figures.j,l=k.length,m=0;m<l;m++){var n=k[m];g=n.startX;h=n.startY;n.startX=g*a+h*c+e;n.startY=g*b+h*d+f;n=n.segments.j;for(var p=n.length,r=0;r<p;r++){var q=n[r];switch(q.type){case xd:case Wd:g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case Xd:g=q.point1X;h=q.point1Y;
q.point1X=g*a+h*c+e;q.point1Y=g*b+h*d+f;g=q.point2X;h=q.point2Y;q.point2X=g*a+h*c+e;q.point2Y=g*b+h*d+f;g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case Yd:g=q.point1X;h=q.point1Y;q.point1X=g*a+h*c+e;q.point1Y=g*b+h*d+f;g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case Zd:g=q.centerX;h=q.centerY;q.centerX=g*a+h*c+e;q.centerY=g*b+h*d+f;0!==b&&(g=180*Math.atan2(b,a)/Math.PI,0>g&&(g+=360),q.startAngle+=g);0>a&&(q.startAngle=180-q.startAngle,q.sweepAngle=-q.sweepAngle);0>d&&
(q.startAngle=-q.startAngle,q.sweepAngle=-q.sweepAngle);q.radiusX*=Math.sqrt(a*a+c*c);void 0!==q.radiusY&&(q.radiusY*=Math.sqrt(b*b+d*d));break;case $d:g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;0!==b&&(g=180*Math.atan2(b,a)/Math.PI,0>g&&(g+=360),q.xAxisRotation+=g);0>a&&(q.xAxisRotation=180-q.xAxisRotation,q.isClockwiseArc=!q.isClockwiseArc);0>d&&(q.xAxisRotation=-q.xAxisRotation,q.isClockwiseArc=!q.isClockwiseArc);q.radiusX*=Math.sqrt(a*a+c*c);q.radiusY*=Math.sqrt(b*b+d*d);break;default:B("Unknown Segment type: "+
q.type)}}}}this.qa=!0;return this};
t.aa=function(a,b){void 0===b&&(b=0);var c=this.Sc,d=this.Tc,e=this.ec,f=this.nc;switch(this.type){case vd:return K.Ob(c,d,e,f,b,a.x,a.y);case zd:var g=N.allocAt(Math.min(c,e)-b,Math.min(d,f)-b,Math.abs(e-c)+2*b,Math.abs(f-d)+2*b);a=g.aa(a);N.free(g);return a;case Hd:g=Math.min(c,e)-b;var h=Math.min(d,f)-b;c=(Math.abs(e-c)+2*b)/2;b=(Math.abs(f-d)+2*b)/2;if(0>=c||0>=b)return!1;g=a.x-(g+c);h=a.y-(h+b);return 1>=g*g/(c*c)+h*h/(b*b);case td:return ce(this,a,b,!0,!1);default:return!1}};
function ce(a,b,c,d,e){var f=b.x;b=b.y;for(var g=a.bounds.x-20,h=0,k,l,m,n,p=a.figures.j,r=p.length,q=0;q<r;q++){var u=p[q];if(u.isFilled){if(d&&u.aa(f,b,c))return!0;var v=u.segments;k=u.startX;l=u.startY;for(var w=k,y=l,z=v.j,A=0;A<=v.length;A++){var C=void 0;if(A!==v.length){C=z[A];var G=C.type;a=C.endX;n=C.endY}else G=xd,a=w,n=y;switch(G){case Wd:w=de(f,b,g,b,k,l,w,y);if(isNaN(w))return!0;h+=w;w=a;y=n;break;case xd:k=de(f,b,g,b,k,l,a,n);if(isNaN(k))return!0;h+=k;break;case Xd:m=K.lq(k,l,C.point1X,
C.point1Y,C.point2X,C.point2Y,a,n,g,b,f,b,.5);h+=m;break;case Yd:m=K.lq(k,l,(k+2*C.point1X)/3,(l+2*C.point1Y)/3,(2*C.point1X+a)/3,(2*C.point1Y+n)/3,a,n,g,b,f,b,.5);h+=m;break;case Zd:case $d:G=C.type===Zd?ae(C,u):be(C,u,k,l);var L=G.length;if(0===L){k=de(f,b,g,b,k,l,C.centerX,C.centerY);if(isNaN(k))return!0;h+=k;break}C=null;for(var J=0;J<L;J++){C=G[J];if(0===J){m=de(f,b,g,b,k,l,C[0],C[1]);if(isNaN(m))return!0;h+=m}m=K.lq(C[0],C[1],C[2],C[3],C[4],C[5],C[6],C[7],g,b,f,b,.5);h+=m}null!==C&&(a=C[6],
n=C[7]);break;default:B("Unknown Segment type: "+C.type)}k=a;l=n}if(0!==h)return!0;h=0}else if(u.aa(f,b,e?c:c+2))return!0}return 0!==h}function de(a,b,c,d,e,f,g,h){if(K.Ob(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 ee(a,b,c,d){a=a.figures.j;for(var e=a.length,f=0;f<e;f++)if(a[f].aa(b,c,d))return!0;return!1}
t.Iv=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=new I);if(this.type===vd)return b.h(this.startX+a*(this.endX-this.startX),this.startY+a*(this.endY-this.startY)),b;for(var c=this.flattenedSegments,d=this.flattenedLengths,e=c.length,f=this.flattenedTotalLength*a,g=0,h=0;h<e;h++){var k=d[h],l=k.length;for(a=0;a<l;a++){var m=k[a];if(g+m>=f)return d=f-g,d=0===m?0:d/m,c=c[h],h=c[2*a],e=c[2*a+1],b.h(h+(c[2*a+2]-h)*d,e+(c[2*a+3]-e)*d),b;g+=m}}return b};
t.Zx=function(a){0>a?a=0:1<a&&(a=1);if(this.type===vd)return 180*Math.atan2(this.endY-this.startY,this.endX-this.startX)/Math.PI;for(var b=this.flattenedSegments,c=this.flattenedLengths,d=b.length,e=this.flattenedTotalLength*a,f=0,g=0;g<d;g++){var h=c[g],k=h.length;for(a=0;a<k;a++){var l=h[a];if(f+l>=e)return e=b[g],b=e[2*a],c=e[2*a+1],d=e[2*a+2],a=e[2*a+3],1>Math.abs(d-b)&&1>Math.abs(a-c)?0:1>Math.abs(d-b)?0<=a-c?90:270:1>Math.abs(a-c)?0<=d-b?0:180:180*Math.atan2(a-c,d-b)/Math.PI;f+=l}}return NaN};
t.Jv=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=[]);b.length=3;if(this.type===vd)return b[0]=this.startX+a*(this.endX-this.startX),b[1]=this.startY+a*(this.endY-this.startY),b[2]=180*Math.atan2(this.endY-this.startY,this.endX-this.startX)/Math.PI,b;for(var c=this.flattenedSegments,d=this.flattenedLengths,e=c.length,f=this.flattenedTotalLength*a,g=0,h=0;h<e;h++){var k=d[h],l=k.length;for(a=0;a<l;a++){var m=k[a];if(g+m>=f)return d=f-g,d=0===m?0:d/m,m=c[h],c=m[2*a],h=m[2*a+1],e=m[2*a+2],a=m[2*a+
3],b[0]=c+(e-c)*d,b[1]=h+(a-h)*d,b[2]=1>Math.abs(e-c)&&1>Math.abs(a-h)?0:1>Math.abs(e-c)?0<=a-h?90:270:1>Math.abs(a-h)?0<=e-c?0:180:180*Math.atan2(a-h,e-c)/Math.PI,b;g+=m}}return b};
t.$x=function(a){if(this.type===vd){var b=this.startX,c=this.startY,d=this.endX,e=this.endY;if(b!==d||c!==e){var f=a.x;a=a.y;if(b===d){if(c<e){var g=c;d=e}else g=e,d=c;return a<=g?g===c?0:1:a>=d?d===c?0:1:Math.abs(a-c)/(d-g)}if(c===e)return b<d?g=b:(g=d,d=b),f<=g?g===b?0:1:f>=d?d===b?0:1:Math.abs(f-b)/(d-g);g=(d-b)*(d-b)+(e-c)*(e-c);var h=I.alloc();K.Kh(b,c,d,e,f,a,h);a=h.x;f=h.y;I.free(h);return Math.sqrt(((a-b)*(a-b)+(f-c)*(f-c))/g)}}else if(this.type===zd){g=this.startX;h=this.startY;var k=this.endX;
e=this.endY;if(g!==k||h!==e){b=k-g;c=e-h;f=2*b+2*c;d=a.x;a=a.y;d=Math.min(Math.max(d,g),k);a=Math.min(Math.max(a,h),e);g=Math.abs(d-g);k=Math.abs(d-k);h=Math.abs(a-h);e=Math.abs(a-e);var l=Math.min(g,k,h,e);if(l===h)return d/f;if(l===k)return(b+a)/f;if(l===e)return(2*b+c-d)/f;if(l===g)return(2*b+2*c-a)/f}}else{b=this.flattenedSegments;c=this.flattenedLengths;f=this.flattenedTotalLength;d=I.alloc();e=Infinity;h=g=0;k=b.length;for(var m=l=0,n=0;n<k;n++)for(var p=b[n],r=c[n],q=p.length,u=0;u<q;u+=2){var v=
p[u],w=p[u+1];if(0!==u){K.Kh(l,m,v,w,a.x,a.y,d);var y=(d.x-a.x)*(d.x-a.x)+(d.y-a.y)*(d.y-a.y);y<e&&(e=y,g=h,g+=Math.sqrt((d.x-l)*(d.x-l)+(d.y-m)*(d.y-m)));h+=r[(u-2)/2]}l=v;m=w}I.free(d);a=g/f;return 0>a?0:1<a?1:a}return 0};
function fe(a){if(null===a.Ik){var b=a.Ik=[],c=a.Xm=[],d=[],e=[];if(a.type===vd)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===zd)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===Hd){var f=new ge;f.startX=a.endX;f.startY=(a.startY+a.endY)/2;var g=new oe(Zd);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=ae(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.Be(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(pe(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 Wd:4<=d.length&&(b.push(d),c.push(pe(d)));d=[];d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;h=g;k=f;break;case xd:d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;break;case Xd:K.Be(g,f,p.point1X,p.point1Y,p.point2X,p.point2Y,p.endX,p.endY,
.5,d);g=p.endX;f=p.endY;break;case Yd:K.Kq(g,f,p.point1X,p.point1Y,p.endX,p.endY,.5,d);g=p.endX;f=p.endY;break;case Zd:var r=ae(p,e),q=r.length;if(0===q){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(var u=0;u<q;u++){var v=r[u];K.Be(g,f,v[2],v[3],v[4],v[5],v[6],v[7],.5,d);g=v[6];f=v[7]}break;case $d:r=be(p,e,g,f);q=r.length;if(0===q){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(u=0;u<q;u++)v=r[u],K.Be(g,f,v[2],v[3],v[4],v[5],v[6],v[7],.5,d),g=v[6],
f=v[7];break;default:B("Segment not of valid type: "+p.type)}p.isClosed&&(d.push(h),d.push(k))}4<=d.length&&(b.push(d),c.push(pe(d)))}}}function pe(a){for(var b=[],c=0,d=0,e=a.length,f=0;f<e;f+=2){var g=a[f],h=a[f+1];0!==f&&b.push(Math.sqrt(Cb(c,d,g,h)));c=g;d=h}return b}t.add=function(a){this.uj.add(a);return this};t.Mm=function(a,b,c,d,e,f,g,h){this.s&&ua(this);this.hf=(new P(a,b,e,f)).freeze();this.jf=(new P(c,d,g,h)).freeze();return this};
ma.Object.defineProperties(sd.prototype,{flattenedSegments:{get:function(){fe(this);return this.Ik}},flattenedLengths:{get:function(){fe(this);return this.Xm}},flattenedTotalLength:{get:function(){var a=this.Ym;if(isNaN(a)){if(this.type===vd){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===zd)a=2*Math.abs(this.endX-this.startX)+2*Math.abs(this.endY-
this.startY);else{b=this.flattenedLengths;for(var c=b.length,d=a=0;d<c;d++)for(var e=b[d],f=e.length,g=0;g<f;g++)a+=e[g]}this.Ym=a}return a}},type:{get:function(){return this.pa},set:function(a){this.pa!==a&&(this.s&&ua(this,a),this.pa=a,this.qa=!0)}},startX:{get:function(){return this.Sc},set:function(a){this.Sc!==a&&(this.s&&ua(this,a),this.Sc=a,this.qa=!0)}},startY:{get:function(){return this.Tc},set:function(a){this.Tc!==
a&&(this.s&&ua(this,a),this.Tc=a,this.qa=!0)}},endX:{get:function(){return this.ec},set:function(a){this.ec!==a&&(this.s&&ua(this,a),this.ec=a,this.qa=!0)}},endY:{get:function(){return this.nc},set:function(a){this.nc!==a&&(this.s&&ua(this,a),this.nc=a,this.qa=!0)}},figures:{get:function(){return this.uj},set:function(a){this.uj!==a&&(this.s&&ua(this,a),this.uj=a,this.qa=!0)}},spot1:{
get:function(){return this.hf},set:function(a){this.s&&ua(this,a);this.hf=a.G()}},spot2:{get:function(){return this.jf},set:function(a){this.s&&ua(this,a);this.jf=a.G()}},defaultStretch:{get:function(){return this.Nf},set:function(a){this.s&&ua(this,a);this.Nf=a}},bounds:{get:function(){this.Sv()&&this.computeBounds();return this.ur}}});sd.prototype.setSpots=sd.prototype.Mm;sd.prototype.add=sd.prototype.add;
sd.prototype.getFractionForPoint=sd.prototype.$x;sd.prototype.getPointAndAngleAlongPath=sd.prototype.Jv;sd.prototype.getAngleAlongPath=sd.prototype.Zx;sd.prototype.getPointAlongPath=sd.prototype.Iv;sd.prototype.containsPoint=sd.prototype.aa;sd.prototype.transform=sd.prototype.transform;sd.prototype.rotate=sd.prototype.rotate;sd.prototype.scale=sd.prototype.scale;sd.prototype.offset=sd.prototype.offset;sd.prototype.normalize=sd.prototype.normalize;sd.prototype.computeBoundsWithoutOrigin=sd.prototype.Nx;
sd.prototype.equalsApprox=sd.prototype.Ma;var vd=new D(sd,"Line",0),zd=new D(sd,"Rectangle",1),Hd=new D(sd,"Ellipse",2),td=new D(sd,"Path",3);sd.className="Geometry";sd.stringify=yd;sd.fillPath=function(a){a=a.split(/[Xx]/);for(var b=a.length,c="",d=0;d<b;d++){var e=a[d];c=null!==e.match(/[Ff]/)?0===d?c+e:c+("X"+(" "===e[0]?"":" ")+e):c+((0===d?"":"X ")+"F"+(" "===e[0]?"":" ")+e)}return c};sd.parse=Id;sd.Line=vd;sd.Rectangle=zd;sd.Ellipse=Hd;sd.Path=td;
function ge(a,b,c,d){Ya(this);this.s=!1;void 0===c&&(c=!0);this.Xr=c;void 0===d&&(d=!0);this.cs=d;void 0!==a?this.Sc=a:this.Sc=0;void 0!==b?this.Tc=b:this.Tc=0;this.Ml=new E;this.Ts=this.Ml.Aa;this.qa=!0}ge.prototype.copy=function(){var a=new ge;a.Xr=this.Xr;a.cs=this.cs;a.Sc=this.Sc;a.Tc=this.Tc;for(var b=this.Ml.j,c=b.length,d=a.Ml,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.Ts=this.Ts;a.qa=this.qa;return a};t=ge.prototype;
t.Ma=function(a){if(!(a instanceof ge&&K.A(this.startX,a.startX)&&K.A(this.startY,a.startY)))return!1;var b=this.segments.j;a=a.segments.j;var c=b.length;if(c!==a.length)return!1;for(var d=0;d<c;d++)if(!b[d].Ma(a[d]))return!1;return!0};t.toString=function(a){void 0===a&&(a=-1);var b=0>a?"M"+this.startX.toString()+" "+this.startY.toString():"M"+this.startX.toFixed(a)+" "+this.startY.toFixed(a);for(var c=this.segments.j,d=c.length,e=0;e<d;e++)b+=" "+c[e].toString(a);return b};
t.freeze=function(){this.s=!0;var a=this.segments;a.freeze();var b=a.j;a=a.length;for(var c=0;c<a;c++)b[c].freeze();return this};t.ea=function(){this.s=!1;var a=this.segments;a.ea();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].ea();return this};t.Sv=function(){if(this.qa)return!0;var a=this.segments;if(this.Ts!==a.Aa)return!0;a=a.j;for(var b=a.length,c=0;c<b;c++)if(a[c].qa)return!0;return!1};t.add=function(a){this.Ml.add(a);return this};
t.aa=function(a,b,c){for(var d=this.startX,e=this.startY,f=d,g=e,h=this.segments.j,k=h.length,l=0;l<k;l++){var m=h[l];switch(m.type){case Wd:f=m.endX;g=m.endY;d=m.endX;e=m.endY;break;case xd:if(K.Ob(d,e,m.endX,m.endY,c,a,b))return!0;d=m.endX;e=m.endY;break;case Xd:if(K.lt(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 Yd:if(K.bw(d,e,m.point1X,m.point1Y,m.endX,m.endY,.5,a,b,c))return!0;d=m.endX;e=m.endY;break;case Zd:case $d:var n=m.type===
Zd?ae(m,this):be(m,this,d,e),p=n.length;if(0===p){if(K.Ob(d,e,m.centerX,m.centerY,c,a,b))return!0;d=m.centerX;e=m.centerY;break}for(var r=null,q=0;q<p;q++)if(r=n[q],0===q&&K.Ob(d,e,r[0],r[1],c,a,b)||K.lt(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],.5,a,b,c))return!0;null!==r&&(d=r[6],e=r[7]);break;default:B("Unknown Segment type: "+m.type)}if(m.isClosed&&(d!==f||e!==g)&&K.Ob(d,e,f,g,c,a,b))return!0}return!1};
ma.Object.defineProperties(ge.prototype,{isFilled:{get:function(){return this.Xr},set:function(a){this.s&&ua(this,a);this.Xr=a}},isShadowed:{get:function(){return this.cs},set:function(a){this.s&&ua(this,a);this.cs=a}},startX:{get:function(){return this.Sc},set:function(a){this.s&&ua(this,a);this.Sc=a;this.qa=!0}},startY:{get:function(){return this.Tc},set:function(a){this.s&&ua(this,
a);this.Tc=a;this.qa=!0}},segments:{get:function(){return this.Ml},set:function(a){this.s&&ua(this,a);this.Ml=a;this.qa=!0}}});ge.prototype.add=ge.prototype.add;ge.prototype.equalsApprox=ge.prototype.Ma;ge.className="PathFigure";
function oe(a,b,c,d,e,f,g,h){Ya(this);this.s=!1;void 0===a&&(a=xd);this.pa=a;void 0!==b?this.ec=b:this.ec=0;void 0!==c?this.nc=c:this.nc=0;void 0===d&&(d=0);void 0===e&&(e=0);void 0===f&&(f=0);void 0===g&&(g=0);a===$d?(a=f%360,0>a&&(a+=360),this.xe=a,this.Hi=0,this.Ii=Math.max(d,0),this.hh=Math.max(e,0),this.tl="boolean"===typeof g?g:"number"===typeof g?!!g:!1,this.Mk=!!h):(this.xe=d,this.Hi=e,a===Zd&&(f=Math.max(f,0)),this.Ii=f,"number"===typeof g?(a===Zd&&(g=Math.max(g,0)),this.hh=g):this.hh=0,
this.Mk=this.tl=!1);this.zj=!1;this.qa=!0;this.Le=null}oe.prototype.copy=function(){var a=new oe;a.pa=this.pa;a.ec=this.ec;a.nc=this.nc;a.xe=this.xe;a.Hi=this.Hi;a.Ii=this.Ii;a.hh=this.hh;a.tl=this.tl;a.Mk=this.Mk;a.zj=this.zj;a.qa=this.qa;return a};t=oe.prototype;
t.Ma=function(a){if(!(a instanceof oe)||this.type!==a.type||this.isClosed!==a.isClosed)return!1;switch(this.type){case Wd:case xd:return K.A(this.endX,a.endX)&&K.A(this.endY,a.endY);case Xd:return K.A(this.endX,a.endX)&&K.A(this.endY,a.endY)&&K.A(this.point1X,a.point1X)&&K.A(this.point1Y,a.point1Y)&&K.A(this.point2X,a.point2X)&&K.A(this.point2Y,a.point2Y);case Yd:return K.A(this.endX,a.endX)&&K.A(this.endY,a.endY)&&K.A(this.point1X,a.point1X)&&K.A(this.point1Y,a.point1Y);case Zd:return K.A(this.startAngle,
a.startAngle)&&K.A(this.sweepAngle,a.sweepAngle)&&K.A(this.centerX,a.centerX)&&K.A(this.centerY,a.centerY)&&K.A(this.radiusX,a.radiusX)&&K.A(this.radiusY,a.radiusY);case $d:return this.isClockwiseArc===a.isClockwiseArc&&this.isLargeArc===a.isLargeArc&&K.A(this.xAxisRotation,a.xAxisRotation)&&K.A(this.endX,a.endX)&&K.A(this.endY,a.endY)&&K.A(this.radiusX,a.radiusX)&&K.A(this.radiusY,a.radiusY);default:return!1}};t.gb=function(a){a.classType===oe&&(this.type=a)};
t.toString=function(a){void 0===a&&(a=-1);switch(this.type){case Wd:a=0>a?"M"+this.endX.toString()+" "+this.endY.toString():"M"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case xd:a=0>a?"L"+this.endX.toString()+" "+this.endY.toString():"L"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Xd: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 Yd: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 Zd: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 $d: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.zj?"z":"")};t.freeze=function(){this.s=!0;return this};t.ea=function(){this.s=!1;return this};t.close=function(){this.zj=!0;return this};
function ae(a,b){if(null!==a.Le&&!1===b.qa)return a.Le;var c=a.radiusX,d=a.radiusY;void 0===d&&(d=c);if(0===c||0===d)return a.Le=[],a.Le;b=a.xe;var e=a.Hi,f=K.Ox(0,0,c<d?c:d,a.startAngle,a.startAngle+a.sweepAngle,!1);if(c!==d){var g=qd.alloc();g.reset();c<d?g.scale(1,d/c):g.scale(c/d,1);Ud(f,g);qd.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.Le=f;return a.Le}
function be(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.Le&&!1===b.qa)return a.Le;b=a.Ii;var f=a.hh;0===b&&(b=1E-4);0===f&&(f=1E-4);var g=Math.PI/180*a.xe,h=a.tl,k=a.Mk,l=a.ec,m=a.nc,n=Math.cos(g),p=Math.sin(g),r=n*(c-l)/2+p*(d-m)/2;g=-p*(c-l)/2+n*(d-m)/2;var q=r*r/(b*b)+g*g/(f*f);1<q&&(b*=Math.sqrt(q),f*=Math.sqrt(q));q=(h===k?-1:1)*Math.sqrt((b*b*f*f-b*b*g*g-f*f*r*r)/(b*b*g*g+f*f*r*r));isNaN(q)&&(q=0);h=q*b*g/f;q=q*-f*
r/b;isNaN(h)&&(h=0);isNaN(q)&&(q=0);c=(c+l)/2+n*h-p*q;d=(d+m)/2+p*h+n*q;m=e(1,0,(r-h)/b,(g-q)/f);n=(r-h)/b;l=(g-q)/f;r=(-r-h)/b;h=(-g-q)/f;g=e(n,l,r,h);r=(n*r+l*h)/(Math.sqrt(n*n+l*l)*Math.sqrt(r*r+h*h));-1>=r?g=Math.PI:1<=r&&(g=0);!k&&0<g&&(g-=2*Math.PI);k&&0>g&&(g+=2*Math.PI);k=b>f?1:b/f;r=b>f?f/b:1;b=K.Ox(0,0,b>f?b:f,m,m+g,!0);f=qd.alloc();f.reset();f.translate(c,d);f.rotate(a.xe,0,0);f.scale(k,r);Ud(b,f);qd.free(f);a.Le=b;return a.Le}
ma.Object.defineProperties(oe.prototype,{isClosed:{get:function(){return this.zj},set:function(a){this.zj!==a&&(this.zj=a,this.qa=!0)}},type:{get:function(){return this.pa},set:function(a){this.s&&ua(this,a);this.pa=a;this.qa=!0}},endX:{get:function(){return this.ec},set:function(a){this.s&&ua(this,a);this.ec=a;this.qa=!0}},endY:{get:function(){return this.nc},set:function(a){this.s&&
ua(this,a);this.nc=a;this.qa=!0}},point1X:{get:function(){return this.xe},set:function(a){this.s&&ua(this,a);this.xe=a;this.qa=!0}},point1Y:{get:function(){return this.Hi},set:function(a){this.s&&ua(this,a);this.Hi=a;this.qa=!0}},point2X:{get:function(){return this.Ii},set:function(a){this.s&&ua(this,a);this.Ii=a;this.qa=!0}},point2Y:{get:function(){return this.hh},set:function(a){this.s&&
ua(this,a);this.hh=a;this.qa=!0}},centerX:{get:function(){return this.xe},set:function(a){this.s&&ua(this,a);this.xe=a;this.qa=!0}},centerY:{get:function(){return this.Hi},set:function(a){this.s&&ua(this,a);this.Hi=a;this.qa=!0}},radiusX:{get:function(){return this.Ii},set:function(a){0>a&&va(a,">= zero",oe,"radiusX");this.s&&ua(this,a);this.Ii=a;this.qa=!0}},radiusY:{get:function(){return this.hh},
set:function(a){0>a&&va(a,">= zero",oe,"radiusY");this.s&&ua(this,a);this.hh=a;this.qa=!0}},startAngle:{get:function(){return this.ec},set:function(a){this.ec!==a&&(this.s&&ua(this,a),a%=360,0>a&&(a+=360),this.ec=a,this.qa=!0)}},sweepAngle:{get:function(){return this.nc},set:function(a){this.s&&ua(this,a);360<a&&(a=360);-360>a&&(a=-360);this.nc=a;this.qa=!0}},isClockwiseArc:{get:function(){return this.Mk},set:function(a){this.s&&
ua(this,a);this.Mk=a;this.qa=!0}},isLargeArc:{get:function(){return this.tl},set:function(a){this.s&&ua(this,a);this.tl=a;this.qa=!0}},xAxisRotation:{get:function(){return this.xe},set:function(a){a%=360;0>a&&(a+=360);this.s&&ua(this,a);this.xe=a;this.qa=!0}}});oe.prototype.equalsApprox=oe.prototype.Ma;
var Wd=new D(oe,"Move",0),xd=new D(oe,"Line",1),Xd=new D(oe,"Bezier",2),Yd=new D(oe,"QuadraticBezier",3),Zd=new D(oe,"Arc",4),$d=new D(oe,"SvgArc",4);oe.className="PathSegment";oe.Move=Wd;oe.Line=xd;oe.Bezier=Xd;oe.QuadraticBezier=Yd;oe.Arc=Zd;oe.SvgArc=$d;function qe(){this.B=null;this.kv=(new I(0,0)).freeze();this.uu=(new I(0,0)).freeze();this.lr=this.qs=0;this.mr=1;this.gs="";this.gt=this.Gr=!1;this.Dr=this.pr=0;this.Jg=this.Qr=this.$r=!1;this.Lr=null;this.bt=0;this.cd=this.at=null}
qe.prototype.copy=function(){var a=new qe;return this.clone(a)};qe.prototype.clone=function(a){a.B=this.B;a.kv.assign(this.viewPoint);a.uu.assign(this.documentPoint);a.qs=this.qs;a.lr=this.lr;a.mr=this.mr;a.gs=this.gs;a.Gr=this.Gr;a.gt=this.gt;a.pr=this.pr;a.Dr=this.Dr;a.$r=this.$r;a.Qr=this.Qr;a.Jg=this.Jg;a.Lr=this.Lr;a.bt=this.bt;a.at=this.at;a.cd=this.cd;return a};
qe.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};qe.prototype.vq=function(a,b){var c=this.diagram;if(null===c)return b;re(c,this.event,a,b);return b};
qe.prototype.Nz=function(a,b){var c=this.diagram;if(null===c)return b;re(c,this.event,a,b);b.assign(c.au(b));return b};
ma.Object.defineProperties(qe.prototype,{diagram:{get:function(){return this.B},set:function(a){this.B=a}},viewPoint:{get:function(){return this.kv},set:function(a){this.kv.assign(a)}},documentPoint:{get:function(){return this.uu},set:function(a){this.uu.assign(a)}},modifiers:{get:function(){return this.qs},set:function(a){this.qs=a}},button:{get:function(){return this.lr},
set:function(a){this.lr=a;if(null===this.event)switch(a){case 0:this.buttons=1;break;case 1:this.buttons=4;break;case 2:this.buttons=2}}},buttons:{get:function(){return this.mr},set:function(a){this.mr=a}},key:{get:function(){return this.gs},set:function(a){this.gs=a}},down:{get:function(){return this.Gr},set:function(a){this.Gr=a}},up:{get:function(){return this.gt},set:function(a){this.gt=
a}},clickCount:{get:function(){return this.pr},set:function(a){this.pr=a}},delta:{get:function(){return this.Dr},set:function(a){this.Dr=a}},isMultiTouch:{get:function(){return this.$r},set:function(a){this.$r=a}},handled:{get:function(){return this.Qr},set:function(a){this.Qr=a}},bubbles:{get:function(){return this.Jg},set:function(a){this.Jg=a}},event:{
get:function(){return this.Lr},set:function(a){this.Lr=a}},isTouchEvent:{get:function(){var a=x.TouchEvent,b=this.event;return a&&b instanceof a?!0:(a=x.PointerEvent)&&b instanceof a&&("touch"===b.pointerType||"pen"===b.pointerType)}},timestamp:{get:function(){return this.bt},set:function(a){this.bt=a}},targetDiagram:{get:function(){return this.at},set:function(a){this.at=a}},targetObject:{
get:function(){return this.cd},set:function(a){this.cd=a}},control:{get:function(){return 0!==(this.modifiers&1)},set:function(a){this.modifiers=a?this.modifiers|1:this.modifiers&-2}},shift:{get:function(){return 0!==(this.modifiers&4)},set:function(a){this.modifiers=a?this.modifiers|4:this.modifiers&-5}},alt:{get:function(){return 0!==(this.modifiers&2)},set:function(a){this.modifiers=a?this.modifiers|
2:this.modifiers&-3}},meta:{get:function(){return 0!==(this.modifiers&8)},set:function(a){this.modifiers=a?this.modifiers|8:this.modifiers&-9}},left:{get:function(){var a=this.event;return null===a||"mousedown"!==a.type&&"mouseup"!==a.type&&"pointerdown"!==a.type&&"pointerup"!==a.type?0!==(this.buttons&1):0===this.button},set:function(a){this.buttons=a?this.buttons|1:this.buttons&-2}},right:{get:function(){var a=
this.event;return null===a||"mousedown"!==a.type&&"mouseup"!==a.type&&"pointerdown"!==a.type&&"pointerup"!==a.type?0!==(this.buttons&2):2===this.button},set:function(a){this.buttons=a?this.buttons|2:this.buttons&-3}},middle:{get:function(){var a=this.event;return null===a||"mousedown"!==a.type&&"mouseup"!==a.type&&"pointerdown"!==a.type&&"pointerup"!==a.type?0!==(this.buttons&4):1===this.button},set:function(a){this.buttons=a?this.buttons|4:this.buttons&-5}}});
qe.prototype.getMultiTouchDocumentPoint=qe.prototype.Nz;qe.prototype.getMultiTouchViewPoint=qe.prototype.vq;qe.className="InputEvent";function se(){this.B=null;this.Qa="";this.As=this.$s=null}se.prototype.copy=function(){var a=new se;a.B=this.B;a.Qa=this.Qa;a.$s=this.$s;a.As=this.As;return a};se.prototype.toString=function(){var a="*"+this.name;null!==this.subject&&(a+=":"+this.subject.toString());null!==this.parameter&&(a+="("+this.parameter.toString()+")");return a};
ma.Object.defineProperties(se.prototype,{diagram:{get:function(){return this.B},set:function(a){this.B=a}},name:{get:function(){return this.Qa},set:function(a){this.Qa=a}},subject:{get:function(){return this.$s},set:function(a){this.$s=a}},parameter:{get:function(){return this.As},set:function(a){this.As=a}}});se.className="DiagramEvent";
function te(){this.hn=ue;this.af=this.ps="";this.To=this.Uo=this.$o=this.ap=this.Zo=this.B=this.ac=null}te.prototype.clear=function(){this.To=this.Uo=this.$o=this.ap=this.Zo=this.B=this.ac=null};
te.prototype.copy=function(){var a=new te;a.hn=this.hn;a.ps=this.ps;a.af=this.af;a.ac=this.ac;a.B=this.B;a.Zo=this.Zo;var b=this.ap;a.ap=za(b)&&"function"===typeof b.G?b.G():b;b=this.$o;a.$o=za(b)&&"function"===typeof b.G?b.G():b;b=this.Uo;a.Uo=za(b)&&"function"===typeof b.G?b.G():b;b=this.To;a.To=za(b)&&"function"===typeof b.G?b.G():b;return a};te.prototype.gb=function(a){a.classType===te&&(this.change=a)};
te.prototype.toString=function(){var a="";a=this.change===ve?a+"* ":this.change===ue?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===ve?null!==this.oldValue&&(a+=" "+this.oldValue):(null!==this.object&&(a+=Ja(this.object)),null!==this.oldValue&&(a+="  old: "+Ja(this.oldValue)),null!==
this.oldParam&&(a+=" "+this.oldParam),null!==this.newValue&&(a+="  new: "+Ja(this.newValue)),null!==this.newParam&&(a+=" "+this.newParam));return a};te.prototype.H=function(a){return a?this.oldValue:this.newValue};te.prototype.Pz=function(a){return a?this.oldParam:this.newParam};te.prototype.canUndo=function(){return null!==this.model||null!==this.diagram?!0:!1};
te.prototype.undo=function(){this.canUndo()&&(null!==this.model?this.model.changeState(this,!0):null!==this.diagram&&this.diagram.changeState(this,!0))};te.prototype.canRedo=function(){return null!==this.model||null!==this.diagram?!0:!1};te.prototype.redo=function(){this.canRedo()&&(null!==this.model?this.model.changeState(this,!1):null!==this.diagram&&this.diagram.changeState(this,!1))};
ma.Object.defineProperties(te.prototype,{model:{get:function(){return this.ac},set:function(a){this.ac=a}},diagram:{get:function(){return this.B},set:function(a){this.B=a}},change:{get:function(){return this.hn},set:function(a){this.hn=a}},modelChange:{get:function(){return this.ps},set:function(a){this.ps=a}},propertyName:{get:function(){return this.af},
set:function(a){this.af=a}},isTransactionFinished:{get:function(){return this.hn===ve&&("CommittedTransaction"===this.af||"FinishedUndo"===this.af||"FinishedRedo"===this.af)}},object:{get:function(){return this.Zo},set:function(a){this.Zo=a}},oldValue:{get:function(){return this.ap},set:function(a){this.ap=a}},oldParam:{get:function(){return this.$o},set:function(a){this.$o=a}},
newValue:{get:function(){return this.Uo},set:function(a){this.Uo=a}},newParam:{get:function(){return this.To},set:function(a){this.To=a}}});te.prototype.redo=te.prototype.redo;te.prototype.canRedo=te.prototype.canRedo;te.prototype.undo=te.prototype.undo;te.prototype.canUndo=te.prototype.canUndo;te.prototype.getParam=te.prototype.Pz;te.prototype.getValue=te.prototype.H;te.prototype.clear=te.prototype.clear;
var ve=new D(te,"Transaction",-1),ue=new D(te,"Property",0),we=new D(te,"Insert",1),xe=new D(te,"Remove",2);te.className="ChangedEvent";te.Transaction=ve;te.Property=ue;te.Insert=we;te.Remove=xe;function ye(){this.u=(new E).freeze();this.Qa="";this.l=!1}ye.prototype.toString=function(a){var b="Transaction: "+this.name+" "+this.changes.count.toString()+(this.isComplete?"":", incomplete");if(void 0!==a&&0<a){a=this.changes.count;for(var c=0;c<a;c++){var d=this.changes.L(c);null!==d&&(b+="\n  "+d.toString())}}return b};
ye.prototype.clear=function(){var a=this.changes;a.ea();for(var b=a.count-1;0<=b;b--){var c=a.L(b);null!==c&&c.clear()}a.clear();a.freeze()};ye.prototype.canUndo=function(){return this.isComplete};ye.prototype.undo=function(){if(this.canUndo())for(var a=this.changes.count-1;0<=a;a--){var b=this.changes.L(a);null!==b&&b.undo()}};ye.prototype.canRedo=function(){return this.isComplete};
ye.prototype.redo=function(){if(this.canRedo())for(var a=this.changes.count,b=0;b<a;b++){var c=this.changes.L(b);null!==c&&c.redo()}};ma.Object.defineProperties(ye.prototype,{changes:{get:function(){return this.u}},name:{get:function(){return this.Qa},set:function(a){this.Qa=a}},isComplete:{get:function(){return this.l},set:function(a){this.l=a}}});ye.prototype.redo=ye.prototype.redo;ye.prototype.canRedo=ye.prototype.canRedo;
ye.prototype.undo=ye.prototype.undo;ye.prototype.canUndo=ye.prototype.canUndo;ye.prototype.clear=ye.prototype.clear;ye.className="Transaction";function ze(){this.Tu=new F;this.ad=!1;this.I=(new E).freeze();this.Kd=-1;this.u=999;this.ne=!1;this.Ar=null;this.Pi=0;this.l=!1;this.te=(new E).freeze();this.Bl=new E;this.Bu=!0;this.Iu=this.Yr=this.Mu=this.Lu=!1}
ze.prototype.toString=function(a){var b="UndoManager "+this.historyIndex+"<"+this.history.count+"<="+this.maxHistoryLength;b+="[";for(var c=this.nestedTransactionNames.count,d=0;d<c;d++)0<d&&(b+=" "),b+=this.nestedTransactionNames.L(d);b+="]";if(void 0!==a&&0<a)for(c=this.history.count,d=0;d<c;d++)b+="\n "+this.history.L(d).toString(a-1);return b};
ze.prototype.clear=function(){var a=this.history;a.ea();for(var b=a.count-1;0<=b;b--){var c=a.L(b);null!==c&&c.clear()}a.clear();this.Kd=-1;a.freeze();this.ne=!1;this.Ar=null;this.Pi=0;this.te.ea();this.te.clear();this.te.freeze();this.Bl.clear();this.Iu=this.Yr=this.Mu=this.Lu=!1};ze.prototype.copyProperties=function(a){this.isEnabled=a.isEnabled;this.maxHistoryLength=a.maxHistoryLength;this.checksTransactionLevel=a.checksTransactionLevel};t=ze.prototype;t.Gx=function(a){this.Tu.add(a)};t.uy=function(a){this.Tu.remove(a)};
t.ua=function(a){void 0===a&&(a="");null===a&&(a="");if(this.isUndoingRedoing)return!1;!0===this.Bu&&(this.Bu=!1,this.Pi++,this.isInternalTransaction||this.zb("StartingFirstTransaction",a,this.currentTransaction),0<this.Pi&&this.Pi--);this.isEnabled&&(this.te.ea(),this.te.add(a),this.te.freeze(),null===this.currentTransaction?this.Bl.add(0):this.Bl.add(this.currentTransaction.changes.count));this.Pi++;var b=1===this.transactionLevel;b&&(this.isInternalTransaction||this.zb("StartedTransaction",a,this.currentTransaction));
return b};t.Va=function(a){void 0===a&&(a="");return Ae(this,!0,a)};t.Bf=function(){return Ae(this,!1,"")};
function Ae(a,b,c){if(a.isUndoingRedoing)return!1;a.checksTransactionLevel&&1>a.transactionLevel&&wa("Ending transaction without having started a transaction: "+c);var d=1===a.transactionLevel,e=a.currentTransaction;d&&b&&(a.isInternalTransaction||a.zb("CommittingTransaction",c,e));var f=0;if(0<a.transactionLevel&&(a.Pi--,a.isEnabled)){var g=a.te.count;0<g&&(""===c&&(c=a.te.L(0)),a.te.ea(),a.te.ab(g-1),a.te.freeze());g=a.Bl.count;0<g&&(f=a.Bl.L(g-1),a.Bl.ab(g-1))}if(d){if(b){a.Yr=!1;null===e&&""!==
c&&(e=a.currentTransaction);if(a.isEnabled&&null!==e){e.isComplete||(e.isComplete=!0,e.name=c);b=a.history;b.ea();for(d=b.count-1;d>a.historyIndex;d--)f=b.L(d),null!==f&&f.clear(),b.ab(d),a.Yr=!0;d=a.maxHistoryLength;0<=d&&(0===d?b.clear():b.count>=d&&(f=b.L(0),null!==f&&f.clear(),b.ab(0),a.Kd--));0===d||0!==b.count&&b.get(b.count-1)===e||(b.add(e),a.Kd++);b.freeze()}a.isInternalTransaction||a.zb("CommittedTransaction",c,e)}else{a.ne=!0;try{a.isEnabled&&null!==e&&(e.isComplete=!0,e.undo())}finally{a.isInternalTransaction||
a.zb("RolledBackTransaction",c,e),a.ne=!1}null!==e&&e.clear()}a.Ar=null;a.isPendingClear&&a.clear();a.isPendingClear=!1;a.isPendingUnmodified=!1;return!0}if(a.isEnabled&&!b&&null!==e){a=f;c=e.changes;for(e=c.count-1;e>=a;e--)b=c.L(e),null!==b&&b.undo(),c.ea(),c.ab(e);c.freeze()}return!1}ze.prototype.canUndo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToUndo;return null!==a&&a.canUndo()?!0:!1};
ze.prototype.undo=function(){if(this.canUndo()){var a=this.transactionToUndo;try{this.ne=!0,this.zb("StartingUndo","Undo",a),this.Kd--,a.undo()}catch(b){wa("undo error: "+b.toString())}finally{this.zb("FinishedUndo","Undo",a),this.ne=!1}}};ze.prototype.canRedo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToRedo;return null!==a&&a.canRedo()?!0:!1};
ze.prototype.redo=function(){if(this.canRedo()){var a=this.transactionToRedo;try{this.ne=!0,this.zb("StartingRedo","Redo",a),this.Kd++,a.redo()}catch(b){wa("redo error: "+b.toString())}finally{this.zb("FinishedRedo","Redo",a),this.ne=!1}}};ze.prototype.zb=function(a,b,c){void 0===c&&(c=null);var d=new te;d.change=ve;d.propertyName=a;d.object=c;d.oldValue=b;for(a=this.models;a.next();)b=a.value,d.model=b,b.mt(d)};
ze.prototype.Mv=function(a){if(this.isEnabled&&!this.isUndoingRedoing&&!this.skipsEvent(a)){var b=this.currentTransaction;null===b&&(this.Ar=b=new ye);var c=a.copy();b=b.changes;b.ea();b.add(c);b.freeze();this.checksTransactionLevel&&0>=this.transactionLevel&&!this.Bu&&(a=a.diagram,null!==a&&!1===a.mk||wa("Change not within a transaction: "+c.toString()))}};
ze.prototype.skipsEvent=function(a){if(null===a||0>a.change.value)return!0;a=a.object;if(null===a)return!1;if(void 0!==a.layer){if(a=a.layer,null!==a&&a.isTemporary)return!0}else if(a.isTemporary)return!0;return!1};
ma.Object.defineProperties(ze.prototype,{models:{get:function(){return this.Tu.iterator}},isEnabled:{get:function(){return this.ad},set:function(a){this.ad=a}},transactionToUndo:{get:function(){return 0<=this.historyIndex&&this.historyIndex<=this.history.count-1?this.history.L(this.historyIndex):null}},transactionToRedo:{get:function(){return this.historyIndex<this.history.count-
1?this.history.L(this.historyIndex+1):null}},isUndoingRedoing:{get:function(){return this.ne}},history:{get:function(){return this.I}},maxHistoryLength:{get:function(){return this.u},set:function(a){this.u=a}},historyIndex:{get:function(){return this.Kd}},currentTransaction:{get:function(){return this.Ar}},transactionLevel:{
get:function(){return this.Pi}},isInTransaction:{get:function(){return 0<this.Pi}},checksTransactionLevel:{get:function(){return this.l},set:function(a){this.l=a}},nestedTransactionNames:{get:function(){return this.te}},isPendingClear:{get:function(){return this.Lu},set:function(a){this.Lu=a}},isPendingUnmodified:{get:function(){return this.Mu},set:function(a){this.Mu=
a}},isInternalTransaction:{get:function(){return this.Iu},set:function(a){this.Iu=a}},isJustDiscarded:{get:function(){return this.Yr}}});ze.prototype.handleChanged=ze.prototype.Mv;ze.prototype.redo=ze.prototype.redo;ze.prototype.undo=ze.prototype.undo;ze.prototype.canUndo=ze.prototype.canUndo;ze.prototype.rollbackTransaction=ze.prototype.Bf;ze.prototype.commitTransaction=ze.prototype.Va;ze.prototype.startTransaction=ze.prototype.ua;
ze.prototype.removeModel=ze.prototype.uy;ze.prototype.addModel=ze.prototype.Gx;ze.prototype.clear=ze.prototype.clear;ze.className="UndoManager";function Be(){Ya(this);this.B=Ce;this.Qa="";this.ad=!0;this.kd=!1;this.Qw=null;this.Py=new qe;this.jt=-1}Be.prototype.toString=function(){return""!==this.name?this.name+" Tool":Ia(this.constructor)};Be.prototype.updateAdornments=function(){};Be.prototype.canStart=function(){return this.isEnabled};Be.prototype.doStart=function(){};
Be.prototype.doActivate=function(){this.isActive=!0};Be.prototype.doDeactivate=function(){this.isActive=!1};Be.prototype.doStop=function(){};Be.prototype.doCancel=function(){this.transactionResult=null;this.stopTool()};Be.prototype.stopTool=function(){var a=this.diagram;a.currentTool===this&&(a.currentTool=null,a.currentCursor="")};Be.prototype.doMouseDown=function(){!this.isActive&&this.canStart()&&this.doActivate()};Be.prototype.doMouseMove=function(){};Be.prototype.doMouseUp=function(){this.stopTool()};
Be.prototype.doMouseWheel=function(){};Be.prototype.canStartMultiTouch=function(){return!0};Be.prototype.standardPinchZoomStart=function(){var a=this.diagram,b=a.lastInput,c=b.vq(0,I.allocAt(NaN,NaN)),d=b.vq(1,I.allocAt(NaN,NaN));if(c.v()&&d.v()&&(this.doCancel(),a.om("hasGestureZoom"))){a.Dl=a.scale;var e=d.x-c.x,f=d.y-c.y;a.ev=Math.sqrt(e*e+f*f);b.bubbles=!1}I.free(c);I.free(d)};
Be.prototype.standardPinchZoomMove=function(){var a=this.diagram,b=a.lastInput,c=b.vq(0,I.allocAt(NaN,NaN)),d=b.vq(1,I.allocAt(NaN,NaN));if(c.v()&&d.v()&&(this.doCancel(),a.om("hasGestureZoom"))){var e=d.x-c.x,f=d.y-c.y;f=Math.sqrt(e*e+f*f)/a.ev;e=new I((Math.min(d.x,c.x)+Math.max(d.x,c.x))/2,(Math.min(d.y,c.y)+Math.max(d.y,c.y))/2);f*=a.Dl;var g=a.commandHandler;if(f!==a.scale&&g.canResetZoom(f)){var h=a.zoomPoint;a.zoomPoint=e;g.resetZoom(f);a.zoomPoint=h}b.bubbles=!1}I.free(c);I.free(d)};
Be.prototype.doKeyDown=function(){"Esc"===this.diagram.lastInput.key&&this.doCancel()};Be.prototype.doKeyUp=function(){};Be.prototype.ua=function(a){void 0===a&&(a=this.name);this.transactionResult=null;return this.diagram.ua(a)};Be.prototype.Dg=function(){var a=this.diagram;return null===this.transactionResult?a.Bf():a.Va(this.transactionResult)};
Be.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.lastInput,c=a.lm(b.documentPoint,!1);if(null!==c)if(Wa?b.meta:b.control){a.R("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!b.isSelected);a.R("ChangedSelection",a.selection)}else if(b.shift){if(!c.isSelected){a.R("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!0);a.R("ChangedSelection",
a.selection)}}else{if(!c.isSelected){for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&a.select(b)}}else!b.left||(Wa?b.meta:b.control)||b.shift||a.clearSelection()}};Be.prototype.standardMouseClick=function(a,b){void 0===a&&(a=null);void 0===b&&(b=function(a){return!a.layer.isTemporary});var c=this.diagram,d=c.lastInput;a=c.Ub(d.documentPoint,a,b);d.targetObject=a;De(a,d,c);return d.handled};
function De(a,b,c){b.handled=!1;if(null===a||a.Ag()){var d=0;b.left?d=1===b.clickCount?1:2===b.clickCount?2:1:b.right&&1===b.clickCount&&(d=3);var e="ObjectSingleClicked";if(null!==a){switch(d){case 1:e="ObjectSingleClicked";break;case 2:e="ObjectDoubleClicked";break;case 3:e="ObjectContextClicked"}0!==d&&c.R(e,a)}else{switch(d){case 1:e="BackgroundSingleClicked";break;case 2:e="BackgroundDoubleClicked";break;case 3:e="BackgroundContextClicked"}0!==d&&c.R(e)}if(null!==a)for(;null!==a;){c=null;switch(d){case 1:c=
a.click;break;case 2:c=a.doubleClick?a.doubleClick:a.click;break;case 3:c=a.contextClick}if(null!==c&&(c(b,a),b.handled))break;a=a.panel}else{a=null;switch(d){case 1:a=c.click;break;case 2:a=c.doubleClick?c.doubleClick:c.click;break;case 3:a=c.contextClick}null!==a&&a(b)}}}
Be.prototype.standardMouseOver=function(){var a=this.diagram,b=a.lastInput;if(!0!==a.animationManager.qc){var c=a.skipsUndoManager;a.skipsUndoManager=!0;var d=a.viewportBounds.aa(b.documentPoint)?a.Ub(b.documentPoint,null,null):null;b.targetObject=d;var e=!1;if(d!==a.pj){var f=a.pj,g=f;a.pj=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.zg(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.zg(d))break;g(b,d,f);e=!0;if(b.handled)break}d=d.panel}d=a.pj}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.Bb();a.skipsUndoManager=c}};Be.prototype.doCurrentObjectChanged=function(){};
Be.prototype.standardMouseWheel=function(){var a=this.diagram,b=a.lastInput,c=b.delta;if(0!==c&&a.documentBounds.v()){var d=a.commandHandler,e=a.toolManager.mouseWheelBehavior;if(null!==d&&(e===Ee&&!b.shift||e===Fe&&b.control)){if(0<c?d.canIncreaseZoom():d.canDecreaseZoom())e=a.zoomPoint,a.zoomPoint=b.viewPoint,0<c?d.increaseZoom():d.decreaseZoom(),a.zoomPoint=e;b.bubbles=!1}else if(e===Ee&&b.shift||e===Fe&&!b.control){d=a.position.copy();var f=0<c?c:-c,g=b.event,h=g.deltaMode;e=g.deltaX;g=g.deltaY;
if(Ta||Ua||Va)h=1,0<e&&(e=3),0>e&&(e=-3),0<g&&(g=3),0>g&&(g=-3);if(void 0===h||void 0===e||void 0===g||0===e&&0===g||b.shift)!b.shift&&a.allowVerticalScroll?(f=3*f*a.scrollVerticalLineChange,0<c?a.scroll("pixel","up",f):a.scroll("pixel","down",f)):b.shift&&a.allowHorizontalScroll&&(f=3*f*a.scrollHorizontalLineChange,0<c?a.scroll("pixel","left",f):a.scroll("pixel","right",f));else{switch(h){case 0:c="pixel";break;case 1:c="line";break;case 2:c="page";break;default:c="pixel"}0!==e&&a.allowHorizontalScroll&&
(e*=a.scrollHorizontalLineChange/16,0<e?a.scroll(c,"left",-e):a.scroll(c,"right",e));0!==g&&a.allowVerticalScroll&&(g*=a.scrollVerticalLineChange/16,0<g?a.scroll(c,"up",-g):a.scroll(c,"down",g))}a.position.w(d)||(b.bubbles=!1)}}};Be.prototype.standardWaitAfter=function(a,b){void 0===b&&(b=this.diagram.lastInput);this.cancelWaitAfter();var c=this,d=b.clone(this.Py);this.jt=sa(function(){c.doWaitAfter(d)},a)};Be.prototype.cancelWaitAfter=function(){-1!==this.jt&&x.clearTimeout(this.jt);this.jt=-1};
Be.prototype.doWaitAfter=function(){};Be.prototype.findToolHandleAt=function(a,b){a=this.diagram.Ub(a,function(a){for(;null!==a&&!(a.panel instanceof Ke);)a=a.panel;return a});return null===a?null:a.part.category===b?a:null};Be.prototype.isBeyondDragSize=function(a,b){var c=this.diagram;void 0===a&&(a=c.firstInput.viewPoint);void 0===b&&(b=c.lastInput.viewPoint);var d=c.toolManager.dragSize,e=d.width;d=d.height;c.firstInput.isTouchEvent&&(e+=6,d+=6);return Math.abs(b.x-a.x)>e||Math.abs(b.y-a.y)>d};
ma.Object.defineProperties(Be.prototype,{diagram:{get:function(){return this.B},set:function(a){a instanceof Q&&(this.B=a)}},name:{get:function(){return this.Qa},set:function(a){this.Qa=a}},isEnabled:{get:function(){return this.ad},set:function(a){this.ad=a}},isActive:{get:function(){return this.kd},set:function(a){this.kd=a}},transactionResult:{get:function(){return this.Qw},
set:function(a){this.Qw=a}}});Be.prototype.stopTransaction=Be.prototype.Dg;Be.prototype.startTransaction=Be.prototype.ua;Be.className="Tool";function Oa(){Be.call(this);this.name="ToolManager";this.Kc=new E;this.Yc=new E;this.Ef=new E;this.T=this.Ia=850;this.u=(new M(2,2)).ca();this.bb=5E3;this.Ja=Fe;this.I=Le;this.zr=this.l=null;this.Tj=-1}la(Oa,Be);Oa.prototype.initializeStandardTools=function(){};
Oa.prototype.updateAdornments=function(a){var b=this.currentToolTip;if(b instanceof Ke&&this.zr===a){var c=b.adornedObject;(null!==a?c.part===a:null===c)?this.showToolTip(b,c):this.hideToolTip()}};
Oa.prototype.doMouseDown=function(){var a=this.diagram,b=a.lastInput;b.isTouchEvent&&this.gestureBehavior===Me&&(b.bubbles=!1);if(b.isMultiTouch){this.cancelWaitAfter();if(this.gestureBehavior===Ne){b.bubbles=!0;return}if(this.gestureBehavior===Me)return;if(a.currentTool.canStartMultiTouch()){a.currentTool.standardPinchZoomStart();return}}for(var c=this.mouseDownTools.length,d=0;d<c;d++){var e=this.mouseDownTools.L(d);e.diagram=this.diagram;if(e.canStart()){a.doFocus();a.currentTool=e;a.currentTool===
e&&(e.isActive||e.doActivate(),e.doMouseDown());return}}1===a.lastInput.button&&(this.mouseWheelBehavior===Fe?this.mouseWheelBehavior=Ee:this.mouseWheelBehavior===Ee&&(this.mouseWheelBehavior=Fe));this.doActivate();this.standardWaitAfter(this.holdDelay,b)};
Oa.prototype.doMouseMove=function(){var a=this.diagram,b=a.lastInput;if(b.isMultiTouch){if(this.gestureBehavior===Ne){b.bubbles=!0;return}if(this.gestureBehavior===Me)return;if(a.currentTool.canStartMultiTouch()){a.currentTool.standardPinchZoomMove();return}}if(this.isActive)for(var c=this.mouseMoveTools.length,d=0;d<c;d++){var e=this.mouseMoveTools.L(d);e.diagram=this.diagram;if(e.canStart()){a.doFocus();a.currentTool=e;a.currentTool===e&&(e.isActive||e.doActivate(),e.doMouseMove());return}}Oe(this,
a);a=b.event;null===a||"mousemove"!==a.type&&"pointermove"!==a.type&&a.cancelable||(b.bubbles=!0)};function Oe(a,b){a.standardMouseOver();a.isBeyondDragSize()&&a.standardWaitAfter(a.isActive?a.holdDelay:a.hoverDelay,b.lastInput)}Oa.prototype.doCurrentObjectChanged=function(a,b){a=this.currentToolTip;null===a||null!==b&&a instanceof Ke&&(b===a||b.zg(a))||this.hideToolTip()};
Oa.prototype.doWaitAfter=function(a){var b=this.diagram;b.sa&&(this.doMouseHover(),this.isActive||this.doToolTip(),a.isTouchEvent&&!b.lastInput.handled&&(a=a.copy(),a.button=2,a.buttons=2,b.lastInput=a,b.Sj=!0,b.doMouseUp()))};
Oa.prototype.doMouseHover=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.Ub(b.documentPoint,null,null));var c=b.targetObject;if(null!==c)for(b.handled=!1;null!==c;){a=this.isActive?c.mouseHold:c.mouseHover;if(null!==a&&(a(b,c),b.handled))break;c=c.panel}else c=this.isActive?a.mouseHold:a.mouseHover,null!==c&&c(b)};
Oa.prototype.doToolTip=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.Ub(b.documentPoint,null,null));b=b.targetObject;if(null!==b){if(a=this.currentToolTip,!(a instanceof Ke)||b!==a&&!b.zg(a)){for(;null!==b;){a=b.toolTip;if(null!==a){this.showToolTip(a,b);return}b=b.panel}this.hideToolTip()}}else b=a.toolTip,null!==b?this.showToolTip(b,null):this.hideToolTip()};
Oa.prototype.showToolTip=function(a,b){var c=this.diagram;a!==this.currentToolTip&&this.hideToolTip();if(a instanceof Ke){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.Ab();this.positionToolTip(a,b)}else a instanceof Pe&&a!==this.currentToolTip&&a.show(b,c,this);this.currentToolTip=a;-1!==this.Tj&&(x.clearTimeout(this.Tj),
this.Tj=-1);a=this.toolTipDuration;if(0<a&&Infinity!==a){var e=this;this.Tj=sa(function(){e.hideToolTip()},a)}};Oa.prototype.positionToolTip=function(a){if(null===a.placeholder){var b=this.diagram,c=b.lastInput.documentPoint.copy(),d=a.measuredBounds,e=b.viewportBounds;b.lastInput.isTouchEvent&&(c.x-=d.width);c.x+d.width>e.right&&(c.x-=d.width+5/b.scale);c.x<e.x&&(c.x=e.x);c.y=c.y+20/b.scale+d.height>e.bottom?c.y-(d.height+5/b.scale):c.y+20/b.scale;c.y<e.y&&(c.y=e.y);a.position=c}};
Oa.prototype.hideToolTip=function(){-1!==this.Tj&&(x.clearTimeout(this.Tj),this.Tj=-1);var a=this.diagram,b=this.currentToolTip;null!==b&&(b instanceof Ke?(a.remove(b),null!==this.zr&&this.zr.Af(b.category),b.data=null,b.adornedObject=null):b instanceof Pe&&null!==b.hide&&b.hide(a,this),this.currentToolTip=null)};
Oa.prototype.doMouseUp=function(){this.cancelWaitAfter();var a=this.diagram;if(this.isActive)for(var b=this.mouseUpTools.length,c=0;c<b;c++){var d=this.mouseUpTools.L(c);d.diagram=this.diagram;if(d.canStart()){a.doFocus();a.currentTool=d;a.currentTool===d&&(d.isActive||d.doActivate(),d.doMouseUp());return}}a.doFocus();this.doDeactivate()};Oa.prototype.doMouseWheel=function(){this.standardMouseWheel()};Oa.prototype.doKeyDown=function(){var a=this.diagram;null!==a.commandHandler&&a.commandHandler.doKeyDown()};
Oa.prototype.doKeyUp=function(){var a=this.diagram;null!==a.commandHandler&&a.commandHandler.doKeyUp()};Oa.prototype.findTool=function(a){for(var b=this.mouseDownTools.length,c=0;c<b;c++){var d=this.mouseDownTools.L(c);if(d.name===a)return d}b=this.mouseMoveTools.length;for(c=0;c<b;c++)if(d=this.mouseMoveTools.L(c),d.name===a)return d;b=this.mouseUpTools.length;for(c=0;c<b;c++)if(d=this.mouseUpTools.L(c),d.name===a)return d;return null};
Oa.prototype.replaceTool=function(a,b){null!==b&&(b.diagram=this.diagram);for(var c=this.mouseDownTools.length,d=0;d<c;d++){var e=this.mouseDownTools.L(d);if(e.name===a)return null!==b?this.mouseDownTools.hd(d,b):this.mouseDownTools.ab(d),e}c=this.mouseMoveTools.length;for(d=0;d<c;d++)if(e=this.mouseMoveTools.L(d),e.name===a)return null!==b?this.mouseMoveTools.hd(d,b):this.mouseMoveTools.ab(d),e;c=this.mouseUpTools.length;for(d=0;d<c;d++)if(e=this.mouseUpTools.L(d),e.name===a)return null!==b?this.mouseUpTools.hd(d,
b):this.mouseUpTools.ab(d),e;return null};Oa.prototype.Wa=function(a,b,c){null!==b&&(b.name=a,b.diagram=this.diagram);this.findTool(a)?this.replaceTool(a,b):null!==b&&c.add(b)};
ma.Object.defineProperties(Oa.prototype,{mouseWheelBehavior:{get:function(){return this.Ja},set:function(a){this.Ja=a}},gestureBehavior:{get:function(){return this.I},set:function(a){this.I=a}},currentToolTip:{get:function(){return this.l},set:function(a){this.l=a;this.zr=null!==a&&a instanceof Ke?a.adornedPart:null}},mouseDownTools:{get:function(){return this.Kc}},mouseMoveTools:{
get:function(){return this.Yc}},mouseUpTools:{get:function(){return this.Ef}},hoverDelay:{get:function(){return this.Ia},set:function(a){this.Ia=a}},holdDelay:{get:function(){return this.T},set:function(a){this.T=a}},dragSize:{get:function(){return this.u},set:function(a){this.u=a.G()}},toolTipDuration:{get:function(){return this.bb},set:function(a){this.bb=
a}}});Oa.prototype.replaceStandardTool=Oa.prototype.Wa;var Fe=new D(Oa,"WheelScroll",0),Ee=new D(Oa,"WheelZoom",1),Qe=new D(Oa,"WheelNone",2),Le=new D(Oa,"GestureZoom",3),Me=new D(Oa,"GestureCancel",4),Ne=new D(Oa,"GestureNone",5);Oa.className="ToolManager";Oa.WheelScroll=Fe;Oa.WheelZoom=Ee;Oa.WheelNone=Qe;Oa.GestureZoom=Le;Oa.GestureCancel=Me;Oa.GestureNone=Ne;
function Re(){Be.call(this);this.name="Dragging";this.I=this.Yc=!0;this.u=this.bb=this.Ia=this.lg=null;this.Fn=this.Ef=!1;this.Sl=new I(NaN,NaN);this.Ys=new I;this.Kc=!0;this.Xk=100;this.Qg=[];this.ar=(new F).freeze();this.Ja=new Se;this.po=null;this.T="copy";this.Nh="";this.Qh="no-drop"}la(Re,Be);
Re.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.Xk)?!1:null!==this.findDraggablePart()};
Re.prototype.findDraggablePart=function(){var a=this.diagram;a=a.lm(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};
Re.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.lm(a.firstInput.documentPoint,!1);if(null!==b){for(;null!==b&&!b.canSelect();)b=b.containingGroup;this.currentPart=b;null===this.currentPart||this.currentPart.isSelected||(a.R("ChangingSelection",a.selection),b=a.lastInput,(Wa?b.meta:b.control)||b.shift||a.clearSelection(!0),this.currentPart.isSelected=!0,a.R("ChangedSelection",a.selection))}}};
Re.prototype.doActivate=function(){var a=this.diagram;this.po=null;null===this.currentPart&&this.standardMouseSelect();var b=this.currentPart;null!==b&&(b.canMove()||b.canCopy())&&(Te=null,this.isActive=!0,this.Sl.set(a.position),Ue(this,a.selection),this.Qg.length=0,this.draggedParts=this.computeEffectiveCollection(a.selection,this.dragOptions),a.$t=!0,!0===a.Ee("temporaryPixelRatio")&&30<a.Jx&&Ve(a),We(a,this.draggedParts),this.ua("Drag"),this.startPoint=a.firstInput.documentPoint,a.isMouseCaptured=
!0,a.allowDragOut&&(this.isDragOutStarted=!0,this.Fn=!1,Te=this,Xe=this.diagram,this.doSimulatedDragOut()))};function Ue(a,b){if(a.dragsLink){var c=a.diagram;c.allowRelink&&(c.model.kk()&&1===b.count&&b.first()instanceof S?(a.draggedLink=b.first(),a.draggedLink.canRelinkFrom()&&a.draggedLink.canRelinkTo()&&a.draggedLink.$j(),a.lg=c.toolManager.findTool("Relinking"),null===a.lg&&(a.lg=new bf,a.lg.diagram=c)):(a.draggedLink=null,a.lg=null))}}
Re.prototype.computeEffectiveCollection=function(a,b){return this.diagram.commandHandler.computeEffectiveCollection(a,b)};Re.prototype.td=function(a){return void 0===a?new cf(Gb):this.isGridSnapEnabled?new cf(new I(Math.round(a.x),Math.round(a.y))):new cf(a.copy())};
Re.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.Cf();df(this);ef(a,this.draggedParts);this.draggedParts=this.currentPart=this.po=null;this.Fn=this.isDragOutStarted=!1;if(0<ff.count){for(var b=ff,c=b.length,d=0;d<c;d++){var e=b.L(d);gf(e);hf(e);df(e);e.diagram.Cf()}b.clear()}gf(this);this.Sl.h(NaN,NaN);Te=Xe=null;hf(this);a.isMouseCaptured=!1;a.currentCursor="";a.$t=!1;this.Dg();jf(a,!0)};
function df(a){var b=a.diagram,c=b.skipsUndoManager;b.skipsUndoManager=!0;kf(a,b.lastInput,null);b.skipsUndoManager=c;a.Qg.length=0}function lf(){var a=Te;hf(a);mf(a);var b=a.diagram;a.Sl.v()&&(b.position=a.Sl);b.Cf()}Re.prototype.doCancel=function(){hf(this);mf(this);var a=this.diagram;this.Sl.v()&&(a.position=this.Sl);this.stopTool()};Re.prototype.doKeyDown=function(){this.isActive&&("Esc"===this.diagram.lastInput.key?this.doCancel():this.doMouseMove())};
Re.prototype.doKeyUp=function(){this.isActive&&this.doMouseMove()};function nf(a,b){var c=Infinity,d=Infinity,e=-Infinity,f=-Infinity;for(a=a.iterator;a.next();){var g=a.value;if(g.Wb()&&g.isVisible()){var h=g.location;g=h.x;h=h.y;isNaN(g)||isNaN(h)||(g<c&&(c=g),h<d&&(d=h),g>e&&(e=g),h>f&&(f=h))}}Infinity===c?b.h(0,0,0,0):b.h(c,d,e-c,f-d)}
function of(a,b){if(null===a.copiedParts){var c=a.diagram;if((!b||!c.isReadOnly&&!c.isModelReadOnly)&&null!==a.draggedParts){var d=c.undoManager;d.isEnabled&&d.isInTransaction?null!==d.currentTransaction&&0<d.currentTransaction.changes.count&&(c.undoManager.Bf(),c.ua("Drag")):mf(a);c.skipsUndoManager=!b;c.partManager.addsToTemporaryLayer=!b;a.startPoint=c.firstInput.documentPoint;b=a.copiesEffectiveCollection?a.draggedParts.Df():c.selection;c=c.ek(b,c,!0);for(b=c.iterator;b.next();)b.value.location=
b.key.location;b=N.alloc();nf(c,b);N.free(b);b=new H;for(d=a.draggedParts.iterator;d.next();){var e=d.key;e.Wb()&&e.canCopy()&&(e=c.H(e),null!==e&&(e.Ab(),b.add(e,a.td(e.location))))}for(c=c.iterator;c.next();)d=c.value,d instanceof S&&d.canCopy()&&b.add(d,a.td());a.copiedParts=b;Ue(a,b.Df());null!==a.draggedLink&&(c=a.draggedLink,b=c.routeBounds,pf(c,a.startPoint.x-(b.x+b.width/2),a.startPoint.y-(b.y+b.height/2)))}}}
function hf(a){var b=a.diagram;if(null!==a.copiedParts&&(b.Ut(a.copiedParts.Df(),!1),a.copiedParts=null,null!==a.draggedParts))for(var c=a.draggedParts.iterator;c.next();)c.key instanceof S&&(c.value.point=new I(0,0));b.skipsUndoManager=!1;b.partManager.addsToTemporaryLayer=!1;a.startPoint=b.firstInput.documentPoint}
function gf(a){if(null!==a.draggedLink){if(a.dragsLink&&null!==a.lg){var b=a.lg;b.diagram.remove(b.temporaryFromNode);b.diagram.remove(b.temporaryToNode)}a.draggedLink=null;a.lg=null}}function qf(a,b,c){var d=a.diagram,e=a.startPoint,f=I.alloc();f.assign(d.lastInput.documentPoint);a.moveParts(b,f.be(e),c);I.free(f);!0===d.Ee("temporaryPixelRatio")&&null===d.rh&&30<d.Jx&&(Ve(d),d.St())}Re.prototype.moveParts=function(a,b,c){var d=this.diagram;null!==d&&rf(d,a,b,this.dragOptions,c)};
function mf(a){if(null!==a.draggedParts){for(var b=a.diagram,c=a.draggedParts.iterator;c.next();){var d=c.key;d.Wb()&&(d.location=c.value.point)}for(c=a.draggedParts.iterator;c.next();)if(d=c.key,d instanceof S&&d.suspendsRouting){var e=c.value.point;a.draggedParts.add(d,a.td());pf(d,-e.x,-e.y)}b.Wc()}}
function sf(a,b){var c=a.diagram;a.dragsLink&&(null!==a.draggedLink&&(a.draggedLink.fromNode=null,a.draggedLink.toNode=null),tf(a,!1));var d=a.findDragOverObject(b),e=c.lastInput;e.targetObject=d;a.doUpdateCursor(d);var f=c.skipsUndoManager,g=!1;try{c.skipsUndoManager=!0;g=kf(a,e,d);if(!a.isActive&&null===Te)return;var h=null!==d?d.part:null;if(null===h||c.handlesDragDropForTopLevelParts&&h.isTopLevel&&!(h instanceof uf)){var k=c.mouseDragOver;null!==k&&(k(e),g=!0)}if(!a.isActive&&null===Te)return;
a.doDragOver(b,d);if(!a.isActive&&null===Te)return}finally{c.skipsUndoManager=f,g&&c.Wc()}a.po=d;c.isReadOnly||!c.allowMove&&!c.allowCopy||!c.allowHorizontalScroll&&!c.allowVerticalScroll||c.rt(e.viewPoint)}Re.prototype.findDragOverObject=function(a){var b=this;return vf(this.diagram,a,null,function(a){null===a?a=!0:(a=a.part,a=null===a||a instanceof Ke||a.layer.isTemporary||b.draggedParts&&b.draggedParts.contains(a)||b.copiedParts&&b.copiedParts.contains(a)?!0:!1);return!a})};
Re.prototype.doUpdateCursor=function(a){var b=this.diagram;this.po!==a&&(!this.diagram.currentTool.isActive||this.mayCopy()?b.currentCursor=this.copyCursor:this.mayMove()?b.currentCursor=this.moveCursor:this.mayDragOut()&&(b.currentCursor=this.nodropCursor))};
function kf(a,b,c){var d=!1,e=a.Qg.length,f=0<e?a.Qg[0]:null;if(c===f)return!1;b.handled=!1;for(var g=0;g<e;g++){var h=a.Qg[g],k=h.mouseDragLeave;if(null!==k&&(k(b,h,c),d=!0,b.handled))break}a.Qg.length=0;if(!a.isActive&&null===Te||null===c)return d;b.handled=!1;for(e=c;null!==e;)a.Qg.push(e),e=wf(e);e=a.Qg.length;for(c=0;c<e&&(g=a.Qg[c],h=g.mouseDragEnter,null===h||(h(b,g,f),d=!0,!b.handled));c++);return d}
function wf(a){var b=a.panel;return null!==b?b:a instanceof T&&!(a instanceof uf)&&(a=a.containingGroup,null!==a&&a.handlesDragDropForMembers)?a:null}function xf(a,b,c){var d=a.lg;if(null===d)return null;var e=a.diagram.xg(b,d.portGravity,function(a){return d.findValidLinkablePort(a,c)});a=I.alloc();var f=Infinity,g=null;for(e=e.iterator;e.next();){var h=e.value;if(null!==h.part){var k=h.ga(Ac,a);k=b.De(k);k<f&&(g=h,f=k)}}I.free(a);return g}
function tf(a,b){var c=a.draggedLink;if(null!==c&&!(2>c.pointsCount)){var d=a.diagram;if(!d.isReadOnly){var e=a.lg;if(null!==e){var f=null,g=null;null===c.fromNode&&(f=xf(a,c.i(0),!1),null!==f&&(g=f.part));var h=null,k=null;null===c.toNode&&(h=xf(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.oy&&d.R("LinkRelinked",c,d.oy),c.toPort!==d.py&&d.R("LinkRelinked",c,d.py)):Df(e,g,f,k,h):Df(e,null,null,null,null)}}}}Re.prototype.doDragOver=function(){};
function Ef(a,b){var c=a.diagram;a.dragsLink&&tf(a,!0);df(a);var d=a.findDragOverObject(b),e=c.lastInput;e.targetObject=d;if(null!==d){e.handled=!1;for(var f=d;null!==f;){var g=f.mouseDrop;if(null!==g&&(g(e,f),e.handled))break;Ff(a,e,f);f=wf(f)}}else f=c.mouseDrop,null!==f&&f(e);if(a.isActive||null!==Te){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!==Te){a=N.alloc();for(b=
c.selection.iterator;b.next();)d=b.value,d instanceof V&&Gf(c,d,a);N.free(a)}}}function Ff(a,b,c){a=a.diagram;c=c.part;!a.handlesDragDropForTopLevelParts||!c.isTopLevel||c instanceof uf||(c=a.mouseDrop,null!==c&&c(b))}function Gf(a,b,c){var d=!1;b.getAvoidableRect(c);a.viewportBounds.Ce(c)&&(d=!0);a=a.Gv(c,function(a){return a.part},function(a){return a instanceof S},!0,function(a){return a instanceof S},d);if(0!==a.count)for(a=a.iterator;a.next();)c=a.value,!c.yd(b)&&c.isAvoiding&&c.Ta()}
Re.prototype.doDropOnto=function(){};Re.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram,b=a.lastInput;this.simulatedMouseMove(b.event,b.documentPoint,b.targetDiagram)||null===this.currentPart||null===this.draggedParts||(this.mayCopy()?(of(this,!1),We(a,this.copiedParts),qf(this,this.copiedParts,!1),ef(a,this.copiedParts)):this.mayMove()?(hf(this),qf(this,this.draggedParts,!0)):this.mayDragOut()?(of(this,!1),qf(this,this.copiedParts,!1)):hf(this),sf(this,a.lastInput.documentPoint))}};
Re.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram,b=a.lastInput;if(!this.simulatedMouseUp(b.event,b.documentPoint,b.targetDiagram)){b=!1;var c=this.mayCopy();c&&null!==this.copiedParts?(hf(this),of(this,!0),We(a,this.copiedParts),qf(this,this.copiedParts,!1),ef(a,this.copiedParts),null!==this.copiedParts&&(a.R("ChangingSelection",a.selection),a.clearSelection(!0),this.copiedParts.iteratorKeys.each(function(a){a.isSelected=!0}))):(b=!0,hf(this),this.mayMove()&&(qf(this,this.draggedParts,
!0),sf(this,a.lastInput.documentPoint)));this.Fn=!0;Ef(this,a.lastInput.documentPoint);if(this.isActive){var d=c?this.copiedParts.Df():this.draggedParts.Df();this.copiedParts=null;b&&Hf(this);a.Na();ef(a,this.draggedParts);this.transactionResult=c?"Copy":"Move";a.R(c?"SelectionCopied":"SelectionMoved",d)}this.stopTool();c&&a.R("ChangedSelection",a.selection)}}};
Re.prototype.simulatedMouseMove=function(a,b,c){if(null===Te)return!1;var d=Te.diagram;c instanceof Q||(c=null);var e=Xe;c!==e&&(null!==e&&e!==d&&(e.Cf(),Te.isDragOutStarted=!1,e=e.toolManager.findTool("Dragging"),null!==e&&e.doSimulatedDragLeave()),Xe=c,null!==c&&c!==d&&(lf(),e=c.toolManager.findTool("Dragging"),null!==e&&(ff.contains(e)||ff.add(e),e.doSimulatedDragEnter())));if(null===c||c===d||!c.allowDrop||c.isReadOnly||!c.allowInsert)return!1;d=c.toolManager.findTool("Dragging");null!==d&&(null!==
a&&(void 0!==a.targetTouches&&(0<a.targetTouches.length?a=a.targetTouches[0]:0<a.changedTouches.length&&(a=a.changedTouches[0])),b=c.getMouse(a)),c.lastInput.documentPoint=b,c.lastInput.viewPoint=c.Wq(b),c.lastInput.down=!1,c.lastInput.up=!1,d.doSimulatedDragOver());return!0};
Re.prototype.simulatedMouseUp=function(a,b,c){if(null===Te)return!1;var d=Xe,e=Te.diagram;if(null===c)return Te.doCancel(),!0;if(c!==d){var f=d.toolManager.findTool("Dragging");if(null!==d&&d!==e&&null!==f)return d.Cf(),Te.isDragOutStarted=!1,f.doSimulatedDragLeave(),!1;Xe=c;d=c.toolManager.findTool("Dragging");null!==d&&(lf(),ff.contains(d)||ff.add(d),d.doSimulatedDragEnter())}return c!==this.diagram?(null!==a?(void 0!==a.targetTouches&&(0<a.targetTouches.length?a=a.targetTouches[0]:0<a.changedTouches.length&&
(a=a.changedTouches[0])),b=c.getMouse(a)):null===b&&(b=new I),c.lastInput.documentPoint=b,c.lastInput.viewPoint=c.Wq(b),c.lastInput.down=!1,c.lastInput.up=!0,a=c.toolManager.findTool("Dragging"),null!==a&&a.doSimulatedDrop(),a=Te,null!==a&&(c=a.mayCopy(),a.transactionResult=c?"Copy":"Move",a.stopTool()),!0):!1};
function Hf(a){if(null!==a.draggedParts)for(var b=a.draggedParts.iterator;b.next();){var c=b.key;c instanceof V&&(c=c.containingGroup,null===c||null===c.placeholder||a.draggedParts.contains(c)||c.placeholder.o())}}
Re.prototype.mayCopy=function(){if(!this.isCopyEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowCopy||(Wa?!a.lastInput.alt:!a.lastInput.control))return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.Wb()&&b.canCopy())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1};
Re.prototype.mayDragOut=function(){if(!this.isCopyEnabled)return!1;var a=this.diagram;if(!a.allowDragOut||!a.allowCopy||a.allowMove)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.Wb()&&b.canCopy())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1};
Re.prototype.mayMove=function(){var a=this.diagram;if(a.isReadOnly||!a.allowMove)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.Wb()&&b.canMove())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canMove()?!0:!1};Re.prototype.computeBorder=function(a,b,c){return this.Fn||null===this.draggedParts||this.draggedParts.contains(a)?null:c.assign(b)};Re.prototype.Mz=function(){return Te};
Re.prototype.mayDragIn=function(){var a=this.diagram;if(!a.allowDrop||a.isReadOnly||a.isModelReadOnly||!a.allowInsert)return!1;var b=Te;return null===b||b.diagram.model.dataFormat!==a.model.dataFormat?!1:!0};Re.prototype.doSimulatedDragEnter=function(){if(this.mayDragIn()){var a=this.diagram;a.animationManager.Xc();If(a);a.animationManager.Xc();var b=Te;null!==b&&(b.diagram.$t=!1);this.doUpdateCursor(a.grid)}};
Re.prototype.doSimulatedDragLeave=function(){var a=Te;null!==a&&a.doSimulatedDragOut();this.doCancel()};Re.prototype.doSimulatedDragOver=function(){var a=this.diagram;a.animationManager.fn=!0;var b=Te;if(null!==b&&null!==b.draggedParts){if(!this.mayDragIn())return;Jf(this,b.draggedParts.Df(),!1,a.firstInput);qf(this,this.copiedParts,!1);sf(this,a.lastInput.documentPoint)}a.animationManager.fn=!1};
Re.prototype.doSimulatedDrop=function(){var a=this.diagram,b=Te;if(null!==b){var c=b.diagram;b.Fn=!0;hf(this);if(!this.mayDragIn())return;a.animationManager.fn=!0;a.R("ChangingSelection",a.selection);this.ua("Drop");Jf(this,b.draggedParts.Df(),!0,a.lastInput);qf(this,this.copiedParts,!1);null!==this.copiedParts&&(a.clearSelection(!0),this.copiedParts.iteratorKeys.each(function(a){a.isSelected=!0}));Ef(this,a.lastInput.documentPoint);a.Na();b=a.selection;null!==this.copiedParts?this.transactionResult=
"ExternalCopy":b=new F;this.copiedParts=null;a.doFocus();a.R("ExternalObjectsDropped",b,c);this.Dg();a.R("ChangedSelection",a.selection)}a.animationManager.fn=!1};
function Jf(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.ek(b,e,!0);var f=N.alloc();nf(b,f);d=f.x+f.width/2;e=f.y+f.height/2;N.free(f);f=a.Ys;var g=new H,h=I.alloc();for(b=b.iterator;b.next();){var k=b.value,l=c.H(k);k.Wb()&&k.canCopy()?(k=k.location,h.h(f.x-(d-k.x),f.y-(e-k.y)),l.location=h,l.Ab(),g.add(l,a.td(h))):l instanceof S&&k.canCopy()&&(pf(l,f.x-d,f.y-e),
g.add(l,a.td()))}I.free(h);a.copiedParts=g;Ue(a,g.Df());null!==a.draggedLink&&(c=a.draggedLink,d=c.routeBounds,pf(c,a.startPoint.x-(d.x+d.width/2),a.startPoint.y-(d.y+d.height/2)))}}}Re.prototype.doSimulatedDragOut=function(){var a=this.diagram;a.$t=!1;this.mayCopy()||this.mayMove()?a.currentCursor="":a.currentCursor=this.nodropCursor;this.po=null};Re.prototype.computeMove=function(a,b,c,d){c=this.diagram;return null!==c?c.computeMove(a,b,this.dragOptions,d):new I};
ma.Object.defineProperties(Re.prototype,{isCopyEnabled:{get:function(){return this.Yc},set:function(a){this.Yc=a}},copiesEffectiveCollection:{get:function(){return this.I},set:function(a){this.I=a}},dragOptions:{get:function(){return this.Ja},set:function(a){this.Ja=a}},isGridSnapEnabled:{get:function(){return this.dragOptions.isGridSnapEnabled},set:function(a){this.dragOptions.isGridSnapEnabled=
a}},isComplexRoutingRealtime:{get:function(){return this.Kc},set:function(a){this.Kc=a}},isGridSnapRealtime:{get:function(){return this.dragOptions.isGridSnapRealtime},set:function(a){this.dragOptions.isGridSnapRealtime=a}},gridSnapCellSize:{get:function(){return this.dragOptions.gridSnapCellSize},set:function(a){this.dragOptions.gridSnapCellSize.w(a)||(a=a.G(),this.dragOptions.gridSnapCellSize=a)}},gridSnapCellSpot:{
get:function(){return this.dragOptions.gridSnapCellSpot},set:function(a){this.dragOptions.gridSnapCellSpot.w(a)||(a=a.G(),this.dragOptions.gridSnapCellSpot=a)}},gridSnapOrigin:{get:function(){return this.dragOptions.gridSnapOrigin},set:function(a){this.dragOptions.gridSnapOrigin.w(a)||(a=a.G(),this.dragOptions.gridSnapOrigin=a)}},dragsLink:{get:function(){return this.dragOptions.dragsLink},set:function(a){this.dragOptions.dragsLink=
a}},dragsTree:{get:function(){return this.dragOptions.dragsTree},set:function(a){this.dragOptions.dragsTree=a}},copyCursor:{get:function(){return this.T},set:function(a){this.T=a}},moveCursor:{get:function(){return this.Nh},set:function(a){this.Nh=a}},nodropCursor:{get:function(){return this.Qh},set:function(a){this.Qh=a}},currentPart:{get:function(){return this.Ia},
set:function(a){this.Ia=a}},copiedParts:{get:function(){return this.u},set:function(a){this.u=a}},draggedParts:{get:function(){return this.bb},set:function(a){this.bb=a}},draggingParts:{get:function(){return null!==this.copiedParts?this.copiedParts.Df():null!==this.draggedParts?this.draggedParts.Df():this.ar}},draggedLink:{get:function(){return this.diagram.draggedLink},set:function(a){this.diagram.draggedLink=
a}},isDragOutStarted:{get:function(){return this.Ef},set:function(a){this.Ef=a}},startPoint:{get:function(){return this.Ys},set:function(a){this.Ys.w(a)||this.Ys.assign(a)}},delay:{get:function(){return this.Xk},set:function(a){this.Xk=a}}});Re.prototype.getDraggingSource=Re.prototype.Mz;var ff=null,Te=null,Xe=null;Re.className="DraggingTool";ff=new E;
La("draggingTool",function(){return this.findTool("Dragging")},function(a){this.Wa("Dragging",a,this.mouseMoveTools)});Oa.prototype.doCancel=function(){null!==Te&&Te.doCancel();Be.prototype.doCancel.call(this)};
function Kf(){Be.call(this);this.Qh=100;this.Ja=!1;this.hi="pointer";var a=new S,b=new W;b.isPanelMain=!0;b.stroke="blue";a.add(b);b=new W;b.toArrow="Standard";b.fill="blue";b.stroke="blue";a.add(b);a.layerName="Tool";this.Ow=a;a=new V;b=new W;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke="magenta";b.strokeWidth=2;b.desiredSize=Mb;a.add(b);a.selectable=!1;a.layerName="Tool";this.Nw=a;this.l=b;a=new V;b=new W;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke="magenta";b.strokeWidth=2;b.desiredSize=
Mb;a.add(b);a.selectable=!1;a.layerName="Tool";this.Pw=a;this.u=b;this.Nh=this.Ef=this.Kc=this.bb=this.Yc=null;this.Ia=!0;this.Gy=new H;this.ar=this.zi=this.Mw=null}la(Kf,Be);Kf.prototype.doStop=function(){this.diagram.Cf();this.originalToPort=this.originalToNode=this.originalFromPort=this.originalFromNode=this.originalLink=null;this.validPortsCache.clear();this.targetPort=null};
Kf.prototype.copyPortProperties=function(a,b,c,d,e){if(null!==a&&null!==b&&null!==c&&null!==d){var f=b.uf(),g=M.alloc();g.width=b.naturalBounds.width*f;g.height=b.naturalBounds.height*f;d.desiredSize=g;M.free(g);e?(d.toSpot=b.toSpot,d.toEndSegmentLength=b.toEndSegmentLength):(d.fromSpot=b.fromSpot,d.fromEndSegmentLength=b.fromEndSegmentLength);c.locationSpot=Ac;f=I.alloc();c.location=b.ga(Ac,f);I.free(f);d.angle=b.aj();null!==this.portTargeted&&this.portTargeted(a,b,c,d,e)}};
Kf.prototype.setNoTargetPortProperties=function(a,b,c){null!==b&&(b.desiredSize=Mb,b.fromSpot=uc,b.toSpot=uc);null!==a&&(a.location=this.diagram.lastInput.documentPoint);null!==this.portTargeted&&this.portTargeted(null,null,a,b,c)};Kf.prototype.doMouseDown=function(){this.isActive&&this.doMouseMove()};
Kf.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.rt(a.lastInput.viewPoint)}};Kf.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};
Kf.prototype.findTargetPort=function(a){var b=this.diagram,c=b.lastInput.documentPoint,d=this.portGravity;0>=d&&(d=.1);var e=this,f=b.xg(c,d,function(b){return e.findValidLinkablePort(b,a)},null,!0);d=Infinity;b=null;for(f=f.iterator;f.next();){var g=f.value,h=g.part;if(h instanceof V){var k=g.ga(Ac,I.alloc()),l=c.x-k.x,m=c.y-k.y;I.free(k);k=l*l+m*m;k<d&&(l=this.validPortsCache.H(g),null!==l?l&&(b=g,d=k):a&&this.isValidLink(this.originalFromNode,this.originalFromPort,h,g)||!a&&this.isValidLink(h,
g,this.originalToNode,this.originalToPort)?(this.validPortsCache.add(g,!0),b=g,d=k):this.validPortsCache.add(g,!1))}}return null!==b&&(c=b.part,c instanceof V&&(null===c.layer||c.layer.allowLink))?b:null};
Kf.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.rq(b).count>=c)return!1}return!0};
Kf.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.xd(b).count>=c)return!1}return!0};
Kf.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};Kf.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.xd(b);b.next();)if(d=b.value,d.fromNode===c&&d.fromPortId===a)return!0;return!1};
Kf.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};Kf.prototype.isLabelDependentOnLink=function(a,b){if(null===a)return!1;var c=a.labeledLink;if(null===c)return!1;if(c===b)return!0;var d=new F;d.add(a);return Lf(this,c,b,d)};
function Lf(a,b,c,d){if(b===c)return!0;var e=b.fromNode;if(null!==e&&e.isLinkLabel&&(d.add(e),Lf(a,e.labeledLink,c,d)))return!0;b=b.toNode;return null!==b&&b.isLinkLabel&&(d.add(b),Lf(a,b.labeledLink,c,d))?!0:!1}
Kf.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!==Mf){if(d===Nf){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!Of(this,a,b,c,!0)}if(d===Pf){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!Of(this,a,b,c,!0)}if(d===Qf)return a===b?a=!0:(d=new F,d.add(b),a=Rf(this,d,a,b,c)),!a;if(d===Sf)return!Of(this,a,b,c,!1);if(d===Tf)return a===b?a=!0:(d=new F,d.add(b),a=Uf(this,d,a,b,c)),!a}return!0};function Of(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&&Of(a,g,c,d,e)))return!0}return!1}
function Rf(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&&Rf(a,b,g,d,e)))return!0}return!1}function Uf(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&&Uf(a,b,h,d,e))return!0}}return!1}
ma.Object.defineProperties(Kf.prototype,{portGravity:{get:function(){return this.Qh},set:function(a){0<=a&&(this.Qh=a)}},isUnconnectedLinkValid:{get:function(){return this.Ja},set:function(a){this.Ja=a}},linkingCursor:{get:function(){return this.hi},set:function(a){this.hi=a}},temporaryLink:{get:function(){return this.Ow},set:function(a){this.Ow=a}},temporaryFromNode:{
get:function(){return this.Nw},set:function(a){if(this.Nw=a)this.l=a.port}},temporaryFromPort:{get:function(){return this.l},set:function(a){if(null!==this.l){var b=this.l.panel;if(null!==b){var c=b.W.indexOf(this.l);b.ab(c);b.ub(c,a)}}this.l=a}},temporaryToNode:{get:function(){return this.Pw},set:function(a){if(this.Pw=a)this.u=a.port}},temporaryToPort:{get:function(){return this.u},set:function(a){if(null!==
this.u){var b=this.u.panel;if(null!==b){var c=b.W.indexOf(this.u);b.ab(c);b.ub(c,a)}}this.u=a}},originalLink:{get:function(){return this.Yc},set:function(a){this.Yc=a}},originalFromNode:{get:function(){return this.bb},set:function(a){this.bb=a}},originalFromPort:{get:function(){return this.Kc},set:function(a){this.Kc=a}},originalToNode:{get:function(){return this.Ef},set:function(a){this.Ef=
a}},originalToPort:{get:function(){return this.Nh},set:function(a){this.Nh=a}},isForwards:{get:function(){return this.Ia},set:function(a){this.Ia=a}},validPortsCache:{get:function(){return this.Gy}},targetPort:{get:function(){return this.Mw},set:function(a){this.Mw=a}},linkValidation:{get:function(){return this.zi},set:function(a){this.zi=a}},portTargeted:{
get:function(){return this.ar},set:function(a){this.ar=a}}});Kf.className="LinkingBaseTool";function Vf(){Kf.call(this);this.name="Linking";this.T={};this.I=null;this.J=Wf;this.Rm=null}la(Vf,Kf);Vf.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowLink||!a.model.Gt()||!a.lastInput.left||a.currentTool!==this&&!this.isBeyondDragSize()?!1:null!==this.findLinkablePort()};
Vf.prototype.findLinkablePort=function(){var a=this.diagram,b=this.startObject;null===b&&(b=a.Ub(a.firstInput.documentPoint,null,null));if(null===b||!(b.part instanceof V))return null;a=this.direction;if(a===Wf||a===Xf){var c=this.findValidLinkablePort(b,!1);if(null!==c)return this.isForwards=!0,c}if(a===Wf||a===Yf)if(b=this.findValidLinkablePort(b,!0),null!==b)return this.isForwards=!1,b;return null};
Vf.prototype.doActivate=function(){var a=this.diagram,b=this.findLinkablePort();null!==b&&(this.ua(this.name),a.isMouseCaptured=!0,a.currentCursor=this.linkingCursor,this.isForwards?(null===this.temporaryToNode||this.temporaryToNode.location.v()||(this.temporaryToNode.location=a.lastInput.documentPoint),this.originalFromPort=b,b=this.originalFromPort.part,b instanceof V&&(this.originalFromNode=b),this.copyPortProperties(this.originalFromNode,this.originalFromPort,this.temporaryFromNode,this.temporaryFromPort,
!1)):(null===this.temporaryFromNode||this.temporaryFromNode.location.v()||(this.temporaryFromNode.location=a.lastInput.documentPoint),this.originalToPort=b,b=this.originalToPort.part,b instanceof V&&(this.originalToNode=b),this.copyPortProperties(this.originalToNode,this.originalToPort,this.temporaryToNode,this.temporaryToPort,!0)),a.add(this.temporaryFromNode),a.add(this.temporaryToNode),null!==this.temporaryLink&&(null!==this.temporaryFromNode&&(this.temporaryLink.fromNode=this.temporaryFromNode),
null!==this.temporaryToNode&&(this.temporaryLink.toNode=this.temporaryToNode),this.temporaryLink.isTreeLink=this.isNewTreeLink(),this.temporaryLink.Ta(),a.add(this.temporaryLink)),this.isActive=!0)};Vf.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.Dg()};Vf.prototype.doStop=function(){Kf.prototype.doStop.call(this);this.startObject=null};
Vf.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.transactionResult=null,c=null,d=null,e=null,f=null;try{var g=this.targetPort=this.findTargetPort(this.isForwards);if(null!==g){var h=g.part;h instanceof V&&(this.isForwards?(null!==this.originalFromNode&&(b=this.originalFromNode,c=this.originalFromPort),d=h,e=g):(b=h,c=g,null!==this.originalToNode&&(d=this.originalToNode,e=this.originalToPort)))}else this.isForwards?null!==this.originalFromNode&&this.isUnconnectedLinkValid&&
(b=this.originalFromNode,c=this.originalFromPort):null!==this.originalToNode&&this.isUnconnectedLinkValid&&(d=this.originalToNode,e=this.originalToPort);null!==b||null!==d?(f=this.insertLink(b,c,d,e),null!==f?(null===g&&(this.isForwards?f.defaultToPoint=a.lastInput.documentPoint:f.defaultFromPoint=a.lastInput.documentPoint),a.allowSelect&&(a.R("ChangingSelection",a.selection),a.clearSelection(!0),f.isSelected=!0),this.transactionResult=this.name,a.R("LinkDrawn",f)):(a.model.mq(),this.doNoLink(b,c,
d,e))):this.isForwards?this.doNoLink(this.originalFromNode,this.originalFromPort,null,null):this.doNoLink(null,null,this.originalToNode,this.originalToPort)}finally{this.stopTool(),f&&a.allowSelect&&a.R("ChangedSelection",a.selection)}}};
Vf.prototype.isNewTreeLink=function(){var a=this.archetypeLinkData;if(null===a)return!0;if(a instanceof S)return a.isTreeLink;var b=this.diagram;if(null===b)return!0;a=b.partManager.getLinkCategoryForData(a);b=b.partManager.findLinkTemplateForCategory(a);return null!==b?b.isTreeLink:!0};Vf.prototype.insertLink=function(a,b,c,d){return this.diagram.partManager.insertLink(a,b,c,d)};Vf.prototype.doNoLink=function(){};
ma.Object.defineProperties(Vf.prototype,{archetypeLinkData:{get:function(){return this.T},set:function(a){this.T=a}},archetypeLabelNodeData:{get:function(){return this.I},set:function(a){this.I=a}},direction:{get:function(){return this.J},set:function(a){this.J=a}},startObject:{get:function(){return this.Rm},set:function(a){this.Rm=a}}});
var Wf=new D(Vf,"Either",0),Xf=new D(Vf,"ForwardsOnly",0),Yf=new D(Vf,"BackwardsOnly",0);Vf.className="LinkingTool";Vf.Either=Wf;Vf.ForwardsOnly=Xf;Vf.BackwardsOnly=Yf;
function bf(){Kf.call(this);this.name="Relinking";var a=new W;a.figure="Diamond";a.desiredSize=Ob;a.fill="lightblue";a.stroke="dodgerblue";a.cursor=this.linkingCursor;a.segmentIndex=0;this.T=a;a=new W;a.figure="Diamond";a.desiredSize=Ob;a.fill="lightblue";a.stroke="dodgerblue";a.cursor=this.linkingCursor;a.segmentIndex=-1;this.Rm=a;this.I=null;this.qx=new N}la(bf,Kf);
bf.prototype.updateAdornments=function(a){if(null!==a&&a instanceof S){var b="RelinkFrom",c=null;if(a.isSelected&&!this.diagram.isReadOnly){var d=a.selectionObject;null!==d&&a.canRelinkFrom()&&a.actualBounds.v()&&a.isVisible()&&d.actualBounds.v()&&d.zf()&&(c=a.hk(b),null===c&&(c=this.makeAdornment(d,!1),a.zh(b,c)))}null===c&&a.Af(b);b="RelinkTo";c=null;a.isSelected&&!this.diagram.isReadOnly&&(d=a.selectionObject,null!==d&&a.canRelinkTo()&&a.actualBounds.v()&&a.isVisible()&&d.actualBounds.v()&&d.zf()&&
(c=a.hk(b),null===c?(c=this.makeAdornment(d,!0),a.zh(b,c)):c.o()));null===c&&a.Af(b)}};bf.prototype.makeAdornment=function(a,b){var c=new Ke;c.type=X.Link;b=b?this.toHandleArchetype:this.fromHandleArchetype;null!==b&&c.add(b.copy());c.adornedObject=a;return c};
bf.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowRelink||!a.model.Gt()||!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};
bf.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 Ke&&c.adornedPart instanceof S))return;this.handle=b;this.isForwards=null===c||"RelinkTo"===c.category;this.originalLink=c.adornedPart}this.ua(this.name);a.isMouseCaptured=!0;a.currentCursor=this.linkingCursor;
this.originalFromPort=this.originalLink.fromPort;this.originalFromNode=this.originalLink.fromNode;this.originalToPort=this.originalLink.toPort;this.originalToNode=this.originalLink.toNode;this.qx.set(this.originalLink.actualBounds);null!==this.originalLink&&0<this.originalLink.pointsCount&&(null===this.originalLink.fromNode&&(null!==this.temporaryFromPort&&(this.temporaryFromPort.desiredSize=Lb),null!==this.temporaryFromNode&&(this.temporaryFromNode.location=this.originalLink.i(0))),null===this.originalLink.toNode&&
(null!==this.temporaryToPort&&(this.temporaryToPort.desiredSize=Lb),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};
bf.prototype.copyLinkProperties=function(a,b){if(null!==a&&null!==b){b.adjusting=a.adjusting;b.corner=a.corner;var c=a.curve;if(c===Zf||c===$f)c=ag;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}};
bf.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.Dg()};bf.prototype.doStop=function(){Kf.prototype.doStop.call(this);this.handle=null};
bf.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.R("LinkRelinked",f,this.isForwards?this.originalToPort:this.originalFromPort)):this.doNoRelink(this.originalLink,this.isForwards);this.originalLink.Bq(this.qx)}this.stopTool()};
bf.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};bf.prototype.doNoRelink=function(){};
function Df(a,b,c,d,e){null!==b?(a.copyPortProperties(b,c,a.temporaryFromNode,a.temporaryFromPort,!1),a.diagram.add(a.temporaryFromNode)):a.diagram.remove(a.temporaryFromNode);null!==d?(a.copyPortProperties(d,e,a.temporaryToNode,a.temporaryToPort,!0),a.diagram.add(a.temporaryToNode)):a.diagram.remove(a.temporaryToNode)}
ma.Object.defineProperties(bf.prototype,{fromHandleArchetype:{get:function(){return this.T},set:function(a){this.T=a}},toHandleArchetype:{get:function(){return this.Rm},set:function(a){this.Rm=a}},handle:{get:function(){return this.I},set:function(a){if(null!==a&&!(a.part instanceof Ke))throw Error("new handle is not in an Adornment: "+a);this.I=a}}});bf.className="RelinkingTool";
La("linkingTool",function(){return this.findTool("Linking")},function(a){this.Wa("Linking",a,this.mouseMoveTools)});La("relinkingTool",function(){return this.findTool("Relinking")},function(a){this.Wa("Relinking",a,this.mouseDownTools)});
function bg(){Be.call(this);this.name="LinkReshaping";var a=new W;a.figure="Rectangle";a.desiredSize=Nb;a.fill="lightblue";a.stroke="dodgerblue";this.u=a;a=new W;a.figure="Diamond";a.desiredSize=Ob;a.fill="lightblue";a.stroke="dodgerblue";a.cursor="move";this.I=a;this.T=3;this.iu=this.l=null;this.sx=new I;this.zs=new E}la(bg,Be);bg.prototype.Kv=function(a){return a&&a.Gs&&0!==a.Gs.value?a.Gs:cg};bg.prototype.Lm=function(a,b){a.Gs=b};
bg.prototype.updateAdornments=function(a){if(null!==a&&a instanceof S){var b=null;if(a.isSelected&&!this.diagram.isReadOnly){var c=a.path;null!==c&&a.canReshape()&&a.actualBounds.v()&&a.isVisible()&&c.actualBounds.v()&&c.zf()&&(b=a.hk(this.name),null===b||b.nx!==a.pointsCount||b.Cx!==a.resegmentable)&&(b=this.makeAdornment(c),null!==b&&(b.nx=a.pointsCount,b.Cx=a.resegmentable,a.zh(this.name,b)))}null===b&&a.Af(this.name)}};
bg.prototype.makeAdornment=function(a){var b=a.part,c=b.pointsCount,d=b.isOrthogonal,e=null;if(null!==b.points&&1<c){e=new Ke;e.type=X.Link;c=b.firstPickIndex;var f=b.lastPickIndex,g=d?1:0;if(b.resegmentable&&b.computeCurve()!==dg)for(var h=c+g;h<f-g;h++){var k=this.makeResegmentHandle(a,h);null!==k&&(k.segmentIndex=h,k.segmentFraction=.5,k.fromMaxLinks=999,e.add(k))}for(g=c+1;g<f;g++)if(h=this.makeHandle(a,g),null!==h){h.segmentIndex=g;if(g!==c)if(g===c+1&&d){k=b.i(c);var l=b.i(c+1);K.A(k.x,l.x)&&
K.A(k.y,l.y)&&(l=b.i(c-1));K.A(k.x,l.x)?(this.Lm(h,pg),h.cursor="n-resize"):K.A(k.y,l.y)&&(this.Lm(h,qg),h.cursor="w-resize")}else g===f-1&&d?(k=b.i(f-1),l=b.i(f),K.A(k.x,l.x)&&K.A(k.y,l.y)&&(k=b.i(f+1)),K.A(k.x,l.x)?(this.Lm(h,pg),h.cursor="n-resize"):K.A(k.y,l.y)&&(this.Lm(h,qg),h.cursor="w-resize")):g!==f&&(this.Lm(h,rg),h.cursor="move");e.add(h)}e.adornedObject=a}return e};bg.prototype.makeHandle=function(){var a=this.handleArchetype;return null===a?null:a.copy()};
bg.prototype.makeResegmentHandle=function(){var a=this.midHandleArchetype;return null===a?null:a.copy()};bg.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};
bg.prototype.doActivate=function(){var a=this.diagram;null===this.handle&&(this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name));if(null!==this.handle){var b=this.handle.part.adornedPart;if(b instanceof S){this.iu=b;a.isMouseCaptured=!0;this.ua(this.name);if(b.resegmentable&&999===this.handle.fromMaxLinks){var c=b.points.copy(),d=this.getResegmentingPoint();c.ub(this.handle.segmentIndex+1,d);b.isOrthogonal&&c.ub(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.sx=b.i(this.handle.segmentIndex);this.zs=b.points.copy();this.isActive=!0}}};bg.prototype.doDeactivate=function(){this.Dg();this.iu=this.handle=null;this.isActive=this.diagram.isMouseCaptured=!1};bg.prototype.doCancel=function(){var a=this.adornedLink;null!==a&&(a.points=this.zs);this.stopTool()};bg.prototype.getResegmentingPoint=function(){return this.handle.ga(Ac)};
bg.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeReshape(a.lastInput.documentPoint),this.reshape(a))};
bg.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&&(sg(this,g,d,e,f,!0)||sg(this,g,d,e,f,!1))){var h=b.points.copy();sg(this,g,d,
e,f,!0)?(h.hd(c-2,new I(g.x,(f.y+g.y)/2)),h.hd(c+1,new I(f.x,(f.y+g.y)/2))):(h.hd(c-2,new I((f.x+g.x)/2,g.y)),h.hd(c+1,new I((f.x+g.x)/2,f.y)));h.ab(c);h.ab(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&&(sg(this,d,e,f,g,!0)||sg(this,d,e,f,g,!1))&&(h=b.points.copy(),sg(this,d,e,f,g,!0)?(h.hd(c-1,new I(d.x,(d.y+g.y)/2)),h.hd(c+2,new I(g.x,(d.y+g.y)/2))):(h.hd(c-1,new I((d.x+g.x)/2,d.y)),h.hd(c+2,new I((d.x+g.x)/2,g.y))),
h.ab(c+1),h.ab(c),b.points=h,b.Mb())}}else g=I.alloc(),K.Kh(d.x,d.y,f.x,f.y,e.x,e.y,g)&&g.De(e)<this.resegmentingDistance*this.resegmentingDistance&&(d=b.points.copy(),d.ab(c),b.points=d,b.Mb()),I.free(g)}a.Na();this.transactionResult=this.name;a.R("LinkReshaped",this.adornedLink,this.zs)}this.stopTool()};
function sg(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}
bg.prototype.reshape=function(a){var b=this.adornedLink;b.Mh();var c=this.handle.segmentIndex,d=this.Kv(this.handle);if(b.isOrthogonal)if(c===b.firstPickIndex+1)c=b.firstPickIndex+1,d===pg?(b.K(c,b.i(c-1).x,a.y),b.K(c+1,b.i(c+2).x,a.y)):d===qg&&(b.K(c,a.x,b.i(c-1).y),b.K(c+1,a.x,b.i(c+2).y));else if(c===b.lastPickIndex-1)c=b.lastPickIndex-1,d===pg?(b.K(c-1,b.i(c-2).x,a.y),b.K(c,b.i(c+1).x,a.y)):d===qg&&(b.K(c-1,a.x,b.i(c-2).y),b.K(c,a.x,b.i(c+1).y));else{d=c;var e=b.i(d),f=b.i(d-1),g=b.i(d+1);K.A(f.x,
e.x)&&K.A(e.y,g.y)?(K.A(f.x,b.i(d-2).x)&&!K.A(f.y,b.i(d-2).y)?(b.m(d,a.x,f.y),c++,d++):b.K(d-1,a.x,f.y),K.A(g.y,b.i(d+2).y)&&!K.A(g.x,b.i(d+2).x)?b.m(d+1,g.x,a.y):b.K(d+1,g.x,a.y)):K.A(f.y,e.y)&&K.A(e.x,g.x)?(K.A(f.y,b.i(d-2).y)&&!K.A(f.x,b.i(d-2).x)?(b.m(d,f.x,a.y),c++,d++):b.K(d-1,f.x,a.y),K.A(g.x,b.i(d+2).x)&&!K.A(g.y,b.i(d+2).y)?b.m(d+1,a.x,g.y):b.K(d+1,a.x,g.y)):K.A(f.x,e.x)&&K.A(e.x,g.x)?(K.A(f.x,b.i(d-2).x)&&!K.A(f.y,b.i(d-2).y)?(b.m(d,a.x,f.y),c++,d++):b.K(d-1,a.x,f.y),K.A(g.x,b.i(d+2).x)&&
!K.A(g.y,b.i(d+2).y)?b.m(d+1,a.x,g.y):b.K(d+1,a.x,g.y)):K.A(f.y,e.y)&&K.A(e.y,g.y)&&(K.A(f.y,b.i(d-2).y)&&!K.A(f.x,b.i(d-2).x)?(b.m(d,f.x,a.y),c++,d++):b.K(d-1,f.x,a.y),K.A(g.y,b.i(d+2).y)&&!K.A(g.x,b.i(d+2).x)?b.m(d+1,g.x,a.y):b.K(d+1,g.x,a.y));b.K(c,a.x,a.y)}else b.K(c,a.x,a.y),d=b.fromNode,e=b.fromPort,null!==d&&(f=d.findVisibleNode(),null!==f&&f!==d&&(d=f,e=d.port)),1===c&&b.computeSpot(!0,e).kc()&&(f=e.ga(Ac,I.alloc()),d=b.getLinkPointFromPoint(d,e,f,a,!0,I.alloc()),b.K(0,d.x,d.y),I.free(f),
I.free(d)),d=b.toNode,e=b.toPort,null!==d&&(f=d.findVisibleNode(),null!==f&&f!==d&&(d=f,e=d.port)),c===b.pointsCount-2&&b.computeSpot(!1,e).kc()&&(c=e.ga(Ac,I.alloc()),a=b.getLinkPointFromPoint(d,e,c,a,!1,I.alloc()),b.K(b.pointsCount-1,a.x,a.y),I.free(c),I.free(a));b.rf()};bg.prototype.computeReshape=function(a){var b=this.adornedLink,c=this.handle.segmentIndex;switch(this.Kv(this.handle)){case rg:return a;case pg:return new I(b.i(c).x,a.y);case qg:return new I(a.x,b.i(c).y);default:case cg:return b.i(c)}};
ma.Object.defineProperties(bg.prototype,{handleArchetype:{get:function(){return this.u},set:function(a){this.u=a}},midHandleArchetype:{get:function(){return this.I},set:function(a){this.I=a}},handle:{get:function(){return this.l},set:function(a){if(null!==a&&!(a.part instanceof Ke))throw Error("new handle is not in an Adornment: "+a);this.l=a}},adornedLink:{get:function(){return this.iu}},
resegmentingDistance:{get:function(){return this.T},set:function(a){this.T=a}},originalPoint:{get:function(){return this.sx}},originalPoints:{get:function(){return this.zs}}});bg.prototype.setReshapingBehavior=bg.prototype.Lm;bg.prototype.getReshapingBehavior=bg.prototype.Kv;var cg=new D(bg,"None",0),qg=new D(bg,"Horizontal",1),pg=new D(bg,"Vertical",2),rg=new D(bg,"All",3);bg.className="LinkReshapingTool";
bg.None=cg;bg.Horizontal=qg;bg.Vertical=pg;bg.All=rg;La("linkReshapingTool",function(){return this.findTool("LinkReshaping")},function(a){this.Wa("LinkReshaping",a,this.mouseDownTools)});
function tg(){Be.call(this);this.name="Resizing";this.bg=(new M(1,1)).freeze();this.ag=(new M(9999,9999)).freeze();this.Kg=(new M(NaN,NaN)).freeze();this.I=!1;this.T=!0;this.de=null;var a=new W;a.alignmentFocus=Ac;a.figure="Rectangle";a.desiredSize=Nb;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.u=a;this.l=null;this.ys=new I;this.px=new M;this.bp=new I;this.zu=new M(0,0);this.yu=new M(Infinity,Infinity);this.xu=new M(1,1);this.mx=!0}la(tg,Be);
tg.prototype.updateAdornments=function(a){if(!(null===a||a instanceof S)){if(a.isSelected&&!this.diagram.isReadOnly){var b=a.resizeObject,c=a.hk(this.name);if(null!==b&&a.canResize()&&a.actualBounds.v()&&a.isVisible()&&b.actualBounds.v()&&b.zf()){if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){b=b.aj();ug(a)&&this.updateResizeHandles(c,b);a.zh(this.name,c);return}}}a.Af(this.name)}};
tg.prototype.makeAdornment=function(a){var b=a.part.resizeAdornmentTemplate;if(null===b){b=new Ke;b.type=X.Spot;b.locationSpot=Ac;var c=new vg;c.isPanelMain=!0;b.add(c);b.add(this.makeHandle(a,vc));b.add(this.makeHandle(a,yc));b.add(this.makeHandle(a,Gc));b.add(this.makeHandle(a,Cc));b.add(this.makeHandle(a,ed));b.add(this.makeHandle(a,gd));b.add(this.makeHandle(a,hd));b.add(this.makeHandle(a,fd))}else if(wg(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};
tg.prototype.makeHandle=function(a,b){a=this.handleArchetype;if(null===a)return null;a=a.copy();a.alignment=b;return a};
tg.prototype.updateResizeHandles=function(a,b){if(null!==a)if(!a.alignment.Nb()&&("pointer"===a.cursor||0<a.cursor.indexOf("resize")))a:{var c=a.alignment;c.kc()&&(c=Ac);if(0>=c.x)b=0>=c.y?b+225:1<=c.y?b+135:b+180;else if(1<=c.x)0>=c.y?b+=315:1<=c.y&&(b+=45);else if(0>=c.y)b+=270;else if(1<=c.y)b+=90;else break a;0>b?b+=360:360<=b&&(b-=360);a.cursor=22.5>b?"e-resize":67.5>b?"se-resize":112.5>b?"s-resize":157.5>b?"sw-resize":202.5>b?"w-resize":247.5>b?"nw-resize":292.5>b?"n-resize":337.5>b?"ne-resize":
"e-resize"}else if(a instanceof X)for(a=a.elements;a.next();)this.updateResizeHandles(a.value,b)};tg.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};
tg.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.ys.set(this.adornedObject.ga(this.handle.alignment.Zv())),this.bp.set(this.adornedObject.part.location),this.px.set(this.adornedObject.desiredSize),this.xu=this.computeCellSize(),this.zu=this.computeMinSize(),this.yu=this.computeMaxSize(),a.isMouseCaptured=
!0,this.mx=a.animationManager.isEnabled,a.animationManager.isEnabled=!1,this.ua(this.name),this.isActive=!0))};tg.prototype.doDeactivate=function(){var a=this.diagram;this.Dg();this.de=this.handle=null;this.isActive=a.isMouseCaptured=!1;a.animationManager.isEnabled=this.mx};tg.prototype.doCancel=function(){null!==this.adornedObject&&(this.adornedObject.desiredSize=this.originalDesiredSize,this.adornedObject.part.location=this.originalLocation);this.stopTool()};
tg.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive){var b=this.zu,c=this.yu,d=this.xu,e=this.adornedObject.zt(a.lastInput.documentPoint,I.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);a.Wc();I.free(e)}};
tg.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.zu,c=this.yu,d=this.xu,e=this.adornedObject.zt(a.lastInput.documentPoint,I.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);I.free(e);a.Na();this.transactionResult=this.name;a.R("PartResized",this.adornedObject,this.originalDesiredSize)}this.stopTool()};
tg.prototype.resize=function(a){var b=this.diagram,c=this.adornedObject;if(null!==c){c.desiredSize=a.size;a=c.part;a.Ab();c=c.ga(this.handle.alignment.Zv());if(a instanceof uf){var d=new E;d.add(a);if(!this.dragsMembers&&null===a.placeholder){var e=new Se;e.dragsMembers=!1}b.moveParts(d,this.oppositePoint.copy().be(c),!0,e)}else a.location=a.location.copy().be(c).add(this.oppositePoint);b.Wc()}};
tg.prototype.computeResize=function(a,b,c,d,e,f){b.kc()&&(b=Ac);var g=this.adornedObject.naturalBounds,h=g.x,k=g.y,l=g.x+g.width,m=g.y+g.height,n=1;if(!f){n=g.width;var p=g.height;0>=n&&(n=1);0>=p&&(p=1);n=p/n}p=I.alloc();K.sq(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)));I.free(p);return a};tg.prototype.computeReshape=function(){var a=xg;this.adornedObject instanceof W&&(a=yg(this.adornedObject));return!(a===zg||this.diagram.lastInput.shift)};
tg.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};tg.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};
tg.prototype.computeCellSize=function(){var a=new M(NaN,NaN),b=this.adornedObject.part;null!==b&&(b=b.resizeCellSize,!isNaN(b.width)&&0<b.width&&(a.width=b.width),!isNaN(b.height)&&0<b.height&&(a.height=b.height));b=this.cellSize;isNaN(a.width)&&!isNaN(b.width)&&0<b.width&&(a.width=b.width);isNaN(a.height)&&!isNaN(b.height)&&0<b.height&&(a.height=b.height);b=this.diagram;(isNaN(a.width)||isNaN(a.height))&&b&&(b=b.grid,null!==b&&b.visible&&this.isGridSnapEnabled&&(b=b.gridCellSize,isNaN(a.width)&&
!isNaN(b.width)&&0<b.width&&(a.width=b.width),isNaN(a.height)&&!isNaN(b.height)&&0<b.height&&(a.height=b.height)));if(isNaN(a.width)||0===a.width||Infinity===a.width)a.width=1;if(isNaN(a.height)||0===a.height||Infinity===a.height)a.height=1;return a};
ma.Object.defineProperties(tg.prototype,{handleArchetype:{get:function(){return this.u},set:function(a){this.u=a}},handle:{get:function(){return this.l},set:function(a){if(null!==a&&!(a.part instanceof Ke))throw Error("new handle is not in an Adornment: "+a);this.l=a}},adornedObject:{get:function(){return this.de},set:function(a){if(null!==a&&a.part instanceof Ke)throw Error("new handle must not be in an Adornment: "+
a);this.de=a}},minSize:{get:function(){return this.bg},set:function(a){if(!this.bg.w(a)){var b=a.width;isNaN(b)&&(b=0);a=a.height;isNaN(a)&&(a=0);this.bg.h(b,a)}}},maxSize:{get:function(){return this.ag},set:function(a){if(!this.ag.w(a)){var b=a.width;isNaN(b)&&(b=Infinity);a=a.height;isNaN(a)&&(a=Infinity);this.ag.h(b,a)}}},cellSize:{get:function(){return this.Kg},set:function(a){this.Kg.w(a)||this.Kg.assign(a)}},
isGridSnapEnabled:{get:function(){return this.I},set:function(a){this.I=a}},dragsMembers:{get:function(){return this.T},set:function(a){this.T=a}},oppositePoint:{get:function(){return this.ys},set:function(a){this.ys.w(a)||this.ys.assign(a)}},originalDesiredSize:{get:function(){return this.px}},originalLocation:{get:function(){return this.bp}}});
tg.className="ResizingTool";La("resizingTool",function(){return this.findTool("Resizing")},function(a){this.Wa("Resizing",a,this.mouseDownTools)});function Ag(){Be.call(this);this.name="Rotating";this.Ja=45;this.Ia=2;this.bp=new I;this.de=null;var a=new W;a.figure="Ellipse";a.desiredSize=Ob;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.u=a;this.l=null;this.ox=0;this.Zu=new I(NaN,NaN);this.I=0;this.T=50}la(Ag,Be);
Ag.prototype.updateAdornments=function(a){if(null!==a){if(a.Jh()){var b=a.rotateObject;if(b===a||b===a.path||b.isPanelMain)return}if(a.isSelected&&!this.diagram.isReadOnly&&(b=a.rotateObject,null!==b&&a.canRotate()&&a.actualBounds.v()&&a.isVisible()&&b.actualBounds.v()&&b.zf())){var c=a.hk(this.name);if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){c.angle=b.aj();null===c.placeholder&&(c.location=this.computeAdornmentLocation(b));a.zh(this.name,c);return}}a.Af(this.name)}};
Ag.prototype.makeAdornment=function(a){var b=a.part.rotateAdornmentTemplate;if(null===b){b=new Ke;b.type=X.Position;b.locationSpot=Ac;var c=this.handleArchetype;null!==c&&b.add(c.copy())}else if(wg(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};Ag.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};
Ag.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.ox=this.adornedObject.angle,this.Zu=this.computeRotationPoint(this.adornedObject),this.bp=this.adornedObject.part.location.copy(),a.isMouseCaptured=!0,a.delaysLayout=!0,this.ua(this.name),this.isActive=!0)};
Ag.prototype.computeRotationPoint=function(a){var b=a.part,c=b.locationObject;return b.rotationSpot.hb()?a.ga(b.rotationSpot):a===b||a===c?c.ga(b.locationSpot):a.ga(Ac)};
Ag.prototype.computeAdornmentLocation=function(a){var b=this.rotationPoint;b.v()||(b=this.computeRotationPoint(a));b=a.zt(b);var c=this.handleAngle;0>c?c+=360:360<=c&&(c-=360);c=Math.round(45*Math.round(c/45));var d=this.handleDistance;0===c?b.x=a.naturalBounds.width+d:45===c?(b.x=a.naturalBounds.width+d,b.y=a.naturalBounds.height+d):90===c?b.y=a.naturalBounds.height+d:135===c?(b.x=-d,b.y=a.naturalBounds.height+d):180===c?b.x=-d:225===c?(b.x=-d,b.y=-d):270===c?b.y=-d:315===c&&(b.x=a.naturalBounds.width+
d,b.y=-d);return a.ga(b)};Ag.prototype.doDeactivate=function(){var a=this.diagram;this.Dg();this.de=this.handle=null;this.Zu=new I(NaN,NaN);this.isActive=a.isMouseCaptured=!1};Ag.prototype.doCancel=function(){this.diagram.delaysLayout=!1;this.rotate(this.originalAngle);this.stopTool()};Ag.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeRotate(a.lastInput.documentPoint),this.rotate(a))};
Ag.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){a.delaysLayout=!1;var b=this.computeRotate(a.lastInput.documentPoint);this.rotate(b);a.Na();this.transactionResult=this.name;a.R("PartRotated",this.adornedObject,this.originalAngle)}this.stopTool()};
Ag.prototype.rotate=function(a){var b=this.adornedObject;if(null!==b){b.angle=a;b=b.part;b.Ab();var c=b.locationObject,d=b.rotateObject;if(c===d||c.zg(d))c=this.bp.copy(),b.location=c.be(this.rotationPoint).rotate(a-this.originalAngle).add(this.rotationPoint);this.diagram.Wc()}};
Ag.prototype.computeRotate=function(a){a=this.rotationPoint.Sa(a)-this.handleAngle;var b=this.adornedObject.panel;null!==b&&(a-=b.aj());360<=a?a-=360:0>a&&(a+=360);b=Math.min(Math.abs(this.snapAngleMultiple),180);var c=Math.min(Math.abs(this.snapAngleEpsilon),b/2);!this.diagram.lastInput.shift&&0<b&&0<c&&(a%b<c?a=Math.floor(a/b)*b:a%b>b-c&&(a=(Math.floor(a/b)+1)*b));360<=a?a-=360:0>a&&(a+=360);return a};
ma.Object.defineProperties(Ag.prototype,{handleArchetype:{get:function(){return this.u},set:function(a){this.u=a}},handle:{get:function(){return this.l},set:function(a){if(null!==a&&!(a.part instanceof Ke))throw Error("new handle is not in an Adornment: "+a);this.l=a}},adornedObject:{get:function(){return this.de},set:function(a){if(null!==a&&a.part instanceof Ke)throw Error("new handle must not be in an Adornment: "+
a);this.de=a}},snapAngleMultiple:{get:function(){return this.Ja},set:function(a){this.Ja=a}},snapAngleEpsilon:{get:function(){return this.Ia},set:function(a){this.Ia=a}},originalAngle:{get:function(){return this.ox}},rotationPoint:{get:function(){return this.Zu}},handleAngle:{get:function(){return this.I},set:function(a){this.I=a}},handleDistance:{
get:function(){return this.T},set:function(a){this.T=a}}});Ag.className="RotatingTool";La("rotatingTool",function(){return this.findTool("Rotating")},function(a){this.Wa("Rotating",a,this.mouseDownTools)});function Bg(){Be.call(this);this.name="ClickSelecting"}la(Bg,Be);Bg.prototype.canStart=function(){return!this.isEnabled||this.isBeyondDragSize()?!1:!0};
Bg.prototype.doMouseUp=function(){this.isActive&&(this.standardMouseSelect(),!this.standardMouseClick()&&this.diagram.lastInput.isTouchEvent&&this.diagram.toolManager.doToolTip());this.stopTool()};Bg.className="ClickSelectingTool";function Cg(){Be.call(this);this.name="Action";this.Dk=null}la(Cg,Be);
Cg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram,b=a.lastInput,c=a.Ub(b.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a});if(null!==c){if(!c.isActionable)return!1;this.Dk=c;a.pj=a.Ub(b.documentPoint,null,null);return!0}return!1};Cg.prototype.doMouseDown=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Dk;null!==b&&(a.targetObject=b,null!==b.actionDown&&b.actionDown(a,b))}else this.canStart()&&this.doActivate()};
Cg.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Dk;null!==b&&(a.targetObject=b,null!==b.actionMove&&b.actionMove(a,b))}};Cg.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Dk;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()};
Cg.prototype.doCancel=function(){var a=this.diagram.lastInput,b=this.Dk;null!==b&&(a.targetObject=b,null!==b.actionCancel&&b.actionCancel(a,b),this.stopTool())};Cg.prototype.doStop=function(){this.Dk=null};Cg.className="ActionTool";function Dg(){Be.call(this);this.name="ClickCreating";this.lj=null;this.u=!0;this.l=!1;this.gx=new I(0,0)}la(Dg,Be);
Dg.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.gx=a.lastInput.viewPoint.copy()),2!==a.lastInput.clickCount||this.isBeyondDragSize(this.gx))return!1}else if(1!==a.lastInput.clickCount)return!1;return a.currentTool!==this&&null!==a.lm(a.lastInput.documentPoint,!0)?!1:!0};
Dg.prototype.doMouseUp=function(){var a=this.diagram;this.isActive&&this.insertPart(a.lastInput.documentPoint);this.stopTool()};
Dg.prototype.insertPart=function(a){var b=this.diagram,c=this.archetypeNodeData;if(null===c)return null;var d=null;try{b.R("ChangingSelection",b.selection);this.ua(this.name);if(c instanceof T)c.Wb()&&(wg(c),d=c.copy(),null!==d&&b.add(d));else if(null!==c){var e=b.model.copyNodeData(c);za(e)&&(b.model.pf(e),d=b.xc(e))}if(null!==d){var f=I.allocAt(a.x,a.y);this.isGridSnapEnabled&&Eg(this.diagram,d,a,f);d.location=f;b.allowSelect&&(b.clearSelection(!0),d.isSelected=!0);I.free(f)}b.Na();this.transactionResult=
this.name;b.R("PartCreated",d)}finally{this.Dg(),b.R("ChangedSelection",b.selection)}return d};ma.Object.defineProperties(Dg.prototype,{archetypeNodeData:{get:function(){return this.lj},set:function(a){this.lj=a}},isDoubleClick:{get:function(){return this.u},set:function(a){this.u=a}},isGridSnapEnabled:{get:function(){return this.l},set:function(a){this.l=a}}});Dg.className="ClickCreatingTool";
function Fg(){Be.call(this);this.name="DragSelecting";this.Xk=175;this.u=!1;var a=new T;a.layerName="Tool";a.selectable=!1;var b=new W;b.name="SHAPE";b.figure="Rectangle";b.fill=null;b.stroke="magenta";a.add(b);this.l=a}la(Fg,Be);
Fg.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.lm(b.documentPoint,!0))?!1:!0};Fg.prototype.doActivate=function(){var a=this.diagram;this.isActive=!0;a.isMouseCaptured=!0;a.skipsUndoManager=!0;a.add(this.box);this.doMouseMove()};
Fg.prototype.doDeactivate=function(){var a=this.diagram;a.Cf();a.remove(this.box);a.skipsUndoManager=!1;this.isActive=a.isMouseCaptured=!1};Fg.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive&&null!==this.box){var b=this.computeBoxBounds(),c=this.box.Za("SHAPE");null===c&&(c=this.box.tb());var d=M.alloc().h(b.width,b.height);b=I.allocAt(b.x,b.y);c.desiredSize=d;this.box.position=b;M.free(d);I.free(b);(a.allowHorizontalScroll||a.allowVerticalScroll)&&a.rt(a.lastInput.viewPoint)}};
Fg.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram;a.remove(this.box);try{a.currentCursor="wait",a.R("ChangingSelection",a.selection),this.selectInRect(this.computeBoxBounds()),a.R("ChangedSelection",a.selection)}finally{a.currentCursor=""}}this.stopTool()};Fg.prototype.computeBoxBounds=function(){var a=this.diagram;return new N(a.firstInput.documentPoint,a.lastInput.documentPoint)};
Fg.prototype.selectInRect=function(a){var b=this.diagram,c=b.lastInput;a=b.Xx(a,this.isPartialInclusion);if(Wa?c.meta:c.control)if(c.shift)for(a=a.iterator;a.next();)b=a.value,b.isSelected&&(b.isSelected=!1);else for(a=a.iterator;a.next();)b=a.value,b.isSelected=!b.isSelected;else if(c.shift)for(a=a.iterator;a.next();)b=a.value,b.isSelected||(b.isSelected=!0);else{c=new E;for(b=b.selection.iterator;b.next();){var d=b.value;a.contains(d)||c.add(d)}for(b=c.iterator;b.next();)b.value.isSelected=!1;for(a=
a.iterator;a.next();)b=a.value,b.isSelected||(b.isSelected=!0)}};ma.Object.defineProperties(Fg.prototype,{delay:{get:function(){return this.Xk},set:function(a){this.Xk=a}},isPartialInclusion:{get:function(){return this.u},set:function(a){this.u=a}},box:{get:function(){return this.l},set:function(a){this.l=a}}});Fg.className="DragSelectingTool";
function Gg(){Be.call(this);this.name="Panning";this.Wu=new I;this.Oy=new I;this.Jg=!1;var a=this;this.vx=function(){var b=a.diagram;null!==b&&b.removeEventListener(x.document,"scroll",a.vx,!1);a.stopTool()}}la(Gg,Be);Gg.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};
Gg.prototype.doActivate=function(){var a=this.diagram;this.Jg?(a.lastInput.bubbles=!0,a.addEventListener(x.document,"scroll",this.vx,!1)):(a.currentCursor="move",a.isMouseCaptured=!0,this.Wu.assign(a.position));this.isActive=!0};Gg.prototype.doDeactivate=function(){var a=this.diagram;a.currentCursor="";this.isActive=a.isMouseCaptured=!1};Gg.prototype.doCancel=function(){var a=this.diagram;a.position=this.Wu;a.isMouseCaptured=!1;this.stopTool()};Gg.prototype.doMouseMove=function(){this.move()};
Gg.prototype.doMouseUp=function(){this.move();this.stopTool()};Gg.prototype.move=function(){var a=this.diagram;if(this.isActive&&a)if(this.Jg)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.Oy.h(e,c)}};
ma.Object.defineProperties(Gg.prototype,{bubbles:{get:function(){return this.Jg},set:function(a){this.Jg=a}},originalPosition:{get:function(){return this.Wu}}});Gg.className="PanningTool";La("clickCreatingTool",function(){return this.findTool("ClickCreating")},function(a){this.Wa("ClickCreating",a,this.mouseUpTools)});La("clickSelectingTool",function(){return this.findTool("ClickSelecting")},function(a){this.Wa("ClickSelecting",a,this.mouseUpTools)});
La("panningTool",function(){return this.findTool("Panning")},function(a){this.Wa("Panning",a,this.mouseMoveTools)});La("dragSelectingTool",function(){return this.findTool("DragSelecting")},function(a){this.Wa("DragSelecting",a,this.mouseMoveTools)});La("actionTool",function(){return this.findTool("Action")},function(a){this.Wa("Action",a,this.mouseDownTools)});function Pe(){this.T=this.I=this.l=this.u=null}
ma.Object.defineProperties(Pe.prototype,{mainElement:{get:function(){return this.I},set:function(a){this.I=a}},show:{get:function(){return this.u},set:function(a){this.u!==a&&(this.u=a)}},hide:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a)}},valueFunction:{get:function(){return this.T},set:function(a){this.T=a}}});Pe.className="HTMLInfo";
function Hg(a,b,c){this.text=a;this.Mx=b;this.visible=c}Hg.className="ContextMenuButtonInfo";function Ig(){Be.call(this);this.name="ContextMenu";this.u=this.ou=this.l=null;this.lx=new I;this.pu=null;this.Ku=!1;var a=this;this.iv=function(){a.stopTool()}}la(Ig,Be);
function Jg(a){var b=new Pe;b.show=function(a,b,c){c.showDefaultContextMenu()};b.hide=function(a,b){b.hideDefaultContextMenu()};Kg=b;a.iv=function(){a.stopTool()};b=ta("div");var c=ta("div");b.style.cssText="top: 0px;z-index:10002;position: fixed;display: none;text-align: center;left: 25%;width: 50%;background-color: #F5F5F5;padding: 16px;border: 16px solid #444;border-radius: 10px;margin-top: 10px";c.style.cssText="z-index:10001;position: fixed;display: none;top: 0;left: 0;width: 100%;height: 100%;background-color: black;opacity: 0.8;";
var d=ta("style");x.document.getElementsByTagName("head")[0].appendChild(d);d.sheet.insertRule(".goCXul { list-style: none; }",0);d.sheet.insertRule(".goCXli {font:700 1.5em Helvetica, Arial, sans-serif;position: relative;min-width: 60px; }",0);d.sheet.insertRule(".goCXa {color: #444;display: inline-block;padding: 4px;text-decoration: none;margin: 2px;border: 1px solid gray;border-radius: 10px; }",0);d=a.diagram;null!==d&&(d.addEventListener(b,"contextmenu",Lg,!1),d.addEventListener(b,"selectstart",
Lg,!1),d.addEventListener(c,"contextmenu",Lg,!1));b.className="goCXforeground";c.className="goCXbackground";x.document.body&&(x.document.body.appendChild(b),x.document.body.appendChild(c));Mg=b;Ng=c;Og=!0}function Lg(a){a.preventDefault();return!1}Ig.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};
Ig.prototype.doStart=function(){this.lx.set(this.diagram.firstInput.documentPoint)};Ig.prototype.doStop=function(){this.hideContextMenu();this.currentObject=null};
Ig.prototype.findObjectWithContextMenu=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.lastInput,d=null;a instanceof Q||(a instanceof Y?d=a:d=b.Ub(c.documentPoint,null,function(a){return!a.layer.isTemporary}));if(null!==d){for(a=d;null!==a;){if(null!==a.contextMenu)return a;a=a.panel}if(b.lastInput.isTouchEvent&&this.defaultTouchContextMenu)return d.part}else if(null!==b.contextMenu)return b;return null};Ig.prototype.doActivate=function(){};
Ig.prototype.doMouseDown=function(){Be.prototype.doMouseDown.call(this);if(this.isActive&&this.currentContextMenu instanceof Ke){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doMouseDown(),a.doDeactivate())}this.diagram.toolManager.mouseDownTools.contains(this)&&Pg(this)};
Ig.prototype.doMouseUp=function(){if(this.isActive&&this.currentContextMenu instanceof Ke){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doCancel(),a.doDeactivate())}Pg(this)};
function Pg(a){var b=a.diagram;if(a.isActive){var c=a.currentContextMenu;if(null!==c){if(!(c instanceof Pe)){var d=b.Ub(b.lastInput.documentPoint,null,null);null!==d&&d.zg(c)&&a.standardMouseClick(null,null)}a.stopTool();a.canStart()&&(b.currentTool=a,a.doMouseUp())}}else a.canStart()&&(Qg(a,!0),a.isActive||a.stopTool())}
function Qg(a,b,c){void 0===c&&(c=null);if(!a.Ku&&(a.Ku=!0,b&&a.standardMouseSelect(),b=a.standardMouseClick(),a.Ku=!1,!b))if(a.isActive=!0,b=Kg,null===c&&(c=a.findObjectWithContextMenu()),null!==c){var d=c.contextMenu;null!==d?(a.currentObject=c instanceof Y?c:null,a.showContextMenu(d,a.currentObject)):null!==b&&a.showContextMenu(b,a.currentObject)}else null!==b&&a.showContextMenu(b,null)}
Ig.prototype.doMouseMove=function(){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.doMouseMove();this.isActive&&this.diagram.toolManager.doMouseMove()};
Ig.prototype.showContextMenu=function(a,b){var c=this.diagram;a!==this.currentContextMenu&&this.hideContextMenu();if(a instanceof Ke){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.Ab();this.positionContextMenu(a,b)}else a instanceof Pe&&a.show(b,c,this);this.currentContextMenu=a};
Ig.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}};
Ig.prototype.hideContextMenu=function(){var a=this.diagram,b=this.currentContextMenu;null!==b&&(b instanceof Ke?(a.remove(b),null!==this.ou&&this.ou.Af(b.category),b.data=null,b.adornedObject=null):b instanceof Pe&&(null!==b.hide?b.hide(a,this):null!==b.mainElement&&(b.mainElement.style.display="none")),this.currentContextMenu=null,this.standardMouseOver())};
function Rg(a){var b=new E;b.add(new Hg("Copy",function(a){a.commandHandler.copySelection()},function(a){return a.commandHandler.canCopySelection()}));b.add(new Hg("Cut",function(a){a.commandHandler.cutSelection()},function(a){return a.commandHandler.canCutSelection()}));b.add(new Hg("Delete",function(a){a.commandHandler.deleteSelection()},function(a){return a.commandHandler.canDeleteSelection()}));b.add(new Hg("Paste",function(b){b.commandHandler.pasteSelection(a.mouseDownPoint)},function(b){return b.commandHandler.canPasteSelection(a.mouseDownPoint)}));
b.add(new Hg("Select All",function(a){a.commandHandler.selectAll()},function(a){return a.commandHandler.canSelectAll()}));b.add(new Hg("Undo",function(a){a.commandHandler.undo()},function(a){return a.commandHandler.canUndo()}));b.add(new Hg("Redo",function(a){a.commandHandler.redo()},function(a){return a.commandHandler.canRedo()}));b.add(new Hg("Scroll To Part",function(a){a.commandHandler.scrollToPart()},function(a){return a.commandHandler.canScrollToPart()}));b.add(new Hg("Zoom To Fit",function(a){a.commandHandler.zoomToFit()},
function(a){return a.commandHandler.canZoomToFit()}));b.add(new Hg("Reset Zoom",function(a){a.commandHandler.resetZoom()},function(a){return a.commandHandler.canResetZoom()}));b.add(new Hg("Group Selection",function(a){a.commandHandler.groupSelection()},function(a){return a.commandHandler.canGroupSelection()}));b.add(new Hg("Ungroup Selection",function(a){a.commandHandler.ungroupSelection()},function(a){return a.commandHandler.canUngroupSelection()}));b.add(new Hg("Edit Text",function(a){a.commandHandler.editTextBlock()},
function(a){return a.commandHandler.canEditTextBlock()}));return b}
Ig.prototype.showDefaultContextMenu=function(){var a=this.diagram;null===this.pu&&(this.pu=Rg(this));Mg.innerHTML="";Ng.addEventListener("click",this.iv,!1);var b=this,c=ta("ul");c.className="goCXul";Mg.appendChild(c);c.innerHTML="";for(var d=this.pu.iterator;d.next();){var e=d.value,f=e.visible;if("function"===typeof e.Mx&&("function"!==typeof f||f(a))){f=ta("li");f.className="goCXli";var g=ta("a");g.className="goCXa";g.href="#";g.Iy=e.Mx;g.addEventListener("click",function(c){this.Iy(a);b.stopTool();
c.preventDefault();return!1},!1);g.textContent=e.text;f.appendChild(g);c.appendChild(f)}}Mg.style.display="block";Ng.style.display="block"};Ig.prototype.hideDefaultContextMenu=function(){if(null!==this.currentContextMenu&&this.currentContextMenu===Kg){Mg.style.display="none";Ng.style.display="none";var a=this.diagram;null!==a&&a.removeEventListener(Ng,"click",this.iv,!1);this.currentContextMenu=null}};
ma.Object.defineProperties(Ig.prototype,{currentContextMenu:{get:function(){return this.l},set:function(a){this.l=a;this.ou=a instanceof Ke?a.adornedPart:null}},defaultTouchContextMenu:{get:function(){!1===Og&&null===Kg&&Sg&&Jg(this);return Kg},set:function(a){null===a&&(Og=!0);Kg=a}},currentObject:{get:function(){return this.u},set:function(a){this.u=a}},mouseDownPoint:{get:function(){return this.lx}}});
var Kg=null,Og=!1,Ng=null,Mg=null;Ig.className="ContextMenuTool";La("contextMenuTool",function(){return this.findTool("ContextMenu")},function(a){this.Wa("ContextMenu",a,this.mouseUpTools)});function Tg(){Be.call(this);this.name="TextEditing";this.sh=new Ug;this.Ja=null;this.Ia=Vg;this.Ni=null;this.ia=Wg;this.I=1;this.T=!0;this.u=null;this.l=new Pe;this.tu=null;Xg(this,this.l)}la(Tg,Be);
function Xg(a,b){if(Sg){var c=ta("textarea");a.tu=c;c.addEventListener("input",function(){if(null!==a.textBlock){var b=a.ny(this.value);this.style.width=20+b.measuredBounds.width*this.EA+"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(Yg)):9===c?(a.acceptText(Zg),b.preventDefault()):27===c&&(a.doCancel(),null!==a.diagram&&a.diagram.doFocus())}},!1);c.addEventListener("focus",
function(){if(null!==a.currentTextEditor&&a.state!==Wg){var b=a.tu;a.ia===$g&&(a.ia=ah);"function"===typeof b.select&&a.selectsTextOnActivate&&(b.select(),b.setSelectionRange(0,9999))}},!1);c.addEventListener("blur",function(){if(null!==a.currentTextEditor&&a.state!==Wg){var b=a.tu;"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 Ug&&f instanceof Tg)if(f.state===bh)c.style.border="3px solid red",c.focus();else{var d=a.ga(Ac),e=b.position,k=b.scale,l=a.uf()*k;l<f.minimumEditorScale&&(l=f.minimumEditorScale);var m=a.naturalBounds.width*l+6,n=a.naturalBounds.height*l+2,p=(d.x-e.x)*k;d=(d.y-e.y)*k;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.EA=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)}}}
Tg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(null===a||a.isReadOnly||ch&&ch!==this&&(ch.acceptText(dh),ch&&ch!==this)||!a.lastInput.left||this.isBeyondDragSize())return!1;var b=a.Ub(a.lastInput.documentPoint);if(!(null!==b&&b instanceof Ug&&b.editable&&b.part.canEdit()))return!1;b=b.part;return null===b||this.starting===Vg&&!b.isSelected||this.starting===eh&&2>a.lastInput.clickCount?!1:!0};Tg.prototype.doStart=function(){ch=this;null!==this.textBlock&&this.doActivate()};
Tg.prototype.doActivate=function(){if(!this.isActive){var a=this.diagram;if(null!==a){var b=this.textBlock;null===b&&(b=a.Ub(a.lastInput.documentPoint));if(null!==b&&b instanceof Ug&&(this.textBlock=b,null!==b.part)){this.isActive=!0;this.ia=$g;var c=this.defaultTextEditor;null!==b.textEditor&&(c=b.textEditor);this.sh=this.textBlock.copy();var d=new N(this.textBlock.ga(vc),this.textBlock.ga(Gc));a.mw(d);c.show(b,a,this);this.currentTextEditor=c}}}};Tg.prototype.doCancel=function(){this.stopTool()};
Tg.prototype.doMouseUp=function(){this.canStart()&&this.doActivate()};Tg.prototype.doMouseDown=function(){this.isActive&&this.acceptText(dh)};Tg.prototype.acceptText=function(a){switch(a){case dh:if(this.ia===fh)this.currentTextEditor instanceof HTMLElement&&this.currentTextEditor.focus();else if(this.ia===$g||this.ia===bh||this.ia===ah)this.ia=gh,hh(this);break;case ih:case Yg:case Zg:if(Yg!==a||!0!==this.textBlock.isMultiline)if(this.ia===$g||this.ia===bh||this.ia===ah)this.ia=gh,hh(this)}};
function hh(a){var b=a.textBlock,c=a.diagram,d=a.currentTextEditor;if(null!==b&&null!==d){var e=b.text,f="";null!==d.valueFunction&&(f=d.valueFunction());if(a.isValidText(b,e,f))a.ua(a.name),a.ia=fh,a.transactionResult=a.name,b.text=f,d=a.textBlock,null!==d.textEdited&&d.textEdited(d,e,f),null!==c&&c.R("TextEdited",b,e),a.Dg(),a.stopTool(),null!==c&&c.doFocus();else{a.ia=bh;var g=a.textBlock;null!==g.errorFunction&&g.errorFunction(a,e,f);d.show(b,c,a)}}}
Tg.prototype.doDeactivate=function(){var a=this.diagram;null!==a&&(this.ia=Wg,this.textBlock=null,null!==this.currentTextEditor&&this.currentTextEditor.hide(a,this),this.isActive=!1)};Tg.prototype.doStop=function(){ch=null};Tg.prototype.isValidText=function(a,b,c){var d=this.textValidation;if(null!==d&&!d(a,b,c))return!1;d=a.textValidation;return null===d||d(a,b,c)?!0:!1};Tg.prototype.ny=function(a){var b=this.sh;b.text=a;b.measure(this.textBlock.vi,Infinity);return b};
ma.Object.defineProperties(Tg.prototype,{textBlock:{get:function(){return this.Ja},set:function(a){this.Ja=a}},currentTextEditor:{get:function(){return this.u},set:function(a){this.u=a}},defaultTextEditor:{get:function(){return this.l},set:function(a){this.l=a}},starting:{get:function(){return this.Ia},set:function(a){this.Ia=a}},textValidation:{get:function(){return this.Ni},
set:function(a){this.Ni=a}},minimumEditorScale:{get:function(){return this.I},set:function(a){this.I=a}},selectsTextOnActivate:{get:function(){return this.T},set:function(a){this.T=a}},state:{get:function(){return this.ia},set:function(a){this.ia!==a&&(this.ia=a)}}});Tg.prototype.measureTemporaryTextBlock=Tg.prototype.ny;
var ih=new D(Tg,"LostFocus",0),dh=new D(Tg,"MouseDown",1),Zg=new D(Tg,"Tab",2),Yg=new D(Tg,"Enter",3),jh=new D(Tg,"SingleClick",0),Vg=new D(Tg,"SingleClickSelected",1),eh=new D(Tg,"DoubleClick",2),Wg=new D(Tg,"StateNone",0),$g=new D(Tg,"StateActive",1),ah=new D(Tg,"StateEditing",2),gh=new D(Tg,"StateValidating",3),bh=new D(Tg,"StateInvalid",4),fh=new D(Tg,"StateValidated",5),ch=null;Tg.className="TextEditingTool";Tg.LostFocus=ih;Tg.MouseDown=dh;Tg.Tab=Zg;Tg.Enter=Yg;Tg.SingleClick=jh;
Tg.SingleClickSelected=Vg;Tg.DoubleClick=eh;Tg.StateNone=Wg;Tg.StateActive=$g;Tg.StateEditing=ah;Tg.StateValidating=gh;Tg.StateInvalid=bh;Tg.StateValidated=fh;La("textEditingTool",function(){return this.findTool("TextEditing")},function(a){this.Wa("TextEditing",a,this.mouseUpTools)});
function kh(){xh||(yh(),xh=!0);this.B=Ce;this.hl=this.Ze=this.qc=this.ds=this.hc=!1;this.Ax=!0;this.il=zh;this.fn=!1;this.ri=this.ad=!0;this.Rg=600;this.Ww=this.zx=!1;this.Ke=new F;this.Dd=new Ah;this.Dd.Lc=this;this.Ek=new F;this.fv=new F;this.ct=new F}kh.prototype.$d=function(a){this.B=a};kh.prototype.canStart=function(){return!0};function Bh(a,b){Ch(a,b)&&(a.Ze=!0)}function Ch(a,b){if(!a.ad||!a.canStart(b))return!1;a.Ke.add(b);a.defaultAnimation.isAnimating&&a.Xc();return a.qc=!0}
function Dh(a){if(a.ad&&a.qc){var b=a.Dd,c=a.B,d=a.Ke.contains("Model");d&&(a.hl=!0,a.il===zh?(b.isViewportUnconstrained=!0,b.jc.clear(),b.add(c,"position",c.position.copy().offset(0,-200),c.position),b.add(c,"opacity",0,1)):a.il===Eh&&b.jc.clear(),a.Ax=a.il===Fh&&c.Ks.w(c.ma)?!0:!1,c.R("InitialAnimationStarting",a));d&&!a.ri||0===b.jc.count?(a.Ke.clear(),a.qc=!1,a.Ze=!1,b.jc.clear(),Gh(b),a.hl=!1,c.M()):(a.Ke.clear(),c.ze=!1,d=b.jc.get(c),c.autoScale!==Hh&&null!==d&&(delete d.start.scale,delete d.end.scale),
x.requestAnimationFrame(function(){!1===a.qc||b.hc||(c.Ee("temporaryPixelRatio")&&Ve(c),Ih(c),a.qc=!1,a.Ze=!1,b.start(),Jh(a),c.Na(),Kh(b,0),If(c,!0),Lh(a),c.R("AnimationStarting",a))}))}}function Mh(a,b,c,d){b instanceof S&&(null!==b.fromNode||null!==b.toNode)||a.Dd.add(b,"position",c,d,!1)}t=kh.prototype;t.Ot=function(a){return this.Dd.Ot(a)};t.Qv=function(a){return this.Dd.Qv(a)};
function Nh(a,b){function c(){0<e.ct.count&&(d.addAll(e.ct),e.ct.clear(),e.hc=!0);if(!1!==e.hc&&0!==d.count){e.fv.addAll(d);for(var a=e.fv.iterator;a.next();){var b=a.value;if(!1!==b.hc){a:if(0<b.Zl.count)var h=!0;else{for(h=b.jc.iterator;h.next();){var k=h.key;if(k instanceof Y&&null!==k.diagram||k instanceof Q){h=!0;break a}}h=!1}h?Oh(b,!1):b.ql=!0}}e.fv.clear();Jh(e);If(e.B);Lh(e);x.requestAnimationFrame(c)}}var d=a.Ek,e=a;a.hc?a.ct.add(b):(a.hc=!0,d.add(b),x.requestAnimationFrame(function(){c()}))}
function Ph(a){for(a=a.Ek.iterator;a.next();)a.value.ql=!1}function Jh(a){if(!a.ds){var b=a.B;a.zx=b.skipsUndoManager;a.Ww=b.skipsModelSourceBindings;b.skipsUndoManager=!0;b.skipsModelSourceBindings=!0;a.ds=!0}}function Lh(a){var b=a.B;b.skipsUndoManager=a.zx;b.skipsModelSourceBindings=a.Ww;a.ds=!1}
t.Xc=function(a){var b=this.Dd;!0===this.qc&&(this.hl=this.Ze=this.qc=!1,this.Ke.clear(),0<b.jc.count&&this.B.Bb());if(this.hc){if(b.im(!0),b.jc.clear(),Gh(b),!0===a)for(a=this.Ek.na(),b=0;b<a.length;b++)a[b].im(!0)}else b.jc.clear(),Gh(b)};t.im=function(a){a===this.defaultAnimation&&this.defaultAnimation.jc.clear();this.Ek.remove(a);0===this.Ek.count&&(this.hc=!1,this.B.Bb());a===this.defaultAnimation&&(this.defaultAnimation.jc.clear(),this.B.R("AnimationFinished",this))};
t.Yj=function(a,b){this.Ze&&(this.Ke.contains("Expand Tree")||this.Ke.contains("Expand SubGraph"))&&this.Dd.Yj(a,b)};t.Wj=function(a,b){this.Ze&&(this.Ke.contains("Collapse Tree")||this.Ke.contains("Collapse SubGraph"))&&(this.Dd.Wj(a,b),Qh(this.Dd,b,"position",b.position,b.position))};function Rh(a,b,c){a.Ze&&!b.w(c)&&(a.B.mk||(b=c.copy()),Qh(a.Dd,a.B,"position",b,c))}
function Sh(a,b,c,d,e){null===a&&(a="rgba(0,0,0,0)");null===b&&(b="rgba(0,0,0,0)");Th(a);Uh();var f=Vh.l,g=Vh.I,h=Vh.u;a=Vh.T;Th(b);Uh();var k=Vh.I,l=Vh.u;b=Vh.T;f=e(c,f,Vh.l-f,d);g=e(c,g,k-g,d);h=e(c,h,l-h,d);c=e(c,a,b-a,d);return"hsla("+f+", "+g+"%, "+h+"%, "+c+")"}
function yh(){var a=new H;a.add("position:diagram",function(a,c,d,e,f,g){a.position=new I(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g))});a.add("position",function(a,c,d,e,f,g){f<g?a.Tq(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g),!1):a.position=new I(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g))});a.add("location",function(a,c,d,e,f,g){f<g?a.Tq(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g),!0):a.location=new I(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.Tq(e(f,c.x,d.x-c.x,
g),e(f,c.y,d.y-c.y,g),!1):a.position=new I(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.Tq(e(f,c.x,d-c.x,g),e(f,c.y,b-c.y,g),!1):a.position=new I(e(f,c.x,d-c.x,g),e(f,c.y,b-c.y,g))});a.add("desiredSize",function(a,c,d,e,f,g){a.desiredSize=new N(e(f,c.width,d.width-c.width,g),e(f,c.height,d.height-c.height,g))});a.add("width",function(a,c,d,e,f,g){a.width=e(f,c,
d-c,g)});a.add("height",function(a,c,d,e,f,g){a.height=e(f,c,d-c,g)});a.add("fill",function(a,c,d,e,f,g){a.fill=Sh(c,d,f,g,e)});a.add("stroke",function(a,c,d,e,f,g){a.stroke=Sh(c,d,f,g,e)});a.add("strokeWidth",function(a,c,d,e,f,g){a.strokeWidth=e(f,c,d-c,g)});a.add("strokeDashOffset",function(a,c,d,e,f,g){a.strokeDashOffset=e(f,c,d-c,g)});a.add("background",function(a,c,d,e,f,g){a.background=Sh(c,d,f,g,e)});a.add("areaBackground",function(a,c,d,e,f,g){a.areaBackground=Sh(c,d,f,g,e)});a.add("opacity",
function(a,c,d,e,f,g){a.opacity=e(f,c,d-c,g)});a.add("scale",function(a,c,d,e,f,g){a.scale=e(f,c,d-c,g)});a.add("angle",function(a,c,d,e,f,g){a.angle=e(f,c,d-c,g)});Wh=a}
ma.Object.defineProperties(kh.prototype,{animationReasons:{get:function(){return this.Ke}},isEnabled:{get:function(){return this.ad},set:function(a){this.ad=a}},duration:{get:function(){return this.Rg},set:function(a){1>a&&va(a,">= 1",kh,"duration");this.Rg=a}},isAnimating:{get:function(){return this.hc}},isTicking:{get:function(){return this.ds}},isInitial:{
get:function(){return this.ri},set:function(a){this.ri=a}},defaultAnimation:{get:function(){return this.Dd}},activeAnimations:{get:function(){return this.Ek}},initialAnimationStyle:{get:function(){return this.il},set:function(a){this.il=a}}});kh.prototype.stopAnimation=kh.prototype.Xc;var Wh=null,xh=!1,zh=new D(kh,"Default",1),Fh=new D(kh,"AnimateLocations",2),Eh=new D(kh,"None",3);
kh.className="AnimationManager";kh.defineAnimationEffect=function(a,b){xh||(yh(),xh=!0);Wh.add(a,b)};kh.Default=zh;kh.AnimateLocations=Fh;kh.None=Eh;function Ah(){this.jv=this.yx=this.Lc=this.B=null;this.ql=this.hc=this.l=!1;this.Ln=this.ud=0;this.xr=this.wu=Xh;this.pl=this.qp=!1;this.$u=1;this.Yu=0;this.nd=this.Rg=NaN;this.Zw=0;this.Mn=null;this.u=Gb;this.jc=new H;this.Uu=new H;this.Zl=new F;this.Vu=new F;this.Xw=Yh}Ah.prototype.suspend=function(){this.ql=!0};
Ah.prototype.advanceTo=function(a,b){b&&(this.ql=!1);this.qp&&a>=this.nd&&(this.pl=!0,a-=this.nd);this.Zw=a;Oh(this,!0);Jh(this.Lc);If(this.B);Lh(this.Lc);this.B.Zd()};function Gh(a){a.Uu.clear();a.pl=!1;a.Yu=0;a.nd=NaN;0<a.Zl.count&&a.Zl.clear();0<a.Vu.count&&a.Vu.clear()}t=Ah.prototype;
t.start=function(){if(0!==this.jc.count&&!this.hc){for(var a=this.B,b=this.jc.iterator;b.next();){var c=b.value.end,d=b.key;if(c["position:placeholder"]){var e=d.findVisibleNode();if(e instanceof uf&&null!==e.placeholder){var f=e.placeholder;e=f.ga(vc);f=f.padding;e.x+=f.left;e.y+=f.top;c["position:placeholder"]=e}}null===a&&(d instanceof Q?a=d:d instanceof Y&&(a=d.diagram))}null!==a&&(this.B=a,b=this.Lc=a.animationManager,!1!==b.isEnabled&&(this.nd=isNaN(this.Rg)?b.duration:this.Rg,this.xr=this.wu,
b.hl&&b.il===zh&&this===b.defaultAnimation&&(this.xr=Zh,this.nd=isNaN(this.Rg)?600===b.duration?900:b.duration:this.Rg),this.Xw=a.scrollMode,this.isViewportUnconstrained&&(a.Ki=$h),Jh(b),this.Zl.each(function(b){b.data=null;a.add(b)}),Lh(b),this.hc=!0,this.ud=+new Date,this.Ln=this.ud+this.nd,Nh(b,this)))}};t.Wy=function(a,b){a.Wb()&&(this.Zl.add(a),this.B=b)};
t.add=function(a,b,c,d,e){"position"===b&&c.w(d)||(null===this.B&&(a instanceof Q?this.B=a:a instanceof Y&&null!==a.diagram&&(this.B=a.diagram)),a instanceof T&&!a.isAnimated||Qh(this,a,b,c,d,e))};
function Qh(a,b,c,d,e,f){var g=a.jc;b instanceof Q&&"position"===c&&(c="position:diagram");if(g.contains(b)){var h=g.H(b);var k=h.start;var l=h.end;void 0===k[c]&&(k[c]=ai(d));l[c]=ai(e)}else k={},l={},k[c]=ai(d),l[c]=ai(e),h=k.position,b instanceof Y&&h instanceof I&&!h.v()&&b.diagram.animationManager.Ke.contains("Expand SubGraph")&&h.assign(l.position),h=new bi(k,l,f),g.add(b,h);g=k[c];g instanceof I&&!g.v()&&g.assign(a.u);f&&0===c.indexOf("position:")&&b instanceof T?h.Bv.location=ai(b.location):
f&&(h.Bv[c]=ai(d))}function ai(a){return a instanceof I?a.copy():a instanceof M?a.copy():a}t.Ot=function(a){if(!this.hc)return!1;a=this.jc.H(a);return null!==a&&a.dw};t.Qv=function(a){if(!this.hc)return!1;a=this.jc.H(a);return null!==a&&(a.start.position||a.start.location)};
function Oh(a,b){if(!a.ql||b){var c=a.Lc;if(!1!==a.hc){var d=+new Date,e=d>a.Ln?a.nd:d-a.ud;b&&(e=a.Zw,e<a.nd?(a.ud=+new Date-e,a.Ln=a.ud+a.nd):e=a.nd);Jh(c);Kh(a,e);If(a.B,!0);Lh(c);d>a.Ln&&(a.qp&&!a.pl?(a.ud=+new Date,a.Ln=a.ud+a.nd,a.pl=!0):a.im(!1))}}}
function Kh(a,b){for(var c=a.nd,d=a.jc.iterator,e=a.pl;d.next();){var f=d.key;if(!(f instanceof Y&&null===f.diagram)){var g=d.value,h=e?g.end:g.start;g=e?g.start:g.end;var k=Wh,l;for(l in g)"position"===l&&(g["position:placeholder"]||g["position:node"])||null===k.get(l)||k.get(l)(f,h[l],g[l],a.xr,b,c,a)}}}t.stop=function(){this.hc&&this.im(!0)};
t.im=function(a){null!==this.jv&&this.jv.yp.remove(this.yx);if(this.hc){var b=this.B,c=this.Lc;this.ql=this.hc=c.hl=!1;Jh(c);for(var d=this.jc,e=this.Zl.iterator;e.next();)b.remove(e.value);for(e=this.Vu.iterator;e.next();)e.value.o();e=this.qp;d=d.iterator;for(var f=Wh;d.next();){var g=d.key,h=d.value,k=e?h.end:h.start,l=e?h.start:h.end,m=h.Bv,n;for(n in l)if(null!==f.get(n)){var p=n;!h.wv||"position:node"!==p&&"position:placeholder"!==p||(p="position");f.get(p)(g,k[n],void 0!==m[n]?m[n]:h.wv?k[n]:
l[n],this.xr,this.nd,this.nd,this)}h.wv&&void 0!==m.location&&g instanceof T&&(g.location=m.location);h.dw&&g instanceof T&&g.Pb(!1)}if(c.defaultAnimation===this)for(n=this.B.links;n.next();)e=n.value,null===e.lh?(d=e.path,null!==d&&(e.ld=!1,e.o(),d.o())):(e.points=e.lh,e.lh=null);b.Jt.clear();jf(b,!1);b.Na();b.M();If(b,!0);this.isViewportUnconstrained&&(b.scrollMode=this.Xw);Lh(c);this.Yu++;!a&&this.$u>this.Yu?(this.pl=!1,this.start()):(this.Mn&&this.Mn(this),Gh(this),c.im(this),b.Bb())}};
t.Yj=function(a,b){var c=b.actualBounds,d=null;b instanceof uf&&(d=b.placeholder);null!==d?(c=d.ga(vc),d=d.padding,c.x+=d.left,c.y+=d.top,this.add(a,"position",c,a.position,!1)):this.add(a,"position",new I(c.x+c.width/2,c.y+c.height/2),a.position,!1);this.add(a,"scale",.01,a.scale,!1);if(a instanceof uf)for(a=a.memberParts;a.next();)d=a.value,d instanceof V&&this.Yj(d,b)};
t.Wj=function(a,b){if(a.isVisible()){var c=null;b instanceof uf&&(c=b.placeholder);null!==c?this.add(a,"position:placeholder",a.position,c,!0):this.add(a,"position:node",a.position,b,!0);this.add(a,"scale",a.scale,.01,!0);c=this.jc;c.contains(a)&&(c.H(a).dw=!0);if(a instanceof uf)for(a=a.memberParts;a.next();)c=a.value,c instanceof V&&this.Wj(c,b)}};t.Qz=function(a){var b=this.Uu.get(a);null===b&&(b={},this.Uu.add(a,b));return b};
ma.Object.defineProperties(Ah.prototype,{duration:{get:function(){return this.Rg},set:function(a){1>a&&va(a,">= 1",Ah,"duration");this.Rg=a}},reversible:{get:function(){return this.qp},set:function(a){this.qp=a}},runCount:{get:function(){return this.$u},set:function(a){0<a?this.$u=a:B("Animation.runCount value must be a positive integer.")}},finished:{get:function(){return this.Mn},
set:function(a){this.Mn!==a&&(this.Mn=a)}},easing:{get:function(){return this.wu},set:function(a){this.wu=a}},isViewportUnconstrained:{get:function(){return this.l},set:function(a){this.l=a}},isAnimating:{get:function(){return this.hc}}});Ah.prototype.getTemporaryState=Ah.prototype.Qz;Ah.prototype.stop=Ah.prototype.stop;Ah.prototype.add=Ah.prototype.add;Ah.prototype.addTemporaryPart=Ah.prototype.Wy;
function Xh(a,b,c,d){a/=d/2;return 1>a?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b}function Zh(a,b,c,d){return a===d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b}Ah.className="Animation";Ah.EaseLinear=function(a,b,c,d){return c*a/d+b};Ah.EaseInOutQuad=Xh;Ah.EaseInQuad=function(a,b,c,d){return c*(a/=d)*a+b};Ah.EaseOutQuad=function(a,b,c,d){return-c*(a/=d)*(a-2)+b};Ah.EaseInExpo=function(a,b,c,d){return 0===a?b:c*Math.pow(2,10*(a/d-1))+b};Ah.EaseOutExpo=Zh;
function bi(a,b,c){this.start=a;this.end=b;this.Bv={};this.wv=c;this.dw=!1}bi.className="AnimationState";function ci(a,b,c){this.cd=null;this.af=a;this.Rp=c||di;this.Jk=null;void 0!==b&&(this.Jk=b,void 0===c&&(this.Rp=ei))}ci.prototype.copy=function(){var a=new ci(this.af);a.Rp=this.Rp;var b=this.Jk;if(null!==b){var c={};void 0!==b.duration&&(c.Sx=b.duration);void 0!==b.finished&&(c.Sx=b.finished);void 0!==b.easing&&(c.Sx=b.easing);a.Jk=c}return a};
function fi(a,b){a=a.Jk;null!==a&&(a.duration&&(b.duration=a.duration),a.finished&&(b.finished=a.finished),a.easing&&(b.easing=a.easing))}ma.Object.defineProperties(ci.prototype,{propertyName:{get:function(){return this.af},set:function(a){this.af=a}},animationSettings:{get:function(){return this.Jk},set:function(a){this.Jk=a}},startCondition:{get:function(){return this.Rp},set:function(a){this.Rp=a}}});
var di=new D(ci,"Default",1),ei=new D(ci,"Immediate",2),gi=new D(ci,"Bundled",3);ci.className="AnimationTrigger";ci.Default=di;ci.Immediate=ei;ci.Bundled=gi;function hi(){Ya(this);this.B=null;this.Ca=new E;this.Qa="";this.rb=1;this.u=!1;this.Fi=this.I=this.bi=this.ai=this.$h=this.Zh=this.Xh=this.Yh=this.Wh=this.di=this.Vh=this.ci=this.Uh=this.Th=!0;this.l=!1;this.cp=[]}t=hi.prototype;t.clear=function(){this.Ca.clear();this.cp.length=0};t.$d=function(a){this.B=a};
t.toString=function(a){void 0===a&&(a=0);var b='Layer "'+this.name+'"';if(0>=a)return b;for(var c=0,d=0,e=0,f=0,g=0,h=this.Ca.iterator;h.next();){var k=h.value;k instanceof uf?e++:k instanceof V?d++:k instanceof S?f++:k instanceof Ke?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.Ca.iterator;a.next();)c=a.value,h+="\n    "+c.toString(),d=c.data,null!==d&&lb(d)&&(h+=" #"+lb(d)),c instanceof V?h+=" "+
Ja(d):c instanceof S&&(h+=" "+Ja(c.fromNode)+" "+Ja(c.toNode));return b+" "+this.Ca.count+": "+h};t.Ub=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);if(!1===this.Fi)return null;var d=!1;null!==this.diagram&&this.diagram.viewportBounds.aa(a)&&(d=!0);for(var e=I.alloc(),f=this.Ca.j,g=f.length;g--;){var h=f[g];if((!0!==d||!1!==ug(h))&&h.isVisible()&&(e.assign(a),Ab(e,h.wd),h=h.Ub(e,b,c),null!==h&&(null!==b&&(h=b(h)),null!==h&&(null===c||c(h)))))return I.free(e),h}I.free(e);return null};
t.Xi=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof E||d instanceof F||(d=new F);if(!1===this.Fi)return d;var e=!1;null!==this.diagram&&this.diagram.viewportBounds.aa(a)&&(e=!0);for(var f=I.alloc(),g=this.Ca.j,h=g.length;h--;){var k=g[h];if((!0!==e||!1!==ug(k))&&k.isVisible()){f.assign(a);Ab(f,k.wd);var l=k;k.Xi(f,b,c,d)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||d.add(l))}}I.free(f);return d};
t.tf=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof E||e instanceof F||(e=new F);if(!1===this.Fi)return e;var f=!1;null!==this.diagram&&this.diagram.viewportBounds.Ce(a)&&(f=!0);for(var g=this.Ca.j,h=g.length;h--;){var k=g[h];if((!0!==f||!1!==ug(k))&&k.isVisible()){var l=k;k.tf(a,b,c,d,e)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||e.add(l))}}return e};
t.Gv=function(a,b,c,d,e,f,g){if(!1===this.Fi)return e;for(var h=this.Ca.j,k=h.length;k--;){var l=h[k];if((!0!==g||!1!==ug(l))&&f(l)&&l.isVisible()){var m=l;l.tf(a,b,c,d,e)&&(null!==b&&(m=b(m)),null===m||null!==c&&!c(m)||e.add(m))}}return e};
t.xg=function(a,b,c,d,e,f){void 0===c&&(c=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof E||e instanceof F)f=e;e=!0}f instanceof E||f instanceof F||(f=new F);if(!1===this.Fi)return f;var g=!1;null!==this.diagram&&this.diagram.viewportBounds.aa(a)&&(g=!0);for(var h=I.alloc(),k=I.alloc(),l=this.Ca.j,m=l.length;m--;){var n=l[m];if((!0!==g||!1!==ug(n))&&n.isVisible()){h.assign(a);Ab(h,n.wd);k.h(a.x+b,a.y);Ab(k,n.wd);var p=n;n.xg(h,k,c,d,e,f)&&(null!==c&&(p=c(p)),null===
p||null!==d&&!d(p)||f.add(p))}}I.free(h);I.free(k);return f};
t.Bd=function(a,b){if(this.visible){var c=void 0===b?a.viewportBounds:b;var d=this.Ca.j,e=d.length;a=Fa();b=Fa();for(var f=0;f<e;f++){var g=d[f];g.jx=f;g instanceof S&&!1===g.ld||g instanceof Ke&&null!==g.adornedPart||(dc(g.actualBounds,c)?(g.Bd(!0),a.push(g)):(g.Bd(!1),null!==g.adornments&&0<g.adornments.count&&b.push(g)))}for(c=0;c<a.length;c++)for(d=a[c],ii(d),d=d.adornments;d.next();)e=d.value,e.measure(Infinity,Infinity),e.arrange(),e.Bd(!0);for(c=0;c<b.length;c++)d=b[c],d.updateAdornments(),
ji(d,!0);Ha(a);Ha(b)}};function ki(a,b){var c=1;1!==a.rb&&(c=b.globalAlpha,b.globalAlpha=c*a.rb);return c}t.bc=function(a,b,c){if(this.visible&&0!==this.rb&&(void 0===c&&(c=!0),c||!this.isTemporary)){c=this.Ca.j;var d=c.length;if(0!==d){var e=ki(this,a),f=this.cp;f.length=0;for(var g=b.scale,h=N.alloc(),k=0;k<d;k++)this.Ti(a,c[k],b,f,g,h);N.free(h);a.globalAlpha=e}}};
t.Ti=function(a,b,c,d,e,f){if(null!==d&&b instanceof S&&(b.isOrthogonal&&d.push(b),!1===b.ld))return;var g=b.actualBounds;d=!1;var h=b.containingGroup;if(null!==h&&h.isClipping&&h.type!==X.Spot&&b.isVisible()){d=h.resizeObject;d instanceof X&&(d=d.tb());d.nm(f);d instanceof W&&f.Fc(-d.strokeWidth,-d.strokeWidth);if(!f.Ic(g))return;d=!f.Ce(g)}d&&(a.save(),a.beginPath(),a.rect(f.x,f.y,f.width,f.height),a.clip());g.width*e>c.Go||g.height*e>c.Go?b.bc(a,c):(e=b.actualBounds,f=b.naturalBounds,0===e.width||
0===e.height||isNaN(e.x)||isNaN(e.y)||!b.isVisible()||(c=b.transform,null!==b.areaBackground&&(li(b,a,b.areaBackground,!0,!0,f,e),a.fillRect(e.x,e.y,e.width,e.height)),null===b.areaBackground&&null===b.background&&(li(b,a,"rgba(0,0,0,0.3)",!0,!1,f,e),a.fillRect(e.x,e.y,e.width,e.height)),null!==b.background&&(a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy),li(b,a,b.background,!0,!1,f,e),a.fillRect(0,0,f.width/2,f.height/2),c.Ft()||(b=1/(c.m11*c.m22-c.m12*c.m21),a.transform(c.m22*b,-c.m12*b,-c.m21*
b,c.m11*b,b*(c.m21*c.dy-c.m22*c.dx),b*(c.m12*c.dx-c.m11*c.dy))))));d&&(a.restore(),a.sc(!0))};t.g=function(a,b,c,d,e){var f=this.diagram;null!==f&&f.$a(ue,a,this,b,c,d,e)};t.cj=function(a,b,c){var d=this.Ca;b.wi=this;if(a>=d.count)a=d.count;else if(d.L(a)===b)return-1;d.ub(a,b);b.yq(c);d=this.diagram;null!==d&&(c?d.M():d.cj(b));mi(this,a,b);return a};
t.Hc=function(a,b,c){if(!c&&b.layer!==this&&null!==b.layer)return b.layer.Hc(a,b,c);var d=this.Ca;if(0>a||a>=d.length){if(a=d.indexOf(b),0>a)return-1}else if(d.L(a)!==b&&(a=d.indexOf(b),0>a))return-1;b.zq(c);d.ab(a);d=this.diagram;null!==d&&(c?d.M():d.Hc(b));b.wi=null;return a};
function mi(a,b,c){b=ni(a,b,c);if(c instanceof uf&&null!==c&&isNaN(c.zOrder)){if(0!==c.memberParts.count){for(var d=-1,e=a.Ca.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.Ca,e.ab(b),e.ub(d,c))}c=c.containingGroup;null!==c&&mi(a,-1,c)}}
function ni(a,b,c){var d=c.zOrder;if(isNaN(d))return b;a=a.Ca;var e=a.count;if(1>=e)return b;0>b&&(b=a.indexOf(c));if(0>b)return-1;for(var f=b-1,g=NaN;0<=f;){g=a.L(f).zOrder;if(!isNaN(g))break;f--}for(var h=b+1,k=NaN;h<e;){k=a.L(h).zOrder;if(!isNaN(k))break;h++}if(!isNaN(g)&&g>d)for(;;){if(-1===f||g<=d){f++;if(f===b)break;a.ab(b);a.ub(f,c);return f}for(g=NaN;0<=--f&&(g=a.L(f).zOrder,isNaN(g)););}else if(!isNaN(k)&&k<d)for(;;){if(h===e||k>=d){h--;if(h===b)break;a.ab(b);a.ub(h,c);return h}for(k=NaN;++h<
e&&(k=a.L(h).zOrder,isNaN(k)););}return b}
ma.Object.defineProperties(hi.prototype,{parts:{get:function(){return this.Ca.iterator}},partsBackwards:{get:function(){return this.Ca.iteratorBackwards}},diagram:{get:function(){return this.B}},name:{get:function(){return this.Qa},set:function(a){var b=this.Qa;if(b!==a){var c=this.diagram;if(null!==c)for(""===b&&B("Cannot rename default Layer to: "+a),c=c.layers;c.next();)c.value.name===
a&&B("Layer.name is already present in this diagram: "+a);this.Qa=a;this.g("name",b,a);for(a=this.Ca.iterator;a.next();)a.value.layerName=this.Qa}}},opacity:{get:function(){return this.rb},set:function(a){var b=this.rb;b!==a&&((0>a||1<a)&&va(a,"0 <= value <= 1",hi,"opacity"),this.rb=a,this.g("opacity",b,a),a=this.diagram,null!==a&&a.M())}},isTemporary:{get:function(){return this.u},set:function(a){var b=this.u;b!==a&&(this.u=a,this.g("isTemporary",
b,a))}},visible:{get:function(){return this.I},set:function(a){var b=this.I;if(b!==a){this.I=a;this.g("visible",b,a);for(b=this.Ca.iterator;b.next();)b.value.Pb(a);a=this.diagram;null!==a&&a.M()}}},pickable:{get:function(){return this.Fi},set:function(a){var b=this.Fi;b!==a&&(this.Fi=a,this.g("pickable",b,a))}},isBoundsIncluded:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a,null!==this.diagram&&
this.diagram.Na())}},allowCopy:{get:function(){return this.Th},set:function(a){var b=this.Th;b!==a&&(this.Th=a,this.g("allowCopy",b,a))}},allowDelete:{get:function(){return this.Uh},set:function(a){var b=this.Uh;b!==a&&(this.Uh=a,this.g("allowDelete",b,a))}},allowTextEdit:{get:function(){return this.ci},set:function(a){var b=this.ci;b!==a&&(this.ci=a,this.g("allowTextEdit",b,a))}},allowGroup:{
get:function(){return this.Vh},set:function(a){var b=this.Vh;b!==a&&(this.Vh=a,this.g("allowGroup",b,a))}},allowUngroup:{get:function(){return this.di},set:function(a){var b=this.di;b!==a&&(this.di=a,this.g("allowUngroup",b,a))}},allowLink:{get:function(){return this.Wh},set:function(a){var b=this.Wh;b!==a&&(this.Wh=a,this.g("allowLink",b,a))}},allowRelink:{get:function(){return this.Yh},set:function(a){var b=
this.Yh;b!==a&&(this.Yh=a,this.g("allowRelink",b,a))}},allowMove:{get:function(){return this.Xh},set:function(a){var b=this.Xh;b!==a&&(this.Xh=a,this.g("allowMove",b,a))}},allowReshape:{get:function(){return this.Zh},set:function(a){var b=this.Zh;b!==a&&(this.Zh=a,this.g("allowReshape",b,a))}},allowResize:{get:function(){return this.$h},set:function(a){var b=this.$h;b!==a&&(this.$h=a,this.g("allowResize",b,a))}},
allowRotate:{get:function(){return this.ai},set:function(a){var b=this.ai;b!==a&&(this.ai=a,this.g("allowRotate",b,a))}},allowSelect:{get:function(){return this.bi},set:function(a){var b=this.bi;b!==a&&(this.bi=a,this.g("allowSelect",b,a))}}});hi.prototype.findObjectsNear=hi.prototype.xg;hi.prototype.findObjectsIn=hi.prototype.tf;hi.prototype.findObjectsAt=hi.prototype.Xi;hi.prototype.findObjectAt=hi.prototype.Ub;hi.className="Layer";
function Q(a){function b(){c.removeEventListener(x.document,"DOMContentLoaded",b,!1);c.setRTL()}1<arguments.length&&B("Diagram constructor can only take one optional argument, the DIV HTML element or its id.");oi||(pi(),oi=!0);Ya(this);Ce=this;Qa=[];this.Rb=!0;this.Lc=new kh;this.Lc.$d(this);this.mb=17;this.ol=this.bv=!1;this.Js="default";this.Da=null;var c=this;Sg&&(null!==x.document.body?this.setRTL():c.addEventListener(x.document,"DOMContentLoaded",b,!1));this.Ka=new E;this.va=this.wa=0;this.Gl=
this.sa=null;this.ux=new H;this.bf=this.Fb=null;this.kw();this.yj=null;this.jw();this.rb=1;this.ma=(new I(NaN,NaN)).freeze();this.Ks=new I(NaN,NaN);this.Cn=this.ya=1;this.Tr=(new I(NaN,NaN)).freeze();this.Ur=NaN;this.os=1E-4;this.ms=100;this.nb=new qd;this.kt=(new I(NaN,NaN)).freeze();this.Or=(new N(NaN,NaN,NaN,NaN)).freeze();this.Ji=(new oc(0,0,0,0)).freeze();this.Ki=Yh;this.Ss=!1;this.Ls=this.Fs=null;this.Ig=Hh;this.oj=$c;this.Uf=Hh;this.bo=$c;this.Vr=this.Sr=vc;this.Bc=!0;this.ml=!1;this.od=new F;
this.Pg=new H;this.Zk=!0;this.cn=250;this.mj=-1;this.en=(new oc(16,16,16,16)).freeze();this.sj=this.ze=!1;this.vj=!0;this.Rf=new qe;this.Rf.diagram=this;this.Sd=new qe;this.Sd.diagram=this;this.$g=new qe;this.$g.diagram=this;this.re=this.Jf=null;this.Sj=!1;this.Er=this.Fr=null;this.Zm=x.PointerEvent&&(Ta||Ua||Va)&&x.navigator&&!1!==x.navigator.msPointerEnabled;qi(this);this.wh=new F;this.es=!0;this.ft=ri;this.Gu=!1;this.ht=Mf;this.Ja=null;si.add("Model",ti);this.yr=this.Br=this.dt=null;this.Bn=this.wr=
"auto";this.cg=this.rs=this.eg=this.fg=this.hg=this.Lf=this.Pf=this.Kf=null;this.Rr=!1;this.Mf=this.rg=this.gg=this.dg=null;this.ss=!1;this.Ds={};this.Nj=[null,null];this.qr=null;this.Cr=this.Ws=this.dv=this.pg=!1;this.Nu=!0;this.pi=this.Cc=!1;this.ac=null;var d=this;this.kd=function(a){var b=d.partManager;if(a.model===b.diagram.model&&b.diagram.Z){b.diagram.Z=!1;try{var c=a.change;""===a.modelChange&&c===ue&&b.updateDataBindings(a.object,a.propertyName)}finally{b.diagram.Z=!0}}};this.Kc=function(a){d.partManager.doModelChanged(a)};
this.lv=!0;this.Kd=-2;this.Gi=new H;this.Cs=new E;this.Wf=!1;this.Uh=this.Th=this.cr=this.ad=!0;this.dr=!1;this.jr=this.hr=this.bi=this.ai=this.$h=this.Zh=this.Xh=this.Yh=this.Wh=this.gr=this.di=this.Vh=this.ci=this.er=!0;this.Vf=this.Ju=!1;this.ir=this.fr=this.el=this.dl=!0;this.Rs=this.Ns=16;this.Ms=this.Ap=!1;this.Bp=this.Ps=null;this.Os=this.Qs=0;this.fb=(new oc(5)).freeze();this.cv=(new F).freeze();this.ns=999999999;this.Du=(new F).freeze();this.oi=this.ni=this.mi=!0;this.Se=this.ke=!1;this.ic=
null;this.Hg=!0;this.le=!1;this.kx=new F;this.Eu=new F;this.Ib=null;this.Dl=1;this.ev=0;this.Td={scale:1,position:new I,bounds:new N,Tv:!1};this.Bx=(new N(NaN,NaN,NaN,NaN)).freeze();this.am=(new M(NaN,NaN)).freeze();this.Dn=(new N(NaN,NaN,NaN,NaN)).freeze();this.fs=!1;this.vo=this.$n=this.Wo=this.ru=this.qu=this.su=this.Yf=this.Yg=this.Ye=this.Ir=null;ui(this);this.Hb=null;this.Zn=!1;this.pj=null;this.partManager=new ti;this.toolManager=new Oa;this.toolManager.initializeStandardTools();this.currentTool=
this.defaultTool=this.toolManager;this.Hr=null;this.Sk=new Se;this.xs=this.ws=null;this.Tp=!1;this.commandHandler=vi();this.model=Di();this.pg=!0;Ei(this);this.layout=new Fi;this.pg=!1;this.ax=this.vu=null;this.Sb=1;this.rh=null;this.Go=1;this.No=0;this.Oo=[0,0,0,0,0];this.Po=0;this.pd=1;this.Dj=0;this.qo=new I;this.et=500;this.dn=new I;this.me=!1;this.preventDefault=this.St=this.wm=this.xm=this.vm=this.um=this.tk=this.vk=this.uk=this.rk=this.sk=this.Gw=this.yw=this.zw=this.Aw=this.kh=this.Il=this.jh=
this.Hl=null;this.fo=!1;this.li=new Gi;this.Up=!1;void 0!==a&&Hi(this,a);this.Nn=null;this.On=Kb;this.Rb=!1}Q.prototype.clear=function(){this.animationManager.Xc();this.model.clear();Ii=null;Ji="";Ki(this,!1);this.Na();Li(this);this.M()};
function Ki(a,b){a.animationManager.Xc(!0);a.cv=(new F).freeze();a.Du=(new F).freeze();var c=a.skipsUndoManager;null!==a.model&&(a.skipsUndoManager=!0);var d=null;null!==a.Hb&&(d=a.Hb.part,null!==d&&a.remove(d));var e=[],f=a.Ka.length;if(b){for(b=0;b<f;b++)for(var g=a.Ka.j[b].parts;g.next();){var h=g.value;h!==d&&null===h.data&&e.push(h)}for(b=0;b<e.length;b++)a.remove(e[b])}for(b=0;b<f;b++)a.Ka.j[b].clear();a.partManager.clear();a.od.clear();a.Pg.clear();a.wh.clear();a.pj=null;Ga=[];null!==d&&(a.add(d),
a.partManager.parts.remove(d));null!==a.model&&(a.skipsUndoManager=c);return e}function vi(){return null}
Q.prototype.reset=function(){this.clear();this.Rb=!0;this.Lc=new kh;this.Lc.$d(this);this.mb=17;this.ol=this.bv=!1;this.Js="default";this.Ka=new E;this.ux=new H;this.bf=null;this.kw();this.yj=null;this.jw();this.rb=1;this.ma=(new I(NaN,NaN)).freeze();this.Ks=new I(NaN,NaN);this.Cn=this.ya=1;this.Tr=(new I(NaN,NaN)).freeze();this.Ur=NaN;this.os=1E-4;this.ms=100;this.nb=new qd;this.kt=(new I(NaN,NaN)).freeze();this.Or=(new N(NaN,NaN,NaN,NaN)).freeze();this.Ji=(new oc(0,0,0,0)).freeze();this.Ki=Yh;this.Ss=
!1;this.Ls=this.Fs=null;this.Ig=Hh;this.oj=$c;this.Uf=Hh;this.bo=$c;this.Vr=this.Sr=vc;this.Bc=!0;this.ml=!1;this.od=new F;this.Pg=new H;this.Zk=!0;this.cn=250;this.mj=-1;this.en=(new oc(16,16,16,16)).freeze();this.sj=this.ze=!1;this.vj=!0;this.Rf=new qe;this.Rf.diagram=this;this.Sd=new qe;this.Sd.diagram=this;this.$g=new qe;this.$g.diagram=this;this.re=this.Jf=null;this.Sj=!1;this.Er=this.Fr=null;this.Zm=x.PointerEvent&&(Ta||Ua||Va)&&x.navigator&&!1!==x.navigator.msPointerEnabled;qi(this);this.wh=
new F;this.es=!0;this.ft=ri;this.Gu=!1;this.ht=Mf;this.yr=this.Br=this.dt=null;this.Bn=this.wr="auto";this.cg=this.rs=this.eg=this.fg=this.hg=this.Lf=this.Pf=this.Kf=null;this.Rr=!1;this.Mf=this.rg=this.gg=this.dg=null;this.ss=!1;this.Ds={};this.Nj=[null,null];this.qr=null;this.Cr=this.Ws=this.dv=this.pg=!1;this.Nu=!0;this.pi=this.Cc=!1;this.lv=!0;this.Kd=-2;this.Gi=new H;this.Cs=new E;this.Wf=!1;this.Uh=this.Th=this.cr=this.ad=!0;this.dr=!1;this.jr=this.hr=this.bi=this.ai=this.$h=this.Zh=this.Xh=
this.Yh=this.Wh=this.gr=this.di=this.Vh=this.ci=this.er=!0;this.Vf=this.Ju=!1;this.ir=this.fr=this.el=this.dl=!0;this.Rs=this.Ns=16;this.Ms=this.Ap=!1;this.Os=this.Qs=0;this.fb=(new oc(5)).freeze();this.cv=(new F).freeze();this.ns=999999999;this.Du=(new F).freeze();this.oi=this.ni=this.mi=!0;this.Se=this.ke=!1;this.ic=null;this.Hg=!0;this.le=!1;this.kx=new F;this.Eu=new F;this.Ib=null;this.Dl=1;this.ev=0;this.Td={scale:1,position:new I,bounds:new N,Tv:!1};this.Bx=(new N(NaN,NaN,NaN,NaN)).freeze();
this.am=(new M(NaN,NaN)).freeze();this.Dn=(new N(NaN,NaN,NaN,NaN)).freeze();this.fs=!1;this.vo=this.$n=this.Wo=this.ru=this.qu=this.su=this.Yf=this.Yg=this.Ye=null;ui(this);this.Hb=null;this.Zn=!1;this.pj=null;this.partManager=new ti;this.toolManager=new Oa;this.toolManager.initializeStandardTools();this.currentTool=this.defaultTool=this.toolManager;this.Hr=null;this.Sk=new Se;this.xs=this.ws=null;this.Tp=!1;this.commandHandler=vi();this.pg=!0;Ei(this);this.layout=new Fi;this.pg=!1;this.model=Di();
this.model.undoManager=new ze;this.le=!1;this.vj=!0;this.ze=!1;this.Sb=1;this.rh=null;this.Go=1;this.No=0;this.Oo=[0,0,0,0,0];this.Po=0;this.pd=1;this.Dj=0;this.qo=new I;this.et=500;this.dn=new I;this.me=!1;this.kh=this.Il=this.jh=this.Hl=null;this.Up=this.fo=!1;this.Nn=null;this.On=Kb;this.Rb=!1;this.M()};
function ui(a){a.Ye=new H;var b=new V,c=new Ug;c.bind(new Mi("text","",Ja));b.add(c);a.su=b;a.Ye.add("",b);b=new V;c=new Ug;c.stroke="brown";c.bind(new Mi("text","",Ja));b.add(c);a.Ye.add("Comment",b);b=new V;b.selectable=!1;b.avoidable=!1;c=new W;c.figure="Ellipse";c.fill="black";c.stroke=null;c.desiredSize=(new M(3,3)).ca();b.add(c);a.Ye.add("LinkLabel",b);a.Yg=new H;b=new uf;b.selectionObjectName="GROUPPANEL";b.type=X.Vertical;c=new Ug;c.font="bold 12pt sans-serif";c.bind(new Mi("text","",Ja));
b.add(c);c=new X(X.Auto);c.name="GROUPPANEL";var d=new W;d.figure="Rectangle";d.fill="rgba(128,128,128,0.2)";d.stroke="black";c.add(d);d=new vg;d.padding=(new oc(5,5,5,5)).ca();c.add(d);b.add(c);a.qu=b;a.Yg.add("",b);a.Yf=new H;b=new S;c=new W;c.isPanelMain=!0;b.add(c);c=new W;c.toArrow="Standard";c.fill="black";c.stroke=null;c.strokeWidth=0;b.add(c);a.ru=b;a.Yf.add("",b);b=new S;c=new W;c.isPanelMain=!0;c.stroke="brown";b.add(c);a.Yf.add("Comment",b);b=new Ke;b.type=X.Auto;c=new W;c.fill=null;c.stroke=
"dodgerblue";c.strokeWidth=3;b.add(c);c=new vg;c.margin=(new oc(1.5,1.5,1.5,1.5)).ca();b.add(c);a.Wo=b;a.$n=b;b=new Ke;b.type=X.Link;c=new W;c.isPanelMain=!0;c.fill=null;c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);a.vo=b}
Q.prototype.setRTL=function(a){a=void 0===a?this.div:a;null===a&&(a=x.document.body);var b=ta("div");b.dir="rtl";b.style.cssText="font-size: 14px; width: 1px; height: 1px; position: absolute; top: -1000px; overflow: scroll;";b.textContent="A";a.appendChild(b);var c="reverse";0<b.scrollLeft?c="default":(b.scrollLeft=1,0===b.scrollLeft&&(c="negative"));a.removeChild(b);this.Js=c};
Q.prototype.setScrollWidth=function(a){a=void 0===a?this.div:a;null===a&&(a=x.document.body);var b=0;if(Sg){var c=Ni;b=Oi;null===c&&(c=Ni=ta("p"),c.style.width="100%",c.style.height="200px",c.style.boxSizing="content-box",b=Oi=ta("div"),b.style.position="absolute",b.style.visibility="hidden",b.style.width="200px",b.style.height="150px",b.style.boxSizing="content-box",b.appendChild(c));b.style.overflow="hidden";a.appendChild(b);var d=c.offsetWidth;b.style.overflow="scroll";c=c.offsetWidth;d===c&&(c=
b.clientWidth);a.removeChild(b);b=d-c;0!==b||Xa||(b=11)}this.mb=b;this.bv=!0};Q.prototype.gb=function(a){a.classType===Q&&(this.autoScale=a)};Q.prototype.toString=function(a){void 0===a&&(a=0);var b="";this.div&&this.div.id&&(b=this.div.id);b='Diagram "'+b+'"';if(0>=a)return b;for(var c=this.Ka.iterator;c.next();)b+="\n  "+c.value.toString(a-1);return b};Q.prototype.addEventListener=function(a,b,c,d){a.addEventListener(b,c,{capture:d,passive:!1})};
Q.prototype.removeEventListener=function(a,b,c,d){a.removeEventListener(b,c,{capture:d})};
function Pi(a){var b=a.sa.Fa;b instanceof HTMLCanvasElement&&(a.Zm?(a.addEventListener(b,"pointerdown",a.um,!1),a.addEventListener(b,"pointermove",a.vm,!1),a.addEventListener(b,"pointerup",a.xm,!1),a.addEventListener(b,"pointerout",a.wm,!1)):(a.addEventListener(b,"touchstart",a.Aw,!1),a.addEventListener(b,"touchmove",a.zw,!1),a.addEventListener(b,"touchend",a.yw,!1),a.addEventListener(b,"mousemove",a.sk,!1),a.addEventListener(b,"mousedown",a.rk,!1),a.addEventListener(b,"mouseup",a.uk,!1),a.addEventListener(b,
"mouseout",a.tk,!1)),a.addEventListener(b,"mouseenter",a.oz,!1),a.addEventListener(b,"mouseleave",a.pz,!1),a.addEventListener(b,"wheel",a.vk,!1),a.addEventListener(b,"keydown",a.bA,!1),a.addEventListener(b,"keyup",a.cA,!1),a.addEventListener(b,"blur",a.bz,!1),a.addEventListener(b,"focus",a.cz,!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!==
Ne&&(a.toolManager.gestureBehavior===Me?b.preventDefault():a.me&&a.lastInput.handled||(b.preventDefault(),a.Dl=a.scale,a.currentTool.doCancel()))},!1),a.addEventListener(b,"gesturechange",function(b){if(a.toolManager.gestureBehavior!==Ne)if(a.toolManager.gestureBehavior===Me)b.preventDefault();else if(!a.me||!a.lastInput.handled){b.preventDefault();var c=b.scale;if(null!==a.Dl){var e=a.sa.getBoundingClientRect();b=new I(b.pageX-x.scrollX-a.wa/e.width*e.left,b.pageY-x.scrollY-a.va/e.height*e.top);
c=a.Dl*c;e=a.commandHandler;if(c!==a.scale&&e.canResetZoom(c)){var f=a.zoomPoint;a.zoomPoint=b;e.resetZoom(c);a.zoomPoint=f}}}},!1),a.addEventListener(x,"resize",a.Gw,!1))}function Ve(a){30<a.No&&(a.rh=1)}function jf(a,b){null!==a.rh&&(a.rh=null,b&&a.St(),a.No=0,a.Oo=[0,0,0,0,0],a.Po=0)}Q.prototype.computePixelRatio=function(){return null!==this.rh?this.rh:x.devicePixelRatio||1};Q.prototype.doMouseMove=function(){this.currentTool.doMouseMove()};Q.prototype.doMouseDown=function(){this.currentTool.doMouseDown()};
Q.prototype.doMouseUp=function(){this.currentTool.doMouseUp()};Q.prototype.doMouseWheel=function(){this.currentTool.doMouseWheel()};Q.prototype.doKeyDown=function(){this.currentTool.doKeyDown()};Q.prototype.doKeyUp=function(){this.currentTool.doKeyUp()};Q.prototype.doFocus=function(){this.focus()};Q.prototype.focus=function(){if(this.sa)if(this.scrollsPageOnFocus)this.sa.focus();else{var a=x.scrollX||x.pageXOffset,b=x.scrollY||x.pageYOffset;this.sa.focus();x.scrollTo(a,b)}};Q.prototype.cz=function(){this.B.R("GainedFocus")};
Q.prototype.bz=function(){this.B.R("LostFocus")};function Ih(a){if(null!==a.sa){var b=a.Da;if(0!==b.clientWidth&&0!==b.clientHeight){a.bv||a.setScrollWidth();var c=a.Se?a.mb:0,d=a.ke?a.mb:0,e=a.Sb;a.Sb=a.computePixelRatio();a.Sb!==e&&(a.ml=!0,a.Bb());if(b.clientWidth!==a.wa+c||b.clientHeight!==a.va+d)a.ni=!0,a.Bc=!0,b=a.layout,null!==b&&b.isViewportSized&&a.autoScale===Hh&&(a.sj=!0,b.C()),a.Cc||a.Bb()}}}
function Ei(a){var b=new hi;b.name="Background";a.bm(b);b=new hi;b.name="";a.bm(b);b=new hi;b.name="Foreground";a.bm(b);b=new hi;b.name="Adornment";b.isTemporary=!0;a.bm(b);b=new hi;b.name="Tool";b.isTemporary=!0;b.isBoundsIncluded=!0;a.bm(b);b=new hi;b.name="Grid";b.allowSelect=!1;b.pickable=!1;b.isTemporary=!0;a.Fx(b,a.km("Background"))}
function Qi(a){a.Hb=new X(X.Grid);a.Hb.name="GRID";var b=new W;b.figure="LineH";b.stroke="lightgray";b.strokeWidth=.5;b.interval=1;a.Hb.add(b);b=new W;b.figure="LineH";b.stroke="gray";b.strokeWidth=.5;b.interval=5;a.Hb.add(b);b=new W;b.figure="LineH";b.stroke="gray";b.strokeWidth=1;b.interval=10;a.Hb.add(b);b=new W;b.figure="LineV";b.stroke="lightgray";b.strokeWidth=.5;b.interval=1;a.Hb.add(b);b=new W;b.figure="LineV";b.stroke="gray";b.strokeWidth=.5;b.interval=5;a.Hb.add(b);b=new W;b.figure="LineV";
b.stroke="gray";b.strokeWidth=1;b.interval=10;a.Hb.add(b);b=new T;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 Ri(){this.B.Ms?this.B.Ms=!1:this.B.isEnabled?this.B.Px(this):Si(this.B)}function Ti(a){this.B.isEnabled?(this.B.Qs=a.target.scrollTop,this.B.Os=a.target.scrollLeft):Si(this.B)}
Q.prototype.Px=function(a){if(null!==this.sa){this.Ap=!0;var b=this.documentBounds,c=this.viewportBounds,d=this.Ji,e=b.x-d.left,f=b.y-d.top,g=b.width+d.left+d.right,h=b.height+d.top+d.bottom,k=b.right+d.right;d=b.bottom+d.bottom;var l=c.x;b=c.y;var m=c.width,n=c.height,p=c.right,r=c.bottom;c=this.scale;var q=a.scrollLeft;if(this.ol)switch(this.Js){case "negative":q=q+a.scrollWidth-a.clientWidth;break;case "reverse":q=a.scrollWidth-q-a.clientWidth}var u=q;m<g||n<h?(q=I.allocAt(this.position.x,this.position.y),
this.allowHorizontalScroll&&this.Os!==u&&(q.x=u/c+e,this.Os=u),this.allowVerticalScroll&&this.Qs!==a.scrollTop&&(q.y=a.scrollTop/c+f,this.Qs=a.scrollTop),this.position=q,I.free(q),this.ni=this.Ap=!1):(q=I.alloc(),a.Ly&&this.allowHorizontalScroll&&(e<l&&(this.position=q.h(u+e,this.position.y)),k>p&&(this.position=q.h(-(this.Ps.scrollWidth-this.wa)+u-this.wa/c+k,this.position.y))),a.My&&this.allowVerticalScroll&&(f<b&&(this.position=q.h(this.position.x,a.scrollTop+f)),d>r&&(this.position=q.h(this.position.x,
-(this.Ps.scrollHeight-this.va)+a.scrollTop-this.va/c+d))),I.free(q),Ui(this),this.ni=this.Ap=!1,b=this.documentBounds,c=this.viewportBounds,k=b.right,p=c.right,d=b.bottom,r=c.bottom,e=b.x,l=c.x,f=b.y,b=c.y,m>=g&&e>=l&&k<=p&&(this.Bp.style.width="1px"),n>=h&&f>=b&&d<=r&&(this.Bp.style.height="1px"))}};Q.prototype.computeBounds=function(){0<this.od.count&&Vi(this);return Wi(this)};
function Wi(a){if(a.fixedBounds.v()){var b=a.fixedBounds.copy();b.iq(a.fb);return b}for(var c=!0,d=a.Ka.j,e=d.length,f=0;f<e;f++){var g=d[f];if(g.visible&&(!g.isTemporary||g.isBoundsIncluded)){g=g.Ca.j;for(var h=g.length,k=0;k<h;k++){var l=g[k];l.isInDocumentBounds&&l.isVisible()&&(l=l.actualBounds,l.v()&&(c?(c=!1,b=l.copy()):b.Jc(l)))}}}c&&(b=new N(0,0,0,0));b.iq(a.fb);return b}
Q.prototype.computePartsBounds=function(a,b){void 0===b&&(b=!1);var c=null;if(Aa(a))for(var d=0;d<a.length;d++){var e=a[d];!b&&e instanceof S||(e.Ab(),null===c?c=e.actualBounds.copy():c.Jc(e.actualBounds))}else for(a=a.iterator;a.next();)d=a.value,!b&&d instanceof S||(d.Ab(),null===c?c=d.actualBounds.copy():c.Jc(d.actualBounds));return null===c?new N(NaN,NaN,0,0):c};
function Xi(a,b){if((b||a.le)&&!a.Rb&&null!==a.sa&&a.documentBounds.v()){if(b){var c=a.initialPosition;if(c.v()){a.position=c;return}c=I.alloc();c.gj(a.documentBounds,a.initialDocumentSpot);var d=a.viewportBounds;d=N.allocAt(0,0,d.width,d.height);var e=I.alloc();e.gj(d,a.initialViewportSpot);e.h(c.x-e.x,c.y-e.y);a.position=e;N.free(d);I.free(e);I.free(c)}a.Rb=!0;c=a.Ig;b&&a.Uf!==Hh&&(c=a.Uf);d=c!==Hh?Yi(a,c):a.scale;c=a.viewportBounds.copy();e=a.wa/d;var f=a.va/d,g=a.oj,h=a.bo;b&&!g.hb()&&(h.hb()||
h.Nb())&&(g=h.Nb()?Ac:h);Zi(a,a.documentBounds,e,f,g,b);b=a.scale;a.scale=d;a.Rb=!1;d=a.viewportBounds;d.Ma(c)||a.Jq(c,d,b,!1);$i(a);aj(a,!0,!1)}}
function Yi(a,b){var c=a.Cn;if(null===a.sa)return c;Li(a);var d=a.documentBounds;if(!d.v())return c;var e=d.width;d=d.height;var f=a.wa+(a.Se?a.mb:0),g=a.va+(a.ke?a.mb:0),h=f/e,k=g/d;return b===bj?(b=Math.min(k,h),b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):b===cj?(b=k>h?(g-a.mb)/d:(f-a.mb)/e,b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):a.scale}
Q.prototype.zoomToFit=function(){var a=this.Ki;this.Ki=Yh;this.scale=Yi(this,bj);a!==Yh&&(Xi(this,!1),Zi(this,this.documentBounds,this.wa/this.ya,this.va/this.ya,this.oj,!1));this.Ki=a};t=Q.prototype;
t.KA=function(a,b){void 0===b&&(b=bj);var c=a.width,d=a.height;if(!(0===c||0===d||isNaN(c)&&isNaN(d))){var e=1;if(b===bj||b===cj)if(isNaN(c))e=this.viewportBounds.height*this.scale/d;else if(isNaN(d))e=this.viewportBounds.width*this.scale/c;else{e=this.wa;var f=this.va;e=b===cj?f/d>e/c?(f-(this.ke?this.mb:0))/d:(e-(this.Se?this.mb:0))/c:Math.min(f/d,e/c)}this.scale=e;this.position=new I(a.x,a.y)}};
t.Xy=function(a,b){Li(this);var c=this.documentBounds,d=this.viewportBounds;this.position=new I(c.x+(a.x*c.width+a.offsetX)-(b.x*d.width-b.offsetX),c.y+(a.y*c.height+a.offsetY)-(b.y*d.height-b.offsetY))};t.Lz=function(a){if(a instanceof Y){this.Nn=a;var b=I.alloc();this.On=this.Wq(a.ga(vc,b));I.free(b)}else this.Nn=null,this.On=Kb};
function Zi(a,b,c,d,e,f){var g=I.allocAt(a.ma.x,a.ma.y),h=g.x,k=g.y;if(null!==a.Nn){var l=I.alloc();l=a.Nn.ga(vc,l);h=l.x-a.On.x/a.scale;k=l.y-a.On.y/a.scale;e=uc;I.free(l)}if(f||a.scrollMode===Yh)e.hb()&&(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.Ji,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.fb.left;g.y=isFinite(k)?k:-a.fb.top;null!==a.positionComputation&&(b=a.positionComputation(a,g),g.x=b.x,g.y=b.y);a.Lc.qc&&Rh(a.Lc,a.ma,g);a.ma.h(g.x,g.y);I.free(g)}
t.lm=function(a,b){void 0===b&&(b=!0);if(b){if(a=vf(this,a,function(a){return a.part},function(a){return a.canSelect()}),a instanceof T)return a}else if(a=vf(this,a,function(a){return a.part}),a instanceof T)return a;return null};t.Ub=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);Vi(this);for(var d=this.Ka.iteratorBackwards;d.next();){var e=d.value;if(e.visible&&(e=e.Ub(a,b,c),null!==e))return e}return null};
function vf(a,b,c,d){void 0===c&&(c=null);void 0===d&&(d=null);Vi(a);for(a=a.Ka.iteratorBackwards;a.next();){var e=a.value;if(e.visible&&!e.isTemporary&&(e=e.Ub(b,c,d),null!==e))return e}return null}t.zz=function(a,b,c){void 0===b&&(b=!0);return dj(this,a,function(a){return a.part},b?function(a){return a instanceof T&&a.canSelect()}:null,c)};
function dj(a,b,c,d,e){void 0===c&&(c=null);void 0===d&&(d=null);e instanceof E||e instanceof F||(e=new F);Vi(a);for(a=a.Ka.iteratorBackwards;a.next();){var f=a.value;f.visible&&!f.isTemporary&&f.Xi(b,c,d,e)}return e}t.Xi=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof E||d instanceof F||(d=new F);Vi(this);for(var e=this.Ka.iteratorBackwards;e.next();){var f=e.value;f.visible&&f.Xi(a,b,c,d)}return d};
t.Xx=function(a,b,c,d){void 0===b&&(b=!1);void 0===c&&(c=!0);return ej(this,a,function(a){return a instanceof T&&(!c||a.canSelect())},b,d)};t.tf=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof E||e instanceof F||(e=new F);Vi(this);for(var f=this.Ka.iteratorBackwards;f.next();){var g=f.value;g.visible&&g.tf(a,b,c,d,e)}return e};
t.Gv=function(a,b,c,d,e,f){var g=new F;Vi(this);for(var h=this.Ka.iteratorBackwards;h.next();){var k=h.value;k.visible&&k.Gv(a,b,c,d,g,e,f)}return g};function ej(a,b,c,d,e){var f=null;void 0===f&&(f=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof E||e instanceof F||(e=new F);Vi(a);for(a=a.Ka.iteratorBackwards;a.next();){var g=a.value;g.visible&&!g.isTemporary&&g.tf(b,f,c,d,e)}return e}
t.Az=function(a,b,c,d,e){void 0===c&&(c=!0);void 0===d&&(d=!0);return fj(this,a,b,function(a){return a instanceof T&&(!d||a.canSelect())},c,e)};t.xg=function(a,b,c,d,e,f){void 0===c&&(c=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof E||e instanceof F)f=e;e=!0}f instanceof E||f instanceof F||(f=new F);Vi(this);for(var g=this.Ka.iteratorBackwards;g.next();){var h=g.value;h.visible&&h.xg(a,b,c,d,e,f)}return f};
function fj(a,b,c,d,e,f){var g=null;void 0===g&&(g=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof E||e instanceof F)f=e;e=!0}f instanceof E||f instanceof F||(f=new F);Vi(a);for(a=a.Ka.iteratorBackwards;a.next();){var h=a.value;h.visible&&!h.isTemporary&&h.xg(b,c,g,d,e,f)}return f}Q.prototype.acceptEvent=function(a){return gj(this,a,a instanceof MouseEvent)};
function gj(a,b,c){var d=a.Sd;a.Sd=a.$g;a.$g=d;d.diagram=a;d.event=b;c?hj(a,b,d):(d.viewPoint=a.Sd.viewPoint,d.documentPoint=a.Sd.documentPoint);a=0;b.ctrlKey&&(a+=1);b.altKey&&(a+=2);b.shiftKey&&(a+=4);b.metaKey&&(a+=8);d.modifiers=a;d.button=b.button;void 0===b.buttons||Sa||(d.buttons=b.buttons);Wa&&0===b.button&&b.ctrlKey&&(d.button=2);d.down=!1;d.up=!1;d.clickCount=1;d.delta=0;d.handled=!1;d.bubbles=!1;d.timestamp=b.timeStamp;d.isMultiTouch=!1;d.targetDiagram=ij(b);d.targetObject=null;return d}
function ij(a){var b=a.target.B;if(!b){var c=a.path;c||"function"!==typeof a.composedPath||(c=a.composedPath());c&&c[0]&&(b=c[0].B)}return b?b:null}function jj(a,b,c,d){var e=kj(a,b,!0,!1,!0,d);hj(a,c,e);e.targetDiagram=ij(b);e.targetObject=null;d||e.clone(a.Rf);return e}
function lj(a,b,c,d){var e;d=kj(a,b,!1,!1,!1,d);null!==c?((e=x.document.elementFromPoint(c.clientX,c.clientY))&&e.B?(b=c,c=e.B):(b=void 0!==b.targetTouches?b.targetTouches[0]:b,c=a),d.targetDiagram=c,hj(a,b,d)):null!==a.Sd?(d.documentPoint=a.Sd.documentPoint,d.viewPoint=a.Sd.viewPoint,d.targetDiagram=a.Sd.targetDiagram):null!==a.Rf&&(d.documentPoint=a.Rf.documentPoint,d.viewPoint=a.Rf.viewPoint,d.targetDiagram=a.Rf.targetDiagram);d.targetObject=null;return d}
function kj(a,b,c,d,e,f){var g=a.Sd;a.Sd=a.$g;a.$g=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.Zm&&b instanceof x.PointerEvent&&"touch"!==b.pointerType&&(g.button=b.button,void 0===b.buttons||Sa||(g.buttons=b.buttons),Wa&&0===b.button&&b.ctrlKey&&(g.button=2));g.down=c;g.up=d;g.handled=!1;g.bubbles=e;g.isMultiTouch=f;return g}
function mj(a,b){if(a.bubbles)return!0;void 0!==b.stopPropagation&&b.stopPropagation();!1!==b.cancelable&&b.preventDefault();b.cancelBubble=!0;return!1}
Q.prototype.bA=function(a){var b=this.B;if(!this.B.isEnabled)return!1;var c=gj(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 mj(c,a)};
Q.prototype.cA=function(a){var b=this.B;if(!b.isEnabled)return!1;var c=gj(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 mj(c,a)};
Q.prototype.oz=function(a){var b=this.B;if(!b.isEnabled)return!1;var c=gj(b,a,!0);null!==b.mouseEnter&&b.mouseEnter(c);return mj(c,a)};Q.prototype.pz=function(a){var b=this.B;if(!b.isEnabled)return!1;var c=gj(b,a,!0);null!==b.mouseLeave&&b.mouseLeave(c);return mj(c,a)};
Q.prototype.getMouse=function(a){var b=this.sa;if(null===b)return new I(0,0);var c=b.getBoundingClientRect();b=a.clientX-this.wa/c.width*c.left;a=a.clientY-this.va/c.height*c.top;return null!==this.nb?Ab(new I(b,a),this.nb):new I(b,a)};
function hj(a,b,c){var d=a.sa,e=a.wa,f=a.va,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.nb?(b=I.allocAt(g,h),a.nb.Xd(b),c.documentPoint.assign(b),I.free(b)):c.documentPoint.h(g,h)}
function re(a,b,c,d){if(void 0!==b.targetTouches){if(2>b.targetTouches.length)return;b=b.targetTouches[c]}else if(null!==a.Nj[0])b=a.Nj[c];else return;c=a.sa;null!==c&&(c=c.getBoundingClientRect(),d.h(b.clientX-a.wa/c.width*c.left,b.clientY-a.va/c.height*c.top))}t=Q.prototype;t.Na=function(){this.mi||(this.mi=!0,this.Bb(!0))};function nj(a){a.Cc||Vi(a);Li(a)}t.Zd=function(){this.Rb||this.Cc||(this.M(),$i(this),Ui(this),this.Na(),this.Wc())};t.aA=function(){return this.ze};
t.jz=function(a){void 0===a&&(a=null);var b=this.animationManager,c=b.isEnabled;b.Xc();b.isEnabled=!1;If(this);this.le=!1;this.Ks=new I(NaN,NaN);b.isEnabled=c;null!==a&&sa(function(){Bh(b,"Model");a()},1)};t.Bb=function(a){void 0===a&&(a=!1);if(!0!==this.ze&&!(this.Rb||!1===a&&this.Cc)){this.ze=!0;var b=this;x.requestAnimationFrame(function(){b.ze&&b.Wc()})}};t.Wc=function(){if(!this.vj||this.ze)this.vj&&(this.vj=!1),If(this)};
function aj(a,b,c){a.animationManager.defaultAnimation.isAnimating||a.Rb||!a.ni||Si(a)||(b&&Vi(a),c&&Xi(a,!1))}
function If(a,b){if(!a.Cc&&(a.ze=!1,null!==a.Da||a.am.v())){a.Cc=!0;var c=a.animationManager,d=a.Cs;if(!c.isAnimating&&0!==d.length){for(var e=d.j,f=e.length,g=0;g<f;g++){var h=e[g];oj(h,!1);h.o()}d.clear()}d=a.Eu;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.qc||Ih(a);aj(a,!1,!0);null!==a.Hb&&(a.Hb.visible&&!a.Zn&&(pj(a),a.Zn=!0),!a.Hb.visible&&a.Zn&&(a.Zn=!1));Vi(a);f=!1;if(!a.le||a.Hg)a.le?qj(a,!a.sj):(a.ua("Initial Layout"),
!1===c.isEnabled&&c.Xc(),qj(a,!1)),f=!0;a.sj=!1;Vi(a);a.Ws||nj(a);aj(a,!0,!1);g=!1;f?(c=N.alloc(),c.assign(a.viewportBounds),a.le||(g=a.le=!0,a.skipsUndoManager||(a.undoManager.isPendingClear=!0),a.undoManager.isPendingUnmodified=!0,rj(a)),a.R("LayoutCompleted"),c.w(a.viewportBounds)||aj(a,!0,!1),N.free(c)):c.hl&&c.Ax&&(a.Uf!==Hh?a.scale=Yi(a,a.Uf):a.Ig!==Hh?a.scale=Yi(a,a.Ig):(c=a.initialScale,isFinite(c)&&0<c&&(a.scale=c)),Xi(a,!0));Vi(a);f&&g&&a.Va("Initial Layout");a.sv();b||a.bc(a.Fb);e&&(a.skipsUndoManager=
d);a.Cc=!1}}function rj(a){var b=a.ya;if(a.Uf!==Hh)a.scale=Yi(a,a.Uf);else if(a.Ig!==Hh)a.scale=Yi(a,a.Ig);else{var c=a.initialScale;isFinite(c)&&0<c&&(a.scale=c)}a.ya!==b&&($i(a),aj(a,!0,!1));Xi(a,!0);b=a.Ka.j;a.Bd(b,b.length,a);a.R("InitialLayoutCompleted");a.Ks.assign(a.ma);pj(a)}
function Vi(a){if((a.Cc||!a.animationManager.isTicking)&&0!==a.od.count){for(var b=0;23>b;b++){var c=a.od.iterator;if(null===c||0===a.od.count)break;a.od=new F;a.Fw(c,a.od)}a.nodes.each(function(a){a instanceof uf&&0!==(a.P&65536)!==!1&&(a.P=a.P^65536)})}}
t.Fw=function(a,b){for(a.reset();a.next();){var c=a.value;!c.Wb()||c instanceof uf||(c.ej()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))}for(a.reset();a.next();)c=a.value,c instanceof uf&&c.isVisible()&&sj(this,c);for(a.reset();a.next();)c=a.value,c instanceof S&&c.isVisible()&&(c.ej()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c));for(a.reset();a.next();)c=a.value,c instanceof Ke&&c.isVisible()&&(c.ej()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))};
function sj(a,b){for(var c=Fa(),d=Fa(),e=b.memberParts;e.next();){var f=e.value;f.isVisible()&&(f instanceof uf?(tj(f)||uj(f)||vj(f))&&sj(a,f):f instanceof S?f.fromNode===b||f.toNode===b?d.push(f):c.push(f):(f.measure(Infinity,Infinity),f.arrange()))}a=c.length;for(e=0;e<a;e++)f=c[e],f.measure(Infinity,Infinity),f.arrange();Ha(c);b.measure(Infinity,Infinity);b.arrange();a=d.length;for(b=0;b<a;b++)c=d[b],c.measure(Infinity,Infinity),c.arrange();Ha(d)}
t.Bd=function(a,b,c,d){if(this.oi||this.animationManager.isAnimating)for(var e=0;e<b;e++)a[e].Bd(c,d)};
t.bc=function(a,b){void 0===b&&(b=null);if(null!==this.Da){null===this.sa&&B("No canvas specified");var c=this.animationManager;if(!c.qc&&(!c.isAnimating||c.isTicking)){var d=new Date;wj(this);if("0"!==this.Da.style.opacity){var e=a!==this.Fb,f=this.Ka.j,g=f.length,h=this;this.Bd(f,g,h);if(e)a.sc(!0),Ui(this);else if(!this.Bc&&null===b&&!c.isAnimating)return;g=this.ma;var k=this.ya,l=Math.round(g.x*k)/k,m=Math.round(g.y*k)/k;c=this.nb;c.reset();1!==k&&c.scale(k);0===g.x&&0===g.y||c.translate(-l,-m);
k=this.Sb;a.setTransform(1,0,0,1,0,0);a.scale(k,k);a.clearRect(0,0,this.wa,this.va);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);xj(this,a);a.globalAlpha=this.rb;l=null!==b?function(c){var d=b;if(c.visible&&0!==c.rb){var e=c.Ca.j,f=e.length;if(0!==f){var g=ki(c,a),k=c.cp;k.length=0;for(var l=h.scale,m=N.alloc(),n=0;n<f;n++){var A=e[n];d.contains(A)||c.Ti(a,A,h,k,l,m)}N.free(m);a.globalAlpha=g}}}:function(b){b.bc(a,h)};g=f.length;for(m=0;m<g;m++)a.setTransform(1,
0,0,1,0,0),a.scale(k,k),a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy),l(f[m]);this.li&&yj(this.li,this)&&this.Ir();e?(this.Fb.sc(!0),Ui(this)):this.Bc=this.oi=!1;e=+new Date-+d;if(null===this.rh){d=this.Oo;d[this.Po]=e;this.Po=(this.Po+1)%d.length;for(f=e=0;f<this.Oo.length;f++)e+=this.Oo[f];this.No=e/d.length}}}}};
function zj(a,b,c,d,e,f,g,h,k,l){if(null!==a.Da){null===a.sa&&B("No canvas specified");void 0===g&&(g=null);void 0===h&&(h=null);void 0===k&&(k=!1);void 0===l&&(l=!1);wj(a);a.Fb.sc(!0);Ui(a);a.pi=!0;var m=a.ya;a.ya=e;var n=a.Ka.j,p=n.length;try{var r=new N(f.x,f.y,d.width/e,d.height/e),q=r.copy();q.iq(c);pj(a,q);Vi(a);a.Bd(n,p,a,r);var u=a.Sb;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 v=qd.alloc();
v.reset();v.translate(c.left,c.top);v.scale(e);0===f.x&&0===f.y||v.translate(-f.x,-f.y);b.setTransform(v.m11,v.m12,v.m21,v.m22,v.dx,v.dy);qd.free(v);xj(a,b);b.globalAlpha=a.rb;if(null!==g){var w=new F,y=g.iterator;for(y.reset();y.next();){var z=y.value;!1===l&&"Grid"===z.layer.name||null===z||w.add(z)}var A=function(c){if(c.visible&&0!==c.rb&&(k||!c.isTemporary)){var d=c.Ca.j,e=d.length;if(0!==e){var f=ki(c,b),g=c.cp;g.length=0;for(var h=a.scale,l=N.alloc(),m=0;m<e;m++){var n=d[m];w.contains(n)&&
c.Ti(b,n,a,g,h,l)}N.free(l);b.globalAlpha=f}}}}else if(!k&&l){var C=a.grid.part,G=C.layer;A=function(c){c===G?C.bc(b,a):c.bc(b,a,k)}}else A=function(c){c.bc(b,a,k)};for(c=0;c<p;c++)A(n[c]);a.pi=!1;a.li&&yj(a.li,a)&&a.Ir()}finally{a.ya=m,a.Fb.sc(!0),Ui(a),a.Bd(n,p,a),pj(a)}}}t.Ee=function(a){return this.bf[a]};t.zy=function(a,b){"minDrawingLength"===a&&(this.Go=b);this.bf[a]=b;this.Zd()};
t.kw=function(){this.bf=new db;this.bf.drawShadows=!0;this.bf.textGreeking=!0;this.bf.viewportOptimizations=Xa||Ta||Ua?!1:!0;this.bf.temporaryPixelRatio=!0;this.bf.pictureRatioOptimization=!0;this.Go=this.bf.minDrawingLength=1};function xj(a,b){a=a.bf;null!==a&&(void 0!==a.imageSmoothingEnabled&&b.yy(!!a.imageSmoothingEnabled),a=a.defaultFont,void 0!==a&&null!==a&&(b.font=a))}t.om=function(a){return this.yj[a]};t.zA=function(a,b){this.yj[a]=b};
t.jw=function(){this.yj=new db;this.yj.extraTouchArea=10;this.yj.extraTouchThreshold=10;this.yj.hasGestureZoom=!0};t.rw=function(a){Aj(this,a)};
function Aj(a,b){var c=a instanceof X,d=a instanceof Q,e;for(e in b){""===e&&B("Setting properties requires non-empty property names");var f=a,g=e;if(c||d){var h=e.indexOf(".");if(0<h){var k=e.substring(0,h);if(c)f=a.Za(k);else if(f=a[k],void 0===f||null===f)f=a.toolManager[k];za(f)?g=e.substr(h+1):B("Unable to find object named: "+k+" in "+a.toString()+" when trying to set property: "+e)}}if("_"!==g[0]&&!Ka(f,g))if(d&&"ModelChanged"===g){a.Hx(b[g]);continue}else if(d&&"Changed"===g){a.Ah(b[g]);continue}else if(d&&
Ka(a.toolManager,g))f=a.toolManager;else if(d&&Bj(a,g)){a.Xj(g,b[g]);continue}else if(a instanceof Z&&"Changed"===g){a.Ah(b[g]);continue}else B('Trying to set undefined property "'+g+'" on object: '+f.toString());f[g]=b[e];"_"===g[0]&&f instanceof Y&&f.Ex(g)}}t.sv=function(){if(0===this.undoManager.transactionLevel&&0!==this.Pg.count){for(;0<this.Pg.count;){var a=this.Pg;this.Pg=new H;for(a=a.iterator;a.next();){var b=a.key;b.Bq(a.value);b.cc()}}this.M()}};
t.M=function(a){void 0===a&&(a=null);if(null===a)this.Bc=!0,this.Bb();else{var b=this.viewportBounds;null!==a&&a.v()&&b.Ic(a)&&(this.Bc=!0,this.Bb())}this.R("InvalidateDraw")};
t.jy=function(a,b){if(!0!==this.Bc){this.Bc=!0;var c=!0===this.Ee("temporaryPixelRatio");if(!0===this.Ee("viewportOptimizations")&&this.scrollMode!==$h&&this.Ji.Vi(0,0,0,0)&&b.width===a.width&&b.height===a.height){var d=this.scale,e=Math.max(a.x,b.x),f=Math.max(a.y,b.y);d=N.allocAt(e,f,Math.max(0,Math.min(a.x+a.width,b.x+b.width)-e)*d,Math.max(0,Math.min(a.y+a.height,b.y+b.height)-f)*d);if(!this.Up&&0<d.width&&0<d.height){if(!(this.Cc||(this.ze=!1,null===this.Da||(this.Cc=!0,this.sv(),this.documentBounds.v()||
Cj(this,this.computeBounds()),e=this.sa,null===e||e instanceof Dj)))){var g=this.Sb;f=this.wa*g;var h=this.va*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.vu;a=this.ax;k.width!==f&&(k.width=f);k.height!==h&&(k.height=h);a.clearRect(0,0,f,h);k=190*g;var m=70*g,n=Math.max(l,0),p=Math.max(b,0),r=Math.floor(f-n),q=Math.floor(h-p);a.drawImage(e.Fa,n,p,r,q,0,0,r,q);yj(this.li,this)&&a.clearRect(0,0,k,m);e=Fa();a=Fa();q=Math.abs(l);
r=Math.abs(b);var u=0===n?0:f-q;n=I.allocAt(u,0);q=I.allocAt(q+u,h);a.push(new N(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));var v=this.nb;v.reset();v.scale(g,g);1!==this.ya&&v.scale(this.ya);g=this.ma;(0!==g.x||0!==g.y)&&isFinite(g.x)&&isFinite(g.y)&&v.translate(-g.x,-g.y);Ab(n,v);Ab(q,v);e.push(new N(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));u=0===p?0:h-r;n.h(0,u);q.h(f,r+u);a.push(new N(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-
q.x),Math.abs(n.y-q.y)));Ab(n,v);Ab(q,v);e.push(new N(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));yj(this.li,this)&&(f=0<l?0:-l,h=0<b?0:-b,n.h(f,h),q.h(k+f,m+h),a.push(new N(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y))),Ab(n,v),Ab(q,v),e.push(new N(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y))));I.free(n);I.free(q);aj(this,!1,!0);null===this.Da&&B("No div specified");null===this.sa&&B("No canvas specified");if(!this.animationManager.qc&&
(f=this.Fb,this.Bc)){wj(this);h=this.Sb;f.setTransform(1,0,0,1,0,0);f.clearRect(0,0,this.wa*h,this.va*h);f.drawImage(this.vu.Fa,0<l?0:Math.round(-l),0<b?0:Math.round(-b));l=this.ma;g=this.ya;k=Math.round(l.x*g)/g;m=Math.round(l.y*g)/g;b=this.nb;b.reset();1!==g&&b.scale(g);0===l.x&&0===l.y||b.translate(-k,-m);f.save();f.beginPath();l=a.length;for(g=0;g<l;g++)k=a[g],0!==k.width&&0!==k.height&&f.rect(Math.floor(k.x),Math.floor(k.y),Math.ceil(k.width),Math.ceil(k.height));f.clip();f.setTransform(1,0,
0,1,0,0);f.scale(h,h);f.transform(b.m11,b.m12,b.m21,b.m22,b.dx,b.dy);b=this.Ka.j;l=b.length;this.Bd(b,l,this);xj(this,f);f.globalAlpha=this.rb;for(h=0;h<l;h++)if(g=b[h],k=e,g.visible&&0!==g.rb){m=ki(g,f);p=g.cp;p.length=0;n=this.scale;r=N.alloc();q=g.Ca.j;v=q.length;u=k.length;for(var w=0;w<v;w++){var y=q[w],z=Ej(y,y.actualBounds);a:{for(var A=2/n,C=4/n,G=0;G<u;G++){var L=k[G];if(0!==L.width&&0!==L.height&&z.Ov(L.x-A,L.y-A,L.width+C,L.height+C)){z=!0;break a}}z=!1}z&&g.Ti(f,y,this,p,n,r)}N.free(r);
f.globalAlpha=m}f.restore();f.sc(!0);this.li&&yj(this.li,this)&&this.Ir();this.Bc=this.oi=!1;this.St()}Ha(e);Ha(a);this.Cc=!1}}else this.Wc();N.free(d);c&&(Ve(this),this.Wc(),jf(this,!0))}else c?(Ve(this),this.Wc(),jf(this,!0)):this.Wc()}};function $i(a){!1===a.ni&&(a.ni=!0)}function Ui(a){!1===a.oi&&(a.oi=!0)}function wj(a){!1!==a.ml&&(a.ml=!1,Fj(a,a.wa,a.va))}function Fj(a,b,c){var d=a.Sb;a.sa.resize(b*d,c*d,b,c)&&(a.Bc=!0,a.Fb.sc(!0))}
function Si(a){var b=a.sa;if(null===b)return!0;var c=a.Da,d=a.wa,e=a.va,f=a.viewportBounds.copy();if(!f.v())return!0;var g=!1,h=a.Se?a.mb:0,k=a.ke?a.mb:0,l=c.clientWidth||d+h,m=c.clientHeight||e+k;if(l!==d+h||m!==e+k)a.Se=!1,a.ke=!1,k=h=0,a.wa=l,a.va=m,g=a.ml=!0;if(!(g||a.Se||a.ke||a.dl||a.el))return!0;a.ni=!1;var n=a.viewportBounds,p=a.documentBounds,r=0,q=0,u=0,v=0;c=n.width;var w=n.height,y=a.Ji;a.contentAlignment.hb()?(p.width>c&&(r=y.left,q=y.right),p.height>w&&(u=y.top,v=y.bottom)):(r=y.left,
q=y.right,u=y.top,v=y.bottom);y=p.width+r+q;var z=p.height+u+v;r=p.x-r;var A=n.x;q=p.right+q;var C=n.right+h;u=p.y-u;var G=n.y;p=p.bottom+v;n=n.bottom+k;var L="1px",J="1px";v=a.scale;l=y>l/v;m=z>m/v;a.scrollMode===Yh&&(l||m)&&(l&&a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(l=1,r+1<A&&(l=Math.max((A-r)*v+a.wa,l)),q>C+1&&(l=Math.max((q-C)*v+a.wa,l)),c+h+1<y&&(l=Math.max((y-c)*v+a.wa,l)),L=l.toString()+"px"),m&&a.hasVerticalScrollbar&&a.allowVerticalScroll&&(l=1,u+1<G&&(l=Math.max((G-u)*v+a.va,
l)),p>n+1&&(l=Math.max((p-n)*v+a.va,l)),w+k+1<z&&(l=Math.max((z-w)*v+a.va,l)),J=l.toString()+"px"));l="1px"!==L;m="1px"!==J;l&&m||!l&&!m||(m&&(C-=a.mb),l&&(n-=a.mb),y<c+h||!a.hasHorizontalScrollbar||!a.allowHorizontalScroll||(h=1,r+1<A&&(h=Math.max((A-r)*v+a.wa,h)),q>C+1&&(h=Math.max((q-C)*v+a.wa,h)),c+1<y&&(h=Math.max((y-c)*v+a.wa,h)),L=h.toString()+"px"),l="1px"!==L,h=a.va,l!==a.ke&&(h=l?a.va-a.mb:a.va+a.mb),z<w+k||!a.hasVerticalScrollbar||!a.allowVerticalScroll||(k=1,u+1<G&&(k=Math.max((G-u)*v+
h,k)),p>n+1&&(k=Math.max((p-n)*v+h,k)),w+1<z&&(k=Math.max((z-w)*v+h,k)),J=k.toString()+"px"),m="1px"!==J);if(a.Ap&&l===a.ke&&m===a.Se)return d===a.wa&&e===a.va||a.Wc(),!1;l!==a.ke&&("1px"===L?a.va=a.va+a.mb:a.va=Math.max(a.va-a.mb,1),g=!0);a.ke=l;a.Bp.style.width=L;m!==a.Se&&("1px"===J?a.wa=a.wa+a.mb:a.wa=Math.max(a.wa-a.mb,1),g=!0,a.ol&&(k=I.alloc(),m?(b.style.left=a.mb+"px",a.position=k.h(a.ma.x+a.mb/a.scale,a.ma.y)):(b.style.left="0px",a.position=k.h(a.ma.x-a.mb/a.scale,a.ma.y)),I.free(k)));a.Se=
m;a.Bp.style.height=J;a.Ms=!0;g&&(a.ml=!0);b=a.Ps;k=b.scrollLeft;a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(c+1<y?k=(a.position.x-r)*v:r+1<A?k=b.scrollWidth-b.clientWidth:q>C+1&&(k=a.position.x*v));if(a.ol)switch(a.Js){case "negative":k=-(b.scrollWidth-k-b.clientWidth);break;case "reverse":k=b.scrollWidth-k-b.clientWidth}b.scrollLeft=k;a.hasVerticalScrollbar&&a.allowVerticalScroll&&(w+1<z?b.scrollTop=(a.position.y-u)*v:u+1<G?b.scrollTop=b.scrollHeight-b.clientHeight:p>n+1&&(b.scrollTop=a.position.y*
v));l=a.wa;m=a.va;b.style.width=l+(a.Se?a.mb:0)+"px";b.style.height=m+(a.ke?a.mb:0)+"px";return d!==l||e!==m||a.animationManager.qc?(a.Jq(f,a.viewportBounds,v,g),!1):!0}
t.add=function(a){var b=a.diagram;if(b!==this&&(null!==b&&B("Cannot add part "+a.toString()+" to "+this.toString()+". It is already a part of "+b.toString()),b=this.km(a.layerName),null===b&&(b=this.km("")),null===b&&B('Cannot add a Part when unable find a Layer named "'+a.layerName+'" and there is no default Layer'),a.layer!==b)){var c=b.cj(99999999,a,a.diagram===this);0<=c&&this.$a(we,"parts",b,null,a,null,c);b.isTemporary||this.Na();a.C(1);c=a.layerChanged;null!==c&&c(a,null,b)}};
t.cj=function(a){this.partManager.cj(a);var b=this;Gj(a,function(a){Hj(b,a)});(a instanceof Ke||a instanceof uf&&null!==a.placeholder)&&a.o();null!==a.data&&Gj(a,function(a){Ij(b.partManager,a)});!0!==uj(a)&&!0!==vj(a)||this.od.add(a);Jj(a,!0,this);Kj(a)?(a.actualBounds.v()&&this.M(Ej(a,a.actualBounds)),this.Na()):a.isVisible()&&a.actualBounds.v()&&this.M(Ej(a,a.actualBounds));this.Bb()};
t.Hc=function(a){a.$j();this.partManager.Hc(a);var b=this;null!==a.data&&Gj(a,function(a){Lj(b.partManager,a,b)});this.od.remove(a);Kj(a)?(a.actualBounds.v()&&this.M(Ej(a,a.actualBounds)),this.Na()):a.isVisible()&&a.actualBounds.v()&&this.M(Ej(a,a.actualBounds));this.Bb()};t.remove=function(a){Mj(this,a,!0)};
function Mj(a,b,c){var d=b.layer;null!==d&&d.diagram===a&&(b.isSelected=!1,b.isHighlighted=!1,b.C(2),c&&b.fk(),c=d.Hc(-1,b,!1),0<=c&&a.$a(xe,"parts",d,b,null,c,null),a=b.layerChanged,null!==a&&a(b,d,null))}t.Ut=function(a,b){if(Aa(a))for(var c=a.length,d=0;d<c;d++){var e=a[d];b&&!e.canDelete()||this.remove(e)}else for(c=new F,c.addAll(a),a=c.iterator;a.next();)c=a.value,b&&!c.canDelete()||this.remove(c)};t.ek=function(a,b,c){return this.partManager.ek(a,b,c)};
Q.prototype.moveParts=function(a,b,c,d){void 0===d&&(d=Nj(this));if(null!==this.toolManager){var e=new H;if(null!==a)if(Aa(a))for(var f=0;f<a.length;f++)Oj(this,e,a[f],c,d);else for(a=a.iterator;a.next();)Oj(this,e,a.value,c,d);else{for(a=this.parts;a.next();)Oj(this,e,a.value,c,d);for(a=this.nodes;a.next();)Oj(this,e,a.value,c,d);for(a=this.links;a.next();)Oj(this,e,a.value,c,d)}rf(this,e,b,d,c)}};
function Oj(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=Nj(a)),c instanceof V){b.add(c,a.td(e,c,c.location));if(c instanceof uf&&(null!==c.placeholder||e.dragsMembers))for(f=c.memberParts;f.next();)Oj(a,b,f.value,d,e,e.groupsAlwaysMove);for(f=c.linksConnected;f.next();){var g=f.value;if(!b.contains(g)){var h=g.fromNode,k=g.toNode;null!==h&&b.contains(h)&&null!==k&&b.contains(k)&&Oj(a,b,g,d,e)}}if(e.dragsTree)for(c=c.Hv();c.next();)Oj(a,b,
c.value,d,e)}else if(c instanceof S)for(b.add(c,a.td(e,c)),c=c.labelNodes;c.next();)Oj(a,b,c.value,d,e);else c instanceof Ke||b.add(c,a.td(e,c,c.location))}
function rf(a,b,c,d,e){if(null!==b&&0!==b.count){var f=I.alloc(),g=I.alloc();g.assign(c);isNaN(g.x)&&(g.x=0);isNaN(g.y)&&(g.y=0);(c=a.Tp)||We(a,b);for(var h=Fa(),k=Fa(),l=b.iterator,m=I.alloc();l.next();){var n=l.key,p=l.value;if(n.Wb()){var r=Pj(a,n,b);if(null!==r)h.push(new Qj(n,p,r));else if(!e||n.canMove())r=p.point,f.assign(r),a.computeMove(n,f.add(g),d,m),n.location=m,void 0===p.shifted&&(p.shifted=new I),p.shifted.assign(m.be(r))}else l.key instanceof S&&k.push(l.la)}I.free(m);e=h.length;for(l=
0;l<e;l++)n=h[l],f.assign(n.info.point),void 0===n.Lv.shifted&&(n.Lv.shifted=new I),n.node.location=f.add(n.Lv.shifted);e=I.alloc();l=I.alloc();n=k.length;for(p=0;p<n;p++){var q=k[p];r=q.key;if(r instanceof S)if(r.suspendsRouting){r.lh=null;m=r.fromNode;var u=r.toNode;if(null!==a.draggedLink&&d.dragsLink)if(u=q.value.point,null===r.dragComputation)b.add(r,a.td(d,r,g)),pf(r,g.x-u.x,g.y-u.y);else{q=I.allocAt(0,0);(m=r.i(0))&&m.v()&&q.assign(m);var v=m=I.alloc().assign(q).add(g);d.isGridSnapEnabled&&
(d.isGridSnapRealtime||a.lastInput.up)&&(v=I.alloc(),Eg(a,r,m,v,d));m.assign(r.dragComputation(r,m,v)).be(q);b.add(r,a.td(d,r,m));pf(r,m.x-u.x,m.y-u.y);I.free(q);I.free(m);v!==m&&I.free(v)}else null!==m&&(e.assign(m.location),v=b.H(m),null!==v&&e.be(v.point)),null!==u&&(l.assign(u.location),v=b.H(u),null!==v&&l.be(v.point)),null!==m&&null!==u?e.Ma(l)?(m=q.value.point,u=f,u.assign(e),u.be(m),b.add(r,a.td(d,r,e)),pf(r,u.x,u.y)):(r.suspendsRouting=!1,r.Ta()):(q=q.value.point,m=null!==m?e:null!==u?l:
g,b.add(r,a.td(d,r,m)),pf(r,m.x-q.x,m.y-q.y))}else if(null===r.fromNode||null===r.toNode)m=q.value.point,b.add(r,a.td(d,r,g)),pf(r,g.x-m.x,g.y-m.y)}I.free(f);I.free(g);I.free(e);I.free(l);Ha(h);Ha(k);c||(Vi(a),ef(a,b))}}
Q.prototype.computeMove=function(a,b,c,d){void 0===d&&(d=new I);d.assign(b);if(null===a)return d;var e=b,f=c.isGridSnapEnabled;f&&(c.isGridSnapRealtime||this.lastInput.up)&&(e=I.alloc(),Eg(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&&I.free(e);return d};function Nj(a){var b=a.toolManager.findTool("Dragging");return null!==b?b.dragOptions:a.Sk}
function Eg(a,b,c,d,e){void 0===e&&(e=Nj(a));d.assign(c);if(null!==b){var f=a.grid;b=e.gridSnapCellSize;a=b.width;b=b.height;var g=e.gridSnapOrigin,h=g.x;g=g.y;e=e.gridSnapCellSpot;if(null!==f){var k=f.gridCellSize;isNaN(a)&&(a=k.width);isNaN(b)&&(b=k.height);f=f.gridOrigin;isNaN(h)&&(h=f.x);isNaN(g)&&(g=f.y)}f=I.allocAt(0,0);f.zk(0,0,a,b,e);K.sq(c.x,c.y,h+f.x,g+f.y,a,b,d);I.free(f)}}function We(a,b){if(null!==b)for(a.Tp=!0,a=b.iterator;a.next();)b=a.key,b instanceof S&&(b.suspendsRouting=!0)}
function ef(a,b){if(null!==b){for(b=b.iterator;b.next();){var c=b.key;c instanceof S&&(c.suspendsRouting=!1,Rj(c)&&c.Ta())}a.Tp=!1}}function Pj(a,b,c){b=b.containingGroup;if(null!==b){a=Pj(a,b,c);if(null!==a)return a;a=c.H(b);if(null!==a)return a}return null}t=Q.prototype;t.td=function(a,b,c){if(void 0===c)return new cf(Gb);var d=a.isGridSnapEnabled;a.groupsSnapMembers||null===b.containingGroup||(d=!1);return d?new cf(new I(Math.round(c.x),Math.round(c.y))):new cf(c.copy())};
function Sj(a,b,c){null!==b.diagram&&b.diagram!==a&&B("Cannot share a Layer with another Diagram: "+b+" of "+b.diagram);null===c?null!==b.diagram&&B("Cannot add an existing Layer to this Diagram again: "+b):(c.diagram!==a&&B("Existing Layer must be in this Diagram: "+c+" not in "+c.diagram),b===c&&B("Cannot move a Layer before or after itself: "+b));if(b.diagram!==a){b=b.name;a=a.Ka;c=a.count;for(var d=0;d<c;d++)a.L(d).name===b&&B("Cannot add Layer with the name '"+b+"'; a Layer with the same name is already present in this Diagram.")}}
t.bm=function(a){Sj(this,a,null);a.$d(this);var b=this.Ka,c=b.count-1;if(!a.isTemporary)for(;0<=c&&b.L(c).isTemporary;)c--;b.ub(c+1,a);null!==this.ac&&this.$a(we,"layers",this,null,a,null,c+1);this.M();this.Na()};t.Fx=function(a,b){Sj(this,a,b);a.$d(this);var c=this.Ka,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.ac&&this.$a(xe,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.L(f)===b){c.ub(f,a);break}null!==this.ac&&this.$a(we,"layers",this,null,a,null,f);this.M();0>d&&this.Na()};
t.Ry=function(a,b){Sj(this,a,b);a.$d(this);var c=this.Ka,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.ac&&this.$a(xe,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.L(f)===b){c.ub(f+1,a);break}null!==this.ac&&this.$a(we,"layers",this,null,a,null,f+1);this.M();0>d&&this.Na()};
t.sA=function(a){a.diagram!==this&&B("Cannot remove a Layer from another Diagram: "+a+" of "+a.diagram);if(""!==a.name){var b=this.Ka,c=b.indexOf(a);if(b.remove(a)){for(b=a.Ca.copy().iterator;b.next();){var d=b.value,e=d.layerName;e!==a.name?d.layerName=e:d.layerName=""}null!==this.ac&&this.$a(xe,"layers",this,a,null,c,null);this.M();this.Na()}}};t.km=function(a){for(var b=this.layers;b.next();){var c=b.value;if(c.name===a)return c}return null};
t.Hx=function(a){null===this.re&&(this.re=new E);this.re.add(a);this.model.Ah(a)};t.uA=function(a){null!==this.re&&(this.re.remove(a),0===this.re.count&&(this.re=null));this.model.yk(a)};t.Ah=function(a){null===this.Jf&&(this.Jf=new E);this.Jf.add(a)};t.yk=function(a){null!==this.Jf&&(this.Jf.remove(a),0===this.Jf.count&&(this.Jf=null))};
t.mt=function(a){this.skipsUndoManager||this.model.skipsUndoManager||this.model.undoManager.Mv(a);a.change!==ve&&(this.isModified=!0);if(null!==this.Jf)for(var b=this.Jf,c=b.length,d=0;d<c;d++)b.L(d)(a)};t.$a=function(a,b,c,d,e,f,g){void 0===f&&(f=null);void 0===g&&(g=null);var h=new te;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.mt(h)};t.g=function(a,b,c,d,e){this.$a(ue,a,this,b,c,d,e)};
Q.prototype.changeState=function(a,b){if(null!==a&&a.diagram===this){var c=this.skipsModelSourceBindings;try{this.skipsModelSourceBindings=!0;var d=a.change;if(d===ue){var e=a.object;Tj(e,a.propertyName,a.H(b));if(e instanceof Y){var f=e.part;null!==f&&f.Mb()}this.isModified=!0}else if(d===we){var g=a.object,h=a.newParam,k=a.newValue;if(g instanceof X)if("number"===typeof h&&k instanceof Y){b?g.Hc(h):g.ub(h,k);var l=g.part;null!==l&&l.Mb()}else{if("number"===typeof h&&k instanceof Uj)if(b)k.isRow?
g.hw(h):g.fw(h);else{var m=k.isRow?g.getRowDefinition(k.index):g.getColumnDefinition(k.index);m.pt(k)}}else if(g instanceof hi){var n=!0===a.oldParam;"number"===typeof h&&k instanceof T&&(b?(k.isSelected=!1,k.isHighlighted=!1,k.Mb(),g.Hc(n?h:-1,k,n)):g.cj(h,k,n))}else g instanceof Q?"number"===typeof h&&k instanceof hi&&(b?this.Ka.ab(h):(k.$d(this),this.Ka.ub(h,k))):B("unknown ChangedEvent.Insert object: "+a.toString());this.isModified=!0}else if(d===xe){var p=a.object,r=a.oldParam,q=a.oldValue;if(p instanceof
X)"number"===typeof r&&q instanceof Y?b?p.ub(r,q):p.Hc(r):"number"===typeof r&&q instanceof Uj&&(b?(m=q.isRow?p.getRowDefinition(q.index):p.getColumnDefinition(q.index),m.pt(q)):q.isRow?p.hw(r):p.fw(r));else if(p instanceof hi){var u=!0===a.newParam;"number"===typeof r&&q instanceof T&&(b?0>p.Ca.indexOf(q)&&p.cj(r,q,u):(q.isSelected=!1,q.isHighlighted=!1,q.Mb(),p.Hc(u?r:-1,q,u)))}else p instanceof Q?"number"===typeof r&&q instanceof hi&&(b?(q.$d(this),this.Ka.ub(r,q)):this.Ka.ab(r)):B("unknown ChangedEvent.Remove object: "+
a.toString());this.isModified=!0}else d!==ve&&B("unknown ChangedEvent: "+a.toString())}finally{this.skipsModelSourceBindings=c}}};Q.prototype.ua=function(a){return this.undoManager.ua(a)};Q.prototype.Va=function(a){return this.undoManager.Va(a)};Q.prototype.Bf=function(){return this.undoManager.Bf()};
Q.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.ua(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.Va(b):this.undoManager.Bf(),this.skipsUndoManager=c}};Q.prototype.updateAllTargetBindings=function(a){this.partManager.updateAllTargetBindings(a)};Q.prototype.Yq=function(){this.partManager.Yq()};
function Vj(a,b,c){var d=a.animationManager;if(a.Rb||a.Cc)a.ya=c,d.Ze&&d.Dd.add(d.B,"scale",b,a.ya);else if(null===a.sa)a.ya=c;else{a.Rb=!0;var e=a.viewportBounds.copy(),f=a.wa,g=a.va;e.width=a.wa/b;e.height=a.va/b;var h=a.zoomPoint.x,k=a.zoomPoint.y,l=a.contentAlignment;isNaN(h)&&(l.gd()?l.xf(Ic)?h=0:l.xf(Jc)&&(h=f-1):h=l.hb()?l.x*(f-1):f/2);isNaN(k)&&(l.gd()?l.xf(Hc)?k=0:l.xf(Kc)&&(k=g-1):k=l.hb()?l.y*(g-1):g/2);null===a.scaleComputation||a.animationManager.isAnimating||(c=a.scaleComputation(a,
c));c<a.minScale&&(c=a.minScale);c>a.maxScale&&(c=a.maxScale);f=I.allocAt(a.ma.x+h/b-h/c,a.ma.y+k/b-k/c);a.position=f;I.free(f);a.ya=c;a.Jq(e,a.viewportBounds,b,!1);a.Rb=!1;Xi(a,!1);d.Ze&&d.Dd.add(d.B,"scale",b,a.ya);a.M();$i(a)}}
Q.prototype.Jq=function(a,b,c,d){if(!a.w(b)){void 0===d&&(d=!1);d||$i(this);Ui(this);var e=this.layout;null===e||!e.isViewportSized||this.autoScale!==Hh||d||a.width===b.width&&a.height===b.height||e.C();e=this.currentTool;!0===this.Vf&&e instanceof Oa&&(this.lastInput.documentPoint=this.au(this.lastInput.viewPoint),Oe(e,this));this.Rb||this.jy(a,b);pj(this);this.Td.scale=c;this.Td.position.x=a.x;this.Td.position.y=a.y;this.Td.bounds.assign(a);this.Td.Tv=d;this.R("ViewportBoundsChanged",this.Td,a);
this.isVirtualized&&this.links.each(function(a){a.isAvoiding&&a.actualBounds.Ic(b)&&a.Ta()})}};
function pj(a,b){void 0===b&&(b=null);var c=a.Hb;if(null!==c&&c.visible){for(var d=M.alloc(),e=1,f=1,g=c.W.j,h=g.length,k=0;k<h;k++){var l=g[k],m=l.interval;2>m||(Wj(l.figure)?f=f*m/K.Yx(f,m):e=e*m/K.Yx(e,m))}g=c.gridCellSize;d.h(f*g.width,e*g.height);if(null!==b)e=b.width,f=b.height,a=b.x,g=b.y;else{b=N.alloc();a=a.viewportBounds;b.h(a.x,a.y,a.width,a.height);if(!b.v()){N.free(b);return}e=b.width;f=b.height;a=b.x;g=b.y;N.free(b)}c.width=e+2*d.width;c.height=f+2*d.height;b=I.alloc();K.sq(a,g,0,0,
d.width,d.height,b);b.offset(-d.width,-d.height);M.free(d);c.part.location=b;I.free(b)}}Q.prototype.clearSelection=function(a){void 0===a&&(a=!1);var b=this.selection;if(0!==b.count){a||this.R("ChangingSelection",b);for(var c=b.na(),d=c.length,e=0;e<d;e++)c[e].isSelected=!1;b.ea();b.clear();b.freeze();a||this.R("ChangedSelection",b)}};
Q.prototype.select=function(a){null!==a&&a.layer.diagram===this&&(!a.isSelected||1<this.selection.count)&&(this.R("ChangingSelection",this.selection),this.clearSelection(!0),a.isSelected=!0,this.R("ChangedSelection",this.selection))};
Q.prototype.yA=function(a){this.R("ChangingSelection",this.selection);this.clearSelection(!0);if(Aa(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];d instanceof T||B("Diagram.selectCollection given something that is not a Part: "+d);d.isSelected=!0}else for(a=a.iterator;a.next();)b=a.value,b instanceof T||B("Diagram.selectCollection given something that is not a Part: "+b),b.isSelected=!0;this.R("ChangedSelection",this.selection)};
Q.prototype.clearHighlighteds=function(){var a=this.highlighteds;if(0<a.count){for(var b=a.na(),c=b.length,d=0;d<c;d++)b[d].isHighlighted=!1;a.ea();a.clear();a.freeze()}};t=Q.prototype;t.Uz=function(a){null!==a&&a.layer.diagram===this&&(!a.isHighlighted||1<this.highlighteds.count)&&(this.clearHighlighteds(),a.isHighlighted=!0)};
t.Vz=function(a){a=(new F).addAll(a);for(var b=this.highlighteds.copy().Nq(a).iterator;b.next();)b.value.isHighlighted=!1;for(a=a.iterator;a.next();)b=a.value,b instanceof T||B("Diagram.highlightCollection given something that is not a Part: "+b),b.isHighlighted=!0};
t.scroll=function(a,b,c){void 0===c&&(c=1);var d="up"===b||"down"===b,e=0;if("pixel"===a)e=c;else if("line"===a)e=c*(d?this.scrollVerticalLineChange:this.scrollHorizontalLineChange);else if("page"===a)a=d?this.viewportBounds.height:this.viewportBounds.width,a*=this.scale,0!==a&&(e=c*Math.max(a-(d?this.scrollVerticalLineChange:this.scrollHorizontalLineChange),0));else{if("document"===a){e=this.documentBounds;c=this.viewportBounds;d=I.alloc();"up"===b?this.position=d.h(c.x,e.y):"left"===b?this.position=
d.h(e.x,c.y):"down"===b?this.position=d.h(c.x,e.bottom-c.height):"right"===b&&(this.position=d.h(e.right-c.width,c.y));I.free(d);return}B("scrolling unit must be 'pixel', 'line', 'page', or 'document', not: "+a)}e/=this.scale;c=this.position.copy();"up"===b?c.y=this.position.y-e:"down"===b?c.y=this.position.y+e:"left"===b?c.x=this.position.x-e:"right"===b?c.x=this.position.x+e:B("scrolling direction must be 'up', 'down', 'left', or 'right', not: "+b);this.position=c};
t.mw=function(a){var b=this.viewportBounds;b.Ce(a)||(a=a.center,a.x-=b.width/2,a.y-=b.height/2,this.position=a)};t.nt=function(a){var b=this.viewportBounds;a=a.center;a.x-=b.width/2;a.y-=b.height/2;this.position=a};t.Wq=function(a){var b=this.nb;b.reset();1!==this.ya&&b.scale(this.ya);var c=this.ma;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return a.copy().transform(this.nb)};
t.HA=function(a){var b=this.nb,c=a.x,d=a.y,e=c+a.width,f=d+a.height,g=b.m11,h=b.m12,k=b.m21,l=b.m22,m=b.dx,n=b.dy,p=c*g+d*k+m;b=c*h+d*l+n;var r=e*g+d*k+m;a=e*h+d*l+n;d=c*g+f*k+m;c=c*h+f*l+n;g=e*g+f*k+m;e=e*h+f*l+n;f=Math.min(p,r);p=Math.max(p,r);r=Math.min(b,a);b=Math.max(b,a);f=Math.min(f,d);p=Math.max(p,d);r=Math.min(r,c);b=Math.max(b,c);f=Math.min(f,g);p=Math.max(p,g);r=Math.min(r,e);b=Math.max(b,e);return new N(f,r,p-f,b-r)};
t.au=function(a){var b=this.nb;b.reset();1!==this.ya&&b.scale(this.ya);var c=this.ma;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return Ab(a.copy(),this.nb)};function Xj(a){var b=a.isModified;a.lv!==b&&(a.lv=b,a.R("Modified"))}function hk(a){a=si.get(a);return null!==a?new a:new ti}
Q.prototype.doModelChanged=function(a){var b=this;if(a.model===this.model){var c=a.change,d=a.propertyName;if(c===ve&&"S"===d[0])if("StartingFirstTransaction"===d){var e=this;a=this.toolManager;a.mouseDownTools.each(function(a){a.diagram=e});a.mouseMoveTools.each(function(a){a.diagram=e});a.mouseUpTools.each(function(a){a.diagram=e});this.Cc||this.le||(this.sj=!0,this.vj&&(this.ze=!0))}else"StartingUndo"===d||"StartingRedo"===d?(a=this.animationManager,a.defaultAnimation.isAnimating&&!this.skipsUndoManager&&
a.Xc(),this.R("ChangingSelection",this.selection)):"StartedTransaction"===d&&(a=this.animationManager,a.defaultAnimation.isAnimating&&!this.skipsUndoManager&&a.Xc());else if(this.Z){this.Z=!1;try{if(""===a.modelChange&&c===ve){if("FinishedUndo"===d||"FinishedRedo"===d)this.R("ChangedSelection",this.selection),Vi(this);var f=this.animationManager;"RolledBackTransaction"===d&&f.Xc();this.sj=!0;this.Wc();0!==this.undoManager.transactionLevel&&1!==this.undoManager.transactionLevel||Dh(f);"CommittedTransaction"===
d&&this.undoManager.isJustDiscarded&&(this.Kd=Math.min(this.Kd,this.undoManager.historyIndex-1));"CommittedTransaction"!==d&&"RolledBackTransaction"!==d||!this.undoManager.isPendingUnmodified||setTimeout(function(){b.isModified=!1},1);var g=a.isTransactionFinished;g&&(Xj(this),this.Jt.clear(),Ph(this.animationManager));if(!this.ss&&g&&this.lastInput.targetDiagram){this.ss=!0;var h=this;sa(function(){h.currentTool.standardMouseOver();h.ss=!1},10)}}}finally{this.Z=!0}}}};
function Hj(a,b){b=b.W.j;for(var c=b.length,d=0;d<c;d++)lk(a,b[d])}function lk(a,b){if(b instanceof mk){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){var d=b.Sg;null!==d&&(d.cl instanceof Event&&null!==b.Ac&&b.Ac(b,d.cl),!0===d.Zr&&(null!==b.kf&&b.kf(b,d.av),null!==b.diagram&&b.diagram.Cs.add(b)));c=c.getAttribute("src");d=a.Gi.H(c);if(null===d)d=[],d.push(b),a.Gi.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}}
function nk(a,b){if(b instanceof mk){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){c=c.getAttribute("src");var d=a.Gi.H(c);if(null!==d)for(var e=0;e<d.length;e++)if(d[e]===b){d.splice(e,1);0===d.length&&(a.Gi.remove(c),ok(c));break}}}}Q.prototype.Ad=function(){this.partManager.Ad()};Q.prototype.Wj=function(a,b){this.Lc.Wj(a,b)};Q.prototype.Yj=function(a,b){this.Lc.Yj(a,b)};Q.prototype.findPartForKey=function(a){return this.partManager.findPartForKey(a)};Q.prototype.Lb=function(a){return this.partManager.Lb(a)};
Q.prototype.findLinkForKey=function(a){return this.partManager.findLinkForKey(a)};t=Q.prototype;t.xc=function(a){return this.partManager.xc(a)};t.Wi=function(a){return this.partManager.Wi(a)};t.wc=function(a){return this.partManager.wc(a)};t.vt=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.vt.apply(this.partManager,b instanceof Array?b:da(ba(b)))};
t.ut=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.ut.apply(this.partManager,b instanceof Array?b:da(ba(b)))};function Cj(a,b){a.mi=!1;var c=a.Dn;c.w(b)||(b=b.G(),a.Dn=b,Xi(a,!1),a.R("DocumentBoundsChanged",null,c.copy()),$i(a))}function Li(a){a.mi&&Cj(a,a.computeBounds())}t.Ez=function(){for(var a=new F,b=this.nodes;b.next();){var c=b.value;c.isTopLevel&&a.add(c)}for(b=this.links;b.next();)c=b.value,c.isTopLevel&&a.add(c);return a.iterator};t.Dz=function(){return this.wh.iterator};
t.fA=function(a){Vi(this);a&&pk(this,!0);this.sj=!0;If(this)};function pk(a,b){for(var c=a.wh.iterator;c.next();)qk(a,c.value,b);null!==a.layout&&(b?a.layout.isValidLayout=!1:a.layout.C())}function qk(a,b,c){if(null!==b){for(var d=b.Al.iterator;d.next();)qk(a,d.value,c);null!==b.layout&&(c?b.layout.isValidLayout=!1:b.layout.C())}}
function qj(a,b){if(a.Hg&&!a.Cr){var c=a.Z;a.Z=!0;var d=a.undoManager.transactionLevel,e=a.layout,f=a.animationManager;try{0===d&&(a.undoManager.isInternalTransaction=!0,a.ua("Layout"));1>=d&&!f.isAnimating&&!f.qc&&(b||Bh(f,"Layout"));a.Hg=!1;for(var g=a.wh.iterator;g.next();)rk(a,g.value,b,d);e.isValidLayout||(!b||e.isRealtime||null===e.isRealtime||0===d?(e.doLayout(a),Vi(a),e.isValidLayout=!0):a.Hg=!0)}finally{b=a.undoManager.isInternalTransaction,0===d&&(a.Va("Layout"),a.undoManager.isInternalTransaction=
!1),!b||0!==d&&1!==d||Dh(f),a.Z=c}}}function rk(a,b,c,d){if(null!==b){for(var e=b.Al.iterator;e.next();)rk(a,e.value,c,d);e=b.layout;null===e||e.isValidLayout||(!c||e.isRealtime||0===d?(b.wk=!b.location.v(),e.doLayout(b),b.C(32),sj(a,b),e.isValidLayout=!0):a.Hg=!0)}}t.Kz=function(){for(var a=new E,b=this.nodes;b.next();){var c=b.value;c.isTopLevel&&null===c.Zi()&&a.add(c)}return a.iterator};
function qi(a){function b(a){var b=a.toLowerCase(),e=new E;c.add(a,e);c.add(b,e);d.add(a,a);d.add(b,a)}var c=new H,d=new H;b("InitialAnimationStarting");b("AnimationStarting");b("AnimationFinished");b("BackgroundSingleClicked");b("BackgroundDoubleClicked");b("BackgroundContextClicked");b("ClipboardChanged");b("ClipboardPasted");b("DocumentBoundsChanged");b("ExternalObjectsDropped");b("GainedFocus");b("InitialLayoutCompleted");b("LayoutCompleted");b("LinkDrawn");b("LinkRelinked");b("LinkReshaped");
b("LostFocus");b("Modified");b("ObjectSingleClicked");b("ObjectDoubleClicked");b("ObjectContextClicked");b("PartCreated");b("PartResized");b("PartRotated");b("SelectionMoved");b("SelectionCopied");b("SelectionDeleting");b("SelectionDeleted");b("SelectionGrouped");b("SelectionUngrouped");b("ChangingSelection");b("ChangedSelection");b("SubGraphCollapsed");b("SubGraphExpanded");b("TextEdited");b("TreeCollapsed");b("TreeExpanded");b("ViewportBoundsChanged");b("InvalidateDraw");a.Fr=c;a.Er=d}
function Bj(a,b){var c=a.Er.H(b);return null!==c?c:a.Er.H(b.toLowerCase())}function sk(a,b){var c=a.Fr.H(b);if(null!==c)return c;c=a.Fr.H(b.toLowerCase());if(null!==c)return c;B("Unknown DiagramEvent name: "+b)}t.Xj=function(a,b){a=sk(this,a);null!==a&&a.add(b)};t.zm=function(a,b){a=sk(this,a);null!==a&&a.remove(b)};
t.R=function(a,b,c){var d=sk(this,a),e=new se;e.diagram=this;a=Bj(this,a);null!==a&&(e.name=a);void 0!==b&&(e.subject=b);void 0!==c&&(e.parameter=c);b=d.length;if(1===b)d.L(0)(e);else if(0!==b)for(d=d.na(),c=0;c<b;c++)(0,d[c])(e)};function tk(a){if(a.animationManager.isTicking)return!1;var b=a.currentTool;return b===a.toolManager.findTool("Dragging")?!a.Tp||b.isComplexRoutingRealtime:!0}t.nk=function(a,b){void 0===b&&(b=null);return uk(this,!1,null,b).nk(a.x,a.y,a.width,a.height)};
Q.prototype.computeOccupiedArea=function(){return this.isVirtualized?this.viewportBounds.copy():this.mi?Wi(this):this.documentBounds.copy()};
function uk(a,b,c,d){null===a.Ib&&(a.Ib=new vk);if(a.Ib.Dt||a.Ib.group!==c||a.Ib.Ay!==d){if(null===c){b=a.computeOccupiedArea();b.Fc(100,100);a.Ib.initialize(b);b=N.alloc();for(var e=a.nodes;e.next();){var f=e.value,g=f.layer;null!==g&&g.visible&&!g.isTemporary&&wk(a,f,d,b)}N.free(b)}else{0<c.memberParts.count&&(b=a.computePartsBounds(c.memberParts,!1),b.Fc(20,20),a.Ib.initialize(b));b=N.alloc();for(e=c.memberParts;e.next();)f=e.value,f instanceof V&&wk(a,f,d,b);N.free(b)}a.Ib.group=c;a.Ib.Ay=d;a.Ib.Dt=
!1}else b&&xk(a.Ib);return a.Ib}function wk(a,b,c,d){if(b!==c)if(b.isVisible()&&b.avoidable&&!b.isLinkLabel){var e=b.getAvoidableRect(d),f=a.Ib.fm;c=a.Ib.em;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)yk(a.Ib,g,h);yk(a.Ib,g,b)}for(e=e.y;e<b;e+=c)yk(a.Ib,d,e);yk(a.Ib,d,b)}else if(b instanceof uf)for(b=b.memberParts;b.next();)e=b.value,e instanceof V&&wk(a,e,c,d)}
function zk(a,b){null!==a.Ib&&!a.Ib.Dt&&(void 0===b&&(b=null),null===b||b.avoidable&&!b.isLinkLabel)&&(a.Ib.Dt=!0)}Q.prototype.rt=function(a){this.dn.assign(a);this.computeAutoScrollPosition(this.dn).Ma(this.position)?this.Cf():Ak(this)};
function Ak(a){-1===a.mj&&(a.mj=sa(function(){if(-1!==a.mj&&(a.Cf(),null!==a.lastInput.event)){var b=a.computeAutoScrollPosition(a.dn);b.Ma(a.position)||(a.position=b,a.lastInput.documentPoint=a.au(a.dn),a.doMouseMove(),a.mi=!0,Cj(a,a.documentBounds.copy().Jc(a.computeBounds())),a.Bc=!0,a.Wc(),Ak(a))}},a.cn))}Q.prototype.Cf=function(){-1!==this.mj&&(x.clearTimeout(this.mj),this.mj=-1)};
Q.prototype.computeAutoScrollPosition=function(a){var b=this.position,c=this.en;if(0>=c.top&&0>=c.left&&0>=c.right&&0>=c.bottom)return b;var d=this.viewportBounds,e=this.scale;d=N.allocAt(0,0,d.width*e,d.height*e);var f=I.allocAt(0,0);if(a.x>=d.x&&a.x<d.x+c.left){var g=Math.max(this.scrollHorizontalLineChange,1);g|=0;f.x-=g;a.x<d.x+c.left/2&&(f.x-=g);a.x<d.x+c.left/4&&(f.x-=4*g)}else a.x<=d.x+d.width&&a.x>d.x+d.width-c.right&&(g=Math.max(this.scrollHorizontalLineChange,1),g|=0,f.x+=g,a.x>d.x+d.width-
c.right/2&&(f.x+=g),a.x>d.x+d.width-c.right/4&&(f.x+=4*g));a.y>=d.y&&a.y<d.y+c.top?(g=Math.max(this.scrollVerticalLineChange,1),g|=0,f.y-=g,a.y<d.y+c.top/2&&(f.y-=g),a.y<d.y+c.top/4&&(f.y-=4*g)):a.y<=d.y+d.height&&a.y>d.y+d.height-c.bottom&&(g=Math.max(this.scrollVerticalLineChange,1),g|=0,f.y+=g,a.y>d.y+d.height-c.bottom/2&&(f.y+=g),a.y>d.y+d.height-c.bottom/4&&(f.y+=4*g));f.Ma(Gb)||(b=new I(b.x+f.x/e,b.y+f.y/e));N.free(d);I.free(f);return b};t=Q.prototype;t.Lt=function(){return null};t.Uv=function(){return null};
t.Vy=function(a,b){this.ux.add(a,b)};function Bk(a,b,c){function d(){var a=+new Date;f=!0;for(g.reset();g.next();)if(!g.value[0].wl){f=!1;break}f||a-l>k?b(c,e,h):x.requestAnimationFrame(d)}for(var e=c.callback,f=!0,g=a.Gi.iterator;g.next();)if(!g.value[0].wl){f=!1;break}if("function"!==typeof e||f)return b(c,e,a);var h=a,k=c.callbackTimeout||300,l=+new Date;x.requestAnimationFrame(function(){d()});return null}t.hA=function(a){if(!Sg)return null;void 0===a&&(a=new db);a.returnType="Image";return this.ly(a)};
t.ly=function(a){void 0===a&&(a=new db);return Bk(this,this.iA,a)};
t.iA=function(a,b,c){var d=Ck(c,a,"canvas",null);if(null===d)return null;c=d.Y.canvas;var e=null;if(null!==c)switch(e=a.returnType,void 0===e?e="string":e=e.toLowerCase(),e){case "imagedata":e=d.getImageData(0,0,c.width,c.height);break;case "image":d=(a.document||document).createElement("img");d.src=c.toDataURL(a.type,a.details);e=d;break;case "blob":"function"!==typeof b&&B('Error: Diagram.makeImageData called with "returnType: toBlob", but no required "callback" function property defined.');if("function"===
typeof c.toBlob)return c.toBlob(b,a.type,a.details),"toBlob";if("function"===typeof c.msToBlob)return b(c.msToBlob()),"msToBlob";b(null);return null;default:e=c.toDataURL(a.type,a.details)}return"function"===typeof b?(b(e),null):e};
function Ck(a,b,c,d){a.animationManager.Xc();a.Wc();if(null===a.sa)return null;"object"!==typeof b&&B("properties argument must be an Object.");var e=b.size||null,f=b.scale||null;void 0!==b.scale&&isNaN(b.scale)&&(f="NaN");var g=b.maxSize;void 0===b.maxSize&&(g="SVG"===c?new M(Infinity,Infinity):new M(2E3,2E3));var h=b.position||null,k=b.parts||null,l=void 0===b.padding?1:b.padding,m=b.background||null,n=b.omitTemporary;void 0===n&&(n=!0);var p=b.document||document,r=b.elementFinished||null,q=b.showTemporary;
void 0===q&&(q=!n);b=b.showGrid;void 0===b&&(b=q);null!==e&&isNaN(e.width)&&isNaN(e.height)&&(e=null);"number"===typeof l?l=new oc(l):l instanceof oc||B("MakeImage padding must be a Margin or a number.");l.left=Math.max(l.left,0);l.right=Math.max(l.right,0);l.top=Math.max(l.top,0);l.bottom=Math.max(l.bottom,0);a.Fb.sc(!0);n=new Dk(null,p);var u=n.context;if(!(e||f||k||h)){n.width=a.wa+Math.ceil(l.left+l.right);n.height=a.va+Math.ceil(l.top+l.bottom);if("SVG"===c){if(null===d)return null;d.resize(n.width,
n.height,n.width,n.height);d.ownerDocument=p;d.pq=r;zj(a,d.context,l,new M(n.width,n.height),a.ya,a.ma,k,m,q,b);return d.context}a.Zk=!1;zj(a,u,l,new M(n.width,n.height),a.ya,a.ma,k,m,q,b);a.Zk=!0;return n.context}var v=a.Cn,w=a.documentBounds.copy();w.vw(a.fb);if(q)for(var y=a.Ka.j,z=y.length,A=0;A<z;A++){var C=y[A];if(C.visible&&C.isTemporary){C=C.Ca.j;for(var G=C.length,L=0;L<G;L++){var J=C[L];J.isInDocumentBounds&&J.isVisible()&&(J=J.actualBounds,J.v()&&w.Jc(J))}}}y=new I(w.x,w.y);if(null!==k){z=
!0;A=k.iterator;for(A.reset();A.next();)if(C=A.value,C instanceof T&&(G=C.layer,(null===G||G.visible)&&(null===G||q||!G.isTemporary)&&C.isVisible()&&(C=C.actualBounds,C.v())))if(z){z=!1;var U=C.copy()}else U.Jc(C);z&&(U=new N(0,0,0,0));w.width=U.width;w.height=U.height;y.x=U.x;y.y=U.y}null!==h&&h.v()&&(y=h,f||(f=v));U=h=0;null!==l&&(h=l.left+l.right,U=l.top+l.bottom);z=A=0;null!==e&&(A=e.width,z=e.height,isFinite(A)&&(A=Math.max(0,A-h)),isFinite(z)&&(z=Math.max(0,z-U)));null!==e&&null!==f?("NaN"===
f&&(f=v),e.v()?(e=A,w=z):isNaN(z)?(e=A,w=w.height*f):(e=w.width*f,w=z)):null!==e?e.v()?(f=Math.min(A/w.width,z/w.height),e=A,w=z):isNaN(z)?(f=A/w.width,e=A,w=w.height*f):(f=z/w.height,e=w.width*f,w=z):null!==f?"NaN"===f&&g.v()?(f=Math.min((g.width-h)/w.width,(g.height-U)/w.height),f>v?(f=v,e=w.width,w=w.height):(e=g.width,w=g.height)):(e=w.width*f,w=w.height*f):(f=v,e=w.width,w=w.height);null!==l?(e+=h,w+=U):l=new oc(0);null!==g&&(v=g.width,g=g.height,isNaN(v)&&(v=2E3),isNaN(g)&&(g=2E3),isFinite(v)&&
(e=Math.min(e,v)),isFinite(g)&&(w=Math.min(w,g)));n.width=Math.ceil(e);n.height=Math.ceil(w);if("SVG"===c){if(null===d)return null;d.resize(n.width,n.height,n.width,n.height);d.ownerDocument=p;d.pq=r;zj(a,d.context,l,new M(Math.ceil(e),Math.ceil(w)),f,y,k,m,q,b);return d.context}a.Zk=!1;zj(a,u,l,new M(Math.ceil(e),Math.ceil(w)),f,y,k,m,q,b);a.Zk=!0;return n.context}
ma.Object.defineProperties(Q.prototype,{div:{get:function(){return this.Da},set:function(a){if(this.Da!==a){Qa=[];var b=this.Da;null!==b?(b.B=void 0,b.goDiagram=void 0,b.innerHTML="",null!==this.sa&&(b=this.sa.Fa,this.removeEventListener(b,"touchstart",this.Aw,!1),this.removeEventListener(b,"touchmove",this.zw,!1),this.removeEventListener(b,"touchend",this.yw,!1),this.sa.Qx()),this.Gl&&(this.Gl.disconnect(),this.Gl=null),b=this.toolManager,null!==b&&(b.mouseDownTools.each(function(a){a.cancelWaitAfter()}),
b.mouseMoveTools.each(function(a){a.cancelWaitAfter()}),b.mouseUpTools.each(function(a){a.cancelWaitAfter()})),b.cancelWaitAfter(),this.currentTool.doCancel(),this.Fb=this.sa=null,this.removeEventListener(x,"resize",this.Gw,!1),this.removeEventListener(x,"mousemove",this.sk,!0),this.removeEventListener(x,"mousedown",this.rk,!0),this.removeEventListener(x,"mouseup",this.uk,!0),this.removeEventListener(x,"wheel",this.vk,!0),this.removeEventListener(x,"mouseout",this.tk,!0),Ce===this&&(Ce=null)):this.le=
!1;this.Da=null;if(null!==a){if(b=a.B)b.div=null;Hi(this,a);this.Zd()}}}},Jx:{get:function(){return this.No}},mk:{get:function(){return this.le}},draggedLink:{get:function(){return this.Hr},set:function(a){this.Hr!==a&&(this.Hr=a,null!==a&&(this.ws=a.fromPort,this.xs=a.toPort))}},oy:{get:function(){return this.ws},set:function(a){this.ws=a}},py:{get:function(){return this.xs},
set:function(a){this.xs=a}},animationManager:{get:function(){return this.Lc}},undoManager:{get:function(){return this.ac.undoManager}},skipsUndoManager:{get:function(){return this.pg},set:function(a){this.pg=a;this.ac.skipsUndoManager=a}},delaysLayout:{get:function(){return this.Cr},set:function(a){this.Cr=a}},opacity:{get:function(){return this.rb},
set:function(a){var b=this.rb;b!==a&&((0>a||1<a)&&va(a,"0 <= value <= 1",Q,"opacity"),this.rb=a,this.g("opacity",b,a),this.M())}},validCycle:{get:function(){return this.ht},set:function(a){var b=this.ht;b!==a&&(this.ht=a,this.g("validCycle",b,a))}},layers:{get:function(){return this.Ka.iterator}},isModelReadOnly:{get:function(){var a=this.ac;return null===a?!1:a.isReadOnly},set:function(a){var b=this.ac;null!==
b&&(b.isReadOnly=a)}},isReadOnly:{get:function(){return this.Wf},set:function(a){var b=this.Wf;b!==a&&(this.Wf=a,this.g("isReadOnly",b,a))}},isEnabled:{get:function(){return this.ad},set:function(a){var b=this.ad;b!==a&&(this.ad=a,this.g("isEnabled",b,a))}},allowClipboard:{get:function(){return this.cr},set:function(a){var b=this.cr;b!==a&&(this.cr=a,this.g("allowClipboard",b,a))}},allowCopy:{
get:function(){return this.Th},set:function(a){var b=this.Th;b!==a&&(this.Th=a,this.g("allowCopy",b,a))}},allowDelete:{get:function(){return this.Uh},set:function(a){var b=this.Uh;b!==a&&(this.Uh=a,this.g("allowDelete",b,a))}},allowDragOut:{get:function(){return this.dr},set:function(a){var b=this.dr;b!==a&&(this.dr=a,this.g("allowDragOut",b,a))}},allowDrop:{get:function(){return this.er},set:function(a){var b=
this.er;b!==a&&(this.er=a,this.g("allowDrop",b,a))}},allowTextEdit:{get:function(){return this.ci},set:function(a){var b=this.ci;b!==a&&(this.ci=a,this.g("allowTextEdit",b,a))}},allowGroup:{get:function(){return this.Vh},set:function(a){var b=this.Vh;b!==a&&(this.Vh=a,this.g("allowGroup",b,a))}},allowUngroup:{get:function(){return this.di},set:function(a){var b=this.di;b!==a&&(this.di=a,this.g("allowUngroup",
b,a))}},allowInsert:{get:function(){return this.gr},set:function(a){var b=this.gr;b!==a&&(this.gr=a,this.g("allowInsert",b,a))}},allowLink:{get:function(){return this.Wh},set:function(a){var b=this.Wh;b!==a&&(this.Wh=a,this.g("allowLink",b,a))}},allowRelink:{get:function(){return this.Yh},set:function(a){var b=this.Yh;b!==a&&(this.Yh=a,this.g("allowRelink",b,a))}},allowMove:{get:function(){return this.Xh},
set:function(a){var b=this.Xh;b!==a&&(this.Xh=a,this.g("allowMove",b,a))}},allowReshape:{get:function(){return this.Zh},set:function(a){var b=this.Zh;b!==a&&(this.Zh=a,this.g("allowReshape",b,a))}},allowResize:{get:function(){return this.$h},set:function(a){var b=this.$h;b!==a&&(this.$h=a,this.g("allowResize",b,a))}},allowRotate:{get:function(){return this.ai},set:function(a){var b=this.ai;b!==a&&(this.ai=a,
this.g("allowRotate",b,a))}},allowSelect:{get:function(){return this.bi},set:function(a){var b=this.bi;b!==a&&(this.bi=a,this.g("allowSelect",b,a))}},allowUndo:{get:function(){return this.hr},set:function(a){var b=this.hr;b!==a&&(this.hr=a,this.g("allowUndo",b,a))}},allowZoom:{get:function(){return this.jr},set:function(a){var b=this.jr;b!==a&&(this.jr=a,this.g("allowZoom",b,a))}},hasVerticalScrollbar:{
get:function(){return this.el},set:function(a){var b=this.el;b!==a&&(this.el=a,$i(this),this.M(),this.g("hasVerticalScrollbar",b,a),Xi(this,!1))}},hasHorizontalScrollbar:{get:function(){return this.dl},set:function(a){var b=this.dl;b!==a&&(this.dl=a,$i(this),this.M(),this.g("hasHorizontalScrollbar",b,a),Xi(this,!1))}},allowHorizontalScroll:{get:function(){return this.fr},set:function(a){var b=this.fr;b!==a&&(this.fr=a,this.g("allowHorizontalScroll",
b,a),Xi(this,!1))}},allowVerticalScroll:{get:function(){return this.ir},set:function(a){var b=this.ir;b!==a&&(this.ir=a,this.g("allowVerticalScroll",b,a),Xi(this,!1))}},scrollHorizontalLineChange:{get:function(){return this.Ns},set:function(a){var b=this.Ns;b!==a&&(0>a&&va(a,">= 0",Q,"scrollHorizontalLineChange"),this.Ns=a,this.g("scrollHorizontalLineChange",b,a))}},scrollVerticalLineChange:{get:function(){return this.Rs},
set:function(a){var b=this.Rs;b!==a&&(0>a&&va(a,">= 0",Q,"scrollVerticalLineChange"),this.Rs=a,this.g("scrollVerticalLineChange",b,a))}},lastInput:{get:function(){return this.$g},set:function(a){this.$g=a}},firstInput:{get:function(){return this.Rf},set:function(a){this.Rf=a}},currentCursor:{get:function(){return this.wr},set:function(a){""===a&&(a=this.Bn);if(this.wr!==a){var b=this.sa,c=this.Da;if(null!==b){this.wr=
a;var d=b.style.cursor;b.style.cursor=a;c.style.cursor=a;b.style.cursor===d&&(b.style.cursor="-webkit-"+a,c.style.cursor="-webkit-"+a,b.style.cursor===d&&(b.style.cursor="-moz-"+a,c.style.cursor="-moz-"+a,b.style.cursor===d&&(b.style.cursor=a,c.style.cursor=a)))}}}},defaultCursor:{get:function(){return this.Bn},set:function(a){""===a&&(a="auto");var b=this.Bn;b!==a&&(this.Bn=a,this.g("defaultCursor",b,a))}},click:{get:function(){return this.Kf},
set:function(a){var b=this.Kf;b!==a&&(this.Kf=a,this.g("click",b,a))}},doubleClick:{get:function(){return this.Pf},set:function(a){var b=this.Pf;b!==a&&(this.Pf=a,this.g("doubleClick",b,a))}},contextClick:{get:function(){return this.Lf},set:function(a){var b=this.Lf;b!==a&&(this.Lf=a,this.g("contextClick",b,a))}},mouseOver:{get:function(){return this.hg},set:function(a){var b=this.hg;b!==a&&(this.hg=a,this.g("mouseOver",
b,a))}},mouseHover:{get:function(){return this.fg},set:function(a){var b=this.fg;b!==a&&(this.fg=a,this.g("mouseHover",b,a))}},mouseHold:{get:function(){return this.eg},set:function(a){var b=this.eg;b!==a&&(this.eg=a,this.g("mouseHold",b,a))}},mouseDragOver:{get:function(){return this.rs},set:function(a){var b=this.rs;b!==a&&(this.rs=a,this.g("mouseDragOver",b,a))}},mouseDrop:{get:function(){return this.cg},
set:function(a){var b=this.cg;b!==a&&(this.cg=a,this.g("mouseDrop",b,a))}},handlesDragDropForTopLevelParts:{get:function(){return this.Rr},set:function(a){var b=this.Rr;b!==a&&(this.Rr=a,this.g("handlesDragDropForTopLevelParts",b,a))}},mouseEnter:{get:function(){return this.dg},set:function(a){var b=this.dg;b!==a&&(this.dg=a,this.g("mouseEnter",b,a))}},mouseLeave:{get:function(){return this.gg},set:function(a){var b=
this.gg;b!==a&&(this.gg=a,this.g("mouseLeave",b,a))}},toolTip:{get:function(){return this.rg},set:function(a){var b=this.rg;b!==a&&(this.rg=a,this.g("toolTip",b,a))}},contextMenu:{get:function(){return this.Mf},set:function(a){var b=this.Mf;b!==a&&(this.Mf=a,this.g("contextMenu",b,a))}},commandHandler:{get:function(){return this.qr},set:function(a){this.qr!==a&&(this.qr=a,a.$d(this))}},toolManager:{
get:function(){return this.dt},set:function(a){this.dt!==a&&(this.dt=a,a.diagram=this)}},defaultTool:{get:function(){return this.Br},set:function(a){var b=this.Br;b!==a&&(this.Br=a,a.diagram=this,this.currentTool===b&&(this.currentTool=a))}},currentTool:{get:function(){return this.yr},set:function(a){var b=this.yr;null!==b&&(b.isActive&&b.doDeactivate(),b.cancelWaitAfter(),b.doStop());null===a&&(a=this.defaultTool);null!==a&&
(this.yr=a,a.diagram=this,a.doStart())}},selection:{get:function(){return this.cv}},maxSelectionCount:{get:function(){return this.ns},set:function(a){var b=this.ns;if(b!==a)if(0<=a&&!isNaN(a)){if(this.ns=a,this.g("maxSelectionCount",b,a),!this.undoManager.isUndoingRedoing&&(a=this.selection.count-a,0<a)){this.R("ChangingSelection",this.selection);b=this.selection.na();for(var c=0;c<a;c++)b[c].isSelected=!1;this.R("ChangedSelection",this.selection)}}else va(a,
">= 0",Q,"maxSelectionCount")}},nodeSelectionAdornmentTemplate:{get:function(){return this.Wo},set:function(a){var b=this.Wo;b!==a&&(this.Wo=a,this.g("nodeSelectionAdornmentTemplate",b,a))}},groupSelectionAdornmentTemplate:{get:function(){return this.$n},set:function(a){var b=this.$n;b!==a&&(this.$n=a,this.g("groupSelectionAdornmentTemplate",b,a))}},linkSelectionAdornmentTemplate:{get:function(){return this.vo},
set:function(a){var b=this.vo;b!==a&&(this.vo=a,this.g("linkSelectionAdornmentTemplate",b,a))}},highlighteds:{get:function(){return this.Du}},isModified:{get:function(){var a=this.undoManager;return a.isEnabled?null!==a.currentTransaction?!0:this.fo&&this.Kd!==a.historyIndex:this.fo},set:function(a){if(this.fo!==a){this.fo=a;var b=this.undoManager;!a&&b.isEnabled&&(this.Kd=b.historyIndex);a||Xj(this)}}},model:{
get:function(){return this.ac},set:function(a){var b=this.ac;if(b!==a){this.currentTool.doCancel();null!==b&&b.undoManager!==a.undoManager&&b.undoManager.isInTransaction&&B("Do not replace a Diagram.model while a transaction is in progress.");this.animationManager.Xc(!0);var c=Ki(this,!0);this.le=!1;this.vj=!0;this.Kd=-2;this.ze=!1;var d=this.Cc;this.Cc=!0;Bh(this.animationManager,"Model");null!==b&&(null!==this.re&&this.re.each(function(a){b.yk(a)}),b.yk(this.Kc));this.ac=a;this.partManager=hk(this.ac.type);
for(var e=0;e<c.length;e++)this.add(c[e]);a.Ah(this.kd);this.partManager.addAllModeledParts();a.yk(this.kd);a.Ah(this.Kc);null!==this.re&&this.re.each(function(b){a.Ah(b)});this.Cc=d;this.Rb||this.M();null!==b&&a.undoManager.copyProperties(b.undoManager)}}},Z:{get:function(){return this.Nu},set:function(a){this.Nu=a}},Jt:{get:function(){return this.kx}},skipsModelSourceBindings:{get:function(){return this.dv},
set:function(a){this.dv=a}},$t:{get:function(){return this.Ws},set:function(a){this.Ws=a}},nodeTemplate:{get:function(){return this.Ye.H("")},set:function(a){var b=this.Ye.H("");b!==a&&(this.Ye.add("",a),this.g("nodeTemplate",b,a),this.undoManager.isUndoingRedoing||this.Ad())}},nodeTemplateMap:{get:function(){return this.Ye},set:function(a){var b=this.Ye;b!==a&&(this.Ye=a,this.g("nodeTemplateMap",b,a),this.undoManager.isUndoingRedoing||
this.Ad())}},groupTemplate:{get:function(){return this.Yg.H("")},set:function(a){var b=this.Yg.H("");b!==a&&(this.Yg.add("",a),this.g("groupTemplate",b,a),this.undoManager.isUndoingRedoing||this.Ad())}},groupTemplateMap:{get:function(){return this.Yg},set:function(a){var b=this.Yg;b!==a&&(this.Yg=a,this.g("groupTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Ad())}},linkTemplate:{get:function(){return this.Yf.H("")},
set:function(a){var b=this.Yf.H("");b!==a&&(this.Yf.add("",a),this.g("linkTemplate",b,a),this.undoManager.isUndoingRedoing||this.Ad())}},linkTemplateMap:{get:function(){return this.Yf},set:function(a){var b=this.Yf;b!==a&&(this.Yf=a,this.g("linkTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Ad())}},isMouseCaptured:{get:function(){return this.Ju},set:function(a){var b=this.sa;null!==b&&(b=b.Fa,b instanceof SVGElement||(a?(this.lastInput.bubbles=
!1,this.Zm?(this.removeEventListener(b,"pointermove",this.vm,!1),this.removeEventListener(b,"pointerdown",this.um,!1),this.removeEventListener(b,"pointerup",this.xm,!1),this.removeEventListener(b,"pointerout",this.wm,!1),this.addEventListener(x,"pointermove",this.vm,!0),this.addEventListener(x,"pointerdown",this.um,!0),this.addEventListener(x,"pointerup",this.xm,!0),this.addEventListener(x,"pointerout",this.wm,!0)):(this.removeEventListener(b,"mousemove",this.sk,!1),this.removeEventListener(b,"mousedown",
this.rk,!1),this.removeEventListener(b,"mouseup",this.uk,!1),this.removeEventListener(b,"mouseout",this.tk,!1),this.addEventListener(x,"mousemove",this.sk,!0),this.addEventListener(x,"mousedown",this.rk,!0),this.addEventListener(x,"mouseup",this.uk,!0),this.addEventListener(x,"mouseout",this.tk,!0)),this.removeEventListener(b,"wheel",this.vk,!1),this.addEventListener(x,"wheel",this.vk,!0),this.addEventListener(x,"selectstart",this.preventDefault,!1)):(this.Zm?(this.removeEventListener(x,"pointermove",
this.vm,!0),this.removeEventListener(x,"pointerdown",this.um,!0),this.removeEventListener(x,"pointerup",this.xm,!0),this.removeEventListener(x,"pointerout",this.wm,!0),this.addEventListener(b,"pointermove",this.vm,!1),this.addEventListener(b,"pointerdown",this.um,!1),this.addEventListener(b,"pointerup",this.xm,!1),this.addEventListener(b,"pointerout",this.wm,!1)):(this.removeEventListener(x,"mousemove",this.sk,!0),this.removeEventListener(x,"mousedown",this.rk,!0),this.removeEventListener(x,"mouseup",
this.uk,!0),this.removeEventListener(x,"mouseout",this.tk,!0),this.addEventListener(b,"mousemove",this.sk,!1),this.addEventListener(b,"mousedown",this.rk,!1),this.addEventListener(b,"mouseup",this.uk,!1),this.addEventListener(b,"mouseout",this.tk,!1)),this.removeEventListener(x,"wheel",this.vk,!0),this.removeEventListener(x,"selectstart",this.preventDefault,!1),this.addEventListener(b,"wheel",this.vk,!1)),this.Ju=a))}},position:{get:function(){return this.ma},set:function(a){var b=
I.alloc().assign(this.ma);if(!b.w(a)){var c=this.viewportBounds.copy();this.ma.assign(a);Rh(this.animationManager,b,this.ma);this.Rb||null===this.sa&&!this.am.v()||(this.Rb=!0,a=this.scale,Zi(this,this.Dn,this.wa/a,this.va/a,this.oj,!1),this.Rb=!1);this.Rb||this.Jq(c,this.viewportBounds,this.ya,!1)}I.free(b)}},initialPosition:{get:function(){return this.Tr},set:function(a){this.Tr.w(a)||(this.Tr=a.G())}},initialScale:{get:function(){return this.Ur},
set:function(a){this.Ur!==a&&(this.Ur=a)}},grid:{get:function(){null===this.Hb&&Qi(this);return this.Hb},set:function(a){var b=this.Hb;if(b!==a){null===b&&(Qi(this),b=this.Hb);a.type!==X.Grid&&B("Diagram.grid must be a Panel of type Panel.Grid");var c=b.panel;null!==c&&c.remove(b);this.Hb=a;a.name="GRID";null!==c&&c.add(a);pj(this);this.M();this.g("grid",b,a)}}},viewportBounds:{get:function(){var a=this.Bx,b=this.ma,c=this.ya;if(null===this.sa)return this.am.v()&&
a.h(b.x,b.y,this.wa/c,this.va/c),a;a.h(b.x,b.y,Math.max(this.wa,0)/c,Math.max(this.va,0)/c);return a}},viewSize:{get:function(){return this.am},set:function(a){var b=this.viewSize;b.w(a)||(this.am=a=a.G(),this.wa=a.width,this.va=a.height,this.Na(),this.g("viewSize",b,a))}},fixedBounds:{get:function(){return this.Or},set:function(a){var b=this.Or;b.w(a)||(-Infinity!==a.width&&Infinity!==a.height&&-Infinity!==a.height||B("fixedBounds width/height must not be Infinity"),
this.Or=a=a.G(),this.Na(),this.g("fixedBounds",b,a))}},scrollMargin:{get:function(){return this.Ji},set:function(a){"number"===typeof a&&(a=new oc(a));var b=this.Ji;b.w(a)||(this.Ji=a=a.G(),this.g("scrollMargin",b,a),this.Zd())}},scrollMode:{get:function(){return this.Ki},set:function(a){var b=this.Ki;b!==a&&(this.Ki=a,a===Yh&&Xi(this,!1),this.g("scrollMode",b,a),this.M())}},scrollsPageOnFocus:{get:function(){return this.Ss},
set:function(a){var b=this.Ss;b!==a&&(this.Ss=a,this.g("scrollsPageOnFocus",b,a))}},positionComputation:{get:function(){return this.Fs},set:function(a){var b=this.Fs;b!==a&&(this.Fs=a,Xi(this,!1),this.g("positionComputation",b,a))}},scaleComputation:{get:function(){return this.Ls},set:function(a){var b=this.Ls;b!==a&&(this.Ls=a,Vj(this,this.scale,this.scale),this.g("scaleComputation",b,a))}},documentBounds:{
get:function(){return this.Dn}},isVirtualized:{get:function(){return this.fs},set:function(a){var b=this.fs;b!==a&&(this.fs=a,this.g("isVirtualized",b,a))}},scale:{get:function(){return this.ya},set:function(a){var b=this.ya;b!==a&&Vj(this,b,a)}},defaultScale:{get:function(){return this.Cn},set:function(a){this.Cn=a}},autoScale:{get:function(){return this.Ig},set:function(a){var b=
this.Ig;b!==a&&(this.Ig=a,this.g("autoScale",b,a),a!==Hh&&Xi(this,!1))}},initialAutoScale:{get:function(){return this.Uf},set:function(a){var b=this.Uf;b!==a&&(this.Uf=a,this.g("initialAutoScale",b,a))}},initialViewportSpot:{get:function(){return this.Vr},set:function(a){var b=this.Vr;b!==a&&(a.hb()||B("initialViewportSpot must be a specific Spot: "+a),this.Vr=a,this.g("initialViewportSpot",b,a))}},initialDocumentSpot:{
get:function(){return this.Sr},set:function(a){var b=this.Sr;b!==a&&(a.hb()||B("initialViewportSpot must be a specific Spot: "+a),this.Sr=a,this.g("initialDocumentSpot",b,a))}},minScale:{get:function(){return this.os},set:function(a){var b=this.os;b!==a&&(0<a?(this.os=a,this.g("minScale",b,a),a>this.scale&&(this.scale=a)):va(a,"> 0",Q,"minScale"))}},maxScale:{get:function(){return this.ms},set:function(a){var b=this.ms;b!==a&&(0<a?(this.ms=
a,this.g("maxScale",b,a),a<this.scale&&(this.scale=a)):va(a,"> 0",Q,"maxScale"))}},zoomPoint:{get:function(){return this.kt},set:function(a){this.kt.w(a)||(this.kt=a=a.G())}},contentAlignment:{get:function(){return this.oj},set:function(a){var b=this.oj;b.w(a)||(this.oj=a=a.G(),this.g("contentAlignment",b,a),Xi(this,!1))}},initialContentAlignment:{get:function(){return this.bo},set:function(a){var b=this.bo;
b.w(a)||(this.bo=a=a.G(),this.g("initialContentAlignment",b,a))}},padding:{get:function(){return this.fb},set:function(a){"number"===typeof a&&(a=new oc(a));var b=this.fb;b.w(a)||(this.fb=a=a.G(),this.Na(),this.g("padding",b,a))}},partManager:{get:function(){return this.Ja},set:function(a){var b=this.Ja;b!==a&&(null!==a.diagram&&B("Cannot share PartManagers between Diagrams: "+a.toString()),null!==b&&b.$d(null),this.Ja=a,a.$d(this))}},nodes:{
get:function(){return this.partManager.nodes.iterator}},links:{get:function(){return this.partManager.links.iterator}},parts:{get:function(){return this.partManager.parts.iterator}},layout:{get:function(){return this.ic},set:function(a){var b=this.ic;b!==a&&(this.ic=a,a.diagram=this,a.group=null,this.Hg=!0,this.g("layout",b,a),this.Bb())}},isTreePathToChildren:{get:function(){return this.es},
set:function(a){var b=this.es;if(b!==a&&(this.es=a,this.g("isTreePathToChildren",b,a),!this.undoManager.isUndoingRedoing))for(a=this.nodes;a.next();)Ek(a.value)}},treeCollapsePolicy:{get:function(){return this.ft},set:function(a){var b=this.ft;b!==a&&(a!==ri&&a!==Fk&&a!==Gk&&B("Unknown Diagram.treeCollapsePolicy: "+a),this.ft=a,this.g("treeCollapsePolicy",b,a))}},Fe:{get:function(){return this.Gu},set:function(a){this.Gu=a}},autoScrollInterval:{
get:function(){return this.cn},set:function(a){var b=this.cn;b!==a&&(this.cn=a,this.g("autoScrollInterval",b,a))}},autoScrollRegion:{get:function(){return this.en},set:function(a){"number"===typeof a&&(a=new oc(a));var b=this.en;b.w(a)||(this.en=a=a.G(),this.Na(),this.g("autoScrollRegion",b,a))}}});
ma.Object.defineProperties(Q,{licenseKey:{get:function(){return Hk.Xb()},set:function(a){Hk.add(a)}},version:{get:function(){return Ik}}});Q.prototype.makeImageData=Q.prototype.ly;Q.prototype.makeImage=Q.prototype.hA;Q.prototype.addRenderer=Q.prototype.Vy;Q.prototype.makeSVG=Q.prototype.Uv;Q.prototype.makeSvg=Q.prototype.Lt;Q.prototype.stopAutoScroll=Q.prototype.Cf;Q.prototype.doAutoScroll=Q.prototype.rt;Q.prototype.isUnoccupied=Q.prototype.nk;
Q.prototype.raiseDiagramEvent=Q.prototype.R;Q.prototype.removeDiagramListener=Q.prototype.zm;Q.prototype.addDiagramListener=Q.prototype.Xj;Q.prototype.findTreeRoots=Q.prototype.Kz;Q.prototype.layoutDiagram=Q.prototype.fA;Q.prototype.findTopLevelGroups=Q.prototype.Dz;Q.prototype.findTopLevelNodesAndLinks=Q.prototype.Ez;Q.prototype.findLinksByExample=Q.prototype.ut;Q.prototype.findNodesByExample=Q.prototype.vt;Q.prototype.findLinkForData=Q.prototype.wc;Q.prototype.findNodeForData=Q.prototype.Wi;
Q.prototype.findPartForData=Q.prototype.xc;Q.prototype.findLinkForKey=Q.prototype.findLinkForKey;Q.prototype.findNodeForKey=Q.prototype.Lb;Q.prototype.findPartForKey=Q.prototype.findPartForKey;Q.prototype.rebuildParts=Q.prototype.Ad;Q.prototype.transformViewToDoc=Q.prototype.au;Q.prototype.transformRectDocToView=Q.prototype.HA;Q.prototype.transformDocToView=Q.prototype.Wq;Q.prototype.centerRect=Q.prototype.nt;Q.prototype.scrollToRect=Q.prototype.mw;Q.prototype.scroll=Q.prototype.scroll;
Q.prototype.highlightCollection=Q.prototype.Vz;Q.prototype.highlight=Q.prototype.Uz;Q.prototype.selectCollection=Q.prototype.yA;Q.prototype.select=Q.prototype.select;Q.prototype.updateAllRelationshipsFromData=Q.prototype.Yq;Q.prototype.updateAllTargetBindings=Q.prototype.updateAllTargetBindings;Q.prototype.commit=Q.prototype.commit;Q.prototype.rollbackTransaction=Q.prototype.Bf;Q.prototype.commitTransaction=Q.prototype.Va;Q.prototype.startTransaction=Q.prototype.ua;Q.prototype.raiseChanged=Q.prototype.g;
Q.prototype.raiseChangedEvent=Q.prototype.$a;Q.prototype.removeChangedListener=Q.prototype.yk;Q.prototype.addChangedListener=Q.prototype.Ah;Q.prototype.removeModelChangedListener=Q.prototype.uA;Q.prototype.addModelChangedListener=Q.prototype.Hx;Q.prototype.findLayer=Q.prototype.km;Q.prototype.removeLayer=Q.prototype.sA;Q.prototype.addLayerAfter=Q.prototype.Ry;Q.prototype.addLayerBefore=Q.prototype.Fx;Q.prototype.addLayer=Q.prototype.bm;Q.prototype.moveParts=Q.prototype.moveParts;
Q.prototype.copyParts=Q.prototype.ek;Q.prototype.removeParts=Q.prototype.Ut;Q.prototype.remove=Q.prototype.remove;Q.prototype.add=Q.prototype.add;Q.prototype.clearDelayedGeometries=Q.prototype.sv;Q.prototype.setProperties=Q.prototype.rw;Q.prototype.resetInputOptions=Q.prototype.jw;Q.prototype.setInputOption=Q.prototype.zA;Q.prototype.getInputOption=Q.prototype.om;Q.prototype.resetRenderingHints=Q.prototype.kw;Q.prototype.setRenderingHint=Q.prototype.zy;Q.prototype.getRenderingHint=Q.prototype.Ee;
Q.prototype.maybeUpdate=Q.prototype.Wc;Q.prototype.requestUpdate=Q.prototype.Bb;Q.prototype.delayInitialization=Q.prototype.jz;Q.prototype.isUpdateRequested=Q.prototype.aA;Q.prototype.redraw=Q.prototype.Zd;Q.prototype.invalidateDocumentBounds=Q.prototype.Na;Q.prototype.findObjectsNear=Q.prototype.xg;Q.prototype.findPartsNear=Q.prototype.Az;Q.prototype.findObjectsIn=Q.prototype.tf;Q.prototype.findPartsIn=Q.prototype.Xx;Q.prototype.findObjectsAt=Q.prototype.Xi;Q.prototype.findPartsAt=Q.prototype.zz;
Q.prototype.findObjectAt=Q.prototype.Ub;Q.prototype.findPartAt=Q.prototype.lm;Q.prototype.focusObject=Q.prototype.Lz;Q.prototype.alignDocument=Q.prototype.Xy;Q.prototype.zoomToRect=Q.prototype.KA;Q.prototype.zoomToFit=Q.prototype.zoomToFit;Q.prototype.diagramScroll=Q.prototype.Px;Q.prototype.focus=Q.prototype.focus;Q.prototype.reset=Q.prototype.reset;Q.useDOM=function(a){Sg=a?void 0!==x.document:!1};Q.isUsingDOM=function(){return Sg};
var Ce=null,si=new H,Oi=null,Ni=null,Sg=void 0!==x.document,Ii=null,Ji="",Hh=new D(Q,"None",0),bj=new D(Q,"Uniform",1),cj=new D(Q,"UniformToFill",2),Mf=new D(Q,"CycleAll",10),Qf=new D(Q,"CycleNotDirected",11),Sf=new D(Q,"CycleNotDirectedFast",12),Tf=new D(Q,"CycleNotUndirected",13),Nf=new D(Q,"CycleDestinationTree",14),Pf=new D(Q,"CycleSourceTree",15),Yh=new D(Q,"DocumentScroll",1),$h=new D(Q,"InfiniteScroll",2),ri=new D(Q,"TreeParentCollapsed",21),Fk=new D(Q,"AllParentsCollapsed",22),Gk=new D(Q,
"AnyParentsCollapsed",23),Hk=new E,Ik="2.1.26",Jk=null,oi=!1;
function pi(){if(Sg){var a=x.document.createElement("canvas");Jk=a}}Q.className="Diagram";
Q.fromDiv=function(a){var b=a;"string"===typeof a&&(b=x.document.getElementById(a));return b instanceof HTMLDivElement&&b.B instanceof Q?b.B:null};Q.inherit=function(a,b){function c(){}if(Object.getPrototypeOf(a).prototype)throw Error("Used go.Diagram.inherit defining already defined class \n"+a);c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a};Q.None=Hh;Q.Uniform=bj;Q.UniformToFill=cj;Q.CycleAll=Mf;Q.CycleNotDirected=Qf;Q.CycleNotDirectedFast=Sf;Q.CycleNotUndirected=Tf;
Q.CycleDestinationTree=Nf;Q.CycleSourceTree=Pf;Q.DocumentScroll=Yh;Q.InfiniteScroll=$h;Q.TreeParentCollapsed=ri;Q.AllParentsCollapsed=Fk;Q.AnyParentsCollapsed=Gk;function Gi(){this.Ny=null;this.l="zz@orderNum";"63ad05bbe23a1786468a4c741b6d2"===this._tk?this.Pe=this.l=!0:this.Pe=null}
function yj(a,b){b.Fb.setTransform(b.Sb,0,0,b.Sb,0,0);if(null===a.Pe){b="f";var c=x[Ra("76a715b2f73f148a")][Ra("72ba13b5")];a.Pe=!0;if(Sg){var d=Q[Ra("76a115b6ed251eaf4692")];if(d)for(var e=Hk.iterator;e.next();){d=e.value;d=Ra(d).split(Ra("39e9"));if(6>d.length)break;var f=Ra(d[1]).split(".");if("7da71ca0"!==d[4])break;var g=Ra(qa[Ra("6cae19")]).split(".");if(f[0]>g[0]||f[0]===g[0]&&f[1]>=g[1]){f=c[Ra("76ad18b4f73e")];for(g=c[Ra("73a612b6fb191d")](Ra("35e7"))+2;g<f;g++)b+=c[g];f=b[Ra("73a612b6fb191d")](Ra(d[2]));
0>f&&Ra(d[2])!==Ra("7da71ca0ad381e90")&&(f=b[Ra("73a612b6fb191d")](Ra("76a715b2ef3e149757")));0>f&&(f=b[Ra("73a612b6fb191d")](Ra("76a715b2ef3e149757")));0>f&&(f=c[Ra("73a612b6fb191d")](Ra("7baa19a6f76c1988428554")));a.Pe=!(0<=f&&f<b[Ra("73a612b6fb191d")](Ra("35"))||-1===b[Ra("73a612b6fb191d")](Ra("35")));if(!a.Pe)break;f=Ra(d[2]);if("#"!==f[0])break;g=x.document.createElement("div");for(var h=d[0].replace(/[A-Za-z]/g,"");4>h.length;)h+="9";h=h.substr(h.length-4);d="";d+=["gsh","gsf"][parseInt(h.substr(0,
1),10)%2];d+=["Header","Background","Display","Feedback"][parseInt(h.substr(0,1),10)%4];g[Ra("79a417a0f0181a8946")]=d;if(x.document[Ra("78a712aa")]){x.document[Ra("78a712aa")][Ra("7bb806b6ed32388c4a875b")](g);h=x.getComputedStyle(g).getPropertyValue(Ra("78a704b7e62456904c9b12701b6532a8"));x.document[Ra("78a712aa")][Ra("68ad1bbcf533388c4a875b")](g);if(!h)break;if(-1!==h.indexOf(parseInt(f[1]+f[2],16))&&-1!==h.indexOf(parseInt(f[3]+f[4],16))){a.Pe=!1;break}else if(Sa||Ta||Ua||Va)for(d="."+d,f=0;f<document.styleSheets.length;f++){g=
document.styleSheets[f].rules||document.styleSheets[f].cssRules;for(var k in g)if(d===g[k].selectorText){a.Pe=!1;break}}}else a.Pe=null,a.Pe=!1}}else{k=c[Ra("76ad18b4f73e")];for(e=c[Ra("73a612b6fb191d")](Ra("35e7"))+2;e<k;e++)b+=c[e];c=b[Ra("73a612b6fb191d")](Ra("7da71ca0ad381e90"));a.Pe=!(0<=c&&c<b[Ra("73a612b6fb191d")](Ra("35")))}}}return 0<a.Pe&&a!==a.Ny?!0:!1}
function Hi(a,b){if(Sg){void 0!==b&&null!==b||B("Diagram setup requires an argument DIV.");null!==a.Da&&B("Diagram has already completed setup.");"string"===typeof b?a.Da=x.document.getElementById(b):b instanceof HTMLDivElement?a.Da=b:B("No DIV or DIV id supplied: "+b);null===a.Da&&B("Invalid DIV id; could not get element with id: "+b);void 0!==a.Da.B&&B("Invalid div id; div already has a Diagram associated with it.");if(!a.Gl&&x.ResizeObserver){var c=ra(function(){a.Bb()},250);a.Gl=new x.ResizeObserver(function(){c()});
a.Gl.observe(a.Da)}"static"===x.getComputedStyle(a.Da,null).position&&(a.Da.style.position="relative");a.Da.style["-webkit-tap-highlight-color"]="rgba(255, 255, 255, 0)";a.Da.style["-ms-touch-action"]="none";a.Da.innerHTML="";a.Da.B=a;a.Da.goDiagram=a;a.Da.go=x.go;var d=a.Up?new Dj(a):new Dk(a);void 0!==d.style&&(d.style.position="absolute",d.style.top="0px",d.style.left="0px","rtl"===x.getComputedStyle(a.Da,null).getPropertyValue("direction")&&(a.ol=!0),d.style.zIndex="2",d.style.userSelect="none",
d.style.webkitUserSelect="none",d.style.MozUserSelect="none");a.sa=d;a.Fb=d.context;b=a.Fb;a.Sb=a.computePixelRatio();a.wa=a.Da.clientWidth||1;a.va=a.Da.clientHeight||1;Fj(a,a.wa,a.va);a.Ir=b.Y[Ra("7eba17a4ca3b1a8346")][Ra("78a118b7")](b.Y,Jk,4,4);a.Da.insertBefore(d.Fa,a.Da.firstChild);d=new Dk(null);d.width=1;d.height=1;a.vu=d;a.ax=d.context;if(Sg){d=ta("div");var e=ta("div");d.style.position="absolute";d.style.overflow="auto";d.style.width=a.wa+"px";d.style.height=a.va+"px";d.style.zIndex="1";
e.style.position="absolute";e.style.width="1px";e.style.height="1px";a.Da.appendChild(d);d.appendChild(e);d.onscroll=Ri;d.addEventListener("mousedown",Ti);d.addEventListener("touchstart",Ti,{passive:!0});d.B=a;d.Ly=!0;d.My=!0;a.Ps=d;a.Bp=e}a.St=ra(function(){a.rh=null;a.M()},300);a.Gw=ra(function(){Ih(a)},250);a.preventDefault=function(a){a.preventDefault();return!1};a.sk=function(b){if(a.isEnabled){a.Vf=!0;var c=gj(a,b,!0);a.doMouseMove();a.currentTool.isBeyondDragSize()&&(a.pd=0);mj(c,b)}};a.rk=
function(b){if(a.isEnabled)if(a.Vf=!0,a.me)b.preventDefault();else{var c=gj(a,b,!0);c.down=!0;c.clickCount=b.detail;if(Ta||Ua)b.timeStamp-a.Dj<a.et&&!a.currentTool.isBeyondDragSize()?a.pd++:a.pd=1,a.Dj=b.timeStamp,c.clickCount=a.pd;c.clone(a.firstInput);a.doMouseDown();1===b.button?b.preventDefault():mj(c,b)}};a.uk=function(b){if(a.isEnabled)if(a.me&&2===b.button)b.preventDefault();else if(a.me&&0===b.button&&(a.me=!1),a.Sj)b.preventDefault();else{a.Vf=!0;var c=gj(a,b,!0);c.up=!0;c.clickCount=b.detail;
if(Ta||Ua)c.clickCount=a.pd;c.bubbles=b.bubbles;c.targetDiagram=ij(b);a.doMouseUp();a.Cf();mj(c,b)}};a.vk=function(b){if(a.isEnabled){var c=gj(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();mj(c,b)}};a.tk=function(b){a.isEnabled&&(a.Vf=!1,gj(a,b,!0),b=a.currentTool,b.cancelWaitAfter(),b.standardMouseOver())};a.Aw=function(b){if(a.isEnabled){a.Sj=!1;a.me=!0;var c=jj(a,b,b.targetTouches[0],1<b.touches.length),d=null;0<b.targetTouches.length?d=b.targetTouches[0]:0<b.changedTouches.length&&(d=b.changedTouches[0]);if(null!==d){var e=d.screenX;d=d.screenY;var f=a.qo;b.timeStamp-a.Dj<a.et&&!(25<Math.abs(f.x-
e)||25<Math.abs(f.y-d))?a.pd++:a.pd=1;c.clickCount=a.pd;a.Dj=b.timeStamp;a.qo.h(e,d)}a.doMouseDown();mj(c,b)}};a.zw=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=lj(a,b,c,1<b.touches.length);a.doMouseMove();mj(c,b)}};a.yw=function(b){if(a.isEnabled)if(a.Sj)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=kj(a,b,!1,!0,!1,!1);null!==d&&(c=x.document.elementFromPoint(d.clientX,d.clientY),null!==c&&c.B instanceof Q&&c.B!==a&&hj(c.B,d,e),hj(a,d,e),e.clickCount=a.pd);null===c?e.targetDiagram=ij(b):c.B?e.targetDiagram=c.B:e.targetDiagram=null;e.targetObject=null;a.doMouseUp();mj(e,b);a.me=!1}};a.um=function(b){if(a.isEnabled){a.Vf=!0;var c=a.Ds;void 0===c[b.pointerId]&&(c[b.pointerId]=b);c=a.Nj;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.Sj=!1,a.me=!0;c=jj(a,b,b,d);d=a.qo;var e="touch"===b.pointerType||"pen"===b.pointerType?25:10;b.timeStamp-a.Dj<a.et&&!(Math.abs(d.x-b.screenX)>e||Math.abs(d.y-b.screenY)>e)?a.pd++:a.pd=1;c.clickCount=a.pd;a.Dj=b.timeStamp;a.qo.Bg(b.screenX,b.screenY);a.doMouseDown();1===b.button?b.preventDefault():mj(c,b)}};a.vm=function(b){if(a.isEnabled){a.Vf=!0;var c=
a.Nj;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=lj(a,b,b,null!==c[1]),c.targetDiagram=ij(b),a.doMouseMove(),mj(c,b))}};a.xm=function(b){if(a.isEnabled){a.Vf=!0;var c="touch"===b.pointerType||"pen"===b.pointerType,d=a.Ds;if(c&&a.Sj)delete d[b.pointerId],b.preventDefault();else if(d=a.Nj,null!==d[0]&&d[0].pointerId===b.pointerId){d[0]=null;d=kj(a,b,!1,!0,!0,!1);
var e=x.document.elementFromPoint(b.clientX,b.clientY);null!==e&&e.B instanceof Q&&e.B!==a&&hj(e.B,b,d);hj(a,b,d);d.clickCount=a.pd;null===e?d.targetDiagram=ij(b):e.B?d.targetDiagram=e.B:d.targetDiagram=null;d.targetObject=null;a.doMouseUp();mj(d,b);c&&(a.me=!1)}else null!==d[1]&&d[1].pointerId===b.pointerId&&(d[1]=null)}};a.wm=function(b){if(a.isEnabled){a.Vf=!1;var c=a.Ds;c[b.pointerId]&&delete c[b.pointerId];c=a.Nj;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.sc(!0);Pi(a)}}Gi.className="DiagramHelper";function cf(a){this.l=void 0===a?new I:a;this.u=new I}ma.Object.defineProperties(cf.prototype,{point:{get:function(){return this.l},set:function(a){this.l=a}},shifted:{get:function(){return this.u},set:function(a){this.u=a}}});cf.className="DraggingInfo";
function Qj(a,b,c){this.node=a;this.info=b;this.Lv=c}Qj.className="DraggingNodeInfoPair";function Se(){this.reset()}Se.prototype.reset=function(){this.isGridSnapEnabled=!1;this.isGridSnapRealtime=!0;this.gridSnapCellSize=(new M(NaN,NaN)).freeze();this.gridSnapCellSpot=vc;this.gridSnapOrigin=(new I(NaN,NaN)).freeze();this.groupsSnapMembers=this.dragsTree=this.dragsLink=!1;this.dragsMembers=this.groupsAlwaysMove=!0};Se.className="DraggingOptions";
function Kk(a){1<arguments.length&&B("Palette constructor can only take one optional argument, the DIV HTML element or its id.");Q.call(this,a);Lk(this)}la(Kk,Q);function Lk(a){a.allowDragOut=!0;a.allowMove=!1;a.isReadOnly=!0;a.contentAlignment=wc;a.layout=new Mk}Kk.prototype.reset=function(){Q.prototype.reset.call(this);Lk(this)};Kk.className="Palette";
function Nk(a){1<arguments.length&&B("Overview constructor can only take one optional argument, the DIV HTML element or its id.");Q.call(this,a);var b=this;this.animationManager.isEnabled=!1;this.Rb=!0;this.Ia=null;this.el=this.dl=!1;this.u=this.I=!0;this.bb=0;this.T=!1;this.Ol=null;this.zy("drawShadows",!1);var c=new T,d=new W;d.stroke="magenta";d.strokeWidth=2;d.fill="transparent";d.name="BOXSHAPE";c.selectable=!0;c.selectionAdorned=!1;c.selectionObjectName="BOXSHAPE";c.locationObjectName="BOXSHAPE";
c.resizeObjectName="BOXSHAPE";c.cursor="move";c.add(d);this.l=c;this.allowDelete=this.allowCopy=!1;this.allowSelect=!0;this.autoScrollRegion=new oc(0,0,0,0);this.ma.h(0,0);this.toolManager.Wa("Dragging",new Ok,this.toolManager.mouseMoveTools);this.click=function(){var a=b.observed;if(null!==a){var c=a.viewportBounds,d=b.lastInput.documentPoint;a.position=new I(d.x-c.width/2,d.y-c.height/2)}};this.Qh=function(){b.Na();Pk(b)};this.Ef=function(){null!==b.observed&&(b.Na(),b.M())};this.Nh=function(){1>
b.updateDelay?b.M():b.T||(b.T=!0,setTimeout(function(){b.T=!1;Qk(b);b.M()},b.updateDelay))};this.Yc=function(){null!==b.observed&&Pk(b)};this.autoScale=bj;this.Rb=!1}la(Nk,Q);Nk.prototype.computePixelRatio=function(){return 1};
Nk.prototype.bc=function(){null===this.Da&&B("No div specified");null===this.sa&&B("No canvas specified");if(!(this.sa instanceof Dj)&&(ii(this.box),this.Bc)){var a=this.observed;if(null!==a&&!a.animationManager.isAnimating){wj(this);var b=this.sa;a=this.Fb;a.sc(!0);a.setTransform(1,0,0,1,0,0);a.clearRect(0,0,b.width,b.height);1>this.updateDelay?Rk(this):null!==this.Ol&&(a.drawImage(this.Ol.Fa,0,0),b=this.nb,b.reset(),1!==this.scale&&b.scale(this.scale),0===this.position.x&&0===this.position.y||b.translate(-this.position.x,
-this.position.y),a.scale(this.Sb,this.Sb),a.transform(b.m11,b.m12,b.m21,b.m22,b.dx,b.dy));b=this.Ka.j;for(var c=b.length,d=0;d<c;d++)b[d].bc(a,this);this.Bc=this.oi=!1}}};function Qk(a){var b=a.sa,c=a.Fb;if(null!==b&&null!==c){wj(a);if(null===a.Ol){var d=new Dk(null);d.width=b.width;d.height=b.height;a.Ol=d}try{a.sa=a.Ol,a.Fb=a.sa.context,a.Fb.sc(!0),a.Fb.setTransform(1,0,0,1,0,0),a.Fb.clearRect(0,0,a.sa.width,a.sa.height),Rk(a)}finally{a.sa=b,a.Fb=c}}}
function Rk(a){var b=a.observed;if(null!==b){var c=a.drawsTemporaryLayers,d=a.drawsGrid&&c,e=b.grid;d&&null!==e&&e.visible&&!isNaN(e.width)&&!isNaN(e.height)&&(e=N.alloc().assign(a.viewportBounds).Jc(b.viewportBounds),pj(b,e),N.free(e),Vi(b));var f=a.nb;f.reset();1!==a.scale&&f.scale(a.scale);0===a.position.x&&0===a.position.y||f.translate(-a.position.x,-a.position.y);e=a.Fb;e.scale(a.Sb,a.Sb);e.transform(f.m11,f.m12,f.m21,f.m22,f.dx,f.dy);b=b.Ka.j;f=b.length;for(var g=0;g<f;g++){var h=b[g],k=a;if(h.visible&&
0!==h.opacity){var l=h.diagram.grid.part;if(!c&&h.isTemporary)d&&l.layer===h&&(h=ki(h,e),l.bc(e,k),e.globalAlpha=h);else{for(var m=ki(h,e),n=k.scale,p=N.alloc(),r=h.Ca.j,q=r.length,u=0;u<q;u++){var v=r[u];(d||v!==l)&&h.Ti(e,v,k,null,n,p)}N.free(p);e.globalAlpha=m}}}}}
function Pk(a){var b=a.box;if(null!==b){var c=a.observed;if(null!==c){a.Bc=!0;c=c.viewportBounds;var d=b.selectionObject,e=M.alloc();e.h(c.width,c.height);d.desiredSize=e;M.free(e);a=2/a.scale;d instanceof W&&(d.strokeWidth=a);b.location=new I(c.x-a/2,c.y-a/2);b.isSelected=!0}}}Nk.prototype.computeBounds=function(){var a=this.observed;if(null===a)return ic;var b=a.documentBounds.copy();b.Jc(a.viewportBounds);return b};Nk.prototype.jy=function(){!0!==this.Bc&&(this.Bc=!0,this.Bb())};
Nk.prototype.Jq=function(a,b,c,d){this.Rb||(Ui(this),this.M(),$i(this),this.Na(),Pk(this),this.Td.scale=c,this.Td.position.x=a.x,this.Td.position.y=a.y,this.Td.bounds.assign(a),this.Td.Tv=d,this.R("ViewportBoundsChanged",this.Td,a))};
ma.Object.defineProperties(Nk.prototype,{observed:{get:function(){return this.Ia},set:function(a){var b=this.Ia;a instanceof Nk&&B("Overview.observed Diagram may not be an Overview itself: "+a);if(b!==a){null!==b&&(this.remove(this.box),b.zm("ViewportBoundsChanged",this.Qh),b.zm("DocumentBoundsChanged",this.Ef),b.zm("InvalidateDraw",this.Nh),b.zm("AnimationFinished",this.Yc));this.Ia=a;null!==a&&(a.Xj("ViewportBoundsChanged",this.Qh),a.Xj("DocumentBoundsChanged",this.Ef),
a.Xj("InvalidateDraw",this.Nh),a.Xj("AnimationFinished",this.Yc),this.add(this.box),Pk(this));this.Na();if(null===a){this.Ol=null;var c=this.sa,d=this.Fb;c&&d&&(d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,c.width,c.height))}else Qk(this),Pk(this),this.M();this.g("observed",b,a)}}},box:{get:function(){return this.l},set:function(a){var b=this.l;b!==a&&(this.l=a,this.remove(b),this.add(this.l),Pk(this),this.g("box",b,a))}},drawsTemporaryLayers:{
get:function(){return this.I},set:function(a){this.I!==a&&(this.I=a,this.Zd())}},drawsGrid:{get:function(){return this.u},set:function(a){this.u!==a&&(this.u=a,this.Zd())}},updateDelay:{get:function(){return this.bb},set:function(a){0>a&&(a=0);this.bb!==a&&(this.bb=a)}}});Nk.className="Overview";function Ok(){Re.call(this);this.l=null}la(Ok,Re);
Ok.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(null===a||!a.allowMove||!a.allowSelect)return!1;var b=a.observed;if(null===b)return!1;var c=a.lastInput;if(!c.left||a.currentTool!==this&&(!this.isBeyondDragSize()||c.isTouchEvent&&c.timestamp-a.firstInput.timestamp<this.delay))return!1;null===this.findDraggablePart()&&(c=b.viewportBounds,this.l=new I(c.width/2,c.height/2),a=a.firstInput.documentPoint,b.position=new I(a.x-this.l.x,a.y-this.l.y));return!0};
Ok.prototype.doActivate=function(){this.l=null;Re.prototype.doActivate.call(this)};Ok.prototype.doUpdateCursor=function(){var a=this.diagram,b=a.box;null!==b&&b.cursor&&(a.currentCursor=b.cursor)};Ok.prototype.moveParts=function(){var a=this.diagram,b=a.observed;if(null!==b){var c=a.box;if(null!==c){if(null===this.l){var d=a.firstInput.documentPoint;c=c.location;this.l=new I(d.x-c.x,d.y-c.y)}a=a.lastInput.documentPoint;b.position=new I(a.x-this.l.x,a.y-this.l.y)}}};Ok.className="OverviewDraggingTool";
function Sk(){Ya(this);this.B=Ce;this.bb=this.I=this.u=!0;this.T=this.Ia=this.kd=this.Ja=!1;this.Ai=this.l=null;this.Yc=1.05;this.Ou=NaN;this.ix=null;this.nv=NaN;this.mv=ic;this.mg=null;this.Kc=200}Sk.prototype.toString=function(){return"CommandHandler"};Sk.prototype.$d=function(a){this.B=a};
Sk.prototype.doKeyDown=function(){var a=this.diagram,b=a.lastInput,c=Wa?b.meta:b.control,d=b.shift,e=b.alt,f=b.key;!c||"C"!==f&&"Insert"!==f?c&&"X"===f||d&&"Del"===f?this.canCutSelection()&&this.cutSelection():c&&"V"===f||d&&"Insert"===f?this.canPasteSelection()&&this.pasteSelection():c&&"Y"===f||e&&d&&"Backspace"===f?this.canRedo()&&this.redo():c&&"Z"===f||e&&"Backspace"===f?this.canUndo()&&this.undo():"Del"===f||"Backspace"===f?this.canDeleteSelection()&&this.deleteSelection():c&&"A"===f?this.canSelectAll()&&
this.selectAll():"Esc"===f?this.canStopCommand()&&this.stopCommand():"Up"===f?a.allowVerticalScroll&&(c?a.scroll("pixel","up"):a.scroll("line","up")):"Down"===f?a.allowVerticalScroll&&(c?a.scroll("pixel","down"):a.scroll("line","down")):"Left"===f?a.allowHorizontalScroll&&(c?a.scroll("pixel","left"):a.scroll("line","left")):"Right"===f?a.allowHorizontalScroll&&(c?a.scroll("pixel","right"):a.scroll("line","right")):"PageUp"===f?d&&a.allowHorizontalScroll?a.scroll("page","left"):a.allowVerticalScroll&&
a.scroll("page","up"):"PageDown"===f?d&&a.allowHorizontalScroll?a.scroll("page","right"):a.allowVerticalScroll&&a.scroll("page","down"):"Home"===f?c&&a.allowVerticalScroll?a.scroll("document","up"):!c&&a.allowHorizontalScroll&&a.scroll("document","left"):"End"===f?c&&a.allowVerticalScroll?a.scroll("document","down"):!c&&a.allowHorizontalScroll&&a.scroll("document","right"):" "===f?this.canScrollToPart()&&this.scrollToPart():"Subtract"===f?this.canDecreaseZoom()&&this.decreaseZoom():"Add"===f?this.canIncreaseZoom()&&
this.increaseZoom():c&&"0"===f?this.canResetZoom()&&this.resetZoom():d&&"Z"===f?this.canZoomToFit()&&this.zoomToFit():c&&!d&&"G"===f?this.canGroupSelection()&&this.groupSelection():c&&d&&"G"===f?this.canUngroupSelection()&&this.ungroupSelection():b.event&&113===b.event.which?this.canEditTextBlock()&&this.editTextBlock():b.event&&93===b.event.which?this.canShowContextMenu()&&this.showContextMenu():b.bubbles=!0:this.canCopySelection()&&this.copySelection()};
Sk.prototype.doKeyUp=function(){this.diagram.lastInput.bubbles=!0};Sk.prototype.stopCommand=function(){var a=this.diagram,b=a.currentTool;b instanceof Oa&&a.allowSelect&&a.clearSelection();null!==b&&b.doCancel()};Sk.prototype.canStopCommand=function(){return!0};
Sk.prototype.selectAll=function(){var a=this.diagram;a.M();try{a.currentCursor="wait";a.R("ChangingSelection",a.selection);for(var b=a.parts;b.next();)b.value.isSelected=!0;for(var c=a.nodes;c.next();)c.value.isSelected=!0;for(var d=a.links;d.next();)d.value.isSelected=!0}finally{a.R("ChangedSelection",a.selection),a.currentCursor=""}};Sk.prototype.canSelectAll=function(){return this.diagram.allowSelect};
Sk.prototype.deleteSelection=function(){var a=this.diagram;try{a.currentCursor="wait";a.R("ChangingSelection",a.selection);a.ua("Delete");a.R("SelectionDeleting",a.selection);for(var b=new F,c=a.selection.iterator;c.next();)Tk(b,c.value,!0,this.deletesTree?Infinity:0,this.deletesConnectedLinks?null:!1,function(a){return a.canDelete()});a.Ut(b,!0);a.R("SelectionDeleted",b)}finally{a.Va("Delete"),a.R("ChangedSelection",a.selection),a.currentCursor=""}};
Sk.prototype.canDeleteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowDelete||0===a.selection.count?!1:!0};Sk.prototype.copySelection=function(){var a=this.diagram,b=new F;for(a=a.selection.iterator;a.next();)Tk(b,a.value,!0,this.copiesTree?Infinity:0,this.copiesConnectedLinks,function(a){return a.canCopy()});this.copyToClipboard(b)};Sk.prototype.canCopySelection=function(){var a=this.diagram;return a.allowCopy&&a.allowClipboard&&0!==a.selection.count?!0:!1};
Sk.prototype.cutSelection=function(){this.copySelection();this.deleteSelection()};Sk.prototype.canCutSelection=function(){var a=this.diagram;return!a.isReadOnly&&!a.isModelReadOnly&&a.allowCopy&&a.allowDelete&&a.allowClipboard&&0!==a.selection.count?!0:!1};
Sk.prototype.copyToClipboard=function(a){var b=this.diagram,c=null;if(null===a)Ii=null,Ji="";else{c=b.model;var d=!1,e=!1,f=null;try{c.rm()&&(d=c.dk,c.dk=this.copiesParentKey),c.kk()&&(e=c.ck,c.ck=this.copiesGroupKey),f=b.ek(a,null,!0)}finally{c.rm()&&(c.dk=d),c.kk()&&(c.ck=e),c=new E,c.addAll(f),Ii=c,Ji=b.model.dataFormat}}b.R("ClipboardChanged",c)};
Sk.prototype.pasteFromClipboard=function(){var a=new F,b=Ii;if(null===b)return a;var c=this.diagram;if(Ji!==c.model.dataFormat)return a;var d=c.model,e=!1,f=!1,g=null;try{d.rm()&&(e=d.dk,d.dk=this.copiesParentKey),d.kk()&&(f=d.ck,d.ck=this.copiesGroupKey),g=c.ek(b,c,!1)}finally{for(d.rm()&&(d.dk=e),d.kk()&&(d.ck=f),b=g.iterator;b.next();)c=b.value,d=b.key,c.location.v()||(d.location.v()?c.location=d.location:!c.position.v()&&d.position.v()&&(c.position=d.position)),a.add(c)}return a};
Sk.prototype.pasteSelection=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.currentCursor="wait";b.R("ChangingSelection",b.selection);b.ua("Paste");var c=this.pasteFromClipboard();0<c.count&&b.clearSelection(!0);for(var d=c.iterator;d.next();)d.value.isSelected=!0;if(null!==a){var e=b.computePartsBounds(b.selection);if(e.v()){var f=this.computeEffectiveCollection(b.selection,b.Sk);rf(b,f,new I(a.x-e.centerX,a.y-e.centerY),b.Sk,!1)}}b.R("ClipboardPasted",c)}finally{b.Va("Paste"),b.R("ChangedSelection",
b.selection),b.currentCursor=""}};Sk.prototype.canPasteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowClipboard||null===Ii||0===Ii.count||Ji!==a.model.dataFormat?!1:!0};Sk.prototype.undo=function(){this.diagram.undoManager.undo()};Sk.prototype.canUndo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canUndo()};Sk.prototype.redo=function(){this.diagram.undoManager.redo()};
Sk.prototype.canRedo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canRedo()};Sk.prototype.decreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);var b=this.diagram;b.autoScale===Hh&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};Sk.prototype.canDecreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);var b=this.diagram;if(b.autoScale!==Hh)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};
Sk.prototype.increaseZoom=function(a){void 0===a&&(a=this.zoomFactor);var b=this.diagram;b.autoScale===Hh&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};Sk.prototype.canIncreaseZoom=function(a){void 0===a&&(a=this.zoomFactor);var b=this.diagram;if(b.autoScale!==Hh)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};Sk.prototype.resetZoom=function(a){void 0===a&&(a=this.defaultScale);var b=this.diagram;a<b.minScale||a>b.maxScale||(b.scale=a)};
Sk.prototype.canResetZoom=function(a){void 0===a&&(a=this.defaultScale);var b=this.diagram;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};Sk.prototype.zoomToFit=function(){var a=this.diagram,b=a.animationManager;b.Xc();a.Zd();var c=a.position,d=a.scale;Bh(b,"Zoom To Fit");d===this.nv&&!isNaN(this.Ou)&&a.documentBounds.w(this.mv)?(a.scale=this.Ou,a.position=this.ix,this.nv=NaN,this.mv=ic):(this.Ou=d,this.ix=c.copy(),a.zoomToFit(),this.nv=a.scale,this.mv=a.documentBounds.copy());Dh(b)};
Sk.prototype.canZoomToFit=function(){return this.diagram.allowZoom};
Sk.prototype.scrollToPart=function(a){void 0===a&&(a=null);var b=this.diagram;Li(b);if(null===a){try{null!==this.mg&&(this.mg.next()?a=this.mg.value:this.mg=null)}catch(k){this.mg=null}null===a&&(0<b.highlighteds.count?this.mg=b.highlighteds.iterator:0<b.selection.count&&(this.mg=b.selection.iterator),null!==this.mg&&this.mg.next()&&(a=this.mg.value))}if(null!==a){var c=b.animationManager;Bh(c,"Scroll To Part");var d=this.scrollToPartPause;if(0<d){var e=Uk(this,a,[a]);if(1===e.length)b.ua(),b.nt(a.actualBounds),
b.Va("Scroll To Part");else{var f=function(){b.ua();for(var a=e.pop();0<e.length&&a instanceof V&&a.isTreeExpanded&&(!(a instanceof uf)||a.isSubGraphExpanded);)a=e.pop();0<e.length?(a instanceof T&&b.mw(a.actualBounds),a instanceof V&&!a.isTreeExpanded&&(a.isTreeExpanded=!0),a instanceof uf&&!a.isSubGraphExpanded&&(a.isSubGraphExpanded=!0)):(a instanceof T&&b.nt(a.actualBounds),b.zm("LayoutCompleted",g));b.Va("Scroll To Part")},g=function(){sa(f,(c.isEnabled?c.duration:0)+d)};b.Xj("LayoutCompleted",
g);f()}}else{var h=b.position.copy();b.nt(a.actualBounds);h.Ma(b.position)&&c.Xc()}}};
function Uk(a,b,c){if(b.isVisible())return c;if(b instanceof Ke)Uk(a,b.adornedPart,c);else if(b instanceof S){var d=b.fromNode;null!==d&&Uk(a,d,c);b=b.toNode;null!==b&&Uk(a,b,c)}else b instanceof V&&(d=b.labeledLink,null!==d&&Uk(a,d,c),d=b.yg(),null!==d&&(d.isTreeExpanded||d.wasTreeExpanded||c.push(d),Uk(a,d,c))),b=b.containingGroup,null!==b&&(b.isSubGraphExpanded||b.wasSubGraphExpanded||c.push(b),Uk(a,b,c));return c}
Sk.prototype.canScrollToPart=function(a){void 0===a&&(a=null);if(null!==a&&!(a instanceof T))return!1;a=this.diagram;return 0===a.selection.count&&0===a.highlighteds.count?!1:a.allowHorizontalScroll&&a.allowVerticalScroll};
Sk.prototype.collapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.ua("Collapse Tree");Bh(b.animationManager,"Collapse Tree");var c=new E;if(null!==a&&a.isTreeExpanded)a.collapseTree(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof V&&e.isTreeExpanded&&(e.collapseTree(),c.add(e))}b.R("TreeCollapsed",c)}finally{b.Va("Collapse Tree")}};
Sk.prototype.canCollapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a){if(!(a instanceof V&&a.isTreeExpanded))return!1;if(0<a.tq().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof V&&b.isTreeExpanded&&0<b.tq().count)return!0;return!1};
Sk.prototype.expandTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.ua("Expand Tree");Bh(b.animationManager,"Expand Tree");var c=new E;if(null!==a&&!a.isTreeExpanded)a.expandTree(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof V&&!e.isTreeExpanded&&(e.expandTree(),c.add(e))}b.R("TreeExpanded",c)}finally{b.Va("Expand Tree")}};
Sk.prototype.canExpandTree=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a){if(!(a instanceof V)||a.isTreeExpanded)return!1;if(0<a.tq().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof V&&!b.isTreeExpanded&&0<b.tq().count)return!0;return!1};
Sk.prototype.groupSelection=function(){var a=this.diagram,b=a.model;if(b.lk()){var c=this.archetypeGroupData;if(null!==c){var d=null;try{a.currentCursor="wait";a.R("ChangingSelection",a.selection);a.ua("Group");for(var e=new E,f=a.selection.iterator;f.next();){var g=f.value;g.Wb()&&g.canGroup()&&e.add(g)}for(var h=new E,k=e.iterator;k.next();){var l=k.value;f=!1;for(var m=e.iterator;m.next();)if(l.yd(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.yd(n)){e=!0;break}if(e)n=n.containingGroup;else break}if(c instanceof uf)wg(c),d=c.copy(),null!==d&&a.add(d);else if(b.Rv(c)){var r=b.copyNodeData(c);za(r)&&(b.pf(r),d=a.Wi(r))}if(null!==d){null!==n&&this.isValidMember(n,d)&&(d.containingGroup=n);for(var q=h.iterator;q.next();){var u=q.value;this.isValidMember(d,u)&&(u.containingGroup=d)}a.clearSelection(!0);d.isSelected=!0}}a.R("SelectionGrouped",d)}finally{a.Va("Group"),a.R("ChangedSelection",
a.selection),a.currentCursor=""}}}};Sk.prototype.canGroupSelection=function(){var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowGroup||!a.model.lk()||null===this.archetypeGroupData)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.Wb()&&b.canGroup())return!0}return!1};
function Vk(a){var b=Fa();for(a=a.iterator;a.next();){var c=a.value;c instanceof S||b.push(c)}a=new F;c=b.length;for(var d=0;d<c;d++){for(var e=b[d],f=!0,g=0;g<c;g++)if(e.yd(b[g])){f=!1;break}f&&a.add(e)}Ha(b);return a}
Sk.prototype.isValidMember=function(a,b){if(null===b||a===b||b instanceof S)return!1;if(null!==a){if(a===b||a.yd(b))return!1;var c=a.memberValidation;if(null!==c&&!c(a,b)||null===a.data&&null!==b.data||null!==a.data&&null===b.data)return!1}c=this.memberValidation;return null!==c?c(a,b):!0};
Sk.prototype.ungroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.model;if(c.lk())try{b.currentCursor="wait";b.R("ChangingSelection",b.selection);b.ua("Ungroup");var d=new E;if(null!==a)d.add(a);else for(var e=b.selection.iterator;e.next();){var f=e.value;f instanceof uf&&f.canUngroup()&&d.add(f)}var g=new E;if(0<d.count){b.clearSelection(!0);for(var h=d.iterator;h.next();){var k=h.value;k.expandSubGraph();var l=k.containingGroup,m=null!==l&&null!==l.data?c.ja(l.data):void 0;g.addAll(k.memberParts);
for(var n=g.iterator;n.next();){var p=n.value;p.isSelected=!0;if(!(p instanceof S)){var r=p.data;null!==r?c.Sq(r,m):p.containingGroup=l}}b.remove(k)}}b.R("SelectionUngrouped",d,g)}finally{b.Va("Ungroup"),b.R("ChangedSelection",b.selection),b.currentCursor=""}};
Sk.prototype.canUngroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly||b.isModelReadOnly||!b.allowDelete||!b.allowUngroup||!b.model.lk())return!1;if(null!==a){if(!(a instanceof uf))return!1;if(a.canUngroup())return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof uf&&b.canUngroup())return!0;return!1};
Sk.prototype.addTopLevelParts=function(a,b){var c=!0;for(a=Vk(a).iterator;a.next();){var d=a.value;null!==d.containingGroup&&(!b||this.isValidMember(null,d)?d.containingGroup=null:c=!1)}return c};
Sk.prototype.collapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.ua("Collapse SubGraph");Bh(b.animationManager,"Collapse SubGraph");var c=new E;if(null!==a&&a.isSubGraphExpanded)a.collapseSubGraph(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof uf&&e.isSubGraphExpanded&&(e.collapseSubGraph(),c.add(e))}b.R("SubGraphCollapsed",c)}finally{b.Va("Collapse SubGraph")}};
Sk.prototype.canCollapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof uf&&a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof uf&&b.isSubGraphExpanded)return!0;return!1};
Sk.prototype.expandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.ua("Expand SubGraph");Bh(b.animationManager,"Expand SubGraph");var c=new E;if(null!==a&&!a.isSubGraphExpanded)a.expandSubGraph(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof uf&&!e.isSubGraphExpanded&&(e.expandSubGraph(),c.add(e))}b.R("SubGraphExpanded",c)}finally{b.Va("Expand SubGraph")}};
Sk.prototype.canExpandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof uf&&!a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof uf&&!b.isSubGraphExpanded)return!0;return!1};
Sk.prototype.editTextBlock=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.toolManager.findTool("TextEditing");if(null!==c){if(null===a){a=null;for(var d=b.selection.iterator;d.next();){var e=d.value;if(e.canEdit()){a=e;break}}if(null===a)return;a=a.jm(function(a){return a instanceof Ug&&a.editable})}null!==a&&(b.currentTool=null,c.textBlock=a,b.currentTool=c)}};
Sk.prototype.canEditTextBlock=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly||b.isModelReadOnly||!b.allowTextEdit||null===b.toolManager.findTool("TextEditing"))return!1;if(null!==a){if(!(a instanceof Ug))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.jm(function(a){return a instanceof Ug&&a.editable}),null!==a))return!0;return!1};
Sk.prototype.showContextMenu=function(a){var b=this.diagram,c=b.toolManager.findTool("ContextMenu");if(null!==c&&(void 0===a&&(a=0<b.selection.count?b.selection.first():b),a=c.findObjectWithContextMenu(a),null!==a)){var d=b.lastInput,e=null;a instanceof Y?e=a.ga(Ac):b.viewportBounds.aa(d.documentPoint)||(e=b.viewportBounds,e=new I(e.x+e.width/2,e.y+e.height/2));null!==e&&(d.viewPoint=b.Wq(e),d.documentPoint=e,d.left=!1,d.right=!0,d.up=!0);b.currentTool=c;Qg(c,!1,a)}};
Sk.prototype.canShowContextMenu=function(a){var b=this.diagram,c=b.toolManager.findTool("ContextMenu");if(null===c)return!1;void 0===a&&(a=0<b.selection.count?b.selection.first():b);return null===c.findObjectWithContextMenu(a)?!1:!0};
Sk.prototype.computeEffectiveCollection=function(a,b){var c=this.diagram,d=c.toolManager.findTool("Dragging"),e=c.currentTool===d;void 0===b&&(b=e?d.dragOptions:c.Sk);d=new H;if(null===a)return d;for(var f=a.iterator;f.next();)Oj(c,d,f.value,e,b);if(null!==c.draggedLink&&b.dragsLink)return d;for(f=a.iterator;f.next();)a=f.value,a instanceof S&&(b=a.fromNode,null===b||d.contains(b)?(b=a.toNode,null===b||d.contains(b)||d.remove(a)):d.remove(a));return d};
ma.Object.defineProperties(Sk.prototype,{diagram:{get:function(){return this.B}},copiesClipboardData:{get:function(){return this.u},set:function(a){this.u=a}},copiesConnectedLinks:{get:function(){return this.I},set:function(a){this.I=a}},deletesConnectedLinks:{get:function(){return this.bb},set:function(a){this.bb=a}},copiesTree:{get:function(){return this.Ja},
set:function(a){this.Ja=a}},deletesTree:{get:function(){return this.kd},set:function(a){this.kd=a}},copiesParentKey:{get:function(){return this.Ia},set:function(a){this.Ia=a}},copiesGroupKey:{get:function(){return this.T},set:function(a){this.T=a}},archetypeGroupData:{get:function(){return this.l},set:function(a){this.l=a}},memberValidation:{get:function(){return this.Ai},
set:function(a){this.Ai=a}},defaultScale:{get:function(){return this.diagram.defaultScale},set:function(a){this.diagram.defaultScale=a}},zoomFactor:{get:function(){return this.Yc},set:function(a){1<a||B("zoomFactor must be larger than 1.0, not: "+a);this.Yc=a}},scrollToPartPause:{get:function(){return this.Kc},set:function(a){this.Kc=a}}});Sk.className="CommandHandler";vi=function(){return new Sk};
function Y(){Ya(this);this.F=4225027;this.rb=1;this.kg=null;this.Qa="";this.dc=this.jb=null;this.ma=(new I(NaN,NaN)).freeze();this.Nc=Rb;this.bg=Lb;this.ag=Qb;this.nb=new qd;this.Sh=new qd;this.Zf=new qd;this.ya=this.Yk=1;this.Yb=0;this.ye=Wk;this.bh=sc;this.oc=(new N(NaN,NaN,NaN,NaN)).freeze();this.wb=(new N(NaN,NaN,NaN,NaN)).freeze();this.pc=(new N(0,0,NaN,NaN)).freeze();this.O=this.ip=this.jp=null;this.Hk=this.xb=$c;this.vp=0;this.wp=1;this.Lg=0;this.ln=1;this.Pp=null;this.Cp=-Infinity;this.Jl=
0;this.Kl=Gb;this.Ll=ag;this.hi="";this.cb=this.N=null;this.Lk=-1;this.Nl=this.md=this.gi=this.Rl=null;this.Gs=xg;this.yp=this.Gg=this.Mj=null}var ud,xg,zg,Wk,Xk,Yk,Zk,$k,al,bl;
Y.prototype.cloneProtected=function(a){a.F=this.F|6144;a.rb=this.rb;a.Qa=this.Qa;a.jb=this.jb;a.dc=this.dc;a.Gg=this.Gg;a.ma.assign(this.ma);a.Nc=this.Nc.G();a.bg=this.bg.G();a.ag=this.ag.G();a.Zf=this.Zf.copy();a.ya=this.ya;a.Yb=this.Yb;a.ye=this.ye;a.bh=this.bh.G();a.oc.assign(this.oc);a.wb.assign(this.wb);a.pc.assign(this.pc);a.ip=this.ip;null!==this.O&&(a.O=this.O.copy());a.xb=this.xb.G();a.Hk=this.Hk.G();a.vp=this.vp;a.wp=this.wp;a.Lg=this.Lg;a.ln=this.ln;a.Pp=this.Pp;a.Cp=this.Cp;a.Jl=this.Jl;
a.Kl=this.Kl.G();a.Ll=this.Ll;a.hi=this.hi;null!==this.N&&(a.N=this.N.copy());a.cb=this.cb;a.Lk=this.Lk;null!==this.gi&&(a.gi=Ba(this.gi));null!==this.md&&(a.md=this.md.copy());a.Nl=this.Nl};Y.prototype.Ex=function(a){var b=this.gi;if(Aa(b))for(var c=0;c<b.length;c++){if(b[c]===a)return}else this.gi=b=[];b.push(a)};Y.prototype.sf=function(a){a.jp=null;a.Mj=null;a.o()};
Y.prototype.clone=function(){var a=new this.constructor;this.cloneProtected(a);if(null!==this.gi)for(var b=0;b<this.gi.length;b++){var c=this.gi[b];a[c]=this[c]}return a};Y.prototype.copy=function(){return this.clone()};t=Y.prototype;t.gb=function(a){a.classType===S?0===a.name.indexOf("Orient")?this.segmentOrientation=a:B("Unknown Link enum value for GraphObject.segmentOrientation property: "+a):a.classType===Y&&(this.stretch=a)};t.toString=function(){return Ia(this.constructor)+"#"+lb(this)};
function cl(a){null===a.N&&(a.N=new dl)}t.Gc=function(){if(null===this.O){var a=new el;a.Vg=uc;a.vh=uc;a.Tg=10;a.th=10;a.Ug=0;a.uh=0;this.O=a}};
t.$a=function(a,b,c,d,e,f,g){var h=this.part;if(null!==h&&(h.xk(a,b,c,d,e,f,g),c===this&&a===ue&&fl(this)&&gl(this,h,b),f=this.diagram,null===this.Gg||null===f||!f.mk||f.undoManager.isUndoingRedoing||f.currentTool!==f.toolManager||f.animationManager.fn||(a=this.Gg.get(b),null!==a&&f.animationManager.isEnabled&&!f.animationManager.isTicking&&(null===this.yp&&(this.yp=new H),g=0===f.undoManager.transactionLevel,a.startCondition===ei?g=!0:a.startCondition===gi&&(g=!1),g?(f=new Ah,fi(a,f),g=this.yp.get(a),
null!==g&&g.stop(),this.yp.add(a,f),f.jv=this,f.yx=a,f.add(this,b,d,e),f.start()):(Ch(f.animationManager,"Trigger"),f.animationManager.defaultAnimation.add(this,b,d,e)))),this instanceof X&&c===h&&0!==(h.F&16777216)&&null!==h.data))for(c=this.W.j,d=c.length,e=0;e<d;e++)h=c[e],h instanceof X&&Gj(h,function(a){null!==a.data&&0!==(a.F&16777216)&&a.Ba(b)})};
function gl(a,b,c){var d=a.Yi();if(null!==d)for(var e=a.cb.iterator;e.next();){var f=e.value,g=null;if(null!==f.sourceName){g=hl(f,d,a);if(null===g)continue;f.Zq(a,g,c,null)}else if(f.isToModel){var h=b.diagram;null===h||h.skipsModelSourceBindings||f.Zq(a,h.model.modelData,c,d)}else{h=d.data;if(null===h)continue;var k=b.diagram;null===k||k.skipsModelSourceBindings||f.Zq(a,h,c,d)}g===a&&(h=d.tt(f.jj),null!==h&&f.Ew(h,g,c))}}t.tt=function(a){return this.Lk===a?this:null};
t.g=function(a,b,c){this.$a(ue,a,this,b,c)};function il(a,b,c,d,e){var f=a.oc,g=a.Zf;g.reset();jl(a,g,b,c,d,e);a.Zf=g;f.h(b,c,d,e);g.Ft()||g.Bw(f)}function kl(a,b,c,d){if(!1===a.pickable)return!1;d.multiply(a.transform);return c?a.Ic(b,d):a.Dh(b,d)}
t.Wx=function(a,b,c){if(!1===this.pickable)return!1;var d=this.naturalBounds;b=a.De(b);return c?Bb(a.x,a.y,0,0,0,d.height)<=b||Bb(a.x,a.y,0,d.height,d.width,d.height)<=b||Bb(a.x,a.y,d.width,d.height,d.width,0)<=b||Bb(a.x,a.y,d.width,0,0,0)<=b:a.dd(0,0)<=b&&a.dd(0,d.height)<=b&&a.dd(d.width,0)<=b&&a.dd(d.width,d.height)<=b};t.ce=function(){return!0};
t.aa=function(a){var b=I.alloc();b.assign(a);this.transform.ra(b);var c=this.actualBounds;if(!c.v())return I.free(b),!1;var d=this.diagram;if(null!==d&&d.me){var e=d.om("extraTouchThreshold"),f=d.om("extraTouchArea"),g=f/2,h=this.naturalBounds;d=this.uf()*d.scale;var k=1/d;if(h.width*d<e&&h.height*d<e)return a=fc(c.x-g*k,c.y-g*k,c.width+f*k,c.height+f*k,b.x,b.y),I.free(b),a}e=!1;if(this instanceof Ke||this instanceof W?fc(c.x-5,c.y-5,c.width+10,c.height+10,b.x,b.y):c.aa(b))this.md&&!this.md.aa(b)?
e=!1:null!==this.dc&&c.aa(b)?e=!0:null!==this.jb&&this.pc.aa(a)?e=!0:e=this.Eh(a);I.free(b);return e};t.Eh=function(a){var b=this.naturalBounds;return fc(0,0,b.width,b.height,a.x,a.y)};
t.Ce=function(a){if(0===this.angle)return this.actualBounds.Ce(a);var b=this.naturalBounds;b=N.allocAt(0,0,b.width,b.height);var c=this.transform,d=!1,e=I.allocAt(a.x,a.y);b.aa(c.Xd(e))&&(e.h(a.x,a.bottom),b.aa(c.Xd(e))&&(e.h(a.right,a.bottom),b.aa(c.Xd(e))&&(e.h(a.right,a.y),b.aa(c.Xd(e))&&(d=!0))));I.free(e);N.free(b);return d};
t.Dh=function(a,b){if(void 0===b)return a.Ce(this.actualBounds);var c=this.naturalBounds,d=!1,e=I.allocAt(0,0);a.aa(b.ra(e))&&(e.h(0,c.height),a.aa(b.ra(e))&&(e.h(c.width,c.height),a.aa(b.ra(e))&&(e.h(c.width,0),a.aa(b.ra(e))&&(d=!0))));I.free(e);return d};
t.Ic=function(a,b){if(void 0===b&&(b=this.transform,0===this.angle))return a.Ic(this.actualBounds);var c=this.naturalBounds,d=I.allocAt(0,0),e=I.allocAt(0,c.height),f=I.allocAt(c.width,c.height),g=I.allocAt(c.width,0),h=!1;if(a.aa(b.ra(d))||a.aa(b.ra(e))||a.aa(b.ra(f))||a.aa(b.ra(g)))h=!0;else{c=N.allocAt(0,0,c.width,c.height);var k=I.allocAt(a.x,a.y);c.aa(b.Xd(k))?h=!0:(k.h(a.x,a.bottom),c.aa(b.Xd(k))?h=!0:(k.h(a.right,a.bottom),c.aa(b.Xd(k))?h=!0:(k.h(a.right,a.y),c.aa(b.Xd(k))&&(h=!0))));I.free(k);
N.free(c);!h&&(K.Ct(a,d,e)||K.Ct(a,e,f)||K.Ct(a,f,g)||K.Ct(a,g,d))&&(h=!0)}I.free(d);I.free(e);I.free(f);I.free(g);return h};t.ga=function(a,b){void 0===b&&(b=new I);if(a instanceof P){var c=this.naturalBounds;b.h(a.x*c.width+a.offsetX,a.y*c.height+a.offsetY)}else b.set(a);this.wd.ra(b);return b};
t.nm=function(a){void 0===a&&(a=new N);var b=this.naturalBounds,c=this.wd,d=I.allocAt(0,0).transform(c);a.h(d.x,d.y,0,0);d.h(b.width,0).transform(c);ec(a,d.x,d.y,0,0);d.h(b.width,b.height).transform(c);ec(a,d.x,d.y,0,0);d.h(0,b.height).transform(c);ec(a,d.x,d.y,0,0);I.free(d);return a};t.aj=function(){var a=this.wd;1===a.m11&&0===a.m12?a=0:(a=180*Math.atan2(a.m12,a.m11)/Math.PI,0>a&&(a+=360));return a};
t.uf=function(){if(0!==(this.F&4096)===!1)return this.Yk;var a=this.ya;return null!==this.panel?a*this.panel.uf():a};t.zt=function(a,b){void 0===b&&(b=new I);b.assign(a);this.wd.Xd(b);return b};t.Vc=function(a,b,c){return this.jk(a.x,a.y,b.x,b.y,c)};
t.jk=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.Vc(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.Vc(0,0,d.width,d.height,g,a,b,c,e);e.transform(f);return c};
Y.prototype.measure=function(a,b,c,d){if(!1!==tj(this)){var e=this.bh,f=e.right+e.left;e=e.top+e.bottom;a=Math.max(a-f,0);b=Math.max(b-e,0);c=Math.max((c||0)-f,0);d=Math.max((d||0)-e,0);f=this.angle;e=this.desiredSize;var g=0;this instanceof W&&(g=this.strokeWidth);90===f||270===f?(a=isFinite(e.height)?e.height+g:a,b=isFinite(e.width)?e.width+g:b):(a=isFinite(e.width)?e.width+g:a,b=isFinite(e.height)?e.height+g:b);e=c||0;g=d||0;var h=this instanceof X;switch(ll(this,!0)){case xg:g=e=0;h&&(b=a=Infinity);
break;case ud:isFinite(a)&&a>c&&(e=a);isFinite(b)&&b>d&&(g=b);break;case Xk:isFinite(a)&&a>c&&(e=a);g=0;h&&(b=Infinity);break;case Yk: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.oc.ea();this.tm(a,b,c,d);this.oc.freeze();this.oc.v()||B("Non-real measuredBounds has been set. Object "+this+", measuredBounds: "+this.oc.toString());oj(this,!1)}};Y.prototype.tm=function(){};Y.prototype.yf=function(){return!1};
Y.prototype.arrange=function(a,b,c,d,e){this.nl();var f=N.alloc();f.assign(this.wb);this.wb.ea();!1===uj(this)?this.wb.h(a,b,c,d):this.Ch(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!==X.TableRow&&e.type!==X.TableColumn||(e=e.panel),null!==e&&(e=e.pc,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 Ug&&(a=this.naturalBounds,
this.ls>a.height||this.qb>a.width)))c=!0;this.F=c?this.F|256:this.F&-257;this.wb.v()||B("Non-real actualBounds has been set. Object "+this+", actualBounds: "+this.wb.toString());this.Pt(f,this.wb);ml(this,!1);N.free(f)};t=Y.prototype;t.Ch=function(){};
function nl(a,b,c,d,e){a.wb.h(b,c,d,e);if(!a.desiredSize.v()){var f=a.oc;c=a.bh;b=c.right+c.left;var g=c.top+c.bottom;c=f.width+b;f=f.height+g;d+=b;e+=g;b=ll(a,!0);c===d&&f===e&&(b=xg);switch(b){case xg:if(c>d||f>e)oj(a,!0),a.measure(c>d?d:c,f>e?e:f,0,0);break;case ud:oj(a,!0);a.measure(d,e,0,0);break;case Xk:oj(a,!0);a.measure(d,f,0,0);break;case Yk:oj(a,!0),a.measure(c,e,0,0)}}}
t.Pt=function(a,b){var c=this.part;null!==c&&null!==c.diagram&&(c.selectionObject!==this&&c.resizeObject!==this&&c.rotateObject!==this||ol(c,!0),this.M(),$b(a,b)||(c.Ih(),this.Yo(c)))};t.Yo=function(a){null!==this.portId&&(ol(a,!0),a instanceof V&&pl(a,this))};
t.bc=function(a,b){if(this.visible){var c=this instanceof X&&(this.type===X.TableRow||this.type===X.TableColumn),d=this.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.Rx(a,b))if(c)ql(this,a,b);else{this instanceof S&&this.qk(!1);c=this.transform;var g=this.panel;0!==(this.F&4096)===!0&&rl(this);var h=this.part,k=!1,l=0;if(h&&b.Ee("drawShadows")&&(k=h.isShadowed)){var m=h.shadowOffset;l=Math.max(m.y,
m.x)*b.scale*b.Sb}if(!(m=b.pi||!this.yf())){var n=this.naturalBounds;m=this.Sh;var p=m.m11,r=m.m21,q=m.dx,u=m.m12,v=m.m22,w=m.dy,y,z=y=0;m=y*p+z*r+q;var A=y*u+z*v+w;y=n.width+l;z=0;var C=y*p+z*r+q;y=y*u+z*v+w;z=Math.min(m,C);var G=Math.min(A,y);var L=Math.max(m+0,C)-z;var J=Math.max(A+0,y)-G;m=z;A=G;y=n.width+l;z=n.height+l;C=y*p+z*r+q;y=y*u+z*v+w;z=Math.min(m,C);G=Math.min(A,y);L=Math.max(m+L,C)-z;J=Math.max(A+J,y)-G;m=z;A=G;y=0;z=n.height+l;C=y*p+z*r+q;y=y*u+z*v+w;z=Math.min(m,C);G=Math.min(A,y);
L=Math.max(m+L,C)-z;J=Math.max(A+J,y)-G;m=z;A=G;l=b.viewportBounds;n=l.x;p=l.y;m=!(m>l.width+n||n>L+m||A>l.height+p||p>J+A)}if(m){m=0!==(this.F&256);a.clipInsteadOfFill&&(m=!1);this instanceof Ug&&(a.font=this.font);if(m){A=g.ce()?g.naturalBounds:g.actualBounds;null!==this.md?(n=this.md,L=n.x,J=n.y,l=n.width,n=n.height):(L=Math.max(d.x,A.x),J=Math.max(d.y,A.y),l=Math.min(d.right,A.right)-L,n=Math.min(d.bottom,A.bottom)-J);if(L>d.width+d.x||d.x>A.width+A.x){1!==e&&(a.globalAlpha=f);return}a.save();
a.beginPath();a.rect(L,J,l,n);a.clip()}if(this.yf()){if(!h.isVisible()){1!==e&&(a.globalAlpha=f);return}k&&(A=h.shadowOffset,a.uw(A.x*b.scale*b.Sb,A.y*b.scale*b.Sb,h.shadowBlur),sl(a),a.shadowColor=h.shadowColor)}!0===this.shadowVisible?sl(a):!1===this.shadowVisible&&tl(a);h=this.naturalBounds;null!==this.dc&&(li(this,a,this.dc,!0,!0,h,d),this.dc instanceof ul&&this.dc.type===vl?(a.beginPath(),a.rect(d.x,d.y,d.width,d.height),a.Wd(this.dc)):a.fillRect(d.x,d.y,d.width,d.height));a.transform(c.m11,
c.m12,c.m21,c.m22,c.dx,c.dy);k&&(null!==g&&0!==(g.F&512)||null!==g&&(g.type===X.Auto||g.type===X.Spot)&&g.tb()!==this)&&null===this.shadowVisible&&tl(a);null!==this.jb&&(l=this.naturalBounds,L=A=0,J=l.width,l=l.height,n=0,this instanceof W&&(l=this.ka.bounds,A=l.x,L=l.y,J=l.width,l=l.height,n=this.strokeWidth),li(this,a,this.jb,!0,!1,h,d),this.jb instanceof ul&&this.jb.type===vl?(a.beginPath(),a.rect(A-n/2,L-n/2,J+n,l+n),a.Wd(this.jb)):a.fillRect(A-n/2,L-n/2,J+n,l+n));k&&(null!==this.jb||null!==this.dc||
null!==g&&0!==(g.F&512)||null!==g&&(g.type===X.Auto||g.type===X.Spot)&&g.tb()!==this)?(wl(this,!0),null===this.shadowVisible&&tl(a)):wl(this,!1);this.Ui(a,b);k&&0!==(this.F&512)===!0&&sl(a);this.yf()&&k&&tl(a);m?(a.restore(),this instanceof X?a.sc(!0):a.sc(!1)):c.Ft()||(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.Rx=function(){return!1};
function ql(a,b,c){var d=a.wb,e=a.pc;null!==a.dc&&(li(a,b,a.dc,!0,!0,e,d),a.dc instanceof ul&&a.dc.type===vl?(b.beginPath(),b.rect(d.x,d.y,d.width,d.height),b.Wd(a.dc)):b.fillRect(d.x,d.y,d.width,d.height));null!==a.jb&&(li(a,b,a.jb,!0,!1,e,d),a.jb instanceof ul&&a.jb.type===vl?(b.beginPath(),b.rect(d.x,d.y,d.width,d.height),b.Wd(a.jb)):b.fillRect(d.x,d.y,d.width,d.height));a.Ui(b,c)}t.Ui=function(){};
function li(a,b,c,d,e,f,g){if(null!==c){var h=1,k=1;if("string"===typeof c)d?b.fillStyle=c:b.strokeStyle=c;else if(c.type===xl)d?b.fillStyle=c.color:b.strokeStyle=c.color;else{var l=0;a instanceof W&&(l=a.strokeWidth);h=f.width;k=f.height;e?(h=g.width,k=g.height):d||(h+=l,k+=l);if((f=b instanceof yl)&&c.fe&&(c.type===zl||c.Ok===h&&c.mu===k))var m=c.fe;else{var n=0,p=0,r=0,q=0,u=0,v=0;v=u=0;e?(u=g.x,v=g.y):d||(u-=l/2,v-=l/2);n=c.start.x*h+c.start.offsetX;p=c.start.y*k+c.start.offsetY;r=c.end.x*h+c.end.offsetX;
q=c.end.y*k+c.end.offsetY;n+=u;r+=u;p+=v;q+=v;if(c.type===Al)m=b.createLinearGradient(n,p,r,q);else if(c.type===vl)v=isNaN(c.endRadius)?Math.max(h,k)/2:c.endRadius,isNaN(c.startRadius)?(u=0,v=Math.max(h,k)/2):u=c.startRadius,m=b.createRadialGradient(n,p,u,r,q,v);else if(c.type===zl)try{m=b.createPattern(c.pattern,"repeat")}catch(y){m=null}if(c.type!==zl&&(e=c.colorStops,null!==e))for(e=e.iterator;e.next();)m.addColorStop(e.key,e.value);if(f&&(c.fe=m,null!==m&&(c.Ok=h,c.mu=k),null===m&&c.type===zl&&
-1!==c.Ok)){c.Ok=-1;var w=a.diagram;null!==w&&-1===c.Ok&&sa(function(){w.Zd()},600)}}d?b.fillStyle=m:b.strokeStyle=m}}}t.zg=function(a){if(a instanceof X)a:{if(this!==a&&null!==a)for(var b=this.panel;null!==b;){if(b===a){a=!0;break a}b=b.panel}a=!1}else a=!1;return a};t.zf=function(){if(!this.visible)return!1;var a=this.panel;return null!==a?a.zf():!0};t.Ag=function(){for(var a=this instanceof X?this:this.panel;null!==a&&a.isEnabled;)a=a.panel;return null===a};
function rl(a){if(0!==(a.F&2048)===!0){var b=a.nb;b.reset();if(!a.wb.v()||!a.oc.v()){Bl(a,!1);return}b.translate(a.wb.x-a.oc.x,a.wb.y-a.oc.y);if(1!==a.scale||0!==a.angle){var c=a.naturalBounds;jl(a,b,c.x,c.y,c.width,c.height)}Bl(a,!1);Cl(a,!0)}0!==(a.F&4096)===!0&&(b=a.panel,null===b?(a.Sh.set(a.nb),a.Yk=a.scale,Cl(a,!1)):null!==b.wd&&(c=a.Sh,c.reset(),b.ce()?c.multiply(b.Sh):null!==b.panel&&c.multiply(b.panel.Sh),c.multiply(a.nb),a.Yk=a.scale*b.Yk,Cl(a,!1)))}
function jl(a,b,c,d,e,f){1!==a.scale&&b.scale(a.scale);if(0!==a.Yb){var g=Ac;a.yf()&&a.locationSpot.hb()&&(g=a.locationSpot);var h=I.alloc();if(a instanceof T&&a.locationObject!==a)for(c=a.locationObject,d=c.naturalBounds,h.zk(d.x,d.y,d.width,d.height,g),c.Zf.ra(h),h.offset(-c.measuredBounds.x,-c.measuredBounds.y),g=c.panel;null!==g&&g!==a;)g.Zf.ra(h),h.offset(-g.measuredBounds.x,-g.measuredBounds.y),g=g.panel;else h.zk(c,d,e,f,g);b.rotate(a.Yb,h.x,h.y);I.free(h)}}
t.o=function(a){void 0===a&&(a=!1);if(!0!==tj(this)){oj(this,!0);ml(this,!0);var b=this.panel;null===b||a||b.o()}};t.qm=function(){!0!==tj(this)&&(oj(this,!0),ml(this,!0))};function Dl(a){if(!1===uj(a)){var b=a.panel;null!==b?b.o():a.yf()&&(b=a.diagram,null!==b&&(b.od.add(a),a instanceof V&&a.fd(),b.Bb()));ml(a,!0)}}t.nl=function(){0!==(this.F&2048)===!1&&(Bl(this,!0),Cl(this,!0))};t.Pv=function(){Cl(this,!0)};t.M=function(){var a=this.part;null!==a&&a.M()};
function ll(a,b){var c=a.stretch,d=a.panel;if(null!==d&&d.type===X.Table)return El(a,d.getRowDefinition(a.row),d.getColumnDefinition(a.column),b);if(null!==d&&d.type===X.Auto&&d.tb()===a)return Fl(a,ud,b);if(c===Wk){if(null!==d){if(d.type===X.Spot&&d.tb()===a)return Fl(a,ud,b);c=d.defaultStretch;return c===Wk?Fl(a,xg,b):Fl(a,c,b)}return Fl(a,xg,b)}return Fl(a,c,b)}
function El(a,b,c,d){var e=a.stretch;if(e!==Wk)return Fl(a,e,d);var f=e=null;switch(b.stretch){case Yk:f=!0;break;case ud:f=!0}switch(c.stretch){case Xk:e=!0;break;case ud:e=!0}b=a.panel.defaultStretch;null===e&&(e=b===Xk||b===ud);null===f&&(f=b===Yk||b===ud);return!0===e&&!0===f?Fl(a,ud,d):!0===e?Fl(a,Xk,d):!0===f?Fl(a,Yk,d):Fl(a,xg,d)}
function Fl(a,b,c){if(c)return b;if(b===xg)return xg;c=a.desiredSize;if(c.v())return xg;a=a.angle;if(!isNaN(c.width))if(90!==a&&270!==a){if(b===Xk)return xg;if(b===ud)return Yk}else{if(b===Yk)return xg;if(b===ud)return Xk}if(!isNaN(c.height))if(90!==a&&270!==a){if(b===Yk)return xg;if(b===ud)return Xk}else{if(b===Xk)return xg;if(b===ud)return Yk}return b}function wl(a,b){a.F=b?a.F|512:a.F&-513}function fl(a){return 0!==(a.F&1024)}function Gl(a,b){a.F=b?a.F|1024:a.F&-1025}
function Bl(a,b){a.F=b?a.F|2048:a.F&-2049}function Cl(a,b){a.F=b?a.F|4096:a.F&-4097}function tj(a){return 0!==(a.F&8192)}function oj(a,b){a.F=b?a.F|8192:a.F&-8193}function uj(a){return 0!==(a.F&16384)}function ml(a,b){a.F=b?a.F|16384:a.F&-16385}t.fj=function(a){this.kg=a};t.Zt=function(){};t.qw=function(a){this.ma.assign(a);Dl(this);return!0};t.Tq=function(a,b){if(this.ma.x!==a||this.ma.y!==b)this.ma.h(a,b),this.nl()};
function Hl(a){var b=a.part;if(b instanceof V&&(null!==a.portId||a===b.port)){var c=b.diagram;null===c||c.undoManager.isUndoingRedoing||pl(b,a)}}function Il(a){var b=a.diagram;null===b||b.undoManager.isUndoingRedoing||(a instanceof X?a instanceof V?a.fd():a.Nm(a,function(a){Hl(a)}):Hl(a))}t.bind=function(a){a.cd=this;var b=this.Yi();null!==b&&Jl(b)&&B("Cannot add a Binding to a template that has already been copied: "+a);null===this.cb&&(this.cb=new E);this.cb.add(a)};
t.Yi=function(){for(var a=this instanceof X?this:this.panel;null!==a;){if(null!==a.ei)return a;a=a.panel}return null};t.rw=function(a){Aj(this,a)};function Kl(a,b){b.cd=a;null===a.Gg&&(a.Gg=new H);a.Gg.add(b.propertyName,b)}
function Ll(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=Ml.H(a);"function"===typeof f?(c=Ba(arguments),d=f(c),za(d)||B('GraphObject.make invoked object builder "'+a+'", but it did not return an Object')):e=x.go[a]}null===d&&(void 0!==e&&null!==e&&e.constructor||B("GraphObject.make requires a class function or GoJS class name or name of an object builder, not: "+a),d=new e);e=1;if(d instanceof Q&&1<c.length){f=
d;var g=c[1];if("string"===typeof g||g instanceof HTMLDivElement)Hi(f,g),e++}for(;e<c.length;e++)f=c[e],void 0===f?B("Undefined value at argument "+e+" for object being constructed by GraphObject.make: "+d):Nl(d,f);return d}
function Nl(a,b){if("string"===typeof b)if(a instanceof Ug)a.text=b;else if(a instanceof W)a.figure=b;else if(a instanceof mk)a.source=b;else if(a instanceof X)b=Ol.H(b),null!==b&&(a.type=b);else if(a instanceof ul){var c=Za(ul,b);null!==c?a.type=c:B("Unknown Brush type as an argument to GraphObject.make: "+b)}else a instanceof sd?(b=Za(sd,b),null!==b&&(a.type=b)):a instanceof oe&&(b=Za(oe,b),null!==b&&(a.type=b));else if(b instanceof Y)a instanceof X||B("A GraphObject can only be added to a Panel, not to: "+
a),a.add(b);else if(b instanceof Uj){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 Uj?d.pt(b):B("A RowColumnDefinition can only be added to an object that implements getRowDefinition/getColumnDefinition, not to: "+a)}else if(b instanceof D)"function"===typeof a.gb&&a.gb(b);else if(b instanceof Pl)a.type=b;else if(b instanceof Mi)a instanceof Y?a.bind(b):a instanceof
Uj?a.bind(b):B("A Binding can only be applied to a GraphObject or RowColumnDefinition, not to: "+a);else if(b instanceof ci)a instanceof Y?Kl(a,b):B("An AnimationTrigger can only be applied to a GraphObject, not to: "+a);else if(b instanceof ge)a instanceof sd?a.figures.add(b):B("A PathFigure can only be added to a Geometry, not to: "+a);else if(b instanceof oe)a instanceof ge?a.segments.add(b):B("A PathSegment can only be added to a PathFigure, not to: "+a);else if(b instanceof Fi)a instanceof Q?
a.layout=b:a instanceof uf?a.layout=b:B("A Layout can only be assigned to a Diagram or a Group, not to: "+a);else if(Array.isArray(b))for(c=0;c<b.length;c++)Nl(a,b[c]);else if("object"===typeof b&&null!==b)if(a instanceof ul){c=new db;for(var e in b)d=parseFloat(e),isNaN(d)?c[e]=b[e]:a.addColorStop(d,b[e]);Aj(a,c)}else if(a instanceof Uj){void 0!==b.row?(e=b.row,(void 0===e||null===e||Infinity===e||isNaN(e)||0>e)&&B("Must specify non-negative integer row for RowColumnDefinition "+b+", not: "+e),a.isRow=
!0,a.index=e):void 0!==b.column&&(e=b.column,(void 0===e||null===e||Infinity===e||isNaN(e)||0>e)&&B("Must specify non-negative integer column for RowColumnDefinition "+b+", not: "+e),a.isRow=!1,a.index=e);e=new db;for(c in b)"row"!==c&&"column"!==c&&(e[c]=b[c]);Aj(a,e)}else Aj(a,b);else B('Unknown initializer "'+b+'" for object being constructed by GraphObject.make: '+a)}function Ql(a,b){Ml.add(a,b)}
function Rl(a,b,c){void 0===c&&(c=null);var d=a[1];if("function"===typeof c?c(d):"string"===typeof d)return a.splice(1,1),d;if(void 0===b)throw Error("no "+("function"===typeof c?"satisfactory":"string")+" argument for GraphObject builder "+a[0]);return b}
ma.Object.defineProperties(Y.prototype,{shadowVisible:{get:function(){return this.Nl},set:function(a){var b=this.Nl;b!==a&&(this.Nl=a,this.M(),this.g("shadowVisible",b,a))}},enabledChanged:{get:function(){return null!==this.N?this.N.In:null},set:function(a){cl(this);var b=this.N.In;b!==a&&(this.N.In=a,this.g("enabledChanged",b,a))}},segmentOrientation:{get:function(){return this.Ll},set:function(a){var b=this.Ll;
b!==a&&(this.Ll=a,this.o(),this.g("segmentOrientation",b,a),a===ag&&(this.angle=0))}},segmentIndex:{get:function(){return this.Cp},set:function(a){a=Math.round(a);var b=this.Cp;b!==a&&(this.Cp=a,this.o(),this.g("segmentIndex",b,a))}},segmentFraction:{get:function(){return this.Jl},set:function(a){isNaN(a)?a=0:0>a?a=0:1<a&&(a=1);var b=this.Jl;b!==a&&(this.Jl=a,this.o(),this.g("segmentFraction",b,a))}},segmentOffset:{
get:function(){return this.Kl},set:function(a){var b=this.Kl;b.w(a)||(this.Kl=a=a.G(),this.o(),this.g("segmentOffset",b,a))}},stretch:{get:function(){return this.ye},set:function(a){var b=this.ye;b!==a&&(this.ye=a,this.o(),this.g("stretch",b,a))}},name:{get:function(){return this.Qa},set:function(a){var b=this.Qa;b!==a&&(this.Qa=a,null!==this.part&&(this.part.Ij=null),this.g("name",b,a))}},opacity:{get:function(){return this.rb},
set:function(a){var b=this.rb;b!==a&&((0>a||1<a)&&va(a,"0 <= value <= 1",Y,"opacity"),this.rb=a,this.g("opacity",b,a),a=this.diagram,b=this.part,null!==a&&null!==b&&a.M(Ej(b,b.actualBounds)))}},visible:{get:function(){return 0!==(this.F&1)},set:function(a){var b=0!==(this.F&1);b!==a&&(this.F^=1,this.g("visible",b,a),b=this.panel,null!==b?b.o():this.yf()&&this.Pb(a),this.M(),Il(this))}},pickable:{get:function(){return 0!==(this.F&2)},set:function(a){var b=
0!==(this.F&2);b!==a&&(this.F^=2,this.g("pickable",b,a))}},fromLinkableDuplicates:{get:function(){return 0!==(this.F&4)},set:function(a){var b=0!==(this.F&4);b!==a&&(this.F^=4,this.g("fromLinkableDuplicates",b,a))}},fromLinkableSelfNode:{get:function(){return 0!==(this.F&8)},set:function(a){var b=0!==(this.F&8);b!==a&&(this.F^=8,this.g("fromLinkableSelfNode",b,a))}},toLinkableDuplicates:{get:function(){return 0!==
(this.F&16)},set:function(a){var b=0!==(this.F&16);b!==a&&(this.F^=16,this.g("toLinkableDuplicates",b,a))}},toLinkableSelfNode:{get:function(){return 0!==(this.F&32)},set:function(a){var b=0!==(this.F&32);b!==a&&(this.F^=32,this.g("toLinkableSelfNode",b,a))}},isPanelMain:{get:function(){return 0!==(this.F&64)},set:function(a){var b=0!==(this.F&64);b!==a&&(this.F^=64,this.o(),this.g("isPanelMain",b,a))}},isActionable:{
get:function(){return 0!==(this.F&128)},set:function(a){var b=0!==(this.F&128);b!==a&&(this.F^=128,this.g("isActionable",b,a))}},areaBackground:{get:function(){return this.dc},set:function(a){var b=this.dc;b!==a&&(null!==a&&Sl(a,"GraphObject.areaBackground"),a instanceof ul&&a.freeze(),this.dc=a,this.M(),this.g("areaBackground",b,a))}},background:{get:function(){return this.jb},set:function(a){var b=this.jb;b!==a&&(null!==a&&Sl(a,"GraphObject.background"),
a instanceof ul&&a.freeze(),this.jb=a,this.M(),this.g("background",b,a))}},part:{get:function(){if(this.yf())return this;if(null!==this.Mj)return this.Mj;var a;for(a=this.panel;a;){if(a instanceof T)return this.Mj=a;a=a.panel}return null}},svg:{get:function(){return this.Up},set:function(a){this.Up=a}},panel:{get:function(){return this.kg}},layer:{get:function(){var a=this.part;
return null!==a?a.layer:null}},diagram:{get:function(){var a=this.part;return null!==a?a.diagram:null}},position:{get:function(){return this.ma},set:function(a){var b=a.x,c=a.y,d=this.ma,e=d.x,f=d.y;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))?this.Zt():(a=a.copy(),this.qw(a,d)&&this.g("position",d.copy(),a.copy()))}},actualBounds:{get:function(){return this.wb}},scale:{
get:function(){return this.ya},set:function(a){var b=this.ya;b!==a&&(0>=a&&B("GraphObject.scale for "+this+" must be greater than zero, not: "+a),this.ya=a,this.o(),this.g("scale",b,a))}},angle:{get:function(){return this.Yb},set:function(a){var b=this.Yb;b!==a&&(a%=360,0>a&&(a+=360),b!==a&&(this.Yb=a,Il(this),this.o(),this.g("angle",b,a)))}},desiredSize:{get:function(){return this.Nc},set:function(a){var b=a.width,c=a.height,d=this.Nc,e=
d.width,f=d.height;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))||(this.Nc=a=a.G(),this.o(),this instanceof W&&this.cc(),this.g("desiredSize",d,a),fl(this)&&(a=this.part,null!==a&&(gl(this,a,"width"),gl(this,a,"height"))))}},width:{get:function(){return this.Nc.width},set:function(a){var b=this.Nc.width;b===a||isNaN(b)&&isNaN(a)||(b=this.Nc,this.Nc=a=(new M(a,this.Nc.height)).freeze(),this.o(),this instanceof W&&this.cc(),this.g("desiredSize",b,a),fl(this)&&
(a=this.part,null!==a&&gl(this,a,"width")))}},height:{get:function(){return this.Nc.height},set:function(a){var b=this.Nc.height;b===a||isNaN(b)&&isNaN(a)||(b=this.Nc,this.Nc=a=(new M(this.Nc.width,a)).freeze(),this.o(),this instanceof W&&this.cc(),this.g("desiredSize",b,a),fl(this)&&(a=this.part,null!==a&&gl(this,a,"height")))}},minSize:{get:function(){return this.bg},set:function(a){var b=this.bg;b.w(a)||(a=a.copy(),isNaN(a.width)&&(a.width=
0),isNaN(a.height)&&(a.height=0),a.freeze(),this.bg=a,this.o(),this.g("minSize",b,a))}},maxSize:{get:function(){return this.ag},set:function(a){var b=this.ag;b.w(a)||(a=a.copy(),isNaN(a.width)&&(a.width=Infinity),isNaN(a.height)&&(a.height=Infinity),a.freeze(),this.ag=a,this.o(),this.g("maxSize",b,a))}},measuredBounds:{get:function(){return this.oc}},naturalBounds:{get:function(){return this.pc}},margin:{
get:function(){return this.bh},set:function(a){"number"===typeof a&&(a=new oc(a));var b=this.bh;b.w(a)||(this.bh=a=a.G(),this.o(),this.g("margin",b,a))}},transform:{get:function(){0!==(this.F&2048)===!0&&rl(this);return this.nb}},wd:{get:function(){0!==(this.F&4096)===!0&&rl(this);return this.Sh}},alignment:{get:function(){return this.xb},set:function(a){var b=this.xb;b.w(a)||(a.kc()&&!a.Nb()&&
B("GraphObject.alignment for "+this+" must be a real Spot or Spot.Default, not: "+a),this.xb=a=a.G(),Dl(this),this.g("alignment",b,a))}},column:{get:function(){return this.Lg},set:function(a){a=Math.round(a);var b=this.Lg;b!==a&&(0>a&&va(a,">= 0",Y,"column"),this.Lg=a,this.o(),this.g("column",b,a))}},columnSpan:{get:function(){return this.ln},set:function(a){a=Math.round(a);var b=this.ln;b!==a&&(1>a&&va(a,">= 1",Y,"columnSpan"),this.ln=a,
this.o(),this.g("columnSpan",b,a))}},row:{get:function(){return this.vp},set:function(a){a=Math.round(a);var b=this.vp;b!==a&&(0>a&&va(a,">= 0",Y,"row"),this.vp=a,this.o(),this.g("row",b,a))}},rowSpan:{get:function(){return this.wp},set:function(a){a=Math.round(a);var b=this.wp;b!==a&&(1>a&&va(a,">= 1",Y,"rowSpan"),this.wp=a,this.o(),this.g("rowSpan",b,a))}},spanAllocation:{get:function(){return this.Pp},set:function(a){var b=
this.Pp;b!==a&&(this.Pp=a,this.o(),this.g("spanAllocation",b,a))}},alignmentFocus:{get:function(){return this.Hk},set:function(a){var b=this.Hk;b.w(a)||(this.Hk=a=a.G(),this.o(),this.g("alignmentFocus",b,a))}},portId:{get:function(){return this.ip},set:function(a){var b=this.ip;if(b!==a){var c=this.part;null===c||c instanceof V||(B("Cannot set portID on a Link: "+a),c=null);null!==b&&null!==c&&Tl(c,this);this.ip=a;null!==a&&null!==c&&(c.Hh=
!0,Ul(c,this));this.g("portId",b,a)}}},toSpot:{get:function(){return null!==this.O?this.O.vh:uc},set:function(a){this.Gc();var b=this.O.vh;b.w(a)||(a=a.G(),this.O.vh=a,this.g("toSpot",b,a),Hl(this))}},toEndSegmentLength:{get:function(){return null!==this.O?this.O.th:10},set:function(a){this.Gc();var b=this.O.th;b!==a&&(0>a&&va(a,">= 0",Y,"toEndSegmentLength"),this.O.th=a,this.g("toEndSegmentLength",b,a),Hl(this))}},toShortLength:{
get:function(){return null!==this.O?this.O.uh:0},set:function(a){this.Gc();var b=this.O.uh;b!==a&&(this.O.uh=a,this.g("toShortLength",b,a),Hl(this))}},toLinkable:{get:function(){return null!==this.O?this.O.Yp:null},set:function(a){this.Gc();var b=this.O.Yp;b!==a&&(this.O.Yp=a,this.g("toLinkable",b,a))}},toMaxLinks:{get:function(){return null!==this.O?this.O.Zp:Infinity},set:function(a){this.Gc();var b=this.O.Zp;b!==a&&(0>a&&
va(a,">= 0",Y,"toMaxLinks"),this.O.Zp=a,this.g("toMaxLinks",b,a))}},fromSpot:{get:function(){return null!==this.O?this.O.Vg:uc},set:function(a){this.Gc();var b=this.O.Vg;b.w(a)||(a=a.G(),this.O.Vg=a,this.g("fromSpot",b,a),Hl(this))}},fromEndSegmentLength:{get:function(){return null!==this.O?this.O.Tg:10},set:function(a){this.Gc();var b=this.O.Tg;b!==a&&(0>a&&va(a,">= 0",Y,"fromEndSegmentLength"),this.O.Tg=a,this.g("fromEndSegmentLength",
b,a),Hl(this))}},fromShortLength:{get:function(){return null!==this.O?this.O.Ug:0},set:function(a){this.Gc();var b=this.O.Ug;b!==a&&(this.O.Ug=a,this.g("fromShortLength",b,a),Hl(this))}},fromLinkable:{get:function(){return null!==this.O?this.O.Pn:null},set:function(a){this.Gc();var b=this.O.Pn;b!==a&&(this.O.Pn=a,this.g("fromLinkable",b,a))}},fromMaxLinks:{get:function(){return null!==this.O?this.O.Qn:Infinity},
set:function(a){this.Gc();var b=this.O.Qn;b!==a&&(0>a&&va(a,">= 0",Y,"fromMaxLinks"),this.O.Qn=a,this.g("fromMaxLinks",b,a))}},cursor:{get:function(){return this.hi},set:function(a){var b=this.hi;b!==a&&(this.hi=a,this.g("cursor",b,a))}},click:{get:function(){return null!==this.N?this.N.Kf:null},set:function(a){cl(this);var b=this.N.Kf;b!==a&&(this.N.Kf=a,this.g("click",b,a))}},doubleClick:{get:function(){return null!==
this.N?this.N.Pf:null},set:function(a){cl(this);var b=this.N.Pf;b!==a&&(this.N.Pf=a,this.g("doubleClick",b,a))}},contextClick:{get:function(){return null!==this.N?this.N.Lf:null},set:function(a){cl(this);var b=this.N.Lf;b!==a&&(this.N.Lf=a,this.g("contextClick",b,a))}},mouseEnter:{get:function(){return null!==this.N?this.N.dg:null},set:function(a){cl(this);var b=this.N.dg;b!==a&&(this.N.dg=a,this.g("mouseEnter",b,a))}},mouseLeave:{
get:function(){return null!==this.N?this.N.gg:null},set:function(a){cl(this);var b=this.N.gg;b!==a&&(this.N.gg=a,this.g("mouseLeave",b,a))}},mouseOver:{get:function(){return null!==this.N?this.N.hg:null},set:function(a){cl(this);var b=this.N.hg;b!==a&&(this.N.hg=a,this.g("mouseOver",b,a))}},mouseHover:{get:function(){return null!==this.N?this.N.fg:null},set:function(a){cl(this);var b=this.N.fg;b!==a&&(this.N.fg=a,this.g("mouseHover",
b,a))}},mouseHold:{get:function(){return null!==this.N?this.N.eg:null},set:function(a){cl(this);var b=this.N.eg;b!==a&&(this.N.eg=a,this.g("mouseHold",b,a))}},mouseDragEnter:{get:function(){return null!==this.N?this.N.Ko:null},set:function(a){cl(this);var b=this.N.Ko;b!==a&&(this.N.Ko=a,this.g("mouseDragEnter",b,a))}},mouseDragLeave:{get:function(){return null!==this.N?this.N.Lo:null},set:function(a){cl(this);
var b=this.N.Lo;b!==a&&(this.N.Lo=a,this.g("mouseDragLeave",b,a))}},mouseDrop:{get:function(){return null!==this.N?this.N.cg:null},set:function(a){cl(this);var b=this.N.cg;b!==a&&(this.N.cg=a,this.g("mouseDrop",b,a))}},actionDown:{get:function(){return null!==this.N?this.N.Tm:null},set:function(a){cl(this);var b=this.N.Tm;b!==a&&(this.N.Tm=a,this.g("actionDown",b,a))}},actionMove:{get:function(){return null!==
this.N?this.N.Um:null},set:function(a){cl(this);var b=this.N.Um;b!==a&&(this.N.Um=a,this.g("actionMove",b,a))}},actionUp:{get:function(){return null!==this.N?this.N.Vm:null},set:function(a){cl(this);var b=this.N.Vm;b!==a&&(this.N.Vm=a,this.g("actionUp",b,a))}},actionCancel:{get:function(){return null!==this.N?this.N.Sm:null},set:function(a){cl(this);var b=this.N.Sm;b!==a&&(this.N.Sm=a,this.g("actionCancel",b,a))}},toolTip:{
get:function(){return null!==this.N?this.N.rg:null},set:function(a){cl(this);var b=this.N.rg;b!==a&&(this.N.rg=a,this.g("toolTip",b,a))}},contextMenu:{get:function(){return null!==this.N?this.N.Mf:null},set:function(a){cl(this);var b=this.N.Mf;b!==a&&(this.N.Mf=a,this.g("contextMenu",b,a))}}});Y.prototype.setProperties=Y.prototype.rw;Y.prototype.findTemplateBinder=Y.prototype.Yi;Y.prototype.bind=Y.prototype.bind;Y.prototype.isEnabledObject=Y.prototype.Ag;
Y.prototype.isVisibleObject=Y.prototype.zf;Y.prototype.isContainedBy=Y.prototype.zg;Y.prototype.getNearestIntersectionPoint=Y.prototype.Vc;Y.prototype.getLocalPoint=Y.prototype.zt;Y.prototype.getDocumentScale=Y.prototype.uf;Y.prototype.getDocumentAngle=Y.prototype.aj;Y.prototype.getDocumentBounds=Y.prototype.nm;Y.prototype.getDocumentPoint=Y.prototype.ga;Y.prototype.intersectsRect=Y.prototype.Ic;Y.prototype.containedInRect=Y.prototype.Dh;Y.prototype.containsRect=Y.prototype.Ce;
Y.prototype.containsPoint=Y.prototype.aa;Y.prototype.raiseChanged=Y.prototype.g;Y.prototype.raiseChangedEvent=Y.prototype.$a;Y.prototype.addCopyProperty=Y.prototype.Ex;var Ml=null;Y.className="GraphObject";Ml=new H;
Ql("Button",function(){function a(a,b){return null!==a.diagram.Ub(a.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a},function(a){return a===b})}var b=Ll(X,X.Auto,{isActionable:!0,enabledChanged:function(a,b){if(a instanceof X){var c=a.Za("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"},Ll(W,{name:"ButtonBorder",figure:"RoundedRectangle",spot1:new P(0,0,2.76142374915397,2.761423749153969),spot2:new P(1,1,-2.76142374915397,-2.761423749153969),parameter1:2,parameter2:2,fill:"#F5F5F5",stroke:"#BDBDBD"}));b.mouseEnter=function(a,b){if(b.Ag()&&b instanceof X&&(a=b.Za("ButtonBorder"),a instanceof W)){var c=b._buttonFillOver;b._buttonFillNormal=a.fill;a.fill=c;c=b._buttonStrokeOver;b._buttonStrokeNormal=a.stroke;a.stroke=c}};
b.mouseLeave=function(a,b){b.Ag()&&b instanceof X&&(a=b.Za("ButtonBorder"),a instanceof W&&(a.fill=b._buttonFillNormal,a.stroke=b._buttonStrokeNormal))};b.actionDown=function(a,b){if(b.Ag()&&b instanceof X&&null!==b._buttonFillPressed&&0===a.button){var c=b.Za("ButtonBorder");if(c instanceof W){a=a.diagram;var d=a.skipsUndoManager;a.skipsUndoManager=!0;var g=b._buttonFillPressed;b._buttonFillOver=c.fill;c.fill=g;g=b._buttonStrokePressed;b._buttonStrokeOver=c.stroke;c.stroke=g;a.skipsUndoManager=d}}};
b.actionUp=function(b,d){if(d.Ag()&&d instanceof X&&null!==d._buttonFillPressed&&0===b.button){var c=d.Za("ButtonBorder");if(c instanceof W){var f=b.diagram,g=f.skipsUndoManager;f.skipsUndoManager=!0;a(b,d)?(c.fill=d._buttonFillOver,c.stroke=d._buttonStrokeOver):(c.fill=d._buttonFillNormal,c.stroke=d._buttonStrokeNormal);f.skipsUndoManager=g}}};b.actionCancel=function(b,d){if(d.Ag()&&d instanceof X&&null!==d._buttonFillPressed){var c=d.Za("ButtonBorder");if(c instanceof W){var f=b.diagram,g=f.skipsUndoManager;
f.skipsUndoManager=!0;a(b,d)?(c.fill=d._buttonFillOver,c.stroke=d._buttonStrokeOver):(c.fill=d._buttonFillNormal,c.stroke=d._buttonStrokeNormal);f.skipsUndoManager=g}}};b.actionMove=function(b,d){if(d.Ag()&&d instanceof X&&null!==d._buttonFillPressed){var c=b.diagram;if(0===c.firstInput.button&&(c.currentTool.standardMouseOver(),a(b,d)&&(b=d.Za("ButtonBorder"),b instanceof W))){var f=c.skipsUndoManager;c.skipsUndoManager=!0;var g=d._buttonFillPressed;b.fill!==g&&(b.fill=g);g=d._buttonStrokePressed;
b.stroke!==g&&(b.stroke=g);c.skipsUndoManager=f}}};return b});
Ql("TreeExpanderButton",function(){var a=Ll("Button",{_treeExpandedFigure:"MinusLine",_treeCollapsedFigure:"PlusLine"},Ll(W,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:Ob},(new Mi("figure","isTreeExpanded",function(a,c){c=c.panel;return a?c._treeExpandedFigure:c._treeCollapsedFigure})).Iq()),{visible:!1},(new Mi("visible","isTreeLeaf",function(a){return!a})).Iq());a.click=function(a,c){c=c.part;c instanceof Ke&&(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});
Ql("SubGraphExpanderButton",function(){var a=Ll("Button",{_subGraphExpandedFigure:"MinusLine",_subGraphCollapsedFigure:"PlusLine"},Ll(W,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:Ob},(new Mi("figure","isSubGraphExpanded",function(a,c){c=c.panel;return a?c._subGraphExpandedFigure:c._subGraphCollapsedFigure})).Iq()));a.click=function(a,c){c=c.part;c instanceof Ke&&(c=c.adornedPart);if(c instanceof uf){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});Ql("ToolTip",function(){return Ll(Ke,X.Auto,{isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new I(0,3),shadowBlur:5},Ll(W,{name:"Border",figure:"RoundedRectangle",parameter1:1,parameter2:1,fill:"#F5F5F5",stroke:"#F0F0F0",spot1:new P(0,0,4,6),spot2:new P(1,1,-4,-4)}))});
Ql("ContextMenu",function(){return Ll(Ke,X.Vertical,{background:"#F5F5F5",isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new I(0,3),shadowBlur:5},new Mi("background","",function(a){return null!==a.adornedPart&&null!==a.placeholder?null:"#F5F5F5"}))});Ql("ContextMenuButton",function(){var a=Ll("Button");a.stretch=Xk;var b=a.Za("ButtonBorder");b instanceof W&&(b.figure="Rectangle",b.strokeWidth=0,b.spot1=new P(0,0,2,3),b.spot2=new P(1,1,-2,-2));return a});
Ql("PanelExpanderButton",function(a){var b=Rl(a,"COLLAPSIBLE"),c=Ll("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},Ll(W,{name:"ButtonIcon",strokeWidth:2},(new Mi("geometryString","visible",function(a){return a?c._buttonExpandedFigure:c._buttonCollapsedFigure})).Iq(b)));
a=c.Za("ButtonBorder");a instanceof W&&(a.stroke=null,a.fill="rgba(0, 0, 0, 0)");c.click=function(a,c){var d=c.diagram;if(null!==d&&!d.isReadOnly){var e=c.Yi();null===e&&(e=c.part);null!==e&&(c=e.Za(b),null!==c&&(a.handled=!0,d.ua("Collapse/Expand Panel"),c.visible=!c.visible,d.Va("Collapse/Expand Panel")))}};return c});
Ql("CheckBoxButton",function(a){var b=Rl(a);a=Ll("Button",{desiredSize:new M(14,14)},Ll(W,{name:"ButtonIcon",geometryString:"M0 0 M0 8.85 L4.9 13.75 16.2 2.45 M16.2 16.2",strokeWidth:2,stretch:ud,geometryStretch:zg,visible:!1},""!==b?(new Mi("visible",b)).my():[]));a.click=function(a,d){if(d instanceof X){var c=a.diagram;if(!(null===c||c.isReadOnly||""!==b&&c.model.isReadOnly)){a.handled=!0;var f=d.Za("ButtonIcon");c.ua("checkbox");f.visible=!f.visible;"function"===typeof d._doClick&&d._doClick(a,
d);c.Va("checkbox")}}};return a});
Ql("CheckBox",function(a){a=Rl(a);a=Ll("CheckBoxButton",a,{name:"Button",isActionable:!1,margin:new oc(0,1,0,0)});var b=Ll(X,"Horizontal",a,{isActionable:!0,cursor:a.cursor,margin:1,_buttonFillNormal:a._buttonFillNormal,_buttonStrokeNormal:a._buttonStrokeNormal,_buttonFillOver:a._buttonFillOver,_buttonStrokeOver:a._buttonStrokeOver,_buttonFillPressed:a._buttonFillPressed,_buttonStrokePressed:a._buttonStrokePressed,_buttonFillDisabled:a._buttonFillDisabled,mouseEnter:a.mouseEnter,mouseLeave:a.mouseLeave,
actionDown:a.actionDown,actionUp:a.actionUp,actionCancel:a.actionCancel,actionMove:a.actionMove,click:a.click,_buttonClick:a.click});a.mouseEnter=null;a.mouseLeave=null;a.actionDown=null;a.actionUp=null;a.actionCancel=null;a.actionMove=null;a.click=null;return b});Y.None=xg=new D(Y,"None",0);Y.Default=Wk=new D(Y,"Default",0);Y.Vertical=Yk=new D(Y,"Vertical",4);Y.Horizontal=Xk=new D(Y,"Horizontal",5);Y.Fill=ud=new D(Y,"Fill",3);Y.Uniform=zg=new D(Y,"Uniform",1);
Y.UniformToFill=Zk=new D(Y,"UniformToFill",2);Y.FlipVertical=$k=new D(Y,"FlipVertical",1);Y.FlipHorizontal=al=new D(Y,"FlipHorizontal",2);Y.FlipBoth=bl=new D(Y,"FlipBoth",3);Y.make=Ll;Y.getBuilders=function(){var a=new H,b;for(b in Ml)if(b!==b.toLowerCase()){var c=Ml.H(b);"function"===typeof c&&a.add(b,c)}a.freeze();return a};Y.defineBuilder=Ql;Y.takeBuilderArgument=Rl;
function dl(){this.In=this.Mf=this.rg=this.Sm=this.Vm=this.Um=this.Tm=this.cg=this.Lo=this.Ko=this.eg=this.fg=this.hg=this.gg=this.dg=this.Lf=this.Pf=this.Kf=null}dl.prototype.copy=function(){var a=new dl;a.Kf=this.Kf;a.Pf=this.Pf;a.Lf=this.Lf;a.dg=this.dg;a.gg=this.gg;a.hg=this.hg;a.fg=this.fg;a.eg=this.eg;a.Ko=this.Ko;a.Lo=this.Lo;a.cg=this.cg;a.Tm=this.Tm;a.Um=this.Um;a.Vm=this.Vm;a.Sm=this.Sm;a.rg=this.rg;a.Mf=this.Mf;a.In=this.In;return a};dl.className="GraphObjectEventHandlers";
function Vl(){this.La=[1,0,0,1,0,0]}Vl.prototype.copy=function(){var a=new Vl;a.La[0]=this.La[0];a.La[1]=this.La[1];a.La[2]=this.La[2];a.La[3]=this.La[3];a.La[4]=this.La[4];a.La[5]=this.La[5];return a};Vl.prototype.translate=function(a,b){this.La[4]+=this.La[0]*a+this.La[2]*b;this.La[5]+=this.La[1]*a+this.La[3]*b};Vl.prototype.scale=function(a,b){this.La[0]*=a;this.La[1]*=a;this.La[2]*=b;this.La[3]*=b};Vl.className="STransform";
function Wl(a){this.type=a;this.r2=this.y2=this.x2=this.r1=this.y1=this.x1=0;this.Lx=[];this.pattern=null}Wl.prototype.addColorStop=function(a,b){this.Lx.push({offset:a,color:b})};Wl.className="SGradient";
function Dj(a,b){this.ownerDocument=a=void 0===b?x.document:b;this.mA="http://www.w3.org/2000/svg";void 0!==a&&(this.Fa=this.vb("svg",{width:"1px",height:"1px",viewBox:"0 0 1 1"}),this.Fa.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns","http://www.w3.org/2000/svg"),this.Fa.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"));this.pq=null;this.context=new Xl(this)}
Dj.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.Fa.setAttributeNS(null,"width",c+"px"),this.Fa.setAttributeNS(null,"height",d+"px"),this.Fa.setAttributeNS(null,"viewBox","0 0 "+c+" "+d),this.context.Qu.firstElementChild.setAttributeNS(null,"width",c+"px"),this.context.Qu.firstElementChild.setAttributeNS(null,"height",d+"px"),!0):!1};
Dj.prototype.vb=function(a,b,c){a=this.ownerDocument.createElementNS(this.mA,a);if(za(b))for(var d in b)a.setAttributeNS("href"===d?"http://www.w3.org/1999/xlink":"",d,b[d]);void 0!==c&&(a.textContent=c);return a};Dj.prototype.getBoundingClientRect=function(){return this.Fa.getBoundingClientRect()};Dj.prototype.focus=function(){this.Fa.focus()};Dj.prototype.Qx=function(){this.ownerDocument=null};
ma.Object.defineProperties(Dj.prototype,{width:{get:function(){return this.Fa.width.baseVal.value},set:function(a){this.Fa.width=a}},height:{get:function(){return this.Fa.height.baseVal.value},set:function(a){this.Fa.height=a}},style:{get:function(){return this.Fa.style}}});Dj.className="SVGSurface";
function Xl(a){this.Ak=a;this.svg=a.Fa;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.df=this.Lp=this.Kp=0;this.Cq=null;this.path=[];this.Hu=!1;this.oh=null;this.ph=0;this.Vd=new Vl;
Yl(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.Qu=c;this.Ak.Fa.appendChild(c);this.yc[0].setAttributeNS(null,"clip-path","url(#mainClip"+b+")");this.oA={}}t=Xl.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.df=this.Lp=this.Kp=0;this.Cq=null;this.path=[];this.Vd=new Vl;Yl(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.Ak.width,height:this.Ak.height}));this.Qu=b;this.Ak.Fa.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,r=b+n,q=f?0:1;d=f?d-e:e-d;(1E-6<Math.abs(g-p)||1E-6<Math.abs(h-r))&&this.path.push(["L",p,+r]);0>d&&(d=d%k+k);d>l?(this.path.push(["A",c,c,0,1,q,a-m,b-n]),this.path.push(["A",c,c,0,1,q,p,r])):1E-6<d&&this.path.push(["A",c,c,0,+(d>=Math.PI),q,a+c*Math.cos(e),b+c*Math.sin(e)])};t.beginPath=function(){this.path=[]};t.bezierCurveTo=function(a,b,c,d,e,f){this.path.push(["C",a,b,c,d,e,f])};t.clearRect=function(){};
t.clip=function(){this.addPath("clipPath",this.path,this.Vd);this.addPath("clipPath",this.path,new Vl)};t.closePath=function(){this.path.push(["z"])};t.createLinearGradient=function(a,b,c,d){var e=new Wl("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.oA;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 Wl("radial");g.x1=a;g.y1=b;g.r1=c;g.x2=d;g.y2=e;g.r2=f;return g};
t.drawImage=function(a,b,c,d,e,f,g,h,k){var l="";a instanceof HTMLCanvasElement&&(l=a.toDataURL());a instanceof HTMLImageElement&&(l=a.getAttribute("src"));var m=a instanceof HTMLImageElement?a.naturalWidth:a.width,n=a instanceof HTMLImageElement?a.naturalHeight:a.height;void 0===d&&(f=b,g=c,h=d=m,k=e=n);d=d||0;e=e||0;f=f||0;g=g||0;h=h||0;k=k||0;a={x:0,y:0,width:m||d,height:n||e,href:l};K.$(d,h)&&K.$(e,k)?-1===l.toLowerCase().indexOf(".svg")&&-1===l.toLowerCase().indexOf("data:image/svg")&&(a.preserveAspectRatio=
"xMidYMid slice"):a.preserveAspectRatio="none";l="";h/=d;k/=e;if(0!==f||0!==g)l+=" translate("+f+", "+g+")";if(1!==h||1!==k)l+=" scale("+h+", "+k+")";if(0!==b||0!==c)l+=" translate("+-b+", "+-c+")";if(0!==b||0!==c||d!==m||e!==n)f="CLIP"+pb++,g=this.vb("clipPath",{id:f}),g.appendChild(this.vb("rect",{x:b,y:c,width:d,height:e})),this.svg.appendChild(g),a["clip-path"]="url(#"+f+")";Zl(this,"image",a,this.Vd,l);this.addElement("image",a)};t.fill=function(){this.addPath("fill",this.path,this.Vd)};
t.Wd=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]};Zl(this,"fill",a,this.Vd);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};Zl(this,"fill",b,this.Vd);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.Vd=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.Vd.copy())};
t.setTransform=function(a,b,c,d,e,f){1===a&&0===b&&0===c&&1===d&&0===e&&0===f||Yl(this,a,b,c,d,e,f)};t.scale=function(a,b){this.Vd.scale(a,b)};t.translate=function(a,b){this.Vd.translate(a,b)};t.transform=function(){};t.stroke=function(){this.addPath("stroke",this.path,this.Vd)};t.ij=function(){this.clipInsteadOfFill||this.stroke()};t.vb=function(a,b,c){return this.Ak.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.Cq=a};
function Zl(a,b,c,d,e){1!==a.globalAlpha&&(c.opacity=a.globalAlpha);"fill"===b?(a.fillStyle instanceof Wl?c.fill=$l(a,a.fillStyle):/^rgba\(/.test(a.fillStyle)?(a=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(a.fillStyle),c.fill="rgb("+a[1]+","+a[2]+","+a[3]+")",c["fill-opacity"]=a[4]):c.fill=a.fillStyle,c.stroke="none"):"stroke"===b&&(c.fill="none",a.strokeStyle instanceof Wl?c.stroke=$l(a,a.strokeStyle):/^rgba\(/.test(a.strokeStyle)?(b=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(a.strokeStyle),
c.stroke="rgb("+b[1]+","+b[2]+","+b[3]+")",c["stroke-opacity"]=b[4]):c.stroke=a.strokeStyle,c["stroke-width"]=a.lineWidth,c["stroke-linecap"]=a.lineCap,c["stroke-linejoin"]=a.lineJoin,c["stroke-miterlimit"]=a.miterLimit);d=d.La;d="matrix("+d[0]+", "+d[1]+", "+d[2]+", "+d[3]+", "+d[4]+", "+d[5]+")";void 0!==e&&(d+=e);c.transform=d}
function $l(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.Lx;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=Ba(b[e]),g=[f.shift()];if("A"===g[0])g.push(f.shift()+","+f.shift(),f.shift(),f.shift()+","+f.shift(),f.shift()+","+f.shift());else for(;f.length;)g.push(f.shift()+","+f.shift());d.push(g.join(" "))}b={d:d.join(" ")};"stroke"===a&&this.Hu&&(b["stroke-dasharray"]=this.oh.toString(),b["stroke-dashoffset"]=this.ph);Zl(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 Yl(a,b,c,d,e,f,g){var h=new Vl;h.La=[b,c,d,e,f,g];b={};Zl(a,"g",b,h);h=a.addElement("g",b);a.yc.push(h)}
t.Uq=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",QA: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.uw=function(a,b,c){this.Kp=a;this.Lp=b;this.df=c};function tl(a){a.shadowOffsetX=0;a.shadowOffsetY=0;a.shadowBlur=0}
function sl(a){a.shadowOffsetX=a.Kp;a.shadowOffsetY=a.Lp;a.shadowBlur=a.df}t.st=function(a,b){this.Hu=!0;this.oh=a;this.ph=b};t.qt=function(){this.Hu=!1};t.sc=function(){};t.yy=function(){};Xl.prototype.rotate=function(){};Xl.prototype.getImageData=function(){return null};Xl.prototype.measureText=function(){return null};Xl.className="SVGContext";
Q.prototype.Lt=function(a){var b=new Dj(this,x.document);void 0===a&&(a=new db);var c=this;return Bk(this,function(a,e){a=Ck(c,a,"SVG",b);a=null!==a?a.svg:null;return"function"===typeof e?(e(a),null):a},a)};Q.prototype.makeSvg=Q.prototype.Lt;Q.prototype.Uv=function(a){return this.Lt(a)};Q.prototype.makeSVG=Q.prototype.Uv;
Y.prototype.Rx=function(a,b){if(!(a instanceof Xl))return!1;if(!this.visible)return!0;var c=null,d=a.Cq;if(this instanceof X&&(this.type===X.TableRow||this.type===X.TableColumn))return ql(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.F&4096)===!0&&rl(this);var h=0!==(this.F&256),k=!1;this instanceof Ug&&(a.font=this.font);if(h){k=g.ce()?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;Yl(a,1,0,0,1,0,0);a.save();a.beginPath();a.rect(m,n,p,l);a.clip()}if(this.yf()&&!this.isVisible())return!0;a.Vd.La=[1,0,0,1,0,0];(this instanceof Ug&&1<this.lineCount||this instanceof W&&1<this.geometry.figures.length)&&Yl(a,1,0,0,1,0,0);m=!1;this.yf()&&this.isShadowed&&b.Ee("drawShadows")&&
(n=this.shadowOffset,a.uw(n.x*b.scale*b.Sb,n.y*b.scale*b.Sb,this.shadowBlur),sl(a),a.shadowColor=this.shadowColor);n=!1;this.part&&b.Ee("drawShadows")&&(n=this.part.isShadowed);!0===this.shadowVisible?(sl(a),!1===m&&n&&(Yl(a,1,0,0,1,0,0),a.Uq(),m=!0)):!1===this.shadowVisible&&tl(a);p=this.naturalBounds;null!==this.areaBackground&&(li(this,a,this.areaBackground,!0,!0,p,e),!1===m&&n&&(Yl(a,1,0,0,1,0,0),a.Uq(),m=!0),this.areaBackground instanceof ul&&this.areaBackground.type===vl?(a.beginPath(),a.rect(e.x,
e.y,e.width,e.height),a.Wd(this.areaBackground)):a.fillRect(e.x,e.y,e.width,e.height));this instanceof X?Yl(a,f.m11,f.m12,f.m21,f.m22,f.dx,f.dy):a.Vd.La=[f.m11,f.m12,f.m21,f.m22,f.dx,f.dy];if(null!==this.background){!1===m&&n&&(Yl(a,1,0,0,1,0,0),a.Uq(),m=!0);var r=this.naturalBounds;l=f=0;var q=r.width;r=r.height;var u=0;this instanceof W&&(r=this.geometry.bounds,f=r.x,l=r.y,q=r.width,r=r.height,u=this.strokeWidth);li(this,a,this.background,!0,!1,p,e);this.background instanceof ul&&this.background.type===
vl?(a.beginPath(),a.rect(f-u/2,l-u/2,q+u,r+u),a.Wd(this.background)):a.fillRect(f-u/2,l-u/2,q+u,r+u)}n&&(null!==this.background||null!==this.areaBackground||null!==g&&0!==(g.F&512)||null!==g&&(g.type===X.Auto||g.type===X.Spot)&&g.tb()!==this)?(wl(this,!0),null===this.shadowVisible&&tl(a)):wl(this,!1);this.Ui(a,b);n&&0!==(this.F&512)===!0&&sl(a);this.yf()&&n&&tl(a);h&&(a.restore(),k&&a.yc.pop());this instanceof X&&(c=a.yc.pop());!0===m&&a.yc.pop();if(this instanceof Ug&&1<this.lineCount||this instanceof
W&&1<this.geometry.figures.length)c=a.yc.pop();null!==a.Ak.pq&&(null===c&&(d===a.Cq?(Yl(a,1,0,0,1,0,0),c=a.yc.pop()):c=a.Cq),a.Ak.pq(this,c));this.svg=c;return!0};function Dk(a,b){this.ownerDocument=b=void 0===b?x.document:b;this.pq=null;b=b.createElement("canvas");b.tabIndex=0;this.Fa=b;this.Fa.innerHTML="This text is displayed if your browser does not support the Canvas HTML element.";this.context=new yl(b);b.B=a}
Dk.prototype.resize=function(a,b,c,d){return this.width!==a||this.height!==b?(this.width=a,this.height=b,this.style.width=c+"px",this.style.height=d+"px",!0):!1};Dk.prototype.toDataURL=function(a,b){return this.Fa.toDataURL(a,b)};Dk.prototype.getBoundingClientRect=function(){return this.Fa.getBoundingClientRect()};Dk.prototype.focus=function(){this.Fa.focus()};Dk.prototype.Qx=function(){this.ownerDocument=this.Fa.B=null};
ma.Object.defineProperties(Dk.prototype,{width:{get:function(){return this.Fa.width},set:function(a){this.Fa.width=a}},height:{get:function(){return this.Fa.height},set:function(a){this.Fa.height=a}},style:{get:function(){return this.Fa.style}}});Dk.className="CanvasSurface";
function yl(a){a.getContext&&a.getContext("2d")||B("Browser does not support HTML Canvas Element");this.Y=a.getContext("2d");this.ju=this.lu=this.ku="";this.kn=!1;this.df=this.Lp=this.Kp=0}t=yl.prototype;t.yy=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()};yl.prototype.rotate=function(a){this.Y.rotate(a)};t=yl.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.Wd=function(a){if(a instanceof ul&&a.type===vl){var b=a.Ok;a=a.mu;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.kn?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.kn?this.clip():this.fill()};t.ij=function(){this.kn||this.stroke()};t.uw=function(a,b,c){this.Kp=a;this.Lp=b;this.df=c};
t.st=function(a,b){var c=this.Y;void 0!==c.setLineDash&&(c.setLineDash(a),c.lineDashOffset=b)};t.qt=function(){var a=this.Y;void 0!==a.setLineDash&&(a.setLineDash(am),a.lineDashOffset=0)};t.sc=function(a){a&&(this.ku="");this.ju=this.lu=""};
ma.Object.defineProperties(yl.prototype,{fillStyle:{get:function(){return this.Y.fillStyle},set:function(a){this.ju!==a&&(this.ju=this.Y.fillStyle=a)}},font:{get:function(){return this.Y.font},set:function(a){this.ku!==a&&(this.ku=this.Y.font=a)}},globalAlpha:{get:function(){return this.Y.globalAlpha},set:function(a){this.Y.globalAlpha=a}},lineCap:{get:function(){return this.Y.lineCap},
set:function(a){this.Y.lineCap=a}},lineDashOffset:{get:function(){return this.Y.lineDashOffset},set:function(a){this.Y.lineDashOffset=a}},lineJoin:{get:function(){return this.Y.lineJoin},set:function(a){this.Y.lineJoin=a}},lineWidth:{get:function(){return this.Y.lineWidth},set:function(a){this.Y.lineWidth=a}},miterLimit:{get:function(){return this.Y.miterLimit},set:function(a){this.Y.miterLimit=
a}},shadowBlur:{get:function(){return this.Y.shadowBlur},set:function(a){this.Y.shadowBlur=a}},shadowColor:{get:function(){return this.Y.shadowColor},set:function(a){this.Y.shadowColor=a}},shadowOffsetX:{get:function(){return this.Y.shadowOffsetX},set:function(a){this.Y.shadowOffsetX=a}},shadowOffsetY:{get:function(){return this.Y.shadowOffsetY},set:function(a){this.Y.shadowOffsetY=
a}},strokeStyle:{get:function(){return this.Y.strokeStyle},set:function(a){this.lu!==a&&(this.lu=this.Y.strokeStyle=a)}},textAlign:{get:function(){return this.Y.textAlign},set:function(a){this.Y.textAlign=a}},imageSmoothingEnabled:{get:function(){return this.Y.imageSmoothingEnabled},set:function(a){this.Y.imageSmoothingEnabled=a}},clipInsteadOfFill:{get:function(){return this.kn},
set:function(a){this.kn=a}}});var am=Object.freeze([]);yl.className="CanvasSurfaceContext";function bm(){this.T=this.u=this.I=this.l=0}bm.className="ColorNumbers";function ul(a){cm||(dm(),cm=!0);Ya(this);this.s=!1;void 0===a?(this.pa=xl,this.Nk="black"):"string"===typeof a?(this.pa=xl,this.Nk=a):(this.pa=a,this.Nk="black");a=this.pa;a===Al?(this.ud=wc,this.$k=Dc):this.$k=a===vl?this.ud=Ac:this.ud=uc;this.Zs=0;this.Kr=NaN;this.fe=this.Bs=this.ee=null;this.mu=this.Ok=0}
ul.prototype.copy=function(){var a=new ul;a.pa=this.pa;a.Nk=this.Nk;a.ud=this.ud.G();a.$k=this.$k.G();a.Zs=this.Zs;a.Kr=this.Kr;null!==this.ee&&(a.ee=this.ee.copy());a.Bs=this.Bs;return a};t=ul.prototype;t.freeze=function(){this.s=!0;null!==this.ee&&this.ee.freeze();return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.s=!1;null!==this.ee&&this.ee.ea();return this};t.gb=function(a){a.classType===ul&&(this.type=a)};
t.toString=function(){var a="Brush(";if(this.type===xl)a+=this.color;else if(a=this.type===Al?a+"Linear ":this.type===vl?a+"Radial ":this.type===zl?a+"Pattern ":a+"(unknown) ",a+=this.start+" "+this.end,null!==this.colorStops)for(var b=this.colorStops.iterator;b.next();)a+=" "+b.key+":"+b.value;return a+")"};
t.addColorStop=function(a,b){this.s&&ua(this);("number"!==typeof a||!isFinite(a)||1<a||0>a)&&va(a,"0 <= loc <= 1",ul,"addColorStop:loc");null===this.ee&&(this.ee=new H);this.ee.add(a,b);this.pa===xl&&(this.type=Al);this.fe=null;return this};
t.gA=function(a,b){this.s&&ua(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?em:b;if(this.type===xl)Th(this.color),this.color=fm(a,b);else if((this.type===Al||this.type===vl)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)Th(c.value),this.addColorStop(c.key,fm(a,b));return this};function gm(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?em:c;Th(a);return fm(b,c)}
t.iz=function(a,b){this.s&&ua(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?em:b;if(this.type===xl)Th(this.color),this.color=fm(-a,b);else if((this.type===Al||this.type===vl)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)Th(c.value),this.addColorStop(c.key,fm(-a,b));return this};function hm(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?em:c;Th(a);return fm(-b,c)}
function im(a,b,c){Th(a);a=jm.l;var d=jm.I,e=jm.u,f=jm.T;Th(b);void 0===c&&(c=.5);return"rgba("+Math.round((jm.l-a)*c+a)+", "+Math.round((jm.I-d)*c+d)+", "+Math.round((jm.u-e)*c+e)+", "+Math.round((jm.T-f)*c+f)+")"}
t.ky=function(){if(this.type===xl)return km(this.color);if((this.type===Al||this.type===vl)&&null!==this.colorStops){var a=this.colorStops;if(this.type===vl)return km(a.first().value);if(null!==a.get(.5))return km(a.get(.5));if(2===a.count)return a=a.na(),km(im(a[0].value,a[1].value));for(var b=a.iterator,c=-1,d=-1,e=1,f=1;b.next();){var g=b.key,h=Math.abs(.5-b.key);e>f&&h<e?(c=g,e=h):f>=e&&h<f&&(d=g,f=h)}c>d&&(f=c,c=d,d=f,f=e);e=d-c;return km(im(a.get(c),a.get(d),1-f/e))}return!1};
function km(a){if(!a)return!1;if(a instanceof ul)return a.ky();Th(a);return 128>(299*jm.l+587*jm.I+114*jm.u)/1E3}
function fm(a,b){switch(b){case em:b=100*lm(jm.l);var c=100*lm(jm.I),d=100*lm(jm.u);mm.l=.4124564*b+.3575761*c+.1804375*d;mm.I=.2126729*b+.7151522*c+.072175*d;mm.u=.0193339*b+.119192*c+.9503041*d;mm.T=jm.T;b=nm(mm.l/om[0]);c=nm(mm.I/om[1]);d=nm(mm.u/om[2]);pm.l=116*c-16;pm.I=500*(b-c);pm.u=200*(c-d);pm.T=mm.T;pm.l=Math.min(100,Math.max(0,pm.l+100*a));a=(pm.l+16)/116;b=a-pm.u/200;mm.l=om[0]*qm(pm.I/500+a);mm.I=om[1]*(pm.l>rm*sm?Math.pow(a,3):pm.l/rm);mm.u=om[2]*qm(b);mm.T=pm.T;a=-.969266*mm.l+1.8760108*
mm.I+.041556*mm.u;b=.0556434*mm.l+-.2040259*mm.I+1.0572252*mm.u;jm.l=255*tm((3.2404542*mm.l+-1.5371385*mm.I+-.4985314*mm.u)/100);jm.I=255*tm(a/100);jm.u=255*tm(b/100);jm.T=mm.T;jm.l=Math.round(jm.l);255<jm.l?jm.l=255:0>jm.l&&(jm.l=0);jm.I=Math.round(jm.I);255<jm.I?jm.I=255:0>jm.I&&(jm.I=0);jm.u=Math.round(jm.u);255<jm.u?jm.u=255:0>jm.u&&(jm.u=0);return"rgba("+jm.l+", "+jm.I+", "+jm.u+", "+jm.T+")";case um:return Uh(),Vh.u=Math.min(100,Math.max(0,Vh.u+100*a)),"hsla("+Vh.l+", "+Vh.I+"%, "+Vh.u+"%, "+
Vh.T+")";default:return B("Unknown color space: "+b),"rgba(0, 0, 0, 1)"}}function Th(a){cm||(dm(),cm=!0);var b=vm;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,jm.l=a[0],jm.I=a[1],jm.u=a[2],jm.T=a[3]/255):(b.fillStyle="#FFFFFF",b.fillStyle=a,jm.l=0,jm.I=0,jm.u=0,jm.T=1)}}
function Uh(){var a=jm.l/255,b=jm.I/255,c=jm.u/255,d=Math.max(a,b,c),e=Math.min(a,b,c),f=d-e;e=(d+e)/2;if(0===f)var g=a=0;else{switch(d){case a:g=(b-c)/f%6;break;case b:g=(c-a)/f+2;break;case c:g=(a-b)/f+4}g*=60;0>g&&(g+=360);a=f/(1-Math.abs(2*e-1))}Vh.l=Math.round(g);Vh.I=Math.round(100*a);Vh.u=Math.round(100*e);Vh.T=jm.T}function lm(a){a/=255;return.04045>=a?a/12.92:Math.pow((a+.055)/1.055,2.4)}function tm(a){return.0031308>=a?12.92*a:1.055*Math.pow(a,1/2.4)-.055}
function nm(a){return a>sm?Math.pow(a,1/3):(rm*a+16)/116}function qm(a){var b=a*a*a;return b>sm?b:(116*a-16)/rm}function Sl(a,b){"string"!==typeof a&&(a instanceof ul||B("Value for "+b+" must be a color string or a Brush, not "+a))}function dm(){vm=Sg?(new Dk(null)).context:null}
ma.Object.defineProperties(ul.prototype,{type:{get:function(){return this.pa},set:function(a){this.s&&ua(this,a);this.pa=a;this.start.kc()&&(a===Al?this.start=wc:a===vl&&(this.start=Ac));this.end.kc()&&(a===Al?this.end=Dc:a===vl&&(this.end=Ac));this.fe=null}},color:{get:function(){return this.Nk},set:function(a){this.s&&ua(this,a);this.Nk=a;this.fe=null}},start:{get:function(){return this.ud},set:function(a){this.s&&
ua(this,a);this.ud=a.G();this.fe=null}},end:{get:function(){return this.$k},set:function(a){this.s&&ua(this,a);this.$k=a.G();this.fe=null}},startRadius:{get:function(){return this.Zs},set:function(a){this.s&&ua(this,a);0>a&&va(a,">= zero",ul,"startRadius");this.Zs=a;this.fe=null}},endRadius:{get:function(){return this.Kr},set:function(a){this.s&&ua(this,a);0>a&&va(a,">= zero",ul,"endRadius");this.Kr=a;this.fe=
null}},colorStops:{get:function(){return this.ee},set:function(a){this.s&&ua(this,a);this.ee=a;this.fe=null}},pattern:{get:function(){return this.Bs},set:function(a){this.s&&ua(this,a);this.Bs=a;this.fe=null}}});ul.prototype.isDark=ul.prototype.ky;ul.prototype.darkenBy=ul.prototype.iz;ul.prototype.lightenBy=ul.prototype.gA;ul.prototype.addColorStop=ul.prototype.addColorStop;
var sm=216/24389,rm=24389/27,om=[95.047,100,108.883],vm=null,jm=new bm,Vh=new bm,mm=new bm,pm=new bm,cm=!1;ul.className="Brush";var xl;ul.Solid=xl=new D(ul,"Solid",0);var Al;ul.Linear=Al=new D(ul,"Linear",1);var vl;ul.Radial=vl=new D(ul,"Radial",2);var zl;ul.Pattern=zl=new D(ul,"Pattern",4);var em;ul.Lab=em=new D(ul,"Lab",5);var um;ul.HSL=um=new D(ul,"HSL",6);
ul.randomColor=function(a,b){void 0===a&&(a=128);void 0===b&&(b=Math.max(a,255));var c=Math.abs(b-a);b=Math.floor(a+Math.random()*c).toString(16);var d=Math.floor(a+Math.random()*c).toString(16);a=Math.floor(a+Math.random()*c).toString(16);2>b.length&&(b="0"+b);2>d.length&&(d="0"+d);2>a.length&&(a="0"+a);return"#"+b+d+a};
ul.isValidColor=function(a){if("black"===a)return!0;if(""===a)return!1;cm||(dm(),cm=!0);var b=vm;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};ul.lighten=function(a){return gm(a)};ul.lightenBy=gm;ul.darken=function(a){return hm(a)};ul.darkenBy=hm;ul.mix=im;ul.isDark=km;function Pl(){this.name="Base"}Pl.prototype.measure=function(){};
Pl.prototype.jA=function(a,b,c,d,e){a.measure(b,c,d,e)};Pl.prototype.arrange=function(){};Pl.prototype.Zy=function(a,b,c,d,e,f){a.arrange(b,c,d,e,f)};Pl.prototype.bc=function(){};ma.Object.defineProperties(Pl.prototype,{classType:{get:function(){return X}}});Pl.prototype.arrangeElement=Pl.prototype.Zy;Pl.prototype.measureElement=Pl.prototype.jA;Pl.className="PanelLayout";function wm(){this.name="Base"}la(wm,Pl);
wm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;a=xm(a);for(var k=0;k<h;k++){var l=d[k];if(l.visible||l===a){var m=l.margin,n=m.right+m.left;m=m.top+m.bottom;l.measure(b,c,f,g);var p=l.measuredBounds;n=Math.max(p.width+n,0);m=Math.max(p.height+m,0);p=l.position.x;var r=l.position.y;isFinite(p)||(p=0);isFinite(r)||(r=0);l instanceof W&&l.isGeometryPositioned&&(l=l.strokeWidth/2,p-=l,r-=l);ec(e,p,r,n,m)}}};
wm.prototype.arrange=function(a,b,c){var d=b.length,e=a.padding;a=c.x-e.left;c=c.y-e.top;for(e=0;e<d;e++){var f=b[e],g=f.measuredBounds,h=f.margin,k=f.position.x,l=f.position.y;k=isNaN(k)?-a:k-a;l=isNaN(l)?-c:l-c;if(f instanceof W&&f.isGeometryPositioned){var m=f.strokeWidth/2;k-=m;l-=m}f.visible&&f.arrange(k+h.left,l+h.top,g.width,g.height)}};function ym(){this.name="Base"}la(ym,Pl);
ym.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;b=Fa();f=xm(a);for(var k=0;k<h;k++){var l=d[k];if(l.visible||l===f){var m=ll(l,!1);if(m!==xg&&m!==Xk)b.push(l);else{l.measure(Infinity,c,0,g);m=l.margin;l=l.measuredBounds;var n=Math.max(l.height+m.top+m.bottom,0);e.width+=Math.max(l.width+m.right+m.left,0);e.height=Math.max(e.height,n)}}}d=b.length;a.desiredSize.height?c=Math.min(a.desiredSize.height,a.maxSize.height):0!==e.height&&(c=Math.min(e.height,a.maxSize.height));for(a=0;a<d;a++)if(k=
b[a],k.visible||k===f)m=k.margin,h=m.right+m.left,m=m.top+m.bottom,k.measure(Infinity,c,0,g),k=k.measuredBounds,m=Math.max(k.height+m,0),e.width+=Math.max(k.width+h,0),e.height=Math.max(e.height,m);Ha(b)};
ym.prototype.arrange=function(a,b,c){for(var d=b.length,e=a.padding,f=e.top,g=a.isOpposite,h=g?c.width:e.left,k=0;k<d;k++){var l=f,m=b[k];if(m.visible){var n=m.measuredBounds,p=m.margin,r=p.top+p.bottom,q=f+e.bottom,u=n.height,v=ll(m,!1);if(isNaN(m.desiredSize.height)&&v===ud||v===Yk)u=Math.max(c.height-r-q,0);r=u+r+q;q=m.alignment;q.Nb()&&(q=a.defaultAlignment);q.hb()||(q=Ac);g&&(h-=n.width+p.left+p.right);m.arrange(h+q.offsetX+p.left,l+q.offsetY+p.top+(c.height*q.y-r*q.y),n.width,u);g||(h+=n.width+
p.left+p.right)}}};function zm(){this.name="Base"}la(zm,Pl);
zm.prototype.measure=function(a,b,c,d,e,f){var g=d.length;c=Fa();for(var h=xm(a),k=0;k<g;k++){var l=d[k];if(l.visible||l===h){var m=ll(l,!1);if(m!==xg&&m!==Yk)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;Vb(e,Math.max(e.width,Math.max(l.width+m,0)),e.height+Math.max(l.height+n,0))}}}d=c.length;if(0!==d){a.desiredSize.width?b=Math.min(a.desiredSize.width,a.maxSize.width):0!==e.width&&(b=Math.min(e.width,a.maxSize.width));for(a=0;a<d;a++)if(k=
c[a],k.visible||k===h)l=k.margin,g=l.right+l.left,l=l.top+l.bottom,k.measure(b,Infinity,f,0),k=k.measuredBounds,l=Math.max(k.height+l,0),e.width=Math.max(e.width,Math.max(k.width+g,0)),e.height+=l;Ha(c)}};
zm.prototype.arrange=function(a,b,c){for(var d=b.length,e=a.padding,f=e.left,g=a.isOpposite,h=g?c.height:e.top,k=0;k<d;k++){var l=f,m=b[k];if(m.visible){var n=m.measuredBounds,p=m.margin,r=p.left+p.right,q=f+e.right,u=n.width,v=ll(m,!1);if(isNaN(m.desiredSize.width)&&v===ud||v===Xk)u=Math.max(c.width-r-q,0);r=u+r+q;q=m.alignment;q.Nb()&&(q=a.defaultAlignment);q.hb()||(q=Ac);g&&(h-=n.height+p.bottom+p.top);m.arrange(l+q.offsetX+p.left+(c.width*q.x-r*q.x),h+q.offsetY+p.top,u,n.height);g||(h+=n.height+
p.bottom+p.top)}}};function Am(){this.name="Base"}la(Am,Pl);
Am.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.tb(),l=k.margin,m=l.right+l.left,n=l.top+l.bottom;k.measure(b,c,f,g);var p=k.measuredBounds;f=p.width;g=p.height;var r=Math.max(f+m,0);var q=Math.max(g+n,0);for(var u=a.isClipping,v=N.allocAt(-l.left,-l.top,r,q),w=!0,y=xm(a),z=0;z<h;z++){var A=d[z];if(A!==k&&(A.visible||A===y)){l=A.margin;r=l.right+l.left;q=l.top+l.bottom;p=ll(A,!1);switch(p){case ud:b=f;c=g;break;case Xk:b=f;break;case Yk:c=g}A.measure(b,c,0,0);p=A.measuredBounds;r=
Math.max(p.width+r,0);q=Math.max(p.height+q,0);var C=A.alignment;C.Nb()&&(C=a.defaultAlignment);C.hb()||(C=Ac);var G=A.alignmentFocus;G.Nb()&&(G=Ac);var L=null;A instanceof X&&""!==A.Fg&&(A.arrange(0,0,p.width,p.height),L=A.Za(A.Fg),L===A&&(L=null));if(null!==L){l=L.naturalBounds;p=L.margin;for(l=I.allocAt(G.x*l.width-G.offsetX-p.left,G.y*l.height-G.offsetY-p.top);L!==A;)L.transform.ra(l),L=L.panel;A=C.x*f+C.offsetX-l.x;p=C.y*g+C.offsetY-l.y;I.free(l)}else A=C.x*f+C.offsetX-(G.x*p.width+G.offsetX)-
l.left,p=C.y*g+C.offsetY-(G.y*p.height+G.offsetY)-l.top;w?(w=!1,e.h(A,p,r,q)):ec(e,A,p,r,q)}}w?e.assign(v):u?e.Nv(v.x,v.y,v.width,v.height):ec(e,v.x,v.y,v.width,v.height);N.free(v);p=k.stretch;p===Wk&&(p=ll(k,!1));switch(p){case xg:return;case ud:if(!isFinite(b)&&!isFinite(c))return;break;case Xk:if(!isFinite(b))return;break;case Yk:if(!isFinite(c))return}p=k.measuredBounds;f=p.width;g=p.height;r=Math.max(f+m,0);q=Math.max(g+n,0);l=k.margin;v=N.allocAt(-l.left,-l.top,r,q);for(b=0;b<h;b++)c=d[b],c===
k||!c.visible&&c!==y||(l=c.margin,r=l.right+l.left,q=l.top+l.bottom,p=c.measuredBounds,r=Math.max(p.width+r,0),q=Math.max(p.height+q,0),m=c.alignment,m.Nb()&&(m=a.defaultAlignment),m.hb()||(m=Ac),c=c.alignmentFocus,c.Nb()&&(c=Ac),w?(w=!1,e.h(m.x*f+m.offsetX-(c.x*p.width+c.offsetX)-l.left,m.y*g+m.offsetY-(c.y*p.height+c.offsetY)-l.top,r,q)):ec(e,m.x*f+m.offsetX-(c.x*p.width+c.offsetX)-l.left,m.y*g+m.offsetY-(c.y*p.height+c.offsetY)-l.top,r,q));w?e.assign(v):u?e.Nv(v.x,v.y,v.width,v.height):ec(e,v.x,
v.y,v.width,v.height);N.free(v)};
Am.prototype.arrange=function(a,b,c){var d=b.length,e=a.tb(),f=e.measuredBounds,g=f.width;f=f.height;var h=a.padding,k=h.left;h=h.top;var l=k-c.x,m=h-c.y;e.arrange(l,m,g,f);for(var n=0;n<d;n++){var p=b[n];if(p!==e){var r=p.measuredBounds,q=r.width;r=r.height;m=p.alignment;m.Nb()&&(m=a.defaultAlignment);m.hb()||(m=Ac);var u=p.alignmentFocus;u.Nb()&&(u=Ac);l=null;p instanceof X&&""!==p.Fg&&(l=p.Za(p.Fg),l===p&&(l=null));if(null!==l){var v=l.naturalBounds;for(u=I.allocAt(u.x*v.width-u.offsetX,u.y*v.height-
u.offsetY);l!==p;)l.transform.ra(u),l=l.panel;l=m.x*g+m.offsetX-u.x;m=m.y*f+m.offsetY-u.y;I.free(u)}else l=m.x*g+m.offsetX-(u.x*q+u.offsetX),m=m.y*f+m.offsetY-(u.y*r+u.offsetY);l-=c.x;m-=c.y;p.visible&&p.arrange(k+l,h+m,q,r)}}};function Bm(){this.name="Base"}la(Bm,Pl);
Bm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.tb(),l=k.margin,m=b,n=c,p=l.right+l.left,r=l.top+l.bottom;k.measure(b,c,f,g);l=k.measuredBounds;var q=0,u=null;k instanceof W&&(u=k,q=u.strokeWidth*u.scale);var v=Math.max(l.width+p,0);l=Math.max(l.height+r,0);var w=Cm(k),y=w.x*v+w.offsetX;w=w.y*l+w.offsetY;var z=Dm(k),A=z.x*v+z.offsetX;z=z.y*l+z.offsetY;isFinite(b)&&(m=Math.max(Math.abs(y-A)-q,0));isFinite(c)&&(n=Math.max(Math.abs(w-z)-q,0));q=M.alloc();q.h(0,0);a=xm(a);for(z=0;z<h;z++)w=
d[z],w===k||!w.visible&&w!==a||(l=w.margin,v=l.right+l.left,y=l.top+l.bottom,w.measure(m,n,0,0),l=w.measuredBounds,v=Math.max(l.width+v,0),l=Math.max(l.height+y,0),q.h(Math.max(v,q.width),Math.max(l,q.height)));if(1===h)e.width=v,e.height=l,M.free(q);else{w=Cm(k);z=Dm(k);h=d=0;z.x!==w.x&&z.y!==w.y&&(d=q.width/Math.abs(z.x-w.x),h=q.height/Math.abs(z.y-w.y));M.free(q);q=0;null!==u&&(q=u.strokeWidth*u.scale,yg(u)===zg&&(d=h=Math.max(d,h)));d+=Math.abs(w.offsetX)+Math.abs(z.offsetX)+q;h+=Math.abs(w.offsetY)+
Math.abs(z.offsetY)+q;u=k.stretch;u===Wk&&(u=ll(k,!1));switch(u){case xg:g=f=0;break;case ud:isFinite(b)&&(d=b);isFinite(c)&&(h=c);break;case Xk:isFinite(b)&&(d=b);g=0;break;case Yk:f=0,isFinite(c)&&(h=c)}k.qm();k.measure(d,h,f,g);e.width=k.measuredBounds.width+p;e.height=k.measuredBounds.height+r}};
Bm.prototype.arrange=function(a,b){var c=b.length,d=a.tb(),e=d.measuredBounds,f=N.alloc();f.h(0,0,1,1);var g=d.margin,h=g.left;g=g.top;var k=a.padding,l=k.left;k=k.top;d.arrange(l+h,k+g,e.width,e.height);var m=Cm(d),n=Dm(d),p=m.y*e.height+m.offsetY,r=n.x*e.width+n.offsetX;n=n.y*e.height+n.offsetY;f.x=m.x*e.width+m.offsetX;f.y=p;ec(f,r,n,0,0);f.x+=h+l;f.y+=g+k;for(e=0;e<c;e++)h=b[e],h!==d&&(l=h.measuredBounds,g=h.margin,k=Math.max(l.width+g.right+g.left,0),m=Math.max(l.height+g.top+g.bottom,0),p=h.alignment,
p.Nb()&&(p=a.defaultAlignment),p.hb()||(p=Ac),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&&(fc(f.x,f.y,f.width,f.height,k,g,l.width,l.height)?h.arrange(k,g,l.width,l.height):h.arrange(k,g,l.width,l.height,new N(f.x,f.y,f.width,f.height))));N.free(f)};function Em(){this.name="Base";this.name="Table"}la(Em,Pl);
Em.prototype.measure=function(a,b,c,d,e,f,g){for(var h=d.length,k=Fa(),l=Fa(),m=0;m<h;m++){var n=d[m],p=n instanceof X?n:null;if(null===p||p.type!==X.TableRow&&p.type!==X.TableColumn||!n.visible)k.push(n);else{l.push(p);for(var r=p.W.j,q=r.length,u=0;u<q;u++){var v=r[u];p.type===X.TableRow?v.row=n.row:p.type===X.TableColumn&&(v.column=n.column);k.push(v)}}}h=k.length;0===h&&(a.getRowDefinition(0),a.getColumnDefinition(0));for(var w=[],y=0;y<h;y++){var z=k[y];oj(z,!0);ml(z,!0);w[z.row]||(w[z.row]=
[]);w[z.row][z.column]||(w[z.row][z.column]=[]);w[z.row][z.column].push(z)}Ha(k);var A=Fa(),C=Fa(),G=Fa(),L={count:0},J={count:0},U=b,R=c,ca=a.sb;h=ca.length;for(var pa=0;pa<h;pa++){var O=ca[pa];void 0!==O&&(O.actual=0)}ca=a.ob;h=ca.length;for(var xa=0;xa<h;xa++)O=ca[xa],void 0!==O&&(O.actual=0);for(var Ma=w.length,hb=0,Ea=0;Ea<Ma;Ea++)w[Ea]&&(hb=Math.max(hb,w[Ea].length));var wb=Math.min(a.topIndex,Ma-1),Ad=Math.min(a.leftIndex,hb-1),ib=0;Ma=w.length;for(var Xb=xm(a),$a=0;$a<Ma;$a++)if(w[$a]){hb=
w[$a].length;for(var Nd=a.getRowDefinition($a),xc=Nd.actual=0;xc<hb;xc++)if(w[$a][xc]){var yf=a.getColumnDefinition(xc);void 0===A[xc]&&(yf.actual=0,A[xc]=!0);for(var Ye=w[$a][xc],Ge=Ye.length,lh=0;lh<Ge;lh++){var Ec=Ye[lh];if(Ec.visible||Ec===Xb){var zf=1<Ec.rowSpan||1<Ec.columnSpan;zf&&($a<wb||xc<Ad||C.push(Ec));var Ze=Ec.margin,Od=Ze.right+Ze.left,Yj=Ze.top+Ze.bottom;var Eb=El(Ec,Nd,yf,!1);var Af=Ec.desiredSize,Bd=!isNaN(Af.height),kc=!isNaN(Af.width)&&Bd;zf||Eb===xg||kc||$a<wb||xc<Ad||(void 0!==
L[xc]||Eb!==ud&&Eb!==Xk||(L[xc]=-1,L.count++),void 0!==J[$a]||Eb!==ud&&Eb!==Yk||(J[$a]=-1,J.count++),G.push(Ec));Ec.measure(Infinity,Infinity,0,0);if(!($a<wb||xc<Ad)){var $e=Ec.measuredBounds,Wc=Math.max($e.width+Od,0),eg=Math.max($e.height+Yj,0);if(1===Ec.rowSpan&&(Eb===xg||Eb===Xk)){O=a.getRowDefinition($a);var mh=O.uc();ib=Math.max(eg-O.actual,0);ib+mh>R&&(ib=Math.max(R-mh,0));var tn=0===O.actual;O.actual=O.actual+ib;R=Math.max(R-(ib+(tn?mh:0)),0)}if(1===Ec.columnSpan&&(Eb===xg||Eb===Yk)){O=a.getColumnDefinition(xc);
var fg=O.uc();ib=Math.max(Wc-O.actual,0);ib+fg>U&&(ib=Math.max(U-fg,0));var Zj=0===O.actual;O.actual=O.actual+ib;U=Math.max(U-(ib+(Zj?fg:0)),0)}zf&&Ec.qm()}}}}}Ha(A);var Yb=0,Oc=0;h=a.columnCount;for(var cc=0;cc<h;cc++){var gg=a.ob[cc];void 0!==gg&&(Yb+=gg.ha,0!==gg.ha&&(Yb+=gg.uc()))}h=a.rowCount;for(var nh=0;nh<h;nh++){var af=a.sb[nh];void 0!==af&&(Oc+=af.ha,0!==af.ha&&(Oc+=af.uc()))}U=Math.max(b-Yb,0);var wi=R=Math.max(c-Oc,0),he=U;h=G.length;for(var He=0;He<h;He++){var lc=G[He],ak=a.getRowDefinition(lc.row),
un=a.getColumnDefinition(lc.column),hg=lc.measuredBounds,xb=lc.margin,ig=xb.right+xb.left,bk=xb.top+xb.bottom;L[lc.column]=0===un.actual&&void 0!==L[lc.column]?Math.max(hg.width+ig,L[lc.column]):null;J[lc.row]=0===ak.actual&&void 0!==J[lc.row]?Math.max(hg.height+bk,J[lc.row]):null}var xi=0,jg=0,Bf;for(Bf in J)"count"!==Bf&&(xi+=J[Bf]);for(Bf in L)"count"!==Bf&&(jg+=L[Bf]);for(var ab=M.alloc(),kg=0;kg<h;kg++){var mc=G[kg];if(mc.visible||mc===Xb){var Fc=a.getRowDefinition(mc.row),bb=a.getColumnDefinition(mc.column),
Cd=0;isFinite(bb.width)?Cd=bb.width:(isFinite(U)&&null!==L[mc.column]?0===jg?Cd=bb.actual+U:Cd=L[mc.column]/jg*he:null!==L[mc.column]?Cd=U:Cd=bb.actual||U,Cd=Math.max(0,Cd-bb.uc()));var Dd=0;isFinite(Fc.height)?Dd=Fc.height:(isFinite(R)&&null!==J[mc.row]?0===xi?Dd=Fc.actual+R:Dd=J[mc.row]/xi*wi:null!==J[mc.row]?Dd=R:Dd=Fc.actual||R,Dd=Math.max(0,Dd-Fc.uc()));ab.h(Math.max(bb.minimum,Math.min(Cd,bb.maximum)),Math.max(Fc.minimum,Math.min(Dd,Fc.maximum)));Eb=El(mc,Fc,bb,!1);switch(Eb){case Xk:ab.height=
Math.max(ab.height,Fc.actual+R);break;case Yk:ab.width=Math.max(ab.width,bb.actual+U)}var Pd=mc.margin,vn=Pd.right+Pd.left,oh=Pd.top+Pd.bottom;mc.qm();mc.measure(ab.width,ab.height,bb.minimum,Fc.minimum);var ph=mc.measuredBounds,qh=Math.max(ph.width+vn,0),rh=Math.max(ph.height+oh,0);isFinite(U)&&(qh=Math.min(qh,ab.width));isFinite(R)&&(rh=Math.min(rh,ab.height));var lg=0;lg=Fc.actual;Fc.actual=Math.max(Fc.actual,rh);ib=Fc.actual-lg;R=Math.max(R-ib,0);lg=bb.actual;bb.actual=Math.max(bb.actual,qh);
ib=bb.actual-lg;U=Math.max(U-ib,0)}}Ha(G);var Ed=M.alloc(),Xc=Fa(),ie=Fa();h=C.length;if(0!==h)for(var yb=0;yb<Ma;yb++)if(w[yb]){hb=w[yb].length;var yi=a.getRowDefinition(yb);Xc[yb]=yi.actual;for(var Yc=0;Yc<hb;Yc++)if(w[yb][Yc]){var wn=a.getColumnDefinition(Yc);ie[Yc]=wn.actual}}for(var je=0;je<h;je++){var Na=C[je];if(Na.visible||Na===Xb){var Fd=a.getRowDefinition(Na.row),nc=a.getColumnDefinition(Na.column);ab.h(Math.max(nc.minimum,Math.min(b,nc.maximum)),Math.max(Fd.minimum,Math.min(c,Fd.maximum)));
Eb=El(Na,Fd,nc,!1);switch(Eb){case ud:0!==ie[nc.index]&&(ab.width=Math.min(ab.width,ie[nc.index]));0!==Xc[Fd.index]&&(ab.height=Math.min(ab.height,Xc[Fd.index]));break;case Xk:0!==ie[nc.index]&&(ab.width=Math.min(ab.width,ie[nc.index]));break;case Yk:0!==Xc[Fd.index]&&(ab.height=Math.min(ab.height,Xc[Fd.index]))}isFinite(nc.width)&&(ab.width=nc.width);isFinite(Fd.height)&&(ab.height=Fd.height);Ed.h(0,0);for(var ke=1;ke<Na.rowSpan&&!(Na.row+ke>=a.rowCount);ke++)O=a.getRowDefinition(Na.row+ke),ib=0,
ib=Eb===ud||Eb===Yk?Math.max(O.minimum,0===Xc[Na.row+ke]?O.maximum:Math.min(Xc[Na.row+ke],O.maximum)):Math.max(O.minimum,isNaN(O.Qc)?O.maximum:Math.min(O.Qc,O.maximum)),Ed.height+=ib;for(var le=1;le<Na.columnSpan&&!(Na.column+le>=a.columnCount);le++)O=a.getColumnDefinition(Na.column+le),ib=0,ib=Eb===ud||Eb===Xk?Math.max(O.minimum,0===ie[Na.column+le]?O.maximum:Math.min(ie[Na.column+le],O.maximum)):Math.max(O.minimum,isNaN(O.Qc)?O.maximum:Math.min(O.Qc,O.maximum)),Ed.width+=ib;ab.width+=Ed.width;ab.height+=
Ed.height;var sh=Na.margin,th=sh.right+sh.left,Qd=sh.top+sh.bottom;Na.measure(ab.width,ab.height,f,g);for(var me=Na.measuredBounds,Ie=Math.max(me.width+th,0),Je=Math.max(me.height+Qd,0),ne=0,od=0;od<Na.rowSpan&&!(Na.row+od>=a.rowCount);od++)O=a.getRowDefinition(Na.row+od),ne+=O.total||0;if(ne<Je){var Cf=Je-ne,mg=Je-ne;if(null!==Na.spanAllocation)for(var xn=Na.spanAllocation,uh=0;uh<Na.rowSpan&&!(0>=Cf)&&!(Na.row+uh>=a.rowCount);uh++){O=a.getRowDefinition(Na.row+uh);var Gd=O.ha||0,zi=xn(Na,O,mg);O.actual=
Math.min(O.maximum,Gd+zi);O.ha!==Gd&&(Cf-=O.ha-Gd)}for(;0<Cf;){var vh=O.ha||0;isNaN(O.height)&&O.maximum>vh&&(O.actual=Math.min(O.maximum,vh+Cf),O.ha!==vh&&(Cf-=O.ha-vh));if(0===O.index)break;O=a.getRowDefinition(O.index-1)}}for(var wh=0,ck=0;ck<Na.columnSpan&&!(Na.column+ck>=a.columnCount);ck++)O=a.getColumnDefinition(Na.column+ck),wh+=O.total||0;if(wh<Ie){var Ai=Ie-wh,Lt=Ie-wh;if(null!==Na.spanAllocation)for(var Mt=Na.spanAllocation,dk=0;dk<Na.columnSpan&&!(0>=Ai)&&!(Na.column+dk>=a.columnCount);dk++){O=
a.getColumnDefinition(Na.column+dk);var yn=O.ha||0,Nt=Mt(Na,O,Lt);O.actual=Math.min(O.maximum,yn+Nt);O.ha!==yn&&(Ai-=O.ha-yn)}for(;0<Ai;){var ek=O.ha||0;isNaN(O.width)&&O.maximum>ek&&(O.actual=Math.min(O.maximum,ek+Ai),O.ha!==ek&&(Ai-=O.ha-ek));if(0===O.index)break;O=a.getColumnDefinition(O.index-1)}}}}Ha(C);M.free(Ed);M.free(ab);void 0!==Xc&&Ha(Xc);void 0!==ie&&Ha(ie);var ng=0,og=0,fk=a.desiredSize,ir=a.maxSize;Eb=ll(a,!0);var Bi=Oc=Yb=0,Ci=0;h=a.columnCount;for(var gk=0;gk<h;gk++)void 0!==a.ob[gk]&&
(O=a.getColumnDefinition(gk),isFinite(O.width)?(Bi+=O.width,Bi+=O.uc()):Fm(O)===Gm?(Bi+=O.ha,Bi+=O.uc()):0!==O.ha&&(Yb+=O.ha,Yb+=O.uc()));isFinite(fk.width)?ng=Math.min(fk.width,ir.width):ng=Eb!==xg&&isFinite(b)?b:Yb;ng=Math.max(ng,a.minSize.width);ng=Math.max(ng-Bi,0);for(var Ot=0===Yb?1:Math.max(ng/Yb,1),ik=0;ik<h;ik++)void 0!==a.ob[ik]&&(O=a.getColumnDefinition(ik),isFinite(O.width)||Fm(O)===Gm||(O.actual=O.ha*Ot),O.position=e.width,0!==O.ha&&(e.width+=O.ha,e.width+=O.uc()));h=a.rowCount;for(var jk=
0;jk<h;jk++)void 0!==a.sb[jk]&&(O=a.getRowDefinition(jk),isFinite(O.height)?(Ci+=O.height,Ci+=O.uc()):Fm(O)===Gm?(Ci+=O.ha,Ci+=O.uc()):0!==O.ha&&(Oc+=O.ha,0!==O.ha&&(Oc+=O.uc())));isFinite(fk.height)?og=Math.min(fk.height,ir.height):og=Eb!==xg&&isFinite(c)?c:Oc;og=Math.max(og,a.minSize.height);og=Math.max(og-Ci,0);for(var Pt=0===Oc?1:Math.max(og/Oc,1),kk=0;kk<h;kk++)void 0!==a.sb[kk]&&(O=a.getRowDefinition(kk),isFinite(O.height)||Fm(O)===Gm||(O.actual=O.ha*Pt),O.position=e.height,0!==O.ha&&(e.height+=
O.ha,0!==O.ha&&(e.height+=O.uc())));h=l.length;for(var zn=0;zn<h;zn++){var pd=l[zn],An=0,Bn=0;pd.type===X.TableRow?(An=e.width,O=a.getRowDefinition(pd.row),Bn=O.actual):(O=a.getColumnDefinition(pd.column),An=O.actual,Bn=e.height);pd.measuredBounds.h(0,0,An,Bn);oj(pd,!1);w[pd.row]||(w[pd.row]=[]);w[pd.row][pd.column]||(w[pd.row][pd.column]=[]);w[pd.row][pd.column].push(pd)}Ha(l);a.xp=w};
Em.prototype.arrange=function(a,b,c){var d=b.length,e=a.padding,f=e.left;e=e.top;for(var g=a.xp,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.sb[n]||0===a.sb[n].ha);)n++;n=Math.min(n,l-1);n=-a.sb[n].position;for(h=Math.min(a.leftIndex,m-1);h!==m&&(void 0===a.ob[h]||0===a.ob[h].ha);)h++;h=Math.min(h,m-1);for(var p=-a.ob[h].position,r=M.alloc(),q=0;q<l;q++)if(g[q]){m=g[q].length;var u=a.getRowDefinition(q);k=u.position+n+e;0!==u.ha&&
(k+=u.uv());for(var v=0;v<m;v++)if(g[q][v]){var w=a.getColumnDefinition(v);h=w.position+p+f;0!==w.ha&&(h+=w.uv());for(var y=g[q][v],z=y.length,A=0;A<z;A++){var C=y[A],G=C.measuredBounds,L=C instanceof X?C:null;if(null===L||L.type!==X.TableRow&&L.type!==X.TableColumn){r.h(0,0);for(var J=1;J<C.rowSpan&&!(q+J>=a.rowCount);J++)L=a.getRowDefinition(q+J),r.height+=L.total;for(J=1;J<C.columnSpan&&!(v+J>=a.columnCount);J++)L=a.getColumnDefinition(v+J),r.width+=L.total;var U=w.ha+r.width,R=u.ha+r.height;J=
h;L=k;var ca=U,pa=R,O=h,xa=k,Ma=U,hb=R;h+U>c.width&&(Ma=Math.max(c.width-h,0));k+R>c.height&&(hb=Math.max(c.height-k,0));var Ea=C.alignment;if(Ea.Nb()){Ea=a.defaultAlignment;Ea.hb()||(Ea=Ac);var wb=Ea.x;var Ad=Ea.y;var ib=Ea.offsetX;Ea=Ea.offsetY;var Xb=w.alignment,$a=u.alignment;Xb.hb()&&(wb=Xb.x,ib=Xb.offsetX);$a.hb()&&(Ad=$a.y,Ea=$a.offsetY)}else wb=Ea.x,Ad=Ea.y,ib=Ea.offsetX,Ea=Ea.offsetY;if(isNaN(wb)||isNaN(Ad))Ad=wb=.5,Ea=ib=0;Xb=G.width;$a=G.height;var Nd=C.margin,xc=Nd.left+Nd.right,yf=Nd.top+
Nd.bottom,Ye=El(C,u,w,!1);!isNaN(C.desiredSize.width)||Ye!==ud&&Ye!==Xk||(Xb=Math.max(U-xc,0));!isNaN(C.desiredSize.height)||Ye!==ud&&Ye!==Yk||($a=Math.max(R-yf,0));U=C.maxSize;R=C.minSize;Xb=Math.min(U.width,Xb);$a=Math.min(U.height,$a);Xb=Math.max(R.width,Xb);$a=Math.max(R.height,$a);U=$a+yf;J+=ca*wb-(Xb+xc)*wb+ib+Nd.left;L+=pa*Ad-U*Ad+Ea+Nd.top;C.visible&&(fc(O,xa,Ma,hb,J,L,G.width,G.height)?C.arrange(J,L,Xb,$a):C.arrange(J,L,Xb,$a,new N(O,xa,Ma,hb)))}else C.nl(),C.actualBounds.ea(),ca=C.actualBounds,
J=N.allocAt(ca.x,ca.y,ca.width,ca.height),ca.x=L.type===X.TableRow?f:h,ca.y=L.type===X.TableColumn?e:k,ca.width=G.width,ca.height=G.height,C.actualBounds.freeze(),ml(C,!1),$b(J,ca)||(G=C.part,null!==G&&(G.Ih(),C.Yo(G))),N.free(J)}}}M.free(r);for(a=0;a<d;a++)c=b[a],f=c instanceof X?c:null,null===f||f.type!==X.TableRow&&f.type!==X.TableColumn||(f=c.actualBounds,c.naturalBounds.ea(),c.naturalBounds.h(0,0,f.width,f.height),c.naturalBounds.freeze())};function Hm(){this.name="Base"}la(Hm,Pl);
Hm.prototype.measure=function(){};Hm.prototype.arrange=function(){};function Im(){this.name="Base"}la(Im,Pl);Im.prototype.measure=function(){};Im.prototype.arrange=function(){};function Jm(){this.name="Base"}la(Jm,Pl);
Jm.prototype.measure=function(a,b,c,d,e,f,g){1<d.length&&B("Viewbox Panel cannot contain more than one GraphObject.");d=d[0];d.ya=1;d.qm();d.measure(Infinity,Infinity,f,g);var h=d.measuredBounds,k=d.margin,l=k.right+k.left;k=k.top+k.bottom;if(isFinite(b)||isFinite(c)){var m=d.scale,n=h.width;h=h.height;var p=Math.max(b-l,0),r=Math.max(c-k,0),q=1;a.viewboxStretch===zg?0!==n&&0!==h&&(q=Math.min(p/n,r/h)):0!==n&&0!==h&&(q=Math.max(p/n,r/h));0===q&&(q=1E-4);d.ya*=q;m!==d.scale&&(oj(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)};Jm.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.Nb()&&(g=a.defaultAlignment);g.hb()||(g=Ac);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 Km(){this.name="Base"}la(Km,Pl);Km.prototype.measure=function(){};
Km.prototype.arrange=function(){};
Km.prototype.bc=function(a,b,c){c=a.uf()*c.scale;0>=c&&(c=1);var d=a.gridCellSize,e=d.width;d=d.height;var f=a.naturalBounds,g=a.actualBounds,h=f.width,k=f.height,l=Math.ceil(h/e),m=Math.ceil(k/d),n=a.gridOrigin;b.save();b.beginPath();b.rect(0,0,h,k);b.clip();for(var p=[],r=a.W.j,q=r.length,u=0;u<q;u++){var v=r[u],w=[];p.push(w);if(v.visible){var y=v.interval;if(!(0>y)){v=Wj(v.figure);for(var z=0;z<q;z++)if(z!==u){var A=r[z];A.visible&&Wj(A.figure)===v&&(A=A.interval,A>y&&w.push(A))}}}}r=a.W.j;q=
r.length;for(u=0;u<q;u++){var C=r[u];if(C.visible&&(w=C.interval,!(2>e*Math.abs(w)*c))){y=C.opacity;v=1;if(1!==y){if(0===y)continue;v=b.globalAlpha;b.globalAlpha=v*y}z=p[u];A=!1;var G=C.strokeDashArray;null!==G&&(A=!0,b.st(G,C.strokeDashOffset));if("LineV"===C.figure&&null!==C.stroke&&0<C.strokeWidth){b.lineWidth=C.strokeWidth;li(a,b,C.stroke,!1,!1,f,g);b.beginPath();for(G=C=Math.floor(-n.x/e);G<=C+l;G++){var L=G*e+n.x;0<=L&&L<=h&&Lm(G,w,z)&&(b.moveTo(L,0),b.lineTo(L,k))}b.stroke()}else if("LineH"===
C.figure&&null!==C.stroke&&0<C.strokeWidth){b.lineWidth=C.strokeWidth;li(a,b,C.stroke,!1,!1,f,g);b.beginPath();for(G=C=Math.floor(-n.y/d);G<=C+m;G++)L=G*d+n.y,0<=L&&L<=k&&Lm(G,w,z)&&(b.moveTo(0,L),b.lineTo(h,L));b.stroke()}else if("BarV"===C.figure&&null!==C.fill)for(li(a,b,C.fill,!0,!1,f,g),C=C.width,isNaN(C)&&(C=e),L=G=Math.floor(-n.x/e);L<=G+l;L++){var J=L*e+n.x;0<=J&&J<=h&&Lm(L,w,z)&&b.fillRect(J,0,C,k)}else if("BarH"===C.figure&&null!==C.fill)for(li(a,b,C.fill,!0,!1,f,g),C=C.height,isNaN(C)&&
(C=d),L=G=Math.floor(-n.y/d);L<=G+m;L++)J=L*d+n.y,0<=J&&J<=k&&Lm(L,w,z)&&b.fillRect(0,J,h,C);A&&b.qt();1!==y&&(b.globalAlpha=v)}}b.restore();b.sc(!1)};function Lm(a,b,c){if(0>b)return 0===a%b;if(0!==a%b)return!1;b=c.length;for(var d=0;d<b;d++)if(0===a%c[d])return!1;return!0}function Mm(){this.name="Base"}la(Mm,Pl);
Mm.prototype.measure=function(a,b,c,d,e){c=d.length;if(a instanceof Ke||a instanceof S){var f=null,g=null,h=null;a instanceof S&&(g=f=a);a instanceof Ke&&(h=a,f=h.adornedPart);if(f instanceof S){var k=f;if(0===c)Vb(a.naturalBounds,0,0),a.measuredBounds.h(0,0,0,0);else{var l=a instanceof Ke?null:f.path,m=f.routeBounds;b=a.sg;b.h(0,0,m.width,m.height);var n=k.points;f=f.pointsCount;null!==h?h.qk(!1):null!==g&&g.qk(!1);var p=m.width,r=m.height;a.location.h(m.x,m.y);a.l.length=0;null!==l&&(Nm(a,p,r,l),
h=l.measuredBounds,b.Jc(h),a.l.push(h));h=qd.alloc();for(var q=I.alloc(),u=I.alloc(),v=0;v<c;v++){var w=d[v];if(w!==l)if(w.isPanelMain&&w instanceof W){Nm(a,p,r,w);var y=w.measuredBounds;b.Jc(y);a.l.push(y)}else if(2>f)w.measure(Infinity,Infinity,0,0),y=w.measuredBounds,b.Jc(y),a.l.push(y);else{var z=w.segmentIndex,A=w.segmentFraction,C=w.alignmentFocus;C.kc()&&(C=Ac);var G=w.segmentOrientation,L=w.segmentOffset;if(isNaN(z)){var J=k.ka;y=Fa();J.Jv(A,y);var U=I.allocAt(y[0],y[1]);U.add(k.i(0));J.type===
vd?U.offset(-J.startX,-J.startY):(J=J.figures.first(),U.offset(-J.startX,-J.startY));J=y[2];if(G!==ag){var R=k.computeAngle(w,G,J);w.Yb=R}R=U.x-m.x;var ca=U.y-m.y;I.free(U);Ha(y)}else if(z<-f||z>=f)ca=k.midPoint,J=k.midAngle,G!==ag&&(R=k.computeAngle(w,G,J),w.Yb=R),R=ca.x-m.x,ca=ca.y-m.y;else{R=0;0<=z?(ca=n.L(z),y=z<f-1?n.L(z+1):ca):(R=f+z,ca=n.L(R),y=0<R?n.L(R-1):ca);if(ca.Ma(y)){0<=z?(J=0<z?n.L(z-1):ca,R=z<f-2?n.L(z+2):y):(J=R<f-1?n.L(R+1):ca,R=1<R?n.L(R-2):y);U=J.De(ca);var pa=y.De(R);J=U>pa+10?
0<=z?J.Sa(ca):ca.Sa(J):pa>U+10?0<=z?y.Sa(R):R.Sa(y):0<=z?J.Sa(R):R.Sa(J)}else J=0<=z?ca.Sa(y):y.Sa(ca);G!==ag&&(R=k.computeAngle(w,G,J),w.Yb=R);R=ca.x+(y.x-ca.x)*A-m.x;ca=ca.y+(y.y-ca.y)*A-m.y}w.measure(Infinity,Infinity,0,0);y=w.measuredBounds;U=w.naturalBounds;var O=0;w instanceof W&&(O=w.strokeWidth);pa=U.width+O;var xa=U.height+O;h.reset();h.translate(-y.x,-y.y);h.scale(w.scale,w.scale);h.rotate(G===ag?w.angle:J,pa/2,xa/2);G!==Om&&G!==Pm||h.rotate(90,pa/2,xa/2);G!==Qm&&G!==Rm||h.rotate(-90,pa/
2,xa/2);G===Sm&&(45<J&&135>J||225<J&&315>J)&&h.rotate(-J,pa/2,xa/2);U=new N(0,0,pa,xa);q.gj(U,C);h.ra(q);C=-q.x+O/2*w.scale;w=-q.y+O/2*w.scale;u.assign(L);O=isNaN(L.x);var Ma=isNaN(L.y);if(O||Ma){pa=pa/2+3;xa=xa/2+3;var hb=45<=J&&135>=J,Ea=225<=J&&315>=J;G===ag&&(hb||Ea)?(u.x=Ma?pa:L.y,u.y=O?xa:L.x,hb?0<=z||isNaN(z)&&.5>A||!O||(u.y=-xa):Ea&&((0<=z||isNaN(z)&&.5>A)&&O&&(u.y=-xa),Ma&&(u.x=-pa))):(O&&(u.x=0<=z||isNaN(z)&&.5>A?pa:-pa),Ma&&(u.y=-xa),u.rotate(J))}else u.rotate(J);R+=u.x;ca+=u.y;U.set(y);
U.h(R+C,ca+w,y.width,y.height);a.l.push(U);b.Jc(U)}}if(null!==g)for(d=g.labelNodes;d.next();)d.value.measure(Infinity,Infinity);a.sg=b;a=a.location;a.h(a.x+b.x,a.y+b.y);Vb(e,b.width||0,b.height||0);qd.free(h);I.free(q);I.free(u)}}}};
Mm.prototype.arrange=function(a,b){var c=b.length;if(a instanceof Ke||a instanceof S){var d=null,e=null,f=null;a instanceof S&&(e=d=a);a instanceof Ke&&(f=a,d=f.adornedPart);var g=a instanceof Ke?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.sg.x,l.y-a.sg.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.sg.x,n.y-a.sg.y,n.width,n.height)}}}b=d.points;c=b.count;if(2<=c&&a instanceof S)for(d=
a.labelNodes;d.next();){var p=a;g=d.value;h=g.segmentIndex;k=g.segmentFraction;var r=g.alignmentFocus;l=g.segmentOrientation;m=g.segmentOffset;if(isNaN(h)){n=p.ka;var q=Fa();n.Jv(k,q);var u=I.allocAt(q[0],q[1]);u.add(p.i(0));n.type===vd?u.offset(-n.startX,-n.startY):(n=n.figures.first(),u.offset(-n.startX,-n.startY));n=q[2];l!==ag&&(p=p.computeAngle(g,l,n),g.angle=p);p=u.x;var v=u.y;I.free(u);Ha(q)}else if(h<-c||h>=c)v=p.midPoint,n=p.midAngle,l!==ag&&(p=p.computeAngle(g,l,n),g.angle=p),p=v.x,v=v.y;
else{u=0;0<=h?(q=b.j[h],v=h<c-1?b.j[h+1]:q):(u=c+h,q=b.j[u],v=0<u?b.j[u-1]:q);if(q.Ma(v)){0<=h?(n=0<h?b.j[h-1]:q,u=h<c-2?b.j[h+2]:v):(n=u<c-1?b.j[u+1]:q,u=1<u?b.j[u-2]:v);var w=n.De(q),y=v.De(u);n=w>y+10?0<=h?n.Sa(q):q.Sa(n):y>w+10?0<=h?v.Sa(u):u.Sa(v):0<=h?n.Sa(u):u.Sa(n)}else n=0<=h?q.Sa(v):v.Sa(q);l!==ag&&(p=p.computeAngle(g,l,n),g.angle=p);p=q.x+(v.x-q.x)*k;v=q.y+(v.y-q.y)*k}if(r.Ht())g.location=new I(p,v);else{r.kc()&&(r=Ac);q=qd.alloc();q.reset();q.scale(g.scale,g.scale);q.rotate(g.angle,0,
0);var z=g.naturalBounds;u=N.allocAt(0,0,z.width,z.height);w=I.alloc();w.gj(u,r);q.ra(w);r=-w.x;y=-w.y;var A=z.width,C=z.height;z=I.alloc();z.assign(m);var G=isNaN(m.x),L=isNaN(m.y);if(G||L){A=A/2+3;C=C/2+3;var J=45<=n&&135>=n,U=225<=n&&315>=n;l===ag&&(J||U)?(z.x=L?A:m.y,z.y=G?C:m.x,J?0<=h||isNaN(h)&&.5>k||!G||(z.y=-C):U&&((0<=h||isNaN(h)&&.5>k)&&G&&(z.y=-C),L&&(z.x=-A))):(G&&(z.x=0<=h||isNaN(h)&&.5>k?A:-A),L&&(z.y=-C),z.rotate(n))}else z.rotate(n);p+=z.x;v+=z.y;q.Bw(u);r+=u.x;y+=u.y;h=I.allocAt(p+
r,v+y);g.move(h);I.free(h);I.free(z);I.free(w);N.free(u);qd.free(q)}}null!==f?f.qk(!1):null!==e&&e.qk(!1)}};
function Nm(a,b,c,d){if(!1!==tj(d)){var e=d.strokeWidth;0===e&&a instanceof Ke&&a.type===X.Link&&a.adornedObject instanceof W&&(e=a.adornedObject.strokeWidth);e*=d.ya;a instanceof S&&null!==a.ka?(a=a.ka.bounds,il(d,a.x-e/2,a.y-e/2,a.width+e,a.height+e)):a instanceof Ke&&null!==a.adornedPart.ka?(a=a.adornedPart.ka.bounds,il(d,a.x-e/2,a.y-e/2,a.width+e,a.height+e)):il(d,-(e/2),-(e/2),b+e,c+e);oj(d,!1)}}function Tm(){this.name="Base"}la(Tm,Pl);
Tm.prototype.measure=function(a,b,c,d,e,f,g){var h=a.tb();a.Wg=[];var k=h.margin,l=k.right+k.left,m=k.top+k.bottom;h.measure(b,c,f,g);var n=h.measuredBounds,p=new N(-k.left,-k.top,Math.max(n.width+l,0),Math.max(n.height+m,0));a.Wg.push(p);e.assign(p);for(var r=h.geometry,q=h.strokeWidth,u=r.flattenedSegments,v=r.flattenedLengths,w=r.flattenedTotalLength,y=u.length,z=0,A=0,C=Fa(),G=0;G<y;G++){var L=u[G],J=[];A=z=0;for(var U=L.length,R=0;R<U;R+=2){var ca=L[R],pa=L[R+1];if(0!==R){var O=180*Math.atan2(pa-
A,ca-z)/Math.PI;0>O&&(O+=360);J.push(O)}z=ca;A=pa}C.push(J)}if(null===a.Xg){for(var xa=[],Ma=a.W.j,hb=Ma.length,Ea=0;Ea<hb;Ea++){var wb=Ma[Ea],Ad=[];xa.push(Ad);if(wb.visible){var ib=wb.interval;if(!(0>ib))for(var Xb=0;Xb<hb;Xb++)if(Xb!==Ea){var $a=Ma[Xb];if($a.visible&&wb.constructor===$a.constructor){var Nd=$a.interval;Nd>ib&&Ad.push(Nd)}}}}a.Xg=xa}var xc=a.Xg;var yf=a.W.j,Ye=yf.length,Ge=0,lh=0,Ec=w;a.xj=[];for(var zf,Ze=0;Ze<Ye;Ze++){var Od=yf[Ze];zf=[];if(Od.visible&&Od!==h){var Yj=Math.abs(Od.interval),
Eb=a.graduatedTickUnit;if(!(2>Eb*Yj*w/a.graduatedRange)){var Af=v[0][0],Bd=0,kc=0;lh=w*Od.graduatedStart-1E-4;Ec=w*Od.graduatedEnd+1E-4;var $e=Eb*Yj,Wc=a.graduatedTickBase;if(Wc<a.graduatedMin){var eg=(a.graduatedMin-Wc)/$e;eg=0===eg%1?eg:Math.floor(eg+1);Wc+=eg*$e}else Wc>a.graduatedMin+$e&&(Wc-=Math.floor((Wc-a.graduatedMin)/$e)*$e);for(var mh=xc[Ze];Wc<=a.graduatedMax;){a:{for(var tn=mh.length,fg=0;fg<tn;fg++)if(K.$((Wc-a.graduatedTickBase)%(mh[fg]*a.graduatedTickUnit),0)){var Zj=!1;break a}Zj=
!0}if(Zj&&(null===Od.graduatedSkip||!Od.graduatedSkip(Wc))&&(Ge=(Wc-a.graduatedMin)*w/a.graduatedRange,Ge>w&&(Ge=w),lh<=Ge&&Ge<=Ec)){for(var Yb=C[Bd][kc],Oc=v[Bd][kc];Bd<v.length;){for(;Ge>Af&&kc<v[Bd].length-1;)kc++,Yb=C[Bd][kc],Oc=v[Bd][kc],Af+=Oc;if(Ge<=Af)break;Bd++;kc=0;Yb=C[Bd][kc];Oc=v[Bd][kc];Af+=Oc}var cc=u[Bd],gg=cc[2*kc],nh=cc[2*kc+1],af=(Ge-(Af-Oc))/Oc,wi=new I(gg+(cc[2*kc+2]-gg)*af+q/2-r.bounds.x,nh+(cc[2*kc+3]-nh)*af+q/2-r.bounds.y);wi.scale(h.scale,h.scale);var he=Yb,He=C[Bd];1E-4>
af?0<kc?he=He[kc-1]:K.$(cc[0],cc[cc.length-2])&&K.$(cc[1],cc[cc.length-1])&&(he=He[He.length-1]):.9999<af&&(kc+1<He.length?he=He[kc+1]:K.$(cc[0],cc[cc.length-2])&&K.$(cc[1],cc[cc.length-1])&&(he=He[0]));Yb!==he&&(180<Math.abs(Yb-he)&&(Yb<he?Yb+=360:he+=360),Yb=(Yb+he)/2%360);if(Od instanceof Ug){var lc="";null!==Od.graduatedFunction?(lc=Od.graduatedFunction(Wc),lc=null!==lc&&void 0!==lc?lc.toString():""):lc=(+Wc.toFixed(2)).toString();""!==lc&&zf.push({ym:wi,angle:Yb,text:lc})}else zf.push({ym:wi,
angle:Yb})}Wc+=$e}}}a.xj.push(zf)}Ha(C);var ak=a.xj;if(null!==ak)for(var un=d.length,hg=0;hg<un;hg++){var xb=d[hg],ig=ak[hg];if(xb.visible&&xb!==h&&0!==ig.length){if(xb instanceof W){var bk=a,xi=e,jg=xb.alignmentFocus;jg.kc()&&(jg=wc);var Bf=xb.angle;xb.Yb=0;xb.measure(Infinity,Infinity,0,0);xb.Yb=Bf;var ab=xb.measuredBounds,kg=ab.width,mc=ab.height,Fc=N.allocAt(0,0,kg,mc),bb=I.alloc();bb.gj(Fc,jg);N.free(Fc);for(var Cd=-bb.x,Dd=-bb.y,Pd=new N,vn=ig.length,oh=0;oh<vn;oh++)for(var ph=ig[oh],qh=ph.ym.x,
rh=ph.ym.y,lg=ph.angle,Ed=0;4>Ed;Ed++){switch(Ed){case 0:bb.h(Cd,Dd);break;case 1:bb.h(Cd+kg,Dd);break;case 2:bb.h(Cd,Dd+mc);break;case 3:bb.h(Cd+kg,Dd+mc)}bb.rotate(lg+xb.angle);bb.offset(qh,rh);0===oh&&0===Ed?Pd.h(bb.x,bb.y,0,0):Pd.Ie(bb);bb.offset(-qh,-rh);bb.rotate(-lg-xb.angle)}I.free(bb);null!==bk.Wg&&bk.Wg.push(Pd);ec(xi,Pd.x,Pd.y,Pd.width,Pd.height)}else if(xb instanceof Ug){var Xc=a,ie=e;null===Xc.sh&&(Xc.sh=new Ug);var yb=Xc.sh;Um(yb,xb);var yi=xb.alignmentFocus;yi.kc()&&(yi=wc);for(var Yc=
xb.segmentOrientation,wn=xb.segmentOffset,je=new N,Na=0,Fd=0,nc=0,ke=0,le=0,sh=ig.length,th=0;th<sh;th++){var Qd=ig[th];Na=Qd.ym.x;Fd=Qd.ym.y;nc=Qd.angle;le=ke=xb.angle;Yc!==ag&&(le=Yc===Vm||Yc===Wm?nc+xb.angle:nc,ke=S.computeAngle(Yc,le));yb.Yb=ke;yb.text=Qd.text||"";yb.measure(Infinity,Infinity,0,0);var me=yb.measuredBounds,Ie=yb.naturalBounds,Je=Ie.width,ne=Ie.height,od=qd.alloc();od.reset();od.translate(-me.x,-me.y);od.scale(yb.scale,yb.scale);od.rotate(le,Je/2,ne/2);Yc!==Om&&Yc!==Pm||od.rotate(90,
Je/2,ne/2);Yc!==Qm&&Yc!==Rm||od.rotate(-90,Je/2,ne/2);Yc===Sm&&(45<nc&&135>nc||225<nc&&315>nc)&&od.rotate(-nc,Je/2,ne/2);var Cf=N.allocAt(0,0,Je,ne),mg=I.alloc();mg.gj(Cf,yi);od.ra(mg);var xn=-mg.x,uh=-mg.y,Gd=I.alloc();Gd.assign(wn);isNaN(Gd.x)&&(Gd.x=Je/2+3);isNaN(Gd.y)&&(Gd.y=-(ne/2+3));Gd.rotate(nc);Na+=Gd.x+xn;Fd+=Gd.y+uh;var zi=new N(Na,Fd,me.width,me.height),vh=new N(me.x,me.y,me.width,me.height),wh=new N(Ie.x,Ie.y,Ie.width,Ie.height);Qd.dA=ke;Qd.lineCount=yb.lineCount;Qd.lines=[yb.qb,yb.vi,
yb.je,yb.we,yb.Qb,yb.ib,yb.he];Qd.actualBounds=zi;Qd.measuredBounds=vh;Qd.naturalBounds=wh;0===th?je.assign(zi):je.Jc(zi);I.free(Gd);I.free(mg);N.free(Cf);qd.free(od)}null!==Xc.Wg&&Xc.Wg.push(je);ec(ie,je.x,je.y,je.width,je.height)}oj(xb,!1)}}};
Tm.prototype.arrange=function(a,b,c){if(null!==a.Wg){var d=a.tb(),e=a.xj;if(null!==e){var f=a.Wg,g=0,h=f[g];g++;null!==d&&d.arrange(h.x-c.x,h.y-c.y,h.width,h.height);for(var k=b.length,l=0;l<k;l++){var m=b[l];h=e[l];m.visible&&m!==d&&0!==h.length&&(h=f[g],g++,m.arrange(h.x-c.x,h.y-c.y,h.width,h.height))}a.Wg=null}}};
Tm.prototype.bc=function(a,b,c){var d=c.pi;c.pi=!0;var e=a.naturalBounds,f=e.width;e=e.height;b.save();b.beginPath();b.rect(-1,-1,f+1,e+1);b.clip();f=a.tb();f.bc(b,c);e=a.uf()*c.scale;0>=e&&(e=1);for(var g=f.actualBounds,h=a.W.j,k=a.xj,l=h.length,m=0;m<l;m++){var n=h[m],p=k[m],r=p.length;if(n.visible&&n!==f&&0!==p.length)if(n instanceof W){if(!(2>a.graduatedTickUnit*n.interval*f.geometry.flattenedTotalLength/a.graduatedRange*e)){var q=n.measuredBounds,u=n.strokeWidth*n.scale,v=n.alignmentFocus;v.kc()&&
(v=wc);for(var w=0;w<r;w++){var y=p[w].ym,z=p[w].angle,A=v,C=n.nb;C.reset();C.translate(y.x+g.x,y.y+g.y);C.rotate(z+n.angle,0,0);C.translate(-q.width*A.x+A.offsetX+u/2,-q.height*A.y+A.offsetY+u/2);C.scale(n.scale,n.scale);Bl(n,!1);n.Sh.set(n.nb);n.Yk=n.scale;Cl(n,!1);n.bc(b,c);n.nb.reset()}}}else if(n instanceof Ug)for(null===a.sh&&(a.sh=new Ug),q=a.sh,Um(q,n),n=0;n<r;n++)u=p[n],u.actualBounds&&u.measuredBounds&&u.naturalBounds&&(q.Tb=u.text||"",q.Yb=u.dA||0,q.Oc=u.lineCount||0,v=u.lines,void 0!==
v&&(q.qb=v[0],q.vi=v[1],q.je=v[2],q.we=v[3],q.Qb=v[4],q.ib=v[5],q.he=v[6]),u.naturalBounds&&(q.pc=u.naturalBounds),u.actualBounds&&(v=u.actualBounds,q.arrange(v.x,v.y,v.width,v.height)),v=u.actualBounds,q.arrange(v.x,v.y,v.width,v.height),w=u.measuredBounds,u=u.naturalBounds,y=q.nb,y.reset(),y.translate(v.x+g.x,v.y+g.y),y.translate(-w.x,-w.y),jl(q,y,u.x,u.y,u.width,u.height),Bl(q,!1),q.Sh.set(q.nb),q.Yk=q.scale,Cl(q,!1),q.bc(b,c))}c.pi=d;b.restore();b.sc(!0)};
function X(a){Y.call(this);this.pa=void 0===a?X.Position:a;null===this.pa&&B("Panel type not specified or PanelLayout not loaded: "+a);this.W=new E;this.fb=sc;this.pa===X.Grid&&(this.isAtomic=!0);this.yn=$c;this.Nf=Wk;this.pa===X.Table&&Xm(this);this.cq=zg;this.Xn=Pb;this.Yn=Gb;this.Un=0;this.Tn=100;this.Wn=10;this.Vn=0;this.ei=this.kb=this.Xg=this.Wg=this.xj=null;this.no=NaN;this.oe=this.ui=null;this.rl="category";this.Md=null;this.sg=new N(NaN,NaN,NaN,NaN);this.sh=this.xp=this.Li=null;this.Fg=""}
la(X,Y);function Xm(a){a.qj=sc;a.Og=1;a.ki=null;a.ji=null;a.Ng=1;a.Mg=null;a.ii=null;a.sb=[];a.ob=[];a.Pj=Ym;a.nj=Ym;a.Oi=0;a.xi=0}
X.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.pa=this.pa;a.fb=this.fb.G();a.yn=this.yn.G();a.Nf=this.Nf;if(a.pa===X.Table){a.qj=this.qj.G();a.Og=this.Og;a.ki=this.ki;a.ji=this.ji;a.Ng=this.Ng;a.Mg=this.Mg;a.ii=this.ii;var b=[];if(0<this.sb.length)for(var c=this.sb,d=c.length,e=0;e<d;e++)if(void 0!==c[e]){var f=c[e].copy();f.fj(a);b[e]=f}a.sb=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.fj(a),b[e]=f);a.ob=b;a.Pj=
this.Pj;a.nj=this.nj;a.Oi=this.Oi;a.xi=this.xi}a.cq=this.cq;a.Xn=this.Xn.G();a.Yn=this.Yn.G();a.Un=this.Un;a.Tn=this.Tn;a.Wn=this.Wn;a.Vn=this.Vn;a.xj=this.xj;a.Xg=this.Xg;a.kb=this.kb;a.ei=this.ei;a.no=this.no;a.ui=this.ui;a.oe=this.oe;a.rl=this.rl;a.sg.assign(this.sg);a.Fg=this.Fg;null!==this.xp&&(a.xp=this.xp)};X.prototype.sf=function(a){Y.prototype.sf.call(this,a);a.W=this.W;for(var b=a.W.j,c=b.length,d=0;d<c;d++)b[d].kg=a;a.Li=null};
X.prototype.copy=function(){var a=Y.prototype.copy.call(this);if(null!==a){for(var b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d].copy();e.fj(a);e.Mj=null;var f=a.W,g=f.count;f.ub(g,e);f=a.part;if(null!==f){f.Ij=null;null!==e.portId&&f instanceof V&&(f.Hh=!0);var h=a.diagram;null!==h&&h.undoManager.isUndoingRedoing||f.$a(we,"elements",a,null,e,null,g)}}return a}return null};t=X.prototype;t.toString=function(){return"Panel("+this.type+")#"+lb(this)};
t.Yo=function(a){Y.prototype.Yo.call(this,a);for(var b=this.W.j,c=b.length,d=0;d<c;d++)b[d].Yo(a)};
t.Ui=function(a,b){if(this.pa===X.Grid)this.pa.bc(this,a,b);else if(this.pa===X.Graduated)this.pa.bc(this,a,b);else{this.pa===X.Table&&(a.lineCap="butt",Zm(this,a,!0,this.sb,!0),Zm(this,a,!1,this.ob,!0),$m(this,a,!0,this.sb),$m(this,a,!1,this.ob),Zm(this,a,!0,this.sb,!1),Zm(this,a,!1,this.ob,!1));var c=this.isClipping&&this.pa===X.Spot;c&&a.save();for(var d=this.tb(),e=this.W.j,f=e.length,g=0;g<f;g++){var h=e[g];c&&h===d&&(a.clipInsteadOfFill=!0);h.bc(a,b);c&&h===d&&(a.clipInsteadOfFill=!1)}c&&(a.restore(),
a.sc(!0))}};
function $m(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.Og:a.Ng);var n=l.separatorStroke;null===n&&(n=c?a.ki:a.Mg);if(0!==m&&null!==n){li(a,b,n,!1,!1,g,f);n=!1;var p=l.separatorDashArray;null===p&&(p=c?a.ji:a.ii);null!==p&&(n=!0,b.st(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.fb;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.qt()}}}}
function Zm(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.uc(),p=l.separatorStrokeWidth;isNaN(p)&&(p=c?a.Og:a.Ng);var r=l.separatorStroke;null===r&&(r=c?a.ki:a.Mg);null===r&&(p=0);n-=p;p=l.position+p;n+=l.actual;p+n>m&&(n=m-p);0>=n||(m=a.fb,li(a,b,l.background,!0,!1,h,g),c?b.fillRect(m.left,p+m.top,g.width-(m.left+m.right),n):b.fillRect(p+
m.left,m.top,n,g.height-(m.top+m.bottom)))}}}}function Wj(a){return"LineV"===a||"BarV"===a}
t.jk=function(a,b,c,d,e){var f=this.ce(),g=this.transform,h=1/(g.m11*g.m22-g.m12*g.m21),k=g.m22*h,l=-g.m12*h,m=-g.m21*h,n=g.m11*h,p=h*(g.m21*g.dy-g.m22*g.dx),r=h*(g.m12*g.dx-g.m11*g.dy);if(null!==this.areaBackground)return g=this.actualBounds,K.Vc(g.left,g.top,g.right,g.bottom,a,b,c,d,e);if(null!==this.background)return f=a*k+b*m+p,h=a*l+b*n+r,a=c*k+d*m+p,k=c*l+d*n+r,e.h(0,0),c=this.naturalBounds,f=K.Vc(0,0,c.width,c.height,f,h,a,k,e),e.transform(g),f;f||(k=1,m=l=0,n=1,r=p=0);h=a*k+b*m+p;a=a*l+b*
n+r;k=c*k+d*m+p;c=c*l+d*n+r;e.h(k,c);d=(k-h)*(k-h)+(c-a)*(c-a);l=!1;n=this.W.j;r=n.length;m=I.alloc();p=null;b=Infinity;var q=null,u=this.isClipping&&this.pa===X.Spot;u&&(q=I.alloc(),p=this.tb(),(l=p.jk(h,a,k,c,q))&&(b=(h-q.x)*(h-q.x)+(a-q.y)*(a-q.y)));for(var v=0;v<r;v++){var w=n[v];w.visible&&w!==p&&w.jk(h,a,k,c,m)&&(l=!0,w=(h-m.x)*(h-m.x)+(a-m.y)*(a-m.y),w<d&&(d=w,e.set(m)))}u&&(b>d&&e.set(q),I.free(q));I.free(m);f&&e.transform(g);return l};
t.o=function(a){if(!0!==tj(this)){Y.prototype.o.call(this,a);a=null;if(this.pa===X.Auto||this.pa===X.Link)a=this.tb();for(var b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d];(e===a||e.isPanelMain)&&e.o(!0);if(!e.desiredSize.v()){var f=ll(e,!1);(e instanceof vg||e instanceof X||e instanceof Ug||f!==xg)&&e.o(!0)}}}};t.qm=function(){if(!1===tj(this)){oj(this,!0);ml(this,!0);for(var a=this.W.j,b=a.length,c=0;c<b;c++)a[c].qm()}};
t.nl=function(){if(0!==(this.F&2048)===!1){Bl(this,!0);Cl(this,!0);for(var a=this.W.j,b=a.length,c=0;c<b;c++)a[c].Pv()}};t.Pv=function(){Cl(this,!0);for(var a=this.W.j,b=a.length,c=0;c<b;c++)a[c].Pv()};
t.tm=function(a,b,c,d){var e=this.sg;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.fb;a=Math.max(a-k.left-k.right,0);b=Math.max(b-k.top-k.bottom,0);var l=this.W.j;0!==l.length&&this.pa.measure(this,a,b,l,e,c,d);a=e.width+k.left+k.right;k=e.height+k.top+k.bottom;
isFinite(f.width)&&(a=f.width);isFinite(f.height)&&(k=f.height);a=Math.min(h.width,a);k=Math.min(h.height,k);a=Math.max(g.width,a);k=Math.max(g.height,k);a=Math.max(c,a);k=Math.max(d,k);Vb(e,a,k);Vb(this.naturalBounds,a,k);il(this,0,0,a,k)};t.tb=function(){if(null===this.Li){var a=this.W.j,b=a.length;if(0===b)return null;for(var c=0;c<b;c++){var d=a[c];if(!0===d.isPanelMain)return this.Li=d}this.Li=a[0]}return this.Li};function xm(a){return null!==a.part?a.part.locationObject:null}
t.Ch=function(a,b,c,d){var e=this.W.j;this.actualBounds.h(a,b,c,d);if(0!==e.length){if(!this.desiredSize.v()){a=ll(this,!0);var f=this.measuredBounds;b=f.width;f=f.height;var g=this.bh,h=g.left+g.right;g=g.top+g.bottom;b===c&&f===d&&(a=xg);switch(a){case xg:if(b>c||f>d)this.o(),this.measure(b>c?c:b,f>d?d:f,0,0);break;case ud:this.o(!0);this.measure(c+h,d+g,0,0);break;case Xk:this.o(!0);this.measure(c+h,f+g,0,0);break;case Yk:this.o(!0),this.measure(b+h,d+g,0,0)}}this.pa.arrange(this,e,this.sg)}};
t.Eh=function(a){var b=this.naturalBounds,c=xm(this);if(fc(0,0,b.width,b.height,a.x,a.y)){b=this.W.j;for(var d=b.length,e=I.allocAt(0,0);d--;){var f=b[d];if(f.visible||f===c)if(Ab(e.set(a),f.transform),f.aa(e))return I.free(e),!0}I.free(e);return null===this.jb&&null===this.dc?!1:!0}return!1};t.tt=function(a){if(this.Lk===a)return this;for(var b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d].tt(a);if(null!==e)return e}return null};
t.Nm=function(a,b){b(this,a);if(a instanceof X){a=a.W.j;for(var c=a.length,d=0;d<c;d++)this.Nm(a[d],b)}};function Gj(a,b){an(a,a,b)}function an(a,b,c){c(b);b=b.W.j;for(var d=b.length,e=0;e<d;e++){var f=b[e];f instanceof X&&an(a,f,c)}}function bn(a,b){cn(a,a,b)}function cn(a,b,c){c(b);if(b instanceof X){b=b.W.j;for(var d=b.length,e=0;e<d;e++)cn(a,b[e],c)}}t.jm=function(a){return dn(this,this,a)};
function dn(a,b,c){if(c(b))return b;if(b instanceof X){b=b.W.j;for(var d=b.length,e=0;e<d;e++){var f=dn(a,b[e],c);if(null!==f)return f}}return null}t.Za=function(a){if(this.name===a)return this;var b=this.W.j,c=b.length;null===this.ui&&null===this.oe||(c=en(this));for(var d=0;d<c;d++){var e=b[d];if(e instanceof X){var f=e.Za(a);if(null!==f)return f}if(e.name===a)return e}return null};
function fn(a){a=a.W.j;for(var b=a.length,c=0,d=0;d<b;d++){var e=a[d];e instanceof X?c=Math.max(c,fn(e)):e instanceof W&&(c=Math.max(c,e.qh/2*e.Rj*e.uf()))}return c}t.ce=function(){return!(this.type===X.TableRow||this.type===X.TableColumn)};
t.Ub=function(a,b,c){if(!1===this.pickable)return null;void 0===b&&(b=null);void 0===c&&(c=null);if(uj(this))return null;var d=this.naturalBounds,e=1/this.uf(),f=this.ce(),g=f?a:Ab(I.allocAt(a.x,a.y),this.transform),h=this.diagram,k=10,l=5;null!==h&&(k=h.om("extraTouchArea"),l=k/2);if(fc(-(l*e),-(l*e),d.width+k*e,d.height+k*e,g.x,g.y)){if(!this.isAtomic){e=this.W.j;var m=e.length;h=I.alloc();l=(k=this.isClipping&&this.pa===X.Spot)?this.tb():null;if(k&&(l.ce()?Ab(h.set(a),l.transform):h.set(a),!l.aa(h)))return I.free(h),
f||I.free(g),null;for(var n=xm(this);m--;){var p=e[m];if(p.visible||p===n)if(p.ce()?Ab(h.set(a),p.transform):h.set(a),!k||p!==l){var r=null;p instanceof X?r=p.Ub(h,b,c):!0===p.pickable&&p.aa(h)&&(r=p);if(null!==r&&(null!==b&&(r=b(r)),null!==r&&(null===c||c(r))))return I.free(h),f||I.free(g),r}}I.free(h)}if(null===this.background&&null===this.areaBackground)return f||I.free(g),null;a=fc(0,0,d.width,d.height,g.x,g.y)?this:null;f||I.free(g);return a}f||I.free(g);return null};
t.Xi=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.ce(),g=f?a:Ab(I.allocAt(a.x,a.y),this.transform);e=fc(0,0,e.width,e.height,g.x,g.y);if(this.type===X.TableRow||this.type===X.TableColumn||e){if(!this.isAtomic){for(var h=this.W.j,k=h.length,l=I.alloc(),m=xm(this);k--;){var n=h[k];if(n.visible||n===m){n.ce()?Ab(l.set(a),n.transform):l.set(a);var p=n;n=n instanceof X?n:null;(null!==n?n.Xi(l,b,c,d):p.aa(l))&&!1!==p.pickable&&
(null!==b&&(p=b(p)),null===p||null!==c&&!c(p)||d.add(p))}}I.free(l)}f||I.free(g);return e&&(null!==this.background||null!==this.areaBackground)}f||I.free(g);return!1};
t.tf=function(a,b,c,d,e,f){if(!1===this.pickable)return!1;void 0===b&&(b=null);void 0===c&&(c=null);var g=f;void 0===f&&(g=qd.alloc(),g.reset());g.multiply(this.transform);if(this.Dh(a,g))return gn(this,b,c,e),void 0===f&&qd.free(g),!0;if(this.Ic(a,g)){if(!this.isAtomic)for(var h=xm(this),k=this.W.j,l=k.length;l--;){var m=k[l];if(m.visible||m===h){var n=m.actualBounds,p=this.naturalBounds;if(!(n.x>p.width||n.y>p.height||0>n.x+n.width||0>n.y+n.height)){n=m;m=m instanceof X?m:null;p=qd.alloc();p.set(g);
if(null!==m?m.tf(a,b,c,d,e,p):kl(n,a,d,p))null!==b&&(n=b(n)),null===n||null!==c&&!c(n)||e.add(n);qd.free(p)}}}void 0===f&&qd.free(g);return d}void 0===f&&qd.free(g);return!1};function gn(a,b,c,d){for(var e=a.W.j,f=e.length;f--;){var g=e[f];if(g.visible){var h=g.actualBounds,k=a.naturalBounds;h.x>k.width||h.y>k.height||0>h.x+h.width||0>h.y+h.height||(g instanceof X&&gn(g,b,c,d),null!==b&&(g=b(g)),null===g||null!==c&&!c(g)||d.add(g))}}}
t.xg=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.ce(),k=h?a:Ab(I.allocAt(a.x,a.y),this.transform),l=h?b:Ab(I.allocAt(b.x,b.y),this.transform),m=k.De(l),n=0<k.x&&k.x<g.width&&0<k.y&&k.y<g.height||Bb(k.x,k.y,0,0,0,g.height)<=m||Bb(k.x,k.y,0,g.height,g.width,g.height)<=m||Bb(k.x,k.y,g.width,g.height,g.width,0)<=m||Bb(k.x,k.y,g.width,0,0,0)<=m;g=k.dd(0,0)<=m&&k.dd(0,g.height)<=m&&k.dd(g.width,0)<=m&&k.dd(g.width,g.height)<=
m;h||(I.free(k),I.free(l));if(n){if(!this.isAtomic){k=I.alloc();l=I.alloc();m=xm(this);for(var p=this.W.j,r=p.length;r--;){var q=p[r];if(q.visible||q===m){var u=q.actualBounds,v=this.naturalBounds;if(!h||!(u.x>v.width||u.y>v.height||0>u.x+u.width||0>u.y+u.height))if(q.ce()?(u=q.transform,Ab(k.set(a),u),Ab(l.set(b),u)):(k.set(a),l.set(b)),u=q,q=q instanceof X?q:null,null!==q?q.xg(k,l,c,d,e,f):u.Wx(k,l,e))null!==c&&(u=c(u)),null===u||null!==d&&!d(u)||f.add(u)}}I.free(k);I.free(l)}return e?n:g}return!1};
function Cm(a){var b=null;a instanceof W&&(b=a.spot1,b===$c&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot1));null===b&&(b=vc);return b}function Dm(a){var b=null;a instanceof W&&(b=a.spot2,b===$c&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot2));null===b&&(b=Gc);return b}t.add=function(a){this.ub(this.W.count,a)};t.L=function(a){return this.W.L(a)};
t.ub=function(a,b){b instanceof T&&B("Cannot add a Part to a Panel: "+b+"; use a Panel instead");if(this===b||this.zg(b))this===b&&B("Cannot make a Panel contain itself: "+this.toString()),B("Cannot make a Panel indirectly contain itself: "+this.toString()+" already contains "+b.toString());var c=b.panel;null!==c&&c!==this&&B("Cannot add a GraphObject that already belongs to another Panel to this Panel: "+b.toString()+", already contained by "+c.toString()+", cannot be shared by this Panel: "+this.toString());
this.pa!==X.Grid||b instanceof W||B("Can only add Shapes to a Grid Panel, not: "+b);this.pa!==X.Graduated||b instanceof W||b instanceof Ug||B("Can only add Shapes or TextBlocks to a Graduated Panel, not: "+b);b.fj(this);b.Mj=null;if(null!==this.itemArray){var d=b.data;null!==d&&"object"===typeof d&&(null===this.Md&&(this.Md=new H),this.Md.add(d,b))}var e=this.W;d=-1;if(c===this){for(var f=-1,g=this.W.j,h=g.length,k=0;k<h;k++)if(g[k]===b){f=k;break}if(-1!==f){if(f===a||f+1>=e.count&&a>=e.count)return;
e.ab(f);d=f}else B("element "+b.toString()+" has panel "+c.toString()+" but is not contained by it.")}if(0>a||a>e.count)a=e.count;e.ub(a,b);if(0===a||b.isPanelMain)this.Li=null;tj(this)||this.o();b.o(!1);null!==b.portId?this.Hh=!0:b instanceof X&&!0===b.Hh&&(this.Hh=!0);this.Xg=null;c=this.part;null!==c&&(c.Ij=null,c.dh=NaN,this.Hh&&c instanceof V&&(c.Hh=!0),c.Hh&&c instanceof V&&(c.rc=null),e=this.diagram,null!==e&&e.undoManager.isUndoingRedoing||(-1!==d&&c.$a(xe,"elements",this,b,null,d,null),c.$a(we,
"elements",this,null,b,null,a),this.Ag()||hn(this,b,!1)))};function jn(a,b){a.F=b?a.F|16777216:a.F&-16777217}t.remove=function(a){for(var b=this.W.j,c=b.length,d=-1,e=0;e<c;e++)if(b[e]===a){d=e;break}-1!==d&&this.Hc(d,!0)};t.ab=function(a){0<=a&&this.Hc(a,!0)};
t.Hc=function(a,b){var c=this.W,d=c.L(a);d.Mj=null;d.fj(null);if(null!==this.Md){var e=d.data;"object"===typeof e&&this.Md.remove(e)}c.ab(a);oj(this,!1);this.o();this.Li===d&&(this.Li=null);this.Xg=null;var f=this.part;null!==f&&(f.Ij=null,f.dh=NaN,f.Mb(),f instanceof V&&(d instanceof X?d.Nm(d,function(a,c){Tl(f,c,b)}):Tl(f,d,b)),c=this.diagram,null!==c&&c.undoManager.isUndoingRedoing||f.$a(xe,"elements",this,d,null,a,null))};
X.prototype.getRowDefinition=function(a){0>a&&va(a,">= 0",X,"getRowDefinition:idx");a=Math.round(a);var b=this.sb;if(void 0===b)return null;if(void 0===b[a]){var c=new Uj;c.fj(this);c.isRow=!0;c.index=a;b[a]=c}return b[a]};X.prototype.hw=function(a){0>a&&va(a,">= 0",X,"removeRowDefinition:idx");a=Math.round(a);var b=this.sb;void 0!==b&&(this.$a(xe,"coldefs",this,b[a],null,a,null),b[a]&&delete b[a],this.o())};
X.prototype.getColumnDefinition=function(a){0>a&&va(a,">= 0",X,"getColumnDefinition:idx");a=Math.round(a);var b=this.ob;if(void 0===b)return null;if(void 0===b[a]){var c=new Uj;c.fj(this);c.isRow=!1;c.index=a;b[a]=c}return b[a]};t=X.prototype;t.fw=function(a){0>a&&va(a,">= 0",X,"removeColumnDefinition:idx");a=Math.round(a);var b=this.ob;void 0!==b&&(this.$a(xe,"coldefs",this,b[a],null,a,null),b[a]&&delete b[a],this.o())};
t.Bz=function(a){if(0>a||this.type!==X.Table)return-1;for(var b=0,c=this.sb,d=c.length,e=this.Oi;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))break}return e};t.sz=function(a){if(0>a||this.type!==X.Table)return-1;for(var b=0,c=this.ob,d=c.length,e=this.xi;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))break}return e};
t.Rz=function(a,b){void 0===b&&(b=new I(NaN,NaN));if(this.type!==X.Graduated)return b.h(NaN,NaN),b;a=Math.min(Math.max(a,this.graduatedMin),this.graduatedMax);var c=this.tb();c.geometry.Iv((a-this.graduatedMin)/this.graduatedRange,b);return c.transform.ra(b)};t.Sz=function(a){if(this.type!==X.Graduated)return NaN;var b=this.tb();b.transform.Xd(a);return b.geometry.$x(a)*this.graduatedRange+this.graduatedMin};function Jl(a){a=a.ei;return null!==a&&a.s}
function wg(a){var b=a.ei;if(null===b)null!==a.data&&B("Template cannot have .data be non-null: "+a),a.ei=b=new E;else if(b.s)return;var c=new E;jn(a,!1);a.Nm(a,function(a,d){var e=d.cb;if(null!==e)for(Gl(d,!1),e=e.iterator;e.next();){var f=e.value;f.mode===kn&&Gl(d,!0);var g=f.sourceName;null!==g&&("/"===g&&jn(a,!0),g=hl(f,a,d),null!==g&&(c.add(g),null===g.Rl&&(g.Rl=new E),g.Rl.add(f)));b.add(f)}if(d instanceof X&&d.type===X.Table){if(0<d.sb.length)for(a=d.sb,e=a.length,f=0;f<e;f++)if(g=a[f],void 0!==
g&&null!==g.cb)for(var h=g.cb.iterator;h.next();){var k=h.value;k.cd=g;k.Vp=2;k.Xl=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.cb)for(g=f.cb.iterator;g.next();)h=g.value,h.cd=f,h.Vp=1,h.Xl=f.index,b.add(h)}});for(var d=c.iterator;d.next();){var e=d.value;if(null!==e.Rl){Gl(e,!0);for(var f=e.Rl.iterator;f.next();){var g=f.value;null===e.cb&&(e.cb=new E);e.cb.add(g)}}e.Rl=null}for(d=b.iterator;d.next();)if(e=d.value,f=e.cd,null!==f){e.cd=null;var h=
e.targetProperty,k=h.indexOf(".");0<k&&f instanceof X&&(g=h.substring(0,k),h=h.substr(k+1),k=f.Za(g),null!==k?(f=k,e.targetProperty=h):wa('Warning: unable to find GraphObject named "'+g+'" for Binding: '+e.toString()));f instanceof Uj?(g=lb(f.panel),e.jj=void 0===g?-1:g,f.panel.Lk=e.jj):f instanceof Y?(g=lb(f),e.jj=void 0===g?-1:g,f.Lk=e.jj):B("Unknown type of binding target: "+f)}b.freeze();a instanceof T&&a.Wb()&&a.Ab()}
t.gz=function(){var a=this.copy();bn(a,function(a){a instanceof X&&(a.ei=null,a.kb=null);var b=a.cb;null!==b&&(a.cb=null,b.each(function(b){a.bind(b.copy())}));b=a.Gg;null!==b&&(a.Gg=null,b.each(function(b){Kl(a,b.value.copy())}))});return a};
t.Ba=function(a){var b=this.ei;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.Za(e);else{var f=this.diagram;null!==f&&c.isToModel&&(d=f.model.modelData)}if(null!==d){f=this;var g=c.jj;if(-1!==g){if(f=this.tt(g),null===f)continue}else null!==c.cd&&(f=c.cd);"/"===e?d=f.part:"."===
e?d=f:".."===e&&(d=f.panel);e=c.Vp;if(0!==e){if(!(f instanceof X))continue;1===e?f=f.getColumnDefinition(c.Xl):2===e&&(f=f.getRowDefinition(c.Xl))}void 0!==f&&c.Ew(f,d)}}}};function ln(a,b){a=a.W.j;for(var c=a.length,d=b.length,e=0,f=null;e<c&&!(f=a[e],f instanceof X&&null!==f.data);)e++,f=a[e];if(c-e!==d)return!0;if(null===f)return 0<d;for(var g=0;e<c&&g<d;){f=a[e];if(!(f instanceof X)||f.data!==b[g])return!0;e++;g++}return!1}
function en(a){if(a.type===X.Spot||a.type===X.Auto)return Math.min(a.W.length,1);if(a.type===X.Link){a=a.W;for(var b=a.length,c=0;c<b;c++){var d=a.L(c);if(!(d instanceof W&&d.isPanelMain))break}return c}return a.type===X.Table&&0<a.W.length&&(a=a.W.L(0),a.isPanelMain&&a instanceof X&&(a.type===X.TableRow||a.type===X.TableColumn))?1:0}t.Rt=function(){for(var a=en(this);this.W.length>a;)this.Hc(this.W.length-1,!1);a=this.itemArray;if(null!==a)for(var b=a.length,c=0;c<b;c++)mn(this,a[c],c)};
t.Vx=function(a){return void 0===a||null===a||null===this.Md?null:this.Md.H(a)};
function mn(a,b,c){if(!(void 0===b||null===b||0>c)){var d=nn(a,b),e=a.itemTemplateMap,f=null;null!==e&&(f=e.H(d));null===f&&(on||(on=!0,wa('No item template Panel found for category "'+d+'" on '+a),wa("  Using default item template."),d=new X,e=new Ug,e.bind(new Mi("text","",Ja)),d.add(e),pn=d),f=pn);d=f;null!==d&&(wg(d),d=d.copy(),0!==(d.F&16777216)&&(e=a.Yi(),null!==e&&jn(e,!0)),"object"===typeof b&&(null===a.Md&&(a.Md=new H),a.Md.add(b,d)),e=c+en(a),a.ub(e,d),d.kb=b,qn(a,e,c),d.kb=null,d.data=
b)}}function qn(a,b,c){for(a=a.W;b<a.length;){var d=a.L(b);if(d instanceof X){var e=b,f=c;d.type===X.TableRow?d.row=e:d.type===X.TableColumn&&(d.column=e);d.itemIndex=f}b++;c++}}function nn(a,b){if(null===b)return"";a=a.rl;if("function"===typeof a)a=a(b);else if("string"===typeof a&&"object"===typeof b){if(""===a)return"";a=rn(b,a)}else return"";if(void 0===a)return"";if("string"===typeof a)return a;B("Panel.getCategoryForItemData found a non-string category for "+b+": "+a);return""}
function hn(a,b,c){var d=b.enabledChanged;null!==d&&d(b,c);if(b instanceof X){b=b.W.j;d=b.length;for(var e=0;e<d;e++){var f=b[e];c&&f instanceof X&&!f.isEnabled||hn(a,f,c)}}}function sn(a,b){b.name=a;Ol.add(a,b)}
ma.Object.defineProperties(X.prototype,{type:{get:function(){return this.pa},set:function(a){var b=this.pa;b!==a&&(this.pa=a,this.pa===X.Grid?this.isAtomic=!0:this.pa===X.Table&&Xm(this),this.o(),this.g("type",b,a))}},elements:{get:function(){return this.W.iterator}},naturalBounds:{get:function(){return this.pc}},padding:{get:function(){return this.fb},set:function(a){"number"===
typeof a?(0>a&&va(a,">= 0",X,"padding"),a=new oc(a)):(0>a.left&&va(a.left,">= 0",X,"padding:value.left"),0>a.right&&va(a.right,">= 0",X,"padding:value.right"),0>a.top&&va(a.top,">= 0",X,"padding:value.top"),0>a.bottom&&va(a.bottom,">= 0",X,"padding:value.bottom"));var b=this.fb;b.w(a)||(this.fb=a=a.G(),this.o(),this.g("padding",b,a))}},defaultAlignment:{get:function(){return this.yn},set:function(a){var b=this.yn;b.w(a)||(this.yn=a=a.G(),this.o(),this.g("defaultAlignment",
b,a))}},defaultStretch:{get:function(){return this.Nf},set:function(a){var b=this.Nf;b!==a&&(this.Nf=a,this.o(),this.g("defaultStretch",b,a))}},defaultSeparatorPadding:{get:function(){return void 0===this.qj?sc:this.qj},set:function(a){if(void 0!==this.qj){"number"===typeof a&&(a=new oc(a));var b=this.qj;b.w(a)||(this.qj=a=a.G(),this.o(),this.g("defaultSeparatorPadding",b,a))}}},defaultRowSeparatorStroke:{get:function(){return void 0===
this.ki?null:this.ki},set:function(a){var b=this.ki;b!==a&&(null===a||"string"===typeof a||a instanceof ul)&&(a instanceof ul&&a.freeze(),this.ki=a,this.M(),this.g("defaultRowSeparatorStroke",b,a))}},defaultRowSeparatorStrokeWidth:{get:function(){return void 0===this.Og?1:this.Og},set:function(a){if(void 0!==this.Og){var b=this.Og;b!==a&&isFinite(a)&&0<=a&&(this.Og=a,this.o(),this.g("defaultRowSeparatorStrokeWidth",b,a))}}},defaultRowSeparatorDashArray:{
get:function(){return void 0===this.ji?null:this.ji},set:function(a){if(void 0!==this.ji){var b=this.ji;if(b!==a){if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];"number"===typeof f&&0<=f&&isFinite(f)||B("defaultRowSeparatorDashArray value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.ji=a;this.M();this.g("defaultRowSeparatorDashArray",b,a)}}}},defaultColumnSeparatorStroke:{get:function(){return void 0===
this.Mg?null:this.Mg},set:function(a){if(void 0!==this.Mg){var b=this.Mg;b!==a&&(null===a||"string"===typeof a||a instanceof ul)&&(a instanceof ul&&a.freeze(),this.Mg=a,this.M(),this.g("defaultColumnSeparatorStroke",b,a))}}},defaultColumnSeparatorStrokeWidth:{get:function(){return void 0===this.Ng?1:this.Ng},set:function(a){if(void 0!==this.Ng){var b=this.Ng;b!==a&&isFinite(a)&&0<=a&&(this.Ng=a,this.o(),this.g("defaultColumnSeparatorStrokeWidth",b,a))}}},defaultColumnSeparatorDashArray:{
get:function(){return void 0===this.ii?null:this.ii},set:function(a){if(void 0!==this.ii){var b=this.ii;if(b!==a){if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];"number"===typeof f&&0<=f&&isFinite(f)||B("defaultColumnSeparatorDashArray value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.ii=a;this.M();this.g("defaultColumnSeparatorDashArray",b,a)}}}},viewboxStretch:{get:function(){return this.cq},
set:function(a){var b=this.cq;b!==a&&(this.cq=a,this.o(),this.g("viewboxStretch",b,a))}},gridCellSize:{get:function(){return this.Xn},set:function(a){var b=this.Xn;if(!b.w(a)){a.v()&&0!==a.width&&0!==a.height||B("Invalid Panel.gridCellSize: "+a);this.Xn=a.G();var c=this.diagram;null!==c&&this===c.grid&&pj(c);this.M();this.g("gridCellSize",b,a)}}},gridOrigin:{get:function(){return this.Yn},set:function(a){var b=this.Yn;if(!b.w(a)){a.v()||
B("Invalid Panel.gridOrigin: "+a);this.Yn=a.G();var c=this.diagram;null!==c&&this===c.grid&&pj(c);this.M();this.g("gridOrigin",b,a)}}},graduatedMin:{get:function(){return this.Un},set:function(a){var b=this.Un;b!==a&&(this.Un=a,this.o(),this.g("graduatedMin",b,a),fl(this)&&(a=this.part,null!==a&&gl(this,a,"graduatedRange")))}},graduatedMax:{get:function(){return this.Tn},set:function(a){var b=this.Tn;b!==a&&(this.Tn=a,this.o(),this.g("graduatedMax",
b,a),fl(this)&&(a=this.part,null!==a&&gl(this,a,"graduatedRange")))}},graduatedRange:{get:function(){return this.graduatedMax-this.graduatedMin}},graduatedTickUnit:{get:function(){return this.Wn},set:function(a){var b=this.Wn;b!==a&&0<a&&(this.Wn=a,this.o(),this.g("graduatedTickUnit",b,a))}},graduatedTickBase:{get:function(){return this.Vn},set:function(a){var b=this.Vn;b!==a&&(this.Vn=a,this.o(),this.g("graduatedTickBase",
b,a))}},Hh:{get:function(){return 0!==(this.F&8388608)},set:function(a){0!==(this.F&8388608)!==a&&(this.F^=8388608)}},rowCount:{get:function(){return void 0===this.sb?0:this.sb.length}},columnCount:{get:function(){return void 0===this.ob?0:this.ob.length}},rowSizing:{get:function(){return void 0===this.Pj?Ym:this.Pj},set:function(a){if(void 0!==this.Pj){var b=this.Pj;b!==a&&(this.Pj=
a,this.o(),this.g("rowSizing",b,a))}}},columnSizing:{get:function(){return void 0===this.nj?Ym:this.nj},set:function(a){if(void 0!==this.nj){var b=this.nj;b!==a&&(this.nj=a,this.o(),this.g("columnSizing",b,a))}}},topIndex:{get:function(){return void 0===this.Oi?0:this.Oi},set:function(a){if(void 0!==this.Oi){var b=this.Oi;b!==a&&((!isFinite(a)||0>a)&&B("Panel.topIndex must be greater than zero and a real number, not: "+a),this.Oi=a,this.o(),
this.g("topIndex",b,a))}}},leftIndex:{get:function(){return void 0===this.xi?0:this.xi},set:function(a){if(void 0!==this.xi){var b=this.xi;b!==a&&((!isFinite(a)||0>a)&&B("Panel.leftIndex must be greater than zero and a real number, not: "+a),this.xi=a,this.o(),this.g("leftIndex",b,a))}}},data:{get:function(){return this.kb},set:function(a){var b=this.kb;if(b!==a){var c=this instanceof T&&!(this instanceof Ke);wg(this);this.kb=a;var d=this.diagram;
null!==d&&(c?(c=d.partManager,this instanceof S?(null!==b&&c.Ne.remove(b),null!==a&&c.Ne.add(a,this)):this instanceof T&&(null!==b&&c.Oe.remove(b),null!==a&&c.Oe.add(a,this))):(c=this.panel,null!==c&&null!==c.Md&&(null!==b&&c.Md.remove(b),null!==a&&c.Md.add(a,this))));this.g("data",b,a);null!==d&&d.undoManager.isUndoingRedoing||null!==a&&this.Ba()}}},itemIndex:{get:function(){return this.no},set:function(a){var b=this.no;b!==a&&(this.no=a,this.g("itemIndex",b,a))}},itemArray:{
get:function(){return this.ui},set:function(a){var b=this.ui;if(b!==a||null!==a&&ln(this,a)){var c=this.diagram;b!==a&&(null!==c&&null!==b&&Lj(c.partManager,this,c),this.ui=a,null!==c&&null!==a&&Ij(c.partManager,this));this.g("itemArray",b,a);null!==c&&c.undoManager.isUndoingRedoing||this.Rt()}}},itemTemplate:{get:function(){return null===this.oe?null:this.oe.H("")},set:function(a){if(null===this.oe){if(null===a)return;this.oe=new H}var b=this.oe.H("");
b!==a&&((a instanceof T||a.isPanelMain)&&B("Panel.itemTemplate must not be a Part or be Panel.isPanelMain: "+a),this.oe.add("",a),this.g("itemTemplate",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.Rt())}},itemTemplateMap:{get:function(){return this.oe},set:function(a){var b=this.oe;if(b!==a){for(var c=a.iterator;c.next(););this.oe=a;this.g("itemTemplateMap",b,a);a=this.diagram;null!==a&&a.undoManager.isUndoingRedoing||this.Rt()}}},itemCategoryProperty:{
get:function(){return this.rl},set:function(a){var b=this.rl;b!==a&&(this.rl=a,this.g("itemCategoryProperty",b,a))}},isAtomic:{get:function(){return 0!==(this.F&1048576)},set:function(a){var b=0!==(this.F&1048576);b!==a&&(this.F^=1048576,this.g("isAtomic",b,a))}},isClipping:{get:function(){return 0!==(this.F&2097152)},set:function(a){var b=0!==(this.F&2097152);b!==a&&(a&&this.type!==X.Spot&&wa("Warning: Panel.isClipping set on non-Spot Panel: "+
this.toString()),this.F^=2097152,this.o(),this.g("isClipping",b,a))}},isOpposite:{get:function(){return 0!==(this.F&33554432)},set:function(a){var b=0!==(this.F&33554432);b!==a&&(this.F^=33554432,this.o(),this.g("isOpposite",b,a))}},isEnabled:{get:function(){return 0!==(this.F&4194304)},set:function(a){var b=0!==(this.F&4194304);if(b!==a){var c=null===this.panel||this.panel.Ag();this.F^=4194304;this.g("isEnabled",b,a);b=this.diagram;null!==
b&&b.undoManager.isUndoingRedoing||c&&hn(this,this,a)}}},alignmentFocusName:{get:function(){return this.Fg},set:function(a){var b=this.Fg;b!==a&&(this.Fg=a,this.o(),this.g("alignmentFocusName",b,a))}}});
ma.Object.defineProperties(X,{Position:{get:function(){return Ol.H("Position")}},Horizontal:{get:function(){return Ol.H("Horizontal")}},Vertical:{get:function(){return Ol.H("Vertical")}},Spot:{get:function(){return Ol.H("Spot")}},Auto:{get:function(){return Ol.H("Auto")}},Table:{get:function(){return Ol.H("Table")}},Viewbox:{
get:function(){return Ol.H("Viewbox")}},TableRow:{get:function(){return Ol.H("TableRow")}},TableColumn:{get:function(){return Ol.H("TableColumn")}},Link:{get:function(){return Ol.H("Link")}},Grid:{get:function(){return Ol.H("Grid")}},Graduated:{get:function(){return Ol.H("Graduated")}}});X.prototype.findItemPanelForData=X.prototype.Vx;
X.prototype.rebuildItemElements=X.prototype.Rt;X.prototype.updateTargetBindings=X.prototype.Ba;X.prototype.copyTemplate=X.prototype.gz;X.prototype.graduatedValueForPoint=X.prototype.Sz;X.prototype.graduatedPointForValue=X.prototype.Rz;X.prototype.findColumnForLocalX=X.prototype.sz;X.prototype.findRowForLocalY=X.prototype.Bz;X.prototype.removeColumnDefinition=X.prototype.fw;X.prototype.removeRowDefinition=X.prototype.hw;X.prototype.removeAt=X.prototype.ab;X.prototype.remove=X.prototype.remove;
X.prototype.insertAt=X.prototype.ub;X.prototype.elt=X.prototype.L;X.prototype.add=X.prototype.add;X.prototype.findObject=X.prototype.Za;X.prototype.findInVisualTree=X.prototype.jm;X.prototype.walkVisualTreeFrom=X.prototype.Nm;X.prototype.findMainElement=X.prototype.tb;var on=!1,pn=null,Ol=new H;X.className="Panel";X.definePanelLayout=sn;sn("Position",new wm);sn("Vertical",new zm);sn("Auto",new Bm);sn("Link",new Mm);
function Uj(){Ya(this);this.kg=null;this.bs=!0;this.Oa=0;this.Qc=NaN;this.fh=0;this.eh=Infinity;this.xb=$c;this.ma=this.ha=0;this.cb=null;this.Mp=Cn;this.ye=Wk;this.Gp=this.ng=null;this.Hp=NaN;this.jb=this.Qj=null;this.un=!1}
Uj.prototype.copy=function(){var a=new Uj;a.bs=this.bs;a.Oa=this.Oa;a.Qc=this.Qc;a.fh=this.fh;a.eh=this.eh;a.xb=this.xb;a.ha=this.ha;a.ma=this.ma;a.ye=this.ye;a.Mp=this.Mp;null===this.ng?a.ng=null:a.ng=this.ng.G();a.Gp=this.Gp;a.Hp=this.Hp;a.Qj=null;null!==this.Qj&&(a.separatorDashArray=Ba(this.separatorDashArray));a.jb=this.jb;a.un=this.un;a.cb=this.cb;return a};t=Uj.prototype;
t.pt=function(a){a.isRow?this.height=a.height:this.width=a.width;this.minimum=a.minimum;this.maximum=a.maximum;this.alignment=a.alignment;this.stretch=a.stretch;this.sizing=a.sizing;this.ng=null===a.separatorPadding?null:a.separatorPadding.G();this.separatorStroke=a.separatorStroke;this.separatorStrokeWidth=a.separatorStrokeWidth;this.Qj=null;a.separatorDashArray&&(this.Qj=Ba(a.separatorDashArray));this.background=a.background;this.coversSeparators=a.coversSeparators;this.cb=a.cb};
t.gb=function(a){a.classType===Uj&&(this.sizing=a)};t.toString=function(){return"RowColumnDefinition "+(this.isRow?"(Row ":"(Column ")+this.index+") #"+lb(this)};t.fj=function(a){this.kg=a};
t.uv=function(){var a=0,b=0,c=this.kg,d=this.isRow;if(null!==c&&c.type===X.Table)for(var e=d?c.sb.length:c.ob.length,f=0;f<e;f++){var g=d?c.sb[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.ng;if(null===b)if(null!==c)b=
c.defaultSeparatorPadding;else return a;return a+(this.isRow?b.top:b.left)};
t.uc=function(){var a=0,b=this.kg,c=0,d=this.isRow;if(null!==b&&b.type===X.Table)for(var e=d?b.sb.length:b.ob.length,f=0;f<e;f++){var g=d?b.sb[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.ng;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.kg;if(null!==d&&(d.$a(ue,a,this,b,c,void 0,void 0),null!==this.cb&&(b=d.diagram,null!==b&&!b.skipsModelSourceBindings&&(d=d.Yi(),null!==d&&(b=d.data,null!==b)))))for(c=this.cb.iterator;c.next();)c.value.Zq(this,b,a,d)};function Fm(a){if(a.sizing===Cn){var b=a.kg;return a.isRow?b.rowSizing:b.columnSizing}return a.sizing}
t.bind=function(a){a.cd=this;var b=this.panel;if(null!==b){var c=b.Yi();null!==c&&Jl(c)&&B("Cannot add a Binding to a RowColumnDefinition that is already frozen: "+a+" on "+b)}null===this.cb&&(this.cb=new E);this.cb.add(a)};
ma.Object.defineProperties(Uj.prototype,{panel:{get:function(){return this.kg}},isRow:{get:function(){return this.bs},set:function(a){this.bs=a}},index:{get:function(){return this.Oa},set:function(a){this.Oa=a}},height:{get:function(){return this.Qc},set:function(a){var b=this.Qc;b!==a&&(0>a&&va(a,">= 0",Uj,"height"),this.Qc=a,this.actual=this.ha,null!==this.panel&&this.panel.o(),
this.zb("height",b,a))}},width:{get:function(){return this.Qc},set:function(a){var b=this.Qc;b!==a&&(0>a&&va(a,">= 0",Uj,"width"),this.Qc=a,this.actual=this.ha,null!==this.panel&&this.panel.o(),this.zb("width",b,a))}},minimum:{get:function(){return this.fh},set:function(a){var b=this.fh;b!==a&&((0>a||!isFinite(a))&&va(a,">= 0",Uj,"minimum"),this.fh=a,this.actual=this.ha,null!==this.panel&&this.panel.o(),this.zb("minimum",b,a))}},maximum:{
get:function(){return this.eh},set:function(a){var b=this.eh;b!==a&&(0>a&&va(a,">= 0",Uj,"maximum"),this.eh=a,this.actual=this.ha,null!==this.panel&&this.panel.o(),this.zb("maximum",b,a))}},alignment:{get:function(){return this.xb},set:function(a){var b=this.xb;b.w(a)||(this.xb=a.G(),null!==this.panel&&this.panel.o(),this.zb("alignment",b,a))}},stretch:{get:function(){return this.ye},set:function(a){var b=this.ye;b!==a&&(this.ye=
a,null!==this.panel&&this.panel.o(),this.zb("stretch",b,a))}},separatorPadding:{get:function(){return this.ng},set:function(a){"number"===typeof a&&(a=new oc(a));var b=this.ng;null!==a&&null!==b&&b.w(a)||(null!==a&&(a=a.G()),this.ng=a,null!==this.panel&&this.panel.o(),this.zb("separatorPadding",b,a))}},separatorStroke:{get:function(){return this.Gp},set:function(a){var b=this.Gp;b!==a&&(null!==a&&Sl(a,"RowColumnDefinition.separatorStroke"),
a instanceof ul&&a.freeze(),this.Gp=a,null!==this.panel&&this.panel.o(),this.zb("separatorStroke",b,a))}},separatorStrokeWidth:{get:function(){return this.Hp},set:function(a){var b=this.Hp;b!==a&&(this.Hp=a,null!==this.panel&&this.panel.o(),this.zb("separatorStrokeWidth",b,a))}},separatorDashArray:{get:function(){return this.Qj},set:function(a){var b=this.Qj;if(b!==a){if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];"number"===
typeof f&&0<=f&&isFinite(f)||B("separatorDashArray value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.Qj=a;null!==this.panel&&this.panel.M();this.zb("separatorDashArray",b,a)}}},background:{get:function(){return this.jb},set:function(a){var b=this.jb;b!==a&&(null!==a&&Sl(a,"RowColumnDefinition.background"),a instanceof ul&&a.freeze(),this.jb=a,null!==this.panel&&this.panel.M(),this.zb("background",b,a))}},coversSeparators:{
get:function(){return this.un},set:function(a){var b=this.un;b!==a&&(this.un=a,null!==this.panel&&this.panel.M(),this.zb("coversSeparators",b,a))}},sizing:{get:function(){return this.Mp},set:function(a){var b=this.Mp;b!==a&&(this.Mp=a,null!==this.panel&&this.panel.o(),this.zb("sizing",b,a))}},actual:{get:function(){return this.ha},set:function(a){this.ha=isNaN(this.Qc)?Math.max(Math.min(this.eh,a),this.fh):Math.max(Math.min(this.eh,
this.Qc),this.fh)}},total:{get:function(){return this.ha+this.uc()},set:function(a){this.ha=isNaN(this.Qc)?Math.max(Math.min(this.eh,a),this.fh):Math.max(Math.min(this.eh,this.Qc),this.fh);this.ha=Math.max(0,this.ha-this.uc())}},position:{get:function(){return this.ma},set:function(a){this.ma=a}}});Uj.prototype.bind=Uj.prototype.bind;Uj.prototype.computeEffectiveSpacing=Uj.prototype.uc;Uj.prototype.computeEffectiveSpacingTop=Uj.prototype.uv;
var Cn=new D(Uj,"Default",0),Gm=new D(Uj,"None",1),Ym=new D(Uj,"ProportionalExtra",2);Uj.className="RowColumnDefinition";Uj.Default=Cn;Uj.None=Gm;Uj.ProportionalExtra=Ym;function W(){Y.call(this);this.vd=this.ka=null;this.Kn="None";this.Sn=Wk;this.Ec=this.al="black";this.qh=1;this.Tl="butt";this.Ul="miter";this.Rj=10;this.oh=null;this.ph=0;this.jf=this.hf=$c;this.fp=this.ep=NaN;this.eo=!1;this.hp=null;this.bl=this.$l="None";this.Ld=1;this.Jd=0;this.Gd=1;this.Hd=null}la(W,Y);
W.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.ka=this.ka;a.Kn=this.Kn;a.Sn=this.Sn;a.vd=this.vd;a.al=this.al;a.Ec=this.Ec;a.qh=this.qh;a.Tl=this.Tl;a.Ul=this.Ul;a.Rj=this.Rj;null!==this.oh&&(a.oh=Ba(this.oh));a.ph=this.ph;a.hf=this.hf.G();a.jf=this.jf.G();a.ep=this.ep;a.fp=this.fp;a.eo=this.eo;a.hp=this.hp;a.$l=this.$l;a.bl=this.bl;a.Ld=this.Ld;a.Jd=this.Jd;a.Gd=this.Gd;a.Hd=this.Hd};t=W.prototype;
t.gb=function(a){a===xg||a===zg||a===Zk||a===Wk?this.geometryStretch=a:Y.prototype.gb.call(this,a)};t.toString=function(){return"Shape("+("None"!==this.figure?this.figure:"None"!==this.toArrow?this.toArrow:this.fromArrow)+")#"+lb(this)};
function Dn(a,b,c,d){var e=c.length;if(!(4>e)){var f=d.measuredBounds,g=Math.max(1,f.width);f=f.height;for(var h=c[0],k=c[1],l,m,n,p,r,q,u=0,v=Fa(),w=2;w<e;w+=2)l=c[w],m=c[w+1],n=l-h,h=m-k,0===n&&(n=.001),p=h/n,r=Math.atan2(h,n),q=Math.sqrt(n*n+h*h),v.push([n,r,p,q]),u+=q,h=l,k=m;h=c[0];k=c[1];n=d.measuredBounds.width;d instanceof W&&(n-=d.strokeWidth);1>n&&(n=1);e=c=n;l=g/2;m=0===l?!1:!0;w=0;q=v[w];n=q[0];r=q[1];p=q[2];q=q[3];for(var y=0;.1<=u;){0===y&&(m?(e=c,e-=l,u-=l,m=!1):e=c,0===e&&(e=1));if(e>
u){Ha(v);return}e>q?(y=e-q,e=q):y=0;var z=Math.sqrt(e*e/(1+p*p));0>n&&(z=-z);h+=z;k+=p*z;a.translate(h,k);a.rotate(r);a.translate(-(g/2),-(f/2));0===y&&d.Ui(a,b);a.translate(g/2,f/2);a.rotate(-r);a.translate(-h,-k);u-=e;q-=e;if(0!==y){w++;if(w===v.length){Ha(v);return}q=v[w];n=q[0];r=q[1];p=q[2];q=q[3];e=y}}Ha(v)}}
t.Ui=function(a,b){var c=this.Ec,d=this.al;if(null!==c||null!==d){var e=this.actualBounds,f=this.naturalBounds;null!==d&&li(this,a,d,!0,!1,f,e);var g=this.part,h=this.qh;null!==c&&0===h&&null!==g&&(h=g.type===X.Link&&g instanceof Ke&&"Selection"===g.category&&g.adornedObject instanceof W&&g.adornedPart.tb()===g.adornedObject?g.adornedObject.strokeWidth:0);null!==c&&0!==h&&(li(this,a,c,!1,!1,f,e),a.lineWidth=h,a.lineJoin=this.Ul,a.lineCap=this.Tl,a.miterLimit=this.Rj);e=!1;g&&b.Ee("drawShadows")&&
(e=g.isShadowed);g=!0;null===c||null!==d&&"transparent"!==d||(g=!1);f=!1;var k=this.strokeDashArray;null!==k&&(f=!0,a.st(k,this.ph));var l=this.ka;if(null!==l){if(l.type===vd)a.beginPath(),a.moveTo(l.startX,l.startY),a.lineTo(l.endX,l.endY),null!==d&&a.Wd(d),0!==h&&null!==c&&a.ij();else if(l.type===zd){var m=l.startX;k=l.startY;var n=l.endX,p=l.endY;l=Math.min(m,n);var r=Math.min(k,p);m=Math.abs(n-m);k=Math.abs(p-k);a.beginPath();a.rect(l,r,m,k);null!==d&&a.Wd(d);if(null!==c){g&&e&&tl(a);if(0!==h){if(0===
m||0===k)a.beginPath(),a.rect(l,r,Math.max(m,.1),Math.max(k,.1));a.ij()}g&&e&&sl(a)}}else if(l.type===Hd)m=l.startX,k=l.startY,n=l.endX,p=l.endY,l=Math.abs(n-m)/2,r=Math.abs(p-k)/2,m=Math.min(m,n)+l,k=Math.min(k,p)+r,a.beginPath(),a.moveTo(m,k-r),a.bezierCurveTo(m+K.Eg*l,k-r,m+l,k-K.Eg*r,m+l,k),a.bezierCurveTo(m+l,k+K.Eg*r,m+K.Eg*l,k+r,m,k+r),a.bezierCurveTo(m-K.Eg*l,k+r,m-l,k+K.Eg*r,m-l,k),a.bezierCurveTo(m-l,k-K.Eg*r,m-K.Eg*l,k-r,m,k-r),a.closePath(),null!==d&&a.Wd(d),0!==h&&null!==c&&(g&&e?(tl(a),
a.ij(),sl(a)):a.ij());else if(l.type===td)for(k=l.figures,l=k.length,r=0;r<l;r++){m=k.j[r];a.beginPath();a.moveTo(m.startX,m.startY);n=m.segments.j;p=n.length;for(var q=null,u=0;u<p;u++){var v=n[u];switch(v.type){case Wd:a.moveTo(v.endX,v.endY);break;case xd:a.lineTo(v.endX,v.endY);break;case Xd:a.bezierCurveTo(v.point1X,v.point1Y,v.point2X,v.point2Y,v.endX,v.endY);break;case Yd:a.quadraticCurveTo(v.point1X,v.point1Y,v.endX,v.endY);break;case Zd:if(v.radiusX===v.radiusY){var w=Math.PI/180;a.arc(v.point1X,
v.point1Y,v.radiusX,v.startAngle*w,(v.startAngle+v.sweepAngle)*w,0>v.sweepAngle,null!==q?q.endX:m.startX,null!==q?q.endY:m.startY)}else if(q=ae(v,m),w=q.length,0===w)a.lineTo(v.centerX,v.centerY);else for(var y=0;y<w;y++){var z=q[y];0===y&&a.lineTo(z[0],z[1]);a.bezierCurveTo(z[2],z[3],z[4],z[5],z[6],z[7])}break;case $d:y=w=0;if(null!==q&&q.type===Zd){q=ae(q,m);z=q.length;if(0===z){a.lineTo(v.centerX,v.centerY);break}q=q[z-1]||null;null!==q&&(w=q[6],y=q[7])}else w=null!==q?q.endX:m.startX,y=null!==
q?q.endY:m.startY;q=be(v,m,w,y);w=q.length;if(0===w){a.lineTo(v.centerX,v.centerY);break}for(y=0;y<w;y++)z=q[y],a.bezierCurveTo(z[2],z[3],z[4],z[5],z[6],z[7]);break;default:B("Segment not of valid type: "+v.type)}v.isClosed&&a.closePath();q=v}e?m.isShadowed?(!0===m.isFilled&&"transparent"!==d&&null!==d&&a.Wd(d),0!==h&&null!==c&&(g&&tl(a),a.ij(),g&&sl(a))):(g&&tl(a),!0===m.isFilled&&"transparent"!==d&&null!==d&&a.Wd(d),0!==h&&null!==c&&a.ij(),g&&sl(a)):(!0===m.isFilled&&null!==d&&a.Wd(d),0!==h&&null!==
c&&a.ij())}f&&a.qt();if(null!==this.pathPattern){c=this.pathPattern;c.measure(Infinity,Infinity);d=c.measuredBounds;c.arrange(0,0,d.width,d.height);h=this.geometry;a.save();a.beginPath();d=Fa();if(h.type===vd)d.push(h.startX),d.push(h.startY),d.push(h.endX),d.push(h.endY),Dn(a,b,d,c);else if(h.type===td)for(h=h.figures.iterator;h.next();){e=h.value;d.length=0;d.push(e.startX);d.push(e.startY);g=e.startX;f=e.startY;k=g;l=f;r=e.segments.j;m=r.length;for(n=0;n<m;n++){p=r[n];switch(p.type){case Wd:Dn(a,
b,d,c);d.length=0;d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;k=g;l=f;break;case xd:d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;break;case Xd:K.Be(g,f,p.point1X,p.point1Y,p.point2X,p.point2Y,p.endX,p.endY,.5,d);g=p.endX;f=p.endY;break;case Yd:K.Kq(g,f,p.point1X,p.point1Y,p.endX,p.endY,.5,d);g=p.endX;f=p.endY;break;case Zd:u=ae(p,e);v=u.length;if(0===v){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(q=0;q<v;q++)w=u[q],K.Be(g,f,w[2],w[3],w[4],w[5],w[6],w[7],.5,d),g=w[6],
f=w[7];break;case $d:u=be(p,e,g,f);v=u.length;if(0===v){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(q=0;q<v;q++)w=u[q],K.Be(g,f,w[2],w[3],w[4],w[5],w[6],w[7],.5,d),g=w[6],f=w[7];break;default:B("Segment not of valid type: "+p.type)}p.isClosed&&(d.push(k),d.push(l),Dn(a,b,d,c))}Dn(a,b,d,c)}else if(h.type===zd)d.push(h.startX),d.push(h.startY),d.push(h.endX),d.push(h.startY),d.push(h.endX),d.push(h.endY),d.push(h.startX),d.push(h.endY),d.push(h.startX),d.push(h.startY),Dn(a,
b,d,c);else if(h.type===Hd){f=new ge;f.startX=h.endX;f.startY=(h.startY+h.endY)/2;g=new oe(Zd);g.startAngle=0;g.sweepAngle=360;g.centerX=(h.startX+h.endX)/2;g.centerY=(h.startY+h.endY)/2;g.radiusX=Math.abs(h.startX-h.endX)/2;g.radiusY=Math.abs(h.startY-h.endY)/2;f.add(g);h=ae(g,f);e=h.length;if(0===e)d.push(g.centerX),d.push(g.centerY);else for(g=f.startX,f=f.startY,k=0;k<e;k++)l=h[k],K.Be(g,f,l[2],l[3],l[4],l[5],l[6],l[7],.5,d),g=l[6],f=l[7];Dn(a,b,d,c)}Ha(d);a.restore();a.sc(!1)}}}};
t.ga=function(a,b){void 0===b&&(b=new I);if(a instanceof P){a.kc()&&B("getDocumentPoint Spot must be a real, specific Spot, not: "+a.toString());var c=this.naturalBounds,d=this.strokeWidth;b.h(a.x*(c.width+d)-d/2+c.x+a.offsetX,a.y*(c.height+d)-d/2+c.y+a.offsetY)}else b.set(a);this.wd.ra(b);return b};
t.nm=function(a){void 0===a&&(a=new N);var b=this.naturalBounds,c=this.wd;b=N.allocAt(b.x,b.y,b.width,b.height);var d=this.strokeWidth;b.Fc(d/2,d/2);d=I.allocAt(b.x,b.y).transform(c);a.h(d.x,d.y,0,0);d.h(b.right,b.y).transform(c);ec(a,d.x,d.y,0,0);d.h(b.right,b.bottom).transform(c);ec(a,d.x,d.y,0,0);d.h(b.x,b.bottom).transform(c);ec(a,d.x,d.y,0,0);N.free(b);I.free(d);return a};
t.Eh=function(a,b){var c=this.geometry;if(null===c||null===this.fill&&null===this.stroke)return!1;var d=c.bounds,e=this.strokeWidth/2;c.type!==vd||b||(e+=2);var f=N.alloc();f.assign(d);f.Fc(e+2,e+2);if(!f.aa(a))return N.free(f),!1;d=e+1E-4;if(c.type===vd){if(null===this.stroke)return!1;d=(c.endX-c.startX)*(a.x-c.startX)+(c.endY-c.startY)*(a.y-c.startY);if(0>(c.startX-c.endX)*(a.x-c.endX)+(c.startY-c.endY)*(a.y-c.endY)||0>d)return!1;N.free(f);return K.Ob(c.startX,c.startY,c.endX,c.endY,e,a.x,a.y)}if(c.type===
zd){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.Fc(-d,-d);if(f.aa(a))return N.free(f),!1;f.Fc(d,d)}null!==this.stroke&&f.Fc(e,e);a=f.aa(a);N.free(f);return a}if(c.type===Hd){g=c.startX;e=c.startY;h=c.endX;var k=c.endY;c=Math.min(g,h);b=Math.min(e,k);g=Math.abs(h-g)/2;e=Math.abs(k-e)/2;c=a.x-(c+g);b=a.y-(b+e);if(null===this.fill){g-=d;e-=d;if(0>=g||0>=e||1>=c*c/(g*g)+b*b/(e*e))return N.free(f),!1;
g+=d;e+=d}null!==this.stroke&&(g+=d,e+=d);N.free(f);return 0>=g||0>=e?!1:1>=c*c/(g*g)+b*b/(e*e)}if(c.type===td)return N.free(f),null===this.fill?ee(c,a.x,a.y,e):ce(c,a,e,1<this.strokeWidth,b);B("Unknown Geometry type: "+c.type);return!1};
t.tm=function(a,b,c,d){var e=this.desiredSize,f=this.qh;a=Math.max(a,0);b=Math.max(b,0);if(null!==this.vd)var g=this.geometry.bounds;else{var h=this.figure,k=En[h];if(void 0===k){var l=K.Je[h];"string"===typeof l&&(l=K.Je[l]);"function"===typeof l?(k=l(null,100,100),En[h]=k):B("Unsupported Figure: "+h)}g=k.bounds}h=g.width;k=g.height;l=g.width;var m=g.height;switch(ll(this,!0)){case xg:d=c=0;break;case ud:l=Math.max(a-f,0);m=Math.max(b-f,0);break;case Xk:l=Math.max(a-f,0);d=0;break;case Yk: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=yg(this);switch(c){case xg:break;case ud:h=l;k=m;break;case zg:c=Math.min(l/h,m/k);isFinite(c)||(c=1);h*=c;k*=c;break;default:B(c+" is not a valid geometryStretch.")}null!==this.vd?(h=Math.max(h,.01),k=Math.max(k,
.01),c=null!==this.vd?this.vd:this.ka,e=c.bounds,d=h/e.width,e=k/e.height,isFinite(d)||(d=1),isFinite(e)||(e=1),this.ka=1===d&&1===e?c:c.copy().scale(d,e)):null!==this.ka&&K.$(this.ka.ll,a-f)&&K.$(this.ka.kl,b-f)||(this.ka=W.makeGeometry(this,h,k));g=this.ka.bounds;Infinity===a||Infinity===b?il(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):il(this,-(f/2),-(f/2),l+f,m+f)};
function yg(a){var b=a.geometryStretch;return null!==a.vd?b===Wk?ud:b:b===Wk?En[a.figure].defaultStretch:b}t.Ch=function(a,b,c,d){nl(this,a,b,c,d)};t.Vc=function(a,b,c){return this.jk(a.x,a.y,b.x,b.y,c)};
t.jk=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.qh/2;l=this.ka;null===l&&(this.measure(Infinity,Infinity),l=this.ka);p=l.bounds;m=!1;if(l.type===vd)if(1.5>=this.strokeWidth)m=K.Ge(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=Fa();a=new I;K.Ge(l.startX+d,l.startY+m,l.endX+d,l.endY+m,f,g,h,k,a)&&b.push(a);a=new I;K.Ge(l.startX-d,l.startY-m,l.endX-d,l.endY-m,f,g,h,k,a)&&b.push(a);a=new I;K.Ge(l.startX+d,l.startY+m,l.startX-d,l.startY-m,f,g,h,k,a)&&b.push(a);a=new I;K.Ge(l.endX+d,l.endY+m,l.endX-d,l.endY-m,f,g,h,k,a)&&b.push(a);h=b.length;if(0===h)return Ha(b),!1;m=!0;k=Infinity;for(d=0;d<h;d++)a=b[d],c=(a.x-f)*(a.x-f)+(a.y-g)*(a.y-g),c<k&&(k=c,e.x=a.x,e.y=a.y);Ha(b)}else if(l.type===zd)m=K.Vc(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===Hd){b=N.allocAt(p.x,p.y,p.width,p.height).Fc(n,n);a:if(0===b.width)m=K.Ge(b.x,b.y,b.x,b.y+b.height,f,g,h,k,e);else if(0===b.height)m=K.Ge(b.x,b.y,b.x+b.width,b.y,f,g,h,k,e);else{a=b.width/2;l=b.height/2;d=b.x+a;m=b.y+l;c=9999;f!==h&&(c=(g-k)/(f-h));if(9999>Math.abs(c)){k=g-m-c*(f-d);if(0>a*a*c*c+l*l-k*k){e.x=NaN;e.y=NaN;m=!1;break a}n=Math.sqrt(a*a*c*c+l*l-k*k);h=(-(a*a*c*k)+a*l*n)/(l*l+a*a*c*c)+d;a=(-(a*a*c*k)-a*l*n)/(l*l+a*a*c*c)+d;l=c*(h-d)+k+m;k=c*
(a-d)+k+m;Math.abs((f-h)*(f-h))+Math.abs((g-l)*(g-l))<Math.abs((f-a)*(f-a))+Math.abs((g-k)*(g-k))?(e.x=h,e.y=l):(e.x=a,e.y=k)}else{h=l*l;k=f-d;h-=h/(a*a)*k*k;if(0>h){e.x=NaN;e.y=NaN;m=!1;break a}k=Math.sqrt(h);h=m+k;k=m-k;Math.abs(h-g)<Math.abs(k-g)?(e.x=f,e.y=h):(e.x=f,e.y=k)}m=!0}N.free(b)}else if(l.type===td){p=I.alloc();var r=h-f;var q=k-g;var u=r*r+q*q;e.x=h;e.y=k;for(var v=0;v<l.figures.count;v++){var w=l.figures.j[v],y=w.segments;r=w.startX;q=w.startY;for(var z=r,A=q,C=0;C<y.count;C++){var G=
y.j[C],L=G.type;var J=G.endX;var U=G.endY;var R=!1;switch(L){case Wd:z=J;A=U;break;case xd:R=Fn(r,q,J,U,f,g,h,k,p);break;case Xd:R=K.kq(r,q,G.point1X,G.point1Y,G.point2X,G.point2Y,J,U,f,g,h,k,.6,p);break;case Yd:R=K.kq(r,q,r+2/3*(G.point1X-r),q+2/3*(G.point1Y-q),J+2/3*(G.point1X-J),U+2/3*(G.point1Y-U),J,U,f,g,h,k,.6,p);break;case Zd:case $d:L=G.type===Zd?ae(G,w):be(G,w,r,q);var ca=L.length;if(0===ca){R=Fn(r,q,G.centerX,G.centerY,f,g,h,k,p);break}U=null;for(J=0;J<ca;J++){U=L[J];if(0===J&&Fn(r,q,U[0],
U[1],f,g,h,k,p)){var pa=Gn(f,g,p,u,e);pa<u&&(u=pa,m=!0)}K.kq(U[0],U[1],U[2],U[3],U[4],U[5],U[6],U[7],f,g,h,k,.6,p)&&(pa=Gn(f,g,p,u,e),pa<u&&(u=pa,m=!0))}J=U[6];U=U[7];break;default:B("Unknown Segment type: "+L)}r=J;q=U;R&&(R=Gn(f,g,p,u,e),R<u&&(u=R,m=!0));G.isClosed&&(J=z,U=A,Fn(r,q,J,U,f,g,h,k,p)&&(G=Gn(f,g,p,u,e),G<u&&(u=G,m=!0)))}}f=c-a;g=d-b;h=Math.sqrt(f*f+g*g);0!==h&&(f/=h,g/=h);e.x-=f*n;e.y-=g*n;I.free(p)}else B("Unknown Geometry type: "+l.type);if(!m)return!1;this.transform.ra(e);return!0};
function Gn(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 Fn(a,b,c,d,e,f,g,h,k){var l=!1,m=(e-g)*(b-d)-(f-h)*(a-c);if(0===m)return!1;k.x=((e*h-f*g)*(a-c)-(e-g)*(a*d-b*c))/m;k.y=((e*h-f*g)*(b-d)-(f-h)*(a*d-b*c))/m;(a>c?a-c:c-a)<(b>d?b-d:d-b)?(a=b<d?b:d,b=b<d?d:b,(k.y>a||K.$(k.y,a))&&(k.y<b||K.$(k.y,b))&&(l=!0)):(b=a<c?a:c,a=a<c?c:a,(k.x>b||K.$(k.x,b))&&(k.x<a||K.$(k.x,a))&&(l=!0));return l}
t.Dh=function(a,b){if(void 0===b)return a.Ce(this.actualBounds);var c=this.ka;null===c&&(this.measure(Infinity,Infinity),c=this.ka);c=c.bounds;var d=this.strokeWidth/2,e=!1,f=I.alloc();f.h(c.x-d,c.y-d);a.aa(b.ra(f))&&(f.h(c.x-d,c.bottom+d),a.aa(b.ra(f))&&(f.h(c.right+d,c.bottom+d),a.aa(b.ra(f))&&(f.h(c.right+d,c.y-d),a.aa(b.ra(f))&&(e=!0))));I.free(f);return e};
t.Ic=function(a,b){if(this.Dh(a,b)||void 0===b&&(b=this.transform,a.Ce(this.actualBounds)))return!0;var c=qd.alloc();c.set(b);c.Et();var d=a.left,e=a.right,f=a.top;a=a.bottom;var g=I.alloc();g.h(d,f);c.ra(g);if(this.Eh(g,!0))return I.free(g),!0;g.h(e,f);c.ra(g);if(this.Eh(g,!0))return I.free(g),!0;g.h(d,a);c.ra(g);if(this.Eh(g,!0))return I.free(g),!0;g.h(e,a);c.ra(g);if(this.Eh(g,!0))return I.free(g),!0;var h=I.alloc(),k=I.alloc();c.set(b);c.Vv(this.transform);c.Et();h.x=e;h.y=f;h.transform(c);g.x=
d;g.y=f;g.transform(c);b=!1;Hn(this,g,h,k)?b=!0:(g.x=e,g.y=a,g.transform(c),Hn(this,g,h,k)?b=!0:(h.x=d,h.y=a,h.transform(c),Hn(this,g,h,k)?b=!0:(g.x=d,g.y=f,g.transform(c),Hn(this,g,h,k)&&(b=!0))));I.free(g);qd.free(c);I.free(h);I.free(k);return b};function Hn(a,b,c,d){if(!a.Vc(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.Wx=function(a,b,c){function d(a,b){for(var c=a.length,d=0;d<c;d+=2)if(b.dd(a[d],a[d+1])>e)return!0;return!1}if(c&&null!==this.fill&&this.Eh(a,!0))return!0;var e=a.De(b),f=e;1.5<this.strokeWidth&&(e=this.strokeWidth/2+Math.sqrt(e),e*=e);b=this.ka;if(null===b&&(this.measure(Infinity,Infinity),b=this.ka,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(Cb(a.x,a.y,h,k)<=e&&Cb(a.x,a.y,l,k)<=e&&Cb(a.x,a.y,h,g)<=e&&Cb(a.x,a.y,l,g)<=e)return!0}h=b.startX;k=b.startY;l=
b.endX;g=b.endY;if(b.type===vd){if(c=(h-l)*(a.x-l)+(k-g)*(a.y-g),Bb(a.x,a.y,h,k,l,g)<=(0<=(l-h)*(a.x-h)+(g-k)*(a.y-k)&&0<=c?e:f))return!0}else{if(b.type===zd)return b=!1,c&&(b=Bb(a.x,a.y,h,k,h,g)<=e||Bb(a.x,a.y,h,k,l,k)<=e||Bb(a.x,a.y,l,k,l,g)<=e||Bb(a.x,a.y,h,g,l,g)<=e),b;if(b.type===Hd){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 Bb(a.x,a.y,h,k,l,g)<=e?!0:!1;if(c){if(a=K.mz(m,n,b,f),a*a<=e)return!0}else return Cb(b,f,-m,0)>=e||Cb(b,f,0,-n)>=e||Cb(b,
f,0,n)>=e||Cb(b,f,m,0)>=e?!1:!0}else if(b.type===td){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&&Bb(a.x,a.y,f,h,f,l)>e&&Bb(a.x,a.y,f,h,k,h)>e&&Bb(a.x,a.y,k,l,f,l)>e&&Bb(a.x,a.y,k,l,k,h)>e)return!1;f=Math.sqrt(e);if(c){if(null===this.fill?ee(b,a.x,a.y,f):ce(b,a,f,!0,!1))return!0}else{c=b.figures;for(b=0;b<c.count;b++){f=c.j[b];g=f.startX;m=f.startY;if(a.dd(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 Wd:case xd:g=n.endX;
m=n.endY;if(a.dd(g,m)>e)return!1;break;case Xd:var p=Fa();K.Be(g,m,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.8,p);g=d(p,a);Ha(p);if(g)return!1;g=n.endX;m=n.endY;if(a.dd(g,m)>e)return!1;break;case Yd:p=Fa();K.Kq(g,m,n.point1X,n.point1Y,n.endX,n.endY,.8,p);g=d(p,a);Ha(p);if(g)return!1;g=n.endX;m=n.endY;if(a.dd(g,m)>e)return!1;break;case Zd:case $d:p=n.type===Zd?ae(n,f):be(n,f,g,m);var r=p.length;if(0===r){g=n.centerX;m=n.centerY;if(a.dd(g,m)>e)return!1;break}n=null;for(var q=Fa(),u=0;u<
r;u++)if(n=p[u],q.length=0,K.Be(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],.8,q),d(q,a))return Ha(q),!1;Ha(q);null!==n&&(g=n[6],m=n[7]);break;default:B("Unknown Segment type: "+n.type)}}return!0}}}return!1};t.cc=function(){this.ka=null};function In(a){var b=a.diagram;null!==b&&b.undoManager.isUndoingRedoing||(a.segmentOrientation=Vm,"None"!==a.$l?(a.segmentIndex=-1,a.alignmentFocus=gd):"None"!==a.bl&&(a.segmentIndex=0,a.alignmentFocus=new P(1-gd.x,gd.y)))}
W.makeGeometry=function(a,b,c){if("None"!==a.toArrow)var d=Jn[a.toArrow];else"None"!==a.fromArrow?d=Jn[a.fromArrow]:(d=K.Je[a.figure],"string"===typeof d&&(d=K.Je[d]),void 0===d&&B("Unknown Shape.figure: "+a.figure),d=d(a,b,c),d.ll=b,d.kl=c);if(null===d){var e=K.Je.Rectangle;"function"===typeof e&&(d=e(a,b,c))}return d};
function Kn(a){var b=Jn[a];if(void 0===b){var c=a.toLowerCase();if("none"===c)return"None";b=Jn[c];if(void 0===b){var d=null,e;for(e in K.Qm)if(e.toLowerCase()===c){d=e;break}if(null!==d)return a=Id(K.Qm[d],!1),Jn[d]=a,c!==d&&(Jn[c]=d),d}}return"string"===typeof b?b:b instanceof sd?a:null}
ma.Object.defineProperties(W.prototype,{geometry:{get:function(){return null!==this.ka?this.ka:this.vd},set:function(a){var b=this.ka,c=this.vd;if(b!==a){null!==a?this.vd=this.ka=a.freeze():this.vd=this.ka=null;var d=this.part;null!==d&&(d.dh=NaN);this.o();this.g("geometry",b||c,a);fl(this)&&(a=this.part,null!==a&&gl(this,a,"geometryString"))}}},geometryString:{get:function(){return null===this.geometry?"":this.geometry.toString()},set:function(a){a=
Id(a);var b=a.normalize();this.geometry=a;this.position=a=I.allocAt(-b.x,-b.y);I.free(a)}},isGeometryPositioned:{get:function(){return this.eo},set:function(a){var b=this.eo;b!==a&&(this.eo=a,this.o(),this.g("isGeometryPositioned",b,a))}},fill:{get:function(){return this.al},set:function(a){var b=this.al;b!==a&&(null!==a&&Sl(a,"Shape.fill"),a instanceof ul&&a.freeze(),this.al=a,this.M(),this.g("fill",b,a))}},stroke:{
get:function(){return this.Ec},set:function(a){var b=this.Ec;b!==a&&(null!==a&&Sl(a,"Shape.stroke"),a instanceof ul&&a.freeze(),this.Ec=a,this.M(),this.g("stroke",b,a))}},strokeWidth:{get:function(){return this.qh},set:function(a){var b=this.qh;if(b!==a)if(0<=a){this.qh=a;this.o();var c=this.part;null!==c&&(c.dh=NaN);this.g("strokeWidth",b,a)}else va(a,"value >= 0",W,"strokeWidth:value")}},strokeCap:{get:function(){return this.Tl},set:function(a){var b=
this.Tl;b!==a&&("string"!==typeof a||"butt"!==a&&"round"!==a&&"square"!==a?va(a,'"butt", "round", or "square"',W,"strokeCap"):(this.Tl=a,this.M(),this.g("strokeCap",b,a)))}},strokeJoin:{get:function(){return this.Ul},set:function(a){var b=this.Ul;b!==a&&("string"!==typeof a||"miter"!==a&&"bevel"!==a&&"round"!==a?va(a,'"miter", "bevel", or "round"',W,"strokeJoin"):(this.Ul=a,this.M(),this.g("strokeJoin",b,a)))}},strokeMiterLimit:{get:function(){return this.Rj},
set:function(a){var b=this.Rj;if(b!==a&&1<=a){this.Rj=a;this.M();var c=this.part;null!==c&&(c.dh=NaN);this.g("strokeMiterLimit",b,a)}}},strokeDashArray:{get:function(){return this.oh},set:function(a){var b=this.oh;if(b!==a){if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];0<=f&&isFinite(f)||B("strokeDashArray:value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.oh=a;this.M();this.g("strokeDashArray",
b,a)}}},strokeDashOffset:{get:function(){return this.ph},set:function(a){var b=this.ph;b!==a&&0<=a&&(this.ph=a,this.M(),this.g("strokeDashOffset",b,a))}},figure:{get:function(){return this.Kn},set:function(a){var b=this.Kn;if(b!==a){var c=K.Je[a];"function"===typeof c?c=a:(c=K.Je[a.toLowerCase()])||B("Unknown Shape.figure: "+a);b!==c&&(a=this.part,null!==a&&(a.dh=NaN),this.Kn=c,this.vd=null,this.cc(),this.o(),this.g("figure",b,c))}}},toArrow:{
get:function(){return this.$l},set:function(a){var b=this.$l;!0===a?a="Standard":!1===a&&(a="");if(b!==a){var c=Kn(a);null===c?B("Unknown Shape.toArrow: "+a):b!==c&&(this.$l=c,this.vd=null,this.cc(),this.o(),In(this),this.g("toArrow",b,c))}}},fromArrow:{get:function(){return this.bl},set:function(a){var b=this.bl;!0===a?a="Standard":!1===a&&(a="");if(b!==a){var c=Kn(a);null===c?B("Unknown Shape.fromArrow: "+a):b!==c&&(this.bl=c,this.vd=null,this.cc(),this.o(),
In(this),this.g("fromArrow",b,c))}}},spot1:{get:function(){return this.hf},set:function(a){var b=this.hf;b.w(a)||(this.hf=a=a.G(),this.o(),this.g("spot1",b,a))}},spot2:{get:function(){return this.jf},set:function(a){var b=this.jf;b.w(a)||(this.jf=a=a.G(),this.o(),this.g("spot2",b,a))}},parameter1:{get:function(){return this.ep},set:function(a){var b=this.ep;b!==a&&(this.ep=a,this.cc(),this.o(),this.g("parameter1",
b,a))}},parameter2:{get:function(){return this.fp},set:function(a){var b=this.fp;b!==a&&(this.fp=a,this.cc(),this.o(),this.g("parameter2",b,a))}},naturalBounds:{get:function(){if(null!==this.ka)return this.pc.assign(this.ka.bounds),this.pc;var a=this.desiredSize;return new N(0,0,a.width,a.height)}},pathPattern:{get:function(){return this.hp},set:function(a){var b=this.hp;b!==a&&(this.hp=a,this.M(),this.g("pathPattern",
b,a))}},geometryStretch:{get:function(){return this.Sn},set:function(a){var b=this.Sn;b!==a&&(this.Sn=a,this.g("geometryStretch",b,a))}},interval:{get:function(){return this.Ld},set:function(a){var b=this.Ld;a=Math.round(a);if(b!==a&&0!==a&&isFinite(a)){this.Ld=a;var c=this.diagram;null!==c&&this.panel===c.grid&&pj(c);this.o();c=this.panel;null!==c&&(c.Xg=null);this.g("interval",b,a)}}},graduatedStart:{get:function(){return this.Jd},
set:function(a){var b=this.Jd;b!==a&&(0>a?a=0:1<a&&(a=1),this.Jd=a,this.o(),this.g("graduatedStart",b,a))}},graduatedEnd:{get:function(){return this.Gd},set:function(a){var b=this.Gd;b!==a&&(0>a?a=0:1<a&&(a=1),this.Gd=a,this.o(),this.g("graduatedEnd",b,a))}},graduatedSkip:{get:function(){return this.Hd},set:function(a){var b=this.Hd;b!==a&&(this.Hd=a,this.o(),this.g("graduatedSkip",b,a))}}});W.prototype.intersectsRect=W.prototype.Ic;
W.prototype.containedInRect=W.prototype.Dh;W.prototype.getNearestIntersectionPoint=W.prototype.Vc;W.prototype.getDocumentBounds=W.prototype.nm;W.prototype.getDocumentPoint=W.prototype.ga;var Jn=new db,En=new db;W.className="Shape";W.getFigureGenerators=function(){var a=new H,b;for(b in K.Je)b!==b.toLowerCase()&&a.add(b,K.Je[b]);a.freeze();return a};W.defineFigureGenerator=function(a,b){var c=a.toLowerCase(),d=K.Je;d[a]=b;d[c]=a};
W.getArrowheadGeometries=function(){var a=new H;for(d in K.Qm)if(void 0===Jn[d]){var b=Id(K.Qm[d],!1);Jn[d]=b;b=d.toLowerCase();b!==d&&(Jn[b]=d)}for(var c in Jn)if(c!==c.toLowerCase()){var d=Jn[c];d instanceof sd&&a.add(c,d)}a.freeze();return a};W.defineArrowheadGeometry=function(a,b){var c=null;"string"===typeof b?c=Id(b,!1):c=b;b=a.toLowerCase();"none"!==b&&a!==b||B("Shape.defineArrowheadGeometry name must not be empty or None or all-lower-case: "+a);var d=Jn;d[a]=c;d[b]=a};
function Ug(){Y.call(this);Ln||(Mn=Sg?(new Dk(null)).context:null,Ln=!0);this.tx=this.Tb="";this.Ec="black";this.ie="13px sans-serif";this.Mi="start";this.Fd=xg;this.Qi=cd;this.Aj=!0;this.si=this.ti=!1;this.ig=Nn;this.tg=On;this.ls=this.qb=this.Oc=0;this.Ru=this.Su=null;this.Hn=!1;this.Ac=this.jn=this.Wp=this.Ni=this.Xp=null;this.gf=this.ff=0;this.qe=Infinity;this.vi=0;this.je=null;this.we=0;this.he=this.ib=this.Qb=null;this.Ld=1;this.Jd=0;this.Gd=1;this.Hd=this.wj=null}la(Ug,Y);
Ug.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.Tb=this.Tb;a.tx=this.tx;a.Ec=this.Ec;a.ie=this.ie;a.Mi=this.Mi;a.Fd=this.Fd;a.Qi=this.Qi;a.Aj=this.Aj;a.ti=this.ti;a.si=this.si;a.ig=this.ig;a.tg=this.tg;a.Oc=this.Oc;a.ls=this.ls;a.qb=this.qb;a.Su=this.Su;a.Ru=this.Ru;a.Hn=this.Hn;a.Xp=this.Xp;a.Ni=this.Ni;a.Wp=this.Wp;a.jn=this.jn;a.Ac=this.Ac;a.ff=this.ff;a.gf=this.gf;a.qe=this.qe;a.je=this.je;a.we=this.we;a.Qb=this.Qb;a.ib=this.ib;a.he=this.he;a.vi=this.vi;a.Ld=
this.Ld;a.Jd=this.Jd;a.Gd=this.Gd;a.wj=this.wj;a.Hd=this.Hd};
function Um(a,b){a.F=b.F|6144;a.rb=b.opacity;a.jb=b.background;a.dc=b.areaBackground;a.Nc=b.desiredSize.G();a.bg=b.minSize.G();a.ag=b.maxSize.G();a.Zf=b.Zf.copy();a.ya=b.scale;a.Yb=b.angle;a.ye=b.stretch;a.bh=b.margin.G();a.xb=b.alignment.G();a.Hk=b.alignmentFocus.G();a.Jl=b.segmentFraction;a.Kl=b.segmentOffset.G();a.Ll=b.segmentOrientation;null!==b.md&&(a.md=b.md.copy());a.Nl=b.shadowVisible;b instanceof Ug&&(a.Tb=b.Tb,a.Ec=b.Ec,a.ie=b.ie,a.Mi=b.Mi,a.Fd=b.Fd,a.Qi=b.Qi,a.Aj=b.Aj,a.ti=b.ti,a.si=b.si,
a.ig=b.ig,a.tg=b.tg,a.je=null,a.ff=b.ff,a.gf=b.gf,a.qe=b.qe,a.vi=b.vi,a.Ld=b.Ld,a.Jd=b.Jd,a.Gd=b.Gd,a.wj=b.wj,a.Hd=b.Hd)}t=Ug.prototype;t.gb=function(a){a.classType===Ug?this.wrap=a:Y.prototype.gb.call(this,a)};t.toString=function(){return 22<this.Tb.length?'TextBlock("'+this.Tb.substring(0,20)+'"...)':'TextBlock("'+this.Tb+'")'};t.o=function(){Y.prototype.o.call(this);this.Ru=this.Su=null};
t.Ui=function(a,b){if(null!==this.Ec&&0!==this.Tb.length&&null!==this.ie){var c=this.naturalBounds,d=this.actualBounds,e=c.width,f=c.height,g=Pn(this),h=a.textAlign=this.Mi,k=b.ol;"start"===h?h=k?"right":"left":"end"===h&&(h=k?"left":"right");k=this.ti;var l=this.si;li(this,a,this.Ec,!0,!1,c,d);(k||l)&&li(this,a,this.Ec,!1,!1,c,d);d=0;c=!1;var m=I.allocAt(0,0);this.wd.ra(m);var n=I.allocAt(0,g);this.wd.ra(n);var p=m.De(n);I.free(m);I.free(n);m=b.scale;8>p*m*m&&(c=!0);b.Fb!==a&&(c=!1);!1===b.Ee("textGreeking")&&
(c=!1);b=this.ff;p=this.gf;switch(this.flip){case al:a.translate(e,0);a.scale(-1,1);break;case $k:a.translate(0,f);a.scale(1,-1);break;case bl:a.translate(e,f),a.scale(-1,-1)}m=this.Oc;n=(b+g+p)*m;f>n&&(d=this.Qi,d=d.y*f-d.y*n+d.offsetY);if(1===m&&null!==this.he)p=this.qb,p>e&&(p=e),this.Ti(this.he,a,0,d+b,e,g,p,c,h,k,l);else if(null!==this.Qb&&null!==this.ib)for(n=0;n<m;n++){var r=this.Qb[n];r>e&&(r=e);d+=b;this.Ti(this.ib[n],a,0,d,e,g,r,c,h,k,l);d+=g+p}switch(this.flip){case al:a.scale(-1,1);a.translate(-e,
0);break;case $k:a.scale(1,-1);a.translate(0,-f);break;case bl:a.scale(-1,-1),a.translate(-e,-f)}}};
t.Ti=function(a,b,c,d,e,f,g,h,k,l,m){var n=0;h?("left"===k?n=0:"right"===k?n=e-g:"center"===k&&(n=(e-g)/2),b.fillRect(c+n,d+.25*f,g,1)):("left"===k?n=0:"right"===k?n=e:"center"===k&&(n=e/2),e=null!==Qn?Qn(this,f):.75*f,b.fillText(a,c+n,d+e),a=f/20|0,0===a&&(a=1),"right"===k?n-=g:"center"===k&&(n-=g/2),l&&(k=null!==Rn?Rn(this,f):.8*f,b.beginPath(),b.lineWidth=a,b.moveTo(c+n,d+k),b.lineTo(c+n+g,d+k),b.stroke()),m&&(b.beginPath(),b.lineWidth=a,d=d+f-f/2.2|0,0!==a%2&&(d+=.5),b.moveTo(c+n,d),b.lineTo(c+
n+g,d),b.stroke()))};
t.tm=function(a,b,c,d){this.vi=a;var e=this.ie;null!==Mn&&Sn!==e&&(Sn=Mn.font=e);this.qb=this.we=0;this.he=this.ib=this.Qb=this.je=null;var f;if(isNaN(this.desiredSize.width)){e=this.Tb.replace(/\r\n/g,"\n").replace(/\r/g,"\n");if(0===e.length)e=0;else if(this.isMultiline){for(var g=f=0,h=!1;!h;){var k=e.indexOf("\n",g);-1===k&&(k=e.length,h=!0);f=Math.max(f,Tn(e.substr(g,k-g).trim()));g=k+1}e=f}else f=e.indexOf("\n",0),0<=f&&(e=e.substr(0,f)),e=Tn(e);e=Math.min(e,a/this.scale);e=Math.max(8,e)}else e=
this.desiredSize.width;null!==this.panel&&(e=Math.min(e,this.panel.maxSize.width));f=Un(this,e);isNaN(this.desiredSize.height)?f=Math.min(f,b/this.scale):f=this.desiredSize.height;g=f;if(0!==this.qb&&null!==this.Qb&&null!==this.ib&&this.ig===Vn&&(b=this.ie,b=this.ig===Vn?Wn(b):0,h=this.ff+this.gf,h=Math.max(0,Pn(this)+h),g=Math.min(this.maxLines-1,Math.max(Math.floor(g/h+.01)-1,0)),!(g+1>=this.ib.length))){h=this.ib[g];for(b=Math.max(1,a-b);Tn(h)>b&&1<h.length;)h=h.substr(0,h.length-1);h+=Xn;b=Tn(h);
this.ib[g]=h;this.ib=this.ib.slice(0,g+1);this.Qb[g]=b;this.Qb=this.Qb.slice(0,g+1);this.we=this.ib.length;this.qb=Math.max(this.qb,b);this.Oc=this.we;1===this.Oc&&(this.he=this.ib[0])}if(this.wrap===Yn||isNaN(this.desiredSize.width))e=isNaN(a)?this.qb:Math.min(a,this.qb),isNaN(this.desiredSize.width)&&(e=Math.max(8,e));e=Math.max(c,e);f=Math.max(d,f);Vb(this.pc,e,f);il(this,0,0,e,f)};t.Ch=function(a,b,c,d){nl(this,a,b,c,d)};
function Zn(a,b,c){if(null===a.he)a.he=b,a.qb=c;else{if(null===a.ib||null===a.Qb)a.ib=[],a.Qb=[],a.ib.push(a.he),a.Qb.push(a.qb);a.ib.push(b);a.Qb.push(c)}}
function $n(a,b,c,d){b=b.trim();var e=0;var f=a.ie;var g=a.ff+a.gf;g=Math.max(0,Pn(a)+g);var h=a.ig===Vn?Wn(f):0;if(a.Oc>=a.qe)null!==d&&d.h(0,g);else{var k=b;if(a.tg===ao)if(a.we=1,f=Tn(b),0===h||f<=c)a.qb=Math.max(a.qb,f),Zn(a,b,a.qb),null!==d&&d.h(f,g);else{e=bo(a,k);k=k.substr(e.length);b=bo(a,k);for(f=Tn(e+b);0<b.length&&f<=c;)e+=b,k=k.substr(b.length),b=bo(a,k),f=Tn((e+b).trim());e+=b.trim();for(c=Math.max(1,c-h);Tn(e)>c&&1<e.length;)e=e.substr(0,e.length-1);e+=Xn;b=Tn(e);a.qb=b;Zn(a,e,b);null!==
d&&d.h(b,g)}else{h=0;0===k.length&&(h=1,Zn(a,k,0));for(;0<k.length;){var l=bo(a,k);for(k=k.substr(l.length);Tn(l)>c;){var m=1;f=Tn(l.substr(0,m));for(b=0;f<=c;)m++,b=f,f=Tn(l.substr(0,m));if(1===m){var n=f;e=Math.max(e,f)}else n=b,e=Math.max(e,b);m--;1>m&&(m=1);Zn(a,l.substr(0,m),n);h++;l=l.substr(m);if(a.Oc+h>a.qe)break}b=bo(a,k);for(f=Tn(l+b);0<b.length&&f<=c;)l+=b,k=k.substr(b.length),b=bo(a,k),f=Tn((l+b).trim());l=l.trim();if(""!==l&&("\u00ad"===l[l.length-1]&&(l=l.substring(0,l.length-1)+"\u2010"),
0===b.length?(m=f,e=Math.max(e,f)):(m=b=Tn(l),e=Math.max(e,b)),Zn(a,l,m),h++,a.Oc+h>a.qe))break}a.we=Math.min(a.qe,h);a.qb=Math.max(a.qb,e);null!==d&&d.h(a.qb,g*a.we)}}}function bo(a,b){if(a.tg===co)return b.substr(0,1);a=b.length;for(var c=0,d=eo;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 Tn(a){return null===Mn?8*a.length:Mn.measureText(a).width}
function Pn(a){if(null!==a.je)return a.je;var b=a.ie;if(null===Mn){var c=16;return a.je=c}void 0!==fo[b]&&5E3>go?c=fo[b]:(c=1.3*Mn.measureText("M").width,fo[b]=c,go++);return a.je=c}function Wn(a){if(null===Mn)return 6;if(void 0!==ho[a]&&5E3>io)var b=ho[a];else b=Mn.measureText(Xn).width,ho[a]=b,io++;return b}
function Un(a,b){var c=a.Tb.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),d=a.ff+a.gf;d=Math.max(0,Pn(a)+d);if(0===c.length)return a.qb=0,a.Oc=1,d;if(!a.isMultiline){var e=c.indexOf("\n",0);0<=e&&(c=c.substr(0,e))}e=0;for(var f=a.Oc=0,g,h=!1;!h;){g=c.indexOf("\n",f);-1===g&&(g=c.length,h=!0);if(f<=g){f=c.substr(f,g-f);if(a.tg!==ao){a.we=0;var k=M.alloc();$n(a,f,b,k);e+=k.height;M.free(k);a.Oc+=a.we}else $n(a,f,b,null),e+=d,a.Oc++;a.Oc===a.qe&&(h=!0)}f=g+1}return a.ls=e}
ma.Object.defineProperties(Ug.prototype,{font:{get:function(){return this.ie},set:function(a){var b=this.ie;b!==a&&(this.ie=a,this.je=null,this.o(),this.g("font",b,a))}},text:{get:function(){return this.Tb},set:function(a){var b=this.Tb;null!==a&&void 0!==a?a=a.toString():a="";b!==a&&(this.Tb=a,this.o(),this.g("text",b,a))}},textAlign:{get:function(){return this.Mi},set:function(a){var b=this.Mi;b===a||"start"!==
a&&"end"!==a&&"left"!==a&&"right"!==a&&"center"!==a||(this.Mi=a,this.M(),this.g("textAlign",b,a))}},flip:{get:function(){return this.Fd},set:function(a){var b=this.Fd;b!==a&&(this.Fd=a,this.M(),this.g("flip",b,a))}},verticalAlignment:{get:function(){return this.Qi},set:function(a){var b=this.Qi;b.w(a)||(this.Qi=a=a.G(),Dl(this),this.g("verticalAlignment",b,a))}},naturalBounds:{get:function(){if(!this.pc.v()){var a=
M.alloc();$n(this,this.Tb,999999,a);var b=a.width;M.free(a);a=Un(this,b);var c=this.desiredSize;isNaN(c.width)||(b=c.width);isNaN(c.height)||(a=c.height);Vb(this.pc,b,a)}return this.pc}},isMultiline:{get:function(){return this.Aj},set:function(a){var b=this.Aj;b!==a&&(this.Aj=a,this.o(),this.g("isMultiline",b,a))}},isUnderline:{get:function(){return this.ti},set:function(a){var b=this.ti;b!==a&&(this.ti=a,this.M(),this.g("isUnderline",b,
a))}},isStrikethrough:{get:function(){return this.si},set:function(a){var b=this.si;b!==a&&(this.si=a,this.M(),this.g("isStrikethrough",b,a))}},wrap:{get:function(){return this.tg},set:function(a){var b=this.tg;b!==a&&(this.tg=a,this.o(),this.g("wrap",b,a))}},overflow:{get:function(){return this.ig},set:function(a){var b=this.ig;b!==a&&(this.ig=a,this.o(),this.g("overflow",b,a))}},stroke:{
get:function(){return this.Ec},set:function(a){var b=this.Ec;b!==a&&(null!==a&&Sl(a,"TextBlock.stroke"),a instanceof ul&&a.freeze(),this.Ec=a,this.M(),this.g("stroke",b,a))}},lineCount:{get:function(){return this.Oc}},editable:{get:function(){return this.Hn},set:function(a){var b=this.Hn;b!==a&&(this.Hn=a,this.g("editable",b,a))}},textEditor:{get:function(){return this.Xp},set:function(a){var b=this.Xp;b!==a&&
(this.Xp=a,this.g("textEditor",b,a))}},errorFunction:{get:function(){return this.Ac},set:function(a){var b=this.Ac;b!==a&&(this.Ac=a,this.g("errorFunction",b,a))}},interval:{get:function(){return this.Ld},set:function(a){var b=this.Ld;a=Math.round(a);if(b!==a&&0!==a&&isFinite(a)){this.Ld=a;this.o();var c=this.panel;null!==c&&(c.Xg=null);this.g("interval",b,a)}}},graduatedStart:{get:function(){return this.Jd},
set:function(a){var b=this.Jd;b!==a&&(0>a?a=0:1<a&&(a=1),this.Jd=a,this.o(),this.g("graduatedStart",b,a))}},graduatedEnd:{get:function(){return this.Gd},set:function(a){var b=this.Gd;b!==a&&(0>a?a=0:1<a&&(a=1),this.Gd=a,this.o(),this.g("graduatedEnd",b,a))}},graduatedFunction:{get:function(){return this.wj},set:function(a){var b=this.wj;b!==a&&(this.wj=a,this.o(),this.g("graduatedFunction",b,a))}},graduatedSkip:{
get:function(){return this.Hd},set:function(a){var b=this.Hd;b!==a&&(this.Hd=a,this.o(),this.g("graduatedSkip",b,a))}},textValidation:{get:function(){return this.Ni},set:function(a){var b=this.Ni;b!==a&&(this.Ni=a,this.g("textValidation",b,a))}},textEdited:{get:function(){return this.Wp},set:function(a){var b=this.Wp;b!==a&&(this.Wp=a,this.g("textEdited",b,a))}},spacingAbove:{get:function(){return this.ff},set:function(a){var b=
this.ff;b!==a&&(this.ff=a,this.g("spacingAbove",b,a))}},spacingBelow:{get:function(){return this.gf},set:function(a){var b=this.gf;b!==a&&(this.gf=a,this.g("spacingBelow",b,a))}},maxLines:{get:function(){return this.qe},set:function(a){var b=this.qe;b!==a&&(a=Math.floor(a),0>=a&&va(a,"> 0",Ug,"maxLines"),this.qe=a,this.g("maxLines",b,a),this.o())}},metrics:{get:function(){return{arrSize:null!==this.Qb?this.Qb:
[this.qb],arrText:null!==this.ib?this.ib:[this.he],maxLineWidth:this.qb,fontHeight:this.je}}},choices:{get:function(){return this.jn},set:function(a){var b=this.jn;b!==a&&(this.jn=a,this.g("choices",b,a))}}});
var Qn=null,Rn=null,ao=new D(Ug,"None",0),Yn=new D(Ug,"WrapFit",1),On=new D(Ug,"WrapDesiredSize",2),co=new D(Ug,"WrapBreakAll",3),Nn=new D(Ug,"OverflowClip",0),Vn=new D(Ug,"OverflowEllipsis",1),eo=/[ \u200b\u00ad]/,fo=new db,go=0,ho=new db,io=0,Xn="...",Sn="",Mn=null,Ln=!1;Ug.className="TextBlock";Ug.getEllipsis=function(){return Xn};Ug.setEllipsis=function(a){Xn=a;ho=new db;io=0};Ug.getBaseline=function(){return Qn};Ug.setBaseline=function(a){Qn=a;a=Pa();for(var b=a.length,c=0;c<b;c++)a[c].Zd()};
Ug.getUnderline=function(){return Rn};Ug.setUnderline=function(a){Rn=a;a=Pa();for(var b=a.length,c=0;c<b;c++)a[c].Zd()};Ug.isValidFont=function(a){Ln||(Mn=Sg?(new Dk(null)).context:null,Ln=!0);if(null===Mn)return!0;var b=Mn.font;if(a===b||"10px sans-serif"===a)return!0;Mn.font="10px sans-serif";Mn.font=a;var c=Mn.font;if("10px sans-serif"!==c)return Mn.font=b,!0;Mn.font="19px serif";var d=Mn.font;Mn.font=a;c=Mn.font;Mn.font=b;return c!==d};Ug.None=ao;Ug.WrapFit=Yn;Ug.WrapDesiredSize=On;
Ug.WrapBreakAll=co;Ug.OverflowClip=Nn;Ug.OverflowEllipsis=Vn;function jo(){this.Qb=[];this.ib=[]}jo.prototype.reset=function(){this.Qb=[];this.ib=[]};jo.prototype.pt=function(a){this.Qb=Ba(a.Qb);this.ib=Ba(a.ib)};jo.className="TextBlockMetrics";function mk(){Y.call(this);this.Sg=null;this.Op="";this.nh=jc;this.gl=ud;this.kf=this.Ac=null;this.fl=Ac;this.Fd=xg;this.Wl=null;this.Fu=!1;this.Nr=!0;this.wl=!1;this.Pl=null}la(mk,Y);
mk.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.element=this.Sg;a.Op=this.Op;a.nh=this.nh.G();a.gl=this.gl;a.Fd=this.Fd;a.Ac=this.Ac;a.kf=this.kf;a.fl=this.fl.G();a.Nr=this.Nr;a.Pl=this.Pl};t=mk.prototype;t.gb=function(a){a===xg||a===zg||a===Zk?this.imageStretch=a:Y.prototype.gb.call(this,a)};t.toString=function(){return"Picture("+this.source+")#"+lb(this)};function ok(a){void 0===a&&(a="");""!==a?ko[a]&&(delete ko[a],lo--):(ko=new db,lo=0)}
function mo(a,b){a.Zr=!0;a.cl=!1;for(var c,d=Pa(),e=d.length,f=0;f<e;f++){var g=d[f];c=a.getAttribute("src");var h=g.Gi.H(c);if(null!==h)for(var k=h.length,l=0;l<k;l++)c=h[l],g.Cs.add(c),g.Bb(),void 0===a.av&&(a.av=b,null!==c.kf&&c.kf(c,b))}}function no(a,b){a.cl=b;for(var c,d=Pa(),e=d.length,f=0;f<e;f++){var g=d[f],h=a.getAttribute("src");c=g.Gi.H(h);if(null!==c){g=c.length;h=Fa();for(var k=0;k<g;k++)h.push(c[k]);for(k=0;k<g;k++)c=h[k],null!==c.Ac&&c.Ac(c,b);Ha(h)}}}
t.rA=function(){if(""!==this.source){ok(this.source);var a=this.source;this.source="";this.source=a}};t.Zd=function(){this.M()};
t.Ui=function(a,b){var c=this.Sg;if(null!==c){var d=c.getAttribute("src");c instanceof HTMLImageElement&&(null===d||""===d)&&B('Element has no source ("src") attribute: '+c);if(!(c.cl instanceof Event)){d=this.naturalBounds;var e=0,f=0,g=this.Fu,h=g?+c.width:c.naturalWidth;g=g?+c.height:c.naturalHeight;void 0===h&&c.videoWidth&&(h=c.videoWidth);void 0===g&&c.videoHeight&&(g=c.videoHeight);h=h||d.width;g=g||d.height;if(0!==h&&0!==g){var k=h,l=g;this.sourceRect.v()&&(e=this.nh.x,f=this.nh.y,h=this.nh.width,
g=this.nh.height);var m=h,n=g,p=this.gl,r=this.fl;switch(p){case xg:if(this.sourceRect.v())break;m>=d.width&&(e=e+r.offsetX+(m*r.x-d.width*r.x));n>=d.height&&(f=f+r.offsetY+(n*r.y-d.height*r.y));h=Math.min(d.width,m);g=Math.min(d.height,n);break;case ud:m=d.width;n=d.height;break;case zg:case Zk:p===zg?(p=Math.min(d.height/n,d.width/m),m*=p,n*=p):p===Zk&&(p=Math.max(d.height/n,d.width/m),m*=p,n*=p,m>=d.width&&(e=(e+r.offsetX+(m*r.x-d.width*r.x)/m)*h),n>=d.height&&(f=(f+r.offsetY+(n*r.y-d.height*r.y)/
n)*g),h*=1/(m/d.width),g*=1/(n/d.height),m=d.width,n=d.height)}p=this.uf()*b.scale;var q=m*p*n*p,u=h*g/q,v=c.__goCache;p=null;var w=oo;if(c.Zr&&void 0!==v&&4<q&&u>w*w)for(null===v.Si&&(po(v,4,k,l,c),po(v,16,k,l,c)),k=v.Si,l=k.length,q=0;q<l;q++)if(k[q].ratio*k[q].ratio<u)p=k[q];else break;if(!b.Zk){if(null===this.Wl)if(null===this.Sg)this.Wl=!1;else{k=(new Dk(null)).context;k.drawImage(this.Sg,0,0);try{k.getImageData(0,0,1,1).data[3]&&(this.Wl=!1),this.Wl=!1}catch(y){this.Wl=!0}}if(this.Wl)return}k=
0;m<d.width&&(k=r.offsetX+(d.width*r.x-m*r.x));l=0;n<d.height&&(l=r.offsetY+(d.height*r.y-n*r.y));switch(this.flip){case al:a.translate(Math.min(d.width,m),0);a.scale(-1,1);break;case $k:a.translate(0,Math.min(d.height,n));a.scale(1,-1);break;case bl:a.translate(Math.min(d.width,m),Math.min(d.height,n)),a.scale(-1,-1)}if(b.Ee("pictureRatioOptimization")&&!b.pi&&void 0!==v&&null!==p&&1!==p.ratio){a.save();b=p.ratio;try{a.drawImage(p.source,e/b,f/b,Math.min(p.source.width,h/b),Math.min(p.source.height,
g/b),k,l,Math.min(d.width,m),Math.min(d.height,n))}catch(y){this.Nr=!1}a.restore()}else try{a.drawImage(c,e,f,h,g,k,l,Math.min(d.width,m),Math.min(d.height,n))}catch(y){this.Nr=!1}switch(this.flip){case al:a.scale(-1,1);a.translate(-Math.min(d.width,m),0);break;case $k:a.scale(1,-1);a.translate(0,-Math.min(d.height,n));break;case bl:a.scale(-1,-1),a.translate(-Math.min(d.width,m),-Math.min(d.height,n))}}}}};
t.tm=function(a,b,c,d){var e=this.desiredSize,f=ll(this,!0),g=this.Sg,h=this.Fu;if(h||!this.wl&&g&&g.complete)this.wl=!0;null===g&&(isFinite(e.width)||(a=0),isFinite(e.height)||(b=0));isFinite(e.width)||f===ud||f===Xk?(isFinite(a)||(a=this.sourceRect.v()?this.sourceRect.width:h?+g.width:g.naturalWidth),c=0):null!==g&&!1!==this.wl&&(a=this.sourceRect.v()?this.sourceRect.width:h?+g.width:g.naturalWidth);isFinite(e.height)||f===ud||f===Yk?(isFinite(b)||(b=this.sourceRect.v()?this.sourceRect.height:h?
+g.height:g.naturalHeight),d=0):null!==g&&!1!==this.wl&&(b=this.sourceRect.v()?this.sourceRect.height:h?+g.height:g.naturalHeight);isFinite(e.width)&&(a=e.width);isFinite(e.height)&&(b=e.height);e=this.maxSize;f=this.minSize;c=Math.max(c,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));Vb(this.pc,a,b);il(this,0,0,a,b)};t.Ch=function(a,b,c,d){nl(this,a,b,c,d)};
ma.Object.defineProperties(mk.prototype,{element:{get:function(){return this.Sg},set:function(a){var b=this.Sg;if(b!==a){null===a||a instanceof HTMLImageElement||a instanceof HTMLVideoElement||a instanceof HTMLCanvasElement||B("Picture.element must be an instance of Image, Canvas, or Video, not: "+a);this.Fu=a instanceof HTMLCanvasElement;this.Sg=a;if(null!==a)if(a instanceof HTMLCanvasElement||!0===a.complete)a.cl instanceof Event&&null!==this.Ac&&this.Ac(this,a.cl),
!0===a.Zr&&null!==this.kf&&this.kf(this,a.av),a.Zr=!0,this.desiredSize.v()||(oj(this,!1),this.o());else{var c=this;a.hx||(a.addEventListener("load",function(b){mo(a,b);c.desiredSize.v()||(oj(c,!1),c.o())}),a.addEventListener("error",function(b){no(a,b)}),a.hx=!0)}this.g("element",b,a);this.M()}}},source:{get:function(){return this.Op},set:function(a){var b=this.Op;if(b!==a){this.Op=a;var c=ko,d=this.diagram,e=null;if(void 0!==c[a])e=c[a];else{30<lo&&(ok(),c=ko);e=ta("img");
var f=this;e.addEventListener("load",function(a){mo(e,a);f.desiredSize.v()||(oj(f,!1),f.o())});e.addEventListener("error",function(a){no(e,a)});e.hx=!0;var g=this.Pl;null!==g&&(e.crossOrigin=g(this));e.src=a;c[a]=e;lo++}null!==d&&nk(d,this);this.element=e;null!==d&&lk(d,this);void 0===e.__goCache&&(e.__goCache=new qo);this.o();this.M();this.g("source",b,a)}}},sourceCrossOrigin:{get:function(){return this.Pl},set:function(a){if(this.Pl!==a&&(this.Pl=a,null!==this.element)){var b=
this.element.getAttribute("src");null===a&&"string"===typeof b?this.element.crossOrigin=null:null!==a&&(this.element.crossOrigin=a(this));this.element.src=b}}},sourceRect:{get:function(){return this.nh},set:function(a){var b=this.nh;b.w(a)||(this.nh=a=a.G(),this.M(),this.g("sourceRect",b,a))}},imageStretch:{get:function(){return this.gl},set:function(a){var b=this.gl;b!==a&&(this.gl=a,this.M(),this.g("imageStretch",b,a))}},flip:{
get:function(){return this.Fd},set:function(a){var b=this.Fd;b!==a&&(this.Fd=a,this.M(),this.g("flip",b,a))}},imageAlignment:{get:function(){return this.fl},set:function(a){var b=this.fl;b.w(a)||(this.fl=a=a.G(),this.o(),this.g("imageAlignment",b,a))}},errorFunction:{get:function(){return this.Ac},set:function(a){var b=this.Ac;b!==a&&(this.Ac=a,this.g("errorFunction",b,a))}},successFunction:{get:function(){return this.kf},
set:function(a){var b=this.kf;b!==a&&(this.kf=a,this.g("successFunction",b,a))}},naturalBounds:{get:function(){return this.pc}}});mk.prototype.redraw=mk.prototype.Zd;mk.prototype.reloadSource=mk.prototype.rA;var ko=null,lo=0,oo=4;mk.className="Picture";ko=new db;mk.clearCache=ok;function qo(){this.Si=null}
function po(a,b,c,d,e){null===a.Si&&(a.Si=[]);var f=new Dk(null),g=f.context,h=1/b;f.width=c/b;f.height=d/b;0!==f.width&&0!==f.height&&(b=new ro(f.Fa,b),c=1,0<a.Si.length&&(c=a.Si[a.Si.length-1],e=c.source,c=c.ratio),g.setTransform(h*c,0,0,h*c,0,0),g.drawImage(e,0,0),a.Si.push(b))}qo.className="PictureCacheArray";function ro(a,b){this.source=a;this.ratio=b}ro.className="PictureCacheInstance";function so(){this.xt=new sd;this.fc=null}t=so.prototype;
t.reset=function(a){null!==a?(a.ea(),this.xt=a,a.figures.clear()):this.xt=new sd;this.fc=null};function Kd(a,b,c,d,e){a.fc=new ge;a.fc.startX=b;a.fc.startY=c;a.fc.isFilled=d;a.xt.figures.add(a.fc);void 0!==e&&(a.fc.isShadowed=e)}function Sd(a){var b=a.fc.segments.length;0<b&&a.fc.segments.L(b-1).close()}t.Uq=function(a){this.fc.isShadowed=a};t.moveTo=function(a,b,c){void 0===c&&(c=!1);var d=new oe(Wd);d.endX=a;d.endY=b;c&&d.close();this.fc.segments.add(d)};
t.lineTo=function(a,b,c){void 0===c&&(c=!1);var d=new oe(xd);d.endX=a;d.endY=b;c&&d.close();this.fc.segments.add(d)};function Ld(a,b,c,d,e,f,g){var h;void 0===h&&(h=!1);var k=new oe(Xd);k.point1X=b;k.point1Y=c;k.point2X=d;k.point2Y=e;k.endX=f;k.endY=g;h&&k.close();a.fc.segments.add(k)}function Md(a,b,c,d,e){var f;void 0===f&&(f=!1);var g=new oe(Yd);g.point1X=b;g.point1Y=c;g.endX=d;g.endY=e;f&&g.close();a.fc.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 oe(Zd);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.fc.segments.add(h)};function Rd(a,b,c,d,e,f,g,h){var k;void 0===k&&(k=!1);b=new oe($d,g,h,b,c,d,e,f);k&&b.close();a.fc.segments.add(b)}function Jd(a){var b=Td;if(null!==b)return Td=null,b.reset(a),b;b=new so;b.reset(a);return b}var Td=null;so.className="StreamGeometryContext";
function to(a,b){var c=a.toLowerCase(),d=K.Je;d[a]=b;d[c]=a}to("Rectangle",function(a,b,c){a="r"+b+","+c;var d=K.Oh[a];if(void 0!==d)return d;d=new sd(zd);d.endX=b;d.endY=c;50>K.Ph&&(K.Oh[a]=d,K.Ph++);return d});to("Square",function(a,b,c){a="s"+b+","+c;var d=K.Oh[a];if(void 0!==d)return d;d=new sd(zd);d.endX=b;d.endY=c;d.defaultStretch=zg;50>K.Ph&&(K.Oh[a]=d,K.Ph++);return d});
to("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.Eg;b=(new sd).add((new ge(d,0,!0)).add(new oe(xd,b-d,0)).add(new oe(Xd,b,d,b-a,0,b,a)).add(new oe(xd,b,c-d)).add(new oe(Xd,b-d,c,b,c-a,b-a,c)).add(new oe(xd,d,c)).add(new oe(Xd,0,c-d,a,c,0,c-a)).add(new oe(xd,0,d)).add((new oe(Xd,d,0,0,a,a,0)).close()));1<a&&(b.spot1=new P(0,0,a,a),b.spot2=new P(1,1,-a,-a));return b});to("Border","RoundedRectangle");
to("Ellipse",function(a,b,c){a="e"+b+","+c;var d=K.Oh[a];if(void 0!==d)return d;d=new sd(Hd);d.endX=b;d.endY=c;d.spot1=id;d.spot2=jd;50>K.Ph&&(K.Oh[a]=d,K.Ph++);return d});to("Circle",function(a,b,c){a="c"+b+","+c;var d=K.Oh[a];if(void 0!==d)return d;d=new sd(Hd);d.endX=b;d.endY=c;d.spot1=id;d.spot2=jd;d.defaultStretch=zg;50>K.Ph&&(K.Oh[a]=d,K.Ph++);return d});to("TriangleRight",function(a,b,c){return(new sd).add((new ge(0,0)).add(new oe(xd,b,.5*c)).add((new oe(xd,0,c)).close())).Mm(0,.25,.5,.75)});
to("TriangleDown",function(a,b,c){return(new sd).add((new ge(0,0)).add(new oe(xd,b,0)).add((new oe(xd,.5*b,c)).close())).Mm(.25,0,.75,.5)});to("TriangleLeft",function(a,b,c){return(new sd).add((new ge(b,c)).add(new oe(xd,0,.5*c)).add((new oe(xd,b,0)).close())).Mm(.5,.25,1,.75)});to("TriangleUp",function(a,b,c){return(new sd).add((new ge(b,c)).add(new oe(xd,0,c)).add((new oe(xd,.5*b,0)).close())).Mm(.25,.5,.75,1)});to("Triangle","TriangleUp");
to("Diamond",function(a,b,c){return(new sd).add((new ge(.5*b,0)).add(new oe(xd,0,.5*c)).add(new oe(xd,.5*b,c)).add((new oe(xd,b,.5*c)).close())).Mm(.25,.25,.75,.75)});to("LineH",function(a,b,c){a=new sd(vd);a.startX=0;a.startY=c/2;a.endX=b;a.endY=c/2;return a});to("LineV",function(a,b,c){a=new sd(vd);a.startX=b/2;a.startY=0;a.endX=b/2;a.endY=c;return a});to("None","Rectangle");to("BarH","Rectangle");to("BarV","Rectangle");to("MinusLine","LineH");
to("PlusLine",function(a,b,c){return(new sd).add((new ge(0,c/2,!1)).add(new oe(xd,b,c/2)).add(new oe(Wd,b/2,0)).add(new oe(xd,b/2,c)))});to("XLine",function(a,b,c){return(new sd).add((new ge(0,c,!1)).add(new oe(xd,b,0)).add(new oe(Wd,0,0)).add(new oe(xd,b,c)))});
K.Qm={"":"",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 T(a){X.call(this,a);this.D=2408959;this.ah=this.If="";this.rp=this.np=this.Dp=this.ro=null;this.Fp="";this.Ff=this.ao=this.Ep=this.mh=null;this.pp="";this.op=Rb;this.Tb=this.sp="";this.wi=this.mn=this.fi=null;this.$f=(new I(NaN,NaN)).freeze();this.yo="";this.Xe=null;this.zo=vc;this.tp=$c;this.Io=Hb;this.Ao=Ib;this.En=null;this.so=127;this.Jp=Jb;this.Ip="gray";this.df=4;this.jx=-1;this.gq=NaN;this.Jy=new N;this.Ij=null;this.dh=NaN}la(T,X);
T.prototype.cloneProtected=function(a){X.prototype.cloneProtected.call(this,a);a.D=this.D&-4097|49152;a.If=this.If;a.ah=this.ah;a.ro=this.ro;a.Dp=this.Dp;a.np=this.np;a.rp=this.rp;a.Fp=this.Fp;a.Ep=this.Ep;a.ao=this.ao;a.Ff=null;a.pp=this.pp;a.op=this.op.G();a.sp=this.sp;a.tp=this.tp.G();a.Tb=this.Tb;a.mn=this.mn;a.$f.assign(this.$f);a.yo=this.yo;a.zo=this.zo.G();a.Io=this.Io.G();a.Ao=this.Ao.G();a.En=this.En;a.so=this.so;a.Jp=this.Jp.G();a.Ip=this.Ip;a.df=this.df;a.gq=this.gq};
T.prototype.sf=function(a){X.prototype.sf.call(this,a);a.Ih();a.mh=null;a.Xe=null;a.Ij=null};T.prototype.toString=function(){var a=Ia(this.constructor)+"#"+lb(this);null!==this.data&&(a+="("+Ja(this.data)+")");return a};T.prototype.xk=function(a,b,c,d,e,f,g){var h=this.diagram;null!==h&&(a===we&&"elements"===b?e instanceof X?Gj(e,function(a){Ij(h.partManager,a);Hj(h,a)}):lk(h,e):a===xe&&"elements"===b&&(e instanceof X?Gj(e,function(a){Lj(h.partManager,a,h)}):nk(h,e)),h.$a(a,b,c,d,e,f,g))};
T.prototype.Ba=function(a){X.prototype.Ba.call(this,a);if(null!==this.data){for(var b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d];e instanceof X&&Gj(e,function(a){null!==a.data&&a.Ba()})}for(b=this.adornments;b.next();)b.value.Ba(a)}};T.prototype.updateRelationshipsFromData=function(){null!==this.data&&this.diagram.partManager.updateRelationshipsFromData(this)};T.prototype.hk=function(a){var b=this.Ff;return null===b?null:b.H(a)};
T.prototype.zh=function(a,b){if(null!==b){var c=null,d=this.Ff;null!==d&&(c=d.H(a));if(c!==b){if(null!==c){var e=c.diagram;null!==e&&e.remove(c)}null===d&&(this.Ff=d=new H);b.If!==a&&(b.category=a);d.add(a,b);a=this.diagram;null!==a&&(a.add(b),a=b.adornedObject,null!==a&&(a=a.Yi(),null!==a&&(b.data=a.data)))}}};T.prototype.Af=function(a){var b=this.Ff;if(null!==b){var c=b.H(a);if(null!==c){var d=c.diagram;null!==d&&d.remove(c)}b.remove(a);0===b.count&&(this.Ff=null)}};
T.prototype.$j=function(){var a=this.Ff;if(null!==a){var b=Fa();for(a=a.iterator;a.next();)b.push(a.key);a=b.length;for(var c=0;c<a;c++)this.Af(b[c]);Ha(b)}};
T.prototype.updateAdornments=function(){var a=this.diagram;if(null!==a){for(var b=this.adornments;b.next();){var c=b.value;c.o();c.placeholder&&c.placeholder.o()}a:{if(this.isSelected&&this.selectionAdorned&&(b=this.selectionObject,null!==b&&this.actualBounds.v()&&this.isVisible()&&b.zf()&&b.actualBounds.v())){c=this.hk("Selection");if(null===c){c=this.selectionAdornmentTemplate;null===c&&(c=this.Jh()?a.linkSelectionAdornmentTemplate:this instanceof uf?a.groupSelectionAdornmentTemplate:a.nodeSelectionAdornmentTemplate);
if(!(c instanceof Ke))break a;wg(c);c=c.copy();null!==c&&(this.Jh()&&this.selectionObject===this.path&&(c.type=X.Link),c.adornedObject=b)}if(null!==c){c.type===X.Link&&c.o();this.zh("Selection",c);break a}}this.Af("Selection")}uo(this,a);for(b=this.adornments;b.next();)b.value.Ba()}};T.prototype.Mb=function(){var a=this.diagram;null!==a&&(Ui(a),0!==(this.D&16384)!==!0&&(ji(this,!0),a.Bb()))};function ii(a){0!==(a.D&16384)!==!1&&(a.updateAdornments(),ji(a,!1))}
function uo(a,b){b.toolManager.mouseDownTools.each(function(b){b.isEnabled&&b.updateAdornments(a)});b.toolManager.updateAdornments(a)}function vo(a){if(!1===vj(a)){wo(a,!0);a.nl();var b=a.diagram;null!==b&&(b.od.add(a),b.Bb())}}function xo(a){a.D|=2097152;if(!1!==vj(a)){var b=a.position,c=a.location;c.v()&&b.v()||yo(a,b,c);c=a.wb;var d=N.alloc().assign(c);c.ea();c.x=b.x;c.y=b.y;c.freeze();a.Pt(d,c);N.free(d);wo(a,!1)}}T.prototype.move=function(a,b){!0===b?this.location=a:this.position=a};
T.prototype.moveTo=function(a,b,c){a=I.allocAt(a,b);this.move(a,c);I.free(a)};T.prototype.isVisible=function(){if(!this.visible)return!1;var a=this.layer;if(null!==a){if(!a.visible)return!1;a=a.diagram;if(null!==a&&a.animationManager.Ot(this))return!0}a=this.containingGroup;return null===a||a.isSubGraphExpanded&&a.isVisible()?!0:!1};t=T.prototype;t.Pb=function(a){var b=this.diagram;a?(this.C(4),this.Mb(),null!==b&&b.od.add(this)):(this.C(8),this.$j());this.Ih();null!==b&&(b.Na(),b.M())};
t.Za=function(a){if(this.name===a)return this;var b=this.Ij;null===b&&(this.Ij=b=new H);if(null!==b.H(a))return b.H(a);var c=X.prototype.Za.call(this,a);if(null!==c)return b.set(a,c),c;b.set(a,null);return null};t.wf=function(a,b,c){void 0===c&&(c=new I);b=b.kc()?Ac: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.ra(c);for(a=a.panel;null!==a&&a!==this;)a.transform.ra(c),a=a.panel;this.Zf.ra(c);c.offset(-this.oc.x,-this.oc.y);return c};
t.nm=function(a){void 0===a&&(a=new N);return a.assign(this.actualBounds)};t.Ab=function(){!0===tj(this)&&this.measure(Infinity,Infinity);this.arrange()};function Ej(a,b){var c=a.Jy;isNaN(a.dh)&&(a.dh=fn(a));var d=a.dh;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}
T.prototype.arrange=function(){if(!1===uj(this))xo(this);else{ml(this,!1);var a=this.wb,b=N.alloc();b.assign(a);a.ea();var c=ug(this);this.Ch(0,0,this.oc.width,this.oc.height);var d=this.position;yo(this,d,this.location);a.x=d.x;a.y=d.y;a.freeze();this.Pt(b,a);b.w(a)?this.Bd(c):!this.Wb()||K.A(b.width,a.width)&&K.A(b.height,a.height)||0<=this.jx&&this.C(16);N.free(b);wo(this,!1)}};t=T.prototype;
t.Pt=function(a,b){var c=this.diagram;if(null!==c){var d=!1;if(!1===c.mi&&a.v()){var e=N.alloc();e.assign(c.documentBounds);e.vw(c.padding);a.x>e.x&&a.y>e.y&&a.right<e.right&&a.bottom<e.bottom&&b.x>e.x&&b.y>e.y&&b.right<e.right&&b.bottom<e.bottom&&(d=!0);N.free(e)}0!==(this.D&65536)!==!0&&a.w(b)||Jj(this,d,c);c.M();$b(a,b)||(this instanceof V&&!c.undoManager.isUndoingRedoing&&this.fd(),this.Ih())}};
t.qw=function(a,b){if(this.Jh()||!a.v())return!1;var c=this.diagram;null!==c&&zo(this,c,a,b);this.ma=a;this.D&=-2097153;var d=this.$f;!d.v()||null!==c&&!c.animationManager.isTicking&&c.undoManager.isUndoingRedoing||(c=d.copy(),d.h(d.x+(a.x-b.x),d.y+(a.y-b.y)),this.g("location",c,d.copy()));!1===vj(this)&&!1===uj(this)&&(vo(this),xo(this));return!0};function zo(a,b,c,d){null===b||a instanceof Ke||(b=b.animationManager,b.Ze&&Mh(b,a,d.copy(),c.copy()))}
t.Tq=function(a,b,c){var d=this.$f,e=this.ma;if(c){if(d.x===a&&d.y===b)return;vj(this)||uj(this)?e.h(NaN,NaN):e.h(e.x+a-d.x,e.y+b-d.y);d.h(a,b)}else{if(e.x===a&&e.y===b)return;vj(this)||uj(this)?this.Zt():d.h(d.x+a-e.x,d.y+b-e.y);e.h(a,b)}vo(this)};t.Zt=function(){this.D&=-2097153;vo(this)};
function yo(a,b,c){var d=I.alloc(),e=a.locationSpot,f=a.locationObject;e.kc()&&B("determineOffset: Part's locationSpot must be real: "+e.toString());var g=f.naturalBounds,h=f instanceof W?f.strokeWidth:0;d.zk(0,0,g.width+h,g.height+h,e);if(f!==a)for(d.offset(-h/2,-h/2),f.transform.ra(d),e=f.panel;null!==e&&e!==a;)e.transform.ra(d),e=e.panel;a.Zf.ra(d);d.offset(-a.oc.x,-a.oc.y);e=a.diagram;f=c.v();g=b.v();f&&g?0!==(a.D&2097152)?Ao(a,b,c,e,d):Bo(a,b,c,e,d):f?Ao(a,b,c,e,d):g&&Bo(a,b,c,e,d);a.D|=2097152;
I.free(d);a.nl()}function Ao(a,b,c,d,e){var f=b.x,g=b.y;b.h(c.x-e.x,c.y-e.y);null!==d&&(c=d.animationManager,(d=c.isAnimating)||!c.Ze||a instanceof Ke||Mh(c,a,new I(f,g),b),d||b.x===f&&b.y===g||a.g("position",new I(f,g),b.copy()))}function Bo(a,b,c,d,e){var f=c.copy();c.h(b.x+e.x,b.y+e.y);c.w(f)||null===d||a.g("location",f,c.copy())}
function Jj(a,b,c){ol(a,!1);a instanceof V&&zk(c,a);a.layer.isTemporary||b||c.Na();b=a.wb;var d=c.viewportBounds;d.v()?ug(a)?(dc(b,d)||a.Bd(!1),a.updateAdornments()):b.Ic(d)?(a.Bd(!0),a.updateAdornments()):a.Mb():c.oi=!0}t.ej=function(){return!0};t.Wb=function(){return!0};t.Jh=function(){return!1};t.yf=function(){return!0};
function Co(a,b,c,d){b.constructor===a.constructor||Do||(Do=!0,wa('Should not change the class of the Part when changing category from "'+c+'" to "'+d+'"'),wa("  Old class: "+Ia(a.constructor)+", new class: "+Ia(b.constructor)+", part: "+a.toString()));a.$j();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.sf(a);b.cloneProtected(a);a.If=d;a.o();a.M();b=a.diagram;d=!0;null!==b&&(d=b.skipsUndoManager,
b.skipsUndoManager=!0);a.kb=e;a.D=f?a.D|4096:a.D&-4097;a.D=g?a.D|524288:a.D&-524289;a instanceof V&&(a.P=h?a.P|4:a.P&-5,a.P=k?a.P|1:a.P&-2,a.P=l?a.P|2:a.P&-3);null!==e&&a.Ba();e=a.layerName;e!==c&&(a.ah=c,a.layerName=e);null!==b&&(b.skipsUndoManager=d);a.Wb()&&a.C(64)}T.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};
T.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};T.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};
T.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};T.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};
T.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};T.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};
T.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};T.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 ji(a,b){a.D=b?a.D|16384:a.D&-16385}function vj(a){return 0!==(a.D&32768)}function wo(a,b){a.D=b?a.D|32768:a.D&-32769}
function ol(a,b){a.D=b?a.D|65536:a.D&-65537}function ug(a){return 0!==(a.D&131072)}t=T.prototype;t.Bd=function(a){this.D=a?this.D|131072:this.D&-131073};function Eo(a,b){a.D=b?a.D|1048576:a.D&-1048577}t.Ih=function(){var a=this.containingGroup;null!==a&&(a.o(),null!==a.placeholder&&a.placeholder.o(),a.fd())};t.M=function(){var a=this.diagram;null!==a&&!uj(this)&&!vj(this)&&this.isVisible()&&this.wb.v()&&a.M(Ej(this,this.wb))};
t.o=function(){X.prototype.o.call(this);var a=this.diagram;null!==a&&(a.od.add(this),this instanceof V&&null!==this.labeledLink&&Dl(this.labeledLink),a.Bb(!0))};t.yq=function(a){a||(a=this.fi,null!==a&&Fo(a,this))};t.zq=function(a){a||(a=this.fi,null!==a&&Go(a,this))};t.fk=function(){var a=this.data;if(null!==a){var b=this.diagram;null!==b&&(b=b.model,null!==b&&b.Bm(a))}};t.Cz=function(){return Ho(this,this)};
function Ho(a,b){var c=b.containingGroup;return null!==c?1+Ho(a,c):b instanceof V&&(b=b.labeledLink,null!==b)?Ho(a,b):0}t.Fz=function(){return Io(this,this)};function Io(a,b){var c=b.containingGroup;return null!==c||b instanceof V&&(c=b.labeledLink,null!==c)?Io(a,c):b}t.yd=function(a){return a instanceof uf?Jo(this,this,a):!1};function Jo(a,b,c){if(b===c||null===c)return!1;var d=b.containingGroup;return null===d||d!==c&&!Jo(a,d,c)?b instanceof V&&(b=b.labeledLink,null!==b)?Jo(a,b,c):!1:!0}
t.Tx=function(a){if(null===a)return null;if(this===a)return this.containingGroup;for(var b=this;null!==b;){b instanceof uf&&Eo(b,!0);if(b instanceof V){var c=b.labeledLink;null!==c&&(b=c)}b=b.containingGroup}c=null;for(b=a;null!==b;){if(0!==(b.D&1048576)){c=b;break}b instanceof V&&(a=b.labeledLink,null!==a&&(b=a));b=b.containingGroup}for(b=this;null!==b;)b instanceof uf&&Eo(b,!1),b instanceof V&&(a=b.labeledLink,null!==a&&(b=a)),b=b.containingGroup;return c};
T.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};
T.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.fi,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 Kj(a){if(!a.isVisible())return!1;a=a.layer;return null!==a&&a.isTemporary?!1:!0}
function Tk(a,b,c,d,e,f){void 0===f&&(f=null);if(!(a.contains(b)||null!==f&&!f(b)||b instanceof Ke))if(a.add(b),b instanceof V){if(c&&b instanceof uf)for(var g=b.memberParts;g.next();)Tk(a,g.value,c,d,e,f);if(!1!==e)for(g=b.linksConnected;g.next();){var h=g.value;if(!a.contains(h)){var k=h.fromNode,l=h.toNode;k=null===k||a.contains(k);l=null===l||a.contains(l);(e?k&&l:k||l)&&Tk(a,h,c,d,e,f)}}if(1<d)for(b=b.Hv();b.next();)Tk(a,b.value,c,d-1,e,f)}else if(b instanceof S)for(b=b.labelNodes;b.next();)Tk(a,
b.value,c,d,e,f)}
ma.Object.defineProperties(T.prototype,{key:{get:function(){var a=this.diagram;if(null!==a)return a.model.ja(this.data)}},adornments:{get:function(){return null===this.Ff?fb:this.Ff.iteratorValues}},layer:{get:function(){return this.wi}},diagram:{get:function(){var a=this.wi;return null!==a?a.diagram:null}},layerName:{get:function(){return this.ah},set:function(a){var b=
this.ah;if(b!==a){var c=this.diagram;if(null===c||null!==c.km(a)&&!c.partManager.addsToTemporaryLayer)if(this.ah=a,null!==c&&c.Na(),this.g("layerName",b,a),b=this.layer,null!==b&&b.name!==a&&(c=b.diagram,null!==c&&(a=c.km(a),null!==a&&a!==b))){var d=b.Hc(-1,this,!0);0<=d&&c.$a(xe,"parts",b,this,null,d,!0);d=a.cj(99999999,this,!0);b.visible!==a.visible&&this.Pb(a.visible);0<=d&&c.$a(we,"parts",a,null,this,!0,d);d=this.layerChanged;if(null!==d){var e=c.Z;c.Z=!0;d(this,b,a);c.Z=e}}}}},layerChanged:{
get:function(){return this.ro},set:function(a){var b=this.ro;b!==a&&(this.ro=a,this.g("layerChanged",b,a))}},zOrder:{get:function(){return this.gq},set:function(a){var b=this.gq;if(b!==a){this.gq=a;var c=this.layer;null!==c&&mi(c,-1,this);this.g("zOrder",b,a);a=this.diagram;null!==a&&a.M()}}},locationObject:{get:function(){if(null===this.Xe){var a=this.locationObjectName;""!==a?(a=this.Za(a),null!==a?this.Xe=a:this.Xe=this):
this instanceof Ke?this.type!==X.Link&&null!==this.placeholder?this.Xe=this.placeholder:this.Xe=this:this.Xe=this}return this.Xe.visible?this.Xe:this}},minLocation:{get:function(){return this.Io},set:function(a){var b=this.Io;b.w(a)||(this.Io=a=a.G(),this.g("minLocation",b,a))}},maxLocation:{get:function(){return this.Ao},set:function(a){var b=this.Ao;b.w(a)||(this.Ao=a=a.G(),this.g("maxLocation",b,a))}},locationObjectName:{
get:function(){return this.yo},set:function(a){var b=this.yo;b!==a&&(this.yo=a,this.Xe=null,this.o(),this.g("locationObjectName",b,a))}},locationSpot:{get:function(){return this.zo},set:function(a){var b=this.zo;b.w(a)||(this.zo=a=a.G(),this.o(),this.g("locationSpot",b,a))}},location:{get:function(){return this.$f},set:function(a){var b=a.x,c=a.y,d=this.$f,e=d.x,f=d.y;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))||
(a=a.copy(),b=a,this.Jh()?b=!1:(this.$f=b,this.D|=2097152,!1===uj(this)&&(vo(this),c=this.ma,c.v()&&(e=this.diagram,null===e||e.animationManager.isTicking||!e.undoManager.isUndoingRedoing))&&(f=c.copy(),c.h(c.x+(b.x-d.x),c.y+(b.y-d.y)),zo(this,e,c,f),this.g("position",f,c.copy())),b=!0),b&&this.g("location",d.copy(),a.copy()))}},category:{get:function(){return this.If},set:function(a){var b=this.If;if(b!==a){var c=this.diagram,d=this.data,e=null;if(null!==c&&null!==d&&
!(this instanceof Ke)){var f=c.model.undoManager;f.isEnabled&&!f.isUndoingRedoing&&(e=this.clone(),e.W.addAll(this.W))}this.If=a;this.g("category",b,a);null===c||null===d||this instanceof Ke?this instanceof Ke&&(e=this.adornedPart,null!==e&&(a=e.Ff,null!==a&&a.remove(b),e.zh(this.category,this))):(f=c.model,f.undoManager.isUndoingRedoing||(this.Jh()?(c.partManager.setLinkCategoryForData(d,a),c=c.partManager.findLinkTemplateForCategory(a),null!==c&&(wg(c),c=c.copy(),null!==c&&Co(this,c,b,a))):(null!==
f&&f.Im(d,a),c=Ko(c.partManager,d,a),null!==c&&(wg(c),c=c.copy(),null===c||c instanceof S||(d=this.location.copy(),Co(this,c,b,a),this.location.v()||(this.location=d)))),null!==e&&(b=this.clone(),b.W.addAll(this.W),this.g("self",e,b))))}}},self:{get:function(){return this},set:function(a){Co(this,a,this.category,a.category)}},copyable:{get:function(){return 0!==(this.D&1)},set:function(a){var b=0!==(this.D&1);b!==a&&(this.D^=1,this.g("copyable",
b,a))}},deletable:{get:function(){return 0!==(this.D&2)},set:function(a){var b=0!==(this.D&2);b!==a&&(this.D^=2,this.g("deletable",b,a))}},textEditable:{get:function(){return 0!==(this.D&4)},set:function(a){var b=0!==(this.D&4);b!==a&&(this.D^=4,this.g("textEditable",b,a),this.Mb())}},groupable:{get:function(){return 0!==(this.D&8)},set:function(a){var b=0!==(this.D&8);b!==a&&(this.D^=8,this.g("groupable",b,
a))}},movable:{get:function(){return 0!==(this.D&16)},set:function(a){var b=0!==(this.D&16);b!==a&&(this.D^=16,this.g("movable",b,a))}},selectionAdorned:{get:function(){return 0!==(this.D&32)},set:function(a){var b=0!==(this.D&32);b!==a&&(this.D^=32,this.g("selectionAdorned",b,a),this.Mb())}},isInDocumentBounds:{get:function(){return 0!==(this.D&64)},set:function(a){var b=0!==(this.D&64);if(b!==a){this.D^=64;
var c=this.diagram;null!==c&&c.Na();this.g("isInDocumentBounds",b,a)}}},isLayoutPositioned:{get:function(){return 0!==(this.D&128)},set:function(a){var b=0!==(this.D&128);b!==a&&(this.D^=128,this.g("isLayoutPositioned",b,a),this.C(a?4:8))}},selectable:{get:function(){return 0!==(this.D&256)},set:function(a){var b=0!==(this.D&256);b!==a&&(this.D^=256,this.g("selectable",b,a),this.Mb())}},reshapable:{get:function(){return 0!==
(this.D&512)},set:function(a){var b=0!==(this.D&512);b!==a&&(this.D^=512,this.g("reshapable",b,a),this.Mb())}},resizable:{get:function(){return 0!==(this.D&1024)},set:function(a){var b=0!==(this.D&1024);b!==a&&(this.D^=1024,this.g("resizable",b,a),this.Mb())}},rotatable:{get:function(){return 0!==(this.D&2048)},set:function(a){var b=0!==(this.D&2048);b!==a&&(this.D^=2048,this.g("rotatable",b,a),this.Mb())}},isSelected:{
get:function(){return 0!==(this.D&4096)},set:function(a){var b=0!==(this.D&4096);if(b!==a){var c=this.diagram;if(!a||this.canSelect()&&!(null!==c&&c.selection.count>=c.maxSelectionCount)){this.D^=4096;var d=!1;if(null!==c){d=c.skipsUndoManager;c.skipsUndoManager=!0;var e=c.selection;e.ea();a?e.add(this):e.remove(this);e.freeze()}this.g("isSelected",b,a);this.Mb();a=this.selectionChanged;null!==a&&a(this);null!==c&&(c.Bb(),c.skipsUndoManager=d)}}}},isHighlighted:{get:function(){return 0!==
(this.D&524288)},set:function(a){var b=0!==(this.D&524288);if(b!==a){this.D^=524288;var c=this.diagram;null!==c&&(c=c.highlighteds,c.ea(),a?c.add(this):c.remove(this),c.freeze());this.g("isHighlighted",b,a);this.M();a=this.highlightedChanged;null!==a&&a(this)}}},isShadowed:{get:function(){return 0!==(this.D&8192)},set:function(a){var b=0!==(this.D&8192);b!==a&&(this.D^=8192,this.g("isShadowed",b,a),this.M())}},isAnimated:{get:function(){return 0!==
(this.D&262144)},set:function(a){var b=0!==(this.D&262144);b!==a&&(this.D^=262144,this.g("isAnimated",b,a))}},highlightedChanged:{get:function(){return this.ao},set:function(a){var b=this.ao;b!==a&&(this.ao=a,this.g("highlightedChanged",b,a))}},selectionObjectName:{get:function(){return this.Fp},set:function(a){var b=this.Fp;b!==a&&(this.Fp=a,this.mh=null,this.g("selectionObjectName",b,a))}},selectionAdornmentTemplate:{
get:function(){return this.Dp},set:function(a){var b=this.Dp;b!==a&&(this.Dp=a,this.g("selectionAdornmentTemplate",b,a))}},selectionObject:{get:function(){if(null===this.mh){var a=this.selectionObjectName;null!==a&&""!==a?(a=this.Za(a),null!==a?this.mh=a:this.mh=this):this instanceof S?(a=this.path,null!==a?this.mh=a:this.mh=this):this.mh=this}return this.mh}},selectionChanged:{get:function(){return this.Ep},set:function(a){var b=this.Ep;
b!==a&&(this.Ep=a,this.g("selectionChanged",b,a))}},resizeAdornmentTemplate:{get:function(){return this.np},set:function(a){var b=this.np;b!==a&&(this.np=a,this.g("resizeAdornmentTemplate",b,a))}},resizeObjectName:{get:function(){return this.pp},set:function(a){var b=this.pp;b!==a&&(this.pp=a,this.g("resizeObjectName",b,a))}},resizeObject:{get:function(){var a=this.resizeObjectName;return""!==a&&(a=this.Za(a),
null!==a)?a:this}},resizeCellSize:{get:function(){return this.op},set:function(a){var b=this.op;b.w(a)||(this.op=a=a.G(),this.g("resizeCellSize",b,a))}},rotateAdornmentTemplate:{get:function(){return this.rp},set:function(a){var b=this.rp;b!==a&&(this.rp=a,this.g("rotateAdornmentTemplate",b,a))}},rotateObjectName:{get:function(){return this.sp},set:function(a){var b=this.sp;b!==a&&(this.sp=a,this.g("rotateObjectName",
b,a))}},rotateObject:{get:function(){var a=this.rotateObjectName;return""!==a&&(a=this.Za(a),null!==a)?a:this}},rotationSpot:{get:function(){return this.tp},set:function(a){var b=this.tp;b.w(a)||(this.tp=a=a.G(),this.g("rotationSpot",b,a))}},text:{get:function(){return this.Tb},set:function(a){var b=this.Tb;b!==a&&(this.Tb=a,this.g("text",b,a))}},containingGroup:{get:function(){return this.fi},
set:function(a){if(this.Wb()){var b=this.fi;if(b!==a){null===a||this!==a&&!a.yd(this)||(this===a&&B("Cannot make a Group a member of itself: "+this.toString()),B("Cannot make a Group indirectly contain itself: "+this.toString()+" already contains "+a.toString()));this.C(2);var c=this.diagram;null!==b?Go(b,this):this instanceof uf&&null!==c&&c.wh.remove(this);this.fi=a;null!==a?Fo(a,this):this instanceof uf&&null!==c&&c.wh.add(this);this.C(1);if(null!==c&&c.Z){var d=this.data,e=c.model;if(null!==d&&
e.lk()){var f=e.ja(null!==a?a.data:null);e.Sq(d,f)}}d=this.containingGroupChanged;null!==d&&(e=!0,null!==c&&(e=c.Z,c.Z=!0),d(this,b,a),null!==c&&(c.Z=e));if(this instanceof uf)for(c=new F,Tk(c,this,!0,0,!0),c=c.iterator;c.next();)if(d=c.value,d instanceof V)for(d=d.linksConnected;d.next();)Lo(d.value);if(this instanceof V){for(c=this.linksConnected;c.next();)Lo(c.value);c=this.labeledLink;null!==c&&Lo(c)}this.g("containingGroup",b,a);null!==a&&(b=a.layer,null!==b&&mi(b,-1,a))}}else B("cannot set the Part.containingGroup of a Link or Adornment")}},
containingGroupChanged:{get:function(){return this.mn},set:function(a){var b=this.mn;b!==a&&(this.mn=a,this.g("containingGroupChanged",b,a))}},isTopLevel:{get:function(){return null!==this.containingGroup||this instanceof V&&null!==this.labeledLink?!1:!0}},layoutConditions:{get:function(){return this.so},set:function(a){var b=this.so;b!==a&&(this.so=a,this.g("layoutConditions",b,a))}},dragComputation:{
get:function(){return this.En},set:function(a){var b=this.En;b!==a&&(this.En=a,this.g("dragComputation",b,a))}},shadowOffset:{get:function(){return this.Jp},set:function(a){var b=this.Jp;b.w(a)||(this.Jp=a=a.G(),this.M(),this.g("shadowOffset",b,a))}},shadowColor:{get:function(){return this.Ip},set:function(a){var b=this.Ip;b!==a&&(this.Ip=a,this.M(),this.g("shadowColor",b,a))}},shadowBlur:{get:function(){return this.df},
set:function(a){var b=this.df;b!==a&&(this.df=a,this.M(),this.g("shadowBlur",b,a))}}});T.prototype.invalidateLayout=T.prototype.C;T.prototype.findCommonContainingGroup=T.prototype.Tx;T.prototype.isMemberOf=T.prototype.yd;T.prototype.findTopLevelPart=T.prototype.Fz;T.prototype.findSubGraphLevel=T.prototype.Cz;T.prototype.ensureBounds=T.prototype.Ab;T.prototype.getDocumentBounds=T.prototype.nm;T.prototype.getRelativePoint=T.prototype.wf;T.prototype.findObject=T.prototype.Za;T.prototype.moveTo=T.prototype.moveTo;
T.prototype.invalidateAdornments=T.prototype.Mb;T.prototype.clearAdornments=T.prototype.$j;T.prototype.removeAdornment=T.prototype.Af;T.prototype.addAdornment=T.prototype.zh;T.prototype.findAdornment=T.prototype.hk;T.prototype.updateTargetBindings=T.prototype.Ba;var Do=!1;T.className="Part";T.LayoutNone=0;T.LayoutAdded=1;T.LayoutRemoved=2;T.LayoutShown=4;T.LayoutHidden=8;T.LayoutNodeSized=16;T.LayoutGroupLayout=32;T.LayoutNodeReplaced=64;T.LayoutStandard=127;T.LayoutAll=16777215;
function Ke(a){T.call(this,a);this.D&=-257;this.ah="Adornment";this.de=null;this.nx=0;this.Cx=!1;this.l=[];this.Ra=null}la(Ke,T);Ke.prototype.toString=function(){var a=this.adornedPart;return"Adornment("+this.category+")"+(null!==a?a.toString():"")};Ke.prototype.updateRelationshipsFromData=function(){};
Ke.prototype.qk=function(a){var b=this.adornedObject.part;if(b instanceof S&&this.adornedObject instanceof W){var c=b.path;b.qk(a);a=c.geometry;b=this.W.j;c=b.length;for(var d=0;d<c;d++){var e=b[d];e.isPanelMain&&e instanceof W&&(e.ka=a)}}};Ke.prototype.ej=function(){var a=this.de;if(null===a)return!0;a=a.part;return null===a||!uj(a)};Ke.prototype.Wb=function(){return!1};
Ke.prototype.xk=function(a,b,c,d,e,f,g){if(a===we&&"elements"===b)if(e instanceof vg)null===this.Ra&&(this.Ra=e);else{if(e instanceof X){var h=e.jm(function(a){return a instanceof vg});h instanceof vg&&null===this.Ra&&(this.Ra=h)}}else a===xe&&"elements"===b&&null!==this.Ra&&(d===this.Ra?this.Ra=null:d instanceof X&&this.Ra.zg(d)&&(this.Ra=null));T.prototype.xk.call(this,a,b,c,d,e,f,g)};Ke.prototype.updateAdornments=function(){};Ke.prototype.fk=function(){};
ma.Object.defineProperties(Ke.prototype,{placeholder:{get:function(){return this.Ra}},adornedObject:{get:function(){return this.de},set:function(a){var b=this.adornedPart,c=null;null!==a&&(c=a.part);null===b||null!==a&&b===c||b.Af(this.category);this.de=a;null!==c&&c.zh(this.category,this)}},adornedPart:{get:function(){var a=this.de;return null!==a?a.part:null}},containingGroup:{
get:function(){return null}}});Ke.className="Adornment";function V(a){T.call(this,a);this.P=13;this.Xa=new E;this.aq=this.sl=this.zi=this.uo=this.to=null;this.Kk=tc;this.rc=this.Me=null;this.kp=Mo;this.xh=!1}la(V,T);V.prototype.cloneProtected=function(a){T.prototype.cloneProtected.call(this,a);a.P=this.P;a.P=this.P&-17;a.to=this.to;a.uo=this.uo;a.zi=this.zi;a.aq=this.aq;a.Kk=this.Kk.G();a.kp=this.kp};t=V.prototype;t.sf=function(a){T.prototype.sf.call(this,a);a.fd();a.Me=this.Me;a.rc=null};
function No(a,b){null!==b&&(null===a.Me&&(a.Me=new F),a.Me.add(b))}function Oo(a,b,c,d){if(null===b||null===a.Me)return null;for(var e=a.Me.iterator;e.next();){var f=e.value;if(f.Mt===a&&f.Wv===b&&f.qy===c&&f.sy===d||f.Mt===b&&f.Wv===a&&f.qy===d&&f.sy===c)return f}return null}t.Yz=function(a,b,c){if(void 0===b||null===b)b="";if(void 0===c||null===c)c="";a=Oo(this,a,b,c);null!==a&&a.pm()};
t.xk=function(a,b,c,d,e,f,g){a===we&&"elements"===b?this.rc=null:a===xe&&"elements"===b&&(this.rc=null);T.prototype.xk.call(this,a,b,c,d,e,f,g)};t.fd=function(a){void 0===a&&(a=null);for(var b=this.linksConnected;b.next();){var c=b.value;null!==a&&a.contains(c)||(Po(this,c.fromPort),Po(this,c.toPort),c.Ta())}};function pl(a,b){for(var c=a.linksConnected;c.next();){var d=c.value;if(d.fromPort===b||d.toPort===b)Po(a,d.fromPort),Po(a,d.toPort),d.Ta()}}
function Po(a,b){null!==b&&(b=b.jp,null!==b&&b.pm(),a=a.containingGroup,null===a||a.isSubGraphExpanded||Po(a,a.port))}t.ej=function(){return!0};V.prototype.getAvoidableRect=function(a){a.set(this.actualBounds);a.iq(this.Kk);return a};V.prototype.findVisibleNode=function(){for(var a=this;null!==a&&!a.isVisible();)a=a.containingGroup;return a};
V.prototype.isVisible=function(){if(!T.prototype.isVisible.call(this))return!1;var a=!0,b=ri,c=this.diagram;if(null!==c){if(c.animationManager.Ot(this))return!0;a=c.isTreePathToChildren;b=c.treeCollapsePolicy}if(b===ri){if(a=this.yg(),null!==a&&!a.isTreeExpanded)return!1}else if(b===Fk){if(a=a?this.Ev():this.Fv(),0<a.count&&a.all(function(a){return!a.isTreeExpanded}))return!1}else if(b===Gk&&(a=a?this.Ev():this.Fv(),0<a.count&&a.any(function(a){return!a.isTreeExpanded})))return!1;a=this.labeledLink;
return null!==a?a.isVisible():!0};V.prototype.Pb=function(a){T.prototype.Pb.call(this,a);for(var b=this.linksConnected;b.next();){var c=b.value;a&&null!==this.containingGroup&&(c.wq(this).yd(this.containingGroup)||c.Ta());c.Pb(a)}};V.prototype.Ux=function(){var a=new F,b=new F;Qo(this,this,a,b);return b.iterator};
function Qo(a,b,c,d){if(!c.has(b)){c.add(b);var e=!0,f=a.diagram;null!==f&&(e=f.isTreePathToChildren);b.linksConnected.each(function(f){f.isTreeLink?(e?f.fromNode===b:f.toNode===b)&&Qo(a,e?f.toNode:f.fromNode,c,d):d.add(f)})}}V.prototype.findLinksConnected=function(a){void 0===a&&(a=null);if(null===a)return this.Xa.iterator;var b=new jb(this.Xa),c=this;b.predicate=function(b){return b.fromNode===c&&b.fromPortId===a||b.toNode===c&&b.toPortId===a};return b};t=V.prototype;
t.rq=function(a){void 0===a&&(a=null);var b=new jb(this.Xa),c=this;b.predicate=function(b){return b.fromNode!==c?!1:null===a?!0:b.fromPortId===a};return b};t.xd=function(a){void 0===a&&(a=null);var b=new jb(this.Xa),c=this;b.predicate=function(b){return b.toNode!==c?!1:null===a?!0:b.toPortId===a};return b};
t.Dv=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.Xa.iterator;d.next();){var e=d.value;if(e.fromNode===this){if(null===a||e.fromPortId===a)e=e.toNode,null!==b?b.add(e):null!==c&&c!==e?(b=new F,b.add(c),b.add(e)):c=e}else e.toNode!==this||null!==a&&e.toPortId!==a||(e=e.fromNode,null!==b?b.add(e):null!==c&&c!==e?(b=new F,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new gb(c):fb};
t.Fv=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.Xa.iterator;d.next();){var e=d.value;e.fromNode!==this||null!==a&&e.fromPortId!==a||(e=e.toNode,null!==b?b.add(e):null!==c&&c!==e?(b=new F,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new gb(c):fb};
t.Ev=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.Xa.iterator;d.next();){var e=d.value;e.toNode!==this||null!==a&&e.toPortId!==a||(e=e.fromNode,null!==b?b.add(e):null!==c&&c!==e?(b=new F,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new gb(c):fb};
t.xz=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);var d=new jb(this.Xa),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.yz=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);var d=new jb(this.Xa),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 Ro(a,b,c){Po(a,c);var d=a.Xa.contains(b);d||a.Xa.add(b);if(!d||b.fromNode===b.toNode){var e=a.linkConnected;if(null!==e){var f=!0,g=a.diagram;null!==g&&(f=g.Z,g.Z=!0);e(a,b,c);null!==g&&(g.Z=f)}}!d&&b.isTreeLink&&(c=b.fromNode,b=b.toNode,null!==c&&null!==b&&c!==b&&(d=!0,a=a.diagram,null!==a&&(d=a.isTreePathToChildren),e=d?b:c,f=d?c:b,e.xh||(e.xh=f),!f.isTreeLeaf||null!==a&&a.undoManager.isUndoingRedoing||(d?c===f&&(f.isTreeLeaf=!1):b===f&&(f.isTreeLeaf=!1))))}
function So(a,b,c){Po(a,c);var d=a.Xa.remove(b),e=null;if(d||b.toNode===b.fromNode){var f=a.linkDisconnected;e=a.diagram;if(null!==f){var g=!0;null!==e&&(g=e.Z,e.Z=!0);f(a,b,c);null!==e&&(e.Z=g)}}d&&b.isTreeLink&&(c=!0,null!==e&&(c=e.isTreePathToChildren),a=c?b.toNode:b.fromNode,b=c?b.fromNode:b.toNode,null!==a&&(a.xh=!1),null===b||b.isTreeLeaf||(0===b.Xa.count?(b.xh=null,null!==e&&e.undoManager.isUndoingRedoing||(b.isTreeLeaf=!0)):Ek(b)))}
function Ek(a){a.xh=!1;if(0!==a.Xa.count){var b=!0,c=a.diagram;if(null===c||!c.undoManager.isUndoingRedoing){null!==c&&(b=c.isTreePathToChildren);for(c=a.Xa.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.yq=function(a){T.prototype.yq.call(this,a);a||(Ek(this),a=this.sl,null!==a&&To(a,this))};t.zq=function(a){T.prototype.zq.call(this,a);a||(a=this.sl,null!==a&&null!==a.bd&&(a.bd.remove(this),a.o()))};
t.fk=function(){if(0<this.Xa.count){var a=this.diagram;if(null!==a)for(var b=null!==a.commandHandler?a.commandHandler.deletesConnectedLinks:!0,c=this.Xa.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;T.prototype.fk.call(this)};t.wt=function(a){if(null===this.rc){if(""===a&&!1===this.Hh)return this;Uo(this)}var b=this.rc.H(a);return null!==b||""!==a&&(b=this.rc.H(""),null!==b)?b:this};
function Uo(a){null===a.rc?a.rc=new H:a.rc.clear();a.Nm(a,function(a,c){Ul(a,c)});0===a.rc.count&&a.rc.add("",a)}function Ul(a,b){var c=b.portId;null!==c&&null!==a.rc&&a.rc.add(c,b)}function Tl(a,b,c){var d=b.portId;if(null!==d&&(null!==a.rc&&a.rc.remove(d),b=a.diagram,null!==b&&c)){c=null;for(a=a.findLinksConnected(d);a.next();)d=a.value,null===c&&(c=Fa()),c.push(d);if(null!==c){for(a=0;a<c.length;a++)b.remove(c[a]);Ha(c)}}}
t.$z=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.Xa.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.Xa.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.Jz=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this;if(a)for(;;){a=null;for(var c=b.Xa.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.Xa.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.uz=function(a){if(null===a)return null;if(this===a)return this;for(var b=this;null!==b;)Eo(b,!0),b=b.yg();var c=null;for(b=a;null!==b;){if(0!==(b.D&1048576)){c=b;break}b=b.yg()}for(b=this;null!==b;)Eo(b,!1),b=b.yg();return c};t.Zi=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this.Xa.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.yg=function(){var a=this.xh;if(null===a)return null;if(a instanceof V)return a;var b=!0;a=this.diagram;null!==a&&(b=a.isTreePathToChildren);a=this.Xa.iterator;if(b)for(;a.next();){if(b=a.value,b.isTreeLink&&(b=b.fromNode,b!==this))return this.xh=b}else for(;a.next();)if(b=a.value,b.isTreeLink&&(b=b.toNode,b!==this))return this.xh=b;return this.xh=null};t.Hz=function(){function a(b,d){if(null!==b){d.add(b);var c=b.Zi();null!==c&&(d.add(c),a(b.yg(),d))}}var b=new F;a(this,b);return b};
t.Gz=function(){return Vo(this,this)};function Vo(a,b){b=b.yg();return null===b?0:1+Vo(a,b)}t.tq=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=new jb(this.Xa);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.Hv=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);var c=b=null,d=this.Xa.iterator;if(a)for(;d.next();)a=d.value,a.isTreeLink&&a.fromNode===this&&(a=a.toNode,null!==b?b.add(a):null!==c&&c!==a?(b=new E,b.add(c),b.add(a)):c=a);else for(;d.next();)a=d.value,a.isTreeLink&&a.toNode===this&&(a=a.fromNode,null!==b?b.add(a):null!==c&&c!==a?(b=new E,b.add(c),b.add(a)):c=a);return null!==b?b.iterator:null!==c?new gb(c):fb};
t.Iz=function(a){void 0===a&&(a=Infinity);var b=new F;Tk(b,this,!1,a,!0);return b};V.prototype.collapseTree=function(a){void 0===a&&(a=1);1>a&&(a=1);var b=this.diagram;if(null!==b&&!b.Fe){b.Fe=!0;var c=new F;c.add(this);Wo(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===ri);b.Fe=!1}};function Wo(a,b,c,d,e,f,g){if(1<d)for(var h=c?a.rq():a.xd();h.next();){var k=h.value;k.isTreeLink&&(k=k.wq(a),null===k||k===a||b.contains(k)||(b.add(k),Wo(k,b,c,d-1,e,f,g)))}else Xo(a,b,c,e,f,g)}
function Xo(a,b,c,d,e,f){for(var g=e===a?!0:a.isTreeExpanded,h=c?a.rq():a.xd();h.next();){var k=h.value;if(k.isTreeLink&&(k=k.wq(a),null!==k&&k!==a)){var l=b.contains(k);l||b.add(k);g&&(f&&d.Wj(k,e),k.Ih(),k.Pb(!1));k.isTreeExpanded&&(k.wasTreeExpanded=k.isTreeExpanded,l||Xo(k,b,c,d,e,f))}}a.isTreeExpanded=!1}
V.prototype.expandTree=function(a){void 0===a&&(a=2);2>a&&(a=2);var b=this.diagram;if(null!==b&&!b.Fe){b.Fe=!0;var c=new F;c.add(this);Yo(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===ri);b.Fe=!1}};
function Yo(a,b,c,d,e,f,g){for(var h=f===a?!1:a.isTreeExpanded,k=c?a.rq():a.xd();k.next();){var l=k.value;l.isTreeLink&&(h||l.ld||l.Ta(),l=l.wq(a),null!==l&&l!==a&&!b.contains(l)&&(b.add(l),h||(l.Pb(!0),l.Ih(),g&&e.Yj(l,f)),2<d||l.wasTreeExpanded))&&(l.wasTreeExpanded=!1,Yo(l,b,c,d-1,e,f,g))}a.isTreeExpanded=!0}
ma.Object.defineProperties(V.prototype,{portSpreading:{get:function(){return this.kp},set:function(a){var b=this.kp;b!==a&&(this.kp=a,this.g("portSpreading",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.fd())}},avoidable:{get:function(){return 0!==(this.P&8)},set:function(a){var b=0!==(this.P&8);if(b!==a){this.P^=8;var c=this.diagram;null!==c&&zk(c,this);this.g("avoidable",b,a)}}},avoidableMargin:{
get:function(){return this.Kk},set:function(a){"number"===typeof a&&(a=new oc(a));var b=this.Kk;if(!b.w(a)){this.Kk=a=a.G();var c=this.diagram;null!==c&&zk(c,this);this.g("avoidableMargin",b,a)}}},linksConnected:{get:function(){return this.Xa.iterator}},linkConnected:{get:function(){return this.to},set:function(a){var b=this.to;b!==a&&(this.to=a,this.g("linkConnected",b,a))}},linkDisconnected:{get:function(){return this.uo},
set:function(a){var b=this.uo;b!==a&&(this.uo=a,this.g("linkDisconnected",b,a))}},linkValidation:{get:function(){return this.zi},set:function(a){var b=this.zi;b!==a&&(this.zi=a,this.g("linkValidation",b,a))}},isLinkLabel:{get:function(){return null!==this.sl}},labeledLink:{get:function(){return this.sl},set:function(a){var b=this.sl;if(b!==a){var c=this.diagram,d=this.data;if(null!==b){null!==b.bd&&(b.bd.remove(this),
b.o());if(null!==c&&null!==d&&!c.undoManager.isUndoingRedoing){var e=b.data,f=c.model;if(null!==e&&f.dj()){var g=f.ja(d);void 0!==g&&f.ty(e,g)}}this.containingGroup=null}this.sl=a;null!==a&&(To(a,this),null===c||null===d||c.undoManager.isUndoingRedoing||(e=a.data,c=c.model,null!==e&&c.dj()&&(d=c.ja(d),void 0!==d&&c.pv(e,d))),this.containingGroup=a.containingGroup);Dl(this);this.g("labeledLink",b,a)}}},port:{get:function(){return this.wt("")}},ports:{
get:function(){null===this.rc&&Uo(this);return this.rc.iteratorValues}},isTreeExpanded:{get:function(){return 0!==(this.P&1)},set:function(a){var b=0!==(this.P&1);if(b!==a){this.P^=1;var c=this.diagram;this.g("isTreeExpanded",b,a);b=this.treeExpandedChanged;if(null!==b){var d=!0;null!==c&&(d=c.Z,c.Z=!0);b(this);null!==c&&(c.Z=d)}null!==c&&c.undoManager.isUndoingRedoing?this.Pb(a):a?this.expandTree():this.collapseTree()}}},wasTreeExpanded:{
get:function(){return 0!==(this.P&2)},set:function(a){var b=0!==(this.P&2);b!==a&&(this.P^=2,this.g("wasTreeExpanded",b,a))}},treeExpandedChanged:{get:function(){return this.aq},set:function(a){var b=this.aq;b!==a&&(this.aq=a,this.g("treeExpandedChanged",b,a))}},isTreeLeaf:{get:function(){return 0!==(this.P&4)},set:function(a){var b=0!==(this.P&4);b!==a&&(this.P^=4,this.g("isTreeLeaf",b,a))}}});V.prototype.expandTree=V.prototype.expandTree;
V.prototype.collapseTree=V.prototype.collapseTree;V.prototype.findTreeParts=V.prototype.Iz;V.prototype.findTreeChildrenNodes=V.prototype.Hv;V.prototype.findTreeChildrenLinks=V.prototype.tq;V.prototype.findTreeLevel=V.prototype.Gz;V.prototype.findTreeParentChain=V.prototype.Hz;V.prototype.findTreeParentNode=V.prototype.yg;V.prototype.findTreeParentLink=V.prototype.Zi;V.prototype.findCommonTreeParent=V.prototype.uz;V.prototype.findTreeRoot=V.prototype.Jz;V.prototype.isInTreeOf=V.prototype.$z;
V.prototype.findPort=V.prototype.wt;V.prototype.findLinksTo=V.prototype.yz;V.prototype.findLinksBetween=V.prototype.xz;V.prototype.findNodesInto=V.prototype.Ev;V.prototype.findNodesOutOf=V.prototype.Fv;V.prototype.findNodesConnected=V.prototype.Dv;V.prototype.findLinksInto=V.prototype.xd;V.prototype.findLinksOutOf=V.prototype.rq;V.prototype.findExternalTreeLinksConnected=V.prototype.Ux;V.prototype.invalidateConnectedLinks=V.prototype.fd;V.prototype.invalidateLinkBundle=V.prototype.Yz;
var Zo=new D(V,"SpreadingNone",10),Mo=new D(V,"SpreadingEvenly",11),$o=new D(V,"SpreadingPacked",12);V.className="Node";V.SpreadingNone=Zo;V.SpreadingEvenly=Mo;V.SpreadingPacked=$o;function uf(a){V.call(this,a);this.P|=4608;this.Eo=new F;this.Al=new F;this.Ra=this.Sp=this.Ai=this.Fo=this.Do=null;this.ic=new Fi;this.ic.group=this}la(uf,V);
uf.prototype.cloneProtected=function(a){V.prototype.cloneProtected.call(this,a);this.P=this.P&-32769;a.Do=this.Do;a.Fo=this.Fo;a.Ai=this.Ai;a.Sp=this.Sp;var b=a.jm(function(a){return a instanceof vg});b instanceof vg?a.Ra=b:a.Ra=null;null!==this.ic?(a.ic=this.ic.copy(),a.ic.group=a):(null!==a.ic&&(a.ic.group=null),a.ic=null)};t=uf.prototype;
t.sf=function(a){V.prototype.sf.call(this,a);var b=a.ik();for(a=a.memberParts;a.next();){var c=a.value;c.o();c.C(8);c.$j();if(c instanceof V)c.fd(b);else if(c instanceof S)for(c=c.labelNodes;c.next();)c.value.fd(b)}};
t.xk=function(a,b,c,d,e,f,g){if(a===we&&"elements"===b)if(e instanceof vg)null===this.Ra?this.Ra=e:this.Ra!==e&&B("Cannot insert a second Placeholder into the visual tree of a Group.");else{if(e instanceof X){var h=e.jm(function(a){return a instanceof vg});h instanceof vg&&(null===this.Ra?this.Ra=h:this.Ra!==h&&B("Cannot insert a second Placeholder into the visual tree of a Group."))}}else a===xe&&"elements"===b&&null!==this.Ra&&(d===this.Ra?this.Ra=null:d instanceof X&&this.Ra.zg(d)&&(this.Ra=null));
V.prototype.xk.call(this,a,b,c,d,e,f,g)};t.Ch=function(a,b,c,d){this.Xe=this.Ra;V.prototype.Ch.call(this,a,b,c,d)};t.Ab=function(){this.memberParts.each(function(a){a.Ab()});V.prototype.Ab.call(this)};t.ej=function(){if(!V.prototype.ej.call(this))return!1;for(var a=this.memberParts;a.next();){var b=a.value;if(b instanceof V){if(b.isVisible()&&uj(b))return!1}else if(b instanceof S&&b.isVisible()&&uj(b)&&b.fromNode!==this&&b.toNode!==this)return!1}return!0};
function Fo(a,b){if(a.Eo.add(b)){b instanceof uf&&a.Al.add(b);var c=a.memberAdded;if(null!==c){var d=!0,e=a.diagram;null!==e&&(d=e.Z,e.Z=!0);c(a,b);null!==e&&(e.Z=d)}a.isVisible()&&a.isSubGraphExpanded||b.Pb(!1)}b instanceof S&&!a.computesBoundsIncludingLinks||(b=a.Ra,null===b&&(b=a),b.o())}
function Go(a,b){if(a.Eo.remove(b)){b instanceof uf&&a.Al.remove(b);var c=a.memberRemoved;if(null!==c){var d=!0,e=a.diagram;null!==e&&(d=e.Z,e.Z=!0);c(a,b);null!==e&&(e.Z=d)}a.isVisible()&&a.isSubGraphExpanded||b.Pb(!0)}b instanceof S&&!a.computesBoundsIncludingLinks||(b=a.Ra,null===b&&(b=a),b.o())}t.fk=function(){if(0<this.Eo.count){var a=this.diagram;if(null!==a)for(var b=this.Eo.copy().iterator;b.next();)a.remove(b.value)}V.prototype.fk.call(this)};
uf.prototype.canAddMembers=function(a){var b=this.diagram;if(null===b)return!1;b=b.commandHandler;for(a=Vk(a).iterator;a.next();)if(!b.isValidMember(this,a.value))return!1;return!0};uf.prototype.addMembers=function(a,b){var c=this.diagram;if(null===c)return!1;c=c.commandHandler;var d=!0;for(a=Vk(a).iterator;a.next();){var e=a.value;!b||c.isValidMember(this,e)?e.containingGroup=this:d=!1}return d};
uf.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=uf.prototype;
t.fd=function(a){void 0===a&&(a=null);var b=0!==(this.P&65536);V.prototype.fd.call(this,a);if(!b)for(0!==(this.P&65536)!==!0&&(this.P=this.P^65536),b=this.Cv();b.next();){var c=b.value;if(null===a||!a.contains(c)){var d=c.fromNode;null!==d&&d!==this&&d.yd(this)&&!d.isVisible()?(Po(d,c.fromPort),Po(d,c.toPort),c.Ta()):(d=c.toNode,null!==d&&d!==this&&d.yd(this)&&!d.isVisible()&&(Po(d,c.fromPort),Po(d,c.toPort),c.Ta()))}}};
t.Cv=function(){var a=this.ik();a.add(this);for(var b=new F,c=a.iterator;c.next();){var d=c.value;if(d instanceof V)for(d=d.linksConnected;d.next();){var e=d.value;a.contains(e)||b.add(e)}}return b.iterator};t.wz=function(){var a=this.ik();a.add(this);for(var b=new F,c=a.iterator;c.next();){var d=c.value;if(d instanceof V)for(d=d.linksConnected;d.next();){var e=d.value,f=e.fromNode;a.contains(f)&&f!==this||b.add(f);e=e.toNode;a.contains(e)&&e!==this||b.add(e)}}return b.iterator};
t.vz=function(){function a(b,d){null!==b&&(d.add(b),a(b.containingGroup,d))}var b=new F;a(this,b);return b};t.ik=function(){var a=new F;Tk(a,this,!0,0,!0);a.remove(this);return a};t.Pb=function(a){V.prototype.Pb.call(this,a);for(var b=this.memberParts;b.next();)b.value.Pb(a)};uf.prototype.collapseSubGraph=function(){var a=this.diagram;if(null!==a&&!a.Fe){a.Fe=!0;var b=this.ik();ap(this,b,a,this);a.Fe=!1}};
function ap(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Pb(!1);f instanceof uf&&f.isSubGraphExpanded&&(f.wasSubGraphExpanded=f.isSubGraphExpanded,ap(f,b,c,d));if(f instanceof V)f.fd(b),c.Wj(f,d);else if(f instanceof S)for(f=f.labelNodes;f.next();)f.value.fd(b)}a.isSubGraphExpanded=!1}uf.prototype.expandSubGraph=function(){var a=this.diagram;if(null!==a&&!a.Fe){a.Fe=!0;var b=this.ik();bp(this,b,a,this);a.Fe=!1}};
function bp(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Pb(!0);f instanceof uf&&f.wasSubGraphExpanded&&(f.wasSubGraphExpanded=!1,bp(f,b,c,d));if(f instanceof V)f.fd(b),c.Yj(f,d);else if(f instanceof S)for(f=f.labelNodes;f.next();)f.value.fd(b)}a.isSubGraphExpanded=!0}
uf.prototype.move=function(a,b){void 0===b&&(b=!1);var c=b?this.location:this.position,d=c.x;c=c.y;var e=a.x,f=a.y;if(!(d===e||isNaN(d)&&isNaN(e))||!(c===f||isNaN(c)&&isNaN(f))){d=e-(isNaN(d)?0:d);c=f-(isNaN(c)?0:c);f=I.alloc();V.prototype.move.call(this,a,b);a=new F;for(b=this.ik().iterator;b.next();)if(e=b.value,e instanceof S&&(e.suspendsRouting&&a.add(e),e.ld||e.fromNode!==this&&e.toNode!==this))e.suspendsRouting=!0;for(b.reset();b.next();)if(e=b.value,!(e.Jh()||e instanceof V&&e.isLinkLabel)){var g=
e.position,h=e.location;g.v()?(f.x=g.x+d,f.y=g.y+c,e.position=f):h.v()&&(f.x=h.x+d,f.y=h.y+c,e.location=f)}for(b.reset();b.next();)if(e=b.value,e instanceof S&&(e.suspendsRouting=a.contains(e),e.ld||e.fromNode!==this&&e.toNode!==this))g=e.position,f.x=g.x+d,f.y=g.y+c,f.v()?e.move(f):e.Ta(),Rj(e)&&e.Ta();I.free(f)}};
ma.Object.defineProperties(uf.prototype,{placeholder:{get:function(){return this.Ra}},computesBoundsAfterDrag:{get:function(){return 0!==(this.P&2048)},set:function(a){var b=0!==(this.P&2048);b!==a&&(this.P^=2048,this.g("computesBoundsAfterDrag",b,a))}},computesBoundsIncludingLinks:{get:function(){return 0!==(this.P&4096)},set:function(a){var b=0!==(this.P&4096);b!==a&&(this.P^=4096,this.g("computesBoundsIncludingLinks",
b,a))}},computesBoundsIncludingLocation:{get:function(){return 0!==(this.P&8192)},set:function(a){var b=0!==(this.P&8192);b!==a&&(this.P^=8192,this.g("computesBoundsIncludingLocation",b,a))}},handlesDragDropForMembers:{get:function(){return 0!==(this.P&16384)},set:function(a){var b=0!==(this.P&16384);b!==a&&(this.P^=16384,this.g("handlesDragDropForMembers",b,a))}},memberParts:{get:function(){return this.Eo.iterator}},
layout:{get:function(){return this.ic},set:function(a){var b=this.ic;if(b!==a){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.Hg=!0);this.g("layout",b,a);null!==c&&c.Bb()}}},memberAdded:{get:function(){return this.Do},set:function(a){var b=this.Do;b!==a&&(this.Do=a,this.g("memberAdded",b,a))}},memberRemoved:{get:function(){return this.Fo},
set:function(a){var b=this.Fo;b!==a&&(this.Fo=a,this.g("memberRemoved",b,a))}},memberValidation:{get:function(){return this.Ai},set:function(a){var b=this.Ai;b!==a&&(this.Ai=a,this.g("memberValidation",b,a))}},ungroupable:{get:function(){return 0!==(this.P&256)},set:function(a){var b=0!==(this.P&256);b!==a&&(this.P^=256,this.g("ungroupable",b,a))}},isSubGraphExpanded:{get:function(){return 0!==(this.P&512)},
set:function(a){var b=0!==(this.P&512);if(b!==a){this.P^=512;var c=this.diagram;this.g("isSubGraphExpanded",b,a);b=this.subGraphExpandedChanged;if(null!==b){var d=!0;null!==c&&(d=c.Z,c.Z=!0);b(this);null!==c&&(c.Z=d)}null!==c&&c.undoManager.isUndoingRedoing?(null!==this.Ra&&this.Ra.o(),this.memberParts.each(function(a){a.updateAdornments()})):a?this.expandSubGraph():this.collapseSubGraph()}}},wasSubGraphExpanded:{get:function(){return 0!==(this.P&1024)},set:function(a){var b=
0!==(this.P&1024);b!==a&&(this.P^=1024,this.g("wasSubGraphExpanded",b,a))}},subGraphExpandedChanged:{get:function(){return this.Sp},set:function(a){var b=this.Sp;b!==a&&(this.Sp=a,this.g("subGraphExpandedChanged",b,a))}},wk:{get:function(){return 0!==(this.P&32768)},set:function(a){0!==(this.P&32768)!==a&&(this.P^=32768)}}});uf.prototype.expandSubGraph=uf.prototype.expandSubGraph;uf.prototype.collapseSubGraph=uf.prototype.collapseSubGraph;
uf.prototype.findSubGraphParts=uf.prototype.ik;uf.prototype.findContainingGroupChain=uf.prototype.vz;uf.prototype.findExternalNodesConnected=uf.prototype.wz;uf.prototype.findExternalLinksConnected=uf.prototype.Cv;uf.prototype.ensureBounds=uf.prototype.Ab;uf.className="Group";function vg(){Y.call(this);this.fb=sc;this.zp=new N(NaN,NaN,NaN,NaN)}la(vg,Y);vg.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.fb=this.fb.G();a.zp=this.zp.copy()};
vg.prototype.Eh=function(a){if(null===this.background&&null===this.areaBackground)return!1;var b=this.naturalBounds;return fc(0,0,b.width,b.height,a.x,a.y)};
vg.prototype.tm=function(){var a=this.part;null!==a&&(a instanceof uf||a instanceof Ke)||B("Placeholder is not inside a Group or Adornment.");if(a instanceof uf){var b=this.computeBorder(this.zp),c=this.minSize,d=this.pc;Vb(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);il(this,0,0,d.width,d.height);d=a.memberParts;for(c=!1;d.next();)if(d.value.isVisible()){c=!0;break}d=a.diagram;!c||null===d||d.animationManager.Qv(a)||isNaN(b.x)||
isNaN(b.y)||(c=I.alloc(),c.gj(b,a.locationSpot),c.w(a.location)||(a.location=new I(c.x,c.y)),I.free(c))}else{b=this.pc;c=this.fb;d=c.left+c.right;var e=c.top+c.bottom,f=a.adornedObject;a.angle=f.aj();var g=0;f instanceof W&&(g=f.strokeWidth);var h=f.uf(),k=f.naturalBounds,l=(k.width+g)*h;g=(k.height+g)*h;a.type!==X.Link&&(f=f.ga("Selection"===a.category?vc:a.locationSpot,I.alloc()),a.location=f,I.free(f));isNaN(l)||isNaN(g)?(a=a.adornedObject,l=a.ga(vc,I.alloc()),f=N.allocAt(l.x,l.y,0,0),f.Ie(a.ga(Gc,
l)),f.Ie(a.ga(yc,l)),f.Ie(a.ga(Cc,l)),Vb(b,f.width+d||0,f.height+e||0),il(this,-c.left,-c.top,b.width,b.height),I.free(l),N.free(f)):(Vb(b,l+d||0,g+e||0),il(this,-c.left,-c.top,b.width,b.height))}};vg.prototype.Ch=function(a,b,c,d){this.actualBounds.h(a,b,c,d)};
vg.prototype.computeBorder=function(a){var b=this.part,c=b.diagram;if(null!==c&&b instanceof uf&&!b.layer.isTemporary&&b.computesBoundsAfterDrag&&this.zp.v()){var d=c.toolManager.findTool("Dragging");if(d===c.currentTool&&(c=d.computeBorder(b,this.zp,a),null!==c))return c}c=N.alloc();d=this.computeMemberBounds(c);var e=this.fb;b instanceof uf&&!b.isSubGraphExpanded?a.h(d.x-e.left,d.y-e.top,0,0):a.h(d.x-e.left,d.y-e.top,Math.max(d.width+e.left+e.right,0),Math.max(d.height+e.top+e.bottom,0));N.free(c);
b instanceof uf&&b.computesBoundsIncludingLocation&&b.location.v()&&a.Ie(b.location);return a};
vg.prototype.computeMemberBounds=function(a){if(!(this.part instanceof uf))return a.h(0,0,0,0),a;for(var b=this.part,c=Infinity,d=Infinity,e=-Infinity,f=-Infinity,g=b.memberParts;g.next();){var h=g.value;if(h.isVisible()){if(h instanceof S){if(!b.computesBoundsIncludingLinks)continue;if(tj(h))continue;if(h.fromNode===b||h.toNode===b)continue}h=h.actualBounds;h.left<c&&(c=h.left);h.top<d&&(d=h.top);h.right>e&&(e=h.right);h.bottom>f&&(f=h.bottom)}}isFinite(c)&&isFinite(d)?a.h(c,d,e-c,f-d):(b=b.location,
a.h(b.x,b.y,0,0));return a};ma.Object.defineProperties(vg.prototype,{padding:{get:function(){return this.fb},set:function(a){"number"===typeof a&&(a=new oc(a));var b=this.fb;b.w(a)||(this.fb=a=a.G(),this.g("padding",b,a),this.o())}}});vg.className="Placeholder";
function S(){T.call(this,X.Link);this.Pa=8;this.Qe=null;this.Re="";this.lf=this.Rn=null;this.mf="";this.$p=null;this.Fk=ag;this.tn=0;this.vn=ag;this.wn=NaN;this.Oj=cp;this.Np=.5;this.bd=null;this.yb=(new E).freeze();this.lh=this.gh=null;this.Fl=new N;this.ka=new sd;this.co=!0;this.I=this.u=this.Hf=this.Qf=null;this.l=[];this.hv=new I;this.Pr=this.xx=this.wx=null;this.Cu=NaN;this.O=null}la(S,T);
S.prototype.cloneProtected=function(a){T.prototype.cloneProtected.call(this,a);a.Pa=this.Pa&-113;a.Re=this.Re;a.Rn=this.Rn;a.mf=this.mf;a.$p=this.$p;a.Fk=this.Fk;a.tn=this.tn;a.vn=this.vn;a.wn=this.wn;a.Oj=this.Oj;a.Np=this.Np;null!==this.O&&(a.O=this.O.copy())};t=S.prototype;t.sf=function(a){T.prototype.sf.call(this,a);this.Re=a.Re;this.mf=a.mf;a.gh=null;a.Ta();a.Hf=this.Hf;var b=a.fromPort;null!==b&&Po(a.fromNode,b);b=a.toPort;null!==b&&Po(a.toNode,b)};
t.gb=function(a){a.classType===S?2===(a.value&2)?this.routing=a:a===dg||a===$f||a===Zf?this.curve=a:a===dp||a===ep||a===fp?this.adjusting=a:a!==cp&&a!==ag&&B("Unknown Link enum value for a Link property: "+a):T.prototype.gb.call(this,a)};t.Gc=function(){null===this.O&&(this.O=new el)};t.ej=function(){var a=this.fromNode;if(null!==a){var b=a.findVisibleNode();null!==b&&(a=b);if(uj(a)||vj(a))return!1}a=this.toNode;return null!==a&&(b=a.findVisibleNode(),null!==b&&(a=b),uj(a)||vj(a))?!1:!0};t.qw=function(){return!1};
t.Zt=function(){};t.Wb=function(){return!1};S.prototype.computeAngle=function(a,b,c){return S.computeAngle(b,c)};S.computeAngle=function(a,b){switch(a){default:case ag:a=0;break;case Vm:a=b;break;case Om:a=b+90;break;case Qm:a=b-90;break;case gp:a=b+180;break;case Wm:a=K.Hq(b);90<a&&270>a&&(a-=180);break;case Pm:a=K.Hq(b+90);90<a&&270>a&&(a-=180);break;case Rm:a=K.Hq(b-90);90<a&&270>a&&(a-=180);break;case Sm:a=K.Hq(b);if(45<a&&135>a||225<a&&315>a)return 0;90<a&&270>a&&(a-=180)}return K.Hq(a)};
function Lo(a){var b=a.fromNode,c=a.toNode,d=null;null!==b?d=null!==c?b.Tx(c):b.containingGroup:null!==c?d=c.containingGroup:d=null;b=d;c=a.fi;if(c!==b){null!==c&&Go(c,a);a.fi=b;null!==b&&Fo(b,a);var e=a.containingGroupChanged;if(null!==e){var f=!0,g=a.diagram;null!==g&&(f=g.Z,g.Z=!0);e(a,c,b);null!==g&&(g.Z=f)}!a.ld||a.wx!==c&&a.xx!==c||a.Ta()}if(a.isLabeledLink)for(a=a.labelNodes;a.next();)a.value.containingGroup=d}t=S.prototype;
t.Ih=function(){var a=this.containingGroup;null!==a&&this.fromNode!==a&&this.toNode!==a&&a.computesBoundsIncludingLinks&&T.prototype.Ih.call(this)};t.wq=function(a){var b=this.fromNode;return a===b?this.toNode:b};t.Oz=function(a){var b=this.fromPort;return a===b?this.toPort:b};function To(a,b){null===a.bd&&(a.bd=new F);a.bd.add(b);a.o()}
t.yq=function(a){T.prototype.yq.call(this,a);hp(this)&&this.Bq(this.actualBounds);if(!a){a=this.Qe;var b=null;null!==a&&(b=this.fromPort,Ro(a,this,b));var c=this.lf;if(null!==c){var d=this.toPort;c===a&&d===b||Ro(c,this,d)}ip(this)}};t.zq=function(a){T.prototype.zq.call(this,a);hp(this)&&this.Bq(this.actualBounds);if(!a){a=this.Qe;var b=null;null!==a&&(b=this.fromPort,So(a,this,b));var c=this.lf;if(null!==c){var d=this.toPort;c===a&&d===b||So(c,this,d)}jp(this)}};
t.fk=function(){this.ld=!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))};S.prototype.updateRelationshipsFromData=function(){if(null!==this.data){var a=this.diagram;null!==a&&a.partManager.updateRelationshipsFromData(this)}};
S.prototype.move=function(a,b){var c=b?this.location:this.position,d=c.x;isNaN(d)&&(d=0);var e=c.y;isNaN(e)&&(e=0);d=a.x-d;e=a.y-e;!0===b?T.prototype.move.call(this,a,!1):(a=I.allocAt(c.x+d,c.y+e),T.prototype.move.call(this,a,!1),I.free(a));pf(this,d,e);for(a=this.labelNodes;a.next();)b=a.value,c=b.position,b.moveTo(c.x+d,c.y+e)};
S.prototype.canRelinkFrom=function(){if(!this.relinkableFrom)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowRelink)return!1;a=a.diagram;return null===a||a.allowRelink?!0:!1};S.prototype.canRelinkTo=function(){if(!this.relinkableTo)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowRelink)return!1;a=a.diagram;return null===a||a.allowRelink?!0:!1};
S.prototype.computeMidPoint=function(a){var b=this.pointsCount;if(0===b)return a.assign(Kb),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()===dg))return this.ka.Iv(.5,a),a.add(this.i(0)),c=this.ka.figures.first(),a.offset(-c.startX,-c.startY),a;if(this.computeCurve()===dg){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.az(d.x,d.y,e.x,e.y,f.x,f.y,c.x,c.y,a)}else a.assign(this.i(c));return a}var g=this.flattenedLengths;c=this.flattenedTotalLength;for(e=f=d=0;d<c/2&&f<b;){e=g[f];if(d+e>c/2)break;d+=e;f++}b=this.i(f);f=this.i(f+1);1>Math.abs(b.x-f.x)?b.y>f.y?a.h(b.x,b.y-(c/2-d)):a.h(b.x,b.y+(c/2-d)):1>Math.abs(b.y-f.y)?b.x>f.x?a.h(b.x-(c/2-d),b.y):a.h(b.x+(c/2-d),b.y):(c=(c/2-d)/e,a.h(b.x+c*(f.x-b.x),b.y+c*(f.y-b.y)));return a};
S.prototype.computeMidAngle=function(){var a=this.pointsCount;if(2>a)return NaN;if(2===a)return this.i(0).Sa(this.i(1));if(this.isOrthogonal&&(15<=this.computeCorner()||this.computeCurve()===dg))return this.ka.Zx(.5);if(this.computeCurve()===dg&&4<=a){var b=(a-1)/3|0,c=3*(b/2|0);if(1===b%2){c=Math.floor(c);a=this.i(c);b=this.i(c+1);var d=this.i(c+2);c=this.i(c+3);return K.$y(a.x,a.y,b.x,b.y,d.x,d.y,c.x,c.y)}if(0<c&&c+1<a)return this.i(c-1).Sa(this.i(c+1))}b=this.flattenedLengths;d=this.flattenedTotalLength;
var e=0;c=0;for(var f;e<d/2&&c<a;){f=b[c];if(e+f>d/2)break;e+=f;c++}b=this.i(c);d=this.i(c+1);if(1>Math.abs(b.x-d.x)&&1>Math.abs(b.y-d.y)){if(0<c&&c+2<a)return this.i(c-1).Sa(this.i(c+2))}else{if(1>Math.abs(b.x-d.x))return b.y>d.y?270:90;if(1>Math.abs(b.y-d.y))return b.x>d.x?180:0}return b.Sa(d)};t=S.prototype;t.i=function(a){return this.yb.j[a]};t.jd=function(a,b){this.yb.hd(a,b)};t.K=function(a,b,c){this.yb.hd(a,new I(b,c))};t.Wz=function(a,b){this.yb.ub(a,b)};
t.m=function(a,b,c){this.yb.ub(a,new I(b,c))};t.Ae=function(a){this.yb.add(a)};t.qf=function(a,b){this.yb.add(new I(a,b))};t.gw=function(a){this.yb.ab(a)};t.ak=function(){this.yb.clear()};
function pf(a,b,c){if(0!==b||0!==c){for(var d=a.ld,e=new E,f=a.yb.iterator;f.next();){var g=f.value;e.add((new I(g.x+b,g.y+c)).freeze())}e.freeze();f=a.yb;a.yb=e;g=a.diagram;isNaN(b)||isNaN(c)||null!==g&&g.animationManager.qc?a.o():(a.$f.h(a.$f.x+b,a.$f.y+c),a.ma.h(a.ma.x+b,a.ma.y+c),Dl(a));d&&kp(a);null!==g&&g.animationManager.qc&&(a.lh=e);a.g("points",f,e)}}t.Mh=function(){null===this.gh&&(this.gh=this.yb,this.yb=this.yb.copy())};
t.rf=function(){if(null!==this.gh){for(var a=this.gh,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.o();this.cc();break}}else this.o(),this.cc();this.gh=null;c=this.diagram;null!==c&&c.animationManager.qc&&(this.lh=b);kp(this);this.g("points",
a,b)}};t.vy=function(){null!==this.gh&&(this.yb=this.gh,this.gh=null)};function kp(a){0===a.yb.count?a.ld=!1:(a.ld=!0,a.Pr=null,a.Cu=NaN,a.defaultFromPoint=a.i(0),a.defaultToPoint=a.i(a.pointsCount-1),lp(a,!1))}
t.Ta=function(){if(!this.suspendsRouting){var a=this.diagram;if(a){if(a.Jt.contains(this)||a.undoManager.isUndoingRedoing)return;a=a.animationManager;if(a.isTicking&&!a.isAnimating)return;null!==this.lh&&!a.isTicking&&a.isAnimating&&(this.lh=null)}a=this.path;null!==a&&(this.ld=!1,this.o(),a.o())}};t.kj=function(){if(!this.ld&&!this.vv){var a=!0;try{this.vv=!0,this.Mh(),a=this.computePoints()}finally{this.vv=!1,a?this.rf():this.vy()}}};
S.prototype.computePoints=function(){var a=this.diagram;if(null===a)return!1;var b=this.fromNode,c=null;null===b?(a.jh||(a.Hl=new W,a.Hl.desiredSize=Lb,a.Hl.strokeWidth=0,a.jh=new V,a.jh.add(a.Hl),a.jh.Ab()),this.defaultFromPoint&&(a.jh.position=a.jh.location=this.defaultFromPoint,a.jh.Ab(),b=a.jh,c=a.Hl)):c=this.fromPort;if(null!==c&&!b.isVisible()){var d=b.findVisibleNode();null!==d&&d!==b?(b=d,c=d.port):b=d}this.wx=b;if(null===b||!b.location.v())return!1;for(;!(null===c||c.actualBounds.v()&&c.zf());)c=
c.panel;if(null===c)return!1;var e=this.toNode,f=null;null===e?(a.kh||(a.Il=new W,a.Il.desiredSize=Lb,a.Il.strokeWidth=0,a.kh=new V,a.kh.add(a.Il),a.kh.Ab()),this.defaultToPoint&&(a.kh.position=a.kh.location=this.defaultToPoint,a.kh.Ab(),e=a.kh,f=a.Il)):f=this.toPort;null===f||e.isVisible()||(a=e.findVisibleNode(),null!==a&&a!==e?(e=a,f=a.port):e=a);this.xx=e;if(null===e||!e.location.v())return!1;for(;!(null===f||f.actualBounds.v()&&f.zf());)f=f.panel;if(null===f)return!1;var g=this.pointsCount;d=
this.computeSpot(!0,c);a=this.computeSpot(!1,f);var h=mp(d),k=mp(a),l=c===f&&null!==c,m=this.isOrthogonal,n=this.curve===dg;this.Qf=l&&!m?n=!0:!1;var p=this.computeAdjusting()===ag||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.ak(),n){g=this.getLinkPoint(b,c,d,!0,!1,e,f);p=this.getLinkPoint(e,
f,a,!1,!1,b,c);h=p.x-g.x;k=p.y-g.y;l=this.computeCurviness();n=m=0;var r=g.x+h/3,q=g.y+k/3,u=r,v=q;K.A(k,0)?v=0<h?v-l:v+l:(m=-h/k,n=Math.sqrt(l*l/(m*m+1)),0>l&&(n=-n),u=(0>k?-1:1)*n+r,v=m*(u-r)+q);r=g.x+2*h/3;q=g.y+2*k/3;var w=r,y=q;K.A(k,0)?y=0<h?y-l:y+l:(w=(0>k?-1:1)*n+r,y=m*(w-r)+q);this.ak();this.Ae(g);this.qf(u,v);this.qf(w,y);this.Ae(p);this.jd(0,this.getLinkPoint(b,c,d,!0,!1,e,f));this.jd(3,this.getLinkPoint(e,f,a,!1,!1,b,c))}else d=this.getLinkPoint(b,c,d,!0,!1,e,f),a=this.getLinkPoint(e,
f,a,!1,!1,b,c),this.hasCurviness()?(p=a.x-d.x,e=a.y-d.y,f=this.computeCurviness(),b=d.x+p/2,c=d.y+e/2,g=b,h=c,K.A(e,0)?h=0<p?h-f:h+f:(p=-p/e,g=Math.sqrt(f*f/(p*p+1)),0>f&&(g=-g),g=(0>e?-1:1)*g+b,h=p*(g-b)+c),this.Ae(d),this.qf(g,h)):this.Ae(d),this.Ae(a)}else{n=this.isAvoiding;p&&(m&&n||l)&&this.ak();var z=l?this.computeCurviness():0;n=this.getLinkPoint(b,c,d,!0,m,e,f);r=u=q=0;if(m||!h||l)v=this.computeEndSegmentLength(b,c,d,!0),r=this.getLinkDirection(b,c,n,d,!0,m,e,f),l&&(h||d.w(a)||!m&&1===d.x+
a.x&&1===d.y+a.y)&&(r-=m?90:30,0>z&&(r-=180)),0>r?r+=360:360<=r&&(r-=360),l&&(v+=Math.abs(z)*(m?1:2)),0===r?q=v:90===r?u=v:180===r?q=-v:270===r?u=-v:(q=v*Math.cos(r*Math.PI/180),u=v*Math.sin(r*Math.PI/180)),d.kc()&&l&&(v=c.ga(Ac,I.alloc()),w=I.allocAt(v.x+1E3*q,v.y+1E3*u),this.getLinkPointFromPoint(b,c,v,w,!0,n),I.free(v),I.free(w));v=this.getLinkPoint(e,f,a,!1,m,b,c);var A=y=w=0;if(m||!k||l){var C=this.computeEndSegmentLength(e,f,a,!1);A=this.getLinkDirection(e,f,v,a,!1,m,b,c);l&&(k||d.w(a)||!m&&
1===d.x+a.x&&1===d.y+a.y)&&(A+=m?0:30,0>z&&(A+=180));0>A?A+=360:360<=A&&(A-=360);l&&(C+=Math.abs(z)*(m?1:2));0===A?w=C:90===A?y=C:180===A?w=-C:270===A?y=-C:(w=C*Math.cos(A*Math.PI/180),y=C*Math.sin(A*Math.PI/180));a.kc()&&l&&(a=f.ga(Ac,I.alloc()),d=I.allocAt(a.x+1E3*w,a.y+1E3*y),this.getLinkPointFromPoint(e,f,a,d,!1,v),I.free(a),I.free(d))}a=n;if(m||!h||l)a=new I(n.x+q,n.y+u);d=v;if(m||!k||l)d=new I(v.x+w,v.y+y);!p&&!m&&h&&3<g&&this.adjustPoints(0,n,g-2,d)?this.jd(g-1,v):!p&&!m&&k&&3<g&&this.adjustPoints(1,
a,g-1,v)?this.jd(0,n):!p&&(m?6<=g:4<g)&&this.adjustPoints(1,a,g-2,d)?(this.jd(0,n),this.jd(g-1,v)):(this.ak(),this.Ae(n),(m||!h||l)&&this.Ae(a),m&&this.addOrthoPoints(a,r,d,A,b,e),(m||!k||l)&&this.Ae(d),this.Ae(v))}return!0};function np(a,b){Math.abs(b.x-a.x)>Math.abs(b.y-a.y)?(b.x>=a.x?b.x=a.x+9E9:b.x=a.x-9E9,b.y=a.y):(b.y>=a.y?b.y=a.y+9E9:b.y=a.y-9E9,b.x=a.x);return b}
S.prototype.getLinkPointFromPoint=function(a,b,c,d,e,f){void 0===f&&(f=new I);if(null===a||null===b)return f.assign(c),f;a.isVisible()||(e=a.findVisibleNode(),null!==e&&e!==a&&(b=e.port));a=null;e=b.panel;null===e||e.ce()||(e=e.panel);if(null===e){e=d.x;d=d.y;var g=c.x;c=c.y}else{a=e.wd;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.jk(e,d,g,c,f);null!==
a&&f.transform(a);return f};function op(a,b){var c=b.jp;null===c&&(c=new pp,c.port=b,c.node=b.part,b.jp=c);return qp(c,a)}
S.prototype.getLinkPoint=function(a,b,c,d,e,f,g,h){void 0===h&&(h=new I);if(c.hb()&&!mp(c))return b.ga(c,h),h;if(c.gd()){var k=op(this,b);if(null!==k){h.assign(k.Eq);if(e&&this.routing===rp){var l=op(this,g);if(null!==l&&k.gm<l.gm){k=I.alloc();l=I.alloc();var m=new N(b.ga(vc,k),b.ga(Gc,l)),n=this.computeSpot(!d,g);a=this.getLinkPoint(f,g,n,!d,e,a,b,l);(c.xf(Ic)||c.xf(Jc))&&a.y>=m.y&&a.y<=m.y+m.height?h.y=a.y:(c.xf(Hc)||c.xf(Kc))&&a.x>=m.x&&a.x<=m.x+m.width&&(h.x=a.x);I.free(k);I.free(l)}}return h}}c=
b.ga(.5===c.x&&.5===c.y?c:Ac,I.alloc());this.pointsCount>(e?6:2)?(g=d?this.i(1):this.i(this.pointsCount-2),e&&(g=np(c,g.copy()))):(k=this.computeSpot(!d,g),f=I.alloc(),g=g.ga(.5===k.x&&.5===k.y?k:Ac,f),e&&(g=np(c,g)),I.free(f));this.getLinkPointFromPoint(a,b,c,g,d,h);I.free(c);return h};
S.prototype.getLinkDirection=function(a,b,c,d,e,f,g,h){a:if(d.hb())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.gd()&&(k=op(this,b),null!==k))switch(k.zc){case 1:k=270;break a;case 2:k=180;break a;default:case 4:k=0;break a;case 8:k=90;break a}k=b.ga(Ac,I.alloc());this.pointsCount>(f?6:2)?(h=e?this.i(1):this.i(this.pointsCount-2),h=f?np(k,h.copy()):c):(c=I.alloc(),h=h.ga(Ac,c),I.free(c));c=Math.abs(h.x-k.x)>Math.abs(h.y-k.y)?h.x>=
k.x?0:180:h.y>=k.y?90:270;I.free(k);k=c}d.kc()&&g.yd(a)&&(k+=180,360<=k&&(k-=360));if(mp(d))return k;a=b.aj();if(0===a)return k;45<=a&&135>a?k+=90:135<=a&&225>a?k+=180:225<=a&&315>a&&(k+=270);360<=k&&(k-=360);return k};S.prototype.computeEndSegmentLength=function(a,b,c,d){if(null!==b&&c.gd()&&(a=op(this,b),null!==a))return a.Av;a=d?this.fromEndSegmentLength:this.toEndSegmentLength;null!==b&&isNaN(a)&&(a=d?b.fromEndSegmentLength:b.toEndSegmentLength);isNaN(a)&&(a=10);return a};
S.prototype.computeSpot=function(a,b){void 0===b&&(b=null);a?(a=b?b:this.fromPort,null===a?a=Ac:(b=this.fromSpot,b.Nb()&&(b=a.fromSpot),a=b===$c?uc:b)):(a=b?b:this.toPort,null===a?a=Ac:(b=this.toSpot,b.Nb()&&(b=a.toSpot),a=b===$c?uc:b));return a};function mp(a){return a===uc||.5===a.x&&.5===a.y}S.prototype.computeOtherPoint=function(a,b){if(this.computeAdjusting()!==ag&&4<this.pointsCount)return this.computeMidPoint(new I);a=b.ga(Ac);b=b.jp;b=null!==b?qp(b,this):null;null!==b&&(a=b.Eq);return a};
S.prototype.computeShortLength=function(a){if(a){a=this.fromShortLength;if(isNaN(a)){var b=this.fromPort;null!==b&&(a=b.fromShortLength)}return isNaN(a)?0:a}a=this.toShortLength;isNaN(a)&&(b=this.toPort,null!==b&&(a=b.toShortLength));return isNaN(a)?0:a};
S.prototype.tf=function(a,b,c,d,e,f){if(!1===this.pickable)return!1;void 0===b&&(b=null);void 0===c&&(c=null);var g=f;void 0===f&&(g=qd.alloc(),g.reset());g.multiply(this.transform);if(this.Dh(a,g))return gn(this,b,c,e),void 0===f&&qd.free(g),!0;if(this.Ic(a,g)){var h=!1;if(!this.isAtomic)for(var k=this.W.j,l=k.length;l--;){var m=k[l];if(m.visible||m===this.locationObject){var n=m.actualBounds,p=this.naturalBounds;if(!(n.x>p.width||n.y>p.height||0>n.x+n.width||0>n.y+n.height)){n=qd.alloc();n.set(g);
if(m instanceof X)h=m.tf(a,b,c,d,e,n);else if(this.path===m){if(m instanceof W)if(h=a,p=d,!1===m.pickable)h=!1;else if(n.multiply(m.transform),p)b:{var r=h,q=n;if(m.Dh(r,q))h=!0;else{if(void 0===q&&(q=m.transform,r.Ce(m.actualBounds))){h=!0;break b}h=r.left;p=r.right;var u=r.top;r=r.bottom;var v=I.alloc(),w=I.alloc(),y=I.alloc(),z=qd.alloc();z.set(q);z.Vv(m.transform);z.Et();w.x=p;w.y=u;w.transform(z);v.x=h;v.y=u;v.transform(z);q=!1;Hn(m,v,w,y)?q=!0:(v.x=p,v.y=r,v.transform(z),Hn(m,v,w,y)?q=!0:(w.x=
h,w.y=r,w.transform(z),Hn(m,v,w,y)?q=!0:(v.x=h,v.y=u,v.transform(z),Hn(m,v,w,y)&&(q=!0))));qd.free(z);I.free(v);I.free(w);I.free(y);h=q}}else h=m.Dh(h,n)}else h=kl(m,a,d,n);h&&(p=m,null!==b&&(p=b(m)),p&&(null===c||c(p))&&e.add(p));qd.free(n)}}}void 0===f&&qd.free(g);return h||null!==this.background||null!==this.areaBackground}void 0===f&&qd.free(g);return!1};
S.prototype.computeCurve=function(){if(null===this.Qf){var a=this.fromPort,b=this.isOrthogonal;this.Qf=null!==a&&a===this.toPort&&!b}return this.Qf?dg:this.curve};S.prototype.computeCorner=function(){if(this.curve===dg)return 0;var a=this.corner;if(isNaN(a)||0>a)a=10;return a};
S.prototype.findMidLabel=function(){for(var a=this.path,b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d];if(e!==a&&!e.isPanelMain&&(-Infinity===e.segmentIndex||isNaN(e.segmentIndex)))return e}for(a=this.labelNodes;a.next();)if(b=a.value,-Infinity===b.segmentIndex||isNaN(b.segmentIndex))return b;return null};
S.prototype.computeSpacing=function(){if(!this.isVisible())return 0;var a=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===Vm||d===Wm||d===gp?a=Math.max(a,e):d===Qm||d===Rm||d===Om||d===Pm?a=Math.max(a,g):(b=b.ga(Ac).Sa(c.ga(Ac))/180*Math.PI,a=Math.max(a,
Math.abs(Math.sin(b)*g)+Math.abs(Math.cos(b)*e)+1));this.curve===dg&&(a*=1.333)}}return a};S.prototype.arrangeBundledLinks=function(a,b){if(b)for(b=0;b<a.length;b++){var c=a[b];c.computeAdjusting()===ag&&c.Ta()}};
S.prototype.computeCurviness=function(){var a=this.curviness;if(isNaN(a)){a=16;var b=this.Hf;if(null!==b){for(var c=Fa(),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.Mt===this.fromNode&&(a=-a);Ha(c)}}return a};S.prototype.computeThickness=function(){if(!this.isVisible())return 0;var a=this.path;return null!==a?Math.max(a.strokeWidth,1):1};
S.prototype.hasCurviness=function(){return!isNaN(this.curviness)||null!==this.Hf};
S.prototype.adjustPoints=function(a,b,c,d){var e=this.computeAdjusting();if(this.isOrthogonal){if(e===ep)return!1;e===fp&&(e=dp)}switch(e){case ep:var f=this.i(a),g=this.i(c);if(!f.Ma(b)||!g.Ma(d)){e=f.x;f=f.y;var h=g.x-e,k=g.y-f,l=Math.sqrt(h*h+k*k);if(!K.$(l,0)){if(K.$(h,0))var m=0>k?-Math.PI/2:Math.PI/2;else m=Math.atan(k/Math.abs(h)),0>h&&(m=Math.PI-m);g=b.x;var n=b.y;h=d.x-g;var p=d.y-n;k=Math.sqrt(h*h+p*p);K.$(h,0)?p=0>p?-Math.PI/2:Math.PI/2:(p=Math.atan(p/Math.abs(h)),0>h&&(p=Math.PI-p));l=
k/l;m=p-m;this.jd(a,b);for(a+=1;a<c;a++)b=this.i(a),h=b.x-e,k=b.y-f,b=Math.sqrt(h*h+k*k),K.$(b,0)||(K.$(h,0)?k=0>k?-Math.PI/2:Math.PI/2:(k=Math.atan(k/Math.abs(h)),0>h&&(k=Math.PI-k)),h=k+m,b*=l,this.K(a,g+b*Math.cos(h),n+b*Math.sin(h)));this.jd(c,d)}}return!0;case fp:f=this.i(a);n=this.i(c);if(!f.Ma(b)||!n.Ma(d)){e=f.x;f=f.y;g=n.x;n=n.y;l=(g-e)*(g-e)+(n-f)*(n-f);h=b.x;m=b.y;k=d.x;p=d.y;var r=1;if(0!==k-h){var q=(p-m)/(k-h);r=Math.sqrt(1+1/(q*q))}else q=9E9;this.jd(a,b);for(a+=1;a<c;a++){b=this.i(a);
var u=b.x,v=b.y,w=.5;0!==l&&(w=((e-u)*(e-g)+(f-v)*(f-n))/l);var y=e+w*(g-e),z=f+w*(n-f);b=Math.sqrt((u-y)*(u-y)+(v-z)*(v-z));v<q*(u-y)+z&&(b=-b);0<q&&(b=-b);u=h+w*(k-h);w=m+w*(p-m);0!==q?(b=u+b/r,this.K(a,b,w-(b-u)/q)):this.K(a,u,w+b)}this.jd(c,d)}return!0;case dp:a:{if(this.isOrthogonal&&(e=this.i(a),f=this.i(a+1),g=this.i(a+2),h=f.x,m=f.y,n=h,l=m,K.A(e.y,f.y)?K.A(f.x,g.x)?m=b.y:K.A(f.y,g.y)&&(h=b.x):K.A(e.x,f.x)&&(K.A(f.y,g.y)?h=b.x:K.A(f.x,g.x)&&(m=b.y)),this.K(a+1,h,m),e=this.i(c),f=this.i(c-
1),g=this.i(c-2),h=f.x,m=f.y,k=h,p=m,K.A(e.y,f.y)?K.A(f.x,g.x)?m=d.y:K.A(f.y,g.y)&&(h=d.x):K.A(e.x,f.x)&&(K.A(f.y,g.y)?h=d.x:K.A(f.x,g.x)&&(m=d.y)),this.K(c-1,h,m),Rj(this))){this.K(a+1,n,l);this.K(c-1,k,p);c=!1;break a}this.jd(a,b);this.jd(c,d);c=!0}return c;default:return!1}};
S.prototype.addOrthoPoints=function(a,b,c,d,e,f){b=-45<=b&&45>b?0:45<=b&&135>b?90:135<=b&&225>b?180:270;d=-45<=d&&45>d?0:45<=d&&135>d?90:135<=d&&225>d?180:270;var g=e.actualBounds.copy(),h=f.actualBounds.copy();if(g.v()&&h.v()){g.Fc(8,8);h.Fc(8,8);g.Ie(a);h.Ie(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 I(c.x,a.y);var l=new I(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 I(a.x,c.y);l=new I((a.x+c.x)/2,c.y);if(180===d||90===d&&c.y<g.top||270===d&&c.y>g.bottom)180===d&&(h.aa(a)||g.aa(c))?k.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):
c.y<a.y&&(180===d||90===d)?k.y=this.computeMidOrthoPosition(a.x,g.top,c.x,Math.max(c.y,h.bottom),!0):c.y>a.y&&(180===d||270===d)&&(k.y=this.computeMidOrthoPosition(a.x,g.bottom,c.x,Math.min(c.y,h.top),!0)),l.x=c.x,l.y=k.y;if(k.y>g.top&&k.y<g.bottom)if(c.x>=g.left&&c.x<=a.x||a.x<=h.right&&a.x>=c.x){if(90===d||270===d)k=new I(Math.max((a.x+c.x)/2,a.x),a.y),l=new I(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 I(c.x,a.y),l=new I(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 I(a.x,c.y);l=new I((a.x+c.x)/2,c.y);if(0===d||90===d&&c.y<g.top||270===d&&c.y>g.bottom)0===d&&(h.aa(a)||g.aa(c))?k.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):c.y<a.y&&(0===d||90===d)?k.y=this.computeMidOrthoPosition(a.x,g.top,c.x,Math.max(c.y,h.bottom),!0):c.y>a.y&&(0===d||270===d)&&(k.y=this.computeMidOrthoPosition(a.x,g.bottom,c.x,Math.min(c.y,h.top),!0)),l.x=c.x,l.y=k.y;if(k.y>g.top&&k.y<g.bottom)if(c.x<=
g.right&&c.x>=a.x||a.x>=h.left&&a.x<=c.x){if(90===d||270===d)k=new I(Math.min((a.x+c.x)/2,a.x),a.y),l=new I(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 I(a.x,c.y),l=new I((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 I(c.x,a.y);l=new I(c.x,(a.y+c.y)/2);if(270===d||0===d&&c.x<g.left||180===d&&c.x>g.right)270===d&&(h.aa(a)||g.aa(c))?k.x=this.computeMidOrthoPosition(a.x,
a.y,c.x,c.y,!1):c.x<a.x&&(270===d||0===d)?k.x=this.computeMidOrthoPosition(g.left,a.y,Math.max(c.x,h.right),c.y,!1):c.x>a.x&&(270===d||180===d)&&(k.x=this.computeMidOrthoPosition(g.right,a.y,Math.min(c.x,h.left),c.y,!1)),l.x=k.x,l.y=c.y;if(k.x>g.left&&k.x<g.right)if(c.y>=g.top&&c.y<=a.y||a.y<=h.bottom&&a.y>=c.y){if(0===d||180===d)k=new I(a.x,Math.max((a.y+c.y)/2,a.y)),l=new I(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 I(a.x,c.y),l=new I((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 I(c.x,a.y);l=new I(c.x,(a.y+c.y)/2);if(90===d||0===d&&c.x<g.left||180===d&&c.x>g.right)90===d&&(h.aa(a)||g.aa(c))?k.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):c.x<a.x&&(90===d||0===d)?k.x=this.computeMidOrthoPosition(g.left,a.y,Math.max(c.x,h.right),c.y,!1):c.x>a.x&&(90===d||180===d)&&(k.x=this.computeMidOrthoPosition(g.right,a.y,Math.min(c.x,h.left),c.y,!1)),l.x=k.x,l.y=c.y;if(k.x>g.left&&
k.x<g.right)if(c.y<=g.bottom&&c.y>=a.y||a.y>=h.top&&a.y<=c.y){if(0===d||180===d)k=new I(a.x,Math.min((a.y+c.y)/2,a.y)),l=new I(c.x,k.y)}else k.x=180===d||(90===d||270===d)&&c.x<a.x?Math.min(c.x,270===d?g.left:Math.min(g.left,h.left)):Math.max(c.x,270===d?g.right:Math.max(g.right,h.right)),l.x=k.x,l.y=c.y}var m=k,n=l,p=c;if(this.isAvoiding){var r=this.diagram;if(null===r||!tk(r)||g.aa(p)&&!f.yd(e)||h.aa(a)&&!e.yd(f)||e===f||this.layer.isTemporary)b=!1;else{var q=uk(r,!0,this.containingGroup,null);
if(17!==this.segmentIndex&&q.nk(Math.min(a.x,m.x),Math.min(a.y,m.y),Math.abs(a.x-m.x),Math.abs(a.y-m.y))&&q.nk(Math.min(m.x,n.x),Math.min(m.y,n.y),Math.abs(m.x-n.x),Math.abs(m.y-n.y))&&q.nk(Math.min(n.x,p.x),Math.min(n.y,p.y),Math.abs(n.x-p.x),Math.abs(n.y-p.y)))b=!1;else{e=a;f=p;var u=c=null;if(r.isVirtualized){r=q.bounds.copy();r.Fc(-q.fm,-q.em);var v=I.alloc();sp(q,a.x,a.y)||(K.Vc(r.x,r.y,r.x+r.width,r.y+r.height,a.x,a.y,m.x,m.y,v)?(c=a=v.copy(),b=v.Sa(m)):K.Vc(r.x,r.y,r.x+r.width,r.y+r.height,
m.x,m.y,n.x,n.y,v)?(c=a=v.copy(),b=v.Sa(n)):K.Vc(r.x,r.y,r.x+r.width,r.y+r.height,n.x,n.y,p.x,p.y,v)&&(c=a=v.copy(),b=v.Sa(p)));sp(q,p.x,p.y)||(K.Vc(r.x,r.y,r.x+r.width,r.y+r.height,p.x,p.y,n.x,n.y,v)?(u=p=v.copy(),d=n.Sa(v)):K.Vc(r.x,r.y,r.x+r.width,r.y+r.height,n.x,n.y,m.x,m.y,v)?(u=p=v.copy(),d=m.Sa(v)):K.Vc(r.x,r.y,r.x+r.width,r.y+r.height,m.x,m.y,a.x,a.y,v)&&(u=p=v.copy(),d=a.Sa(v)));I.free(v)}g=g.copy().Jc(h);h=q.BA;g.Fc(q.fm*h,q.em*h);tp(q,a,b,p,d,g);h=up(q,p.x,p.y);!q.abort&&h>=vp&&(xk(q),
h=q.eA,g.Fc(q.fm*h,q.em*h),tp(q,a,b,p,d,g),h=up(q,p.x,p.y));!q.abort&&h>=vp&&q.IA&&(xk(q),tp(q,a,b,p,d,q.bounds),h=up(q,p.x,p.y));if(!q.abort&&h<vp&&up(q,p.x,p.y)!==wp){xp(this,q,p.x,p.y,d,!0);g=this.i(2);if(4>this.pointsCount)0===b||180===b?(g.x=a.x,g.y=p.y):(g.x=p.x,g.y=a.y),this.K(2,g.x,g.y),this.m(3,g.x,g.y);else if(p=this.i(3),0===b||180===b)K.A(g.x,p.x)?(g=0===b?Math.max(g.x,a.x):Math.min(g.x,a.x),this.K(2,g,a.y),this.K(3,g,p.y)):K.A(g.y,p.y)?(Math.abs(a.y-g.y)<=q.em/2&&(this.K(2,g.x,a.y),this.K(3,
p.x,a.y)),this.m(2,g.x,a.y)):this.K(2,a.x,g.y);else if(90===b||270===b)K.A(g.y,p.y)?(g=90===b?Math.max(g.y,a.y):Math.min(g.y,a.y),this.K(2,a.x,g),this.K(3,p.x,g)):K.A(g.x,p.x)?(Math.abs(a.x-g.x)<=q.fm/2&&(this.K(2,a.x,g.y),this.K(3,a.x,p.y)),this.m(2,a.x,g.y)):this.K(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.qf(f.x,u.y):this.qf(u.x,f.y));b=
!0}else b=!1}}}else b=!1;b||(this.Ae(k),this.Ae(l))}};S.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 Rj(a){if(null===a.diagram||!a.isAvoiding||!tk(a.diagram))return!1;var b=a.points.j,c=b.length;if(4>c)return!1;a=uk(a.diagram,!0,a.containingGroup,null);for(var d=1;d<c-2;d++){var e=b[d],f=b[d+1];if(!a.nk(Math.min(e.x,f.x),Math.min(e.y,f.y),Math.abs(e.x-f.x),Math.abs(e.y-f.y)))return!0}return!1}
function xp(a,b,c,d,e,f){var g=b.fm,h=b.em,k=up(b,c,d),l=c,m=d;for(0===e?l+=g:90===e?m+=h:180===e?l-=g:m-=h;k>yp&&up(b,l,m)===k-1;)c=l,d=m,0===e?l+=g:90===e?m+=h:180===e?l-=g:m-=h,--k;if(f){if(k>yp)if(180===e||0===e)c=Math.floor(c/g)*g+g/2;else if(90===e||270===e)d=Math.floor(d/h)*h+h/2}else c=Math.floor(c/g)*g+g/2,d=Math.floor(d/h)*h+h/2;k>yp&&(f=e,l=c,m=d,0===e?(f=90,m+=h):90===e?(f=180,l-=g):180===e?(f=270,m-=h):270===e&&(f=0,l+=g),up(b,l,m)===k-1?xp(a,b,l,m,f,!1):(l=c,m=d,0===e?(f=270,m-=h):90===
e?(f=0,l+=g):180===e?(f=90,m+=h):270===e&&(f=180,l-=g),up(b,l,m)===k-1&&xp(a,b,l,m,f,!1)));a.qf(c,d)}S.prototype.rz=function(a){var b=a.x;a=a.y;for(var c=this.i(0),d=this.i(1),e=Bb(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=Bb(b,a,d.x,d.y,c.x,c.y);d=c;h<e&&(f=g,e=h)}return f};S.prototype.cc=function(){this.co=!0};
S.prototype.qk=function(a){if(!a){if(!1===this.ld)return;a=this.tb();if(!this.co&&(null===a||null!==a.geometry))return}this.ka=this.makeGeometry();a=this.path;if(null!==a){a.ka=this.ka;for(var b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d];e!==a&&e.isPanelMain&&e instanceof W&&(e.ka=this.ka)}}};
S.prototype.makeGeometry=function(){var a=this.ka,b=this.pointsCount;if(2>b)return a.type=vd,this.co=!1,a;var c=!1,d=this.diagram;null!==d&&hp(this)&&d.Pg.contains(this)&&(0!==this.Fl.width||0!==this.Fl.height)&&(c=!0);var e=this.i(0).copy(),f=e.copy();d=this.yb.j;var g=this.computeCurve();if(g===dg&&3<=b&&!K.$(this.smoothness,0))if(3===b){var h=this.i(1);d=Math.min(e.x,h.x);var k=Math.min(e.y,h.y);h=this.i(2);d=Math.min(d,h.x);k=Math.min(k,h.y)}else{if(this.isOrthogonal)for(k=0;k<b;k++)h=d[k],f.x=
Math.min(h.x,f.x),f.y=Math.min(h.y,f.y);else for(d=3;d<b;d+=3)d+3>=b&&(d=b-1),k=this.i(d),f.x=Math.min(k.x,f.x),f.y=Math.min(k.y,f.y);d=f.x;k=f.y}else{for(k=0;k<b;k++)h=d[k],f.x=Math.min(h.x,f.x),f.y=Math.min(h.y,f.y);d=f.x;k=f.y}d-=this.hv.x;k-=this.hv.y;e.x-=d;e.y-=k;if(2!==b||hp(this)){a.type=td;h=Jd(a);0!==this.computeShortLength(!0)&&(e=zp(this,e,!0,f));Kd(h,e.x,e.y,!1);if(g===dg&&3<=b&&!K.$(this.smoothness,0))if(3===b)c=this.i(1),b=c.x-d,c=c.y-k,e=this.i(2).copy(),e.x-=d,e.y-=k,0!==this.computeShortLength(!1)&&
(e=zp(this,e,!1,f)),Ld(h,b,c,b,c,e.x,e.y);else if(this.isOrthogonal){f=new I(d,k);e=this.i(1).copy();g=new I(d,k);b=new I(d,k);c=this.i(0);for(var l,m=this.smoothness/3,n=1;n<this.pointsCount-1;n++){l=this.i(n);var p=c,r=l,q=this.i(Ap(this,l,n,!1));if(!K.$(p.x,r.x)||!K.$(r.x,q.x))if(!K.$(p.y,r.y)||!K.$(r.y,q.y)){var u=m;isNaN(u)&&(u=this.smoothness/3);var v=p.x;p=p.y;var w=r.x;r=r.y;var y=q.x;q=q.y;var z=u*Bp(v,p,w,r);u*=Bp(w,r,y,q);K.$(p,r)&&K.$(w,y)&&(w>v?q>r?(g.x=w-z,g.y=r-z,b.x=w+u,b.y=r+u):(g.x=
w-z,g.y=r+z,b.x=w+u,b.y=r-u):q>r?(g.x=w+z,g.y=r-z,b.x=w-u,b.y=r+u):(g.x=w+z,g.y=r+z,b.x=w-u,b.y=r-u));K.$(v,w)&&K.$(r,q)&&(r>p?(y>w?(g.x=w-z,g.y=r-z,b.x=w+u):(g.x=w+z,g.y=r-z,b.x=w-u),b.y=r+u):(y>w?(g.x=w-z,g.y=r+z,b.x=w+u):(g.x=w+z,g.y=r+z,b.x=w-u),b.y=r-u));if(K.$(v,w)&&K.$(w,y)||K.$(p,r)&&K.$(r,q))v=.5*(v+y),p=.5*(p+q),g.x=v,g.y=p,b.x=v,b.y=p;1===n?(e.x=.5*(c.x+l.x),e.y=.5*(c.y+l.y)):2===n&&K.$(c.x,this.i(0).x)&&K.$(c.y,this.i(0).y)&&(e.x=.5*(c.x+l.x),e.y=.5*(c.y+l.y));Ld(h,e.x-d,e.y-k,g.x-d,g.y-
k,l.x-d,l.y-k);f.set(g);e.set(b);c=l}}f=c.x;c=c.y;e=this.i(this.pointsCount-1);0!==this.computeShortLength(!1)&&(e=zp(this,e.copy(),!1,Gb));f=.5*(f+e.x);c=.5*(c+e.y);Ld(h,b.x-d,b.y-k,f-d,c-k,e.x-d,e.y-k)}else for(c=3;c<b;c+=3)f=this.i(c-2),c+3>=b&&(c=b-1),e=this.i(c-1),g=this.i(c),c===b-1&&0!==this.computeShortLength(!1)&&(g=zp(this,g.copy(),!1,Gb)),Ld(h,f.x-d,f.y-k,e.x-d,e.y-k,g.x-d,g.y-k);else{f=I.alloc();f.assign(this.i(0));e=I.alloc();e.assign(f);g=this.computeCorner();n=1;for(l=0;n<b;){n=Ap(this,
f,n,1<n);m=this.i(n);if(n>=b-1){if(!f.w(m))0!==this.computeShortLength(!1)&&(m=zp(this,m.copy(),!1,Gb)),Cp(this,h,-d,-k,f,m,c);else if(0===l)for(n=1;n<b;)e.assign(f),m=this.i(n++),Cp(this,h,-d,-k,f,m,c),f.assign(m);break}l=Ap(this,m,n+1,n<b-3);n=-d;v=-k;p=m;u=this.i(l);w=c;if(K.A(f.y,p.y)&&K.A(p.x,u.x))if(r=Math.min(g,Math.abs(p.x-e.x)/2),r=y=Math.min(r,Math.abs(u.y-p.y)/2),K.A(r,0))Cp(this,h,n,v,f,p,w),f.assign(p);else{q=p.x;z=p.y;var A=q,C=z;p.x>f.x?q=p.x-r:q=p.x+r;u.y>p.y?C=p.y+y:C=p.y-y;Cp(this,
h,n,v,f,new I(q,z),w);Md(h,p.x+n,p.y+v,A+n,C+v);f.h(A,C)}else K.A(f.x,p.x)&&K.A(p.y,u.y)?(r=Math.min(g,Math.abs(p.y-e.y)/2),r=y=Math.min(r,Math.abs(u.x-p.x)/2),K.A(y,0)?(Cp(this,h,n,v,f,p,w),f.assign(p)):(q=p.x,z=p.y,A=q,C=z,p.y>f.y?z=p.y-r:z=p.y+r,u.x>p.x?A=p.x+y:A=p.x-y,Cp(this,h,n,v,f,new I(q,z),w),Md(h,p.x+n,p.y+v,A+n,C+v),f.h(A,C))):(Cp(this,h,n,v,f,p,w),f.assign(p));e.assign(m);n=l}I.free(f)}Td=h}else h=this.i(1).copy(),h.x-=d,h.y-=k,0!==this.computeShortLength(!0)&&(e=zp(this,e,!0,f)),0!==
this.computeShortLength(!1)&&(h=zp(this,h,!1,f)),a.type=vd,a.startX=e.x,a.startY=e.y,a.endX=h.x,a.endY=h.y;this.co=!1;return a};function Bp(a,b,c,d){a=c-a;if(isNaN(a)||Infinity===a||-Infinity===a)return NaN;0>a&&(a=-a);b=d-b;if(isNaN(b)||Infinity===b||-Infinity===b)return NaN;0>b&&(b=-b);return K.$(a,0)?b:K.$(b,0)?a:Math.sqrt(a*a+b*b)}
function zp(a,b,c,d){var e=a.pointsCount;if(2>e)return b;if(c){var f=a.i(1);c=f.x-d.x;f=f.y-d.y;d=Bp(b.x,b.y,c,f);if(0===d)return b;e=2===e?.5*d:d;a=a.computeShortLength(!0);a>e&&(a=e);e=a*(f-b.y)/d;b.x+=a*(c-b.x)/d;b.y+=e}else{f=a.i(e-2);c=f.x-d.x;f=f.y-d.y;d=Bp(b.x,b.y,c,f);if(0===d)return b;e=2===e?.5*d:d;a=a.computeShortLength(!1);a>e&&(a=e);e=a*(b.y-f)/d;b.x-=a*(b.x-c)/d;b.y-=e}return b}
function Ap(a,b,c,d){for(var e=a.pointsCount,f=b;K.$(b.x,f.x)&&K.$(b.y,f.y);){if(c>=e)return e-1;f=a.i(c++)}if(!K.$(b.x,f.x)&&!K.$(b.y,f.y))return c-1;for(var g=f;K.$(b.x,f.x)&&K.$(f.x,g.x)&&(!d||(b.y>=f.y?f.y>=g.y:f.y<=g.y))||K.$(b.y,f.y)&&K.$(f.y,g.y)&&(!d||(b.x>=f.x?f.x>=g.x:f.x<=g.x));){if(c>=e)return e-1;g=a.i(c++)}return c-2}
function Cp(a,b,c,d,e,f,g){if(!g&&hp(a)){g=[];var h=0;a.isVisible()&&(h=Dp(a,e,f,g));if(0<h)if(K.A(e.y,f.y))if(e.x<f.x)for(var k=0;k<h;){var l=Math.max(e.x,Math.min(g[k++]-5,f.x-10));b.lineTo(l+c,f.y+d);var m=l+c;for(var n=Math.min(l+10,f.x);k<h;)if(l=g[k],l<n+10)k++,n=Math.min(l+5,f.x);else break;l=f.y-10+d;n+=c;var p=f.y+d;a.curve===$f?Kd(b,n,p,!1):Ld(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===$f?Kd(b,l,n,!1):Ld(b,m,k,l,k,l,n)}else if(K.A(e.x,f.x))if(e.y<f.y)for(k=0;k<h;){l=Math.max(e.y,Math.min(g[k++]-5,f.y-10));b.lineTo(f.x+c,l+d);m=l+d;for(l=Math.min(l+10,f.y);k<h;)if(n=g[k],n<l+10)k++,l=Math.min(n+5,f.y);else break;n=f.x-10+c;p=f.x+c;l+=d;a.curve===$f?Kd(b,p,l,!1):Ld(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===$f?Kd(b,n,k,!1):Ld(b,l,m,l,k,n,k)}}b.lineTo(f.x+c,f.y+d)}
function Dp(a,b,c,d){var e=a.diagram;if(null===e||b.w(c))return 0;for(e=e.layers;e.next();){var f=e.value;if(null!==f&&f.visible){f=f.Ca.j;for(var g=f.length,h=0;h<g;h++){var k=f[h];if(k instanceof S){if(k===a)return 0<d.length&&d.sort(function(a,b){return a-b}),d.length;if(k.isVisible()&&hp(k)){var l=k.routeBounds;l.v()&&a.routeBounds.Ic(l)&&!a.usesSamePort(k)&&(l=k.path,null!==l&&l.zf()&&Ep(b,c,d,k))}}}}}0<d.length&&d.sort(function(a,b){return a-b});return d.length}
function Ep(a,b,c,d){for(var e=K.A(a.y,b.y),f=d.pointsCount,g=d.i(0),h=I.alloc(),k=1;k<f;k++){var l=d.i(k);if(k<f-1){var m=d.i(k+1);if(g.y===l.y&&l.y===m.y){if(l.x>g.x&&m.x>=l.x||l.x<g.x&&m.x<=l.x)continue}else if(g.x===l.x&&l.x===m.x&&(l.y>g.y&&m.y>=l.y||l.y<g.y&&m.y<=l.y))continue}a:{m=a.x;var n=a.y,p=b.x,r=b.y,q=g.x;g=g.y;var u=l.x,v=l.y;if(!K.A(m,p)){if(K.A(n,r)&&K.A(q,u)&&Math.min(m,p)<q&&Math.max(m,p)>q&&Math.min(g,v)<n&&Math.max(g,v)>n&&!K.A(g,v)){h.x=q;h.y=n;m=!0;break a}}else if(!K.A(n,r)&&
K.A(g,v)&&Math.min(n,r)<g&&Math.max(n,r)>g&&Math.min(q,u)<m&&Math.max(q,u)>m&&!K.A(q,u)){h.x=m;h.y=g;m=!0;break a}h.x=0;h.y=0;m=!1}m&&(e?c.push(h.x):c.push(h.y));g=l}I.free(h)}function hp(a){a=a.curve;return a===Zf||a===$f}function lp(a,b){if(b||hp(a))b=a.diagram,null===b||b.animationManager.isTicking||b.Pg.contains(a)||0===a.Fl.width&&0===a.Fl.height||b.Pg.add(a,a.Fl.copy())}
S.prototype.Bq=function(a){var b=this.layer;if(null!==b&&b.visible&&!b.isTemporary){var c=b.diagram;if(null!==c&&!c.animationManager.isTicking){var d=!1;for(c=c.layers;c.next();){var e=c.value;if(e.visible)if(e===b){d=!0;var f=!1;e=e.Ca.j;for(var g=e.length,h=0;h<g;h++){var k=e[h];k instanceof S&&(k===this?f=!0:f&&Fp(this,k,a))}}else if(d)for(f=e.Ca.j,e=f.length,g=0;g<e;g++)h=f[g],h instanceof S&&Fp(this,h,a)}}}};
function Fp(a,b,c){if(null!==b&&null!==b.ka&&hp(b)){var d=b.routeBounds;d.v()&&(a.routeBounds.Ic(d)||c.Ic(d))&&(a.usesSamePort(b)||b.cc())}}S.prototype.usesSamePort=function(a){var b=this.pointsCount,c=a.pointsCount;if(0<b&&0<c){var d=this.i(0),e=a.i(0);if(d.Ma(e))return!0;b=this.i(b-1);a=a.i(c-1);if(b.Ma(a)||d.Ma(a)||b.Ma(e))return!0}else if(this.fromNode===a.fromNode||this.toNode===a.toNode||this.fromNode===a.toNode||this.toNode===a.fromNode)return!0;return!1};
S.prototype.isVisible=function(){if(!T.prototype.isVisible.call(this))return!1;var a=this.containingGroup,b=!0,c=this.diagram;null!==c&&(b=c.isTreePathToChildren);c=this.fromNode;if(null!==c){if(this.isTreeLink&&b&&!c.isTreeExpanded)return!1;if(c===a)return!0;for(var d=c;null!==d;){if(d.labeledLink===this)return!0;d=d.containingGroup}c=c.findVisibleNode();if(null===c||c===a)return!1}c=this.toNode;if(null!==c){if(this.isTreeLink&&!b&&!c.isTreeExpanded)return!1;if(c===a)return!0;for(b=c;null!==b;){if(b.labeledLink===
this)return!0;b=b.containingGroup}b=c.findVisibleNode();if(null===b||b===a)return!1}return!0};S.prototype.Pb=function(a){T.prototype.Pb.call(this,a);null!==this.Hf&&this.Hf.pm();if(null!==this.bd)for(var b=this.bd.iterator;b.next();)b.value.Pb(a)};S.prototype.computeAdjusting=function(){return null!==this.diagram&&this.diagram.animationManager.isAnimating?dp:this.Fk};
function ip(a){var b=a.Qe;if(null!==b){var c=a.lf;if(null!==c){for(var d=a.Re,e=a.mf,f=a=null,g=b.Xa.j,h=g.length,k=0;k<h;k++){var l=g[k];if(l.Qe===b&&l.Re===d&&l.lf===c&&l.mf===e||l.Qe===c&&l.Re===e&&l.lf===b&&l.mf===d)null===f?f=l:(null===a&&(a=[],a.push(f)),a.push(l))}if(null!==a){f=Oo(b,c,d,e);null===f&&(f=new Gp(b,d,c,e),No(b,f),No(c,f));f.links=a;for(b=0;b<a.length;b++)a[b].Hf=f;f.pm()}}}}function jp(a){var b=a.Hf;null!==b&&(a.Hf=null,a=b.links.indexOf(a),0<=a&&(Da(b.links,a),b.pm()))}
S.prototype.Jh=function(){return!0};
ma.Object.defineProperties(S.prototype,{fromNode:{get:function(){return this.Qe},set:function(a){var b=this.Qe;if(b!==a){var c=this.fromPort;null!==b&&(this.lf!==b&&So(b,this,c),jp(this),this.C(2));this.Qe=a;null!==a&&this.Pb(a.isVisible());this.Qf=null;this.Ta();var d=this.diagram;null!==d&&d.Z&&d.partManager.setFromNodeForLink(this,a,b);var e=this.fromPort,f=this.fromPortChanged;if(null!==f){var g=!0;null!==d&&(g=d.Z,d.Z=!0);f(this,c,e);null!==d&&(d.Z=g)}null!==a&&
(this.lf!==a&&Ro(a,this,e),ip(this),this.C(1));this.g("fromNode",b,a);Lo(this)}}},fromPortId:{get:function(){return this.Re},set:function(a){var b=this.Re;if(b!==a){var c=this.fromPort;null!==c&&Po(this.fromNode,c);jp(this);this.Re=a;var d=this.fromPort;null!==d&&Po(this.fromNode,d);var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.dj()&&g.ow(f,a)}c!==d&&(this.Qf=null,this.Ta(),f=this.fromPortChanged,null!==f&&(g=!0,null!==e&&(g=e.Z,e.Z=!0),f(this,
c,d),null!==e&&(e.Z=g)));ip(this);this.g("fromPortId",b,a)}}},fromPort:{get:function(){var a=this.Qe;return null===a?null:a.wt(this.Re)}},fromPortChanged:{get:function(){return this.Rn},set:function(a){var b=this.Rn;b!==a&&(this.Rn=a,this.g("fromPortChanged",b,a))}},toNode:{get:function(){return this.lf},set:function(a){var b=this.lf;if(b!==a){var c=this.toPort;null!==b&&(this.Qe!==b&&So(b,this,c),jp(this),this.C(2));
this.lf=a;null!==a&&this.Pb(a.isVisible());this.Qf=null;this.Ta();var d=this.diagram;null!==d&&d.Z&&d.partManager.setToNodeForLink(this,a,b);var e=this.toPort,f=this.toPortChanged;if(null!==f){var g=!0;null!==d&&(g=d.Z,d.Z=!0);f(this,c,e);null!==d&&(d.Z=g)}null!==a&&(this.Qe!==a&&Ro(a,this,e),ip(this),this.C(1));this.g("toNode",b,a);Lo(this)}}},toPortId:{get:function(){return this.mf},set:function(a){var b=this.mf;if(b!==a){var c=this.toPort;null!==c&&Po(this.toNode,
c);jp(this);this.mf=a;var d=this.toPort;null!==d&&Po(this.toNode,d);var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.dj()&&g.tw(f,a)}c!==d&&(this.Qf=null,this.Ta(),f=this.toPortChanged,null!==f&&(g=!0,null!==e&&(g=e.Z,e.Z=!0),f(this,c,d),null!==e&&(e.Z=g)));ip(this);this.g("toPortId",b,a)}}},toPort:{get:function(){var a=this.lf;return null===a?null:a.wt(this.mf)}},toPortChanged:{get:function(){return this.$p},set:function(a){var b=
this.$p;b!==a&&(this.$p=a,this.g("toPortChanged",b,a))}},fromSpot:{get:function(){return null!==this.O?this.O.Vg:$c},set:function(a){this.Gc();var b=this.O.Vg;if(!b.w(a)){a=a.G();this.O.Vg=a;this.g("fromSpot",b,a);if(b.gd()||a.gd())a=this.fromNode,null!==a&&Po(a,this.fromPort);this.Ta()}}},fromEndSegmentLength:{get:function(){return null!==this.O?this.O.Tg:NaN},set:function(a){this.Gc();var b=this.O.Tg;b!==a&&(0>a&&va(a,">= 0",S,"fromEndSegmentLength"),
this.O.Tg=a,this.g("fromEndSegmentLength",b,a),this.Ta())}},fromShortLength:{get:function(){return null!==this.O?this.O.Ug:NaN},set:function(a){this.Gc();var b=this.O.Ug;b!==a&&(this.O.Ug=a,this.g("fromShortLength",b,a),this.cc())}},toSpot:{get:function(){return null!==this.O?this.O.vh:$c},set:function(a){this.Gc();var b=this.O.vh;if(!b.w(a)){a=a.G();this.O.vh=a;this.g("toSpot",b,a);if(b.gd()||a.gd())a=this.toNode,null!==a&&Po(a,this.toPort);
this.Ta()}}},toEndSegmentLength:{get:function(){return null!==this.O?this.O.th:NaN},set:function(a){this.Gc();var b=this.O.th;b!==a&&(0>a&&va(a,">= 0",S,"toEndSegmentLength"),this.O.th=a,this.g("toEndSegmentLength",b,a),this.Ta())}},toShortLength:{get:function(){return null!==this.O?this.O.uh:NaN},set:function(a){this.Gc();var b=this.O.uh;b!==a&&(this.O.uh=a,this.g("toShortLength",b,a),this.cc())}},isLabeledLink:{
get:function(){return null===this.bd?!1:0<this.bd.count}},labelNodes:{get:function(){return null===this.bd?fb:this.bd.iterator}},relinkableFrom:{get:function(){return 0!==(this.Pa&1)},set:function(a){var b=0!==(this.Pa&1);b!==a&&(this.Pa^=1,this.g("relinkableFrom",b,a),this.Mb())}},relinkableTo:{get:function(){return 0!==(this.Pa&2)},set:function(a){var b=0!==(this.Pa&2);b!==a&&(this.Pa^=2,this.g("relinkableTo",
b,a),this.Mb())}},resegmentable:{get:function(){return 0!==(this.Pa&4)},set:function(a){var b=0!==(this.Pa&4);b!==a&&(this.Pa^=4,this.g("resegmentable",b,a),this.Mb())}},isTreeLink:{get:function(){return 0!==(this.Pa&8)},set:function(a){var b=0!==(this.Pa&8);b!==a&&(this.Pa^=8,this.g("isTreeLink",b,a),null!==this.fromNode&&Ek(this.fromNode),null!==this.toNode&&Ek(this.toNode))}},path:{get:function(){var a=this.tb();
return a instanceof W?a:null}},routeBounds:{get:function(){this.kj();var a=this.Fl,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.Ie(e)}else if(this.computeCurve()===dg&&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.dm(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.dm(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.Ie(f),e=2;e<d;e++)f=this.i(e),b=Math.min(f.x,b),c=Math.min(f.y,c),a.Ie(f);this.hv.h(b-a.x,c-a.y)}return a}},midPoint:{
get:function(){this.kj();return this.computeMidPoint(new I)}},midAngle:{get:function(){this.kj();return this.computeMidAngle()}},flattenedLengths:{get:function(){if(null===this.Pr){this.ld||kp(this);for(var a=this.Pr=[],b=this.pointsCount,c=0;c<b-1;c++){var d=this.i(c);var e=this.i(c+1);K.$(d.x,e.x)?(d=e.y-d.y,0>d&&(d=-d)):K.$(d.y,e.y)?(d=e.x-d.x,0>d&&(d=-d)):d=Math.sqrt(d.De(e));a.push(d)}}return this.Pr}},flattenedTotalLength:{
get:function(){var a=this.Cu;if(isNaN(a)){for(var b=this.flattenedLengths,c=b.length,d=a=0;d<c;d++)a+=b[d];this.Cu=a}return a}},points:{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 E,d=0;d<a.length/2;d++)e=(new I(a[2*d],a[2*d+1])).freeze(),c.add(e);else{d=!0;for(e=0;e<a.length;e++){var f=
a[e];if(!za(f)||"number"!==typeof f.x||isNaN(f.x)||"number"!==typeof f.y||isNaN(f.y)){d=!1;break}}if(d)for(c=new E,d=0;d<a.length;d++)e=a[d],c.add((new I(e.x,e.y)).freeze())}}else if(a instanceof E)for(c=a.copy(),a=c.iterator;a.next();)a.value.freeze();else B("Link.points value is not an instance of List or Array: "+a);c.freeze();this.yb=c;this.cc();this.o();kp(this);a=this.diagram;null!==a&&(a.mk||a.undoManager.isUndoingRedoing||a.Jt.add(this),a.animationManager.qc&&(this.lh=c));this.g("points",
b,c)}}},pointsCount:{get:function(){return this.yb.count}},ld:{get:function(){return 0!==(this.Pa&16)},set:function(a){0!==(this.Pa&16)!==a&&(this.Pa^=16)}},suspendsRouting:{get:function(){return 0!==(this.Pa&32)},set:function(a){0!==(this.Pa&32)!==a&&(this.Pa^=32)}},vv:{get:function(){return 0!==(this.Pa&64)},set:function(a){0!==(this.Pa&64)!==a&&(this.Pa^=64)}},defaultFromPoint:{
get:function(){return this.u},set:function(a){this.u=a.copy()}},defaultToPoint:{get:function(){return this.I},set:function(a){this.I=a.copy()}},isOrthogonal:{get:function(){return 2===(this.Oj.value&2)}},isAvoiding:{get:function(){return 4===(this.Oj.value&4)}},geometry:{get:function(){this.co&&(this.kj(),this.ka=this.makeGeometry());return this.ka}},firstPickIndex:{
get:function(){return 2>=this.pointsCount?0:this.isOrthogonal||!mp(this.computeSpot(!0))?1:0}},lastPickIndex:{get:function(){var a=this.pointsCount;return 0===a?0:2>=a?a-1:this.isOrthogonal||!mp(this.computeSpot(!1))?a-2:a-1}},adjusting:{get:function(){return this.Fk},set:function(a){var b=this.Fk;b!==a&&(this.Fk=a,this.g("adjusting",b,a))}},corner:{get:function(){return this.tn},set:function(a){var b=
this.tn;b!==a&&(this.tn=a,this.cc(),this.g("corner",b,a))}},curve:{get:function(){return this.vn},set:function(a){var b=this.vn;b!==a&&(this.vn=a,this.Ta(),this.cc(),lp(this,b===$f||b===Zf||a===$f||a===Zf),this.g("curve",b,a))}},curviness:{get:function(){return this.wn},set:function(a){var b=this.wn;b!==a&&(this.wn=a,this.Ta(),this.cc(),this.g("curviness",b,a))}},routing:{get:function(){return this.Oj},set:function(a){var b=
this.Oj;b!==a&&(this.Oj=a,this.Qf=null,this.Ta(),lp(this,2===(b.value&2)||2===(a.value&2)),this.g("routing",b,a))}},smoothness:{get:function(){return this.Np},set:function(a){var b=this.Np;b!==a&&(this.Np=a,this.cc(),this.g("smoothness",b,a))}},key:{get:function(){var a=this.diagram;if(null!==a&&a.model.dj())return a.model.Vb(this.data)}}});S.prototype.invalidateOtherJumpOvers=S.prototype.Bq;S.prototype.findClosestSegment=S.prototype.rz;
S.prototype.updateRoute=S.prototype.kj;S.prototype.invalidateRoute=S.prototype.Ta;S.prototype.rollbackRoute=S.prototype.vy;S.prototype.commitRoute=S.prototype.rf;S.prototype.startRoute=S.prototype.Mh;S.prototype.clearPoints=S.prototype.ak;S.prototype.removePoint=S.prototype.gw;S.prototype.addPointAt=S.prototype.qf;S.prototype.addPoint=S.prototype.Ae;S.prototype.insertPointAt=S.prototype.m;S.prototype.insertPoint=S.prototype.Wz;S.prototype.setPointAt=S.prototype.K;S.prototype.setPoint=S.prototype.jd;
S.prototype.getPoint=S.prototype.i;S.prototype.getOtherPort=S.prototype.Oz;S.prototype.getOtherNode=S.prototype.wq;
var cp=new D(S,"Normal",1),Hp=new D(S,"Orthogonal",2),Ip=new D(S,"AvoidsNodes",6),rp=new D(S,"AvoidsNodesStraight",7),ag=new D(S,"None",0),dg=new D(S,"Bezier",9),$f=new D(S,"JumpGap",10),Zf=new D(S,"JumpOver",11),dp=new D(S,"End",17),ep=new D(S,"Scale",18),fp=new D(S,"Stretch",19),Vm=new D(S,"OrientAlong",21),Om=new D(S,"OrientPlus90",22),Qm=new D(S,"OrientMinus90",23),gp=new D(S,"OrientOpposite",24),Wm=new D(S,"OrientUpright",25),Pm=new D(S,"OrientPlus90Upright",26),Rm=new D(S,"OrientMinus90Upright",
27),Sm=new D(S,"OrientUpright45",28);S.className="Link";S.Normal=cp;S.Orthogonal=Hp;S.AvoidsNodes=Ip;S.AvoidsNodesStraight=rp;S.None=ag;S.Bezier=dg;S.JumpGap=$f;S.JumpOver=Zf;S.End=dp;S.Scale=ep;S.Stretch=fp;S.OrientAlong=Vm;S.OrientPlus90=Om;S.OrientMinus90=Qm;S.OrientOpposite=gp;S.OrientUpright=Wm;S.OrientPlus90Upright=Pm;S.OrientMinus90Upright=Rm;S.OrientUpright45=Sm;function Gp(a,b,c,d){Ya(this);this.ne=this.Wr=!1;this.Mt=a;this.qy=b;this.Wv=c;this.sy=d;this.links=[]}
Gp.prototype.pm=function(){if(!this.Wr){var a=this.links;0<a.length&&(a=a[0].diagram,null!==a&&(a.Eu.add(this),this.ne=a.undoManager.isUndoingRedoing))}this.Wr=!0};Gp.prototype.Fw=function(){if(this.Wr){this.Wr=!1;var a=this.links;if(0<a.length){var b=a[0],c=b.diagram;c=null===c||c.mk&&!this.ne;this.ne=!1;b.arrangeBundledLinks(a,c);1===a.length&&(b.Hf=null,a.length=0)}0===a.length&&(a=this.Mt,null!==this&&null!==a.Me&&a.Me.remove(this),a=this.Wv,null!==this&&null!==a.Me&&a.Me.remove(this))}};
Gp.className="LinkBundle";function vk(){Ya(this);this.Ay=this.group=null;this.Dt=!0;this.abort=!1;this.Qd=this.Pd=1;this.Co=this.Bo=-1;this.mc=this.lc=8;this.Db=[[]];this.Vj=this.Uj=0;this.IA=!1;this.BA=22;this.eA=111}
vk.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.Pd=Math.floor((a.x-this.lc)/this.lc)*this.lc;this.Qd=Math.floor((b-this.mc)/this.mc)*this.mc;this.Bo=Math.ceil((c+2*this.lc)/this.lc)*this.lc;this.Co=Math.ceil((d+2*this.mc)/this.mc)*this.mc;a=1+(Math.ceil((this.Bo-this.Pd)/this.lc)|0);b=1+(Math.ceil((this.Co-this.Qd)/this.mc)|0);if(null===this.Db||this.Uj<a-1||this.Vj<b-1){c=[];for(d=0;d<=a;d++)c[d]=[];this.Db=c;this.Uj=a-1;this.Vj=b-1}a=
Jp;if(null!==this.Db)for(b=0;b<=this.Uj;b++)for(c=0;c<=this.Vj;c++)this.Db[b][c]=a}};function sp(a,b,c){return a.Pd<=b&&b<=a.Bo&&a.Qd<=c&&c<=a.Co}function up(a,b,c){if(!sp(a,b,c))return Jp;b-=a.Pd;b/=a.lc;c-=a.Qd;c/=a.mc;return a.Db[b|0][c|0]}function yk(a,b,c){sp(a,b,c)&&(b-=a.Pd,b/=a.lc,c-=a.Qd,c/=a.mc,a.Db[b|0][c|0]=wp)}function xk(a){if(null!==a.Db)for(var b=0;b<=a.Uj;b++)for(var c=0;c<=a.Vj;c++)a.Db[b][c]>=yp&&(a.Db[b][c]=Jp)}
vk.prototype.nk=function(a,b,c,d){if(a>this.Bo||a+c<this.Pd||b>this.Co||b+d<this.Qd)return!0;a=(a-this.Pd)/this.lc|0;b=(b-this.Qd)/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.Uj)|0;for(c=Math.min(b+e-1,this.Vj)|0;a<=d;a++)for(e=b;e<=c;e++)if(this.Db[a][e]===wp)return!1;return!0};
function Kp(a,b,c,d,e,f,g,h,k){if(!(b<f||b>g||c<h||c>k)){var l=b|0;var m=c|0;var n=a.Db[l][m];if(n>=yp&&n<vp)for(e?m+=d:l+=d,n+=1;f<=l&&l<=g&&h<=m&&m<=k&&!(n>=a.Db[l][m]);)a.Db[l][m]=n,n+=1,e?m+=d:l+=d;l=e?m:l;if(e)if(0<d)for(c+=d;c<l;c+=d)Kp(a,b,c,1,!e,f,g,h,k),Kp(a,b,c,-1,!e,f,g,h,k);else for(c+=d;c>l;c+=d)Kp(a,b,c,1,!e,f,g,h,k),Kp(a,b,c,-1,!e,f,g,h,k);else if(0<d)for(b+=d;b<l;b+=d)Kp(a,b,c,1,!e,f,g,h,k),Kp(a,b,c,-1,!e,f,g,h,k);else for(b+=d;b>l;b+=d)Kp(a,b,c,1,!e,f,g,h,k),Kp(a,b,c,-1,!e,f,g,h,
k)}}function Lp(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=wp,m=yp;for(a.Db[b][c]=m;l===wp&&b>f&&b<g&&c>h&&c<k;)m+=1,a.Db[b][c]=m,e?c+=d:b+=d,l=a.Db[b][c]}function Mp(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=wp,m=vp;for(a.Db[b][c]=m;l===wp&&b>f&&b<g&&c>h&&c<k;)a.Db[b][c]=m,e?c+=d:b+=d,l=a.Db[b][c]}
function tp(a,b,c,d,e,f){if(null!==a.Db){a.abort=!1;var g=b.x,h=b.y;if(sp(a,g,h)&&(g-=a.Pd,g/=a.lc,h-=a.Qd,h/=a.mc,b=d.x,d=d.y,sp(a,b,d)))if(b-=a.Pd,b/=a.lc,d-=a.Qd,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.Pd;k/=a.lc;l-=a.Qd;l/=a.mc;m-=a.Pd;m/=a.lc;n-=a.Qd;n/=a.mc;f=Math.max(0,Math.min(a.Uj,k|0));m=Math.min(a.Uj,Math.max(0,m|0));l=Math.max(0,Math.min(a.Vj,l|0));n=Math.min(a.Vj,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.Db[g][h]===wp?(Lp(a,g,h,k,c,f,m,l,n),Lp(a,g,h,1,!c,f,m,l,n),Lp(a,g,h,-1,!c,f,m,l,n)):Lp(a,g,h,k,c,g,h,g,h);a.Db[b][d]===wp?(Mp(a,b,d,0===e||90===e?1:-1,90===e||270===e,f,m,l,n),Mp(a,b,d,1,!(90===e||270===e),f,m,l,n),Mp(a,b,d,-1,!(90===e||270===e),f,m,l,n)):Mp(a,b,d,k,c,b,d,b,d);a.abort||(Kp(a,g,h,1,!1,f,m,l,n),Kp(a,g,h,-1,!1,f,m,l,n),Kp(a,g,h,1,!0,f,m,l,n),Kp(a,g,h,-1,!0,f,m,l,n))}}}
ma.Object.defineProperties(vk.prototype,{bounds:{get:function(){return new N(this.Pd,this.Qd,this.Bo-this.Pd,this.Co-this.Qd)}},fm:{get:function(){return this.lc},set:function(a){0<a&&a!==this.lc&&(this.lc=a,this.initialize(this.bounds))}},em:{get:function(){return this.mc},set:function(a){0<a&&a!==this.mc&&(this.mc=a,this.initialize(this.bounds))}}});var wp=0,yp=1,vp=999999,Jp=vp+1;vk.className="PositionArray";
function pp(){Ya(this);this.port=this.node=null;this.Yd=[];this.Gq=!1}pp.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 Np(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}pp.prototype.pm=function(){this.Yd.length=0};
function qp(a,b){var c=a.Yd;if(0===c.length){a:if(!a.Gq){c=a.Gq;a.Gq=!0;var d=null,e=a.node,f=e instanceof uf?e:null;if(null===f||f.isSubGraphExpanded)var g=e.isTreeExpanded?e.findLinksConnected(a.port.portId):e.Ux();else{if(!f.actualBounds.v()){a.Gq=c;break a}d=f;g=d.Cv()}f=a.Yd.length=0;var h=a.port.ga(vc,I.alloc()),k=a.port.ga(Gc,I.alloc());e=N.allocAt(h.x,h.y,0,0);e.Ie(k);I.free(h);I.free(k);h=I.allocAt(e.x+e.width/2,e.y+e.height/2);k=a.port.aj();for(g=g.iterator;g.next();){var l=g.value;if(l.isVisible()&&
l.fromPort!==l.toPort){var m=l.fromPort===a.port||null!==l.fromNode&&l.fromNode.yd(d),n=l.computeSpot(m,a.port);if(n.gd()&&(m=m?l.toPort:l.fromPort,null!==m)){var p=m.part;if(null!==p){var r=p.findVisibleNode();null!==r&&r!==p&&(p=r,m=p.port);m=l.computeOtherPoint(p,m);p=h.Sa(m);p-=k;0>p?p+=360:360<=p&&(p-=360);n=Np(e,n,p,l.isOrthogonal);0===n?(n=4,180<p&&(p-=360)):90===n?(n=8,270<p&&(p-=360)):180===n?n=2:(n=1,90>p&&(p+=360));r=a.Yd[f];void 0===r?(r=new Op(l,p,n),a.Yd[f]=r):(r.link=l,r.angle=p,r.zc=
n);r.$v.set(m);f++}}}}I.free(h);a.Yd.sort(pp.prototype.l);k=a.Yd.length;d=-1;for(f=h=0;f<k;f++)g=a.Yd[f],void 0!==g&&(g.zc!==d&&(d=g.zc,h=0),g.xq=h,h++);d=-1;h=0;for(f=k-1;0<=f;f--)k=a.Yd[f],void 0!==k&&(k.zc!==d&&(d=k.zc,h=k.xq+1),k.gm=h);f=a.Yd;n=a.port;d=a.node.portSpreading;h=I.alloc();k=I.alloc();g=I.alloc();l=I.alloc();n.ga(vc,h);n.ga(yc,k);n.ga(Gc,g);n.ga(Cc,l);r=p=m=n=0;if(d===$o)for(var q=0;q<f.length;q++){var u=f[q];if(null!==u){var v=u.link.computeThickness();switch(u.zc){case 8:p+=v;break;
case 2:r+=v;break;case 1:n+=v;break;default:case 4:m+=v}}}var w=q=0,y=1,z=u=0;for(v=0;v<f.length;v++){var A=f[v];if(null!==A){if(q!==A.zc){q=A.zc;switch(q){case 8:var C=g;w=l;break;case 2:C=l;w=h;break;case 1:C=h;w=k;break;default:case 4:C=k,w=g}u=w.x-C.x;z=w.y-C.y;switch(q){case 8:p>Math.abs(u)?(y=Math.abs(u)/p,p=Math.abs(u)):y=1;break;case 2:r>Math.abs(z)?(y=Math.abs(z)/r,r=Math.abs(z)):y=1;break;case 1:n>Math.abs(u)?(y=Math.abs(u)/n,n=Math.abs(u)):y=1;break;default:case 4:m>Math.abs(z)?(y=Math.abs(z)/
m,m=Math.abs(z)):y=1}w=0}var G=A.Eq;if(d===$o){A=A.link.computeThickness();A*=y;G.set(C);switch(q){case 8:G.x=C.x+u/2+p/2-w-A/2;break;case 2:G.y=C.y+z/2+r/2-w-A/2;break;case 1:G.x=C.x+u/2-n/2+w+A/2;break;default:case 4:G.y=C.y+z/2-m/2+w+A/2}w+=A}else{var L=.5;d===Mo&&(L=(A.xq+1)/(A.gm+1));G.x=C.x+u*L;G.y=C.y+z*L}}}I.free(h);I.free(k);I.free(g);I.free(l);C=a.Yd;for(f=0;f<C.length;f++)d=C[f],null!==d&&(d.Av=a.computeEndSegmentLength(d));a.Gq=c;N.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}pp.prototype.l=function(a,b){return a===b?0:null===a?-1:null===b?1:a.zc<b.zc?-1:a.zc>b.zc?1:a.angle<b.angle?-1:a.angle>b.angle?1:0};
pp.prototype.computeEndSegmentLength=function(a){var b=a.link,c=b.computeEndSegmentLength(this.node,this.port,uc,b.fromPort===this.port),d=a.xq;if(0>d)return c;var e=a.gm;if(1>=e||!b.isOrthogonal)return c;b=a.$v;var f=a.Eq;if(2===a.zc||8===a.zc)d=e-1-d;return((a=2===a.zc||4===a.zc)?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)};pp.className="Knot";function Op(a,b,c){this.link=a;this.angle=b;this.zc=c;this.$v=new I;this.gm=this.xq=0;this.Eq=new I;this.Av=0}
Op.prototype.toString=function(){return this.link.toString()+" "+this.angle.toString()+" "+this.zc.toString()+":"+this.xq.toString()+"/"+this.gm.toString()+" "+this.Eq.toString()+" "+this.Av.toString()+" "+this.$v.toString()};Op.className="LinkInfo";function el(){this.vh=this.Vg=$c;this.uh=this.Ug=this.th=this.Tg=NaN;this.Yp=this.Pn=null;this.Zp=this.Qn=Infinity}
el.prototype.copy=function(){var a=new el;a.Vg=this.Vg.G();a.vh=this.vh.G();a.Tg=this.Tg;a.th=this.th;a.Ug=this.Ug;a.uh=this.uh;a.Pn=this.Pn;a.Yp=this.Yp;a.Qn=this.Qn;a.Zp=this.Zp;return a};el.className="LinkSettings";function Fi(){Ya(this);this.I=this.B=null;this.ri=this.ho=!0;this.mo=!1;this.$m=(new I(0,0)).freeze();this.jo=!0;this.io=null;this.$w="";this.u=null;this.lo=!1;this.l=null}
Fi.prototype.cloneProtected=function(a){a.ho=this.ho;a.ri=this.ri;a.mo=this.mo;a.$m.assign(this.$m);a.jo=this.jo;a.io=this.io;a.$w=this.$w;a.lo=!0};Fi.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};Fi.prototype.gb=function(){};Fi.prototype.toString=function(){var a=Ia(this.constructor);a+="(";null!==this.group&&(a+=" in "+this.group);null!==this.diagram&&(a+=" for "+this.diagram);return a+")"};
Fi.prototype.C=function(){if(this.isValidLayout){var a=this.diagram;if(null!==a&&!a.undoManager.isUndoingRedoing){var b=a.animationManager;!b.isTicking&&(b.defaultAnimation.isAnimating&&b.Xc(),this.isOngoing&&a.mk||this.isInitial&&!a.mk)&&(this.isValidLayout=!1,a.Bb())}}};Fi.prototype.createNetwork=function(){return new Pp(this)};Fi.prototype.makeNetwork=function(a){var b=this.createNetwork();a instanceof Q?(b.ug(a.nodes,!0),b.ug(a.links,!0)):a instanceof uf?b.ug(a.memberParts):b.ug(a.iterator);return b};
Fi.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.ua("Layout"),this.commitLayout()}finally{null!==a&&a.Va("Layout")}};Fi.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()}};
Fi.prototype.doLayout=function(a){var b=new F;a instanceof Q?(Qp(this,b,a.nodes,!0,this.wk,!0,!1,!0),Qp(this,b,a.parts,!0,this.wk,!0,!1,!0)):a instanceof uf?Qp(this,b,a.memberParts,!1,this.wk,!0,!1,!0):b.addAll(a.iterator);var c=b.count;if(0<c){a=this.diagram;null!==a&&a.ua("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;Rp(k);var l=
k.measuredBounds,m=l.width;l=l.height;k.moveTo(e,f);k instanceof uf&&(k.wk=!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.Va("Layout")}this.isValidLayout=!0};Fi.prototype.wk=function(a){return!a.location.v()||a instanceof uf&&a.wk?!0:!1};
function Qp(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 uf?null===k.layout?Qp(a,b,k.memberParts,!1,e,f,g,h):(Rp(k),b.add(k)):(Rp(k),b.add(k))):g&&k instanceof S?b.add(k):!h||!k.Wb()||k instanceof V||(Rp(k),b.add(k)))}}function Rp(a){var b=a.actualBounds;(0===b.width||0===b.height||isNaN(b.width)||isNaN(b.height))&&a.Ab()}
Fi.prototype.bj=function(a,b){var c=this.boundsComputation;if(null!==c)return b||(b=new N),c(a,this,b);if(!b)return a.actualBounds;b.set(a.actualBounds);return b};Fi.prototype.Kx=function(a){var b=new F;a instanceof Q?(Qp(this,b,a.nodes,!0,null,!0,!0,!0),Qp(this,b,a.links,!0,null,!0,!0,!0),Qp(this,b,a.parts,!0,null,!0,!0,!0)):a instanceof uf?Qp(this,b,a.memberParts,!1,null,!0,!0,!0):Qp(this,b,a.iterator,!1,null,!0,!0,!0);return b};
Fi.prototype.initialOrigin=function(a){var b=this.group;if(null!==b){var c=b.position.copy();(isNaN(c.x)||isNaN(c.y))&&c.set(a);b=b.placeholder;null!==b&&(c=b.ga(vc),(isNaN(c.x)||isNaN(c.y))&&c.set(a),a=b.padding,c.x+=a.left,c.y+=a.top);return c}return a};
ma.Object.defineProperties(Fi.prototype,{diagram:{get:function(){return this.B},set:function(a){this.B=a}},group:{get:function(){return this.I},set:function(a){this.I!==a&&(this.I=a,null!==a&&(this.B=a.diagram))}},isOngoing:{get:function(){return this.ho},set:function(a){this.ho!==a&&(this.ho=a)}},isInitial:{get:function(){return this.ri},set:function(a){this.ri=a;a||(this.lo=!0)}},
isViewportSized:{get:function(){return this.mo},set:function(a){this.mo!==a&&(this.mo=a)&&this.C()}},isRouting:{get:function(){return this.jo},set:function(a){this.jo!==a&&(this.jo=a)}},isRealtime:{get:function(){return this.io},set:function(a){this.io!==a&&(this.io=a)}},isValidLayout:{get:function(){return this.lo},set:function(a){this.lo!==a&&(this.lo=a,a||(a=this.diagram,null!==
a&&(a.Hg=!0)))}},network:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a,null!==a&&(a.layout=this))}},boundsComputation:{get:function(){return this.u},set:function(a){this.u!==a&&(this.u=a,this.C())}},arrangementOrigin:{get:function(){return this.$m},set:function(a){this.$m.w(a)||(this.$m.assign(a),this.C())}}});Fi.prototype.collectParts=Fi.prototype.Kx;Fi.prototype.getLayoutBounds=Fi.prototype.bj;
Fi.prototype.invalidateLayout=Fi.prototype.C;Fi.className="Layout";function Pp(a){Ya(this);this.ic=a;this.nf=new F;this.ge=new F;this.Nt=new H;this.It=new H}Pp.prototype.clear=function(){if(this.nf)for(var a=this.nf.iterator;a.next();)a.value.clear();if(this.ge)for(a=this.ge.iterator;a.next();)a.value.clear();this.nf=new F;this.ge=new F;this.Nt=new H;this.It=new H};
Pp.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.nf.count+" edges: "+this.ge.count;if(1<a){for(var c=this.nf.iterator;c.next();)b+="\n    "+c.value.toString(a-1);for(c=this.ge.iterator;c.next();)b+="\n    "+c.value.toString(a-1)}return b};Pp.prototype.createVertex=function(){return new Sp(this)};Pp.prototype.createEdge=function(){return new Tp(this)};
Pp.prototype.ug=function(a,b,c){if(null!==a){void 0===b&&(b=!1);void 0===c&&(c=null);null===c&&(c=function(a){if(a instanceof V)return!a.isLinkLabel;if(a instanceof S){var b=a.fromNode;if(null===b||b.isLinkLabel)return!1;a=a.toNode;return null===a||a.isLinkLabel?!1:!0}return!1});for(a=a.iterator;a.next();){var d=a.value;if(d instanceof V&&(!b||d.isTopLevel)&&d.canLayout()&&c(d))if(d instanceof uf&&null===d.layout)this.ug(d.memberParts,!1);else if(null===this.$i(d)){var e=this.createVertex();e.node=
d;this.Bh(e)}}for(a.reset();a.next();)if(d=a.value,d instanceof S&&(!b||d.isTopLevel)&&d.canLayout()&&c(d)&&null===this.qq(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.pk(f,e,d))}}};Pp.prototype.findGroupVertex=function(a){if(null===a)return null;var b=a.findVisibleNode();if(null===b)return null;a=this.$i(b);if(null!==a)return a;for(b=b.containingGroup;null!==b;){a=this.$i(b);if(null!==a)return a;b=b.containingGroup}return null};
t=Pp.prototype;t.Bh=function(a){if(null!==a){this.nf.add(a);var b=a.node;null!==b&&this.Nt.add(b,a);a.network=this}};t.cm=function(a){if(null===a)return null;var b=this.$i(a);null===b&&(b=this.createVertex(),b.node=a,this.Bh(b));return b};t.zv=function(a){if(null!==a&&Up(this,a)){for(var b=a.Cg,c=b.count-1;0<=c;c--){var d=b.L(c);this.gk(d)}b=a.vg;for(a=b.count-1;0<=a;a--)c=b.L(a),this.gk(c)}};
function Up(a,b){if(null===b)return!1;var c=a.nf.remove(b);c&&(b=b.node,null!==b&&a.Nt.remove(b));return c}t.lz=function(a){null!==a&&(a=this.$i(a),null!==a&&this.zv(a))};t.$i=function(a){return null===a?null:this.Nt.H(a)};t.hq=function(a){if(null!==a){Vp(this,a);var b=a.toVertex;null!==b&&b.qv(a);b=a.fromVertex;null!==b&&b.ov(a)}};function Vp(a,b){if(null!==b){a.ge.add(b);var c=b.link;null!==c&&null===a.qq(c)&&a.It.add(c,b);b.network=a}}
t.Sy=function(a){if(null===a)return null;var b=a.fromNode,c=a.toNode,d=this.qq(a);null===d?(d=this.createEdge(),d.link=a,null!==b&&(d.fromVertex=this.cm(b)),null!==c&&(d.toVertex=this.cm(c)),this.hq(d)):(null!==b?d.fromVertex=this.cm(b):d.fromVertex=null,null!==c?d.toVertex=this.cm(c):d.toVertex=null);return d};t.gk=function(a){if(null!==a){var b=a.toVertex;null!==b&&b.yv(a);b=a.fromVertex;null!==b&&b.xv(a);Wp(this,a)}};
function Wp(a,b){null!==b&&a.ge.remove(b)&&(b=b.link,null!==b&&a.It.remove(b))}t.kz=function(a){null!==a&&(a=this.qq(a),null!==a&&this.gk(a))};t.qq=function(a){return null===a?null:this.It.H(a)};t.pk=function(a,b,c){if(null===a||null===b)return null;if(a.network===this&&b.network===this){var d=this.createEdge();d.link=c;d.fromVertex=a;d.toVertex=b;this.hq(d);return d}return null};t.Fm=function(a){if(null!==a){var b=a.fromVertex,c=a.toVertex;null!==b&&null!==c&&(b.xv(a),c.yv(a),a.Fm(),b.qv(a),c.ov(a))}};
t.oq=function(){for(var a=Fa(),b=this.ge.iterator;b.next();){var c=b.value;c.fromVertex===c.toVertex&&a.push(c)}b=a.length;for(c=0;c<b;c++)this.gk(a[c]);Ha(a)};Pp.prototype.deleteArtificialVertexes=function(){for(var a=Fa(),b=this.nf.iterator;b.next();){var c=b.value;null===c.node&&a.push(c)}c=a.length;for(b=0;b<c;b++)this.zv(a[b]);b=Fa();for(c=this.ge.iterator;c.next();){var d=c.value;null===d.link&&b.push(d)}c=b.length;for(d=0;d<c;d++)this.gk(b[d]);Ha(a);Ha(b)};
function Xp(a){for(var b=Fa(),c=a.ge.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.gk(b[d]);Ha(b)}
Pp.prototype.By=function(a){void 0===a&&(a=!0);a&&(this.deleteArtificialVertexes(),Xp(this),this.oq());a=new E;for(var b=!0;b;){b=!1;for(var c=this.nf.iterator;c.next();){var d=c.value;if(0<d.Cg.count||0<d.vg.count){b=this.layout.createNetwork();a.add(b);Yp(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 Yp(a,b,c){if(null!==c&&c.network!==b){Up(a,c);b.Bh(c);for(var d=c.sourceEdges;d.next();){var e=d.value;e.network!==b&&(Wp(a,e),Vp(b,e),Yp(a,b,e.fromVertex))}for(d=c.destinationEdges;d.next();)c=d.value,c.network!==b&&(Wp(a,c),Vp(b,c),Yp(a,b,c.toVertex))}}Pp.prototype.qz=function(){for(var a=new F,b=this.nf.iterator;b.next();)a.add(b.value.node);for(b=this.ge.iterator;b.next();)a.add(b.value.link);return a};
ma.Object.defineProperties(Pp.prototype,{layout:{get:function(){return this.ic},set:function(a){null!==a&&(this.ic=a)}},vertexes:{get:function(){return this.nf}},edges:{get:function(){return this.ge}}});Pp.prototype.findAllParts=Pp.prototype.qz;Pp.prototype.splitIntoSubNetworks=Pp.prototype.By;Pp.prototype.deleteSelfEdges=Pp.prototype.oq;Pp.prototype.reverseEdge=Pp.prototype.Fm;Pp.prototype.linkVertexes=Pp.prototype.pk;
Pp.prototype.findEdge=Pp.prototype.qq;Pp.prototype.deleteLink=Pp.prototype.kz;Pp.prototype.deleteEdge=Pp.prototype.gk;Pp.prototype.addLink=Pp.prototype.Sy;Pp.prototype.addEdge=Pp.prototype.hq;Pp.prototype.findVertex=Pp.prototype.$i;Pp.prototype.deleteNode=Pp.prototype.lz;Pp.prototype.deleteVertex=Pp.prototype.zv;Pp.prototype.addNode=Pp.prototype.cm;Pp.prototype.addVertex=Pp.prototype.Bh;Pp.prototype.addParts=Pp.prototype.ug;Pp.className="LayoutNetwork";
function Sp(a){Ya(this);this.Yc=a;this.l=(new N(0,0,10,10)).freeze();this.u=(new I(5,5)).freeze();this.Ci=this.kb=null;this.Cg=new E;this.vg=new E}Sp.prototype.clear=function(){this.Ci=this.kb=null;this.Cg=new E;this.vg=new E};
Sp.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutVertex#"+lb(this);if(0<a&&(b+=null!==this.node?"("+this.node.toString()+")":"",1<a)){a="";for(var c=!0,d=this.Cg.iterator;d.next();){var e=d.value;c?c=!1:a+=",";a+=e.toString(0)}e="";c=!0;for(d=this.vg.iterator;d.next();){var f=d.value;c?c=!1:e+=",";e+=f.toString(0)}b+=" sources: "+a+" destinations: "+e}return b};
Sp.prototype.commit=function(){var a=this.kb;if(null!==a){var b=this.bounds,c=a.bounds;za(c)?(c.x=b.x,c.y=b.y,c.width=b.width,c.height=b.height):a.bounds=b.copy()}else if(a=this.node,null!==a){b=this.bounds;if(!(a instanceof uf)){c=N.alloc();var d=this.network.layout.bj(a,c),e=a.locationObject.ga(Ac);if(d.v()&&e.v()){a.moveTo(b.x+this.focusX-(e.x-d.x),b.y+this.focusY-(e.y-d.y));N.free(c);return}N.free(c)}a.moveTo(b.x,b.y)}};Sp.prototype.qv=function(a){null!==a&&(this.Cg.contains(a)||this.Cg.add(a))};
Sp.prototype.yv=function(a){null!==a&&this.Cg.remove(a)};Sp.prototype.ov=function(a){null!==a&&(this.vg.contains(a)||this.vg.add(a))};Sp.prototype.xv=function(a){null!==a&&this.vg.remove(a)};function Zp(a,b){a=a.Ci;b=b.Ci;return a?b?(a=a.text,b=b.text,a<b?-1:a>b?1:0):1:null!==b?-1:0}
ma.Object.defineProperties(Sp.prototype,{sourceEdgesArrayAccess:{get:function(){return this.Cg._dataArray}},destinationEdgesArrayAccess:{get:function(){return this.vg._dataArray}},data:{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.u.h(d/2,b/2);this.l.h(a,c,d,b)}}},node:{get:function(){return this.Ci},
set:function(a){if(this.Ci!==a){this.Ci=a;a.Ab();var b=this.network.layout,c=N.alloc(),d=b.bj(a,c);b=d.x;var e=d.y,f=d.width;d=d.height;isNaN(b)&&(b=0);isNaN(e)&&(e=0);this.l.h(b,e,f,d);N.free(c);if(!(a instanceof uf)&&(a=a.locationObject.ga(Ac),a.v())){this.u.h(a.x-b,a.y-e);return}this.u.h(f/2,d/2)}}},bounds:{get:function(){return this.l},set:function(a){this.l.w(a)||this.l.assign(a)}},focus:{get:function(){return this.u},set:function(a){this.u.w(a)||
this.u.assign(a)}},centerX:{get:function(){return this.l.x+this.u.x},set:function(a){var b=this.l;b.x+this.u.x!==a&&(b.ea(),b.x=a-this.u.x,b.freeze())}},centerY:{get:function(){return this.l.y+this.u.y},set:function(a){var b=this.l;b.y+this.u.y!==a&&(b.ea(),b.y=a-this.u.y,b.freeze())}},focusX:{get:function(){return this.u.x},set:function(a){var b=this.u;b.x!==a&&(b.ea(),b.x=a,b.freeze())}},focusY:{
get:function(){return this.u.y},set:function(a){var b=this.u;b.y!==a&&(b.ea(),b.y=a,b.freeze())}},x:{get:function(){return this.l.x},set:function(a){var b=this.l;b.x!==a&&(b.ea(),b.x=a,b.freeze())}},y:{get:function(){return this.l.y},set:function(a){var b=this.l;b.y!==a&&(b.ea(),b.y=a,b.freeze())}},width:{get:function(){return this.l.width},set:function(a){var b=this.l;b.width!==a&&(b.ea(),b.width=
a,b.freeze())}},height:{get:function(){return this.l.height},set:function(a){var b=this.l;b.height!==a&&(b.ea(),b.height=a,b.freeze())}},network:{get:function(){return this.Yc},set:function(a){this.Yc=a}},sourceVertexes:{get:function(){for(var a=new F,b=this.sourceEdges;b.next();)a.add(b.value.fromVertex);return a.iterator}},destinationVertexes:{get:function(){for(var a=new F,b=
this.destinationEdges;b.next();)a.add(b.value.toVertex);return a.iterator}},vertexes:{get:function(){for(var a=new F,b=this.sourceEdges;b.next();)a.add(b.value.fromVertex);for(b=this.destinationEdges;b.next();)a.add(b.value.toVertex);return a.iterator}},sourceEdges:{get:function(){return this.Cg.iterator}},destinationEdges:{get:function(){return this.vg.iterator}},edges:{get:function(){for(var a=
new E,b=this.sourceEdges;b.next();)a.add(b.value);for(b=this.destinationEdges;b.next();)a.add(b.value);return a.iterator}},edgesCount:{get:function(){return this.Cg.count+this.vg.count}}});Sp.prototype.deleteDestinationEdge=Sp.prototype.xv;Sp.prototype.addDestinationEdge=Sp.prototype.ov;Sp.prototype.deleteSourceEdge=Sp.prototype.yv;Sp.prototype.addSourceEdge=Sp.prototype.qv;Sp.className="LayoutVertex";Sp.standardComparer=Zp;
Sp.smartComparer=function(a,b){if(null!==a){if(null!==b){a=a.Ci;var c=b.Ci;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 Tp(a){Ya(this);this.kd=a;this.qg=this.Sf=this.vl=this.kb=null}Tp.prototype.clear=function(){this.qg=this.Sf=this.vl=this.kb=null};Tp.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutEdge#"+lb(this);0<a&&(b+=null!==this.vl?"("+this.vl.toString()+")":"",1<a&&(b+=" "+(this.Sf?this.Sf.toString():"null")+" --\x3e "+(this.qg?this.qg.toString():"null")));return b};
Tp.prototype.Fm=function(){var a=this.Sf;this.Sf=this.qg;this.qg=a};Tp.prototype.commit=function(){};Tp.prototype.ey=function(a){return this.qg===a?this.Sf:this.Sf===a?this.qg:null};
ma.Object.defineProperties(Tp.prototype,{network:{get:function(){return this.kd},set:function(a){this.kd=a}},data:{get:function(){return this.kb},set:function(a){this.kb!==a&&(this.kb=a)}},link:{get:function(){return this.vl},set:function(a){this.vl!==a&&(this.vl=a)}},fromVertex:{get:function(){return this.Sf},set:function(a){this.Sf!==a&&(this.Sf=a)}},toVertex:{
get:function(){return this.qg},set:function(a){this.qg!==a&&(this.qg=a)}}});Tp.prototype.getOtherVertex=Tp.prototype.ey;Tp.className="LayoutEdge";function Mk(){Fi.call(this);this.isViewportSized=!0;this.eq=this.fq=NaN;this.Kg=(new M(NaN,NaN)).freeze();this.ef=(new M(10,10)).freeze();this.xb=$p;this.Cb=aq;this.Rc=bq;this.Mc=cq}la(Mk,Fi);
Mk.prototype.cloneProtected=function(a){Fi.prototype.cloneProtected.call(this,a);a.fq=this.fq;a.eq=this.eq;a.Kg.assign(this.Kg);a.ef.assign(this.ef);a.xb=this.xb;a.Cb=this.Cb;a.Rc=this.Rc;a.Mc=this.Mc};Mk.prototype.gb=function(a){a.classType===Mk?a===bq||a===dq||a===eq||a===fq?this.sorting=a:a===aq||a===gq?this.arrangement=a:a===$p||a===hq?this.alignment=a:B("Unknown enum value: "+a):Fi.prototype.gb.call(this,a)};
Mk.prototype.doLayout=function(a){this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);var b=this.Kx(a);a=this.diagram;for(var c=b.copy().iterator;c.next();){var d=c.value;if(!d.Jh()||null===d.fromNode&&null===d.toNode){if(d.Ab(),d instanceof uf)for(d=d.memberParts;d.next();)b.remove(d.value)}else b.remove(d)}var e=b.na();if(0!==e.length){switch(this.sorting){case fq:e.reverse();break;case bq:e.sort(this.comparer);break;case dq: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.ua("Layout");d=[];switch(this.alignment){case hq:var h=b,k=c,l=N.alloc(),m=Math.max(this.cellSize.width,1);if(!isFinite(m))for(var n=m=0;n<e.length;n++){var p=this.bj(e[n],l);m=Math.max(m,p.width)}m=Math.max(m+h,1);n=Math.max(this.cellSize.height,
1);if(!isFinite(n))for(p=n=0;p<e.length;p++){var r=this.bj(e[p],l);n=Math.max(n,r.height)}n=Math.max(n+k,1);p=this.arrangement;for(var q=r=this.arrangementOrigin.x,u=this.arrangementOrigin.y,v=0,w=0,y=0;y<e.length;y++){var z=e[y],A=this.bj(z,l),C=Math.ceil((A.width+h)/m)*m,G=Math.ceil((A.height+k)/n)*n;switch(p){case gq:var L=Math.abs(q-A.width);break;default:L=q+A.width}if(0<f&&v>f-1||0<g&&0<v&&L-r>g)d.push(new N(0,u,g+h,w)),v=0,q=r,u+=w,w=0;w=Math.max(w,G);switch(p){case gq:A=-A.width;break;default:A=
0}z.moveTo(q+A,u);switch(p){case gq:q-=C;break;default:q+=C}v++}d.push(new N(0,u,g+h,w));N.free(l);break;case $p:k=g;m=f;n=b;p=c;g=N.alloc();r=Math.max(this.cellSize.width,1);f=u=l=0;h=I.alloc();for(q=0;q<e.length;q++)w=e[q],v=this.bj(w,g),w=w.wf(w.locationObject,w.locationSpot,h),l=Math.max(l,w.x),u=Math.max(u,v.width-w.x),f=Math.max(f,w.y);q=this.arrangement;switch(q){case gq:l+=n;break;default:u+=n}r=isFinite(r)?Math.max(r+n,1):Math.max(l+u,1);var J=w=this.arrangementOrigin.x;y=this.arrangementOrigin.y;
u=0;k>=l&&(k-=l);l=z=0;C=Math.max(this.cellSize.height,1);A=f=0;G=!0;v=I.alloc();for(L=0;L<e.length;L++){var U=e[L],R=this.bj(U,g),ca=U.wf(U.locationObject,U.locationSpot,h);if(0<u)switch(q){case gq:J=(J-w-(R.width-ca.x))/r;J=K.$(Math.round(J),J)?Math.round(J):Math.floor(J);J=J*r+w;break;default:J=(J-w+ca.x)/r,J=K.$(Math.round(J),J)?Math.round(J):Math.ceil(J),J=J*r+w}else switch(q){case gq:z=J+ca.x+R.width;break;default:z=J-ca.x}switch(q){case gq:var pa=-(J+ca.x)+z;break;default:pa=J+R.width-ca.x-
z}if(0<m&&u>m-1||0<k&&0<u&&pa>k){d.push(new N(0,G?y-f:y,k+n,A+f+p));for(J=0;J<u&&L!==u;J++){pa=e[L-u+J];var O=pa.wf(pa.locationObject,pa.locationSpot,v);pa.moveTo(pa.position.x,pa.position.y+f-O.y)}A+=p;y=G?y+A:y+(A+f);u=A=f=0;J=w;G=!1}J===w&&(l=q===gq?Math.max(l,R.width-ca.x):Math.min(l,-ca.x));f=Math.max(f,ca.y);A=Math.max(A,R.height-ca.y);isFinite(C)&&(A=Math.max(A,Math.max(R.height,C)-ca.y));G?U.moveTo(J-ca.x,y-ca.y):U.moveTo(J-ca.x,y);switch(q){case gq:J-=ca.x+n;break;default:J+=R.width-ca.x+
n}u++}d.push(new N(0,y,k+n,(G?A:A+f)+p));if(e.length!==u)for(k=0;k<u;k++)m=e[e.length-u+k],n=m.wf(m.locationObject,m.locationSpot,h),m.moveTo(m.position.x,m.position.y+f-n.y);I.free(h);I.free(v);if(q===gq)for(e=0;e<d.length;e++)f=d[e],f.width+=l,f.x-=l;else for(e=0;e<d.length;e++)f=d[e],f.x>l&&(f.width+=f.x-l,f.x=l);N.free(g)}for(h=f=g=e=0;h<d.length;h++)k=d[h],e=Math.min(e,k.x),g=Math.min(g,k.y),f=Math.max(f,k.x+k.width);this.arrangement===gq?this.commitLayers(d,new I(e+b/2-(f+e),g-c/2)):this.commitLayers(d,
new I(e-b/2,g-c/2));null!==a&&a.Va("Layout");this.isValidLayout=!0}};Mk.prototype.commitLayers=function(){};function cq(a,b){a=a.text;b=b.text;return a<b?-1:a>b?1:0}
ma.Object.defineProperties(Mk.prototype,{wrappingWidth:{get:function(){return this.fq},set:function(a){this.fq!==a&&(0<a||isNaN(a))&&(this.fq=a,this.isViewportSized=isNaN(a),this.C())}},wrappingColumn:{get:function(){return this.eq},set:function(a){this.eq!==a&&(0<a||isNaN(a))&&(this.eq=a,this.C())}},cellSize:{get:function(){return this.Kg},set:function(a){this.Kg.w(a)||(this.Kg.assign(a),this.C())}},spacing:{
get:function(){return this.ef},set:function(a){this.ef.w(a)||(this.ef.assign(a),this.C())}},alignment:{get:function(){return this.xb},set:function(a){this.xb===a||a!==$p&&a!==hq||(this.xb=a,this.C())}},arrangement:{get:function(){return this.Cb},set:function(a){this.Cb===a||a!==aq&&a!==gq||(this.Cb=a,this.C())}},sorting:{get:function(){return this.Rc},set:function(a){this.Rc===a||a!==eq&&a!==fq&&
a!==bq&&a!==dq||(this.Rc=a,this.C())}},comparer:{get:function(){return this.Mc},set:function(a){this.Mc!==a&&(this.Mc=a,this.C())}}});var hq=new D(Mk,"Position",0),$p=new D(Mk,"Location",1),aq=new D(Mk,"LeftToRight",2),gq=new D(Mk,"RightToLeft",3),eq=new D(Mk,"Forward",4),fq=new D(Mk,"Reverse",5),bq=new D(Mk,"Ascending",6),dq=new D(Mk,"Descending",7);Mk.className="GridLayout";Mk.standardComparer=cq;
Mk.smartComparer=function(a,b){if(null!==a){if(null!==b){a=a.text.toLocaleLowerCase().split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/);b=b.text.toLocaleLowerCase().split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/);for(var c=0;c<a.length;c++)if(""!==b[c]&&void 0!==b[c]){var d=parseFloat(a[c]),e=parseFloat(b[c]);if(isNaN(d))if(isNaN(e)){if(0!==a[c].localeCompare(b[c]))return a[c].localeCompare(b[c])}else return 1;else{if(isNaN(e))return-1;if(0!==d-e)return d-e}}else if(""!==a[c])return 1;return""!==
b[c]&&void 0!==b[c]?-1:0}return 1}return null!==b?-1:0};Mk.Position=hq;Mk.Location=$p;Mk.LeftToRight=aq;Mk.RightToLeft=gq;Mk.Forward=eq;Mk.Reverse=fq;Mk.Ascending=bq;Mk.Descending=dq;function ti(){this.Xo=new F;this.xo=new F;this.Ca=new F;this.Oe=new H;this.Ne=new H;this.Bj=new H;this.B=null;this.br=!1}t=ti.prototype;t.clear=function(){this.Xo.clear();this.xo.clear();this.Ca.clear();this.Oe.clear();this.Ne.clear();this.Bj.clear()};t.$d=function(a){this.B=a};
t.cj=function(a){if(a instanceof V){if(this.Xo.add(a),a instanceof uf){var b=a.containingGroup;null===b?this.B.wh.add(a):b.Al.add(a);b=a.layout;null!==b&&(b.diagram=this.B)}}else a instanceof S?this.xo.add(a):a instanceof Ke||this.Ca.add(a);b=a.data;null===b||a instanceof Ke||(a instanceof S?this.Ne.add(b,a):this.Oe.add(b,a))};
t.Hc=function(a){a.$j();if(a instanceof V){if(this.Xo.remove(a),a instanceof uf){var b=a.containingGroup;null===b?this.B.wh.remove(a):b.Al.remove(a);b=a.layout;null!==b&&(b.diagram=null)}}else a instanceof S?this.xo.remove(a):a instanceof Ke||this.Ca.remove(a);b=a.data;null===b||a instanceof Ke||(a instanceof S?this.Ne.remove(b):this.Oe.remove(b))};
t.Ad=function(){for(var a=this.B.nodeTemplateMap.iterator;a.next();){var b=a.value,c=a.key;(!b.Wb()||b instanceof uf)&&B('Invalid node template in Diagram.nodeTemplateMap: template for "'+c+'" must be a Node or a simple Part, not a Group or Link: '+b)}for(a=this.B.groupTemplateMap.iterator;a.next();)b=a.value,c=a.key,b instanceof uf||B('Invalid group template in Diagram.groupTemplateMap: template for "'+c+'" must be a Group, not a normal Node or Link: '+b);for(a=this.B.linkTemplateMap.iterator;a.next();)b=
a.value,c=a.key,b instanceof S||B('Invalid link template in Diagram.linkTemplateMap: template for "'+c+'" must be a Link, not a normal Node or simple Part: '+b);a=Fa();for(b=this.B.selection.iterator;b.next();)(c=b.value.data)&&a.push(c);b=Fa();for(c=this.B.highlighteds.iterator;c.next();){var d=c.value.data;d&&b.push(d)}c=Fa();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]);Ha(a);Ha(b);Ha(c)};ti.prototype.addAllModeledParts=function(){this.addModeledParts(this.diagram.model.nodeDataArray)};
ti.prototype.addModeledParts=function(a,b){var c=this,d=this.diagram.model;a.forEach(function(a){d.Ya(a)&&iq(c,a,!1)});a.forEach(function(a){d.Ya(a)&&c.resolveReferencesForData(a)});!1!==b&&pk(this.diagram,!1)};
function iq(a,b,c){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.Oe.contains(b)){void 0===c&&(c=!0);a:{if(void 0!==b&&null!==b&&!a.B.undoManager.isUndoingRedoing&&!a.Oe.contains(b)){var d=a.uq(b);var e=Ko(a,b,d);if(null!==e&&(wg(e),e=e.copy(),null!==e)){var f=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.If=d;e.kb=b;a.br&&(e.ah="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)}}
ti.prototype.insertLink=function(){return null};ti.prototype.resolveReferencesForData=function(){};ti.prototype.uq=function(a){return this.B.model.uq(a)};
function Ko(a,b,c){a=a.B;var d=a.model;d.lk()&&d.Rv(b)?(b=a.groupTemplateMap.H(c),null===b&&(b=a.groupTemplateMap.H(""),null===b&&(jq||(jq=!0,wa('No Group template found for category "'+c+'"'),wa("  Using default group template")),b=a.qu))):(b=a.nodeTemplateMap.H(c),null===b&&(b=a.nodeTemplateMap.H(""),null===b&&(kq||(kq=!0,wa('No Node template found for category "'+c+'"'),wa("  Using default node template")),b=a.su)));return b}ti.prototype.getLinkCategoryForData=function(){return""};
ti.prototype.setLinkCategoryForData=function(){};ti.prototype.setFromNodeForLink=function(){};ti.prototype.setToNodeForLink=function(){};ti.prototype.findLinkTemplateForCategory=function(a){var b=this.B.linkTemplateMap.H(a);null===b&&(b=this.B.linkTemplateMap.H(""),null===b&&(lq||(lq=!0,wa('No Link template found for category "'+a+'"'),wa("  Using default link template")),b=this.B.ru));return b};ti.prototype.removeAllModeledParts=function(){this.Tt(this.diagram.model.nodeDataArray)};
ti.prototype.Tt=function(a){var b=this;a.forEach(function(a){b.Oq(a)})};ti.prototype.Oq=function(a){a=this.xc(a);null!==a&&(Mj(this.diagram,a,!1),this.unresolveReferencesForPart(a))};ti.prototype.unresolveReferencesForPart=function(){};ti.prototype.removeDataForLink=function(){};ti.prototype.findPartForKey=function(a){if(null===a||void 0===a)return null;a=this.B.model.Kb(a);return null!==a?this.Oe.H(a):null};
ti.prototype.Lb=function(a){if(null===a||void 0===a)return null;a=this.B.model.Kb(a);if(null===a)return null;a=this.Oe.H(a);return a instanceof V?a:null};ti.prototype.findLinkForKey=function(){return null};t=ti.prototype;t.xc=function(a){if(null===a)return null;var b=this.Oe.H(a);return null!==b?b:b=this.Ne.H(a)};t.Wi=function(a){if(null===a)return null;a=this.Oe.H(a);return a instanceof V?a:null};t.wc=function(a){return null===a?null:this.Ne.H(a)};
t.vt=function(a){for(var b=0;b<arguments.length;++b);b=new F;for(var c=this.Xo.iterator;c.next();){var d=c.value,e=d.data;if(null!==e)for(var f=0;f<arguments.length;f++){var g=arguments[f];if(za(g)&&mq(this,e,g)){b.add(d);break}}}return b.iterator};t.ut=function(a){for(var b=0;b<arguments.length;++b);b=new F;for(var c=this.xo.iterator;c.next();){var d=c.value,e=d.data;if(null!==e)for(var f=0;f<arguments.length;f++){var g=arguments[f];if(za(g)&&mq(this,e,g)){b.add(d);break}}}return b.iterator};
function mq(a,b,c){for(var d in c){var e=b[d],f=c[d];if(Aa(f)){if(!Aa(e)||e.length<f.length)return!1;for(var g=0;g<e.length;g++){var h=f[g];if(void 0!==h&&!nq(a,e[g],h))return!1}}else if(!nq(a,e,f))return!1}return!0}function nq(a,b,c){if("function"===typeof c){if(!c(b))return!1}else if(c instanceof RegExp){if(!b||!c.test(b.toString()))return!1}else if(za(b)&&za(c)){if(!mq(a,b,c))return!1}else if(b!==c)return!1;return!0}
ti.prototype.doModelChanged=function(a){if(this.B){var b=this.B;if(a.model===b.model){var c=a.change;b.doModelChanged(a);if(b.Z){b.Z=!1;try{var d=a.modelChange;if(""!==d)if(c===ue){if("nodeCategory"===d){var e=this.xc(a.object),f=a.newValue;null!==e&&"string"===typeof f&&(e.category=f)}else"nodeDataArray"===d&&(this.Tt(a.oldValue),this.addModeledParts(a.newValue));b.isModified=!0}else if(c===we){var g=a.newValue;"nodeDataArray"===d&&za(g)&&iq(this,g);b.isModified=!0}else if(c===xe){var h=a.oldValue;
"nodeDataArray"===d&&za(h)&&this.Oq(h);b.isModified=!0}else c===ve&&("SourceChanged"===d?null!==a.object?this.updateDataBindings(a.object,a.propertyName):(this.Yq(),this.updateAllTargetBindings()):"ModelDisplaced"===d&&this.Ad());else if(c===ue){var k=a.propertyName,l=a.object;if(l===b.model){if("nodeKeyProperty"===k||"nodeCategoryProperty"===k)b.undoManager.isUndoingRedoing||this.Ad()}else this.updateDataBindings(l,k);b.isModified=!0}else if(c===we||c===xe){var m=a.change===we,n=m?a.newParam:a.oldParam,
p=m?a.newValue:a.oldValue,r=this.Bj.H(a.object);if(Array.isArray(r))for(a=0;a<r.length;a++){var q=r[a];if(m)mn(q,p,n);else if(!(0>n)){var u=n+en(q);q.Hc(u,!0);qn(q,u,n)}}b.isModified=!0}}finally{b.Z=!0}}}}};ti.prototype.updateAllTargetBindings=function(a){void 0===a&&(a="");for(var b=this.parts.iterator;b.next();)b.value.Ba(a);for(b=this.nodes.iterator;b.next();)b.value.Ba(a);for(b=this.links.iterator;b.next();)b.value.Ba(a)};
ti.prototype.Yq=function(){for(var a=this.B.model,b=new F,c=a.nodeDataArray,d=0;d<c.length;d++)b.add(c[d]);var e=[];this.nodes.each(function(a){null===a.data||b.contains(a.data)||e.push(a.data)});this.parts.each(function(a){null===a.data||b.contains(a.data)||e.push(a.data)});e.forEach(function(b){oq(a,b,!1)});for(d=0;d<c.length;d++){var f=c[d];null===this.xc(f)&&pq(a,f,!1)}this.refreshDataBoundLinks();for(c=this.parts.iterator;c.next();)c.value.updateRelationshipsFromData();for(c=this.nodes.iterator;c.next();)c.value.updateRelationshipsFromData();
for(c=this.links.iterator;c.next();)c.value.updateRelationshipsFromData()};ti.prototype.refreshDataBoundLinks=function(){};ti.prototype.updateRelationshipsFromData=function(){};
ti.prototype.updateDataBindings=function(a,b){if("string"===typeof b){var c=this.xc(a);if(null!==c)c.Ba(b);else{c=null;for(var d=this.Bj.iterator;d.next();){for(var e=d.value,f=0;f<e.length;f++){var g=e[f].Vx(a);null!==g&&(null===c&&(c=Fa()),c.push(g))}if(null!==c)break}if(null!==c){for(d=0;d<c.length;d++)c[d].Ba(b);Ha(c)}}a===this.diagram.model.modelData&&this.updateAllTargetBindings(b)}};
function Ij(a,b){var c=b.ui;if(Aa(c)){var d=a.Bj.H(c);if(null===d)d=[],d.push(b),a.Bj.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}function Lj(a,b,c){Gj(b,function(a){a=a.W.j;for(var b=a.length,d=0;d<b;d++)nk(c,a[d])});var d=b.ui;if(Aa(d)){var e=a.Bj.H(d);if(null!==e)for(var f=0;f<e.length;f++)if(e[f]===b){e.splice(f,1);0===e.length&&a.Bj.remove(d);break}}}
ti.prototype.ek=function(a,b,c){var d=new H;if(Aa(a))for(var e=0;e<a.length;e++)qq(this,a[e],b,d,c);else for(a=a.iterator;a.next();)qq(this,a.value,b,d,c);if(null!==b){c=b.model;a=b.toolManager.findTool("Dragging");a=null!==a?a.dragOptions.dragsLink:b.Sk.dragsLink;e=new F;for(var f=new H,g=d.iterator;g.next();){var h=g.value;if(h instanceof S)a||null!==h.fromNode&&null!==h.toNode||e.add(h);else if(h instanceof V&&null!==h.data&&c.rm()){var k=h;h=g.key;var l=h.yg();null!==l&&(l=d.H(l),null!==l?(c.ae(k.data,
c.ja(l.data)),k=b.wc(k.data),h=h.Zi(),null!==h&&null!==k&&f.add(h,k)):c.ae(k.data,void 0))}}0<e.count&&b.Ut(e,!1);if(0<f.count)for(c=f.iterator;c.next();)d.add(c.key,c.value)}if(null!==b&&null!==this.B&&(b=b.model,c=b.afterCopyFunction,null!==c)){var m=new H;d.each(function(a){null!==a.key.data&&m.add(a.key.data,a.value.data)});c(m,b,this.B.model)}for(b=d.iterator;b.next();)b.value.Ba();return d};
function qq(a,b,c,d,e){if(null===b||e&&!b.canCopy())return null;if(d.contains(b))return d.H(b);var f=a.copyPartData(b,c);if(!(f instanceof T))return null;f.isSelected=!1;f.isHighlighted=!1;d.add(b,f);if(b instanceof V){for(var g=b.linksConnected;g.next();){var h=g.value;if(h.fromNode===b){var k=d.H(h);null!==k&&(k.fromNode=f)}h.toNode===b&&(h=d.H(h),null!==h&&(h.toNode=f))}if(b instanceof uf&&f instanceof uf)for(b=b.memberParts;b.next();)g=qq(a,b.value,c,d,e),g instanceof S||null===g||(g.containingGroup=
f)}else if(b instanceof S&&f instanceof S)for(g=b.fromNode,null!==g&&(g=d.H(g),null!==g&&(f.fromNode=g)),g=b.toNode,null!==g&&(g=d.H(g),null!==g&&(f.toNode=g)),b=b.labelNodes;b.next();)g=qq(a,b.value,c,d,e),null!==g&&g instanceof V&&(g.labeledLink=f);return f}
ti.prototype.copyPartData=function(a,b){var c=null,d=a.data;if(null!==d&&null!==b){var e=b.model;a instanceof S||(d=e.copyNodeData(d),za(d)&&(e.pf(d),c=b.xc(d)))}else wg(a),c=a.copy(),null!==c&&(e=this.B,null!==b?b.add(c):null!==d&&null!==e&&null!==e.commandHandler&&e.commandHandler.copiesClipboardData&&(b=e.model,e=null,c instanceof S||(e=b.copyNodeData(d)),za(e)&&(c.data=e)));return c};
ma.Object.defineProperties(ti.prototype,{nodes:{get:function(){return this.Xo}},links:{get:function(){return this.xo}},parts:{get:function(){return this.Ca}},diagram:{get:function(){return this.B}},addsToTemporaryLayer:{get:function(){return this.br},set:function(a){this.br=a}}});ti.prototype.updateAllRelationshipsFromData=ti.prototype.Yq;
ti.prototype.findLinksByExample=ti.prototype.ut;ti.prototype.findNodesByExample=ti.prototype.vt;ti.prototype.findLinkForData=ti.prototype.wc;ti.prototype.findNodeForData=ti.prototype.Wi;ti.prototype.findPartForData=ti.prototype.xc;ti.prototype.findNodeForKey=ti.prototype.Lb;ti.prototype.removeModeledPart=ti.prototype.Oq;ti.prototype.removeModeledParts=ti.prototype.Tt;ti.prototype.rebuildParts=ti.prototype.Ad;var kq=!1,jq=!1,lq=!1;ti.className="PartManager";
function rq(a){ti.apply(this,arguments)}la(rq,ti);rq.prototype.addAllModeledParts=function(){var a=this.diagram.model;this.addModeledParts(a.nodeDataArray);sq(this,a.linkDataArray)};rq.prototype.addModeledParts=function(a){ti.prototype.addModeledParts.call(this,a,!1);for(a=this.links.iterator;a.next();)Lo(a.value);pk(this.diagram,!1)};function sq(a,b){b.forEach(function(b){tq(a,b)});pk(a.diagram,!1)}
function tq(a,b){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.Ne.contains(b)){var c=a.getLinkCategoryForData(b),d=a.findLinkTemplateForCategory(c);if(null!==d){wg(d);var e=d.copy();if(null!==e){d=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.If=c;e.kb=b;c=a.diagram.model;var f=uq(c,b,!0);""!==f&&(e.fromPortId=f);f=vq(c,b,!0);void 0!==f&&(f=a.Lb(f),f instanceof V&&(e.fromNode=f));f=uq(c,b,!1);""!==f&&(e.toPortId=f);f=vq(c,b,!1);void 0!==f&&(f=a.Lb(f),
f instanceof V&&(e.toNode=f));c=c.vf(b);Array.isArray(c)&&c.forEach(function(b){b=a.Lb(b);null!==b&&(b.labeledLink=e)});a.br&&(e.ah="Tool");a.diagram.add(e);e.kb=null;e.data=b;a.diagram.skipsModelSourceBindings=d}}}}rq.prototype.removeAllModeledParts=function(){var a=this.diagram.model;wq(this,a.linkDataArray);this.Tt(a.nodeDataArray)};function wq(a,b){b.forEach(function(b){a.Oq(b)})}rq.prototype.getLinkCategoryForData=function(a){return this.diagram.model.yt(a)};
rq.prototype.setLinkCategoryForData=function(a,b){return this.diagram.model.Rq(a,b)};rq.prototype.setFromNodeForLink=function(a,b){var c=this.diagram.model;c.nw(a.data,c.ja(null!==b?b.data:null))};rq.prototype.setToNodeForLink=function(a,b){var c=this.diagram.model;c.sw(a.data,c.ja(null!==b?b.data:null))};rq.prototype.removeDataForLink=function(a){this.diagram.model.Am(a.data)};
rq.prototype.findPartForKey=function(a){var b=ti.prototype.findPartForKey.call(this,a);return null===b&&(a=this.diagram.model.wg(a),null!==a)?this.Ne.H(a):b};rq.prototype.findLinkForKey=function(a){if(null===a||void 0===a)return null;a=this.diagram.model.wg(a);return null!==a?this.Ne.H(a):null};
rq.prototype.doModelChanged=function(a){var b=this;ti.prototype.doModelChanged.call(this,a);if(this.diagram){var c=this.diagram;if(a.model===c.model){var d=a.change;if(c.Z){c.Z=!1;try{var e=a.modelChange;if(""!==e)if(d===ue){if("linkFromKey"===e){var f=this.wc(a.object);if(null!==f){var g=this.Lb(a.newValue);f.fromNode=g}}else if("linkToKey"===e){var h=this.wc(a.object);if(null!==h){var k=this.Lb(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 r=this.xc(a.object);if(null!==r){var q=a.newValue;if(void 0!==q){var u=this.Lb(q);u instanceof uf?r.containingGroup=u:r.containingGroup=null}else r.containingGroup=null}}else if("linkLabelKeys"===e){var v=this.wc(a.object);if(null!==v){var w=a.oldValue,y=a.newValue;Array.isArray(w)&&w.forEach(function(a){0<=y.indexOf(a)||
(a=b.Lb(a),null!==a&&(a.labeledLink=null))});Array.isArray(y)&&y.forEach(function(a){a=b.Lb(a);null!==a&&(a.labeledLink=v)})}}else if("linkCategory"===e){var z=this.wc(a.object),A=a.newValue;null!==z&&"string"===typeof A&&(z.category=A)}else"linkDataArray"===e&&(wq(this,a.oldValue),sq(this,a.newValue));c.isModified=!0}else if(d===we){var C=a.newValue;if("linkDataArray"===e&&"object"===typeof C&&null!==C)tq(this,C);else if("linkLabelKeys"===e&&xq(C)){var G=this.wc(a.object),L=this.Lb(C);null!==G&&
null!==L&&(L.labeledLink=G)}c.isModified=!0}else{if(d===xe){var J=a.oldValue;if("linkDataArray"===e&&"object"===typeof J&&null!==J)this.Oq(J);else if("linkLabelKeys"===e&&xq(J)){var U=this.Lb(J);null!==U&&(U.labeledLink=null)}c.isModified=!0}}else if(d===ue){var R=a.propertyName;a.object!==c.model||"linkFromKeyProperty"!==R&&"linkToKeyProperty"!==R&&"linkFromPortIdProperty"!==R&&"linkToPortIdProperty"!==R&&"linkLabelKeysProperty"!==R&&"nodeIsGroupProperty"!==R&&"nodeGroupKeyProperty"!==R&&"linkCategoryProperty"!==
R||c.undoManager.isUndoingRedoing||this.Ad();c.isModified=!0}}finally{c.Z=!0}}}}};rq.prototype.refreshDataBoundLinks=function(){var a=this,b=this.diagram.model,c=new F,d=b.linkDataArray;d.forEach(function(a){c.add(a)});var e=[];this.links.each(function(a){null===a.data||c.contains(a.data)||e.push(a.data)});e.forEach(function(a){yq(b,a,!1)});d.forEach(function(c){null===a.wc(c)&&zq(b,c,!1)})};
rq.prototype.updateRelationshipsFromData=function(a){var b=a.data;if(null!==b){var c=a.diagram;if(null!==c){var d=c.model;if(a instanceof S){var e=vq(d,b,!0);e=c.Lb(e);a.fromNode=e;e=vq(d,b,!1);e=c.Lb(e);a.toNode=e;b=d.vf(b);if(0<b.length||0<a.labelNodes.count){if(1===b.length&&1===a.labelNodes.count){e=b[0];var f=a.labelNodes.first();if(d.ja(f.data)===e)return}e=(new F).addAll(b);var g=new F;a.labelNodes.each(function(a){null!==a.data&&(a=d.ja(a.data),void 0!==a&&g.add(a))});b=g.copy();b.Nq(e);e=
e.copy();e.Nq(g);if(0<b.count||0<e.count)b.each(function(b){b=c.Lb(b);null!==b&&b.labeledLink===a&&(b.labeledLink=null)}),e.each(function(b){b=c.Lb(b);null!==b&&b.labeledLink!==a&&(b.labeledLink=a)})}}else!(a instanceof Ke)&&(b=d.Fh(b),b=c.findPartForKey(b),null===b||b instanceof uf)&&(a.containingGroup=b)}}};
rq.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.ja(a);if(void 0!==c){var d=Aq(b,c),e=this.xc(a);if(null!==d&&null!==e){d=d.iterator;for(var f={};d.next();){var g=d.value;b.Ya(g)?e instanceof uf&&b.Fh(g)===c&&(g=this.xc(g),null!==g&&(g.containingGroup=e)):(f.link=this.wc(g),null!==f.link&&e instanceof V&&(vq(b,g,!0)===c&&(f.link.fromNode=e),vq(b,g,!1)===c&&(f.link.toNode=e),g=b.vf(g),Array.isArray(g)&&g.some(function(a){return function(b){return b===c?(e.labeledLink=
a.link,!0):!1}}(f))));f={link:f.link}}Bq(b,c)}a=b.Fh(a);void 0!==a&&(a=this.Lb(a),a instanceof uf&&(e.containingGroup=a))}};rq.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof V){var c=b.ja(a.data);if(void 0!==c){for(var d=a.linksConnected;d.next();)Cq(b,c,d.value.data);a.isLinkLabel&&(d=a.labeledLink,null!==d&&Cq(b,c,d.data));if(a instanceof uf)for(a=a.memberParts;a.next();)d=a.value.data,b.Ya(d)&&Cq(b,c,d)}}};
rq.prototype.copyPartData=function(a,b){var c=ti.prototype.copyPartData.call(this,a,b);if(a instanceof S)if(a=a.data,null!==a&&null!==b){var d=b.model;a=d.nq(a);"object"===typeof a&&null!==a&&(d.Ri(a),c=b.wc(a))}else null!==c&&(b=this.diagram,null!==a&&null!==b&&null!==b.commandHandler&&b.commandHandler.copiesClipboardData&&(b=b.model.nq(a),"object"===typeof b&&null!==b&&(c.data=b)));return c};
rq.prototype.insertLink=function(a,b,c,d){var e=this.diagram,f=e.model,g=e.toolManager.findTool("Linking"),h="";null!==a&&(null===b&&(b=a),h=b.portId,null===h&&(h=""));b="";null!==c&&(null===d&&(d=c),b=d.portId,null===b&&(b=""));d=g.archetypeLinkData;if(d instanceof S){if(wg(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&&(wg(a),a=a.copy(),null!==a&&(a.labeledLink=f,e.add(a))),f}else if(null!==d&&(d=f.nq(d),"object"===
typeof d&&null!==d))return null!==a&&Dq(f,d,f.ja(a.data),!0),Eq(f,d,h,!0),null!==c&&Dq(f,d,f.ja(c.data),!1),Eq(f,d,b,!1),f.Ri(d),a=g.archetypeLabelNodeData,null===a||a instanceof V||(a=f.copyNodeData(a),"object"===typeof a&&null!==a&&(f.pf(a),a=f.ja(a),void 0!==a&&f.pv(d,a))),e.wc(d);return null};rq.prototype.findLinkForKey=rq.prototype.findLinkForKey;rq.prototype.findPartForKey=rq.prototype.findPartForKey;rq.prototype.removeAllModeledParts=rq.prototype.removeAllModeledParts;
rq.prototype.addModeledParts=rq.prototype.addModeledParts;rq.prototype.addAllModeledParts=rq.prototype.addAllModeledParts;rq.className="GraphLinksPartManager";function Fq(){ti.apply(this,arguments);this.ih=null}la(Fq,ti);
function Gq(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||!Of(d,e,f,null,!0))if(d=a.getLinkCategoryForData(c.data),b=a.findLinkTemplateForCategory(d),null!==b&&(wg(b),b=b.copy(),null!==b)){var g=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;b.If=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}}}Fq.prototype.getLinkCategoryForData=function(a){return this.diagram.model.At(a)};Fq.prototype.setLinkCategoryForData=function(a,b){this.diagram.model.Yt(a,b)};
Fq.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.ae(a.data,d.ja(b));else{var e=this.ih;this.ih=a;null!==c&&d.ae(c.data,void 0);d.ae(b,d.ja(null!==a.toNode?a.toNode.data:null));this.ih=e}};
Fq.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.ih;this.ih=a;null!==c&&d.ae(c.data,void 0);d.ae(b,d.ja(null!==a.fromNode?a.fromNode.data:null));this.ih=e}else d.ae(a.data,d.ja(b))};Fq.prototype.removeDataForLink=function(a){this.diagram.model.ae(a.data,void 0)};
Fq.prototype.findLinkForKey=function(a){if(null===a||void 0===a)return null;a=this.diagram.model.Kb(a);return null!==a?this.Ne.H(a):null};
Fq.prototype.doModelChanged=function(a){ti.prototype.doModelChanged.call(this,a);if(this.diagram){var b=this.diagram;if(a.model===b.model){var c=a.change;if(b.Z){b.Z=!1;try{var d=a.modelChange;if(""!==d){if(c===ue){if("nodeParentKey"===d){var e=a.object,f=this.Lb(a.newValue),g=this.Wi(e);if(null!==this.ih)null!==f&&(this.ih.data=e,this.ih.category=this.getLinkCategoryForData(e));else if(null!==g){var h=g.Zi();null!==h?null===f?b.remove(h):b.isTreePathToChildren?h.fromNode=f:h.toNode=f:Gq(this,f,g)}}else if("parentLinkCategory"===
d){var k=this.Wi(a.object),l=a.newValue;if(null!==k&&"string"===typeof l){var m=k.Zi();null!==m&&(m.category=l)}}b.isModified=!0}}else if(c===ue){var n=a.propertyName;a.object===b.model&&"nodeParentKeyProperty"===n&&(b.undoManager.isUndoingRedoing||this.Ad());b.isModified=!0}}finally{b.Z=!0}}}}};
Fq.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.Gh(b),b=c.Lb(b),d=a.yg(),b!==d&&(d=a.Zi(),null!==b?null!==d?c.isTreePathToChildren?d.fromNode=b:d.toNode=b:Gq(this,b,a):null!==d&&Mj(c,d,!1)))}}};Fq.prototype.updateDataBindings=function(a,b){ti.prototype.updateDataBindings.call(this,a,b);"string"===typeof b&&null!==this.xc(a)&&(a=this.wc(a),null!==a&&a.Ba(b))};
Fq.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.ja(a);if(void 0!==c){var d=Aq(b,c),e=this.xc(a);if(null!==d&&null!==e){for(d=d.iterator;d.next();){var f=d.value;b.Ya(f)&&e instanceof V&&b.Gh(f)===c&&Gq(this,e,this.Wi(f))}Bq(b,c)}a=b.Gh(a);void 0!==a&&e instanceof V&&(a=this.Lb(a),Gq(this,a,e))}};
Fq.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof V){var c=b.ja(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.Hc(-1,d,!1);0<=f&&this.diagram.$a(xe,"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.Ya(e)&&Cq(b,c,e)}};
Fq.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.ae(e.data,b.ja(d.data)),e.Zi()):null};Fq.prototype.findLinkForKey=Fq.prototype.findLinkForKey;Fq.className="TreePartManager";
function Z(a){this.Ei=new F;this.Bi=new F;this.fu=',\n  "insertedNodeKeys": ';this.Tw=',\n  "modifiedNodeData": ';this.hu=',\n  "removedNodeKeys": ';this.Rh=null;Ya(this);this.xn=this.Qa="";this.Wf=!1;this.l={};this.Dc=[];this.Ua=new H;this.Di="key";this.Qk=this.xl=null;this.on=this.pn=!1;this.rn=!0;this.Wm=null;this.Jj="category";this.Of=new H;this.Pu=new E;this.pg=!1;this.u=null;this.undoManager=new ze;void 0!==a&&(this.nodeDataArray=a)}
Z.prototype.cloneProtected=function(a){a.Qa=this.Qa;a.xn=this.xn;a.Wf=this.Wf;a.Di=this.Di;a.xl=this.xl;a.Qk=this.Qk;a.pn=this.pn;a.on=this.on;a.rn=this.rn;a.Wm=this.Wm;a.Jj=this.Jj};Z.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};Z.prototype.clear=function(){this.Dc=[];this.Ua.clear();this.Of.clear();this.undoManager.clear()};
Z.prototype.toString=function(a){void 0===a&&(a=0);if(1<a)return this.Vq();var b=(""!==this.name?this.name:"")+" Model";if(0<a){b+="\n node data:";a=this.nodeDataArray;for(var c=a.length,d=0;d<c;d++){var e=a[d];b+=" "+this.ja(e)+":"+Ja(e)}}return b};
Z.prototype.FA=function(a){a.change!==ve&&B("Model.toIncrementalData argument is not a Transaction ChangedEvent:"+a.toString());var b=a.object;if(!(a.isTransactionFinished&&b instanceof ye))return null;Hq(this,b);a=this.Iw(b,"FinishedUndo"===a.propertyName);this.Rh=null;return a};
Z.prototype.Iw=function(a,b){var c=this,d=!1,e=new F,f=new F,g=new F,h=this.Rh;a.changes.each(function(a){a.model===c&&("nodeDataArray"===a.modelChange?a.change===we?e.add(a.newValue):a.change===xe&&g.add(a.oldValue):c.Ya(a.object)?f.add(a.object):a.change!==ue||c.modelData!==a.object&&"modelData"!==a.propertyName?null!==a.object&&(h&&h.contains(a.object)?h.get(a.object).each(function(a){c.Ya(a)&&f.add(a)}):a.object instanceof Z||c.dj()&&c.vc(a.object)||Iq(c,a.object).each(function(a){f.add(a)})):
d=!0)});var k=this.Bi;k.clear();e.each(function(a){k.add(c.ja(a));b||f.add(a)});var l=this.Ei;l.clear();g.each(function(a){l.add(c.ja(a));b&&f.add(a)});a=c.cloneDeep(f.na());var m=null;d&&(null===m&&(m={}),m.modelData=this.cloneDeep(this.modelData));0<k.count&&(null===m&&(m={}),b?m.removedNodeKeys=k.na():m.insertedNodeKeys=k.na());0<a.length&&(null===m&&(m={}),m.modifiedNodeData=a);0<l.count&&(null===m&&(m={}),b?m.insertedNodeKeys=l.na():m.removedNodeKeys=l.na());l.clear();k.clear();return m};
Z.prototype.cloneDeep=function(a){return Jq(this,a,!0)};
function Jq(a,b,c,d,e,f){function g(a,c){h?(void 0===a.__gohashid&&f.push(a),d.set(a,c)):(a=pb++,d.set(a,c),e.set(a,b))}if(!za(b))return b;f||(f=[]);var h=Object.isExtensible(b);d||(d=new H);if(h){var k=d.get(b);if(k)return k}else for(e||(e=new H),k=e.iterator;k.next();){var l=k.key;if(k.value===b&&(l=d.get(l)))return l}if(Array.isArray(b)){k=[];g(b,k);for(var m=0;m<b.length;m++)k.push(Jq(a,b[m],!1,d,e,f))}else if(b instanceof I||b instanceof M||b instanceof N||b instanceof oc||b instanceof P)k=b.copy(),
g(b,k);else{if(b instanceof ul||b instanceof sd||b instanceof D)return b;if(b instanceof E)k=(new E).addAll(Jq(a,b.na(),!1,d,e,f)),g(b,k);else if(b instanceof F)k=(new F).addAll(Jq(a,b.na(),!1,d,e,f)),g(b,k);else if(b instanceof H)k=(new H).addAll(Jq(a,b.na(),!1,d,e,f)),g(b,k);else if(b instanceof Date)k=new Date(b.getTime()),g(b,k);else if(b instanceof RegExp)k=new RegExp(b),g(b,k),k.lastIndex=b.lastIndex;else if("function"===typeof b.copy)k=b.copy(),g(b,k);else for(m in k={},g(b,k),b)"__gohashid"!==
m&&(k[m]=Jq(a,b[m],!1,d,e,f))}c&&f.forEach(function(a){delete a.__gohashid});return k}t=Z.prototype;
t.Bk=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.Mq=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 Kq(a){return',\n  "modelData": '+Lq(a,a.modelData)}
function Mq(a,b){b=b.modelData;za(b)&&(a.Cm(b),a.modelData=b)}t.Jw=function(){var a=this.modelData,b=!1,c;for(c in a)if(!Nq(c,a[c])){b=!0;break}a="";b&&(a=Kq(this));return a+',\n  "nodeDataArray": '+Oq(this,this.nodeDataArray,!0)};t.cw=function(a){Mq(this,a);a=a.nodeDataArray;Aa(a)&&(this.Cm(a),this.nodeDataArray=a)};
function Pq(a,b,c,d){if(b===c)return!0;if(typeof b!==typeof c||"function"===typeof b||"function"===typeof c)return!1;if(Array.isArray(b)&&Array.isArray(c)){if(d.H(b)===c)return!0;d.add(b,c);if(b.length!==c.length)return!1;for(var e=0;e<b.length;e++)if(!Pq(a,b[e],c[e],d))return!1;return!0}if(za(b)&&za(c)){if(d.H(b)===c)return!0;d.add(b,c);for(var f in b){var g=b[f];if(!Nq(f,g)){var h=c[f];if(void 0===h||!Pq(a,g,h,d))return!1}}for(e in c)if(f=c[e],!Nq(e,f)&&(g=b[e],void 0===g||!Pq(a,g,f,d)))return!1;
return!0}return!1}function Qq(a,b,c){a[c]!==b[c]&&B("Model.computeJsonDifference: Model."+c+' is not the same in both models: "'+a[c]+'" and "'+b[c]+'"')}
t.$q=function(a){Qq(this,a,"nodeKeyProperty");var b=this.Bi;b.clear();var c=new F,d=this.Ei;d.clear();d.addAll(this.Ua.iteratorKeys);for(var e=new H,f=a.nodeDataArray,g=f.length,h=0;h<g;h++){var k=f[h],l=a.ja(k);if(void 0!==l){d.remove(l);var m=this.Kb(l);null===m?(b.add(l),c.add(k)):Pq(this,m,k,e)||c.add(k)}else this.Kt(k),l=this.ja(k),b.add(l),c.add(k)}f="";Pq(this,this.modelData,a.modelData,e)||(f+=Kq(this));0<b.count&&(f+=this.fu+Oq(this,b.na(),!0));0<c.count&&(f+=this.Tw+Oq(this,c.na(),!0));
0<d.count&&(f+=this.hu+Oq(this,d.na(),!0));d.clear();b.clear();return f};t.dz=function(a,b){void 0===b&&(b=Rq(this,this));return'{ "class": '+this.quote(b)+', "incremental": 1'+this.Bk()+this.$q(a)+"}"};
function Hq(a,b){function c(a,b){if(b=b.part)if(b=b.data,a!==b){var c=d.get(a);null===c?(c=new F,c.add(b),d.add(a,c)):c.add(b)}}var d=a.Rh;null===d&&(d=new H,b.changes.each(function(a){if(null!==a.diagram){var b=a.change;if(b===ue)(a=a.object.panel)&&(b=a.data)&&c(b,a);else if(b===we||b===xe)a=a.object,(b=a.itemArray)&&c(b,a)}}),a.Rh=d)}function Iq(a,b){for(var c=new F,d=0;d<a.nodeDataArray.length;d++){var e=a.nodeDataArray[d];Sq(a,b,e,e,c)}return c}
function Sq(a,b,c,d,e){if(Array.isArray(c))for(var f=0;f<c.length;f++){var g=c[f];if(g===b)return e.add(d),!0;if(Sq(a,b,g,d,e))return!0}else if(za(c)&&Object.getPrototypeOf(c)===Object.prototype)for(f in c){g=c[f];if(g===b)return e.add(d),!0;if(Sq(a,b,g,d,e))return!0}return!1}
t.Hw=function(a,b){var c=this,d=!1,e=new F,f=new F,g=new F,h=this.Rh;a.changes.each(function(a){a.model===c&&("nodeDataArray"===a.modelChange?a.change===we?e.add(a.newValue):a.change===xe&&g.add(a.oldValue):c.Ya(a.object)?f.add(a.object):a.change!==ue||c.modelData!==a.object&&"modelData"!==a.propertyName?null!==a.object&&(h&&h.contains(a.object)?h.get(a.object).each(function(a){c.Ya(a)&&f.add(a)}):a.object instanceof Z||c.dj()&&c.vc(a.object)||Iq(c,a.object).each(function(a){f.add(a)})):d=!0)});var k=
this.Bi;k.clear();e.each(function(a){k.add(c.ja(a));b||f.add(a)});var l=this.Ei;l.clear();g.each(function(a){l.add(c.ja(a));b&&f.add(a)});a="";d&&(a+=Kq(this));0<k.count&&(a+=(b?this.hu:this.fu)+Oq(this,k.na(),!0));0<f.count&&(a+=this.Tw+Oq(this,f.na(),!0));0<l.count&&(a+=(b?this.fu:this.hu)+Oq(this,l.na(),!0));l.clear();k.clear();return a};
t.Lq=function(a){(void 0!==a.name&&a.name!==this.name||void 0!==a.dataFormat&&a.dataFormat!==this.dataFormat||void 0!==a.isReadOnly&&a.isReadOnly!==this.isReadOnly||void 0!==a.nodeKeyProperty&&a.nodeKeyProperty!==this.nodeKeyProperty||void 0!==a.copiesArrays&&a.copiesArrays!==this.copiesArrays||void 0!==a.copiesArrayObjects&&a.copiesArrayObjects!==this.copiesArrayObjects||void 0!==a.copiesKey&&a.copiesKey!==this.copiesKey||void 0!==a.nodeCategoryProperty&&a.nodeCategoryProperty!==this.nodeCategoryProperty)&&
B("applyIncrementalJson cannot change Model properties");Mq(this,a);var b=a.insertedNodeKeys,c=a.modifiedNodeData,d=new H;if(Array.isArray(c))for(var e=0;e<c.length;e++){var f=c[e],g=this.ja(f);void 0!==g&&null!==g&&d.set(g,f)}if(Array.isArray(b))for(e=b.length,f=0;f<e;f++){g=b[f];var h=this.Kb(g);null===h&&(h=(h=d.get(g))?h:this.copyNodeData({}),this.Jm(h,g),this.pf(h))}if(Array.isArray(c))for(b=c.length,d=0;d<b;d++)if(e=c[d],f=this.ja(e),f=this.Kb(f),null!==f){for(var k in e)"__gohashid"===k||k===
this.nodeKeyProperty||this.kk()&&k===this.nodeIsGroupProperty||this.setDataProperty(f,k,e[k]);this.Km(e,f)}a=a.removedNodeKeys;if(Array.isArray(a))for(c=a.length,k=0;k<c;k++)b=this.Kb(a[k]),null!==b&&this.Bm(b)};
t.Cy=function(a,b){a.change!==ve&&B("Model.toIncrementalJson argument is not a Transaction ChangedEvent:"+a.toString());var c=a.object;if(!(a.isTransactionFinished&&c instanceof ye))return'{ "incremental": 0 }';void 0===b&&(b=Rq(this,this));Hq(this,c);a=this.Hw(c,"FinishedUndo"===a.propertyName);this.Rh=null;return"2"===b?'{ "incremental": 2'+a+"}":'{ "class": '+this.quote(b)+', "incremental": 1'+this.Bk()+a+"}"};t.GA=function(a,b){return this.Cy(a,b)};
t.Vq=function(a){void 0===a&&(a=Rq(this,this));return'{ "class": '+this.quote(a)+this.Bk()+this.Jw()+"}"};t.toJSON=function(a){return this.Vq(a)};t.Ix=function(a){var b=null;if("string"===typeof a)try{b=x.JSON.parse(a)}catch(d){}else"object"===typeof a?b=a:B("Unable to modify a Model from: "+a);var c=b.incremental;"number"!==typeof c&&B("Unable to apply non-incremental changes to Model: "+a);0!==c&&(this.ua("applyIncrementalJson"),this.Lq(b),this.Va("applyIncrementalJson"))};t.Yy=function(a){return this.Ix(a)};
Z.constructGraphLinksModel=function(){return new Z};t=Z.prototype;
t.Cm=function(a){if(Aa(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];if(za(d)){var e=c;d=this.Cm(d);Array.isArray(a)?a[e]=d:B("Cannot replace an object in an HTMLCollection or NodeList at "+e)}}else if(za(a)){for(c in a)if(e=a[c],za(e)&&(e=this.Cm(e),a[c]=e,"points"===c&&Array.isArray(e))){d=0===e.length%2;for(var f=0;f<e.length;f++)if("number"!==typeof e[f]){d=!1;break}if(d){d=new E;for(f=0;f<e.length/2;f++)d.add(new I(e[2*f],e[2*f+1]));d.freeze();a[c]=d}}if("object"===typeof a){c=a;e=a["class"]||
"";0===e.indexOf("go.")&&(e=e.substr(3));if("NaN"===e)c=NaN;else if("Date"===e)c=new Date(a.value);else if("Point"===e)c=new I(Tq(a.x),Tq(a.y));else if("Size"===e)c=new M(Tq(a.width),Tq(a.height));else if("Rect"===e)c=new N(Tq(a.x),Tq(a.y),Tq(a.width),Tq(a.height));else if("Margin"===e)c=new oc(Tq(a.top),Tq(a.right),Tq(a.bottom),Tq(a.left));else if("Spot"===e)"string"===typeof a["enum"]?c=ld(a["enum"]):c=new P(Tq(a.x),Tq(a.y),Tq(a.offsetX),Tq(a.offsetY));else if("Brush"===e){if(c=new ul,c.type=Za(ul,
a.type),"string"===typeof a.color&&(c.color=a.color),a.start instanceof P&&(c.start=a.start),a.end instanceof P&&(c.end=a.end),"number"===typeof a.startRadius&&(c.startRadius=Tq(a.startRadius)),"number"===typeof a.endRadius&&(c.endRadius=Tq(a.endRadius)),a=a.colorStops,za(a))for(b in a)c.addColorStop(parseFloat(b),a[b])}else"Geometry"===e?(b=null,"string"===typeof a.path?b=Id(a.path):b=new sd,b.type=Za(sd,a.type),"number"===typeof a.startX&&(b.startX=Tq(a.startX)),"number"===typeof a.startY&&(b.startY=
Tq(a.startY)),"number"===typeof a.endX&&(b.endX=Tq(a.endX)),"number"===typeof a.endY&&(b.endY=Tq(a.endY)),a.spot1 instanceof P&&(b.spot1=a.spot1),a.spot2 instanceof P&&(b.spot2=a.spot2),c=b):"EnumValue"===e&&(b=a.classType,0===b.indexOf("go.")&&(b=b.substr(3)),b=Uq(b),"function"===typeof b&&(c=Za(b,a.name)));a=c}}return a};
t.quote=function(a){for(var b="",c=a.length,d=0;d<c;d++){var e=a[d];if('"'===e||"\\"===e)b+="\\"+e;else if("\b"===e)b+="\\b";else if("\f"===e)b+="\\f";else if("\n"===e)b+="\\n";else if("\r"===e)b+="\\r";else if("\t"===e)b+="\\t";else{var f=a.charCodeAt(d);b=16>f?b+("\\u000"+a.charCodeAt(d).toString(16)):32>f?b+("\\u00"+a.charCodeAt(d).toString(16)):8232===f?b+"\\u2028":8233===f?b+"\\u2029":b+e}}return'"'+b+'"'};
t.Om=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.Om(a.valueOf()):Aa(a)?Oq(this,a):za(a)?Lq(this,a):"function"===typeof a?"null":a.toString()};
function Oq(a,b,c){void 0===c&&(c=!1);var d=b.length;if(0>=d)return"[]";var e=new cb;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.Om(g)))}c&&1<d&&e.add("\n");e.add(" ]");return e.toString()}function Nq(a,b){return void 0===b||"__gohashid"===a||"_"===a[0]||"function"===typeof b?!0:!1}function Vq(a){return isNaN(a)?"NaN":Infinity===a?"9e9999":-Infinity===a?"-9e9999":a}
function Lq(a,b){var c=b;if(c instanceof I)b={"class":"go.Point",x:Vq(c.x),y:Vq(c.y)};else if(c instanceof M)b={"class":"go.Size",width:Vq(c.width),height:Vq(c.height)};else if(c instanceof N)b={"class":"go.Rect",x:Vq(c.x),y:Vq(c.y),width:Vq(c.width),height:Vq(c.height)};else if(c instanceof oc)b={"class":"go.Margin",top:Vq(c.top),right:Vq(c.right),bottom:Vq(c.bottom),left:Vq(c.left)};else if(c instanceof P)c.hb()?b={"class":"go.Spot",x:Vq(c.x),y:Vq(c.y),offsetX:Vq(c.offsetX),offsetY:Vq(c.offsetY)}:
b={"class":"go.Spot","enum":c.toString()};else if(c instanceof ul){b={"class":"go.Brush",type:c.type.name};if(c.type===xl)b.color=c.color;else if(c.type===Al||c.type===vl)b.start=c.start,b.end=c.end,c.type===vl&&(0!==c.startRadius&&(b.startRadius=Vq(c.startRadius)),isNaN(c.endRadius)||(b.endRadius=Vq(c.endRadius)));if(null!==c.colorStops){var d={};for(c=c.colorStops.iterator;c.next();)d[c.key]=c.value;b.colorStops=d}}else c instanceof sd?(b={"class":"go.Geometry",type:c.type.name},0!==c.startX&&(b.startX=
Vq(c.startX)),0!==c.startY&&(b.startY=Vq(c.startY)),0!==c.endX&&(b.endX=Vq(c.endX)),0!==c.endY&&(b.endY=Vq(c.endY)),c.spot1.w(vc)||(b.spot1=c.spot1),c.spot2.w(Gc)||(b.spot2=c.spot2),c.type===td&&(b.path=yd(c))):c instanceof D&&(b={"class":"go.EnumValue",classType:Rq(a,c.classType),name:c.name});d="{";c=!0;for(var e in b){var f=rn(b,e);if(!Nq(e,f))if(c?c=!1:d+=", ",d+='"'+e+'":',"points"===e&&f instanceof E){var g="[";for(f=f.iterator;f.next();){var h=f.value;1<g.length&&(g+=",");g+=a.Om(h.x);g+=",";
g+=a.Om(h.y)}g+="]";d+=g}else d+=a.Om(f)}return d+"}"}function Tq(a){return"number"===typeof a?a:"NaN"===a?NaN:"9e9999"===a?Infinity:"-9e9999"===a?-Infinity:parseFloat(a)}t.Ah=function(a){this.Pu.add(a)};t.yk=function(a){this.Pu.remove(a)};t.mt=function(a){this.skipsUndoManager||this.undoManager.Mv(a);for(var b=this.Pu,c=b.length,d=0;d<c;d++)b.L(d)(a)};t.$a=function(a,b,c,d,e,f,g){Wq(this,"",a,b,c,d,e,f,g)};t.g=function(a,b,c,d,e){Wq(this,"",ue,a,this,b,c,d,e)};
t.Qt=function(a,b,c,d,e,f){Wq(this,"",ue,b,a,c,d,e,f)};function Wq(a,b,c,d,e,f,g,h,k){void 0===h&&(h=null);void 0===k&&(k=null);var l=new te;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.mt(l)}
Z.prototype.changeState=function(a,b){if(null!==a&&a.model===this)if(a.change===ue){var c=a.object,d=a.propertyName,e=a.H(b);d===this.nodeKeyProperty&&this.Ya(c)&&(b=a.H(!b),void 0!==b&&this.Ua.remove(b),void 0!==e&&this.Ua.add(e,c));Tj(c,d,e)}else a.change===we?(c=a.newParam,"nodeDataArray"===a.modelChange?(a=a.newValue,za(a)&&"number"===typeof c&&(d=this.ja(a),b?(this.Dc[c]===a&&Da(this.Dc,c),void 0!==d&&this.Ua.remove(d)):(this.Dc[c]!==a&&Ca(this.Dc,c,a),void 0!==d&&this.Ua.add(d,a)))):""===a.modelChange?
((d=a.object)&&!Aa(d)&&a.propertyName&&(d=rn(a.object,a.propertyName)),Aa(d)&&"number"===typeof c&&(a=a.newValue,b?Da(d,c):Ca(d,c,a))):B("unknown ChangedEvent.Insert modelChange: "+a.toString())):a.change===xe?(c=a.oldParam,"nodeDataArray"===a.modelChange?(a=a.oldValue,za(a)&&"number"===typeof c&&(d=this.ja(a),b?(this.Dc[c]!==a&&Ca(this.Dc,c,a),void 0!==d&&this.Ua.add(d,a)):(this.Dc[c]===a&&Da(this.Dc,c),void 0!==d&&this.Ua.remove(d)))):""===a.modelChange?((d=a.object)&&!Aa(d)&&a.propertyName&&(d=
rn(a.object,a.propertyName)),Aa(d)&&"number"===typeof c&&(a=a.oldValue,b?Ca(d,c,a):Da(d,c))):B("unknown ChangedEvent.Remove modelChange: "+a.toString())):a.change!==ve&&B("unknown ChangedEvent: "+a.toString())};Z.prototype.ua=function(a){return this.undoManager.ua(a)};Z.prototype.Va=function(a){return this.undoManager.Va(a)};Z.prototype.Bf=function(){return this.undoManager.Bf()};
Z.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.ua(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.Va(b):this.undoManager.Bf(),this.skipsUndoManager=c}};t=Z.prototype;t.Ba=function(a,b){void 0===b&&(b="");Wq(this,"SourceChanged",ve,b,a,null,null)};
t.ja=function(a){if(null!==a){var b=this.Di;if(""!==b&&(b=rn(a,b),void 0!==b)){if(xq(b))return b;B("Key value for node data "+a+" is not a number or a string: "+b)}}};t.Jm=function(a,b){if(null!==a){var c=this.Di;if(""!==c)if(this.Ya(a)){var d=rn(a,c);d!==b&&null===this.Kb(b)&&(Tj(a,c,b),void 0!==d&&this.Ua.remove(d),this.Ua.add(b,a),Wq(this,"nodeKey",ue,c,a,d,b),"string"===typeof c&&this.Ba(a,c),this.Pq(d,b))}else Tj(a,c,b)}};function xq(a){return"number"===typeof a||"string"===typeof a}
t.Ya=function(a){var b=this.ja(a);return void 0===b?!1:this.Ua.H(b)===a};t.Kb=function(a){null===a&&B("Model.findNodeDataForKey:key must not be null");return void 0!==a&&xq(a)?this.Ua.H(a):null};
t.Kt=function(a){if(null!==a){var b=this.Di;if(""!==b){var c=this.ja(a);if(void 0===c||this.Ua.contains(c)){var d=this.xl;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.Ua.contains(c))){Tj(a,b,c);return}if("string"===typeof c){for(d=2;this.Ua.contains(c+d);)d++;Tj(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.Ua.count-1;this.Ua.contains(c);)c--;Tj(a,b,c)}}}}};t.pf=function(a){null!==a&&(nb(a),this.Ya(a)||pq(this,a,!0))};
function pq(a,b,c){var d=a.ja(b);if(void 0===d||a.Ua.H(d)!==b)a.Kt(b),d=a.ja(b),void 0===d?B("Model.makeNodeDataKeyUnique failed on "+b+".  Data not added to Model."):(a.Ua.add(d,b),d=null,c&&(d=a.Dc.length,Ca(a.Dc,d,b)),Wq(a,"nodeDataArray",we,"nodeDataArray",a,null,b,null,d),a.Em(b),a.Dm(b))}t.Uy=function(a){if(Aa(a))for(var b=a.length,c=0;c<b;c++)this.pf(a[c]);else for(a=a.iterator;a.next();)this.pf(a.value)};t.Bm=function(a){null!==a&&oq(this,a,!0)};
function oq(a,b,c){var d=a.ja(b);void 0!==d&&a.Ua.remove(d);d=null;if(c){a:if(c=a.Dc,Array.isArray(c))d=c.indexOf(b);else{d=c.length;for(var e=0;e<d;e++)if(c[e]===b){d=e;break a}d=-1}if(0>d)return;Da(a.Dc,d)}Wq(a,"nodeDataArray",xe,"nodeDataArray",a,b,null,d,null);a.Xq(b)}t.vA=function(a){if(Aa(a))for(var b=a.length,c=0;c<b;c++)this.Bm(a[c]);else for(a=a.iterator;a.next();)this.Bm(a.value)};
t.lA=function(a){if(a!==this.nodeDataArray&&Aa(a)){var b=this.Ei;b.clear();b.addAll(this.Ua.iteratorKeys);var c=this.Bi;c.clear();for(var d=a.length,e=0;e<d;e++){var f=a[e],g=this.ja(f);if(void 0!==g){c.add(g);var h=this.Kb(g);h!==f&&(null!==h?(this.jq(h,f),this.Km(f,h)):(f=this.cloneDeep(f),this.Jm(f,g),this.pf(f)))}else g=this.cloneDeep(f),this.pf(g),c.add(this.ja(g))}for(a=b.iterator;a.next();)d=a.value,c.contains(d)||(d=this.Kb(d))&&this.Bm(d);this.mq();b.clear();c.clear()}};
t.Pq=function(a,b){void 0!==b&&(a=Aq(this,a),a instanceof F&&this.Of.add(b,a))};t.Dw=function(){};t.Em=function(){};t.Dm=function(){};t.Xq=function(){};function Cq(a,b,c){if(void 0!==b){var d=a.Of.H(b);null===d&&(d=new F,a.Of.add(b,d));d.add(c)}}function Bq(a,b,c){if(void 0!==b){var d=a.Of.H(b);d instanceof F&&(void 0===c||null===c?a.Of.remove(b):(d.remove(c),0===d.count&&a.Of.remove(b)))}}function Aq(a,b){if(void 0===b)return null;a=a.Of.H(b);return a instanceof F?a:null}
t.mq=function(a){void 0===a?this.Of.clear():this.Of.remove(a)};Z.prototype.copyNodeData=function(a){if(null===a)return null;var b=this.Qk;a=null!==b?b(a,this):Xq(this,a,!0);za(a)&&Ya(a);return a};
function Xq(a,b,c){if(a.copiesArrays&&Array.isArray(b)){var d=[];for(c=0;c<b.length;c++){var e=Xq(a,b[c],a.copiesArrayObjects);d.push(e)}Ya(d);return d}if(c&&za(b)){c=(c=b.constructor)?new c:{};e=a.copiesKey||"string"!==typeof a.nodeKeyProperty?null:a.nodeKeyProperty;for(d in b)if("__gohashid"===d)c.__gohashid=void 0;else if(d===e)c[e]=void 0;else{var f=rn(b,d),g=Rq(a,f);"GraphObject"===g||"Diagram"===g||"Layer"===g||"RowColumnDefinition"===g||"AnimationManager"===g||"Tool"===g||"CommandHandler"===
g||"Layout"===g||"InputEvent"===g||"DiagramEvent"===g||f instanceof Z||f instanceof ze||f instanceof ye||f instanceof te?Tj(c,d,f):(f=Xq(a,f,!1),Tj(c,d,f))}Ya(c);return c}return b instanceof I?b.copy():b instanceof M?b.copy():b instanceof N?b.copy():b instanceof P?b.copy():b instanceof oc?b.copy():b}
Z.prototype.setDataProperty=function(a,b,c){if(this.Ya(a)){if(b===this.nodeKeyProperty){this.Jm(a,c);return}if(b===this.nodeCategoryProperty){this.Im(a,c);return}}else!Yq&&a instanceof Y&&(Yq=!0,wa('Model.setDataProperty is modifying a GraphObject, "'+a.toString()+'"'),wa("  Is that really your intent?"));var d=rn(a,b);d!==c&&(Tj(a,b,c),this.Qt(a,b,d,c))};t=Z.prototype;t.set=function(a,b,c){this.setDataProperty(a,b,c)};
t.jq=function(a,b){if(b){var c=this.Ya(a),d;for(d in b)"__gohashid"===d||c&&d===this.nodeKeyProperty||this.setDataProperty(a,d,b[d])}};t.Qy=function(a,b){this.Bt(a,-1,b)};t.Bt=function(a,b,c){0>b&&(b=a.length);Ca(a,b,c);Wq(this,"",we,"",a,null,c,null,b)};t.ew=function(a,b){void 0===b&&(b=-1);a===this.Dc&&B("Model.removeArrayItem should not be called on the Model.nodeDataArray");-1===b&&(b=a.length-1);var c=a[b];Da(a,b);Wq(this,"",xe,"",a,c,null,b,null)};
t.uq=function(a){if(null===a)return"";var b=this.Jj;if(""===b)return"";b=rn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;B("getCategoryForNodeData found a non-string category for "+a+": "+b);return""};t.Im=function(a,b){if(null!==a){var c=this.Jj;if(""!==c)if(this.Ya(a)){var d=rn(a,c);void 0===d&&(d="");d!==b&&(Tj(a,c,b),Wq(this,"nodeCategory",ue,c,a,d,b))}else Tj(a,c,b)}};t.Km=function(a,b){this.Im(b,this.uq(a))};t.rm=function(){return!1};t.kk=function(){return!1};t.dj=function(){return!1};
t.Gt=function(){return!1};t.lk=function(){return!1};function Di(){return new Z}function Rq(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 Rq(a,b.constructor);return typeof b}function Uq(a){return Zq[a]?Zq[a]:void 0!==x.go&&x.go[a]?x.go[a]:null}
function rn(a,b){if(!a||!b)return null;try{if("function"===typeof b)var c=b(a);else"function"===typeof a.getAttribute?(c=a.getAttribute(b),null===c&&(c=void 0)):c=a[b]}catch(d){}return c}function Tj(a,b,c){if(a&&b)try{"function"===typeof b?b(a,c):"function"===typeof a.setAttribute?a.setAttribute(b,c):a[b]=c}catch(d){}}
ma.Object.defineProperties(Z.prototype,{name:{get:function(){return this.Qa},set:function(a){var b=this.Qa;b!==a&&(this.Qa=a,this.g("name",b,a))}},dataFormat:{get:function(){return this.xn},set:function(a){var b=this.xn;b!==a&&(this.xn=a,this.g("dataFormat",b,a))}},isReadOnly:{get:function(){return this.Wf},set:function(a){var b=this.Wf;b!==a&&(this.Wf=a,this.g("isReadOnly",b,a))}},modelData:{
get:function(){return this.l},set:function(a){var b=this.l;b!==a&&(this.l=a,this.g("modelData",b,a),this.Ba(a))}},undoManager:{get:function(){return this.u},set:function(a){var b=this.u;b!==a&&(null!==b&&b.uy(this),this.u=a,null!==a&&a.Gx(this))}},skipsUndoManager:{get:function(){return this.pg},set:function(a){this.pg=a}},nodeKeyProperty:{get:function(){return this.Di},set:function(a){var b=this.Di;
b!==a&&(""===a&&B("Model.nodeKeyProperty may not be the empty string"),0<this.Ua.count&&B("Cannot set Model.nodeKeyProperty when there is existing node data"),this.Di=a,this.g("nodeKeyProperty",b,a))}},makeUniqueKeyFunction:{get:function(){return this.xl},set:function(a){var b=this.xl;b!==a&&(this.xl=a,this.g("makeUniqueKeyFunction",b,a))}},nodeDataArray:{get:function(){return this.Dc},set:function(a){var b=this.Dc;if(b!==a){this.Ua.clear();
this.Dw();for(var c=a.length,d=0;d<c;d++){var e=a[d];if(!za(e)){B("Model.nodeDataArray must only contain Objects, not: "+e);return}nb(e)}this.Dc=a;d=new E;for(e=0;e<c;e++){var f=a[e],g=this.ja(f);void 0===g?d.add(f):null!==this.Ua.H(g)?d.add(f):this.Ua.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.Kt(e),f=this.ja(e),void 0!==f&&this.Ua.add(f,e);Wq(this,"nodeDataArray",ue,"nodeDataArray",this,b,a);for(b=0;b<c;b++)d=a[b],this.Em(d),this.Dm(d);this.mq();Array.isArray(a)||(this.isReadOnly=!0)}}},
copyNodeDataFunction:{get:function(){return this.Qk},set:function(a){var b=this.Qk;b!==a&&(this.Qk=a,this.g("copyNodeDataFunction",b,a))}},copiesArrays:{get:function(){return this.pn},set:function(a){var b=this.pn;b!==a&&(this.pn=a,this.g("copiesArrays",b,a))}},copiesArrayObjects:{get:function(){return this.on},set:function(a){var b=this.on;b!==a&&(this.on=a,this.g("copiesArrayObjects",b,a))}},copiesKey:{
get:function(){return this.rn},set:function(a){var b=this.rn;b!==a&&(this.rn=a,this.g("copiesKey",b,a))}},afterCopyFunction:{get:function(){return this.Wm},set:function(a){var b=this.Wm;b!==a&&(this.Wm=a,this.g("afterCopyFunction",b,a))}},nodeCategoryProperty:{get:function(){return this.Jj},set:function(a){var b=this.Jj;b!==a&&(this.Jj=a,this.g("nodeCategoryProperty",b,a))}},type:{get:function(){return"Model"}}});
Z.prototype.setCategoryForNodeData=Z.prototype.Im;Z.prototype.getCategoryForNodeData=Z.prototype.uq;Z.prototype.removeArrayItem=Z.prototype.ew;Z.prototype.insertArrayItem=Z.prototype.Bt;Z.prototype.addArrayItem=Z.prototype.Qy;Z.prototype.assignAllDataProperties=Z.prototype.jq;Z.prototype.set=Z.prototype.set;Z.prototype.clearUnresolvedReferences=Z.prototype.mq;Z.prototype.mergeNodeDataArray=Z.prototype.lA;Z.prototype.removeNodeDataCollection=Z.prototype.vA;Z.prototype.removeNodeData=Z.prototype.Bm;
Z.prototype.addNodeDataCollection=Z.prototype.Uy;Z.prototype.addNodeData=Z.prototype.pf;Z.prototype.makeNodeDataKeyUnique=Z.prototype.Kt;Z.prototype.findNodeDataForKey=Z.prototype.Kb;Z.prototype.containsNodeData=Z.prototype.Ya;Z.prototype.setKeyForNodeData=Z.prototype.Jm;Z.prototype.getKeyForNodeData=Z.prototype.ja;Z.prototype.updateTargetBindings=Z.prototype.Ba;Z.prototype.commit=Z.prototype.commit;Z.prototype.rollbackTransaction=Z.prototype.Bf;Z.prototype.commitTransaction=Z.prototype.Va;
Z.prototype.startTransaction=Z.prototype.ua;Z.prototype.raiseDataChanged=Z.prototype.Qt;Z.prototype.raiseChanged=Z.prototype.g;Z.prototype.raiseChangedEvent=Z.prototype.$a;Z.prototype.removeChangedListener=Z.prototype.yk;Z.prototype.addChangedListener=Z.prototype.Ah;Z.prototype.writeJsonValue=Z.prototype.Om;Z.prototype.replaceJsonObjects=Z.prototype.Cm;Z.prototype.applyIncrementalJSON=Z.prototype.Yy;Z.prototype.applyIncrementalJson=Z.prototype.Ix;Z.prototype.toJSON=Z.prototype.toJSON;
Z.prototype.toJson=Z.prototype.Vq;Z.prototype.toIncrementalJSON=Z.prototype.GA;Z.prototype.toIncrementalJson=Z.prototype.Cy;Z.prototype.computeJsonDifference=Z.prototype.dz;Z.prototype.toIncrementalData=Z.prototype.FA;Z.prototype.clear=Z.prototype.clear;var Yq=!1,Zq={};Z.className="Model";
Z.fromJSON=Z.fromJson=function(a,b){void 0===b&&(b=null);var c=null;if("string"===typeof a)try{c=x.JSON.parse(a)}catch(f){}else"object"===typeof a?c=a:B("Unable to construct a Model from: "+a);if(null===b){a=null;var d=c["class"];if("string"===typeof d)try{var e=null;0===d.indexOf("go.")?(d=d.substr(3),e=Uq(d)):(e=Uq(d),null===e&&(e=x[d]));"function"===typeof e&&(a=new e)}catch(f){}null===a||a instanceof Z?b=a:B("Unable to construct a Model of declared class: "+c["class"])}null===b&&(b=Z.constructGraphLinksModel());
b.Mq(c);b.cw(c);return b};Z.safePropertyValue=rn;Z.safePropertySet=Tj;Zq.Brush=ul;Zq.ChangedEvent=te;Zq.Geometry=sd;Zq.Margin=oc;Zq.Panel=X;Zq.Point=I;Zq.Rect=N;Zq.Size=M;Zq.Spot=P;Zq.Transaction=ye;Zq.UndoManager=ze;function Mi(a,b,c){Ya(this);this.s=!1;void 0===a&&(a="");void 0===b&&(b=a);void 0===c&&(c=null);this.l=-1;this.cd=null;this.Yl=a;this.Xl=this.Vp=0;this.Xs=null;this.ko=!1;this.Ql=b;this.nn=c;this.Jo=$q;this.gn=null;this.Au=new F}
Mi.prototype.copy=function(){var a=new Mi;a.Yl=this.Yl;a.Vp=this.Vp;a.Xl=this.Xl;a.Xs=this.Xs;a.ko=this.ko;a.Ql=this.Ql;a.nn=this.nn;a.Jo=this.Jo;a.gn=this.gn;return a};t=Mi.prototype;t.gb=function(a){a.classType===Mi&&(this.mode=a)};t.toString=function(){return"Binding("+this.targetProperty+":"+this.sourceProperty+(-1!==this.jj?" "+this.jj:"")+" "+this.mode.name+")"};t.freeze=function(){this.s=!0;return this};t.ea=function(){this.s=!1;return this};
t.my=function(a){void 0===a&&(a=null);this.mode=kn;this.backConverter=a;return this};t.Iq=function(a){void 0===a&&(a="");this.sourceName=a;this.isToModel=!1;return this};t.nA=function(){this.sourceName=null;this.isToModel=!0;return this};function hl(a,b,c){a=a.sourceName;return null===a||""===a?b:"/"===a?c.part:"."===a?c:".."===a?c.panel:b.Za(a)}
t.Ew=function(a,b,c){var d=this.Ql;if(void 0===c||""===d||d===c){c=this.Yl;var e=this.nn;if(null===e&&""===c)wa("Binding error: target property is the empty string: "+this.toString());else{var f=b;""!==d&&(f=rn(b,d));if(void 0!==f)if(null===e)""!==c&&Tj(a,c,f);else try{if(""!==c){var g=e(f,a);Tj(a,c,g)}else e(f,a)}catch(h){}}}};
t.Zq=function(a,b,c,d){if(this.Jo===kn){var e=this.Yl;if(void 0===c||e===c){c=this.Ql;var f=this.gn,g=a;""!==e&&(g=rn(a,e));if(void 0!==g&&!this.Au.contains(a))try{this.Au.add(a);var h=null!==d?d.diagram:null,k=null!==h?h.model:null;if(null===f)if(""!==c)null!==k?k.setDataProperty(b,c,g):Tj(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.ew(m,l);k.Bt(m,l,g)}}else try{if(""!==c){var n=f(g,b,k);null!==k?k.setDataProperty(b,
c,n):Tj(b,c,n)}else{var p=f(g,b,k);if(void 0!==p&&null!==k&&null!==d&&0<=d.itemIndex&&null!==d.panel&&Array.isArray(d.panel.itemArray)){var r=d.itemIndex,q=d.panel.itemArray;k.ew(q,r);k.Bt(q,r,p)}}}catch(u){}}finally{this.Au.remove(a)}}}};
ma.Object.defineProperties(Mi.prototype,{jj:{get:function(){return this.l},set:function(a){this.s&&ua(this);this.l=a}},targetProperty:{get:function(){return this.Yl},set:function(a){this.s&&ua(this);this.Yl=a}},sourceName:{get:function(){return this.Xs},set:function(a){this.s&&ua(this);this.Xs=a;null!==a&&(this.ko=!1)}},isToModel:{get:function(){return this.ko},set:function(a){this.s&&
ua(this);this.ko=a}},sourceProperty:{get:function(){return this.Ql},set:function(a){this.s&&ua(this);this.Ql=a}},converter:{get:function(){return this.nn},set:function(a){this.s&&ua(this);this.nn=a}},backConverter:{get:function(){return this.gn},set:function(a){this.s&&ua(this);this.gn=a}},mode:{get:function(){return this.Jo},set:function(a){this.s&&ua(this);this.Jo=a}}});
Mi.prototype.updateSource=Mi.prototype.Zq;Mi.prototype.updateTarget=Mi.prototype.Ew;Mi.prototype.ofModel=Mi.prototype.nA;Mi.prototype.ofObject=Mi.prototype.Iq;Mi.prototype.makeTwoWay=Mi.prototype.my;var $q=new D(Mi,"OneWay",1),kn=new D(Mi,"TwoWay",2);Mi.className="Binding";Mi.parseEnum=function(a,b){return function(c){c=Za(a,c);return null===c?b:c}};Mi.toString=Ja;Mi.OneWay=$q;Mi.TwoWay=kn;
function ar(a,b){Z.call(this);this.eu=',\n  "insertedLinkKeys": ';this.Sw=',\n  "modifiedLinkData": ';this.gu=',\n  "removedLinkKeys": ';this.Pc=[];this.Xf=new F;this.eb=new H;this.yi="";this.lj=this.Pk=this.yl=null;this.Ve="from";this.We="to";this.Gj=this.Fj="";this.Ej="category";this.Od="";this.Cl="isGroup";this.ue="group";this.qn=!1;void 0!==a&&(this.nodeDataArray=a);void 0!==b&&(this.linkDataArray=b)}la(ar,Z);ar.constructGraphLinksModel=Z.constructGraphLinksModel;
ar.prototype.cloneProtected=function(a){Z.prototype.cloneProtected.call(this,a);a.yi=this.yi;a.yl=this.yl;a.Pk=this.Pk;a.Ve=this.Ve;a.We=this.We;a.Fj=this.Fj;a.Gj=this.Gj;a.Ej=this.Ej;a.Od=this.Od;a.Cl=this.Cl;a.ue=this.ue;a.qn=this.qn};t=ar.prototype;t.clear=function(){Z.prototype.clear.call(this);this.Pc=[];this.eb.clear();this.Xf.clear()};
t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.Vq();var b=(""!==this.name?this.name:"")+" GraphLinksModel";if(0<a){b+="\n node data:";a=this.nodeDataArray;var c=a.length,d;for(d=0;d<c;d++){var e=a[d];b+=" "+this.ja(e)+":"+Ja(e)}b+="\n link data:";a=this.linkDataArray;c=a.length;for(d=0;d<c;d++)e=a[d],b+=" "+vq(this,e,!0)+"--\x3e"+vq(this,e,!1)}return b};
t.Iw=function(a,b){""===this.linkKeyProperty&&B("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalData() to succeed.");var c=Z.prototype.Iw.call(this,a,b),d=this,e=new F,f=new F,g=new F,h=this.Rh;a.changes.each(function(a){a.model===d&&("linkDataArray"===a.modelChange?a.change===we?e.add(a.newValue):a.change===xe&&g.add(a.oldValue):d.vc(a.object)?f.add(a.object):null!==a.object&&(null!==a.object&&h&&h.contains(a.object)?h.get(a.object).each(function(a){d.vc(a)&&f.add(a)}):
a.object instanceof Z||d.Ya(a.object)||br(d,a.object).each(function(a){f.add(a)})))});var k=this.Bi;k.clear();e.each(function(a){k.add(d.Vb(a));b||f.add(a)});var l=this.Ei;l.clear();g.each(function(a){l.add(d.Vb(a));b&&f.add(a)});a=d.cloneDeep(f.na());0<k.count&&(null===c&&(c={}),b?c.removedLinkKeys=k.na():c.insertedLinkKeys=k.na());0<a.length&&(null===c&&(c={}),c.modifiedLinkData=a);0<l.count&&(null===c&&(c={}),b?c.insertedLinkKeys=l.na():c.removedLinkKeys=l.na());l.clear();k.clear();return c};
t.Bk=function(){var a=Z.prototype.Bk.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.Mq=function(a){Z.prototype.Mq.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.Jw=function(){var a=Z.prototype.Jw.call(this),b=',\n  "linkDataArray": '+Oq(this,this.linkDataArray,!0);return a+b};t.cw=function(a){Z.prototype.cw.call(this,a);a=a.linkDataArray;Array.isArray(a)&&(this.Cm(a),this.linkDataArray=a)};
t.$q=function(a){if(!(a instanceof ar))return B("Model.computeJsonDifference: newmodel must be a GraphLinksModel"),"";""===this.linkKeyProperty&&B("GraphLinksModel.linkKeyProperty must not be an empty string for .computeJsonDifference() to succeed.");var b=Z.prototype.$q.call(this,a);Qq(this,a,"linkKeyProperty");Qq(this,a,"linkFromKeyProperty");Qq(this,a,"linkToKeyProperty");Qq(this,a,"linkLabelKeysProperty");Qq(this,a,"nodeIsGroupProperty");Qq(this,a,"nodeGroupKeyProperty");var c=this.Bi;c.clear();
var d=new F,e=this.Ei;e.clear();e.addAll(this.eb.iteratorKeys);for(var f=new H,g=a.linkDataArray,h=g.length,k=0;k<h;k++){var l=g[k],m=a.Vb(l);if(void 0!==m){e.remove(m);var n=this.wg(m);null===n?(c.add(m),d.add(l)):Pq(this,n,l,f)||d.add(l)}else this.Fq(l),m=this.Vb(l),c.add(m),d.add(l)}a=b;0<c.count&&(a+=this.eu+Oq(this,c.na(),!0));0<d.count&&(a+=this.Sw+Oq(this,d.na(),!0));0<e.count&&(a+=this.gu+Oq(this,e.na(),!0));e.clear();c.clear();return a};
function br(a,b){for(var c=new F,d=0;d<a.linkDataArray.length;d++){var e=a.linkDataArray[d];Sq(a,b,e,e,c)}return c}
t.Hw=function(a,b){""===this.linkKeyProperty&&B("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalJson() to succeed.");var c=Z.prototype.Hw.call(this,a,b),d=this,e=new F,f=new F,g=new F,h=this.Rh;a.changes.each(function(a){a.model===d&&("linkDataArray"===a.modelChange?a.change===we?e.add(a.newValue):a.change===xe&&g.add(a.oldValue):d.vc(a.object)?f.add(a.object):null!==a.object&&(null!==a.object&&h&&h.contains(a.object)?h.get(a.object).each(function(a){d.vc(a)&&f.add(a)}):
a.object instanceof Z||d.Ya(a.object)||br(d,a.object).each(function(a){f.add(a)})))});var k=this.Bi;k.clear();e.each(function(a){k.add(d.Vb(a));b||f.add(a)});var l=this.Ei;l.clear();g.each(function(a){l.add(d.Vb(a));b&&f.add(a)});a=c;0<k.count&&(a+=(b?this.gu:this.eu)+Oq(this,k.na(),!0));0<f.count&&(a+=this.Sw+Oq(this,f.na(),!0));0<l.count&&(a+=(b?this.eu:this.gu)+Oq(this,l.na(),!0));l.clear();k.clear();return a};
t.Lq=function(a){(void 0!==a.linkCategoryProperty&&a.linkCategoryProperty!==this.linkCategoryProperty||void 0!==a.linkKeyProperty&&a.linkKeyProperty!==this.linkKeyProperty||void 0!==a.linkFromKeyProperty&&a.linkFromKeyProperty!==this.linkFromKeyProperty||void 0!==a.linkToKeyProperty&&a.linkToKeyProperty!==this.linkToKeyProperty||void 0!==a.linkFromPortIdProperty&&a.linkFromPortIdProperty!==this.linkFromPortIdProperty||void 0!==a.linkToPortIdProperty&&a.linkToPortIdProperty!==this.linkToPortIdProperty||
void 0!==a.linkLabelKeysProperty&&a.linkLabelKeysProperty!==this.linkLabelKeysProperty||void 0!==a.nodeIsGroupProperty&&a.nodeIsGroupProperty!==this.nodeIsGroupProperty||void 0!==a.nodeGroupKeyProperty&&a.nodeGroupKeyProperty!==this.nodeGroupKeyProperty)&&B("applyIncrementalJson cannot change Model properties");Z.prototype.Lq.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.wg(e);null===f&&(f=this.nq({}),this.Wt(f,e),this.Ri(f))}b=a.modifiedLinkData;
if(Array.isArray(b))for(c=b.length,d=0;d<c;d++)if(e=b[d],f=this.Vb(e),f=this.wg(f),null!==f){for(var g in e)"__gohashid"!==g&&g!==this.linkKeyProperty&&this.setDataProperty(f,g,e[g]);cr(this,e,f)}a=a.removedLinkKeys;if(Array.isArray(a))for(g=a.length,b=0;b<g;b++)c=this.wg(a[b]),null!==c&&this.Am(c)};
ar.prototype.changeState=function(a,b){if(null!==a&&a.model===this){if(a.change===ue){var c=a.object,d=a.propertyName;if(d===this.linkKeyProperty&&this.vc(c)){var e=a.H(b);b=a.H(!b);void 0!==b&&this.eb.remove(b);void 0!==e&&this.eb.add(e,c);Tj(c,d,e);return}}else if(a.change===we){c=a.newParam;if("linkDataArray"===a.modelChange){a=a.newValue;za(a)&&"number"===typeof c&&(d=this.Vb(a),b?(this.Xf.remove(a),this.Pc[c]===a&&this.Pc.splice(c,1),void 0!==d&&this.eb.remove(d)):(this.Xf.add(a),this.Pc[c]!==
a&&this.Pc.splice(c,0,a),void 0!==d&&this.eb.add(d,a)));return}if("linkLabelKeys"===a.modelChange){d=this.vf(a.object);Array.isArray(d)&&"number"===typeof c&&(b?(c=d.indexOf(a.newValue),0<=c&&d.splice(c,1)):0>d.indexOf(a.newValue)&&d.splice(c,0,a.newValue));return}}else if(a.change===xe){c=a.oldParam;if("linkDataArray"===a.modelChange){a=a.oldValue;za(a)&&"number"===typeof c&&(d=this.Vb(a),b?(this.Xf.add(a),this.Pc[c]!==a&&this.Pc.splice(c,0,a),void 0!==d&&this.eb.add(d,a)):(this.Xf.remove(a),this.Pc[c]===
a&&this.Pc.splice(c,1),void 0!==d&&this.eb.remove(d)));return}if("linkLabelKeys"===a.modelChange){d=this.vf(a.object);Array.isArray(d)&&"number"===typeof c&&(b?0>d.indexOf(a.newValue)&&d.splice(c,0,a.newValue):(c=d.indexOf(a.newValue),0<=c&&d.splice(c,1)));return}}Z.prototype.changeState.call(this,a,b)}};t=ar.prototype;t.sm=function(a){if(void 0!==a){var b=this.lj;if(null!==b){var c=this.Kb(a);null===c&&(c=this.copyNodeData(b),Tj(c,this.nodeKeyProperty,a),this.pf(c))}return a}};
t.ay=function(a){return vq(this,a,!0)};t.nw=function(a,b){Dq(this,a,b,!0)};t.gy=function(a){return vq(this,a,!1)};t.sw=function(a,b){Dq(this,a,b,!1)};function vq(a,b,c){if(null!==b&&(a=c?a.Ve:a.We,""!==a&&(a=rn(b,a),void 0!==a))){if(xq(a))return a;B((c?"FromKey":"ToKey")+" value for link data "+b+" is not a number or a string: "+a)}}
function Dq(a,b,c,d){null===c&&(c=void 0);if(null!==b){var e=d?a.Ve:a.We;if(""!==e)if(c=a.sm(c),a.vc(b)){var f=rn(b,e);f!==c&&(Bq(a,f,b),Tj(b,e,c),null===a.Kb(c)&&Cq(a,c,b),Wq(a,d?"linkFromKey":"linkToKey",ue,e,b,f,c),"string"===typeof e&&a.Ba(b,e))}else Tj(b,e,c)}}t.by=function(a){return uq(this,a,!0)};t.ow=function(a,b){Eq(this,a,b,!0)};t.hy=function(a){return uq(this,a,!1)};t.tw=function(a,b){Eq(this,a,b,!1)};
function uq(a,b,c){if(null===b)return"";a=c?a.Fj:a.Gj;if(""===a)return"";b=rn(b,a);return void 0===b?"":b}function Eq(a,b,c,d){if(null!==b){var e=d?a.Fj:a.Gj;if(""!==e)if(a.vc(b)){var f=rn(b,e);void 0===f&&(f="");f!==c&&(Tj(b,e,c),Wq(a,d?"linkFromPortId":"linkToPortId",ue,e,b,f,c),"string"===typeof e&&a.Ba(b,e))}else Tj(b,e,c)}}t.vf=function(a){if(null===a)return dr;var b=this.Od;if(""===b)return dr;a=rn(a,b);return void 0===a?dr:a};
t.Xt=function(a,b){if(null!==a){var c=this.Od;if(""!==c)if(this.vc(a)){var d=rn(a,c);void 0===d&&(d=dr);if(d!==b){if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)Bq(this,d[f],a);Tj(a,c,b);e=b.length;for(f=0;f<e;f++){var g=b[f];null===this.Kb(g)&&Cq(this,g,a)}Wq(this,"linkLabelKeys",ue,c,a,d,b);"string"===typeof c&&this.Ba(a,c)}}else Tj(a,c,b)}};
t.pv=function(a,b){if(null!==b&&void 0!==b&&null!==a){var c=this.Od;if(""!==c){var d=rn(a,c);if(void 0===d)c=[],c.push(b),this.Xt(a,c);else if(Array.isArray(d)){var e=d.indexOf(b);0<=e||(e=d.length,d.push(b),this.vc(a)&&(null===this.Kb(b)&&Cq(this,b,a),Wq(this,"linkLabelKeys",we,c,a,null,b,null,e)))}else B(c+" property is not an Array; cannot addLabelKeyForLinkData: "+a)}}};
t.ty=function(a,b){if(null!==b&&void 0!==b&&null!==a){var c=this.Od;if(""!==c){var d=rn(a,c);if(Array.isArray(d)){var e=d.indexOf(b);0>e||(d.splice(e,1),this.vc(a)&&(Bq(this,b,a),Wq(this,"linkLabelKeys",xe,c,a,b,null,e,null)))}else void 0!==d&&B(c+" property is not an Array; cannot removeLabelKeyforLinkData: "+a)}}};t.Vb=function(a){if(null!==a){var b=this.yi;if(""!==b&&(b=rn(a,b),void 0!==b)){if(xq(b))return b;B("Key value for link data "+a+" is not a number or a string: "+b)}}};
t.Wt=function(a,b){if(null!==a){var c=this.yi;if(""!==c)if(this.vc(a)){var d=rn(a,c);d!==b&&null===this.wg(b)&&(Tj(a,c,b),void 0!==d&&this.eb.remove(d),this.eb.add(b,a),Wq(this,"linkKey",ue,c,a,d,b),"string"===typeof c&&this.Ba(a,c))}else Tj(a,c,b)}};t.wg=function(a){null===a&&B("GraphLinksModel.findLinkDataForKey:key must not be null");return void 0!==a&&xq(a)?this.eb.H(a):null};
t.Fq=function(a){if(null!==a){var b=this.yi;if(""!==b){var c=this.Vb(a);if(void 0===c||this.eb.contains(c)){var d=this.yl;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.eb.contains(c))){Tj(a,b,c);return}if("string"===typeof c){for(d=2;this.eb.contains(c+d);)d++;Tj(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.eb.count-1;this.eb.contains(c);)c--;Tj(a,b,c)}}}}};t.vc=function(a){return null===a?!1:this.Xf.contains(a)};t.Ri=function(a){null!==a&&(nb(a),this.vc(a)||zq(this,a,!0))};
function zq(a,b,c){if(""!==a.linkKeyProperty){var d=a.Vb(b);if(void 0!==d&&a.eb.H(d)===b)return;a.Fq(b);d=a.Vb(b);if(void 0===d){B("GraphLinksModel.makeLinkDataKeyUnique failed on "+b+". Data not added to model.");return}a.eb.add(d,b)}a.Xf.add(b);d=null;c&&(d=a.Pc.length,a.Pc.splice(d,0,b));Wq(a,"linkDataArray",we,"linkDataArray",a,null,b,null,d);er(a,b)}t.Ty=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.Ri(a[c]);else for(a=a.iterator;a.next();)this.Ri(a.value)};
t.Am=function(a){null!==a&&yq(this,a,!0)};function yq(a,b,c){a.Xf.remove(b);var d=a.Vb(b);void 0!==d&&a.eb.remove(d);d=null;if(c){d=a.Pc.indexOf(b);if(0>d)return;a.Pc.splice(d,1)}Wq(a,"linkDataArray",xe,"linkDataArray",a,b,null,d,null);c=vq(a,b,!0);Bq(a,c,b);c=vq(a,b,!1);Bq(a,c,b);d=a.vf(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],Bq(a,c,b)}t.tA=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.Am(a[c]);else for(a=a.iterator;a.next();)this.Am(a.value)};
t.kA=function(a){""===this.linkKeyProperty&&B("GraphLinksModel.linkKeyProperty must not be an empty string for .mergeLinkDataArray() to succeed.");if(a!==this.linkDataArray&&Aa(a)){var b=this.Ei;b.clear();b.addAll(this.eb.iteratorKeys);var c=this.Bi;c.clear();for(var d=a.length,e=0;e<d;e++){var f=a[e],g=this.Vb(f);if(void 0!==g){c.add(g);var h=this.wg(g);h!==f&&(null!==h?(this.jq(h,f),cr(this,f,h)):(f=this.cloneDeep(f),this.Wt(f,g),this.Ri(f)))}else g=this.cloneDeep(f),this.Ri(g),c.add(this.Vb(g))}for(a=
b.iterator;a.next();)d=a.value,c.contains(d)||(d=this.wg(d))&&this.Am(d);this.mq();b.clear();c.clear()}};function er(a,b){var c=vq(a,b,!0);c=a.sm(c);null===a.Kb(c)&&Cq(a,c,b);c=vq(a,b,!1);c=a.sm(c);null===a.Kb(c)&&Cq(a,c,b);var d=a.vf(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],null===a.Kb(c)&&Cq(a,c,b)}
t.nq=function(a){if(null===a)return null;var b=this.Pk;a=null!==b?b(a,this):Xq(this,a,!0);za(a)&&(Ya(a),""!==this.Ve&&Tj(a,this.Ve,void 0),""!==this.We&&Tj(a,this.We,void 0),""!==this.Od&&Tj(a,this.Od,[]));return a};t.Rv=function(a){if(null===a)return!1;var b=this.Cl;return""===b?!1:rn(a,b)?!0:!1};t.Fh=function(a){if(null!==a){var b=this.ue;if(""!==b&&(b=rn(a,b),void 0!==b)){if(xq(b))return b;B("GroupKey value for node data "+a+" is not a number or a string: "+b)}}};
t.Sq=function(a,b){null===b&&(b=void 0);if(null!==a){var c=this.ue;if(""!==c)if(this.Ya(a)){var d=rn(a,c);d!==b&&(Bq(this,d,a),Tj(a,c,b),null===this.Kb(b)&&Cq(this,b,a),Wq(this,"nodeGroupKey",ue,c,a,d,b),"string"===typeof c&&this.Ba(a,c))}else Tj(a,c,b)}};ar.prototype.copyNodeData=function(a){if(null===a)return null;a=Z.prototype.copyNodeData.call(this,a);this.ck||""===this.ue||void 0===rn(a,this.ue)||Tj(a,this.ue,void 0);return a};
ar.prototype.setDataProperty=function(a,b,c){if(this.Ya(a)){if(b===this.nodeKeyProperty){this.Jm(a,c);return}if(b===this.nodeCategoryProperty){this.Im(a,c);return}if(b===this.nodeGroupKeyProperty){this.Sq(a,c);return}}else if(this.vc(a)){if(b===this.linkFromKeyProperty){Dq(this,a,c,!0);return}if(b===this.linkToKeyProperty){Dq(this,a,c,!1);return}if(b===this.linkFromPortIdProperty){Eq(this,a,c,!0);return}if(b===this.linkToPortIdProperty){Eq(this,a,c,!1);return}if(b===this.linkKeyProperty){this.Wt(a,
c);return}if(b===this.linkCategoryProperty){this.Rq(a,c);return}if(b===this.linkLabelKeysProperty){this.Xt(a,c);return}}var d=rn(a,b);d!==c&&(Tj(a,b,c),this.Qt(a,b,d,c))};t=ar.prototype;t.jq=function(a,b){if(b){var c=this.Ya(a),d=this.vc(a),e;for(e in b)"__gohashid"===e||c&&e===this.nodeKeyProperty||c&&e===this.nodeIsGroupProperty&&rn(a,e)===b[e]||d&&e===this.linkKeyProperty||this.setDataProperty(a,e,b[e])}};
t.Pq=function(a,b){Z.prototype.Pq.call(this,a,b);for(var c=this.Ua.iterator;c.next();)this.iw(c.value,a,b);for(c=this.Xf.iterator;c.next();){var d=c.value,e=a,f=b;if(vq(this,d,!0)===e){var g=this.Ve;Tj(d,g,f);Wq(this,"linkFromKey",ue,g,d,e,f);"string"===typeof g&&this.Ba(d,g)}vq(this,d,!1)===e&&(g=this.We,Tj(d,g,f),Wq(this,"linkToKey",ue,g,d,e,f),"string"===typeof g&&this.Ba(d,g));g=this.vf(d);if(Array.isArray(g))for(var h=g.length,k=this.Od,l=0;l<h;l++)g[l]===e&&(g[l]=f,Wq(this,"linkLabelKeys",we,
k,d,e,f,l,l))}};t.iw=function(a,b,c){if(this.Fh(a)===b){var d=this.ue;Tj(a,d,c);Wq(this,"nodeGroupKey",ue,d,a,b,c);"string"===typeof d&&this.Ba(a,d)}};t.Dw=function(){Z.prototype.Dw.call(this);for(var a=this.linkDataArray,b=a.length,c=0;c<b;c++)er(this,a[c])};
t.Em=function(a){Z.prototype.Em.call(this,a);a=this.ja(a);var b=Aq(this,a);if(null!==b){var c=Fa();for(b=b.iterator;b.next();){var d=b.value;if(this.Ya(d)){if(this.Fh(d)===a){var e=this.ue;Wq(this,"nodeGroupKey",ue,e,d,a,a);"string"===typeof e&&this.Ba(d,e);c.push(d)}}else if(vq(this,d,!0)===a&&(e=this.Ve,Wq(this,"linkFromKey",ue,e,d,a,a),"string"===typeof e&&this.Ba(d,e),c.push(d)),vq(this,d,!1)===a&&(e=this.We,Wq(this,"linkToKey",ue,e,d,a,a),"string"===typeof e&&this.Ba(d,e),c.push(d)),e=this.vf(d),
Array.isArray(e))for(var f=e.length,g=this.Od,h=0;h<f;h++)e[h]===a&&(Wq(this,"linkLabelKeys",we,g,d,a,a,h,h),c.push(d))}for(b=0;b<c.length;b++)Bq(this,a,c[b]);Ha(c)}};t.Dm=function(a){Z.prototype.Dm.call(this,a);var b=this.Fh(a);null===this.Kb(b)&&Cq(this,b,a)};t.Xq=function(a){Z.prototype.Xq.call(this,a);var b=this.Fh(a);Bq(this,b,a)};
t.yt=function(a){if(null===a)return"";var b=this.Ej;if(""===b)return"";b=rn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;B("getCategoryForLinkData found a non-string category for "+a+": "+b);return""};ar.prototype.getLinkCategoryForData=function(a){return this.yt(a)};ar.prototype.Rq=function(a,b){if(null!==a){var c=this.Ej;if(""!==c)if(this.vc(a)){var d=rn(a,c);void 0===d&&(d="");d!==b&&(Tj(a,c,b),Wq(this,"linkCategory",ue,c,a,d,b),"string"===typeof c&&this.Ba(a,c))}else Tj(a,c,b)}};
ar.prototype.setLinkCategoryForData=function(a,b){this.Rq(a,b)};t=ar.prototype;t.Km=function(a,b){Z.prototype.Km.call(this,a,b);this.Sq(b,this.Fh(a))};function cr(a,b,c){a.Rq(c,a.yt(b));a.nw(c,a.ay(b));a.sw(c,a.gy(b));a.Xt(c,a.vf(b));a.ow(c,a.by(b));a.tw(c,a.hy(b))}t.kk=function(){return!0};t.dj=function(){return!0};t.Gt=function(){return!0};t.lk=function(){return!0};
ma.Object.defineProperties(ar.prototype,{archetypeNodeData:{get:function(){return this.lj},set:function(a){var b=this.lj;b!==a&&(this.lj=a,this.g("archetypeNodeData",b,a))}},linkFromKeyProperty:{get:function(){return this.Ve},set:function(a){var b=this.Ve;b!==a&&(this.Ve=a,this.g("linkFromKeyProperty",b,a))}},linkToKeyProperty:{get:function(){return this.We},set:function(a){var b=this.We;b!==a&&(this.We=a,this.g("linkToKeyProperty",
b,a))}},linkFromPortIdProperty:{get:function(){return this.Fj},set:function(a){var b=this.Fj;b!==a&&(this.Fj=a,this.g("linkFromPortIdProperty",b,a))}},linkToPortIdProperty:{get:function(){return this.Gj},set:function(a){var b=this.Gj;b!==a&&(this.Gj=a,this.g("linkToPortIdProperty",b,a))}},linkLabelKeysProperty:{get:function(){return this.Od},set:function(a){var b=this.Od;b!==a&&(this.Od=a,this.g("linkLabelKeysProperty",
b,a))}},linkDataArray:{get:function(){return this.Pc},set:function(a){var b=this.Pc;if(b!==a){this.eb.clear();for(var c=a.length,d=0;d<c;d++){var e=a[d];if(!za(e)){B("GraphLinksModel.linkDataArray must only contain Objects, not: "+e);return}nb(e)}this.Pc=a;if(""!==this.linkKeyProperty){d=new E;for(e=0;e<c;e++){var f=a[e],g=this.Vb(f);void 0===g?d.add(f):null!==this.eb.H(g)?d.add(f):this.eb.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.Fq(e),f=this.Vb(e),void 0!==
f&&this.eb.add(f,e)}d=new F;for(e=0;e<c;e++)d.add(a[e]);this.Xf=d;Wq(this,"linkDataArray",ue,"linkDataArray",this,b,a);for(b=0;b<c;b++)er(this,a[b])}}},linkKeyProperty:{get:function(){return this.yi},set:function(a){var b=this.yi;if(b!==a){this.yi=a;this.eb.clear();for(var c=this.linkDataArray.length,d=0;d<c;d++){var e=this.linkDataArray[d],f=this.Vb(e);void 0===f&&(this.Fq(e),f=this.Vb(e));void 0!==f&&this.eb.add(f,e)}this.g("linkKeyProperty",b,a)}}},makeUniqueLinkKeyFunction:{
get:function(){return this.yl},set:function(a){var b=this.yl;b!==a&&(this.yl=a,this.g("makeUniqueLinkKeyFunction",b,a))}},copyLinkDataFunction:{get:function(){return this.Pk},set:function(a){var b=this.Pk;b!==a&&(this.Pk=a,this.g("copyLinkDataFunction",b,a))}},nodeIsGroupProperty:{get:function(){return this.Cl},set:function(a){var b=this.Cl;b!==a&&(this.Cl=a,this.g("nodeIsGroupProperty",b,a))}},nodeGroupKeyProperty:{
get:function(){return this.ue},set:function(a){var b=this.ue;b!==a&&(this.ue=a,this.g("nodeGroupKeyProperty",b,a))}},ck:{get:function(){return this.qn},set:function(a){this.qn!==a&&(this.qn=a)}},linkCategoryProperty:{get:function(){return this.Ej},set:function(a){var b=this.Ej;b!==a&&(this.Ej=a,this.g("linkCategoryProperty",b,a))}},type:{get:function(){return"GraphLinksModel"}}});
ar.prototype.setCategoryForLinkData=ar.prototype.Rq;ar.prototype.getCategoryForLinkData=ar.prototype.yt;ar.prototype.assignAllDataProperties=ar.prototype.jq;ar.prototype.setGroupKeyForNodeData=ar.prototype.Sq;ar.prototype.getGroupKeyForNodeData=ar.prototype.Fh;ar.prototype.isGroupForNodeData=ar.prototype.Rv;ar.prototype.copyLinkData=ar.prototype.nq;ar.prototype.mergeLinkDataArray=ar.prototype.kA;ar.prototype.removeLinkDataCollection=ar.prototype.tA;ar.prototype.removeLinkData=ar.prototype.Am;
ar.prototype.addLinkDataCollection=ar.prototype.Ty;ar.prototype.addLinkData=ar.prototype.Ri;ar.prototype.containsLinkData=ar.prototype.vc;ar.prototype.makeLinkDataKeyUnique=ar.prototype.Fq;ar.prototype.findLinkDataForKey=ar.prototype.wg;ar.prototype.setKeyForLinkData=ar.prototype.Wt;ar.prototype.getKeyForLinkData=ar.prototype.Vb;ar.prototype.removeLabelKeyForLinkData=ar.prototype.ty;ar.prototype.addLabelKeyForLinkData=ar.prototype.pv;ar.prototype.setLabelKeysForLinkData=ar.prototype.Xt;
ar.prototype.getLabelKeysForLinkData=ar.prototype.vf;ar.prototype.setToPortIdForLinkData=ar.prototype.tw;ar.prototype.getToPortIdForLinkData=ar.prototype.hy;ar.prototype.setFromPortIdForLinkData=ar.prototype.ow;ar.prototype.getFromPortIdForLinkData=ar.prototype.by;ar.prototype.setToKeyForLinkData=ar.prototype.sw;ar.prototype.getToKeyForLinkData=ar.prototype.gy;ar.prototype.setFromKeyForLinkData=ar.prototype.nw;ar.prototype.getFromKeyForLinkData=ar.prototype.ay;ar.prototype.clear=ar.prototype.clear;
var dr=Object.freeze([]);ar.className="GraphLinksModel";Zq.GraphLinksModel=ar;Z.constructGraphLinksModel=Z.constructGraphLinksModel=function(){return new ar};Z.initDiagramModel=Di=function(){return new ar};function fr(a){Z.call(this);this.ve="parent";this.sn=!1;this.Lj="parentLinkCategory";void 0!==a&&(this.nodeDataArray=a)}la(fr,Z);fr.constructGraphLinksModel=Z.constructGraphLinksModel;
fr.prototype.cloneProtected=function(a){Z.prototype.cloneProtected.call(this,a);a.ve=this.ve;a.sn=this.sn;a.Lj=this.Lj};t=fr.prototype;t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.Vq();var b=(""!==this.name?this.name:"")+" TreeModel";if(0<a){b+="\n node data:";a=this.nodeDataArray;for(var c=a.length,d=0;d<c;d++){var e=a[d];b+=" "+this.ja(e)+":"+Ja(e)}}return b};
t.Bk=function(){var a=Z.prototype.Bk.call(this),b="";"parent"!==this.nodeParentKeyProperty&&"string"===typeof this.nodeParentKeyProperty&&(b+=',\n  "nodeParentKeyProperty": '+this.quote(this.nodeParentKeyProperty));return a+b};t.Mq=function(a){Z.prototype.Mq.call(this,a);a.nodeParentKeyProperty&&(this.nodeParentKeyProperty=a.nodeParentKeyProperty)};t.$q=function(a){Qq(this,a,"nodeParentKeyProperty");return Z.prototype.$q.call(this,a)};
t.Lq=function(a){void 0!==a.nodeParentKeyProperty&&a.nodeParentKeyProperty!==this.nodeParentKeyProperty&&B("applyIncrementalJson cannot change Model properties");Z.prototype.Lq.call(this,a)};t.sm=function(a){return a};t.Gh=function(a){if(null!==a){var b=this.ve;if(""!==b&&(b=rn(a,b),void 0!==b)){if(xq(b))return b;B("ParentKey value for node data "+a+" is not a number or a string: "+b)}}};
t.ae=function(a,b){null===b&&(b=void 0);if(null!==a){var c=this.ve;if(""!==c)if(b=this.sm(b),this.Ya(a)){var d=rn(a,c);d!==b&&(Bq(this,d,a),Tj(a,c,b),null===this.Kb(b)&&Cq(this,b,a),Wq(this,"nodeParentKey",ue,c,a,d,b),"string"===typeof c&&this.Ba(a,c))}else Tj(a,c,b)}};t.At=function(a){if(null===a)return"";var b=this.Lj;if(""===b)return"";b=rn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;B("getParentLinkCategoryForNodeData found a non-string category for "+a+": "+b);return""};
fr.prototype.getLinkCategoryForData=function(a){return this.At(a)};fr.prototype.Yt=function(a,b){if(null!==a){var c=this.Lj;if(""!==c)if(this.Ya(a)){var d=rn(a,c);void 0===d&&(d="");d!==b&&(Tj(a,c,b),Wq(this,"parentLinkCategory",ue,c,a,d,b),"string"===typeof c&&this.Ba(a,c))}else Tj(a,c,b)}};fr.prototype.setLinkCategoryForData=function(a,b){this.Yt(a,b)};
fr.prototype.copyNodeData=function(a){if(null===a)return null;a=Z.prototype.copyNodeData.call(this,a);this.dk||""===this.ve||void 0===rn(a,this.ve)||Tj(a,this.ve,void 0);return a};fr.prototype.setDataProperty=function(a,b,c){if(this.Ya(a)){if(b===this.nodeKeyProperty){this.Jm(a,c);return}if(b===this.nodeCategoryProperty){this.Im(a,c);return}if(b===this.nodeParentKeyProperty){this.ae(a,c);return}}var d=rn(a,b);d!==c&&(Tj(a,b,c),this.Qt(a,b,d,c))};t=fr.prototype;
t.Pq=function(a,b){Z.prototype.Pq.call(this,a,b);for(var c=this.Ua.iterator;c.next();)this.iw(c.value,a,b)};t.iw=function(a,b,c){if(this.Gh(a)===b){var d=this.ve;Tj(a,d,c);Wq(this,"nodeParentKey",ue,d,a,b,c);"string"===typeof d&&this.Ba(a,d)}};
t.Em=function(a){Z.prototype.Em.call(this,a);a=this.ja(a);var b=Aq(this,a);if(null!==b){var c=Fa();for(b=b.iterator;b.next();){var d=b.value;if(this.Ya(d)&&this.Gh(d)===a){var e=this.ve;Wq(this,"nodeParentKey",ue,e,d,a,a);"string"===typeof e&&this.Ba(d,e);c.push(d)}}for(b=0;b<c.length;b++)Bq(this,a,c[b]);Ha(c)}};t.Dm=function(a){Z.prototype.Dm.call(this,a);var b=this.Gh(a);b=this.sm(b);null===this.Kb(b)&&Cq(this,b,a)};t.Xq=function(a){Z.prototype.Xq.call(this,a);var b=this.Gh(a);Bq(this,b,a)};
t.Km=function(a,b){Z.prototype.Km.call(this,a,b);this.Yt(b,this.At(a));this.ae(b,this.Gh(a))};t.rm=function(){return!0};t.Gt=function(){return!0};
ma.Object.defineProperties(fr.prototype,{nodeParentKeyProperty:{get:function(){return this.ve},set:function(a){var b=this.ve;b!==a&&(this.ve=a,this.g("nodeParentKeyProperty",b,a))}},dk:{get:function(){return this.sn},set:function(a){this.sn!==a&&(this.sn=a)}},parentLinkCategoryProperty:{get:function(){return this.Lj},set:function(a){var b=this.Lj;b!==a&&(this.Lj=a,this.g("parentLinkCategoryProperty",b,a))}},
linkCategoryProperty:{get:function(){return this.parentLinkCategoryProperty},set:function(a){this.parentLinkCategoryProperty=a}},type:{get:function(){return"TreeModel"}}});fr.prototype.setParentLinkCategoryForNodeData=fr.prototype.Yt;fr.prototype.getParentLinkCategoryForNodeData=fr.prototype.At;fr.prototype.setParentKeyForNodeData=fr.prototype.ae;fr.prototype.getParentKeyForNodeData=fr.prototype.Gh;fr.className="TreeModel";Zq.TreeModel=fr;
function gr(){Fi.call(this);this.ex=this.Gn=this.$b=0;this.Jr=360;this.bx=hr;this.tj=0;this.Uw=new I;this.vr=this.Ud=0;this.it=new jr;this.nu=this.Kj=0;this.Ky=600;this.lp=NaN;this.bn=1;this.Qp=0;this.Vl=360;this.Cb=hr;this.J=kr;this.Rc=lr;this.Mc=Zp;this.ef=6;this.Vo=mr}la(gr,Fi);gr.prototype.cloneProtected=function(a){Fi.prototype.cloneProtected.call(this,a);a.lp=this.lp;a.bn=this.bn;a.Qp=this.Qp;a.Vl=this.Vl;a.Cb=this.Cb;a.J=this.J;a.Rc=this.Rc;a.Mc=this.Mc;a.ef=this.ef;a.Vo=this.Vo};
gr.prototype.gb=function(a){if(a.classType===gr)if(a===nr||a===or||a===pr||a===qr||a===lr)this.sorting=a;else if(a===rr||a===sr||a===kr||a===tr)this.direction=a;else if(a===ur||a===vr||a===hr||a===wr)this.arrangement=a;else{if(a===xr||a===mr)this.nodeDiameterFormula=a}else Fi.prototype.gb.call(this,a)};gr.prototype.createNetwork=function(){return new yr(this)};
gr.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);a=this.network.vertexes;if(1>=a.count)1===a.count&&(a=a.first(),a.centerX=0,a.centerY=0);else{var b=new E;b.addAll(a.iterator);a=new E;var c=new E;var d=this.sort(b);var e,f,g=this.vr;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===wr&&k===xr?h=hr:h===wr&&k!==xr&&(h=this.arrangement);if((this.direction===rr||this.direction===sr)&&this.sorting!==lr){for(k=0;!(k>=d.length);k+=2){a.add(d.L(k));if(k+1>=d.length)break;c.add(d.L(k+1))}this.direction===rr?(this.arrangement===wr&&a.reverse(),d=new E,d.addAll(a),d.addAll(c)):(this.arrangement===wr&&c.reverse(),d=new E,d.addAll(c),d.addAll(a))}k=d.length;for(var r=f=e=0;r<
d.length;r++){var q=n+p*f*(this.direction===kr?1:-1)/k,u=d.L(r).diameter;isNaN(u)&&(u=zr(d.L(r),q));360>p&&(0===r||r===d.length-1)&&(u/=2);e+=u;f++}if(isNaN(l)||h===wr){isNaN(b)&&(b=6);if(h!==hr&&h!==wr){f=-Infinity;for(g=0;g<k;g++)r=d.L(g),e=d.L(g===k-1?0:g+1),isNaN(r.diameter)&&zr(r,0),isNaN(e.diameter)&&zr(e,0),f=Math.max(f,(r.diameter+e.diameter)/2);g=f+b;h===ur?l=(f+b)/(2*Math.PI/k):l=Ar(this,g*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180)}else l=Ar(this,e+(360<=p?k:k-1)*(h!==wr?b:1.6*b),m,n*
Math.PI/180,p*Math.PI/180);f=l*m}else if(f=l*m,r=Br(this,l,f,n*Math.PI/180,p*Math.PI/180),isNaN(b)){if(h===hr||h===wr)b=(r-e)/(360<=p?k:k-1)}else if(h===hr||h===wr)r=(r-e)/(360<=p?k:k-1),r<b?(l=Ar(this,e+b*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180),f=l*m):b=r;else{g=-Infinity;for(e=0;e<k;e++)q=d.L(e),u=d.L(e===k-1?0:e+1),isNaN(q.diameter)&&zr(q,0),isNaN(u.diameter)&&zr(u,0),g=Math.max(g,(q.diameter+u.diameter)/2);g+=b;e=Ar(this,g*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180);e>l?(l=e,f=l*m):g=
r/(360<=p?k:k-1)}this.bx=h;this.$b=l;this.Gn=m;this.ex=n;this.Jr=p;this.tj=b;this.Ud=f;this.vr=g;b=d;d=this.bx;h=this.$b;l=this.ex;m=this.Jr;n=this.tj;p=this.Ud;k=this.vr;if(this.direction!==rr&&this.direction!==sr||d!==wr)if(this.direction===rr||this.direction===sr){g=0;switch(d){case vr:g=180*Cr(this,h,p,l,k)/Math.PI;break;case hr:k=b=0;g=a.first();null!==g&&(b=zr(g,Math.PI/2));g=c.first();null!==g&&(k=zr(g,Math.PI/2));g=180*Cr(this,h,p,l,n+(b+k)/2)/Math.PI;break;case ur:g=m/b.length}if(this.direction===
rr){switch(d){case vr:Dr(this,a,l,tr);break;case hr:Er(this,a,l,tr);break;case ur:Fr(this,a,m/2,l,tr)}switch(d){case vr:Dr(this,c,l+g,kr);break;case hr:Er(this,c,l+g,kr);break;case ur:Fr(this,c,m/2,l+g,kr)}}else{switch(d){case vr:Dr(this,c,l,tr);break;case hr:Er(this,c,l,tr);break;case ur:Fr(this,c,m/2,l,tr)}switch(d){case vr:Dr(this,a,l+g,kr);break;case hr:Er(this,a,l+g,kr);break;case ur:Fr(this,a,m/2,l+g,kr)}}}else switch(d){case vr:Dr(this,b,l,this.direction);break;case hr:Er(this,b,l,this.direction);
break;case ur:Fr(this,b,m,l,this.direction);break;case wr:Gr(this,b,m,l,this.direction)}else Gr(this,b,m,l-m/2,kr)}this.updateParts();this.network=null;this.isValidLayout=!0};function Fr(a,b,c,d,e){var f=a.Jr,g=a.$b;a=a.Ud;d=d*Math.PI/180;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=d+(e===kr?k*c/(360<=f?h:h-1):-(k*c)/h),m=b.L(k),n=g*Math.tan(l)/a;n=Math.sqrt((g*g+a*a*n*n)/(1+n*n));m.centerX=n*Math.cos(l);m.centerY=n*Math.sin(l);m.actualAngle=180*l/Math.PI}}
function Er(a,b,c,d){var e=a.$b,f=a.Ud,g=a.tj;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=b.L(k),m=b.L(k===h-1?0:k+1),n=f*Math.sin(c);l.centerX=e*Math.cos(c);l.centerY=n;l.actualAngle=180*c/Math.PI;isNaN(l.diameter)&&zr(l,0);isNaN(m.diameter)&&zr(m,0);l=Cr(a,e,f,d===kr?c:-c,(l.diameter+m.diameter)/2+g);c+=d===kr?l:-l}}
function Dr(a,b,c,d){var e=a.$b,f=a.Ud,g=a.vr;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=b.L(k);l.centerX=e*Math.cos(c);l.centerY=f*Math.sin(c);l.actualAngle=180*c/Math.PI;l=Cr(a,e,f,d===kr?c:-c,g);c+=d===kr?l:-l}}function Gr(a,b,c,d,e){var f=a.Jr;a.Kj=0;a.it=new jr;if(360>c){for(f=d+(e===kr?f:-f);0>f;)f+=360;f%=360;180<f&&(f-=360);f*=Math.PI/180;a.nu=f;Hr(a,b,c,d,e)}else Ir(a,b,c,d,e);a.it.commit(b)}
function Ir(a,b,c,d,e){var f=a.$b,g=a.tj,h=a.Gn,k=f*Math.cos(d*Math.PI/180),l=a.Ud*Math.sin(d*Math.PI/180),m=b.na();if(3===m.length)m[0].centerX=f,m[0].centerY=0,m[1].centerX=m[0].centerX-m[0].width/2-m[1].width/2-g,m[1].y=m[0].y,m[2].centerX=(m[0].centerX+m[1].centerX)/2,m[2].y=m[0].y-m[2].height-g;else if(4===m.length)m[0].centerX=f,m[0].centerY=0,m[2].centerX=-m[0].centerX,m[2].centerY=m[0].centerY,m[1].centerX=0,m[1].y=Math.min(m[0].y,m[2].y)-m[1].height-g,m[3].centerX=0,m[3].y=Math.max(m[0].y+
m[0].height+g,m[2].y+m[2].height+g);else{f=I.alloc();for(var n=0;n<m.length;n++){m[n].centerX=k;m[n].centerY=l;if(n>=m.length-1)break;Jr(a,k,l,m,n,e,f)||Kr(a,k,l,m,n,e,f);k=f.x;l=f.y}I.free(f);a.Kj++;if(!(23<a.Kj)){k=m[0].centerX;l=m[0].centerY;f=m[m.length-1].centerX;n=m[m.length-1].centerY;var p=Math.abs(k-f)-((m[0].width+m[m.length-1].width)/2+g),r=Math.abs(l-n)-((m[0].height+m[m.length-1].height)/2+g);g=0;1>Math.abs(r)?Math.abs(k-f)<(m[0].width+m[m.length-1].width)/2&&(g=0):g=0<r?r:1>Math.abs(p)?
0:p;k=Math.abs(f)>Math.abs(n)?0<f!==l>n:0<n!==k<f;if(k=e===kr?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.it.compare(g,m);1<Math.abs(g)&&(a.$b=8>a.Kj?a.$b-g/(2*Math.PI):5>m.length&&10<g?a.$b/2:a.$b-(0<g?1.7:-2.3),a.Ud=a.$b*h,Ir(a,b,c,d,e))}}}
function Hr(a,b,c,d,e){for(var f=a.$b,g=a.Ud,h=a.Gn,k=f*Math.cos(d*Math.PI/180),l=g*Math.sin(d*Math.PI/180),m=I.alloc(),n=b.na(),p=0;p<n.length;p++){n[p].centerX=k;n[p].centerY=l;if(p>=n.length-1)break;Jr(a,k,l,n,p,e,m)||Kr(a,k,l,n,p,e,m);k=m.x;l=m.y}I.free(m);a.Kj++;if(!(23<a.Kj)){k=Math.atan2(l,k);k=e===kr?a.nu-k:k-a.nu;k=Math.abs(k)<Math.abs(k-2*Math.PI)?k:k-2*Math.PI;f=k*(f+g)/2;g=a.it;if(Math.abs(f)<Math.abs(g.mm))for(g.mm=f,g.Ck=[],g.Pm=[],k=0;k<n.length;k++)g.Ck[k]=n[k].bounds.x,g.Pm[k]=n[k].bounds.y;
1<Math.abs(f)&&(a.$b=8>a.Kj?a.$b-f/(2*Math.PI):a.$b-(0<f?1.7:-2.3),a.Ud=a.$b*h,Hr(a,b,c,d,e))}}function Jr(a,b,c,d,e,f,g){var h=a.$b,k=a.Ud,l=0;a=(d[e].width+d[e+1].width)/2+a.tj;var m=!1;if(0<=c!==(f===kr)){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 Kr(a,b,c,d,e,f,g){var h=a.$b,k=a.Ud,l=0;a=(d[e].height+d[e+1].height)/2+a.tj;d=!1;if(0<=b!==(f===kr)){if(f=c-a,f<-k){f=c+a;if(f>k){g.x=l;g.y=f;return}d=!0}}else if(f=c+a,f>k){f=c-a;if(f<-k){g.x=l;g.y=f;return}d=!0}l=Math.sqrt(1-Math.min(1,f*f/(k*k)))*h;0>b!==d&&(l=-l);g.x=l;g.y=f}gr.prototype.commitLayout=function(){this.commitNodes();this.isRouting&&this.commitLinks()};
gr.prototype.commitNodes=function(){var a=null!==this.group&&null!==this.group.placeholder&&this.group.isSubGraphExpanded,b=a?this.group.location.copy():null,c=this.actualCenter;a?c=new I(0,0):(c.x=this.arrangementOrigin.x+this.$b,c.y=this.arrangementOrigin.y+this.Ud);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.Ab(),a=this.group.position.copy(),c=this.group.location.copy(),b=b.be(c.be(a)),this.group.move(b),this.Uw=b.be(a))};
gr.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};function Br(a,b,c,d,e){var f=a.Ky;if(.001>Math.abs(a.Gn-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 Ar(a,b,c,d,e){return b/(void 0!==d&&void 0!==e?Br(a,1,c,d,e):Br(a,1,c))}function Cr(a,b,c,d,e){if(.001>Math.abs(a.Gn-1))return e/b;var f=b>c?Math.sqrt(b*b-c*c)/b:Math.sqrt(c*c-b*b)/c,g=0;a=2*Math.PI/(700*a.network.vertexes.count);b>c&&(d+=Math.PI/2);for(var h=0;;h++){var k=Math.sin(d+h*a);g+=(b>c?b:c)*Math.sqrt(1-f*f*k*k)*a;if(g>=e)return h*a}}
gr.prototype.sort=function(a){switch(this.sorting){case pr:break;case qr:a.reverse();break;case nr:a.sort(this.comparer);break;case or:a.sort(this.comparer);a.reverse();break;case lr:for(var b=[],c=0;c<a.length;c++)b.push(0);c=new E;for(var d=0;d<a.length;d++){var e=-1,f=-1;if(0===d)for(var g=0;g<a.length;g++){var h=a.L(g).edgesCount;h>e&&(e=h,f=g)}else for(g=0;g<a.length;g++)h=b[g],h>e&&(e=h,f=g);c.add(a.L(f));b[f]=-1;f=a.L(f);for(g=f.sourceEdges;g.next();)e=a.indexOf(g.value.fromVertex),0>e||0<=
b[e]&&b[e]++;for(f=f.destinationEdges;f.next();)e=a.indexOf(f.value.toVertex),0>e||0<=b[e]&&b[e]++}a=[];for(b=0;b<c.length;b++){e=c.L(b);a[b]=[];for(f=e.destinationEdges;f.next();)d=c.indexOf(f.value.toVertex),d!==b&&0>a[b].indexOf(d)&&a[b].push(d);for(e=e.sourceEdges;e.next();)d=c.indexOf(e.value.fromVertex),d!==b&&0>a[b].indexOf(d)&&a[b].push(d)}f=[];for(b=0;b<a.length;b++)f[b]=0;b=[];g=[];h=[];e=[];d=new E;for(var k=0,l=0;l<a.length;l++){var m=a[l].length;if(1===m)e.push(l);else if(0===m)d.add(c.L(l));
else{if(0===k)b.push(l);else{for(var n=m=Infinity,p=-1,r=[],q=0;q<b.length;q++)0>a[b[q]].indexOf(b[q===b.length-1?0:q+1])&&r.push(q===b.length-1?0:q+1);if(0===r.length)for(q=0;q<b.length;q++)r.push(q);for(q=0;q<r.length;q++){for(var u=r[q],v=a[l],w=0,y=0;y<g.length;y++){var z=f[g[y]],A=f[h[y]];if(z<A){var C=z;z=A}else C=A;if(C<u&&u<=z)for(A=0;A<v.length;A++){var G=v[A];0>b.indexOf(G)||C<f[G]&&f[G]<z||C===f[G]||z===f[G]||w++}else for(A=0;A<v.length;A++)G=v[A],0>b.indexOf(G)||C<f[G]&&f[G]<z&&C!==f[G]&&
z!==f[G]&&w++}v=w;for(y=w=0;y<a[l].length;y++)C=b.indexOf(a[l][y]),0<=C&&(C=Math.abs(u-(C>=u?C+1:C)),w+=C<b.length+1-C?C:b.length+1-C);for(y=0;y<g.length;y++)C=f[g[y]],z=f[h[y]],C>=u&&C++,z>=u&&z++,C>z&&(A=z,z=C,C=A),z-C<(b.length+2)/2===(C<u&&u<=z)&&w++;if(v<m||v===m&&w<n)m=v,n=w,p=u}b.splice(p,0,l);for(m=0;m<b.length;m++)f[b[m]]=m;for(m=0;m<a[l].length;m++)n=a[l][m],0<=b.indexOf(n)&&(g.push(l),h.push(n))}k++}}for(g=b.length;;){f=!0;for(h=0;h<e.length;h++)if(k=e[h],l=a[k][0],m=b.indexOf(l),0<=m){for(p=
n=0;p<a[l].length;p++)r=b.indexOf(a[l][p]),0>r||r===m||(q=r>m?r-m:m-r,n+=r<m!==q>g-q?1:-1);b.splice(0>n?m:m+1,0,k);e.splice(h,1);h--}else f=!1;if(f)break;else b.push(e[0]),e.splice(0,1)}for(a=0;a<b.length;a++)d.add(c.L(b[a]));return d;default:B("Invalid sorting type.")}return a};
ma.Object.defineProperties(gr.prototype,{radius:{get:function(){return this.lp},set:function(a){this.lp!==a&&(0<a||isNaN(a))&&(this.lp=a,this.C())}},aspectRatio:{get:function(){return this.bn},set:function(a){this.bn!==a&&0<a&&(this.bn=a,this.C())}},startAngle:{get:function(){return this.Qp},set:function(a){this.Qp!==a&&(this.Qp=a,this.C())}},sweepAngle:{get:function(){return this.Vl},
set:function(a){this.Vl!==a&&(0<a&&360>=a?this.Vl=a:this.Vl=360,this.C())}},arrangement:{get:function(){return this.Cb},set:function(a){this.Cb===a||a!==wr&&a!==hr&&a!==vr&&a!==ur||(this.Cb=a,this.C())}},direction:{get:function(){return this.J},set:function(a){this.J===a||a!==kr&&a!==tr&&a!==rr&&a!==sr||(this.J=a,this.C())}},sorting:{get:function(){return this.Rc},set:function(a){this.Rc===a||a!==pr&&a!==qr&&
a!==nr&&!or&&a!==lr||(this.Rc=a,this.C())}},comparer:{get:function(){return this.Mc},set:function(a){this.Mc!==a&&(this.Mc=a,this.C())}},spacing:{get:function(){return this.ef},set:function(a){this.ef!==a&&(this.ef=a,this.C())}},nodeDiameterFormula:{get:function(){return this.Vo},set:function(a){this.Vo===a||a!==mr&&a!==xr||(this.Vo=a,this.C())}},actualXRadius:{get:function(){return this.$b}},
actualYRadius:{get:function(){return this.Ud}},actualSpacing:{get:function(){return this.tj}},actualCenter:{get:function(){return this.Uw}}});
var hr=new D(gr,"ConstantSpacing",0),vr=new D(gr,"ConstantDistance",1),ur=new D(gr,"ConstantAngle",2),wr=new D(gr,"Packed",3),kr=new D(gr,"Clockwise",4),tr=new D(gr,"Counterclockwise",5),rr=new D(gr,"BidirectionalLeft",6),sr=new D(gr,"BidirectionalRight",7),pr=new D(gr,"Forwards",8),qr=new D(gr,"Reverse",9),nr=new D(gr,"Ascending",10),or=new D(gr,"Descending",11),lr=new D(gr,"Optimized",12),mr=new D(gr,"Pythagorean",13),xr=new D(gr,"Circular",14);gr.className="CircularLayout";gr.ConstantSpacing=hr;
gr.ConstantDistance=vr;gr.ConstantAngle=ur;gr.Packed=wr;gr.Clockwise=kr;gr.Counterclockwise=tr;gr.BidirectionalLeft=rr;gr.BidirectionalRight=sr;gr.Forwards=pr;gr.Reverse=qr;gr.Ascending=nr;gr.Descending=or;gr.Optimized=lr;gr.Pythagorean=mr;gr.Circular=xr;function jr(){this.mm=-Infinity;this.Pm=this.Ck=null}
jr.prototype.compare=function(a,b){if(0<a&&0>this.mm||Math.abs(a)<Math.abs(this.mm)&&!(0>a&&0<this.mm))for(this.mm=a,this.Ck=[],this.Pm=[],a=0;a<b.length;a++)this.Ck[a]=b[a].bounds.x,this.Pm[a]=b[a].bounds.y};jr.prototype.commit=function(a){if(null!==this.Ck&&null!==this.Pm)for(var b=0;b<this.Ck.length;b++){var c=a.L(b);c.x=this.Ck[b];c.y=this.Pm[b]}};jr.className="VertexArrangement";function yr(a){Pp.call(this,a)}la(yr,Pp);yr.prototype.createVertex=function(){return new Lr(this)};
yr.prototype.createEdge=function(){return new Mr(this)};yr.className="CircularNetwork";function Lr(a){Sp.call(this,a);this.I=this.rj=NaN}la(Lr,Sp);
function zr(a,b){var c=a.network;if(null===c)return NaN;c=c.layout;if(null===c)return NaN;if(c.arrangement===wr)if(c.nodeDiameterFormula===xr)a.rj=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.rj=Math.min(a.height/c,a.width/b)}else a.rj=c.nodeDiameterFormula===xr?Math.max(a.width,a.height):Math.sqrt(a.width*a.width+a.height*a.height);return a.rj}
ma.Object.defineProperties(Lr.prototype,{diameter:{get:function(){return this.rj},set:function(a){this.rj!==a&&(this.rj=a)}},actualAngle:{get:function(){return this.I},set:function(a){this.I!==a&&(this.I=a)}}});Lr.className="CircularVertex";function Mr(a){Tp.call(this,a)}la(Mr,Tp);Mr.className="CircularEdge";
function Nr(){Fi.call(this);this.yh=null;this.oo=0;this.Cd=(new M(100,100)).freeze();this.an=!1;this.cf=!0;this.Zc=!1;this.zl=100;this.Jn=1;this.Tf=1E3;this.Mo=10;this.mp=Math;this.Wk=.05;this.Vk=50;this.Tk=150;this.Uk=0;this.An=10;this.zn=5}la(Nr,Fi);
Nr.prototype.cloneProtected=function(a){Fi.prototype.cloneProtected.call(this,a);a.Cd.assign(this.Cd);a.an=this.an;a.cf=this.cf;a.Zc=this.Zc;a.zl=this.zl;a.Jn=this.Jn;a.Tf=this.Tf;a.Mo=this.Mo;a.mp=this.mp;a.Wk=this.Wk;a.Vk=this.Vk;a.Tk=this.Tk;a.Uk=this.Uk;a.An=this.An;a.zn=this.zn};Nr.prototype.createNetwork=function(){return new Or(this)};
Nr.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));a=this.maxIterations;if(0<this.network.vertexes.count){this.network.oq();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.rv();this.oo=0;if(this.needsClusterLayout()){b=this.network;for(c=b.By().iterator;c.next();){this.network=
c.value;for(var d=this.network.vertexes.iterator;d.next();){var e=d.value;e.zd=e.vertexes.count;e.Lh=1;e.bk=null;e.He=null}Pr(this,0,a)}this.network=b;c.reset();d=this.arrangementSpacing;for(var f=c.count,g=!0,h=e=0,k=Fa(),l=0;l<f+b.vertexes.count+2;l++)k[l]=null;f=0;c.reset();for(var m=N.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 I(m.x+m.width+d.width,m.y),k[1]=new I(m.x,m.y+m.height+d.height),f=2;else{var n=Qr(k,f,e,h,m.width,m.height,
d),p=k[n],r=new I(p.x+m.width+d.width,p.y),q=new I(p.x,p.y+m.height+d.height);n+1<f&&k.splice(n+1,0,null);k[n]=r;k[n+1]=q;f++;n=p.x-m.x;p=p.y-m.y;for(l=l.vertexes.iterator;l.next();)r=l.value,r.centerX+=n,r.centerY+=p}N.free(m);for(l=b.vertexes.iterator;l.next();)g=l.value,r=g.bounds,2>f?(e=r.x+r.width/2,h=r.y+r.height/2,k[0]=new I(r.x+r.width+d.width,r.y),k[1]=new I(r.x,r.y+r.height+d.height),f=2):(m=Qr(k,f,e,h,r.width,r.height,d),p=k[m],n=new I(p.x+r.width+d.width,p.y),r=new I(p.x,p.y+r.height+
d.height),m+1<f&&k.splice(m+1,0,null),k[m]=n,k[m+1]=r,f++,g.centerX=p.x+g.width/2,g.centerY=p.y+g.height/2);Ha(k);for(c.reset();c.next();){d=c.value;for(e=d.vertexes.iterator;e.next();)b.Bh(e.value);for(d=d.edges.iterator;d.next();)b.hq(d.value)}}Rr(this,a);this.updateParts()}this.zl=a;this.network=null;this.isValidLayout=!0};
Nr.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.Ic(c)&&(a++,2<a))return!0;if(10<b)break;b++}return!1};Nr.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.Jc(d.bounds)}return b};
function Pr(a,b,c){if(Sr(a,b)){var d=a.Tf;a.Tf*=1+1/(b+1);var e=Tr(a,b),f=Math.max(0,Math.max(Math.min(a.network.vertexes.count,c*(b+1)/11),10));a.maxIterations+=f;Pr(a,b+1,c);Rr(a,f);Ur(a,e);b=e.vertexes.na();b.sort(function(a,b){return null===a||null===b||a===b?0:b.zd-a.zd});for(c=0;c<b.length;c++)Vr(a,b[c]);a.Tf=d}}
function Sr(a,b){if(10<b||3>a.network.vertexes.count)return!1;a.yh=a.network.vertexes.na();a=a.yh;a.sort(function(a,b){return null===a||null===b||a===b?0:b.zd-a.zd});for(b=a.length-1;0<=b&&1>=a[b].zd;)b--;return 1<a.length-b}
function Tr(a,b){for(var c=a.network,d=new Or(a),e=0;e<a.yh.length;e++){var f=a.yh[e];if(1<f.zd){d.Bh(f);var g=new Wr;g.cu=f.zd;g.du=f.width;g.bu=f.height;g.Kw=f.focus.x;g.Lw=f.focus.y;null===f.He&&(f.He=new E);f.He.add(g);f.lw=f.He.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.hq(h):e.network===d?(h=e.bk,null===h&&(h=new E,e.bk=h),h.add(g),e.zd--,e.Lh+=g.Lh):g.network===d&&(h=g.bk,null===h&&(h=new E,g.bk=h),h.add(e),
g.zd--,g.Lh+=e.Lh)}for(e=d.edges.iterator;e.next();)f=e.value,f.length*=Math.max(1,K.sqrt((f.fromVertex.Lh+f.toVertex.Lh)/(4*b+1)));for(b=d.vertexes.iterator;b.next();){e=b.value;var k=e.bk;if(null!==k&&0<k.count&&(g=e.He.L(e.He.count-1).cu-e.zd,!(0>=g))){for(var l=h=0,m=k.count-g;m<k.count;m++){var n=k.L(m),p=null;for(f=n.edges.iterator;f.next();){var r=f.value;if(r.ey(n)===e){p=r;break}}null!==p&&(l+=p.length,h+=n.width*n.height)}f=e.centerX;k=e.centerY;m=e.width;n=e.height;p=e.focus;r=m*n;1>r&&
(r=1);h=K.sqrt((h+r+l*l*4/(g*g))/r);g=(h-1)*m/2;h=(h-1)*n/2;e.bounds=new N(f-p.x-g,k-p.y-h,m+2*g,n+2*h);e.focus=new I(p.x+g,p.y+h)}}a.network=d;return c}function Ur(a,b){for(var c=a.network.vertexes.iterator;c.next();){var d=c.value;d.network=b;if(null!==d.He){var e=d.He.L(d.lw);d.zd=e.cu;var f=e.Kw,g=e.Lw;d.bounds=new N(d.centerX-f,d.centerY-g,e.du,e.bu);d.focus=new I(f,g);d.lw--}}for(c=a.network.edges.iterator;c.next();)c.value.network=b;a.network=b}
function Vr(a,b){var c=b.bk;if(null!==c&&0!==c.count){var d=b.centerX,e=b.centerY,f=b.width,g=b.height;null!==b.He&&0<b.He.count&&(g=b.He.L(0),f=g.du,g=g.bu);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.zd?k++:(h=!0,l++,g+=Math.atan2(b.centerY-n.centerY,b.centerX-n.centerX))}if(0!==k)for(0<l&&(g/=l),l=b=0,b=h?2*Math.PI/(k+1):2*Math.PI/k,0===k%2&&(l=b/2),1<c.count&&c.sort(function(a,b){return null===a||null===b||a===b?0:b.width*b.height-a.width*a.height}),
h=0===k%2?0:1,c=c.iterator;c.next();)if(k=c.value,!(1<k.zd||a.isFixed(k))){m=null;for(n=k.edges.iterator;n.next();){m=n.value;break}n=k.width;var p=k.height;n=K.sqrt(n*n+p*p)/2;m=f+m.length+n;n=g+(b*(h/2>>1)+l)*(0===h%2?1:-1);k.centerX=d+m*Math.cos(n);k.centerY=e+m*Math.sin(n);h++}}}
function Qr(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}Nr.prototype.rv=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)};
Nr.prototype.addComments=function(a){var b=a.node;if(null!==b)for(b=b.Dv();b.next();){var c=b.value;if("Comment"===c.category&&c.isVisible()){var d=this.network.$i(c);null===d&&(d=this.network.cm(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.pk(a,d,null));c.length=this.defaultCommentSpringLength}}};
function Xr(a,b){var c=a.bounds,d=c.x;a=c.y;var e=c.width;c=c.height;var f=b.bounds,g=f.x;b=f.y;var h=f.width;f=f.height;return d+e<g?a>b+f?(c=d+e-g,a=a-b-f,K.sqrt(c*c+a*a)):a+c<b?(d=d+e-g,a=a+c-b,K.sqrt(d*d+a*a)):g-(d+e):d>g+h?a>b+f?(c=d-g-h,a=a-b-f,K.sqrt(c*c+a*a)):a+c<b?(d=d-g-h,a=a+c-b,K.sqrt(d*d+a*a)):d-(g+h):a>b+f?a-(b+f):a+c<b?b-(a+c):.1}function Rr(a,b){a.yh=null;for(b=a.oo+b;a.oo<b&&(a.oo++,Yr(a)););a.yh=null}
function Yr(a){null===a.yh&&(a.yh=a.network.vertexes.na());var b=a.yh;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.Tf;var l=d=h=0;for(f=
0;f<b.length;f++){g=b[f];d=g.bounds;h=g.focus;k=d.x+h.x;var m=d.y+h.y;d=g.charge*a.electricalFieldX(k,m);l=g.charge*a.electricalFieldY(k,m);d+=g.mass*a.gravitationalFieldX(k,m);l+=g.mass*a.gravitationalFieldY(k,m);g.forceX+=d;g.forceY+=l;for(var n=f+1;n<b.length;n++){var p=b[n];if(p!==g){d=p.bounds;h=p.focus;l=d.x+h.x;var r=d.y+h.y;if(k-l>c||l-k>c){if(e)break}else if(m-r>c||r-m>c){if(!e)break}else{var q=Xr(g,p);1>q?(d=a.randomNumberGenerator,null===d&&(a.randomNumberGenerator=d=new Zr),q=d.random(),
h=d.random(),k>l?(d=Math.abs(p.bounds.right-g.bounds.x),d=(1+d)*q):k<l?(d=Math.abs(p.bounds.x-g.bounds.right),d=-(1+d)*q):(d=Math.max(p.width,g.width),d=(1+d)*q-d/2),m>r?(l=Math.abs(p.bounds.bottom-g.bounds.y),l=(1+l)*h):k<l?(l=Math.abs(p.bounds.y-g.bounds.bottom),l=-(1+l)*h):(l=Math.max(p.height,g.height),l=(1+l)*h-l/2)):(h=-(g.charge*p.charge)/(q*q),d=(l-k)/q*h,l=(r-m)/q*h);g.forceX+=d;g.forceY+=l;p.forceX-=d;p.forceY-=l}}}}for(e=a.network.edges.iterator;e.next();)h=e.value,c=h.fromVertex,f=h.toVertex,
g=c.bounds,k=c.focus,d=g.x+k.x,g=g.y+k.y,m=f.bounds,n=f.focus,k=m.x+n.x,m=m.y+n.y,n=Xr(c,f),1>n?(n=a.randomNumberGenerator,null===n&&(a.randomNumberGenerator=n=new Zr),h=n.random(),n=n.random(),d=(d>k?1:-1)*(1+(f.width>c.width?f.width:c.width))*h,l=(g>m?1:-1)*(1+(f.height>c.height?f.height:c.height))*n):(h=h.stiffness*(n-h.length),d=(k-d)/n*h,l=(m-g)/n*h),c.forceX+=d,c.forceY+=l,f.forceX-=d,f.forceY-=l;for(e=d=0;e<b.length;e++)c=b[e],a.isFixed(c)?a.moveFixedVertex(c):d=Math.max(d,a.moveVertex(c)||
0);return d>a.epsilonDistance*a.epsilonDistance}Nr.prototype.moveVertex=function(a){var b=a.forceX,c=a.forceY,d=this.moveLimit;b<-d?b=-d:b>d&&(b=d);c<-d?c=-d:c>d&&(c=d);a.centerX+=b;a.centerY+=c;return b*b+c*c};Nr.prototype.moveFixedVertex=function(){};Nr.prototype.commitLayout=function(){this.pw();this.commitNodes();this.isRouting&&this.commitLinks()};
Nr.prototype.pw=function(){if(this.setsPortSpots)for(var a=this.network.edges.iterator;a.next();){var b=a.value.link;null!==b&&(b.fromSpot=$c,b.toSpot=$c)}};Nr.prototype.commitNodes=function(){var a=0,b=0;if(this.arrangesToOrigin){var c=N.alloc();this.computeBounds(this.network,c);b=this.arrangementOrigin;a=b.x-c.x;b=b.y-c.y;N.free(c)}c=N.alloc();for(var d=this.network.vertexes.iterator;d.next();){var e=d.value;if(0!==a||0!==b)c.assign(e.bounds),c.x+=a,c.y+=b,e.bounds=c;e.commit()}N.free(c)};
Nr.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};Nr.prototype.springStiffness=function(a){a=a.stiffness;return isNaN(a)?this.Wk:a};Nr.prototype.springLength=function(a){a=a.length;return isNaN(a)?this.Vk:a};Nr.prototype.electricalCharge=function(a){a=a.charge;return isNaN(a)?this.Tk:a};Nr.prototype.electricalFieldX=function(){return 0};Nr.prototype.electricalFieldY=function(){return 0};
Nr.prototype.gravitationalMass=function(a){a=a.mass;return isNaN(a)?this.Uk:a};Nr.prototype.gravitationalFieldX=function(){return 0};Nr.prototype.gravitationalFieldY=function(){return 0};Nr.prototype.isFixed=function(a){return a.isFixed};
ma.Object.defineProperties(Nr.prototype,{currentIteration:{get:function(){return this.oo}},arrangementSpacing:{get:function(){return this.Cd},set:function(a){this.Cd.w(a)||(this.Cd.assign(a),this.C())}},arrangesToOrigin:{get:function(){return this.an},set:function(a){this.an!==a&&(this.an=a,this.C())}},setsPortSpots:{get:function(){return this.cf},set:function(a){this.cf!==a&&(this.cf=
a,this.C())}},comments:{get:function(){return this.Zc},set:function(a){this.Zc!==a&&(this.Zc=a,this.C())}},maxIterations:{get:function(){return this.zl},set:function(a){this.zl!==a&&0<=a&&(this.zl=a,this.C())}},epsilonDistance:{get:function(){return this.Jn},set:function(a){this.Jn!==a&&0<a&&(this.Jn=a,this.C())}},infinityDistance:{get:function(){return this.Tf},set:function(a){this.Tf!==
a&&1<a&&(this.Tf=a,this.C())}},moveLimit:{get:function(){return this.Mo},set:function(a){this.Mo!==a&&1<a&&(this.Mo=a,this.C())}},randomNumberGenerator:{get:function(){return this.mp},set:function(a){this.mp!==a&&(null!==a&&"function"!==typeof a.random&&B('ForceDirectedLayout.randomNumberGenerator must have a "random()" function on it: '+a),this.mp=a)}},defaultSpringStiffness:{get:function(){return this.Wk},
set:function(a){this.Wk!==a&&(this.Wk=a,this.C())}},defaultSpringLength:{get:function(){return this.Vk},set:function(a){this.Vk!==a&&(this.Vk=a,this.C())}},defaultElectricalCharge:{get:function(){return this.Tk},set:function(a){this.Tk!==a&&(this.Tk=a,this.C())}},defaultGravitationalMass:{get:function(){return this.Uk},set:function(a){this.Uk!==a&&(this.Uk=a,this.C())}},defaultCommentSpringLength:{
get:function(){return this.An},set:function(a){this.An!==a&&(this.An=a,this.C())}},defaultCommentElectricalCharge:{get:function(){return this.zn},set:function(a){this.zn!==a&&(this.zn=a,this.C())}}});Nr.className="ForceDirectedLayout";function Wr(){this.Lw=this.Kw=this.bu=this.du=this.cu=0}Wr.className="ForceDirectedSubnet";function Or(a){Pp.call(this,a)}la(Or,Pp);Or.prototype.createVertex=function(){return new $r(this)};Or.prototype.createEdge=function(){return new as(this)};
Or.className="ForceDirectedNetwork";function $r(a){Sp.call(this,a);this.Ja=!1;this.bb=this.I=NaN;this.Lh=this.zd=this.Ia=this.T=0;this.He=this.bk=null;this.lw=0}la($r,Sp);
ma.Object.defineProperties($r.prototype,{isFixed:{get:function(){return this.Ja},set:function(a){this.Ja!==a&&(this.Ja=a)}},charge:{get:function(){return this.I},set:function(a){this.I!==a&&(this.I=a)}},mass:{get:function(){return this.bb},set:function(a){this.bb!==a&&(this.bb=a)}},forceX:{get:function(){return this.T},set:function(a){this.T!==a&&(this.T=a)}},forceY:{
get:function(){return this.Ia},set:function(a){this.Ia!==a&&(this.Ia=a)}}});$r.className="ForceDirectedVertex";function as(a){Tp.call(this,a);this.l=this.u=NaN}la(as,Tp);ma.Object.defineProperties(as.prototype,{stiffness:{get:function(){return this.u},set:function(a){this.u!==a&&(this.u=a)}},length:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a)}}});as.className="ForceDirectedEdge";
function Zr(){var a=0;void 0===a&&(a=42);this.seed=a;this.Dy=48271;this.Fy=2147483647;this.Q=44488.07041494893;this.Hy=3399;this.Ey=1/2147483647;this.random()}Zr.prototype.random=function(){var a=this.seed%this.Q*this.Dy-this.seed/this.Q*this.Hy;0<a?this.seed=a:this.seed=a+this.Fy;return this.seed*this.Ey};Zr.className="RandomNumberGenerator";
function bs(){Fi.call(this);this.Zb=this.pe=25;this.J=0;this.Rk=cs;this.ul=ds;this.jl=es;this.Cj=4;this.Gk=fs;this.jg=7;this.cf=!0;this.wo=4;this.Ea=this.ks=this.xa=-1;this.sd=this.Ho=0;this.Ha=this.qd=this.rd=this.Nd=this.gc=null;this.Ro=0;this.Qo=this.Hj=null;this.Rd=0;this.So=null;this.Gf=new I;this.se=[];this.se.length=100}la(bs,Fi);
bs.prototype.cloneProtected=function(a){Fi.prototype.cloneProtected.call(this,a);a.pe=this.pe;a.Zb=this.Zb;a.J=this.J;a.Rk=this.Rk;a.ul=this.ul;a.jl=this.jl;a.Cj=this.Cj;a.Gk=this.Gk;a.jg=this.jg;a.cf=this.cf;a.wo=this.wo};
bs.prototype.gb=function(a){a.classType===bs?0===a.name.indexOf("Aggressive")?this.aggressiveOption=a:0===a.name.indexOf("Cycle")?this.cycleRemoveOption=a:0===a.name.indexOf("Init")?this.initializeOption=a:0===a.name.indexOf("Layer")?this.layeringOption=a:B("Unknown enum value: "+a):Fi.prototype.gb.call(this,a)};bs.prototype.createNetwork=function(){return new gs(this)};
bs.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);this.ks=-1;this.sd=this.Ho=0;this.So=this.Qo=this.Hj=null;for(a=0;a<this.se.length;a++)this.se[a]=null;if(0<this.network.vertexes.count){this.network.oq();this.cycleRemoveOption!==hs&&this.removeCycles();for(a=this.network.vertexes.iterator;a.next();)a.value.layer=-1;this.xa=-1;this.assignLayers();for(a.reset();a.next();)this.xa=Math.max(this.xa,
a.value.layer);this.cycleRemoveOption===hs&&this.removeCycles();a=this.network;for(var b=[],c=a.edges.iterator;c.next();){var d=c.value;d.valid=!1;b.push(d)}for(c=0;c<b.length;c++){d=b[c];var e=d.fromVertex,f=d.toVertex;if(!d.valid&&(null!==e.node&&null!==f.node||e.layer!==f.layer)){var g=0,h=0,k=0,l=0;if(null!==d.link){h=d.link;if(null===h)continue;var m=e.node;g=f.node;if(null===m||null===g)continue;var n=h.fromNode;k=h.toNode;var p=h.fromPort;h=h.toPort;if(d.rev){l=n;var r=p;n=k;p=h;k=l;h=r}var q=
e.focus;l=f.focus;var u=d.rev?f.bounds:e.bounds;r=I.alloc();m!==n?u.v()&&n.isVisible()?n.actualBounds.v()?(n.wf(p,Ac,r),r.x+=n.actualBounds.x-u.x,r.y+=n.actualBounds.y-u.y):(n.wf(p,Ac,r),r.v()||r.assign(q)):r.assign(q):u.v()?(n.wf(p,Ac,r),r.v()||r.assign(q)):r.assign(q);n=d.rev?e.bounds:f.bounds;m=I.alloc();g!==k?n.v()&&k.isVisible()?k.actualBounds.v()?(k.wf(h,Ac,m),m.x+=k.actualBounds.x-n.x,m.y+=k.actualBounds.y-n.y):(k.wf(h,Ac,m),m.v()||m.assign(l)):m.assign(l):n.v()?(k.wf(h,Ac,m),m.v()||m.assign(l)):
m.assign(l);90===this.J||270===this.J?(g=Math.round((r.x-q.x)/this.Zb),k=r.x,h=Math.round((m.x-l.x)/this.Zb),l=m.x):(g=Math.round((r.y-q.y)/this.Zb),k=r.y,h=Math.round((m.y-l.y)/this.Zb),l=m.y);I.free(r);I.free(m);d.portFromColOffset=g;d.portFromPos=k;d.portToColOffset=h;d.portToPos=l}else d.portFromColOffset=0,d.portFromPos=0,d.portToColOffset=0,d.portToPos=0;r=e.layer;m=f.layer;n=0;u=d.link;if(null!==u){var v=u.fromPort,w=u.toPort;if(null!==v&&null!==w){var y=u.fromNode;p=u.toNode;if(null!==y&&
null!==p){var z=is(this,!0),A=is(this,!1),C=this.setsPortSpots?z:u.computeSpot(!0,v);q=this.setsPortSpots?A:u.computeSpot(!1,w);var G=u.isOrthogonal;C.gd()&&C.xf(A)&&q.gd()&&q.xf(z)?n=0:(z=u.getLinkPoint(y,v,C,!0,G,p,w,I.alloc()),A=u.getLinkDirection(y,v,z,C,!0,G,p,w),I.free(z),C.Ht()||A!==js(this,d,!0)?this.setsPortSpots&&null!==y&&1===y.ports.count&&d.rev&&(n+=1):n+=1,C=u.getLinkPoint(p,w,q,!1,G,y,v,I.alloc()),u=u.getLinkDirection(p,w,C,q,!1,G,y,v),I.free(C),q.Ht()||u!==js(this,d,!1)?this.setsPortSpots&&
null!==p&&1===p.ports.count&&d.rev&&(n+=2):n+=2)}}}p=n;n=1===p||3===p?!0:!1;if(p=2===p||3===p?!0:!1)q=a.createVertex(),q.node=null,q.Zj=1,q.layer=r,q.near=e,a.Bh(q),e=a.pk(e,q,d.link),e.valid=!1,e.rev=d.rev,e.portFromColOffset=g,e.portToColOffset=0,e.portFromPos=k,e.portToPos=0,e=q;u=1;n&&u--;if(r-m>u&&0<r){d.valid=!1;q=a.createVertex();q.node=null;q.Zj=2;q.layer=r-1;a.Bh(q);e=a.pk(e,q,d.link);e.valid=!0;e.rev=d.rev;e.portFromColOffset=p?0:g;e.portToColOffset=0;e.portFromPos=p?0:k;e.portToPos=0;e=
q;for(r--;r-m>u&&0<r;)q=a.createVertex(),q.node=null,q.Zj=3,q.layer=r-1,a.Bh(q),e=a.pk(e,q,d.link),e.valid=!0,e.rev=d.rev,e.portFromColOffset=0,e.portToColOffset=0,e.portFromPos=0,e.portToPos=0,e=q,r--;e=a.pk(q,f,d.link);e.valid=!n;n&&(q.near=f);e.rev=d.rev;e.portFromColOffset=0;e.portToColOffset=h;e.portFromPos=0;e.portToPos=l}else d.valid=!0}}a=this.gc=[];for(b=0;b<=this.xa;b++)a[b]=0;for(b=this.network.vertexes.iterator;b.next();)b.value.index=-1;this.initializeIndices();this.ks=-1;for(c=this.sd=
this.Ho=0;c<=this.xa;c++)a[c]>a[this.sd]&&(this.ks=a[c]-1,this.sd=c),a[c]<a[this.Ho]&&(this.Ho=c);this.So=[];for(c=0;c<a.length;c++)this.So[c]=[];for(b.reset();b.next();)a=b.value,this.So[a.layer][a.index]=a;this.Ea=-1;for(a=0;a<=this.xa;a++){b=ks(this,a);c=0;d=this.gc[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.Ea=Math.max(this.Ea,c-1);ls(this,a,b)}this.reduceCrossings();this.straightenAndPack();this.updateParts()}this.network=
null;this.isValidLayout=!0};bs.prototype.linkMinLength=function(){return 1};function ms(a){var b=a.fromVertex.node;a=a.toVertex.node;return null===b&&null===a?8:null===b||null===a?4:1}bs.prototype.nodeMinLayerSpace=function(a,b){return null===a.node?0:90===this.J||270===this.J?b?a.focus.y+10:a.bounds.height-a.focus.y+10:b?a.focus.x+10:a.bounds.width-a.focus.x+10};
bs.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.J;return 90===c||270===c?b?a.Yv=a.focus.x/this.Zb+1|0:a.Xv=(a.bounds.width-a.focus.x)/this.Zb+1|0:b?a.Yv=a.focus.y/this.Zb+1|0:a.Xv=(a.bounds.height-a.focus.y)/this.Zb+1|0};function ns(a){null===a.Hj&&(a.Hj=[]);for(var b=0,c=a.network.vertexes.iterator;c.next();){var d=c.value;a.Hj[b]=d.layer;b++;a.Hj[b]=d.column;b++;a.Hj[b]=d.index;b++}return a.Hj}
function os(a,b){var c=0;for(a=a.network.vertexes.iterator;a.next();){var d=a.value;d.layer=b[c];c++;d.column=b[c];c++;d.index=b[c];c++}}
function ps(a,b,c){var d=ks(a,b),e=a.gc[b];if(null===a.Qo||a.Qo.length<e*e)a.Qo=[];for(var f=a.Qo,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.Zj===l.Zj||h++}else for(m=g-1;m>k;m--)n=d[m],n.near===l&&n.Zj===l.Zj||h++;var p;if(0<=c)for(k=d[g].sourceEdgesArrayAccess,l=0;l<k.length;l++){var r=k[l];if(r.valid&&r.fromVertex.layer!==b)for(n=r.fromVertex.index,m=r.portToPos,r=r.portFromPos,p=l+1;p<k.length;p++){var q=
k[p];if(q.valid&&q.fromVertex.layer!==b){var u=q.fromVertex.index;var v=q.portToPos;q=q.portFromPos;m<v&&(n>u||n===u&&r>q)&&h++;v<m&&(u>n||u===n&&q>r)&&h++}}}if(0>=c)for(k=d[g].destinationEdgesArrayAccess,l=0;l<k.length;l++)if(r=k[l],r.valid&&r.toVertex.layer!==b)for(n=r.toVertex.index,m=r.portToPos,r=r.portFromPos,p=l+1;p<k.length;p++)q=k[p],q.valid&&q.toVertex.layer!==b&&(u=q.toVertex.index,v=q.portToPos,q=q.portFromPos,r<q&&(n>u||n===u&&m>v)&&h++,q<r&&(u>n||u===n&&v>m)&&h++);f[g*e+g]=h;for(k=g+
1;k<e;k++){var w=0,y=0;if(0<=c){h=d[g].sourceEdgesArrayAccess;var z=d[k].sourceEdgesArrayAccess;for(l=0;l<h.length;l++)if(r=h[l],r.valid&&r.fromVertex.layer!==b)for(n=r.fromVertex.index,r=r.portFromPos,p=0;p<z.length;p++)q=z[p],q.valid&&q.fromVertex.layer!==b&&(u=q.fromVertex.index,q=q.portFromPos,(n<u||n===u&&r<q)&&y++,(u<n||u===n&&q<r)&&w++)}if(0>=c)for(h=d[g].destinationEdgesArrayAccess,z=d[k].destinationEdgesArrayAccess,l=0;l<h.length;l++)if(r=h[l],r.valid&&r.toVertex.layer!==b)for(n=r.toVertex.index,
m=r.portToPos,p=0;p<z.length;p++)q=z[p],q.valid&&q.toVertex.layer!==b&&(u=q.toVertex.index,v=q.portToPos,(n<u||n===u&&m<v)&&y++,(u<n||u===n&&v<m)&&w++);f[g*e+k]=w;f[k*e+g]=y}}ls(a,b,d);return f}bs.prototype.countCrossings=function(){for(var a=0,b=0;b<=this.xa;b++)for(var c=ps(this,b,1),d=this.gc[b],e=0;e<d;e++)for(var f=e;f<d;f++)a+=c[e*d+f];return a};
function qs(a){for(var b=0,c=0;c<=a.xa;c++){for(var d=a,e=c,f=ks(d,e),g=d.gc[e],h=0,k=0;k<g;k++){var l=f[k].destinationEdgesArrayAccess;if(null!==l)for(var m=0;m<l.length;m++){var n=l[m];if(n.valid&&n.toVertex.layer!==e){var p=n.fromVertex.column+n.portFromColOffset;var r=n.toVertex.column+n.portToColOffset;h+=(Math.abs(p-r)+1)*ms(n)}}}ls(d,e,f);b+=h}return b}
bs.prototype.normalize=function(){var a=Infinity;this.Ea=-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.Ea=Math.max(this.Ea,c.column+this.nodeMinColumnSpace(c,!1))}for(b.reset();b.next();)b.value.column-=a;this.Ea-=a};
function rs(a,b,c){for(var d=ks(a,b),e=a.gc[b],f=[],g=0;g<e;g++){var h=d[g],k=null;0>=c&&(k=h.sourceEdgesArrayAccess);var l=null;0<=c&&(l=h.destinationEdgesArrayAccess);var m=0,n=0,p=h.near;null!==p&&p.layer===h.layer&&(m+=p.column-1,n++);if(null!==k)for(p=0;p<k.length;p++){h=k[p];var r=h.fromVertex;h.valid&&!h.rev&&r.layer!==b&&(m+=r.column,n++)}if(null!==l)for(k=0;k<l.length;k++)h=l[k],p=h.toVertex,h.valid&&!h.rev&&p.layer!==b&&(m+=p.column,n++);f[g]=0===n?-1:m/n}ls(a,b,d);return f}
function ss(a,b,c){for(var d=ks(a,b),e=a.gc[b],f=[],g=0;g<e;g++){var h=d[g],k=null;0>=c&&(k=h.sourceEdgesArrayAccess);var l=null;0<=c&&(l=h.destinationEdgesArrayAccess);var m=0,n=[],p=h.near;null!==p&&p.layer===h.layer&&(n[m]=p.column-1,m++);h=void 0;if(null!==k)for(p=0;p<k.length;p++){h=k[p];var r=h.fromVertex;h.valid&&!h.rev&&r.layer!==b&&(n[m]=r.column+h.portFromColOffset,m++)}if(null!==l)for(k=0;k<l.length;k++)h=l[k],p=h.toVertex,h.valid&&!h.rev&&p.layer!==b&&(n[m]=p.column+h.portToColOffset,
m++);0===m?f[g]=-1:(n.sort(function(a,b){return a-b}),l=m>>1,f[g]=0!==(m&1)?n[l]:n[l-1]+n[l]>>1)}ls(a,b,d);return f}function ts(a,b,c,d,e,f){if(b.component===d){b.component=c;if(e)for(var g=b.destinationEdges;g.next();){var h=g.value;var k=h.toVertex;var l=b.layer-k.layer;h=a.linkMinLength(h);l===h&&ts(a,k,c,d,e,f)}if(f)for(g=b.sourceEdges;g.next();)h=g.value,k=h.fromVertex,l=k.layer-b.layer,h=a.linkMinLength(h),l===h&&ts(a,k,c,d,e,f)}}
function us(a,b,c,d,e,f){if(b.component===d){b.component=c;if(e)for(var g=b.destinationEdges;g.next();)us(a,g.value.toVertex,c,d,e,f);if(f)for(b=b.sourceEdges;b.next();)us(a,b.value.fromVertex,c,d,e,f)}}
bs.prototype.removeCycles=function(){for(var a=this.network.edges.iterator;a.next();)a.value.rev=!1;switch(this.Rk){default:case vs:a=this.network;var b=0,c=a.vertexes.count-1,d=[];d.length=c+1;for(var e=a.vertexes.iterator;e.next();)e.value.valid=!0;for(;null!==ws(a);){for(e=xs(a);null!==e;)d[c]=e,c--,e.valid=!1,e=xs(a);for(e=ys(a);null!==e;)d[b]=e,b++,e.valid=!1,e=ys(a);e=null;for(var f=0,g=this.network.vertexes.iterator;g.next();){var h=g.value;if(h.valid){for(var k=0,l=h.destinationEdges;l.next();)l.value.toVertex.valid&&
k++;l=0;for(var m=h.sourceEdges;m.next();)m.value.fromVertex.valid&&l++;if(null===e||f<k-l)e=h,f=k-l}}null!==e&&(d[b]=e,b++,e.valid=!1)}for(b=0;b<a.vertexes.count;b++)d[b].index=b;for(d=a.edges.iterator;d.next();)b=d.value,b.fromVertex.index>b.toVertex.index&&(a.Fm(b),b.rev=!0);break;case cs:for(d=this.network.vertexes.iterator;d.next();)a=d.value,a.hm=-1,a.finish=-1;for(a=this.network.edges.iterator;a.next();)a.value.forest=!1;this.Ro=0;for(d.reset();d.next();)b=d.value,0===b.sourceEdges.count&&
zs(this,b);for(d.reset();d.next();)b=d.value,-1===b.hm&&zs(this,b);for(a.reset();a.next();)d=a.value,d.forest||(b=d.fromVertex,c=b.finish,e=d.toVertex,f=e.finish,e.hm<b.hm&&c<f&&(this.network.Fm(d),d.rev=!0));break;case hs:a=this.network;b=a.vertexes.iterator;for(d=Infinity;b.next();)d=Math.min(d,b.value.layer);if(Infinity>d){if(0>d)for(b.reset();b.next();)b.value.layer-=d;d=[];for(b.reset();b.next();)c=b.value,e=d[c.layer],void 0===e?d[c.layer]=[c]:e.push(c);for(c=b=0;c<d.length;c++)if(e=d[c],!e||
0===e.length)b++;else if(0<c)for(f=0;f<e.length;f++)e[f].layer-=b;for(d=a.edges.iterator;d.next();)b=d.value,b.fromVertex.layer<b.toVertex.layer&&(a.Fm(b),b.rev=!0)}}};function ws(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid)return b}return null}function xs(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid){for(var c=!0,d=b.destinationEdges;d.next();)if(d.value.toVertex.valid){c=!1;break}if(c)return b}}return null}
function ys(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid){for(var c=!0,d=b.sourceEdges;d.next();)if(d.value.fromVertex.valid){c=!1;break}if(c)return b}}return null}function zs(a,b){b.hm=a.Ro;a.Ro++;for(var c=b.destinationEdges;c.next();){var d=c.value,e=d.toVertex;-1===e.hm&&(d.forest=!0,zs(a,e))}b.finish=a.Ro;a.Ro++}
bs.prototype.assignLayers=function(){switch(this.ul){case As:Bs(this);break;case Cs:for(var a,b=this.network.vertexes.iterator;b.next();)a=Ds(this,b.value),this.xa=Math.max(a,this.xa);for(b.reset();b.next();)a=b.value,a.layer=this.xa-a.layer;break;default:case ds:Bs(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&&Es(this,a);a=Infinity;for(b.reset();b.next();)a=Math.min(a,b.value.layer);this.xa=-1;for(b.reset();b.next();){var c=
b.value;c.layer-=a;this.xa=Math.max(this.xa,c.layer)}}};function Bs(a){for(var b=a.network.vertexes.iterator;b.next();){var c=Fs(a,b.value);a.xa=Math.max(c,a.xa)}}function Fs(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,Fs(a,f)+e)}b.layer=c}else c=b.layer;return c}
function Ds(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,Ds(a,f)+e)}b.layer=c}else c=b.layer;return c}
function Es(a,b){if(!b.valid){b.valid=!0;for(var c=b.destinationEdges;c.next();)Es(a,c.value.toVertex);for(c=a.network.vertexes.iterator;c.next();)c.value.component=-1;for(var d=b.sourceEdgesArrayAccess,e=d.length,f=0;f<e;f++){var g=d[f],h=g.fromVertex,k=g.toVertex;g=a.linkMinLength(g);h.layer-k.layer>g&&ts(a,h,0,-1,!0,!1)}for(ts(a,b,1,-1,!0,!0);0!==b.component;){f=0;d=Infinity;h=0;k=null;for(g=a.network.vertexes.iterator;g.next();){var l=g.value;if(1===l.component){var m=0,n=!1,p=l.sourceEdgesArrayAccess;
e=p.length;for(var r=0;r<e;r++){var q=p[r],u=q.fromVertex;m+=1;1!==u.component&&(f+=1,u=u.layer-l.layer,q=a.linkMinLength(q),d=Math.min(d,u-q))}p=l.destinationEdgesArrayAccess;e=p.length;for(r=0;r<e;r++)q=p[r].toVertex,--m,1!==q.component?--f:n=!0;(null===k||m<h)&&!n&&(k=l,h=m)}}if(0<f){for(c.reset();c.next();)e=c.value,1===e.component&&(e.layer+=d);b.component=0}else k.component=0}for(c=a.network.vertexes.iterator;c.next();)c.value.component=-1;for(ts(a,b,1,-1,!0,!1);0!==b.component;){d=0;e=Infinity;
f=0;h=null;for(k=a.network.vertexes.iterator;k.next();)if(g=k.value,1===g.component){l=0;m=!1;p=g.sourceEdgesArrayAccess;n=p.length;for(r=0;r<n;r++)q=p[r].fromVertex,l+=1,1!==q.component?d+=1:m=!0;p=g.destinationEdgesArrayAccess;n=p.length;for(r=0;r<n;r++)q=p[r],u=q.toVertex,--l,1!==u.component&&(--d,u=g.layer-u.layer,q=a.linkMinLength(q),e=Math.min(e,u-q));(null===h||l>f)&&!m&&(h=g,f=l)}if(0>d){for(c.reset();c.next();)d=c.value,1===d.component&&(d.layer-=e);b.component=0}else h.component=0}}}
function js(a,b,c){return 90===a.J?c&&!b.rev||!c&&b.rev?270:90:180===a.J?c&&!b.rev||!c&&b.rev?0:180:270===a.J?c&&!b.rev||!c&&b.rev?90:270:c&&!b.rev||!c&&b.rev?180:0}
bs.prototype.initializeIndices=function(){switch(this.jl){default:case Gs:for(var a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;b.index=this.gc[c];this.gc[c]++}break;case es:a=this.network.vertexes.iterator;for(b=this.xa;0<=b;b--)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&Hs(this,c);break;case Is:for(a=this.network.vertexes.iterator,b=0;b<=this.xa;b++)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&Js(this,c)}};
function Hs(a,b){var c=b.layer;b.index=a.gc[c];a.gc[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&&Hs(a,d))}
function Js(a,b){var c=b.layer;b.index=a.gc[c];a.gc[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&&Js(a,d))}
bs.prototype.reduceCrossings=function(){var a=this.countCrossings(),b=ns(this),c,d;for(c=0;c<this.Cj;c++){for(d=0;d<=this.xa;d++)Ks(this,d,1),Ls(this,d,1);var e=this.countCrossings();e<a&&(a=e,b=ns(this));for(d=this.xa;0<=d;d--)Ks(this,d,-1),Ls(this,d,-1);e=this.countCrossings();e<a&&(a=e,b=ns(this))}os(this,b);for(c=0;c<this.Cj;c++){for(d=0;d<=this.xa;d++)Ks(this,d,0),Ls(this,d,0);e=this.countCrossings();e<a&&(a=e,b=ns(this));for(d=this.xa;0<=d;d--)Ks(this,d,0),Ls(this,d,0);e=this.countCrossings();
e<a&&(a=e,b=ns(this))}os(this,b);var f,g,h;switch(this.Gk){case Ms:break;case Ns:for(h=a+1;(d=this.countCrossings())<h;)for(h=d,c=this.xa;0<=c;c--)for(g=0;g<=c;g++){for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Ls(this,d,-1)||f;e=this.countCrossings();e>=a?os(this,b):(a=e,b=ns(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Ls(this,d,1)||f;e=this.countCrossings();e>=a?os(this,b):(a=e,b=ns(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Ls(this,d,1)||f;e>=a?os(this,b):(a=e,b=ns(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=
Ls(this,d,-1)||f;e>=a?os(this,b):(a=e,b=ns(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Ls(this,d,0)||f;e>=a?os(this,b):(a=e,b=ns(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Ls(this,d,0)||f;e>=a?os(this,b):(a=e,b=ns(this))}break;default:case fs:for(c=this.xa,g=0,h=a+1;(d=this.countCrossings())<h;){h=d;for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Ls(this,d,-1)||f;e=this.countCrossings();e>=a?os(this,b):(a=e,b=ns(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Ls(this,d,1)||f;e=this.countCrossings();e>=a?os(this,b):
(a=e,b=ns(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Ls(this,d,1)||f;e>=a?os(this,b):(a=e,b=ns(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Ls(this,d,-1)||f;e>=a?os(this,b):(a=e,b=ns(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Ls(this,d,0)||f;e>=a?os(this,b):(a=e,b=ns(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Ls(this,d,0)||f;e>=a?os(this,b):(a=e,b=ns(this))}}os(this,b)};
function Ks(a,b,c){var d=ks(a,b),e=a.gc[b],f=ss(a,b,c),g=rs(a,b,c);for(c=0;c<e;c++)-1===g[c]&&(g[c]=d[c].column),-1===f[c]&&(f[c]=d[c].column);for(var h=!0,k;h;)for(h=!1,c=0;c<e-1;c++)if(f[c+1]<f[c]||f[c+1]===f[c]&&g[c+1]<g[c])h=!0,k=f[c],f[c]=f[c+1],f[c+1]=k,k=g[c],g[c]=g[c+1],g[c+1]=k,k=d[c],d[c]=d[c+1],d[c+1]=k;for(c=f=0;c<e;c++)k=d[c],k.index=c,f+=a.nodeMinColumnSpace(k,!0),k.column=f,f+=1,f+=a.nodeMinColumnSpace(k,!1);ls(a,b,d)}
function Ls(a,b,c){var d=ks(a,b),e=a.gc[b];c=ps(a,b,c);var f;var g=[];for(f=0;f<e;f++)g[f]=-1;var h=[];for(f=0;f<e;f++)h[f]=-1;for(var k=!1,l=!0;l;)for(l=!1,f=0;f<e-1;f++){var m=c[d[f].index*e+d[f+1].index],n=c[d[f+1].index*e+d[f].index],p=0,r=0,q=d[f].column,u=d[f+1].column,v=a.nodeMinColumnSpace(d[f],!0),w=a.nodeMinColumnSpace(d[f],!1),y=a.nodeMinColumnSpace(d[f+1],!0),z=a.nodeMinColumnSpace(d[f+1],!1);v=q-v+y;w=u-w+z;var A=d[f].sourceEdges.iterator;for(A.reset();A.next();)if(y=A.value,z=y.fromVertex,
y.valid&&z.layer===b){for(y=0;d[y]!==z;)y++;y<f&&(p+=2*(f-y),r+=2*(f+1-y));y===f+1&&(p+=1);y>f+1&&(p+=4*(y-f),r+=4*(y-(f+1)))}A=d[f].destinationEdges.iterator;for(A.reset();A.next();)if(y=A.value,z=y.toVertex,y.valid&&z.layer===b){for(y=0;d[y]!==z;)y++;y===f+1&&(r+=1)}A=d[f+1].sourceEdges.iterator;for(A.reset();A.next();)if(y=A.value,z=y.fromVertex,y.valid&&z.layer===b){for(y=0;d[y]!==z;)y++;y<f&&(p+=2*(f+1-y),r+=2*(f-y));y===f&&(r+=1);y>f+1&&(p+=4*(y-(f+1)),r+=4*(y-f))}A=d[f+1].destinationEdges.iterator;
for(A.reset();A.next();)if(y=A.value,z=y.toVertex,y.valid&&z.layer===b){for(y=0;d[y]!==z;)y++;y===f&&(p+=1)}y=z=0;A=g[d[f].index];var C=h[d[f].index],G=g[d[f+1].index],L=h[d[f+1].index];-1!==A&&(z+=Math.abs(A-q),y+=Math.abs(A-w));-1!==C&&(z+=Math.abs(C-q),y+=Math.abs(C-w));-1!==G&&(z+=Math.abs(G-u),y+=Math.abs(G-v));-1!==L&&(z+=Math.abs(L-u),y+=Math.abs(L-v));if(r<p-.5||r===p&&n<m-.5||r===p&&n===m&&y<z-.5)l=k=!0,d[f].column=w,d[f+1].column=v,m=d[f],d[f]=d[f+1],d[f+1]=m}for(f=0;f<e;f++)d[f].index=
f;ls(a,b,d);return k}
bs.prototype.straightenAndPack=function(){var a=0!==(this.jg&1);var b=7===this.jg;1E3<this.network.edges.count&&!b&&(a=!1);if(a){var c=[];for(b=0;b<=this.xa;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.Ea-c[b])>>1)+8*d;this.Ea*=8}if(0!==(this.jg&2))for(c=!0;c;){c=!1;for(b=this.sd+1;b<=this.xa;b++)c=Os(this,b,1)||c;for(b=
this.sd-1;0<=b;b--)c=Os(this,b,-1)||c;c=Os(this,this.sd,0)||c}if(0!==(this.jg&4)){for(b=this.sd+1;b<=this.xa;b++)Ps(this,b,1);for(b=this.sd-1;0<=b;b--)Ps(this,b,-1);Ps(this,this.sd,0)}a&&(Qs(this,-1),Qs(this,1));if(0!==(this.jg&2))for(c=!0;c;){c=!1;c=Os(this,this.sd,0)||c;for(b=this.sd+1;b<=this.xa;b++)c=Os(this,b,0)||c;for(b=this.sd-1;0<=b;b--)c=Os(this,b,0)||c}};function Os(a,b,c){for(var d=!1;Rs(a,b,c);)d=!0;return d}
function Rs(a,b,c){var d,e=ks(a,b),f=a.gc[b],g=rs(a,b,-1);if(0<c)for(d=0;d<f;d++)g[d]=-1;var h=rs(a,b,1);if(0>c)for(d=0;d<f;d++)h[d]=-1;for(var k=!1,l=!0;l;)for(l=!1,d=0;d<f;d++){var m=e[d].column,n=a.nodeMinColumnSpace(e[d],!0),p=a.nodeMinColumnSpace(e[d],!1),r=0;0>d-1||m-e[d-1].column-1>n+a.nodeMinColumnSpace(e[d-1],!1)?r=m-1:r=m;n=d+1>=f||e[d+1].column-m-1>p+a.nodeMinColumnSpace(e[d+1],!0)?m+1:m;var q=p=0,u=0;if(0>=c)for(var v=e[d].sourceEdges.iterator;v.next();){var w=v.value;var y=w.fromVertex;
if(w.valid&&y.layer!==b){var z=ms(w);var A=w.portFromColOffset;w=w.portToColOffset;y=y.column;p+=(Math.abs(m+w-(y+A))+1)*z;q+=(Math.abs(r+w-(y+A))+1)*z;u+=(Math.abs(n+w-(y+A))+1)*z}}if(0<=c)for(v=e[d].destinationEdges.iterator;v.next();)w=v.value,y=w.toVertex,w.valid&&y.layer!==b&&(z=ms(w),A=w.portFromColOffset,w=w.portToColOffset,y=y.column,p+=(Math.abs(m+A-(y+w))+1)*z,q+=(Math.abs(r+A-(y+w))+1)*z,u+=(Math.abs(n+A-(y+w))+1)*z);w=A=z=0;v=g[e[d].index];y=h[e[d].index];-1!==v&&(z+=Math.abs(v-m),A+=
Math.abs(v-r),w+=Math.abs(v-n));-1!==y&&(z+=Math.abs(y-m),A+=Math.abs(y-r),w+=Math.abs(y-n));if(q<p||q===p&&A<z)l=k=!0,e[d].column=r;else if(u<p||u===p&&w<z)l=k=!0,e[d].column=n}ls(a,b,e);a.normalize();return k}
function Ps(a,b,c){var d=ks(a,b),e=a.gc[b],f=ss(a,b,c),g=[];for(c=0;c<e;c++)g[c]=f[c];for(f=!0;f;)for(f=!1,c=0;c<e;c++){var h=d[c].column,k=a.nodeMinColumnSpace(d[c],!0),l=a.nodeMinColumnSpace(d[c],!1),m=0;if(-1===g[c])if(0===c&&c===e-1)m=h;else if(0===c){var n=d[c+1].column;n-h===l+a.nodeMinColumnSpace(d[c+1],!0)?m=h-1:m=h}else c===e-1?(n=d[c-1].column,m=h-n===k+a.nodeMinColumnSpace(d[c-1],!1)?h+1:h):(n=d[c-1].column,k=n+a.nodeMinColumnSpace(d[c-1],!1)+k+1,n=d[c+1].column,l=n-a.nodeMinColumnSpace(d[c+
1],!0)-l-1,m=(k+l)/2|0);else 0===c&&c===e-1?m=g[c]:0===c?(n=d[c+1].column,l=n-a.nodeMinColumnSpace(d[c+1],!0)-l-1,m=Math.min(g[c],l)):c===e-1?(n=d[c-1].column,k=n+a.nodeMinColumnSpace(d[c-1],!1)+k+1,m=Math.max(g[c],k)):(n=d[c-1].column,k=n+a.nodeMinColumnSpace(d[c-1],!1)+k+1,n=d[c+1].column,l=n-a.nodeMinColumnSpace(d[c+1],!0)-l-1,k<g[c]&&g[c]<l?m=g[c]:k>=g[c]?m=k:l<=g[c]&&(m=l));m!==h&&(f=!0,d[c].column=m)}ls(a,b,d);a.normalize()}
function Ss(a,b){for(var c=!0,d=a.network.vertexes.iterator;d.next();){var e=d.value,f=a.nodeMinColumnSpace(e,!0),g=a.nodeMinColumnSpace(e,!1);if(e.column-f<=b&&e.column+g>=b){c=!1;break}}a=!1;if(c)for(d.reset();d.next();)c=d.value,c.column>b&&(--c.column,a=!0);return a}
function Ts(a,b){var c=b+1;var d,e=[],f=[];for(d=0;d<=a.xa;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.xa;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 Qs(a,b){for(var c=0;c<=a.Ea;c++)for(;Ss(a,c););a.normalize();for(c=0;c<a.Ea;c++)for(;Ts(a,c););a.normalize();var d;if(0<b)for(c=0;c<=a.Ea;c++){var e=ns(a);var f=qs(a);for(d=f+1;f<d;){d=f;Us(a,c,1);var g=qs(a);g>f?os(a,e):g<f&&(f=g,e=ns(a))}}if(0>b)for(c=a.Ea;0<=c;c--)for(e=ns(a),f=qs(a),d=f+1;f<d;)d=f,Us(a,c,-1),g=qs(a),g>f?os(a,e):g<f&&(f=g,e=ns(a));a.normalize()}
function Us(a,b,c){a.Rd=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.Rd)}if(0>c)for(d.reset();d.next();)e=d.value,e.column+a.nodeMinColumnSpace(e,!1)>=b&&(e.component=a.Rd);a.Rd++;for(d.reset();d.next();)b=d.value,-1===b.component&&(us(a,b,a.Rd,-1,!0,!0),a.Rd++);var f;b=[];for(f=0;f<a.Rd*a.Rd;f++)b[f]=!1;e=[];for(f=0;f<(a.xa+1)*(a.Ea+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.Ea,f.column+a.nodeMinColumnSpace(f,!1));h<=k;h++)e[g*(a.Ea+1)+h]=f.component}for(f=0;f<=a.xa;f++){if(0<c)for(g=0;g<a.Ea;g++)-1!==e[f*(a.Ea+1)+g]&&-1!==e[f*(a.Ea+1)+g+1]&&e[f*(a.Ea+1)+g]!==e[f*(a.Ea+1)+g+1]&&(b[e[f*(a.Ea+1)+g]*a.Rd+e[f*(a.Ea+1)+g+1]]=!0);if(0>c)for(g=a.Ea;0<g;g--)-1!==e[f*(a.Ea+1)+g]&&-1!==e[f*(a.Ea+1)+g-1]&&e[f*(a.Ea+1)+g]!==e[f*(a.Ea+1)+g-1]&&(b[e[f*(a.Ea+1)+g]*a.Rd+e[f*(a.Ea+1)+g-1]]=!0)}e=
[];for(f=0;f<a.Rd;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.Rd;f++)b[k*a.Rd+f]&&g.splice(0,0,f);if(0<c)for(d.reset();d.next();)a=d.value,e[a.component]&&--a.column;if(0>c)for(d.reset();d.next();)c=d.value,e[c.component]&&(c.column+=1)}
bs.prototype.commitLayout=function(){if(this.setsPortSpots)for(var a=is(this,!0),b=is(this,!1),c=this.network.edges.iterator;c.next();){var d=c.value.link;null!==d&&(d.fromSpot=a,d.toSpot=b)}this.commitNodes();this.tv();this.isRouting&&this.commitLinks()};function is(a,b){return 270===a.J?b?ed:hd:90===a.J?b?hd:ed:180===a.J?b?fd:gd:b?gd:fd}
bs.prototype.commitNodes=function(){this.Nd=[];this.rd=[];this.qd=[];this.Ha=[];for(var a=0;a<=this.xa;a++)this.Nd[a]=0,this.rd[a]=0,this.qd[a]=0,this.Ha[a]=0;for(a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;this.Nd[c]=Math.max(this.Nd[c],this.nodeMinLayerSpace(b,!0));this.rd[c]=Math.max(this.rd[c],this.nodeMinLayerSpace(b,!1))}b=0;c=this.pe;for(var d=0;d<=this.xa;d++){var e=c;0>=this.Nd[d]+this.rd[d]&&(e=0);0<d&&(b+=e/2);90===this.J||0===this.J?(b+=this.rd[d],this.qd[d]=b,
b+=this.Nd[d]):(b+=this.Nd[d],this.qd[d]=b,b+=this.rd[d]);d<this.xa&&(b+=e/2);this.Ha[d]=b}c=b;b=this.arrangementOrigin;for(d=0;d<=this.xa;d++)270===this.J?this.qd[d]=b.y+this.qd[d]:90===this.J?(this.qd[d]=b.y+c-this.qd[d],this.Ha[d]=c-this.Ha[d]):180===this.J?this.qd[d]=b.x+this.qd[d]:(this.qd[d]=b.x+c-this.qd[d],this.Ha[d]=c-this.Ha[d]);a.reset();for(c=d=Infinity;a.next();){e=a.value;var f=e.layer,g=e.column|0;if(270===this.J||90===this.J){var h=b.x+this.Zb*g;f=this.qd[f]}else h=this.qd[f],f=b.y+
this.Zb*g;e.centerX=h;e.centerY=f;d=Math.min(e.x,d);c=Math.min(e.y,c)}d=b.x-d;b=b.y-c;this.Gf=new I(d,b);for(a.reset();a.next();)c=a.value,c.x+=d,c.y+=b,c.commit()};
bs.prototype.tv=function(){for(var a=0,b=this.pe,c=0;c<=this.xa;c++)a+=this.Nd[c],a+=this.rd[c];a+=this.xa*b;b=[];c=this.Zb*this.Ea;for(var d=this.maxLayer;0<=d;d--)270===this.J?0===d?b.push(new N(0,0,c,Math.abs(this.Ha[0]))):b.push(new N(0,this.Ha[d-1],c,Math.abs(this.Ha[d-1]-this.Ha[d]))):90===this.J?0===d?b.push(new N(0,this.Ha[0],c,Math.abs(this.Ha[0]-a))):b.push(new N(0,this.Ha[d],c,Math.abs(this.Ha[d-1]-this.Ha[d]))):180===this.J?0===d?b.push(new N(0,0,Math.abs(this.Ha[0]),c)):b.push(new N(this.Ha[d-
1],0,Math.abs(this.Ha[d-1]-this.Ha[d]),c)):0===d?b.push(new N(this.Ha[0],0,Math.abs(this.Ha[0]-a),c)):b.push(new N(this.Ha[d],0,Math.abs(this.Ha[d-1]-this.Ha[d]),c));this.commitLayers(b,this.Gf)};bs.prototype.commitLayers=function(){};
bs.prototype.commitLinks=function(){for(var a=this.network.edges.iterator,b;a.next();)b=a.value.link,null!==b&&(b.Mh(),b.ak(),b.rf());for(a.reset();a.next();)b=a.value.link,null!==b&&b.kj();for(a.reset();a.next();){var c=a.value;b=c.link;if(null!==b){b.Mh();var d=b,e=d.fromNode,f=d.toNode,g=d.fromPort,h=d.toPort;if(null!==e){var k=e.findVisibleNode();null!==k&&k!==e&&(e=k,g=k.port)}null!==f&&(k=f.findVisibleNode(),null!==k&&k!==f&&(f=k,h=k.port));var l=b.computeSpot(!0,g);k=b.computeSpot(!1,h);var m=
c.fromVertex,n=c.toVertex;if(c.valid){if(b.curve===dg&&4===b.pointsCount)if(m.column===n.column)c=b.getLinkPoint(e,g,l,!0,!1,f,h),g=b.getLinkPoint(f,h,k,!1,!1,e,g),c.v()||c.set(e.actualBounds.center),g.v()||g.set(f.actualBounds.center),b.ak(),b.qf(c.x,c.y),b.qf((2*c.x+g.x)/3,(2*c.y+g.y)/3),b.qf((c.x+2*g.x)/3,(c.y+2*g.y)/3),b.qf(g.x,g.y);else{var p=!1,r=!1;null!==g&&l===uc&&(p=!0);null!==h&&k===uc&&(r=!0);if(p||r){var q=b.i(0).x;c=b.i(0).y;m=b.i(3).x;d=b.i(3).y;p&&(90===this.J||270===this.J?(p=q,n=
(c+d)/2):(p=(q+m)/2,n=c),b.K(1,p,n),l=b.getLinkPoint(e,g,l,!0,!1,f,h),l.v()||l.set(e.actualBounds.center),b.K(0,l.x,l.y));r&&(90===this.J||270===this.J?(l=m,c=(c+d)/2):(l=(q+m)/2,c=d),b.K(2,l,c),e=b.getLinkPoint(f,h,k,!1,!1,e,g),e.v()||e.set(f.actualBounds.center),b.K(3,e.x,e.y))}}b.rf()}else if(m.layer===n.layer)b.rf();else{p=r=!1;q=b.firstPickIndex+1;if(b.isOrthogonal){p=!0;var u=b.pointsCount;4<u&&b.points.removeRange(2,u-3)}else if(b.curve===dg)r=!0,u=b.pointsCount,4<u&&b.points.removeRange(2,
u-3),4===u&&(q=2);else{u=b.pointsCount;var v=l===uc,w=k===uc;2<u&&v&&w?b.points.removeRange(1,u-2):3<u&&v&&!w?b.points.removeRange(1,u-3):3<u&&!v&&w?b.points.removeRange(2,u-2):4<u&&!v&&!w&&b.points.removeRange(2,u-3)}if(c.rev){for(;null!==n&&m!==n;){var y=u=null;for(v=n.sourceEdges.iterator;v.next()&&(w=v.value,w.link!==c.link||(u=w.fromVertex,y=w.toVertex,null!==u.node)););if(u!==m){v=b.i(q-1).x;w=b.i(q-1).y;var z=u.centerX;var A=u.centerY;if(p)180===this.J||0===this.J?q===b.firstPickIndex+1?(b.m(q++,
v,w),b.m(q++,v,A)):(null!==y?y.centerY:w)!==A&&(y=this.Ha[u.layer-1]+this.Gf.x,b.m(q++,y,w),b.m(q++,y,A)):q===b.firstPickIndex+1?(b.m(q++,v,w),b.m(q++,z,w)):(null!==y?y.centerX:v)!==z&&(y=this.Ha[u.layer-1]+this.Gf.y,b.m(q++,v,y),b.m(q++,z,y));else if(q===b.firstPickIndex+1){y=Math.max(10,this.Nd[n.layer]);var C=Math.max(10,this.rd[n.layer]);if(r)180===this.J?z<=n.bounds.x?(n=n.bounds.x,b.m(q++,n-y,A),b.m(q++,n,A),b.m(q++,n+C,A)):(b.m(q++,z-y,A),b.m(q++,z,A),b.m(q++,z+C,A)):90===this.J?A>=n.bounds.bottom?
(n=n.bounds.y+n.bounds.height,b.m(q++,z,n+C),b.m(q++,z,n),b.m(q++,z,n-y)):(b.m(q++,z,A+C),b.m(q++,z,A),b.m(q++,z,A-y)):270===this.J?A<=n.bounds.y?(n=n.bounds.y,b.m(q++,z,n-y),b.m(q++,z,n),b.m(q++,z,n+C)):(b.m(q++,z,A-y),b.m(q++,z,A),b.m(q++,z,A+C)):0===this.J&&(z>=n.bounds.right?(n=n.bounds.x+n.bounds.width,b.m(q++,n+C,A),b.m(q++,n,A),b.m(q++,n-y,A)):(b.m(q++,z+C,A),b.m(q++,z,A),b.m(q++,z-y,A)));else{b.m(q++,v,w);var G=0;if(180===this.J||0===this.J){if(180===this.J?z>=n.bounds.right:z<=n.bounds.x)G=
(0===this.J?-y:C)/2;b.m(q++,v+G,A)}else{if(270===this.J?A>=n.bounds.bottom:A<=n.bounds.y)G=(90===this.J?-y:C)/2;b.m(q++,z,w+G)}b.m(q++,z,A)}}else y=Math.max(10,this.Nd[u.layer]),C=Math.max(10,this.rd[u.layer]),180===this.J?(r&&b.m(q++,z-y,A),b.m(q++,z,A),r&&b.m(q++,z+C,A)):90===this.J?(r&&b.m(q++,z,A+C),b.m(q++,z,A),r&&b.m(q++,z,A-y)):270===this.J?(r&&b.m(q++,z,A-y),b.m(q++,z,A),r&&b.m(q++,z,A+C)):(r&&b.m(q++,z+C,A),b.m(q++,z,A),r&&b.m(q++,z-y,A))}n=u}if(null===h||l!==uc||p)if(v=b.i(q-1).x,w=b.i(q-
1).y,z=b.i(q).x,A=b.i(q).y,p)n=this.rd[m.layer],180===this.J||0===this.J?(p=w,p>=m.bounds.y&&p<=m.bounds.bottom&&(180===this.J?z>=m.bounds.x:z<=m.bounds.right)&&(n=m.centerX+(180===this.J?-n:n),p<m.bounds.y+m.bounds.height/2?p=m.bounds.y-this.Zb/2:p=m.bounds.bottom+this.Zb/2,b.m(q++,n,w),b.m(q++,n,p)),b.m(q++,z,p)):(p=v,p>=m.bounds.x&&p<=m.bounds.right&&(270===this.J?A>=m.bounds.y:A<=m.bounds.bottom)&&(n=m.centerY+(270===this.J?-n:n),p<m.bounds.x+m.bounds.width/2?p=m.bounds.x-this.Zb/2:p=m.bounds.right+
this.Zb/2,b.m(q++,v,n),b.m(q++,p,n)),b.m(q++,p,A)),b.m(q++,z,A);else if(r)y=Math.max(10,this.Nd[m.layer]),C=Math.max(10,this.rd[m.layer]),180===this.J&&z>=m.bounds.x?(n=m.bounds.x+m.bounds.width,b.K(q-2,n,w),b.K(q-1,n+C,w)):90===this.J&&A<=m.bounds.bottom?(n=m.bounds.y,b.K(q-2,v,n),b.K(q-1,v,n-y)):270===this.J&&A>=m.bounds.y?(n=m.bounds.y+m.bounds.height,b.K(q-2,v,n),b.K(q-1,v,n+C)):0===this.J&&z<=m.bounds.right&&(n=m.bounds.x,b.K(q-2,n,w),b.K(q-1,n-y,w));else{y=Math.max(10,this.Nd[m.layer]);C=Math.max(10,
this.rd[m.layer]);p=0;if(180===this.J||0===this.J){if(180===this.J?z<=m.bounds.x:z>=m.bounds.right)p=(0===this.J?C:-y)/2;b.m(q++,z+p,w)}else{if(270===this.J?A<=m.bounds.y:A>=m.bounds.bottom)p=(90===this.J?C:-y)/2;b.m(q++,v,A+p)}b.m(q++,z,A)}}else{for(;null!==m&&m!==n;){y=u=null;for(m=m.destinationEdges.iterator;m.next()&&(v=m.value,v.link!==c.link||(u=v.toVertex,y=v.fromVertex,null!==y.node&&(y=null),null!==u.node)););u!==n&&(v=b.i(q-1).x,w=b.i(q-1).y,z=u.centerX,A=u.centerY,p?180===this.J||0===this.J?
(null!==y?y.centerY:w)!==A&&(y=this.Ha[u.layer]+this.Gf.x,q===b.firstPickIndex+1&&(y=0===this.J?Math.max(y,v):Math.min(y,v)),b.m(q++,y,w),b.m(q++,y,A)):(null!==y?y.centerX:v)!==z&&(y=this.Ha[u.layer]+this.Gf.y,q===b.firstPickIndex+1&&(y=90===this.J?Math.max(y,w):Math.min(y,w)),b.m(q++,v,y),b.m(q++,z,y)):(y=Math.max(10,this.Nd[u.layer]),C=Math.max(10,this.rd[u.layer]),180===this.J?(b.m(q++,z+C,A),r&&b.m(q++,z,A),b.m(q++,z-y,A)):90===this.J?(b.m(q++,z,A-y),r&&b.m(q++,z,A),b.m(q++,z,A+C)):270===this.J?
(b.m(q++,z,A+C),r&&b.m(q++,z,A),b.m(q++,z,A-y)):(b.m(q++,z-y,A),r&&b.m(q++,z,A),b.m(q++,z+C,A))));m=u}p&&(v=b.i(q-1).x,w=b.i(q-1).y,z=b.i(q).x,A=b.i(q).y,180===this.J||0===this.J?w!==A&&(y=0===this.J?Math.min(Math.max((z+v)/2,this.Ha[n.layer]+this.Gf.x),z):Math.max(Math.min((z+v)/2,this.Ha[n.layer]+this.Gf.x),z),b.m(q++,y,w),b.m(q++,y,A)):v!==z&&(y=90===this.J?Math.min(Math.max((A+w)/2,this.Ha[n.layer]+this.Gf.y),A):Math.max(Math.min((A+w)/2,this.Ha[n.layer]+this.Gf.y),A),b.m(q++,v,y),b.m(q++,z,y)))}null!==
d&&r&&(null!==g&&(l===uc&&(l=b.i(0),d=b.i(2),l.w(d)||b.K(1,(l.x+d.x)/2,(l.y+d.y)/2)),l=b.getLinkPoint(e,g,uc,!0,!1,f,h),l.v()||l.set(e.actualBounds.center),b.K(0,l.x,l.y)),null!==h&&(k===uc&&(k=b.i(b.pointsCount-1),l=b.i(b.pointsCount-3),k.w(l)||b.K(b.pointsCount-2,(k.x+l.x)/2,(k.y+l.y)/2)),e=b.getLinkPoint(f,h,uc,!1,!1,e,g),e.v()||e.set(f.actualBounds.center),b.K(b.pointsCount-1,e.x,e.y)));b.rf();c.commit()}}}this.avoidOrthogonalOverlaps()};
bs.prototype.avoidOrthogonalOverlaps=function(){if(!(0>=this.linkSpacing)){for(var a=new E,b=this.network.edges.iterator;b.next();){var c=b.value.link;null!==c&&c.isOrthogonal&&!a.contains(c)&&a.add(c)}if(0<a.count)if(90===this.J||270===this.J){b=0;c=[];for(a=a.iterator;a.next();){var d=a.value;if(null!==d&&d.isOrthogonal)for(var e=2;e<d.pointsCount-3;e++){var f=d.i(e);var g=d.i(e+1);if(this.A(f.y,g.y)&&!this.A(f.x,g.x)){var h=new Vs;h.layer=Math.floor(f.y/2);var k=d.i(0),l=d.i(d.pointsCount-1);h.first=
k.x*k.x+k.y;h.Xb=l.x*l.x+l.y;h.Uc=Math.min(f.x,g.x);h.tc=Math.max(f.x,g.x);h.index=e;h.link=d;if(e+2<d.pointsCount){k=d.i(e-1);l=d.i(e+2);var m=0;k.y<f.y?m=l.y<f.y?3:f.x<g.x?2:1:k.y>f.y&&(m=l.y>f.y?0:g.x<f.x?2:1);h.l=m}c.push(h)}}}if(1<c.length)for(c.sort(this.xy),a=0;a<c.length;){f=c[a].layer;for(d=a+1;d<c.length&&c[d].layer===f;)d++;if(1<d-a)for(f=a;f<d;){g=c[f].tc;for(e=a+1;e<d&&c[e].Uc<g;)g=Math.max(g,c[e].tc),e++;g=e-f;if(1<g){this.hj(c,this.Vt,f,f+g);m=1;h=c[f].Xb;for(k=f;k<e;k++)l=c[k],l.Xb!==
h&&(m++,h=l.Xb);this.hj(c,this.wy,f,f+g);var n=1;h=c[f].first;for(k=f;k<e;k++)l=c[k],l.first!==h&&(n++,h=l.first);k=!0;l=n;m<n?(k=!1,l=m,h=c[f].Xb,this.hj(c,this.Vt,f,f+g)):h=c[f].first;m=0;for(n=f;n<e;n++){var p=c[n];(k?p.first:p.Xb)!==h&&(m++,h=k?p.first:p.Xb);var r=p.link;f=r.i(p.index);g=r.i(p.index+1);var q=this.linkSpacing*(m-(l-1)/2);b++;r.Mh();r.K(p.index,f.x,f.y+q);r.K(p.index+1,g.x,g.y+q);r.rf()}}f=e}a=d}}else{b=0;c=[];for(a=a.iterator;a.next();)if(d=a.value,null!==d&&d.isOrthogonal)for(e=
2;e<d.pointsCount-3;e++)f=d.i(e),g=d.i(e+1),this.A(f.x,g.x)&&!this.A(f.y,g.y)&&(h=new Vs,h.layer=Math.floor(f.x/2),k=d.i(0),l=d.i(d.pointsCount-1),h.first=k.x+k.y*k.y,h.Xb=l.x+l.y*l.y,h.Uc=Math.min(f.y,g.y),h.tc=Math.max(f.y,g.y),h.index=e,h.link=d,e+2<d.pointsCount&&(k=d.i(e-1),l=d.i(e+2),m=0,k.x<f.x?m=l.x<f.x?3:f.y<g.y?2:1:k.x>f.x&&(m=l.x>f.x?0:g.y<f.y?2:1),h.l=m),c.push(h));if(1<c.length)for(c.sort(this.xy),a=0;a<c.length;){f=c[a].layer;for(d=a+1;d<c.length&&c[d].layer===f;)d++;if(1<d-a)for(f=
a;f<d;){g=c[f].tc;for(e=a+1;e<d&&c[e].Uc<g;)g=Math.max(g,c[e].tc),e++;g=e-f;if(1<g){this.hj(c,this.Vt,f,f+g);m=1;h=c[f].Xb;for(k=f;k<e;k++)l=c[k],l.Xb!==h&&(m++,h=l.Xb);this.hj(c,this.wy,f,f+g);n=1;h=c[f].first;for(k=f;k<e;k++)l=c[k],l.first!==h&&(n++,h=l.first);k=!0;l=n;m<n?(k=!1,l=m,h=c[f].Xb,this.hj(c,this.Vt,f,f+g)):h=c[f].first;m=0;for(n=f;n<e;n++)p=c[n],(k?p.first:p.Xb)!==h&&(m++,h=k?p.first:p.Xb),r=p.link,f=r.i(p.index),g=r.i(p.index+1),q=this.linkSpacing*(m-(l-1)/2),b++,r.Mh(),r.K(p.index,
f.x+q,f.y),r.K(p.index+1,g.x+q,g.y),r.rf()}f=e}a=d}}}};t=bs.prototype;t.xy=function(a,b){return a instanceof Vs&&b instanceof Vs&&a!==b?a.layer<b.layer?-1:a.layer>b.layer?1:a.Uc<b.Uc?-1:a.Uc>b.Uc?1:a.tc<b.tc?-1:a.tc>b.tc?1:0:0};t.wy=function(a,b){return a instanceof Vs&&b instanceof Vs&&a!==b?a.first<b.first?-1:a.first>b.first||a.l<b.l?1:a.l>b.l||a.Uc<b.Uc?-1:a.Uc>b.Uc?1:a.tc<b.tc?-1:a.tc>b.tc?1:0:0};
t.Vt=function(a,b){return a instanceof Vs&&b instanceof Vs&&a!==b?a.Xb<b.Xb?-1:a.Xb>b.Xb||a.l<b.l?1:a.l>b.l||a.Uc<b.Uc?-1:a.Uc>b.Uc?1:a.tc<b.tc?-1:a.tc>b.tc?1:0:0};t.A=function(a,b){a-=b;return-1<a&&1>a};
t.hj=function(a,b,c,d){var e=a.length,f=d-c;if(!(1>=f))if((0>c||c>=e-1)&&B("not in range 0 <= from < length: "+c),2===f)d=a[c],e=a[c+1],0<b(d,e)&&(a[c]=e,a[c+1]=d);else if(0===c)if(d>=e)a.sort(b);else for(c=a.slice(0,d),c.sort(b),b=0;b<d;b++)a[b]=c[b];else if(d>=e)for(d=a.slice(c),d.sort(b),b=c;b<e;b++)a[b]=d[b-c];else for(e=a.slice(c,d),e.sort(b),b=c;b<d;b++)a[b]=e[b-c]};
function ks(a,b){var c=a.gc[b];if(c>=a.se.length){var d=[];for(var e=0;e<a.se.length;e++)d[e]=a.se[e];a.se=d}void 0===a.se[c]||null===a.se[c]?d=[]:(d=a.se[c],a.se[c]=null);a=a.So[b];for(b=0;b<a.length;b++)c=a[b],d[c.index]=c;return d}function ls(a,b,c){a.se[a.gc[b]]=c}
ma.Object.defineProperties(bs.prototype,{layerSpacing:{get:function(){return this.pe},set:function(a){this.pe!==a&&0<=a&&(this.pe=a,this.C())}},columnSpacing:{get:function(){return this.Zb},set:function(a){this.Zb!==a&&0<a&&(this.Zb=a,this.C())}},direction:{get:function(){return this.J},set:function(a){this.J!==a&&(0===a||90===a||180===a||270===a?(this.J=a,this.C()):B("LayeredDigraphLayout.direction must be 0, 90, 180, or 270"))}},
cycleRemoveOption:{get:function(){return this.Rk},set:function(a){this.Rk===a||a!==vs&&a!==cs&&a!==hs||(this.Rk=a,this.C())}},layeringOption:{get:function(){return this.ul},set:function(a){this.ul===a||a!==ds&&a!==As&&a!==Cs||(this.ul=a,this.C())}},initializeOption:{get:function(){return this.jl},set:function(a){this.jl===a||a!==es&&a!==Is&&a!==Gs||(this.jl=a,this.C())}},iterations:{
get:function(){return this.Cj},set:function(a){this.Cj!==a&&0<=a&&(this.Cj=a,this.C())}},aggressiveOption:{get:function(){return this.Gk},set:function(a){this.Gk===a||a!==Ms&&a!==fs&&a!==Ns||(this.Gk=a,this.C())}},packOption:{get:function(){return this.jg},set:function(a){this.jg!==a&&0<=a&&8>a&&(this.jg=a,this.C())}},setsPortSpots:{get:function(){return this.cf},set:function(a){this.cf!==a&&(this.cf=a,this.C())}},
linkSpacing:{get:function(){return this.wo},set:function(a){this.wo!==a&&0<=a&&(this.wo=a,this.C())}},maxLayer:{get:function(){return this.xa}},maxIndex:{get:function(){return this.ks}},maxColumn:{get:function(){return this.Ea}},minIndexLayer:{get:function(){return this.Ho}},maxIndexLayer:{get:function(){return this.sd}}});
var cs=new D(bs,"CycleDepthFirst",0),vs=new D(bs,"CycleGreedy",1),hs=new D(bs,"CycleFromLayers",2),ds=new D(bs,"LayerOptimalLinkLength",0),As=new D(bs,"LayerLongestPathSink",1),Cs=new D(bs,"LayerLongestPathSource",2),es=new D(bs,"InitDepthFirstOut",0),Is=new D(bs,"InitDepthFirstIn",1),Gs=new D(bs,"InitNaive",2),Ms=new D(bs,"AggressiveNone",0),fs=new D(bs,"AggressiveLess",1),Ns=new D(bs,"AggressiveMore",2);bs.className="LayeredDigraphLayout";bs.CycleDepthFirst=cs;bs.CycleGreedy=vs;
bs.CycleFromLayers=hs;bs.LayerOptimalLinkLength=ds;bs.LayerLongestPathSink=As;bs.LayerLongestPathSource=Cs;bs.InitDepthFirstOut=es;bs.InitDepthFirstIn=Is;bs.InitNaive=Gs;bs.AggressiveNone=Ms;bs.AggressiveLess=fs;bs.AggressiveMore=Ns;bs.PackNone=0;bs.PackExpand=1;bs.PackStraighten=2;bs.PackMedian=4;bs.PackAll=7;function Vs(){this.index=this.tc=this.Uc=this.Xb=this.first=this.layer=0;this.link=null;this.l=0}Vs.className="SegInfo";function gs(a){Pp.call(this,a)}la(gs,Pp);gs.prototype.createVertex=function(){return new Ws(this)};
gs.prototype.createEdge=function(){return new Xs(this)};gs.className="LayeredDigraphNetwork";function Ws(a){Sp.call(this,a);this.Oa=this.Lg=this.wi=-1;this.I=NaN;this.T=null;this.valid=!1;this.finish=this.hm=NaN;this.Zj=0;this.Xv=this.Yv=null}la(Ws,Sp);
ma.Object.defineProperties(Ws.prototype,{layer:{get:function(){return this.wi},set:function(a){this.wi!==a&&(this.wi=a)}},column:{get:function(){return this.Lg},set:function(a){this.Lg!==a&&(this.Lg=a)}},index:{get:function(){return this.Oa},set:function(a){this.Oa!==a&&(this.Oa=a)}},component:{get:function(){return this.I},set:function(a){this.I!==a&&(this.I=a)}},near:{
get:function(){return this.T},set:function(a){this.T!==a&&(this.T=a)}}});Ws.className="LayeredDigraphVertex";function Xs(a){Tp.call(this,a);this.l=this.Ja=this.bb=!1;this.Ia=this.I=NaN;this.T=this.u=0}la(Xs,Tp);
ma.Object.defineProperties(Xs.prototype,{valid:{get:function(){return this.bb},set:function(a){this.bb!==a&&(this.bb=a)}},rev:{get:function(){return this.Ja},set:function(a){this.Ja!==a&&(this.Ja=a)}},forest:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a)}},portFromPos:{get:function(){return this.I},set:function(a){this.I!==a&&(this.I=a)}},portToPos:{
get:function(){return this.Ia},set:function(a){this.Ia!==a&&(this.Ia=a)}},portFromColOffset:{get:function(){return this.u},set:function(a){this.u!==a&&(this.u=a)}},portToColOffset:{get:function(){return this.T},set:function(a){this.T!==a&&(this.T=a)}}});Xs.className="LayeredDigraphEdge";
function Ys(){Fi.call(this);this.Jb=new F;this.gp=Zs;this.$c=$s;this.bq=at;this.js=bt;this.Vw=[];this.Zc=!0;this.Cb=ct;this.Cd=(new M(10,10)).freeze();var a=new dt(this);this.U=new et(a);this.V=new et(a);this.gv=[]}la(Ys,Fi);Ys.prototype.cloneProtected=function(a){Fi.prototype.cloneProtected.call(this,a);a.gp=this.gp;a.bq=this.bq;a.js=this.js;a.Zc=this.Zc;a.Cb=this.Cb;a.Cd.assign(this.Cd);a.U.copyInheritedPropertiesFrom(this.U);a.V.copyInheritedPropertiesFrom(this.V)};
Ys.prototype.gb=function(a){a.classType===Ys?0===a.name.indexOf("Alignment")?this.alignment=a:0===a.name.indexOf("Arrangement")?this.arrangement=a:0===a.name.indexOf("Compaction")?this.compaction=a:0===a.name.indexOf("Path")?this.path=a:0===a.name.indexOf("Sorting")?this.sorting=a:0===a.name.indexOf("Style")?this.treeStyle=a:B("Unknown enum value: "+a):Fi.prototype.gb.call(this,a)};Ys.prototype.createNetwork=function(){return new dt(this)};
Ys.prototype.makeNetwork=function(a){function b(a){if(a instanceof V)return!a.isLinkLabel&&"Comment"!==a.category;if(a instanceof S){var b=a.fromNode;if(null===b||b.isLinkLabel||"Comment"===b.category)return!1;a=a.toNode;return null===a||a.isLinkLabel||"Comment"===a.category?!1:!0}return!1}var c=this.createNetwork();a instanceof Q?(c.ug(a.nodes,!0,b),c.ug(a.links,!0,b)):a instanceof uf?c.ug(a.memberParts,!1,b):c.ug(a.iterator,!1,b);return c};
Ys.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));this.arrangement!==ft&&(this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin));var b=this.diagram;null===b&&a instanceof Q&&(b=a);this.path===Zs&&null!==b?this.$c=b.isTreePathToChildren?$s:gt:this.$c=this.path===Zs?$s:this.path;if(0<this.network.vertexes.count){this.network.oq();for(a=this.network.vertexes.iterator;a.next();)b=a.value,b.initialized=!1,b.level=0,b.parent=null,b.children=[];if(0<this.Jb.count){a=
new F;for(b=this.Jb.iterator;b.next();){var c=b.value;c instanceof V?(c=this.network.$i(c),null!==c&&a.add(c)):c instanceof et&&a.add(c)}this.Jb=a}0===this.Jb.count&&this.findRoots();for(a=this.Jb.copy().iterator;a.next();)b=a.value,b.initialized||(b.initialized=!0,ht(this,b));b=this.network.vertexes;for(a=null;a=it(b),0<a.count;)b=jt(this,a),null!==b&&this.Jb.add(b),b.initialized=!0,ht(this,b),b=a;for(a=this.Jb.iterator;a.next();)b=a.value,b instanceof et&&kt(this,b);for(a=this.Jb.iterator;a.next();)b=
a.value,b instanceof et&&lt(this,b);for(a=this.Jb.iterator;a.next();)b=a.value,b instanceof et&&mt(this,b);this.rv();if(this.layerStyle===nt){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.Vw=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===ot)for(a=this.network.vertexes.iterator;a.next();){b=a.value;c=0===b.angle||180===b.angle;d=-1;for(e=0;e<b.children.length;e++){var f=b.children[e];d=Math.max(d,c?f.width:f.height)}if(0<=d)for(e=0;e<b.children.length;e++)f=b.children[e],c?(180===b.angle&&(f.focusX+=d-f.width),f.width=d):(270===b.angle&&(f.focusY+=d-f.height),f.height=
d)}for(a=this.Jb.iterator;a.next();)b=a.value,b instanceof et&&this.layoutTree(b);this.arrangeTrees();this.updateParts()}this.network=null;this.Jb=new F;this.isValidLayout=!0};function it(a){var b=new F;for(a=a.iterator;a.next();){var c=a.value;c.initialized||b.add(c)}return b}
Ys.prototype.findRoots=function(){for(var a=this.network.vertexes,b=a.iterator;b.next();){var c=b.value;switch(this.$c){case $s:0===c.sourceEdges.count&&this.Jb.add(c);break;case gt:0===c.destinationEdges.count&&this.Jb.add(c);break;default:B("Unhandled path value "+this.$c.toString())}}0===this.Jb.count&&(a=jt(this,a),null!==a&&this.Jb.add(a))};
function jt(a,b){var c=999999,d=null;for(b=b.iterator;b.next();){var e=b.value;switch(a.$c){case $s:e.sourceEdges.count<c&&(c=e.sourceEdges.count,d=e);break;case gt:e.destinationEdges.count<c&&(c=e.destinationEdges.count,d=e);break;default:B("Unhandled path value "+a.$c.toString())}}return d}
function ht(a,b){if(null!==b){switch(a.$c){case $s:if(0<b.destinationEdges.count){for(var c=new E,d=b.destinationVertexes;d.next();){var e=d.value;pt(a,b,e)&&c.add(e)}0<c.count&&(b.children=c.na())}break;case gt:if(0<b.sourceEdges.count){c=new E;for(d=b.sourceVertexes;d.next();)e=d.value,pt(a,b,e)&&c.add(e);0<c.count&&(b.children=c.na())}break;default:B("Unhandled path value"+a.$c.toString())}c=b.children;d=c.length;for(e=0;e<d;e++){var f=c[e];f.initialized=!0;f.level=b.level+1;f.parent=b;a.Jb.remove(f)}for(b=
0;b<d;b++)ht(a,c[b])}}function pt(a,b,c){if(c.initialized){if(null===b)var d=!1;else{for(d=b.parent;null!==d&&d!==c;)d=d.parent;d=d===c}if(d||c.level>b.level)return!1;a.removeChild(c.parent,c)}return!0}Ys.prototype.removeChild=function(a,b){if(null!==a&&null!==b){for(var c=a.children,d=0,e=0;e<c.length;e++)c[e]===b&&d++;if(0<d){d=Array(c.length-d);for(var f=e=0;f<c.length;f++)c[f]!==b&&(d[e++]=c[f]);a.children=d}}};
function kt(a,b){if(null!==b){a.initializeTreeVertexValues(b);b.alignment===qt&&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];kt(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 rt(a,b){switch(a.bq){default:case at:return null!==b.parent?b.parent:a.U;case st:return null===b.parent?a.U:null===b.parent.parent?a.V:b.parent;case tt:return null!==b.parent?null!==b.parent.parent?b.parent.parent:a.V:a.U;case ut:var c=!0;if(0===b.childrenCount)c=!1;else for(var d=b.children,e=d.length,f=0;f<e;f++)if(0<d[f].childrenCount){c=!1;break}return c&&null!==b.parent?a.V:null!==b.parent?b.parent:a.U}}
Ys.prototype.initializeTreeVertexValues=function(a){a.copyInheritedPropertiesFrom(rt(this,a));if(null!==a.parent&&a.parent.alignment===qt){for(var b=a.angle,c=a.parent.children,d=0;d<c.length&&a!==c[d];)d++;0===d%2?d!==c.length-1&&(b=90===b?180:180===b?270:270===b?180:270):b=90===b?0:180===b?90:270===b?0:90;a.angle=b}a.initialized=!0};function lt(a,b){if(null!==b){a.assignTreeVertexValues(b);b=b.children;for(var c=b.length,d=0;d<c;d++)lt(a,b[d])}}Ys.prototype.assignTreeVertexValues=function(){};
function mt(a,b){if(null!==b){b.alignment!==qt&&a.sortTreeVertexChildren(b);b=b.children;for(var c=b.length,d=0;d<c;d++)mt(a,b[d])}}Ys.prototype.sortTreeVertexChildren=function(a){switch(a.sorting){case vt:break;case wt:a.children.reverse();break;case xt:a.children.sort(a.comparer);break;case yt:a.children.sort(a.comparer);a.children.reverse();break;default:B("Unhandled sorting value "+a.sorting.toString())}};Ys.prototype.rv=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)};
Ys.prototype.addComments=function(a){var b=a.angle,c=a.parent,d=0;var e=!1;null!==c&&(d=c.angle,e=c.alignment,e=zt(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.Dv();l.next();){var m=l.value;"Comment"===m.category&&m.canLayout()&&(null===a.comments&&(a.comments=[]),a.comments.push(m),m.Ab(),m=m.measuredBounds,b&&!c||!e&&!d&&c||e&&d&&c?(f=Math.max(f,m.width),g+=m.height+Math.abs(h)):(f+=m.width+Math.abs(h),g=Math.max(g,
m.height)),h=k)}null!==a.comments&&(b&&!c||!e&&!d&&c||e&&d&&c?(f+=Math.abs(a.commentMargin),g=Math.max(0,g-a.height)):(g+=Math.abs(a.commentMargin),f=Math.max(0,f-a.width)),e=N.allocAt(0,0,a.bounds.width+f,a.bounds.height+g),a.bounds=e,N.free(e))};function zt(a){return a===At||a===qt||a===Bt||a===Ct}function Dt(a){return a===At||a===qt}
function Et(a){var b=a.parent;if(null!==b){var c=b.alignment;if(zt(c)){if(Dt(c)){b=b.children;for(c=0;c<b.length&&a!==b[c];)c++;return 0===c%2}if(c===Bt)return!0}}return!1}
Ys.prototype.layoutComments=function(a){if(null!==a.comments){var b=a.node.measuredBounds,c=a.parent,d=a.angle,e=0;var f=!1;null!==c&&(e=c.angle,f=c.alignment,f=zt(f));d=90===d||270===d;c=90===e||270===e;for(var g=0===a.childrenCount,h=Et(a),k=0,l=a.comments,m=l.length,n=I.alloc(),p=0;p<m;p++){var r=l[p],q=r.measuredBounds;if(d&&!g||!f&&!c&&g||f&&c&&g){if(135<e&&!f||c&&h)if(0<=a.commentMargin)for(n.h(a.bounds.x-a.commentMargin-q.width,a.bounds.y+k),r.move(n),r=r.xd();r.next();){var u=r.value;u.fromSpot=
fd;u.toSpot=gd}else for(n.h(a.bounds.x+2*a.focus.x-a.commentMargin,a.bounds.y+k),r.move(n),r=r.xd();r.next();)u=r.value,u.fromSpot=gd,u.toSpot=fd;else if(0<=a.commentMargin)for(n.h(a.bounds.x+2*a.focus.x+a.commentMargin,a.bounds.y+k),r.move(n),r=r.xd();r.next();)u=r.value,u.fromSpot=gd,u.toSpot=fd;else for(n.h(a.bounds.x+a.commentMargin-q.width,a.bounds.y+k),r.move(n),r=r.xd();r.next();)u=r.value,u.fromSpot=fd,u.toSpot=gd;k=0<=a.commentSpacing?k+(q.height+a.commentSpacing):k+(a.commentSpacing-q.height)}else{if(135<
e&&!f||!c&&h)if(0<=a.commentMargin)for(n.h(a.bounds.x+k,a.bounds.y-a.commentMargin-q.height),r.move(n),r=r.xd();r.next();)u=r.value,u.fromSpot=ed,u.toSpot=hd;else for(n.h(a.bounds.x+k,a.bounds.y+2*a.focus.y-a.commentMargin),r.move(n),r=r.xd();r.next();)u=r.value,u.fromSpot=hd,u.toSpot=ed;else if(0<=a.commentMargin)for(n.h(a.bounds.x+k,a.bounds.y+2*a.focus.y+a.commentMargin),r.move(n),r=r.xd();r.next();)u=r.value,u.fromSpot=hd,u.toSpot=ed;else for(n.h(a.bounds.x+k,a.bounds.y+a.commentMargin-q.height),
r.move(n),r=r.xd();r.next();)u=r.value,u.fromSpot=ed,u.toSpot=hd;k=0<=a.commentSpacing?k+(q.width+a.commentSpacing):k+(a.commentSpacing-q.width)}}I.free(n);b=k-a.commentSpacing-(d?b.height:b.width);if(this.$c===$s)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)}};
Ys.prototype.layoutTree=function(a){if(null!==a){for(var b=a.children,c=b.length,d=0;d<c;d++)this.layoutTree(b[d]);switch(a.compaction){case Ft:Gt(this,a);break;case Ht:if(a.alignment===qt)Gt(this,a);else if(0===a.childrenCount)d=a.parent,c=!1,b=0,null!==d&&(b=d.angle,c=d.alignment,c=zt(c)),d=Et(a),a.S.h(0,0),a.ta.h(a.width,a.height),null===a.parent||null===a.comments||(180!==b&&270!==b||c)&&!d?a.da.h(0,0):180===b&&!c||(90===b||270===b)&&d?a.da.h(a.width-2*a.focus.x,0):a.da.h(0,a.height-2*a.focus.y),
a.Dq=null,a.Qq=null;else{var e=It(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.ta.width:d.ta.height);var k=a.alignment,l=k===Jt,m=zt(k),n=Math.max(0,a.breadthLimit);c=Kt(a);var p=a.nodeSpacing,r=Qt(a),q=a.rowSpacing,u=0;if(k===Rt||l||a.Gm||a.Hm&&1===a.maxGenerationCount)u=Math.max(0,a.rowIndent);d=a.width;var v=a.height,w=0,y=0,z=0,A=null,C=null,G=0,L=0,J=0,U=0,R=0,ca=0,pa=0,O=0;m&&!Dt(k)&&135<e&&g.reverse();if(Dt(k))if(1<h)for(var xa=0;xa<h;xa++)0===
xa%2&&xa!==h-1&&(O=Math.max(O,b?g[xa].ta.width:g[xa].ta.height));else 1===h&&(O=b?g[0].ta.width:g[0].ta.height);if(m){switch(k){case At:y=135>e?St(a,g,O,w,y):Tt(a,g,O,w,y);O=y.x;w=y.width;y=y.height;break;case Bt:for(A=0;A<h;A++)C=g[A],n=C.ta,z=0===ca?0:q,b?(C.S.h(f-n.width,U+z),w=Math.max(w,n.width),y=Math.max(y,U+z+n.height),U+=z+n.height):(C.S.h(J+z,f-n.height),w=Math.max(w,J+z+n.width),y=Math.max(y,n.height),J+=z+n.width),ca++;break;case Ct:for(A=0;A<h;A++)C=g[A],f=C.ta,n=0===ca?0:q,b?(C.S.h(p/
2+a.focus.x,U+n),w=Math.max(w,f.width),y=Math.max(y,U+n+f.height),U+=n+f.height):(C.S.h(J+n,p/2+a.focus.y),w=Math.max(w,J+n+f.width),y=Math.max(y,f.height),J+=n+f.width),ca++}A=Ut(this,2);C=Ut(this,2);b?(A[0].h(0,0),A[1].h(0,y),C[0].h(w,0)):(A[0].h(0,0),A[1].h(w,0),C[0].h(0,y));C[1].h(w,y)}else for(xa=0;xa<h;xa++){var Ma=g[xa],hb=Ma.ta;if(b){0<n&&0<ca&&J+p+hb.width>n&&(J<f&&Vt(a,k,f-J,0,pa,xa-1),R++,ca=0,pa=xa,z=y,J=0,U=135<e?-y-q:y+q);Wt(this,Ma,0,U);var Ea=0;if(0===ca){if(A=Ma.Dq,C=Ma.Qq,G=hb.width,
L=hb.height,null===A||null===C||e!==It(Ma))A=Ut(this,2),C=Ut(this,2),A[0].h(0,0),A[1].h(0,L),C[0].h(G,0),C[1].h(G,L)}else{var wb=Fa();L=Xt(this,a,Ma,A,C,G,L,wb);Ea=L.x;A=wb[0];C=wb[1];G=L.width;L=L.height;Ha(wb);J<hb.width&&0>Ea&&(Yt(a,-Ea,0,pa,xa-1),Zt(A,-Ea,0),Zt(C,-Ea,0),Ea=0)}Ma.S.h(Ea,U);w=Math.max(w,G);y=Math.max(y,z+(0===R?0:q)+hb.height);J=G}else{0<n&&0<ca&&U+p+hb.height>n&&(U<f&&Vt(a,k,0,f-U,pa,xa-1),R++,ca=0,pa=xa,z=w,U=0,J=135<e?-w-q:w+q);Wt(this,Ma,J,0);Ea=0;if(0===ca){if(A=Ma.Dq,C=Ma.Qq,
G=hb.width,L=hb.height,null===A||null===C||e!==It(Ma))A=Ut(this,2),C=Ut(this,2),A[0].h(0,0),A[1].h(G,0),C[0].h(0,L),C[1].h(G,L)}else wb=Fa(),L=Xt(this,a,Ma,A,C,G,L,wb),Ea=L.x,A=wb[0],C=wb[1],G=L.width,L=L.height,Ha(wb),U<hb.height&&0>Ea&&(Yt(a,0,-Ea,pa,xa-1),Zt(A,0,-Ea),Zt(C,0,-Ea),Ea=0);Ma.S.h(J,Ea);y=Math.max(y,L);w=Math.max(w,z+(0===R?0:q)+hb.width);U=L}ca++}0<R&&(b?(y+=Math.max(0,c),J<w&&Vt(a,k,w-J,0,pa,h-1),0<u&&(l||Yt(a,u,0,0,h-1),w+=u)):(w+=Math.max(0,c),U<y&&Vt(a,k,0,y-U,pa,h-1),0<u&&(l||
Yt(a,0,u,0,h-1),y+=u)));u=l=0;switch(k){case $t:b?l+=w/2-a.focus.x-r/2:u+=y/2-a.focus.y-r/2;break;case au:0<R?b?l+=w/2-a.focus.x-r/2:u+=y/2-a.focus.y-r/2:b?(O=g[0].S.x+g[0].da.x,l+=O+(g[h-1].S.x+g[h-1].da.x+2*g[h-1].focus.x-O)/2-a.focus.x-r/2):(O=g[0].S.y+g[0].da.y,u+=O+(g[h-1].S.y+g[h-1].da.y+2*g[h-1].focus.y-O)/2-a.focus.y-r/2);break;case Rt:b?(l-=r,w+=r):(u-=r,y+=r);break;case Jt:b?(l+=w-a.width+r,w+=r):(u+=y-a.height+r,y+=r);break;case At:b?1<h?l+=O+p/2-a.focus.x:l+=g[0].focus.x-a.focus.x+g[0].da.x:
1<h?u+=O+p/2-a.focus.y:u+=g[0].focus.y-a.focus.y+g[0].da.y;break;case Bt:b?l+=w+p/2-a.focus.x:u+=y+p/2-a.focus.y;break;case Ct:break;default:B("Unhandled alignment value "+k.toString())}for(r=0;r<h;r++)O=g[r],b?O.S.h(O.S.x+O.da.x-l,O.S.y+(135<e?(m?-y:-O.ta.height)+O.da.y-c:v+c+O.da.y)):O.S.h(O.S.x+(135<e?(m?-w:-O.ta.width)+O.da.x-c:d+c+O.da.x),O.S.y+O.da.y-u);h=g=0;m?b?(w=bu(a,w,l),0>l&&(l=0),135<e&&(u+=y+c),y+=v+c,k===Ct&&(g+=p/2+a.focus.x),h+=v+c):(135<e&&(l+=w+c),w+=d+c,y=cu(a,y,u),0>u&&(u=0),
k===Ct&&(h+=p/2+a.focus.y),g+=d+c):b?(null===a.comments?d>w&&(w=du(k,d-w,0),g=w.x,h=w.y,w=d,l=0):w=bu(a,w,l),0>l&&(g-=l,l=0),135<e&&(u+=y+c),y=Math.max(Math.max(y,v),y+v+c),h+=v+c):(135<e&&(l+=w+c),w=Math.max(Math.max(w,d),w+d+c),null===a.comments?v>y&&(y=du(k,0,v-y),g=y.x,h=y.y,y=v,u=0):y=cu(a,y,u),0>u&&(h-=u,u=0),g+=d+c);if(0<R)e=Ut(this,4),R=Ut(this,4),b?(e[2].h(0,v+c),e[3].h(e[2].x,y),R[2].h(w,e[2].y),R[3].h(R[2].x,e[3].y)):(e[2].h(d+c,0),e[3].h(w,e[2].y),R[2].h(e[2].x,y),R[3].h(e[3].x,R[2].y));
else{e=Ut(this,A.length+2);R=Ut(this,C.length+2);for(k=0;k<A.length;k++)m=A[k],e[k+2].h(m.x+g,m.y+h);for(k=0;k<C.length;k++)m=C[k],R[k+2].h(m.x+g,m.y+h)}b?(e[0].h(l,0),e[1].h(e[0].x,v),e[2].y<e[1].y&&(e[2].x>e[0].x?e[2].assign(e[1]):e[1].assign(e[2])),e[3].y<e[2].y&&(e[3].x>e[0].x?e[3].assign(e[2]):e[2].assign(e[3])),R[0].h(l+d,0),R[1].h(R[0].x,v),R[2].y<R[1].y&&(R[2].x<R[0].x?R[2].assign(R[1]):R[1].assign(R[2])),R[3].y<R[2].y&&(R[3].x<R[0].x?R[3].assign(R[2]):R[2].assign(R[3])),e[2].y-=c/2,R[2].y-=
c/2):(e[0].h(0,u),e[1].h(d,e[0].y),e[2].x<e[1].x&&(e[2].y>e[0].y?e[2].assign(e[1]):e[1].assign(e[2])),e[3].x<e[2].x&&(e[3].y>e[0].y?e[3].assign(e[2]):e[2].assign(e[3])),R[0].h(0,u+v),R[1].h(d,R[0].y),R[2].x<R[1].x&&(R[2].y<R[0].y?R[2].assign(R[1]):R[1].assign(R[2])),R[3].x<R[2].x&&(R[3].y<R[0].y?R[3].assign(R[2]):R[2].assign(R[3])),e[2].x-=c/2,R[2].x-=c/2);eu(this,A);eu(this,C);a.Dq=e;a.Qq=R;a.da.h(l,u);a.ta.h(w,y)}break;default:B("Unhandled compaction value "+a.compaction.toString())}}};
function Gt(a,b){if(0===b.childrenCount){var c=!1,d=0;null!==b.parent&&(d=b.parent.angle,c=b.parent.alignment,c=zt(c));var e=Et(b);b.S.h(0,0);b.ta.h(b.width,b.height);null===b.parent||null===b.comments||(180!==d&&270!==d||c)&&!e?b.da.h(0,0):180===d&&!c||(90===d||270===d)&&e?b.da.h(b.width-2*b.focus.x,0):b.da.h(0,b.height-2*b.focus.y)}else{d=It(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.ta.width:k.ta.height)}var l=b.alignment,m=l===Rt,n=l===
Jt;h=zt(l);var p=Math.max(0,b.breadthLimit);k=Kt(b);var r=b.nodeSpacing,q=Qt(b),u=m||n?0:q/2,v=b.rowSpacing,w=0;if(m||n||b.Gm||b.Hm&&1===b.maxGenerationCount)w=Math.max(0,b.rowIndent);m=b.width;var y=b.height,z=0,A=0,C=0,G=0,L=0,J=0,U=0,R=0,ca=0;h&&!Dt(l)&&135<d&&e.reverse();if(Dt(l))if(1<g)for(var pa=0;pa<g;pa++){var O=e[pa],xa=O.ta;0===pa%2&&pa!==g-1&&(ca=Math.max(ca,(c?xa.width:xa.height)+fu(O)-r))}else 1===g&&(ca=c?e[0].ta.width:e[0].ta.height);if(h)switch(l){case At:case qt:A=135>d?St(b,e,ca,
z,A):Tt(b,e,ca,z,A);ca=A.x;z=A.width;A=A.height;break;case Bt:for(a=0;a<g;a++)p=e[a],u=p.ta,C=0===U?0:v,c?(p.S.h(f-u.width,L+C),z=Math.max(z,u.width),A=Math.max(A,L+C+u.height),L+=C+u.height):(p.S.h(G+C,f-u.height),z=Math.max(z,G+C+u.width),A=Math.max(A,u.height),G+=C+u.width),U++;break;case Ct:for(f=0;f<g;f++)a=e[f],p=a.ta,u=0===U?0:v,c?(a.S.h(r/2+b.focus.x,L+u),z=Math.max(z,p.width),A=Math.max(A,L+u+p.height),L+=u+p.height):(a.S.h(G+u,r/2+b.focus.y),z=Math.max(z,G+u+p.width),A=Math.max(A,p.height),
G+=u+p.width),U++}else for(pa=0;pa<g;pa++){O=e[pa];xa=O.ta;if(c){0<p&&0<U&&G+r+xa.width>p&&(G<f&&Vt(b,l,f-G,0,R,pa-1),J++,U=0,R=pa,C=A,G=0,L=135<d?-A-v:A+v);var Ma=0===U?u:r;Wt(a,O,0,L);O.S.h(G+Ma,L);z=Math.max(z,G+Ma+xa.width);A=Math.max(A,C+(0===J?0:v)+xa.height);G+=Ma+xa.width}else 0<p&&0<U&&L+r+xa.height>p&&(L<f&&Vt(b,l,0,f-L,R,pa-1),J++,U=0,R=pa,C=z,L=0,G=135<d?-z-v:z+v),Ma=0===U?u:r,Wt(a,O,G,0),O.S.h(G,L+Ma),A=Math.max(A,L+Ma+xa.height),z=Math.max(z,C+(0===J?0:v)+xa.width),L+=Ma+xa.height;U++}0<
J&&(c?(A+=Math.max(0,k),G<z&&Vt(b,l,z-G,0,R,g-1),0<w&&(n||Yt(b,w,0,0,g-1),z+=w)):(z+=Math.max(0,k),L<A&&Vt(b,l,0,A-L,R,g-1),0<w&&(n||Yt(b,0,w,0,g-1),A+=w)));w=n=0;switch(l){case $t:c?n+=z/2-b.focus.x-q/2:w+=A/2-b.focus.y-q/2;break;case au:0<J?c?n+=z/2-b.focus.x-q/2:w+=A/2-b.focus.y-q/2:c?(l=e[0].S.x+e[0].da.x,n+=l+(e[g-1].S.x+e[g-1].da.x+2*e[g-1].focus.x-l)/2-b.focus.x-q/2):(l=e[0].S.y+e[0].da.y,w+=l+(e[g-1].S.y+e[g-1].da.y+2*e[g-1].focus.y-l)/2-b.focus.y-q/2);break;case Rt:c?(n-=q,z+=q):(w-=q,A+=
q);break;case Jt:c?(n+=z-b.width+q,z+=q):(w+=A-b.height+q,A+=q);break;case At:case qt:c?1<g?n+=ca+r/2-b.focus.x:n+=e[0].focus.x-b.focus.x+e[0].da.x:1<g?w+=ca+r/2-b.focus.y:w+=e[0].focus.y-b.focus.y+e[0].da.y;break;case Bt:c?n+=z+r/2-b.focus.x:w+=A+r/2-b.focus.y;break;case Ct:break;default:B("Unhandled alignment value "+l.toString())}for(q=0;q<g;q++)l=e[q],c?l.S.h(l.S.x+l.da.x-n,l.S.y+(135<d?(h?-A:-l.ta.height)+l.da.y-k:y+k+l.da.y)):l.S.h(l.S.x+(135<d?(h?-z:-l.ta.width)+l.da.x-k:m+k+l.da.x),l.S.y+
l.da.y-w);c?(z=bu(b,z,n),0>n&&(n=0),135<d&&(w+=A+k),A=Math.max(Math.max(A,y),A+y+k)):(135<d&&(n+=z+k),z=Math.max(Math.max(z,m),z+m+k),A=cu(b,A,w),0>w&&(w=0));b.da.h(n,w);b.ta.h(z,A)}}
function St(a,b,c,d,e){var f=b.length;if(0===f)return new N(c,0,d,e);if(1===f)return a=b[0],d=a.ta.width,e=a.ta.height,new N(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=90===It(a),l=0,m=0,n=0,p=0;p<f;p++)if(!(0!==p%2||1<f&&p===f-1)){var r=b[p],q=r.ta,u=0===l?0:h;if(k){var v=fu(r)-g;r.S.h(c-(q.width+v),n+u);d=Math.max(d,q.width+v);e=Math.max(e,n+u+q.height);n+=u+q.height}else v=fu(r)-g,r.S.h(m+u,c-(q.height+v)),e=Math.max(e,q.height+v),d=Math.max(d,m+u+q.width),m+=u+q.width;l++}l=0;r=m;p=n;k?
(m=c+g,n=0):(m=0,n=c+g);for(q=0;q<f;q++)if(0!==q%2){u=b[q];v=u.ta;var w=0===l?0:h;if(k){var y=fu(u)-g;u.S.h(m+y,n+w);d=Math.max(d,m+v.width+y);e=Math.max(e,n+w+v.height);n+=w+v.height}else y=fu(u)-g,u.S.h(m+w,n+y),d=Math.max(d,m+w+v.width),e=Math.max(e,n+v.height+y),m+=w+v.width;l++}1<f&&1===f%2&&(b=b[f-1],f=b.ta,h=null===b.parent?0:b.parent.rowSpacing,k?(b.S.h(c+g/2-b.focus.x-b.da.x,e+h),k=c+g/2-b.focus.x-b.da.x,d=Math.max(d,k+f.width),0>k&&(d-=k),e=Math.max(e,Math.max(p,n)+h+f.height),0>b.S.x&&
(c=gu(a,b.S.x,!1,c,g))):(b.S.h(d+h,c+g/2-b.focus.y-b.da.y),d=Math.max(d,Math.max(r,m)+h+f.width),n=c+g/2-b.focus.y-b.da.y,e=Math.max(e,n+f.height),0>n&&(e-=n),0>b.S.y&&(c=gu(a,b.S.y,!0,c,g))));return new N(c,0,d,e)}
function Tt(a,b,c,d,e){var f=b.length;if(0===f)return new N(c,0,d,e);if(1===f)return b=b[0],d=b.ta.width,e=b.ta.height,new N(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=270===It(a),l=0,m=0,n=0,p=0;p<f;p++)if(!(0!==p%2||1<f&&p===f-1)){var r=b[p],q=r.ta,u=0===l?0:h;if(k){var v=fu(r)-g;n-=u+q.height;r.S.h(c-(q.width+v),n);d=Math.max(d,q.width+v);e=Math.max(e,Math.abs(n))}else v=fu(r)-g,m-=u+q.width,r.S.h(m,c-(q.height+v)),e=Math.max(e,q.height+v),d=Math.max(d,Math.abs(m));l++}l=0;r=m;p=n;k?(m=
c+g,n=0):(m=0,n=c+g);for(q=0;q<f;q++)if(0!==q%2){u=b[q];v=u.ta;var w=0===l?0:h;if(k){var y=fu(u)-g;n-=w+v.height;u.S.h(m+y,n);d=Math.max(d,m+v.width+y);e=Math.max(e,Math.abs(n))}else y=fu(u)-g,m-=w+v.width,u.S.h(m,n+y),e=Math.max(e,n+v.height+y),d=Math.max(d,Math.abs(m));l++}1<f&&1===f%2&&(h=b[f-1],l=h.ta,q=null===h.parent?0:h.parent.rowSpacing,k?(h.S.h(c+g/2-h.focus.x-h.da.x,-e-l.height-q),m=c+g/2-h.focus.x-h.da.x,d=Math.max(d,m+l.width),0>m&&(d-=m),e=Math.max(e,Math.abs(Math.min(p,n))+q+l.height),
0>h.S.x&&(c=gu(a,h.S.x,!1,c,g))):(h.S.h(-d-l.width-q,c+g/2-h.focus.y-h.da.y),d=Math.max(d,Math.abs(Math.min(r,m))+q+l.width),n=c+g/2-h.focus.y-h.da.y,e=Math.max(e,n+l.height),0>n&&(e-=n),0>h.S.y&&(c=gu(a,h.S.y,!0,c,g))));for(a=0;a<f;a++)g=b[a],k?g.S.h(g.S.x,g.S.y+e):g.S.h(g.S.x+d,g.S.y);return new N(c,0,d,e)}function fu(a){return null===a.parent?0:a.parent.nodeSpacing}
function gu(a,b,c,d,e){a=a.children;for(var f=a.length,g=0;g<f;g++)c?a[g].S.h(a[g].S.x,a[g].S.y-b):a[g].S.h(a[g].S.x-b,a[g].S.y);b=a[f-1];return Math.max(d,c?b.da.y+b.focus.y-e/2:b.da.x+b.focus.x-e/2)}
function bu(a,b,c){switch(a.alignment){case au:case $t:return c+a.width>b&&(b=c+a.width),0>c&&(b-=c),b;case Rt:return a.width>b?a.width:b;case Jt:return 2*a.focus.x>b?a.width:b+a.width-2*a.focus.x;case At:case qt:return Math.max(a.width,Math.max(b,c+a.width)-Math.min(0,c));case Bt:return a.width-a.focus.x+a.nodeSpacing/2+b;case Ct:return Math.max(a.width,a.focus.x+a.nodeSpacing/2+b);default:return b}}
function cu(a,b,c){switch(a.alignment){case au:case $t:return c+a.height>b&&(b=c+a.height),0>c&&(b-=c),b;case Rt:return a.height>b?a.height:b;case Jt:return 2*a.focus.y>b?a.height:b+a.height-2*a.focus.y;case At:case qt:return Math.max(a.height,Math.max(b,c+a.height)-Math.min(0,c));case Bt:return a.height-a.focus.y+a.nodeSpacing/2+b;case Ct:return Math.max(a.height,a.focus.y+a.nodeSpacing/2+b);default:return b}}
function du(a,b,c){switch(a){case $t:b/=2;c/=2;break;case au:b/=2;c/=2;break;case Rt:c=b=0;break;case Jt:break;default:B("Unhandled alignment value "+a.toString())}return new I(b,c)}function Vt(a,b,c,d,e,f){b=du(b,c,d);Yt(a,b.x,b.y,e,f)}function Yt(a,b,c,d,e){if(0!==b||0!==c)for(a=a.children;d<=e;d++){var f=a[d].S;f.x+=b;f.y+=c}}
function Wt(a,b,c,d){var e=b.parent;switch(a.$c){case $s:for(a=b.sourceEdges;a.next();)b=a.value,b.fromVertex===e&&b.relativePoint.h(c,d);break;case gt:for(a=b.destinationEdges;a.next();)b=a.value,b.toVertex===e&&b.relativePoint.h(c,d);break;default:B("Unhandled path value "+a.$c.toString())}}function Zt(a,b,c){for(var d=0;d<a.length;d++){var e=a[d];e.x+=b;e.y+=c}}
function Xt(a,b,c,d,e,f,g,h){var k=It(b),l=90===k||270===k,m=b.nodeSpacing;b=d;var n=e;d=f;var p=g,r=c.Dq,q=c.Qq;g=c.ta;var u=l?Math.max(p,g.height):Math.max(d,g.width);if(null===r||k!==It(c))r=Ut(a,2),q=Ut(a,2),l?(r[0].h(0,0),r[1].h(0,g.height),q[0].h(g.width,0),q[1].h(q[0].x,r[1].y)):(r[0].h(0,0),r[1].h(g.width,0),q[0].h(0,g.height),q[1].h(r[1].x,q[0].y));if(l){p=9999999;if(!(null===n||2>n.length||null===r||2>r.length))for(e=c=0;c<n.length&&e<r.length;){f=n[c];var v=r[e];k=v.x;l=v.y;k+=d;var w=
f;c+1<n.length&&(w=n[c+1]);var y=v;v=y.x;y=y.y;e+1<r.length&&(y=r[e+1],v=y.x,y=y.y,v+=d);var z=p;f.y===l?z=k-f.x:f.y>l&&f.y<y?z=k+(f.y-l)/(y-l)*(v-k)-f.x:l>f.y&&l<w.y&&(z=k-(f.x+(l-f.y)/(w.y-f.y)*(w.x-f.x)));z<p&&(p=z);w.y<=f.y?c++:y<=l?e++:(w.y<=y&&c++,y<=w.y&&e++)}p=d-p;p+=m;c=r;e=p;if(null===b||2>b.length||null===c||2>c.length)d=null;else{m=Ut(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=Ut(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);eu(a,m);d=c}f=q;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=Ut(a,n.length+f.length);for(e=l=c=0;c<n.length&&n[c].y<f[0].y;)w=n[c++],m[e++].h(w.x,w.y);for(;l<f.length;)w=f[l++],m[e++].h(w.x+k,w.y);for(f=f[f.length-1].y;c<n.length&&n[c].y<=f;)c++;for(;c<n.length&&n[c].y>f;)k=n[c++],m[e++].h(k.x,k.y);f=Ut(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);eu(a,m);e=f}f=
Math.max(0,p)+g.width;g=u;eu(a,b);eu(a,r);eu(a,n);eu(a,q);h[0]=d;h[1]=e;return new N(p,0,f,g)}d=9999999;if(!(null===n||2>n.length||null===r||2>r.length))for(e=c=0;c<n.length&&e<r.length;)f=n[c],v=r[e],k=v.x,l=v.y,l+=p,w=f,c+1<n.length&&(w=n[c+1]),y=v,v=y.x,y=y.y,e+1<r.length&&(y=r[e+1],v=y.x,y=y.y,y+=p),z=d,f.x===k?z=l-f.y:f.x>k&&f.x<v?z=l+(f.x-k)/(v-k)*(y-l)-f.y:k>f.x&&k<w.x&&(z=l-(f.y+(k-f.x)/(w.x-f.x)*(w.y-f.y))),z<d&&(d=z),w.x<=f.x?c++:v<=k?e++:(w.x<=v&&c++,v<=w.x&&e++);p-=d;p+=m;c=r;e=p;if(null===
b||2>b.length||null===c||2>c.length)d=null;else{m=Ut(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=Ut(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);eu(a,m);d=c}f=q;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=Ut(a,n.length+f.length);for(e=l=c=0;c<n.length&&n[c].x<f[0].x;)w=n[c++],m[e++].h(w.x,w.y);
for(;l<f.length;)w=f[l++],m[e++].h(w.x,w.y+k);for(f=f[f.length-1].x;c<n.length&&n[c].x<=f;)c++;for(;c<n.length&&n[c].x>f;)k=n[c++],m[e++].h(k.x,k.y);f=Ut(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);eu(a,m);e=f}f=u;g=Math.max(0,p)+g.height;eu(a,b);eu(a,r);eu(a,n);eu(a,q);h[0]=d;h[1]=e;return new N(p,0,f,g)}function Ut(a,b){a=a.gv[b];if(void 0!==a&&(a=a.pop(),void 0!==a))return a;a=[];for(var c=0;c<b;c++)a[c]=new I;return a}
function eu(a,b){var c=b.length,d=a.gv[c];void 0===d&&(d=[],a.gv[c]=d);d.push(b)}
Ys.prototype.arrangeTrees=function(){if(this.Cb===ft)for(var a=this.Jb.iterator;a.next();){var b=a.value;if(b instanceof et){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);hu(this,b,c,d)}}}else{a=[];for(b=this.Jb.iterator;b.next();)c=b.value,c instanceof et&&a.push(c);switch(this.sorting){case vt:break;case wt:a.reverse();break;case xt:a.sort(this.comparer);break;case yt:a.sort(this.comparer);a.reverse();break;default:B("Unhandled sorting value "+this.sorting.toString())}c=
this.arrangementOrigin;b=c.x;c=c.y;for(d=0;d<a.length;d++){var e=a[d];hu(this,e,b+e.da.x,c+e.da.y);switch(this.Cb){case ct:c+=e.ta.height+this.Cd.height;break;case iu:b+=e.ta.width+this.Cd.width;break;default:B("Unhandled arrangement value "+this.Cb.toString())}}}};function hu(a,b,c,d){if(null!==b){b.x=c;b.y=d;b=b.children;for(var e=b.length,f=0;f<e;f++){var g=b[f];hu(a,g,c+g.S.x,d+g.S.y)}}}Ys.prototype.commitLayout=function(){this.pw();this.commitNodes();this.tv();this.isRouting&&this.commitLinks()};
Ys.prototype.commitNodes=function(){for(var a=this.network.vertexes.iterator;a.next();)a.value.commit();for(a.reset();a.next();)this.layoutComments(a.value)};
Ys.prototype.tv=function(){if(this.layerStyle===nt){for(var a=this.Vw,b=[],c=null,d=this.network.vertexes.iterator;d.next();){var e=d.value;null===c?c=e.bounds.copy():c.Jc(e.bounds);var f=b[e.level];void 0===f?f=Kt(e):f=Math.max(f,Kt(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.Fc(this.nodeSpacing/2,this.layerSpacing),d=new I(-this.nodeSpacing/2,-this.layerSpacing/2)):(c.Fc(this.layerSpacing,this.nodeSpacing/2),d=new I(-this.layerSpacing/2,-this.nodeSpacing/
2));e=[];c=90===this.angle||270===this.angle?c.width:c.height;f=0;if(180===this.angle||270===this.angle)for(var g=0;g<a.length;g++)f+=a[g]+b[g];for(g=0;g<a.length;g++){var h=a[g]+b[g];270===this.angle?(f-=h,e.push(new N(0,f,c,h))):90===this.angle?(e.push(new N(0,f,c,h)),f+=h):180===this.angle?(f-=h,e.push(new N(f,0,h,c))):(e.push(new N(f,0,h,c)),f+=h)}this.commitLayers(e,d)}};Ys.prototype.commitLayers=function(){};Ys.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};
Ys.prototype.pw=function(){for(var a=this.Jb.iterator;a.next();){var b=a.value;b instanceof et&&ju(this,b)}};function ju(a,b){if(null!==b){a.setPortSpots(b);b=b.children;for(var c=b.length,d=0;d<c;d++)ju(a,b[d])}}
Ys.prototype.setPortSpots=function(a){var b=a.alignment;if(zt(b)){var c=this.$c===$s,d=It(a);switch(d){case 0:var e=gd;break;case 90:e=hd;break;case 180:e=fd;break;default:e=ed}var f=a.children,g=f.length;switch(b){case At:case qt: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?fd:ed;if(1===g||b===g-1&&1===g%2)switch(d){case 0:k=fd;break;case 90:k=ed;break;case 180:k=gd;break;default:k=hd}else 0===b%2&&(k=90===d||270===
d?gd:hd);c?(a.setsPortSpot&&(h.fromSpot=e),a.setsChildPortSpot&&(h.toSpot=k)):(a.setsPortSpot&&(h.fromSpot=k),a.setsChildPortSpot&&(h.toSpot=e))}}break;case Bt:d=90===d||270===d?gd:hd;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 Ct:for(d=90===d||270===d?fd:ed,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=It(a),this.$c===$s)for(e=a.destinationEdges;e.next();){if(d=e.value.link,null!==d){if(a.setsPortSpot)if(a.portSpot.Nb())switch(c){case 0:d.fromSpot=gd;break;case 90:d.fromSpot=hd;break;case 180:d.fromSpot=fd;break;default:d.fromSpot=ed}else d.fromSpot=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.Nb())switch(c){case 0:d.toSpot=fd;break;
case 90:d.toSpot=ed;break;case 180:d.toSpot=gd;break;default:d.toSpot=hd}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.Nb())switch(c){case 0:d.toSpot=gd;break;case 90:d.toSpot=hd;break;case 180:d.toSpot=fd;break;default:d.toSpot=ed}else d.toSpot=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.Nb())switch(c){case 0:d.fromSpot=fd;break;case 90:d.fromSpot=ed;break;case 180:d.fromSpot=gd;break;default:d.fromSpot=hd}else d.fromSpot=
a.childPortSpot}};function It(a){a=a.angle;return 45>=a?0:135>=a?90:225>=a?180:315>=a?270:0}function Kt(a){var b=It(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 Qt(a){var b=It(a),c=a.nodeIndent;if(0<a.nodeIndentPastParent){var d=Math.min(1,a.nodeIndentPastParent);c+=90===b||270===b?a.width*d:a.height*d}return c=Math.max(0,c)}
ma.Object.defineProperties(Ys.prototype,{roots:{get:function(){return this.Jb},set:function(a){this.Jb!==a&&(this.Jb=a,this.C())}},path:{get:function(){return this.gp},set:function(a){this.gp!==a&&(this.gp=a,this.C())}},treeStyle:{get:function(){return this.bq},set:function(a){this.Cb===a||a!==at&&a!==tt&&a!==ut&&a!==st||(this.bq=a,this.C())}},layerStyle:{get:function(){return this.js},
set:function(a){this.Cb===a||a!==bt&&a!==ot&&a!==nt||(this.js=a,this.C())}},comments:{get:function(){return this.Zc},set:function(a){this.Zc!==a&&(this.Zc=a,this.C())}},arrangement:{get:function(){return this.Cb},set:function(a){this.Cb===a||a!==ct&&a!==iu&&a!==ft||(this.Cb=a,this.C())}},arrangementSpacing:{get:function(){return this.Cd},set:function(a){this.Cd.w(a)||(this.Cd.assign(a),this.C())}},rootDefaults:{
get:function(){return this.U},set:function(a){this.U!==a&&(this.U=a,this.C())}},alternateDefaults:{get:function(){return this.V},set:function(a){this.V!==a&&(this.V=a,this.C())}},sorting:{get:function(){return this.U.sorting},set:function(a){this.U.sorting===a||a!==vt&&a!==wt&&a!==xt&&!yt||(this.U.sorting=a,this.C())}},comparer:{get:function(){return this.U.comparer},set:function(a){this.U.comparer!==
a&&(this.U.comparer=a,this.C())}},angle:{get:function(){return this.U.angle},set:function(a){this.U.angle!==a&&(0===a||90===a||180===a||270===a?(this.U.angle=a,this.C()):B("TreeLayout.angle must be 0, 90, 180, or 270"))}},alignment:{get:function(){return this.U.alignment},set:function(a){this.U.alignment!==a&&(this.U.alignment=a,this.C())}},nodeIndent:{get:function(){return this.U.nodeIndent},set:function(a){this.U.nodeIndent!==
a&&0<=a&&(this.U.nodeIndent=a,this.C())}},nodeIndentPastParent:{get:function(){return this.U.nodeIndentPastParent},set:function(a){this.U.nodeIndentPastParent!==a&&0<=a&&1>=a&&(this.U.nodeIndentPastParent=a,this.C())}},nodeSpacing:{get:function(){return this.U.nodeSpacing},set:function(a){this.U.nodeSpacing!==a&&(this.U.nodeSpacing=a,this.C())}},layerSpacing:{get:function(){return this.U.layerSpacing},set:function(a){this.U.layerSpacing!==
a&&(this.U.layerSpacing=a,this.C())}},layerSpacingParentOverlap:{get:function(){return this.U.layerSpacingParentOverlap},set:function(a){this.U.layerSpacingParentOverlap!==a&&0<=a&&1>=a&&(this.U.layerSpacingParentOverlap=a,this.C())}},compaction:{get:function(){return this.U.compaction},set:function(a){this.U.compaction===a||a!==Ft&&a!==Ht||(this.U.compaction=a,this.C())}},breadthLimit:{get:function(){return this.U.breadthLimit},
set:function(a){this.U.breadthLimit!==a&&0<=a&&(this.U.breadthLimit=a,this.C())}},rowSpacing:{get:function(){return this.U.rowSpacing},set:function(a){this.U.rowSpacing!==a&&(this.U.rowSpacing=a,this.C())}},rowIndent:{get:function(){return this.U.rowIndent},set:function(a){this.U.rowIndent!==a&&0<=a&&(this.U.rowIndent=a,this.C())}},commentSpacing:{get:function(){return this.U.commentSpacing},set:function(a){this.U.commentSpacing!==
a&&(this.U.commentSpacing=a,this.C())}},commentMargin:{get:function(){return this.U.commentMargin},set:function(a){this.U.commentMargin!==a&&(this.U.commentMargin=a,this.C())}},setsPortSpot:{get:function(){return this.U.setsPortSpot},set:function(a){this.U.setsPortSpot!==a&&(this.U.setsPortSpot=a,this.C())}},portSpot:{get:function(){return this.U.portSpot},set:function(a){this.U.portSpot.w(a)||(this.U.portSpot=
a,this.C())}},setsChildPortSpot:{get:function(){return this.U.setsChildPortSpot},set:function(a){this.U.setsChildPortSpot!==a&&(this.U.setsChildPortSpot=a,this.C())}},childPortSpot:{get:function(){return this.U.childPortSpot},set:function(a){this.U.childPortSpot.w(a)||(this.U.childPortSpot=a,this.C())}},alternateSorting:{get:function(){return this.V.sorting},set:function(a){this.V.sorting===a||a!==vt&&a!==wt&&
a!==xt&&!yt||(this.V.sorting=a,this.C())}},alternateComparer:{get:function(){return this.V.comparer},set:function(a){this.V.comparer!==a&&(this.V.comparer=a,this.C())}},alternateAngle:{get:function(){return this.V.angle},set:function(a){this.V.angle===a||0!==a&&90!==a&&180!==a&&270!==a||(this.V.angle=a,this.C())}},alternateAlignment:{get:function(){return this.V.alignment},set:function(a){this.V.alignment!==
a&&(this.V.alignment=a,this.C())}},alternateNodeIndent:{get:function(){return this.V.nodeIndent},set:function(a){this.V.nodeIndent!==a&&0<=a&&(this.V.nodeIndent=a,this.C())}},alternateNodeIndentPastParent:{get:function(){return this.V.nodeIndentPastParent},set:function(a){this.V.nodeIndentPastParent!==a&&0<=a&&1>=a&&(this.V.nodeIndentPastParent=a,this.C())}},alternateNodeSpacing:{get:function(){return this.V.nodeSpacing},
set:function(a){this.V.nodeSpacing!==a&&(this.V.nodeSpacing=a,this.C())}},alternateLayerSpacing:{get:function(){return this.V.layerSpacing},set:function(a){this.V.layerSpacing!==a&&(this.V.layerSpacing=a,this.C())}},alternateLayerSpacingParentOverlap:{get:function(){return this.V.layerSpacingParentOverlap},set:function(a){this.V.layerSpacingParentOverlap!==a&&0<=a&&1>=a&&(this.V.layerSpacingParentOverlap=a,this.C())}},alternateCompaction:{
get:function(){return this.V.compaction},set:function(a){this.V.compaction===a||a!==Ft&&a!==Ht||(this.V.compaction=a,this.C())}},alternateBreadthLimit:{get:function(){return this.V.breadthLimit},set:function(a){this.V.breadthLimit!==a&&0<=a&&(this.V.breadthLimit=a,this.C())}},alternateRowSpacing:{get:function(){return this.V.rowSpacing},set:function(a){this.V.rowSpacing!==a&&(this.V.rowSpacing=a,this.C())}},alternateRowIndent:{
get:function(){return this.V.rowIndent},set:function(a){this.V.rowIndent!==a&&0<=a&&(this.V.rowIndent=a,this.C())}},alternateCommentSpacing:{get:function(){return this.V.commentSpacing},set:function(a){this.V.commentSpacing!==a&&(this.V.commentSpacing=a,this.C())}},alternateCommentMargin:{get:function(){return this.V.commentMargin},set:function(a){this.V.commentMargin!==a&&(this.V.commentMargin=a,this.C())}},alternateSetsPortSpot:{
get:function(){return this.V.setsPortSpot},set:function(a){this.V.setsPortSpot!==a&&(this.V.setsPortSpot=a,this.C())}},alternatePortSpot:{get:function(){return this.V.portSpot},set:function(a){this.V.portSpot.w(a)||(this.V.portSpot=a,this.C())}},alternateSetsChildPortSpot:{get:function(){return this.V.setsChildPortSpot},set:function(a){this.V.setsChildPortSpot!==a&&(this.V.setsChildPortSpot=a,this.C())}},alternateChildPortSpot:{
get:function(){return this.V.childPortSpot},set:function(a){this.V.childPortSpot.w(a)||(this.V.childPortSpot=a,this.C())}}});
var Zs=new D(Ys,"PathDefault",-1),$s=new D(Ys,"PathDestination",0),gt=new D(Ys,"PathSource",1),vt=new D(Ys,"SortingForwards",10),wt=new D(Ys,"SortingReverse",11),xt=new D(Ys,"SortingAscending",12),yt=new D(Ys,"SortingDescending",13),$t=new D(Ys,"AlignmentCenterSubtrees",20),au=new D(Ys,"AlignmentCenterChildren",21),Rt=new D(Ys,"AlignmentStart",22),Jt=new D(Ys,"AlignmentEnd",23),At=new D(Ys,"AlignmentBus",24),qt=new D(Ys,"AlignmentBusBranching",25),Bt=new D(Ys,"AlignmentTopLeftBus",26),Ct=new D(Ys,
"AlignmentBottomRightBus",27),Ft=new D(Ys,"CompactionNone",30),Ht=new D(Ys,"CompactionBlock",31),at=new D(Ys,"StyleLayered",40),ut=new D(Ys,"StyleLastParents",41),tt=new D(Ys,"StyleAlternating",42),st=new D(Ys,"StyleRootOnly",43),ct=new D(Ys,"ArrangementVertical",50),iu=new D(Ys,"ArrangementHorizontal",51),ft=new D(Ys,"ArrangementFixedRoots",52),bt=new D(Ys,"LayerIndividual",60),ot=new D(Ys,"LayerSiblings",61),nt=new D(Ys,"LayerUniform",62);Ys.className="TreeLayout";Ys.PathDefault=Zs;
Ys.PathDestination=$s;Ys.PathSource=gt;Ys.SortingForwards=vt;Ys.SortingReverse=wt;Ys.SortingAscending=xt;Ys.SortingDescending=yt;Ys.AlignmentCenterSubtrees=$t;Ys.AlignmentCenterChildren=au;Ys.AlignmentStart=Rt;Ys.AlignmentEnd=Jt;Ys.AlignmentBus=At;Ys.AlignmentBusBranching=qt;Ys.AlignmentTopLeftBus=Bt;Ys.AlignmentBottomRightBus=Ct;Ys.CompactionNone=Ft;Ys.CompactionBlock=Ht;Ys.StyleLayered=at;Ys.StyleLastParents=ut;Ys.StyleAlternating=tt;Ys.StyleRootOnly=st;Ys.ArrangementVertical=ct;
Ys.ArrangementHorizontal=iu;Ys.ArrangementFixedRoots=ft;Ys.LayerIndividual=bt;Ys.LayerSiblings=ot;Ys.LayerUniform=nt;function dt(a){Pp.call(this,a)}la(dt,Pp);dt.prototype.createVertex=function(){return new et(this)};dt.prototype.createEdge=function(){return new ku(this)};dt.className="TreeNetwork";
function et(a){Sp.call(this,a);this.Ia=!1;this.Kc=null;this.I=[];this.kd=this.bb=this.T=this.Ja=0;this.Zc=null;this.S=new I(0,0);this.ta=new M(0,0);this.da=new I(0,0);this.Hm=this.Gm=this.xA=!1;this.Qq=this.Dq=null;this.Rc=vt;this.Mc=Zp;this.Yb=0;this.xb=au;this.us=this.ts=0;this.vs=20;this.pe=50;this.hs=0;this.tr=Ht;this.kr=0;this.Is=25;this.sr=this.Hs=10;this.rr=20;this.Vs=!0;this.Es=$c;this.Us=!0;this.nr=$c}la(et,Sp);
et.prototype.copyInheritedPropertiesFrom=function(a){null!==a&&(this.Rc=a.sorting,this.Mc=a.comparer,this.Yb=a.angle,this.xb=a.alignment,this.ts=a.nodeIndent,this.us=a.nodeIndentPastParent,this.vs=a.nodeSpacing,this.pe=a.layerSpacing,this.hs=a.layerSpacingParentOverlap,this.tr=a.compaction,this.kr=a.breadthLimit,this.Is=a.rowSpacing,this.Hs=a.rowIndent,this.sr=a.commentSpacing,this.rr=a.commentMargin,this.Vs=a.setsPortSpot,this.Es=a.portSpot,this.Us=a.setsChildPortSpot,this.nr=a.childPortSpot)};
ma.Object.defineProperties(et.prototype,{initialized:{get:function(){return this.Ia},set:function(a){this.Ia!==a&&(this.Ia=a)}},parent:{get:function(){return this.Kc},set:function(a){this.Kc!==a&&(this.Kc=a)}},children:{get:function(){return this.I},set:function(a){if(this.I!==a){if(null!==a)for(var b=a.length,c=0;c<b;c++);this.I=a}}},level:{get:function(){return this.Ja},set:function(a){this.Ja!==
a&&(this.Ja=a)}},descendantCount:{get:function(){return this.T},set:function(a){this.T!==a&&(this.T=a)}},maxChildrenCount:{get:function(){return this.bb},set:function(a){this.bb!==a&&(this.bb=a)}},maxGenerationCount:{get:function(){return this.kd},set:function(a){this.kd!==a&&(this.kd=a)}},comments:{get:function(){return this.Zc},set:function(a){if(this.Zc!==a){if(null!==a)for(var b=
a.length,c=0;c<b;c++);this.Zc=a}}},sorting:{get:function(){return this.Rc},set:function(a){this.Rc!==a&&(this.Rc=a)}},comparer:{get:function(){return this.Mc},set:function(a){this.Mc!==a&&(this.Mc=a)}},angle:{get:function(){return this.Yb},set:function(a){this.Yb!==a&&(this.Yb=a)}},alignment:{get:function(){return this.xb},set:function(a){this.xb!==a&&(this.xb=a)}},nodeIndent:{
get:function(){return this.ts},set:function(a){this.ts!==a&&(this.ts=a)}},nodeIndentPastParent:{get:function(){return this.us},set:function(a){this.us!==a&&(this.us=a)}},nodeSpacing:{get:function(){return this.vs},set:function(a){this.vs!==a&&(this.vs=a)}},layerSpacing:{get:function(){return this.pe},set:function(a){this.pe!==a&&(this.pe=a)}},layerSpacingParentOverlap:{
get:function(){return this.hs},set:function(a){this.hs!==a&&(this.hs=a)}},compaction:{get:function(){return this.tr},set:function(a){this.tr!==a&&(this.tr=a)}},breadthLimit:{get:function(){return this.kr},set:function(a){this.kr!==a&&(this.kr=a)}},rowSpacing:{get:function(){return this.Is},set:function(a){this.Is!==a&&(this.Is=a)}},rowIndent:{get:function(){return this.Hs},set:function(a){this.Hs!==
a&&(this.Hs=a)}},commentSpacing:{get:function(){return this.sr},set:function(a){this.sr!==a&&(this.sr=a)}},commentMargin:{get:function(){return this.rr},set:function(a){this.rr!==a&&(this.rr=a)}},setsPortSpot:{get:function(){return this.Vs},set:function(a){this.Vs!==a&&(this.Vs=a)}},portSpot:{get:function(){return this.Es},set:function(a){this.Es.w(a)||(this.Es=a)}},setsChildPortSpot:{
get:function(){return this.Us},set:function(a){this.Us!==a&&(this.Us=a)}},childPortSpot:{get:function(){return this.nr},set:function(a){this.nr.w(a)||(this.nr=a)}},childrenCount:{get:function(){return this.children.length}},relativePosition:{get:function(){return this.S},set:function(a){this.S.set(a)}},subtreeSize:{get:function(){return this.ta},set:function(a){this.ta.set(a)}},
subtreeOffset:{get:function(){return this.da},set:function(a){this.da.set(a)}}});et.className="TreeVertex";function ku(a){Tp.call(this,a);this.Xu=new I(0,0)}la(ku,Tp);
ku.prototype.commit=function(){var a=this.link;if(null!==a&&!a.isAvoiding){var b=this.network.layout,c=null,d=null;switch(b.$c){case $s:c=this.fromVertex;d=this.toVertex;break;case gt:c=this.toVertex;d=this.fromVertex;break;default:B("Unhandled path value "+b.$c.toString())}if(null!==c&&null!==d)if(b=this.Xu,0!==b.x||0!==b.y||c.xA){d=c.bounds;var e=It(c),f=Kt(c),g=c.rowSpacing;a.kj();var h=a.curve===dg,k=a.isOrthogonal,l;a.Mh();if(k||h){for(l=2;4<a.pointsCount;)a.gw(2);var m=a.i(1);var n=a.i(2)}else{for(l=
1;3<a.pointsCount;)a.gw(1);m=a.i(0);n=a.i(a.pointsCount-1)}var p=a.i(a.pointsCount-1);0===e?(c.alignment===Jt?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-Qt(c))))):c.alignment===Rt?(e=d.top+b.y,0===b.y&&m.y<p.y-c.rowIndent&&(e=Math.max(e,Math.min(m.y,e+Qt(c))))):e=c.Gm||c.Hm&&1===c.maxGenerationCount?d.top-c.da.y+b.y:d.y+d.height/2+b.y,h?(a.m(l,m.x,e),l++,a.m(l,d.right+f,e),l++,a.m(l,d.right+f+(b.x-g)/3,e),l++,a.m(l,d.right+f+2*(b.x-g)/3,e),l++,a.m(l,d.right+f+(b.x-
g),e),l++,a.m(l,n.x,e)):(k&&(a.m(l,d.right+f/2,m.y),l++),a.m(l,d.right+f/2,e),l++,a.m(l,d.right+f+b.x-(k?g/2:g),e),l++,k&&a.m(l,a.i(l-1).x,n.y))):90===e?(c.alignment===Jt?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-Qt(c))))):c.alignment===Rt?(e=d.left+b.x,0===b.x&&m.x<p.x-c.rowIndent&&(e=Math.max(e,Math.min(m.x,e+Qt(c))))):e=c.Gm||c.Hm&&1===c.maxGenerationCount?d.left-c.da.x+b.x:d.x+d.width/2+b.x,h?(a.m(l,e,m.y),l++,a.m(l,e,d.bottom+f),l++,a.m(l,e,d.bottom+f+(b.y-g)/
3),l++,a.m(l,e,d.bottom+f+2*(b.y-g)/3),l++,a.m(l,e,d.bottom+f+(b.y-g)),l++,a.m(l,e,n.y)):(k&&(a.m(l,m.x,d.bottom+f/2),l++),a.m(l,e,d.bottom+f/2),l++,a.m(l,e,d.bottom+f+b.y-(k?g/2:g)),l++,k&&a.m(l,n.x,a.i(l-1).y))):180===e?(c.alignment===Jt?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-Qt(c))))):c.alignment===Rt?(e=d.top+b.y,0===b.y&&m.y<p.y-c.rowIndent&&(e=Math.max(e,Math.min(m.y,e+Qt(c))))):e=c.Gm||c.Hm&&1===c.maxGenerationCount?d.top-c.da.y+b.y:d.y+d.height/2+b.y,h?
(a.m(l,m.x,e),l++,a.m(l,d.left-f,e),l++,a.m(l,d.left-f+(b.x+g)/3,e),l++,a.m(l,d.left-f+2*(b.x+g)/3,e),l++,a.m(l,d.left-f+(b.x+g),e),l++,a.m(l,n.x,e)):(k&&(a.m(l,d.left-f/2,m.y),l++),a.m(l,d.left-f/2,e),l++,a.m(l,d.left-f+b.x+(k?g/2:g),e),l++,k&&a.m(l,a.i(l-1).x,n.y))):270===e?(c.alignment===Jt?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-Qt(c))))):c.alignment===Rt?(e=d.left+b.x,0===b.x&&m.x<p.x-c.rowIndent&&(e=Math.max(e,Math.min(m.x,e+Qt(c))))):e=c.Gm||c.Hm&&1===c.maxGenerationCount?
d.left-c.da.x+b.x:d.x+d.width/2+b.x,h?(a.m(l,e,m.y),l++,a.m(l,e,d.top-f),l++,a.m(l,e,d.top-f+(b.y+g)/3),l++,a.m(l,e,d.top-f+2*(b.y+g)/3),l++,a.m(l,e,d.top-f+(b.y+g)),l++,a.m(l,e,n.y)):(k&&(a.m(l,m.x,d.top-f/2),l++),a.m(l,e,d.top-f/2),l++,a.m(l,e,d.top-f+b.y+(k?g/2:g)),l++,k&&a.m(l,n.x,a.i(l-1).y))):B("Invalid angle "+e);a.rf()}else a=this.link,f=It(c),f!==It(d)&&(g=Kt(c),h=c.bounds,c=d.bounds,0===f&&c.left-h.right<g+1||90===f&&c.top-h.bottom<g+1||180===f&&h.left-c.right<g+1||270===f&&h.top-c.bottom<
g+1||(a.kj(),c=a.curve===dg,b=a.isOrthogonal,d=zt(this.fromVertex.alignment),a.Mh(),0===f?(f=h.right+g/2,c?4===a.pointsCount&&(c=a.i(3).y,a.K(1,f-20,a.i(1).y),a.m(2,f-20,c),a.m(3,f,c),a.m(4,f+20,c),a.K(5,a.i(5).x,c)):b?d?a.K(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.K(2,f,a.i(2).y),a.K(3,f,a.i(3).y)):4===a.pointsCount?a.m(2,f,a.i(2).y):3===a.pointsCount?a.K(1,f,a.i(2).y):2===a.pointsCount&&a.m(1,f,a.i(1).y)):90===f?(f=h.bottom+g/2,c?4===a.pointsCount&&(c=a.i(3).x,a.K(1,a.i(1).x,f-20),a.m(2,c,f-20),
a.m(3,c,f),a.m(4,c,f+20),a.K(5,c,a.i(5).y)):b?d?a.K(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.K(2,a.i(2).x,f),a.K(3,a.i(3).x,f)):4===a.pointsCount?a.m(2,a.i(2).x,f):3===a.pointsCount?a.K(1,a.i(2).x,f):2===a.pointsCount&&a.m(1,a.i(1).x,f)):180===f?(f=h.left-g/2,c?4===a.pointsCount&&(c=a.i(3).y,a.K(1,f+20,a.i(1).y),a.m(2,f+20,c),a.m(3,f,c),a.m(4,f-20,c),a.K(5,a.i(5).x,c)):b?d?a.K(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.K(2,f,a.i(2).y),a.K(3,f,a.i(3).y)):4===a.pointsCount?a.m(2,f,a.i(2).y):3===a.pointsCount?
a.K(1,f,a.i(2).y):2===a.pointsCount&&a.m(1,f,a.i(1).y)):270===f&&(f=h.top-g/2,c?4===a.pointsCount&&(c=a.i(3).x,a.K(1,a.i(1).x,f+20),a.m(2,c,f+20),a.m(3,c,f),a.m(4,c,f-20),a.K(5,c,a.i(5).y)):b?d?a.K(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.K(2,a.i(2).x,f),a.K(3,a.i(3).x,f)):4===a.pointsCount?a.m(2,a.i(2).x,f):3===a.pointsCount?a.K(1,a.i(2).x,f):2===a.pointsCount&&a.m(1,a.i(1).x,f)),a.rf()))}};
ma.Object.defineProperties(ku.prototype,{relativePoint:{get:function(){return this.Xu},set:function(a){this.Xu.set(a)}}});ku.className="TreeEdge";
Oa.prototype.initializeStandardTools=function(){this.Wa("Action",new Cg,this.mouseDownTools);this.Wa("Relinking",new bf,this.mouseDownTools);this.Wa("LinkReshaping",new bg,this.mouseDownTools);this.Wa("Rotating",new Ag,this.mouseDownTools);this.Wa("Resizing",new tg,this.mouseDownTools);this.Wa("Linking",new Vf,this.mouseMoveTools);this.Wa("Dragging",new Re,this.mouseMoveTools);this.Wa("DragSelecting",new Fg,this.mouseMoveTools);this.Wa("Panning",new Gg,this.mouseMoveTools);this.Wa("ContextMenu",new Ig,
this.mouseUpTools);this.Wa("TextEditing",new Tg,this.mouseUpTools);this.Wa("ClickCreating",new Dg,this.mouseUpTools);this.Wa("ClickSelecting",new Bg,this.mouseUpTools)};sn("Horizontal",new ym);sn("Spot",new Am);sn("Table",new Em);sn("Viewbox",new Jm);sn("TableRow",new Hm);sn("TableColumn",new Im);sn("Graduated",new Tm);sn("Grid",new Km);si.add("GraphLinksModel",rq);si.add("TreeModel",Fq);
var lu=x.go,mu={get licenseKey(){return Q.licenseKey},set licenseKey(a){Q.licenseKey=a},get version(){return Q.version},Group:uf,EnumValue:D,List:E,Set:F,Map:H,Point:I,Size:M,Rect:N,Margin:oc,Spot:P,Geometry:sd,PathFigure:ge,PathSegment:oe,InputEvent:qe,DiagramEvent:se,ChangedEvent:te,Model:Z,GraphLinksModel:ar,TreeModel:fr,Binding:Mi,Transaction:ye,UndoManager:ze,CommandHandler:Sk,Tool:Be,DraggingTool:Re,DraggingInfo:cf,DraggingOptions:Se,LinkingBaseTool:Kf,LinkingTool:Vf,RelinkingTool:bf,LinkReshapingTool:bg,
ResizingTool:tg,RotatingTool:Ag,ClickSelectingTool:Bg,ActionTool:Cg,ClickCreatingTool:Dg,HTMLInfo:Pe,ContextMenuTool:Ig,DragSelectingTool:Fg,PanningTool:Gg,TextEditingTool:Tg,ToolManager:Oa,Animation:Ah,AnimationManager:kh,AnimationTrigger:ci,Layer:hi,Diagram:Q,Palette:Kk,Overview:Nk,Brush:ul,GraphObject:Y,Panel:X,RowColumnDefinition:Uj,Shape:W,TextBlock:Ug,TextBlockMetrics:jo,Picture:mk,Part:T,Adornment:Ke,Node:V,Link:S,Placeholder:vg,Layout:Fi,LayoutNetwork:Pp,LayoutVertex:Sp,LayoutEdge:Tp,GridLayout:Mk,
PanelLayout:Pl,CircularLayout:gr,CircularNetwork:yr,CircularVertex:Lr,CircularEdge:Mr,ForceDirectedLayout:Nr,ForceDirectedNetwork:Or,ForceDirectedVertex:$r,ForceDirectedEdge:as,LayeredDigraphLayout:bs,LayeredDigraphNetwork:gs,LayeredDigraphVertex:Ws,LayeredDigraphEdge:Xs,TreeLayout:Ys,TreeNetwork:dt,TreeVertex:et,TreeEdge:ku};
"object"===typeof lu&&lu.version&&B("WARNING: a `go` object on the root object is already defined.  "+("Debug"in lu?"debug ":"")+"version: "+lu.version+", replaced with version: "+mu.version);Q.prototype.go=mu;x.go=mu;("undefined"===typeof x||"undefined"===typeof x.module||"object"!==typeof x.module.exports)&&x.define&&"function"===typeof x.define&&x.define.amd&&x.define(mu); 'undefined'!==typeof module&&'object'===typeof module.exports&&(module.exports='undefined'!==typeof global?global.go:self.go); })();
