/*
 * GoJS v2.2.0 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-2022 by Northwoods Software Corporation.  All Rights Reserved.
 * THIS SOFTWARE IS LICENSED.  THE LICENSE AGREEMENT IS AT: https://gojs.net/2.2.0/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},ka={};try{ka.__proto__=ia;ha=ka.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 la=fa;
function ma(a,b){a.prototype=ea(b.prototype);a.prototype.constructor=a;if(la)la(a,b);else for(var c in b)if("prototype"!=c)if(Object.defineProperties){var d=Object.getOwnPropertyDescriptor(b,c);d&&Object.defineProperty(a,c,d)}else a[c]=b[c];a.oB=b.prototype}
var na="undefined"!=typeof global&&null!=global?global:self,oa="function"==typeof Object.assign?Object.assign:function(a,b){for(var c=1;c<arguments.length;c++){var d=arguments[c];if(d)for(var e in d)Object.prototype.hasOwnProperty.call(d,e)&&(a[e]=d[e])}return a},qa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};
function ra(a,b){if(b){var c=na;a=a.split(".");for(var d=0;d<a.length-1;d++){var e=a[d];e in c||(c[e]={});c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&qa(c,a,{writable:!0,value:b})}}ra("Object.assign",function(a){return a||oa});ra("Array.prototype.fill",function(a){return a?a:function(a,c,d){var b=this.length||0;0>c&&(c=Math.max(0,b+c));if(null==d||d>b)d=b;d=Number(d);0>d&&(d=Math.max(0,b+d));for(c=Number(c||0);c<d;c++)this[c]=a;return this}});var x="object"===typeof globalThis&&globalThis||"object"===typeof global&&global.global===global&&global||"object"===typeof self&&self.self===self&&self||{};void 0===x.requestAnimationFrame&&(void 0===x.setImmediate?x.requestAnimationFrame=function(a){x.setTimeout(a,0)}:x.requestAnimationFrame=x.setImmediate);function sa(){}function ta(a,b){var c=-1;return function(){var d=this,e=arguments;-1!==c&&x.clearTimeout(c);c=ua(function(){c=-1;a.apply(d,e)},b)}}function ua(a,b){return x.setTimeout(a,b)}
function va(a){return x.document.createElement(a)}function B(a){throw Error(a);}function wa(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 xa(a,b,c,d){c=null===c?"*":"string"===typeof c?c:"function"===typeof c&&"string"===typeof c.className?c.className:"";void 0!==d&&(c+="."+d);B(c+" is not in the range "+b+": "+a)}function ya(a){x.console&&x.console.log(a)}function za(a){return"object"===typeof a&&null!==a}
function Aa(a){return Array.isArray(a)||x.NodeList&&a instanceof x.NodeList||x.HTMLCollection&&a instanceof x.HTMLCollection}function Ba(a){return Array.prototype.slice.call(a)}function Ca(a,b,c){Array.isArray(a)?b>=a.length?a.push(c):a.splice(b,0,c):B("Cannot insert an object into an HTMLCollection or NodeList: "+c+" at "+b)}function Da(a,b){Array.isArray(a)?b>=a.length?a.pop():a.splice(b,1):B("Cannot remove an object from an HTMLCollection or NodeList at "+b)}
function Ea(){var a=Fa.pop();return void 0===a?[]:a}function Ia(a){a.length=0;Fa.push(a)}function Ja(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 Ja(a.constructor);return typeof a}
function Ka(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 La(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.aB;if(c&&c[b])return!0;a=Object.getPrototypeOf(a)}return!1}
function Ma(a,b,c){Object.defineProperty(Pa.prototype,a,{get:b,set:c})}
function Qa(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 Ra=void 0!==x.navigator&&0<x.navigator.userAgent.indexOf("Trident/7"),Sa=void 0!==x.navigator&&0<x.navigator.userAgent.indexOf("Edge/"),Ta=void 0!==x.navigator&&void 0!==x.navigator.platform&&0<=x.navigator.platform.toUpperCase().indexOf("MAC"),Ua=void 0!==x.navigator&&void 0!==x.navigator.platform&&null!==x.navigator.platform.match(/(iPhone|iPod|iPad)/i),Fa=[];Object.freeze([]);sa.className="Util";sa.Dx="32ab5ff3b26f42dc0ed90f21462913b5";sa.adym="gojs.net";sa.vfo="28e644fdb3";sa.className="Util";
function D(a,b,c){Va(this);this.j=a;this.na=b;this.o=c}D.prototype.toString=function(){return"EnumValue."+this.na};function Wa(a,b){return void 0===b||null===b||""===b?null:a[b]}na.Object.defineProperties(D.prototype,{classType:{get:function(){return this.j}},name:{get:function(){return this.na}},value:{get:function(){return this.o}}});D.className="EnumValue";function Xa(){this.Gw=[]}Xa.prototype.toString=function(){return this.Gw.join("")};
Xa.prototype.add=function(a){""!==a&&this.Gw.push(a)};Xa.className="StringBuilder";function Ya(){}Ya.className="PropertyCollection";
var Za={cB:!1,hB:!1,eB:!1,gB:!1,mB:!1,kB:!1,Ox:!1,dB:null,trace:function(a){x.console&&x.console.log(a)},fB:function(a,b,c,d){a.strokeStyle="red";a.fillStyle="red";a.font="8px sans-serif";a.beginPath();a.moveTo(-10,0);a.lineTo(10,0);a.moveTo(0,-10);a.lineTo(0,10);a.stroke();a.setTransform(1,0,0,1,0,0);a.scale(c,c);a.transform(b.m11,b.m12,b.m21,b.m22,b.dx,b.dy);a.lineWidth=2;a.beginPath();a.moveTo(d.left,d.top+20);a.lineTo(d.left,d.top);a.lineTo(d.left+20,d.top);a.moveTo(d.right,d.bottom-20);a.lineTo(d.right,
d.bottom);a.lineTo(d.right-20,d.bottom);a.stroke();a.fillText("DB: "+Math.round(d.x)+", "+Math.round(d.y)+", "+Math.round(d.width)+", "+Math.round(d.height),d.left,d.top-5)},bB:function(a){var b={},c;for(c in a){b.x=c;if("licenseKey"!==b.x){var d=a[b.x];if(void 0!==d.prototype){b.km=Object.getOwnPropertyNames(d.prototype);for(var e={bk:0};e.bk<b.km.length;e={bk:e.bk},e.bk++){var f=Object.getOwnPropertyDescriptor(d.prototype,b.km[e.bk]);void 0!==f.get&&void 0===f.set&&Object.defineProperty(d.prototype,
b.km[e.bk],{set:function(a,b){return function(){throw Error("Property "+a.km[b.bk]+" of "+a.x+" is read-only.");}}(b,e)})}}}b={km:b.km,x:b.x}}}};function $a(){}$a.prototype.reset=function(){};$a.prototype.next=function(){return!1};$a.prototype.qd=function(){return!1};$a.prototype.first=function(){return null};$a.prototype.any=function(){return!1};$a.prototype.all=function(){return!0};$a.prototype.each=function(){return this};$a.prototype.map=function(){return this};$a.prototype.filter=function(){return this};
$a.prototype.Ud=function(){};$a.prototype.toString=function(){return"EmptyIterator"};na.Object.defineProperties($a.prototype,{iterator:{get:function(){return this}},count:{get:function(){return 0}}});$a.prototype.first=$a.prototype.first;$a.prototype.hasNext=$a.prototype.qd;$a.prototype.next=$a.prototype.next;$a.prototype.reset=$a.prototype.reset;var ab=null;$a.className="EmptyIterator";ab=new $a;function bb(a){this.key=-1;this.value=a}
bb.prototype.reset=function(){this.key=-1};bb.prototype.next=function(){return-1===this.key?(this.key=0,!0):!1};bb.prototype.qd=function(){return this.next()};bb.prototype.first=function(){this.key=0;return this.value};bb.prototype.any=function(a){this.key=-1;return a(this.value)};bb.prototype.all=function(a){this.key=-1;return a(this.value)};bb.prototype.each=function(a){this.key=-1;a(this.value);return this};bb.prototype.map=function(a){return new bb(a(this.value))};
bb.prototype.filter=function(a){return a(this.value)?new bb(this.value):ab};bb.prototype.Ud=function(){this.value=null};bb.prototype.toString=function(){return"SingletonIterator("+this.value+")"};na.Object.defineProperties(bb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return 1}}});bb.prototype.first=bb.prototype.first;bb.prototype.hasNext=bb.prototype.qd;bb.prototype.next=bb.prototype.next;
bb.prototype.reset=bb.prototype.reset;bb.className="SingletonIterator";function db(a){this.qb=a;this.ef=null;a.Ja=null;this.ia=a.Da;this.Ra=-1}db.prototype.reset=function(){var a=this.qb;a.Ja=null;this.ia=a.Da;this.Ra=-1};db.prototype.next=function(){var a=this.qb;if(a.Da!==this.ia&&0>this.key)return!1;a=a.l;var b=a.length,c=++this.Ra,d=this.ef;if(null!==d)for(;c<b;){var e=a[c];if(d(e))return this.key=this.Ra=c,this.value=e,!0;c++}else{if(c<b)return this.key=c,this.value=a[c],!0;this.Ud()}return!1};
db.prototype.qd=function(){return this.next()};db.prototype.first=function(){var a=this.qb;this.ia=a.Da;this.Ra=0;a=a.l;var b=a.length,c=this.ef;if(null!==c){for(var d=0;d<b;){var e=a[d];if(c(e))return this.key=this.Ra=d,this.value=e;d++}return null}return 0<b?(a=a[0],this.key=0,this.value=a):null};db.prototype.any=function(a){var b=this.qb;b.Ja=null;this.Ra=-1;b=b.l;for(var c=b.length,d=this.ef,e=0;e<c;e++){var f=b[e];if((null===d||d(f))&&a(f))return!0}return!1};
db.prototype.all=function(a){var b=this.qb;b.Ja=null;this.Ra=-1;b=b.l;for(var c=b.length,d=this.ef,e=0;e<c;e++){var f=b[e];if((null===d||d(f))&&!a(f))return!1}return!0};db.prototype.each=function(a){var b=this.qb;b.Ja=null;this.Ra=-1;b=b.l;for(var c=b.length,d=this.ef,e=0;e<c;e++){var f=b[e];(null===d||d(f))&&a(f)}return this};
db.prototype.map=function(a){var b=this.qb;b.Ja=null;this.Ra=-1;var c=[];b=b.l;for(var d=b.length,e=this.ef,f=0;f<d;f++){var g=b[f];(null===e||e(g))&&c.push(a(g))}a=new E;a.l=c;a.lb();return a.iterator};db.prototype.filter=function(a){var b=this.qb;b.Ja=null;this.Ra=-1;var c=[];b=b.l;for(var d=b.length,e=this.ef,f=0;f<d;f++){var g=b[f];(null===e||e(g))&&a(g)&&c.push(g)}a=new E;a.l=c;a.lb();return a.iterator};
db.prototype.Ud=function(){this.key=-1;this.value=null;this.ia=-1;this.ef=null;this.qb.Ja=this};db.prototype.toString=function(){return"ListIterator@"+this.Ra+"/"+this.qb.count};
na.Object.defineProperties(db.prototype,{iterator:{get:function(){return this}},predicate:{get:function(){return this.ef},set:function(a){this.ef=a}},count:{get:function(){var a=this.ef;if(null!==a){for(var b=0,c=this.qb.l,d=c.length,e=0;e<d;e++)a(c[e])&&b++;return b}return this.qb.l.length}}});db.prototype.first=db.prototype.first;db.prototype.hasNext=db.prototype.qd;db.prototype.next=db.prototype.next;
db.prototype.reset=db.prototype.reset;db.className="ListIterator";function eb(a){this.qb=a;a.Tg=null;this.ia=a.Da;this.Ra=a.l.length}eb.prototype.reset=function(){var a=this.qb;a.Tg=null;this.ia=a.Da;this.Ra=a.l.length};eb.prototype.next=function(){var a=this.qb;if(a.Da!==this.ia&&0>this.key)return!1;var b=--this.Ra;if(0<=b)return this.key=b,this.value=a.l[b],!0;this.Ud();return!1};eb.prototype.qd=function(){return this.next()};
eb.prototype.first=function(){var a=this.qb;this.ia=a.Da;var b=a.l;this.Ra=a=b.length-1;return 0<=a?(b=b[a],this.key=a,this.value=b):null};eb.prototype.any=function(a){var b=this.qb;b.Tg=null;b=b.l;var c=b.length;this.Ra=c;for(--c;0<=c;c--)if(a(b[c]))return!0;return!1};eb.prototype.all=function(a){var b=this.qb;b.Tg=null;b=b.l;var c=b.length;this.Ra=c;for(--c;0<=c;c--)if(!a(b[c]))return!1;return!0};
eb.prototype.each=function(a){var b=this.qb;b.Tg=null;b=b.l;var c=b.length;this.Ra=c;for(--c;0<=c;c--)a(b[c]);return this};eb.prototype.map=function(a){var b=this.qb;b.Tg=null;var c=[];b=b.l;var d=b.length;this.Ra=d;for(--d;0<=d;d--)c.push(a(b[d]));a=new E;a.l=c;a.lb();return a.iterator};eb.prototype.filter=function(a){var b=this.qb;b.Tg=null;var c=[];b=b.l;var d=b.length;this.Ra=d;for(--d;0<=d;d--){var e=b[d];a(e)&&c.push(e)}a=new E;a.l=c;a.lb();return a.iterator};
eb.prototype.Ud=function(){this.key=-1;this.value=null;this.ia=-1;this.qb.Tg=this};eb.prototype.toString=function(){return"ListIteratorBackwards("+this.Ra+"/"+this.qb.count+")"};na.Object.defineProperties(eb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.qb.l.length}}});eb.prototype.first=eb.prototype.first;eb.prototype.hasNext=eb.prototype.qd;eb.prototype.next=eb.prototype.next;eb.prototype.reset=eb.prototype.reset;
eb.className="ListIteratorBackwards";function E(a){Va(this);this.v=!1;this.l=[];this.Da=0;this.Tg=this.Ja=null;"string"===typeof a&&B("Error: Since 2.0 List/Map/Set constructors no longer take an argument that enforces type.");void 0!==a&&this.addAll(a)}t=E.prototype;t.lb=function(){var a=this.Da;a++;999999999<a&&(a=0);this.Da=a};t.freeze=function(){this.v=!0;return this};t.ea=function(){this.v=!1;return this};t.toString=function(){return"List()#"+ib(this)};
t.add=function(a){if(null===a)return this;this.v&&wa(this,a);this.l.push(a);this.lb();return this};t.push=function(a){this.add(a)};t.addAll=function(a){if(null===a)return this;this.v&&wa(this);var b=this.l;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.v&&wa(this);this.l.length=0;this.lb()};t.contains=function(a){return null===a?!1:-1!==this.l.indexOf(a)};t.has=function(a){return this.contains(a)};
t.indexOf=function(a){return null===a?-1:this.l.indexOf(a)};t.J=function(a){var b=this.l;(0>a||a>=b.length)&&xa(a,"0 <= i < length",E,"elt:i");return b[a]};t.get=function(a){return this.J(a)};t.Pc=function(a,b){var c=this.l;(0>a||a>=c.length)&&xa(a,"0 <= i < length",E,"setElt:i");this.v&&wa(this,a);c[a]=b};t.set=function(a,b){this.Pc(a,b)};t.first=function(){var a=this.l;return 0===a.length?null:a[0]};t.$b=function(){var a=this.l,b=a.length;return 0<b?a[b-1]:null};
t.pop=function(){this.v&&wa(this);var a=this.l;return 0<a.length?a.pop():null};E.prototype.any=function(a){for(var b=this.l,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.l,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.l,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.l,e=d.length,f=0;f<e;f++)c.push(a(d[f]));b.l=c;b.lb();return b};
E.prototype.filter=function(a){for(var b=new E,c=[],d=this.l,e=d.length,f=0;f<e;f++){var g=d[f];a(g)&&c.push(g)}b.l=c;b.lb();return b};t=E.prototype;t.vb=function(a,b){0>a&&xa(a,">= 0",E,"insertAt:i");this.v&&wa(this,a);var c=this.l;a>=c.length?c.push(b):c.splice(a,0,b);this.lb()};t.remove=function(a){if(null===a)return!1;this.v&&wa(this,a);var b=this.l;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.eb=function(a){var b=this.l;(0>a||a>=b.length)&&xa(a,"0 <= i < length",E,"removeAt:i");this.v&&wa(this,a);a===b.length-1?b.pop():b.splice(a,1);this.lb()};t.removeRange=function(a,b){var c=this.l,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.v&&wa(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.l;0<b.length&&(a.l=Array.prototype.slice.call(b));return a};
t=E.prototype;t.ya=function(){for(var a=this.l,b=this.count,c=Array(b),d=0;d<b;d++)c[d]=a[d];return c};t.Yv=function(){for(var a=new G,b=this.l,c=this.count,d=0;d<c;d++)a.add(b[d]);return a};t.sort=function(a){this.v&&wa(this);this.l.sort(a);this.lb();return this};
t.Vi=function(a,b,c){var d=this.l,e=d.length;void 0===b&&(b=0);void 0===c&&(c=e);this.v&&wa(this);var f=c-b;if(1>=f)return this;(0>b||b>=e-1)&&xa(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.v&&wa(this);this.l.reverse();this.lb();return this};
na.Object.defineProperties(E.prototype,{_dataArray:{get:function(){return this.l}},count:{get:function(){return this.l.length}},size:{get:function(){return this.l.length}},length:{get:function(){return this.l.length}},iterator:{get:function(){if(0>=this.l.length)return ab;var a=this.Ja;return null!==a?(a.reset(),a):new db(this)}},iteratorBackwards:{
get:function(){if(0>=this.l.length)return ab;var a=this.Tg;return null!==a?(a.reset(),a):new eb(this)}}});E.prototype.reverse=E.prototype.reverse;E.prototype.sortRange=E.prototype.Vi;E.prototype.sort=E.prototype.sort;E.prototype.toSet=E.prototype.Yv;E.prototype.toArray=E.prototype.ya;E.prototype.removeRange=E.prototype.removeRange;E.prototype.removeAt=E.prototype.eb;E.prototype["delete"]=E.prototype.delete;E.prototype.remove=E.prototype.remove;E.prototype.insertAt=E.prototype.vb;
E.prototype.pop=E.prototype.pop;E.prototype.last=E.prototype.$b;E.prototype.first=E.prototype.first;E.prototype.set=E.prototype.set;E.prototype.setElt=E.prototype.Pc;E.prototype.get=E.prototype.get;E.prototype.elt=E.prototype.J;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 jb(a){this.gg=a;a.Ja=null;this.ia=a.Da;this.ka=null}jb.prototype.reset=function(){var a=this.gg;a.Ja=null;this.ia=a.Da;this.ka=null};jb.prototype.next=function(){var a=this.gg;if(a.Da!==this.ia&&null===this.key)return!1;var b=this.ka;b=null===b?a.ba:b.oa;if(null!==b)return this.ka=b,this.value=b.value,this.key=b.key,!0;this.Ud();return!1};jb.prototype.qd=function(){return this.next()};
jb.prototype.first=function(){var a=this.gg;this.ia=a.Da;a=a.ba;if(null!==a){this.ka=a;var b=a.value;this.key=a.key;return this.value=b}return null};jb.prototype.any=function(a){var b=this.gg;this.ka=b.Ja=null;for(b=b.ba;null!==b;){if(a(b.value))return!0;b=b.oa}return!1};jb.prototype.all=function(a){var b=this.gg;this.ka=b.Ja=null;for(b=b.ba;null!==b;){if(!a(b.value))return!1;b=b.oa}return!0};jb.prototype.each=function(a){var b=this.gg;this.ka=b.Ja=null;for(b=b.ba;null!==b;)a(b.value),b=b.oa;return this};
jb.prototype.map=function(a){var b=this.gg;b.Ja=null;var c=new E;for(b=b.ba;null!==b;)c.add(a(b.value)),b=b.oa;return c.iterator};jb.prototype.filter=function(a){var b=this.gg;b.Ja=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};jb.prototype.Ud=function(){this.value=this.key=null;this.ia=-1;this.gg.Ja=this};jb.prototype.toString=function(){return null!==this.ka?"SetIterator@"+this.ka.value:"SetIterator"};
na.Object.defineProperties(jb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.gg.Ib}}});jb.prototype.first=jb.prototype.first;jb.prototype.hasNext=jb.prototype.qd;jb.prototype.next=jb.prototype.next;jb.prototype.reset=jb.prototype.reset;jb.className="SetIterator";
function G(a){Va(this);this.v=!1;this.Jb={};this.Ib=0;this.Ja=null;this.Da=0;this.$e=this.ba=null;"string"===typeof a&&B("Error: Since 2.0 List/Map/Set constructors no longer take an argument that enforces type.");void 0!==a&&this.addAll(a)}t=G.prototype;t.lb=function(){var a=this.Da;a++;999999999<a&&(a=0);this.Da=a};t.freeze=function(){this.v=!0;return this};t.ea=function(){this.v=!1;return this};t.toString=function(){return"Set()#"+ib(this)};
t.add=function(a){if(null===a)return this;this.v&&wa(this,a);var b=a;za(a)&&(b=kb(a));void 0===this.Jb[b]&&(this.Ib++,a=new lb(a,a),this.Jb[b]=a,b=this.$e,null===b?this.ba=a:(a.xl=b,b.oa=a),this.$e=a,this.lb());return this};t.addAll=function(a){if(null===a)return this;this.v&&wa(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=ib(a),void 0===b)?!1:void 0!==this.Jb[b]};t.has=function(a){return this.contains(a)};t.oz=function(a){if(null===a)return!0;for(a=a.iterator;a.next();)if(!this.contains(a.value))return!1;return!0};t.pz=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};
G.prototype.any=function(a){for(var b=this.ba;null!==b;){if(a(b.value))return!0;b=b.oa}return!1};G.prototype.all=function(a){for(var b=this.ba;null!==b;){if(!a(b.value))return!1;b=b.oa}return!0};G.prototype.each=function(a){for(var b=this.ba;null!==b;)a(b.value),b=b.oa;return this};G.prototype.map=function(a){for(var b=new G,c=this.ba;null!==c;)b.add(a(c.value)),c=c.oa;return b};G.prototype.filter=function(a){for(var b=new G,c=this.ba;null!==c;){var d=c.value;a(d)&&b.add(d);c=c.oa}return b};t=G.prototype;
t.remove=function(a){if(null===a)return!1;this.v&&wa(this,a);var b=a;if(za(a)&&(b=ib(a),void 0===b))return!1;a=this.Jb[b];if(void 0===a)return!1;var c=a.oa,d=a.xl;null!==c&&(c.xl=d);null!==d&&(d.oa=c);this.ba===a&&(this.ba=c);this.$e===a&&(this.$e=d);delete this.Jb[b];this.Ib--;this.lb();return!0};t.delete=function(a){return this.remove(a)};
t.pq=function(a){if(null===a)return this;this.v&&wa(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.LA=function(a){if(null===a||0===this.count)return this;this.v&&wa(this);var b=new G;b.addAll(a);a=[];for(var c=this.iterator;c.next();){var d=c.value;b.contains(d)||a.push(d)}this.pq(a);return this};t.clear=function(){this.v&&wa(this);this.Jb={};this.Ib=0;null!==this.Ja&&this.Ja.reset();this.$e=this.ba=null;this.lb()};
G.prototype.copy=function(){var a=new G,b=this.Jb,c;for(c in b)a.add(b[c].value);return a};G.prototype.ya=function(){var a=Array(this.Ib),b=this.Jb,c=0,d;for(d in b)a[c]=b[d].value,c++;return a};G.prototype.Xv=function(){var a=new E,b=this.Jb,c;for(c in b)a.add(b[c].value);return a};function Va(a){a.__gohashid=mb++}function kb(a){var b=a.__gohashid;void 0===b&&(b=mb++,a.__gohashid=b);return b}function ib(a){return a.__gohashid}
na.Object.defineProperties(G.prototype,{count:{get:function(){return this.Ib}},size:{get:function(){return this.Ib}},iterator:{get:function(){if(0>=this.Ib)return ab;var a=this.Ja;return null!==a?(a.reset(),a):new jb(this)}}});G.prototype.toList=G.prototype.Xv;G.prototype.toArray=G.prototype.ya;G.prototype.clear=G.prototype.clear;G.prototype.retainAll=G.prototype.LA;G.prototype.removeAll=G.prototype.pq;
G.prototype["delete"]=G.prototype.delete;G.prototype.remove=G.prototype.remove;G.prototype.first=G.prototype.first;G.prototype.containsAny=G.prototype.pz;G.prototype.containsAll=G.prototype.oz;G.prototype.has=G.prototype.has;G.prototype.contains=G.prototype.contains;G.prototype.addAll=G.prototype.addAll;G.prototype.add=G.prototype.add;G.prototype.thaw=G.prototype.ea;G.prototype.freeze=G.prototype.freeze;var mb=1;G.className="Set";G.uniqueHash=Va;G.hashIdUnique=kb;G.hashId=ib;
function nb(a){this.ga=a;this.ia=a.Da;this.ka=null}nb.prototype.reset=function(){this.ia=this.ga.Da;this.ka=null};nb.prototype.next=function(){var a=this.ga;if(a.Da!==this.ia&&null===this.key)return!1;var b=this.ka;b=null===b?a.ba:b.oa;if(null!==b)return this.ka=b,this.value=this.key=a=b.key,!0;this.Ud();return!1};nb.prototype.qd=function(){return this.next()};nb.prototype.first=function(){var a=this.ga;this.ia=a.Da;a=a.ba;return null!==a?(this.ka=a,this.value=this.key=a=a.key):null};
nb.prototype.any=function(a){var b=this.ga;this.ka=null;for(b=b.ba;null!==b;){if(a(b.key))return!0;b=b.oa}return!1};nb.prototype.all=function(a){var b=this.ga;this.ka=null;for(b=b.ba;null!==b;){if(!a(b.key))return!1;b=b.oa}return!0};nb.prototype.each=function(a){var b=this.ga;this.ka=null;for(b=b.ba;null!==b;)a(b.key),b=b.oa;return this};nb.prototype.map=function(a){var b=this.ga;this.ka=null;var c=new E;for(b=b.ba;null!==b;)c.add(a(b.key)),b=b.oa;return c.iterator};
nb.prototype.filter=function(a){var b=this.ga;this.ka=null;var c=new E;for(b=b.ba;null!==b;){var d=b.key;a(d)&&c.add(d);b=b.oa}return c.iterator};nb.prototype.Ud=function(){this.value=this.key=null;this.ia=-1};nb.prototype.toString=function(){return null!==this.ka?"MapKeySetIterator@"+this.ka.value:"MapKeySetIterator"};na.Object.defineProperties(nb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ga.Ib}}});
nb.prototype.first=nb.prototype.first;nb.prototype.hasNext=nb.prototype.qd;nb.prototype.next=nb.prototype.next;nb.prototype.reset=nb.prototype.reset;nb.className="MapKeySetIterator";function ob(a){G.call(this);Va(this);this.v=!0;this.ga=a}ma(ob,G);t=ob.prototype;t.freeze=function(){return this};t.ea=function(){return this};t.toString=function(){return"MapKeySet("+this.ga.toString()+")"};t.add=function(){B("This Set is read-only: "+this.toString())};t.contains=function(a){return this.ga.contains(a)};
t.has=function(a){return this.contains(a)};t.remove=function(){B("This Set is read-only: "+this.toString())};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.ga.ba;return null!==a?a.key:null};ob.prototype.any=function(a){for(var b=this.ga.ba;null!==b;){if(a(b.key))return!0;b=b.oa}return!1};ob.prototype.all=function(a){for(var b=this.ga.ba;null!==b;){if(!a(b.key))return!1;b=b.oa}return!0};
ob.prototype.each=function(a){for(var b=this.ga.ba;null!==b;)a(b.key),b=b.oa;return this};ob.prototype.map=function(a){for(var b=new G,c=this.ga.ba;null!==c;)b.add(a(c.key)),c=c.oa;return b};ob.prototype.filter=function(a){for(var b=new G,c=this.ga.ba;null!==c;){var d=c.key;a(d)&&b.add(d);c=c.oa}return b};ob.prototype.copy=function(){return new ob(this.ga)};ob.prototype.Yv=function(){var a=new G,b=this.ga.Jb,c;for(c in b)a.add(b[c].key);return a};
ob.prototype.ya=function(){var a=this.ga.Jb,b=Array(this.ga.Ib),c=0,d;for(d in a)b[c]=a[d].key,c++;return b};ob.prototype.Xv=function(){var a=new E,b=this.ga.Jb,c;for(c in b)a.add(b[c].key);return a};na.Object.defineProperties(ob.prototype,{count:{get:function(){return this.ga.Ib}},size:{get:function(){return this.ga.Ib}},iterator:{get:function(){return 0>=this.ga.Ib?ab:new nb(this.ga)}}});
ob.prototype.toList=ob.prototype.Xv;ob.prototype.toArray=ob.prototype.ya;ob.prototype.toSet=ob.prototype.Yv;ob.prototype.first=ob.prototype.first;ob.prototype.clear=ob.prototype.clear;ob.prototype["delete"]=ob.prototype.delete;ob.prototype.remove=ob.prototype.remove;ob.prototype.has=ob.prototype.has;ob.prototype.contains=ob.prototype.contains;ob.prototype.add=ob.prototype.add;ob.prototype.thaw=ob.prototype.ea;ob.prototype.freeze=ob.prototype.freeze;ob.className="MapKeySet";
function pb(a){this.ga=a;a.Ze=null;this.ia=a.Da;this.ka=null}pb.prototype.reset=function(){var a=this.ga;a.Ze=null;this.ia=a.Da;this.ka=null};pb.prototype.next=function(){var a=this.ga;if(a.Da!==this.ia&&null===this.key)return!1;var b=this.ka;b=null===b?a.ba:b.oa;if(null!==b)return this.ka=b,this.value=b.value,this.key=b.key,!0;this.Ud();return!1};pb.prototype.qd=function(){return this.next()};
pb.prototype.first=function(){var a=this.ga;this.ia=a.Da;a=a.ba;if(null!==a){this.ka=a;var b=a.value;this.key=a.key;return this.value=b}return null};pb.prototype.any=function(a){var b=this.ga;this.ka=b.Ze=null;for(b=b.ba;null!==b;){if(a(b.value))return!0;b=b.oa}return!1};pb.prototype.all=function(a){var b=this.ga;this.ka=b.Ze=null;for(b=b.ba;null!==b;){if(!a(b.value))return!1;b=b.oa}return!0};pb.prototype.each=function(a){var b=this.ga;this.ka=b.Ze=null;for(b=b.ba;null!==b;)a(b.value),b=b.oa;return this};
pb.prototype.map=function(a){var b=this.ga;this.ka=b.Ze=null;var c=new E;for(b=b.ba;null!==b;)c.add(a(b.value)),b=b.oa;return c.iterator};pb.prototype.filter=function(a){var b=this.ga;this.ka=b.Ze=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};pb.prototype.Ud=function(){this.value=this.key=null;this.ia=-1;this.ga.Ze=this};pb.prototype.toString=function(){return null!==this.ka?"MapValueSetIterator@"+this.ka.value:"MapValueSetIterator"};
na.Object.defineProperties(pb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ga.Ib}}});pb.prototype.first=pb.prototype.first;pb.prototype.hasNext=pb.prototype.qd;pb.prototype.next=pb.prototype.next;pb.prototype.reset=pb.prototype.reset;pb.className="MapValueSetIterator";function lb(a,b){this.key=a;this.value=b;this.xl=this.oa=null}lb.prototype.toString=function(){return"{"+this.key+":"+this.value+"}"};
lb.className="KeyValuePair";function qb(a){this.ga=a;a.Ja=null;this.ia=a.Da;this.ka=null}qb.prototype.reset=function(){var a=this.ga;a.Ja=null;this.ia=a.Da;this.ka=null};qb.prototype.next=function(){var a=this.ga;if(a.Da!==this.ia&&null===this.key)return!1;var b=this.ka;b=null===b?a.ba:b.oa;if(null!==b)return this.ka=b,this.key=b.key,this.value=b.value,!0;this.Ud();return!1};qb.prototype.qd=function(){return this.next()};
qb.prototype.first=function(){var a=this.ga;this.ia=a.Da;a=a.ba;return null!==a?(this.ka=a,this.key=a.key,this.value=a.value,a):null};qb.prototype.any=function(a){var b=this.ga;this.ka=b.Ja=null;for(b=b.ba;null!==b;){if(a(b))return!0;b=b.oa}return!1};qb.prototype.all=function(a){var b=this.ga;this.ka=b.Ja=null;for(b=b.ba;null!==b;){if(!a(b))return!1;b=b.oa}return!0};qb.prototype.each=function(a){var b=this.ga;this.ka=b.Ja=null;for(b=b.ba;null!==b;)a(b),b=b.oa;return this};
qb.prototype.map=function(a){var b=this.ga;this.ka=b.Ja=null;var c=new E;for(b=b.ba;null!==b;)c.add(a(b)),b=b.oa;return c.iterator};qb.prototype.filter=function(a){var b=this.ga;this.ka=b.Ja=null;var c=new E;for(b=b.ba;null!==b;)a(b)&&c.add(b),b=b.oa;return c.iterator};qb.prototype.Ud=function(){this.value=this.key=null;this.ia=-1;this.ga.Ja=this};qb.prototype.toString=function(){return null!==this.ka?"MapIterator@"+this.ka:"MapIterator"};
na.Object.defineProperties(qb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ga.Ib}}});qb.prototype.first=qb.prototype.first;qb.prototype.hasNext=qb.prototype.qd;qb.prototype.next=qb.prototype.next;qb.prototype.reset=qb.prototype.reset;qb.className="MapIterator";
function H(a){Va(this);this.v=!1;this.Jb={};this.Ib=0;this.Ze=this.Ja=null;this.Da=0;this.$e=this.ba=null;"string"===typeof a&&B("Error: Since 2.0 List/Map/Set constructors no longer take an argument that enforces type.");void 0!==a&&this.addAll(a)}t=H.prototype;t.lb=function(){var a=this.Da;a++;999999999<a&&(a=0);this.Da=a};t.freeze=function(){this.v=!0;return this};t.ea=function(){this.v=!1;return this};t.toString=function(){return"Map()#"+ib(this)};
t.add=function(a,b){this.v&&wa(this,a);var c=a;za(a)&&(c=kb(a));var d=this.Jb[c];void 0===d?(this.Ib++,a=new lb(a,b),this.Jb[c]=a,c=this.$e,null===c?this.ba=a:(a.xl=c,c.oa=a),this.$e=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=ib(a),void 0===b)?!1:void 0!==this.Jb[b]};t.has=function(a){return this.contains(a)};
t.H=function(a){var b=a;if(za(a)&&(b=ib(a),void 0===b))return null;a=this.Jb[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.v&&wa(this,a);var b=a;if(za(a)&&(b=ib(a),void 0===b))return!1;a=this.Jb[b];if(void 0===a)return!1;var c=a.oa,d=a.xl;null!==c&&(c.xl=d);null!==d&&(d.oa=c);this.ba===a&&(this.ba=c);this.$e===a&&(this.$e=d);delete this.Jb[b];this.Ib--;this.lb();return!0};t.delete=function(a){return this.remove(a)};
t.clear=function(){this.v&&wa(this);this.Jb={};this.Ib=0;null!==this.Ja&&this.Ja.reset();null!==this.Ze&&this.Ze.reset();this.$e=this.ba=null;this.lb()};H.prototype.copy=function(){var a=new H,b=this.Jb,c;for(c in b){var d=b[c];a.add(d.key,d.value)}return a};H.prototype.ya=function(){var a=this.Jb,b=Array(this.Ib),c=0,d;for(d in a){var e=a[d];b[c]=new lb(e.key,e.value);c++}return b};H.prototype.If=function(){return new ob(this)};
na.Object.defineProperties(H.prototype,{count:{get:function(){return this.Ib}},size:{get:function(){return this.Ib}},iterator:{get:function(){if(0>=this.count)return ab;var a=this.Ja;return null!==a?(a.reset(),a):new qb(this)}},iteratorKeys:{get:function(){return 0>=this.count?ab:new nb(this)}},iteratorValues:{get:function(){if(0>=this.count)return ab;
var a=this.Ze;return null!==a?(a.reset(),a):new pb(this)}}});H.prototype.toKeySet=H.prototype.If;H.prototype.toArray=H.prototype.ya;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 K(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.v=!1}K.prototype.assign=function(a){this.x=a.x;this.y=a.y;return this};K.prototype.h=function(a,b){this.x=a;this.y=b;return this};K.prototype.tg=function(a,b){this.x=a;this.y=b;return this};
K.prototype.set=function(a){this.x=a.x;this.y=a.y;return this};K.prototype.copy=function(){var a=new K;a.x=this.x;a.y=this.y;return a};t=K.prototype;t.ca=function(){this.v=!0;Object.freeze(this);return this};t.I=function(){return this.v||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.v=!0;return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.v=!1;return this};
function rb(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 K(c,e)}return new K}function sb(a){return a.x.toString()+" "+a.y.toString()}t.toString=function(){return"Point("+this.x+","+this.y+")"};t.A=function(a){return a instanceof K?this.x===a.x&&this.y===a.y:!1};t.Fi=function(a,b){return this.x===a&&this.y===b};t.Ua=function(a){return M.w(this.x,a.x)&&M.w(this.y,a.y)};
t.add=function(a){this.x+=a.x;this.y+=a.y;return this};t.he=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};K.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=K.prototype;
t.scale=function(a,b){this.x*=a;this.y*=b;return this};t.xf=function(a){var b=a.x-this.x;a=a.y-this.y;return b*b+a*a};t.pd=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.Pa=function(a){return tb(a.x-this.x,a.y-this.y)};t.direction=function(a,b){return tb(a-this.x,b-this.y)};
function tb(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.nz=function(a,b){return M.Xl(a.x,a.y,b.x,b.y,this.x,this.y)};t.BA=function(a,b,c,d){M.Ih(a,b,c,d,this.x,this.y,this);return this};t.CA=function(a,b){M.Ih(a.x,a.y,b.x,b.y,this.x,this.y,this);return this};t.QA=function(a,b,c,d){M.Xp(this.x,this.y,a,b,c,d,this);return this};
t.RA=function(a,b){M.Xp(this.x,this.y,a.x,a.y,b.width,b.height,this);return this};t.Ti=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.Ui=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.Aa(this);return this};function ub(a,b){b.Hd(a);return a}
function vb(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 wb(a,b,c,d){a=c-a;b=d-b;return a*a+b*b}function xb(a,b,c,d){a=c-a;b=d-b;if(0===a)return 0<b?90:0>b?270:0;if(0===b)return 0<a?0:180;if(isNaN(a)||isNaN(b))return 0;d=180*Math.atan(Math.abs(b/a))/Math.PI;0>a?d=0>b?d+180:180-d:0>b&&(d=360-d);return d}t.u=function(){return isFinite(this.x)&&isFinite(this.y)};
K.alloc=function(){var a=yb.pop();return void 0===a?new K:a};K.allocAt=function(a,b){var c=yb.pop();if(void 0===c)return new K(a,b);c.x=a;c.y=b;return c};K.free=function(a){yb.push(a)};K.prototype.isReal=K.prototype.u;K.prototype.setSpot=K.prototype.Ui;K.prototype.setRectSpot=K.prototype.Ti;K.prototype.snapToGridPoint=K.prototype.RA;K.prototype.snapToGrid=K.prototype.QA;K.prototype.projectOntoLineSegmentPoint=K.prototype.CA;K.prototype.projectOntoLineSegment=K.prototype.BA;
K.intersectingLineSegments=function(a,b,c,d,e,f,g,h){return M.dm(a,b,c,d,e,f,g,h)};K.prototype.compareWithLineSegmentPoint=K.prototype.nz;K.compareWithLineSegment=function(a,b,c,d,e,f){return M.Xl(a,b,c,d,e,f)};K.prototype.direction=K.prototype.direction;K.prototype.directionPoint=K.prototype.Pa;K.prototype.normalize=K.prototype.normalize;K.prototype.distanceSquared=K.prototype.pd;K.prototype.distanceSquaredPoint=K.prototype.xf;K.prototype.scale=K.prototype.scale;K.prototype.rotate=K.prototype.rotate;
K.prototype.offset=K.prototype.offset;K.prototype.subtract=K.prototype.he;K.prototype.add=K.prototype.add;K.prototype.equalsApprox=K.prototype.Ua;K.prototype.equalTo=K.prototype.Fi;K.prototype.equals=K.prototype.A;K.prototype.set=K.prototype.set;K.prototype.setTo=K.prototype.tg;var zb=null,Ab=null,Db=null,Eb=null,Fb=null,yb=[];K.className="Point";K.parse=rb;K.stringify=sb;K.distanceLineSegmentSquared=vb;K.distanceSquared=wb;K.direction=xb;K.Origin=zb=(new K(0,0)).ca();
K.InfiniteTopLeft=Ab=(new K(-Infinity,-Infinity)).ca();K.InfiniteBottomRight=Db=(new K(Infinity,Infinity)).ca();K.SixPoint=Eb=(new K(6,6)).ca();K.NoPoint=Fb=(new K(NaN,NaN)).ca();K.parse=rb;K.stringify=sb;K.distanceLineSegmentSquared=vb;K.distanceSquared=wb;K.direction=xb;function Gb(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.v=!1}
var Hb,Ib,Jb,Kb,Lb,Mb,Nb;Gb.prototype.assign=function(a){this.width=a.width;this.height=a.height;return this};Gb.prototype.h=function(a,b){this.width=a;this.height=b;return this};Gb.prototype.tg=function(a,b){this.width=a;this.height=b;return this};Gb.prototype.set=function(a){this.width=a.width;this.height=a.height;return this};Gb.prototype.copy=function(){var a=new Gb;a.width=this.width;a.height=this.height;return a};t=Gb.prototype;t.ca=function(){this.v=!0;Object.freeze(this);return this};
t.I=function(){return this.v||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.v=!0;return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.v=!1;return this};function Ob(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 Gb(c,e)}return new Gb}function Pb(a){return a.width.toString()+" "+a.height.toString()}
t.toString=function(){return"Size("+this.width+","+this.height+")"};t.A=function(a){return a instanceof Gb?this.width===a.width&&this.height===a.height:!1};t.Fi=function(a,b){return this.width===a&&this.height===b};t.Ua=function(a){return M.w(this.width,a.width)&&M.w(this.height,a.height)};t.u=function(){return isFinite(this.width)&&isFinite(this.height)};Gb.alloc=function(){var a=Qb.pop();return void 0===a?new Gb:a};Gb.free=function(a){Qb.push(a)};Gb.prototype.isReal=Gb.prototype.u;
Gb.prototype.equalsApprox=Gb.prototype.Ua;Gb.prototype.equalTo=Gb.prototype.Fi;Gb.prototype.equals=Gb.prototype.A;Gb.prototype.set=Gb.prototype.set;Gb.prototype.setTo=Gb.prototype.tg;var Qb=[];Gb.className="Size";Gb.parse=Ob;Gb.stringify=Pb;Gb.ZeroSize=Hb=(new Gb(0,0)).ca();Gb.OneSize=Ib=(new Gb(1,1)).ca();Gb.SixSize=Jb=(new Gb(6,6)).ca();Gb.EightSize=Kb=(new Gb(8,8)).ca();Gb.TenSize=Lb=(new Gb(10,10)).ca();Gb.InfiniteSize=Mb=(new Gb(Infinity,Infinity)).ca();Gb.NoSize=Nb=(new Gb(NaN,NaN)).ca();
Gb.parse=Ob;Gb.stringify=Pb;
function N(a,b,c,d){void 0===a?this.height=this.width=this.y=this.x=0:"number"===typeof a&&"number"===typeof b&&"number"===typeof c&&(0<=c||isNaN(c))&&"number"===typeof d&&(0<=d||isNaN(d))?(this.x=a,this.y=b,this.width=c,this.height=d):a instanceof K?(c=a.x,a=a.y,b instanceof K?(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 Gb?(this.x=c,this.y=a,this.width=b.width,this.height=b.height):B("Incorrect second argument supplied to Rect constructor "+b)):
B("Invalid arguments to Rect constructor: "+a+", "+b+", "+c+", "+d);this.v=!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 Rb(a,b,c){a.width=b;a.height=c}t.tg=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.Qc=function(a){this.x=a.x;this.y=a.y;return this};t.PA=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.v=!0;Object.freeze(this);return this};t.I=function(){return this.v||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.v=!0;return this};
t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.v=!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));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 Tb(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.A=function(a){return a instanceof N?this.x===a.x&&this.y===a.y&&this.width===a.width&&this.height===a.height:!1};t.Fi=function(a,b,c,d){return this.x===a&&this.y===b&&this.width===c&&this.height===d};t.Ua=function(a){return M.w(this.x,a.x)&&M.w(this.y,a.y)&&M.w(this.width,a.width)&&M.w(this.height,a.height)};
function Ub(a,b){return M.aa(a.x,b.x)&&M.aa(a.y,b.y)&&M.aa(a.width,b.width)&&M.aa(a.height,b.height)}t.$=function(a){return this.x<=a.x&&this.x+this.width>=a.x&&this.y<=a.y&&this.y+this.height>=a.y};t.Ge=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.Kc=function(a,b){return Vb(this,b,a,b,a)};t.Mp=function(a){return Vb(this,a.top,a.right,a.bottom,a.left)};t.Vv=function(a){return Vb(this,-a.top,-a.right,-a.bottom,-a.left)};t.eA=function(a,b,c,d){return Vb(this,a,b,c,d)};function Vb(a,b,c,d,e){var f=a.width;c+e<=-f?(a.x+=f/2,a.width=0):(a.x-=e,a.width+=c+e);c=a.height;b+d<=-c?(a.y+=c/2,a.height=0):(a.y-=b,a.height+=b+d);return a}t.ey=function(a){return Zb(this,a.x,a.y,a.width,a.height)};
t.iv=function(a,b,c,d){return Zb(this,a,b,c,d)};function Zb(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.Mc=function(a){return this.jv(a.x,a.y,a.width,a.height)};
t.jv=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 $b(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.Oe=function(a){return ac(this,a.x,a.y,0,0)};t.Rc=function(a){return ac(this,a.x,a.y,a.width,a.height)};
t.aw=function(a,b,c,d){void 0===c&&(c=0);void 0===d&&(d=0);return ac(this,a,b,c,d)};function ac(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.Ui=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 bc(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 fc(a,b,c,d,e,f,g,h){return a>g+e||e>c+a?!1:b>h+f||f>d+b?!1:!0}t.u=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)};t.kA=function(){return 0===this.width&&0===this.height};N.alloc=function(){var a=gc.pop();return void 0===a?new N:a};N.allocAt=function(a,b,c,d){var e=gc.pop();return void 0===e?new N(a,b,c,d):e.h(a,b,c,d)};N.free=function(a){gc.push(a)};
na.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 K(this.x,this.y)},set:function(a){this.x=a.x;this.y=a.y}},size:{get:function(){return new Gb(this.width,this.height)},set:function(a){this.width=a.width;this.height=a.height}},center:{get:function(){return new K(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.kA;N.prototype.isReal=N.prototype.u;N.intersectsLineSegment=function(a,b,c,d,e,f,g,h){return M.gy(a,b,c,d,e,f,g,h)};N.prototype.setSpot=N.prototype.Ui;N.prototype.union=N.prototype.aw;N.prototype.unionRect=N.prototype.Rc;N.prototype.unionPoint=N.prototype.Oe;N.prototype.intersects=N.prototype.jv;
N.prototype.intersectsRect=N.prototype.Mc;N.prototype.intersect=N.prototype.iv;N.prototype.intersectRect=N.prototype.ey;N.prototype.grow=N.prototype.eA;N.prototype.subtractMargin=N.prototype.Vv;N.prototype.addMargin=N.prototype.Mp;N.prototype.inflate=N.prototype.Kc;N.prototype.offset=N.prototype.offset;N.prototype.contains=N.prototype.contains;N.prototype.containsRect=N.prototype.Ge;N.prototype.containsPoint=N.prototype.$;N.prototype.equalsApprox=N.prototype.Ua;N.prototype.equalTo=N.prototype.Fi;
N.prototype.equals=N.prototype.A;N.prototype.setSize=N.prototype.PA;N.prototype.setPoint=N.prototype.Qc;N.prototype.set=N.prototype.set;N.prototype.setTo=N.prototype.tg;var hc=null,kc=null,gc=[];N.className="Rect";N.parse=Sb;N.stringify=Tb;N.contains=bc;N.intersects=fc;N.ZeroRect=hc=(new N(0,0,0,0)).ca();N.NoRect=kc=(new N(NaN,NaN,NaN,NaN)).ca();N.parse=Sb;N.stringify=Tb;N.contains=bc;N.intersects=fc;
function lc(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.v=!1}lc.prototype.assign=function(a){this.top=a.top;this.right=a.right;this.bottom=a.bottom;this.left=a.left;return this};
lc.prototype.tg=function(a,b,c,d){this.top=a;this.right=b;this.bottom=c;this.left=d;return this};lc.prototype.set=function(a){this.top=a.top;this.right=a.right;this.bottom=a.bottom;this.left=a.left;return this};lc.prototype.copy=function(){var a=new lc;a.top=this.top;a.right=this.right;a.bottom=this.bottom;a.left=this.left;return a};t=lc.prototype;t.ca=function(){this.v=!0;Object.freeze(this);return this};t.I=function(){return this.v||Object.isFrozen(this)?this:this.copy().freeze()};
t.freeze=function(){this.v=!0;return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.v=!1;return this};
function mc(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=NaN;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));if(isNaN(c))return new lc;for(var e=NaN;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));if(isNaN(e))return new lc(c);for(var f=NaN;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));if(isNaN(f))return new lc(c,e);for(var g=NaN;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));return isNaN(g)?new lc(c,e):new lc(c,e,f,g)}return new lc}
function nc(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.A=function(a){return a instanceof lc?this.top===a.top&&this.right===a.right&&this.bottom===a.bottom&&this.left===a.left:!1};t.Fi=function(a,b,c,d){return this.top===a&&this.right===b&&this.bottom===c&&this.left===d};
t.Ua=function(a){return M.w(this.top,a.top)&&M.w(this.right,a.right)&&M.w(this.bottom,a.bottom)&&M.w(this.left,a.left)};t.u=function(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)};lc.alloc=function(){var a=oc.pop();return void 0===a?new lc:a};lc.free=function(a){oc.push(a)};lc.prototype.isReal=lc.prototype.u;lc.prototype.equalsApprox=lc.prototype.Ua;lc.prototype.equalTo=lc.prototype.Fi;lc.prototype.equals=lc.prototype.A;lc.prototype.set=lc.prototype.set;
lc.prototype.setTo=lc.prototype.tg;var pc=null,qc=null,oc=[];lc.className="Margin";lc.parse=mc;lc.stringify=nc;lc.ZeroMargin=pc=(new lc(0,0,0,0)).ca();lc.TwoMargin=qc=(new lc(2,2,2,2)).ca();lc.parse=mc;lc.stringify=nc;function O(a,b,c,d){void 0===a?this.offsetY=this.offsetX=this.y=this.x=0:(void 0===b&&(b=0),void 0===c&&(c=0),void 0===d&&(d=0),this.x=a,this.y=b,this.offsetX=c,this.offsetY=d);this.v=!1}
var rc,uc,vc,wc,xc,yc,zc,Ac,Bc,Cc,Ec,Fc,Gc,Hc,Ic,Jc,Kc,Lc,Mc,Oc,Pc,Qc,Rc,Sc,Tc,Wc,Xc,Yc,Zc,$c,ad,bd,cd,dd,ed,fd;O.prototype.assign=function(a){this.x=a.x;this.y=a.y;this.offsetX=a.offsetX;this.offsetY=a.offsetY;return this};O.prototype.tg=function(a,b,c,d){this.x=a;this.y=b;this.offsetX=c;this.offsetY=d;return this};O.prototype.set=function(a){this.x=a.x;this.y=a.y;this.offsetX=a.offsetX;this.offsetY=a.offsetY;return this};
O.prototype.copy=function(){var a=new O;a.x=this.x;a.y=this.y;a.offsetX=this.offsetX;a.offsetY=this.offsetY;return a};t=O.prototype;t.ca=function(){this.v=!0;Object.freeze(this);return this};t.I=function(){return this.v||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.v=!0;return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.v=!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 rc;if("TopLeft"===a)return uc;if("Top"===a||"TopCenter"===a||"MiddleTop"===a)return vc;if("TopRight"===a)return wc;if("Left"===a||"LeftCenter"===a||"MiddleLeft"===a)return xc;if("Center"===a)return yc;if("Right"===a||"RightCenter"===a||"MiddleRight"===a)return zc;if("BottomLeft"===a)return Ac;if("Bottom"===a||"BottomCenter"===a||"MiddleBottom"===a)return Bc;if("BottomRight"===a)return Cc;if("TopSide"===a)return Ec;if("LeftSide"===
a)return Fc;if("RightSide"===a)return Gc;if("BottomSide"===a)return Hc;if("TopBottomSides"===a)return Ic;if("LeftRightSides"===a)return Jc;if("TopLeftSides"===a)return Kc;if("TopRightSides"===a)return Lc;if("BottomLeftSides"===a)return Mc;if("BottomRightSides"===a)return Oc;if("NotTopSide"===a)return Pc;if("NotLeftSide"===a)return Qc;if("NotRightSide"===a)return Rc;if("NotBottomSide"===a)return Sc;if("AllSides"===a)return Tc;if("Default"===a)return Wc;a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;
var d=a[b++];void 0!==d&&0<d.length&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(e=parseFloat(d));for(var f=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(f=parseFloat(d));for(var g=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(g=parseFloat(d));return new O(c,e,f,g)}return new O}function 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.A(rc)?"None":this.A(uc)?"TopLeft":this.A(vc)?"Top":this.A(wc)?"TopRight":this.A(xc)?"Left":this.A(yc)?"Center":this.A(zc)?"Right":this.A(Ac)?"BottomLeft":this.A(Bc)?"Bottom":this.A(Cc)?"BottomRight":this.A(Ec)?"TopSide":this.A(Fc)?"LeftSide":this.A(Gc)?"RightSide":this.A(Hc)?"BottomSide":this.A(Ic)?"TopBottomSides":this.A(Jc)?
"LeftRightSides":this.A(Kc)?"TopLeftSides":this.A(Lc)?"TopRightSides":this.A(Mc)?"BottomLeftSides":this.A(Oc)?"BottomRightSides":this.A(Pc)?"NotTopSide":this.A(Qc)?"NotLeftSide":this.A(Rc)?"NotRightSide":this.A(Sc)?"NotBottomSide":this.A(Tc)?"AllSides":this.A(Wc)?"Default":"None"};t.A=function(a){return a instanceof O?(this.x===a.x||isNaN(this.x)&&isNaN(a.x))&&(this.y===a.y||isNaN(this.y)&&isNaN(a.y))&&this.offsetX===a.offsetX&&this.offsetY===a.offsetY:!1};
t.yv=function(){return new O(.5-(this.x-.5),.5-(this.y-.5),-this.offsetX,-this.offsetY)};t.Df=function(a){if(!this.Oc())return!1;if(!a.Oc())if(a.A(Xc))a=Fc;else if(a.A(Yc))a=Gc;else if(a.A(Zc))a=Ec;else if(a.A($c))a=Hc;else return!1;a=a.offsetY;return(this.offsetY&a)===a};t.hb=function(){return!isNaN(this.x)&&!isNaN(this.y)};t.Cc=function(){return isNaN(this.x)||isNaN(this.y)};t.Oc=function(){return isNaN(this.x)&&isNaN(this.y)&&1===this.offsetX&&0!==this.offsetY};
t.Es=function(){return isNaN(this.x)&&isNaN(this.y)&&0===this.offsetX&&0===this.offsetY};t.Mb=function(){return isNaN(this.x)&&isNaN(this.y)&&-1===this.offsetX&&0===this.offsetY};O.alloc=function(){var a=nd.pop();return void 0===a?new O:a};O.free=function(a){nd.push(a)};O.prototype.isDefault=O.prototype.Mb;O.prototype.isNone=O.prototype.Es;O.prototype.isSide=O.prototype.Oc;O.prototype.isNoSpot=O.prototype.Cc;O.prototype.isSpot=O.prototype.hb;O.prototype.includesSide=O.prototype.Df;
O.prototype.opposite=O.prototype.yv;O.prototype.equals=O.prototype.A;O.prototype.set=O.prototype.set;O.prototype.setTo=O.prototype.tg;var nd=[];O.className="Spot";O.parse=ld;O.stringify=md;O.None=rc=kd(new O(0,0,0,0),0).ca();O.Default=Wc=kd(new O(0,0,-1,0),-1).ca();O.TopLeft=uc=(new O(0,0,0,0)).ca();O.TopCenter=vc=(new O(.5,0,0,0)).ca();O.TopRight=wc=(new O(1,0,0,0)).ca();O.LeftCenter=xc=(new O(0,.5,0,0)).ca();O.Center=yc=(new O(.5,.5,0,0)).ca();O.RightCenter=zc=(new O(1,.5,0,0)).ca();
O.BottomLeft=Ac=(new O(0,1,0,0)).ca();O.BottomCenter=Bc=(new O(.5,1,0,0)).ca();O.BottomRight=Cc=(new O(1,1,0,0)).ca();O.MiddleTop=ad=vc;O.MiddleLeft=bd=xc;O.MiddleRight=cd=zc;O.MiddleBottom=dd=Bc;O.Top=Zc=vc;O.Left=Xc=xc;O.Right=Yc=zc;O.Bottom=$c=Bc;O.TopSide=Ec=kd(new O(0,0,1,1),1).ca();O.LeftSide=Fc=kd(new O(0,0,1,2),1).ca();O.RightSide=Gc=kd(new O(0,0,1,4),1).ca();O.BottomSide=Hc=kd(new O(0,0,1,8),1).ca();O.TopBottomSides=Ic=kd(new O(0,0,1,9),1).ca();O.LeftRightSides=Jc=kd(new O(0,0,1,6),1).ca();
O.TopLeftSides=Kc=kd(new O(0,0,1,3),1).ca();O.TopRightSides=Lc=kd(new O(0,0,1,5),1).ca();O.BottomLeftSides=Mc=kd(new O(0,0,1,10),1).ca();O.BottomRightSides=Oc=kd(new O(0,0,1,12),1).ca();O.NotTopSide=Pc=kd(new O(0,0,1,14),1).ca();O.NotLeftSide=Qc=kd(new O(0,0,1,13),1).ca();O.NotRightSide=Rc=kd(new O(0,0,1,11),1).ca();O.NotBottomSide=Sc=kd(new O(0,0,1,7),1).ca();O.AllSides=Tc=kd(new O(0,0,1,15),1).ca();ed=(new O(.156,.156)).ca();fd=(new O(.844,.844)).ca();O.parse=ld;O.stringify=md;
function od(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0}od.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};od.prototype.setTransform=function(a,b,c,d,e,f){this.m11=a;this.m12=b;this.m21=c;this.m22=d;this.dx=e;this.dy=f;return this};od.prototype.copy=function(){var a=new od;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};
od.prototype.toString=function(){return"Transform("+this.m11+","+this.m12+","+this.m21+","+this.m22+","+this.dx+","+this.dy+")"};od.prototype.A=function(a){return this.m11===a.m11&&this.m12===a.m12&&this.m21===a.m21&&this.m22===a.m22&&this.dx===a.dx&&this.dy===a.dy};od.prototype.Cs=function(){return 0===this.dx&&0===this.dy&&1===this.m11&&0===this.m12&&0===this.m21&&1===this.m22};od.prototype.reset=function(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0;return this};
od.prototype.multiply=function(a){var b=this.m11*a.m11+this.m21*a.m12,c=this.m12*a.m11+this.m22*a.m12,d=this.m11*a.m21+this.m21*a.m22,e=this.m12*a.m21+this.m22*a.m22;this.dx=this.m11*a.dx+this.m21*a.dy+this.dx;this.dy=this.m12*a.dx+this.m22*a.dy+this.dy;this.m11=b;this.m12=c;this.m21=d;this.m22=e;return this};
od.prototype.uv=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};
od.prototype.Bs=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};
od.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=od.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.Aa=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.Hd=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.Cx=function(a){var b=1/(this.m11*this.m22-this.m12*this.m21),c=1.25*a.x,d=1.2*a.y;return a.h(c*this.m22*b+d*-this.m21*b+b*(this.m21*this.dy-this.m22*this.dx),c*-this.m12*b+d*this.m11*b+b*(this.m12*this.dx-this.m11*this.dy))};
t.xq=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};od.alloc=function(){var a=pd.pop();return void 0===a?new od:a};
od.free=function(a){pd.push(a)};od.prototype.transformRect=od.prototype.xq;od.prototype.transformPoint=od.prototype.Aa;od.prototype.scale=od.prototype.scale;od.prototype.translate=od.prototype.translate;od.prototype.rotate=od.prototype.rotate;od.prototype.invert=od.prototype.Bs;od.prototype.multiplyInverted=od.prototype.uv;od.prototype.multiply=od.prototype.multiply;od.prototype.reset=od.prototype.reset;od.prototype.isIdentity=od.prototype.Cs;od.prototype.equals=od.prototype.A;
od.prototype.setTransform=od.prototype.setTransform;od.prototype.set=od.prototype.set;var pd=[];od.className="Transform";od.xF="54a702f3e53909c447824c6706603faf4c";
var M={ZA:"7da71ca0ad381e90",wg:(Math.sqrt(2)-1)/3*4,uw:null,sqrt:function(a){if(0>=a)return 0;var b=M.uw;if(null===b){b=[];for(var c=0;2E3>=c;c++)b[c]=Math.sqrt(c);M.uw=b}return 1>a?(c=1/a,2E3>=c?1/b[c|0]:Math.sqrt(a)):2E3>=a?b[a|0]:Math.sqrt(a)},w:function(a,b){a-=b;return.5>a&&-.5<a},aa:function(a,b){a-=b;return 5E-8>a&&-5E-8<a},Nb:function(a,b,c,d,e,f,g){0>=e&&(e=1E-6);if(a<c){var h=a;var k=c}else h=c,k=a;if(b<d){var l=b;var m=d}else l=d,m=b;if(a===c)return l<=g&&g<=m&&a-e<=f&&f<=a+e;if(b===d)return h<=
f&&f<=k&&b-e<=g&&g<=b+e;k+=e;h-=e;if(h<=f&&f<=k&&(m+=e,l-=e,l<=g&&g<=m))if(k-h>m-l)if(a-c>e||c-a>e){if(f=(d-b)/(c-a)*(f-a)+b,f-e<=g&&g<=f+e)return!0}else return!0;else if(b-d>e||d-b>e){if(g=(c-a)/(d-b)*(g-b)+a,g-e<=f&&f<=g+e)return!0}else return!0;return!1},js:function(a,b,c,d,e,f,g,h,k,l,m,n){if(M.Nb(a,b,g,h,n,c,d)&&M.Nb(a,b,g,h,n,e,f))return M.Nb(a,b,g,h,n,l,m);var p=(a+c)/2,r=(b+d)/2,q=(c+e)/2,u=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(p+q)/2;c=(r+u)/2;q=(q+e)/2;u=(u+f)/2;var w=(d+q)/2,v=(c+u)/2;return M.js(a,
b,p,r,d,c,w,v,k,l,m,n)||M.js(w,v,q,u,e,f,g,h,k,l,m,n)},iz: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},hz:function(a,b,c,d,e,f,g,h){var k=(c+e)/2,l=(d+f)/2;return xb(((a+c)/2+k)/2,((b+d)/2+l)/2,(k+(e+g)/2)/2,(l+(f+h)/2)/2)},Vl:function(a,b,c,d,e,f,g,h,k,l){if(M.Nb(a,b,g,h,k,c,d)&&M.Nb(a,b,g,h,k,e,f))ac(l,a,b,0,0),ac(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;M.Vl(a,b,m,n,d,c,q,u,k,l);M.Vl(q,u,p,r,e,f,g,h,k,l)}return l},Fe:function(a,b,c,d,e,f,g,h,k,l){if(M.Nb(a,b,g,h,k,c,d)&&M.Nb(a,b,g,h,k,e,f))0===l.length&&(l.push(a),l.push(b)),l.push(g),l.push(h);else{var m=(a+c)/2,n=(b+d)/2,p=(c+e)/2,r=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(m+p)/2;c=(n+r)/2;p=(p+e)/2;r=(r+f)/2;var q=(d+p)/2,u=(c+r)/2;M.Fe(a,b,m,n,d,c,q,u,k,l);M.Fe(q,u,p,r,e,f,g,h,k,l)}return l},Dv:function(a,b,c,d,e,f,g,h,k,l){if(M.Nb(a,b,e,f,l,c,d))return M.Nb(a,
b,e,f,l,h,k);var m=(a+c)/2,n=(b+d)/2;c=(c+e)/2;d=(d+f)/2;var p=(m+c)/2,r=(n+d)/2;return M.Dv(a,b,m,n,p,r,g,h,k,l)||M.Dv(p,r,c,d,e,f,g,h,k,l)},nB: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},Cv:function(a,b,c,d,e,f,g,h){if(M.Nb(a,b,e,f,g,c,d))ac(h,a,b,0,0),ac(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;M.Cv(a,b,k,l,m,n,g,h);M.Cv(m,n,c,d,e,f,g,h)}return h},lq:function(a,b,c,d,e,f,g,h){if(M.Nb(a,b,e,f,g,c,d))0===h.length&&(h.push(a),
h.push(b)),h.push(e),h.push(f);else{var k=(a+c)/2,l=(b+d)/2;c=(c+e)/2;d=(d+f)/2;var m=(k+c)/2,n=(l+d)/2;M.lq(a,b,k,l,m,n,g,h);M.lq(m,n,c,d,e,f,g,h)}return h},Op:function(a,b,c,d,e,f,g,h,k,l,m,n,p,r){if(M.Nb(a,b,g,h,p,c,d)&&M.Nb(a,b,g,h,p,e,f)){if(!M.dm(a,b,g,h,k,l,m,n))return!1;p=(a-g)*(l-n)-(b-h)*(k-m);if(0===p)return!1;r.h(((a*h-b*g)*(k-m)-(a-g)*(k*n-l*m))/p,((a*h-b*g)*(l-n)-(b-h)*(k*n-l*m))/p);return!0}var q=(a+c)/2,u=(b+d)/2,w=(c+e)/2,v=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(q+w)/2;c=(u+v)/2;w=(w+e)/
2;v=(v+f)/2;var y=(d+w)/2,z=(c+v)/2,A=Infinity,C=!1,F=0,R=0;M.Op(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,F=r.x,R=r.y));M.Op(y,z,w,v,e,f,g,h,k,l,m,n,p,r)&&(r.x-k)*(r.x-k)+(r.y-l)*(r.y-l)<A&&(C=!0,F=r.x,R=r.y);C&&(r.x=F,r.y=R);return C},Pp:function(a,b,c,d,e,f,g,h,k,l,m,n,p){var r=0;if(M.Nb(a,b,g,h,p,c,d)&&M.Nb(a,b,g,h,p,e,f)){p=(a-g)*(l-n)-(b-h)*(k-m);if(0===p)return r;var q=((a*h-b*g)*(k-m)-(a-g)*(k*n-l*m))/p,u=((a*h-b*g)*(l-n)-(b-h)*(k*n-l*m))/p;if(q>=m)return r;
if((k>m?k-m:m-k)<(l>n?l-n:n-l)){if(b<h?(k=b,a=h):(k=h,a=b),u<k||u>a)return r}else if(a<g?(k=a,a=g):k=g,q<k||q>a)return r;0<p?r++:0>p&&r--}else{q=(a+c)/2;u=(b+d)/2;var w=(c+e)/2,v=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(q+w)/2;c=(u+v)/2;w=(w+e)/2;v=(v+f)/2;var y=(d+w)/2,z=(c+v)/2;r+=M.Pp(a,b,q,u,d,c,y,z,k,l,m,n,p);r+=M.Pp(y,z,w,v,e,f,g,h,k,l,m,n,p)}return r},Ih:function(a,b,c,d,e,f,g){if(M.aa(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(M.aa(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},Le:function(a,b,c,d,e,f,g,h,k){if(M.w(a,c)&&M.w(b,d))return k.h(a,b),!1;if(M.aa(e,g))return M.aa(a,c)?(M.Ih(a,b,c,d,e,f,k),!1):M.Ih(a,b,c,d,e,(d-b)/(c-a)*(e-a)+b,k);h=(h-f)/(g-e);if(M.aa(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(M.aa(h,g))return M.Ih(a,b,c,d,e,f,k),!1;e=(g*a-h*e+f-b)/(g-h);if(M.aa(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 M.Ih(a,b,c,d,e,g*(e-a)+b,k)},lB:function(a,b,c,d,e){return M.Le(c.x,c.y,d.x,d.y,a.x,a.y,b.x,b.y,e)},jB: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},Cf:function(a,b,c,d,e,f,g,h,k){var l=1E21,m=a,n=b;if(M.Le(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)}M.Le(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));M.Le(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));M.Le(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},iB: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},zs:function(a,b,c){return M.gy(a.x,a.y,a.width,a.height,b.x,b.y,c.x,c.y)},gy: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):bc(a,b,c,d,e,f)||bc(a,b,c,d,g,h)||M.dm(a,b,k,b,e,f,g,h)||M.dm(k,b,k,l,e,f,g,h)||M.dm(k,l,a,l,e,f,g,h)||M.dm(a,l,a,b,e,f,g,h)?!0:!1},dm:function(a,b,c,d,e,f,g,h){return 0>=M.Xl(a,b,c,d,e,f)*M.Xl(a,b,c,d,g,h)&&0>=M.Xl(e,f,g,h,a,b)*M.Xl(e,
f,g,h,c,d)},Xl:function(a,b,c,d,e,f){c-=a;d-=b;a=e-a;b=f-b;f=a*d-b*c;0===f&&(f=a*c+b*d,0<f&&(f=(a-c)*c+(b-d)*d,0>f&&(f=0)));return f},jq:function(a){0>a&&(a+=360);360<=a&&(a-=360);return a},Jx:function(a,b,c,d,e,f){var g=Math.PI;f||(d*=g/180,e*=g/180);var h=d>e?-1:1;f=[];var k=g/2,l=d;d=Math.min(2*g,Math.abs(e-d));if(1E-5>d)return k=l+h*Math.min(d,k),h=a+c*Math.cos(l),l=b+c*Math.sin(l),a+=c*Math.cos(k),b+=c*Math.sin(k),c=(h+a)/2,k=(l+b)/2,f.push([h,l,c,k,c,k,a,b]),f;for(;1E-5<d;)e=l+h*Math.min(d,
k),f.push(M.rz(c,l,e,a,b)),d-=Math.abs(e-l),l=e;return f},rz: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)]},Xp: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},
Ux: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},xz: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 M.yz(k,0===g?a:b,l,c,0,0)},yz: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},Qe:new Ya,Im:new Ya,Jf:new Ya,Kf:0,Jm:100};M.za=M.ZA;
function P(a){Va(this);this.v=!1;void 0===a&&(a=P.o);this.ha=a;this.uc=this.ic=this.bd=this.ad=0;this.ij=new E;this.ar=this.ij.Da;this.Nq=(new N).freeze();this.qa=!0;this.Pm=this.yk=null;this.Qm=NaN;this.mf=uc;this.nf=Cc;this.al=this.cl=NaN;this.Of=qd}
P.prototype.copy=function(){var a=new P;a.ha=this.ha;a.ad=this.ad;a.bd=this.bd;a.ic=this.ic;a.uc=this.uc;for(var b=this.ij.l,c=b.length,d=a.ij,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.ar=this.ar;a.Nq.assign(this.Nq);a.qa=this.qa;a.yk=this.yk;a.Pm=this.Pm;a.Qm=this.Qm;a.mf=this.mf.I();a.nf=this.nf.I();a.cl=this.cl;a.al=this.al;a.Of=this.Of;return a};P.prototype.ca=function(){this.freeze();Object.freeze(this);return this};
P.prototype.freeze=function(){this.v=!0;var a=this.figures;a.freeze();a=a.l;for(var b=a.length,c=0;c<b;c++)a[c].freeze();return this};P.prototype.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.v=!1;var a=this.figures;a.ea();a=a.l;for(var b=a.length,c=0;c<b;c++)a[c].ea();return this};
P.prototype.Ua=function(a){if(!(a instanceof P))return!1;if(this.type!==a.type)return this.type===P.j&&a.type===P.o?rd(this,a):a.type===P.j&&this.type===P.o?rd(a,this):!1;if(this.type===P.o){var b=this.figures.l;a=a.figures.l;var c=b.length;if(c!==a.length)return!1;for(var d=0;d<c;d++)if(!b[d].Ua(a[d]))return!1;return!0}return M.w(this.startX,a.startX)&&M.w(this.startY,a.startY)&&M.w(this.endX,a.endX)&&M.w(this.endY,a.endY)};
function rd(a,b){return a.type!==P.j||b.type!==P.o?!1:1===b.figures.count&&(b=b.figures.J(0),1===b.segments.count&&M.w(a.startX,b.startX)&&M.w(a.startY,b.startY)&&(b=b.segments.J(0),b.type===sd&&M.w(a.endX,b.endX)&&M.w(a.endY,b.endY)))?!0:!1}P.wa=function(a){return a.toString()};P.prototype.gb=function(a){a.classType===P&&(this.type=a)};
P.prototype.toString=function(a){void 0===a&&(a=-1);switch(this.type){case P.j:return 0>a?"M"+this.startX.toString()+" "+this.startY.toString()+"L"+this.endX.toString()+" "+this.endY.toString():"M"+this.startX.toFixed(a)+" "+this.startY.toFixed(a)+"L"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);case P.C:var b=new N(this.startX,this.startY,0,0);b.aw(this.endX,this.endY,0,0);return 0>a?"M"+b.x.toString()+" "+b.y.toString()+"H"+b.right.toString()+"V"+b.bottom.toString()+"H"+b.left.toString()+"z":"M"+
b.x.toFixed(a)+" "+b.y.toFixed(a)+"H"+b.right.toFixed(a)+"V"+b.bottom.toFixed(a)+"H"+b.left.toFixed(a)+"z";case P.K:b=new N(this.startX,this.startY,0,0);b.aw(this.endX,this.endY,0,0);if(0>a)return a=b.left.toString()+" "+(b.y+b.height/2).toString(),"M"+a+"A"+(b.width/2).toString()+" "+(b.height/2).toString()+" 0 0 1 "+(b.right.toString()+" "+(b.y+b.height/2).toString())+"A"+(b.width/2).toString()+" "+(b.height/2).toString()+" 0 0 1 "+a;var c=b.left.toFixed(a)+" "+(b.y+b.height/2).toFixed(a);return"M"+
c+"A"+(b.width/2).toFixed(a)+" "+(b.height/2).toFixed(a)+" 0 0 1 "+(b.right.toFixed(a)+" "+(b.y+b.height/2).toFixed(a))+"A"+(b.width/2).toFixed(a)+" "+(b.height/2).toFixed(a)+" 0 0 1 "+c;case P.o:b="";c=this.figures.l;for(var d=c.length,e=0;e<d;e++){var f=c[e];0<e&&(b+=" x ");f.isFilled&&(b+="F ");b+=f.toString(a)}return b;default:return this.type.toString()}};
P.Ma=function(a){a=a.split(/[Xx]/);for(var b=a.length,c="",d=0;d<b;d++){var e=a[d];c=null!==e.match(/[Ff]/)?0===d?c+e:c+("X"+(" "===e[0]?"":" ")+e):c+((0===d?"":"X ")+"F"+(" "===e[0]?"":" ")+e)}return c};
P.parse=function(a,b){function c(){return u>=A-1?!0:null!==l[u+1].match(C)}function d(){u++;return l[u]}function e(a){var b=parseFloat(d()),c=parseFloat(d());w===w.toLowerCase()&&(b=z.x+b,c=z.y+c);a.h(b,c)}function f(){e(z);return z}function g(){e(y);return y}function h(){var a=v.toLowerCase();return"c"!==a&&"s"!==a&&"q"!==a&&"t"!==a?z:new K(2*z.x-y.x,2*z.y-y.y)}void 0===b&&(b=!1);var k=/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm;a=a.replace(/,/gm," ");a=a.replace(k,"$1 $2");
a=a.replace(k,"$1 $2");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([^s])/gm,"$1 $2");a=a.replace(/([^s])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,"$1 $2");a=a.replace(/([0-9])([+\-])/gm,"$1 $2");a=a.replace(/[\s\r\t\n]+/gm," ");a=a.replace(/^\s+|\s+$/g,"");var l=a.split(" ");for(a=0;a<l.length;a++){var m=l[a];if(null!==m.match(/(\.[0-9]*)(\.)/gm)){k=Ea();for(var n="",p=!1,r=0;r<m.length;r++){var q=m[r];"."!==q||p?"."===q?(k.push(n),n="."):n+=q:(p=!0,n+=q)}k.push(n);l.splice(a,1);for(m=0;m<k.length;m++)l.splice(a+
m,0,k[m]);a+=k.length-1;Ia(k)}}var u=-1,w="",v="";k=new K(0,0);var y=new K(0,0),z=new K(0,0),A=l.length;a=td(null);n=m=!1;p=!0;r=null;for(var C=/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/;!(u>=A-1);)if(v=w,w=d(),""!==w)switch(w.toUpperCase()){case "X":p=!0;n=m=!1;break;case "M":r=f();null===a.jc||!0===p?(xd(a,r.x,r.y,m,!n),p=!1):a.moveTo(r.x,r.y);for(k.assign(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 K((w===w.toLowerCase()?z.x:0)+parseFloat(d()),
z.y),a.lineTo(z.x,z.y);break;case "V":for(;!c();)z=new K(z.x,(w===w.toLowerCase()?z.y:0)+parseFloat(d())),a.lineTo(z.x,z.y);break;case "C":for(;!c();){r=new K;e(r);q=g();var F=f();yd(a,r.x,r.y,q.x,q.y,F.x,F.y)}break;case "S":for(;!c();)r=h(),q=g(),F=f(),yd(a,r.x,r.y,q.x,q.y,F.x,F.y);break;case "Q":for(;!c();)r=g(),q=f(),zd(a,r.x,r.y,q.x,q.y);break;case "T":for(;!c();)y=r=h(),q=f(),zd(a,r.x,r.y,q.x,q.y);break;case "B":for(;!c();){r=parseFloat(d());q=parseFloat(d());F=parseFloat(d());var R=parseFloat(d()),
J=parseFloat(d()),S=J,L=!1;c()||(S=parseFloat(d()),c()||(L=0!==parseFloat(d())));w===w.toLowerCase()&&(F+=z.x,R+=z.y);a.arcTo(r,q,F,R,J,S,L)}break;case "A":for(;!c();)r=Math.abs(parseFloat(d())),q=Math.abs(parseFloat(d())),F=parseFloat(d()),J=R=!1,L=S=0,S=d(),1===S.length?(R=!!parseFloat(S),J=!!parseFloat(d()),S=parseFloat(d())):2===S.length?(R=!!parseFloat(S[0]),J=!!parseFloat(S[1]),S=parseFloat(d())):(R=!!parseFloat(S[0]),J=!!parseFloat(S[1]),S=parseFloat(S.slice(2))),L=parseFloat(d()),w===w.toLowerCase()&&
(S=z.x+S,L=z.y+L),z.h(S,L),Ad(a,r,q,F,R,J,S,L);break;case "Z":Bd(a);z.assign(k);break;case "F":r="";for(q=1;l[u+q];)if(null!==l[u+q].match(/[Uu]/))q++;else if(null===l[u+q].match(C))q++;else{r=l[u+q];break}r.match(/[Mm]/)?m=!0:0<a.jc.segments.length&&(a.jc.isFilled=!0);break;case "U":r="";for(q=1;l[u+q];)if(null!==l[u+q].match(/[Ff]/))q++;else if(null===l[u+q].match(C))q++;else{r=l[u+q];break}r.match(/[Mm]/)?n=!0:a.Bm(!1)}k=a.ts;Cd=a;if(b)for(b=k.figures.iterator;b.next();)b.value.isFilled=!0;return k};
P.Ba=function(a,b){for(var c=a.length,d=K.alloc(),e=0;e<c;e++){var f=a[e];d.x=f[0];d.y=f[1];b.Aa(d);f[0]=d.x;f[1]=d.y;d.x=f[2];d.y=f[3];b.Aa(d);f[2]=d.x;f[3]=d.y;d.x=f[4];d.y=f[5];b.Aa(d);f[4]=d.x;f[5]=d.y;d.x=f[6];d.y=f[7];b.Aa(d);f[6]=d.x;f[7]=d.y}K.free(d)};P.prototype.nv=function(){if(this.qa||this.ar!==this.figures.Da)return!0;for(var a=this.figures.l,b=a.length,c=0;c<b;c++)if(a[c].nv())return!0;return!1};
P.prototype.computeBounds=function(){this.qa=!1;this.Pm=this.yk=null;this.Qm=NaN;this.ar=this.figures.Da;for(var a=this.figures.l,b=a.length,c=0;c<b;c++){var d=a[c];d.qa=!1;var e=d.segments;d.Pr=e.Da;d=e.l;e=d.length;for(var f=0;f<e;f++){var g=d[f];g.qa=!1;g.Sd=null}}a=this.Nq;a.ea();isNaN(this.cl)||isNaN(this.al)?a.h(0,0,0,0):a.h(0,0,this.cl,this.al);Od(this,a,!1);ac(a,0,0,0,0);a.freeze()};P.prototype.Ix=function(){var a=new N;Od(this,a,!0);return a};
function Od(a,b,c){switch(a.type){case P.j:case P.C:case P.K:c?b.h(a.ad,a.bd,0,0):ac(b,a.ad,a.bd,0,0);ac(b,a.ic,a.uc,0,0);break;case P.o:var d=a.figures;a=d.l;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):ac(b,f.startX,f.startY,0,0);for(var g=f.segments.l,h=g.length,k=f.startX,l=f.startY,m=0;m<h;m++){var n=g[m];switch(n.type){case sd:case Pd:k=n.endX;l=n.endY;ac(b,k,l,0,0);break;case Qd:M.Vl(k,l,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.5,b);k=n.endX;
l=n.endY;break;case Rd:M.Cv(k,l,n.point1X,n.point1Y,n.endX,n.endY,.5,b);k=n.endX;l=n.endY;break;case Sd:case Td:var p=n.type===Sd?Ud(n,f):Vd(n,f,k,l),r=p.length;if(0===r){k=n.type===Sd?n.centerX:n.endX;l=n.type===Sd?n.centerY:n.endY;ac(b,k,l,0,0);break}n=null;for(var q=0;q<r;q++)n=p[q],M.Vl(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)}}
P.prototype.normalize=function(){this.v&&wa(this);var a=this.Ix();this.offset(-a.x,-a.y);return new K(-a.x,-a.y)};P.prototype.offset=function(a,b){this.v&&wa(this);this.transform(1,0,0,1,a,b);return this};P.prototype.scale=function(a,b){this.v&&wa(this);this.transform(a,0,0,b,0,0);return this};P.prototype.rotate=function(a,b,c){this.v&&wa(this);void 0===b&&(b=0);void 0===c&&(c=0);var d=od.alloc();d.reset();d.rotate(a,b,c);this.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);od.free(d);return this};
t=P.prototype;
t.transform=function(a,b,c,d,e,f){switch(this.type){case P.j:case P.C:case P.K:var g=this.ad;var h=this.bd;this.ad=g*a+h*c+e;this.bd=g*b+h*d+f;g=this.ic;h=this.uc;this.ic=g*a+h*c+e;this.uc=g*b+h*d+f;break;case P.o:for(var k=this.figures.l,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.l;for(var p=n.length,r=0;r<p;r++){var q=n[r];switch(q.type){case sd:case Pd:g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case Qd: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 Rd: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 Sd: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 Td:g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;if(0===q.radiusX||0===q.radiusY)break;0!==b&&(g=180*Math.atan2(b,a)/Math.PI,0>g&&(g+=360),q.xAxisRotation+=g);0>a&&(q.xAxisRotation=180-q.xAxisRotation,q.isClockwiseArc=!q.isClockwiseArc);0>d&&(q.xAxisRotation=-q.xAxisRotation,q.isClockwiseArc=!q.isClockwiseArc);q.radiusX*=Math.sqrt(a*a+c*c);
q.radiusY*=Math.sqrt(b*b+d*d);break;default:B("Unknown Segment type: "+q.type)}}}}this.qa=!0;return this};
t.$=function(a,b){void 0===b&&(b=0);var c=this.ad,d=this.bd,e=this.ic,f=this.uc;switch(this.type){case P.j:return M.Nb(c,d,e,f,b,a.x,a.y);case P.C: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.$(a);N.free(g);return a;case P.K:g=Math.min(c,e)-b;var h=Math.min(d,f)-b;c=(Math.abs(e-c)+2*b)/2;b=(Math.abs(f-d)+2*b)/2;if(0>=c||0>=b)return!1;g=a.x-(g+c);h=a.y-(h+b);return 1>=g*g/(c*c)+h*h/(b*b);case P.o:return Wd(this,a,b,!0,!1);default:return!1}};
function Wd(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.l,r=p.length,q=0;q<r;q++){var u=p[q];if(u.isFilled){if(d&&u.$(f,b,c))return!0;var w=u.segments;k=u.startX;l=u.startY;for(var v=k,y=l,z=w.l,A=0;A<=w.length;A++){var C=void 0;if(A!==w.length){C=z[A];var F=C.type;a=C.endX;n=C.endY}else F=sd,a=v,n=y;switch(F){case Pd:v=Xd(f,b,g,b,k,l,v,y);if(isNaN(v))return!0;h+=v;v=a;y=n;break;case sd:k=Xd(f,b,g,b,k,l,a,n);if(isNaN(k))return!0;h+=k;break;case Qd:m=M.Pp(k,l,C.point1X,
C.point1Y,C.point2X,C.point2Y,a,n,g,b,f,b,.5);h+=m;break;case Rd:m=M.Pp(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 Sd:case Td:F=C.type===Sd?Ud(C,u):Vd(C,u,k,l);var R=F.length;if(0===R){k=Xd(f,b,g,b,k,l,C.type===Sd?C.centerX:C.endX,C.type===Sd?C.centerY:C.endY);if(isNaN(k))return!0;h+=k;break}C=null;for(var J=0;J<R;J++){C=F[J];if(0===J){m=Xd(f,b,g,b,k,l,C[0],C[1]);if(isNaN(m))return!0;h+=m}m=M.Pp(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.$(f,b,e?c:c+2))return!0}return 0!==h}
function Xd(a,b,c,d,e,f,g,h){if(M.Nb(e,f,g,h,.05,a,b))return NaN;var k=(a-c)*(f-h);if(0===k)return 0;var l=((a*d-b*c)*(e-g)-(a-c)*(e*h-f*g))/k;b=(a*d-b*c)*(f-h)/k;if(l>=a)return 0;if((e>g?e-g:g-e)<(f>h?f-h:h-f))if(f<h){if(b<f||b>h)return 0}else{if(b<h||b>f)return 0}else if(e<g){if(l<e||l>g)return 0}else if(l<g||l>e)return 0;return 0<k?1:-1}function Yd(a,b,c,d){a=a.figures.l;for(var e=a.length,f=0;f<e;f++)if(a[f].$(b,c,d))return!0;return!1}
t.bv=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=new K);if(this.type===P.j)return b.h(this.startX+a*(this.endX-this.startX),this.startY+a*(this.endY-this.startY)),b;for(var c=this.flattenedSegments,d=this.flattenedLengths,e=c.length,f=this.flattenedTotalLength*a,g=0,h=0;h<e;h++){var k=d[h],l=k.length;for(a=0;a<l;a++){var m=k[a];if(g+m>=f)return d=f-g,d=0===m?0:d/m,c=c[h],h=c[2*a],e=c[2*a+1],b.h(h+(c[2*a+2]-h)*d,e+(c[2*a+3]-e)*d),b;g+=m}}return b};
t.Vx=function(a){0>a?a=0:1<a&&(a=1);if(this.type===P.j)return 180*Math.atan2(this.endY-this.startY,this.endX-this.startX)/Math.PI;for(var b=this.flattenedSegments,c=this.flattenedLengths,d=b.length,e=this.flattenedTotalLength*a,f=0,g=0;g<d;g++){var h=c[g],k=h.length;for(a=0;a<k;a++){var l=h[a];if(f+l>=e)return e=b[g],b=e[2*a],c=e[2*a+1],d=e[2*a+2],a=e[2*a+3],1>Math.abs(d-b)&&1>Math.abs(a-c)?0:1>Math.abs(d-b)?0<=a-c?90:270:1>Math.abs(a-c)?0<=d-b?0:180:180*Math.atan2(a-c,d-b)/Math.PI;f+=l}}return NaN};
t.cv=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=[]);b.length=3;if(this.type===P.j)return b[0]=this.startX+a*(this.endX-this.startX),b[1]=this.startY+a*(this.endY-this.startY),b[2]=180*Math.atan2(this.endY-this.startY,this.endX-this.startX)/Math.PI,b;for(var c=this.flattenedSegments,d=this.flattenedLengths,e=c.length,f=this.flattenedTotalLength*a,g=0,h=0;h<e;h++){var k=d[h],l=k.length;for(a=0;a<l;a++){var m=k[a];if(g+m>=f)return d=f-g,d=0===m?0:d/m,m=c[h],c=m[2*a],h=m[2*a+1],e=m[2*a+2],a=m[2*
a+3],b[0]=c+(e-c)*d,b[1]=h+(a-h)*d,b[2]=1>Math.abs(e-c)&&1>Math.abs(a-h)?0:1>Math.abs(e-c)?0<=a-h?90:270:1>Math.abs(a-h)?0<=e-c?0:180:180*Math.atan2(a-h,e-c)/Math.PI,b;g+=m}}return b};
t.Wx=function(a){if(this.type===P.j){var b=this.startX,c=this.startY,d=this.endX,e=this.endY;if(b!==d||c!==e){var f=a.x;a=a.y;if(b===d){if(c<e){var g=c;d=e}else g=e,d=c;return a<=g?g===c?0:1:a>=d?d===c?0:1:Math.abs(a-c)/(d-g)}if(c===e)return b<d?g=b:(g=d,d=b),f<=g?g===b?0:1:f>=d?d===b?0:1:Math.abs(f-b)/(d-g);g=(d-b)*(d-b)+(e-c)*(e-c);var h=K.alloc();M.Ih(b,c,d,e,f,a,h);a=h.x;f=h.y;K.free(h);return Math.sqrt(((a-b)*(a-b)+(f-c)*(f-c))/g)}}else if(this.type===P.C){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=K.alloc();e=Infinity;h=g=0;k=b.length;for(var m=l=0,n=0;n<k;n++)for(var p=b[n],r=c[n],q=p.length,u=0;u<q;u+=2){var w=
p[u],v=p[u+1];if(0!==u){M.Ih(l,m,w,v,a.x,a.y,d);var y=(d.x-a.x)*(d.x-a.x)+(d.y-a.y)*(d.y-a.y);y<e&&(e=y,g=h,g+=Math.sqrt((d.x-l)*(d.x-l)+(d.y-m)*(d.y-m)));h+=r[(u-2)/2]}l=w;m=v}K.free(d);a=g/f;return 0>a?0:1<a?1:a}return 0};
function Zd(a){if(null===a.yk){var b=a.yk=[],c=a.Pm=[],d=[],e=[];if(a.type===P.j)d.push(a.startX),d.push(a.startY),d.push(a.endX),d.push(a.endY),b.push(d),e.push(Math.sqrt((a.startX-a.endX)*(a.startX-a.endX)+(a.startY-a.endY)*(a.startY-a.endY))),c.push(e);else if(a.type===P.C)d.push(a.startX),d.push(a.startY),d.push(a.endX),d.push(a.startY),d.push(a.endX),d.push(a.endY),d.push(a.startX),d.push(a.endY),d.push(a.startX),d.push(a.startY),b.push(d),e.push(Math.abs(a.startX-a.endX)),e.push(Math.abs(a.startY-
a.endY)),e.push(Math.abs(a.startX-a.endX)),e.push(Math.abs(a.startY-a.endY)),c.push(e);else if(a.type===P.K){var f=new $d;f.startX=a.endX;f.startY=(a.startY+a.endY)/2;var g=new ae(Sd);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=Ud(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];M.Fe(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(be(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.l,m=l.length,n=0;n<m;n++){var p=l[n];switch(p.type){case Pd:4<=d.length&&(b.push(d),c.push(be(d)));d=[];d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;h=g;k=f;break;case sd:d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;break;case Qd:M.Fe(g,f,p.point1X,p.point1Y,p.point2X,p.point2Y,p.endX,p.endY,
.5,d);g=p.endX;f=p.endY;break;case Rd:M.lq(g,f,p.point1X,p.point1Y,p.endX,p.endY,.5,d);g=p.endX;f=p.endY;break;case Sd:var r=Ud(p,e),q=r.length;if(0===q){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(var u=0;u<q;u++){var w=r[u];M.Fe(g,f,w[2],w[3],w[4],w[5],w[6],w[7],.5,d);g=w[6];f=w[7]}break;case Td:r=Vd(p,e,g,f);q=r.length;u=p.endX;w=p.endY;if(0===q){d.push(u);d.push(w);g=u;f=w;break}for(u=0;u<q;u++)w=r[u],M.Fe(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(h),d.push(k))}4<=d.length&&(b.push(d),c.push(be(d)))}}}function be(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(wb(c,d,g,h)));c=g;d=h}return b}t.add=function(a){this.ij.add(a);return this};t.Cm=function(a,b,c,d,e,f,g,h){this.v&&wa(this);this.mf=(new O(a,b,e,f)).freeze();this.nf=(new O(c,d,g,h)).freeze();return this};
na.Object.defineProperties(P.prototype,{flattenedSegments:{get:function(){Zd(this);return this.yk}},flattenedLengths:{get:function(){Zd(this);return this.Pm}},flattenedTotalLength:{get:function(){var a=this.Qm;if(isNaN(a)){if(this.type===P.j){a=Math.abs(this.endX-this.startX);var b=Math.abs(this.endY-this.startY);a=Math.sqrt(a*a+b*b)}else if(this.type===P.C)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.Qm=a}return a}},type:{get:function(){return this.ha},set:function(a){this.ha!==a&&(this.v&&wa(this,a),this.ha=a,this.qa=!0)}},startX:{get:function(){return this.ad},set:function(a){this.ad!==a&&(this.v&&wa(this,a),this.ad=a,this.qa=!0)}},startY:{get:function(){return this.bd},set:function(a){this.bd!==
a&&(this.v&&wa(this,a),this.bd=a,this.qa=!0)}},endX:{get:function(){return this.ic},set:function(a){this.ic!==a&&(this.v&&wa(this,a),this.ic=a,this.qa=!0)}},endY:{get:function(){return this.uc},set:function(a){this.uc!==a&&(this.v&&wa(this,a),this.uc=a,this.qa=!0)}},figures:{get:function(){return this.ij},set:function(a){this.ij!==a&&(this.v&&wa(this,a),this.ij=a,this.qa=!0)}},spot1:{
get:function(){return this.mf},set:function(a){this.v&&wa(this,a);this.mf=a.I()}},spot2:{get:function(){return this.nf},set:function(a){this.v&&wa(this,a);this.nf=a.I()}},defaultStretch:{get:function(){return this.Of},set:function(a){this.v&&wa(this,a);this.Of=a}},bounds:{get:function(){this.nv()&&this.computeBounds();return this.Nq}}});P.prototype.setSpots=P.prototype.Cm;P.prototype.add=P.prototype.add;
P.prototype.getFractionForPoint=P.prototype.Wx;P.prototype.getPointAndAngleAlongPath=P.prototype.cv;P.prototype.getAngleAlongPath=P.prototype.Vx;P.prototype.getPointAlongPath=P.prototype.bv;P.prototype.containsPoint=P.prototype.$;P.prototype.transform=P.prototype.transform;P.prototype.rotate=P.prototype.rotate;P.prototype.scale=P.prototype.scale;P.prototype.offset=P.prototype.offset;P.prototype.normalize=P.prototype.normalize;P.prototype.computeBoundsWithoutOrigin=P.prototype.Ix;
P.prototype.equalsApprox=P.prototype.Ua;P.className="Geometry";P.j=new D(P,"Line",0);P.C=new D(P,"Rectangle",1);P.K=new D(P,"Ellipse",2);P.o=new D(P,"Path",3);P.Qb="UuBbMmZzLlHhVvCcSsQqTtAaFfXx";P.className="Geometry";P.stringify=P.wa;P.fillPath=P.Ma;P.parse=P.parse;P.Line=P.j;P.Rectangle=P.C;P.Ellipse=P.K;P.Path=P.o;
function $d(a,b,c,d){Va(this);this.Hw=null;this.v=!1;void 0===c&&(c=!0);this.kr=c;void 0===d&&(d=!0);this.qr=d;void 0!==a?this.ad=a:this.ad=0;void 0!==b?this.bd=b:this.bd=0;this.El=new E;this.Pr=this.El.Da;this.qa=!0}$d.prototype.copy=function(){var a=new $d;a.kr=this.kr;a.qr=this.qr;a.ad=this.ad;a.bd=this.bd;for(var b=this.El.l,c=b.length,d=a.El,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.Pr=this.Pr;a.qa=this.qa;a.Hw=this.Hw;return a};t=$d.prototype;
t.Ua=function(a){if(!(a instanceof $d&&M.w(this.startX,a.startX)&&M.w(this.startY,a.startY)))return!1;var b=this.segments.l;a=a.segments.l;var c=b.length;if(c!==a.length)return!1;for(var d=0;d<c;d++)if(!b[d].Ua(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.l,d=c.length,e=0;e<d;e++)b+=" "+c[e].toString(a);return b};
t.freeze=function(){this.v=!0;var a=this.segments;a.freeze();var b=a.l;a=a.length;for(var c=0;c<a;c++)b[c].freeze();return this};t.ea=function(){this.v=!1;var a=this.segments;a.ea();a=a.l;for(var b=a.length,c=0;c<b;c++)a[c].ea();return this};t.nv=function(){if(this.qa)return!0;var a=this.segments;if(this.Pr!==a.Da)return!0;a=a.l;for(var b=a.length,c=0;c<b;c++)if(a[c].qa)return!0;return!1};t.add=function(a){this.El.add(a);return this};
t.$=function(a,b,c){for(var d=this.startX,e=this.startY,f=d,g=e,h=this.segments.l,k=h.length,l=0;l<k;l++){var m=h[l];switch(m.type){case Pd:f=m.endX;g=m.endY;d=m.endX;e=m.endY;break;case sd:if(M.Nb(d,e,m.endX,m.endY,c,a,b))return!0;d=m.endX;e=m.endY;break;case Qd:if(M.js(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 Rd:if(M.Dv(d,e,m.point1X,m.point1Y,m.endX,m.endY,.5,a,b,c))return!0;d=m.endX;e=m.endY;break;case Sd:case Td:var n=m.type===
Sd?Ud(m,this):Vd(m,this,d,e),p=n.length,r=m.type===Sd?m.centerX:m.endX,q=m.type===Sd?m.centerY:m.endY;if(0===p){if(M.Nb(d,e,r,q,c,a,b))return!0;d=r;e=q;break}r=null;for(q=0;q<p;q++)if(r=n[q],0===q&&M.Nb(d,e,r[0],r[1],c,a,b)||M.js(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)&&M.Nb(d,e,f,g,c,a,b))return!0}return!1};
na.Object.defineProperties($d.prototype,{isFilled:{get:function(){return this.kr},set:function(a){this.v&&wa(this,a);this.kr=a}},isShadowed:{get:function(){return this.qr},set:function(a){this.v&&wa(this,a);this.qr=a}},startX:{get:function(){return this.ad},set:function(a){this.v&&wa(this,a);this.ad=a;this.qa=!0}},startY:{get:function(){return this.bd},set:function(a){this.v&&wa(this,
a);this.bd=a;this.qa=!0}},segments:{get:function(){return this.El},set:function(a){this.v&&wa(this,a);this.El=a;this.qa=!0}}});$d.prototype.add=$d.prototype.add;$d.prototype.equalsApprox=$d.prototype.Ua;$d.className="PathFigure";
function ae(a,b,c,d,e,f,g,h){Va(this);this.v=!1;void 0===a&&(a=sd);this.ha=a;void 0!==b?this.ic=b:this.ic=0;void 0!==c?this.uc=c:this.uc=0;void 0===d&&(d=0);void 0===e&&(e=0);void 0===f&&(f=0);void 0===g&&(g=0);a===Td?(a=f%360,0>a&&(a+=360),this.De=a,this.pi=0,this.ri=Math.max(d,0),this.gh=Math.max(e,0),this.jl="boolean"===typeof g?g:"number"===typeof g?!!g:!1,this.Ek=!!h):(this.De=d,this.pi=e,a===Sd&&(f=Math.max(f,0)),this.ri=f,"number"===typeof g?(a===Sd&&(g=Math.max(g,0)),this.gh=g):this.gh=0,
this.Ek=this.jl=!1);this.oj=!1;this.qa=!0;this.Sd=null}ae.prototype.copy=function(){var a=new ae;a.ha=this.ha;a.ic=this.ic;a.uc=this.uc;a.De=this.De;a.pi=this.pi;a.ri=this.ri;a.gh=this.gh;a.jl=this.jl;a.Ek=this.Ek;a.oj=this.oj;a.qa=this.qa;return a};t=ae.prototype;
t.Ua=function(a){if(!(a instanceof ae)||this.type!==a.type||this.isClosed!==a.isClosed)return!1;switch(this.type){case Pd:case sd:return M.w(this.endX,a.endX)&&M.w(this.endY,a.endY);case Qd:return M.w(this.endX,a.endX)&&M.w(this.endY,a.endY)&&M.w(this.point1X,a.point1X)&&M.w(this.point1Y,a.point1Y)&&M.w(this.point2X,a.point2X)&&M.w(this.point2Y,a.point2Y);case Rd:return M.w(this.endX,a.endX)&&M.w(this.endY,a.endY)&&M.w(this.point1X,a.point1X)&&M.w(this.point1Y,a.point1Y);case Sd:return M.w(this.startAngle,
a.startAngle)&&M.w(this.sweepAngle,a.sweepAngle)&&M.w(this.centerX,a.centerX)&&M.w(this.centerY,a.centerY)&&M.w(this.radiusX,a.radiusX)&&M.w(this.radiusY,a.radiusY);case Td:return this.isClockwiseArc===a.isClockwiseArc&&this.isLargeArc===a.isLargeArc&&M.w(this.xAxisRotation,a.xAxisRotation)&&M.w(this.endX,a.endX)&&M.w(this.endY,a.endY)&&M.w(this.radiusX,a.radiusX)&&M.w(this.radiusY,a.radiusY);default:return!1}};t.gb=function(a){a.classType===ae&&(this.type=a)};
t.toString=function(a){void 0===a&&(a=-1);switch(this.type){case Pd:a=0>a?"M"+this.endX.toString()+" "+this.endY.toString():"M"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case sd:a=0>a?"L"+this.endX.toString()+" "+this.endY.toString():"L"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Qd: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 Rd: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 Sd: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 Td: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.oj?"z":"")};t.freeze=function(){this.v=!0;return this};t.ea=function(){this.v=!1;return this};t.close=function(){this.oj=!0;return this};
function Ud(a,b){if(null!==a.Sd&&!1===b.qa)return a.Sd;var c=a.radiusX,d=a.radiusY;void 0===d&&(d=c);if(0===c||0===d)return a.Sd=[],a.Sd;b=a.De;var e=a.pi,f=M.Jx(0,0,c<d?c:d,a.startAngle,a.startAngle+a.sweepAngle,!1);if(c!==d){var g=od.alloc();g.reset();c<d?g.scale(1,d/c):g.scale(c/d,1);P.Ba(f,g);od.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.Sd=f;return a.Sd}
function Vd(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.Sd&&!1===b.qa)return a.Sd;if(0===a.radiusX||0===a.radiusY)return a.Sd=[],a.Sd;b=a.ri;var f=a.gh;0===b&&(b=1E-4);0===f&&(f=1E-4);var g=Math.PI/180*a.De,h=a.jl,k=a.Ek,l=a.ic,m=a.uc,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=M.Jx(0,0,b>f?b:f,m,m+g,!0);f=od.alloc();f.reset();f.translate(c,d);f.rotate(a.De,0,0);f.scale(k,r);P.Ba(b,f);od.free(f);a.Sd=b;return a.Sd}
na.Object.defineProperties(ae.prototype,{isClosed:{get:function(){return this.oj},set:function(a){this.oj!==a&&(this.oj=a,this.qa=!0)}},type:{get:function(){return this.ha},set:function(a){this.v&&wa(this,a);this.ha=a;this.qa=!0}},endX:{get:function(){return this.ic},set:function(a){this.v&&wa(this,a);this.ic=a;this.qa=!0}},endY:{get:function(){return this.uc},set:function(a){this.v&&
wa(this,a);this.uc=a;this.qa=!0}},point1X:{get:function(){return this.De},set:function(a){this.v&&wa(this,a);this.De=a;this.qa=!0}},point1Y:{get:function(){return this.pi},set:function(a){this.v&&wa(this,a);this.pi=a;this.qa=!0}},point2X:{get:function(){return this.ri},set:function(a){this.v&&wa(this,a);this.ri=a;this.qa=!0}},point2Y:{get:function(){return this.gh},set:function(a){this.v&&
wa(this,a);this.gh=a;this.qa=!0}},centerX:{get:function(){return this.De},set:function(a){this.v&&wa(this,a);this.De=a;this.qa=!0}},centerY:{get:function(){return this.pi},set:function(a){this.v&&wa(this,a);this.pi=a;this.qa=!0}},radiusX:{get:function(){return this.ri},set:function(a){0>a&&xa(a,">= zero",ae,"radiusX");this.v&&wa(this,a);this.ri=a;this.qa=!0}},radiusY:{get:function(){return this.gh},
set:function(a){0>a&&xa(a,">= zero",ae,"radiusY");this.v&&wa(this,a);this.gh=a;this.qa=!0}},startAngle:{get:function(){return this.ic},set:function(a){this.ic!==a&&(this.v&&wa(this,a),a%=360,0>a&&(a+=360),this.ic=a,this.qa=!0)}},sweepAngle:{get:function(){return this.uc},set:function(a){this.v&&wa(this,a);360<a&&(a=360);-360>a&&(a=-360);this.uc=a;this.qa=!0}},isClockwiseArc:{get:function(){return this.Ek},set:function(a){this.v&&
wa(this,a);this.Ek=a;this.qa=!0}},isLargeArc:{get:function(){return this.jl},set:function(a){this.v&&wa(this,a);this.jl=a;this.qa=!0}},xAxisRotation:{get:function(){return this.De},set:function(a){a%=360;0>a&&(a+=360);this.v&&wa(this,a);this.De=a;this.qa=!0}}});ae.prototype.equalsApprox=ae.prototype.Ua;
var Pd=new D(ae,"Move",0),sd=new D(ae,"Line",1),Qd=new D(ae,"Bezier",2),Rd=new D(ae,"QuadraticBezier",3),Sd=new D(ae,"Arc",4),Td=new D(ae,"SvgArc",4);ae.className="PathSegment";ae.Move=Pd;ae.Line=sd;ae.Bezier=Qd;ae.QuadraticBezier=Rd;ae.Arc=Sd;ae.SvgArc=Td;function ce(){this.D=null;this.xu=(new K(0,0)).freeze();this.Ht=(new K(0,0)).freeze();this.Gq=this.yr=0;this.Hq=1;this.di="";this.es=this.Vq=!1;this.Tq=this.Jq=0;this.yg=this.hr=this.nr=!1;this.Zq=null;this.cs=0;this.od=this.bs=null}
ce.prototype.copy=function(){var a=new ce;return this.clone(a)};ce.prototype.clone=function(a){a.D=this.D;a.xu.assign(this.viewPoint);a.Ht.assign(this.documentPoint);a.yr=this.yr;a.Gq=this.Gq;a.Hq=this.Hq;a.di=this.di;a.Vq=this.Vq;a.es=this.es;a.Jq=this.Jq;a.Tq=this.Tq;a.nr=this.nr;a.hr=this.hr;a.yg=this.yg;a.Zq=this.Zq;a.cs=this.cs;a.bs=this.bs;a.od=this.od;return a};
ce.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};ce.prototype.$p=function(a,b){var c=this.diagram;if(null===c)return b;de(c,this.event,a,b);return b};
ce.prototype.Zz=function(a,b){var c=this.diagram;if(null===c)return b;de(c,this.event,a,b);b.assign(c.Zs(b));return b};
na.Object.defineProperties(ce.prototype,{diagram:{get:function(){return this.D},set:function(a){this.D=a}},viewPoint:{get:function(){return this.xu},set:function(a){this.xu.assign(a)}},documentPoint:{get:function(){return this.Ht},set:function(a){this.Ht.assign(a)}},modifiers:{get:function(){return this.yr},set:function(a){this.yr=a}},button:{get:function(){return this.Gq},
set:function(a){this.Gq=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.Hq},set:function(a){this.Hq=a}},key:{get:function(){return this.di},set:function(a){this.di=a}},down:{get:function(){return this.Vq},set:function(a){this.Vq=a}},up:{get:function(){return this.es},set:function(a){this.es=
a}},clickCount:{get:function(){return this.Jq},set:function(a){this.Jq=a}},delta:{get:function(){return this.Tq},set:function(a){this.Tq=a}},isMultiTouch:{get:function(){return this.nr},set:function(a){this.nr=a}},handled:{get:function(){return this.hr},set:function(a){this.hr=a}},bubbles:{get:function(){return this.yg},set:function(a){this.yg=a}},event:{
get:function(){return this.Zq},set:function(a){this.Zq=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.cs},set:function(a){this.cs=a}},targetDiagram:{get:function(){return this.bs},set:function(a){this.bs=a}},targetObject:{
get:function(){return this.od},set:function(a){this.od=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}}});
ce.prototype.getMultiTouchDocumentPoint=ce.prototype.Zz;ce.prototype.getMultiTouchViewPoint=ce.prototype.$p;ce.className="InputEvent";function ee(){this.D=null;this.na="";this.Gr=this.Xr=null}ee.prototype.copy=function(){var a=new ee;a.D=this.D;a.na=this.na;a.Xr=this.Xr;a.Gr=this.Gr;return a};ee.prototype.toString=function(){var a="*"+this.name;null!==this.subject&&(a+=":"+this.subject.toString());null!==this.parameter&&(a+="("+this.parameter.toString()+")");return a};
na.Object.defineProperties(ee.prototype,{diagram:{get:function(){return this.D},set:function(a){this.D=a}},name:{get:function(){return this.na},set:function(a){this.na=a}},subject:{get:function(){return this.Xr},set:function(a){this.Xr=a}},parameter:{get:function(){return this.Gr},set:function(a){this.Gr=a}}});ee.className="DiagramEvent";
function fe(){this.Wm=ge;this.ff=this.xr="";this.Ao=this.Bo=this.Go=this.Ho=this.Fo=this.D=this.dc=null}fe.prototype.clear=function(){this.Ao=this.Bo=this.Go=this.Ho=this.Fo=this.D=this.dc=null};
fe.prototype.copy=function(){var a=new fe;a.Wm=this.Wm;a.xr=this.xr;a.ff=this.ff;a.dc=this.dc;a.D=this.D;a.Fo=this.Fo;var b=this.Ho;a.Ho=za(b)&&"function"===typeof b.I?b.I():b;b=this.Go;a.Go=za(b)&&"function"===typeof b.I?b.I():b;b=this.Bo;a.Bo=za(b)&&"function"===typeof b.I?b.I():b;b=this.Ao;a.Ao=za(b)&&"function"===typeof b.I?b.I():b;return a};fe.prototype.gb=function(a){a.classType===fe&&(this.change=a)};
fe.prototype.toString=function(){var a="";a=this.change===oe?a+"* ":this.change===ge?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===oe?null!==this.oldValue&&(a+=" "+this.oldValue):(null!==this.object&&(a+=Ka(this.object)),null!==this.oldValue&&(a+="  old: "+Ka(this.oldValue)),null!==
this.oldParam&&(a+=" "+this.oldParam),null!==this.newValue&&(a+="  new: "+Ka(this.newValue)),null!==this.newParam&&(a+=" "+this.newParam));return a};fe.prototype.H=function(a){return a?this.oldValue:this.newValue};fe.prototype.aA=function(a){return a?this.oldParam:this.newParam};fe.prototype.canUndo=function(){return null!==this.model||null!==this.diagram?!0:!1};
fe.prototype.undo=function(){this.canUndo()&&(null!==this.model?this.model.changeState(this,!0):null!==this.diagram&&this.diagram.changeState(this,!0))};fe.prototype.canRedo=function(){return null!==this.model||null!==this.diagram?!0:!1};fe.prototype.redo=function(){this.canRedo()&&(null!==this.model?this.model.changeState(this,!1):null!==this.diagram&&this.diagram.changeState(this,!1))};
na.Object.defineProperties(fe.prototype,{model:{get:function(){return this.dc},set:function(a){this.dc=a}},diagram:{get:function(){return this.D},set:function(a){this.D=a}},change:{get:function(){return this.Wm},set:function(a){this.Wm=a}},modelChange:{get:function(){return this.xr},set:function(a){this.xr=a}},propertyName:{get:function(){return this.ff},
set:function(a){this.ff=a}},isTransactionFinished:{get:function(){return this.Wm===oe&&("CommittedTransaction"===this.ff||"FinishedUndo"===this.ff||"FinishedRedo"===this.ff)}},object:{get:function(){return this.Fo},set:function(a){this.Fo=a}},oldValue:{get:function(){return this.Ho},set:function(a){this.Ho=a}},oldParam:{get:function(){return this.Go},set:function(a){this.Go=a}},
newValue:{get:function(){return this.Bo},set:function(a){this.Bo=a}},newParam:{get:function(){return this.Ao},set:function(a){this.Ao=a}}});fe.prototype.redo=fe.prototype.redo;fe.prototype.canRedo=fe.prototype.canRedo;fe.prototype.undo=fe.prototype.undo;fe.prototype.canUndo=fe.prototype.canUndo;fe.prototype.getParam=fe.prototype.aA;fe.prototype.getValue=fe.prototype.H;fe.prototype.clear=fe.prototype.clear;
var oe=new D(fe,"Transaction",-1),ge=new D(fe,"Property",0),pe=new D(fe,"Insert",1),qe=new D(fe,"Remove",2);fe.className="ChangedEvent";fe.Transaction=oe;fe.Property=ge;fe.Insert=pe;fe.Remove=qe;function re(){this.o=(new E).freeze();this.na="";this.j=!1}re.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.J(c);null!==d&&(b+="\n  "+d.toString())}}return b};
re.prototype.clear=function(){var a=this.changes;a.ea();for(var b=a.count-1;0<=b;b--){var c=a.J(b);null!==c&&c.clear()}a.clear();a.freeze()};re.prototype.canUndo=function(){return this.isComplete};re.prototype.undo=function(){if(this.canUndo())for(var a=this.changes.count-1;0<=a;a--){var b=this.changes.J(a);null!==b&&b.undo()}};re.prototype.canRedo=function(){return this.isComplete};
re.prototype.redo=function(){if(this.canRedo())for(var a=this.changes.count,b=0;b<a;b++){var c=this.changes.J(b);null!==c&&c.redo()}};
re.prototype.Ns=function(){if(this.isComplete){var a=this.changes;a.ea();for(var b=new H,c=0;c<a.count;c++){var d=a.J(c);if(null!==d&&d.change===ge&&d.object){var e=b.get(d.object);e||(e=new H,b.set(d.object,e));var f=e.get(d.propertyName);null===f?e.set(d.propertyName,-1):(0<f&&a.Pc(f,null),e.set(d.propertyName,c))}}for(c=b=0;c<a.count;c++)d=a.J(c),null!==d&&(c>b&&a.Pc(b,d),b++);for(;a.length>b;)a.pop();a.freeze()}};
na.Object.defineProperties(re.prototype,{changes:{get:function(){return this.o}},name:{get:function(){return this.na},set:function(a){this.na=a}},isComplete:{get:function(){return this.j},set:function(a){this.j=a}}});re.prototype.optimize=re.prototype.Ns;re.prototype.redo=re.prototype.redo;re.prototype.canRedo=re.prototype.canRedo;re.prototype.undo=re.prototype.undo;re.prototype.canUndo=re.prototype.canUndo;
re.prototype.clear=re.prototype.clear;re.className="Transaction";function se(){this.bu=new G;this.vd=!1;this.C=(new E).freeze();this.re=-1;this.o=999;this.te=!1;this.Rq=null;this.xi=0;this.j=!1;this.ze=(new E).freeze();this.sl=new E;this.Pt=!0;this.St=this.lr=this.Vt=this.Ut=!1}
se.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.J(d);b+="]";if(void 0!==a&&0<a)for(c=this.history.count,d=0;d<c;d++)b+="\n "+this.history.J(d).toString(a-1);return b};
se.prototype.clear=function(){var a=this.history;a.ea();for(var b=a.count-1;0<=b;b--){var c=a.J(b);null!==c&&c.clear()}a.clear();this.re=-1;a.freeze();this.te=!1;this.Rq=null;this.xi=0;this.ze.ea();this.ze.clear();this.ze.freeze();this.sl.clear();this.St=this.lr=this.Vt=this.Ut=!1};se.prototype.copyProperties=function(a){this.isEnabled=a.isEnabled;this.maxHistoryLength=a.maxHistoryLength;this.checksTransactionLevel=a.checksTransactionLevel};t=se.prototype;t.yx=function(a){this.bu.add(a)};t.uy=function(a){this.bu.remove(a)};
t.xa=function(a){void 0===a&&(a="");null===a&&(a="");if(this.isUndoingRedoing)return!1;!0===this.Pt&&(this.Pt=!1,this.xi++,this.isInternalTransaction||this.Db("StartingFirstTransaction",a,this.currentTransaction),0<this.xi&&this.xi--);this.isEnabled&&(this.ze.ea(),this.ze.add(a),this.ze.freeze(),null===this.currentTransaction?this.sl.add(0):this.sl.add(this.currentTransaction.changes.count));this.xi++;var b=1===this.transactionLevel;b&&(this.isInternalTransaction||this.Db("StartedTransaction",a,this.currentTransaction));
return b};t.Xa=function(a){void 0===a&&(a="");return te(this,!0,a)};t.Hf=function(){return te(this,!1,"")};
function te(a,b,c){if(a.isUndoingRedoing)return!1;a.checksTransactionLevel&&1>a.transactionLevel&&ya("Ending transaction without having started a transaction: "+c);var d=1===a.transactionLevel,e=a.currentTransaction;d&&b&&(a.isInternalTransaction||a.Db("CommittingTransaction",c,e));var f=0;if(0<a.transactionLevel&&(a.xi--,a.isEnabled)){var g=a.ze.count;0<g&&(""===c&&(c=a.ze.J(0)),a.ze.ea(),a.ze.eb(g-1),a.ze.freeze());g=a.sl.count;0<g&&(f=a.sl.J(g-1),a.sl.eb(g-1))}if(d){if(b){a.lr=!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.J(d),null!==f&&f.clear(),b.eb(d),a.lr=!0;d=a.maxHistoryLength;0<=d&&(0===d?b.clear():b.count>=d&&(f=b.J(0),null!==f&&f.clear(),b.eb(0),a.re--));0===d||0!==b.count&&b.get(b.count-1)===e||(b.add(e),a.re++);b.freeze()}a.isInternalTransaction||a.Db("CommittedTransaction",c,e)}else{a.te=!0;try{a.isEnabled&&null!==e&&(e.isComplete=!0,e.undo())}finally{a.isInternalTransaction||
a.Db("RolledBackTransaction",c,e),a.te=!1}null!==e&&e.clear()}a.Rq=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.J(e),null!==b&&b.undo(),c.ea(),c.eb(e);c.freeze()}return!1}se.prototype.canUndo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToUndo;return null!==a&&a.canUndo()?!0:!1};
se.prototype.undo=function(){if(this.canUndo()){var a=this.transactionToUndo;try{this.te=!0,this.Db("StartingUndo","Undo",a),this.re--,a.undo()}catch(b){ya("undo error: "+b.toString())}finally{this.Db("FinishedUndo","Undo",a),this.te=!1}}};se.prototype.canRedo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToRedo;return null!==a&&a.canRedo()?!0:!1};
se.prototype.redo=function(){if(this.canRedo()){var a=this.transactionToRedo;try{this.te=!0,this.Db("StartingRedo","Redo",a),this.re++,a.redo()}catch(b){ya("redo error: "+b.toString())}finally{this.Db("FinishedRedo","Redo",a),this.te=!1}}};se.prototype.Db=function(a,b,c){void 0===c&&(c=null);var d=new fe;d.change=oe;d.propertyName=a;d.object=c;d.oldValue=b;for(a=this.models;a.next();)b=a.value,d.model=b,b.ks(d)};
se.prototype.gv=function(a){if(this.isEnabled&&!this.isUndoingRedoing&&!this.skipsEvent(a)){var b=this.currentTransaction;null===b&&(this.Rq=b=new re);var c=a.copy();b=b.changes;b.ea();b.add(c);b.freeze();this.checksTransactionLevel&&0>=this.transactionLevel&&!this.Pt&&(a=a.diagram,null!==a&&!1===a.Oi||ya("Change not within a transaction: "+c.toString()))}};
se.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};
na.Object.defineProperties(se.prototype,{models:{get:function(){return this.bu.iterator}},isEnabled:{get:function(){return this.vd},set:function(a){this.vd=a}},transactionToUndo:{get:function(){return 0<=this.historyIndex&&this.historyIndex<=this.history.count-1?this.history.J(this.historyIndex):null}},transactionToRedo:{get:function(){return this.historyIndex<this.history.count-
1?this.history.J(this.historyIndex+1):null}},isUndoingRedoing:{get:function(){return this.te}},history:{get:function(){return this.C}},maxHistoryLength:{get:function(){return this.o},set:function(a){this.o=a}},historyIndex:{get:function(){return this.re}},currentTransaction:{get:function(){return this.Rq}},transactionLevel:{
get:function(){return this.xi}},isInTransaction:{get:function(){return 0<this.xi}},checksTransactionLevel:{get:function(){return this.j},set:function(a){this.j=a}},nestedTransactionNames:{get:function(){return this.ze}},isPendingClear:{get:function(){return this.Ut},set:function(a){this.Ut=a}},isPendingUnmodified:{get:function(){return this.Vt},set:function(a){this.Vt=
a}},isInternalTransaction:{get:function(){return this.St},set:function(a){this.St=a}},isJustDiscarded:{get:function(){return this.lr}}});se.prototype.handleChanged=se.prototype.gv;se.prototype.redo=se.prototype.redo;se.prototype.undo=se.prototype.undo;se.prototype.canUndo=se.prototype.canUndo;se.prototype.rollbackTransaction=se.prototype.Hf;se.prototype.commitTransaction=se.prototype.Xa;se.prototype.startTransaction=se.prototype.xa;
se.prototype.removeModel=se.prototype.uy;se.prototype.addModel=se.prototype.yx;se.prototype.clear=se.prototype.clear;se.className="UndoManager";function ue(){Va(this);this.D=ve;this.na="";this.vd=!0;this.Qb=!1;this.bj=null;this.Wy=new ce;this.gs=-1}ue.prototype.toString=function(){return""!==this.name?this.name+" Tool":Ja(this.constructor)};ue.prototype.updateAdornments=function(){};ue.prototype.canStart=function(){return this.isEnabled};ue.prototype.doStart=function(){};
ue.prototype.doActivate=function(){this.isActive=!0};ue.prototype.doDeactivate=function(){this.isActive=!1};ue.prototype.doStop=function(){};ue.prototype.doCancel=function(){this.transactionResult=null;this.stopTool()};ue.prototype.stopTool=function(){var a=this.diagram;a.currentTool===this&&(a.currentTool=null,a.currentCursor="")};ue.prototype.doMouseDown=function(){!this.isActive&&this.canStart()&&this.doActivate()};ue.prototype.doMouseMove=function(){};ue.prototype.doMouseUp=function(){this.stopTool()};
ue.prototype.doMouseWheel=function(){};ue.prototype.canStartMultiTouch=function(){return!0};ue.prototype.standardPinchZoomStart=function(){var a=this.diagram,b=a.lastInput,c=b.$p(0,K.allocAt(NaN,NaN)),d=b.$p(1,K.allocAt(NaN,NaN));if(c.u()&&d.u()&&(this.doCancel(),a.cm("hasGestureZoom"))){a.ax=a.scale;var e=d.x-c.x,f=d.y-c.y;a.kx=Math.sqrt(e*e+f*f);b.bubbles=!1}K.free(c);K.free(d)};
ue.prototype.standardPinchZoomMove=function(){var a=this.diagram,b=a.lastInput,c=b.$p(0,K.allocAt(NaN,NaN)),d=b.$p(1,K.allocAt(NaN,NaN));if(c.u()&&d.u()&&(this.doCancel(),a.cm("hasGestureZoom"))){var e=d.x-c.x,f=d.y-c.y;f=Math.sqrt(e*e+f*f)/a.kx;e=new K((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.ax;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}K.free(c);K.free(d)};
ue.prototype.doKeyDown=function(){"Esc"===this.diagram.lastInput.key&&this.doCancel()};ue.prototype.doKeyUp=function(){};ue.prototype.xa=function(a){void 0===a&&(a=this.name);this.transactionResult=null;return this.diagram.xa(a)};ue.prototype.stopTransaction=function(){var a=this.diagram;return null===this.transactionResult?a.Hf():a.Xa(this.transactionResult)};
ue.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.lastInput,c=a.am(b.documentPoint,!1);if(null!==c)if(Ta?b.meta:b.control){a.S("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!b.isSelected);a.S("ChangedSelection",a.selection)}else if(b.shift){if(!c.isSelected){a.S("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!0);a.S("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||(Ta?b.meta:b.control)||b.shift||a.clearSelection()}};ue.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.Zb(d.documentPoint,a,b);d.targetObject=a;we(a,d,c);return d.handled};
function we(a,b,c){b.handled=!1;if(null===a||a.Ef()){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.S(e,a)}else{switch(d){case 1:e="BackgroundSingleClicked";break;case 2:e="BackgroundDoubleClicked";break;case 3:e="BackgroundContextClicked"}0!==d&&c.S(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)}}}
ue.prototype.standardMouseOver=function(){var a=this.diagram,b=a.lastInput;if(!0!==a.animationManager.sb){var c=a.skipsUndoManager;a.skipsUndoManager=!0;var d=a.viewportBounds.$(b.documentPoint)?a.Zb(b.documentPoint,null,null):null;b.targetObject=d;var e=!1;if(d!==a.Kk){var f=a.Kk,g=f;a.Kk=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.sg(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.sg(d))break;g(b,d,f);e=!0;if(b.handled)break}d=d.panel}d=a.Kk}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.Fb();a.skipsUndoManager=c}};ue.prototype.doCurrentObjectChanged=function(){};
ue.prototype.standardMouseWheel=function(){var a=this.diagram,b=a.lastInput,c=b.delta;if(0!==c&&a.documentBounds.u()){var d=a.commandHandler,e=a.toolManager.mouseWheelBehavior;if(null!==d&&(e===xe&&!b.shift||e===ye&&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===xe&&b.shift||e===ye&&!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(Ra||Sa)h=1,0<e&&(e=3),0>e&&(e=-3),0<g&&(g=3),0>g&&(g=-3);if(void 0===h||void 0===e||void 0===g||0===e&&0===g||b.shift)!b.shift&&a.allowVerticalScroll?(f=3*f*a.scrollVerticalLineChange,0<c?a.scroll("pixel","up",f):a.scroll("pixel","down",f)):b.shift&&a.allowHorizontalScroll&&(f=3*f*a.scrollHorizontalLineChange,0<c?a.scroll("pixel","left",f):a.scroll("pixel","right",f));else{switch(h){case 0:c="pixel";break;case 1:c="line";break;case 2:c="page";break;default:c="pixel"}0!==e&&a.allowHorizontalScroll&&
(e*=a.scrollHorizontalLineChange/16,0<e?a.scroll(c,"left",-e):a.scroll(c,"right",e));0!==g&&a.allowVerticalScroll&&(g*=a.scrollVerticalLineChange/16,0<g?a.scroll(c,"up",-g):a.scroll(c,"down",g))}a.position.A(d)||(b.bubbles=!1)}}};ue.prototype.standardWaitAfter=function(a,b){void 0===b&&(b=this.diagram.lastInput);this.cancelWaitAfter();var c=this,d=b.clone(this.Wy);this.gs=ua(function(){c.doWaitAfter(d)},a)};ue.prototype.cancelWaitAfter=function(){-1!==this.gs&&x.clearTimeout(this.gs);this.gs=-1};
ue.prototype.doWaitAfter=function(){};ue.prototype.findToolHandleAt=function(a,b){a=this.diagram.Zb(a,function(a){for(;null!==a&&!(a.panel instanceof ze);)a=a.panel;return a});return null===a?null:a.part.category===b?a:null};ue.prototype.isBeyondDragSize=function(a,b){var c=this.diagram;void 0===a&&(a=c.firstInput.viewPoint);void 0===b&&(b=c.lastInput.viewPoint);var d=c.toolManager.dragSize,e=d.width;d=d.height;c.firstInput.isTouchEvent&&(e+=6,d+=6);return Math.abs(b.x-a.x)>e||Math.abs(b.y-a.y)>d};
na.Object.defineProperties(ue.prototype,{diagram:{get:function(){return this.D},set:function(a){a instanceof Q&&(this.D=a)}},name:{get:function(){return this.na},set:function(a){this.na=a}},isEnabled:{get:function(){return this.vd},set:function(a){this.vd=a}},isActive:{get:function(){return this.Qb},set:function(a){this.Qb=a}},transactionResult:{get:function(){return this.bj},
set:function(a){this.bj=a}}});ue.prototype.startTransaction=ue.prototype.xa;ue.className="Tool";function Pa(){ue.call(this);this.name="ToolManager";this.Gb=new E;this.Rb=new E;this.tc=new E;this.K=this.wa=850;this.o=(new Gb(2,2)).ca();this.Ma=5E3;this.Ba=ye;this.C=Ae;this.Qq=this.j=null;this.Lj=-1}ma(Pa,ue);Pa.prototype.initializeStandardTools=function(){};
Pa.prototype.updateAdornments=function(a){var b=this.currentToolTip;if(b instanceof ze&&this.Qq===a){var c=b.adornedObject;(null!==a?c.part===a:null===c)?this.showToolTip(b,c):this.hideToolTip()}};
Pa.prototype.doMouseDown=function(){var a=this.diagram,b=a.lastInput;b.isTouchEvent&&this.gestureBehavior===Be&&(b.bubbles=!1);if(b.isMultiTouch){this.cancelWaitAfter();if(this.gestureBehavior===Ce){b.bubbles=!0;return}if(this.gestureBehavior===Be)return;if(a.currentTool.canStartMultiTouch()){a.currentTool.standardPinchZoomStart();return}}for(var c=this.mouseDownTools.length,d=0;d<c;d++){var e=this.mouseDownTools.J(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===ye?this.mouseWheelBehavior=xe:this.mouseWheelBehavior===xe&&(this.mouseWheelBehavior=ye));this.doActivate();this.standardWaitAfter(this.holdDelay,b)};
Pa.prototype.doMouseMove=function(){var a=this.diagram,b=a.lastInput;if(b.isMultiTouch){if(this.gestureBehavior===Ce){b.bubbles=!0;return}if(this.gestureBehavior===Be)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.J(d);e.diagram=this.diagram;if(e.canStart()){a.doFocus();a.currentTool=e;a.currentTool===e&&(e.isActive||e.doActivate(),e.doMouseMove());return}}De(this,
a);a=b.event;null===a||"pointermove"!==a.type&&a.cancelable||(b.bubbles=!0)};function De(a,b){a.standardMouseOver();a.isBeyondDragSize()&&a.standardWaitAfter(a.isActive?a.holdDelay:a.hoverDelay,b.lastInput)}Pa.prototype.doCurrentObjectChanged=function(a,b){a=this.currentToolTip;null===a||null!==b&&a instanceof ze&&(b===a||b.sg(a))||this.hideToolTip()};
Pa.prototype.doWaitAfter=function(a){var b=this.diagram;b.Ca&&(this.doMouseHover(),this.isActive||this.doToolTip(),a.isTouchEvent&&!b.lastInput.handled&&(a=a.copy(),a.button=2,a.buttons=2,b.lastInput=a,b.su=!0,b.doMouseUp()))};
Pa.prototype.doMouseHover=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.Zb(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)};
Pa.prototype.doToolTip=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.Zb(b.documentPoint,null,null));b=b.targetObject;if(null!==b){if(a=this.currentToolTip,!(a instanceof ze)||b!==a&&!b.sg(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()};
Pa.prototype.showToolTip=function(a,b){var c=this.diagram;a!==this.currentToolTip&&this.hideToolTip();if(a instanceof ze){a.layerName="Tool";a.selectable=!1;a.scale=1/c.scale;a.category="ToolTip";null!==a.placeholder&&(a.placeholder.scale=c.scale);var d=a.diagram;null!==d&&d!==c&&d.remove(a);c.add(a);null!==b?a.adornedObject=b:a.data=c.model;a.Ta();this.positionToolTip(a,b)}else a instanceof Ee&&a!==this.currentToolTip&&a.show(b,c,this);this.currentToolTip=a;-1!==this.Lj&&(x.clearTimeout(this.Lj),
this.Lj=-1);a=this.toolTipDuration;if(0<a&&Infinity!==a){var e=this;this.Lj=ua(function(){e.hideToolTip()},a)}};Pa.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}};
Pa.prototype.hideToolTip=function(){-1!==this.Lj&&(x.clearTimeout(this.Lj),this.Lj=-1);var a=this.diagram,b=this.currentToolTip;null!==b&&(b instanceof ze?(a.remove(b),null!==this.Qq&&this.Qq.Gf(b.category),b.data=null,b.adornedObject=null):b instanceof Ee&&null!==b.hide&&b.hide(a,this),this.currentToolTip=null)};
Pa.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.J(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()};Pa.prototype.doMouseWheel=function(){this.standardMouseWheel()};Pa.prototype.doKeyDown=function(){var a=this.diagram;null!==a.commandHandler&&a.commandHandler.doKeyDown()};
Pa.prototype.doKeyUp=function(){var a=this.diagram;null!==a.commandHandler&&a.commandHandler.doKeyUp()};Pa.prototype.findTool=function(a){for(var b=this.mouseDownTools.length,c=0;c<b;c++){var d=this.mouseDownTools.J(c);if(d.name===a)return d}b=this.mouseMoveTools.length;for(c=0;c<b;c++)if(d=this.mouseMoveTools.J(c),d.name===a)return d;b=this.mouseUpTools.length;for(c=0;c<b;c++)if(d=this.mouseUpTools.J(c),d.name===a)return d;return null};
Pa.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.J(d);if(e.name===a)return null!==b?this.mouseDownTools.Pc(d,b):this.mouseDownTools.eb(d),e}c=this.mouseMoveTools.length;for(d=0;d<c;d++)if(e=this.mouseMoveTools.J(d),e.name===a)return null!==b?this.mouseMoveTools.Pc(d,b):this.mouseMoveTools.eb(d),e;c=this.mouseUpTools.length;for(d=0;d<c;d++)if(e=this.mouseUpTools.J(d),e.name===a)return null!==b?this.mouseUpTools.Pc(d,
b):this.mouseUpTools.eb(d),e;return null};Pa.prototype.Za=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)};
na.Object.defineProperties(Pa.prototype,{mouseWheelBehavior:{get:function(){return this.Ba},set:function(a){this.Ba=a}},gestureBehavior:{get:function(){return this.C},set:function(a){this.C=a}},currentToolTip:{get:function(){return this.j},set:function(a){this.j=a;this.Qq=null!==a&&a instanceof ze?a.adornedPart:null}},mouseDownTools:{get:function(){return this.Gb}},mouseMoveTools:{
get:function(){return this.Rb}},mouseUpTools:{get:function(){return this.tc}},hoverDelay:{get:function(){return this.wa},set:function(a){this.wa=a}},holdDelay:{get:function(){return this.K},set:function(a){this.K=a}},dragSize:{get:function(){return this.o},set:function(a){this.o=a.I()}},toolTipDuration:{get:function(){return this.Ma},set:function(a){this.Ma=
a}}});Pa.prototype.replaceStandardTool=Pa.prototype.Za;var ye=new D(Pa,"WheelScroll",0),xe=new D(Pa,"WheelZoom",1),Ke=new D(Pa,"WheelNone",2),Ae=new D(Pa,"GestureZoom",3),Be=new D(Pa,"GestureCancel",4),Ce=new D(Pa,"GestureNone",5);Pa.className="ToolManager";Pa.WheelScroll=ye;Pa.WheelZoom=xe;Pa.WheelNone=Ke;Pa.GestureZoom=Ae;Pa.GestureCancel=Be;Pa.GestureNone=Ce;
function Le(){ue.call(this);this.name="Dragging";this.C=this.Rb=!0;this.o=this.Ma=this.wa=this.cg=null;this.sn=this.tc=!1;this.Kl=new K(NaN,NaN);this.Vr=new K;this.Gb=!0;this.Qk=100;this.Kg=[];this.je=(new G).freeze();this.Ba=new Me;this.co=null;this.K="copy";this.Nd="";this.Od="no-drop"}ma(Le,ue);
Le.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.Qk)?!1:null!==this.findDraggablePart()};
Le.prototype.findDraggablePart=function(){var a=this.diagram;a=a.am(a.firstInput.documentPoint,!1);if(null===a)return null;for(;null!==a&&!a.canSelect();)a=a.containingGroup;return null!==a&&(a.canMove()||a.canCopy())?a:null};
Le.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.am(a.firstInput.documentPoint,!1);if(null!==b){for(;null!==b&&!b.canSelect();)b=b.containingGroup;this.currentPart=b;null===this.currentPart||this.currentPart.isSelected||(a.S("ChangingSelection",a.selection),b=a.lastInput,(Ta?b.meta:b.control)||b.shift||a.clearSelection(!0),this.currentPart.isSelected=!0,a.S("ChangedSelection",a.selection))}}};
Le.prototype.doActivate=function(){var a=this.diagram;this.co=null;null===this.currentPart&&this.standardMouseSelect();var b=this.currentPart;null!==b&&(b.canMove()||b.canCopy())&&(a.Iu(!0),Ne=null,this.isActive=!0,this.Kl.set(a.position),Oe(this,a.selection),this.Kg.length=0,a.animationManager.sc(),this.draggedParts=this.computeEffectiveCollection(a.selection,this.dragOptions),a.Xs=!0,!0===a.Ie("temporaryPixelRatio")&&30<a.Bx&&Pe(a),Qe(a,this.draggedParts),this.xa("Drag"),this.startPoint=a.firstInput.documentPoint,
a.isMouseCaptured=!0,a.allowDragOut&&(this.isDragOutStarted=!0,this.sn=!1,Ne=this,Re=this.diagram,this.doSimulatedDragOut()))};function Oe(a,b){if(a.dragsLink){var c=a.diagram;c.allowRelink&&(c.model.dk()&&1===b.count&&b.first()instanceof T?(a.draggedLink=b.first(),a.draggedLink.canRelinkFrom()&&a.draggedLink.canRelinkTo()&&a.draggedLink.Qj(),a.cg=c.toolManager.findTool("Relinking"),null===a.cg&&(a.cg=new Se,a.cg.diagram=c)):(a.draggedLink=null,a.cg=null))}}
Le.prototype.computeEffectiveCollection=function(a,b){return this.diagram.commandHandler.computeEffectiveCollection(a,b)};Le.prototype.Ad=function(a){return void 0===a?new Te(zb):this.isGridSnapEnabled?new Te(new K(Math.round(1E3*a.x)/1E3,Math.round(1E3*a.y)/1E3)):new Te(a.copy())};
Le.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.Iu(!1);a.ug();Ue(this);Ve(a,this.draggedParts);this.draggedParts=this.currentPart=this.co=null;this.sn=this.isDragOutStarted=!1;if(0<We.count){for(var b=We,c=b.length,d=0;d<c;d++){var e=b.J(d);Xe(e);af(e);Ue(e);e.diagram.ug()}b.clear()}Xe(this);this.Kl.h(NaN,NaN);null!==Re&&(Re.currentCursor="");Ne=Re=null;af(this);a.isMouseCaptured=!1;a.currentCursor="";a.Xs=!1;this.stopTransaction();bf(a,!0)};
Le.prototype.stopTransaction=function(){var a=this.diagram,b=ue.prototype.stopTransaction.call(this);b&&null!==a.undoManager.transactionToUndo&&a.undoManager.transactionToUndo.Ns();return b};function Ue(a){var b=a.diagram,c=b.skipsUndoManager;b.skipsUndoManager=!0;cf(a,b.lastInput,null);b.skipsUndoManager=c;a.Kg.length=0}function df(){var a=Ne;af(a);ef(a);var b=a.diagram;a.Kl.u()&&(b.position=a.Kl);b.ug()}
Le.prototype.doCancel=function(){af(this);ef(this);var a=this.diagram;this.Kl.u()&&(a.position=this.Kl);this.stopTool()};Le.prototype.doKeyDown=function(){var a=this.diagram,b=a.lastInput;this.isActive&&("Esc"===b.key?this.doCancel():b.key!==a.previousInput.key&&this.doMouseMove())};Le.prototype.doKeyUp=function(){this.isActive&&this.doMouseMove()};
function ff(a,b){if(null===a.copiedParts){var c=a.diagram;if((!b||!c.isReadOnly&&!c.isModelReadOnly)&&null!==a.draggedParts){var d=c.undoManager;d.isEnabled&&d.isInTransaction?null!==d.currentTransaction&&0<d.currentTransaction.changes.count&&(c.undoManager.Hf(),c.xa("Drag")):ef(a);c.skipsUndoManager=!b;c.partManager.addsToTemporaryLayer=!b;a.startPoint=c.firstInput.documentPoint;b=a.copiesEffectiveCollection?a.draggedParts.If():c.selection;b=c.Vj(b,c,!0);c=new H;for(d=a.draggedParts.iterator;d.next();){var e=
d.key;if(e.Nc()&&e.canCopy()){var f=b.H(e);null!==f&&(f.location=e.location,f.Ta(),c.add(f,a.Ad(f.location)))}}for(b=b.iterator;b.next();)d=b.value,d instanceof T&&d.canCopy()&&c.add(d,a.Ad());a.copiedParts=c;Oe(a,c.If());null!==a.draggedLink&&(c=a.draggedLink,b=c.routeBounds,gf(c,a.startPoint.x-(b.x+b.width/2),a.startPoint.y-(b.y+b.height/2)));a.doUpdateCursor(null,!0)}}}
function af(a){var b=a.diagram;if(null!==a.copiedParts){b.Rs(a.copiedParts.If(),!1);a.copiedParts=null;if(null!==a.draggedParts)for(var c=a.draggedParts.iterator;c.next();)c.key instanceof T&&(c.value.point=new K(0,0));a.doUpdateCursor(null,!0)}b.skipsUndoManager=!1;b.partManager.addsToTemporaryLayer=!1;a.startPoint=b.firstInput.documentPoint}
function Xe(a){if(null!==a.draggedLink){if(a.dragsLink&&null!==a.cg){var b=a.cg;b.diagram.remove(b.temporaryFromNode);b.diagram.remove(b.temporaryToNode)}a.draggedLink=null;a.cg=null}}function hf(a,b,c){var d=a.diagram,e=a.startPoint,f=K.alloc();f.assign(d.lastInput.documentPoint);a.moveParts(b,f.he(e),c);K.free(f);!0===d.Ie("temporaryPixelRatio")&&null===d.si&&30<d.Bx&&(Pe(d),d.oq())}
Le.prototype.moveParts=function(a,b,c){void 0===c&&(c=!1);var d=this.diagram;null!==d&&jf(d,a,b,this.dragOptions,c)};function ef(a){if(null!==a.draggedParts){for(var b=a.diagram,c=a.draggedParts.iterator;c.next();){var d=c.key;d.Nc()&&(d.location=c.value.point)}for(c=a.draggedParts.iterator;c.next();)if(d=c.key,d instanceof T&&d.suspendsRouting){var e=c.value.point;a.draggedParts.add(d,a.Ad());gf(d,-e.x,-e.y)}b.gd()}}
function kf(a,b){var c=a.diagram;a.dragsLink&&(null!==a.draggedLink&&(a.draggedLink.fromNode=null,a.draggedLink.toNode=null),lf(a,!1));var d=a.findDragOverObject(b),e=c.lastInput;e.targetObject=d;a.doUpdateCursor(d,!1);var f=c.skipsUndoManager,g=!1;try{c.skipsUndoManager=!0;g=cf(a,e,d);if(!a.isActive&&null===Ne)return;var h=null!==d?d.part:null;if(null===h||c.handlesDragDropForTopLevelParts&&h.isTopLevel&&!(h instanceof U)){var k=c.mouseDragOver;null!==k&&(k(e),g=!0)}if(!a.isActive&&null===Ne)return;
a.doDragOver(b,d);if(!a.isActive&&null===Ne)return}finally{c.skipsUndoManager=f,g&&c.gd()}a.co=d;c.isReadOnly||!c.allowMove&&!c.allowCopy||!c.allowHorizontalScroll&&!c.allowVerticalScroll||c.ns(e.viewPoint)}Le.prototype.findDragOverObject=function(a){var b=this;return mf(this.diagram,a,null,function(a){null===a?a=!0:(a=a.part,a=null===a||a instanceof ze||a.layer.isTemporary||b.draggedParts&&b.draggedParts.contains(a)||b.copiedParts&&b.copiedParts.contains(a)?!0:!1);return!a})};
Le.prototype.doUpdateCursor=function(a,b){var c=this.diagram;if(b||this.co!==a)!this.diagram.currentTool.isActive||this.mayCopy()?c.currentCursor=this.copyCursor:this.mayMove()?c.currentCursor=this.moveCursor:this.mayDragOut()&&(c.currentCursor=this.nodropCursor)};
function cf(a,b,c){var d=!1,e=a.Kg.length,f=0<e?a.Kg[0]:null;if(c===f)return!1;b.handled=!1;for(var g=0;g<e;g++){var h=a.Kg[g],k=h.mouseDragLeave;if(null!==k&&(k(b,h,c),d=!0,b.handled))break}a.Kg.length=0;if(!a.isActive&&null===Ne||null===c)return d;b.handled=!1;for(e=c;null!==e;)a.Kg.push(e),e=nf(e);e=a.Kg.length;for(c=0;c<e&&(g=a.Kg[c],h=g.mouseDragEnter,null===h||(h(b,g,f),d=!0,!b.handled));c++);return d}
function nf(a){var b=a.panel;return null!==b?b:a instanceof V&&!(a instanceof U)&&(a=a.containingGroup,null!==a&&a.handlesDragDropForMembers)?a:null}function of(a,b,c){var d=a.cg;if(null===d)return null;var e=a.diagram.qg(b,d.portGravity,function(a){return d.findValidLinkablePort(a,c)});a=K.alloc();var f=Infinity,g=null;for(e=e.iterator;e.next();){var h=e.value;if(null!==h.part){var k=h.da(yc,a);k=b.xf(k);k<f&&(g=h,f=k)}}K.free(a);return g}
function lf(a,b){var c=a.draggedLink;if(null!==c&&!(2>c.pointsCount)){var d=a.diagram;if(!d.isReadOnly){var e=a.cg;if(null!==e){var f=null,g=null;null===c.fromNode&&(f=of(a,c.i(0),!1),null!==f&&(g=f.part));var h=null,k=null;null===c.toNode&&(h=of(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.S("LinkRelinked",c,d.oy),c.toPort!==d.py&&d.S("LinkRelinked",c,d.py)):pf(e,g,f,k,h):pf(e,null,null,null,null)}}}}Le.prototype.doDragOver=function(){};
function qf(a,b){var c=a.diagram;a.dragsLink&&lf(a,!0);Ue(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;rf(a,e,f);f=nf(f)}}else f=c.mouseDrop,null!==f&&f(e);if(a.isActive||null!==Ne){for(e=(a.copiedParts||a.draggedParts).iterator;e.next();)f=e.key,f instanceof W&&f.linksConnected.each(function(a){a.suspendsRouting=!1});a.doDropOnto(b,d);if(a.isActive||null!==Ne){a=N.alloc();for(b=
c.selection.iterator;b.next();)d=b.value,d instanceof W&&sf(c,d,a);N.free(a)}}}function rf(a,b,c){a=a.diagram;c=c.part;!a.handlesDragDropForTopLevelParts||!c.isTopLevel||c instanceof U||(c=a.mouseDrop,null!==c&&c(b))}function sf(a,b,c){var d=!1;b.getAvoidableRect(c);a.viewportBounds.Ge(c)&&(d=!0);a=a.Zu(c,function(a){return a.part},function(a){return a instanceof T},!0,function(a){return a instanceof T},d);if(0!==a.count)for(a=a.iterator;a.next();)c=a.value,!c.Jd(b)&&c.isAvoiding&&c.Va()}
Le.prototype.doDropOnto=function(){};Le.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()?(ff(this,!1),Qe(a,this.copiedParts),hf(this,this.copiedParts,!1),Ve(a,this.copiedParts)):this.mayMove()?(af(this),hf(this,this.draggedParts,!0)):this.mayDragOut()?(ff(this,!1),hf(this,this.copiedParts,!1)):af(this),kf(this,a.lastInput.documentPoint))}};
Le.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?(af(this),ff(this,!0),Qe(a,this.copiedParts),hf(this,this.copiedParts,!1),Ve(a,this.copiedParts),null!==this.copiedParts&&(a.S("ChangingSelection",a.selection),a.clearSelection(!0),this.copiedParts.iteratorKeys.each(function(a){a.isSelected=!0}))):(b=!0,af(this),this.mayMove()&&(hf(this,this.draggedParts,
!0),kf(this,a.lastInput.documentPoint)));this.sn=!0;qf(this,a.lastInput.documentPoint);if(this.isActive){var d=c?this.copiedParts.If():this.draggedParts.If();this.copiedParts=null;b&&tf(this);a.Qa();Ve(a,this.draggedParts);this.transactionResult=c?"Copy":"Move";a.S(c?"SelectionCopied":"SelectionMoved",d)}this.stopTool();c&&a.S("ChangedSelection",a.selection)}}};
Le.prototype.simulatedMouseMove=function(a,b,c){if(null===Ne)return!1;var d=Ne.diagram;c instanceof Q||(c=null);var e=Re;c!==e&&(null!==e&&e!==d&&(e.ug(),Ne.isDragOutStarted=!1,e=e.toolManager.findTool("Dragging"),null!==e&&e.doSimulatedDragLeave()),Re=c,null!==c&&c!==d&&(df(),e=c.toolManager.findTool("Dragging"),null!==e&&(We.contains(e)||We.add(e),e.doSimulatedDragEnter())),this.doUpdateCursor(null,!0));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};
Le.prototype.simulatedMouseUp=function(a,b,c){if(null===Ne)return!1;var d=Re,e=Ne.diagram;if(null===c)return Ne.doCancel(),!0;if(c!==d){var f=d.toolManager.findTool("Dragging");if(null!==d&&d!==e&&null!==f)return d.ug(),Ne.isDragOutStarted=!1,f.doSimulatedDragLeave(),!1;Re=c;d=c.toolManager.findTool("Dragging");null!==d&&(df(),We.contains(d)||We.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 K),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=Ne,null!==a&&(c=a.mayCopy(),a.transactionResult=c?"Copy":"Move",a.stopTool()),!0):!1};
function tf(a){if(null!==a.draggedParts)for(var b=a.draggedParts.iterator;b.next();){var c=b.key;c instanceof W&&(c=c.containingGroup,null===c||null===c.placeholder||a.draggedParts.contains(c)||c.placeholder.s())}}
Le.prototype.mayCopy=function(){if(!this.isCopyEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowCopy||(Ta?!a.lastInput.alt:!a.lastInput.control))return!1;for(a=a.selection.iterator;a.next();)if(a.value.canCopy())return!0;return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1};
Le.prototype.mayDragOut=function(){if(!this.isCopyEnabled)return!1;var a=this.diagram;if(!a.allowDragOut||!a.allowCopy||a.allowMove)return!1;for(a=a.selection.iterator;a.next();)if(a.value.canCopy())return!0;return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1};
Le.prototype.mayMove=function(){var a=this.diagram;if(a.isReadOnly||!a.allowMove)return!1;for(a=a.selection.iterator;a.next();)if(a.value.canMove())return!0;return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canMove()?!0:!1};Le.prototype.computeBorder=function(a,b,c){return this.sn||null===this.draggedParts||this.draggedParts.contains(a)?null:c.assign(b)};Le.prototype.Yz=function(){return Ne};
Le.prototype.mayDragIn=function(){var a=this.diagram;if(!a.allowDrop||a.isReadOnly||a.isModelReadOnly||!a.allowInsert)return!1;var b=Ne;return null===b||b.diagram.model.dataFormat!==a.model.dataFormat?!1:!0};Le.prototype.doSimulatedDragEnter=function(){if(this.mayDragIn()){var a=this.diagram;a.animationManager.sc();uf(a);a.animationManager.sc();a=Ne;null!==a&&(a.diagram.Xs=!1);this.doUpdateCursor(null,!0)}};Le.prototype.doSimulatedDragLeave=function(){var a=Ne;null!==a&&a.doSimulatedDragOut();this.doCancel()};
Le.prototype.doSimulatedDragOver=function(){var a=this.diagram;a.animationManager.Um=!0;var b=Ne;if(null!==b&&null!==b.draggedParts){if(!this.mayDragIn())return;vf(this,b.draggedParts.If(),!1,a.firstInput);hf(this,this.copiedParts,!1);kf(this,a.lastInput.documentPoint)}a.animationManager.Um=!1};
Le.prototype.doSimulatedDrop=function(){var a=this.diagram,b=Ne;if(null!==b){var c=b.diagram;b.sn=!0;af(this);if(!this.mayDragIn())return;a.animationManager.Um=!0;a.S("ChangingSelection",a.selection);this.xa("Drop");vf(this,b.draggedParts.If(),!0,a.lastInput);hf(this,this.copiedParts,!1);null!==this.copiedParts&&(a.clearSelection(!0),this.copiedParts.iteratorKeys.each(function(a){a.isSelected=!0}));qf(this,a.lastInput.documentPoint);a.Qa();b=a.selection;null!==this.copiedParts?this.transactionResult=
"ExternalCopy":b=new G;this.copiedParts=null;a.doFocus();a.S("ExternalObjectsDropped",b,c);this.stopTransaction();a.S("ChangedSelection",a.selection)}a.animationManager.Um=!1};
function vf(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.Vj(b,e,!0);var f=N.alloc();e=d=Infinity;for(var g=-Infinity,h=-Infinity,k=b.iterator;k.next();){var l=k.value;if(l.isVisible()){var m=l.location;l=m.x;m=m.y;isNaN(l)||isNaN(m)||(l<d&&(d=l),m<e&&(e=m),l>g&&(g=l),m>h&&(h=m))}}Infinity===d?f.h(0,0,0,0):f.h(d,e,g-d,h-e);d=f.x+f.width/2;e=f.y+f.height/2;N.free(f);
f=a.Vr;g=new H;h=K.alloc();for(k=b.iterator;k.next();)l=k.value,l instanceof T&&l.canCopy()&&(m=c.H(l),null!==m&&(m.points=l.points,gf(m,f.x-d,f.y-e),m.suspendsRouting=!0,g.add(m,a.Ad())));for(b=b.iterator;b.next();)l=b.value,l.Nc()&&l.canCopy()&&(k=c.H(l),null!==k&&(l=l.location,h.h(f.x-(d-l.x),f.y-(e-l.y)),k.location=h,k.Ta(),g.add(k,a.Ad(h))));K.free(h);a.copiedParts=g;Oe(a,g.If());null!==a.draggedLink&&(c=a.draggedLink,b=c.routeBounds,gf(c,a.startPoint.x-(b.x+b.width/2),a.startPoint.y-(b.y+b.height/
2)));a.doUpdateCursor(null,!0)}}}Le.prototype.doSimulatedDragOut=function(){var a=this.diagram;a.Xs=!1;this.mayCopy()||this.mayMove()?a.currentCursor="":a.currentCursor=this.nodropCursor;this.co=null};Le.prototype.computeMove=function(a,b,c,d){c=this.diagram;return null!==c?c.computeMove(a,b,this.dragOptions,d):new K};
na.Object.defineProperties(Le.prototype,{isCopyEnabled:{get:function(){return this.Rb},set:function(a){this.Rb=a}},copiesEffectiveCollection:{get:function(){return this.C},set:function(a){this.C=a}},dragOptions:{get:function(){return this.Ba},set:function(a){this.Ba=a}},isGridSnapEnabled:{get:function(){return this.dragOptions.isGridSnapEnabled},set:function(a){this.dragOptions.isGridSnapEnabled=
a}},isComplexRoutingRealtime:{get:function(){return this.Gb},set:function(a){this.Gb=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.A(a)||(a=a.I(),this.dragOptions.gridSnapCellSize=a)}},gridSnapCellSpot:{
get:function(){return this.dragOptions.gridSnapCellSpot},set:function(a){this.dragOptions.gridSnapCellSpot.A(a)||(a=a.I(),this.dragOptions.gridSnapCellSpot=a)}},gridSnapOrigin:{get:function(){return this.dragOptions.gridSnapOrigin},set:function(a){this.dragOptions.gridSnapOrigin.A(a)||(a=a.I(),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.K},set:function(a){this.K=a}},moveCursor:{get:function(){return this.Nd},set:function(a){this.Nd=a}},nodropCursor:{get:function(){return this.Od},set:function(a){this.Od=a}},currentPart:{get:function(){return this.wa},
set:function(a){this.wa=a}},copiedParts:{get:function(){return this.o},set:function(a){this.o=a}},draggedParts:{get:function(){return this.Ma},set:function(a){this.Ma=a}},draggingParts:{get:function(){return null!==this.copiedParts?this.copiedParts.If():null!==this.draggedParts?this.draggedParts.If():this.je}},draggedLink:{get:function(){return this.diagram.draggedLink},set:function(a){this.diagram.draggedLink=
a}},isDragOutStarted:{get:function(){return this.tc},set:function(a){this.tc=a}},startPoint:{get:function(){return this.Vr},set:function(a){this.Vr.A(a)||this.Vr.assign(a)}},delay:{get:function(){return this.Qk},set:function(a){this.Qk=a}}});Le.prototype.getDraggingSource=Le.prototype.Yz;var We=null,Ne=null,Re=null;Le.className="DraggingTool";We=new E;
Ma("draggingTool",function(){return this.findTool("Dragging")},function(a){this.Za("Dragging",a,this.mouseMoveTools)});Pa.prototype.doCancel=function(){null!==Ne&&Ne.doCancel();ue.prototype.doCancel.call(this)};
function wf(){ue.call(this);this.Od=100;this.Ba=!1;this.Th="pointer";var a=new T,b=new xf;b.isPanelMain=!0;b.stroke="blue";a.add(b);b=new xf;b.toArrow="Standard";b.fill="blue";b.stroke="blue";a.add(b);a.layerName="Tool";this.$i=a;a=new W;b=new xf;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke="magenta";b.strokeWidth=2;b.desiredSize=Ib;a.add(b);a.selectable=!1;a.layerName="Tool";this.Zi=a;this.j=b;a=new W;b=new xf;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke="magenta";b.strokeWidth=
2;b.desiredSize=Ib;a.add(b);a.selectable=!1;a.layerName="Tool";this.aj=a;this.o=b;this.Nd=this.tc=this.Gb=this.Ma=this.Rb=null;this.wa=!0;this.tk=new H;this.je=this.ii=this.Yi=null}ma(wf,ue);wf.prototype.doStop=function(){this.diagram.ug();this.originalToPort=this.originalToNode=this.originalFromPort=this.originalFromNode=this.originalLink=null;this.validPortsCache.clear();this.targetPort=null};
wf.prototype.copyPortProperties=function(a,b,c,d,e){if(null!==a&&null!==b&&null!==c&&null!==d){var f=b.Af(),g=Gb.alloc();g.width=b.naturalBounds.width*f;g.height=b.naturalBounds.height*f;d.desiredSize=g;Gb.free(g);e?(d.toSpot=b.toSpot,d.toEndSegmentLength=b.toEndSegmentLength):(d.fromSpot=b.fromSpot,d.fromEndSegmentLength=b.fromEndSegmentLength);c.locationSpot=yc;f=K.alloc();c.location=b.da(yc,f);K.free(f);d.angle=b.Ki();null!==this.portTargeted&&this.portTargeted(a,b,c,d,e)}};
wf.prototype.setNoTargetPortProperties=function(a,b,c){null!==b&&(b.desiredSize=Ib,b.fromSpot=rc,b.toSpot=rc);null!==a&&(a.location=this.diagram.lastInput.documentPoint);null!==this.portTargeted&&this.portTargeted(null,null,a,b,c)};wf.prototype.doMouseDown=function(){this.isActive&&this.doMouseMove()};
wf.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram;this.targetPort=this.findTargetPort(this.isForwards);if(null!==this.targetPort&&this.targetPort.part instanceof W){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.ns(a.lastInput.viewPoint)}};wf.prototype.findValidLinkablePort=function(a,b){if(null===a)return null;var c=a.part;if(!(c instanceof W))return null;for(;null!==a;){var d=b?a.toLinkable:a.fromLinkable;if(!0===d&&(null!==a.portId||a instanceof W)&&(b?this.isValidTo(c,a):this.isValidFrom(c,a)))return a;if(!1===d)break;a=a.panel}return null};
wf.prototype.findTargetPort=function(a){var b=this.diagram,c=b.lastInput.documentPoint,d=this.portGravity;0>=d&&(d=.1);var e=this,f=b.qg(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 W){var k=g.da(yc,K.alloc()),l=c.x-k.x,m=c.y-k.y;K.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 W&&(null===c.layer||c.layer.allowLink))?b:null};
wf.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.Wp(b).count>=c)return!1}return!0};
wf.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.Gd(b).count>=c)return!1}return!0};
wf.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};wf.prototype.isLinked=function(a,b){if(null===a||null===b)return!1;var c=a.part;if(!(c instanceof W))return!1;a=a.portId;null===a&&(a="");var d=b.part;if(!(d instanceof W))return!1;b=b.portId;null===b&&(b="");for(b=d.Gd(b);b.next();)if(d=b.value,d.fromNode===c&&d.fromPortId===a)return!0;return!1};
wf.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};wf.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 G;d.add(a);return yf(this,c,b,d)};
function yf(a,b,c,d){if(b===c)return!0;var e=b.fromNode;if(null!==e&&e.isLinkLabel&&(d.add(e),yf(a,e.labeledLink,c,d)))return!0;b=b.toNode;return null!==b&&b.isLinkLabel&&(d.add(b),yf(a,b.labeledLink,c,d))?!0:!1}
wf.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!==Cf){if(d===Df){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!Ef(this,a,b,c,!0)}if(d===Ff){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!Ef(this,a,b,c,!0)}if(d===Gf)return a===b?a=!0:(d=new G,d.add(b),a=Hf(this,d,a,b,c)),!a;if(d===If)return!Ef(this,a,b,c,!1);if(d===Jf)return a===b?a=!0:(d=new G,d.add(b),a=Kf(this,d,a,b,c)),!a}return!0};function Ef(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&&Ef(a,g,c,d,e)))return!0}return!1}
function Hf(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&&Hf(a,b,g,d,e)))return!0}return!1}function Kf(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&&Kf(a,b,h,d,e))return!0}}return!1}
na.Object.defineProperties(wf.prototype,{portGravity:{get:function(){return this.Od},set:function(a){0<=a&&(this.Od=a)}},isUnconnectedLinkValid:{get:function(){return this.Ba},set:function(a){this.Ba=a}},linkingCursor:{get:function(){return this.Th},set:function(a){this.Th=a}},temporaryLink:{get:function(){return this.$i},set:function(a){this.$i=a}},temporaryFromNode:{
get:function(){return this.Zi},set:function(a){if(this.Zi=a)this.j=a.port}},temporaryFromPort:{get:function(){return this.j},set:function(a){if(null!==this.j){var b=this.j.panel;if(null!==b){var c=b.U.indexOf(this.j);b.eb(c);b.vb(c,a)}}this.j=a}},temporaryToNode:{get:function(){return this.aj},set:function(a){if(this.aj=a)this.o=a.port}},temporaryToPort:{get:function(){return this.o},set:function(a){if(null!==
this.o){var b=this.o.panel;if(null!==b){var c=b.U.indexOf(this.o);b.eb(c);b.vb(c,a)}}this.o=a}},originalLink:{get:function(){return this.Rb},set:function(a){this.Rb=a}},originalFromNode:{get:function(){return this.Ma},set:function(a){this.Ma=a}},originalFromPort:{get:function(){return this.Gb},set:function(a){this.Gb=a}},originalToNode:{get:function(){return this.tc},set:function(a){this.tc=
a}},originalToPort:{get:function(){return this.Nd},set:function(a){this.Nd=a}},isForwards:{get:function(){return this.wa},set:function(a){this.wa=a}},validPortsCache:{get:function(){return this.tk}},targetPort:{get:function(){return this.Yi},set:function(a){this.Yi=a}},linkValidation:{get:function(){return this.ii},set:function(a){this.ii=a}},portTargeted:{
get:function(){return this.je},set:function(a){this.je=a}}});wf.className="LinkingBaseTool";function Lf(){wf.call(this);this.name="Linking";this.K={};this.C=null;this.L=Mf;this.Pd=null}ma(Lf,wf);Lf.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowLink||!a.model.Ds()||!a.lastInput.left||a.currentTool!==this&&!this.isBeyondDragSize()?!1:null!==this.findLinkablePort()};
Lf.prototype.findLinkablePort=function(){var a=this.diagram,b=this.startObject;null===b&&(b=a.Zb(a.firstInput.documentPoint,null,null));if(null===b)return null;a=b.part;if(!(a instanceof W))return null;var c=this.direction;if(c===Mf||c===Nf){var d=this.findValidLinkablePort(b,!1);if(null!==d||this.startObject===a&&(d=a.port,this.findValidLinkablePort(d,!1)))return this.isForwards=!0,d}if(c===Mf||c===Of)if(b=this.findValidLinkablePort(b,!0),null!==b||this.startObject===a&&(b=a.port,this.findValidLinkablePort(b,
!0)))return this.isForwards=!1,b;return null};
Lf.prototype.doActivate=function(){var a=this.diagram,b=this.findLinkablePort();null===b?this.stopTool():(this.xa(this.name),a.isMouseCaptured=!0,a.currentCursor=this.linkingCursor,this.isForwards?(null===this.temporaryToNode||this.temporaryToNode.location.u()||(this.temporaryToNode.location=a.lastInput.documentPoint),this.originalFromPort=b,b=this.originalFromPort.part,b instanceof W&&(this.originalFromNode=b),this.copyPortProperties(this.originalFromNode,this.originalFromPort,this.temporaryFromNode,
this.temporaryFromPort,!1)):(null===this.temporaryFromNode||this.temporaryFromNode.location.u()||(this.temporaryFromNode.location=a.lastInput.documentPoint),this.originalToPort=b,b=this.originalToPort.part,b instanceof W&&(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.Va(),a.add(this.temporaryLink)),this.isActive=!0)};Lf.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.remove(this.temporaryLink);a.remove(this.temporaryFromNode);a.remove(this.temporaryToNode);a.isMouseCaptured=!1;a.currentCursor="";this.stopTransaction()};
Lf.prototype.doStop=function(){wf.prototype.doStop.call(this);this.startObject=null};
Lf.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram,b=this.transactionResult=null,c=null,d=null,e=null,f=null;try{var g=this.targetPort=this.findTargetPort(this.isForwards);if(null!==g){var h=g.part;h instanceof W&&(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.S("ChangingSelection",a.selection),a.clearSelection(!0),f.isSelected=!0),this.transactionResult=this.name,a.S("LinkDrawn",f)):this.doNoLink(b,c,d,e)):this.isForwards?
this.doNoLink(this.originalFromNode,this.originalFromPort,null,null):this.doNoLink(null,null,this.originalToNode,this.originalToPort)}finally{this.stopTool(),f&&a.allowSelect&&a.S("ChangedSelection",a.selection)}}};Lf.prototype.isNewTreeLink=function(){var a=this.archetypeLinkData;if(null===a)return!0;if(a instanceof T)return a.isTreeLink;var b=this.diagram;if(null===b)return!0;a=b.partManager.getLinkCategoryForData(a);b=b.partManager.findLinkTemplateForCategory(a);return null!==b?b.isTreeLink:!0};
Lf.prototype.insertLink=function(a,b,c,d){return this.diagram.partManager.insertLink(a,b,c,d)};Lf.prototype.doNoLink=function(){};
na.Object.defineProperties(Lf.prototype,{archetypeLinkData:{get:function(){return this.K},set:function(a){this.K=a}},archetypeLabelNodeData:{get:function(){return this.C},set:function(a){this.C=a}},direction:{get:function(){return this.L},set:function(a){this.L=a}},startObject:{get:function(){return this.Pd},set:function(a){this.Pd=a}}});
var Mf=new D(Lf,"Either",0),Nf=new D(Lf,"ForwardsOnly",0),Of=new D(Lf,"BackwardsOnly",0);Lf.className="LinkingTool";Lf.Either=Mf;Lf.ForwardsOnly=Nf;Lf.BackwardsOnly=Of;
function Se(){wf.call(this);this.name="Relinking";var a=new xf;a.figure="Diamond";a.desiredSize=Kb;a.fill="lightblue";a.stroke="dodgerblue";a.cursor=this.linkingCursor;a.segmentIndex=0;this.K=a;a=new xf;a.figure="Diamond";a.desiredSize=Kb;a.fill="lightblue";a.stroke="dodgerblue";a.cursor=this.linkingCursor;a.segmentIndex=-1;this.Pd=a;this.C=null;this.gx=new N}ma(Se,wf);
Se.prototype.updateAdornments=function(a){if(null!==a&&a instanceof T){var b="RelinkFrom",c=null;if(a.isSelected&&!this.diagram.isReadOnly){var d=a.selectionObject;null!==d&&a.canRelinkFrom()&&a.actualBounds.u()&&a.isVisible()&&d.actualBounds.u()&&d.Ff()&&(c=a.Yj(b),null===c&&(c=this.makeAdornment(d,!1),a.xh(b,c)))}null===c&&a.Gf(b);b="RelinkTo";c=null;a.isSelected&&!this.diagram.isReadOnly&&(d=a.selectionObject,null!==d&&a.canRelinkTo()&&a.actualBounds.u()&&a.isVisible()&&d.actualBounds.u()&&d.Ff()&&
(c=a.Yj(b),null===c?(c=this.makeAdornment(d,!0),a.xh(b,c)):c.s()));null===c&&a.Gf(b)}};Se.prototype.makeAdornment=function(a,b){var c=new ze;c.type=X.Link;b=b?this.toHandleArchetype:this.fromHandleArchetype;null!==b&&c.add(b.copy());c.adornedObject=a;return c};
Se.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowRelink||!a.model.Ds()||!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};
Se.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 ze&&c.adornedPart instanceof T))return;this.handle=b;this.isForwards=null===c||"RelinkTo"===c.category;this.originalLink=c.adornedPart}this.xa(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.gx.set(this.originalLink.actualBounds);null!==this.originalLink&&0<this.originalLink.pointsCount&&(null===this.originalLink.fromNode&&(null!==this.temporaryFromPort&&(this.temporaryFromPort.desiredSize=Hb),null!==this.temporaryFromNode&&(this.temporaryFromNode.location=this.originalLink.i(0))),null===this.originalLink.toNode&&
(null!==this.temporaryToPort&&(this.temporaryToPort.desiredSize=Hb),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.Va(),a.add(this.temporaryLink));this.isActive=!0};
Se.prototype.copyLinkProperties=function(a,b){if(null!==a&&null!==b){b.adjusting=a.adjusting;b.corner=a.corner;var c=a.curve;if(c===Pf||c===Qf)c=Rf;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}};
Se.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.remove(this.temporaryLink);a.remove(this.temporaryFromNode);a.remove(this.temporaryToNode);a.isMouseCaptured=!1;a.currentCursor="";this.stopTransaction()};Se.prototype.doStop=function(){wf.prototype.doStop.call(this);this.handle=null};
Se.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram;this.transactionResult=null;var b=this.originalFromNode,c=this.originalFromPort,d=this.originalToNode,e=this.originalToPort,f=this.originalLink;try{this.targetPort=this.findTargetPort(this.isForwards);if(null!==this.targetPort){var g=this.targetPort.part;g instanceof W&&(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.Va()),this.transactionResult=this.name,a.S("LinkRelinked",f,this.isForwards?this.originalToPort:this.originalFromPort)):this.doNoRelink(this.originalLink,this.isForwards);this.originalLink.fq(this.gx)}finally{this.stopTool()}}};
Se.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};Se.prototype.doNoRelink=function(){};
function pf(a,b,c,d,e){null!==b?(a.copyPortProperties(b,c,a.temporaryFromNode,a.temporaryFromPort,!1),a.diagram.add(a.temporaryFromNode)):a.diagram.remove(a.temporaryFromNode);null!==d?(a.copyPortProperties(d,e,a.temporaryToNode,a.temporaryToPort,!0),a.diagram.add(a.temporaryToNode)):a.diagram.remove(a.temporaryToNode)}
na.Object.defineProperties(Se.prototype,{fromHandleArchetype:{get:function(){return this.K},set:function(a){this.K=a}},toHandleArchetype:{get:function(){return this.Pd},set:function(a){this.Pd=a}},handle:{get:function(){return this.C},set:function(a){if(null!==a&&!(a.part instanceof ze))throw Error("new handle is not in an Adornment: "+a);this.C=a}}});Se.className="RelinkingTool";
Ma("linkingTool",function(){return this.findTool("Linking")},function(a){this.Za("Linking",a,this.mouseMoveTools)});Ma("relinkingTool",function(){return this.findTool("Relinking")},function(a){this.Za("Relinking",a,this.mouseDownTools)});
function Sf(){ue.call(this);this.name="LinkReshaping";var a=new xf;a.figure="Rectangle";a.desiredSize=Jb;a.fill="lightblue";a.stroke="dodgerblue";this.o=a;a=new xf;a.figure="Diamond";a.desiredSize=Kb;a.fill="lightblue";a.stroke="dodgerblue";a.cursor="move";this.C=a;this.K=3;this.vt=this.j=null;this.hx=new K;this.Fr=new E}ma(Sf,ue);Sf.prototype.dv=function(a){return a&&a.Jr&&0!==a.Jr.value?a.Jr:Tf};Sf.prototype.Am=function(a,b){a.Jr=b};
Sf.prototype.updateAdornments=function(a){if(null!==a&&a instanceof T){var b=null;if(a.isSelected&&!this.diagram.isReadOnly){var c=a.path;null!==c&&a.canReshape()&&a.actualBounds.u()&&a.isVisible()&&c.actualBounds.u()&&c.Ff()&&(b=a.Yj(this.name),null===b||b.$w!==a.pointsCount||b.vx!==a.resegmentable)&&(b=this.makeAdornment(c),null!==b&&(b.$w=a.pointsCount,b.vx=a.resegmentable,a.xh(this.name,b)))}null===b&&a.Gf(this.name)}};
Sf.prototype.makeAdornment=function(a){var b=a.part,c=b.pointsCount,d=b.isOrthogonal,e=null;if(null!==b.points&&1<c){e=new ze;e.type=X.Link;c=b.firstPickIndex;var f=b.lastPickIndex,g=d?1:0;if(b.resegmentable&&b.computeCurve()!==Uf)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);M.w(k.x,l.x)&&
M.w(k.y,l.y)&&(l=b.i(c-1));M.w(k.x,l.x)?(this.Am(h,Vf),h.cursor="n-resize"):M.w(k.y,l.y)&&(this.Am(h,Wf),h.cursor="w-resize")}else g===f-1&&d?(k=b.i(f-1),l=b.i(f),M.w(k.x,l.x)&&M.w(k.y,l.y)&&(k=b.i(f+1)),M.w(k.x,l.x)?(this.Am(h,Vf),h.cursor="n-resize"):M.w(k.y,l.y)&&(this.Am(h,Wf),h.cursor="w-resize")):g!==f&&(this.Am(h,Xf),h.cursor="move");e.add(h)}e.adornedObject=a}return e};Sf.prototype.makeHandle=function(){var a=this.handleArchetype;return null===a?null:a.copy()};
Sf.prototype.makeResegmentHandle=function(){var a=this.midHandleArchetype;return null===a?null:a.copy()};Sf.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};
Sf.prototype.doActivate=function(){var a=this.diagram;null===this.handle&&(this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name));if(null!==this.handle){var b=this.handle.part.adornedPart;if(b instanceof T){this.vt=b;a.isMouseCaptured=!0;this.xa(this.name);if(b.resegmentable&&999===this.handle.fromMaxLinks){var c=b.points.copy(),d=this.getResegmentingPoint();c.vb(this.handle.segmentIndex+1,d);b.isOrthogonal&&c.vb(this.handle.segmentIndex+1,d);b.points=c;b.Lb();b.updateAdornments();
this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name);if(null===this.handle){this.doDeactivate();return}}this.hx=b.i(this.handle.segmentIndex);this.Fr=b.points.copy();this.isActive=!0}}};Sf.prototype.doDeactivate=function(){this.stopTransaction();this.vt=this.handle=null;this.isActive=this.diagram.isMouseCaptured=!1};Sf.prototype.doCancel=function(){var a=this.adornedLink;null!==a&&(a.points=this.Fr);this.stopTool()};Sf.prototype.getResegmentingPoint=function(){return this.handle.da(yc)};
Sf.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeReshape(a.lastInput.documentPoint),this.reshape(a))};
Sf.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&&(Yf(this,g,d,e,f,!0)||Yf(this,g,d,e,f,!1))){var h=b.points.copy();Yf(this,g,d,
e,f,!0)?(h.Pc(c-2,new K(g.x,(f.y+g.y)/2)),h.Pc(c+1,new K(f.x,(f.y+g.y)/2))):(h.Pc(c-2,new K((f.x+g.x)/2,g.y)),h.Pc(c+1,new K((f.x+g.x)/2,f.y)));h.eb(c);h.eb(c-1);b.points=h;b.Lb()}else g=b.i(c+2),Math.abs(e.x-f.x)<this.resegmentingDistance&&Math.abs(e.y-f.y)<this.resegmentingDistance&&(Yf(this,d,e,f,g,!0)||Yf(this,d,e,f,g,!1))&&(h=b.points.copy(),Yf(this,d,e,f,g,!0)?(h.Pc(c-1,new K(d.x,(d.y+g.y)/2)),h.Pc(c+2,new K(g.x,(d.y+g.y)/2))):(h.Pc(c-1,new K((d.x+g.x)/2,d.y)),h.Pc(c+2,new K((d.x+g.x)/2,g.y))),
h.eb(c+1),h.eb(c),b.points=h,b.Lb())}}else g=K.alloc(),M.Ih(d.x,d.y,f.x,f.y,e.x,e.y,g)&&g.xf(e)<this.resegmentingDistance*this.resegmentingDistance&&(d=b.points.copy(),d.eb(c),b.points=d,b.Lb()),K.free(g)}a.Qa();this.transactionResult=this.name;a.S("LinkReshaped",this.adornedLink,this.Fr)}this.stopTool()};
function Yf(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}
Sf.prototype.reshape=function(a){var b=this.adornedLink;b.Lh();var c=this.handle.segmentIndex,d=this.dv(this.handle);if(b.isOrthogonal)if(c===b.firstPickIndex+1)c=b.firstPickIndex+1,d===Vf?(b.M(c,b.i(c-1).x,a.y),b.M(c+1,b.i(c+2).x,a.y)):d===Wf&&(b.M(c,a.x,b.i(c-1).y),b.M(c+1,a.x,b.i(c+2).y));else if(c===b.lastPickIndex-1)c=b.lastPickIndex-1,d===Vf?(b.M(c-1,b.i(c-2).x,a.y),b.M(c,b.i(c+1).x,a.y)):d===Wf&&(b.M(c-1,a.x,b.i(c-2).y),b.M(c,a.x,b.i(c+1).y));else{d=c;var e=b.i(d),f=b.i(d-1),g=b.i(d+1);M.w(f.x,
e.x)&&M.w(e.y,g.y)?(M.w(f.x,b.i(d-2).x)&&!M.w(f.y,b.i(d-2).y)?(b.m(d,a.x,f.y),c++,d++):b.M(d-1,a.x,f.y),M.w(g.y,b.i(d+2).y)&&!M.w(g.x,b.i(d+2).x)?b.m(d+1,g.x,a.y):b.M(d+1,g.x,a.y)):M.w(f.y,e.y)&&M.w(e.x,g.x)?(M.w(f.y,b.i(d-2).y)&&!M.w(f.x,b.i(d-2).x)?(b.m(d,f.x,a.y),c++,d++):b.M(d-1,f.x,a.y),M.w(g.x,b.i(d+2).x)&&!M.w(g.y,b.i(d+2).y)?b.m(d+1,a.x,g.y):b.M(d+1,a.x,g.y)):M.w(f.x,e.x)&&M.w(e.x,g.x)?(M.w(f.x,b.i(d-2).x)&&!M.w(f.y,b.i(d-2).y)?(b.m(d,a.x,f.y),c++,d++):b.M(d-1,a.x,f.y),M.w(g.x,b.i(d+2).x)&&
!M.w(g.y,b.i(d+2).y)?b.m(d+1,a.x,g.y):b.M(d+1,a.x,g.y)):M.w(f.y,e.y)&&M.w(e.y,g.y)&&(M.w(f.y,b.i(d-2).y)&&!M.w(f.x,b.i(d-2).x)?(b.m(d,f.x,a.y),c++,d++):b.M(d-1,f.x,a.y),M.w(g.y,b.i(d+2).y)&&!M.w(g.x,b.i(d+2).x)?b.m(d+1,g.x,a.y):b.M(d+1,g.x,a.y));b.M(c,a.x,a.y)}else b.M(c,a.x,a.y),d=b.fromNode,e=b.fromPort,null!==d&&(f=d.findVisibleNode(),null!==f&&f!==d&&(d=f,e=d.port)),1===c&&b.computeSpot(!0,e).Cc()&&(f=e.da(yc,K.alloc()),d=b.getLinkPointFromPoint(d,e,f,a,!0,K.alloc()),b.M(0,d.x,d.y),K.free(f),
K.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).Cc()&&(c=e.da(yc,K.alloc()),a=b.getLinkPointFromPoint(d,e,c,a,!1,K.alloc()),b.M(b.pointsCount-1,a.x,a.y),K.free(c),K.free(a));b.vf()};Sf.prototype.computeReshape=function(a){var b=this.adornedLink,c=this.handle.segmentIndex;switch(this.dv(this.handle)){case Xf:return a;case Vf:return new K(b.i(c).x,a.y);case Wf:return new K(a.x,b.i(c).y);default:case Tf:return b.i(c)}};
na.Object.defineProperties(Sf.prototype,{handleArchetype:{get:function(){return this.o},set:function(a){this.o=a}},midHandleArchetype:{get:function(){return this.C},set:function(a){this.C=a}},handle:{get:function(){return this.j},set:function(a){if(null!==a&&!(a.part instanceof ze))throw Error("new handle is not in an Adornment: "+a);this.j=a}},adornedLink:{get:function(){return this.vt}},
resegmentingDistance:{get:function(){return this.K},set:function(a){this.K=a}},originalPoint:{get:function(){return this.hx}},originalPoints:{get:function(){return this.Fr}}});Sf.prototype.setReshapingBehavior=Sf.prototype.Am;Sf.prototype.getReshapingBehavior=Sf.prototype.dv;var Tf=new D(Sf,"None",0),Wf=new D(Sf,"Horizontal",1),Vf=new D(Sf,"Vertical",2),Xf=new D(Sf,"All",3);Sf.className="LinkReshapingTool";
Sf.None=Tf;Sf.Horizontal=Wf;Sf.Vertical=Vf;Sf.All=Xf;Ma("linkReshapingTool",function(){return this.findTool("LinkReshaping")},function(a){this.Za("LinkReshaping",a,this.mouseDownTools)});
function lg(){ue.call(this);this.name="Resizing";this.Zf=(new Gb(1,1)).freeze();this.Yf=(new Gb(9999,9999)).freeze();this.zg=(new Gb(NaN,NaN)).freeze();this.C=!1;this.K=!0;this.ke=null;var a=new xf;a.alignmentFocus=yc;a.figure="Rectangle";a.desiredSize=Jb;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.o=a;this.j=null;this.Er=new K;this.ex=new Gb;this.Io=new K;this.Mt=new Gb(0,0);this.Lt=new Gb(Infinity,Infinity);this.Kt=new Gb(1,1)}ma(lg,ue);
lg.prototype.updateAdornments=function(a){if(!(null===a||a instanceof T)){if(a.isSelected&&!this.diagram.isReadOnly){var b=a.resizeObject,c=a.Yj(this.name);if(null!==b&&a.canResize()&&a.actualBounds.u()&&a.isVisible()&&b.actualBounds.u()&&b.Ff()){if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){b=b.Ki();mg(a)&&this.updateResizeHandles(c,b);a.xh(this.name,c);return}}}a.Gf(this.name)}};
lg.prototype.makeAdornment=function(a){var b=a.part.resizeAdornmentTemplate;if(null===b){b=new ze;b.type=X.Spot;b.locationSpot=yc;var c=new ng;c.isPanelMain=!0;b.add(c);b.add(this.makeHandle(a,uc));b.add(this.makeHandle(a,wc));b.add(this.makeHandle(a,Cc));b.add(this.makeHandle(a,Ac));b.add(this.makeHandle(a,ad));b.add(this.makeHandle(a,cd));b.add(this.makeHandle(a,dd));b.add(this.makeHandle(a,bd))}else if(og(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};
lg.prototype.makeHandle=function(a,b){a=this.handleArchetype;if(null===a)return null;a=a.copy();a.alignment=b;return a};
lg.prototype.updateResizeHandles=function(a,b){if(null!==a)if(!a.alignment.Mb()&&("pointer"===a.cursor||0<a.cursor.indexOf("resize")))a:{var c=a.alignment;c.Cc()&&(c=yc);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)};lg.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};
lg.prototype.doActivate=function(){var a=this.diagram;null===this.handle&&(this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name));null!==this.handle&&(this.adornedObject=this.handle.part.adornedObject,null!==this.adornedObject&&(a.isMouseCaptured=!0,a.animationManager.sc(),this.xa(this.name),this.Er.set(this.adornedObject.da(this.handle.alignment.yv())),this.Io.set(this.adornedObject.part.location),this.ex.set(this.adornedObject.desiredSize),this.Kt=this.computeCellSize(),this.Mt=
this.computeMinSize(),this.Lt=this.computeMaxSize(),this.isActive=!0))};lg.prototype.doDeactivate=function(){var a=this.diagram;this.stopTransaction();this.ke=this.handle=null;this.isActive=a.isMouseCaptured=!1};lg.prototype.doCancel=function(){null!==this.adornedObject&&(this.adornedObject.desiredSize=this.originalDesiredSize,this.adornedObject.part.location=this.originalLocation);this.stopTool()};
lg.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive){var b=this.Mt,c=this.Lt,d=this.Kt,e=this.adornedObject.vs(a.lastInput.documentPoint,K.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);a.gd();K.free(e)}};
lg.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.Mt,c=this.Lt,d=this.Kt,e=this.adornedObject.vs(a.lastInput.documentPoint,K.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);K.free(e);a.Qa();this.transactionResult=this.name;a.S("PartResized",this.adornedObject,this.originalDesiredSize)}this.stopTool()};
lg.prototype.resize=function(a){var b=this.diagram,c=this.adornedObject;if(null!==c){c.desiredSize=a.size;a=c.part;a.Ta();c=c.da(this.handle.alignment.yv());if(a instanceof U){var d=new E;d.add(a);if(!this.dragsMembers&&null===a.placeholder){var e=new Me;e.dragsMembers=!1}b.moveParts(d,this.oppositePoint.copy().he(c),!0,e)}else a.location=a.location.copy().he(c).add(this.oppositePoint);b.gd()}};
lg.prototype.computeResize=function(a,b,c,d,e,f){b.Cc()&&(b=yc);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=K.alloc();M.Xp(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)));K.free(p);return a};lg.prototype.computeReshape=function(){var a=pg;this.adornedObject instanceof xf&&(a=qg(this.adornedObject));return!(a===rg||this.diagram.lastInput.shift)};
lg.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};lg.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};
lg.prototype.computeCellSize=function(){var a=new Gb(NaN,NaN),b=this.adornedObject.part;null!==b&&(b=b.resizeCellSize,!isNaN(b.width)&&0<b.width&&(a.width=b.width),!isNaN(b.height)&&0<b.height&&(a.height=b.height));b=this.cellSize;isNaN(a.width)&&!isNaN(b.width)&&0<b.width&&(a.width=b.width);isNaN(a.height)&&!isNaN(b.height)&&0<b.height&&(a.height=b.height);b=this.diagram;(isNaN(a.width)||isNaN(a.height))&&b&&(b=b.grid,null!==b&&b.visible&&this.isGridSnapEnabled&&(b=b.gridCellSize,isNaN(a.width)&&
!isNaN(b.width)&&0<b.width&&(a.width=b.width),isNaN(a.height)&&!isNaN(b.height)&&0<b.height&&(a.height=b.height)));if(isNaN(a.width)||0===a.width||Infinity===a.width)a.width=1;if(isNaN(a.height)||0===a.height||Infinity===a.height)a.height=1;return a};
na.Object.defineProperties(lg.prototype,{handleArchetype:{get:function(){return this.o},set:function(a){this.o=a}},handle:{get:function(){return this.j},set:function(a){if(null!==a&&!(a.part instanceof ze))throw Error("new handle is not in an Adornment: "+a);this.j=a}},adornedObject:{get:function(){return this.ke},set:function(a){if(null!==a&&a.part instanceof ze)throw Error("new handle must not be in an Adornment: "+
a);this.ke=a}},minSize:{get:function(){return this.Zf},set:function(a){if(!this.Zf.A(a)){var b=a.width;isNaN(b)&&(b=0);a=a.height;isNaN(a)&&(a=0);this.Zf.h(b,a)}}},maxSize:{get:function(){return this.Yf},set:function(a){if(!this.Yf.A(a)){var b=a.width;isNaN(b)&&(b=Infinity);a=a.height;isNaN(a)&&(a=Infinity);this.Yf.h(b,a)}}},cellSize:{get:function(){return this.zg},set:function(a){this.zg.A(a)||this.zg.assign(a)}},
isGridSnapEnabled:{get:function(){return this.C},set:function(a){this.C=a}},dragsMembers:{get:function(){return this.K},set:function(a){this.K=a}},oppositePoint:{get:function(){return this.Er},set:function(a){this.Er.A(a)||this.Er.assign(a)}},originalDesiredSize:{get:function(){return this.ex}},originalLocation:{get:function(){return this.Io}}});
lg.className="ResizingTool";Ma("resizingTool",function(){return this.findTool("Resizing")},function(a){this.Za("Resizing",a,this.mouseDownTools)});function sg(){ue.call(this);this.name="Rotating";this.Ba=45;this.wa=2;this.Io=new K;this.ke=null;var a=new xf;a.figure="Ellipse";a.desiredSize=Kb;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.o=a;this.j=null;this.bx=0;this.Kr=new K(NaN,NaN);this.C=0;this.K=50}ma(sg,ue);
sg.prototype.updateAdornments=function(a){if(null!==a){if(a.Hh()){var b=a.rotateObject;if(b===a||b===a.path||b.isPanelMain)return}if(a.isSelected&&!this.diagram.isReadOnly&&(b=a.rotateObject,null!==b&&a.canRotate()&&a.actualBounds.u()&&a.isVisible()&&b.actualBounds.u()&&b.Ff())){var c=a.Yj(this.name);if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){c.angle=b.Ki();null===c.placeholder&&(c.location=this.computeAdornmentLocation(b));a.xh(this.name,c);return}}a.Gf(this.name)}};
sg.prototype.makeAdornment=function(a){var b=a.part.rotateAdornmentTemplate;if(null===b){b=new ze;b.type=X.Position;b.locationSpot=yc;var c=this.handleArchetype;null!==c&&b.add(c.copy())}else if(og(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};sg.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};
sg.prototype.doActivate=function(){var a=this.diagram;if(null===this.adornedObject){null===this.handle&&(this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name));if(null===this.handle)return;this.adornedObject=this.handle.part.adornedObject}null!==this.adornedObject&&(a.isMouseCaptured=!0,a.delaysLayout=!0,this.xa(this.name),this.bx=this.adornedObject.angle,this.Kr=this.computeRotationPoint(this.adornedObject),this.Io=this.adornedObject.part.location.copy(),this.isActive=!0)};
sg.prototype.computeRotationPoint=function(a){var b=a.part,c=b.locationObject;return b.rotationSpot.hb()?a.da(b.rotationSpot):a===b||a===c?c.da(b.locationSpot):a.da(yc)};
sg.prototype.computeAdornmentLocation=function(a){var b=this.rotationPoint;b.u()||(b=this.computeRotationPoint(a));b=a.vs(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.da(b)};sg.prototype.doDeactivate=function(){var a=this.diagram;this.stopTransaction();this.ke=this.handle=null;this.Kr=new K(NaN,NaN);this.isActive=a.isMouseCaptured=!1};sg.prototype.doCancel=function(){this.diagram.delaysLayout=!1;this.rotate(this.originalAngle);this.stopTool()};sg.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeRotate(a.lastInput.documentPoint),this.rotate(a))};
sg.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){a.delaysLayout=!1;var b=this.computeRotate(a.lastInput.documentPoint);this.rotate(b);a.Qa();this.transactionResult=this.name;a.S("PartRotated",this.adornedObject,this.originalAngle)}this.stopTool()};
sg.prototype.rotate=function(a){var b=this.adornedObject;if(null!==b){b.angle=a;b=b.part;b.Ta();var c=b.locationObject,d=b.rotateObject;if(c===d||c.sg(d))c=this.Io.copy(),b.location=c.he(this.rotationPoint).rotate(a-this.originalAngle).add(this.rotationPoint);this.diagram.gd()}};
sg.prototype.computeRotate=function(a){a=this.rotationPoint.Pa(a)-this.handleAngle;var b=this.adornedObject.panel;null!==b&&(a-=b.Ki());360<=a?a-=360:0>a&&(a+=360);b=Math.min(Math.abs(this.snapAngleMultiple),180);var c=Math.min(Math.abs(this.snapAngleEpsilon),b/2);!this.diagram.lastInput.shift&&0<b&&0<c&&(a%b<c?a=Math.floor(a/b)*b:a%b>b-c&&(a=(Math.floor(a/b)+1)*b));360<=a?a-=360:0>a&&(a+=360);return a};
na.Object.defineProperties(sg.prototype,{handleArchetype:{get:function(){return this.o},set:function(a){this.o=a}},handle:{get:function(){return this.j},set:function(a){if(null!==a&&!(a.part instanceof ze))throw Error("new handle is not in an Adornment: "+a);this.j=a}},adornedObject:{get:function(){return this.ke},set:function(a){if(null!==a&&a.part instanceof ze)throw Error("new handle must not be in an Adornment: "+
a);this.ke=a}},snapAngleMultiple:{get:function(){return this.Ba},set:function(a){this.Ba=a}},snapAngleEpsilon:{get:function(){return this.wa},set:function(a){this.wa=a}},originalAngle:{get:function(){return this.bx}},rotationPoint:{get:function(){return this.Kr},set:function(a){this.Kr=a.copy()}},handleAngle:{get:function(){return this.C},set:function(a){this.C=
a}},handleDistance:{get:function(){return this.K},set:function(a){this.K=a}}});sg.className="RotatingTool";Ma("rotatingTool",function(){return this.findTool("Rotating")},function(a){this.Za("Rotating",a,this.mouseDownTools)});function tg(){ue.call(this);this.name="ClickSelecting"}ma(tg,ue);tg.prototype.canStart=function(){return!this.isEnabled||this.isBeyondDragSize()?!1:!0};
tg.prototype.doMouseUp=function(){this.isActive&&(this.standardMouseSelect(),!this.standardMouseClick()&&this.diagram.lastInput.isTouchEvent&&this.diagram.toolManager.doToolTip());this.stopTool()};tg.className="ClickSelectingTool";function ug(){ue.call(this);this.name="Action";this.uk=null}ma(ug,ue);
ug.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram,b=a.lastInput,c=a.Zb(b.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a});if(null!==c){if(!c.isActionable)return!1;this.uk=c;a.Kk=a.Zb(b.documentPoint,null,null);return!0}return!1};ug.prototype.doMouseDown=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.uk;null!==b&&(a.targetObject=b,null!==b.actionDown&&b.actionDown(a,b))}else this.canStart()&&this.doActivate()};
ug.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.uk;null!==b&&(a.targetObject=b,null!==b.actionMove&&b.actionMove(a,b))}};ug.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.uk;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()};
ug.prototype.doCancel=function(){var a=this.diagram.lastInput,b=this.uk;null!==b&&(a.targetObject=b,null!==b.actionCancel&&b.actionCancel(a,b),this.stopTool())};ug.prototype.doStop=function(){this.uk=null};ug.className="ActionTool";function vg(){ue.call(this);this.name="ClickCreating";this.dj=null;this.o=!0;this.j=!1;this.Pw=new K(0,0)}ma(vg,ue);
vg.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.Pw=a.lastInput.viewPoint.copy()),2!==a.lastInput.clickCount||this.isBeyondDragSize(this.Pw))return!1}else if(1!==a.lastInput.clickCount)return!1;return a.currentTool!==this&&null!==a.am(a.lastInput.documentPoint,!0)?!1:!0};
vg.prototype.doMouseUp=function(){var a=this.diagram;this.isActive&&this.insertPart(a.lastInput.documentPoint);this.stopTool()};
vg.prototype.insertPart=function(a){var b=this.diagram,c=this.archetypeNodeData;if(null===c)return null;var d=null;try{b.S("ChangingSelection",b.selection);this.xa(this.name);if(c instanceof V)c.Nc()&&(og(c),d=c.copy(),null!==d&&b.add(d));else if(null!==c){var e=b.model.copyNodeData(c);za(e)&&(b.model.sf(e),d=b.Bc(e))}if(null!==d){var f=K.allocAt(a.x,a.y);this.isGridSnapEnabled&&wg(this.diagram,d,a,f);d.location=f;b.allowSelect&&(b.clearSelection(!0),d.isSelected=!0);K.free(f)}b.Qa();this.transactionResult=
this.name;b.S("PartCreated",d)}finally{this.stopTransaction(),b.S("ChangedSelection",b.selection)}return d};na.Object.defineProperties(vg.prototype,{archetypeNodeData:{get:function(){return this.dj},set:function(a){this.dj=a}},isDoubleClick:{get:function(){return this.o},set:function(a){this.o=a}},isGridSnapEnabled:{get:function(){return this.j},set:function(a){this.j=a}}});vg.className="ClickCreatingTool";
function xg(){ue.call(this);this.name="DragSelecting";this.Qk=175;this.o=!1;var a=new V;a.layerName="Tool";a.selectable=!1;var b=new xf;b.name="SHAPE";b.figure="Rectangle";b.fill=null;b.stroke="magenta";a.add(b);this.j=a}ma(xg,ue);
xg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(!a.allowSelect)return!1;var b=a.lastInput;return!b.left||a.currentTool!==this&&(!this.isBeyondDragSize()||b.timestamp-a.firstInput.timestamp<this.delay||null!==a.am(b.documentPoint,!0))?!1:!0};xg.prototype.doActivate=function(){var a=this.diagram;this.isActive=!0;a.isMouseCaptured=!0;a.skipsUndoManager=!0;a.add(this.box);this.doMouseMove()};
xg.prototype.doDeactivate=function(){var a=this.diagram;a.ug();a.remove(this.box);a.skipsUndoManager=!1;this.isActive=a.isMouseCaptured=!1};xg.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive&&null!==this.box){var b=this.computeBoxBounds(),c=this.box.Ya("SHAPE");null===c&&(c=this.box.pb());var d=Gb.alloc().h(b.width,b.height);c.desiredSize=d;this.box.ym(b.x,b.y,!1);Gb.free(d);(a.allowHorizontalScroll||a.allowVerticalScroll)&&a.ns(a.lastInput.viewPoint)}};
xg.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram;a.remove(this.box);try{a.currentCursor="wait",a.S("ChangingSelection",a.selection),this.selectInRect(this.computeBoxBounds()),a.S("ChangedSelection",a.selection)}finally{a.currentCursor=""}}this.stopTool()};xg.prototype.computeBoxBounds=function(){var a=this.diagram;return new N(a.firstInput.documentPoint,a.lastInput.documentPoint)};
xg.prototype.selectInRect=function(a){var b=this.diagram,c=b.lastInput;a=b.Tx(a,this.isPartialInclusion);if(Ta?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)}};na.Object.defineProperties(xg.prototype,{delay:{get:function(){return this.Qk},set:function(a){this.Qk=a}},isPartialInclusion:{get:function(){return this.o},set:function(a){this.o=a}},box:{get:function(){return this.j},set:function(a){this.j=a}}});xg.className="DragSelectingTool";
function yg(){ue.call(this);this.name="Panning";this.fu=new K;this.Vy=new K;this.yg=!1;var a=this;this.lx=function(){var b=a.diagram;null!==b&&b.removeEventListener(x.document,"scroll",a.lx,!1);a.stopTool()}}ma(yg,ue);yg.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};
yg.prototype.doActivate=function(){var a=this.diagram;this.yg?(a.lastInput.bubbles=!0,a.addEventListener(x.document,"scroll",this.lx,!1)):(a.currentCursor="move",a.isMouseCaptured=!0,this.fu.assign(a.position));this.isActive=!0};yg.prototype.doDeactivate=function(){var a=this.diagram;a.currentCursor="";this.isActive=a.isMouseCaptured=!1};yg.prototype.doCancel=function(){var a=this.diagram;a.position=this.fu;a.isMouseCaptured=!1;this.stopTool()};yg.prototype.doMouseMove=function(){this.move()};
yg.prototype.doMouseUp=function(){this.move();this.stopTool()};yg.prototype.move=function(){var a=this.diagram;if(this.isActive&&a)if(this.yg)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.Vy.h(e,c)}};
na.Object.defineProperties(yg.prototype,{bubbles:{get:function(){return this.yg},set:function(a){this.yg=a}},originalPosition:{get:function(){return this.fu}}});yg.className="PanningTool";Ma("clickCreatingTool",function(){return this.findTool("ClickCreating")},function(a){this.Za("ClickCreating",a,this.mouseUpTools)});Ma("clickSelectingTool",function(){return this.findTool("ClickSelecting")},function(a){this.Za("ClickSelecting",a,this.mouseUpTools)});
Ma("panningTool",function(){return this.findTool("Panning")},function(a){this.Za("Panning",a,this.mouseMoveTools)});Ma("dragSelectingTool",function(){return this.findTool("DragSelecting")},function(a){this.Za("DragSelecting",a,this.mouseMoveTools)});Ma("actionTool",function(){return this.findTool("Action")},function(a){this.Za("Action",a,this.mouseDownTools)});function Ee(){this.K=this.C=this.j=this.o=null}
na.Object.defineProperties(Ee.prototype,{mainElement:{get:function(){return this.C},set:function(a){this.C=a}},show:{get:function(){return this.o},set:function(a){this.o!==a&&(this.o=a)}},hide:{get:function(){return this.j},set:function(a){this.j!==a&&(this.j=a)}},valueFunction:{get:function(){return this.K},set:function(a){this.K=a}}});Ee.className="HTMLInfo";
function zg(a,b,c){this.text=a;this.Hx=b;this.visible=c}zg.className="ContextMenuButtonInfo";function Ag(){ue.call(this);this.name="ContextMenu";this.o=this.Bt=this.j=null;this.Yw=new K;this.Ct=null;this.Tt=!1;var a=this;this.vu=function(){a.stopTool()}}ma(Ag,ue);
function Bg(a){var b=new Ee;b.show=function(a,b,c){c.showDefaultContextMenu()};b.hide=function(a,b){b.hideDefaultContextMenu()};Cg=b;a.vu=function(){a.stopTool()};b=va("div");var c=va("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=va("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",Dg,!1),d.addEventListener(b,"selectstart",
Dg,!1),d.addEventListener(c,"contextmenu",Dg,!1));b.className="goCXforeground";c.className="goCXbackground";x.document.body&&(x.document.body.appendChild(b),x.document.body.appendChild(c));Eg=b;Fg=c;Gg=!0}function Dg(a){a.preventDefault();return!1}
Ag.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return this.isBeyondDragSize()||!a.lastInput.right||1<a.lastInput.clickCount?!1:a.lastInput.isTouchEvent&&null!==this.defaultTouchContextMenu||null!==this.findObjectWithContextMenu()?!0:!1};Ag.prototype.doStart=function(){this.Yw.set(this.diagram.firstInput.documentPoint)};Ag.prototype.doStop=function(){this.hideContextMenu();this.currentObject=null};
Ag.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.Zb(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};Ag.prototype.doActivate=function(){};
Ag.prototype.doMouseDown=function(){ue.prototype.doMouseDown.call(this);if(this.isActive&&this.currentContextMenu instanceof ze){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doMouseDown(),a.doDeactivate())}this.diagram.toolManager.mouseDownTools.contains(this)&&Hg(this)};
Ag.prototype.doMouseUp=function(){if(this.isActive&&this.currentContextMenu instanceof ze){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doCancel(),a.doDeactivate())}Hg(this)};
function Hg(a){var b=a.diagram;if(a.isActive){var c=a.currentContextMenu;if(null!==c){if(!(c instanceof Ee)){var d=b.Zb(b.lastInput.documentPoint,null,null);null!==d&&d.sg(c)&&a.standardMouseClick(null,null)}a.stopTool();a.canStart()&&(b.currentTool=a,a.doMouseUp())}}else a.canStart()&&(Ig(a,!0),a.isActive||a.stopTool())}
function Ig(a,b,c){void 0===c&&(c=null);if(!a.Tt&&(a.Tt=!0,b&&a.standardMouseSelect(),b=a.standardMouseClick(),a.Tt=!1,!b)){a.isActive=!0;b=Cg;null===c&&(c=a.findObjectWithContextMenu());if(null!==c){var d=c.contextMenu;null!==d?(a.currentObject=c instanceof Y?c:null,a.showContextMenu(d,a.currentObject)):null!==b&&a.showContextMenu(b,a.currentObject)}else null!==b&&a.showContextMenu(b,null);a.currentContextMenu instanceof ze&&!a.currentContextMenu.visible&&a.stopTool()}}
Ag.prototype.doMouseMove=function(){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.doMouseMove();this.isActive&&this.diagram.toolManager.doMouseMove()};
Ag.prototype.showContextMenu=function(a,b){var c=this.diagram;a!==this.currentContextMenu&&this.hideContextMenu();if(a instanceof ze){a.layerName="Tool";a.selectable=!1;a.scale=1/c.scale;a.category=this.name;null!==a.placeholder&&(a.placeholder.scale=c.scale);var d=a.diagram;null!==d&&d!==c&&d.remove(a);c.add(a);null!==b?a.adornedObject=b:a.data=c.model;a.Ta();this.positionContextMenu(a,b)}else a instanceof Ee&&a.show(b,c,this);this.currentContextMenu=a};
Ag.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}};
Ag.prototype.hideContextMenu=function(){var a=this.diagram,b=this.currentContextMenu;null!==b&&(b instanceof ze?(a.remove(b),null!==this.Bt&&this.Bt.Gf(b.category),b.data=null,b.adornedObject=null):b instanceof Ee&&(null!==b.hide?b.hide(a,this):null!==b.mainElement&&(b.mainElement.style.display="none")),this.currentContextMenu=null,this.standardMouseOver())};
function Jg(a){var b=new E;b.add(new zg("Copy",function(a){a.commandHandler.copySelection()},function(a){return a.commandHandler.canCopySelection()}));b.add(new zg("Cut",function(a){a.commandHandler.cutSelection()},function(a){return a.commandHandler.canCutSelection()}));b.add(new zg("Delete",function(a){a.commandHandler.deleteSelection()},function(a){return a.commandHandler.canDeleteSelection()}));b.add(new zg("Paste",function(b){b.commandHandler.pasteSelection(a.mouseDownPoint)},function(b){return b.commandHandler.canPasteSelection(a.mouseDownPoint)}));
b.add(new zg("Select All",function(a){a.commandHandler.selectAll()},function(a){return a.commandHandler.canSelectAll()}));b.add(new zg("Undo",function(a){a.commandHandler.undo()},function(a){return a.commandHandler.canUndo()}));b.add(new zg("Redo",function(a){a.commandHandler.redo()},function(a){return a.commandHandler.canRedo()}));b.add(new zg("Scroll To Part",function(a){a.commandHandler.scrollToPart()},function(a){return a.commandHandler.canScrollToPart()}));b.add(new zg("Zoom To Fit",function(a){a.commandHandler.zoomToFit()},
function(a){return a.commandHandler.canZoomToFit()}));b.add(new zg("Reset Zoom",function(a){a.commandHandler.resetZoom()},function(a){return a.commandHandler.canResetZoom()}));b.add(new zg("Group Selection",function(a){a.commandHandler.groupSelection()},function(a){return a.commandHandler.canGroupSelection()}));b.add(new zg("Ungroup Selection",function(a){a.commandHandler.ungroupSelection()},function(a){return a.commandHandler.canUngroupSelection()}));b.add(new zg("Edit Text",function(a){a.commandHandler.editTextBlock()},
function(a){return a.commandHandler.canEditTextBlock()}));return b}
Ag.prototype.showDefaultContextMenu=function(){var a=this.diagram;null===this.Ct&&(this.Ct=Jg(this));Eg.innerHTML="";Fg.addEventListener("click",this.vu,!1);var b=this,c=va("ul");c.className="goCXul";Eg.appendChild(c);c.innerHTML="";for(var d=this.Ct.iterator;d.next();){var e=d.value,f=e.visible;if("function"===typeof e.Hx&&("function"!==typeof f||f(a))){f=va("li");f.className="goCXli";var g=va("a");g.className="goCXa";g.href="#";g.Ny=e.Hx;g.addEventListener("click",function(c){this.Ny(a);b.stopTool();
c.preventDefault();return!1},!1);g.textContent=e.text;f.appendChild(g);c.appendChild(f)}}Eg.style.display="block";Fg.style.display="block"};Ag.prototype.hideDefaultContextMenu=function(){if(null!==this.currentContextMenu&&this.currentContextMenu===Cg){Eg.style.display="none";Fg.style.display="none";var a=this.diagram;null!==a&&a.removeEventListener(Fg,"click",this.vu,!1);this.currentContextMenu=null}};
na.Object.defineProperties(Ag.prototype,{currentContextMenu:{get:function(){return this.j},set:function(a){this.j=a;this.Bt=a instanceof ze?a.adornedPart:null}},defaultTouchContextMenu:{get:function(){!1===Gg&&null===Cg&&Kg&&Bg(this);return Cg},set:function(a){null===a&&(Gg=!0);Cg=a}},currentObject:{get:function(){return this.o},set:function(a){this.o=a}},mouseDownPoint:{get:function(){return this.Yw}}});
var Cg=null,Gg=!1,Fg=null,Eg=null;Ag.className="ContextMenuTool";Ma("contextMenuTool",function(){return this.findTool("ContextMenu")},function(a){this.Za("ContextMenu",a,this.mouseUpTools)});function Lg(){ue.call(this);this.name="TextEditing";this.qh=new Mg;this.Ba=null;this.wa=Ng;this.ui=null;this.ia=Og;this.C=1;this.K=!0;this.o=null;this.j=new Ee;this.Dt=null;Pg(this,this.j)}ma(Lg,ue);
function Pg(a,b){if(Kg){var c=va("textarea");a.Dt=c;c.addEventListener("input",function(){if(null!==a.textBlock){var b=a.my(this.value);this.style.width=20+b.measuredBounds.width*this.SA+"px";this.rows=b.lineCount}},!1);c.addEventListener("keydown",function(b){if(null!==a.textBlock){var c=b.key;"Enter"===c?(!1===a.textBlock.isMultiline&&b.preventDefault(),a.acceptText(Qg)):"Tab"===c?(a.acceptText(Rg),b.preventDefault()):"Escape"===c&&(a.doCancel(),null!==a.diagram&&a.diagram.doFocus())}},!1);c.addEventListener("focus",
function(){if(null!==a.currentTextEditor&&a.state!==Og){var b=a.Dt;a.ia===Sg&&(a.ia=Tg);"function"===typeof b.select&&a.selectsTextOnActivate&&(b.select(),b.setSelectionRange(0,9999))}},!1);c.addEventListener("blur",function(){if(null!==a.currentTextEditor&&a.state!==Og){var b=a.Dt;"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 Mg&&f instanceof Lg)if(f.state===Ug)c.style.border="3px solid red",c.focus();else{var d=a.da(yc),e=b.position,k=b.scale,l=a.Af()*k;l<f.minimumEditorScale&&(l=f.minimumEditorScale);var m=a.naturalBounds.width*l+6,n=a.naturalBounds.height*l+2,p=(d.x-e.x)*k;d=(d.y-e.y)*k;e=a.verticalAlignment;k=(a.lineHeight+a.spacingAbove+a.spacingBelow)*a.lineCount*l;n=e.y*n-e.y*k+e.offsetY-(.5*n-.5*k)-k/2;c.value=a.text;b.div.style.font=a.font;c.style.position="absolute";c.style.zIndex="100";
c.style.font="inherit";c.style.fontSize=100*l+"%";c.style.lineHeight="normal";c.style.width=m+"px";c.style.left=(p-m/2|0)-1+"px";c.style.top=(d+n|0)-1+"px";c.style.textAlign=a.textAlign;c.style.margin="0";c.style.padding="1px";c.style.border="0";c.style.outline="none";c.style.whiteSpace="pre-wrap";c.style.overflow="hidden";c.rows=a.lineCount;c.SA=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)}}}
Lg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(null===a||a.isReadOnly||Vg&&Vg!==this&&(Vg.acceptText(Wg),Vg&&Vg!==this)||!a.lastInput.left||this.isBeyondDragSize())return!1;var b=a.Zb(a.lastInput.documentPoint);if(!(null!==b&&b instanceof Mg&&b.editable&&b.part.canEdit()))return!1;b=b.part;return null===b||this.starting===Ng&&!b.isSelected||this.starting===Xg&&2>a.lastInput.clickCount?!1:!0};Lg.prototype.doStart=function(){Vg=this;null!==this.textBlock&&this.doActivate()};
Lg.prototype.doActivate=function(){if(!this.isActive){var a=this.diagram;if(null!==a){var b=this.textBlock;null===b&&(b=a.Zb(a.lastInput.documentPoint));if(null!==b&&b instanceof Mg&&(this.textBlock=b,null!==b.part)){a.animationManager.sc();this.isActive=!0;this.ia=Sg;var c=this.defaultTextEditor;null!==b.textEditor&&(c=b.textEditor);this.qh=this.textBlock.copy();var d=new N(this.textBlock.da(uc),this.textBlock.da(Cc));a.Nv(d);c.show(b,a,this);this.currentTextEditor=c}}}};Lg.prototype.doCancel=function(){this.stopTool()};
Lg.prototype.doMouseUp=function(){this.canStart()&&this.doActivate()};Lg.prototype.doMouseDown=function(){this.isActive&&this.acceptText(Wg)};Lg.prototype.acceptText=function(a){switch(a){case Wg:if(this.ia===Yg)this.currentTextEditor instanceof HTMLElement&&this.currentTextEditor.focus();else if(this.ia===Sg||this.ia===Ug||this.ia===Tg)this.ia=Zg,$g(this);break;case ah:case Qg:case Rg:if(Qg!==a||!0!==this.textBlock.isMultiline)if(this.ia===Sg||this.ia===Ug||this.ia===Tg)this.ia=Zg,$g(this)}};
function $g(a){var b=a.textBlock,c=a.diagram,d=a.currentTextEditor;if(null!==b&&null!==d){var e=b.text,f="";null!==d.valueFunction&&(f=d.valueFunction());a.isValidText(b,e,f)?(a.xa(a.name),a.ia=Yg,a.transactionResult=a.name,b.text=f,a.doSuccess(e,f),null!==c&&c.S("TextEdited",b,e),a.stopTransaction(),a.stopTool(),null!==c&&c.doFocus()):(a.ia=Ug,a.doError(e,f))}}
Lg.prototype.doError=function(a,b){var c=this.textBlock;null!==c.errorFunction&&c.errorFunction(this,a,b);(a=this.currentTextEditor)&&a.show(c,this.diagram,this)};Lg.prototype.doSuccess=function(a,b){var c=this.textBlock;null!==c.textEdited&&c.textEdited(c,a,b)};Lg.prototype.doDeactivate=function(){var a=this.diagram;null!==a&&(this.ia=Og,this.textBlock=null,null!==this.currentTextEditor&&this.currentTextEditor.hide(a,this),this.isActive=!1)};Lg.prototype.doStop=function(){Vg=null};
Lg.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};Lg.prototype.my=function(a){var b=this.qh;b.text=a;b.measure(this.textBlock.ei,Infinity);return b};
na.Object.defineProperties(Lg.prototype,{textBlock:{get:function(){return this.Ba},set:function(a){this.Ba=a}},currentTextEditor:{get:function(){return this.o},set:function(a){this.o=a}},defaultTextEditor:{get:function(){return this.j},set:function(a){this.j=a}},starting:{get:function(){return this.wa},set:function(a){this.wa=a}},textValidation:{get:function(){return this.ui},
set:function(a){this.ui=a}},minimumEditorScale:{get:function(){return this.C},set:function(a){this.C=a}},selectsTextOnActivate:{get:function(){return this.K},set:function(a){this.K=a}},state:{get:function(){return this.ia},set:function(a){this.ia!==a&&(this.ia=a)}}});Lg.prototype.measureTemporaryTextBlock=Lg.prototype.my;
var ah=new D(Lg,"LostFocus",0),Wg=new D(Lg,"MouseDown",1),Rg=new D(Lg,"Tab",2),Qg=new D(Lg,"Enter",3),bh=new D(Lg,"SingleClick",0),Ng=new D(Lg,"SingleClickSelected",1),Xg=new D(Lg,"DoubleClick",2),Og=new D(Lg,"StateNone",0),Sg=new D(Lg,"StateActive",1),Tg=new D(Lg,"StateEditing",2),Zg=new D(Lg,"StateValidating",3),Ug=new D(Lg,"StateInvalid",4),Yg=new D(Lg,"StateValidated",5),Vg=null;Lg.className="TextEditingTool";Lg.LostFocus=ah;Lg.MouseDown=Wg;Lg.Tab=Rg;Lg.Enter=Qg;Lg.SingleClick=bh;
Lg.SingleClickSelected=Ng;Lg.DoubleClick=Xg;Lg.StateNone=Og;Lg.StateActive=Sg;Lg.StateEditing=Tg;Lg.StateValidating=Zg;Lg.StateInvalid=Ug;Lg.StateValidated=Yg;Ma("textEditingTool",function(){return this.findTool("TextEditing")},function(a){this.Za("TextEditing",a,this.mouseUpTools)});
function ch(a){dh||(eh(),dh=!0);this.D=ve;this.Yk=this.sb=this.rr=this.kc=!1;this.sx=!0;this.Zk=fh;this.Um=!1;this.$h=this.vd=!0;this.Lg=600;this.Ew=this.px=!1;this.Se=new G;this.Td=new gh;this.Td.Qd=this;this.cj=new G;this.ru=new G;this.ds=new G;this.Al=new G;a&&Object.assign(this,a)}ch.prototype.Ne=function(a){this.D=a};ch.prototype.canStart=function(){return!0};function hh(a,b){a.vd&&a.canStart(b)&&(a.Se.add(b),a.defaultAnimation.isAnimating&&a.sc(),ih(a.D),a.sb=!0)}
function jh(a){if(a.vd&&a.sb){var b=a.Td,c=a.D,d=a.Se.contains("Model");d&&(a.Yk=!0,a.Zk===fh?(b.isViewportUnconstrained=!0,b.nc.clear(),b.add(c,"position",c.position.copy().offset(0,-200),c.position),b.add(c,"opacity",0,1)):a.Zk===kh&&b.nc.clear(),a.sx=a.Zk===lh&&c.lu.A(c.ja)?!0:!1,c.S("InitialAnimationStarting",a));d&&!a.$h||0===b.nc.count?(a.Se.clear(),a.sb=!1,b.nc.clear(),mh(b,c),a.Yk=!1,c.N()):(a.Se.clear(),c.kg=!1,d=b.nc.get(c),c.autoScale!==nh&&null!==d&&(delete d.start.scale,delete d.end.scale),
x.requestAnimationFrame(function(){!1===a.sb||b.kc||(c.Ie("temporaryPixelRatio")&&Pe(c),Ah(c),a.sb=!1,b.start(),Bh(a),c.Qa(),Ch(b,0),uf(c,!0),Dh(a),c.S("AnimationStarting",a))}))}}function Eh(a,b,c,d){a.isTicking||b instanceof T&&(null!==b.fromNode||null!==b.toNode)||a.Td.add(b,"position",c,d,!1)}t=ch.prototype;t.Ms=function(a){return this.Td.Ms(a)};t.lv=function(a){return this.Td.lv(a)};
function Fh(a,b){function c(){0<e.ds.count&&(d.addAll(e.ds),e.ds.clear(),e.kc=!0);if(!1!==e.kc&&0!==d.count){e.ru.addAll(d);for(var a=e.ru.iterator;a.next();){var b=a.value;if(!1!==b.kc){a:if(0<b.Rl.count)var h=!0;else{for(h=b.nc.iterator;h.next();){var k=h.key;if(k instanceof Y&&null!==k.diagram||k instanceof Q){h=!0;break a}}h=!1}h?Gh(b,!1):b.gl=!0}}e.ru.clear();Bh(e);uf(e.D);Dh(e);x.requestAnimationFrame(c)}}var d=a.cj,e=a;a.kc?a.ds.add(b):(a.kc=!0,d.add(b),x.requestAnimationFrame(function(){c()}))}
function Hh(a){for(a=a.cj.iterator;a.next();)a.value.gl=!1}function Bh(a){if(!a.rr){var b=a.D;a.px=b.skipsUndoManager;a.Ew=b.skipsModelSourceBindings;b.skipsUndoManager=!0;b.skipsModelSourceBindings=!0;a.rr=!0}}function Dh(a){var b=a.D;b.skipsUndoManager=a.px;b.skipsModelSourceBindings=a.Ew;a.rr=!1}
t.sc=function(a){var b=this.Td;!0===this.sb&&(this.Yk=this.sb=!1,this.Se.clear(),0<b.nc.count&&this.D.Fb());if(this.kc){if(b.Zl(!0),b.nc.clear(),mh(b,null),!0===a)for(a=this.cj.ya(),b=0;b<a.length;b++)a[b].Zl(!0)}else b.nc.clear(),mh(b,this.D)};t.Zl=function(a){a===this.defaultAnimation&&this.defaultAnimation.nc.clear();this.cj.remove(a);0===this.cj.count&&(this.kc=!1,this.D.Fb());a===this.defaultAnimation&&(this.defaultAnimation.nc.clear(),this.D.S("AnimationFinished",this))};
t.Oj=function(a,b){this.sb&&(this.Se.contains("Expand Tree")||this.Se.contains("Expand SubGraph"))&&(this.Td.Oj(a,b),Ih(this,a))};t.Mj=function(a,b){this.sb&&(this.Se.contains("Collapse Tree")||this.Se.contains("Collapse SubGraph"))&&(this.Td.Mj(a,b),Jh(this.Td,b,"position",b.position,b.position),Ih(this,a))};function Kh(a,b,c){a.sb&&!b.A(c)&&(a.D.Oi||(b=c.copy()),Jh(a.Td,a.D,"position",b,c))}
function Ih(a,b){for(b=b.findLinksConnected();b.next();){var c=b.value;c.gf=c.points.copy();a.Al.add(c)}}function Lh(a,b,c,d,e){null===a&&(a=[0,0,0,0]);null===b&&(b=[0,0,0,0]);var f=a[0],g=a[1],h=a[2];a=a[3];var k=b[0],l=b[1],m=b[2];b=b[3];if(0===h||100===h)f=k,g=l;else if(0===m||100===m)k=f,l=g;180<Math.abs(k-f)&&(k>f?f+=360:k+=360);f=e(c,f,k-f,d)%360;g=e(c,g,l-g,d);h=e(c,h,m-h,d);c=e(c,a,b-a,d);return"hsla("+f+", "+g+"%, "+h+"%, "+c+")"}
function eh(){function a(a,b,e,f,g,h){a.position=new K(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h))}var b=new H;b.add("position:diagram",a);b.add("position",a);b.add("position:part",function(a,b,e,f,g,h){g<h?a.ym(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h),!1):a.position=new K(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h))});b.add("location",function(a,b,e,f,g,h){g<h?a.ym(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h),!0):a.location=new K(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h))});b.add("position:placeholder",function(a,b,e,f,
g,h){g<h?a.ym(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h),!1):a.position=new K(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h))});b.add("position:nodeCollapse",function(a,b,e,f,g,h){var c=a.actualBounds,d=e.actualBounds;e=d.x+d.width/2-c.width/2;c=d.y+d.height/2-c.height/2;g<h?a.ym(f(g,b.x,e-b.x,h),f(g,b.y,c-b.y,h),!1):a.position=new K(f(g,b.x,e-b.x,h),f(g,b.y,c-b.y,h))});b.add("desiredSize",function(a,b,e,f,g,h){a.desiredSize=new N(f(g,b.width,e.width-b.width,h),f(g,b.height,e.height-b.height,h))});b.add("width",
function(a,b,e,f,g,h){a.width=f(g,b,e-b,h)});b.add("height",function(a,b,e,f,g,h){a.height=f(g,b,e-b,h)});b.add("fill",function(a,b,e,f,g,h){a.fill=Lh(b,e,g,h,f)});b.add("stroke",function(a,b,e,f,g,h){a.stroke=Lh(b,e,g,h,f)});b.add("strokeWidth",function(a,b,e,f,g,h){a.strokeWidth=f(g,b,e-b,h)});b.add("strokeDashOffset",function(a,b,e,f,g,h){a.strokeDashOffset=f(g,b,e-b,h)});b.add("background",function(a,b,e,f,g,h){a.background=Lh(b,e,g,h,f)});b.add("areaBackground",function(a,b,e,f,g,h){a.areaBackground=
Lh(b,e,g,h,f)});b.add("opacity",function(a,b,e,f,g,h){a.opacity=f(g,b,e-b,h)});b.add("scale",function(a,b,e,f,g,h){a.scale=f(g,b,e-b,h)});b.add("angle",function(a,b,e,f,g,h){a.angle=f(g,b,e-b,h)});Mh=b}
na.Object.defineProperties(ch.prototype,{animationReasons:{get:function(){return this.Se}},isEnabled:{get:function(){return this.vd},set:function(a){(this.vd=a)&&this.cj.each(function(a){a.isAnimating||Infinity!==a.runCount||a.start()})}},duration:{get:function(){return this.Lg},set:function(a){1>a&&xa(a,">= 1",ch,"duration");this.Lg=a}},isAnimating:{get:function(){return this.kc}},
isTicking:{get:function(){return this.rr}},isInitial:{get:function(){return this.$h},set:function(a){this.$h=a}},defaultAnimation:{get:function(){return this.Td}},activeAnimations:{get:function(){return this.cj}},initialAnimationStyle:{get:function(){return this.Zk},set:function(a){this.Zk=a}}});ch.prototype.stopAnimation=ch.prototype.sc;
var Mh=null,dh=!1,fh=new D(ch,"Default",1),lh=new D(ch,"AnimateLocations",2),kh=new D(ch,"None",3);ch.className="AnimationManager";ch.defineAnimationEffect=function(a,b){dh||(eh(),dh=!0);Mh.add(a,b)};ch.Default=fh;ch.AnimateLocations=lh;ch.None=kh;
function gh(){this.wu=this.ox=this.Qd=this.D=null;this.gl=this.kc=this.j=!1;this.yn=this.Cd=0;this.Pq=this.Jt=Nh;this.fl=this.Xo=!1;this.ku=1;this.iu=0;this.ud=this.Lg=NaN;this.Iw=0;this.zn=null;this.o=zb;this.nc=new H;this.du=new H;this.Rl=new G;this.eu=new G;this.Fw=Oh;return this}gh.prototype.suspend=function(){this.gl=!0};gh.prototype.advanceTo=function(a,b){b&&(this.gl=!1);this.Xo&&a>=this.ud&&(this.fl=!0,a-=this.ud);this.Iw=a;Gh(this,!0);Bh(this.Qd);uf(this.D);Dh(this.Qd);this.D.redraw()};
function mh(a,b){a.du.clear();a.fl=!1;a.iu=0;a.ud=NaN;0<a.Rl.count&&a.Rl.clear();0<a.eu.count&&a.eu.clear();if(null!==b)for(a=b.links;a.next();)a.value.gf=null}t=gh.prototype;
t.start=function(){if(0!==this.nc.count&&!this.kc){for(var a=this.D,b=this.nc.iterator;b.next();){var c=b.value.end,d=b.key;if(c["position:placeholder"]){var e=d.findVisibleNode();if(e instanceof U&&null!==e.placeholder){var f=e.placeholder;e=f.da(uc);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.D=a,b=this.Qd=a.animationManager,!1!==b.isEnabled&&(this.ud=isNaN(this.Lg)?b.duration:this.Lg,this.Pq=this.Jt,
b.Yk&&b.Zk===fh&&this===b.defaultAnimation&&(this.Pq=Ph,this.ud=isNaN(this.Lg)?600===b.duration?900:b.duration:this.Lg),this.Fw=a.scrollMode,this.isViewportUnconstrained&&(a.Ij=Qh),Bh(b),this.Rl.each(function(b){b.data=null;a.add(b)}),Dh(b),this.kc=!0,this.Cd=+new Date,this.yn=this.Cd+this.ud,Fh(b,this)))}};t.dz=function(a,b){if(!a.Nc())return this;this.Rl.add(a);this.D=b;return this};
t.add=function(a,b,c,d,e){if("position"===b&&c.A(d))return this;null===this.D&&(a instanceof Q?this.D=a:a instanceof Y&&null!==a.diagram&&(this.D=a.diagram));if(a instanceof V){if(!a.isAnimated)return this;"position"===b&&(b="position:part")}Jh(this,a,b,c,d,e);return this};
function Jh(a,b,c,d,e,f){var g=a.nc;b instanceof Q&&"position"===c&&(c="position:diagram");if("fill"===c||"stroke"===c||"background"===c||"areaBackground"===c)Rh(d),Sh(),d=[Th.j,Th.C,Th.o,Th.K],Rh(e),Sh(),e=[Th.j,Th.C,Th.o,Th.K];if(g.contains(b)){var h=g.H(b);var k=h.start;var l=h.end;void 0===k[c]&&(k[c]=Uh(d));l[c]=Uh(e)}else k={},l={},k[c]=Uh(d),l[c]=Uh(e),h=k.position,b instanceof Y&&h instanceof K&&!h.u()&&b.diagram.animationManager.Se.contains("Expand SubGraph")&&h.assign(l.position),h=new Vh(k,
l,f),g.add(b,h);g=k[c];g instanceof K&&!g.u()&&g.assign(a.o);f&&0===c.indexOf("position:")&&b instanceof V?h.Uu.location=Uh(b.location):f&&(h.Uu[c]=Uh(d))}function Uh(a){return a instanceof K?a.copy():a instanceof Gb?a.copy():a}t.Ms=function(a){if(!this.kc)return!1;a=this.nc.H(a);return null!==a&&a.Gv};t.lv=function(a){if(!this.kc)return!1;a=this.nc.H(a);return null!==a&&(a.start.position||a.start.location)};
function Gh(a,b){if(!a.gl||b){var c=a.Qd;if(!1!==a.kc){var d=+new Date,e=d>a.yn?a.ud:d-a.Cd;b&&(e=a.Iw,e<a.ud?(a.Cd=+new Date-e,a.yn=a.Cd+a.ud):e=a.ud);Bh(c);Ch(a,e);uf(a.D,!0);Dh(c);d>a.yn&&(a.Xo&&!a.fl?(a.Cd=+new Date,a.yn=a.Cd+a.ud,a.fl=!0):a.Zl(!1))}}}
function Ch(a,b){for(var c=a.ud,d=a.nc.iterator,e=a.fl;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=Mh,l;for(l in g)"position"===l&&(g["position:placeholder"]||g["position:nodeCollapse"])||null===k.get(l)||k.get(l)(f,h[l],g[l],a.Pq,b,c,a)}}}t.stop=function(){this.kc&&this.Zl(!0)};
t.Zl=function(a){null!==this.wu&&this.wu.ep.remove(this.ox);if(this.kc){var b=this.D,c=this.Qd;this.gl=this.kc=c.Yk=!1;Bh(c);for(var d=this.nc,e=this.Rl.iterator;e.next();)b.remove(e.value);for(e=this.eu.iterator;e.next();)e.value.s();e=this.Xo;d=d.iterator;for(var f=Mh;d.next();){var g=d.key,h=d.value,k=e?h.end:h.start,l=e?h.start:h.end,m=h.Uu,n;for(n in l)if(null!==f.get(n)){var p=n;!h.Mu||"position:nodeCollapse"!==p&&"position:placeholder"!==p||(p="position");f.get(p)(g,k[n],void 0!==m[n]?m[n]:
h.Mu?k[n]:l[n],this.Pq,this.ud,this.ud,this)}h.Mu&&void 0!==m.location&&g instanceof V&&(g.location=m.location);h.Gv&&g instanceof V&&g.Ob(!1)}b.Hs.clear();bf(b,!1);b.Qa();b.N();uf(b,!0);if(c.defaultAnimation===this){for(n=c.Al.iterator;n.next();)e=n.value,null!==e.gf&&(e.points=e.gf,e.gf=null);c.Al.clear()}this.isViewportUnconstrained&&(b.scrollMode=this.Fw);Dh(c);this.iu++;!a&&this.ku>this.iu?(this.fl=!1,this.start()):(this.zn&&this.zn(this),mh(this,null),c.Zl(this),b.Fb())}};
t.Oj=function(a,b){var c=b.actualBounds,d=null;b instanceof U&&(d=b.placeholder);null!==d?(c=d.da(uc),d=d.padding,c.x+=d.left,c.y+=d.top,this.add(a,"position",c,a.position,!1)):this.add(a,"position",new K(c.x+c.width/2,c.y+c.height/2),a.position,!1);this.add(a,"scale",.01,a.scale,!1);if(a instanceof U)for(a=a.memberParts;a.next();)d=a.value,d instanceof W&&this.Oj(d,b)};
t.Mj=function(a,b){if(a.isVisible()){var c=null;b instanceof U&&(c=b.placeholder);null!==c?this.add(a,"position:placeholder",a.position,c,!0):this.add(a,"position:nodeCollapse",a.position,b,!0);this.add(a,"scale",a.scale,.01,!0);c=this.nc;c.contains(a)&&(c.H(a).Gv=!0);if(a instanceof U)for(a=a.memberParts;a.next();)c=a.value,c instanceof W&&this.Mj(c,b)}};t.bA=function(a){var b=this.du.get(a);null===b&&(b={},this.du.add(a,b));return b};
na.Object.defineProperties(gh.prototype,{duration:{get:function(){return this.Lg},set:function(a){1>a&&xa(a,">= 1",gh,"duration");this.Lg=a}},reversible:{get:function(){return this.Xo},set:function(a){this.Xo=a}},runCount:{get:function(){return this.ku},set:function(a){0<a?this.ku=a:B("Animation.runCount value must be a positive integer.")}},finished:{get:function(){return this.zn},
set:function(a){this.zn!==a&&(this.zn=a)}},easing:{get:function(){return this.Jt},set:function(a){this.Jt=a}},isViewportUnconstrained:{get:function(){return this.j},set:function(a){this.j=a}},isAnimating:{get:function(){return this.kc}}});gh.prototype.getTemporaryState=gh.prototype.bA;gh.prototype.stop=gh.prototype.stop;gh.prototype.add=gh.prototype.add;gh.prototype.addTemporaryPart=gh.prototype.dz;
function Nh(a,b,c,d){a/=d/2;return 1>a?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b}function Ph(a,b,c,d){return a===d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b}gh.className="Animation";gh.EaseLinear=function(a,b,c,d){return c*a/d+b};gh.EaseInOutQuad=Nh;gh.EaseInQuad=function(a,b,c,d){return c*(a/=d)*a+b};gh.EaseOutQuad=function(a,b,c,d){return-c*(a/=d)*(a-2)+b};gh.EaseInExpo=function(a,b,c,d){return 0===a?b:c*Math.pow(2,10*(a/d-1))+b};gh.EaseOutExpo=Ph;
function Vh(a,b,c){this.start=a;this.end=b;this.Uu={};this.Mu=c;this.Gv=!1}Vh.className="AnimationState";function Wh(a,b,c){this.od=null;this.ff=a;this.wp=c||Xh;this.zk=null;void 0!==b&&(this.zk=b,void 0===c&&(this.wp=Yh))}Wh.prototype.copy=function(){var a=new Wh(this.ff);a.wp=this.wp;var b=this.zk;if(null!==b){var c={};void 0!==b.duration&&(c.duration=b.duration);void 0!==b.finished&&(c.finished=b.finished);void 0!==b.easing&&(c.easing=b.easing);a.zk=c}return a};
function Zh(a,b){a=a.zk;null!==a&&(a.duration&&(b.duration=a.duration),a.finished&&(b.finished=a.finished),a.easing&&(b.easing=a.easing))}na.Object.defineProperties(Wh.prototype,{propertyName:{get:function(){return this.ff},set:function(a){this.ff=a}},animationSettings:{get:function(){return this.zk},set:function(a){this.zk=a}},startCondition:{get:function(){return this.wp},set:function(a){this.wp=a}}});
var Xh=new D(Wh,"Default",1),Yh=new D(Wh,"Immediate",2),$h=new D(Wh,"Bundled",3);Wh.className="AnimationTrigger";Wh.Default=Xh;Wh.Immediate=Yh;Wh.Bundled=$h;function ai(){Va(this);this.D=null;this.Ha=new E;this.na="";this.mb=1;this.o=!1;this.j=this.oi=this.C=this.Od=this.Nd=this.tc=this.Rb=this.Qb=this.Gb=this.Ma=this.Pd=this.Ba=this.je=this.wa=this.K=!0;this.Jo=[]}t=ai.prototype;t.clear=function(){this.Ha.clear();this.Jo.length=0};t.Ne=function(a){this.D=a};
t.toString=function(a){void 0===a&&(a=0);var b='Layer "'+this.name+'"';if(0>=a)return b;for(var c=0,d=0,e=0,f=0,g=0,h=this.Ha.iterator;h.next();){var k=h.value;k instanceof U?e++:k instanceof W?d++:k instanceof T?f++:k instanceof ze?g++:c++}h="";0<c&&(h+=c+" Parts ");0<d&&(h+=d+" Nodes ");0<e&&(h+=e+" Groups ");0<f&&(h+=f+" Links ");0<g&&(h+=g+" Adornments ");if(1<a)for(a=this.Ha.iterator;a.next();)c=a.value,h+="\n    "+c.toString(),d=c.data,null!==d&&ib(d)&&(h+=" #"+ib(d)),c instanceof W?h+=" "+
Ka(d):c instanceof T&&(h+=" "+Ka(c.fromNode)+" "+Ka(c.toNode));return b+" "+this.Ha.count+": "+h};t.Zb=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);if(!1===this.oi)return null;var d=!1;null!==this.diagram&&this.diagram.viewportBounds.$(a)&&(d=!0);for(var e=K.alloc(),f=this.Ha.l,g=f.length;g--;){var h=f[g];if((!0!==d||!1!==mg(h))&&h.isVisible()&&(e.assign(a),ub(e,h.ee),h=h.Zb(e,b,c),null!==h&&(null!==b&&(h=b(h)),null!==h&&(null===c||c(h)))))return K.free(e),h}K.free(e);return null};
t.Hi=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof E||d instanceof G||(d=new G);if(!1===this.oi)return d;var e=!1;null!==this.diagram&&this.diagram.viewportBounds.$(a)&&(e=!0);for(var f=K.alloc(),g=this.Ha.l,h=g.length;h--;){var k=g[h];if((!0!==e||!1!==mg(k))&&k.isVisible()){f.assign(a);ub(f,k.ee);var l=k;k.Hi(f,b,c,d)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||d.add(l))}}K.free(f);return d};
t.zf=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof E||e instanceof G||(e=new G);if(!1===this.oi)return e;var f=!1;null!==this.diagram&&this.diagram.viewportBounds.Ge(a)&&(f=!0);for(var g=this.Ha.l,h=g.length;h--;){var k=g[h];if((!0!==f||!1!==mg(k))&&k.isVisible()){var l=k;k.zf(a,b,c,d,e)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||e.add(l))}}return e};
t.Zu=function(a,b,c,d,e,f,g){if(!1===this.oi)return e;for(var h=this.Ha.l,k=h.length;k--;){var l=h[k];if((!0!==g||!1!==mg(l))&&f(l)&&l.isVisible()){var m=l;l.zf(a,b,c,d,e)&&(null!==b&&(m=b(m)),null===m||null!==c&&!c(m)||e.add(m))}}return e};
t.qg=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 G)f=e;e=!0}f instanceof E||f instanceof G||(f=new G);if(!1===this.oi)return f;var g=!1;null!==this.diagram&&this.diagram.viewportBounds.$(a)&&(g=!0);for(var h=K.alloc(),k=K.alloc(),l=this.Ha.l,m=l.length;m--;){var n=l[m];if((!0!==g||!1!==mg(n))&&n.isVisible()){h.assign(a);ub(h,n.ee);k.h(a.x+b,a.y);ub(k,n.ee);var p=n;n.qg(h,k,c,d,e,f)&&(null!==c&&(p=c(p)),null===
p||null!==d&&!d(p)||f.add(p))}}K.free(h);K.free(k);return f};
t.Md=function(a,b){if(this.visible){var c=this.Ha.l,d=c.length;if(0!==d){a=Ea();for(var e=Ea(),f=0;f<d;f++){var g=c[f];g.Ww=f;if(g instanceof T){if(!1===g.td)continue}else if(g instanceof ze&&null!==g.adornedPart)continue;var h=g.actualBounds;g.isVisible()&&$b(h,b)?(g.Md(!0),a.push(g)):(g.Md(!1),null!==g.adornments&&0<g.adornments.count&&e.push(g))}for(b=0;b<a.length;b++)for(c=a[b],bi(c),c=c.adornments;c.next();)d=c.value,d.measure(Infinity,Infinity),d.arrange(),d.Md(!0);for(b=0;b<e.length;b++)bi(e[b]);
Ia(a);Ia(e)}}};function ci(a,b){var c=1;1!==a.mb&&(c=b.globalAlpha,b.globalAlpha=c*a.mb);return c}t.pc=function(a,b,c){if(this.visible&&0!==this.mb&&(void 0===c&&(c=!0),c||!this.isTemporary)){c=this.Ha.l;var d=c.length;if(0!==d){var e=ci(this,a),f=this.Jo;f.length=0;for(var g=b.scale,h=N.alloc(),k=0;k<d;k++)this.Di(a,c[k],b,f,g,h,!0);N.free(h);a.globalAlpha=e}}};
t.Di=function(a,b,c,d,e,f,g){if(!g||mg(b)){if(null!==d&&b instanceof T&&(b.isOrthogonal&&d.push(b),!1===b.td))return;g=!1;for(d=b.containingGroup;null!==d;)g?null!==d.$a&&f.ey(d.$a):null!==d.$a&&(g=!0,f.assign(d.$a)),d=d.containingGroup;var h=b.actualBounds;d=!1;if(g&&b.isVisible()){if(!f.Mc(h))return;d=!f.Ge(h)}d&&(a.save(),a.beginPath(),a.rect(f.x,f.y,f.width,f.height),a.clip());h.width*e>c.wr||h.height*e>c.wr?b.pc(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&&(di(b,a,b.areaBackground,!0,!0,f,e),a.fillRect(e.x,e.y,e.width,e.height)),null===b.areaBackground&&null===b.background&&(di(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),di(b,a,b.background,!0,!1,f,e),a.fillRect(0,0,f.width/2,f.height/2),c.Cs()||(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.Ic(!0))}};t.g=function(a,b,c,d,e){var f=this.diagram;null!==f&&f.Wa(ge,a,this,b,c,d,e)};t.Ni=function(a,b,c){var d=this.Ha;b.fi=this;if(a>=d.count)a=d.count;else if(d.J(a)===b)return-1;d.vb(a,b);b.cq(c);d=this.diagram;null!==d&&(c?d.N():d.Ni(b));ei(this,a,b);return a};
t.rc=function(a,b,c){if(!c&&b.layer!==this&&null!==b.layer)return b.layer.rc(a,b,c);var d=this.Ha;if(0>a||a>=d.length){if(a=d.indexOf(b),0>a)return-1}else if(d.J(a)!==b&&(a=d.indexOf(b),0>a))return-1;b.eq(c);d.eb(a);d=this.diagram;null!==d&&(c?d.N():d.rc(b));b.fi=null;return a};
function ei(a,b,c){b=fi(a,b,c);if(c instanceof U&&null!==c&&isNaN(c.zOrder)){if(0!==c.memberParts.count){for(var d=-1,e=a.Ha.l,f=e.length,g=0;g<f;g++){var h=e[g];if(h===c&&(b=g,0<=d))break;if(0>d&&h.containingGroup===c&&(d=g,0<=b))break}!(0>d)&&d<b&&(e=a.Ha,e.eb(b),e.vb(d,c))}c=c.containingGroup;null!==c&&ei(a,-1,c)}}
function fi(a,b,c){var d=c.zOrder;if(isNaN(d))return b;a=a.Ha;var e=a.count;if(1>=e)return b;0>b&&(b=a.indexOf(c));if(0>b)return-1;for(var f=b-1,g=NaN;0<=f;){g=a.J(f).zOrder;if(!isNaN(g))break;f--}for(var h=b+1,k=NaN;h<e;){k=a.J(h).zOrder;if(!isNaN(k))break;h++}if(!isNaN(g)&&g>d)for(;;){if(-1===f||g<=d){f++;if(f===b)break;a.eb(b);a.vb(f,c);return f}for(g=NaN;0<=--f&&(g=a.J(f).zOrder,isNaN(g)););}else if(!isNaN(k)&&k<d)for(;;){if(h===e||k>=d){h--;if(h===b)break;a.eb(b);a.vb(h,c);return h}for(k=NaN;++h<
e&&(k=a.J(h).zOrder,isNaN(k)););}return b}
na.Object.defineProperties(ai.prototype,{parts:{get:function(){return this.Ha.iterator}},partsBackwards:{get:function(){return this.Ha.iteratorBackwards}},diagram:{get:function(){return this.D}},name:{get:function(){return this.na},set:function(a){var b=this.na;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.na=a;this.g("name",b,a);for(a=this.Ha.iterator;a.next();)a.value.layerName=this.na}}},opacity:{get:function(){return this.mb},set:function(a){var b=this.mb;b!==a&&((0>a||1<a)&&xa(a,"0 <= value <= 1",ai,"opacity"),this.mb=a,this.g("opacity",b,a),a=this.diagram,null!==a&&a.N())}},isTemporary:{get:function(){return this.o},set:function(a){var b=this.o;if(b!==a){if(this.o=a)this.isInDocumentBounds=
!1;this.g("isTemporary",b,a)}}},visible:{get:function(){return this.C},set:function(a){var b=this.C;if(b!==a){this.C=a;this.g("visible",b,a);for(b=this.Ha.iterator;b.next();)b.value.Ob(a);a=this.diagram;null!==a&&a.N()}}},pickable:{get:function(){return this.oi},set:function(a){var b=this.oi;b!==a&&(this.oi=a,this.g("pickable",b,a))}},isInDocumentBounds:{get:function(){return this.j},set:function(a){this.j!==
a&&(this.j=a,null!==this.diagram&&this.diagram.Qa())}},allowCopy:{get:function(){return this.K},set:function(a){var b=this.K;b!==a&&(this.K=a,this.g("allowCopy",b,a))}},allowDelete:{get:function(){return this.wa},set:function(a){var b=this.wa;b!==a&&(this.wa=a,this.g("allowDelete",b,a))}},allowTextEdit:{get:function(){return this.je},set:function(a){var b=this.je;b!==a&&(this.je=a,this.g("allowTextEdit",b,a))}},
allowGroup:{get:function(){return this.Ba},set:function(a){var b=this.Ba;b!==a&&(this.Ba=a,this.g("allowGroup",b,a))}},allowUngroup:{get:function(){return this.Pd},set:function(a){var b=this.Pd;b!==a&&(this.Pd=a,this.g("allowUngroup",b,a))}},allowLink:{get:function(){return this.Ma},set:function(a){var b=this.Ma;b!==a&&(this.Ma=a,this.g("allowLink",b,a))}},allowRelink:{get:function(){return this.Gb},
set:function(a){var b=this.Gb;b!==a&&(this.Gb=a,this.g("allowRelink",b,a))}},allowMove:{get:function(){return this.Qb},set:function(a){var b=this.Qb;b!==a&&(this.Qb=a,this.g("allowMove",b,a))}},allowReshape:{get:function(){return this.Rb},set:function(a){var b=this.Rb;b!==a&&(this.Rb=a,this.g("allowReshape",b,a))}},allowResize:{get:function(){return this.tc},set:function(a){var b=this.tc;b!==a&&(this.tc=a,this.g("allowResize",
b,a))}},allowRotate:{get:function(){return this.Nd},set:function(a){var b=this.Nd;b!==a&&(this.Nd=a,this.g("allowRotate",b,a))}},allowSelect:{get:function(){return this.Od},set:function(a){var b=this.Od;b!==a&&(this.Od=a,this.g("allowSelect",b,a))}}});ai.prototype.findObjectsNear=ai.prototype.qg;ai.prototype.findObjectsIn=ai.prototype.zf;ai.prototype.findObjectsAt=ai.prototype.Hi;ai.prototype.findObjectAt=ai.prototype.Zb;ai.className="Layer";
function Q(a,b){gi||(hi(),gi=!0);Va(this);ve=this;this.Wb=!0;this.Ga=null;this.ta=this.ua=0;this.Ca=null;if(Kg){var c=this,d=function(){c.removeEventListener(x.document,"DOMContentLoaded",d,!1);c.setRTL()};null!==x.document.body?this.setRTL():c.addEventListener(x.document,"DOMContentLoaded",d,!1)}this.bt=this.zb=this.zl=null;ii.add("Model",ji);this.dc=null;var e=this;this.rw=function(a){var b=e.partManager;if(a.model===b.diagram.model&&b.diagram.Z){b.diagram.Z=!1;try{var c=a.change;""===a.modelChange&&
c===ge&&b.updateDataBindings(a.object,a.propertyName)}finally{b.diagram.Z=!0}}};this.sw=function(a){e.partManager.doModelChanged(a)};this.Wq=this.gp=this.Or=null;ki(this);this.model=li();this.kh=!0;mi(this);this.layout=new ni;this.kh=!1;this.nk=this.pk=this.mk=this.lk=this.xA=this.ik=this.gw=this.Mw=this.It=null;this.oq=function(){};this.preventDefault=null;this.Tn=!1;this.Zh=new oi;void 0!==a&&("string"===typeof a||x.Element&&a instanceof Element?pi(this,a):b=a);this.Wb=!1;b&&this.zm(b);return this}
function ki(a){a.Qd=new ch;a.Qd.Ne(a);a.tb=17;a.ix=!1;a.Vn=!1;a.ju="default";a.Oa=new E;a.Qy=new H;a.dg=null;a.wy();a.bl=null;a.vy();a.mb=1;a.ja=(new K(NaN,NaN)).freeze();a.lu=new K(NaN,NaN);a.sa=1;a.Sq=1;a.vv=(new K(NaN,NaN)).freeze();a.xv=NaN;a.$v=1E-4;a.Lv=100;a.ub=new od;a.mt=(new K(NaN,NaN)).freeze();a.pv=(new N(NaN,NaN,NaN,NaN)).freeze();a.Hj=(new lc(0,0,0,0)).freeze();a.Ij=Oh;a.gt=!1;a.ct=null;a.dt=null;a.Ph=nh;a.Hk=Wc;a.Rg=nh;a.ir=Wc;a.rv=uc;a.Av=uc;a.Wc=!0;a.Qn=!1;a.se=new G;a.Xh=new H;a.rn=
!0;a.Cq=250;a.Ak=-1;a.Eq=(new lc(16,16,16,16)).freeze();a.kg=!1;a.Rk=!1;a.An=!0;a.cr=new ce;a.cr.diagram=a;a.hh=new ce;a.hh.diagram=a;a.tj=new ce;a.tj.diagram=a;a.Ag=null;a.df=null;a.su=!1;a.Gt=null;a.Ft=null;qi(a);a.wi=new G;a.Bv=!0;a.jt=ri;a.ow=!1;a.lt=Cf;a.ht=null;a.av=null;a.Tu=null;a.Ou="auto";a.Zi="auto";a.Bg=null;a.Jg=null;a.Dg=null;a.bh=null;a.$g=null;a.Zg=null;a.fw=null;a.Xg=null;a.qv=!1;a.Yg=null;a.ah=null;a.uh=null;a.Eg=null;a.cu=!1;a.gu={};a.wl=[null,null];a.Hu=null;a.kh=!1;a.tw=!1;a.qu=
!1;a.Et=!1;a.qw=!0;a.lc=!1;a.pj=!1;a.ux=!0;a.re=-2;a.fh=new H;a.Oo=new E;a.Sg=!1;a.vd=!0;a.pt=!0;a.K=!0;a.wa=!0;a.qt=!1;a.rt=!0;a.je=!0;a.Ba=!0;a.Pd=!0;a.ut=!0;a.Ma=!0;a.Gb=!0;a.Qb=!0;a.Rb=!0;a.tc=!0;a.Nd=!0;a.Od=!0;a.$s=!0;a.Gu=!0;a.pw=!1;a.el=!1;a.Nn=!0;a.On=!0;a.tt=!0;a.Au=!0;a.et=16;a.ft=16;a.Nr=!1;a.nu=!1;a.pu=0;a.ou=0;a.nb=(new lc(5)).freeze();a.jx=(new G).freeze();a.Wv=999999999;a.Rw=(new G).freeze();a.lj=!0;a.mj=!0;a.nj=!0;a.Ye=!1;a.Sf=!1;a.vc=null;a.Oh=!0;a.Uf=!1;a.Ky=new G;a.Sw=new G;a.Zc=
null;a.ax=1;a.kx=0;a.dd={scale:1,position:new K,bounds:new N,Ex:new Gb,ny:new Gb,iy:!1};a.tx=(new N(NaN,NaN,NaN,NaN)).freeze();a.Gp=(new Gb(NaN,NaN)).freeze();a.Uq=(new N(NaN,NaN,NaN,NaN)).freeze();a.Ev=!1;a.j=null;a.C=null;a.o=null;a.Lw=null;a.Jw=null;a.Kw=null;a.tk=null;a.$i=null;a.bj=null;a.j=new H;var b=new W,c=new Mg;c.bind(new si("text","",Ka));b.add(c);a.Lw=b;a.j.add("",b);b=new W;c=new Mg;c.stroke="brown";c.bind(new si("text","",Ka));b.add(c);a.j.add("Comment",b);b=new W;b.selectable=!1;b.avoidable=
!1;c=new xf;c.figure="Ellipse";c.fill="black";c.stroke=null;c.desiredSize=(new Gb(3,3)).ca();b.add(c);a.j.add("LinkLabel",b);a.C=new H;b=new U;b.selectionObjectName="GROUPPANEL";b.type=X.Vertical;c=new Mg;c.font="bold 12pt sans-serif";c.bind(new si("text","",Ka));b.add(c);c=new X(X.Auto);c.name="GROUPPANEL";var d=new xf;d.figure="Rectangle";d.fill="rgba(128,128,128,0.2)";d.stroke="black";c.add(d);d=new ng;d.padding=(new lc(5,5,5,5)).ca();c.add(d);b.add(c);a.Jw=b;a.C.add("",b);a.o=new H;b=new T;c=
new xf;c.isPanelMain=!0;b.add(c);c=new xf;c.toArrow="Standard";c.fill="black";c.stroke=null;c.strokeWidth=0;b.add(c);a.Kw=b;a.o.add("",b);b=new T;c=new xf;c.isPanelMain=!0;c.stroke="brown";b.add(c);a.o.add("Comment",b);b=new ze;b.type=X.Auto;c=new xf;c.fill=null;c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);c=new ng;c.margin=(new lc(1.5,1.5,1.5,1.5)).ca();b.add(c);a.tk=b;a.$i=b;b=new ze;b.type=X.Link;c=new xf;c.isPanelMain=!0;c.fill=null;c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);a.bj=b;a.Vb=
null;a.gr=!1;a.Kk=null;a.partManager=new ji;a.toolManager=new Pa;a.toolManager.initializeStandardTools();a.defaultTool=a.toolManager;a.currentTool=a.defaultTool;a.fv=null;a.pn=new Me;a.lw=null;a.at=null;a.Zr=!1;a.commandHandler=ti();a.$r=!1;a.er=null;a.fr=Fb;a.qx=!1;a.ec=1;a.si=null;a.wr=1;a.zr=0;a.Zw=[0,0,0,0,0];a.Ar=0;a.sr=1;a.Uw=0;a.Vw=new K;a.Xy=500;a.Dq=new K;a.Wt=!1}
Q.prototype.clear=function(){this.animationManager.sc();this.model.clear();ui=null;Bi="";Ci(this,!1);this.Oo.clear();Di();this.fh.clear();this.Qa();this.Ta();this.N()};
function Ci(a,b){a.animationManager.sc(!0);a.jx=(new G).freeze();a.Rw=(new G).freeze();var c=a.skipsUndoManager;null!==a.model&&(a.skipsUndoManager=!0);var d=null;null!==a.Vb&&(d=a.Vb.part,null!==d&&a.remove(d));var e=[],f=a.Oa.length;if(b){for(b=0;b<f;b++)for(var g=a.Oa.l[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.Oa.l[b].clear();a.partManager.clear();a.se.clear();a.Xh.clear();a.wi.clear();a.Kk=null;a.Oo.clear();Di();
a.fh.clear();Fa=[];null!==d&&(a.add(d),a.partManager.parts.remove(d));null!==a.model&&(a.skipsUndoManager=c);return e}function ti(){return null}Q.prototype.reset=function(){this.clear();this.Wb=!0;ki(this);Ei(this);this.kh=!0;mi(this);this.layout=new ni;this.kh=!1;this.model=li();this.model.undoManager=new se;this.Wb=this.Tn=!1;this.N()};
Q.prototype.setRTL=function(a){a=void 0===a?this.div:a;null===a&&(a=x.document.body);var b=va("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.ju=c};
Q.prototype.setScrollWidth=function(a){a=void 0===a?this.div:a;null===a&&(a=x.document.body);var b=0;if(Kg){var c=Fi;b=Gi;null===c&&(c=Fi=va("p"),c.style.width="100%",c.style.height="200px",c.style.boxSizing="content-box",b=Gi=va("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||Ua||(b=11)}this.tb=b;this.ix=!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.Oa.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 Hi(a){var b=a.Ca.La;b instanceof HTMLCanvasElement&&(a.addEventListener(b,"pointerdown",a.lk,!1),a.addEventListener(b,"pointermove",a.mk,!1),a.addEventListener(b,"pointerup",a.pk,!1),a.addEventListener(b,"pointerout",a.nk,!1),a.addEventListener(b,"pointerenter",a.zz,!1),a.addEventListener(b,"pointerleave",a.Az,!1),a.addEventListener(b,"wheel",a.ik,!1),a.addEventListener(b,"keydown",a.nA,!1),a.addEventListener(b,"keyup",a.oA,!1),a.addEventListener(b,"blur",a.kz,!1),a.addEventListener(b,"focus",
a.lz,!1),a.addEventListener(b,"selectstart",function(a){a.preventDefault();return!1},!1),a.addEventListener(b,"contextmenu",function(a){a.preventDefault();return!1},!1),a.addEventListener(x,"resize",a.gw,!1))}function Pe(a){30<a.zr&&(a.si=1)}function bf(a,b){null!==a.si&&(a.si=null,b&&a.oq(),Za&&Za.Ox||(a.zr=0,a.Zw=[0,0,0,0,0],a.Ar=0))}Q.prototype.computePixelRatio=function(){return null!==this.si?this.si: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.Ca)if(this.scrollsPageOnFocus)this.Ca.focus();else{var a=x.scrollX||x.pageXOffset,b=x.scrollY||x.pageYOffset;this.Ca.focus();x.scrollTo(a,b)}};Q.prototype.lz=function(){this.D.S("GainedFocus")};Q.prototype.kz=function(){this.D.S("LostFocus")};
function Ah(a){if(null!==a.Ca){var b=a.Ga;if(0!==b.clientWidth&&0!==b.clientHeight){a.ix||a.setScrollWidth();var c=a.Sf?a.tb:0,d=a.Ye?a.tb:0,e=a.ec;a.ec=a.computePixelRatio();a.ec!==e&&(a.Qn=!0,a.Fb());if(b.clientWidth!==a.ua+c||b.clientHeight!==a.ta+d)a.mj=!0,a.Wc=!0,b=a.layout,null!==b&&b.isViewportSized&&a.autoScale===nh&&(a.Rk=!0,b.B()),a.lc||a.Fb()}}}
function mi(a){var b=new ai;b.name="Background";a.Ul(b);b=new ai;b.name="";a.Ul(b);b=new ai;b.name="Foreground";a.Ul(b);b=new ai;b.name="Adornment";b.isTemporary=!0;b.isInDocumentBounds=!1;a.Ul(b);b=new ai;b.name="Tool";b.isTemporary=!0;b.isInDocumentBounds=!0;a.Ul(b);b=new ai;b.name="Grid";b.allowSelect=!1;b.pickable=!1;b.isTemporary=!0;b.isInDocumentBounds=!1;a.xx(b,a.Zj("Background"))}
function Ii(a){a.Vb=new X(X.Grid);a.Vb.name="GRID";var b=new xf;b.figure="LineH";b.stroke="lightgray";b.strokeWidth=.5;b.interval=1;a.Vb.add(b);b=new xf;b.figure="LineH";b.stroke="gray";b.strokeWidth=.5;b.interval=5;a.Vb.add(b);b=new xf;b.figure="LineH";b.stroke="gray";b.strokeWidth=1;b.interval=10;a.Vb.add(b);b=new xf;b.figure="LineV";b.stroke="lightgray";b.strokeWidth=.5;b.interval=1;a.Vb.add(b);b=new xf;b.figure="LineV";b.stroke="gray";b.strokeWidth=.5;b.interval=5;a.Vb.add(b);b=new xf;b.figure=
"LineV";b.stroke="gray";b.strokeWidth=1;b.interval=10;a.Vb.add(b);b=new V;b.add(a.Vb);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.Vb.visible=!1}function Ji(){this.D.nu?this.D.nu=!1:this.D.isEnabled?this.D.Kx(this):Ki(this.D)}function Li(a){this.D.isEnabled?(this.D.pu=a.target.scrollTop,this.D.ou=a.target.scrollLeft):Ki(this.D)}
Q.prototype.Kx=function(a){if(null!==this.Ca){this.Nr=!0;var b=this.documentBounds,c=this.viewportBounds,d=this.Hj,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.Vn)switch(this.ju){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=K.allocAt(this.position.x,this.position.y),
this.allowHorizontalScroll&&this.ou!==u&&(q.x=u/c+e,this.ou=u),this.allowVerticalScroll&&this.pu!==a.scrollTop&&(q.y=a.scrollTop/c+f,this.pu=a.scrollTop),this.position=q,K.free(q),this.mj=this.Nr=!1):(q=K.alloc(),a.Sy&&this.allowHorizontalScroll&&(e<l&&(this.position=q.h(u+e,this.position.y)),k>p&&(this.position=q.h(-(this.Or.scrollWidth-this.ua)+u-this.ua/c+k,this.position.y))),a.Ty&&this.allowVerticalScroll&&(f<b&&(this.position=q.h(this.position.x,a.scrollTop+f)),d>r&&(this.position=q.h(this.position.x,
-(this.Or.scrollHeight-this.ta)+a.scrollTop-this.ta/c+d))),K.free(q),Mi(this),this.mj=this.Nr=!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.gp.style.width="1px"),n>=h&&f>=b&&d<=r&&(this.gp.style.height="1px"))}};Q.prototype.computeBounds=function(a){void 0===a&&(a=new N);ih(this);return Ni(this,a)};
function Ni(a,b){if(a.fixedBounds.u())return b.assign(a.fixedBounds),b.Mp(a.nb),b;for(var c=!0,d=a.Oa.l,e=d.length,f=0;f<e;f++){var g=d[f];if(g.visible&&g.isInDocumentBounds){g=g.Ha.l;for(var h=g.length,k=0;k<h;k++){var l=g[k];l.isInDocumentBounds&&l.isVisible()&&(l=l.actualBounds,l.u()&&(c?(c=!1,b.assign(l)):b.Rc(l)))}}}c&&b.h(0,0,0,0);b.Mp(a.nb);return b}
Q.prototype.computePartsBounds=function(a,b){void 0===b&&(b=!1);var c=null;if(Aa(a))for(var d=0;d<a.length;d++){var e=a[d];!b&&e instanceof T||(e.Ta(),null===c?c=e.actualBounds.copy():c.Rc(e.actualBounds))}else for(a=a.iterator;a.next();)d=a.value,!b&&d instanceof T||(d.Ta(),null===c?c=d.actualBounds.copy():c.Rc(d.actualBounds));return null===c?new N(NaN,NaN,0,0):c};
function Oi(a,b){if((b||a.Uf)&&!a.Wb&&null!==a.Ca&&a.documentBounds.u()){if(b){var c=a.initialPosition;if(c.u()){a.position=c;return}c=K.alloc();c.Ti(a.documentBounds,a.initialDocumentSpot);var d=a.viewportBounds;d=N.allocAt(0,0,d.width,d.height);var e=K.alloc();e.Ti(d,a.initialViewportSpot);e.h(c.x-e.x,c.y-e.y);a.position=e;N.free(d);K.free(e);K.free(c)}a.Wb=!0;c=a.Ph;b&&a.Rg!==nh&&(c=a.Rg);var f=c!==nh?Pi(a,c):a.scale;c=a.ja.x;d=a.ja.y;e=a.ua/f;var g=a.ta/f,h=a.Hk,k=a.ir;b&&!h.hb()&&(k.hb()||k.Mb())&&
(h=k.Mb()?yc:k);Qi(a,a.documentBounds,e,g,h,b);b=a.scale;a.scale=f;a.Wb=!1;Ri(a);Si(a,!0,!1);f=a.viewportBounds;if(!(M.w(f.x,c)&&M.w(f.y,d)&&M.w(f.width,e)&&M.w(f.height,g)))a.onViewportBoundsChanged(new N(c,d,e,g),f,b,!1)}}
function Pi(a,b){var c=a.Sq;if(null===a.Ca)return c;a.Ta();var d=a.documentBounds;if(!d.u())return c;var e=d.width;d=d.height;var f=a.ua+(a.Sf?a.tb:0),g=a.ta+(a.Ye?a.tb:0),h=f/e,k=g/d;return b===Ti?(b=Math.min(k,h),b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):b===Ui?(b=k>h?(g-a.tb)/d:(f-a.tb)/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.Ij;this.Ij=Oh;this.scale=Pi(this,Ti);a!==Oh&&(Oi(this,!1),Qi(this,this.documentBounds,this.ua/this.sa,this.ta/this.sa,this.Hk,!1));this.Ij=a};t=Q.prototype;
t.$A=function(a,b){void 0===b&&(b=Ti);var c=a.width,d=a.height;if(!(0===c||0===d||isNaN(c)&&isNaN(d))){var e=1;if(b===Ti||b===Ui)if(isNaN(c))e=this.viewportBounds.height*this.scale/d;else if(isNaN(d))e=this.viewportBounds.width*this.scale/c;else{e=this.ua;var f=this.ta;e=b===Ui?f/d>e/c?(f-(this.Ye?this.tb:0))/d:(e-(this.Sf?this.tb:0))/c:Math.min(f/d,e/c)}this.scale=e;this.position=new K(a.x,a.y)}};
t.ez=function(a,b){this.Ta();var c=this.documentBounds,d=this.viewportBounds;this.position=new K(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.Xz=function(a){if(a instanceof Y){this.er=a;var b=K.alloc();this.fr=this.wq(a.da(uc,b));K.free(b)}else this.er=null,this.fr=Fb};
function Qi(a,b,c,d,e,f){var g=K.allocAt(a.ja.x,a.ja.y),h=g.x,k=g.y;if(null!==a.er){var l=K.alloc();l=a.er.da(uc,l);h=l.x-a.fr.x/a.scale;k=l.y-a.fr.y/a.scale;e=rc;K.free(l)}if(f||a.scrollMode===Oh)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.Hj,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.nb.left;g.y=isFinite(k)?k:-a.nb.top;null!==a.positionComputation&&(b=a.positionComputation(a,g),g.x=b.x,g.y=b.y);Kh(a.Qd,a.ja,g);a.ja.h(g.x,g.y);Ei(a);K.free(g)}
t.am=function(a,b){void 0===b&&(b=!0);if(b){if(a=mf(this,a,function(a){return a.part},function(a){return a.canSelect()}),a instanceof V)return a}else if(a=mf(this,a,function(a){return a.part}),a instanceof V)return a;return null};t.Zb=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);ih(this);for(var d=this.Oa.iteratorBackwards;d.next();){var e=d.value;if(e.visible&&(e=e.Zb(a,b,c),null!==e))return e}return null};
function mf(a,b,c,d){void 0===c&&(c=null);void 0===d&&(d=null);ih(a);for(a=a.Oa.iteratorBackwards;a.next();){var e=a.value;if(e.visible&&!e.isTemporary&&(e=e.Zb(b,c,d),null!==e))return e}return null}t.Kz=function(a,b,c){void 0===b&&(b=!0);return Vi(this,a,function(a){return a.part},b?function(a){return a instanceof V&&a.canSelect()}:null,c)};
function Vi(a,b,c,d,e){void 0===c&&(c=null);void 0===d&&(d=null);e instanceof E||e instanceof G||(e=new G);ih(a);for(a=a.Oa.iteratorBackwards;a.next();){var f=a.value;f.visible&&!f.isTemporary&&f.Hi(b,c,d,e)}return e}t.Hi=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof E||d instanceof G||(d=new G);ih(this);for(var e=this.Oa.iteratorBackwards;e.next();){var f=e.value;f.visible&&f.Hi(a,b,c,d)}return d};
t.Tx=function(a,b,c,d){void 0===b&&(b=!1);void 0===c&&(c=!0);return Wi(this,a,function(a){return a instanceof V&&(!c||a.canSelect())},b,d)};t.zf=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof E||e instanceof G||(e=new G);ih(this);for(var f=this.Oa.iteratorBackwards;f.next();){var g=f.value;g.visible&&g.zf(a,b,c,d,e)}return e};
t.Zu=function(a,b,c,d,e,f){var g=new G;ih(this);for(var h=this.Oa.iteratorBackwards;h.next();){var k=h.value;k.visible&&k.Zu(a,b,c,d,g,e,f)}return g};function Wi(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 G||(e=new G);ih(a);for(a=a.Oa.iteratorBackwards;a.next();){var g=a.value;g.visible&&!g.isTemporary&&g.zf(b,f,c,d,e)}return e}
t.Lz=function(a,b,c,d,e){void 0===c&&(c=!0);void 0===d&&(d=!0);return Xi(this,a,b,function(a){return a instanceof V&&(!d||a.canSelect())},c,e)};t.qg=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 G)f=e;e=!0}f instanceof E||f instanceof G||(f=new G);ih(this);for(var g=this.Oa.iteratorBackwards;g.next();){var h=g.value;h.visible&&h.qg(a,b,c,d,e,f)}return f};
function Xi(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 G)f=e;e=!0}f instanceof E||f instanceof G||(f=new G);ih(a);for(a=a.Oa.iteratorBackwards;a.next();){var h=a.value;h.visible&&!h.isTemporary&&h.qg(b,c,g,d,e,f)}return f}Q.prototype.acceptEvent=function(a){return Yi(this,a,a instanceof MouseEvent)};
function Yi(a,b,c){var d=a.hh;a.hh=a.tj;a.tj=d;d.diagram=a;d.event=b;c?Zi(a,b,d):(d.viewPoint=a.hh.viewPoint,d.documentPoint=a.hh.documentPoint);a=0;b.ctrlKey&&(a+=1);b.altKey&&(a+=2);b.shiftKey&&(a+=4);b.metaKey&&(a+=8);d.modifiers=a;d.button=b.button;void 0!==b.buttons&&(d.buttons=b.buttons);Ta&&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=$i(b);d.targetObject=null;return d}
function $i(a){var b=a.target.D;if(b)return b;(b=a.path)||"function"!==typeof a.composedPath||(b=a.composedPath());return b&&b[0]?b[0].D:null}
function aj(a,b,c,d,e,f){var g=a.hh;a.hh=a.tj;a.tj=g;g.diagram=a;g.clickCount=1;a=g.delta=0;b.ctrlKey&&(a+=1);b.altKey&&(a+=2);b.shiftKey&&(a+=4);b.metaKey&&(a+=8);g.modifiers=a;g.event=b;g.timestamp=b.timeStamp;g.button=b.button;g.buttons=b.buttons;Ta&&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 bj(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.nA=function(a){var b=this.D;if(!this.D.isEnabled)return!1;var c=Yi(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 bj(c,a)};
Q.prototype.oA=function(a){var b=this.D;if(!b.isEnabled)return!1;var c=Yi(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 bj(c,a)};
Q.prototype.zz=function(a){var b=this.D;if(!b.isEnabled)return!1;var c=Yi(b,a,!0);null!==b.mouseEnter&&b.mouseEnter(c);return bj(c,a)};Q.prototype.Az=function(a){var b=this.D;if(!b.isEnabled)return!1;var c=Yi(b,a,!0);null!==b.mouseLeave&&b.mouseLeave(c);return bj(c,a)};
Q.prototype.getMouse=function(a){var b=this.Ca;if(null===b)return new K(0,0);var c=b.getBoundingClientRect();b=a.clientX-this.ua/c.width*c.left;a=a.clientY-this.ta/c.height*c.top;return null!==this.ub?ub(new K(b,a),this.ub):new K(b,a)};
function Zi(a,b,c){var d=a.Ca,e=a.ua,f=a.ta,g=0,h=0;null!==d&&(d=d.getBoundingClientRect(),g=b.clientX-e/d.width*d.left,h=b.clientY-f/d.height*d.top);c.viewPoint.h(g,h);null!==a.ub?(b=K.allocAt(g,h),a.ub.Hd(b),c.documentPoint.assign(b),K.free(b)):c.documentPoint.h(g,h)}
function de(a,b,c,d){if(void 0!==b.targetTouches){if(2>b.targetTouches.length)return;b=b.targetTouches[c]}else if(null!==a.wl[0])b=a.wl[c];else return;c=a.Ca;null!==c&&(c=c.getBoundingClientRect(),d.h(b.clientX-a.ua/c.width*c.left,b.clientY-a.ta/c.height*c.top))}Q.prototype.Qa=function(){this.lj||(this.lj=!0,this.Fb(!0))};function cj(a){a.lc||ih(a);a.Ta()}Q.prototype.redraw=function(){this.Wb||this.lc||(this.N(),Ri(this),this.gd())};t=Q.prototype;t.mA=function(){return this.kg};
t.uz=function(a){void 0===a&&(a=null);var b=this.animationManager,c=b.isEnabled;b.sc();b.isEnabled=!1;uf(this);this.Uf=!1;this.lu=new K(NaN,NaN);b.isEnabled=c;this.lc=!0;var d=this;null!==a&&ua(function(){d.lc=!1;hh(b,"Model");a(d)},1)};t.Fb=function(a){void 0===a&&(a=!1);if(!0!==this.kg&&!(this.Wb||!1===a&&this.lc)){this.kg=!0;var b=this;x.requestAnimationFrame(function(){b.kg&&b.gd()})}};t.gd=function(){if(!this.An||this.kg)this.An&&(this.An=!1),uf(this)};
function Si(a,b,c){a.animationManager.defaultAnimation.isAnimating||a.Wb||!a.mj||Ki(a)||(b&&ih(a),c&&Oi(a,!1))}
function uf(a,b){if(!a.lc&&(a.kg=!1,null!==a.Ga||a.Gp.u())){a.lc=!0;var c=a.animationManager,d=a.Oo;if(!c.isAnimating&&0!==d.length){for(var e=d.l,f=e.length,g=0;g<f;g++){var h=e[g];dj(h,!1);h.s()}d.clear()}d=a.Sw;0<d.count&&(d.each(function(a){a.ew()}),d.clear());e=d=!1;c.defaultAnimation.isAnimating&&(e=!0,d=a.skipsUndoManager,a.skipsUndoManager=!0);c.sb||Ah(a);Si(a,!1,!0);null!==a.Vb&&(a.Vb.visible&&!a.gr&&(ej(a),a.gr=!0),!a.Vb.visible&&a.gr&&(a.gr=!1));ih(a);f=!1;if(!a.Uf||a.Oh)a.Uf?fj(a,!a.Rk):
(a.xa("Initial Layout"),!1===c.isEnabled&&c.sc(),fj(a,!1)),f=!0;a.Rk=!1;ih(a);a.qu||cj(a);Si(a,!0,!1);g=!1;f?(c=N.alloc(),c.assign(a.viewportBounds),a.Uf||(g=a.Uf=!0,a.skipsUndoManager||(a.undoManager.isPendingClear=!0),a.undoManager.isPendingUnmodified=!0,gj(a)),a.S("LayoutCompleted"),c.A(a.viewportBounds)||Si(a,!0,!1),N.free(c)):c.Yk&&c.sx&&(a.Rg!==nh?a.scale=Pi(a,a.Rg):a.Ph!==nh?a.scale=Pi(a,a.Ph):(c=a.initialScale,isFinite(c)&&0<c&&(a.scale=c)),Oi(a,!0));ih(a);f&&g&&a.Xa("Initial Layout");a.Ju();
b||a.pc(a.zb);e&&(a.skipsUndoManager=d);a.lc=!1}}function gj(a){var b=a.sa;if(a.Rg!==nh)a.scale=Pi(a,a.Rg);else if(a.Ph!==nh)a.scale=Pi(a,a.Ph);else{var c=a.initialScale;isFinite(c)&&0<c&&(a.scale=c)}a.sa!==b&&(Ri(a),Si(a,!0,!1));Oi(a,!0);b=a.Oa.l;a.Md(b,b.length,a,a.viewportBounds);a.S("InitialLayoutCompleted");a.lu.assign(a.ja);ej(a)}
function ih(a){if(0!==a.se.count&&(a.lc||!a.animationManager.isTicking)){for(var b=0;23>b;b++){var c=a.se.iterator;if(null===c||0===a.se.count)break;a.se=new G;a.ew(c,a.se)}a.nodes.each(function(a){a instanceof U&&0!==(a.R&65536)!==!1&&(a.R=a.R^65536)})}}
t.ew=function(a,b){for(a.reset();a.next();){var c=a.value;!c.Nc()||c instanceof U||(c.Ri()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))}for(a.reset();a.next();)c=a.value,c instanceof U&&c.isVisible()&&hj(this,c);for(a.reset();a.next();)c=a.value,c instanceof T&&c.isVisible()&&(c.Ri()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c));for(a.reset();a.next();)c=a.value,c instanceof ze&&c.isVisible()&&(c.Ri()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))};
function hj(a,b){for(var c=Ea(),d=Ea(),e=b.memberParts;e.next();){var f=e.value;f.isVisible()&&(f instanceof U?(ij(f)||jj(f)||kj(f))&&hj(a,f):f instanceof T?f.fromNode===b||f.toNode===b?d.push(f):c.push(f):(f.measure(Infinity,Infinity),f.arrange()))}a=c.length;for(e=0;e<a;e++)f=c[e],f.measure(Infinity,Infinity),f.arrange();Ia(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();Ia(d)}
t.Md=function(a,b,c,d){if(this.nj||this.animationManager.isAnimating)for(var e=0;e<b;e++)a[e].Md(c,d)};
t.pc=function(a,b){void 0===b&&(b=null);if(null!==this.Ga){null===this.Ca&&B("No canvas specified");var c=this.animationManager;if(!c.sb&&(!c.isAnimating||c.isTicking)){var d=new Date;lj(this);if("0"!==this.Ga.style.opacity){var e=a!==this.zb,f=this.Oa.l,g=f.length,h=this;this.Md(f,g,h,h.viewportBounds);if(e)a.Ic(!0),Mi(this);else if(!this.Wc&&null===b&&!c.isAnimating)return;g=this.ja;var k=this.sa,l=Math.round(g.x*k)/k,m=Math.round(g.y*k)/k;c=this.ub;c.reset();1!==k&&c.scale(k);0===g.x&&0===g.y||
c.translate(-l,-m);k=this.ec;a.setTransform(k,0,0,k,0,0);a.clearRect(0,0,this.ua,this.ta);1!==this.mb&&(a.globalAlpha=this.mb);mj(this,a);l=null!==b?function(c){var d=b;if(c.visible&&0!==c.mb){var e=c.Ha.l,f=e.length;if(0!==f){var g=ci(c,a),k=c.Jo;k.length=0;for(var l=h.scale,m=N.alloc(),n=0;n<f;n++){var A=e[n];d.contains(A)||c.Di(a,A,h,k,l,m,!0)}N.free(m);a.globalAlpha=g}}}:function(b){b.pc(a,h)};g=f.length;for(m=0;m<g;m++)a.setTransform(k,0,0,k,0,0),a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy),
l(f[m]);f=!1;this.Zh?nj(this.Zh,this)&&(f=this.Wq()):f=!0;f&&(od.prototype.Hd=od.prototype.Cx);e?(this.zb.Ic(!0),Mi(this)):this.Wc=this.nj=!1;f=+new Date-+d;e=Za&&Za.Ox;d=this.Zw;if(e||null===this.si){d[this.Ar]=f;this.Ar=(this.Ar+1)%d.length;for(c=f=0;c<d.length;c++)f+=d[c];this.zr=f/d.length}1!==this.mb&&(a.globalAlpha=1);if(e)for(a.setTransform(1,0,0,1,0,0),e=0;e<d.length;e++)a.fillText(d[e].toString(),20,150+ +(20*e))}}}};
function oj(a,b,c,d,e,f,g,h,k,l){if(null!==a.Ga){null===a.Ca&&B("No canvas specified");void 0===g&&(g=null);void 0===h&&(h=null);void 0===k&&(k=!1);void 0===l&&(l=!1);lj(a);a.zb.Ic(!0);Mi(a);a.pj=!0;var m=a.sa;a.sa=e;var n=a.Oa.l,p=n.length;try{var r=new N(f.x,f.y,d.width/e,d.height/e),q=r.copy();q.Mp(c);ej(a,q);ih(a);a.Md(n,p,a,r);b.setTransform(1,0,0,1,0,0);b.clearRect(0,0,d.width,d.height);null!==h&&""!==h&&(b.fillStyle=h,b.fillRect(0,0,d.width,d.height));var u=a.ec;b.scale(u,u);var w=od.alloc();
w.reset();w.translate(c.left,c.top);w.scale(e);0===f.x&&0===f.y||w.translate(-f.x,-f.y);b.setTransform(w.m11,w.m12,w.m21,w.m22,w.dx,w.dy);od.free(w);mj(a,b);b.globalAlpha=a.mb;var v=a.Zj("Grid");if(g){var y=new G,z=g.iterator;for(z.reset();z.next();){var A=z.value;A instanceof V&&(l||A.layer!==v)&&y.add(A)}for(l=0;l<p;l++){var C=n[l];v=b;var F=a;if(C.visible&&0!==C.mb&&(k||!C.isTemporary)){var R=C.Ha.l,J=R.length;if(0!==J){var S=ci(C,v),L=C.Jo;L.length=0;var I=F.scale,ja=N.alloc();for(c=0;c<J;c++){var ca=
R[c];y.contains(ca)&&C.Di(v,ca,F,L,I,ja,!1)}N.free(ja);v.globalAlpha=S}}}}else for(y=0;y<p;y++)F=n[y],F===v?l&&F.pc(b,a,!0):F.pc(b,a,k);a.pj=!1;a.Zh&&nj(a.Zh,a)&&a.Wq()}finally{a.sa=m,a.zb.Ic(!0),Mi(a),a.Md(n,p,a,a.viewportBounds),ej(a)}}}t.Ie=function(a){return this.dg[a]};t.Ay=function(a,b){"minDrawingLength"===a&&(this.wr=b);this.dg[a]=b;this.redraw()};
t.wy=function(){this.dg=new Ya;this.dg.drawShadows=!0;this.dg.textGreeking=!0;this.dg.viewportOptimizations=Ua||Ra?!1:!0;this.dg.temporaryPixelRatio=!0;this.dg.pictureRatioOptimization=!0;this.wr=this.dg.minDrawingLength=1};function mj(a,b){a=a.dg;null!==a&&(void 0!==a.imageSmoothingEnabled&&b.zy(!!a.imageSmoothingEnabled),a=a.defaultFont,void 0!==a&&null!==a&&(b.font=a))}t.cm=function(a){return this.bl[a]};t.OA=function(a,b){this.bl[a]=b};
t.vy=function(){this.bl=new Ya;this.bl.extraTouchArea=10;this.bl.extraTouchThreshold=10;this.bl.hasGestureZoom=!0};t.set=function(a){Object.assign(this,a);return this};t.Fu=function(a){return this.zm(a)};t.zm=function(a){pj(this,a);return this};
function pj(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.Ya(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]&&!La(f,g))if(d&&"ModelChanged"===g){a.zx(b[g]);continue}else if(d&&"Changed"===g){a.yh(b[g]);continue}else if(d&&
La(a.toolManager,g))f=a.toolManager;else if(d&&qj(a,g)){a.Nj(g,b[g]);continue}else if(a instanceof Z&&"Changed"===g){a.yh(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.wx(g)}}t.Ju=function(){if(0===this.undoManager.transactionLevel&&0!==this.Xh.count){for(;0<this.Xh.count;){var a=this.Xh;this.Xh=new H;for(a=a.iterator;a.next();){var b=a.key;b.fq(a.value);b.fc(!1)}}this.N()}};
t.N=function(a){void 0===a&&(a=null);if(null===a)this.Wc=!0,this.Fb();else{var b=this.viewportBounds;null!==a&&a.u()&&b.Mc(a)&&(this.Wc=!0,this.Fb())}this.S("InvalidateDraw")};
Q.prototype.invalidateViewport=function(a,b){if(!0!==this.Wc){this.Wc=!0;var c=!0===this.Ie("temporaryPixelRatio");if(!0===this.Ie("viewportOptimizations")&&this.scrollMode!==Qh&&this.Hj.Fi(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.$r&&0<d.width&&0<d.height){if(!(this.lc||(this.kg=!1,null===this.Ga||(this.lc=
!0,this.Ju(),this.documentBounds.u()||(e=N.alloc(),rj(this,this.computeBounds(e)),N.free(e)),e=this.Ca,null===e||e instanceof sj)))){var g=this.ec;f=this.ua*g;var h=this.ta*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.It;a=this.Mw;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.La,n,p,r,q,0,0,r,
q);nj(this.Zh,this)&&a.clearRect(0,0,k,m);e=Ea();a=Ea();q=Math.abs(l);r=Math.abs(b);var u=0===n?0:f-q;n=K.allocAt(u,0);q=K.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 w=this.ub;w.reset();w.scale(g,g);1!==this.sa&&w.scale(this.sa);g=this.ja;(0!==g.x||0!==g.y)&&isFinite(g.x)&&isFinite(g.y)&&w.translate(-g.x,-g.y);ub(n,w);ub(q,w);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)));ub(n,w);ub(q,w);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)));nj(this.Zh,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))),ub(n,w),ub(q,w),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))));K.free(n);K.free(q);Si(this,!1,!0);null===this.Ga&&
B("No div specified");null===this.Ca&&B("No canvas specified");if(!this.animationManager.sb&&(f=this.zb,this.Wc)){lj(this);h=this.ec;f.setTransform(1,0,0,1,0,0);f.clearRect(0,0,this.ua*h,this.ta*h);f.drawImage(this.It.La,0<l?0:Math.round(-l),0<b?0:Math.round(-b));l=this.ja;g=this.sa;k=Math.round(l.x*g)/g;m=Math.round(l.y*g)/g;b=this.ub;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.Oa.l;l=b.length;this.Md(b,l,this,this.viewportBounds);mj(this,f);f.globalAlpha=this.mb;for(h=0;h<l;h++)if(g=b[h],k=e,g.visible&&0!==g.mb){m=ci(g,f);p=g.Jo;p.length=0;n=this.scale;r=N.alloc();q=g.Ha.l;w=q.length;u=k.length;for(var v=0;v<w;v++){var y=q[v],z=tj(y,y.actualBounds);a:{for(var A=2/n,C=4/n,F=0;F<u;F++){var R=k[F];if(0!==R.width&&0!==
R.height&&z.jv(R.x-A,R.y-A,R.width+C,R.height+C)){z=!0;break a}}z=!1}z&&g.Di(f,y,this,p,n,r,!0)}N.free(r);f.globalAlpha=m}f.restore();f.Ic(!0);this.Zh&&nj(this.Zh,this)&&this.Wq();this.Wc=this.nj=!1;this.oq()}Ia(e);Ia(a);this.lc=!1}}else this.gd();N.free(d);c&&(Pe(this),this.gd(),bf(this,!0))}else c?(Pe(this),this.gd(),bf(this,!0)):this.gd()}};function Ri(a){!1===a.mj&&(a.mj=!0)}function Mi(a){!1===a.nj&&(a.nj=!0)}function lj(a){!1!==a.Qn&&(a.Qn=!1,uj(a,a.ua,a.ta))}
function uj(a,b,c){Ei(a);var d=a.ec;a.Ca.resize(b*d,c*d,b,c)&&(a.Wc=!0,a.zb.Ic(!0))}
function Ki(a){var b=a.Ca;if(null===b||a.Gp.u())return!0;var c=a.Ga,d=a.ua,e=a.ta,f=a.viewportBounds;if(!a.viewportBounds.u())return!0;var g=f.x,h=f.y,k=f.width,l=f.height,m=!1,n=a.Sf?a.tb:0,p=a.Ye?a.tb:0,r=c.clientWidth||d+n,q=c.clientHeight||e+p;if(r!==d+n||q!==e+p)a.Sf=!1,a.Ye=!1,p=n=0,a.ua=r,a.ta=q,m=a.Qn=!0,Ei(a);if(!(m||a.Sf||a.Ye||a.Nn||a.On))return!0;a.mj=!1;var u=a.documentBounds,w=0,v=0,y=0,z=0;c=f.width;var A=f.height,C=a.Hj;a.contentAlignment.hb()?(u.width>c&&(w=C.left,v=C.right),u.height>
A&&(y=C.top,z=C.bottom)):(w=C.left,v=C.right,y=C.top,z=C.bottom);C=u.width+w+v;var F=u.height+y+z;w=u.x-w;var R=f.x;v=u.right+v;var J=f.right+n;y=u.y-y;var S=f.y;u=u.bottom+z;z=f.bottom+p;var L="1px",I="1px";f=a.scale;r=C>r/f;q=F>q/f;a.scrollMode===Oh&&(r||q)&&(r&&a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(r=1,w+1<R&&(r=Math.max((R-w)*f+a.ua,r)),v>J+1&&(r=Math.max((v-J)*f+a.ua,r)),c+n+1<C&&(r=Math.max((C-c)*f+a.ua,r)),L=r.toString()+"px"),q&&a.hasVerticalScrollbar&&a.allowVerticalScroll&&
(r=1,y+1<S&&(r=Math.max((S-y)*f+a.ta,r)),u>z+1&&(r=Math.max((u-z)*f+a.ta,r)),A+p+1<F&&(r=Math.max((F-A)*f+a.ta,r)),I=r.toString()+"px"));r="1px"!==L;q="1px"!==I;r&&q||!r&&!q||(q&&(J-=a.tb),r&&(z-=a.tb),C<c+n||!a.hasHorizontalScrollbar||!a.allowHorizontalScroll||(n=1,w+1<R&&(n=Math.max((R-w)*f+a.ua,n)),v>J+1&&(n=Math.max((v-J)*f+a.ua,n)),c+1<C&&(n=Math.max((C-c)*f+a.ua,n)),L=n.toString()+"px"),r="1px"!==L,n=a.ta,r!==a.Ye&&(n=r?a.ta-a.tb:a.ta+a.tb),F<A+p||!a.hasVerticalScrollbar||!a.allowVerticalScroll||
(p=1,y+1<S&&(p=Math.max((S-y)*f+n,p)),u>z+1&&(p=Math.max((u-z)*f+n,p)),A+1<F&&(p=Math.max((F-A)*f+n,p)),I=p.toString()+"px"),q="1px"!==I);if(a.Nr&&r===a.Ye&&q===a.Sf)return d===a.ua&&e===a.ta||a.gd(),!1;r!==a.Ye&&("1px"===L?a.ta=a.ta+a.tb:a.ta=Math.max(a.ta-a.tb,1),m=!0);a.Ye=r;a.gp.style.width=L;q!==a.Sf&&("1px"===I?a.ua=a.ua+a.tb:a.ua=Math.max(a.ua-a.tb,1),m=!0,a.Vn&&(p=K.alloc(),q?(b.style.left=a.tb+"px",a.position=p.h(a.ja.x+a.tb/a.scale,a.ja.y)):(b.style.left="0px",a.position=p.h(a.ja.x-a.tb/
a.scale,a.ja.y)),K.free(p)));m&&Ei(a);a.Sf=q;a.gp.style.height=I;a.nu=!0;m&&(a.Qn=!0);b=a.Or;p=b.scrollLeft;a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(c+1<C?p=(a.position.x-w)*f:w+1<R?p=b.scrollWidth-b.clientWidth:v>J+1&&(p=a.position.x*f));if(a.Vn)switch(a.ju){case "negative":p=-(b.scrollWidth-p-b.clientWidth);break;case "reverse":p=b.scrollWidth-p-b.clientWidth}b.scrollLeft=p;a.hasVerticalScrollbar&&a.allowVerticalScroll&&(A+1<F?b.scrollTop=(a.position.y-y)*f:y+1<S?b.scrollTop=b.scrollHeight-
b.clientHeight:u>z+1&&(b.scrollTop=a.position.y*f));r=a.ua;q=a.ta;b.style.width=r+(a.Sf?a.tb:0)+"px";b.style.height=q+(a.Ye?a.tb:0)+"px";return d!==r||e!==q||a.animationManager.sb?(d=N.allocAt(g,h,k,l),a.onViewportBoundsChanged(d,a.viewportBounds,f,m),N.free(d),!1):!0}t=Q.prototype;
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.Zj(a.layerName),null===b&&(b=this.Zj("")),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.Ni(99999999,a,a.diagram===this);0<=c&&this.Wa(pe,"parts",b,null,a,null,c);b.isTemporary||this.Qa();a.B(1);c=a.layerChanged;null!==c&&c(a,null,b)}};
t.Ni=function(a){this.partManager.Ni(a);var b=this;vj(a,function(a){wj(b,a)});(a instanceof ze||a instanceof U&&null!==a.placeholder)&&a.s();null!==a.data&&vj(a,function(a){xj(b.partManager,a)});!0!==jj(a)&&!0!==kj(a)||this.se.add(a);yj(a,!0,this);zj(a)?(a.actualBounds.u()&&this.N(tj(a,a.actualBounds)),this.Qa()):a.isVisible()&&a.actualBounds.u()&&this.N(tj(a,a.actualBounds));this.Fb()};
t.rc=function(a){a.Qj();this.partManager.rc(a);var b=this;null!==a.data&&vj(a,function(a){Aj(b.partManager,a,b)});this.se.remove(a);zj(a)?(a.actualBounds.u()&&this.N(tj(a,a.actualBounds)),this.Qa()):a.isVisible()&&a.actualBounds.u()&&this.N(tj(a,a.actualBounds));this.Fb()};t.remove=function(a){Bj(this,a,!0)};
function Bj(a,b,c){var d=b.layer;null!==d&&d.diagram===a&&(b.isSelected=!1,b.isHighlighted=!1,b.B(2),c&&b.Wj(),c=d.rc(-1,b,!1),0<=c&&a.Wa(qe,"parts",d,b,null,c,null),a=b.layerChanged,null!==a&&a(b,d,null))}t.Rs=function(a,b){void 0===b&&(b=!1);if(Aa(a))for(var c=a.length,d=0;d<c;d++){var e=a[d];b&&!e.canDelete()||this.remove(e)}else for(c=new G,c.addAll(a),a=c.iterator;a.next();)c=a.value,b&&!c.canDelete()||this.remove(c)};t.Vj=function(a,b,c){void 0===c&&(c=!1);return this.partManager.Vj(a,b,c)};
Q.prototype.moveParts=function(a,b,c,d){void 0===c&&(c=!1);void 0===d&&(d=Cj(this));if(null!==this.toolManager){var e=new H;if(null!==a)if(Aa(a))for(var f=0;f<a.length;f++)Dj(this,e,a[f],c,d);else for(a=a.iterator;a.next();)Dj(this,e,a.value,c,d);else{for(a=this.parts;a.next();)Dj(this,e,a.value,c,d);for(a=this.nodes;a.next();)Dj(this,e,a.value,c,d);for(a=this.links;a.next();)Dj(this,e,a.value,c,d)}jf(this,e,b,d,c)}};
function Dj(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=Cj(a)),c instanceof W){b.add(c,a.Ad(e,c,c.location));if(c instanceof U&&(null!==c.placeholder||e.dragsMembers))for(f=c.memberParts;f.next();)Dj(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)&&Dj(a,b,g,d,e)}}if(e.dragsTree)for(c=c.$u();c.next();)Dj(a,b,c.value,
d,e)}else if(c instanceof T)for(b.add(c,a.Ad(e,c)),c=c.labelNodes;c.next();)Dj(a,b,c.value,d,e);else c instanceof ze||b.add(c,a.Ad(e,c,c.location))}
function jf(a,b,c,d,e){if(null!==b&&0!==b.count){var f=K.alloc(),g=K.alloc();g.assign(c);isNaN(g.x)&&(g.x=0);isNaN(g.y)&&(g.y=0);(c=a.Zr)||Qe(a,b);for(var h=Ea(),k=Ea(),l=b.iterator,m=K.alloc();l.next();){var n=l.key,p=l.value;if(n.Nc()){var r=Ej(a,n,b);if(null!==r)h.push(new Fj(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 K),p.shifted.assign(m.he(r))}else l.key instanceof T&&k.push(l.ka)}K.free(m);e=h.length;for(l=
0;l<e;l++)n=h[l],f.assign(n.info.point),void 0===n.ev.shifted&&(n.ev.shifted=new K),n.node.location=f.add(n.ev.shifted);e=K.alloc();l=K.alloc();n=k.length;for(p=0;p<n;p++){var q=k[p];r=q.key;if(r instanceof T)if(r.suspendsRouting){r.gf=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.Ad(d,r,g)),gf(r,g.x-u.x,g.y-u.y);else{q=K.allocAt(0,0);(m=r.i(0))&&m.u()&&q.assign(m);var w=m=K.alloc().assign(q).add(g);d.isGridSnapEnabled&&
(d.isGridSnapRealtime||a.lastInput.up)&&(w=K.alloc(),wg(a,r,m,w,d));m.assign(r.dragComputation(r,m,w)).he(q);b.add(r,a.Ad(d,r,m));gf(r,m.x-u.x,m.y-u.y);K.free(q);K.free(m);w!==m&&K.free(w)}else null!==m&&(e.assign(m.location),w=b.H(m),null!==w&&e.he(w.point)),null!==u&&(l.assign(u.location),w=b.H(u),null!==w&&l.he(w.point)),null!==m&&null!==u?e.Ua(l)?(m=q.value.point,u=f,u.assign(e),u.he(m),b.add(r,a.Ad(d,r,e)),gf(r,u.x,u.y)):(r.suspendsRouting=!1,r.Va()):(q=q.value.point,m=null!==m?e:null!==u?l:
g,b.add(r,a.Ad(d,r,m)),gf(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.Ad(d,r,g)),gf(r,g.x-m.x,g.y-m.y)}K.free(f);K.free(g);K.free(e);K.free(l);Ia(h);Ia(k);c||(ih(a),Ve(a,b))}}
Q.prototype.computeMove=function(a,b,c,d){void 0===d&&(d=new K);d.assign(b);if(null===a)return d;var e=b,f=c.isGridSnapEnabled;f&&(c.isGridSnapRealtime||this.lastInput.up)&&(e=K.alloc(),wg(this,a,b,e,c));c=null!==a.dragComputation?a.dragComputation(a,b,e):e;var g=a.minLocation,h=g.x;isNaN(h)&&(h=f?Math.round(1E3*a.location.x)/1E3:a.location.x);g=g.y;isNaN(g)&&(g=f?Math.round(1E3*a.location.y)/1E3:a.location.y);var k=a.maxLocation,l=k.x;isNaN(l)&&(l=f?Math.round(1E3*a.location.x)/1E3:a.location.x);
k=k.y;isNaN(k)&&(k=f?Math.round(1E3*a.location.y)/1E3:a.location.y);d.h(Math.max(h,Math.min(c.x,l)),Math.max(g,Math.min(c.y,k)));e!==b&&K.free(e);return d};function Cj(a){var b=a.toolManager.findTool("Dragging");return null!==b?b.dragOptions:a.pn}
function wg(a,b,c,d,e){void 0===e&&(e=Cj(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=K.allocAt(0,0);f.Ui(0,0,a,b,e);M.Xp(c.x,c.y,h+f.x,g+f.y,a,b,d);K.free(f)}}function Qe(a,b){if(null!==b)for(a.Zr=!0,a=b.iterator;a.next();)b=a.key,b instanceof T&&(b.suspendsRouting=!0)}
function Ve(a,b){if(null!==b){for(b=b.iterator;b.next();){var c=b.key;c instanceof T&&(c.suspendsRouting=!1,Gj(c)&&c.Va())}a.Zr=!1}}function Ej(a,b,c){b=b.containingGroup;if(null!==b){a=Ej(a,b,c);if(null!==a)return a;a=c.H(b);if(null!==a)return a}return null}t=Q.prototype;t.Ad=function(a,b,c){if(void 0===c)return new Te(zb);var d=a.isGridSnapEnabled;a.groupsSnapMembers||null===b.containingGroup||(d=!1);return d?new Te(new K(Math.round(1E3*c.x)/1E3,Math.round(1E3*c.y)/1E3)):new Te(c.copy())};
function Hj(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.Oa;c=a.count;for(var d=0;d<c;d++)a.J(d).name===b&&B("Cannot add Layer with the name '"+b+"'; a Layer with the same name is already present in this Diagram.")}}
t.Ul=function(a){Hj(this,a,null);a.Ne(this);var b=this.Oa,c=b.count-1;if(!a.isTemporary)for(;0<=c&&b.J(c).isTemporary;)c--;b.vb(c+1,a);null!==this.dc&&this.Wa(pe,"layers",this,null,a,null,c+1);this.N();this.Qa();return this};
t.xx=function(a,b){Hj(this,a,b);a.Ne(this);var c=this.Oa,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.dc&&this.Wa(qe,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.J(f)===b){c.vb(f,a);break}null!==this.dc&&this.Wa(pe,"layers",this,null,a,null,f);this.N();0>d&&this.Qa();return this};
t.Zy=function(a,b){Hj(this,a,b);a.Ne(this);var c=this.Oa,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.dc&&this.Wa(qe,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.J(f)===b){c.vb(f+1,a);break}null!==this.dc&&this.Wa(pe,"layers",this,null,a,null,f+1);this.N();0>d&&this.Qa();return this};
t.GA=function(a){a.diagram!==this&&B("Cannot remove a Layer from another Diagram: "+a+" of "+a.diagram);if(""!==a.name){var b=this.Oa,c=b.indexOf(a);if(b.remove(a)){for(b=a.Ha.copy().iterator;b.next();){var d=b.value,e=d.layerName;e!==a.name?d.layerName=e:d.layerName=""}null!==this.dc&&this.Wa(qe,"layers",this,a,null,c,null);this.N();this.Qa()}}};t.Zj=function(a){for(var b=this.layers;b.next();){var c=b.value;if(c.name===a)return c}return null};
t.zx=function(a){null===this.df&&(this.df=new E);this.df.add(a);this.model.yh(a);return this};t.IA=function(a){null!==this.df&&(this.df.remove(a),0===this.df.count&&(this.df=null));this.model.rk(a)};t.yh=function(a){null===this.Ag&&(this.Ag=new E);this.Ag.add(a);return this};t.rk=function(a){null!==this.Ag&&(this.Ag.remove(a),0===this.Ag.count&&(this.Ag=null))};
t.ks=function(a){this.skipsUndoManager||this.model.skipsUndoManager||this.model.undoManager.gv(a);a.change!==oe&&(this.isModified=!0);if(null!==this.Ag)for(var b=this.Ag,c=b.length,d=0;d<c;d++)b.J(d)(a)};t.Wa=function(a,b,c,d,e,f,g){void 0===f&&(f=null);void 0===g&&(g=null);var h=new fe;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.ks(h)};t.g=function(a,b,c,d,e){this.Wa(ge,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===ge){var e=a.object;Ij(e,a.propertyName,a.H(b));if(e instanceof Y){var f=e.part;null!==f&&f.Lb()}this.isModified=!0}else if(d===pe){var g=a.object,h=a.newParam,k=a.newValue;if(g instanceof X)if("number"===typeof h&&k instanceof Y){b?g.rc(h):g.vb(h,k);var l=g.part;null!==l&&l.Lb()}else"number"===typeof h&&k instanceof Jj&&(k.isRow?Kj(g,h,
b?void 0:k):Lj(g,h,b?void 0:k));else if(g instanceof ai){var m=!0===a.oldParam;"number"===typeof h&&k instanceof V&&(b?(k.isSelected=!1,k.isHighlighted=!1,k.Lb(),g.rc(m?h:-1,k,m)):g.Ni(h,k,m))}else g instanceof Q?"number"===typeof h&&k instanceof ai&&(b?this.Oa.eb(h):(k.Ne(this),this.Oa.vb(h,k))):B("unknown ChangedEvent.Insert object: "+a.toString());this.isModified=!0}else if(d===qe){var n=a.object,p=a.oldParam,r=a.oldValue;if(n instanceof X)"number"===typeof p&&r instanceof Y?b?n.vb(p,r):n.rc(p):
"number"===typeof p&&r instanceof Jj&&(r.isRow?Kj(n,p,b?r:void 0):Lj(n,p,b?r:void 0));else if(n instanceof ai){var q=!0===a.newParam;"number"===typeof p&&r instanceof V&&(b?0>n.Ha.indexOf(r)&&n.Ni(p,r,q):(r.isSelected=!1,r.isHighlighted=!1,r.Lb(),n.rc(q?p:-1,r,q)))}else n instanceof Q?"number"===typeof p&&r instanceof ai&&(b?(r.Ne(this),this.Oa.vb(p,r)):this.Oa.eb(p)):B("unknown ChangedEvent.Remove object: "+a.toString());this.isModified=!0}else d!==oe&&B("unknown ChangedEvent: "+a.toString())}finally{this.skipsModelSourceBindings=
c}}};Q.prototype.xa=function(a){return this.undoManager.xa(a)};Q.prototype.Xa=function(a){return this.undoManager.Xa(a)};Q.prototype.Hf=function(){return this.undoManager.Hf()};Q.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.xa(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.Xa(b):this.undoManager.Hf(),this.skipsUndoManager=c}};Q.prototype.updateAllTargetBindings=function(a){this.partManager.updateAllTargetBindings(a)};
Q.prototype.zq=function(){this.partManager.zq()};
function Mj(a,b,c){var d=a.animationManager;if(a.Wb||a.lc)a.sa=c,Ei(a),d.sb&&d.Td.add(d.D,"scale",b,a.sa);else if(null===a.Ca)a.sa=c,Ei(a);else{a.Wb=!0;var e=a.viewportBounds.copy(),f=a.ua,g=a.ta;e.width=a.ua/b;e.height=a.ta/b;var h=a.zoomPoint.x,k=a.zoomPoint.y,l=a.contentAlignment;isNaN(h)&&(l.Oc()?l.Df(Fc)?h=0:l.Df(Gc)&&(h=f-1):h=l.hb()?l.x*(f-1):f/2);isNaN(k)&&(l.Oc()?l.Df(Ec)?k=0:l.Df(Hc)&&(k=g-1):k=l.hb()?l.y*(g-1):g/2);null===a.scaleComputation||a.animationManager.defaultAnimation.isAnimating||
(c=a.scaleComputation(a,c));c<a.minScale&&(c=a.minScale);c>a.maxScale&&(c=a.maxScale);f=K.allocAt(a.ja.x+h/b-h/c,a.ja.y+k/b-k/c);a.position=f;K.free(f);a.sa=c;Ei(a);a.onViewportBoundsChanged(e,a.viewportBounds,b,!1);a.Wb=!1;Oi(a,!1);d.sb&&d.Td.add(d.D,"scale",b,a.sa);a.N();Ri(a)}}
Q.prototype.onViewportBoundsChanged=function(a,b,c,d){if(!a.A(b)){void 0===d&&(d=!1);d||Ri(this);Mi(this);var e=this.layout;null===e||!e.isViewportSized||this.autoScale!==nh||d||a.width===b.width&&a.height===b.height||e.B();e=this.currentTool;!0===this.el&&e instanceof Pa&&(this.lastInput.documentPoint=this.Zs(this.lastInput.viewPoint),De(e,this));this.Wb||this.invalidateViewport(a,b);ej(this);this.dd.scale=c;this.dd.position.x=a.x;this.dd.position.y=a.y;this.dd.bounds.assign(a);this.dd.Ex.width=
Math.round(a.width*c);this.dd.Ex.height=Math.round(a.height*c);this.dd.ny.width=this.ua;this.dd.ny.height=this.ta;this.dd.iy=d;this.S("ViewportBoundsChanged",this.dd,a);this.isVirtualized&&this.links.each(function(a){a.isAvoiding&&a.actualBounds.Mc(b)&&a.Va()})}};
function ej(a,b){void 0===b&&(b=null);var c=a.Vb;if(null!==c&&c.visible){for(var d=Gb.alloc(),e=1,f=1,g=c.U.l,h=g.length,k=0;k<h;k++){var l=g[k],m=Math.abs(l.interval);2>m||(Nj(l.figure)?f=f*m/M.Ux(f,m):e=e*m/M.Ux(e,m))}g=c.gridCellSize;d.h(f*g.width,e*g.height);if(null!==b)e=b.width,f=b.height,a=b.x,g=b.y;else{b=N.alloc();a=a.viewportBounds;b.h(a.x,a.y,a.width,a.height);if(!b.u()){N.free(b);return}e=b.width;f=b.height;a=b.x;g=b.y;N.free(b)}c.width=e+2*d.width;c.height=f+2*d.height;b=K.alloc();M.Xp(a,
g,0,0,d.width,d.height,b);b.offset(-d.width,-d.height);Gb.free(d);c.part.location=b;K.free(b)}}Q.prototype.clearSelection=function(a){void 0===a&&(a=!1);var b=this.selection;if(0!==b.count){a||this.S("ChangingSelection",b);for(var c=b.ya(),d=c.length,e=0;e<d;e++)c[e].isSelected=!1;b.ea();b.clear();b.freeze();a||this.S("ChangedSelection",b)}};
Q.prototype.select=function(a){null!==a&&a.layer.diagram===this&&(!a.isSelected||1<this.selection.count)&&(this.S("ChangingSelection",this.selection),this.clearSelection(!0),a.isSelected=!0,this.S("ChangedSelection",this.selection))};
Q.prototype.NA=function(a){this.S("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 V||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 V||B("Diagram.selectCollection given something that is not a Part: "+b),b.isSelected=!0;this.S("ChangedSelection",this.selection)};
Q.prototype.clearHighlighteds=function(){var a=this.highlighteds;if(0<a.count){for(var b=a.ya(),c=b.length,d=0;d<c;d++)b[d].isHighlighted=!1;a.ea();a.clear();a.freeze()}};t=Q.prototype;t.gA=function(a){null!==a&&a.layer.diagram===this&&(!a.isHighlighted||1<this.highlighteds.count)&&(this.clearHighlighteds(),a.isHighlighted=!0)};
t.hA=function(a){a=(new G).addAll(a);for(var b=this.highlighteds.copy().pq(a).iterator;b.next();)b.value.isHighlighted=!1;for(a=a.iterator;a.next();)b=a.value,b instanceof V||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=K.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));K.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.Nv=function(a){var b=this.viewportBounds;b.Ge(a)||(a=a.center,a.x-=b.width/2,a.y-=b.height/2,this.position=a)};t.ls=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.ub;b.reset();1!==this.sa&&b.scale(this.sa);var c=this.ja;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return a.copy().transform(this.ub)};
t.WA=function(a){var b=this.ub,c=a.x,d=a.y,e=c+a.width,f=d+a.height,g=b.m11,h=b.m12,k=b.m21,l=b.m22,m=b.dx,n=b.dy,p=c*g+d*k+m;b=c*h+d*l+n;var 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.Zs=function(a){var b=this.ub;b.reset();1!==this.sa&&b.scale(this.sa);var c=this.ja;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return ub(a.copy(),this.ub)};function Oj(a){var b=a.isModified;a.ux!==b&&(a.ux=b,a.S("Modified"))}function Pj(a){a=ii.get(a);return null!==a?new a:new ji}
Q.prototype.doModelChanged=function(a){var b=this;if(a.model===this.model){var c=a.change,d=a.propertyName;if(c===oe&&"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.lc||this.Uf||(this.Rk=!0,this.An&&(this.kg=!0))}else"StartingUndo"===d||"StartingRedo"===d?(a=this.animationManager,a.defaultAnimation.isAnimating&&!this.skipsUndoManager&&
a.sc(),this.S("ChangingSelection",this.selection)):"StartedTransaction"===d&&(a=this.animationManager,a.defaultAnimation.isAnimating&&!this.skipsUndoManager&&a.sc());else if(this.Z){this.Z=!1;try{if(""===a.modelChange&&c===oe){if("FinishedUndo"===d||"FinishedRedo"===d)this.S("ChangedSelection",this.selection),ih(this);var f=this.animationManager;"RolledBackTransaction"===d&&f.sc();this.Rk=!0;this.gd();0!==this.undoManager.transactionLevel&&1!==this.undoManager.transactionLevel||jh(f);"CommittedTransaction"===
d&&this.undoManager.isJustDiscarded&&(this.re=Math.min(this.re,this.undoManager.historyIndex-1));"CommittedTransaction"!==d&&"RolledBackTransaction"!==d||!this.undoManager.isPendingUnmodified||setTimeout(function(){b.isModified=!1},1);var g=a.isTransactionFinished;g&&(Oj(this),this.Hs.clear(),Hh(this.animationManager));if(!this.cu&&g&&this.lastInput.targetDiagram){this.cu=!0;var h=this;ua(function(){h.currentTool.standardMouseOver();h.cu=!1},10)}}}finally{this.Z=!0}}}};
function wj(a,b){b=b.U.l;for(var c=b.length,d=0;d<c;d++)Qj(a,b[d])}function Qj(a,b){if(b instanceof Rj){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){c.Ig instanceof G&&c.Ig.add(a);var d=b.Mg;null!==d&&!0===d.mr&&null!==b.diagram&&b.diagram.Oo.add(b);if(c.Fn)if(c=c.getAttribute("src"),d=a.fh.H(c),null===d)d=[],d.push(b),a.fh.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}}
function Sj(a,b){if(b instanceof Rj){var c=b.element;if(null!==c&&c instanceof HTMLImageElement&&(c.Ig instanceof G&&c.Ig.remove(a),Tj(c),c.Fn)){c=c.getAttribute("src");var d=a.fh.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.fh.remove(c),Di(c));break}}}}Q.prototype.Ld=function(){this.partManager.Ld()};Q.prototype.Mj=function(a,b){this.Qd.Mj(a,b)};Q.prototype.Oj=function(a,b){this.Qd.Oj(a,b)};Q.prototype.findPartForKey=function(a){return this.partManager.findPartForKey(a)};
Q.prototype.Eb=function(a){return this.partManager.Eb(a)};Q.prototype.findLinkForKey=function(a){return this.partManager.findLinkForKey(a)};t=Q.prototype;t.Bc=function(a){return this.partManager.Bc(a)};t.Gi=function(a){return this.partManager.Gi(a)};t.Ac=function(a){return this.partManager.Ac(a)};t.rs=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.rs.apply(this.partManager,b instanceof Array?b:da(ba(b)))};
t.qs=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.qs.apply(this.partManager,b instanceof Array?b:da(ba(b)))};function Ei(a){var b=a.ja,c=a.sa;a.tx.h(b.x,b.y,Math.max(a.ua,0)/c,Math.max(a.ta,0)/c)}function rj(a,b){a.lj=!1;var c=a.Uq;c.A(b)||(c=c.copy(),a.Uq.assign(b),Oi(a,!1),a.S("DocumentBoundsChanged",null,c),Ri(a))}t.Ta=function(){if(this.lj){var a=N.alloc();rj(this,this.computeBounds(a));N.free(a)}};
t.Qz=function(){for(var a=new G,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.Pz=function(){return this.wi.iterator};t.qA=function(a){ih(this);a&&Uj(this,!0);this.lc?fj(this,!1):(this.Rk=!0,uf(this))};function Uj(a,b){for(var c=a.wi.iterator;c.next();)Vj(a,c.value,b);null!==a.layout&&(b?a.layout.isValidLayout=!1:a.layout.B())}
function Vj(a,b,c){if(null!==b){for(var d=b.rl.iterator;d.next();)Vj(a,d.value,c);null!==b.layout&&(c?b.layout.isValidLayout=!1:b.layout.B())}}
function fj(a,b){if(a.Oh&&!a.Et){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.xa("Layout"));1>=d&&!f.defaultAnimation.isAnimating&&!f.sb&&(b||hh(f,"Layout"));a.Oh=!1;for(var g=a.wi.iterator;g.next();)dk(a,g.value,b,d);e.isValidLayout||(!b||e.isRealtime||null===e.isRealtime||0===d?(e.doLayout(a),ih(a),e.isValidLayout=!0):a.Oh=!0)}finally{b=a.undoManager.isInternalTransaction,0===d&&(a.Xa("Layout"),a.undoManager.isInternalTransaction=
!1),!b||0!==d&&1!==d||jh(f),a.Z=c}}}function dk(a,b,c,d){if(null!==b){for(var e=b.rl.iterator;e.next();)dk(a,e.value,c,d);e=b.layout;null===e||e.isValidLayout||(!c||e.isRealtime||0===d?(b.Jh=!b.location.u(),e.doLayout(b),b.B(32),hj(a,b),e.isValidLayout=!0):a.Oh=!0)}}t.Wz=function(){for(var a=new E,b=this.nodes;b.next();){var c=b.value;c.isTopLevel&&null===c.Ii()&&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.Gt=c;a.Ft=d}
function qj(a,b){var c=a.Ft.H(b);return null!==c?c:a.Ft.H(b.toLowerCase())}function hk(a,b){var c=a.Gt.H(b);if(null!==c)return c;c=a.Gt.H(b.toLowerCase());if(null!==c)return c;B("Unknown DiagramEvent name: "+b)}t.Nj=function(a,b){a=hk(this,a);null!==a&&a.add(b);return this};t.mm=function(a,b){a=hk(this,a);null!==a&&a.remove(b)};
t.S=function(a,b,c){var d=hk(this,a),e=new ee;e.diagram=this;a=qj(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.J(0)(e);else if(0!==b)for(d=d.ya(),c=0;c<b;c++)(0,d[c])(e)};function ik(a){if(a.animationManager.isTicking)return!1;var b=a.currentTool;return b===a.toolManager.findTool("Dragging")?!a.Zr||b.isComplexRoutingRealtime:!0}t.fk=function(a,b){void 0===b&&(b=null);return jk(this,!1,null,b).fk(a.x,a.y,a.width,a.height)};
Q.prototype.computeOccupiedArea=function(a){return this.isVirtualized?this.viewportBounds.copy():this.lj?Ni(this,a):a.assign(this.documentBounds)};
function jk(a,b,c,d){null===a.Zc&&(a.Zc=new kk);if(a.Zc.As||a.Zc.group!==c||a.Zc.Cy!==d){null!==c&&(c=lk(a,c));if(null===c){b=N.alloc();a.computeOccupiedArea(b);b.Kc(100,100);a.Zc.initialize(b);for(var e=a.nodes;e.next();){var f=e.value,g=f.layer;null!==g&&g.visible&&!g.isTemporary&&mk(a,f,d,b)}N.free(b)}else{0<c.memberParts.count&&(b=a.computePartsBounds(c.memberParts,!1),b.Kc(20,20),a.Zc.initialize(b));b=N.alloc();for(e=c.memberParts;e.next();)f=e.value,f instanceof W&&mk(a,f,d,b);N.free(b)}a.Zc.group=
c;a.Zc.Cy=d;a.Zc.As=!1}else b&&nk(a.Zc);return a.Zc}function lk(a,b){return b.avoidable&&!b.isLinkLabel?b:null!==b.containingGroup?lk(a,b.containingGroup):null}
function mk(a,b,c,d){if(b!==c&&b.isVisible())if(b.avoidable&&!b.isLinkLabel){b=b.getAvoidableRect(d);a=a.Zc;var e=b.x,f=b.y;if(ok(a,e,f))for(c=(f-a.zd)/a.hc|0,d=Math.min((e+b.width-a.yd)/a.gc|0,a.yi),b=Math.min((f+b.height-a.zd)/a.hc|0,a.zi),e=(e-a.yd)/a.gc|0;e<=d;e++)if(f=a.Tb[e],f.fill)f.fill(pk,c,b+1);else for(var g=c;g<=b;g++)f[g]=pk}else if(b instanceof U)for(b=b.memberParts;b.next();)e=b.value,e instanceof W&&mk(a,e,c,d)}
function qk(a,b){null!==a.Zc&&!a.Zc.As&&(void 0===b&&(b=null),null===b||b.avoidable&&!b.isLinkLabel)&&(a.Zc.As=!0)}Q.prototype.ns=function(a){this.Dq.assign(a);this.computeAutoScrollPosition(this.Dq).Ua(this.position)?this.ug():rk(this)};
function rk(a){-1===a.Ak&&(a.Ak=ua(function(){if(-1!==a.Ak&&(a.ug(),null!==a.lastInput.event)){var b=a.computeAutoScrollPosition(a.Dq);b.Ua(a.position)||(a.position=b,a.lastInput.documentPoint=a.Zs(a.Dq),a.doMouseMove(),a.lj=!0,b=N.alloc(),a.computeBounds(b),b.Rc(a.documentBounds),rj(a,b),N.free(b),a.Wc=!0,a.gd(),rk(a))}},a.Cq))}Q.prototype.ug=function(){-1!==this.Ak&&(x.clearTimeout(this.Ak),this.Ak=-1)};
Q.prototype.computeAutoScrollPosition=function(a){var b=this.position,c=this.Eq;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=K.allocAt(0,0);if(a.x>=d.x&&a.x<d.x+c.left&&this.allowHorizontalScroll){var g=Math.max(this.scrollHorizontalLineChange,1);g|=0;f.x-=g;a.x<d.x+c.left/2&&(f.x-=g);a.x<d.x+c.left/4&&(f.x-=4*g)}else a.x<=d.x+d.width&&a.x>d.x+d.width-c.right&&this.allowHorizontalScroll&&(g=Math.max(this.scrollHorizontalLineChange,
1),g|=0,f.x+=g,a.x>d.x+d.width-c.right/2&&(f.x+=g),a.x>d.x+d.width-c.right/4&&(f.x+=4*g));a.y>=d.y&&a.y<d.y+c.top&&this.allowVerticalScroll?(g=Math.max(this.scrollVerticalLineChange,1),g|=0,f.y-=g,a.y<d.y+c.top/2&&(f.y-=g),a.y<d.y+c.top/4&&(f.y-=4*g)):a.y<=d.y+d.height&&a.y>d.y+d.height-c.bottom&&this.allowVerticalScroll&&(g=Math.max(this.scrollVerticalLineChange,1),g|=0,f.y+=g,a.y>d.y+d.height-c.bottom/2&&(f.y+=g),a.y>d.y+d.height-c.bottom/4&&(f.y+=4*g));f.Ua(zb)||(b=new K(b.x+f.x/e,b.y+f.y/e));
N.free(d);K.free(f);return b};t=Q.prototype;t.Js=function(){return null};t.tv=function(){return null};t.cz=function(a,b){this.Qy.add(a,b)};t.Iu=function(a){(this.qx=a)||this.nodes.each(function(a){a instanceof U&&(a.$q=null)})};
function sk(a,b,c){function d(){var a=+new Date;f=!0;for(g.reset();g.next();)if(!g.value[0].ml){f=!1;break}f||a-l>k?b(c,e,h):x.requestAnimationFrame(d)}for(var e=c.callback,f=!0,g=a.fh.iterator;g.next();)if(!g.value[0].ml){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.sA=function(a){if(!Kg)return null;void 0===a&&(a=new Ya);a.returnType="Image";return this.ky(a)};
t.ky=function(a){void 0===a&&(a=new Ya);return sk(this,this.tA,a)};
t.tA=function(a,b,c){var d=tk(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 uk+"data":e=d.getImageData(0,0,c.width,c.height);break;case uk: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 tk(a,b,c,d){a.animationManager.sc();a.gd();if(null===a.Ca)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 Gb(Infinity,Infinity):new Gb(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 lc(l):l instanceof lc||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.zb.Ic(!0);n=new vk(null,p);var u=n.context;if(!(e||f||k||h)){n.width=a.ua+Math.ceil(l.left+l.right);n.height=a.ta+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.Up=r;oj(a,d.context,l,new Gb(n.width,n.height),a.sa,a.ja,k,m,q,b);return d.context}a.rn=!1;oj(a,u,l,new Gb(n.width,n.height),a.sa,a.ja,k,m,q,b);a.rn=!0;return n.context}var w=a.Sq,v=a.documentBounds.copy();v.Vv(a.nb);if(q)for(var y=a.Oa.l,z=y.length,A=0;A<z;A++){var C=y[A];if(C.visible&&C.isTemporary){C=C.Ha.l;for(var F=C.length,R=0;R<F;R++){var J=C[R];J.isInDocumentBounds&&J.isVisible()&&(J=J.actualBounds,J.u()&&v.Rc(J))}}}y=new K(v.x,v.y);if(null!==
k){z=!0;A=k.iterator;for(A.reset();A.next();)if(C=A.value,C instanceof V&&(F=C.layer,(null===F||F.visible)&&(null===F||q||!F.isTemporary)&&C.isVisible()&&(C=C.actualBounds,C.u())))if(z){z=!1;var S=C.copy()}else S.Rc(C);z&&(S=new N(0,0,0,0));v.width=S.width;v.height=S.height;y.x=S.x;y.y=S.y}null!==h&&h.u()&&(y=h,f||(f=w));S=h=0;null!==l&&(h=l.left+l.right,S=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-S)));null!==e&&null!==f?("NaN"===
f&&(f=w),e.u()?(e=A,v=z):isNaN(z)?(e=A,v=v.height*f):(e=v.width*f,v=z)):null!==e?e.u()?(f=Math.min(A/v.width,z/v.height),e=A,v=z):isNaN(z)?(f=A/v.width,e=A,v=v.height*f):(f=z/v.height,e=v.width*f,v=z):null!==f?"NaN"===f&&g.u()?(f=Math.min((g.width-h)/v.width,(g.height-S)/v.height),f>w?(f=w,e=v.width,v=v.height):(e=g.width,v=g.height)):(e=v.width*f,v=v.height*f):(f=w,e=v.width,v=v.height);null!==l?(e+=h,v+=S):l=new lc(0);null!==g&&(w=g.width,g=g.height,isNaN(w)&&(w=2E3),isNaN(g)&&(g=2E3),isFinite(w)&&
(e=Math.min(e,w)),isFinite(g)&&(v=Math.min(v,g)));n.width=Math.ceil(e);n.height=Math.ceil(v);if("SVG"===c){if(null===d)return null;d.resize(n.width,n.height,n.width,n.height);d.ownerDocument=p;d.Up=r;oj(a,d.context,l,new Gb(Math.ceil(e),Math.ceil(v)),f,y,k,m,q,b);return d.context}a.rn=!1;oj(a,u,l,new Gb(Math.ceil(e),Math.ceil(v)),f,y,k,m,q,b);a.rn=!0;return n.context}
na.Object.defineProperties(Q.prototype,{div:{get:function(){return this.Ga},set:function(a){if(this.Ga!==a){var b=this.Ga;null!==b?(b.D=void 0,b.goDiagram=void 0,b.go=void 0,b.innerHTML="",null!==this.Ca&&(b=this.Ca.La,this.removeEventListener(b,"pointermove",this.mk,!1),this.removeEventListener(b,"pointerdown",this.lk,!1),this.removeEventListener(b,"pointerup",this.pk,!1),this.removeEventListener(b,"pointerout",this.nk,!1),this.Ca.Mx()),this.zl&&(this.zl.disconnect(),
this.zl=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.zb=this.Ca=null,this.removeEventListener(x,"resize",this.gw,!1),this.removeEventListener(x,"wheel",this.ik,!0),ve===this&&(ve=null)):this.Uf=!1;this.Ga=null;if(null!==a){if(b=a.D)b.div=null;pi(this,a);this.redraw()}}}},Bx:{
get:function(){return this.zr}},Oi:{get:function(){return this.Uf}},draggedLink:{get:function(){return this.fv},set:function(a){this.fv!==a&&(this.fv=a,null!==a&&(this.lw=a.fromPort,this.at=a.toPort))}},oy:{get:function(){return this.lw},set:function(a){this.lw=a}},py:{get:function(){return this.at},set:function(a){this.at=a}},animationManager:{
get:function(){return this.Qd}},undoManager:{get:function(){return this.dc.undoManager}},skipsUndoManager:{get:function(){return this.kh},set:function(a){this.kh=a;this.dc.skipsUndoManager=a}},delaysLayout:{get:function(){return this.Et},set:function(a){this.Et=a}},opacity:{get:function(){return this.mb},set:function(a){var b=this.mb;b!==a&&((0>a||1<a)&&xa(a,"0 <= value <= 1",Q,
"opacity"),this.mb=a,this.g("opacity",b,a),this.N())}},validCycle:{get:function(){return this.lt},set:function(a){var b=this.lt;b!==a&&(this.lt=a,this.g("validCycle",b,a))}},layers:{get:function(){return this.Oa.iterator}},isModelReadOnly:{get:function(){var a=this.dc;return null===a?!1:a.isReadOnly},set:function(a){var b=this.dc;null!==b&&(b.isReadOnly=a)}},isReadOnly:{get:function(){return this.Sg},
set:function(a){var b=this.Sg;b!==a&&(this.Sg=a,this.g("isReadOnly",b,a))}},isEnabled:{get:function(){return this.vd},set:function(a){var b=this.vd;b!==a&&(this.vd=a,this.g("isEnabled",b,a))}},allowClipboard:{get:function(){return this.pt},set:function(a){var b=this.pt;b!==a&&(this.pt=a,this.g("allowClipboard",b,a))}},allowCopy:{get:function(){return this.K},set:function(a){var b=this.K;b!==a&&(this.K=a,this.g("allowCopy",
b,a))}},allowDelete:{get:function(){return this.wa},set:function(a){var b=this.wa;b!==a&&(this.wa=a,this.g("allowDelete",b,a))}},allowDragOut:{get:function(){return this.qt},set:function(a){var b=this.qt;b!==a&&(this.qt=a,this.g("allowDragOut",b,a))}},allowDrop:{get:function(){return this.rt},set:function(a){var b=this.rt;b!==a&&(this.rt=a,this.g("allowDrop",b,a))}},allowTextEdit:{
get:function(){return this.je},set:function(a){var b=this.je;b!==a&&(this.je=a,this.g("allowTextEdit",b,a))}},allowGroup:{get:function(){return this.Ba},set:function(a){var b=this.Ba;b!==a&&(this.Ba=a,this.g("allowGroup",b,a))}},allowUngroup:{get:function(){return this.Pd},set:function(a){var b=this.Pd;b!==a&&(this.Pd=a,this.g("allowUngroup",b,a))}},allowInsert:{get:function(){return this.ut},set:function(a){var b=
this.ut;b!==a&&(this.ut=a,this.g("allowInsert",b,a))}},allowLink:{get:function(){return this.Ma},set:function(a){var b=this.Ma;b!==a&&(this.Ma=a,this.g("allowLink",b,a))}},allowRelink:{get:function(){return this.Gb},set:function(a){var b=this.Gb;b!==a&&(this.Gb=a,this.g("allowRelink",b,a))}},allowMove:{get:function(){return this.Qb},set:function(a){var b=this.Qb;b!==a&&(this.Qb=a,this.g("allowMove",b,a))}},allowReshape:{
get:function(){return this.Rb},set:function(a){var b=this.Rb;b!==a&&(this.Rb=a,this.g("allowReshape",b,a))}},allowResize:{get:function(){return this.tc},set:function(a){var b=this.tc;b!==a&&(this.tc=a,this.g("allowResize",b,a))}},allowRotate:{get:function(){return this.Nd},set:function(a){var b=this.Nd;b!==a&&(this.Nd=a,this.g("allowRotate",b,a))}},allowSelect:{get:function(){return this.Od},set:function(a){var b=
this.Od;b!==a&&(this.Od=a,this.g("allowSelect",b,a))}},allowUndo:{get:function(){return this.$s},set:function(a){var b=this.$s;b!==a&&(this.$s=a,this.g("allowUndo",b,a))}},allowZoom:{get:function(){return this.Gu},set:function(a){var b=this.Gu;b!==a&&(this.Gu=a,this.g("allowZoom",b,a))}},hasVerticalScrollbar:{get:function(){return this.On},set:function(a){var b=this.On;b!==a&&(this.On=a,Ri(this),this.N(),this.g("hasVerticalScrollbar",
b,a),Oi(this,!1))}},hasHorizontalScrollbar:{get:function(){return this.Nn},set:function(a){var b=this.Nn;b!==a&&(this.Nn=a,Ri(this),this.N(),this.g("hasHorizontalScrollbar",b,a),Oi(this,!1))}},allowHorizontalScroll:{get:function(){return this.tt},set:function(a){var b=this.tt;b!==a&&(this.tt=a,this.g("allowHorizontalScroll",b,a),Oi(this,!1))}},allowVerticalScroll:{get:function(){return this.Au},set:function(a){var b=
this.Au;b!==a&&(this.Au=a,this.g("allowVerticalScroll",b,a),Oi(this,!1))}},scrollHorizontalLineChange:{get:function(){return this.et},set:function(a){var b=this.et;b!==a&&(0>a&&xa(a,">= 0",Q,"scrollHorizontalLineChange"),this.et=a,this.g("scrollHorizontalLineChange",b,a))}},scrollVerticalLineChange:{get:function(){return this.ft},set:function(a){var b=this.ft;b!==a&&(0>a&&xa(a,">= 0",Q,"scrollVerticalLineChange"),this.ft=a,this.g("scrollVerticalLineChange",
b,a))}},lastInput:{get:function(){return this.tj},set:function(a){this.tj=a}},previousInput:{get:function(){return this.hh},set:function(a){this.hh=a}},firstInput:{get:function(){return this.cr},set:function(a){this.cr=a}},currentCursor:{get:function(){return this.Ou},set:function(a){""===a&&(a=this.Zi);if(this.Ou!==a){var b=this.Ca,c=this.Ga;if(null!==b){this.Ou=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.Zi},set:function(a){""===a&&(a="auto");var b=this.Zi;b!==a&&(this.Zi=a,this.g("defaultCursor",b,a))}},click:{get:function(){return this.Bg},set:function(a){var b=
this.Bg;b!==a&&(this.Bg=a,this.g("click",b,a))}},doubleClick:{get:function(){return this.Jg},set:function(a){var b=this.Jg;b!==a&&(this.Jg=a,this.g("doubleClick",b,a))}},contextClick:{get:function(){return this.Dg},set:function(a){var b=this.Dg;b!==a&&(this.Dg=a,this.g("contextClick",b,a))}},mouseOver:{get:function(){return this.bh},set:function(a){var b=this.bh;b!==a&&(this.bh=a,this.g("mouseOver",b,a))}},mouseHover:{
get:function(){return this.$g},set:function(a){var b=this.$g;b!==a&&(this.$g=a,this.g("mouseHover",b,a))}},mouseHold:{get:function(){return this.Zg},set:function(a){var b=this.Zg;b!==a&&(this.Zg=a,this.g("mouseHold",b,a))}},mouseDragOver:{get:function(){return this.fw},set:function(a){var b=this.fw;b!==a&&(this.fw=a,this.g("mouseDragOver",b,a))}},mouseDrop:{get:function(){return this.Xg},set:function(a){var b=
this.Xg;b!==a&&(this.Xg=a,this.g("mouseDrop",b,a))}},handlesDragDropForTopLevelParts:{get:function(){return this.qv},set:function(a){var b=this.qv;b!==a&&(this.qv=a,this.g("handlesDragDropForTopLevelParts",b,a))}},mouseEnter:{get:function(){return this.Yg},set:function(a){var b=this.Yg;b!==a&&(this.Yg=a,this.g("mouseEnter",b,a))}},mouseLeave:{get:function(){return this.ah},set:function(a){var b=this.ah;b!==a&&
(this.ah=a,this.g("mouseLeave",b,a))}},toolTip:{get:function(){return this.uh},set:function(a){var b=this.uh;b!==a&&(this.uh=a,this.g("toolTip",b,a))}},contextMenu:{get:function(){return this.Eg},set:function(a){var b=this.Eg;b!==a&&(this.Eg=a,this.g("contextMenu",b,a))}},commandHandler:{get:function(){return this.Hu},set:function(a){this.Hu!==a&&(this.Hu=a,a.Ne(this))}},toolManager:{
get:function(){return this.ht},set:function(a){this.ht!==a&&(this.ht=a,a.diagram=this)}},defaultTool:{get:function(){return this.av},set:function(a){var b=this.av;b!==a&&(this.av=a,a.diagram=this,this.currentTool===b&&(this.currentTool=a))}},currentTool:{get:function(){return this.Tu},set:function(a){var b=this.Tu;null!==b&&(b.isActive&&b.doDeactivate(),b.cancelWaitAfter(),b.doStop());null===a&&(a=this.defaultTool);null!==a&&(this.Tu=a,a.diagram=
this,a.doStart())}},selection:{get:function(){return this.jx}},maxSelectionCount:{get:function(){return this.Wv},set:function(a){var b=this.Wv;if(b!==a)if(0<=a&&!isNaN(a)){if(this.Wv=a,this.g("maxSelectionCount",b,a),!this.undoManager.isUndoingRedoing&&(a=this.selection.count-a,0<a)){this.S("ChangingSelection",this.selection);b=this.selection.ya();for(var c=0;c<a;c++)b[c].isSelected=!1;this.S("ChangedSelection",this.selection)}}else xa(a,
">= 0",Q,"maxSelectionCount")}},nodeSelectionAdornmentTemplate:{get:function(){return this.tk},set:function(a){var b=this.tk;b!==a&&(this.tk=a,this.g("nodeSelectionAdornmentTemplate",b,a))}},groupSelectionAdornmentTemplate:{get:function(){return this.$i},set:function(a){var b=this.$i;b!==a&&(this.$i=a,this.g("groupSelectionAdornmentTemplate",b,a))}},linkSelectionAdornmentTemplate:{get:function(){return this.bj},
set:function(a){var b=this.bj;b!==a&&(this.bj=a,this.g("linkSelectionAdornmentTemplate",b,a))}},highlighteds:{get:function(){return this.Rw}},isModified:{get:function(){var a=this.undoManager;return a.isEnabled?null!==a.currentTransaction?!0:this.Tn&&this.re!==a.historyIndex:this.Tn},set:function(a){if(this.Tn!==a){this.Tn=a;var b=this.undoManager;!a&&b.isEnabled&&(this.re=b.historyIndex);a||Oj(this)}}},model:{
get:function(){return this.dc},set:function(a){var b=this.dc;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.sc(!0);var c=Ci(this,!0);this.Uf=!1;this.An=!0;this.re=-2;this.kg=!1;var d=this.lc;this.lc=!0;hh(this.animationManager,"Model");null!==b&&(null!==this.df&&this.df.each(function(a){b.rk(a)}),b.rk(this.sw));this.dc=a;this.partManager=Pj(this.dc.type);
for(var e=0;e<c.length;e++)this.add(c[e]);a.yh(this.rw);this.partManager.addAllModeledParts();a.rk(this.rw);a.yh(this.sw);null!==this.df&&this.df.each(function(b){a.yh(b)});this.lc=d;this.Qa();this.Wb||this.N();null!==b&&a.undoManager.copyProperties(b.undoManager)}}},Z:{get:function(){return this.qw},set:function(a){this.qw=a}},Hs:{get:function(){return this.Ky}},skipsModelSourceBindings:{get:function(){return this.tw},
set:function(a){this.tw=a}},Xs:{get:function(){return this.qu},set:function(a){this.qu=a}},nodeTemplate:{get:function(){return this.j.H("")},set:function(a){var b=this.j.H("");b!==a&&(this.j.add("",a),this.g("nodeTemplate",b,a),this.undoManager.isUndoingRedoing||this.Ld())}},nodeTemplateMap:{get:function(){return this.j},set:function(a){var b=this.j;b!==a&&(this.j=a,this.g("nodeTemplateMap",b,a),this.undoManager.isUndoingRedoing||
this.Ld())}},groupTemplate:{get:function(){return this.C.H("")},set:function(a){var b=this.C.H("");b!==a&&(this.C.add("",a),this.g("groupTemplate",b,a),this.undoManager.isUndoingRedoing||this.Ld())}},groupTemplateMap:{get:function(){return this.C},set:function(a){var b=this.C;b!==a&&(this.C=a,this.g("groupTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Ld())}},linkTemplate:{get:function(){return this.o.H("")},
set:function(a){var b=this.o.H("");b!==a&&(this.o.add("",a),this.g("linkTemplate",b,a),this.undoManager.isUndoingRedoing||this.Ld())}},linkTemplateMap:{get:function(){return this.o},set:function(a){var b=this.o;b!==a&&(this.o=a,this.g("linkTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Ld())}},isMouseCaptured:{get:function(){return this.pw},set:function(a){var b=this.Ca;null!==b&&(b=b.La,b instanceof SVGElement||(a?(this.lastInput.bubbles=
!1,this.removeEventListener(b,"pointermove",this.mk,!1),this.removeEventListener(b,"pointerdown",this.lk,!1),this.removeEventListener(b,"pointerup",this.pk,!1),this.removeEventListener(b,"pointerout",this.nk,!1),this.addEventListener(x,"pointermove",this.mk,!0),this.addEventListener(x,"pointerdown",this.lk,!0),this.addEventListener(x,"pointerup",this.pk,!0),this.addEventListener(x,"pointerout",this.nk,!0),this.removeEventListener(b,"wheel",this.ik,!1),this.addEventListener(x,"wheel",this.ik,!0),this.addEventListener(x,
"selectstart",this.preventDefault,!1)):(this.removeEventListener(x,"pointermove",this.mk,!0),this.removeEventListener(x,"pointerdown",this.lk,!0),this.removeEventListener(x,"pointerup",this.pk,!0),this.removeEventListener(x,"pointerout",this.nk,!0),this.addEventListener(b,"pointermove",this.mk,!1),this.addEventListener(b,"pointerdown",this.lk,!1),this.addEventListener(b,"pointerup",this.pk,!1),this.addEventListener(b,"pointerout",this.nk,!1),this.removeEventListener(x,"wheel",this.ik,!0),this.removeEventListener(x,
"selectstart",this.preventDefault,!1),this.addEventListener(b,"wheel",this.ik,!1)),this.pw=a))}},position:{get:function(){return this.ja},set:function(a){var b=K.alloc().assign(this.ja);if(!b.A(a)){var c=this.viewportBounds.copy();this.ja.assign(a);Kh(this.animationManager,b,this.ja);this.Wb||null===this.Ca&&!this.Gp.u()?Ei(this):(this.Wb=!0,a=this.scale,Qi(this,this.Uq,this.ua/a,this.ta/a,this.Hk,!1),this.Wb=!1);if(!this.Wb)this.onViewportBoundsChanged(c,this.viewportBounds,
this.sa,!1)}K.free(b)}},initialPosition:{get:function(){return this.vv},set:function(a){this.vv.A(a)||(this.vv=a.I())}},initialScale:{get:function(){return this.xv},set:function(a){this.xv!==a&&(this.xv=a)}},grid:{get:function(){null===this.Vb&&Ii(this);return this.Vb},set:function(a){var b=this.Vb;if(b!==a){null===b&&(Ii(this),b=this.Vb);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.Vb=a;a.name="GRID";null!==c&&c.add(a);ej(this);this.N();this.g("grid",b,a)}}},viewportBounds:{get:function(){return this.tx}},viewSize:{get:function(){return this.Gp},set:function(a){var b=this.viewSize;b.A(a)||(this.Gp=a=a.I(),this.ta=this.ua=0,a.u()?(this.ua=a.width,this.ta=a.height):null!==this.Ga&&(this.ua=this.Ga.clientWidth||1,this.ta=this.Ga.clientHeight||1),Ei(this),this.Qa(),this.g("viewSize",
b,a),this.redraw())}},fixedBounds:{get:function(){return this.pv},set:function(a){var b=this.pv;b.A(a)||(-Infinity!==a.width&&Infinity!==a.height&&-Infinity!==a.height||B("fixedBounds width/height must not be Infinity"),this.pv=a=a.I(),this.Qa(),this.g("fixedBounds",b,a))}},scrollMargin:{get:function(){return this.Hj},set:function(a){"number"===typeof a&&(a=new lc(a));var b=this.Hj;b.A(a)||(this.Hj=a=a.I(),this.g("scrollMargin",b,a),this.oq())}},
scrollMode:{get:function(){return this.Ij},set:function(a){var b=this.Ij;b!==a&&(this.Ij=a,a===Oh&&Oi(this,!1),this.g("scrollMode",b,a),this.N())}},scrollsPageOnFocus:{get:function(){return this.gt},set:function(a){var b=this.gt;b!==a&&(this.gt=a,this.g("scrollsPageOnFocus",b,a))}},positionComputation:{get:function(){return this.ct},set:function(a){var b=this.ct;b!==a&&(this.ct=a,Oi(this,!1),this.g("positionComputation",
b,a))}},scaleComputation:{get:function(){return this.dt},set:function(a){var b=this.dt;b!==a&&(this.dt=a,Mj(this,this.scale,this.scale),this.g("scaleComputation",b,a))}},documentBounds:{get:function(){return this.Uq}},isVirtualized:{get:function(){return this.Ev},set:function(a){var b=this.Ev;b!==a&&(this.Ev=a,this.g("isVirtualized",b,a))}},scale:{get:function(){return this.sa},
set:function(a){var b=this.sa;b!==a&&Mj(this,b,a)}},defaultScale:{get:function(){return this.Sq},set:function(a){this.Sq=a}},autoScale:{get:function(){return this.Ph},set:function(a){var b=this.Ph;b!==a&&(this.Ph=a,this.g("autoScale",b,a),a!==nh&&Oi(this,!1))}},initialAutoScale:{get:function(){return this.Rg},set:function(a){var b=this.Rg;b!==a&&(this.Rg=a,this.g("initialAutoScale",b,a))}},initialViewportSpot:{
get:function(){return this.Av},set:function(a){var b=this.Av;b!==a&&(a.hb()||B("initialViewportSpot must be a specific Spot: "+a),this.Av=a,this.g("initialViewportSpot",b,a))}},initialDocumentSpot:{get:function(){return this.rv},set:function(a){var b=this.rv;b!==a&&(a.hb()||B("initialViewportSpot must be a specific Spot: "+a),this.rv=a,this.g("initialDocumentSpot",b,a))}},minScale:{get:function(){return this.$v},set:function(a){var b=
this.$v;b!==a&&(0<a?(this.$v=a,this.g("minScale",b,a),a>this.scale&&(this.scale=a)):xa(a,"> 0",Q,"minScale"))}},maxScale:{get:function(){return this.Lv},set:function(a){var b=this.Lv;b!==a&&(0<a?(this.Lv=a,this.g("maxScale",b,a),a<this.scale&&(this.scale=a)):xa(a,"> 0",Q,"maxScale"))}},zoomPoint:{get:function(){return this.mt},set:function(a){this.mt.A(a)||(this.mt=a=a.I())}},contentAlignment:{get:function(){return this.Hk},
set:function(a){var b=this.Hk;b.A(a)||(this.Hk=a=a.I(),this.g("contentAlignment",b,a),Oi(this,!1))}},initialContentAlignment:{get:function(){return this.ir},set:function(a){var b=this.ir;b.A(a)||(this.ir=a=a.I(),this.g("initialContentAlignment",b,a))}},padding:{get:function(){return this.nb},set:function(a){"number"===typeof a&&(a=new lc(a));var b=this.nb;b.A(a)||(this.nb=a=a.I(),this.Qa(),this.g("padding",b,a))}},partManager:{
get:function(){return this.bt},set:function(a){var b=this.bt;b!==a&&(null!==a.diagram&&B("Cannot share PartManagers between Diagrams: "+a.toString()),null!==b&&b.Ne(null),this.bt=a,a.Ne(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.vc},set:function(a){var b=this.vc;b!==a&&(this.vc=a,a.diagram=this,a.group=null,this.Oh=!0,this.g("layout",b,a),this.Fb())}},isTreePathToChildren:{get:function(){return this.Bv},set:function(a){var b=this.Bv;if(b!==a&&(this.Bv=a,this.g("isTreePathToChildren",b,a),!this.undoManager.isUndoingRedoing))for(a=this.nodes;a.next();)wk(a.value)}},treeCollapsePolicy:{get:function(){return this.jt},set:function(a){var b=
this.jt;b!==a&&(a!==ri&&a!==xk&&a!==yk&&B("Unknown Diagram.treeCollapsePolicy: "+a),this.jt=a,this.g("treeCollapsePolicy",b,a))}},Ke:{get:function(){return this.ow},set:function(a){this.ow=a}},autoScrollInterval:{get:function(){return this.Cq},set:function(a){var b=this.Cq;b!==a&&(this.Cq=a,this.g("autoScrollInterval",b,a))}},autoScrollRegion:{get:function(){return this.Eq},set:function(a){"number"===typeof a&&
(a=new lc(a));var b=this.Eq;b.A(a)||(this.Eq=a=a.I(),this.Qa(),this.g("autoScrollRegion",b,a))}}});na.Object.defineProperties(Q,{licenseKey:{get:function(){return zk.$b()},set:function(a){zk.add(a)}},version:{get:function(){return Ak}}});Q.prototype.makeImageData=Q.prototype.ky;Q.prototype.makeImage=Q.prototype.sA;Q.prototype.cacheGroupExternalLinks=Q.prototype.Iu;Q.prototype.addRenderer=Q.prototype.cz;Q.prototype.makeSVG=Q.prototype.tv;
Q.prototype.makeSvg=Q.prototype.Js;Q.prototype.stopAutoScroll=Q.prototype.ug;Q.prototype.doAutoScroll=Q.prototype.ns;Q.prototype.isUnoccupied=Q.prototype.fk;Q.prototype.raiseDiagramEvent=Q.prototype.S;Q.prototype.removeDiagramListener=Q.prototype.mm;Q.prototype.addDiagramListener=Q.prototype.Nj;Q.prototype.findTreeRoots=Q.prototype.Wz;Q.prototype.layoutDiagram=Q.prototype.qA;Q.prototype.findTopLevelGroups=Q.prototype.Pz;Q.prototype.findTopLevelNodesAndLinks=Q.prototype.Qz;
Q.prototype.ensureBounds=Q.prototype.Ta;Q.prototype.findLinksByExample=Q.prototype.qs;Q.prototype.findNodesByExample=Q.prototype.rs;Q.prototype.findLinkForData=Q.prototype.Ac;Q.prototype.findNodeForData=Q.prototype.Gi;Q.prototype.findPartForData=Q.prototype.Bc;Q.prototype.findLinkForKey=Q.prototype.findLinkForKey;Q.prototype.findNodeForKey=Q.prototype.Eb;Q.prototype.findPartForKey=Q.prototype.findPartForKey;Q.prototype.rebuildParts=Q.prototype.Ld;Q.prototype.transformViewToDoc=Q.prototype.Zs;
Q.prototype.transformRectDocToView=Q.prototype.WA;Q.prototype.transformDocToView=Q.prototype.wq;Q.prototype.centerRect=Q.prototype.ls;Q.prototype.scrollToRect=Q.prototype.Nv;Q.prototype.scroll=Q.prototype.scroll;Q.prototype.highlightCollection=Q.prototype.hA;Q.prototype.highlight=Q.prototype.gA;Q.prototype.selectCollection=Q.prototype.NA;Q.prototype.select=Q.prototype.select;Q.prototype.updateAllRelationshipsFromData=Q.prototype.zq;Q.prototype.updateAllTargetBindings=Q.prototype.updateAllTargetBindings;
Q.prototype.commit=Q.prototype.commit;Q.prototype.rollbackTransaction=Q.prototype.Hf;Q.prototype.commitTransaction=Q.prototype.Xa;Q.prototype.startTransaction=Q.prototype.xa;Q.prototype.raiseChanged=Q.prototype.g;Q.prototype.raiseChangedEvent=Q.prototype.Wa;Q.prototype.removeChangedListener=Q.prototype.rk;Q.prototype.addChangedListener=Q.prototype.yh;Q.prototype.removeModelChangedListener=Q.prototype.IA;Q.prototype.addModelChangedListener=Q.prototype.zx;Q.prototype.findLayer=Q.prototype.Zj;
Q.prototype.removeLayer=Q.prototype.GA;Q.prototype.addLayerAfter=Q.prototype.Zy;Q.prototype.addLayerBefore=Q.prototype.xx;Q.prototype.addLayer=Q.prototype.Ul;Q.prototype.moveParts=Q.prototype.moveParts;Q.prototype.copyParts=Q.prototype.Vj;Q.prototype.removeParts=Q.prototype.Rs;Q.prototype.remove=Q.prototype.remove;Q.prototype.add=Q.prototype.add;Q.prototype.clearDelayedGeometries=Q.prototype.Ju;Q.prototype.setProperties=Q.prototype.zm;Q.prototype.attach=Q.prototype.Fu;Q.prototype.set=Q.prototype.set;
Q.prototype.resetInputOptions=Q.prototype.vy;Q.prototype.setInputOption=Q.prototype.OA;Q.prototype.getInputOption=Q.prototype.cm;Q.prototype.resetRenderingHints=Q.prototype.wy;Q.prototype.setRenderingHint=Q.prototype.Ay;Q.prototype.getRenderingHint=Q.prototype.Ie;Q.prototype.maybeUpdate=Q.prototype.gd;Q.prototype.requestUpdate=Q.prototype.Fb;Q.prototype.delayInitialization=Q.prototype.uz;Q.prototype.isUpdateRequested=Q.prototype.mA;Q.prototype.invalidateDocumentBounds=Q.prototype.Qa;
Q.prototype.findObjectsNear=Q.prototype.qg;Q.prototype.findPartsNear=Q.prototype.Lz;Q.prototype.findObjectsIn=Q.prototype.zf;Q.prototype.findPartsIn=Q.prototype.Tx;Q.prototype.findObjectsAt=Q.prototype.Hi;Q.prototype.findPartsAt=Q.prototype.Kz;Q.prototype.findObjectAt=Q.prototype.Zb;Q.prototype.findPartAt=Q.prototype.am;Q.prototype.focusObject=Q.prototype.Xz;Q.prototype.alignDocument=Q.prototype.ez;Q.prototype.zoomToRect=Q.prototype.$A;Q.prototype.zoomToFit=Q.prototype.zoomToFit;
Q.prototype.diagramScroll=Q.prototype.Kx;Q.prototype.focus=Q.prototype.focus;
var ve=null,ii=new H,Gi=null,Fi=null,Kg=void 0!==x.document,ui=null,Bi="",nh=new D(Q,"None",0),Ti=new D(Q,"Uniform",1),Ui=new D(Q,"UniformToFill",2),Cf=new D(Q,"CycleAll",10),Gf=new D(Q,"CycleNotDirected",11),If=new D(Q,"CycleNotDirectedFast",12),Jf=new D(Q,"CycleNotUndirected",13),Df=new D(Q,"CycleDestinationTree",14),Ff=new D(Q,"CycleSourceTree",15),Oh=new D(Q,"DocumentScroll",1),Qh=new D(Q,"InfiniteScroll",2),ri=new D(Q,"TreeParentCollapsed",21),xk=new D(Q,"AllParentsCollapsed",22),yk=new D(Q,
"AnyParentsCollapsed",23),zk=new E,Ak="2.2.0",uk="image",Bk=null,gi=!1;
function hi(){if(Kg){var a=x.document.createElement("canvas"),b=a.getContext("2d"),c=Qa("7ca11abfd022028846");b[c]=Qa("398c3597c01238");for(var d=["5da73c80a36455d6038e4972187c3cae51fd22",sa.Dx+"4ae6247590da4bb21c324ba3a84e385776",od.xF+"fb236cdfda5de14c134ba1a95a2d4c7cc6f93c1387",M.za],e=1;5>e;e++)b[Qa("7ca11abfd7330390")](Qa(d[e-1]),10,15*e);b[c]=Qa("39f046ebb36e4b");for(c=1;5>c;c++)b[Qa("7ca11abfd7330390")](Qa(d[c-1]),10,15*c);if(4!==d.length||"5"!==d[0][0]||"7"!==d[3][0])od.prototype.Hd=od.prototype.Cx;
Bk=a}}Q.className="Diagram";Q.fromDiv=function(a){var b=a;"string"===typeof a&&(b=x.document.getElementById(a));return b instanceof HTMLDivElement&&b.D instanceof Q?b.D: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=nh;Q.Uniform=Ti;Q.UniformToFill=Ui;Q.CycleAll=Cf;Q.CycleNotDirected=Gf;Q.CycleNotDirectedFast=If;
Q.CycleNotUndirected=Jf;Q.CycleDestinationTree=Df;Q.CycleSourceTree=Ff;Q.DocumentScroll=Oh;Q.InfiniteScroll=Qh;Q.TreeParentCollapsed=ri;Q.AllParentsCollapsed=xk;Q.AnyParentsCollapsed=yk;function oi(){this.Uy=null;this.j="zz@orderNum";"63ad05bbe23a1786468a4c741b6d2"===this._tk?this.kd=this.j=!0:this.kd=null}
function nj(a,b){b.zb.setTransform(b.ec,0,0,b.ec,0,0);b.zb.Ed();if(null===a.kd)a:{b="f";var c=x[Qa("76a715b2f73f148a")][Qa("72ba13b5")];a.kd=!0;if(Kg){var d=Q[Qa("76a115b6ed251eaf4692")];if(d)for(var e=zk.iterator;e.next();){d=e.value;d=Qa(d).split(Qa("39e9"));if(6>d.length)break;var f=Qa(d[1]).split(".");if("7da71ca0"!==d[4])break;var g=Qa(sa[Qa("6cae19")]).split(".");if(f[0]>g[0]||f[0]===g[0]&&f[1]>=g[1]){var h=x[Qa("74a900bae4370f8b51")][Qa("6fbb13a1c2311e8a57")].toLowerCase();g=h[Qa("73a612b6fb191d")](Qa("3aad1ab6e022098b4dc4"));
f=Qa(d[2]);if(-1<g&&(h=h[Qa("73a612b6fb191d")](" "+f.toLowerCase()+"/"),a.kd=!(-1<h&&h<g),!a.kd))break;g=c[Qa("76ad18b4f73e")];for(h=c[Qa("73a612b6fb191d")](Qa("35e7"))+2;h<g;h++)b+=c[h];g=b[Qa("73a612b6fb191d")](f);0>g&&f!==Qa("7da71ca0ad381e90")&&(g=b[Qa("73a612b6fb191d")](Qa("76a715b2ef3e149757")));0>g&&(g=b[Qa("73a612b6fb191d")](Qa("76a715b2ef3e149757")));0>g&&(g=c[Qa("73a612b6fb191d")](Qa("7baa19a6f76c1988428554")));a.kd=!(0<=g&&g<b[Qa("73a612b6fb191d")](Qa("35"))||-1===b[Qa("73a612b6fb191d")](Qa("35")));
if(!a.kd)break;if(c[Qa("73a612b6fb191d")](Qa("7fb002b6ed25128b4da25b2e"))&&c[Qa("73a612b6fb191d")](Qa("75ba1beee63a1e875799507d"))&&(a.kd=!(-1<c[Qa("73a612b6fb191d")](f)),!a.kd))break;if("#"===f[0]){g=x.document.createElement("div");for(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[Qa("79a417a0f0181a8946")]=d;if(x.document[Qa("78a712aa")]){if(x.document[Qa("78a712aa")][Qa("7bb806b6ed32388c4a875b")](g),
h=x.getComputedStyle(g).getPropertyValue(Qa("78a704b7e62456904c9b12701b6532a8")),x.document[Qa("78a712aa")][Qa("68ad1bbcf533388c4a875b")](g),h)if(-1!==h.indexOf(parseInt(f[1]+f[2],16))&&-1!==h.indexOf(parseInt(f[3]+f[4],16))){a.kd=!1;break}else if(Ra||Sa)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.kd=!1;break a}}}else a.kd=null,a.kd=!1}}}else{k=c[Qa("76ad18b4f73e")];for(e=c[Qa("73a612b6fb191d")](Qa("35e7"))+
2;e<k;e++)b+=c[e];c=b[Qa("73a612b6fb191d")](Qa("7da71ca0ad381e90"));a.kd=!(0<=c&&c<b[Qa("73a612b6fb191d")](Qa("35")))}}}return 0<a.kd&&a!==a.Uy?!0:!1}
function pi(a,b){if(Kg){void 0!==b&&null!==b||B("Diagram setup requires an argument DIV.");null!==a.Ga&&B("Diagram has already completed setup.");"string"===typeof b?a.Ga=x.document.getElementById(b):b instanceof HTMLDivElement?a.Ga=b:B("No DIV or DIV id supplied: "+b);null===a.Ga&&B("Invalid DIV id; could not get element with id: "+b);void 0!==a.Ga.D&&B("Invalid div id; div already has a Diagram associated with it.");if(!a.zl&&x.ResizeObserver){var c=ta(function(){a.Fb()},250);a.zl=new x.ResizeObserver(function(){c()});
a.zl.observe(a.Ga)}"static"===x.getComputedStyle(a.Ga,null).position&&(a.Ga.style.position="relative");b=5;var d="rgba(2"+b+"5, 255, 255, 0)";b--;a.Ga.style["-webkit-tap-highlight-color"]=d;a.Ga.innerHTML="";a.Ga.D=a;a.Ga.goDiagram=a;a.Ga.go=x.go;var e=a.$r?new sj(a):new vk(a);void 0!==e.style&&(e.style.position="absolute",e.style.top="0px",e.style.left="0px","rtl"===x.getComputedStyle(a.Ga,null).getPropertyValue("direction")&&(a.Vn=!0),e.style.zIndex="2",e.style.userSelect="none",e.style.MozUserSelect=
"none",e.style.touchAction="none");a.Ca=e;a.zb=e.context;d=a.zb;a.ec=a.computePixelRatio();a.viewSize.u()||(a.ua=a.Ga.clientWidth||1,a.ta=a.Ga.clientHeight||1);uj(a,a.ua,a.ta);a.Ga.insertBefore(e.La,a.Ga.firstChild);e=new vk(null);e.width=1;e.height=1;a.It=e;a.Mw=e.context;if(Kg){e=va("div");var f=va("div");e.style.position="absolute";e.style.overflow="auto";e.style.width=a.ua+"px";e.style.height=a.ta+"px";e.style.zIndex="1";f.style.position="absolute";f.style.width="1px";f.style.height="1px";a.Ga.appendChild(e);
e.appendChild(f);e.onscroll=Ji;e.addEventListener("pointerdown",Li);e.D=a;e.Sy=!0;e.Ty=!0;a.Or=e;a.gp=f}a.oq=ta(function(){a.si=null;a.N()},300);a.gw=ta(function(){Ah(a)},250);a.preventDefault=function(a){a.preventDefault();return!1};a.ik=function(b){if(a.isEnabled){var c=Yi(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();bj(c,b)}};a.xA=function(b){a.isEnabled&&(a.el=!1,Yi(a,b,!0),b=a.currentTool,b.cancelWaitAfter(),b.standardMouseOver())};a.lk=function(b){if(a.isEnabled){a.el=!0;var c=a.gu;void 0===c[b.pointerId]&&(c[b.pointerId]=b);c=a.wl;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(c="touch"===b.pointerType||"pen"===b.pointerType)a.su=!1,a.Wt=!0;var e=d;d=aj(a,b,!0,!1,!0,e);Zi(a,b,d);d.targetDiagram=$i(b);d.targetObject=null;e||d.clone(a.cr);e=a.Vw;c=c?25:10;b.timeStamp-a.Uw<a.Xy&&!(Math.abs(e.x-b.screenX)>c||Math.abs(e.y-b.screenY)>c)?a.sr++:a.sr=1;d.clickCount=a.sr;a.Uw=b.timeStamp;a.Vw.tg(b.screenX,b.screenY);a.doMouseDown();
1===b.button?b.preventDefault():bj(d,b)}};a.mk=function(b){if(a.isEnabled){a.el=!0;var c=a.wl;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}if(c[0].pointerId===b.pointerId){c=aj(a,b,!1,!1,!1,null!==c[1]);var d=x.document.elementFromPoint(b.clientX,b.clientY);null!==d&&void 0!==d.shadowRoot&&null!==d.shadowRoot&&(d=d.shadowRoot.elementFromPoint(b.clientX,b.clientY));var e=a,f=b;d&&d.D&&(f=b,e=d.D);
c.targetDiagram=e;Zi(a,f,c);c.targetObject=null;a.doMouseMove();bj(c,b)}}};a.pk=function(b){if(a.isEnabled){a.el=!0;var c="touch"===b.pointerType||"pen"===b.pointerType,d=a.gu;if(c&&a.su)delete d[b.pointerId],b.preventDefault();else if(d=a.wl,null!==d[0]&&d[0].pointerId===b.pointerId){d[0]=null;d=aj(a,b,!1,!0,!0,!1);var e=x.document.elementFromPoint(b.clientX,b.clientY);null!==e&&e.D instanceof Q&&e.D!==a&&Zi(e.D,b,d);Zi(a,b,d);d.clickCount=a.sr;null===e?d.targetDiagram=$i(b):e.D?d.targetDiagram=
e.D:d.targetDiagram=null;d.targetObject=null;a.doMouseUp();bj(d,b);c&&(a.Wt=!1)}else null!==d[1]&&d[1].pointerId===b.pointerId&&(d[1]=null)}};a.nk=function(b){if(a.isEnabled){a.el=!1;var c=a.gu;c[b.pointerId]&&delete c[b.pointerId];c=a.wl;null!==c[0]&&c[0].pointerId===b.pointerId&&(c[0]=null);null!==c[1]&&c[1].pointerId===b.pointerId&&(c[1]=null);"touch"!==b.pointerType&&"pen"!==b.pointerType&&(b=a.currentTool,b.cancelWaitAfter(),b.standardMouseOver())}};a.Wq=d.Y["d"+Ck[1]+Ck[2]+"wI"+uk.slice(1,5)]["b"+
Dk.slice(1,b)](d.Y,Bk,b,b);d.Ic(!0);Hi(a)}}oi.className="DiagramHelper";function Te(a){this.j=void 0===a?new K:a;this.o=new K}na.Object.defineProperties(Te.prototype,{point:{get:function(){return this.j},set:function(a){this.j=a}},shifted:{get:function(){return this.o},set:function(a){this.o=a}}});var Ck="DraggingInfo";Te.className="DraggingInfo";function Fj(a,b,c){this.node=a;this.info=b;this.ev=c}Fj.className="DraggingNodeInfoPair";
function Me(){this.reset()}Me.prototype.reset=function(){this.isGridSnapEnabled=!1;this.isGridSnapRealtime=!0;this.gridSnapCellSize=(new Gb(NaN,NaN)).freeze();this.gridSnapCellSpot=uc;this.gridSnapOrigin=(new K(NaN,NaN)).freeze();this.groupsSnapMembers=this.dragsTree=this.dragsLink=!1;this.dragsMembers=this.groupsAlwaysMove=!0};Me.className="DraggingOptions";
function Ek(a,b){if("string"===typeof a||x.Element&&a instanceof Element)var c=Q.call(this,a)||this;else c=Q.call(this)||this,b=a;Fk(c);b&&c.zm(b);return c}ma(Ek,Q);function Fk(a){a.allowDragOut=!0;a.allowMove=!1;a.isReadOnly=!0;a.contentAlignment=vc;a.layout=new Gk}Ek.prototype.reset=function(){Q.prototype.reset.call(this);Fk(this)};Ek.className="Palette";
function Hk(a,b){if("string"===typeof a||x.Element&&a instanceof Element)var c=Q.call(this,a)||this;else c=Q.call(this)||this,b=a;var d=c;c.animationManager.isEnabled=!1;c.Wb=!0;c.kw=null;c.Nn=!1;c.On=!1;c.ov=!0;c.hv=!0;c.kt=0;c.aj=!1;c.Gl=null;c.Ay("drawShadows",!1);a=new V;var e=new xf;e.stroke="magenta";e.strokeWidth=2;e.fill="transparent";e.name="BOXSHAPE";a.selectable=!0;a.selectionAdorned=!1;a.selectionObjectName="BOXSHAPE";a.locationObjectName="BOXSHAPE";a.resizeObjectName="BOXSHAPE";a.cursor=
"move";a.add(e);c.Yi=a;c.allowCopy=!1;c.allowDelete=!1;c.allowSelect=!0;c.autoScrollRegion=new lc(0,0,0,0);c.ja.h(0,0);c.toolManager.Za("Dragging",new Ik,c.toolManager.mouseMoveTools);c.click=function(){var a=d.observed;if(null!==a){var b=a.viewportBounds,c=d.lastInput.documentPoint;a.position=new K(c.x-b.width/2,c.y-b.height/2)}};c.xw=function(){d.Qa();Jk(d)};c.ww=function(){null!==d.observed&&(d.Qa(),d.N())};c.nt=function(){1>d.updateDelay?d.N():d.aj||(d.aj=!0,setTimeout(function(){return d.redraw()},
d.updateDelay))};c.vw=function(){null!==d.observed&&Jk(d)};c.autoScale=Ti;c.Wb=!1;b&&Object.assign(c,b);return c}ma(Hk,Q);Hk.prototype.computePixelRatio=function(){return 1};
Hk.prototype.redraw=function(){if(this.aj&&1<=this.updateDelay){this.aj=!1;var a=this.Ca,b=this.zb;if(null!==a&&null!==b){lj(this);if(null===this.Gl){var c=new vk(null);c.width=a.width;c.height=a.height;this.Gl=c}try{this.Ca=this.Gl,this.zb=this.Ca.context,this.zb.Ic(!0),this.zb.setTransform(1,0,0,1,0,0),this.zb.clearRect(0,0,this.Ca.width,this.Ca.height),Kk(this)}finally{this.Ca=a,this.zb=b}}}Q.prototype.redraw.call(this)};
Hk.prototype.pc=function(){null===this.Ga&&B("No div specified");null===this.Ca&&B("No canvas specified");if(!(this.Ca instanceof sj)&&(bi(this.box),this.Wc)){var a=this.observed;if(null!==a&&!a.animationManager.defaultAnimation.isAnimating&&a.Oi){lj(this);var b=this.Ca;a=this.zb;a.Ic(!0);a.setTransform(1,0,0,1,0,0);a.clearRect(0,0,b.width,b.height);1>this.updateDelay?Kk(this):null!==this.Gl&&(a.drawImage(this.Gl.La,0,0),b=this.ub,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.ec,this.ec),a.transform(b.m11,b.m12,b.m21,b.m22,b.dx,b.dy));b=this.Oa.l;for(var c=b.length,d=0;d<c;d++)b[d].pc(a,this);this.Wc=this.nj=!1}}};
function Kk(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).Rc(b.viewportBounds),ej(b,e),N.free(e),ih(b));var f=a.ub;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.zb;e.scale(a.ec,a.ec);e.transform(f.m11,f.m12,f.m21,f.m22,f.dx,f.dy);b=b.Oa.l;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=ci(h,e),l.pc(e,k),e.globalAlpha=h);else{for(var m=ci(h,e),n=k.scale,p=N.alloc(),r=h.Ha.l,q=r.length,u=0;u<q;u++){var w=r[u];(d||w!==l)&&h.Di(e,w,k,null,n,p,!1)}N.free(p);e.globalAlpha=m}}}}}
function Jk(a){var b=a.box;if(null!==b){var c=a.observed;if(null!==c){a.Wc=!0;c=c.viewportBounds;var d=b.selectionObject,e=Gb.alloc();e.h(c.width,c.height);d.desiredSize=e;Gb.free(e);a=2/a.scale;d instanceof xf&&(d.strokeWidth=a);b.location=new K(c.x-a/2,c.y-a/2);b.isSelected=!0}}}Hk.prototype.computeBounds=function(){var a=this.observed;if(null===a)return hc;var b=a.documentBounds.copy();b.Rc(a.viewportBounds);return b};Hk.prototype.invalidateViewport=function(){!0!==this.Wc&&(this.Wc=!0,this.Fb())};
Hk.prototype.onViewportBoundsChanged=function(a,b,c,d){this.Wb||(Mi(this),this.N(),Ri(this),this.Qa(),Jk(this),this.dd.scale=c,this.dd.position.x=a.x,this.dd.position.y=a.y,this.dd.bounds.assign(a),this.dd.iy=d,this.S("ViewportBoundsChanged",this.dd,a))};
na.Object.defineProperties(Hk.prototype,{observed:{get:function(){return this.kw},set:function(a){var b=this.kw;a instanceof Hk&&B("Overview.observed Diagram may not be an Overview itself: "+a);if(b!==a){null!==b&&(this.remove(this.box),b.mm("ViewportBoundsChanged",this.xw),b.mm("DocumentBoundsChanged",this.ww),b.mm("InvalidateDraw",this.nt),b.mm("AnimationFinished",this.vw));this.kw=a;null!==a&&(a.Nj("ViewportBoundsChanged",this.xw),a.Nj("DocumentBoundsChanged",this.ww),
a.Nj("InvalidateDraw",this.nt),a.Nj("AnimationFinished",this.vw),this.add(this.box));this.Qa();if(null===a){this.Gl=null;var c=this.Ca,d=this.zb;c&&d&&(d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,c.width,c.height))}else this.nt(null),Jk(this),this.N();this.g("observed",b,a)}}},box:{get:function(){return this.Yi},set:function(a){var b=this.Yi;b!==a&&(this.Yi=a,this.remove(b),this.add(this.Yi),Jk(this),this.g("box",b,a))}},drawsTemporaryLayers:{
get:function(){return this.ov},set:function(a){this.ov!==a&&(this.ov=a,this.redraw())}},drawsGrid:{get:function(){return this.hv},set:function(a){this.hv!==a&&(this.hv=a,this.redraw())}},updateDelay:{get:function(){return this.kt},set:function(a){0>a&&(a=0);this.kt!==a&&(this.kt=a)}}});Hk.className="Overview";function Ik(){Le.call(this);this.j=null}ma(Ik,Le);
Ik.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(null===a||!a.allowMove||!a.allowSelect)return!1;var b=a.observed;if(null===b)return!1;var c=a.lastInput;if(!c.left||a.currentTool!==this&&(!this.isBeyondDragSize()||c.isTouchEvent&&c.timestamp-a.firstInput.timestamp<this.delay))return!1;null===this.findDraggablePart()&&(c=b.viewportBounds,this.j=new K(c.width/2,c.height/2),a=a.firstInput.documentPoint,b.position=new K(a.x-this.j.x,a.y-this.j.y));return!0};
Ik.prototype.doActivate=function(){this.j=null;Le.prototype.doActivate.call(this)};Ik.prototype.doUpdateCursor=function(){var a=this.diagram,b=a.box;null!==b&&b.cursor&&(a.currentCursor=b.cursor)};Ik.prototype.moveParts=function(){var a=this.diagram,b=a.observed;if(null!==b){var c=a.box;if(null!==c){if(null===this.j){var d=a.firstInput.documentPoint;c=c.location;this.j=new K(d.x-c.x,d.y-c.y)}a=a.lastInput.documentPoint;b.position=new K(a.x-this.j.x,a.y-this.j.y)}}};Ik.className="OverviewDraggingTool";
function Lk(){Va(this);this.D=ve;this.Ma=this.C=this.o=!0;this.K=this.wa=this.Qb=this.Ba=!1;this.ki=this.j=null;this.tc=1.05;this.Xt=NaN;this.Tw=null;this.zu=NaN;this.yu=hc;this.Gb=!0;this.eg=null;this.Rb=200}Lk.prototype.toString=function(){return"CommandHandler"};Lk.prototype.Ne=function(a){this.D=a};
Lk.prototype.doKeyDown=function(){var a=this.diagram,b=a.lastInput,c=Ta?b.meta:b.control,d=b.shift,e=b.alt,f=b.key;!c||"C"!==f&&"Insert"!==f?c&&"X"===f||d&&"Del"===f?this.canCutSelection()&&this.cutSelection():c&&"V"===f||d&&"Insert"===f?this.canPasteSelection()&&this.pasteSelection():c&&"Y"===f||e&&d&&"Backspace"===f?this.canRedo()&&this.redo():c&&"Z"===f||e&&"Backspace"===f?this.canUndo()&&this.undo():"Del"===f||"Backspace"===f?this.canDeleteSelection()&&this.deleteSelection():c&&"A"===f?this.canSelectAll()&&
this.selectAll():"Esc"===f?this.canStopCommand()&&this.stopCommand():"Up"===f?a.allowVerticalScroll&&(c?a.scroll("pixel","up"):a.scroll("line","up")):"Down"===f?a.allowVerticalScroll&&(c?a.scroll("pixel","down"):a.scroll("line","down")):"Left"===f?a.allowHorizontalScroll&&(c?a.scroll("pixel","left"):a.scroll("line","left")):"Right"===f?a.allowHorizontalScroll&&(c?a.scroll("pixel","right"):a.scroll("line","right")):"PageUp"===f?d&&a.allowHorizontalScroll?a.scroll("page","left"):a.allowVerticalScroll&&
a.scroll("page","up"):"PageDown"===f?d&&a.allowHorizontalScroll?a.scroll("page","right"):a.allowVerticalScroll&&a.scroll("page","down"):"Home"===f?c&&a.allowVerticalScroll?a.scroll("document","up"):!c&&a.allowHorizontalScroll&&a.scroll("document","left"):"End"===f?c&&a.allowVerticalScroll?a.scroll("document","down"):!c&&a.allowHorizontalScroll&&a.scroll("document","right"):" "===f?this.canScrollToPart()&&this.scrollToPart():"Subtract"===f?this.canDecreaseZoom()&&this.decreaseZoom():"Add"===f?this.canIncreaseZoom()&&
this.increaseZoom():c&&"0"===f?this.canResetZoom()&&this.resetZoom():d&&"Z"===f?this.canZoomToFit()&&this.zoomToFit():c&&!d&&"G"===f?this.canGroupSelection()&&this.groupSelection():c&&d&&"G"===f?this.canUngroupSelection()&&this.ungroupSelection():"F2"===f||b.event&&"F2"===b.event.key?this.canEditTextBlock()&&this.editTextBlock():"ContextMenu"===f||b.event&&"ContextMenu"===b.event.key?this.canShowContextMenu()&&this.showContextMenu():b.bubbles=!0:this.canCopySelection()&&this.copySelection()};
Lk.prototype.doKeyUp=function(){this.diagram.lastInput.bubbles=!0};Lk.prototype.stopCommand=function(){var a=this.diagram,b=a.currentTool;b instanceof Pa&&a.allowSelect&&a.clearSelection();null!==b&&b.doCancel()};Lk.prototype.canStopCommand=function(){return!0};
Lk.prototype.selectAll=function(){var a=this.diagram;a.N();try{a.currentCursor="wait";a.S("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.S("ChangedSelection",a.selection),a.currentCursor=""}};Lk.prototype.canSelectAll=function(){return this.diagram.allowSelect};
Lk.prototype.deleteSelection=function(){var a=this.diagram;try{a.currentCursor="wait";a.S("ChangingSelection",a.selection);a.xa("Delete");a.S("SelectionDeleting",a.selection);for(var b=new G,c=a.selection.iterator;c.next();)Mk(b,c.value,!0,this.deletesTree?Infinity:0,this.deletesConnectedLinks?null:!1,function(a){return a.canDelete()});a.Rs(b,!0);a.S("SelectionDeleted",b)}finally{a.Xa("Delete"),a.S("ChangedSelection",a.selection),a.currentCursor=""}};
Lk.prototype.canDeleteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowDelete||0===a.selection.count?!1:!0};Lk.prototype.copySelection=function(){var a=this.diagram,b=new G;for(a=a.selection.iterator;a.next();)Mk(b,a.value,!0,this.copiesTree?Infinity:0,this.copiesConnectedLinks,function(a){return a.canCopy()});this.copyToClipboard(b)};Lk.prototype.canCopySelection=function(){var a=this.diagram;return a.allowCopy&&a.allowClipboard&&0!==a.selection.count?!0:!1};
Lk.prototype.cutSelection=function(){this.copySelection();this.deleteSelection()};Lk.prototype.canCutSelection=function(){var a=this.diagram;return!a.isReadOnly&&!a.isModelReadOnly&&a.allowCopy&&a.allowDelete&&a.allowClipboard&&0!==a.selection.count?!0:!1};
Lk.prototype.copyToClipboard=function(a){var b=this.diagram,c=null;if(null===a)ui=null,Bi="";else{c=b.model;var d=!1,e=!1,f=null;try{c.fm()&&(d=c.Uj,c.Uj=this.copiesParentKey),c.dk()&&(e=c.Tj,c.Tj=this.copiesGroupKey),f=b.Vj(a,null,!0)}finally{c.fm()&&(c.Uj=d),c.dk()&&(c.Tj=e),c=new E,c.addAll(f),ui=c,Bi=b.model.dataFormat}}b.S("ClipboardChanged",c)};
Lk.prototype.pasteFromClipboard=function(){var a=new G,b=ui;if(null===b)return a;var c=this.diagram;if(Bi!==c.model.dataFormat)return a;var d=c.model,e=!1,f=!1,g=null;try{d.fm()&&(e=d.Uj,d.Uj=this.copiesParentKey),d.dk()&&(f=d.Tj,d.Tj=this.copiesGroupKey),g=c.Vj(b,c,!1)}finally{for(d.fm()&&(d.Uj=e),d.dk()&&(d.Tj=f),b=g.iterator;b.next();)c=b.value,d=b.key,c.location.u()||(d.location.u()?c.location=d.location:!c.position.u()&&d.position.u()&&(c.position=d.position)),a.add(c)}return a};
Lk.prototype.pasteSelection=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.currentCursor="wait";b.S("ChangingSelection",b.selection);b.xa("Paste");var c=this.pasteFromClipboard();0<c.count&&b.clearSelection(!0);for(var d=c.iterator;d.next();)d.value.isSelected=!0;if(null!==a){var e=b.computePartsBounds(b.selection);if(e.u()){var f=this.computeEffectiveCollection(b.selection,b.pn);jf(b,f,new K(a.x-e.centerX,a.y-e.centerY),b.pn,!1)}}b.S("ClipboardPasted",c)}finally{b.Xa("Paste"),b.S("ChangedSelection",
b.selection),b.currentCursor=""}};Lk.prototype.canPasteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowClipboard||null===ui||0===ui.count||Bi!==a.model.dataFormat?!1:!0};Lk.prototype.undo=function(){this.diagram.undoManager.undo()};Lk.prototype.canUndo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canUndo()};Lk.prototype.redo=function(){this.diagram.undoManager.redo()};
Lk.prototype.canRedo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canRedo()};Lk.prototype.decreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);var b=this.diagram;b.autoScale===nh&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};Lk.prototype.canDecreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);var b=this.diagram;if(b.autoScale!==nh)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};
Lk.prototype.increaseZoom=function(a){void 0===a&&(a=this.zoomFactor);var b=this.diagram;b.autoScale===nh&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};Lk.prototype.canIncreaseZoom=function(a){void 0===a&&(a=this.zoomFactor);var b=this.diagram;if(b.autoScale!==nh)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};Lk.prototype.resetZoom=function(a){void 0===a&&(a=this.defaultScale);var b=this.diagram;a<b.minScale||a>b.maxScale||(b.scale=a)};
Lk.prototype.canResetZoom=function(a){void 0===a&&(a=this.defaultScale);var b=this.diagram;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};
Lk.prototype.zoomToFit=function(){var a=this.diagram,b=a.animationManager;b.sc();a.redraw();var c=a.position,d=a.scale;hh(b,"Zoom To Fit");this.isZoomToFitRestoreEnabled&&d===this.zu&&!isNaN(this.Xt)&&a.documentBounds.A(this.yu)?(a.scale=this.Xt,a.position=this.Tw,this.zu=NaN,this.yu=hc):(this.Xt=d,this.Tw=c.copy(),a.zoomToFit(),this.zu=a.scale,this.yu=a.documentBounds.copy());jh(b)};Lk.prototype.canZoomToFit=function(){return this.diagram.allowZoom};
Lk.prototype.scrollToPart=function(a){void 0===a&&(a=null);var b=this.diagram;b.Ta();if(null===a){try{null!==this.eg&&(this.eg.next()?a=this.eg.value:this.eg=null)}catch(k){this.eg=null}null===a&&(0<b.highlighteds.count?this.eg=b.highlighteds.iterator:0<b.selection.count&&(this.eg=b.selection.iterator),null!==this.eg&&this.eg.next()&&(a=this.eg.value))}if(null!==a){var c=b.animationManager;hh(c,"Scroll To Part");var d=this.scrollToPartPause;if(0<d){var e=Nk(this,a,[a]);if(1===e.length)b.xa(),b.ls(a.actualBounds),
b.Xa("Scroll To Part");else{var f=function(){b.xa();for(var a=e.pop();0<e.length&&a instanceof W&&a.isTreeExpanded&&(!(a instanceof U)||a.isSubGraphExpanded);)a=e.pop();0<e.length?(a instanceof V&&b.Nv(a.actualBounds),a instanceof W&&!a.isTreeExpanded&&(a.isTreeExpanded=!0),a instanceof U&&!a.isSubGraphExpanded&&(a.isSubGraphExpanded=!0)):(a instanceof V&&b.ls(a.actualBounds),b.mm("LayoutCompleted",g));b.Xa("Scroll To Part")},g=function(){ua(f,(c.isEnabled?c.duration:0)+d)};b.Nj("LayoutCompleted",
g);f()}}else{var h=b.position.copy();b.ls(a.actualBounds);h.Ua(b.position)&&c.sc()}}};
function Nk(a,b,c){if(b.isVisible())return c;if(b instanceof ze)Nk(a,b.adornedPart,c);else if(b instanceof T){var d=b.fromNode;null!==d&&Nk(a,d,c);b=b.toNode;null!==b&&Nk(a,b,c)}else b instanceof W&&(d=b.labeledLink,null!==d&&Nk(a,d,c),d=b.rg(),null!==d&&(d.isTreeExpanded||d.wasTreeExpanded||c.push(d),Nk(a,d,c))),b=b.containingGroup,null!==b&&(b.isSubGraphExpanded||b.wasSubGraphExpanded||c.push(b),Nk(a,b,c));return c}
Lk.prototype.canScrollToPart=function(a){void 0===a&&(a=null);if(null!==a&&!(a instanceof V))return!1;a=this.diagram;return 0===a.selection.count&&0===a.highlighteds.count?!1:a.allowHorizontalScroll&&a.allowVerticalScroll};
Lk.prototype.collapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.xa("Collapse Tree");hh(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 W&&e.isTreeExpanded&&(e.collapseTree(),c.add(e))}b.S("TreeCollapsed",c)}finally{b.Xa("Collapse Tree")}};
Lk.prototype.canCollapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a){if(!(a instanceof W&&a.isTreeExpanded))return!1;if(0<a.Yp().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof W&&b.isTreeExpanded&&0<b.Yp().count)return!0;return!1};
Lk.prototype.expandTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.xa("Expand Tree");hh(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 W&&!e.isTreeExpanded&&(e.expandTree(),c.add(e))}b.S("TreeExpanded",c)}finally{b.Xa("Expand Tree")}};
Lk.prototype.canExpandTree=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a){if(!(a instanceof W)||a.isTreeExpanded)return!1;if(0<a.Yp().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof W&&!b.isTreeExpanded&&0<b.Yp().count)return!0;return!1};
Lk.prototype.groupSelection=function(){var a=this.diagram,b=a.model;if(b.ek()){var c=this.archetypeGroupData;if(null!==c){var d=null;try{a.currentCursor="wait";a.S("ChangingSelection",a.selection);a.xa("Group");for(var e=new E,f=a.selection.iterator;f.next();){var g=f.value;g.Nc()&&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.Jd(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.Jd(n)){e=!0;break}if(e)n=n.containingGroup;else break}if(c instanceof U)og(c),d=c.copy(),null!==d&&a.add(d);else if(b.mv(c)){var r=b.copyNodeData(c);za(r)&&(b.sf(r),d=a.Gi(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.S("SelectionGrouped",d)}finally{a.Xa("Group"),a.S("ChangedSelection",a.selection),
a.currentCursor=""}}}};Lk.prototype.canGroupSelection=function(){var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowGroup||!a.model.ek()||null===this.archetypeGroupData)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.Nc()&&b.canGroup())return!0}return!1};
function Ok(a){var b=Ea();for(a=a.iterator;a.next();){var c=a.value;c instanceof T||b.push(c)}a=new G;c=b.length;for(var d=0;d<c;d++){for(var e=b[d],f=!0,g=0;g<c;g++)if(e.Jd(b[g])){f=!1;break}f&&a.add(e)}Ia(b);return a}
Lk.prototype.isValidMember=function(a,b){if(null===b||a===b||b instanceof T)return!1;if(null!==a){if(a===b||a.Jd(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};
Lk.prototype.ungroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.model;if(c.ek())try{b.currentCursor="wait";b.S("ChangingSelection",b.selection);b.xa("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 U&&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.pa(l.data):void 0;g.addAll(k.memberParts);
for(var n=g.iterator;n.next();){var p=n.value;p.isSelected=!0;if(!(p instanceof T)){var r=p.data;null!==r?c.uq(r,m):p.containingGroup=l}}b.remove(k)}}b.S("SelectionUngrouped",d,g)}finally{b.Xa("Ungroup"),b.S("ChangedSelection",b.selection),b.currentCursor=""}};
Lk.prototype.canUngroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly||b.isModelReadOnly||!b.allowDelete||!b.allowUngroup||!b.model.ek())return!1;if(null!==a){if(!(a instanceof U))return!1;if(a.canUngroup())return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof U&&b.canUngroup())return!0;return!1};
Lk.prototype.addTopLevelParts=function(a,b){var c=!0;for(a=Ok(a).iterator;a.next();){var d=a.value;null!==d.containingGroup&&(!b||this.isValidMember(null,d)?d.containingGroup=null:c=!1)}return c};
Lk.prototype.collapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.xa("Collapse SubGraph");hh(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 U&&e.isSubGraphExpanded&&(e.collapseSubGraph(),c.add(e))}b.S("SubGraphCollapsed",c)}finally{b.Xa("Collapse SubGraph")}};
Lk.prototype.canCollapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof U&&a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof U&&b.isSubGraphExpanded)return!0;return!1};
Lk.prototype.expandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.xa("Expand SubGraph");hh(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 U&&!e.isSubGraphExpanded&&(e.expandSubGraph(),c.add(e))}b.S("SubGraphExpanded",c)}finally{b.Xa("Expand SubGraph")}};
Lk.prototype.canExpandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof U&&!a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof U&&!b.isSubGraphExpanded)return!0;return!1};
Lk.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.$l(function(a){return a instanceof Mg&&a.editable})}null!==a&&(b.currentTool=null,c.textBlock=a,b.currentTool=c)}};
Lk.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 Mg))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.$l(function(a){return a instanceof Mg&&a.editable}),null!==a))return!0;return!1};
Lk.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.da(yc):b.viewportBounds.$(d.documentPoint)||(e=b.viewportBounds,e=new K(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;Ig(c,!1,a)}};
Lk.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};
Lk.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.pn);d=new H;if(null===a)return d;for(var f=a.iterator;f.next();)Dj(c,d,f.value,e,b);if(null!==c.draggedLink&&b.dragsLink)return d;for(f=a.iterator;f.next();)a=f.value,a instanceof T&&(b=a.fromNode,null===b||d.contains(b)?(b=a.toNode,null===b||d.contains(b)||d.remove(a)):d.remove(a));return d};
na.Object.defineProperties(Lk.prototype,{diagram:{get:function(){return this.D}},copiesClipboardData:{get:function(){return this.o},set:function(a){this.o=a}},copiesConnectedLinks:{get:function(){return this.C},set:function(a){this.C=a}},deletesConnectedLinks:{get:function(){return this.Ma},set:function(a){this.Ma=a}},copiesTree:{get:function(){return this.Ba},
set:function(a){this.Ba=a}},deletesTree:{get:function(){return this.Qb},set:function(a){this.Qb=a}},copiesParentKey:{get:function(){return this.wa},set:function(a){this.wa=a}},copiesGroupKey:{get:function(){return this.K},set:function(a){this.K=a}},archetypeGroupData:{get:function(){return this.j},set:function(a){this.j=a}},memberValidation:{get:function(){return this.ki},
set:function(a){this.ki=a}},defaultScale:{get:function(){return this.diagram.defaultScale},set:function(a){this.diagram.defaultScale=a}},zoomFactor:{get:function(){return this.tc},set:function(a){1<a||B("zoomFactor must be larger than 1.0, not: "+a);this.tc=a}},isZoomToFitRestoreEnabled:{get:function(){return this.Gb},set:function(a){this.Gb=a}},scrollToPartPause:{get:function(){return this.Rb},
set:function(a){this.Rb=a}}});Lk.className="CommandHandler";ti=function(){return new Lk};
function Y(){Va(this);this.G=4225027;this.mb=1;this.bg=null;this.na="";this.hd=this.Ub=null;this.ja=(new K(NaN,NaN)).freeze();this.Uc=Nb;this.Zf=Hb;this.Yf=Mb;this.ub=new od;this.Nh=new od;this.Bb=null;this.sa=this.Sk=1;this.yb=0;this.Ee=Pk;this.Vg=pc;this.mc=(new N(NaN,NaN,NaN,NaN)).freeze();this.wb=(new N(NaN,NaN,NaN,NaN)).freeze();this.xc=(new N(0,0,NaN,NaN)).freeze();this.P=this.Po=this.Qo=null;this.xk=this.xb=Wc;this.ap=0;this.bp=1;this.Cg=0;this.Zm=1;this.tp=null;this.hp=-Infinity;this.Bl=0;
this.Cl=zb;this.Dl=Rf;this.Th="";this.fb=this.O=null;this.Dk=-1;this.Fl=this.$a=this.Sh=this.Jl=null;this.Jr=pg;this.ep=this.xg=this.Dj=null}var qd,pg,rg,Pk,Qk,Rk,Sk,Tk,Uk,Vk;
Y.prototype.cloneProtected=function(a){a.G=this.G|6144;a.mb=this.mb;a.na=this.na;a.Ub=this.Ub;a.hd=this.hd;a.xg=this.xg;a.ja.assign(this.ja);a.Uc=this.Uc.I();a.Zf=this.Zf.I();a.Yf=this.Yf.I();null!==this.Bb?a.Bb=this.Bb.copy():a.Bb=null;a.sa=this.sa;a.yb=this.yb;a.Ee=this.Ee;a.Vg=this.Vg.I();a.mc.assign(this.mc);a.wb.assign(this.wb);a.xc.assign(this.xc);a.Po=this.Po;null!==this.P&&(a.P=this.P.copy());a.xb=this.xb.I();a.xk=this.xk.I();a.ap=this.ap;a.bp=this.bp;a.Cg=this.Cg;a.Zm=this.Zm;a.tp=this.tp;
a.hp=this.hp;a.Bl=this.Bl;a.Cl=this.Cl.I();a.Dl=this.Dl;a.Th=this.Th;null!==this.O&&(a.O=this.O.copy());a.fb=this.fb;a.Dk=this.Dk;null!==this.Sh&&(a.Sh=Ba(this.Sh));null!==this.$a&&(a.$a=this.$a.copy());a.Fl=this.Fl};Y.prototype.wx=function(a){var b=this.Sh;if(Aa(b))for(var c=0;c<b.length;c++){if(b[c]===a)return}else this.Sh=b=[];b.push(a)};Y.prototype.wf=function(a){a.Qo=null;a.Dj=null;a.s()};
Y.prototype.clone=function(){var a=new this.constructor;this.cloneProtected(a);if(null!==this.Sh)for(var b=0;b<this.Sh.length;b++){var c=this.Sh[b];a[c]=this[c]}return a};Y.prototype.copy=function(){return this.clone()};t=Y.prototype;t.gb=function(a){a.classType===T?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 Ja(this.constructor)+"#"+ib(this)};
function Wk(a){null===a.O&&(a.O=new Xk)}t.Lc=function(){if(null===this.P){var a=new Yk;a.Pg=rc;a.th=rc;a.Ng=10;a.rh=10;a.Og=0;a.sh=0;this.P=a}};
t.Wa=function(a,b,c,d,e,f,g){var h=this.part;if(null!==h&&(h.qk(a,b,c,d,e,f,g),c===this&&a===ge&&Zk(this)&&$k(this,h,b),f=this.diagram,null===this.xg||null===f||!f.Oi||f.undoManager.isUndoingRedoing||f.currentTool!==f.toolManager||f.animationManager.Um||(a=this.xg.get(b),null!==a&&f.animationManager.isEnabled&&!f.animationManager.isTicking&&(null===this.ep&&(this.ep=new H),g=0===f.undoManager.transactionLevel,a.startCondition===Yh?g=!0:a.startCondition===$h&&(g=!1),g?(f=new gh,Zh(a,f),g=this.ep.get(a),
null!==g&&g.stop(),this.ep.add(a,f),f.wu=this,f.ox=a,f.add(this,b,d,e),f.start()):(hh(f.animationManager,"Trigger"),f.animationManager.defaultAnimation.add(this,b,d,e)))),this instanceof X&&c===h&&0!==(h.G&16777216)&&null!==h.data))for(c=this.U.l,d=c.length,e=0;e<d;e++)h=c[e],h instanceof X&&vj(h,function(a){null!==a.data&&0!==(a.G&16777216)&&a.Fa(b)})};
function $k(a,b,c){var d=a.Ch();if(null!==d)for(var e=a.fb.iterator;e.next();){var f=e.value,g=null;if(null!==f.sourceName){g=al(f,d,a);if(null===g)continue;f.Aq(a,g,c,null)}else if(f.isToModel){var h=b.diagram;null===h||h.skipsModelSourceBindings||f.Aq(a,h.model.modelData,c,d)}else{h=d.data;if(null===h)continue;var k=b.diagram;null===k||k.skipsModelSourceBindings||f.Aq(a,h,c,d)}g===a&&(h=d.ps(f.Xi),null!==h&&f.cw(h,g,c))}}t.ps=function(a){return this.Dk===a?this:null};
t.g=function(a,b,c){this.Wa(ge,a,this,b,c)};t.xe=function(a,b,c,d){var e=this.mc;e.h(a,b,c,d);if(1!==this.sa||0!==this.yb){null===this.Bb&&(this.Bb=new od);var f=this.Bb;f.reset();this.np(f,a,b,c,d);f.xq(e)}};function bl(a,b,c,d){if(!1===a.pickable)return!1;d.multiply(a.transform);return c?a.Mc(b,d):a.Ah(b,d)}
t.Sx=function(a,b,c){if(!1===this.pickable)return!1;var d=this.naturalBounds;b=a.xf(b);return c?vb(a.x,a.y,0,0,0,d.height)<=b||vb(a.x,a.y,0,d.height,d.width,d.height)<=b||vb(a.x,a.y,d.width,d.height,d.width,0)<=b||vb(a.x,a.y,d.width,0,0,0)<=b:a.pd(0,0)<=b&&a.pd(0,d.height)<=b&&a.pd(d.width,0)<=b&&a.pd(d.width,d.height)<=b};t.ie=function(){return!0};
t.$=function(a){var b=K.alloc();b.assign(a);this.transform.Aa(b);var c=this.actualBounds;if(!c.u())return K.free(b),!1;var d=this.diagram;if(null!==d&&d.Wt){var e=d.cm("extraTouchThreshold"),f=d.cm("extraTouchArea"),g=f/2,h=this.naturalBounds;d=this.Af()*d.scale;var k=1/d;if(h.width*d<e&&h.height*d<e)return a=bc(c.x-g*k,c.y-g*k,c.width+f*k,c.height+f*k,b.x,b.y),K.free(b),a}e=!1;if(this instanceof ze||this instanceof xf?bc(c.x-5,c.y-5,c.width+10,c.height+10,b.x,b.y):c.$(b))this.$a&&!this.$a.$(b)?e=
!1:null!==this.hd&&c.$(b)?e=!0:null!==this.Ub&&this.xc.$(a)?e=!0:e=this.Bh(a);K.free(b);return e};t.Bh=function(a){var b=this.naturalBounds;return bc(0,0,b.width,b.height,a.x,a.y)};t.Ge=function(a){if(0===this.angle)return this.actualBounds.Ge(a);var b=this.naturalBounds;b=N.allocAt(0,0,b.width,b.height);var c=this.transform,d=!1,e=K.allocAt(a.x,a.y);b.$(c.Hd(e))&&(e.h(a.x,a.bottom),b.$(c.Hd(e))&&(e.h(a.right,a.bottom),b.$(c.Hd(e))&&(e.h(a.right,a.y),b.$(c.Hd(e))&&(d=!0))));K.free(e);N.free(b);return d};
t.Ah=function(a,b){if(void 0===b)return a.Ge(this.actualBounds);var c=this.naturalBounds,d=!1,e=K.allocAt(0,0);a.$(b.Aa(e))&&(e.h(0,c.height),a.$(b.Aa(e))&&(e.h(c.width,c.height),a.$(b.Aa(e))&&(e.h(c.width,0),a.$(b.Aa(e))&&(d=!0))));K.free(e);return d};
t.Mc=function(a,b){if(void 0===b&&(b=this.transform,0===this.angle))return a.Mc(this.actualBounds);var c=this.naturalBounds,d=K.allocAt(0,0),e=K.allocAt(0,c.height),f=K.allocAt(c.width,c.height),g=K.allocAt(c.width,0),h=!1;if(a.$(b.Aa(d))||a.$(b.Aa(e))||a.$(b.Aa(f))||a.$(b.Aa(g)))h=!0;else{c=N.allocAt(0,0,c.width,c.height);var k=K.allocAt(a.x,a.y);c.$(b.Hd(k))?h=!0:(k.h(a.x,a.bottom),c.$(b.Hd(k))?h=!0:(k.h(a.right,a.bottom),c.$(b.Hd(k))?h=!0:(k.h(a.right,a.y),c.$(b.Hd(k))&&(h=!0))));K.free(k);N.free(c);
!h&&(M.zs(a,d,e)||M.zs(a,e,f)||M.zs(a,f,g)||M.zs(a,g,d))&&(h=!0)}K.free(d);K.free(e);K.free(f);K.free(g);return h};t.da=function(a,b){void 0===b&&(b=new K);if(a instanceof O){var c=this.naturalBounds;b.h(a.x*c.width+a.offsetX,a.y*c.height+a.offsetY)}else b.set(a);this.ee.Aa(b);return b};
t.Li=function(a){void 0===a&&(a=new N);var b=this.naturalBounds,c=this.ee,d=K.allocAt(0,0).transform(c);a.h(d.x,d.y,0,0);d.h(b.width,0).transform(c);ac(a,d.x,d.y,0,0);d.h(b.width,b.height).transform(c);ac(a,d.x,d.y,0,0);d.h(0,b.height).transform(c);ac(a,d.x,d.y,0,0);K.free(d);return a};t.Ki=function(){var a=this.ee;1===a.m11&&0===a.m12?a=0:(a=180*Math.atan2(a.m12,a.m11)/Math.PI,0>a&&(a+=360));return a};
t.Af=function(){if(0!==(this.G&4096)===!1)return this.Sk;var a=this.sa;return null!==this.panel?a*this.panel.Af():a};t.vs=function(a,b){void 0===b&&(b=new K);b.assign(a);this.ee.Hd(b);return b};t.ws=function(a,b,c){return this.ak(a.x,a.y,b.x,b.y,c)};
t.ak=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,M.Cf(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=M.Cf(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!==ij(this)){var e=this.Vg,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 xf&&(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(cl(this,!0)){case pg:g=e=0;h&&(b=a=Infinity);
break;case qd:isFinite(a)&&a>c&&(e=a);isFinite(b)&&b>d&&(g=b);break;case Qk:isFinite(a)&&a>c&&(e=a);g=0;h&&(b=Infinity);break;case Rk: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.mc.ea();this.im(a,b,c,d);this.mc.freeze();this.mc.u()||B("Non-real measuredBounds has been set. Object "+this+", measuredBounds: "+this.mc.toString());dj(this,!1)}};Y.prototype.im=function(){};Y.prototype.Qi=function(){return!1};
Y.prototype.arrange=function(a,b,c,d,e){this.dl();var f=N.alloc();f.assign(this.wb);this.wb.ea();!1===jj(this)?this.wb.h(a,b,c,d):this.zh(a,b,c,d);this.wb.freeze();void 0===e?this.$a=null:this.$a=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.xc,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 Mg&&(a=this.naturalBounds,
this.vr>a.height||this.rb>a.width)))c=!0;this.G=c?this.G|256:this.G&-257;this.wb.u()||B("Non-real actualBounds has been set. Object "+this+", actualBounds: "+this.wb.toString());this.jm(f,this.wb);dl(this,!1);N.free(f)};t=Y.prototype;t.zh=function(){};
function el(a,b,c,d,e){a.wb.h(b,c,d,e);if(!a.desiredSize.u()){var f=a.mc;c=a.Vg;b=c.right+c.left;var g=c.top+c.bottom;c=f.width+b;f=f.height+g;d+=b;e+=g;b=cl(a,!0);c===d&&f===e&&(b=pg);switch(b){case pg:if(c>d||f>e)dj(a,!0),a.measure(c>d?d:c,f>e?e:f,0,0);break;case qd:dj(a,!0);a.measure(d,e,0,0);break;case Qk:dj(a,!0);a.measure(d,f,0,0);break;case Rk:dj(a,!0),a.measure(c,e,0,0)}}}
t.jm=function(a,b){var c=this.part;null!==c&&null!==c.diagram&&(c.selectionObject!==this&&c.resizeObject!==this&&c.rotateObject!==this||fl(c,!0),this.N(),Ub(a,b)||(c.Gh(),this.Eo(c)))};t.Eo=function(a){null!==this.portId&&(fl(a,!0),a instanceof W&&gl(a,this))};
t.pc=function(a,b){if(this.visible){var c=this.opacity;if(0!==c){var d=this instanceof X&&(this.type===X.TableRow||this.type===X.TableColumn),e=this.wb;if(d||0!==e.width&&0!==e.height&&!isNaN(e.x)&&!isNaN(e.y)){var f=1;1!==c&&(f=a.globalAlpha,a.globalAlpha=f*c);if(d){e=this.wb;d=this.xc;var g=this.hd,h=this.Ub;null===g&&null===h||a.Ed();null!==g&&(di(this,a,g,!0,!0,d,e),g instanceof hl&&g.type===il?(a.beginPath(),a.rect(e.x,e.y,e.width,e.height),a.yf(g)):a.fillRect(e.x,e.y,e.width,e.height));null!==
h&&(di(this,a,h,!0,!1,d,e),h instanceof hl&&h.type===il?(a.beginPath(),a.rect(e.x,e.y,e.width,e.height),a.yf(h)):a.fillRect(e.x,e.y,e.width,e.height));this.Ei(a,b)}else if(!this.Nx(a,b)){this instanceof T&&this.hk(!1);d=this.transform;g=this.panel;0!==(this.G&4096)===!0&&jl(this);var k=this.part;h=!1;var l=0;if(k&&b.Ie("drawShadows")&&(h=k.isShadowed)){var m=k.shadowOffset;l=Math.max(m.y,m.x)*b.scale*b.ec}m=this.Qi();var n;if(!(n=b.pj||!m)){var p=this.naturalBounds;n=this.Nh;var r=n.m11,q=n.m21,u=
n.dx,w=n.m12,v=n.m22,y=n.dy,z,A=z=0;n=z*r+A*q+u;var C=z*w+A*v+y;z=p.width+l;A=0;var F=z*r+A*q+u;z=z*w+A*v+y;A=Math.min(n,F);var R=Math.min(C,z);var J=Math.max(n+0,F)-A;var S=Math.max(C+0,z)-R;n=A;C=R;z=p.width+l;A=p.height+l;F=z*r+A*q+u;z=z*w+A*v+y;A=Math.min(n,F);R=Math.min(C,z);J=Math.max(n+J,F)-A;S=Math.max(C+S,z)-R;n=A;C=R;z=0;A=p.height+l;F=z*r+A*q+u;z=z*w+A*v+y;A=Math.min(n,F);R=Math.min(C,z);J=Math.max(n+J,F)-A;S=Math.max(C+S,z)-R;n=A;C=R;l=b.viewportBounds;p=l.x;r=l.y;n=!(n>l.width+p||p>J+
n||C>l.height+r||r>S+C)}if(n){n=0!==(this.G&256);a.clipInsteadOfFill&&(n=!1);this instanceof Mg&&(a.font=this.font);if(n){C=g.ie()?g.naturalBounds:g.actualBounds;null!==this.$a?(p=this.$a,J=p.x,S=p.y,l=p.width,p=p.height):(J=Math.max(e.x,C.x),S=Math.max(e.y,C.y),l=Math.min(e.right,C.right)-J,p=Math.min(e.bottom,C.bottom)-S);if(J>e.width+e.x||e.x>C.width+C.x){1!==c&&(a.globalAlpha=f);return}a.save();a.beginPath();a.rect(J,S,l,p);a.clip()}if(m){if(!k.isVisible()){1!==c&&(a.globalAlpha=f);return}h&&
(C=k.shadowOffset,a.Uv(C.x*b.scale*b.ec,C.y*b.scale*b.ec,k.shadowBlur),kl(a),a.shadowColor=k.shadowColor)}h&&!0===this.shadowVisible?kl(a):h&&!1===this.shadowVisible&&ll(a);k=this.naturalBounds;null!==this.hd&&(a.Ed(),di(this,a,this.hd,!0,!0,k,e),this.hd instanceof hl&&this.hd.type===il?(a.beginPath(),a.rect(e.x,e.y,e.width,e.height),a.yf(this.hd)):a.fillRect(e.x,e.y,e.width,e.height));a.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);h&&(null!==g&&0!==(g.G&512)||null!==g&&(g.type===X.Auto||g.type===
X.Spot)&&g.pb()!==this)&&null===this.shadowVisible&&ll(a);null!==this.Ub&&(a.Ed(),ml(this,a,k,e));h&&(null!==this.Ub||null!==this.hd||null!==g&&0!==(g.G&512)||null!==g&&(g.type===X.Auto||g.type===X.Spot)&&g.pb()!==this)?(nl(this,!0),null===this.shadowVisible&&ll(a)):nl(this,!1);this.Ei(a,b);h&&0!==(this.G&512)===!0&&kl(a);m&&h&&ll(a);n&&(a.restore(),a.Ic(this instanceof X));d.Cs()||(b=1/(d.m11*d.m22-d.m12*d.m21),a.transform(d.m22*b,-d.m12*b,-d.m21*b,d.m11*b,b*(d.m21*d.dy-d.m22*d.dx),b*(d.m12*d.dx-
d.m11*d.dy)))}}1!==c&&(a.globalAlpha=f)}}}};function ml(a,b,c,d){var e=a.naturalBounds,f=0,g=0,h=e.width;e=e.height;var k=a.Qw();a instanceof xf&&(e=a.ma.bounds,f=e.x,g=e.y,h=e.width,e=e.height);di(a,b,a.Ub,!0,!1,c,d);a.Ub instanceof hl&&a.Ub.type===il?(b.beginPath(),b.rect(f-k/2,g-k/2,h+k,e+k),b.yf(a.Ub)):b.fillRect(f-k/2,g-k/2,h+k,e+k)}t.Nx=function(){return!1};t.Ei=function(){};
function di(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===ol)d?b.fillStyle=c.color:b.strokeStyle=c.color;else{var l=0;a instanceof xf&&(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 pl)&&c.me&&(c.type===ql||c.Gk===h&&c.zt===k))var m=c.me;else{var n=0,p=0,r=0,q=0,u=0,w=0;w=u=0;e?(u=g.x,w=g.y):d||(u-=l/2,w-=l/2);n=c.start.x*h+c.start.offsetX;p=c.start.y*k+c.start.offsetY;r=c.end.x*h+
c.end.offsetX;q=c.end.y*k+c.end.offsetY;n+=u;r+=u;p+=w;q+=w;if(c.type===rl)m=b.createLinearGradient(n,p,r,q);else if(c.type===il)w=isNaN(c.endRadius)?Math.max(h,k)/2:c.endRadius,isNaN(c.startRadius)?(u=0,w=Math.max(h,k)/2):u=c.startRadius,m=b.createRadialGradient(n,p,u,r,q,w);else if(c.type===ql)try{m=b.createPattern(c.pattern,"repeat")}catch(y){m=null}if(c.type!==ql&&(e=c.colorStops,null!==e))for(e=e.iterator;e.next();)m.addColorStop(e.key,e.value);if(f&&(c.me=m,null!==m&&(c.Gk=h,c.zt=k),null===
m&&c.type===ql&&-1!==c.Gk)){c.Gk=-1;var v=a.diagram;null!==v&&-1===c.Gk&&ua(function(){v.redraw()},600)}}d?b.fillStyle=m:b.strokeStyle=m}}}t.sg=function(a){if(a instanceof X)a:{if(this!==a&&null!==a)for(var b=this.panel;null!==b;){if(b===a){a=!0;break a}b=b.panel}a=!1}else a=!1;return a};t.Ff=function(){if(!this.visible)return!1;var a=this.panel;return null!==a?a.Ff():!0};t.Ef=function(){for(var a=this instanceof X?this:this.panel;null!==a&&a.isEnabled;)a=a.panel;return null===a};
function jl(a){if(0!==(a.G&2048)===!0){var b=a.ub;b.reset();if(!a.wb.u()||!a.mc.u()){sl(a,!1);return}b.translate(a.wb.x-a.mc.x,a.wb.y-a.mc.y);if(1!==a.scale||0!==a.angle){var c=a.naturalBounds;a.np(b,c.x,c.y,c.width,c.height)}sl(a,!1);tl(a,!0)}0!==(a.G&4096)===!0&&(b=a.panel,null===b?(a.Nh.set(a.ub),a.Sk=a.scale,tl(a,!1)):null!==b.ee&&(c=a.Nh,c.reset(),b.ie()?c.multiply(b.Nh):null!==b.panel&&c.multiply(b.panel.Nh),c.multiply(a.ub),a.Sk=a.scale*b.Sk,tl(a,!1)))}
t.np=function(a,b,c,d,e){1!==this.sa&&a.scale(this.sa);if(0!==this.yb){var f=K.alloc();f.Ui(b,c,d,e,yc);a.rotate(this.yb,f.x,f.y);K.free(f)}};t.s=function(a){if(!ij(this)){void 0===a&&(a=!1);dj(this,!0);dl(this,!0);var b=this.panel;null===b||a||b.s()}};t.ck=function(){ij(this)||(dj(this,!0),dl(this,!0))};function ul(a){if(!jj(a)){var b=a.panel;null!==b?b.s():a.Qi()&&(b=a.diagram,null!==b&&(b.se.add(a),a instanceof W&&a.rd(),b.Fb()));dl(a,!0)}}
t.dl=function(){0!==(this.G&2048)===!1&&(sl(this,!0),tl(this,!0))};t.kv=function(){tl(this,!0)};t.N=function(){var a=this.part;null!==a&&a.N()};
function cl(a,b){var c=a.stretch,d=a.panel;if(null!==d&&d.type===X.Table)return vl(a,d.getRowDefinition(a.row),d.getColumnDefinition(a.column),b);if(null!==d&&d.type===X.Auto&&d.pb()===a)return wl(a,qd,b);if(c===Pk){if(null!==d){if(d.type===X.Spot&&d.pb()===a)return wl(a,qd,b);c=d.defaultStretch;return c===Pk?wl(a,pg,b):wl(a,c,b)}return wl(a,pg,b)}return wl(a,c,b)}
function vl(a,b,c,d){var e=a.stretch;if(e!==Pk)return wl(a,e,d);var f=e=null;switch(b.stretch){case Rk:f=!0;break;case qd:f=!0}switch(c.stretch){case Qk:e=!0;break;case qd:e=!0}b=a.panel.defaultStretch;null===e&&(e=b===Qk||b===qd);null===f&&(f=b===Rk||b===qd);return!0===e&&!0===f?wl(a,qd,d):!0===e?wl(a,Qk,d):!0===f?wl(a,Rk,d):wl(a,pg,d)}
function wl(a,b,c){if(c)return b;if(b===pg)return pg;c=a.desiredSize;if(c.u())return pg;a=a.angle;if(!isNaN(c.width))if(90!==a&&270!==a){if(b===Qk)return pg;if(b===qd)return Rk}else{if(b===Rk)return pg;if(b===qd)return Qk}if(!isNaN(c.height))if(90!==a&&270!==a){if(b===Rk)return pg;if(b===qd)return Qk}else{if(b===Qk)return pg;if(b===qd)return Rk}return b}function nl(a,b){a.G=b?a.G|512:a.G&-513}function Zk(a){return 0!==(a.G&1024)}function xl(a,b){a.G=b?a.G|1024:a.G&-1025}
function sl(a,b){a.G=b?a.G|2048:a.G&-2049}function tl(a,b){a.G=b?a.G|4096:a.G&-4097}function ij(a){return 0!==(a.G&8192)}function dj(a,b){a.G=b?a.G|8192:a.G&-8193}function jj(a){return 0!==(a.G&16384)}function dl(a,b){a.G=b?a.G|16384:a.G&-16385}t.Si=function(a){this.bg=a};t.Ws=function(){};t.Rv=function(a){this.ja=a;ul(this);return!0};t.ym=function(a,b){if(this.ja.x!==a||this.ja.y!==b)this.ja.h(a,b),this.dl()};t.Qw=function(){return 0};
function yl(a){var b=a.part;if(b instanceof W&&(null!==a.portId||a===b.port)){var c=b.diagram;null===c||c.undoManager.isUndoingRedoing||gl(b,a)}}function zl(a){var b=a.diagram;null===b||b.undoManager.isUndoingRedoing||(a instanceof X?a instanceof W?a.rd():a.Em(a,function(a){yl(a)}):yl(a))}
t.bind=function(a,b,c,d){var e=null;"string"===typeof a?e=new si(a,b,c,d):e=a;e.od=this;a=this.Ch();null!==a&&Al(a)&&B("Cannot add a Binding to a template that has already been copied: "+e);null===this.fb&&(this.fb=new E);this.fb.add(e);return this};t.set=function(a){Object.assign(this,a);return this};t.Fu=function(a){Bl(this,a);return this};t.apply=function(a){a(this);return this};t.zm=function(a){pj(this,a);return this};t.Oz=function(){return this.Ch()};
t.Ch=function(){for(var a=this instanceof X?this:this.panel;null!==a;){if(null!==a.Qh)return a;a=a.panel}return null};t.Zv=function(a){a.od=this;null===this.xg&&(this.xg=new H);this.xg.add(a.propertyName,a);return this};
function Cl(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=Dl.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)pi(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):Bl(d,f);return d}
function Bl(a,b){if("string"===typeof b)if(a instanceof Mg)a.text=b;else if(a instanceof xf)a.figure=b;else if(a instanceof Rj)a.source=b;else if(a instanceof X)b=El.H(b),null!==b&&(a.type=b);else if(a instanceof hl){var c=Wa(hl,b);null!==c?a.type=c:B("Unknown Brush type as an argument to GraphObject.make: "+b)}else a instanceof P?(b=Wa(P,b),null!==b&&(a.type=b)):a instanceof ae&&(b=Wa(ae,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 Jj){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 Jj?(a=d,b.isRow?a.height=b.height:a.width=b.width,a.minimum=b.minimum,a.maximum=b.maximum,a.alignment=b.alignment,a.stretch=b.stretch,a.sizing=b.sizing,a.fg=null===b.separatorPadding?null:b.separatorPadding.I(),a.separatorStroke=b.separatorStroke,a.separatorStrokeWidth=b.separatorStrokeWidth,
a.Jj=null,b.separatorDashArray&&(a.Jj=Ba(b.separatorDashArray)),a.background=b.background,a.coversSeparators=b.coversSeparators,a.fb=b.fb):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 Fl)a.type=b;else if(b instanceof si)a instanceof Y?a.bind(b):a instanceof Jj?a.bind(b):B("A Binding can only be applied to a GraphObject or RowColumnDefinition, not to: "+
a);else if(b instanceof Wh)a instanceof Y?a.Zv(b):B("An AnimationTrigger can only be applied to a GraphObject, not to: "+a);else if(b instanceof $d)a instanceof P?a.figures.add(b):B("A PathFigure can only be added to a Geometry, not to: "+a);else if(b instanceof ae)a instanceof $d?a.segments.add(b):B("A PathSegment can only be added to a PathFigure, not to: "+a);else if(b instanceof ni)a instanceof Q?a.layout=b:a instanceof U?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++)Bl(a,b[c]);else if("object"===typeof b&&null!==b)if(a instanceof hl){c=new Ya;for(var e in b)d=parseFloat(e),isNaN(d)?c[e]=b[e]:a.addColorStop(d,b[e]);pj(a,c)}else if(a instanceof Jj){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 Ya;for(c in b)"row"!==c&&"column"!==c&&(e[c]=b[c]);pj(a,e)}else pj(a,b);else B('Unknown initializer "'+b+'" for object being constructed by GraphObject.make: '+a)}function Gl(a,b){Dl.add(a,b)}function Hl(a,b,c){void 0===c&&(c=null);var d=a[1];if("function"===typeof c?c(d):"string"===typeof d)return a.splice(1,1),d;if(void 0===b)throw Error("no "+("function"===typeof c?"satisfactory":"string")+" argument for GraphObject builder "+a[0]);return b}
na.Object.defineProperties(Y.prototype,{shadowVisible:{get:function(){return this.Fl},set:function(a){var b=this.Fl;b!==a&&(this.Fl=a,this.N(),this.g("shadowVisible",b,a))}},enabledChanged:{get:function(){return null!==this.O?this.O.vn:null},set:function(a){Wk(this);var b=this.O.vn;b!==a&&(this.O.vn=a,this.g("enabledChanged",b,a))}},segmentOrientation:{get:function(){return this.Dl},set:function(a){var b=this.Dl;
b!==a&&(this.Dl=a,this.s(),this.g("segmentOrientation",b,a),a===Rf&&(this.angle=0))}},segmentIndex:{get:function(){return this.hp},set:function(a){a=Math.round(a);var b=this.hp;b!==a&&(this.hp=a,this.s(),this.g("segmentIndex",b,a))}},segmentFraction:{get:function(){return this.Bl},set:function(a){isNaN(a)?a=0:0>a?a=0:1<a&&(a=1);var b=this.Bl;b!==a&&(this.Bl=a,this.s(),this.g("segmentFraction",b,a))}},segmentOffset:{
get:function(){return this.Cl},set:function(a){var b=this.Cl;b.A(a)||(this.Cl=a=a.I(),this.s(),this.g("segmentOffset",b,a))}},stretch:{get:function(){return this.Ee},set:function(a){var b=this.Ee;b!==a&&(this.Ee=a,this.s(),this.g("stretch",b,a))}},name:{get:function(){return this.na},set:function(a){var b=this.na;b!==a&&(this.na=a,null!==this.part&&(this.part.li=null),this.g("name",b,a))}},opacity:{get:function(){return this.mb},
set:function(a){var b=this.mb;b!==a&&((0>a||1<a)&&xa(a,"0 <= value <= 1",Y,"opacity"),this.mb=a,this.g("opacity",b,a),a=this.diagram,b=this.part,null!==a&&null!==b&&a.N(tj(b,b.actualBounds)))}},visible:{get:function(){return 0!==(this.G&1)},set:function(a){var b=0!==(this.G&1);b!==a&&(this.G^=1,this.g("visible",b,a),b=this.panel,null!==b?b.s():this.Qi()&&this.Ob(a),this.N(),zl(this))}},pickable:{get:function(){return 0!==(this.G&2)},set:function(a){var b=
0!==(this.G&2);b!==a&&(this.G^=2,this.g("pickable",b,a))}},fromLinkableDuplicates:{get:function(){return 0!==(this.G&4)},set:function(a){var b=0!==(this.G&4);b!==a&&(this.G^=4,this.g("fromLinkableDuplicates",b,a))}},fromLinkableSelfNode:{get:function(){return 0!==(this.G&8)},set:function(a){var b=0!==(this.G&8);b!==a&&(this.G^=8,this.g("fromLinkableSelfNode",b,a))}},toLinkableDuplicates:{get:function(){return 0!==
(this.G&16)},set:function(a){var b=0!==(this.G&16);b!==a&&(this.G^=16,this.g("toLinkableDuplicates",b,a))}},toLinkableSelfNode:{get:function(){return 0!==(this.G&32)},set:function(a){var b=0!==(this.G&32);b!==a&&(this.G^=32,this.g("toLinkableSelfNode",b,a))}},isPanelMain:{get:function(){return 0!==(this.G&64)},set:function(a){var b=0!==(this.G&64);b!==a&&(this.G^=64,this.s(),this.g("isPanelMain",b,a))}},isActionable:{
get:function(){return 0!==(this.G&128)},set:function(a){var b=0!==(this.G&128);b!==a&&(this.G^=128,this.g("isActionable",b,a))}},areaBackground:{get:function(){return this.hd},set:function(a){var b=this.hd;b!==a&&(null!==a&&Il(a,"GraphObject.areaBackground"),a instanceof hl&&a.freeze(),this.hd=a,this.N(),this.g("areaBackground",b,a))}},background:{get:function(){return this.Ub},set:function(a){var b=this.Ub;b!==a&&(null!==a&&Il(a,"GraphObject.background"),
a instanceof hl&&a.freeze(),this.Ub=a,this.N(),this.g("background",b,a))}},part:{get:function(){if(this.Qi())return this;if(null!==this.Dj)return this.Dj;var a;for(a=this.panel;a;){if(a instanceof V)return this.Dj=a;a=a.panel}return null}},svg:{get:function(){return this.$r},set:function(a){this.$r=a}},panel:{get:function(){return this.bg}},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.ja},set:function(a){var b=a.x,c=a.y,d=this.ja,e=d.x;d=d.y;(e===b||isNaN(e)&&isNaN(b))&&(d===c||isNaN(d)&&isNaN(c))?this.Ws():(a=a.copy(),this.Rv(a,e,d)&&this.g("position",new K(e,d),a))}},actualBounds:{get:function(){return this.wb}},scale:{
get:function(){return this.sa},set:function(a){var b=this.sa;b!==a&&(0>=a&&B("GraphObject.scale for "+this+" must be greater than zero, not: "+a),this.sa=a,this.s(),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,zl(this),this.s(),this.g("angle",b,a)))}},desiredSize:{get:function(){return this.Uc},set:function(a){var b=a.width,c=a.height,d=this.Uc,e=
d.width,f=d.height;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))||(this.Uc=a=a.I(),this.s(),this instanceof xf&&this.fc(),this.g("desiredSize",d,a),Zk(this)&&(a=this.part,null!==a&&($k(this,a,"width"),$k(this,a,"height"))))}},width:{get:function(){return this.Uc.width},set:function(a){var b=this.Uc.width;b===a||isNaN(b)&&isNaN(a)||(b=this.Uc,this.Uc=a=(new Gb(a,this.Uc.height)).freeze(),this.s(),this instanceof xf&&this.fc(),this.g("desiredSize",b,a),Zk(this)&&
(a=this.part,null!==a&&$k(this,a,"width")))}},height:{get:function(){return this.Uc.height},set:function(a){var b=this.Uc.height;b===a||isNaN(b)&&isNaN(a)||(b=this.Uc,this.Uc=a=(new Gb(this.Uc.width,a)).freeze(),this.s(),this instanceof xf&&this.fc(),this.g("desiredSize",b,a),Zk(this)&&(a=this.part,null!==a&&$k(this,a,"height")))}},minSize:{get:function(){return this.Zf},set:function(a){var b=this.Zf;b.A(a)||(a=a.copy(),isNaN(a.width)&&(a.width=
0),isNaN(a.height)&&(a.height=0),a.freeze(),this.Zf=a,this.s(),this.g("minSize",b,a))}},maxSize:{get:function(){return this.Yf},set:function(a){var b=this.Yf;b.A(a)||(a=a.copy(),isNaN(a.width)&&(a.width=Infinity),isNaN(a.height)&&(a.height=Infinity),a.freeze(),this.Yf=a,this.s(),this.g("maxSize",b,a))}},measuredBounds:{get:function(){return this.mc}},naturalBounds:{get:function(){return this.xc}},margin:{
get:function(){return this.Vg},set:function(a){"number"===typeof a&&(a=new lc(a));var b=this.Vg;b.A(a)||(this.Vg=a=a.I(),this.s(),this.g("margin",b,a))}},transform:{get:function(){0!==(this.G&2048)===!0&&jl(this);return this.ub}},ee:{get:function(){0!==(this.G&4096)===!0&&jl(this);return this.Nh}},alignment:{get:function(){return this.xb},set:function(a){var b=this.xb;b.A(a)||(a.Cc()&&!a.Mb()&&
B("GraphObject.alignment for "+this+" must be a real Spot or Spot.Default, not: "+a),this.xb=a=a.I(),ul(this),this.g("alignment",b,a))}},column:{get:function(){return this.Cg},set:function(a){a=Math.round(a);var b=this.Cg;b!==a&&(0>a&&xa(a,">= 0",Y,"column"),this.Cg=a,this.s(),this.g("column",b,a))}},columnSpan:{get:function(){return this.Zm},set:function(a){a=Math.round(a);var b=this.Zm;b!==a&&(1>a&&xa(a,">= 1",Y,"columnSpan"),this.Zm=a,
this.s(),this.g("columnSpan",b,a))}},row:{get:function(){return this.ap},set:function(a){a=Math.round(a);var b=this.ap;b!==a&&(0>a&&xa(a,">= 0",Y,"row"),this.ap=a,this.s(),this.g("row",b,a))}},rowSpan:{get:function(){return this.bp},set:function(a){a=Math.round(a);var b=this.bp;b!==a&&(1>a&&xa(a,">= 1",Y,"rowSpan"),this.bp=a,this.s(),this.g("rowSpan",b,a))}},spanAllocation:{get:function(){return this.tp},set:function(a){var b=
this.tp;b!==a&&(this.tp=a,this.s(),this.g("spanAllocation",b,a))}},alignmentFocus:{get:function(){return this.xk},set:function(a){var b=this.xk;b.A(a)||(this.xk=a=a.I(),this.s(),this.g("alignmentFocus",b,a))}},portId:{get:function(){return this.Po},set:function(a){var b=this.Po;if(b!==a){var c=this.part;null===c||c instanceof W||B("Cannot set portID on a Link: "+a);null!==b&&null!==c&&Jl(c,this);this.Po=a;null!==a&&null!==c&&(c.Je=!0,Kl(c,
this));this.g("portId",b,a)}}},toSpot:{get:function(){return null!==this.P?this.P.th:rc},set:function(a){this.Lc();var b=this.P.th;b.A(a)||(a=a.I(),this.P.th=a,this.g("toSpot",b,a),yl(this))}},toEndSegmentLength:{get:function(){return null!==this.P?this.P.rh:10},set:function(a){this.Lc();var b=this.P.rh;b!==a&&(0>a&&xa(a,">= 0",Y,"toEndSegmentLength"),this.P.rh=a,this.g("toEndSegmentLength",b,a),yl(this))}},toShortLength:{
get:function(){return null!==this.P?this.P.sh:0},set:function(a){this.Lc();var b=this.P.sh;b!==a&&(this.P.sh=a,this.g("toShortLength",b,a),yl(this))}},toLinkable:{get:function(){return null!==this.P?this.P.Bp:null},set:function(a){this.Lc();var b=this.P.Bp;b!==a&&(this.P.Bp=a,this.g("toLinkable",b,a))}},toMaxLinks:{get:function(){return null!==this.P?this.P.Cp:Infinity},set:function(a){this.Lc();var b=this.P.Cp;b!==a&&(0>a&&
xa(a,">= 0",Y,"toMaxLinks"),this.P.Cp=a,this.g("toMaxLinks",b,a))}},fromSpot:{get:function(){return null!==this.P?this.P.Pg:rc},set:function(a){this.Lc();var b=this.P.Pg;b.A(a)||(a=a.I(),this.P.Pg=a,this.g("fromSpot",b,a),yl(this))}},fromEndSegmentLength:{get:function(){return null!==this.P?this.P.Ng:10},set:function(a){this.Lc();var b=this.P.Ng;b!==a&&(0>a&&xa(a,">= 0",Y,"fromEndSegmentLength"),this.P.Ng=a,this.g("fromEndSegmentLength",
b,a),yl(this))}},fromShortLength:{get:function(){return null!==this.P?this.P.Og:0},set:function(a){this.Lc();var b=this.P.Og;b!==a&&(this.P.Og=a,this.g("fromShortLength",b,a),yl(this))}},fromLinkable:{get:function(){return null!==this.P?this.P.Bn:null},set:function(a){this.Lc();var b=this.P.Bn;b!==a&&(this.P.Bn=a,this.g("fromLinkable",b,a))}},fromMaxLinks:{get:function(){return null!==this.P?this.P.Cn:Infinity},
set:function(a){this.Lc();var b=this.P.Cn;b!==a&&(0>a&&xa(a,">= 0",Y,"fromMaxLinks"),this.P.Cn=a,this.g("fromMaxLinks",b,a))}},cursor:{get:function(){return this.Th},set:function(a){var b=this.Th;b!==a&&(this.Th=a,this.g("cursor",b,a))}},click:{get:function(){return null!==this.O?this.O.Bg:null},set:function(a){Wk(this);var b=this.O.Bg;b!==a&&(this.O.Bg=a,this.g("click",b,a))}},doubleClick:{get:function(){return null!==
this.O?this.O.Jg:null},set:function(a){Wk(this);var b=this.O.Jg;b!==a&&(this.O.Jg=a,this.g("doubleClick",b,a))}},contextClick:{get:function(){return null!==this.O?this.O.Dg:null},set:function(a){Wk(this);var b=this.O.Dg;b!==a&&(this.O.Dg=a,this.g("contextClick",b,a))}},mouseEnter:{get:function(){return null!==this.O?this.O.Yg:null},set:function(a){Wk(this);var b=this.O.Yg;b!==a&&(this.O.Yg=a,this.g("mouseEnter",b,a))}},mouseLeave:{
get:function(){return null!==this.O?this.O.ah:null},set:function(a){Wk(this);var b=this.O.ah;b!==a&&(this.O.ah=a,this.g("mouseLeave",b,a))}},mouseOver:{get:function(){return null!==this.O?this.O.bh:null},set:function(a){Wk(this);var b=this.O.bh;b!==a&&(this.O.bh=a,this.g("mouseOver",b,a))}},mouseHover:{get:function(){return null!==this.O?this.O.$g:null},set:function(a){Wk(this);var b=this.O.$g;b!==a&&(this.O.$g=a,this.g("mouseHover",
b,a))}},mouseHold:{get:function(){return null!==this.O?this.O.Zg:null},set:function(a){Wk(this);var b=this.O.Zg;b!==a&&(this.O.Zg=a,this.g("mouseHold",b,a))}},mouseDragEnter:{get:function(){return null!==this.O?this.O.vo:null},set:function(a){Wk(this);var b=this.O.vo;b!==a&&(this.O.vo=a,this.g("mouseDragEnter",b,a))}},mouseDragLeave:{get:function(){return null!==this.O?this.O.wo:null},set:function(a){Wk(this);
var b=this.O.wo;b!==a&&(this.O.wo=a,this.g("mouseDragLeave",b,a))}},mouseDrop:{get:function(){return null!==this.O?this.O.Xg:null},set:function(a){Wk(this);var b=this.O.Xg;b!==a&&(this.O.Xg=a,this.g("mouseDrop",b,a))}},actionDown:{get:function(){return null!==this.O?this.O.Lm:null},set:function(a){Wk(this);var b=this.O.Lm;b!==a&&(this.O.Lm=a,this.g("actionDown",b,a))}},actionMove:{get:function(){return null!==
this.O?this.O.Mm:null},set:function(a){Wk(this);var b=this.O.Mm;b!==a&&(this.O.Mm=a,this.g("actionMove",b,a))}},actionUp:{get:function(){return null!==this.O?this.O.Nm:null},set:function(a){Wk(this);var b=this.O.Nm;b!==a&&(this.O.Nm=a,this.g("actionUp",b,a))}},actionCancel:{get:function(){return null!==this.O?this.O.Km:null},set:function(a){Wk(this);var b=this.O.Km;b!==a&&(this.O.Km=a,this.g("actionCancel",b,a))}},toolTip:{
get:function(){return null!==this.O?this.O.uh:null},set:function(a){Wk(this);var b=this.O.uh;b!==a&&(this.O.uh=a,this.g("toolTip",b,a))}},contextMenu:{get:function(){return null!==this.O?this.O.Eg:null},set:function(a){Wk(this);var b=this.O.Eg;b!==a&&(this.O.Eg=a,this.g("contextMenu",b,a))}}});Y.prototype.trigger=Y.prototype.Zv;Y.prototype.findBindingPanel=Y.prototype.Ch;Y.prototype.findTemplateBinder=Y.prototype.Oz;Y.prototype.setProperties=Y.prototype.zm;
Y.prototype.apply=Y.prototype.apply;Y.prototype.attach=Y.prototype.Fu;Y.prototype.set=Y.prototype.set;Y.prototype.isEnabledObject=Y.prototype.Ef;Y.prototype.isVisibleObject=Y.prototype.Ff;Y.prototype.isContainedBy=Y.prototype.sg;Y.prototype.getNearestIntersectionPoint=Y.prototype.ws;Y.prototype.getLocalPoint=Y.prototype.vs;Y.prototype.getDocumentScale=Y.prototype.Af;Y.prototype.getDocumentAngle=Y.prototype.Ki;Y.prototype.getDocumentBounds=Y.prototype.Li;Y.prototype.getDocumentPoint=Y.prototype.da;
Y.prototype.intersectsRect=Y.prototype.Mc;Y.prototype.containedInRect=Y.prototype.Ah;Y.prototype.containsRect=Y.prototype.Ge;Y.prototype.containsPoint=Y.prototype.$;Y.prototype.raiseChanged=Y.prototype.g;Y.prototype.raiseChangedEvent=Y.prototype.Wa;Y.prototype.addCopyProperty=Y.prototype.wx;var Dl=null;Y.className="GraphObject";Dl=new H;
Gl("Button",function(){function a(a,b){return null!==a.diagram.Zb(a.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a},function(a){return a===b})}var b=Cl(X,X.Auto,{isActionable:!0,enabledChanged:function(a,b){if(a instanceof X){var c=a.Ya("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"},Cl(xf,{name:"ButtonBorder",figure:"RoundedRectangle",spot1:new O(0,0,2.76142374915397,2.761423749153969),spot2:new O(1,1,-2.76142374915397,-2.761423749153969),parameter1:2,parameter2:2,fill:"#F5F5F5",stroke:"#BDBDBD"}));b.mouseEnter=function(a,b){if(b.Ef()&&b instanceof X&&(a=b.Ya("ButtonBorder"),a instanceof xf)){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.Ef()&&b instanceof X&&(a=b.Ya("ButtonBorder"),a instanceof xf&&(a.fill=b._buttonFillNormal,a.stroke=b._buttonStrokeNormal))};b.actionDown=function(a,b){if(b.Ef()&&b instanceof X&&null!==b._buttonFillPressed&&0===a.button){var c=b.Ya("ButtonBorder");if(c instanceof xf){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.Ef()&&d instanceof X&&null!==d._buttonFillPressed&&0===b.button){var c=d.Ya("ButtonBorder");if(c instanceof xf){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.Ef()&&d instanceof X&&null!==d._buttonFillPressed){var c=d.Ya("ButtonBorder");if(c instanceof xf){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.Ef()&&d instanceof X&&null!==d._buttonFillPressed){var c=b.diagram;if(0===c.firstInput.button&&(c.currentTool.standardMouseOver(),a(b,d)&&(b=d.Ya("ButtonBorder"),b instanceof xf))){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});
Gl("TreeExpanderButton",function(){var a=Cl("Button",{_treeExpandedFigure:"MinusLine",_treeCollapsedFigure:"PlusLine"},Cl(xf,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:Kb},(new si("figure","isTreeExpanded",function(a,c){c=c.panel;return a?c._treeExpandedFigure:c._treeCollapsedFigure})).kq()),{visible:!1},(new si("visible","isTreeLeaf",function(a){return!a})).kq());a.click=function(a,c){c=c.part;c instanceof ze&&(c=c.adornedPart);if(c instanceof W){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});
Gl("SubGraphExpanderButton",function(){var a=Cl("Button",{_subGraphExpandedFigure:"MinusLine",_subGraphCollapsedFigure:"PlusLine"},Cl(xf,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:Kb},(new si("figure","isSubGraphExpanded",function(a,c){c=c.panel;return a?c._subGraphExpandedFigure:c._subGraphCollapsedFigure})).kq()));a.click=function(a,c){c=c.part;c instanceof ze&&(c=c.adornedPart);if(c instanceof U){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});Gl("ToolTip",function(){return Cl(ze,X.Auto,{isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new K(0,3),shadowBlur:5},Cl(xf,{name:"Border",figure:"RoundedRectangle",parameter1:1,parameter2:1,fill:"#F5F5F5",stroke:"#F0F0F0",spot1:new O(0,0,4,6),spot2:new O(1,1,-4,-4)}))});
Gl("ContextMenu",function(){return Cl(ze,X.Vertical,{background:"#F5F5F5",isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new K(0,3),shadowBlur:5},new si("background","",function(a){return null!==a.adornedPart&&null!==a.placeholder?null:"#F5F5F5"}))});Gl("ContextMenuButton",function(){var a=Cl("Button");a.stretch=Qk;var b=a.Ya("ButtonBorder");b instanceof xf&&(b.figure="Rectangle",b.strokeWidth=0,b.spot1=new O(0,0,2,3),b.spot2=new O(1,1,-2,-2));return a});
Gl("PanelExpanderButton",function(a){var b=Hl(a,"COLLAPSIBLE"),c=Cl("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},Cl(xf,{name:"ButtonIcon",strokeWidth:2},(new si("geometryString","visible",function(a){return a?c._buttonExpandedFigure:c._buttonCollapsedFigure})).kq(b)));
a=c.Ya("ButtonBorder");a instanceof xf&&(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.Ch();null===e&&(e=c.part);null!==e&&(c=e.Ya(b),null!==c&&(a.handled=!0,d.xa("Collapse/Expand Panel"),c.visible=!c.visible,d.Xa("Collapse/Expand Panel")))}};return c});
Gl("CheckBoxButton",function(a){var b=Hl(a);a=Cl("Button",{desiredSize:new Gb(14,14)},Cl(xf,{name:"ButtonIcon",geometryString:"M0 0 M0 8.85 L4.9 13.75 16.2 2.45 M16.2 16.2",strokeWidth:2,stretch:qd,geometryStretch:rg,visible:!1},""!==b?(new si("visible",b)).ly():[]));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.Ya("ButtonIcon");c.xa("checkbox");f.visible=!f.visible;"function"===typeof d._doClick&&d._doClick(a,
d);c.Xa("checkbox")}}};return a});
Gl("CheckBox",function(a){a=Hl(a);a=Cl("CheckBoxButton",a,{name:"Button",isActionable:!1,margin:new lc(0,1,0,0)});var b=Cl(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=pg=new D(Y,"None",0);Y.Default=Pk=new D(Y,"Default",0);Y.Vertical=Rk=new D(Y,"Vertical",4);Y.Horizontal=Qk=new D(Y,"Horizontal",5);Y.Fill=qd=new D(Y,"Fill",3);Y.Uniform=rg=new D(Y,"Uniform",1);
Y.UniformToFill=Sk=new D(Y,"UniformToFill",2);Y.FlipVertical=Tk=new D(Y,"FlipVertical",1);Y.FlipHorizontal=Uk=new D(Y,"FlipHorizontal",2);Y.FlipBoth=Vk=new D(Y,"FlipBoth",3);Y.make=Cl;Y.getBuilders=function(){var a=new H,b;for(b in Dl)if(b!==b.toLowerCase()){var c=Dl.H(b);"function"===typeof c&&a.add(b,c)}a.freeze();return a};Y.defineBuilder=Gl;Y.takeBuilderArgument=Hl;
function Xk(){this.vn=this.Eg=this.uh=this.Km=this.Nm=this.Mm=this.Lm=this.Xg=this.wo=this.vo=this.Zg=this.$g=this.bh=this.ah=this.Yg=this.Dg=this.Jg=this.Bg=null}Xk.prototype.copy=function(){var a=new Xk;a.Bg=this.Bg;a.Jg=this.Jg;a.Dg=this.Dg;a.Yg=this.Yg;a.ah=this.ah;a.bh=this.bh;a.$g=this.$g;a.Zg=this.Zg;a.vo=this.vo;a.wo=this.wo;a.Xg=this.Xg;a.Lm=this.Lm;a.Mm=this.Mm;a.Nm=this.Nm;a.Km=this.Km;a.uh=this.uh;a.Eg=this.Eg;a.vn=this.vn;return a};Xk.className="GraphObjectEventHandlers";
function Ll(){this.Na=[1,0,0,1,0,0]}Ll.prototype.copy=function(){var a=new Ll;a.Na[0]=this.Na[0];a.Na[1]=this.Na[1];a.Na[2]=this.Na[2];a.Na[3]=this.Na[3];a.Na[4]=this.Na[4];a.Na[5]=this.Na[5];return a};Ll.prototype.translate=function(a,b){this.Na[4]+=this.Na[0]*a+this.Na[2]*b;this.Na[5]+=this.Na[1]*a+this.Na[3]*b};Ll.prototype.scale=function(a,b){this.Na[0]*=a;this.Na[1]*=a;this.Na[2]*=b;this.Na[3]*=b};Ll.className="STransform";
function Ml(a){this.type=a;this.r2=this.y2=this.x2=this.r1=this.y1=this.x1=0;this.Gx=[];this.pattern=null}Ml.prototype.addColorStop=function(a,b){this.Gx.push({offset:a,color:b})};Ml.className="SGradient";
function sj(a,b){this.ownerDocument=a=void 0===b?x.document:b;this.yA="http://www.w3.org/2000/svg";void 0!==a&&(this.La=this.Pb("svg",{width:"1px",height:"1px",viewBox:"0 0 1 1"}),this.La.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns","http://www.w3.org/2000/svg"),this.La.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"));this.Up=null;this.context=new Nl(this)}
sj.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.La.setAttributeNS(null,"width",c+"px"),this.La.setAttributeNS(null,"height",d+"px"),this.La.setAttributeNS(null,"viewBox","0 0 "+c+" "+d),this.context.Xw.firstElementChild.setAttributeNS(null,"width",c+"px"),this.context.Xw.firstElementChild.setAttributeNS(null,"height",d+"px"),!0):!1};
sj.prototype.Pb=function(a,b,c){a=this.ownerDocument.createElementNS(this.yA,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};sj.prototype.getBoundingClientRect=function(){return this.La.getBoundingClientRect()};sj.prototype.focus=function(){this.La.focus()};sj.prototype.Mx=function(){this.ownerDocument=null};
na.Object.defineProperties(sj.prototype,{width:{get:function(){return this.La.width.baseVal.value},set:function(a){this.La.width=a}},height:{get:function(){return this.La.height.baseVal.value},set:function(a){this.La.height=a}},style:{get:function(){return this.La.style}}});sj.className="SVGSurface";
function Nl(a){this.Ys=a;this.svg=a.La;this.stack=[];this.fd=[];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.hg=this.Tr=this.Sr=0;this.Fs=null;this.path=[];this.Rt=!1;this.mh=null;this.nh=0;this.He=new Ll;
Ol(this,1,0,0,1,0,0);var b=mb++,c=this.Pb("clipPath",{id:"mainClip"+b});c.appendChild(this.Pb("rect",{x:0,y:0,width:a.width,height:a.height}));this.Xw=c;this.Ys.La.appendChild(c);this.fd[0].setAttributeNS(null,"clip-path","url(#mainClip"+b+")");this.AA={}}t=Nl.prototype;
t.arc=function(a,b,c,d,e,f,g,h){var k=2*Math.PI,l=k-1E-6,m=c*Math.cos(d),n=c*Math.sin(d),p=a+m,r=b+n,q=f?0:1;d=f?d-e:e-d;(1E-6<Math.abs(g-p)||1E-6<Math.abs(h-r))&&this.path.push(["L",p,+r]);0>d&&(d=d%k+k);d>l?(this.path.push(["A",c,c,0,1,q,a-m,b-n]),this.path.push(["A",c,c,0,1,q,p,r])):1E-6<d&&this.path.push(["A",c,c,0,+(d>=Math.PI),q,a+c*Math.cos(e),b+c*Math.sin(e)])};t.beginPath=function(){this.path=[]};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.He)};t.closePath=function(){this.path.push(["z"])};t.createLinearGradient=function(a,b,c,d){var e=new Ml("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.AA;if(c[b])return"url(#"+c[b]+")";var d="PATTERN"+mb++,e={x:0,y:0,width:a.width,height:a.height,href:b};a=this.Pb("pattern",{width:a.width,height:a.height,id:d,patternUnits:"userSpaceOnUse"});a.appendChild(this.Pb(uk,e));this.svg.appendChild(a);c[b]=d;return"url(#"+d+")"};
t.createRadialGradient=function(a,b,c,d,e,f){var g=new Ml("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};M.aa(d,h)&&M.aa(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"+mb++,g=this.Pb("clipPath",{id:f}),g.appendChild(this.Pb("rect",{x:b,y:c,width:d,height:e})),this.svg.appendChild(g),a["clip-path"]="url(#"+f+")";Pl(this,uk,a,this.He,l);this.addElement(uk,a)};t.fill=function(){this.addPath("fill",this.path,this.He)};
t.yf=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]};Pl(this,"fill",a,this.He);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};Pl(this,"fill",b,this.He);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.He=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.He.copy())};
t.setTransform=function(a,b,c,d,e,f){1===a&&0===b&&0===c&&1===d&&0===e&&0===f||Ol(this,a,b,c,d,e,f)};t.scale=function(a,b){this.He.scale(a,b)};t.translate=function(a,b){this.He.translate(a,b)};t.transform=function(){};t.Ed=function(){};t.stroke=function(){this.addPath("stroke",this.path,this.He)};t.Wi=function(){this.clipInsteadOfFill||this.stroke()};t.Pb=function(a,b,c){return this.Ys.Pb(a,b,c)};
t.addElement=function(a,b,c){a=this.Pb(a,b,c);0<this.fd.length?this.fd[this.fd.length-1].appendChild(a):this.svg.appendChild(a);return this.Fs=a};
function Pl(a,b,c,d,e){1!==a.globalAlpha&&(c.opacity=a.globalAlpha);"fill"===b?(a.fillStyle instanceof Ml?c.fill=Ql(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 Ml?c.stroke=Ql(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.Na;d="matrix("+d[0]+", "+d[1]+", "+d[2]+", "+d[3]+", "+d[4]+", "+d[5]+")";void 0!==e&&(d+=e);c.transform=d}
function Ql(a,b){var c="GRAD"+mb++;if("linear"===b.type)var d=a.Pb("linearGradient",{x1:b.x1,x2:b.x2,y1:b.y1,y2:b.y2,id:c,gradientUnits:"userSpaceOnUse"});else if("radial"===b.type)d=a.Pb("radialGradient",{x1:b.x1,x2:b.x2,y1:b.y1,y2:b.y2,r1:b.r1,r2:b.r2,id:c});else throw Error("invalid gradient");var e=b.Gx;b=e.length;for(var f=[],g=0;g<b;g++){var h=e[g],k=h.color;h={offset:h.offset,"stop-color":k};/^rgba\(/.test(k)&&(k=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(k),
h["stop-color"]="rgb("+k[1]+","+k[2]+","+k[3]+")",h["stop-opacity"]=k[4]);f.push(h)}f.sort(function(a,b){return a.offset>b.offset?1:-1});for(e=0;e<b;e++)d.appendChild(a.Pb("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.Rt&&(b["stroke-dasharray"]=this.mh.toString(),b["stroke-dashoffset"]=this.nh);Pl(this,a,b,c);"clipPath"===a?(a="CLIP"+mb++,c=this.Pb("clipPath",{id:a}),c.appendChild(this.Pb("path",b)),this.svg.appendChild(c),
0<this.fd.length&&this.fd[this.fd.length-1].setAttributeNS(null,"clip-path","url(#"+a+")")):this.addElement("path",b)};function Ol(a,b,c,d,e,f,g){var h=new Ll;h.Na=[b,c,d,e,f,g];b={};Pl(a,"g",b,h);h=a.addElement("g",b);a.fd.push(h)}
t.Bm=function(a){if(0!==this.shadowOffsetX||0!==this.shadowOffsetY||0!==this.shadowBlur){var b="SHADOW"+mb++,c=this.addElement("filter",{id:b,x:"-100%",y:"-100%",width:"300%",height:"300%"},null),d=a.computePixelRatio();a=this.Pb("feGaussianBlur",{"in":"SourceAlpha",result:"blur",stdDeviation:this.shadowBlur/2/d});var e=this.Pb("feFlood",{"in":"blur",result:"flood","flood-color":this.shadowColor}),f=this.Pb("feComposite",{"in":"flood",in2:"blur",operator:"in",result:"comp"});d=this.Pb("feOffset",
{"in":"comp",result:"offsetBlur",dx:this.shadowOffsetX/d,dy:this.shadowOffsetY/d});var g=this.Pb("feMerge",{});g.appendChild(this.Pb("feMergeNode",{"in":"offsetBlur"}));g.appendChild(this.Pb("feMergeNode",{"in":"SourceGraphic"}));c.appendChild(a);c.appendChild(e);c.appendChild(f);c.appendChild(d);c.appendChild(g);0<this.fd.length&&this.fd[this.fd.length-1].setAttributeNS(null,"filter","url(#"+b+")")}};t.Uv=function(a,b,c){this.Sr=a;this.Tr=b;this.hg=c};
function ll(a){a.shadowOffsetX=0;a.shadowOffsetY=0;a.shadowBlur=0}function kl(a){a.shadowOffsetX=a.Sr;a.shadowOffsetY=a.Tr;a.shadowBlur=a.hg}t.os=function(a,b){this.Rt=!0;this.mh=a;this.nh=b};t.ms=function(){this.Rt=!1};t.Ic=function(){};t.zy=function(){};Nl.prototype.rotate=function(){};Nl.prototype.getImageData=function(){return null};Nl.prototype.measureText=function(){return null};Nl.className="SVGContext";
Q.prototype.Js=function(a){var b=new sj(this,x.document);void 0===a&&(a=new Ya);var c=this;return sk(this,function(a,e){a=tk(c,a,"SVG",b);a=null!==a?a.svg:null;return"function"===typeof e?(e(a),null):a},a)};Q.prototype.makeSvg=Q.prototype.Js;Q.prototype.tv=function(a){return this.Js(a)};Q.prototype.makeSVG=Q.prototype.tv;
Y.prototype.Nx=function(a,b){if(!(a instanceof Nl))return!1;var c=null,d=a.Fs,e=this.transform,f=this.panel;0!==(this.G&4096)===!0&&jl(this);var g=this.wb,h=0!==(this.G&256);a.clipInsteadOfFill&&(h=!1);var k=!1;this instanceof Mg&&(a.font=this.font);if(h){k=f.ie()?f.naturalBounds:f.actualBounds;if(null!==this.$a){var l=this.$a;var m=l.x;var n=l.y;var p=l.width;l=l.height}else m=Math.max(g.x,k.x),n=Math.max(g.y,k.y),p=Math.min(g.right,k.right)-m,l=Math.min(g.bottom,k.bottom)-n;if(m>g.width+g.x||g.x>
k.width+k.x||n>g.height+g.y||g.y>k.height+k.y)return!0;k=!0;Ol(a,1,0,0,1,0,0);a.save();a.beginPath();a.rect(m,n,p,l);a.clip()}if(this.Qi()&&!this.isVisible())return!0;a.He.Na=[1,0,0,1,0,0];(this instanceof Mg&&1<this.lineCount||this instanceof xf&&1<this.geometry.figures.length)&&Ol(a,1,0,0,1,0,0);m=!1;this.Qi()&&this.isShadowed&&b.Ie("drawShadows")&&(n=this.shadowOffset,a.Uv(n.x*b.scale*b.ec,n.y*b.scale*b.ec,this.shadowBlur),kl(a),a.shadowColor=this.shadowColor);n=!1;this.part&&b.Ie("drawShadows")&&
(n=this.part.isShadowed);a.clipInsteadOfFill&&(n=!1);!0===this.shadowVisible?(kl(a),!1===m&&n&&(Ol(a,1,0,0,1,0,0),a.Bm(b),m=!0)):!1===this.shadowVisible&&ll(a);p=this.naturalBounds;null!==this.areaBackground&&(di(this,a,this.areaBackground,!0,!0,p,g),!1===m&&n&&(Ol(a,1,0,0,1,0,0),a.Bm(b),m=!0),this.areaBackground instanceof hl&&this.areaBackground.type===il?(a.beginPath(),a.rect(g.x,g.y,g.width,g.height),a.yf(this.areaBackground)):a.fillRect(g.x,g.y,g.width,g.height));l=!1;this instanceof X?Ol(a,
e.m11,e.m12,e.m21,e.m22,e.dx,e.dy):(a.He.Na=[e.m11,e.m12,e.m21,e.m22,e.dx,e.dy],!1===m&&n&&(l=!0));null!==this.background&&(!1===m&&n&&(Ol(a,1,0,0,1,0,0),a.Bm(b),m=!0),ml(this,a,p,g));n&&(null!==this.background||null!==this.areaBackground||null!==f&&0!==(f.G&512)||null!==f&&(f.type===X.Auto||f.type===X.Spot)&&f.pb()!==this)?(nl(this,!0),null===this.shadowVisible&&ll(a),l=!1):nl(this,!1);l&&!1===m&&(Ol(a,1,0,0,1,0,0),a.Bm(b),m=!0);this.Ei(a,b);n&&0!==(this.G&512)===!0&&kl(a);this.Qi()&&n&&ll(a);h&&
(a.restore(),k&&a.fd.pop());this instanceof X&&(c=a.fd.pop());!0===m&&a.fd.pop();if(this instanceof Mg&&1<this.lineCount||this instanceof xf&&1<this.geometry.figures.length)c=a.fd.pop();null!==a.Ys.Up&&(null===c&&(d===a.Fs?(Ol(a,1,0,0,1,0,0),c=a.fd.pop()):c=a.Fs),a.Ys.Up(this,c));this.svg=c;return!0};
function vk(a,b){this.ownerDocument=b=void 0===b?x.document:b;this.Up=null;b=b.createElement("canvas");b.tabIndex=0;this.La=b;this.La.innerHTML="This text is displayed if your browser does not support the Canvas HTML element.";this.context=new pl(b);b.D=a}vk.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};vk.prototype.toDataURL=function(a,b){return this.La.toDataURL(a,b)};
vk.prototype.getBoundingClientRect=function(){return this.La.getBoundingClientRect()};vk.prototype.focus=function(){this.La.focus()};vk.prototype.Mx=function(){this.ownerDocument=this.La.D=null};na.Object.defineProperties(vk.prototype,{width:{get:function(){return this.La.width},set:function(a){this.La.width=a}},height:{get:function(){return this.La.height},set:function(a){this.La.height=a}},style:{get:function(){return this.La.style}}});
vk.className="CanvasSurface";function pl(a){a.getContext&&a.getContext("2d")||B("Browser does not support HTML Canvas Element");this.Y=a.getContext("2d");this.wt=this.yt=this.xt="";this.Ym=!1;this.hg=this.Tr=this.Sr=0;this.Wl=new od}t=pl.prototype;t.zy=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.Ed();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()};
t.save=function(){this.Ed();this.Y.save()};pl.prototype.rotate=function(a){this.Wl.rotate(57.2958*a,0,0)};t=pl.prototype;t.setTransform=function(a,b,c,d,e,f){this.Wl.setTransform(a,b,c,d,e,f)};t.scale=function(a,b){this.Wl.scale(a,b)};t.translate=function(a,b){this.Wl.translate(a,b)};t.stroke=function(){this.Y.stroke()};
t.transform=function(a,b,c,d,e,f){if(1!==a||0!==b||0!==c||1!==d||0!==e||0!==f){var g=this.Wl,h=g.m11*a+g.m21*b;a=g.m12*a+g.m22*b;b=g.m11*c+g.m21*d;c=g.m12*c+g.m22*d;g.dx=g.m11*e+g.m21*f+g.dx;g.dy=g.m12*e+g.m22*f+g.dy;g.m11=h;g.m12=a;g.m21=b;g.m22=c}};t.Ed=function(){var a=this.Wl;this.Y.setTransform(a.m11,a.m12,a.m21,a.m22,a.dx,a.dy)};
t.yf=function(a){if(a instanceof hl&&a.type===il){var b=a.Gk;a=a.zt;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.Ym?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.Ym?this.clip():this.fill()};t.Wi=function(){this.Ym||this.stroke()};t.Uv=function(a,b,c){this.Sr=a;this.Tr=b;this.hg=c};
t.os=function(a,b){var c=this.Y;void 0!==c.setLineDash&&(c.setLineDash(a),c.lineDashOffset=b)};t.ms=function(){var a=this.Y;void 0!==a.setLineDash&&(a.setLineDash(Rl),a.lineDashOffset=0)};t.Ic=function(a){a&&(this.xt="");this.wt=this.yt=""};
na.Object.defineProperties(pl.prototype,{fillStyle:{get:function(){return this.Y.fillStyle},set:function(a){this.wt!==a&&(this.wt=this.Y.fillStyle=a)}},font:{get:function(){return this.Y.font},set:function(a){this.xt!==a&&(this.xt=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.yt!==a&&(this.yt=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.Ym},
set:function(a){this.Ym=a}}});var Rl=Object.freeze([]);pl.className="CanvasSurfaceContext";function Sl(){this.K=this.o=this.C=this.j=0}Sl.className="ColorNumbers";function hl(a){Tl||(Ul(),Tl=!0);Va(this);this.v=!1;void 0===a?(this.ha=ol,this.Fk="black"):"string"===typeof a?(this.ha=ol,this.Fk=a):(this.ha=a,this.Fk="black");a=this.ha;a===rl?(this.Cd=vc,this.Tk=Bc):this.Tk=a===il?this.Cd=yc:this.Cd=rc;this.Wr=0;this.Yq=NaN;this.me=this.Hr=this.le=null;this.zt=this.Gk=0}
hl.prototype.copy=function(){var a=new hl;a.ha=this.ha;a.Fk=this.Fk;a.Cd=this.Cd.I();a.Tk=this.Tk.I();a.Wr=this.Wr;a.Yq=this.Yq;null!==this.le&&(a.le=this.le.copy());a.Hr=this.Hr;return a};t=hl.prototype;t.freeze=function(){this.v=!0;null!==this.le&&this.le.freeze();return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.v=!1;null!==this.le&&this.le.ea();return this};t.gb=function(a){a.classType===hl&&(this.type=a)};
t.toString=function(){var a="Brush(";if(this.type===ol)a+=this.color;else if(a=this.type===rl?a+"Linear ":this.type===il?a+"Radial ":this.type===ql?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.v&&wa(this);("number"!==typeof a||!isFinite(a)||1<a||0>a)&&xa(a,"0 <= loc <= 1",hl,"addColorStop:loc");null===this.le&&(this.le=new H);this.le.add(a,b);this.ha===ol&&(this.type=rl);this.me=null;return this};
t.rA=function(a,b){this.v&&wa(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?Vl:b;if(this.type===ol)Rh(this.color),this.color=Wl(a,b);else if((this.type===rl||this.type===il)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)Rh(c.value),this.addColorStop(c.key,Wl(a,b));return this};function Xl(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?Vl:c;Rh(a);return Wl(b,c)}
t.sz=function(a,b){this.v&&wa(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?Vl:b;if(this.type===ol)Rh(this.color),this.color=Wl(-a,b);else if((this.type===rl||this.type===il)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)Rh(c.value),this.addColorStop(c.key,Wl(-a,b));return this};function Yl(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?Vl:c;Rh(a);return Wl(-b,c)}
function Zl(a,b,c){Rh(a);a=$l.j;var d=$l.C,e=$l.o,f=$l.K;Rh(b);void 0===c&&(c=.5);return"rgba("+Math.round(($l.j-a)*c+a)+", "+Math.round(($l.C-d)*c+d)+", "+Math.round(($l.o-e)*c+e)+", "+Math.round(($l.K-f)*c+f)+")"}
t.hy=function(){if(this.type===ol)return am(this.color);if((this.type===rl||this.type===il)&&null!==this.colorStops){var a=this.colorStops;if(this.type===il)return am(a.first().value);if(null!==a.get(.5))return am(a.get(.5));if(2===a.count)return a=a.ya(),am(Zl(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 am(Zl(a.get(c),a.get(d),1-f/e))}return!1};
function am(a){if(!a)return!1;if(a instanceof hl)return a.hy();Rh(a);return 128>(299*$l.j+587*$l.C+114*$l.o)/1E3}
function Wl(a,b){switch(b){case Vl:b=100*bm($l.j);var c=100*bm($l.C),d=100*bm($l.o);cm.j=.4124564*b+.3575761*c+.1804375*d;cm.C=.2126729*b+.7151522*c+.072175*d;cm.o=.0193339*b+.119192*c+.9503041*d;cm.K=$l.K;b=dm(cm.j/em[0]);c=dm(cm.C/em[1]);d=dm(cm.o/em[2]);fm.j=116*c-16;fm.C=500*(b-c);fm.o=200*(c-d);fm.K=cm.K;fm.j=Math.min(100,Math.max(0,fm.j+100*a));a=(fm.j+16)/116;b=a-fm.o/200;cm.j=em[0]*gm(fm.C/500+a);cm.C=em[1]*(fm.j>hm*im?Math.pow(a,3):fm.j/hm);cm.o=em[2]*gm(b);cm.K=fm.K;a=-.969266*cm.j+1.8760108*
cm.C+.041556*cm.o;b=.0556434*cm.j+-.2040259*cm.C+1.0572252*cm.o;$l.j=255*jm((3.2404542*cm.j+-1.5371385*cm.C+-.4985314*cm.o)/100);$l.C=255*jm(a/100);$l.o=255*jm(b/100);$l.K=cm.K;$l.j=Math.round($l.j);255<$l.j?$l.j=255:0>$l.j&&($l.j=0);$l.C=Math.round($l.C);255<$l.C?$l.C=255:0>$l.C&&($l.C=0);$l.o=Math.round($l.o);255<$l.o?$l.o=255:0>$l.o&&($l.o=0);return"rgba("+$l.j+", "+$l.C+", "+$l.o+", "+$l.K+")";case km:return Sh(),Th.o=Math.min(100,Math.max(0,Th.o+100*a)),"hsla("+Th.j+", "+Th.C+"%, "+Th.o+"%, "+
Th.K+")";default:B("Unknown color space: "+b)}}function Rh(a){Tl||(Ul(),Tl=!0);var b=lm;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,$l.j=a[0],$l.C=a[1],$l.o=a[2],$l.K=a[3]/255):(b.fillStyle="#FFFFFF",b.fillStyle=a,$l.j=0,$l.C=0,$l.o=0,$l.K=1)}}
function Sh(){var a=$l.j/255,b=$l.C/255,c=$l.o/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))}Th.j=Math.round(g);Th.C=Math.round(100*a);Th.o=Math.round(100*e);Th.K=$l.K}function bm(a){a/=255;return.04045>=a?a/12.92:Math.pow((a+.055)/1.055,2.4)}function jm(a){return.0031308>=a?12.92*a:1.055*Math.pow(a,1/2.4)-.055}
function dm(a){return a>im?Math.pow(a,1/3):(hm*a+16)/116}function gm(a){var b=a*a*a;return b>im?b:(116*a-16)/hm}function Il(a,b){"string"!==typeof a&&(a instanceof hl||B("Value for "+b+" must be a color string or a Brush, not "+a))}function Ul(){lm=Kg?(new vk(null)).context:null}
na.Object.defineProperties(hl.prototype,{type:{get:function(){return this.ha},set:function(a){this.v&&wa(this,a);this.ha=a;this.start.Cc()&&(a===rl?this.start=vc:a===il&&(this.start=yc));this.end.Cc()&&(a===rl?this.end=Bc:a===il&&(this.end=yc));this.me=null}},color:{get:function(){return this.Fk},set:function(a){this.v&&wa(this,a);this.Fk=a;this.me=null}},start:{get:function(){return this.Cd},set:function(a){this.v&&
wa(this,a);this.Cd=a.I();this.me=null}},end:{get:function(){return this.Tk},set:function(a){this.v&&wa(this,a);this.Tk=a.I();this.me=null}},startRadius:{get:function(){return this.Wr},set:function(a){this.v&&wa(this,a);0>a&&xa(a,">= zero",hl,"startRadius");this.Wr=a;this.me=null}},endRadius:{get:function(){return this.Yq},set:function(a){this.v&&wa(this,a);0>a&&xa(a,">= zero",hl,"endRadius");this.Yq=a;this.me=
null}},colorStops:{get:function(){return this.le},set:function(a){this.v&&wa(this,a);this.le=a;this.me=null}},pattern:{get:function(){return this.Hr},set:function(a){this.v&&wa(this,a);this.Hr=a;this.me=null}}});hl.prototype.isDark=hl.prototype.hy;hl.prototype.darkenBy=hl.prototype.sz;hl.prototype.lightenBy=hl.prototype.rA;hl.prototype.addColorStop=hl.prototype.addColorStop;
var im=216/24389,hm=24389/27,em=[95.047,100,108.883],lm=null,$l=new Sl,Th=new Sl,cm=new Sl,fm=new Sl,Tl=!1;hl.className="Brush";var ol;hl.Solid=ol=new D(hl,"Solid",0);var rl;hl.Linear=rl=new D(hl,"Linear",1);var il;hl.Radial=il=new D(hl,"Radial",2);var ql;hl.Pattern=ql=new D(hl,"Pattern",4);var Vl;hl.Lab=Vl=new D(hl,"Lab",5);var km;hl.HSL=km=new D(hl,"HSL",6);
hl.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};
hl.isValidColor=function(a){if("black"===a)return!0;if(""===a)return!1;Tl||(Ul(),Tl=!0);var b=lm;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};hl.lighten=function(a){return Xl(a)};hl.lightenBy=Xl;hl.darken=function(a){return Yl(a)};hl.darkenBy=Yl;hl.mix=Zl;hl.isDark=am;function Fl(){this.na="Base"}Fl.prototype.measure=function(){};
Fl.prototype.uA=function(a,b,c,d,e){a.measure(b,c,d,e)};Fl.prototype.arrange=function(){};Fl.prototype.gz=function(a,b,c,d,e,f){a.arrange(b,c,d,e,f)};Fl.prototype.EA=function(a){a.ck()};Fl.prototype.pc=function(){};na.Object.defineProperties(Fl.prototype,{name:{get:function(){return this.na},set:function(a){this.na=a}},classType:{get:function(){return X}}});Fl.prototype.remeasureObject=Fl.prototype.EA;Fl.prototype.arrangeElement=Fl.prototype.gz;
Fl.prototype.measureElement=Fl.prototype.uA;Fl.className="PanelLayout";function mm(){this.na="Base"}ma(mm,Fl);
mm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;a=nm(a);for(var k=0;k<h;k++){var l=d[k];if(l.visible||l===a){var m=l.margin,n=m.right+m.left;m=m.top+m.bottom;l.measure(b,c,f,g);var p=l.measuredBounds;n=Math.max(p.width+n,0);m=Math.max(p.height+m,0);p=l.position.x;var r=l.position.y;isFinite(p)||(p=0);isFinite(r)||(r=0);l instanceof xf&&l.isGeometryPositioned&&(l=l.strokeWidth/2,p-=l,r-=l);ac(e,p,r,n,m)}}};
mm.prototype.arrange=function(a,b,c){var d=b.length,e=a.padding;a=c.x-e.left;c=c.y-e.top;for(e=0;e<d;e++){var f=b[e],g=f.measuredBounds,h=f.margin,k=f.position.x,l=f.position.y;k=isNaN(k)?-a:k-a;l=isNaN(l)?-c:l-c;if(f instanceof xf&&f.isGeometryPositioned){var m=f.strokeWidth/2;k-=m;l-=m}f.visible&&f.arrange(k+h.left,l+h.top,g.width,g.height)}};function om(){this.na="Base"}ma(om,Fl);
om.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;b=Ea();f=nm(a);for(var k=0;k<h;k++){var l=d[k];if(l.visible||l===f){var m=cl(l,!1);if(m!==pg&&m!==Qk)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);Ia(b)};
om.prototype.arrange=function(a,b,c){for(var d=b.length,e=a.padding,f=e.top,g=a.isOpposite,h=g?c.width:e.left,k=0;k<d;k++){var l=f,m=b[k];if(m.visible){var n=m.measuredBounds,p=m.margin,r=p.top+p.bottom,q=f+e.bottom,u=n.height,w=cl(m,!1);if(isNaN(m.desiredSize.height)&&w===qd||w===Rk)u=Math.max(c.height-r-q,0);r=u+r+q;q=m.alignment;q.Mb()&&(q=a.defaultAlignment);q.hb()||(q=yc);g&&(h-=n.width+p.left+p.right);m.arrange(h+q.offsetX+p.left,l+q.offsetY+p.top+(c.height*q.y-r*q.y),n.width,u);g||(h+=n.width+
p.left+p.right)}}};function pm(){this.na="Base"}ma(pm,Fl);
pm.prototype.measure=function(a,b,c,d,e,f){var g=d.length;c=Ea();for(var h=nm(a),k=0;k<g;k++){var l=d[k];if(l.visible||l===h){var m=cl(l,!1);if(m!==pg&&m!==Rk)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;Rb(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;Ia(c)}};
pm.prototype.arrange=function(a,b,c){for(var d=b.length,e=a.padding,f=e.left,g=a.isOpposite,h=g?c.height:e.top,k=0;k<d;k++){var l=f,m=b[k];if(m.visible){var n=m.measuredBounds,p=m.margin,r=p.left+p.right,q=f+e.right,u=n.width,w=cl(m,!1);if(isNaN(m.desiredSize.width)&&w===qd||w===Qk)u=Math.max(c.width-r-q,0);r=u+r+q;q=m.alignment;q.Mb()&&(q=a.defaultAlignment);q.hb()||(q=yc);g&&(h-=n.height+p.bottom+p.top);m.arrange(l+q.offsetX+p.left+(c.width*q.x-r*q.x),h+q.offsetY+p.top,u,n.height);g||(h+=n.height+
p.bottom+p.top)}}};function qm(){this.na="Base"}ma(qm,Fl);
qm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.pb(),l=k.margin,m=l.right+l.left,n=l.top+l.bottom;k.measure(b,c,f,g);var p=k.measuredBounds;f=p.width;g=p.height;var r=Math.max(f+m,0);var q=Math.max(g+n,0);var u=a.isClipping,w=N.allocAt(-l.left,-l.top,r,q),v=N.allocAt(0,0,f,g);rm(k,v,!0);f=v.width;g=v.height;for(var y=!0,z=nm(a),A=0;A<h;A++){var C=d[A];if(C!==k&&(C.visible||C===z)){l=C.margin;r=l.right+l.left;q=l.top+l.bottom;p=cl(C,!1);switch(p){case qd:b=f;c=g;break;case Qk:b=f;break;
case Rk:c=g}C.measure(b,c,0,0);p=C.measuredBounds;r=Math.max(p.width+r,0);q=Math.max(p.height+q,0);var F=C.alignment;F.Mb()&&(F=a.defaultAlignment);F.hb()||(F=yc);var R=C.alignmentFocus;R.Mb()&&(R=yc);var J=null;C instanceof X&&""!==C.Re&&(J=C.Ya(C.Re),J===C&&(J=null));var S=v.x,L=v.y;if(null!==J){C.arrange(0,0,p.width,p.height);l=J.actualBounds;l=K.allocAt(l.x+(R.x*l.width-R.offsetX),l.y+(R.y*l.height-R.offsetY));for(J=J.panel;J!==C;)J.transform.Aa(l),J=J.panel;S+=F.x*f+F.offsetX-l.x;L+=F.y*g+F.offsetY-
l.y;K.free(l)}else S+=F.x*f+F.offsetX-(R.x*p.width+R.offsetX)-l.left,L+=F.y*g+F.offsetY-(R.y*p.height+R.offsetY)-l.top;y?(y=!1,e.h(S,L,r,q)):ac(e,S,L,r,q)}}y?e.assign(w):u?e.iv(v.x,v.y,v.width,v.height):ac(e,w.x,w.y,w.width,w.height);N.free(w);N.free(v);p=k.stretch;p===Pk&&(p=cl(k,!1));switch(p){case pg:return;case qd:if(!isFinite(b)&&!isFinite(c))return;break;case Qk:if(!isFinite(b))return;break;case Rk: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);rm(k,v,!0);f=v.width;g=v.height;for(b=0;b<h;b++)c=d[b],c===k||!c.visible&&c!==z||(l=c.margin,r=l.right+l.left,q=l.top+l.bottom,p=c.measuredBounds,r=Math.max(p.width+r,0),q=Math.max(p.height+q,0),m=c.alignment,m.Mb()&&(m=a.defaultAlignment),m.hb()||(m=yc),c=c.alignmentFocus,c.Mb()&&(c=yc),y?(y=!1,e.h(m.x*f+m.offsetX-(c.x*p.width+c.offsetX)-l.left,m.y*g+m.offsetY-(c.y*p.height+c.offsetY)-l.top,r,q)):ac(e,m.x*f+m.offsetX-(c.x*p.width+c.offsetX)-l.left,
m.y*g+m.offsetY-(c.y*p.height+c.offsetY)-l.top,r,q));y?e.assign(w):u?e.iv(v.x,v.y,v.width,v.height):ac(e,w.x,w.y,w.width,w.height);N.free(v)};
qm.prototype.arrange=function(a,b,c){var d=b.length,e=a.pb(),f=e.measuredBounds,g=f.width,h=f.height,k=a.padding;f=k.left;k=k.top;var l=f-c.x,m=k-c.y;e.arrange(l,m,g,h);g=N.allocAt(0,0,g,h);rm(e,g,!1);for(h=0;h<d;h++){var n=b[h];if(n!==e){l=n.measuredBounds;var p=l.width,r=l.height;m=n.alignment;m.Mb()&&(m=a.defaultAlignment);m.hb()||(m=yc);var q=n.alignmentFocus;q.Mb()&&(q=yc);l=null;n instanceof X&&""!==n.Re&&(l=n.Ya(n.Re),l===n&&(l=null));if(null!==l){var u=l.actualBounds;q=K.allocAt(u.x+(q.x*
u.width-q.offsetX),u.y+(q.y*u.height-q.offsetY));for(l=l.panel;l!==n;)l.transform.Aa(q),l=l.panel;l=m.x*g.width+m.offsetX-q.x;m=m.y*g.height+m.offsetY-q.y;K.free(q)}else l=m.x*g.width+m.offsetX-(q.x*p+q.offsetX),m=m.y*g.height+m.offsetY-(q.y*r+q.offsetY);l+=g.x-c.x;m+=g.y-c.y;n.visible&&n.arrange(f+l,k+m,p,r)}}N.free(g)};
function rm(a,b,c){var d=null;a instanceof X&&""!==a.Re&&(d=a.Ya(a.Re),d===a&&(d=null));if(null!==d)for(c&&a.arrange(0,0,b.width,b.height),b.assign(d.actualBounds),d=d.panel;d!==a;)d.transform.xq(b),d=d.panel}function sm(){this.na="Base"}ma(sm,Fl);
sm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.pb(),l=k.margin,m=b,n=c,p=l.right+l.left,r=l.top+l.bottom;k.measure(b,c,f,g);l=k.measuredBounds;var q=0,u=null;k instanceof xf&&(u=k,q=u.strokeWidth*u.scale);var w=Math.max(l.width+p,0);l=Math.max(l.height+r,0);var v=tm(k),y=v.x*w+v.offsetX;v=v.y*l+v.offsetY;var z=um(k),A=z.x*w+z.offsetX;z=z.y*l+z.offsetY;isFinite(b)&&(m=Math.max(Math.abs(y-A)-q,0));isFinite(c)&&(n=Math.max(Math.abs(v-z)-q,0));q=Gb.alloc();q.h(0,0);a=nm(a);for(z=0;z<
h;z++)v=d[z],v===k||!v.visible&&v!==a||(l=v.margin,w=l.right+l.left,y=l.top+l.bottom,v.measure(m,n,0,0),l=v.measuredBounds,w=Math.max(l.width+w,0),l=Math.max(l.height+y,0),q.h(Math.max(w,q.width),Math.max(l,q.height)));if(1===h)e.width=w,e.height=l,Gb.free(q);else{v=tm(k);z=um(k);h=d=0;z.x!==v.x&&z.y!==v.y&&(d=q.width/Math.abs(z.x-v.x),h=q.height/Math.abs(z.y-v.y));Gb.free(q);q=0;null!==u&&(q=u.strokeWidth*u.scale,qg(u)===rg&&(d=h=Math.max(d,h)));d+=Math.abs(v.offsetX)+Math.abs(z.offsetX)+q;h+=Math.abs(v.offsetY)+
Math.abs(z.offsetY)+q;u=k.stretch;u===Pk&&(u=cl(k,!1));switch(u){case pg:g=f=0;break;case qd:isFinite(b)&&(d=b);isFinite(c)&&(h=c);break;case Qk:isFinite(b)&&(d=b);g=0;break;case Rk:f=0,isFinite(c)&&(h=c)}k.ck();k.measure(d,h,f,g);e.width=k.measuredBounds.width+p;e.height=k.measuredBounds.height+r}};
sm.prototype.arrange=function(a,b){var c=b.length,d=a.pb(),e=d.measuredBounds,f=N.alloc();f.h(0,0,1,1);var g=d.margin,h=g.left;g=g.top;var k=a.padding,l=k.left;k=k.top;d.arrange(l+h,k+g,e.width,e.height);var m=tm(d),n=um(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;ac(f,r,n,0,0);f.x+=h+l;f.y+=g+k;for(e=0;e<c;e++)h=b[e],h!==d&&(l=h.measuredBounds,g=h.margin,k=Math.max(l.width+g.right+g.left,0),m=Math.max(l.height+g.top+g.bottom,0),p=h.alignment,
p.Mb()&&(p=a.defaultAlignment),p.hb()||(p=yc),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&&(bc(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 vm(){this.na="Base";this.name="Table"}ma(vm,Fl);
vm.prototype.measure=function(a,b,c,d,e){for(var f=d.length,g=Ea(),h=Ea(),k=0;k<f;k++){var l=d[k],m=l instanceof X?l:null;if(null===m||m.type!==X.TableRow&&m.type!==X.TableColumn||!l.visible)g.push(l);else{h.push(m);for(var n=m.U.l,p=n.length,r=0;r<p;r++){var q=n[r];m.type===X.TableRow?q.row=l.row:m.type===X.TableColumn&&(q.column=l.column);g.push(q)}}}f=g.length;0===f&&(a.getRowDefinition(0),a.getColumnDefinition(0));for(var u=[],w=0;w<f;w++){var v=g[w];dj(v,!0);dl(v,!0);u[v.row]||(u[v.row]=[]);
u[v.row][v.column]||(u[v.row][v.column]=[]);u[v.row][v.column].push(v)}Ia(g);var y=Ea(),z=Ea(),A=Ea(),C={count:0},F={count:0},R=b,J=c,S=a.ob;f=S.length;for(var L=0;L<f;L++){var I=S[L];void 0!==I&&(I.actual=0)}S=a.ib;f=S.length;for(var ja=0;ja<f;ja++)I=S[ja],void 0!==I&&(I.actual=0);for(var ca=u.length,pa=0,Na=0;Na<ca;Na++)u[Na]&&(pa=Math.max(pa,u[Na].length));var fb=Math.min(a.topIndex,ca-1),Ga=Math.min(a.leftIndex,pa-1),Ha=0;ca=u.length;for(var ud=nm(a),Wb=0;Wb<ca;Wb++)if(u[Wb]){pa=u[Wb].length;
var Xb=a.getRowDefinition(Wb);Xb.actual=0;for(var gb=Xb.cc=0;gb<pa;gb++)if(u[Wb][gb]){var vd=a.getColumnDefinition(gb);void 0===y[gb]&&(vd.actual=0,vd.cc=0,y[gb]=!0);for(var Zf=u[Wb][gb],$f=Zf.length,Fe=0;Fe<$f;Fe++){var Bb=Zf[Fe];if(Bb.visible||Bb===ud){var oh=1<Bb.rowSpan||1<Bb.columnSpan;oh&&(Wb<fb||gb<Ga||z.push(Bb));var ag=Bb.margin,ph=ag.right+ag.left,qh=ag.top+ag.bottom;var cb=vl(Bb,Xb,vd,!1);var vi=Bb.desiredSize,Wj=!isNaN(vi.height),bg=!isNaN(vi.width)&&Wj;oh||cb===pg||bg||Wb<fb||gb<Ga||
(void 0!==C[gb]||cb!==qd&&cb!==Qk||(C[gb]=-1,C.count++),void 0!==F[Wb]||cb!==qd&&cb!==Rk||(F[Wb]=-1,F.count++),A.push(Bb));Bb.measure(Infinity,Infinity,0,0);if(!(Wb<fb||gb<Ga)){var gd=Bb.measuredBounds,ic=Math.max(gd.width+ph,0),zf=Math.max(gd.height+qh,0);if(1===Bb.rowSpan&&(cb===pg||cb===Qk)){I=a.getRowDefinition(Wb);var sc=I.Jc();Ha=Math.max(zf-I.actual,0);Ha+sc>J&&(Ha=Math.max(J-sc,0));var cg=0===I.la;I.cc=I.cc+Ha;I.actual=I.la+Ha;J=Math.max(J-(Ha+(cg?sc:0)),0)}if(1===Bb.columnSpan&&(cb===pg||
cb===Rk)){I=a.getColumnDefinition(gb);var rh=I.Jc();Ha=Math.max(ic-I.actual,0);Ha+rh>R&&(Ha=Math.max(R-rh,0));var qn=0===I.la;I.cc=I.cc+Ha;I.actual=I.la+Ha;R=Math.max(R-(Ha+(qn?rh:0)),0)}oh&&Bb.ck()}}}}}Ia(y);var Dd=0,he=0;f=a.columnCount;for(var dg=0;dg<f;dg++){var eg=a.ib[dg];void 0!==eg&&(Dd+=eg.cc,0!==eg.cc&&(Dd+=eg.Jc()))}f=a.rowCount;for(var Uc=0;Uc<f;Uc++){var ie=a.ob[Uc];void 0!==ie&&(he+=ie.cc,0!==ie.cc&&(he+=ie.Jc()))}R=Math.max(b-Dd,0);var cc=J=Math.max(c-he,0),sh=R;f=A.length;for(var th=
0;th<f;th++){var Vc=A[th],wi=a.getRowDefinition(Vc.row),je=a.getColumnDefinition(Vc.column),Ye=Vc.measuredBounds,wd=Vc.margin,Xj=wd.right+wd.left,rn=wd.top+wd.bottom;C[Vc.column]=0===je.cc&&void 0!==C[Vc.column]?Math.max(Ye.width+Xj,C[Vc.column]):null;F[Vc.row]=0===wi.cc&&void 0!==F[Vc.row]?Math.max(Ye.height+rn,F[Vc.row]):null}var Af=0,Cb=0,Ed;for(Ed in F)"count"!==Ed&&(Af+=F[Ed]);for(Ed in C)"count"!==Ed&&(Cb+=C[Ed]);for(var hb=Gb.alloc(),xi=0;xi<f;xi++){var Yb=A[xi];if(Yb.visible||Yb===ud){var tc=
a.getRowDefinition(Yb.row),jc=a.getColumnDefinition(Yb.column),Fd=0;isFinite(jc.width)?Fd=jc.width:(isFinite(R)&&null!==C[Yb.column]?0===Cb?Fd=jc.actual+R:Fd=C[Yb.column]/Cb*sh:null!==C[Yb.column]?Fd=R:Fd=jc.actual||R,Fd=Math.max(0,Fd-jc.Jc()));var Gd=0;isFinite(tc.height)?Gd=tc.height:(isFinite(J)&&null!==F[Yb.row]?0===Af?Gd=tc.actual+J:Gd=F[Yb.row]/Af*cc:null!==F[Yb.row]?Gd=J:Gd=tc.actual||J,Gd=Math.max(0,Gd-tc.Jc()));hb.h(Math.max(jc.minimum,Math.min(Fd,jc.maximum)),Math.max(tc.minimum,Math.min(Gd,
tc.maximum)));cb=vl(Yb,tc,jc,!1);switch(cb){case Qk:hb.height=Math.max(hb.height,tc.actual+J);break;case Rk:hb.width=Math.max(hb.width,jc.actual+R)}var fg=Yb.margin,Dc=fg.right+fg.left,uh=fg.top+fg.bottom;Yb.ck();Yb.measure(hb.width,hb.height,jc.minimum,tc.minimum);var gg=Yb.measuredBounds,Hd=Math.max(gg.width+Dc,0),vh=Math.max(gg.height+uh,0);isFinite(R)&&(Hd=Math.min(Hd,hb.width));isFinite(J)&&(vh=Math.min(vh,hb.height));var Ze=0;Ze=tc.actual;tc.actual=Math.max(tc.actual,vh);tc.cc=Math.max(tc.cc,
vh);Ha=tc.actual-Ze;J=Math.max(J-Ha,0);null===F[Yb.row]&&(cc=Math.max(cc-Ha,0));Ze=jc.actual;jc.actual=Math.max(jc.actual,Hd);jc.cc=Math.max(jc.cc,Hd);Ha=jc.actual-Ze;R=Math.max(R-Ha,0);null===C[Yb.column]&&(sh=Math.max(sh-Ha,0))}}Ia(A);var Id=Gb.alloc(),Jd=Ea(),Kd=Ea();f=z.length;if(0!==f)for(var Ge=0;Ge<ca;Ge++)if(u[Ge]){pa=u[Ge].length;var wh=a.getRowDefinition(Ge);Jd[Ge]=wh.actual;for(var ke=0;ke<pa;ke++)if(u[Ge][ke]){var sn=a.getColumnDefinition(ke);Kd[ke]=sn.actual}}for(var dc=0;dc<f;dc++){var Oa=
z[dc];if(Oa.visible||Oa===ud){var ec=a.getRowDefinition(Oa.row),Ld=a.getColumnDefinition(Oa.column);hb.h(Math.max(Ld.minimum,Math.min(b,Ld.maximum)),Math.max(ec.minimum,Math.min(c,ec.maximum)));cb=vl(Oa,ec,Ld,!1);switch(cb){case qd:0!==Kd[Ld.index]&&(hb.width=Math.min(hb.width,Kd[Ld.index]));0!==Jd[ec.index]&&(hb.height=Math.min(hb.height,Jd[ec.index]));break;case Qk:0!==Kd[Ld.index]&&(hb.width=Math.min(hb.width,Kd[Ld.index]));break;case Rk:0!==Jd[ec.index]&&(hb.height=Math.min(hb.height,Jd[ec.index]))}isFinite(Ld.width)&&
(hb.width=Ld.width);isFinite(ec.height)&&(hb.height=ec.height);Id.h(0,0);for(var He=Ld.minimum,xh=ec.minimum,Ie=1;Ie<Oa.rowSpan&&!(Oa.row+Ie>=a.rowCount);Ie++)I=a.getRowDefinition(Oa.row+Ie),Ha=0,Ha=cb===qd||cb===Rk?Math.max(I.minimum,0===Jd[Oa.row+Ie]?I.maximum:Math.min(Jd[Oa.row+Ie],I.maximum)):Math.max(I.minimum,isNaN(I.Bd)?I.maximum:Math.min(I.Bd,I.maximum)),Id.height+=Ha,xh+=I.minimum;for(var Nc=1;Nc<Oa.columnSpan&&!(Oa.column+Nc>=a.columnCount);Nc++)I=a.getColumnDefinition(Oa.column+Nc),Ha=
0,Ha=cb===qd||cb===Qk?Math.max(I.minimum,0===Kd[Oa.column+Nc]?I.maximum:Math.min(Kd[Oa.column+Nc],I.maximum)):Math.max(I.minimum,isNaN(I.Bd)?I.maximum:Math.min(I.Bd,I.maximum)),Id.width+=Ha,He+=I.minimum;hb.width+=Id.width;hb.height+=Id.height;var $e=Oa.margin,yh=$e.right+$e.left,tn=$e.top+$e.bottom;Oa.measure(hb.width,hb.height,He,xh);for(var hg=Oa.measuredBounds,hd=Math.max(hg.width+yh,0),Md=Math.max(hg.height+tn,0),le=0,me=0;me<Oa.rowSpan&&!(Oa.row+me>=a.rowCount);me++)I=a.getRowDefinition(Oa.row+
me),le+=I.total||0;if(le<Md){var Nd=Md-le,ne=Md-le;if(null!==Oa.spanAllocation)for(var Yj=Oa.spanAllocation,Je=0;Je<Oa.rowSpan&&!(0>=Nd)&&!(Oa.row+Je>=a.rowCount);Je++){I=a.getRowDefinition(Oa.row+Je);var yi=I.la||0,un=Yj(Oa,I,ne);I.actual=Math.min(I.maximum,yi+un);I.la!==yi&&(Nd-=I.la-yi)}for(;0<Nd;){var id=I.la||0;isNaN(I.height)&&I.maximum>id&&(I.actual=Math.min(I.maximum,id+Nd),I.la!==id&&(Nd-=I.la-id));if(0===I.index)break;I=a.getRowDefinition(I.index-1)}}for(var Bf=0,zh=0;zh<Oa.columnSpan&&
!(Oa.column+zh>=a.columnCount);zh++)I=a.getColumnDefinition(Oa.column+zh),Bf+=I.total||0;if(Bf<hd){var ig=hd-Bf,Rt=hd-Bf;if(null!==Oa.spanAllocation)for(var St=Oa.spanAllocation,Zj=0;Zj<Oa.columnSpan&&!(0>=ig)&&!(Oa.column+Zj>=a.columnCount);Zj++){I=a.getColumnDefinition(Oa.column+Zj);var vn=I.la||0,Tt=St(Oa,I,Rt);I.actual=Math.min(I.maximum,vn+Tt);I.la!==vn&&(ig-=I.la-vn)}for(;0<ig;){var ak=I.la||0;isNaN(I.width)&&I.maximum>ak&&(I.actual=Math.min(I.maximum,ak+ig),I.la!==ak&&(ig-=I.la-ak));if(0===
I.index)break;I=a.getColumnDefinition(I.index-1)}}}}Ia(z);Gb.free(Id);Gb.free(hb);void 0!==Jd&&Ia(Jd);void 0!==Kd&&Ia(Kd);var jg=0,kg=0,bk=a.desiredSize,er=a.maxSize;cb=cl(a,!0);var zi=he=Dd=0,Ai=0;f=a.columnCount;for(var ck=0;ck<f;ck++)void 0!==a.ib[ck]&&(I=a.getColumnDefinition(ck),isFinite(I.width)?(zi+=I.width,zi+=I.Jc()):wm(I)===xm?(zi+=I.la,zi+=I.Jc()):0!==I.la&&(Dd+=I.la,Dd+=I.Jc()));isFinite(bk.width)?jg=Math.min(bk.width,er.width):jg=cb!==pg&&isFinite(b)?b:Dd;jg=Math.max(jg,a.minSize.width);
jg=Math.max(jg-zi,0);for(var Ut=0===Dd?1:Math.max(jg/Dd,1),ek=0;ek<f;ek++)void 0!==a.ib[ek]&&(I=a.getColumnDefinition(ek),isFinite(I.width)||wm(I)===xm||(I.actual=I.la*Ut),I.position=e.width,0!==I.la&&(e.width+=I.la,e.width+=I.Jc()));f=a.rowCount;for(var fk=0;fk<f;fk++)void 0!==a.ob[fk]&&(I=a.getRowDefinition(fk),isFinite(I.height)?(Ai+=I.height,Ai+=I.Jc()):wm(I)===xm?(Ai+=I.la,Ai+=I.Jc()):0!==I.la&&(he+=I.la,0!==I.la&&(he+=I.Jc())));isFinite(bk.height)?kg=Math.min(bk.height,er.height):kg=cb!==pg&&
isFinite(c)?c:he;kg=Math.max(kg,a.minSize.height);kg=Math.max(kg-Ai,0);for(var Vt=0===he?1:Math.max(kg/he,1),gk=0;gk<f;gk++)void 0!==a.ob[gk]&&(I=a.getRowDefinition(gk),isFinite(I.height)||wm(I)===xm||(I.actual=I.la*Vt),I.position=e.height,0!==I.la&&(e.height+=I.la,0!==I.la&&(e.height+=I.Jc())));f=h.length;for(var wn=0;wn<f;wn++){var jd=h[wn],xn=0,yn=0;jd.type===X.TableRow?(xn=e.width,I=a.getRowDefinition(jd.row),yn=I.actual):(I=a.getColumnDefinition(jd.column),xn=I.actual,yn=e.height);jd.measuredBounds.h(0,
0,xn,yn);dj(jd,!1);u[jd.row]||(u[jd.row]=[]);u[jd.row][jd.column]||(u[jd.row][jd.column]=[]);u[jd.row][jd.column].push(jd)}Ia(h);a.cp=u};
vm.prototype.arrange=function(a,b,c){var d=b.length,e=a.padding,f=e.left;e=e.top;for(var g=a.cp,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.ob[n]||0===a.ob[n].la);)n++;n=Math.min(n,l-1);n=-a.ob[n].position;for(h=Math.min(a.leftIndex,m-1);h!==m&&(void 0===a.ib[h]||0===a.ib[h].la);)h++;h=Math.min(h,m-1);for(var p=-a.ib[h].position,r=Gb.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.la&&
(k+=u.Lu());for(var w=0;w<m;w++)if(g[q][w]){var v=a.getColumnDefinition(w);h=v.position+p+f;0!==v.la&&(h+=v.Lu());for(var y=g[q][w],z=y.length,A=0;A<z;A++){var C=y[A],F=C.measuredBounds,R=C instanceof X?C:null;if(null===R||R.type!==X.TableRow&&R.type!==X.TableColumn){r.h(0,0);for(var J=1;J<C.rowSpan&&!(q+J>=a.rowCount);J++)R=a.getRowDefinition(q+J),r.height+=R.total;for(J=1;J<C.columnSpan&&!(w+J>=a.columnCount);J++)R=a.getColumnDefinition(w+J),r.width+=R.total;var S=v.la+r.width,L=u.la+r.height;J=
h;R=k;var I=S,ja=L,ca=h,pa=k,Na=S,fb=L;h+S>c.width&&(Na=Math.max(c.width-h,0));k+L>c.height&&(fb=Math.max(c.height-k,0));var Ga=C.alignment;if(Ga.Mb()){Ga=a.defaultAlignment;Ga.hb()||(Ga=yc);var Ha=Ga.x;var ud=Ga.y;var Wb=Ga.offsetX;Ga=Ga.offsetY;var Xb=v.alignment,gb=u.alignment;Xb.hb()&&(Ha=Xb.x,Wb=Xb.offsetX);gb.hb()&&(ud=gb.y,Ga=gb.offsetY)}else Ha=Ga.x,ud=Ga.y,Wb=Ga.offsetX,Ga=Ga.offsetY;if(isNaN(Ha)||isNaN(ud))ud=Ha=.5,Ga=Wb=0;Xb=F.width;gb=F.height;var vd=C.margin,Zf=vd.left+vd.right,$f=vd.top+
vd.bottom,Fe=vl(C,u,v,!1);!isNaN(C.desiredSize.width)||Fe!==qd&&Fe!==Qk||(Xb=Math.max(S-Zf,0));!isNaN(C.desiredSize.height)||Fe!==qd&&Fe!==Rk||(gb=Math.max(L-$f,0));S=C.maxSize;L=C.minSize;Xb=Math.min(S.width,Xb);gb=Math.min(S.height,gb);Xb=Math.max(L.width,Xb);gb=Math.max(L.height,gb);S=gb+$f;J+=I*Ha-(Xb+Zf)*Ha+Wb+vd.left;R+=ja*ud-S*ud+Ga+vd.top;C.visible&&(bc(ca,pa,Na,fb,J,R,F.width,F.height)?C.arrange(J,R,Xb,gb):C.arrange(J,R,Xb,gb,new N(ca,pa,Na,fb)))}else C.dl(),C.actualBounds.ea(),I=C.actualBounds,
J=N.allocAt(I.x,I.y,I.width,I.height),I.x=R.type===X.TableRow?f:h,I.y=R.type===X.TableColumn?e:k,I.width=F.width,I.height=F.height,C.actualBounds.freeze(),dl(C,!1),Ub(J,I)||(F=C.part,null!==F&&(F.Gh(),C.Eo(F))),N.free(J)}}}Gb.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 ym(){this.na="Base"}ma(ym,Fl);
ym.prototype.measure=function(){};ym.prototype.arrange=function(){};function zm(){this.na="Base"}ma(zm,Fl);zm.prototype.measure=function(){};zm.prototype.arrange=function(){};function Am(){this.na="Base"}ma(Am,Fl);
Am.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.sa=1;d.ck();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===rg?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.sa*=q;m!==d.scale&&(dj(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)};Am.prototype.arrange=function(a,b,c){b=b[0];var d=b.measuredBounds,e=b.margin,f=Math.max(d.width+(e.right+e.left),0);e=Math.max(d.height+(e.top+e.bottom),0);var g=b.alignment;g.Mb()&&(g=a.defaultAlignment);g.hb()||(g=yc);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 Bm(){this.na="Base"}ma(Bm,Fl);Bm.prototype.measure=function(){};
Bm.prototype.arrange=function(){};
Bm.prototype.pc=function(a,b,c){c=a.Af()*c.scale;0>=c&&(c=1);var d=a.gridCellSize,e=d.width;d=d.height;var f=a.naturalBounds,g=a.actualBounds,h=f.width,k=f.height,l=Math.ceil(h/e),m=Math.ceil(k/d),n=a.gridOrigin,p=n.x;n=n.y;b.save();b.beginPath();b.rect(0,0,h,k);b.clip();for(var r=[],q=a.U.l,u=q.length,w=0;w<u;w++){var v=q[w],y=[];r.push(y);if(v.visible){var z=v.interval;if(!(0>z)){v=Nj(v.figure);for(var A=0;A<u;A++)if(A!==w){var C=q[A];C.visible&&Nj(C.figure)===v&&(C=C.interval,C>z&&y.push(C))}}}}q=
a.U.l;u=q.length;for(w=0;w<u;w++){var F=q[w];if(F.visible&&(y=F.interval||1,v=Math.abs(y),!(2>e*v*c))){z=F.segmentIndex;if(!isFinite(z)||isNaN(z))z=0;0>z&&(z=v-Math.min(-z,v));z=Math.round(z%v);v=F.opacity;A=1;if(1!==v){if(0===v)continue;A=b.globalAlpha;b.globalAlpha=A*v}C=r[w];var R=!1,J=F.strokeDashArray;null!==J&&(R=!0,b.os(J,F.strokeDashOffset));if("LineV"===F.figure&&null!==F.stroke&&0<F.strokeWidth){b.lineWidth=F.strokeWidth;di(a,b,F.stroke,!1,!1,f,g);b.beginPath();for(J=F=Math.floor((p-e)/
e);J<=F+l;J++){var S=J*e+p;0<=S&&S<=h&&Cm(J,y,z,C)&&(b.moveTo(S,0),b.lineTo(S,k))}b.stroke()}else if("LineH"===F.figure&&null!==F.stroke&&0<F.strokeWidth){b.lineWidth=F.strokeWidth;di(a,b,F.stroke,!1,!1,f,g);b.beginPath();for(J=F=Math.floor((n-d)/d);J<=F+m;J++)S=J*d+n,0<=S&&S<=k&&Cm(J,y,z,C)&&(b.moveTo(0,S),b.lineTo(h,S));b.stroke()}else if("BarV"===F.figure&&null!==F.fill)for(di(a,b,F.fill,!0,!1,f,g),F=F.width,isNaN(F)&&(F=e),S=J=Math.floor((p-e)/e);S<=J+l;S++){var L=S*e+p;0<=L+F&&L<=h&&Cm(S,y,z,
C)&&b.fillRect(L,0,F,k)}else if("BarH"===F.figure&&null!==F.fill)for(di(a,b,F.fill,!0,!1,f,g),F=F.height,isNaN(F)&&(F=d),S=J=Math.floor((n-d)/d);S<=J+m;S++)L=S*d+n,0<=L+F&&L<=k&&Cm(S,y,z,C)&&b.fillRect(0,L,h,F);R&&b.ms();1!==v&&(b.globalAlpha=A)}}b.restore();b.Ic(!1)};function Cm(a,b,c,d){if(0>b)return a%b===c;if(a%b!==c)return!1;b=d.length;for(var e=0;e<b;e++)if(a%d[e]===c)return!1;return!0}function Dm(){this.na="Base"}ma(Dm,Fl);
Dm.prototype.measure=function(a,b,c,d,e){c=d.length;if(a instanceof ze||a instanceof T){var f=null,g=null,h=null;a instanceof T&&(g=f=a);a instanceof ze&&(h=a,f=h.adornedPart);if(f instanceof T){var k=f;if(0===c)Rb(a.naturalBounds,0,0),a.measuredBounds.h(0,0,0,0);else{var l=a instanceof ze?null:f.path,m=f.routeBounds;b=a.jg;b.h(0,0,m.width,m.height);var n=k.points;f=f.pointsCount;null!==h?h.hk(!1):null!==g&&g.hk(!1);var p=m.width,r=m.height;a.location.h(m.x,m.y);a.j.length=0;null!==l&&(Em(a,p,r,l),
h=l.measuredBounds,b.Rc(h),a.j.push(h));h=od.alloc();for(var q=K.alloc(),u=K.alloc(),w=0;w<c;w++){var v=d[w];if(v!==l)if(v.isPanelMain&&v instanceof xf){Em(a,p,r,v);var y=v.measuredBounds;b.Rc(y);a.j.push(y)}else if(2>f)v.measure(Infinity,Infinity,0,0),y=v.measuredBounds,b.Rc(y),a.j.push(y);else{var z=v.segmentIndex,A=v.segmentFraction,C=v.alignmentFocus;C.Cc()&&(C=yc);var F=v.segmentOrientation,R=v.segmentOffset;if(isNaN(z)){var J=k.ma;y=Ea();J.cv(A,y);var S=K.allocAt(y[0],y[1]);S.add(k.i(0));J.type===
P.j?S.offset(-J.startX,-J.startY):(J=J.figures.first(),S.offset(-J.startX,-J.startY));J=y[2];if(F!==Rf){var L=k.computeAngle(v,F,J);v.yb=L}L=S.x-m.x;var I=S.y-m.y;K.free(S);Ia(y)}else if(z<-f||z>=f)y=K.alloc(),k.vg(),k.computeMidPoint(y),J=k.midAngle,F!==Rf&&(L=k.computeAngle(v,F,J),v.yb=L),L=y.x-m.x,I=y.y-m.y,K.free(y);else{L=0;0<=z?(I=n.J(z),y=z<f-1?n.J(z+1):I):(L=f+z,I=n.J(L),y=0<L?n.J(L-1):I);if(I.Ua(y)){0<=z?(J=0<z?n.J(z-1):I,L=z<f-2?n.J(z+2):y):(J=L<f-1?n.J(L+1):I,L=1<L?n.J(L-2):y);S=J.xf(I);
var ja=y.xf(L);J=S>ja+10?0<=z?J.Pa(I):I.Pa(J):ja>S+10?0<=z?y.Pa(L):L.Pa(y):0<=z?J.Pa(L):L.Pa(J)}else J=0<=z?I.Pa(y):y.Pa(I);F!==Rf&&(L=k.computeAngle(v,F,J),v.yb=L);L=I.x+(y.x-I.x)*A-m.x;I=I.y+(y.y-I.y)*A-m.y}v.measure(Infinity,Infinity,0,0);y=v.measuredBounds;S=v.naturalBounds;var ca=0;v instanceof xf&&(ca=v.strokeWidth);ja=S.width+ca;var pa=S.height+ca;h.reset();h.translate(-y.x,-y.y);h.scale(v.scale,v.scale);h.rotate(F===Rf?v.angle:J,ja/2,pa/2);F!==Fm&&F!==Gm||h.rotate(90,ja/2,pa/2);F!==Hm&&F!==
Im||h.rotate(-90,ja/2,pa/2);F===Jm&&(45<J&&135>J||225<J&&315>J)&&h.rotate(-J,ja/2,pa/2);S=new N(0,0,ja,pa);q.Ti(S,C);h.Aa(q);C=-q.x+ca/2*v.scale;v=-q.y+ca/2*v.scale;u.assign(R);ca=isNaN(R.x);var Na=isNaN(R.y);if(ca||Na){ja=ja/2+3;pa=pa/2+3;var fb=45<=J&&135>=J,Ga=225<=J&&315>=J;F===Rf&&(fb||Ga)?(u.x=Na?ja:R.y,u.y=ca?pa:R.x,fb?0<=z||isNaN(z)&&.5>A||!ca||(u.y=-pa):Ga&&((0<=z||isNaN(z)&&.5>A)&&ca&&(u.y=-pa),Na&&(u.x=-ja))):(ca&&(u.x=0<=z||isNaN(z)&&.5>A?ja:-ja),Na&&(u.y=-pa),u.rotate(J))}else u.rotate(J);
L+=u.x;I+=u.y;S.set(y);S.h(L+C,I+v,y.width,y.height);a.j.push(S);b.Rc(S)}}if(null!==g)for(d=g.labelNodes;d.next();)d.value.measure(Infinity,Infinity);a.jg=b;a=a.location;a.h(a.x+b.x,a.y+b.y);Rb(e,b.width||0,b.height||0);od.free(h);K.free(q);K.free(u)}}}};
Dm.prototype.arrange=function(a,b){var c=b.length;if(a instanceof ze||a instanceof T){var d=null,e=null,f=null;a instanceof T&&(e=d=a);a instanceof ze&&(f=a,d=f.adornedPart);var g=a instanceof ze?null:d.path;if(0!==a.j.length){var h=a.j,k=0;if(null!==g&&k<a.j.length){var l=h[k];k++;g.arrange(l.x-a.jg.x,l.y-a.jg.y,l.width,l.height)}for(l=0;l<c;l++){var m=b[l];if(m!==g&&k<a.j.length){var n=h[k];k++;m.arrange(n.x-a.jg.x,n.y-a.jg.y,n.width,n.height)}}}b=d.points;c=b.count;if(2<=c&&a instanceof T)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.ma;var q=Ea();n.cv(k,q);var u=K.allocAt(q[0],q[1]);u.add(p.i(0));n.type===P.j?u.offset(-n.startX,-n.startY):(n=n.figures.first(),u.offset(-n.startX,-n.startY));n=q[2];l!==Rf&&(p=p.computeAngle(g,l,n),g.angle=p);p=u.x;var w=u.y;K.free(u);Ia(q)}else if(h<-c||h>=c)q=K.alloc(),n=p,w=q,n.vg(),n.computeMidPoint(w),n=p.midAngle,l!==Rf&&(p=p.computeAngle(g,
l,n),g.angle=p),p=q.x,w=q.y,K.free(q);else{u=0;0<=h?(q=b.l[h],w=h<c-1?b.l[h+1]:q):(u=c+h,q=b.l[u],w=0<u?b.l[u-1]:q);if(q.Ua(w)){0<=h?(n=0<h?b.l[h-1]:q,u=h<c-2?b.l[h+2]:w):(n=u<c-1?b.l[u+1]:q,u=1<u?b.l[u-2]:w);var v=n.xf(q),y=w.xf(u);n=v>y+10?0<=h?n.Pa(q):q.Pa(n):y>v+10?0<=h?w.Pa(u):u.Pa(w):0<=h?n.Pa(u):u.Pa(n)}else n=0<=h?q.Pa(w):w.Pa(q);l!==Rf&&(p=p.computeAngle(g,l,n),g.angle=p);p=q.x+(w.x-q.x)*k;w=q.y+(w.y-q.y)*k}if(r.Es())g.location=new K(p,w);else{r.Cc()&&(r=yc);q=od.alloc();q.reset();q.scale(g.scale,
g.scale);q.rotate(g.angle,0,0);var z=g.naturalBounds;u=N.allocAt(0,0,z.width,z.height);v=K.alloc();v.Ti(u,r);q.Aa(v);r=-v.x;y=-v.y;var A=z.width,C=z.height;z=K.alloc();z.assign(m);var F=isNaN(m.x),R=isNaN(m.y);if(F||R){A=A/2+3;C=C/2+3;var J=45<=n&&135>=n,S=225<=n&&315>=n;l===Rf&&(J||S)?(z.x=R?A:m.y,z.y=F?C:m.x,J?0<=h||isNaN(h)&&.5>k||!F||(z.y=-C):S&&((0<=h||isNaN(h)&&.5>k)&&F&&(z.y=-C),R&&(z.x=-A))):(F&&(z.x=0<=h||isNaN(h)&&.5>k?A:-A),R&&(z.y=-C),z.rotate(n))}else z.rotate(n);p+=z.x;w+=z.y;q.xq(u);
r+=u.x;y+=u.y;h=K.allocAt(p+r,w+y);g.move(h);K.free(h);K.free(z);K.free(v);N.free(u);od.free(q)}}null!==f?f.hk(!1):null!==e&&e.hk(!1)}};
function Em(a,b,c,d){if(!1!==ij(d)){var e=d.strokeWidth;0===e&&a instanceof ze&&a.type===X.Link&&a.adornedObject instanceof xf&&(e=a.adornedObject.strokeWidth);e*=d.sa;a instanceof T&&null!==a.ma?(a=a.ma.bounds,d.xe(a.x-e/2,a.y-e/2,a.width+e,a.height+e)):a instanceof ze&&null!==a.adornedPart.ma?(a=a.adornedPart.ma.bounds,d.xe(a.x-e/2,a.y-e/2,a.width+e,a.height+e)):d.xe(-(e/2),-(e/2),b+e,c+e);dj(d,!1)}}function Km(){this.na="Base"}ma(Km,Fl);
Km.prototype.measure=function(a,b,c,d,e,f,g){var h=a.pb();a.Qg=[];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.Qg.push(p);e.assign(p);for(var r=h.geometry,q=h.strokeWidth,u=r.flattenedSegments,w=r.flattenedLengths,v=r.flattenedTotalLength,y=u.length,z=0,A=0,C=Ea(),F=0;F<y;F++){var R=u[F],J=[];A=z=0;for(var S=R.length,L=0;L<S;L+=2){var I=R[L],ja=R[L+1];if(0!==L){var ca=180*Math.atan2(ja-
A,I-z)/Math.PI;0>ca&&(ca+=360);J.push(ca)}z=I;A=ja}C.push(J)}if(null===a.Rf){for(var pa=[],Na=a.U.l,fb=Na.length,Ga=0;Ga<fb;Ga++){var Ha=Na[Ga],ud=[];pa.push(ud);if(Ha.visible){var Wb=Ha.interval;if(!(0>Wb))for(var Xb=0;Xb<fb;Xb++)if(Xb!==Ga){var gb=Na[Xb];if(gb.visible&&Ha.constructor===gb.constructor){var vd=gb.interval;vd>Wb&&ud.push(vd)}}}}a.Rf=pa}var Zf=a.Rf;var $f=a.U.l,Fe=$f.length,Bb=0,oh=0,ag=v;a.kj=[];for(var ph,qh=0;qh<Fe;qh++){var cb=$f[qh];ph=[];if(cb.visible&&cb!==h){var vi=Math.abs(cb.interval),
Wj=a.graduatedTickUnit;if(!(2>Wj*vi*v/a.graduatedRange)){var bg=w[0][0],gd=0,ic=0;oh=v*cb.graduatedStart-1E-4;ag=v*cb.graduatedEnd+1E-4;var zf=Wj*vi,sc=a.graduatedTickBase;if(sc<a.graduatedMin){var cg=(a.graduatedMin-sc)/zf;cg=0===cg%1?cg:Math.floor(cg+1);sc+=cg*zf}else sc>a.graduatedMin+zf&&(sc-=Math.floor((sc-a.graduatedMin)/zf)*zf);for(var rh=Zf[qh],qn=sc,Dd=1;sc<a.graduatedMax+5E-8;Dd++){a:{for(var he=rh.length,dg=0;dg<he;dg++)if(M.aa((sc-a.graduatedTickBase)%(rh[dg]*a.graduatedTickUnit),0)){var eg=
!1;break a}eg=!0}if(eg&&(null===cb.graduatedSkip||!cb.graduatedSkip(sc))&&(Bb=(sc-a.graduatedMin)*v/a.graduatedRange,Bb>v&&(Bb=v),oh<=Bb&&Bb<=ag)){for(var Uc=C[gd][ic],ie=w[gd][ic];gd<w.length;){for(;Bb>bg&&ic<w[gd].length-1;)ic++,Uc=C[gd][ic],ie=w[gd][ic],bg+=ie;if(Bb<=bg)break;gd++;ic=0;Uc=C[gd][ic];ie=w[gd][ic];bg+=ie}var cc=u[gd],sh=cc[2*ic],th=cc[2*ic+1],Vc=(Bb-(bg-ie))/ie,wi=new K(sh+(cc[2*ic+2]-sh)*Vc+q/2-r.bounds.x,th+(cc[2*ic+3]-th)*Vc+q/2-r.bounds.y);wi.scale(h.scale,h.scale);var je=Uc,
Ye=C[gd];1E-4>Vc?0<ic?je=Ye[ic-1]:M.aa(cc[0],cc[cc.length-2])&&M.aa(cc[1],cc[cc.length-1])&&(je=Ye[Ye.length-1]):.9999<Vc&&(ic+1<Ye.length?je=Ye[ic+1]:M.aa(cc[0],cc[cc.length-2])&&M.aa(cc[1],cc[cc.length-1])&&(je=Ye[0]));Uc!==je&&(180<Math.abs(Uc-je)&&(Uc<je?Uc+=360:je+=360),Uc=(Uc+je)/2%360);if(cb instanceof Mg){var wd="";null!==cb.graduatedFunction?(wd=cb.graduatedFunction(sc),wd=null!==wd&&void 0!==wd?wd.toString():""):wd=(+sc.toFixed(2)).toString();""!==wd&&ph.push({lm:wi,angle:Uc,text:wd})}else ph.push({lm:wi,
angle:Uc})}sc=qn+Dd*zf}}}a.kj.push(ph)}Ia(C);var Xj=a.kj;if(null!==Xj)for(var rn=d.length,Af=0;Af<rn;Af++){var Cb=d[Af],Ed=Xj[Af];if(Cb.visible&&Cb!==h&&0!==Ed.length){if(Cb instanceof xf){var hb=a,xi=e,Yb=Cb.alignmentFocus;Yb.Cc()&&(Yb=vc);var tc=Cb.angle;Cb.yb=0;Cb.measure(Infinity,Infinity,0,0);Cb.yb=tc;var jc=Cb.measuredBounds,Fd=jc.width,Gd=jc.height,fg=N.allocAt(0,0,Fd,Gd),Dc=K.alloc();Dc.Ti(fg,Yb);N.free(fg);for(var uh=-Dc.x,gg=-Dc.y,Hd=new N,vh=Ed.length,Ze=0;Ze<vh;Ze++)for(var Id=Ed[Ze],
Jd=Id.lm.x,Kd=Id.lm.y,Ge=Id.angle,wh=0;4>wh;wh++){switch(wh){case 0:Dc.h(uh,gg);break;case 1:Dc.h(uh+Fd,gg);break;case 2:Dc.h(uh,gg+Gd);break;case 3:Dc.h(uh+Fd,gg+Gd)}Dc.rotate(Ge+Cb.angle);Dc.offset(Jd,Kd);0===Ze&&0===wh?Hd.h(Dc.x,Dc.y,0,0):Hd.Oe(Dc);Dc.offset(-Jd,-Kd);Dc.rotate(-Ge-Cb.angle)}K.free(Dc);null!==hb.Qg&&hb.Qg.push(Hd);ac(xi,Hd.x,Hd.y,Hd.width,Hd.height)}else if(Cb instanceof Mg){var ke=a,sn=e;null===ke.qh&&(ke.qh=new Mg);var dc=ke.qh;Lm(dc,Cb);var Oa=Cb.alignmentFocus;Oa.Cc()&&(Oa=
vc);for(var ec=Cb.segmentOrientation,Ld=Cb.segmentOffset,He=new N,xh=0,Ie=0,Nc=0,$e=0,yh=0,tn=Ed.length,hg=0;hg<tn;hg++){var hd=Ed[hg];xh=hd.lm.x;Ie=hd.lm.y;Nc=hd.angle;yh=$e=Cb.angle;ec!==Rf&&(yh=ec===Mm||ec===Nm?Nc+Cb.angle:Nc,$e=T.computeAngle(ec,yh));dc.yb=$e;dc.text=hd.text||"";dc.measure(Infinity,Infinity,0,0);var Md=dc.measuredBounds,le=dc.naturalBounds,me=le.width,Nd=le.height,ne=od.alloc();ne.reset();ne.translate(-Md.x,-Md.y);ne.scale(dc.scale,dc.scale);ne.rotate(yh,me/2,Nd/2);ec!==Fm&&ec!==
Gm||ne.rotate(90,me/2,Nd/2);ec!==Hm&&ec!==Im||ne.rotate(-90,me/2,Nd/2);ec===Jm&&(45<Nc&&135>Nc||225<Nc&&315>Nc)&&ne.rotate(-Nc,me/2,Nd/2);var Yj=N.allocAt(0,0,me,Nd),Je=K.alloc();Je.Ti(Yj,Oa);ne.Aa(Je);var yi=-Je.x,un=-Je.y,id=K.alloc();id.assign(Ld);isNaN(id.x)&&(id.x=me/2+3);isNaN(id.y)&&(id.y=-(Nd/2+3));id.rotate(Nc);xh+=id.x+yi;Ie+=id.y+un;var Bf=new N(xh,Ie,Md.width,Md.height),zh=new N(Md.x,Md.y,Md.width,Md.height),ig=new N(le.x,le.y,le.width,le.height);hd.pA=$e;hd.lineCount=dc.lineCount;hd.lines=
[dc.rb,dc.ei,dc.qe,dc.Ce,dc.Ec,dc.Sb,dc.oe];hd.actualBounds=Bf;hd.measuredBounds=zh;hd.naturalBounds=ig;0===hg?He.assign(Bf):He.Rc(Bf);K.free(id);K.free(Je);N.free(Yj);od.free(ne)}null!==ke.Qg&&ke.Qg.push(He);ac(sn,He.x,He.y,He.width,He.height)}dj(Cb,!1)}}};
Km.prototype.arrange=function(a,b,c){if(null!==a.Qg){var d=a.pb(),e=a.kj;if(null!==e){var f=a.Qg,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.Qg=null}}};
Km.prototype.pc=function(a,b,c){var d=c.pj;c.pj=!0;var e=a.naturalBounds,f=e.width;e=e.height;b.save();b.beginPath();b.rect(-1,-1,f+1,e+1);b.clip();f=a.pb();f.pc(b,c);e=a.Af()*c.scale;0>=e&&(e=1);for(var g=f.actualBounds,h=a.U.l,k=a.kj,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 xf){if(!(2>a.graduatedTickUnit*n.interval*f.geometry.flattenedTotalLength/a.graduatedRange*e)){var q=n.measuredBounds,u=n.strokeWidth*n.scale,w=n.alignmentFocus;w.Cc()&&
(w=vc);for(var v=0;v<r;v++){var y=p[v].lm,z=p[v].angle,A=w,C=n.ub;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);sl(n,!1);n.Nh.set(n.ub);n.Sk=n.scale;tl(n,!1);n.pc(b,c);n.ub.reset()}}}else if(n instanceof Mg)for(null===a.qh&&(a.qh=new Mg),q=a.qh,Lm(q,n),n=0;n<r;n++)u=p[n],u.actualBounds&&u.measuredBounds&&u.naturalBounds&&(q.Xb=u.text||"",q.yb=u.pA||0,q.Xc=u.lineCount||0,w=u.lines,void 0!==
w&&(q.rb=w[0],q.ei=w[1],q.qe=w[2],q.Ce=w[3],q.Ec=w[4],q.Sb=w[5],q.oe=w[6]),u.naturalBounds&&(q.xc=u.naturalBounds),u.actualBounds&&(w=u.actualBounds,q.arrange(w.x,w.y,w.width,w.height)),w=u.actualBounds,q.arrange(w.x,w.y,w.width,w.height),v=u.measuredBounds,u=u.naturalBounds,y=q.ub,y.reset(),y.translate(w.x+g.x,w.y+g.y),y.translate(-v.x,-v.y),q.np(y,u.x,u.y,u.width,u.height),sl(q,!1),q.Nh.set(q.ub),q.Sk=q.scale,tl(q,!1),q.pc(b,c))}c.pj=d;b.restore();b.Ic(!0)};
function X(a,b){Y.call(this);this.ha=null;if(void 0===a)this.ha=X.Position;else if("string"===typeof a){var c=El.H(a);null!==c&&(this.ha=c)}else a instanceof Fl?this.ha=a:a&&(this.ha=X.Position,b=a);null===this.ha&&B("Panel type not specified or PanelLayout not loaded: "+a);this.U=new E;this.nb=pc;this.ha===X.Grid&&(this.G|=1048576);this.mn=Wc;this.Of=Pk;this.ha===X.Table&&Om(this);this.Hp=rg;this.Kn=Lb;this.Ln=zb;this.Hn=0;this.Gn=100;this.Jn=10;this.In=0;this.Qh=this.jb=this.Rf=this.Qg=this.kj=
null;this.ao=NaN;this.ue=this.ci=null;this.hl="category";this.$d=null;this.jg=new N(NaN,NaN,NaN,NaN);this.qh=this.cp=this.ph=null;this.Re="";b&&Object.assign(this,b)}ma(X,Y);function Om(a){a.fj=pc;a.Hg=1;a.Wh=null;a.Vh=null;a.Gg=1;a.Fg=null;a.Uh=null;a.ob=[];a.ib=[];a.Fj=Pm;a.ej=Pm;a.vi=0;a.gi=0}
X.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.ha=this.ha;a.nb=this.nb.I();a.mn=this.mn.I();a.Of=this.Of;if(a.ha===X.Table){a.fj=this.fj.I();a.Hg=this.Hg;a.Wh=this.Wh;a.Vh=this.Vh;a.Gg=this.Gg;a.Fg=this.Fg;a.Uh=this.Uh;var b=[];if(0<this.ob.length)for(var c=this.ob,d=c.length,e=0;e<d;e++)if(void 0!==c[e]){var f=c[e].copy();f.Si(a);b[e]=f}a.ob=b;b=[];if(0<this.ib.length)for(c=this.ib,d=c.length,e=0;e<d;e++)void 0!==c[e]&&(f=c[e].copy(),f.Si(a),b[e]=f);a.ib=b;a.Fj=
this.Fj;a.ej=this.ej;a.vi=this.vi;a.gi=this.gi}a.Hp=this.Hp;a.Kn=this.Kn.I();a.Ln=this.Ln.I();a.Hn=this.Hn;a.Gn=this.Gn;a.Jn=this.Jn;a.In=this.In;a.kj=this.kj;a.Rf=this.Rf;a.jb=this.jb;a.Qh=this.Qh;a.ao=this.ao;a.ci=this.ci;a.ue=this.ue;a.hl=this.hl;a.jg.assign(this.jg);a.Re=this.Re;null!==this.cp&&(a.cp=this.cp)};X.prototype.wf=function(a){Y.prototype.wf.call(this,a);a.U=this.U;for(var b=a.U.l,c=b.length,d=0;d<c;d++)b[d].bg=a;a.ph=null};
X.prototype.copy=function(){var a=Y.prototype.copy.call(this);if(null!==a){for(var b=this.U.l,c=b.length,d=0;d<c;d++){var e=b[d].copy();e.Si(a);e.Dj=null;var f=a.U,g=f.count;f.vb(g,e);f=a.part;if(null!==f){f.li=null;null!==e.portId&&f instanceof W&&(f.Je=!0);var h=a.diagram;null!==h&&h.undoManager.isUndoingRedoing||f.Wa(pe,"elements",a,null,e,null,g)}}return a}return null};t=X.prototype;t.toString=function(){return"Panel("+this.type.name+")#"+ib(this)};
t.Eo=function(a){Y.prototype.Eo.call(this,a);for(var b=this.U.l,c=b.length,d=0;d<c;d++)b[d].Eo(a)};
t.Ei=function(a,b){if(this.ha===X.Grid)a.Ed(),this.ha.pc(this,a,b);else if(this.ha===X.Graduated)a.Ed(),this.ha.pc(this,a,b);else{this.ha===X.Table&&(a.Ed(),a.lineCap="butt",Qm(this,a,!0,this.ob,!0),Qm(this,a,!1,this.ib,!0),Rm(this,a,!0,this.ob),Rm(this,a,!1,this.ib),Qm(this,a,!0,this.ob,!1),Qm(this,a,!1,this.ib,!1));var c=this.isClipping&&this.ha===X.Spot;c&&a.save();for(var d=this.pb(),e=this.U.l,f=e.length,g=0;g<f;g++){var h=e[g];c&&h===d&&(a.clipInsteadOfFill=!0);h.pc(a,b);c&&h===d&&(a.clipInsteadOfFill=
!1)}c&&(a.restore(),a.Ic(!0))}};
function Rm(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.Hg:a.Gg);var n=l.separatorStroke;null===n&&(n=c?a.Wh:a.Fg);if(0!==m&&null!==n){di(a,b,n,!1,!1,g,f);n=!1;var p=l.separatorDashArray;null===p&&(p=c?a.Vh:a.Uh);null!==p&&(n=!0,b.os(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.nb;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.ms()}}}}
function Qm(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.Jc(),p=l.separatorStrokeWidth;isNaN(p)&&(p=c?a.Hg:a.Gg);var r=l.separatorStroke;null===r&&(r=c?a.Wh:a.Fg);null===r&&(p=0);n-=p;p=l.position+p;n+=l.actual;p+n>m&&(n=m-p);0>=n||(m=a.nb,di(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 Nj(a){return"LineV"===a||"BarV"===a}
t.ak=function(a,b,c,d,e){var f=this.ie(),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,M.Cf(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=M.Cf(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.U.l;r=n.length;m=K.alloc();p=null;b=Infinity;var q=null,u=this.isClipping&&this.ha===X.Spot;u&&(q=K.alloc(),p=this.pb(),(l=p.ak(h,a,k,c,q))&&(b=(h-q.x)*(h-q.x)+(a-q.y)*(a-q.y)));for(var w=0;w<r;w++){var v=n[w];v.visible&&v!==p&&v.ak(h,a,k,c,m)&&(l=!0,v=(h-m.x)*(h-m.x)+(a-m.y)*(a-m.y),v<d&&(d=v,e.set(m)))}u&&(b>d&&e.set(q),K.free(q));K.free(m);f&&e.transform(g);return l};
t.s=function(a){if(!ij(this)){Y.prototype.s.call(this,a);a=null;if(this.ha===X.Auto||this.ha===X.Link)a=this.pb();for(var b=this.U.l,c=b.length,d=0;d<c;d++){var e=b[d];(e===a||e.isPanelMain)&&e.s(!0);if(!e.desiredSize.u()){var f=cl(e,!1);(e instanceof ng||e instanceof X||e instanceof Mg||f!==pg)&&e.s(!0)}}}};t.ck=function(){if(!ij(this)){dj(this,!0);dl(this,!0);for(var a=this.U.l,b=a.length,c=0;c<b;c++)a[c].ck()}};
t.dl=function(){if(0!==(this.G&2048)===!1){sl(this,!0);tl(this,!0);for(var a=this.U.l,b=a.length,c=0;c<b;c++)a[c].kv()}};t.kv=function(){tl(this,!0);for(var a=this.U.l,b=a.length,c=0;c<b;c++)a[c].kv()};
t.im=function(a,b,c,d){var e=this.jg;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.nb;a=Math.max(a-k.left-k.right,0);b=Math.max(b-k.top-k.bottom,0);var l=this.U.l;0!==l.length&&this.ha.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);Rb(e,a,k);Rb(this.naturalBounds,a,k);this.xe(0,0,a,k)};t.pb=function(){if(null===this.ph){var a=this.U.l,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.ph=d}this.ph=a[0]}return this.ph};function nm(a){return null!==a.part?a.part.locationObject:null}
t.zh=function(a,b,c,d){var e=this.U.l;this.actualBounds.h(a,b,c,d);if(0!==e.length){if(!this.desiredSize.u()){a=cl(this,!0);var f=this.measuredBounds;b=f.width;f=f.height;var g=this.Vg,h=g.left+g.right;g=g.top+g.bottom;b===c&&f===d&&(a=pg);switch(a){case pg:if(b>c||f>d)this.s(),this.measure(b>c?c:b,f>d?d:f,0,0);break;case qd:this.s(!0);this.measure(c+h,d+g,0,0);break;case Qk:this.s(!0);this.measure(c+h,f+g,0,0);break;case Rk:this.s(!0),this.measure(b+h,d+g,0,0)}}this.ha.arrange(this,e,this.jg)}};
t.Bh=function(a){var b=this.naturalBounds,c=nm(this);if(bc(0,0,b.width,b.height,a.x,a.y)){b=this.U.l;for(var d=b.length,e=K.allocAt(0,0);d--;){var f=b[d];if(f.visible||f===c)if(ub(e.set(a),f.transform),f.$(e))return K.free(e),!0}K.free(e);return null===this.Ub&&null===this.hd?!1:!0}return!1};t.ps=function(a){if(this.Dk===a)return this;for(var b=this.U.l,c=b.length,d=0;d<c;d++){var e=b[d].ps(a);if(null!==e)return e}return null};
t.Em=function(a,b){b(this,a);if(a instanceof X){a=a.U.l;for(var c=a.length,d=0;d<c;d++)this.Em(a[d],b)}};function vj(a,b){Sm(a,a,b)}function Sm(a,b,c){c(b);b=b.U.l;for(var d=b.length,e=0;e<d;e++){var f=b[e];f instanceof X&&Sm(a,f,c)}}function Tm(a,b){Um(a,a,b)}function Um(a,b,c){c(b);if(b instanceof X){b=b.U.l;for(var d=b.length,e=0;e<d;e++)Um(a,b[e],c)}}t.$l=function(a){return Vm(this,this,a)};
function Vm(a,b,c){if(c(b))return b;if(b instanceof X){b=b.U.l;for(var d=b.length,e=0;e<d;e++){var f=Vm(a,b[e],c);if(null!==f)return f}}return null}t.Ya=function(a){if(this.name===a)return this;var b=this.U.l,c=b.length;null===this.ci&&null===this.ue||(c=Wm(this));for(var d=0;d<c;d++){var e=b[d];if(e instanceof X){var f=e.Ya(a);if(null!==f)return f}if(e.name===a)return e}return null};
function Xm(a){a=a.U.l;for(var b=a.length,c=0,d=0;d<b;d++){var e=a[d];e instanceof X?c=Math.max(c,Xm(e)):e instanceof xf&&(c=Math.max(c,e.ig/2*e.Kj*e.Af()))}return c}t.ie=function(){return!(this.type===X.TableRow||this.type===X.TableColumn)};
t.Zb=function(a,b,c){if(!1===this.pickable)return null;void 0===b&&(b=null);void 0===c&&(c=null);if(jj(this))return null;var d=this.naturalBounds,e=1/this.Af(),f=this.ie(),g=f?a:ub(K.allocAt(a.x,a.y),this.transform),h=this.diagram,k=10,l=5;null!==h&&(k=h.cm("extraTouchArea"),l=k/2);if(bc(-(l*e),-(l*e),d.width+k*e,d.height+k*e,g.x,g.y)){if(!this.isAtomic){e=this.U.l;var m=e.length;h=K.alloc();l=(k=this.isClipping&&this.ha===X.Spot)?this.pb():null;if(k&&(l.ie()?ub(h.set(a),l.transform):h.set(a),!l.$(h)))return K.free(h),
f||K.free(g),null;for(var n=nm(this);m--;){var p=e[m];if(p.visible||p===n)if(p.ie()?ub(h.set(a),p.transform):h.set(a),!k||p!==l){var r=null;p instanceof X?r=p.Zb(h,b,c):!0===p.pickable&&p.$(h)&&(r=p);if(null!==r&&(null!==b&&(r=b(r)),null!==r&&(null===c||c(r))))return K.free(h),f||K.free(g),r}}K.free(h)}if(null===this.background&&null===this.areaBackground)return f||K.free(g),null;a=bc(0,0,d.width,d.height,g.x,g.y)?this:null;f||K.free(g);return a}f||K.free(g);return null};
t.Hi=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.ie(),g=f?a:ub(K.allocAt(a.x,a.y),this.transform);e=bc(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.U.l,k=h.length,l=K.alloc(),m=nm(this);k--;){var n=h[k];if(n.visible||n===m){n.ie()?ub(l.set(a),n.transform):l.set(a);var p=n;n=n instanceof X?n:null;(null!==n?n.Hi(l,b,c,d):p.$(l))&&!1!==p.pickable&&
(null!==b&&(p=b(p)),null===p||null!==c&&!c(p)||d.add(p))}}K.free(l)}f||K.free(g);return e&&(null!==this.background||null!==this.areaBackground)}f||K.free(g);return!1};
t.zf=function(a,b,c,d,e,f){if(!1===this.pickable)return!1;void 0===b&&(b=null);void 0===c&&(c=null);var g=f;void 0===f&&(g=od.alloc(),g.reset());g.multiply(this.transform);if(this.Ah(a,g))return Ym(this,b,c,e),void 0===f&&od.free(g),!0;if(this.Mc(a,g)){if(!this.isAtomic)for(var h=nm(this),k=this.U.l,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=od.alloc();p.set(g);
if(null!==m?m.zf(a,b,c,d,e,p):bl(n,a,d,p))null!==b&&(n=b(n)),null===n||null!==c&&!c(n)||e.add(n);od.free(p)}}}void 0===f&&od.free(g);return d}void 0===f&&od.free(g);return!1};function Ym(a,b,c,d){for(var e=a.U.l,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&&Ym(g,b,c,d),null!==b&&(g=b(g)),null===g||null!==c&&!c(g)||d.add(g))}}}
t.qg=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.ie(),k=h?a:ub(K.allocAt(a.x,a.y),this.transform),l=h?b:ub(K.allocAt(b.x,b.y),this.transform),m=k.xf(l),n=0<k.x&&k.x<g.width&&0<k.y&&k.y<g.height||vb(k.x,k.y,0,0,0,g.height)<=m||vb(k.x,k.y,0,g.height,g.width,g.height)<=m||vb(k.x,k.y,g.width,g.height,g.width,0)<=m||vb(k.x,k.y,g.width,0,0,0)<=m;g=k.pd(0,0)<=m&&k.pd(0,g.height)<=m&&k.pd(g.width,0)<=m&&k.pd(g.width,g.height)<=
m;h||(K.free(k),K.free(l));if(n){if(!this.isAtomic){k=K.alloc();l=K.alloc();m=nm(this);for(var p=this.U.l,r=p.length;r--;){var q=p[r];if(q.visible||q===m){var u=q.actualBounds,w=this.naturalBounds;if(!h||!(u.x>w.width||u.y>w.height||0>u.x+u.width||0>u.y+u.height))if(q.ie()?(u=q.transform,ub(k.set(a),u),ub(l.set(b),u)):(k.set(a),l.set(b)),u=q,q=q instanceof X?q:null,null!==q?q.qg(k,l,c,d,e,f):u.Sx(k,l,e))null!==c&&(u=c(u)),null===u||null!==d&&!d(u)||f.add(u)}}K.free(k);K.free(l)}return e?n:g}return!1};
function tm(a){var b=null;a instanceof xf&&(b=a.spot1,b===Wc&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot1));null===b&&(b=uc);return b}function um(a){var b=null;a instanceof xf&&(b=a.spot2,b===Wc&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot2));null===b&&(b=Cc);return b}t.add=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];for(c=0;c<b.length;c++)this.vb(this.U.count,b[c]);return this};t.J=function(a){return this.U.J(a)};
t.vb=function(a,b){b instanceof V&&B("Cannot add a Part to a Panel: "+b+"; use a Panel instead");if(this===b||this.sg(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.ha!==X.Grid||b instanceof xf||B("Can only add Shapes to a Grid Panel, not: "+b);this.ha!==X.Graduated||b instanceof xf||b instanceof Mg||B("Can only add Shapes or TextBlocks to a Graduated Panel, not: "+b);b.Si(this);b.Dj=null;if(null!==this.itemArray){var d=b.data;null!==d&&"object"===typeof d&&(null===this.$d&&(this.$d=new H),this.$d.add(d,b))}var e=this.U;d=-1;if(c===this){for(var f=-1,g=this.U.l,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.eb(f);d=f}else B("element "+b.toString()+" has panel "+c.toString()+" but is not contained by it.")}if(0>a||a>e.count)a=e.count;e.vb(a,b);if(0===a||b.isPanelMain)this.ph=null;ij(this)||this.s();b.s(!1);null!==b.portId?this.Je=!0:b instanceof X&&!0===b.Je&&(this.Je=!0);this.Rf=null;this.Ef()||Zm(this,b,!1);c=this.part;null!==c&&(c.li=null,c.Xf=NaN,this.Je&&c instanceof W&&(c.Je=!0),c.Je&&c instanceof W&&(c.oc=null),e=this.diagram,null!==e&&e.undoManager.isUndoingRedoing||(-1!==d&&c.Wa(qe,"elements",
this,b,null,d,null),c.Wa(pe,"elements",this,null,b,null,a)))};function $m(a,b){a.G=b?a.G|16777216:a.G&-16777217}t.remove=function(a){for(var b=this.U.l,c=b.length,d=-1,e=0;e<c;e++)if(b[e]===a){d=e;break}-1!==d&&this.rc(d,!0)};t.eb=function(a){0<=a&&this.rc(a,!0)};
t.rc=function(a,b){var c=this.U,d=c.J(a);d.Dj=null;d.Si(null);if(null!==this.$d){var e=d.data;"object"===typeof e&&this.$d.remove(e)}c.eb(a);dj(this,!1);this.s();this.ph===d&&(this.ph=null);this.Rf=null;var f=this.part;null!==f&&(f.li=null,f.Xf=NaN,f.Lb(),f instanceof W&&(d instanceof X?d.Em(d,function(a,c){Jl(f,c,b)}):Jl(f,d,b)),c=this.diagram,null!==c&&c.undoManager.isUndoingRedoing||f.Wa(qe,"elements",this,d,null,a,null))};
X.prototype.getRowDefinition=function(a){0>a&&xa(a,">= 0",X,"getRowDefinition:idx");a=Math.round(a);var b=this.ob;if(void 0===b)return null;if(void 0===b[a]){var c=new Jj;c.Si(this);c.isRow=!0;c.index=a;b[a]=c;this.Wa(pe,"rowdefs",this,null,c,null,a)}return b[a]};
X.prototype.KA=function(a){0>a&&xa(a,">= 0",X,"removeRowDefinition:idx");a=Math.round(a);var b=this.ob;if(void 0!==b){var c=b[a];if(c){b[a]=void 0;for(var d=b.length-1;0<=d&&void 0===b[d--];)b.length--;this.Wa(qe,"rowdefs",this,c,null,a,null);this.s()}}};function Kj(a,b,c){var d=a.ob;if(d&&!(0>b)){d[b]=c instanceof Jj?c:void 0;if(!c)for(b=d.length-1;0<=b&&void 0===d[b--];)d.length--;a.s()}}
X.prototype.getColumnDefinition=function(a){0>a&&xa(a,">= 0",X,"getColumnDefinition:idx");a=Math.round(a);var b=this.ib;if(void 0===b)return null;if(void 0===b[a]){var c=new Jj;c.Si(this);c.isRow=!1;c.index=a;b[a]=c;this.Wa(pe,"coldefs",this,null,c,null,a)}return b[a]};t=X.prototype;
t.FA=function(a){0>a&&xa(a,">= 0",X,"removeColumnDefinition:idx");a=Math.round(a);var b=this.ib;if(void 0!==b){var c=b[a];if(c){b[a]=void 0;for(var d=b.length-1;0<=d&&void 0===b[d--];)b.length--;this.Wa(qe,"coldefs",this,c,null,a,null);this.s()}}};function Lj(a,b,c){var d=a.ib;if(d&&!(0>b)){d[b]=c instanceof Jj?c:void 0;if(!c)for(b=d.length-1;0<=b&&void 0===d[b--];)d.length--;a.s()}}
t.Mz=function(a){if(0>a||this.type!==X.Table)return-1;for(var b=0,c=this.ob,d=c.length,e=this.vi;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))break}return e};t.Ez=function(a){if(0>a||this.type!==X.Table)return-1;for(var b=0,c=this.ib,d=c.length,e=this.gi;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))break}return e};
t.cA=function(a,b){void 0===b&&(b=new K(NaN,NaN));if(this.type!==X.Graduated)return b.h(NaN,NaN),b;a=Math.min(Math.max(a,this.graduatedMin),this.graduatedMax);var c=this.pb();c.geometry.bv((a-this.graduatedMin)/this.graduatedRange,b);return c.transform.Aa(b)};t.dA=function(a){if(this.type!==X.Graduated)return NaN;var b=this.pb();b.transform.Hd(a);return b.geometry.Wx(a)*this.graduatedRange+this.graduatedMin};function Al(a){a=a.Qh;return null!==a&&a.v}
function og(a){var b=a.Qh;if(null===b)null!==a.data&&B("Template cannot have .data be non-null: "+a),a.Qh=b=new E;else if(b.v)return;var c=new E;$m(a,!1);a.Em(a,function(a,d){var e=d.fb;if(null!==e)for(xl(d,!1),e=e.iterator;e.next();){var f=e.value;f.mode===an&&xl(d,!0);var g=f.sourceName;null!==g&&("/"===g&&$m(a,!0),g=al(f,a,d),null!==g&&(c.add(g),null===g.Jl&&(g.Jl=new E),g.Jl.add(f)));b.add(f)}if(d instanceof X&&d.type===X.Table){if(0<d.ob.length)for(a=d.ob,e=a.length,f=0;f<e;f++)if(g=a[f],void 0!==
g&&null!==g.fb)for(var h=g.fb.iterator;h.next();){var k=h.value;k.od=g;k.yp=2;k.Pl=g.index;b.add(k)}if(0<d.ib.length)for(d=d.ib,a=d.length,e=0;e<a;e++)if(f=d[e],void 0!==f&&null!==f.fb)for(g=f.fb.iterator;g.next();)h=g.value,h.od=f,h.yp=1,h.Pl=f.index,b.add(h)}});for(var d=c.iterator;d.next();){var e=d.value;if(null!==e.Jl){xl(e,!0);for(var f=e.Jl.iterator;f.next();){var g=f.value;null===e.fb&&(e.fb=new E);e.fb.add(g)}}e.Jl=null}for(d=b.iterator;d.next();)if(e=d.value,f=e.od,null!==f){e.od=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.Ya(g),null!==k?(f=k,e.targetProperty=h):ya('Warning: unable to find GraphObject named "'+g+'" for Binding: '+e.toString()));f instanceof Jj?(g=ib(f.panel),e.Xi=void 0===g?-1:g,f.panel.Dk=e.Xi):f instanceof Y?(g=ib(f),e.Xi=void 0===g?-1:g,f.Dk=e.Xi):B("Unknown type of binding target: "+f)}b.freeze();a instanceof V&&a.Nc()&&a.Ta()}
t.qz=function(a){void 0===a&&(a=!1);var b=this.copy();Tm(b,function(a){a instanceof X&&(a.Qh=null,a.jb=null);var b=a.fb;null!==b&&(a.fb=null,b.each(function(b){a.bind(b.copy())}));b=a.xg;null!==b&&(a.xg=null,b.each(function(b){a.Zv(b.value.copy())}))});a&&og(b);return b};
t.Fa=function(a){var b=this.Qh;if(null!==b)for(void 0===a&&(a=""),b=b.iterator;b.next();){var c=b.value,d=c.sourceProperty;if(""===a||""===d||d===a)if(d=c.targetProperty,null!==c.converter||""!==d){d=this.data;var e=c.sourceName;if(null!==e)if(""===e)d=this;else if("/"===e)d=this;else if("."===e)d=this;else if(".."===e)d=this;else{if(d=this.Ya(e),null===d)continue}else if(c.isToModel)if(d=this.diagram,null!==d)d=d.model.modelData;else continue;var f=this,g=c.Xi;if(-1!==g){if(f=this.ps(g),null===f)continue}else null!==
c.od&&(f=c.od);"/"===e?d=f.part:"."===e?d=f:".."===e&&(d=f.panel);e=c.yp;if(0!==e){if(!(f instanceof X))continue;1===e?f=f.getColumnDefinition(c.Pl):2===e&&(f=f.getRowDefinition(c.Pl))}void 0!==f&&c.cw(f,d)}}};t.Rx=function(a){return void 0===a||null===a||null===this.$d?null:this.$d.H(a)};
function bn(a,b){a=a.U.l;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 Wm(a){if(a.type===X.Spot||a.type===X.Auto)return Math.min(a.U.length,1);if(a.type===X.Link){a=a.U;for(var b=a.length,c=0;c<b;c++){var d=a.J(c);if(!(d instanceof xf&&d.isPanelMain))break}return c}return a.type===X.Table&&0<a.U.length&&(a=a.U.J(0),a.isPanelMain&&a instanceof X&&(a.type===X.TableRow||a.type===X.TableColumn))?1:0}
t.Ps=function(){var a=Wm(this),b=this.itemArray;if(null===b||0===b.length)for(;this.U.length>a;)this.rc(this.U.length-1,!1);else if(this.U.length<=a){a=b.length;for(var c=0;c<a;c++)cn(this,b[c],c,!0)}else{c=a;for(var d=0;d<b.length;d++,c++){var e=b[d],f=c<this.U.length?this.U.J(c):null;if(f instanceof X){if(f.data!==e){var g=dn(this,f.data),h=dn(this,e),k=h!==g;k||(g=en(this,g),k=en(this,h)!==g);k?(this.rc(c,!1),cn(this,e,d,!1)):f.data=e}}else cn(this,e,d,!1)}for(;c<this.U.length;)this.rc(c,!1);this.ph=
null;fn(this,a,0);ij(this)||this.s();this.Rf=null;this.Ef()||Zm(this,this,!1);b=this.part;null!==b&&(b.li=null,b.Xf=NaN,this.Je&&b instanceof W&&(b.Je=!0),b.Je&&b instanceof W&&(b.oc=null))}};function cn(a,b,c,d){if(!(void 0===b||null===b||0>c)){var e=dn(a,b);e=en(a,e);if(null!==e){og(e);e=e.copy();if(0!==(e.G&16777216)){var f=a.Ch();null!==f&&$m(f,!0)}"object"===typeof b&&(null===a.$d&&(a.$d=new H),a.$d.add(b,e));f=c+Wm(a);a.vb(f,e);d&&(e.jb=b,fn(a,f,c),e.jb=null);e.data=b}}}
function fn(a,b,c){for(a=a.U;b<a.length;){var d=a.J(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 dn(a,b){if(null===b)return"";a=a.hl;if("function"===typeof a)a=a(b);else if("string"===typeof a&&"object"===typeof b){if(""===a)return"";a=gn(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)}
function en(a,b){var c=a.itemTemplateMap,d=null;null!==c&&(d=c.H(b));null===d&&(null!==c&&(d=c.H("")),null===d&&(hn||(hn=!0,ya('No item template Panel found for category "'+b+'" on '+a),ya("  Using default item template."),a=new X,b=new Mg,b.bind(new si("text","",Ka)),a.add(b),jn=a),d=jn));return d}function Zm(a,b,c){var d=b.enabledChanged;null!==d&&d(b,c);if(b instanceof X){b=b.U.l;d=b.length;for(var e=0;e<d;e++){var f=b[e];c&&f instanceof X&&!f.isEnabled||Zm(a,f,c)}}}
function kn(a,b){b.name=a;El.add(a,b)}
na.Object.defineProperties(X.prototype,{type:{get:function(){return this.ha},set:function(a){var b=this.ha;b!==a&&(this.ha=a,this.ha===X.Grid?this.isAtomic=!0:this.ha===X.Table&&Om(this),this.s(),this.g("type",b,a))}},elements:{get:function(){return this.U.iterator}},naturalBounds:{get:function(){return this.xc}},padding:{get:function(){return this.nb},set:function(a){"number"===
typeof a?(0>a&&xa(a,">= 0",X,"padding"),a=new lc(a)):(0>a.left&&xa(a.left,">= 0",X,"padding:value.left"),0>a.right&&xa(a.right,">= 0",X,"padding:value.right"),0>a.top&&xa(a.top,">= 0",X,"padding:value.top"),0>a.bottom&&xa(a.bottom,">= 0",X,"padding:value.bottom"));var b=this.nb;b.A(a)||(this.nb=a=a.I(),this.s(),this.g("padding",b,a))}},defaultAlignment:{get:function(){return this.mn},set:function(a){var b=this.mn;b.A(a)||(this.mn=a=a.I(),this.s(),this.g("defaultAlignment",
b,a))}},defaultStretch:{get:function(){return this.Of},set:function(a){var b=this.Of;b!==a&&(this.Of=a,this.s(),this.g("defaultStretch",b,a))}},defaultSeparatorPadding:{get:function(){return void 0===this.fj?pc:this.fj},set:function(a){if(void 0!==this.fj){"number"===typeof a&&(a=new lc(a));var b=this.fj;b.A(a)||(this.fj=a=a.I(),this.s(),this.g("defaultSeparatorPadding",b,a))}}},defaultRowSeparatorStroke:{get:function(){return void 0===
this.Wh?null:this.Wh},set:function(a){var b=this.Wh;b!==a&&(null===a||"string"===typeof a||a instanceof hl)&&(a instanceof hl&&a.freeze(),this.Wh=a,this.N(),this.g("defaultRowSeparatorStroke",b,a))}},defaultRowSeparatorStrokeWidth:{get:function(){return void 0===this.Hg?1:this.Hg},set:function(a){if(void 0!==this.Hg){var b=this.Hg;b!==a&&isFinite(a)&&0<=a&&(this.Hg=a,this.s(),this.g("defaultRowSeparatorStrokeWidth",b,a))}}},defaultRowSeparatorDashArray:{
get:function(){return void 0===this.Vh?null:this.Vh},set:function(a){if(void 0!==this.Vh){var b=this.Vh;if(b!==a){if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];"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.Vh=a;this.N();this.g("defaultRowSeparatorDashArray",b,a)}}}},defaultColumnSeparatorStroke:{get:function(){return void 0===
this.Fg?null:this.Fg},set:function(a){if(void 0!==this.Fg){var b=this.Fg;b!==a&&(null===a||"string"===typeof a||a instanceof hl)&&(a instanceof hl&&a.freeze(),this.Fg=a,this.N(),this.g("defaultColumnSeparatorStroke",b,a))}}},defaultColumnSeparatorStrokeWidth:{get:function(){return void 0===this.Gg?1:this.Gg},set:function(a){if(void 0!==this.Gg){var b=this.Gg;b!==a&&isFinite(a)&&0<=a&&(this.Gg=a,this.s(),this.g("defaultColumnSeparatorStrokeWidth",b,a))}}},defaultColumnSeparatorDashArray:{
get:function(){return void 0===this.Uh?null:this.Uh},set:function(a){if(void 0!==this.Uh){var b=this.Uh;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.Uh=a;this.N();this.g("defaultColumnSeparatorDashArray",b,a)}}}},viewboxStretch:{get:function(){return this.Hp},
set:function(a){var b=this.Hp;b!==a&&(this.Hp=a,this.s(),this.g("viewboxStretch",b,a))}},gridCellSize:{get:function(){return this.Kn},set:function(a){var b=this.Kn;if(!b.A(a)){a.u()&&0!==a.width&&0!==a.height||B("Invalid Panel.gridCellSize: "+a);this.Kn=a.I();var c=this.diagram;null!==c&&this===c.grid&&ej(c);this.N();this.g("gridCellSize",b,a)}}},gridOrigin:{get:function(){return this.Ln},set:function(a){var b=this.Ln;if(!b.A(a)){a.u()||
B("Invalid Panel.gridOrigin: "+a);this.Ln=a.I();var c=this.diagram;null!==c&&this===c.grid&&ej(c);this.N();this.g("gridOrigin",b,a)}}},graduatedMin:{get:function(){return this.Hn},set:function(a){var b=this.Hn;b!==a&&(this.Hn=a,this.s(),this.g("graduatedMin",b,a),Zk(this)&&(a=this.part,null!==a&&$k(this,a,"graduatedRange")))}},graduatedMax:{get:function(){return this.Gn},set:function(a){var b=this.Gn;b!==a&&(this.Gn=a,this.s(),this.g("graduatedMax",
b,a),Zk(this)&&(a=this.part,null!==a&&$k(this,a,"graduatedRange")))}},graduatedRange:{get:function(){return this.graduatedMax-this.graduatedMin}},graduatedTickUnit:{get:function(){return this.Jn},set:function(a){var b=this.Jn;b!==a&&0<a&&(this.Jn=a,this.s(),this.g("graduatedTickUnit",b,a))}},graduatedTickBase:{get:function(){return this.In},set:function(a){var b=this.In;b!==a&&(this.In=a,this.s(),this.g("graduatedTickBase",
b,a))}},Je:{get:function(){return 0!==(this.G&8388608)},set:function(a){0!==(this.G&8388608)!==a&&(this.G^=8388608)}},rowCount:{get:function(){return void 0===this.ob?0:this.ob.length}},columnCount:{get:function(){return void 0===this.ib?0:this.ib.length}},rowSizing:{get:function(){return void 0===this.Fj?Pm:this.Fj},set:function(a){if(void 0!==this.Fj){var b=this.Fj;b!==a&&(this.Fj=
a,this.s(),this.g("rowSizing",b,a))}}},columnSizing:{get:function(){return void 0===this.ej?Pm:this.ej},set:function(a){if(void 0!==this.ej){var b=this.ej;b!==a&&(this.ej=a,this.s(),this.g("columnSizing",b,a))}}},topIndex:{get:function(){return void 0===this.vi?0:this.vi},set:function(a){if(void 0!==this.vi){var b=this.vi;b!==a&&((!isFinite(a)||0>a)&&B("Panel.topIndex must be greater than zero and a real number, not: "+a),this.vi=a,this.s(),
this.g("topIndex",b,a))}}},leftIndex:{get:function(){return void 0===this.gi?0:this.gi},set:function(a){if(void 0!==this.gi){var b=this.gi;b!==a&&((!isFinite(a)||0>a)&&B("Panel.leftIndex must be greater than zero and a real number, not: "+a),this.gi=a,this.s(),this.g("leftIndex",b,a))}}},data:{get:function(){return this.jb},set:function(a){var b=this.jb;if(b!==a){var c=this instanceof V&&!(this instanceof ze);og(this);this.jb=a;var d=this.diagram;
null!==d&&(c?(c=d.partManager,this instanceof T?(null!==b&&c.Ue.remove(b),null!==a&&c.Ue.add(a,this)):this instanceof V&&(null!==b&&c.Ve.remove(b),null!==a&&c.Ve.add(a,this))):(c=this.panel,null!==c&&null!==c.$d&&(null!==b&&c.$d.remove(b),null!==a&&c.$d.add(a,this))));this.g("data",b,a);null!==d&&d.undoManager.isUndoingRedoing||null!==a&&this.Fa()}}},itemIndex:{get:function(){return this.ao},set:function(a){var b=this.ao;b!==a&&(this.ao=a,this.g("itemIndex",b,a))}},itemArray:{
get:function(){return this.ci},set:function(a){var b=this.ci;if(b!==a||null!==a&&bn(this,a)){var c=this.diagram;b!==a&&(null!==c&&null!==b&&Aj(c.partManager,this,c),this.ci=a,null!==c&&null!==a&&xj(c.partManager,this));this.g("itemArray",b,a);null!==c&&c.undoManager.isUndoingRedoing||this.Ps()}}},itemTemplate:{get:function(){return null===this.ue?null:this.ue.H("")},set:function(a){if(null===this.ue){if(null===a)return;this.ue=new H}var b=this.ue.H("");
b!==a&&((a instanceof V||a.isPanelMain)&&B("Panel.itemTemplate must not be a Part or be Panel.isPanelMain: "+a),this.ue.add("",a),this.g("itemTemplate",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.Ps())}},itemTemplateMap:{get:function(){return this.ue},set:function(a){var b=this.ue;if(b!==a){for(var c=a.iterator;c.next(););this.ue=a;this.g("itemTemplateMap",b,a);a=this.diagram;null!==a&&a.undoManager.isUndoingRedoing||this.Ps()}}},itemCategoryProperty:{
get:function(){return this.hl},set:function(a){var b=this.hl;b!==a&&(this.hl=a,this.g("itemCategoryProperty",b,a))}},isAtomic:{get:function(){return 0!==(this.G&1048576)},set:function(a){var b=0!==(this.G&1048576);b!==a&&(this.G^=1048576,this.g("isAtomic",b,a))}},isClipping:{get:function(){return 0!==(this.G&2097152)},set:function(a){var b=0!==(this.G&2097152);b!==a&&(this.G^=2097152,this instanceof U&&(this.$a=null),this.s(),
this.g("isClipping",b,a))}},isOpposite:{get:function(){return 0!==(this.G&33554432)},set:function(a){var b=0!==(this.G&33554432);b!==a&&(this.G^=33554432,this.s(),this.g("isOpposite",b,a))}},isEnabled:{get:function(){return 0!==(this.G&4194304)},set:function(a){var b=0!==(this.G&4194304);if(b!==a){var c=null===this.panel||this.panel.Ef();this.G^=4194304;this.g("isEnabled",b,a);b=this.diagram;null!==b&&b.undoManager.isUndoingRedoing||c&&Zm(this,
this,a)}}},alignmentFocusName:{get:function(){return this.Re},set:function(a){var b=this.Re;b!==a&&(this.Re=a,this.s(),this.g("alignmentFocusName",b,a))}}});
na.Object.defineProperties(X,{Position:{get:function(){return El.H("Position")}},Horizontal:{get:function(){return El.H("Horizontal")}},Vertical:{get:function(){return El.H("Vertical")}},Spot:{get:function(){return El.H("Spot")}},Auto:{get:function(){return El.H("Auto")}},Table:{get:function(){return El.H("Table")}},Viewbox:{
get:function(){return El.H("Viewbox")}},TableRow:{get:function(){return El.H("TableRow")}},TableColumn:{get:function(){return El.H("TableColumn")}},Link:{get:function(){return El.H("Link")}},Grid:{get:function(){return El.H("Grid")}},Graduated:{get:function(){return El.H("Graduated")}}});X.prototype.rebuildItemElements=X.prototype.Ps;
X.prototype.findItemPanelForData=X.prototype.Rx;X.prototype.updateTargetBindings=X.prototype.Fa;X.prototype.copyTemplate=X.prototype.qz;X.prototype.graduatedValueForPoint=X.prototype.dA;X.prototype.graduatedPointForValue=X.prototype.cA;X.prototype.findColumnForLocalX=X.prototype.Ez;X.prototype.findRowForLocalY=X.prototype.Mz;X.prototype.removeColumnDefinition=X.prototype.FA;X.prototype.removeRowDefinition=X.prototype.KA;X.prototype.removeAt=X.prototype.eb;X.prototype.remove=X.prototype.remove;
X.prototype.insertAt=X.prototype.vb;X.prototype.elt=X.prototype.J;X.prototype.add=X.prototype.add;X.prototype.findObject=X.prototype.Ya;X.prototype.findInVisualTree=X.prototype.$l;X.prototype.walkVisualTreeFrom=X.prototype.Em;X.prototype.findMainElement=X.prototype.pb;var hn=!1,jn=null,El=new H;X.className="Panel";X.definePanelLayout=kn;kn("Position",new mm);kn("Vertical",new pm);kn("Auto",new sm);kn("Link",new Dm);
function Jj(){Va(this);this.bg=null;this.pr=!0;this.Ra=0;this.Bd=NaN;this.yj=0;this.xj=Infinity;this.xb=Wc;this.ja=this.cc=this.la=0;this.fb=null;this.qp=ln;this.Ee=Pk;this.lp=this.fg=null;this.mp=NaN;this.Ub=this.Jj=null;this.hn=!1}
Jj.prototype.copy=function(){var a=new Jj;a.pr=this.pr;a.Ra=this.Ra;a.Bd=this.Bd;a.yj=this.yj;a.xj=this.xj;a.xb=this.xb;a.la=this.la;a.cc=this.cc;a.ja=this.ja;a.Ee=this.Ee;a.qp=this.qp;null===this.fg?a.fg=null:a.fg=this.fg.I();a.lp=this.lp;a.mp=this.mp;a.Jj=null;null!==this.Jj&&(a.separatorDashArray=Ba(this.separatorDashArray));a.Ub=this.Ub;a.hn=this.hn;a.fb=this.fb;return a};t=Jj.prototype;t.gb=function(a){a.classType===Jj&&(this.sizing=a)};
t.toString=function(){return"RowColumnDefinition "+(this.isRow?"(Row ":"(Column ")+this.index+") #"+ib(this)};t.Si=function(a){this.bg=a};
t.Lu=function(){var a=0,b=0,c=this.bg,d=this.isRow;if(null!==c&&c.type===X.Table)for(var e=d?c.ob.length:c.ib.length,f=0;f<e;f++){var g=d?c.ob[f]:c.ib[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.fg;if(null===b)if(null!==c)b=
c.defaultSeparatorPadding;else return a;return a+(this.isRow?b.top:b.left)};
t.Jc=function(){var a=0,b=this.bg,c=0,d=this.isRow;if(null!==b&&b.type===X.Table)for(var e=d?b.ob.length:b.ib.length,f=0;f<e;f++){var g=d?b.ob[f]:b.ib[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.fg;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.Db=function(a,b,c){var d=this.bg;if(null!==d&&(d.Wa(ge,a,this,b,c,void 0,void 0),null!==this.fb&&(b=d.diagram,null!==b&&!b.skipsModelSourceBindings&&(d=d.Ch(),null!==d&&(b=d.data,null!==b)))))for(c=this.fb.iterator;c.next();)c.value.Aq(this,b,a,d)};function wm(a){if(a.sizing===ln){var b=a.bg;return a.isRow?b.rowSizing:b.columnSizing}return a.sizing}
t.bind=function(a,b,c,d){var e=null;"string"===typeof a?e=new si(a,b,c,d):e=a;e.od=this;a=this.panel;null!==a&&(b=a.Ch(),null!==b&&Al(b)&&B("Cannot add a Binding to a RowColumnDefinition that is already frozen: "+e+" on "+a));null===this.fb&&(this.fb=new E);this.fb.add(e);return this};
na.Object.defineProperties(Jj.prototype,{panel:{get:function(){return this.bg}},isRow:{get:function(){return this.pr},set:function(a){this.pr=a}},index:{get:function(){return this.Ra},set:function(a){this.Ra=a}},height:{get:function(){return this.Bd},set:function(a){var b=this.Bd;b!==a&&(0>a&&xa(a,">= 0",Jj,"height"),this.Bd=a,this.actual=this.la,null!==this.panel&&this.panel.s(),
this.Db("height",b,a))}},width:{get:function(){return this.Bd},set:function(a){var b=this.Bd;b!==a&&(0>a&&xa(a,">= 0",Jj,"width"),this.Bd=a,this.actual=this.la,null!==this.panel&&this.panel.s(),this.Db("width",b,a))}},minimum:{get:function(){return this.yj},set:function(a){var b=this.yj;b!==a&&((0>a||!isFinite(a))&&xa(a,">= 0",Jj,"minimum"),this.yj=a,this.actual=this.la,null!==this.panel&&this.panel.s(),this.Db("minimum",b,a))}},maximum:{
get:function(){return this.xj},set:function(a){var b=this.xj;b!==a&&(0>a&&xa(a,">= 0",Jj,"maximum"),this.xj=a,this.actual=this.la,null!==this.panel&&this.panel.s(),this.Db("maximum",b,a))}},alignment:{get:function(){return this.xb},set:function(a){var b=this.xb;b.A(a)||(this.xb=a.I(),null!==this.panel&&this.panel.s(),this.Db("alignment",b,a))}},stretch:{get:function(){return this.Ee},set:function(a){var b=this.Ee;b!==a&&(this.Ee=
a,null!==this.panel&&this.panel.s(),this.Db("stretch",b,a))}},separatorPadding:{get:function(){return this.fg},set:function(a){"number"===typeof a&&(a=new lc(a));var b=this.fg;null!==a&&null!==b&&b.A(a)||(null!==a&&(a=a.I()),this.fg=a,null!==this.panel&&this.panel.s(),this.Db("separatorPadding",b,a))}},separatorStroke:{get:function(){return this.lp},set:function(a){var b=this.lp;b!==a&&(null!==a&&Il(a,"RowColumnDefinition.separatorStroke"),
a instanceof hl&&a.freeze(),this.lp=a,null!==this.panel&&this.panel.s(),this.Db("separatorStroke",b,a))}},separatorStrokeWidth:{get:function(){return this.mp},set:function(a){var b=this.mp;b!==a&&(this.mp=a,null!==this.panel&&this.panel.s(),this.Db("separatorStrokeWidth",b,a))}},separatorDashArray:{get:function(){return this.Jj},set:function(a){var b=this.Jj;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.Jj=a;null!==this.panel&&this.panel.N();this.Db("separatorDashArray",b,a)}}},background:{get:function(){return this.Ub},set:function(a){var b=this.Ub;b!==a&&(null!==a&&Il(a,"RowColumnDefinition.background"),a instanceof hl&&a.freeze(),this.Ub=a,null!==this.panel&&this.panel.N(),this.Db("background",b,a))}},coversSeparators:{
get:function(){return this.hn},set:function(a){var b=this.hn;b!==a&&(this.hn=a,null!==this.panel&&this.panel.N(),this.Db("coversSeparators",b,a))}},sizing:{get:function(){return this.qp},set:function(a){var b=this.qp;b!==a&&(this.qp=a,null!==this.panel&&this.panel.s(),this.Db("sizing",b,a))}},actual:{get:function(){return this.la},set:function(a){this.la=isNaN(this.Bd)?Math.max(Math.min(this.xj,a),this.yj):Math.max(Math.min(this.xj,
this.Bd),this.yj)}},measured:{get:function(){return this.cc},set:function(a){this.cc=a}},total:{get:function(){return this.la+this.Jc()}},position:{get:function(){return this.ja},set:function(a){this.ja=a}}});Jj.prototype.computeEffectiveSpacing=Jj.prototype.Jc;Jj.prototype.computeEffectiveSpacingTop=Jj.prototype.Lu;var ln=new D(Jj,"Default",0),xm=new D(Jj,"None",1),Pm=new D(Jj,"ProportionalExtra",2);
Jj.className="RowColumnDefinition";Jj.Default=ln;Jj.None=xm;Jj.ProportionalExtra=Pm;function xf(a,b){Y.call(this);this.Dd=this.ma=null;this.xn="None";this.En=Pk;this.Hc=this.Uk="black";this.ig=1;this.Ll="butt";this.Ml="miter";this.Kj=10;this.mh=null;this.nh=0;this.nf=this.mf=Wc;this.Lo=this.Ko=NaN;this.Sn=!1;this.No=null;this.Vk=this.Sl="None";this.Zd=1;this.Yd=0;this.Wd=1;this.Xd=null;"string"===typeof a?this.figure=a:a&&Object.assign(this,a);b&&Object.assign(this,b)}ma(xf,Y);
xf.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.ma=this.ma;a.xn=this.xn;a.En=this.En;a.Dd=this.Dd;a.Uk=this.Uk;a.Hc=this.Hc;a.ig=this.ig;a.Ll=this.Ll;a.Ml=this.Ml;a.Kj=this.Kj;null!==this.mh&&(a.mh=Ba(this.mh));a.nh=this.nh;a.mf=this.mf.I();a.nf=this.nf.I();a.Ko=this.Ko;a.Lo=this.Lo;a.Sn=this.Sn;a.No=this.No;a.Sl=this.Sl;a.Vk=this.Vk;a.Zd=this.Zd;a.Yd=this.Yd;a.Wd=this.Wd;a.Xd=this.Xd};t=xf.prototype;
t.gb=function(a){a===pg||a===rg||a===Sk||a===Pk?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)+")#"+ib(this)};
function mn(a,b,c,d){var e=c.length;if(!(4>e)){var f=d.measuredBounds,g=Math.max(1,f.width);f=f.height;for(var h=c[0],k=c[1],l,m,n,p,r,q,u=0,w=Ea(),v=2;v<e;v+=2)l=c[v],m=c[v+1],n=l-h,h=m-k,0===n&&(n=.001),p=h/n,r=Math.atan2(h,n),q=Math.sqrt(n*n+h*h),w.push([n,r,p,q]),u+=q,h=l,k=m;h=c[0];k=c[1];n=d.measuredBounds.width;d instanceof xf&&(n-=d.strokeWidth);1>n&&(n=1);e=c=n;l=g/2;m=0===l?!1:!0;v=0;q=w[v];n=q[0];r=q[1];p=q[2];q=q[3];for(var y=0;.1<=u;){0===y&&(m?(e=c,e-=l,u-=l,m=!1):e=c,0===e&&(e=1));
if(e>u){Ia(w);return}e>q?(y=e-q,e=q):y=0;var z=Math.sqrt(e*e/(1+p*p));0>n&&(z=-z);h+=z;k+=p*z;a.translate(h,k);a.rotate(r);a.translate(-(g/2),-(f/2));0===y&&d.Ei(a,b);a.translate(g/2,f/2);a.rotate(-r);a.translate(-h,-k);u-=e;q-=e;if(0!==y){v++;if(v===w.length){Ia(w);return}q=w[v];n=q[0];r=q[1];p=q[2];q=q[3];e=y}}Ia(w)}}
t.Ei=function(a,b){var c=this.Hc,d=this.Uk;if(null!==c||null!==d){var e=this.ma;if(null!==e){a.Ed();var f=this.actualBounds,g=this.naturalBounds;null!==d&&di(this,a,d,!0,!1,g,f);var h=this.part,k=this.ig;null===c||0!==k||null===h||!this.isPanelMain&&h.pb()!==this||(k=h.type===X.Link&&h instanceof ze&&"Selection"===h.category&&h.adornedObject instanceof xf&&h.adornedPart.pb()===h.adornedObject?h.adornedObject.strokeWidth:0);0===k&&(c=null);null!==c&&0!==k&&(di(this,a,c,!1,!1,g,f),a.lineWidth=k,a.lineJoin=
this.Ml,a.lineCap=this.Ll,a.miterLimit=this.Kj);f=!1;h&&b.Ie("drawShadows")&&(f=h.isShadowed);h=!0;null===c||null!==d&&"transparent"!==d||(h=!1);g=!1;k=this.strokeDashArray;null!==k&&(g=!0,a.os(k,this.nh));if(e.type===P.j)a.beginPath(),a.moveTo(e.startX,e.startY),a.lineTo(e.endX,e.endY),null!==c&&a.Wi();else if(e.type===P.C){var l=e.startX;k=e.startY;var m=e.endX,n=e.endY;e=Math.min(l,m);var p=Math.min(k,n);l=Math.abs(m-l);k=Math.abs(n-k);a.beginPath();a.rect(e,p,l,k);null!==d&&a.yf(d);if(null!==
c){h&&f&&ll(a);if(0===l||0===k)a.beginPath(),a.rect(e,p,Math.max(l,.1),Math.max(k,.1));a.Wi();h&&f&&kl(a)}}else if(e.type===P.K)l=e.startX,k=e.startY,m=e.endX,n=e.endY,e=Math.abs(m-l)/2,p=Math.abs(n-k)/2,l=Math.min(l,m)+e,k=Math.min(k,n)+p,a.beginPath(),a.moveTo(l,k-p),a.bezierCurveTo(l+M.wg*e,k-p,l+e,k-M.wg*p,l+e,k),a.bezierCurveTo(l+e,k+M.wg*p,l+M.wg*e,k+p,l,k+p),a.bezierCurveTo(l-M.wg*e,k+p,l-e,k+M.wg*p,l-e,k),a.bezierCurveTo(l-e,k-M.wg*p,l-M.wg*e,k-p,l,k-p),a.closePath(),null!==d&&a.yf(d),null!==
c&&(h&&f?(ll(a),a.Wi(),kl(a)):a.Wi());else if(e.type===P.o)for(e=e.figures,k=e.length,p=0;p<k;p++){l=e.l[p];a.beginPath();a.moveTo(l.startX,l.startY);m=l.segments.l;n=m.length;for(var r=null,q=0;q<n;q++){var u=m[q];switch(u.type){case Pd:a.moveTo(u.endX,u.endY);break;case sd:a.lineTo(u.endX,u.endY);break;case Qd:a.bezierCurveTo(u.point1X,u.point1Y,u.point2X,u.point2Y,u.endX,u.endY);break;case Rd:a.quadraticCurveTo(u.point1X,u.point1Y,u.endX,u.endY);break;case Sd:if(u.radiusX===u.radiusY){var w=Math.PI/
180;a.arc(u.point1X,u.point1Y,u.radiusX,u.startAngle*w,(u.startAngle+u.sweepAngle)*w,0>u.sweepAngle,null!==r?r.endX:l.startX,null!==r?r.endY:l.startY)}else if(r=Ud(u,l),w=r.length,0===w)a.lineTo(u.centerX,u.centerY);else for(var v=0;v<w;v++){var y=r[v];0===v&&a.lineTo(y[0],y[1]);a.bezierCurveTo(y[2],y[3],y[4],y[5],y[6],y[7])}break;case Td:v=w=0;if(null!==r&&r.type===Sd){r=Ud(r,l);y=r.length;if(0===y){a.lineTo(u.endX,u.endY);break}r=r[y-1]||null;null!==r&&(w=r[6],v=r[7])}else w=null!==r?r.endX:l.startX,
v=null!==r?r.endY:l.startY;r=Vd(u,l,w,v);w=r.length;if(0===w){a.lineTo(u.endX,u.endY);break}for(v=0;v<w;v++)y=r[v],a.bezierCurveTo(y[2],y[3],y[4],y[5],y[6],y[7]);break;default:B("Segment not of valid type: "+u.type)}u.isClosed&&a.closePath();r=u}m=l.isFilled;f?l.isShadowed?(!0===m&&"transparent"!==d&&null!==d&&a.yf(d),null!==c&&(m&&h&&ll(a),a.Wi(),m&&h&&kl(a))):(ll(a),m&&"transparent"!==d&&null!==d&&a.yf(d),null!==c&&a.Wi(),kl(a)):(m&&null!==d&&a.yf(d),null!==c&&a.Wi())}g&&a.ms();if(null!==this.pathPattern){c=
this.pathPattern;c.measure(Infinity,Infinity);d=c.measuredBounds;c.arrange(0,0,d.width,d.height);f=this.geometry;a.save();a.beginPath();d=Ea();if(f.type===P.j)d.push(f.startX),d.push(f.startY),d.push(f.endX),d.push(f.endY),mn(a,b,d,c);else if(f.type===P.o)for(f=f.figures.iterator;f.next();){h=f.value;d.length=0;d.push(h.startX);d.push(h.startY);g=h.startX;e=h.startY;k=g;p=e;l=h.segments.l;m=l.length;for(n=0;n<m;n++){q=l[n];switch(q.type){case Pd:mn(a,b,d,c);d.length=0;d.push(q.endX);d.push(q.endY);
g=q.endX;e=q.endY;k=g;p=e;break;case sd:d.push(q.endX);d.push(q.endY);g=q.endX;e=q.endY;break;case Qd:M.Fe(g,e,q.point1X,q.point1Y,q.point2X,q.point2Y,q.endX,q.endY,.5,d);g=q.endX;e=q.endY;break;case Rd:M.lq(g,e,q.point1X,q.point1Y,q.endX,q.endY,.5,d);g=q.endX;e=q.endY;break;case Sd:u=Ud(q,h);r=u.length;if(0===r){d.push(q.centerX);d.push(q.centerY);g=q.centerX;e=q.centerY;break}for(w=0;w<r;w++)v=u[w],M.Fe(g,e,v[2],v[3],v[4],v[5],v[6],v[7],.5,d),g=v[6],e=v[7];break;case Td:u=Vd(q,h,g,e);r=u.length;
if(0===r){d.push(q.endX);d.push(q.endY);g=q.endX;e=q.endY;break}for(w=0;w<r;w++)v=u[w],M.Fe(g,e,v[2],v[3],v[4],v[5],v[6],v[7],.5,d),g=v[6],e=v[7];break;default:B("Segment not of valid type: "+q.type)}q.isClosed&&(d.push(k),d.push(p),mn(a,b,d,c))}mn(a,b,d,c)}else if(f.type===P.C)d.push(f.startX),d.push(f.startY),d.push(f.endX),d.push(f.startY),d.push(f.endX),d.push(f.endY),d.push(f.startX),d.push(f.endY),d.push(f.startX),d.push(f.startY),mn(a,b,d,c);else if(f.type===P.K){e=new $d;e.startX=f.endX;e.startY=
(f.startY+f.endY)/2;g=new ae(Sd);g.startAngle=0;g.sweepAngle=360;g.centerX=(f.startX+f.endX)/2;g.centerY=(f.startY+f.endY)/2;g.radiusX=Math.abs(f.startX-f.endX)/2;g.radiusY=Math.abs(f.startY-f.endY)/2;e.add(g);f=Ud(g,e);h=f.length;if(0===h)d.push(g.centerX),d.push(g.centerY);else for(g=e.startX,e=e.startY,k=0;k<h;k++)p=f[k],M.Fe(g,e,p[2],p[3],p[4],p[5],p[6],p[7],.5,d),g=p[6],e=p[7];mn(a,b,d,c)}Ia(d);a.restore();a.Ic(!1)}}}};
t.da=function(a,b){void 0===b&&(b=new K);if(a instanceof O){a.Cc()&&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.ee.Aa(b);return b};
t.Li=function(a){void 0===a&&(a=new N);var b=this.naturalBounds,c=this.ee;b=N.allocAt(b.x,b.y,b.width,b.height);var d=this.strokeWidth;b.Kc(d/2,d/2);d=K.allocAt(b.x,b.y).transform(c);a.h(d.x,d.y,0,0);d.h(b.right,b.y).transform(c);ac(a,d.x,d.y,0,0);d.h(b.right,b.bottom).transform(c);ac(a,d.x,d.y,0,0);d.h(b.x,b.bottom).transform(c);ac(a,d.x,d.y,0,0);N.free(b);K.free(d);return a};
t.Bh=function(a,b){var c=this.geometry;if(null===c||null===this.fill&&null===this.stroke)return!1;var d=c.bounds,e=this.strokeWidth/2;c.type!==P.j||b||(e+=2);var f=N.alloc();f.assign(d);f.Kc(e+2,e+2);if(!f.$(a))return N.free(f),!1;d=e+1E-4;if(c.type===P.j){if(null===this.stroke)return!1;d=(c.endX-c.startX)*(a.x-c.startX)+(c.endY-c.startY)*(a.y-c.startY);if(0>(c.startX-c.endX)*(a.x-c.endX)+(c.startY-c.endY)*(a.y-c.endY)||0>d)return!1;N.free(f);return M.Nb(c.startX,c.startY,c.endX,c.endY,e,a.x,a.y)}if(c.type===
P.C){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.Kc(-d,-d);if(f.$(a))return N.free(f),!1;f.Kc(d,d)}null!==this.stroke&&f.Kc(e,e);a=f.$(a);N.free(f);return a}if(c.type===P.K){g=c.startX;e=c.startY;h=c.endX;var k=c.endY;c=Math.min(g,h);b=Math.min(e,k);g=Math.abs(h-g)/2;e=Math.abs(k-e)/2;c=a.x-(c+g);b=a.y-(b+e);if(null===this.fill){g-=d;e-=d;if(0>=g||0>=e||1>=c*c/(g*g)+b*b/(e*e))return N.free(f),!1;
g+=d;e+=d}null!==this.stroke&&(g+=d,e+=d);N.free(f);return 0>=g||0>=e?!1:1>=c*c/(g*g)+b*b/(e*e)}if(c.type===P.o)return N.free(f),null===this.fill?Yd(c,a.x,a.y,e):Wd(c,a,e,1<this.strokeWidth,b);B("Unknown Geometry type: "+c.type)};
t.im=function(a,b,c,d){var e=this.desiredSize,f=this.ig;a=Math.max(a,0);b=Math.max(b,0);if(null!==this.Dd)var g=this.geometry.bounds;else{var h=this.figure,k=nn[h];if(void 0===k){var l=M.Qe[h];"string"===typeof l&&(l=M.Qe[l]);"function"===typeof l?(k=l(null,100,100),nn[h]=k):B("Unsupported Figure: "+h)}g=k.bounds}h=g.width;k=g.height;l=g.width;var m=g.height;switch(cl(this,!0)){case pg:d=c=0;break;case qd:l=Math.max(a-f,0);m=Math.max(b-f,0);break;case Qk:l=Math.max(a-f,0);d=0;break;case Rk: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=qg(this);switch(c){case pg:break;case qd:h=l;k=m;break;case rg: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.Dd?(0===h&&(h=.001),0===k&&(k=.001),
c=null!==this.Dd?this.Dd:this.ma,e=c.bounds,d=h/e.width,e=k/e.height,isFinite(d)||(d=1),isFinite(e)||(e=1),this.ma=1===d&&1===e?c:c.copy().scale(d,e)):null!==this.ma&&M.aa(this.ma.cl,a-f)&&M.aa(this.ma.al,b-f)||(this.ma=xf.makeGeometry(this,h,k));g=this.ma.bounds;Infinity===a||Infinity===b?this.xe(g.x-f/2,g.y-f/2,0===a&&0===h?0:g.width+f,0===b&&0===k?0:g.height+f):this.xe(-(f/2),-(f/2),l+f,m+f)};
function qg(a){var b=a.geometryStretch;return null!==a.Dd?b===Pk?qd:b:b===Pk?nn[a.figure].defaultStretch:b}t.zh=function(a,b,c,d){el(this,a,b,c,d)};t.ws=function(a,b,c){return this.ak(a.x,a.y,b.x,b.y,c)};
t.ak=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.ig/2;l=this.ma;null===l&&(this.measure(Infinity,Infinity),l=this.ma);var r=l.bounds;m=!1;if(l.type===P.j)if(1.5>=this.strokeWidth)m=M.Le(l.startX,l.startY,l.endX,l.endY,f,g,h,k,e);else{l.startX===l.endX?(d=n,m=0):(b=(l.endY-l.startY)/(l.endX-l.startX),m=n/Math.sqrt(1+b*b),
d=m*b);b=Ea();a=new K;M.Le(l.startX+d,l.startY+m,l.endX+d,l.endY+m,f,g,h,k,a)&&b.push(a);a=new K;M.Le(l.startX-d,l.startY-m,l.endX-d,l.endY-m,f,g,h,k,a)&&b.push(a);a=new K;M.Le(l.startX+d,l.startY+m,l.startX-d,l.startY-m,f,g,h,k,a)&&b.push(a);a=new K;M.Le(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 Ia(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);Ia(b)}else if(l.type===P.C)m=M.Cf(r.x-n,r.y-n,r.x+r.width+
n,r.y+r.height+n,f,g,h,k,e);else if(l.type===P.K){b=N.allocAt(r.x,r.y,r.width,r.height).Kc(n,n);a:if(0===b.width)m=M.Le(b.x,b.y,b.x,b.y+b.height,f,g,h,k,e);else if(0===b.height)m=M.Le(b.x,b.y,b.x+b.width,b.y,f,g,h,k,e);else{a=b.width/2;l=b.height/2;d=b.x+a;m=b.y+l;c=9999;f!==h&&(c=(g-k)/(f-h));if(9999>Math.abs(c)){k=g-m-c*(f-d);if(0>a*a*c*c+l*l-k*k){e.x=NaN;e.y=NaN;m=!1;break a}n=Math.sqrt(a*a*c*c+l*l-k*k);h=(-(a*a*c*k)+a*l*n)/(l*l+a*a*c*c)+d;a=(-(a*a*c*k)-a*l*n)/(l*l+a*a*c*c)+d;l=c*(h-d)+k+m;k=c*
(a-d)+k+m;Math.abs((f-h)*(f-h))+Math.abs((g-l)*(g-l))<Math.abs((f-a)*(f-a))+Math.abs((g-k)*(g-k))?(e.x=h,e.y=l):(e.x=a,e.y=k)}else{h=l*l;k=f-d;h-=h/(a*a)*k*k;if(0>h){e.x=NaN;e.y=NaN;m=!1;break a}k=Math.sqrt(h);h=m+k;k=m-k;Math.abs(h-g)<Math.abs(k-g)?(e.x=f,e.y=h):(e.x=f,e.y=k)}m=!0}N.free(b)}else if(l.type===P.o){p=K.alloc();var q=h-f;var u=k-g,w=q*q+u*u,v=f,y=g;if(0<w&&r.contains(v,y)&&(p.x=v,p.y=y,this.$(p)))for(0!==q&&.5>Math.abs(q)?(u*=.5/q,q=.5):0!==u&&.5>Math.abs(u)&&(q*=.5/u,u=.5),v-=q,y-=
u;r.contains(v,y);)v-=q,y-=u;e.x=h;e.y=k;for(u=0;u<l.figures.count;u++){var z=l.figures.l[u],A=z.isFilled?v:f,C=z.isFilled?y:g,F=z.segments;r=z.startX;q=z.startY;for(var R=r,J=q,S=0;S<F.count;S++){var L=F.l[S],I=L.type;var ja=L.endX;var ca=L.endY;var pa=!1;switch(I){case Pd:R=ja;J=ca;break;case sd:pa=on(r,q,ja,ca,A,C,h,k,p);break;case Qd:pa=M.Op(r,q,L.point1X,L.point1Y,L.point2X,L.point2Y,ja,ca,A,C,h,k,.6,p);break;case Rd:pa=M.Op(r,q,r+2/3*(L.point1X-r),q+2/3*(L.point1Y-q),ja+2/3*(L.point1X-ja),ca+
2/3*(L.point1Y-ca),ja,ca,A,C,h,k,.6,p);break;case Sd:case Td:I=L.type===Sd?Ud(L,z):Vd(L,z,r,q);var Na=I.length;if(0===Na){pa=on(r,q,L.type===Sd?L.centerX:L.endX,L.type===Sd?L.centerY:L.endY,A,C,h,k,p);break}ca=null;for(ja=0;ja<Na;ja++){ca=I[ja];if(0===ja&&on(r,q,ca[0],ca[1],A,C,h,k,p)){var fb=pn(A,C,p,w,e);fb<w&&(w=fb,m=!0)}M.Op(ca[0],ca[1],ca[2],ca[3],ca[4],ca[5],ca[6],ca[7],A,C,h,k,.6,p)&&(fb=pn(A,C,p,w,e),fb<w&&(w=fb,m=!0))}ja=ca[6];ca=ca[7];break;default:B("Unknown Segment type: "+I)}r=ja;q=ca;
pa&&(pa=pn(A,C,p,w,e),pa<w&&(w=pa,m=!0));L.isClosed&&(ja=R,ca=J,on(r,q,ja,ca,A,C,h,k,p)&&(L=pn(A,C,p,w,e),L<w&&(w=L,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;K.free(p)}else B("Unknown Geometry type: "+l.type);if(!m)return!1;this.transform.Aa(e);return!0};function pn(a,b,c,d,e){a=c.x-a;b=c.y-b;b=a*a+b*b;return b<d?(e.x=c.x,e.y=c.y,b):d}
function on(a,b,c,d,e,f,g,h,k){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||M.aa(k.y,a))&&(k.y<b||M.aa(k.y,b))&&(l=!0)):(b=a<c?a:c,a=a<c?c:a,(k.x>b||M.aa(k.x,b))&&(k.x<a||M.aa(k.x,a))&&(l=!0));return l}
t.Ah=function(a,b){if(void 0===b)return a.Ge(this.actualBounds);var c=this.ma;null===c&&(this.measure(Infinity,Infinity),c=this.ma);c=c.bounds;var d=this.strokeWidth/2,e=!1,f=K.alloc();f.h(c.x-d,c.y-d);a.$(b.Aa(f))&&(f.h(c.x-d,c.bottom+d),a.$(b.Aa(f))&&(f.h(c.right+d,c.bottom+d),a.$(b.Aa(f))&&(f.h(c.right+d,c.y-d),a.$(b.Aa(f))&&(e=!0))));K.free(f);return e};
t.Mc=function(a,b){if(this.Ah(a,b)||void 0===b&&(b=this.transform,a.Ge(this.actualBounds)))return!0;var c=od.alloc();c.set(b);c.Bs();var d=a.left,e=a.right,f=a.top;a=a.bottom;var g=K.alloc();g.h(d,f);c.Aa(g);if(this.Bh(g,!0))return K.free(g),!0;g.h(e,f);c.Aa(g);if(this.Bh(g,!0))return K.free(g),!0;g.h(d,a);c.Aa(g);if(this.Bh(g,!0))return K.free(g),!0;g.h(e,a);c.Aa(g);if(this.Bh(g,!0))return K.free(g),!0;var h=K.alloc(),k=K.alloc();c.set(b);c.uv(this.transform);c.Bs();h.x=e;h.y=f;h.transform(c);g.x=
d;g.y=f;g.transform(c);b=!1;zn(this,g,h,k)?b=!0:(g.x=e,g.y=a,g.transform(c),zn(this,g,h,k)?b=!0:(h.x=d,h.y=a,h.transform(c),zn(this,g,h,k)?b=!0:(g.x=d,g.y=f,g.transform(c),zn(this,g,h,k)&&(b=!0))));K.free(g);od.free(c);K.free(h);K.free(k);return b};function zn(a,b,c,d){if(!a.ws(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.Sx=function(a,b,c){function d(a,b){for(var c=a.length,d=0;d<c;d+=2)if(b.pd(a[d],a[d+1])>e)return!0;return!1}if(c&&null!==this.fill&&this.Bh(a,!0))return!0;var e=a.xf(b),f=e;1.5<this.strokeWidth&&(e=this.strokeWidth/2+Math.sqrt(e),e*=e);b=this.ma;if(null===b&&(this.measure(Infinity,Infinity),b=this.ma,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(wb(a.x,a.y,h,k)<=e&&wb(a.x,a.y,l,k)<=e&&wb(a.x,a.y,h,g)<=e&&wb(a.x,a.y,l,g)<=e)return!0}h=b.startX;k=b.startY;l=
b.endX;g=b.endY;if(b.type===P.j){if(c=(h-l)*(a.x-l)+(k-g)*(a.y-g),vb(a.x,a.y,h,k,l,g)<=(0<=(l-h)*(a.x-h)+(g-k)*(a.y-k)&&0<=c?e:f))return!0}else{if(b.type===P.C)return b=!1,c&&(b=vb(a.x,a.y,h,k,h,g)<=e||vb(a.x,a.y,h,k,l,k)<=e||vb(a.x,a.y,l,k,l,g)<=e||vb(a.x,a.y,h,g,l,g)<=e),b;if(b.type===P.K){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 vb(a.x,a.y,h,k,l,g)<=e?!0:!1;if(c){if(a=M.xz(m,n,b,f),a*a<=e)return!0}else return wb(b,f,-m,0)>=e||wb(b,f,0,-n)>=e||wb(b,
f,0,n)>=e||wb(b,f,m,0)>=e?!1:!0}else if(b.type===P.o){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&&vb(a.x,a.y,f,h,f,l)>e&&vb(a.x,a.y,f,h,k,h)>e&&vb(a.x,a.y,k,l,f,l)>e&&vb(a.x,a.y,k,l,k,h)>e)return!1;f=Math.sqrt(e);if(c){if(null===this.fill?Yd(b,a.x,a.y,f):Wd(b,a,f,!0,!1))return!0}else{c=b.figures;for(b=0;b<c.count;b++){f=c.l[b];g=f.startX;m=f.startY;if(a.pd(g,m)>e)return!1;h=f.segments.l;k=h.length;for(l=0;l<k;l++)switch(n=h[l],n.type){case Pd:case sd:g=n.endX;
m=n.endY;if(a.pd(g,m)>e)return!1;break;case Qd:var p=Ea();M.Fe(g,m,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.8,p);g=d(p,a);Ia(p);if(g)return!1;g=n.endX;m=n.endY;if(a.pd(g,m)>e)return!1;break;case Rd:p=Ea();M.lq(g,m,n.point1X,n.point1Y,n.endX,n.endY,.8,p);g=d(p,a);Ia(p);if(g)return!1;g=n.endX;m=n.endY;if(a.pd(g,m)>e)return!1;break;case Sd:case Td:p=n.type===Sd?Ud(n,f):Vd(n,f,g,m);var r=p.length;if(0===r){g=n.type===Sd?n.centerX:n.endX;m=n.type===Sd?n.centerY:n.endY;if(a.pd(g,m)>e)return!1;
break}n=null;for(var q=Ea(),u=0;u<r;u++)if(n=p[u],q.length=0,M.Fe(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],.8,q),d(q,a))return Ia(q),!1;Ia(q);null!==n&&(g=n[6],m=n[7]);break;default:B("Unknown Segment type: "+n.type)}}return!0}}}return!1};t.fc=function(){this.ma=null};t.Qw=function(){return this.ig};
function An(a){var b=a.diagram;null!==b&&b.undoManager.isUndoingRedoing||(a.segmentOrientation=Mm,"None"!==a.Sl?(a.segmentIndex=-1,a.alignmentFocus=cd):"None"!==a.Vk&&(a.segmentIndex=0,a.alignmentFocus=new O(1-cd.x,cd.y)))}
xf.makeGeometry=function(a,b,c){if("None"!==a.toArrow)var d=Bn[a.toArrow];else"None"!==a.fromArrow?d=Bn[a.fromArrow]:(d=M.Qe[a.figure],"string"===typeof d&&(d=M.Qe[d]),void 0===d&&B("Unknown Shape.figure: "+a.figure),d=d(a,b,c),d.cl=b,d.al=c);if(null===d){var e=M.Qe.Rectangle;"function"===typeof e&&(d=e(a,b,c))}return d};
function Cn(a){var b=Bn[a];if(void 0===b){var c=a.toLowerCase();if("none"===c)return"None";b=Bn[c];if(void 0===b){var d=null,e;for(e in M.Im)if(e.toLowerCase()===c){d=e;break}if(null!==d)return a=P.parse(M.Im[d],!1),Bn[d]=a,c!==d&&(Bn[c]=d),d}}return"string"===typeof b?b:b instanceof P?a:null}
na.Object.defineProperties(xf.prototype,{geometry:{get:function(){return null!==this.ma?this.ma:this.Dd},set:function(a){var b=this.ma,c=this.Dd;if(b!==a){null!==a?this.Dd=this.ma=a.freeze():this.Dd=this.ma=null;var d=this.part;null!==d&&(d.Xf=NaN);this.s();this.g("geometry",b||c,a);Zk(this)&&(a=this.part,null!==a&&$k(this,a,"geometryString"))}}},geometryString:{get:function(){return null===this.geometry?"":this.geometry.toString()},set:function(a){a=
P.parse(a);var b=a.normalize();this.geometry=a;this.position=a=K.allocAt(-b.x,-b.y);K.free(a)}},isGeometryPositioned:{get:function(){return this.Sn},set:function(a){var b=this.Sn;b!==a&&(this.Sn=a,this.s(),this.g("isGeometryPositioned",b,a))}},fill:{get:function(){return this.Uk},set:function(a){var b=this.Uk;b!==a&&(null!==a&&Il(a,"Shape.fill"),a instanceof hl&&a.freeze(),this.Uk=a,this.N(),this.g("fill",b,a))}},stroke:{
get:function(){return this.Hc},set:function(a){var b=this.Hc;b!==a&&(null!==a&&Il(a,"Shape.stroke"),a instanceof hl&&a.freeze(),this.Hc=a,this.N(),this.g("stroke",b,a))}},strokeWidth:{get:function(){return this.ig},set:function(a){var b=this.ig;if(b!==a)if(0<=a){this.ig=a;this.s();var c=this.part;null!==c&&(c.Xf=NaN);this.g("strokeWidth",b,a)}else xa(a,"value >= 0",xf,"strokeWidth:value")}},strokeCap:{get:function(){return this.Ll},
set:function(a){var b=this.Ll;b!==a&&("string"!==typeof a||"butt"!==a&&"round"!==a&&"square"!==a?xa(a,'"butt", "round", or "square"',xf,"strokeCap"):(this.Ll=a,this.N(),this.g("strokeCap",b,a)))}},strokeJoin:{get:function(){return this.Ml},set:function(a){var b=this.Ml;b!==a&&("string"!==typeof a||"miter"!==a&&"bevel"!==a&&"round"!==a?xa(a,'"miter", "bevel", or "round"',xf,"strokeJoin"):(this.Ml=a,this.N(),this.g("strokeJoin",b,a)))}},strokeMiterLimit:{
get:function(){return this.Kj},set:function(a){var b=this.Kj;if(b!==a&&1<=a){this.Kj=a;this.N();var c=this.part;null!==c&&(c.Xf=NaN);this.g("strokeMiterLimit",b,a)}}},strokeDashArray:{get:function(){return this.mh},set:function(a){var b=this.mh;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.mh=
a;this.N();this.g("strokeDashArray",b,a)}}},strokeDashOffset:{get:function(){return this.nh},set:function(a){var b=this.nh;b!==a&&0<=a&&(this.nh=a,this.N(),this.g("strokeDashOffset",b,a))}},figure:{get:function(){return this.xn},set:function(a){var b=this.xn;if(b!==a){var c=M.Qe[a];"function"===typeof c?c=a:(c=M.Qe[a.toLowerCase()])||B("Unknown Shape.figure: "+a);b!==c&&(a=this.part,null!==a&&(a.Xf=NaN),this.xn=c,this.Dd=null,this.fc(),this.s(),
this.g("figure",b,c))}}},toArrow:{get:function(){return this.Sl},set:function(a){var b=this.Sl;!0===a?a="Standard":!1===a&&(a="");if(b!==a){var c=Cn(a);null===c?B("Unknown Shape.toArrow: "+a):b!==c&&(this.Sl=c,this.Dd=null,this.fc(),this.s(),An(this),this.g("toArrow",b,c))}}},fromArrow:{get:function(){return this.Vk},set:function(a){var b=this.Vk;!0===a?a="Standard":!1===a&&(a="");if(b!==a){var c=Cn(a);null===c?B("Unknown Shape.fromArrow: "+
a):b!==c&&(this.Vk=c,this.Dd=null,this.fc(),this.s(),An(this),this.g("fromArrow",b,c))}}},spot1:{get:function(){return this.mf},set:function(a){var b=this.mf;b.A(a)||(this.mf=a=a.I(),this.s(),this.g("spot1",b,a))}},spot2:{get:function(){return this.nf},set:function(a){var b=this.nf;b.A(a)||(this.nf=a=a.I(),this.s(),this.g("spot2",b,a))}},parameter1:{get:function(){return this.Ko},set:function(a){var b=this.Ko;
b!==a&&(this.Ko=a,this.fc(),this.s(),this.g("parameter1",b,a))}},parameter2:{get:function(){return this.Lo},set:function(a){var b=this.Lo;b!==a&&(this.Lo=a,this.fc(),this.s(),this.g("parameter2",b,a))}},naturalBounds:{get:function(){var a=this.desiredSize;return a.u()||null===this.ma?new N(0,0,a.width,a.height):(this.xc.assign(this.ma.bounds),this.xc)}},pathPattern:{get:function(){return this.No},set:function(a){var b=
this.No;b!==a&&(this.No=a,this.N(),this.g("pathPattern",b,a))}},geometryStretch:{get:function(){return this.En},set:function(a){var b=this.En;b!==a&&(this.En=a,this.s(),this.g("geometryStretch",b,a))}},interval:{get:function(){return this.Zd},set:function(a){var b=this.Zd;a=Math.round(a);if(b!==a&&0!==a&&isFinite(a)){this.Zd=a;var c=this.diagram;null!==c&&this.panel===c.grid&&ej(c);this.s();c=this.panel;null!==c&&(c.Rf=null);this.g("interval",
b,a)}}},graduatedStart:{get:function(){return this.Yd},set:function(a){var b=this.Yd;b!==a&&(0>a?a=0:1<a&&(a=1),this.Yd=a,this.s(),this.g("graduatedStart",b,a))}},graduatedEnd:{get:function(){return this.Wd},set:function(a){var b=this.Wd;b!==a&&(0>a?a=0:1<a&&(a=1),this.Wd=a,this.s(),this.g("graduatedEnd",b,a))}},graduatedSkip:{get:function(){return this.Xd},set:function(a){var b=this.Xd;b!==a&&(this.Xd=a,this.s(),
this.g("graduatedSkip",b,a))}}});xf.prototype.intersectsRect=xf.prototype.Mc;xf.prototype.containedInRect=xf.prototype.Ah;xf.prototype.getNearestIntersectionPoint=xf.prototype.ws;xf.prototype.getDocumentBounds=xf.prototype.Li;xf.prototype.getDocumentPoint=xf.prototype.da;var Bn=new Ya,nn=new Ya;xf.className="Shape";xf.getFigureGenerators=function(){var a=new H,b;for(b in M.Qe)b!==b.toLowerCase()&&a.add(b,M.Qe[b]);a.freeze();return a};
xf.defineFigureGenerator=function(a,b){var c=a.toLowerCase(),d=M.Qe;d[a]=b;d[c]=a};xf.getArrowheadGeometries=function(){var a=new H;for(d in M.Im)if(void 0===Bn[d]){var b=P.parse(M.Im[d],!1);Bn[d]=b;b=d.toLowerCase();b!==d&&(Bn[b]=d)}for(var c in Bn)if(c!==c.toLowerCase()){var d=Bn[c];d instanceof P&&a.add(c,d)}a.freeze();return a};
xf.defineArrowheadGeometry=function(a,b){var c=null;"string"===typeof b?c=P.parse(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=Bn;d[a]=c;d[b]=a};
function Mg(a,b){Y.call(this);Dn||(En=Kg?(new vk(null)).context:null,Dn=!0);this.Xb="";this.Hc="black";this.pe="13px sans-serif";this.ti="start";this.Vd=pg;this.Ai=Zc;this.qj=!0;this.ai=this.bi=!1;this.$f=Fn;this.mg=Gn;this.vr=this.rb=this.Xc=0;this.$t=this.au=null;this.un=!1;this.md=this.Xm=this.zp=this.ui=this.Ap=null;this.lf=this.kf=0;this.Yh=Hn;this.we=Infinity;this.ei=0;this.qe=null;this.Ce=0;this.oe=this.Sb=this.Ec=null;this.Zd=1;this.Yd=0;this.Wd=1;this.Xd=this.jj=null;"string"===typeof a?
this.text=a:a&&Object.assign(this,a);b&&Object.assign(this,b);return this}ma(Mg,Y);
Mg.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.Xb=this.Xb;a.Hc=this.Hc;a.pe=this.pe;a.ti=this.ti;a.Vd=this.Vd;a.Ai=this.Ai;a.qj=this.qj;a.bi=this.bi;a.ai=this.ai;a.$f=this.$f;a.mg=this.mg;a.Xc=this.Xc;a.vr=this.vr;a.rb=this.rb;a.au=this.au;a.$t=this.$t;a.un=this.un;a.Ap=this.Ap;a.ui=this.ui;a.zp=this.zp;a.Xm=this.Xm;a.md=this.md;a.kf=this.kf;a.lf=this.lf;a.Yh=this.Yh;a.we=this.we;a.qe=this.qe;a.Ce=this.Ce;a.Ec=this.Ec;a.Sb=this.Sb;a.oe=this.oe;a.ei=this.ei;a.Zd=
this.Zd;a.Yd=this.Yd;a.Wd=this.Wd;a.jj=this.jj;a.Xd=this.Xd};
function Lm(a,b){a.G=b.G|6144;a.mb=b.opacity;a.Ub=b.background;a.hd=b.areaBackground;a.Uc=b.desiredSize.I();a.Zf=b.minSize.I();a.Yf=b.maxSize.I();null!==b.Bb?a.Bb=b.Bb.copy():a.Bb=null;a.sa=b.scale;a.yb=b.angle;a.Ee=b.stretch;a.Vg=b.margin.I();a.xb=b.alignment.I();a.xk=b.alignmentFocus.I();a.Bl=b.segmentFraction;a.Cl=b.segmentOffset.I();a.Dl=b.segmentOrientation;null!==b.$a&&(a.$a=b.$a.copy());a.Fl=b.shadowVisible;b instanceof Mg&&(a.Xb=b.Xb,a.Hc=b.Hc,a.pe=b.pe,a.ti=b.ti,a.Vd=b.Vd,a.Ai=b.Ai,a.qj=
b.qj,a.bi=b.bi,a.ai=b.ai,a.$f=b.$f,a.mg=b.mg,a.qe=null,a.kf=b.kf,a.lf=b.lf,a.we=b.we,a.ei=b.ei,a.Zd=b.Zd,a.Yd=b.Yd,a.Wd=b.Wd,a.jj=b.jj,a.Xd=b.Xd)}t=Mg.prototype;t.gb=function(a){a.classType===Mg?this.wrap=a:Y.prototype.gb.call(this,a)};t.toString=function(){return 22<this.Xb.length?'TextBlock("'+this.Xb.substring(0,20)+'"...)':'TextBlock("'+this.Xb+'")'};t.s=function(){Y.prototype.s.call(this);this.$t=this.au=null};
t.Ei=function(a,b){if(null!==this.Hc&&0!==this.Xb.length&&null!==this.pe){var c=this.naturalBounds,d=this.actualBounds,e=c.width,f=c.height,g=In(this),h=a.textAlign=this.ti,k=b.Vn;"start"===h?h=k?"right":"left":"end"===h&&(h=k?"left":"right");k=this.bi;var l=this.ai;di(this,a,this.Hc,!0,!1,c,d);(k||l)&&di(this,a,this.Hc,!1,!1,c,d);d=0;c=!1;var m=this.ee,n=m.dx-(g*m.m21+m.dx);m=m.dy-(g*m.m22+m.dy);var p=b.scale;8>(n*n+m*m)*p*p&&(c=!0);b.zb!==a&&(c=!1);!1===b.Ie("textGreeking")&&(c=!1);b=this.kf;n=
this.lf;switch(this.flip){case Uk:a.translate(e,0);a.scale(-1,1);break;case Tk:a.translate(0,f);a.scale(1,-1);break;case Vk:a.translate(e,f),a.scale(-1,-1)}a.Ed();m=this.Xc;p=(b+g+n)*m;f>p&&(d=this.Ai,d=d.y*f-d.y*p+d.offsetY);if(1===m&&null!==this.oe)n=this.rb,n>e&&(n=e),this.Di(this.oe,a,0,d+b,e,g,n,c,h,k,l);else if(null!==this.Ec&&null!==this.Sb)for(p=0;p<m;p++){var r=this.Ec[p];r>e&&(r=e);d+=b;this.Di(this.Sb[p],a,0,d,e,g,r,c,h,k,l);d+=g+n}switch(this.flip){case Uk:a.scale(-1,1);a.translate(-e,
0);break;case Tk:a.scale(1,-1);a.translate(0,-f);break;case Vk:a.scale(-1,-1),a.translate(-e,-f)}}};
t.Di=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!==Jn?Jn(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!==Kn?Kn(this,f):.8*f,b.beginPath(),b.lineWidth=a,b.moveTo(c+n,d+k),b.lineTo(c+n+g,d+k),b.stroke()),m&&(b.beginPath(),b.lineWidth=a,d=d+f-f/2.2|0,0!==a%2&&(d+=.5),b.moveTo(c+n,d),b.lineTo(c+
n+g,d),b.stroke()))};
t.im=function(a,b,c,d){this.ei=a;var e=this.pe;null!==En&&Ln!==e&&(Ln=En.font=e);this.rb=this.Ce=0;this.oe=this.Sb=this.Ec=this.qe=null;var f;if(isNaN(this.desiredSize.width)){e=this.Xb.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);g=e.substr(g,k-g);this.Yh===Hn&&(g=g.trim());f=Math.max(f,Mn(g));g=k+1}e=f}else f=e.indexOf("\n",0),0<=f&&(e=e.substr(0,f)),e=Mn(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=Nn(this,e);isNaN(this.desiredSize.height)?f=Math.min(f,b/this.scale):f=this.desiredSize.height;h=f;if(0!==this.rb&&null!==this.Ec&&null!==this.Sb&&this.$f===On&&(b=this.pe,b=this.$f===On?Pn(b):0,k=this.kf+this.lf,k=Math.max(0,In(this)+k),h=Math.min(this.maxLines-1,Math.max(Math.floor(h/k+.01)-1,0)),!(h+1>=this.Sb.length))){k=this.Sb[h];for(b=Math.max(1,a-b);Mn(k)>b&&1<k.length;)k=k.substr(0,
k.length-1);k+=Qn;b=Mn(k);this.Sb[h]=k;this.Sb=this.Sb.slice(0,h+1);this.Ec[h]=b;this.Ec=this.Ec.slice(0,h+1);this.Ce=this.Sb.length;this.rb=Math.max(this.rb,b);this.Xc=this.Ce;1===this.Xc&&(this.oe=this.Sb[0])}if(this.wrap===Rn||isNaN(this.desiredSize.width))e=isNaN(a)?this.rb:Math.min(a,this.rb),isNaN(this.desiredSize.width)&&(e=Math.max(8,e));e=Math.max(c,e);f=Math.max(d,f);Rb(this.xc,e,f);this.xe(0,0,e,f)};t.zh=function(a,b,c,d){el(this,a,b,c,d)};
function Sn(a,b,c){if(null===a.oe)a.oe=b,a.rb=c;else{if(null===a.Sb||null===a.Ec)a.Sb=[],a.Ec=[],a.Sb.push(a.oe),a.Ec.push(a.rb);a.Sb.push(b);a.Ec.push(c)}}
function Tn(a,b,c,d){var e=a.Yh===Hn;e&&(b=b.trim());var f=0,g=a.pe,h=a.kf+a.lf;h=Math.max(0,In(a)+h);var k=a.$f===On?Pn(g):0;if(a.Xc>=a.we)null!==d&&d.h(0,h);else if(g=b,a.mg===Un){a.Ce=1;var l=Mn(b);if(0===k||l<=c)a.rb=Math.max(a.rb,l),Sn(a,b,a.rb),null!==d&&d.h(l,h);else{f=Vn(a,g);g=g.substr(f.length);b=Vn(a,g);for(l=Mn(f+b);0<b.length&&l<=c;)f+=b,g=g.substr(b.length),b=Vn(a,g),l=f+b,e&&(l=l.trim()),l=Mn(l);e&&(b=b.trim());f+=b;for(c=Math.max(1,c-k);Mn(f)>c&&1<f.length;)f=f.substr(0,f.length-1);
f+=Qn;var m=Mn(f);a.rb=m;Sn(a,f,m);null!==d&&d.h(m,h)}}else{k=0;0===g.length&&(k=1,Sn(a,g,0));for(;0<g.length;){b=Vn(a,g);for(g=g.substr(b.length);Mn(b)>c;){var n=1;l=Mn(b.substr(0,n));for(m=0;l<=c;)n++,m=l,l=Mn(b.substr(0,n));if(1===n){var p=l;f=Math.max(f,l)}else p=m,f=Math.max(f,m);n--;1>n&&(n=1);Sn(a,b.substr(0,n),p);k++;b=b.substr(n);if(a.Xc+k>a.we)break}m=Vn(a,g);for(l=Mn(b+m);0<m.length&&l<=c;)b+=m,g=g.substr(m.length),m=Vn(a,g),l=b+m,e&&(l=l.trim()),l=Mn(l);e&&(b=b.trim());if(""!==b&&("\u00ad"===
b[b.length-1]&&(b=b.substring(0,b.length-1)+"\u2010"),0===m.length?(n=l,f=Math.max(f,l)):(n=m=Mn(b),f=Math.max(f,m)),Sn(a,b,n),k++,a.Xc+k>a.we))break}a.Ce=Math.min(a.we,k);a.rb=Math.max(a.rb,f);null!==d&&d.h(a.rb,h*a.Ce)}}function Vn(a,b){if(a.mg===Wn)return b.substr(0,1);for(var c=b.length,d=0,e=Xn;d<c&&!e.test(b.charAt(d));)d++;for(a.Yh===Yn&&(c=Math.min(c,d+1));d<c&&e.test(b.charAt(d));)d++;return d>=b.length?b:b.substr(0,d)}function Mn(a){return null===En?8*a.length:En.measureText(a).width}
function In(a){if(null!==a.qe)return a.qe;var b=a.pe;if(null===En){var c=16;return a.qe=c}void 0!==Zn[b]&&5E3>$n?c=Zn[b]:(c=1.3*En.measureText("M").width,Zn[b]=c,$n++);return a.qe=c}function Pn(a){if(null===En)return 6;if(void 0!==ao[a]&&5E3>bo)var b=ao[a];else b=En.measureText(Qn).width,ao[a]=b,bo++;return b}
function Nn(a,b){var c=a.Xb.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),d=a.kf+a.lf;d=Math.max(0,In(a)+d);if(0===c.length)return a.rb=0,a.Xc=1,d;if(!a.isMultiline){var e=c.indexOf("\n",0);0<=e&&(c=c.substr(0,e))}e=0;for(var f=a.Xc=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.mg!==Un){a.Ce=0;var k=Gb.alloc();Tn(a,f,b,k);e+=k.height;Gb.free(k);a.Xc+=a.Ce}else Tn(a,f,b,null),e+=d,a.Xc++;a.Xc===a.we&&(h=!0)}f=g+1}return a.vr=e}
na.Object.defineProperties(Mg.prototype,{font:{get:function(){return this.pe},set:function(a){var b=this.pe;b!==a&&(this.pe=a,this.qe=null,this.s(),this.g("font",b,a))}},text:{get:function(){return this.Xb},set:function(a){var b=this.Xb;null!==a&&void 0!==a?a=a.toString():a="";b!==a&&(this.Xb=a,this.s(),this.g("text",b,a))}},textAlign:{get:function(){return this.ti},set:function(a){var b=this.ti;b===a||"start"!==
a&&"end"!==a&&"left"!==a&&"right"!==a&&"center"!==a||(this.ti=a,this.N(),this.g("textAlign",b,a))}},flip:{get:function(){return this.Vd},set:function(a){var b=this.Vd;b!==a&&(this.Vd=a,this.N(),this.g("flip",b,a))}},verticalAlignment:{get:function(){return this.Ai},set:function(a){var b=this.Ai;b.A(a)||(this.Ai=a=a.I(),ul(this),this.g("verticalAlignment",b,a))}},naturalBounds:{get:function(){if(!this.xc.u()){var a=
Gb.alloc();Tn(this,this.Xb,999999,a);var b=a.width;Gb.free(a);a=Nn(this,b);var c=this.desiredSize;isNaN(c.width)||(b=c.width);isNaN(c.height)||(a=c.height);Rb(this.xc,b,a)}return this.xc}},isMultiline:{get:function(){return this.qj},set:function(a){var b=this.qj;b!==a&&(this.qj=a,this.s(),this.g("isMultiline",b,a))}},isUnderline:{get:function(){return this.bi},set:function(a){var b=this.bi;b!==a&&(this.bi=a,this.N(),this.g("isUnderline",
b,a))}},isStrikethrough:{get:function(){return this.ai},set:function(a){var b=this.ai;b!==a&&(this.ai=a,this.N(),this.g("isStrikethrough",b,a))}},wrap:{get:function(){return this.mg},set:function(a){var b=this.mg;b!==a&&(this.mg=a,this.s(),this.g("wrap",b,a))}},overflow:{get:function(){return this.$f},set:function(a){var b=this.$f;b!==a&&(this.$f=a,this.s(),this.g("overflow",b,a))}},stroke:{
get:function(){return this.Hc},set:function(a){var b=this.Hc;b!==a&&(null!==a&&Il(a,"TextBlock.stroke"),a instanceof hl&&a.freeze(),this.Hc=a,this.N(),this.g("stroke",b,a))}},lineCount:{get:function(){return this.Xc}},lineHeight:{get:function(){return In(this)}},editable:{get:function(){return this.un},set:function(a){var b=this.un;b!==a&&(this.un=a,this.g("editable",b,a))}},textEditor:{
get:function(){return this.Ap},set:function(a){var b=this.Ap;b!==a&&(this.Ap=a,this.g("textEditor",b,a))}},errorFunction:{get:function(){return this.md},set:function(a){var b=this.md;b!==a&&(this.md=a,this.g("errorFunction",b,a))}},interval:{get:function(){return this.Zd},set:function(a){var b=this.Zd;a=Math.round(a);if(b!==a&&0!==a&&isFinite(a)){this.Zd=a;this.s();var c=this.panel;null!==c&&(c.Rf=null);this.g("interval",b,a)}}},graduatedStart:{
get:function(){return this.Yd},set:function(a){var b=this.Yd;b!==a&&(0>a?a=0:1<a&&(a=1),this.Yd=a,this.s(),this.g("graduatedStart",b,a))}},graduatedEnd:{get:function(){return this.Wd},set:function(a){var b=this.Wd;b!==a&&(0>a?a=0:1<a&&(a=1),this.Wd=a,this.s(),this.g("graduatedEnd",b,a))}},graduatedFunction:{get:function(){return this.jj},set:function(a){var b=this.jj;b!==a&&(this.jj=a,this.s(),this.g("graduatedFunction",b,a))}},
graduatedSkip:{get:function(){return this.Xd},set:function(a){var b=this.Xd;b!==a&&(this.Xd=a,this.s(),this.g("graduatedSkip",b,a))}},textValidation:{get:function(){return this.ui},set:function(a){var b=this.ui;b!==a&&(this.ui=a,this.g("textValidation",b,a))}},textEdited:{get:function(){return this.zp},set:function(a){var b=this.zp;b!==a&&(this.zp=a,this.g("textEdited",b,a))}},spacingAbove:{
get:function(){return this.kf},set:function(a){var b=this.kf;b!==a&&(this.kf=a,this.s(),this.g("spacingAbove",b,a))}},spacingBelow:{get:function(){return this.lf},set:function(a){var b=this.lf;b!==a&&(this.lf=a,this.s(),this.g("spacingBelow",b,a))}},formatting:{get:function(){return this.Yh},set:function(a){var b=this.Yh;b!==a&&(this.Yh=a,this.s(),this.g("formatting",b,a))}},maxLines:{get:function(){return this.we},
set:function(a){var b=this.we;b!==a&&(a=Math.floor(a),0>=a&&xa(a,"> 0",Mg,"maxLines"),this.we=a,this.s(),this.g("maxLines",b,a))}},metrics:{get:function(){return{arrSize:null!==this.Ec?this.Ec:[this.rb],arrText:null!==this.Sb?this.Sb:[this.oe],maxLineWidth:this.rb,fontHeight:this.qe}}},choices:{get:function(){return this.Xm},set:function(a){var b=this.Xm;b!==a&&(this.Xm=a,this.g("choices",b,a))}}});
var Jn=null,Kn=null,Un=new D(Mg,"None",0),Rn=new D(Mg,"WrapFit",1),Gn=new D(Mg,"WrapDesiredSize",2),Wn=new D(Mg,"WrapBreakAll",3),Fn=new D(Mg,"OverflowClip",0),On=new D(Mg,"OverflowEllipsis",1),Hn=new D(Mg,"FormatTrim",0),Yn=new D(Mg,"FormatNone",0),Xn=/[ \u200b\u00ad]/,Zn=new Ya,$n=0,ao=new Ya,bo=0,Qn="...",Ln="",En=null,Dn=!1;Mg.className="TextBlock";Mg.getEllipsis=function(){return Qn};Mg.setEllipsis=function(a){Qn=a;ao=new Ya;bo=0};Mg.getBaseline=function(){return Jn};
Mg.setBaseline=function(a){Jn=a};Mg.getUnderline=function(){return Kn};Mg.setUnderline=function(a){Kn=a};Mg.isValidFont=function(a){Dn||(En=Kg?(new vk(null)).context:null,Dn=!0);if(null===En)return!0;var b=En.font;if(a===b||"10px sans-serif"===a)return!0;En.font="10px sans-serif";En.font=a;var c=En.font;if("10px sans-serif"!==c)return En.font=b,!0;En.font="19px serif";var d=En.font;En.font=a;c=En.font;En.font=b;return c!==d};Mg.None=Un;Mg.WrapFit=Rn;Mg.WrapDesiredSize=Gn;Mg.WrapBreakAll=Wn;
Mg.OverflowClip=Fn;Mg.OverflowEllipsis=On;function Rj(a,b){Y.call(this);this.Mg=null;this.sp="";this.lh=kc;this.Xk=qd;this.oh=this.md=null;this.Wk=yc;this.Vd=pg;this.Ol=null;this.Rn=!1;this.br=!0;this.ml=!1;this.Hl=null;"string"===typeof a?this.source=a:a&&Object.assign(this,a);b&&Object.assign(this,b)}ma(Rj,Y);
Rj.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.element=this.Mg;a.sp=this.sp;a.lh=this.lh.I();a.Xk=this.Xk;a.Vd=this.Vd;a.md=this.md;a.oh=this.oh;a.Wk=this.Wk.I();a.br=this.br;a.Hl=this.Hl};Rj.prototype.gb=function(a){a===pg||a===rg||a===Sk?this.imageStretch=a:Y.prototype.gb.call(this,a)};Rj.prototype.toString=function(){return"Picture("+this.source+")#"+ib(this)};function Di(a){void 0===a&&(a="");""!==a?co[a]&&(delete co[a],eo--):(co=new Ya,eo=0)}
function fo(a,b){b.Py||(b.Zt=function(c){b.mr=!0;b.Mn=!1;var d=b.Ig.copy();if(null!==d&&void 0!==d){for(d=d.iterator;d.next();){var e=d.value;var f=b.getAttribute("src");var g=e.fh.H(f);if(null!==g)for(var h=g.length,k=0;k<h;k++)f=g[k],e.Oo.add(f),e.Fb(),b.Fn&&(void 0===b.mu&&(b.mu=c),null!==f.oh&&f.oh(f,c))}b.Ig=null}a.desiredSize.u()||(dj(a,!1),a.s())},b.Ot=function(a){b.Mn=a;var c=b.Ig.copy();if(null!==c&&void 0!==c){for(c=c.iterator;c.next();){var e=c.value,f=b.getAttribute("src");var g=e.fh.H(f);
if(null!==g){e=g.length;f=Ea();for(var h=0;h<e;h++)f.push(g[h]);if(b.Fn)for(h=0;h<e;h++)g=f[h],null!==g.md&&g.md(g,a);Ia(f)}}b.Ig=null}},b.addEventListener("load",b.Zt),b.addEventListener("error",b.Ot),b.Py=!0)}function Tj(a){a.removeEventListener("load",a.Zt);a.removeEventListener("error",a.Ot);delete a.Zt;delete a.Ot}Rj.prototype.DA=function(){if(""!==this.source){Di(this.source);var a=this.source;this.source="";this.source=a}};Rj.prototype.redraw=function(){this.N()};
Rj.prototype.Ei=function(a,b){var c=this.Mg;if(null!==c){var d=c.getAttribute("src");if(!(c instanceof HTMLImageElement&&(null===d||""===d)||c.Mn instanceof Event&&a instanceof pl)){d=this.naturalBounds;var e=0,f=0,g=this.Rn,h=g?+c.width:c.naturalWidth;g=g?+c.height:c.naturalHeight;void 0===h&&c.videoWidth&&(h=c.videoWidth);void 0===g&&c.videoHeight&&(g=c.videoHeight);h=h||d.width;g=g||d.height;if(0!==h&&0!==g){var k=h,l=g;this.sourceRect.u()&&(e=this.lh.x,f=this.lh.y,h=this.lh.width,g=this.lh.height);
var m=h,n=g,p=this.Xk,r=this.Wk;switch(p){case pg:if(this.sourceRect.u())break;m>=d.width&&(e=e+r.offsetX+(m*r.x-d.width*r.x));n>=d.height&&(f=f+r.offsetY+(n*r.y-d.height*r.y));h=Math.min(d.width,m);g=Math.min(d.height,n);break;case qd:m=d.width;n=d.height;break;case rg:case Sk:p===rg?(p=Math.min(d.height/n,d.width/m),m*=p,n*=p):p===Sk&&(p=Math.max(d.height/n,d.width/m),m*=p,n*=p,m>=d.width&&(e=(e+r.offsetX+(m*r.x-d.width*r.x)/m)*h),n>=d.height&&(f=(f+r.offsetY+(n*r.y-d.height*r.y)/n)*g),h*=1/(m/
d.width),g*=1/(n/d.height),m=d.width,n=d.height)}p=this.Af()*b.scale;var q=m*p*n*p,u=h*g/q,w=c.__goCache;p=null;var v=go;if(c.mr&&void 0!==w&&4<q&&u>v*v)for(null===w.Ci&&(ho(w,4,k,l,c),ho(w,16,k,l,c)),k=w.Ci,l=k.length,q=0;q<l;q++)if(k[q].ratio*k[q].ratio<u)p=k[q];else break;if(!b.rn){if(null===this.Ol)if(null===this.Mg)this.Ol=!1;else{k=(new vk(null)).context;k.drawImage(this.Mg,0,0);try{k.getImageData(0,0,1,1).data[3]&&(this.Ol=!1),this.Ol=!1}catch(y){this.Ol=!0}}if(this.Ol)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 Uk:a.translate(Math.min(d.width,m),0);a.scale(-1,1);break;case Tk:a.translate(0,Math.min(d.height,n));a.scale(1,-1);break;case Vk:a.translate(Math.min(d.width,m),Math.min(d.height,n)),a.scale(-1,-1)}a.Ed();if(b.Ie("pictureRatioOptimization")&&!b.pj&&void 0!==w&&null!==p&&1!==p.ratio){a.save();b=p.ratio;try{a.drawImage(p.source,e/b,f/b,Math.min(p.source.width,h/b),Math.min(p.source.height,g/
b),k,l,Math.min(d.width,m),Math.min(d.height,n))}catch(y){this.br=!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.br=!1}switch(this.flip){case Uk:a.scale(-1,1);a.translate(-Math.min(d.width,m),0);break;case Tk:a.scale(1,-1);a.translate(0,-Math.min(d.height,n));break;case Vk:a.scale(-1,-1),a.translate(-Math.min(d.width,m),-Math.min(d.height,n))}}}}};
Rj.prototype.im=function(a,b,c,d){var e=this.desiredSize,f=cl(this,!0),g=this.Mg,h=this.Rn;if(h||!this.ml&&g&&g.complete)this.ml=!0;null===g&&(isFinite(e.width)||(a=0),isFinite(e.height)||(b=0));isFinite(e.width)||f===qd||f===Qk?(isFinite(a)||(a=this.sourceRect.u()?this.sourceRect.width:h?+g.width:g.naturalWidth),c=0):null!==g&&!1!==this.ml&&(a=this.sourceRect.u()?this.sourceRect.width:h?+g.width:g.naturalWidth);isFinite(e.height)||f===qd||f===Rk?(isFinite(b)||(b=this.sourceRect.u()?this.sourceRect.height:
h?+g.height:g.naturalHeight),d=0):null!==g&&!1!==this.ml&&(b=this.sourceRect.u()?this.sourceRect.height:h?+g.height:g.naturalHeight);isFinite(e.width)&&(a=e.width);isFinite(e.height)&&(b=e.height);e=this.maxSize;f=this.minSize;c=Math.max(c,f.width);d=Math.max(d,f.height);a=Math.min(e.width,a);b=Math.min(e.height,b);a=Math.max(c,a);b=Math.max(d,b);null===g||g.complete||(isFinite(a)||(a=0),isFinite(b)||(b=0));Rb(this.xc,a,b);this.xe(0,0,a,b)};Rj.prototype.zh=function(a,b,c,d){el(this,a,b,c,d)};
na.Object.defineProperties(Rj.prototype,{element:{get:function(){return this.Mg},set:function(a){var b=this.Mg;if(b!==a){this.Rn=a instanceof HTMLCanvasElement;var c=a instanceof HTMLImageElement;b instanceof HTMLImageElement&&Tj(b);null===a||c||a instanceof HTMLVideoElement||this.Rn||B("Picture.element must be an instance of Image, Canvas, or Video, not: "+a);var d=this.diagram;null!==d&&Sj(d,this);this.Mg=a;null!==a&&c&&void 0===a.Ig&&(a.Ig=new G);null!==d&&c&&Qj(d,
this);null!==a&&(this.Rn||!0===a.complete?(a.Fn&&(a.Mn instanceof Event&&null!==this.md?this.md(this,a.Mn):!0===a.mr&&!a.Mn&&null!==this.oh&&a.mu&&this.oh(this,a.mu)),a.mr=!0,this.desiredSize.u()||(dj(this,!1),this.s())):c&&fo(this,a));this.g("element",b,a);this.N()}}},source:{get:function(){return this.sp},set:function(a){var b=this.sp;if(b!==a){this.sp=a;var c=co;if(Kg){var d=null;if(void 0!==c[a])d=c[a];else if(""!==a){30<eo&&(Di(),c=co);d=va("img");d.Fn=!0;fo(this,
d);var e=this.Hl;null!==e&&(d.crossOrigin=e(this));d.src=a;c[a]=d;eo++}this.element=d;null!==d&&void 0===d.__goCache&&(d.__goCache=new io);this.s();this.N()}this.g("source",b,a)}}},sourceCrossOrigin:{get:function(){return this.Hl},set:function(a){if(this.Hl!==a&&(this.Hl=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.lh},set:function(a){var b=this.lh;b.A(a)||(this.lh=a=a.I(),this.N(),this.g("sourceRect",b,a))}},imageStretch:{get:function(){return this.Xk},set:function(a){var b=this.Xk;b!==a&&(this.Xk=a,this.N(),this.g("imageStretch",b,a))}},flip:{get:function(){return this.Vd},set:function(a){var b=this.Vd;b!==a&&(this.Vd=a,this.N(),this.g("flip",b,a))}},imageAlignment:{get:function(){return this.Wk},
set:function(a){var b=this.Wk;b.A(a)||(this.Wk=a=a.I(),this.N(),this.g("imageAlignment",b,a))}},errorFunction:{get:function(){return this.md},set:function(a){var b=this.md;b!==a&&(this.md=a,this.g("errorFunction",b,a))}},successFunction:{get:function(){return this.oh},set:function(a){var b=this.oh;b!==a&&(this.oh=a,this.g("successFunction",b,a))}},naturalBounds:{get:function(){return this.xc}}});
Rj.prototype.redraw=Rj.prototype.redraw;Rj.prototype.reloadSource=Rj.prototype.DA;var co=null,eo=0,go=4;Rj.className="Picture";co=new Ya;Rj.clearCache=Di;function io(){this.Ci=null}function ho(a,b,c,d,e){null===a.Ci&&(a.Ci=[]);var f=new vk(null),g=f.context,h=1/b;f.width=c/b;f.height=d/b;0!==f.width&&0!==f.height&&(b=new jo(f.La,b),c=1,0<a.Ci.length&&(c=a.Ci[a.Ci.length-1],e=c.source,c=c.ratio),g.setTransform(h*c,0,0,h*c,0,0),g.Ed(),g.drawImage(e,0,0),a.Ci.push(b))}io.className="PictureCacheArray";
function jo(a,b){this.source=a;this.ratio=b}jo.className="PictureCacheInstance";function ko(){this.ts=new P;this.jc=null}ko.prototype.reset=function(a){null!==a?(a.ea(),this.ts=a,a.figures.clear()):this.ts=new P;this.jc=null};function xd(a,b,c,d,e){a.jc=new $d;a.jc.startX=b;a.jc.startY=c;a.jc.isFilled=d;a.ts.figures.add(a.jc);void 0!==e&&(a.jc.isShadowed=e)}function Bd(a){var b=a.jc.segments.length;0<b&&a.jc.segments.J(b-1).close()}ko.prototype.Bm=function(a){this.jc.isShadowed=a};
ko.prototype.moveTo=function(a,b,c){void 0===c&&(c=!1);var d=new ae(Pd);d.endX=a;d.endY=b;c&&d.close();this.jc.segments.add(d)};ko.prototype.lineTo=function(a,b,c){void 0===c&&(c=!1);var d=new ae(sd);d.endX=a;d.endY=b;c&&d.close();this.jc.segments.add(d)};function yd(a,b,c,d,e,f,g){var h;void 0===h&&(h=!1);var k=new ae(Qd);k.point1X=b;k.point1Y=c;k.point2X=d;k.point2Y=e;k.endX=f;k.endY=g;h&&k.close();a.jc.segments.add(k)}
function zd(a,b,c,d,e){var f;void 0===f&&(f=!1);var g=new ae(Rd);g.point1X=b;g.point1Y=c;g.endX=d;g.endY=e;f&&g.close();a.jc.segments.add(g)}ko.prototype.arcTo=function(a,b,c,d,e,f,g){void 0===f&&(f=0);void 0===g&&(g=!1);var h=new ae(Sd);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.jc.segments.add(h)};function Ad(a,b,c,d,e,f,g,h){var k;void 0===k&&(k=!1);b=new ae(Td,g,h,b,c,d,e,f);k&&b.close();a.jc.segments.add(b)}
function td(a){var b=Cd;if(null!==b)return Cd=null,b.reset(a),b;b=new ko;b.reset(a);return b}var Cd=null;ko.className="StreamGeometryContext";function lo(a,b){var c=a.toLowerCase(),d=M.Qe;d[a]=b;d[c]=a}lo("Rectangle",function(a,b,c){a="r"+b+","+c;var d=M.Jf[a];if(void 0!==d)return d;d=new P(P.C);d.endX=b;d.endY=c;M.Kf<M.Jm&&(M.Jf[a]=d,M.Kf++);return d});
lo("Square",function(a,b,c){a="s"+b+","+c;var d=M.Jf[a];if(void 0!==d)return d;d=new P(P.C);d.endX=b;d.endY=c;d.defaultStretch=rg;M.Kf<M.Jm&&(M.Jf[a]=d,M.Kf++);return d});
lo("RoundedRectangle",function(a,b,c){a=a?a.parameter1:NaN;if(isNaN(a)||0>a)a=5;a=Math.min(a,b/3);a=Math.min(a,c/3);var d="rr"+b+","+c+","+a,e=M.Jf[d];if(void 0!==e)return e;var f=a*M.wg;e=(new P).add((new $d(a,0,!0)).add(new ae(sd,b-a,0)).add(new ae(Qd,b,a,b-f,0,b,f)).add(new ae(sd,b,c-a)).add(new ae(Qd,b-a,c,b,c-f,b-f,c)).add(new ae(sd,a,c)).add(new ae(Qd,0,c-a,f,c,0,c-f)).add(new ae(sd,0,a)).add((new ae(Qd,a,0,0,f,f,0)).close()));1<f&&(e.spot1=new O(0,0,f,f),e.spot2=new O(1,1,-f,-f));M.Kf<M.Jm&&
(M.Jf[d]=e,M.Kf++);return e});lo("Border","RoundedRectangle");lo("Ellipse",function(a,b,c){a="e"+b+","+c;var d=M.Jf[a];if(void 0!==d)return d;d=new P(P.K);d.endX=b;d.endY=c;d.spot1=ed;d.spot2=fd;M.Kf<M.Jm&&(M.Jf[a]=d,M.Kf++);return d});lo("Circle",function(a,b,c){a="c"+b+","+c;var d=M.Jf[a];if(void 0!==d)return d;d=new P(P.K);d.endX=b;d.endY=c;d.spot1=ed;d.spot2=fd;d.defaultStretch=rg;M.Kf<M.Jm&&(M.Jf[a]=d,M.Kf++);return d});
lo("TriangleRight",function(a,b,c){return(new P).add((new $d(0,0)).add(new ae(sd,b,.5*c)).add((new ae(sd,0,c)).close())).Cm(0,.25,.5,.75)});lo("TriangleDown",function(a,b,c){return(new P).add((new $d(0,0)).add(new ae(sd,b,0)).add((new ae(sd,.5*b,c)).close())).Cm(.25,0,.75,.5)});lo("TriangleLeft",function(a,b,c){return(new P).add((new $d(b,c)).add(new ae(sd,0,.5*c)).add((new ae(sd,b,0)).close())).Cm(.5,.25,1,.75)});
lo("TriangleUp",function(a,b,c){return(new P).add((new $d(b,c)).add(new ae(sd,0,c)).add((new ae(sd,.5*b,0)).close())).Cm(.25,.5,.75,1)});lo("Triangle","TriangleUp");lo("Diamond",function(a,b,c){return(new P).add((new $d(.5*b,0)).add(new ae(sd,0,.5*c)).add(new ae(sd,.5*b,c)).add((new ae(sd,b,.5*c)).close())).Cm(.25,.25,.75,.75)});lo("LineH",function(a,b,c){a=new P(P.j);a.startX=0;a.startY=c/2;a.endX=b;a.endY=c/2;return a});
lo("LineV",function(a,b,c){a=new P(P.j);a.startX=b/2;a.startY=0;a.endX=b/2;a.endY=c;return a});lo("None","Rectangle");lo("BarH","Rectangle");lo("BarV","Rectangle");lo("MinusLine","LineH");lo("PlusLine",function(a,b,c){return(new P).add((new $d(0,c/2,!1)).add(new ae(sd,b,c/2)).add(new ae(Pd,b/2,0)).add(new ae(sd,b/2,c)))});lo("XLine",function(a,b,c){return(new P).add((new $d(0,c,!1)).add(new ae(sd,b,0)).add(new ae(Pd,0,0)).add(new ae(sd,b,c)))});
M.Im={"":"",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 V(a,b){void 0===a||a instanceof Fl||"string"===typeof a?X.call(this,a):(X.call(this),a&&(b=a));this.F=2408959;this.Ug=this.Nf="";this.Yo=this.Uo=this.ip=this.eo=null;this.kp="";this.Lf=this.Pn=this.jp=this.jh=null;this.Wo="";this.Vo=Nb;this.Xb=this.Zo="";this.fi=this.$m=this.Rh=null;this.Wf=(new K(NaN,NaN)).freeze();this.lo="";this.cf=null;this.mo=uc;this.$o=Wc;this.uo=Ab;this.no=Db;this.qn=null;this.fo=127;this.pp=Eb;this.op="gray";this.hg=4;this.Ww=-1;this.Lp=NaN;this.Oy=new N;this.li=
null;this.Xf=NaN;b&&Object.assign(this,b)}ma(V,X);
V.prototype.cloneProtected=function(a){X.prototype.cloneProtected.call(this,a);a.F=this.F&-4097|49152;a.Nf=this.Nf;a.Ug=this.Ug;a.eo=this.eo;a.ip=this.ip;a.Uo=this.Uo;a.Yo=this.Yo;a.kp=this.kp;a.jp=this.jp;a.Pn=this.Pn;a.Lf=null;a.Wo=this.Wo;a.Vo=this.Vo.I();a.Zo=this.Zo;a.$o=this.$o.I();a.Xb=this.Xb;a.$m=this.$m;a.Wf.assign(this.Wf);a.lo=this.lo;a.mo=this.mo.I();a.uo=this.uo.I();a.no=this.no.I();a.qn=this.qn;a.fo=this.fo;a.pp=this.pp.I();a.op=this.op;a.hg=this.hg;a.Lp=this.Lp};
V.prototype.wf=function(a){X.prototype.wf.call(this,a);a.Gh();a.jh=null;a.cf=null;a.li=null};V.prototype.toString=function(){var a=Ja(this.constructor)+"#"+ib(this);null!==this.data&&(a+="("+Ka(this.data)+")");return a};V.prototype.qk=function(a,b,c,d,e,f,g){var h=this.diagram;null!==h&&(a===pe&&"elements"===b?e instanceof X?vj(e,function(a){xj(h.partManager,a);wj(h,a)}):Qj(h,e):a===qe&&"elements"===b&&(e instanceof X?vj(e,function(a){Aj(h.partManager,a,h)}):Sj(h,e)),h.Wa(a,b,c,d,e,f,g))};
V.prototype.Fa=function(a){X.prototype.Fa.call(this,a);if(null!==this.data){for(var b=this.U.l,c=b.length,d=0;d<c;d++){var e=b[d];e instanceof X&&vj(e,function(a){null!==a.data&&a.Fa()})}for(b=this.adornments;b.next();)b.value.Fa(a)}};V.prototype.updateRelationshipsFromData=function(){null!==this.data&&this.diagram.partManager.updateRelationshipsFromData(this)};V.prototype.Yj=function(a){var b=this.Lf;return null===b?null:b.H(a)};
V.prototype.xh=function(a,b){if(null!==b){var c=null,d=this.Lf;null!==d&&(c=d.H(a));if(c!==b){if(null!==c){var e=c.diagram;null!==e&&e.remove(c)}null===d&&(this.Lf=d=new H);b.Nf!==a&&(b.category=a);d.add(a,b);a=this.diagram;null!==a&&(a.add(b),a=b.adornedObject,null!==a&&(a=a.Ch(),null!==a&&(b.data=a.data)))}}};V.prototype.Gf=function(a){var b=this.Lf;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.Lf=null)}};
V.prototype.Qj=function(){var a=this.Lf;if(null!==a){var b=Ea();for(a=a.iterator;a.next();)b.push(a.key);a=b.length;for(var c=0;c<a;c++)this.Gf(b[c]);Ia(b)}};
V.prototype.updateAdornments=function(){var a=this.diagram;if(null!==a){for(var b=this.adornments;b.next();){var c=b.value;c.s();c.placeholder&&c.placeholder.s()}a:{if(this.isSelected&&this.selectionAdorned&&(b=this.selectionObject,null!==b&&this.actualBounds.u()&&this.isVisible()&&b.Ff()&&b.actualBounds.u())){c=this.Yj("Selection");if(null===c){c=this.selectionAdornmentTemplate;null===c&&(c=this.Hh()?a.linkSelectionAdornmentTemplate:this instanceof U?a.groupSelectionAdornmentTemplate:a.nodeSelectionAdornmentTemplate);
if(!(c instanceof ze))break a;og(c);c=c.copy();null!==c&&(this.Hh()&&this.selectionObject===this.path&&(c.type=X.Link),c.adornedObject=b)}if(null!==c){c.type===X.Link&&c.s();this.xh("Selection",c);break a}}this.Gf("Selection")}mo(this,a);for(b=this.adornments;b.next();)b.value.Fa()}};V.prototype.Lb=function(){var a=this.diagram;null!==a&&(Mi(a),0!==(this.F&16384)!==!0&&(this.F|=16384,a.Fb()))};function bi(a){0!==(a.F&16384)!==!1&&(a.updateAdornments(),a.F&=-16385)}
function mo(a,b){b.toolManager.mouseDownTools.each(function(b){b.isEnabled&&b.updateAdornments(a)});b.toolManager.updateAdornments(a)}function no(a){if(!1===kj(a)){oo(a,!0);a.dl();var b=a.diagram;null!==b&&(b.se.add(a),b.Fb())}}function po(a){a.F|=2097152;if(!1!==kj(a)){var b=a.position,c=a.location;c.u()&&b.u()||qo(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.jm(d,c);N.free(d);oo(a,!1)}}
V.prototype.xe=function(a,b,c,d){var e=this.mc;e.h(a,b,c,d);null===this.Bb&&(this.Bb=new od);var f=this.Bb;f.reset();this.np(f,a,b,c,d);this.Bb=f;f.Cs()||f.xq(e)};
V.prototype.np=function(a,b,c,d,e){1!==this.sa&&a.scale(this.sa);if(0!==this.yb){var f=yc;this.locationSpot.hb()&&(f=this.locationSpot);var g=K.alloc();if(this.locationObject!==this)for(b=this.locationObject,c=b.naturalBounds,g.Ui(c.x,c.y,c.width,c.height,f),null!==b.Bb&&b.Bb.Aa(g),g.offset(-b.measuredBounds.x,-b.measuredBounds.y),f=b.panel;null!==f&&f!==this;)null!==f.Bb&&f.Bb.Aa(g),g.offset(-f.measuredBounds.x,-f.measuredBounds.y),f=f.panel;else g.Ui(b,c,d,e,f);a.rotate(this.yb,g.x,g.y);K.free(g)}};
V.prototype.move=function(a,b){!0===b?this.location=a:this.position=a};V.prototype.moveTo=function(a,b,c){a=K.allocAt(a,b);this.move(a,c);K.free(a)};V.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.Ms(this))return!0}a=this.containingGroup;return null===a||a.isSubGraphExpanded&&a.isVisible()?!0:!1};
V.prototype.Ob=function(a){var b=this.diagram;a?(this.B(4),this.Lb(),null!==b&&b.se.add(this)):(this.B(8),this.Qj());this.Gh();null!==b&&(b.Qa(),b.N())};V.prototype.Ya=function(a){if(this.name===a)return this;var b=this.li;null===b&&(this.li=b=new H);if(null!==b.H(a))return b.H(a);var c=X.prototype.Ya.call(this,a);if(null!==c)return b.set(a,c),c;b.set(a,null);return null};
function ro(a,b,c,d){void 0===d&&(d=new K);c=c.Cc()?yc:c;var e=b.naturalBounds;d.h(e.width*c.x+c.offsetX,e.height*c.y+c.offsetY);if(null===b||b===a)return d;b.transform.Aa(d);for(b=b.panel;null!==b&&b!==a;)b.transform.Aa(d),b=b.panel;null!==a.Bb&&a.Bb.Aa(d);d.offset(-a.mc.x,-a.mc.y);return d}V.prototype.Li=function(a){void 0===a&&(a=new N);return a.assign(this.actualBounds)};V.prototype.Ta=function(){!0===ij(this)&&this.measure(Infinity,Infinity);this.arrange()};
function tj(a,b){var c=a.Oy;isNaN(a.Xf)&&(a.Xf=Xm(a));var d=a.Xf;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}
V.prototype.arrange=function(){if(!1===jj(this))po(this);else{dl(this,!1);var a=this.wb,b=N.alloc();b.assign(a);var c=mg(this);this.zh(0,0,this.mc.width,this.mc.height);var d=this.position;qo(this,d,this.location);a.ea();a.x=d.x;a.y=d.y;a.freeze();this.jm(b,a);b.A(a)?this.Md(c):!this.Nc()||M.w(b.width,a.width)&&M.w(b.height,a.height)||0<=this.Ww&&this.B(16);N.free(b);oo(this,!1)}};t=V.prototype;
t.jm=function(a,b){var c=this.diagram;if(null!==c){var d=!1;if(!1===c.lj&&a.u()){var e=N.alloc();e.assign(c.documentBounds);e.Vv(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.F&65536)!==!0&&a.A(b)||yj(this,d,c);c.N();!a.u()&&!b.u()||Ub(a,b)||(this instanceof W&&!c.undoManager.isUndoingRedoing&&this.rd(),this.Gh())}};
t.Rv=function(a,b,c){if(this.Hh()||!a.u())return!1;var d=this.diagram;null!==d&&so(this,d,a,b,c);this.ja=a;this.F&=-2097153;var e=this.Wf;!e.u()||null!==d&&!d.animationManager.isTicking&&d.undoManager.isUndoingRedoing||(d=e.copy(),e.h(e.x+(a.x-b),e.y+(a.y-c)),this.g("location",d,e.copy()));!1===kj(this)&&!1===jj(this)&&(no(this),po(this));return!0};function so(a,b,c,d,e){null===b||a instanceof ze||(b=b.animationManager,b.sb&&Eh(b,a,new K(d,e),c))}
t.ym=function(a,b,c){var d=this.Wf,e=this.ja;if(c){if(d.x===a&&d.y===b)return;kj(this)||jj(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;kj(this)||jj(this)?this.Ws():d.h(d.x+a-e.x,d.y+b-e.y);e.h(a,b)}no(this)};t.Ws=function(){this.F&=-2097153;no(this)};
function qo(a,b,c){var d=K.alloc(),e=a.locationObject,f=e.naturalBounds,g=e instanceof xf?e.strokeWidth:0;d.Ui(0,0,f.width+g,f.height+g,a.locationSpot);if(e!==a)for(d.offset(-g/2,-g/2),e.transform.Aa(d),e=e.panel;null!==e&&e!==a;)e.transform.Aa(d),e=e.panel;null!==a.Bb&&a.Bb.Aa(d);d.offset(-a.mc.x,-a.mc.y);e=a.diagram;f=c.u();g=b.u();f&&g?0!==(a.F&2097152)?to(a,b,c,e,d):uo(a,b,c,e,d):f?to(a,b,c,e,d):g&&uo(a,b,c,e,d);a.F|=2097152;K.free(d);a.dl()}
function to(a,b,c,d,e){var f=b.x,g=b.y;b.h(c.x-e.x,c.y-e.y);null!==d&&(c=d.animationManager,(d=c.defaultAnimation.isAnimating)||!c.sb||a instanceof ze||Eh(c,a,new K(f,g),b),d||b.x===f&&b.y===g||a.g("position",new K(f,g),b.copy()))}function uo(a,b,c,d,e){var f=c.copy();c.h(b.x+e.x,b.y+e.y);c.A(f)||null===d||a.g("location",f,c.copy())}
function yj(a,b,c){fl(a,!1);a instanceof W&&qk(c,a);a.layer.isTemporary||b||c.Qa();b=a.wb;var d=c.viewportBounds;d.u()?mg(a)?($b(b,d)||a.Md(!1),a.updateAdornments()):b.Mc(d)?(a.Md(!0),a.updateAdornments()):a.Lb():c.nj=!0}t.Ri=function(){return!0};t.Nc=function(){return!0};t.Hh=function(){return!1};t.Qi=function(){return!0};
function vo(a,b,c,d){b.constructor===a.constructor||wo||(wo=!0,ya('Should not change the class of the Part when changing category from "'+c+'" to "'+d+'"'),ya("  Old class: "+Ja(a.constructor)+", new class: "+Ja(b.constructor)+", part: "+a.toString()));a.Qj();var e=a.data;c=a.layerName;var f=a.isSelected,g=a.isHighlighted,h=!0,k=!0,l=!1;a instanceof W&&(h=a.isTreeLeaf,k=a.isTreeExpanded,l=a.wasTreeExpanded);b.wf(a);b.cloneProtected(a);a.Nf=d;a.s();a.N();b=a.diagram;d=!0;null!==b&&(d=b.skipsUndoManager,
b.skipsUndoManager=!0);a.jb=e;a.F=f?a.F|4096:a.F&-4097;a.F=g?a.F|524288:a.F&-524289;a instanceof W&&(a.R=h?a.R|4:a.R&-5,a.R=k?a.R|1:a.R&-2,a.R=l?a.R|2:a.R&-3);null!==e&&a.Fa();e=a.layerName;e!==c&&(a.Ug=c,a.layerName=e);null!==b&&(b.skipsUndoManager=d);a.Nc()&&a.B(64)}V.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};
V.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};V.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};
V.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};V.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};
V.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};V.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};
V.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};V.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 kj(a){return 0!==(a.F&32768)}function oo(a,b){a.F=b?a.F|32768:a.F&-32769}function fl(a,b){a.F=b?a.F|65536:a.F&-65537}
function mg(a){return 0!==(a.F&131072)}t=V.prototype;t.Md=function(a){this.F=a?this.F|131072:this.F&-131073};function xo(a,b){a.F=b?a.F|1048576:a.F&-1048577}t.Gh=function(){var a=this.containingGroup;null!==a&&(a.s(),null!==a.placeholder&&a.placeholder.s(),a.rd())};t.N=function(){var a=this.diagram;null!==a&&!jj(this)&&!kj(this)&&this.isVisible()&&this.wb.u()&&a.N(tj(this,this.wb))};
t.s=function(){X.prototype.s.call(this);var a=this.diagram;null!==a&&(a.se.add(this),this instanceof W&&null!==this.labeledLink&&ul(this.labeledLink),a.Fb(!0))};t.cq=function(a){a||(a=this.Rh,null!==a&&yo(a,this))};t.eq=function(a){a||(a=this.Rh,null!==a&&zo(a,this))};t.Wj=function(){var a=this.data;if(null!==a){var b=this.diagram;null!==b&&(b=b.model,null!==b&&b.om(a))}};t.Nz=function(){return Ao(this,this)};
function Ao(a,b){var c=b.containingGroup;return null!==c?1+Ao(a,c):b instanceof W&&(b=b.labeledLink,null!==b)?Ao(a,b):0}t.Rz=function(){return Bo(this,this)};function Bo(a,b){var c=b.containingGroup;return null!==c||b instanceof W&&(c=b.labeledLink,null!==c)?Bo(a,c):b}t.Jd=function(a){return a instanceof U?Co(this,this,a):!1};function Co(a,b,c){if(b===c||null===c)return!1;var d=b.containingGroup;return null===d||d!==c&&!Co(a,d,c)?b instanceof W&&(b=b.labeledLink,null!==b)?Co(a,b,c):!1:!0}
t.Px=function(a){if(null===a)return null;if(this===a)return this.containingGroup;for(var b=this;null!==b;){b instanceof U&&xo(b,!0);if(b instanceof W){var c=b.labeledLink;null!==c&&(b=c)}b=b.containingGroup}c=null;for(b=a;null!==b;){if(0!==(b.F&1048576)){c=b;break}b instanceof W&&(a=b.labeledLink,null!==a&&(b=a));b=b.containingGroup}for(b=this;null!==b;)b instanceof U&&xo(b,!1),b instanceof W&&(a=b.labeledLink,null!==a&&(b=a)),b=b.containingGroup;return c};
V.prototype.canLayout=function(){if(!this.isLayoutPositioned||!this.isVisible())return!1;var a=this.layer;return null!==a&&a.isTemporary||this instanceof W&&this.isLinkLabel?!1:!0};
V.prototype.B=function(a){void 0===a&&(a=16777215);if(this.isLayoutPositioned&&0!==(a&this.layoutConditions)){var b=this.layer;null!==b&&b.isTemporary||this instanceof W&&this.isLinkLabel?b=!1:(b=this.diagram,b=null!==b&&b.undoManager.isUndoingRedoing?!1:!0)}else b=!1;if(b)if(b=this.Rh,null!==b){var c=b.layout;null!==c?c.B():b.B(a)}else a=this.diagram,null!==a&&(a=a.layout,null!==a&&a.B())};function zj(a){if(!a.isVisible())return!1;a=a.layer;return null!==a&&a.isTemporary?!1:!0}
function Mk(a,b,c,d,e,f){void 0===f&&(f=null);if(!(a.contains(b)||null!==f&&!f(b)||b instanceof ze))if(a.add(b),b instanceof W){if(c&&b instanceof U)for(var g=b.memberParts;g.next();)Mk(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)&&Mk(a,h,c,d,e,f)}}if(1<d)for(b=b.$u();b.next();)Mk(a,b.value,c,d-1,e,f)}else if(b instanceof T)for(b=b.labelNodes;b.next();)Mk(a,
b.value,c,d,e,f)}
na.Object.defineProperties(V.prototype,{key:{get:function(){var a=this.diagram;if(null!==a)return a.model.pa(this.data)}},adornments:{get:function(){return null===this.Lf?ab:this.Lf.iteratorValues}},layer:{get:function(){return this.fi}},diagram:{get:function(){var a=this.fi;return null===a||void 0===a?null:a.diagram}},layerName:{get:function(){return this.Ug},set:function(a){var b=
this.Ug;if(b!==a){var c=this.diagram;if(null===c||null!==c.Zj(a)&&!c.partManager.addsToTemporaryLayer)if(this.Ug=a,null!==c&&c.Qa(),this.g("layerName",b,a),b=this.layer,null!==b&&b.name!==a&&(c=b.diagram,null!==c&&(a=c.Zj(a),null!==a&&a!==b))){var d=b.rc(-1,this,!0);0<=d&&c.Wa(qe,"parts",b,this,null,d,!0);d=a.Ni(99999999,this,!0);b.visible!==a.visible&&this.Ob(a.visible);0<=d&&c.Wa(pe,"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.eo},set:function(a){var b=this.eo;b!==a&&(this.eo=a,this.g("layerChanged",b,a))}},zOrder:{get:function(){return this.Lp},set:function(a){var b=this.Lp;if(b!==a){this.Lp=a;var c=this.layer;null!==c&&ei(c,-1,this);this.g("zOrder",b,a);a=this.diagram;null!==a&&a.N()}}},locationObject:{get:function(){if(null===this.cf){var a=this.locationObjectName;""!==a?(a=this.Ya(a),null!==a?this.cf=a:this.cf=this):
this instanceof ze?this.type!==X.Link&&null!==this.placeholder?this.cf=this.placeholder:this.cf=this:this.cf=this}return this.cf.visible?this.cf:this}},minLocation:{get:function(){return this.uo},set:function(a){var b=this.uo;b.A(a)||(this.uo=a=a.I(),this.g("minLocation",b,a))}},maxLocation:{get:function(){return this.no},set:function(a){var b=this.no;b.A(a)||(this.no=a=a.I(),this.g("maxLocation",b,a))}},locationObjectName:{
get:function(){return this.lo},set:function(a){var b=this.lo;b!==a&&(this.lo=a,this.cf=null,this.s(),this.g("locationObjectName",b,a))}},locationSpot:{get:function(){return this.mo},set:function(a){var b=this.mo;b.A(a)||(this.mo=a=a.I(),this.s(),this.g("locationSpot",b,a))}},location:{get:function(){return this.Wf},set:function(a){var b=a.x,c=a.y,d=this.Wf;if(!(d.x===b||isNaN(d.x)&&isNaN(b))||!(d.y===c||isNaN(d.y)&&isNaN(c))){a=
a.copy();b=a;if(this.Hh())b=!1;else{this.Wf=b;this.F|=2097152;if(!1===jj(this)&&(no(this),c=this.ja,c.u())){var e=this.diagram;if(null===e||e.animationManager.isTicking||!e.undoManager.isUndoingRedoing){var f=c.copy();c.h(c.x+(b.x-d.x),c.y+(b.y-d.y));so(this,e,c,f.x,f.y);this.g("position",f,c.copy())}}b=!0}b&&this.g("location",d,a.copy())}}},category:{get:function(){return this.Nf},set:function(a){var b=this.Nf;if(b!==a){var c=this.diagram,d=this.data,e=null;if(null!==
c&&null!==d&&!(this instanceof ze)){var f=c.model.undoManager;f.isEnabled&&!f.isUndoingRedoing&&(e=this.clone(),e.U.addAll(this.U))}this.Nf=a;this.g("category",b,a);null===c||null===d||this instanceof ze?this instanceof ze&&(e=this.adornedPart,null!==e&&(a=e.Lf,null!==a&&a.remove(b),e.xh(this.category,this))):(f=c.model,f.undoManager.isUndoingRedoing||(this.Hh()?(c.partManager.setLinkCategoryForData(d,a),c=c.partManager.findLinkTemplateForCategory(a),null!==c&&(og(c),c=c.copy(),null!==c&&vo(this,
c,b,a))):(null!==f&&f.vm(d,a),c=Do(c.partManager,d,a),null!==c&&(og(c),c=c.copy(),null===c||c instanceof T||(d=this.location.copy(),vo(this,c,b,a),this.location.u()||(this.location=d)))),null!==e&&(b=this.clone(),b.U.addAll(this.U),this.g("self",e,b))))}}},self:{get:function(){return this},set:function(a){vo(this,a,this.category,a.category)}},copyable:{get:function(){return 0!==(this.F&1)},set:function(a){var b=0!==(this.F&1);b!==a&&(this.F^=
1,this.g("copyable",b,a))}},deletable:{get:function(){return 0!==(this.F&2)},set:function(a){var b=0!==(this.F&2);b!==a&&(this.F^=2,this.g("deletable",b,a))}},textEditable:{get:function(){return 0!==(this.F&4)},set:function(a){var b=0!==(this.F&4);b!==a&&(this.F^=4,this.g("textEditable",b,a),this.Lb())}},groupable:{get:function(){return 0!==(this.F&8)},set:function(a){var b=0!==(this.F&8);b!==a&&(this.F^=8,this.g("groupable",
b,a))}},movable:{get:function(){return 0!==(this.F&16)},set:function(a){var b=0!==(this.F&16);b!==a&&(this.F^=16,this.g("movable",b,a))}},selectionAdorned:{get:function(){return 0!==(this.F&32)},set:function(a){var b=0!==(this.F&32);b!==a&&(this.F^=32,this.g("selectionAdorned",b,a),this.Lb())}},isInDocumentBounds:{get:function(){return 0!==(this.F&64)},set:function(a){var b=0!==(this.F&64);if(b!==a){this.F^=
64;var c=this.diagram;null!==c&&c.Qa();this.g("isInDocumentBounds",b,a)}}},isLayoutPositioned:{get:function(){return 0!==(this.F&128)},set:function(a){var b=0!==(this.F&128);b!==a&&(this.F^=128,this.g("isLayoutPositioned",b,a),this.B(a?4:8))}},selectable:{get:function(){return 0!==(this.F&256)},set:function(a){var b=0!==(this.F&256);b!==a&&(this.F^=256,this.g("selectable",b,a),this.Lb())}},reshapable:{get:function(){return 0!==
(this.F&512)},set:function(a){var b=0!==(this.F&512);b!==a&&(this.F^=512,this.g("reshapable",b,a),this.Lb())}},resizable:{get:function(){return 0!==(this.F&1024)},set:function(a){var b=0!==(this.F&1024);b!==a&&(this.F^=1024,this.g("resizable",b,a),this.Lb())}},rotatable:{get:function(){return 0!==(this.F&2048)},set:function(a){var b=0!==(this.F&2048);b!==a&&(this.F^=2048,this.g("rotatable",b,a),this.Lb())}},isSelected:{
get:function(){return 0!==(this.F&4096)},set:function(a){var b=0!==(this.F&4096);if(b!==a){var c=this.diagram;if(!a||this.canSelect()&&!(null!==c&&c.selection.count>=c.maxSelectionCount)){this.F^=4096;var d=!1;if(null!==c){d=c.skipsUndoManager;c.skipsUndoManager=!0;var e=c.selection;e.ea();a?e.add(this):e.remove(this);e.freeze()}this.g("isSelected",b,a);this.Lb();a=this.selectionChanged;null!==a&&a(this);null!==c&&(c.Fb(),c.skipsUndoManager=d)}}}},isHighlighted:{get:function(){return 0!==
(this.F&524288)},set:function(a){var b=0!==(this.F&524288);if(b!==a){this.F^=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.N();a=this.highlightedChanged;null!==a&&a(this)}}},isShadowed:{get:function(){return 0!==(this.F&8192)},set:function(a){var b=0!==(this.F&8192);b!==a&&(this.F^=8192,this.g("isShadowed",b,a),this.N())}},isAnimated:{get:function(){return 0!==
(this.F&262144)},set:function(a){var b=0!==(this.F&262144);b!==a&&(this.F^=262144,this.g("isAnimated",b,a))}},highlightedChanged:{get:function(){return this.Pn},set:function(a){var b=this.Pn;b!==a&&(this.Pn=a,this.g("highlightedChanged",b,a))}},selectionObjectName:{get:function(){return this.kp},set:function(a){var b=this.kp;b!==a&&(this.kp=a,this.jh=null,this.g("selectionObjectName",b,a))}},selectionAdornmentTemplate:{
get:function(){return this.ip},set:function(a){var b=this.ip;b!==a&&(this.ip=a,this.g("selectionAdornmentTemplate",b,a))}},selectionObject:{get:function(){if(null===this.jh){var a=this.selectionObjectName;null!==a&&""!==a?(a=this.Ya(a),null!==a?this.jh=a:this.jh=this):this instanceof T?(a=this.path,null!==a?this.jh=a:this.jh=this):this.jh=this}return this.jh}},selectionChanged:{get:function(){return this.jp},set:function(a){var b=this.jp;
b!==a&&(this.jp=a,this.g("selectionChanged",b,a))}},resizeAdornmentTemplate:{get:function(){return this.Uo},set:function(a){var b=this.Uo;b!==a&&(this.Uo=a,this.g("resizeAdornmentTemplate",b,a))}},resizeObjectName:{get:function(){return this.Wo},set:function(a){var b=this.Wo;b!==a&&(this.Wo=a,this.g("resizeObjectName",b,a))}},resizeObject:{get:function(){var a=this.resizeObjectName;return""!==a&&(a=this.Ya(a),
null!==a)?a:this}},resizeCellSize:{get:function(){return this.Vo},set:function(a){var b=this.Vo;b.A(a)||(this.Vo=a=a.I(),this.g("resizeCellSize",b,a))}},rotateAdornmentTemplate:{get:function(){return this.Yo},set:function(a){var b=this.Yo;b!==a&&(this.Yo=a,this.g("rotateAdornmentTemplate",b,a))}},rotateObjectName:{get:function(){return this.Zo},set:function(a){var b=this.Zo;b!==a&&(this.Zo=a,this.g("rotateObjectName",
b,a))}},rotateObject:{get:function(){var a=this.rotateObjectName;return""!==a&&(a=this.Ya(a),null!==a)?a:this}},rotationSpot:{get:function(){return this.$o},set:function(a){var b=this.$o;b.A(a)||(this.$o=a=a.I(),this.g("rotationSpot",b,a))}},text:{get:function(){return this.Xb},set:function(a){var b=this.Xb;b!==a&&(this.Xb=a,this.g("text",b,a))}},containingGroup:{get:function(){return this.Rh},
set:function(a){if(this.Nc()){var b=this.Rh;if(b!==a){null===a||this!==a&&!a.Jd(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.B(2);var c=this.diagram;null!==b?zo(b,this):this instanceof U&&null!==c&&c.wi.remove(this);this.Rh=a;null!==a?yo(a,this):this instanceof U&&null!==c&&c.wi.add(this);this.B(1);if(null!==c&&c.Z){var d=this.data,e=c.model;if(null!==d&&
e.ek()){var f=e.pa(null!==a?a.data:null);e.uq(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 U)for(c=new G,Mk(c,this,!0,0,!0),c=c.iterator;c.next();)if(d=c.value,d instanceof W)for(d=d.linksConnected;d.next();)Eo(d.value);if(this instanceof W){for(c=this.linksConnected;c.next();)Eo(c.value);c=this.labeledLink;null!==c&&Eo(c)}this.g("containingGroup",b,a);null!==a&&(b=a.layer,null!==b&&ei(b,-1,a))}}else B("cannot set the Part.containingGroup of a Link or Adornment")}},
containingGroupChanged:{get:function(){return this.$m},set:function(a){var b=this.$m;b!==a&&(this.$m=a,this.g("containingGroupChanged",b,a))}},isTopLevel:{get:function(){return null!==this.containingGroup||this instanceof W&&null!==this.labeledLink?!1:!0}},layoutConditions:{get:function(){return this.fo},set:function(a){var b=this.fo;b!==a&&(this.fo=a,this.g("layoutConditions",b,a))}},dragComputation:{
get:function(){return this.qn},set:function(a){var b=this.qn;b!==a&&(this.qn=a,this.g("dragComputation",b,a))}},shadowOffset:{get:function(){return this.pp},set:function(a){var b=this.pp;b.A(a)||(this.pp=a=a.I(),this.N(),this.g("shadowOffset",b,a))}},shadowColor:{get:function(){return this.op},set:function(a){var b=this.op;b!==a&&(this.op=a,this.N(),this.g("shadowColor",b,a))}},shadowBlur:{get:function(){return this.hg},
set:function(a){var b=this.hg;b!==a&&(this.hg=a,this.N(),this.g("shadowBlur",b,a))}}});V.prototype.invalidateLayout=V.prototype.B;V.prototype.findCommonContainingGroup=V.prototype.Px;V.prototype.isMemberOf=V.prototype.Jd;V.prototype.findTopLevelPart=V.prototype.Rz;V.prototype.findSubGraphLevel=V.prototype.Nz;V.prototype.ensureBounds=V.prototype.Ta;V.prototype.getDocumentBounds=V.prototype.Li;V.prototype.findObject=V.prototype.Ya;V.prototype.moveTo=V.prototype.moveTo;
V.prototype.invalidateAdornments=V.prototype.Lb;V.prototype.clearAdornments=V.prototype.Qj;V.prototype.removeAdornment=V.prototype.Gf;V.prototype.addAdornment=V.prototype.xh;V.prototype.findAdornment=V.prototype.Yj;V.prototype.updateTargetBindings=V.prototype.Fa;var wo=!1;V.className="Part";V.LayoutNone=0;V.LayoutAdded=1;V.LayoutRemoved=2;V.LayoutShown=4;V.LayoutHidden=8;V.LayoutNodeSized=16;V.LayoutGroupLayout=32;V.LayoutNodeReplaced=64;V.LayoutStandard=127;V.LayoutAll=16777215;
function ze(a,b){void 0===a||a instanceof Fl||"string"===typeof a?V.call(this,a):(V.call(this),a&&(b=a));this.F&=-257;this.Ug="Adornment";this.ke=null;this.$w=0;this.vx=!1;this.j=a instanceof Dm?[]:Fo;this.Sa=null;b&&Object.assign(this,b)}ma(ze,V);ze.prototype.toString=function(){var a=this.adornedPart;return"Adornment("+this.category+")"+(null!==a?a.toString():"")};ze.prototype.updateRelationshipsFromData=function(){};
ze.prototype.hk=function(a){var b=this.adornedObject.part;if(b instanceof T&&this.adornedObject instanceof xf){var c=b.path;b.hk(a);a=c.geometry;b=this.U.l;c=b.length;for(var d=0;d<c;d++){var e=b[d];e.isPanelMain&&e instanceof xf&&(e.ma=a)}}};ze.prototype.Ri=function(){var a=this.ke;if(null===a)return!0;a=a.part;return null===a||!jj(a)};ze.prototype.Nc=function(){return!1};
ze.prototype.qk=function(a,b,c,d,e,f,g){if(a===pe&&"elements"===b)if(e instanceof ng)null===this.Sa&&(this.Sa=e);else{if(e instanceof X){var h=e.$l(function(a){return a instanceof ng});h instanceof ng&&null===this.Sa&&(this.Sa=h)}}else a===qe&&"elements"===b&&null!==this.Sa&&(d===this.Sa?this.Sa=null:d instanceof X&&this.Sa.sg(d)&&(this.Sa=null));V.prototype.qk.call(this,a,b,c,d,e,f,g)};ze.prototype.updateAdornments=function(){};ze.prototype.Wj=function(){};
na.Object.defineProperties(ze.prototype,{placeholder:{get:function(){return this.Sa}},adornedObject:{get:function(){return this.ke},set:function(a){var b=this.adornedPart,c=null;null!==a&&(c=a.part);null===b||null!==a&&b===c||b.Gf(this.category);this.ke=a;null!==c&&c.xh(this.category,this)}},adornedPart:{get:function(){var a=this.ke;return null!==a?a.part:null}},containingGroup:{
get:function(){return null}}});var Fo=[];ze.className="Adornment";function W(a,b){void 0===a||a instanceof Fl||"string"===typeof a?V.call(this,a):(V.call(this),a&&(b=a));this.R=13;this.ab=new E;this.Ep=this.il=this.ii=this.io=this.ho=null;this.Bk=qc;this.oc=this.Te=null;this.Ro=Go;this.vh=!1;b&&Object.assign(this,b)}ma(W,V);
W.prototype.cloneProtected=function(a){V.prototype.cloneProtected.call(this,a);a.R=this.R;a.R=this.R&-17;a.ho=this.ho;a.io=this.io;a.ii=this.ii;a.Ep=this.Ep;a.Bk=this.Bk.I();a.Ro=this.Ro};t=W.prototype;t.wf=function(a){V.prototype.wf.call(this,a);a.rd();a.Te=this.Te;a.oc=null};function Ho(a,b){null!==b&&(null===a.Te&&(a.Te=new G),a.Te.add(b))}
function Io(a,b,c,d){if(null===b||null===a.Te)return null;for(var e=a.Te.iterator;e.next();){var f=e.value;if(f.Ks===a&&f.wv===b&&f.qy===c&&f.sy===d||f.Ks===b&&f.wv===a&&f.qy===d&&f.sy===c)return f}return null}t.jA=function(a,b,c){if(void 0===b||null===b)b="";if(void 0===c||null===c)c="";a=Io(this,a,b,c);null!==a&&a.em()};t.qk=function(a,b,c,d,e,f,g){a===pe&&"elements"===b?this.oc=null:a===qe&&"elements"===b&&(this.oc=null);V.prototype.qk.call(this,a,b,c,d,e,f,g)};
t.rd=function(a){void 0===a&&(a=null);for(var b=this.linksConnected;b.next();){var c=b.value;null!==a&&a.contains(c)||(Jo(c.fromPort),Jo(c.toPort),c.Va())}};function gl(a,b){for(a=a.linksConnected;a.next();){var c=a.value;if(c.fromPort===b||c.toPort===b)Jo(c.fromPort),Jo(c.toPort),c.Va()}}function Jo(a){if(null!==a){var b=a.Qo;null!==b&&b.em();a=a.part;b=a.containingGroup;null===b||a.isVisible()||Jo(b.port)}}t.Ri=function(){return!0};
W.prototype.getAvoidableRect=function(a){a.set(this.actualBounds);a.Mp(this.Bk);return a};W.prototype.findVisibleNode=function(){for(var a=this;null!==a&&!a.isVisible();)a=a.containingGroup;return a};
W.prototype.isVisible=function(){if(!V.prototype.isVisible.call(this))return!1;var a=!0,b=ri,c=this.diagram;if(null!==c){if(c.animationManager.Ms(this))return!0;a=c.isTreePathToChildren;b=c.treeCollapsePolicy}if(b===ri){if(a=this.rg(),null!==a&&!a.isTreeExpanded)return!1}else if(b===xk){if(a=a?this.Xu():this.Yu(),0<a.count&&a.all(function(a){return!a.isTreeExpanded}))return!1}else if(b===yk&&(a=a?this.Xu():this.Yu(),0<a.count&&a.any(function(a){return!a.isTreeExpanded})))return!1;a=this.labeledLink;
return null!==a?a.isVisible():!0};W.prototype.Ob=function(a){V.prototype.Ob.call(this,a);for(var b=this.linksConnected;b.next();){var c=b.value;if(a&&null!==this.containingGroup){var d=c.aq(this);null===d||d.Jd(this.containingGroup)||c.Va()}c.Ob(a)}};W.prototype.Qx=function(){var a=new G,b=new G;Ko(this,this,a,b);return b.iterator};
function Ko(a,b,c,d){if(null!==b&&!c.has(b)){c.add(b);var e=!0,f=a.diagram;null!==f&&(e=f.isTreePathToChildren);b.linksConnected.each(function(f){f.isTreeLink?(e?f.fromNode===b:f.toNode===b)&&Ko(a,e?f.toNode:f.fromNode,c,d):d.add(f)})}}W.prototype.findLinksConnected=function(a){void 0===a&&(a=null);if(null===a)return this.ab.iterator;var b=new db(this.ab),c=this;b.predicate=function(b){return b.fromNode===c&&b.fromPortId===a||b.toNode===c&&b.toPortId===a};return b};t=W.prototype;
t.Wp=function(a){void 0===a&&(a=null);var b=new db(this.ab),c=this;b.predicate=function(b){return b.fromNode!==c?!1:null===a?!0:b.fromPortId===a};return b};t.Gd=function(a){void 0===a&&(a=null);var b=new db(this.ab),c=this;b.predicate=function(b){return b.toNode!==c?!1:null===a?!0:b.toPortId===a};return b};
t.Wu=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.ab.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 G,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 G,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new bb(c):ab};
t.Yu=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.ab.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 G,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new bb(c):ab};
t.Xu=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.ab.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 G,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new bb(c):ab};
t.Iz=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);var d=new db(this.ab),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.Jz=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);var d=new db(this.ab),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 Lo(a,b,c){Jo(c);var d=a.ab.contains(b);d||a.ab.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.vh||(e.vh=f),!f.isTreeLeaf||null!==a&&a.undoManager.isUndoingRedoing||(d?c===f&&(f.isTreeLeaf=!1):b===f&&(f.isTreeLeaf=!1))))}
function Mo(a,b,c){Jo(c);var d=a.ab.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.vh=!1),null===b||b.isTreeLeaf||(0===b.ab.count?(b.vh=null,null!==e&&e.undoManager.isUndoingRedoing||(b.isTreeLeaf=!0)):wk(b)))}
function wk(a){a.vh=!1;if(0!==a.ab.count){var b=!0,c=a.diagram;if(null===c||!c.undoManager.isUndoingRedoing){null!==c&&(b=c.isTreePathToChildren);for(c=a.ab.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}}}W.prototype.updateRelationshipsFromData=function(){var a=this.diagram;null!==a&&a.partManager.updateRelationshipsFromData(this)};t=W.prototype;
t.cq=function(a){V.prototype.cq.call(this,a);a||(wk(this),a=this.il,null!==a&&No(a,this))};t.eq=function(a){V.prototype.eq.call(this,a);a||(a=this.il,null!==a&&null!==a.nd&&(a.nd.remove(this),a.s()))};
t.Wj=function(){if(0<this.ab.count){var a=this.diagram;if(null!==a)for(var b=null!==a.commandHandler?a.commandHandler.deletesConnectedLinks:!0,c=this.ab.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;V.prototype.Wj.call(this)};t.ss=function(a){if(null===this.oc){if(""===a&&!1===this.Je)return this;Oo(this)}var b=this.oc.H(a);return null!==b||""!==a&&(b=this.oc.H(""),null!==b)?b:this};
function Oo(a){null===a.oc?a.oc=new H:a.oc.clear();a.Em(a,function(a,c){Kl(a,c)});0===a.oc.count&&a.oc.add("",a)}function Kl(a,b){var c=b.portId;null!==c&&null!==a.oc&&a.oc.add(c,b)}function Jl(a,b,c){var d=b.portId;if(null!==d&&(null!==a.oc&&a.oc.remove(d),b=a.diagram,null!==b&&c)){c=null;for(a=a.findLinksConnected(d);a.next();)d=a.value,null===c&&(c=Ea()),c.push(d);if(null!==c){for(a=0;a<c.length;a++)b.remove(c[a]);Ia(c)}}}
t.lA=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.ab.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.ab.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.Vz=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this;if(a)for(;;){a=null;for(var c=b.ab.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.ab.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.Fz=function(a){if(null===a)return null;if(this===a)return this;for(var b=this;null!==b;)xo(b,!0),b=b.rg();var c=null;for(b=a;null!==b;){if(0!==(b.F&1048576)){c=b;break}b=b.rg()}for(b=this;null!==b;)xo(b,!1),b=b.rg();return c};t.Ii=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this.ab.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.rg=function(){var a=this.vh;if(null===a)return null;if(a instanceof W)return a;var b=!0;a=this.diagram;null!==a&&(b=a.isTreePathToChildren);a=this.ab.iterator;if(b)for(;a.next();){if(b=a.value,b.isTreeLink&&(b=b.fromNode,b!==this))return this.vh=b}else for(;a.next();)if(b=a.value,b.isTreeLink&&(b=b.toNode,b!==this))return this.vh=b;return this.vh=null};t.Tz=function(){function a(b,d){if(null!==b){d.add(b);var c=b.Ii();null!==c&&(d.add(c),a(b.rg(),d))}}var b=new G;a(this,b);return b};
t.Sz=function(){return Po(this,this)};function Po(a,b){b=b.rg();return null===b?0:1+Po(a,b)}t.Yp=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=new db(this.ab);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.$u=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);var c=b=null,d=this.ab.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 bb(c):ab};
t.Uz=function(a){void 0===a&&(a=Infinity);var b=new G;Mk(b,this,!1,a,!0);return b};W.prototype.collapseTree=function(a){void 0===a&&(a=1);1>a&&(a=1);var b=this.diagram;if(null!==b&&!b.Ke){b.Ke=!0;var c=new G;c.add(this);Qo(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===ri);b.Ke=!1}};function Qo(a,b,c,d,e,f,g){if(1<d)for(var h=c?a.Wp():a.Gd();h.next();){var k=h.value;k.isTreeLink&&(k=k.aq(a),null===k||k===a||b.contains(k)||(b.add(k),Qo(k,b,c,d-1,e,f,g)))}else Ro(a,b,c,e,f,g)}
function Ro(a,b,c,d,e,f){for(var g=e===a?!0:a.isTreeExpanded,h=c?a.Wp():a.Gd();h.next();){var k=h.value;if(k.isTreeLink&&(k=k.aq(a),null!==k&&k!==a)){var l=b.contains(k);l||b.add(k);g&&(f&&d.Mj(k,e),k.Gh(),k.Ob(!1));k.isTreeExpanded&&(k.wasTreeExpanded=k.isTreeExpanded,l||Ro(k,b,c,d,e,f))}}a.isTreeExpanded=!1}
W.prototype.expandTree=function(a){void 0===a&&(a=2);2>a&&(a=2);var b=this.diagram;if(null!==b&&!b.Ke){b.Ke=!0;var c=new G;c.add(this);So(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===ri);b.Ke=!1}};
function So(a,b,c,d,e,f,g){for(var h=f===a?!1:a.isTreeExpanded,k=c?a.Wp():a.Gd();k.next();){var l=k.value;l.isTreeLink&&(h||l.td||l.Va(),l=l.aq(a),null!==l&&l!==a&&!b.contains(l)&&(b.add(l),h||(l.Ob(!0),l.Gh(),g&&e.Oj(l,f)),2<d||l.wasTreeExpanded))&&(l.wasTreeExpanded=!1,So(l,b,c,d-1,e,f,g))}a.isTreeExpanded=!0}
na.Object.defineProperties(W.prototype,{portSpreading:{get:function(){return this.Ro},set:function(a){var b=this.Ro;b!==a&&(this.Ro=a,this.g("portSpreading",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.rd())}},avoidable:{get:function(){return 0!==(this.R&8)},set:function(a){var b=0!==(this.R&8);if(b!==a){this.R^=8;var c=this.diagram;null!==c&&qk(c,this);this.g("avoidable",b,a)}}},avoidableMargin:{
get:function(){return this.Bk},set:function(a){"number"===typeof a&&(a=new lc(a));var b=this.Bk;if(!b.A(a)){this.Bk=a=a.I();var c=this.diagram;null!==c&&qk(c,this);this.g("avoidableMargin",b,a)}}},linksConnected:{get:function(){return this.ab.iterator}},linkConnected:{get:function(){return this.ho},set:function(a){var b=this.ho;b!==a&&(this.ho=a,this.g("linkConnected",b,a))}},linkDisconnected:{get:function(){return this.io},
set:function(a){var b=this.io;b!==a&&(this.io=a,this.g("linkDisconnected",b,a))}},linkValidation:{get:function(){return this.ii},set:function(a){var b=this.ii;b!==a&&(this.ii=a,this.g("linkValidation",b,a))}},isLinkLabel:{get:function(){return null!==this.il}},labeledLink:{get:function(){return this.il},set:function(a){var b=this.il;if(b!==a){var c=this.diagram,d=this.data;if(null!==b){null!==b.nd&&(b.nd.remove(this),
b.s());if(null!==c&&null!==d&&!c.undoManager.isUndoingRedoing){var e=b.data,f=c.model;if(null!==e&&f.Pi()){var g=f.pa(d);void 0!==g&&f.ty(e,g)}}this.containingGroup=null}this.il=a;null!==a&&(No(a,this),null===c||null===d||c.undoManager.isUndoingRedoing||(e=a.data,c=c.model,null!==e&&c.Pi()&&(d=c.pa(d),void 0!==d&&c.Cu(e,d))),this.containingGroup=a.containingGroup);ul(this);this.g("labeledLink",b,a)}}},port:{get:function(){return this.ss("")}},ports:{
get:function(){null===this.oc&&Oo(this);return this.oc.iteratorValues}},isTreeExpanded:{get:function(){return 0!==(this.R&1)},set:function(a){var b=0!==(this.R&1);if(b!==a){this.R^=1;var c=this.diagram;this.g("isTreeExpanded",b,a);b=this.treeExpandedChanged;if(null!==b){var d=!0;null!==c&&(d=c.Z,c.Z=!0);b(this);null!==c&&(c.Z=d)}null!==c&&c.undoManager.isUndoingRedoing?this.Ob(a):a?this.expandTree():this.collapseTree()}}},wasTreeExpanded:{
get:function(){return 0!==(this.R&2)},set:function(a){var b=0!==(this.R&2);b!==a&&(this.R^=2,this.g("wasTreeExpanded",b,a))}},treeExpandedChanged:{get:function(){return this.Ep},set:function(a){var b=this.Ep;b!==a&&(this.Ep=a,this.g("treeExpandedChanged",b,a))}},isTreeLeaf:{get:function(){return 0!==(this.R&4)},set:function(a){var b=0!==(this.R&4);b!==a&&(this.R^=4,this.g("isTreeLeaf",b,a))}}});W.prototype.expandTree=W.prototype.expandTree;
W.prototype.collapseTree=W.prototype.collapseTree;W.prototype.findTreeParts=W.prototype.Uz;W.prototype.findTreeChildrenNodes=W.prototype.$u;W.prototype.findTreeChildrenLinks=W.prototype.Yp;W.prototype.findTreeLevel=W.prototype.Sz;W.prototype.findTreeParentChain=W.prototype.Tz;W.prototype.findTreeParentNode=W.prototype.rg;W.prototype.findTreeParentLink=W.prototype.Ii;W.prototype.findCommonTreeParent=W.prototype.Fz;W.prototype.findTreeRoot=W.prototype.Vz;W.prototype.isInTreeOf=W.prototype.lA;
W.prototype.findPort=W.prototype.ss;W.prototype.findLinksTo=W.prototype.Jz;W.prototype.findLinksBetween=W.prototype.Iz;W.prototype.findNodesInto=W.prototype.Xu;W.prototype.findNodesOutOf=W.prototype.Yu;W.prototype.findNodesConnected=W.prototype.Wu;W.prototype.findLinksInto=W.prototype.Gd;W.prototype.findLinksOutOf=W.prototype.Wp;W.prototype.findExternalTreeLinksConnected=W.prototype.Qx;W.prototype.invalidateConnectedLinks=W.prototype.rd;W.prototype.invalidateLinkBundle=W.prototype.jA;
var To=new D(W,"SpreadingNone",10),Go=new D(W,"SpreadingEvenly",11),Uo=new D(W,"SpreadingPacked",12);W.className="Node";W.SpreadingNone=To;W.SpreadingEvenly=Go;W.SpreadingPacked=Uo;function U(a,b){void 0===a||a instanceof Fl||"string"===typeof a?W.call(this,a):(W.call(this),a&&(b=a));this.R|=4608;this.so=new G;this.rl=new G;this.Sa=this.xp=this.ki=this.to=this.ro=this.$a=null;this.vc=new ni;this.vc.group=this;this.$q=null;b&&Object.assign(this,b)}ma(U,W);
U.prototype.cloneProtected=function(a){W.prototype.cloneProtected.call(this,a);this.R=this.R&-32769;null!==this.$a&&(a.$a=this.$a.copy());a.ro=this.ro;a.to=this.to;a.ki=this.ki;a.xp=this.xp;var b=a.$l(function(a){return a instanceof ng});b instanceof ng?a.Sa=b:a.Sa=null;null!==this.vc?(a.vc=this.vc.copy(),a.vc.group=a):(null!==a.vc&&(a.vc.group=null),a.vc=null)};t=U.prototype;
t.wf=function(a){W.prototype.wf.call(this,a);var b=a.$j();for(a=a.memberParts;a.next();){var c=a.value;c.s();c.B(8);c.Qj();if(c instanceof W)c.rd(b);else if(c instanceof T)for(c=c.labelNodes;c.next();)c.value.rd(b)}};
t.qk=function(a,b,c,d,e,f,g){if(a===pe&&"elements"===b)if(e instanceof ng)null===this.Sa?this.Sa=e:this.Sa!==e&&B("Cannot insert a second Placeholder into the visual tree of a Group.");else{if(e instanceof X){var h=e.$l(function(a){return a instanceof ng});h instanceof ng&&(null===this.Sa?this.Sa=h:this.Sa!==h&&B("Cannot insert a second Placeholder into the visual tree of a Group."))}}else a===qe&&"elements"===b&&null!==this.Sa&&(d===this.Sa?this.Sa=null:d instanceof X&&this.Sa.sg(d)&&(this.Sa=null));
W.prototype.qk.call(this,a,b,c,d,e,f,g)};t.jm=function(a,b){W.prototype.jm.call(this,a,b);this.isClipping&&this.type!==X.Spot&&this.isSubGraphExpanded&&(a=this.resizeObject,a instanceof X&&(a=a.pb()),null===this.$a&&(this.$a=new N),a.Li(this.$a),a instanceof xf&&this.$a.Kc(-a.strokeWidth,-a.strokeWidth))};t.zh=function(a,b,c,d){this.cf=this.Sa;W.prototype.zh.call(this,a,b,c,d)};
t.Ta=function(){var a=this;a.isSubGraphExpanded&&this.memberParts.each(function(b){!a.computesBoundsIncludingLinks&&b instanceof T||b.Ta()});W.prototype.Ta.call(this)};t.Ri=function(){if(!W.prototype.Ri.call(this))return!1;for(var a=this.memberParts;a.next();){var b=a.value;if(b instanceof W){if(b.isVisible()&&jj(b))return!1}else if(b instanceof T&&b.isVisible()&&jj(b)&&b.fromNode!==this&&b.toNode!==this)return!1}return!0};
function yo(a,b){if(a.so.add(b)){b instanceof U&&a.rl.add(b);var c=a.memberAdded;if(null!==c){var d=!0,e=a.diagram;null!==e&&(d=e.Z,e.Z=!0);c(a,b);null!==e&&(e.Z=d)}a.isVisible()&&a.isSubGraphExpanded||b.Ob(!1)}b instanceof T&&!a.computesBoundsIncludingLinks||(b=a.Sa,null===b&&(b=a),b.s())}
function zo(a,b){if(a.so.remove(b)){b instanceof U&&a.rl.remove(b);var c=a.memberRemoved;if(null!==c){var d=!0,e=a.diagram;null!==e&&(d=e.Z,e.Z=!0);c(a,b);null!==e&&(e.Z=d)}a.isVisible()&&a.isSubGraphExpanded||b.Ob(!0)}b instanceof T&&!a.computesBoundsIncludingLinks||(b=a.Sa,null===b&&(b=a),b.s())}t.Wj=function(){if(0<this.so.count){var a=this.diagram;if(null!==a)for(var b=this.so.copy().iterator;b.next();)a.remove(b.value)}W.prototype.Wj.call(this)};
U.prototype.canAddMembers=function(a){var b=this.diagram;if(null===b)return!1;b=b.commandHandler;for(a=Ok(a).iterator;a.next();)if(!b.isValidMember(this,a.value))return!1;return!0};U.prototype.addMembers=function(a,b){var c=this.diagram;if(null===c)return!1;c=c.commandHandler;var d=!0;for(a=Ok(a).iterator;a.next();){var e=a.value;!b||c.isValidMember(this,e)?e.containingGroup=this:d=!1}return d};
U.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=U.prototype;
t.rd=function(a){void 0===a&&(a=null);var b=0!==(this.R&65536);W.prototype.rd.call(this,a);if(!b)for(0!==(this.R&65536)!==!0&&(this.R=this.R^65536),b=this.Vu();b.next();){var c=b.value;if(null===a||!a.contains(c)){var d=c.fromNode;null!==d&&d!==this&&d.Jd(this)&&!d.isVisible()?(Jo(c.fromPort),Jo(c.toPort),c.Va()):(d=c.toNode,null!==d&&d!==this&&d.Jd(this)&&!d.isVisible()&&(Jo(c.fromPort),Jo(c.toPort),c.Va()))}}};
t.Vu=function(){var a=null!==this.diagram&&this.diagram.qx;if(a&&null!==this.$q)return this.$q.iterator;var b=this.$j();b.add(this);for(var c=new G,d=b.iterator;d.next();){var e=d.value;if(e instanceof W)for(e=e.linksConnected;e.next();){var f=e.value;b.contains(f)||c.add(f)}}a&&(this.$q=c);return c.iterator};
t.Hz=function(){var a=this.$j();a.add(this);for(var b=new G,c=a.iterator;c.next();){var d=c.value;if(d instanceof W)for(d=d.linksConnected;d.next();){var e=d.value,f=e.fromNode;null===f||a.contains(f)&&f!==this||b.add(f);e=e.toNode;null===e||a.contains(e)&&e!==this||b.add(e)}}return b.iterator};t.Gz=function(){function a(b,d){null!==b&&(d.add(b),a(b.containingGroup,d))}var b=new G;a(this,b);return b};t.$j=function(){var a=new G;Mk(a,this,!0,0,!0);a.remove(this);return a};
t.Ob=function(a){W.prototype.Ob.call(this,a);for(var b=this.memberParts;b.next();)b.value.Ob(a)};U.prototype.collapseSubGraph=function(){var a=this.diagram;if(null!==a&&!a.Ke){a.Ke=!0;var b=this.$j();Vo(this,b,a,this);a.Ke=!1}};
function Vo(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Ob(!1);f instanceof U&&f.isSubGraphExpanded&&(f.wasSubGraphExpanded=f.isSubGraphExpanded,Vo(f,b,c,d));if(f instanceof W)f.rd(b),c.Mj(f,d);else if(f instanceof T)for(f=f.labelNodes;f.next();)f.value.rd(b)}a.isSubGraphExpanded=!1}U.prototype.expandSubGraph=function(){var a=this.diagram;if(null!==a&&!a.Ke){a.Ke=!0;var b=this.$j();Wo(this,b,a,this);a.Ke=!1}};
function Wo(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Ob(!0);f instanceof U&&f.wasSubGraphExpanded&&(f.wasSubGraphExpanded=!1,Wo(f,b,c,d));if(f instanceof W)f.rd(b),c.Oj(f,d);else if(f instanceof T)for(f=f.labelNodes;f.next();)f.value.rd(b)}a.isSubGraphExpanded=!0}
U.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=K.alloc();W.prototype.move.call(this,a,b);a=new G;for(b=this.$j().iterator;b.next();)if(e=b.value,e instanceof T&&(e.suspendsRouting&&a.add(e),e.td||e.fromNode!==this&&e.toNode!==this))e.suspendsRouting=!0;for(b.reset();b.next();)if(e=b.value,!(e.Hh()||e instanceof W&&e.isLinkLabel)){var g=
e.position,h=e.location;g.u()?(f.x=g.x+d,f.y=g.y+c,e.position=f):h.u()&&(f.x=h.x+d,f.y=h.y+c,e.location=f)}for(b.reset();b.next();)if(e=b.value,e instanceof T&&(e.suspendsRouting=a.contains(e),e.td||e.fromNode!==this&&e.toNode!==this))g=e.position,f.x=g.x+d,f.y=g.y+c,f.u()?e.move(f):e.Va(),Gj(e)&&e.Va();K.free(f)}};
na.Object.defineProperties(U.prototype,{placeholder:{get:function(){return this.Sa}},computesBoundsAfterDrag:{get:function(){return 0!==(this.R&2048)},set:function(a){var b=0!==(this.R&2048);b!==a&&(this.R^=2048,this.g("computesBoundsAfterDrag",b,a))}},computesBoundsIncludingLinks:{get:function(){return 0!==(this.R&4096)},set:function(a){var b=0!==(this.R&4096);b!==a&&(this.R^=4096,this.g("computesBoundsIncludingLinks",
b,a))}},computesBoundsIncludingLocation:{get:function(){return 0!==(this.R&8192)},set:function(a){var b=0!==(this.R&8192);b!==a&&(this.R^=8192,this.g("computesBoundsIncludingLocation",b,a))}},handlesDragDropForMembers:{get:function(){return 0!==(this.R&16384)},set:function(a){var b=0!==(this.R&16384);b!==a&&(this.R^=16384,this.g("handlesDragDropForMembers",b,a))}},memberParts:{get:function(){return this.so.iterator}},
layout:{get:function(){return this.vc},set:function(a){var b=this.vc;if(b!==a){null!==b&&(b.diagram=null,b.group=null);this.vc=a;var c=this.diagram;null!==a&&(a.diagram=c,a.group=this);null!==c&&(c.Oh=!0);this.g("layout",b,a);null!==c&&c.Fb()}}},memberAdded:{get:function(){return this.ro},set:function(a){var b=this.ro;b!==a&&(this.ro=a,this.g("memberAdded",b,a))}},memberRemoved:{get:function(){return this.to},
set:function(a){var b=this.to;b!==a&&(this.to=a,this.g("memberRemoved",b,a))}},memberValidation:{get:function(){return this.ki},set:function(a){var b=this.ki;b!==a&&(this.ki=a,this.g("memberValidation",b,a))}},ungroupable:{get:function(){return 0!==(this.R&256)},set:function(a){var b=0!==(this.R&256);b!==a&&(this.R^=256,this.g("ungroupable",b,a))}},isSubGraphExpanded:{get:function(){return 0!==(this.R&512)},
set:function(a){var b=0!==(this.R&512);if(b!==a){this.R^=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.Sa&&this.Sa.s(),this.memberParts.each(function(a){a.updateAdornments()})):a?this.expandSubGraph():this.collapseSubGraph()}}},wasSubGraphExpanded:{get:function(){return 0!==(this.R&1024)},set:function(a){var b=
0!==(this.R&1024);b!==a&&(this.R^=1024,this.g("wasSubGraphExpanded",b,a))}},subGraphExpandedChanged:{get:function(){return this.xp},set:function(a){var b=this.xp;b!==a&&(this.xp=a,this.g("subGraphExpandedChanged",b,a))}},Jh:{get:function(){return 0!==(this.R&32768)},set:function(a){0!==(this.R&32768)!==a&&(this.R^=32768)}}});U.prototype.expandSubGraph=U.prototype.expandSubGraph;U.prototype.collapseSubGraph=U.prototype.collapseSubGraph;
U.prototype.findSubGraphParts=U.prototype.$j;U.prototype.findContainingGroupChain=U.prototype.Gz;U.prototype.findExternalNodesConnected=U.prototype.Hz;U.prototype.findExternalLinksConnected=U.prototype.Vu;U.prototype.ensureBounds=U.prototype.Ta;U.className="Group";function ng(a){Y.call(this);this.nb=pc;this.fp=new N(NaN,NaN,NaN,NaN);a&&Object.assign(this,a)}ma(ng,Y);ng.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.nb=this.nb.I();a.fp=this.fp.copy()};
ng.prototype.Bh=function(a){if(null===this.background&&null===this.areaBackground)return!1;var b=this.naturalBounds;return bc(0,0,b.width,b.height,a.x,a.y)};
ng.prototype.im=function(){var a=this.part;null!==a&&(a instanceof U||a instanceof ze)||B("Placeholder is not inside a Group or Adornment.");if(a instanceof U){var b=this.computeBorder(this.fp),c=this.minSize,d=this.xc;Rb(d,(isFinite(c.width)?Math.max(c.width,b.width):b.width)||0,(isFinite(c.height)?Math.max(c.height,b.height):b.height)||0);this.xe(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.lv(a)||isNaN(b.x)||
isNaN(b.y)||(c=K.alloc(),c.Ti(b,a.locationSpot),c.A(a.location)||(a.location=c),K.free(c))}else{b=this.xc;c=this.nb;d=c.left+c.right;var e=c.top+c.bottom,f=a.adornedObject;a.angle=f.Ki();var g=0;f instanceof xf&&(g=f.strokeWidth);var h=f.Af(),k=f.naturalBounds,l=(k.width+g)*h;g=(k.height+g)*h;a.type!==X.Link&&(f=f.da("Selection"===a.category?uc:a.locationSpot,K.alloc()),a.location=f,K.free(f));isNaN(l)||isNaN(g)?(a=a.adornedObject,l=a.da(uc,K.alloc()),f=N.allocAt(l.x,l.y,0,0),f.Oe(a.da(Cc,l)),f.Oe(a.da(wc,
l)),f.Oe(a.da(Ac,l)),Rb(b,f.width+d||0,f.height+e||0),this.xe(-c.left,-c.top,b.width,b.height),K.free(l),N.free(f)):(Rb(b,l+d||0,g+e||0),this.xe(-c.left,-c.top,b.width,b.height))}};ng.prototype.zh=function(a,b,c,d){this.actualBounds.h(a,b,c,d)};
ng.prototype.computeBorder=function(a){var b=this.part,c=b.diagram;if(null!==c&&b instanceof U&&!b.layer.isTemporary&&b.computesBoundsAfterDrag&&this.fp.u()){var d=c.toolManager.findTool("Dragging");if(d===c.currentTool&&(c=d.computeBorder(b,this.fp,a),null!==c))return c}c=N.alloc();d=this.computeMemberBounds(c);var e=this.nb;b instanceof U&&!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 U&&b.computesBoundsIncludingLocation&&b.location.u()&&a.Oe(b.location);return a};
ng.prototype.computeMemberBounds=function(a){if(!(this.part instanceof U))return a.h(0,0,0,0),a;for(var b=this.part,c=Infinity,d=Infinity,e=-Infinity,f=-Infinity,g=b.memberParts;g.next();){var h=g.value;if(h.isVisible()){if(h instanceof T){if(!b.computesBoundsIncludingLinks)continue;if(ij(h))continue;if(h.fromNode===b||h.toNode===b)continue}h=h.actualBounds;h.left<c&&(c=h.left);h.top<d&&(d=h.top);h.right>e&&(e=h.right);h.bottom>f&&(f=h.bottom)}}isFinite(c)&&isFinite(d)?a.h(c,d,e-c,f-d):(b=b.location,
a.h(b.x,b.y,0,0));return a};na.Object.defineProperties(ng.prototype,{padding:{get:function(){return this.nb},set:function(a){"number"===typeof a&&(a=new lc(a));var b=this.nb;b.A(a)||(this.nb=a=a.I(),this.g("padding",b,a),this.s())}}});ng.className="Placeholder";
function T(a){V.call(this,X.Link);this.Ia=8;this.We=null;this.Xe="";this.pf=this.Dn=null;this.qf="";this.Dp=null;this.vk=Rf;this.gn=0;this.jn=Rf;this.kn=NaN;this.Ej=Xo;this.rp=.5;this.nd=null;this.Cb=(new E).freeze();this.gf=this.eh=null;this.yl=new N;this.ma=new P;this.C=this.o=this.Mf=this.Qf=null;this.j=[];this.uu=new K;this.dr=this.nx=this.mx=null;this.Qt=NaN;this.P=null;a&&Object.assign(this,a)}ma(T,V);
T.prototype.cloneProtected=function(a){V.prototype.cloneProtected.call(this,a);a.Ia=this.Ia&-113;a.Xe=this.Xe;a.Dn=this.Dn;a.qf=this.qf;a.Dp=this.Dp;a.vk=this.vk;a.gn=this.gn;a.jn=this.jn;a.kn=this.kn;a.Ej=this.Ej;a.rp=this.rp;null!==this.P&&(a.P=this.P.copy())};t=T.prototype;t.wf=function(a){V.prototype.wf.call(this,a);this.Xe=a.Xe;this.qf=a.qf;a.eh=null;a.Va();a.Mf=this.Mf;var b=a.fromPort;null!==b&&Jo(b);a=a.toPort;null!==a&&Jo(a)};
t.gb=function(a){a.classType===T?2===(a.value&2)?this.routing=a:a===Uf||a===Qf||a===Pf?this.curve=a:a===Yo||a===Zo||a===$o?this.adjusting=a:a!==Xo&&a!==Rf&&B("Unknown Link enum value for a Link property: "+a):V.prototype.gb.call(this,a)};t.Lc=function(){null===this.P&&(this.P=new Yk)};t.Ri=function(){var a=this.fromNode;if(null!==a){var b=a.findVisibleNode();null!==b&&(a=b);if(jj(a)||kj(a))return!1}a=this.toNode;return null!==a&&(b=a.findVisibleNode(),null!==b&&(a=b),jj(a)||kj(a))?!1:!0};t.Rv=function(){return!1};
t.Ws=function(){};t.Nc=function(){return!1};T.prototype.computeAngle=function(a,b,c){return T.computeAngle(b,c)};T.computeAngle=function(a,b){switch(a){default:case Rf:a=0;break;case Mm:a=b;break;case Fm:a=b+90;break;case Hm:a=b-90;break;case ap:a=b+180;break;case Nm:a=M.jq(b);90<a&&270>a&&(a-=180);break;case Gm:a=M.jq(b+90);90<a&&270>a&&(a-=180);break;case Im:a=M.jq(b-90);90<a&&270>a&&(a-=180);break;case Jm:a=M.jq(b);if(45<a&&135>a||225<a&&315>a)return 0;90<a&&270>a&&(a-=180)}return M.jq(a)};
function Eo(a){var b=a.fromNode,c=a.toNode,d=null;null!==b?d=null!==c?b.Px(c):b.containingGroup:null!==c?d=c.containingGroup:d=null;b=d;c=a.Rh;if(c!==b){null!==c&&zo(c,a);a.Rh=b;null!==b&&yo(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.td||a.mx!==c&&a.nx!==c||a.Va()}if(a.isLabeledLink)for(a=a.labelNodes;a.next();)a.value.containingGroup=d}t=T.prototype;
t.Gh=function(){var a=this.containingGroup;null!==a&&this.fromNode!==a&&this.toNode!==a&&a.computesBoundsIncludingLinks&&V.prototype.Gh.call(this)};t.aq=function(a){var b=this.fromNode;return a===b?this.toNode:b};t.$z=function(a){var b=this.fromPort;return a===b?this.toPort:b};function No(a,b){null===a.nd&&(a.nd=new G);a.nd.add(b);a.s()}
t.cq=function(a){V.prototype.cq.call(this,a);bp(this)&&this.fq(this.actualBounds);if(!a){a=this.We;var b=null;null!==a&&(b=this.fromPort,Lo(a,this,b));var c=this.pf;if(null!==c){var d=this.toPort;c===a&&d===b||Lo(c,this,d)}cp(this)}};t.eq=function(a){V.prototype.eq.call(this,a);bp(this)&&this.fq(this.actualBounds);if(!a){a=this.We;var b=null;null!==a&&(b=this.fromPort,Mo(a,this,b));var c=this.pf;if(null!==c){var d=this.toPort;c===a&&d===b||Mo(c,this,d)}dp(this)}};
t.Wj=function(){this.td=!0;if(null!==this.nd){var a=this.diagram;if(null!==a)for(var b=this.nd.copy().iterator;b.next();)a.remove(b.value)}null!==this.data&&(a=this.diagram,null!==a&&a.partManager.removeDataForLink(this))};T.prototype.updateRelationshipsFromData=function(){if(null!==this.data){var a=this.diagram;null!==a&&a.partManager.updateRelationshipsFromData(this)}};
T.prototype.move=function(a,b){var c=b?this.location:this.position,d=c.x;isNaN(d)&&(d=0);var e=c.y;isNaN(e)&&(e=0);d=a.x-d;e=a.y-e;!0===b?V.prototype.move.call(this,a,!1):(a=K.allocAt(c.x+d,c.y+e),V.prototype.move.call(this,a,!1),K.free(a));gf(this,d,e);for(a=this.labelNodes;a.next();)b=a.value,c=b.position,b.moveTo(c.x+d,c.y+e)};
T.prototype.canRelinkFrom=function(){if(!this.relinkableFrom)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowRelink)return!1;a=a.diagram;return null===a||a.allowRelink?!0:!1};T.prototype.canRelinkTo=function(){if(!this.relinkableTo)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowRelink)return!1;a=a.diagram;return null===a||a.allowRelink?!0:!1};
T.prototype.computeMidPoint=function(a){var b=this.pointsCount;if(0===b)return a.assign(Fb),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()===Uf))return this.ma.bv(.5,a),a.add(this.i(0)),c=this.ma.figures.first(),a.offset(-c.startX,-c.startY),a;if(this.computeCurve()===Uf){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);M.iz(d.x,d.y,e.x,e.y,f.x,f.y,c.x,c.y,a)}else a.assign(this.i(c));return a}var g=this.flattenedLengths;c=this.flattenedTotalLength;for(e=f=d=0;d<c/2&&f<b;){e=g[f];if(d+e>c/2)break;d+=e;f++}b=this.i(f);f=this.i(f+1);1>Math.abs(b.x-f.x)?b.y>f.y?a.h(b.x,b.y-(c/2-d)):a.h(b.x,b.y+(c/2-d)):1>Math.abs(b.y-f.y)?b.x>f.x?a.h(b.x-(c/2-d),b.y):a.h(b.x+(c/2-d),b.y):(c=(c/2-d)/e,a.h(b.x+c*(f.x-b.x),b.y+c*(f.y-b.y)));return a};
T.prototype.computeMidAngle=function(){var a=this.pointsCount;if(2>a)return NaN;if(2===a)return this.i(0).Pa(this.i(1));if(this.isOrthogonal&&(15<=this.computeCorner()||this.computeCurve()===Uf))return this.ma.Vx(.5);if(this.computeCurve()===Uf&&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 M.hz(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).Pa(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).Pa(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.Pa(d)};t=T.prototype;t.i=function(a){return this.Cb.l[a]};t.Qc=function(a,b){this.Cb.Pc(a,b)};t.M=function(a,b,c){this.Cb.Pc(a,new K(b,c))};t.iA=function(a,b){this.Cb.vb(a,b)};
t.m=function(a,b,c){this.Cb.vb(a,new K(b,c))};t.de=function(a){this.Cb.add(a)};t.tf=function(a,b){this.Cb.add(new K(a,b))};t.Iv=function(a){this.Cb.eb(a)};t.Rj=function(){this.Cb.clear()};
function gf(a,b,c){if(0!==b||0!==c)if(0===a.pointsCount)a.defaultFromPoint&&a.defaultFromPoint.offset(b,c),a.defaultToPoint&&a.defaultToPoint.offset(b,c);else{for(var d=a.td,e=new E,f=a.Cb.iterator;f.next();){var g=f.value;e.add((new K(g.x+b,g.y+c)).freeze())}e.freeze();f=a.Cb;a.Cb=e;g=a.diagram;isNaN(b)||isNaN(c)||null!==g&&g.animationManager.sb?a.s():(a.Wf.h(a.Wf.x+b,a.Wf.y+c),a.ja.h(a.ja.x+b,a.ja.y+c),ul(a));d?ep(a):(a.defaultFromPoint&&(a.defaultFromPoint=a.i(0)),a.defaultToPoint&&(a.defaultToPoint=
a.i(a.pointsCount-1)));null!==g&&g.animationManager.sb&&(b=g.animationManager,a.gf=e,b.Al.add(a));a.g("points",f,e)}}t.Lh=function(){null===this.eh&&(this.eh=this.Cb,this.Cb=this.Cb.copy())};
t.vf=function(){if(null!==this.eh){for(var a=this.eh,b=this.Cb,c=Infinity,d=Infinity,e=a.l,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.l,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.fc(!0);break}}else this.fc(!0);this.eh=null;c=this.diagram;null!==c&&c.animationManager.sb&&(c=c.animationManager,this.gf=b,c.Al.add(this));ep(this);
this.g("points",a,b)}};t.Kv=function(){null!==this.eh&&(this.Cb=this.eh,this.eh=null)};function ep(a){0===a.Cb.count?a.td=!1:(a.td=!0,a.dr=null,a.Qt=NaN,a.defaultFromPoint=a.i(0),a.defaultToPoint=a.i(a.pointsCount-1),fp(a,!1))}
t.Va=function(){if(!this.suspendsRouting){var a=this.diagram;if(a){if(a.Hs.contains(this)||a.undoManager.isUndoingRedoing)return;a=a.animationManager;if(a.isTicking&&!a.isAnimating)return;null!==this.gf&&!a.isTicking&&a.isAnimating&&(this.gf=null)}a=this.path;null!==a&&(this.td=!1,this.s(),a.s())}};
t.vg=function(){if(!this.td&&!this.computingPoints){var a=!0;try{this.computingPoints=!0,this.Lh(),a=this.computePoints()}catch(b){this.computingPoints=!1,this.Kv()}finally{this.computingPoints=!1,a?this.vf():this.Kv()}}};
T.prototype.computePoints=function(){if(null===this.diagram)return!1;var a=this.fromNode,b=null;null===a?(gp||(gp=new W,gp.desiredSize=Hb,gp.Ta()),this.defaultFromPoint&&(gp.location=this.defaultFromPoint,gp.Ta(),b=a=gp)):b=this.fromPort;if(null!==b&&!a.isVisible()){var c=a.findVisibleNode();null!==c&&c!==a?(a=c,b=c.port):a=c}this.mx=a;if(null===a||!a.location.u())return!1;for(;!(null===b||b.actualBounds.u()&&b.Ff());)b=b.panel;if(null===b)return!1;var d=this.toNode,e=null;null===d?(hp||(hp=new W,
hp.desiredSize=Hb,hp.Ta()),this.defaultToPoint&&(hp.location=this.defaultToPoint,hp.Ta(),e=d=hp)):e=this.toPort;null===e||d.isVisible()||(c=d.findVisibleNode(),null!==c&&c!==d?(d=c,e=c.port):d=c);this.nx=d;if(null===d||!d.location.u())return!1;for(;!(null===e||e.actualBounds.u()&&e.Ff());)e=e.panel;if(null===e)return!1;var f=this.pointsCount,g=this.computeSpot(!0,b);c=this.computeSpot(!1,e);var h=ip(g),k=ip(c),l=b===e&&null!==b,m=this.isOrthogonal,n=this.curve===Uf;this.Qf=l&&!m?n=!0:!1;var p=this.computeAdjusting()===
Rf||l;if(!m&&!l&&h&&k){if(h=!1,!p&&3<=f&&(p=this.getLinkPoint(a,b,g,!0,!1,d,e),k=this.getLinkPoint(d,e,c,!1,!1,a,b),h=this.adjustPoints(0,p,f-1,k))&&(p=this.getLinkPoint(a,b,g,!0,!1,d,e),k=this.getLinkPoint(d,e,c,!1,!1,a,b),this.adjustPoints(0,p,f-1,k)),!h)if(this.Rj(),n){f=this.getLinkPoint(a,b,g,!0,!1,d,e);p=this.getLinkPoint(d,e,c,!1,!1,a,b);h=p.x-f.x;k=p.y-f.y;l=this.computeCurviness();n=m=0;var r=f.x+h/3,q=f.y+k/3,u=r,w=q;M.w(k,0)?w=0<h?w-l:w+l:(m=-h/k,n=Math.sqrt(l*l/(m*m+1)),0>l&&(n=-n),u=
(0>k?-1:1)*n+r,w=m*(u-r)+q);r=f.x+2*h/3;q=f.y+2*k/3;var v=r,y=q;M.w(k,0)?y=0<h?y-l:y+l:(v=(0>k?-1:1)*n+r,y=m*(v-r)+q);this.Rj();this.de(f);this.tf(u,w);this.tf(v,y);this.de(p);this.Qc(0,this.getLinkPoint(a,b,g,!0,!1,d,e));this.Qc(3,this.getLinkPoint(d,e,c,!1,!1,a,b))}else if(f=d,p=e,d=this.getLinkPoint(a,b,g,!0,!1,f,p),e=this.getLinkPoint(f,p,c,!1,!1,a,b),this.hasCurviness())p=e.x-d.x,c=e.y-d.y,g=this.computeCurviness(),a=d.x+p/2,b=d.y+c/2,f=a,h=b,M.w(c,0)?h=0<p?h-g:h+g:(p=-p/c,f=Math.sqrt(g*g/(p*
p+1)),0>g&&(f=-f),f=(0>c?-1:1)*f+a,h=p*(f-a)+b),this.de(d),this.tf(f,h),this.de(e);else{this.de(d);this.de(e);h=N.alloc();b.Li(h);k=h.$(e);p.Li(h);l=h.$(d);if(k||l)g=b.da(jp(g),new K),this.Qc(0,this.getLinkPointFromPoint(a,b,g,e,!0,g)),c=p.da(jp(c),new K),this.Qc(1,this.getLinkPointFromPoint(f,p,c,d,!1,c));N.free(h)}}else{n=this.isAvoiding;p&&(m&&n||l)&&this.Rj();var z=l?this.computeCurviness():0;n=this.getLinkPoint(a,b,g,!0,m,d,e);r=u=q=0;if(m||!h||l)w=this.computeEndSegmentLength(a,b,g,!0),r=this.getLinkDirection(a,
b,n,g,!0,m,d,e),l&&(h||g.A(c)||!m&&1===g.x+c.x&&1===g.y+c.y)&&(r-=m?90:30,0>z&&(r-=180)),0>r?r+=360:360<=r&&(r-=360),l&&(w+=Math.abs(z)*(m?1:2)),0===r?q=w:90===r?u=w:180===r?q=-w:270===r?u=-w:(q=w*Math.cos(r*Math.PI/180),u=w*Math.sin(r*Math.PI/180)),g.Cc()&&l&&(w=b.da(yc,K.alloc()),v=K.allocAt(w.x+1E3*q,w.y+1E3*u),this.getLinkPointFromPoint(a,b,w,v,!0,n),K.free(w),K.free(v));w=this.getLinkPoint(d,e,c,!1,m,a,b);var A=y=v=0;if(m||!k||l){var C=this.computeEndSegmentLength(d,e,c,!1);A=this.getLinkDirection(d,
e,w,c,!1,m,a,b);l&&(k||g.A(c)||!m&&1===g.x+c.x&&1===g.y+c.y)&&(A+=m?0:30,0>z&&(A+=180));0>A?A+=360:360<=A&&(A-=360);l&&(C+=Math.abs(z)*(m?1:2));0===A?v=C:90===A?y=C:180===A?v=-C:270===A?y=-C:(v=C*Math.cos(A*Math.PI/180),y=C*Math.sin(A*Math.PI/180));c.Cc()&&l&&(c=e.da(yc,K.alloc()),g=K.allocAt(c.x+1E3*v,c.y+1E3*y),this.getLinkPointFromPoint(d,e,c,g,!1,w),K.free(c),K.free(g))}c=n;if(m||!h||l)c=new K(n.x+q,n.y+u);g=w;if(m||!k||l)g=new K(w.x+v,w.y+y);!p&&!m&&h&&3<f&&this.adjustPoints(0,n,f-2,g)?this.Qc(f-
1,w):!p&&!m&&k&&3<f&&this.adjustPoints(1,c,f-1,w)?this.Qc(0,n):!p&&(m?6<=f:4<f)&&this.adjustPoints(1,c,f-2,g)?(this.Qc(0,n),this.Qc(f-1,w)):(this.Rj(),this.de(n),(m||!h||l)&&this.de(c),m&&this.addOrthoPoints(c,r,g,A,a,d),(m||!k||l)&&this.de(g),this.de(w))}return!0};function kp(a,b){Math.abs(b.x-a.x)>Math.abs(b.y-a.y)?(b.x>=a.x?b.x=a.x+9E9:b.x=a.x-9E9,b.y=a.y):(b.y>=a.y?b.y=a.y+9E9:b.y=a.y-9E9,b.x=a.x);return b}
T.prototype.getLinkPointFromPoint=function(a,b,c,d,e,f){void 0===f&&(f=new K);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.ie()||(e=e.panel);if(null===e){e=d.x;d=d.y;var g=c.x;c=c.y}else{a=e.ee;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.ak(e,d,g,c,f);null!==
a&&f.transform(a);return f};function lp(a,b){var c=b.Qo;null===c&&(c=new mp,c.port=b,c.node=b.part,b.Qo=c);return np(c,a)}
T.prototype.getLinkPoint=function(a,b,c,d,e,f,g,h){void 0===h&&(h=new K);if(c.hb()&&!ip(c))return b.da(c,h),h;if(c.Oc()){var k=lp(this,b);if(null!==k){h.assign(k.hq);if(e&&this.routing===op){var l=lp(this,g);if(null!==l&&k.Yl<l.Yl){k=K.alloc();l=K.alloc();var m=new N(b.da(uc,k),b.da(Cc,l)),n=this.computeSpot(!d,g);a=this.getLinkPoint(f,g,n,!d,e,a,b,l);(c.Df(Fc)||c.Df(Gc))&&a.y>=m.y&&a.y<=m.y+m.height?h.y=a.y:(c.Df(Ec)||c.Df(Hc))&&a.x>=m.x&&a.x<=m.x+m.width&&(h.x=a.x);K.free(k);K.free(l)}}return h}}c=
b.da(jp(c),K.alloc());this.pointsCount>(e?6:2)?(g=d?this.i(1):this.i(this.pointsCount-2),e&&(g=kp(c,g.copy()))):(k=this.computeSpot(!d,g),f=K.alloc(),g=g.da(jp(k),f),e&&(g=kp(c,g)),K.free(f));this.getLinkPointFromPoint(a,b,c,g,d,h);K.free(c);return h};
T.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.Oc()&&(k=lp(this,b),null!==k))switch(k.Dc){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.da(yc,K.alloc());this.pointsCount>(f?6:2)?(h=e?this.i(1):this.i(this.pointsCount-2),h=f?kp(k,h.copy()):c):(c=K.alloc(),h=h.da(yc,c),K.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;K.free(k);k=c}d.Cc()&&g.Jd(a)&&(k+=180,360<=k&&(k-=360));if(ip(d))return k;a=b.Ki();if(0===a)return k;45<=a&&135>a?k+=90:135<=a&&225>a?k+=180:225<=a&&315>a&&(k+=270);360<=k&&(k-=360);return k};T.prototype.computeEndSegmentLength=function(a,b,c,d){if(null!==b&&c.Oc()&&(a=lp(this,b),null!==a))return a.Su;a=d?this.fromEndSegmentLength:this.toEndSegmentLength;null!==b&&isNaN(a)&&(a=d?b.fromEndSegmentLength:b.toEndSegmentLength);isNaN(a)&&(a=10);return a};
T.prototype.computeSpot=function(a,b){void 0===b&&(b=null);a?(a=b?b:this.fromPort,null===a?a=yc:(b=this.fromSpot,b.Mb()&&(b=a.fromSpot),a=b===Wc?rc:b)):(a=b?b:this.toPort,null===a?a=yc:(b=this.toSpot,b.Mb()&&(b=a.toSpot),a=b===Wc?rc:b));return a};function ip(a){return a===rc||.5===a.x&&.5===a.y}function jp(a){return.5===a.x&&.5===a.y?a:yc}
T.prototype.computeOtherPoint=function(a,b){if(this.computeAdjusting()!==Rf&&4<this.pointsCount)return this.computeMidPoint(new K);a=b.Qo;a=null!==a?np(a,this):null;return null!==a?a.hq:b.da(yc)};T.prototype.computeShortLength=function(a){if(a){a=this.fromShortLength;if(isNaN(a)){var b=this.fromPort;null!==b&&(a=b.fromShortLength)}return isNaN(a)?0:a}a=this.toShortLength;isNaN(a)&&(b=this.toPort,null!==b&&(a=b.toShortLength));return isNaN(a)?0:a};
T.prototype.zf=function(a,b,c,d,e,f){if(!1===this.pickable)return!1;void 0===b&&(b=null);void 0===c&&(c=null);var g=f;void 0===f&&(g=od.alloc(),g.reset());g.multiply(this.transform);if(this.Ah(a,g))return Ym(this,b,c,e),void 0===f&&od.free(g),!0;if(this.Mc(a,g)){var h=!1;if(!this.isAtomic)for(var k=this.U.l,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=od.alloc();n.set(g);
if(m instanceof X)h=m.zf(a,b,c,d,e,n);else if(this.path===m){if(m instanceof xf)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.Ah(r,q))h=!0;else{if(void 0===q&&(q=m.transform,r.Ge(m.actualBounds))){h=!0;break b}h=r.left;p=r.right;var u=r.top;r=r.bottom;var w=K.alloc(),v=K.alloc(),y=K.alloc(),z=od.alloc();z.set(q);z.uv(m.transform);z.Bs();v.x=p;v.y=u;v.transform(z);w.x=h;w.y=u;w.transform(z);q=!1;zn(m,w,v,y)?q=!0:(w.x=p,w.y=r,w.transform(z),zn(m,w,v,y)?q=!0:(v.x=
h,v.y=r,v.transform(z),zn(m,w,v,y)?q=!0:(w.x=h,w.y=u,w.transform(z),zn(m,w,v,y)&&(q=!0))));od.free(z);K.free(w);K.free(v);K.free(y);h=q}}else h=m.Ah(h,n)}else h=bl(m,a,d,n);h&&(p=m,null!==b&&(p=b(m)),p&&(null===c||c(p))&&e.add(p));od.free(n)}}}void 0===f&&od.free(g);return h||null!==this.background||null!==this.areaBackground}void 0===f&&od.free(g);return!1};
T.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?Uf:this.curve};T.prototype.computeCorner=function(){if(this.curve===Uf)return 0;var a=this.corner;if(isNaN(a)||0>a)a=10;return a};
T.prototype.findMidLabel=function(){for(var a=this.path,b=this.U.l,c=b.length,d=0;d<c;d++){var e=b[d];if(e!==a&&!e.isPanelMain&&(-Infinity===e.segmentIndex||isNaN(e.segmentIndex)))return e}for(a=this.labelNodes;a.next();)if(b=a.value,-Infinity===b.segmentIndex||isNaN(b.segmentIndex))return b;return null};
T.prototype.computeSpacing=function(){if(!this.isVisible())return 0;var a=pp;a=Math.max(a,this.computeThickness());var b=this.fromPort,c=this.toPort;if(null!==b&&null!==c){var d=this.findMidLabel();if(null!==d){var e=d.naturalBounds,f=d.margin,g=isNaN(e.width)?30:e.width*d.scale+f.left+f.right;e=isNaN(e.height)?14:e.height*d.scale+f.top+f.bottom;d=d.segmentOrientation;d===Mm||d===Nm||d===ap?a=Math.max(a,e):d===Hm||d===Im||d===Fm||d===Gm?a=Math.max(a,g):(b=b.da(yc).Pa(c.da(yc))/180*Math.PI,a=Math.max(a,
Math.abs(Math.sin(b)*g)+Math.abs(Math.cos(b)*e)+1));this.curve===Uf&&(a*=1.333)}}return a};T.prototype.arrangeBundledLinks=function(a,b){if(b)for(b=0;b<a.length;b++){var c=a[b];c.computeAdjusting()===Rf&&c.Va()}};
T.prototype.computeCurviness=function(){var a=this.curviness;if(isNaN(a)){a=qp;var b=this.Mf;if(null!==b){for(var c=Ea(),d=0,e=b.links,f=0;f<e.length;f++){var g=e[f].computeSpacing();c.push(g);d+=g}d=-d/2;for(f=0;f<e.length;f++){if(e[f]===this){a=d+c[f]/2;break}d+=c[f]}b.Ks===this.fromNode&&(a=-a);Ia(c)}}return a};T.prototype.computeThickness=function(){if(!this.isVisible())return 0;var a=this.path;return null!==a?Math.max(a.strokeWidth,1):1};
T.prototype.hasCurviness=function(){return!isNaN(this.curviness)||null!==this.Mf};
T.prototype.adjustPoints=function(a,b,c,d){var e=this.computeAdjusting();if(this.isOrthogonal){if(e===Zo)return!1;e===$o&&(e=Yo)}switch(e){case Zo:var f=this.i(a),g=this.i(c);if(!f.Ua(b)||!g.Ua(d)){e=f.x;f=f.y;var h=g.x-e,k=g.y-f,l=Math.sqrt(h*h+k*k);if(!M.aa(l,0)){if(M.aa(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);M.aa(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.Qc(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),M.aa(b,0)||(M.aa(h,0)?k=0>k?-Math.PI/2:Math.PI/2:(k=Math.atan(k/Math.abs(h)),0>h&&(k=Math.PI-k)),h=k+m,b*=l,this.M(a,g+b*Math.cos(h),n+b*Math.sin(h)));this.Qc(c,d)}}return!0;case $o:f=this.i(a);n=this.i(c);if(!f.Ua(b)||!n.Ua(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.Qc(a,b);for(a+=1;a<c;a++){b=this.i(a);
var u=b.x,w=b.y,v=.5;0!==l&&(v=((e-u)*(e-g)+(f-w)*(f-n))/l);var y=e+v*(g-e),z=f+v*(n-f);b=Math.sqrt((u-y)*(u-y)+(w-z)*(w-z));w<q*(u-y)+z&&(b=-b);0<q&&(b=-b);u=h+v*(k-h);v=m+v*(p-m);0!==q?(b=u+b/r,this.M(a,b,v-(b-u)/q)):this.M(a,u,v+b)}this.Qc(c,d)}return!0;case Yo: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,M.w(e.y,f.y)?M.w(f.x,g.x)?m=b.y:M.w(f.y,g.y)&&(h=b.x):M.w(e.x,f.x)&&(M.w(f.y,g.y)?h=b.x:M.w(f.x,g.x)&&(m=b.y)),this.M(a+1,h,m),e=this.i(c),f=this.i(c-
1),g=this.i(c-2),h=f.x,m=f.y,k=h,p=m,M.w(e.y,f.y)?M.w(f.x,g.x)?m=d.y:M.w(f.y,g.y)&&(h=d.x):M.w(e.x,f.x)&&(M.w(f.y,g.y)?h=d.x:M.w(f.x,g.x)&&(m=d.y)),this.M(c-1,h,m),Gj(this))){this.M(a+1,n,l);this.M(c-1,k,p);c=!1;break a}this.Qc(a,b);this.Qc(c,d);c=!0}return c;default:return!1}};
T.prototype.addOrthoPoints=function(a,b,c,d,e,f){0>b?b+=360:360<=b&&(b-=360);0>d?d+=360:360<=d&&(d-=360);var g=d;b=315<=b||45>b?0:45<=b&&135>b?90:135<=b&&225>b?180:270;d=315<=d||45>d?0:45<=d&&135>d?90:135<=d&&225>d?180:270;var h=e.actualBounds.copy(),k=f.actualBounds.copy();if(h.u()&&k.u()){h.Kc(rp,rp);k.Kc(rp,rp);h.Oe(a);k.Oe(c);var l=K.alloc(),m=K.alloc();if(0===b)if(c.x>a.x||270===d&&c.y<a.y&&k.right>a.x||90===d&&c.y>a.y&&k.right>a.x)l.h(c.x,a.y),m.h(c.x,(a.y+c.y)/2),180===d?(l.x=this.computeMidOrthoPosition(a.x,
a.y,c.x,c.y,!1),m.x=l.x,m.y=c.y):270===d&&c.y<a.y||90===d&&c.y>a.y?(l.x=a.x<k.left?this.computeMidOrthoPosition(a.x,a.y,k.left,c.y,!1):a.x<k.right&&(270===d&&a.y<k.top||90===d&&a.y>k.bottom)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):k.right,m.x=l.x,m.y=c.y):0===d&&a.x<k.left&&a.y>k.top&&a.y<k.bottom&&(l.x=a.x,l.y=a.y<c.y?Math.min(c.y,k.top):Math.max(c.y,k.bottom),m.y=l.y);else{l.h(a.x,c.y);m.h((a.x+c.x)/2,c.y);if(180===d||90===d&&c.y<h.top||270===d&&c.y>h.bottom)180===d&&(k.$(a)||h.$(c))?l.y=
this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):c.y<a.y&&(180===d||90===d)?l.y=this.computeMidOrthoPosition(a.x,h.top,c.x,Math.max(c.y,k.bottom),!0):c.y>a.y&&(180===d||270===d)&&(l.y=this.computeMidOrthoPosition(a.x,h.bottom,c.x,Math.min(c.y,k.top),!0)),m.x=c.x,m.y=l.y;if(l.y>h.top&&l.y<h.bottom)if(c.x>=h.left&&c.x<=a.x||a.x<=k.right&&a.x>=c.x){if(90===d||270===d)l.h(Math.max((a.x+c.x)/2,a.x),a.y),m.h(l.x,c.y)}else l.y=270===d||(0===d||180===d)&&c.y<a.y?Math.min(c.y,0===d?h.top:Math.min(h.top,k.top)):
Math.max(c.y,0===d?h.bottom:Math.max(h.bottom,k.bottom)),m.x=c.x,m.y=l.y}else if(180===b)if(c.x<a.x||270===d&&c.y<a.y&&k.left<a.x||90===d&&c.y>a.y&&k.left<a.x)l.h(c.x,a.y),m.h(c.x,(a.y+c.y)/2),0===d?(l.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1),m.x=l.x,m.y=c.y):270===d&&c.y<a.y||90===d&&c.y>a.y?(l.x=a.x>k.right?this.computeMidOrthoPosition(a.x,a.y,k.right,c.y,!1):a.x>k.left&&(270===d&&a.y<k.top||90===d&&a.y>k.bottom)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):k.left,m.x=l.x,m.y=c.y):
180===d&&a.x>k.right&&a.y>k.top&&a.y<k.bottom&&(l.x=a.x,l.y=a.y<c.y?Math.min(c.y,k.top):Math.max(c.y,k.bottom),m.y=l.y);else{l.h(a.x,c.y);m.h((a.x+c.x)/2,c.y);if(0===d||90===d&&c.y<h.top||270===d&&c.y>h.bottom)0===d&&(k.$(a)||h.$(c))?l.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):c.y<a.y&&(0===d||90===d)?l.y=this.computeMidOrthoPosition(a.x,h.top,c.x,Math.max(c.y,k.bottom),!0):c.y>a.y&&(0===d||270===d)&&(l.y=this.computeMidOrthoPosition(a.x,h.bottom,c.x,Math.min(c.y,k.top),!0)),m.x=c.x,m.y=
l.y;if(l.y>h.top&&l.y<h.bottom)if(c.x<=h.right&&c.x>=a.x||a.x>=k.left&&a.x<=c.x){if(90===d||270===d)l.h(Math.min((a.x+c.x)/2,a.x),a.y),m.h(l.x,c.y)}else l.y=270===d||(0===d||180===d)&&c.y<a.y?Math.min(c.y,180===d?h.top:Math.min(h.top,k.top)):Math.max(c.y,180===d?h.bottom:Math.max(h.bottom,k.bottom)),m.x=c.x,m.y=l.y}else if(90===b)if(c.y>a.y||180===d&&c.x<a.x&&k.bottom>a.y||0===d&&c.x>a.x&&k.bottom>a.y)l.h(a.x,c.y),m.h((a.x+c.x)/2,c.y),270===d?(l.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0),
m.x=c.x,m.y=l.y):180===d&&c.x<a.x||0===d&&c.x>a.x?(l.y=a.y<k.top?this.computeMidOrthoPosition(a.x,a.y,c.x,k.top,!0):a.y<k.bottom&&(180===d&&a.x<k.left||0===d&&a.x>k.right)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):k.bottom,m.x=c.x,m.y=l.y):90===d&&a.y<k.top&&a.x>k.left&&a.x<k.right&&(l.x=a.x<c.x?Math.min(c.x,k.left):Math.max(c.x,k.right),l.y=a.y,m.x=l.x);else{l.h(c.x,a.y);m.h(c.x,(a.y+c.y)/2);if(270===d||0===d&&c.x<h.left||180===d&&c.x>h.right)270===d&&(k.$(a)||h.$(c))?l.x=this.computeMidOrthoPosition(a.x,
a.y,c.x,c.y,!1):c.x<a.x&&(270===d||0===d)?l.x=this.computeMidOrthoPosition(h.left,a.y,Math.max(c.x,k.right),c.y,!1):c.x>a.x&&(270===d||180===d)&&(l.x=this.computeMidOrthoPosition(h.right,a.y,Math.min(c.x,k.left),c.y,!1)),m.x=l.x,m.y=c.y;if(l.x>h.left&&l.x<h.right)if(c.y>=h.top&&c.y<=a.y||a.y<=k.bottom&&a.y>=c.y){if(0===d||180===d)l.h(a.x,Math.max((a.y+c.y)/2,a.y)),m.h(c.x,l.y)}else l.x=180===d||(90===d||270===d)&&c.x<a.x?Math.min(c.x,90===d?h.left:Math.min(h.left,k.left)):Math.max(c.x,90===d?h.right:
Math.max(h.right,k.right)),m.x=l.x,m.y=c.y}else if(c.y<a.y||180===d&&c.x<a.x&&k.top<a.y||0===d&&c.x>a.x&&k.top<a.y)l.h(a.x,c.y),m.h((a.x+c.x)/2,c.y),90===d?(l.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0),m.x=c.x,m.y=l.y):180===d&&c.x<a.x||0===d&&c.x>=a.x?(l.y=a.y>k.bottom?this.computeMidOrthoPosition(a.x,a.y,c.x,k.bottom,!0):a.y>k.top&&(180===d&&a.x<k.left||0===d&&a.x>k.right)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):k.top,m.x=c.x,m.y=l.y):270===d&&a.y>k.bottom&&a.x>k.left&&a.x<k.right&&
(l.x=a.x<c.x?Math.min(c.x,k.left):Math.max(c.x,k.right),l.y=a.y,m.x=l.x);else{l.h(c.x,a.y);m.h(c.x,(a.y+c.y)/2);if(90===d||0===d&&c.x<h.left||180===d&&c.x>h.right)90===d&&(k.$(a)||h.$(c))?l.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):c.x<a.x&&(90===d||0===d)?l.x=this.computeMidOrthoPosition(h.left,a.y,Math.max(c.x,k.right),c.y,!1):c.x>a.x&&(90===d||180===d)&&(l.x=this.computeMidOrthoPosition(h.right,a.y,Math.min(c.x,k.left),c.y,!1)),m.x=l.x,m.y=c.y;if(l.x>h.left&&l.x<h.right)if(c.y<=h.bottom&&
c.y>=a.y||a.y>=k.top&&a.y<=c.y){if(0===d||180===d)l.h(a.x,Math.min((a.y+c.y)/2,a.y)),m.h(c.x,l.y)}else l.x=180===d||(90===d||270===d)&&c.x<a.x?Math.min(c.x,270===d?h.left:Math.min(h.left,k.left)):Math.max(c.x,270===d?h.right:Math.max(h.right,k.right)),m.x=l.x,m.y=c.y}var n=c;if(this.isAvoiding){var p=this.diagram;if(null===p||e===f||this.layer.isTemporary||!ik(p)||h.$(n)&&!f.Jd(e)||k.$(a)&&!e.Jd(f))b=!1;else{var r=jk(p,!0,this.containingGroup,null);if(17!==this.segmentIndex&&r.fk(Math.min(a.x,l.x),
Math.min(a.y,l.y),Math.abs(a.x-l.x),Math.abs(a.y-l.y))&&r.fk(Math.min(l.x,m.x),Math.min(l.y,m.y),Math.abs(l.x-m.x),Math.abs(l.y-m.y))&&r.fk(Math.min(m.x,n.x),Math.min(m.y,n.y),Math.abs(m.x-n.x),Math.abs(m.y-n.y)))b=!1;else{e=a;f=n;var q=c=null;if(p.isVirtualized){p=r.bounds.copy();p.Kc(-r.Rp,-r.Qp);var u=K.alloc();ok(r,a.x,a.y)||(M.Cf(p.x,p.y,p.x+p.width,p.y+p.height,a.x,a.y,l.x,l.y,u)?(c=a=u.copy(),b=u.Pa(l)):M.Cf(p.x,p.y,p.x+p.width,p.y+p.height,l.x,l.y,m.x,m.y,u)?(c=a=u.copy(),b=u.Pa(m)):M.Cf(p.x,
p.y,p.x+p.width,p.y+p.height,m.x,m.y,n.x,n.y,u)&&(c=a=u.copy(),b=u.Pa(n)));ok(r,n.x,n.y)||(M.Cf(p.x,p.y,p.x+p.width,p.y+p.height,n.x,n.y,m.x,m.y,u)?(q=n=u.copy(),d=m.Pa(u)):M.Cf(p.x,p.y,p.x+p.width,p.y+p.height,m.x,m.y,l.x,l.y,u)?(q=n=u.copy(),d=l.Pa(u)):M.Cf(p.x,p.y,p.x+p.width,p.y+p.height,l.x,l.y,a.x,a.y,u)&&(q=n=u.copy(),d=a.Pa(u)));K.free(u)}h=h.copy().Rc(k);h.Kc(r.Rp*r.Dy,r.Qp*r.Dy);sp(r,a,b,n,d,h,!0);k=tp(r,n.x,n.y);!r.abort&&k>=up&&(nk(r),h.Kc(r.Rp*r.jy,r.Qp*r.jy),sp(r,a,b,n,d,h,!1),k=tp(r,
n.x,n.y));if(!r.abort&&k<up&&tp(r,n.x,n.y)!==pk){vp(this,r,n.x,n.y,d,!0,g);h=this.i(2);if(4>this.pointsCount)0===b||180===b?(h.x=a.x,h.y=n.y):(h.x=n.x,h.y=a.y),this.M(2,h.x,h.y),this.m(3,h.x,h.y);else if(g=this.i(3),0===b||180===b)M.w(h.x,g.x)?(h=0===b?Math.max(h.x,a.x):Math.min(h.x,a.x),this.M(2,h,a.y),this.M(3,h,g.y)):M.w(h.y,g.y)?(Math.abs(a.y-h.y)<=r.Qp/2&&(this.M(2,h.x,a.y),this.M(3,g.x,a.y)),this.m(2,h.x,a.y)):this.M(2,a.x,h.y);else if(90===b||270===b)M.w(h.y,g.y)?(h=90===b?Math.max(h.y,a.y):
Math.min(h.y,a.y),this.M(2,a.x,h),this.M(3,g.x,h)):M.w(h.x,g.x)?(Math.abs(a.x-h.x)<=r.Rp/2&&(this.M(2,a.x,h.y),this.M(3,a.x,g.y)),this.m(2,a.x,h.y)):this.M(2,h.x,a.y);null!==c&&(a=this.i(1),g=this.i(2),a.x!==g.x&&a.y!==g.y?0===b||180===b?this.m(2,a.x,g.y):this.m(2,g.x,a.y):0===b||180===b?this.m(2,e.x,c.y):this.m(2,c.x,e.y));null!==q&&(0===d||180===d?this.tf(f.x,q.y):this.tf(q.x,f.y));b=!0}else b=!1}}}else b=!1;b||(this.de(l.copy()),this.de(m.copy()));K.free(l);K.free(m)}};
T.prototype.computeMidOrthoPosition=function(a,b,c,d,e){var f=0;!this.hasCurviness()||this.computeSpot(!0,this.fromPort).Oc()||this.computeSpot(!1,this.toPort).Oc()||(f=this.computeCurviness());return e?(b+d)/2+f:(a+c)/2+f};
function Gj(a){if(null===a.diagram||!a.isAvoiding||!ik(a.diagram))return!1;var b=a.points.l,c=b.length;if(4>c)return!1;a=jk(a.diagram,!0,a.containingGroup,null);for(var d=1;d<c-2;d++){var e=b[d],f=b[d+1];if(!a.fk(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 vp(a,b,c,d,e,f,g){var h=b.Rp,k=b.Qp,l=tp(b,c,d),m=c,n=d;0===e?m+=h:90===e?n+=k:180===e?m-=h:n-=k;e!==g&&l>wp&&tp(b,m,n)!==l-1&&(tp(b,c-h,d)===l-1?(e=180,m=c-h,n=d):tp(b,c+h,d)===l-1?(e=0,m=c+h,n=d):tp(b,c,d-k)===l-1?(e=270,m=c,n=d-k):tp(b,c,d+k)===l-1&&(e=90,m=c,n=d+k));for(;l>wp&&tp(b,m,n)===l-1;)c=m,d=n,0===e?m+=h:90===e?n+=k:180===e?m-=h:n-=k,--l;if(f){if(l>wp)if(180===e||0===e)c=Math.floor(c/h)*h+h/2;else if(90===e||270===e)d=Math.floor(d/k)*k+k/2}else c=Math.floor(c/h)*h+h/2,d=Math.floor(d/
k)*k+k/2;l>wp&&(f=e,g=c,m=d,0===e?(f=90,m+=k):90===e?(f=180,g-=h):180===e?(f=270,m-=k):270===e&&(f=0,g+=h),tp(b,g,m)===l-1?vp(a,b,g,m,f,!1,f):(g=c,m=d,0===e?(f=270,m-=k):90===e?(f=0,g+=h):180===e?(f=90,m+=k):270===e&&(f=180,g-=h),tp(b,g,m)===l-1&&vp(a,b,g,m,f,!1,f)));a.tf(c,d)}T.prototype.Dz=function(a){var b=a.x;a=a.y;for(var c=this.i(0),d=this.i(1),e=vb(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=vb(b,a,d.x,d.y,c.x,c.y);d=c;h<e&&(f=g,e=h)}return f};
T.prototype.fc=function(a){this.Dm=!1;a&&this.s()};T.prototype.hk=function(a){if(!a){if(!1===this.td)return;a=this.pb();if(this.Dm&&(null===a||null!==a.geometry))return}this.ma=this.makeGeometry();a=this.path;if(null!==a){a.ma=this.ma;for(var b=this.U.l,c=b.length,d=0;d<c;d++){var e=b[d];e!==a&&e.isPanelMain&&e instanceof xf&&(e.ma=this.ma)}}};
T.prototype.makeGeometry=function(){var a=this.ma,b=this.pointsCount;if(2>b)return a.type=P.j,this.Dm=!0,a;var c=!1,d=this.diagram;null!==d&&bp(this)&&d.Xh.contains(this)&&(0!==this.yl.width||0!==this.yl.height)&&(c=!0);var e=this.i(0).copy(),f=e.copy();d=this.Cb.l;var g=this.computeCurve();if(g===Uf&&3<=b&&!M.aa(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.uu.x;k-=this.uu.y;e.x-=d;e.y-=k;if(2!==b||bp(this)){a.type=P.o;h=td(a);0!==this.computeShortLength(!0)&&(e=xp(this,e,!0,f));xd(h,e.x,e.y,!1);if(g===Uf&&3<=b&&!M.aa(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=xp(this,e,!1,f)),yd(h,b,c,b,c,e.x,e.y);else if(this.isOrthogonal){b=K.allocAt(d,k);c=K.alloc();c.assign(this.i(1));f=K.allocAt(d,k);e=K.allocAt(d,k);g=this.i(0);for(var l,m=this.smoothness/3,n=1;n<this.pointsCount-1;n++){l=this.i(n);var p=g,r=l,q=this.i(yp(this,l,n,!1));if(!M.aa(p.x,r.x)||!M.aa(r.x,q.x))if(!M.aa(p.y,r.y)||!M.aa(r.y,q.y)){var u=m;isNaN(u)&&(u=this.smoothness/3);var w=p.x;p=p.y;var v=r.x;r=r.y;var y=q.x;q=q.y;var z=u*zp(w,p,v,r);u*=zp(v,r,y,q);M.aa(p,r)&&M.aa(v,y)&&(v>w?q>r?(f.x=
v-z,f.y=r-z,e.x=v+u,e.y=r+u):(f.x=v-z,f.y=r+z,e.x=v+u,e.y=r-u):q>r?(f.x=v+z,f.y=r-z,e.x=v-u,e.y=r+u):(f.x=v+z,f.y=r+z,e.x=v-u,e.y=r-u));M.aa(w,v)&&M.aa(r,q)&&(r>p?(y>v?(f.x=v-z,f.y=r-z,e.x=v+u):(f.x=v+z,f.y=r-z,e.x=v-u),e.y=r+u):(y>v?(f.x=v-z,f.y=r+z,e.x=v+u):(f.x=v+z,f.y=r+z,e.x=v-u),e.y=r-u));if(M.aa(w,v)&&M.aa(v,y)||M.aa(p,r)&&M.aa(r,q))w=.5*(w+y),p=.5*(p+q),f.x=w,f.y=p,e.x=w,e.y=p;1===n?(c.x=.5*(g.x+l.x),c.y=.5*(g.y+l.y)):2===n&&M.aa(g.x,this.i(0).x)&&M.aa(g.y,this.i(0).y)&&(c.x=.5*(g.x+l.x),
c.y=.5*(g.y+l.y));yd(h,c.x-d,c.y-k,f.x-d,f.y-k,l.x-d,l.y-k);b.set(f);c.set(e);g=l}}l=g.x;g=g.y;m=this.i(this.pointsCount-1);0!==this.computeShortLength(!1)&&(m=xp(this,m.copy(),!1,zb));l=.5*(l+m.x);g=.5*(g+m.y);yd(h,e.x-d,e.y-k,l-d,g-k,m.x-d,m.y-k);K.free(b);K.free(c);K.free(f);K.free(e)}else for(c=3;c<b;c+=3)f=this.i(c-2),c+3>=b&&(c=b-1),e=this.i(c-1),g=this.i(c),c===b-1&&0!==this.computeShortLength(!1)&&(g=xp(this,g.copy(),!1,zb)),yd(h,f.x-d,f.y-k,e.x-d,e.y-k,g.x-d,g.y-k);else{f=K.alloc();f.assign(this.i(0));
e=K.alloc();e.assign(f);g=this.computeCorner();n=1;for(l=0;n<b;){n=yp(this,f,n,1<n);m=this.i(n);if(n>=b-1){if(!f.A(m))0!==this.computeShortLength(!1)&&(m=xp(this,m.copy(),!1,zb)),Ap(this,h,-d,-k,f,m,c);else if(0===l)for(n=1;n<b;)e.assign(f),m=this.i(n++),Ap(this,h,-d,-k,f,m,c),f.assign(m);break}l=yp(this,m,n+1,n<b-3);n=-d;w=-k;p=m;v=this.i(l);u=c;if(M.w(f.y,p.y)&&M.w(p.x,v.x))if(q=Math.min(g,Math.abs(p.x-e.x)/2),q=z=Math.min(q,Math.abs(v.y-p.y)/2),M.w(q,0))Ap(this,h,n,w,f,p,u),f.assign(p);else{var A=
p.x,C=p.y;r=A;y=C;p.x>f.x?A=p.x-q:A=p.x+q;v.y>p.y?y=p.y+z:y=p.y-z;v=K.allocAt(A,C);Ap(this,h,n,w,f,v,u);K.free(v);zd(h,p.x+n,p.y+w,r+n,y+w);f.h(r,y)}else M.w(f.x,p.x)&&M.w(p.y,v.y)?(q=Math.min(g,Math.abs(p.y-e.y)/2),q=z=Math.min(q,Math.abs(v.x-p.x)/2),M.w(z,0)?(Ap(this,h,n,w,f,p,u),f.assign(p)):(A=p.x,C=p.y,r=A,y=C,p.y>f.y?C=p.y-q:C=p.y+q,v.x>p.x?r=p.x+z:r=p.x-z,v=K.allocAt(A,C),Ap(this,h,n,w,f,v,u),K.free(v),zd(h,p.x+n,p.y+w,r+n,y+w),f.h(r,y))):(Ap(this,h,n,w,f,p,u),f.assign(p));e.assign(m);n=l}K.free(f)}Cd=
h}else h=this.i(1).copy(),h.x-=d,h.y-=k,0!==this.computeShortLength(!0)&&(e=xp(this,e,!0,f)),0!==this.computeShortLength(!1)&&(h=xp(this,h,!1,f)),a.type=P.j,a.startX=e.x,a.startY=e.y,a.endX=h.x,a.endY=h.y;this.Dm=!0;return a};function zp(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 M.aa(a,0)?b:M.aa(b,0)?a:Math.sqrt(a*a+b*b)}
function xp(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=zp(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=zp(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 yp(a,b,c,d){for(var e=a.pointsCount,f=b;M.aa(b.x,f.x)&&M.aa(b.y,f.y);){if(c>=e)return e-1;f=a.i(c++)}if(!M.aa(b.x,f.x)&&!M.aa(b.y,f.y))return c-1;for(var g=f;M.aa(b.x,f.x)&&M.aa(f.x,g.x)&&(!d||(b.y>=f.y?f.y>=g.y:f.y<=g.y))||M.aa(b.y,f.y)&&M.aa(f.y,g.y)&&(!d||(b.x>=f.x?f.x>=g.x:f.x<=g.x));){if(c>=e)return e-1;g=a.i(c++)}return c-2}T.prototype.computeJumpLength=function(){return 10};
function Ap(a,b,c,d,e,f,g){if(!g&&bp(a)){g=a.computeJumpLength();var h=g/2,k=[],l=0;a.isVisible()&&(l=Bp(a,e,f,k));if(0<l)if(M.w(e.y,f.y))if(e.x<f.x)for(var m=0;m<l;){var n=Math.max(e.x,Math.min(k[m++]-h,f.x-g));b.lineTo(n+c,f.y+d);var p=n+c;for(var r=Math.min(n+g,f.x);m<l;)if(n=k[m],n<r+g)m++,r=Math.min(n+h,f.x);else break;n=f.y-g+d;r+=c;var q=f.y+d;a.curve===Qf?xd(b,r,q,!1):yd(b,p,n,r,n,r,q)}else for(--l;0<=l;){m=Math.min(e.x,Math.max(k[l--]+h,f.x+g));b.lineTo(m+c,f.y+d);p=m+c;for(n=Math.max(m-
g,f.x);0<=l;)if(m=k[l],m>n-g)l--,n=Math.max(m-h,f.x);else break;m=f.y-g+d;n+=c;r=f.y+d;a.curve===Qf?xd(b,n,r,!1):yd(b,p,m,n,m,n,r)}else if(M.w(e.x,f.x))if(e.y<f.y)for(m=0;m<l;){n=Math.max(e.y,Math.min(k[m++]-h,f.y-g));b.lineTo(f.x+c,n+d);p=n+d;for(n=Math.min(n+g,f.y);m<l;)if(r=k[m],r<n+g)m++,n=Math.min(r+h,f.y);else break;r=f.x-g+c;q=f.x+c;n+=d;a.curve===Qf?xd(b,q,n,!1):yd(b,r,p,r,n,q,n)}else for(--l;0<=l;){m=Math.min(e.y,Math.max(k[l--]+h,f.y+g));b.lineTo(f.x+c,m+d);p=m+d;for(m=Math.max(m-g,f.y);0<=
l;)if(n=k[l],n>m-g)l--,m=Math.max(n-h,f.y);else break;n=f.x-g+c;r=f.x+c;m+=d;a.curve===Qf?xd(b,r,m,!1):yd(b,n,p,n,m,r,m)}}b.lineTo(f.x+c,f.y+d)}
function Bp(a,b,c,d){var e=a.diagram;if(null===e||b.A(c))return 0;for(e=e.layers;e.next();){var f=e.value;if(null!==f&&f.visible){f=f.Ha.l;for(var g=f.length,h=0;h<g;h++){var k=f[h];if(k instanceof T){if(k===a)return 0<d.length&&d.sort(function(a,b){return a-b}),d.length;if(k.isVisible()&&bp(k)){var l=k.routeBounds;l.u()&&a.routeBounds.Mc(l)&&!a.usesSamePort(k)&&(l=k.path,null!==l&&l.Ff()&&Cp(b,c,d,k))}}}}}0<d.length&&d.sort(function(a,b){return a-b});return d.length}
function Cp(a,b,c,d){for(var e=M.w(a.y,b.y),f=d.pointsCount,g=d.i(0),h=K.alloc(),k=1;k<f;k++){var l=d.i(k);if(k<f-1){var m=d.i(k+1);if(g.y===l.y&&l.y===m.y){if(l.x>g.x&&m.x>=l.x||l.x<g.x&&m.x<=l.x)continue}else if(g.x===l.x&&l.x===m.x&&(l.y>g.y&&m.y>=l.y||l.y<g.y&&m.y<=l.y))continue}a:{m=a.x;var n=a.y,p=b.x,r=b.y,q=g.x;g=g.y;var u=l.x,w=l.y;if(!M.w(m,p)){if(M.w(n,r)&&M.w(q,u)&&Math.min(m,p)<q&&Math.max(m,p)>q&&Math.min(g,w)<n&&Math.max(g,w)>n&&!M.w(g,w)){h.x=q;h.y=n;m=!0;break a}}else if(!M.w(n,r)&&
M.w(g,w)&&Math.min(n,r)<g&&Math.max(n,r)>g&&Math.min(q,u)<m&&Math.max(q,u)>m&&!M.w(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}K.free(h)}function bp(a){a=a.curve;return a===Pf||a===Qf}function fp(a,b){if(b||bp(a))b=a.diagram,null===b||b.animationManager.isTicking||b.Xh.contains(a)||0===a.yl.width&&0===a.yl.height||b.Xh.add(a,a.yl.copy())}
T.prototype.fq=function(a){var b=this.layer;if(null!==b&&b.visible&&!b.isTemporary){var c=b.diagram;if(null!==c&&!c.animationManager.isTicking){var d=!1;for(c=c.layers;c.next();){var e=c.value;if(e.visible)if(e===b){d=!0;var f=!1;e=e.Ha.l;for(var g=e.length,h=0;h<g;h++){var k=e[h];k instanceof T&&(k===this?f=!0:f&&Dp(this,k,a))}}else if(d)for(f=e.Ha.l,e=f.length,g=0;g<e;g++)h=f[g],h instanceof T&&Dp(this,h,a)}}}};
function Dp(a,b,c){if(null!==b&&b.Dm&&b.td&&bp(b)){var d=b.routeBounds;d.u()&&(a.routeBounds.Mc(d)||c.Mc(d))&&(a.usesSamePort(b)||b.fc(!1))}}T.prototype.usesSamePort=function(a){var b=this.pointsCount,c=a.pointsCount;if(0<b&&0<c){var d=this.i(0),e=a.i(0);if(d.Ua(e))return!0;b=this.i(b-1);a=a.i(c-1);if(b.Ua(a)||d.Ua(a)||b.Ua(e))return!0}else if(this.fromNode===a.fromNode||this.toNode===a.toNode||this.fromNode===a.toNode||this.toNode===a.fromNode)return!0;return!1};
T.prototype.isVisible=function(){if(!V.prototype.isVisible.call(this))return!1;var a=this.containingGroup,b=!0,c=this.diagram;null!==c&&(b=c.isTreePathToChildren);c=this.fromNode;if(null!==c){if(this.isTreeLink&&b&&!c.isTreeExpanded)return!1;if(c===a)return!0;for(var d=c;null!==d;){if(d.labeledLink===this)return!0;d=d.containingGroup}c=c.findVisibleNode();if(null===c||c===a)return!1}c=this.toNode;if(null!==c){if(this.isTreeLink&&!b&&!c.isTreeExpanded)return!1;if(c===a)return!0;for(b=c;null!==b;){if(b.labeledLink===
this)return!0;b=b.containingGroup}b=c.findVisibleNode();if(null===b||b===a)return!1}return!0};T.prototype.Ob=function(a){V.prototype.Ob.call(this,a);null!==this.Mf&&this.Mf.em();if(null!==this.nd)for(var b=this.nd.iterator;b.next();)b.value.Ob(a)};T.prototype.computeAdjusting=function(){return this.isAvoiding&&null!==this.diagram&&this.diagram.animationManager.defaultAnimation.isAnimating?Yo:this.vk};
function cp(a){var b=a.We;if(null!==b){var c=a.pf;if(null!==c&&isNaN(a.curviness)){for(var d=a.Xe,e=a.qf,f=a=null,g=b.ab.l,h=g.length,k=0;k<h;k++){var l=g[k];if(l.We===b&&l.Xe===d&&l.pf===c&&l.qf===e||l.We===c&&l.Xe===e&&l.pf===b&&l.qf===d)null===f?f=l:(null===a&&(a=[],a.push(f)),a.push(l))}if(null!==a){f=Io(b,c,d,e);null===f&&(f=new Ep(b,d,c,e),Ho(b,f),Ho(c,f));f.links=a;for(b=0;b<a.length;b++)a[b].Mf=f;f.em()}}}}
function dp(a){var b=a.Mf;null!==b&&isNaN(a.curviness)&&(a.Mf=null,a=b.links.indexOf(a),0<=a&&(Da(b.links,a),b.em()))}T.prototype.Hh=function(){return!0};
na.Object.defineProperties(T.prototype,{fromNode:{get:function(){return this.We},set:function(a){var b=this.We;if(b!==a){var c=this.fromPort;null!==b&&(this.pf!==b&&Mo(b,this,c),dp(this),this.B(2));this.We=a;null!==a&&this.Ob(a.isVisible());this.Qf=null;this.Va();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.pf!==a&&Lo(a,this,e),cp(this),this.B(1));this.g("fromNode",b,a);Eo(this)}}},fromPortId:{get:function(){return this.Xe},set:function(a){var b=this.Xe;if(b!==a){var c=this.fromPort;null!==c&&Jo(c);dp(this);this.Xe=a;var d=this.fromPort;null!==d&&Jo(d);var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.Pi()&&g.Pv(f,a)}c!==d&&(this.Qf=null,this.Va(),f=this.fromPortChanged,null!==f&&(g=!0,null!==e&&(g=e.Z,e.Z=!0),f(this,c,d),null!==e&&(e.Z=g)));cp(this);
this.g("fromPortId",b,a)}}},fromPort:{get:function(){var a=this.We;return null===a?null:a.ss(this.Xe)}},fromPortChanged:{get:function(){return this.Dn},set:function(a){var b=this.Dn;b!==a&&(this.Dn=a,this.g("fromPortChanged",b,a))}},toNode:{get:function(){return this.pf},set:function(a){var b=this.pf;if(b!==a){var c=this.toPort;null!==b&&(this.We!==b&&Mo(b,this,c),dp(this),this.B(2));this.pf=a;null!==a&&this.Ob(a.isVisible());
this.Qf=null;this.Va();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.We!==a&&Lo(a,this,e),cp(this),this.B(1));this.g("toNode",b,a);Eo(this)}}},toPortId:{get:function(){return this.qf},set:function(a){var b=this.qf;if(b!==a){var c=this.toPort;null!==c&&Jo(c);dp(this);this.qf=a;var d=this.toPort;null!==d&&Jo(d);
var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.Pi()&&g.Tv(f,a)}c!==d&&(this.Qf=null,this.Va(),f=this.toPortChanged,null!==f&&(g=!0,null!==e&&(g=e.Z,e.Z=!0),f(this,c,d),null!==e&&(e.Z=g)));cp(this);this.g("toPortId",b,a)}}},toPort:{get:function(){var a=this.pf;return null===a?null:a.ss(this.qf)}},toPortChanged:{get:function(){return this.Dp},set:function(a){var b=this.Dp;b!==a&&(this.Dp=a,this.g("toPortChanged",b,a))}},
fromSpot:{get:function(){return null!==this.P?this.P.Pg:Wc},set:function(a){this.Lc();var b=this.P.Pg;b.A(a)||(a=a.I(),this.P.Pg=a,this.g("fromSpot",b,a),(b.Oc()||a.Oc())&&null!==this.fromNode&&Jo(this.fromPort),this.Va())}},fromEndSegmentLength:{get:function(){return null!==this.P?this.P.Ng:NaN},set:function(a){this.Lc();var b=this.P.Ng;b!==a&&(0>a&&xa(a,">= 0",T,"fromEndSegmentLength"),this.P.Ng=a,this.g("fromEndSegmentLength",b,a),this.Va())}},
fromShortLength:{get:function(){return null!==this.P?this.P.Og:NaN},set:function(a){this.Lc();var b=this.P.Og;b!==a&&(this.P.Og=a,this.fc(!0),this.g("fromShortLength",b,a))}},toSpot:{get:function(){return null!==this.P?this.P.th:Wc},set:function(a){this.Lc();var b=this.P.th;b.A(a)||(a=a.I(),this.P.th=a,this.g("toSpot",b,a),(b.Oc()||a.Oc())&&null!==this.toNode&&Jo(this.toPort),this.Va())}},toEndSegmentLength:{
get:function(){return null!==this.P?this.P.rh:NaN},set:function(a){this.Lc();var b=this.P.rh;b!==a&&(0>a&&xa(a,">= 0",T,"toEndSegmentLength"),this.P.rh=a,this.g("toEndSegmentLength",b,a),this.Va())}},toShortLength:{get:function(){return null!==this.P?this.P.sh:NaN},set:function(a){this.Lc();var b=this.P.sh;b!==a&&(this.P.sh=a,this.fc(!0),this.g("toShortLength",b,a))}},isLabeledLink:{get:function(){return null===this.nd?!1:0<this.nd.count}},
labelNodes:{get:function(){return null===this.nd?ab:this.nd.iterator}},relinkableFrom:{get:function(){return 0!==(this.Ia&1)},set:function(a){var b=0!==(this.Ia&1);b!==a&&(this.Ia^=1,this.g("relinkableFrom",b,a),this.Lb())}},relinkableTo:{get:function(){return 0!==(this.Ia&2)},set:function(a){var b=0!==(this.Ia&2);b!==a&&(this.Ia^=2,this.g("relinkableTo",b,a),this.Lb())}},resegmentable:{
get:function(){return 0!==(this.Ia&4)},set:function(a){var b=0!==(this.Ia&4);b!==a&&(this.Ia^=4,this.g("resegmentable",b,a),this.Lb())}},isTreeLink:{get:function(){return 0!==(this.Ia&8)},set:function(a){var b=0!==(this.Ia&8);b!==a&&(this.Ia^=8,this.g("isTreeLink",b,a),null!==this.fromNode&&wk(this.fromNode),null!==this.toNode&&wk(this.toNode))}},path:{get:function(){var a=this.pb();return a instanceof xf?a:null}},routeBounds:{
get:function(){this.vg();var a=this.yl,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.Oe(e)}else if(this.computeCurve()===Uf&&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);M.Vl(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);M.Vl(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.Oe(f),e=2;e<d;e++)f=this.i(e),b=Math.min(f.x,b),c=Math.min(f.y,c),a.Oe(f);this.uu.h(b-a.x,c-a.y)}return a}},midPoint:{get:function(){this.vg();return this.computeMidPoint(new K)}},
midAngle:{get:function(){this.vg();return this.computeMidAngle()}},flattenedLengths:{get:function(){if(null===this.dr){this.td||ep(this);for(var a=this.dr=[],b=this.pointsCount,c=0;c<b-1;c++){var d=this.i(c);var e=this.i(c+1);M.aa(d.x,e.x)?(d=e.y-d.y,0>d&&(d=-d)):M.aa(d.y,e.y)?(d=e.x-d.x,0>d&&(d=-d)):d=Math.sqrt(d.xf(e));a.push(d)}}return this.dr}},flattenedTotalLength:{get:function(){var a=this.Qt;if(isNaN(a)){for(var b=
this.flattenedLengths,c=b.length,d=a=0;d<c;d++)a+=b[d];this.Qt=a}return a}},points:{get:function(){return this.Cb},set:function(a){var b=this.Cb;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 K(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 K(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.Cb=c;this.fc(!0);ep(this);a=this.diagram;null!==a&&(a.Oi||a.undoManager.isUndoingRedoing||a.Hs.add(this),a.animationManager.sb&&(a=a.animationManager,this.gf=c,a.Al.add(this)));this.g("points",b,c)}}},pointsCount:{
get:function(){return this.Cb.count}},td:{get:function(){return 0!==(this.Ia&16)},set:function(a){0!==(this.Ia&16)!==a&&(this.Ia^=16)}},suspendsRouting:{get:function(){return 0!==(this.Ia&32)},set:function(a){0!==(this.Ia&32)!==a&&(this.Ia^=32)}},computingPoints:{get:function(){return 0!==(this.Ia&64)},set:function(a){0!==(this.Ia&64)!==a&&(this.Ia^=64)}},defaultFromPoint:{
get:function(){return this.o},set:function(a){this.o=a.copy()}},defaultToPoint:{get:function(){return this.C},set:function(a){this.C=a.copy()}},isOrthogonal:{get:function(){return 2===(this.Ej.value&2)}},isAvoiding:{get:function(){return 4===(this.Ej.value&4)}},Dm:{get:function(){return 0!==(this.Ia&128)},set:function(a){0!==(this.Ia&128)!==a&&(this.Ia^=128)}},geometry:{
get:function(){this.Dm||(this.vg(),this.ma=this.makeGeometry());return this.ma}},firstPickIndex:{get:function(){return 2>=this.pointsCount?0:this.isOrthogonal||!ip(this.computeSpot(!0))?1:0}},lastPickIndex:{get:function(){var a=this.pointsCount;return 0===a?0:2>=a?a-1:this.isOrthogonal||!ip(this.computeSpot(!1))?a-2:a-1}},adjusting:{get:function(){return this.vk},set:function(a){var b=this.vk;b!==
a&&(this.vk=a,this.g("adjusting",b,a))}},corner:{get:function(){return this.gn},set:function(a){var b=this.gn;b!==a&&(this.gn=a,this.fc(!0),this.g("corner",b,a))}},curve:{get:function(){return this.jn},set:function(a){var b=this.jn;b!==a&&(this.jn=a,this.Va(),this.fc(!0),fp(this,b===Qf||b===Pf||a===Qf||a===Pf),this.g("curve",b,a))}},curviness:{get:function(){return this.kn},set:function(a){var b=this.kn;b!==
a&&(this.kn=a,this.Va(),this.fc(!1),this.g("curviness",b,a))}},routing:{get:function(){return this.Ej},set:function(a){var b=this.Ej;b!==a&&(this.Ej=a,this.Qf=null,this.Va(),fp(this,2===(b.value&2)||2===(a.value&2)),this.g("routing",b,a))}},smoothness:{get:function(){return this.rp},set:function(a){var b=this.rp;b!==a&&(this.rp=a,this.fc(!0),this.g("smoothness",b,a))}},key:{get:function(){var a=this.diagram;
if(null!==a&&a.model.Pi())return a.model.qc(this.data)}}});T.prototype.invalidateOtherJumpOvers=T.prototype.fq;T.prototype.findClosestSegment=T.prototype.Dz;T.prototype.updateRoute=T.prototype.vg;T.prototype.invalidateRoute=T.prototype.Va;T.prototype.rollbackRoute=T.prototype.Kv;T.prototype.commitRoute=T.prototype.vf;T.prototype.startRoute=T.prototype.Lh;T.prototype.clearPoints=T.prototype.Rj;T.prototype.removePoint=T.prototype.Iv;T.prototype.addPointAt=T.prototype.tf;T.prototype.addPoint=T.prototype.de;
T.prototype.insertPointAt=T.prototype.m;T.prototype.insertPoint=T.prototype.iA;T.prototype.setPointAt=T.prototype.M;T.prototype.setPoint=T.prototype.Qc;T.prototype.getPoint=T.prototype.i;T.prototype.getOtherPort=T.prototype.$z;T.prototype.getOtherNode=T.prototype.aq;
var gp=null,hp=null,Xo=new D(T,"Normal",1),Fp=new D(T,"Orthogonal",2),Gp=new D(T,"AvoidsNodes",6),op=new D(T,"AvoidsNodesStraight",7),Rf=new D(T,"None",0),Uf=new D(T,"Bezier",9),Qf=new D(T,"JumpGap",10),Pf=new D(T,"JumpOver",11),Yo=new D(T,"End",17),Zo=new D(T,"Scale",18),$o=new D(T,"Stretch",19),Mm=new D(T,"OrientAlong",21),Fm=new D(T,"OrientPlus90",22),Hm=new D(T,"OrientMinus90",23),ap=new D(T,"OrientOpposite",24),Nm=new D(T,"OrientUpright",25),Gm=new D(T,"OrientPlus90Upright",26),Im=new D(T,"OrientMinus90Upright",
27),Jm=new D(T,"OrientUpright45",28),qp=16,pp=14,rp=8;T.className="Link";T.Normal=Xo;T.Orthogonal=Fp;T.AvoidsNodes=Gp;T.AvoidsNodesStraight=op;T.None=Rf;T.Bezier=Uf;T.JumpGap=Qf;T.JumpOver=Pf;T.End=Yo;T.Scale=Zo;T.Stretch=$o;T.OrientAlong=Mm;T.OrientPlus90=Fm;T.OrientMinus90=Hm;T.OrientOpposite=ap;T.OrientUpright=Nm;T.OrientPlus90Upright=Gm;T.OrientMinus90Upright=Im;T.OrientUpright45=Jm;T.EndSegmentStep=8;T.CurvinessStart=qp;T.SpacingMin=pp;T.OrthoShortCut=rp;T.AvoidanceCell=8;T.AvoidanceLimit=999;
function Ep(a,b,c,d){Va(this);this.te=this.jr=!1;this.Ks=a;this.qy=b;this.wv=c;this.sy=d;this.links=[]}Ep.prototype.em=function(){if(!this.jr){var a=this.links;0<a.length&&(a=a[0].diagram,null!==a&&(a.Sw.add(this),this.te=a.undoManager.isUndoingRedoing))}this.jr=!0};
Ep.prototype.ew=function(){if(this.jr){this.jr=!1;var a=this.links;if(0<a.length){var b=a[0],c=b.diagram;c=null===c||c.Oi&&!this.te;this.te=!1;b.arrangeBundledLinks(a,c);1===a.length&&(b.Mf=null,a.length=0)}0===a.length&&(a=this.Ks,null!==this&&null!==a.Te&&a.Te.remove(this),a=this.wv,null!==this&&null!==a.Te&&a.Te.remove(this))}};Ep.className="LinkBundle";
function kk(){Va(this);this.Cy=this.group=null;this.As=!0;this.abort=!1;this.zd=this.yd=1;this.po=this.oo=-1;this.hc=this.gc=8;this.Tb=null;this.zi=this.yi=0;this.Dy=11;this.jy=124}
kk.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.yd=Math.floor((a.x-this.gc)/this.gc)*this.gc;this.zd=Math.floor((b-this.hc)/this.hc)*this.hc;this.oo=Math.ceil((c+2*this.gc)/this.gc)*this.gc;this.po=Math.ceil((d+2*this.hc)/this.hc)*this.hc;a=1+(Math.ceil((this.oo-this.yd)/this.gc)|0);b=1+(Math.ceil((this.po-this.zd)/this.hc)|0);if(null===this.Tb||this.yi<a-1||this.zi<b-1){c=[];for(d=0;d<=a;d++)c[d]=new Uint32Array(b);this.Tb=c;this.yi=
a-1;this.zi=b-1}a=Hp;if(null!==this.Tb)for(b=0;b<=this.yi;b++)if(c=this.Tb[b],c.fill)c.fill(a);else for(d=0;d<=this.zi;d++)c[d]=a}};function ok(a,b,c){return a.yd<=b&&b<=a.oo&&a.zd<=c&&c<=a.po}function tp(a,b,c){if(!ok(a,b,c))return Hp;b-=a.yd;b/=a.gc;c-=a.zd;c/=a.hc;return a.Tb[b|0][c|0]}function nk(a){if(null!==a.Tb)for(var b=0;b<=a.yi;b++)for(var c=a.Tb[b],d=0;d<=a.zi;d++)c[d]>=wp&&(c[d]=Hp)}
kk.prototype.fk=function(a,b,c,d){if(a>this.oo||a+c<this.yd||b>this.po||b+d<this.zd)return!0;a=(a-this.yd)/this.gc|0;b=(b-this.zd)/this.hc|0;c=Math.max(0,c)/this.gc+1|0;var e=Math.max(0,d)/this.hc+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.yi)|0;for(c=Math.min(b+e-1,this.zi)|0;a<=d;a++){e=this.Tb[a];for(var f=b;f<=c;f++)if(e[f]===pk)return!1}return!0};
function Ip(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.Tb[l][m];if(n>=wp&&n<up)for(e?m+=d:l+=d,n+=1;f<=l&&l<=g&&h<=m&&m<=k&&!(n>=a.Tb[l][m]);)a.Tb[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)Ip(a,b,c,1,!e,f,g,h,k),Ip(a,b,c,-1,!e,f,g,h,k);else for(c+=d;c>l;c+=d)Ip(a,b,c,1,!e,f,g,h,k),Ip(a,b,c,-1,!e,f,g,h,k);else if(0<d)for(b+=d;b<l;b+=d)Ip(a,b,c,1,!e,f,g,h,k),Ip(a,b,c,-1,!e,f,g,h,k);else for(b+=d;b>l;b+=d)Ip(a,b,c,1,!e,f,g,h,k),Ip(a,b,c,-1,!e,f,g,h,
k)}}function Jp(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=pk,m=wp;for(a.Tb[b][c]=m;l===pk&&b>f&&b<g&&c>h&&c<k;)m+=1,a.Tb[b][c]=m,e?c+=d:b+=d,l=a.Tb[b][c]}function Kp(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=pk,m=up;for(a.Tb[b][c]=m;l===pk&&b>f&&b<g&&c>h&&c<k;)a.Tb[b][c]=m,e?c+=d:b+=d,l=a.Tb[b][c]}
function sp(a,b,c,d,e,f,g){if(null!==a.Tb){a.abort=!1;var h=b.x,k=b.y;if(ok(a,h,k)){h-=a.yd;h/=a.gc;k-=a.zd;k/=a.hc;var l=d.x,m=d.y;if(ok(a,l,m))if(l-=a.yd,l/=a.gc,m-=a.zd,m/=a.hc,1>=Math.abs(h-l)&&1>=Math.abs(k-m))a.abort=!0;else{var n=f.x;d=f.y;b=f.x+f.width;var p=f.y+f.height;n-=a.yd;n/=a.gc;d-=a.zd;d/=a.hc;b-=a.yd;b/=a.gc;p-=a.zd;p/=a.hc;f=Math.max(0,Math.min(a.yi,n|0));b=Math.min(a.yi,Math.max(0,b|0));n=Math.max(0,Math.min(a.zi,d|0));p=Math.min(a.zi,Math.max(0,p|0));d=a.Tb;h|=0;k|=0;l|=0;m|=
0;var r=0===c||90===c?1:-1;c=90===c||270===c;d[h][k]===pk?(Jp(a,h,k,r,c,f,b,n,p),Jp(a,h,k,1,!c,f,b,n,p),Jp(a,h,k,-1,!c,f,b,n,p)):Jp(a,h,k,r,c,h,k,h,k);d[l][m]===pk?(Kp(a,l,m,0===e||90===e?1:-1,90===e||270===e,f,b,n,p),Kp(a,l,m,1,!(90===e||270===e),f,b,n,p),Kp(a,l,m,-1,!(90===e||270===e),f,b,n,p)):Kp(a,l,m,r,c,l,m,l,m);c=Ea();if(g&&Lp(a,l,m,e,h,k,c)){if(c[0]!==l||c[1]!==m)c.unshift(m),c.unshift(l);if(c[c.length-2]!==h||c[c.length-1]!==k)c.push(h),c.push(k);a=wp;e=c[c.length-2];g=c[c.length-1];d[e][g]=
a++;for(f=c.length-4;0<=f;f-=2)for(e=c[f+2],g=c[f+3],b=c[f],l=c[f+1];b>e?e++:b<e?e--:l>g?g++:l<g&&g--,d[e][g]=a++,e!==b||g!==l;);}else Ip(a,h,k,1,!1,f,b,n,p),Ip(a,h,k,-1,!1,f,b,n,p),Ip(a,h,k,1,!0,f,b,n,p),Ip(a,h,k,-1,!0,f,b,n,p);Ia(c)}}}}
function Lp(a,b,c,d,e,f,g){for(var h=a.Tb,k=b,l=c;;){if(k===e&&l===f)return!0;var m=k,n=l;if(0===d)if(m<e)m++;else break;else if(90===d)if(n<f)n++;else break;else if(180===d)if(m>e)m--;else break;else if(n>f)n--;else break;var p=h[m][n];if(0===p||p===Mp)break;k=m;l=n}for(;;){m=d;n=k;p=l;0===d?p<f?(m=90,p++):p>f&&(m=270,p--):90===d?n<e?(m=0,n++):n>e&&(m=180,n--):180===d?p<f?(m=90,p++):p>f&&(m=270,p--):n<e?(m=0,n++):n>e&&(m=180,n--);n=h[n][p];if(m!==d&&0!==n&&n!==Mp){g.push(k);g.push(l);if(Lp(a,k,l,
m,e,f,g))return!0;g.pop();g.pop()}h[k][l]=Mp;if(0===d){if(k===b)return!1;k--}else if(90===d){if(l===c)return!1;l--}else if(180===d){if(k===b)return!1;k++}else{if(l===c)return!1;l++}}}
na.Object.defineProperties(kk.prototype,{bounds:{get:function(){return new N(this.yd,this.zd,this.oo-this.yd,this.po-this.zd)}},Rp:{get:function(){return this.gc},set:function(a){0<a&&a!==this.gc&&(this.gc=a,this.initialize(this.bounds))}},Qp:{get:function(){return this.hc},set:function(a){0<a&&a!==this.hc&&(this.hc=a,this.initialize(this.bounds))}}});var pk=0,wp=1,up=999999,Hp=up+1,Mp=up+2;kk.className="PositionArray";
function mp(){Va(this);this.port=this.node=null;this.fe=[];this.iq=!1}mp.prototype.toString=function(){for(var a=this.fe,b=this.node.toString()+" "+a.length.toString()+":",c=0;c<a.length;c++){var d=a[c];null!==d&&(b+="\n  "+d.toString())}return b};
function 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}mp.prototype.em=function(){this.fe.length=0};
function np(a,b){var c=a.fe;if(0===c.length){a:if(!a.iq){c=a.iq;a.iq=!0;var d=null,e=a.node,f=e instanceof U?e:null;if(null===f||f.isSubGraphExpanded)var g=e.isTreeExpanded?e.findLinksConnected(a.port.portId):e.Qx();else{if(!f.actualBounds.u()){a.iq=c;break a}d=f;g=d.Vu()}f=a.fe.length=0;var h=a.port.da(uc,K.alloc()),k=a.port.da(Cc,K.alloc());e=N.allocAt(h.x,h.y,0,0);e.Oe(k);K.free(h);K.free(k);h=K.allocAt(e.x+e.width/2,e.y+e.height/2);k=a.port.Ki();for(g=g.iterator;g.next();){var l=g.value;if(l.isVisible()&&
l.fromPort!==l.toPort){var m=l.fromPort===a.port||null!==l.fromNode&&l.fromNode.Jd(d),n=l.computeSpot(m,a.port);if(n.Oc()){var p=m?l.toPort:l.fromPort;if(null!==p&&(m=p.part,null!==m)){var r=m.findVisibleNode();null!==r&&r!==m&&(m=r,p=m.port);m=l.computeOtherPoint(m,p);p=h.Pa(p.da(yc));p+=(h.Pa(m)-p)/360;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.fe[f];void 0===r?(r=new Op(l,p,n),a.fe[f]=
r):(r.link=l,r.angle=p,r.Dc=n);r.zv.set(m);f++}}}}K.free(h);a.fe.sort(mp.prototype.j);k=a.fe.length;d=-1;for(f=h=0;f<k;f++)g=a.fe[f],void 0!==g&&(g.Dc!==d&&(d=g.Dc,h=0),g.bq=h,h++);d=-1;h=0;for(f=k-1;0<=f;f--)k=a.fe[f],void 0!==k&&(k.Dc!==d&&(d=k.Dc,h=k.bq+1),k.Yl=h);f=a.fe;n=a.port;d=a.node.portSpreading;h=K.alloc();k=K.alloc();g=K.alloc();l=K.alloc();n.da(uc,h);n.da(wc,k);n.da(Cc,g);n.da(Ac,l);r=p=m=n=0;if(d===Uo)for(var q=0;q<f.length;q++){var u=f[q];if(null!==u){var w=u.link.computeThickness();
switch(u.Dc){case 8:p+=w;break;case 2:r+=w;break;case 1:n+=w;break;default:case 4:m+=w}}}var v=q=0,y=1,z=u=0;for(w=0;w<f.length;w++){var A=f[w];if(null!==A){if(q!==A.Dc){q=A.Dc;switch(q){case 8:var C=g;v=l;break;case 2:C=l;v=h;break;case 1:C=h;v=k;break;default:case 4:C=k,v=g}u=v.x-C.x;z=v.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}v=0}var F=A.hq;if(d===Uo){A=A.link.computeThickness();A*=y;F.set(C);switch(q){case 8:F.x=C.x+u/2+p/2-v-A/2;break;case 2:F.y=C.y+z/2+r/2-v-A/2;break;case 1:F.x=C.x+u/2-n/2+v+A/2;break;default:case 4:F.y=C.y+z/2-m/2+v+A/2}v+=A}else{var R=.5;d===Go&&(R=(A.bq+1)/(A.Yl+1));F.x=C.x+u*R;F.y=C.y+z*R}}}K.free(h);K.free(k);K.free(g);K.free(l);C=a.fe;for(f=0;f<C.length;f++)d=C[f],null!==d&&(d.Su=a.computeEndSegmentLength(d));a.iq=c;N.free(e)}c=a.fe}for(a=0;a<c.length;a++)if(e=
c[a],null!==e&&e.link===b)return e;return null}mp.prototype.j=function(a,b){return a===b?0:null===a?-1:null===b?1:a.Dc<b.Dc?-1:a.Dc>b.Dc?1:a.angle<b.angle?-1:a.angle>b.angle?1:0};
mp.prototype.computeEndSegmentLength=function(a){var b=a.link,c=b.computeEndSegmentLength(this.node,this.port,rc,b.fromPort===this.port),d=a.bq;if(0>d)return c;var e=a.Yl;if(1>=e||!b.isOrthogonal)return c;b=a.zv;var f=a.hq;if(2===a.Dc||8===a.Dc)d=e-1-d;return((a=2===a.Dc||4===a.Dc)?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)};mp.className="Knot";function Op(a,b,c){this.link=a;this.angle=b;this.Dc=c;this.zv=new K;this.Yl=this.bq=0;this.hq=new K;this.Su=0}
Op.prototype.toString=function(){return this.link.toString()+" "+this.angle.toString()+" "+this.Dc.toString()+":"+this.bq.toString()+"/"+this.Yl.toString()+" "+this.hq.toString()+" "+this.Su.toString()+" "+this.zv.toString()};Op.className="LinkInfo";function Yk(){this.th=this.Pg=Wc;this.sh=this.Og=this.rh=this.Ng=NaN;this.Bp=this.Bn=null;this.Cp=this.Cn=Infinity}
Yk.prototype.copy=function(){var a=new Yk;a.Pg=this.Pg.I();a.th=this.th.I();a.Ng=this.Ng;a.rh=this.rh;a.Og=this.Og;a.sh=this.sh;a.Bn=this.Bn;a.Bp=this.Bp;a.Cn=this.Cn;a.Cp=this.Cp;return a};Yk.className="LinkSettings";function ni(a){Va(this);this.o=this.D=null;this.$h=this.Un=!0;this.$n=!1;this.Rm=(new K(0,0)).freeze();this.Xn=!0;this.Vm=this.Wn=null;this.Zn=!1;this.j=null;this.C=0;this.qo=this.Ip=null;this.hs=!1;this.lg=this.Gj=null;this.Yr=!1;a&&Object.assign(this,a)}
ni.prototype.cloneProtected=function(a){a.Un=this.Un;a.$h=this.$h;a.$n=this.$n;a.Rm.assign(this.Rm);a.Xn=this.Xn;a.Wn=this.Wn;a.Vm=this.Vm;a.Zn=!0;a.qo=this.qo;a.Ip=this.Ip};ni.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};ni.prototype.serializeLayoutProperties=function(a){a.arrangementOrigin={x:this.arrangementOrigin.x,y:this.arrangementOrigin.y};a.isRouting=this.isRouting};
ni.prototype.deserializeLayoutProperties=function(a){null!==a&&(this.arrangementOrigin=new K(a.arrangementOrigin.x,a.arrangementOrigin.y),this.isRouting=a.isRouting)};ni.prototype.gb=function(){};ni.prototype.toString=function(){var a=Ja(this.constructor);a+="(";null!==this.group&&(a+=" in "+this.group);null!==this.diagram&&(a+=" for "+this.diagram);return a+")"};
ni.prototype.B=function(){if(this.isValidLayout){var a=this.diagram;if(null!==a&&!a.undoManager.isUndoingRedoing){var b=a.animationManager;!b.isTicking&&(b.defaultAnimation.isAnimating&&b.sc(),this.isOngoing&&a.Oi||this.isInitial&&!a.Oi)&&(this.isValidLayout=!1,a.Fb())}}};ni.prototype.createNetwork=function(){return new Pp(this)};ni.prototype.makeNetwork=function(a){var b=this.createNetwork();a instanceof Q?(b.ng(a.nodes,!0),b.ng(a.links,!0)):a instanceof U?b.ng(a.memberParts):b.ng(a.iterator);return b};
ni.prototype.updateParts=function(){this.isValidLayout=!0;if(!this.workerLayout()){var a=this.diagram;if(null===a&&null!==this.network)for(var b=this.network.vertexes.iterator;b.next();){var c=b.value.node;if(null!==c&&(a=c.diagram,null!==a))break}try{null!==a&&a.xa("Layout"),this.commitLayout()}finally{null!==a&&a.Xa("Layout")}}};ni.prototype.commitLayout=function(){if(null!==this.network){for(var a=this.network.vertexes.iterator;a.next();)a.value.commit();if(this.isRouting)for(a=this.network.edges.iterator;a.next();)a.value.commit()}};
ni.prototype.doLayout=function(a){var b=new G;a instanceof Q?(Qp(this,b,a.nodes,!0,this.Jh,!0,!1,!0),Qp(this,b,a.parts,!0,this.Jh,!0,!1,!0)):a instanceof U?Qp(this,b,a.memberParts,!1,this.Jh,!0,!1,!0):b.addAll(a.iterator);0<b.count&&(a=this.diagram,null!==a&&a.xa("Layout"),this.doMinimalNoNetworkLayout(b),null!==a&&a.Xa("Layout"));this.isValidLayout=!0};
ni.prototype.doMinimalNoNetworkLayout=function(a){var b=Math.ceil(Math.sqrt(a.count));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);var c=this.arrangementOrigin.x,d=c,e=this.arrangementOrigin.y,f=0,g=0;for(a=a.iterator;a.next();){var h=a.value;Rp(h);var k=h.measuredBounds,l=k.width;k=k.height;h.moveTo(d,e);h instanceof U&&(h.Jh=!1);d+=Math.max(l,50)+20;g=Math.max(g,Math.max(k,50));f>=b-1?(f=0,d=c,e+=g+20,g=0):f++}};
ni.prototype.doMinimalNetworkLayout=function(){var a=Math.ceil(Math.sqrt(this.network.vertexes.count));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);for(var b=this.arrangementOrigin.x,c=b,d=this.arrangementOrigin.y,e=0,f=0,g=this.network.vertexes.iterator;g.next();){var h=g.value.node;if(!(null===h||h instanceof T)&&(Rp(h),this.Jh(h))){var k=h.measuredBounds,l=k.width;k=k.height;h.moveTo(c,d);h instanceof U&&(h.Jh=!1);c+=Math.max(l,50)+20;f=Math.max(f,Math.max(k,50));e>=a-1?(e=
0,c=b,d+=f+20,f=0):e++}}};ni.prototype.Jh=function(a){return!a.location.u()||a instanceof U&&a.Jh?!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 W?k.isLinkLabel||(k instanceof U?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 T?b.add(k):!h||!k.Nc()||k instanceof W||(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.Ta()}ni.prototype.Mi=function(a,b){var c=this.boundsComputation;if(null!==c)return b||(b=new N),c(a,this,b);if(!b)return a.actualBounds;b.set(a.actualBounds);return b};
ni.prototype.Fx=function(a){var b=new G;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 U?Qp(this,b,a.memberParts,!1,null,!0,!0,!0):Qp(this,b,a.iterator,!1,null,!0,!0,!0);return b};
ni.prototype.initialOrigin=function(a){var b=this.group;if(null!==b){var c=b.position.copy();(isNaN(c.x)||isNaN(c.y))&&c.set(a);b=b.placeholder;null!==b&&(c=b.da(uc),(isNaN(c.x)||isNaN(c.y))&&c.set(a),a=b.padding,c.x+=a.left,c.y+=a.top);return c}return a};ni.prototype.mayUseWorker=function(){return this.mayUseWorkerFunction?this.mayUseWorkerFunction(this):!1};ni.prototype.workerLayout=function(){return!1};
function Sp(a,b){if(null!==a.workerStateChanged){var c={key:a.group?a.group.key:null};void 0!==b&&(c.time=b);null!==a.Gj&&(c.running=Tp(a.Gj));null!==a.lg&&(c.waiting=Tp(a.lg));a.workerStateChanged(c,a)}}function Tp(a){return{vertexes:a.vertexes.count,edges:a.edges.count}}ni.prototype.jz=function(){var a=Up(this.constructor);a&&(null!==a.Pe&&a.Pe.terminate(),a.Pe=null,a.gm.iteratorValues.each(function(a){a.hs=!1;a.Gj=null;a.lg=null;a.Yr=!1;Sp(a)}),a.gm.clear())};
function Vp(a,b){var c=Up(a);if(c){if(b)for(var d in b)c[d]=b[d]}else throw Error("Unknown Layout class: "+a);}function Up(a){var b=null;if("function"===typeof a){if(b=Wp.get(a),!b){var c=Ja(a);b=Wp.get(c);b||(b=new Xp,b.Nu=a,b.name=c,b.j=a.name,b.by=Yp,Wp.set(c,b),Wp.set(a,b),Wp.set(a.name,b))}}else"string"===typeof a&&(b=Wp.get(a));return b}
ni.prototype.dw=function(){if("undefined"===typeof Worker||!Zp||"undefined"===typeof self||"undefined"!==typeof self.DedicatedWorkerGlobalScope)return!1;if(!this.mayUseWorker())return this.hs&&(this.Yr=!0,this.lg=this.Gj=null,Sp(this)),!1;var a=Up(this.constructor);if(null===a)return!1;null===a.Pe&&(a.Pe=new Worker(Zp),a.Pe.onerror=function(a){a.preventDefault();ya("Worker Error at: "+a.filename+" "+a.lineno+" "+a.colno+"\n  "+a.message)},a.Pe.j=function(a){ya("Worker serialization error: "+a)},a.Pe.onmessage=
function(b){var c=b.data;if("_GoJS"===c._GoJS)if(c.version&&Q.version&&c.version!==Q.version)ya("Failure: GoJS v"+Q.version+"  Worker v"+c.version);else if(b=a.gm.get(c.id)){a.gm.remove(c.id);b.hs=!1;b.Gj=null;if(b.Yr)b.Yr=!1,b.lg=null;else{var d=$p(b,c,!1);b.network=d;b.updateParts();b.network=null;b.isValidLayout=!0}Sp(b,c.time);c=b.lg;if(null!==c)b.lg=null;else for(d=a.gm.iteratorValues;d.next();){var e=d.value;c=e.lg;if(null!==c){e.lg=null;break}}null!==c&&aq(b,c)}},a.Pe.postMessage({_GoJS:"_GoJS",
url:a.by}),Array.isArray(a.scripts)&&a.scripts.forEach(function(b){a.Pe.postMessage({_GoJS:"_GoJS",url:b})}),a.Pe.postMessage({_GoJS:"_GoJS",version:-1}));null!==this.Gj?this.lg=this.network:aq(this,this.network);Sp(this);this.doMinimalNetworkLayout();this.network=null;return this.isValidLayout=!0};function aq(a,b){a.hs=!0;var c=Up(a.constructor),d=bq(a,b,!0);d._GoJS="_GoJS";c.Pe.postMessage(d);c.gm.set(ib(a),a);a.Gj=b}
function bq(a,b,c){a.onNetworkSerialization(1,c,b,null);var d={};a.serializeLayoutProperties(d,c);var e=[];b.vertexes.each(function(a){var b={};a.serializeVertexProperties(b,c);e.push(b)});var f=[];b.edges.each(function(a){var b={};a.serializeEdgeProperties(b,c);f.push(b)});d={id:c?ib(a):a.id,layout:Ja(a.constructor),p:d,XA:e,Bz:f};a.onNetworkSerialization(2,c,b,d);return d}
function $p(a,b,c){c&&(a.id=b.id);var d=a.diagram,e=a.createNetwork();a.onNetworkSerialization(3,c,e,b);var f=b.XA,g=new H;f&&f.forEach(function(a){var b=null;null===a.key||null===d||c||(b=d.Eb(a.key));null!==b?b=e.Pj(b):(b=e.createVertex(),e.og(b));c&&null!==a.key&&(b.data={di:a.key});g.set(a.id,b)});var h=b.Bz,k=new H;h&&h.forEach(function(a){var b=null;null===a.key||null===d||c||(b=d.findLinkForKey(a.key));var f=e.createEdge();e.Tl(f);f.link=b;c&&null!==a.key&&(f.data={di:a.key});k.set(a.id,f)});
f&&f.forEach(function(a){var b=g.get(a.id);b&&b.deserializeVertexProperties(a,g,k,c)});h&&h.forEach(function(a){var b=k.get(a.id);b&&b.deserializeEdgeProperties(a,g,k,c)});a.deserializeLayoutProperties(b.p,g,k,c,e);a.onNetworkSerialization(4,c,e,b);return e}ni.prototype.onNetworkSerialization=function(){};
na.Object.defineProperties(ni.prototype,{diagram:{get:function(){return this.D},set:function(a){this.D=a}},group:{get:function(){return this.o},set:function(a){this.o!==a&&(this.o=a,null!==a&&(this.D=a.diagram))}},isOngoing:{get:function(){return this.Un},set:function(a){this.Un!==a&&(this.Un=a)}},isInitial:{get:function(){return this.$h},set:function(a){this.$h=a;a||(this.Zn=!0)}},
isViewportSized:{get:function(){return this.$n},set:function(a){this.$n!==a&&(this.$n=a)&&this.B()}},isRouting:{get:function(){return this.Xn},set:function(a){this.Xn!==a&&(this.Xn=a)}},isRealtime:{get:function(){return this.Wn},set:function(a){this.Wn!==a&&(this.Wn=a)}},isValidLayout:{get:function(){return this.Zn},set:function(a){this.Zn!==a&&(this.Zn=a,a||(a=this.diagram,null!==
a&&(a.Oh=!0)))}},network:{get:function(){return this.j},set:function(a){this.j!==a&&(this.j=a,null!==a&&(a.layout=this))}},boundsComputation:{get:function(){return this.Vm},set:function(a){this.Vm!==a&&(this.Vm=a,this.B())}},arrangementOrigin:{get:function(){return this.Rm},set:function(a){this.Rm.A(a)||(this.Rm.assign(a),this.B())}},id:{get:function(){return this.C},set:function(a){this.C=
a}},mayUseWorkerFunction:{get:function(){return this.qo},set:function(a){this.qo!==a&&(this.qo=a)}},workerStateChanged:{get:function(){return this.Ip},set:function(a){this.Ip!==a&&(this.Ip=a)}}});ni.prototype.useWorker=ni.prototype.dw;ni.declareWorkerLayout=Vp;ni.prototype.cancelWorker=ni.prototype.jz;ni.prototype.collectParts=ni.prototype.Fx;ni.prototype.getLayoutBounds=ni.prototype.Mi;ni.prototype.invalidateLayout=ni.prototype.B;
var Wp=new H,Yp="object"===typeof x.document&&x.document.currentScript?x.document.currentScript.src:"",Zp="undefined"!==typeof URL&&"function"===typeof URL.createObjectURL&&"function"===typeof Blob?URL.createObjectURL(new Blob(["self.onmessage=function(e){if(e.data.url){\nimportScripts(e.data.url);}}"],{type:"text/javascript"})):"";ni.className="Layout";ni.GoJSScriptURL=Yp;ni.declareWorkerLayout=Vp;
"undefined"!==typeof self&&"undefined"!==typeof self.DedicatedWorkerGlobalScope&&"undefined"!==typeof self&&"undefined"!==typeof self.DedicatedWorkerGlobalScope&&(self.onmessage=function(a){a=a.data;if("_GoJS"===a._GoJS)if(a.url)importScripts(a.url);else if(a.version)self.postMessage({_GoJS:"_GoJS",version:Q.version},void 0);else{var b=performance.now(),c=null;a.layout&&(c=Up(a.layout));var d=null;c&&c.Nu&&(d=new c.Nu);if(!d)throw Error("no registered Worker Layout: "+a.layout);d.network=$p(d,a,!0);
d.workerLayout=function(){var a=bq(d,d.network,!1);a._GoJS="_GoJS";a.time=performance.now()-b;self.postMessage(a,void 0);return!0};d.doLayout(new E)}});function Xp(){this.Nu=null;this.by=this.j=this.name="";this.scripts=[];this.Pe=null;this.gm=new H}function Pp(a){Va(this);this.vc=a;this.rf=new G;this.ne=new G;this.Ls=new H;this.Gs=new H}
Pp.prototype.clear=function(){if(this.rf)for(var a=this.rf.iterator;a.next();)a.value.clear();if(this.ne)for(a=this.ne.iterator;a.next();)a.value.clear();this.rf=new G;this.ne=new G;this.Ls=new H;this.Gs=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.rf.count+" edges: "+this.ne.count;if(1<a){for(var c=this.rf.iterator;c.next();)b+="\n    "+c.value.toString(a-1);for(c=this.ne.iterator;c.next();)b+="\n    "+c.value.toString(a-1)}return b};Pp.prototype.createVertex=function(){return new cq(this)};Pp.prototype.createEdge=function(){return new dq(this)};
Pp.prototype.ng=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 W)return!a.isLinkLabel;if(a instanceof T){var b=a.fromNode;if(null===b||b.isLinkLabel)return!1;a=a.toNode;return null===a||a.isLinkLabel?!1:!0}return!1});for(a=a.iterator;a.next();){var d=a.value;if(d instanceof W&&(!b||d.isTopLevel)&&d.canLayout()&&c(d))if(d instanceof U&&null===d.layout)this.ng(d.memberParts,!1);else if(null===this.Ji(d)){var e=this.createVertex();e.node=
d;this.og(e)}}for(a.reset();a.next();)if(d=a.value,d instanceof T&&(!b||d.isTopLevel)&&d.canLayout()&&c(d)&&null===this.Vp(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.gk(f,e,d))}}};Pp.prototype.findGroupVertex=function(a){if(null===a)return null;var b=a.findVisibleNode();if(null===b)return null;a=this.Ji(b);if(null!==a)return a;for(b=b.containingGroup;null!==b;){a=this.Ji(b);if(null!==a)return a;b=b.containingGroup}return null};
t=Pp.prototype;t.og=function(a){if(null!==a){this.rf.add(a);var b=a.node;null!==b&&this.Ls.add(b,a);a.network=this}};t.Pj=function(a){if(null===a)return null;var b=this.Ji(a);null===b&&(b=this.createVertex(),b.node=a,this.og(b));return b};t.Ru=function(a){if(null!==a&&eq(this,a)){for(var b=a.sd,c=b.count-1;0<=c;c--){var d=b.J(c);this.Xj(d)}b=a.Fd;for(a=b.count-1;0<=a;a--)c=b.J(a),this.Xj(c)}};
function eq(a,b){if(null===b)return!1;var c=a.rf.remove(b);c&&(b=b.node,null!==b&&a.Ls.remove(b));return c}t.wz=function(a){null!==a&&(a=this.Ji(a),null!==a&&this.Ru(a))};t.Ji=function(a){return null===a?null:this.Ls.H(a)};t.Tl=function(a){if(null!==a){fq(this,a);var b=a.toVertex;null!==b&&b.Du(a);b=a.fromVertex;null!==b&&b.Bu(a)}};function fq(a,b){if(null!==b){a.ne.add(b);var c=b.link;null!==c&&null===a.Vp(c)&&a.Gs.add(c,b);b.network=a}}
t.$y=function(a){if(null===a)return null;var b=a.fromNode,c=a.toNode,d=this.Vp(a);null===d?(d=this.createEdge(),d.link=a,null!==b&&(d.fromVertex=this.Pj(b)),null!==c&&(d.toVertex=this.Pj(c)),this.Tl(d)):(null!==b?d.fromVertex=this.Pj(b):d.fromVertex=null,null!==c?d.toVertex=this.Pj(c):d.toVertex=null);return d};t.Xj=function(a){if(null!==a){var b=a.toVertex;null!==b&&b.Qu(a);b=a.fromVertex;null!==b&&b.Pu(a);gq(this,a)}};
function gq(a,b){null!==b&&a.ne.remove(b)&&(b=b.link,null!==b&&a.Gs.remove(b))}t.vz=function(a){null!==a&&(a=this.Vp(a),null!==a&&this.Xj(a))};t.Vp=function(a){return null===a?null:this.Gs.H(a)};t.gk=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.Tl(d);return d}return null};t.sm=function(a){if(null!==a){var b=a.fromVertex,c=a.toVertex;null!==b&&null!==c&&(b.Pu(a),c.Qu(a),a.sm(),b.Du(a),c.Bu(a))}};
t.Tp=function(){for(var a=Ea(),b=this.ne.iterator;b.next();){var c=b.value;c.fromVertex===c.toVertex&&a.push(c)}b=a.length;for(c=0;c<b;c++)this.Xj(a[c]);Ia(a)};Pp.prototype.deleteArtificialVertexes=function(){for(var a=Ea(),b=this.rf.iterator;b.next();){var c=b.value;null===c.node&&null===c.data&&a.push(c)}c=a.length;for(b=0;b<c;b++)this.Ru(a[b]);b=Ea();for(c=this.ne.iterator;c.next();){var d=c.value;null===d.link&&null===d.data&&b.push(d)}c=b.length;for(d=0;d<c;d++)this.Xj(b[d]);Ia(a);Ia(b)};
function hq(a){for(var b=Ea(),c=a.ne.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.Xj(b[d]);Ia(b)}
Pp.prototype.Ey=function(a){void 0===a&&(a=!0);a&&(this.deleteArtificialVertexes(),hq(this),this.Tp());a=new E;for(var b=!0;b;){b=!1;for(var c=this.rf.iterator;c.next();){var d=c.value;if(0<d.sd.count||0<d.Fd.count){b=this.layout.createNetwork();a.add(b);iq(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 iq(a,b,c){if(null!==c&&c.network!==b){eq(a,c);b.og(c);for(var d=c.sourceEdges;d.next();){var e=d.value;e.network!==b&&(gq(a,e),fq(b,e),iq(a,b,e.fromVertex))}for(d=c.destinationEdges;d.next();)c=d.value,c.network!==b&&(gq(a,c),fq(b,c),iq(a,b,c.toVertex))}}Pp.prototype.Cz=function(){for(var a=new G,b=this.rf.iterator;b.next();)a.add(b.value.node);for(b=this.ne.iterator;b.next();)a.add(b.value.link);return a};
na.Object.defineProperties(Pp.prototype,{layout:{get:function(){return this.vc},set:function(a){null!==a&&(this.vc=a)}},vertexes:{get:function(){return this.rf}},edges:{get:function(){return this.ne}}});Pp.prototype.findAllParts=Pp.prototype.Cz;Pp.prototype.splitIntoSubNetworks=Pp.prototype.Ey;Pp.prototype.deleteSelfEdges=Pp.prototype.Tp;Pp.prototype.reverseEdge=Pp.prototype.sm;Pp.prototype.linkVertexes=Pp.prototype.gk;
Pp.prototype.findEdge=Pp.prototype.Vp;Pp.prototype.deleteLink=Pp.prototype.vz;Pp.prototype.deleteEdge=Pp.prototype.Xj;Pp.prototype.addLink=Pp.prototype.$y;Pp.prototype.addEdge=Pp.prototype.Tl;Pp.prototype.findVertex=Pp.prototype.Ji;Pp.prototype.deleteNode=Pp.prototype.wz;Pp.prototype.deleteVertex=Pp.prototype.Ru;Pp.prototype.addNode=Pp.prototype.Pj;Pp.prototype.addVertex=Pp.prototype.og;Pp.prototype.addParts=Pp.prototype.ng;Pp.className="LayoutNetwork";
function cq(a){Va(this);this.Rb=a;this.j=(new N(0,0,10,10)).freeze();this.o=(new K(5,5)).freeze();this.mi=this.jb=null;this.sd=new E;this.Fd=new E}
cq.prototype.serializeVertexProperties=function(a){a.id=ib(this);a.key=this.node?this.node.key:this.data?this.data.di:void 0;void 0===a.key&&(a.key=null);a.x=this.bounds.x;a.y=this.bounds.y;a.YA=this.bounds.width;a.fA=this.bounds.height;a.fx=this.focus.x;a.fy=this.focus.y;var b=[];this.sd.each(function(a){b.push(ib(a))});a.By=b;var c=[];this.Fd.each(function(a){c.push(ib(a))});a.Lx=c};
cq.prototype.deserializeVertexProperties=function(a,b,c){if(null!==a){this.x=a.x;this.y=a.y;this.width=a.YA;this.height=a.fA;this.focusX=a.fx;this.focusY=a.fy;var d=this;a.By&&a.By.forEach(function(a){(a=c.get(a))&&d.sd.add(a)});a.Lx&&a.Lx.forEach(function(a){(a=c.get(a))&&d.Fd.add(a)})}};cq.prototype.clear=function(){this.mi=this.jb=null;this.sd=new E;this.Fd=new E};
cq.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutVertex#"+ib(this);if(0<a&&(b+=null!==this.node?"("+this.node.toString()+")":"",1<a)){a="";for(var c=!0,d=this.sd.iterator;d.next();){var e=d.value;c?c=!1:a+=",";a+=e.toString(0)}e="";c=!0;for(d=this.Fd.iterator;d.next();){var f=d.value;c?c=!1:e+=",";e+=f.toString(0)}b+=" sources: "+a+" destinations: "+e}return b};
cq.prototype.commit=function(){var a=this.jb;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 U)){c=N.alloc();var d=this.network.layout.Mi(a,c),e=a.locationObject.da(yc);if(d.u()&&e.u()){a.moveTo(b.x+this.focusX-(e.x-d.x),b.y+this.focusY-(e.y-d.y));N.free(c);return}N.free(c)}a.moveTo(b.x,b.y)}};cq.prototype.Du=function(a){null!==a&&(this.sd.contains(a)||this.sd.add(a))};
cq.prototype.Qu=function(a){null!==a&&this.sd.remove(a)};cq.prototype.Bu=function(a){null!==a&&(this.Fd.contains(a)||this.Fd.add(a))};cq.prototype.Pu=function(a){null!==a&&this.Fd.remove(a)};function jq(a,b){a=a.mi;b=b.mi;return a?b?(a=a.text,b=b.text,a<b?-1:a>b?1:0):1:null!==b?-1:0}
na.Object.defineProperties(cq.prototype,{sourceEdgesArrayAccess:{get:function(){return this.sd._dataArray}},destinationEdgesArrayAccess:{get:function(){return this.Fd._dataArray}},data:{get:function(){return this.jb},set:function(a){this.jb=a;if(null!==a&&a.bounds){var b=a.bounds;a=b.x;var c=b.y,d=b.width;b=b.height;this.o.h(d/2,b/2);this.j.h(a,c,d,b)}}},node:{get:function(){return this.mi},
set:function(a){if(this.mi!==a){this.mi=a;a.Ta();var b=this.network.layout,c=N.alloc(),d=b.Mi(a,c);b=d.x;var e=d.y,f=d.width;d=d.height;isNaN(b)&&(b=0);isNaN(e)&&(e=0);this.j.h(b,e,f,d);N.free(c);if(!(a instanceof U)&&(a=a.locationObject.da(yc),a.u())){this.o.h(a.x-b,a.y-e);return}this.o.h(f/2,d/2)}}},bounds:{get:function(){return this.j},set:function(a){this.j.A(a)||this.j.assign(a)}},focus:{get:function(){return this.o},set:function(a){this.o.A(a)||
this.o.assign(a)}},centerX:{get:function(){return this.j.x+this.o.x},set:function(a){var b=this.j;b.x+this.o.x!==a&&(b.ea(),b.x=a-this.o.x,b.freeze())}},centerY:{get:function(){return this.j.y+this.o.y},set:function(a){var b=this.j;b.y+this.o.y!==a&&(b.ea(),b.y=a-this.o.y,b.freeze())}},focusX:{get:function(){return this.o.x},set:function(a){var b=this.o;b.x!==a&&(b.ea(),b.x=a,b.freeze())}},focusY:{
get:function(){return this.o.y},set:function(a){var b=this.o;b.y!==a&&(b.ea(),b.y=a,b.freeze())}},x:{get:function(){return this.j.x},set:function(a){var b=this.j;b.x!==a&&(b.ea(),b.x=a,b.freeze())}},y:{get:function(){return this.j.y},set:function(a){var b=this.j;b.y!==a&&(b.ea(),b.y=a,b.freeze())}},width:{get:function(){return this.j.width},set:function(a){var b=this.j;b.width!==a&&(b.ea(),b.width=
a,b.freeze())}},height:{get:function(){return this.j.height},set:function(a){var b=this.j;b.height!==a&&(b.ea(),b.height=a,b.freeze())}},network:{get:function(){return this.Rb},set:function(a){this.Rb=a}},sourceVertexes:{get:function(){for(var a=new G,b=this.sourceEdges;b.next();)a.add(b.value.fromVertex);return a.iterator}},destinationVertexes:{get:function(){for(var a=new G,b=
this.destinationEdges;b.next();)a.add(b.value.toVertex);return a.iterator}},vertexes:{get:function(){for(var a=new G,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.sd.iterator}},destinationEdges:{get:function(){return this.Fd.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.sd.count+this.Fd.count}}});cq.prototype.deleteDestinationEdge=cq.prototype.Pu;cq.prototype.addDestinationEdge=cq.prototype.Bu;cq.prototype.deleteSourceEdge=cq.prototype.Qu;cq.prototype.addSourceEdge=cq.prototype.Du;cq.className="LayoutVertex";cq.standardComparer=jq;
cq.smartComparer=function(a,b){if(null!==a){if(null!==b){a=a.mi;var c=b.mi;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 dq(a){Va(this);this.Qb=a;this.cd=this.Vc=this.ll=this.jb=null}dq.prototype.clear=function(){this.cd=this.Vc=this.ll=this.jb=null};dq.prototype.serializeEdgeProperties=function(a){a.id=ib(this);a.key=this.link?this.link.key:this.data?this.data.di:void 0;void 0===a.key&&(a.key=null);a.from=this.fromVertex?ib(this.fromVertex):null;a.TA=this.toVertex?ib(this.toVertex):null};
dq.prototype.deserializeEdgeProperties=function(a,b){if(null!==a){var c=b.get(a.from);c&&(this.fromVertex=c);if(a=b.get(a.TA))this.toVertex=a}};dq.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutEdge#"+ib(this);0<a&&(b+=null!==this.ll?"("+this.ll.toString()+")":"",1<a&&(b+=" "+(this.Vc?this.Vc.toString():"null")+" --\x3e "+(this.cd?this.cd.toString():"null")));return b};dq.prototype.sm=function(){var a=this.Vc;this.Vc=this.cd;this.cd=a};dq.prototype.commit=function(){};
dq.prototype.Zx=function(a){return this.cd===a?this.Vc:this.Vc===a?this.cd:null};
na.Object.defineProperties(dq.prototype,{network:{get:function(){return this.Qb},set:function(a){this.Qb=a}},data:{get:function(){return this.jb},set:function(a){this.jb!==a&&(this.jb=a)}},link:{get:function(){return this.ll},set:function(a){this.ll!==a&&(this.ll=a)}},fromVertex:{get:function(){return this.Vc},set:function(a){this.Vc!==a&&(this.Vc=a)}},toVertex:{
get:function(){return this.cd},set:function(a){this.cd!==a&&(this.cd=a)}}});dq.prototype.getOtherVertex=dq.prototype.Zx;dq.className="LayoutEdge";function Gk(a){ni.call(this);this.isViewportSized=!0;this.Jp=this.Kp=NaN;this.zg=(new Gb(NaN,NaN)).freeze();this.jf=(new Gb(10,10)).freeze();this.xb=kq;this.Hb=lq;this.$c=mq;this.Tc=nq;a&&Object.assign(this,a)}ma(Gk,ni);
Gk.prototype.cloneProtected=function(a){ni.prototype.cloneProtected.call(this,a);a.Kp=this.Kp;a.Jp=this.Jp;a.zg.assign(this.zg);a.jf.assign(this.jf);a.xb=this.xb;a.Hb=this.Hb;a.$c=this.$c;a.Tc=this.Tc};Gk.prototype.gb=function(a){a.classType===Gk?a===mq||a===oq||a===pq||a===qq?this.sorting=a:a===lq||a===rq?this.arrangement=a:a===kq||a===sq?this.alignment=a:B("Unknown enum value: "+a):ni.prototype.gb.call(this,a)};
Gk.prototype.doLayout=function(a){this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);var b=this.Fx(a);a=this.diagram;for(var c=b.copy().iterator;c.next();){var d=c.value;if(!d.Hh()||null===d.fromNode&&null===d.toNode){if(d.Ta(),d instanceof U)for(d=d.memberParts;d.next();)b.remove(d.value)}else b.remove(d)}var e=b.ya();if(0!==e.length){switch(this.sorting){case qq:e.reverse();break;case mq:e.sort(this.comparer);break;case oq: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.xa("Layout");d=[];switch(this.alignment){case sq:var h=b,k=c,l=N.alloc(),m=Math.max(this.cellSize.width,1);if(!isFinite(m))for(var n=m=0;n<e.length;n++){var p=this.Mi(e[n],l);m=Math.max(m,p.width)}m=Math.max(m+h,1);n=Math.max(this.cellSize.height,
1);if(!isFinite(n))for(p=n=0;p<e.length;p++){var r=this.Mi(e[p],l);n=Math.max(n,r.height)}n=Math.max(n+k,1);p=this.arrangement;for(var q=r=this.arrangementOrigin.x,u=this.arrangementOrigin.y,w=0,v=0,y=0;y<e.length;y++){var z=e[y],A=this.Mi(z,l),C=Math.ceil((A.width+h)/m)*m,F=Math.ceil((A.height+k)/n)*n;switch(p){case rq:var R=Math.abs(q-A.width);break;default:R=q+A.width}if(0<f&&w>f-1||0<g&&0<w&&R-r>g)d.push(new N(0,u,g+h,v)),w=0,q=r,u+=v,v=0;v=Math.max(v,F);switch(p){case rq:A=-A.width;break;default:A=
0}z.moveTo(q+A,u);switch(p){case rq:q-=C;break;default:q+=C}w++}d.push(new N(0,u,g+h,v));N.free(l);break;case kq:k=g;m=f;n=b;p=c;g=N.alloc();r=Math.max(this.cellSize.width,1);f=u=l=0;h=K.alloc();for(q=0;q<e.length;q++)v=e[q],w=this.Mi(v,g),v=ro(v,v.locationObject,v.locationSpot,h),l=Math.max(l,v.x),u=Math.max(u,w.width-v.x),f=Math.max(f,v.y);q=this.arrangement;switch(q){case rq:l+=n;break;default:u+=n}r=isFinite(r)?Math.max(r+n,1):Math.max(l+u,1);var J=v=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;F=!0;w=K.alloc();for(R=0;R<e.length;R++){var S=e[R],L=this.Mi(S,g),I=ro(S,S.locationObject,S.locationSpot,h);if(0<u)switch(q){case rq:J=(J-v-(L.width-I.x))/r;J=M.aa(Math.round(J),J)?Math.round(J):Math.floor(J);J=J*r+v;break;default:J=(J-v+I.x)/r,J=M.aa(Math.round(J),J)?Math.round(J):Math.ceil(J),J=J*r+v}else switch(q){case rq:z=J+I.x+L.width;break;default:z=J-I.x}switch(q){case rq:var ja=-(J+I.x)+z;break;default:ja=J+L.width-I.x-z}if(0<
m&&u>m-1||0<k&&0<u&&ja>k){d.push(new N(0,F?y-f:y,k+n,A+f+p));for(J=0;J<u&&R!==u;J++){ja=e[R-u+J];var ca=ro(ja,ja.locationObject,ja.locationSpot,w);ja.moveTo(ja.position.x,ja.position.y+f-ca.y)}A+=p;y=F?y+A:y+(A+f);u=A=f=0;J=v;F=!1}J===v&&(l=q===rq?Math.max(l,L.width-I.x):Math.min(l,-I.x));f=Math.max(f,I.y);A=Math.max(A,L.height-I.y);isFinite(C)&&(A=Math.max(A,Math.max(L.height,C)-I.y));F?S.moveTo(J-I.x,y-I.y):S.moveTo(J-I.x,y);switch(q){case rq:J-=I.x+n;break;default:J+=L.width-I.x+n}u++}d.push(new N(0,
y,k+n,(F?A:A+f)+p));if(e.length!==u)for(k=0;k<u;k++)m=e[e.length-u+k],n=ro(m,m.locationObject,m.locationSpot,h),m.moveTo(m.position.x,m.position.y+f-n.y);K.free(h);K.free(w);if(q===rq)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===rq?this.commitLayers(d,new K(e+b/2-(f+e),g-c/2)):this.commitLayers(d,new K(e-
b/2,g-c/2));null!==a&&a.Xa("Layout");this.isValidLayout=!0}};Gk.prototype.commitLayers=function(){};function nq(a,b){a=a.text;b=b.text;return a<b?-1:a>b?1:0}
na.Object.defineProperties(Gk.prototype,{wrappingWidth:{get:function(){return this.Kp},set:function(a){this.Kp!==a&&(0<a||isNaN(a))&&(this.Kp=a,this.isViewportSized=isNaN(a),this.B())}},wrappingColumn:{get:function(){return this.Jp},set:function(a){this.Jp!==a&&(0<a||isNaN(a))&&(this.Jp=a,this.B())}},cellSize:{get:function(){return this.zg},set:function(a){this.zg.A(a)||(this.zg.assign(a),this.B())}},spacing:{
get:function(){return this.jf},set:function(a){this.jf.A(a)||(this.jf.assign(a),this.B())}},alignment:{get:function(){return this.xb},set:function(a){this.xb===a||a!==kq&&a!==sq||(this.xb=a,this.B())}},arrangement:{get:function(){return this.Hb},set:function(a){this.Hb===a||a!==lq&&a!==rq||(this.Hb=a,this.B())}},sorting:{get:function(){return this.$c},set:function(a){this.$c===a||a!==pq&&a!==qq&&
a!==mq&&a!==oq||(this.$c=a,this.B())}},comparer:{get:function(){return this.Tc},set:function(a){this.Tc!==a&&(this.Tc=a,this.B())}}});var sq=new D(Gk,"Position",0),kq=new D(Gk,"Location",1),lq=new D(Gk,"LeftToRight",2),rq=new D(Gk,"RightToLeft",3),pq=new D(Gk,"Forward",4),qq=new D(Gk,"Reverse",5),mq=new D(Gk,"Ascending",6),oq=new D(Gk,"Descending",7);Gk.className="GridLayout";Gk.standardComparer=nq;
Gk.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};Gk.Position=sq;Gk.Location=kq;Gk.LeftToRight=lq;Gk.RightToLeft=rq;Gk.Forward=pq;Gk.Reverse=qq;Gk.Ascending=mq;Gk.Descending=oq;function ji(){this.Do=new G;this.ko=new G;this.Ha=new G;this.Ve=new H;this.Ue=new H;this.rj=new H;this.D=null;this.Bq=!1}t=ji.prototype;t.clear=function(){this.Do.clear();this.ko.clear();this.Ha.clear();this.Ve.clear();this.Ue.clear();this.rj.clear()};t.Ne=function(a){this.D=a};
t.Ni=function(a){if(a instanceof W){if(this.Do.add(a),a instanceof U){var b=a.containingGroup;null===b?this.D.wi.add(a):b.rl.add(a);b=a.layout;null!==b&&(b.diagram=this.D)}}else a instanceof T?this.ko.add(a):a instanceof ze||this.Ha.add(a);b=a.data;null===b||a instanceof ze||(a instanceof T?this.Ue.add(b,a):this.Ve.add(b,a))};
t.rc=function(a){a.Qj();if(a instanceof W){if(this.Do.remove(a),a instanceof U){var b=a.containingGroup;null===b?this.D.wi.remove(a):b.rl.remove(a);b=a.layout;null!==b&&(b.diagram=null)}}else a instanceof T?this.ko.remove(a):a instanceof ze||this.Ha.remove(a);b=a.data;null===b||a instanceof ze||(a instanceof T?this.Ue.remove(b):this.Ve.remove(b))};
t.Ld=function(){for(var a=this.D.nodeTemplateMap.iterator;a.next();){var b=a.value,c=a.key;(!b.Nc()||b instanceof U)&&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.D.groupTemplateMap.iterator;a.next();)b=a.value,c=a.key,b instanceof U||B('Invalid group template in Diagram.groupTemplateMap: template for "'+c+'" must be a Group, not a normal Node or Link: '+b);for(a=this.D.linkTemplateMap.iterator;a.next();)b=
a.value,c=a.key,b instanceof T||B('Invalid link template in Diagram.linkTemplateMap: template for "'+c+'" must be a Link, not a normal Node or simple Part: '+b);a=Ea();for(b=this.D.selection.iterator;b.next();)(c=b.value.data)&&a.push(c);b=Ea();for(c=this.D.highlighteds.iterator;c.next();){var d=c.value.data;d&&b.push(d)}c=Ea();for(d=this.nodes.iterator;d.next();){var e=d.value;null!==e.data&&(c.push(e.data),c.push(e.location))}for(d=this.links.iterator;d.next();)e=d.value,null!==e.data&&(c.push(e.data),
c.push(e.location));for(d=this.parts.iterator;d.next();)e=d.value,null!==e.data&&(c.push(e.data),c.push(e.location));this.removeAllModeledParts();this.addAllModeledParts();for(d=0;d<a.length;d++)e=this.Bc(a[d]),null!==e&&(e.isSelected=!0);for(d=0;d<b.length;d++)e=this.Bc(b[d]),null!==e&&(e.isHighlighted=!0);for(d=0;d<c.length;d+=2)e=this.Bc(c[d]),null!==e&&(e.location=c[d+1]);Ia(a);Ia(b);Ia(c)};ji.prototype.addAllModeledParts=function(){this.addModeledParts(this.diagram.model.nodeDataArray)};
ji.prototype.addModeledParts=function(a,b){var c=this,d=this.diagram.model;a.forEach(function(a){d.cb(a)&&tq(c,a,!1)});a.forEach(function(a){d.cb(a)&&c.resolveReferencesForData(a)});!1!==b&&Uj(this.diagram,!1)};
function tq(a,b,c){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.Ve.contains(b)){void 0===c&&(c=!0);a:{if(void 0!==b&&null!==b&&!a.D.undoManager.isUndoingRedoing&&!a.Ve.contains(b)){var d=a.Zp(b);var e=Do(a,b,d);if(null!==e&&(og(e),e=e.copy(),null!==e)){var f=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.Nf=d;e.jb=b;a.Bq&&(e.Ug="Tool");a.diagram.add(e);e.jb=null;e.data=b;a.diagram.skipsModelSourceBindings=f;d=e;break a}}d=null}null!==d&&c&&a.resolveReferencesForData(b)}}
ji.prototype.insertLink=function(){return null};ji.prototype.resolveReferencesForData=function(){};ji.prototype.Zp=function(a){return this.D.model.Zp(a)};
function Do(a,b,c){a=a.D;var d=a.model;d.ek()&&d.mv(b)?(b=a.groupTemplateMap.H(c),null===b&&(b=a.groupTemplateMap.H(""),null===b&&(uq||(uq=!0,ya('No Group template found for category "'+c+'"'),ya("  Using default group template")),b=a.Jw))):(b=a.nodeTemplateMap.H(c),null===b&&(b=a.nodeTemplateMap.H(""),null===b&&(vq||(vq=!0,ya('No Node template found for category "'+c+'"'),ya("  Using default node template")),b=a.Lw)));return b}ji.prototype.getLinkCategoryForData=function(){return""};
ji.prototype.setLinkCategoryForData=function(){};ji.prototype.setFromNodeForLink=function(){};ji.prototype.setToNodeForLink=function(){};ji.prototype.findLinkTemplateForCategory=function(a){var b=this.D.linkTemplateMap.H(a);null===b&&(b=this.D.linkTemplateMap.H(""),null===b&&(wq||(wq=!0,ya('No Link template found for category "'+a+'"'),ya("  Using default link template")),b=this.D.Kw));return b};ji.prototype.removeAllModeledParts=function(){this.Qs(this.diagram.model.nodeDataArray)};
ji.prototype.Qs=function(a){var b=this;a.forEach(function(a){b.qq(a)})};ji.prototype.qq=function(a){a=this.Bc(a);null!==a&&(Bj(this.diagram,a,!1),this.unresolveReferencesForPart(a))};ji.prototype.unresolveReferencesForPart=function(){};ji.prototype.removeDataForLink=function(){};ji.prototype.findPartForKey=function(a){if(null===a||void 0===a)return null;a=this.D.model.Yb(a);return null!==a?this.Ve.H(a):null};
ji.prototype.Eb=function(a){if(null===a||void 0===a)return null;a=this.D.model.Yb(a);if(null===a)return null;a=this.Ve.H(a);return a instanceof W?a:null};ji.prototype.findLinkForKey=function(){return null};t=ji.prototype;t.Bc=function(a){if(null===a)return null;var b=this.Ve.H(a);return null!==b?b:b=this.Ue.H(a)};t.Gi=function(a){if(null===a)return null;a=this.Ve.H(a);return a instanceof W?a:null};t.Ac=function(a){return null===a?null:this.Ue.H(a)};
t.rs=function(a){for(var b=0;b<arguments.length;++b);b=new G;for(var c=this.Do.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)&&xq(this,e,g)){b.add(d);break}}}return b.iterator};t.qs=function(a){for(var b=0;b<arguments.length;++b);b=new G;for(var c=this.ko.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)&&xq(this,e,g)){b.add(d);break}}}return b.iterator};
function xq(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&&!yq(a,e[g],h))return!1}}else if(!yq(a,e,f))return!1}return!0}function yq(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(!xq(a,b,c))return!1}else if(b!==c)return!1;return!0}
ji.prototype.doModelChanged=function(a){if(this.D){var b=this.D;if(a.model===b.model){var c=a.change;b.doModelChanged(a);if(b.Z){b.Z=!1;try{var d=a.modelChange;if(""!==d)if(c===ge){if("nodeCategory"===d){var e=this.Bc(a.object),f=a.newValue;null!==e&&"string"===typeof f&&(e.category=f)}else"nodeDataArray"===d&&(this.Qs(a.oldValue),this.addModeledParts(a.newValue));b.isModified=!0}else if(c===pe){var g=a.newValue;"nodeDataArray"===d&&za(g)&&tq(this,g);b.isModified=!0}else if(c===qe){var h=a.oldValue;
"nodeDataArray"===d&&za(h)&&this.qq(h);b.isModified=!0}else c===oe&&("SourceChanged"===d?null!==a.object?this.updateDataBindings(a.object,a.propertyName):(this.zq(),this.updateAllTargetBindings()):"ModelDisplaced"===d&&this.Ld());else if(c===ge){var k=a.propertyName,l=a.object;if(l===b.model){if("nodeKeyProperty"===k||"nodeCategoryProperty"===k)b.undoManager.isUndoingRedoing||this.Ld()}else this.updateDataBindings(l,k);b.isModified=!0}else if(c===pe||c===qe){var m=a.change===pe,n=m?a.newParam:a.oldParam,
p=m?a.newValue:a.oldValue,r=this.rj.H(a.object);if(Array.isArray(r))for(a=0;a<r.length;a++){var q=r[a];if(m)cn(q,p,n,!0);else if(!(0>n)){var u=n+Wm(q);q.rc(u,!0);fn(q,u,n)}}b.isModified=!0}}finally{b.Z=!0}}}}};ji.prototype.updateAllTargetBindings=function(a){void 0===a&&(a="");for(var b=this.parts.iterator;b.next();)b.value.Fa(a);for(b=this.nodes.iterator;b.next();)b.value.Fa(a);for(b=this.links.iterator;b.next();)b.value.Fa(a)};
ji.prototype.zq=function(){for(var a=this.D.model,b=new G,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){zq(a,b,!1)});for(d=0;d<c.length;d++){var f=c[d];null===this.Bc(f)&&Aq(a,f,!1)}this.refreshDataBoundLinks();for(c=this.parts.iterator;c.next();)c.value.updateRelationshipsFromData();for(c=this.nodes.iterator;c.next();)c.value.updateRelationshipsFromData();
for(c=this.links.iterator;c.next();)c.value.updateRelationshipsFromData()};ji.prototype.refreshDataBoundLinks=function(){};ji.prototype.updateRelationshipsFromData=function(){};
ji.prototype.updateDataBindings=function(a,b){if("string"===typeof b){var c=this.Bc(a);if(null!==c)c.Fa(b);else{c=null;for(var d=this.rj.iterator;d.next();){for(var e=d.value,f=0;f<e.length;f++){var g=e[f].Rx(a);null!==g&&(null===c&&(c=Ea()),c.push(g))}if(null!==c)break}if(null!==c){for(d=0;d<c.length;d++)c[d].Fa(b);Ia(c)}}a===this.diagram.model.modelData&&this.updateAllTargetBindings(b)}};
function xj(a,b){var c=b.ci;if(Aa(c)){var d=a.rj.H(c);if(null===d)d=[],d.push(b),a.rj.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}function Aj(a,b,c){vj(b,function(a){a=a.U.l;for(var b=a.length,d=0;d<b;d++)Sj(c,a[d])});var d=b.ci;if(Aa(d)){var e=a.rj.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.rj.remove(d);break}}}
ji.prototype.Vj=function(a,b,c){void 0===c&&(c=!1);var d=new H;if(Aa(a))for(var e=0;e<a.length;e++)Bq(this,a[e],b,d,c);else for(a=a.iterator;a.next();)Bq(this,a.value,b,d,c);if(null!==b){c=b.model;a=b.toolManager.findTool("Dragging");a=null!==a?a.dragOptions.dragsLink:b.pn.dragsLink;e=new G;for(var f=new H,g=d.iterator;g.next();){var h=g.value;if(h instanceof T)a||null!==h.fromNode&&null!==h.toNode||e.add(h);else if(h instanceof W&&null!==h.data&&c.fm()){var k=h;h=g.key;var l=h.rg();null!==l&&(l=
d.H(l),null!==l?(c.ge(k.data,c.pa(l.data)),k=b.Ac(k.data),h=h.Ii(),null!==h&&null!==k&&f.add(h,k)):c.ge(k.data,void 0))}}0<e.count&&b.Rs(e,!1);if(0<f.count)for(c=f.iterator;c.next();)d.add(c.key,c.value)}if(null!==b&&null!==this.D&&(b=b.model,c=b.afterCopyFunction,null!==c)){var m=new H;d.each(function(a){null!==a.key.data&&m.add(a.key.data,a.value.data)});c(m,b,this.D.model)}for(b=d.iterator;b.next();)b.value.Fa();return d};
function Bq(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 V))return null;f.isSelected=!1;f.isHighlighted=!1;d.add(b,f);if(b instanceof W){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 U&&f instanceof U)for(b=b.memberParts;b.next();)g=Bq(a,b.value,c,d,e),g instanceof T||null===g||(g.containingGroup=
f)}else if(b instanceof T&&f instanceof T)for(g=b.fromNode,null!==g&&(g=d.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=Bq(a,b.value,c,d,e),null!==g&&g instanceof W&&(g.labeledLink=f);return f}
ji.prototype.copyPartData=function(a,b){var c=null,d=a.data;if(null!==d&&null!==b){var e=b.model;a instanceof T||(d=e.copyNodeData(d),za(d)&&(e.sf(d),c=b.Bc(d)))}else og(a),c=a.copy(),null!==c&&(e=this.D,null!==b?b.add(c):null!==d&&null!==e&&null!==e.commandHandler&&e.commandHandler.copiesClipboardData&&(b=e.model,e=null,c instanceof T||(e=b.copyNodeData(d)),za(e)&&(c.data=e)));return c};
na.Object.defineProperties(ji.prototype,{nodes:{get:function(){return this.Do}},links:{get:function(){return this.ko}},parts:{get:function(){return this.Ha}},diagram:{get:function(){return this.D}},addsToTemporaryLayer:{get:function(){return this.Bq},set:function(a){this.Bq=a}}});ji.prototype.updateAllRelationshipsFromData=ji.prototype.zq;
ji.prototype.findLinksByExample=ji.prototype.qs;ji.prototype.findNodesByExample=ji.prototype.rs;ji.prototype.findLinkForData=ji.prototype.Ac;ji.prototype.findNodeForData=ji.prototype.Gi;ji.prototype.findPartForData=ji.prototype.Bc;ji.prototype.findNodeForKey=ji.prototype.Eb;ji.prototype.removeModeledPart=ji.prototype.qq;ji.prototype.removeModeledParts=ji.prototype.Qs;ji.prototype.rebuildParts=ji.prototype.Ld;var vq=!1,uq=!1,wq=!1;ji.className="PartManager";
function Cq(a){ji.apply(this,arguments)}ma(Cq,ji);Cq.prototype.addAllModeledParts=function(){var a=this.diagram.model;this.addModeledParts(a.nodeDataArray);Dq(this,a.linkDataArray)};Cq.prototype.addModeledParts=function(a){ji.prototype.addModeledParts.call(this,a,!1);for(a=this.links.iterator;a.next();)Eo(a.value);Uj(this.diagram,!1)};function Dq(a,b){b.forEach(function(b){Eq(a,b)});Uj(a.diagram,!1)}
function Eq(a,b){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.Ue.contains(b)){var c=a.getLinkCategoryForData(b),d=a.findLinkTemplateForCategory(c);if(null!==d){og(d);var e=d.copy();if(null!==e){d=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.Nf=c;e.jb=b;c=a.diagram.model;var f=Fq(c,b,!0);""!==f&&(e.fromPortId=f);f=Gq(c,b,!0);void 0!==f&&(f=a.Eb(f),f instanceof W&&(e.fromNode=f));f=Fq(c,b,!1);""!==f&&(e.toPortId=f);f=Gq(c,b,!1);void 0!==f&&(f=a.Eb(f),
f instanceof W&&(e.toNode=f));c=c.Bf(b);Array.isArray(c)&&c.forEach(function(b){b=a.Eb(b);null!==b&&(b.labeledLink=e)});a.Bq&&(e.Ug="Tool");a.diagram.add(e);e.jb=null;e.data=b;a.diagram.skipsModelSourceBindings=d}}}}Cq.prototype.removeAllModeledParts=function(){var a=this.diagram.model;Hq(this,a.linkDataArray);this.Qs(a.nodeDataArray)};function Hq(a,b){b.forEach(function(b){a.qq(b)})}Cq.prototype.getLinkCategoryForData=function(a){return this.diagram.model.us(a)};
Cq.prototype.setLinkCategoryForData=function(a,b){return this.diagram.model.tq(a,b)};Cq.prototype.setFromNodeForLink=function(a,b){var c=this.diagram.model;c.Ov(a.data,c.pa(null!==b?b.data:null))};Cq.prototype.setToNodeForLink=function(a,b){var c=this.diagram.model;c.Sv(a.data,c.pa(null!==b?b.data:null))};Cq.prototype.removeDataForLink=function(a){this.diagram.model.nm(a.data)};
Cq.prototype.findPartForKey=function(a){var b=ji.prototype.findPartForKey.call(this,a);return null===b&&(a=this.diagram.model.Dh(a),null!==a)?this.Ue.H(a):b};Cq.prototype.findLinkForKey=function(a){if(null===a||void 0===a)return null;a=this.diagram.model.Dh(a);return null!==a?this.Ue.H(a):null};
Cq.prototype.doModelChanged=function(a){var b=this;ji.prototype.doModelChanged.call(this,a);if(this.diagram){var c=this.diagram;if(a.model===c.model){var d=a.change;if(c.Z){c.Z=!1;try{var e=a.modelChange;if(""!==e)if(d===ge){if("linkFromKey"===e){var f=this.Ac(a.object);if(null!==f){var g=this.Eb(a.newValue);f.fromNode=g}}else if("linkToKey"===e){var h=this.Ac(a.object);if(null!==h){var k=this.Eb(a.newValue);h.toNode=k}}else if("linkFromPortId"===e){var l=this.Ac(a.object);if(null!==l){var m=a.newValue;
"string"===typeof m&&(l.fromPortId=m)}}else if("linkToPortId"===e){var n=this.Ac(a.object);if(null!==n){var p=a.newValue;"string"===typeof p&&(n.toPortId=p)}}else if("nodeGroupKey"===e){var r=this.Bc(a.object);if(null!==r){var q=a.newValue;if(void 0!==q){var u=this.Eb(q);u instanceof U?r.containingGroup=u:r.containingGroup=null}else r.containingGroup=null}}else if("linkLabelKeys"===e){var w=this.Ac(a.object);if(null!==w){var v=a.oldValue,y=a.newValue;Array.isArray(v)&&v.forEach(function(a){0<=y.indexOf(a)||
(a=b.Eb(a),null!==a&&(a.labeledLink=null))});Array.isArray(y)&&y.forEach(function(a){a=b.Eb(a);null!==a&&(a.labeledLink=w)})}}else if("linkCategory"===e){var z=this.Ac(a.object),A=a.newValue;null!==z&&"string"===typeof A&&(z.category=A)}else"linkDataArray"===e&&(Hq(this,a.oldValue),Dq(this,a.newValue));c.isModified=!0}else if(d===pe){var C=a.newValue;if("linkDataArray"===e&&"object"===typeof C&&null!==C)Eq(this,C);else if("linkLabelKeys"===e&&Iq(C)){var F=this.Ac(a.object),R=this.Eb(C);null!==F&&
null!==R&&(R.labeledLink=F)}c.isModified=!0}else{if(d===qe){var J=a.oldValue;if("linkDataArray"===e&&"object"===typeof J&&null!==J)this.qq(J);else if("linkLabelKeys"===e&&Iq(J)){var S=this.Eb(J);null!==S&&(S.labeledLink=null)}c.isModified=!0}}else if(d===ge){var L=a.propertyName;a.object!==c.model||"linkFromKeyProperty"!==L&&"linkToKeyProperty"!==L&&"linkFromPortIdProperty"!==L&&"linkToPortIdProperty"!==L&&"linkLabelKeysProperty"!==L&&"nodeIsGroupProperty"!==L&&"nodeGroupKeyProperty"!==L&&"linkCategoryProperty"!==
L||c.undoManager.isUndoingRedoing||this.Ld();c.isModified=!0}}finally{c.Z=!0}}}}};Cq.prototype.refreshDataBoundLinks=function(){var a=this,b=this.diagram.model,c=new G,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){Jq(b,a,!1)});d.forEach(function(c){null===a.Ac(c)&&Kq(b,c,!1)})};
Cq.prototype.updateRelationshipsFromData=function(a){var b=a.data;if(null!==b){var c=a.diagram;if(null!==c){var d=c.model;if(a instanceof T){var e=Gq(d,b,!0);e=c.Eb(e);a.fromNode=e;e=Gq(d,b,!1);e=c.Eb(e);a.toNode=e;b=d.Bf(b);if(0<b.length||0<a.labelNodes.count){if(1===b.length&&1===a.labelNodes.count){e=b[0];var f=a.labelNodes.first();if(d.pa(f.data)===e)return}e=(new G).addAll(b);var g=new G;a.labelNodes.each(function(a){null!==a.data&&(a=d.pa(a.data),void 0!==a&&g.add(a))});b=g.copy();b.pq(e);e=
e.copy();e.pq(g);if(0<b.count||0<e.count)b.each(function(b){b=c.Eb(b);null!==b&&b.labeledLink===a&&(b.labeledLink=null)}),e.each(function(b){b=c.Eb(b);null!==b&&b.labeledLink!==a&&(b.labeledLink=a)})}}else!(a instanceof ze)&&(b=d.Eh(b),b=c.findPartForKey(b),null===b||b instanceof U)&&(a.containingGroup=b)}}};
Cq.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.pa(a);if(void 0!==c){var d=Lq(b,c),e=this.Bc(a);if(null!==d&&null!==e){d=d.iterator;for(var f={};d.next();){var g=d.value;b.cb(g)?e instanceof U&&b.Eh(g)===c&&(g=this.Bc(g),null!==g&&(g.containingGroup=e)):(f.link=this.Ac(g),null!==f.link&&e instanceof W&&(Gq(b,g,!0)===c&&(f.link.fromNode=e),Gq(b,g,!1)===c&&(f.link.toNode=e),g=b.Bf(g),Array.isArray(g)&&g.some(function(a){return function(b){return b===c?(e.labeledLink=a.link,
!0):!1}}(f))));f={link:f.link}}Mq(b,c)}a=b.Eh(a);void 0!==a&&(a=this.Eb(a),a instanceof U&&(e.containingGroup=a))}};Cq.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof W){var c=b.pa(a.data);if(void 0!==c){for(var d=a.linksConnected;d.next();)Nq(b,c,d.value.data);a.isLinkLabel&&(d=a.labeledLink,null!==d&&Nq(b,c,d.data));if(a instanceof U)for(a=a.memberParts;a.next();)d=a.value.data,b.cb(d)&&Nq(b,c,d)}}};
Cq.prototype.copyPartData=function(a,b){var c=ji.prototype.copyPartData.call(this,a,b);if(a instanceof T)if(a=a.data,null!==a&&null!==b){var d=b.model;a=d.Sp(a);"object"===typeof a&&null!==a&&(d.Bi(a),c=b.Ac(a))}else null!==c&&(b=this.diagram,null!==a&&null!==b&&null!==b.commandHandler&&b.commandHandler.copiesClipboardData&&(b=b.model.Sp(a),"object"===typeof b&&null!==b&&(c.data=b)));return c};
Cq.prototype.insertLink=function(a,b,c,d){var e=this.diagram,f=e.model,g=e.toolManager.findTool("Linking"),h="";null!==a&&(null===b&&(b=a),h=b.portId,null===h&&(h=""));b="";null!==c&&(null===d&&(d=c),b=d.portId,null===b&&(b=""));d=g.archetypeLinkData;if(d instanceof T){if(og(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 W&&(og(a),a=a.copy(),null!==a&&(a.labeledLink=f,e.add(a))),f}else if(null!==d&&(d=f.Sp(d),"object"===
typeof d&&null!==d))return null!==a&&Oq(f,d,f.pa(a.data),!0),Pq(f,d,h,!0),null!==c&&Oq(f,d,f.pa(c.data),!1),Pq(f,d,b,!1),f.Bi(d),a=g.archetypeLabelNodeData,null===a||a instanceof W||(a=f.copyNodeData(a),"object"===typeof a&&null!==a&&(f.sf(a),a=f.pa(a),void 0!==a&&f.Cu(d,a))),e.Ac(d);return null};Cq.prototype.findLinkForKey=Cq.prototype.findLinkForKey;Cq.prototype.findPartForKey=Cq.prototype.findPartForKey;Cq.prototype.removeAllModeledParts=Cq.prototype.removeAllModeledParts;
Cq.prototype.addModeledParts=Cq.prototype.addModeledParts;Cq.prototype.addAllModeledParts=Cq.prototype.addAllModeledParts;Cq.className="GraphLinksPartManager";function Qq(){ji.apply(this,arguments);this.ih=null}ma(Qq,ji);
function Rq(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||!Ef(d,e,f,null,!0))if(d=a.getLinkCategoryForData(c.data),b=a.findLinkTemplateForCategory(d),null!==b&&(og(b),b=b.copy(),null!==b)){var g=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;b.Nf=d;
b.jb=c.data;b.fromNode=e;b.toNode=f;a.diagram.add(b);b.jb=null;b.data=c.data;a.diagram.skipsModelSourceBindings=g}}}Qq.prototype.getLinkCategoryForData=function(a){return this.diagram.model.xs(a)};Qq.prototype.setLinkCategoryForData=function(a,b){this.diagram.model.Vs(a,b)};
Qq.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.ge(a.data,d.pa(b));else{var e=this.ih;this.ih=a;null!==c&&d.ge(c.data,void 0);d.ge(b,d.pa(null!==a.toNode?a.toNode.data:null));this.ih=e}};
Qq.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.ge(c.data,void 0);d.ge(b,d.pa(null!==a.fromNode?a.fromNode.data:null));this.ih=e}else d.ge(a.data,d.pa(b))};Qq.prototype.removeDataForLink=function(a){this.diagram.model.ge(a.data,void 0)};
Qq.prototype.findLinkForKey=function(a){if(null===a||void 0===a)return null;a=this.diagram.model.Yb(a);return null!==a?this.Ue.H(a):null};
Qq.prototype.doModelChanged=function(a){ji.prototype.doModelChanged.call(this,a);if(this.diagram){var b=this.diagram;if(a.model===b.model){var c=a.change;if(b.Z){b.Z=!1;try{var d=a.modelChange;if(""!==d){if(c===ge){if("nodeParentKey"===d){var e=a.object,f=this.Eb(a.newValue),g=this.Gi(e);if(null!==this.ih)null!==f&&(this.ih.data=e,this.ih.category=this.getLinkCategoryForData(e));else if(null!==g){var h=g.Ii();null!==h?null===f?b.remove(h):b.isTreePathToChildren?h.fromNode=f:h.toNode=f:Rq(this,f,g)}}else if("parentLinkCategory"===
d){var k=this.Gi(a.object),l=a.newValue;if(null!==k&&"string"===typeof l){var m=k.Ii();null!==m&&(m.category=l)}}b.isModified=!0}}else if(c===ge){var n=a.propertyName;a.object===b.model&&"nodeParentKeyProperty"===n&&(b.undoManager.isUndoingRedoing||this.Ld());b.isModified=!0}}finally{b.Z=!0}}}}};
Qq.prototype.updateRelationshipsFromData=function(a){var b=a.data;if(null!==b){var c=a.diagram;if(null!==c){var d=c.model;a instanceof W&&(b=d.Fh(b),b=c.Eb(b),d=a.rg(),b!==d&&(d=a.Ii(),null!==b?null!==d?c.isTreePathToChildren?d.fromNode=b:d.toNode=b:Rq(this,b,a):null!==d&&Bj(c,d,!1)))}}};Qq.prototype.updateDataBindings=function(a,b){ji.prototype.updateDataBindings.call(this,a,b);"string"===typeof b&&null!==this.Bc(a)&&(a=this.Ac(a),null!==a&&a.Fa(b))};
Qq.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.pa(a);if(void 0!==c){var d=Lq(b,c),e=this.Bc(a);if(null!==d&&null!==e){for(d=d.iterator;d.next();){var f=d.value;b.cb(f)&&e instanceof W&&b.Fh(f)===c&&Rq(this,e,this.Gi(f))}Mq(b,c)}a=b.Fh(a);void 0!==a&&e instanceof W&&(a=this.Eb(a),Rq(this,a,e))}};
Qq.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof W){var c=b.pa(a.data),d=this.Ac(a.data);if(null!==d){d.isSelected=!1;d.isHighlighted=!1;var e=d.layer;if(null!==e){var f=e.rc(-1,d,!1);0<=f&&this.diagram.Wa(qe,"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.cb(e)&&Nq(b,c,e)}};
Qq.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.ge(e.data,b.pa(d.data)),e.Ii()):null};Qq.prototype.findLinkForKey=Qq.prototype.findLinkForKey;Qq.className="TreePartManager";
function Z(a,b){this.vl=new G;this.tl=new G;this.zw=',\n  "insertedNodeKeys": ';this.My=',\n  "modifiedNodeData": ';this.Bw=',\n  "removedNodeKeys": ';this.Mh=null;Va(this);this.ln=this.na="";this.Sg=!1;this.j={};this.Gc=[];this.bb=new H;this.ni="key";this.Jk=this.nl=null;this.bn=this.cn=!1;this.en=!0;this.Om=null;this.Aj="category";this.Pf=new H;this.Yt=new E;this.kh=!1;this.o=null;this.undoManager=new se;void 0!==a&&(Aa(a)?this.nodeDataArray=a:Object.assign(this,a));b&&Object.assign(this,b)}
Z.prototype.cloneProtected=function(a){a.na=this.na;a.ln=this.ln;a.Sg=this.Sg;a.ni=this.ni;a.nl=this.nl;a.Jk=this.Jk;a.cn=this.cn;a.bn=this.bn;a.en=this.en;a.Om=this.Om;a.Aj=this.Aj};Z.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};Z.prototype.clear=function(){this.Gc=[];this.bb.clear();this.Pf.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.pa(e)+":"+Ka(e)}}return b};
Z.prototype.UA=function(a){a.change!==oe&&B("Model.toIncrementalData argument is not a Transaction ChangedEvent:"+a.toString());var b=a.object;if(!(a.isTransactionFinished&&b instanceof re))return null;Sq(this,b);a=this.iw(b,"FinishedUndo"===a.propertyName);this.Mh=null;return a};
Z.prototype.iw=function(a,b){var c=this,d=!1,e=new G,f=new G,g=new G,h=this.Mh;a.changes.each(function(a){a.model===c&&("nodeDataArray"===a.modelChange?a.change===pe?e.add(a.newValue):a.change===qe&&g.add(a.oldValue):c.cb(a.object)?f.add(a.object):a.change!==ge||c.modelData!==a.object&&"modelData"!==a.propertyName?null!==a.object&&(h&&h.contains(a.object)?h.get(a.object).each(function(a){c.cb(a)&&f.add(a)}):a.object instanceof Z||c.Pi()&&c.zc(a.object)||Tq(c,a.object).each(function(a){f.add(a)})):
d=!0)});var k=this.tl;k.clear();e.each(function(a){k.add(c.pa(a));b||f.add(a)});var l=this.vl;l.clear();g.each(function(a){l.add(c.pa(a));b&&f.add(a)});a=c.cloneDeep(f.ya());var m=null;d&&(null===m&&(m={}),m.modelData=this.cloneDeep(this.modelData));0<k.count&&(null===m&&(m={}),b?m.removedNodeKeys=k.ya():m.insertedNodeKeys=k.ya());0<a.length&&(null===m&&(m={}),m.modifiedNodeData=a);0<l.count&&(null===m&&(m={}),b?m.insertedNodeKeys=l.ya():m.removedNodeKeys=l.ya());l.clear();k.clear();return m};
Z.prototype.cloneDeep=function(a){return Uq(this,a,!0)};
function Uq(a,b,c,d,e,f){function g(a,c){h?(void 0===a.__gohashid&&f.push(a),d.set(a,c)):(a=mb++,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(Uq(a,b[m],!1,d,e,f))}else if(b instanceof K||b instanceof Gb||b instanceof N||b instanceof lc||b instanceof O)k=
b.copy(),g(b,k);else{if(b instanceof hl||b instanceof P||b instanceof D)return b;if(b instanceof E)k=(new E).addAll(Uq(a,b.ya(),!1,d,e,f)),g(b,k);else if(b instanceof G)k=(new G).addAll(Uq(a,b.ya(),!1,d,e,f)),g(b,k);else if(b instanceof H)k=(new H).addAll(Uq(a,b.ya(),!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]=Uq(a,b[m],!1,d,e,f))}c&&f.forEach(function(a){delete a.__gohashid});return k}t=Z.prototype;t.quote=function(a){return JSON.stringify(a).replace(/[\u007F-\uFFFF]/g,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).substr(-4)})};
t.Fm=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.nq=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 Vq(a,b){b=b.modelData;za(b)&&(a.pm(b),a.modelData=b)}
t.jw=function(){var a=this.modelData,b=!1,c;for(c in a)if(!Wq(c,a[c])){b=!0;break}a="";b&&(a=',\n  "modelData": '+Xq(this,this.modelData));return a+',\n  "nodeDataArray": '+Yq(this,this.nodeDataArray,!0)};t.Fv=function(a){Vq(this,a);a=a.nodeDataArray;Aa(a)&&(this.pm(a),this.nodeDataArray=a)};
function Sq(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 G,c.add(b),d.add(a,c)):c.add(b)}}var d=a.Mh;null===d&&(d=new H,b.changes.each(function(a){if(null!==a.diagram){var b=a.change;if(b===ge)(a=a.object.panel)&&(b=a.data)&&c(b,a);else if(b===pe||b===qe)a=a.object,(b=a.itemArray)&&c(b,a)}}),a.Mh=d)}function Tq(a,b){for(var c=new G,d=0;d<a.nodeDataArray.length;d++){var e=a.nodeDataArray[d];Zq(a,b,e,e,c)}return c}
function Zq(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(Zq(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(Zq(a,b,g,d,e))return!0}return!1}
t.hw=function(a,b){var c=this,d=!1,e=new G,f=new G,g=new G,h=this.Mh;a.changes.each(function(a){a.model===c&&("nodeDataArray"===a.modelChange?a.change===pe?e.add(a.newValue):a.change===qe&&g.add(a.oldValue):c.cb(a.object)?f.add(a.object):a.change!==ge||c.modelData!==a.object&&"modelData"!==a.propertyName?null!==a.object&&(h&&h.contains(a.object)?h.get(a.object).each(function(a){c.cb(a)&&f.add(a)}):a.object instanceof Z||c.Pi()&&c.zc(a.object)||Tq(c,a.object).each(function(a){f.add(a)})):d=!0)});var k=
this.tl;k.clear();e.each(function(a){k.add(c.pa(a));b||f.add(a)});var l=this.vl;l.clear();g.each(function(a){l.add(c.pa(a));b&&f.add(a)});a="";d&&(a+=',\n  "modelData": '+Xq(this,this.modelData));0<k.count&&(a+=(b?this.Bw:this.zw)+Yq(this,k.ya(),!0));0<f.count&&(a+=this.My+Yq(this,f.ya(),!0));0<l.count&&(a+=(b?this.zw:this.Bw)+Yq(this,l.ya(),!0));l.clear();k.clear();return a};
t.mq=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");Vq(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.pa(f);void 0!==g&&null!==g&&d.set(g,f)}if(Array.isArray(b))for(e=b.length,f=0;f<e;f++){g=b[f];var h=this.Yb(g);null===h&&(h=(h=d.get(g))?h:this.copyNodeData({}),this.wm(h,g),this.sf(h))}if(Array.isArray(c))for(b=c.length,d=0;d<b;d++)if(e=c[d],f=this.pa(e),f=this.Yb(f),null!==f){for(var k in e)"__gohashid"===k||k===
this.nodeKeyProperty||this.dk()&&k===this.nodeIsGroupProperty||this.setDataProperty(f,k,e[k]);this.xm(e,f)}a=a.removedNodeKeys;if(Array.isArray(a))for(c=a.length,k=0;k<c;k++)b=this.Yb(a[k]),null!==b&&this.om(b)};
t.Fy=function(a,b){a.change!==oe&&B("Model.toIncrementalJson argument is not a Transaction ChangedEvent:"+a.toString());var c=a.object;if(!(a.isTransactionFinished&&c instanceof re))return'{ "incremental": 0 }';void 0===b&&(b=$q(this,this));Sq(this,c);a=this.hw(c,"FinishedUndo"===a.propertyName);this.Mh=null;return"2"===b?'{ "incremental": 2'+a+"}":'{ "class": '+this.quote(b)+', "incremental": 1'+this.Fm()+a+"}"};t.VA=function(a,b){return this.Fy(a,b)};
t.vq=function(a){void 0===a&&(a=$q(this,this));return'{ "class": '+this.quote(a)+this.Fm()+this.jw()+"}"};t.toJSON=function(a){return this.vq(a)};t.Ax=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.xa("applyIncrementalJson"),this.mq(b),this.Xa("applyIncrementalJson"))};t.fz=function(a){return this.Ax(a)};
Z.constructGraphLinksModel=function(){return new Z};t=Z.prototype;
t.pm=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.pm(d);Array.isArray(a)?a[e]=d:B("Cannot replace an object in an HTMLCollection or NodeList at "+e)}}else if(za(a)){for(b in a)if(c=a[b],za(c)&&(c=this.pm(c),a[b]=c,"points"===b&&Array.isArray(c))){e=0===c.length%2;for(d=0;d<c.length;d++)if("number"!==typeof c[d]){e=!1;break}if(e){e=new E;for(d=0;d<c.length/2;d++)e.add(new K(c[2*d],c[2*d+1]));e.freeze();a[b]=e}}return ar(a)}return a};
t.Gm=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.Gm(a.valueOf()):Aa(a)?Yq(this,a):za(a)?Xq(this,a):"function"===typeof a?"null":a.toString()};
function Yq(a,b,c){void 0===c&&(c=!1);var d=b.length;if(0>=d)return"[]";var e=new Xa;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.Gm(g)))}c&&1<d&&e.add("\n");e.add("]");return e.toString()}function Wq(a,b){return void 0===b||"__gohashid"===a||"_"===a[0]||"function"===typeof b?!0:!1}function br(a){return isNaN(a)?"NaN":Infinity===a?"9e9999":-Infinity===a?"-9e9999":a}
function Xq(a,b){var c=b;if(c instanceof K)b={"class":"go.Point",x:br(c.x),y:br(c.y)};else if(c instanceof Gb)b={"class":"go.Size",width:br(c.width),height:br(c.height)};else if(c instanceof N)b={"class":"go.Rect",x:br(c.x),y:br(c.y),width:br(c.width),height:br(c.height)};else if(c instanceof lc)b={"class":"go.Margin",top:br(c.top),right:br(c.right),bottom:br(c.bottom),left:br(c.left)};else if(c instanceof O)c.hb()?b={"class":"go.Spot",x:br(c.x),y:br(c.y),offsetX:br(c.offsetX),offsetY:br(c.offsetY)}:
b={"class":"go.Spot","enum":c.toString()};else if(c instanceof hl){b={"class":"go.Brush",type:c.type.name};if(c.type===ol)b.color=c.color;else if(c.type===rl||c.type===il)b.start=c.start,b.end=c.end,c.type===il&&(0!==c.startRadius&&(b.startRadius=br(c.startRadius)),isNaN(c.endRadius)||(b.endRadius=br(c.endRadius)));if(null!==c.colorStops){var d={};for(c=c.colorStops.iterator;c.next();)d[c.key]=c.value;b.colorStops=d}}else c instanceof P?(b={"class":"go.Geometry",type:c.type.name},0!==c.startX&&(b.startX=
br(c.startX)),0!==c.startY&&(b.startY=br(c.startY)),0!==c.endX&&(b.endX=br(c.endX)),0!==c.endY&&(b.endY=br(c.endY)),c.spot1.A(uc)||(b.spot1=c.spot1),c.spot2.A(Cc)||(b.spot2=c.spot2),c.type===P.o&&(b.path=P.wa(c))):c instanceof D&&(b={"class":"go.EnumValue",classType:$q(a,c.classType),name:c.name});d="{";c=!0;for(var e in b){var f=gn(b,e);if(!Wq(e,f))if(c?c=!1:d+=",",d+=a.quote(e)+":","points"===e&&f instanceof E){var g="[";for(f=f.iterator;f.next();){var h=f.value;1<g.length&&(g+=",");g+=a.Gm(h.x);
g+=",";g+=a.Gm(h.y)}g+="]";d+=g}else d+=a.Gm(f)}return d+"}"}function cr(a){return"number"===typeof a?a:"NaN"===a?NaN:"9e9999"===a?Infinity:"-9e9999"===a?-Infinity:parseFloat(a)}
function ar(a){if("object"!==typeof a)return a;var b=a["class"]||"";if("NaN"===b)return NaN;if("Date"===b)return new Date(a.value);if(0!==b.indexOf("go."))return a;b=b.substr(3);var c=a;if("Point"===b)c=new K(cr(a.x),cr(a.y));else if("Size"===b)c=new Gb(cr(a.width),cr(a.height));else if("Rect"===b)c=new N(cr(a.x),cr(a.y),cr(a.width),cr(a.height));else if("Margin"===b)c=new lc(cr(a.top),cr(a.right),cr(a.bottom),cr(a.left));else if("Spot"===b)"string"===typeof a["enum"]?c=ld(a["enum"]):c=new O(cr(a.x),
cr(a.y),cr(a.offsetX),cr(a.offsetY));else if("Brush"===b){if(c=new hl,c.type=Wa(hl,a.type),"string"===typeof a.color&&(c.color=a.color),a.start instanceof O&&(c.start=a.start),a.end instanceof O&&(c.end=a.end),"number"===typeof a.startRadius&&(c.startRadius=cr(a.startRadius)),"number"===typeof a.endRadius&&(c.endRadius=cr(a.endRadius)),a=a.colorStops,za(a))for(var d in a)c.addColorStop(parseFloat(d),a[d])}else"Geometry"===b?(c=null,"string"===typeof a.path?c=P.parse(a.path):c=new P,c.type=Wa(P,a.type),
"number"===typeof a.startX&&(c.startX=cr(a.startX)),"number"===typeof a.startY&&(c.startY=cr(a.startY)),"number"===typeof a.endX&&(c.endX=cr(a.endX)),"number"===typeof a.endY&&(c.endY=cr(a.endY)),a.spot1 instanceof O&&(c.spot1=a.spot1),a.spot2 instanceof O&&(c.spot2=a.spot2)):"EnumValue"===b&&(d=a.classType,0===d.indexOf("go.")&&(d=d.substr(3)),d=dr(d),"function"===typeof d&&(c=Wa(d,a.name)));return c}t.yh=function(a){this.Yt.add(a);return this};t.rk=function(a){this.Yt.remove(a)};
t.ks=function(a){this.skipsUndoManager||this.undoManager.gv(a);for(var b=this.Yt,c=b.length,d=0;d<c;d++)b.J(d)(a)};t.Wa=function(a,b,c,d,e,f,g){fr(this,"",a,b,c,d,e,f,g)};t.g=function(a,b,c,d,e){fr(this,"",ge,a,this,b,c,d,e)};t.Os=function(a,b,c,d,e,f){fr(this,"",ge,b,a,c,d,e,f)};function fr(a,b,c,d,e,f,g,h,k){void 0===h&&(h=null);void 0===k&&(k=null);var l=new fe;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.ks(l)}
Z.prototype.changeState=function(a,b){if(null!==a&&a.model===this)if(a.change===ge){var c=a.object,d=a.propertyName,e=a.H(b);d===this.nodeKeyProperty&&this.cb(c)&&(b=a.H(!b),void 0!==b&&this.bb.remove(b),void 0!==e&&this.bb.add(e,c));Ij(c,d,e)}else a.change===pe?(c=a.newParam,"nodeDataArray"===a.modelChange?(a=a.newValue,za(a)&&"number"===typeof c&&(d=this.pa(a),b?(this.Gc[c]===a&&Da(this.Gc,c),void 0!==d&&this.bb.remove(d)):(this.Gc[c]!==a&&Ca(this.Gc,c,a),void 0!==d&&this.bb.add(d,a)))):""===a.modelChange?
((d=a.object)&&!Aa(d)&&a.propertyName&&(d=gn(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===qe?(c=a.oldParam,"nodeDataArray"===a.modelChange?(a=a.oldValue,za(a)&&"number"===typeof c&&(d=this.pa(a),b?(this.Gc[c]!==a&&Ca(this.Gc,c,a),void 0!==d&&this.bb.add(d,a)):(this.Gc[c]===a&&Da(this.Gc,c),void 0!==d&&this.bb.remove(d)))):""===a.modelChange?((d=a.object)&&!Aa(d)&&a.propertyName&&(d=
gn(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!==oe&&B("unknown ChangedEvent: "+a.toString())};Z.prototype.xa=function(a){return this.undoManager.xa(a)};Z.prototype.Xa=function(a){return this.undoManager.Xa(a)};Z.prototype.Hf=function(){return this.undoManager.Hf()};
Z.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.xa(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.Xa(b):this.undoManager.Hf(),this.skipsUndoManager=c}};t=Z.prototype;t.Fa=function(a,b){void 0===b&&(b="");fr(this,"SourceChanged",oe,b,a,null,null)};
t.pa=function(a){if(null!==a){var b=this.ni;if(""!==b&&(b=gn(a,b),void 0!==b)){if(Iq(b))return b;B("Key value for node data "+a+" is not a number or a string: "+b)}}};t.wm=function(a,b){if(null!==a){var c=this.ni;if(""!==c)if(this.cb(a)){var d=gn(a,c);d!==b&&null===this.Yb(b)&&(Ij(a,c,b),void 0!==d&&this.bb.remove(d),this.bb.add(b,a),fr(this,"nodeKey",ge,c,a,d,b),"string"===typeof c&&this.Fa(a,c),this.rq(d,b))}else Ij(a,c,b)}};function Iq(a){return"number"===typeof a||"string"===typeof a}
t.cb=function(a){var b=this.pa(a);return void 0===b?!1:this.bb.H(b)===a};t.Yb=function(a){null===a&&B("Model.findNodeDataForKey:key must not be null");return void 0!==a&&Iq(a)?this.bb.H(a):null};
t.sv=function(a){if(null!==a){var b=this.ni;if(""!==b){var c=this.pa(a);if(void 0===c||this.bb.contains(c)){var d=this.nl;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.bb.contains(c))){Ij(a,b,c);return}if("string"===typeof c){for(d=2;this.bb.contains(c+d);)d++;Ij(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.bb.count-1;this.bb.contains(c);)c--;Ij(a,b,c)}}}}};t.sf=function(a){null!==a&&(kb(a),this.cb(a)||Aq(this,a,!0))};
function Aq(a,b,c){var d=a.pa(b);if(void 0===d||a.bb.H(d)!==b)a.sv(b),d=a.pa(b),void 0===d&&B("Model.makeNodeDataKeyUnique failed on "+b+".  Data not added to Model."),a.bb.add(d,b),d=null,c&&(d=a.Gc.length,Ca(a.Gc,d,b)),fr(a,"nodeDataArray",pe,"nodeDataArray",a,null,b,null,d),a.rm(b),a.qm(b)}t.bz=function(a){if(Aa(a))for(var b=a.length,c=0;c<b;c++)this.sf(a[c]);else for(a=a.iterator;a.next();)this.sf(a.value)};t.om=function(a){null!==a&&zq(this,a,!0)};
function zq(a,b,c){var d=a.pa(b);void 0!==d&&a.bb.remove(d);d=null;if(c){a:if(c=a.Gc,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.Gc,d)}fr(a,"nodeDataArray",qe,"nodeDataArray",a,b,null,d,null);a.yq(b)}t.JA=function(a){if(Aa(a))for(var b=a.length,c=0;c<b;c++)this.om(a[c]);else for(a=a.iterator;a.next();)this.om(a.value)};
t.wA=function(a){if(a!==this.nodeDataArray&&Aa(a)){var b=this.vl;b.clear();b.addAll(this.bb.iteratorKeys);var c=this.tl;c.clear();for(var d=a.length,e=0;e<d;e++){var f=a[e],g=this.pa(f);if(void 0!==g){c.add(g);var h=this.Yb(g);h!==f&&(null!==h?(this.Np(h,f),this.xm(f,h)):(f=this.cloneDeep(f),this.wm(f,g),this.sf(f)))}else g=this.cloneDeep(f),this.sf(g),c.add(this.pa(g))}for(a=b.iterator;a.next();)d=a.value,c.contains(d)||(d=this.Yb(d))&&this.om(d);b.clear();c.clear()}};
t.rq=function(a,b){void 0!==b&&(a=Lq(this,a),a instanceof G&&this.Pf.add(b,a))};t.bw=function(){};t.rm=function(){};t.qm=function(){};t.yq=function(){};function Nq(a,b,c){if(void 0!==b){var d=a.Pf.H(b);null===d&&(d=new G,a.Pf.add(b,d));d.add(c)}}function Mq(a,b,c){if(void 0!==b){var d=a.Pf.H(b);d instanceof G&&(void 0===c||null===c?a.Pf.remove(b):(d.remove(c),0===d.count&&a.Pf.remove(b)))}}function Lq(a,b){if(void 0===b)return null;a=a.Pf.H(b);return a instanceof G?a:null}
t.mz=function(a){void 0===a?this.Pf.clear():this.Pf.remove(a)};Z.prototype.copyNodeData=function(a){if(null===a)return null;var b=this.Jk;a=null!==b?b(a,this):gr(this,a,!0);za(a)&&Va(a);return a};
function gr(a,b,c){if(a.copiesArrays&&Array.isArray(b)){var d=[];for(c=0;c<b.length;c++){var e=gr(a,b[c],a.copiesArrayObjects);d.push(e)}Va(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=gn(b,d),g=$q(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 se||f instanceof re||f instanceof fe?Ij(c,d,f):(f=gr(a,f,!1),Ij(c,d,f))}Va(c);return c}return b instanceof K?b.copy():b instanceof Gb?b.copy():b instanceof N?b.copy():b instanceof O?b.copy():b instanceof lc?b.copy():b}
Z.prototype.setDataProperty=function(a,b,c){if(this.cb(a)){if(b===this.nodeKeyProperty){this.wm(a,c);return}if(b===this.nodeCategoryProperty){this.vm(a,c);return}}else!hr&&a instanceof Y&&(hr=!0,ya('Model.setDataProperty is modifying a GraphObject, "'+a.toString()+'"'),ya("  Is that really your intent?"));var d=gn(a,b);d!==c&&(Ij(a,b,c),this.Os(a,b,d,c))};t=Z.prototype;t.set=function(a,b,c){this.setDataProperty(a,b,c)};
t.Np=function(a,b){if(b){var c=this.cb(a),d;for(d in b)"__gohashid"===d||c&&d===this.nodeKeyProperty||this.setDataProperty(a,d,b[d])}};t.Yy=function(a,b){this.ys(a,-1,b)};t.ys=function(a,b,c){0>b&&(b=a.length);Ca(a,b,c);fr(this,"",pe,"",a,null,c,null,b)};t.Hv=function(a,b){void 0===b&&(b=-1);a===this.Gc&&B("Model.removeArrayItem should not be called on the Model.nodeDataArray");-1===b&&(b=a.length-1);var c=a[b];Da(a,b);fr(this,"",qe,"",a,c,null,b,null)};
t.Zp=function(a){if(null===a)return"";var b=this.Aj;if(""===b)return"";b=gn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;B("getCategoryForNodeData found a non-string category for "+a+": "+b)};t.vm=function(a,b){if(null!==a){var c=this.Aj;if(""!==c)if(this.cb(a)){var d=gn(a,c);void 0===d&&(d="");d!==b&&(Ij(a,c,b),fr(this,"nodeCategory",ge,c,a,d,b))}else Ij(a,c,b)}};t.xm=function(a,b){this.vm(b,this.Zp(a))};t.fm=function(){return!1};t.dk=function(){return!1};t.Pi=function(){return!1};
t.Ds=function(){return!1};t.ek=function(){return!1};function li(){return new Z}function $q(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 $q(a,b.constructor);return typeof b}function dr(a){return ir[a]?ir[a]:void 0!==x.go&&x.go[a]?x.go[a]:null}
function gn(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 Ij(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){}}
na.Object.defineProperties(Z.prototype,{name:{get:function(){return this.na},set:function(a){var b=this.na;b!==a&&(this.na=a,this.g("name",b,a))}},dataFormat:{get:function(){return this.ln},set:function(a){var b=this.ln;b!==a&&(this.ln=a,this.g("dataFormat",b,a))}},isReadOnly:{get:function(){return this.Sg},set:function(a){var b=this.Sg;b!==a&&(this.Sg=a,this.g("isReadOnly",b,a))}},modelData:{
get:function(){return this.j},set:function(a){var b=this.j;b!==a&&(this.j=a,this.g("modelData",b,a),this.Fa(a))}},undoManager:{get:function(){return this.o},set:function(a){var b=this.o;b!==a&&(null!==b&&b.uy(this),this.o=a,null!==a&&a.yx(this))}},skipsUndoManager:{get:function(){return this.kh},set:function(a){this.kh=a}},nodeKeyProperty:{get:function(){return this.ni},set:function(a){var b=this.ni;
b!==a&&(""===a&&B("Model.nodeKeyProperty may not be the empty string"),0<this.bb.count&&B("Cannot set Model.nodeKeyProperty when there is existing node data"),this.ni=a,this.g("nodeKeyProperty",b,a))}},makeUniqueKeyFunction:{get:function(){return this.nl},set:function(a){var b=this.nl;b!==a&&(this.nl=a,this.g("makeUniqueKeyFunction",b,a))}},nodeDataArray:{get:function(){return this.Gc},set:function(a){var b=this.Gc;if(b!==a){this.bb.clear();
this.bw();for(var c=a.length,d=0;d<c;d++){var e=a[d];za(e)||B("Model.nodeDataArray must only contain Objects, not: "+e);kb(e)}this.Gc=a;d=new E;for(e=0;e<c;e++){var f=a[e],g=this.pa(f);void 0===g?d.add(f):null!==this.bb.H(g)?d.add(f):this.bb.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.sv(e),f=this.pa(e),void 0!==f&&this.bb.add(f,e);fr(this,"nodeDataArray",ge,"nodeDataArray",this,b,a);for(b=0;b<c;b++)d=a[b],this.rm(d),this.qm(d);Array.isArray(a)||(this.isReadOnly=!0)}}},copyNodeDataFunction:{
get:function(){return this.Jk},set:function(a){var b=this.Jk;b!==a&&(this.Jk=a,this.g("copyNodeDataFunction",b,a))}},copiesArrays:{get:function(){return this.cn},set:function(a){var b=this.cn;b!==a&&(this.cn=a,this.g("copiesArrays",b,a))}},copiesArrayObjects:{get:function(){return this.bn},set:function(a){var b=this.bn;b!==a&&(this.bn=a,this.g("copiesArrayObjects",b,a))}},copiesKey:{get:function(){return this.en},
set:function(a){var b=this.en;b!==a&&(this.en=a,this.g("copiesKey",b,a))}},afterCopyFunction:{get:function(){return this.Om},set:function(a){var b=this.Om;b!==a&&(this.Om=a,this.g("afterCopyFunction",b,a))}},nodeCategoryProperty:{get:function(){return this.Aj},set:function(a){var b=this.Aj;b!==a&&(this.Aj=a,this.g("nodeCategoryProperty",b,a))}},type:{get:function(){return"Model"}}});
Z.prototype.setCategoryForNodeData=Z.prototype.vm;Z.prototype.getCategoryForNodeData=Z.prototype.Zp;Z.prototype.removeArrayItem=Z.prototype.Hv;Z.prototype.insertArrayItem=Z.prototype.ys;Z.prototype.addArrayItem=Z.prototype.Yy;Z.prototype.assignAllDataProperties=Z.prototype.Np;Z.prototype.set=Z.prototype.set;Z.prototype.clearUnresolvedReferences=Z.prototype.mz;Z.prototype.mergeNodeDataArray=Z.prototype.wA;Z.prototype.removeNodeDataCollection=Z.prototype.JA;Z.prototype.removeNodeData=Z.prototype.om;
Z.prototype.addNodeDataCollection=Z.prototype.bz;Z.prototype.addNodeData=Z.prototype.sf;Z.prototype.makeNodeDataKeyUnique=Z.prototype.sv;Z.prototype.findNodeDataForKey=Z.prototype.Yb;Z.prototype.containsNodeData=Z.prototype.cb;Z.prototype.setKeyForNodeData=Z.prototype.wm;Z.prototype.getKeyForNodeData=Z.prototype.pa;Z.prototype.updateTargetBindings=Z.prototype.Fa;Z.prototype.commit=Z.prototype.commit;Z.prototype.rollbackTransaction=Z.prototype.Hf;Z.prototype.commitTransaction=Z.prototype.Xa;
Z.prototype.startTransaction=Z.prototype.xa;Z.prototype.raiseDataChanged=Z.prototype.Os;Z.prototype.raiseChanged=Z.prototype.g;Z.prototype.raiseChangedEvent=Z.prototype.Wa;Z.prototype.removeChangedListener=Z.prototype.rk;Z.prototype.addChangedListener=Z.prototype.yh;Z.prototype.writeJsonValue=Z.prototype.Gm;Z.prototype.replaceJsonObjects=Z.prototype.pm;Z.prototype.applyIncrementalJSON=Z.prototype.fz;Z.prototype.applyIncrementalJson=Z.prototype.Ax;Z.prototype.toJSON=Z.prototype.toJSON;
Z.prototype.toJson=Z.prototype.vq;Z.prototype.toIncrementalJSON=Z.prototype.VA;Z.prototype.toIncrementalJson=Z.prototype.Fy;Z.prototype.toIncrementalData=Z.prototype.UA;Z.prototype.clear=Z.prototype.clear;var hr=!1,ir={};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=dr(d)):(e=dr(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.nq(c);b.Fv(c);return b};Z.safePropertyValue=gn;Z.safePropertySet=Ij;ir.Brush=hl;ir.ChangedEvent=fe;ir.Geometry=P;ir.Margin=lc;ir.Panel=X;ir.Point=K;ir.Rect=N;ir.Size=Gb;ir.Spot=O;ir.Transaction=re;ir.UndoManager=se;function si(a,b,c,d){Va(this);this.v=!1;void 0===a&&(a="");void 0===b&&(b=a);void 0===c&&(c=null);this.j=-1;this.od=null;this.Ql=a;this.Pl=this.yp=0;this.Ur=null;this.Yn=!1;this.Il=b;this.an=c;void 0===d?(this.ql=jr,this.Ck=null):(this.ql=an,this.Ck=d);this.Nt=new G}
si.prototype.copy=function(){var a=new si;a.Ql=this.Ql;a.yp=this.yp;a.Pl=this.Pl;a.Ur=this.Ur;a.Yn=this.Yn;a.Il=this.Il;a.an=this.an;a.ql=this.ql;a.Ck=this.Ck;return a};t=si.prototype;t.gb=function(a){a.classType===si&&(this.mode=a)};t.toString=function(){return"Binding("+this.targetProperty+":"+this.sourceProperty+(-1!==this.Xi?" "+this.Xi:"")+" "+this.mode.name+")"};t.freeze=function(){this.v=!0;return this};t.ea=function(){this.v=!1;return this};
t.ly=function(a){void 0===a&&(a=null);this.mode=an;this.backConverter=a;return this};t.kq=function(a){void 0===a&&(a="");this.sourceName=a;this.isToModel=!1;return this};t.zA=function(){this.sourceName=null;this.isToModel=!0;return this};function al(a,b,c){a=a.sourceName;return null===a||""===a?b:"/"===a?c.part:"."===a?c:".."===a?c.panel:b.Ya(a)}
t.cw=function(a,b,c){var d=this.Il;if(void 0===c||""===d||d===c){c=this.Ql;var e=this.an;if(null===e&&""===c)ya("Binding error: target property is the empty string: "+this.toString());else{var f=b;""!==d&&(f=gn(b,d));if(void 0!==f)if(null===e)""!==c&&Ij(a,c,f);else try{if(""!==c){var g=e(f,a);Ij(a,c,g)}else e(f,a)}catch(h){}}}};
t.Aq=function(a,b,c,d){if(this.ql===an){var e=this.Ql;if(void 0===c||e===c){c=this.Il;var f=this.Ck,g=a;""!==e&&(g=gn(a,e));if(void 0!==g&&!this.Nt.contains(a))try{this.Nt.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):Ij(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.Hv(m,l);k.ys(m,l,g)}}else try{if(""!==c){var n=f(g,b,k);null!==k?k.setDataProperty(b,
c,n):Ij(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.Hv(q,r);k.ys(q,r,p)}}}catch(u){}}finally{this.Nt.remove(a)}}}};
na.Object.defineProperties(si.prototype,{Xi:{get:function(){return this.j},set:function(a){this.v&&wa(this);this.j=a}},targetProperty:{get:function(){return this.Ql},set:function(a){this.v&&wa(this);this.Ql=a}},sourceName:{get:function(){return this.Ur},set:function(a){this.v&&wa(this);this.Ur=a;null!==a&&(this.Yn=!1)}},isToModel:{get:function(){return this.Yn},set:function(a){this.v&&
wa(this);this.Yn=a}},sourceProperty:{get:function(){return this.Il},set:function(a){this.v&&wa(this);this.Il=a}},converter:{get:function(){return this.an},set:function(a){this.v&&wa(this);this.an=a}},backConverter:{get:function(){return this.Ck},set:function(a){this.v&&wa(this);this.Ck=a}},mode:{get:function(){return this.ql},set:function(a){this.v&&wa(this);this.ql=a}}});
si.prototype.updateSource=si.prototype.Aq;si.prototype.updateTarget=si.prototype.cw;si.prototype.ofModel=si.prototype.zA;si.prototype.ofObject=si.prototype.kq;si.prototype.makeTwoWay=si.prototype.ly;var Dk="Binding",jr=new D(si,"OneWay",1),an=new D(si,"TwoWay",2);si.className="Binding";si.parseEnum=function(a,b){return function(c){c=Wa(a,c);return null===c?b:c}};si.toString=Ka;si.OneWay=jr;si.TwoWay=an;
function kr(a,b,c){Z.call(this);this.yw=',\n  "insertedLinkKeys": ';this.Ly=',\n  "modifiedLinkData": ';this.Aw=',\n  "removedLinkKeys": ';this.Yc=[];this.Vf=new G;this.kb=new H;this.hi="";this.dj=this.Ik=this.ol=null;this.af="from";this.bf="to";this.wj=this.vj="";this.uj="category";this.be="";this.ul="isGroup";this.Ae="group";this.dn=!1;void 0!==b&&(this.linkDataArray=b);void 0!==a&&(Aa(a)?this.nodeDataArray=a:Object.assign(this,a));c&&Object.assign(this,c)}ma(kr,Z);kr.constructGraphLinksModel=Z.constructGraphLinksModel;
kr.prototype.cloneProtected=function(a){Z.prototype.cloneProtected.call(this,a);a.hi=this.hi;a.ol=this.ol;a.Ik=this.Ik;a.af=this.af;a.bf=this.bf;a.vj=this.vj;a.wj=this.wj;a.uj=this.uj;a.be=this.be;a.ul=this.ul;a.Ae=this.Ae;a.dn=this.dn};t=kr.prototype;t.clear=function(){Z.prototype.clear.call(this);this.Yc=[];this.kb.clear();this.Vf.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.pa(e)+":"+Ka(e)}b+="\n link data:";a=this.linkDataArray;c=a.length;for(d=0;d<c;d++)e=a[d],b+=" "+Gq(this,e,!0)+"--\x3e"+Gq(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 G,f=new G,g=new G,h=this.Mh;a.changes.each(function(a){a.model===d&&("linkDataArray"===a.modelChange?a.change===pe?e.add(a.newValue):a.change===qe&&g.add(a.oldValue):d.zc(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.zc(a)&&f.add(a)}):
a.object instanceof Z||d.cb(a.object)||lr(d,a.object).each(function(a){f.add(a)})))});var k=this.tl;k.clear();e.each(function(a){k.add(d.qc(a));b||f.add(a)});var l=this.vl;l.clear();g.each(function(a){l.add(d.qc(a));b&&f.add(a)});a=d.cloneDeep(f.ya());0<k.count&&(null===c&&(c={}),b?c.removedLinkKeys=k.ya():c.insertedLinkKeys=k.ya());0<a.length&&(null===c&&(c={}),c.modifiedLinkData=a);0<l.count&&(null===c&&(c={}),b?c.insertedLinkKeys=l.ya():c.removedLinkKeys=l.ya());l.clear();k.clear();return c};
t.Fm=function(){var a=Z.prototype.Fm.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.nq=function(a){Z.prototype.nq.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": '+Yq(this,this.linkDataArray,!0);return a+b};t.Fv=function(a){Z.prototype.Fv.call(this,a);a=a.linkDataArray;Array.isArray(a)&&(this.pm(a),this.linkDataArray=a)};
function lr(a,b){for(var c=new G,d=0;d<a.linkDataArray.length;d++){var e=a.linkDataArray[d];Zq(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 G,f=new G,g=new G,h=this.Mh;a.changes.each(function(a){a.model===d&&("linkDataArray"===a.modelChange?a.change===pe?e.add(a.newValue):a.change===qe&&g.add(a.oldValue):d.zc(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.zc(a)&&f.add(a)}):
a.object instanceof Z||d.cb(a.object)||lr(d,a.object).each(function(a){f.add(a)})))});var k=this.tl;k.clear();e.each(function(a){k.add(d.qc(a));b||f.add(a)});var l=this.vl;l.clear();g.each(function(a){l.add(d.qc(a));b&&f.add(a)});a=c;0<k.count&&(a+=(b?this.Aw:this.yw)+Yq(this,k.ya(),!0));0<f.count&&(a+=this.Ly+Yq(this,f.ya(),!0));0<l.count&&(a+=(b?this.yw:this.Aw)+Yq(this,l.ya(),!0));l.clear();k.clear();return a};
t.mq=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.mq.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.Dh(e);null===f&&(f=this.Sp({}),this.Ts(f,e),this.Bi(f))}b=a.modifiedLinkData;
if(Array.isArray(b))for(c=b.length,d=0;d<c;d++)if(e=b[d],f=this.qc(e),f=this.Dh(f),null!==f){for(var g in e)"__gohashid"!==g&&g!==this.linkKeyProperty&&this.setDataProperty(f,g,e[g]);mr(this,e,f)}a=a.removedLinkKeys;if(Array.isArray(a))for(g=a.length,b=0;b<g;b++)c=this.Dh(a[b]),null!==c&&this.nm(c)};
kr.prototype.changeState=function(a,b){if(null!==a&&a.model===this){if(a.change===ge){var c=a.object,d=a.propertyName;if(d===this.linkKeyProperty&&this.zc(c)){var e=a.H(b);b=a.H(!b);void 0!==b&&this.kb.remove(b);void 0!==e&&this.kb.add(e,c);Ij(c,d,e);return}}else if(a.change===pe){c=a.newParam;if("linkDataArray"===a.modelChange){a=a.newValue;za(a)&&"number"===typeof c&&(d=this.qc(a),b?(this.Vf.remove(a),this.Yc[c]===a&&this.Yc.splice(c,1),void 0!==d&&this.kb.remove(d)):(this.Vf.add(a),this.Yc[c]!==
a&&this.Yc.splice(c,0,a),void 0!==d&&this.kb.add(d,a)));return}if("linkLabelKeys"===a.modelChange){d=this.Bf(a.object);Array.isArray(d)&&"number"===typeof c&&(b?(c=d.indexOf(a.newValue),0<=c&&d.splice(c,1)):0>d.indexOf(a.newValue)&&d.splice(c,0,a.newValue));return}}else if(a.change===qe){c=a.oldParam;if("linkDataArray"===a.modelChange){a=a.oldValue;za(a)&&"number"===typeof c&&(d=this.qc(a),b?(this.Vf.add(a),this.Yc[c]!==a&&this.Yc.splice(c,0,a),void 0!==d&&this.kb.add(d,a)):(this.Vf.remove(a),this.Yc[c]===
a&&this.Yc.splice(c,1),void 0!==d&&this.kb.remove(d)));return}if("linkLabelKeys"===a.modelChange){d=this.Bf(a.object);Array.isArray(d)&&"number"===typeof c&&(b?0>d.indexOf(a.newValue)&&d.splice(c,0,a.newValue):(c=d.indexOf(a.newValue),0<=c&&d.splice(c,1)));return}}Z.prototype.changeState.call(this,a,b)}};t=kr.prototype;t.hm=function(a){if(void 0!==a){var b=this.dj;if(null!==b){var c=this.Yb(a);null===c&&(c=this.copyNodeData(b),Ij(c,this.nodeKeyProperty,a),this.sf(c))}return a}};
t.Xx=function(a){return Gq(this,a,!0)};t.Ov=function(a,b){Oq(this,a,b,!0)};t.$x=function(a){return Gq(this,a,!1)};t.Sv=function(a,b){Oq(this,a,b,!1)};function Gq(a,b,c){if(null!==b&&(a=c?a.af:a.bf,""!==a&&(a=gn(b,a),void 0!==a))){if(Iq(a))return a;B((c?"FromKey":"ToKey")+" value for link data "+b+" is not a number or a string: "+a)}}
function Oq(a,b,c,d){null===c&&(c=void 0);if(null!==b){var e=d?a.af:a.bf;if(""!==e)if(c=a.hm(c),a.zc(b)){var f=gn(b,e);f!==c&&(Mq(a,f,b),Ij(b,e,c),null===a.Yb(c)&&Nq(a,c,b),fr(a,d?"linkFromKey":"linkToKey",ge,e,b,f,c),"string"===typeof e&&a.Fa(b,e))}else Ij(b,e,c)}}t.Yx=function(a){return Fq(this,a,!0)};t.Pv=function(a,b){Pq(this,a,b,!0)};t.ay=function(a){return Fq(this,a,!1)};t.Tv=function(a,b){Pq(this,a,b,!1)};
function Fq(a,b,c){if(null===b)return"";a=c?a.vj:a.wj;if(""===a)return"";b=gn(b,a);return void 0===b?"":b}function Pq(a,b,c,d){if(null!==b){var e=d?a.vj:a.wj;if(""!==e)if(a.zc(b)){var f=gn(b,e);void 0===f&&(f="");f!==c&&(Ij(b,e,c),fr(a,d?"linkFromPortId":"linkToPortId",ge,e,b,f,c),"string"===typeof e&&a.Fa(b,e))}else Ij(b,e,c)}}t.Bf=function(a){if(null===a)return nr;var b=this.be;if(""===b)return nr;a=gn(a,b);return void 0===a?nr:a};
t.Us=function(a,b){if(null!==a){var c=this.be;if(""!==c)if(this.zc(a)){var d=gn(a,c);void 0===d&&(d=nr);if(d!==b){if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)Mq(this,d[f],a);Ij(a,c,b);e=b.length;for(f=0;f<e;f++){var g=b[f];null===this.Yb(g)&&Nq(this,g,a)}fr(this,"linkLabelKeys",ge,c,a,d,b);"string"===typeof c&&this.Fa(a,c)}}else Ij(a,c,b)}};
t.Cu=function(a,b){if(null!==b&&void 0!==b&&null!==a){var c=this.be;if(""!==c){var d=gn(a,c);if(void 0===d)c=[],c.push(b),this.Us(a,c);else if(Array.isArray(d)){var e=d.indexOf(b);0<=e||(e=d.length,d.push(b),this.zc(a)&&(null===this.Yb(b)&&Nq(this,b,a),fr(this,"linkLabelKeys",pe,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.be;if(""!==c){var d=gn(a,c);if(Array.isArray(d)){var e=d.indexOf(b);0>e||(d.splice(e,1),this.zc(a)&&(Mq(this,b,a),fr(this,"linkLabelKeys",qe,c,a,b,null,e,null)))}else void 0!==d&&B(c+" property is not an Array; cannot removeLabelKeyforLinkData: "+a)}}};t.qc=function(a){if(null!==a){var b=this.hi;if(""!==b&&(b=gn(a,b),void 0!==b)){if(Iq(b))return b;B("Key value for link data "+a+" is not a number or a string: "+b)}}};
t.Ts=function(a,b){if(null!==a){var c=this.hi;if(""!==c)if(this.zc(a)){var d=gn(a,c);d!==b&&null===this.Dh(b)&&(Ij(a,c,b),void 0!==d&&this.kb.remove(d),this.kb.add(b,a),fr(this,"linkKey",ge,c,a,d,b),"string"===typeof c&&this.Fa(a,c))}else Ij(a,c,b)}};t.Dh=function(a){null===a&&B("GraphLinksModel.findLinkDataForKey:key must not be null");return void 0!==a&&Iq(a)?this.kb.H(a):null};
t.Is=function(a){if(null!==a){var b=this.hi;if(""!==b){var c=this.qc(a);if(void 0===c||this.kb.contains(c)){var d=this.ol;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.kb.contains(c))){Ij(a,b,c);return}if("string"===typeof c){for(d=2;this.kb.contains(c+d);)d++;Ij(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.kb.count-1;this.kb.contains(c);)c--;Ij(a,b,c)}}}}};t.zc=function(a){return null===a?!1:this.Vf.contains(a)};t.Bi=function(a){null!==a&&(kb(a),this.zc(a)||Kq(this,a,!0))};
function Kq(a,b,c){if(""!==a.linkKeyProperty){var d=a.qc(b);if(void 0!==d&&a.kb.H(d)===b)return;a.Is(b);d=a.qc(b);void 0===d&&B("GraphLinksModel.makeLinkDataKeyUnique failed on "+b+". Data not added to model.");a.kb.add(d,b)}a.Vf.add(b);d=null;c&&(d=a.Yc.length,a.Yc.splice(d,0,b));fr(a,"linkDataArray",pe,"linkDataArray",a,null,b,null,d);or(a,b)}t.az=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.Bi(a[c]);else for(a=a.iterator;a.next();)this.Bi(a.value)};
t.nm=function(a){null!==a&&Jq(this,a,!0)};function Jq(a,b,c){a.Vf.remove(b);var d=a.qc(b);void 0!==d&&a.kb.remove(d);d=null;if(c){d=a.Yc.indexOf(b);if(0>d)return;a.Yc.splice(d,1)}fr(a,"linkDataArray",qe,"linkDataArray",a,b,null,d,null);c=Gq(a,b,!0);Mq(a,c,b);c=Gq(a,b,!1);Mq(a,c,b);d=a.Bf(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],Mq(a,c,b)}t.HA=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.nm(a[c]);else for(a=a.iterator;a.next();)this.nm(a.value)};
t.vA=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.vl;b.clear();b.addAll(this.kb.iteratorKeys);var c=this.tl;c.clear();for(var d=a.length,e=0;e<d;e++){var f=a[e],g=this.qc(f);if(void 0!==g){c.add(g);var h=this.Dh(g);h!==f&&(null!==h?(this.Np(h,f),mr(this,f,h)):(f=this.cloneDeep(f),this.Ts(f,g),this.Bi(f)))}else g=this.cloneDeep(f),this.Bi(g),c.add(this.qc(g))}for(a=
b.iterator;a.next();)d=a.value,c.contains(d)||(d=this.Dh(d))&&this.nm(d);b.clear();c.clear()}};function or(a,b){var c=Gq(a,b,!0);c=a.hm(c);null===a.Yb(c)&&Nq(a,c,b);c=Gq(a,b,!1);c=a.hm(c);null===a.Yb(c)&&Nq(a,c,b);var d=a.Bf(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],null===a.Yb(c)&&Nq(a,c,b)}
t.Sp=function(a){if(null===a)return null;var b=this.Ik;a=null!==b?b(a,this):gr(this,a,!0);za(a)&&(Va(a),""!==this.af&&Ij(a,this.af,void 0),""!==this.bf&&Ij(a,this.bf,void 0),""!==this.be&&Ij(a,this.be,[]));return a};t.mv=function(a){if(null===a)return!1;var b=this.ul;return""===b?!1:gn(a,b)?!0:!1};t.Eh=function(a){if(null!==a){var b=this.Ae;if(""!==b&&(b=gn(a,b),void 0!==b)){if(Iq(b))return b;B("GroupKey value for node data "+a+" is not a number or a string: "+b)}}};
t.uq=function(a,b){null===b&&(b=void 0);if(null!==a){var c=this.Ae;if(""!==c)if(this.cb(a)){var d=gn(a,c);d!==b&&(Mq(this,d,a),Ij(a,c,b),null===this.Yb(b)&&Nq(this,b,a),fr(this,"nodeGroupKey",ge,c,a,d,b),"string"===typeof c&&this.Fa(a,c))}else Ij(a,c,b)}};kr.prototype.copyNodeData=function(a){if(null===a)return null;a=Z.prototype.copyNodeData.call(this,a);this.Tj||""===this.Ae||void 0===gn(a,this.Ae)||Ij(a,this.Ae,void 0);return a};
kr.prototype.setDataProperty=function(a,b,c){if(this.cb(a)){if(b===this.nodeKeyProperty){this.wm(a,c);return}if(b===this.nodeCategoryProperty){this.vm(a,c);return}if(b===this.nodeGroupKeyProperty){this.uq(a,c);return}}else if(this.zc(a)){if(b===this.linkFromKeyProperty){Oq(this,a,c,!0);return}if(b===this.linkToKeyProperty){Oq(this,a,c,!1);return}if(b===this.linkFromPortIdProperty){Pq(this,a,c,!0);return}if(b===this.linkToPortIdProperty){Pq(this,a,c,!1);return}if(b===this.linkKeyProperty){this.Ts(a,
c);return}if(b===this.linkCategoryProperty){this.tq(a,c);return}if(b===this.linkLabelKeysProperty){this.Us(a,c);return}}var d=gn(a,b);d!==c&&(Ij(a,b,c),this.Os(a,b,d,c))};t=kr.prototype;t.Np=function(a,b){if(b){var c=this.cb(a),d=this.zc(a),e;for(e in b)"__gohashid"===e||c&&e===this.nodeKeyProperty||c&&e===this.nodeIsGroupProperty&&gn(a,e)===b[e]||d&&e===this.linkKeyProperty||this.setDataProperty(a,e,b[e])}};
t.rq=function(a,b){Z.prototype.rq.call(this,a,b);for(var c=this.bb.iterator;c.next();)this.Jv(c.value,a,b);for(c=this.Vf.iterator;c.next();){var d=c.value,e=a,f=b;if(Gq(this,d,!0)===e){var g=this.af;Ij(d,g,f);fr(this,"linkFromKey",ge,g,d,e,f);"string"===typeof g&&this.Fa(d,g)}Gq(this,d,!1)===e&&(g=this.bf,Ij(d,g,f),fr(this,"linkToKey",ge,g,d,e,f),"string"===typeof g&&this.Fa(d,g));g=this.Bf(d);if(Array.isArray(g))for(var h=g.length,k=this.be,l=0;l<h;l++)g[l]===e&&(g[l]=f,fr(this,"linkLabelKeys",pe,
k,d,e,f,l,l))}};t.Jv=function(a,b,c){if(this.Eh(a)===b){var d=this.Ae;Ij(a,d,c);fr(this,"nodeGroupKey",ge,d,a,b,c);"string"===typeof d&&this.Fa(a,d)}};t.bw=function(){Z.prototype.bw.call(this);for(var a=this.linkDataArray,b=a.length,c=0;c<b;c++)or(this,a[c])};
t.rm=function(a){Z.prototype.rm.call(this,a);a=this.pa(a);var b=Lq(this,a);if(null!==b){var c=Ea();for(b=b.iterator;b.next();){var d=b.value;if(this.cb(d)){if(this.Eh(d)===a){var e=this.Ae;fr(this,"nodeGroupKey",ge,e,d,a,a);"string"===typeof e&&this.Fa(d,e);c.push(d)}}else if(Gq(this,d,!0)===a&&(e=this.af,fr(this,"linkFromKey",ge,e,d,a,a),"string"===typeof e&&this.Fa(d,e),c.push(d)),Gq(this,d,!1)===a&&(e=this.bf,fr(this,"linkToKey",ge,e,d,a,a),"string"===typeof e&&this.Fa(d,e),c.push(d)),e=this.Bf(d),
Array.isArray(e))for(var f=e.length,g=this.be,h=0;h<f;h++)e[h]===a&&(fr(this,"linkLabelKeys",pe,g,d,a,a,h,h),c.push(d))}for(b=0;b<c.length;b++)Mq(this,a,c[b]);Ia(c)}};t.qm=function(a){Z.prototype.qm.call(this,a);var b=this.Eh(a);null===this.Yb(b)&&Nq(this,b,a)};t.yq=function(a){Z.prototype.yq.call(this,a);var b=this.Eh(a);Mq(this,b,a)};
t.us=function(a){if(null===a)return"";var b=this.uj;if(""===b)return"";b=gn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;B("getCategoryForLinkData found a non-string category for "+a+": "+b)};kr.prototype.getLinkCategoryForData=function(a){return this.us(a)};kr.prototype.tq=function(a,b){if(null!==a){var c=this.uj;if(""!==c)if(this.zc(a)){var d=gn(a,c);void 0===d&&(d="");d!==b&&(Ij(a,c,b),fr(this,"linkCategory",ge,c,a,d,b),"string"===typeof c&&this.Fa(a,c))}else Ij(a,c,b)}};
kr.prototype.setLinkCategoryForData=function(a,b){this.tq(a,b)};t=kr.prototype;t.xm=function(a,b){Z.prototype.xm.call(this,a,b);this.uq(b,this.Eh(a))};function mr(a,b,c){a.tq(c,a.us(b));a.Ov(c,a.Xx(b));a.Sv(c,a.$x(b));a.Us(c,a.Bf(b));a.Pv(c,a.Yx(b));a.Tv(c,a.ay(b))}t.dk=function(){return!0};t.Pi=function(){return!0};t.Ds=function(){return!0};t.ek=function(){return!0};
na.Object.defineProperties(kr.prototype,{archetypeNodeData:{get:function(){return this.dj},set:function(a){var b=this.dj;b!==a&&(this.dj=a,this.g("archetypeNodeData",b,a))}},linkFromKeyProperty:{get:function(){return this.af},set:function(a){var b=this.af;b!==a&&(this.af=a,this.g("linkFromKeyProperty",b,a))}},linkToKeyProperty:{get:function(){return this.bf},set:function(a){var b=this.bf;b!==a&&(this.bf=a,this.g("linkToKeyProperty",
b,a))}},linkFromPortIdProperty:{get:function(){return this.vj},set:function(a){var b=this.vj;b!==a&&(this.vj=a,this.g("linkFromPortIdProperty",b,a))}},linkToPortIdProperty:{get:function(){return this.wj},set:function(a){var b=this.wj;b!==a&&(this.wj=a,this.g("linkToPortIdProperty",b,a))}},linkLabelKeysProperty:{get:function(){return this.be},set:function(a){var b=this.be;b!==a&&(this.be=a,this.g("linkLabelKeysProperty",
b,a))}},linkDataArray:{get:function(){return this.Yc},set:function(a){var b=this.Yc;if(b!==a){this.kb.clear();for(var c=a.length,d=0;d<c;d++){var e=a[d];za(e)||B("GraphLinksModel.linkDataArray must only contain Objects, not: "+e);kb(e)}this.Yc=a;if(""!==this.linkKeyProperty){d=new E;for(e=0;e<c;e++){var f=a[e],g=this.qc(f);void 0===g?d.add(f):null!==this.kb.H(g)?d.add(f):this.kb.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.Is(e),f=this.qc(e),void 0!==f&&this.kb.add(f,
e)}d=new G;for(e=0;e<c;e++)d.add(a[e]);this.Vf=d;fr(this,"linkDataArray",ge,"linkDataArray",this,b,a);for(b=0;b<c;b++)or(this,a[b])}}},linkKeyProperty:{get:function(){return this.hi},set:function(a){var b=this.hi;if(b!==a){this.hi=a;this.kb.clear();for(var c=this.linkDataArray.length,d=0;d<c;d++){var e=this.linkDataArray[d],f=this.qc(e);void 0===f&&(this.Is(e),f=this.qc(e));void 0!==f&&this.kb.add(f,e)}this.g("linkKeyProperty",b,a)}}},makeUniqueLinkKeyFunction:{
get:function(){return this.ol},set:function(a){var b=this.ol;b!==a&&(this.ol=a,this.g("makeUniqueLinkKeyFunction",b,a))}},copyLinkDataFunction:{get:function(){return this.Ik},set:function(a){var b=this.Ik;b!==a&&(this.Ik=a,this.g("copyLinkDataFunction",b,a))}},nodeIsGroupProperty:{get:function(){return this.ul},set:function(a){var b=this.ul;b!==a&&(this.ul=a,this.g("nodeIsGroupProperty",b,a))}},nodeGroupKeyProperty:{
get:function(){return this.Ae},set:function(a){var b=this.Ae;b!==a&&(this.Ae=a,this.g("nodeGroupKeyProperty",b,a))}},Tj:{get:function(){return this.dn},set:function(a){this.dn!==a&&(this.dn=a)}},linkCategoryProperty:{get:function(){return this.uj},set:function(a){var b=this.uj;b!==a&&(this.uj=a,this.g("linkCategoryProperty",b,a))}},type:{get:function(){return"GraphLinksModel"}}});
kr.prototype.setCategoryForLinkData=kr.prototype.tq;kr.prototype.getCategoryForLinkData=kr.prototype.us;kr.prototype.assignAllDataProperties=kr.prototype.Np;kr.prototype.setGroupKeyForNodeData=kr.prototype.uq;kr.prototype.getGroupKeyForNodeData=kr.prototype.Eh;kr.prototype.isGroupForNodeData=kr.prototype.mv;kr.prototype.copyLinkData=kr.prototype.Sp;kr.prototype.mergeLinkDataArray=kr.prototype.vA;kr.prototype.removeLinkDataCollection=kr.prototype.HA;kr.prototype.removeLinkData=kr.prototype.nm;
kr.prototype.addLinkDataCollection=kr.prototype.az;kr.prototype.addLinkData=kr.prototype.Bi;kr.prototype.containsLinkData=kr.prototype.zc;kr.prototype.makeLinkDataKeyUnique=kr.prototype.Is;kr.prototype.findLinkDataForKey=kr.prototype.Dh;kr.prototype.setKeyForLinkData=kr.prototype.Ts;kr.prototype.getKeyForLinkData=kr.prototype.qc;kr.prototype.removeLabelKeyForLinkData=kr.prototype.ty;kr.prototype.addLabelKeyForLinkData=kr.prototype.Cu;kr.prototype.setLabelKeysForLinkData=kr.prototype.Us;
kr.prototype.getLabelKeysForLinkData=kr.prototype.Bf;kr.prototype.setToPortIdForLinkData=kr.prototype.Tv;kr.prototype.getToPortIdForLinkData=kr.prototype.ay;kr.prototype.setFromPortIdForLinkData=kr.prototype.Pv;kr.prototype.getFromPortIdForLinkData=kr.prototype.Yx;kr.prototype.setToKeyForLinkData=kr.prototype.Sv;kr.prototype.getToKeyForLinkData=kr.prototype.$x;kr.prototype.setFromKeyForLinkData=kr.prototype.Ov;kr.prototype.getFromKeyForLinkData=kr.prototype.Xx;kr.prototype.clear=kr.prototype.clear;
var nr=Object.freeze([]);kr.className="GraphLinksModel";ir.GraphLinksModel=kr;Z.constructGraphLinksModel=Z.constructGraphLinksModel=function(){return new kr};Z.initDiagramModel=li=function(){return new kr};function pr(a,b){Z.call(this);this.Be="parent";this.fn=!1;this.Cj="parentLinkCategory";void 0!==a&&(Aa(a)?this.nodeDataArray=a:Object.assign(this,a));b&&Object.assign(this,b)}ma(pr,Z);pr.constructGraphLinksModel=Z.constructGraphLinksModel;
pr.prototype.cloneProtected=function(a){Z.prototype.cloneProtected.call(this,a);a.Be=this.Be;a.fn=this.fn;a.Cj=this.Cj};t=pr.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.pa(e)+":"+Ka(e)}}return b};
t.Fm=function(){var a=Z.prototype.Fm.call(this),b="";"parent"!==this.nodeParentKeyProperty&&"string"===typeof this.nodeParentKeyProperty&&(b+=',\n  "nodeParentKeyProperty": '+this.quote(this.nodeParentKeyProperty));return a+b};t.nq=function(a){Z.prototype.nq.call(this,a);a.nodeParentKeyProperty&&(this.nodeParentKeyProperty=a.nodeParentKeyProperty)};
t.mq=function(a){void 0!==a.nodeParentKeyProperty&&a.nodeParentKeyProperty!==this.nodeParentKeyProperty&&B("applyIncrementalJson cannot change Model properties");Z.prototype.mq.call(this,a)};t.hm=function(a){return a};t.Fh=function(a){if(null!==a){var b=this.Be;if(""!==b&&(b=gn(a,b),void 0!==b)){if(Iq(b))return b;B("ParentKey value for node data "+a+" is not a number or a string: "+b)}}};
t.ge=function(a,b){null===b&&(b=void 0);if(null!==a){var c=this.Be;if(""!==c)if(b=this.hm(b),this.cb(a)){var d=gn(a,c);d!==b&&(Mq(this,d,a),Ij(a,c,b),null===this.Yb(b)&&Nq(this,b,a),fr(this,"nodeParentKey",ge,c,a,d,b),"string"===typeof c&&this.Fa(a,c))}else Ij(a,c,b)}};t.xs=function(a){if(null===a)return"";var b=this.Cj;if(""===b)return"";b=gn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;B("getParentLinkCategoryForNodeData found a non-string category for "+a+": "+b);return""};
pr.prototype.getLinkCategoryForData=function(a){return this.xs(a)};pr.prototype.Vs=function(a,b){if(null!==a){var c=this.Cj;if(""!==c)if(this.cb(a)){var d=gn(a,c);void 0===d&&(d="");d!==b&&(Ij(a,c,b),fr(this,"parentLinkCategory",ge,c,a,d,b),"string"===typeof c&&this.Fa(a,c))}else Ij(a,c,b)}};pr.prototype.setLinkCategoryForData=function(a,b){this.Vs(a,b)};
pr.prototype.copyNodeData=function(a){if(null===a)return null;a=Z.prototype.copyNodeData.call(this,a);this.Uj||""===this.Be||void 0===gn(a,this.Be)||Ij(a,this.Be,void 0);return a};pr.prototype.setDataProperty=function(a,b,c){if(this.cb(a)){if(b===this.nodeKeyProperty){this.wm(a,c);return}if(b===this.nodeCategoryProperty){this.vm(a,c);return}if(b===this.nodeParentKeyProperty){this.ge(a,c);return}}var d=gn(a,b);d!==c&&(Ij(a,b,c),this.Os(a,b,d,c))};t=pr.prototype;
t.rq=function(a,b){Z.prototype.rq.call(this,a,b);for(var c=this.bb.iterator;c.next();)this.Jv(c.value,a,b)};t.Jv=function(a,b,c){if(this.Fh(a)===b){var d=this.Be;Ij(a,d,c);fr(this,"nodeParentKey",ge,d,a,b,c);"string"===typeof d&&this.Fa(a,d)}};
t.rm=function(a){Z.prototype.rm.call(this,a);a=this.pa(a);var b=Lq(this,a);if(null!==b){var c=Ea();for(b=b.iterator;b.next();){var d=b.value;if(this.cb(d)&&this.Fh(d)===a){var e=this.Be;fr(this,"nodeParentKey",ge,e,d,a,a);"string"===typeof e&&this.Fa(d,e);c.push(d)}}for(b=0;b<c.length;b++)Mq(this,a,c[b]);Ia(c)}};t.qm=function(a){Z.prototype.qm.call(this,a);var b=this.Fh(a);b=this.hm(b);null===this.Yb(b)&&Nq(this,b,a)};t.yq=function(a){Z.prototype.yq.call(this,a);var b=this.Fh(a);Mq(this,b,a)};
t.xm=function(a,b){Z.prototype.xm.call(this,a,b);this.Vs(b,this.xs(a));this.ge(b,this.Fh(a))};t.fm=function(){return!0};t.Ds=function(){return!0};
na.Object.defineProperties(pr.prototype,{nodeParentKeyProperty:{get:function(){return this.Be},set:function(a){var b=this.Be;b!==a&&(this.Be=a,this.g("nodeParentKeyProperty",b,a))}},Uj:{get:function(){return this.fn},set:function(a){this.fn!==a&&(this.fn=a)}},parentLinkCategoryProperty:{get:function(){return this.Cj},set:function(a){var b=this.Cj;b!==a&&(this.Cj=a,this.g("parentLinkCategoryProperty",b,a))}},
linkCategoryProperty:{get:function(){return this.parentLinkCategoryProperty},set:function(a){this.parentLinkCategoryProperty=a}},type:{get:function(){return"TreeModel"}}});pr.prototype.setParentLinkCategoryForNodeData=pr.prototype.Vs;pr.prototype.getParentLinkCategoryForNodeData=pr.prototype.xs;pr.prototype.setParentKeyForNodeData=pr.prototype.ge;pr.prototype.getParentKeyForNodeData=pr.prototype.Fh;pr.className="TreeModel";ir.TreeModel=pr;
function qr(a){ni.call(this);this.Ow=this.tn=this.bc=0;this.Xq=360;this.Nw=rr;this.hj=0;this.Cw=new K;this.Oq=this.ce=0;this.fs=new sr;this.At=this.Bj=0;this.Ry=600;this.So=NaN;this.Tm=1;this.vp=0;this.Nl=360;this.Hb=rr;this.L=tr;this.$c=ur;this.Tc=jq;this.jf=6;this.Co=vr;a&&Object.assign(this,a)}ma(qr,ni);
qr.prototype.cloneProtected=function(a){ni.prototype.cloneProtected.call(this,a);a.So=this.So;a.Tm=this.Tm;a.vp=this.vp;a.Nl=this.Nl;a.Hb=this.Hb;a.L=this.L;a.$c=this.$c;a.Tc=this.Tc;a.jf=this.jf;a.Co=this.Co};
qr.prototype.gb=function(a){if(a.classType===qr)if(a===wr||a===xr||a===yr||a===zr||a===ur)this.sorting=a;else if(a===Ar||a===Br||a===tr||a===Cr)this.direction=a;else if(a===Dr||a===Er||a===rr||a===Fr)this.arrangement=a;else{if(a===Gr||a===vr)this.nodeDiameterFormula=a}else ni.prototype.gb.call(this,a)};qr.prototype.createNetwork=function(){return new Hr(this)};
qr.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.Oq;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===Fr&&k===Gr?h=rr:h===Fr&&k!==Gr&&(h=this.arrangement);if((this.direction===Ar||this.direction===Br)&&this.sorting!==ur){for(k=0;!(k>=d.length);k+=2){a.add(d.J(k));if(k+1>=d.length)break;c.add(d.J(k+1))}this.direction===Ar?(this.arrangement===Fr&&a.reverse(),d=new E,d.addAll(a),d.addAll(c)):(this.arrangement===Fr&&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===tr?1:-1)/k,u=d.J(r).diameter;isNaN(u)&&(u=Ir(d.J(r),q));360>p&&(0===r||r===d.length-1)&&(u/=2);e+=u;f++}if(isNaN(l)||h===Fr){isNaN(b)&&(b=6);if(h!==rr&&h!==Fr){f=-Infinity;for(g=0;g<k;g++)r=d.J(g),e=d.J(g===k-1?0:g+1),isNaN(r.diameter)&&Ir(r,0),isNaN(e.diameter)&&Ir(e,0),f=Math.max(f,(r.diameter+e.diameter)/2);g=f+b;h===Dr?l=(f+b)/(2*Math.PI/k):l=Jr(this,g*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180)}else l=Jr(this,e+(360<=p?k:k-1)*(h!==Fr?b:1.6*b),m,n*
Math.PI/180,p*Math.PI/180);f=l*m}else if(f=l*m,r=Kr(this,l,f,n*Math.PI/180,p*Math.PI/180),isNaN(b)){if(h===rr||h===Fr)b=(r-e)/(360<=p?k:k-1)}else if(h===rr||h===Fr)r=(r-e)/(360<=p?k:k-1),r<b?(l=Jr(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.J(e),u=d.J(e===k-1?0:e+1),isNaN(q.diameter)&&Ir(q,0),isNaN(u.diameter)&&Ir(u,0),g=Math.max(g,(q.diameter+u.diameter)/2);g+=b;e=Jr(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.Nw=h;this.bc=l;this.tn=m;this.Ow=n;this.Xq=p;this.hj=b;this.ce=f;this.Oq=g;b=d;d=this.Nw;h=this.bc;l=this.Ow;m=this.Xq;n=this.hj;p=this.ce;k=this.Oq;if(this.direction!==Ar&&this.direction!==Br||d!==Fr)if(this.direction===Ar||this.direction===Br){g=0;switch(d){case Er:g=180*Lr(this,h,p,l,k)/Math.PI;break;case rr:k=b=0;g=a.first();null!==g&&(b=Ir(g,Math.PI/2));g=c.first();null!==g&&(k=Ir(g,Math.PI/2));g=180*Lr(this,h,p,l,n+(b+k)/2)/Math.PI;break;case Dr:g=m/b.length}if(this.direction===
Ar){switch(d){case Er:Mr(this,a,l,Cr);break;case rr:Nr(this,a,l,Cr);break;case Dr:Or(this,a,m/2,l,Cr)}switch(d){case Er:Mr(this,c,l+g,tr);break;case rr:Nr(this,c,l+g,tr);break;case Dr:Or(this,c,m/2,l+g,tr)}}else{switch(d){case Er:Mr(this,c,l,Cr);break;case rr:Nr(this,c,l,Cr);break;case Dr:Or(this,c,m/2,l,Cr)}switch(d){case Er:Mr(this,a,l+g,tr);break;case rr:Nr(this,a,l+g,tr);break;case Dr:Or(this,a,m/2,l+g,tr)}}}else switch(d){case Er:Mr(this,b,l,this.direction);break;case rr:Nr(this,b,l,this.direction);
break;case Dr:Or(this,b,m,l,this.direction);break;case Fr:Pr(this,b,m,l,this.direction)}else Pr(this,b,m,l-m/2,tr)}this.updateParts();this.network=null;this.isValidLayout=!0};function Or(a,b,c,d,e){var f=a.Xq,g=a.bc;a=a.ce;d=d*Math.PI/180;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=d+(e===tr?k*c/(360<=f?h:h-1):-(k*c)/h),m=b.J(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 Nr(a,b,c,d){var e=a.bc,f=a.ce,g=a.hj;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=b.J(k),m=b.J(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)&&Ir(l,0);isNaN(m.diameter)&&Ir(m,0);l=Lr(a,e,f,d===tr?c:-c,(l.diameter+m.diameter)/2+g);c+=d===tr?l:-l}}
function Mr(a,b,c,d){var e=a.bc,f=a.ce,g=a.Oq;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=b.J(k);l.centerX=e*Math.cos(c);l.centerY=f*Math.sin(c);l.actualAngle=180*c/Math.PI;l=Lr(a,e,f,d===tr?c:-c,g);c+=d===tr?l:-l}}function Pr(a,b,c,d,e){var f=a.Xq;a.Bj=0;a.fs=new sr;if(360>c){for(f=d+(e===tr?f:-f);0>f;)f+=360;f%=360;180<f&&(f-=360);f*=Math.PI/180;a.At=f;Qr(a,b,c,d,e)}else Rr(a,b,c,d,e);a.fs.commit(b)}
function Rr(a,b,c,d,e){var f=a.bc,g=a.hj,h=a.tn,k=f*Math.cos(d*Math.PI/180),l=a.ce*Math.sin(d*Math.PI/180),m=b.ya();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=K.alloc();for(var n=0;n<m.length;n++){m[n].centerX=k;m[n].centerY=l;if(n>=m.length-1)break;Sr(a,k,l,m,n,e,f)||Tr(a,k,l,m,n,e,f);k=f.x;l=f.y}K.free(f);a.Bj++;if(!(23<a.Bj)){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===tr?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.fs.compare(g,m);1<Math.abs(g)&&(a.bc=8>a.Bj?a.bc-g/(2*Math.PI):5>m.length&&10<g?a.bc/2:a.bc-(0<g?1.7:-2.3),a.ce=a.bc*h,Rr(a,b,c,d,e))}}}
function Qr(a,b,c,d,e){for(var f=a.bc,g=a.ce,h=a.tn,k=f*Math.cos(d*Math.PI/180),l=g*Math.sin(d*Math.PI/180),m=K.alloc(),n=b.ya(),p=0;p<n.length;p++){n[p].centerX=k;n[p].centerY=l;if(p>=n.length-1)break;Sr(a,k,l,n,p,e,m)||Tr(a,k,l,n,p,e,m);k=m.x;l=m.y}K.free(m);a.Bj++;if(!(23<a.Bj)){k=Math.atan2(l,k);k=e===tr?a.At-k:k-a.At;k=Math.abs(k)<Math.abs(k-2*Math.PI)?k:k-2*Math.PI;f=k*(f+g)/2;g=a.fs;if(Math.abs(f)<Math.abs(g.bm))for(g.bm=f,g.sk=[],g.Hm=[],k=0;k<n.length;k++)g.sk[k]=n[k].bounds.x,g.Hm[k]=n[k].bounds.y;
1<Math.abs(f)&&(a.bc=8>a.Bj?a.bc-f/(2*Math.PI):a.bc-(0<f?1.7:-2.3),a.ce=a.bc*h,Qr(a,b,c,d,e))}}function Sr(a,b,c,d,e,f,g){var h=a.bc,k=a.ce,l=0;a=(d[e].width+d[e+1].width)/2+a.hj;var m=!1;if(0<=c!==(f===tr)){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 Tr(a,b,c,d,e,f,g){var h=a.bc,k=a.ce,l=0;a=(d[e].height+d[e+1].height)/2+a.hj;d=!1;if(0<=b!==(f===tr)){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}qr.prototype.commitLayout=function(){this.commitNodes();this.isRouting&&this.commitLinks()};
qr.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 K(0,0):(c.x=this.arrangementOrigin.x+this.bc,c.y=this.arrangementOrigin.y+this.ce);for(var d=this.network.vertexes.iterator;d.next();){var e=d.value;e.x+=c.x;e.y+=c.y;e.commit()}a&&(this.group.Ta(),a=this.group.position.copy(),c=this.group.location.copy(),b=b.he(c.he(a)),this.group.move(b),this.Cw=b.he(a))};
qr.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};function Kr(a,b,c,d,e){var f=a.Ry;if(.001>Math.abs(a.tn-1))return void 0!==d&&void 0!==e?e*b:2*Math.PI*b;a=b>c?Math.sqrt(b*b-c*c)/b:Math.sqrt(c*c-b*b)/c;var g=0;var h=void 0!==d&&void 0!==e?e/(f+1):Math.PI/(2*(f+1));for(var k=0,l=0;l<=f;l++){void 0!==d&&void 0!==e?k=d+l*e/f:k=l*Math.PI/(2*f);var m=Math.sin(k);g+=Math.sqrt(1-a*a*m*m)*h}return void 0!==d&&void 0!==e?(b>c?b:c)*g:4*(b>c?b:c)*g}
function Jr(a,b,c,d,e){return b/(void 0!==d&&void 0!==e?Kr(a,1,c,d,e):Kr(a,1,c))}function Lr(a,b,c,d,e){if(.001>Math.abs(a.tn-1))return e/b;var f=b>c?Math.sqrt(b*b-c*c)/b:Math.sqrt(c*c-b*b)/c,g=0;a=2*Math.PI/(700*a.network.vertexes.count);b>c&&(d+=Math.PI/2);for(var h=0;;h++){var k=Math.sin(d+h*a);g+=(b>c?b:c)*Math.sqrt(1-f*f*k*k)*a;if(g>=e)return h*a}}
qr.prototype.sort=function(a){switch(this.sorting){case yr:break;case zr:a.reverse();break;case wr:a.sort(this.comparer);break;case xr:a.sort(this.comparer);a.reverse();break;case ur:return this.Ns(Ur(a));default:B("Invalid sorting type.")}return a};
function Ur(a){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.J(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.J(f));b[f]=-1;f=a.J(f);for(g=f.sourceEdges;g.next();)e=a.indexOf(g.value.fromVertex),0>e||0<=b[e]&&b[e]++;for(f=f.destinationEdges;f.next();)e=a.indexOf(f.value.toVertex),0>e||0<=b[e]&&b[e]++}return c}
qr.prototype.Ns=function(a){for(var b=[],c=0;c<a.length;c++){var d=a.J(c);b[c]=[];for(var e,f=d.destinationEdges;f.next();)e=a.indexOf(f.value.toVertex),e!==c&&0>b[c].indexOf(e)&&b[c].push(e);for(d=d.sourceEdges;d.next();)e=a.indexOf(d.value.fromVertex),e!==c&&0>b[c].indexOf(e)&&b[c].push(e)}f=[];for(c=0;c<b.length;c++)f[c]=0;c=[];var g=[],h=[];d=[];e=new E;for(var k=0,l=0;l<b.length;l++){var m=b[l].length;if(1===m)d.push(l);else if(0===m)e.add(a.J(l));else{if(0===k)c.push(l);else{for(var n=m=Infinity,
p=-1,r=[],q=0;q<c.length;q++)0>b[c[q]].indexOf(c[q===c.length-1?0:q+1])&&r.push(q===c.length-1?0:q+1);if(0===r.length)for(q=0;q<c.length;q++)r.push(q);for(q=0;q<r.length;q++){for(var u=r[q],w=b[l],v=0,y=0;y<g.length;y++){var z=f[g[y]],A=f[h[y]];if(z<A){var C=z;z=A}else C=A;if(C<u&&u<=z)for(A=0;A<w.length;A++){var F=w[A];0>c.indexOf(F)||C<f[F]&&f[F]<z||C===f[F]||z===f[F]||v++}else for(A=0;A<w.length;A++)F=w[A],0>c.indexOf(F)||C<f[F]&&f[F]<z&&C!==f[F]&&z!==f[F]&&v++}w=v;for(y=v=0;y<b[l].length;y++)C=
c.indexOf(b[l][y]),0<=C&&(C=Math.abs(u-(C>=u?C+1:C)),v+=C<c.length+1-C?C:c.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<(c.length+2)/2===(C<u&&u<=z)&&v++;if(w<m||w===m&&v<n)m=w,n=v,p=u}c.splice(p,0,l);for(m=0;m<c.length;m++)f[c[m]]=m;for(m=0;m<b[l].length;m++)n=b[l][m],0<=c.indexOf(n)&&(g.push(l),h.push(n))}k++}}for(g=c.length;;){f=!0;for(h=0;h<d.length;h++)if(k=d[h],l=b[k][0],m=c.indexOf(l),0<=m){for(p=n=0;p<b[l].length;p++)r=c.indexOf(b[l][p]),
0>r||r===m||(q=r>m?r-m:m-r,n+=r<m!==q>g-q?1:-1);c.splice(0>n?m:m+1,0,k);d.splice(h,1);h--}else f=!1;if(f)break;else c.push(d[0]),d.splice(0,1)}for(b=0;b<c.length;b++)e.add(a.J(c[b]));return e};
na.Object.defineProperties(qr.prototype,{radius:{get:function(){return this.So},set:function(a){this.So!==a&&(0<a||isNaN(a))&&(this.So=a,this.B())}},aspectRatio:{get:function(){return this.Tm},set:function(a){this.Tm!==a&&0<a&&(this.Tm=a,this.B())}},startAngle:{get:function(){return this.vp},set:function(a){this.vp!==a&&(this.vp=a,this.B())}},sweepAngle:{get:function(){return this.Nl},
set:function(a){this.Nl!==a&&(0<a&&360>=a?this.Nl=a:this.Nl=360,this.B())}},arrangement:{get:function(){return this.Hb},set:function(a){this.Hb===a||a!==Fr&&a!==rr&&a!==Er&&a!==Dr||(this.Hb=a,this.B())}},direction:{get:function(){return this.L},set:function(a){this.L===a||a!==tr&&a!==Cr&&a!==Ar&&a!==Br||(this.L=a,this.B())}},sorting:{get:function(){return this.$c},set:function(a){this.$c===a||a!==yr&&a!==zr&&
a!==wr&&!xr&&a!==ur||(this.$c=a,this.B())}},comparer:{get:function(){return this.Tc},set:function(a){this.Tc!==a&&(this.Tc=a,this.B())}},spacing:{get:function(){return this.jf},set:function(a){this.jf!==a&&(this.jf=a,this.B())}},nodeDiameterFormula:{get:function(){return this.Co},set:function(a){this.Co===a||a!==vr&&a!==Gr||(this.Co=a,this.B())}},actualXRadius:{get:function(){return this.bc}},
actualYRadius:{get:function(){return this.ce}},actualSpacing:{get:function(){return this.hj}},actualCenter:{get:function(){return this.Cw}}});
var rr=new D(qr,"ConstantSpacing",0),Er=new D(qr,"ConstantDistance",1),Dr=new D(qr,"ConstantAngle",2),Fr=new D(qr,"Packed",3),tr=new D(qr,"Clockwise",4),Cr=new D(qr,"Counterclockwise",5),Ar=new D(qr,"BidirectionalLeft",6),Br=new D(qr,"BidirectionalRight",7),yr=new D(qr,"Forwards",8),zr=new D(qr,"Reverse",9),wr=new D(qr,"Ascending",10),xr=new D(qr,"Descending",11),ur=new D(qr,"Optimized",12),vr=new D(qr,"Pythagorean",13),Gr=new D(qr,"Circular",14);qr.className="CircularLayout";qr.ConstantSpacing=rr;
qr.ConstantDistance=Er;qr.ConstantAngle=Dr;qr.Packed=Fr;qr.Clockwise=tr;qr.Counterclockwise=Cr;qr.BidirectionalLeft=Ar;qr.BidirectionalRight=Br;qr.Forwards=yr;qr.Reverse=zr;qr.Ascending=wr;qr.Descending=xr;qr.Optimized=ur;qr.Pythagorean=vr;qr.Circular=Gr;function sr(){this.bm=-Infinity;this.Hm=this.sk=null}
sr.prototype.compare=function(a,b){if(0<a&&0>this.bm||Math.abs(a)<Math.abs(this.bm)&&!(0>a&&0<this.bm))for(this.bm=a,this.sk=[],this.Hm=[],a=0;a<b.length;a++)this.sk[a]=b[a].bounds.x,this.Hm[a]=b[a].bounds.y};sr.prototype.commit=function(a){if(null!==this.sk&&null!==this.Hm)for(var b=0;b<this.sk.length;b++){var c=a.J(b);c.x=this.sk[b];c.y=this.Hm[b]}};sr.className="VertexArrangement";function Hr(a){Pp.call(this,a)}ma(Hr,Pp);Hr.prototype.createVertex=function(){return new Vr(this)};
Hr.prototype.createEdge=function(){return new Wr(this)};Hr.className="CircularNetwork";function Vr(a){cq.call(this,a);this.C=this.gj=NaN}ma(Vr,cq);
function Ir(a,b){var c=a.network;if(null===c)return NaN;c=c.layout;if(null===c)return NaN;if(c.arrangement===Fr)if(c.nodeDiameterFormula===Gr)a.gj=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.gj=Math.min(a.height/c,a.width/b)}else a.gj=c.nodeDiameterFormula===Gr?Math.max(a.width,a.height):Math.sqrt(a.width*a.width+a.height*a.height);return a.gj}
na.Object.defineProperties(Vr.prototype,{diameter:{get:function(){return this.gj},set:function(a){this.gj!==a&&(this.gj=a)}},actualAngle:{get:function(){return this.C},set:function(a){this.C!==a&&(this.C=a)}}});Vr.className="CircularVertex";function Wr(a){dq.call(this,a)}ma(Wr,dq);Wr.className="CircularEdge";
function Xr(a){ni.call(this);this.wh=null;this.bo=0;this.Rd=(new Gb(100,100)).freeze();this.Sm=!1;this.hf=!0;this.jd=!1;this.pl=100;this.wn=1;this.Tf=1E3;this.xo=10;this.To=Math;this.Pk=.05;this.Ok=50;this.Mk=150;this.Nk=0;this.on=10;this.nn=5;a&&Object.assign(this,a)}ma(Xr,ni);
Xr.prototype.cloneProtected=function(a){ni.prototype.cloneProtected.call(this,a);a.Rd.assign(this.Rd);a.Sm=this.Sm;a.hf=this.hf;a.jd=this.jd;a.pl=this.pl;a.wn=this.wn;a.Tf=this.Tf;a.xo=this.xo;a.To=this.To;a.Pk=this.Pk;a.Ok=this.Ok;a.Mk=this.Mk;a.Nk=this.Nk;a.on=this.on;a.nn=this.nn};
Xr.prototype.serializeLayoutProperties=function(a,b){ni.prototype.serializeLayoutProperties.call(this,a,b);a.arrangementSpacing={width:this.arrangementSpacing.width,height:this.arrangementSpacing.height};a.arrangesToOrigin=this.arrangesToOrigin;a.setsPortSpots=this.setsPortSpots;a.comments=this.comments;a.maxIterations=this.maxIterations;a.epsilonDistance=this.epsilonDistance;a.infinityDistance=this.infinityDistance;a.moveLimit=this.moveLimit;a.defaultSpringStiffness=this.defaultSpringStiffness;a.defaultSpringLength=
this.defaultSpringLength;a.defaultElectricalCharge=this.defaultElectricalCharge;a.defaultGravitationalMass=this.defaultGravitationalMass;a.defaultCommentSpringLength=this.defaultCommentSpringLength;a.defaultCommentElectricalCharge=this.defaultCommentElectricalCharge};
Xr.prototype.deserializeLayoutProperties=function(a,b,c,d,e){ni.prototype.deserializeLayoutProperties.call(this,a,b,c,d,e);this.arrangementSpacing=new Gb(a.arrangementSpacing.width,a.arrangementSpacing.height);this.arrangesToOrigin=a.arrangesToOrigin;this.setsPortSpots=a.setsPortSpots;this.comments=a.comments;this.maxIterations=a.maxIterations;this.epsilonDistance=a.epsilonDistance;this.infinityDistance=a.infinityDistance;this.moveLimit=a.moveLimit;this.defaultSpringStiffness=a.defaultSpringStiffness;
this.defaultSpringLength=a.defaultSpringLength;this.defaultElectricalCharge=a.defaultElectricalCharge;this.defaultGravitationalMass=a.defaultGravitationalMass;this.defaultCommentSpringLength=a.defaultCommentSpringLength;this.defaultCommentElectricalCharge=a.defaultCommentElectricalCharge};Xr.prototype.createNetwork=function(){return new Yr(this)};
Xr.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));if(!this.dw()){a=this.maxIterations;if(0<this.network.vertexes.count){this.network.Tp();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.Eu();this.bo=0;if(this.needsClusterLayout()){b=this.network;c=b.Ey();
for(var d=c.iterator;d.next();){this.network=d.value;for(var e=this.network.vertexes.iterator;e.next();){var f=e.value;f.Kd=f.vertexes.count;f.Kh=1;f.Sj=null;f.Me=null}Zr(this,0,a)}this.network=b;var g=d=c.iterator;d=this.arrangementSpacing;var h=g.count,k=!0;f=e=0;for(var l=Ea(),m=0;m<h+b.vertexes.count+2;m++)l[m]=null;h=0;g.reset();for(var n=N.alloc();g.next();)if(m=g.value,this.computeBounds(m,n),k)k=!1,e=n.x+n.width/2,f=n.y+n.height/2,l[0]=new K(n.x+n.width+d.width,n.y),l[1]=new K(n.x,n.y+n.height+
d.height),h=2;else{var p=$r(l,h,e,f,n.width,n.height,d),r=l[p],q=new K(r.x+n.width+d.width,r.y),u=new K(r.x,r.y+n.height+d.height);p+1<h&&l.splice(p+1,0,null);l[p]=q;l[p+1]=u;h++;p=r.x-n.x;r=r.y-n.y;for(m=m.vertexes.iterator;m.next();)q=m.value,q.centerX+=p,q.centerY+=r}N.free(n);for(m=b.vertexes.iterator;m.next();)g=m.value,p=g.bounds,2>h?(e=p.x+p.width/2,f=p.y+p.height/2,l[0]=new K(p.x+p.width+d.width,p.y),l[1]=new K(p.x,p.y+p.height+d.height),h=2):(k=$r(l,h,e,f,p.width,p.height,d),n=l[k],r=new K(n.x+
p.width+d.width,n.y),p=new K(n.x,n.y+p.height+d.height),k+1<h&&l.splice(k+1,0,null),l[k]=r,l[k+1]=p,h++,g.centerX=n.x+g.width/2,g.centerY=n.y+g.height/2);Ia(l);for(d=c.iterator;d.next();){c=d.value;for(e=c.vertexes.iterator;e.next();)b.og(e.value);for(c=c.edges.iterator;c.next();)b.Tl(c.value)}}as(this,a);this.updateParts()}this.pl=a;this.network=null;this.isValidLayout=!0}};
Xr.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.Mc(c)&&(a++,2<a))return!0;if(10<b)break;b++}return!1};Xr.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.Rc(d.bounds)}return b};
function Zr(a,b,c){if(bs(a,b)){var d=a.Tf;a.Tf*=1+1/(b+1);var e=cs(a,b),f=Math.max(0,Math.max(Math.min(a.network.vertexes.count,c*(b+1)/11),10));a.maxIterations+=f;Zr(a,b+1,c);as(a,f);ds(a,e);b=e.vertexes.ya();b.sort(function(a,b){return null===a||null===b||a===b?0:b.Kd-a.Kd});for(c=0;c<b.length;c++)es(a,b[c]);a.Tf=d}}
function bs(a,b){if(10<b||3>a.network.vertexes.count)return!1;a.wh=a.network.vertexes.ya();a=a.wh;a.sort(function(a,b){return null===a||null===b||a===b?0:b.Kd-a.Kd});for(b=a.length-1;0<=b&&1>=a[b].Kd;)b--;return 1<a.length-b}
function cs(a,b){for(var c=a.network,d=new Yr(a),e=0;e<a.wh.length;e++){var f=a.wh[e];if(1<f.Kd){d.og(f);var g=new fs;g.ot=f.Kd;g.st=f.width;g.it=f.height;g.mw=f.focus.x;g.nw=f.focus.y;null===f.Me&&(f.Me=new E);f.Me.add(g);f.Mv=f.Me.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.Tl(h):e.network===d?(h=e.Sj,null===h&&(h=new E,e.Sj=h),h.add(g),e.Kd--,e.Kh+=g.Kh):g.network===d&&(h=g.Sj,null===h&&(h=new E,g.Sj=h),h.add(e),
g.Kd--,g.Kh+=e.Kh)}for(e=d.edges.iterator;e.next();)f=e.value,f.length*=Math.max(1,M.sqrt((f.fromVertex.Kh+f.toVertex.Kh)/(4*b+1)));for(b=d.vertexes.iterator;b.next();){e=b.value;var k=e.Sj;if(null!==k&&0<k.count&&(g=e.Me.J(e.Me.count-1).ot-e.Kd,!(0>=g))){for(var l=h=0,m=k.count-g;m<k.count;m++){var n=k.J(m),p=null;for(f=n.edges.iterator;f.next();){var r=f.value;if(r.Zx(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=M.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 K(p.x+g,p.y+h)}}a.network=d;return c}function ds(a,b){for(var c=a.network.vertexes.iterator;c.next();){var d=c.value;d.network=b;if(null!==d.Me){var e=d.Me.J(d.Mv);d.Kd=e.ot;var f=e.mw,g=e.nw;d.bounds=new N(d.centerX-f,d.centerY-g,e.st,e.it);d.focus=new K(f,g);d.Mv--}}for(c=a.network.edges.iterator;c.next();)c.value.network=b;a.network=b}
function es(a,b){var c=b.Sj;if(null!==c&&0!==c.count){var d=b.centerX,e=b.centerY,f=b.width,g=b.height;null!==b.Me&&0<b.Me.count&&(g=b.Me.J(0),f=g.st,g=g.it);f=M.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.Kd?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.Kd||a.isFixed(k))){m=null;for(n=k.edges.iterator;n.next();){m=n.value;break}n=k.width;var p=k.height;n=M.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 $r(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}Xr.prototype.Eu=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)};
Xr.prototype.addComments=function(a){var b=a.node;if(null!==b)for(b=b.Wu();b.next();){var c=b.value;if("Comment"===c.category&&c.isVisible()){var d=this.network.Ji(c);null===d&&(d=this.network.Pj(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.gk(a,d,null));c.length=this.defaultCommentSpringLength}}};
function gs(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,M.sqrt(c*c+a*a)):a+c<b?(d=d+e-g,a=a+c-b,M.sqrt(d*d+a*a)):g-(d+e):d>g+h?a>b+f?(c=d-g-h,a=a-b-f,M.sqrt(c*c+a*a)):a+c<b?(d=d-g-h,a=a+c-b,M.sqrt(d*d+a*a)):d-(g+h):a>b+f?a-(b+f):a+c<b?b-(a+c):.1}function as(a,b){a.wh=null;for(b=a.bo+b;a.bo<b&&(a.bo++,hs(a)););a.wh=null}
function hs(a){null===a.wh&&(a.wh=a.network.vertexes.ya());var b=a.wh;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=gs(g,p);1>q?(d=a.randomNumberGenerator,null===d&&(a.randomNumberGenerator=d=new is),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=gs(c,f),1>n?(n=a.randomNumberGenerator,null===n&&(a.randomNumberGenerator=n=new is),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}Xr.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};Xr.prototype.moveFixedVertex=function(){};Xr.prototype.commitLayout=function(){this.Qv();this.commitNodes();this.isRouting&&this.commitLinks()};
Xr.prototype.Qv=function(){if(this.setsPortSpots)for(var a=this.network.edges.iterator;a.next();){var b=a.value.link;null!==b&&(b.fromSpot=Wc,b.toSpot=Wc)}};Xr.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)};
Xr.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};Xr.prototype.springStiffness=function(a){a=a.stiffness;return isNaN(a)?this.Pk:a};Xr.prototype.springLength=function(a){a=a.length;return isNaN(a)?this.Ok:a};Xr.prototype.electricalCharge=function(a){a=a.charge;return isNaN(a)?this.Mk:a};Xr.prototype.electricalFieldX=function(){return 0};Xr.prototype.electricalFieldY=function(){return 0};
Xr.prototype.gravitationalMass=function(a){a=a.mass;return isNaN(a)?this.Nk:a};Xr.prototype.gravitationalFieldX=function(){return 0};Xr.prototype.gravitationalFieldY=function(){return 0};Xr.prototype.isFixed=function(a){return a.isFixed};
na.Object.defineProperties(Xr.prototype,{currentIteration:{get:function(){return this.bo}},arrangementSpacing:{get:function(){return this.Rd},set:function(a){this.Rd.A(a)||(this.Rd.assign(a),this.B())}},arrangesToOrigin:{get:function(){return this.Sm},set:function(a){this.Sm!==a&&(this.Sm=a,this.B())}},setsPortSpots:{get:function(){return this.hf},set:function(a){this.hf!==a&&(this.hf=
a,this.B())}},comments:{get:function(){return this.jd},set:function(a){this.jd!==a&&(this.jd=a,this.B())}},maxIterations:{get:function(){return this.pl},set:function(a){this.pl!==a&&0<=a&&(this.pl=a,this.B())}},epsilonDistance:{get:function(){return this.wn},set:function(a){this.wn!==a&&0<a&&(this.wn=a,this.B())}},infinityDistance:{get:function(){return this.Tf},set:function(a){this.Tf!==
a&&1<a&&(this.Tf=a,this.B())}},moveLimit:{get:function(){return this.xo},set:function(a){this.xo!==a&&1<a&&(this.xo=a,this.B())}},randomNumberGenerator:{get:function(){return this.To},set:function(a){this.To!==a&&(null!==a&&"function"!==typeof a.random&&B('ForceDirectedLayout.randomNumberGenerator must have a "random()" function on it: '+a),this.To=a)}},defaultSpringStiffness:{get:function(){return this.Pk},
set:function(a){this.Pk!==a&&(this.Pk=a,this.B())}},defaultSpringLength:{get:function(){return this.Ok},set:function(a){this.Ok!==a&&(this.Ok=a,this.B())}},defaultElectricalCharge:{get:function(){return this.Mk},set:function(a){this.Mk!==a&&(this.Mk=a,this.B())}},defaultGravitationalMass:{get:function(){return this.Nk},set:function(a){this.Nk!==a&&(this.Nk=a,this.B())}},defaultCommentSpringLength:{
get:function(){return this.on},set:function(a){this.on!==a&&(this.on=a,this.B())}},defaultCommentElectricalCharge:{get:function(){return this.nn},set:function(a){this.nn!==a&&(this.nn=a,this.B())}}});Xr.className="ForceDirectedLayout";function fs(){this.nw=this.mw=this.it=this.st=this.ot=0}fs.className="ForceDirectedSubnet";function Yr(a){Pp.call(this,a)}ma(Yr,Pp);Yr.prototype.createVertex=function(){return new js(this)};Yr.prototype.createEdge=function(){return new ks(this)};
Yr.className="ForceDirectedNetwork";function js(a){cq.call(this,a);this.Ba=!1;this.Ma=this.C=NaN;this.Kh=this.Kd=this.wa=this.K=0;this.Me=this.Sj=null;this.Mv=0}ma(js,cq);js.prototype.serializeVertexProperties=function(a,b){cq.prototype.serializeVertexProperties.call(this,a,b);a.isFixed=this.isFixed;a.charge=this.charge;a.mass=this.mass};
js.prototype.deserializeVertexProperties=function(a,b,c,d){cq.prototype.deserializeVertexProperties.call(this,a,b,c,d);this.isFixed=a.isFixed;this.charge=a.charge;this.mass=a.mass};
na.Object.defineProperties(js.prototype,{isFixed:{get:function(){return this.Ba},set:function(a){this.Ba!==a&&(this.Ba=a)}},charge:{get:function(){return this.C},set:function(a){this.C!==a&&(this.C=a)}},mass:{get:function(){return this.Ma},set:function(a){this.Ma!==a&&(this.Ma=a)}},forceX:{get:function(){return this.K},set:function(a){this.K!==a&&(this.K=a)}},forceY:{
get:function(){return this.wa},set:function(a){this.wa!==a&&(this.wa=a)}}});js.className="ForceDirectedVertex";function ks(a){dq.call(this,a);this.j=this.o=NaN}ma(ks,dq);ks.prototype.serializeEdgeProperties=function(a,b){dq.prototype.serializeEdgeProperties.call(this,a,b);a.stiffness=this.stiffness;a.length=this.length};ks.prototype.deserializeEdgeProperties=function(a,b,c,d){dq.prototype.deserializeEdgeProperties.call(this,a,b,c,d);this.stiffness=a.stiffness;this.length=a.length};
na.Object.defineProperties(ks.prototype,{stiffness:{get:function(){return this.o},set:function(a){this.o!==a&&(this.o=a)}},length:{get:function(){return this.j},set:function(a){this.j!==a&&(this.j=a)}}});ks.className="ForceDirectedEdge";function is(){var a=0;void 0===a&&(a=42);this.seed=a;this.Gy=48271;this.Iy=2147483647;this.Q=44488.07041494893;this.Jy=3399;this.Hy=1/2147483647;this.random()}
is.prototype.random=function(){var a=this.seed%this.Q*this.Gy-this.seed/this.Q*this.Jy;0<a?this.seed=a:this.seed=a+this.Iy;return this.seed*this.Hy};is.className="RandomNumberGenerator";
function ls(a){ni.call(this);this.ac=this.ve=25;this.L=0;this.Lk=ms;this.kl=ns;this.$k=os;this.sj=4;this.wk=ps;this.ag=15;this.hf=!0;this.jo=4;this.Ea=this.ji=this.ra=-1;this.wc=this.Wg=0;this.Ka=this.wd=this.xd=this.ae=this.Ab=null;this.dh=0;this.yo=this.zj=null;this.Fc=0;this.zo=null;this.Sc=new K;this.ye=[];this.ye.length=100;a&&Object.assign(this,a)}ma(ls,ni);
ls.prototype.cloneProtected=function(a){ni.prototype.cloneProtected.call(this,a);a.ve=this.ve;a.ac=this.ac;a.L=this.L;a.Lk=this.Lk;a.kl=this.kl;a.$k=this.$k;a.sj=this.sj;a.wk=this.wk;a.ag=this.ag;a.hf=this.hf;a.jo=this.jo};
ls.prototype.serializeLayoutProperties=function(a,b){ni.prototype.serializeLayoutProperties.call(this,a,b);a.layerSpacing=this.layerSpacing;a.columnSpacing=this.columnSpacing;a.direction=this.direction;a.cycleRemoveOption=this.cycleRemoveOption.name;a.layeringOption=this.layeringOption.name;a.initializeOption=this.initializeOption.name;a.iterations=this.iterations;a.aggressiveOption=this.aggressiveOption.name;a.packOption=this.packOption;a.setsPortSpots=this.setsPortSpots;a.linkSpacing=this.linkSpacing;
a.ra=this.ra;a.ji=this.ji;a.Ea=this.Ea;a.Wg=this.Wg;a.wc=this.wc;a.Ab=this.Ab;a.dh=this.dh;a.Fc=this.Fc;a.Sc={x:this.Sc.x,y:this.Sc.y}};
ls.prototype.deserializeLayoutProperties=function(a,b,c,d,e){ni.prototype.deserializeLayoutProperties.call(this,a,b,c,d,e);this.layerSpacing=a.layerSpacing;this.columnSpacing=a.columnSpacing;this.direction=a.direction;this.cycleRemoveOption=Wa(ls,a.cycleRemoveOption);this.layeringOption=Wa(ls,a.layeringOption);this.initializeOption=Wa(ls,a.initializeOption);this.iterations=a.iterations;this.aggressiveOption=Wa(ls,a.aggressiveOption);this.packOption=a.packOption;this.setsPortSpots=a.setsPortSpots;
this.linkSpacing=a.linkSpacing;this.ra=a.ra;this.ji=a.ji;this.Ea=a.Ea;this.Wg=a.Wg;this.wc=a.wc;this.Ab=a.Ab;this.dh=a.dh;this.Fc=a.Fc;this.Sc=new K(this.Sc.x,this.Sc.y);e&&!d&&e.edges.each(function(a){if(!a.link&&a.fromVertex&&a.toVertex&&(null===a.fromVertex.node||null===a.toVertex.node)){for(var b=a.fromVertex;null!==b&&null===b.node&&0<b.sd.count;){var c=b.sd.J(0);if(c.link){a.link=c.link;break}b=c.fromVertex}if(!a.link){for(c=a.toVertex;null!==c&&null===c.node&&0<c.Fd.count;){var d=c.Fd.J(0);
if(d.link){a.link=d.link;break}c=d.toVertex}if(!a.link)for(c=c.sd.iterator;c.next();)if(d=c.value,d.link&&d.fromVertex===b){a.link=d.link;break}}}})};ls.prototype.gb=function(a){a.classType===ls?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):ni.prototype.gb.call(this,a)};ls.prototype.createNetwork=function(){return new qs(this)};
ls.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);this.ji=-1;this.wc=this.Wg=0;this.zo=this.yo=this.zj=null;for(a=0;a<this.ye.length;a++)this.ye[a]=null;if(0<this.network.vertexes.count){this.network.Tp();if(this.dw())return;this.cycleRemoveOption!==rs&&this.removeCycles();for(a=this.network.vertexes.iterator;a.next();)a.value.layer=-1;this.ra=-1;this.assignLayers();for(a.reset();a.next();)this.ra=
Math.max(this.ra,a.value.layer);this.cycleRemoveOption===rs&&this.removeCycles();a=this.network;for(var b=[],c=a.edges.iterator;c.next();){var d=c.value;d.valid=!1;b.push(d)}for(c=0;c<b.length;c++){d=b[c];var e=d.fromVertex,f=d.toVertex;if(!(d.valid||(null===e.node&&null===e.data||null===f.node&&null===f.data)&&e.layer===f.layer)){var g=0,h=0,k=0,l=0;if(null!==d.link){h=d.link;if(null===h)continue;var m=e.node;g=f.node;if(null===m||null===g)continue;var n=h.fromNode;k=h.toNode;var p=h.fromPort;h=
h.toPort;if(d.rev){l=n;var r=p;n=k;p=h;k=l;h=r}var q=e.focus;l=f.focus;var u=d.rev?f.bounds:e.bounds;r=K.alloc();m!==n?u.u()&&n.isVisible()?n.actualBounds.u()?(ro(n,p,yc,r),r.x+=n.actualBounds.x-u.x,r.y+=n.actualBounds.y-u.y):(ro(n,p,yc,r),r.u()||r.assign(q)):r.assign(q):u.u()?(ro(n,p,yc,r),r.u()||r.assign(q)):r.assign(q);n=d.rev?e.bounds:f.bounds;m=K.alloc();g!==k?n.u()&&k.isVisible()?k.actualBounds.u()?(ro(k,h,yc,m),m.x+=k.actualBounds.x-n.x,m.y+=k.actualBounds.y-n.y):(ro(k,h,yc,m),m.u()||m.assign(l)):
m.assign(l):n.u()?(ro(k,h,yc,m),m.u()||m.assign(l)):m.assign(l);90===this.L||270===this.L?(g=Math.round((r.x-q.x)/this.ac),k=r.x,h=Math.round((m.x-l.x)/this.ac),l=m.x):(g=Math.round((r.y-q.y)/this.ac),k=r.y,h=Math.round((m.y-l.y)/this.ac),l=m.y);K.free(r);K.free(m);d.portFromColOffset=g;d.portFromPos=k;d.portToColOffset=h;d.portToPos=l}else d.portFromColOffset=0,d.portFromPos=0,d.portToColOffset=0,d.portToPos=0;r=e.layer;m=f.layer;n=0;u=d.link;if(null!==u){var w=u.fromPort,v=u.toPort;if(null!==w&&
null!==v){var y=u.fromNode;p=u.toNode;if(null!==y&&null!==p){var z=ss(this,!0),A=ss(this,!1),C=this.setsPortSpots?z:u.computeSpot(!0,w);q=this.setsPortSpots?A:u.computeSpot(!1,v);var F=u.isOrthogonal;C.Oc()&&C.Df(A)&&q.Oc()&&q.Df(z)?n=0:(z=u.getLinkPoint(y,w,C,!0,F,p,v,K.alloc()),A=u.getLinkDirection(y,w,z,C,!0,F,p,v),K.free(z),C.Es()||A!==ts(this,d,!0)?this.setsPortSpots&&null!==y&&1===y.ports.count&&d.rev&&(n+=1):n+=1,C=u.getLinkPoint(p,v,q,!1,F,y,w,K.alloc()),u=u.getLinkDirection(p,v,C,q,!1,F,
y,w),K.free(C),q.Es()||u!==ts(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.uf=1,q.layer=r,q.near=e,a.og(q),e=a.gk(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.uf=2;q.layer=r-1;a.og(q);e=a.gk(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.uf=3,q.layer=r-1,a.og(q),e=a.gk(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.gk(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.Ab=[];for(b=0;b<=this.ra;b++)a[b]=0;for(b=this.network.vertexes.iterator;b.next();)b.value.index=
-1;this.initializeIndices();this.ji=-1;for(c=this.wc=this.Wg=0;c<=this.ra;c++)a[c]>a[this.wc]&&(this.ji=a[c]-1,this.wc=c),a[c]<a[this.Wg]&&(this.Wg=c);this.zo=[];for(c=0;c<a.length;c++)this.zo[c]=[];for(b.reset();b.next();)a=b.value,this.zo[a.layer][a.index]=a;this.Ea=-1;for(a=0;a<=this.ra;a++){b=us(this,a);c=0;d=this.Ab[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);vs(this,a,b)}this.reduceCrossings();this.straightenAndPack();
this.updateParts()}this.network=null;this.isValidLayout=!0};ls.prototype.linkMinLength=function(){return 1};function ws(a){var b=a.fromVertex.node||a.fromVertex.data;a=a.toVertex.node||a.toVertex.data;return null===b&&null===a?8:null===b||null===a?4:1}ls.prototype.nodeMinLayerSpace=function(a,b){return null===a.node&&null===a.data?0:90===this.L||270===this.L?b?a.focus.y+10:a.bounds.height-a.focus.y+10:b?a.focus.x+10:a.bounds.width-a.focus.x+10};
ls.prototype.nodeMinColumnSpace=function(a,b){if(null===a.node&&null===a.data)return 0;var c=b?a.kk:a.jk;if(null!==c)return c;c=this.L;return 90===c||270===c?b?a.kk=a.focus.x/this.ac+1|0:a.jk=(a.bounds.width-a.focus.x)/this.ac+1|0:b?a.kk=a.focus.y/this.ac+1|0:a.jk=(a.bounds.height-a.focus.y)/this.ac+1|0};function xs(a){null===a.zj&&(a.zj=[]);for(var b=0,c=a.network.vertexes.iterator;c.next();){var d=c.value;a.zj[b]=d.layer;b++;a.zj[b]=d.column;b++;a.zj[b]=d.index;b++}return a.zj}
function ys(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 zs(a,b,c){var d=us(a,b),e=a.Ab[b];if(null===a.yo||a.yo.length<e*e)a.yo=[];for(var f=a.yo,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.uf===l.uf||h++}else for(m=g-1;m>k;m--)n=d[m],n.near===l&&n.uf===l.uf||h++;var p;if(0<=c)for(k=d[g].sourceEdgesArrayAccess,l=0;l<k.length;l++){var r=k[l];if(r.valid&&r.fromVertex.layer!==b)for(n=r.fromVertex.index,m=r.portToPos,r=r.portFromPos,p=l+1;p<k.length;p++){var q=
k[p];if(q.valid&&q.fromVertex.layer!==b){var u=q.fromVertex.index;var w=q.portToPos;q=q.portFromPos;m<w&&(n>u||n===u&&r>q)&&h++;w<m&&(u>n||u===n&&q>r)&&h++}}}if(0>=c)for(k=d[g].destinationEdgesArrayAccess,l=0;l<k.length;l++)if(r=k[l],r.valid&&r.toVertex.layer!==b)for(n=r.toVertex.index,m=r.portToPos,r=r.portFromPos,p=l+1;p<k.length;p++)q=k[p],q.valid&&q.toVertex.layer!==b&&(u=q.toVertex.index,w=q.portToPos,q=q.portFromPos,r<q&&(n>u||n===u&&m>w)&&h++,q<r&&(u>n||u===n&&w>m)&&h++);f[g*e+g]=h;for(k=g+
1;k<e;k++){var v=0,y=0;if(0<=c){h=d[g].sourceEdgesArrayAccess;var z=d[k].sourceEdgesArrayAccess;for(l=0;l<h.length;l++)if(r=h[l],r.valid&&r.fromVertex.layer!==b)for(n=r.fromVertex.index,r=r.portFromPos,p=0;p<z.length;p++)q=z[p],q.valid&&q.fromVertex.layer!==b&&(u=q.fromVertex.index,q=q.portFromPos,(n<u||n===u&&r<q)&&y++,(u<n||u===n&&q<r)&&v++)}if(0>=c)for(h=d[g].destinationEdgesArrayAccess,z=d[k].destinationEdgesArrayAccess,l=0;l<h.length;l++)if(r=h[l],r.valid&&r.toVertex.layer!==b)for(n=r.toVertex.index,
m=r.portToPos,p=0;p<z.length;p++)q=z[p],q.valid&&q.toVertex.layer!==b&&(u=q.toVertex.index,w=q.portToPos,(n<u||n===u&&m<w)&&y++,(u<n||u===n&&w<m)&&v++);f[g*e+k]=v;f[k*e+g]=y}}vs(a,b,d);return f}ls.prototype.countCrossings=function(){for(var a=0,b=0;b<=this.ra;b++)for(var c=zs(this,b,1),d=this.Ab[b],e=0;e<d;e++)for(var f=e;f<d;f++)a+=c[e*d+f];return a};
function As(a){for(var b=0,c=0;c<=a.ra;c++){for(var d=a,e=c,f=us(d,e),g=d.Ab[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)*ws(n)}}}vs(d,e,f);b+=h}return b}
ls.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 Bs(a,b,c){for(var d=us(a,b),e=a.Ab[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}vs(a,b,d);return f}
function Cs(a,b,c){for(var d=us(a,b),e=a.Ab[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)}vs(a,b,d);return f}function Ds(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&&Ds(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&&Ds(a,k,c,d,e,f)}}
function Es(a,b,c,d,e,f){if(b.component===d){b.component=c;if(e)for(var g=b.destinationEdges;g.next();)Es(a,g.value.toVertex,c,d,e,f);if(f)for(b=b.sourceEdges;b.next();)Es(a,b.value.fromVertex,c,d,e,f)}}
ls.prototype.removeCycles=function(){for(var a=this.network.edges.iterator;a.next();)a.value.rev=!1;switch(this.Lk){default:case Fs: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!==Gs(a);){for(e=Hs(a);null!==e;)d[c]=e,c--,e.valid=!1,e=Hs(a);for(e=Is(a);null!==e;)d[b]=e,b++,e.valid=!1,e=Is(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.sm(b),b.rev=!0);break;case ms:for(d=this.network.vertexes.iterator;d.next();)a=d.value,a.pg=-1,a.finish=-1;for(a=this.network.edges.iterator;a.next();)a.value.forest=!1;this.dh=0;for(d.reset();d.next();)b=d.value,0===b.sourceEdges.count&&
Js(this,b);for(d.reset();d.next();)b=d.value,-1===b.pg&&Js(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.pg<b.pg&&c<f&&(this.network.sm(d),d.rev=!0));break;case rs: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.sm(b),b.rev=!0)}}};function Gs(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid)return b}return null}function Hs(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 Is(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 Js(a,b){b.pg=a.dh;a.dh++;for(var c=b.destinationEdges;c.next();){var d=c.value,e=d.toVertex;-1===e.pg&&(d.forest=!0,Js(a,e))}b.finish=a.dh;a.dh++}
ls.prototype.assignLayers=function(){switch(this.kl){case Ks:Ls(this);break;case Ms:for(var a,b=this.network.vertexes.iterator;b.next();)a=Ns(this,b.value),this.ra=Math.max(a,this.ra);for(b.reset();b.next();)a=b.value,a.layer=this.ra-a.layer;break;default:case ns:Ls(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&&Os(this,a);a=Infinity;for(b.reset();b.next();)a=Math.min(a,b.value.layer);this.ra=-1;for(b.reset();b.next();){var c=
b.value;c.layer-=a;this.ra=Math.max(this.ra,c.layer)}}};function Ls(a){for(var b=a.network.vertexes.iterator;b.next();){var c=Ps(a,b.value);a.ra=Math.max(c,a.ra)}}function Ps(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,Ps(a,f)+e)}b.layer=c}else c=b.layer;return c}
function Ns(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,Ns(a,f)+e)}b.layer=c}else c=b.layer;return c}
function Os(a,b){if(!b.valid){b.valid=!0;for(var c=b.destinationEdges;c.next();)Os(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&&Ds(a,h,0,-1,!0,!1)}for(Ds(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(Ds(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 ts(a,b,c){return 90===a.L?c&&!b.rev||!c&&b.rev?270:90:180===a.L?c&&!b.rev||!c&&b.rev?0:180:270===a.L?c&&!b.rev||!c&&b.rev?90:270:c&&!b.rev||!c&&b.rev?180:0}
ls.prototype.initializeIndices=function(){switch(this.$k){default:case Qs:for(var a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;b.index=this.Ab[c];this.Ab[c]++}break;case os:a=this.network.vertexes.iterator;for(b=this.ra;0<=b;b--)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&Rs(this,c);break;case Ss:for(a=this.network.vertexes.iterator,b=0;b<=this.ra;b++)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&Ts(this,c)}};
function Rs(a,b){var c=b.layer;b.index=a.Ab[c];a.Ab[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&&Rs(a,d))}
function Ts(a,b){var c=b.layer;b.index=a.Ab[c];a.Ab[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&&Ts(a,d))}
ls.prototype.reduceCrossings=function(){var a=this.countCrossings(),b=xs(this),c,d;for(c=0;c<this.sj;c++){for(d=0;d<=this.ra;d++)Us(this,d,1),Vs(this,d,1);var e=this.countCrossings();e<a&&(a=e,b=xs(this));for(d=this.ra;0<=d;d--)Us(this,d,-1),Vs(this,d,-1);e=this.countCrossings();e<a&&(a=e,b=xs(this))}ys(this,b);for(c=0;c<this.sj;c++){for(d=0;d<=this.ra;d++)Us(this,d,0),Vs(this,d,0);e=this.countCrossings();e<a&&(a=e,b=xs(this));for(d=this.ra;0<=d;d--)Us(this,d,0),Vs(this,d,0);e=this.countCrossings();
e<a&&(a=e,b=xs(this))}ys(this,b);var f,g,h;switch(this.wk){case Ws:break;case Xs:for(h=a+1;(d=this.countCrossings())<h;)for(h=d,c=this.ra;0<=c;c--)for(g=0;g<=c;g++){for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Vs(this,d,-1)||f;e=this.countCrossings();e>=a?ys(this,b):(a=e,b=xs(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Vs(this,d,1)||f;e=this.countCrossings();e>=a?ys(this,b):(a=e,b=xs(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Vs(this,d,1)||f;e>=a?ys(this,b):(a=e,b=xs(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=
Vs(this,d,-1)||f;e>=a?ys(this,b):(a=e,b=xs(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Vs(this,d,0)||f;e>=a?ys(this,b):(a=e,b=xs(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Vs(this,d,0)||f;e>=a?ys(this,b):(a=e,b=xs(this))}break;default:case ps:for(c=this.ra,g=0,h=a+1;(d=this.countCrossings())<h;){h=d;for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Vs(this,d,-1)||f;e=this.countCrossings();e>=a?ys(this,b):(a=e,b=xs(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Vs(this,d,1)||f;e=this.countCrossings();e>=a?ys(this,b):
(a=e,b=xs(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Vs(this,d,1)||f;e>=a?ys(this,b):(a=e,b=xs(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Vs(this,d,-1)||f;e>=a?ys(this,b):(a=e,b=xs(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Vs(this,d,0)||f;e>=a?ys(this,b):(a=e,b=xs(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Vs(this,d,0)||f;e>=a?ys(this,b):(a=e,b=xs(this))}}ys(this,b)};
function Us(a,b,c){var d=us(a,b),e=a.Ab[b],f=Cs(a,b,c),g=Bs(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);vs(a,b,d)}
function Vs(a,b,c){var d=us(a,b),e=a.Ab[b];c=zs(a,b,c);var f;var g=[];for(f=0;f<e;f++)g[f]=-1;var h=[];for(f=0;f<e;f++)h[f]=-1;for(var k=!1,l=!0;l;)for(l=!1,f=0;f<e-1;f++){var m=c[d[f].index*e+d[f+1].index],n=c[d[f+1].index*e+d[f].index],p=0,r=0,q=d[f].column,u=d[f+1].column,w=a.nodeMinColumnSpace(d[f],!0),v=a.nodeMinColumnSpace(d[f],!1),y=a.nodeMinColumnSpace(d[f+1],!0),z=a.nodeMinColumnSpace(d[f+1],!1);w=q-w+y;v=u-v+z;var A=d[f].sourceEdges.iterator;for(A.reset();A.next();)if(y=A.value,z=y.fromVertex,
y.valid&&z.layer===b){for(y=0;d[y]!==z;)y++;y<f&&(p+=2*(f-y),r+=2*(f+1-y));y===f+1&&(p+=1);y>f+1&&(p+=4*(y-f),r+=4*(y-(f+1)))}A=d[f].destinationEdges.iterator;for(A.reset();A.next();)if(y=A.value,z=y.toVertex,y.valid&&z.layer===b){for(y=0;d[y]!==z;)y++;y===f+1&&(r+=1)}A=d[f+1].sourceEdges.iterator;for(A.reset();A.next();)if(y=A.value,z=y.fromVertex,y.valid&&z.layer===b){for(y=0;d[y]!==z;)y++;y<f&&(p+=2*(f+1-y),r+=2*(f-y));y===f&&(r+=1);y>f+1&&(p+=4*(y-(f+1)),r+=4*(y-f))}A=d[f+1].destinationEdges.iterator;
for(A.reset();A.next();)if(y=A.value,z=y.toVertex,y.valid&&z.layer===b){for(y=0;d[y]!==z;)y++;y===f&&(p+=1)}y=z=0;A=g[d[f].index];var C=h[d[f].index],F=g[d[f+1].index],R=h[d[f+1].index];-1!==A&&(z+=Math.abs(A-q),y+=Math.abs(A-v));-1!==C&&(z+=Math.abs(C-q),y+=Math.abs(C-v));-1!==F&&(z+=Math.abs(F-u),y+=Math.abs(F-w));-1!==R&&(z+=Math.abs(R-u),y+=Math.abs(R-w));if(r<p-.5||r===p&&n<m-.5||r===p&&n===m&&y<z-.5)l=k=!0,d[f].column=v,d[f+1].column=w,m=d[f],d[f]=d[f+1],d[f+1]=m}for(f=0;f<e;f++)d[f].index=
f;vs(a,b,d);return k}
ls.prototype.straightenAndPack=function(){var a=0!==(this.ag&1);var b=0!==(this.ag&Ys);1E3<this.network.edges.count&&b&&(a=!1);if(a){var c=[];for(b=0;b<=this.ra;b++)c[b]=0;for(var d,e=this.network.vertexes.iterator;e.next();){var f=e.value;b=f.layer;d=f.column;f=this.nodeMinColumnSpace(f,!1);c[b]=Math.max(c[b],d+f)}for(e.reset();e.next();)f=e.value,b=f.layer,d=f.column,f.column=(8*(this.Ea-c[b])>>1)+8*d;this.Ea*=8}if(0!==(this.ag&2))for(c=!0;c;){c=!1;for(b=this.wc+1;b<=this.ra;b++)c=Zs(this,b,1)||
c;for(b=this.wc-1;0<=b;b--)c=Zs(this,b,-1)||c;c=Zs(this,this.wc,0)||c}if(0!==(this.ag&4)){for(b=this.wc+1;b<=this.ra;b++)$s(this,b,1);for(b=this.wc-1;0<=b;b--)$s(this,b,-1);$s(this,this.wc,0)}a&&(at(this,-1),at(this,1));if(0!==(this.ag&2))for(c=!0;c;){c=!1;c=Zs(this,this.wc,0)||c;for(b=this.wc+1;b<=this.ra;b++)c=Zs(this,b,0)||c;for(b=this.wc-1;0<=b;b--)c=Zs(this,b,0)||c}};function Zs(a,b,c){for(var d=!1;bt(a,b,c);)d=!0;return d}
function bt(a,b,c){var d,e=us(a,b),f=a.Ab[b],g=Bs(a,b,-1);if(0<c)for(d=0;d<f;d++)g[d]=-1;var h=Bs(a,b,1);if(0>c)for(d=0;d<f;d++)h[d]=-1;for(var k=!1,l=!0;l;)for(l=!1,d=0;d<f;d++){var m=e[d].column,n=a.nodeMinColumnSpace(e[d],!0),p=a.nodeMinColumnSpace(e[d],!1),r=0;0>d-1||m-e[d-1].column-1>n+a.nodeMinColumnSpace(e[d-1],!1)?r=m-1:r=m;n=d+1>=f||e[d+1].column-m-1>p+a.nodeMinColumnSpace(e[d+1],!0)?m+1:m;var q=p=0,u=0;if(0>=c)for(var w=e[d].sourceEdges.iterator;w.next();){var v=w.value;var y=v.fromVertex;
if(v.valid&&y.layer!==b){var z=ws(v);var A=v.portFromColOffset;v=v.portToColOffset;y=y.column;p+=(Math.abs(m+v-(y+A))+1)*z;q+=(Math.abs(r+v-(y+A))+1)*z;u+=(Math.abs(n+v-(y+A))+1)*z}}if(0<=c)for(w=e[d].destinationEdges.iterator;w.next();)v=w.value,y=v.toVertex,v.valid&&y.layer!==b&&(z=ws(v),A=v.portFromColOffset,v=v.portToColOffset,y=y.column,p+=(Math.abs(m+A-(y+v))+1)*z,q+=(Math.abs(r+A-(y+v))+1)*z,u+=(Math.abs(n+A-(y+v))+1)*z);v=A=z=0;w=g[e[d].index];y=h[e[d].index];-1!==w&&(z+=Math.abs(w-m),A+=
Math.abs(w-r),v+=Math.abs(w-n));-1!==y&&(z+=Math.abs(y-m),A+=Math.abs(y-r),v+=Math.abs(y-n));if(q<p||q===p&&A<z)l=k=!0,e[d].column=r;else if(u<p||u===p&&v<z)l=k=!0,e[d].column=n}vs(a,b,e);a.normalize();return k}
function $s(a,b,c){var d=us(a,b),e=a.Ab[b],f=Cs(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)}vs(a,b,d);a.normalize()}
function ct(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 dt(a,b){var c=b+1;var d,e=[],f=[];for(d=0;d<=a.ra;d++)e[d]=!1,f[d]=!1;for(var g=a.network.vertexes.iterator;g.next();){d=g.value;var h=d.column-a.nodeMinColumnSpace(d,!0),k=d.column+a.nodeMinColumnSpace(d,!1);h<=b&&k>=b&&(e[d.layer]=!0);h<=c&&k>=c&&(f[d.layer]=!0)}h=!0;c=!1;for(d=0;d<=a.ra;d++)h=h&&!(e[d]&&f[d]);if(h)for(g.reset();g.next();)a=g.value,a.column>b&&(--a.column,c=!0);return c}
function at(a,b){for(var c=0;c<=a.Ea;c++)for(;ct(a,c););a.normalize();for(c=0;c<a.Ea;c++)for(;dt(a,c););a.normalize();var d;if(0<b)for(c=0;c<=a.Ea;c++){var e=xs(a);var f=As(a);for(d=f+1;f<d;){d=f;et(a,c,1);var g=As(a);g>f?ys(a,e):g<f&&(f=g,e=xs(a))}}if(0>b)for(c=a.Ea;0<=c;c--)for(e=xs(a),f=As(a),d=f+1;f<d;)d=f,et(a,c,-1),g=As(a),g>f?ys(a,e):g<f&&(f=g,e=xs(a));a.normalize()}
function et(a,b,c){a.Fc=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.Fc)}if(0>c)for(d.reset();d.next();)e=d.value,e.column+a.nodeMinColumnSpace(e,!1)>=b&&(e.component=a.Fc);a.Fc++;for(d.reset();d.next();)b=d.value,-1===b.component&&(Es(a,b,a.Fc,-1,!0,!0),a.Fc++);var f;b=[];for(f=0;f<a.Fc*a.Fc;f++)b[f]=!1;e=[];for(f=0;f<(a.ra+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.ra;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.Fc+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.Fc+e[f*(a.Ea+1)+g-1]]=!0)}e=
[];for(f=0;f<a.Fc;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.Fc;f++)b[k*a.Fc+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)}
ls.prototype.commitLayout=function(){if(this.setsPortSpots)for(var a=ss(this,!0),b=ss(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.Ku();this.isRouting&&this.commitLinks()};function ss(a,b){return 270===a.L?b?ad:dd:90===a.L?b?dd:ad:180===a.L?b?bd:cd:b?cd:bd}
ls.prototype.commitNodes=function(){this.ae=[];this.xd=[];this.wd=[];this.Ka=[];for(var a=0;a<=this.ra;a++)this.ae[a]=0,this.xd[a]=0,this.wd[a]=0,this.Ka[a]=0;for(a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;this.ae[c]=Math.max(this.ae[c],this.nodeMinLayerSpace(b,!0));this.xd[c]=Math.max(this.xd[c],this.nodeMinLayerSpace(b,!1))}b=0;c=this.ve;for(var d=0;d<=this.ra;d++){var e=c;0>=this.ae[d]+this.xd[d]&&(e=0);0<d&&(b+=e/2);90===this.L||0===this.L?(b+=this.xd[d],this.wd[d]=b,
b+=this.ae[d]):(b+=this.ae[d],this.wd[d]=b,b+=this.xd[d]);d<this.ra&&(b+=e/2);this.Ka[d]=b}c=b;b=this.arrangementOrigin;for(d=0;d<=this.ra;d++)270===this.L?this.wd[d]=b.y+this.wd[d]:90===this.L?(this.wd[d]=b.y+c-this.wd[d],this.Ka[d]=c-this.Ka[d]):180===this.L?this.wd[d]=b.x+this.wd[d]:(this.wd[d]=b.x+c-this.wd[d],this.Ka[d]=c-this.Ka[d]);a.reset();for(c=d=Infinity;a.next();){e=a.value;var f=e.layer,g=e.column|0;if(270===this.L||90===this.L){var h=b.x+this.ac*g;f=this.wd[f]}else h=this.wd[f],f=b.y+
this.ac*g;e.centerX=h;e.centerY=f;d=Math.min(e.x,d);c=Math.min(e.y,c)}d=b.x-d;b=b.y-c;this.Sc=new K(d,b);for(a.reset();a.next();)c=a.value,c.x+=d,c.y+=b,c.commit()};
ls.prototype.Ku=function(){for(var a=0,b=this.ve,c=0;c<=this.ra;c++)a+=this.ae[c],a+=this.xd[c];a+=this.ra*b;b=[];c=this.ac*this.Ea;for(var d=this.maxLayer;0<=d;d--)270===this.L?0===d?b.push(new N(0,0,c,Math.abs(this.Ka[0]))):b.push(new N(0,this.Ka[d-1],c,Math.abs(this.Ka[d-1]-this.Ka[d]))):90===this.L?0===d?b.push(new N(0,this.Ka[0],c,Math.abs(this.Ka[0]-a))):b.push(new N(0,this.Ka[d],c,Math.abs(this.Ka[d-1]-this.Ka[d]))):180===this.L?0===d?b.push(new N(0,0,Math.abs(this.Ka[0]),c)):b.push(new N(this.Ka[d-
1],0,Math.abs(this.Ka[d-1]-this.Ka[d]),c)):0===d?b.push(new N(this.Ka[0],0,Math.abs(this.Ka[0]-a),c)):b.push(new N(this.Ka[d],0,Math.abs(this.Ka[d-1]-this.Ka[d]),c));this.commitLayers(b,this.Sc)};ls.prototype.commitLayers=function(){};
ls.prototype.commitLinks=function(){for(var a=this.network.edges.iterator,b;a.next();)b=a.value.link,null!==b&&(b.Lh(),b.Rj(),b.vf());for(a.reset();a.next();)b=a.value.link,null!==b&&b.vg();for(a.reset();a.next();){var c=a.value;b=c.link;if(null!==b){b.Lh();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===Uf&&4===b.pointsCount)if(m.column===n.column)c=b.getLinkPoint(e,g,l,!0,!1,f,h),g=b.getLinkPoint(f,h,k,!1,!1,e,g),c.u()||c.set(e.actualBounds.center),g.u()||g.set(f.actualBounds.center),b.Rj(),b.tf(c.x,c.y),b.tf((2*c.x+g.x)/3,(2*c.y+g.y)/3),b.tf((c.x+2*g.x)/3,(c.y+2*g.y)/3),b.tf(g.x,g.y);else{var p=!1,r=!1;null!==g&&l===rc&&(p=!0);null!==h&&k===rc&&(r=!0);if(p||r){var q=b.i(0).x;c=b.i(0).y;m=b.i(3).x;d=b.i(3).y;p&&(90===this.L||270===this.L?(p=q,n=
(c+d)/2):(p=(q+m)/2,n=c),b.M(1,p,n),l=b.getLinkPoint(e,g,l,!0,!1,f,h),l.u()||l.set(e.actualBounds.center),b.M(0,l.x,l.y));r&&(90===this.L||270===this.L?(l=m,c=(c+d)/2):(l=(q+m)/2,c=d),b.M(2,l,c),e=b.getLinkPoint(f,h,k,!1,!1,e,g),e.u()||e.set(f.actualBounds.center),b.M(3,e.x,e.y))}}b.vf()}else if(m.layer===n.layer)b.vf();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===Uf)r=!0,u=b.pointsCount,4<u&&b.points.removeRange(2,
u-3),4===u&&(q=2);else{u=b.pointsCount;var w=l===rc,v=k===rc;2<u&&w&&v?b.points.removeRange(1,u-2):3<u&&w&&!v?b.points.removeRange(1,u-3):3<u&&!w&&v?b.points.removeRange(2,u-2):4<u&&!w&&!v&&b.points.removeRange(2,u-3)}if(c.rev){for(;null!==n&&m!==n;){var y=u=null;for(w=n.sourceEdges.iterator;w.next()&&(v=w.value,v.link!==c.link||(u=v.fromVertex,y=v.toVertex,null!==u.node)););if(null===u)break;if(u!==m){w=b.i(q-1).x;v=b.i(q-1).y;var z=u.centerX;var A=u.centerY;if(p)180===this.L||0===this.L?q===b.firstPickIndex+
1?(b.m(q++,w,v),b.m(q++,w,A)):(null!==y?y.centerY:v)!==A&&(y=this.Ka[u.layer-1]+this.Sc.x,b.m(q++,y,v),b.m(q++,y,A)):q===b.firstPickIndex+1?(b.m(q++,w,v),b.m(q++,z,v)):(null!==y?y.centerX:w)!==z&&(y=this.Ka[u.layer-1]+this.Sc.y,b.m(q++,w,y),b.m(q++,z,y));else if(q===b.firstPickIndex+1){y=Math.max(10,this.ae[n.layer]);var C=Math.max(10,this.xd[n.layer]);if(r)180===this.L?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.L?
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.L?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.L&&(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++,w,v);var F=0;if(180===this.L||0===this.L){if(180===this.L?z>=n.bounds.right:
z<=n.bounds.x)F=(0===this.L?-y:C)/2;b.m(q++,w+F,A)}else{if(270===this.L?A>=n.bounds.bottom:A<=n.bounds.y)F=(90===this.L?-y:C)/2;b.m(q++,z,v+F)}b.m(q++,z,A)}}else y=Math.max(10,this.ae[u.layer]),C=Math.max(10,this.xd[u.layer]),180===this.L?(r&&b.m(q++,z-y,A),b.m(q++,z,A),r&&b.m(q++,z+C,A)):90===this.L?(r&&b.m(q++,z,A+C),b.m(q++,z,A),r&&b.m(q++,z,A-y)):270===this.L?(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!==rc||p)if(w=b.i(q-
1).x,v=b.i(q-1).y,z=b.i(q).x,A=b.i(q).y,p)n=this.xd[m.layer],180===this.L||0===this.L?(p=v,p>=m.bounds.y&&p<=m.bounds.bottom&&(180===this.L?z>=m.bounds.x:z<=m.bounds.right)&&(n=m.centerX+(180===this.L?-n:n),p<m.bounds.y+m.bounds.height/2?p=m.bounds.y-this.ac/2:p=m.bounds.bottom+this.ac/2,b.m(q++,n,v),b.m(q++,n,p)),b.m(q++,z,p)):(p=w,p>=m.bounds.x&&p<=m.bounds.right&&(270===this.L?A>=m.bounds.y:A<=m.bounds.bottom)&&(n=m.centerY+(270===this.L?-n:n),p<m.bounds.x+m.bounds.width/2?p=m.bounds.x-this.ac/
2:p=m.bounds.right+this.ac/2,b.m(q++,w,n),b.m(q++,p,n)),b.m(q++,p,A)),b.m(q++,z,A);else if(r)y=Math.max(10,this.ae[m.layer]),C=Math.max(10,this.xd[m.layer]),180===this.L&&z>=m.bounds.x?(n=m.bounds.x+m.bounds.width,b.M(q-2,n,v),b.M(q-1,n+C,v)):90===this.L&&A<=m.bounds.bottom?(n=m.bounds.y,b.M(q-2,w,n),b.M(q-1,w,n-y)):270===this.L&&A>=m.bounds.y?(n=m.bounds.y+m.bounds.height,b.M(q-2,w,n),b.M(q-1,w,n+C)):0===this.L&&z<=m.bounds.right&&(n=m.bounds.x,b.M(q-2,n,v),b.M(q-1,n-y,v));else{y=Math.max(10,this.ae[m.layer]);
C=Math.max(10,this.xd[m.layer]);p=0;if(180===this.L||0===this.L){if(180===this.L?z<=m.bounds.x:z>=m.bounds.right)p=(0===this.L?C:-y)/2;b.m(q++,z+p,v)}else{if(270===this.L?A<=m.bounds.y:A>=m.bounds.bottom)p=(90===this.L?C:-y)/2;b.m(q++,w,A+p)}b.m(q++,z,A)}}else{for(;null!==m&&m!==n;){y=u=null;for(m=m.destinationEdges.iterator;m.next()&&(w=m.value,w.link!==c.link||(u=w.toVertex,y=w.fromVertex,null!==y.node&&(y=null),null!==u.node)););if(null===u)break;u!==n&&(w=b.i(q-1).x,v=b.i(q-1).y,z=u.centerX,A=
u.centerY,p?180===this.L||0===this.L?(null!==y?y.centerY:v)!==A&&(y=this.Ka[u.layer]+this.Sc.x,q===b.firstPickIndex+1&&(y=0===this.L?Math.max(y,w):Math.min(y,w)),b.m(q++,y,v),b.m(q++,y,A)):(null!==y?y.centerX:w)!==z&&(y=this.Ka[u.layer]+this.Sc.y,q===b.firstPickIndex+1&&(y=90===this.L?Math.max(y,v):Math.min(y,v)),b.m(q++,w,y),b.m(q++,z,y)):(y=Math.max(10,this.ae[u.layer]),C=Math.max(10,this.xd[u.layer]),180===this.L?(b.m(q++,z+C,A),r&&b.m(q++,z,A),b.m(q++,z-y,A)):90===this.L?(b.m(q++,z,A-y),r&&b.m(q++,
z,A),b.m(q++,z,A+C)):270===this.L?(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&&(w=b.i(q-1).x,v=b.i(q-1).y,z=b.i(q).x,A=b.i(q).y,180===this.L||0===this.L?v!==A&&(y=0===this.L?Math.min(Math.max((z+w)/2,this.Ka[n.layer]+this.Sc.x),z):Math.max(Math.min((z+w)/2,this.Ka[n.layer]+this.Sc.x),z),b.m(q++,y,v),b.m(q++,y,A)):w!==z&&(y=90===this.L?Math.min(Math.max((A+v)/2,this.Ka[n.layer]+this.Sc.y),A):Math.max(Math.min((A+v)/2,this.Ka[n.layer]+this.Sc.y),
A),b.m(q++,w,y),b.m(q++,z,y)))}null!==d&&r&&(null!==g&&(l===rc&&(l=b.i(0),d=b.i(2),l.A(d)||b.M(1,(l.x+d.x)/2,(l.y+d.y)/2)),l=b.getLinkPoint(e,g,rc,!0,!1,f,h),l.u()||l.set(e.actualBounds.center),b.M(0,l.x,l.y)),null!==h&&(k===rc&&(k=b.i(b.pointsCount-1),l=b.i(b.pointsCount-3),k.A(l)||b.M(b.pointsCount-2,(k.x+l.x)/2,(k.y+l.y)/2)),e=b.getLinkPoint(f,h,rc,!1,!1,e,g),e.u()||e.set(f.actualBounds.center),b.M(b.pointsCount-1,e.x,e.y)));b.vf();c.commit()}}}this.avoidOrthogonalOverlaps()};
ls.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.L||270===this.L){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.w(f.y,g.y)&&!this.w(f.x,g.x)){var h=new ft;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.$b=l.x*l.x+l.y;h.ed=Math.min(f.x,g.x);h.yc=Math.max(f.x,g.x);h.index=e;h.link=d;if(e+2<d.pointsCount){k=d.i(e-1);l=d.i(e+2);var m=0;k.y<f.y?m=l.y<f.y?3:f.x<g.x?2:1:k.y>f.y&&(m=l.y>f.y?0:g.x<f.x?2:1);h.j=m}c.push(h)}}}if(1<c.length)for(c.sort(this.yy),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].yc;for(e=a+1;e<d&&c[e].ed<g;)g=Math.max(g,c[e].yc),e++;g=e-f;if(1<g){this.Vi(c,this.Ss,f,f+g);m=1;h=c[f].$b;for(k=f;k<e;k++)l=c[k],l.$b!==
h&&(m++,h=l.$b);this.Vi(c,this.xy,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].$b,this.Vi(c,this.Ss,f,f+g)):h=c[f].first;m=0;for(n=f;n<e;n++){var p=c[n];(k?p.first:p.$b)!==h&&(m++,h=k?p.first:p.$b);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.Lh();r.M(p.index,f.x,f.y+q);r.M(p.index+1,g.x,g.y+q);r.vf()}}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.w(f.x,g.x)&&!this.w(f.y,g.y)&&(h=new ft,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.$b=l.x+l.y*l.y,h.ed=Math.min(f.y,g.y),h.yc=Math.max(f.y,g.y),h.index=e,h.link=d,e+2<d.pointsCount&&(k=d.i(e-1),l=d.i(e+2),m=0,k.x<f.x?m=l.x<f.x?3:f.y<g.y?2:1:k.x>f.x&&(m=l.x>f.x?0:g.y<f.y?2:1),h.j=m),c.push(h));if(1<c.length)for(c.sort(this.yy),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].yc;for(e=a+1;e<d&&c[e].ed<g;)g=Math.max(g,c[e].yc),e++;g=e-f;if(1<g){this.Vi(c,this.Ss,f,f+g);m=1;h=c[f].$b;for(k=f;k<e;k++)l=c[k],l.$b!==h&&(m++,h=l.$b);this.Vi(c,this.xy,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].$b,this.Vi(c,this.Ss,f,f+g)):h=c[f].first;m=0;for(n=f;n<e;n++)p=c[n],(k?p.first:p.$b)!==h&&(m++,h=k?p.first:p.$b),r=p.link,f=r.i(p.index),g=r.i(p.index+1),q=this.linkSpacing*(m-(l-1)/2),b++,r.Lh(),r.M(p.index,
f.x+q,f.y),r.M(p.index+1,g.x+q,g.y),r.vf()}f=e}a=d}}}};t=ls.prototype;t.yy=function(a,b){return a instanceof ft&&b instanceof ft&&a!==b?a.layer<b.layer?-1:a.layer>b.layer?1:a.ed<b.ed?-1:a.ed>b.ed?1:a.yc<b.yc?-1:a.yc>b.yc?1:0:0};t.xy=function(a,b){return a instanceof ft&&b instanceof ft&&a!==b?a.first<b.first?-1:a.first>b.first||a.j<b.j?1:a.j>b.j||a.ed<b.ed?-1:a.ed>b.ed?1:a.yc<b.yc?-1:a.yc>b.yc?1:0:0};
t.Ss=function(a,b){return a instanceof ft&&b instanceof ft&&a!==b?a.$b<b.$b?-1:a.$b>b.$b||a.j<b.j?1:a.j>b.j||a.ed<b.ed?-1:a.ed>b.ed?1:a.yc<b.yc?-1:a.yc>b.yc?1:0:0};t.w=function(a,b){a-=b;return-1<a&&1>a};
t.Vi=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 us(a,b){var c=a.Ab[b];if(c>=a.ye.length){var d=[];for(var e=0;e<a.ye.length;e++)d[e]=a.ye[e];a.ye=d}void 0===a.ye[c]||null===a.ye[c]?d=[]:(d=a.ye[c],a.ye[c]=null);a=a.zo[b];for(b=0;b<a.length;b++)c=a[b],d[c.index]=c;return d}function vs(a,b,c){a.ye[a.Ab[b]]=c}
na.Object.defineProperties(ls.prototype,{layerSpacing:{get:function(){return this.ve},set:function(a){this.ve!==a&&0<=a&&(this.ve=a,this.B())}},columnSpacing:{get:function(){return this.ac},set:function(a){this.ac!==a&&0<a&&(this.ac=a,this.B())}},direction:{get:function(){return this.L},set:function(a){this.L!==a&&(0===a||90===a||180===a||270===a?(this.L=a,this.B()):B("LayeredDigraphLayout.direction must be 0, 90, 180, or 270"))}},
cycleRemoveOption:{get:function(){return this.Lk},set:function(a){this.Lk===a||a!==Fs&&a!==ms&&a!==rs||(this.Lk=a,this.B())}},layeringOption:{get:function(){return this.kl},set:function(a){this.kl===a||a!==ns&&a!==Ks&&a!==Ms||(this.kl=a,this.B())}},initializeOption:{get:function(){return this.$k},set:function(a){this.$k===a||a!==os&&a!==Ss&&a!==Qs||(this.$k=a,this.B())}},iterations:{
get:function(){return this.sj},set:function(a){this.sj!==a&&0<=a&&(this.sj=a,this.B())}},aggressiveOption:{get:function(){return this.wk},set:function(a){this.wk===a||a!==Ws&&a!==ps&&a!==Xs||(this.wk=a,this.B())}},packOption:{get:function(){return this.ag},set:function(a){this.ag!==a&&0<=a&&8>a&&(this.ag=a,this.B())}},setsPortSpots:{get:function(){return this.hf},set:function(a){this.hf!==a&&(this.hf=a,this.B())}},
linkSpacing:{get:function(){return this.jo},set:function(a){this.jo!==a&&0<=a&&(this.jo=a,this.B())}},maxLayer:{get:function(){return this.ra}},maxIndex:{get:function(){return this.ji}},maxColumn:{get:function(){return this.Ea}},minIndexLayer:{get:function(){return this.Wg}},maxIndexLayer:{get:function(){return this.wc}}});
var ms=new D(ls,"CycleDepthFirst",0),Fs=new D(ls,"CycleGreedy",1),rs=new D(ls,"CycleFromLayers",2),ns=new D(ls,"LayerOptimalLinkLength",0),Ks=new D(ls,"LayerLongestPathSink",1),Ms=new D(ls,"LayerLongestPathSource",2),os=new D(ls,"InitDepthFirstOut",0),Ss=new D(ls,"InitDepthFirstIn",1),Qs=new D(ls,"InitNaive",2),Ws=new D(ls,"AggressiveNone",0),ps=new D(ls,"AggressiveLess",1),Xs=new D(ls,"AggressiveMore",2),Ys=8;ls.className="LayeredDigraphLayout";ls.CycleDepthFirst=ms;ls.CycleGreedy=Fs;
ls.CycleFromLayers=rs;ls.LayerOptimalLinkLength=ns;ls.LayerLongestPathSink=Ks;ls.LayerLongestPathSource=Ms;ls.InitDepthFirstOut=os;ls.InitDepthFirstIn=Ss;ls.InitNaive=Qs;ls.AggressiveNone=Ws;ls.AggressiveLess=ps;ls.AggressiveMore=Xs;ls.PackNone=0;ls.PackExpand=1;ls.PackStraighten=2;ls.PackMedian=4;ls.PackAll=15;function ft(){this.index=this.yc=this.ed=this.$b=this.first=this.layer=0;this.link=null;this.j=0}ft.className="SegInfo";function qs(a){Pp.call(this,a)}ma(qs,Pp);qs.prototype.createVertex=function(){return new gt(this)};
qs.prototype.createEdge=function(){return new ht(this)};qs.className="LayeredDigraphNetwork";function gt(a){cq.call(this,a);this.Ra=this.Cg=this.fi=-1;this.C=NaN;this.K=null;this.valid=!1;this.finish=this.pg=NaN;this.uf=0;this.jk=this.kk=null}ma(gt,cq);
gt.prototype.serializeVertexProperties=function(a,b){cq.prototype.serializeVertexProperties.call(this,a,b);a.layer=this.layer;a.column=this.column;a.index=this.index;a.component=this.component;a.near=this.near?ib(this.near):null;a.valid=this.valid;a.pg=this.pg;a.finish=this.finish;a.uf=this.uf;a.kk=this.kk;a.jk=this.jk};
gt.prototype.deserializeVertexProperties=function(a,b,c,d){cq.prototype.deserializeVertexProperties.call(this,a,b,c,d);this.layer=a.layer;this.column=a.column;this.index=a.index;this.component=a.component;if(b=b.get(a.near))this.near=b;this.valid=a.valid;this.pg=a.pg;this.finish=a.finish;this.uf=a.uf;this.kk=a.kk;this.jk=a.jk};
na.Object.defineProperties(gt.prototype,{layer:{get:function(){return this.fi},set:function(a){this.fi!==a&&(this.fi=a)}},column:{get:function(){return this.Cg},set:function(a){this.Cg!==a&&(this.Cg=a)}},index:{get:function(){return this.Ra},set:function(a){this.Ra!==a&&(this.Ra=a)}},component:{get:function(){return this.C},set:function(a){this.C!==a&&(this.C=a)}},near:{
get:function(){return this.K},set:function(a){this.K!==a&&(this.K=a)}}});gt.className="LayeredDigraphVertex";function ht(a){dq.call(this,a);this.j=this.Ba=this.Ma=!1;this.wa=this.C=NaN;this.K=this.o=0}ma(ht,dq);
ht.prototype.serializeEdgeProperties=function(a,b){dq.prototype.serializeEdgeProperties.call(this,a,b);a.valid=this.valid;a.rev=this.rev;a.forest=this.forest;a.portFromPos=this.portFromPos;a.portToPos=this.portToPos;a.portFromColOffset=this.portFromColOffset;a.portToColOffset=this.portToColOffset};
ht.prototype.deserializeEdgeProperties=function(a,b,c,d){dq.prototype.deserializeEdgeProperties.call(this,a,b,c,d);this.valid=a.valid;this.rev=a.rev;this.forest=a.forest;this.portFromPos=a.portFromPos;this.portToPos=a.portToPos;this.portFromColOffset=a.portFromColOffset;this.portToColOffset=a.portToColOffset};
na.Object.defineProperties(ht.prototype,{fromVertex:{get:function(){return this.Vc},set:function(a){this.Vc!==a&&(this.Vc=a)}},toVertex:{get:function(){return this.cd},set:function(a){this.cd!==a&&(this.cd=a)}},valid:{get:function(){return this.Ma},set:function(a){this.Ma!==a&&(this.Ma=a)}},rev:{get:function(){return this.Ba},set:function(a){this.Ba!==a&&(this.Ba=a)}},forest:{
get:function(){return this.j},set:function(a){this.j!==a&&(this.j=a)}},portFromPos:{get:function(){return this.C},set:function(a){this.C!==a&&(this.C=a)}},portToPos:{get:function(){return this.wa},set:function(a){this.wa!==a&&(this.wa=a)}},portFromColOffset:{get:function(){return this.o},set:function(a){this.o!==a&&(this.o=a)}},portToColOffset:{get:function(){return this.K},
set:function(a){this.K!==a&&(this.K=a)}}});ht.className="LayeredDigraphEdge";function it(a){ni.call(this);this.Kb=new G;this.Mo=jt;this.ld=kt;this.Fp=lt;this.ur=mt;this.Dw=[];this.jd=!0;this.Hb=nt;this.Rd=(new Gb(10,10)).freeze();var b=new ot(this);this.V=new pt(b);this.W=new pt(b);this.tu=[];a&&Object.assign(this,a)}ma(it,ni);
it.prototype.cloneProtected=function(a){ni.prototype.cloneProtected.call(this,a);a.Mo=this.Mo;a.Fp=this.Fp;a.ur=this.ur;a.jd=this.jd;a.Hb=this.Hb;a.Rd.assign(this.Rd);a.V.copyInheritedPropertiesFrom(this.V);a.W.copyInheritedPropertiesFrom(this.W)};
it.prototype.gb=function(a){a.classType===it?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):ni.prototype.gb.call(this,a)};it.prototype.createNetwork=function(){return new ot(this)};
it.prototype.makeNetwork=function(a){function b(a){if(a instanceof W)return!a.isLinkLabel&&"Comment"!==a.category;if(a instanceof T){var b=a.fromNode;if(null===b||b.isLinkLabel||"Comment"===b.category)return!1;a=a.toNode;return null===a||a.isLinkLabel||"Comment"===a.category?!1:!0}return!1}var c=this.createNetwork();a instanceof Q?(c.ng(a.nodes,!0,b),c.ng(a.links,!0,b)):a instanceof U?c.ng(a.memberParts,!1,b):c.ng(a.iterator,!1,b);return c};
it.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));this.arrangement!==qt&&(this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin));var b=this.diagram;null===b&&a instanceof Q&&(b=a);this.path===jt&&null!==b?this.ld=b.isTreePathToChildren?kt:rt:this.ld=this.path===jt?kt:this.path;if(0<this.network.vertexes.count){this.network.Tp();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.Kb.count){a=
new G;for(b=this.Kb.iterator;b.next();){var c=b.value;c instanceof W?(c=this.network.Ji(c),null!==c&&a.add(c)):c instanceof pt&&a.add(c)}this.Kb=a}0===this.Kb.count&&this.findRoots();for(a=this.Kb.copy().iterator;a.next();)b=a.value,b.initialized||(b.initialized=!0,st(this,b));b=this.network.vertexes;for(a=null;a=tt(b),0<a.count;)b=ut(this,a),null!==b&&this.Kb.add(b),b.initialized=!0,st(this,b),b=a;for(a=this.Kb.iterator;a.next();)b=a.value,b instanceof pt&&vt(this,b);for(a=this.Kb.iterator;a.next();)b=
a.value,b instanceof pt&&wt(this,b);for(a=this.Kb.iterator;a.next();)b=a.value,b instanceof pt&&xt(this,b);this.Eu();if(this.layerStyle===yt){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.Dw=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===zt)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.Kb.iterator;a.next();)b=a.value,b instanceof pt&&this.layoutTree(b);this.arrangeTrees();this.updateParts()}this.network=null;this.Kb=new G;this.isValidLayout=!0};function tt(a){var b=new G;for(a=a.iterator;a.next();){var c=a.value;c.initialized||b.add(c)}return b}
it.prototype.findRoots=function(){for(var a=this.network.vertexes,b=a.iterator;b.next();){var c=b.value;switch(this.ld){case kt:0===c.sourceEdges.count&&this.Kb.add(c);break;case rt:0===c.destinationEdges.count&&this.Kb.add(c);break;default:B("Unhandled path value "+this.ld.toString())}}0===this.Kb.count&&(a=ut(this,a),null!==a&&this.Kb.add(a))};
function ut(a,b){var c=999999,d=null;for(b=b.iterator;b.next();){var e=b.value;switch(a.ld){case kt:e.sourceEdges.count<c&&(c=e.sourceEdges.count,d=e);break;case rt:e.destinationEdges.count<c&&(c=e.destinationEdges.count,d=e);break;default:B("Unhandled path value "+a.ld.toString())}}return d}
function st(a,b){if(null!==b){switch(a.ld){case kt:if(0<b.destinationEdges.count){for(var c=new E,d=b.destinationVertexes;d.next();){var e=d.value;At(a,b,e)&&c.add(e)}0<c.count&&(b.children=c.ya())}break;case rt:if(0<b.sourceEdges.count){c=new E;for(d=b.sourceVertexes;d.next();)e=d.value,At(a,b,e)&&c.add(e);0<c.count&&(b.children=c.ya())}break;default:B("Unhandled path value"+a.ld.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.Kb.remove(f)}for(b=
0;b<d;b++)st(a,c[b])}}function At(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}it.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 vt(a,b){if(null!==b){a.initializeTreeVertexValues(b);b.alignment===Bt&&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];vt(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 Ct(a,b){switch(a.Fp){default:case lt:return null!==b.parent?b.parent:a.V;case Dt:return null===b.parent?a.V:null===b.parent.parent?a.W:b.parent;case Et:return null!==b.parent?null!==b.parent.parent?b.parent.parent:a.W:a.V;case Ft:var c=!0;if(0===b.childrenCount)c=!1;else for(var d=b.children,e=d.length,f=0;f<e;f++)if(0<d[f].childrenCount){c=!1;break}return c&&null!==b.parent?a.W:null!==b.parent?b.parent:a.V}}
it.prototype.initializeTreeVertexValues=function(a){a.copyInheritedPropertiesFrom(Ct(this,a));if(null!==a.parent&&a.parent.alignment===Bt){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 wt(a,b){if(null!==b){a.assignTreeVertexValues(b);b=b.children;for(var c=b.length,d=0;d<c;d++)wt(a,b[d])}}it.prototype.assignTreeVertexValues=function(){};
function xt(a,b){if(null!==b){b.alignment!==Bt&&a.sortTreeVertexChildren(b);b=b.children;for(var c=b.length,d=0;d<c;d++)xt(a,b[d])}}it.prototype.sortTreeVertexChildren=function(a){switch(a.sorting){case Gt:break;case Ht:a.children.reverse();break;case It:a.children.sort(a.comparer);break;case Jt:a.children.sort(a.comparer);a.children.reverse();break;default:B("Unhandled sorting value "+a.sorting.toString())}};it.prototype.Eu=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)};
it.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=Kt(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.Wu();l.next();){var m=l.value;"Comment"===m.category&&m.canLayout()&&(null===a.comments&&(a.comments=[]),a.comments.push(m),m.Ta(),m=m.measuredBounds,b&&!c||!e&&!d&&c||e&&d&&c?(f=Math.max(f,m.width),g+=m.height+Math.abs(h)):(f+=m.width+Math.abs(h),g=Math.max(g,
m.height)),h=k)}null!==a.comments&&(b&&!c||!e&&!d&&c||e&&d&&c?(f+=Math.abs(a.commentMargin),g=Math.max(0,g-a.height)):(g+=Math.abs(a.commentMargin),f=Math.max(0,f-a.width)),e=N.allocAt(0,0,a.bounds.width+f,a.bounds.height+g),a.bounds=e,N.free(e))};function Kt(a){return a===Lt||a===Bt||a===Mt||a===Nt}function Ot(a){return a===Lt||a===Bt}
function Pt(a){var b=a.parent;if(null!==b){var c=b.alignment;if(Kt(c)){if(Ot(c)){b=b.children;for(c=0;c<b.length&&a!==b[c];)c++;return 0===c%2}if(c===Mt)return!0}}return!1}
it.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=Kt(f));d=90===d||270===d;c=90===e||270===e;for(var g=0===a.childrenCount,h=Pt(a),k=0,l=a.comments,m=l.length,n=K.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.Gd();r.next();){var u=r.value;u.fromSpot=
bd;u.toSpot=cd}else for(n.h(a.bounds.x+2*a.focus.x-a.commentMargin,a.bounds.y+k),r.move(n),r=r.Gd();r.next();)u=r.value,u.fromSpot=cd,u.toSpot=bd;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.Gd();r.next();)u=r.value,u.fromSpot=cd,u.toSpot=bd;else for(n.h(a.bounds.x+a.commentMargin-q.width,a.bounds.y+k),r.move(n),r=r.Gd();r.next();)u=r.value,u.fromSpot=bd,u.toSpot=cd;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.Gd();r.next();)u=r.value,u.fromSpot=ad,u.toSpot=dd;else for(n.h(a.bounds.x+k,a.bounds.y+2*a.focus.y-a.commentMargin),r.move(n),r=r.Gd();r.next();)u=r.value,u.fromSpot=dd,u.toSpot=ad;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.Gd();r.next();)u=r.value,u.fromSpot=dd,u.toSpot=ad;else for(n.h(a.bounds.x+k,a.bounds.y+a.commentMargin-q.height),
r.move(n),r=r.Gd();r.next();)u=r.value,u.fromSpot=ad,u.toSpot=dd;k=0<=a.commentSpacing?k+(q.width+a.commentSpacing):k+(a.commentSpacing-q.width)}}K.free(n);b=k-a.commentSpacing-(d?b.height:b.width);if(this.ld===kt)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)}};
it.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 Qt:Wt(this,a);break;case Xt:if(a.alignment===Bt)Wt(this,a);else if(0===a.childrenCount)d=a.parent,c=!1,b=0,null!==d&&(b=d.angle,c=d.alignment,c=Kt(c)),d=Pt(a),a.T.h(0,0),a.va.h(a.width,a.height),null===a.parent||null===a.comments||(180!==b&&270!==b||c)&&!d?a.fa.h(0,0):180===b&&!c||(90===b||270===b)&&d?a.fa.h(a.width-2*a.focus.x,0):a.fa.h(0,a.height-2*a.focus.y),
a.gq=null,a.sq=null;else{var e=Yt(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.va.width:d.va.height);var k=a.alignment,l=k===Zt,m=Kt(k),n=Math.max(0,a.breadthLimit);c=$t(a);var p=a.nodeSpacing,r=au(a),q=a.rowSpacing,u=0;if(k===bu||l||a.tm||a.um&&1===a.maxGenerationCount)u=Math.max(0,a.rowIndent);d=a.width;var w=a.height,v=0,y=0,z=0,A=null,C=null,F=0,R=0,J=0,S=0,L=0,I=0,ja=0,ca=0;m&&!Ot(k)&&135<e&&g.reverse();if(Ot(k))if(1<h)for(var pa=0;pa<h;pa++)0===
pa%2&&pa!==h-1&&(ca=Math.max(ca,b?g[pa].va.width:g[pa].va.height));else 1===h&&(ca=b?g[0].va.width:g[0].va.height);if(m){switch(k){case Lt:y=135>e?cu(a,g,ca,v,y):du(a,g,ca,v,y);ca=y.x;v=y.width;y=y.height;break;case Mt:for(A=0;A<h;A++)C=g[A],n=C.va,z=0===I?0:q,b?(C.T.h(f-n.width,S+z),v=Math.max(v,n.width),y=Math.max(y,S+z+n.height),S+=z+n.height):(C.T.h(J+z,f-n.height),v=Math.max(v,J+z+n.width),y=Math.max(y,n.height),J+=z+n.width),I++;break;case Nt:for(A=0;A<h;A++)C=g[A],f=C.va,n=0===I?0:q,b?(C.T.h(p/
2+a.focus.x,S+n),v=Math.max(v,f.width),y=Math.max(y,S+n+f.height),S+=n+f.height):(C.T.h(J+n,p/2+a.focus.y),v=Math.max(v,J+n+f.width),y=Math.max(y,f.height),J+=n+f.width),I++}A=eu(this,2);C=eu(this,2);b?(A[0].h(0,0),A[1].h(0,y),C[0].h(v,0)):(A[0].h(0,0),A[1].h(v,0),C[0].h(0,y));C[1].h(v,y)}else for(pa=0;pa<h;pa++){var Na=g[pa],fb=Na.va;if(b){0<n&&0<I&&J+p+fb.width>n&&(J<f&&fu(a,k,f-J,0,ja,pa-1),L++,I=0,ja=pa,z=y,J=0,S=135<e?-y-q:y+q);gu(this,Na,0,S);var Ga=0;if(0===I){if(A=Na.gq,C=Na.sq,F=fb.width,
R=fb.height,null===A||null===C||e!==Yt(Na))A=eu(this,2),C=eu(this,2),A[0].h(0,0),A[1].h(0,R),C[0].h(F,0),C[1].h(F,R)}else{var Ha=Ea();R=hu(this,a,Na,A,C,F,R,Ha);Ga=R.x;A=Ha[0];C=Ha[1];F=R.width;R=R.height;Ia(Ha);J<fb.width&&0>Ga&&(iu(a,-Ga,0,ja,pa-1),ju(A,-Ga,0),ju(C,-Ga,0),Ga=0)}Na.T.h(Ga,S);v=Math.max(v,F);y=Math.max(y,z+(0===L?0:q)+fb.height);J=F}else{0<n&&0<I&&S+p+fb.height>n&&(S<f&&fu(a,k,0,f-S,ja,pa-1),L++,I=0,ja=pa,z=v,S=0,J=135<e?-v-q:v+q);gu(this,Na,J,0);Ga=0;if(0===I){if(A=Na.gq,C=Na.sq,
F=fb.width,R=fb.height,null===A||null===C||e!==Yt(Na))A=eu(this,2),C=eu(this,2),A[0].h(0,0),A[1].h(F,0),C[0].h(0,R),C[1].h(F,R)}else Ha=Ea(),R=hu(this,a,Na,A,C,F,R,Ha),Ga=R.x,A=Ha[0],C=Ha[1],F=R.width,R=R.height,Ia(Ha),S<fb.height&&0>Ga&&(iu(a,0,-Ga,ja,pa-1),ju(A,0,-Ga),ju(C,0,-Ga),Ga=0);Na.T.h(J,Ga);y=Math.max(y,R);v=Math.max(v,z+(0===L?0:q)+fb.width);S=R}I++}0<L&&(b?(y+=Math.max(0,c),J<v&&fu(a,k,v-J,0,ja,h-1),0<u&&(l||iu(a,u,0,0,h-1),v+=u)):(v+=Math.max(0,c),S<y&&fu(a,k,0,y-S,ja,h-1),0<u&&(l||iu(a,
0,u,0,h-1),y+=u)));u=l=0;switch(k){case ku:b?l+=v/2-a.focus.x-r/2:u+=y/2-a.focus.y-r/2;break;case lu:0<L?b?l+=v/2-a.focus.x-r/2:u+=y/2-a.focus.y-r/2:b?(ca=g[0].T.x+g[0].fa.x,l+=ca+(g[h-1].T.x+g[h-1].fa.x+2*g[h-1].focus.x-ca)/2-a.focus.x-r/2):(ca=g[0].T.y+g[0].fa.y,u+=ca+(g[h-1].T.y+g[h-1].fa.y+2*g[h-1].focus.y-ca)/2-a.focus.y-r/2);break;case bu:b?(l-=r,v+=r):(u-=r,y+=r);break;case Zt:b?(l+=v-a.width+r,v+=r):(u+=y-a.height+r,y+=r);break;case Lt:b?1<h?l+=ca+p/2-a.focus.x:l+=g[0].focus.x-a.focus.x+g[0].fa.x:
1<h?u+=ca+p/2-a.focus.y:u+=g[0].focus.y-a.focus.y+g[0].fa.y;break;case Mt:b?l+=v+p/2-a.focus.x:u+=y+p/2-a.focus.y;break;case Nt:break;default:B("Unhandled alignment value "+k.toString())}for(r=0;r<h;r++)ca=g[r],b?ca.T.h(ca.T.x+ca.fa.x-l,ca.T.y+(135<e?(m?-y:-ca.va.height)+ca.fa.y-c:w+c+ca.fa.y)):ca.T.h(ca.T.x+(135<e?(m?-v:-ca.va.width)+ca.fa.x-c:d+c+ca.fa.x),ca.T.y+ca.fa.y-u);h=g=0;m?b?(v=mu(a,v,l),0>l&&(l=0),135<e&&(u+=y+c),y+=w+c,k===Nt&&(g+=p/2+a.focus.x),h+=w+c):(135<e&&(l+=v+c),v+=d+c,y=nu(a,
y,u),0>u&&(u=0),k===Nt&&(h+=p/2+a.focus.y),g+=d+c):b?(null===a.comments?d>v&&(v=ou(k,d-v,0),g=v.x,h=v.y,v=d,l=0):v=mu(a,v,l),0>l&&(g-=l,l=0),135<e&&(u+=y+c),y=Math.max(Math.max(y,w),y+w+c),h+=w+c):(135<e&&(l+=v+c),v=Math.max(Math.max(v,d),v+d+c),null===a.comments?w>y&&(y=ou(k,0,w-y),g=y.x,h=y.y,y=w,u=0):y=nu(a,y,u),0>u&&(h-=u,u=0),g+=d+c);if(0<L)e=eu(this,4),L=eu(this,4),b?(e[2].h(0,w+c),e[3].h(e[2].x,y),L[2].h(v,e[2].y),L[3].h(L[2].x,e[3].y)):(e[2].h(d+c,0),e[3].h(v,e[2].y),L[2].h(e[2].x,y),L[3].h(e[3].x,
L[2].y));else{e=eu(this,A.length+2);L=eu(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],L[k+2].h(m.x+g,m.y+h)}b?(e[0].h(l,0),e[1].h(e[0].x,w),e[2].y<e[1].y&&(e[2].x>e[0].x?e[2].assign(e[1]):e[1].assign(e[2])),e[3].y<e[2].y&&(e[3].x>e[0].x?e[3].assign(e[2]):e[2].assign(e[3])),L[0].h(l+d,0),L[1].h(L[0].x,w),L[2].y<L[1].y&&(L[2].x<L[0].x?L[2].assign(L[1]):L[1].assign(L[2])),L[3].y<L[2].y&&(L[3].x<L[0].x?L[3].assign(L[2]):L[2].assign(L[3])),e[2].y-=
c/2,L[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])),L[0].h(0,u+w),L[1].h(d,L[0].y),L[2].x<L[1].x&&(L[2].y<L[0].y?L[2].assign(L[1]):L[1].assign(L[2])),L[3].x<L[2].x&&(L[3].y<L[0].y?L[3].assign(L[2]):L[2].assign(L[3])),e[2].x-=c/2,L[2].x-=c/2);pu(this,A);pu(this,C);a.gq=e;a.sq=L;a.fa.h(l,u);a.va.h(v,y)}break;default:B("Unhandled compaction value "+a.compaction.toString())}}};
function Wt(a,b){if(0===b.childrenCount){var c=!1,d=0;null!==b.parent&&(d=b.parent.angle,c=b.parent.alignment,c=Kt(c));var e=Pt(b);b.T.h(0,0);b.va.h(b.width,b.height);null===b.parent||null===b.comments||(180!==d&&270!==d||c)&&!e?b.fa.h(0,0):180===d&&!c||(90===d||270===d)&&e?b.fa.h(b.width-2*b.focus.x,0):b.fa.h(0,b.height-2*b.focus.y)}else{d=Yt(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.va.width:k.va.height)}var l=b.alignment,m=l===bu,n=l===
Zt;h=Kt(l);var p=Math.max(0,b.breadthLimit);k=$t(b);var r=b.nodeSpacing,q=au(b),u=m||n?0:q/2,w=b.rowSpacing,v=0;if(m||n||b.tm||b.um&&1===b.maxGenerationCount)v=Math.max(0,b.rowIndent);m=b.width;var y=b.height,z=0,A=0,C=0,F=0,R=0,J=0,S=0,L=0,I=0;h&&!Ot(l)&&135<d&&e.reverse();if(Ot(l))if(1<g)for(var ja=0;ja<g;ja++){var ca=e[ja],pa=ca.va;0===ja%2&&ja!==g-1&&(I=Math.max(I,(c?pa.width:pa.height)+qu(ca)-r))}else 1===g&&(I=c?e[0].va.width:e[0].va.height);if(h)switch(l){case Lt:case Bt:A=135>d?cu(b,e,I,z,
A):du(b,e,I,z,A);I=A.x;z=A.width;A=A.height;break;case Mt:for(a=0;a<g;a++)p=e[a],u=p.va,C=0===S?0:w,c?(p.T.h(f-u.width,R+C),z=Math.max(z,u.width),A=Math.max(A,R+C+u.height),R+=C+u.height):(p.T.h(F+C,f-u.height),z=Math.max(z,F+C+u.width),A=Math.max(A,u.height),F+=C+u.width),S++;break;case Nt:for(f=0;f<g;f++)a=e[f],p=a.va,u=0===S?0:w,c?(a.T.h(r/2+b.focus.x,R+u),z=Math.max(z,p.width),A=Math.max(A,R+u+p.height),R+=u+p.height):(a.T.h(F+u,r/2+b.focus.y),z=Math.max(z,F+u+p.width),A=Math.max(A,p.height),
F+=u+p.width),S++}else for(ja=0;ja<g;ja++){ca=e[ja];pa=ca.va;if(c){0<p&&0<S&&F+r+pa.width>p&&(F<f&&fu(b,l,f-F,0,L,ja-1),J++,S=0,L=ja,C=A,F=0,R=135<d?-A-w:A+w);var Na=0===S?u:r;gu(a,ca,0,R);ca.T.h(F+Na,R);z=Math.max(z,F+Na+pa.width);A=Math.max(A,C+(0===J?0:w)+pa.height);F+=Na+pa.width}else 0<p&&0<S&&R+r+pa.height>p&&(R<f&&fu(b,l,0,f-R,L,ja-1),J++,S=0,L=ja,C=z,R=0,F=135<d?-z-w:z+w),Na=0===S?u:r,gu(a,ca,F,0),ca.T.h(F,R+Na),A=Math.max(A,R+Na+pa.height),z=Math.max(z,C+(0===J?0:w)+pa.width),R+=Na+pa.height;
S++}0<J&&(c?(A+=Math.max(0,k),F<z&&fu(b,l,z-F,0,L,g-1),0<v&&(n||iu(b,v,0,0,g-1),z+=v)):(z+=Math.max(0,k),R<A&&fu(b,l,0,A-R,L,g-1),0<v&&(n||iu(b,0,v,0,g-1),A+=v)));v=n=0;switch(l){case ku:c?n+=z/2-b.focus.x-q/2:v+=A/2-b.focus.y-q/2;break;case lu:0<J?c?n+=z/2-b.focus.x-q/2:v+=A/2-b.focus.y-q/2:c?(l=e[0].T.x+e[0].fa.x,n+=l+(e[g-1].T.x+e[g-1].fa.x+2*e[g-1].focus.x-l)/2-b.focus.x-q/2):(l=e[0].T.y+e[0].fa.y,v+=l+(e[g-1].T.y+e[g-1].fa.y+2*e[g-1].focus.y-l)/2-b.focus.y-q/2);break;case bu:c?(n-=q,z+=q):(v-=
q,A+=q);break;case Zt:c?(n+=z-b.width+q,z+=q):(v+=A-b.height+q,A+=q);break;case Lt:case Bt:c?1<g?n+=I+r/2-b.focus.x:n+=e[0].focus.x-b.focus.x+e[0].fa.x:1<g?v+=I+r/2-b.focus.y:v+=e[0].focus.y-b.focus.y+e[0].fa.y;break;case Mt:c?n+=z+r/2-b.focus.x:v+=A+r/2-b.focus.y;break;case Nt:break;default:B("Unhandled alignment value "+l.toString())}for(q=0;q<g;q++)l=e[q],c?l.T.h(l.T.x+l.fa.x-n,l.T.y+(135<d?(h?-A:-l.va.height)+l.fa.y-k:y+k+l.fa.y)):l.T.h(l.T.x+(135<d?(h?-z:-l.va.width)+l.fa.x-k:m+k+l.fa.x),l.T.y+
l.fa.y-v);c?(z=mu(b,z,n),0>n&&(n=0),135<d&&(v+=A+k),A=Math.max(Math.max(A,y),A+y+k)):(135<d&&(n+=z+k),z=Math.max(Math.max(z,m),z+m+k),A=nu(b,A,v),0>v&&(v=0));b.fa.h(n,v);b.va.h(z,A)}}
function cu(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.va.width,e=a.va.height,new N(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=90===Yt(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.va,u=0===l?0:h;if(k){var w=qu(r)-g;r.T.h(c-(q.width+w),n+u);d=Math.max(d,q.width+w);e=Math.max(e,n+u+q.height);n+=u+q.height}else w=qu(r)-g,r.T.h(m+u,c-(q.height+w)),e=Math.max(e,q.height+w),d=Math.max(d,m+u+q.width),m+=u+q.width;l++}l=0;r=m;p=n;k?
(m=c+g,n=0):(m=0,n=c+g);for(q=0;q<f;q++)if(0!==q%2){u=b[q];w=u.va;var v=0===l?0:h;if(k){var y=qu(u)-g;u.T.h(m+y,n+v);d=Math.max(d,m+w.width+y);e=Math.max(e,n+v+w.height);n+=v+w.height}else y=qu(u)-g,u.T.h(m+v,n+y),d=Math.max(d,m+v+w.width),e=Math.max(e,n+w.height+y),m+=v+w.width;l++}1<f&&1===f%2&&(b=b[f-1],f=b.va,h=null===b.parent?0:b.parent.rowSpacing,k?(b.T.h(c+g/2-b.focus.x-b.fa.x,e+h),k=c+g/2-b.focus.x-b.fa.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.T.x&&
(c=ru(a,b.T.x,!1,c,g))):(b.T.h(d+h,c+g/2-b.focus.y-b.fa.y),d=Math.max(d,Math.max(r,m)+h+f.width),n=c+g/2-b.focus.y-b.fa.y,e=Math.max(e,n+f.height),0>n&&(e-=n),0>b.T.y&&(c=ru(a,b.T.y,!0,c,g))));return new N(c,0,d,e)}
function du(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.va.width,e=b.va.height,new N(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=270===Yt(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.va,u=0===l?0:h;if(k){var w=qu(r)-g;n-=u+q.height;r.T.h(c-(q.width+w),n);d=Math.max(d,q.width+w);e=Math.max(e,Math.abs(n))}else w=qu(r)-g,m-=u+q.width,r.T.h(m,c-(q.height+w)),e=Math.max(e,q.height+w),d=Math.max(d,Math.abs(m));l++}l=0;r=m;p=n;k?(m=
c+g,n=0):(m=0,n=c+g);for(q=0;q<f;q++)if(0!==q%2){u=b[q];w=u.va;var v=0===l?0:h;if(k){var y=qu(u)-g;n-=v+w.height;u.T.h(m+y,n);d=Math.max(d,m+w.width+y);e=Math.max(e,Math.abs(n))}else y=qu(u)-g,m-=v+w.width,u.T.h(m,n+y),e=Math.max(e,n+w.height+y),d=Math.max(d,Math.abs(m));l++}1<f&&1===f%2&&(h=b[f-1],l=h.va,q=null===h.parent?0:h.parent.rowSpacing,k?(h.T.h(c+g/2-h.focus.x-h.fa.x,-e-l.height-q),m=c+g/2-h.focus.x-h.fa.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.T.x&&(c=ru(a,h.T.x,!1,c,g))):(h.T.h(-d-l.width-q,c+g/2-h.focus.y-h.fa.y),d=Math.max(d,Math.abs(Math.min(r,m))+q+l.width),n=c+g/2-h.focus.y-h.fa.y,e=Math.max(e,n+l.height),0>n&&(e-=n),0>h.T.y&&(c=ru(a,h.T.y,!0,c,g))));for(a=0;a<f;a++)g=b[a],k?g.T.h(g.T.x,g.T.y+e):g.T.h(g.T.x+d,g.T.y);return new N(c,0,d,e)}function qu(a){return null===a.parent?0:a.parent.nodeSpacing}
function ru(a,b,c,d,e){a=a.children;for(var f=a.length,g=0;g<f;g++)c?a[g].T.h(a[g].T.x,a[g].T.y-b):a[g].T.h(a[g].T.x-b,a[g].T.y);b=a[f-1];return Math.max(d,c?b.fa.y+b.focus.y-e/2:b.fa.x+b.focus.x-e/2)}
function mu(a,b,c){switch(a.alignment){case lu:case ku:return c+a.width>b&&(b=c+a.width),0>c&&(b-=c),b;case bu:return a.width>b?a.width:b;case Zt:return 2*a.focus.x>b?a.width:b+a.width-2*a.focus.x;case Lt:case Bt:return Math.max(a.width,Math.max(b,c+a.width)-Math.min(0,c));case Mt:return a.width-a.focus.x+a.nodeSpacing/2+b;case Nt:return Math.max(a.width,a.focus.x+a.nodeSpacing/2+b);default:return b}}
function nu(a,b,c){switch(a.alignment){case lu:case ku:return c+a.height>b&&(b=c+a.height),0>c&&(b-=c),b;case bu:return a.height>b?a.height:b;case Zt:return 2*a.focus.y>b?a.height:b+a.height-2*a.focus.y;case Lt:case Bt:return Math.max(a.height,Math.max(b,c+a.height)-Math.min(0,c));case Mt:return a.height-a.focus.y+a.nodeSpacing/2+b;case Nt:return Math.max(a.height,a.focus.y+a.nodeSpacing/2+b);default:return b}}
function ou(a,b,c){switch(a){case ku:b/=2;c/=2;break;case lu:b/=2;c/=2;break;case bu:c=b=0;break;case Zt:break;default:B("Unhandled alignment value "+a.toString())}return new K(b,c)}function fu(a,b,c,d,e,f){b=ou(b,c,d);iu(a,b.x,b.y,e,f)}function iu(a,b,c,d,e){if(0!==b||0!==c)for(a=a.children;d<=e;d++){var f=a[d].T;f.x+=b;f.y+=c}}
function gu(a,b,c,d){var e=b.parent;switch(a.ld){case kt:for(a=b.sourceEdges;a.next();)b=a.value,b.fromVertex===e&&b.relativePoint.h(c,d);break;case rt:for(a=b.destinationEdges;a.next();)b=a.value,b.toVertex===e&&b.relativePoint.h(c,d);break;default:B("Unhandled path value "+a.ld.toString())}}function ju(a,b,c){for(var d=0;d<a.length;d++){var e=a[d];e.x+=b;e.y+=c}}
function hu(a,b,c,d,e,f,g,h){var k=Yt(b),l=90===k||270===k,m=b.nodeSpacing;b=d;var n=e;d=f;var p=g,r=c.gq,q=c.sq;g=c.va;var u=l?Math.max(p,g.height):Math.max(d,g.width);if(null===r||k!==Yt(c))r=eu(a,2),q=eu(a,2),l?(r[0].h(0,0),r[1].h(0,g.height),q[0].h(g.width,0),q[1].h(q[0].x,r[1].y)):(r[0].h(0,0),r[1].h(g.width,0),q[0].h(0,g.height),q[1].h(r[1].x,q[0].y));if(l){p=9999999;if(!(null===n||2>n.length||null===r||2>r.length))for(e=c=0;c<n.length&&e<r.length;){f=n[c];var w=r[e];k=w.x;l=w.y;k+=d;var v=
f;c+1<n.length&&(v=n[c+1]);var y=w;w=y.x;y=y.y;e+1<r.length&&(y=r[e+1],w=y.x,y=y.y,w+=d);var z=p;f.y===l?z=k-f.x:f.y>l&&f.y<y?z=k+(f.y-l)/(y-l)*(w-k)-f.x:l>f.y&&l<v.y&&(z=k-(f.x+(l-f.y)/(v.y-f.y)*(v.x-f.x)));z<p&&(p=z);v.y<=f.y?c++:y<=l?e++:(v.y<=y&&c++,y<=v.y&&e++)}p=d-p;p+=m;c=r;e=p;if(null===b||2>b.length||null===c||2>c.length)d=null;else{m=eu(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=eu(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);pu(a,m);d=c}f=q;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=eu(a,n.length+f.length);for(e=l=c=0;c<n.length&&n[c].y<f[0].y;)v=n[c++],m[e++].h(v.x,v.y);for(;l<f.length;)v=f[l++],m[e++].h(v.x+k,v.y);for(f=f[f.length-1].y;c<n.length&&n[c].y<=f;)c++;for(;c<n.length&&n[c].y>f;)k=n[c++],m[e++].h(k.x,k.y);f=eu(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);pu(a,m);e=f}f=
Math.max(0,p)+g.width;g=u;pu(a,b);pu(a,r);pu(a,n);pu(a,q);h[0]=d;h[1]=e;return new N(p,0,f,g)}d=9999999;if(!(null===n||2>n.length||null===r||2>r.length))for(e=c=0;c<n.length&&e<r.length;)f=n[c],w=r[e],k=w.x,l=w.y,l+=p,v=f,c+1<n.length&&(v=n[c+1]),y=w,w=y.x,y=y.y,e+1<r.length&&(y=r[e+1],w=y.x,y=y.y,y+=p),z=d,f.x===k?z=l-f.y:f.x>k&&f.x<w?z=l+(f.x-k)/(w-k)*(y-l)-f.y:k>f.x&&k<v.x&&(z=l-(f.y+(k-f.x)/(v.x-f.x)*(v.y-f.y))),z<d&&(d=z),v.x<=f.x?c++:w<=k?e++:(v.x<=w&&c++,w<=v.x&&e++);p-=d;p+=m;c=r;e=p;if(null===
b||2>b.length||null===c||2>c.length)d=null;else{m=eu(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=eu(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);pu(a,m);d=c}f=q;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=eu(a,n.length+f.length);for(e=l=c=0;c<n.length&&n[c].x<f[0].x;)v=n[c++],m[e++].h(v.x,v.y);
for(;l<f.length;)v=f[l++],m[e++].h(v.x,v.y+k);for(f=f[f.length-1].x;c<n.length&&n[c].x<=f;)c++;for(;c<n.length&&n[c].x>f;)k=n[c++],m[e++].h(k.x,k.y);f=eu(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);pu(a,m);e=f}f=u;g=Math.max(0,p)+g.height;pu(a,b);pu(a,r);pu(a,n);pu(a,q);h[0]=d;h[1]=e;return new N(p,0,f,g)}function eu(a,b){a=a.tu[b];if(void 0!==a&&(a=a.pop(),void 0!==a))return a;a=[];for(var c=0;c<b;c++)a[c]=new K;return a}
function pu(a,b){var c=b.length,d=a.tu[c];void 0===d&&(d=[],a.tu[c]=d);d.push(b)}
it.prototype.arrangeTrees=function(){if(this.Hb===qt)for(var a=this.Kb.iterator;a.next();){var b=a.value;if(b instanceof pt){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);su(this,b,c,d)}}}else{a=[];for(b=this.Kb.iterator;b.next();)c=b.value,c instanceof pt&&a.push(c);switch(this.sorting){case Gt:break;case Ht:a.reverse();break;case It:a.sort(this.comparer);break;case Jt: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];su(this,e,b+e.fa.x,c+e.fa.y);switch(this.Hb){case nt:c+=e.va.height+this.Rd.height;break;case tu:b+=e.va.width+this.Rd.width;break;default:B("Unhandled arrangement value "+this.Hb.toString())}}}};function su(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];su(a,g,c+g.T.x,d+g.T.y)}}}it.prototype.commitLayout=function(){this.Qv();this.commitNodes();this.Ku();this.isRouting&&this.commitLinks()};
it.prototype.commitNodes=function(){for(var a=this.network.vertexes.iterator;a.next();)a.value.commit();for(a.reset();a.next();)this.layoutComments(a.value)};
it.prototype.Ku=function(){if(this.layerStyle===yt){for(var a=this.Dw,b=[],c=null,d=this.network.vertexes.iterator;d.next();){var e=d.value;null===c?c=e.bounds.copy():c.Rc(e.bounds);var f=b[e.level];void 0===f?f=$t(e):f=Math.max(f,$t(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.Kc(this.nodeSpacing/2,this.layerSpacing),d=new K(-this.nodeSpacing/2,-this.layerSpacing/2)):(c.Kc(this.layerSpacing,this.nodeSpacing/2),d=new K(-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)}};it.prototype.commitLayers=function(){};it.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};
it.prototype.Qv=function(){for(var a=this.Kb.iterator;a.next();){var b=a.value;b instanceof pt&&uu(this,b)}};function uu(a,b){if(null!==b){a.setPortSpots(b);b=b.children;for(var c=b.length,d=0;d<c;d++)uu(a,b[d])}}
it.prototype.setPortSpots=function(a){var b=a.alignment;if(Kt(b)){var c=this.ld===kt,d=Yt(a);switch(d){case 0:var e=cd;break;case 90:e=dd;break;case 180:e=bd;break;default:e=ad}var f=a.children,g=f.length;switch(b){case Lt:case Bt: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?bd:ad;if(1===g||b===g-1&&1===g%2)switch(d){case 0:k=bd;break;case 90:k=ad;break;case 180:k=cd;break;default:k=dd}else 0===b%2&&(k=90===d||270===
d?cd:dd);c?(a.setsPortSpot&&(h.fromSpot=e),a.setsChildPortSpot&&(h.toSpot=k)):(a.setsPortSpot&&(h.fromSpot=k),a.setsChildPortSpot&&(h.toSpot=e))}}break;case Mt:d=90===d||270===d?cd:dd;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 Nt:for(d=90===d||270===d?bd:ad,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=Yt(a),this.ld===kt)for(e=a.destinationEdges;e.next();){if(d=e.value.link,null!==d){if(a.setsPortSpot)if(a.portSpot.Mb())switch(c){case 0:d.fromSpot=cd;break;case 90:d.fromSpot=dd;break;case 180:d.fromSpot=bd;break;default:d.fromSpot=ad}else d.fromSpot=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.Mb())switch(c){case 0:d.toSpot=bd;break;
case 90:d.toSpot=ad;break;case 180:d.toSpot=cd;break;default:d.toSpot=dd}else d.toSpot=a.childPortSpot}}else for(e=a.sourceEdges;e.next();)if(d=e.value.link,null!==d){if(a.setsPortSpot)if(a.portSpot.Mb())switch(c){case 0:d.toSpot=cd;break;case 90:d.toSpot=dd;break;case 180:d.toSpot=bd;break;default:d.toSpot=ad}else d.toSpot=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.Mb())switch(c){case 0:d.fromSpot=bd;break;case 90:d.fromSpot=ad;break;case 180:d.fromSpot=cd;break;default:d.fromSpot=dd}else d.fromSpot=
a.childPortSpot}};function Yt(a){a=a.angle;return 45>=a?0:135>=a?90:225>=a?180:315>=a?270:0}function $t(a){var b=Yt(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 au(a){var b=Yt(a),c=a.nodeIndent;if(0<a.nodeIndentPastParent){var d=Math.min(1,a.nodeIndentPastParent);c+=90===b||270===b?a.width*d:a.height*d}return c=Math.max(0,c)}
na.Object.defineProperties(it.prototype,{roots:{get:function(){return this.Kb},set:function(a){this.Kb!==a&&(this.Kb=a,this.B())}},path:{get:function(){return this.Mo},set:function(a){this.Mo!==a&&(this.Mo=a,this.B())}},treeStyle:{get:function(){return this.Fp},set:function(a){this.Hb===a||a!==lt&&a!==Et&&a!==Ft&&a!==Dt||(this.Fp=a,this.B())}},layerStyle:{get:function(){return this.ur},
set:function(a){this.Hb===a||a!==mt&&a!==zt&&a!==yt||(this.ur=a,this.B())}},comments:{get:function(){return this.jd},set:function(a){this.jd!==a&&(this.jd=a,this.B())}},arrangement:{get:function(){return this.Hb},set:function(a){this.Hb===a||a!==nt&&a!==tu&&a!==qt||(this.Hb=a,this.B())}},arrangementSpacing:{get:function(){return this.Rd},set:function(a){this.Rd.A(a)||(this.Rd.assign(a),this.B())}},rootDefaults:{
get:function(){return this.V},set:function(a){this.V!==a&&(this.V=a,this.B())}},alternateDefaults:{get:function(){return this.W},set:function(a){this.W!==a&&(this.W=a,this.B())}},sorting:{get:function(){return this.V.sorting},set:function(a){this.V.sorting===a||a!==Gt&&a!==Ht&&a!==It&&!Jt||(this.V.sorting=a,this.B())}},comparer:{get:function(){return this.V.comparer},set:function(a){this.V.comparer!==
a&&(this.V.comparer=a,this.B())}},angle:{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.B()):B("TreeLayout.angle must be 0, 90, 180, or 270"))}},alignment:{get:function(){return this.V.alignment},set:function(a){this.V.alignment!==a&&(this.V.alignment=a,this.B())}},nodeIndent:{get:function(){return this.V.nodeIndent},set:function(a){this.V.nodeIndent!==
a&&0<=a&&(this.V.nodeIndent=a,this.B())}},nodeIndentPastParent:{get:function(){return this.V.nodeIndentPastParent},set:function(a){this.V.nodeIndentPastParent!==a&&0<=a&&1>=a&&(this.V.nodeIndentPastParent=a,this.B())}},nodeSpacing:{get:function(){return this.V.nodeSpacing},set:function(a){this.V.nodeSpacing!==a&&(this.V.nodeSpacing=a,this.B())}},layerSpacing:{get:function(){return this.V.layerSpacing},set:function(a){this.V.layerSpacing!==
a&&(this.V.layerSpacing=a,this.B())}},layerSpacingParentOverlap:{get:function(){return this.V.layerSpacingParentOverlap},set:function(a){this.V.layerSpacingParentOverlap!==a&&0<=a&&1>=a&&(this.V.layerSpacingParentOverlap=a,this.B())}},compaction:{get:function(){return this.V.compaction},set:function(a){this.V.compaction===a||a!==Qt&&a!==Xt||(this.V.compaction=a,this.B())}},breadthLimit:{get:function(){return this.V.breadthLimit},
set:function(a){this.V.breadthLimit!==a&&0<=a&&(this.V.breadthLimit=a,this.B())}},rowSpacing:{get:function(){return this.V.rowSpacing},set:function(a){this.V.rowSpacing!==a&&(this.V.rowSpacing=a,this.B())}},rowIndent:{get:function(){return this.V.rowIndent},set:function(a){this.V.rowIndent!==a&&0<=a&&(this.V.rowIndent=a,this.B())}},commentSpacing:{get:function(){return this.V.commentSpacing},set:function(a){this.V.commentSpacing!==
a&&(this.V.commentSpacing=a,this.B())}},commentMargin:{get:function(){return this.V.commentMargin},set:function(a){this.V.commentMargin!==a&&(this.V.commentMargin=a,this.B())}},setsPortSpot:{get:function(){return this.V.setsPortSpot},set:function(a){this.V.setsPortSpot!==a&&(this.V.setsPortSpot=a,this.B())}},portSpot:{get:function(){return this.V.portSpot},set:function(a){this.V.portSpot.A(a)||(this.V.portSpot=
a,this.B())}},setsChildPortSpot:{get:function(){return this.V.setsChildPortSpot},set:function(a){this.V.setsChildPortSpot!==a&&(this.V.setsChildPortSpot=a,this.B())}},childPortSpot:{get:function(){return this.V.childPortSpot},set:function(a){this.V.childPortSpot.A(a)||(this.V.childPortSpot=a,this.B())}},alternateSorting:{get:function(){return this.W.sorting},set:function(a){this.W.sorting===a||a!==Gt&&a!==Ht&&
a!==It&&!Jt||(this.W.sorting=a,this.B())}},alternateComparer:{get:function(){return this.W.comparer},set:function(a){this.W.comparer!==a&&(this.W.comparer=a,this.B())}},alternateAngle:{get:function(){return this.W.angle},set:function(a){this.W.angle===a||0!==a&&90!==a&&180!==a&&270!==a||(this.W.angle=a,this.B())}},alternateAlignment:{get:function(){return this.W.alignment},set:function(a){this.W.alignment!==
a&&(this.W.alignment=a,this.B())}},alternateNodeIndent:{get:function(){return this.W.nodeIndent},set:function(a){this.W.nodeIndent!==a&&0<=a&&(this.W.nodeIndent=a,this.B())}},alternateNodeIndentPastParent:{get:function(){return this.W.nodeIndentPastParent},set:function(a){this.W.nodeIndentPastParent!==a&&0<=a&&1>=a&&(this.W.nodeIndentPastParent=a,this.B())}},alternateNodeSpacing:{get:function(){return this.W.nodeSpacing},
set:function(a){this.W.nodeSpacing!==a&&(this.W.nodeSpacing=a,this.B())}},alternateLayerSpacing:{get:function(){return this.W.layerSpacing},set:function(a){this.W.layerSpacing!==a&&(this.W.layerSpacing=a,this.B())}},alternateLayerSpacingParentOverlap:{get:function(){return this.W.layerSpacingParentOverlap},set:function(a){this.W.layerSpacingParentOverlap!==a&&0<=a&&1>=a&&(this.W.layerSpacingParentOverlap=a,this.B())}},alternateCompaction:{
get:function(){return this.W.compaction},set:function(a){this.W.compaction===a||a!==Qt&&a!==Xt||(this.W.compaction=a,this.B())}},alternateBreadthLimit:{get:function(){return this.W.breadthLimit},set:function(a){this.W.breadthLimit!==a&&0<=a&&(this.W.breadthLimit=a,this.B())}},alternateRowSpacing:{get:function(){return this.W.rowSpacing},set:function(a){this.W.rowSpacing!==a&&(this.W.rowSpacing=a,this.B())}},alternateRowIndent:{
get:function(){return this.W.rowIndent},set:function(a){this.W.rowIndent!==a&&0<=a&&(this.W.rowIndent=a,this.B())}},alternateCommentSpacing:{get:function(){return this.W.commentSpacing},set:function(a){this.W.commentSpacing!==a&&(this.W.commentSpacing=a,this.B())}},alternateCommentMargin:{get:function(){return this.W.commentMargin},set:function(a){this.W.commentMargin!==a&&(this.W.commentMargin=a,this.B())}},alternateSetsPortSpot:{
get:function(){return this.W.setsPortSpot},set:function(a){this.W.setsPortSpot!==a&&(this.W.setsPortSpot=a,this.B())}},alternatePortSpot:{get:function(){return this.W.portSpot},set:function(a){this.W.portSpot.A(a)||(this.W.portSpot=a,this.B())}},alternateSetsChildPortSpot:{get:function(){return this.W.setsChildPortSpot},set:function(a){this.W.setsChildPortSpot!==a&&(this.W.setsChildPortSpot=a,this.B())}},alternateChildPortSpot:{
get:function(){return this.W.childPortSpot},set:function(a){this.W.childPortSpot.A(a)||(this.W.childPortSpot=a,this.B())}}});
var jt=new D(it,"PathDefault",-1),kt=new D(it,"PathDestination",0),rt=new D(it,"PathSource",1),Gt=new D(it,"SortingForwards",10),Ht=new D(it,"SortingReverse",11),It=new D(it,"SortingAscending",12),Jt=new D(it,"SortingDescending",13),ku=new D(it,"AlignmentCenterSubtrees",20),lu=new D(it,"AlignmentCenterChildren",21),bu=new D(it,"AlignmentStart",22),Zt=new D(it,"AlignmentEnd",23),Lt=new D(it,"AlignmentBus",24),Bt=new D(it,"AlignmentBusBranching",25),Mt=new D(it,"AlignmentTopLeftBus",26),Nt=new D(it,
"AlignmentBottomRightBus",27),Qt=new D(it,"CompactionNone",30),Xt=new D(it,"CompactionBlock",31),lt=new D(it,"StyleLayered",40),Ft=new D(it,"StyleLastParents",41),Et=new D(it,"StyleAlternating",42),Dt=new D(it,"StyleRootOnly",43),nt=new D(it,"ArrangementVertical",50),tu=new D(it,"ArrangementHorizontal",51),qt=new D(it,"ArrangementFixedRoots",52),mt=new D(it,"LayerIndividual",60),zt=new D(it,"LayerSiblings",61),yt=new D(it,"LayerUniform",62);it.className="TreeLayout";it.PathDefault=jt;
it.PathDestination=kt;it.PathSource=rt;it.SortingForwards=Gt;it.SortingReverse=Ht;it.SortingAscending=It;it.SortingDescending=Jt;it.AlignmentCenterSubtrees=ku;it.AlignmentCenterChildren=lu;it.AlignmentStart=bu;it.AlignmentEnd=Zt;it.AlignmentBus=Lt;it.AlignmentBusBranching=Bt;it.AlignmentTopLeftBus=Mt;it.AlignmentBottomRightBus=Nt;it.CompactionNone=Qt;it.CompactionBlock=Xt;it.StyleLayered=lt;it.StyleLastParents=Ft;it.StyleAlternating=Et;it.StyleRootOnly=Dt;it.ArrangementVertical=nt;
it.ArrangementHorizontal=tu;it.ArrangementFixedRoots=qt;it.LayerIndividual=mt;it.LayerSiblings=zt;it.LayerUniform=yt;function ot(a){Pp.call(this,a)}ma(ot,Pp);ot.prototype.createVertex=function(){return new pt(this)};ot.prototype.createEdge=function(){return new vu(this)};ot.className="TreeNetwork";
function pt(a){cq.call(this,a);this.wa=!1;this.Gb=null;this.C=[];this.Qb=this.Ma=this.K=this.Ba=0;this.jd=null;this.T=new K(0,0);this.va=new Gb(0,0);this.fa=new K(0,0);this.um=this.tm=this.MA=!1;this.sq=this.gq=null;this.$c=Gt;this.Tc=jq;this.yb=0;this.xb=lu;this.Cr=this.Br=0;this.Dr=20;this.ve=50;this.tr=0;this.Mq=Xt;this.Fq=0;this.Mr=25;this.Lq=this.Lr=10;this.Kq=20;this.Rr=!0;this.Ir=Wc;this.Qr=!0;this.Iq=Wc}ma(pt,cq);
pt.prototype.copyInheritedPropertiesFrom=function(a){null!==a&&(this.$c=a.sorting,this.Tc=a.comparer,this.yb=a.angle,this.xb=a.alignment,this.Br=a.nodeIndent,this.Cr=a.nodeIndentPastParent,this.Dr=a.nodeSpacing,this.ve=a.layerSpacing,this.tr=a.layerSpacingParentOverlap,this.Mq=a.compaction,this.Fq=a.breadthLimit,this.Mr=a.rowSpacing,this.Lr=a.rowIndent,this.Lq=a.commentSpacing,this.Kq=a.commentMargin,this.Rr=a.setsPortSpot,this.Ir=a.portSpot,this.Qr=a.setsChildPortSpot,this.Iq=a.childPortSpot)};
na.Object.defineProperties(pt.prototype,{initialized:{get:function(){return this.wa},set:function(a){this.wa!==a&&(this.wa=a)}},parent:{get:function(){return this.Gb},set:function(a){this.Gb!==a&&(this.Gb=a)}},children:{get:function(){return this.C},set:function(a){if(this.C!==a){if(null!==a)for(var b=a.length,c=0;c<b;c++);this.C=a}}},level:{get:function(){return this.Ba},set:function(a){this.Ba!==
a&&(this.Ba=a)}},descendantCount:{get:function(){return this.K},set:function(a){this.K!==a&&(this.K=a)}},maxChildrenCount:{get:function(){return this.Ma},set:function(a){this.Ma!==a&&(this.Ma=a)}},maxGenerationCount:{get:function(){return this.Qb},set:function(a){this.Qb!==a&&(this.Qb=a)}},comments:{get:function(){return this.jd},set:function(a){if(this.jd!==a){if(null!==a)for(var b=
a.length,c=0;c<b;c++);this.jd=a}}},sorting:{get:function(){return this.$c},set:function(a){this.$c!==a&&(this.$c=a)}},comparer:{get:function(){return this.Tc},set:function(a){this.Tc!==a&&(this.Tc=a)}},angle:{get:function(){return this.yb},set:function(a){this.yb!==a&&(this.yb=a)}},alignment:{get:function(){return this.xb},set:function(a){this.xb!==a&&(this.xb=a)}},nodeIndent:{
get:function(){return this.Br},set:function(a){this.Br!==a&&(this.Br=a)}},nodeIndentPastParent:{get:function(){return this.Cr},set:function(a){this.Cr!==a&&(this.Cr=a)}},nodeSpacing:{get:function(){return this.Dr},set:function(a){this.Dr!==a&&(this.Dr=a)}},layerSpacing:{get:function(){return this.ve},set:function(a){this.ve!==a&&(this.ve=a)}},layerSpacingParentOverlap:{
get:function(){return this.tr},set:function(a){this.tr!==a&&(this.tr=a)}},compaction:{get:function(){return this.Mq},set:function(a){this.Mq!==a&&(this.Mq=a)}},breadthLimit:{get:function(){return this.Fq},set:function(a){this.Fq!==a&&(this.Fq=a)}},rowSpacing:{get:function(){return this.Mr},set:function(a){this.Mr!==a&&(this.Mr=a)}},rowIndent:{get:function(){return this.Lr},set:function(a){this.Lr!==
a&&(this.Lr=a)}},commentSpacing:{get:function(){return this.Lq},set:function(a){this.Lq!==a&&(this.Lq=a)}},commentMargin:{get:function(){return this.Kq},set:function(a){this.Kq!==a&&(this.Kq=a)}},setsPortSpot:{get:function(){return this.Rr},set:function(a){this.Rr!==a&&(this.Rr=a)}},portSpot:{get:function(){return this.Ir},set:function(a){this.Ir.A(a)||(this.Ir=a)}},setsChildPortSpot:{
get:function(){return this.Qr},set:function(a){this.Qr!==a&&(this.Qr=a)}},childPortSpot:{get:function(){return this.Iq},set:function(a){this.Iq.A(a)||(this.Iq=a)}},childrenCount:{get:function(){return this.children.length}},relativePosition:{get:function(){return this.T},set:function(a){this.T.set(a)}},subtreeSize:{get:function(){return this.va},set:function(a){this.va.set(a)}},
subtreeOffset:{get:function(){return this.fa},set:function(a){this.fa.set(a)}}});pt.className="TreeVertex";function vu(a){dq.call(this,a);this.hu=new K(0,0)}ma(vu,dq);
vu.prototype.commit=function(){var a=this.link;if(null!==a&&!a.isAvoiding){var b=this.network.layout,c=null,d=null;switch(b.ld){case kt:c=this.fromVertex;d=this.toVertex;break;case rt:c=this.toVertex;d=this.fromVertex;break;default:B("Unhandled path value "+b.ld.toString())}if(null!==c&&null!==d)if(b=this.hu,0!==b.x||0!==b.y||c.MA){d=c.bounds;var e=Yt(c),f=$t(c),g=c.rowSpacing;a.vg();var h=a.curve===Uf,k=a.isOrthogonal,l;a.Lh();if(k||h){for(l=2;4<a.pointsCount;)a.Iv(2);var m=a.i(1);var n=a.i(2)}else{for(l=
1;3<a.pointsCount;)a.Iv(1);m=a.i(0);n=a.i(a.pointsCount-1)}var p=a.i(a.pointsCount-1);0===e?(c.alignment===Zt?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-au(c))))):c.alignment===bu?(e=d.top+b.y,0===b.y&&m.y<p.y-c.rowIndent&&(e=Math.max(e,Math.min(m.y,e+au(c))))):e=c.tm||c.um&&1===c.maxGenerationCount?d.top-c.fa.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===Zt?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-au(c))))):c.alignment===bu?(e=d.left+b.x,0===b.x&&m.x<p.x-c.rowIndent&&(e=Math.max(e,Math.min(m.x,e+au(c))))):e=c.tm||c.um&&1===c.maxGenerationCount?d.left-c.fa.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===Zt?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-au(c))))):c.alignment===bu?(e=d.top+b.y,0===b.y&&m.y<p.y-c.rowIndent&&(e=Math.max(e,Math.min(m.y,e+au(c))))):e=c.tm||c.um&&1===c.maxGenerationCount?d.top-c.fa.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===Zt?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-au(c))))):c.alignment===bu?(e=d.left+b.x,0===b.x&&m.x<p.x-c.rowIndent&&(e=Math.max(e,Math.min(m.x,e+au(c))))):e=c.tm||c.um&&1===c.maxGenerationCount?
d.left-c.fa.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.vf()}else a=this.link,f=Yt(c),f!==Yt(d)&&(g=$t(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.vg(),c=a.curve===Uf,b=a.isOrthogonal,d=Kt(this.fromVertex.alignment),a.Lh(),0===f?(f=h.right+g/2,c?4===a.pointsCount&&(c=a.i(3).y,a.M(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.M(5,a.i(5).x,c)):b?d?a.M(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.M(2,f,a.i(2).y),a.M(3,f,a.i(3).y)):4===a.pointsCount?a.m(2,f,a.i(2).y):3===a.pointsCount?a.M(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.M(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.M(5,c,a.i(5).y)):b?d?a.M(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.M(2,a.i(2).x,f),a.M(3,a.i(3).x,f)):4===a.pointsCount?a.m(2,a.i(2).x,f):3===a.pointsCount?a.M(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.M(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.M(5,a.i(5).x,c)):b?d?a.M(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.M(2,f,a.i(2).y),a.M(3,f,a.i(3).y)):4===a.pointsCount?a.m(2,f,a.i(2).y):3===a.pointsCount?
a.M(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.M(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.M(5,c,a.i(5).y)):b?d?a.M(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.M(2,a.i(2).x,f),a.M(3,a.i(3).x,f)):4===a.pointsCount?a.m(2,a.i(2).x,f):3===a.pointsCount?a.M(1,a.i(2).x,f):2===a.pointsCount&&a.m(1,a.i(1).x,f)),a.vf()))}};
na.Object.defineProperties(vu.prototype,{fromVertex:{get:function(){return this.Vc},set:function(a){this.Vc!==a&&(this.Vc=a)}},toVertex:{get:function(){return this.cd},set:function(a){this.cd!==a&&(this.cd=a)}},relativePoint:{get:function(){return this.hu},set:function(a){this.hu.set(a)}}});vu.className="TreeEdge";
Pa.prototype.initializeStandardTools=function(){this.Za("Action",new ug,this.mouseDownTools);this.Za("Relinking",new Se,this.mouseDownTools);this.Za("LinkReshaping",new Sf,this.mouseDownTools);this.Za("Rotating",new sg,this.mouseDownTools);this.Za("Resizing",new lg,this.mouseDownTools);this.Za("Linking",new Lf,this.mouseMoveTools);this.Za("Dragging",new Le,this.mouseMoveTools);this.Za("DragSelecting",new xg,this.mouseMoveTools);this.Za("Panning",new yg,this.mouseMoveTools);this.Za("ContextMenu",new Ag,
this.mouseUpTools);this.Za("TextEditing",new Lg,this.mouseUpTools);this.Za("ClickCreating",new vg,this.mouseUpTools);this.Za("ClickSelecting",new tg,this.mouseUpTools)};kn("Horizontal",new om);kn("Spot",new qm);kn("Table",new vm);kn("Viewbox",new Am);kn("TableRow",new ym);kn("TableColumn",new zm);kn("Graduated",new Km);kn("Grid",new Bm);ii.add("GraphLinksModel",Cq);ii.add("TreeModel",Qq);Vp(Xr,null);Vp(ls,null);
var wu=x.go,xu={get licenseKey(){return Q.licenseKey},set licenseKey(a){Q.licenseKey=a},get version(){return Q.version},Group:U,EnumValue:D,List:E,Set:G,Map:H,Point:K,Size:Gb,Rect:N,Margin:lc,Spot:O,Geometry:P,PathFigure:$d,PathSegment:ae,InputEvent:ce,DiagramEvent:ee,ChangedEvent:fe,Model:Z,GraphLinksModel:kr,TreeModel:pr,Binding:si,Transaction:re,UndoManager:se,CommandHandler:Lk,Tool:ue,DraggingTool:Le,DraggingInfo:Te,DraggingOptions:Me,LinkingBaseTool:wf,LinkingTool:Lf,RelinkingTool:Se,LinkReshapingTool:Sf,
ResizingTool:lg,RotatingTool:sg,ClickSelectingTool:tg,ActionTool:ug,ClickCreatingTool:vg,HTMLInfo:Ee,ContextMenuTool:Ag,DragSelectingTool:xg,PanningTool:yg,TextEditingTool:Lg,ToolManager:Pa,Animation:gh,AnimationManager:ch,AnimationTrigger:Wh,Layer:ai,Diagram:Q,Palette:Ek,Overview:Hk,Brush:hl,GraphObject:Y,Panel:X,RowColumnDefinition:Jj,Shape:xf,TextBlock:Mg,Picture:Rj,Part:V,Adornment:ze,Node:W,Link:T,Placeholder:ng,Layout:ni,LayoutNetwork:Pp,LayoutVertex:cq,LayoutEdge:dq,GridLayout:Gk,PanelLayout:Fl,
CircularLayout:qr,CircularNetwork:Hr,CircularVertex:Vr,CircularEdge:Wr,ForceDirectedLayout:Xr,ForceDirectedNetwork:Yr,ForceDirectedVertex:js,ForceDirectedEdge:ks,LayeredDigraphLayout:ls,LayeredDigraphNetwork:qs,LayeredDigraphVertex:gt,LayeredDigraphEdge:ht,TreeLayout:it,TreeNetwork:ot,TreeVertex:pt,TreeEdge:vu};"object"===typeof wu&&wu.version&&B("WARNING: a `go` object on the root object is already defined.  "+("Debug"in wu?"debug ":"")+"version: "+wu.version+", replaced with version: "+xu.version);
Q.prototype.go=xu;x.go=xu;("undefined"===typeof x||"undefined"===typeof x.module||"object"!==typeof x.module.exports)&&x.define&&"function"===typeof x.define&&x.define.amd&&x.define(xu); 'undefined'!==typeof module&&'object'===typeof module.exports&&(module.exports='undefined'!==typeof global?global.go:self.go); })();
