text: /*
   * GoJS v2.1.16 JavaScript Library for HTML Diagrams, https://gojs.net
   * GoJS and Northwoods Software are registered trademarks of Northwoods Software Corporation, https://www.nwoods.com.
   * Copyright (C) 1998-2020 by Northwoods Software Corporation.  All Rights Reserved.
   * THIS SOFTWARE IS LICENSED.  THE LICENSE AGREEMENT IS AT: https://gojs.net/2.1.16/license.html.
   * DO NOT MODIFY THIS FILE.  DO NOT DISTRIBUTE A MODIFIED COPY OF THE CONTENTS OF THIS FILE.
   */
  (function() { var t;function aa(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}function ba(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):{next:aa(a)}}function da(a){for(var b,c=[];!(b=a.next()).done;)c.push(b.value);return c}var ea="function"==typeof Object.create?Object.create:function(a){function b(){}b.prototype=a;return new b},fa;
    if("function"==typeof Object.setPrototypeOf)fa=Object.setPrototypeOf;else{var ha;a:{var ia={a:!0},ja={};try{ja.__proto__=ia;ha=ja.a;break a}catch(a){}ha=!1}fa=ha?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null}var ka=fa;
    function la(a,b){a.prototype=ea(b.prototype);a.prototype.constructor=a;if(ka)ka(a,b);else for(var c in b)if("prototype"!=c)if(Object.defineProperties){var d=Object.getOwnPropertyDescriptor(b,c);d&&Object.defineProperty(a,c,d)}else a[c]=b[c];a.NA=b.prototype}var ma="undefined"!=typeof window&&window===self?self:"undefined"!=typeof global&&null!=global?global:self,na="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};
    function oa(a){if(a){for(var b=ma,c=["Array","prototype","fill"],d=0;d<c.length-1;d++){var e=c[d];e in b||(b[e]={});b=b[e]}c=c[c.length-1];d=b[c];a=a(d);a!=d&&null!=a&&na(b,c,{writable:!0,value:a})}}oa(function(a){return a?a:function(a,c,d){var b=this.length||0;0>c&&(c=Math.max(0,b+c));if(null==d||d>b)d=b;d=Number(d);0>d&&(d=Math.max(0,b+d));for(c=Number(c||0);c<d;c++)this[c]=a;return this}});var x="object"===typeof self&&self.self===self&&self||"object"===typeof global&&global.global===global&&global||"object"===typeof window&&window.window===window&&window||{};void 0===x.requestAnimationFrame&&(x.requestAnimationFrame=x.setImmediate);function qa(){}function ra(a,b){var c=-1;return function(){var d=this,e=arguments;-1!==c&&x.clearTimeout(c);c=sa(function(){c=-1;a.apply(d,e)},b)}}function sa(a,b){return x.setTimeout(a,b)}function ta(a){return x.document.createElement(a)}
    function B(a){throw Error(a);}function ua(a,b){a="The object is frozen, so its properties cannot be set: "+a.toString();void 0!==b&&(a+="  to value: "+b);B(a)}function va(a,b,c,d){c=null===c?"*":"string"===typeof c?c:"function"===typeof c&&"string"===typeof c.className?c.className:"";void 0!==d&&(c+="."+d);B(c+" is not in the range "+b+": "+a)}function wa(a){x.console&&x.console.log(a)}
    function ya(){x.console&&x.console.log("Warning: List/Map/Set constructors no longer take an argument that enforces type.Instead they take an optional collection of Values to add to the collection. See 2.0 changelog for details.")}function za(a){return"object"===typeof a&&null!==a}function Aa(a){return Array.isArray(a)||x.NodeList&&a instanceof x.NodeList||x.HTMLCollection&&a instanceof x.HTMLCollection}function Ba(a){return Array.prototype.slice.call(a)}
    function Ca(a,b,c){Array.isArray(a)?b>=a.length?a.push(c):a.splice(b,0,c):B("Cannot insert an object into an HTMLCollection or NodeList: "+c+" at "+b)}function Da(a,b){Array.isArray(a)?b>=a.length?a.pop():a.splice(b,1):B("Cannot remove an object from an HTMLCollection or NodeList at "+b)}function Fa(){var a=Ga.pop();return void 0===a?[]:a}function Ha(a){a.length=0;Ga.push(a)}
    function Ia(a){if("function"===typeof a){if(a.className)return a.className;if(a.name)return a.name;var b=a.toString();b=b.substring(9,b.indexOf("(")).trim();if(""!==b)return a._className=b}else if(za(a)&&a.constructor)return Ia(a.constructor);return typeof a}
    function Ja(a){var b=a;za(a)&&(a.text?b=a.text:a.name?b=a.name:void 0!==a.key?b=a.key:void 0!==a.id?b=a.id:a.constructor===Object&&(a.Text?b=a.Text:a.Name?b=a.Name:void 0!==a.Key?b=a.Key:void 0!==a.Id?b=a.Id:void 0!==a.ID&&(b=a.ID)));return void 0===b?"undefined":null===b?"null":b.toString()}function Ka(a,b){if(a.hasOwnProperty(b))return!0;for(a=Object.getPrototypeOf(a);a&&a!==Function;){if(a.hasOwnProperty(b))return!0;var c=a.HA;if(c&&c[b])return!0;a=Object.getPrototypeOf(a)}return!1}
    function La(a,b,c){Object.defineProperty(Oa.prototype,a,{get:b,set:c})}function Pa(){var a=Qa;if(0===a.length)for(var b=x.document.getElementsByTagName("canvas"),c=b.length,d=0;d<c;d++){var e=b[d];e.parentElement&&e.parentElement.B&&a.push(e.parentElement.B)}return a}
    function Ra(a){for(var b=[],c=0;256>c;c++)b["0123456789abcdef".charAt(c>>4)+"0123456789abcdef".charAt(c&15)]=String.fromCharCode(c);a.length%2&&(a="0"+a);c=[];for(var d=0,e=0;e<a.length;e+=2)c[d++]=b[a.substr(e,2)];a=c.join("");a=""===a?"0":a;b=[];for(c=0;256>c;c++)b[c]=c;for(c=d=0;256>c;c++)d=(d+b[c]+119)%256,e=b[c],b[c]=b[d],b[d]=e;d=c=0;for(var f="",g=0;g<a.length;g++)c=(c+1)%256,d=(d+b[c])%256,e=b[c],b[c]=b[d],b[d]=e,f+=String.fromCharCode(a.charCodeAt(g)^b[(b[c]+b[d])%256]);return f}
    var Sa=void 0!==x.navigator&&0<x.navigator.userAgent.indexOf("MSIE 9.0"),Ta=void 0!==x.navigator&&0<x.navigator.userAgent.indexOf("MSIE 10.0"),Ua=void 0!==x.navigator&&0<x.navigator.userAgent.indexOf("Trident/7"),Va=void 0!==x.navigator&&0<x.navigator.userAgent.indexOf("Edge/"),Wa=void 0!==x.navigator&&void 0!==x.navigator.platform&&0<=x.navigator.platform.toUpperCase().indexOf("MAC"),Xa=void 0!==x.navigator&&void 0!==x.navigator.platform&&null!==x.navigator.platform.match(/(iPhone|iPod|iPad)/i),
      Ga=[];Object.freeze([]);var Qa=[];qa.className="Util";qa.Dx="32ab5ff3b26f42dc0ed90f21442913b5";qa.adym="gojs.net";qa.vfo="28e647fdb260";qa.className="Util";function D(a,b,c){Ya(this);this.l=a;this.Qa=b;this.v=c}D.prototype.toString=function(){return"EnumValue."+this.Qa};function Za(a,b){return void 0===b||null===b||""===b?null:a[b]}
    ma.Object.defineProperties(D.prototype,{classType:{get:function(){return this.l}},name:{get:function(){return this.Qa}},value:{get:function(){return this.v}}});D.className="EnumValue";function cb(){this.Qw=[]}cb.prototype.toString=function(){return this.Qw.join("")};cb.prototype.add=function(a){""!==a&&this.Qw.push(a)};cb.className="StringBuilder";function db(){}db.className="PropertyCollection";
    function eb(){}eb.prototype.reset=function(){};eb.prototype.next=function(){return!1};eb.prototype.ed=function(){return!1};eb.prototype.first=function(){return null};eb.prototype.any=function(){return!1};eb.prototype.all=function(){return!0};eb.prototype.each=function(){return this};eb.prototype.map=function(){return this};eb.prototype.filter=function(){return this};eb.prototype.Cd=function(){};eb.prototype.toString=function(){return"EmptyIterator"};
    ma.Object.defineProperties(eb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return 0}}});eb.prototype.first=eb.prototype.first;eb.prototype.hasNext=eb.prototype.ed;eb.prototype.next=eb.prototype.next;eb.prototype.reset=eb.prototype.reset;var fb=null;eb.className="EmptyIterator";fb=new eb;function gb(a){this.key=-1;this.value=a}gb.prototype.reset=function(){this.key=-1};
    gb.prototype.next=function(){return-1===this.key?(this.key=0,!0):!1};gb.prototype.ed=function(){return this.next()};gb.prototype.first=function(){this.key=0;return this.value};gb.prototype.any=function(a){this.key=-1;return a(this.value)};gb.prototype.all=function(a){this.key=-1;return a(this.value)};gb.prototype.each=function(a){this.key=-1;a(this.value);return this};gb.prototype.map=function(a){return new gb(a(this.value))};
    gb.prototype.filter=function(a){return a(this.value)?new gb(this.value):fb};gb.prototype.Cd=function(){this.value=null};gb.prototype.toString=function(){return"SingletonIterator("+this.value+")"};ma.Object.defineProperties(gb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return 1}}});gb.prototype.first=gb.prototype.first;gb.prototype.hasNext=gb.prototype.ed;gb.prototype.next=gb.prototype.next;
    gb.prototype.reset=gb.prototype.reset;gb.className="SingletonIterator";function jb(a){this.nb=a;this.af=null;a.Fa=null;this.ia=a.Aa;this.Oa=-1}jb.prototype.reset=function(){var a=this.nb;a.Fa=null;this.ia=a.Aa;this.Oa=-1};jb.prototype.next=function(){var a=this.nb;if(a.Aa!==this.ia&&0>this.key)return!1;a=a.j;var b=a.length,c=++this.Oa,d=this.af;if(null!==d)for(;c<b;){var e=a[c];if(d(e))return this.key=this.Oa=c,this.value=e,!0;c++}else{if(c<b)return this.key=c,this.value=a[c],!0;this.Cd()}return!1};
    jb.prototype.ed=function(){return this.next()};jb.prototype.first=function(){var a=this.nb;this.ia=a.Aa;this.Oa=0;a=a.j;var b=a.length,c=this.af;if(null!==c){for(var d=0;d<b;){var e=a[d];if(c(e))return this.key=this.Oa=d,this.value=e;d++}return null}return 0<b?(a=a[0],this.key=0,this.value=a):null};jb.prototype.any=function(a){var b=this.nb;b.Fa=null;this.Oa=-1;b=b.j;for(var c=b.length,d=this.af,e=0;e<c;e++){var f=b[e];if((null===d||d(f))&&a(f))return!0}return!1};
    jb.prototype.all=function(a){var b=this.nb;b.Fa=null;this.Oa=-1;b=b.j;for(var c=b.length,d=this.af,e=0;e<c;e++){var f=b[e];if((null===d||d(f))&&!a(f))return!1}return!0};jb.prototype.each=function(a){var b=this.nb;b.Fa=null;this.Oa=-1;b=b.j;for(var c=b.length,d=this.af,e=0;e<c;e++){var f=b[e];(null===d||d(f))&&a(f)}return this};
    jb.prototype.map=function(a){var b=this.nb;b.Fa=null;this.Oa=-1;var c=[];b=b.j;for(var d=b.length,e=this.af,f=0;f<d;f++){var g=b[f];(null===e||e(g))&&c.push(a(g))}a=new E;a.j=c;a.ib();return a.iterator};jb.prototype.filter=function(a){var b=this.nb;b.Fa=null;this.Oa=-1;var c=[];b=b.j;for(var d=b.length,e=this.af,f=0;f<d;f++){var g=b[f];(null===e||e(g))&&a(g)&&c.push(g)}a=new E;a.j=c;a.ib();return a.iterator};
    jb.prototype.Cd=function(){this.key=-1;this.value=null;this.ia=-1;this.af=null;this.nb.Fa=this};jb.prototype.toString=function(){return"ListIterator@"+this.Oa+"/"+this.nb.count};
    ma.Object.defineProperties(jb.prototype,{iterator:{get:function(){return this}},predicate:{get:function(){return this.af},set:function(a){this.af=a}},count:{get:function(){var a=this.af;if(null!==a){for(var b=0,c=this.nb.j,d=c.length,e=0;e<d;e++)a(c[e])&&b++;return b}return this.nb.j.length}}});jb.prototype.first=jb.prototype.first;jb.prototype.hasNext=jb.prototype.ed;jb.prototype.next=jb.prototype.next;
    jb.prototype.reset=jb.prototype.reset;jb.className="ListIterator";function kb(a){this.nb=a;a.$g=null;this.ia=a.Aa;this.Oa=a.j.length}kb.prototype.reset=function(){var a=this.nb;a.$g=null;this.ia=a.Aa;this.Oa=a.j.length};kb.prototype.next=function(){var a=this.nb;if(a.Aa!==this.ia&&0>this.key)return!1;var b=--this.Oa;if(0<=b)return this.key=b,this.value=a.j[b],!0;this.Cd();return!1};kb.prototype.ed=function(){return this.next()};
    kb.prototype.first=function(){var a=this.nb;this.ia=a.Aa;var b=a.j;this.Oa=a=b.length-1;return 0<=a?(b=b[a],this.key=a,this.value=b):null};kb.prototype.any=function(a){var b=this.nb;b.$g=null;b=b.j;var c=b.length;this.Oa=c;for(--c;0<=c;c--)if(a(b[c]))return!0;return!1};kb.prototype.all=function(a){var b=this.nb;b.$g=null;b=b.j;var c=b.length;this.Oa=c;for(--c;0<=c;c--)if(!a(b[c]))return!1;return!0};
    kb.prototype.each=function(a){var b=this.nb;b.$g=null;b=b.j;var c=b.length;this.Oa=c;for(--c;0<=c;c--)a(b[c]);return this};kb.prototype.map=function(a){var b=this.nb;b.$g=null;var c=[];b=b.j;var d=b.length;this.Oa=d;for(--d;0<=d;d--)c.push(a(b[d]));a=new E;a.j=c;a.ib();return a.iterator};kb.prototype.filter=function(a){var b=this.nb;b.$g=null;var c=[];b=b.j;var d=b.length;this.Oa=d;for(--d;0<=d;d--){var e=b[d];a(e)&&c.push(e)}a=new E;a.j=c;a.ib();return a.iterator};
    kb.prototype.Cd=function(){this.key=-1;this.value=null;this.ia=-1;this.nb.$g=this};kb.prototype.toString=function(){return"ListIteratorBackwards("+this.Oa+"/"+this.nb.count+")"};ma.Object.defineProperties(kb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.nb.j.length}}});kb.prototype.first=kb.prototype.first;kb.prototype.hasNext=kb.prototype.ed;kb.prototype.next=kb.prototype.next;kb.prototype.reset=kb.prototype.reset;
    kb.className="ListIteratorBackwards";function E(a){Ya(this);this.s=!1;this.j=[];this.Aa=0;this.$g=this.Fa=null;void 0!==a&&("function"===typeof a||"string"===typeof a?ya():this.addAll(a))}t=E.prototype;t.ib=function(){var a=this.Aa;a++;999999999<a&&(a=0);this.Aa=a};t.freeze=function(){this.s=!0;return this};t.ea=function(){this.s=!1;return this};t.toString=function(){return"List()#"+lb(this)};t.add=function(a){if(null===a)return this;this.s&&ua(this,a);this.j.push(a);this.ib();return this};
    t.push=function(a){this.add(a)};t.addAll=function(a){if(null===a)return this;this.s&&ua(this);var b=this.j;if(Aa(a))for(var c=a.length,d=0;d<c;d++)b.push(a[d]);else for(a=a.iterator;a.next();)b.push(a.value);this.ib();return this};t.clear=function(){this.s&&ua(this);this.j.length=0;this.ib()};t.contains=function(a){return null===a?!1:-1!==this.j.indexOf(a)};t.has=function(a){return this.contains(a)};t.indexOf=function(a){return null===a?-1:this.j.indexOf(a)};
    t.L=function(a){var b=this.j;(0>a||a>=b.length)&&va(a,"0 <= i < length",E,"elt:i");return b[a]};t.get=function(a){return this.L(a)};t.hd=function(a,b){var c=this.j;(0>a||a>=c.length)&&va(a,"0 <= i < length",E,"setElt:i");this.s&&ua(this,a);c[a]=b};t.set=function(a,b){this.hd(a,b)};t.first=function(){var a=this.j;return 0===a.length?null:a[0]};t.Xb=function(){var a=this.j,b=a.length;return 0<b?a[b-1]:null};t.pop=function(){this.s&&ua(this);var a=this.j;return 0<a.length?a.pop():null};
    E.prototype.any=function(a){for(var b=this.j,c=b.length,d=0;d<c;d++)if(a(b[d]))return!0;return!1};E.prototype.all=function(a){for(var b=this.j,c=b.length,d=0;d<c;d++)if(!a(b[d]))return!1;return!0};E.prototype.each=function(a){for(var b=this.j,c=b.length,d=0;d<c;d++)a(b[d]);return this};E.prototype.map=function(a){for(var b=new E,c=[],d=this.j,e=d.length,f=0;f<e;f++)c.push(a(d[f]));b.j=c;b.ib();return b};
    E.prototype.filter=function(a){for(var b=new E,c=[],d=this.j,e=d.length,f=0;f<e;f++){var g=d[f];a(g)&&c.push(g)}b.j=c;b.ib();return b};t=E.prototype;t.Kb=function(a,b){0>a&&va(a,">= 0",E,"insertAt:i");this.s&&ua(this,a);var c=this.j;a>=c.length?c.push(b):c.splice(a,0,b);this.ib()};t.remove=function(a){if(null===a)return!1;this.s&&ua(this,a);var b=this.j;a=b.indexOf(a);if(-1===a)return!1;a===b.length-1?b.pop():b.splice(a,1);this.ib();return!0};t.delete=function(a){return this.remove(a)};
    t.lb=function(a){var b=this.j;(0>a||a>=b.length)&&va(a,"0 <= i < length",E,"removeAt:i");this.s&&ua(this,a);a===b.length-1?b.pop():b.splice(a,1);this.ib()};t.removeRange=function(a,b){var c=this.j,d=c.length;if(0>a)a=0;else if(a>=d)return this;if(0>b)return this;b>=d&&(b=d-1);if(a>b)return this;this.s&&ua(this);for(var e=a,f=b+1;f<d;)c[e++]=c[f++];c.length=d-(b-a+1);this.ib();return this};E.prototype.copy=function(){var a=new E,b=this.j;0<b.length&&(a.j=Array.prototype.slice.call(b));return a};
    t=E.prototype;t.na=function(){for(var a=this.j,b=this.count,c=Array(b),d=0;d<b;d++)c[d]=a[d];return c};t.ow=function(){for(var a=new F,b=this.j,c=this.count,d=0;d<c;d++)a.add(b[d]);return a};t.sort=function(a){this.s&&ua(this);this.j.sort(a);this.ib();return this};
    t.ej=function(a,b,c){var d=this.j,e=d.length;void 0===b&&(b=0);void 0===c&&(c=e);this.s&&ua(this);var f=c-b;if(1>=f)return this;(0>b||b>=e-1)&&va(b,"0 <= from < length",E,"sortRange:from");if(2===f)return c=d[b],e=d[b+1],0<a(c,e)&&(d[b]=e,d[b+1]=c,this.ib()),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.ib();return this};
    t.reverse=function(){this.s&&ua(this);this.j.reverse();this.ib();return this};
    ma.Object.defineProperties(E.prototype,{_dataArray:{get:function(){return this.j}},count:{get:function(){return this.j.length}},size:{get:function(){return this.j.length}},length:{get:function(){return this.j.length}},iterator:{get:function(){if(0>=this.j.length)return fb;var a=this.Fa;return null!==a?(a.reset(),a):new jb(this)}},iteratorBackwards:{
        get:function(){if(0>=this.j.length)return fb;var a=this.$g;return null!==a?(a.reset(),a):new kb(this)}}});E.prototype.reverse=E.prototype.reverse;E.prototype.sortRange=E.prototype.ej;E.prototype.sort=E.prototype.sort;E.prototype.toSet=E.prototype.ow;E.prototype.toArray=E.prototype.na;E.prototype.removeRange=E.prototype.removeRange;E.prototype.removeAt=E.prototype.lb;E.prototype["delete"]=E.prototype.delete;E.prototype.remove=E.prototype.remove;E.prototype.insertAt=E.prototype.Kb;
    E.prototype.pop=E.prototype.pop;E.prototype.last=E.prototype.Xb;E.prototype.first=E.prototype.first;E.prototype.set=E.prototype.set;E.prototype.setElt=E.prototype.hd;E.prototype.get=E.prototype.get;E.prototype.elt=E.prototype.L;E.prototype.indexOf=E.prototype.indexOf;E.prototype.has=E.prototype.has;E.prototype.contains=E.prototype.contains;E.prototype.clear=E.prototype.clear;E.prototype.addAll=E.prototype.addAll;E.prototype.push=E.prototype.push;E.prototype.add=E.prototype.add;E.prototype.thaw=E.prototype.ea;
    E.prototype.freeze=E.prototype.freeze;E.className="List";function mb(a){this.pg=a;a.Fa=null;this.ia=a.Aa;this.la=null}mb.prototype.reset=function(){var a=this.pg;a.Fa=null;this.ia=a.Aa;this.la=null};mb.prototype.next=function(){var a=this.pg;if(a.Aa!==this.ia&&null===this.key)return!1;var b=this.la;b=null===b?a.ba:b.oa;if(null!==b)return this.la=b,this.value=b.value,this.key=b.key,!0;this.Cd();return!1};mb.prototype.ed=function(){return this.next()};
    mb.prototype.first=function(){var a=this.pg;this.ia=a.Aa;a=a.ba;if(null!==a){this.la=a;var b=a.value;this.key=a.key;return this.value=b}return null};mb.prototype.any=function(a){var b=this.pg;this.la=b.Fa=null;for(b=b.ba;null!==b;){if(a(b.value))return!0;b=b.oa}return!1};mb.prototype.all=function(a){var b=this.pg;this.la=b.Fa=null;for(b=b.ba;null!==b;){if(!a(b.value))return!1;b=b.oa}return!0};mb.prototype.each=function(a){var b=this.pg;this.la=b.Fa=null;for(b=b.ba;null!==b;)a(b.value),b=b.oa;return this};
    mb.prototype.map=function(a){var b=this.pg;b.Fa=null;var c=new E;for(b=b.ba;null!==b;)c.add(a(b.value)),b=b.oa;return c.iterator};mb.prototype.filter=function(a){var b=this.pg;b.Fa=null;var c=new E;for(b=b.ba;null!==b;){var d=b.value;a(d)&&c.add(d);b=b.oa}return c.iterator};mb.prototype.Cd=function(){this.value=this.key=null;this.ia=-1;this.pg.Fa=this};mb.prototype.toString=function(){return null!==this.la?"SetIterator@"+this.la.value:"SetIterator"};
    ma.Object.defineProperties(mb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.pg.Cb}}});mb.prototype.first=mb.prototype.first;mb.prototype.hasNext=mb.prototype.ed;mb.prototype.next=mb.prototype.next;mb.prototype.reset=mb.prototype.reset;mb.className="SetIterator";
    function F(a){Ya(this);this.s=!1;this.Eb={};this.Cb=0;this.Fa=null;this.Aa=0;this.Ve=this.ba=null;void 0!==a&&("function"===typeof a||"string"===typeof a?ya():this.addAll(a))}t=F.prototype;t.ib=function(){var a=this.Aa;a++;999999999<a&&(a=0);this.Aa=a};t.freeze=function(){this.s=!0;return this};t.ea=function(){this.s=!1;return this};t.toString=function(){return"Set()#"+lb(this)};
    t.add=function(a){if(null===a)return this;this.s&&ua(this,a);var b=a;za(a)&&(b=nb(a));void 0===this.Eb[b]&&(this.Cb++,a=new ob(a,a),this.Eb[b]=a,b=this.Ve,null===b?this.ba=a:(a.Dl=b,b.oa=a),this.Ve=a,this.ib());return this};t.addAll=function(a){if(null===a)return this;this.s&&ua(this);if(Aa(a))for(var b=a.length,c=0;c<b;c++)this.add(a[c]);else for(a=a.iterator;a.next();)this.add(a.value);return this};
    t.contains=function(a){if(null===a)return!1;var b=a;return za(a)&&(b=lb(a),void 0===b)?!1:void 0!==this.Eb[b]};t.has=function(a){return this.contains(a)};t.Wy=function(a){if(null===a)return!0;for(a=a.iterator;a.next();)if(!this.contains(a.value))return!1;return!0};t.Xy=function(a){if(null===a)return!0;for(a=a.iterator;a.next();)if(this.contains(a.value))return!0;return!1};t.first=function(){var a=this.ba;return null===a?null:a.value};
    F.prototype.any=function(a){for(var b=this.ba;null!==b;){if(a(b.value))return!0;b=b.oa}return!1};F.prototype.all=function(a){for(var b=this.ba;null!==b;){if(!a(b.value))return!1;b=b.oa}return!0};F.prototype.each=function(a){for(var b=this.ba;null!==b;)a(b.value),b=b.oa;return this};F.prototype.map=function(a){for(var b=new F,c=this.ba;null!==c;)b.add(a(c.value)),c=c.oa;return b};F.prototype.filter=function(a){for(var b=new F,c=this.ba;null!==c;){var d=c.value;a(d)&&b.add(d);c=c.oa}return b};t=F.prototype;
    t.remove=function(a){if(null===a)return!1;this.s&&ua(this,a);var b=a;if(za(a)&&(b=lb(a),void 0===b))return!1;a=this.Eb[b];if(void 0===a)return!1;var c=a.oa,d=a.Dl;null!==c&&(c.Dl=d);null!==d&&(d.oa=c);this.ba===a&&(this.ba=c);this.Ve===a&&(this.Ve=d);delete this.Eb[b];this.Cb--;this.ib();return!0};t.delete=function(a){return this.remove(a)};
    t.Fq=function(a){if(null===a)return this;this.s&&ua(this);if(Aa(a))for(var b=a.length,c=0;c<b;c++)this.remove(a[c]);else for(a=a.iterator;a.next();)this.remove(a.value);return this};t.sA=function(a){if(null===a||0===this.count)return this;this.s&&ua(this);var b=new F;b.addAll(a);a=[];for(var c=this.iterator;c.next();){var d=c.value;b.contains(d)||a.push(d)}this.Fq(a);return this};t.clear=function(){this.s&&ua(this);this.Eb={};this.Cb=0;null!==this.Fa&&this.Fa.reset();this.Ve=this.ba=null;this.ib()};
    F.prototype.copy=function(){var a=new F,b=this.Eb,c;for(c in b)a.add(b[c].value);return a};F.prototype.na=function(){var a=Array(this.Cb),b=this.Eb,c=0,d;for(d in b)a[c]=b[d].value,c++;return a};F.prototype.nw=function(){var a=new E,b=this.Eb,c;for(c in b)a.add(b[c].value);return a};function Ya(a){a.__gohashid=pb++}function nb(a){var b=a.__gohashid;void 0===b&&(b=pb++,a.__gohashid=b);return b}function lb(a){return a.__gohashid}
    ma.Object.defineProperties(F.prototype,{count:{get:function(){return this.Cb}},size:{get:function(){return this.Cb}},iterator:{get:function(){if(0>=this.Cb)return fb;var a=this.Fa;return null!==a?(a.reset(),a):new mb(this)}}});F.prototype.toList=F.prototype.nw;F.prototype.toArray=F.prototype.na;F.prototype.clear=F.prototype.clear;F.prototype.retainAll=F.prototype.sA;F.prototype.removeAll=F.prototype.Fq;
    F.prototype["delete"]=F.prototype.delete;F.prototype.remove=F.prototype.remove;F.prototype.first=F.prototype.first;F.prototype.containsAny=F.prototype.Xy;F.prototype.containsAll=F.prototype.Wy;F.prototype.has=F.prototype.has;F.prototype.contains=F.prototype.contains;F.prototype.addAll=F.prototype.addAll;F.prototype.add=F.prototype.add;F.prototype.thaw=F.prototype.ea;F.prototype.freeze=F.prototype.freeze;var pb=1;F.className="Set";F.uniqueHash=Ya;F.hashIdUnique=nb;F.hashId=lb;
    function qb(a){this.fa=a;this.ia=a.Aa;this.la=null}qb.prototype.reset=function(){this.ia=this.fa.Aa;this.la=null};qb.prototype.next=function(){var a=this.fa;if(a.Aa!==this.ia&&null===this.key)return!1;var b=this.la;b=null===b?a.ba:b.oa;if(null!==b)return this.la=b,this.value=this.key=a=b.key,!0;this.Cd();return!1};qb.prototype.ed=function(){return this.next()};qb.prototype.first=function(){var a=this.fa;this.ia=a.Aa;a=a.ba;return null!==a?(this.la=a,this.value=this.key=a=a.key):null};
    qb.prototype.any=function(a){var b=this.fa;this.la=null;for(b=b.ba;null!==b;){if(a(b.key))return!0;b=b.oa}return!1};qb.prototype.all=function(a){var b=this.fa;this.la=null;for(b=b.ba;null!==b;){if(!a(b.key))return!1;b=b.oa}return!0};qb.prototype.each=function(a){var b=this.fa;this.la=null;for(b=b.ba;null!==b;)a(b.key),b=b.oa;return this};qb.prototype.map=function(a){var b=this.fa;this.la=null;var c=new E;for(b=b.ba;null!==b;)c.add(a(b.key)),b=b.oa;return c.iterator};
    qb.prototype.filter=function(a){var b=this.fa;this.la=null;var c=new E;for(b=b.ba;null!==b;){var d=b.key;a(d)&&c.add(d);b=b.oa}return c.iterator};qb.prototype.Cd=function(){this.value=this.key=null;this.ia=-1};qb.prototype.toString=function(){return null!==this.la?"MapKeySetIterator@"+this.la.value:"MapKeySetIterator"};ma.Object.defineProperties(qb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.fa.Cb}}});
    qb.prototype.first=qb.prototype.first;qb.prototype.hasNext=qb.prototype.ed;qb.prototype.next=qb.prototype.next;qb.prototype.reset=qb.prototype.reset;qb.className="MapKeySetIterator";function rb(a){F.call(this);Ya(this);this.s=!0;this.fa=a}la(rb,F);t=rb.prototype;t.freeze=function(){return this};t.ea=function(){return this};t.toString=function(){return"MapKeySet("+this.fa.toString()+")"};t.add=function(){B("This Set is read-only: "+this.toString());return this};t.contains=function(a){return this.fa.contains(a)};
    t.has=function(a){return this.contains(a)};t.remove=function(){B("This Set is read-only: "+this.toString());return!1};t.delete=function(a){return this.remove(a)};t.clear=function(){B("This Set is read-only: "+this.toString())};t.first=function(){var a=this.fa.ba;return null!==a?a.key:null};rb.prototype.any=function(a){for(var b=this.fa.ba;null!==b;){if(a(b.key))return!0;b=b.oa}return!1};rb.prototype.all=function(a){for(var b=this.fa.ba;null!==b;){if(!a(b.key))return!1;b=b.oa}return!0};
    rb.prototype.each=function(a){for(var b=this.fa.ba;null!==b;)a(b.key),b=b.oa;return this};rb.prototype.map=function(a){for(var b=new F,c=this.fa.ba;null!==c;)b.add(a(c.key)),c=c.oa;return b};rb.prototype.filter=function(a){for(var b=new F,c=this.fa.ba;null!==c;){var d=c.key;a(d)&&b.add(d);c=c.oa}return b};rb.prototype.copy=function(){return new rb(this.fa)};rb.prototype.ow=function(){var a=new F,b=this.fa.Eb,c;for(c in b)a.add(b[c].key);return a};
    rb.prototype.na=function(){var a=this.fa.Eb,b=Array(this.fa.Cb),c=0,d;for(d in a)b[c]=a[d].key,c++;return b};rb.prototype.nw=function(){var a=new E,b=this.fa.Eb,c;for(c in b)a.add(b[c].key);return a};ma.Object.defineProperties(rb.prototype,{count:{get:function(){return this.fa.Cb}},size:{get:function(){return this.fa.Cb}},iterator:{get:function(){return 0>=this.fa.Cb?fb:new qb(this.fa)}}});
    rb.prototype.toList=rb.prototype.nw;rb.prototype.toArray=rb.prototype.na;rb.prototype.toSet=rb.prototype.ow;rb.prototype.first=rb.prototype.first;rb.prototype.clear=rb.prototype.clear;rb.prototype["delete"]=rb.prototype.delete;rb.prototype.remove=rb.prototype.remove;rb.prototype.has=rb.prototype.has;rb.prototype.contains=rb.prototype.contains;rb.prototype.add=rb.prototype.add;rb.prototype.thaw=rb.prototype.ea;rb.prototype.freeze=rb.prototype.freeze;rb.className="MapKeySet";
    function sb(a){this.fa=a;a.Ue=null;this.ia=a.Aa;this.la=null}sb.prototype.reset=function(){var a=this.fa;a.Ue=null;this.ia=a.Aa;this.la=null};sb.prototype.next=function(){var a=this.fa;if(a.Aa!==this.ia&&null===this.key)return!1;var b=this.la;b=null===b?a.ba:b.oa;if(null!==b)return this.la=b,this.value=b.value,this.key=b.key,!0;this.Cd();return!1};sb.prototype.ed=function(){return this.next()};
    sb.prototype.first=function(){var a=this.fa;this.ia=a.Aa;a=a.ba;if(null!==a){this.la=a;var b=a.value;this.key=a.key;return this.value=b}return null};sb.prototype.any=function(a){var b=this.fa;this.la=b.Ue=null;for(b=b.ba;null!==b;){if(a(b.value))return!0;b=b.oa}return!1};sb.prototype.all=function(a){var b=this.fa;this.la=b.Ue=null;for(b=b.ba;null!==b;){if(!a(b.value))return!1;b=b.oa}return!0};sb.prototype.each=function(a){var b=this.fa;this.la=b.Ue=null;for(b=b.ba;null!==b;)a(b.value),b=b.oa;return this};
    sb.prototype.map=function(a){var b=this.fa;this.la=b.Ue=null;var c=new E;for(b=b.ba;null!==b;)c.add(a(b.value)),b=b.oa;return c.iterator};sb.prototype.filter=function(a){var b=this.fa;this.la=b.Ue=null;var c=new E;for(b=b.ba;null!==b;){var d=b.value;a(d)&&c.add(d);b=b.oa}return c.iterator};sb.prototype.Cd=function(){this.value=this.key=null;this.ia=-1;this.fa.Ue=this};sb.prototype.toString=function(){return null!==this.la?"MapValueSetIterator@"+this.la.value:"MapValueSetIterator"};
    ma.Object.defineProperties(sb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.fa.Cb}}});sb.prototype.first=sb.prototype.first;sb.prototype.hasNext=sb.prototype.ed;sb.prototype.next=sb.prototype.next;sb.prototype.reset=sb.prototype.reset;sb.className="MapValueSetIterator";function ob(a,b){this.key=a;this.value=b;this.Dl=this.oa=null}ob.prototype.toString=function(){return"{"+this.key+":"+this.value+"}"};
    ob.className="KeyValuePair";function tb(a){this.fa=a;a.Fa=null;this.ia=a.Aa;this.la=null}tb.prototype.reset=function(){var a=this.fa;a.Fa=null;this.ia=a.Aa;this.la=null};tb.prototype.next=function(){var a=this.fa;if(a.Aa!==this.ia&&null===this.key)return!1;var b=this.la;b=null===b?a.ba:b.oa;if(null!==b)return this.la=b,this.key=b.key,this.value=b.value,!0;this.Cd();return!1};tb.prototype.ed=function(){return this.next()};
    tb.prototype.first=function(){var a=this.fa;this.ia=a.Aa;a=a.ba;return null!==a?(this.la=a,this.key=a.key,this.value=a.value,a):null};tb.prototype.any=function(a){var b=this.fa;this.la=b.Fa=null;for(b=b.ba;null!==b;){if(a(b))return!0;b=b.oa}return!1};tb.prototype.all=function(a){var b=this.fa;this.la=b.Fa=null;for(b=b.ba;null!==b;){if(!a(b))return!1;b=b.oa}return!0};tb.prototype.each=function(a){var b=this.fa;this.la=b.Fa=null;for(b=b.ba;null!==b;)a(b),b=b.oa;return this};
    tb.prototype.map=function(a){var b=this.fa;this.la=b.Fa=null;var c=new E;for(b=b.ba;null!==b;)c.add(a(b)),b=b.oa;return c.iterator};tb.prototype.filter=function(a){var b=this.fa;this.la=b.Fa=null;var c=new E;for(b=b.ba;null!==b;)a(b)&&c.add(b),b=b.oa;return c.iterator};tb.prototype.Cd=function(){this.value=this.key=null;this.ia=-1;this.fa.Fa=this};tb.prototype.toString=function(){return null!==this.la?"MapIterator@"+this.la:"MapIterator"};
    ma.Object.defineProperties(tb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.fa.Cb}}});tb.prototype.first=tb.prototype.first;tb.prototype.hasNext=tb.prototype.ed;tb.prototype.next=tb.prototype.next;tb.prototype.reset=tb.prototype.reset;tb.className="MapIterator";
    function G(a){Ya(this);this.s=!1;this.Eb={};this.Cb=0;this.Ue=this.Fa=null;this.Aa=0;this.Ve=this.ba=null;void 0!==a&&("function"===typeof a||"string"===typeof a?ya():this.addAll(a))}t=G.prototype;t.ib=function(){var a=this.Aa;a++;999999999<a&&(a=0);this.Aa=a};t.freeze=function(){this.s=!0;return this};t.ea=function(){this.s=!1;return this};t.toString=function(){return"Map()#"+lb(this)};
    t.add=function(a,b){this.s&&ua(this,a);var c=a;za(a)&&(c=nb(a));var d=this.Eb[c];void 0===d?(this.Cb++,a=new ob(a,b),this.Eb[c]=a,c=this.Ve,null===c?this.ba=a:(a.Dl=c,c.oa=a),this.Ve=a,this.ib()):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 G)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};G.prototype.any=function(a){for(var b=this.ba;null!==b;){if(a(b))return!0;b=b.oa}return!1};G.prototype.all=function(a){for(var b=this.ba;null!==b;){if(!a(b))return!1;b=b.oa}return!0};
    G.prototype.each=function(a){for(var b=this.ba;null!==b;)a(b),b=b.oa;return this};G.prototype.map=function(a){for(var b=new G,c=this.ba;null!==c;)b.add(c.key,a(c)),c=c.oa;return b};G.prototype.filter=function(a){for(var b=new G,c=this.ba;null!==c;)a(c)&&b.add(c.key,c.value),c=c.oa;return b};t=G.prototype;t.contains=function(a){var b=a;return za(a)&&(b=lb(a),void 0===b)?!1:void 0!==this.Eb[b]};t.has=function(a){return this.contains(a)};
    t.H=function(a){var b=a;if(za(a)&&(b=lb(a),void 0===b))return null;a=this.Eb[b];return void 0===a?null:a.value};t.get=function(a){return this.H(a)};t.remove=function(a){if(null===a)return!1;this.s&&ua(this,a);var b=a;if(za(a)&&(b=lb(a),void 0===b))return!1;a=this.Eb[b];if(void 0===a)return!1;var c=a.oa,d=a.Dl;null!==c&&(c.Dl=d);null!==d&&(d.oa=c);this.ba===a&&(this.ba=c);this.Ve===a&&(this.Ve=d);delete this.Eb[b];this.Cb--;this.ib();return!0};t.delete=function(a){return this.remove(a)};
    t.clear=function(){this.s&&ua(this);this.Eb={};this.Cb=0;null!==this.Fa&&this.Fa.reset();null!==this.Ue&&this.Ue.reset();this.Ve=this.ba=null;this.ib()};G.prototype.copy=function(){var a=new G,b=this.Eb,c;for(c in b){var d=b[c];a.add(d.key,d.value)}return a};G.prototype.na=function(){var a=this.Eb,b=Array(this.Cb),c=0,d;for(d in a){var e=a[d];b[c]=new ob(e.key,e.value);c++}return b};G.prototype.Df=function(){return new rb(this)};
    ma.Object.defineProperties(G.prototype,{count:{get:function(){return this.Cb}},size:{get:function(){return this.Cb}},iterator:{get:function(){if(0>=this.count)return fb;var a=this.Fa;return null!==a?(a.reset(),a):new tb(this)}},iteratorKeys:{get:function(){return 0>=this.count?fb:new qb(this)}},iteratorValues:{get:function(){if(0>=this.count)return fb;
          var a=this.Ue;return null!==a?(a.reset(),a):new sb(this)}}});G.prototype.toKeySet=G.prototype.Df;G.prototype.toArray=G.prototype.na;G.prototype.clear=G.prototype.clear;G.prototype["delete"]=G.prototype.delete;G.prototype.remove=G.prototype.remove;G.prototype.get=G.prototype.get;G.prototype.getValue=G.prototype.H;G.prototype.has=G.prototype.has;G.prototype.contains=G.prototype.contains;G.prototype.first=G.prototype.first;G.prototype.addAll=G.prototype.addAll;G.prototype.set=G.prototype.set;
    G.prototype.add=G.prototype.add;G.prototype.thaw=G.prototype.ea;G.prototype.freeze=G.prototype.freeze;G.className="Map";function I(a,b){void 0===a?this.y=this.x=0:"number"===typeof a&&"number"===typeof b?(this.x=a,this.y=b):B("Invalid arguments to Point constructor: "+a+", "+b);this.s=!1}I.prototype.assign=function(a){this.x=a.x;this.y=a.y;return this};I.prototype.h=function(a,b){this.x=a;this.y=b;return this};I.prototype.Dg=function(a,b){this.x=a;this.y=b;return this};
    I.prototype.set=function(a){this.x=a.x;this.y=a.y;return this};I.prototype.copy=function(){var a=new I;a.x=this.x;a.y=this.y;return a};t=I.prototype;t.ca=function(){this.s=!0;Object.freeze(this);return this};t.G=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.s=!1;return this};
    function ub(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));return new I(c,e)}return new I}function vb(a){return a.x.toString()+" "+a.y.toString()}t.toString=function(){return"Point("+this.x+","+this.y+")"};t.w=function(a){return a instanceof I?this.x===a.x&&this.y===a.y:!1};t.Ri=function(a,b){return this.x===a&&this.y===b};t.Ma=function(a){return J.A(this.x,a.x)&&J.A(this.y,a.y)};
    t.add=function(a){this.x+=a.x;this.y+=a.y;return this};t.$d=function(a){this.x-=a.x;this.y-=a.y;return this};t.offset=function(a,b){this.x+=a;this.y+=b;return this};I.prototype.rotate=function(a){if(0===a)return this;var b=this.x,c=this.y;if(0===b&&0===c)return this;360<=a?a-=360:0>a&&(a+=360);if(90===a){a=0;var d=1}else 180===a?(a=-1,d=0):270===a?(a=0,d=-1):(d=a*Math.PI/180,a=Math.cos(d),d=Math.sin(d));this.x=a*b-d*c;this.y=d*b+a*c;return this};t=I.prototype;
    t.scale=function(a,b){this.x*=a;this.y*=b;return this};t.Be=function(a){var b=a.x-this.x;a=a.y-this.y;return b*b+a*a};t.dd=function(a,b){a-=this.x;b-=this.y;return a*a+b*b};t.normalize=function(){var a=this.x,b=this.y,c=Math.sqrt(a*a+b*b);0<c&&(this.x=a/c,this.y=b/c);return this};t.Sa=function(a){return zb(a.x-this.x,a.y-this.y)};t.direction=function(a,b){return zb(a-this.x,b-this.y)};
    function zb(a,b){if(0===a)return 0<b?90:0>b?270:0;if(0===b)return 0<a?0:180;if(isNaN(a)||isNaN(b))return 0;var c=180*Math.atan(Math.abs(b/a))/Math.PI;0>a?c=0>b?c+180:180-c:0>b&&(c=360-c);return c}t.mA=function(a,b,c,d){J.Jh(a,b,c,d,this.x,this.y,this);return this};t.nA=function(a,b){J.Jh(a.x,a.y,b.x,b.y,this.x,this.y,this);return this};t.yA=function(a,b,c,d){J.mq(this.x,this.y,a,b,c,d,this);return this};t.zA=function(a,b){J.mq(this.x,this.y,a.x,a.y,b.width,b.height,this);return this};
    t.dj=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.xk=function(a,b,c,d,e){this.x=a+e.x*c+e.offsetX;this.y=b+e.y*d+e.offsetY;return this};t.transform=function(a){a.ra(this);return this};function Ab(a,b){b.Wd(a);return a}function Bb(a,b,c,d,e,f){var g=e-c,h=f-d,k=g*g+h*h;c-=a;d-=b;var l=-c*g-d*h;if(0>=l||l>=k)return g=e-a,h=f-b,Math.min(c*c+d*d,g*g+h*h);a=g*d-h*c;return a*a/k}function Cb(a,b,c,d){a=c-a;b=d-b;return a*a+b*b}
    function Db(a,b,c,d){a=c-a;b=d-b;if(0===a)return 0<b?90:0>b?270:0;if(0===b)return 0<a?0:180;if(isNaN(a)||isNaN(b))return 0;d=180*Math.atan(Math.abs(b/a))/Math.PI;0>a?d=0>b?d+180:180-d:0>b&&(d=360-d);return d}t.u=function(){return isFinite(this.x)&&isFinite(this.y)};I.alloc=function(){var a=Eb.pop();return void 0===a?new I:a};I.allocAt=function(a,b){var c=Eb.pop();if(void 0===c)return new I(a,b);c.x=a;c.y=b;return c};I.free=function(a){Eb.push(a)};I.prototype.isReal=I.prototype.u;
    I.prototype.setSpot=I.prototype.xk;I.prototype.setRectSpot=I.prototype.dj;I.prototype.snapToGridPoint=I.prototype.zA;I.prototype.snapToGrid=I.prototype.yA;I.prototype.projectOntoLineSegmentPoint=I.prototype.nA;I.prototype.projectOntoLineSegment=I.prototype.mA;I.intersectingLineSegments=function(a,b,c,d,e,f,g,h){return J.sq(a,b,c,d,e,f,g,h)};I.prototype.direction=I.prototype.direction;I.prototype.directionPoint=I.prototype.Sa;I.prototype.normalize=I.prototype.normalize;
    I.prototype.distanceSquared=I.prototype.dd;I.prototype.distanceSquaredPoint=I.prototype.Be;I.prototype.scale=I.prototype.scale;I.prototype.rotate=I.prototype.rotate;I.prototype.offset=I.prototype.offset;I.prototype.subtract=I.prototype.$d;I.prototype.add=I.prototype.add;I.prototype.equalsApprox=I.prototype.Ma;I.prototype.equalTo=I.prototype.Ri;I.prototype.equals=I.prototype.w;I.prototype.set=I.prototype.set;I.prototype.setTo=I.prototype.Dg;var Gb=null,Hb=null,Ib=null,Jb=null,Kb=null,Eb=[];
    I.className="Point";I.parse=ub;I.stringify=vb;I.distanceLineSegmentSquared=Bb;I.distanceSquared=Cb;I.direction=Db;I.Origin=Gb=(new I(0,0)).ca();I.InfiniteTopLeft=Hb=(new I(-Infinity,-Infinity)).ca();I.InfiniteBottomRight=Ib=(new I(Infinity,Infinity)).ca();I.SixPoint=Jb=(new I(6,6)).ca();I.NoPoint=Kb=(new I(NaN,NaN)).ca();I.parse=ub;I.stringify=vb;I.distanceLineSegmentSquared=Bb;I.distanceSquared=Cb;I.direction=Db;
    function M(a,b){void 0===a?this.height=this.width=0:"number"===typeof a&&(0<=a||isNaN(a))&&"number"===typeof b&&(0<=b||isNaN(b))?(this.width=a,this.height=b):B("Invalid arguments to Size constructor: "+a+", "+b);this.s=!1}var Lb,Mb,Nb,Ob,Pb,Qb,Rb;M.prototype.assign=function(a){this.width=a.width;this.height=a.height;return this};M.prototype.h=function(a,b){this.width=a;this.height=b;return this};M.prototype.Dg=function(a,b){this.width=a;this.height=b;return this};
    M.prototype.set=function(a){this.width=a.width;this.height=a.height;return this};M.prototype.copy=function(){var a=new M;a.width=this.width;a.height=this.height;return a};t=M.prototype;t.ca=function(){this.s=!0;Object.freeze(this);return this};t.G=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.s=!1;return this};
    function Sb(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));return new M(c,e)}return new M}function Tb(a){return a.width.toString()+" "+a.height.toString()}t.toString=function(){return"Size("+this.width+","+this.height+")"};t.w=function(a){return a instanceof M?this.width===a.width&&this.height===a.height:!1};t.Ri=function(a,b){return this.width===a&&this.height===b};
    t.Ma=function(a){return J.A(this.width,a.width)&&J.A(this.height,a.height)};t.u=function(){return isFinite(this.width)&&isFinite(this.height)};M.alloc=function(){var a=Ub.pop();return void 0===a?new M:a};M.free=function(a){Ub.push(a)};M.prototype.isReal=M.prototype.u;M.prototype.equalsApprox=M.prototype.Ma;M.prototype.equalTo=M.prototype.Ri;M.prototype.equals=M.prototype.w;M.prototype.set=M.prototype.set;M.prototype.setTo=M.prototype.Dg;var Ub=[];M.className="Size";M.parse=Sb;M.stringify=Tb;
    M.ZeroSize=Lb=(new M(0,0)).ca();M.OneSize=Mb=(new M(1,1)).ca();M.SixSize=Nb=(new M(6,6)).ca();M.EightSize=Ob=(new M(8,8)).ca();M.TenSize=Pb=(new M(10,10)).ca();M.InfiniteSize=Qb=(new M(Infinity,Infinity)).ca();M.NoSize=Rb=(new M(NaN,NaN)).ca();M.parse=Sb;M.stringify=Tb;
    function N(a,b,c,d){void 0===a?this.height=this.width=this.y=this.x=0:a instanceof I?(c=a.x,a=a.y,b instanceof I?(d=b.x,b=b.y,this.x=Math.min(c,d),this.y=Math.min(a,b),this.width=Math.abs(c-d),this.height=Math.abs(a-b)):b instanceof M?(this.x=c,this.y=a,this.width=b.width,this.height=b.height):B("Incorrect arguments supplied to Rect constructor")):"number"===typeof a&&"number"===typeof b&&"number"===typeof c&&(0<=c||isNaN(c))&&"number"===typeof d&&(0<=d||isNaN(d))?(this.x=a,this.y=b,this.width=c,
      this.height=d):B("Invalid arguments to Rect constructor: "+a+", "+b+", "+c+", "+d);this.s=!1}t=N.prototype;t.assign=function(a){this.x=a.x;this.y=a.y;this.width=a.width;this.height=a.height;return this};t.h=function(a,b,c,d){this.x=a;this.y=b;this.width=c;this.height=d;return this};function Vb(a,b,c){a.width=b;a.height=c}t.Dg=function(a,b,c,d){this.x=a;this.y=b;this.width=c;this.height=d;return this};t.set=function(a){this.x=a.x;this.y=a.y;this.width=a.width;this.height=a.height;return this};
    t.jd=function(a){this.x=a.x;this.y=a.y;return this};t.wA=function(a){this.width=a.width;this.height=a.height;return this};N.prototype.copy=function(){var a=new N;a.x=this.x;a.y=this.y;a.width=this.width;a.height=this.height;return a};t=N.prototype;t.ca=function(){this.s=!0;Object.freeze(this);return this};t.G=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};
    t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.s=!1;return this};function Wb(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));for(var f=0;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));for(var g=0;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));return new N(c,e,f,g)}return new N}
    function Zb(a){return a.x.toString()+" "+a.y.toString()+" "+a.width.toString()+" "+a.height.toString()}t.toString=function(){return"Rect("+this.x+","+this.y+","+this.width+","+this.height+")"};t.w=function(a){return a instanceof N?this.x===a.x&&this.y===a.y&&this.width===a.width&&this.height===a.height:!1};t.Ri=function(a,b,c,d){return this.x===a&&this.y===b&&this.width===c&&this.height===d};t.Ma=function(a){return J.A(this.x,a.x)&&J.A(this.y,a.y)&&J.A(this.width,a.width)&&J.A(this.height,a.height)};
    function $b(a,b){return J.$(a.x,b.x)&&J.$(a.y,b.y)&&J.$(a.width,b.width)&&J.$(a.height,b.height)}t.aa=function(a){return this.x<=a.x&&this.x+this.width>=a.x&&this.y<=a.y&&this.y+this.height>=a.y};t.Ae=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.Vc=function(a,b){return ac(this,b,a,b,a)};t.cq=function(a){return ac(this,a.top,a.right,a.bottom,a.left)};t.mw=function(a){return ac(this,-a.top,-a.right,-a.bottom,-a.left)};t.Qz=function(a,b,c,d){return ac(this,a,b,c,d)};function ac(a,b,c,d,e){var f=a.width;c+e<=-f?(a.x+=f/2,a.width=0):(a.x-=e,a.width+=c+e);c=a.height;b+d<=-c?(a.y+=c/2,a.height=0):(a.y-=b,a.height+=b+d);return a}t.Uz=function(a){return bc(this,a.x,a.y,a.width,a.height)};t.Gv=function(a,b,c,d){return bc(this,a,b,c,d)};
    function bc(a,b,c,d,e){var f=Math.max(a.x,b),g=Math.max(a.y,c);b=Math.min(a.x+a.width,b+d);c=Math.min(a.y+a.height,c+e);a.x=f;a.y=g;a.width=Math.max(0,b-f);a.height=Math.max(0,c-g);return a}t.Gc=function(a){return this.Hv(a.x,a.y,a.width,a.height)};t.Hv=function(a,b,c,d){var e=this.width,f=this.x;if(Infinity!==e&&Infinity!==c&&(e+=f,c+=a,isNaN(c)||isNaN(e)||f>c||a>e))return!1;a=this.height;c=this.y;return Infinity!==a&&Infinity!==d&&(a+=c,d+=b,isNaN(d)||isNaN(a)||c>d||b>a)?!1:!0};
    function dc(a,b){var c=a.width,d=a.x,e=b.x-10;if(d>b.width+10+10+e||e>c+d)return!1;c=a.height;a=a.y;d=b.y-10;return a>b.height+10+10+d||d>c+a?!1:!0}t.Ie=function(a){return ec(this,a.x,a.y,0,0)};t.Hc=function(a){return ec(this,a.x,a.y,a.width,a.height)};t.tw=function(a,b,c,d){void 0===c&&(c=0);void 0===d&&(d=0);return ec(this,a,b,c,d)};
    function ec(a,b,c,d,e){var f=Math.min(a.x,b),g=Math.min(a.y,c);b=Math.max(a.x+a.width,b+d);c=Math.max(a.y+a.height,c+e);a.x=f;a.y=g;a.width=b-f;a.height=c-g;return a}t.xk=function(a,b,c){this.x=a-c.offsetX-c.x*this.width;this.y=b-c.offsetY-c.y*this.height;return this};function fc(a,b,c,d,e,f,g,h){void 0===g&&(g=0);void 0===h&&(h=0);return a<=e&&e+g<=a+c&&b<=f&&f+h<=b+d}function gc(a,b,c,d,e,f,g,h){return a>g+e||e>c+a?!1:b>h+f||f>d+b?!1:!0}
    t.u=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)};t.Wz=function(){return 0===this.width&&0===this.height};N.alloc=function(){var a=hc.pop();return void 0===a?new N:a};N.allocAt=function(a,b,c,d){var e=hc.pop();return void 0===e?new N(a,b,c,d):e.h(a,b,c,d)};N.free=function(a){hc.push(a)};
    ma.Object.defineProperties(N.prototype,{left:{get:function(){return this.x},set:function(a){this.x=a}},top:{get:function(){return this.y},set:function(a){this.y=a}},right:{get:function(){return this.x+this.width},set:function(a){this.x+=a-(this.x+this.width)}},bottom:{get:function(){return this.y+this.height},set:function(a){this.y+=a-(this.y+this.height)}},position:{
        get:function(){return new I(this.x,this.y)},set:function(a){this.x=a.x;this.y=a.y}},size:{get:function(){return new M(this.width,this.height)},set:function(a){this.width=a.width;this.height=a.height}},center:{get:function(){return new I(this.x+this.width/2,this.y+this.height/2)},set:function(a){this.x=a.x-this.width/2;this.y=a.y-this.height/2}},centerX:{get:function(){return this.x+this.width/2},
        set:function(a){this.x=a-this.width/2}},centerY:{get:function(){return this.y+this.height/2},set:function(a){this.y=a-this.height/2}}});N.prototype.isEmpty=N.prototype.Wz;N.prototype.isReal=N.prototype.u;N.intersectsLineSegment=function(a,b,c,d,e,f,g,h){return J.Tx(a,b,c,d,e,f,g,h)};N.prototype.setSpot=N.prototype.xk;N.prototype.union=N.prototype.tw;N.prototype.unionRect=N.prototype.Hc;N.prototype.unionPoint=N.prototype.Ie;N.prototype.intersects=N.prototype.Hv;
    N.prototype.intersectsRect=N.prototype.Gc;N.prototype.intersect=N.prototype.Gv;N.prototype.intersectRect=N.prototype.Uz;N.prototype.grow=N.prototype.Qz;N.prototype.subtractMargin=N.prototype.mw;N.prototype.addMargin=N.prototype.cq;N.prototype.inflate=N.prototype.Vc;N.prototype.offset=N.prototype.offset;N.prototype.contains=N.prototype.contains;N.prototype.containsRect=N.prototype.Ae;N.prototype.containsPoint=N.prototype.aa;N.prototype.equalsApprox=N.prototype.Ma;N.prototype.equalTo=N.prototype.Ri;
    N.prototype.equals=N.prototype.w;N.prototype.setSize=N.prototype.wA;N.prototype.setPoint=N.prototype.jd;N.prototype.set=N.prototype.set;N.prototype.setTo=N.prototype.Dg;var ic=null,nc=null,hc=[];N.className="Rect";N.parse=Wb;N.stringify=Zb;N.contains=fc;N.intersects=gc;N.ZeroRect=ic=(new N(0,0,0,0)).ca();N.NoRect=nc=(new N(NaN,NaN,NaN,NaN)).ca();N.parse=Wb;N.stringify=Zb;N.contains=fc;N.intersects=gc;
    function oc(a,b,c,d){void 0===a?this.left=this.bottom=this.right=this.top=0:void 0===b?this.left=this.bottom=this.right=this.top=a:void 0===c?(this.top=a,this.right=b,this.bottom=a,this.left=b):void 0!==d?(this.top=a,this.right=b,this.bottom=c,this.left=d):B("Invalid arguments to Margin constructor: "+a+", "+b+", "+c+", "+d);this.s=!1}oc.prototype.assign=function(a){this.top=a.top;this.right=a.right;this.bottom=a.bottom;this.left=a.left;return this};
    oc.prototype.Dg=function(a,b,c,d){this.top=a;this.right=b;this.bottom=c;this.left=d;return this};oc.prototype.set=function(a){this.top=a.top;this.right=a.right;this.bottom=a.bottom;this.left=a.left;return this};oc.prototype.copy=function(){var a=new oc;a.top=this.top;a.right=this.right;a.bottom=this.bottom;a.left=this.left;return a};t=oc.prototype;t.ca=function(){this.s=!0;Object.freeze(this);return this};t.G=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};
    t.freeze=function(){this.s=!0;return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.s=!1;return this};
    function pc(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=NaN;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));if(isNaN(c))return new oc;for(var e=NaN;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));if(isNaN(e))return new oc(c);for(var f=NaN;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));if(isNaN(f))return new oc(c,e);for(var g=NaN;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));return isNaN(g)?new oc(c,e):new oc(c,e,f,g)}return new oc}
    function qc(a){return a.top.toString()+" "+a.right.toString()+" "+a.bottom.toString()+" "+a.left.toString()}t.toString=function(){return"Margin("+this.top+","+this.right+","+this.bottom+","+this.left+")"};t.w=function(a){return a instanceof oc?this.top===a.top&&this.right===a.right&&this.bottom===a.bottom&&this.left===a.left:!1};t.Ri=function(a,b,c,d){return this.top===a&&this.right===b&&this.bottom===c&&this.left===d};
    t.Ma=function(a){return J.A(this.top,a.top)&&J.A(this.right,a.right)&&J.A(this.bottom,a.bottom)&&J.A(this.left,a.left)};t.u=function(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)};oc.alloc=function(){var a=rc.pop();return void 0===a?new oc:a};oc.free=function(a){rc.push(a)};oc.prototype.isReal=oc.prototype.u;oc.prototype.equalsApprox=oc.prototype.Ma;oc.prototype.equalTo=oc.prototype.Ri;oc.prototype.equals=oc.prototype.w;oc.prototype.set=oc.prototype.set;
    oc.prototype.setTo=oc.prototype.Dg;var sc=null,tc=null,rc=[];oc.className="Margin";oc.parse=pc;oc.stringify=qc;oc.ZeroMargin=sc=(new oc(0,0,0,0)).ca();oc.TwoMargin=tc=(new oc(2,2,2,2)).ca();oc.parse=pc;oc.stringify=qc;function P(a,b,c,d){void 0===a?this.offsetY=this.offsetX=this.y=this.x=0:(void 0===b&&(b=0),void 0===c&&(c=0),void 0===d&&(d=0),this.x=a,this.y=b,this.offsetX=c,this.offsetY=d);this.s=!1}
    var uc,vc,wc,yc,zc,Ac,Bc,Cc,Dc,Gc,Hc,Ic,Jc,Kc,Lc,Mc,Nc,Pc,Qc,Rc,Sc,Tc,Uc,Vc,Zc,$c,ad,bd,cd,dd,ed,fd,gd,hd,id,jd;P.prototype.assign=function(a){this.x=a.x;this.y=a.y;this.offsetX=a.offsetX;this.offsetY=a.offsetY;return this};P.prototype.Dg=function(a,b,c,d){this.x=a;this.y=b;this.offsetX=c;this.offsetY=d;return this};P.prototype.set=function(a){this.x=a.x;this.y=a.y;this.offsetX=a.offsetX;this.offsetY=a.offsetY;return this};
    P.prototype.copy=function(){var a=new P;a.x=this.x;a.y=this.y;a.offsetX=this.offsetX;a.offsetY=this.offsetY;return a};t=P.prototype;t.ca=function(){this.s=!0;Object.freeze(this);return this};t.G=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.s=!1;return this};function kd(a,b){a.x=NaN;a.y=NaN;a.offsetX=b;return a}
    function ld(a){if("string"===typeof a){a=a.trim();if("None"===a)return uc;if("TopLeft"===a)return vc;if("Top"===a||"TopCenter"===a||"MiddleTop"===a)return wc;if("TopRight"===a)return yc;if("Left"===a||"LeftCenter"===a||"MiddleLeft"===a)return zc;if("Center"===a)return Ac;if("Right"===a||"RightCenter"===a||"MiddleRight"===a)return Bc;if("BottomLeft"===a)return Cc;if("Bottom"===a||"BottomCenter"===a||"MiddleBottom"===a)return Dc;if("BottomRight"===a)return Gc;if("TopSide"===a)return Hc;if("LeftSide"===
      a)return Ic;if("RightSide"===a)return Jc;if("BottomSide"===a)return Kc;if("TopBottomSides"===a)return Lc;if("LeftRightSides"===a)return Mc;if("TopLeftSides"===a)return Nc;if("TopRightSides"===a)return Pc;if("BottomLeftSides"===a)return Qc;if("BottomRightSides"===a)return Rc;if("NotTopSide"===a)return Sc;if("NotLeftSide"===a)return Tc;if("NotRightSide"===a)return Uc;if("NotBottomSide"===a)return Vc;if("AllSides"===a)return Zc;if("Default"===a)return $c;a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;
      var d=a[b++];void 0!==d&&0<d.length&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(e=parseFloat(d));for(var f=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(f=parseFloat(d));for(var g=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(g=parseFloat(d));return new P(c,e,f,g)}return new P}function md(a){return a.eb()?a.x.toString()+" "+a.y.toString()+" "+a.offsetX.toString()+" "+a.offsetY.toString():a.toString()}
    t.toString=function(){return this.eb()?0===this.offsetX&&0===this.offsetY?"Spot("+this.x+","+this.y+")":"Spot("+this.x+","+this.y+","+this.offsetX+","+this.offsetY+")":this.w(uc)?"None":this.w(vc)?"TopLeft":this.w(wc)?"Top":this.w(yc)?"TopRight":this.w(zc)?"Left":this.w(Ac)?"Center":this.w(Bc)?"Right":this.w(Cc)?"BottomLeft":this.w(Dc)?"Bottom":this.w(Gc)?"BottomRight":this.w(Hc)?"TopSide":this.w(Ic)?"LeftSide":this.w(Jc)?"RightSide":this.w(Kc)?"BottomSide":this.w(Lc)?"TopBottomSides":this.w(Mc)?
      "LeftRightSides":this.w(Nc)?"TopLeftSides":this.w(Pc)?"TopRightSides":this.w(Qc)?"BottomLeftSides":this.w(Rc)?"BottomRightSides":this.w(Sc)?"NotTopSide":this.w(Tc)?"NotLeftSide":this.w(Uc)?"NotRightSide":this.w(Vc)?"NotBottomSide":this.w(Zc)?"AllSides":this.w($c)?"Default":"None"};t.w=function(a){return a instanceof P?(this.x===a.x||isNaN(this.x)&&isNaN(a.x))&&(this.y===a.y||isNaN(this.y)&&isNaN(a.y))&&this.offsetX===a.offsetX&&this.offsetY===a.offsetY:!1};
    t.Sv=function(){return new P(.5-(this.x-.5),.5-(this.y-.5),-this.offsetX,-this.offsetY)};t.xf=function(a){if(!this.gd())return!1;if(!a.gd())if(a.w(ad))a=Ic;else if(a.w(bd))a=Jc;else if(a.w(cd))a=Hc;else if(a.w(dd))a=Kc;else return!1;a=a.offsetY;return(this.offsetY&a)===a};t.eb=function(){return!isNaN(this.x)&&!isNaN(this.y)};t.jc=function(){return isNaN(this.x)||isNaN(this.y)};t.gd=function(){return isNaN(this.x)&&isNaN(this.y)&&1===this.offsetX&&0!==this.offsetY};
    t.xt=function(){return isNaN(this.x)&&isNaN(this.y)&&0===this.offsetX&&0===this.offsetY};t.Mb=function(){return isNaN(this.x)&&isNaN(this.y)&&-1===this.offsetX&&0===this.offsetY};P.alloc=function(){var a=pd.pop();return void 0===a?new P:a};P.free=function(a){pd.push(a)};P.prototype.isDefault=P.prototype.Mb;P.prototype.isNone=P.prototype.xt;P.prototype.isSide=P.prototype.gd;P.prototype.isNoSpot=P.prototype.jc;P.prototype.isSpot=P.prototype.eb;P.prototype.includesSide=P.prototype.xf;
    P.prototype.opposite=P.prototype.Sv;P.prototype.equals=P.prototype.w;P.prototype.set=P.prototype.set;P.prototype.setTo=P.prototype.Dg;var pd=[];P.className="Spot";P.parse=ld;P.stringify=md;P.None=uc=kd(new P(0,0,0,0),0).ca();P.Default=$c=kd(new P(0,0,-1,0),-1).ca();P.TopLeft=vc=(new P(0,0,0,0)).ca();P.TopCenter=wc=(new P(.5,0,0,0)).ca();P.TopRight=yc=(new P(1,0,0,0)).ca();P.LeftCenter=zc=(new P(0,.5,0,0)).ca();P.Center=Ac=(new P(.5,.5,0,0)).ca();P.RightCenter=Bc=(new P(1,.5,0,0)).ca();
    P.BottomLeft=Cc=(new P(0,1,0,0)).ca();P.BottomCenter=Dc=(new P(.5,1,0,0)).ca();P.BottomRight=Gc=(new P(1,1,0,0)).ca();P.MiddleTop=ed=wc;P.MiddleLeft=fd=zc;P.MiddleRight=gd=Bc;P.MiddleBottom=hd=Dc;P.Top=cd=wc;P.Left=ad=zc;P.Right=bd=Bc;P.Bottom=dd=Dc;P.TopSide=Hc=kd(new P(0,0,1,1),1).ca();P.LeftSide=Ic=kd(new P(0,0,1,2),1).ca();P.RightSide=Jc=kd(new P(0,0,1,4),1).ca();P.BottomSide=Kc=kd(new P(0,0,1,8),1).ca();P.TopBottomSides=Lc=kd(new P(0,0,1,9),1).ca();P.LeftRightSides=Mc=kd(new P(0,0,1,6),1).ca();
    P.TopLeftSides=Nc=kd(new P(0,0,1,3),1).ca();P.TopRightSides=Pc=kd(new P(0,0,1,5),1).ca();P.BottomLeftSides=Qc=kd(new P(0,0,1,10),1).ca();P.BottomRightSides=Rc=kd(new P(0,0,1,12),1).ca();P.NotTopSide=Sc=kd(new P(0,0,1,14),1).ca();P.NotLeftSide=Tc=kd(new P(0,0,1,13),1).ca();P.NotRightSide=Uc=kd(new P(0,0,1,11),1).ca();P.NotBottomSide=Vc=kd(new P(0,0,1,7),1).ca();P.AllSides=Zc=kd(new P(0,0,1,15),1).ca();id=(new P(.156,.156)).ca();jd=(new P(.844,.844)).ca();P.parse=ld;P.stringify=md;
    function qd(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0}qd.prototype.set=function(a){this.m11=a.m11;this.m12=a.m12;this.m21=a.m21;this.m22=a.m22;this.dx=a.dx;this.dy=a.dy;return this};qd.prototype.copy=function(){var a=new qd;a.m11=this.m11;a.m12=this.m12;a.m21=this.m21;a.m22=this.m22;a.dx=this.dx;a.dy=this.dy;return a};t=qd.prototype;t.toString=function(){return"Transform("+this.m11+","+this.m12+","+this.m21+","+this.m22+","+this.dx+","+this.dy+")"};
    t.w=function(a){return this.m11===a.m11&&this.m12===a.m12&&this.m21===a.m21&&this.m22===a.m22&&this.dx===a.dx&&this.dy===a.dy};t.vt=function(){return 0===this.dx&&0===this.dy&&1===this.m11&&0===this.m12&&0===this.m21&&1===this.m22};t.reset=function(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0;return this};
    t.multiply=function(a){var b=this.m11*a.m11+this.m21*a.m12,c=this.m12*a.m11+this.m22*a.m12,d=this.m11*a.m21+this.m21*a.m22,e=this.m12*a.m21+this.m22*a.m22;this.dx=this.m11*a.dx+this.m21*a.dy+this.dx;this.dy=this.m12*a.dx+this.m22*a.dy+this.dy;this.m11=b;this.m12=c;this.m21=d;this.m22=e;return this};
    t.Ov=function(a){var b=1/(a.m11*a.m22-a.m12*a.m21),c=a.m22*b,d=-a.m12*b,e=-a.m21*b,f=a.m11*b,g=b*(a.m21*a.dy-a.m22*a.dx);a=b*(a.m12*a.dx-a.m11*a.dy);b=this.m11*c+this.m21*d;c=this.m12*c+this.m22*d;d=this.m11*e+this.m21*f;e=this.m12*e+this.m22*f;this.dx=this.m11*g+this.m21*a+this.dx;this.dy=this.m12*g+this.m22*a+this.dy;this.m11=b;this.m12=c;this.m21=d;this.m22=e;return this};
    t.ut=function(){var a=1/(this.m11*this.m22-this.m12*this.m21),b=-this.m12*a,c=-this.m21*a,d=this.m11*a,e=a*(this.m21*this.dy-this.m22*this.dx),f=a*(this.m12*this.dx-this.m11*this.dy);this.m11=this.m22*a;this.m12=b;this.m21=c;this.m22=d;this.dx=e;this.dy=f;return this};
    qd.prototype.rotate=function(a,b,c){360<=a?a-=360:0>a&&(a+=360);if(0===a)return this;this.translate(b,c);if(90===a){a=0;var d=1}else 180===a?(a=-1,d=0):270===a?(a=0,d=-1):(d=a*Math.PI/180,a=Math.cos(d),d=Math.sin(d));var e=this.m12*a+this.m22*d,f=this.m11*-d+this.m21*a,g=this.m12*-d+this.m22*a;this.m11=this.m11*a+this.m21*d;this.m12=e;this.m21=f;this.m22=g;this.translate(-b,-c);return this};t=qd.prototype;t.translate=function(a,b){this.dx+=this.m11*a+this.m21*b;this.dy+=this.m12*a+this.m22*b;return this};
    t.scale=function(a,b){void 0===b&&(b=a);this.m11*=a;this.m12*=a;this.m21*=b;this.m22*=b;return this};t.ra=function(a){var b=a.x,c=a.y;return a.h(b*this.m11+c*this.m21+this.dx,b*this.m12+c*this.m22+this.dy)};t.Wd=function(a){var b=1/(this.m11*this.m22-this.m12*this.m21),c=a.x,d=a.y;return a.h(c*this.m22*b+d*-this.m21*b+b*(this.m21*this.dy-this.m22*this.dx),c*-this.m12*b+d*this.m11*b+b*(this.m12*this.dx-this.m11*this.dy))};
    t.sw=function(a){var b=a.x,c=a.y,d=b+a.width,e=c+a.height,f=this.m11,g=this.m12,h=this.m21,k=this.m22,l=this.dx,m=this.dy,n=b*f+c*h+l,p=b*g+c*k+m,r=d*f+c*h+l,q=d*g+c*k+m;c=b*f+e*h+l;b=b*g+e*k+m;f=d*f+e*h+l;d=d*g+e*k+m;e=Math.min(n,r);n=Math.max(n,r);r=Math.min(p,q);p=Math.max(p,q);e=Math.min(e,c);n=Math.max(n,c);r=Math.min(r,b);p=Math.max(p,b);e=Math.min(e,f);n=Math.max(n,f);r=Math.min(r,d);p=Math.max(p,d);a.h(e,r,n-e,p-r);return a};qd.alloc=function(){var a=rd.pop();return void 0===a?new qd:a};
    qd.free=function(a){rd.push(a)};qd.prototype.transformRect=qd.prototype.sw;qd.prototype.invertedTransformPoint=qd.prototype.Wd;qd.prototype.transformPoint=qd.prototype.ra;qd.prototype.scale=qd.prototype.scale;qd.prototype.translate=qd.prototype.translate;qd.prototype.rotate=qd.prototype.rotate;qd.prototype.invert=qd.prototype.ut;qd.prototype.multiplyInverted=qd.prototype.Ov;qd.prototype.multiply=qd.prototype.multiply;qd.prototype.reset=qd.prototype.reset;qd.prototype.isIdentity=qd.prototype.vt;
    qd.prototype.equals=qd.prototype.w;qd.prototype.set=qd.prototype.set;var rd=[];qd.className="Transform";qd.xF="54a702f3e53909c447824c6706603faf4c";
    var J={FA:"7da71ca0ad381e90",Gg:(Math.sqrt(2)-1)/3*4,Jw:null,sqrt:function(a){if(0>=a)return 0;var b=J.Jw;if(null===b){b=[];for(var c=0;2E3>=c;c++)b[c]=Math.sqrt(c);J.Jw=b}return 1>a?(c=1/a,2E3>=c?1/b[c|0]:Math.sqrt(a)):2E3>=a?b[a|0]:Math.sqrt(a)},A:function(a,b){a-=b;return.5>a&&-.5<a},$:function(a,b){a-=b;return 5E-8>a&&-5E-8<a},Nb:function(a,b,c,d,e,f,g){0>=e&&(e=1E-6);if(a<c){var h=a;var k=c}else h=c,k=a;if(b<d){var l=b;var m=d}else l=d,m=b;if(a===c)return l<=g&&g<=m&&a-e<=f&&f<=a+e;if(b===d)return h<=
        f&&f<=k&&b-e<=g&&g<=b+e;k+=e;h-=e;if(h<=f&&f<=k&&(m+=e,l-=e,l<=g&&g<=m))if(k-h>m-l)if(a-c>e||c-a>e){if(f=(d-b)/(c-a)*(f-a)+b,f-e<=g&&g<=f+e)return!0}else return!0;else if(b-d>e||d-b>e){if(g=(c-a)/(d-b)*(g-b)+a,g-e<=f&&f<=g+e)return!0}else return!0;return!1},bt:function(a,b,c,d,e,f,g,h,k,l,m,n){if(J.Nb(a,b,g,h,n,c,d)&&J.Nb(a,b,g,h,n,e,f))return J.Nb(a,b,g,h,n,l,m);var p=(a+c)/2,r=(b+d)/2,q=(c+e)/2,u=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(p+q)/2;c=(r+u)/2;q=(q+e)/2;u=(u+f)/2;var v=(d+q)/2,w=(c+u)/2;return J.bt(a,
        b,p,r,d,c,v,w,k,l,m,n)||J.bt(v,w,q,u,e,f,g,h,k,l,m,n)},Sy: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},Ry:function(a,b,c,d,e,f,g,h){var k=(c+e)/2,l=(d+f)/2;return Db(((a+c)/2+k)/2,((b+d)/2+l)/2,(k+(e+g)/2)/2,(l+(f+h)/2)/2)},bm:function(a,b,c,d,e,f,g,h,k,l){if(J.Nb(a,b,g,h,k,c,d)&&J.Nb(a,b,g,h,k,e,f))ec(l,a,b,0,0),ec(l,g,h,0,0);else{var m=(a+c)/2,n=(b+d)/2,p=(c+e)/2,r=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(m+p)/2;c=(n+r)/
        2;p=(p+e)/2;r=(r+f)/2;var q=(d+p)/2,u=(c+r)/2;J.bm(a,b,m,n,d,c,q,u,k,l);J.bm(q,u,p,r,e,f,g,h,k,l)}return l},ze:function(a,b,c,d,e,f,g,h,k,l){if(J.Nb(a,b,g,h,k,c,d)&&J.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;J.ze(a,b,m,n,d,c,q,u,k,l);J.ze(q,u,p,r,e,f,g,h,k,l)}return l},Vv:function(a,b,c,d,e,f,g,h,k,l){if(J.Nb(a,b,e,f,l,c,d))return J.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 J.Vv(a,b,m,n,p,r,g,h,k,l)||J.Vv(p,r,c,d,e,f,g,h,k,l)},LA: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},Uv:function(a,b,c,d,e,f,g,h){if(J.Nb(a,b,e,f,g,c,d))ec(h,a,b,0,0),ec(h,e,f,0,0);else{var k=(a+c)/2,l=(b+d)/2;c=(c+e)/2;d=(d+f)/2;var m=(k+c)/2,n=(l+d)/2;J.Uv(a,b,k,l,m,n,g,h);J.Uv(m,n,c,d,e,f,g,h)}return h},Cq:function(a,b,c,d,e,f,g,h){if(J.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;J.Cq(a,b,k,l,m,n,g,h);J.Cq(m,n,c,d,e,f,g,h)}return h},eq:function(a,b,c,d,e,f,g,h,k,l,m,n,p,r){if(J.Nb(a,b,g,h,p,c,d)&&J.Nb(a,b,g,h,p,e,f)){var q=(a-g)*(l-n)-(b-h)*(k-m);if(0===q)return!1;p=((a*h-b*g)*(k-m)-(a-g)*(k*n-l*m))/q;q=((a*h-b*g)*(l-n)-(b-h)*(k*n-l*m))/q;if((k>m?k-m:m-k)<(l>n?l-n:n-l)){if(b<h?g=b:(g=h,h=b),q<g||q>h)return!1}else if(a<g?h=a:(h=g,g=a),p<h||p>g)return!1;r.h(p,q);return!0}q=
        (a+c)/2;var u=(b+d)/2;c=(c+e)/2;d=(d+f)/2;e=(e+g)/2;f=(f+h)/2;var v=(q+c)/2,w=(u+d)/2;c=(c+e)/2;d=(d+f)/2;var y=(v+c)/2,z=(w+d)/2,A=(m-k)*(m-k)+(n-l)*(n-l),C=!1;J.eq(a,b,q,u,v,w,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));a=r.x;b=r.y;J.eq(y,z,c,d,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:r.h(a,b));return C},fq:function(a,b,c,d,e,f,g,h,k,l,m,n,p){var r=0;if(J.Nb(a,b,g,h,p,c,d)&&J.Nb(a,b,g,h,p,e,f)){p=(a-g)*(l-n)-(b-h)*(k-m);if(0===p)return r;var q=((a*
        h-b*g)*(k-m)-(a-g)*(k*n-l*m))/p,u=((a*h-b*g)*(l-n)-(b-h)*(k*n-l*m))/p;if(q>=m)return r;if((k>m?k-m:m-k)<(l>n?l-n:n-l)){if(b<h?(a=b,b=h):a=h,u<a||u>b)return r}else if(a<g?(b=a,a=g):b=g,q<b||q>a)return r;0<p?r++:0>p&&r--}else{q=(a+c)/2;u=(b+d)/2;var v=(c+e)/2,w=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(q+v)/2;c=(u+w)/2;v=(v+e)/2;w=(w+f)/2;var y=(d+v)/2,z=(c+w)/2;r+=J.fq(a,b,q,u,d,c,y,z,k,l,m,n,p);r+=J.fq(y,z,v,w,e,f,g,h,k,l,m,n,p)}return r},Jh:function(a,b,c,d,e,f,g){if(J.$(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(J.$(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},Ee:function(a,b,c,d,e,f,g,h,k){if(J.A(a,c)&&J.A(b,d))return k.h(a,b),!1;if(J.$(e,g))return J.$(a,c)?(J.Jh(a,b,c,d,e,f,k),!1):J.Jh(a,b,c,d,e,(d-b)/(c-a)*(e-a)+b,k);h=(h-f)/(g-e);if(J.$(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(J.$(h,g))return J.Jh(a,b,c,d,e,f,k),!1;e=(g*a-h*e+f-b)/(g-h);if(J.$(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 J.Jh(a,b,c,d,e,g*(e-a)+b,k)},KA:function(a,b,c,d,e){return J.Ee(c.x,c.y,d.x,d.y,a.x,a.y,b.x,b.y,e)},JA: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},
      Uc:function(a,b,c,d,e,f,g,h,k){var l=1E21,m=a,n=b;if(J.Ee(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)}J.Ee(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));J.Ee(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));J.Ee(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},IA: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},st:function(a,b,c){return J.Tx(a.x,a.y,a.width,a.height,b.x,b.y,c.x,c.y)},Tx:function(a,b,c,d,e,f,g,h){var k=a+c,l=b+d;return e===g?(f<h?(g=f,f=h):g=h,a<=e&&e<=k&&g<=l&&f>=b):f===h?(e<g?(h=e,e=g):h=g,b<=f&&f<=l&&h<=k&&e>=a):fc(a,b,c,d,e,f)||fc(a,b,c,d,g,h)||J.sq(a,b,k,b,e,f,g,h)||J.sq(k,b,k,l,e,f,g,h)||J.sq(k,l,a,l,e,f,g,h)||J.sq(a,l,a,b,e,f,g,h)?!0:!1},sq:function(a,b,c,d,e,f,g,h){return 0>=
        J.et(a,b,c,d,e,f)*J.et(a,b,c,d,g,h)&&0>=J.et(e,f,g,h,a,b)*J.et(e,f,g,h,c,d)},et:function(a,b,c,d,e,f){c-=a;d-=b;a=e-a;b=f-b;f=a*d-b*c;0===f&&(f=a*c+b*d,0<f&&(f=(a-c)*c+(b-d)*d,0>f&&(f=0)));return 0>f?-1:0<f?1:0},zq:function(a){0>a&&(a+=360);360<=a&&(a-=360);return a},Fx: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(J.Zy(c,l,e,a,b)),d-=Math.abs(e-l),l=e;return f},Zy: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)]},mq: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},Px: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},dz: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 J.ez(k,0===g?a:b,l,c,0,0)},ez: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},Ke:new db,Nm:new db,Nh:new db,Oh:0};J.za=J.FA;
    function sd(a){Ya(this);this.s=!1;void 0===a&&(a=td);this.pa=a;this.mc=this.ec=this.Sc=this.Rc=0;this.rj=new E;this.Dr=this.rj.Aa;this.kr=(new N).freeze();this.qa=!0;this.Tm=this.Gk=null;this.Um=NaN;this.jf=vc;this.kf=Gc;this.jl=this.kl=NaN;this.Of=ud}
    sd.prototype.copy=function(){var a=new sd;a.pa=this.pa;a.Rc=this.Rc;a.Sc=this.Sc;a.ec=this.ec;a.mc=this.mc;for(var b=this.rj.j,c=b.length,d=a.rj,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.Dr=this.Dr;a.kr.assign(this.kr);a.qa=this.qa;a.Gk=this.Gk;a.Tm=this.Tm;a.Um=this.Um;a.jf=this.jf.G();a.kf=this.kf.G();a.kl=this.kl;a.jl=this.jl;a.Of=this.Of;return a};t=sd.prototype;t.ca=function(){this.freeze();Object.freeze(this);return this};
    t.freeze=function(){this.s=!0;var a=this.figures;a.freeze();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].freeze();return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.s=!1;var a=this.figures;a.ea();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].ea();return this};
    t.Ma=function(a){if(!(a instanceof sd))return!1;if(this.type!==a.type)return this.type===vd&&a.type===td?wd(this,a):a.type===vd&&this.type===td?wd(a,this):!1;if(this.type===td){var b=this.figures.j;a=a.figures.j;var c=b.length;if(c!==a.length)return!1;for(var d=0;d<c;d++)if(!b[d].Ma(a[d]))return!1;return!0}return J.A(this.startX,a.startX)&&J.A(this.startY,a.startY)&&J.A(this.endX,a.endX)&&J.A(this.endY,a.endY)};
    function wd(a,b){return a.type!==vd||b.type!==td?!1:1===b.figures.count&&(b=b.figures.L(0),1===b.segments.count&&J.A(a.startX,b.startX)&&J.A(a.startY,b.startY)&&(b=b.segments.L(0),b.type===xd&&J.A(a.endX,b.endX)&&J.A(a.endY,b.endY)))?!0:!1}function yd(a){return a.toString()}t.cb=function(a){a.classType===sd&&(this.type=a)};
    t.toString=function(a){void 0===a&&(a=-1);switch(this.type){case vd:return 0>a?"M"+this.startX.toString()+" "+this.startY.toString()+"L"+this.endX.toString()+" "+this.endY.toString():"M"+this.startX.toFixed(a)+" "+this.startY.toFixed(a)+"L"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);case Gd:var b=new N(this.startX,this.startY,0,0);b.tw(this.endX,this.endY,0,0);return 0>a?"M"+b.x.toString()+" "+b.y.toString()+"H"+b.right.toString()+"V"+b.bottom.toString()+"H"+b.left.toString()+"z":"M"+b.x.toFixed(a)+
      " "+b.y.toFixed(a)+"H"+b.right.toFixed(a)+"V"+b.bottom.toFixed(a)+"H"+b.left.toFixed(a)+"z";case Hd:b=new N(this.startX,this.startY,0,0);b.tw(this.endX,this.endY,0,0);if(0>a)return a=b.left.toString()+" "+(b.y+b.height/2).toString(),"M"+a+"A"+(b.width/2).toString()+" "+(b.height/2).toString()+" 0 0 1 "+(b.right.toString()+" "+(b.y+b.height/2).toString())+"A"+(b.width/2).toString()+" "+(b.height/2).toString()+" 0 0 1 "+a;var c=b.left.toFixed(a)+" "+(b.y+b.height/2).toFixed(a);return"M"+c+"A"+(b.width/
      2).toFixed(a)+" "+(b.height/2).toFixed(a)+" 0 0 1 "+(b.right.toFixed(a)+" "+(b.y+b.height/2).toFixed(a))+"A"+(b.width/2).toFixed(a)+" "+(b.height/2).toFixed(a)+" 0 0 1 "+c;case td:b="";c=this.figures.j;for(var d=c.length,e=0;e<d;e++){var f=c[e];0<e&&(b+=" x ");f.isFilled&&(b+="F ");b+=f.toString(a)}return b;default:return this.type.toString()}};
    function Id(a,b){function c(){return u>=A-1?!0:null!==k[u+1].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/)}function d(){u++;return k[u]}function e(){var a=new I(parseFloat(d()),parseFloat(d()));v===v.toLowerCase()&&(a.x=z.x+a.x,a.y=z.y+a.y);return a}function f(){return z=e()}function g(){return y=e()}function h(){var a=w.toLowerCase();return"c"!==a&&"s"!==a&&"q"!==a&&"t"!==a?z:new I(2*z.x-y.x,2*z.y-y.y)}void 0===b&&(b=!1);a=a.replace(/,/gm," ");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,
      "$1 $2");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,"$1 $2");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([^\s])/gm,"$1 $2");a=a.replace(/([^\s])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,"$1 $2");a=a.replace(/([0-9])([+\-])/gm,"$1 $2");a=a.replace(/([Aa](\s+[0-9]+){3})\s+([01])\s*([01])/gm,"$1 $3 $4 ");a=a.replace(/[\s\r\t\n]+/gm," ");a=a.replace(/^\s+|\s+$/g,"");var k=a.split(" ");for(a=0;a<k.length;a++){var l=k[a];if(null!==l.match(/(\.[0-9]*)(\.)/gm)){for(var m=
      Fa(),n="",p=!1,r=0;r<l.length;r++){var q=l[r];"."!==q||p?"."===q?(m.push(n),n="."):n+=q:(p=!0,n+=q)}m.push(n);k.splice(a,1);for(l=0;l<m.length;l++)k.splice(a+l,0,m[l]);a+=m.length-1;Ha(m)}}var u=-1,v="",w="";m=new I(0,0);var y=new I(0,0),z=new I(0,0),A=k.length;a=Jd(null);n=l=!1;p=!0;for(r=null;!(u>=A-1);)if(w=v,v=d(),""!==v)switch(v.toUpperCase()){case "X":p=!0;n=l=!1;break;case "M":r=f();null===a.fc||!0===p?(Kd(a,r.x,r.y,l,!n),p=!1):a.moveTo(r.x,r.y);for(m=z;!c();)r=f(),a.lineTo(r.x,r.y);break;
      case "L":for(;!c();)r=f(),a.lineTo(r.x,r.y);break;case "H":for(;!c();)z=new I((v===v.toLowerCase()?z.x:0)+parseFloat(d()),z.y),a.lineTo(z.x,z.y);break;case "V":for(;!c();)z=new I(z.x,(v===v.toLowerCase()?z.y:0)+parseFloat(d())),a.lineTo(z.x,z.y);break;case "C":for(;!c();){r=e();q=g();var C=f();Ld(a,r.x,r.y,q.x,q.y,C.x,C.y)}break;case "S":for(;!c();)r=h(),q=g(),C=f(),Ld(a,r.x,r.y,q.x,q.y,C.x,C.y);break;case "Q":for(;!c();)r=g(),q=f(),Qd(a,r.x,r.y,q.x,q.y);break;case "T":for(;!c();)y=r=h(),q=f(),Qd(a,
        r.x,r.y,q.x,q.y);break;case "B":for(;!c();){r=parseFloat(d());q=parseFloat(d());C=parseFloat(d());var H=parseFloat(d()),L=parseFloat(d()),K=L,V=!1;c()||(K=parseFloat(d()),c()||(V=0!==parseFloat(d())));v===v.toLowerCase()&&(C+=z.x,H+=z.y);a.arcTo(r,q,C,H,L,K,V)}break;case "A":for(;!c();)r=Math.abs(parseFloat(d())),q=Math.abs(parseFloat(d())),C=parseFloat(d()),H=!!parseFloat(d()),L=!!parseFloat(d()),K=f(),Rd(a,r,q,C,H,L,K.x,K.y);break;case "Z":Sd(a);z=m;break;case "F":r="";for(q=1;k[u+q];)if(null!==
        k[u+q].match(/[Uu]/))q++;else if(null===k[u+q].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/))q++;else{r=k[u+q];break}r.match(/[Mm]/)?l=!0:0<a.fc.segments.length&&(a.fc.isFilled=!0);break;case "U":r="";for(q=1;k[u+q];)if(null!==k[u+q].match(/[Ff]/))q++;else if(null===k[u+q].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/))q++;else{r=k[u+q];break}r.match(/[Mm]/)?n=!0:a.Lq(!1)}m=a.nt;Td=a;if(b)for(b=m.figures.iterator;b.next();)b.value.isFilled=!0;return m}
    function Ud(a,b){for(var c=a.length,d=I.alloc(),e=0;e<c;e++){var f=a[e];d.x=f[0];d.y=f[1];b.ra(d);f[0]=d.x;f[1]=d.y;d.x=f[2];d.y=f[3];b.ra(d);f[2]=d.x;f[3]=d.y;d.x=f[4];d.y=f[5];b.ra(d);f[4]=d.x;f[5]=d.y;d.x=f[6];d.y=f[7];b.ra(d);f[6]=d.x;f[7]=d.y}I.free(d)}t.Lv=function(){if(this.qa||this.Dr!==this.figures.Aa)return!0;for(var a=this.figures.j,b=a.length,c=0;c<b;c++)if(a[c].Lv())return!0;return!1};
    sd.prototype.computeBounds=function(){this.qa=!1;this.Tm=this.Gk=null;this.Um=NaN;this.Dr=this.figures.Aa;for(var a=this.figures.j,b=a.length,c=0;c<b;c++){var d=a[c];d.qa=!1;var e=d.segments;d.Js=e.Aa;d=e.j;e=d.length;for(var f=0;f<e;f++){var g=d[f];g.qa=!1;g.Me=null}}a=this.kr;a.ea();isNaN(this.kl)||isNaN(this.jl)?a.h(0,0,0,0):a.h(0,0,this.kl,this.jl);Vd(this,a,!1);ec(a,0,0,0,0);a.freeze()};sd.prototype.Ex=function(){var a=new N;Vd(this,a,!0);return a};
    function Vd(a,b,c){switch(a.type){case vd:case Gd:case Hd:c?b.h(a.Rc,a.Sc,0,0):ec(b,a.Rc,a.Sc,0,0);ec(b,a.ec,a.mc,0,0);break;case td:var d=a.figures;a=d.j;d=d.length;for(var e=0;e<d;e++){var f=a[e];c&&0===e?b.h(f.startX,f.startY,0,0):ec(b,f.startX,f.startY,0,0);for(var g=f.segments.j,h=g.length,k=f.startX,l=f.startY,m=0;m<h;m++){var n=g[m];switch(n.type){case xd:case Wd:k=n.endX;l=n.endY;ec(b,k,l,0,0);break;case Xd:J.bm(k,l,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.5,b);k=n.endX;l=n.endY;
      break;case Yd:J.Uv(k,l,n.point1X,n.point1Y,n.endX,n.endY,.5,b);k=n.endX;l=n.endY;break;case Zd:case $d:var p=n.type===Zd?ae(n,f):be(n,f,k,l),r=p.length;if(0===r){k=n.centerX;l=n.centerY;ec(b,k,l,0,0);break}n=null;for(var q=0;q<r;q++)n=p[q],J.bm(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],.5,b);null!==n&&(k=n[6],l=n[7]);break;default:B("Unknown Segment type: "+n.type)}}}break;default:B("Unknown Geometry type: "+a.type)}}
    sd.prototype.normalize=function(){this.s&&ua(this);var a=this.Ex();this.offset(-a.x,-a.y);return new I(-a.x,-a.y)};sd.prototype.offset=function(a,b){this.s&&ua(this);this.transform(1,0,0,1,a,b);return this};sd.prototype.scale=function(a,b){this.s&&ua(this);this.transform(a,0,0,b,0,0);return this};sd.prototype.rotate=function(a,b,c){this.s&&ua(this);void 0===b&&(b=0);void 0===c&&(c=0);var d=qd.alloc();d.reset();d.rotate(a,b,c);this.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);qd.free(d);return this};
    t=sd.prototype;
    t.transform=function(a,b,c,d,e,f){switch(this.type){case vd:case Gd:case Hd:var g=this.Rc;var h=this.Sc;this.Rc=g*a+h*c+e;this.Sc=g*b+h*d+f;g=this.ec;h=this.mc;this.ec=g*a+h*c+e;this.mc=g*b+h*d+f;break;case td:for(var k=this.figures.j,l=k.length,m=0;m<l;m++){var n=k[m];g=n.startX;h=n.startY;n.startX=g*a+h*c+e;n.startY=g*b+h*d+f;n=n.segments.j;for(var p=n.length,r=0;r<p;r++){var q=n[r];switch(q.type){case xd:case Wd:g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case Xd:g=q.point1X;h=q.point1Y;
      q.point1X=g*a+h*c+e;q.point1Y=g*b+h*d+f;g=q.point2X;h=q.point2Y;q.point2X=g*a+h*c+e;q.point2Y=g*b+h*d+f;g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case Yd:g=q.point1X;h=q.point1Y;q.point1X=g*a+h*c+e;q.point1Y=g*b+h*d+f;g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case Zd:g=q.centerX;h=q.centerY;q.centerX=g*a+h*c+e;q.centerY=g*b+h*d+f;0!==b&&(g=180*Math.atan2(b,a)/Math.PI,0>g&&(g+=360),q.startAngle+=g);0>a&&(q.startAngle=180-q.startAngle,q.sweepAngle=-q.sweepAngle);0>d&&
    (q.startAngle=-q.startAngle,q.sweepAngle=-q.sweepAngle);q.radiusX*=Math.sqrt(a*a+c*c);void 0!==q.radiusY&&(q.radiusY*=Math.sqrt(b*b+d*d));break;case $d:g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;0!==b&&(g=180*Math.atan2(b,a)/Math.PI,0>g&&(g+=360),q.xAxisRotation+=g);0>a&&(q.xAxisRotation=180-q.xAxisRotation,q.isClockwiseArc=!q.isClockwiseArc);0>d&&(q.xAxisRotation=-q.xAxisRotation,q.isClockwiseArc=!q.isClockwiseArc);q.radiusX*=Math.sqrt(a*a+c*c);q.radiusY*=Math.sqrt(b*b+d*d);break;default:B("Unknown Segment type: "+
      q.type)}}}}this.qa=!0;return this};
    t.aa=function(a,b){void 0===b&&(b=0);var c=this.Rc,d=this.Sc,e=this.ec,f=this.mc;switch(this.type){case vd:return J.Nb(c,d,e,f,b,a.x,a.y);case Gd:var g=N.allocAt(Math.min(c,e)-b,Math.min(d,f)-b,Math.abs(e-c)+2*b,Math.abs(f-d)+2*b);a=g.aa(a);N.free(g);return a;case Hd:g=Math.min(c,e)-b;var h=Math.min(d,f)-b;c=(Math.abs(e-c)+2*b)/2;b=(Math.abs(f-d)+2*b)/2;if(0>=c||0>=b)return!1;g=a.x-(g+c);h=a.y-(h+b);return 1>=g*g/(c*c)+h*h/(b*b);case td:return ce(this,a,b,!0,!1);default:return!1}};
    function ce(a,b,c,d,e){var f=b.x;b=b.y;for(var g=a.bounds.x-20,h=0,k,l,m,n,p=a.figures.j,r=p.length,q=0;q<r;q++){var u=p[q];if(u.isFilled){if(d&&u.aa(f,b,c))return!0;var v=u.segments;k=u.startX;l=u.startY;for(var w=k,y=l,z=v.j,A=0;A<=v.length;A++){var C=void 0;if(A!==v.length){C=z[A];var H=C.type;a=C.endX;n=C.endY}else H=xd,a=w,n=y;switch(H){case Wd:w=de(f,b,g,b,k,l,w,y);if(isNaN(w))return!0;h+=w;w=a;y=n;break;case xd:k=de(f,b,g,b,k,l,a,n);if(isNaN(k))return!0;h+=k;break;case Xd:m=J.fq(k,l,C.point1X,
      C.point1Y,C.point2X,C.point2Y,a,n,g,b,f,b,.5);h+=m;break;case Yd:m=J.fq(k,l,(k+2*C.point1X)/3,(l+2*C.point1Y)/3,(2*C.point1X+a)/3,(2*C.point1Y+n)/3,a,n,g,b,f,b,.5);h+=m;break;case Zd:case $d:H=C.type===Zd?ae(C,u):be(C,u,k,l);var L=H.length;if(0===L){k=de(f,b,g,b,k,l,C.centerX,C.centerY);if(isNaN(k))return!0;h+=k;break}C=null;for(var K=0;K<L;K++){C=H[K];if(0===K){m=de(f,b,g,b,k,l,C[0],C[1]);if(isNaN(m))return!0;h+=m}m=J.fq(C[0],C[1],C[2],C[3],C[4],C[5],C[6],C[7],g,b,f,b,.5);h+=m}null!==C&&(a=C[6],
      n=C[7]);break;default:B("Unknown Segment type: "+C.type)}k=a;l=n}if(0!==h)return!0;h=0}else if(u.aa(f,b,e?c:c+2))return!0}return 0!==h}function de(a,b,c,d,e,f,g,h){if(J.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 ee(a,b,c,d){a=a.figures.j;for(var e=a.length,f=0;f<e;f++)if(a[f].aa(b,c,d))return!0;return!1}
    t.Bv=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=new I);if(this.type===vd)return b.h(this.startX+a*(this.endX-this.startX),this.startY+a*(this.endY-this.startY)),b;for(var c=this.flattenedSegments,d=this.flattenedLengths,e=c.length,f=this.flattenedTotalLength*a,g=0,h=0;h<e;h++){var k=d[h],l=k.length;for(a=0;a<l;a++){var m=k[a];if(g+m>=f)return d=f-g,d=0===m?0:d/m,c=c[h],h=c[2*a],e=c[2*a+1],b.h(h+(c[2*a+2]-h)*d,e+(c[2*a+3]-e)*d),b;g+=m}}return b};
    t.Qx=function(a){0>a?a=0:1<a&&(a=1);if(this.type===vd)return 180*Math.atan2(this.endY-this.startY,this.endX-this.startX)/Math.PI;for(var b=this.flattenedSegments,c=this.flattenedLengths,d=b.length,e=this.flattenedTotalLength*a,f=0,g=0;g<d;g++){var h=c[g],k=h.length;for(a=0;a<k;a++){var l=h[a];if(f+l>=e)return e=b[g],b=e[2*a],c=e[2*a+1],d=e[2*a+2],a=e[2*a+3],1>Math.abs(d-b)&&1>Math.abs(a-c)?0:1>Math.abs(d-b)?0<=a-c?90:270:1>Math.abs(a-c)?0<=d-b?0:180:180*Math.atan2(a-c,d-b)/Math.PI;f+=l}}return NaN};
    t.Cv=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=[]);b.length=3;if(this.type===vd)return b[0]=this.startX+a*(this.endX-this.startX),b[1]=this.startY+a*(this.endY-this.startY),b[2]=180*Math.atan2(this.endY-this.startY,this.endX-this.startX)/Math.PI,b;for(var c=this.flattenedSegments,d=this.flattenedLengths,e=c.length,f=this.flattenedTotalLength*a,g=0,h=0;h<e;h++){var k=d[h],l=k.length;for(a=0;a<l;a++){var m=k[a];if(g+m>=f)return d=f-g,d=0===m?0:d/m,m=c[h],c=m[2*a],h=m[2*a+1],e=m[2*a+2],a=m[2*a+
    3],b[0]=c+(e-c)*d,b[1]=h+(a-h)*d,b[2]=1>Math.abs(e-c)&&1>Math.abs(a-h)?0:1>Math.abs(e-c)?0<=a-h?90:270:1>Math.abs(a-h)?0<=e-c?0:180:180*Math.atan2(a-h,e-c)/Math.PI,b;g+=m}}return b};
    t.Rx=function(a){if(this.type===vd){var b=this.startX,c=this.startY,d=this.endX,e=this.endY;if(b!==d||c!==e){var f=a.x;a=a.y;if(b===d){if(c<e){var g=c;d=e}else g=e,d=c;return a<=g?g===c?0:1:a>=d?d===c?0:1:Math.abs(a-c)/(d-g)}if(c===e)return b<d?g=b:(g=d,d=b),f<=g?g===b?0:1:f>=d?d===b?0:1:Math.abs(f-b)/(d-g);g=(d-b)*(d-b)+(e-c)*(e-c);var h=I.alloc();J.Jh(b,c,d,e,f,a,h);a=h.x;f=h.y;I.free(h);return Math.sqrt(((a-b)*(a-b)+(f-c)*(f-c))/g)}}else if(this.type===Gd){g=this.startX;h=this.startY;var k=this.endX;
      e=this.endY;if(g!==k||h!==e){b=k-g;c=e-h;f=2*b+2*c;d=a.x;a=a.y;d=Math.min(Math.max(d,g),k);a=Math.min(Math.max(a,h),e);g=Math.abs(d-g);k=Math.abs(d-k);h=Math.abs(a-h);e=Math.abs(a-e);var l=Math.min(g,k,h,e);if(l===h)return d/f;if(l===k)return(b+a)/f;if(l===e)return(2*b+c-d)/f;if(l===g)return(2*b+2*c-a)/f}}else{b=this.flattenedSegments;c=this.flattenedLengths;f=this.flattenedTotalLength;d=I.alloc();e=Infinity;h=g=0;k=b.length;for(var m=l=0,n=0;n<k;n++)for(var p=b[n],r=c[n],q=p.length,u=0;u<q;u+=2){var v=
      p[u],w=p[u+1];if(0!==u){J.Jh(l,m,v,w,a.x,a.y,d);var y=(d.x-a.x)*(d.x-a.x)+(d.y-a.y)*(d.y-a.y);y<e&&(e=y,g=h,g+=Math.sqrt((d.x-l)*(d.x-l)+(d.y-m)*(d.y-m)));h+=r[(u-2)/2]}l=v;m=w}I.free(d);a=g/f;return 0>a?0:1<a?1:a}return 0};
    function fe(a){if(null===a.Gk){var b=a.Gk=[],c=a.Tm=[],d=[],e=[];if(a.type===vd)d.push(a.startX),d.push(a.startY),d.push(a.endX),d.push(a.endY),b.push(d),e.push(Math.sqrt((a.startX-a.endX)*(a.startX-a.endX)+(a.startY-a.endY)*(a.startY-a.endY))),c.push(e);else if(a.type===Gd)d.push(a.startX),d.push(a.startY),d.push(a.endX),d.push(a.startY),d.push(a.endX),d.push(a.endY),d.push(a.startX),d.push(a.endY),d.push(a.startX),d.push(a.startY),b.push(d),e.push(Math.abs(a.startX-a.endX)),e.push(Math.abs(a.startY-
      a.endY)),e.push(Math.abs(a.startX-a.endX)),e.push(Math.abs(a.startY-a.endY)),c.push(e);else if(a.type===Hd){var f=new ne;f.startX=a.endX;f.startY=(a.startY+a.endY)/2;var g=new oe(Zd);g.startAngle=0;g.sweepAngle=360;g.centerX=(a.startX+a.endX)/2;g.centerY=(a.startY+a.endY)/2;g.radiusX=Math.abs(a.startX-a.endX)/2;g.radiusY=Math.abs(a.startY-a.endY)/2;f.add(g);a=ae(g,f);e=a.length;if(0===e)d.push(g.centerX),d.push(g.centerY);else{g=f.startX;f=f.startY;for(var h=0;h<e;h++){var k=a[h];J.ze(g,f,k[2],k[3],
      k[4],k[5],k[6],k[7],.5,d);g=k[6];f=k[7]}}b.push(d);c.push(pe(d))}else for(a=a.figures.iterator;a.next();){e=a.value;d=[];d.push(e.startX);d.push(e.startY);g=e.startX;f=e.startY;h=g;k=f;for(var l=e.segments.j,m=l.length,n=0;n<m;n++){var p=l[n];switch(p.type){case Wd:4<=d.length&&(b.push(d),c.push(pe(d)));d=[];d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;h=g;k=f;break;case xd:d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;break;case Xd:J.ze(g,f,p.point1X,p.point1Y,p.point2X,p.point2Y,p.endX,p.endY,
      .5,d);g=p.endX;f=p.endY;break;case Yd:J.Cq(g,f,p.point1X,p.point1Y,p.endX,p.endY,.5,d);g=p.endX;f=p.endY;break;case Zd:var r=ae(p,e),q=r.length;if(0===q){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(var u=0;u<q;u++){var v=r[u];J.ze(g,f,v[2],v[3],v[4],v[5],v[6],v[7],.5,d);g=v[6];f=v[7]}break;case $d:r=be(p,e,g,f);q=r.length;if(0===q){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(u=0;u<q;u++)v=r[u],J.ze(g,f,v[2],v[3],v[4],v[5],v[6],v[7],.5,d),g=v[6],
      f=v[7];break;default:B("Segment not of valid type: "+p.type)}p.isClosed&&(d.push(h),d.push(k))}4<=d.length&&(b.push(d),c.push(pe(d)))}}}function pe(a){for(var b=[],c=0,d=0,e=a.length,f=0;f<e;f+=2){var g=a[f],h=a[f+1];0!==f&&b.push(Math.sqrt(Cb(c,d,g,h)));c=g;d=h}return b}t.add=function(a){this.rj.add(a);return this};t.Jm=function(a,b,c,d,e,f,g,h){this.s&&ua(this);this.jf=(new P(a,b,e,f)).freeze();this.kf=(new P(c,d,g,h)).freeze();return this};
    ma.Object.defineProperties(sd.prototype,{flattenedSegments:{get:function(){fe(this);return this.Gk}},flattenedLengths:{get:function(){fe(this);return this.Tm}},flattenedTotalLength:{get:function(){var a=this.Um;if(isNaN(a)){if(this.type===vd){a=Math.abs(this.endX-this.startX);var b=Math.abs(this.endY-this.startY);a=Math.sqrt(a*a+b*b)}else if(this.type===Gd)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.Um=a}return a}},type:{get:function(){return this.pa},set:function(a){this.pa!==a&&(this.s&&ua(this,a),this.pa=a,this.qa=!0)}},startX:{get:function(){return this.Rc},set:function(a){this.Rc!==a&&(this.s&&ua(this,a),this.Rc=a,this.qa=!0)}},startY:{get:function(){return this.Sc},set:function(a){this.Sc!==
        a&&(this.s&&ua(this,a),this.Sc=a,this.qa=!0)}},endX:{get:function(){return this.ec},set:function(a){this.ec!==a&&(this.s&&ua(this,a),this.ec=a,this.qa=!0)}},endY:{get:function(){return this.mc},set:function(a){this.mc!==a&&(this.s&&ua(this,a),this.mc=a,this.qa=!0)}},figures:{get:function(){return this.rj},set:function(a){this.rj!==a&&(this.s&&ua(this,a),this.rj=a,this.qa=!0)}},spot1:{
        get:function(){return this.jf},set:function(a){this.s&&ua(this,a);this.jf=a.G()}},spot2:{get:function(){return this.kf},set:function(a){this.s&&ua(this,a);this.kf=a.G()}},defaultStretch:{get:function(){return this.Of},set:function(a){this.s&&ua(this,a);this.Of=a}},bounds:{get:function(){this.Lv()&&this.computeBounds();return this.kr}}});sd.prototype.setSpots=sd.prototype.Jm;sd.prototype.add=sd.prototype.add;
    sd.prototype.getFractionForPoint=sd.prototype.Rx;sd.prototype.getPointAndAngleAlongPath=sd.prototype.Cv;sd.prototype.getAngleAlongPath=sd.prototype.Qx;sd.prototype.getPointAlongPath=sd.prototype.Bv;sd.prototype.containsPoint=sd.prototype.aa;sd.prototype.transform=sd.prototype.transform;sd.prototype.rotate=sd.prototype.rotate;sd.prototype.scale=sd.prototype.scale;sd.prototype.offset=sd.prototype.offset;sd.prototype.normalize=sd.prototype.normalize;sd.prototype.computeBoundsWithoutOrigin=sd.prototype.Ex;
    sd.prototype.equalsApprox=sd.prototype.Ma;var vd=new D(sd,"Line",0),Gd=new D(sd,"Rectangle",1),Hd=new D(sd,"Ellipse",2),td=new D(sd,"Path",3);sd.className="Geometry";sd.stringify=yd;sd.fillPath=function(a){a=a.split(/[Xx]/);for(var b=a.length,c="",d=0;d<b;d++){var e=a[d];c=null!==e.match(/[Ff]/)?0===d?c+e:c+("X"+(" "===e[0]?"":" ")+e):c+((0===d?"":"X ")+"F"+(" "===e[0]?"":" ")+e)}return c};sd.parse=Id;sd.Line=vd;sd.Rectangle=Gd;sd.Ellipse=Hd;sd.Path=td;
    function ne(a,b,c,d){Ya(this);this.s=!1;void 0===c&&(c=!0);this.Or=c;void 0===d&&(d=!0);this.Sr=d;void 0!==a?this.Rc=a:this.Rc=0;void 0!==b?this.Sc=b:this.Sc=0;this.Kl=new E;this.Js=this.Kl.Aa;this.qa=!0}ne.prototype.copy=function(){var a=new ne;a.Or=this.Or;a.Sr=this.Sr;a.Rc=this.Rc;a.Sc=this.Sc;for(var b=this.Kl.j,c=b.length,d=a.Kl,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.Js=this.Js;a.qa=this.qa;return a};t=ne.prototype;
    t.Ma=function(a){if(!(a instanceof ne&&J.A(this.startX,a.startX)&&J.A(this.startY,a.startY)))return!1;var b=this.segments.j;a=a.segments.j;var c=b.length;if(c!==a.length)return!1;for(var d=0;d<c;d++)if(!b[d].Ma(a[d]))return!1;return!0};t.toString=function(a){void 0===a&&(a=-1);var b=0>a?"M"+this.startX.toString()+" "+this.startY.toString():"M"+this.startX.toFixed(a)+" "+this.startY.toFixed(a);for(var c=this.segments.j,d=c.length,e=0;e<d;e++)b+=" "+c[e].toString(a);return b};
    t.freeze=function(){this.s=!0;var a=this.segments;a.freeze();var b=a.j;a=a.length;for(var c=0;c<a;c++)b[c].freeze();return this};t.ea=function(){this.s=!1;var a=this.segments;a.ea();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].ea();return this};t.Lv=function(){if(this.qa)return!0;var a=this.segments;if(this.Js!==a.Aa)return!0;a=a.j;for(var b=a.length,c=0;c<b;c++)if(a[c].qa)return!0;return!1};t.add=function(a){this.Kl.add(a);return this};
    t.aa=function(a,b,c){for(var d=this.startX,e=this.startY,f=d,g=e,h=this.segments.j,k=h.length,l=0;l<k;l++){var m=h[l];switch(m.type){case Wd:f=m.endX;g=m.endY;d=m.endX;e=m.endY;break;case xd:if(J.Nb(d,e,m.endX,m.endY,c,a,b))return!0;d=m.endX;e=m.endY;break;case Xd:if(J.bt(d,e,m.point1X,m.point1Y,m.point2X,m.point2Y,m.endX,m.endY,.5,a,b,c))return!0;d=m.endX;e=m.endY;break;case Yd:if(J.Vv(d,e,m.point1X,m.point1Y,m.endX,m.endY,.5,a,b,c))return!0;d=m.endX;e=m.endY;break;case Zd:case $d:var n=m.type===
    Zd?ae(m,this):be(m,this,d,e),p=n.length;if(0===p){if(J.Nb(d,e,m.centerX,m.centerY,c,a,b))return!0;d=m.centerX;e=m.centerY;break}for(var r=null,q=0;q<p;q++)if(r=n[q],0===q&&J.Nb(d,e,r[0],r[1],c,a,b)||J.bt(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)&&J.Nb(d,e,f,g,c,a,b))return!0}return!1};
    ma.Object.defineProperties(ne.prototype,{isFilled:{get:function(){return this.Or},set:function(a){this.s&&ua(this,a);this.Or=a}},isShadowed:{get:function(){return this.Sr},set:function(a){this.s&&ua(this,a);this.Sr=a}},startX:{get:function(){return this.Rc},set:function(a){this.s&&ua(this,a);this.Rc=a;this.qa=!0}},startY:{get:function(){return this.Sc},set:function(a){this.s&&ua(this,
          a);this.Sc=a;this.qa=!0}},segments:{get:function(){return this.Kl},set:function(a){this.s&&ua(this,a);this.Kl=a;this.qa=!0}}});ne.prototype.add=ne.prototype.add;ne.prototype.equalsApprox=ne.prototype.Ma;ne.className="PathFigure";
    function oe(a,b,c,d,e,f,g,h){Ya(this);this.s=!1;void 0===a&&(a=xd);this.pa=a;void 0!==b?this.ec=b:this.ec=0;void 0!==c?this.mc=c:this.mc=0;void 0===d&&(d=0);void 0===e&&(e=0);void 0===f&&(f=0);void 0===g&&(g=0);a===$d?(a=f%360,0>a&&(a+=360),this.ve=a,this.Di=0,this.Ei=Math.max(d,0),this.ih=Math.max(e,0),this.sl="boolean"===typeof g?!!g:!1,this.Kk=!!h):(this.ve=d,this.Di=e,a===Zd&&(f=Math.max(f,0)),this.Ei=f,"number"===typeof g?(a===Zd&&(g=Math.max(g,0)),this.ih=g):this.ih=0,this.Kk=this.sl=!1);this.wj=
      !1;this.qa=!0;this.Me=null}oe.prototype.copy=function(){var a=new oe;a.pa=this.pa;a.ec=this.ec;a.mc=this.mc;a.ve=this.ve;a.Di=this.Di;a.Ei=this.Ei;a.ih=this.ih;a.sl=this.sl;a.Kk=this.Kk;a.wj=this.wj;a.qa=this.qa;return a};t=oe.prototype;
    t.Ma=function(a){if(!(a instanceof oe)||this.type!==a.type||this.isClosed!==a.isClosed)return!1;switch(this.type){case Wd:case xd:return J.A(this.endX,a.endX)&&J.A(this.endY,a.endY);case Xd:return J.A(this.endX,a.endX)&&J.A(this.endY,a.endY)&&J.A(this.point1X,a.point1X)&&J.A(this.point1Y,a.point1Y)&&J.A(this.point2X,a.point2X)&&J.A(this.point2Y,a.point2Y);case Yd:return J.A(this.endX,a.endX)&&J.A(this.endY,a.endY)&&J.A(this.point1X,a.point1X)&&J.A(this.point1Y,a.point1Y);case Zd:return J.A(this.startAngle,
      a.startAngle)&&J.A(this.sweepAngle,a.sweepAngle)&&J.A(this.centerX,a.centerX)&&J.A(this.centerY,a.centerY)&&J.A(this.radiusX,a.radiusX)&&J.A(this.radiusY,a.radiusY);case $d:return this.isClockwiseArc===a.isClockwiseArc&&this.isLargeArc===a.isLargeArc&&J.A(this.xAxisRotation,a.xAxisRotation)&&J.A(this.endX,a.endX)&&J.A(this.endY,a.endY)&&J.A(this.radiusX,a.radiusX)&&J.A(this.radiusY,a.radiusY);default:return!1}};t.cb=function(a){a.classType===oe&&(this.type=a)};
    t.toString=function(a){void 0===a&&(a=-1);switch(this.type){case Wd:a=0>a?"M"+this.endX.toString()+" "+this.endY.toString():"M"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case xd:a=0>a?"L"+this.endX.toString()+" "+this.endY.toString():"L"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Xd:a=0>a?"C"+this.point1X.toString()+" "+this.point1Y.toString()+" "+this.point2X.toString()+" "+this.point2Y.toString()+" "+this.endX.toString()+" "+this.endY.toString():"C"+this.point1X.toFixed(a)+
      " "+this.point1Y.toFixed(a)+" "+this.point2X.toFixed(a)+" "+this.point2Y.toFixed(a)+" "+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Yd:a=0>a?"Q"+this.point1X.toString()+" "+this.point1Y.toString()+" "+this.endX.toString()+" "+this.endY.toString():"Q"+this.point1X.toFixed(a)+" "+this.point1Y.toFixed(a)+" "+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Zd:a=0>a?"B"+this.startAngle.toString()+" "+this.sweepAngle.toString()+" "+this.centerX.toString()+" "+this.centerY.toString()+
      " "+this.radiusX.toString()+" "+this.radiusY.toString():"B"+this.startAngle.toFixed(a)+" "+this.sweepAngle.toFixed(a)+" "+this.centerX.toFixed(a)+" "+this.centerY.toFixed(a)+" "+this.radiusX.toFixed(a)+" "+this.radiusY.toFixed(a);break;case $d:a=0>a?"A"+this.radiusX.toString()+" "+this.radiusY.toString()+" "+this.xAxisRotation.toString()+" "+(this.isLargeArc?1:0)+" "+(this.isClockwiseArc?1:0)+" "+this.endX.toString()+" "+this.endY.toString():"A"+this.radiusX.toFixed(a)+" "+this.radiusY.toFixed(a)+
      " "+this.xAxisRotation.toFixed(a)+" "+(this.isLargeArc?1:0)+" "+(this.isClockwiseArc?1:0)+" "+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;default:a=this.type.toString()}return a+(this.wj?"z":"")};t.freeze=function(){this.s=!0;return this};t.ea=function(){this.s=!1;return this};t.close=function(){this.wj=!0;return this};
    function ae(a,b){if(null!==a.Me&&!1===b.qa)return a.Me;var c=a.radiusX,d=a.radiusY;void 0===d&&(d=c);if(0===c||0===d)return a.Me=[],a.Me;b=a.ve;var e=a.Di,f=J.Fx(0,0,c<d?c:d,a.startAngle,a.startAngle+a.sweepAngle,!1);if(c!==d){var g=qd.alloc();g.reset();c<d?g.scale(1,d/c):g.scale(c/d,1);Ud(f,g);qd.free(g)}c=f.length;for(d=0;d<c;d++)g=f[d],g[0]+=b,g[1]+=e,g[2]+=b,g[3]+=e,g[4]+=b,g[5]+=e,g[6]+=b,g[7]+=e;a.Me=f;return a.Me}
    function be(a,b,c,d){function e(a,b,c,d){return(a*d<b*c?-1:1)*Math.acos((a*c+b*d)/(Math.sqrt(a*a+b*b)*Math.sqrt(c*c+d*d)))}if(null!==a.Me&&!1===b.qa)return a.Me;b=a.Ei;var f=a.ih;0===b&&(b=1E-4);0===f&&(f=1E-4);var g=Math.PI/180*a.ve,h=a.sl,k=a.Kk,l=a.ec,m=a.mc,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=J.Fx(0,0,b>f?b:f,m,m+g,!0);f=qd.alloc();f.reset();f.translate(c,d);f.rotate(a.ve,0,0);f.scale(k,r);Ud(b,f);qd.free(f);a.Me=b;return a.Me}
    ma.Object.defineProperties(oe.prototype,{isClosed:{get:function(){return this.wj},set:function(a){this.wj!==a&&(this.wj=a,this.qa=!0)}},type:{get:function(){return this.pa},set:function(a){this.s&&ua(this,a);this.pa=a;this.qa=!0}},endX:{get:function(){return this.ec},set:function(a){this.s&&ua(this,a);this.ec=a;this.qa=!0}},endY:{get:function(){return this.mc},set:function(a){this.s&&
        ua(this,a);this.mc=a;this.qa=!0}},point1X:{get:function(){return this.ve},set:function(a){this.s&&ua(this,a);this.ve=a;this.qa=!0}},point1Y:{get:function(){return this.Di},set:function(a){this.s&&ua(this,a);this.Di=a;this.qa=!0}},point2X:{get:function(){return this.Ei},set:function(a){this.s&&ua(this,a);this.Ei=a;this.qa=!0}},point2Y:{get:function(){return this.ih},set:function(a){this.s&&
        ua(this,a);this.ih=a;this.qa=!0}},centerX:{get:function(){return this.ve},set:function(a){this.s&&ua(this,a);this.ve=a;this.qa=!0}},centerY:{get:function(){return this.Di},set:function(a){this.s&&ua(this,a);this.Di=a;this.qa=!0}},radiusX:{get:function(){return this.Ei},set:function(a){0>a&&va(a,">= zero",oe,"radiusX");this.s&&ua(this,a);this.Ei=a;this.qa=!0}},radiusY:{get:function(){return this.ih},
        set:function(a){0>a&&va(a,">= zero",oe,"radiusY");this.s&&ua(this,a);this.ih=a;this.qa=!0}},startAngle:{get:function(){return this.ec},set:function(a){this.ec!==a&&(this.s&&ua(this,a),a%=360,0>a&&(a+=360),this.ec=a,this.qa=!0)}},sweepAngle:{get:function(){return this.mc},set:function(a){this.s&&ua(this,a);360<a&&(a=360);-360>a&&(a=-360);this.mc=a;this.qa=!0}},isClockwiseArc:{get:function(){return this.Kk},set:function(a){this.s&&
        ua(this,a);this.Kk=a;this.qa=!0}},isLargeArc:{get:function(){return this.sl},set:function(a){this.s&&ua(this,a);this.sl=a;this.qa=!0}},xAxisRotation:{get:function(){return this.ve},set:function(a){a%=360;0>a&&(a+=360);this.s&&ua(this,a);this.ve=a;this.qa=!0}}});oe.prototype.equalsApprox=oe.prototype.Ma;
    var Wd=new D(oe,"Move",0),xd=new D(oe,"Line",1),Xd=new D(oe,"Bezier",2),Yd=new D(oe,"QuadraticBezier",3),Zd=new D(oe,"Arc",4),$d=new D(oe,"SvgArc",4);oe.className="PathSegment";oe.Move=Wd;oe.Line=xd;oe.Bezier=Xd;oe.QuadraticBezier=Yd;oe.Arc=Zd;oe.SvgArc=$d;function qe(){this.B=null;this.av=(new I(0,0)).freeze();this.ku=(new I(0,0)).freeze();this.cr=this.fs=0;this.dr=1;this.Wr="";this.Xs=this.xr=!1;this.ur=this.fr=0;this.Kg=this.Hr=this.Qr=!1;this.Cr=null;this.Ss=0;this.bd=this.Rs=null}
    qe.prototype.copy=function(){var a=new qe;return this.clone(a)};qe.prototype.clone=function(a){a.B=this.B;a.av.assign(this.viewPoint);a.ku.assign(this.documentPoint);a.fs=this.fs;a.cr=this.cr;a.dr=this.dr;a.Wr=this.Wr;a.xr=this.xr;a.Xs=this.Xs;a.fr=this.fr;a.ur=this.ur;a.Qr=this.Qr;a.Hr=this.Hr;a.Kg=this.Kg;a.Cr=this.Cr;a.Ss=this.Ss;a.Rs=this.Rs;a.bd=this.bd;return a};
    qe.prototype.toString=function(){var a="^";0!==this.modifiers&&(a+="M:"+this.modifiers);0!==this.button&&(a+="B:"+this.button);""!==this.key&&(a+="K:"+this.key);0!==this.clickCount&&(a+="C:"+this.clickCount);0!==this.delta&&(a+="D:"+this.delta);this.handled&&(a+="h");this.bubbles&&(a+="b");null!==this.documentPoint&&(a+="@"+this.documentPoint.toString());return a};qe.prototype.oq=function(a,b){var c=this.diagram;if(null===c)return b;re(c,this.event,a,b);return b};
    qe.prototype.Gz=function(a,b){var c=this.diagram;if(null===c)return b;re(c,this.event,a,b);b.assign(c.Rt(b));return b};
    ma.Object.defineProperties(qe.prototype,{diagram:{get:function(){return this.B},set:function(a){this.B=a}},viewPoint:{get:function(){return this.av},set:function(a){this.av.assign(a)}},documentPoint:{get:function(){return this.ku},set:function(a){this.ku.assign(a)}},modifiers:{get:function(){return this.fs},set:function(a){this.fs=a}},button:{get:function(){return this.cr},
        set:function(a){this.cr=a;if(null===this.event)switch(a){case 0:this.buttons=1;break;case 1:this.buttons=4;break;case 2:this.buttons=2}}},buttons:{get:function(){return this.dr},set:function(a){this.dr=a}},key:{get:function(){return this.Wr},set:function(a){this.Wr=a}},down:{get:function(){return this.xr},set:function(a){this.xr=a}},up:{get:function(){return this.Xs},set:function(a){this.Xs=
          a}},clickCount:{get:function(){return this.fr},set:function(a){this.fr=a}},delta:{get:function(){return this.ur},set:function(a){this.ur=a}},isMultiTouch:{get:function(){return this.Qr},set:function(a){this.Qr=a}},handled:{get:function(){return this.Hr},set:function(a){this.Hr=a}},bubbles:{get:function(){return this.Kg},set:function(a){this.Kg=a}},event:{
        get:function(){return this.Cr},set:function(a){this.Cr=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.Ss},set:function(a){this.Ss=a}},targetDiagram:{get:function(){return this.Rs},set:function(a){this.Rs=a}},targetObject:{
        get:function(){return this.bd},set:function(a){this.bd=a}},control:{get:function(){return 0!==(this.modifiers&1)},set:function(a){this.modifiers=a?this.modifiers|1:this.modifiers&-2}},shift:{get:function(){return 0!==(this.modifiers&4)},set:function(a){this.modifiers=a?this.modifiers|4:this.modifiers&-5}},alt:{get:function(){return 0!==(this.modifiers&2)},set:function(a){this.modifiers=a?this.modifiers|
          2:this.modifiers&-3}},meta:{get:function(){return 0!==(this.modifiers&8)},set:function(a){this.modifiers=a?this.modifiers|8:this.modifiers&-9}},left:{get:function(){var a=this.event;return null===a||"mousedown"!==a.type&&"mouseup"!==a.type&&"pointerdown"!==a.type&&"pointerup"!==a.type?0!==(this.buttons&1):0===this.button},set:function(a){this.buttons=a?this.buttons|1:this.buttons&-2}},right:{get:function(){var a=
          this.event;return null===a||"mousedown"!==a.type&&"mouseup"!==a.type&&"pointerdown"!==a.type&&"pointerup"!==a.type?0!==(this.buttons&2):2===this.button},set:function(a){this.buttons=a?this.buttons|2:this.buttons&-3}},middle:{get:function(){var a=this.event;return null===a||"mousedown"!==a.type&&"mouseup"!==a.type&&"pointerdown"!==a.type&&"pointerup"!==a.type?0!==(this.buttons&4):1===this.button},set:function(a){this.buttons=a?this.buttons|4:this.buttons&-5}}});
    qe.prototype.getMultiTouchDocumentPoint=qe.prototype.Gz;qe.prototype.getMultiTouchViewPoint=qe.prototype.oq;qe.className="InputEvent";function se(){this.B=null;this.Qa="";this.qs=this.Qs=null}se.prototype.copy=function(){var a=new se;a.B=this.B;a.Qa=this.Qa;a.Qs=this.Qs;a.qs=this.qs;return a};se.prototype.toString=function(){var a="*"+this.name;null!==this.subject&&(a+=":"+this.subject.toString());null!==this.parameter&&(a+="("+this.parameter.toString()+")");return a};
    ma.Object.defineProperties(se.prototype,{diagram:{get:function(){return this.B},set:function(a){this.B=a}},name:{get:function(){return this.Qa},set:function(a){this.Qa=a}},subject:{get:function(){return this.Qs},set:function(a){this.Qs=a}},parameter:{get:function(){return this.qs},set:function(a){this.qs=a}}});se.className="DiagramEvent";
    function te(){this.dn=ue;this.bf=this.es="";this.Oo=this.Po=this.Vo=this.Wo=this.Uo=this.B=this.ac=null}te.prototype.clear=function(){this.Oo=this.Po=this.Vo=this.Wo=this.Uo=this.B=this.ac=null};
    te.prototype.copy=function(){var a=new te;a.dn=this.dn;a.es=this.es;a.bf=this.bf;a.ac=this.ac;a.B=this.B;a.Uo=this.Uo;var b=this.Wo;a.Wo=za(b)&&"function"===typeof b.G?b.G():b;b=this.Vo;a.Vo=za(b)&&"function"===typeof b.G?b.G():b;b=this.Po;a.Po=za(b)&&"function"===typeof b.G?b.G():b;b=this.Oo;a.Oo=za(b)&&"function"===typeof b.G?b.G():b;return a};te.prototype.cb=function(a){a.classType===te&&(this.change=a)};
    te.prototype.toString=function(){var a="";a=this.change===ve?a+"* ":this.change===ue?a+(null!==this.model?"!m":"!d"):a+((null!==this.model?"!m":"!d")+this.change);this.propertyName&&"string"===typeof this.propertyName&&(a+=" "+this.propertyName);this.modelChange&&this.modelChange!==this.propertyName&&(a+=" "+this.modelChange);a+=": ";this.change===ve?null!==this.oldValue&&(a+=" "+this.oldValue):(null!==this.object&&(a+=Ja(this.object)),null!==this.oldValue&&(a+="  old: "+Ja(this.oldValue)),null!==
    this.oldParam&&(a+=" "+this.oldParam),null!==this.newValue&&(a+="  new: "+Ja(this.newValue)),null!==this.newParam&&(a+=" "+this.newParam));return a};te.prototype.H=function(a){return a?this.oldValue:this.newValue};te.prototype.Iz=function(a){return a?this.oldParam:this.newParam};te.prototype.canUndo=function(){return null!==this.model||null!==this.diagram?!0:!1};
    te.prototype.undo=function(){this.canUndo()&&(null!==this.model?this.model.changeState(this,!0):null!==this.diagram&&this.diagram.changeState(this,!0))};te.prototype.canRedo=function(){return null!==this.model||null!==this.diagram?!0:!1};te.prototype.redo=function(){this.canRedo()&&(null!==this.model?this.model.changeState(this,!1):null!==this.diagram&&this.diagram.changeState(this,!1))};
    ma.Object.defineProperties(te.prototype,{model:{get:function(){return this.ac},set:function(a){this.ac=a}},diagram:{get:function(){return this.B},set:function(a){this.B=a}},change:{get:function(){return this.dn},set:function(a){this.dn=a}},modelChange:{get:function(){return this.es},set:function(a){this.es=a}},propertyName:{get:function(){return this.bf},
        set:function(a){this.bf=a}},isTransactionFinished:{get:function(){return this.dn===ve&&("CommittedTransaction"===this.bf||"FinishedUndo"===this.bf||"FinishedRedo"===this.bf)}},object:{get:function(){return this.Uo},set:function(a){this.Uo=a}},oldValue:{get:function(){return this.Wo},set:function(a){this.Wo=a}},oldParam:{get:function(){return this.Vo},set:function(a){this.Vo=a}},
      newValue:{get:function(){return this.Po},set:function(a){this.Po=a}},newParam:{get:function(){return this.Oo},set:function(a){this.Oo=a}}});te.prototype.redo=te.prototype.redo;te.prototype.canRedo=te.prototype.canRedo;te.prototype.undo=te.prototype.undo;te.prototype.canUndo=te.prototype.canUndo;te.prototype.getParam=te.prototype.Iz;te.prototype.getValue=te.prototype.H;te.prototype.clear=te.prototype.clear;
    var ve=new D(te,"Transaction",-1),ue=new D(te,"Property",0),we=new D(te,"Insert",1),xe=new D(te,"Remove",2);te.className="ChangedEvent";te.Transaction=ve;te.Property=ue;te.Insert=we;te.Remove=xe;function ye(){this.v=(new E).freeze();this.Qa="";this.l=!1}ye.prototype.toString=function(a){var b="Transaction: "+this.name+" "+this.changes.count.toString()+(this.isComplete?"":", incomplete");if(void 0!==a&&0<a){a=this.changes.count;for(var c=0;c<a;c++){var d=this.changes.L(c);null!==d&&(b+="\n  "+d.toString())}}return b};
    ye.prototype.clear=function(){var a=this.changes;a.ea();for(var b=a.count-1;0<=b;b--){var c=a.L(b);null!==c&&c.clear()}a.clear();a.freeze()};ye.prototype.canUndo=function(){return this.isComplete};ye.prototype.undo=function(){if(this.canUndo())for(var a=this.changes.count-1;0<=a;a--){var b=this.changes.L(a);null!==b&&b.undo()}};ye.prototype.canRedo=function(){return this.isComplete};
    ye.prototype.redo=function(){if(this.canRedo())for(var a=this.changes.count,b=0;b<a;b++){var c=this.changes.L(b);null!==c&&c.redo()}};ma.Object.defineProperties(ye.prototype,{changes:{get:function(){return this.v}},name:{get:function(){return this.Qa},set:function(a){this.Qa=a}},isComplete:{get:function(){return this.l},set:function(a){this.l=a}}});ye.prototype.redo=ye.prototype.redo;ye.prototype.canRedo=ye.prototype.canRedo;
    ye.prototype.undo=ye.prototype.undo;ye.prototype.canUndo=ye.prototype.canUndo;ye.prototype.clear=ye.prototype.clear;ye.className="Transaction";function ze(){this.Ju=new F;this.Mc=!1;this.I=(new E).freeze();this.Hd=-1;this.v=999;this.le=!1;this.rr=null;this.Li=0;this.l=!1;this.re=(new E).freeze();this.Al=new E;this.ru=!0;this.Du=this.Bu=this.Au=!1}
    ze.prototype.toString=function(a){var b="UndoManager "+this.historyIndex+"<"+this.history.count+"<="+this.maxHistoryLength;b+="[";for(var c=this.nestedTransactionNames.count,d=0;d<c;d++)0<d&&(b+=" "),b+=this.nestedTransactionNames.L(d);b+="]";if(void 0!==a&&0<a)for(c=this.history.count,d=0;d<c;d++)b+="\n "+this.history.L(d).toString(a-1);return b};
    ze.prototype.clear=function(){var a=this.history;a.ea();for(var b=a.count-1;0<=b;b--){var c=a.L(b);null!==c&&c.clear()}a.clear();this.Hd=-1;a.freeze();this.le=!1;this.rr=null;this.Li=0;this.re.ea();this.re.clear();this.re.freeze();this.Al.clear();this.Bu=this.Au=!1};ze.prototype.copyProperties=function(a){this.isEnabled=a.isEnabled;this.maxHistoryLength=a.maxHistoryLength;this.checksTransactionLevel=a.checksTransactionLevel};t=ze.prototype;t.wx=function(a){this.Ju.add(a)};t.gy=function(a){this.Ju.remove(a)};
    t.ua=function(a){void 0===a&&(a="");null===a&&(a="");if(this.isUndoingRedoing)return!1;!0===this.ru&&(this.ru=!1,this.Li++,this.xb("StartingFirstTransaction",a,this.currentTransaction),0<this.Li&&this.Li--);this.isEnabled&&(this.re.ea(),this.re.add(a),this.re.freeze(),null===this.currentTransaction?this.Al.add(0):this.Al.add(this.currentTransaction.changes.count));this.Li++;var b=1===this.transactionLevel;b&&this.xb("StartedTransaction",a,this.currentTransaction);return b};
    t.Ua=function(a){void 0===a&&(a="");return Ae(this,!0,a)};t.Bf=function(){return Ae(this,!1,"")};
    function Ae(a,b,c){if(a.isUndoingRedoing)return!1;a.checksTransactionLevel&&1>a.transactionLevel&&wa("Ending transaction without having started a transaction: "+c);var d=1===a.transactionLevel,e=a.currentTransaction;d&&b&&a.xb("CommittingTransaction",c,e);var f=0;if(0<a.transactionLevel&&(a.Li--,a.isEnabled)){var g=a.re.count;0<g&&(""===c&&(c=a.re.L(0)),a.re.ea(),a.re.lb(g-1),a.re.freeze());g=a.Al.count;0<g&&(f=a.Al.L(g-1),a.Al.lb(g-1))}if(d){if(b){a.Du=!1;if(a.isEnabled&&null!==e){e.isComplete=!0;
      e.name=c;b=a.history;b.ea();for(d=b.count-1;d>a.historyIndex;d--)f=b.L(d),null!==f&&f.clear(),b.lb(d),a.Du=!0;d=a.maxHistoryLength;0<=d&&(0===d?b.clear():b.count>=d&&(f=b.L(0),null!==f&&f.clear(),b.lb(0),a.Hd--));0!==d&&(b.add(e),a.Hd++);b.freeze()}a.xb("CommittedTransaction",c,e)}else{a.le=!0;try{a.isEnabled&&null!==e&&(e.isComplete=!0,e.undo())}finally{a.xb("RolledBackTransaction",c,e),a.le=!1}null!==e&&e.clear()}a.rr=null;a.isPendingClear&&a.clear();a.isPendingClear=!1;a.isPendingUnmodified=!1;
      return!0}if(a.isEnabled&&!b&&null!==e){a=f;c=e.changes;for(e=c.count-1;e>=a;e--)b=c.L(e),null!==b&&b.undo(),c.ea(),c.lb(e);c.freeze()}return!1}ze.prototype.canUndo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToUndo;return null!==a&&a.canUndo()?!0:!1};
    ze.prototype.undo=function(){if(this.canUndo()){var a=this.transactionToUndo;try{this.le=!0,this.xb("StartingUndo","Undo",a),this.Hd--,a.undo()}catch(b){wa("undo error: "+b.toString())}finally{this.xb("FinishedUndo","Undo",a),this.le=!1}}};ze.prototype.canRedo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToRedo;return null!==a&&a.canRedo()?!0:!1};
    ze.prototype.redo=function(){if(this.canRedo()){var a=this.transactionToRedo;try{this.le=!0,this.xb("StartingRedo","Redo",a),this.Hd++,a.redo()}catch(b){wa("redo error: "+b.toString())}finally{this.xb("FinishedRedo","Redo",a),this.le=!1}}};ze.prototype.xb=function(a,b,c){void 0===c&&(c=null);var d=new te;d.change=ve;d.propertyName=a;d.object=c;d.oldValue=b;for(a=this.models;a.next();)b=a.value,d.model=b,b.ct(d)};
    ze.prototype.Fv=function(a){if(this.isEnabled&&!this.isUndoingRedoing&&!this.skipsEvent(a)){var b=this.currentTransaction;null===b&&(this.rr=b=new ye);var c=a.copy();b=b.changes;b.ea();b.add(c);b.freeze();this.checksTransactionLevel&&0>=this.transactionLevel&&!this.ru&&(a=a.diagram,null!==a&&!1===a.kk||wa("Change not within a transaction: "+c.toString()))}};
    ze.prototype.skipsEvent=function(a){if(null===a||0>a.change.value)return!0;a=a.object;if(null===a)return!1;if(void 0!==a.layer){if(a=a.layer,null!==a&&a.isTemporary)return!0}else if(a.isTemporary)return!0;return!1};
    ma.Object.defineProperties(ze.prototype,{models:{get:function(){return this.Ju.iterator}},isEnabled:{get:function(){return this.Mc},set:function(a){this.Mc=a}},transactionToUndo:{get:function(){return 0<=this.historyIndex&&this.historyIndex<=this.history.count-1?this.history.L(this.historyIndex):null}},transactionToRedo:{get:function(){return this.historyIndex<this.history.count-
        1?this.history.L(this.historyIndex+1):null}},isUndoingRedoing:{get:function(){return this.le}},history:{get:function(){return this.I}},maxHistoryLength:{get:function(){return this.v},set:function(a){this.v=a}},historyIndex:{get:function(){return this.Hd}},currentTransaction:{get:function(){return this.rr}},transactionLevel:{
        get:function(){return this.Li}},isInTransaction:{get:function(){return 0<this.Li}},checksTransactionLevel:{get:function(){return this.l},set:function(a){this.l=a}},nestedTransactionNames:{get:function(){return this.re}},isPendingClear:{get:function(){return this.Au},set:function(a){this.Au=a}},isPendingUnmodified:{get:function(){return this.Bu},set:function(a){this.Bu=
          a}}});ze.prototype.handleChanged=ze.prototype.Fv;ze.prototype.redo=ze.prototype.redo;ze.prototype.undo=ze.prototype.undo;ze.prototype.canUndo=ze.prototype.canUndo;ze.prototype.rollbackTransaction=ze.prototype.Bf;ze.prototype.commitTransaction=ze.prototype.Ua;ze.prototype.startTransaction=ze.prototype.ua;ze.prototype.removeModel=ze.prototype.gy;ze.prototype.addModel=ze.prototype.wx;ze.prototype.clear=ze.prototype.clear;ze.className="UndoManager";
    function Be(){Ya(this);this.B=Ce;this.Qa="";this.Mc=!0;this.kd=!1;this.Iw=null;this.Gy=new qe;this.$s=-1}Be.prototype.toString=function(){return""!==this.name?this.name+" Tool":Ia(this.constructor)};Be.prototype.updateAdornments=function(){};Be.prototype.canStart=function(){return this.isEnabled};Be.prototype.doStart=function(){};Be.prototype.doActivate=function(){this.isActive=!0};Be.prototype.doDeactivate=function(){this.isActive=!1};Be.prototype.doStop=function(){};
    Be.prototype.doCancel=function(){this.transactionResult=null;this.stopTool()};Be.prototype.stopTool=function(){var a=this.diagram;a.currentTool===this&&(a.currentTool=null,a.currentCursor="")};Be.prototype.doMouseDown=function(){!this.isActive&&this.canStart()&&this.doActivate()};Be.prototype.doMouseMove=function(){};Be.prototype.doMouseUp=function(){this.stopTool()};Be.prototype.doMouseWheel=function(){};Be.prototype.canStartMultiTouch=function(){return!0};
    Be.prototype.standardPinchZoomStart=function(){var a=this.diagram,b=a.lastInput,c=b.oq(0,I.allocAt(NaN,NaN)),d=b.oq(1,I.allocAt(NaN,NaN));if(c.u()&&d.u()&&(this.doCancel(),a.mm("hasGestureZoom"))){a.Cl=a.scale;var e=d.x-c.x,f=d.y-c.y;a.Vu=Math.sqrt(e*e+f*f);b.bubbles=!1}I.free(c);I.free(d)};
    Be.prototype.standardPinchZoomMove=function(){var a=this.diagram,b=a.lastInput,c=b.oq(0,I.allocAt(NaN,NaN)),d=b.oq(1,I.allocAt(NaN,NaN));if(c.u()&&d.u()&&(this.doCancel(),a.mm("hasGestureZoom"))){var e=d.x-c.x,f=d.y-c.y;f=Math.sqrt(e*e+f*f)/a.Vu;e=new I((Math.min(d.x,c.x)+Math.max(d.x,c.x))/2,(Math.min(d.y,c.y)+Math.max(d.y,c.y))/2);f*=a.Cl;var g=a.commandHandler;if(f!==a.scale&&g.canResetZoom(f)){var h=a.zoomPoint;a.zoomPoint=e;g.resetZoom(f);a.zoomPoint=h}b.bubbles=!1}I.free(c);I.free(d)};
    Be.prototype.doKeyDown=function(){"Esc"===this.diagram.lastInput.key&&this.doCancel()};Be.prototype.doKeyUp=function(){};Be.prototype.ua=function(a){void 0===a&&(a=this.name);this.transactionResult=null;return this.diagram.ua(a)};Be.prototype.Fg=function(){var a=this.diagram;return null===this.transactionResult?a.Bf():a.Ua(this.transactionResult)};
    Be.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.lastInput,c=a.jm(b.documentPoint,!1);if(null!==c)if(Wa?b.meta:b.control){a.R("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!b.isSelected);a.R("ChangedSelection",a.selection)}else if(b.shift){if(!c.isSelected){a.R("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!0);a.R("ChangedSelection",
      a.selection)}}else{if(!c.isSelected){for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&a.select(b)}}else!b.left||(Wa?b.meta:b.control)||b.shift||a.clearSelection()}};Be.prototype.standardMouseClick=function(a,b){void 0===a&&(a=null);void 0===b&&(b=function(a){return!a.layer.isTemporary});var c=this.diagram,d=c.lastInput;a=c.Ub(d.documentPoint,a,b);d.targetObject=a;De(a,d,c);return d.handled};
    function De(a,b,c){b.handled=!1;if(null===a||a.Cg()){var d=0;b.left?d=1===b.clickCount?1:2===b.clickCount?2:1:b.right&&1===b.clickCount&&(d=3);var e="ObjectSingleClicked";if(null!==a){switch(d){case 1:e="ObjectSingleClicked";break;case 2:e="ObjectDoubleClicked";break;case 3:e="ObjectContextClicked"}0!==d&&c.R(e,a)}else{switch(d){case 1:e="BackgroundSingleClicked";break;case 2:e="BackgroundDoubleClicked";break;case 3:e="BackgroundContextClicked"}0!==d&&c.R(e)}if(null!==a)for(;null!==a;){c=null;switch(d){case 1:c=
      a.click;break;case 2:c=a.doubleClick?a.doubleClick:a.click;break;case 3:c=a.contextClick}if(null!==c&&(c(b,a),b.handled))break;a=a.panel}else{a=null;switch(d){case 1:a=c.click;break;case 2:a=c.doubleClick?c.doubleClick:c.click;break;case 3:a=c.contextClick}null!==a&&a(b)}}}
    Be.prototype.standardMouseOver=function(){var a=this.diagram,b=a.lastInput;if(!0!==a.animationManager.qc){var c=a.skipsUndoManager;a.skipsUndoManager=!0;var d=a.viewportBounds.aa(b.documentPoint)?a.Ub(b.documentPoint,null,null):null;b.targetObject=d;var e=!1;if(d!==a.mj){var f=a.mj,g=f;a.mj=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.Bg(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.Bg(d))break;g(b,d,f);e=!0;if(b.handled)break}d=d.panel}d=a.mj}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.Pb();a.skipsUndoManager=c}};Be.prototype.doCurrentObjectChanged=function(){};
    Be.prototype.standardMouseWheel=function(){var a=this.diagram,b=a.lastInput,c=b.delta;if(0!==c&&a.documentBounds.u()){var d=a.commandHandler,e=a.toolManager.mouseWheelBehavior;if(null!==d&&(e===Ee&&!b.shift||e===Fe&&b.control)){if(0<c?d.canIncreaseZoom():d.canDecreaseZoom())e=a.zoomPoint,a.zoomPoint=b.viewPoint,0<c?d.increaseZoom():d.decreaseZoom(),a.zoomPoint=e;b.bubbles=!1}else if(e===Ee&&b.shift||e===Fe&&!b.control){d=a.position.copy();var f=0<c?c:-c,g=b.event,h=g.deltaMode;e=g.deltaX;g=g.deltaY;
      if(Ta||Ua||Va)h=1,0<e&&(e=3),0>e&&(e=-3),0<g&&(g=3),0>g&&(g=-3);if(void 0===h||void 0===e||void 0===g||0===e&&0===g||b.shift)!b.shift&&a.allowVerticalScroll?(f=3*f*a.scrollVerticalLineChange,0<c?a.scroll("pixel","up",f):a.scroll("pixel","down",f)):b.shift&&a.allowHorizontalScroll&&(f=3*f*a.scrollHorizontalLineChange,0<c?a.scroll("pixel","left",f):a.scroll("pixel","right",f));else{switch(h){case 0:c="pixel";break;case 1:c="line";break;case 2:c="page";break;default:c="pixel"}0!==e&&a.allowHorizontalScroll&&
      (e*=a.scrollHorizontalLineChange/16,0<e?a.scroll(c,"left",-e):a.scroll(c,"right",e));0!==g&&a.allowVerticalScroll&&(g*=a.scrollVerticalLineChange/16,0<g?a.scroll(c,"up",-g):a.scroll(c,"down",g))}a.position.w(d)||(b.bubbles=!1)}}};Be.prototype.standardWaitAfter=function(a,b){void 0===b&&(b=this.diagram.lastInput);this.cancelWaitAfter();var c=this,d=b.clone(this.Gy);this.$s=sa(function(){c.doWaitAfter(d)},a)};Be.prototype.cancelWaitAfter=function(){-1!==this.$s&&x.clearTimeout(this.$s);this.$s=-1};
    Be.prototype.doWaitAfter=function(){};Be.prototype.findToolHandleAt=function(a,b){a=this.diagram.Ub(a,function(a){for(;null!==a&&!(a.panel instanceof Ke);)a=a.panel;return a});return null===a?null:a.part.category===b?a:null};Be.prototype.isBeyondDragSize=function(a,b){var c=this.diagram;void 0===a&&(a=c.firstInput.viewPoint);void 0===b&&(b=c.lastInput.viewPoint);var d=c.toolManager.dragSize,e=d.width;d=d.height;c.firstInput.isTouchEvent&&(e+=6,d+=6);return Math.abs(b.x-a.x)>e||Math.abs(b.y-a.y)>d};
    ma.Object.defineProperties(Be.prototype,{diagram:{get:function(){return this.B},set:function(a){a instanceof R&&(this.B=a)}},name:{get:function(){return this.Qa},set:function(a){this.Qa=a}},isEnabled:{get:function(){return this.Mc},set:function(a){this.Mc=a}},isActive:{get:function(){return this.kd},set:function(a){this.kd=a}},transactionResult:{get:function(){return this.Iw},
        set:function(a){this.Iw=a}}});Be.prototype.stopTransaction=Be.prototype.Fg;Be.prototype.startTransaction=Be.prototype.ua;Be.className="Tool";function Oa(){Be.call(this);this.name="ToolManager";this.Ic=new E;this.Yc=new E;this.Ef=new E;this.Y=this.Ha=850;this.v=(new M(2,2)).ca();this.Za=5E3;this.Ia=Fe;this.I=Le;this.qr=this.l=null;this.Qj=-1}la(Oa,Be);Oa.prototype.initializeStandardTools=function(){};
    Oa.prototype.updateAdornments=function(a){var b=this.currentToolTip;if(b instanceof Ke&&this.qr===a){var c=b.adornedObject;(null!==a?c.part===a:null===c)?this.showToolTip(b,c):this.hideToolTip()}};
    Oa.prototype.doMouseDown=function(){var a=this.diagram,b=a.lastInput;b.isTouchEvent&&this.gestureBehavior===Me&&(b.bubbles=!1);if(b.isMultiTouch){this.cancelWaitAfter();if(this.gestureBehavior===Ne){b.bubbles=!0;return}if(this.gestureBehavior===Me)return;if(a.currentTool.canStartMultiTouch()){a.currentTool.standardPinchZoomStart();return}}for(var c=this.mouseDownTools.length,d=0;d<c;d++){var e=this.mouseDownTools.L(d);e.diagram=this.diagram;if(e.canStart()){a.doFocus();a.currentTool=e;a.currentTool===
    e&&(e.isActive||e.doActivate(),e.doMouseDown());return}}1===a.lastInput.button&&(this.mouseWheelBehavior===Fe?this.mouseWheelBehavior=Ee:this.mouseWheelBehavior===Ee&&(this.mouseWheelBehavior=Fe));this.doActivate();this.standardWaitAfter(this.holdDelay,b)};
    Oa.prototype.doMouseMove=function(){var a=this.diagram,b=a.lastInput;if(b.isMultiTouch){if(this.gestureBehavior===Ne){b.bubbles=!0;return}if(this.gestureBehavior===Me)return;if(a.currentTool.canStartMultiTouch()){a.currentTool.standardPinchZoomMove();return}}if(this.isActive)for(var c=this.mouseMoveTools.length,d=0;d<c;d++){var e=this.mouseMoveTools.L(d);e.diagram=this.diagram;if(e.canStart()){a.doFocus();a.currentTool=e;a.currentTool===e&&(e.isActive||e.doActivate(),e.doMouseMove());return}}Oe(this,
      a);a=b.event;null===a||"mousemove"!==a.type&&"pointermove"!==a.type&&a.cancelable||(b.bubbles=!0)};function Oe(a,b){a.standardMouseOver();a.isBeyondDragSize()&&a.standardWaitAfter(a.isActive?a.holdDelay:a.hoverDelay,b.lastInput)}Oa.prototype.doCurrentObjectChanged=function(a,b){a=this.currentToolTip;null===a||null!==b&&a instanceof Ke&&(b===a||b.Bg(a))||this.hideToolTip()};
    Oa.prototype.doWaitAfter=function(a){var b=this.diagram;b.sa&&(this.doMouseHover(),this.isActive||this.doToolTip(),a.isTouchEvent&&!b.lastInput.handled&&(a=a.copy(),a.button=2,a.buttons=2,b.lastInput=a,b.Pj=!0,b.doMouseUp()))};
    Oa.prototype.doMouseHover=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.Ub(b.documentPoint,null,null));var c=b.targetObject;if(null!==c)for(b.handled=!1;null!==c;){a=this.isActive?c.mouseHold:c.mouseHover;if(null!==a&&(a(b,c),b.handled))break;c=c.panel}else c=this.isActive?a.mouseHold:a.mouseHover,null!==c&&c(b)};
    Oa.prototype.doToolTip=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.Ub(b.documentPoint,null,null));b=b.targetObject;if(null!==b){if(a=this.currentToolTip,!(a instanceof Ke)||b!==a&&!b.Bg(a)){for(;null!==b;){a=b.toolTip;if(null!==a){this.showToolTip(a,b);return}b=b.panel}this.hideToolTip()}}else b=a.toolTip,null!==b?this.showToolTip(b,null):this.hideToolTip()};
    Oa.prototype.showToolTip=function(a,b){var c=this.diagram;a!==this.currentToolTip&&this.hideToolTip();if(a instanceof Ke){a.layerName="Tool";a.selectable=!1;a.scale=1/c.scale;a.category="ToolTip";null!==a.placeholder&&(a.placeholder.scale=c.scale);var d=a.diagram;null!==d&&d!==c&&d.remove(a);c.add(a);null!==b?a.adornedObject=b:a.data=c.model;a.yb();this.positionToolTip(a,b)}else a instanceof Pe&&a!==this.currentToolTip&&a.show(b,c,this);this.currentToolTip=a;-1!==this.Qj&&(x.clearTimeout(this.Qj),
      this.Qj=-1);a=this.toolTipDuration;if(0<a&&Infinity!==a){var e=this;this.Qj=sa(function(){e.hideToolTip()},a)}};Oa.prototype.positionToolTip=function(a){if(null===a.placeholder){var b=this.diagram,c=b.lastInput.documentPoint.copy(),d=a.measuredBounds,e=b.viewportBounds;b.lastInput.isTouchEvent&&(c.x-=d.width);c.x+d.width>e.right&&(c.x-=d.width+5/b.scale);c.x<e.x&&(c.x=e.x);c.y=c.y+20/b.scale+d.height>e.bottom?c.y-(d.height+5/b.scale):c.y+20/b.scale;c.y<e.y&&(c.y=e.y);a.position=c}};
    Oa.prototype.hideToolTip=function(){-1!==this.Qj&&(x.clearTimeout(this.Qj),this.Qj=-1);var a=this.diagram,b=this.currentToolTip;null!==b&&(b instanceof Ke?(a.remove(b),null!==this.qr&&this.qr.Af(b.category),b.data=null,b.adornedObject=null):b instanceof Pe&&null!==b.hide&&b.hide(a,this),this.currentToolTip=null)};
    Oa.prototype.doMouseUp=function(){this.cancelWaitAfter();var a=this.diagram;if(this.isActive)for(var b=this.mouseUpTools.length,c=0;c<b;c++){var d=this.mouseUpTools.L(c);d.diagram=this.diagram;if(d.canStart()){a.doFocus();a.currentTool=d;a.currentTool===d&&(d.isActive||d.doActivate(),d.doMouseUp());return}}a.doFocus();this.doDeactivate()};Oa.prototype.doMouseWheel=function(){this.standardMouseWheel()};Oa.prototype.doKeyDown=function(){var a=this.diagram;null!==a.commandHandler&&a.commandHandler.doKeyDown()};
    Oa.prototype.doKeyUp=function(){var a=this.diagram;null!==a.commandHandler&&a.commandHandler.doKeyUp()};Oa.prototype.findTool=function(a){for(var b=this.mouseDownTools.length,c=0;c<b;c++){var d=this.mouseDownTools.L(c);if(d.name===a)return d}b=this.mouseMoveTools.length;for(c=0;c<b;c++)if(d=this.mouseMoveTools.L(c),d.name===a)return d;b=this.mouseUpTools.length;for(c=0;c<b;c++)if(d=this.mouseUpTools.L(c),d.name===a)return d;return null};
    Oa.prototype.replaceTool=function(a,b){null!==b&&(b.diagram=this.diagram);for(var c=this.mouseDownTools.length,d=0;d<c;d++){var e=this.mouseDownTools.L(d);if(e.name===a)return null!==b?this.mouseDownTools.hd(d,b):this.mouseDownTools.lb(d),e}c=this.mouseMoveTools.length;for(d=0;d<c;d++)if(e=this.mouseMoveTools.L(d),e.name===a)return null!==b?this.mouseMoveTools.hd(d,b):this.mouseMoveTools.lb(d),e;c=this.mouseUpTools.length;for(d=0;d<c;d++)if(e=this.mouseUpTools.L(d),e.name===a)return null!==b?this.mouseUpTools.hd(d,
      b):this.mouseUpTools.lb(d),e;return null};Oa.prototype.Va=function(a,b,c){null!==b&&(b.name=a,b.diagram=this.diagram);this.findTool(a)?this.replaceTool(a,b):null!==b&&c.add(b)};
    ma.Object.defineProperties(Oa.prototype,{mouseWheelBehavior:{get:function(){return this.Ia},set:function(a){this.Ia=a}},gestureBehavior:{get:function(){return this.I},set:function(a){this.I=a}},currentToolTip:{get:function(){return this.l},set:function(a){this.l=a;this.qr=null!==a&&a instanceof Ke?a.adornedPart:null}},mouseDownTools:{get:function(){return this.Ic}},mouseMoveTools:{
        get:function(){return this.Yc}},mouseUpTools:{get:function(){return this.Ef}},hoverDelay:{get:function(){return this.Ha},set:function(a){this.Ha=a}},holdDelay:{get:function(){return this.Y},set:function(a){this.Y=a}},dragSize:{get:function(){return this.v},set:function(a){this.v=a.G()}},toolTipDuration:{get:function(){return this.Za},set:function(a){this.Za=
          a}}});Oa.prototype.replaceStandardTool=Oa.prototype.Va;var Fe=new D(Oa,"WheelScroll",0),Ee=new D(Oa,"WheelZoom",1),Qe=new D(Oa,"WheelNone",2),Le=new D(Oa,"GestureZoom",3),Me=new D(Oa,"GestureCancel",4),Ne=new D(Oa,"GestureNone",5);Oa.className="ToolManager";Oa.WheelScroll=Fe;Oa.WheelZoom=Ee;Oa.WheelNone=Qe;Oa.GestureZoom=Le;Oa.GestureCancel=Me;Oa.GestureNone=Ne;
    function Re(){Be.call(this);this.name="Dragging";this.I=this.Yc=!0;this.v=this.Za=this.Ha=this.mg=null;this.Bn=this.Ef=!1;this.Ql=new I(NaN,NaN);this.Os=new I;this.Ic=!0;this.Vk=100;this.Rg=[];this.Sq=(new F).freeze();this.Ia=new Se;this.ko=null;this.Y="copy";this.Mh="";this.Je="no-drop"}la(Re,Be);
    Re.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(a.isReadOnly&&!a.allowDragOut||!a.allowMove&&!a.allowCopy&&!a.allowDragOut||!a.allowSelect)return!1;var b=a.lastInput;return!b.left||a.currentTool!==this&&(!this.isBeyondDragSize()||b.isTouchEvent&&b.timestamp-a.firstInput.timestamp<this.Vk)?!1:null!==this.findDraggablePart()};
    Re.prototype.findDraggablePart=function(){var a=this.diagram;a=a.jm(a.firstInput.documentPoint,!1);if(null===a)return null;for(;null!==a&&!a.canSelect();)a=a.containingGroup;return null!==a&&(a.canMove()||a.canCopy())?a:null};
    Re.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.jm(a.firstInput.documentPoint,!1);if(null!==b){for(;null!==b&&!b.canSelect();)b=b.containingGroup;this.currentPart=b;null===this.currentPart||this.currentPart.isSelected||(a.R("ChangingSelection",a.selection),b=a.lastInput,(Wa?b.meta:b.control)||b.shift||a.clearSelection(!0),this.currentPart.isSelected=!0,a.R("ChangedSelection",a.selection))}}};
    Re.prototype.doActivate=function(){var a=this.diagram;this.ko=null;null===this.currentPart&&this.standardMouseSelect();var b=this.currentPart;null!==b&&(b.canMove()||b.canCopy())&&(Te=null,this.isActive=!0,this.Ql.set(a.position),Ue(this,a.selection),this.Rg.length=0,this.draggedParts=this.computeEffectiveCollection(a.selection,this.dragOptions),a.Qt=!0,!0===a.Ce("temporaryPixelRatio")&&30<a.zx&&Ve(a),We(a,this.draggedParts),this.ua("Drag"),this.startPoint=a.firstInput.documentPoint,a.isMouseCaptured=
      !0,a.allowDragOut&&(this.isDragOutStarted=!0,this.Bn=!1,Te=this,Xe=this.diagram,this.doSimulatedDragOut()))};function Ue(a,b){if(a.dragsLink){var c=a.diagram;c.allowRelink&&(c.model.ik()&&1===b.count&&b.first()instanceof S?(a.draggedLink=b.first(),a.draggedLink.canRelinkFrom()&&a.draggedLink.canRelinkTo()&&a.draggedLink.Yj(),a.mg=c.toolManager.findTool("Relinking"),null===a.mg&&(a.mg=new bf,a.mg.diagram=c)):(a.draggedLink=null,a.mg=null))}}
    Re.prototype.computeEffectiveCollection=function(a,b){return this.diagram.commandHandler.computeEffectiveCollection(a,b)};Re.prototype.td=function(a){return void 0===a?new cf(Gb):this.isGridSnapEnabled?new cf(new I(Math.round(a.x),Math.round(a.y))):new cf(a.copy())};
    Re.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.Cf();df(this);ef(a,this.draggedParts);this.draggedParts=this.currentPart=this.ko=null;this.Bn=this.isDragOutStarted=!1;if(0<ff.count){for(var b=ff,c=b.length,d=0;d<c;d++){var e=b.L(d);gf(e);hf(e);df(e);e.diagram.Cf()}b.clear()}gf(this);this.Ql.h(NaN,NaN);Te=Xe=null;hf(this);a.isMouseCaptured=!1;a.currentCursor="";a.Qt=!1;this.Fg();jf(a,!0)};
    function df(a){var b=a.diagram,c=b.skipsUndoManager;b.skipsUndoManager=!0;kf(a,b.lastInput,null);b.skipsUndoManager=c;a.Rg.length=0}function lf(){var a=Te;hf(a);mf(a);var b=a.diagram;a.Ql.u()&&(b.position=a.Ql);b.Cf()}Re.prototype.doCancel=function(){hf(this);mf(this);var a=this.diagram;this.Ql.u()&&(a.position=this.Ql);this.stopTool()};Re.prototype.doKeyDown=function(){this.isActive&&("Esc"===this.diagram.lastInput.key?this.doCancel():this.doMouseMove())};
    Re.prototype.doKeyUp=function(){this.isActive&&this.doMouseMove()};function nf(a,b){var c=Infinity,d=Infinity,e=-Infinity,f=-Infinity;for(a=a.iterator;a.next();){var g=a.value;if(g.Wb()&&g.isVisible()){var h=g.location;g=h.x;h=h.y;isNaN(g)||isNaN(h)||(g<c&&(c=g),h<d&&(d=h),g>e&&(e=g),h>f&&(f=h))}}Infinity===c?b.h(0,0,0,0):b.h(c,d,e-c,f-d)}
    function of(a,b){if(null===a.copiedParts){var c=a.diagram;if((!b||!c.isReadOnly&&!c.isModelReadOnly)&&null!==a.draggedParts){var d=c.undoManager;d.isEnabled&&d.isInTransaction?null!==d.currentTransaction&&0<d.currentTransaction.changes.count&&(c.undoManager.Bf(),c.ua("Drag")):mf(a);c.skipsUndoManager=!b;c.partManager.addsToTemporaryLayer=!b;a.startPoint=c.firstInput.documentPoint;b=a.copiesEffectiveCollection?a.draggedParts.Df():c.selection;c=c.ck(b,c,!0);for(b=c.iterator;b.next();)b.value.location=
      b.key.location;b=N.alloc();nf(c,b);N.free(b);b=new G;for(d=a.draggedParts.iterator;d.next();){var e=d.key;e.Wb()&&e.canCopy()&&(e=c.H(e),null!==e&&(e.yb(),b.add(e,a.td(e.location))))}for(c=c.iterator;c.next();)d=c.value,d instanceof S&&d.canCopy()&&b.add(d,a.td());a.copiedParts=b;Ue(a,b.Df());null!==a.draggedLink&&(c=a.draggedLink,b=c.routeBounds,pf(c,a.startPoint.x-(b.x+b.width/2),a.startPoint.y-(b.y+b.height/2)))}}}
    function hf(a){var b=a.diagram;if(null!==a.copiedParts&&(b.Kt(a.copiedParts.Df(),!1),a.copiedParts=null,null!==a.draggedParts))for(var c=a.draggedParts.iterator;c.next();)c.key instanceof S&&(c.value.point=new I(0,0));b.skipsUndoManager=!1;b.partManager.addsToTemporaryLayer=!1;a.startPoint=b.firstInput.documentPoint}
    function gf(a){if(null!==a.draggedLink){if(a.dragsLink&&null!==a.mg){var b=a.mg;b.diagram.remove(b.temporaryFromNode);b.diagram.remove(b.temporaryToNode)}a.draggedLink=null;a.mg=null}}function qf(a,b,c){var d=a.diagram,e=a.startPoint,f=I.alloc();f.assign(d.lastInput.documentPoint);a.moveParts(b,f.$d(e),c);I.free(f);!0===d.Ce("temporaryPixelRatio")&&null===d.sh&&30<d.zx&&(Ve(d),d.It())}Re.prototype.moveParts=function(a,b,c){var d=this.diagram;null!==d&&rf(d,a,b,this.dragOptions,c)};
    function mf(a){if(null!==a.draggedParts){for(var b=a.diagram,c=a.draggedParts.iterator;c.next();){var d=c.key;d.Wb()&&(d.location=c.value.point)}for(c=a.draggedParts.iterator;c.next();)if(d=c.key,d instanceof S&&d.suspendsRouting){var e=c.value.point;a.draggedParts.add(d,a.td());pf(d,-e.x,-e.y)}b.Wc()}}
    function sf(a,b){var c=a.diagram;a.dragsLink&&(null!==a.draggedLink&&(a.draggedLink.fromNode=null,a.draggedLink.toNode=null),tf(a,!1));var d=a.findDragOverObject(b),e=c.lastInput;e.targetObject=d;a.doUpdateCursor(d);var f=c.skipsUndoManager,g=!1;try{c.skipsUndoManager=!0;g=kf(a,e,d);if(!a.isActive&&null===Te)return;var h=null!==d?d.part:null;if(null===h||c.handlesDragDropForTopLevelParts&&h.isTopLevel&&!(h instanceof T)){var k=c.mouseDragOver;null!==k&&(k(e),g=!0)}if(!a.isActive&&null===Te)return;
      a.doDragOver(b,d);if(!a.isActive&&null===Te)return}finally{c.skipsUndoManager=f,g&&c.Wc()}a.ko=d;c.isReadOnly||!c.allowMove&&!c.allowCopy||!c.allowHorizontalScroll&&!c.allowVerticalScroll||c.ht(e.viewPoint)}Re.prototype.findDragOverObject=function(a){var b=this;return uf(this.diagram,a,null,function(a){null===a?a=!0:(a=a.part,a=null===a||a instanceof Ke||a.layer.isTemporary||b.draggedParts&&b.draggedParts.contains(a)||b.copiedParts&&b.copiedParts.contains(a)?!0:!1);return!a})};
    Re.prototype.doUpdateCursor=function(a){var b=this.diagram;this.ko!==a&&(!this.diagram.currentTool.isActive||this.mayCopy()?b.currentCursor=this.copyCursor:this.mayMove()?b.currentCursor=this.moveCursor:this.mayDragOut()&&(b.currentCursor=this.nodropCursor))};
    function kf(a,b,c){var d=!1,e=a.Rg.length,f=0<e?a.Rg[0]:null;if(c===f)return!1;b.handled=!1;for(var g=0;g<e;g++){var h=a.Rg[g],k=h.mouseDragLeave;if(null!==k&&(k(b,h,c),d=!0,b.handled))break}a.Rg.length=0;if(!a.isActive&&null===Te||null===c)return d;b.handled=!1;for(e=c;null!==e;)a.Rg.push(e),e=vf(e);e=a.Rg.length;for(c=0;c<e&&(g=a.Rg[c],h=g.mouseDragEnter,null===h||(h(b,g,f),d=!0,!b.handled));c++);return d}
    function vf(a){var b=a.panel;return null!==b?b:a instanceof U&&!(a instanceof T)&&(a=a.containingGroup,null!==a&&a.handlesDragDropForMembers)?a:null}function wf(a,b,c){var d=a.mg;if(null===d)return null;var e=a.diagram.yg(b,d.portGravity,function(a){return d.findValidLinkablePort(a,c)});a=I.alloc();var f=Infinity,g=null;for(e=e.iterator;e.next();){var h=e.value;if(null!==h.part){var k=h.ga(Ac,a);k=b.Be(k);k<f&&(g=h,f=k)}}I.free(a);return g}
    function tf(a,b){var c=a.draggedLink;if(null!==c&&!(2>c.pointsCount)){var d=a.diagram;if(!d.isReadOnly){var e=a.mg;if(null!==e){var f=null,g=null;null===c.fromNode&&(f=wf(a,c.i(0),!1),null!==f&&(g=f.part));var h=null,k=null;null===c.toNode&&(h=wf(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.Zx&&d.R("LinkRelinked",c,d.Zx),c.toPort!==d.$x&&d.R("LinkRelinked",c,d.$x)):xf(e,g,f,k,h):xf(e,null,null,null,null)}}}}Re.prototype.doDragOver=function(){};
    function Df(a,b){var c=a.diagram;a.dragsLink&&tf(a,!0);df(a);var d=a.findDragOverObject(b),e=c.lastInput;e.targetObject=d;if(null!==d){e.handled=!1;for(var f=d;null!==f;){var g=f.mouseDrop;if(null!==g&&(g(e,f),e.handled))break;Ef(a,e,f);f=vf(f)}}else f=c.mouseDrop,null!==f&&f(e);if(a.isActive||null!==Te){for(e=(a.copiedParts||a.draggedParts).iterator;e.next();)f=e.key,f instanceof W&&f.linksConnected.each(function(a){a.suspendsRouting=!1});a.doDropOnto(b,d);if(a.isActive||null!==Te){a=N.alloc();for(b=
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              c.selection.iterator;b.next();)d=b.value,d instanceof W&&Ff(c,d,a);N.free(a)}}}function Ef(a,b,c){a=a.diagram;c=c.part;!a.handlesDragDropForTopLevelParts||!c.isTopLevel||c instanceof T||(c=a.mouseDrop,null!==c&&c(b))}function Ff(a,b,c){var d=!1;b.getAvoidableRect(c);a.viewportBounds.Ae(c)&&(d=!0);a=a.xv(c,function(a){return a.part},function(a){return a instanceof S},!0,function(a){return a instanceof S},d);if(0!==a.count)for(a=a.iterator;a.next();)c=a.value,!c.Xd(b)&&c.isAvoiding&&c.Ta()}
    Re.prototype.doDropOnto=function(){};Re.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram,b=a.lastInput;this.simulatedMouseMove(b.event,b.documentPoint,b.targetDiagram)||null===this.currentPart||null===this.draggedParts||(this.mayCopy()?(of(this,!1),We(a,this.copiedParts),qf(this,this.copiedParts,!1),ef(a,this.copiedParts)):this.mayMove()?(hf(this),qf(this,this.draggedParts,!0)):this.mayDragOut()?(of(this,!1),qf(this,this.copiedParts,!1)):hf(this),sf(this,a.lastInput.documentPoint))}};
    Re.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram,b=a.lastInput;if(!this.simulatedMouseUp(b.event,b.documentPoint,b.targetDiagram)){b=!1;var c=this.mayCopy();c&&null!==this.copiedParts?(hf(this),of(this,!0),We(a,this.copiedParts),qf(this,this.copiedParts,!1),ef(a,this.copiedParts),null!==this.copiedParts&&(a.R("ChangingSelection",a.selection),a.clearSelection(!0),this.copiedParts.iteratorKeys.each(function(a){a.isSelected=!0}))):(b=!0,hf(this),this.mayMove()&&(qf(this,this.draggedParts,
      !0),sf(this,a.lastInput.documentPoint)));this.Bn=!0;Df(this,a.lastInput.documentPoint);if(this.isActive){var d=c?this.copiedParts.Df():this.draggedParts.Df();this.copiedParts=null;b&&Gf(this);a.Na();ef(a,this.draggedParts);this.transactionResult=c?"Copy":"Move";a.R(c?"SelectionCopied":"SelectionMoved",d)}this.stopTool();c&&a.R("ChangedSelection",a.selection)}}};
    Re.prototype.simulatedMouseMove=function(a,b,c){if(null===Te)return!1;var d=Te.diagram;c instanceof R||(c=null);var e=Xe;c!==e&&(null!==e&&e!==d&&(e.Cf(),Te.isDragOutStarted=!1,e=e.toolManager.findTool("Dragging"),null!==e&&e.doSimulatedDragLeave()),Xe=c,null!==c&&c!==d&&(lf(),e=c.toolManager.findTool("Dragging"),null!==e&&(ff.contains(e)||ff.add(e),e.doSimulatedDragEnter())));if(null===c||c===d||!c.allowDrop||c.isReadOnly||!c.allowInsert)return!1;d=c.toolManager.findTool("Dragging");null!==d&&(null!==
    a&&(void 0!==a.targetTouches&&(0<a.targetTouches.length?a=a.targetTouches[0]:0<a.changedTouches.length&&(a=a.changedTouches[0])),b=c.getMouse(a)),c.lastInput.documentPoint=b,c.lastInput.viewPoint=c.Nq(b),c.lastInput.down=!1,c.lastInput.up=!1,d.doSimulatedDragOver());return!0};
    Re.prototype.simulatedMouseUp=function(a,b,c){if(null===Te)return!1;var d=Xe,e=Te.diagram;if(null===c)return Te.doCancel(),!0;if(c!==d){var f=d.toolManager.findTool("Dragging");if(null!==d&&d!==e&&null!==f)return d.Cf(),Te.isDragOutStarted=!1,f.doSimulatedDragLeave(),!1;Xe=c;d=c.toolManager.findTool("Dragging");null!==d&&(lf(),ff.contains(d)||ff.add(d),d.doSimulatedDragEnter())}return c!==this.diagram?(null!==a?(void 0!==a.targetTouches&&(0<a.targetTouches.length?a=a.targetTouches[0]:0<a.changedTouches.length&&
      (a=a.changedTouches[0])),b=c.getMouse(a)):null===b&&(b=new I),c.lastInput.documentPoint=b,c.lastInput.viewPoint=c.Nq(b),c.lastInput.down=!1,c.lastInput.up=!0,a=c.toolManager.findTool("Dragging"),null!==a&&a.doSimulatedDrop(),a=Te,null!==a&&(c=a.mayCopy(),a.transactionResult=c?"Copy":"Move",a.stopTool()),!0):!1};
    function Gf(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.o())}}
    Re.prototype.mayCopy=function(){if(!this.isCopyEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowCopy||(Wa?!a.lastInput.alt:!a.lastInput.control))return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.Wb()&&b.canCopy())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1};
    Re.prototype.mayDragOut=function(){if(!this.isCopyEnabled)return!1;var a=this.diagram;if(!a.allowDragOut||!a.allowCopy||a.allowMove)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.Wb()&&b.canCopy())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1};
    Re.prototype.mayMove=function(){var a=this.diagram;if(a.isReadOnly||!a.allowMove)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.Wb()&&b.canMove())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canMove()?!0:!1};Re.prototype.computeBorder=function(a,b,c){return this.Bn||null===this.draggedParts||this.draggedParts.contains(a)?null:c.assign(b)};Re.prototype.Dz=function(){return Te};
    Re.prototype.mayDragIn=function(){var a=this.diagram;if(!a.allowDrop||a.isReadOnly||a.isModelReadOnly||!a.allowInsert)return!1;var b=Te;return null===b||b.diagram.model.dataFormat!==a.model.dataFormat?!1:!0};Re.prototype.doSimulatedDragEnter=function(){if(this.mayDragIn()){var a=this.diagram;a.animationManager.Xc();Hf(a);a.animationManager.Xc();var b=Te;null!==b&&(b.diagram.Qt=!1);this.doUpdateCursor(a.grid)}};
    Re.prototype.doSimulatedDragLeave=function(){var a=Te;null!==a&&a.doSimulatedDragOut();this.doCancel()};Re.prototype.doSimulatedDragOver=function(){var a=this.diagram;a.animationManager.bn=!0;var b=Te;if(null!==b&&null!==b.draggedParts){if(!this.mayDragIn())return;If(this,b.draggedParts.Df(),!1,a.firstInput);qf(this,this.copiedParts,!1);sf(this,a.lastInput.documentPoint)}a.animationManager.bn=!1};
    Re.prototype.doSimulatedDrop=function(){var a=this.diagram,b=Te;if(null!==b){var c=b.diagram;b.Bn=!0;hf(this);if(!this.mayDragIn())return;a.animationManager.bn=!0;a.R("ChangingSelection",a.selection);this.ua("Drop");If(this,b.draggedParts.Df(),!0,a.lastInput);qf(this,this.copiedParts,!1);null!==this.copiedParts&&(a.clearSelection(!0),this.copiedParts.iteratorKeys.each(function(a){a.isSelected=!0}));Df(this,a.lastInput.documentPoint);a.Na();b=a.selection;null!==this.copiedParts?this.transactionResult=
      "ExternalCopy":b=new F;this.copiedParts=null;a.doFocus();a.R("ExternalObjectsDropped",b,c);this.Fg();a.R("ChangedSelection",a.selection)}a.animationManager.bn=!1};
    function If(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.ck(b,e,!0);var f=N.alloc();nf(b,f);d=f.x+f.width/2;e=f.y+f.height/2;N.free(f);f=a.Os;var g=new G,h=I.alloc();for(b=b.iterator;b.next();){var k=b.value,l=c.H(k);k.Wb()&&k.canCopy()?(k=k.location,h.h(f.x-(d-k.x),f.y-(e-k.y)),l.location=h,l.yb(),g.add(l,a.td(h))):l instanceof S&&k.canCopy()&&(pf(l,f.x-d,f.y-e),
      g.add(l,a.td()))}I.free(h);a.copiedParts=g;Ue(a,g.Df());null!==a.draggedLink&&(c=a.draggedLink,d=c.routeBounds,pf(c,a.startPoint.x-(d.x+d.width/2),a.startPoint.y-(d.y+d.height/2)))}}}Re.prototype.doSimulatedDragOut=function(){var a=this.diagram;a.Qt=!1;this.mayCopy()||this.mayMove()?a.currentCursor="":a.currentCursor=this.nodropCursor;this.ko=null};Re.prototype.computeMove=function(a,b,c,d){c=this.diagram;return null!==c?c.computeMove(a,b,this.dragOptions,d):new I};
    ma.Object.defineProperties(Re.prototype,{isCopyEnabled:{get:function(){return this.Yc},set:function(a){this.Yc=a}},copiesEffectiveCollection:{get:function(){return this.I},set:function(a){this.I=a}},dragOptions:{get:function(){return this.Ia},set:function(a){this.Ia=a}},isGridSnapEnabled:{get:function(){return this.dragOptions.isGridSnapEnabled},set:function(a){this.dragOptions.isGridSnapEnabled=
          a}},isComplexRoutingRealtime:{get:function(){return this.Ic},set:function(a){this.Ic=a}},isGridSnapRealtime:{get:function(){return this.dragOptions.isGridSnapRealtime},set:function(a){this.dragOptions.isGridSnapRealtime=a}},gridSnapCellSize:{get:function(){return this.dragOptions.gridSnapCellSize},set:function(a){this.dragOptions.gridSnapCellSize.w(a)||(a=a.G(),this.dragOptions.gridSnapCellSize=a)}},gridSnapCellSpot:{
        get:function(){return this.dragOptions.gridSnapCellSpot},set:function(a){this.dragOptions.gridSnapCellSpot.w(a)||(a=a.G(),this.dragOptions.gridSnapCellSpot=a)}},gridSnapOrigin:{get:function(){return this.dragOptions.gridSnapOrigin},set:function(a){this.dragOptions.gridSnapOrigin.w(a)||(a=a.G(),this.dragOptions.gridSnapOrigin=a)}},dragsLink:{get:function(){return this.dragOptions.dragsLink},set:function(a){this.dragOptions.dragsLink=
          a}},dragsTree:{get:function(){return this.dragOptions.dragsTree},set:function(a){this.dragOptions.dragsTree=a}},copyCursor:{get:function(){return this.Y},set:function(a){this.Y=a}},moveCursor:{get:function(){return this.Mh},set:function(a){this.Mh=a}},nodropCursor:{get:function(){return this.Je},set:function(a){this.Je=a}},currentPart:{get:function(){return this.Ha},
        set:function(a){this.Ha=a}},copiedParts:{get:function(){return this.v},set:function(a){this.v=a}},draggedParts:{get:function(){return this.Za},set:function(a){this.Za=a}},draggingParts:{get:function(){return null!==this.copiedParts?this.copiedParts.Df():null!==this.draggedParts?this.draggedParts.Df():this.Sq}},draggedLink:{get:function(){return this.diagram.draggedLink},set:function(a){this.diagram.draggedLink=
          a}},isDragOutStarted:{get:function(){return this.Ef},set:function(a){this.Ef=a}},startPoint:{get:function(){return this.Os},set:function(a){this.Os.w(a)||this.Os.assign(a)}},delay:{get:function(){return this.Vk},set:function(a){this.Vk=a}}});Re.prototype.getDraggingSource=Re.prototype.Dz;var ff=null,Te=null,Xe=null;Re.className="DraggingTool";ff=new E;
    La("draggingTool",function(){return this.findTool("Dragging")},function(a){this.Va("Dragging",a,this.mouseMoveTools)});Oa.prototype.doCancel=function(){null!==Te&&Te.doCancel();Be.prototype.doCancel.call(this)};
    function Jf(){Be.call(this);this.Ef=100;this.Y=!1;this.fi="pointer";var a=new S,b=new Kf;b.isPanelMain=!0;b.stroke="blue";a.add(b);b=new Kf;b.toArrow="Standard";b.fill="blue";b.stroke="blue";a.add(b);a.layerName="Tool";this.Fw=a;a=new W;b=new Kf;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke="magenta";b.strokeWidth=2;b.desiredSize=Mb;a.add(b);a.selectable=!1;a.layerName="Tool";this.Dw=a;this.Ew=b;a=new W;b=new Kf;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke="magenta";b.strokeWidth=
      2;b.desiredSize=Mb;a.add(b);a.selectable=!1;a.layerName="Tool";this.Gw=a;this.Hw=b;this.Yc=this.Ic=this.Ia=this.Ha=this.Za=null;this.I=!0;this.xy=new G;this.Mh=this.xi=this.Sq=null}la(Jf,Be);Jf.prototype.doStop=function(){this.diagram.Cf();this.originalToPort=this.originalToNode=this.originalFromPort=this.originalFromNode=this.originalLink=null;this.validPortsCache.clear();this.targetPort=null};
    Jf.prototype.copyPortProperties=function(a,b,c,d,e){if(null!==a&&null!==b&&null!==c&&null!==d){var f=b.vf(),g=M.alloc();g.width=b.naturalBounds.width*f;g.height=b.naturalBounds.height*f;d.desiredSize=g;M.free(g);e?(d.toSpot=b.toSpot,d.toEndSegmentLength=b.toEndSegmentLength):(d.fromSpot=b.fromSpot,d.fromEndSegmentLength=b.fromEndSegmentLength);c.locationSpot=Ac;f=I.alloc();c.location=b.ga(Ac,f);I.free(f);d.angle=b.Xi();null!==this.portTargeted&&this.portTargeted(a,b,c,d,e)}};
    Jf.prototype.setNoTargetPortProperties=function(a,b,c){null!==b&&(b.desiredSize=Mb,b.fromSpot=uc,b.toSpot=uc);null!==a&&(a.location=this.diagram.lastInput.documentPoint);null!==this.portTargeted&&this.portTargeted(null,null,a,b,c)};Jf.prototype.doMouseDown=function(){this.isActive&&this.doMouseMove()};
    Jf.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.ht(a.lastInput.viewPoint)}};Jf.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};
    Jf.prototype.findTargetPort=function(a){var b=this.diagram,c=b.lastInput.documentPoint,d=this.portGravity;0>=d&&(d=.1);var e=this,f=b.yg(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.ga(Ac,I.alloc()),l=c.x-k.x,m=c.y-k.y;I.free(k);k=l*l+m*m;k<d&&(l=this.validPortsCache.H(g),null!==l?l&&(b=g,d=k):a&&this.isValidLink(this.originalFromNode,this.originalFromPort,h,g)||!a&&this.isValidLink(h,
      g,this.originalToNode,this.originalToPort)?(this.validPortsCache.add(g,!0),b=g,d=k):this.validPortsCache.add(g,!1))}}return null!==b&&(c=b.part,c instanceof W&&(null===c.layer||c.layer.allowLink))?b:null};
    Jf.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.lq(b).count>=c)return!1}return!0};
    Jf.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.wd(b).count>=c)return!1}return!0};
    Jf.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};Jf.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.wd(b);b.next();)if(d=b.value,d.fromNode===c&&d.fromPortId===a)return!0;return!1};
    Jf.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};Jf.prototype.isLabelDependentOnLink=function(a,b){if(null===a)return!1;var c=a.labeledLink;if(null===c)return!1;if(c===b)return!0;var d=new F;d.add(a);return Lf(this,c,b,d)};
    function Lf(a,b,c,d){if(b===c)return!0;var e=b.fromNode;if(null!==e&&e.isLinkLabel&&(d.add(e),Lf(a,e.labeledLink,c,d)))return!0;b=b.toNode;return null!==b&&b.isLinkLabel&&(d.add(b),Lf(a,b.labeledLink,c,d))?!0:!1}
    Jf.prototype.isValidCycle=function(a,b,c){void 0===c&&(c=null);if(null===a||null===b)return this.isUnconnectedLinkValid;var d=this.diagram.validCycle;if(d!==Mf){if(d===Nf){d=c||this.temporaryLink;if(null!==d&&!d.isTreeLink)return!0;for(d=b.linksConnected;d.next();){var e=d.value;if(e!==c&&e.isTreeLink&&e.toNode===b)return!1}return!Of(this,a,b,c,!0)}if(d===Pf){d=c||this.temporaryLink;if(null!==d&&!d.isTreeLink)return!0;for(d=a.linksConnected;d.next();)if(e=d.value,e!==c&&e.isTreeLink&&e.fromNode===
    a)return!1;return!Of(this,a,b,c,!0)}if(d===Qf)return a===b?a=!0:(d=new F,d.add(b),a=Rf(this,d,a,b,c)),!a;if(d===Sf)return!Of(this,a,b,c,!1);if(d===Tf)return a===b?a=!0:(d=new F,d.add(b),a=Uf(this,d,a,b,c)),!a}return!0};function Of(a,b,c,d,e){if(b===c)return!0;if(null===b||null===c)return!1;for(var f=b.linksConnected;f.next();){var g=f.value;if(g!==d&&(!e||g.isTreeLink)&&g.toNode===b&&(g=g.fromNode,g!==b&&Of(a,g,c,d,e)))return!0}return!1}
    function Rf(a,b,c,d,e){if(c===d)return!0;if(null===c||null===d||b.contains(c))return!1;b.add(c);for(var f=c.linksConnected;f.next();){var g=f.value;if(g!==e&&g.toNode===c&&(g=g.fromNode,g!==c&&Rf(a,b,g,d,e)))return!0}return!1}function Uf(a,b,c,d,e){if(c===d)return!0;if(null===c||null===d||b.contains(c))return!1;b.add(c);for(var f=c.linksConnected;f.next();){var g=f.value;if(g!==e){var h=g.fromNode;g=g.toNode;h=h===c?g:h;if(h!==c&&Uf(a,b,h,d,e))return!0}}return!1}
    ma.Object.defineProperties(Jf.prototype,{portGravity:{get:function(){return this.Ef},set:function(a){0<=a&&(this.Ef=a)}},isUnconnectedLinkValid:{get:function(){return this.Y},set:function(a){this.Y=a}},linkingCursor:{get:function(){return this.fi},set:function(a){this.fi=a}},temporaryLink:{get:function(){return this.Fw},set:function(a){this.Fw=a}},temporaryFromNode:{
        get:function(){return this.Dw},set:function(a){this.Dw=a}},temporaryFromPort:{get:function(){return this.Ew},set:function(a){this.Ew=a}},temporaryToNode:{get:function(){return this.Gw},set:function(a){this.Gw=a}},temporaryToPort:{get:function(){return this.Hw},set:function(a){this.Hw=a}},originalLink:{get:function(){return this.Za},set:function(a){this.Za=a}},originalFromNode:{
        get:function(){return this.Ha},set:function(a){this.Ha=a}},originalFromPort:{get:function(){return this.Ia},set:function(a){this.Ia=a}},originalToNode:{get:function(){return this.Ic},set:function(a){this.Ic=a}},originalToPort:{get:function(){return this.Yc},set:function(a){this.Yc=a}},isForwards:{get:function(){return this.I},set:function(a){this.I=a}},validPortsCache:{
        get:function(){return this.xy}},targetPort:{get:function(){return this.Sq},set:function(a){this.Sq=a}},linkValidation:{get:function(){return this.xi},set:function(a){this.xi=a}},portTargeted:{get:function(){return this.Mh},set:function(a){this.Mh=a}}});Jf.className="LinkingBaseTool";function Vf(){Jf.call(this);this.name="Linking";this.v={};this.l=null;this.J=Wf;this.Je=null}la(Vf,Jf);
    Vf.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowLink||!a.model.wt()||!a.lastInput.left||a.currentTool!==this&&!this.isBeyondDragSize()?!1:null!==this.findLinkablePort()};
    Vf.prototype.findLinkablePort=function(){var a=this.diagram,b=this.startObject;null===b&&(b=a.Ub(a.firstInput.documentPoint,null,null));if(null===b||!(b.part instanceof W))return null;a=this.direction;if(a===Wf||a===Xf){var c=this.findValidLinkablePort(b,!1);if(null!==c)return this.isForwards=!0,c}if(a===Wf||a===Yf)if(b=this.findValidLinkablePort(b,!0),null!==b)return this.isForwards=!1,b;return null};
    Vf.prototype.doActivate=function(){var a=this.diagram,b=this.findLinkablePort();null!==b&&(this.ua(this.name),a.isMouseCaptured=!0,a.currentCursor=this.linkingCursor,this.isForwards?(null===this.temporaryToNode||this.temporaryToNode.location.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.Ta(),a.add(this.temporaryLink)),this.isActive=!0)};Vf.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.remove(this.temporaryLink);a.remove(this.temporaryFromNode);a.remove(this.temporaryToNode);a.isMouseCaptured=!1;a.currentCursor="";this.Fg()};Vf.prototype.doStop=function(){Jf.prototype.doStop.call(this);this.startObject=null};
    Vf.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.transactionResult=null,c=null,d=null,e=null,f=null;try{var g=this.targetPort=this.findTargetPort(this.isForwards);if(null!==g){var h=g.part;h instanceof 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.R("ChangingSelection",a.selection),a.clearSelection(!0),f.isSelected=!0),this.transactionResult=this.name,a.R("LinkDrawn",f)):(a.model.gq(),this.doNoLink(b,c,
      d,e))):this.isForwards?this.doNoLink(this.originalFromNode,this.originalFromPort,null,null):this.doNoLink(null,null,this.originalToNode,this.originalToPort)}finally{this.stopTool(),f&&a.allowSelect&&a.R("ChangedSelection",a.selection)}}};
    Vf.prototype.isNewTreeLink=function(){var a=this.archetypeLinkData;if(null===a)return!0;if(a instanceof S)return a.isTreeLink;var b=this.diagram;if(null===b)return!0;a=b.partManager.getLinkCategoryForData(a);b=b.partManager.findLinkTemplateForCategory(a);return null!==b?b.isTreeLink:!0};Vf.prototype.insertLink=function(a,b,c,d){return this.diagram.partManager.insertLink(a,b,c,d)};Vf.prototype.doNoLink=function(){};
    ma.Object.defineProperties(Vf.prototype,{archetypeLinkData:{get:function(){return this.v},set:function(a){this.v=a}},archetypeLabelNodeData:{get:function(){return this.l},set:function(a){this.l=a}},direction:{get:function(){return this.J},set:function(a){this.J=a}},startObject:{get:function(){return this.Je},set:function(a){this.Je=a}}});
    var Wf=new D(Vf,"Either",0),Xf=new D(Vf,"ForwardsOnly",0),Yf=new D(Vf,"BackwardsOnly",0);Vf.className="LinkingTool";Vf.Either=Wf;Vf.ForwardsOnly=Xf;Vf.BackwardsOnly=Yf;
    function bf(){Jf.call(this);this.name="Relinking";var a=new Kf;a.figure="Diamond";a.desiredSize=Ob;a.fill="lightblue";a.stroke="dodgerblue";a.cursor=this.linkingCursor;a.segmentIndex=0;this.v=a;a=new Kf;a.figure="Diamond";a.desiredSize=Ob;a.fill="lightblue";a.stroke="dodgerblue";a.cursor=this.linkingCursor;a.segmentIndex=-1;this.Je=a;this.l=null;this.ix=new N}la(bf,Jf);
    bf.prototype.updateAdornments=function(a){if(null!==a&&a instanceof S){var b="RelinkFrom",c=null;if(a.isSelected&&!this.diagram.isReadOnly){var d=a.selectionObject;null!==d&&a.canRelinkFrom()&&a.actualBounds.u()&&a.isVisible()&&d.actualBounds.u()&&d.zf()&&(c=a.fk(b),null===c&&(c=this.makeAdornment(d,!1),a.Ah(b,c)))}null===c&&a.Af(b);b="RelinkTo";c=null;a.isSelected&&!this.diagram.isReadOnly&&(d=a.selectionObject,null!==d&&a.canRelinkTo()&&a.actualBounds.u()&&a.isVisible()&&d.actualBounds.u()&&d.zf()&&
    (c=a.fk(b),null===c?(c=this.makeAdornment(d,!0),a.Ah(b,c)):c.o()));null===c&&a.Af(b)}};bf.prototype.makeAdornment=function(a,b){var c=new Ke;c.type=X.Link;b=b?this.toHandleArchetype:this.fromHandleArchetype;null!==b&&c.add(b.copy());c.adornedObject=a;return c};
    bf.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowRelink||!a.model.wt()||!a.lastInput.left)return!1;var b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkFrom");null===b&&(b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkTo"));return null!==b};
    bf.prototype.doActivate=function(){var a=this.diagram;if(null===this.originalLink){var b=this.handle;null===b&&(b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkFrom"),null===b&&(b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkTo")));if(null===b)return;var c=b.part;if(!(c instanceof Ke&&c.adornedPart instanceof S))return;this.handle=b;this.isForwards=null===c||"RelinkTo"===c.category;this.originalLink=c.adornedPart}this.ua(this.name);a.isMouseCaptured=!0;a.currentCursor=this.linkingCursor;
      this.originalFromPort=this.originalLink.fromPort;this.originalFromNode=this.originalLink.fromNode;this.originalToPort=this.originalLink.toPort;this.originalToNode=this.originalLink.toNode;this.ix.set(this.originalLink.actualBounds);null!==this.originalLink&&0<this.originalLink.pointsCount&&(null===this.originalLink.fromNode&&(null!==this.temporaryFromPort&&(this.temporaryFromPort.desiredSize=Lb),null!==this.temporaryFromNode&&(this.temporaryFromNode.location=this.originalLink.i(0))),null===this.originalLink.toNode&&
      (null!==this.temporaryToPort&&(this.temporaryToPort.desiredSize=Lb),null!==this.temporaryToNode&&(this.temporaryToNode.location=this.originalLink.i(this.originalLink.pointsCount-1))));this.copyPortProperties(this.originalFromNode,this.originalFromPort,this.temporaryFromNode,this.temporaryFromPort,!1);this.copyPortProperties(this.originalToNode,this.originalToPort,this.temporaryToNode,this.temporaryToPort,!0);a.add(this.temporaryFromNode);a.add(this.temporaryToNode);null!==this.temporaryLink&&(null!==
      this.temporaryFromNode&&(this.temporaryLink.fromNode=this.temporaryFromNode),null!==this.temporaryToNode&&(this.temporaryLink.toNode=this.temporaryToNode),this.copyLinkProperties(this.originalLink,this.temporaryLink),this.temporaryLink.Ta(),a.add(this.temporaryLink));this.isActive=!0};
    bf.prototype.copyLinkProperties=function(a,b){if(null!==a&&null!==b){b.adjusting=a.adjusting;b.corner=a.corner;var c=a.curve;if(c===Zf||c===$f)c=ag;b.curve=c;b.curviness=a.curviness;b.isTreeLink=a.isTreeLink;b.points=a.points;b.routing=a.routing;b.smoothness=a.smoothness;b.fromSpot=a.fromSpot;b.fromEndSegmentLength=a.fromEndSegmentLength;b.fromShortLength=a.fromShortLength;b.toSpot=a.toSpot;b.toEndSegmentLength=a.toEndSegmentLength;b.toShortLength=a.toShortLength}};
    bf.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.remove(this.temporaryLink);a.remove(this.temporaryFromNode);a.remove(this.temporaryToNode);a.isMouseCaptured=!1;a.currentCursor="";this.Fg()};bf.prototype.doStop=function(){Jf.prototype.doStop.call(this);this.handle=null};
    bf.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram;this.transactionResult=null;var b=this.originalFromNode,c=this.originalFromPort,d=this.originalToNode,e=this.originalToPort,f=this.originalLink;this.targetPort=this.findTargetPort(this.isForwards);if(null!==this.targetPort){var g=this.targetPort.part;g instanceof 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.Ta()),a.allowSelect&&(f.isSelected=!0),this.transactionResult=this.name,a.R("LinkRelinked",f,this.isForwards?this.originalToPort:this.originalFromPort)):this.doNoRelink(this.originalLink,this.isForwards);this.originalLink.tq(this.ix)}this.stopTool()};
    bf.prototype.reconnectLink=function(a,b,c,d){c=null!==c&&null!==c.portId?c.portId:"";d?(a.toNode=b,a.toPortId=c):(a.fromNode=b,a.fromPortId=c);return!0};bf.prototype.doNoRelink=function(){};
    function xf(a,b,c,d,e){null!==b?(a.copyPortProperties(b,c,a.temporaryFromNode,a.temporaryFromPort,!1),a.diagram.add(a.temporaryFromNode)):a.diagram.remove(a.temporaryFromNode);null!==d?(a.copyPortProperties(d,e,a.temporaryToNode,a.temporaryToPort,!0),a.diagram.add(a.temporaryToNode)):a.diagram.remove(a.temporaryToNode)}
    ma.Object.defineProperties(bf.prototype,{fromHandleArchetype:{get:function(){return this.v},set:function(a){this.v=a}},toHandleArchetype:{get:function(){return this.Je},set:function(a){this.Je=a}},handle:{get:function(){return this.l},set:function(a){if(null!==a&&!(a.part instanceof Ke))throw Error("new handle is not in an Adornment: "+a);this.l=a}}});bf.className="RelinkingTool";
    La("linkingTool",function(){return this.findTool("Linking")},function(a){this.Va("Linking",a,this.mouseMoveTools)});La("relinkingTool",function(){return this.findTool("Relinking")},function(a){this.Va("Relinking",a,this.mouseDownTools)});
    function bg(){Be.call(this);this.name="LinkReshaping";var a=new Kf;a.figure="Rectangle";a.desiredSize=Nb;a.fill="lightblue";a.stroke="dodgerblue";this.v=a;a=new Kf;a.figure="Diamond";a.desiredSize=Ob;a.fill="lightblue";a.stroke="dodgerblue";a.cursor="move";this.I=a;this.Y=3;this.Zt=this.l=null;this.jx=new I;this.ps=new E}la(bg,Be);bg.prototype.Dv=function(a){return a&&a.ws&&0!==a.ws.value?a.ws:cg};bg.prototype.Im=function(a,b){a.ws=b};
    bg.prototype.updateAdornments=function(a){if(null!==a&&a instanceof S){var b=null;if(a.isSelected&&!this.diagram.isReadOnly){var c=a.path;null!==c&&a.canReshape()&&a.actualBounds.u()&&a.isVisible()&&c.actualBounds.u()&&c.zf()&&(b=a.fk(this.name),null===b||b.ex!==a.pointsCount||b.tx!==a.resegmentable)&&(b=this.makeAdornment(c),null!==b&&(b.ex=a.pointsCount,b.tx=a.resegmentable,a.Ah(this.name,b)))}null===b&&a.Af(this.name)}};
    bg.prototype.makeAdornment=function(a){var b=a.part,c=b.pointsCount,d=b.isOrthogonal,e=null;if(null!==b.points&&1<c){e=new Ke;e.type=X.Link;c=b.firstPickIndex;var f=b.lastPickIndex,g=d?1:0;if(b.resegmentable&&b.computeCurve()!==og)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);J.A(k.x,l.x)&&
    J.A(k.y,l.y)&&(l=b.i(c-1));J.A(k.x,l.x)?(this.Im(h,pg),h.cursor="n-resize"):J.A(k.y,l.y)&&(this.Im(h,qg),h.cursor="w-resize")}else g===f-1&&d?(k=b.i(f-1),l=b.i(f),J.A(k.x,l.x)&&J.A(k.y,l.y)&&(k=b.i(f+1)),J.A(k.x,l.x)?(this.Im(h,pg),h.cursor="n-resize"):J.A(k.y,l.y)&&(this.Im(h,qg),h.cursor="w-resize")):g!==f&&(this.Im(h,rg),h.cursor="move");e.add(h)}e.adornedObject=a}return e};bg.prototype.makeHandle=function(){var a=this.handleArchetype;return null===a?null:a.copy()};
    bg.prototype.makeResegmentHandle=function(){var a=this.midHandleArchetype;return null===a?null:a.copy()};bg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return!a.isReadOnly&&a.allowReshape&&a.lastInput.left?null!==this.findToolHandleAt(a.firstInput.documentPoint,this.name):!1};
    bg.prototype.doActivate=function(){var a=this.diagram;null===this.handle&&(this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name));if(null!==this.handle){var b=this.handle.part.adornedPart;if(b instanceof S){this.Zt=b;a.isMouseCaptured=!0;this.ua(this.name);if(b.resegmentable&&999===this.handle.fromMaxLinks){var c=b.points.copy(),d=this.getResegmentingPoint();c.Kb(this.handle.segmentIndex+1,d);b.isOrthogonal&&c.Kb(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.jx=b.i(this.handle.segmentIndex);this.ps=b.points.copy();this.isActive=!0}}};bg.prototype.doDeactivate=function(){this.Fg();this.Zt=this.handle=null;this.isActive=this.diagram.isMouseCaptured=!1};bg.prototype.doCancel=function(){var a=this.adornedLink;null!==a&&(a.points=this.ps);this.stopTool()};bg.prototype.getResegmentingPoint=function(){return this.handle.ga(Ac)};
    bg.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeReshape(a.lastInput.documentPoint),this.reshape(a))};
    bg.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.computeReshape(a.lastInput.documentPoint);this.reshape(b);b=this.adornedLink;if(null!==b&&b.resegmentable){var c=this.handle.segmentIndex,d=b.i(c-1),e=b.i(c),f=b.i(c+1);if(b.isOrthogonal){if(c>b.firstPickIndex+1&&c<b.lastPickIndex-1){var g=b.i(c-2);if(Math.abs(d.x-e.x)<this.resegmentingDistance&&Math.abs(d.y-e.y)<this.resegmentingDistance&&(sg(this,g,d,e,f,!0)||sg(this,g,d,e,f,!1))){var h=b.points.copy();sg(this,g,d,
      e,f,!0)?(h.hd(c-2,new I(g.x,(f.y+g.y)/2)),h.hd(c+1,new I(f.x,(f.y+g.y)/2))):(h.hd(c-2,new I((f.x+g.x)/2,g.y)),h.hd(c+1,new I((f.x+g.x)/2,f.y)));h.lb(c);h.lb(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&&(sg(this,d,e,f,g,!0)||sg(this,d,e,f,g,!1))&&(h=b.points.copy(),sg(this,d,e,f,g,!0)?(h.hd(c-1,new I(d.x,(d.y+g.y)/2)),h.hd(c+2,new I(g.x,(d.y+g.y)/2))):(h.hd(c-1,new I((d.x+g.x)/2,d.y)),h.hd(c+2,new I((d.x+g.x)/2,g.y))),
      h.lb(c+1),h.lb(c),b.points=h,b.Lb())}}else g=I.alloc(),J.Jh(d.x,d.y,f.x,f.y,e.x,e.y,g)&&g.Be(e)<this.resegmentingDistance*this.resegmentingDistance&&(d=b.points.copy(),d.lb(c),b.points=d,b.Lb()),I.free(g)}a.Na();this.transactionResult=this.name;a.R("LinkReshaped",this.adornedLink,this.ps)}this.stopTool()};
    function sg(a,b,c,d,e,f){return f?Math.abs(b.y-c.y)<a.resegmentingDistance&&Math.abs(c.y-d.y)<a.resegmentingDistance&&Math.abs(d.y-e.y)<a.resegmentingDistance:Math.abs(b.x-c.x)<a.resegmentingDistance&&Math.abs(c.x-d.x)<a.resegmentingDistance&&Math.abs(d.x-e.x)<a.resegmentingDistance}
    bg.prototype.reshape=function(a){var b=this.adornedLink;b.Lh();var c=this.handle.segmentIndex,d=this.Dv(this.handle);if(b.isOrthogonal)if(c===b.firstPickIndex+1)c=b.firstPickIndex+1,d===pg?(b.K(c,b.i(c-1).x,a.y),b.K(c+1,b.i(c+2).x,a.y)):d===qg&&(b.K(c,a.x,b.i(c-1).y),b.K(c+1,a.x,b.i(c+2).y));else if(c===b.lastPickIndex-1)c=b.lastPickIndex-1,d===pg?(b.K(c-1,b.i(c-2).x,a.y),b.K(c,b.i(c+1).x,a.y)):d===qg&&(b.K(c-1,a.x,b.i(c-2).y),b.K(c,a.x,b.i(c+1).y));else{d=c;var e=b.i(d),f=b.i(d-1),g=b.i(d+1);J.A(f.x,
      e.x)&&J.A(e.y,g.y)?(J.A(f.x,b.i(d-2).x)&&!J.A(f.y,b.i(d-2).y)?(b.m(d,a.x,f.y),c++,d++):b.K(d-1,a.x,f.y),J.A(g.y,b.i(d+2).y)&&!J.A(g.x,b.i(d+2).x)?b.m(d+1,g.x,a.y):b.K(d+1,g.x,a.y)):J.A(f.y,e.y)&&J.A(e.x,g.x)?(J.A(f.y,b.i(d-2).y)&&!J.A(f.x,b.i(d-2).x)?(b.m(d,f.x,a.y),c++,d++):b.K(d-1,f.x,a.y),J.A(g.x,b.i(d+2).x)&&!J.A(g.y,b.i(d+2).y)?b.m(d+1,a.x,g.y):b.K(d+1,a.x,g.y)):J.A(f.x,e.x)&&J.A(e.x,g.x)?(J.A(f.x,b.i(d-2).x)&&!J.A(f.y,b.i(d-2).y)?(b.m(d,a.x,f.y),c++,d++):b.K(d-1,a.x,f.y),J.A(g.x,b.i(d+2).x)&&
    !J.A(g.y,b.i(d+2).y)?b.m(d+1,a.x,g.y):b.K(d+1,a.x,g.y)):J.A(f.y,e.y)&&J.A(e.y,g.y)&&(J.A(f.y,b.i(d-2).y)&&!J.A(f.x,b.i(d-2).x)?(b.m(d,f.x,a.y),c++,d++):b.K(d-1,f.x,a.y),J.A(g.y,b.i(d+2).y)&&!J.A(g.x,b.i(d+2).x)?b.m(d+1,g.x,a.y):b.K(d+1,g.x,a.y));b.K(c,a.x,a.y)}else b.K(c,a.x,a.y),d=b.fromNode,e=b.fromPort,null!==d&&(f=d.findVisibleNode(),null!==f&&f!==d&&(d=f,e=d.port)),1===c&&b.computeSpot(!0,e).jc()&&(f=e.ga(Ac,I.alloc()),d=b.getLinkPointFromPoint(d,e,f,a,!0,I.alloc()),b.K(0,d.x,d.y),I.free(f),
      I.free(d)),d=b.toNode,e=b.toPort,null!==d&&(f=d.findVisibleNode(),null!==f&&f!==d&&(d=f,e=d.port)),c===b.pointsCount-2&&b.computeSpot(!1,e).jc()&&(c=e.ga(Ac,I.alloc()),a=b.getLinkPointFromPoint(d,e,c,a,!1,I.alloc()),b.K(b.pointsCount-1,a.x,a.y),I.free(c),I.free(a));b.sf()};bg.prototype.computeReshape=function(a){var b=this.adornedLink,c=this.handle.segmentIndex;switch(this.Dv(this.handle)){case rg:return a;case pg:return new I(b.i(c).x,a.y);case qg:return new I(a.x,b.i(c).y);default:case cg:return b.i(c)}};
    ma.Object.defineProperties(bg.prototype,{handleArchetype:{get:function(){return this.v},set:function(a){this.v=a}},midHandleArchetype:{get:function(){return this.I},set:function(a){this.I=a}},handle:{get:function(){return this.l},set:function(a){if(null!==a&&!(a.part instanceof Ke))throw Error("new handle is not in an Adornment: "+a);this.l=a}},adornedLink:{get:function(){return this.Zt}},
      resegmentingDistance:{get:function(){return this.Y},set:function(a){this.Y=a}},originalPoint:{get:function(){return this.jx}},originalPoints:{get:function(){return this.ps}}});bg.prototype.setReshapingBehavior=bg.prototype.Im;bg.prototype.getReshapingBehavior=bg.prototype.Dv;var cg=new D(bg,"None",0),qg=new D(bg,"Horizontal",1),pg=new D(bg,"Vertical",2),rg=new D(bg,"All",3);bg.className="LinkReshapingTool";
    bg.None=cg;bg.Horizontal=qg;bg.Vertical=pg;bg.All=rg;La("linkReshapingTool",function(){return this.findTool("LinkReshaping")},function(a){this.Va("LinkReshaping",a,this.mouseDownTools)});
    function tg(){Be.call(this);this.name="Resizing";this.cg=(new M(1,1)).freeze();this.bg=(new M(9999,9999)).freeze();this.Lg=(new M(NaN,NaN)).freeze();this.I=!1;this.be=null;var a=new Kf;a.alignmentFocus=Ac;a.figure="Rectangle";a.desiredSize=Nb;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.v=a;this.l=null;this.os=new I;this.hx=new M;this.Xo=new I;this.pu=new M(0,0);this.ou=new M(Infinity,Infinity);this.nu=new M(1,1);this.bx=!0}la(tg,Be);
    tg.prototype.updateAdornments=function(a){if(!(null===a||a instanceof S)){if(a.isSelected&&!this.diagram.isReadOnly){var b=a.resizeObject,c=a.fk(this.name);if(null!==b&&a.canResize()&&a.actualBounds.u()&&a.isVisible()&&b.actualBounds.u()&&b.zf()){if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){b=b.Xi();ug(a)&&this.updateResizeHandles(c,b);a.Ah(this.name,c);return}}}a.Af(this.name)}};
    tg.prototype.makeAdornment=function(a){var b=a.part.resizeAdornmentTemplate;if(null===b){b=new Ke;b.type=X.Spot;b.locationSpot=Ac;var c=new vg;c.isPanelMain=!0;b.add(c);b.add(this.makeHandle(a,vc));b.add(this.makeHandle(a,yc));b.add(this.makeHandle(a,Gc));b.add(this.makeHandle(a,Cc));b.add(this.makeHandle(a,ed));b.add(this.makeHandle(a,gd));b.add(this.makeHandle(a,hd));b.add(this.makeHandle(a,fd))}else if(wg(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};
    tg.prototype.makeHandle=function(a,b){a=this.handleArchetype;if(null===a)return null;a=a.copy();a.alignment=b;return a};
    tg.prototype.updateResizeHandles=function(a,b){if(null!==a)if(!a.alignment.Mb()&&("pointer"===a.cursor||0<a.cursor.indexOf("resize")))a:{var c=a.alignment;c.jc()&&(c=Ac);if(0>=c.x)b=0>=c.y?b+225:1<=c.y?b+135:b+180;else if(1<=c.x)0>=c.y?b+=315:1<=c.y&&(b+=45);else if(0>=c.y)b+=270;else if(1<=c.y)b+=90;else break a;0>b?b+=360:360<=b&&(b-=360);a.cursor=22.5>b?"e-resize":67.5>b?"se-resize":112.5>b?"s-resize":157.5>b?"sw-resize":202.5>b?"w-resize":247.5>b?"nw-resize":292.5>b?"n-resize":337.5>b?"ne-resize":
      "e-resize"}else if(a instanceof X)for(a=a.elements;a.next();)this.updateResizeHandles(a.value,b)};tg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return!a.isReadOnly&&a.allowResize&&a.lastInput.left?null!==this.findToolHandleAt(a.firstInput.documentPoint,this.name):!1};
    tg.prototype.doActivate=function(){var a=this.diagram;null===this.handle&&(this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name));null!==this.handle&&(this.adornedObject=this.handle.part.adornedObject,null!==this.adornedObject&&(this.os.set(this.adornedObject.ga(this.handle.alignment.Sv())),this.Xo.set(this.adornedObject.part.location),this.hx.set(this.adornedObject.desiredSize),this.nu=this.computeCellSize(),this.pu=this.computeMinSize(),this.ou=this.computeMaxSize(),a.isMouseCaptured=
      !0,this.bx=a.animationManager.isEnabled,a.animationManager.isEnabled=!1,this.ua(this.name),this.isActive=!0))};tg.prototype.doDeactivate=function(){var a=this.diagram;this.Fg();this.be=this.handle=null;this.isActive=a.isMouseCaptured=!1;a.animationManager.isEnabled=this.bx};tg.prototype.doCancel=function(){null!==this.adornedObject&&(this.adornedObject.desiredSize=this.originalDesiredSize,this.adornedObject.part.location=this.originalLocation);this.stopTool()};
    tg.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive){var b=this.pu,c=this.ou,d=this.nu,e=this.adornedObject.pt(a.lastInput.documentPoint,I.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);a.Wc();I.free(e)}};
    tg.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.pu,c=this.ou,d=this.nu,e=this.adornedObject.pt(a.lastInput.documentPoint,I.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);I.free(e);a.Na();this.transactionResult=this.name;a.R("PartResized",this.adornedObject,this.originalDesiredSize)}this.stopTool()};
    tg.prototype.resize=function(a){var b=this.diagram,c=this.adornedObject;if(null!==c){c.desiredSize=a.size;a=c.part;a.yb();c=c.ga(this.handle.alignment.Sv());if(a instanceof T){var d=new E;d.add(a);b.moveParts(d,this.oppositePoint.copy().$d(c),!0)}else a.location=a.location.copy().$d(c).add(this.oppositePoint);b.Wc()}};
    tg.prototype.computeResize=function(a,b,c,d,e,f){b.jc()&&(b=Ac);var g=this.adornedObject.naturalBounds,h=g.x,k=g.y,l=g.x+g.width,m=g.y+g.height,n=1;if(!f){n=g.width;var p=g.height;0>=n&&(n=1);0>=p&&(p=1);n=p/n}p=I.alloc();J.mq(a.x,a.y,h,k,e.width,e.height,p);a=g.copy();0>=b.x?0>=b.y?(a.x=Math.max(p.x,l-d.width),a.x=Math.min(a.x,l-c.width),a.width=Math.max(l-a.x,c.width),a.y=Math.max(p.y,m-d.height),a.y=Math.min(a.y,m-c.height),a.height=Math.max(m-a.y,c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*
      a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width),a.x=l-a.width,a.y=m-a.height)):1<=b.y?(a.x=Math.max(p.x,l-d.width),a.x=Math.min(a.x,l-c.width),a.width=Math.max(l-a.x,c.width),a.height=Math.max(Math.min(p.y-k,d.height),c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width),a.x=l-a.width)):(a.x=
      Math.max(p.x,l-d.width),a.x=Math.min(a.x,l-c.width),a.width=l-a.x,f||(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n,a.y=k+.5*(m-k-a.height))):1<=b.x?0>=b.y?(a.width=Math.max(Math.min(p.x-h,d.width),c.width),a.y=Math.max(p.y,m-d.height),a.y=Math.min(a.y,m-c.height),a.height=Math.max(m-a.y,c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width),
      a.y=m-a.height)):1<=b.y?(a.width=Math.max(Math.min(p.x-h,d.width),c.width),a.height=Math.max(Math.min(p.y-k,d.height),c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width))):(a.width=Math.max(Math.min(p.x-h,d.width),c.width),f||(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n,a.y=k+.5*(m-k-a.height))):0>=b.y?(a.y=Math.max(p.y,m-d.height),
      a.y=Math.min(a.y,m-c.height),a.height=m-a.y,f||(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width,a.x=h+.5*(l-h-a.width))):1<=b.y&&(a.height=Math.max(Math.min(p.y-k,d.height),c.height),f||(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width,a.x=h+.5*(l-h-a.width)));I.free(p);return a};tg.prototype.computeReshape=function(){var a=xg;this.adornedObject instanceof Kf&&(a=yg(this.adornedObject));return!(a===zg||this.diagram.lastInput.shift)};
    tg.prototype.computeMinSize=function(){var a=this.adornedObject.minSize.copy(),b=this.minSize;!isNaN(b.width)&&b.width>a.width&&(a.width=b.width);!isNaN(b.height)&&b.height>a.height&&(a.height=b.height);return a};tg.prototype.computeMaxSize=function(){var a=this.adornedObject.maxSize.copy(),b=this.maxSize;!isNaN(b.width)&&b.width<a.width&&(a.width=b.width);!isNaN(b.height)&&b.height<a.height&&(a.height=b.height);return a};
    tg.prototype.computeCellSize=function(){var a=new M(NaN,NaN),b=this.adornedObject.part;null!==b&&(b=b.resizeCellSize,!isNaN(b.width)&&0<b.width&&(a.width=b.width),!isNaN(b.height)&&0<b.height&&(a.height=b.height));b=this.cellSize;isNaN(a.width)&&!isNaN(b.width)&&0<b.width&&(a.width=b.width);isNaN(a.height)&&!isNaN(b.height)&&0<b.height&&(a.height=b.height);b=this.diagram;(isNaN(a.width)||isNaN(a.height))&&b&&(b=b.grid,null!==b&&b.visible&&this.isGridSnapEnabled&&(b=b.gridCellSize,isNaN(a.width)&&
    !isNaN(b.width)&&0<b.width&&(a.width=b.width),isNaN(a.height)&&!isNaN(b.height)&&0<b.height&&(a.height=b.height)));if(isNaN(a.width)||0===a.width||Infinity===a.width)a.width=1;if(isNaN(a.height)||0===a.height||Infinity===a.height)a.height=1;return a};
    ma.Object.defineProperties(tg.prototype,{handleArchetype:{get:function(){return this.v},set:function(a){this.v=a}},handle:{get:function(){return this.l},set:function(a){if(null!==a&&!(a.part instanceof Ke))throw Error("new handle is not in an Adornment: "+a);this.l=a}},adornedObject:{get:function(){return this.be},set:function(a){if(null!==a&&a.part instanceof Ke)throw Error("new handle must not be in an Adornment: "+
          a);this.be=a}},minSize:{get:function(){return this.cg},set:function(a){if(!this.cg.w(a)){var b=a.width;isNaN(b)&&(b=0);a=a.height;isNaN(a)&&(a=0);this.cg.h(b,a)}}},maxSize:{get:function(){return this.bg},set:function(a){if(!this.bg.w(a)){var b=a.width;isNaN(b)&&(b=Infinity);a=a.height;isNaN(a)&&(a=Infinity);this.bg.h(b,a)}}},cellSize:{get:function(){return this.Lg},set:function(a){this.Lg.w(a)||this.Lg.assign(a)}},
      isGridSnapEnabled:{get:function(){return this.I},set:function(a){this.I=a}},oppositePoint:{get:function(){return this.os},set:function(a){this.os.w(a)||this.os.assign(a)}},originalDesiredSize:{get:function(){return this.hx}},originalLocation:{get:function(){return this.Xo}}});tg.className="ResizingTool";
    La("resizingTool",function(){return this.findTool("Resizing")},function(a){this.Va("Resizing",a,this.mouseDownTools)});function Ag(){Be.call(this);this.name="Rotating";this.Ia=45;this.Ha=2;this.Xo=new I;this.be=null;var a=new Kf;a.figure="Ellipse";a.desiredSize=Ob;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.v=a;this.l=null;this.gx=0;this.Pu=new I(NaN,NaN);this.I=0;this.Y=50}la(Ag,Be);
    Ag.prototype.updateAdornments=function(a){if(null!==a){if(a.Ih()){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.zf())){var c=a.fk(this.name);if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){c.angle=b.Xi();null===c.placeholder&&(c.location=this.computeAdornmentLocation(b));a.Ah(this.name,c);return}}a.Af(this.name)}};
    Ag.prototype.makeAdornment=function(a){var b=a.part.rotateAdornmentTemplate;if(null===b){b=new Ke;b.type=X.Position;b.locationSpot=Ac;var c=this.handleArchetype;null!==c&&b.add(c.copy())}else if(wg(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};Ag.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return!a.isReadOnly&&a.allowRotate&&a.lastInput.left?null!==this.findToolHandleAt(a.firstInput.documentPoint,this.name):!1};
    Ag.prototype.doActivate=function(){var a=this.diagram;if(null===this.adornedObject){null===this.handle&&(this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name));if(null===this.handle)return;this.adornedObject=this.handle.part.adornedObject}null!==this.adornedObject&&(this.gx=this.adornedObject.angle,this.Pu=this.computeRotationPoint(this.adornedObject),this.Xo=this.adornedObject.part.location.copy(),a.isMouseCaptured=!0,a.delaysLayout=!0,this.ua(this.name),this.isActive=!0)};
    Ag.prototype.computeRotationPoint=function(a){var b=a.part,c=b.locationObject;return b.rotationSpot.eb()?a.ga(b.rotationSpot):a===b||a===c?c.ga(b.locationSpot):a.ga(Ac)};
    Ag.prototype.computeAdornmentLocation=function(a){var b=this.rotationPoint;b.u()||(b=this.computeRotationPoint(a));b=a.pt(b);var c=this.handleAngle;0>c?c+=360:360<=c&&(c-=360);c=Math.round(45*Math.round(c/45));var d=this.handleDistance;0===c?b.x=a.naturalBounds.width+d:45===c?(b.x=a.naturalBounds.width+d,b.y=a.naturalBounds.height+d):90===c?b.y=a.naturalBounds.height+d:135===c?(b.x=-d,b.y=a.naturalBounds.height+d):180===c?b.x=-d:225===c?(b.x=-d,b.y=-d):270===c?b.y=-d:315===c&&(b.x=a.naturalBounds.width+
      d,b.y=-d);return a.ga(b)};Ag.prototype.doDeactivate=function(){var a=this.diagram;this.Fg();this.be=this.handle=null;this.Pu=new I(NaN,NaN);this.isActive=a.isMouseCaptured=!1};Ag.prototype.doCancel=function(){this.diagram.delaysLayout=!1;this.rotate(this.originalAngle);this.stopTool()};Ag.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeRotate(a.lastInput.documentPoint),this.rotate(a))};
    Ag.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){a.delaysLayout=!1;var b=this.computeRotate(a.lastInput.documentPoint);this.rotate(b);a.Na();this.transactionResult=this.name;a.R("PartRotated",this.adornedObject,this.originalAngle)}this.stopTool()};
    Ag.prototype.rotate=function(a){var b=this.adornedObject;if(null!==b){b.angle=a;b=b.part;b.yb();var c=b.locationObject,d=b.rotateObject;if(c===d||c.Bg(d))c=this.Xo.copy(),b.location=c.$d(this.rotationPoint).rotate(a-this.originalAngle).add(this.rotationPoint);this.diagram.Wc()}};
    Ag.prototype.computeRotate=function(a){a=this.rotationPoint.Sa(a)-this.handleAngle;var b=this.adornedObject.panel;null!==b&&(a-=b.Xi());360<=a?a-=360:0>a&&(a+=360);b=Math.min(Math.abs(this.snapAngleMultiple),180);var c=Math.min(Math.abs(this.snapAngleEpsilon),b/2);!this.diagram.lastInput.shift&&0<b&&0<c&&(a%b<c?a=Math.floor(a/b)*b:a%b>b-c&&(a=(Math.floor(a/b)+1)*b));360<=a?a-=360:0>a&&(a+=360);return a};
    ma.Object.defineProperties(Ag.prototype,{handleArchetype:{get:function(){return this.v},set:function(a){this.v=a}},handle:{get:function(){return this.l},set:function(a){if(null!==a&&!(a.part instanceof Ke))throw Error("new handle is not in an Adornment: "+a);this.l=a}},adornedObject:{get:function(){return this.be},set:function(a){if(null!==a&&a.part instanceof Ke)throw Error("new handle must not be in an Adornment: "+
          a);this.be=a}},snapAngleMultiple:{get:function(){return this.Ia},set:function(a){this.Ia=a}},snapAngleEpsilon:{get:function(){return this.Ha},set:function(a){this.Ha=a}},originalAngle:{get:function(){return this.gx}},rotationPoint:{get:function(){return this.Pu}},handleAngle:{get:function(){return this.I},set:function(a){this.I=a}},handleDistance:{
        get:function(){return this.Y},set:function(a){this.Y=a}}});Ag.className="RotatingTool";La("rotatingTool",function(){return this.findTool("Rotating")},function(a){this.Va("Rotating",a,this.mouseDownTools)});function Bg(){Be.call(this);this.name="ClickSelecting"}la(Bg,Be);Bg.prototype.canStart=function(){return!this.isEnabled||this.isBeyondDragSize()?!1:!0};
    Bg.prototype.doMouseUp=function(){this.isActive&&(this.standardMouseSelect(),!this.standardMouseClick()&&this.diagram.lastInput.isTouchEvent&&this.diagram.toolManager.doToolTip());this.stopTool()};Bg.className="ClickSelectingTool";function Cg(){Be.call(this);this.name="Action";this.Bk=null}la(Cg,Be);
    Cg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram,b=a.lastInput,c=a.Ub(b.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a});if(null!==c){if(!c.isActionable)return!1;this.Bk=c;a.mj=a.Ub(b.documentPoint,null,null);return!0}return!1};Cg.prototype.doMouseDown=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Bk;null!==b&&(a.targetObject=b,null!==b.actionDown&&b.actionDown(a,b))}else this.canStart()&&this.doActivate()};
    Cg.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Bk;null!==b&&(a.targetObject=b,null!==b.actionMove&&b.actionMove(a,b))}};Cg.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Bk;if(null===b)return;a.targetObject=b;null!==b.actionUp&&b.actionUp(a,b);this.standardMouseClick(function(a){for(;null!==a.panel&&(!a.isActionable||a!==b);)a=a.panel;return a},function(a){return a===b})}this.stopTool()};
    Cg.prototype.doCancel=function(){var a=this.diagram.lastInput,b=this.Bk;null!==b&&(a.targetObject=b,null!==b.actionCancel&&b.actionCancel(a,b),this.stopTool())};Cg.prototype.doStop=function(){this.Bk=null};Cg.className="ActionTool";function Dg(){Be.call(this);this.name="ClickCreating";this.ij=null;this.v=!0;this.l=!1;this.Ww=new I(0,0)}la(Dg,Be);
    Dg.prototype.canStart=function(){if(!this.isEnabled||null===this.archetypeNodeData)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.lastInput.left||this.isBeyondDragSize())return!1;if(this.isDoubleClick){if(1===a.lastInput.clickCount&&(this.Ww=a.lastInput.viewPoint.copy()),2!==a.lastInput.clickCount||this.isBeyondDragSize(this.Ww))return!1}else if(1!==a.lastInput.clickCount)return!1;return a.currentTool!==this&&null!==a.jm(a.lastInput.documentPoint,!0)?!1:!0};
    Dg.prototype.doMouseUp=function(){var a=this.diagram;this.isActive&&this.insertPart(a.lastInput.documentPoint);this.stopTool()};
    Dg.prototype.insertPart=function(a){var b=this.diagram,c=this.archetypeNodeData;if(null===c)return null;var d=null;try{b.R("ChangingSelection",b.selection);this.ua(this.name);if(c instanceof U)c.Wb()&&(wg(c),d=c.copy(),null!==d&&b.add(d));else if(null!==c){var e=b.model.copyNodeData(c);za(e)&&(b.model.qf(e),d=b.wc(e))}if(null!==d){var f=I.allocAt(a.x,a.y);this.isGridSnapEnabled&&Eg(this.diagram,d,a,f);d.location=f;b.allowSelect&&(b.clearSelection(!0),d.isSelected=!0);I.free(f)}b.Na();this.transactionResult=
      this.name;b.R("PartCreated",d)}finally{this.Fg(),b.R("ChangedSelection",b.selection)}return d};ma.Object.defineProperties(Dg.prototype,{archetypeNodeData:{get:function(){return this.ij},set:function(a){this.ij=a}},isDoubleClick:{get:function(){return this.v},set:function(a){this.v=a}},isGridSnapEnabled:{get:function(){return this.l},set:function(a){this.l=a}}});Dg.className="ClickCreatingTool";
    function Fg(){Be.call(this);this.name="DragSelecting";this.Vk=175;this.v=!1;var a=new U;a.layerName="Tool";a.selectable=!1;var b=new Kf;b.name="SHAPE";b.figure="Rectangle";b.fill=null;b.stroke="magenta";a.add(b);this.l=a}la(Fg,Be);
    Fg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(!a.allowSelect)return!1;var b=a.lastInput;return!b.left||a.currentTool!==this&&(!this.isBeyondDragSize()||b.timestamp-a.firstInput.timestamp<this.delay||null!==a.jm(b.documentPoint,!0))?!1:!0};Fg.prototype.doActivate=function(){var a=this.diagram;this.isActive=!0;a.isMouseCaptured=!0;a.skipsUndoManager=!0;a.add(this.box);this.doMouseMove()};
    Fg.prototype.doDeactivate=function(){var a=this.diagram;a.Cf();a.remove(this.box);a.skipsUndoManager=!1;this.isActive=a.isMouseCaptured=!1};Fg.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive&&null!==this.box){var b=this.computeBoxBounds(),c=this.box.Xa("SHAPE");null===c&&(c=this.box.zb());var d=M.alloc().h(b.width,b.height);b=I.allocAt(b.x,b.y);c.desiredSize=d;this.box.position=b;M.free(d);I.free(b);(a.allowHorizontalScroll||a.allowVerticalScroll)&&a.ht(a.lastInput.viewPoint)}};
    Fg.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram;a.remove(this.box);try{a.currentCursor="wait",a.R("ChangingSelection",a.selection),this.selectInRect(this.computeBoxBounds()),a.R("ChangedSelection",a.selection)}finally{a.currentCursor=""}}this.stopTool()};Fg.prototype.computeBoxBounds=function(){var a=this.diagram;return new N(a.firstInput.documentPoint,a.lastInput.documentPoint)};
    Fg.prototype.selectInRect=function(a){var b=this.diagram,c=b.lastInput;a=b.Ox(a,this.isPartialInclusion);if(Wa?c.meta:c.control)if(c.shift)for(a=a.iterator;a.next();)b=a.value,b.isSelected&&(b.isSelected=!1);else for(a=a.iterator;a.next();)b=a.value,b.isSelected=!b.isSelected;else if(c.shift)for(a=a.iterator;a.next();)b=a.value,b.isSelected||(b.isSelected=!0);else{c=new E;for(b=b.selection.iterator;b.next();){var d=b.value;a.contains(d)||c.add(d)}for(b=c.iterator;b.next();)b.value.isSelected=!1;for(a=
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              a.iterator;a.next();)b=a.value,b.isSelected||(b.isSelected=!0)}};ma.Object.defineProperties(Fg.prototype,{delay:{get:function(){return this.Vk},set:function(a){this.Vk=a}},isPartialInclusion:{get:function(){return this.v},set:function(a){this.v=a}},box:{get:function(){return this.l},set:function(a){this.l=a}}});Fg.className="DragSelectingTool";
    function Gg(){Be.call(this);this.name="Panning";this.Mu=new I;this.Fy=new I;this.Kg=!1;var a=this;this.mx=function(){var b=a.diagram;null!==b&&b.removeEventListener(x.document,"scroll",a.mx,!1);a.stopTool()}}la(Gg,Be);Gg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return!a.allowHorizontalScroll&&!a.allowVerticalScroll||!a.lastInput.left||a.currentTool!==this&&!this.isBeyondDragSize()?!1:!0};
    Gg.prototype.doActivate=function(){var a=this.diagram;this.Kg?(a.lastInput.bubbles=!0,a.addEventListener(x.document,"scroll",this.mx,!1)):(a.currentCursor="move",a.isMouseCaptured=!0,this.Mu.assign(a.position));this.isActive=!0};Gg.prototype.doDeactivate=function(){var a=this.diagram;a.currentCursor="";this.isActive=a.isMouseCaptured=!1};Gg.prototype.doCancel=function(){var a=this.diagram;a.position=this.Mu;a.isMouseCaptured=!1;this.stopTool()};Gg.prototype.doMouseMove=function(){this.move()};
    Gg.prototype.doMouseUp=function(){this.move();this.stopTool()};Gg.prototype.move=function(){var a=this.diagram;if(this.isActive&&a)if(this.Kg)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.Fy.h(e,c)}};
    ma.Object.defineProperties(Gg.prototype,{bubbles:{get:function(){return this.Kg},set:function(a){this.Kg=a}},originalPosition:{get:function(){return this.Mu}}});Gg.className="PanningTool";La("clickCreatingTool",function(){return this.findTool("ClickCreating")},function(a){this.Va("ClickCreating",a,this.mouseUpTools)});La("clickSelectingTool",function(){return this.findTool("ClickSelecting")},function(a){this.Va("ClickSelecting",a,this.mouseUpTools)});
    La("panningTool",function(){return this.findTool("Panning")},function(a){this.Va("Panning",a,this.mouseMoveTools)});La("dragSelectingTool",function(){return this.findTool("DragSelecting")},function(a){this.Va("DragSelecting",a,this.mouseMoveTools)});La("actionTool",function(){return this.findTool("Action")},function(a){this.Va("Action",a,this.mouseDownTools)});function Pe(){this.Y=this.I=this.l=this.v=null}
    ma.Object.defineProperties(Pe.prototype,{mainElement:{get:function(){return this.I},set:function(a){this.I=a}},show:{get:function(){return this.v},set:function(a){this.v!==a&&(this.v=a)}},hide:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a)}},valueFunction:{get:function(){return this.Y},set:function(a){this.Y=a}}});Pe.className="HTMLInfo";
    function Hg(a,b,c){this.text=a;this.Cx=b;this.visible=c}Hg.className="ContextMenuButtonInfo";function Ig(){Be.call(this);this.name="ContextMenu";this.v=this.eu=this.l=null;this.ax=new I;this.fu=null;this.zu=!1;var a=this;this.Zu=function(){a.stopTool()}}la(Ig,Be);
    function Jg(a){var b=new Pe;b.show=function(a,b,c){c.showDefaultContextMenu()};b.hide=function(a,b){b.hideDefaultContextMenu()};Kg=b;a.Zu=function(){a.stopTool()};b=ta("div");var c=ta("div");b.style.cssText="top: 0px;z-index:10002;position: fixed;display: none;text-align: center;left: 25%;width: 50%;background-color: #F5F5F5;padding: 16px;border: 16px solid #444;border-radius: 10px;margin-top: 10px";c.style.cssText="z-index:10001;position: fixed;display: none;top: 0;left: 0;width: 100%;height: 100%;background-color: black;opacity: 0.8;";
      var d=ta("style");x.document.getElementsByTagName("head")[0].appendChild(d);d.sheet.insertRule(".goCXul { list-style: none; }",0);d.sheet.insertRule(".goCXli {font:700 1.5em Helvetica, Arial, sans-serif;position: relative;min-width: 60px; }",0);d.sheet.insertRule(".goCXa {color: #444;display: inline-block;padding: 4px;text-decoration: none;margin: 2px;border: 1px solid gray;border-radius: 10px; }",0);d=a.diagram;null!==d&&(d.addEventListener(b,"contextmenu",Lg,!1),d.addEventListener(b,"selectstart",
        Lg,!1),d.addEventListener(c,"contextmenu",Lg,!1));b.className="goCXforeground";c.className="goCXbackground";x.document.body&&(x.document.body.appendChild(b),x.document.body.appendChild(c));Mg=b;Ng=c;Og=!0}function Lg(a){a.preventDefault();return!1}Ig.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return this.isBeyondDragSize()||!a.lastInput.right?!1:a.lastInput.isTouchEvent&&null!==this.defaultTouchContextMenu||null!==this.findObjectWithContextMenu()?!0:!1};
    Ig.prototype.doStart=function(){this.ax.set(this.diagram.firstInput.documentPoint)};Ig.prototype.doStop=function(){this.hideContextMenu();this.currentObject=null};
    Ig.prototype.findObjectWithContextMenu=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.lastInput,d=null;a instanceof R||(a instanceof Y?d=a:d=b.Ub(c.documentPoint,null,function(a){return!a.layer.isTemporary}));if(null!==d){for(a=d;null!==a;){if(null!==a.contextMenu)return a;a=a.panel}if(b.lastInput.isTouchEvent&&this.defaultTouchContextMenu)return d.part}else if(null!==b.contextMenu)return b;return null};Ig.prototype.doActivate=function(){};
    Ig.prototype.doMouseDown=function(){Be.prototype.doMouseDown.call(this);if(this.isActive&&this.currentContextMenu instanceof Ke){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doMouseDown(),a.doDeactivate())}this.diagram.toolManager.mouseDownTools.contains(this)&&Pg(this)};
    Ig.prototype.doMouseUp=function(){if(this.isActive&&this.currentContextMenu instanceof Ke){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doCancel(),a.doDeactivate())}Pg(this)};
    function Pg(a){var b=a.diagram;if(a.isActive){var c=a.currentContextMenu;if(null!==c){if(!(c instanceof Pe)){var d=b.Ub(b.lastInput.documentPoint,null,null);null!==d&&d.Bg(c)&&a.standardMouseClick(null,null)}a.stopTool();a.canStart()&&(b.currentTool=a,a.doMouseUp())}}else a.canStart()&&(Qg(a,!0),a.isActive||a.stopTool())}
    function Qg(a,b,c){void 0===c&&(c=null);if(!a.zu&&(a.zu=!0,b&&a.standardMouseSelect(),b=a.standardMouseClick(),a.zu=!1,!b))if(a.isActive=!0,b=Kg,null===c&&(c=a.findObjectWithContextMenu()),null!==c){var d=c.contextMenu;null!==d?(a.currentObject=c instanceof Y?c:null,a.showContextMenu(d,a.currentObject)):null!==b&&a.showContextMenu(b,a.currentObject)}else null!==b&&a.showContextMenu(b,null)}
    Ig.prototype.doMouseMove=function(){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.doMouseMove();this.isActive&&this.diagram.toolManager.doMouseMove()};
    Ig.prototype.showContextMenu=function(a,b){var c=this.diagram;a!==this.currentContextMenu&&this.hideContextMenu();if(a instanceof Ke){a.layerName="Tool";a.selectable=!1;a.scale=1/c.scale;a.category=this.name;null!==a.placeholder&&(a.placeholder.scale=c.scale);var d=a.diagram;null!==d&&d!==c&&d.remove(a);c.add(a);null!==b?a.adornedObject=b:a.data=c.model;a.yb();this.positionContextMenu(a,b)}else a instanceof Pe&&a.show(b,c,this);this.currentContextMenu=a};
    Ig.prototype.positionContextMenu=function(a){if(null===a.placeholder){var b=this.diagram,c=b.lastInput.documentPoint.copy(),d=a.measuredBounds,e=b.viewportBounds;b.lastInput.isTouchEvent&&(c.x-=d.width);c.x+d.width>e.right&&(c.x-=d.width+5/b.scale);c.x<e.x&&(c.x=e.x);c.y+d.height>e.bottom&&(c.y-=d.height+5/b.scale);c.y<e.y&&(c.y=e.y);a.position=c}};
    Ig.prototype.hideContextMenu=function(){var a=this.diagram,b=this.currentContextMenu;null!==b&&(b instanceof Ke?(a.remove(b),null!==this.eu&&this.eu.Af(b.category),b.data=null,b.adornedObject=null):b instanceof Pe&&(null!==b.hide?b.hide(a,this):null!==b.mainElement&&(b.mainElement.style.display="none")),this.currentContextMenu=null,this.standardMouseOver())};
    function Rg(a){var b=new E;b.add(new Hg("Copy",function(a){a.commandHandler.copySelection()},function(a){return a.commandHandler.canCopySelection()}));b.add(new Hg("Cut",function(a){a.commandHandler.cutSelection()},function(a){return a.commandHandler.canCutSelection()}));b.add(new Hg("Delete",function(a){a.commandHandler.deleteSelection()},function(a){return a.commandHandler.canDeleteSelection()}));b.add(new Hg("Paste",function(b){b.commandHandler.pasteSelection(a.mouseDownPoint)},function(b){return b.commandHandler.canPasteSelection(a.mouseDownPoint)}));
      b.add(new Hg("Select All",function(a){a.commandHandler.selectAll()},function(a){return a.commandHandler.canSelectAll()}));b.add(new Hg("Undo",function(a){a.commandHandler.undo()},function(a){return a.commandHandler.canUndo()}));b.add(new Hg("Redo",function(a){a.commandHandler.redo()},function(a){return a.commandHandler.canRedo()}));b.add(new Hg("Scroll To Part",function(a){a.commandHandler.scrollToPart()},function(a){return a.commandHandler.canScrollToPart()}));b.add(new Hg("Zoom To Fit",function(a){a.commandHandler.zoomToFit()},
        function(a){return a.commandHandler.canZoomToFit()}));b.add(new Hg("Reset Zoom",function(a){a.commandHandler.resetZoom()},function(a){return a.commandHandler.canResetZoom()}));b.add(new Hg("Group Selection",function(a){a.commandHandler.groupSelection()},function(a){return a.commandHandler.canGroupSelection()}));b.add(new Hg("Ungroup Selection",function(a){a.commandHandler.ungroupSelection()},function(a){return a.commandHandler.canUngroupSelection()}));b.add(new Hg("Edit Text",function(a){a.commandHandler.editTextBlock()},
        function(a){return a.commandHandler.canEditTextBlock()}));return b}
    Ig.prototype.showDefaultContextMenu=function(){var a=this.diagram;null===this.fu&&(this.fu=Rg(this));Mg.innerHTML="";Ng.addEventListener("click",this.Zu,!1);var b=this,c=ta("ul");c.className="goCXul";Mg.appendChild(c);c.innerHTML="";for(var d=this.fu.iterator;d.next();){var e=d.value,f=e.visible;if("function"===typeof e.Cx&&("function"!==typeof f||f(a))){f=ta("li");f.className="goCXli";var g=ta("a");g.className="goCXa";g.href="#";g.zy=e.Cx;g.addEventListener("click",function(c){this.zy(a);b.stopTool();
      c.preventDefault();return!1},!1);g.textContent=e.text;f.appendChild(g);c.appendChild(f)}}Mg.style.display="block";Ng.style.display="block"};Ig.prototype.hideDefaultContextMenu=function(){if(null!==this.currentContextMenu&&this.currentContextMenu===Kg){Mg.style.display="none";Ng.style.display="none";var a=this.diagram;null!==a&&a.removeEventListener(Ng,"click",this.Zu,!1);this.currentContextMenu=null}};
    ma.Object.defineProperties(Ig.prototype,{currentContextMenu:{get:function(){return this.l},set:function(a){this.l=a;this.eu=a instanceof Ke?a.adornedPart:null}},defaultTouchContextMenu:{get:function(){!1===Og&&null===Kg&&Sg&&Jg(this);return Kg},set:function(a){null===a&&(Og=!0);Kg=a}},currentObject:{get:function(){return this.v},set:function(a){this.v=a}},mouseDownPoint:{get:function(){return this.ax}}});
    var Kg=null,Og=!1,Ng=null,Mg=null;Ig.className="ContextMenuTool";La("contextMenuTool",function(){return this.findTool("ContextMenu")},function(a){this.Va("ContextMenu",a,this.mouseUpTools)});function Tg(){Be.call(this);this.name="TextEditing";this.th=new Ug;this.Ia=null;this.Ha=Vg;this.Ji=null;this.ia=Wg;this.I=1;this.Y=!0;this.v=null;this.l=new Pe;this.ju=null;Xg(this,this.l)}la(Tg,Be);
    function Xg(a,b){if(Sg){var c=ta("textarea");a.ju=c;c.addEventListener("input",function(){if(null!==a.textBlock){var b=a.Yx(this.value);this.style.width=20+b.measuredBounds.width*this.AA+"px";this.rows=b.lineCount}},!1);c.addEventListener("keydown",function(b){if(null!==a.textBlock){var c=b.which;13===c?(!1===a.textBlock.isMultiline&&b.preventDefault(),a.acceptText(Yg)):9===c?(a.acceptText(Zg),b.preventDefault()):27===c&&(a.doCancel(),null!==a.diagram&&a.diagram.doFocus())}},!1);c.addEventListener("focus",
      function(){if(null!==a.currentTextEditor&&a.state!==Wg){var b=a.ju;a.ia===$g&&(a.ia=ah);"function"===typeof b.select&&a.selectsTextOnActivate&&(b.select(),b.setSelectionRange(0,9999))}},!1);c.addEventListener("blur",function(){if(null!==a.currentTextEditor&&a.state!==Wg){var b=a.ju;"function"===typeof b.focus&&b.focus();"function"===typeof b.select&&a.selectsTextOnActivate&&(b.select(),b.setSelectionRange(0,9999))}},!1);b.valueFunction=function(){return c.value};b.mainElement=c;b.show=function(a,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         b,f){if(a instanceof Ug&&f instanceof Tg)if(f.state===bh)c.style.border="3px solid red",c.focus();else{var d=a.ga(Ac),e=b.position,k=b.scale,l=a.vf()*k;l<f.minimumEditorScale&&(l=f.minimumEditorScale);var m=a.naturalBounds.width*l+6,n=a.naturalBounds.height*l+2,p=(d.x-e.x)*k;d=(d.y-e.y)*k;c.value=a.text;b.div.style.font=a.font;c.style.position="absolute";c.style.zIndex="100";c.style.font="inherit";c.style.fontSize=100*l+"%";c.style.lineHeight="normal";c.style.width=m+"px";c.style.left=(p-m/2|0)-1+
      "px";c.style.top=(d-n/2|0)-1+"px";c.style.textAlign=a.textAlign;c.style.margin="0";c.style.padding="1px";c.style.border="0";c.style.outline="none";c.style.whiteSpace="pre-wrap";c.style.overflow="hidden";c.rows=a.lineCount;c.AA=l;c.className="goTXarea";b.div.appendChild(c);c.focus();f.selectsTextOnActivate&&(c.select(),c.setSelectionRange(0,9999))}};b.hide=function(a){a.div.removeChild(c)}}}
    Tg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(null===a||a.isReadOnly||ch&&ch!==this&&(ch.acceptText(dh),ch&&ch!==this)||!a.lastInput.left||this.isBeyondDragSize())return!1;var b=a.Ub(a.lastInput.documentPoint);if(!(null!==b&&b instanceof Ug&&b.editable&&b.part.canEdit()))return!1;b=b.part;return null===b||this.starting===Vg&&!b.isSelected||this.starting===eh&&2>a.lastInput.clickCount?!1:!0};Tg.prototype.doStart=function(){ch=this;null!==this.textBlock&&this.doActivate()};
    Tg.prototype.doActivate=function(){if(!this.isActive){var a=this.diagram;if(null!==a){var b=this.textBlock;null===b&&(b=a.Ub(a.lastInput.documentPoint));if(null!==b&&b instanceof Ug&&(this.textBlock=b,null!==b.part)){this.isActive=!0;this.ia=$g;var c=this.defaultTextEditor;null!==b.textEditor&&(c=b.textEditor);this.th=this.textBlock.copy();var d=new N(this.textBlock.ga(vc),this.textBlock.ga(Gc));a.fw(d);c.show(b,a,this);this.currentTextEditor=c}}}};Tg.prototype.doCancel=function(){this.stopTool()};
    Tg.prototype.doMouseUp=function(){this.canStart()&&this.doActivate()};Tg.prototype.doMouseDown=function(){this.isActive&&this.acceptText(dh)};Tg.prototype.acceptText=function(a){switch(a){case dh:if(this.ia===fh)this.currentTextEditor instanceof HTMLElement&&this.currentTextEditor.focus();else if(this.ia===$g||this.ia===bh||this.ia===ah)this.ia=gh,hh(this);break;case ih:case Yg:case Zg:if(Yg!==a||!0!==this.textBlock.isMultiline)if(this.ia===$g||this.ia===bh||this.ia===ah)this.ia=gh,hh(this)}};
    function hh(a){var b=a.textBlock,c=a.diagram,d=a.currentTextEditor;if(null!==b&&null!==d){var e=b.text,f="";null!==d.valueFunction&&(f=d.valueFunction());if(a.isValidText(b,e,f))a.ua(a.name),a.ia=fh,a.transactionResult=a.name,b.text=f,d=a.textBlock,null!==d.textEdited&&d.textEdited(d,e,f),null!==c&&c.R("TextEdited",b,e),a.Fg(),a.stopTool(),null!==c&&c.doFocus();else{a.ia=bh;var g=a.textBlock;null!==g.errorFunction&&g.errorFunction(a,e,f);d.show(b,c,a)}}}
    Tg.prototype.doDeactivate=function(){var a=this.diagram;null!==a&&(this.ia=Wg,this.textBlock=null,null!==this.currentTextEditor&&this.currentTextEditor.hide(a,this),this.isActive=!1)};Tg.prototype.doStop=function(){ch=null};Tg.prototype.isValidText=function(a,b,c){var d=this.textValidation;if(null!==d&&!d(a,b,c))return!1;d=a.textValidation;return null===d||d(a,b,c)?!0:!1};Tg.prototype.Yx=function(a){var b=this.th;b.text=a;b.measure(this.textBlock.ti,Infinity);return b};
    ma.Object.defineProperties(Tg.prototype,{textBlock:{get:function(){return this.Ia},set:function(a){this.Ia=a}},currentTextEditor:{get:function(){return this.v},set:function(a){this.v=a}},defaultTextEditor:{get:function(){return this.l},set:function(a){this.l=a}},starting:{get:function(){return this.Ha},set:function(a){this.Ha=a}},textValidation:{get:function(){return this.Ji},
        set:function(a){this.Ji=a}},minimumEditorScale:{get:function(){return this.I},set:function(a){this.I=a}},selectsTextOnActivate:{get:function(){return this.Y},set:function(a){this.Y=a}},state:{get:function(){return this.ia},set:function(a){this.ia!==a&&(this.ia=a)}}});Tg.prototype.measureTemporaryTextBlock=Tg.prototype.Yx;
    var ih=new D(Tg,"LostFocus",0),dh=new D(Tg,"MouseDown",1),Zg=new D(Tg,"Tab",2),Yg=new D(Tg,"Enter",3),vh=new D(Tg,"SingleClick",0),Vg=new D(Tg,"SingleClickSelected",1),eh=new D(Tg,"DoubleClick",2),Wg=new D(Tg,"StateNone",0),$g=new D(Tg,"StateActive",1),ah=new D(Tg,"StateEditing",2),gh=new D(Tg,"StateValidating",3),bh=new D(Tg,"StateInvalid",4),fh=new D(Tg,"StateValidated",5),ch=null;Tg.className="TextEditingTool";Tg.LostFocus=ih;Tg.MouseDown=dh;Tg.Tab=Zg;Tg.Enter=Yg;Tg.SingleClick=vh;
    Tg.SingleClickSelected=Vg;Tg.DoubleClick=eh;Tg.StateNone=Wg;Tg.StateActive=$g;Tg.StateEditing=ah;Tg.StateValidating=gh;Tg.StateInvalid=bh;Tg.StateValidated=fh;La("textEditingTool",function(){return this.findTool("TextEditing")},function(a){this.Va("TextEditing",a,this.mouseUpTools)});
    function wh(){xh||(yh(),xh=!0);this.B=Ce;this.gl=this.$e=this.qc=this.Tr=this.hc=!1;this.sx=!0;this.hl=zh;this.bn=!1;this.oi=this.Mc=!0;this.Sg=600;this.Ow=this.qx=!1;this.Le=new F;this.Bd=new Ah;this.Bd.Jc=this;this.Ck=new F;this.Wu=new F;this.Ts=new F}wh.prototype.Zd=function(a){this.B=a};wh.prototype.canStart=function(){return!0};function Bh(a,b){Ch(a,b)&&(a.$e=!0)}function Ch(a,b){if(!a.Mc||!a.canStart(b))return!1;a.Le.add(b);a.defaultAnimation.isAnimating&&a.Xc();return a.qc=!0}
    function Dh(a){if(a.Mc&&a.qc){var b=a.Bd,c=a.B,d=a.Le.contains("Model");d&&(a.gl=!0,a.hl===zh?(b.isViewportUnconstrained=!0,b.pc.clear(),b.add(c,"position",c.position.copy().offset(0,-200),c.position),b.add(c,"opacity",0,1)):a.hl===Eh&&b.pc.clear(),a.sx=a.hl===Fh&&c.As.w(c.ma)?!0:!1,c.R("InitialAnimationStarting",a));d&&!a.oi||0===b.pc.count?(a.Le.clear(),a.qc=!1,a.$e=!1,b.pc.clear(),Gh(b),a.gl=!1,c.M()):(a.Le.clear(),c.xe=!1,x.requestAnimationFrame(function(){!1===a.qc||b.hc||(c.Ce("temporaryPixelRatio")&&
    Ve(c),Hh(c),a.qc=!1,a.$e=!1,b.start(),Ih(a),c.Na(),Jh(b,0),Hf(c,!0),Kh(a),c.R("AnimationStarting",a))}))}}function Lh(a,b,c,d){b instanceof S&&(null!==b.fromNode||null!==b.toNode)||a.Bd.add(b,"position",c,d,!1)}t=wh.prototype;t.Et=function(a){return this.Bd.Et(a)};t.Jv=function(a){return this.Bd.Jv(a)};
    function Mh(a,b){function c(){0<e.Ts.count&&(d.addAll(e.Ts),e.Ts.clear(),e.hc=!0);if(!1!==e.hc&&0!==d.count){e.Wu.addAll(d);for(var a=e.Wu.iterator;a.next();){var b=a.value;if(!1!==b.hc){a:if(0<b.Xl.count)var h=!0;else{for(h=b.pc.iterator;h.next();){var k=h.key;if(k instanceof Y&&null!==k.diagram||k instanceof R){h=!0;break a}}h=!1}h?Nh(b,!1):b.pl=!0}}e.Wu.clear();Ih(e);Hf(e.B);Kh(e);x.requestAnimationFrame(c)}}var d=a.Ck,e=a;a.hc?a.Ts.add(b):(a.hc=!0,d.add(b),x.requestAnimationFrame(function(){c()}))}
    function Oh(a){for(a=a.Ck.iterator;a.next();)a.value.pl=!1}function Ih(a){if(!a.Tr){var b=a.B;a.qx=b.skipsUndoManager;a.Ow=b.skipsModelSourceBindings;b.skipsUndoManager=!0;b.skipsModelSourceBindings=!0;a.Tr=!0}}function Kh(a){var b=a.B;b.skipsUndoManager=a.qx;b.skipsModelSourceBindings=a.Ow;a.Tr=!1}
    t.Xc=function(a){var b=this.Bd;!0===this.qc&&(this.gl=this.$e=this.qc=!1,this.Le.clear(),0<b.pc.count&&this.B.Pb());if(this.hc&&this.Mc){if(b.gm(!0),b.pc.clear(),Gh(b),!0===a)for(a=this.Ck.na(),b=0;b<a.length;b++)a[b].gm(!0)}else b.pc.clear(),Gh(b)};t.gm=function(a){a===this.defaultAnimation&&this.defaultAnimation.pc.clear();this.Ck.remove(a);0===this.Ck.count&&(this.hc=!1,this.B.Pb());a===this.defaultAnimation&&(this.defaultAnimation.pc.clear(),this.B.R("AnimationFinished",this))};
    t.Vj=function(a,b){this.$e&&(this.Le.contains("Expand Tree")||this.Le.contains("Expand SubGraph"))&&this.Bd.Vj(a,b)};t.Tj=function(a,b){this.$e&&(this.Le.contains("Collapse Tree")||this.Le.contains("Collapse SubGraph"))&&(this.Bd.Tj(a,b),Ph(this.Bd,b,"position",b.position,b.position))};function Qh(a,b,c){a.$e&&!b.w(c)&&(a.B.kk||(b=c.copy()),Ph(a.Bd,a.B,"position",b,c))}
    function Rh(a,b,c,d,e){null===a&&(a="rgba(0,0,0,0)");null===b&&(b="rgba(0,0,0,0)");Sh(a);Th();var f=Uh.l,g=Uh.I,h=Uh.v;a=Uh.Y;Sh(b);Th();var k=Uh.I,l=Uh.v;b=Uh.Y;f=e(c,f,Uh.l-f,d);g=e(c,g,k-g,d);h=e(c,h,l-h,d);c=e(c,a,b-a,d);return"hsla("+f+", "+g+"%, "+h+"%, "+c+")"}
    function yh(){var a=new G;a.add("position:diagram",function(a,c,d,e,f,g){a.position=new I(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g))});a.add("position",function(a,c,d,e,f,g){f<g?a.Kq(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g),!1):a.position=new I(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g))});a.add("location",function(a,c,d,e,f,g){f<g?a.Kq(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g),!0):a.location=new I(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g))});a.add("position:placeholder",function(a,c,d,e,f,g){f<g?a.Kq(e(f,c.x,d.x-c.x,
      g),e(f,c.y,d.y-c.y,g),!1):a.position=new I(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g))});a.add("position:node",function(a,c,d,e,f,g){var b=a.actualBounds,k=d.actualBounds;d=k.x+k.width/2-b.width/2;b=k.y+k.height/2-b.height/2;f<g?a.Kq(e(f,c.x,d-c.x,g),e(f,c.y,b-c.y,g),!1):a.position=new I(e(f,c.x,d-c.x,g),e(f,c.y,b-c.y,g))});a.add("desiredSize",function(a,c,d,e,f,g){a.desiredSize=new N(e(f,c.width,d.width-c.width,g),e(f,c.height,d.height-c.height,g))});a.add("width",function(a,c,d,e,f,g){a.width=e(f,c,
      d-c,g)});a.add("height",function(a,c,d,e,f,g){a.height=e(f,c,d-c,g)});a.add("fill",function(a,c,d,e,f,g){a.fill=Rh(c,d,f,g,e)});a.add("stroke",function(a,c,d,e,f,g){a.stroke=Rh(c,d,f,g,e)});a.add("strokeWidth",function(a,c,d,e,f,g){a.strokeWidth=e(f,c,d-c,g)});a.add("strokeDashOffset",function(a,c,d,e,f,g){a.strokeDashOffset=e(f,c,d-c,g)});a.add("background",function(a,c,d,e,f,g){a.background=Rh(c,d,f,g,e)});a.add("areaBackground",function(a,c,d,e,f,g){a.areaBackground=Rh(c,d,f,g,e)});a.add("opacity",
      function(a,c,d,e,f,g){a.opacity=e(f,c,d-c,g)});a.add("scale",function(a,c,d,e,f,g){a.scale=e(f,c,d-c,g)});a.add("angle",function(a,c,d,e,f,g){a.angle=e(f,c,d-c,g)});Vh=a}
    ma.Object.defineProperties(wh.prototype,{animationReasons:{get:function(){return this.Le}},isEnabled:{get:function(){return this.Mc},set:function(a){this.Mc=a}},duration:{get:function(){return this.Sg},set:function(a){1>a&&va(a,">= 1",wh,"duration");this.Sg=a}},isAnimating:{get:function(){return this.hc}},isTicking:{get:function(){return this.Tr}},isInitial:{
        get:function(){return this.oi},set:function(a){this.oi=a}},defaultAnimation:{get:function(){return this.Bd}},activeAnimations:{get:function(){return this.Ck}},initialAnimationStyle:{get:function(){return this.hl},set:function(a){this.hl=a}}});wh.prototype.stopAnimation=wh.prototype.Xc;var Vh=null,xh=!1,zh=new D(wh,"Default",1),Fh=new D(wh,"AnimateLocations",2),Eh=new D(wh,"None",3);
    wh.className="AnimationManager";wh.defineAnimationEffect=function(a,b){xh||(yh(),xh=!0);Vh.add(a,b)};wh.Default=zh;wh.AnimateLocations=Fh;wh.None=Eh;function Ah(){this.$u=this.px=this.Jc=this.B=null;this.pl=this.hc=this.l=!1;this.Gn=this.ud=0;this.nr=this.mu=Wh;this.ol=this.lp=!1;this.Qu=1;this.Ou=0;this.nd=this.Sg=NaN;this.Rw=0;this.Hn=null;this.v=Gb;this.pc=new G;this.Ku=new G;this.Xl=new F;this.Lu=new F;this.Pw=Xh}Ah.prototype.suspend=function(){this.pl=!0};
    Ah.prototype.advanceTo=function(a,b){b&&(this.pl=!1);this.lp&&a>=this.nd&&(this.ol=!0,a-=this.nd);this.Rw=a;Nh(this,!0);Ih(this.Jc);Hf(this.B);Kh(this.Jc);this.B.Fe()};function Gh(a){a.Ku.clear();a.ol=!1;a.Ou=0;a.nd=NaN;0<a.Xl.count&&a.Xl.clear();0<a.Lu.count&&a.Lu.clear()}t=Ah.prototype;
    t.start=function(){if(0!==this.pc.count&&!this.hc){for(var a=this.B,b=this.pc.iterator;b.next();){var c=b.value.end,d=b.key;if(c["position:placeholder"]){var e=d.findVisibleNode();if(e instanceof T&&null!==e.placeholder){var f=e.placeholder;e=f.ga(vc);f=f.padding;e.x+=f.left;e.y+=f.top;c["position:placeholder"]=e}}null===a&&(d instanceof R?a=d:d instanceof Y&&(a=d.diagram))}null!==a&&(this.B=a,b=this.Jc=a.animationManager,this.nd=isNaN(this.Sg)?b.duration:this.Sg,this.nr=this.mu,b.gl&&b.hl===zh&&
    this===b.defaultAnimation&&(this.nr=Yh,this.nd=isNaN(this.Sg)?600===b.duration?900:b.duration:this.Sg),this.Pw=a.scrollMode,this.isViewportUnconstrained&&(a.Gi=Zh),Ih(b),this.Xl.each(function(b){b.data=null;a.add(b)}),Kh(b),this.hc=!0,this.ud=+new Date,this.Gn=this.ud+this.nd,Mh(b,this))}};t.Ny=function(a,b){a.Wb()&&(this.Xl.add(a),this.B=b)};
    t.add=function(a,b,c,d,e){"position"===b&&c.w(d)||(null===this.B&&(a instanceof R?this.B=a:a instanceof Y&&null!==a.diagram&&(this.B=a.diagram)),a instanceof U&&!a.isAnimated||Ph(this,a,b,c,d,e))};
    function Ph(a,b,c,d,e,f){var g=a.pc;b instanceof R&&"position"===c&&(c="position:diagram");if(g.contains(b)){var h=g.H(b);var k=h.start;var l=h.end;void 0===k[c]&&(k[c]=$h(d));l[c]=$h(e)}else k={},l={},k[c]=$h(d),l[c]=$h(e),h=k.position,b instanceof Y&&h instanceof I&&!h.u()&&b.diagram.animationManager.Le.contains("Expand SubGraph")&&h.assign(l.position),h=new ai(k,l,f),g.add(b,h);g=k[c];g instanceof I&&!g.u()&&g.assign(a.v);f&&0===c.indexOf("position:")&&b instanceof U?h.sv.location=$h(b.location):
      f&&(h.sv[c]=$h(d))}function $h(a){return a instanceof I?a.copy():a instanceof M?a.copy():a}t.Et=function(a){if(!this.hc)return!1;a=this.pc.H(a);return null!==a&&a.Xv};t.Jv=function(a){if(!this.hc)return!1;a=this.pc.H(a);return null!==a&&(a.start.position||a.start.location)};
    function Nh(a,b){if(!a.pl||b){var c=a.Jc;if(!1!==a.hc){var d=+new Date,e=d>a.Gn?a.nd:d-a.ud;b&&(e=a.Rw,e<a.nd?(a.ud=+new Date-e,a.Gn=a.ud+a.nd):e=a.nd);Ih(c);Jh(a,e);Hf(a.B,!0);Kh(c);d>a.Gn&&(a.lp&&!a.ol?(a.ud=+new Date,a.Gn=a.ud+a.nd,a.ol=!0):a.gm(!1))}}}
    function Jh(a,b){for(var c=a.nd,d=a.pc.iterator,e=a.ol;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=Vh,l;for(l in g)"position"===l&&(g["position:placeholder"]||g["position:node"])||null===k.get(l)||k.get(l)(f,h[l],g[l],a.nr,b,c,a)}}}t.stop=function(){this.hc&&this.gm(!0)};
    t.gm=function(a){null!==this.$u&&this.$u.sp.remove(this.px);if(this.hc){var b=this.B,c=this.Jc;this.pl=this.hc=c.gl=!1;Ih(c);for(var d=this.pc,e=this.Xl.iterator;e.next();)b.remove(e.value);for(e=this.Lu.iterator;e.next();)e.value.o();e=this.lp;d=d.iterator;for(var f=Vh;d.next();){var g=d.key,h=d.value,k=e?h.end:h.start,l=e?h.start:h.end,m=h.sv,n;for(n in l)if(null!==f.get(n)){var p=n;!h.nv||"position:node"!==p&&"position:placeholder"!==p||(p="position");f.get(p)(g,k[n],void 0!==m[n]?m[n]:h.nv?k[n]:
      l[n],this.nr,this.nd,this.nd,this)}h.nv&&void 0!==m.location&&g instanceof U&&(g.location=m.location);h.Xv&&g instanceof U&&g.Ob(!1)}if(c.defaultAnimation===this)for(n=this.B.links;n.next();)e=n.value,null===e.mh?(d=e.path,null!==d&&(e.ld=!1,e.o(),d.o())):(e.points=e.mh,e.mh=null);b.zt.clear();jf(b,!1);b.Na();b.M();Hf(b,!0);this.isViewportUnconstrained&&(b.scrollMode=this.Pw);Kh(c);this.Ou++;!a&&this.Qu>this.Ou?(this.ol=!1,this.start()):(this.Hn&&this.Hn(this),Gh(this),c.gm(this),b.Pb())}};
    t.Vj=function(a,b){var c=b.actualBounds,d=null;b instanceof T&&(d=b.placeholder);null!==d?(c=d.ga(vc),d=d.padding,c.x+=d.left,c.y+=d.top,this.add(a,"position",c,a.position,!1)):this.add(a,"position",new I(c.x+c.width/2,c.y+c.height/2),a.position,!1);this.add(a,"scale",.01,a.scale,!1);if(a instanceof T)for(a=a.memberParts;a.next();)d=a.value,d instanceof W&&this.Vj(d,b)};
    t.Tj=function(a,b){if(a.isVisible()){var c=null;b instanceof T&&(c=b.placeholder);null!==c?this.add(a,"position:placeholder",a.position,c,!0):this.add(a,"position:node",a.position,b,!0);this.add(a,"scale",a.scale,.01,!0);c=this.pc;c.contains(a)&&(c.H(a).Xv=!0);if(a instanceof T)for(a=a.memberParts;a.next();)c=a.value,c instanceof W&&this.Tj(c,b)}};t.Jz=function(a){var b=this.Ku.get(a);null===b&&(b={},this.Ku.add(a,b));return b};
    ma.Object.defineProperties(Ah.prototype,{duration:{get:function(){return this.Sg},set:function(a){1>a&&va(a,">= 1",Ah,"duration");this.Sg=a}},reversible:{get:function(){return this.lp},set:function(a){this.lp=a}},runCount:{get:function(){return this.Qu},set:function(a){0<a?this.Qu=a:B("Animation.runCount value must be a positive integer.")}},finished:{get:function(){return this.Hn},
        set:function(a){this.Hn!==a&&(this.Hn=a)}},easing:{get:function(){return this.mu},set:function(a){this.mu=a}},isViewportUnconstrained:{get:function(){return this.l},set:function(a){this.l=a}},isAnimating:{get:function(){return this.hc}}});Ah.prototype.getTemporaryState=Ah.prototype.Jz;Ah.prototype.stop=Ah.prototype.stop;Ah.prototype.add=Ah.prototype.add;Ah.prototype.addTemporaryPart=Ah.prototype.Ny;
    function Wh(a,b,c,d){a/=d/2;return 1>a?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b}function Yh(a,b,c,d){return a===d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b}Ah.className="Animation";Ah.EaseLinear=function(a,b,c,d){return c*a/d+b};Ah.EaseInOutQuad=Wh;Ah.EaseInQuad=function(a,b,c,d){return c*(a/=d)*a+b};Ah.EaseOutQuad=function(a,b,c,d){return-c*(a/=d)*(a-2)+b};Ah.EaseInExpo=function(a,b,c,d){return 0===a?b:c*Math.pow(2,10*(a/d-1))+b};Ah.EaseOutExpo=Yh;
    function ai(a,b,c){this.start=a;this.end=b;this.sv={};this.nv=c;this.Xv=!1}ai.className="AnimationState";function bi(a,b,c){this.bd=null;this.bf=a;this.Mp=c||ci;this.Hk=null;void 0!==b&&(this.Hk=b,void 0===c&&(this.Mp=di))}bi.prototype.copy=function(){var a=new bi(this.bf);a.Mp=this.Mp;var b=this.Hk;if(null!==b){var c={};void 0!==b.duration&&(c.Jx=b.duration);void 0!==b.finished&&(c.Jx=b.finished);void 0!==b.easing&&(c.Jx=b.easing);a.Hk=c}return a};
    function ei(a,b){a=a.Hk;null!==a&&(a.duration&&(b.duration=a.duration),a.finished&&(b.finished=a.finished),a.easing&&(b.easing=a.easing))}ma.Object.defineProperties(bi.prototype,{propertyName:{get:function(){return this.bf},set:function(a){this.bf=a}},animationSettings:{get:function(){return this.Hk},set:function(a){this.Hk=a}},startCondition:{get:function(){return this.Mp},set:function(a){this.Mp=a}}});
    var ci=new D(bi,"Default",1),di=new D(bi,"Immediate",2),fi=new D(bi,"Bundled",3);bi.className="AnimationTrigger";bi.Default=ci;bi.Immediate=di;bi.Bundled=fi;function gi(){Ya(this);this.B=null;this.Ca=new E;this.Qa="";this.qb=1;this.v=!1;this.Bi=this.I=this.$h=this.Zh=this.Yh=this.Xh=this.Vh=this.Wh=this.Uh=this.bi=this.Th=this.ai=this.Sh=this.Rh=!0;this.l=!1;this.Yo=[]}t=gi.prototype;t.clear=function(){this.Ca.clear();this.Yo.length=0};t.Zd=function(a){this.B=a};
    t.toString=function(a){void 0===a&&(a=0);var b='Layer "'+this.name+'"';if(0>=a)return b;for(var c=0,d=0,e=0,f=0,g=0,h=this.Ca.iterator;h.next();){var k=h.value;k instanceof T?e++:k instanceof W?d++:k instanceof S?f++:k instanceof Ke?g++:c++}h="";0<c&&(h+=c+" Parts ");0<d&&(h+=d+" Nodes ");0<e&&(h+=e+" Groups ");0<f&&(h+=f+" Links ");0<g&&(h+=g+" Adornments ");if(1<a)for(a=this.Ca.iterator;a.next();)c=a.value,h+="\n    "+c.toString(),d=c.data,null!==d&&lb(d)&&(h+=" #"+lb(d)),c instanceof W?h+=" "+
      Ja(d):c instanceof S&&(h+=" "+Ja(c.fromNode)+" "+Ja(c.toNode));return b+" "+this.Ca.count+": "+h};t.Ub=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);if(!1===this.Bi)return null;var d=!1;null!==this.diagram&&this.diagram.viewportBounds.aa(a)&&(d=!0);for(var e=I.alloc(),f=this.Ca.j,g=f.length;g--;){var h=f[g];if((!0!==d||!1!==ug(h))&&h.isVisible()&&(e.assign(a),Ab(e,h.vd),h=h.Ub(e,b,c),null!==h&&(null!==b&&(h=b(h)),null!==h&&(null===c||c(h)))))return I.free(e),h}I.free(e);return null};
    t.Ti=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof E||d instanceof F||(d=new F);if(!1===this.Bi)return d;var e=!1;null!==this.diagram&&this.diagram.viewportBounds.aa(a)&&(e=!0);for(var f=I.alloc(),g=this.Ca.j,h=g.length;h--;){var k=g[h];if((!0!==e||!1!==ug(k))&&k.isVisible()){f.assign(a);Ab(f,k.vd);var l=k;k.Ti(f,b,c,d)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||d.add(l))}}I.free(f);return d};
    t.uf=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof E||e instanceof F||(e=new F);if(!1===this.Bi)return e;var f=!1;null!==this.diagram&&this.diagram.viewportBounds.Ae(a)&&(f=!0);for(var g=this.Ca.j,h=g.length;h--;){var k=g[h];if((!0!==f||!1!==ug(k))&&k.isVisible()){var l=k;k.uf(a,b,c,d,e)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||e.add(l))}}return e};
    t.xv=function(a,b,c,d,e,f,g){if(!1===this.Bi)return e;for(var h=this.Ca.j,k=h.length;k--;){var l=h[k];if((!0!==g||!1!==ug(l))&&f(l)&&l.isVisible()){var m=l;l.uf(a,b,c,d,e)&&(null!==b&&(m=b(m)),null===m||null!==c&&!c(m)||e.add(m))}}return e};
    t.yg=function(a,b,c,d,e,f){void 0===c&&(c=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof E||e instanceof F)f=e;e=!0}f instanceof E||f instanceof F||(f=new F);if(!1===this.Bi)return f;var g=!1;null!==this.diagram&&this.diagram.viewportBounds.aa(a)&&(g=!0);for(var h=I.alloc(),k=I.alloc(),l=this.Ca.j,m=l.length;m--;){var n=l[m];if((!0!==g||!1!==ug(n))&&n.isVisible()){h.assign(a);Ab(h,n.vd);k.h(a.x+b,a.y);Ab(k,n.vd);var p=n;n.yg(h,k,c,d,e,f)&&(null!==c&&(p=c(p)),null===
    p||null!==d&&!d(p)||f.add(p))}}I.free(h);I.free(k);return f};
    t.zd=function(a,b){if(this.visible){var c=void 0===b?a.viewportBounds:b;var d=this.Ca.j,e=d.length;a=Fa();b=Fa();for(var f=0;f<e;f++){var g=d[f];g.Zw=f;g instanceof S&&!1===g.ld||g instanceof Ke&&null!==g.adornedPart||(dc(g.actualBounds,c)?(g.zd(!0),a.push(g)):(g.zd(!1),null!==g.adornments&&0<g.adornments.count&&b.push(g)))}for(c=0;c<a.length;c++)for(d=a[c],hi(d),d=d.adornments;d.next();)e=d.value,e.measure(Infinity,Infinity),e.arrange(),e.zd(!0);for(c=0;c<b.length;c++)d=b[c],d.updateAdornments(),
      ii(d,!0);Ha(a);Ha(b)}};function ji(a,b){var c=1;1!==a.qb&&(c=b.globalAlpha,b.globalAlpha=c*a.qb);return c}t.bc=function(a,b,c){if(this.visible&&0!==this.qb&&(void 0===c&&(c=!0),c||!this.isTemporary)){c=this.Ca.j;var d=c.length;if(0!==d){var e=ji(this,a),f=this.Yo;f.length=0;for(var g=b.scale,h=N.alloc(),k=0;k<d;k++)this.Pi(a,c[k],b,f,g,h);N.free(h);a.globalAlpha=e}}};
    t.Pi=function(a,b,c,d,e,f){if(null!==d&&b instanceof S&&(b.isOrthogonal&&d.push(b),!1===b.ld))return;var g=b.actualBounds;d=!1;var h=b.containingGroup;if(null!==h&&h.isClipping&&h.type!==X.Spot){h.locationObject.lm(f);if(!f.Gc(g))return;d=!f.Ae(g)}d&&(a.save(),a.beginPath(),a.rect(f.x,f.y,f.width,f.height),a.clip());g.width*e>c.Bo||g.height*e>c.Bo?b.bc(a,c):(e=b.actualBounds,f=b.naturalBounds,0===e.width||0===e.height||isNaN(e.x)||isNaN(e.y)||!b.isVisible()||(c=b.transform,null!==b.areaBackground&&
    (ki(b,a,b.areaBackground,!0,!0,f,e),a.fillRect(e.x,e.y,e.width,e.height)),null===b.areaBackground&&null===b.background&&(ki(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),ki(b,a,b.background,!0,!1,f,e),a.fillRect(0,0,f.width/2,f.height/2),c.vt()||(b=1/(c.m11*c.m22-c.m12*c.m21),a.transform(c.m22*b,-c.m12*b,-c.m21*b,c.m11*b,b*(c.m21*c.dy-c.m22*c.dx),b*(c.m12*c.dx-c.m11*c.dy))))));d&&(a.restore(),a.sc(!0))};
    t.g=function(a,b,c,d,e){var f=this.diagram;null!==f&&f.Ya(ue,a,this,b,c,d,e)};t.aj=function(a,b,c){var d=this.Ca;b.ui=this;if(a>=d.count)a=d.count;else if(d.L(a)===b)return-1;d.Kb(a,b);b.qq(c);d=this.diagram;null!==d&&(c?d.M():d.aj(b));li(this,a,b);return a};
    t.Fc=function(a,b,c){if(!c&&b.layer!==this&&null!==b.layer)return b.layer.Fc(a,b,c);var d=this.Ca;if(0>a||a>=d.length){if(a=d.indexOf(b),0>a)return-1}else if(d.L(a)!==b&&(a=d.indexOf(b),0>a))return-1;b.rq(c);d.lb(a);d=this.diagram;null!==d&&(c?d.M():d.Fc(b));b.ui=null;return a};
    function li(a,b,c){b=mi(a,b,c);if(c instanceof T&&null!==c&&isNaN(c.zOrder)){if(0!==c.memberParts.count){for(var d=-1,e=a.Ca.j,f=e.length,g=0;g<f;g++){var h=e[g];if(h===c&&(b=g,0<=d))break;if(0>d&&h.containingGroup===c&&(d=g,0<=b))break}!(0>d)&&d<b&&(e=a.Ca,e.lb(b),e.Kb(d,c))}c=c.containingGroup;null!==c&&li(a,-1,c)}}
    function mi(a,b,c){var d=c.zOrder;if(isNaN(d))return b;a=a.Ca;var e=a.count;if(1>=e)return b;0>b&&(b=a.indexOf(c));if(0>b)return-1;for(var f=b-1,g=NaN;0<=f;){g=a.L(f).zOrder;if(!isNaN(g))break;f--}for(var h=b+1,k=NaN;h<e;){k=a.L(h).zOrder;if(!isNaN(k))break;h++}if(!isNaN(g)&&g>d)for(;;){if(-1===f||g<=d){f++;if(f===b)break;a.lb(b);a.Kb(f,c);return f}for(g=NaN;0<=--f&&(g=a.L(f).zOrder,isNaN(g)););}else if(!isNaN(k)&&k<d)for(;;){if(h===e||k>=d){h--;if(h===b)break;a.lb(b);a.Kb(h,c);return h}for(k=NaN;++h<
    e&&(k=a.L(h).zOrder,isNaN(k)););}return b}
    ma.Object.defineProperties(gi.prototype,{parts:{get:function(){return this.Ca.iterator}},partsBackwards:{get:function(){return this.Ca.iteratorBackwards}},diagram:{get:function(){return this.B}},name:{get:function(){return this.Qa},set:function(a){var b=this.Qa;if(b!==a){var c=this.diagram;if(null!==c)for(""===b&&B("Cannot rename default Layer to: "+a),c=c.layers;c.next();)c.value.name===
        a&&B("Layer.name is already present in this diagram: "+a);this.Qa=a;this.g("name",b,a);for(a=this.Ca.iterator;a.next();)a.value.layerName=this.Qa}}},opacity:{get:function(){return this.qb},set:function(a){var b=this.qb;b!==a&&((0>a||1<a)&&va(a,"0 <= value <= 1",gi,"opacity"),this.qb=a,this.g("opacity",b,a),a=this.diagram,null!==a&&a.M())}},isTemporary:{get:function(){return this.v},set:function(a){var b=this.v;b!==a&&(this.v=a,this.g("isTemporary",
          b,a))}},visible:{get:function(){return this.I},set:function(a){var b=this.I;if(b!==a){this.I=a;this.g("visible",b,a);for(b=this.Ca.iterator;b.next();)b.value.Ob(a);a=this.diagram;null!==a&&a.M()}}},pickable:{get:function(){return this.Bi},set:function(a){var b=this.Bi;b!==a&&(this.Bi=a,this.g("pickable",b,a))}},isBoundsIncluded:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a,null!==this.diagram&&
        this.diagram.Na())}},allowCopy:{get:function(){return this.Rh},set:function(a){var b=this.Rh;b!==a&&(this.Rh=a,this.g("allowCopy",b,a))}},allowDelete:{get:function(){return this.Sh},set:function(a){var b=this.Sh;b!==a&&(this.Sh=a,this.g("allowDelete",b,a))}},allowTextEdit:{get:function(){return this.ai},set:function(a){var b=this.ai;b!==a&&(this.ai=a,this.g("allowTextEdit",b,a))}},allowGroup:{
        get:function(){return this.Th},set:function(a){var b=this.Th;b!==a&&(this.Th=a,this.g("allowGroup",b,a))}},allowUngroup:{get:function(){return this.bi},set:function(a){var b=this.bi;b!==a&&(this.bi=a,this.g("allowUngroup",b,a))}},allowLink:{get:function(){return this.Uh},set:function(a){var b=this.Uh;b!==a&&(this.Uh=a,this.g("allowLink",b,a))}},allowRelink:{get:function(){return this.Wh},set:function(a){var b=
          this.Wh;b!==a&&(this.Wh=a,this.g("allowRelink",b,a))}},allowMove:{get:function(){return this.Vh},set:function(a){var b=this.Vh;b!==a&&(this.Vh=a,this.g("allowMove",b,a))}},allowReshape:{get:function(){return this.Xh},set:function(a){var b=this.Xh;b!==a&&(this.Xh=a,this.g("allowReshape",b,a))}},allowResize:{get:function(){return this.Yh},set:function(a){var b=this.Yh;b!==a&&(this.Yh=a,this.g("allowResize",b,a))}},
      allowRotate:{get:function(){return this.Zh},set:function(a){var b=this.Zh;b!==a&&(this.Zh=a,this.g("allowRotate",b,a))}},allowSelect:{get:function(){return this.$h},set:function(a){var b=this.$h;b!==a&&(this.$h=a,this.g("allowSelect",b,a))}}});gi.prototype.findObjectsNear=gi.prototype.yg;gi.prototype.findObjectsIn=gi.prototype.uf;gi.prototype.findObjectsAt=gi.prototype.Ti;gi.prototype.findObjectAt=gi.prototype.Ub;gi.className="Layer";
    function R(a){function b(){c.removeEventListener(x.document,"DOMContentLoaded",b,!1);c.setRTL()}1<arguments.length&&B("Diagram constructor can only take one optional argument, the DIV HTML element or its id.");ni||(oi(),ni=!0);Ya(this);Ce=this;Qa=[];this.Rb=!0;this.Jc=new wh;this.Jc.Zd(this);this.jb=17;this.nl=this.Su=!1;this.zs="default";this.La=null;var c=this;Sg&&(null!==x.document.body?this.setRTL():c.addEventListener(x.document,"DOMContentLoaded",b,!1));this.Ja=new E;this.va=this.wa=0;this.sa=
      null;this.lx=new G;this.cf=this.Db=null;this.dw();this.vj=null;this.cw();this.qb=1;this.ma=(new I(NaN,NaN)).freeze();this.As=new I(NaN,NaN);this.yn=this.ya=1;this.Kr=(new I(NaN,NaN)).freeze();this.Lr=NaN;this.ds=1E-4;this.bs=100;this.kb=new qd;this.at=(new I(NaN,NaN)).freeze();this.Fr=(new N(NaN,NaN,NaN,NaN)).freeze();this.Fi=(new oc(0,0,0,0)).freeze();this.Gi=Xh;this.Is=!1;this.Bs=this.vs=null;this.Jg=pi;this.lj=$c;this.Vf=pi;this.Xn=$c;this.Mr=this.Jr=vc;this.Ac=!0;this.ll=!1;this.od=new F;this.Qg=
      new G;this.Xk=!0;this.Zm=250;this.jj=-1;this.an=(new oc(16,16,16,16)).freeze();this.pj=this.xe=!1;this.sj=!0;this.Sf=new qe;this.Sf.diagram=this;this.Qd=new qe;this.Qd.diagram=this;this.ah=new qe;this.ah.diagram=this;this.pe=this.Kf=null;this.Pj=!1;this.vr=this.wr=null;this.Vm=x.PointerEvent&&(Ta||Ua||Va)&&x.navigator&&!1!==x.navigator.msPointerEnabled;qi(this);this.xh=new F;this.Ur=!0;this.Ws=ri;this.wu=!1;this.Ys=Mf;this.Ia=null;si.add("Model",ti);this.pr=this.sr=this.Us=null;this.xn=this.mr="auto";
      this.dg=this.gs=this.fg=this.gg=this.ig=this.Mf=this.Qf=this.Lf=null;this.Ir=!1;this.Nf=this.sg=this.hg=this.eg=null;this.hs=!1;this.ts={};this.Kj=[null,null];this.gr=null;this.tr=this.Ms=this.Uu=this.qg=!1;this.Cu=!0;this.ni=this.Bc=!1;this.ac=null;var d=this;this.kd=function(a){var b=d.partManager;if(a.model===b.diagram.model&&b.diagram.Z){b.diagram.Z=!1;try{var c=a.change;""===a.modelChange&&c===ue&&b.updateDataBindings(a.object,a.propertyName)}finally{b.diagram.Z=!0}}};this.Ic=function(a){d.partManager.doModelChanged(a)};
      this.cv=!0;this.Hd=-2;this.Ci=new G;this.ss=new E;this.Xf=!1;this.Sh=this.Rh=this.Uq=this.Mc=!0;this.Vq=!1;this.ar=this.Zq=this.$h=this.Zh=this.Yh=this.Xh=this.Vh=this.Wh=this.Uh=this.Yq=this.bi=this.Th=this.ai=this.Wq=!0;this.Wf=this.yu=!1;this.$q=this.Xq=this.dl=this.cl=!0;this.Hs=this.Ds=16;this.Cs=this.vp=!1;this.wp=this.Fs=null;this.Es=this.Gs=0;this.bb=(new oc(5)).freeze();this.Tu=(new F).freeze();this.cs=999999999;this.tu=(new F).freeze();this.mi=this.li=this.ki=!0;this.Te=this.ie=!1;this.ic=
        null;this.Gf=!0;this.je=!1;this.$w=new F;this.uu=new F;this.Gb=null;this.Cl=1;this.Vu=0;this.Sd={scale:1,position:new I,bounds:new N,Mv:!1};this.bv=(new N(NaN,NaN,NaN,NaN)).freeze();this.Zl=(new M(NaN,NaN)).freeze();this.zn=(new N(NaN,NaN,NaN,NaN)).freeze();this.Vr=!1;this.qo=this.Vn=this.Ro=this.hu=this.gu=this.iu=this.Zf=this.Zg=this.Ze=this.zr=null;ui(this);this.Fb=null;this.Un=!1;this.mj=null;this.partManager=new ti;this.toolManager=new Oa;this.toolManager.initializeStandardTools();this.currentTool=
        this.defaultTool=this.toolManager;this.yr=null;this.Qk=new Se;this.ns=this.ms=null;this.Op=!1;this.commandHandler=Ci();this.model=Di();this.qg=!0;Ei(this);this.layout=new Fi;this.qg=!1;this.Tw=this.lu=null;this.Sb=1;this.sh=null;this.Bo=1;this.Io=0;this.Jo=[0,0,0,0,0];this.Ko=0;this.pd=1;this.Aj=0;this.lo=new I;this.Vs=500;this.$m=new I;this.ke=!1;this.preventDefault=this.It=this.vm=this.wm=this.um=this.tm=this.rk=this.tk=this.sk=this.pk=this.qk=this.xw=this.pw=this.qw=this.rw=this.lh=this.Gl=this.kh=
        this.Fl=null;this.$n=!1;this.ji=new Gi;this.Pp=!1;void 0!==a&&Hi(this,a);this.In=null;this.Jn=Kb;this.Rb=!1}R.prototype.clear=function(){this.animationManager.Xc();this.model.clear();Ii=null;Ji="";Ki(this,!1);this.Na();Li(this);this.M()};
    function Ki(a,b){a.animationManager.Xc(!0);a.Tu=(new F).freeze();a.tu=(new F).freeze();var c=a.skipsUndoManager;null!==a.model&&(a.skipsUndoManager=!0);var d=null;null!==a.Fb&&(d=a.Fb.part,null!==d&&a.remove(d));var e=[],f=a.Ja.length;if(b){for(b=0;b<f;b++)for(var g=a.Ja.j[b].parts;g.next();){var h=g.value;h!==d&&null===h.data&&e.push(h)}for(b=0;b<e.length;b++)a.remove(e[b])}for(b=0;b<f;b++)a.Ja.j[b].clear();a.partManager.clear();a.od.clear();a.Qg.clear();a.xh.clear();a.mj=null;Ga=[];null!==d&&(a.add(d),
      a.partManager.parts.remove(d));null!==a.model&&(a.skipsUndoManager=c);return e}function Ci(){return null}
    R.prototype.reset=function(){this.clear();this.Rb=!0;this.Jc=new wh;this.Jc.Zd(this);this.jb=17;this.nl=this.Su=!1;this.zs="default";this.Ja=new E;this.lx=new G;this.cf=null;this.dw();this.vj=null;this.cw();this.qb=1;this.ma=(new I(NaN,NaN)).freeze();this.As=new I(NaN,NaN);this.yn=this.ya=1;this.Kr=(new I(NaN,NaN)).freeze();this.Lr=NaN;this.ds=1E-4;this.bs=100;this.kb=new qd;this.at=(new I(NaN,NaN)).freeze();this.Fr=(new N(NaN,NaN,NaN,NaN)).freeze();this.Fi=(new oc(0,0,0,0)).freeze();this.Gi=Xh;this.Is=
      !1;this.Bs=this.vs=null;this.Jg=pi;this.lj=$c;this.Vf=pi;this.Xn=$c;this.Mr=this.Jr=vc;this.Ac=!0;this.ll=!1;this.od=new F;this.Qg=new G;this.Xk=!0;this.Zm=250;this.jj=-1;this.an=(new oc(16,16,16,16)).freeze();this.pj=this.xe=!1;this.sj=!0;this.Sf=new qe;this.Sf.diagram=this;this.Qd=new qe;this.Qd.diagram=this;this.ah=new qe;this.ah.diagram=this;this.pe=this.Kf=null;this.Pj=!1;this.vr=this.wr=null;this.Vm=x.PointerEvent&&(Ta||Ua||Va)&&x.navigator&&!1!==x.navigator.msPointerEnabled;qi(this);this.xh=
      new F;this.Ur=!0;this.Ws=ri;this.wu=!1;this.Ys=Mf;this.pr=this.sr=this.Us=null;this.xn=this.mr="auto";this.dg=this.gs=this.fg=this.gg=this.ig=this.Mf=this.Qf=this.Lf=null;this.Ir=!1;this.Nf=this.sg=this.hg=this.eg=null;this.hs=!1;this.ts={};this.Kj=[null,null];this.gr=null;this.tr=this.Ms=this.Uu=this.qg=!1;this.Cu=!0;this.ni=this.Bc=!1;this.cv=!0;this.Hd=-2;this.Ci=new G;this.ss=new E;this.Xf=!1;this.Sh=this.Rh=this.Uq=this.Mc=!0;this.Vq=!1;this.ar=this.Zq=this.$h=this.Zh=this.Yh=this.Xh=this.Vh=
      this.Wh=this.Uh=this.Yq=this.bi=this.Th=this.ai=this.Wq=!0;this.Wf=this.yu=!1;this.$q=this.Xq=this.dl=this.cl=!0;this.Hs=this.Ds=16;this.Cs=this.vp=!1;this.Es=this.Gs=0;this.bb=(new oc(5)).freeze();this.Tu=(new F).freeze();this.cs=999999999;this.tu=(new F).freeze();this.mi=this.li=this.ki=!0;this.Te=this.ie=!1;this.ic=null;this.Gf=!0;this.je=!1;this.$w=new F;this.uu=new F;this.Gb=null;this.Cl=1;this.Vu=0;this.Sd={scale:1,position:new I,bounds:new N,Mv:!1};this.bv=(new N(NaN,NaN,NaN,NaN)).freeze();
      this.Zl=(new M(NaN,NaN)).freeze();this.zn=(new N(NaN,NaN,NaN,NaN)).freeze();this.Vr=!1;this.qo=this.Vn=this.Ro=this.hu=this.gu=this.iu=this.Zf=this.Zg=this.Ze=null;ui(this);this.Fb=null;this.Un=!1;this.mj=null;this.partManager=new ti;this.toolManager=new Oa;this.toolManager.initializeStandardTools();this.currentTool=this.defaultTool=this.toolManager;this.yr=null;this.Qk=new Se;this.ns=this.ms=null;this.Op=!1;this.commandHandler=Ci();this.qg=!0;Ei(this);this.layout=new Fi;this.qg=!1;this.model=Di();
      this.model.undoManager=new ze;this.je=!1;this.sj=!0;this.xe=!1;this.Sb=1;this.sh=null;this.Bo=1;this.Io=0;this.Jo=[0,0,0,0,0];this.Ko=0;this.pd=1;this.Aj=0;this.lo=new I;this.Vs=500;this.$m=new I;this.ke=!1;this.lh=this.Gl=this.kh=this.Fl=null;this.Pp=this.$n=!1;this.In=null;this.Jn=Kb;this.Rb=!1;this.M()};
    function ui(a){a.Ze=new G;var b=new W,c=new Ug;c.bind(new Mi("text","",Ja));b.add(c);a.iu=b;a.Ze.add("",b);b=new W;c=new Ug;c.stroke="brown";c.bind(new Mi("text","",Ja));b.add(c);a.Ze.add("Comment",b);b=new W;b.selectable=!1;b.avoidable=!1;c=new Kf;c.figure="Ellipse";c.fill="black";c.stroke=null;c.desiredSize=(new M(3,3)).ca();b.add(c);a.Ze.add("LinkLabel",b);a.Zg=new G;b=new T;b.selectionObjectName="GROUPPANEL";b.type=X.Vertical;c=new Ug;c.font="bold 12pt sans-serif";c.bind(new Mi("text","",Ja));
      b.add(c);c=new X(X.Auto);c.name="GROUPPANEL";var d=new Kf;d.figure="Rectangle";d.fill="rgba(128,128,128,0.2)";d.stroke="black";c.add(d);d=new vg;d.padding=(new oc(5,5,5,5)).ca();c.add(d);b.add(c);a.gu=b;a.Zg.add("",b);a.Zf=new G;b=new S;c=new Kf;c.isPanelMain=!0;b.add(c);c=new Kf;c.toArrow="Standard";c.fill="black";c.stroke=null;c.strokeWidth=0;b.add(c);a.hu=b;a.Zf.add("",b);b=new S;c=new Kf;c.isPanelMain=!0;c.stroke="brown";b.add(c);a.Zf.add("Comment",b);b=new Ke;b.type=X.Auto;c=new Kf;c.fill=null;
      c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);c=new vg;c.margin=(new oc(1.5,1.5,1.5,1.5)).ca();b.add(c);a.Ro=b;a.Vn=b;b=new Ke;b.type=X.Link;c=new Kf;c.isPanelMain=!0;c.fill=null;c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);a.qo=b}
    R.prototype.setRTL=function(a){a=void 0===a?this.div:a;null===a&&(a=x.document.body);var b=ta("div");b.dir="rtl";b.style.cssText="font-size: 14px; width: 1px; height: 1px; position: absolute; top: -1000px; overflow: scroll;";b.textContent="A";a.appendChild(b);var c="reverse";0<b.scrollLeft?c="default":(b.scrollLeft=1,0===b.scrollLeft&&(c="negative"));a.removeChild(b);this.zs=c};
    R.prototype.setScrollWidth=function(a){a=void 0===a?this.div:a;null===a&&(a=x.document.body);var b=0;if(Sg){var c=Ni;b=Oi;null===c&&(c=Ni=ta("p"),c.style.width="100%",c.style.height="200px",c.style.boxSizing="content-box",b=Oi=ta("div"),b.style.position="absolute",b.style.visibility="hidden",b.style.width="200px",b.style.height="150px",b.style.boxSizing="content-box",b.appendChild(c));b.style.overflow="hidden";a.appendChild(b);var d=c.offsetWidth;b.style.overflow="scroll";c=c.offsetWidth;d===c&&(c=
      b.clientWidth);a.removeChild(b);b=d-c;0!==b||Xa||(b=11)}this.jb=b;this.Su=!0};R.prototype.cb=function(a){a.classType===R&&(this.autoScale=a)};R.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.Ja.iterator;c.next();)b+="\n  "+c.value.toString(a-1);return b};R.prototype.addEventListener=function(a,b,c,d){a.addEventListener(b,c,d)};
    R.prototype.removeEventListener=function(a,b,c,d){a.removeEventListener(b,c,d)};
    function Pi(a){var b=a.sa.Ea;b instanceof HTMLCanvasElement&&(a.Vm?(a.addEventListener(b,"pointerdown",a.tm,!1),a.addEventListener(b,"pointermove",a.um,!1),a.addEventListener(b,"pointerup",a.wm,!1),a.addEventListener(b,"pointerout",a.vm,!1)):(a.addEventListener(b,"touchstart",a.rw,!1),a.addEventListener(b,"touchmove",a.qw,!1),a.addEventListener(b,"touchend",a.pw,!1),a.addEventListener(b,"mousemove",a.qk,!1),a.addEventListener(b,"mousedown",a.pk,!1),a.addEventListener(b,"mouseup",a.sk,!1),a.addEventListener(b,
      "mouseout",a.rk,!1)),a.addEventListener(b,"mouseenter",a.fz,!1),a.addEventListener(b,"mouseleave",a.gz,!1),a.addEventListener(b,"wheel",a.tk,!1),a.addEventListener(b,"keydown",a.Zz,!1),a.addEventListener(b,"keyup",a.$z,!1),a.addEventListener(b,"blur",a.Ty,!1),a.addEventListener(b,"focus",a.Uy,!1),a.addEventListener(b,"selectstart",function(a){a.preventDefault();return!1},!1),a.addEventListener(b,"contextmenu",function(a){a.preventDefault();return!1},!1),a.addEventListener(b,"gesturestart",function(b){a.toolManager.gestureBehavior!==
    Ne&&(a.toolManager.gestureBehavior===Me?b.preventDefault():a.ke&&a.lastInput.handled||(b.preventDefault(),a.Cl=a.scale,a.currentTool.doCancel()))},!1),a.addEventListener(b,"gesturechange",function(b){if(a.toolManager.gestureBehavior!==Ne)if(a.toolManager.gestureBehavior===Me)b.preventDefault();else if(!a.ke||!a.lastInput.handled){b.preventDefault();var c=b.scale;if(null!==a.Cl){var e=a.sa.getBoundingClientRect();b=new I(b.pageX-window.scrollX-a.wa/e.width*e.left,b.pageY-window.scrollY-a.va/e.height*
      e.top);c=a.Cl*c;e=a.commandHandler;if(c!==a.scale&&e.canResetZoom(c)){var f=a.zoomPoint;a.zoomPoint=b;e.resetZoom(c);a.zoomPoint=f}}}},!1),a.addEventListener(x,"resize",a.xw,!1))}function Ve(a){30<a.Io&&(a.sh=1)}function jf(a,b){null!==a.sh&&(a.sh=null,b&&a.It(),a.Io=0,a.Jo=[0,0,0,0,0],a.Ko=0)}R.prototype.computePixelRatio=function(){return null!==this.sh?this.sh:x.devicePixelRatio||1};R.prototype.doMouseMove=function(){this.currentTool.doMouseMove()};R.prototype.doMouseDown=function(){this.currentTool.doMouseDown()};
    R.prototype.doMouseUp=function(){this.currentTool.doMouseUp()};R.prototype.doMouseWheel=function(){this.currentTool.doMouseWheel()};R.prototype.doKeyDown=function(){this.currentTool.doKeyDown()};R.prototype.doKeyUp=function(){this.currentTool.doKeyUp()};R.prototype.doFocus=function(){this.focus()};R.prototype.focus=function(){if(this.sa)if(this.scrollsPageOnFocus)this.sa.focus();else{var a=x.scrollX||x.pageXOffset,b=x.scrollY||x.pageYOffset;this.sa.focus();x.scrollTo(a,b)}};R.prototype.Uy=function(){this.B.R("GainedFocus")};
    R.prototype.Ty=function(){this.B.R("LostFocus")};function Hh(a){if(null!==a.sa){var b=a.La;if(0!==b.clientWidth&&0!==b.clientHeight){a.Su||a.setScrollWidth();var c=a.Te?a.jb:0,d=a.ie?a.jb:0,e=a.Sb;a.Sb=a.computePixelRatio();a.Sb!==e&&(a.ll=!0,a.Pb());if(b.clientWidth!==a.wa+c||b.clientHeight!==a.va+d)a.li=!0,a.Ac=!0,b=a.layout,null!==b&&b.isViewportSized&&a.autoScale===pi&&(a.pj=!0,b.C()),a.Bc||a.Pb()}}}
    function Ei(a){var b=new gi;b.name="Background";a.$l(b);b=new gi;b.name="";a.$l(b);b=new gi;b.name="Foreground";a.$l(b);b=new gi;b.name="Adornment";b.isTemporary=!0;a.$l(b);b=new gi;b.name="Tool";b.isTemporary=!0;b.isBoundsIncluded=!0;a.$l(b);b=new gi;b.name="Grid";b.allowSelect=!1;b.pickable=!1;b.isTemporary=!0;a.vx(b,a.im("Background"))}
    function Qi(a){a.Fb=new X(X.Grid);a.Fb.name="GRID";var b=new Kf;b.figure="LineH";b.stroke="lightgray";b.strokeWidth=.5;b.interval=1;a.Fb.add(b);b=new Kf;b.figure="LineH";b.stroke="gray";b.strokeWidth=.5;b.interval=5;a.Fb.add(b);b=new Kf;b.figure="LineH";b.stroke="gray";b.strokeWidth=1;b.interval=10;a.Fb.add(b);b=new Kf;b.figure="LineV";b.stroke="lightgray";b.strokeWidth=.5;b.interval=1;a.Fb.add(b);b=new Kf;b.figure="LineV";b.stroke="gray";b.strokeWidth=.5;b.interval=5;a.Fb.add(b);b=new Kf;b.figure=
      "LineV";b.stroke="gray";b.strokeWidth=1;b.interval=10;a.Fb.add(b);b=new U;b.add(a.Fb);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.Fb.visible=!1}function Ri(){this.B.Cs?this.B.Cs=!1:this.B.isEnabled?this.B.Gx(this):Si(this.B)}function Ti(a){this.B.isEnabled?(this.B.Gs=a.target.scrollTop,this.B.Es=a.target.scrollLeft):Si(this.B)}
    R.prototype.Gx=function(a){if(null!==this.sa){this.vp=!0;var b=this.documentBounds,c=this.viewportBounds,d=this.Fi,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.nl)switch(this.zs){case "negative":q=q+a.scrollWidth-a.clientWidth;break;case "reverse":q=a.scrollWidth-q-a.clientWidth}var u=q;m<g||n<h?(q=I.allocAt(this.position.x,this.position.y),
    this.allowHorizontalScroll&&this.Es!==u&&(q.x=u/c+e,this.Es=u),this.allowVerticalScroll&&this.Gs!==a.scrollTop&&(q.y=a.scrollTop/c+f,this.Gs=a.scrollTop),this.position=q,I.free(q),this.li=this.vp=!1):(q=I.alloc(),a.Cy&&this.allowHorizontalScroll&&(e<l&&(this.position=q.h(u+e,this.position.y)),k>p&&(this.position=q.h(-(this.Fs.scrollWidth-this.wa)+u-this.wa/c+k,this.position.y))),a.Dy&&this.allowVerticalScroll&&(f<b&&(this.position=q.h(this.position.x,a.scrollTop+f)),d>r&&(this.position=q.h(this.position.x,
      -(this.Fs.scrollHeight-this.va)+a.scrollTop-this.va/c+d))),I.free(q),Ui(this),this.li=this.vp=!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.wp.style.width="1px"),n>=h&&f>=b&&d<=r&&(this.wp.style.height="1px"))}};R.prototype.computeBounds=function(){0<this.od.count&&Vi(this);return Wi(this)};
    function Wi(a){if(a.fixedBounds.u()){var b=a.fixedBounds.copy();b.cq(a.bb);return b}for(var c=!0,d=a.Ja.j,e=d.length,f=0;f<e;f++){var g=d[f];if(g.visible&&(!g.isTemporary||g.isBoundsIncluded)){g=g.Ca.j;for(var h=g.length,k=0;k<h;k++){var l=g[k];l.isInDocumentBounds&&l.isVisible()&&(l=l.actualBounds,l.u()&&(c?(c=!1,b=l.copy()):b.Hc(l)))}}}c&&(b=new N(0,0,0,0));b.cq(a.bb);return b}
    R.prototype.computePartsBounds=function(a,b){void 0===b&&(b=!1);var c=null;if(Aa(a))for(var d=0;d<a.length;d++){var e=a[d];!b&&e instanceof S||(e.yb(),null===c?c=e.actualBounds.copy():c.Hc(e.actualBounds))}else for(a=a.iterator;a.next();)d=a.value,!b&&d instanceof S||(d.yb(),null===c?c=d.actualBounds.copy():c.Hc(d.actualBounds));return null===c?new N(NaN,NaN,0,0):c};
    function Xi(a,b){if((b||a.je)&&!a.Rb&&null!==a.sa&&a.documentBounds.u()){if(b){var c=a.initialPosition;if(c.u()){a.position=c;return}c=I.alloc();c.dj(a.documentBounds,a.initialDocumentSpot);var d=a.viewportBounds;d=N.allocAt(0,0,d.width,d.height);var e=I.alloc();e.dj(d,a.initialViewportSpot);e.h(c.x-e.x,c.y-e.y);a.position=e;N.free(d);I.free(e);I.free(c)}a.Rb=!0;c=a.Jg;b&&a.Vf!==pi&&(c=a.Vf);d=c!==pi?Yi(a,c):a.scale;c=a.viewportBounds.copy();e=a.wa/d;var f=a.va/d,g=a.lj,h=a.Xn;b&&!g.eb()&&(h.eb()||
      h.Mb())&&(g=h.Mb()?Ac:h);Zi(a,a.documentBounds,e,f,g,b);b=a.scale;a.scale=d;a.Rb=!1;d=a.viewportBounds;d.Ma(c)||a.Bq(c,d,b,!1);$i(a);aj(a,!0,!1)}}
    function Yi(a,b){var c=a.yn;if(null===a.sa)return c;Li(a);var d=a.documentBounds;if(!d.u())return c;var e=d.width;d=d.height;var f=a.wa+(a.Te?a.jb:0),g=a.va+(a.ie?a.jb:0),h=f/e,k=g/d;return b===bj?(b=Math.min(k,h),b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):b===cj?(b=k>h?(g-a.jb)/d:(f-a.jb)/e,b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):a.scale}
    R.prototype.zoomToFit=function(){var a=this.Gi;this.Gi=Xh;this.scale=Yi(this,bj);a!==Xh&&(Xi(this,!1),Zi(this,this.documentBounds,this.wa/this.ya,this.va/this.ya,this.lj,!1));this.Gi=a};t=R.prototype;
    t.GA=function(a,b){void 0===b&&(b=bj);var c=a.width,d=a.height;if(!(0===c||0===d||isNaN(c)&&isNaN(d))){var e=1;if(b===bj||b===cj)if(isNaN(c))e=this.viewportBounds.height*this.scale/d;else if(isNaN(d))e=this.viewportBounds.width*this.scale/c;else{e=this.wa;var f=this.va;e=b===cj?f/d>e/c?(f-(this.ie?this.jb:0))/d:(e-(this.Te?this.jb:0))/c:Math.min(f/d,e/c)}this.scale=e;this.position=new I(a.x,a.y)}};
    t.Oy=function(a,b){Li(this);var c=this.documentBounds,d=this.viewportBounds;this.position=new I(c.x+(a.x*c.width+a.offsetX)-(b.x*d.width-b.offsetX),c.y+(a.y*c.height+a.offsetY)-(b.y*d.height-b.offsetY))};t.Cz=function(a){if(a instanceof Y){this.In=a;var b=I.alloc();this.Jn=this.Nq(a.ga(vc,b));I.free(b)}else this.In=null,this.Jn=Kb};
    function Zi(a,b,c,d,e,f){var g=I.allocAt(a.ma.x,a.ma.y),h=g.x,k=g.y;if(null!==a.In){var l=I.alloc();l=a.In.ga(vc,l);h=l.x-a.Jn.x/a.scale;k=l.y-a.Jn.y/a.scale;e=uc;I.free(l)}if(f||a.scrollMode===Xh)e.eb()&&(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.Fi,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.bb.left;g.y=isFinite(k)?k:-a.bb.top;null!==a.positionComputation&&(b=a.positionComputation(a,g),g.x=b.x,g.y=b.y);a.Jc.qc&&Qh(a.Jc,a.ma,g);a.ma.h(g.x,g.y);I.free(g)}
    t.jm=function(a,b){void 0===b&&(b=!0);if(b){if(a=uf(this,a,function(a){return a.part},function(a){return a.canSelect()}),a instanceof U)return a}else if(a=uf(this,a,function(a){return a.part}),a instanceof U)return a;return null};t.Ub=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);Vi(this);for(var d=this.Ja.iteratorBackwards;d.next();){var e=d.value;if(e.visible&&(e=e.Ub(a,b,c),null!==e))return e}return null};
    function uf(a,b,c,d){void 0===c&&(c=null);void 0===d&&(d=null);Vi(a);for(a=a.Ja.iteratorBackwards;a.next();){var e=a.value;if(e.visible&&!e.isTemporary&&(e=e.Ub(b,c,d),null!==e))return e}return null}t.pz=function(a,b,c){void 0===b&&(b=!0);return dj(this,a,function(a){return a.part},b?function(a){return a instanceof U&&a.canSelect()}:null,c)};
    function dj(a,b,c,d,e){void 0===c&&(c=null);void 0===d&&(d=null);e instanceof E||e instanceof F||(e=new F);Vi(a);for(a=a.Ja.iteratorBackwards;a.next();){var f=a.value;f.visible&&!f.isTemporary&&f.Ti(b,c,d,e)}return e}t.Ti=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof E||d instanceof F||(d=new F);Vi(this);for(var e=this.Ja.iteratorBackwards;e.next();){var f=e.value;f.visible&&f.Ti(a,b,c,d)}return d};
    t.Ox=function(a,b,c,d){void 0===b&&(b=!1);void 0===c&&(c=!0);return ej(this,a,function(a){return a instanceof U&&(!c||a.canSelect())},b,d)};t.uf=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof E||e instanceof F||(e=new F);Vi(this);for(var f=this.Ja.iteratorBackwards;f.next();){var g=f.value;g.visible&&g.uf(a,b,c,d,e)}return e};
    t.xv=function(a,b,c,d,e,f){var g=new F;Vi(this);for(var h=this.Ja.iteratorBackwards;h.next();){var k=h.value;k.visible&&k.xv(a,b,c,d,g,e,f)}return g};function ej(a,b,c,d,e){var f=null;void 0===f&&(f=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof E||e instanceof F||(e=new F);Vi(a);for(a=a.Ja.iteratorBackwards;a.next();){var g=a.value;g.visible&&!g.isTemporary&&g.uf(b,f,c,d,e)}return e}
    t.qz=function(a,b,c,d,e){void 0===c&&(c=!0);void 0===d&&(d=!0);return fj(this,a,b,function(a){return a instanceof U&&(!d||a.canSelect())},c,e)};t.yg=function(a,b,c,d,e,f){void 0===c&&(c=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof E||e instanceof F)f=e;e=!0}f instanceof E||f instanceof F||(f=new F);Vi(this);for(var g=this.Ja.iteratorBackwards;g.next();){var h=g.value;h.visible&&h.yg(a,b,c,d,e,f)}return f};
    function fj(a,b,c,d,e,f){var g=null;void 0===g&&(g=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof E||e instanceof F)f=e;e=!0}f instanceof E||f instanceof F||(f=new F);Vi(a);for(a=a.Ja.iteratorBackwards;a.next();){var h=a.value;h.visible&&!h.isTemporary&&h.yg(b,c,g,d,e,f)}return f}R.prototype.acceptEvent=function(a){return gj(this,a,a instanceof MouseEvent)};
    function gj(a,b,c){var d=a.Qd;a.Qd=a.ah;a.ah=d;d.diagram=a;d.event=b;c?hj(a,b,d):(d.viewPoint=a.Qd.viewPoint,d.documentPoint=a.Qd.documentPoint);a=0;b.ctrlKey&&(a+=1);b.altKey&&(a+=2);b.shiftKey&&(a+=4);b.metaKey&&(a+=8);d.modifiers=a;d.button=b.button;void 0===b.buttons||Sa||(d.buttons=b.buttons);Wa&&0===b.button&&b.ctrlKey&&(d.button=2);d.down=!1;d.up=!1;d.clickCount=1;d.delta=0;d.handled=!1;d.bubbles=!1;d.timestamp=b.timeStamp;d.isMultiTouch=!1;d.targetDiagram=ij(b);d.targetObject=null;return d}
    function ij(a){var b=a.target.B;if(!b){var c=a.path;c||"function"!==typeof a.composedPath||(c=a.composedPath());c&&c[0]&&(b=c[0].B)}return b?b:null}function jj(a,b,c,d){var e=kj(a,b,!0,!1,!0,d);hj(a,c,e);e.targetDiagram=ij(b);e.targetObject=null;d||e.clone(a.Sf);return e}
    function lj(a,b,c,d){var e;d=kj(a,b,!1,!1,!1,d);null!==c?((e=x.document.elementFromPoint(c.clientX,c.clientY))&&e.B?(b=c,c=e.B):(b=void 0!==b.targetTouches?b.targetTouches[0]:b,c=a),d.targetDiagram=c,hj(a,b,d)):null!==a.Qd?(d.documentPoint=a.Qd.documentPoint,d.viewPoint=a.Qd.viewPoint,d.targetDiagram=a.Qd.targetDiagram):null!==a.Sf&&(d.documentPoint=a.Sf.documentPoint,d.viewPoint=a.Sf.viewPoint,d.targetDiagram=a.Sf.targetDiagram);d.targetObject=null;return d}
    function kj(a,b,c,d,e,f){var g=a.Qd;a.Qd=a.ah;a.ah=g;g.diagram=a;g.clickCount=1;var h=g.delta=0;b.ctrlKey&&(h+=1);b.altKey&&(h+=2);b.shiftKey&&(h+=4);b.metaKey&&(h+=8);g.modifiers=h;g.button=0;g.buttons=1;g.event=b;g.timestamp=b.timeStamp;a.Vm&&b instanceof x.PointerEvent&&"touch"!==b.pointerType&&(g.button=b.button,void 0===b.buttons||Sa||(g.buttons=b.buttons),Wa&&0===b.button&&b.ctrlKey&&(g.button=2));g.down=c;g.up=d;g.handled=!1;g.bubbles=e;g.isMultiTouch=f;return g}
    function mj(a,b){if(a.bubbles)return!0;void 0!==b.stopPropagation&&b.stopPropagation();!1!==b.cancelable&&b.preventDefault();b.cancelBubble=!0;return!1}
    R.prototype.Zz=function(a){var b=this.B;if(!this.B.isEnabled)return!1;var c=gj(b,a,!1);c.key=String.fromCharCode(a.which);c.down=!0;switch(a.which){case 8:c.key="Backspace";break;case 33:c.key="PageUp";break;case 34:c.key="PageDown";break;case 35:c.key="End";break;case 36:c.key="Home";break;case 37:c.key="Left";break;case 38:c.key="Up";break;case 39:c.key="Right";break;case 40:c.key="Down";break;case 45:c.key="Insert";break;case 46:c.key="Del";break;case 48:c.key="0";break;case 187:case 61:case 107:c.key=
      "Add";break;case 189:case 173:case 109:c.key="Subtract";break;case 27:c.key="Esc"}b.doKeyDown();return mj(c,a)};
    R.prototype.$z=function(a){var b=this.B;if(!b.isEnabled)return!1;var c=gj(b,a,!1);c.key=String.fromCharCode(a.which);c.up=!0;switch(a.which){case 8:c.key="Backspace";break;case 33:c.key="PageUp";break;case 34:c.key="PageDown";break;case 35:c.key="End";break;case 36:c.key="Home";break;case 37:c.key="Left";break;case 38:c.key="Up";break;case 39:c.key="Right";break;case 40:c.key="Down";break;case 45:c.key="Insert";break;case 46:c.key="Del"}b.doKeyUp();return mj(c,a)};
    R.prototype.fz=function(a){var b=this.B;if(!b.isEnabled)return!1;var c=gj(b,a,!0);null!==b.mouseEnter&&b.mouseEnter(c);return mj(c,a)};R.prototype.gz=function(a){var b=this.B;if(!b.isEnabled)return!1;var c=gj(b,a,!0);null!==b.mouseLeave&&b.mouseLeave(c);return mj(c,a)};
    R.prototype.getMouse=function(a){var b=this.sa;if(null===b)return new I(0,0);var c=b.getBoundingClientRect();b=a.clientX-this.wa/c.width*c.left;a=a.clientY-this.va/c.height*c.top;return null!==this.kb?Ab(new I(b,a),this.kb):new I(b,a)};
    function hj(a,b,c){var d=a.sa,e=a.wa,f=a.va,g=0,h=0;null!==d&&(d=d.getBoundingClientRect(),g=b.clientX-e/d.width*d.left,h=b.clientY-f/d.height*d.top);c.viewPoint.h(g,h);null!==a.kb?(b=I.allocAt(g,h),a.kb.Wd(b),c.documentPoint.assign(b),I.free(b)):c.documentPoint.h(g,h)}
    function re(a,b,c,d){if(void 0!==b.targetTouches){if(2>b.targetTouches.length)return;b=b.targetTouches[c]}else if(null!==a.Kj[0])b=a.Kj[c];else return;c=a.sa;null!==c&&(c=c.getBoundingClientRect(),d.h(b.clientX-a.wa/c.width*c.left,b.clientY-a.va/c.height*c.top))}t=R.prototype;t.Na=function(){this.ki||(this.ki=!0,this.Pb(!0))};function nj(a){a.Bc||Vi(a);Li(a)}t.Fe=function(){this.Rb||this.Bc||(this.M(),$i(this),Ui(this),this.Na(),this.Wc())};t.Yz=function(){return this.xe};
    t.az=function(a){void 0===a&&(a=null);var b=this.animationManager,c=b.isEnabled;b.Xc();b.isEnabled=!1;Hf(this);this.je=!1;this.As=new I(NaN,NaN);b.isEnabled=c;null!==a&&sa(function(){Bh(b,"Model");a()},1)};t.Pb=function(a){void 0===a&&(a=!1);if(!0!==this.xe&&!(this.Rb||!1===a&&this.Bc)){this.xe=!0;var b=this;x.requestAnimationFrame(function(){b.xe&&b.Wc()})}};t.Wc=function(){if(!this.sj||this.xe)this.sj&&(this.sj=!1),Hf(this)};
    function aj(a,b,c){a.animationManager.defaultAnimation.isAnimating||a.Rb||!a.li||Si(a)||(b&&Vi(a),c&&Xi(a,!1))}
    function Hf(a,b){if(!a.Bc&&(a.xe=!1,null!==a.La||a.Zl.u())){a.Bc=!0;var c=a.animationManager,d=a.ss;if(!c.isAnimating&&0!==d.length){for(var e=d.j,f=e.length,g=0;g<f;g++){var h=e[g];oj(h,!1);h.o()}d.clear()}d=a.uu;0<d.count&&(d.each(function(a){a.ww()}),d.clear());e=d=!1;c.isAnimating&&(e=!0,d=a.skipsUndoManager,a.skipsUndoManager=!0);c.qc||Hh(a);aj(a,!1,!1);null!==a.Fb&&(a.Fb.visible&&!a.Un&&(pj(a),a.Un=!0),!a.Fb.visible&&a.Un&&(a.Un=!1));Vi(a);f=!1;if(!a.je||a.Gf)a.je?qj(a,!a.pj):(a.ua("Initial Layout"),
    !1===c.isEnabled&&c.Xc(),qj(a,!1)),f=!0;a.pj=!1;Vi(a);a.Ms||nj(a);aj(a,!0,!1);g=!1;f?(a.je||(g=a.je=!0,a.skipsUndoManager||(a.undoManager.isPendingClear=!0),a.undoManager.isPendingUnmodified=!0,rj(a)),a.R("LayoutCompleted")):c.gl&&c.sx&&(a.Vf!==pi?a.scale=Yi(a,a.Vf):a.Jg!==pi?a.scale=Yi(a,a.Jg):(c=a.initialScale,isFinite(c)&&0<c&&(a.scale=c)),Xi(a,!0));Vi(a);f&&g&&a.Ua("Initial Layout");a.jv();b||a.bc(a.Db);e&&(a.skipsUndoManager=d);a.Bc=!1}}
    function rj(a){var b=a.ya;if(a.Vf!==pi)a.scale=Yi(a,a.Vf);else if(a.Jg!==pi)a.scale=Yi(a,a.Jg);else{var c=a.initialScale;isFinite(c)&&0<c&&(a.scale=c)}a.ya!==b&&($i(a),aj(a,!0,!1));Xi(a,!0);b=a.Ja.j;a.zd(b,b.length,a);a.R("InitialLayoutCompleted");a.As.assign(a.ma);pj(a)}
    function Vi(a){if((a.Bc||!a.animationManager.isTicking)&&0!==a.od.count){for(var b=0;23>b;b++){var c=a.od.iterator;if(null===c||0===a.od.count)break;a.od=new F;a.ww(c,a.od)}a.nodes.each(function(a){a instanceof T&&0!==(a.P&65536)!==!1&&(a.P=a.P^65536)})}}
    t.ww=function(a,b){for(a.reset();a.next();){var c=a.value;!c.Wb()||c instanceof T||(c.bj()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))}for(a.reset();a.next();)c=a.value,c instanceof T&&c.isVisible()&&sj(this,c);for(a.reset();a.next();)c=a.value,c instanceof S&&c.isVisible()&&(c.bj()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c));for(a.reset();a.next();)c=a.value,c instanceof Ke&&c.isVisible()&&(c.bj()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))};
    function sj(a,b){for(var c=Fa(),d=Fa(),e=b.memberParts;e.next();){var f=e.value;f.isVisible()&&(f instanceof T?(tj(f)||uj(f)||vj(f))&&sj(a,f):f instanceof S?f.fromNode===b||f.toNode===b?d.push(f):c.push(f):(f.measure(Infinity,Infinity),f.arrange()))}a=c.length;for(e=0;e<a;e++)f=c[e],f.measure(Infinity,Infinity),f.arrange();Ha(c);b.measure(Infinity,Infinity);b.arrange();a=d.length;for(b=0;b<a;b++)c=d[b],c.measure(Infinity,Infinity),c.arrange();Ha(d)}
    t.zd=function(a,b,c,d){if(this.mi||this.animationManager.isAnimating)for(var e=0;e<b;e++)a[e].zd(c,d)};
    t.bc=function(a,b){void 0===b&&(b=null);if(null!==this.La){null===this.sa&&B("No canvas specified");var c=this.animationManager;if(!c.qc&&(!c.isAnimating||c.isTicking)){var d=new Date;wj(this);if("0"!==this.La.style.opacity){var e=a!==this.Db,f=this.Ja.j,g=f.length,h=this;this.zd(f,g,h);if(e)a.sc(!0),Ui(this);else if(!this.Ac&&null===b&&!c.isAnimating)return;g=this.ma;var k=this.ya,l=Math.round(g.x*k)/k,m=Math.round(g.y*k)/k;c=this.kb;c.reset();1!==k&&c.scale(k);0===g.x&&0===g.y||c.translate(-l,-m);
      k=this.Sb;a.setTransform(1,0,0,1,0,0);a.scale(k,k);a.clearRect(0,0,this.wa,this.va);a.setTransform(1,0,0,1,0,0);a.scale(k,k);a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy);xj(this,a);a.globalAlpha=this.qb;l=null!==b?function(c){var d=b;if(c.visible&&0!==c.qb){var e=c.Ca.j,f=e.length;if(0!==f){var g=ji(c,a),k=c.Yo;k.length=0;for(var l=h.scale,m=N.alloc(),n=0;n<f;n++){var A=e[n];d.contains(A)||c.Pi(a,A,h,k,l,m)}N.free(m);a.globalAlpha=g}}}:function(b){b.bc(a,h)};g=f.length;for(m=0;m<g;m++)a.setTransform(1,
        0,0,1,0,0),a.scale(k,k),a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy),l(f[m]);this.ji&&yj(this.ji,this)&&this.zr();e?(this.Db.sc(!0),Ui(this)):this.Ac=this.mi=!1;e=+new Date-+d;if(null===this.sh){d=this.Jo;d[this.Ko]=e;this.Ko=(this.Ko+1)%d.length;for(f=e=0;f<this.Jo.length;f++)e+=this.Jo[f];this.Io=e/d.length}}}}};
    function zj(a,b,c,d,e,f,g,h,k,l){if(null!==a.La){null===a.sa&&B("No canvas specified");void 0===g&&(g=null);void 0===h&&(h=null);void 0===k&&(k=!1);void 0===l&&(l=!1);wj(a);a.Db.sc(!0);Ui(a);a.ni=!0;var m=a.ya;a.ya=e;var n=a.Ja.j,p=n.length;try{var r=new N(f.x,f.y,d.width/e,d.height/e),q=r.copy();q.cq(c);pj(a,q);Vi(a);a.zd(n,p,a,r);var u=a.Sb;b.setTransform(1,0,0,1,0,0);b.scale(u,u);b.clearRect(0,0,d.width,d.height);null!==h&&""!==h&&(b.fillStyle=h,b.fillRect(0,0,d.width,d.height));var v=qd.alloc();
      v.reset();v.translate(c.left,c.top);v.scale(e);0===f.x&&0===f.y||v.translate(-f.x,-f.y);b.setTransform(v.m11,v.m12,v.m21,v.m22,v.dx,v.dy);qd.free(v);xj(a,b);b.globalAlpha=a.qb;if(null!==g){var w=new F,y=g.iterator;for(y.reset();y.next();){var z=y.value;!1===l&&"Grid"===z.layer.name||null===z||w.add(z)}var A=function(c){if(c.visible&&0!==c.qb&&(k||!c.isTemporary)){var d=c.Ca.j,e=d.length;if(0!==e){var f=ji(c,b),g=c.Yo;g.length=0;for(var h=a.scale,l=N.alloc(),m=0;m<e;m++){var n=d[m];w.contains(n)&&
      c.Pi(b,n,a,g,h,l)}N.free(l);b.globalAlpha=f}}}}else if(!k&&l){var C=a.grid.part,H=C.layer;A=function(c){c===H?C.bc(b,a):c.bc(b,a,k)}}else A=function(c){c.bc(b,a,k)};for(c=0;c<p;c++)A(n[c]);a.ni=!1;a.ji&&yj(a.ji,a)&&a.zr()}finally{a.ya=m,a.Db.sc(!0),Ui(a),a.zd(n,p,a),pj(a)}}}t.Ce=function(a){return this.cf[a]};t.ny=function(a,b){"minDrawingLength"===a&&(this.Bo=b);this.cf[a]=b;this.Fe()};
    t.dw=function(){this.cf=new db;this.cf.drawShadows=!0;this.cf.textGreeking=!0;this.cf.viewportOptimizations=Xa||Ta||Ua?!1:!0;this.cf.temporaryPixelRatio=!0;this.cf.pictureRatioOptimization=!0;this.Bo=this.cf.minDrawingLength=1};function xj(a,b){a=a.cf;null!==a&&(void 0!==a.imageSmoothingEnabled&&b.my(!!a.imageSmoothingEnabled),a=a.defaultFont,void 0!==a&&null!==a&&(b.font=a))}t.mm=function(a){return this.vj[a]};t.vA=function(a,b){this.vj[a]=b};
    t.cw=function(){this.vj=new db;this.vj.extraTouchArea=10;this.vj.extraTouchThreshold=10;this.vj.hasGestureZoom=!0};t.kw=function(a){Aj(this,a)};
    function Aj(a,b){var c=a instanceof X,d=a instanceof R,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.Xa(k);else if(f=a[k],void 0===f||null===f)f=a.toolManager[k];za(f)?g=e.substr(h+1):B("Unable to find object named: "+k+" in "+a.toString()+" when trying to set property: "+e)}}if("_"!==g[0]&&!Ka(f,g))if(d&&"ModelChanged"===g){a.xx(b[g]);continue}else if(d&&"Changed"===g){a.Bh(b[g]);continue}else if(d&&
      Ka(a.toolManager,g))f=a.toolManager;else if(d&&Bj(a,g)){a.Uj(g,b[g]);continue}else if(a instanceof Z&&"Changed"===g){a.Bh(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.ux(g)}}t.jv=function(){if(0===this.undoManager.transactionLevel&&0!==this.Qg.count){for(;0<this.Qg.count;){var a=this.Qg;this.Qg=new G;for(a=a.iterator;a.next();){var b=a.key;b.tq(a.value);b.cc()}}this.M()}};
    t.M=function(a){void 0===a&&(a=null);if(null===a)this.Ac=!0,this.Pb();else{var b=this.viewportBounds;null!==a&&a.u()&&b.Gc(a)&&(this.Ac=!0,this.Pb())}this.R("InvalidateDraw")};
    t.Ux=function(a,b){if(!0!==this.Ac){this.Ac=!0;var c=!0===this.Ce("temporaryPixelRatio");if(!0===this.Ce("viewportOptimizations")&&this.scrollMode!==Zh&&this.Fi.Ri(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.Pp&&0<d.width&&0<d.height){if(!(this.Bc||(this.xe=!1,null===this.La||(this.Bc=!0,this.jv(),this.documentBounds.u()||
    Cj(this,this.computeBounds()),e=this.sa,null===e||e instanceof Dj)))){var g=this.Sb;f=this.wa*g;var h=this.va*g,k=this.scale*g,l=Math.round(Math.round(b.x*k)-Math.round(a.x*k));b=Math.round(Math.round(b.y*k)-Math.round(a.y*k));k=this.lu;a=this.Tw;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.Ea,n,p,r,q,0,0,r,q);yj(this.ji,this)&&a.clearRect(0,0,k,m);e=Fa();a=Fa();q=Math.abs(l);
      r=Math.abs(b);var u=0===n?0:f-q;n=I.allocAt(u,0);q=I.allocAt(q+u,h);a.push(new N(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));var v=this.kb;v.reset();v.scale(g,g);1!==this.ya&&v.scale(this.ya);g=this.ma;(0!==g.x||0!==g.y)&&isFinite(g.x)&&isFinite(g.y)&&v.translate(-g.x,-g.y);Ab(n,v);Ab(q,v);e.push(new N(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));u=0===p?0:h-r;n.h(0,u);q.h(f,r+u);a.push(new N(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-
        q.x),Math.abs(n.y-q.y)));Ab(n,v);Ab(q,v);e.push(new N(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));yj(this.ji,this)&&(f=0<l?0:-l,h=0<b?0:-b,n.h(f,h),q.h(k+f,m+h),a.push(new N(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y))),Ab(n,v),Ab(q,v),e.push(new N(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y))));I.free(n);I.free(q);aj(this,!1,!0);null===this.La&&B("No div specified");null===this.sa&&B("No canvas specified");if(!this.animationManager.qc&&
        (f=this.Db,this.Ac)){wj(this);h=this.Sb;f.setTransform(1,0,0,1,0,0);f.clearRect(0,0,this.wa*h,this.va*h);f.drawImage(this.lu.Ea,0<l?0:Math.round(-l),0<b?0:Math.round(-b));l=this.ma;g=this.ya;k=Math.round(l.x*g)/g;m=Math.round(l.y*g)/g;b=this.kb;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.Ja.j;l=b.length;this.zd(b,l,this);xj(this,f);f.globalAlpha=this.qb;for(h=0;h<l;h++)if(g=b[h],k=e,g.visible&&0!==g.qb){m=ji(g,f);p=g.Yo;p.length=0;n=this.scale;r=N.alloc();q=g.Ca.j;v=q.length;u=k.length;for(var w=0;w<v;w++){var y=q[w],z=Ej(y,y.actualBounds);a:{for(var A=2/n,C=4/n,H=0;H<u;H++){var L=k[H];if(0!==L.width&&0!==L.height&&z.Hv(L.x-A,L.y-A,L.width+C,L.height+C)){z=!0;break a}}z=!1}z&&g.Pi(f,y,this,p,n,r)}N.free(r);
        f.globalAlpha=m}f.restore();f.sc(!0);this.ji&&yj(this.ji,this)&&this.zr();this.Ac=this.mi=!1;this.It()}Ha(e);Ha(a);this.Bc=!1}}else this.Wc();N.free(d);c&&(Ve(this),this.Wc(),jf(this,!0))}else c?(Ve(this),this.Wc(),jf(this,!0)):this.Wc()}};function $i(a){!1===a.li&&(a.li=!0)}function Ui(a){!1===a.mi&&(a.mi=!0)}function wj(a){!1!==a.ll&&(a.ll=!1,Fj(a,a.wa,a.va))}function Fj(a,b,c){var d=a.Sb;a.sa.resize(b*d,c*d,b,c)&&(a.Ac=!0,a.Db.sc(!0))}
    function Si(a){var b=a.sa;if(null===b)return!0;var c=a.La,d=a.wa,e=a.va,f=a.bv.copy();if(!f.u())return!0;var g=!1,h=a.Te?a.jb:0,k=a.ie?a.jb:0,l=c.clientWidth||d+h,m=c.clientHeight||e+k;if(l!==d+h||m!==e+k)a.Te=!1,a.ie=!1,k=h=0,a.wa=l,a.va=m,g=a.ll=!0;if(!(g||a.Te||a.ie||a.cl||a.dl))return!0;a.li=!1;var n=a.viewportBounds,p=a.documentBounds,r=0,q=0,u=0,v=0;c=n.width;var w=n.height,y=a.Fi;a.contentAlignment.eb()?(p.width>c&&(r=y.left,q=y.right),p.height>w&&(u=y.top,v=y.bottom)):(r=y.left,q=y.right,
      u=y.top,v=y.bottom);y=p.width+r+q;var z=p.height+u+v;r=p.x-r;var A=n.x;q=p.right+q;var C=n.right+h;u=p.y-u;var H=n.y;p=p.bottom+v;n=n.bottom+k;var L="1px",K="1px";v=a.scale;l=y>l/v;m=z>m/v;a.scrollMode===Xh&&(l||m)&&(l&&a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(l=1,r+1<A&&(l=Math.max((A-r)*v+a.wa,l)),q>C+1&&(l=Math.max((q-C)*v+a.wa,l)),c+h+1<y&&(l=Math.max((y-c)*v+a.wa,l)),L=l.toString()+"px"),m&&a.hasVerticalScrollbar&&a.allowVerticalScroll&&(l=1,u+1<H&&(l=Math.max((H-u)*v+a.va,l)),p>n+
    1&&(l=Math.max((p-n)*v+a.va,l)),w+k+1<z&&(l=Math.max((z-w)*v+a.va,l)),K=l.toString()+"px"));l="1px"!==L;m="1px"!==K;l&&m||!l&&!m||(m&&(C-=a.jb),l&&(n-=a.jb),y<c+h||!a.hasHorizontalScrollbar||!a.allowHorizontalScroll||(h=1,r+1<A&&(h=Math.max((A-r)*v+a.wa,h)),q>C+1&&(h=Math.max((q-C)*v+a.wa,h)),c+1<y&&(h=Math.max((y-c)*v+a.wa,h)),L=h.toString()+"px"),l="1px"!==L,h=a.va,l!==a.ie&&(h=l?a.va-a.jb:a.va+a.jb),z<w+k||!a.hasVerticalScrollbar||!a.allowVerticalScroll||(k=1,u+1<H&&(k=Math.max((H-u)*v+h,k)),p>
    n+1&&(k=Math.max((p-n)*v+h,k)),w+1<z&&(k=Math.max((z-w)*v+h,k)),K=k.toString()+"px"),m="1px"!==K);if(a.vp&&l===a.ie&&m===a.Te)return d===a.wa&&e===a.va||a.Wc(),!1;l!==a.ie&&("1px"===L?a.va=a.va+a.jb:a.va=Math.max(a.va-a.jb,1),g=!0);a.ie=l;a.wp.style.width=L;m!==a.Te&&("1px"===K?a.wa=a.wa+a.jb:a.wa=Math.max(a.wa-a.jb,1),g=!0,a.nl&&(k=I.alloc(),m?(b.style.left=a.jb+"px",a.position=k.h(a.ma.x+a.jb/a.scale,a.ma.y)):(b.style.left="0px",a.position=k.h(a.ma.x-a.jb/a.scale,a.ma.y)),I.free(k)));a.Te=m;a.wp.style.height=
      K;a.Cs=!0;g&&(a.ll=!0);b=a.Fs;k=b.scrollLeft;a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(c+1<y?k=(a.position.x-r)*v:r+1<A?k=b.scrollWidth-b.clientWidth:q>C+1&&(k=a.position.x*v));if(a.nl)switch(a.zs){case "negative":k=-(b.scrollWidth-k-b.clientWidth);break;case "reverse":k=b.scrollWidth-k-b.clientWidth}b.scrollLeft=k;a.hasVerticalScrollbar&&a.allowVerticalScroll&&(w+1<z?b.scrollTop=(a.position.y-u)*v:u+1<H?b.scrollTop=b.scrollHeight-b.clientHeight:p>n+1&&(b.scrollTop=a.position.y*v));l=a.wa;
      m=a.va;b.style.width=l+(a.Te?a.jb:0)+"px";b.style.height=m+(a.ie?a.jb:0)+"px";return d!==l||e!==m||a.animationManager.qc?(a.Bq(f,a.viewportBounds,v,g),!1):!0}
    t.add=function(a){var b=a.diagram;if(b!==this&&(null!==b&&B("Cannot add part "+a.toString()+" to "+this.toString()+". It is already a part of "+b.toString()),b=this.im(a.layerName),null===b&&(b=this.im("")),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.aj(99999999,a,a.diagram===this);0<=c&&this.Ya(we,"parts",b,null,a,null,c);b.isTemporary||this.Na();a.C(1);c=a.layerChanged;null!==c&&c(a,null,b)}};
    t.aj=function(a){this.partManager.aj(a);var b=this;Gj(a,function(a){Hj(b,a)});(a instanceof Ke||a instanceof T&&null!==a.placeholder)&&a.o();null!==a.data&&Gj(a,function(a){Ij(b.partManager,a)});!0!==uj(a)&&!0!==vj(a)||this.od.add(a);Jj(a,!0,this);Kj(a)?(a.actualBounds.u()&&this.M(Ej(a,a.actualBounds)),this.Na()):a.isVisible()&&a.actualBounds.u()&&this.M(Ej(a,a.actualBounds));this.Pb()};
    t.Fc=function(a){a.Yj();this.partManager.Fc(a);var b=this;null!==a.data&&Gj(a,function(a){Lj(b.partManager,a,b)});this.od.remove(a);Kj(a)?(a.actualBounds.u()&&this.M(Ej(a,a.actualBounds)),this.Na()):a.isVisible()&&a.actualBounds.u()&&this.M(Ej(a,a.actualBounds));this.Pb()};t.remove=function(a){Mj(this,a,!0)};
    function Mj(a,b,c){var d=b.layer;null!==d&&d.diagram===a&&(b.isSelected=!1,b.isHighlighted=!1,b.C(2),c&&b.dk(),c=d.Fc(-1,b,!1),0<=c&&a.Ya(xe,"parts",d,b,null,c,null),a=b.layerChanged,null!==a&&a(b,d,null))}t.Kt=function(a,b){if(Aa(a))for(var c=a.length,d=0;d<c;d++){var e=a[d];b&&!e.canDelete()||this.remove(e)}else for(c=new F,c.addAll(a),a=c.iterator;a.next();)c=a.value,b&&!c.canDelete()||this.remove(c)};t.ck=function(a,b,c){return this.partManager.ck(a,b,c)};
    R.prototype.moveParts=function(a,b,c,d){void 0===d&&(d=Nj(this));if(null!==this.toolManager){var e=new G;if(null!==a)if(Aa(a))for(var f=0;f<a.length;f++)Oj(this,e,a[f],c,d);else for(a=a.iterator;a.next();)Oj(this,e,a.value,c,d);else{for(a=this.parts;a.next();)Oj(this,e,a.value,c,d);for(a=this.nodes;a.next();)Oj(this,e,a.value,c,d);for(a=this.links;a.next();)Oj(this,e,a.value,c,d)}rf(this,e,b,d,c)}};
    function Oj(a,b,c,d,e,f){if(!b.contains(c)&&(void 0===f&&(f=!1),!d||f||c.canMove()||c.canCopy()))if(void 0===e&&(e=Nj(a)),c instanceof W){b.add(c,a.td(e,c,c.location));if(c instanceof T)for(f=c.memberParts;f.next();)Oj(a,b,f.value,d,e,e.Oz);for(f=c.linksConnected;f.next();){var g=f.value;if(!b.contains(g)){var h=g.fromNode,k=g.toNode;null!==h&&b.contains(h)&&null!==k&&b.contains(k)&&Oj(a,b,g,d,e)}}if(e.dragsTree)for(c=c.yv();c.next();)Oj(a,b,c.value,d,e)}else if(c instanceof S)for(b.add(c,a.td(e,
      c)),c=c.labelNodes;c.next();)Oj(a,b,c.value,d,e);else c instanceof Ke||b.add(c,a.td(e,c,c.location))}
    function rf(a,b,c,d,e){if(null!==b&&0!==b.count){var f=I.alloc(),g=I.alloc();g.assign(c);isNaN(g.x)&&(g.x=0);isNaN(g.y)&&(g.y=0);(c=a.Op)||We(a,b);for(var h=Fa(),k=Fa(),l=b.iterator,m=I.alloc();l.next();){var n=l.key,p=l.value;if(n.Wb()){var r=Pj(a,n,b);if(null!==r)h.push(new Qj(n,p,r));else if(!e||n.canMove())r=p.point,f.assign(r),a.computeMove(n,f.add(g),d,m),n.location=m,void 0===p.shifted&&(p.shifted=new I),p.shifted.assign(m.$d(r))}else l.key instanceof S&&k.push(l.la)}I.free(m);e=h.length;for(l=
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              0;l<e;l++)n=h[l],f.assign(n.info.point),void 0===n.Ev.shifted&&(n.Ev.shifted=new I),n.node.location=f.add(n.Ev.shifted);e=I.alloc();l=I.alloc();n=k.length;for(p=0;p<n;p++){var q=k[p];r=q.key;if(r instanceof S)if(r.suspendsRouting){r.mh=null;m=r.fromNode;var u=r.toNode;if(null!==a.draggedLink&&d.dragsLink)if(u=q.value.point,null===r.dragComputation)b.add(r,a.td(d,r,g)),pf(r,g.x-u.x,g.y-u.y);else{q=I.allocAt(0,0);(m=r.i(0))&&m.u()&&q.assign(m);var v=m=I.alloc().assign(q).add(g);d.isGridSnapEnabled&&
    (d.isGridSnapRealtime||a.lastInput.up)&&(v=I.alloc(),Eg(a,r,m,v,d));m.assign(r.dragComputation(r,m,v)).$d(q);b.add(r,a.td(d,r,m));pf(r,m.x-u.x,m.y-u.y);I.free(q);I.free(m);v!==m&&I.free(v)}else null!==m&&(e.assign(m.location),v=b.H(m),null!==v&&e.$d(v.point)),null!==u&&(l.assign(u.location),v=b.H(u),null!==v&&l.$d(v.point)),null!==m&&null!==u?e.Ma(l)?(m=q.value.point,u=f,u.assign(e),u.$d(m),b.add(r,a.td(d,r,e)),pf(r,u.x,u.y)):(r.suspendsRouting=!1,r.Ta()):(q=q.value.point,m=null!==m?e:null!==u?l:
      g,b.add(r,a.td(d,r,m)),pf(r,m.x-q.x,m.y-q.y))}else if(null===r.fromNode||null===r.toNode)m=q.value.point,b.add(r,a.td(d,r,g)),pf(r,g.x-m.x,g.y-m.y)}I.free(f);I.free(g);I.free(e);I.free(l);Ha(h);Ha(k);c||(Vi(a),ef(a,b))}}
    R.prototype.computeMove=function(a,b,c,d){void 0===d&&(d=new I);d.assign(b);if(null===a)return d;var e=b,f=c.isGridSnapEnabled;f&&(c.isGridSnapRealtime||this.lastInput.up)&&(e=I.alloc(),Eg(this,a,b,e,c));c=null!==a.dragComputation?a.dragComputation(a,b,e):e;var g=a.minLocation,h=g.x;isNaN(h)&&(h=f?Math.round(a.location.x):a.location.x);g=g.y;isNaN(g)&&(g=f?Math.round(a.location.y):a.location.y);var k=a.maxLocation,l=k.x;isNaN(l)&&(l=f?Math.round(a.location.x):a.location.x);k=k.y;isNaN(k)&&(k=f?Math.round(a.location.y):
      a.location.y);d.h(Math.max(h,Math.min(c.x,l)),Math.max(g,Math.min(c.y,k)));e!==b&&I.free(e);return d};function Nj(a){var b=a.toolManager.findTool("Dragging");return null!==b?b.dragOptions:a.Qk}
    function Eg(a,b,c,d,e){void 0===e&&(e=Nj(a));d.assign(c);if(null!==b){var f=a.grid;b=e.gridSnapCellSize;a=b.width;b=b.height;var g=e.gridSnapOrigin,h=g.x;g=g.y;e=e.gridSnapCellSpot;if(null!==f){var k=f.gridCellSize;isNaN(a)&&(a=k.width);isNaN(b)&&(b=k.height);f=f.gridOrigin;isNaN(h)&&(h=f.x);isNaN(g)&&(g=f.y)}f=I.allocAt(0,0);f.xk(0,0,a,b,e);J.mq(c.x,c.y,h+f.x,g+f.y,a,b,d);I.free(f)}}function We(a,b){if(null!==b)for(a.Op=!0,a=b.iterator;a.next();)b=a.key,b instanceof S&&(b.suspendsRouting=!0)}
    function ef(a,b){if(null!==b){for(b=b.iterator;b.next();){var c=b.key;c instanceof S&&(c.suspendsRouting=!1,Rj(c)&&c.Ta())}a.Op=!1}}function Pj(a,b,c){b=b.containingGroup;if(null!==b){a=Pj(a,b,c);if(null!==a)return a;a=c.H(b);if(null!==a)return a}return null}t=R.prototype;t.td=function(a,b,c){if(void 0===c)return new cf(Gb);var d=a.isGridSnapEnabled;a.Pz||null===b.containingGroup||(d=!1);return d?new cf(new I(Math.round(c.x),Math.round(c.y))):new cf(c.copy())};
    function Sj(a,b,c){null!==b.diagram&&b.diagram!==a&&B("Cannot share a Layer with another Diagram: "+b+" of "+b.diagram);null===c?null!==b.diagram&&B("Cannot add an existing Layer to this Diagram again: "+b):(c.diagram!==a&&B("Existing Layer must be in this Diagram: "+c+" not in "+c.diagram),b===c&&B("Cannot move a Layer before or after itself: "+b));if(b.diagram!==a){b=b.name;a=a.Ja;c=a.count;for(var d=0;d<c;d++)a.L(d).name===b&&B("Cannot add Layer with the name '"+b+"'; a Layer with the same name is already present in this Diagram.")}}
    t.$l=function(a){Sj(this,a,null);a.Zd(this);var b=this.Ja,c=b.count-1;if(!a.isTemporary)for(;0<=c&&b.L(c).isTemporary;)c--;b.Kb(c+1,a);null!==this.ac&&this.Ya(we,"layers",this,null,a,null,c+1);this.M();this.Na()};t.vx=function(a,b){Sj(this,a,b);a.Zd(this);var c=this.Ja,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.ac&&this.Ya(xe,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.L(f)===b){c.Kb(f,a);break}null!==this.ac&&this.Ya(we,"layers",this,null,a,null,f);this.M();0>d&&this.Na()};
    t.Iy=function(a,b){Sj(this,a,b);a.Zd(this);var c=this.Ja,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.ac&&this.Ya(xe,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.L(f)===b){c.Kb(f+1,a);break}null!==this.ac&&this.Ya(we,"layers",this,null,a,null,f+1);this.M();0>d&&this.Na()};
    t.oA=function(a){a.diagram!==this&&B("Cannot remove a Layer from another Diagram: "+a+" of "+a.diagram);if(""!==a.name){var b=this.Ja,c=b.indexOf(a);if(b.remove(a)){for(b=a.Ca.copy().iterator;b.next();){var d=b.value,e=d.layerName;e!==a.name?d.layerName=e:d.layerName=""}null!==this.ac&&this.Ya(xe,"layers",this,a,null,c,null);this.M();this.Na()}}};t.im=function(a){for(var b=this.layers;b.next();){var c=b.value;if(c.name===a)return c}return null};
    t.xx=function(a){null===this.pe&&(this.pe=new E);this.pe.add(a);this.model.Bh(a)};t.qA=function(a){null!==this.pe&&(this.pe.remove(a),0===this.pe.count&&(this.pe=null));this.model.wk(a)};t.Bh=function(a){null===this.Kf&&(this.Kf=new E);this.Kf.add(a)};t.wk=function(a){null!==this.Kf&&(this.Kf.remove(a),0===this.Kf.count&&(this.Kf=null))};
    t.ct=function(a){this.skipsUndoManager||this.model.skipsUndoManager||this.model.undoManager.Fv(a);a.change!==ve&&(this.isModified=!0);if(null!==this.Kf)for(var b=this.Kf,c=b.length,d=0;d<c;d++)b.L(d)(a)};t.Ya=function(a,b,c,d,e,f,g){void 0===f&&(f=null);void 0===g&&(g=null);var h=new te;h.diagram=this;h.change=a;h.propertyName=b;h.object=c;h.oldValue=d;h.oldParam=f;h.newValue=e;h.newParam=g;this.ct(h)};t.g=function(a,b,c,d,e){this.Ya(ue,a,this,b,c,d,e)};
    R.prototype.changeState=function(a,b){if(null!==a&&a.diagram===this){var c=this.skipsModelSourceBindings;try{this.skipsModelSourceBindings=!0;var d=a.change;if(d===ue){var e=a.object;Tj(e,a.propertyName,a.H(b));if(e instanceof Y){var f=e.part;null!==f&&f.Lb()}this.isModified=!0}else if(d===we){var g=a.object,h=a.newParam,k=a.newValue;if(g instanceof X)if("number"===typeof h&&k instanceof Y){b?g.Fc(h):g.Kb(h,k);var l=g.part;null!==l&&l.Lb()}else{if("number"===typeof h&&k instanceof Uj)if(b)k.isRow?
      g.aw(h):g.Zv(h);else{var m=k.isRow?g.getRowDefinition(k.index):g.getColumnDefinition(k.index);m.ft(k)}}else if(g instanceof gi){var n=!0===a.oldParam;"number"===typeof h&&k instanceof U&&(b?(k.isSelected=!1,k.isHighlighted=!1,k.Lb(),g.Fc(n?h:-1,k,n)):g.aj(h,k,n))}else g instanceof R?"number"===typeof h&&k instanceof gi&&(b?this.Ja.lb(h):(k.Zd(this),this.Ja.Kb(h,k))):B("unknown ChangedEvent.Insert object: "+a.toString());this.isModified=!0}else if(d===xe){var p=a.object,r=a.oldParam,q=a.oldValue;if(p instanceof
      X)"number"===typeof r&&q instanceof Y?b?p.Kb(r,q):p.Fc(r):"number"===typeof r&&q instanceof Uj&&(b?(m=q.isRow?p.getRowDefinition(q.index):p.getColumnDefinition(q.index),m.ft(q)):q.isRow?p.aw(r):p.Zv(r));else if(p instanceof gi){var u=!0===a.newParam;"number"===typeof r&&q instanceof U&&(b?0>p.Ca.indexOf(q)&&p.aj(r,q,u):(q.isSelected=!1,q.isHighlighted=!1,q.Lb(),p.Fc(u?r:-1,q,u)))}else p instanceof R?"number"===typeof r&&q instanceof gi&&(b?(q.Zd(this),this.Ja.Kb(r,q)):this.Ja.lb(r)):B("unknown ChangedEvent.Remove object: "+
      a.toString());this.isModified=!0}else d!==ve&&B("unknown ChangedEvent: "+a.toString())}finally{this.skipsModelSourceBindings=c}}};R.prototype.ua=function(a){return this.undoManager.ua(a)};R.prototype.Ua=function(a){return this.undoManager.Ua(a)};R.prototype.Bf=function(){return this.undoManager.Bf()};
    R.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.ua(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.Ua(b):this.undoManager.Bf(),this.skipsUndoManager=c}};R.prototype.updateAllTargetBindings=function(a){this.partManager.updateAllTargetBindings(a)};R.prototype.Pq=function(){this.partManager.Pq()};
    function Vj(a,b,c){var d=a.animationManager;if(a.Rb||a.Bc)a.ya=c,d.$e&&d.Bd.add(d.B,"scale",b,a.ya);else if(a.Rb=!0,null===a.sa)a.ya=c;else{var e=a.viewportBounds.copy(),f=a.wa,g=a.va;e.width=a.wa/b;e.height=a.va/b;var h=a.zoomPoint.x,k=a.zoomPoint.y,l=a.contentAlignment;isNaN(h)&&(l.gd()?l.xf(Ic)?h=0:l.xf(Jc)&&(h=f-1):h=l.eb()?l.x*(f-1):f/2);isNaN(k)&&(l.gd()?l.xf(Hc)?k=0:l.xf(Kc)&&(k=g-1):k=l.eb()?l.y*(g-1):g/2);null===a.scaleComputation||a.animationManager.isAnimating||(c=a.scaleComputation(a,
      c));c<a.minScale&&(c=a.minScale);c>a.maxScale&&(c=a.maxScale);f=I.allocAt(a.ma.x+h/b-h/c,a.ma.y+k/b-k/c);a.position=f;I.free(f);a.ya=c;a.Bq(e,a.viewportBounds,b,!1);a.Rb=!1;Xi(a,!1);d.$e&&d.Bd.add(d.B,"scale",b,a.ya);a.M();$i(a)}}
    R.prototype.Bq=function(a,b,c,d){if(!a.w(b)){void 0===d&&(d=!1);d||$i(this);Ui(this);var e=this.layout;null===e||!e.isViewportSized||this.autoScale!==pi||d||a.width===b.width&&a.height===b.height||e.C();e=this.currentTool;!0===this.Wf&&e instanceof Oa&&(this.lastInput.documentPoint=this.Rt(this.lastInput.viewPoint),Oe(e,this));this.Rb||this.Ux(a,b);pj(this);this.Sd.scale=c;this.Sd.position.x=a.x;this.Sd.position.y=a.y;this.Sd.bounds.assign(a);this.Sd.Mv=d;this.R("ViewportBoundsChanged",this.Sd,a);
      this.isVirtualized&&this.links.each(function(a){a.isAvoiding&&a.actualBounds.Gc(b)&&a.Ta()})}};
    function pj(a,b){void 0===b&&(b=null);var c=a.Fb;if(null!==c&&c.visible){for(var d=M.alloc(),e=1,f=1,g=c.W.j,h=g.length,k=0;k<h;k++){var l=g[k],m=l.interval;2>m||(Wj(l.figure)?f=f*m/J.Px(f,m):e=e*m/J.Px(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=I.alloc();J.mq(a,g,0,0,
      d.width,d.height,b);b.offset(-d.width,-d.height);M.free(d);c.part.location=b;I.free(b)}}R.prototype.clearSelection=function(a){void 0===a&&(a=!1);var b=this.selection;if(0!==b.count){a||this.R("ChangingSelection",b);for(var c=b.na(),d=c.length,e=0;e<d;e++)c[e].isSelected=!1;b.ea();b.clear();b.freeze();a||this.R("ChangedSelection",b)}};
    R.prototype.select=function(a){null!==a&&a.layer.diagram===this&&(!a.isSelected||1<this.selection.count)&&(this.R("ChangingSelection",this.selection),this.clearSelection(!0),a.isSelected=!0,this.R("ChangedSelection",this.selection))};
    R.prototype.uA=function(a){this.R("ChangingSelection",this.selection);this.clearSelection(!0);if(Aa(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];d instanceof U||B("Diagram.selectCollection given something that is not a Part: "+d);d.isSelected=!0}else for(a=a.iterator;a.next();)b=a.value,b instanceof U||B("Diagram.selectCollection given something that is not a Part: "+b),b.isSelected=!0;this.R("ChangedSelection",this.selection)};
    R.prototype.clearHighlighteds=function(){var a=this.highlighteds;if(0<a.count){for(var b=a.na(),c=b.length,d=0;d<c;d++)b[d].isHighlighted=!1;a.ea();a.clear();a.freeze()}};t=R.prototype;t.Rz=function(a){null!==a&&a.layer.diagram===this&&(!a.isHighlighted||1<this.highlighteds.count)&&(this.clearHighlighteds(),a.isHighlighted=!0)};
    t.Sz=function(a){a=(new F).addAll(a);for(var b=this.highlighteds.copy().Fq(a).iterator;b.next();)b.value.isHighlighted=!1;for(a=a.iterator;a.next();)b=a.value,b instanceof U||B("Diagram.highlightCollection given something that is not a Part: "+b),b.isHighlighted=!0};
    t.scroll=function(a,b,c){void 0===c&&(c=1);var d="up"===b||"down"===b,e=0;if("pixel"===a)e=c;else if("line"===a)e=c*(d?this.scrollVerticalLineChange:this.scrollHorizontalLineChange);else if("page"===a)a=d?this.viewportBounds.height:this.viewportBounds.width,a*=this.scale,0!==a&&(e=c*Math.max(a-(d?this.scrollVerticalLineChange:this.scrollHorizontalLineChange),0));else{if("document"===a){e=this.documentBounds;c=this.viewportBounds;d=I.alloc();"up"===b?this.position=d.h(c.x,e.y):"left"===b?this.position=
      d.h(e.x,c.y):"down"===b?this.position=d.h(c.x,e.bottom-c.height):"right"===b&&(this.position=d.h(e.right-c.width,c.y));I.free(d);return}B("scrolling unit must be 'pixel', 'line', 'page', or 'document', not: "+a)}e/=this.scale;c=this.position.copy();"up"===b?c.y=this.position.y-e:"down"===b?c.y=this.position.y+e:"left"===b?c.x=this.position.x-e:"right"===b?c.x=this.position.x+e:B("scrolling direction must be 'up', 'down', 'left', or 'right', not: "+b);this.position=c};
    t.fw=function(a){var b=this.viewportBounds;b.Ae(a)||(a=a.center,a.x-=b.width/2,a.y-=b.height/2,this.position=a)};t.dt=function(a){var b=this.viewportBounds;a=a.center;a.x-=b.width/2;a.y-=b.height/2;this.position=a};t.Nq=function(a){var b=this.kb;b.reset();1!==this.ya&&b.scale(this.ya);var c=this.ma;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return a.copy().transform(this.kb)};
    t.DA=function(a){var b=this.kb,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.Rt=function(a){var b=this.kb;b.reset();1!==this.ya&&b.scale(this.ya);var c=this.ma;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return Ab(a.copy(),this.kb)};function gk(a){var b=a.isModified;a.cv!==b&&(a.cv=b,a.R("Modified"))}function kk(a){a=si.get(a);return null!==a?new a:new ti}
    R.prototype.doModelChanged=function(a){var b=this;if(a.model===this.model){var c=a.change,d=a.propertyName;if(c===ve&&"S"===d[0])if("StartingFirstTransaction"===d){var e=this;a=this.toolManager;a.mouseDownTools.each(function(a){a.diagram=e});a.mouseMoveTools.each(function(a){a.diagram=e});a.mouseUpTools.each(function(a){a.diagram=e});this.Bc||this.je||(this.pj=!0,this.sj&&(this.xe=!0))}else"StartingUndo"===d||"StartingRedo"===d?(a=this.animationManager,a.defaultAnimation.isAnimating&&!this.skipsUndoManager&&
    a.Xc(),this.R("ChangingSelection",this.selection)):"StartedTransaction"===d&&(a=this.animationManager,a.defaultAnimation.isAnimating&&!this.skipsUndoManager&&a.Xc());else if(this.Z){this.Z=!1;try{if(""===a.modelChange&&c===ve){if("FinishedUndo"===d||"FinishedRedo"===d)this.R("ChangedSelection",this.selection),Vi(this);var f=this.animationManager;"RolledBackTransaction"===d&&f.Xc();this.pj=!0;this.Wc();0!==this.undoManager.transactionLevel&&1!==this.undoManager.transactionLevel||Dh(f);"CommittedTransaction"===
    d&&this.undoManager.Du&&(this.Hd=Math.min(this.Hd,this.undoManager.historyIndex-1));"CommittedTransaction"!==d&&"RolledBackTransaction"!==d||!this.undoManager.isPendingUnmodified||setTimeout(function(){b.isModified=!1},1);var g=a.isTransactionFinished;g&&(gk(this),this.zt.clear(),Oh(this.animationManager));if(!this.hs&&g){this.hs=!0;var h=this;sa(function(){h.currentTool.standardMouseOver();h.hs=!1},10)}}}finally{this.Z=!0}}}};function Hj(a,b){b=b.W.j;for(var c=b.length,d=0;d<c;d++)lk(a,b[d])}
    function lk(a,b){if(b instanceof mk){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){var d=b.Tg;null!==d&&(d.bl instanceof Event&&null!==b.zc&&b.zc(b,d.bl),!0===d.Pr&&(null!==b.lf&&b.lf(b,d.Ru),null!==b.diagram&&b.diagram.ss.add(b)));c=c.getAttribute("src");d=a.Ci.H(c);if(null===d)d=[],d.push(b),a.Ci.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}}
    function nk(a,b){if(b instanceof mk){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){c=c.getAttribute("src");var d=a.Ci.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.Ci.remove(c),ok(c));break}}}}R.prototype.yd=function(){this.partManager.yd()};R.prototype.Tj=function(a,b){this.Jc.Tj(a,b)};R.prototype.Vj=function(a,b){this.Jc.Vj(a,b)};R.prototype.findPartForKey=function(a){return this.partManager.findPartForKey(a)};R.prototype.Jb=function(a){return this.partManager.Jb(a)};
    R.prototype.findLinkForKey=function(a){return this.partManager.findLinkForKey(a)};t=R.prototype;t.wc=function(a){return this.partManager.wc(a)};t.Si=function(a){return this.partManager.Si(a)};t.vc=function(a){return this.partManager.vc(a)};t.lt=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.lt.apply(this.partManager,b instanceof Array?b:da(ba(b)))};
    t.kt=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.kt.apply(this.partManager,b instanceof Array?b:da(ba(b)))};function Cj(a,b){a.ki=!1;var c=a.zn;c.w(b)||(b=b.G(),a.zn=b,Xi(a,!1),a.R("DocumentBoundsChanged",null,c.copy()),$i(a))}function Li(a){a.ki&&Cj(a,a.computeBounds())}t.vz=function(){for(var a=new F,b=this.nodes;b.next();){var c=b.value;c.isTopLevel&&a.add(c)}for(b=this.links;b.next();)c=b.value,c.isTopLevel&&a.add(c);return a.iterator};t.uz=function(){return this.xh.iterator};
    t.cA=function(a){Vi(this);a&&pk(this,!0);this.pj=!0;Hf(this)};function pk(a,b){for(var c=a.xh.iterator;c.next();)qk(a,c.value,b);null!==a.layout&&(b?a.layout.isValidLayout=!1:a.layout.C())}function qk(a,b,c){if(null!==b){for(var d=b.zl.iterator;d.next();)qk(a,d.value,c);null!==b.layout&&(c?b.layout.isValidLayout=!1:b.layout.C())}}
    function qj(a,b){if(a.Gf&&!a.tr){var c=a.Z;a.Z=!0;var d=a.undoManager.transactionLevel,e=a.layout;try{0===d&&a.ua("Layout");var f=a.animationManager;1>=d&&!f.isAnimating&&!f.qc&&(b||Bh(f,"Layout"));a.Gf=!1;for(var g=a.xh.iterator;g.next();)rk(a,g.value,b,d);e.isValidLayout||(!b||e.isRealtime||null===e.isRealtime||0===d?(e.doLayout(a),Vi(a),e.isValidLayout=!0):a.Gf=!0)}finally{0===d&&a.Ua("Layout"),a.Gf=!e.isValidLayout,a.Z=c}}}
    function rk(a,b,c,d){if(null!==b){for(var e=b.zl.iterator;e.next();)rk(a,e.value,c,d);e=b.layout;null===e||e.isValidLayout||(!c||e.isRealtime||0===d?(b.uk=!b.location.u(),e.doLayout(b),b.C(32),sj(a,b),e.isValidLayout=!0):a.Gf=!0)}}t.Bz=function(){for(var a=new E,b=this.nodes;b.next();){var c=b.value;c.isTopLevel&&null===c.Vi()&&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 G,d=new G;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.wr=c;a.vr=d}
    function Bj(a,b){var c=a.vr.H(b);return null!==c?c:a.vr.H(b.toLowerCase())}function sk(a,b){var c=a.wr.H(b);if(null!==c)return c;c=a.wr.H(b.toLowerCase());if(null!==c)return c;B("Unknown DiagramEvent name: "+b)}t.Uj=function(a,b){a=sk(this,a);null!==a&&a.add(b)};t.ym=function(a,b){a=sk(this,a);null!==a&&a.remove(b)};
    t.R=function(a,b,c){var d=sk(this,a),e=new se;e.diagram=this;a=Bj(this,a);null!==a&&(e.name=a);void 0!==b&&(e.subject=b);void 0!==c&&(e.parameter=c);b=d.length;if(1===b)d.L(0)(e);else if(0!==b)for(d=d.na(),c=0;c<b;c++)(0,d[c])(e)};function tk(a){if(a.animationManager.isAnimating)return!1;var b=a.currentTool;return b===a.toolManager.findTool("Dragging")?!a.Op||b.isComplexRoutingRealtime:!0}t.lk=function(a,b){void 0===b&&(b=null);return uk(this,!1,null,b).lk(a.x,a.y,a.width,a.height)};
    R.prototype.computeOccupiedArea=function(){return this.isVirtualized?this.viewportBounds.copy():this.ki?Wi(this):this.documentBounds.copy()};
    function uk(a,b,c,d){null===a.Gb&&(a.Gb=new vk);if(a.Gb.tt||a.Gb.group!==c||a.Gb.qy!==d){if(null===c){b=a.computeOccupiedArea();b.Vc(100,100);a.Gb.initialize(b);b=N.alloc();for(var e=a.nodes;e.next();){var f=e.value,g=f.layer;null!==g&&g.visible&&!g.isTemporary&&wk(a,f,d,b)}N.free(b)}else{0<c.memberParts.count&&(b=a.computePartsBounds(c.memberParts,!1),b.Vc(20,20),a.Gb.initialize(b));b=N.alloc();for(e=c.memberParts;e.next();)f=e.value,f instanceof W&&wk(a,f,d,b);N.free(b)}a.Gb.group=c;a.Gb.qy=d;a.Gb.tt=
      !1}else b&&xk(a.Gb);return a.Gb}function wk(a,b,c,d){if(b!==c)if(b.isVisible()&&b.avoidable&&!b.isLinkLabel){var e=b.getAvoidableRect(d),f=a.Gb.dm;c=a.Gb.cm;d=e.x+e.width;b=e.y+e.height;for(var g=e.x;g<d;g+=f){for(var h=e.y;h<b;h+=c)yk(a.Gb,g,h);yk(a.Gb,g,b)}for(e=e.y;e<b;e+=c)yk(a.Gb,d,e);yk(a.Gb,d,b)}else if(b instanceof T)for(b=b.memberParts;b.next();)e=b.value,e instanceof W&&wk(a,e,c,d)}
    function zk(a,b){null!==a.Gb&&!a.Gb.tt&&(void 0===b&&(b=null),null===b||b.avoidable&&!b.isLinkLabel)&&(a.Gb.tt=!0)}t=R.prototype;t.ht=function(a){this.$m.assign(a);Ak(this,this.$m).Ma(this.position)?this.Cf():Bk(this)};
    function Bk(a){-1===a.jj&&(a.jj=sa(function(){if(-1!==a.jj&&(a.Cf(),null!==a.lastInput.event)){var b=Ak(a,a.$m);b.Ma(a.position)||(a.position=b,a.lastInput.documentPoint=a.Rt(a.$m),a.doMouseMove(),a.ki=!0,Cj(a,a.documentBounds.copy().Hc(a.computeBounds())),a.Ac=!0,a.Wc(),Bk(a))}},a.Zm))}t.Cf=function(){-1!==this.jj&&(x.clearTimeout(this.jj),this.jj=-1)};
    function Ak(a,b){var c=a.position,d=a.an;if(0>=d.top&&0>=d.left&&0>=d.right&&0>=d.bottom)return c;var e=a.viewportBounds,f=a.scale;e=N.allocAt(0,0,e.width*f,e.height*f);var g=I.allocAt(0,0);if(b.x>=e.x&&b.x<e.x+d.left){var h=Math.max(a.scrollHorizontalLineChange,1);h|=0;g.x-=h;b.x<e.x+d.left/2&&(g.x-=h);b.x<e.x+d.left/4&&(g.x-=4*h)}else b.x<=e.x+e.width&&b.x>e.x+e.width-d.right&&(h=Math.max(a.scrollHorizontalLineChange,1),h|=0,g.x+=h,b.x>e.x+e.width-d.right/2&&(g.x+=h),b.x>e.x+e.width-d.right/4&&
    (g.x+=4*h));b.y>=e.y&&b.y<e.y+d.top?(a=Math.max(a.scrollVerticalLineChange,1),a|=0,g.y-=a,b.y<e.y+d.top/2&&(g.y-=a),b.y<e.y+d.top/4&&(g.y-=4*a)):b.y<=e.y+e.height&&b.y>e.y+e.height-d.bottom&&(a=Math.max(a.scrollVerticalLineChange,1),a|=0,g.y+=a,b.y>e.y+e.height-d.bottom/2&&(g.y+=a),b.y>e.y+e.height-d.bottom/4&&(g.y+=4*a));g.Ma(Gb)||(c=new I(c.x+g.x/f,c.y+g.y/f));N.free(e);I.free(g);return c}t.Bt=function(){return null};t.Nv=function(){return null};t.My=function(a,b){this.lx.add(a,b)};
    function Ck(a,b,c){function d(){var a=+new Date;f=!0;for(g.reset();g.next();)if(!g.value[0].vl){f=!1;break}f||a-l>k?b(c,e,h):x.requestAnimationFrame(d)}for(var e=c.callback,f=!0,g=a.Ci.iterator;g.next();)if(!g.value[0].vl){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.eA=function(a){if(!Sg)return null;void 0===a&&(a=new db);a.returnType="Image";return this.Wx(a)};
    t.Wx=function(a){void 0===a&&(a=new db);return Ck(this,this.fA,a)};
    t.fA=function(a,b,c){var d=Dk(c,a,"canvas",null);if(null===d)return null;c=d.V.canvas;var e=null;if(null!==c)switch(e=a.returnType,void 0===e?e="string":e=e.toLowerCase(),e){case "imagedata":e=d.getImageData(0,0,c.width,c.height);break;case "image":d=(a.document||document).createElement("img");d.src=c.toDataURL(a.type,a.details);e=d;break;case "blob":"function"!==typeof b&&B('Error: Diagram.makeImageData called with "returnType: toBlob", but no required "callback" function property defined.');if("function"===
      typeof c.toBlob)return c.toBlob(b,a.type,a.details),"toBlob";if("function"===typeof c.msToBlob)return b(c.msToBlob()),"msToBlob";b(null);return null;default:e=c.toDataURL(a.type,a.details)}return"function"===typeof b?(b(e),null):e};
    function Dk(a,b,c,d){a.animationManager.Xc();a.Wc();if(null===a.sa)return null;"object"!==typeof b&&B("properties argument must be an Object.");var e=b.size||null,f=b.scale||null;void 0!==b.scale&&isNaN(b.scale)&&(f="NaN");var g=b.maxSize;void 0===b.maxSize&&(g="SVG"===c?new M(Infinity,Infinity):new M(2E3,2E3));var h=b.position||null,k=b.parts||null,l=void 0===b.padding?1:b.padding,m=b.background||null,n=b.omitTemporary;void 0===n&&(n=!0);var p=b.document||document,r=b.elementFinished||null,q=b.showTemporary;
      void 0===q&&(q=!n);b=b.showGrid;void 0===b&&(b=q);null!==e&&isNaN(e.width)&&isNaN(e.height)&&(e=null);"number"===typeof l?l=new oc(l):l instanceof oc||B("MakeImage padding must be a Margin or a number.");l.left=Math.max(l.left,0);l.right=Math.max(l.right,0);l.top=Math.max(l.top,0);l.bottom=Math.max(l.bottom,0);a.Db.sc(!0);n=new Ek(null,p);var u=n.context;if(!(e||f||k||h)){n.width=a.wa+Math.ceil(l.left+l.right);n.height=a.va+Math.ceil(l.top+l.bottom);if("SVG"===c){if(null===d)return null;d.resize(n.width,
        n.height,n.width,n.height);d.ownerDocument=p;d.jq=r;zj(a,d.context,l,new M(n.width,n.height),a.ya,a.ma,k,m,q,b);return d.context}a.Xk=!1;zj(a,u,l,new M(n.width,n.height),a.ya,a.ma,k,m,q,b);a.Xk=!0;return n.context}var v=a.yn,w=a.documentBounds.copy();w.mw(a.bb);if(q)for(var y=a.Ja.j,z=y.length,A=0;A<z;A++){var C=y[A];if(C.visible&&C.isTemporary){C=C.Ca.j;for(var H=C.length,L=0;L<H;L++){var K=C[L];K.isInDocumentBounds&&K.isVisible()&&(K=K.actualBounds,K.u()&&w.Hc(K))}}}y=new I(w.x,w.y);if(null!==k){z=
        !0;A=k.iterator;for(A.reset();A.next();)if(C=A.value,C instanceof U&&(H=C.layer,(null===H||H.visible)&&(null===H||q||!H.isTemporary)&&C.isVisible()&&(C=C.actualBounds,C.u())))if(z){z=!1;var V=C.copy()}else V.Hc(C);z&&(V=new N(0,0,0,0));w.width=V.width;w.height=V.height;y.x=V.x;y.y=V.y}null!==h&&h.u()&&(y=h,f||(f=v));V=h=0;null!==l&&(h=l.left+l.right,V=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-V)));null!==e&&null!==f?("NaN"===
      f&&(f=v),e.u()?(e=A,w=z):isNaN(z)?(e=A,w=w.height*f):(e=w.width*f,w=z)):null!==e?e.u()?(f=Math.min(A/w.width,z/w.height),e=A,w=z):isNaN(z)?(f=A/w.width,e=A,w=w.height*f):(f=z/w.height,e=w.width*f,w=z):null!==f?"NaN"===f&&g.u()?(f=Math.min((g.width-h)/w.width,(g.height-V)/w.height),f>v?(f=v,e=w.width,w=w.height):(e=g.width,w=g.height)):(e=w.width*f,w=w.height*f):(f=v,e=w.width,w=w.height);null!==l?(e+=h,w+=V):l=new oc(0);null!==g&&(v=g.width,g=g.height,isNaN(v)&&(v=2E3),isNaN(g)&&(g=2E3),isFinite(v)&&
      (e=Math.min(e,v)),isFinite(g)&&(w=Math.min(w,g)));n.width=Math.ceil(e);n.height=Math.ceil(w);if("SVG"===c){if(null===d)return null;d.resize(n.width,n.height,n.width,n.height);d.ownerDocument=p;d.jq=r;zj(a,d.context,l,new M(Math.ceil(e),Math.ceil(w)),f,y,k,m,q,b);return d.context}a.Xk=!1;zj(a,u,l,new M(Math.ceil(e),Math.ceil(w)),f,y,k,m,q,b);a.Xk=!0;return n.context}
    ma.Object.defineProperties(R.prototype,{div:{get:function(){return this.La},set:function(a){if(this.La!==a){Qa=[];var b=this.La;null!==b?(b.B=void 0,b.innerHTML="",null!==this.sa&&(b=this.sa.Ea,this.removeEventListener(b,"touchstart",this.rw,!1),this.removeEventListener(b,"touchmove",this.qw,!1),this.removeEventListener(b,"touchend",this.pw,!1),this.sa.Hx()),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.Db=this.sa=null,this.removeEventListener(x,"resize",this.xw,!1),this.removeEventListener(x,"mousemove",this.qk,!0),this.removeEventListener(x,"mousedown",this.pk,!0),this.removeEventListener(x,"mouseup",this.sk,!0),this.removeEventListener(x,"wheel",this.tk,!0),this.removeEventListener(x,"mouseout",this.rk,!0),Ce===this&&(Ce=null)):this.je=!1;this.La=null;if(null!==a){if(b=a.B)b.div=null;Hi(this,
          a);this.Fe()}}}},zx:{get:function(){return this.Io}},kk:{get:function(){return this.je}},draggedLink:{get:function(){return this.yr},set:function(a){this.yr!==a&&(this.yr=a,null!==a&&(this.ms=a.fromPort,this.ns=a.toPort))}},Zx:{get:function(){return this.ms},set:function(a){this.ms=a}},$x:{get:function(){return this.ns},set:function(a){this.ns=a}},animationManager:{
        get:function(){return this.Jc}},undoManager:{get:function(){return this.ac.undoManager}},skipsUndoManager:{get:function(){return this.qg},set:function(a){this.qg=a;this.ac.skipsUndoManager=a}},delaysLayout:{get:function(){return this.tr},set:function(a){this.tr=a}},opacity:{get:function(){return this.qb},set:function(a){var b=this.qb;b!==a&&((0>a||1<a)&&va(a,"0 <= value <= 1",
          R,"opacity"),this.qb=a,this.g("opacity",b,a),this.M())}},validCycle:{get:function(){return this.Ys},set:function(a){var b=this.Ys;b!==a&&(this.Ys=a,this.g("validCycle",b,a))}},layers:{get:function(){return this.Ja.iterator}},isModelReadOnly:{get:function(){var a=this.ac;return null===a?!1:a.isReadOnly},set:function(a){var b=this.ac;null!==b&&(b.isReadOnly=a)}},isReadOnly:{get:function(){return this.Xf},
        set:function(a){var b=this.Xf;b!==a&&(this.Xf=a,this.g("isReadOnly",b,a))}},isEnabled:{get:function(){return this.Mc},set:function(a){var b=this.Mc;b!==a&&(this.Mc=a,this.g("isEnabled",b,a))}},allowClipboard:{get:function(){return this.Uq},set:function(a){var b=this.Uq;b!==a&&(this.Uq=a,this.g("allowClipboard",b,a))}},allowCopy:{get:function(){return this.Rh},set:function(a){var b=this.Rh;b!==a&&(this.Rh=a,this.g("allowCopy",
          b,a))}},allowDelete:{get:function(){return this.Sh},set:function(a){var b=this.Sh;b!==a&&(this.Sh=a,this.g("allowDelete",b,a))}},allowDragOut:{get:function(){return this.Vq},set:function(a){var b=this.Vq;b!==a&&(this.Vq=a,this.g("allowDragOut",b,a))}},allowDrop:{get:function(){return this.Wq},set:function(a){var b=this.Wq;b!==a&&(this.Wq=a,this.g("allowDrop",b,a))}},allowTextEdit:{
        get:function(){return this.ai},set:function(a){var b=this.ai;b!==a&&(this.ai=a,this.g("allowTextEdit",b,a))}},allowGroup:{get:function(){return this.Th},set:function(a){var b=this.Th;b!==a&&(this.Th=a,this.g("allowGroup",b,a))}},allowUngroup:{get:function(){return this.bi},set:function(a){var b=this.bi;b!==a&&(this.bi=a,this.g("allowUngroup",b,a))}},allowInsert:{get:function(){return this.Yq},set:function(a){var b=
          this.Yq;b!==a&&(this.Yq=a,this.g("allowInsert",b,a))}},allowLink:{get:function(){return this.Uh},set:function(a){var b=this.Uh;b!==a&&(this.Uh=a,this.g("allowLink",b,a))}},allowRelink:{get:function(){return this.Wh},set:function(a){var b=this.Wh;b!==a&&(this.Wh=a,this.g("allowRelink",b,a))}},allowMove:{get:function(){return this.Vh},set:function(a){var b=this.Vh;b!==a&&(this.Vh=a,this.g("allowMove",b,a))}},allowReshape:{
        get:function(){return this.Xh},set:function(a){var b=this.Xh;b!==a&&(this.Xh=a,this.g("allowReshape",b,a))}},allowResize:{get:function(){return this.Yh},set:function(a){var b=this.Yh;b!==a&&(this.Yh=a,this.g("allowResize",b,a))}},allowRotate:{get:function(){return this.Zh},set:function(a){var b=this.Zh;b!==a&&(this.Zh=a,this.g("allowRotate",b,a))}},allowSelect:{get:function(){return this.$h},set:function(a){var b=
          this.$h;b!==a&&(this.$h=a,this.g("allowSelect",b,a))}},allowUndo:{get:function(){return this.Zq},set:function(a){var b=this.Zq;b!==a&&(this.Zq=a,this.g("allowUndo",b,a))}},allowZoom:{get:function(){return this.ar},set:function(a){var b=this.ar;b!==a&&(this.ar=a,this.g("allowZoom",b,a))}},hasVerticalScrollbar:{get:function(){return this.dl},set:function(a){var b=this.dl;b!==a&&(this.dl=a,$i(this),this.M(),this.g("hasVerticalScrollbar",
          b,a),Xi(this,!1))}},hasHorizontalScrollbar:{get:function(){return this.cl},set:function(a){var b=this.cl;b!==a&&(this.cl=a,$i(this),this.M(),this.g("hasHorizontalScrollbar",b,a),Xi(this,!1))}},allowHorizontalScroll:{get:function(){return this.Xq},set:function(a){var b=this.Xq;b!==a&&(this.Xq=a,this.g("allowHorizontalScroll",b,a),Xi(this,!1))}},allowVerticalScroll:{get:function(){return this.$q},set:function(a){var b=
          this.$q;b!==a&&(this.$q=a,this.g("allowVerticalScroll",b,a),Xi(this,!1))}},scrollHorizontalLineChange:{get:function(){return this.Ds},set:function(a){var b=this.Ds;b!==a&&(0>a&&va(a,">= 0",R,"scrollHorizontalLineChange"),this.Ds=a,this.g("scrollHorizontalLineChange",b,a))}},scrollVerticalLineChange:{get:function(){return this.Hs},set:function(a){var b=this.Hs;b!==a&&(0>a&&va(a,">= 0",R,"scrollVerticalLineChange"),this.Hs=a,this.g("scrollVerticalLineChange",
          b,a))}},lastInput:{get:function(){return this.ah},set:function(a){this.ah=a}},firstInput:{get:function(){return this.Sf},set:function(a){this.Sf=a}},currentCursor:{get:function(){return this.mr},set:function(a){""===a&&(a=this.xn);if(this.mr!==a){var b=this.sa,c=this.La;if(null!==b){this.mr=a;var d=b.style.cursor;b.style.cursor=a;c.style.cursor=a;b.style.cursor===d&&(b.style.cursor="-webkit-"+a,c.style.cursor=
          "-webkit-"+a,b.style.cursor===d&&(b.style.cursor="-moz-"+a,c.style.cursor="-moz-"+a,b.style.cursor===d&&(b.style.cursor=a,c.style.cursor=a)))}}}},defaultCursor:{get:function(){return this.xn},set:function(a){""===a&&(a="auto");var b=this.xn;b!==a&&(this.xn=a,this.g("defaultCursor",b,a))}},click:{get:function(){return this.Lf},set:function(a){var b=this.Lf;b!==a&&(this.Lf=a,this.g("click",b,a))}},doubleClick:{
        get:function(){return this.Qf},set:function(a){var b=this.Qf;b!==a&&(this.Qf=a,this.g("doubleClick",b,a))}},contextClick:{get:function(){return this.Mf},set:function(a){var b=this.Mf;b!==a&&(this.Mf=a,this.g("contextClick",b,a))}},mouseOver:{get:function(){return this.ig},set:function(a){var b=this.ig;b!==a&&(this.ig=a,this.g("mouseOver",b,a))}},mouseHover:{get:function(){return this.gg},set:function(a){var b=
          this.gg;b!==a&&(this.gg=a,this.g("mouseHover",b,a))}},mouseHold:{get:function(){return this.fg},set:function(a){var b=this.fg;b!==a&&(this.fg=a,this.g("mouseHold",b,a))}},mouseDragOver:{get:function(){return this.gs},set:function(a){var b=this.gs;b!==a&&(this.gs=a,this.g("mouseDragOver",b,a))}},mouseDrop:{get:function(){return this.dg},set:function(a){var b=this.dg;b!==a&&(this.dg=a,this.g("mouseDrop",b,a))}},
      handlesDragDropForTopLevelParts:{get:function(){return this.Ir},set:function(a){var b=this.Ir;b!==a&&(this.Ir=a,this.g("handlesDragDropForTopLevelParts",b,a))}},mouseEnter:{get:function(){return this.eg},set:function(a){var b=this.eg;b!==a&&(this.eg=a,this.g("mouseEnter",b,a))}},mouseLeave:{get:function(){return this.hg},set:function(a){var b=this.hg;b!==a&&(this.hg=a,this.g("mouseLeave",b,a))}},toolTip:{
        get:function(){return this.sg},set:function(a){var b=this.sg;b!==a&&(this.sg=a,this.g("toolTip",b,a))}},contextMenu:{get:function(){return this.Nf},set:function(a){var b=this.Nf;b!==a&&(this.Nf=a,this.g("contextMenu",b,a))}},commandHandler:{get:function(){return this.gr},set:function(a){this.gr!==a&&(this.gr=a,a.Zd(this))}},toolManager:{get:function(){return this.Us},set:function(a){this.Us!==a&&
        (this.Us=a,a.diagram=this)}},defaultTool:{get:function(){return this.sr},set:function(a){var b=this.sr;b!==a&&(this.sr=a,a.diagram=this,this.currentTool===b&&(this.currentTool=a))}},currentTool:{get:function(){return this.pr},set:function(a){var b=this.pr;null!==b&&(b.isActive&&b.doDeactivate(),b.cancelWaitAfter(),b.doStop());null===a&&(a=this.defaultTool);null!==a&&(this.pr=a,a.diagram=this,a.doStart())}},selection:{
        get:function(){return this.Tu}},maxSelectionCount:{get:function(){return this.cs},set:function(a){var b=this.cs;if(b!==a)if(0<=a&&!isNaN(a)){if(this.cs=a,this.g("maxSelectionCount",b,a),!this.undoManager.isUndoingRedoing&&(a=this.selection.count-a,0<a)){this.R("ChangingSelection",this.selection);b=this.selection.na();for(var c=0;c<a;c++)b[c].isSelected=!1;this.R("ChangedSelection",this.selection)}}else va(a,">= 0",R,"maxSelectionCount")}},nodeSelectionAdornmentTemplate:{
        get:function(){return this.Ro},set:function(a){var b=this.Ro;b!==a&&(this.Ro=a,this.g("nodeSelectionAdornmentTemplate",b,a))}},groupSelectionAdornmentTemplate:{get:function(){return this.Vn},set:function(a){var b=this.Vn;b!==a&&(this.Vn=a,this.g("groupSelectionAdornmentTemplate",b,a))}},linkSelectionAdornmentTemplate:{get:function(){return this.qo},set:function(a){var b=this.qo;b!==a&&(this.qo=a,this.g("linkSelectionAdornmentTemplate",
          b,a))}},highlighteds:{get:function(){return this.tu}},isModified:{get:function(){var a=this.undoManager;return a.isEnabled?null!==a.currentTransaction?!0:this.$n&&this.Hd!==a.historyIndex:this.$n},set:function(a){if(this.$n!==a){this.$n=a;var b=this.undoManager;!a&&b.isEnabled&&(this.Hd=b.historyIndex);a||gk(this)}}},model:{get:function(){return this.ac},set:function(a){var b=this.ac;if(b!==a){this.currentTool.doCancel();
          null!==b&&b.undoManager!==a.undoManager&&b.undoManager.isInTransaction&&B("Do not replace a Diagram.model while a transaction is in progress.");this.animationManager.Xc(!0);var c=Ki(this,!0);this.je=!1;this.sj=!0;this.Hd=-2;this.xe=!1;var d=this.Bc;this.Bc=!0;Bh(this.animationManager,"Model");null!==b&&(null!==this.pe&&this.pe.each(function(a){b.wk(a)}),b.wk(this.Ic));this.ac=a;this.partManager=kk(this.ac.constructor.type);for(var e=0;e<c.length;e++)this.add(c[e]);a.Bh(this.kd);this.partManager.addAllModeledParts();
          a.wk(this.kd);a.Bh(this.Ic);null!==this.pe&&this.pe.each(function(b){a.Bh(b)});this.Bc=d;this.Rb||this.M();null!==b&&a.undoManager.copyProperties(b.undoManager)}}},Z:{get:function(){return this.Cu},set:function(a){this.Cu=a}},zt:{get:function(){return this.$w}},skipsModelSourceBindings:{get:function(){return this.Uu},set:function(a){this.Uu=a}},Qt:{get:function(){return this.Ms},
        set:function(a){this.Ms=a}},nodeTemplate:{get:function(){return this.Ze.H("")},set:function(a){var b=this.Ze.H("");b!==a&&(this.Ze.add("",a),this.g("nodeTemplate",b,a),this.undoManager.isUndoingRedoing||this.yd())}},nodeTemplateMap:{get:function(){return this.Ze},set:function(a){var b=this.Ze;b!==a&&(this.Ze=a,this.g("nodeTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.yd())}},groupTemplate:{get:function(){return this.Zg.H("")},
        set:function(a){var b=this.Zg.H("");b!==a&&(this.Zg.add("",a),this.g("groupTemplate",b,a),this.undoManager.isUndoingRedoing||this.yd())}},groupTemplateMap:{get:function(){return this.Zg},set:function(a){var b=this.Zg;b!==a&&(this.Zg=a,this.g("groupTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.yd())}},linkTemplate:{get:function(){return this.Zf.H("")},set:function(a){var b=this.Zf.H("");b!==a&&(this.Zf.add("",a),this.g("linkTemplate",
          b,a),this.undoManager.isUndoingRedoing||this.yd())}},linkTemplateMap:{get:function(){return this.Zf},set:function(a){var b=this.Zf;b!==a&&(this.Zf=a,this.g("linkTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.yd())}},isMouseCaptured:{get:function(){return this.yu},set:function(a){var b=this.sa;null!==b&&(b=b.Ea,b instanceof SVGElement||(a?(this.lastInput.bubbles=!1,this.Vm?(this.removeEventListener(b,"pointermove",this.um,!1),this.removeEventListener(b,
          "pointerdown",this.tm,!1),this.removeEventListener(b,"pointerup",this.wm,!1),this.removeEventListener(b,"pointerout",this.vm,!1),this.addEventListener(x,"pointermove",this.um,!0),this.addEventListener(x,"pointerdown",this.tm,!0),this.addEventListener(x,"pointerup",this.wm,!0),this.addEventListener(x,"pointerout",this.vm,!0)):(this.removeEventListener(b,"mousemove",this.qk,!1),this.removeEventListener(b,"mousedown",this.pk,!1),this.removeEventListener(b,"mouseup",this.sk,!1),this.removeEventListener(b,
          "mouseout",this.rk,!1),this.addEventListener(x,"mousemove",this.qk,!0),this.addEventListener(x,"mousedown",this.pk,!0),this.addEventListener(x,"mouseup",this.sk,!0),this.addEventListener(x,"mouseout",this.rk,!0)),this.removeEventListener(b,"wheel",this.tk,!1),this.addEventListener(x,"wheel",this.tk,!0),this.addEventListener(x,"selectstart",this.preventDefault,!1)):(this.Vm?(this.removeEventListener(x,"pointermove",this.um,!0),this.removeEventListener(x,"pointerdown",this.tm,!0),this.removeEventListener(x,
          "pointerup",this.wm,!0),this.removeEventListener(x,"pointerout",this.vm,!0),this.addEventListener(b,"pointermove",this.um,!1),this.addEventListener(b,"pointerdown",this.tm,!1),this.addEventListener(b,"pointerup",this.wm,!1),this.addEventListener(b,"pointerout",this.vm,!1)):(this.removeEventListener(x,"mousemove",this.qk,!0),this.removeEventListener(x,"mousedown",this.pk,!0),this.removeEventListener(x,"mouseup",this.sk,!0),this.removeEventListener(x,"mouseout",this.rk,!0),this.addEventListener(b,"mousemove",
          this.qk,!1),this.addEventListener(b,"mousedown",this.pk,!1),this.addEventListener(b,"mouseup",this.sk,!1),this.addEventListener(b,"mouseout",this.rk,!1)),this.removeEventListener(x,"wheel",this.tk,!0),this.removeEventListener(x,"selectstart",this.preventDefault,!1),this.addEventListener(b,"wheel",this.tk,!1)),this.yu=a))}},position:{get:function(){return this.ma},set:function(a){var b=I.alloc().assign(this.ma);if(!b.w(a)){var c=this.viewportBounds.copy();this.ma.assign(a);
          Qh(this.animationManager,b,this.ma);this.Rb||null===this.sa&&!this.Zl.u()||(this.Rb=!0,a=this.scale,Zi(this,this.zn,this.wa/a,this.va/a,this.lj,!1),this.Rb=!1);this.Rb||this.Bq(c,this.viewportBounds,this.ya,!1)}I.free(b)}},initialPosition:{get:function(){return this.Kr},set:function(a){this.Kr.w(a)||(this.Kr=a.G())}},initialScale:{get:function(){return this.Lr},set:function(a){this.Lr!==a&&(this.Lr=a)}},grid:{
        get:function(){null===this.Fb&&Qi(this);return this.Fb},set:function(a){var b=this.Fb;if(b!==a){null===b&&(Qi(this),b=this.Fb);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.Fb=a;a.name="GRID";null!==c&&c.add(a);pj(this);this.M();this.g("grid",b,a)}}},viewportBounds:{get:function(){var a=this.bv,b=this.ma,c=this.ya;if(null===this.sa)return this.Zl.u()&&a.h(b.x,b.y,this.wa/c,this.va/c),a;a.h(b.x,b.y,Math.max(this.wa,
          0)/c,Math.max(this.va,0)/c);return a}},viewSize:{get:function(){return this.Zl},set:function(a){var b=this.viewSize;b.w(a)||(this.Zl=a=a.G(),this.wa=a.width,this.va=a.height,this.Na(),this.g("viewSize",b,a))}},fixedBounds:{get:function(){return this.Fr},set:function(a){var b=this.Fr;b.w(a)||(-Infinity!==a.width&&Infinity!==a.height&&-Infinity!==a.height||B("fixedBounds width/height must not be Infinity"),this.Fr=a=a.G(),this.Na(),this.g("fixedBounds",
          b,a))}},scrollMargin:{get:function(){return this.Fi},set:function(a){"number"===typeof a&&(a=new oc(a));var b=this.Fi;b.w(a)||(this.Fi=a=a.G(),this.g("scrollMargin",b,a),this.Fe())}},scrollMode:{get:function(){return this.Gi},set:function(a){var b=this.Gi;b!==a&&(this.Gi=a,a===Xh&&Xi(this,!1),this.g("scrollMode",b,a),this.M())}},scrollsPageOnFocus:{get:function(){return this.Is},set:function(a){var b=this.Is;
          b!==a&&(this.Is=a,this.g("scrollsPageOnFocus",b,a))}},positionComputation:{get:function(){return this.vs},set:function(a){var b=this.vs;b!==a&&(this.vs=a,Xi(this,!1),this.g("positionComputation",b,a))}},scaleComputation:{get:function(){return this.Bs},set:function(a){var b=this.Bs;b!==a&&(this.Bs=a,Vj(this,this.scale,this.scale),this.g("scaleComputation",b,a))}},documentBounds:{get:function(){return this.zn}},
      isVirtualized:{get:function(){return this.Vr},set:function(a){var b=this.Vr;b!==a&&(this.Vr=a,this.g("isVirtualized",b,a))}},scale:{get:function(){return this.ya},set:function(a){var b=this.ya;b!==a&&Vj(this,b,a)}},defaultScale:{get:function(){return this.yn},set:function(a){this.yn=a}},autoScale:{get:function(){return this.Jg},set:function(a){var b=this.Jg;b!==a&&(this.Jg=a,this.g("autoScale",
          b,a),a!==pi&&Xi(this,!1))}},initialAutoScale:{get:function(){return this.Vf},set:function(a){var b=this.Vf;b!==a&&(this.Vf=a,this.g("initialAutoScale",b,a))}},initialViewportSpot:{get:function(){return this.Mr},set:function(a){var b=this.Mr;b!==a&&(a.eb()||B("initialViewportSpot must be a specific Spot: "+a),this.Mr=a,this.g("initialViewportSpot",b,a))}},initialDocumentSpot:{get:function(){return this.Jr},set:function(a){var b=
          this.Jr;b!==a&&(a.eb()||B("initialViewportSpot must be a specific Spot: "+a),this.Jr=a,this.g("initialDocumentSpot",b,a))}},minScale:{get:function(){return this.ds},set:function(a){var b=this.ds;b!==a&&(0<a?(this.ds=a,this.g("minScale",b,a),a>this.scale&&(this.scale=a)):va(a,"> 0",R,"minScale"))}},maxScale:{get:function(){return this.bs},set:function(a){var b=this.bs;b!==a&&(0<a?(this.bs=a,this.g("maxScale",b,a),a<this.scale&&(this.scale=
          a)):va(a,"> 0",R,"maxScale"))}},zoomPoint:{get:function(){return this.at},set:function(a){this.at.w(a)||(this.at=a=a.G())}},contentAlignment:{get:function(){return this.lj},set:function(a){var b=this.lj;b.w(a)||(this.lj=a=a.G(),this.g("contentAlignment",b,a),Xi(this,!1))}},initialContentAlignment:{get:function(){return this.Xn},set:function(a){var b=this.Xn;b.w(a)||(this.Xn=a=a.G(),this.g("initialContentAlignment",
          b,a))}},padding:{get:function(){return this.bb},set:function(a){"number"===typeof a&&(a=new oc(a));var b=this.bb;b.w(a)||(this.bb=a=a.G(),this.Na(),this.g("padding",b,a))}},partManager:{get:function(){return this.Ia},set:function(a){var b=this.Ia;b!==a&&(null!==a.diagram&&B("Cannot share PartManagers between Diagrams: "+a.toString()),null!==b&&b.Zd(null),this.Ia=a,a.Zd(this))}},nodes:{get:function(){return this.partManager.nodes.iterator}},
      links:{get:function(){return this.partManager.links.iterator}},parts:{get:function(){return this.partManager.parts.iterator}},layout:{get:function(){return this.ic},set:function(a){var b=this.ic;b!==a&&(this.ic=a,a.diagram=this,a.group=null,this.Gf=!0,this.g("layout",b,a),this.Pb())}},isTreePathToChildren:{get:function(){return this.Ur},set:function(a){var b=this.Ur;if(b!==a&&(this.Ur=
          a,this.g("isTreePathToChildren",b,a),!this.undoManager.isUndoingRedoing))for(a=this.nodes;a.next();)Fk(a.value)}},treeCollapsePolicy:{get:function(){return this.Ws},set:function(a){var b=this.Ws;b!==a&&(a!==ri&&a!==Gk&&a!==Hk&&B("Unknown Diagram.treeCollapsePolicy: "+a),this.Ws=a,this.g("treeCollapsePolicy",b,a))}},De:{get:function(){return this.wu},set:function(a){this.wu=a}},autoScrollInterval:{get:function(){return this.Zm},
        set:function(a){var b=this.Zm;b!==a&&(this.Zm=a,this.g("autoScrollInterval",b,a))}},autoScrollRegion:{get:function(){return this.an},set:function(a){"number"===typeof a&&(a=new oc(a));var b=this.an;b.w(a)||(this.an=a=a.G(),this.Na(),this.g("autoScrollRegion",b,a))}}});ma.Object.defineProperties(R,{licenseKey:{get:function(){return Ik.Xb()},set:function(a){Ik.add(a)}},version:{get:function(){return Jk}}});
    R.prototype.makeImageData=R.prototype.Wx;R.prototype.makeImage=R.prototype.eA;R.prototype.addRenderer=R.prototype.My;R.prototype.makeSVG=R.prototype.Nv;R.prototype.makeSvg=R.prototype.Bt;R.prototype.stopAutoScroll=R.prototype.Cf;R.prototype.doAutoScroll=R.prototype.ht;R.prototype.isUnoccupied=R.prototype.lk;R.prototype.raiseDiagramEvent=R.prototype.R;R.prototype.removeDiagramListener=R.prototype.ym;R.prototype.addDiagramListener=R.prototype.Uj;R.prototype.findTreeRoots=R.prototype.Bz;
    R.prototype.layoutDiagram=R.prototype.cA;R.prototype.findTopLevelGroups=R.prototype.uz;R.prototype.findTopLevelNodesAndLinks=R.prototype.vz;R.prototype.findLinksByExample=R.prototype.kt;R.prototype.findNodesByExample=R.prototype.lt;R.prototype.findLinkForData=R.prototype.vc;R.prototype.findNodeForData=R.prototype.Si;R.prototype.findPartForData=R.prototype.wc;R.prototype.findLinkForKey=R.prototype.findLinkForKey;R.prototype.findNodeForKey=R.prototype.Jb;R.prototype.findPartForKey=R.prototype.findPartForKey;
    R.prototype.rebuildParts=R.prototype.yd;R.prototype.transformViewToDoc=R.prototype.Rt;R.prototype.transformRectDocToView=R.prototype.DA;R.prototype.transformDocToView=R.prototype.Nq;R.prototype.centerRect=R.prototype.dt;R.prototype.scrollToRect=R.prototype.fw;R.prototype.scroll=R.prototype.scroll;R.prototype.highlightCollection=R.prototype.Sz;R.prototype.highlight=R.prototype.Rz;R.prototype.selectCollection=R.prototype.uA;R.prototype.select=R.prototype.select;
    R.prototype.updateAllRelationshipsFromData=R.prototype.Pq;R.prototype.updateAllTargetBindings=R.prototype.updateAllTargetBindings;R.prototype.commit=R.prototype.commit;R.prototype.rollbackTransaction=R.prototype.Bf;R.prototype.commitTransaction=R.prototype.Ua;R.prototype.startTransaction=R.prototype.ua;R.prototype.raiseChanged=R.prototype.g;R.prototype.raiseChangedEvent=R.prototype.Ya;R.prototype.removeChangedListener=R.prototype.wk;R.prototype.addChangedListener=R.prototype.Bh;
    R.prototype.removeModelChangedListener=R.prototype.qA;R.prototype.addModelChangedListener=R.prototype.xx;R.prototype.findLayer=R.prototype.im;R.prototype.removeLayer=R.prototype.oA;R.prototype.addLayerAfter=R.prototype.Iy;R.prototype.addLayerBefore=R.prototype.vx;R.prototype.addLayer=R.prototype.$l;R.prototype.moveParts=R.prototype.moveParts;R.prototype.copyParts=R.prototype.ck;R.prototype.removeParts=R.prototype.Kt;R.prototype.remove=R.prototype.remove;R.prototype.add=R.prototype.add;
    R.prototype.clearDelayedGeometries=R.prototype.jv;R.prototype.setProperties=R.prototype.kw;R.prototype.resetInputOptions=R.prototype.cw;R.prototype.setInputOption=R.prototype.vA;R.prototype.getInputOption=R.prototype.mm;R.prototype.resetRenderingHints=R.prototype.dw;R.prototype.setRenderingHint=R.prototype.ny;R.prototype.getRenderingHint=R.prototype.Ce;R.prototype.maybeUpdate=R.prototype.Wc;R.prototype.requestUpdate=R.prototype.Pb;R.prototype.delayInitialization=R.prototype.az;
    R.prototype.isUpdateRequested=R.prototype.Yz;R.prototype.redraw=R.prototype.Fe;R.prototype.invalidateDocumentBounds=R.prototype.Na;R.prototype.findObjectsNear=R.prototype.yg;R.prototype.findPartsNear=R.prototype.qz;R.prototype.findObjectsIn=R.prototype.uf;R.prototype.findPartsIn=R.prototype.Ox;R.prototype.findObjectsAt=R.prototype.Ti;R.prototype.findPartsAt=R.prototype.pz;R.prototype.findObjectAt=R.prototype.Ub;R.prototype.findPartAt=R.prototype.jm;R.prototype.focusObject=R.prototype.Cz;
    R.prototype.alignDocument=R.prototype.Oy;R.prototype.zoomToRect=R.prototype.GA;R.prototype.zoomToFit=R.prototype.zoomToFit;R.prototype.diagramScroll=R.prototype.Gx;R.prototype.focus=R.prototype.focus;R.prototype.reset=R.prototype.reset;R.useDOM=function(a){Sg=a?void 0!==x.document:!1};R.isUsingDOM=function(){return Sg};
    var Ce=null,si=new G,Oi=null,Ni=null,Sg=void 0!==x.document,Ii=null,Ji="",pi=new D(R,"None",0),bj=new D(R,"Uniform",1),cj=new D(R,"UniformToFill",2),Mf=new D(R,"CycleAll",10),Qf=new D(R,"CycleNotDirected",11),Sf=new D(R,"CycleNotDirectedFast",12),Tf=new D(R,"CycleNotUndirected",13),Nf=new D(R,"CycleDestinationTree",14),Pf=new D(R,"CycleSourceTree",15),Xh=new D(R,"DocumentScroll",1),Zh=new D(R,"InfiniteScroll",2),ri=new D(R,"TreeParentCollapsed",21),Gk=new D(R,"AllParentsCollapsed",22),Hk=new D(R,
      "AnyParentsCollapsed",23),Ik=new E,Jk="2.1.16",Kk=null,ni=!1;
    function oi(){if(Sg){var a=x.document.createElement("canvas"),b=a.getContext("2d"),c=Ra("7ca11abfd022028846");b[c]=Ra("398c3597c01238");for(var d=["5da73c80a36455d5038e4972187c3cae51fd22",qa.Dx+"4ae6247590da4bb21c324ba3a84e385776",qd.xF+"fb236cdfda5de14c134ba1a95a2d4c7cc6f93c1387",J.za],e=1;5>e;e++)b[Ra("7ca11abfd7330390")](Ra(d[1-1]),10,0);b[c]=Ra("39f046ebb36e4b");for(c=1;5>c;c++)b[Ra("7ca11abfd7330390")](Ra(d[1-1]),10,0);Kk=a}}R.className="Diagram";
    R.fromDiv=function(a){var b=a;"string"===typeof a&&(b=x.document.getElementById(a));return b instanceof HTMLDivElement&&b.B instanceof R?b.B:null};R.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};R.None=pi;R.Uniform=bj;R.UniformToFill=cj;R.CycleAll=Mf;R.CycleNotDirected=Qf;R.CycleNotDirectedFast=Sf;R.CycleNotUndirected=Tf;
    R.CycleDestinationTree=Nf;R.CycleSourceTree=Pf;R.DocumentScroll=Xh;R.InfiniteScroll=Zh;R.TreeParentCollapsed=ri;R.AllParentsCollapsed=Gk;R.AnyParentsCollapsed=Hk;function Gi(){this.Ey=null;this.l="zz@orderNum";"63ad05bbe23a1786468a4c741b6d2"===this._tk?this.Qe=this.l=!0:this.Qe=null}
    function yj(a,b){b.Db.setTransform(b.Sb,0,0,b.Sb,0,0);if(null===a.Qe){b="f";var c=x[Ra("76a715b2f73f148a")][Ra("72ba13b5")];a.Qe=!0;if(Sg){var d=R[Ra("76a115b6ed251eaf4692")];if(d)for(var e=Ik.iterator;e.next();){d=e.value;d=Ra(d).split(Ra("39e9"));if(6>d.length)break;var f=Ra(d[1]).split(".");if("7da71ca0"!==d[4])break;var g=Ra(qa[Ra("6cae19")]).split(".");if(f[0]>g[0]||f[0]===g[0]&&f[1]>=g[1]){f=c[Ra("76ad18b4f73e")];for(g=c[Ra("73a612b6fb191d")](Ra("35e7"))+2;g<f;g++)b+=c[g];f=b[Ra("73a612b6fb191d")](Ra(d[2]));
      0>f&&Ra(d[2])!==Ra("7da71ca0ad381e90")&&(f=b[Ra("73a612b6fb191d")](Ra("76a715b2ef3e149757")));0>f&&(f=b[Ra("73a612b6fb191d")](Ra("76a715b2ef3e149757")));0>f&&(f=c[Ra("73a612b6fb191d")](Ra("7baa19a6f76c1988428554")));a.Qe=!(0<=f&&f<b[Ra("73a612b6fb191d")](Ra("35"))||-1===b[Ra("73a612b6fb191d")](Ra("35")));if(!a.Qe)break;f=Ra(d[2]);if("#"!==f[0])break;g=x.document.createElement("div");for(var h=d[0].replace(/[A-Za-z]/g,"");4>h.length;)h+="9";h=h.substr(h.length-4);d="";d+=["gsh","gsf"][parseInt(h.substr(0,
        1),10)%2];d+=["Header","Background","Display","Feedback"][parseInt(h.substr(0,1),10)%4];g[Ra("79a417a0f0181a8946")]=d;if(x.document[Ra("78a712aa")]){x.document[Ra("78a712aa")][Ra("7bb806b6ed32388c4a875b")](g);h=x.getComputedStyle(g).getPropertyValue(Ra("78a704b7e62456904c9b12701b6532a8"));x.document[Ra("78a712aa")][Ra("68ad1bbcf533388c4a875b")](g);if(!h)break;if(-1!==h.indexOf(parseInt(f[1]+f[2],16))&&-1!==h.indexOf(parseInt(f[3]+f[4],16))){a.Qe=!1;break}else if(Sa||Ta||Ua||Va)for(d="."+d,f=0;f<document.styleSheets.length;f++){g=
        document.styleSheets[f].rules||document.styleSheets[f].cssRules;for(var k in g)if(d===g[k].selectorText){a.Qe=!1;break}}}else a.Qe=null,a.Qe=!1}}else{k=c[Ra("76ad18b4f73e")];for(e=c[Ra("73a612b6fb191d")](Ra("35e7"))+2;e<k;e++)b+=c[e];c=b[Ra("73a612b6fb191d")](Ra("7da71ca0ad381e90"));a.Qe=!(0<=c&&c<b[Ra("73a612b6fb191d")](Ra("35")))}}}return 0<a.Qe&&a!==a.Ey?!0:!1}
    function Hi(a,b){if(Sg){void 0!==b&&null!==b||B("Diagram setup requires an argument DIV.");null!==a.La&&B("Diagram has already completed setup.");"string"===typeof b?a.La=x.document.getElementById(b):b instanceof HTMLDivElement?a.La=b:B("No DIV or DIV id supplied: "+b);null===a.La&&B("Invalid DIV id; could not get element with id: "+b);void 0!==a.La.B&&B("Invalid div id; div already has a Diagram associated with it.");"static"===x.getComputedStyle(a.La,null).position&&(a.La.style.position="relative");
      a.La.style["-webkit-tap-highlight-color"]="rgba(255, 255, 255, 0)";a.La.style["-ms-touch-action"]="none";a.La.innerHTML="";a.La.B=a;var c=a.Pp?new Dj(a):new Ek(a);void 0!==c.style&&(c.style.position="absolute",c.style.top="0px",c.style.left="0px","rtl"===x.getComputedStyle(a.La,null).getPropertyValue("direction")&&(a.nl=!0),c.style.zIndex="2",c.style.userSelect="none",c.style.webkitUserSelect="none",c.style.MozUserSelect="none");a.sa=c;a.Db=c.context;b=a.Db;a.Sb=a.computePixelRatio();a.wa=a.La.clientWidth||
        1;a.va=a.La.clientHeight||1;Fj(a,a.wa,a.va);a.zr=b.V[Ra("7eba17a4ca3b1a8346")][Ra("78a118b7")](b.V,Kk,4,4);a.La.insertBefore(c.Ea,a.La.firstChild);c=new Ek(null);c.width=1;c.height=1;a.lu=c;a.Tw=c.context;if(Sg){c=ta("div");var d=ta("div");c.style.position="absolute";c.style.overflow="auto";c.style.width=a.wa+"px";c.style.height=a.va+"px";c.style.zIndex="1";d.style.position="absolute";d.style.width="1px";d.style.height="1px";a.La.appendChild(c);c.appendChild(d);c.onscroll=Ri;c.onmousedown=Ti;c.ontouchstart=
        Ti;c.B=a;c.Cy=!0;c.Dy=!0;a.Fs=c;a.wp=d}a.It=ra(function(){a.sh=null;a.M()},300);a.xw=ra(function(){Hh(a)},250);a.preventDefault=function(a){a.preventDefault();return!1};a.qk=function(b){if(a.isEnabled){a.Wf=!0;var c=gj(a,b,!0);a.doMouseMove();a.currentTool.isBeyondDragSize()&&(a.pd=0);mj(c,b)}};a.pk=function(b){if(a.isEnabled)if(a.Wf=!0,a.ke)b.preventDefault();else{var c=gj(a,b,!0);c.down=!0;c.clickCount=b.detail;if(Ta||Ua)b.timeStamp-a.Aj<a.Vs&&!a.currentTool.isBeyondDragSize()?a.pd++:a.pd=1,a.Aj=
        b.timeStamp,c.clickCount=a.pd;c.clone(a.firstInput);a.doMouseDown();1===b.button?b.preventDefault():mj(c,b)}};a.sk=function(b){if(a.isEnabled)if(a.ke&&2===b.button)b.preventDefault();else if(a.ke&&0===b.button&&(a.ke=!1),a.Pj)b.preventDefault();else{a.Wf=!0;var c=gj(a,b,!0);c.up=!0;c.clickCount=b.detail;if(Ta||Ua)c.clickCount=a.pd;c.bubbles=b.bubbles;c.targetDiagram=ij(b);a.doMouseUp();a.Cf();mj(c,b)}};a.tk=function(b){if(a.isEnabled){var c=gj(a,b,!0);c.bubbles=!0;var d=0,e=0;c.delta=0;void 0!==b.deltaX?
        (0!==b.deltaX&&(d=0<b.deltaX?1:-1),0!==b.deltaY&&(e=0<b.deltaY?1:-1),c.delta=Math.abs(b.deltaX)>Math.abs(b.deltaY)?-d:-e):void 0!==b.wheelDeltaX?(0!==b.wheelDeltaX&&(d=0<b.wheelDeltaX?-1:1),0!==b.wheelDeltaY&&(e=0<b.wheelDeltaY?-1:1),c.delta=Math.abs(b.wheelDeltaX)>Math.abs(b.wheelDeltaY)?-d:-e):void 0!==b.wheelDelta&&0!==b.wheelDelta&&(c.delta=0<b.wheelDelta?1:-1);a.doMouseWheel();mj(c,b)}};a.rk=function(b){a.isEnabled&&(a.Wf=!1,gj(a,b,!0),b=a.currentTool,b.cancelWaitAfter(),b.standardMouseOver())};
      a.rw=function(b){if(a.isEnabled){a.Pj=!1;a.ke=!0;var c=jj(a,b,b.targetTouches[0],1<b.touches.length),d=null;0<b.targetTouches.length?d=b.targetTouches[0]:0<b.changedTouches.length&&(d=b.changedTouches[0]);if(null!==d){var e=d.screenX;d=d.screenY;var k=a.lo;b.timeStamp-a.Aj<a.Vs&&!(25<Math.abs(k.x-e)||25<Math.abs(k.y-d))?a.pd++:a.pd=1;c.clickCount=a.pd;a.Aj=b.timeStamp;a.lo.h(e,d)}a.doMouseDown();mj(c,b)}};a.qw=function(b){if(a.isEnabled){var c=null;0<b.targetTouches.length?c=b.targetTouches[0]:0<
        b.changedTouches.length&&(c=b.changedTouches[0]);c=lj(a,b,c,1<b.touches.length);a.doMouseMove();mj(c,b)}};a.pw=function(b){if(a.isEnabled)if(a.Pj)b.preventDefault();else if(!(1<b.touches.length)){var c=null,d=null;0<b.targetTouches.length?d=b.targetTouches[0]:0<b.changedTouches.length&&(d=b.changedTouches[0]);var e=kj(a,b,!1,!0,!1,!1);null!==d&&(c=x.document.elementFromPoint(d.clientX,d.clientY),null!==c&&c.B instanceof R&&c.B!==a&&hj(c.B,d,e),hj(a,d,e),e.clickCount=a.pd);null===c?e.targetDiagram=
        ij(b):c.B?e.targetDiagram=c.B:e.targetDiagram=null;e.targetObject=null;a.doMouseUp();mj(e,b);a.ke=!1}};a.tm=function(b){if(a.isEnabled){a.Wf=!0;var c=a.ts;void 0===c[b.pointerId]&&(c[b.pointerId]=b);c=a.Kj;var d=!1;if(null!==c[0]&&c[0].pointerId===b.pointerId)c[0]=b;else if(null!==c[1]&&c[1].pointerId===b.pointerId)c[1]=b,d=!0;else if(null===c[0])c[0]=b;else if(null===c[1])c[1]=b,d=!0;else{b.preventDefault();return}if("touch"===b.pointerType||"pen"===b.pointerType)a.Pj=!1,a.ke=!0;c=jj(a,b,b,d);d=
        a.lo;var e="touch"===b.pointerType||"pen"===b.pointerType?25:10;b.timeStamp-a.Aj<a.Vs&&!(Math.abs(d.x-b.screenX)>e||Math.abs(d.y-b.screenY)>e)?a.pd++:a.pd=1;c.clickCount=a.pd;a.Aj=b.timeStamp;a.lo.Dg(b.screenX,b.screenY);a.doMouseDown();1===b.button?b.preventDefault():mj(c,b)}};a.um=function(b){if(a.isEnabled){a.Wf=!0;var c=a.Kj;if(null!==c[0]&&c[0].pointerId===b.pointerId)c[0]=b;else{if(null!==c[1]&&c[1].pointerId===b.pointerId){c[1]=b;return}if(null===c[0])c[0]=b;else return}c[0].pointerId===b.pointerId&&
      (c=lj(a,b,b,null!==c[1]),c.targetDiagram=ij(b),a.doMouseMove(),mj(c,b))}};a.wm=function(b){if(a.isEnabled){a.Wf=!0;var c="touch"===b.pointerType||"pen"===b.pointerType,d=a.ts;if(c&&a.Pj)delete d[b.pointerId],b.preventDefault();else if(d=a.Kj,null!==d[0]&&d[0].pointerId===b.pointerId){d[0]=null;d=kj(a,b,!1,!0,!0,!1);var e=x.document.elementFromPoint(b.clientX,b.clientY);null!==e&&e.B instanceof R&&e.B!==a&&hj(e.B,b,d);hj(a,b,d);d.clickCount=a.pd;null===e?d.targetDiagram=ij(b):e.B?d.targetDiagram=e.B:
        d.targetDiagram=null;d.targetObject=null;a.doMouseUp();mj(d,b);c&&(a.ke=!1)}else null!==d[1]&&d[1].pointerId===b.pointerId&&(d[1]=null)}};a.vm=function(b){if(a.isEnabled){a.Wf=!1;var c=a.ts;c[b.pointerId]&&delete c[b.pointerId];c=a.Kj;null!==c[0]&&c[0].pointerId===b.pointerId&&(c[0]=null);null!==c[1]&&c[1].pointerId===b.pointerId&&(c[1]=null);"touch"!==b.pointerType&&"pen"!==b.pointerType&&(b=a.currentTool,b.cancelWaitAfter(),b.standardMouseOver())}};b.sc(!0);Pi(a)}}Gi.className="DiagramHelper";
    function cf(a){this.l=void 0===a?new I:a;this.v=new I}ma.Object.defineProperties(cf.prototype,{point:{get:function(){return this.l},set:function(a){this.l=a}},shifted:{get:function(){return this.v},set:function(a){this.v=a}}});cf.className="DraggingInfo";function Qj(a,b,c){this.node=a;this.info=b;this.Ev=c}Qj.className="DraggingNodeInfoPair";function Se(){this.reset()}
    Se.prototype.reset=function(){this.isGridSnapEnabled=!1;this.isGridSnapRealtime=!0;this.gridSnapCellSize=(new M(NaN,NaN)).freeze();this.gridSnapCellSpot=vc;this.gridSnapOrigin=(new I(NaN,NaN)).freeze();this.Pz=this.dragsTree=this.dragsLink=!1;this.Oz=!0};function Lk(a){1<arguments.length&&B("Palette constructor can only take one optional argument, the DIV HTML element or its id.");R.call(this,a);Mk(this)}la(Lk,R);
    function Mk(a){a.allowDragOut=!0;a.allowMove=!1;a.isReadOnly=!0;a.contentAlignment=wc;a.layout=new Nk}Lk.prototype.reset=function(){R.prototype.reset.call(this);Mk(this)};Lk.className="Palette";
    function Ok(a){1<arguments.length&&B("Overview constructor can only take one optional argument, the DIV HTML element or its id.");R.call(this,a);var b=this;this.animationManager.isEnabled=!1;this.Rb=!0;this.Ha=null;this.dl=this.cl=!1;this.v=this.I=!0;this.Za=0;this.Y=!1;this.Ml=null;this.ny("drawShadows",!1);var c=new U,d=new Kf;d.stroke="magenta";d.strokeWidth=2;d.fill="transparent";d.name="BOXSHAPE";c.selectable=!0;c.selectionAdorned=!1;c.selectionObjectName="BOXSHAPE";c.locationObjectName="BOXSHAPE";
      c.resizeObjectName="BOXSHAPE";c.cursor="move";c.add(d);this.l=c;this.allowDelete=this.allowCopy=!1;this.allowSelect=!0;this.autoScrollRegion=new oc(0,0,0,0);this.ma.h(0,0);this.toolManager.Va("Dragging",new Pk,this.toolManager.mouseMoveTools);this.click=function(){var a=b.observed;if(null!==a){var c=a.viewportBounds,d=b.lastInput.documentPoint;a.position=new I(d.x-c.width/2,d.y-c.height/2)}};this.Je=function(){b.Na();Qk(b)};this.Ef=function(){null!==b.observed&&(b.Na(),b.M())};this.Mh=function(){1>
      b.updateDelay?b.M():b.Y||(b.Y=!0,setTimeout(function(){b.Y=!1;Rk(b);b.M()},b.updateDelay))};this.Yc=function(){null!==b.observed&&Qk(b)};this.autoScale=bj;this.Rb=!1}la(Ok,R);Ok.prototype.computePixelRatio=function(){return 1};
    Ok.prototype.bc=function(){null===this.La&&B("No div specified");null===this.sa&&B("No canvas specified");if(!(this.sa instanceof Dj)&&(hi(this.box),this.Ac)){var a=this.observed;if(null!==a&&!a.animationManager.isAnimating){wj(this);var b=this.sa;a=this.Db;a.sc(!0);a.setTransform(1,0,0,1,0,0);a.clearRect(0,0,b.width,b.height);1>this.updateDelay?Sk(this):null!==this.Ml&&(a.drawImage(this.Ml.Ea,0,0),b=this.kb,b.reset(),1!==this.scale&&b.scale(this.scale),0===this.position.x&&0===this.position.y||b.translate(-this.position.x,
      -this.position.y),a.scale(this.Sb,this.Sb),a.transform(b.m11,b.m12,b.m21,b.m22,b.dx,b.dy));b=this.Ja.j;for(var c=b.length,d=0;d<c;d++)b[d].bc(a,this);this.Ac=this.mi=!1}}};function Rk(a){var b=a.sa,c=a.Db;if(null!==b&&null!==c){wj(a);if(null===a.Ml){var d=new Ek(null);d.width=b.width;d.height=b.height;a.Ml=d}try{a.sa=a.Ml,a.Db=a.sa.context,a.Db.sc(!0),a.Db.setTransform(1,0,0,1,0,0),a.Db.clearRect(0,0,a.sa.width,a.sa.height),Sk(a)}finally{a.sa=b,a.Db=c}}}
    function Sk(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).Hc(b.viewportBounds),pj(b,e),N.free(e),Vi(b));var f=a.kb;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.Db;e.scale(a.Sb,a.Sb);e.transform(f.m11,f.m12,f.m21,f.m22,f.dx,f.dy);b=b.Ja.j;f=b.length;for(var g=0;g<f;g++){var h=b[g],k=a;if(h.visible&&
      0!==h.opacity){var l=h.diagram.grid.part;if(!c&&h.isTemporary)d&&l.layer===h&&(h=ji(h,e),l.bc(e,k),e.globalAlpha=h);else{for(var m=ji(h,e),n=k.scale,p=N.alloc(),r=h.Ca.j,q=r.length,u=0;u<q;u++){var v=r[u];(d||v!==l)&&h.Pi(e,v,k,null,n,p)}N.free(p);e.globalAlpha=m}}}}}
    function Qk(a){var b=a.box;if(null!==b){var c=a.observed;if(null!==c){a.Ac=!0;c=c.viewportBounds;var d=b.selectionObject,e=M.alloc();e.h(c.width,c.height);d.desiredSize=e;M.free(e);a=2/a.scale;d instanceof Kf&&(d.strokeWidth=a);b.location=new I(c.x-a/2,c.y-a/2);b.isSelected=!0}}}Ok.prototype.computeBounds=function(){var a=this.observed;if(null===a)return ic;var b=a.documentBounds.copy();b.Hc(a.viewportBounds);return b};Ok.prototype.Ux=function(){!0!==this.Ac&&(this.Ac=!0,this.Pb())};
    Ok.prototype.Bq=function(a,b,c,d){this.Rb||(Ui(this),this.M(),$i(this),this.Na(),Qk(this),this.Sd.scale=c,this.Sd.position.x=a.x,this.Sd.position.y=a.y,this.Sd.bounds.assign(a),this.Sd.Mv=d,this.R("ViewportBoundsChanged",this.Sd,a))};
    ma.Object.defineProperties(Ok.prototype,{observed:{get:function(){return this.Ha},set:function(a){var b=this.Ha;a instanceof Ok&&B("Overview.observed Diagram may not be an Overview itself: "+a);if(b!==a){null!==b&&(this.remove(this.box),b.ym("ViewportBoundsChanged",this.Je),b.ym("DocumentBoundsChanged",this.Ef),b.ym("InvalidateDraw",this.Mh),b.ym("AnimationFinished",this.Yc));this.Ha=a;null!==a&&(a.Uj("ViewportBoundsChanged",this.Je),a.Uj("DocumentBoundsChanged",this.Ef),
          a.Uj("InvalidateDraw",this.Mh),a.Uj("AnimationFinished",this.Yc),this.add(this.box),Qk(this));this.Na();if(null===a){this.Ml=null;var c=this.sa,d=this.Db;c&&d&&(d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,c.width,c.height))}else Rk(this),Qk(this),this.M();this.g("observed",b,a)}}},box:{get:function(){return this.l},set:function(a){var b=this.l;b!==a&&(this.l=a,this.remove(b),this.add(this.l),Qk(this),this.g("box",b,a))}},drawsTemporaryLayers:{
        get:function(){return this.I},set:function(a){this.I!==a&&(this.I=a,this.Fe())}},drawsGrid:{get:function(){return this.v},set:function(a){this.v!==a&&(this.v=a,this.Fe())}},updateDelay:{get:function(){return this.Za},set:function(a){0>a&&(a=0);this.Za!==a&&(this.Za=a)}}});Ok.className="Overview";function Pk(){Re.call(this);this.l=null}la(Pk,Re);
    Pk.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(null===a||!a.allowMove||!a.allowSelect)return!1;var b=a.observed;if(null===b)return!1;var c=a.lastInput;if(!c.left||a.currentTool!==this&&(!this.isBeyondDragSize()||c.isTouchEvent&&c.timestamp-a.firstInput.timestamp<this.delay))return!1;null===this.findDraggablePart()&&(c=b.viewportBounds,this.l=new I(c.width/2,c.height/2),a=a.firstInput.documentPoint,b.position=new I(a.x-this.l.x,a.y-this.l.y));return!0};
    Pk.prototype.doActivate=function(){this.l=null;Re.prototype.doActivate.call(this)};Pk.prototype.doUpdateCursor=function(){var a=this.diagram,b=a.box;null!==b&&b.cursor&&(a.currentCursor=b.cursor)};Pk.prototype.moveParts=function(){var a=this.diagram,b=a.observed;if(null!==b){var c=a.box;if(null!==c){if(null===this.l){var d=a.firstInput.documentPoint;c=c.location;this.l=new I(d.x-c.x,d.y-c.y)}a=a.lastInput.documentPoint;b.position=new I(a.x-this.l.x,a.y-this.l.y)}}};Pk.className="OverviewDraggingTool";
    function Tk(){Ya(this);this.B=Ce;this.Za=this.I=this.v=!0;this.Y=this.Ha=this.kd=this.Ia=!1;this.yi=this.l=null;this.Yc=1.05;this.Eu=NaN;this.Yw=null;this.ev=NaN;this.dv=ic;this.ng=null;this.Ic=200}Tk.prototype.toString=function(){return"CommandHandler"};Tk.prototype.Zd=function(a){this.B=a};
    Tk.prototype.doKeyDown=function(){var a=this.diagram,b=a.lastInput,c=Wa?b.meta:b.control,d=b.shift,e=b.alt,f=b.key;!c||"C"!==f&&"Insert"!==f?c&&"X"===f||d&&"Del"===f?this.canCutSelection()&&this.cutSelection():c&&"V"===f||d&&"Insert"===f?this.canPasteSelection()&&this.pasteSelection():c&&"Y"===f||e&&d&&"Backspace"===f?this.canRedo()&&this.redo():c&&"Z"===f||e&&"Backspace"===f?this.canUndo()&&this.undo():"Del"===f||"Backspace"===f?this.canDeleteSelection()&&this.deleteSelection():c&&"A"===f?this.canSelectAll()&&
      this.selectAll():"Esc"===f?this.canStopCommand()&&this.stopCommand():"Up"===f?a.allowVerticalScroll&&(c?a.scroll("pixel","up"):a.scroll("line","up")):"Down"===f?a.allowVerticalScroll&&(c?a.scroll("pixel","down"):a.scroll("line","down")):"Left"===f?a.allowHorizontalScroll&&(c?a.scroll("pixel","left"):a.scroll("line","left")):"Right"===f?a.allowHorizontalScroll&&(c?a.scroll("pixel","right"):a.scroll("line","right")):"PageUp"===f?d&&a.allowHorizontalScroll?a.scroll("page","left"):a.allowVerticalScroll&&
      a.scroll("page","up"):"PageDown"===f?d&&a.allowHorizontalScroll?a.scroll("page","right"):a.allowVerticalScroll&&a.scroll("page","down"):"Home"===f?c&&a.allowVerticalScroll?a.scroll("document","up"):!c&&a.allowHorizontalScroll&&a.scroll("document","left"):"End"===f?c&&a.allowVerticalScroll?a.scroll("document","down"):!c&&a.allowHorizontalScroll&&a.scroll("document","right"):" "===f?this.canScrollToPart()&&this.scrollToPart():"Subtract"===f?this.canDecreaseZoom()&&this.decreaseZoom():"Add"===f?this.canIncreaseZoom()&&
      this.increaseZoom():c&&"0"===f?this.canResetZoom()&&this.resetZoom():d&&"Z"===f?this.canZoomToFit()&&this.zoomToFit():c&&!d&&"G"===f?this.canGroupSelection()&&this.groupSelection():c&&d&&"G"===f?this.canUngroupSelection()&&this.ungroupSelection():b.event&&113===b.event.which?this.canEditTextBlock()&&this.editTextBlock():b.event&&93===b.event.which?this.canShowContextMenu()&&this.showContextMenu():b.bubbles=!0:this.canCopySelection()&&this.copySelection()};
    Tk.prototype.doKeyUp=function(){this.diagram.lastInput.bubbles=!0};Tk.prototype.stopCommand=function(){var a=this.diagram,b=a.currentTool;b instanceof Oa&&a.allowSelect&&a.clearSelection();null!==b&&b.doCancel()};Tk.prototype.canStopCommand=function(){return!0};
    Tk.prototype.selectAll=function(){var a=this.diagram;a.M();try{a.currentCursor="wait";a.R("ChangingSelection",a.selection);for(var b=a.parts;b.next();)b.value.isSelected=!0;for(var c=a.nodes;c.next();)c.value.isSelected=!0;for(var d=a.links;d.next();)d.value.isSelected=!0}finally{a.R("ChangedSelection",a.selection),a.currentCursor=""}};Tk.prototype.canSelectAll=function(){return this.diagram.allowSelect};
    Tk.prototype.deleteSelection=function(){var a=this.diagram;try{a.currentCursor="wait";a.R("ChangingSelection",a.selection);a.ua("Delete");a.R("SelectionDeleting",a.selection);for(var b=new F,c=a.selection.iterator;c.next();)Uk(b,c.value,!0,this.deletesTree?Infinity:0,this.deletesConnectedLinks?null:!1,function(a){return a.canDelete()});a.Kt(b,!0);a.R("SelectionDeleted",b)}finally{a.Ua("Delete"),a.R("ChangedSelection",a.selection),a.currentCursor=""}};
    Tk.prototype.canDeleteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowDelete||0===a.selection.count?!1:!0};Tk.prototype.copySelection=function(){var a=this.diagram,b=new F;for(a=a.selection.iterator;a.next();)Uk(b,a.value,!0,this.copiesTree?Infinity:0,this.copiesConnectedLinks,function(a){return a.canCopy()});this.copyToClipboard(b)};Tk.prototype.canCopySelection=function(){var a=this.diagram;return a.allowCopy&&a.allowClipboard&&0!==a.selection.count?!0:!1};
    Tk.prototype.cutSelection=function(){this.copySelection();this.deleteSelection()};Tk.prototype.canCutSelection=function(){var a=this.diagram;return!a.isReadOnly&&!a.isModelReadOnly&&a.allowCopy&&a.allowDelete&&a.allowClipboard&&0!==a.selection.count?!0:!1};
    Tk.prototype.copyToClipboard=function(a){var b=this.diagram,c=null;if(null===a)Ii=null,Ji="";else{c=b.model;var d=!1,e=!1,f=null;try{c.qm()&&(d=c.bk,c.bk=this.copiesParentKey),c.ik()&&(e=c.ak,c.ak=this.copiesGroupKey),f=b.ck(a,null,!0)}finally{c.qm()&&(c.bk=d),c.ik()&&(c.ak=e),c=new E,c.addAll(f),Ii=c,Ji=b.model.dataFormat}}b.R("ClipboardChanged",c)};
    Tk.prototype.pasteFromClipboard=function(){var a=new F,b=Ii;if(null===b)return a;var c=this.diagram;if(Ji!==c.model.dataFormat)return a;var d=c.model,e=!1,f=!1,g=null;try{d.qm()&&(e=d.bk,d.bk=this.copiesParentKey),d.ik()&&(f=d.ak,d.ak=this.copiesGroupKey),g=c.ck(b,c,!1)}finally{for(d.qm()&&(d.bk=e),d.ik()&&(d.ak=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};
    Tk.prototype.pasteSelection=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.currentCursor="wait";b.R("ChangingSelection",b.selection);b.ua("Paste");var c=this.pasteFromClipboard();0<c.count&&b.clearSelection(!0);for(var d=c.iterator;d.next();)d.value.isSelected=!0;if(null!==a){var e=b.computePartsBounds(b.selection);if(e.u()){var f=this.computeEffectiveCollection(b.selection,b.Qk);rf(b,f,new I(a.x-e.centerX,a.y-e.centerY),b.Qk,!1)}}b.R("ClipboardPasted",c)}finally{b.Ua("Paste"),b.R("ChangedSelection",
      b.selection),b.currentCursor=""}};Tk.prototype.canPasteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowClipboard||null===Ii||0===Ii.count||Ji!==a.model.dataFormat?!1:!0};Tk.prototype.undo=function(){this.diagram.undoManager.undo()};Tk.prototype.canUndo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canUndo()};Tk.prototype.redo=function(){this.diagram.undoManager.redo()};
    Tk.prototype.canRedo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canRedo()};Tk.prototype.decreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);var b=this.diagram;b.autoScale===pi&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};Tk.prototype.canDecreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);var b=this.diagram;if(b.autoScale!==pi)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};
    Tk.prototype.increaseZoom=function(a){void 0===a&&(a=this.zoomFactor);var b=this.diagram;b.autoScale===pi&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};Tk.prototype.canIncreaseZoom=function(a){void 0===a&&(a=this.zoomFactor);var b=this.diagram;if(b.autoScale!==pi)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};Tk.prototype.resetZoom=function(a){void 0===a&&(a=this.defaultScale);var b=this.diagram;a<b.minScale||a>b.maxScale||(b.scale=a)};
    Tk.prototype.canResetZoom=function(a){void 0===a&&(a=this.defaultScale);var b=this.diagram;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};Tk.prototype.zoomToFit=function(){var a=this.diagram,b=a.animationManager;b.Xc();a.Fe();var c=a.position,d=a.scale;Bh(b,"Zoom To Fit");d===this.ev&&!isNaN(this.Eu)&&a.documentBounds.w(this.dv)?(a.scale=this.Eu,a.position=this.Yw,this.ev=NaN,this.dv=ic):(this.Eu=d,this.Yw=c.copy(),a.zoomToFit(),this.ev=a.scale,this.dv=a.documentBounds.copy());Dh(b)};
    Tk.prototype.canZoomToFit=function(){return this.diagram.allowZoom};
    Tk.prototype.scrollToPart=function(a){void 0===a&&(a=null);var b=this.diagram;Li(b);if(null===a){try{null!==this.ng&&(this.ng.next()?a=this.ng.value:this.ng=null)}catch(k){this.ng=null}null===a&&(0<b.highlighteds.count?this.ng=b.highlighteds.iterator:0<b.selection.count&&(this.ng=b.selection.iterator),null!==this.ng&&this.ng.next()&&(a=this.ng.value))}if(null!==a){var c=b.animationManager;Bh(c,"Scroll To Part");var d=this.scrollToPartPause;if(0<d){var e=Vk(this,a,[a]);if(1===e.length)b.ua(),b.dt(a.actualBounds),
      b.Ua("Scroll To Part");else{var f=function(){b.ua();for(var a=e.pop();0<e.length&&a instanceof W&&a.isTreeExpanded&&(!(a instanceof T)||a.isSubGraphExpanded);)a=e.pop();0<e.length?(a instanceof U&&b.fw(a.actualBounds),a instanceof W&&!a.isTreeExpanded&&(a.isTreeExpanded=!0),a instanceof T&&!a.isSubGraphExpanded&&(a.isSubGraphExpanded=!0)):(a instanceof U&&b.dt(a.actualBounds),b.ym("LayoutCompleted",g));b.Ua("Scroll To Part")},g=function(){sa(f,(c.isEnabled?c.duration:0)+d)};b.Uj("LayoutCompleted",
      g);f()}}else{var h=b.position.copy();b.dt(a.actualBounds);h.Ma(b.position)&&c.Xc()}}};
    function Vk(a,b,c){if(b.isVisible())return c;if(b instanceof Ke)Vk(a,b.adornedPart,c);else if(b instanceof S){var d=b.fromNode;null!==d&&Vk(a,d,c);b=b.toNode;null!==b&&Vk(a,b,c)}else b instanceof W&&(d=b.labeledLink,null!==d&&Vk(a,d,c),d=b.zg(),null!==d&&(d.isTreeExpanded||d.wasTreeExpanded||c.push(d),Vk(a,d,c))),b=b.containingGroup,null!==b&&(b.isSubGraphExpanded||b.wasSubGraphExpanded||c.push(b),Vk(a,b,c));return c}
    Tk.prototype.canScrollToPart=function(a){void 0===a&&(a=null);if(null!==a&&!(a instanceof U))return!1;a=this.diagram;return 0===a.selection.count&&0===a.highlighteds.count?!1:a.allowHorizontalScroll&&a.allowVerticalScroll};
    Tk.prototype.collapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.ua("Collapse Tree");Bh(b.animationManager,"Collapse Tree");var c=new E;if(null!==a&&a.isTreeExpanded)a.collapseTree(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof W&&e.isTreeExpanded&&(e.collapseTree(),c.add(e))}b.R("TreeCollapsed",c)}finally{b.Ua("Collapse Tree")}};
    Tk.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.nq().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof W&&b.isTreeExpanded&&0<b.nq().count)return!0;return!1};
    Tk.prototype.expandTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.ua("Expand Tree");Bh(b.animationManager,"Expand Tree");var c=new E;if(null!==a&&!a.isTreeExpanded)a.expandTree(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof W&&!e.isTreeExpanded&&(e.expandTree(),c.add(e))}b.R("TreeExpanded",c)}finally{b.Ua("Expand Tree")}};
    Tk.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.nq().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof W&&!b.isTreeExpanded&&0<b.nq().count)return!0;return!1};
    Tk.prototype.groupSelection=function(){var a=this.diagram,b=a.model;if(b.jk()){var c=this.archetypeGroupData;if(null!==c){var d=null;try{a.currentCursor="wait";a.R("ChangingSelection",a.selection);a.ua("Group");for(var e=new E,f=a.selection.iterator;f.next();){var g=f.value;g.Wb()&&g.canGroup()&&e.add(g)}for(var h=new E,k=e.iterator;k.next();){var l=k.value;f=!1;for(var m=e.iterator;m.next();)if(l.Xd(m.value)){f=!0;break}f||h.add(l)}if(0<h.count){var n=h.first().containingGroup;if(null!==n)for(;null!==
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        n;){e=!1;for(var p=h.iterator;p.next();)if(!p.value.Xd(n)){e=!0;break}if(e)n=n.containingGroup;else break}if(c instanceof T)wg(c),d=c.copy(),null!==d&&a.add(d);else if(b.Kv(c)){var r=b.copyNodeData(c);za(r)&&(b.qf(r),d=a.Si(r))}if(null!==d){null!==n&&this.isValidMember(n,d)&&(d.containingGroup=n);for(var q=h.iterator;q.next();){var u=q.value;this.isValidMember(d,u)&&(u.containingGroup=d)}a.clearSelection(!0);d.isSelected=!0}}a.R("SelectionGrouped",d)}finally{a.Ua("Group"),a.R("ChangedSelection",a.selection),
      a.currentCursor=""}}}};Tk.prototype.canGroupSelection=function(){var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowGroup||!a.model.jk()||null===this.archetypeGroupData)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.Wb()&&b.canGroup())return!0}return!1};
    function Wk(a){var b=Fa();for(a=a.iterator;a.next();){var c=a.value;c instanceof S||b.push(c)}a=new F;c=b.length;for(var d=0;d<c;d++){for(var e=b[d],f=!0,g=0;g<c;g++)if(e.Xd(b[g])){f=!1;break}f&&a.add(e)}Ha(b);return a}
    Tk.prototype.isValidMember=function(a,b){if(null===b||a===b||b instanceof S)return!1;if(null!==a){if(a===b||a.Xd(b))return!1;var c=a.memberValidation;if(null!==c&&!c(a,b)||null===a.data&&null!==b.data||null!==a.data&&null===b.data)return!1}c=this.memberValidation;return null!==c?c(a,b):!0};
    Tk.prototype.ungroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.model;if(c.jk())try{b.currentCursor="wait";b.R("ChangingSelection",b.selection);b.ua("Ungroup");var d=new E;if(null!==a)d.add(a);else for(var e=b.selection.iterator;e.next();){var f=e.value;f instanceof T&&f.canUngroup()&&d.add(f)}var g=new E;if(0<d.count){b.clearSelection(!0);for(var h=d.iterator;h.next();){var k=h.value;k.expandSubGraph();var l=k.containingGroup,m=null!==l&&null!==l.data?c.ja(l.data):void 0;g.addAll(k.memberParts);
      for(var n=g.iterator;n.next();){var p=n.value;p.isSelected=!0;if(!(p instanceof S)){var r=p.data;null!==r?c.Nt(r,m):p.containingGroup=l}}b.remove(k)}}b.R("SelectionUngrouped",d,g)}finally{b.Ua("Ungroup"),b.R("ChangedSelection",b.selection),b.currentCursor=""}};
    Tk.prototype.canUngroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly||b.isModelReadOnly||!b.allowDelete||!b.allowUngroup||!b.model.jk())return!1;if(null!==a){if(!(a instanceof T))return!1;if(a.canUngroup())return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof T&&b.canUngroup())return!0;return!1};
    Tk.prototype.addTopLevelParts=function(a,b){var c=!0;for(a=Wk(a).iterator;a.next();){var d=a.value;null!==d.containingGroup&&(!b||this.isValidMember(null,d)?d.containingGroup=null:c=!1)}return c};
    Tk.prototype.collapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.ua("Collapse SubGraph");Bh(b.animationManager,"Collapse SubGraph");var c=new E;if(null!==a&&a.isSubGraphExpanded)a.collapseSubGraph(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof T&&e.isSubGraphExpanded&&(e.collapseSubGraph(),c.add(e))}b.R("SubGraphCollapsed",c)}finally{b.Ua("Collapse SubGraph")}};
    Tk.prototype.canCollapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof T&&a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof T&&b.isSubGraphExpanded)return!0;return!1};
    Tk.prototype.expandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.ua("Expand SubGraph");Bh(b.animationManager,"Expand SubGraph");var c=new E;if(null!==a&&!a.isSubGraphExpanded)a.expandSubGraph(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof T&&!e.isSubGraphExpanded&&(e.expandSubGraph(),c.add(e))}b.R("SubGraphExpanded",c)}finally{b.Ua("Expand SubGraph")}};
    Tk.prototype.canExpandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof T&&!a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof T&&!b.isSubGraphExpanded)return!0;return!1};
    Tk.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.hm(function(a){return a instanceof Ug&&a.editable})}null!==a&&(b.currentTool=null,c.textBlock=a,b.currentTool=c)}};
    Tk.prototype.canEditTextBlock=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly||b.isModelReadOnly||!b.allowTextEdit||null===b.toolManager.findTool("TextEditing"))return!1;if(null!==a){if(!(a instanceof Ug))return!1;a=a.part;if(null!==a&&a.canEdit())return!0}else for(b=b.selection.iterator;b.next();)if(a=b.value,a.canEdit()&&(a=a.hm(function(a){return a instanceof Ug&&a.editable}),null!==a))return!0;return!1};
    Tk.prototype.showContextMenu=function(a){var b=this.diagram,c=b.toolManager.findTool("ContextMenu");if(null!==c&&(void 0===a&&(a=0<b.selection.count?b.selection.first():b),a=c.findObjectWithContextMenu(a),null!==a)){var d=b.lastInput,e=null;a instanceof Y?e=a.ga(Ac):b.viewportBounds.aa(d.documentPoint)||(e=b.viewportBounds,e=new I(e.x+e.width/2,e.y+e.height/2));null!==e&&(d.viewPoint=b.Nq(e),d.documentPoint=e,d.left=!1,d.right=!0,d.up=!0);b.currentTool=c;Qg(c,!1,a)}};
    Tk.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};
    Tk.prototype.computeEffectiveCollection=function(a,b){var c=this.diagram,d=c.toolManager.findTool("Dragging"),e=c.currentTool===d;void 0===b&&(b=e?d.dragOptions:c.Qk);d=new G;if(null===a)return d;for(var f=a.iterator;f.next();)Oj(c,d,f.value,e,b);if(null!==c.draggedLink&&b.dragsLink)return d;for(f=a.iterator;f.next();)a=f.value,a instanceof S&&(b=a.fromNode,null===b||d.contains(b)?(b=a.toNode,null===b||d.contains(b)||d.remove(a)):d.remove(a));return d};
    ma.Object.defineProperties(Tk.prototype,{diagram:{get:function(){return this.B}},copiesClipboardData:{get:function(){return this.v},set:function(a){this.v=a}},copiesConnectedLinks:{get:function(){return this.I},set:function(a){this.I=a}},deletesConnectedLinks:{get:function(){return this.Za},set:function(a){this.Za=a}},copiesTree:{get:function(){return this.Ia},
        set:function(a){this.Ia=a}},deletesTree:{get:function(){return this.kd},set:function(a){this.kd=a}},copiesParentKey:{get:function(){return this.Ha},set:function(a){this.Ha=a}},copiesGroupKey:{get:function(){return this.Y},set:function(a){this.Y=a}},archetypeGroupData:{get:function(){return this.l},set:function(a){this.l=a}},memberValidation:{get:function(){return this.yi},
        set:function(a){this.yi=a}},defaultScale:{get:function(){return this.diagram.defaultScale},set:function(a){this.diagram.defaultScale=a}},zoomFactor:{get:function(){return this.Yc},set:function(a){1<a||B("zoomFactor must be larger than 1.0, not: "+a);this.Yc=a}},scrollToPartPause:{get:function(){return this.Ic},set:function(a){this.Ic=a}}});Tk.className="CommandHandler";Ci=function(){return new Tk};
    function Y(){Ya(this);this.F=4225027;this.qb=1;this.lg=null;this.Qa="";this.dc=this.gb=null;this.ma=(new I(NaN,NaN)).freeze();this.Lc=Rb;this.cg=Lb;this.bg=Qb;this.kb=new qd;this.Qh=new qd;this.$f=new qd;this.ya=this.Wk=1;this.Yb=0;this.we=Xk;this.dh=sc;this.nc=(new N(NaN,NaN,NaN,NaN)).freeze();this.ub=(new N(NaN,NaN,NaN,NaN)).freeze();this.oc=(new N(0,0,NaN,NaN)).freeze();this.O=this.cp=this.ep=null;this.Fk=this.vb=$c;this.pp=0;this.qp=1;this.Mg=0;this.gn=1;this.Kp=null;this.xp=-Infinity;this.Hl=
      0;this.Il=Gb;this.Jl=ag;this.fi="";this.$a=this.N=null;this.Jk=-1;this.Ll=this.md=this.ei=this.Pl=null;this.ws=xg;this.sp=this.Ig=this.Jj=null}var ud,xg,zg,Xk,Yk,Zk,$k,al,bl,cl;
    Y.prototype.cloneProtected=function(a){a.F=this.F|6144;a.qb=this.qb;a.Qa=this.Qa;a.gb=this.gb;a.dc=this.dc;a.Ig=this.Ig;a.ma.assign(this.ma);a.Lc=this.Lc.G();a.cg=this.cg.G();a.bg=this.bg.G();a.$f=this.$f.copy();a.ya=this.ya;a.Yb=this.Yb;a.we=this.we;a.dh=this.dh.G();a.nc.assign(this.nc);a.ub.assign(this.ub);a.oc.assign(this.oc);a.cp=this.cp;null!==this.O&&(a.O=this.O.copy());a.vb=this.vb.G();a.Fk=this.Fk.G();a.pp=this.pp;a.qp=this.qp;a.Mg=this.Mg;a.gn=this.gn;a.Kp=this.Kp;a.xp=this.xp;a.Hl=this.Hl;
      a.Il=this.Il.G();a.Jl=this.Jl;a.fi=this.fi;null!==this.N&&(a.N=this.N.copy());a.$a=this.$a;a.Jk=this.Jk;null!==this.ei&&(a.ei=Ba(this.ei));null!==this.md&&(a.md=this.md.copy());a.Ll=this.Ll};Y.prototype.ux=function(a){var b=this.ei;if(Aa(b))for(var c=0;c<b.length;c++){if(b[c]===a)return}else this.ei=b=[];b.push(a)};Y.prototype.tf=function(a){a.ep=null;a.Jj=null;a.o()};
    Y.prototype.clone=function(){var a=new this.constructor;this.cloneProtected(a);if(null!==this.ei)for(var b=0;b<this.ei.length;b++){var c=this.ei[b];a[c]=this[c]}return a};Y.prototype.copy=function(){return this.clone()};t=Y.prototype;t.cb=function(a){a.classType===S?0===a.name.indexOf("Orient")?this.segmentOrientation=a:B("Unknown Link enum value for GraphObject.segmentOrientation property: "+a):a.classType===Y&&(this.stretch=a)};t.toString=function(){return Ia(this.constructor)+"#"+lb(this)};
    function dl(a){null===a.N&&(a.N=new el)}t.Ec=function(){if(null===this.O){var a=new fl;a.Wg=uc;a.wh=uc;a.Ug=10;a.uh=10;a.Vg=0;a.vh=0;this.O=a}};
    t.Ya=function(a,b,c,d,e,f,g){var h=this.part;if(null!==h&&(h.vk(a,b,c,d,e,f,g),c===this&&a===ue&&gl(this)&&hl(this,h,b),f=this.diagram,null===this.Ig||null===f||!f.kk||f.undoManager.isUndoingRedoing||f.currentTool!==f.toolManager||f.animationManager.bn||(a=this.Ig.get(b),null===a||f.animationManager.isTicking||(null===this.sp&&(this.sp=new G),g=0===f.undoManager.transactionLevel,a.startCondition===di?g=!0:a.startCondition===fi&&(g=!1),g?(f=new Ah,ei(a,f),g=this.sp.get(a),null!==g&&g.stop(),this.sp.add(a,
      f),f.$u=this,f.px=a,f.add(this,b,d,e),f.start()):(Ch(f.animationManager,"Trigger"),f.animationManager.defaultAnimation.add(this,b,d,e)))),this instanceof X&&c===h&&0!==(h.F&16777216)&&null!==h.data))for(c=this.W.j,d=c.length,e=0;e<d;e++)h=c[e],h instanceof X&&Gj(h,function(a){null!==a.data&&0!==(a.F&16777216)&&a.Ba(b)})};
    function hl(a,b,c){var d=a.Ui();if(null!==d)for(var e=a.$a.iterator;e.next();){var f=e.value,g=null;if(null!==f.sourceName){g=il(f,d,a);if(null===g)continue;f.Qq(a,g,c,null)}else if(f.isToModel){var h=b.diagram;null===h||h.skipsModelSourceBindings||f.Qq(a,h.model.modelData,c,d)}else{h=d.data;if(null===h)continue;var k=b.diagram;null===k||k.skipsModelSourceBindings||f.Qq(a,h,c,d)}g===a&&(h=d.jt(f.gj),null!==h&&f.vw(h,g,c))}}t.jt=function(a){return this.Jk===a?this:null};
    t.g=function(a,b,c){this.Ya(ue,a,this,b,c)};function jl(a,b,c,d,e){var f=a.nc,g=a.$f;g.reset();kl(a,g,b,c,d,e);a.$f=g;f.h(b,c,d,e);g.vt()||g.sw(f)}function ll(a,b,c,d){if(!1===a.pickable)return!1;d.multiply(a.transform);return c?a.Gc(b,d):a.Eh(b,d)}
    t.Nx=function(a,b,c){if(!1===this.pickable)return!1;var d=this.naturalBounds;b=a.Be(b);return c?Bb(a.x,a.y,0,0,0,d.height)<=b||Bb(a.x,a.y,0,d.height,d.width,d.height)<=b||Bb(a.x,a.y,d.width,d.height,d.width,0)<=b||Bb(a.x,a.y,d.width,0,0,0)<=b:a.dd(0,0)<=b&&a.dd(0,d.height)<=b&&a.dd(d.width,0)<=b&&a.dd(d.width,d.height)<=b};t.ae=function(){return!0};
    t.aa=function(a){var b=I.alloc();b.assign(a);this.transform.ra(b);var c=this.actualBounds;if(!c.u())return I.free(b),!1;var d=this.diagram;if(null!==d&&d.ke){var e=d.mm("extraTouchThreshold"),f=d.mm("extraTouchArea"),g=f/2,h=this.naturalBounds;d=this.vf()*d.scale;var k=1/d;if(h.width*d<e&&h.height*d<e)return a=fc(c.x-g*k,c.y-g*k,c.width+f*k,c.height+f*k,b.x,b.y),I.free(b),a}e=!1;if(this instanceof Ke||this instanceof Kf?fc(c.x-5,c.y-5,c.width+10,c.height+10,b.x,b.y):c.aa(b))this.md&&!this.md.aa(b)?
      e=!1:null!==this.dc&&c.aa(b)?e=!0:null!==this.gb&&this.oc.aa(a)?e=!0:e=this.Fh(a);I.free(b);return e};t.Fh=function(a){var b=this.naturalBounds;return fc(0,0,b.width,b.height,a.x,a.y)};
    t.Ae=function(a){if(0===this.angle)return this.actualBounds.Ae(a);var b=this.naturalBounds;b=N.allocAt(0,0,b.width,b.height);var c=this.transform,d=!1,e=I.allocAt(a.x,a.y);b.aa(c.Wd(e))&&(e.h(a.x,a.bottom),b.aa(c.Wd(e))&&(e.h(a.right,a.bottom),b.aa(c.Wd(e))&&(e.h(a.right,a.y),b.aa(c.Wd(e))&&(d=!0))));I.free(e);N.free(b);return d};
    t.Eh=function(a,b){if(void 0===b)return a.Ae(this.actualBounds);var c=this.naturalBounds,d=!1,e=I.allocAt(0,0);a.aa(b.ra(e))&&(e.h(0,c.height),a.aa(b.ra(e))&&(e.h(c.width,c.height),a.aa(b.ra(e))&&(e.h(c.width,0),a.aa(b.ra(e))&&(d=!0))));I.free(e);return d};
    t.Gc=function(a,b){if(void 0===b&&(b=this.transform,0===this.angle))return a.Gc(this.actualBounds);var c=this.naturalBounds,d=I.allocAt(0,0),e=I.allocAt(0,c.height),f=I.allocAt(c.width,c.height),g=I.allocAt(c.width,0),h=!1;if(a.aa(b.ra(d))||a.aa(b.ra(e))||a.aa(b.ra(f))||a.aa(b.ra(g)))h=!0;else{c=N.allocAt(0,0,c.width,c.height);var k=I.allocAt(a.x,a.y);c.aa(b.Wd(k))?h=!0:(k.h(a.x,a.bottom),c.aa(b.Wd(k))?h=!0:(k.h(a.right,a.bottom),c.aa(b.Wd(k))?h=!0:(k.h(a.right,a.y),c.aa(b.Wd(k))&&(h=!0))));I.free(k);
      N.free(c);!h&&(J.st(a,d,e)||J.st(a,e,f)||J.st(a,f,g)||J.st(a,g,d))&&(h=!0)}I.free(d);I.free(e);I.free(f);I.free(g);return h};t.ga=function(a,b){void 0===b&&(b=new I);if(a instanceof P){var c=this.naturalBounds;b.h(a.x*c.width+a.offsetX,a.y*c.height+a.offsetY)}else b.set(a);this.vd.ra(b);return b};
    t.lm=function(a){void 0===a&&(a=new N);var b=this.naturalBounds,c=this.vd,d=I.allocAt(0,0).transform(c);a.h(d.x,d.y,0,0);d.h(b.width,0).transform(c);ec(a,d.x,d.y,0,0);d.h(b.width,b.height).transform(c);ec(a,d.x,d.y,0,0);d.h(0,b.height).transform(c);ec(a,d.x,d.y,0,0);I.free(d);return a};t.Xi=function(){var a=this.vd;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.vf=function(){if(0!==(this.F&4096)===!1)return this.Wk;var a=this.ya;return null!==this.panel?a*this.panel.vf():a};t.pt=function(a,b){void 0===b&&(b=new I);b.assign(a);this.vd.Wd(b);return b};t.Uc=function(a,b,c){return this.hk(a.x,a.y,b.x,b.y,c)};
    t.hk=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,J.Uc(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=J.Uc(0,0,d.width,d.height,g,a,b,c,e);e.transform(f);return c};
    Y.prototype.measure=function(a,b,c,d){if(!1!==tj(this)){var e=this.dh,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 Kf&&(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(ml(this,!0)){case xg:g=e=0;h&&(b=a=Infinity);
      break;case ud:isFinite(a)&&a>c&&(e=a);isFinite(b)&&b>d&&(g=b);break;case Yk:isFinite(a)&&a>c&&(e=a);g=0;h&&(b=Infinity);break;case Zk: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.nc.ea();this.sm(a,b,c,d);this.nc.freeze();this.nc.u()||B("Non-real measuredBounds has been set. Object "+this+", measuredBounds: "+this.nc.toString());oj(this,!1)}};Y.prototype.sm=function(){};Y.prototype.yf=function(){return!1};
    Y.prototype.arrange=function(a,b,c,d,e){this.ml();var f=N.alloc();f.assign(this.ub);this.ub.ea();!1===uj(this)?this.ub.h(a,b,c,d):this.Dh(a,b,c,d);this.ub.freeze();void 0===e?this.md=null:this.md=e;c=!1;if(void 0!==e)c=!0;else if(e=this.panel,null===e||e.type!==X.TableRow&&e.type!==X.TableColumn||(e=e.panel),null!==e&&(e=e.oc,d=this.measuredBounds,null!==this.areaBackground&&(d=this.ub),c=b+d.height,d=a+d.width,c=!(0<=a+.05&&d<=e.width+.05&&0<=b+.05&&c<=e.height+.05),this instanceof Ug&&(a=this.naturalBounds,
    this.$r>a.height||this.pb>a.width)))c=!0;this.F=c?this.F|256:this.F&-257;this.ub.u()||B("Non-real actualBounds has been set. Object "+this+", actualBounds: "+this.ub.toString());this.Ft(f,this.ub);nl(this,!1);N.free(f)};t=Y.prototype;t.Dh=function(){};
    function ol(a,b,c,d,e){a.ub.h(b,c,d,e);if(!a.desiredSize.u()){var f=a.nc;c=a.dh;b=c.right+c.left;var g=c.top+c.bottom;c=f.width+b;f=f.height+g;d+=b;e+=g;b=ml(a,!0);c===d&&f===e&&(b=xg);switch(b){case xg:if(c>d||f>e)oj(a,!0),a.measure(c>d?d:c,f>e?e:f,0,0);break;case ud:oj(a,!0);a.measure(d,e,0,0);break;case Yk:oj(a,!0);a.measure(d,f,0,0);break;case Zk:oj(a,!0),a.measure(c,e,0,0)}}}
    t.Ft=function(a,b){var c=this.part;null!==c&&null!==c.diagram&&(c.selectionObject!==this&&c.resizeObject!==this&&c.rotateObject!==this||pl(c,!0),this.M(),$b(a,b)||(c.Hh(),this.To(c)))};t.To=function(a){null!==this.portId&&(pl(a,!0),a instanceof W&&ql(a,this))};
    t.bc=function(a,b){if(this.visible){var c=this instanceof X&&(this.type===X.TableRow||this.type===X.TableColumn),d=this.ub;if(c||0!==d.width&&0!==d.height&&!isNaN(d.x)&&!isNaN(d.y)){var e=this.opacity;if(0!==e){var f=1;1!==e&&(f=a.globalAlpha,a.globalAlpha=f*e);if(!this.Ix(a,b))if(c)rl(this,a,b);else{this instanceof S&&this.nk(!1);c=this.transform;var g=this.panel;0!==(this.F&4096)===!0&&sl(this);var h=this.part,k=!1,l=0;if(h&&b.Ce("drawShadows")&&(k=h.isShadowed)){var m=h.shadowOffset;l=Math.max(m.y,
      m.x)*b.scale*b.Sb}if(!(m=b.ni||!this.yf())){var n=this.naturalBounds;m=this.Qh;var p=m.m11,r=m.m21,q=m.dx,u=m.m12,v=m.m22,w=m.dy,y,z=y=0;m=y*p+z*r+q;var A=y*u+z*v+w;y=n.width+l;z=0;var C=y*p+z*r+q;y=y*u+z*v+w;z=Math.min(m,C);var H=Math.min(A,y);var L=Math.max(m+0,C)-z;var K=Math.max(A+0,y)-H;m=z;A=H;y=n.width+l;z=n.height+l;C=y*p+z*r+q;y=y*u+z*v+w;z=Math.min(m,C);H=Math.min(A,y);L=Math.max(m+L,C)-z;K=Math.max(A+K,y)-H;m=z;A=H;y=0;z=n.height+l;C=y*p+z*r+q;y=y*u+z*v+w;z=Math.min(m,C);H=Math.min(A,y);
      L=Math.max(m+L,C)-z;K=Math.max(A+K,y)-H;m=z;A=H;l=b.viewportBounds;n=l.x;p=l.y;m=!(m>l.width+n||n>L+m||A>l.height+p||p>K+A)}if(m){m=0!==(this.F&256);a.clipInsteadOfFill&&(m=!1);this instanceof Ug&&(a.font=this.font);if(m){A=g.ae()?g.naturalBounds:g.actualBounds;null!==this.md?(n=this.md,L=n.x,K=n.y,l=n.width,n=n.height):(L=Math.max(d.x,A.x),K=Math.max(d.y,A.y),l=Math.min(d.right,A.right)-L,n=Math.min(d.bottom,A.bottom)-K);if(L>d.width+d.x||d.x>A.width+A.x){1!==e&&(a.globalAlpha=f);return}a.save();
      a.beginPath();a.rect(L,K,l,n);a.clip()}if(this.yf()){if(!h.isVisible()){1!==e&&(a.globalAlpha=f);return}k&&(A=h.shadowOffset,a.lw(A.x*b.scale*b.Sb,A.y*b.scale*b.Sb,h.shadowBlur),tl(a),a.shadowColor=h.shadowColor)}!0===this.shadowVisible?tl(a):!1===this.shadowVisible&&ul(a);h=this.naturalBounds;null!==this.dc&&(ki(this,a,this.dc,!0,!0,h,d),this.dc instanceof vl&&this.dc.type===wl?(a.beginPath(),a.rect(d.x,d.y,d.width,d.height),a.Vd(this.dc)):a.fillRect(d.x,d.y,d.width,d.height));a.transform(c.m11,
      c.m12,c.m21,c.m22,c.dx,c.dy);k&&(null!==g&&0!==(g.F&512)||null!==g&&(g.type===X.Auto||g.type===X.Spot)&&g.zb()!==this)&&null===this.shadowVisible&&ul(a);null!==this.gb&&(l=this.naturalBounds,L=A=0,K=l.width,l=l.height,n=0,this instanceof Kf&&(l=this.ka.bounds,A=l.x,L=l.y,K=l.width,l=l.height,n=this.strokeWidth),ki(this,a,this.gb,!0,!1,h,d),this.gb instanceof vl&&this.gb.type===wl?(a.beginPath(),a.rect(A-n/2,L-n/2,K+n,l+n),a.Vd(this.gb)):a.fillRect(A-n/2,L-n/2,K+n,l+n));k&&(null!==this.gb||null!==
      this.dc||null!==g&&0!==(g.F&512)||null!==g&&(g.type===X.Auto||g.type===X.Spot)&&g.zb()!==this)?(xl(this,!0),null===this.shadowVisible&&ul(a)):xl(this,!1);this.Qi(a,b);k&&0!==(this.F&512)===!0&&tl(a);this.yf()&&k&&ul(a);m?(a.restore(),this instanceof X?a.sc(!0):a.sc(!1)):c.vt()||(b=1/(c.m11*c.m22-c.m12*c.m21),a.transform(c.m22*b,-c.m12*b,-c.m21*b,c.m11*b,b*(c.m21*c.dy-c.m22*c.dx),b*(c.m12*c.dx-c.m11*c.dy)))}}1!==e&&(a.globalAlpha=f)}}}};t.Ix=function(){return!1};
    function rl(a,b,c){var d=a.ub,e=a.oc;null!==a.dc&&(ki(a,b,a.dc,!0,!0,e,d),a.dc instanceof vl&&a.dc.type===wl?(b.beginPath(),b.rect(d.x,d.y,d.width,d.height),b.Vd(a.dc)):b.fillRect(d.x,d.y,d.width,d.height));null!==a.gb&&(ki(a,b,a.gb,!0,!1,e,d),a.gb instanceof vl&&a.gb.type===wl?(b.beginPath(),b.rect(d.x,d.y,d.width,d.height),b.Vd(a.gb)):b.fillRect(d.x,d.y,d.width,d.height));a.Qi(b,c)}t.Qi=function(){};
    function ki(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===yl)d?b.fillStyle=c.color:b.strokeStyle=c.color;else{h=f.width;k=f.height;e&&(h=g.width,k=g.height);if((f=b instanceof zl)&&c.de&&(c.type===Al||c.Mk===h&&c.cu===k))var l=c.de;else{var m=0,n=0,p=0,r=0,q=0,u=0;u=q=0;e&&(q=g.x,u=g.y);m=c.start.x*h+c.start.offsetX;n=c.start.y*k+c.start.offsetY;p=c.end.x*h+c.end.offsetX;r=c.end.y*k+c.end.offsetY;m+=q;p+=q;n+=u;r+=u;if(c.type===Bl)l=
      b.createLinearGradient(m,n,p,r);else if(c.type===wl)u=isNaN(c.endRadius)?Math.max(h,k)/2:c.endRadius,isNaN(c.startRadius)?(q=0,u=Math.max(h,k)/2):q=c.startRadius,l=b.createRadialGradient(m,n,q,p,r,u);else if(c.type===Al)try{l=b.createPattern(c.pattern,"repeat")}catch(w){l=null}if(c.type!==Al&&(e=c.colorStops,null!==e))for(e=e.iterator;e.next();)l.addColorStop(e.key,e.value);if(f&&(c.de=l,null!==l&&(c.Mk=h,c.cu=k),null===l&&c.type===Al&&-1!==c.Mk)){c.Mk=-1;var v=a.diagram;null!==v&&-1===c.Mk&&sa(function(){v.Fe()},
      600)}}d?b.fillStyle=l:b.strokeStyle=l}}}t.Bg=function(a){if(a instanceof X)a:{if(this!==a&&null!==a)for(var b=this.panel;null!==b;){if(b===a){a=!0;break a}b=b.panel}a=!1}else a=!1;return a};t.zf=function(){if(!this.visible)return!1;var a=this.panel;return null!==a?a.zf():!0};t.Cg=function(){for(var a=this instanceof X?this:this.panel;null!==a&&a.isEnabled;)a=a.panel;return null===a};
    function sl(a){if(0!==(a.F&2048)===!0){var b=a.kb;b.reset();if(!a.ub.u()||!a.nc.u()){Cl(a,!1);return}b.translate(a.ub.x-a.nc.x,a.ub.y-a.nc.y);if(1!==a.scale||0!==a.angle){var c=a.naturalBounds;kl(a,b,c.x,c.y,c.width,c.height)}Cl(a,!1);Dl(a,!0)}0!==(a.F&4096)===!0&&(b=a.panel,null===b?(a.Qh.set(a.kb),a.Wk=a.scale,Dl(a,!1)):null!==b.vd&&(c=a.Qh,c.reset(),b.ae()?c.multiply(b.Qh):null!==b.panel&&c.multiply(b.panel.Qh),c.multiply(a.kb),a.Wk=a.scale*b.Wk,Dl(a,!1)))}
    function kl(a,b,c,d,e,f){1!==a.scale&&b.scale(a.scale);if(0!==a.Yb){var g=Ac;a.yf()&&a.locationSpot.eb()&&(g=a.locationSpot);var h=I.alloc();if(a instanceof U&&a.locationObject!==a)for(c=a.locationObject,d=c.naturalBounds,h.xk(d.x,d.y,d.width,d.height,g),c.$f.ra(h),h.offset(-c.measuredBounds.x,-c.measuredBounds.y),g=c.panel;null!==g&&g!==a;)g.$f.ra(h),h.offset(-g.measuredBounds.x,-g.measuredBounds.y),g=g.panel;else h.xk(c,d,e,f,g);b.rotate(a.Yb,h.x,h.y);I.free(h)}}
    t.o=function(a){void 0===a&&(a=!1);if(!0!==tj(this)){oj(this,!0);nl(this,!0);var b=this.panel;null===b||a||b.o()}};t.om=function(){!0!==tj(this)&&(oj(this,!0),nl(this,!0))};function El(a){if(!1===uj(a)){var b=a.panel;null!==b?b.o():a.yf()&&(b=a.diagram,null!==b&&(b.od.add(a),a instanceof W&&a.fd(),b.Pb()));nl(a,!0)}}t.ml=function(){0!==(this.F&2048)===!1&&(Cl(this,!0),Dl(this,!0))};t.Iv=function(){Dl(this,!0)};t.M=function(){var a=this.part;null!==a&&a.M()};
    function ml(a,b){var c=a.stretch,d=a.panel;if(null!==d&&d.type===X.Table)return Fl(a,d.getRowDefinition(a.row),d.getColumnDefinition(a.column),b);if(null!==d&&d.type===X.Auto&&d.zb()===a)return Gl(a,ud,b);if(c===Xk){if(null!==d){if(d.type===X.Spot&&d.zb()===a)return Gl(a,ud,b);c=d.defaultStretch;return c===Xk?Gl(a,xg,b):Gl(a,c,b)}return Gl(a,xg,b)}return Gl(a,c,b)}
    function Fl(a,b,c,d){var e=a.stretch;if(e!==Xk)return Gl(a,e,d);var f=e=null;switch(b.stretch){case Zk:f=!0;break;case ud:f=!0}switch(c.stretch){case Yk:e=!0;break;case ud:e=!0}b=a.panel.defaultStretch;null===e&&(e=b===Yk||b===ud);null===f&&(f=b===Zk||b===ud);return!0===e&&!0===f?Gl(a,ud,d):!0===e?Gl(a,Yk,d):!0===f?Gl(a,Zk,d):Gl(a,xg,d)}
    function Gl(a,b,c){if(c)return b;if(b===xg)return xg;c=a.desiredSize;if(c.u())return xg;a=a.angle;if(!isNaN(c.width))if(90!==a&&270!==a){if(b===Yk)return xg;if(b===ud)return Zk}else{if(b===Zk)return xg;if(b===ud)return Yk}if(!isNaN(c.height))if(90!==a&&270!==a){if(b===Zk)return xg;if(b===ud)return Yk}else{if(b===Yk)return xg;if(b===ud)return Zk}return b}function xl(a,b){a.F=b?a.F|512:a.F&-513}function gl(a){return 0!==(a.F&1024)}function Hl(a,b){a.F=b?a.F|1024:a.F&-1025}
    function Cl(a,b){a.F=b?a.F|2048:a.F&-2049}function Dl(a,b){a.F=b?a.F|4096:a.F&-4097}function tj(a){return 0!==(a.F&8192)}function oj(a,b){a.F=b?a.F|8192:a.F&-8193}function uj(a){return 0!==(a.F&16384)}function nl(a,b){a.F=b?a.F|16384:a.F&-16385}t.cj=function(a){this.lg=a};t.Pt=function(){};t.jw=function(a){this.ma.assign(a);El(this);return!0};t.Kq=function(a,b){if(this.ma.x!==a||this.ma.y!==b)this.ma.h(a,b),this.ml()};
    function Il(a){var b=a.part;if(b instanceof W&&(null!==a.portId||a===b.port)){var c=b.diagram;null===c||c.undoManager.isUndoingRedoing||ql(b,a)}}function Jl(a){var b=a.diagram;null===b||b.undoManager.isUndoingRedoing||(a instanceof X?a instanceof W?a.fd():a.Km(a,function(a){Il(a)}):Il(a))}t.bind=function(a){a.bd=this;var b=this.Ui();null!==b&&Kl(b)&&B("Cannot add a Binding to a template that has already been copied: "+a);null===this.$a&&(this.$a=new E);this.$a.add(a)};
    t.Ui=function(){for(var a=this instanceof X?this:this.panel;null!==a;){if(null!==a.ci)return a;a=a.panel}return null};t.kw=function(a){Aj(this,a)};function Ll(a,b){b.bd=a;null===a.Ig&&(a.Ig=new G);a.Ig.add(b.propertyName,b)}
    function Ml(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=Nl.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 R&&1<c.length){f=
      d;var g=c[1];if("string"===typeof g||g instanceof HTMLDivElement)Hi(f,g),e++}for(;e<c.length;e++)f=c[e],void 0===f?B("Undefined value at argument "+e+" for object being constructed by GraphObject.make: "+d):Ol(d,f);return d}
    function Ol(a,b){if("string"===typeof b)if(a instanceof Ug)a.text=b;else if(a instanceof Kf)a.figure=b;else if(a instanceof mk)a.source=b;else if(a instanceof X)b=Pl.H(b),null!==b&&(a.type=b);else if(a instanceof vl){var c=Za(vl,b);null!==c?a.type=c:B("Unknown Brush type as an argument to GraphObject.make: "+b)}else a instanceof sd?(b=Za(sd,b),null!==b&&(a.type=b)):a instanceof oe&&(b=Za(oe,b),null!==b&&(a.type=b));else if(b instanceof Y)a instanceof X||B("A GraphObject can only be added to a Panel, not to: "+
      a),a.add(b);else if(b instanceof Uj){var d;b.isRow&&"function"===typeof a.getRowDefinition?d=a.getRowDefinition(b.index):b.isRow||"function"!==typeof a.getColumnDefinition||(d=a.getColumnDefinition(b.index));d instanceof Uj?d.ft(b):B("A RowColumnDefinition can only be added to an object that implements getRowDefinition/getColumnDefinition, not to: "+a)}else if(b instanceof D)"function"===typeof a.cb&&a.cb(b);else if(b instanceof Ql)a.type=b;else if(b instanceof Mi)a instanceof Y?a.bind(b):a instanceof
    Uj?a.bind(b):B("A Binding can only be applied to a GraphObject or RowColumnDefinition, not to: "+a);else if(b instanceof bi)a instanceof Y?Ll(a,b):B("An AnimationTrigger can only be applied to a GraphObject, not to: "+a);else if(b instanceof ne)a instanceof sd?a.figures.add(b):B("A PathFigure can only be added to a Geometry, not to: "+a);else if(b instanceof oe)a instanceof ne?a.segments.add(b):B("A PathSegment can only be added to a PathFigure, not to: "+a);else if(b instanceof Fi)a instanceof R?
      a.layout=b:a instanceof T?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++)Ol(a,b[c]);else if("object"===typeof b&&null!==b)if(a instanceof vl){c=new db;for(var e in b)d=parseFloat(e),isNaN(d)?c[e]=b[e]:a.addColorStop(d,b[e]);Aj(a,c)}else if(a instanceof Uj){void 0!==b.row?(e=b.row,(void 0===e||null===e||Infinity===e||isNaN(e)||0>e)&&B("Must specify non-negative integer row for RowColumnDefinition "+b+", not: "+e),a.isRow=
      !0,a.index=e):void 0!==b.column&&(e=b.column,(void 0===e||null===e||Infinity===e||isNaN(e)||0>e)&&B("Must specify non-negative integer column for RowColumnDefinition "+b+", not: "+e),a.isRow=!1,a.index=e);e=new db;for(c in b)"row"!==c&&"column"!==c&&(e[c]=b[c]);Aj(a,e)}else Aj(a,b);else B('Unknown initializer "'+b+'" for object being constructed by GraphObject.make: '+a)}function Rl(a,b){Nl.add(a,b)}
    function Sl(a,b,c){void 0===c&&(c=null);var d=a[1];if("function"===typeof c?c(d):"string"===typeof d)return a.splice(1,1),d;if(void 0===b)throw Error("no "+("function"===typeof c?"satisfactory":"string")+" argument for GraphObject builder "+a[0]);return b}
    ma.Object.defineProperties(Y.prototype,{shadowVisible:{get:function(){return this.Ll},set:function(a){var b=this.Ll;b!==a&&(this.Ll=a,this.M(),this.g("shadowVisible",b,a))}},enabledChanged:{get:function(){return null!==this.N?this.N.En:null},set:function(a){dl(this);var b=this.N.En;b!==a&&(this.N.En=a,this.g("enabledChanged",b,a))}},segmentOrientation:{get:function(){return this.Jl},set:function(a){var b=this.Jl;
          b!==a&&(this.Jl=a,this.o(),this.g("segmentOrientation",b,a),a===ag&&(this.angle=0))}},segmentIndex:{get:function(){return this.xp},set:function(a){a=Math.round(a);var b=this.xp;b!==a&&(this.xp=a,this.o(),this.g("segmentIndex",b,a))}},segmentFraction:{get:function(){return this.Hl},set:function(a){isNaN(a)?a=0:0>a?a=0:1<a&&(a=1);var b=this.Hl;b!==a&&(this.Hl=a,this.o(),this.g("segmentFraction",b,a))}},segmentOffset:{
        get:function(){return this.Il},set:function(a){var b=this.Il;b.w(a)||(this.Il=a=a.G(),this.o(),this.g("segmentOffset",b,a))}},stretch:{get:function(){return this.we},set:function(a){var b=this.we;b!==a&&(this.we=a,this.o(),this.g("stretch",b,a))}},name:{get:function(){return this.Qa},set:function(a){var b=this.Qa;b!==a&&(this.Qa=a,null!==this.part&&(this.part.Fj=null),this.g("name",b,a))}},opacity:{get:function(){return this.qb},
        set:function(a){var b=this.qb;b!==a&&((0>a||1<a)&&va(a,"0 <= value <= 1",Y,"opacity"),this.qb=a,this.g("opacity",b,a),a=this.diagram,b=this.part,null!==a&&null!==b&&a.M(Ej(b,b.actualBounds)))}},visible:{get:function(){return 0!==(this.F&1)},set:function(a){var b=0!==(this.F&1);b!==a&&(this.F^=1,this.g("visible",b,a),b=this.panel,null!==b?b.o():this.yf()&&this.Ob(a),this.M(),Jl(this))}},pickable:{get:function(){return 0!==(this.F&2)},set:function(a){var b=
          0!==(this.F&2);b!==a&&(this.F^=2,this.g("pickable",b,a))}},fromLinkableDuplicates:{get:function(){return 0!==(this.F&4)},set:function(a){var b=0!==(this.F&4);b!==a&&(this.F^=4,this.g("fromLinkableDuplicates",b,a))}},fromLinkableSelfNode:{get:function(){return 0!==(this.F&8)},set:function(a){var b=0!==(this.F&8);b!==a&&(this.F^=8,this.g("fromLinkableSelfNode",b,a))}},toLinkableDuplicates:{get:function(){return 0!==
          (this.F&16)},set:function(a){var b=0!==(this.F&16);b!==a&&(this.F^=16,this.g("toLinkableDuplicates",b,a))}},toLinkableSelfNode:{get:function(){return 0!==(this.F&32)},set:function(a){var b=0!==(this.F&32);b!==a&&(this.F^=32,this.g("toLinkableSelfNode",b,a))}},isPanelMain:{get:function(){return 0!==(this.F&64)},set:function(a){var b=0!==(this.F&64);b!==a&&(this.F^=64,this.o(),this.g("isPanelMain",b,a))}},isActionable:{
        get:function(){return 0!==(this.F&128)},set:function(a){var b=0!==(this.F&128);b!==a&&(this.F^=128,this.g("isActionable",b,a))}},areaBackground:{get:function(){return this.dc},set:function(a){var b=this.dc;b!==a&&(null!==a&&Tl(a,"GraphObject.areaBackground"),a instanceof vl&&a.freeze(),this.dc=a,this.M(),this.g("areaBackground",b,a))}},background:{get:function(){return this.gb},set:function(a){var b=this.gb;b!==a&&(null!==a&&Tl(a,"GraphObject.background"),
        a instanceof vl&&a.freeze(),this.gb=a,this.M(),this.g("background",b,a))}},part:{get:function(){if(this.yf())return this;if(null!==this.Jj)return this.Jj;var a;for(a=this.panel;a;){if(a instanceof U)return this.Jj=a;a=a.panel}return null}},svg:{get:function(){return this.Pp},set:function(a){this.Pp=a}},panel:{get:function(){return this.lg}},layer:{get:function(){var a=this.part;
          return null!==a?a.layer:null}},diagram:{get:function(){var a=this.part;return null!==a?a.diagram:null}},position:{get:function(){return this.ma},set:function(a){var b=a.x,c=a.y,d=this.ma,e=d.x,f=d.y;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))?this.Pt():(a=a.copy(),this.jw(a,d)&&this.g("position",d.copy(),a))}},actualBounds:{get:function(){return this.ub}},scale:{get:function(){return this.ya},
        set:function(a){var b=this.ya;b!==a&&(0>=a&&B("GraphObject.scale for "+this+" must be greater than zero, not: "+a),this.ya=a,this.o(),this.g("scale",b,a))}},angle:{get:function(){return this.Yb},set:function(a){var b=this.Yb;b!==a&&(a%=360,0>a&&(a+=360),b!==a&&(this.Yb=a,Jl(this),this.o(),this.g("angle",b,a)))}},desiredSize:{get:function(){return this.Lc},set:function(a){var b=a.width,c=a.height,d=this.Lc,e=d.width,f=d.height;(e===b||isNaN(e)&&
          isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))||(this.Lc=a=a.G(),this.o(),this instanceof Kf&&this.cc(),this.g("desiredSize",d,a),gl(this)&&(a=this.part,null!==a&&(hl(this,a,"width"),hl(this,a,"height"))))}},width:{get:function(){return this.Lc.width},set:function(a){var b=this.Lc.width;b===a||isNaN(b)&&isNaN(a)||(b=this.Lc,this.Lc=a=(new M(a,this.Lc.height)).freeze(),this.o(),this instanceof Kf&&this.cc(),this.g("desiredSize",b,a),gl(this)&&(a=this.part,null!==a&&hl(this,a,
          "width")))}},height:{get:function(){return this.Lc.height},set:function(a){var b=this.Lc.height;b===a||isNaN(b)&&isNaN(a)||(b=this.Lc,this.Lc=a=(new M(this.Lc.width,a)).freeze(),this.o(),this instanceof Kf&&this.cc(),this.g("desiredSize",b,a),gl(this)&&(a=this.part,null!==a&&hl(this,a,"height")))}},minSize:{get:function(){return this.cg},set:function(a){var b=this.cg;b.w(a)||(a=a.copy(),isNaN(a.width)&&(a.width=0),isNaN(a.height)&&(a.height=
          0),a.freeze(),this.cg=a,this.o(),this.g("minSize",b,a))}},maxSize:{get:function(){return this.bg},set:function(a){var b=this.bg;b.w(a)||(a=a.copy(),isNaN(a.width)&&(a.width=Infinity),isNaN(a.height)&&(a.height=Infinity),a.freeze(),this.bg=a,this.o(),this.g("maxSize",b,a))}},measuredBounds:{get:function(){return this.nc}},naturalBounds:{get:function(){return this.oc}},margin:{get:function(){return this.dh},
        set:function(a){"number"===typeof a&&(a=new oc(a));var b=this.dh;b.w(a)||(this.dh=a=a.G(),this.o(),this.g("margin",b,a))}},transform:{get:function(){0!==(this.F&2048)===!0&&sl(this);return this.kb}},vd:{get:function(){0!==(this.F&4096)===!0&&sl(this);return this.Qh}},alignment:{get:function(){return this.vb},set:function(a){var b=this.vb;b.w(a)||(a.jc()&&!a.Mb()&&B("GraphObject.alignment for "+this+" must be a real Spot or Spot.Default, not: "+
          a),this.vb=a=a.G(),El(this),this.g("alignment",b,a))}},column:{get:function(){return this.Mg},set:function(a){a=Math.round(a);var b=this.Mg;b!==a&&(0>a&&va(a,">= 0",Y,"column"),this.Mg=a,this.o(),this.g("column",b,a))}},columnSpan:{get:function(){return this.gn},set:function(a){a=Math.round(a);var b=this.gn;b!==a&&(1>a&&va(a,">= 1",Y,"columnSpan"),this.gn=a,this.o(),this.g("columnSpan",b,a))}},row:{get:function(){return this.pp},
        set:function(a){a=Math.round(a);var b=this.pp;b!==a&&(0>a&&va(a,">= 0",Y,"row"),this.pp=a,this.o(),this.g("row",b,a))}},rowSpan:{get:function(){return this.qp},set:function(a){a=Math.round(a);var b=this.qp;b!==a&&(1>a&&va(a,">= 1",Y,"rowSpan"),this.qp=a,this.o(),this.g("rowSpan",b,a))}},spanAllocation:{get:function(){return this.Kp},set:function(a){var b=this.Kp;b!==a&&(this.Kp=a,this.o(),this.g("spanAllocation",b,a))}},alignmentFocus:{
        get:function(){return this.Fk},set:function(a){var b=this.Fk;b.w(a)||(this.Fk=a=a.G(),this.o(),this.g("alignmentFocus",b,a))}},portId:{get:function(){return this.cp},set:function(a){var b=this.cp;if(b!==a){var c=this.part;null===c||c instanceof W||(B("Cannot set portID on a Link: "+a),c=null);null!==b&&null!==c&&Ul(c,this);this.cp=a;null!==a&&null!==c&&(c.Gh=!0,Vl(c,this));this.g("portId",b,a)}}},toSpot:{get:function(){return null!==
        this.O?this.O.wh:uc},set:function(a){this.Ec();var b=this.O.wh;b.w(a)||(a=a.G(),this.O.wh=a,this.g("toSpot",b,a),Il(this))}},toEndSegmentLength:{get:function(){return null!==this.O?this.O.uh:10},set:function(a){this.Ec();var b=this.O.uh;b!==a&&(0>a&&va(a,">= 0",Y,"toEndSegmentLength"),this.O.uh=a,this.g("toEndSegmentLength",b,a),Il(this))}},toShortLength:{get:function(){return null!==this.O?this.O.vh:0},set:function(a){this.Ec();var b=this.O.vh;
          b!==a&&(this.O.vh=a,this.g("toShortLength",b,a),Il(this))}},toLinkable:{get:function(){return null!==this.O?this.O.Tp:null},set:function(a){this.Ec();var b=this.O.Tp;b!==a&&(this.O.Tp=a,this.g("toLinkable",b,a))}},toMaxLinks:{get:function(){return null!==this.O?this.O.Up:Infinity},set:function(a){this.Ec();var b=this.O.Up;b!==a&&(0>a&&va(a,">= 0",Y,"toMaxLinks"),this.O.Up=a,this.g("toMaxLinks",b,a))}},fromSpot:{
        get:function(){return null!==this.O?this.O.Wg:uc},set:function(a){this.Ec();var b=this.O.Wg;b.w(a)||(a=a.G(),this.O.Wg=a,this.g("fromSpot",b,a),Il(this))}},fromEndSegmentLength:{get:function(){return null!==this.O?this.O.Ug:10},set:function(a){this.Ec();var b=this.O.Ug;b!==a&&(0>a&&va(a,">= 0",Y,"fromEndSegmentLength"),this.O.Ug=a,this.g("fromEndSegmentLength",b,a),Il(this))}},fromShortLength:{get:function(){return null!==this.O?this.O.Vg:
          0},set:function(a){this.Ec();var b=this.O.Vg;b!==a&&(this.O.Vg=a,this.g("fromShortLength",b,a),Il(this))}},fromLinkable:{get:function(){return null!==this.O?this.O.Kn:null},set:function(a){this.Ec();var b=this.O.Kn;b!==a&&(this.O.Kn=a,this.g("fromLinkable",b,a))}},fromMaxLinks:{get:function(){return null!==this.O?this.O.Ln:Infinity},set:function(a){this.Ec();var b=this.O.Ln;b!==a&&(0>a&&va(a,">= 0",Y,"fromMaxLinks"),this.O.Ln=a,this.g("fromMaxLinks",
          b,a))}},cursor:{get:function(){return this.fi},set:function(a){var b=this.fi;b!==a&&(this.fi=a,this.g("cursor",b,a))}},click:{get:function(){return null!==this.N?this.N.Lf:null},set:function(a){dl(this);var b=this.N.Lf;b!==a&&(this.N.Lf=a,this.g("click",b,a))}},doubleClick:{get:function(){return null!==this.N?this.N.Qf:null},set:function(a){dl(this);var b=this.N.Qf;b!==a&&(this.N.Qf=a,this.g("doubleClick",b,
          a))}},contextClick:{get:function(){return null!==this.N?this.N.Mf:null},set:function(a){dl(this);var b=this.N.Mf;b!==a&&(this.N.Mf=a,this.g("contextClick",b,a))}},mouseEnter:{get:function(){return null!==this.N?this.N.eg:null},set:function(a){dl(this);var b=this.N.eg;b!==a&&(this.N.eg=a,this.g("mouseEnter",b,a))}},mouseLeave:{get:function(){return null!==this.N?this.N.hg:null},set:function(a){dl(this);var b=
          this.N.hg;b!==a&&(this.N.hg=a,this.g("mouseLeave",b,a))}},mouseOver:{get:function(){return null!==this.N?this.N.ig:null},set:function(a){dl(this);var b=this.N.ig;b!==a&&(this.N.ig=a,this.g("mouseOver",b,a))}},mouseHover:{get:function(){return null!==this.N?this.N.gg:null},set:function(a){dl(this);var b=this.N.gg;b!==a&&(this.N.gg=a,this.g("mouseHover",b,a))}},mouseHold:{get:function(){return null!==this.N?this.N.fg:
          null},set:function(a){dl(this);var b=this.N.fg;b!==a&&(this.N.fg=a,this.g("mouseHold",b,a))}},mouseDragEnter:{get:function(){return null!==this.N?this.N.Fo:null},set:function(a){dl(this);var b=this.N.Fo;b!==a&&(this.N.Fo=a,this.g("mouseDragEnter",b,a))}},mouseDragLeave:{get:function(){return null!==this.N?this.N.Go:null},set:function(a){dl(this);var b=this.N.Go;b!==a&&(this.N.Go=a,this.g("mouseDragLeave",b,a))}},mouseDrop:{
        get:function(){return null!==this.N?this.N.dg:null},set:function(a){dl(this);var b=this.N.dg;b!==a&&(this.N.dg=a,this.g("mouseDrop",b,a))}},actionDown:{get:function(){return null!==this.N?this.N.Pm:null},set:function(a){dl(this);var b=this.N.Pm;b!==a&&(this.N.Pm=a,this.g("actionDown",b,a))}},actionMove:{get:function(){return null!==this.N?this.N.Qm:null},set:function(a){dl(this);var b=this.N.Qm;b!==a&&(this.N.Qm=a,this.g("actionMove",
          b,a))}},actionUp:{get:function(){return null!==this.N?this.N.Rm:null},set:function(a){dl(this);var b=this.N.Rm;b!==a&&(this.N.Rm=a,this.g("actionUp",b,a))}},actionCancel:{get:function(){return null!==this.N?this.N.Om:null},set:function(a){dl(this);var b=this.N.Om;b!==a&&(this.N.Om=a,this.g("actionCancel",b,a))}},toolTip:{get:function(){return null!==this.N?this.N.sg:null},set:function(a){dl(this);var b=this.N.sg;
          b!==a&&(this.N.sg=a,this.g("toolTip",b,a))}},contextMenu:{get:function(){return null!==this.N?this.N.Nf:null},set:function(a){dl(this);var b=this.N.Nf;b!==a&&(this.N.Nf=a,this.g("contextMenu",b,a))}}});Y.prototype.setProperties=Y.prototype.kw;Y.prototype.findTemplateBinder=Y.prototype.Ui;Y.prototype.bind=Y.prototype.bind;Y.prototype.isEnabledObject=Y.prototype.Cg;Y.prototype.isVisibleObject=Y.prototype.zf;Y.prototype.isContainedBy=Y.prototype.Bg;
    Y.prototype.getNearestIntersectionPoint=Y.prototype.Uc;Y.prototype.getLocalPoint=Y.prototype.pt;Y.prototype.getDocumentScale=Y.prototype.vf;Y.prototype.getDocumentAngle=Y.prototype.Xi;Y.prototype.getDocumentBounds=Y.prototype.lm;Y.prototype.getDocumentPoint=Y.prototype.ga;Y.prototype.intersectsRect=Y.prototype.Gc;Y.prototype.containedInRect=Y.prototype.Eh;Y.prototype.containsRect=Y.prototype.Ae;Y.prototype.containsPoint=Y.prototype.aa;Y.prototype.raiseChanged=Y.prototype.g;
    Y.prototype.raiseChangedEvent=Y.prototype.Ya;Y.prototype.addCopyProperty=Y.prototype.ux;var Nl=null;Y.className="GraphObject";Nl=new G;
    Rl("Button",function(){function a(a,b){return null!==a.diagram.Ub(a.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a},function(a){return a===b})}var b=Ml(X,X.Auto,{isActionable:!0,enabledChanged:function(a,b){if(a instanceof X){var c=a.Xa("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"},Ml(Kf,{name:"ButtonBorder",figure:"RoundedRectangle",spot1:new P(0,0,2.76142374915397,2.761423749153969),spot2:new P(1,1,-2.76142374915397,-2.761423749153969),parameter1:2,parameter2:2,fill:"#F5F5F5",stroke:"#BDBDBD"}));b.mouseEnter=function(a,b){if(b.Cg()&&b instanceof X&&(a=b.Xa("ButtonBorder"),a instanceof Kf)){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.Cg()&&b instanceof X&&(a=b.Xa("ButtonBorder"),a instanceof Kf&&(a.fill=b._buttonFillNormal,a.stroke=b._buttonStrokeNormal))};b.actionDown=function(a,b){if(b.Cg()&&b instanceof X&&null!==b._buttonFillPressed&&0===a.button){var c=b.Xa("ButtonBorder");if(c instanceof Kf){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.Cg()&&d instanceof X&&null!==d._buttonFillPressed&&0===b.button){var c=d.Xa("ButtonBorder");if(c instanceof Kf){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.Cg()&&d instanceof X&&null!==d._buttonFillPressed){var c=d.Xa("ButtonBorder");if(c instanceof Kf){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.Cg()&&d instanceof X&&null!==d._buttonFillPressed){var c=b.diagram;if(0===c.firstInput.button&&(c.currentTool.standardMouseOver(),a(b,d)&&(b=d.Xa("ButtonBorder"),b instanceof Kf))){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});
    Rl("TreeExpanderButton",function(){var a=Ml("Button",{_treeExpandedFigure:"MinusLine",_treeCollapsedFigure:"PlusLine"},Ml(Kf,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:Ob},(new Mi("figure","isTreeExpanded",function(a,c){c=c.panel;return a?c._treeExpandedFigure:c._treeCollapsedFigure})).Aq()),{visible:!1},(new Mi("visible","isTreeLeaf",function(a){return!a})).Aq());a.click=function(a,c){c=c.part;c instanceof Ke&&(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});
    Rl("SubGraphExpanderButton",function(){var a=Ml("Button",{_subGraphExpandedFigure:"MinusLine",_subGraphCollapsedFigure:"PlusLine"},Ml(Kf,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:Ob},(new Mi("figure","isSubGraphExpanded",function(a,c){c=c.panel;return a?c._subGraphExpandedFigure:c._subGraphCollapsedFigure})).Aq()));a.click=function(a,c){c=c.part;c instanceof Ke&&(c=c.adornedPart);if(c instanceof T){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});Rl("ToolTip",function(){return Ml(Ke,X.Auto,{isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new I(0,3),shadowBlur:5},Ml(Kf,{name:"Border",figure:"RoundedRectangle",parameter1:1,parameter2:1,fill:"#F5F5F5",stroke:"#F0F0F0",spot1:new P(0,0,4,6),spot2:new P(1,1,-4,-4)}))});
    Rl("ContextMenu",function(){return Ml(Ke,X.Vertical,{background:"#F5F5F5",isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new I(0,3),shadowBlur:5},new Mi("background","",function(a){return null!==a.adornedPart&&null!==a.placeholder?null:"#F5F5F5"}))});Rl("ContextMenuButton",function(){var a=Ml("Button");a.stretch=Yk;var b=a.Xa("ButtonBorder");b instanceof Kf&&(b.figure="Rectangle",b.strokeWidth=0,b.spot1=new P(0,0,2,3),b.spot2=new P(1,1,-2,-2));return a});
    Rl("PanelExpanderButton",function(a){var b=Sl(a,"COLLAPSIBLE"),c=Ml("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},Ml(Kf,{name:"ButtonIcon",strokeWidth:2},(new Mi("geometryString","visible",function(a){return a?c._buttonExpandedFigure:c._buttonCollapsedFigure})).Aq(b)));
      a=c.Xa("ButtonBorder");a instanceof Kf&&(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.Ui();null===e&&(e=c.part);null!==e&&(c=e.Xa(b),null!==c&&(a.handled=!0,d.ua("Collapse/Expand Panel"),c.visible=!c.visible,d.Ua("Collapse/Expand Panel")))}};return c});
    Rl("CheckBoxButton",function(a){var b=Sl(a);a=Ml("Button",{desiredSize:new M(14,14)},Ml(Kf,{name:"ButtonIcon",geometryString:"M0 0 M0 8.85 L4.9 13.75 16.2 2.45 M16.2 16.2",strokeWidth:2,stretch:ud,geometryStretch:zg,visible:!1},""!==b?(new Mi("visible",b)).Xx():[]));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.Xa("ButtonIcon");c.ua("checkbox");f.visible=!f.visible;"function"===typeof d._doClick&&d._doClick(a,
      d);c.Ua("checkbox")}}};return a});
    Rl("CheckBox",function(a){a=Sl(a);a=Ml("CheckBoxButton",a,{name:"Button",isActionable:!1,margin:new oc(0,1,0,0)});var b=Ml(X,"Horizontal",a,{isActionable:!0,cursor:a.cursor,margin:1,_buttonFillNormal:a._buttonFillNormal,_buttonStrokeNormal:a._buttonStrokeNormal,_buttonFillOver:a._buttonFillOver,_buttonStrokeOver:a._buttonStrokeOver,_buttonFillPressed:a._buttonFillPressed,_buttonStrokePressed:a._buttonStrokePressed,_buttonFillDisabled:a._buttonFillDisabled,mouseEnter:a.mouseEnter,mouseLeave:a.mouseLeave,
      actionDown:a.actionDown,actionUp:a.actionUp,actionCancel:a.actionCancel,actionMove:a.actionMove,click:a.click,_buttonClick:a.click});a.mouseEnter=null;a.mouseLeave=null;a.actionDown=null;a.actionUp=null;a.actionCancel=null;a.actionMove=null;a.click=null;return b});Y.None=xg=new D(Y,"None",0);Y.Default=Xk=new D(Y,"Default",0);Y.Vertical=Zk=new D(Y,"Vertical",4);Y.Horizontal=Yk=new D(Y,"Horizontal",5);Y.Fill=ud=new D(Y,"Fill",3);Y.Uniform=zg=new D(Y,"Uniform",1);
    Y.UniformToFill=$k=new D(Y,"UniformToFill",2);Y.FlipVertical=al=new D(Y,"FlipVertical",1);Y.FlipHorizontal=bl=new D(Y,"FlipHorizontal",2);Y.FlipBoth=cl=new D(Y,"FlipBoth",3);Y.make=Ml;Y.getBuilders=function(){var a=new G,b;for(b in Nl)if(b!==b.toLowerCase()){var c=Nl.H(b);"function"===typeof c&&a.add(b,c)}a.freeze();return a};Y.defineBuilder=Rl;Y.takeBuilderArgument=Sl;
    function el(){this.En=this.Nf=this.sg=this.Om=this.Rm=this.Qm=this.Pm=this.dg=this.Go=this.Fo=this.fg=this.gg=this.ig=this.hg=this.eg=this.Mf=this.Qf=this.Lf=null}el.prototype.copy=function(){var a=new el;a.Lf=this.Lf;a.Qf=this.Qf;a.Mf=this.Mf;a.eg=this.eg;a.hg=this.hg;a.ig=this.ig;a.gg=this.gg;a.fg=this.fg;a.Fo=this.Fo;a.Go=this.Go;a.dg=this.dg;a.Pm=this.Pm;a.Qm=this.Qm;a.Rm=this.Rm;a.Om=this.Om;a.sg=this.sg;a.Nf=this.Nf;a.En=this.En;return a};el.className="GraphObjectEventHandlers";
    function Wl(){this.Ka=[1,0,0,1,0,0]}Wl.prototype.copy=function(){var a=new Wl;a.Ka[0]=this.Ka[0];a.Ka[1]=this.Ka[1];a.Ka[2]=this.Ka[2];a.Ka[3]=this.Ka[3];a.Ka[4]=this.Ka[4];a.Ka[5]=this.Ka[5];return a};Wl.prototype.translate=function(a,b){this.Ka[4]+=this.Ka[0]*a+this.Ka[2]*b;this.Ka[5]+=this.Ka[1]*a+this.Ka[3]*b};Wl.prototype.scale=function(a,b){this.Ka[0]*=a;this.Ka[1]*=a;this.Ka[2]*=b;this.Ka[3]*=b};Wl.className="STransform";
    function Xl(a){this.type=a;this.r2=this.y2=this.x2=this.r1=this.y1=this.x1=0;this.Bx=[];this.pattern=null}Xl.prototype.addColorStop=function(a,b){this.Bx.push({offset:a,color:b})};Xl.className="SGradient";
    function Dj(a,b){this.ownerDocument=a=void 0===b?x.document:b;this.jA="http://www.w3.org/2000/svg";void 0!==a&&(this.Ea=this.tb("svg",{width:"1px",height:"1px",viewBox:"0 0 1 1"}),this.Ea.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns","http://www.w3.org/2000/svg"),this.Ea.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"));this.jq=null;this.context=new Yl(this)}
    Dj.prototype.resize=function(a,b,c,d){return this.width!==a||this.height!==b?(this.style.width=c+"px",this.style.height=d+"px",this.Ea.setAttributeNS(null,"width",c+"px"),this.Ea.setAttributeNS(null,"height",d+"px"),this.Ea.setAttributeNS(null,"viewBox","0 0 "+c+" "+d),this.context.Gu.firstElementChild.setAttributeNS(null,"width",c+"px"),this.context.Gu.firstElementChild.setAttributeNS(null,"height",d+"px"),!0):!1};
    Dj.prototype.tb=function(a,b,c){a=this.ownerDocument.createElementNS(this.jA,a);if(za(b))for(var d in b)a.setAttributeNS("href"===d?"http://www.w3.org/1999/xlink":"",d,b[d]);void 0!==c&&(a.textContent=c);return a};Dj.prototype.getBoundingClientRect=function(){return this.Ea.getBoundingClientRect()};Dj.prototype.focus=function(){this.Ea.focus()};Dj.prototype.Hx=function(){this.ownerDocument=null};
    ma.Object.defineProperties(Dj.prototype,{width:{get:function(){return this.Ea.width.baseVal.value},set:function(a){this.Ea.width=a}},height:{get:function(){return this.Ea.height.baseVal.value},set:function(a){this.Ea.height=a}},style:{get:function(){return this.Ea.style}}});Dj.className="SVGSurface";
    function Yl(a){this.yk=a;this.svg=a.Ea;this.stack=[];this.xc=[];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.ef=this.Gp=this.Fp=0;this.uq=null;this.path=[];this.xu=!1;this.ph=null;this.qh=0;this.Ud=new Wl;
      Zl(this,1,0,0,1,0,0);var b=pb++,c=this.tb("clipPath",{id:"mainClip"+b});c.appendChild(this.tb("rect",{x:0,y:0,width:a.width,height:a.height}));this.Gu=c;this.yk.Ea.appendChild(c);this.xc[0].setAttributeNS(null,"clip-path","url(#mainClip"+b+")");this.lA={}}t=Yl.prototype;
    t.reset=function(){this.stack=[];this.xc=[];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.ef=this.Gp=this.Fp=0;this.uq=null;this.path=[];this.Ud=new Wl;Zl(this,1,0,0,1,0,0);var a=pb++,b=this.tb("clipPath",
      {id:"mainClip"+a});b.appendChild(this.tb("rect",{x:0,y:0,width:this.yk.width,height:this.yk.height}));this.Gu=b;this.yk.Ea.appendChild(b);this.xc[0].setAttributeNS(null,"clip-path","url(#mainClip"+a+")")};
    t.arc=function(a,b,c,d,e,f,g,h){var k=2*Math.PI,l=k-1E-6,m=c*Math.cos(d),n=c*Math.sin(d),p=a+m,r=b+n,q=f?0:1;d=f?d-e:e-d;(1E-6<Math.abs(g-p)||1E-6<Math.abs(h-r))&&this.path.push(["L",p,+r]);0>d&&(d=d%k+k);d>l?(this.path.push(["A",c,c,0,1,q,a-m,b-n]),this.path.push(["A",c,c,0,1,q,p,r])):1E-6<d&&this.path.push(["A",c,c,0,+(d>=Math.PI),q,a+c*Math.cos(e),b+c*Math.sin(e)])};t.beginPath=function(){this.path=[]};t.bezierCurveTo=function(a,b,c,d,e,f){this.path.push(["C",a,b,c,d,e,f])};t.clearRect=function(){};
    t.clip=function(){this.addPath("clipPath",this.path,this.Ud);this.addPath("clipPath",this.path,new Wl)};t.closePath=function(){this.path.push(["z"])};t.createLinearGradient=function(a,b,c,d){var e=new Xl("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.lA;if(c[b])return"url(#"+c[b]+")";var d="PATTERN"+pb++,e={x:0,y:0,width:a.width,height:a.height,href:b};a=this.tb("pattern",{width:a.width,height:a.height,id:d,patternUnits:"userSpaceOnUse"});a.appendChild(this.tb("image",e));this.svg.appendChild(a);c[b]=d;return"url(#"+d+")"};
    t.createRadialGradient=function(a,b,c,d,e,f){var g=new Xl("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};J.$(d,h)&&J.$(e,k)?-1===l.toLowerCase().indexOf(".svg")&&(a.preserveAspectRatio="xMidYMid slice"):a.preserveAspectRatio=
      "none";l="";h/=d;k/=e;if(0!==f||0!==g)l+=" translate("+f+", "+g+")";if(1!==h||1!==k)l+=" scale("+h+", "+k+")";if(0!==b||0!==c)l+=" translate("+-b+", "+-c+")";if(0!==b||0!==c||d!==m||e!==n)f="CLIP"+pb++,g=this.tb("clipPath",{id:f}),g.appendChild(this.tb("rect",{x:b,y:c,width:d,height:e})),this.svg.appendChild(g),a["clip-path"]="url(#"+f+")";$l(this,"image",a,this.Ud,l);this.addElement("image",a)};t.fill=function(){this.addPath("fill",this.path,this.Ud)};
    t.Vd=function(){this.clipInsteadOfFill?this.clip():this.fill()};t.fillRect=function(a,b,c,d){a=[a,b,c,d];a={x:a[0],y:a[1],width:a[2],height:a[3]};$l(this,"fill",a,this.Ud);this.addElement("rect",a)};t.fillText=function(a,b,c){a=[a,b,c];b=this.textAlign;"left"===b?b="start":"right"===b?b="end":"center"===b&&(b="middle");b={x:a[1],y:a[2],style:"font: "+this.font,"text-anchor":b};$l(this,"fill",b,this.Ud);this.addElement("text",b,a[0])};t.lineTo=function(a,b){this.path.push(["L",a,b])};
    t.moveTo=function(a,b){this.path.push(["M",a,b])};t.quadraticCurveTo=function(a,b,c,d){this.path.push(["Q",a,b,c,d])};t.rect=function(a,b,c,d){this.path.push(["M",a,b],["L",a+c,b],["L",a+c,b+d],["L",a,b+d],["z"])};
    t.restore=function(){this.Ud=this.stack.pop();this.path=this.stack.pop();var a=this.stack.pop();this.fillStyle=a.fillStyle;this.font=a.font;this.globalAlpha=a.globalAlpha;this.lineCap=a.lineCap;this.lineDashOffset=a.lineDashOffset;this.lineJoin=a.lineJoin;this.lineWidth=a.lineWidth;this.miterLimit=a.miterLimit;this.shadowBlur=a.shadowBlur;this.shadowColor=a.shadowColor;this.shadowOffsetX=a.shadowOffsetX;this.shadowOffsetY=a.shadowOffsetY;this.strokeStyle=a.strokeStyle;this.textAlign=a.textAlign};
    t.save=function(){this.stack.push({fillStyle:this.fillStyle,font:this.font,globalAlpha:this.globalAlpha,lineCap:this.lineCap,lineDashOffset:this.lineDashOffset,lineJoin:this.lineJoin,lineWidth:this.lineWidth,miterLimit:this.miterLimit,shadowBlur:this.shadowBlur,shadowColor:this.shadowColor,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,strokeStyle:this.strokeStyle,textAlign:this.textAlign});for(var a=[],b=0;b<this.path.length;b++)a.push(this.path[b]);this.stack.push(a);this.stack.push(this.Ud.copy())};
    t.setTransform=function(a,b,c,d,e,f){1===a&&0===b&&0===c&&1===d&&0===e&&0===f||Zl(this,a,b,c,d,e,f)};t.scale=function(a,b){this.Ud.scale(a,b)};t.translate=function(a,b){this.Ud.translate(a,b)};t.transform=function(){};t.stroke=function(){this.addPath("stroke",this.path,this.Ud)};t.fj=function(){this.clipInsteadOfFill||this.stroke()};t.tb=function(a,b,c){return this.yk.tb(a,b,c)};
    t.addElement=function(a,b,c){a=this.tb(a,b,c);0<this.xc.length?this.xc[this.xc.length-1].appendChild(a):this.svg.appendChild(a);return this.uq=a};
    function $l(a,b,c,d,e){1!==a.globalAlpha&&(c.opacity=a.globalAlpha);"fill"===b?(a.fillStyle instanceof Xl?c.fill=am(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 Xl?c.stroke=am(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.Ka;d="matrix("+d[0]+", "+d[1]+", "+d[2]+", "+d[3]+", "+d[4]+", "+d[5]+")";void 0!==e&&(d+=e);c.transform=d}
    function am(a,b){var c="GRAD"+pb++;if("linear"===b.type)var d=a.tb("linearGradient",{x1:b.x1,x2:b.x2,y1:b.y1,y2:b.y2,id:c,gradientUnits:"userSpaceOnUse"});else if("radial"===b.type)d=a.tb("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.Bx;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.tb("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.xu&&(b["stroke-dasharray"]=this.ph.toString(),b["stroke-dashoffset"]=this.qh);$l(this,a,b,c);"clipPath"===a?(a="CLIP"+pb++,c=this.tb("clipPath",{id:a}),c.appendChild(this.tb("path",b)),this.svg.appendChild(c),
    0<this.xc.length&&this.xc[this.xc.length-1].setAttributeNS(null,"clip-path","url(#"+a+")")):this.addElement("path",b)};function Zl(a,b,c,d,e,f,g){var h=new Wl;h.Ka=[b,c,d,e,f,g];b={};$l(a,"g",b,h);h=a.addElement("g",b);a.xc.push(h)}
    t.Lq=function(){if(0!==this.shadowOffsetX||0!==this.shadowOffsetY||0!==this.shadowBlur){var a="SHADOW"+pb++,b=this.addElement("filter",{id:a,x:"-100%",y:"-100%",width:"300%",height:"300%"},null);var c=this.tb("feGaussianBlur",{"in":"SourceAlpha",result:"blur",MA:this.shadowBlur/2});var d=this.tb("feFlood",{"in":"blur",result:"flood","flood-color":this.shadowColor});var e=this.tb("feComposite",{"in":"flood",in2:"blur",operator:"in",result:"comp"});var f=this.tb("feOffset",{"in":"comp",result:"offsetBlur",
      dx:this.shadowOffsetX,dy:this.shadowOffsetY});var g=this.tb("feMerge",{});g.appendChild(this.tb("feMergeNode",{"in":"offsetBlur"}));g.appendChild(this.tb("feMergeNode",{"in":"SourceGraphic"}));b.appendChild(c);b.appendChild(d);b.appendChild(e);b.appendChild(f);b.appendChild(g);0<this.xc.length&&this.xc[this.xc.length-1].setAttributeNS(null,"filter","url(#"+a+")")}};t.lw=function(a,b,c){this.Fp=a;this.Gp=b;this.ef=c};function ul(a){a.shadowOffsetX=0;a.shadowOffsetY=0;a.shadowBlur=0}
    function tl(a){a.shadowOffsetX=a.Fp;a.shadowOffsetY=a.Gp;a.shadowBlur=a.ef}t.it=function(a,b){this.xu=!0;this.ph=a;this.qh=b};t.gt=function(){this.xu=!1};t.sc=function(){};t.my=function(){};Yl.prototype.rotate=function(){};Yl.prototype.getImageData=function(){return null};Yl.prototype.measureText=function(){return null};Yl.className="SVGContext";
    R.prototype.Bt=function(a){var b=new Dj(this,x.document);void 0===a&&(a=new db);var c=this;return Ck(this,function(a,e){a=Dk(c,a,"SVG",b);a=null!==a?a.svg:null;return"function"===typeof e?(e(a),null):a},a)};R.prototype.makeSvg=R.prototype.Bt;R.prototype.Nv=function(a){return this.Bt(a)};R.prototype.makeSVG=R.prototype.Nv;
    Y.prototype.Ix=function(a,b){if(!(a instanceof Yl))return!1;if(!this.visible)return!0;var c=null,d=a.uq;if(this instanceof X&&(this.type===X.TableRow||this.type===X.TableColumn))return rl(this,a,b),!0;var e=this.ub;if(0===e.width||0===e.height||isNaN(e.x)||isNaN(e.y))return!0;var f=this.transform,g=this.panel;0!==(this.F&4096)===!0&&sl(this);var h=0!==(this.F&256),k=!1;this instanceof Ug&&(a.font=this.font);if(h){k=g.ae()?g.naturalBounds:g.actualBounds;if(null!==this.md){var l=this.md;var m=l.x;var n=
      l.y;var p=l.width;l=l.height}else m=Math.max(e.x,k.x),n=Math.max(e.y,k.y),p=Math.min(e.right,k.right)-m,l=Math.min(e.bottom,k.bottom)-n;if(m>e.width+e.x||e.x>k.width+k.x||n>e.height+e.y||e.y>k.height+k.y)return!0;k=!0;Zl(a,1,0,0,1,0,0);a.save();a.beginPath();a.rect(m,n,p,l);a.clip()}if(this.yf()&&!this.isVisible())return!0;a.Ud.Ka=[1,0,0,1,0,0];(this instanceof Ug&&1<this.lineCount||this instanceof Kf&&1<this.geometry.figures.length)&&Zl(a,1,0,0,1,0,0);m=!1;this.yf()&&this.isShadowed&&b.Ce("drawShadows")&&
    (n=this.shadowOffset,a.lw(n.x*b.scale*b.Sb,n.y*b.scale*b.Sb,this.shadowBlur),tl(a),a.shadowColor=this.shadowColor);n=!1;this.part&&b.Ce("drawShadows")&&(n=this.part.isShadowed);!0===this.shadowVisible?(tl(a),!1===m&&n&&(Zl(a,1,0,0,1,0,0),a.Lq(),m=!0)):!1===this.shadowVisible&&ul(a);p=this.naturalBounds;null!==this.areaBackground&&(ki(this,a,this.areaBackground,!0,!0,p,e),!1===m&&n&&(Zl(a,1,0,0,1,0,0),a.Lq(),m=!0),this.areaBackground instanceof vl&&this.areaBackground.type===wl?(a.beginPath(),a.rect(e.x,
      e.y,e.width,e.height),a.Vd(this.areaBackground)):a.fillRect(e.x,e.y,e.width,e.height));this instanceof X?Zl(a,f.m11,f.m12,f.m21,f.m22,f.dx,f.dy):a.Ud.Ka=[f.m11,f.m12,f.m21,f.m22,f.dx,f.dy];if(null!==this.background){!1===m&&n&&(Zl(a,1,0,0,1,0,0),a.Lq(),m=!0);var r=this.naturalBounds;l=f=0;var q=r.width;r=r.height;var u=0;this instanceof Kf&&(r=this.geometry.bounds,f=r.x,l=r.y,q=r.width,r=r.height,u=this.strokeWidth);ki(this,a,this.background,!0,!1,p,e);this.background instanceof vl&&this.background.type===
    wl?(a.beginPath(),a.rect(f-u/2,l-u/2,q+u,r+u),a.Vd(this.background)):a.fillRect(f-u/2,l-u/2,q+u,r+u)}n&&(null!==this.background||null!==this.areaBackground||null!==g&&0!==(g.F&512)||null!==g&&(g.type===X.Auto||g.type===X.Spot)&&g.zb()!==this)?(xl(this,!0),null===this.shadowVisible&&ul(a)):xl(this,!1);this.Qi(a,b);n&&0!==(this.F&512)===!0&&tl(a);this.yf()&&n&&ul(a);h&&(a.restore(),k&&a.xc.pop());this instanceof X&&(c=a.xc.pop());!0===m&&a.xc.pop();if(this instanceof Ug&&1<this.lineCount||this instanceof
      Kf&&1<this.geometry.figures.length)c=a.xc.pop();null!==a.yk.jq&&(null===c&&(d===a.uq?(Zl(a,1,0,0,1,0,0),c=a.xc.pop()):c=a.uq),a.yk.jq(this,c));this.svg=c;return!0};function Ek(a,b){this.ownerDocument=b=void 0===b?x.document:b;this.jq=null;b=b.createElement("canvas");b.tabIndex=0;this.Ea=b;this.Ea.innerHTML="This text is displayed if your browser does not support the Canvas HTML element.";this.context=new zl(b);b.B=a}
    Ek.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};Ek.prototype.toDataURL=function(a,b){return this.Ea.toDataURL(a,b)};Ek.prototype.getBoundingClientRect=function(){return this.Ea.getBoundingClientRect()};Ek.prototype.focus=function(){this.Ea.focus()};Ek.prototype.Hx=function(){this.ownerDocument=this.Ea.B=null};
    ma.Object.defineProperties(Ek.prototype,{width:{get:function(){return this.Ea.width},set:function(a){this.Ea.width=a}},height:{get:function(){return this.Ea.height},set:function(a){this.Ea.height=a}},style:{get:function(){return this.Ea.style}}});Ek.className="CanvasSurface";
    function zl(a){a.getContext&&a.getContext("2d")||B("Browser does not support HTML Canvas Element");this.V=a.getContext("2d");this.$t=this.bu=this.au="";this.fn=!1;this.ef=this.Gp=this.Fp=0}t=zl.prototype;t.my=function(a){this.V.imageSmoothingEnabled=a};t.arc=function(a,b,c,d,e,f){this.V.arc(a,b,c,d,e,f)};t.beginPath=function(){this.V.beginPath()};t.bezierCurveTo=function(a,b,c,d,e,f){this.V.bezierCurveTo(a,b,c,d,e,f)};t.clearRect=function(a,b,c,d){this.V.clearRect(a,b,c,d)};t.clip=function(){this.V.clip()};
    t.closePath=function(){this.V.closePath()};t.createLinearGradient=function(a,b,c,d){return this.V.createLinearGradient(a,b,c,d)};t.createPattern=function(a,b){return this.V.createPattern(a,b)};t.createRadialGradient=function(a,b,c,d,e,f){return this.V.createRadialGradient(a,b,c,d,e,f)};t.drawImage=function(a,b,c,d,e,f,g,h,k){void 0===d?this.V.drawImage(a,b,c):this.V.drawImage(a,b,c,d,e,f,g,h,k)};t.fill=function(){this.V.fill()};t.fillRect=function(a,b,c,d){this.V.fillRect(a,b,c,d)};
    t.fillText=function(a,b,c){this.V.fillText(a,b,c)};t.getImageData=function(a,b,c,d){return this.V.getImageData(a,b,c,d)};t.lineTo=function(a,b){this.V.lineTo(a,b)};t.measureText=function(a){return this.V.measureText(a)};t.moveTo=function(a,b){this.V.moveTo(a,b)};t.quadraticCurveTo=function(a,b,c,d){this.V.quadraticCurveTo(a,b,c,d)};t.rect=function(a,b,c,d){this.V.rect(a,b,c,d)};t.restore=function(){this.V.restore()};zl.prototype.rotate=function(a){this.V.rotate(a)};t=zl.prototype;t.save=function(){this.V.save()};
    t.setTransform=function(a,b,c,d,e,f){this.V.setTransform(a,b,c,d,e,f)};t.scale=function(a,b){this.V.scale(a,b)};t.stroke=function(){this.V.stroke()};t.transform=function(a,b,c,d,e,f){1===a&&0===b&&0===c&&1===d&&0===e&&0===f||this.V.transform(a,b,c,d,e,f)};t.translate=function(a,b){this.V.translate(a,b)};
    t.Vd=function(a){if(a instanceof vl&&a.type===wl){var b=a.Mk;a=a.cu;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.fn?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.fn?this.clip():this.fill()};t.fj=function(){this.fn||this.stroke()};t.lw=function(a,b,c){this.Fp=a;this.Gp=b;this.ef=c};
    t.it=function(a,b){var c=this.V;void 0!==c.setLineDash&&(c.setLineDash(a),c.lineDashOffset=b)};t.gt=function(){var a=this.V;void 0!==a.setLineDash&&(a.setLineDash(bm),a.lineDashOffset=0)};t.sc=function(a){a&&(this.au="");this.$t=this.bu=""};
    ma.Object.defineProperties(zl.prototype,{fillStyle:{get:function(){return this.V.fillStyle},set:function(a){this.$t!==a&&(this.$t=this.V.fillStyle=a)}},font:{get:function(){return this.V.font},set:function(a){this.au!==a&&(this.au=this.V.font=a)}},globalAlpha:{get:function(){return this.V.globalAlpha},set:function(a){this.V.globalAlpha=a}},lineCap:{get:function(){return this.V.lineCap},
        set:function(a){this.V.lineCap=a}},lineDashOffset:{get:function(){return this.V.lineDashOffset},set:function(a){this.V.lineDashOffset=a}},lineJoin:{get:function(){return this.V.lineJoin},set:function(a){this.V.lineJoin=a}},lineWidth:{get:function(){return this.V.lineWidth},set:function(a){this.V.lineWidth=a}},miterLimit:{get:function(){return this.V.miterLimit},set:function(a){this.V.miterLimit=
          a}},shadowBlur:{get:function(){return this.V.shadowBlur},set:function(a){this.V.shadowBlur=a}},shadowColor:{get:function(){return this.V.shadowColor},set:function(a){this.V.shadowColor=a}},shadowOffsetX:{get:function(){return this.V.shadowOffsetX},set:function(a){this.V.shadowOffsetX=a}},shadowOffsetY:{get:function(){return this.V.shadowOffsetY},set:function(a){this.V.shadowOffsetY=
          a}},strokeStyle:{get:function(){return this.V.strokeStyle},set:function(a){this.bu!==a&&(this.bu=this.V.strokeStyle=a)}},textAlign:{get:function(){return this.V.textAlign},set:function(a){this.V.textAlign=a}},imageSmoothingEnabled:{get:function(){return this.V.imageSmoothingEnabled},set:function(a){this.V.imageSmoothingEnabled=a}},clipInsteadOfFill:{get:function(){return this.fn},
        set:function(a){this.fn=a}}});var bm=Object.freeze([]);zl.className="CanvasSurfaceContext";function cm(){this.Y=this.v=this.I=this.l=0}cm.className="ColorNumbers";function vl(a){dm||(em(),dm=!0);Ya(this);this.s=!1;void 0===a?(this.pa=yl,this.Lk="black"):"string"===typeof a?(this.pa=yl,this.Lk=a):(this.pa=a,this.Lk="black");a=this.pa;a===Bl?(this.ud=wc,this.Yk=Dc):this.Yk=a===wl?this.ud=Ac:this.ud=uc;this.Ps=0;this.Br=NaN;this.de=this.rs=this.ce=null;this.cu=this.Mk=0}
    vl.prototype.copy=function(){var a=new vl;a.pa=this.pa;a.Lk=this.Lk;a.ud=this.ud.G();a.Yk=this.Yk.G();a.Ps=this.Ps;a.Br=this.Br;null!==this.ce&&(a.ce=this.ce.copy());a.rs=this.rs;return a};t=vl.prototype;t.freeze=function(){this.s=!0;null!==this.ce&&this.ce.freeze();return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.s=!1;null!==this.ce&&this.ce.ea();return this};t.cb=function(a){a.classType===vl&&(this.type=a)};
    t.toString=function(){var a="Brush(";if(this.type===yl)a+=this.color;else if(a=this.type===Bl?a+"Linear ":this.type===wl?a+"Radial ":this.type===Al?a+"Pattern ":a+"(unknown) ",a+=this.start+" "+this.end,null!==this.colorStops)for(var b=this.colorStops.iterator;b.next();)a+=" "+b.key+":"+b.value;return a+")"};
    t.addColorStop=function(a,b){this.s&&ua(this);("number"!==typeof a||!isFinite(a)||1<a||0>a)&&va(a,"0 <= loc <= 1",vl,"addColorStop:loc");null===this.ce&&(this.ce=new G);this.ce.add(a,b);this.pa===yl&&(this.type=Bl);this.de=null;return this};
    t.dA=function(a,b){this.s&&ua(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?fm:b;if(this.type===yl)Sh(this.color),this.color=gm(a,b);else if((this.type===Bl||this.type===wl)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)Sh(c.value),this.addColorStop(c.key,gm(a,b));return this};function hm(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?fm:c;Sh(a);return gm(b,c)}
    t.$y=function(a,b){this.s&&ua(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?fm:b;if(this.type===yl)Sh(this.color),this.color=gm(-a,b);else if((this.type===Bl||this.type===wl)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)Sh(c.value),this.addColorStop(c.key,gm(-a,b));return this};function im(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?fm:c;Sh(a);return gm(-b,c)}
    function jm(a,b,c){Sh(a);a=km.l;var d=km.I,e=km.v,f=km.Y;Sh(b);void 0===c&&(c=.5);return"rgba("+Math.round((km.l-a)*c+a)+", "+Math.round((km.I-d)*c+d)+", "+Math.round((km.v-e)*c+e)+", "+Math.round((km.Y-f)*c+f)+")"}
    t.Vx=function(){if(this.type===yl)return lm(this.color);if((this.type===Bl||this.type===wl)&&null!==this.colorStops){var a=this.colorStops;if(this.type===wl)return lm(a.first().value);if(null!==a.get(.5))return lm(a.get(.5));if(2===a.count)return a=a.na(),lm(jm(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 lm(jm(a.get(c),a.get(d),1-f/e))}return!1};
    function lm(a){if(null===a)return null;if(a instanceof vl)return a.Vx();Sh(a);return 128>(299*km.l+587*km.I+114*km.v)/1E3}
    function gm(a,b){switch(b){case fm:b=100*mm(km.l);var c=100*mm(km.I),d=100*mm(km.v);nm.l=.4124564*b+.3575761*c+.1804375*d;nm.I=.2126729*b+.7151522*c+.072175*d;nm.v=.0193339*b+.119192*c+.9503041*d;nm.Y=km.Y;b=om(nm.l/pm[0]);c=om(nm.I/pm[1]);d=om(nm.v/pm[2]);qm.l=116*c-16;qm.I=500*(b-c);qm.v=200*(c-d);qm.Y=nm.Y;qm.l=Math.min(100,Math.max(0,qm.l+100*a));a=(qm.l+16)/116;b=a-qm.v/200;nm.l=pm[0]*rm(qm.I/500+a);nm.I=pm[1]*(qm.l>sm*tm?Math.pow(a,3):qm.l/sm);nm.v=pm[2]*rm(b);nm.Y=qm.Y;a=-.969266*nm.l+1.8760108*
      nm.I+.041556*nm.v;b=.0556434*nm.l+-.2040259*nm.I+1.0572252*nm.v;km.l=255*um((3.2404542*nm.l+-1.5371385*nm.I+-.4985314*nm.v)/100);km.I=255*um(a/100);km.v=255*um(b/100);km.Y=nm.Y;km.l=Math.round(km.l);255<km.l?km.l=255:0>km.l&&(km.l=0);km.I=Math.round(km.I);255<km.I?km.I=255:0>km.I&&(km.I=0);km.v=Math.round(km.v);255<km.v?km.v=255:0>km.v&&(km.v=0);return"rgba("+km.l+", "+km.I+", "+km.v+", "+km.Y+")";case vm:return Th(),Uh.v=Math.min(100,Math.max(0,Uh.v+100*a)),"hsla("+Uh.l+", "+Uh.I+"%, "+Uh.v+"%, "+
    Uh.Y+")";default:return B("Unknown color space: "+b),"rgba(0, 0, 0, 1)"}}function Sh(a){dm||(em(),dm=!0);var b=wm;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,km.l=a[0],km.I=a[1],km.v=a[2],km.Y=a[3]/255):(b.fillStyle="#FFFFFF",b.fillStyle=a,km.l=0,km.I=0,km.v=0,km.Y=1)}}
    function Th(){var a=km.l/255,b=km.I/255,c=km.v/255,d=Math.max(a,b,c),e=Math.min(a,b,c),f=d-e;e=(d+e)/2;if(0===f)var g=a=0;else{switch(d){case a:g=(b-c)/f%6;break;case b:g=(c-a)/f+2;break;case c:g=(a-b)/f+4}g*=60;0>g&&(g+=360);a=f/(1-Math.abs(2*e-1))}Uh.l=Math.round(g);Uh.I=Math.round(100*a);Uh.v=Math.round(100*e);Uh.Y=km.Y}function mm(a){a/=255;return.04045>=a?a/12.92:Math.pow((a+.055)/1.055,2.4)}function um(a){return.0031308>=a?12.92*a:1.055*Math.pow(a,1/2.4)-.055}
    function om(a){return a>tm?Math.pow(a,1/3):(sm*a+16)/116}function rm(a){var b=a*a*a;return b>tm?b:(116*a-16)/sm}function Tl(a,b){"string"!==typeof a&&(a instanceof vl||B("Value for "+b+" must be a color string or a Brush, not "+a))}function em(){wm=Sg?(new Ek(null)).context:null}
    ma.Object.defineProperties(vl.prototype,{type:{get:function(){return this.pa},set:function(a){this.s&&ua(this,a);this.pa=a;this.start.jc()&&(a===Bl?this.start=wc:a===wl&&(this.start=Ac));this.end.jc()&&(a===Bl?this.end=Dc:a===wl&&(this.end=Ac));this.de=null}},color:{get:function(){return this.Lk},set:function(a){this.s&&ua(this,a);this.Lk=a;this.de=null}},start:{get:function(){return this.ud},set:function(a){this.s&&
        ua(this,a);this.ud=a.G();this.de=null}},end:{get:function(){return this.Yk},set:function(a){this.s&&ua(this,a);this.Yk=a.G();this.de=null}},startRadius:{get:function(){return this.Ps},set:function(a){this.s&&ua(this,a);0>a&&va(a,">= zero",vl,"startRadius");this.Ps=a;this.de=null}},endRadius:{get:function(){return this.Br},set:function(a){this.s&&ua(this,a);0>a&&va(a,">= zero",vl,"endRadius");this.Br=a;this.de=
          null}},colorStops:{get:function(){return this.ce},set:function(a){this.s&&ua(this,a);this.ce=a;this.de=null}},pattern:{get:function(){return this.rs},set:function(a){this.s&&ua(this,a);this.rs=a;this.de=null}}});vl.prototype.isDark=vl.prototype.Vx;vl.prototype.darkenBy=vl.prototype.$y;vl.prototype.lightenBy=vl.prototype.dA;vl.prototype.addColorStop=vl.prototype.addColorStop;
    var tm=216/24389,sm=24389/27,pm=[95.047,100,108.883],wm=null,km=new cm,Uh=new cm,nm=new cm,qm=new cm,dm=!1;vl.className="Brush";var yl;vl.Solid=yl=new D(vl,"Solid",0);var Bl;vl.Linear=Bl=new D(vl,"Linear",1);var wl;vl.Radial=wl=new D(vl,"Radial",2);var Al;vl.Pattern=Al=new D(vl,"Pattern",4);var fm;vl.Lab=fm=new D(vl,"Lab",5);var vm;vl.HSL=vm=new D(vl,"HSL",6);
    vl.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};
    vl.isValidColor=function(a){if("black"===a)return!0;if(""===a)return!1;dm||(em(),dm=!0);var b=wm;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};vl.lighten=function(a){return hm(a)};vl.lightenBy=hm;vl.darken=function(a){return im(a)};vl.darkenBy=im;vl.mix=jm;vl.isDark=lm;function Ql(){this.name="Base"}Ql.prototype.measure=function(){};
    Ql.prototype.gA=function(a,b,c,d,e){a.measure(b,c,d,e)};Ql.prototype.arrange=function(){};Ql.prototype.Qy=function(a,b,c,d,e,f){a.arrange(b,c,d,e,f)};Ql.prototype.bc=function(){};ma.Object.defineProperties(Ql.prototype,{classType:{get:function(){return X}}});Ql.prototype.arrangeElement=Ql.prototype.Qy;Ql.prototype.measureElement=Ql.prototype.gA;Ql.className="PanelLayout";function xm(){this.name="Base";this.name="Position"}la(xm,Ql);
    xm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;a=ym(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 Kf&&l.isGeometryPositioned&&(l=l.strokeWidth/2,p-=l,r-=l);ec(e,p,r,n,m)}}};
    xm.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 Kf&&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 zm(){this.name="Base";this.name="Horizontal"}la(zm,Ql);
    zm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;b=Fa();f=ym(a);for(var k=0;k<h;k++){var l=d[k];if(l.visible||l===f){var m=ml(l,!1);if(m!==xg&&m!==Yk)b.push(l);else{l.measure(Infinity,c,0,g);m=l.margin;l=l.measuredBounds;var n=Math.max(l.height+m.top+m.bottom,0);e.width+=Math.max(l.width+m.right+m.left,0);e.height=Math.max(e.height,n)}}}d=b.length;a.desiredSize.height?c=Math.min(a.desiredSize.height,a.maxSize.height):0!==e.height&&(c=Math.min(e.height,a.maxSize.height));for(a=0;a<d;a++)if(k=
      b[a],k.visible||k===f)m=k.margin,h=m.right+m.left,m=m.top+m.bottom,k.measure(Infinity,c,0,g),k=k.measuredBounds,m=Math.max(k.height+m,0),e.width+=Math.max(k.width+h,0),e.height=Math.max(e.height,m);Ha(b)};
    zm.prototype.arrange=function(a,b,c){for(var d=b.length,e=a.padding,f=e.top,g=a.isOpposite,h=g?c.width:e.left,k=0;k<d;k++){var l=f,m=b[k];if(m.visible){var n=m.measuredBounds,p=m.margin,r=p.top+p.bottom,q=f+e.bottom,u=n.height,v=ml(m,!1);if(isNaN(m.desiredSize.height)&&v===ud||v===Zk)u=Math.max(c.height-r-q,0);r=u+r+q;q=m.alignment;q.Mb()&&(q=a.defaultAlignment);q.eb()||(q=Ac);g&&(h-=n.width+p.left+p.right);m.arrange(h+q.offsetX+p.left,l+q.offsetY+p.top+(c.height*q.y-r*q.y),n.width,u);g||(h+=n.width+
      p.left+p.right)}}};function Am(){this.name="Base";this.name="Vertical"}la(Am,Ql);
    Am.prototype.measure=function(a,b,c,d,e,f){var g=d.length;c=Fa();for(var h=ym(a),k=0;k<g;k++){var l=d[k];if(l.visible||l===h){var m=ml(l,!1);if(m!==xg&&m!==Zk)c.push(l);else{var n=l.margin;m=n.right+n.left;n=n.top+n.bottom;l.measure(b,Infinity,f,0);l=l.measuredBounds;Vb(e,Math.max(e.width,Math.max(l.width+m,0)),e.height+Math.max(l.height+n,0))}}}d=c.length;if(0!==d){a.desiredSize.width?b=Math.min(a.desiredSize.width,a.maxSize.width):0!==e.width&&(b=Math.min(e.width,a.maxSize.width));for(a=0;a<d;a++)if(k=
      c[a],k.visible||k===h)l=k.margin,g=l.right+l.left,l=l.top+l.bottom,k.measure(b,Infinity,f,0),k=k.measuredBounds,l=Math.max(k.height+l,0),e.width=Math.max(e.width,Math.max(k.width+g,0)),e.height+=l;Ha(c)}};
    Am.prototype.arrange=function(a,b,c){for(var d=b.length,e=a.padding,f=e.left,g=a.isOpposite,h=g?c.height:e.top,k=0;k<d;k++){var l=f,m=b[k];if(m.visible){var n=m.measuredBounds,p=m.margin,r=p.left+p.right,q=f+e.right,u=n.width,v=ml(m,!1);if(isNaN(m.desiredSize.width)&&v===ud||v===Yk)u=Math.max(c.width-r-q,0);r=u+r+q;q=m.alignment;q.Mb()&&(q=a.defaultAlignment);q.eb()||(q=Ac);g&&(h-=n.height+p.bottom+p.top);m.arrange(l+q.offsetX+p.left+(c.width*q.x-r*q.x),h+q.offsetY+p.top,u,n.height);g||(h+=n.height+
      p.bottom+p.top)}}};function Bm(){this.name="Base";this.name="Spot"}la(Bm,Ql);
    Bm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.zb(),l=k.margin,m=l.right+l.left,n=l.top+l.bottom;k.measure(b,c,f,g);var p=k.measuredBounds;f=p.width;g=p.height;var r=Math.max(f+m,0);var q=Math.max(g+n,0);for(var u=a.isClipping,v=N.allocAt(-l.left,-l.top,r,q),w=!0,y=ym(a),z=0;z<h;z++){var A=d[z];if(A!==k&&(A.visible||A===y)){l=A.margin;r=l.right+l.left;q=l.top+l.bottom;p=ml(A,!1);switch(p){case ud:b=f;c=g;break;case Yk:b=f;break;case Zk:c=g}A.measure(b,c,0,0);p=A.measuredBounds;r=
      Math.max(p.width+r,0);q=Math.max(p.height+q,0);var C=A.alignment;C.Mb()&&(C=a.defaultAlignment);C.eb()||(C=Ac);var H=A.alignmentFocus;H.Mb()&&(H=Ac);var L=null;A instanceof X&&""!==A.Hg&&(A.arrange(0,0,p.width,p.height),L=A.Xa(A.Hg),L===A&&(L=null));if(null!==L){l=L.naturalBounds;p=L.margin;for(l=I.allocAt(H.x*l.width-H.offsetX-p.left,H.y*l.height-H.offsetY-p.top);L!==A;)L.transform.ra(l),L=L.panel;A=C.x*f+C.offsetX-l.x;p=C.y*g+C.offsetY-l.y;I.free(l)}else A=C.x*f+C.offsetX-(H.x*p.width+H.offsetX)-
      l.left,p=C.y*g+C.offsetY-(H.y*p.height+H.offsetY)-l.top;w?(w=!1,e.h(A,p,r,q)):ec(e,A,p,r,q)}}w?e.assign(v):u?e.Gv(v.x,v.y,v.width,v.height):ec(e,v.x,v.y,v.width,v.height);N.free(v);p=k.stretch;p===Xk&&(p=ml(k,!1));switch(p){case xg:return;case ud:if(!isFinite(b)&&!isFinite(c))return;break;case Yk:if(!isFinite(b))return;break;case Zk:if(!isFinite(c))return}p=k.measuredBounds;f=p.width;g=p.height;r=Math.max(f+m,0);q=Math.max(g+n,0);l=k.margin;v=N.allocAt(-l.left,-l.top,r,q);for(b=0;b<h;b++)c=d[b],c===
    k||!c.visible&&c!==y||(l=c.margin,r=l.right+l.left,q=l.top+l.bottom,p=c.measuredBounds,r=Math.max(p.width+r,0),q=Math.max(p.height+q,0),m=c.alignment,m.Mb()&&(m=a.defaultAlignment),m.eb()||(m=Ac),c=c.alignmentFocus,c.Mb()&&(c=Ac),w?(w=!1,e.h(m.x*f+m.offsetX-(c.x*p.width+c.offsetX)-l.left,m.y*g+m.offsetY-(c.y*p.height+c.offsetY)-l.top,r,q)):ec(e,m.x*f+m.offsetX-(c.x*p.width+c.offsetX)-l.left,m.y*g+m.offsetY-(c.y*p.height+c.offsetY)-l.top,r,q));w?e.assign(v):u?e.Gv(v.x,v.y,v.width,v.height):ec(e,v.x,
      v.y,v.width,v.height);N.free(v)};
    Bm.prototype.arrange=function(a,b,c){var d=b.length,e=a.zb(),f=e.measuredBounds,g=f.width;f=f.height;var h=a.padding,k=h.left;h=h.top;var l=k-c.x,m=h-c.y;e.arrange(l,m,g,f);for(var n=0;n<d;n++){var p=b[n];if(p!==e){var r=p.measuredBounds,q=r.width;r=r.height;m=p.alignment;m.Mb()&&(m=a.defaultAlignment);m.eb()||(m=Ac);var u=p.alignmentFocus;u.Mb()&&(u=Ac);l=null;p instanceof X&&""!==p.Hg&&(l=p.Xa(p.Hg),l===p&&(l=null));if(null!==l){var v=l.naturalBounds;for(u=I.allocAt(u.x*v.width-u.offsetX,u.y*v.height-
      u.offsetY);l!==p;)l.transform.ra(u),l=l.panel;l=m.x*g+m.offsetX-u.x;m=m.y*f+m.offsetY-u.y;I.free(u)}else l=m.x*g+m.offsetX-(u.x*q+u.offsetX),m=m.y*f+m.offsetY-(u.y*r+u.offsetY);l-=c.x;m-=c.y;p.visible&&p.arrange(k+l,h+m,q,r)}}};function Cm(){this.name="Base";this.name="Auto"}la(Cm,Ql);
    Cm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.zb(),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 Kf&&(u=k,q=u.strokeWidth*u.scale);var v=Math.max(l.width+p,0);l=Math.max(l.height+r,0);var w=Dm(k),y=w.x*v+w.offsetX;w=w.y*l+w.offsetY;var z=Em(k),A=z.x*v+z.offsetX;z=z.y*l+z.offsetY;isFinite(b)&&(m=Math.max(Math.abs(y-A)-q,0));isFinite(c)&&(n=Math.max(Math.abs(w-z)-q,0));q=M.alloc();q.h(0,0);a=ym(a);for(z=0;z<h;z++)w=
      d[z],w===k||!w.visible&&w!==a||(l=w.margin,v=l.right+l.left,y=l.top+l.bottom,w.measure(m,n,0,0),l=w.measuredBounds,v=Math.max(l.width+v,0),l=Math.max(l.height+y,0),q.h(Math.max(v,q.width),Math.max(l,q.height)));if(1===h)e.width=v,e.height=l,M.free(q);else{w=Dm(k);z=Em(k);h=d=0;z.x!==w.x&&z.y!==w.y&&(d=q.width/Math.abs(z.x-w.x),h=q.height/Math.abs(z.y-w.y));M.free(q);q=0;null!==u&&(q=u.strokeWidth*u.scale,yg(u)===zg&&(d=h=Math.max(d,h)));d+=Math.abs(w.offsetX)+Math.abs(z.offsetX)+q;h+=Math.abs(w.offsetY)+
      Math.abs(z.offsetY)+q;u=k.stretch;u===Xk&&(u=ml(k,!1));switch(u){case xg:g=f=0;break;case ud:isFinite(b)&&(d=b);isFinite(c)&&(h=c);break;case Yk:isFinite(b)&&(d=b);g=0;break;case Zk:f=0,isFinite(c)&&(h=c)}k.om();k.measure(d,h,f,g);e.width=k.measuredBounds.width+p;e.height=k.measuredBounds.height+r}};
    Cm.prototype.arrange=function(a,b){var c=b.length,d=a.zb(),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=Dm(d),n=Em(d),p=m.y*e.height+m.offsetY,r=n.x*e.width+n.offsetX;n=n.y*e.height+n.offsetY;f.x=m.x*e.width+m.offsetX;f.y=p;ec(f,r,n,0,0);f.x+=h+l;f.y+=g+k;for(e=0;e<c;e++)h=b[e],h!==d&&(l=h.measuredBounds,g=h.margin,k=Math.max(l.width+g.right+g.left,0),m=Math.max(l.height+g.top+g.bottom,0),p=h.alignment,
    p.Mb()&&(p=a.defaultAlignment),p.eb()||(p=Ac),k=f.width*p.x+p.offsetX-k*p.x+g.left+f.x,g=f.height*p.y+p.offsetY-m*p.y+g.top+f.y,h.visible&&(fc(f.x,f.y,f.width,f.height,k,g,l.width,l.height)?h.arrange(k,g,l.width,l.height):h.arrange(k,g,l.width,l.height,new N(f.x,f.y,f.width,f.height))));N.free(f)};function Fm(){this.name="Base";this.name="Table"}la(Fm,Ql);
    Fm.prototype.measure=function(a,b,c,d,e,f,g){for(var h=d.length,k=Fa(),l=Fa(),m=0;m<h;m++){var n=d[m],p=n instanceof X?n:null;if(null===p||p.type!==X.TableRow&&p.type!==X.TableColumn||!n.visible)k.push(n);else{l.push(p);for(var r=p.W.j,q=r.length,u=0;u<q;u++){var v=r[u];p.type===X.TableRow?v.row=n.row:p.type===X.TableColumn&&(v.column=n.column);k.push(v)}}}h=k.length;0===h&&(a.getRowDefinition(0),a.getColumnDefinition(0));for(var w=[],y=0;y<h;y++){var z=k[y];oj(z,!0);nl(z,!0);w[z.row]||(w[z.row]=
      []);w[z.row][z.column]||(w[z.row][z.column]=[]);w[z.row][z.column].push(z)}Ha(k);var A=Fa(),C=Fa(),H=Fa(),L={count:0},K={count:0},V=b,Q=c,ca=a.rb;h=ca.length;for(var pa=0;pa<h;pa++){var O=ca[pa];void 0!==O&&(O.actual=0)}ca=a.mb;h=ca.length;for(var xa=0;xa<h;xa++)O=ca[xa],void 0!==O&&(O.actual=0);for(var Ma=w.length,hb=0,Ea=0;Ea<Ma;Ea++)w[Ea]&&(hb=Math.max(hb,w[Ea].length));var wb=Math.min(a.topIndex,Ma-1),zd=Math.min(a.leftIndex,hb-1),ib=0;Ma=w.length;for(var Xb=ym(a),$a=0;$a<Ma;$a++)if(w[$a]){hb=
      w[$a].length;for(var Md=a.getRowDefinition($a),xc=Md.actual=0;xc<hb;xc++)if(w[$a][xc]){var yf=a.getColumnDefinition(xc);void 0===A[xc]&&(yf.actual=0,A[xc]=!0);for(var Ye=w[$a][xc],Ge=Ye.length,jh=0;jh<Ge;jh++){var Ec=Ye[jh];if(Ec.visible||Ec===Xb){var zf=1<Ec.rowSpan||1<Ec.columnSpan;zf&&($a<wb||xc<zd||C.push(Ec));var Ze=Ec.margin,Nd=Ze.right+Ze.left,Xj=Ze.top+Ze.bottom;var Fb=Fl(Ec,Md,yf,!1);var Af=Ec.desiredSize,Ad=!isNaN(Af.height),jc=!isNaN(Af.width)&&Ad;zf||Fb===xg||jc||$a<wb||xc<zd||(void 0!==
    L[xc]||Fb!==ud&&Fb!==Yk||(L[xc]=-1,L.count++),void 0!==K[$a]||Fb!==ud&&Fb!==Zk||(K[$a]=-1,K.count++),H.push(Ec));Ec.measure(Infinity,Infinity,0,0);if(!($a<wb||xc<zd)){var $e=Ec.measuredBounds,Wc=Math.max($e.width+Nd,0),dg=Math.max($e.height+Xj,0);if(1===Ec.rowSpan&&(Fb===xg||Fb===Yk)){O=a.getRowDefinition($a);var kh=O.uc();ib=Math.max(dg-O.actual,0);ib+kh>Q&&(ib=Math.max(Q-kh,0));var qn=0===O.actual;O.actual=O.actual+ib;Q=Math.max(Q-(ib+(qn?kh:0)),0)}if(1===Ec.columnSpan&&(Fb===xg||Fb===Zk)){O=a.getColumnDefinition(xc);
      var eg=O.uc();ib=Math.max(Wc-O.actual,0);ib+eg>V&&(ib=Math.max(V-eg,0));var Yj=0===O.actual;O.actual=O.actual+ib;V=Math.max(V-(ib+(Yj?eg:0)),0)}zf&&Ec.om()}}}}}Ha(A);var Yb=0,Oc=0;h=a.columnCount;for(var cc=0;cc<h;cc++){var fg=a.mb[cc];void 0!==fg&&(Yb+=fg.ha,0!==fg.ha&&(Yb+=fg.uc()))}h=a.rowCount;for(var lh=0;lh<h;lh++){var af=a.rb[lh];void 0!==af&&(Oc+=af.ha,0!==af.ha&&(Oc+=af.uc()))}V=Math.max(b-Yb,0);var vi=Q=Math.max(c-Oc,0),ge=V;h=H.length;for(var He=0;He<h;He++){var kc=H[He],Zj=a.getRowDefinition(kc.row),
      rn=a.getColumnDefinition(kc.column),gg=kc.measuredBounds,xb=kc.margin,hg=xb.right+xb.left,ak=xb.top+xb.bottom;L[kc.column]=0===rn.actual&&void 0!==L[kc.column]?Math.max(gg.width+hg,L[kc.column]):null;K[kc.row]=0===Zj.actual&&void 0!==K[kc.row]?Math.max(gg.height+ak,K[kc.row]):null}var wi=0,ig=0,Bf;for(Bf in K)"count"!==Bf&&(wi+=K[Bf]);for(Bf in L)"count"!==Bf&&(ig+=L[Bf]);for(var ab=M.alloc(),jg=0;jg<h;jg++){var lc=H[jg];if(lc.visible||lc===Xb){var Fc=a.getRowDefinition(lc.row),bb=a.getColumnDefinition(lc.column),
      Bd=0;isFinite(bb.width)?Bd=bb.width:(isFinite(V)&&null!==L[lc.column]?0===ig?Bd=bb.actual+V:Bd=L[lc.column]/ig*ge:null!==L[lc.column]?Bd=V:Bd=bb.actual||V,Bd=Math.max(0,Bd-bb.uc()));var Cd=0;isFinite(Fc.height)?Cd=Fc.height:(isFinite(Q)&&null!==K[lc.row]?0===wi?Cd=Fc.actual+Q:Cd=K[lc.row]/wi*vi:null!==K[lc.row]?Cd=Q:Cd=Fc.actual||Q,Cd=Math.max(0,Cd-Fc.uc()));ab.h(Math.max(bb.minimum,Math.min(Bd,bb.maximum)),Math.max(Fc.minimum,Math.min(Cd,Fc.maximum)));Fb=Fl(lc,Fc,bb,!1);switch(Fb){case Yk:ab.height=
      Math.max(ab.height,Fc.actual+Q);break;case Zk:ab.width=Math.max(ab.width,bb.actual+V)}var Od=lc.margin,sn=Od.right+Od.left,mh=Od.top+Od.bottom;lc.om();lc.measure(ab.width,ab.height,bb.minimum,Fc.minimum);var nh=lc.measuredBounds,oh=Math.max(nh.width+sn,0),ph=Math.max(nh.height+mh,0);isFinite(V)&&(oh=Math.min(oh,ab.width));isFinite(Q)&&(ph=Math.min(ph,ab.height));var kg=0;kg=Fc.actual;Fc.actual=Math.max(Fc.actual,ph);ib=Fc.actual-kg;Q=Math.max(Q-ib,0);kg=bb.actual;bb.actual=Math.max(bb.actual,oh);
      ib=bb.actual-kg;V=Math.max(V-ib,0)}}Ha(H);var Dd=M.alloc(),Xc=Fa(),he=Fa();h=C.length;if(0!==h)for(var yb=0;yb<Ma;yb++)if(w[yb]){hb=w[yb].length;var xi=a.getRowDefinition(yb);Xc[yb]=xi.actual;for(var Yc=0;Yc<hb;Yc++)if(w[yb][Yc]){var tn=a.getColumnDefinition(Yc);he[Yc]=tn.actual}}for(var ie=0;ie<h;ie++){var Na=C[ie];if(Na.visible||Na===Xb){var Ed=a.getRowDefinition(Na.row),mc=a.getColumnDefinition(Na.column);ab.h(Math.max(mc.minimum,Math.min(b,mc.maximum)),Math.max(Ed.minimum,Math.min(c,Ed.maximum)));
      Fb=Fl(Na,Ed,mc,!1);switch(Fb){case ud:0!==he[mc.index]&&(ab.width=Math.min(ab.width,he[mc.index]));0!==Xc[Ed.index]&&(ab.height=Math.min(ab.height,Xc[Ed.index]));break;case Yk:0!==he[mc.index]&&(ab.width=Math.min(ab.width,he[mc.index]));break;case Zk:0!==Xc[Ed.index]&&(ab.height=Math.min(ab.height,Xc[Ed.index]))}isFinite(mc.width)&&(ab.width=mc.width);isFinite(Ed.height)&&(ab.height=Ed.height);Dd.h(0,0);for(var je=1;je<Na.rowSpan&&!(Na.row+je>=a.rowCount);je++)O=a.getRowDefinition(Na.row+je),ib=0,
        ib=Fb===ud||Fb===Zk?Math.max(O.minimum,0===Xc[Na.row+je]?O.maximum:Math.min(Xc[Na.row+je],O.maximum)):Math.max(O.minimum,isNaN(O.Pc)?O.maximum:Math.min(O.Pc,O.maximum)),Dd.height+=ib;for(var ke=1;ke<Na.columnSpan&&!(Na.column+ke>=a.columnCount);ke++)O=a.getColumnDefinition(Na.column+ke),ib=0,ib=Fb===ud||Fb===Yk?Math.max(O.minimum,0===he[Na.column+ke]?O.maximum:Math.min(he[Na.column+ke],O.maximum)):Math.max(O.minimum,isNaN(O.Pc)?O.maximum:Math.min(O.Pc,O.maximum)),Dd.width+=ib;ab.width+=Dd.width;ab.height+=
        Dd.height;var qh=Na.margin,rh=qh.right+qh.left,Pd=qh.top+qh.bottom;Na.measure(ab.width,ab.height,f,g);for(var le=Na.measuredBounds,Ie=Math.max(le.width+rh,0),Je=Math.max(le.height+Pd,0),me=0,nd=0;nd<Na.rowSpan&&!(Na.row+nd>=a.rowCount);nd++)O=a.getRowDefinition(Na.row+nd),me+=O.total||0;if(me<Je){var Cf=Je-me,lg=Je-me;if(null!==Na.spanAllocation)for(var un=Na.spanAllocation,sh=0;sh<Na.rowSpan&&!(0>=Cf)&&!(Na.row+sh>=a.rowCount);sh++){O=a.getRowDefinition(Na.row+sh);var Fd=O.ha||0,yi=un(Na,O,lg);O.actual=
        Math.min(O.maximum,Fd+yi);O.ha!==Fd&&(Cf-=O.ha-Fd)}for(;0<Cf;){var th=O.ha||0;isNaN(O.height)&&O.maximum>th&&(O.actual=Math.min(O.maximum,th+Cf),O.ha!==th&&(Cf-=O.ha-th));if(0===O.index)break;O=a.getRowDefinition(O.index-1)}}for(var uh=0,bk=0;bk<Na.columnSpan&&!(Na.column+bk>=a.columnCount);bk++)O=a.getColumnDefinition(Na.column+bk),uh+=O.total||0;if(uh<Ie){var zi=Ie-uh,Lt=Ie-uh;if(null!==Na.spanAllocation)for(var Mt=Na.spanAllocation,ck=0;ck<Na.columnSpan&&!(0>=zi)&&!(Na.column+ck>=a.columnCount);ck++){O=
        a.getColumnDefinition(Na.column+ck);var vn=O.ha||0,Nt=Mt(Na,O,Lt);O.actual=Math.min(O.maximum,vn+Nt);O.ha!==vn&&(zi-=O.ha-vn)}for(;0<zi;){var dk=O.ha||0;isNaN(O.width)&&O.maximum>dk&&(O.actual=Math.min(O.maximum,dk+zi),O.ha!==dk&&(zi-=O.ha-dk));if(0===O.index)break;O=a.getColumnDefinition(O.index-1)}}}}Ha(C);M.free(Dd);M.free(ab);void 0!==Xc&&Ha(Xc);void 0!==he&&Ha(he);var mg=0,ng=0,ek=a.desiredSize,jr=a.maxSize;Fb=ml(a,!0);var Ai=Oc=Yb=0,Bi=0;h=a.columnCount;for(var fk=0;fk<h;fk++)void 0!==a.mb[fk]&&
    (O=a.getColumnDefinition(fk),isFinite(O.width)?(Ai+=O.width,Ai+=O.uc()):Gm(O)===Hm?(Ai+=O.ha,Ai+=O.uc()):0!==O.ha&&(Yb+=O.ha,Yb+=O.uc()));isFinite(ek.width)?mg=Math.min(ek.width,jr.width):mg=Fb!==xg&&isFinite(b)?b:Yb;mg=Math.max(mg,a.minSize.width);mg=Math.max(mg-Ai,0);for(var Ot=0===Yb?1:Math.max(mg/Yb,1),hk=0;hk<h;hk++)void 0!==a.mb[hk]&&(O=a.getColumnDefinition(hk),isFinite(O.width)||Gm(O)===Hm||(O.actual=O.ha*Ot),O.position=e.width,0!==O.ha&&(e.width+=O.ha,e.width+=O.uc()));h=a.rowCount;for(var ik=
      0;ik<h;ik++)void 0!==a.rb[ik]&&(O=a.getRowDefinition(ik),isFinite(O.height)?(Bi+=O.height,Bi+=O.uc()):Gm(O)===Hm?(Bi+=O.ha,Bi+=O.uc()):0!==O.ha&&(Oc+=O.ha,0!==O.ha&&(Oc+=O.uc())));isFinite(ek.height)?ng=Math.min(ek.height,jr.height):ng=Fb!==xg&&isFinite(c)?c:Oc;ng=Math.max(ng,a.minSize.height);ng=Math.max(ng-Bi,0);for(var Pt=0===Oc?1:Math.max(ng/Oc,1),jk=0;jk<h;jk++)void 0!==a.rb[jk]&&(O=a.getRowDefinition(jk),isFinite(O.height)||Gm(O)===Hm||(O.actual=O.ha*Pt),O.position=e.height,0!==O.ha&&(e.height+=
      O.ha,0!==O.ha&&(e.height+=O.uc())));h=l.length;for(var wn=0;wn<h;wn++){var od=l[wn],xn=0,yn=0;od.type===X.TableRow?(xn=e.width,O=a.getRowDefinition(od.row),yn=O.actual):(O=a.getColumnDefinition(od.column),xn=O.actual,yn=e.height);od.measuredBounds.h(0,0,xn,yn);oj(od,!1);w[od.row]||(w[od.row]=[]);w[od.row][od.column]||(w[od.row][od.column]=[]);w[od.row][od.column].push(od)}Ha(l);a.rp=w};
    Fm.prototype.arrange=function(a,b,c){var d=b.length,e=a.padding,f=e.left;e=e.top;for(var g=a.rp,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.rb[n]||0===a.rb[n].ha);)n++;n=Math.min(n,l-1);n=-a.rb[n].position;for(h=Math.min(a.leftIndex,m-1);h!==m&&(void 0===a.mb[h]||0===a.mb[h].ha);)h++;h=Math.min(h,m-1);for(var p=-a.mb[h].position,r=M.alloc(),q=0;q<l;q++)if(g[q]){m=g[q].length;var u=a.getRowDefinition(q);k=u.position+n+e;0!==u.ha&&
    (k+=u.lv());for(var v=0;v<m;v++)if(g[q][v]){var w=a.getColumnDefinition(v);h=w.position+p+f;0!==w.ha&&(h+=w.lv());for(var y=g[q][v],z=y.length,A=0;A<z;A++){var C=y[A],H=C.measuredBounds,L=C instanceof X?C:null;if(null===L||L.type!==X.TableRow&&L.type!==X.TableColumn){r.h(0,0);for(var K=1;K<C.rowSpan&&!(q+K>=a.rowCount);K++)L=a.getRowDefinition(q+K),r.height+=L.total;for(K=1;K<C.columnSpan&&!(v+K>=a.columnCount);K++)L=a.getColumnDefinition(v+K),r.width+=L.total;var V=w.ha+r.width,Q=u.ha+r.height;K=
      h;L=k;var ca=V,pa=Q,O=h,xa=k,Ma=V,hb=Q;h+V>c.width&&(Ma=Math.max(c.width-h,0));k+Q>c.height&&(hb=Math.max(c.height-k,0));var Ea=C.alignment;if(Ea.Mb()){Ea=a.defaultAlignment;Ea.eb()||(Ea=Ac);var wb=Ea.x;var zd=Ea.y;var ib=Ea.offsetX;Ea=Ea.offsetY;var Xb=w.alignment,$a=u.alignment;Xb.eb()&&(wb=Xb.x,ib=Xb.offsetX);$a.eb()&&(zd=$a.y,Ea=$a.offsetY)}else wb=Ea.x,zd=Ea.y,ib=Ea.offsetX,Ea=Ea.offsetY;if(isNaN(wb)||isNaN(zd))zd=wb=.5,Ea=ib=0;Xb=H.width;$a=H.height;var Md=C.margin,xc=Md.left+Md.right,yf=Md.top+
      Md.bottom,Ye=Fl(C,u,w,!1);!isNaN(C.desiredSize.width)||Ye!==ud&&Ye!==Yk||(Xb=Math.max(V-xc,0));!isNaN(C.desiredSize.height)||Ye!==ud&&Ye!==Zk||($a=Math.max(Q-yf,0));V=C.maxSize;Q=C.minSize;Xb=Math.min(V.width,Xb);$a=Math.min(V.height,$a);Xb=Math.max(Q.width,Xb);$a=Math.max(Q.height,$a);V=$a+yf;K+=ca*wb-(Xb+xc)*wb+ib+Md.left;L+=pa*zd-V*zd+Ea+Md.top;C.visible&&(fc(O,xa,Ma,hb,K,L,H.width,H.height)?C.arrange(K,L,Xb,$a):C.arrange(K,L,Xb,$a,new N(O,xa,Ma,hb)))}else C.ml(),C.actualBounds.ea(),ca=C.actualBounds,
      K=N.allocAt(ca.x,ca.y,ca.width,ca.height),ca.x=L.type===X.TableRow?f:h,ca.y=L.type===X.TableColumn?e:k,ca.width=H.width,ca.height=H.height,C.actualBounds.freeze(),nl(C,!1),$b(K,ca)||(H=C.part,null!==H&&(H.Hh(),C.To(H))),N.free(K)}}}M.free(r);for(a=0;a<d;a++)c=b[a],f=c instanceof X?c:null,null===f||f.type!==X.TableRow&&f.type!==X.TableColumn||(f=c.actualBounds,c.naturalBounds.ea(),c.naturalBounds.h(0,0,f.width,f.height),c.naturalBounds.freeze())};
    function Im(){this.name="Base";this.name="TableRow"}la(Im,Ql);Im.prototype.measure=function(){};Im.prototype.arrange=function(){};function Jm(){this.name="Base";this.name="TableColumn"}la(Jm,Ql);Jm.prototype.measure=function(){};Jm.prototype.arrange=function(){};function Km(){this.name="Base";this.name="Viewbox"}la(Km,Ql);
    Km.prototype.measure=function(a,b,c,d,e,f,g){1<d.length&&B("Viewbox Panel cannot contain more than one GraphObject.");d=d[0];d.ya=1;d.om();d.measure(Infinity,Infinity,f,g);var h=d.measuredBounds,k=d.margin,l=k.right+k.left;k=k.top+k.bottom;if(isFinite(b)||isFinite(c)){var m=d.scale,n=h.width;h=h.height;var p=Math.max(b-l,0),r=Math.max(c-k,0),q=1;a.viewboxStretch===zg?0!==n&&0!==h&&(q=Math.min(p/n,r/h)):0!==n&&0!==h&&(q=Math.max(p/n,r/h));0===q&&(q=1E-4);d.ya*=q;m!==d.scale&&(oj(d,!0),d.measure(Infinity,
      Infinity,f,g))}h=d.measuredBounds;e.width=isFinite(b)?b:Math.max(h.width+l,0);e.height=isFinite(c)?c:Math.max(h.height+k,0)};Km.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.eb()||(g=Ac);b.arrange(c.width*g.x-f*g.x+g.offsetX,c.height*g.y-e*g.y+g.offsetY,d.width,d.height)};function Lm(){this.name="Base";this.name="Grid"}la(Lm,Ql);
    Lm.prototype.measure=function(){};Lm.prototype.arrange=function(){};
    Lm.prototype.bc=function(a,b,c){c=a.vf()*c.scale;0>=c&&(c=1);var d=a.gridCellSize,e=d.width;d=d.height;var f=a.naturalBounds,g=a.actualBounds,h=f.width,k=f.height,l=Math.ceil(h/e),m=Math.ceil(k/d),n=a.gridOrigin;b.save();b.beginPath();b.rect(0,0,h,k);b.clip();for(var p=[],r=a.W.j,q=r.length,u=0;u<q;u++){var v=r[u],w=[];p.push(w);if(v.visible){var y=v.interval;if(!(0>y)){v=Wj(v.figure);for(var z=0;z<q;z++)if(z!==u){var A=r[z];A.visible&&Wj(A.figure)===v&&(A=A.interval,A>y&&w.push(A))}}}}r=a.W.j;q=
      r.length;for(u=0;u<q;u++){var C=r[u];if(C.visible&&(w=C.interval,!(2>e*Math.abs(w)*c))){y=C.opacity;v=1;if(1!==y){if(0===y)continue;v=b.globalAlpha;b.globalAlpha=v*y}z=p[u];A=!1;var H=C.strokeDashArray;null!==H&&(A=!0,b.it(H,C.strokeDashOffset));if("LineV"===C.figure&&null!==C.stroke&&0<C.strokeWidth){b.lineWidth=C.strokeWidth;ki(a,b,C.stroke,!1,!1,f,g);b.beginPath();for(H=C=Math.floor(-n.x/e);H<=C+l;H++){var L=H*e+n.x;0<=L&&L<=h&&Mm(H,w,z)&&(b.moveTo(L,0),b.lineTo(L,k))}b.stroke()}else if("LineH"===
      C.figure&&null!==C.stroke&&0<C.strokeWidth){b.lineWidth=C.strokeWidth;ki(a,b,C.stroke,!1,!1,f,g);b.beginPath();for(H=C=Math.floor(-n.y/d);H<=C+m;H++)L=H*d+n.y,0<=L&&L<=k&&Mm(H,w,z)&&(b.moveTo(0,L),b.lineTo(h,L));b.stroke()}else if("BarV"===C.figure&&null!==C.fill)for(ki(a,b,C.fill,!0,!1,f,g),C=C.width,isNaN(C)&&(C=e),L=H=Math.floor(-n.x/e);L<=H+l;L++){var K=L*e+n.x;0<=K&&K<=h&&Mm(L,w,z)&&b.fillRect(K,0,C,k)}else if("BarH"===C.figure&&null!==C.fill)for(ki(a,b,C.fill,!0,!1,f,g),C=C.height,isNaN(C)&&
    (C=d),L=H=Math.floor(-n.y/d);L<=H+m;L++)K=L*d+n.y,0<=K&&K<=k&&Mm(L,w,z)&&b.fillRect(0,K,h,C);A&&b.gt();1!==y&&(b.globalAlpha=v)}}b.restore();b.sc(!1)};function Mm(a,b,c){if(0>b)return 0===a%b;if(0!==a%b)return!1;b=c.length;for(var d=0;d<b;d++)if(0===a%c[d])return!1;return!0}function Nm(){this.name="Base";this.name="Link"}la(Nm,Ql);
    Nm.prototype.measure=function(a,b,c,d,e){c=d.length;if(a instanceof Ke||a instanceof S){var f=null,g=null,h=null;a instanceof S&&(g=f=a);a instanceof Ke&&(h=a,f=h.adornedPart);if(f instanceof S){var k=f;if(0===c)Vb(a.naturalBounds,0,0),a.measuredBounds.h(0,0,0,0);else{var l=a instanceof Ke?null:f.path,m=f.routeBounds;b=a.tg;b.h(0,0,m.width,m.height);var n=k.points;f=f.pointsCount;null!==h?h.nk(!1):null!==g&&g.nk(!1);var p=m.width,r=m.height;a.location.h(m.x,m.y);a.l.length=0;null!==l&&(Om(a,p,r,l),
      h=l.measuredBounds,b.Hc(h),a.l.push(h));h=qd.alloc();for(var q=I.alloc(),u=I.alloc(),v=0;v<c;v++){var w=d[v];if(w!==l)if(w.isPanelMain&&w instanceof Kf){Om(a,p,r,w);var y=w.measuredBounds;b.Hc(y);a.l.push(y)}else if(2>f)w.measure(Infinity,Infinity,0,0),y=w.measuredBounds,b.Hc(y),a.l.push(y);else{var z=w.segmentIndex,A=w.segmentFraction,C=w.alignmentFocus;C.jc()&&(C=Ac);var H=w.segmentOrientation,L=w.segmentOffset;if(isNaN(z)){var K=k.ka;y=Fa();K.Cv(A,y);var V=I.allocAt(y[0],y[1]);V.add(k.i(0));K.type===
    vd?V.offset(-K.startX,-K.startY):(K=K.figures.first(),V.offset(-K.startX,-K.startY));K=y[2];if(H!==ag){var Q=k.computeAngle(w,H,K);w.Yb=Q}Q=V.x-m.x;var ca=V.y-m.y;I.free(V);Ha(y)}else if(z<-f||z>=f)ca=k.midPoint,K=k.midAngle,H!==ag&&(Q=k.computeAngle(w,H,K),w.Yb=Q),Q=ca.x-m.x,ca=ca.y-m.y;else{Q=0;0<=z?(ca=n.L(z),y=z<f-1?n.L(z+1):ca):(Q=f+z,ca=n.L(Q),y=0<Q?n.L(Q-1):ca);if(ca.Ma(y)){0<=z?(K=0<z?n.L(z-1):ca,Q=z<f-2?n.L(z+2):y):(K=Q<f-1?n.L(Q+1):ca,Q=1<Q?n.L(Q-2):y);V=K.Be(ca);var pa=y.Be(Q);K=V>pa+10?
      0<=z?K.Sa(ca):ca.Sa(K):pa>V+10?0<=z?y.Sa(Q):Q.Sa(y):0<=z?K.Sa(Q):Q.Sa(K)}else K=0<=z?ca.Sa(y):y.Sa(ca);H!==ag&&(Q=k.computeAngle(w,H,K),w.Yb=Q);Q=ca.x+(y.x-ca.x)*A-m.x;ca=ca.y+(y.y-ca.y)*A-m.y}w.measure(Infinity,Infinity,0,0);y=w.measuredBounds;V=w.naturalBounds;var O=0;w instanceof Kf&&(O=w.strokeWidth);pa=V.width+O;var xa=V.height+O;h.reset();h.translate(-y.x,-y.y);h.scale(w.scale,w.scale);h.rotate(H===ag?w.angle:K,pa/2,xa/2);H!==Pm&&H!==Qm||h.rotate(90,pa/2,xa/2);H!==Rm&&H!==Sm||h.rotate(-90,pa/
      2,xa/2);H===Tm&&(45<K&&135>K||225<K&&315>K)&&h.rotate(-K,pa/2,xa/2);V=new N(0,0,pa,xa);q.dj(V,C);h.ra(q);C=-q.x+O/2*w.scale;w=-q.y+O/2*w.scale;u.assign(L);O=isNaN(L.x);var Ma=isNaN(L.y);if(O||Ma){pa=pa/2+3;xa=xa/2+3;var hb=45<=K&&135>=K,Ea=225<=K&&315>=K;H===ag&&(hb||Ea)?(u.x=Ma?pa:L.y,u.y=O?xa:L.x,hb?0<=z||isNaN(z)&&.5>A||!O||(u.y=-xa):Ea&&((0<=z||isNaN(z)&&.5>A)&&O&&(u.y=-xa),Ma&&(u.x=-pa))):(O&&(u.x=0<=z||isNaN(z)&&.5>A?pa:-pa),Ma&&(u.y=-xa),u.rotate(K))}else u.rotate(K);Q+=u.x;ca+=u.y;V.set(y);
      V.h(Q+C,ca+w,y.width,y.height);a.l.push(V);b.Hc(V)}}if(null!==g)for(d=g.labelNodes;d.next();)d.value.measure(Infinity,Infinity);a.tg=b;a=a.location;a.h(a.x+b.x,a.y+b.y);Vb(e,b.width||0,b.height||0);qd.free(h);I.free(q);I.free(u)}}}};
    Nm.prototype.arrange=function(a,b){var c=b.length;if(a instanceof Ke||a instanceof S){var d=null,e=null,f=null;a instanceof S&&(e=d=a);a instanceof Ke&&(f=a,d=f.adornedPart);var g=a instanceof Ke?null:d.path;if(0!==a.l.length){var h=a.l,k=0;if(null!==g&&k<a.l.length){var l=h[k];k++;g.arrange(l.x-a.tg.x,l.y-a.tg.y,l.width,l.height)}for(l=0;l<c;l++){var m=b[l];if(m!==g&&k<a.l.length){var n=h[k];k++;m.arrange(n.x-a.tg.x,n.y-a.tg.y,n.width,n.height)}}}b=d.points;c=b.count;if(2<=c&&a instanceof S)for(d=
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           a.labelNodes;d.next();){var p=a;g=d.value;h=g.segmentIndex;k=g.segmentFraction;var r=g.alignmentFocus;l=g.segmentOrientation;m=g.segmentOffset;if(isNaN(h)){n=p.ka;var q=Fa();n.Cv(k,q);var u=I.allocAt(q[0],q[1]);u.add(p.i(0));n.type===vd?u.offset(-n.startX,-n.startY):(n=n.figures.first(),u.offset(-n.startX,-n.startY));n=q[2];l!==ag&&(p=p.computeAngle(g,l,n),g.angle=p);p=u.x;var v=u.y;I.free(u);Ha(q)}else if(h<-c||h>=c)v=p.midPoint,n=p.midAngle,l!==ag&&(p=p.computeAngle(g,l,n),g.angle=p),p=v.x,v=v.y;
    else{u=0;0<=h?(q=b.j[h],v=h<c-1?b.j[h+1]:q):(u=c+h,q=b.j[u],v=0<u?b.j[u-1]:q);if(q.Ma(v)){0<=h?(n=0<h?b.j[h-1]:q,u=h<c-2?b.j[h+2]:v):(n=u<c-1?b.j[u+1]:q,u=1<u?b.j[u-2]:v);var w=n.Be(q),y=v.Be(u);n=w>y+10?0<=h?n.Sa(q):q.Sa(n):y>w+10?0<=h?v.Sa(u):u.Sa(v):0<=h?n.Sa(u):u.Sa(n)}else n=0<=h?q.Sa(v):v.Sa(q);l!==ag&&(p=p.computeAngle(g,l,n),g.angle=p);p=q.x+(v.x-q.x)*k;v=q.y+(v.y-q.y)*k}if(r.xt())g.location=new I(p,v);else{r.jc()&&(r=Ac);q=qd.alloc();q.reset();q.scale(g.scale,g.scale);q.rotate(g.angle,0,
      0);var z=g.naturalBounds;u=N.allocAt(0,0,z.width,z.height);w=I.alloc();w.dj(u,r);q.ra(w);r=-w.x;y=-w.y;var A=z.width,C=z.height;z=I.alloc();z.assign(m);var H=isNaN(m.x),L=isNaN(m.y);if(H||L){A=A/2+3;C=C/2+3;var K=45<=n&&135>=n,V=225<=n&&315>=n;l===ag&&(K||V)?(z.x=L?A:m.y,z.y=H?C:m.x,K?0<=h||isNaN(h)&&.5>k||!H||(z.y=-C):V&&((0<=h||isNaN(h)&&.5>k)&&H&&(z.y=-C),L&&(z.x=-A))):(H&&(z.x=0<=h||isNaN(h)&&.5>k?A:-A),L&&(z.y=-C),z.rotate(n))}else z.rotate(n);p+=z.x;v+=z.y;q.sw(u);r+=u.x;y+=u.y;h=I.allocAt(p+
      r,v+y);g.move(h);I.free(h);I.free(z);I.free(w);N.free(u);qd.free(q)}}null!==f?f.nk(!1):null!==e&&e.nk(!1)}};
    function Om(a,b,c,d){if(!1!==tj(d)){var e=d.strokeWidth;0===e&&a instanceof Ke&&a.type===X.Link&&a.adornedObject instanceof Kf&&(e=a.adornedObject.strokeWidth);e*=d.ya;a instanceof S&&null!==a.ka?(a=a.ka.bounds,jl(d,a.x-e/2,a.y-e/2,a.width+e,a.height+e)):a instanceof Ke&&null!==a.adornedPart.ka?(a=a.adornedPart.ka.bounds,jl(d,a.x-e/2,a.y-e/2,a.width+e,a.height+e)):jl(d,-(e/2),-(e/2),b+e,c+e);oj(d,!1)}}function Um(){this.name="Base";this.name="Graduated"}la(Um,Ql);
    Um.prototype.measure=function(a,b,c,d,e,f,g){var h=a.zb();a.Xg=[];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.Xg.push(p);e.assign(p);for(var r=h.geometry,q=h.strokeWidth,u=r.flattenedSegments,v=r.flattenedLengths,w=r.flattenedTotalLength,y=u.length,z=0,A=0,C=Fa(),H=0;H<y;H++){var L=u[H],K=[];A=z=0;for(var V=L.length,Q=0;Q<V;Q+=2){var ca=L[Q],pa=L[Q+1];if(0!==Q){var O=180*Math.atan2(pa-
      A,ca-z)/Math.PI;0>O&&(O+=360);K.push(O)}z=ca;A=pa}C.push(K)}if(null===a.Yg){for(var xa=[],Ma=a.W.j,hb=Ma.length,Ea=0;Ea<hb;Ea++){var wb=Ma[Ea],zd=[];xa.push(zd);if(wb.visible){var ib=wb.interval;if(!(0>ib))for(var Xb=0;Xb<hb;Xb++)if(Xb!==Ea){var $a=Ma[Xb];if($a.visible&&wb.constructor===$a.constructor){var Md=$a.interval;Md>ib&&zd.push(Md)}}}}a.Yg=xa}var xc=a.Yg;var yf=a.W.j,Ye=yf.length,Ge=0,jh=0,Ec=w;a.uj=[];for(var zf,Ze=0;Ze<Ye;Ze++){var Nd=yf[Ze];zf=[];if(Nd.visible&&Nd!==h){var Xj=Math.abs(Nd.interval),
      Fb=a.graduatedTickUnit;if(!(2>Fb*Xj*w/a.graduatedRange)){var Af=v[0][0],Ad=0,jc=0;jh=w*Nd.graduatedStart-1E-4;Ec=w*Nd.graduatedEnd+1E-4;var $e=Fb*Xj,Wc=a.graduatedTickBase;if(Wc<a.graduatedMin){var dg=(a.graduatedMin-Wc)/$e;dg=0===dg%1?dg:Math.floor(dg+1);Wc+=dg*$e}else Wc>a.graduatedMin+$e&&(Wc-=Math.floor((Wc-a.graduatedMin)/$e)*$e);for(var kh=xc[Ze];Wc<=a.graduatedMax;){a:{for(var qn=kh.length,eg=0;eg<qn;eg++)if(J.$((Wc-a.graduatedTickBase)%(kh[eg]*a.graduatedTickUnit),0)){var Yj=!1;break a}Yj=
      !0}if(Yj&&(null===Nd.graduatedSkip||!Nd.graduatedSkip(Wc))&&(Ge=(Wc-a.graduatedMin)*w/a.graduatedRange,Ge>w&&(Ge=w),jh<=Ge&&Ge<=Ec)){for(var Yb=C[Ad][jc],Oc=v[Ad][jc];Ad<v.length;){for(;Ge>Af&&jc<v[Ad].length-1;)jc++,Yb=C[Ad][jc],Oc=v[Ad][jc],Af+=Oc;if(Ge<=Af)break;Ad++;jc=0;Yb=C[Ad][jc];Oc=v[Ad][jc];Af+=Oc}var cc=u[Ad],fg=cc[2*jc],lh=cc[2*jc+1],af=(Ge-(Af-Oc))/Oc,vi=new I(fg+(cc[2*jc+2]-fg)*af+q/2-r.bounds.x,lh+(cc[2*jc+3]-lh)*af+q/2-r.bounds.y);vi.scale(h.scale,h.scale);var ge=Yb,He=C[Ad];1E-4>
    af?0<jc?ge=He[jc-1]:J.$(cc[0],cc[cc.length-2])&&J.$(cc[1],cc[cc.length-1])&&(ge=He[He.length-1]):.9999<af&&(jc+1<He.length?ge=He[jc+1]:J.$(cc[0],cc[cc.length-2])&&J.$(cc[1],cc[cc.length-1])&&(ge=He[0]));Yb!==ge&&(180<Math.abs(Yb-ge)&&(Yb<ge?Yb+=360:ge+=360),Yb=(Yb+ge)/2%360);if(Nd instanceof Ug){var kc="";null!==Nd.graduatedFunction?(kc=Nd.graduatedFunction(Wc),kc=null!==kc&&void 0!==kc?kc.toString():""):kc=(+Wc.toFixed(2)).toString();""!==kc&&zf.push({xm:vi,angle:Yb,text:kc})}else zf.push({xm:vi,
      angle:Yb})}Wc+=$e}}}a.uj.push(zf)}Ha(C);var Zj=a.uj;if(null!==Zj)for(var rn=d.length,gg=0;gg<rn;gg++){var xb=d[gg],hg=Zj[gg];if(xb.visible&&xb!==h&&0!==hg.length){if(xb instanceof Kf){var ak=a,wi=e,ig=xb.alignmentFocus;ig.jc()&&(ig=wc);var Bf=xb.angle;xb.Yb=0;xb.measure(Infinity,Infinity,0,0);xb.Yb=Bf;var ab=xb.measuredBounds,jg=ab.width,lc=ab.height,Fc=N.allocAt(0,0,jg,lc),bb=I.alloc();bb.dj(Fc,ig);N.free(Fc);for(var Bd=-bb.x,Cd=-bb.y,Od=new N,sn=hg.length,mh=0;mh<sn;mh++)for(var nh=hg[mh],oh=nh.xm.x,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ph=nh.xm.y,kg=nh.angle,Dd=0;4>Dd;Dd++){switch(Dd){case 0:bb.h(Bd,Cd);break;case 1:bb.h(Bd+jg,Cd);break;case 2:bb.h(Bd,Cd+lc);break;case 3:bb.h(Bd+jg,Cd+lc)}bb.rotate(kg+xb.angle);bb.offset(oh,ph);0===mh&&0===Dd?Od.h(bb.x,bb.y,0,0):Od.Ie(bb);bb.offset(-oh,-ph);bb.rotate(-kg-xb.angle)}I.free(bb);null!==ak.Xg&&ak.Xg.push(Od);ec(wi,Od.x,Od.y,Od.width,Od.height)}else if(xb instanceof Ug){var Xc=a,he=e;null===Xc.th&&(Xc.th=new Ug);var yb=Xc.th;Vm(yb,xb);var xi=xb.alignmentFocus;xi.jc()&&(xi=wc);for(var Yc=
      xb.segmentOrientation,tn=xb.segmentOffset,ie=new N,Na=0,Ed=0,mc=0,je=0,ke=0,qh=hg.length,rh=0;rh<qh;rh++){var Pd=hg[rh];Na=Pd.xm.x;Ed=Pd.xm.y;mc=Pd.angle;ke=je=xb.angle;Yc!==ag&&(ke=Yc===Wm||Yc===Xm?mc+xb.angle:mc,je=S.computeAngle(Yc,ke));yb.Yb=je;yb.text=Pd.text||"";yb.measure(Infinity,Infinity,0,0);var le=yb.measuredBounds,Ie=yb.naturalBounds,Je=Ie.width,me=Ie.height,nd=qd.alloc();nd.reset();nd.translate(-le.x,-le.y);nd.scale(yb.scale,yb.scale);nd.rotate(ke,Je/2,me/2);Yc!==Pm&&Yc!==Qm||nd.rotate(90,
      Je/2,me/2);Yc!==Rm&&Yc!==Sm||nd.rotate(-90,Je/2,me/2);Yc===Tm&&(45<mc&&135>mc||225<mc&&315>mc)&&nd.rotate(-mc,Je/2,me/2);var Cf=N.allocAt(0,0,Je,me),lg=I.alloc();lg.dj(Cf,xi);nd.ra(lg);var un=-lg.x,sh=-lg.y,Fd=I.alloc();Fd.assign(tn);isNaN(Fd.x)&&(Fd.x=Je/2+3);isNaN(Fd.y)&&(Fd.y=-(me/2+3));Fd.rotate(mc);Na+=Fd.x+un;Ed+=Fd.y+sh;var yi=new N(Na,Ed,le.width,le.height),th=new N(le.x,le.y,le.width,le.height),uh=new N(Ie.x,Ie.y,Ie.width,Ie.height);Pd.aA=je;Pd.lineCount=yb.lineCount;Pd.lines=[yb.pb,yb.ti,
      yb.he,yb.ue,yb.Qb,yb.fb,yb.fe];Pd.actualBounds=yi;Pd.measuredBounds=th;Pd.naturalBounds=uh;0===rh?ie.assign(yi):ie.Hc(yi);I.free(Fd);I.free(lg);N.free(Cf);qd.free(nd)}null!==Xc.Xg&&Xc.Xg.push(ie);ec(he,ie.x,ie.y,ie.width,ie.height)}oj(xb,!1)}}};
    Um.prototype.arrange=function(a,b,c){if(null!==a.Xg){var d=a.zb(),e=a.uj;if(null!==e){var f=a.Xg,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.Xg=null}}};
    Um.prototype.bc=function(a,b,c){var d=c.ni;c.ni=!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.zb();f.bc(b,c);e=a.vf()*c.scale;0>=e&&(e=1);for(var g=f.actualBounds,h=a.W.j,k=a.uj,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 Kf){if(!(2>a.graduatedTickUnit*n.interval*f.geometry.flattenedTotalLength/a.graduatedRange*e)){var q=n.measuredBounds,u=n.strokeWidth*n.scale,v=n.alignmentFocus;v.jc()&&
    (v=wc);for(var w=0;w<r;w++){var y=p[w].xm,z=p[w].angle,A=v,C=n.kb;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);Cl(n,!1);n.Qh.set(n.kb);n.Wk=n.scale;Dl(n,!1);n.bc(b,c);n.kb.reset()}}}else if(n instanceof Ug)for(null===a.th&&(a.th=new Ug),q=a.th,Vm(q,n),n=0;n<r;n++)u=p[n],u.actualBounds&&u.measuredBounds&&u.naturalBounds&&(q.Tb=u.text||"",q.Yb=u.aA||0,q.Nc=u.lineCount||0,v=u.lines,void 0!==
    v&&(q.pb=v[0],q.ti=v[1],q.he=v[2],q.ue=v[3],q.Qb=v[4],q.fb=v[5],q.fe=v[6]),u.naturalBounds&&(q.oc=u.naturalBounds),u.actualBounds&&(v=u.actualBounds,q.arrange(v.x,v.y,v.width,v.height)),v=u.actualBounds,q.arrange(v.x,v.y,v.width,v.height),w=u.measuredBounds,u=u.naturalBounds,y=q.kb,y.reset(),y.translate(v.x+g.x,v.y+g.y),y.translate(-w.x,-w.y),kl(q,y,u.x,u.y,u.width,u.height),Cl(q,!1),q.Qh.set(q.kb),q.Wk=q.scale,Dl(q,!1),q.bc(b,c))}c.ni=d;b.restore();b.sc(!0)};
    function X(a){Y.call(this);this.pa=void 0===a?X.Position:a;null===this.pa&&B("Panel type not specified or PanelLayout not loaded: "+a);this.W=new E;this.bb=sc;this.pa===X.Grid&&(this.isAtomic=!0);this.un=$c;this.Of=Xk;this.pa===X.Table&&Ym(this);this.Yp=zg;this.Sn=Pb;this.Tn=Gb;this.Pn=0;this.On=100;this.Rn=10;this.Qn=0;this.ci=this.hb=this.Yg=this.Xg=this.uj=null;this.io=NaN;this.me=this.si=null;this.ql="category";this.Kd=null;this.tg=new N(NaN,NaN,NaN,NaN);this.th=this.rp=this.Hi=null;this.Hg=""}
    la(X,Y);function Ym(a){a.nj=sc;a.Pg=1;a.ii=null;a.hi=null;a.Og=1;a.Ng=null;a.gi=null;a.rb=[];a.mb=[];a.Mj=Zm;a.kj=Zm;a.Ki=0;a.vi=0}
    X.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.pa=this.pa;a.bb=this.bb.G();a.un=this.un.G();a.Of=this.Of;if(a.pa===X.Table){a.nj=this.nj.G();a.Pg=this.Pg;a.ii=this.ii;a.hi=this.hi;a.Og=this.Og;a.Ng=this.Ng;a.gi=this.gi;var b=[];if(0<this.rb.length)for(var c=this.rb,d=c.length,e=0;e<d;e++)if(void 0!==c[e]){var f=c[e].copy();f.cj(a);b[e]=f}a.rb=b;b=[];if(0<this.mb.length)for(c=this.mb,d=c.length,e=0;e<d;e++)void 0!==c[e]&&(f=c[e].copy(),f.cj(a),b[e]=f);a.mb=b;a.Mj=
      this.Mj;a.kj=this.kj;a.Ki=this.Ki;a.vi=this.vi}a.Yp=this.Yp;a.Sn=this.Sn.G();a.Tn=this.Tn.G();a.Pn=this.Pn;a.On=this.On;a.Rn=this.Rn;a.Qn=this.Qn;a.uj=this.uj;a.Yg=this.Yg;a.hb=this.hb;a.ci=this.ci;a.io=this.io;a.si=this.si;a.me=this.me;a.ql=this.ql;a.tg.assign(this.tg);a.Hg=this.Hg;null!==this.rp&&(a.rp=this.rp)};X.prototype.tf=function(a){Y.prototype.tf.call(this,a);a.W=this.W;for(var b=a.W.j,c=b.length,d=0;d<c;d++)b[d].lg=a;a.Hi=null};
    X.prototype.copy=function(){var a=Y.prototype.copy.call(this);if(null!==a){for(var b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d].copy();e.cj(a);e.Jj=null;var f=a.W,g=f.count;f.Kb(g,e);f=a.part;if(null!==f){f.Fj=null;null!==e.portId&&f instanceof W&&(f.Gh=!0);var h=a.diagram;null!==h&&h.undoManager.isUndoingRedoing||f.Ya(we,"elements",a,null,e,null,g)}}return a}return null};t=X.prototype;t.toString=function(){return"Panel("+this.type+")#"+lb(this)};
    t.To=function(a){Y.prototype.To.call(this,a);for(var b=this.W.j,c=b.length,d=0;d<c;d++)b[d].To(a)};
    t.Qi=function(a,b){if(this.pa===X.Grid)this.pa.bc(this,a,b);else if(this.pa===X.Graduated)this.pa.bc(this,a,b);else{this.pa===X.Table&&(a.lineCap="butt",$m(this,a,!0,this.rb,!0),$m(this,a,!1,this.mb,!0),an(this,a,!0,this.rb),an(this,a,!1,this.mb),$m(this,a,!0,this.rb,!1),$m(this,a,!1,this.mb,!1));var c=this.isClipping&&this.pa===X.Spot;c&&a.save();for(var d=this.zb(),e=this.W.j,f=e.length,g=0;g<f;g++){var h=e[g];c&&h===d&&(a.clipInsteadOfFill=!0);h.bc(a,b);c&&h===d&&(a.clipInsteadOfFill=!1)}c&&(a.restore(),
      a.sc(!0))}};
    function an(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.Pg:a.Og);var n=l.separatorStroke;null===n&&(n=c?a.ii:a.Ng);if(0!==m&&null!==n){ki(a,b,n,!1,!1,g,f);n=!1;var p=l.separatorDashArray;null===p&&(p=c?a.hi:a.gi);null!==p&&(n=!0,b.it(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.bb;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.gt()}}}}
    function $m(a,b,c,d,e){for(var f=d.length,g=a.actualBounds,h=a.naturalBounds,k=0;k<f;k++){var l=d[k];if(void 0!==l&&null!==l.background&&l.coversSeparators!==e&&0!==l.actual){var m=c?g.height:g.width;if(!(l.position>m)){var n=l.uc(),p=l.separatorStrokeWidth;isNaN(p)&&(p=c?a.Pg:a.Og);var r=l.separatorStroke;null===r&&(r=c?a.ii:a.Ng);null===r&&(p=0);n-=p;p=l.position+p;n+=l.actual;p+n>m&&(n=m-p);0>=n||(m=a.bb,ki(a,b,l.background,!0,!1,h,g),c?b.fillRect(m.left,p+m.top,g.width-(m.left+m.right),n):b.fillRect(p+
      m.left,m.top,n,g.height-(m.top+m.bottom)))}}}}function Wj(a){return"LineV"===a||"BarV"===a}
    t.hk=function(a,b,c,d,e){var f=this.ae(),g=this.transform,h=1/(g.m11*g.m22-g.m12*g.m21),k=g.m22*h,l=-g.m12*h,m=-g.m21*h,n=g.m11*h,p=h*(g.m21*g.dy-g.m22*g.dx),r=h*(g.m12*g.dx-g.m11*g.dy);if(null!==this.areaBackground)return g=this.actualBounds,J.Uc(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=J.Uc(0,0,c.width,c.height,f,h,a,k,e),e.transform(g),f;f||(k=1,m=l=0,n=1,r=p=0);h=a*k+b*m+p;a=a*l+b*
      n+r;k=c*k+d*m+p;c=c*l+d*n+r;e.h(k,c);d=(k-h)*(k-h)+(c-a)*(c-a);l=!1;n=this.W.j;r=n.length;m=I.alloc();p=null;b=Infinity;var q=null,u=this.isClipping&&this.pa===X.Spot;u&&(q=I.alloc(),p=this.zb(),(l=p.hk(h,a,k,c,q))&&(b=(h-q.x)*(h-q.x)+(a-q.y)*(a-q.y)));for(var v=0;v<r;v++){var w=n[v];w.visible&&w!==p&&w.hk(h,a,k,c,m)&&(l=!0,w=(h-m.x)*(h-m.x)+(a-m.y)*(a-m.y),w<d&&(d=w,e.set(m)))}u&&(b>d&&e.set(q),I.free(q));I.free(m);f&&e.transform(g);return l};
    t.o=function(a){if(!0!==tj(this)){Y.prototype.o.call(this,a);a=null;if(this.pa===X.Auto||this.pa===X.Link)a=this.zb();for(var b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d];(e===a||e.isPanelMain)&&e.o(!0);if(!e.desiredSize.u()){var f=ml(e,!1);(e instanceof vg||e instanceof X||e instanceof Ug||f!==xg)&&e.o(!0)}}}};t.om=function(){if(!1===tj(this)){oj(this,!0);nl(this,!0);for(var a=this.W.j,b=a.length,c=0;c<b;c++)a[c].om()}};
    t.ml=function(){if(0!==(this.F&2048)===!1){Cl(this,!0);Dl(this,!0);for(var a=this.W.j,b=a.length,c=0;c<b;c++)a[c].Iv()}};t.Iv=function(){Dl(this,!0);for(var a=this.W.j,b=a.length,c=0;c<b;c++)a[c].Iv()};
    t.sm=function(a,b,c,d){var e=this.tg;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.bb;a=Math.max(a-k.left-k.right,0);b=Math.max(b-k.top-k.bottom,0);var l=this.W.j;0!==l.length&&this.pa.measure(this,a,b,l,e,c,d);a=e.width+k.left+k.right;k=e.height+k.top+k.bottom;
      isFinite(f.width)&&(a=f.width);isFinite(f.height)&&(k=f.height);a=Math.min(h.width,a);k=Math.min(h.height,k);a=Math.max(g.width,a);k=Math.max(g.height,k);a=Math.max(c,a);k=Math.max(d,k);Vb(e,a,k);Vb(this.naturalBounds,a,k);jl(this,0,0,a,k)};t.zb=function(){if(null===this.Hi){var a=this.W.j,b=a.length;if(0===b)return null;for(var c=0;c<b;c++){var d=a[c];if(!0===d.isPanelMain)return this.Hi=d}this.Hi=a[0]}return this.Hi};function ym(a){return null!==a.part?a.part.locationObject:null}
    t.Dh=function(a,b,c,d){var e=this.W.j;this.actualBounds.h(a,b,c,d);if(0!==e.length){if(!this.desiredSize.u()){a=ml(this,!0);var f=this.measuredBounds;b=f.width;f=f.height;var g=this.dh,h=g.left+g.right;g=g.top+g.bottom;b===c&&f===d&&(a=xg);switch(a){case xg:if(b>c||f>d)this.o(),this.measure(b>c?c:b,f>d?d:f,0,0);break;case ud:this.o(!0);this.measure(c+h,d+g,0,0);break;case Yk:this.o(!0);this.measure(c+h,f+g,0,0);break;case Zk:this.o(!0),this.measure(b+h,d+g,0,0)}}this.pa.arrange(this,e,this.tg)}};
    t.Fh=function(a){var b=this.naturalBounds,c=ym(this);if(fc(0,0,b.width,b.height,a.x,a.y)){b=this.W.j;for(var d=b.length,e=I.allocAt(0,0);d--;){var f=b[d];if(f.visible||f===c)if(Ab(e.set(a),f.transform),f.aa(e))return I.free(e),!0}I.free(e);return null===this.gb&&null===this.dc?!1:!0}return!1};t.jt=function(a){if(this.Jk===a)return this;for(var b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d].jt(a);if(null!==e)return e}return null};
    t.Km=function(a,b){b(this,a);if(a instanceof X){a=a.W.j;for(var c=a.length,d=0;d<c;d++)this.Km(a[d],b)}};function Gj(a,b){bn(a,a,b)}function bn(a,b,c){c(b);b=b.W.j;for(var d=b.length,e=0;e<d;e++){var f=b[e];f instanceof X&&bn(a,f,c)}}function cn(a,b){dn(a,a,b)}function dn(a,b,c){c(b);if(b instanceof X){b=b.W.j;for(var d=b.length,e=0;e<d;e++)dn(a,b[e],c)}}t.hm=function(a){return en(this,this,a)};
    function en(a,b,c){if(c(b))return b;if(b instanceof X){b=b.W.j;for(var d=b.length,e=0;e<d;e++){var f=en(a,b[e],c);if(null!==f)return f}}return null}t.Xa=function(a){if(this.name===a)return this;var b=this.W.j,c=b.length;null===this.si&&null===this.me||(c=fn(this));for(var d=0;d<c;d++){var e=b[d];if(e instanceof X){var f=e.Xa(a);if(null!==f)return f}if(e.name===a)return e}return null};
    function gn(a){a=a.W.j;for(var b=a.length,c=0,d=0;d<b;d++){var e=a[d];if(e instanceof X)c=Math.max(c,gn(e));else if(e instanceof Kf){a:{switch(e.Zk){case "None":case "Square":case "Ellipse":case "Circle":case "LineH":case "LineV":case "FramedRectangle":case "RoundedRectangle":case "Line1":case "Line2":case "Border":case "Cube1":case "Cube2":case "Junction":case "Cylinder1":case "Cylinder2":case "Cylinder3":case "Cylinder4":case "PlusLine":case "XLine":case "ThinCross":case "ThickCross":e=0;break a}e=
      e.rh/2*e.Oj*e.vf()}c=Math.max(c,e)}}return c}t.ae=function(){return!(this.type===X.TableRow||this.type===X.TableColumn)};
    t.Ub=function(a,b,c){if(!1===this.pickable)return null;void 0===b&&(b=null);void 0===c&&(c=null);if(uj(this))return null;var d=this.naturalBounds,e=1/this.vf(),f=this.ae(),g=f?a:Ab(I.allocAt(a.x,a.y),this.transform),h=this.diagram,k=10,l=5;null!==h&&(k=h.mm("extraTouchArea"),l=k/2);if(fc(-(l*e),-(l*e),d.width+k*e,d.height+k*e,g.x,g.y)){if(!this.isAtomic){e=this.W.j;var m=e.length;h=I.alloc();l=(k=this.isClipping&&this.pa===X.Spot)?this.zb():null;if(k&&(l.ae()?Ab(h.set(a),l.transform):h.set(a),!l.aa(h)))return I.free(h),
    f||I.free(g),null;for(var n=ym(this);m--;){var p=e[m];if(p.visible||p===n)if(p.ae()?Ab(h.set(a),p.transform):h.set(a),!k||p!==l){var r=null;p instanceof X?r=p.Ub(h,b,c):!0===p.pickable&&p.aa(h)&&(r=p);if(null!==r&&(null!==b&&(r=b(r)),null!==r&&(null===c||c(r))))return I.free(h),f||I.free(g),r}}I.free(h)}if(null===this.background&&null===this.areaBackground)return f||I.free(g),null;a=fc(0,0,d.width,d.height,g.x,g.y)?this:null;f||I.free(g);return a}f||I.free(g);return null};
    t.Ti=function(a,b,c,d){if(!1===this.pickable)return!1;void 0===b&&(b=null);void 0===c&&(c=null);var e=this.naturalBounds,f=this.ae(),g=f?a:Ab(I.allocAt(a.x,a.y),this.transform);e=fc(0,0,e.width,e.height,g.x,g.y);if(this.type===X.TableRow||this.type===X.TableColumn||e){if(!this.isAtomic){for(var h=this.W.j,k=h.length,l=I.alloc(),m=ym(this);k--;){var n=h[k];if(n.visible||n===m){n.ae()?Ab(l.set(a),n.transform):l.set(a);var p=n;n=n instanceof X?n:null;(null!==n?n.Ti(l,b,c,d):p.aa(l))&&!1!==p.pickable&&
    (null!==b&&(p=b(p)),null===p||null!==c&&!c(p)||d.add(p))}}I.free(l)}f||I.free(g);return e&&(null!==this.background||null!==this.areaBackground)}f||I.free(g);return!1};
    t.uf=function(a,b,c,d,e,f){if(!1===this.pickable)return!1;void 0===b&&(b=null);void 0===c&&(c=null);var g=f;void 0===f&&(g=qd.alloc(),g.reset());g.multiply(this.transform);if(this.Eh(a,g))return hn(this,b,c,e),void 0===f&&qd.free(g),!0;if(this.Gc(a,g)){if(!this.isAtomic)for(var h=ym(this),k=this.W.j,l=k.length;l--;){var m=k[l];if(m.visible||m===h){var n=m.actualBounds,p=this.naturalBounds;if(!(n.x>p.width||n.y>p.height||0>n.x+n.width||0>n.y+n.height)){n=m;m=m instanceof X?m:null;p=qd.alloc();p.set(g);
      if(null!==m?m.uf(a,b,c,d,e,p):ll(n,a,d,p))null!==b&&(n=b(n)),null===n||null!==c&&!c(n)||e.add(n);qd.free(p)}}}void 0===f&&qd.free(g);return d}void 0===f&&qd.free(g);return!1};function hn(a,b,c,d){for(var e=a.W.j,f=e.length;f--;){var g=e[f];if(g.visible){var h=g.actualBounds,k=a.naturalBounds;h.x>k.width||h.y>k.height||0>h.x+h.width||0>h.y+h.height||(g instanceof X&&hn(g,b,c,d),null!==b&&(g=b(g)),null===g||null!==c&&!c(g)||d.add(g))}}}
    t.yg=function(a,b,c,d,e,f){if(!1===this.pickable)return!1;void 0===c&&(c=null);void 0===d&&(d=null);var g=this.naturalBounds,h=this.ae(),k=h?a:Ab(I.allocAt(a.x,a.y),this.transform),l=h?b:Ab(I.allocAt(b.x,b.y),this.transform),m=k.Be(l),n=0<k.x&&k.x<g.width&&0<k.y&&k.y<g.height||Bb(k.x,k.y,0,0,0,g.height)<=m||Bb(k.x,k.y,0,g.height,g.width,g.height)<=m||Bb(k.x,k.y,g.width,g.height,g.width,0)<=m||Bb(k.x,k.y,g.width,0,0,0)<=m;g=k.dd(0,0)<=m&&k.dd(0,g.height)<=m&&k.dd(g.width,0)<=m&&k.dd(g.width,g.height)<=
      m;h||(I.free(k),I.free(l));if(n){if(!this.isAtomic){k=I.alloc();l=I.alloc();m=ym(this);for(var p=this.W.j,r=p.length;r--;){var q=p[r];if(q.visible||q===m){var u=q.actualBounds,v=this.naturalBounds;if(!h||!(u.x>v.width||u.y>v.height||0>u.x+u.width||0>u.y+u.height))if(q.ae()?(u=q.transform,Ab(k.set(a),u),Ab(l.set(b),u)):(k.set(a),l.set(b)),u=q,q=q instanceof X?q:null,null!==q?q.yg(k,l,c,d,e,f):u.Nx(k,l,e))null!==c&&(u=c(u)),null===u||null!==d&&!d(u)||f.add(u)}}I.free(k);I.free(l)}return e?n:g}return!1};
    function Dm(a){var b=null;a instanceof Kf&&(b=a.spot1,b===$c&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot1));null===b&&(b=vc);return b}function Em(a){var b=null;a instanceof Kf&&(b=a.spot2,b===$c&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot2));null===b&&(b=Gc);return b}t.add=function(a){this.Kb(this.W.count,a)};t.L=function(a){return this.W.L(a)};
    t.Kb=function(a,b){b instanceof U&&B("Cannot add a Part to a Panel: "+b+"; use a Panel instead");if(this===b||this.Bg(b))this===b&&B("Cannot make a Panel contain itself: "+this.toString()),B("Cannot make a Panel indirectly contain itself: "+this.toString()+" already contains "+b.toString());var c=b.panel;null!==c&&c!==this&&B("Cannot add a GraphObject that already belongs to another Panel to this Panel: "+b.toString()+", already contained by "+c.toString()+", cannot be shared by this Panel: "+this.toString());
      this.pa!==X.Grid||b instanceof Kf||B("Can only add Shapes to a Grid Panel, not: "+b);this.pa!==X.Graduated||b instanceof Kf||b instanceof Ug||B("Can only add Shapes or TextBlocks to a Graduated Panel, not: "+b);b.cj(this);b.Jj=null;if(null!==this.itemArray){var d=b.data;null!==d&&"object"===typeof d&&(null===this.Kd&&(this.Kd=new G),this.Kd.add(d,b))}var e=this.W;d=-1;if(c===this){for(var f=-1,g=this.W.j,h=g.length,k=0;k<h;k++)if(g[k]===b){f=k;break}if(-1!==f){if(f===a||f+1>=e.count&&a>=e.count)return;
        e.lb(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.Kb(a,b);if(0===a||b.isPanelMain)this.Hi=null;tj(this)||this.o();b.o(!1);null!==b.portId?this.Gh=!0:b instanceof X&&!0===b.Gh&&(this.Gh=!0);this.Yg=null;c=this.part;null!==c&&(c.Fj=null,c.eh=NaN,this.Gh&&c instanceof W&&(c.Gh=!0),c.Gh&&c instanceof W&&(c.rc=null),e=this.diagram,null!==e&&e.undoManager.isUndoingRedoing||(-1!==d&&c.Ya(xe,"elements",this,b,null,d,null),c.Ya(we,
        "elements",this,null,b,null,a),this.Cg()||jn(this,b,!1)))};function kn(a,b){a.F=b?a.F|16777216:a.F&-16777217}t.remove=function(a){for(var b=this.W.j,c=b.length,d=-1,e=0;e<c;e++)if(b[e]===a){d=e;break}-1!==d&&this.Fc(d,!0)};t.lb=function(a){0<=a&&this.Fc(a,!0)};
    t.Fc=function(a,b){var c=this.W,d=c.L(a);d.Jj=null;d.cj(null);if(null!==this.Kd){var e=d.data;"object"===typeof e&&this.Kd.remove(e)}c.lb(a);oj(this,!1);this.o();this.Hi===d&&(this.Hi=null);this.Yg=null;var f=this.part;null!==f&&(f.Fj=null,f.eh=NaN,f.Lb(),f instanceof W&&(d instanceof X?d.Km(d,function(a,c){Ul(f,c,b)}):Ul(f,d,b)),c=this.diagram,null!==c&&c.undoManager.isUndoingRedoing||f.Ya(xe,"elements",this,d,null,a,null))};
    X.prototype.getRowDefinition=function(a){0>a&&va(a,">= 0",X,"getRowDefinition:idx");a=Math.round(a);var b=this.rb;if(void 0===b)return null;if(void 0===b[a]){var c=new Uj;c.cj(this);c.isRow=!0;c.index=a;b[a]=c}return b[a]};X.prototype.aw=function(a){0>a&&va(a,">= 0",X,"removeRowDefinition:idx");a=Math.round(a);var b=this.rb;void 0!==b&&(this.Ya(xe,"coldefs",this,b[a],null,a,null),b[a]&&delete b[a],this.o())};
    X.prototype.getColumnDefinition=function(a){0>a&&va(a,">= 0",X,"getColumnDefinition:idx");a=Math.round(a);var b=this.mb;if(void 0===b)return null;if(void 0===b[a]){var c=new Uj;c.cj(this);c.isRow=!1;c.index=a;b[a]=c}return b[a]};t=X.prototype;t.Zv=function(a){0>a&&va(a,">= 0",X,"removeColumnDefinition:idx");a=Math.round(a);var b=this.mb;void 0!==b&&(this.Ya(xe,"coldefs",this,b[a],null,a,null),b[a]&&delete b[a],this.o())};
    t.rz=function(a){if(0>a||this.type!==X.Table)return-1;for(var b=0,c=this.rb,d=c.length,e=this.Ki;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))break}return e};t.jz=function(a){if(0>a||this.type!==X.Table)return-1;for(var b=0,c=this.mb,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.Mz=function(a,b){void 0===b&&(b=new I(NaN,NaN));if(this.type!==X.Graduated)return b.h(NaN,NaN),b;a=Math.min(Math.max(a,this.graduatedMin),this.graduatedMax);var c=this.zb();c.geometry.Bv((a-this.graduatedMin)/this.graduatedRange,b);return c.transform.ra(b)};t.Nz=function(a){if(this.type!==X.Graduated)return NaN;var b=this.zb();b.transform.Wd(a);return b.geometry.Rx(a)*this.graduatedRange+this.graduatedMin};function Kl(a){a=a.ci;return null!==a&&a.s}
    function wg(a){var b=a.ci;if(null===b)null!==a.data&&B("Template cannot have .data be non-null: "+a),a.ci=b=new E;else if(b.s)return;var c=new E;kn(a,!1);a.Km(a,function(a,d){var e=d.$a;if(null!==e)for(Hl(d,!1),e=e.iterator;e.next();){var f=e.value;f.mode===ln&&Hl(d,!0);var g=f.sourceName;null!==g&&("/"===g&&kn(a,!0),g=il(f,a,d),null!==g&&(c.add(g),null===g.Pl&&(g.Pl=new E),g.Pl.add(f)));b.add(f)}if(d instanceof X&&d.type===X.Table){if(0<d.rb.length)for(a=d.rb,e=a.length,f=0;f<e;f++)if(g=a[f],void 0!==
    g&&null!==g.$a)for(var h=g.$a.iterator;h.next();){var k=h.value;k.bd=g;k.Qp=2;k.Vl=g.index;b.add(k)}if(0<d.mb.length)for(d=d.mb,a=d.length,e=0;e<a;e++)if(f=d[e],void 0!==f&&null!==f.$a)for(g=f.$a.iterator;g.next();)h=g.value,h.bd=f,h.Qp=1,h.Vl=f.index,b.add(h)}});for(var d=c.iterator;d.next();){var e=d.value;if(null!==e.Pl){Hl(e,!0);for(var f=e.Pl.iterator;f.next();){var g=f.value;null===e.$a&&(e.$a=new E);e.$a.add(g)}}e.Pl=null}for(d=b.iterator;d.next();)if(e=d.value,f=e.bd,null!==f){e.bd=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.Xa(g),null!==k?(f=k,e.targetProperty=h):wa('Warning: unable to find GraphObject named "'+g+'" for Binding: '+e.toString()));f instanceof Uj?(g=lb(f.panel),e.gj=void 0===g?-1:g,f.panel.Jk=e.gj):f instanceof Y?(g=lb(f),e.gj=void 0===g?-1:g,f.Jk=e.gj):B("Unknown type of binding target: "+f)}b.freeze();a instanceof U&&a.Wb()&&a.yb()}
    t.Yy=function(){var a=this.copy();cn(a,function(a){a instanceof X&&(a.ci=null,a.hb=null);var b=a.$a;null!==b&&(a.$a=null,b.each(function(b){a.bind(b.copy())}));b=a.Ig;null!==b&&(a.Ig=null,b.each(function(b){Ll(a,b.value.copy())}))});return a};
    t.Ba=function(a){var b=this.ci;if(null!==b)for(void 0===a&&(a=""),b=b.iterator;b.next();){var c=b.value,d=c.sourceProperty;if(""===a||""===d||d===a)if(d=c.targetProperty,null!==c.converter||""!==d){d=this.data;var e=c.sourceName;if(null!==e)d=""===e?this:"/"===e?this:"."===e?this:".."===e?this:this.Xa(e);else{var f=this.diagram;null!==f&&c.isToModel&&(d=f.model.modelData)}if(null!==d){f=this;var g=c.gj;if(-1!==g){if(f=this.jt(g),null===f)continue}else null!==c.bd&&(f=c.bd);"/"===e?d=f.part:"."===
    e?d=f:".."===e&&(d=f.panel);e=c.Qp;if(0!==e){if(!(f instanceof X))continue;1===e?f=f.getColumnDefinition(c.Vl):2===e&&(f=f.getRowDefinition(c.Vl))}void 0!==f&&c.vw(f,d)}}}};function mn(a,b){a=a.W.j;for(var c=a.length,d=b.length,e=0,f=null;e<c&&!(f=a[e],f instanceof X&&null!==f.data);)e++,f=a[e];if(c-e!==d)return!0;if(null===f)return 0<d;for(var g=0;e<c&&g<d;){f=a[e];if(!(f instanceof X)||f.data!==b[g])return!0;e++;g++}return!1}
    function fn(a){if(a.type===X.Spot||a.type===X.Auto)return Math.min(a.W.length,1);if(a.type===X.Link){a=a.W;for(var b=a.length,c=0;c<b;c++){var d=a.L(c);if(!(d instanceof Kf&&d.isPanelMain))break}return c}return a.type===X.Table&&0<a.W.length&&(a=a.W.L(0),a.isPanelMain&&a instanceof X&&(a.type===X.TableRow||a.type===X.TableColumn))?1:0}t.Ht=function(){for(var a=fn(this);this.W.length>a;)this.Fc(this.W.length-1,!1);a=this.itemArray;if(null!==a)for(var b=a.length,c=0;c<b;c++)nn(this,a[c],c)};
    t.Mx=function(a){return void 0===a||null===a||null===this.Kd?null:this.Kd.H(a)};
    function nn(a,b,c){if(!(void 0===b||null===b||0>c)){var d=on(a,b),e=a.itemTemplateMap,f=null;null!==e&&(f=e.H(d));null===f&&(pn||(pn=!0,wa('No item template Panel found for category "'+d+'" on '+a),wa("  Using default item template."),d=new X,e=new Ug,e.bind(new Mi("text","",Ja)),d.add(e),zn=d),f=zn);d=f;null!==d&&(wg(d),d=d.copy(),0!==(d.F&16777216)&&(e=a.Ui(),null!==e&&kn(e,!0)),"object"===typeof b&&(null===a.Kd&&(a.Kd=new G),a.Kd.add(b,d)),e=c+fn(a),a.Kb(e,d),d.hb=b,An(a,e,c),d.hb=null,d.data=
      b)}}function An(a,b,c){for(a=a.W;b<a.length;){var d=a.L(b);if(d instanceof X){var e=b,f=c;d.type===X.TableRow?d.row=e:d.type===X.TableColumn&&(d.column=e);d.itemIndex=f}b++;c++}}function on(a,b){if(null===b)return"";a=a.ql;if("function"===typeof a)a=a(b);else if("string"===typeof a&&"object"===typeof b){if(""===a)return"";a=Bn(b,a)}else return"";if(void 0===a)return"";if("string"===typeof a)return a;B("Panel.getCategoryForItemData found a non-string category for "+b+": "+a);return""}
    function jn(a,b,c){var d=b.enabledChanged;null!==d&&d(b,c);if(b instanceof X){b=b.W.j;d=b.length;for(var e=0;e<d;e++){var f=b[e];c&&f instanceof X&&!f.isEnabled||jn(a,f,c)}}}function Cn(a,b){Pl.add(a,b)}
    ma.Object.defineProperties(X.prototype,{type:{get:function(){return this.pa},set:function(a){var b=this.pa;b!==a&&(this.pa=a,this.pa===X.Grid?this.isAtomic=!0:this.pa===X.Table&&Ym(this),this.o(),this.g("type",b,a))}},elements:{get:function(){return this.W.iterator}},naturalBounds:{get:function(){return this.oc}},padding:{get:function(){return this.bb},set:function(a){"number"===
        typeof a?(0>a&&va(a,">= 0",X,"padding"),a=new oc(a)):(0>a.left&&va(a.left,">= 0",X,"padding:value.left"),0>a.right&&va(a.right,">= 0",X,"padding:value.right"),0>a.top&&va(a.top,">= 0",X,"padding:value.top"),0>a.bottom&&va(a.bottom,">= 0",X,"padding:value.bottom"));var b=this.bb;b.w(a)||(this.bb=a=a.G(),this.o(),this.g("padding",b,a))}},defaultAlignment:{get:function(){return this.un},set:function(a){var b=this.un;b.w(a)||(this.un=a=a.G(),this.o(),this.g("defaultAlignment",
          b,a))}},defaultStretch:{get:function(){return this.Of},set:function(a){var b=this.Of;b!==a&&(this.Of=a,this.o(),this.g("defaultStretch",b,a))}},defaultSeparatorPadding:{get:function(){return void 0===this.nj?sc:this.nj},set:function(a){if(void 0!==this.nj){"number"===typeof a&&(a=new oc(a));var b=this.nj;b.w(a)||(this.nj=a=a.G(),this.o(),this.g("defaultSeparatorPadding",b,a))}}},defaultRowSeparatorStroke:{get:function(){return void 0===
        this.ii?null:this.ii},set:function(a){var b=this.ii;b!==a&&(null===a||"string"===typeof a||a instanceof vl)&&(a instanceof vl&&a.freeze(),this.ii=a,this.M(),this.g("defaultRowSeparatorStroke",b,a))}},defaultRowSeparatorStrokeWidth:{get:function(){return void 0===this.Pg?1:this.Pg},set:function(a){if(void 0!==this.Pg){var b=this.Pg;b!==a&&isFinite(a)&&0<=a&&(this.Pg=a,this.o(),this.g("defaultRowSeparatorStrokeWidth",b,a))}}},defaultRowSeparatorDashArray:{
        get:function(){return void 0===this.hi?null:this.hi},set:function(a){if(void 0!==this.hi){var b=this.hi;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.hi=a;this.M();this.g("defaultRowSeparatorDashArray",b,a)}}}},defaultColumnSeparatorStroke:{get:function(){return void 0===
        this.Ng?null:this.Ng},set:function(a){if(void 0!==this.Ng){var b=this.Ng;b!==a&&(null===a||"string"===typeof a||a instanceof vl)&&(a instanceof vl&&a.freeze(),this.Ng=a,this.M(),this.g("defaultColumnSeparatorStroke",b,a))}}},defaultColumnSeparatorStrokeWidth:{get:function(){return void 0===this.Og?1:this.Og},set:function(a){if(void 0!==this.Og){var b=this.Og;b!==a&&isFinite(a)&&0<=a&&(this.Og=a,this.o(),this.g("defaultColumnSeparatorStrokeWidth",b,a))}}},defaultColumnSeparatorDashArray:{
        get:function(){return void 0===this.gi?null:this.gi},set:function(a){if(void 0!==this.gi){var b=this.gi;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.gi=a;this.M();this.g("defaultColumnSeparatorDashArray",b,a)}}}},viewboxStretch:{get:function(){return this.Yp},
        set:function(a){var b=this.Yp;b!==a&&(this.Yp=a,this.o(),this.g("viewboxStretch",b,a))}},gridCellSize:{get:function(){return this.Sn},set:function(a){var b=this.Sn;if(!b.w(a)){a.u()&&0!==a.width&&0!==a.height||B("Invalid Panel.gridCellSize: "+a);this.Sn=a.G();var c=this.diagram;null!==c&&this===c.grid&&pj(c);this.M();this.g("gridCellSize",b,a)}}},gridOrigin:{get:function(){return this.Tn},set:function(a){var b=this.Tn;if(!b.w(a)){a.u()||
        B("Invalid Panel.gridOrigin: "+a);this.Tn=a.G();var c=this.diagram;null!==c&&this===c.grid&&pj(c);this.M();this.g("gridOrigin",b,a)}}},graduatedMin:{get:function(){return this.Pn},set:function(a){var b=this.Pn;b!==a&&(this.Pn=a,this.o(),this.g("graduatedMin",b,a),gl(this)&&(a=this.part,null!==a&&hl(this,a,"graduatedRange")))}},graduatedMax:{get:function(){return this.On},set:function(a){var b=this.On;b!==a&&(this.On=a,this.o(),this.g("graduatedMax",
          b,a),gl(this)&&(a=this.part,null!==a&&hl(this,a,"graduatedRange")))}},graduatedRange:{get:function(){return this.graduatedMax-this.graduatedMin}},graduatedTickUnit:{get:function(){return this.Rn},set:function(a){var b=this.Rn;b!==a&&0<a&&(this.Rn=a,this.o(),this.g("graduatedTickUnit",b,a))}},graduatedTickBase:{get:function(){return this.Qn},set:function(a){var b=this.Qn;b!==a&&(this.Qn=a,this.o(),this.g("graduatedTickBase",
          b,a))}},Gh:{get:function(){return 0!==(this.F&8388608)},set:function(a){0!==(this.F&8388608)!==a&&(this.F^=8388608)}},rowCount:{get:function(){return void 0===this.rb?0:this.rb.length}},columnCount:{get:function(){return void 0===this.mb?0:this.mb.length}},rowSizing:{get:function(){return void 0===this.Mj?Zm:this.Mj},set:function(a){if(void 0!==this.Mj){var b=this.Mj;b!==a&&(this.Mj=
          a,this.o(),this.g("rowSizing",b,a))}}},columnSizing:{get:function(){return void 0===this.kj?Zm:this.kj},set:function(a){if(void 0!==this.kj){var b=this.kj;b!==a&&(this.kj=a,this.o(),this.g("columnSizing",b,a))}}},topIndex:{get:function(){return void 0===this.Ki?0:this.Ki},set:function(a){if(void 0!==this.Ki){var b=this.Ki;b!==a&&((!isFinite(a)||0>a)&&B("Panel.topIndex must be greater than zero and a real number, not: "+a),this.Ki=a,this.o(),
          this.g("topIndex",b,a))}}},leftIndex:{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.leftIndex must be greater than zero and a real number, not: "+a),this.vi=a,this.o(),this.g("leftIndex",b,a))}}},data:{get:function(){return this.hb},set:function(a){var b=this.hb;if(b!==a){var c=this instanceof U&&!(this instanceof Ke);wg(this);this.hb=a;var d=this.diagram;
          null!==d&&(c?(c=d.partManager,this instanceof S?(null!==b&&c.Oe.remove(b),null!==a&&c.Oe.add(a,this)):this instanceof U&&(null!==b&&c.Pe.remove(b),null!==a&&c.Pe.add(a,this))):(c=this.panel,null!==c&&null!==c.Kd&&(null!==b&&c.Kd.remove(b),null!==a&&c.Kd.add(a,this))));this.g("data",b,a);null!==d&&d.undoManager.isUndoingRedoing||null!==a&&this.Ba()}}},itemIndex:{get:function(){return this.io},set:function(a){var b=this.io;b!==a&&(this.io=a,this.g("itemIndex",b,a))}},itemArray:{
        get:function(){return this.si},set:function(a){var b=this.si;if(b!==a||null!==a&&mn(this,a)){var c=this.diagram;b!==a&&(null!==c&&null!==b&&Lj(c.partManager,this,c),this.si=a,null!==c&&null!==a&&Ij(c.partManager,this));this.g("itemArray",b,a);null!==c&&c.undoManager.isUndoingRedoing||this.Ht()}}},itemTemplate:{get:function(){return null===this.me?null:this.me.H("")},set:function(a){if(null===this.me){if(null===a)return;this.me=new G}var b=this.me.H("");
          b!==a&&((a instanceof U||a.isPanelMain)&&B("Panel.itemTemplate must not be a Part or be Panel.isPanelMain: "+a),this.me.add("",a),this.g("itemTemplate",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.Ht())}},itemTemplateMap:{get:function(){return this.me},set:function(a){var b=this.me;if(b!==a){for(var c=a.iterator;c.next(););this.me=a;this.g("itemTemplateMap",b,a);a=this.diagram;null!==a&&a.undoManager.isUndoingRedoing||this.Ht()}}},itemCategoryProperty:{
        get:function(){return this.ql},set:function(a){var b=this.ql;b!==a&&(this.ql=a,this.g("itemCategoryProperty",b,a))}},isAtomic:{get:function(){return 0!==(this.F&1048576)},set:function(a){var b=0!==(this.F&1048576);b!==a&&(this.F^=1048576,this.g("isAtomic",b,a))}},isClipping:{get:function(){return 0!==(this.F&2097152)},set:function(a){var b=0!==(this.F&2097152);b!==a&&(a&&this.type!==X.Spot&&wa("Warning: Panel.isClipping set on non-Spot Panel: "+
          this.toString()),this.F^=2097152,this.o(),this.g("isClipping",b,a))}},isOpposite:{get:function(){return 0!==(this.F&33554432)},set:function(a){var b=0!==(this.F&33554432);b!==a&&(this.F^=33554432,this.o(),this.g("isOpposite",b,a))}},isEnabled:{get:function(){return 0!==(this.F&4194304)},set:function(a){var b=0!==(this.F&4194304);if(b!==a){var c=null===this.panel||this.panel.Cg();this.F^=4194304;this.g("isEnabled",b,a);b=this.diagram;null!==
        b&&b.undoManager.isUndoingRedoing||c&&jn(this,this,a)}}},alignmentFocusName:{get:function(){return this.Hg},set:function(a){var b=this.Hg;b!==a&&(this.Hg=a,this.o(),this.g("alignmentFocusName",b,a))}}});
    ma.Object.defineProperties(X,{Position:{get:function(){return Pl.H("Position")}},Horizontal:{get:function(){return Pl.H("Horizontal")}},Vertical:{get:function(){return Pl.H("Vertical")}},Spot:{get:function(){return Pl.H("Spot")}},Auto:{get:function(){return Pl.H("Auto")}},Table:{get:function(){return Pl.H("Table")}},Viewbox:{
        get:function(){return Pl.H("Viewbox")}},TableRow:{get:function(){return Pl.H("TableRow")}},TableColumn:{get:function(){return Pl.H("TableColumn")}},Link:{get:function(){return Pl.H("Link")}},Grid:{get:function(){return Pl.H("Grid")}},Graduated:{get:function(){return Pl.H("Graduated")}}});X.prototype.findItemPanelForData=X.prototype.Mx;
    X.prototype.rebuildItemElements=X.prototype.Ht;X.prototype.updateTargetBindings=X.prototype.Ba;X.prototype.copyTemplate=X.prototype.Yy;X.prototype.graduatedValueForPoint=X.prototype.Nz;X.prototype.graduatedPointForValue=X.prototype.Mz;X.prototype.findColumnForLocalX=X.prototype.jz;X.prototype.findRowForLocalY=X.prototype.rz;X.prototype.removeColumnDefinition=X.prototype.Zv;X.prototype.removeRowDefinition=X.prototype.aw;X.prototype.removeAt=X.prototype.lb;X.prototype.remove=X.prototype.remove;
    X.prototype.insertAt=X.prototype.Kb;X.prototype.elt=X.prototype.L;X.prototype.add=X.prototype.add;X.prototype.findObject=X.prototype.Xa;X.prototype.findInVisualTree=X.prototype.hm;X.prototype.walkVisualTreeFrom=X.prototype.Km;X.prototype.findMainElement=X.prototype.zb;var pn=!1,zn=null,Pl=new G;X.className="Panel";X.definePanelLayout=Cn;Cn("Position",new xm);Cn("Vertical",new Am);Cn("Auto",new Cm);Cn("Link",new Nm);
    function Uj(){Ya(this);this.lg=null;this.Rr=!0;this.Oa=0;this.Pc=NaN;this.gh=0;this.fh=Infinity;this.vb=$c;this.ma=this.ha=0;this.$a=null;this.Hp=Dn;this.we=Xk;this.Bp=this.og=null;this.Cp=NaN;this.gb=this.Nj=null;this.qn=!1}
    Uj.prototype.copy=function(){var a=new Uj;a.Rr=this.Rr;a.Oa=this.Oa;a.Pc=this.Pc;a.gh=this.gh;a.fh=this.fh;a.vb=this.vb;a.ha=this.ha;a.ma=this.ma;a.we=this.we;a.Hp=this.Hp;null===this.og?a.og=null:a.og=this.og.G();a.Bp=this.Bp;a.Cp=this.Cp;a.Nj=null;null!==this.Nj&&(a.separatorDashArray=Ba(this.separatorDashArray));a.gb=this.gb;a.qn=this.qn;a.$a=this.$a;return a};t=Uj.prototype;
    t.ft=function(a){a.isRow?this.height=a.height:this.width=a.width;this.minimum=a.minimum;this.maximum=a.maximum;this.alignment=a.alignment;this.stretch=a.stretch;this.sizing=a.sizing;this.og=null===a.separatorPadding?null:a.separatorPadding.G();this.separatorStroke=a.separatorStroke;this.separatorStrokeWidth=a.separatorStrokeWidth;this.Nj=null;a.separatorDashArray&&(this.Nj=Ba(a.separatorDashArray));this.background=a.background;this.coversSeparators=a.coversSeparators;this.$a=a.$a};
    t.cb=function(a){a.classType===Uj&&(this.sizing=a)};t.toString=function(){return"RowColumnDefinition "+(this.isRow?"(Row ":"(Column ")+this.index+") #"+lb(this)};t.cj=function(a){this.lg=a};
    t.lv=function(){var a=0,b=0,c=this.lg,d=this.isRow;if(null!==c&&c.type===X.Table)for(var e=d?c.rb.length:c.mb.length,f=0;f<e;f++){var g=d?c.rb[f]:c.mb[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.og;if(null===b)if(null!==c)b=
      c.defaultSeparatorPadding;else return a;return a+(this.isRow?b.top:b.left)};
    t.uc=function(){var a=0,b=this.lg,c=0,d=this.isRow;if(null!==b&&b.type===X.Table)for(var e=d?b.rb.length:b.mb.length,f=0;f<e;f++){var g=d?b.rb[f]:b.mb[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.og;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.xb=function(a,b,c){var d=this.lg;if(null!==d&&(d.Ya(ue,a,this,b,c,void 0,void 0),null!==this.$a&&(b=d.diagram,null!==b&&!b.skipsModelSourceBindings&&(d=d.Ui(),null!==d&&(b=d.data,null!==b)))))for(c=this.$a.iterator;c.next();)c.value.Qq(this,b,a,d)};function Gm(a){if(a.sizing===Dn){var b=a.lg;return a.isRow?b.rowSizing:b.columnSizing}return a.sizing}
    t.bind=function(a){a.bd=this;var b=this.panel;if(null!==b){var c=b.Ui();null!==c&&Kl(c)&&B("Cannot add a Binding to a RowColumnDefinition that is already frozen: "+a+" on "+b)}null===this.$a&&(this.$a=new E);this.$a.add(a)};
    ma.Object.defineProperties(Uj.prototype,{panel:{get:function(){return this.lg}},isRow:{get:function(){return this.Rr},set:function(a){this.Rr=a}},index:{get:function(){return this.Oa},set:function(a){this.Oa=a}},height:{get:function(){return this.Pc},set:function(a){var b=this.Pc;b!==a&&(0>a&&va(a,">= 0",Uj,"height"),this.Pc=a,this.actual=this.ha,null!==this.panel&&this.panel.o(),
          this.xb("height",b,a))}},width:{get:function(){return this.Pc},set:function(a){var b=this.Pc;b!==a&&(0>a&&va(a,">= 0",Uj,"width"),this.Pc=a,this.actual=this.ha,null!==this.panel&&this.panel.o(),this.xb("width",b,a))}},minimum:{get:function(){return this.gh},set:function(a){var b=this.gh;b!==a&&((0>a||!isFinite(a))&&va(a,">= 0",Uj,"minimum"),this.gh=a,this.actual=this.ha,null!==this.panel&&this.panel.o(),this.xb("minimum",b,a))}},maximum:{
        get:function(){return this.fh},set:function(a){var b=this.fh;b!==a&&(0>a&&va(a,">= 0",Uj,"maximum"),this.fh=a,this.actual=this.ha,null!==this.panel&&this.panel.o(),this.xb("maximum",b,a))}},alignment:{get:function(){return this.vb},set:function(a){var b=this.vb;b.w(a)||(this.vb=a.G(),null!==this.panel&&this.panel.o(),this.xb("alignment",b,a))}},stretch:{get:function(){return this.we},set:function(a){var b=this.we;b!==a&&(this.we=
          a,null!==this.panel&&this.panel.o(),this.xb("stretch",b,a))}},separatorPadding:{get:function(){return this.og},set:function(a){"number"===typeof a&&(a=new oc(a));var b=this.og;null!==a&&null!==b&&b.w(a)||(null!==a&&(a=a.G()),this.og=a,null!==this.panel&&this.panel.o(),this.xb("separatorPadding",b,a))}},separatorStroke:{get:function(){return this.Bp},set:function(a){var b=this.Bp;b!==a&&(null!==a&&Tl(a,"RowColumnDefinition.separatorStroke"),
        a instanceof vl&&a.freeze(),this.Bp=a,null!==this.panel&&this.panel.o(),this.xb("separatorStroke",b,a))}},separatorStrokeWidth:{get:function(){return this.Cp},set:function(a){var b=this.Cp;b!==a&&(this.Cp=a,null!==this.panel&&this.panel.o(),this.xb("separatorStrokeWidth",b,a))}},separatorDashArray:{get:function(){return this.Nj},set:function(a){var b=this.Nj;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.Nj=a;null!==this.panel&&this.panel.M();this.xb("separatorDashArray",b,a)}}},background:{get:function(){return this.gb},set:function(a){var b=this.gb;b!==a&&(null!==a&&Tl(a,"RowColumnDefinition.background"),a instanceof vl&&a.freeze(),this.gb=a,null!==this.panel&&this.panel.M(),this.xb("background",b,a))}},coversSeparators:{
        get:function(){return this.qn},set:function(a){var b=this.qn;b!==a&&(this.qn=a,null!==this.panel&&this.panel.M(),this.xb("coversSeparators",b,a))}},sizing:{get:function(){return this.Hp},set:function(a){var b=this.Hp;b!==a&&(this.Hp=a,null!==this.panel&&this.panel.o(),this.xb("sizing",b,a))}},actual:{get:function(){return this.ha},set:function(a){this.ha=isNaN(this.Pc)?Math.max(Math.min(this.fh,a),this.gh):Math.max(Math.min(this.fh,
          this.Pc),this.gh)}},total:{get:function(){return this.ha+this.uc()},set:function(a){this.ha=isNaN(this.Pc)?Math.max(Math.min(this.fh,a),this.gh):Math.max(Math.min(this.fh,this.Pc),this.gh);this.ha=Math.max(0,this.ha-this.uc())}},position:{get:function(){return this.ma},set:function(a){this.ma=a}}});Uj.prototype.bind=Uj.prototype.bind;Uj.prototype.computeEffectiveSpacing=Uj.prototype.uc;Uj.prototype.computeEffectiveSpacingTop=Uj.prototype.lv;
    var Dn=new D(Uj,"Default",0),Hm=new D(Uj,"None",1),Zm=new D(Uj,"ProportionalExtra",2);Uj.className="RowColumnDefinition";Uj.Default=Dn;Uj.None=Hm;Uj.ProportionalExtra=Zm;function Kf(){Y.call(this);this.Rd=this.ka=null;this.Zk="None";this.Nn=Xk;this.Dc=this.$k="black";this.rh=1;this.Rl="butt";this.Sl="miter";this.Oj=10;this.ph=null;this.qh=0;this.kf=this.jf=$c;this.$o=this.Zo=NaN;this.Zn=!1;this.bp=null;this.al=this.Yl="None";this.Jd=1;this.Gd=0;this.Ed=1;this.Fd=null}la(Kf,Y);
    Kf.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.ka=this.ka;a.Zk=this.Zk;a.Nn=this.Nn;a.Rd=this.Rd;a.$k=this.$k;a.Dc=this.Dc;a.rh=this.rh;a.Rl=this.Rl;a.Sl=this.Sl;a.Oj=this.Oj;null!==this.ph&&(a.ph=Ba(this.ph));a.qh=this.qh;a.jf=this.jf.G();a.kf=this.kf.G();a.Zo=this.Zo;a.$o=this.$o;a.Zn=this.Zn;a.bp=this.bp;a.Yl=this.Yl;a.al=this.al;a.Jd=this.Jd;a.Gd=this.Gd;a.Ed=this.Ed;a.Fd=this.Fd};t=Kf.prototype;
    t.cb=function(a){a===xg||a===zg||a===$k||a===Xk?this.geometryStretch=a:Y.prototype.cb.call(this,a)};t.toString=function(){return"Shape("+("None"!==this.figure?this.figure:"None"!==this.toArrow?this.toArrow:this.fromArrow)+")#"+lb(this)};
    function En(a,b,c,d){var e=c.length;if(!(4>e)){var f=d.measuredBounds,g=Math.max(1,f.width);f=f.height;for(var h=c[0],k=c[1],l,m,n,p,r,q,u=0,v=Fa(),w=2;w<e;w+=2)l=c[w],m=c[w+1],n=l-h,h=m-k,0===n&&(n=.001),p=h/n,r=Math.atan2(h,n),q=Math.sqrt(n*n+h*h),v.push([n,r,p,q]),u+=q,h=l,k=m;h=c[0];k=c[1];n=d.measuredBounds.width;d instanceof Kf&&(n-=d.strokeWidth);1>n&&(n=1);e=c=n;l=g/2;m=0===l?!1:!0;w=0;q=v[w];n=q[0];r=q[1];p=q[2];q=q[3];for(var y=0;.1<=u;){0===y&&(m?(e=c,e-=l,u-=l,m=!1):e=c,0===e&&(e=1));
      if(e>u){Ha(v);return}e>q?(y=e-q,e=q):y=0;var z=Math.sqrt(e*e/(1+p*p));0>n&&(z=-z);h+=z;k+=p*z;a.translate(h,k);a.rotate(r);a.translate(-(g/2),-(f/2));0===y&&d.Qi(a,b);a.translate(g/2,f/2);a.rotate(-r);a.translate(-h,-k);u-=e;q-=e;if(0!==y){w++;if(w===v.length){Ha(v);return}q=v[w];n=q[0];r=q[1];p=q[2];q=q[3];e=y}}Ha(v)}}
    t.Qi=function(a,b){var c=this.Dc,d=this.$k;if(null!==c||null!==d){var e=this.actualBounds,f=this.naturalBounds;null!==d&&ki(this,a,d,!0,!1,f,e);var g=this.part,h=this.rh;null!==c&&0===h&&null!==g&&(h=g.type===X.Link&&g instanceof Ke&&"Selection"===g.category&&g.adornedObject instanceof Kf&&g.adornedPart.zb()===g.adornedObject?g.adornedObject.strokeWidth:0);null!==c&&0!==h&&(ki(this,a,c,!1,!1,f,e),a.lineWidth=h,a.lineJoin=this.Sl,a.lineCap=this.Rl,a.miterLimit=this.Oj);e=!1;g&&b.Ce("drawShadows")&&
    (e=g.isShadowed);g=!0;null===c||null!==d&&"transparent"!==d||(g=!1);f=!1;var k=this.strokeDashArray;null!==k&&(f=!0,a.it(k,this.qh));var l=this.ka;if(null!==l){if(l.type===vd)a.beginPath(),a.moveTo(l.startX,l.startY),a.lineTo(l.endX,l.endY),null!==d&&a.Vd(d),0!==h&&null!==c&&a.fj();else if(l.type===Gd){var m=l.startX;k=l.startY;var n=l.endX,p=l.endY;l=Math.min(m,n);var r=Math.min(k,p);m=Math.abs(n-m);k=Math.abs(p-k);a.beginPath();a.rect(l,r,m,k);null!==d&&a.Vd(d);if(null!==c){g&&e&&ul(a);if(0!==h){if(0===
      m||0===k)a.beginPath(),a.rect(l,r,Math.max(m,.1),Math.max(k,.1));a.fj()}g&&e&&tl(a)}}else if(l.type===Hd)m=l.startX,k=l.startY,n=l.endX,p=l.endY,l=Math.abs(n-m)/2,r=Math.abs(p-k)/2,m=Math.min(m,n)+l,k=Math.min(k,p)+r,a.beginPath(),a.moveTo(m,k-r),a.bezierCurveTo(m+J.Gg*l,k-r,m+l,k-J.Gg*r,m+l,k),a.bezierCurveTo(m+l,k+J.Gg*r,m+J.Gg*l,k+r,m,k+r),a.bezierCurveTo(m-J.Gg*l,k+r,m-l,k+J.Gg*r,m-l,k),a.bezierCurveTo(m-l,k-J.Gg*r,m-J.Gg*l,k-r,m,k-r),a.closePath(),null!==d&&a.Vd(d),0!==h&&null!==c&&(g&&e?(ul(a),
      a.fj(),tl(a)):a.fj());else if(l.type===td)for(k=l.figures,l=k.length,r=0;r<l;r++){m=k.j[r];a.beginPath();a.moveTo(m.startX,m.startY);n=m.segments.j;p=n.length;for(var q=null,u=0;u<p;u++){var v=n[u];switch(v.type){case Wd:a.moveTo(v.endX,v.endY);break;case xd:a.lineTo(v.endX,v.endY);break;case Xd:a.bezierCurveTo(v.point1X,v.point1Y,v.point2X,v.point2Y,v.endX,v.endY);break;case Yd:a.quadraticCurveTo(v.point1X,v.point1Y,v.endX,v.endY);break;case Zd:if(v.radiusX===v.radiusY){var w=Math.PI/180;a.arc(v.point1X,
      v.point1Y,v.radiusX,v.startAngle*w,(v.startAngle+v.sweepAngle)*w,0>v.sweepAngle,null!==q?q.endX:m.startX,null!==q?q.endY:m.startY)}else if(q=ae(v,m),w=q.length,0===w)a.lineTo(v.centerX,v.centerY);else for(var y=0;y<w;y++){var z=q[y];0===y&&a.lineTo(z[0],z[1]);a.bezierCurveTo(z[2],z[3],z[4],z[5],z[6],z[7])}break;case $d:y=w=0;if(null!==q&&q.type===Zd){q=ae(q,m);z=q.length;if(0===z){a.lineTo(v.centerX,v.centerY);break}q=q[z-1]||null;null!==q&&(w=q[6],y=q[7])}else w=null!==q?q.endX:m.startX,y=null!==
    q?q.endY:m.startY;q=be(v,m,w,y);w=q.length;if(0===w){a.lineTo(v.centerX,v.centerY);break}for(y=0;y<w;y++)z=q[y],a.bezierCurveTo(z[2],z[3],z[4],z[5],z[6],z[7]);break;default:B("Segment not of valid type: "+v.type)}v.isClosed&&a.closePath();q=v}e?m.isShadowed?(!0===m.isFilled&&"transparent"!==d&&null!==d&&a.Vd(d),0!==h&&null!==c&&(g&&ul(a),a.fj(),g&&tl(a))):(g&&ul(a),!0===m.isFilled&&"transparent"!==d&&null!==d&&a.Vd(d),0!==h&&null!==c&&a.fj(),g&&tl(a)):(!0===m.isFilled&&null!==d&&a.Vd(d),0!==h&&null!==
    c&&a.fj())}f&&a.gt();if(null!==this.pathPattern){c=this.pathPattern;c.measure(Infinity,Infinity);d=c.measuredBounds;c.arrange(0,0,d.width,d.height);h=this.geometry;a.save();a.beginPath();d=Fa();if(h.type===vd)d.push(h.startX),d.push(h.startY),d.push(h.endX),d.push(h.endY),En(a,b,d,c);else if(h.type===td)for(h=h.figures.iterator;h.next();){e=h.value;d.length=0;d.push(e.startX);d.push(e.startY);g=e.startX;f=e.startY;k=g;l=f;r=e.segments.j;m=r.length;for(n=0;n<m;n++){p=r[n];switch(p.type){case Wd:En(a,
      b,d,c);d.length=0;d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;k=g;l=f;break;case xd:d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;break;case Xd:J.ze(g,f,p.point1X,p.point1Y,p.point2X,p.point2Y,p.endX,p.endY,.5,d);g=p.endX;f=p.endY;break;case Yd:J.Cq(g,f,p.point1X,p.point1Y,p.endX,p.endY,.5,d);g=p.endX;f=p.endY;break;case Zd:u=ae(p,e);v=u.length;if(0===v){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(q=0;q<v;q++)w=u[q],J.ze(g,f,w[2],w[3],w[4],w[5],w[6],w[7],.5,d),g=w[6],
      f=w[7];break;case $d:u=be(p,e,g,f);v=u.length;if(0===v){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(q=0;q<v;q++)w=u[q],J.ze(g,f,w[2],w[3],w[4],w[5],w[6],w[7],.5,d),g=w[6],f=w[7];break;default:B("Segment not of valid type: "+p.type)}p.isClosed&&(d.push(k),d.push(l),En(a,b,d,c))}En(a,b,d,c)}else if(h.type===Gd)d.push(h.startX),d.push(h.startY),d.push(h.endX),d.push(h.startY),d.push(h.endX),d.push(h.endY),d.push(h.startX),d.push(h.endY),d.push(h.startX),d.push(h.startY),En(a,
      b,d,c);else if(h.type===Hd){f=new ne;f.startX=h.endX;f.startY=(h.startY+h.endY)/2;g=new oe(Zd);g.startAngle=0;g.sweepAngle=360;g.centerX=(h.startX+h.endX)/2;g.centerY=(h.startY+h.endY)/2;g.radiusX=Math.abs(h.startX-h.endX)/2;g.radiusY=Math.abs(h.startY-h.endY)/2;f.add(g);h=ae(g,f);e=h.length;if(0===e)d.push(g.centerX),d.push(g.centerY);else for(g=f.startX,f=f.startY,k=0;k<e;k++)l=h[k],J.ze(g,f,l[2],l[3],l[4],l[5],l[6],l[7],.5,d),g=l[6],f=l[7];En(a,b,d,c)}Ha(d);a.restore();a.sc(!1)}}}};
    t.ga=function(a,b){void 0===b&&(b=new I);if(a instanceof P){a.jc()&&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.vd.ra(b);return b};
    t.lm=function(a){void 0===a&&(a=new N);var b=this.naturalBounds,c=this.vd;b=N.allocAt(b.x,b.y,b.width,b.height);var d=this.strokeWidth;b.Vc(d/2,d/2);d=I.allocAt(b.x,b.y).transform(c);a.h(d.x,d.y,0,0);d.h(b.right,b.y).transform(c);ec(a,d.x,d.y,0,0);d.h(b.right,b.bottom).transform(c);ec(a,d.x,d.y,0,0);d.h(b.x,b.bottom).transform(c);ec(a,d.x,d.y,0,0);N.free(b);I.free(d);return a};
    t.Fh=function(a,b){var c=this.geometry;if(null===c||null===this.fill&&null===this.stroke)return!1;var d=c.bounds,e=this.strokeWidth/2;c.type!==vd||b||(e+=2);var f=N.alloc();f.assign(d);f.Vc(e+2,e+2);if(!f.aa(a))return N.free(f),!1;d=e+1E-4;if(c.type===vd){if(null===this.stroke)return!1;d=(c.endX-c.startX)*(a.x-c.startX)+(c.endY-c.startY)*(a.y-c.startY);if(0>(c.startX-c.endX)*(a.x-c.endX)+(c.startY-c.endY)*(a.y-c.endY)||0>d)return!1;N.free(f);return J.Nb(c.startX,c.startY,c.endX,c.endY,e,a.x,a.y)}if(c.type===
      Gd){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.Vc(-d,-d);if(f.aa(a))return N.free(f),!1;f.Vc(d,d)}null!==this.stroke&&f.Vc(e,e);a=f.aa(a);N.free(f);return a}if(c.type===Hd){g=c.startX;e=c.startY;h=c.endX;var k=c.endY;c=Math.min(g,h);b=Math.min(e,k);g=Math.abs(h-g)/2;e=Math.abs(k-e)/2;c=a.x-(c+g);b=a.y-(b+e);if(null===this.fill){g-=d;e-=d;if(0>=g||0>=e||1>=c*c/(g*g)+b*b/(e*e))return N.free(f),!1;
      g+=d;e+=d}null!==this.stroke&&(g+=d,e+=d);N.free(f);return 0>=g||0>=e?!1:1>=c*c/(g*g)+b*b/(e*e)}if(c.type===td)return N.free(f),null===this.fill?ee(c,a.x,a.y,e):ce(c,a,e,1<this.strokeWidth,b);B("Unknown Geometry type: "+c.type);return!1};
    t.sm=function(a,b,c,d){var e=this.desiredSize,f=this.rh;a=Math.max(a,0);b=Math.max(b,0);if(null!==this.Rd)var g=this.geometry.bounds;else{var h=this.figure,k=Fn[h];if(void 0===k){var l=J.Ke[h];"string"===typeof l&&(l=J.Ke[l]);"function"===typeof l?(k=l(null,100,100),Fn[h]=k):B("Unsupported Figure: "+h)}g=k.bounds}h=g.width;k=g.height;l=g.width;var m=g.height;switch(ml(this,!0)){case xg:d=c=0;break;case ud:l=Math.max(a-f,0);m=Math.max(b-f,0);break;case Yk:l=Math.max(a-f,0);d=0;break;case Zk:c=0,m=
      Math.max(b-f,0)}isFinite(e.width)&&(l=e.width);isFinite(e.height)&&(m=e.height);e=this.maxSize;g=this.minSize;c=Math.max(c-f,g.width);d=Math.max(d-f,g.height);l=Math.min(e.width,l);m=Math.min(e.height,m);l=isFinite(l)?Math.max(c,l):Math.max(h,c);m=isFinite(m)?Math.max(d,m):Math.max(k,d);c=yg(this);switch(c){case xg:break;case ud:h=l;k=m;break;case zg:c=Math.min(l/h,m/k);isFinite(c)||(c=1);h*=c;k*=c;break;default:B(c+" is not a valid geometryStretch.")}null!==this.Rd?(h=Math.max(h,.01),k=Math.max(k,
      .01),g=null!==this.Rd?this.Rd:this.ka,e=h,d=k,c=g.copy(),g=g.bounds,e/=g.width,d/=g.height,isFinite(e)||(e=1),isFinite(d)||(d=1),1===e&&1===d||c.scale(e,d),this.ka=c):null!==this.ka&&J.$(this.ka.kl,a-f)&&J.$(this.ka.jl,b-f)||(this.ka=Kf.makeGeometry(this,h,k));g=this.ka.bounds;Infinity===a||Infinity===b?jl(this,g.x-f/2,g.y-f/2,0===a&&0===h?0:g.width+f,0===b&&0===k?0:g.height+f):jl(this,-(f/2),-(f/2),l+f,m+f)};
    function yg(a){var b=a.geometryStretch;return null!==a.Rd?b===Xk?ud:b:b===Xk?Fn[a.figure].defaultStretch:b}t.Dh=function(a,b,c,d){ol(this,a,b,c,d)};t.Uc=function(a,b,c){return this.hk(a.x,a.y,b.x,b.y,c)};
    t.hk=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.rh/2;l=this.ka;null===l&&(this.measure(Infinity,Infinity),l=this.ka);p=l.bounds;m=!1;if(l.type===vd)if(1.5>=this.strokeWidth)m=J.Ee(l.startX,l.startY,l.endX,l.endY,f,g,h,k,e);else{l.startX===l.endX?(d=n,m=0):(b=(l.endY-l.startY)/(l.endX-l.startX),m=n/Math.sqrt(1+b*b),d=m*
      b);b=Fa();a=new I;J.Ee(l.startX+d,l.startY+m,l.endX+d,l.endY+m,f,g,h,k,a)&&b.push(a);a=new I;J.Ee(l.startX-d,l.startY-m,l.endX-d,l.endY-m,f,g,h,k,a)&&b.push(a);a=new I;J.Ee(l.startX+d,l.startY+m,l.startX-d,l.startY-m,f,g,h,k,a)&&b.push(a);a=new I;J.Ee(l.endX+d,l.endY+m,l.endX-d,l.endY-m,f,g,h,k,a)&&b.push(a);h=b.length;if(0===h)return Ha(b),!1;m=!0;k=Infinity;for(d=0;d<h;d++)a=b[d],c=(a.x-f)*(a.x-f)+(a.y-g)*(a.y-g),c<k&&(k=c,e.x=a.x,e.y=a.y);Ha(b)}else if(l.type===Gd)m=J.Uc(p.x-n,p.y-n,p.x+p.width+
      n,p.y+p.height+n,f,g,h,k,e);else if(l.type===Hd){b=N.allocAt(p.x,p.y,p.width,p.height).Vc(n,n);a:if(0===b.width)m=J.Ee(b.x,b.y,b.x,b.y+b.height,f,g,h,k,e);else if(0===b.height)m=J.Ee(b.x,b.y,b.x+b.width,b.y,f,g,h,k,e);else{a=b.width/2;l=b.height/2;d=b.x+a;m=b.y+l;c=9999;f!==h&&(c=(g-k)/(f-h));if(9999>Math.abs(c)){k=g-m-c*(f-d);if(0>a*a*c*c+l*l-k*k){e.x=NaN;e.y=NaN;m=!1;break a}n=Math.sqrt(a*a*c*c+l*l-k*k);h=(-(a*a*c*k)+a*l*n)/(l*l+a*a*c*c)+d;a=(-(a*a*c*k)-a*l*n)/(l*l+a*a*c*c)+d;l=c*(h-d)+k+m;k=c*
      (a-d)+k+m;Math.abs((f-h)*(f-h))+Math.abs((g-l)*(g-l))<Math.abs((f-a)*(f-a))+Math.abs((g-k)*(g-k))?(e.x=h,e.y=l):(e.x=a,e.y=k)}else{h=l*l;k=f-d;h-=h/(a*a)*k*k;if(0>h){e.x=NaN;e.y=NaN;m=!1;break a}k=Math.sqrt(h);h=m+k;k=m-k;Math.abs(h-g)<Math.abs(k-g)?(e.x=f,e.y=h):(e.x=f,e.y=k)}m=!0}N.free(b)}else if(l.type===td){p=I.alloc();var r=h-f;var q=k-g;var u=r*r+q*q;e.x=h;e.y=k;for(var v=0;v<l.figures.count;v++){var w=l.figures.j[v],y=w.segments;r=w.startX;q=w.startY;for(var z=r,A=q,C=0;C<y.count;C++){var H=
      y.j[C],L=H.type;var K=H.endX;var V=H.endY;var Q=!1;switch(L){case Wd:z=K;A=V;break;case xd:Q=Gn(r,q,K,V,f,g,h,k,p);break;case Xd:Q=J.eq(r,q,H.point1X,H.point1Y,H.point2X,H.point2Y,K,V,f,g,h,k,.6,p);break;case Yd:Q=J.eq(r,q,(r+2*H.point1X)/3,(q+2*H.point1Y)/3,(2*H.point1X+K)/3,(2*H.point1X+K)/3,K,V,f,g,h,k,.6,p);break;case Zd:case $d:L=H.type===Zd?ae(H,w):be(H,w,r,q);var ca=L.length;if(0===ca){Q=Gn(r,q,H.centerX,H.centerY,f,g,h,k,p);break}V=null;for(K=0;K<ca;K++){V=L[K];if(0===K&&Gn(r,q,V[0],V[1],
      f,g,h,k,p)){var pa=Hn(f,g,p,u,e);pa<u&&(u=pa,m=!0)}J.eq(V[0],V[1],V[2],V[3],V[4],V[5],V[6],V[7],f,g,h,k,.6,p)&&(pa=Hn(f,g,p,u,e),pa<u&&(u=pa,m=!0))}K=V[6];V=V[7];break;default:B("Unknown Segment type: "+L)}r=K;q=V;Q&&(Q=Hn(f,g,p,u,e),Q<u&&(u=Q,m=!0));H.isClosed&&(K=z,V=A,Gn(r,q,K,V,f,g,h,k,p)&&(H=Hn(f,g,p,u,e),H<u&&(u=H,m=!0)))}}f=c-a;g=d-b;h=Math.sqrt(f*f+g*g);0!==h&&(f/=h,g/=h);e.x-=f*n;e.y-=g*n;I.free(p)}else B("Unknown Geometry type: "+l.type);if(!m)return!1;this.transform.ra(e);return!0};
    function Hn(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 Gn(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||J.$(k.y,a))&&(k.y<b||J.$(k.y,b))&&(l=!0)):(b=a<c?a:c,a=a<c?c:a,(k.x>b||J.$(k.x,b))&&(k.x<a||J.$(k.x,a))&&(l=!0));return l}
    t.Eh=function(a,b){if(void 0===b)return a.Ae(this.actualBounds);var c=this.ka;null===c&&(this.measure(Infinity,Infinity),c=this.ka);c=c.bounds;var d=this.strokeWidth/2,e=!1,f=I.alloc();f.h(c.x-d,c.y-d);a.aa(b.ra(f))&&(f.h(c.x-d,c.bottom+d),a.aa(b.ra(f))&&(f.h(c.right+d,c.bottom+d),a.aa(b.ra(f))&&(f.h(c.right+d,c.y-d),a.aa(b.ra(f))&&(e=!0))));I.free(f);return e};
    t.Gc=function(a,b){if(this.Eh(a,b)||void 0===b&&(b=this.transform,a.Ae(this.actualBounds)))return!0;var c=qd.alloc();c.set(b);c.ut();var d=a.left,e=a.right,f=a.top;a=a.bottom;var g=I.alloc();g.h(d,f);c.ra(g);if(this.Fh(g,!0))return I.free(g),!0;g.h(e,f);c.ra(g);if(this.Fh(g,!0))return I.free(g),!0;g.h(d,a);c.ra(g);if(this.Fh(g,!0))return I.free(g),!0;g.h(e,a);c.ra(g);if(this.Fh(g,!0))return I.free(g),!0;var h=I.alloc(),k=I.alloc();c.set(b);c.Ov(this.transform);c.ut();h.x=e;h.y=f;h.transform(c);g.x=
      d;g.y=f;g.transform(c);b=!1;In(this,g,h,k)?b=!0:(g.x=e,g.y=a,g.transform(c),In(this,g,h,k)?b=!0:(h.x=d,h.y=a,h.transform(c),In(this,g,h,k)?b=!0:(g.x=d,g.y=f,g.transform(c),In(this,g,h,k)&&(b=!0))));I.free(g);qd.free(c);I.free(h);I.free(k);return b};function In(a,b,c,d){if(!a.Uc(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.Nx=function(a,b,c){function d(a,b){for(var c=a.length,d=0;d<c;d+=2)if(b.dd(a[d],a[d+1])>e)return!0;return!1}if(c&&null!==this.fill&&this.Fh(a,!0))return!0;var e=a.Be(b),f=e;1.5<this.strokeWidth&&(e=this.strokeWidth/2+Math.sqrt(e),e*=e);b=this.ka;if(null===b&&(this.measure(Infinity,Infinity),b=this.ka,null===b))return!1;if(!c){var g=b.bounds,h=g.x,k=g.y,l=g.x+g.width;g=g.y+g.height;if(Cb(a.x,a.y,h,k)<=e&&Cb(a.x,a.y,l,k)<=e&&Cb(a.x,a.y,h,g)<=e&&Cb(a.x,a.y,l,g)<=e)return!0}h=b.startX;k=b.startY;l=
      b.endX;g=b.endY;if(b.type===vd){if(c=(h-l)*(a.x-l)+(k-g)*(a.y-g),Bb(a.x,a.y,h,k,l,g)<=(0<=(l-h)*(a.x-h)+(g-k)*(a.y-k)&&0<=c?e:f))return!0}else{if(b.type===Gd)return b=!1,c&&(b=Bb(a.x,a.y,h,k,h,g)<=e||Bb(a.x,a.y,h,k,l,k)<=e||Bb(a.x,a.y,l,k,l,g)<=e||Bb(a.x,a.y,h,g,l,g)<=e),b;if(b.type===Hd){b=a.x-(h+l)/2;f=a.y-(k+g)/2;var m=Math.abs(l-h)/2,n=Math.abs(g-k)/2;if(0===m||0===n)return Bb(a.x,a.y,h,k,l,g)<=e?!0:!1;if(c){if(a=J.dz(m,n,b,f),a*a<=e)return!0}else return Cb(b,f,-m,0)>=e||Cb(b,f,0,-n)>=e||Cb(b,
      f,0,n)>=e||Cb(b,f,m,0)>=e?!1:!0}else if(b.type===td){l=b.bounds;f=l.x;h=l.y;k=l.x+l.width;l=l.y+l.height;if(a.x>k&&a.x<f&&a.y>l&&a.y<h&&Bb(a.x,a.y,f,h,f,l)>e&&Bb(a.x,a.y,f,h,k,h)>e&&Bb(a.x,a.y,k,l,f,l)>e&&Bb(a.x,a.y,k,l,k,h)>e)return!1;f=Math.sqrt(e);if(c){if(null===this.fill?ee(b,a.x,a.y,f):ce(b,a,f,!0,!1))return!0}else{c=b.figures;for(b=0;b<c.count;b++){f=c.j[b];g=f.startX;m=f.startY;if(a.dd(g,m)>e)return!1;h=f.segments.j;k=h.length;for(l=0;l<k;l++)switch(n=h[l],n.type){case Wd:case xd:g=n.endX;
      m=n.endY;if(a.dd(g,m)>e)return!1;break;case Xd:var p=Fa();J.ze(g,m,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.8,p);g=d(p,a);Ha(p);if(g)return!1;g=n.endX;m=n.endY;if(a.dd(g,m)>e)return!1;break;case Yd:p=Fa();J.Cq(g,m,n.point1X,n.point1Y,n.endX,n.endY,.8,p);g=d(p,a);Ha(p);if(g)return!1;g=n.endX;m=n.endY;if(a.dd(g,m)>e)return!1;break;case Zd:case $d:p=n.type===Zd?ae(n,f):be(n,f,g,m);var r=p.length;if(0===r){g=n.centerX;m=n.centerY;if(a.dd(g,m)>e)return!1;break}n=null;for(var q=Fa(),u=0;u<
    r;u++)if(n=p[u],q.length=0,J.ze(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],.8,q),d(q,a))return Ha(q),!1;Ha(q);null!==n&&(g=n[6],m=n[7]);break;default:B("Unknown Segment type: "+n.type)}}return!0}}}return!1};t.cc=function(){this.ka=null};function Jn(a){var b=a.diagram;null!==b&&b.undoManager.isUndoingRedoing||(a.segmentOrientation=Wm,"None"!==a.Yl?(a.segmentIndex=-1,a.alignmentFocus=gd):"None"!==a.al&&(a.segmentIndex=0,a.alignmentFocus=new P(1-gd.x,gd.y)))}
    Kf.makeGeometry=function(a,b,c){if("None"!==a.toArrow)var d=Kn[a.toArrow];else"None"!==a.fromArrow?d=Kn[a.fromArrow]:(d=J.Ke[a.figure],"string"===typeof d&&(d=J.Ke[d]),void 0===d&&B("Unknown Shape.figure: "+a.figure),d=d(a,b,c),d.kl=b,d.jl=c);if(null===d){var e=J.Ke.Rectangle;"function"===typeof e&&(d=e(a,b,c))}return d};
    function Ln(a){var b=Kn[a];if(void 0===b){var c=a.toLowerCase();if("none"===c)return"None";b=Kn[c];if(void 0===b){var d=null,e;for(e in J.Nm)if(e.toLowerCase()===c){d=e;break}if(null!==d)return a=Id(J.Nm[d],!1),Kn[d]=a,c!==d&&(Kn[c]=d),d}}return"string"===typeof b?b:b instanceof sd?a:null}
    ma.Object.defineProperties(Kf.prototype,{geometry:{get:function(){return null!==this.ka?this.ka:this.Rd},set:function(a){var b=this.ka;if(b!==a){null!==a?this.Rd=this.ka=a.freeze():this.Rd=this.ka=null;var c=this.part;null!==c&&(c.eh=NaN);this.o();this.g("geometry",b,a);gl(this)&&(a=this.part,null!==a&&hl(this,a,"geometryString"))}}},geometryString:{get:function(){return null===this.geometry?"":this.geometry.toString()},set:function(a){a=
          Id(a);var b=a.normalize();this.geometry=a;this.position=a=I.allocAt(-b.x,-b.y);I.free(a)}},isGeometryPositioned:{get:function(){return this.Zn},set:function(a){var b=this.Zn;b!==a&&(this.Zn=a,this.o(),this.g("isGeometryPositioned",b,a))}},fill:{get:function(){return this.$k},set:function(a){var b=this.$k;b!==a&&(null!==a&&Tl(a,"Shape.fill"),a instanceof vl&&a.freeze(),this.$k=a,this.M(),this.g("fill",b,a))}},stroke:{
        get:function(){return this.Dc},set:function(a){var b=this.Dc;b!==a&&(null!==a&&Tl(a,"Shape.stroke"),a instanceof vl&&a.freeze(),this.Dc=a,this.M(),this.g("stroke",b,a))}},strokeWidth:{get:function(){return this.rh},set:function(a){var b=this.rh;if(b!==a)if(0<=a){this.rh=a;this.o();var c=this.part;null!==c&&(c.eh=NaN);this.g("strokeWidth",b,a)}else va(a,"value >= 0",Kf,"strokeWidth:value")}},strokeCap:{get:function(){return this.Rl},set:function(a){var b=
          this.Rl;b!==a&&("string"!==typeof a||"butt"!==a&&"round"!==a&&"square"!==a?va(a,'"butt", "round", or "square"',Kf,"strokeCap"):(this.Rl=a,this.M(),this.g("strokeCap",b,a)))}},strokeJoin:{get:function(){return this.Sl},set:function(a){var b=this.Sl;b!==a&&("string"!==typeof a||"miter"!==a&&"bevel"!==a&&"round"!==a?va(a,'"miter", "bevel", or "round"',Kf,"strokeJoin"):(this.Sl=a,this.M(),this.g("strokeJoin",b,a)))}},strokeMiterLimit:{get:function(){return this.Oj},
        set:function(a){var b=this.Oj;if(b!==a&&1<=a){this.Oj=a;this.M();var c=this.part;null!==c&&(c.eh=NaN);this.g("strokeMiterLimit",b,a)}}},strokeDashArray:{get:function(){return this.ph},set:function(a){var b=this.ph;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.ph=a;this.M();this.g("strokeDashArray",
          b,a)}}},strokeDashOffset:{get:function(){return this.qh},set:function(a){var b=this.qh;b!==a&&0<=a&&(this.qh=a,this.M(),this.g("strokeDashOffset",b,a))}},figure:{get:function(){return this.Zk},set:function(a){var b=this.Zk;if(b!==a){var c=J.Ke[a];"function"===typeof c?c=a:(c=J.Ke[a.toLowerCase()])||B("Unknown Shape.figure: "+a);b!==c&&(a=this.part,null!==a&&(a.eh=NaN),this.Zk=c,this.Rd=null,this.cc(),this.o(),this.g("figure",b,c))}}},toArrow:{
        get:function(){return this.Yl},set:function(a){var b=this.Yl;!0===a?a="Standard":!1===a&&(a="");if(b!==a){var c=Ln(a);null===c?B("Unknown Shape.toArrow: "+a):b!==c&&(this.Yl=c,this.Rd=null,this.cc(),this.o(),Jn(this),this.g("toArrow",b,c))}}},fromArrow:{get:function(){return this.al},set:function(a){var b=this.al;!0===a?a="Standard":!1===a&&(a="");if(b!==a){var c=Ln(a);null===c?B("Unknown Shape.fromArrow: "+a):b!==c&&(this.al=c,this.Rd=null,this.cc(),this.o(),
          Jn(this),this.g("fromArrow",b,c))}}},spot1:{get:function(){return this.jf},set:function(a){var b=this.jf;b.w(a)||(this.jf=a=a.G(),this.o(),this.g("spot1",b,a))}},spot2:{get:function(){return this.kf},set:function(a){var b=this.kf;b.w(a)||(this.kf=a=a.G(),this.o(),this.g("spot2",b,a))}},parameter1:{get:function(){return this.Zo},set:function(a){var b=this.Zo;b!==a&&(this.Zo=a,this.cc(),this.o(),this.g("parameter1",
          b,a))}},parameter2:{get:function(){return this.$o},set:function(a){var b=this.$o;b!==a&&(this.$o=a,this.cc(),this.o(),this.g("parameter2",b,a))}},naturalBounds:{get:function(){if(null!==this.ka)return this.oc.assign(this.ka.bounds),this.oc;var a=this.desiredSize;return new N(0,0,a.width,a.height)}},pathPattern:{get:function(){return this.bp},set:function(a){var b=this.bp;b!==a&&(this.bp=a,this.M(),this.g("pathPattern",
          b,a))}},geometryStretch:{get:function(){return this.Nn},set:function(a){var b=this.Nn;b!==a&&(this.Nn=a,this.g("geometryStretch",b,a))}},interval:{get:function(){return this.Jd},set:function(a){var b=this.Jd;a=Math.round(a);if(b!==a&&0!==a&&isFinite(a)){this.Jd=a;var c=this.diagram;null!==c&&this.panel===c.grid&&pj(c);this.o();c=this.panel;null!==c&&(c.Yg=null);this.g("interval",b,a)}}},graduatedStart:{get:function(){return this.Gd},
        set:function(a){var b=this.Gd;b!==a&&(0>a?a=0:1<a&&(a=1),this.Gd=a,this.o(),this.g("graduatedStart",b,a))}},graduatedEnd:{get:function(){return this.Ed},set:function(a){var b=this.Ed;b!==a&&(0>a?a=0:1<a&&(a=1),this.Ed=a,this.o(),this.g("graduatedEnd",b,a))}},graduatedSkip:{get:function(){return this.Fd},set:function(a){var b=this.Fd;b!==a&&(this.Fd=a,this.o(),this.g("graduatedSkip",b,a))}}});Kf.prototype.intersectsRect=Kf.prototype.Gc;
    Kf.prototype.containedInRect=Kf.prototype.Eh;Kf.prototype.getNearestIntersectionPoint=Kf.prototype.Uc;Kf.prototype.getDocumentBounds=Kf.prototype.lm;Kf.prototype.getDocumentPoint=Kf.prototype.ga;var Kn=new db,Fn=new db;Kf.className="Shape";Kf.getFigureGenerators=function(){var a=new G,b;for(b in J.Ke)b!==b.toLowerCase()&&a.add(b,J.Ke[b]);a.freeze();return a};Kf.defineFigureGenerator=function(a,b){var c=a.toLowerCase(),d=J.Ke;d[a]=b;d[c]=a};
    Kf.getArrowheadGeometries=function(){var a=new G;for(d in J.Nm)if(void 0===Kn[d]){var b=Id(J.Nm[d],!1);Kn[d]=b;b=d.toLowerCase();b!==d&&(Kn[b]=d)}for(var c in Kn)if(c!==c.toLowerCase()){var d=Kn[c];d instanceof sd&&a.add(c,d)}a.freeze();return a};Kf.defineArrowheadGeometry=function(a,b){var c=null;"string"===typeof b?c=Id(b,!1):c=b;b=a.toLowerCase();"none"!==b&&a!==b||B("Shape.defineArrowheadGeometry name must not be empty or None or all-lower-case: "+a);var d=Kn;d[a]=c;d[b]=a};
    function Ug(){Y.call(this);Mn||(Nn=Sg?(new Ek(null)).context:null,Mn=!0);this.kx=this.Tb="";this.Dc="black";this.ge="13px sans-serif";this.Ii="start";this.Dd=xg;this.Mi=cd;this.xj=!0;this.pi=this.ri=!1;this.jg=On;this.ug=Pn;this.$r=this.pb=this.Nc=0;this.Hu=this.Iu=null;this.Dn=!1;this.zc=this.en=this.Rp=this.Ji=this.Sp=null;this.hf=this.gf=0;this.oe=Infinity;this.ti=0;this.he=null;this.ue=0;this.fe=this.fb=this.Qb=null;this.Jd=1;this.Gd=0;this.Ed=1;this.Fd=this.tj=null}la(Ug,Y);
    Ug.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.Tb=this.Tb;a.kx=this.kx;a.Dc=this.Dc;a.ge=this.ge;a.Ii=this.Ii;a.Dd=this.Dd;a.Mi=this.Mi;a.xj=this.xj;a.ri=this.ri;a.pi=this.pi;a.jg=this.jg;a.ug=this.ug;a.Nc=this.Nc;a.$r=this.$r;a.pb=this.pb;a.Iu=this.Iu;a.Hu=this.Hu;a.Dn=this.Dn;a.Sp=this.Sp;a.Ji=this.Ji;a.Rp=this.Rp;a.en=this.en;a.zc=this.zc;a.gf=this.gf;a.hf=this.hf;a.oe=this.oe;a.he=this.he;a.ue=this.ue;a.Qb=this.Qb;a.fb=this.fb;a.fe=this.fe;a.ti=this.ti;a.Jd=
      this.Jd;a.Gd=this.Gd;a.Ed=this.Ed;a.tj=this.tj;a.Fd=this.Fd};
    function Vm(a,b){a.F=b.F|6144;a.qb=b.opacity;a.gb=b.background;a.dc=b.areaBackground;a.Lc=b.desiredSize.G();a.cg=b.minSize.G();a.bg=b.maxSize.G();a.$f=b.$f.copy();a.ya=b.scale;a.Yb=b.angle;a.we=b.stretch;a.dh=b.margin.G();a.vb=b.alignment.G();a.Fk=b.alignmentFocus.G();a.Hl=b.segmentFraction;a.Il=b.segmentOffset.G();a.Jl=b.segmentOrientation;null!==b.md&&(a.md=b.md.copy());a.Ll=b.shadowVisible;b instanceof Ug&&(a.Tb=b.Tb,a.Dc=b.Dc,a.ge=b.ge,a.Ii=b.Ii,a.Dd=b.Dd,a.Mi=b.Mi,a.xj=b.xj,a.ri=b.ri,a.pi=b.pi,
      a.jg=b.jg,a.ug=b.ug,a.he=null,a.gf=b.gf,a.hf=b.hf,a.oe=b.oe,a.ti=b.ti,a.Jd=b.Jd,a.Gd=b.Gd,a.Ed=b.Ed,a.tj=b.tj,a.Fd=b.Fd)}t=Ug.prototype;t.cb=function(a){a.classType===Ug?this.wrap=a:Y.prototype.cb.call(this,a)};t.toString=function(){return 22<this.Tb.length?'TextBlock("'+this.Tb.substring(0,20)+'"...)':'TextBlock("'+this.Tb+'")'};t.o=function(){Y.prototype.o.call(this);this.Hu=this.Iu=null};
    t.Qi=function(a,b){if(null!==this.Dc&&0!==this.Tb.length&&null!==this.ge){var c=this.naturalBounds,d=this.actualBounds,e=c.width,f=c.height,g=Qn(this),h=a.textAlign=this.Ii,k=b.nl;"start"===h?h=k?"right":"left":"end"===h&&(h=k?"left":"right");k=this.ri;var l=this.pi;ki(this,a,this.Dc,!0,!1,c,d);(k||l)&&ki(this,a,this.Dc,!1,!1,c,d);d=0;c=!1;var m=I.allocAt(0,0);this.vd.ra(m);var n=I.allocAt(0,g);this.vd.ra(n);var p=m.Be(n);I.free(m);I.free(n);m=b.scale;8>p*m*m&&(c=!0);b.Db!==a&&(c=!1);!1===b.Ce("textGreeking")&&
    (c=!1);b=this.gf;p=this.hf;switch(this.flip){case bl:a.translate(e,0);a.scale(-1,1);break;case al:a.translate(0,f);a.scale(1,-1);break;case cl:a.translate(e,f),a.scale(-1,-1)}m=this.Nc;n=(b+g+p)*m;f>n&&(d=this.Mi,d=d.y*f-d.y*n+d.offsetY);if(1===m&&null!==this.fe)p=this.pb,p>e&&(p=e),this.Pi(this.fe,a,0,d+b,e,g,p,c,h,k,l);else if(null!==this.Qb&&null!==this.fb)for(n=0;n<m;n++){var r=this.Qb[n];r>e&&(r=e);d+=b;this.Pi(this.fb[n],a,0,d,e,g,r,c,h,k,l);d+=g+p}switch(this.flip){case bl:a.scale(-1,1);a.translate(-e,
      0);break;case al:a.scale(1,-1);a.translate(0,-f);break;case cl:a.scale(-1,-1),a.translate(-e,-f)}}};
    t.Pi=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!==Rn?Rn(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!==Sn?Sn(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.sm=function(a,b,c,d){this.ti=a;var e=this.ge;null!==Nn&&Tn!==e&&(Tn=Nn.font=e);this.pb=this.ue=0;this.fe=this.fb=this.Qb=this.he=null;var f;if(isNaN(this.desiredSize.width)){e=this.Tb.replace(/\r\n/g,"\n").replace(/\r/g,"\n");if(0===e.length)e=0;else if(this.isMultiline){for(var g=f=0,h=!1;!h;){var k=e.indexOf("\n",g);-1===k&&(k=e.length,h=!0);f=Math.max(f,Un(e.substr(g,k-g).trim()));g=k+1}e=f}else f=e.indexOf("\n",0),0<=f&&(e=e.substr(0,f)),e=Un(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=Vn(this,e);isNaN(this.desiredSize.height)?f=Math.min(f,b/this.scale):f=this.desiredSize.height;g=f;if(0!==this.pb&&null!==this.Qb&&null!==this.fb&&this.jg===Wn&&(b=this.ge,b=this.jg===Wn?Xn(b):0,h=this.gf+this.hf,h=Math.max(0,Qn(this)+h),g=Math.min(this.maxLines-1,Math.max(Math.floor(g/h+.01)-1,0)),!(g+1>=this.fb.length))){h=this.fb[g];for(b=Math.max(1,a-b);Un(h)>b&&1<h.length;)h=h.substr(0,h.length-1);h+=Yn;b=Un(h);
      this.fb[g]=h;this.fb=this.fb.slice(0,g+1);this.Qb[g]=b;this.Qb=this.Qb.slice(0,g+1);this.ue=this.fb.length;this.pb=Math.max(this.pb,b);this.Nc=this.ue;1===this.Nc&&(this.fe=this.fb[0])}if(this.wrap===Zn||isNaN(this.desiredSize.width))e=isNaN(a)?this.pb:Math.min(a,this.pb),isNaN(this.desiredSize.width)&&(e=Math.max(8,e));e=Math.max(c,e);f=Math.max(d,f);Vb(this.oc,e,f);jl(this,0,0,e,f)};t.Dh=function(a,b,c,d){ol(this,a,b,c,d)};
    function $n(a,b,c){if(null===a.fe)a.fe=b,a.pb=c;else{if(null===a.fb||null===a.Qb)a.fb=[],a.Qb=[],a.fb.push(a.fe),a.Qb.push(a.pb);a.fb.push(b);a.Qb.push(c)}}
    function ao(a,b,c,d){b=b.trim();var e=0;var f=a.ge;var g=a.gf+a.hf;g=Math.max(0,Qn(a)+g);var h=a.jg===Wn?Xn(f):0;if(a.Nc>=a.oe)null!==d&&d.h(0,g);else{var k=b;if(a.ug===bo)if(a.ue=1,f=Un(b),0===h||f<=c)a.pb=Math.max(a.pb,f),$n(a,b,a.pb),null!==d&&d.h(f,g);else{e=co(a,k);k=k.substr(e.length);b=co(a,k);for(f=Un(e+b);0<b.length&&f<=c;)e+=b,k=k.substr(b.length),b=co(a,k),f=Un((e+b).trim());e+=b.trim();for(c=Math.max(1,c-h);Un(e)>c&&1<e.length;)e=e.substr(0,e.length-1);e+=Yn;b=Un(e);a.pb=b;$n(a,e,b);null!==
    d&&d.h(b,g)}else{h=0;0===k.length&&(h=1,$n(a,k,0));for(;0<k.length;){var l=co(a,k);for(k=k.substr(l.length);Un(l)>c;){var m=1;f=Un(l.substr(0,m));for(b=0;f<=c;)m++,b=f,f=Un(l.substr(0,m));if(1===m){var n=f;e=Math.max(e,f)}else n=b,e=Math.max(e,b);m--;1>m&&(m=1);$n(a,l.substr(0,m),n);h++;l=l.substr(m);if(a.Nc+h>a.oe)break}b=co(a,k);for(f=Un(l+b);0<b.length&&f<=c;)l+=b,k=k.substr(b.length),b=co(a,k),f=Un((l+b).trim());l=l.trim();if(""!==l&&("\u00ad"===l[l.length-1]&&(l=l.substring(0,l.length-1)+"\u2010"),
      0===b.length?(m=f,e=Math.max(e,f)):(m=b=Un(l),e=Math.max(e,b)),$n(a,l,m),h++,a.Nc+h>a.oe))break}a.ue=Math.min(a.oe,h);a.pb=Math.max(a.pb,e);null!==d&&d.h(a.pb,g*a.ue)}}}function co(a,b){if(a.ug===eo)return b.substr(0,1);a=b.length;for(var c=0,d=fo;c<a&&!d.test(b.charAt(c));)c++;for(;c<a&&d.test(b.charAt(c));)c++;return c>=a?b:b.substr(0,c)}function Un(a){return null===Nn?8*a.length:Nn.measureText(a).width}
    function Qn(a){if(null!==a.he)return a.he;var b=a.ge;if(null===Nn){var c=16;return a.he=c}void 0!==go[b]&&5E3>ho?c=go[b]:(c=1.3*Nn.measureText("M").width,go[b]=c,ho++);return a.he=c}function Xn(a){if(null===Nn)return 6;if(void 0!==io[a]&&5E3>jo)var b=io[a];else b=Nn.measureText(Yn).width,io[a]=b,jo++;return b}
    function Vn(a,b){var c=a.Tb.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),d=a.gf+a.hf;d=Math.max(0,Qn(a)+d);if(0===c.length)return a.pb=0,a.Nc=1,d;if(!a.isMultiline){var e=c.indexOf("\n",0);0<=e&&(c=c.substr(0,e))}e=0;for(var f=a.Nc=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.ug!==bo){a.ue=0;var k=M.alloc();ao(a,f,b,k);e+=k.height;M.free(k);a.Nc+=a.ue}else ao(a,f,b,null),e+=d,a.Nc++;a.Nc===a.oe&&(h=!0)}f=g+1}return a.$r=e}
    ma.Object.defineProperties(Ug.prototype,{font:{get:function(){return this.ge},set:function(a){var b=this.ge;b!==a&&(this.ge=a,this.he=null,this.o(),this.g("font",b,a))}},text:{get:function(){return this.Tb},set:function(a){var b=this.Tb;null!==a&&void 0!==a?a=a.toString():a="";b!==a&&(this.Tb=a,this.o(),this.g("text",b,a))}},textAlign:{get:function(){return this.Ii},set:function(a){var b=this.Ii;b===a||"start"!==
        a&&"end"!==a&&"left"!==a&&"right"!==a&&"center"!==a||(this.Ii=a,this.M(),this.g("textAlign",b,a))}},flip:{get:function(){return this.Dd},set:function(a){var b=this.Dd;b!==a&&(this.Dd=a,this.M(),this.g("flip",b,a))}},verticalAlignment:{get:function(){return this.Mi},set:function(a){var b=this.Mi;b.w(a)||(this.Mi=a=a.G(),El(this),this.g("verticalAlignment",b,a))}},naturalBounds:{get:function(){if(!this.oc.u()){var a=
          M.alloc();ao(this,this.Tb,999999,a);var b=a.width;M.free(a);a=Vn(this,b);var c=this.desiredSize;isNaN(c.width)||(b=c.width);isNaN(c.height)||(a=c.height);Vb(this.oc,b,a)}return this.oc}},isMultiline:{get:function(){return this.xj},set:function(a){var b=this.xj;b!==a&&(this.xj=a,this.o(),this.g("isMultiline",b,a))}},isUnderline:{get:function(){return this.ri},set:function(a){var b=this.ri;b!==a&&(this.ri=a,this.M(),this.g("isUnderline",b,
          a))}},isStrikethrough:{get:function(){return this.pi},set:function(a){var b=this.pi;b!==a&&(this.pi=a,this.M(),this.g("isStrikethrough",b,a))}},wrap:{get:function(){return this.ug},set:function(a){var b=this.ug;b!==a&&(this.ug=a,this.o(),this.g("wrap",b,a))}},overflow:{get:function(){return this.jg},set:function(a){var b=this.jg;b!==a&&(this.jg=a,this.o(),this.g("overflow",b,a))}},stroke:{
        get:function(){return this.Dc},set:function(a){var b=this.Dc;b!==a&&(null!==a&&Tl(a,"TextBlock.stroke"),a instanceof vl&&a.freeze(),this.Dc=a,this.M(),this.g("stroke",b,a))}},lineCount:{get:function(){return this.Nc}},editable:{get:function(){return this.Dn},set:function(a){var b=this.Dn;b!==a&&(this.Dn=a,this.g("editable",b,a))}},textEditor:{get:function(){return this.Sp},set:function(a){var b=this.Sp;b!==a&&
        (this.Sp=a,this.g("textEditor",b,a))}},errorFunction:{get:function(){return this.zc},set:function(a){var b=this.zc;b!==a&&(this.zc=a,this.g("errorFunction",b,a))}},interval:{get:function(){return this.Jd},set:function(a){var b=this.Jd;a=Math.round(a);if(b!==a&&0!==a&&isFinite(a)){this.Jd=a;this.o();var c=this.panel;null!==c&&(c.Yg=null);this.g("interval",b,a)}}},graduatedStart:{get:function(){return this.Gd},
        set:function(a){var b=this.Gd;b!==a&&(0>a?a=0:1<a&&(a=1),this.Gd=a,this.o(),this.g("graduatedStart",b,a))}},graduatedEnd:{get:function(){return this.Ed},set:function(a){var b=this.Ed;b!==a&&(0>a?a=0:1<a&&(a=1),this.Ed=a,this.o(),this.g("graduatedEnd",b,a))}},graduatedFunction:{get:function(){return this.tj},set:function(a){var b=this.tj;b!==a&&(this.tj=a,this.o(),this.g("graduatedFunction",b,a))}},graduatedSkip:{
        get:function(){return this.Fd},set:function(a){var b=this.Fd;b!==a&&(this.Fd=a,this.o(),this.g("graduatedSkip",b,a))}},textValidation:{get:function(){return this.Ji},set:function(a){var b=this.Ji;b!==a&&(this.Ji=a,this.g("textValidation",b,a))}},textEdited:{get:function(){return this.Rp},set:function(a){var b=this.Rp;b!==a&&(this.Rp=a,this.g("textEdited",b,a))}},spacingAbove:{get:function(){return this.gf},set:function(a){var b=
          this.gf;b!==a&&(this.gf=a,this.g("spacingAbove",b,a))}},spacingBelow:{get:function(){return this.hf},set:function(a){var b=this.hf;b!==a&&(this.hf=a,this.g("spacingBelow",b,a))}},maxLines:{get:function(){return this.oe},set:function(a){var b=this.oe;b!==a&&(a=Math.floor(a),0>=a&&va(a,"> 0",Ug,"maxLines"),this.oe=a,this.g("maxLines",b,a),this.o())}},metrics:{get:function(){return{arrSize:null!==this.Qb?this.Qb:
            [this.pb],arrText:null!==this.fb?this.fb:[this.fe],maxLineWidth:this.pb,fontHeight:this.he}}},choices:{get:function(){return this.en},set:function(a){var b=this.en;b!==a&&(this.en=a,this.g("choices",b,a))}}});
    var Rn=null,Sn=null,bo=new D(Ug,"None",0),Zn=new D(Ug,"WrapFit",1),Pn=new D(Ug,"WrapDesiredSize",2),eo=new D(Ug,"WrapBreakAll",3),On=new D(Ug,"OverflowClip",0),Wn=new D(Ug,"OverflowEllipsis",1),fo=/[ \u200b\u00ad]/,go=new db,ho=0,io=new db,jo=0,Yn="...",Tn="",Nn=null,Mn=!1;Ug.className="TextBlock";Ug.getEllipsis=function(){return Yn};Ug.setEllipsis=function(a){Yn=a;io=new db;jo=0};Ug.getBaseline=function(){return Rn};Ug.setBaseline=function(a){Rn=a;a=Pa();for(var b=a.length,c=0;c<b;c++)a[c].Fe()};
    Ug.getUnderline=function(){return Sn};Ug.setUnderline=function(a){Sn=a;a=Pa();for(var b=a.length,c=0;c<b;c++)a[c].Fe()};Ug.isValidFont=function(a){Mn||(Nn=Sg?(new Ek(null)).context:null,Mn=!0);if(null===Nn)return!0;var b=Nn.font;if(a===b||"10px sans-serif"===a)return!0;Nn.font="10px sans-serif";Nn.font=a;var c=Nn.font;if("10px sans-serif"!==c)return Nn.font=b,!0;Nn.font="19px serif";var d=Nn.font;Nn.font=a;c=Nn.font;Nn.font=b;return c!==d};Ug.None=bo;Ug.WrapFit=Zn;Ug.WrapDesiredSize=Pn;
    Ug.WrapBreakAll=eo;Ug.OverflowClip=On;Ug.OverflowEllipsis=Wn;function ko(){this.Qb=[];this.fb=[]}ko.prototype.reset=function(){this.Qb=[];this.fb=[]};ko.prototype.ft=function(a){this.Qb=Ba(a.Qb);this.fb=Ba(a.fb)};ko.className="TextBlockMetrics";function mk(){Y.call(this);this.Tg=null;this.Jp="";this.oh=nc;this.fl=ud;this.lf=this.zc=null;this.el=Ac;this.Dd=xg;this.Ul=null;this.vu=!1;this.Er=!0;this.vl=!1;this.Nl=null}la(mk,Y);
    mk.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.element=this.Tg;a.Jp=this.Jp;a.oh=this.oh.G();a.fl=this.fl;a.Dd=this.Dd;a.zc=this.zc;a.lf=this.lf;a.el=this.el.G();a.Er=this.Er;a.Nl=this.Nl};t=mk.prototype;t.cb=function(a){a===xg||a===zg||a===$k?this.imageStretch=a:Y.prototype.cb.call(this,a)};t.toString=function(){return"Picture("+this.source+")#"+lb(this)};function ok(a){void 0===a&&(a="");""!==a?lo[a]&&(delete lo[a],mo--):(lo=new db,mo=0)}
    function no(a,b){a.Pr=!0;a.bl=!1;for(var c,d=Pa(),e=d.length,f=0;f<e;f++){var g=d[f];c=a.getAttribute("src");var h=g.Ci.H(c);if(null!==h)for(var k=h.length,l=0;l<k;l++)c=h[l],g.ss.add(c),g.Pb(),void 0===a.Ru&&(a.Ru=b,null!==c.lf&&c.lf(c,b))}}function oo(a,b){a.bl=b;for(var c,d=Pa(),e=d.length,f=0;f<e;f++){var g=d[f],h=a.getAttribute("src");c=g.Ci.H(h);if(null!==c){g=c.length;h=Fa();for(var k=0;k<g;k++)h.push(c[k]);for(k=0;k<g;k++)c=h[k],null!==c.zc&&c.zc(c,b);Ha(h)}}}t.Fe=function(){this.M()};
    t.Qi=function(a,b){var c=this.Tg;if(null!==c){var d=c.getAttribute("src");c instanceof HTMLImageElement&&(null===d||""===d)&&B('Element has no source ("src") attribute: '+c);if(!(c.bl instanceof Event)){d=this.naturalBounds;var e=0,f=0,g=this.vu,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.oh.x,f=this.oh.y,h=this.oh.width,
      g=this.oh.height);var m=h,n=g,p=this.fl,r=this.el;switch(p){case xg: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 ud:m=d.width;n=d.height;break;case zg:case $k:p===zg?(p=Math.min(d.height/n,d.width/m),m*=p,n*=p):p===$k&&(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.vf()*b.scale;var q=m*p*n*p,u=h*g/q,v=c.__goCache;p=null;var w=po;if(c.Pr&&void 0!==v&&4<q&&u>w*w)for(null===v.Oi&&(qo(v,4,k,l,c),qo(v,16,k,l,c)),k=v.Oi,l=k.length,q=0;q<l;q++)if(k[q].ratio*k[q].ratio<u)p=k[q];else break;if(!b.Xk){if(null===this.Ul)if(null===this.Tg)this.Ul=!1;else{k=(new Ek(null)).context;k.drawImage(this.Tg,0,0);try{k.getImageData(0,0,1,1).data[3]&&(this.Ul=!1),this.Ul=!1}catch(y){this.Ul=!0}}if(this.Ul)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 bl:a.translate(Math.min(d.width,m),0);a.scale(-1,1);break;case al:a.translate(0,Math.min(d.height,n));a.scale(1,-1);break;case cl:a.translate(Math.min(d.width,m),Math.min(d.height,n)),a.scale(-1,-1)}if(b.Ce("pictureRatioOptimization")&&!b.ni&&void 0!==v&&null!==p&&1!==p.ratio){a.save();b=p.ratio;try{a.drawImage(p.source,e/b,f/b,Math.min(p.source.width,h/b),Math.min(p.source.height,
      g/b),k,l,Math.min(d.width,m),Math.min(d.height,n))}catch(y){this.Er=!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.Er=!1}switch(this.flip){case bl:a.scale(-1,1);a.translate(-Math.min(d.width,m),0);break;case al:a.scale(1,-1);a.translate(0,-Math.min(d.height,n));break;case cl:a.scale(-1,-1),a.translate(-Math.min(d.width,m),-Math.min(d.height,n))}}}}};
    t.sm=function(a,b,c,d){var e=this.desiredSize,f=ml(this,!0),g=this.Tg,h=this.vu;if(h||!this.vl&&g&&g.complete)this.vl=!0;null===g&&(isFinite(e.width)||(a=0),isFinite(e.height)||(b=0));isFinite(e.width)||f===ud||f===Yk?(isFinite(a)||(a=this.sourceRect.u()?this.sourceRect.width:h?+g.width:g.naturalWidth),c=0):null!==g&&!1!==this.vl&&(a=this.sourceRect.u()?this.sourceRect.width:h?+g.width:g.naturalWidth);isFinite(e.height)||f===ud||f===Zk?(isFinite(b)||(b=this.sourceRect.u()?this.sourceRect.height:h?
      +g.height:g.naturalHeight),d=0):null!==g&&!1!==this.vl&&(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));Vb(this.oc,a,b);jl(this,0,0,a,b)};t.Dh=function(a,b,c,d){ol(this,a,b,c,d)};
    ma.Object.defineProperties(mk.prototype,{element:{get:function(){return this.Tg},set:function(a){var b=this.Tg;if(b!==a){null===a||a instanceof HTMLImageElement||a instanceof HTMLVideoElement||a instanceof HTMLCanvasElement||B("Picture.element must be an instance of Image, Canvas, or Video, not: "+a);this.vu=a instanceof HTMLCanvasElement;this.Tg=a;if(null!==a)if(a instanceof HTMLCanvasElement||!0===a.complete)a.bl instanceof Event&&null!==this.zc&&this.zc(this,a.bl),
        !0===a.Pr&&null!==this.lf&&this.lf(this,a.Ru),a.Pr=!0,this.desiredSize.u()||(oj(this,!1),this.o());else{var c=this;a.Xw||(a.addEventListener("load",function(b){no(a,b);c.desiredSize.u()||(oj(c,!1),c.o())}),a.addEventListener("error",function(b){oo(a,b)}),a.Xw=!0)}this.g("element",b,a);this.M()}}},source:{get:function(){return this.Jp},set:function(a){var b=this.Jp;if(b!==a){this.Jp=a;var c=lo,d=this.diagram,e=null;if(void 0!==c[a])e=c[a];else{30<mo&&(ok(),c=lo);e=ta("img");
          var f=this;e.addEventListener("load",function(a){no(e,a);f.desiredSize.u()||(oj(f,!1),f.o())});e.addEventListener("error",function(a){oo(e,a)});e.Xw=!0;var g=this.Nl;null!==g&&(e.crossOrigin=g(this));e.src=a;c[a]=e;mo++}null!==d&&nk(d,this);this.element=e;null!==d&&lk(d,this);void 0===e.__goCache&&(e.__goCache=new ro);this.o();this.M();this.g("source",b,a)}}},sourceCrossOrigin:{get:function(){return this.Nl},set:function(a){if(this.Nl!==a&&(this.Nl=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.oh},set:function(a){var b=this.oh;b.w(a)||(this.oh=a=a.G(),this.M(),this.g("sourceRect",b,a))}},imageStretch:{get:function(){return this.fl},set:function(a){var b=this.fl;b!==a&&(this.fl=a,this.M(),this.g("imageStretch",b,a))}},flip:{
        get:function(){return this.Dd},set:function(a){var b=this.Dd;b!==a&&(this.Dd=a,this.M(),this.g("flip",b,a))}},imageAlignment:{get:function(){return this.el},set:function(a){var b=this.el;b.w(a)||(this.el=a=a.G(),this.o(),this.g("imageAlignment",b,a))}},errorFunction:{get:function(){return this.zc},set:function(a){var b=this.zc;b!==a&&(this.zc=a,this.g("errorFunction",b,a))}},successFunction:{get:function(){return this.lf},
        set:function(a){var b=this.lf;b!==a&&(this.lf=a,this.g("successFunction",b,a))}},naturalBounds:{get:function(){return this.oc}}});var lo=null,mo=0,po=4;mk.className="Picture";lo=new db;mk.clearCache=ok;function ro(){this.Oi=null}
    function qo(a,b,c,d,e){null===a.Oi&&(a.Oi=[]);var f=new Ek(null),g=f.context,h=1/b;f.width=c/b;f.height=d/b;0!==f.width&&0!==f.height&&(b=new so(f.Ea,b),c=1,0<a.Oi.length&&(c=a.Oi[a.Oi.length-1],e=c.source,c=c.ratio),g.setTransform(h*c,0,0,h*c,0,0),g.drawImage(e,0,0),a.Oi.push(b))}ro.className="PictureCacheArray";function so(a,b){this.source=a;this.ratio=b}so.className="PictureCacheInstance";function to(){this.nt=new sd;this.fc=null}t=to.prototype;
    t.reset=function(a){null!==a?(a.ea(),this.nt=a,a.figures.clear()):this.nt=new sd;this.fc=null};function Kd(a,b,c,d,e){a.fc=new ne;a.fc.startX=b;a.fc.startY=c;a.fc.isFilled=d;a.nt.figures.add(a.fc);void 0!==e&&(a.fc.isShadowed=e)}function Sd(a){var b=a.fc.segments.length;0<b&&a.fc.segments.L(b-1).close()}t.Lq=function(a){this.fc.isShadowed=a};t.moveTo=function(a,b,c){void 0===c&&(c=!1);var d=new oe(Wd);d.endX=a;d.endY=b;c&&d.close();this.fc.segments.add(d)};
    t.lineTo=function(a,b,c){void 0===c&&(c=!1);var d=new oe(xd);d.endX=a;d.endY=b;c&&d.close();this.fc.segments.add(d)};function Ld(a,b,c,d,e,f,g){var h;void 0===h&&(h=!1);var k=new oe(Xd);k.point1X=b;k.point1Y=c;k.point2X=d;k.point2Y=e;k.endX=f;k.endY=g;h&&k.close();a.fc.segments.add(k)}function Qd(a,b,c,d,e){var f;void 0===f&&(f=!1);var g=new oe(Yd);g.point1X=b;g.point1Y=c;g.endX=d;g.endY=e;f&&g.close();a.fc.segments.add(g)}
    t.arcTo=function(a,b,c,d,e,f,g){void 0===f&&(f=0);void 0===g&&(g=!1);var h=new oe(Zd);h.startAngle=a;h.sweepAngle=b;h.centerX=c;h.centerY=d;h.radiusX=e;h.radiusY=0!==f?f:e;g&&h.close();this.fc.segments.add(h)};function Rd(a,b,c,d,e,f,g,h){var k;void 0===k&&(k=!1);b=new oe($d,g,h,b,c,d,e,f);k&&b.close();a.fc.segments.add(b)}function Jd(a){var b=Td;if(null!==b)return Td=null,b.reset(a),b;b=new to;b.reset(a);return b}var Td=null;to.className="StreamGeometryContext";
    function uo(a,b){var c=a.toLowerCase(),d=J.Ke;d[a]=b;d[c]=a}uo("Rectangle",function(a,b,c){a="r"+b+","+c;var d=J.Nh[a];if(void 0!==d)return d;d=new sd(Gd);d.endX=b;d.endY=c;50>J.Oh&&(J.Nh[a]=d,J.Oh++);return d});uo("Square",function(a,b,c){a="s"+b+","+c;var d=J.Nh[a];if(void 0!==d)return d;d=new sd(Gd);d.endX=b;d.endY=c;d.defaultStretch=zg;50>J.Oh&&(J.Nh[a]=d,J.Oh++);return d});
    uo("RoundedRectangle",function(a,b,c){var d=a?a.parameter1:NaN;if(isNaN(d)||0>d)d=5;d=Math.min(d,b/3);d=Math.min(d,c/3);a=d*J.Gg;b=(new sd).add((new ne(d,0,!0)).add(new oe(xd,b-d,0)).add(new oe(Xd,b,d,b-a,0,b,a)).add(new oe(xd,b,c-d)).add(new oe(Xd,b-d,c,b,c-a,b-a,c)).add(new oe(xd,d,c)).add(new oe(Xd,0,c-d,a,c,0,c-a)).add(new oe(xd,0,d)).add((new oe(Xd,d,0,0,a,a,0)).close()));1<a&&(b.spot1=new P(0,0,a,a),b.spot2=new P(1,1,-a,-a));return b});uo("Border","RoundedRectangle");
    uo("Ellipse",function(a,b,c){a="e"+b+","+c;var d=J.Nh[a];if(void 0!==d)return d;d=new sd(Hd);d.endX=b;d.endY=c;d.spot1=id;d.spot2=jd;50>J.Oh&&(J.Nh[a]=d,J.Oh++);return d});uo("Circle",function(a,b,c){a="c"+b+","+c;var d=J.Nh[a];if(void 0!==d)return d;d=new sd(Hd);d.endX=b;d.endY=c;d.spot1=id;d.spot2=jd;d.defaultStretch=zg;50>J.Oh&&(J.Nh[a]=d,J.Oh++);return d});uo("TriangleRight",function(a,b,c){return(new sd).add((new ne(0,0)).add(new oe(xd,b,.5*c)).add((new oe(xd,0,c)).close())).Jm(0,.25,.5,.75)});
    uo("TriangleDown",function(a,b,c){return(new sd).add((new ne(0,0)).add(new oe(xd,b,0)).add((new oe(xd,.5*b,c)).close())).Jm(.25,0,.75,.5)});uo("TriangleLeft",function(a,b,c){return(new sd).add((new ne(b,c)).add(new oe(xd,0,.5*c)).add((new oe(xd,b,0)).close())).Jm(.5,.25,1,.75)});uo("TriangleUp",function(a,b,c){return(new sd).add((new ne(b,c)).add(new oe(xd,0,c)).add((new oe(xd,.5*b,0)).close())).Jm(.25,.5,.75,1)});uo("Triangle","TriangleUp");
    uo("Diamond",function(a,b,c){return(new sd).add((new ne(.5*b,0)).add(new oe(xd,0,.5*c)).add(new oe(xd,.5*b,c)).add((new oe(xd,b,.5*c)).close())).Jm(.25,.25,.75,.75)});uo("LineH",function(a,b,c){a=new sd(vd);a.startX=0;a.startY=c/2;a.endX=b;a.endY=c/2;return a});uo("LineV",function(a,b,c){a=new sd(vd);a.startX=b/2;a.startY=0;a.endX=b/2;a.endY=c;return a});uo("None","Rectangle");uo("BarH","Rectangle");uo("BarV","Rectangle");uo("MinusLine","LineH");
    uo("PlusLine",function(a,b,c){return(new sd).add((new ne(0,c/2,!1)).add(new oe(xd,b,c/2)).add(new oe(Wd,b/2,0)).add(new oe(xd,b/2,c)))});uo("XLine",function(a,b,c){return(new sd).add((new ne(0,c,!1)).add(new oe(xd,b,0)).add(new oe(Wd,0,0)).add(new oe(xd,b,c)))});
    J.Nm={"":"",Standard:"F1 m 0,0 l 8,4 -8,4 2,-4 z",Backward:"F1 m 8,0 l -2,4 2,4 -8,-4 z",Triangle:"F1 m 0,0 l 8,4.62 -8,4.62 z",BackwardTriangle:"F1 m 8,4 l 0,4 -8,-4 8,-4 0,4 z",Boomerang:"F1 m 0,0 l 8,4 -8,4 4,-4 -4,-4 z",BackwardBoomerang:"F1 m 8,0 l -8,4 8,4 -4,-4 4,-4 z",SidewaysV:"m 0,0 l 8,4 -8,4 0,-1 6,-3 -6,-3 0,-1 z",BackwardV:"m 8,0 l -8,4 8,4 0,-1 -6,-3 6,-3 0,-1 z",OpenTriangle:"m 0,0 l 8,4 -8,4",BackwardOpenTriangle:"m 8,0 l -8,4 8,4",OpenTriangleLine:"m 0,0 l 8,4 -8,4 m 8.5,0 l 0,-8",
      BackwardOpenTriangleLine:"m 8,0 l  -8,4 8,4 m -8.5,0 l 0,-8",OpenTriangleTop:"m 0,0 l 8,4 m 0,4",BackwardOpenTriangleTop:"m 8,0 l -8,4 m 0,4",OpenTriangleBottom:"m 0,8 l 8,-4",BackwardOpenTriangleBottom:"m 0,4 l 8,4",HalfTriangleTop:"F1 m 0,0 l 0,4 8,0 z m 0,8",BackwardHalfTriangleTop:"F1 m 8,0 l 0,4 -8,0 z m 0,8",HalfTriangleBottom:"F1 m 0,4 l 0,4 8,-4 z",BackwardHalfTriangleBottom:"F1 m 8,4 l 0,4 -8,-4 z",ForwardSemiCircle:"m 4,0 b 270 180 0 4 4",BackwardSemiCircle:"m 4,8 b 90 180 0 -4 4",Feather:"m 0,0 l 3,4 -3,4",
      BackwardFeather:"m 3,0 l -3,4 3,4",DoubleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardDoubleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4",TripleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardTripleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4 m 3,-8 l -3,4 3,4",ForwardSlash:"m 0,8 l 5,-8",BackSlash:"m 0,0 l 5,8",DoubleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8",DoubleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8",TripleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8 m -2,8 l 4,-8",
      TripleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8 m -2,-8 l 4,8",Fork:"m 0,4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4",LineFork:"m 0,0 l 0,8 m 0,-4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardLineFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4 m 8,-8 l 0,8",CircleFork:"F1 m 6,4 b 0 360 -3 0 3 z m 0,0 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",BackwardCircleFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 6,0 b 0 360 -3 0 3",CircleLineFork:"F1 m 6,4 b 0 360 -3 0 3 z m 1,-4 l 0,8 m 0,-4 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",
      BackwardCircleLineFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 0,-4 l 0,8 m 7,-4 b 0 360 -3 0 3",Circle:"F1 m 8,4 b 0 360 -4 0 4 z",Block:"F1 m 0,0 l 0,8 8,0 0,-8 z",StretchedDiamond:"F1 m 0,3 l 5,-3 5,3 -5,3 -5,-3 z",Diamond:"F1 m 0,4 l 4,-4 4,4 -4,4 -4,-4 z",Chevron:"F1 m 0,0 l 5,0 3,4 -3,4 -5,0 3,-4 -3,-4 z",StretchedChevron:"F1 m 0,0 l 8,0 3,4 -3,4 -8,0 3,-4 -3,-4 z",NormalArrow:"F1 m 0,2 l 4,0 0,-2 4,4 -4,4 0,-2 -4,0 z",X:"m 0,0 l 8,8 m 0,-8 l -8,8",TailedNormalArrow:"F1 m 0,0 l 2,0 1,2 3,0 0,-2 2,4 -2,4 0,-2 -3,0 -1,2 -2,0 1,-4 -1,-4 z",
      DoubleTriangle:"F1 m 0,0 l 4,4 -4,4 0,-8 z  m 4,0 l 4,4 -4,4 0,-8 z",BigEndArrow:"F1 m 0,0 l 5,2 0,-2 3,4 -3,4 0,-2 -5,2 0,-8 z",ConcaveTailArrow:"F1 m 0,2 h 4 v -2 l 4,4 -4,4 v -2 h -4 l 2,-2 -2,-2 z",RoundedTriangle:"F1 m 0,1 a 1,1 0 0 1 1,-1 l 7,3 a 0.5,1 0 0 1 0,2 l -7,3 a 1,1 0 0 1 -1,-1 l 0,-6 z",SimpleArrow:"F1 m 1,2 l -1,-2 2,0 1,2 -1,2 -2,0 1,-2 5,0 0,-2 2,2 -2,2 0,-2 z",AccelerationArrow:"F1 m 0,0 l 0,8 0.2,0 0,-8 -0.2,0 z m 2,0 l 0,8 1,0 0,-8 -1,0 z m 3,0 l 2,0 2,4 -2,4 -2,0 0,-8 z",BoxArrow:"F1 m 0,0 l 4,0 0,2 2,0 0,-2 2,4 -2,4 0,-2 -2,0 0,2 -4,0 0,-8 z",
      TriangleLine:"F1 m 8,4 l -8,-4 0,8 8,-4 z m 0.5,4 l 0,-8",CircleEndedArrow:"F1 m 10,4 l -2,-3 0,2 -2,0 0,2 2,0 0,2 2,-3 z m -4,0 b 0 360 -3 0 3 z",DynamicWidthArrow:"F1 m 0,3 l 2,0 2,-1 2,-2 2,4 -2,4 -2,-2 -2,-1 -2,0 0,-2 z",EquilibriumArrow:"m 0,3 l 8,0 -3,-3 m 3,5 l -8,0 3,3",FastForward:"F1 m 0,0 l 3.5,4 0,-4 3.5,4 0,-4 1,0 0,8 -1,0 0,-4 -3.5,4 0,-4 -3.5,4 0,-8 z",Kite:"F1 m 0,4 l 2,-4 6,4 -6,4 -2,-4 z",HalfArrowTop:"F1 m 0,0 l 4,4 4,0 -8,-4 z m 0,8",HalfArrowBottom:"F1 m 0,8 l 4,-4 4,0 -8,4 z",
      OpposingDirectionDoubleArrow:"F1 m 0,4 l 2,-4 0,2 4,0 0,-2 2,4 -2,4 0,-2 -4,0 0,2 -2,-4 z",PartialDoubleTriangle:"F1 m 0,0 4,3 0,-3 4,4 -4,4 0,-3 -4,3 0,-8 z",LineCircle:"F1 m 0,0 l 0,8 m 7 -4 b 0 360 -3 0 3 z",DoubleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",TripleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",CircleLine:"F1 m 6 4 b 0 360 -3 0 3 z m 1,-4 l 0,8",DiamondCircle:"F1 m 8,4 l -4,4 -4,-4 4,-4 4,4 m 8,0 b 0 360 -4 0 4 z",PlusCircle:"F1 m 8,4 b 0 360 -4 0 4 l -8 0 z m -4 -4 l 0 8",
      OpenRightTriangleTop:"m 8,0 l 0,4 -8,0 m 0,4",OpenRightTriangleBottom:"m 8,8 l 0,-4 -8,0",Line:"m 0,0 l 0,8",DoubleLine:"m 0,0 l 0,8 m 2,0 l 0,-8",TripleLine:"m 0,0 l 0,8 m 2,0 l 0,-8 m 2,0 l 0,8",PentagonArrow:"F1 m 8,4 l -4,-4 -4,0 0,8 4,0 4,-4 z"};
    function U(a){X.call(this,a);this.D=2408959;this.bh=this.Jf="";this.mp=this.ip=this.yp=this.mo=null;this.Ap="";this.Ff=this.Wn=this.zp=this.nh=null;this.kp="";this.jp=Rb;this.Tb=this.np="";this.ui=this.hn=this.di=null;this.ag=(new I(NaN,NaN)).freeze();this.to="";this.Ye=null;this.uo=vc;this.op=$c;this.Do=Hb;this.vo=Ib;this.An=null;this.no=127;this.Ep=Jb;this.Dp="gray";this.ef=4;this.Zw=-1;this.aq=NaN;this.Ay=new N;this.Fj=null;this.eh=NaN}la(U,X);
    U.prototype.cloneProtected=function(a){X.prototype.cloneProtected.call(this,a);a.D=this.D&-4097|49152;a.Jf=this.Jf;a.bh=this.bh;a.mo=this.mo;a.yp=this.yp;a.ip=this.ip;a.mp=this.mp;a.Ap=this.Ap;a.zp=this.zp;a.Wn=this.Wn;a.Ff=null;a.kp=this.kp;a.jp=this.jp.G();a.np=this.np;a.op=this.op.G();a.Tb=this.Tb;a.hn=this.hn;a.ag.assign(this.ag);a.to=this.to;a.uo=this.uo.G();a.Do=this.Do.G();a.vo=this.vo.G();a.An=this.An;a.no=this.no;a.Ep=this.Ep.G();a.Dp=this.Dp;a.ef=this.ef;a.aq=this.aq};
    U.prototype.tf=function(a){X.prototype.tf.call(this,a);a.Hh();a.nh=null;a.Ye=null;a.Fj=null};U.prototype.toString=function(){var a=Ia(this.constructor)+"#"+lb(this);null!==this.data&&(a+="("+Ja(this.data)+")");return a};U.prototype.vk=function(a,b,c,d,e,f,g){var h=this.diagram;null!==h&&(a===we&&"elements"===b?e instanceof X?Gj(e,function(a){Ij(h.partManager,a);Hj(h,a)}):lk(h,e):a===xe&&"elements"===b&&(e instanceof X?Gj(e,function(a){Lj(h.partManager,a,h)}):nk(h,e)),h.Ya(a,b,c,d,e,f,g))};
    U.prototype.Ba=function(a){X.prototype.Ba.call(this,a);if(null!==this.data){for(var b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d];e instanceof X&&Gj(e,function(a){null!==a.data&&a.Ba()})}for(b=this.adornments;b.next();)b.value.Ba(a)}};U.prototype.updateRelationshipsFromData=function(){null!==this.data&&this.diagram.partManager.updateRelationshipsFromData(this)};U.prototype.fk=function(a){var b=this.Ff;return null===b?null:b.H(a)};
    U.prototype.Ah=function(a,b){if(null!==b){var c=null,d=this.Ff;null!==d&&(c=d.H(a));if(c!==b){if(null!==c){var e=c.diagram;null!==e&&e.remove(c)}null===d&&(this.Ff=d=new G);b.Jf!==a&&(b.category=a);d.add(a,b);a=this.diagram;null!==a&&(a.add(b),a=b.adornedObject,null!==a&&(a=a.Ui(),null!==a&&(b.data=a.data)))}}};U.prototype.Af=function(a){var b=this.Ff;if(null!==b){var c=b.H(a);if(null!==c){var d=c.diagram;null!==d&&d.remove(c)}b.remove(a);0===b.count&&(this.Ff=null)}};
    U.prototype.Yj=function(){var a=this.Ff;if(null!==a){var b=Fa();for(a=a.iterator;a.next();)b.push(a.key);a=b.length;for(var c=0;c<a;c++)this.Af(b[c]);Ha(b)}};
    U.prototype.updateAdornments=function(){var a=this.diagram;if(null!==a){for(var b=this.adornments;b.next();){var c=b.value;c.o();c.placeholder&&c.placeholder.o()}a:{if(this.isSelected&&this.selectionAdorned&&(b=this.selectionObject,null!==b&&this.actualBounds.u()&&this.isVisible()&&b.zf()&&b.actualBounds.u())){c=this.fk("Selection");if(null===c){c=this.selectionAdornmentTemplate;null===c&&(c=this.Ih()?a.linkSelectionAdornmentTemplate:this instanceof T?a.groupSelectionAdornmentTemplate:a.nodeSelectionAdornmentTemplate);
      if(!(c instanceof Ke))break a;wg(c);c=c.copy();null!==c&&(this.Ih()&&this.selectionObject===this.path&&(c.type=X.Link),c.adornedObject=b)}if(null!==c){c.type===X.Link&&c.o();this.Ah("Selection",c);break a}}this.Af("Selection")}vo(this,a);for(b=this.adornments;b.next();)b.value.Ba()}};U.prototype.Lb=function(){var a=this.diagram;null!==a&&(Ui(a),0!==(this.D&16384)!==!0&&(ii(this,!0),a.Pb()))};function hi(a){0!==(a.D&16384)!==!1&&(a.updateAdornments(),ii(a,!1))}
    function vo(a,b){b.toolManager.mouseDownTools.each(function(b){b.isEnabled&&b.updateAdornments(a)});b.toolManager.updateAdornments(a)}function wo(a){if(!1===vj(a)){xo(a,!0);a.ml();var b=a.diagram;null!==b&&(b.od.add(a),b.Pb())}}function yo(a){a.D|=2097152;if(!1!==vj(a)){var b=a.position,c=a.location;c.u()&&b.u()||zo(a,b,c);c=a.ub;var d=N.alloc().assign(c);c.ea();c.x=b.x;c.y=b.y;c.freeze();a.Ft(d,c);N.free(d);xo(a,!1)}}U.prototype.move=function(a,b){!0===b?this.location=a:this.position=a};
    U.prototype.moveTo=function(a,b,c){a=I.allocAt(a,b);this.move(a,c);I.free(a)};U.prototype.isVisible=function(){if(!this.visible)return!1;var a=this.layer;if(null!==a){if(!a.visible)return!1;a=a.diagram;if(null!==a&&a.animationManager.Et(this))return!0}a=this.containingGroup;return null===a||a.isSubGraphExpanded&&a.isVisible()?!0:!1};t=U.prototype;t.Ob=function(a){var b=this.diagram;a?(this.C(4),this.Lb(),null!==b&&b.od.add(this)):(this.C(8),this.Yj());this.Hh();null!==b&&(b.Na(),b.M())};
    t.Xa=function(a){if(this.name===a)return this;var b=this.Fj;null===b&&(this.Fj=b=new G);if(null!==b.H(a))return b.H(a);var c=X.prototype.Xa.call(this,a);if(null!==c)return b.set(a,c),c;b.set(a,null);return null};t.wf=function(a,b,c){void 0===c&&(c=new I);b=b.jc()?Ac:b;var d=a.naturalBounds;c.h(d.width*b.x+b.offsetX,d.height*b.y+b.offsetY);if(null===a||a===this)return c;a.transform.ra(c);for(a=a.panel;null!==a&&a!==this;)a.transform.ra(c),a=a.panel;this.$f.ra(c);c.offset(-this.nc.x,-this.nc.y);return c};
    t.lm=function(a){void 0===a&&(a=new N);return a.assign(this.actualBounds)};t.yb=function(){!0===tj(this)&&this.measure(Infinity,Infinity);this.arrange()};function Ej(a,b){var c=a.Ay;isNaN(a.eh)&&(a.eh=gn(a));var d=a.eh;var e=2*d;if(!a.isShadowed)return c.h(b.x-1-d,b.y-1-d,b.width+2+e,b.height+2+e),c;d=b.x;e=b.y;var f=b.width;b=b.height;var g=a.shadowBlur;a=a.shadowOffset;f+=g;b+=g;d-=g/2;e-=g/2;0<a.x?f+=a.x:(d+=a.x,f-=a.x);0<a.y?b+=a.y:(e+=a.y,b-=a.y);c.h(d-1,e-1,f+2,b+2);return c}
    U.prototype.arrange=function(){if(!1===uj(this))yo(this);else{var a=this.ub,b=N.alloc();b.assign(a);a.ea();var c=ug(this);this.Dh(0,0,this.nc.width,this.nc.height);var d=this.position;zo(this,d,this.location);a.x=d.x;a.y=d.y;a.freeze();this.Ft(b,a);nl(this,!1);b.w(a)?this.zd(c):!this.Wb()||J.A(b.width,a.width)&&J.A(b.height,a.height)||0<=this.Zw&&this.C(16);N.free(b);xo(this,!1)}};t=U.prototype;
    t.Ft=function(a,b){var c=this.diagram;if(null!==c){var d=!1;if(!1===c.ki&&a.u()){var e=N.alloc();e.assign(c.documentBounds);e.mw(c.padding);a.x>e.x&&a.y>e.y&&a.right<e.right&&a.bottom<e.bottom&&b.x>e.x&&b.y>e.y&&b.right<e.right&&b.bottom<e.bottom&&(d=!0);N.free(e)}0!==(this.D&65536)!==!0&&a.w(b)||Jj(this,d,c);c.M();$b(a,b)||(this instanceof W&&!c.undoManager.isUndoingRedoing&&this.fd(),this.Hh())}};
    t.jw=function(a,b){if(this.Ih()||!a.u())return!1;var c=this.diagram;if(null!==c&&(Ao(this,c,a,b),!0===c.undoManager.isUndoingRedoing))return!0;this.ma=a;this.D&=-2097153;c=this.ag;if(c.u()){var d=c.copy();c.h(c.x+(a.x-b.x),c.y+(a.y-b.y));this.g("location",d,c.copy())}!1===vj(this)&&!1===uj(this)&&(wo(this),yo(this));return!0};function Ao(a,b,c,d){null===b||a instanceof Ke||(b=b.animationManager,b.$e&&Lh(b,a,d.copy(),c.copy()))}
    t.Kq=function(a,b,c){var d=this.ag,e=this.ma;if(c){if(d.x===a&&d.y===b)return;vj(this)||uj(this)?e.h(NaN,NaN):e.h(e.x+a-d.x,e.y+b-d.y);d.h(a,b)}else{if(e.x===a&&e.y===b)return;vj(this)||uj(this)?this.Pt():d.h(d.x+a-e.x,d.y+b-e.y);e.h(a,b)}wo(this)};t.Pt=function(){this.D&=-2097153;wo(this)};
    function zo(a,b,c){var d=I.alloc(),e=a.locationSpot,f=a.locationObject;e.jc()&&B("determineOffset: Part's locationSpot must be real: "+e.toString());var g=f.naturalBounds,h=f instanceof Kf?f.strokeWidth:0;d.xk(0,0,g.width+h,g.height+h,e);if(f!==a)for(d.offset(-h/2,-h/2),f.transform.ra(d),e=f.panel;null!==e&&e!==a;)e.transform.ra(d),e=e.panel;a.$f.ra(d);d.offset(-a.nc.x,-a.nc.y);e=a.diagram;f=c.u();g=b.u();f&&g?0!==(a.D&2097152)?Bo(a,b,c,e,d):Co(a,b,c,e,d):f?Bo(a,b,c,e,d):g&&Co(a,b,c,e,d);a.D|=2097152;
      I.free(d);a.ml()}function Bo(a,b,c,d,e){var f=b.x,g=b.y;b.h(c.x-e.x,c.y-e.y);null!==d&&(c=d.animationManager,(e=c.isAnimating)||!c.$e||a instanceof Ke||Lh(c,a,new I(f,g),b),e||b.x===f&&b.y===g||(c=d.skipsUndoManager,d.skipsUndoManager=!0,a.g("position",new I(f,g),b),d.skipsUndoManager=c))}function Co(a,b,c,d,e){var f=c.copy();c.h(b.x+e.x,b.y+e.y);c.w(f)||null===d||(b=d.skipsUndoManager,d.skipsUndoManager=!0,a.g("location",f,c.copy()),d.skipsUndoManager=b)}
    function Jj(a,b,c){pl(a,!1);a instanceof W&&zk(c,a);a.layer.isTemporary||b||c.Na();b=a.ub;var d=c.viewportBounds;d.u()?ug(a)?(dc(b,d)||a.zd(!1),a.updateAdornments()):b.Gc(d)?(a.zd(!0),a.updateAdornments()):a.Lb():c.mi=!0}t.bj=function(){return!0};t.Wb=function(){return!0};t.Ih=function(){return!1};t.yf=function(){return!0};
    function Do(a,b,c,d){b.constructor===a.constructor||Eo||(Eo=!0,wa('Should not change the class of the Part when changing category from "'+c+'" to "'+d+'"'),wa("  Old class: "+Ia(a.constructor)+", new class: "+Ia(b.constructor)+", part: "+a.toString()));a.Yj();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.tf(a);b.cloneProtected(a);a.Jf=d;a.o();a.M();b=a.diagram;d=!0;null!==b&&(d=b.skipsUndoManager,
      b.skipsUndoManager=!0);a.hb=e;a.D=f?a.D|4096:a.D&-4097;a.D=g?a.D|524288:a.D&-524289;a instanceof W&&(a.P=h?a.P|4:a.P&-5,a.P=k?a.P|1:a.P&-2,a.P=l?a.P|2:a.P&-3);null!==e&&a.Ba();e=a.layerName;e!==c&&(a.bh=c,a.layerName=e);null!==b&&(b.skipsUndoManager=d);a.Wb()&&a.C(64)}U.prototype.canCopy=function(){if(!this.copyable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowCopy)return!1;a=a.diagram;return null===a?!0:a.allowCopy?!0:!1};
    U.prototype.canDelete=function(){if(!this.deletable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowDelete)return!1;a=a.diagram;return null===a?!0:a.allowDelete?!0:!1};U.prototype.canEdit=function(){if(!this.textEditable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowTextEdit)return!1;a=a.diagram;return null===a?!0:a.allowTextEdit?!0:!1};
    U.prototype.canGroup=function(){if(!this.groupable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowGroup)return!1;a=a.diagram;return null===a?!0:a.allowGroup?!0:!1};U.prototype.canMove=function(){if(!this.movable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowMove)return!1;a=a.diagram;return null===a?!0:a.allowMove?!0:!1};
    U.prototype.canReshape=function(){if(!this.reshapable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowReshape)return!1;a=a.diagram;return null===a?!0:a.allowReshape?!0:!1};U.prototype.canResize=function(){if(!this.resizable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowResize)return!1;a=a.diagram;return null===a?!0:a.allowResize?!0:!1};
    U.prototype.canRotate=function(){if(!this.rotatable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowRotate)return!1;a=a.diagram;return null===a?!0:a.allowRotate?!0:!1};U.prototype.canSelect=function(){if(!this.selectable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowSelect)return!1;a=a.diagram;return null===a?!0:a.allowSelect?!0:!1};function ii(a,b){a.D=b?a.D|16384:a.D&-16385}function vj(a){return 0!==(a.D&32768)}function xo(a,b){a.D=b?a.D|32768:a.D&-32769}
    function pl(a,b){a.D=b?a.D|65536:a.D&-65537}function ug(a){return 0!==(a.D&131072)}t=U.prototype;t.zd=function(a){this.D=a?this.D|131072:this.D&-131073};function Fo(a,b){a.D=b?a.D|1048576:a.D&-1048577}t.Hh=function(){var a=this.containingGroup;null!==a&&(a.o(),null!==a.placeholder&&a.placeholder.o(),a.fd())};t.M=function(){var a=this.diagram;null!==a&&!uj(this)&&!vj(this)&&this.isVisible()&&this.ub.u()&&a.M(Ej(this,this.ub))};
    t.o=function(){X.prototype.o.call(this);var a=this.diagram;null!==a&&(a.od.add(this),this instanceof W&&null!==this.labeledLink&&El(this.labeledLink),a.Pb(!0))};t.qq=function(a){a||(a=this.di,null!==a&&Go(a,this))};t.rq=function(a){a||(a=this.di,null!==a&&Ho(a,this))};t.dk=function(){var a=this.data;if(null!==a){var b=this.diagram;null!==b&&(b=b.model,null!==b&&b.Am(a))}};t.sz=function(){return Io(this,this)};
    function Io(a,b){var c=b.containingGroup;return null!==c?1+Io(a,c):b instanceof W&&(b=b.labeledLink,null!==b)?Io(a,b):0}t.wz=function(){return Jo(this,this)};function Jo(a,b){var c=b.containingGroup;return null!==c||b instanceof W&&(c=b.labeledLink,null!==c)?Jo(a,c):b}t.Xd=function(a){return a instanceof T?Ko(this,this,a):!1};function Ko(a,b,c){if(b===c||null===c)return!1;var d=b.containingGroup;return null===d||d!==c&&!Ko(a,d,c)?b instanceof W&&(b=b.labeledLink,null!==b)?Ko(a,b,c):!1:!0}
    t.Kx=function(a){if(null===a)return null;if(this===a)return this.containingGroup;for(var b=this;null!==b;){b instanceof T&&Fo(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.D&1048576)){c=b;break}b instanceof W&&(a=b.labeledLink,null!==a&&(b=a));b=b.containingGroup}for(b=this;null!==b;)b instanceof T&&Fo(b,!1),b instanceof W&&(a=b.labeledLink,null!==a&&(b=a)),b=b.containingGroup;return c};
    U.prototype.canLayout=function(){if(!this.isLayoutPositioned||!this.isVisible())return!1;var a=this.layer;return null!==a&&a.isTemporary||this instanceof W&&this.isLinkLabel?!1:!0};
    U.prototype.C=function(a){void 0===a&&(a=16777215);if(this.isLayoutPositioned&&0!==(a&this.layoutConditions)){var b=this.layer;null!==b&&b.isTemporary||this instanceof W&&this.isLinkLabel?b=!1:(b=this.diagram,b=null!==b&&b.undoManager.isUndoingRedoing?!1:!0)}else b=!1;if(b)if(b=this.di,null!==b){var c=b.layout;null!==c?c.C():b.C(a)}else a=this.diagram,null!==a&&(a=a.layout,null!==a&&a.C())};function Kj(a){if(!a.isVisible())return!1;a=a.layer;return null!==a&&a.isTemporary?!1:!0}
    function Uk(a,b,c,d,e,f){void 0===f&&(f=null);if(!(a.contains(b)||null!==f&&!f(b)||b instanceof Ke))if(a.add(b),b instanceof W){if(c&&b instanceof T)for(var g=b.memberParts;g.next();)Uk(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)&&Uk(a,h,c,d,e,f)}}if(1<d)for(b=b.yv();b.next();)Uk(a,b.value,c,d-1,e,f)}else if(b instanceof S)for(b=b.labelNodes;b.next();)Uk(a,
      b.value,c,d,e,f)}
    ma.Object.defineProperties(U.prototype,{key:{get:function(){var a=this.diagram;if(null!==a)return a.model.ja(this.data)}},adornments:{get:function(){return null===this.Ff?fb:this.Ff.iteratorValues}},layer:{get:function(){return this.ui}},diagram:{get:function(){var a=this.ui;return null!==a?a.diagram:null}},layerName:{get:function(){return this.bh},set:function(a){var b=
          this.bh;if(b!==a){var c=this.diagram;if(null===c||null!==c.im(a)&&!c.partManager.addsToTemporaryLayer)if(this.bh=a,null!==c&&c.Na(),this.g("layerName",b,a),b=this.layer,null!==b&&b.name!==a&&(c=b.diagram,null!==c&&(a=c.im(a),null!==a&&a!==b))){var d=b.Fc(-1,this,!0);0<=d&&c.Ya(xe,"parts",b,this,null,d,!0);d=a.aj(99999999,this,!0);b.visible!==a.visible&&this.Ob(a.visible);0<=d&&c.Ya(we,"parts",a,null,this,!0,d);d=this.layerChanged;if(null!==d){var e=c.Z;c.Z=!0;d(this,b,a);c.Z=e}}}}},layerChanged:{
        get:function(){return this.mo},set:function(a){var b=this.mo;b!==a&&(this.mo=a,this.g("layerChanged",b,a))}},zOrder:{get:function(){return this.aq},set:function(a){var b=this.aq;if(b!==a){this.aq=a;var c=this.layer;null!==c&&li(c,-1,this);this.g("zOrder",b,a);a=this.diagram;null!==a&&a.M()}}},locationObject:{get:function(){if(null===this.Ye){var a=this.locationObjectName;""!==a?(a=this.Xa(a),null!==a?this.Ye=a:this.Ye=this):
          this instanceof Ke?this.type!==X.Link&&null!==this.placeholder?this.Ye=this.placeholder:this.Ye=this:this.Ye=this}return this.Ye.visible?this.Ye:this}},minLocation:{get:function(){return this.Do},set:function(a){var b=this.Do;b.w(a)||(this.Do=a=a.G(),this.g("minLocation",b,a))}},maxLocation:{get:function(){return this.vo},set:function(a){var b=this.vo;b.w(a)||(this.vo=a=a.G(),this.g("maxLocation",b,a))}},locationObjectName:{
        get:function(){return this.to},set:function(a){var b=this.to;b!==a&&(this.to=a,this.Ye=null,this.o(),this.g("locationObjectName",b,a))}},locationSpot:{get:function(){return this.uo},set:function(a){var b=this.uo;b.w(a)||(this.uo=a=a.G(),this.o(),this.g("locationSpot",b,a))}},location:{get:function(){return this.ag},set:function(a){var b=a.x,c=a.y,d=this.ag,e=d.x,f=d.y;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))||
        (a=a.copy(),e=a,this.Ih()?b=!1:(this.ag=e,this.D|=2097152,!1===uj(this)&&(wo(this),b=this.ma,b.u()&&(c=b.copy(),b.h(b.x+(e.x-d.x),b.y+(e.y-d.y)),Ao(this,this.diagram,b,c),e=this.diagram,null!==e?(f=e.skipsUndoManager,e.skipsUndoManager=!0,this.g("position",c,b),e.skipsUndoManager=f):this.g("position",c,b))),b=!0),b&&this.g("location",d.copy(),a.copy()))}},category:{get:function(){return this.Jf},set:function(a){var b=this.Jf;if(b!==a){var c=this.diagram,d=this.data,e=
          null;if(null!==c&&null!==d&&!(this instanceof Ke)){var f=c.model.undoManager;f.isEnabled&&!f.isUndoingRedoing&&(e=this.clone(),e.W.addAll(this.W))}this.Jf=a;this.g("category",b,a);null===c||null===d||this instanceof Ke?this instanceof Ke&&(e=this.adornedPart,null!==e&&(a=e.Ff,null!==a&&a.remove(b),e.Ah(this.category,this))):(f=c.model,f.undoManager.isUndoingRedoing||(this.Ih()?(c.partManager.setLinkCategoryForData(d,a),c=c.partManager.findLinkTemplateForCategory(a),null!==c&&(wg(c),c=c.copy(),null!==
        c&&Do(this,c,b,a))):(null!==f&&f.Jq(d,a),c=Lo(c.partManager,d,a),null!==c&&(wg(c),c=c.copy(),null===c||c instanceof S||(d=this.location.copy(),Do(this,c,b,a),this.location.u()||(this.location=d)))),null!==e&&(b=this.clone(),b.W.addAll(this.W),this.g("self",e,b))))}}},self:{get:function(){return this},set:function(a){Do(this,a,this.category,a.category)}},copyable:{get:function(){return 0!==(this.D&1)},set:function(a){var b=0!==(this.D&1);
          b!==a&&(this.D^=1,this.g("copyable",b,a))}},deletable:{get:function(){return 0!==(this.D&2)},set:function(a){var b=0!==(this.D&2);b!==a&&(this.D^=2,this.g("deletable",b,a))}},textEditable:{get:function(){return 0!==(this.D&4)},set:function(a){var b=0!==(this.D&4);b!==a&&(this.D^=4,this.g("textEditable",b,a),this.Lb())}},groupable:{get:function(){return 0!==(this.D&8)},set:function(a){var b=0!==(this.D&8);b!==
        a&&(this.D^=8,this.g("groupable",b,a))}},movable:{get:function(){return 0!==(this.D&16)},set:function(a){var b=0!==(this.D&16);b!==a&&(this.D^=16,this.g("movable",b,a))}},selectionAdorned:{get:function(){return 0!==(this.D&32)},set:function(a){var b=0!==(this.D&32);b!==a&&(this.D^=32,this.g("selectionAdorned",b,a),this.Lb())}},isInDocumentBounds:{get:function(){return 0!==(this.D&64)},set:function(a){var b=0!==
          (this.D&64);if(b!==a){this.D^=64;var c=this.diagram;null!==c&&c.Na();this.g("isInDocumentBounds",b,a)}}},isLayoutPositioned:{get:function(){return 0!==(this.D&128)},set:function(a){var b=0!==(this.D&128);b!==a&&(this.D^=128,this.g("isLayoutPositioned",b,a),this.C(a?4:8))}},selectable:{get:function(){return 0!==(this.D&256)},set:function(a){var b=0!==(this.D&256);b!==a&&(this.D^=256,this.g("selectable",b,a),this.Lb())}},reshapable:{
        get:function(){return 0!==(this.D&512)},set:function(a){var b=0!==(this.D&512);b!==a&&(this.D^=512,this.g("reshapable",b,a),this.Lb())}},resizable:{get:function(){return 0!==(this.D&1024)},set:function(a){var b=0!==(this.D&1024);b!==a&&(this.D^=1024,this.g("resizable",b,a),this.Lb())}},rotatable:{get:function(){return 0!==(this.D&2048)},set:function(a){var b=0!==(this.D&2048);b!==a&&(this.D^=2048,this.g("rotatable",b,a),this.Lb())}},
      isSelected:{get:function(){return 0!==(this.D&4096)},set:function(a){var b=0!==(this.D&4096);if(b!==a){var c=this.diagram;if(!a||this.canSelect()&&!(null!==c&&c.selection.count>=c.maxSelectionCount)){this.D^=4096;var d=!1;if(null!==c){d=c.skipsUndoManager;c.skipsUndoManager=!0;var e=c.selection;e.ea();a?e.add(this):e.remove(this);e.freeze()}this.g("isSelected",b,a);this.Lb();a=this.selectionChanged;null!==a&&a(this);null!==c&&(c.Pb(),c.skipsUndoManager=d)}}}},isHighlighted:{
        get:function(){return 0!==(this.D&524288)},set:function(a){var b=0!==(this.D&524288);if(b!==a){this.D^=524288;var c=this.diagram;null!==c&&(c=c.highlighteds,c.ea(),a?c.add(this):c.remove(this),c.freeze());this.g("isHighlighted",b,a);this.M();a=this.highlightedChanged;null!==a&&a(this)}}},isShadowed:{get:function(){return 0!==(this.D&8192)},set:function(a){var b=0!==(this.D&8192);b!==a&&(this.D^=8192,this.g("isShadowed",b,a),this.M())}},isAnimated:{
        get:function(){return 0!==(this.D&262144)},set:function(a){var b=0!==(this.D&262144);b!==a&&(this.D^=262144,this.g("isAnimated",b,a))}},highlightedChanged:{get:function(){return this.Wn},set:function(a){var b=this.Wn;b!==a&&(this.Wn=a,this.g("highlightedChanged",b,a))}},selectionObjectName:{get:function(){return this.Ap},set:function(a){var b=this.Ap;b!==a&&(this.Ap=a,this.nh=null,this.g("selectionObjectName",b,a))}},selectionAdornmentTemplate:{
        get:function(){return this.yp},set:function(a){var b=this.yp;b!==a&&(this.yp=a,this.g("selectionAdornmentTemplate",b,a))}},selectionObject:{get:function(){if(null===this.nh){var a=this.selectionObjectName;null!==a&&""!==a?(a=this.Xa(a),null!==a?this.nh=a:this.nh=this):this instanceof S?(a=this.path,null!==a?this.nh=a:this.nh=this):this.nh=this}return this.nh}},selectionChanged:{get:function(){return this.zp},set:function(a){var b=
          this.zp;b!==a&&(this.zp=a,this.g("selectionChanged",b,a))}},resizeAdornmentTemplate:{get:function(){return this.ip},set:function(a){var b=this.ip;b!==a&&(this.ip=a,this.g("resizeAdornmentTemplate",b,a))}},resizeObjectName:{get:function(){return this.kp},set:function(a){var b=this.kp;b!==a&&(this.kp=a,this.g("resizeObjectName",b,a))}},resizeObject:{get:function(){var a=this.resizeObjectName;return""!==a&&(a=this.Xa(a),
        null!==a)?a:this}},resizeCellSize:{get:function(){return this.jp},set:function(a){var b=this.jp;b.w(a)||(this.jp=a=a.G(),this.g("resizeCellSize",b,a))}},rotateAdornmentTemplate:{get:function(){return this.mp},set:function(a){var b=this.mp;b!==a&&(this.mp=a,this.g("rotateAdornmentTemplate",b,a))}},rotateObjectName:{get:function(){return this.np},set:function(a){var b=this.np;b!==a&&(this.np=a,this.g("rotateObjectName",
          b,a))}},rotateObject:{get:function(){var a=this.rotateObjectName;return""!==a&&(a=this.Xa(a),null!==a)?a:this}},rotationSpot:{get:function(){return this.op},set:function(a){var b=this.op;b.w(a)||(this.op=a=a.G(),this.g("rotationSpot",b,a))}},text:{get:function(){return this.Tb},set:function(a){var b=this.Tb;b!==a&&(this.Tb=a,this.g("text",b,a))}},containingGroup:{get:function(){return this.di},
        set:function(a){if(this.Wb()){var b=this.di;if(b!==a){null===a||this!==a&&!a.Xd(this)||(this===a&&B("Cannot make a Group a member of itself: "+this.toString()),B("Cannot make a Group indirectly contain itself: "+this.toString()+" already contains "+a.toString()));this.C(2);var c=this.diagram;null!==b?Ho(b,this):this instanceof T&&null!==c&&c.xh.remove(this);this.di=a;null!==a?Go(a,this):this instanceof T&&null!==c&&c.xh.add(this);this.C(1);if(null!==c&&c.Z){var d=this.data,e=c.model;if(null!==d&&
          e.jk()){var f=e.ja(null!==a?a.data:null);e.Nt(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 T)for(c=new F,Uk(c,this,!0,0,!0),c=c.iterator;c.next();)if(d=c.value,d instanceof W)for(d=d.linksConnected;d.next();)Mo(d.value);if(this instanceof W){for(c=this.linksConnected;c.next();)Mo(c.value);c=this.labeledLink;null!==c&&Mo(c)}this.g("containingGroup",b,a);null!==a&&(b=a.layer,null!==b&&li(b,-1,a))}}else B("cannot set the Part.containingGroup of a Link or Adornment")}},
      containingGroupChanged:{get:function(){return this.hn},set:function(a){var b=this.hn;b!==a&&(this.hn=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.no},set:function(a){var b=this.no;b!==a&&(this.no=a,this.g("layoutConditions",b,a))}},dragComputation:{
        get:function(){return this.An},set:function(a){var b=this.An;b!==a&&(this.An=a,this.g("dragComputation",b,a))}},shadowOffset:{get:function(){return this.Ep},set:function(a){var b=this.Ep;b.w(a)||(this.Ep=a=a.G(),this.M(),this.g("shadowOffset",b,a))}},shadowColor:{get:function(){return this.Dp},set:function(a){var b=this.Dp;b!==a&&(this.Dp=a,this.M(),this.g("shadowColor",b,a))}},shadowBlur:{get:function(){return this.ef},
        set:function(a){var b=this.ef;b!==a&&(this.ef=a,this.M(),this.g("shadowBlur",b,a))}}});U.prototype.invalidateLayout=U.prototype.C;U.prototype.findCommonContainingGroup=U.prototype.Kx;U.prototype.isMemberOf=U.prototype.Xd;U.prototype.findTopLevelPart=U.prototype.wz;U.prototype.findSubGraphLevel=U.prototype.sz;U.prototype.ensureBounds=U.prototype.yb;U.prototype.getDocumentBounds=U.prototype.lm;U.prototype.getRelativePoint=U.prototype.wf;U.prototype.findObject=U.prototype.Xa;U.prototype.moveTo=U.prototype.moveTo;
    U.prototype.invalidateAdornments=U.prototype.Lb;U.prototype.clearAdornments=U.prototype.Yj;U.prototype.removeAdornment=U.prototype.Af;U.prototype.addAdornment=U.prototype.Ah;U.prototype.findAdornment=U.prototype.fk;U.prototype.updateTargetBindings=U.prototype.Ba;var Eo=!1;U.className="Part";U.LayoutNone=0;U.LayoutAdded=1;U.LayoutRemoved=2;U.LayoutShown=4;U.LayoutHidden=8;U.LayoutNodeSized=16;U.LayoutGroupLayout=32;U.LayoutNodeReplaced=64;U.LayoutStandard=127;U.LayoutAll=16777215;
    function Ke(a){U.call(this,a);this.D&=-257;this.bh="Adornment";this.be=null;this.ex=0;this.tx=!1;this.l=[];this.Ra=null}la(Ke,U);Ke.prototype.toString=function(){var a=this.adornedPart;return"Adornment("+this.category+")"+(null!==a?a.toString():"")};Ke.prototype.updateRelationshipsFromData=function(){};
    Ke.prototype.nk=function(a){var b=this.adornedObject.part;if(b instanceof S&&this.adornedObject instanceof Kf){var c=b.path;b.nk(a);a=c.geometry;b=this.W.j;c=b.length;for(var d=0;d<c;d++){var e=b[d];e.isPanelMain&&e instanceof Kf&&(e.ka=a)}}};Ke.prototype.bj=function(){var a=this.be;if(null===a)return!0;a=a.part;return null===a||!uj(a)};Ke.prototype.Wb=function(){return!1};
    Ke.prototype.vk=function(a,b,c,d,e,f,g){if(a===we&&"elements"===b)if(e instanceof vg)null===this.Ra&&(this.Ra=e);else{if(e instanceof X){var h=e.hm(function(a){return a instanceof vg});h instanceof vg&&null===this.Ra&&(this.Ra=h)}}else a===xe&&"elements"===b&&null!==this.Ra&&(d===this.Ra?this.Ra=null:d instanceof X&&this.Ra.Bg(d)&&(this.Ra=null));U.prototype.vk.call(this,a,b,c,d,e,f,g)};Ke.prototype.updateAdornments=function(){};Ke.prototype.dk=function(){};
    ma.Object.defineProperties(Ke.prototype,{placeholder:{get:function(){return this.Ra}},adornedObject:{get:function(){return this.be},set:function(a){var b=this.adornedPart,c=null;null!==a&&(c=a.part);null===b||null!==a&&b===c||b.Af(this.category);this.be=a;null!==c&&c.Ah(this.category,this)}},adornedPart:{get:function(){var a=this.be;return null!==a?a.part:null}},containingGroup:{
        get:function(){return null}}});Ke.className="Adornment";function W(a){U.call(this,a);this.P=13;this.Wa=new E;this.Wp=this.rl=this.xi=this.po=this.oo=null;this.Ik=tc;this.rc=this.Ne=null;this.fp=No;this.yh=!1}la(W,U);W.prototype.cloneProtected=function(a){U.prototype.cloneProtected.call(this,a);a.P=this.P;a.P=this.P&-17;a.oo=this.oo;a.po=this.po;a.xi=this.xi;a.Wp=this.Wp;a.Ik=this.Ik.G();a.fp=this.fp};t=W.prototype;t.tf=function(a){U.prototype.tf.call(this,a);a.fd();a.Ne=this.Ne;a.rc=null};
    function Oo(a,b){null!==b&&(null===a.Ne&&(a.Ne=new F),a.Ne.add(b))}function Po(a,b,c,d){if(null===b||null===a.Ne)return null;for(var e=a.Ne.iterator;e.next();){var f=e.value;if(f.Ct===a&&f.Pv===b&&f.ay===c&&f.by===d||f.Ct===b&&f.Pv===a&&f.ay===d&&f.by===c)return f}return null}t.Vz=function(a,b,c){if(void 0===b||null===b)b="";if(void 0===c||null===c)c="";a=Po(this,a,b,c);null!==a&&a.nm()};
    t.vk=function(a,b,c,d,e,f,g){a===we&&"elements"===b?this.rc=null:a===xe&&"elements"===b&&(this.rc=null);U.prototype.vk.call(this,a,b,c,d,e,f,g)};t.fd=function(a){void 0===a&&(a=null);for(var b=this.linksConnected;b.next();){var c=b.value;null!==a&&a.contains(c)||(Qo(this,c.fromPort),Qo(this,c.toPort),c.Ta())}};function ql(a,b){for(var c=a.linksConnected;c.next();){var d=c.value;if(d.fromPort===b||d.toPort===b)Qo(a,d.fromPort),Qo(a,d.toPort),d.Ta()}}
    function Qo(a,b){null!==b&&(b=b.ep,null!==b&&b.nm(),a=a.containingGroup,null===a||a.isSubGraphExpanded||Qo(a,a.port))}t.bj=function(){return!0};W.prototype.getAvoidableRect=function(a){a.set(this.actualBounds);a.cq(this.Ik);return a};W.prototype.findVisibleNode=function(){for(var a=this;null!==a&&!a.isVisible();)a=a.containingGroup;return a};
    W.prototype.isVisible=function(){if(!U.prototype.isVisible.call(this))return!1;var a=!0,b=ri,c=this.diagram;if(null!==c){if(c.animationManager.Et(this))return!0;a=c.isTreePathToChildren;b=c.treeCollapsePolicy}if(b===ri){if(a=this.zg(),null!==a&&!a.isTreeExpanded)return!1}else if(b===Gk){if(a=a?this.vv():this.wv(),0<a.count&&a.all(function(a){return!a.isTreeExpanded}))return!1}else if(b===Hk&&(a=a?this.vv():this.wv(),0<a.count&&a.any(function(a){return!a.isTreeExpanded})))return!1;a=this.labeledLink;
      return null!==a?a.isVisible():!0};W.prototype.Ob=function(a){U.prototype.Ob.call(this,a);for(var b=this.linksConnected;b.next();)b.value.Ob(a)};W.prototype.Lx=function(){var a=new F,b=new F;Ro(this,this,a,b);return b.iterator};function Ro(a,b,c,d){if(!c.has(b)){c.add(b);var e=!0,f=a.diagram;null!==f&&(e=f.isTreePathToChildren);b.linksConnected.each(function(f){f.isTreeLink?(e?f.fromNode===b:f.toNode===b)&&Ro(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.Wa.iterator;var b=new jb(this.Wa),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.lq=function(a){void 0===a&&(a=null);var b=new jb(this.Wa),c=this;b.predicate=function(b){return b.fromNode!==c?!1:null===a?!0:b.fromPortId===a};return b};
    t.wd=function(a){void 0===a&&(a=null);var b=new jb(this.Wa),c=this;b.predicate=function(b){return b.toNode!==c?!1:null===a?!0:b.toPortId===a};return b};
    t.uv=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.Wa.iterator;d.next();){var e=d.value;if(e.fromNode===this){if(null===a||e.fromPortId===a)e=e.toNode,null!==b?b.add(e):null!==c&&c!==e?(b=new F,b.add(c),b.add(e)):c=e}else e.toNode!==this||null!==a&&e.toPortId!==a||(e=e.fromNode,null!==b?b.add(e):null!==c&&c!==e?(b=new F,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new gb(c):fb};
    t.wv=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.Wa.iterator;d.next();){var e=d.value;e.fromNode!==this||null!==a&&e.fromPortId!==a||(e=e.toNode,null!==b?b.add(e):null!==c&&c!==e?(b=new F,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new gb(c):fb};
    t.vv=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.Wa.iterator;d.next();){var e=d.value;e.toNode!==this||null!==a&&e.toPortId!==a||(e=e.fromNode,null!==b?b.add(e):null!==c&&c!==e?(b=new F,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new gb(c):fb};
    t.nz=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);var d=new jb(this.Wa),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.oz=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);var d=new jb(this.Wa),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 So(a,b,c){Qo(a,c);var d=a.Wa.contains(b);d||a.Wa.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.yh||(e.yh=f),!f.isTreeLeaf||null!==a&&a.undoManager.isUndoingRedoing||(d?c===f&&(f.isTreeLeaf=!1):b===f&&(f.isTreeLeaf=!1))))}
    function To(a,b,c){Qo(a,c);var d=a.Wa.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.yh=!1),null===b||b.isTreeLeaf||(0===b.Wa.count?(b.yh=null,null!==e&&e.undoManager.isUndoingRedoing||(b.isTreeLeaf=!0)):Fk(b)))}
    function Fk(a){a.yh=!1;if(0!==a.Wa.count){var b=!0,c=a.diagram;if(null===c||!c.undoManager.isUndoingRedoing){null!==c&&(b=c.isTreePathToChildren);for(c=a.Wa.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.qq=function(a){U.prototype.qq.call(this,a);a||(Fk(this),a=this.rl,null!==a&&Uo(a,this))};t.rq=function(a){U.prototype.rq.call(this,a);a||(a=this.rl,null!==a&&null!==a.ad&&(a.ad.remove(this),a.o()))};
    t.dk=function(){if(0<this.Wa.count){var a=this.diagram;if(null!==a)for(var b=null!==a.commandHandler?a.commandHandler.deletesConnectedLinks:!0,c=this.Wa.copy().iterator;c.next();){var d=c.value;b?a.remove(d):(d.fromNode===this&&(d.fromNode=null),d.toNode===this&&(d.toNode=null))}}this.labeledLink=null;U.prototype.dk.call(this)};t.mt=function(a){if(null===this.rc){if(""===a&&!1===this.Gh)return this;Vo(this)}var b=this.rc.H(a);return null!==b||""!==a&&(b=this.rc.H(""),null!==b)?b:this};
    function Vo(a){null===a.rc?a.rc=new G:a.rc.clear();a.Km(a,function(a,c){Vl(a,c)});0===a.rc.count&&a.rc.add("",a)}function Vl(a,b){var c=b.portId;null!==c&&null!==a.rc&&a.rc.add(c,b)}function Ul(a,b,c){var d=b.portId;if(null!==d&&(null!==a.rc&&a.rc.remove(d),b=a.diagram,null!==b&&c)){c=null;for(a=a.findLinksConnected(d);a.next();)d=a.value,null===c&&(c=Fa()),c.push(d);if(null!==c){for(a=0;a<c.length;a++)b.remove(c[a]);Ha(c)}}}
    t.Xz=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.Wa.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.Wa.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.Az=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this;if(a)for(;;){a=null;for(var c=b.Wa.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.Wa.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.kz=function(a){if(null===a)return null;if(this===a)return this;for(var b=this;null!==b;)Fo(b,!0),b=b.zg();var c=null;for(b=a;null!==b;){if(0!==(b.D&1048576)){c=b;break}b=b.zg()}for(b=this;null!==b;)Fo(b,!1),b=b.zg();return c};t.Vi=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this.Wa.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.zg=function(){var a=this.yh;if(null===a)return null;if(a instanceof W)return a;var b=!0;a=this.diagram;null!==a&&(b=a.isTreePathToChildren);a=this.Wa.iterator;if(b)for(;a.next();){if(b=a.value,b.isTreeLink&&(b=b.fromNode,b!==this))return this.yh=b}else for(;a.next();)if(b=a.value,b.isTreeLink&&(b=b.toNode,b!==this))return this.yh=b;return this.yh=null};t.yz=function(){function a(b,d){if(null!==b){d.add(b);var c=b.Vi();null!==c&&(d.add(c),a(b.zg(),d))}}var b=new F;a(this,b);return b};
    t.xz=function(){return Wo(this,this)};function Wo(a,b){b=b.zg();return null===b?0:1+Wo(a,b)}t.nq=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=new jb(this.Wa);var c=this;b.predicate=a?function(a){return a.isTreeLink&&a.fromNode===c?!0:!1}:function(a){return a.isTreeLink&&a.toNode===c?!0:!1};return b};
    t.yv=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);var c=b=null,d=this.Wa.iterator;if(a)for(;d.next();)a=d.value,a.isTreeLink&&a.fromNode===this&&(a=a.toNode,null!==b?b.add(a):null!==c&&c!==a?(b=new E,b.add(c),b.add(a)):c=a);else for(;d.next();)a=d.value,a.isTreeLink&&a.toNode===this&&(a=a.fromNode,null!==b?b.add(a):null!==c&&c!==a?(b=new E,b.add(c),b.add(a)):c=a);return null!==b?b.iterator:null!==c?new gb(c):fb};
    t.zz=function(a){void 0===a&&(a=Infinity);var b=new F;Uk(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.De){b.De=!0;var c=new F;c.add(this);Xo(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===ri);b.De=!1}};function Xo(a,b,c,d,e,f,g){if(1<d)for(var h=c?a.lq():a.wd();h.next();){var k=h.value;k.isTreeLink&&(k=k.qt(a),null===k||k===a||b.contains(k)||(b.add(k),Xo(k,b,c,d-1,e,f,g)))}else Yo(a,b,c,e,f,g)}
    function Yo(a,b,c,d,e,f){for(var g=e===a?!0:a.isTreeExpanded,h=c?a.lq():a.wd();h.next();){var k=h.value;if(k.isTreeLink&&(k=k.qt(a),null!==k&&k!==a)){var l=b.contains(k);l||b.add(k);g&&(f&&d.Tj(k,e),k.Hh(),k.Ob(!1));k.isTreeExpanded&&(k.wasTreeExpanded=k.isTreeExpanded,l||Yo(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.De){b.De=!0;var c=new F;c.add(this);Zo(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===ri);b.De=!1}};
    function Zo(a,b,c,d,e,f,g){for(var h=f===a?!1:a.isTreeExpanded,k=c?a.lq():a.wd();k.next();){var l=k.value;l.isTreeLink&&(h||l.ld||l.Ta(),l=l.qt(a),null!==l&&l!==a&&!b.contains(l)&&(b.add(l),h||(l.Ob(!0),l.Hh(),g&&e.Vj(l,f)),2<d||l.wasTreeExpanded))&&(l.wasTreeExpanded=!1,Zo(l,b,c,d-1,e,f,g))}a.isTreeExpanded=!0}
    ma.Object.defineProperties(W.prototype,{portSpreading:{get:function(){return this.fp},set:function(a){var b=this.fp;b!==a&&(this.fp=a,this.g("portSpreading",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.fd())}},avoidable:{get:function(){return 0!==(this.P&8)},set:function(a){var b=0!==(this.P&8);if(b!==a){this.P^=8;var c=this.diagram;null!==c&&zk(c,this);this.g("avoidable",b,a)}}},avoidableMargin:{
        get:function(){return this.Ik},set:function(a){"number"===typeof a&&(a=new oc(a));var b=this.Ik;if(!b.w(a)){this.Ik=a=a.G();var c=this.diagram;null!==c&&zk(c,this);this.g("avoidableMargin",b,a)}}},linksConnected:{get:function(){return this.Wa.iterator}},linkConnected:{get:function(){return this.oo},set:function(a){var b=this.oo;b!==a&&(this.oo=a,this.g("linkConnected",b,a))}},linkDisconnected:{get:function(){return this.po},
        set:function(a){var b=this.po;b!==a&&(this.po=a,this.g("linkDisconnected",b,a))}},linkValidation:{get:function(){return this.xi},set:function(a){var b=this.xi;b!==a&&(this.xi=a,this.g("linkValidation",b,a))}},isLinkLabel:{get:function(){return null!==this.rl}},labeledLink:{get:function(){return this.rl},set:function(a){var b=this.rl;if(b!==a){var c=this.diagram,d=this.data;if(null!==b){null!==b.ad&&(b.ad.remove(this),
          b.o());if(null!==c&&null!==d&&!c.undoManager.isUndoingRedoing){var e=b.data,f=c.model;if(null!==e&&f.pm()){var g=f.ja(d);void 0!==g&&f.ey(e,g)}}this.containingGroup=null}this.rl=a;null!==a&&(Uo(a,this),null===c||null===d||c.undoManager.isUndoingRedoing||(e=a.data,c=c.model,null!==e&&c.pm()&&(d=c.ja(d),void 0!==d&&c.gv(e,d))),this.containingGroup=a.containingGroup);El(this);this.g("labeledLink",b,a)}}},port:{get:function(){return this.mt("")}},ports:{
        get:function(){null===this.rc&&Vo(this);return this.rc.iteratorValues}},isTreeExpanded:{get:function(){return 0!==(this.P&1)},set:function(a){var b=0!==(this.P&1);if(b!==a){this.P^=1;var c=this.diagram;this.g("isTreeExpanded",b,a);b=this.treeExpandedChanged;if(null!==b){var d=!0;null!==c&&(d=c.Z,c.Z=!0);b(this);null!==c&&(c.Z=d)}null!==c&&c.undoManager.isUndoingRedoing?this.Ob(a):a?this.expandTree():this.collapseTree()}}},wasTreeExpanded:{
        get:function(){return 0!==(this.P&2)},set:function(a){var b=0!==(this.P&2);b!==a&&(this.P^=2,this.g("wasTreeExpanded",b,a))}},treeExpandedChanged:{get:function(){return this.Wp},set:function(a){var b=this.Wp;b!==a&&(this.Wp=a,this.g("treeExpandedChanged",b,a))}},isTreeLeaf:{get:function(){return 0!==(this.P&4)},set:function(a){var b=0!==(this.P&4);b!==a&&(this.P^=4,this.g("isTreeLeaf",b,a))}}});W.prototype.expandTree=W.prototype.expandTree;
    W.prototype.collapseTree=W.prototype.collapseTree;W.prototype.findTreeParts=W.prototype.zz;W.prototype.findTreeChildrenNodes=W.prototype.yv;W.prototype.findTreeChildrenLinks=W.prototype.nq;W.prototype.findTreeLevel=W.prototype.xz;W.prototype.findTreeParentChain=W.prototype.yz;W.prototype.findTreeParentNode=W.prototype.zg;W.prototype.findTreeParentLink=W.prototype.Vi;W.prototype.findCommonTreeParent=W.prototype.kz;W.prototype.findTreeRoot=W.prototype.Az;W.prototype.isInTreeOf=W.prototype.Xz;
    W.prototype.findPort=W.prototype.mt;W.prototype.findLinksTo=W.prototype.oz;W.prototype.findLinksBetween=W.prototype.nz;W.prototype.findNodesInto=W.prototype.vv;W.prototype.findNodesOutOf=W.prototype.wv;W.prototype.findNodesConnected=W.prototype.uv;W.prototype.findLinksInto=W.prototype.wd;W.prototype.findLinksOutOf=W.prototype.lq;W.prototype.findExternalTreeLinksConnected=W.prototype.Lx;W.prototype.invalidateConnectedLinks=W.prototype.fd;W.prototype.invalidateLinkBundle=W.prototype.Vz;
    var $o=new D(W,"SpreadingNone",10),No=new D(W,"SpreadingEvenly",11),ap=new D(W,"SpreadingPacked",12);W.className="Node";W.SpreadingNone=$o;W.SpreadingEvenly=No;W.SpreadingPacked=ap;function T(a){W.call(this,a);this.P|=4608;this.zo=new F;this.zl=new F;this.Ra=this.Np=this.yi=this.Ao=this.yo=null;this.ic=new Fi;this.ic.group=this}la(T,W);
    T.prototype.cloneProtected=function(a){W.prototype.cloneProtected.call(this,a);this.P=this.P&-32769;a.yo=this.yo;a.Ao=this.Ao;a.yi=this.yi;a.Np=this.Np;var b=a.hm(function(a){return a instanceof vg});b instanceof vg?a.Ra=b:a.Ra=null;null!==this.ic?(a.ic=this.ic.copy(),a.ic.group=a):(null!==a.ic&&(a.ic.group=null),a.ic=null)};t=T.prototype;
    t.tf=function(a){W.prototype.tf.call(this,a);var b=a.gk();for(a=a.memberParts;a.next();){var c=a.value;c.o();c.C(8);c.Yj();if(c instanceof W)c.fd(b);else if(c instanceof S)for(c=c.labelNodes;c.next();)c.value.fd(b)}};
    t.vk=function(a,b,c,d,e,f,g){if(a===we&&"elements"===b)if(e instanceof vg)null===this.Ra?this.Ra=e:this.Ra!==e&&B("Cannot insert a second Placeholder into the visual tree of a Group.");else{if(e instanceof X){var h=e.hm(function(a){return a instanceof vg});h instanceof vg&&(null===this.Ra?this.Ra=h:this.Ra!==h&&B("Cannot insert a second Placeholder into the visual tree of a Group."))}}else a===xe&&"elements"===b&&null!==this.Ra&&(d===this.Ra?this.Ra=null:d instanceof X&&this.Ra.Bg(d)&&(this.Ra=null));
      W.prototype.vk.call(this,a,b,c,d,e,f,g)};t.Dh=function(a,b,c,d){this.Ye=this.Ra;W.prototype.Dh.call(this,a,b,c,d)};t.yb=function(){this.memberParts.each(function(a){a.yb()});W.prototype.yb.call(this)};t.bj=function(){if(!W.prototype.bj.call(this))return!1;for(var a=this.memberParts;a.next();){var b=a.value;if(b instanceof W){if(b.isVisible()&&uj(b))return!1}else if(b instanceof S&&b.isVisible()&&uj(b)&&b.fromNode!==this&&b.toNode!==this)return!1}return!0};
    function Go(a,b){if(a.zo.add(b)){b instanceof T&&a.zl.add(b);var c=a.memberAdded;if(null!==c){var d=!0,e=a.diagram;null!==e&&(d=e.Z,e.Z=!0);c(a,b);null!==e&&(e.Z=d)}a.isVisible()&&a.isSubGraphExpanded||b.Ob(!1)}b instanceof S&&!a.computesBoundsIncludingLinks||(b=a.Ra,null===b&&(b=a),b.o())}
    function Ho(a,b){if(a.zo.remove(b)){b instanceof T&&a.zl.remove(b);var c=a.memberRemoved;if(null!==c){var d=!0,e=a.diagram;null!==e&&(d=e.Z,e.Z=!0);c(a,b);null!==e&&(e.Z=d)}a.isVisible()&&a.isSubGraphExpanded||b.Ob(!0)}b instanceof S&&!a.computesBoundsIncludingLinks||(b=a.Ra,null===b&&(b=a),b.o())}t.dk=function(){if(0<this.zo.count){var a=this.diagram;if(null!==a)for(var b=this.zo.copy().iterator;b.next();)a.remove(b.value)}W.prototype.dk.call(this)};
    T.prototype.canAddMembers=function(a){var b=this.diagram;if(null===b)return!1;b=b.commandHandler;for(a=Wk(a).iterator;a.next();)if(!b.isValidMember(this,a.value))return!1;return!0};T.prototype.addMembers=function(a,b){var c=this.diagram;if(null===c)return!1;c=c.commandHandler;var d=!0;for(a=Wk(a).iterator;a.next();){var e=a.value;!b||c.isValidMember(this,e)?e.containingGroup=this:d=!1}return d};
    T.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=T.prototype;
    t.fd=function(a){void 0===a&&(a=null);var b=0!==(this.P&65536);W.prototype.fd.call(this,a);if(!b)for(0!==(this.P&65536)!==!0&&(this.P=this.P^65536),b=this.tv();b.next();){var c=b.value;if(null===a||!a.contains(c)){var d=c.fromNode;null!==d&&d!==this&&d.Xd(this)&&!d.isVisible()?(Qo(d,c.fromPort),Qo(d,c.toPort),c.Ta()):(d=c.toNode,null!==d&&d!==this&&d.Xd(this)&&!d.isVisible()&&(Qo(d,c.fromPort),Qo(d,c.toPort),c.Ta()))}}};
    t.tv=function(){var a=this.gk();a.add(this);for(var b=new F,c=a.iterator;c.next();){var d=c.value;if(d instanceof W)for(d=d.linksConnected;d.next();){var e=d.value;a.contains(e)||b.add(e)}}return b.iterator};t.mz=function(){var a=this.gk();a.add(this);for(var b=new F,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;a.contains(f)&&f!==this||b.add(f);e=e.toNode;a.contains(e)&&e!==this||b.add(e)}}return b.iterator};
    t.lz=function(){function a(b,d){null!==b&&(d.add(b),a(b.containingGroup,d))}var b=new F;a(this,b);return b};t.gk=function(){var a=new F;Uk(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)};T.prototype.collapseSubGraph=function(){var a=this.diagram;if(null!==a&&!a.De){a.De=!0;var b=this.gk();bp(this,b,a,this);a.De=!1}};
    function bp(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Ob(!1);f instanceof T&&f.isSubGraphExpanded&&(f.wasSubGraphExpanded=f.isSubGraphExpanded,bp(f,b,c,d));if(f instanceof W)f.fd(b),c.Tj(f,d);else if(f instanceof S)for(f=f.labelNodes;f.next();)f.value.fd(b)}a.isSubGraphExpanded=!1}T.prototype.expandSubGraph=function(){var a=this.diagram;if(null!==a&&!a.De){a.De=!0;var b=this.gk();cp(this,b,a,this);a.De=!1}};
    function cp(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Ob(!0);f instanceof T&&f.wasSubGraphExpanded&&(f.wasSubGraphExpanded=!1,cp(f,b,c,d));if(f instanceof W)f.fd(b),c.Vj(f,d);else if(f instanceof S)for(f=f.labelNodes;f.next();)f.value.fd(b)}a.isSubGraphExpanded=!0}
    T.prototype.move=function(a,b){void 0===b&&(b=!1);var c=b?this.location:this.position,d=c.x;c=c.y;var e=a.x,f=a.y;if(!(d===e||isNaN(d)&&isNaN(e))||!(c===f||isNaN(c)&&isNaN(f))){d=e-(isNaN(d)?0:d);c=f-(isNaN(c)?0:c);f=I.alloc();W.prototype.move.call(this,a,b);a=new F;for(b=this.gk().iterator;b.next();)if(e=b.value,e instanceof S&&(e.suspendsRouting&&a.add(e),e.ld||e.fromNode!==this&&e.toNode!==this))e.suspendsRouting=!0;for(b.reset();b.next();)if(e=b.value,!(e.Ih()||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 S&&(e.suspendsRouting=a.contains(e),e.ld||e.fromNode!==this&&e.toNode!==this))g=e.position,f.x=g.x+d,f.y=g.y+c,f.u()?e.move(f):e.Ta(),Rj(e)&&e.Ta();I.free(f)}};
    ma.Object.defineProperties(T.prototype,{placeholder:{get:function(){return this.Ra}},computesBoundsAfterDrag:{get:function(){return 0!==(this.P&2048)},set:function(a){var b=0!==(this.P&2048);b!==a&&(this.P^=2048,this.g("computesBoundsAfterDrag",b,a))}},computesBoundsIncludingLinks:{get:function(){return 0!==(this.P&4096)},set:function(a){var b=0!==(this.P&4096);b!==a&&(this.P^=4096,this.g("computesBoundsIncludingLinks",
          b,a))}},computesBoundsIncludingLocation:{get:function(){return 0!==(this.P&8192)},set:function(a){var b=0!==(this.P&8192);b!==a&&(this.P^=8192,this.g("computesBoundsIncludingLocation",b,a))}},handlesDragDropForMembers:{get:function(){return 0!==(this.P&16384)},set:function(a){var b=0!==(this.P&16384);b!==a&&(this.P^=16384,this.g("handlesDragDropForMembers",b,a))}},memberParts:{get:function(){return this.zo.iterator}},
      layout:{get:function(){return this.ic},set:function(a){var b=this.ic;if(b!==a){null!==b&&(b.diagram=null,b.group=null);this.ic=a;var c=this.diagram;null!==a&&(a.diagram=c,a.group=this);null!==c&&(c.Gf=!0);this.g("layout",b,a);null!==c&&c.Pb()}}},memberAdded:{get:function(){return this.yo},set:function(a){var b=this.yo;b!==a&&(this.yo=a,this.g("memberAdded",b,a))}},memberRemoved:{get:function(){return this.Ao},
        set:function(a){var b=this.Ao;b!==a&&(this.Ao=a,this.g("memberRemoved",b,a))}},memberValidation:{get:function(){return this.yi},set:function(a){var b=this.yi;b!==a&&(this.yi=a,this.g("memberValidation",b,a))}},ungroupable:{get:function(){return 0!==(this.P&256)},set:function(a){var b=0!==(this.P&256);b!==a&&(this.P^=256,this.g("ungroupable",b,a))}},isSubGraphExpanded:{get:function(){return 0!==(this.P&512)},
        set:function(a){var b=0!==(this.P&512);if(b!==a){this.P^=512;var c=this.diagram;this.g("isSubGraphExpanded",b,a);b=this.subGraphExpandedChanged;if(null!==b){var d=!0;null!==c&&(d=c.Z,c.Z=!0);b(this);null!==c&&(c.Z=d)}null!==c&&c.undoManager.isUndoingRedoing?(null!==this.Ra&&this.Ra.o(),this.memberParts.each(function(a){a.updateAdornments()})):a?this.expandSubGraph():this.collapseSubGraph()}}},wasSubGraphExpanded:{get:function(){return 0!==(this.P&1024)},set:function(a){var b=
          0!==(this.P&1024);b!==a&&(this.P^=1024,this.g("wasSubGraphExpanded",b,a))}},subGraphExpandedChanged:{get:function(){return this.Np},set:function(a){var b=this.Np;b!==a&&(this.Np=a,this.g("subGraphExpandedChanged",b,a))}},uk:{get:function(){return 0!==(this.P&32768)},set:function(a){0!==(this.P&32768)!==a&&(this.P^=32768)}}});T.prototype.expandSubGraph=T.prototype.expandSubGraph;T.prototype.collapseSubGraph=T.prototype.collapseSubGraph;
    T.prototype.findSubGraphParts=T.prototype.gk;T.prototype.findContainingGroupChain=T.prototype.lz;T.prototype.findExternalNodesConnected=T.prototype.mz;T.prototype.findExternalLinksConnected=T.prototype.tv;T.prototype.ensureBounds=T.prototype.yb;T.className="Group";function vg(){Y.call(this);this.bb=sc;this.tp=new N(NaN,NaN,NaN,NaN)}la(vg,Y);vg.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.bb=this.bb.G();a.tp=this.tp.copy()};
    vg.prototype.Fh=function(a){if(null===this.background&&null===this.areaBackground)return!1;var b=this.naturalBounds;return fc(0,0,b.width,b.height,a.x,a.y)};
    vg.prototype.sm=function(){var a=this.part;null!==a&&(a instanceof T||a instanceof Ke)||B("Placeholder is not inside a Group or Adornment.");if(a instanceof T){var b=this.computeBorder(this.tp),c=this.minSize,d=this.oc;Vb(d,(isFinite(c.width)?Math.max(c.width,b.width):b.width)||0,(isFinite(c.height)?Math.max(c.height,b.height):b.height)||0);jl(this,0,0,d.width,d.height);d=a.memberParts;for(c=!1;d.next();)if(d.value.isVisible()){c=!0;break}d=a.diagram;!c||null===d||d.animationManager.Jv(a)||isNaN(b.x)||
    isNaN(b.y)||(c=I.alloc(),c.dj(b,a.locationSpot),c.w(a.location)||(a.location=new I(c.x,c.y)),I.free(c))}else{b=this.oc;c=this.bb;d=c.left+c.right;var e=c.top+c.bottom,f=a.adornedObject;a.angle=f.Xi();var g=0;f instanceof Kf&&(g=f.strokeWidth);var h=f.vf(),k=f.naturalBounds,l=(k.width+g)*h;g=(k.height+g)*h;a.type!==X.Link&&(f=f.ga("Selection"===a.category?vc:a.locationSpot,I.alloc()),a.location=f,I.free(f));isNaN(l)||isNaN(g)?(a=a.adornedObject,l=a.ga(vc,I.alloc()),f=N.allocAt(l.x,l.y,0,0),f.Ie(a.ga(Gc,
      l)),f.Ie(a.ga(yc,l)),f.Ie(a.ga(Cc,l)),Vb(b,f.width+d||0,f.height+e||0),jl(this,-c.left,-c.top,b.width,b.height),I.free(l),N.free(f)):(Vb(b,l+d||0,g+e||0),jl(this,-c.left,-c.top,b.width,b.height))}};vg.prototype.Dh=function(a,b,c,d){this.actualBounds.h(a,b,c,d)};
    vg.prototype.computeBorder=function(a){var b=this.part,c=b.diagram;if(null!==c&&b instanceof T&&!b.layer.isTemporary&&b.computesBoundsAfterDrag&&this.tp.u()){var d=c.toolManager.findTool("Dragging");if(d===c.currentTool&&(c=d.computeBorder(b,this.tp,a),null!==c))return c}c=N.alloc();d=this.computeMemberBounds(c);var e=this.bb;b instanceof T&&!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 T&&b.computesBoundsIncludingLocation&&b.location.u()&&a.Ie(b.location);return a};
    vg.prototype.computeMemberBounds=function(a){if(!(this.part instanceof T))return a.h(0,0,0,0),a;for(var b=this.part,c=Infinity,d=Infinity,e=-Infinity,f=-Infinity,g=b.memberParts;g.next();){var h=g.value;if(h.isVisible()){if(h instanceof S){if(!b.computesBoundsIncludingLinks)continue;if(tj(h))continue;if(h.fromNode===b||h.toNode===b)continue}h=h.actualBounds;h.left<c&&(c=h.left);h.top<d&&(d=h.top);h.right>e&&(e=h.right);h.bottom>f&&(f=h.bottom)}}isFinite(c)&&isFinite(d)?a.h(c,d,e-c,f-d):(b=b.location,
      a.h(b.x,b.y,0,0));return a};ma.Object.defineProperties(vg.prototype,{padding:{get:function(){return this.bb},set:function(a){"number"===typeof a&&(a=new oc(a));var b=this.bb;b.w(a)||(this.bb=a=a.G(),this.g("padding",b,a))}}});vg.className="Placeholder";
    function S(){U.call(this,X.Link);this.Pa=8;this.Re=null;this.Se="";this.mf=this.Mn=null;this.nf="";this.Vp=null;this.Dk=ag;this.pn=0;this.rn=ag;this.sn=NaN;this.Lj=dp;this.Ip=.5;this.ad=null;this.wb=(new E).freeze();this.mh=this.hh=null;this.El=new N;this.ka=new sd;this.Yn=!0;this.I=this.v=this.If=this.Rf=null;this.l=[];this.Yu=new I;this.Gr=this.ox=this.nx=null;this.su=NaN;this.O=null}la(S,U);
    S.prototype.cloneProtected=function(a){U.prototype.cloneProtected.call(this,a);a.Pa=this.Pa&-113;a.Se=this.Se;a.Mn=this.Mn;a.nf=this.nf;a.Vp=this.Vp;a.Dk=this.Dk;a.pn=this.pn;a.rn=this.rn;a.sn=this.sn;a.Lj=this.Lj;a.Ip=this.Ip;null!==this.O&&(a.O=this.O.copy())};t=S.prototype;t.tf=function(a){U.prototype.tf.call(this,a);this.Se=a.Se;this.nf=a.nf;a.hh=null;a.Ta();a.If=this.If;var b=a.fromPort;null!==b&&Qo(a.fromNode,b);b=a.toPort;null!==b&&Qo(a.toNode,b)};
    t.cb=function(a){a.classType===S?2===(a.value&2)?this.routing=a:a===og||a===$f||a===Zf?this.curve=a:a===ep||a===fp||a===gp?this.adjusting=a:a!==dp&&a!==ag&&B("Unknown Link enum value for a Link property: "+a):U.prototype.cb.call(this,a)};t.Ec=function(){null===this.O&&(this.O=new fl)};t.bj=function(){var a=this.fromNode;if(null!==a){var b=a.findVisibleNode();null!==b&&(a=b);if(uj(a)||vj(a))return!1}a=this.toNode;return null!==a&&(b=a.findVisibleNode(),null!==b&&(a=b),uj(a)||vj(a))?!1:!0};t.jw=function(){return!1};
    t.Pt=function(){};t.Wb=function(){return!1};S.prototype.computeAngle=function(a,b,c){return S.computeAngle(b,c)};S.computeAngle=function(a,b){switch(a){default:case ag:a=0;break;case Wm:a=b;break;case Pm:a=b+90;break;case Rm:a=b-90;break;case hp:a=b+180;break;case Xm:a=J.zq(b);90<a&&270>a&&(a-=180);break;case Qm:a=J.zq(b+90);90<a&&270>a&&(a-=180);break;case Sm:a=J.zq(b-90);90<a&&270>a&&(a-=180);break;case Tm:a=J.zq(b);if(45<a&&135>a||225<a&&315>a)return 0;90<a&&270>a&&(a-=180)}return J.zq(a)};
    function Mo(a){var b=a.fromNode,c=a.toNode,d=null;null!==b?d=null!==c?b.Kx(c):b.containingGroup:null!==c?d=c.containingGroup:d=null;b=d;c=a.di;if(c!==b){null!==c&&Ho(c,a);a.di=b;null!==b&&Go(b,a);var e=a.containingGroupChanged;if(null!==e){var f=!0,g=a.diagram;null!==g&&(f=g.Z,g.Z=!0);e(a,c,b);null!==g&&(g.Z=f)}!a.ld||a.nx!==c&&a.ox!==c||a.Ta()}if(a.isLabeledLink)for(a=a.labelNodes;a.next();)a.value.containingGroup=d}t=S.prototype;
    t.Hh=function(){var a=this.containingGroup;null!==a&&this.fromNode!==a&&this.toNode!==a&&a.computesBoundsIncludingLinks&&U.prototype.Hh.call(this)};t.qt=function(a){var b=this.fromNode;return a===b?this.toNode:b};t.Hz=function(a){var b=this.fromPort;return a===b?this.toPort:b};function Uo(a,b){null===a.ad&&(a.ad=new F);a.ad.add(b);a.o()}
    t.qq=function(a){U.prototype.qq.call(this,a);ip(this)&&this.tq(this.actualBounds);if(!a){a=this.Re;var b=null;null!==a&&(b=this.fromPort,So(a,this,b));var c=this.mf;if(null!==c){var d=this.toPort;c===a&&d===b||So(c,this,d)}jp(this)}};t.rq=function(a){U.prototype.rq.call(this,a);ip(this)&&this.tq(this.actualBounds);if(!a){a=this.Re;var b=null;null!==a&&(b=this.fromPort,To(a,this,b));var c=this.mf;if(null!==c){var d=this.toPort;c===a&&d===b||To(c,this,d)}kp(this)}};
    t.dk=function(){this.ld=!0;if(null!==this.ad){var a=this.diagram;if(null!==a)for(var b=this.ad.copy().iterator;b.next();)a.remove(b.value)}null!==this.data&&(a=this.diagram,null!==a&&a.partManager.removeDataForLink(this))};S.prototype.updateRelationshipsFromData=function(){if(null!==this.data){var a=this.diagram;null!==a&&a.partManager.updateRelationshipsFromData(this)}};
    S.prototype.move=function(a,b){var c=b?this.location:this.position,d=c.x;isNaN(d)&&(d=0);var e=c.y;isNaN(e)&&(e=0);d=a.x-d;e=a.y-e;!0===b?U.prototype.move.call(this,a,!1):(a=I.allocAt(c.x+d,c.y+e),U.prototype.move.call(this,a,!1),I.free(a));pf(this,d,e);for(a=this.labelNodes;a.next();)b=a.value,c=b.position,b.moveTo(c.x+d,c.y+e)};
    S.prototype.canRelinkFrom=function(){if(!this.relinkableFrom)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowRelink)return!1;a=a.diagram;return null===a||a.allowRelink?!0:!1};S.prototype.canRelinkTo=function(){if(!this.relinkableTo)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowRelink)return!1;a=a.diagram;return null===a||a.allowRelink?!0:!1};
    S.prototype.computeMidPoint=function(a){var b=this.pointsCount;if(0===b)return a.assign(Kb),a;if(1===b)return a.assign(this.i(0)),a;if(2===b){var c=this.i(0),d=this.i(1);a.h((c.x+d.x)/2,(c.y+d.y)/2);return a}if(this.isOrthogonal&&(15<=this.computeCorner()||this.computeCurve()===og))return this.ka.Bv(.5,a),a.add(this.i(0)),c=this.ka.figures.first(),a.offset(-c.startX,-c.startY),a;if(this.computeCurve()===og){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);J.Sy(d.x,d.y,e.x,e.y,f.x,f.y,c.x,c.y,a)}else a.assign(this.i(c));return a}var g=this.flattenedLengths;c=this.flattenedTotalLength;for(e=f=d=0;d<c/2&&f<b;){e=g[f];if(d+e>c/2)break;d+=e;f++}b=this.i(f);f=this.i(f+1);1>Math.abs(b.x-f.x)?b.y>f.y?a.h(b.x,b.y-(c/2-d)):a.h(b.x,b.y+(c/2-d)):1>Math.abs(b.y-f.y)?b.x>f.x?a.h(b.x-(c/2-d),b.y):a.h(b.x+(c/2-d),b.y):(c=(c/2-d)/e,a.h(b.x+c*(f.x-b.x),b.y+c*(f.y-b.y)));return a};
    S.prototype.computeMidAngle=function(){var a=this.pointsCount;if(2>a)return NaN;if(2===a)return this.i(0).Sa(this.i(1));if(this.isOrthogonal&&(15<=this.computeCorner()||this.computeCurve()===og))return this.ka.Qx(.5);if(this.computeCurve()===og&&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 J.Ry(a.x,a.y,b.x,b.y,d.x,d.y,c.x,c.y)}if(0<c&&c+1<a)return this.i(c-1).Sa(this.i(c+1))}b=this.flattenedLengths;d=this.flattenedTotalLength;
      var e=0;c=0;for(var f;e<d/2&&c<a;){f=b[c];if(e+f>d/2)break;e+=f;c++}b=this.i(c);d=this.i(c+1);if(1>Math.abs(b.x-d.x)&&1>Math.abs(b.y-d.y)){if(0<c&&c+2<a)return this.i(c-1).Sa(this.i(c+2))}else{if(1>Math.abs(b.x-d.x))return b.y>d.y?270:90;if(1>Math.abs(b.y-d.y))return b.x>d.x?180:0}return b.Sa(d)};t=S.prototype;t.i=function(a){return this.wb.j[a]};t.jd=function(a,b){this.wb.hd(a,b)};t.K=function(a,b,c){this.wb.hd(a,new I(b,c))};t.Tz=function(a,b){this.wb.Kb(a,b)};
    t.m=function(a,b,c){this.wb.Kb(a,new I(b,c))};t.ye=function(a){this.wb.add(a)};t.rf=function(a,b){this.wb.add(new I(a,b))};t.$v=function(a){this.wb.lb(a)};t.Zj=function(){this.wb.clear()};
    function pf(a,b,c){if(0!==b||0!==c){for(var d=a.ld,e=new E,f=a.wb.iterator;f.next();){var g=f.value;e.add((new I(g.x+b,g.y+c)).freeze())}e.freeze();f=a.wb;a.wb=e;g=a.diagram;isNaN(b)||isNaN(c)||null!==g&&g.animationManager.qc?a.o():(a.ag.h(a.ag.x+b,a.ag.y+c),a.ma.h(a.ma.x+b,a.ma.y+c),El(a));d&&lp(a);null!==g&&g.animationManager.qc&&(a.mh=e);a.g("points",f,e)}}t.Lh=function(){null===this.hh&&(this.hh=this.wb,this.wb=this.wb.copy())};
    t.sf=function(){if(null!==this.hh){for(var a=this.hh,b=this.wb,c=Infinity,d=Infinity,e=a.j,f=e.length,g=0;g<f;g++){var h=e[g];c=Math.min(h.x,c);d=Math.min(h.y,d)}h=g=Infinity;for(var k=b.j,l=k.length,m=0;m<l;m++){var n=k[m];g=Math.min(n.x,g);h=Math.min(n.y,h);n.freeze()}b.freeze();if(l===f)for(f=0;f<l;f++){if(m=e[f],n=k[f],m.x-c!==n.x-g||m.y-d!==n.y-h){this.o();this.cc();break}}else this.o(),this.cc();this.hh=null;c=this.diagram;null!==c&&c.animationManager.qc&&(this.mh=b);lp(this);this.g("points",
      a,b)}};t.hy=function(){null!==this.hh&&(this.wb=this.hh,this.hh=null)};function lp(a){0===a.wb.count?a.ld=!1:(a.ld=!0,a.Gr=null,a.su=NaN,a.defaultFromPoint=a.i(0),a.defaultToPoint=a.i(a.pointsCount-1),mp(a,!1))}
    t.Ta=function(){if(!this.suspendsRouting){var a=this.diagram;if(a){if(a.zt.contains(this)||a.undoManager.isUndoingRedoing)return;a=a.animationManager;if(a.isTicking&&!a.isAnimating)return;null!==this.mh&&!a.isTicking&&a.isAnimating&&(this.mh=null)}a=this.path;null!==a&&(this.ld=!1,this.o(),a.o())}};t.hj=function(){if(!this.ld&&!this.mv){var a=!0;try{this.mv=!0,this.Lh(),a=this.computePoints()}finally{this.mv=!1,a?this.sf():this.hy()}}};
    S.prototype.computePoints=function(){var a=this.diagram;if(null===a)return!1;var b=this.fromNode,c=null;null===b?(a.kh||(a.Fl=new Kf,a.Fl.desiredSize=Lb,a.Fl.strokeWidth=0,a.kh=new W,a.kh.add(a.Fl),a.kh.yb()),this.defaultFromPoint&&(a.kh.position=a.kh.location=this.defaultFromPoint,a.kh.yb(),b=a.kh,c=a.Fl)):c=this.fromPort;if(null!==c&&!b.isVisible()){var d=b.findVisibleNode();null!==d&&d!==b?(b=d,c=d.port):b=d}this.nx=b;if(null===b||!b.location.u())return!1;for(;!(null===c||c.actualBounds.u()&&c.zf());)c=
      c.panel;if(null===c)return!1;var e=this.toNode,f=null;null===e?(a.lh||(a.Gl=new Kf,a.Gl.desiredSize=Lb,a.Gl.strokeWidth=0,a.lh=new W,a.lh.add(a.Gl),a.lh.yb()),this.defaultToPoint&&(a.lh.position=a.lh.location=this.defaultToPoint,a.lh.yb(),e=a.lh,f=a.Gl)):f=this.toPort;null===f||e.isVisible()||(a=e.findVisibleNode(),null!==a&&a!==e?(e=a,f=a.port):e=a);this.ox=e;if(null===e||!e.location.u())return!1;for(;!(null===f||f.actualBounds.u()&&f.zf());)f=f.panel;if(null===f)return!1;var g=this.pointsCount;
      d=this.computeSpot(!0,c);a=this.computeSpot(!1,f);var h=np(d),k=np(a),l=c===f&&null!==c,m=this.isOrthogonal,n=this.curve===og;this.Rf=l&&!m?n=!0:!1;var p=this.computeAdjusting()===ag||l;if(!m&&!l&&h&&k){if(h=!1,!p&&3<=g&&(p=this.getLinkPoint(b,c,d,!0,!1,e,f),k=this.getLinkPoint(e,f,a,!1,!1,b,c),h=this.adjustPoints(0,p,g-1,k))&&(p=this.getLinkPoint(b,c,d,!0,!1,e,f),k=this.getLinkPoint(e,f,a,!1,!1,b,c),this.adjustPoints(0,p,g-1,k)),!h)if(this.Zj(),n){g=this.getLinkPoint(b,c,d,!0,!1,e,f);p=this.getLinkPoint(e,
        f,a,!1,!1,b,c);h=p.x-g.x;k=p.y-g.y;l=this.computeCurviness();n=m=0;var r=g.x+h/3,q=g.y+k/3,u=r,v=q;J.A(k,0)?v=0<h?v-l:v+l:(m=-h/k,n=Math.sqrt(l*l/(m*m+1)),0>l&&(n=-n),u=(0>k?-1:1)*n+r,v=m*(u-r)+q);r=g.x+2*h/3;q=g.y+2*k/3;var w=r,y=q;J.A(k,0)?y=0<h?y-l:y+l:(w=(0>k?-1:1)*n+r,y=m*(w-r)+q);this.Zj();this.ye(g);this.rf(u,v);this.rf(w,y);this.ye(p);this.jd(0,this.getLinkPoint(b,c,d,!0,!1,e,f));this.jd(3,this.getLinkPoint(e,f,a,!1,!1,b,c))}else d=this.getLinkPoint(b,c,d,!0,!1,e,f),a=this.getLinkPoint(e,
        f,a,!1,!1,b,c),this.hasCurviness()?(p=a.x-d.x,e=a.y-d.y,f=this.computeCurviness(),b=d.x+p/2,c=d.y+e/2,g=b,h=c,J.A(e,0)?h=0<p?h-f:h+f:(p=-p/e,g=Math.sqrt(f*f/(p*p+1)),0>f&&(g=-g),g=(0>e?-1:1)*g+b,h=p*(g-b)+c),this.ye(d),this.rf(g,h)):this.ye(d),this.ye(a)}else{n=this.isAvoiding;p&&(m&&n||l)&&this.Zj();var z=l?this.computeCurviness():0;n=this.getLinkPoint(b,c,d,!0,m,e,f);r=u=q=0;if(m||!h||l)v=this.computeEndSegmentLength(b,c,d,!0),r=this.getLinkDirection(b,c,n,d,!0,m,e,f),l&&(h||d.w(a)||!m&&1===d.x+
        a.x&&1===d.y+a.y)&&(r-=m?90:30,0>z&&(r-=180)),0>r?r+=360:360<=r&&(r-=360),l&&(v+=Math.abs(z)*(m?1:2)),0===r?q=v:90===r?u=v:180===r?q=-v:270===r?u=-v:(q=v*Math.cos(r*Math.PI/180),u=v*Math.sin(r*Math.PI/180)),d.jc()&&l&&(v=c.ga(Ac,I.alloc()),w=I.allocAt(v.x+1E3*q,v.y+1E3*u),this.getLinkPointFromPoint(b,c,v,w,!0,n),I.free(v),I.free(w));v=this.getLinkPoint(e,f,a,!1,m,b,c);var A=y=w=0;if(m||!k||l){var C=this.computeEndSegmentLength(e,f,a,!1);A=this.getLinkDirection(e,f,v,a,!1,m,b,c);l&&(k||d.w(a)||!m&&
        1===d.x+a.x&&1===d.y+a.y)&&(A+=m?0:30,0>z&&(A+=180));0>A?A+=360:360<=A&&(A-=360);l&&(C+=Math.abs(z)*(m?1:2));0===A?w=C:90===A?y=C:180===A?w=-C:270===A?y=-C:(w=C*Math.cos(A*Math.PI/180),y=C*Math.sin(A*Math.PI/180));a.jc()&&l&&(a=f.ga(Ac,I.alloc()),d=I.allocAt(a.x+1E3*w,a.y+1E3*y),this.getLinkPointFromPoint(e,f,a,d,!1,v),I.free(a),I.free(d))}a=n;if(m||!h||l)a=new I(n.x+q,n.y+u);d=v;if(m||!k||l)d=new I(v.x+w,v.y+y);!p&&!m&&h&&3<g&&this.adjustPoints(0,n,g-2,d)?this.jd(g-1,v):!p&&!m&&k&&3<g&&this.adjustPoints(1,
        a,g-1,v)?this.jd(0,n):!p&&(m?6<=g:4<g)&&this.adjustPoints(1,a,g-2,d)?(this.jd(0,n),this.jd(g-1,v)):(this.Zj(),this.ye(n),(m||!h||l)&&this.ye(a),m&&this.addOrthoPoints(a,r,d,A,b,e),(m||!k||l)&&this.ye(d),this.ye(v))}return!0};function op(a,b){Math.abs(b.x-a.x)>Math.abs(b.y-a.y)?(b.x>=a.x?b.x=a.x+9E9:b.x=a.x-9E9,b.y=a.y):(b.y>=a.y?b.y=a.y+9E9:b.y=a.y-9E9,b.x=a.x);return b}
    S.prototype.getLinkPointFromPoint=function(a,b,c,d,e,f){void 0===f&&(f=new I);if(null===a||null===b)return f.assign(c),f;a.isVisible()||(e=a.findVisibleNode(),null!==e&&e!==a&&(b=e.port));a=null;e=b.panel;null===e||e.ae()||(e=e.panel);if(null===e){e=d.x;d=d.y;var g=c.x;c=c.y}else{a=e.vd;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.hk(e,d,g,c,f);null!==
    a&&f.transform(a);return f};function pp(a,b){var c=b.ep;null===c&&(c=new qp,c.port=b,c.node=b.part,b.ep=c);return rp(c,a)}
    S.prototype.getLinkPoint=function(a,b,c,d,e,f,g,h){void 0===h&&(h=new I);if(c.eb()&&!np(c))return b.ga(c,h),h;if(c.gd()){var k=pp(this,b);if(null!==k){h.assign(k.wq);if(e&&this.routing===sp){var l=pp(this,g);if(null!==l&&k.em<l.em){k=I.alloc();l=I.alloc();var m=new N(b.ga(vc,k),b.ga(Gc,l)),n=this.computeSpot(!d,g);a=this.getLinkPoint(f,g,n,!d,e,a,b,l);(c.xf(Ic)||c.xf(Jc))&&a.y>=m.y&&a.y<=m.y+m.height?h.y=a.y:(c.xf(Hc)||c.xf(Kc))&&a.x>=m.x&&a.x<=m.x+m.width&&(h.x=a.x);I.free(k);I.free(l)}}return h}}c=
      b.ga(.5===c.x&&.5===c.y?c:Ac,I.alloc());this.pointsCount>(e?6:2)?(g=d?this.i(1):this.i(this.pointsCount-2),e&&(g=op(c,g.copy()))):(k=this.computeSpot(!d,g),f=I.alloc(),g=g.ga(.5===k.x&&.5===k.y?k:Ac,f),e&&(g=op(c,g)),I.free(f));this.getLinkPointFromPoint(a,b,c,g,d,h);I.free(c);return h};
    S.prototype.getLinkDirection=function(a,b,c,d,e,f,g,h){a:if(d.eb())var k=d.x>d.y?d.x>1-d.y?0:d.x<1-d.y?270:315:d.x<d.y?d.x>1-d.y?90:d.x<1-d.y?180:135:.5>d.x?225:.5<d.x?45:0;else{if(d.gd()&&(k=pp(this,b),null!==k))switch(k.yc){case 1:k=270;break a;case 2:k=180;break a;default:case 4:k=0;break a;case 8:k=90;break a}k=b.ga(Ac,I.alloc());this.pointsCount>(f?6:2)?(h=e?this.i(1):this.i(this.pointsCount-2),h=f?op(k,h.copy()):c):(c=I.alloc(),h=h.ga(Ac,c),I.free(c));c=Math.abs(h.x-k.x)>Math.abs(h.y-k.y)?h.x>=
    k.x?0:180:h.y>=k.y?90:270;I.free(k);k=c}d.jc()&&g.Xd(a)&&(k+=180,360<=k&&(k-=360));if(np(d))return k;a=b.Xi();if(0===a)return k;45<=a&&135>a?k+=90:135<=a&&225>a?k+=180:225<=a&&315>a&&(k+=270);360<=k&&(k-=360);return k};S.prototype.computeEndSegmentLength=function(a,b,c,d){if(null!==b&&c.gd()&&(a=pp(this,b),null!==a))return a.rv;a=d?this.fromEndSegmentLength:this.toEndSegmentLength;null!==b&&isNaN(a)&&(a=d?b.fromEndSegmentLength:b.toEndSegmentLength);isNaN(a)&&(a=10);return a};
    S.prototype.computeSpot=function(a,b){void 0===b&&(b=null);a?(a=b?b:this.fromPort,null===a?a=Ac:(b=this.fromSpot,b.Mb()&&(b=a.fromSpot),a=b===$c?uc:b)):(a=b?b:this.toPort,null===a?a=Ac:(b=this.toSpot,b.Mb()&&(b=a.toSpot),a=b===$c?uc:b));return a};function np(a){return a===uc||.5===a.x&&.5===a.y}S.prototype.computeOtherPoint=function(a,b){if(this.computeAdjusting()!==ag&&4<this.pointsCount)return this.computeMidPoint(new I);a=b.ga(Ac);b=b.ep;b=null!==b?rp(b,this):null;null!==b&&(a=b.wq);return a};
    S.prototype.computeShortLength=function(a){if(a){a=this.fromShortLength;if(isNaN(a)){var b=this.fromPort;null!==b&&(a=b.fromShortLength)}return isNaN(a)?0:a}a=this.toShortLength;isNaN(a)&&(b=this.toPort,null!==b&&(a=b.toShortLength));return isNaN(a)?0:a};
    S.prototype.uf=function(a,b,c,d,e,f){if(!1===this.pickable)return!1;void 0===b&&(b=null);void 0===c&&(c=null);var g=f;void 0===f&&(g=qd.alloc(),g.reset());g.multiply(this.transform);if(this.Eh(a,g))return hn(this,b,c,e),void 0===f&&qd.free(g),!0;if(this.Gc(a,g)){var h=!1;if(!this.isAtomic)for(var k=this.W.j,l=k.length;l--;){var m=k[l];if(m.visible||m===this.locationObject){var n=m.actualBounds,p=this.naturalBounds;if(!(n.x>p.width||n.y>p.height||0>n.x+n.width||0>n.y+n.height)){n=qd.alloc();n.set(g);
      if(m instanceof X)h=m.uf(a,b,c,d,e,n);else if(this.path===m){if(m instanceof Kf)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.Eh(r,q))h=!0;else{if(void 0===q&&(q=m.transform,r.Ae(m.actualBounds))){h=!0;break b}h=r.left;p=r.right;var u=r.top;r=r.bottom;var v=I.alloc(),w=I.alloc(),y=I.alloc(),z=qd.alloc();z.set(q);z.Ov(m.transform);z.ut();w.x=p;w.y=u;w.transform(z);v.x=h;v.y=u;v.transform(z);q=!1;In(m,v,w,y)?q=!0:(v.x=p,v.y=r,v.transform(z),In(m,v,w,y)?q=!0:(w.x=
        h,w.y=r,w.transform(z),In(m,v,w,y)?q=!0:(v.x=h,v.y=u,v.transform(z),In(m,v,w,y)&&(q=!0))));qd.free(z);I.free(v);I.free(w);I.free(y);h=q}}else h=m.Eh(h,n)}else h=ll(m,a,d,n);h&&(p=m,null!==b&&(p=b(m)),p&&(null===c||c(p))&&e.add(p));qd.free(n)}}}void 0===f&&qd.free(g);return h||null!==this.background||null!==this.areaBackground}void 0===f&&qd.free(g);return!1};
    S.prototype.computeCurve=function(){if(null===this.Rf){var a=this.fromPort,b=this.isOrthogonal;this.Rf=null!==a&&a===this.toPort&&!b}return this.Rf?og:this.curve};S.prototype.computeCorner=function(){if(this.curve===og)return 0;var a=this.corner;if(isNaN(a)||0>a)a=10;return a};
    S.prototype.findMidLabel=function(){for(var a=this.path,b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d];if(e!==a&&!e.isPanelMain&&(-Infinity===e.segmentIndex||isNaN(e.segmentIndex)))return e}for(a=this.labelNodes;a.next();)if(b=a.value,-Infinity===b.segmentIndex||isNaN(b.segmentIndex))return b;return null};
    S.prototype.computeSpacing=function(){if(!this.isVisible())return 0;var a=Math.max(14,this.computeThickness());var b=this.fromPort,c=this.toPort;if(null!==b&&null!==c){var d=this.findMidLabel();if(null!==d){var e=d.naturalBounds,f=d.margin,g=isNaN(e.width)?30:e.width*d.scale+f.left+f.right;e=isNaN(e.height)?14:e.height*d.scale+f.top+f.bottom;d=d.segmentOrientation;d===Wm||d===Xm||d===hp?a=Math.max(a,e):d===Rm||d===Sm||d===Pm||d===Qm?a=Math.max(a,g):(b=b.ga(Ac).Sa(c.ga(Ac))/180*Math.PI,a=Math.max(a,
      Math.abs(Math.sin(b)*g)+Math.abs(Math.cos(b)*e)+1));this.curve===og&&(a*=1.333)}}return a};S.prototype.arrangeBundledLinks=function(a,b){if(b)for(b=0;b<a.length;b++){var c=a[b];c.computeAdjusting()===ag&&c.Ta()}};
    S.prototype.computeCurviness=function(){var a=this.curviness;if(isNaN(a)){a=16;var b=this.If;if(null!==b){for(var c=Fa(),d=0,e=b.links,f=0;f<e.length;f++){var g=e[f].computeSpacing();c.push(g);d+=g}d=-d/2;for(f=0;f<e.length;f++){if(e[f]===this){a=d+c[f]/2;break}d+=c[f]}b.Ct===this.fromNode&&(a=-a);Ha(c)}}return a};S.prototype.computeThickness=function(){if(!this.isVisible())return 0;var a=this.path;return null!==a?Math.max(a.strokeWidth,1):1};
    S.prototype.hasCurviness=function(){return!isNaN(this.curviness)||null!==this.If};
    S.prototype.adjustPoints=function(a,b,c,d){var e=this.computeAdjusting();if(this.isOrthogonal){if(e===fp)return!1;e===gp&&(e=ep)}switch(e){case fp:var f=this.i(a),g=this.i(c);if(!f.Ma(b)||!g.Ma(d)){e=f.x;f=f.y;var h=g.x-e,k=g.y-f,l=Math.sqrt(h*h+k*k);if(!J.$(l,0)){if(J.$(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);J.$(h,0)?p=0>p?-Math.PI/2:Math.PI/2:(p=Math.atan(p/Math.abs(h)),0>h&&(p=Math.PI-p));l=
      k/l;m=p-m;this.jd(a,b);for(a+=1;a<c;a++)b=this.i(a),h=b.x-e,k=b.y-f,b=Math.sqrt(h*h+k*k),J.$(b,0)||(J.$(h,0)?k=0>k?-Math.PI/2:Math.PI/2:(k=Math.atan(k/Math.abs(h)),0>h&&(k=Math.PI-k)),h=k+m,b*=l,this.K(a,g+b*Math.cos(h),n+b*Math.sin(h)));this.jd(c,d)}}return!0;case gp:f=this.i(a);n=this.i(c);if(!f.Ma(b)||!n.Ma(d)){e=f.x;f=f.y;g=n.x;n=n.y;l=(g-e)*(g-e)+(n-f)*(n-f);h=b.x;m=b.y;k=d.x;p=d.y;var r=1;if(0!==k-h){var q=(p-m)/(k-h);r=Math.sqrt(1+1/(q*q))}else q=9E9;this.jd(a,b);for(a+=1;a<c;a++){b=this.i(a);
      var u=b.x,v=b.y,w=.5;0!==l&&(w=((e-u)*(e-g)+(f-v)*(f-n))/l);var y=e+w*(g-e),z=f+w*(n-f);b=Math.sqrt((u-y)*(u-y)+(v-z)*(v-z));v<q*(u-y)+z&&(b=-b);0<q&&(b=-b);u=h+w*(k-h);w=m+w*(p-m);0!==q?(b=u+b/r,this.K(a,b,w-(b-u)/q)):this.K(a,u,w+b)}this.jd(c,d)}return!0;case ep: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,J.A(e.y,f.y)?J.A(f.x,g.x)?m=b.y:J.A(f.y,g.y)&&(h=b.x):J.A(e.x,f.x)&&(J.A(f.y,g.y)?h=b.x:J.A(f.x,g.x)&&(m=b.y)),this.K(a+1,h,m),e=this.i(c),f=this.i(c-
      1),g=this.i(c-2),h=f.x,m=f.y,k=h,p=m,J.A(e.y,f.y)?J.A(f.x,g.x)?m=d.y:J.A(f.y,g.y)&&(h=d.x):J.A(e.x,f.x)&&(J.A(f.y,g.y)?h=d.x:J.A(f.x,g.x)&&(m=d.y)),this.K(c-1,h,m),Rj(this))){this.K(a+1,n,l);this.K(c-1,k,p);c=!1;break a}this.jd(a,b);this.jd(c,d);c=!0}return c;default:return!1}};
    S.prototype.addOrthoPoints=function(a,b,c,d,e,f){b=-45<=b&&45>b?0:45<=b&&135>b?90:135<=b&&225>b?180:270;d=-45<=d&&45>d?0:45<=d&&135>d?90:135<=d&&225>d?180:270;var g=e.actualBounds.copy(),h=f.actualBounds.copy();if(g.u()&&h.u()){g.Vc(8,8);h.Vc(8,8);g.Ie(a);h.Ie(c);if(0===b)if(c.x>a.x||270===d&&c.y<a.y&&h.right>a.x||90===d&&c.y>a.y&&h.right>a.x){var k=new I(c.x,a.y);var l=new I(c.x,(a.y+c.y)/2);180===d?(k.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1),l.x=k.x,l.y=c.y):270===d&&c.y<a.y||90===d&&
    c.y>a.y?(k.x=a.x<h.left?this.computeMidOrthoPosition(a.x,a.y,h.left,c.y,!1):a.x<h.right&&(270===d&&a.y<h.top||90===d&&a.y>h.bottom)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):h.right,l.x=k.x,l.y=c.y):0===d&&a.x<h.left&&a.y>h.top&&a.y<h.bottom&&(k.x=a.x,k.y=a.y<c.y?Math.min(c.y,h.top):Math.max(c.y,h.bottom),l.y=k.y)}else{k=new I(a.x,c.y);l=new I((a.x+c.x)/2,c.y);if(180===d||90===d&&c.y<g.top||270===d&&c.y>g.bottom)180===d&&(h.aa(a)||g.aa(c))?k.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):
      c.y<a.y&&(180===d||90===d)?k.y=this.computeMidOrthoPosition(a.x,g.top,c.x,Math.max(c.y,h.bottom),!0):c.y>a.y&&(180===d||270===d)&&(k.y=this.computeMidOrthoPosition(a.x,g.bottom,c.x,Math.min(c.y,h.top),!0)),l.x=c.x,l.y=k.y;if(k.y>g.top&&k.y<g.bottom)if(c.x>=g.left&&c.x<=a.x||a.x<=h.right&&a.x>=c.x){if(90===d||270===d)k=new I(Math.max((a.x+c.x)/2,a.x),a.y),l=new I(k.x,c.y)}else k.y=270===d||(0===d||180===d)&&c.y<a.y?Math.min(c.y,0===d?g.top:Math.min(g.top,h.top)):Math.max(c.y,0===d?g.bottom:Math.max(g.bottom,
      h.bottom)),l.x=c.x,l.y=k.y}else if(180===b)if(c.x<a.x||270===d&&c.y<a.y&&h.left<a.x||90===d&&c.y>a.y&&h.left<a.x)k=new I(c.x,a.y),l=new I(c.x,(a.y+c.y)/2),0===d?(k.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1),l.x=k.x,l.y=c.y):270===d&&c.y<a.y||90===d&&c.y>a.y?(k.x=a.x>h.right?this.computeMidOrthoPosition(a.x,a.y,h.right,c.y,!1):a.x>h.left&&(270===d&&a.y<h.top||90===d&&a.y>h.bottom)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):h.left,l.x=k.x,l.y=c.y):180===d&&a.x>h.right&&a.y>h.top&&a.y<
      h.bottom&&(k.x=a.x,k.y=a.y<c.y?Math.min(c.y,h.top):Math.max(c.y,h.bottom),l.y=k.y);else{k=new I(a.x,c.y);l=new I((a.x+c.x)/2,c.y);if(0===d||90===d&&c.y<g.top||270===d&&c.y>g.bottom)0===d&&(h.aa(a)||g.aa(c))?k.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):c.y<a.y&&(0===d||90===d)?k.y=this.computeMidOrthoPosition(a.x,g.top,c.x,Math.max(c.y,h.bottom),!0):c.y>a.y&&(0===d||270===d)&&(k.y=this.computeMidOrthoPosition(a.x,g.bottom,c.x,Math.min(c.y,h.top),!0)),l.x=c.x,l.y=k.y;if(k.y>g.top&&k.y<g.bottom)if(c.x<=
      g.right&&c.x>=a.x||a.x>=h.left&&a.x<=c.x){if(90===d||270===d)k=new I(Math.min((a.x+c.x)/2,a.x),a.y),l=new I(k.x,c.y)}else k.y=270===d||(0===d||180===d)&&c.y<a.y?Math.min(c.y,180===d?g.top:Math.min(g.top,h.top)):Math.max(c.y,180===d?g.bottom:Math.max(g.bottom,h.bottom)),l.x=c.x,l.y=k.y}else if(90===b)if(c.y>a.y||180===d&&c.x<a.x&&h.bottom>a.y||0===d&&c.x>a.x&&h.bottom>a.y)k=new I(a.x,c.y),l=new I((a.x+c.x)/2,c.y),270===d?(k.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0),l.x=c.x,l.y=k.y):180===
    d&&c.x<a.x||0===d&&c.x>a.x?(k.y=a.y<h.top?this.computeMidOrthoPosition(a.x,a.y,c.x,h.top,!0):a.y<h.bottom&&(180===d&&a.x<h.left||0===d&&a.x>h.right)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):h.bottom,l.x=c.x,l.y=k.y):90===d&&a.y<h.top&&a.x>h.left&&a.x<h.right&&(k.x=a.x<c.x?Math.min(c.x,h.left):Math.max(c.x,h.right),k.y=a.y,l.x=k.x);else{k=new I(c.x,a.y);l=new I(c.x,(a.y+c.y)/2);if(270===d||0===d&&c.x<g.left||180===d&&c.x>g.right)270===d&&(h.aa(a)||g.aa(c))?k.x=this.computeMidOrthoPosition(a.x,
      a.y,c.x,c.y,!1):c.x<a.x&&(270===d||0===d)?k.x=this.computeMidOrthoPosition(g.left,a.y,Math.max(c.x,h.right),c.y,!1):c.x>a.x&&(270===d||180===d)&&(k.x=this.computeMidOrthoPosition(g.right,a.y,Math.min(c.x,h.left),c.y,!1)),l.x=k.x,l.y=c.y;if(k.x>g.left&&k.x<g.right)if(c.y>=g.top&&c.y<=a.y||a.y<=h.bottom&&a.y>=c.y){if(0===d||180===d)k=new I(a.x,Math.max((a.y+c.y)/2,a.y)),l=new I(c.x,k.y)}else k.x=180===d||(90===d||270===d)&&c.x<a.x?Math.min(c.x,90===d?g.left:Math.min(g.left,h.left)):Math.max(c.x,90===
    d?g.right:Math.max(g.right,h.right)),l.x=k.x,l.y=c.y}else if(c.y<a.y||180===d&&c.x<a.x&&h.top<a.y||0===d&&c.x>a.x&&h.top<a.y)k=new I(a.x,c.y),l=new I((a.x+c.x)/2,c.y),90===d?(k.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0),l.x=c.x,l.y=k.y):180===d&&c.x<a.x||0===d&&c.x>=a.x?(k.y=a.y>h.bottom?this.computeMidOrthoPosition(a.x,a.y,c.x,h.bottom,!0):a.y>h.top&&(180===d&&a.x<h.left||0===d&&a.x>h.right)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):h.top,l.x=c.x,l.y=k.y):270===d&&a.y>h.bottom&&a.x>
      h.left&&a.x<h.right&&(k.x=a.x<c.x?Math.min(c.x,h.left):Math.max(c.x,h.right),k.y=a.y,l.x=k.x);else{k=new I(c.x,a.y);l=new I(c.x,(a.y+c.y)/2);if(90===d||0===d&&c.x<g.left||180===d&&c.x>g.right)90===d&&(h.aa(a)||g.aa(c))?k.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):c.x<a.x&&(90===d||0===d)?k.x=this.computeMidOrthoPosition(g.left,a.y,Math.max(c.x,h.right),c.y,!1):c.x>a.x&&(90===d||180===d)&&(k.x=this.computeMidOrthoPosition(g.right,a.y,Math.min(c.x,h.left),c.y,!1)),l.x=k.x,l.y=c.y;if(k.x>g.left&&
      k.x<g.right)if(c.y<=g.bottom&&c.y>=a.y||a.y>=h.top&&a.y<=c.y){if(0===d||180===d)k=new I(a.x,Math.min((a.y+c.y)/2,a.y)),l=new I(c.x,k.y)}else k.x=180===d||(90===d||270===d)&&c.x<a.x?Math.min(c.x,270===d?g.left:Math.min(g.left,h.left)):Math.max(c.x,270===d?g.right:Math.max(g.right,h.right)),l.x=k.x,l.y=c.y}var m=k,n=l,p=c;if(this.isAvoiding){var r=this.diagram;if(null===r||!tk(r)||g.aa(p)&&!f.Xd(e)||h.aa(a)&&!e.Xd(f)||e===f||this.layer.isTemporary)b=!1;else{var q=uk(r,!0,this.containingGroup,null);
      if(17!==this.segmentIndex&&q.lk(Math.min(a.x,m.x),Math.min(a.y,m.y),Math.abs(a.x-m.x),Math.abs(a.y-m.y))&&q.lk(Math.min(m.x,n.x),Math.min(m.y,n.y),Math.abs(m.x-n.x),Math.abs(m.y-n.y))&&q.lk(Math.min(n.x,p.x),Math.min(n.y,p.y),Math.abs(n.x-p.x),Math.abs(n.y-p.y)))b=!1;else{e=a;f=p;var u=c=null;if(r.isVirtualized){r=q.bounds.copy();r.Vc(-q.dm,-q.cm);var v=I.alloc();tp(q,a.x,a.y)||(J.Uc(r.x,r.y,r.x+r.width,r.y+r.height,a.x,a.y,m.x,m.y,v)?(c=a=v.copy(),b=v.Sa(m)):J.Uc(r.x,r.y,r.x+r.width,r.y+r.height,
        m.x,m.y,n.x,n.y,v)?(c=a=v.copy(),b=v.Sa(n)):J.Uc(r.x,r.y,r.x+r.width,r.y+r.height,n.x,n.y,p.x,p.y,v)&&(c=a=v.copy(),b=v.Sa(p)));tp(q,p.x,p.y)||(J.Uc(r.x,r.y,r.x+r.width,r.y+r.height,p.x,p.y,n.x,n.y,v)?(u=p=v.copy(),d=n.Sa(v)):J.Uc(r.x,r.y,r.x+r.width,r.y+r.height,n.x,n.y,m.x,m.y,v)?(u=p=v.copy(),d=m.Sa(v)):J.Uc(r.x,r.y,r.x+r.width,r.y+r.height,m.x,m.y,a.x,a.y,v)&&(u=p=v.copy(),d=a.Sa(v)));I.free(v)}g=g.copy().Hc(h);h=q.xA;g.Vc(q.dm*h,q.cm*h);up(q,a,b,p,d,g);h=vp(q,p.x,p.y);!q.abort&&h>=wp&&(xk(q),
        h=q.bA,g.Vc(q.dm*h,q.cm*h),up(q,a,b,p,d,g),h=vp(q,p.x,p.y));!q.abort&&h>=wp&&q.EA&&(xk(q),up(q,a,b,p,d,q.bounds),h=vp(q,p.x,p.y));if(!q.abort&&h<wp&&vp(q,p.x,p.y)!==xp){yp(this,q,p.x,p.y,d,!0);g=this.i(2);if(4>this.pointsCount)0===b||180===b?(g.x=a.x,g.y=p.y):(g.x=p.x,g.y=a.y),this.K(2,g.x,g.y),this.m(3,g.x,g.y);else if(p=this.i(3),0===b||180===b)J.A(g.x,p.x)?(g=0===b?Math.max(g.x,a.x):Math.min(g.x,a.x),this.K(2,g,a.y),this.K(3,g,p.y)):J.A(g.y,p.y)?(Math.abs(a.y-g.y)<=q.cm/2&&(this.K(2,g.x,a.y),this.K(3,
        p.x,a.y)),this.m(2,g.x,a.y)):this.K(2,a.x,g.y);else if(90===b||270===b)J.A(g.y,p.y)?(g=90===b?Math.max(g.y,a.y):Math.min(g.y,a.y),this.K(2,a.x,g),this.K(3,p.x,g)):J.A(g.x,p.x)?(Math.abs(a.x-g.x)<=q.dm/2&&(this.K(2,a.x,g.y),this.K(3,a.x,p.y)),this.m(2,a.x,g.y)):this.K(2,g.x,a.y);null!==c&&(a=this.i(1),p=this.i(2),a.x!==p.x&&a.y!==p.y?0===b||180===b?this.m(2,a.x,p.y):this.m(2,p.x,a.y):0===b||180===b?this.m(2,e.x,c.y):this.m(2,c.x,e.y));null!==u&&(0===d||180===d?this.rf(f.x,u.y):this.rf(u.x,f.y));b=
        !0}else b=!1}}}else b=!1;b||(this.ye(k),this.ye(l))}};S.prototype.computeMidOrthoPosition=function(a,b,c,d,e){var f=0;this.hasCurviness()&&(f=this.computeCurviness());return e?(b+d)/2+f:(a+c)/2+f};
    function Rj(a){if(null===a.diagram||!a.isAvoiding||!tk(a.diagram))return!1;var b=a.points.j,c=b.length;if(4>c)return!1;a=uk(a.diagram,!0,a.containingGroup,null);for(var d=1;d<c-2;d++){var e=b[d],f=b[d+1];if(!a.lk(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 yp(a,b,c,d,e,f){var g=b.dm,h=b.cm,k=vp(b,c,d),l=c,m=d;for(0===e?l+=g:90===e?m+=h:180===e?l-=g:m-=h;k>zp&&vp(b,l,m)===k-1;)c=l,d=m,0===e?l+=g:90===e?m+=h:180===e?l-=g:m-=h,--k;if(f){if(k>zp)if(180===e||0===e)c=Math.floor(c/g)*g+g/2;else if(90===e||270===e)d=Math.floor(d/h)*h+h/2}else c=Math.floor(c/g)*g+g/2,d=Math.floor(d/h)*h+h/2;k>zp&&(f=e,l=c,m=d,0===e?(f=90,m+=h):90===e?(f=180,l-=g):180===e?(f=270,m-=h):270===e&&(f=0,l+=g),vp(b,l,m)===k-1?yp(a,b,l,m,f,!1):(l=c,m=d,0===e?(f=270,m-=h):90===
    e?(f=0,l+=g):180===e?(f=90,m+=h):270===e&&(f=180,l-=g),vp(b,l,m)===k-1&&yp(a,b,l,m,f,!1)));a.rf(c,d)}S.prototype.iz=function(a){var b=a.x;a=a.y;for(var c=this.i(0),d=this.i(1),e=Bb(b,a,c.x,c.y,d.x,d.y),f=0,g=1;g<this.pointsCount-1;g++){c=this.i(g+1);var h=Bb(b,a,d.x,d.y,c.x,c.y);d=c;h<e&&(f=g,e=h)}return f};S.prototype.cc=function(){this.Yn=!0};
    S.prototype.nk=function(a){if(!a){if(!1===this.ld)return;a=this.zb();if(!this.Yn&&(null===a||null!==a.geometry))return}this.ka=this.makeGeometry();a=this.path;if(null!==a){a.ka=this.ka;for(var b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d];e!==a&&e.isPanelMain&&e instanceof Kf&&(e.ka=this.ka)}}};
    S.prototype.makeGeometry=function(){var a=this.ka,b=this.pointsCount;if(2>b)return a.type=vd,this.Yn=!1,a;var c=!1,d=this.diagram;null!==d&&ip(this)&&d.Qg.contains(this)&&(0!==this.El.width||0!==this.El.height)&&(c=!0);var e=this.i(0).copy(),f=e.copy();d=this.wb.j;var g=this.computeCurve();if(g===og&&3<=b&&!J.$(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.Yu.x;k-=this.Yu.y;e.x-=d;e.y-=k;if(2!==b||ip(this)){a.type=td;h=Jd(a);0!==this.computeShortLength(!0)&&(e=Ap(this,e,!0,f));Kd(h,e.x,e.y,!1);if(g===og&&3<=b&&!J.$(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=Ap(this,e,!1,f)),Ld(h,b,c,b,c,e.x,e.y);else if(this.isOrthogonal){f=new I(d,k);e=this.i(1).copy();g=new I(d,k);b=new I(d,k);c=this.i(0);for(var l,m=this.smoothness/3,n=1;n<this.pointsCount-1;n++){l=this.i(n);var p=c,r=l,q=this.i(Bp(this,l,n,!1));if(!J.$(p.x,r.x)||!J.$(r.x,q.x))if(!J.$(p.y,r.y)||!J.$(r.y,q.y)){var u=m;isNaN(u)&&(u=this.smoothness/3);var v=p.x;p=p.y;var w=r.x;r=r.y;var y=q.x;q=q.y;var z=u*Cp(v,p,w,r);u*=Cp(w,r,y,q);J.$(p,r)&&J.$(w,y)&&(w>v?q>r?(g.x=w-z,g.y=r-z,b.x=w+u,b.y=r+u):(g.x=
      w-z,g.y=r+z,b.x=w+u,b.y=r-u):q>r?(g.x=w+z,g.y=r-z,b.x=w-u,b.y=r+u):(g.x=w+z,g.y=r+z,b.x=w-u,b.y=r-u));J.$(v,w)&&J.$(r,q)&&(r>p?(y>w?(g.x=w-z,g.y=r-z,b.x=w+u):(g.x=w+z,g.y=r-z,b.x=w-u),b.y=r+u):(y>w?(g.x=w-z,g.y=r+z,b.x=w+u):(g.x=w+z,g.y=r+z,b.x=w-u),b.y=r-u));if(J.$(v,w)&&J.$(w,y)||J.$(p,r)&&J.$(r,q))v=.5*(v+y),p=.5*(p+q),g.x=v,g.y=p,b.x=v,b.y=p;1===n?(e.x=.5*(c.x+l.x),e.y=.5*(c.y+l.y)):2===n&&J.$(c.x,this.i(0).x)&&J.$(c.y,this.i(0).y)&&(e.x=.5*(c.x+l.x),e.y=.5*(c.y+l.y));Ld(h,e.x-d,e.y-k,g.x-d,g.y-
      k,l.x-d,l.y-k);f.set(g);e.set(b);c=l}}f=c.x;c=c.y;e=this.i(this.pointsCount-1);0!==this.computeShortLength(!1)&&(e=Ap(this,e.copy(),!1,Gb));f=.5*(f+e.x);c=.5*(c+e.y);Ld(h,b.x-d,b.y-k,f-d,c-k,e.x-d,e.y-k)}else for(c=3;c<b;c+=3)f=this.i(c-2),c+3>=b&&(c=b-1),e=this.i(c-1),g=this.i(c),c===b-1&&0!==this.computeShortLength(!1)&&(g=Ap(this,g.copy(),!1,Gb)),Ld(h,f.x-d,f.y-k,e.x-d,e.y-k,g.x-d,g.y-k);else{f=I.alloc();f.assign(this.i(0));e=I.alloc();e.assign(f);g=this.computeCorner();n=1;for(l=0;n<b;){n=Bp(this,
      f,n,1<n);m=this.i(n);if(n>=b-1){if(!f.w(m))0!==this.computeShortLength(!1)&&(m=Ap(this,m.copy(),!1,Gb)),Dp(this,h,-d,-k,f,m,c);else if(0===l)for(n=1;n<b;)e.assign(f),m=this.i(n++),Dp(this,h,-d,-k,f,m,c),f.assign(m);break}l=Bp(this,m,n+1,n<b-3);n=-d;v=-k;p=m;u=this.i(l);w=c;if(J.A(f.y,p.y)&&J.A(p.x,u.x))if(r=Math.min(g,Math.abs(p.x-e.x)/2),r=y=Math.min(r,Math.abs(u.y-p.y)/2),J.A(r,0))Dp(this,h,n,v,f,p,w),f.assign(p);else{q=p.x;z=p.y;var A=q,C=z;p.x>f.x?q=p.x-r:q=p.x+r;u.y>p.y?C=p.y+y:C=p.y-y;Dp(this,
      h,n,v,f,new I(q,z),w);Qd(h,p.x+n,p.y+v,A+n,C+v);f.h(A,C)}else J.A(f.x,p.x)&&J.A(p.y,u.y)?(r=Math.min(g,Math.abs(p.y-e.y)/2),r=y=Math.min(r,Math.abs(u.x-p.x)/2),J.A(y,0)?(Dp(this,h,n,v,f,p,w),f.assign(p)):(q=p.x,z=p.y,A=q,C=z,p.y>f.y?z=p.y-r:z=p.y+r,u.x>p.x?A=p.x+y:A=p.x-y,Dp(this,h,n,v,f,new I(q,z),w),Qd(h,p.x+n,p.y+v,A+n,C+v),f.h(A,C))):(Dp(this,h,n,v,f,p,w),f.assign(p));e.assign(m);n=l}I.free(f)}Td=h}else h=this.i(1).copy(),h.x-=d,h.y-=k,0!==this.computeShortLength(!0)&&(e=Ap(this,e,!0,f)),0!==
    this.computeShortLength(!1)&&(h=Ap(this,h,!1,f)),a.type=vd,a.startX=e.x,a.startY=e.y,a.endX=h.x,a.endY=h.y;this.Yn=!1;return a};function Cp(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 J.$(a,0)?b:J.$(b,0)?a:Math.sqrt(a*a+b*b)}
    function Ap(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=Cp(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=Cp(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 Bp(a,b,c,d){for(var e=a.pointsCount,f=b;J.$(b.x,f.x)&&J.$(b.y,f.y);){if(c>=e)return e-1;f=a.i(c++)}if(!J.$(b.x,f.x)&&!J.$(b.y,f.y))return c-1;for(var g=f;J.$(b.x,f.x)&&J.$(f.x,g.x)&&(!d||(b.y>=f.y?f.y>=g.y:f.y<=g.y))||J.$(b.y,f.y)&&J.$(f.y,g.y)&&(!d||(b.x>=f.x?f.x>=g.x:f.x<=g.x));){if(c>=e)return e-1;g=a.i(c++)}return c-2}
    function Dp(a,b,c,d,e,f,g){if(!g&&ip(a)){g=[];var h=0;a.isVisible()&&(h=Ep(a,e,f,g));if(0<h)if(J.A(e.y,f.y))if(e.x<f.x)for(var k=0;k<h;){var l=Math.max(e.x,Math.min(g[k++]-5,f.x-10));b.lineTo(l+c,f.y+d);var m=l+c;for(var n=Math.min(l+10,f.x);k<h;)if(l=g[k],l<n+10)k++,n=Math.min(l+5,f.x);else break;l=f.y-10+d;n+=c;var p=f.y+d;a.curve===$f?Kd(b,n,p,!1):Ld(b,m,l,n,l,n,p)}else for(--h;0<=h;){k=Math.min(e.x,Math.max(g[h--]+5,f.x+10));b.lineTo(k+c,f.y+d);m=k+c;for(l=Math.max(k-10,f.x);0<=h;)if(k=g[h],k>
    l-10)h--,l=Math.max(k-5,f.x);else break;k=f.y-10+d;l+=c;n=f.y+d;a.curve===$f?Kd(b,l,n,!1):Ld(b,m,k,l,k,l,n)}else if(J.A(e.x,f.x))if(e.y<f.y)for(k=0;k<h;){l=Math.max(e.y,Math.min(g[k++]-5,f.y-10));b.lineTo(f.x+c,l+d);m=l+d;for(l=Math.min(l+10,f.y);k<h;)if(n=g[k],n<l+10)k++,l=Math.min(n+5,f.y);else break;n=f.x-10+c;p=f.x+c;l+=d;a.curve===$f?Kd(b,p,l,!1):Ld(b,n,m,n,l,p,l)}else for(--h;0<=h;){k=Math.min(e.y,Math.max(g[h--]+5,f.y+10));b.lineTo(f.x+c,k+d);m=k+d;for(k=Math.max(k-10,f.y);0<=h;)if(l=g[h],
    l>k-10)h--,k=Math.max(l-5,f.y);else break;l=f.x-10+c;n=f.x+c;k+=d;a.curve===$f?Kd(b,n,k,!1):Ld(b,l,m,l,k,n,k)}}b.lineTo(f.x+c,f.y+d)}
    function Ep(a,b,c,d){var e=a.diagram;if(null===e||b.w(c))return 0;for(e=e.layers;e.next();){var f=e.value;if(null!==f&&f.visible){f=f.Ca.j;for(var g=f.length,h=0;h<g;h++){var k=f[h];if(k instanceof S){if(k===a)return 0<d.length&&d.sort(function(a,b){return a-b}),d.length;if(k.isVisible()&&ip(k)){var l=k.routeBounds;l.u()&&a.routeBounds.Gc(l)&&!a.usesSamePort(k)&&(l=k.path,null!==l&&l.zf()&&Fp(b,c,d,k))}}}}}0<d.length&&d.sort(function(a,b){return a-b});return d.length}
    function Fp(a,b,c,d){for(var e=J.A(a.y,b.y),f=d.pointsCount,g=d.i(0),h=I.alloc(),k=1;k<f;k++){var l=d.i(k);if(k<f-1){var m=d.i(k+1);if(g.y===l.y&&l.y===m.y){if(l.x>g.x&&m.x>=l.x||l.x<g.x&&m.x<=l.x)continue}else if(g.x===l.x&&l.x===m.x&&(l.y>g.y&&m.y>=l.y||l.y<g.y&&m.y<=l.y))continue}a:{m=a.x;var n=a.y,p=b.x,r=b.y,q=g.x;g=g.y;var u=l.x,v=l.y;if(!J.A(m,p)){if(J.A(n,r)&&J.A(q,u)&&Math.min(m,p)<q&&Math.max(m,p)>q&&Math.min(g,v)<n&&Math.max(g,v)>n&&!J.A(g,v)){h.x=q;h.y=n;m=!0;break a}}else if(!J.A(n,r)&&
      J.A(g,v)&&Math.min(n,r)<g&&Math.max(n,r)>g&&Math.min(q,u)<m&&Math.max(q,u)>m&&!J.A(q,u)){h.x=m;h.y=g;m=!0;break a}h.x=0;h.y=0;m=!1}m&&(e?c.push(h.x):c.push(h.y));g=l}I.free(h)}function ip(a){a=a.curve;return a===Zf||a===$f}function mp(a,b){if(b||ip(a))b=a.diagram,null===b||b.animationManager.isTicking||b.Qg.contains(a)||0===a.El.width&&0===a.El.height||b.Qg.add(a,a.El.copy())}
    S.prototype.tq=function(a){var b=this.layer;if(null!==b&&b.visible&&!b.isTemporary){var c=b.diagram;if(null!==c&&!c.animationManager.isAnimating){var d=!1;for(c=c.layers;c.next();){var e=c.value;if(e.visible)if(e===b){d=!0;var f=!1;e=e.Ca.j;for(var g=e.length,h=0;h<g;h++){var k=e[h];k instanceof S&&(k===this?f=!0:f&&Gp(this,k,a))}}else if(d)for(f=e.Ca.j,e=f.length,g=0;g<e;g++)h=f[g],h instanceof S&&Gp(this,h,a)}}}};
    function Gp(a,b,c){if(null!==b&&null!==b.ka&&ip(b)){var d=b.routeBounds;d.u()&&(a.routeBounds.Gc(d)||c.Gc(d))&&(a.usesSamePort(b)||b.cc())}}S.prototype.usesSamePort=function(a){var b=this.pointsCount,c=a.pointsCount;if(0<b&&0<c){var d=this.i(0),e=a.i(0);if(d.Ma(e))return!0;b=this.i(b-1);a=a.i(c-1);if(b.Ma(a)||d.Ma(a)||b.Ma(e))return!0}else if(this.fromNode===a.fromNode||this.toNode===a.toNode||this.fromNode===a.toNode||this.toNode===a.fromNode)return!0;return!1};
    S.prototype.isVisible=function(){if(!U.prototype.isVisible.call(this))return!1;var a=this.containingGroup,b=!0,c=this.diagram;null!==c&&(b=c.isTreePathToChildren);c=this.fromNode;if(null!==c){if(this.isTreeLink&&b&&!c.isTreeExpanded)return!1;if(c===a)return!0;for(var d=c;null!==d;){if(d.labeledLink===this)return!0;d=d.containingGroup}c=c.findVisibleNode();if(null===c||c===a)return!1}c=this.toNode;if(null!==c){if(this.isTreeLink&&!b&&!c.isTreeExpanded)return!1;if(c===a)return!0;for(b=c;null!==b;){if(b.labeledLink===
      this)return!0;b=b.containingGroup}b=c.findVisibleNode();if(null===b||b===a)return!1}return!0};S.prototype.Ob=function(a){U.prototype.Ob.call(this,a);null!==this.If&&this.If.nm();if(null!==this.ad)for(var b=this.ad.iterator;b.next();)b.value.Ob(a)};S.prototype.computeAdjusting=function(){return null!==this.diagram&&this.diagram.animationManager.isAnimating?ep:this.Dk};
    function jp(a){var b=a.Re;if(null!==b){var c=a.mf;if(null!==c){for(var d=a.Se,e=a.nf,f=a=null,g=b.Wa.j,h=g.length,k=0;k<h;k++){var l=g[k];if(l.Re===b&&l.Se===d&&l.mf===c&&l.nf===e||l.Re===c&&l.Se===e&&l.mf===b&&l.nf===d)null===f?f=l:(null===a&&(a=[],a.push(f)),a.push(l))}if(null!==a){f=Po(b,c,d,e);null===f&&(f=new Hp(b,d,c,e),Oo(b,f),Oo(c,f));f.links=a;for(b=0;b<a.length;b++)a[b].If=f;f.nm()}}}}function kp(a){var b=a.If;null!==b&&(a.If=null,a=b.links.indexOf(a),0<=a&&(Da(b.links,a),b.nm()))}
    S.prototype.Ih=function(){return!0};
    ma.Object.defineProperties(S.prototype,{fromNode:{get:function(){return this.Re},set:function(a){var b=this.Re;if(b!==a){var c=this.fromPort;null!==b&&(this.mf!==b&&To(b,this,c),kp(this),this.C(2));this.Re=a;null!==a&&this.Ob(a.isVisible());this.Rf=null;this.Ta();var d=this.diagram;null!==d&&d.Z&&d.partManager.setFromNodeForLink(this,a,b);var e=this.fromPort,f=this.fromPortChanged;if(null!==f){var g=!0;null!==d&&(g=d.Z,d.Z=!0);f(this,c,e);null!==d&&(d.Z=g)}null!==a&&
        (this.mf!==a&&So(a,this,e),jp(this),this.C(1));this.g("fromNode",b,a);Mo(this)}}},fromPortId:{get:function(){return this.Se},set:function(a){var b=this.Se;if(b!==a){var c=this.fromPort;null!==c&&Qo(this.fromNode,c);kp(this);this.Se=a;var d=this.fromPort;null!==d&&Qo(this.fromNode,d);var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.pm()&&g.ly(f,a)}c!==d&&(this.Rf=null,this.Ta(),f=this.fromPortChanged,null!==f&&(g=!0,null!==e&&(g=e.Z,e.Z=!0),f(this,
          c,d),null!==e&&(e.Z=g)));jp(this);this.g("fromPortId",b,a)}}},fromPort:{get:function(){var a=this.Re;return null===a?null:a.mt(this.Se)}},fromPortChanged:{get:function(){return this.Mn},set:function(a){var b=this.Mn;b!==a&&(this.Mn=a,this.g("fromPortChanged",b,a))}},toNode:{get:function(){return this.mf},set:function(a){var b=this.mf;if(b!==a){var c=this.toPort;null!==b&&(this.Re!==b&&To(b,this,c),kp(this),this.C(2));
          this.mf=a;null!==a&&this.Ob(a.isVisible());this.Rf=null;this.Ta();var d=this.diagram;null!==d&&d.Z&&d.partManager.setToNodeForLink(this,a,b);var e=this.toPort,f=this.toPortChanged;if(null!==f){var g=!0;null!==d&&(g=d.Z,d.Z=!0);f(this,c,e);null!==d&&(d.Z=g)}null!==a&&(this.Re!==a&&So(a,this,e),jp(this),this.C(1));this.g("toNode",b,a);Mo(this)}}},toPortId:{get:function(){return this.nf},set:function(a){var b=this.nf;if(b!==a){var c=this.toPort;null!==c&&Qo(this.toNode,
          c);kp(this);this.nf=a;var d=this.toPort;null!==d&&Qo(this.toNode,d);var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.pm()&&g.py(f,a)}c!==d&&(this.Rf=null,this.Ta(),f=this.toPortChanged,null!==f&&(g=!0,null!==e&&(g=e.Z,e.Z=!0),f(this,c,d),null!==e&&(e.Z=g)));jp(this);this.g("toPortId",b,a)}}},toPort:{get:function(){var a=this.mf;return null===a?null:a.mt(this.nf)}},toPortChanged:{get:function(){return this.Vp},set:function(a){var b=
          this.Vp;b!==a&&(this.Vp=a,this.g("toPortChanged",b,a))}},fromSpot:{get:function(){return null!==this.O?this.O.Wg:$c},set:function(a){this.Ec();var b=this.O.Wg;if(!b.w(a)){a=a.G();this.O.Wg=a;this.g("fromSpot",b,a);if(b.gd()||a.gd())a=this.fromNode,null!==a&&Qo(a,this.fromPort);this.Ta()}}},fromEndSegmentLength:{get:function(){return null!==this.O?this.O.Ug:NaN},set:function(a){this.Ec();var b=this.O.Ug;b!==a&&(0>a&&va(a,">= 0",S,"fromEndSegmentLength"),
          this.O.Ug=a,this.g("fromEndSegmentLength",b,a),this.Ta())}},fromShortLength:{get:function(){return null!==this.O?this.O.Vg:NaN},set:function(a){this.Ec();var b=this.O.Vg;b!==a&&(this.O.Vg=a,this.g("fromShortLength",b,a),this.cc())}},toSpot:{get:function(){return null!==this.O?this.O.wh:$c},set:function(a){this.Ec();var b=this.O.wh;if(!b.w(a)){a=a.G();this.O.wh=a;this.g("toSpot",b,a);if(b.gd()||a.gd())a=this.toNode,null!==a&&Qo(a,this.toPort);
          this.Ta()}}},toEndSegmentLength:{get:function(){return null!==this.O?this.O.uh:NaN},set:function(a){this.Ec();var b=this.O.uh;b!==a&&(0>a&&va(a,">= 0",S,"toEndSegmentLength"),this.O.uh=a,this.g("toEndSegmentLength",b,a),this.Ta())}},toShortLength:{get:function(){return null!==this.O?this.O.vh:NaN},set:function(a){this.Ec();var b=this.O.vh;b!==a&&(this.O.vh=a,this.g("toShortLength",b,a),this.cc())}},isLabeledLink:{
        get:function(){return null===this.ad?!1:0<this.ad.count}},labelNodes:{get:function(){return null===this.ad?fb:this.ad.iterator}},relinkableFrom:{get:function(){return 0!==(this.Pa&1)},set:function(a){var b=0!==(this.Pa&1);b!==a&&(this.Pa^=1,this.g("relinkableFrom",b,a),this.Lb())}},relinkableTo:{get:function(){return 0!==(this.Pa&2)},set:function(a){var b=0!==(this.Pa&2);b!==a&&(this.Pa^=2,this.g("relinkableTo",
          b,a),this.Lb())}},resegmentable:{get:function(){return 0!==(this.Pa&4)},set:function(a){var b=0!==(this.Pa&4);b!==a&&(this.Pa^=4,this.g("resegmentable",b,a),this.Lb())}},isTreeLink:{get:function(){return 0!==(this.Pa&8)},set:function(a){var b=0!==(this.Pa&8);b!==a&&(this.Pa^=8,this.g("isTreeLink",b,a),null!==this.fromNode&&Fk(this.fromNode),null!==this.toNode&&Fk(this.toNode))}},path:{get:function(){var a=this.zb();
          return a instanceof Kf?a:null}},routeBounds:{get:function(){this.hj();var a=this.El,b=Infinity,c=Infinity,d=this.pointsCount;if(0===d)a.h(NaN,NaN,0,0);else{if(1===d)d=this.i(0),b=Math.min(d.x,b),c=Math.min(d.y,c),a.h(d.x,d.y,0,0);else if(2===d){d=this.i(0);var e=this.i(1);b=Math.min(d.x,e.x);c=Math.min(d.y,e.y);a.h(d.x,d.y,0,0);a.Ie(e)}else if(this.computeCurve()===og&&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);J.bm(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);J.bm(e.x,e.y,g.x,g.y,h.x,h.y,k.x,k.y,.5,a);b=Math.min(k.x,b);c=Math.min(k.y,c);e=k}else for(e=this.i(0),f=this.i(1),b=Math.min(e.x,f.x),c=Math.min(e.y,f.y),a.h(e.x,e.y,0,0),a.Ie(f),e=2;e<d;e++)f=this.i(e),b=Math.min(f.x,b),c=Math.min(f.y,c),a.Ie(f);this.Yu.h(b-a.x,c-a.y)}return a}},midPoint:{
        get:function(){this.hj();return this.computeMidPoint(new I)}},midAngle:{get:function(){this.hj();return this.computeMidAngle()}},flattenedLengths:{get:function(){if(null===this.Gr){this.ld||lp(this);for(var a=this.Gr=[],b=this.pointsCount,c=0;c<b-1;c++){var d=this.i(c);var e=this.i(c+1);J.$(d.x,e.x)?(d=e.y-d.y,0>d&&(d=-d)):J.$(d.y,e.y)?(d=e.x-d.x,0>d&&(d=-d)):d=Math.sqrt(d.Be(e));a.push(d)}}return this.Gr}},flattenedTotalLength:{
        get:function(){var a=this.su;if(isNaN(a)){for(var b=this.flattenedLengths,c=b.length,d=a=0;d<c;d++)a+=b[d];this.su=a}return a}},points:{get:function(){return this.wb},set:function(a){var b=this.wb;if(b!==a){var c=null;if(Array.isArray(a)){var d=0===a.length%2;if(d)for(var e=0;e<a.length;e++)if("number"!==typeof a[e]||isNaN(a[e])){d=!1;break}if(d)for(c=new E,d=0;d<a.length/2;d++)e=(new I(a[2*d],a[2*d+1])).freeze(),c.add(e);else{d=!0;for(e=0;e<a.length;e++){var f=
          a[e];if(!za(f)||"number"!==typeof f.x||isNaN(f.x)||"number"!==typeof f.y||isNaN(f.y)){d=!1;break}}if(d)for(c=new E,d=0;d<a.length;d++)e=a[d],c.add((new I(e.x,e.y)).freeze())}}else if(a instanceof E)for(c=a.copy(),a=c.iterator;a.next();)a.value.freeze();else B("Link.points value is not an instance of List or Array: "+a);c.freeze();this.wb=c;this.cc();this.o();lp(this);a=this.diagram;null!==a&&(a.kk||a.undoManager.isUndoingRedoing||a.zt.add(this),a.animationManager.qc&&(this.mh=c));this.g("points",
          b,c)}}},pointsCount:{get:function(){return this.wb.count}},ld:{get:function(){return 0!==(this.Pa&16)},set:function(a){0!==(this.Pa&16)!==a&&(this.Pa^=16)}},suspendsRouting:{get:function(){return 0!==(this.Pa&32)},set:function(a){0!==(this.Pa&32)!==a&&(this.Pa^=32)}},mv:{get:function(){return 0!==(this.Pa&64)},set:function(a){0!==(this.Pa&64)!==a&&(this.Pa^=64)}},defaultFromPoint:{
        get:function(){return this.v},set:function(a){this.v=a.copy()}},defaultToPoint:{get:function(){return this.I},set:function(a){this.I=a.copy()}},isOrthogonal:{get:function(){return 2===(this.Lj.value&2)}},isAvoiding:{get:function(){return 4===(this.Lj.value&4)}},geometry:{get:function(){this.Yn&&(this.hj(),this.ka=this.makeGeometry());return this.ka}},firstPickIndex:{
        get:function(){return 2>=this.pointsCount?0:this.isOrthogonal||!np(this.computeSpot(!0))?1:0}},lastPickIndex:{get:function(){var a=this.pointsCount;return 0===a?0:2>=a?a-1:this.isOrthogonal||!np(this.computeSpot(!1))?a-2:a-1}},adjusting:{get:function(){return this.Dk},set:function(a){var b=this.Dk;b!==a&&(this.Dk=a,this.g("adjusting",b,a))}},corner:{get:function(){return this.pn},set:function(a){var b=
          this.pn;b!==a&&(this.pn=a,this.cc(),this.g("corner",b,a))}},curve:{get:function(){return this.rn},set:function(a){var b=this.rn;b!==a&&(this.rn=a,this.Ta(),this.cc(),mp(this,b===$f||b===Zf||a===$f||a===Zf),this.g("curve",b,a))}},curviness:{get:function(){return this.sn},set:function(a){var b=this.sn;b!==a&&(this.sn=a,this.Ta(),this.cc(),this.g("curviness",b,a))}},routing:{get:function(){return this.Lj},set:function(a){var b=
          this.Lj;b!==a&&(this.Lj=a,this.Rf=null,this.Ta(),mp(this,2===(b.value&2)||2===(a.value&2)),this.g("routing",b,a))}},smoothness:{get:function(){return this.Ip},set:function(a){var b=this.Ip;b!==a&&(this.Ip=a,this.cc(),this.g("smoothness",b,a))}},key:{get:function(){var a=this.diagram;if(null!==a&&a.model.pm())return a.model.Vb(this.data)}}});S.prototype.invalidateOtherJumpOvers=S.prototype.tq;S.prototype.findClosestSegment=S.prototype.iz;
    S.prototype.updateRoute=S.prototype.hj;S.prototype.invalidateRoute=S.prototype.Ta;S.prototype.rollbackRoute=S.prototype.hy;S.prototype.commitRoute=S.prototype.sf;S.prototype.startRoute=S.prototype.Lh;S.prototype.clearPoints=S.prototype.Zj;S.prototype.removePoint=S.prototype.$v;S.prototype.addPointAt=S.prototype.rf;S.prototype.addPoint=S.prototype.ye;S.prototype.insertPointAt=S.prototype.m;S.prototype.insertPoint=S.prototype.Tz;S.prototype.setPointAt=S.prototype.K;S.prototype.setPoint=S.prototype.jd;
    S.prototype.getPoint=S.prototype.i;S.prototype.getOtherPort=S.prototype.Hz;S.prototype.getOtherNode=S.prototype.qt;
    var dp=new D(S,"Normal",1),Ip=new D(S,"Orthogonal",2),Jp=new D(S,"AvoidsNodes",6),sp=new D(S,"AvoidsNodesStraight",7),ag=new D(S,"None",0),og=new D(S,"Bezier",9),$f=new D(S,"JumpGap",10),Zf=new D(S,"JumpOver",11),ep=new D(S,"End",17),fp=new D(S,"Scale",18),gp=new D(S,"Stretch",19),Wm=new D(S,"OrientAlong",21),Pm=new D(S,"OrientPlus90",22),Rm=new D(S,"OrientMinus90",23),hp=new D(S,"OrientOpposite",24),Xm=new D(S,"OrientUpright",25),Qm=new D(S,"OrientPlus90Upright",26),Sm=new D(S,"OrientMinus90Upright",
      27),Tm=new D(S,"OrientUpright45",28);S.className="Link";S.Normal=dp;S.Orthogonal=Ip;S.AvoidsNodes=Jp;S.AvoidsNodesStraight=sp;S.None=ag;S.Bezier=og;S.JumpGap=$f;S.JumpOver=Zf;S.End=ep;S.Scale=fp;S.Stretch=gp;S.OrientAlong=Wm;S.OrientPlus90=Pm;S.OrientMinus90=Rm;S.OrientOpposite=hp;S.OrientUpright=Xm;S.OrientPlus90Upright=Qm;S.OrientMinus90Upright=Sm;S.OrientUpright45=Tm;function Hp(a,b,c,d){Ya(this);this.le=this.Nr=!1;this.Ct=a;this.ay=b;this.Pv=c;this.by=d;this.links=[]}
    Hp.prototype.nm=function(){if(!this.Nr){var a=this.links;0<a.length&&(a=a[0].diagram,null!==a&&(a.uu.add(this),this.le=a.undoManager.isUndoingRedoing))}this.Nr=!0};Hp.prototype.ww=function(){if(this.Nr){this.Nr=!1;var a=this.links;if(0<a.length){var b=a[0],c=b.diagram;c=null===c||c.kk&&!this.le;this.le=!1;b.arrangeBundledLinks(a,c);1===a.length&&(b.If=null,a.length=0)}0===a.length&&(a=this.Ct,null!==this&&null!==a.Ne&&a.Ne.remove(this),a=this.Pv,null!==this&&null!==a.Ne&&a.Ne.remove(this))}};
    Hp.className="LinkBundle";function vk(){Ya(this);this.qy=this.group=null;this.tt=!0;this.abort=!1;this.Od=this.Nd=1;this.xo=this.wo=-1;this.lc=this.kc=8;this.Bb=[[]];this.Sj=this.Rj=0;this.EA=!1;this.xA=22;this.bA=111}
    vk.prototype.initialize=function(a){if(!(0>=a.width||0>=a.height)){var b=a.y,c=a.x+a.width,d=a.y+a.height;this.Nd=Math.floor((a.x-this.kc)/this.kc)*this.kc;this.Od=Math.floor((b-this.lc)/this.lc)*this.lc;this.wo=Math.ceil((c+2*this.kc)/this.kc)*this.kc;this.xo=Math.ceil((d+2*this.lc)/this.lc)*this.lc;a=1+(Math.ceil((this.wo-this.Nd)/this.kc)|0);b=1+(Math.ceil((this.xo-this.Od)/this.lc)|0);if(null===this.Bb||this.Rj<a-1||this.Sj<b-1){c=[];for(d=0;d<=a;d++)c[d]=[];this.Bb=c;this.Rj=a-1;this.Sj=b-1}a=
      Kp;if(null!==this.Bb)for(b=0;b<=this.Rj;b++)for(c=0;c<=this.Sj;c++)this.Bb[b][c]=a}};function tp(a,b,c){return a.Nd<=b&&b<=a.wo&&a.Od<=c&&c<=a.xo}function vp(a,b,c){if(!tp(a,b,c))return Kp;b-=a.Nd;b/=a.kc;c-=a.Od;c/=a.lc;return a.Bb[b|0][c|0]}function yk(a,b,c){tp(a,b,c)&&(b-=a.Nd,b/=a.kc,c-=a.Od,c/=a.lc,a.Bb[b|0][c|0]=xp)}function xk(a){if(null!==a.Bb)for(var b=0;b<=a.Rj;b++)for(var c=0;c<=a.Sj;c++)a.Bb[b][c]>=zp&&(a.Bb[b][c]=Kp)}
    vk.prototype.lk=function(a,b,c,d){if(a>this.wo||a+c<this.Nd||b>this.xo||b+d<this.Od)return!0;a=(a-this.Nd)/this.kc|0;b=(b-this.Od)/this.lc|0;c=Math.max(0,c)/this.kc+1|0;var e=Math.max(0,d)/this.lc+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.Rj)|0;for(c=Math.min(b+e-1,this.Sj)|0;a<=d;a++)for(e=b;e<=c;e++)if(this.Bb[a][e]===xp)return!1;return!0};
    function Lp(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.Bb[l][m];if(n>=zp&&n<wp)for(e?m+=d:l+=d,n+=1;f<=l&&l<=g&&h<=m&&m<=k&&!(n>=a.Bb[l][m]);)a.Bb[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)Lp(a,b,c,1,!e,f,g,h,k),Lp(a,b,c,-1,!e,f,g,h,k);else for(c+=d;c>l;c+=d)Lp(a,b,c,1,!e,f,g,h,k),Lp(a,b,c,-1,!e,f,g,h,k);else if(0<d)for(b+=d;b<l;b+=d)Lp(a,b,c,1,!e,f,g,h,k),Lp(a,b,c,-1,!e,f,g,h,k);else for(b+=d;b>l;b+=d)Lp(a,b,c,1,!e,f,g,h,k),Lp(a,b,c,-1,!e,f,g,h,
      k)}}function Mp(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=xp,m=zp;for(a.Bb[b][c]=m;l===xp&&b>f&&b<g&&c>h&&c<k;)m+=1,a.Bb[b][c]=m,e?c+=d:b+=d,l=a.Bb[b][c]}function Np(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=xp,m=wp;for(a.Bb[b][c]=m;l===xp&&b>f&&b<g&&c>h&&c<k;)a.Bb[b][c]=m,e?c+=d:b+=d,l=a.Bb[b][c]}
    function up(a,b,c,d,e,f){if(null!==a.Bb){a.abort=!1;var g=b.x,h=b.y;if(tp(a,g,h)&&(g-=a.Nd,g/=a.kc,h-=a.Od,h/=a.lc,b=d.x,d=d.y,tp(a,b,d)))if(b-=a.Nd,b/=a.kc,d-=a.Od,d/=a.lc,1>=Math.abs(g-b)&&1>=Math.abs(h-d))a.abort=!0;else{var k=f.x,l=f.y,m=f.x+f.width,n=f.y+f.height;k-=a.Nd;k/=a.kc;l-=a.Od;l/=a.lc;m-=a.Nd;m/=a.kc;n-=a.Od;n/=a.lc;f=Math.max(0,Math.min(a.Rj,k|0));m=Math.min(a.Rj,Math.max(0,m|0));l=Math.max(0,Math.min(a.Sj,l|0));n=Math.min(a.Sj,Math.max(0,n|0));g|=0;h|=0;b|=0;d|=0;k=0===c||90===c?
      1:-1;c=90===c||270===c;a.Bb[g][h]===xp?(Mp(a,g,h,k,c,f,m,l,n),Mp(a,g,h,1,!c,f,m,l,n),Mp(a,g,h,-1,!c,f,m,l,n)):Mp(a,g,h,k,c,g,h,g,h);a.Bb[b][d]===xp?(Np(a,b,d,0===e||90===e?1:-1,90===e||270===e,f,m,l,n),Np(a,b,d,1,!(90===e||270===e),f,m,l,n),Np(a,b,d,-1,!(90===e||270===e),f,m,l,n)):Np(a,b,d,k,c,b,d,b,d);a.abort||(Lp(a,g,h,1,!1,f,m,l,n),Lp(a,g,h,-1,!1,f,m,l,n),Lp(a,g,h,1,!0,f,m,l,n),Lp(a,g,h,-1,!0,f,m,l,n))}}}
    ma.Object.defineProperties(vk.prototype,{bounds:{get:function(){return new N(this.Nd,this.Od,this.wo-this.Nd,this.xo-this.Od)}},dm:{get:function(){return this.kc},set:function(a){0<a&&a!==this.kc&&(this.kc=a,this.initialize(this.bounds))}},cm:{get:function(){return this.lc},set:function(a){0<a&&a!==this.lc&&(this.lc=a,this.initialize(this.bounds))}}});var xp=0,zp=1,wp=999999,Kp=wp+1;vk.className="PositionArray";
    function qp(){Ya(this);this.port=this.node=null;this.Yd=[];this.yq=!1}qp.prototype.toString=function(){for(var a=this.Yd,b=this.node.toString()+" "+a.length.toString()+":",c=0;c<a.length;c++){var d=a[c];null!==d&&(b+="\n  "+d.toString())}return b};
    function Op(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}qp.prototype.nm=function(){this.Yd.length=0};
    function rp(a,b){var c=a.Yd;if(0===c.length){a:if(!a.yq){c=a.yq;a.yq=!0;var d=null,e=a.node,f=e instanceof T?e:null;if(null===f||f.isSubGraphExpanded)var g=e.isTreeExpanded?e.findLinksConnected(a.port.portId):e.Lx();else{if(!f.actualBounds.u()){a.yq=c;break a}d=f;g=d.tv()}f=a.Yd.length=0;var h=a.port.ga(vc,I.alloc()),k=a.port.ga(Gc,I.alloc());e=N.allocAt(h.x,h.y,0,0);e.Ie(k);I.free(h);I.free(k);h=I.allocAt(e.x+e.width/2,e.y+e.height/2);k=a.port.Xi();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.Xd(d),n=l.computeSpot(m,a.port);if(n.gd()&&(m=m?l.toPort:l.fromPort,null!==m)){var p=m.part;if(null!==p){var r=p.findVisibleNode();null!==r&&r!==p&&(p=r,m=p.port);m=l.computeOtherPoint(p,m);p=h.Sa(m);p-=k;0>p&&(p+=360);n=Op(e,n,p,l.isOrthogonal);0===n?(n=4,180<p&&(p-=360)):n=90===n?8:180===n?2:1;r=a.Yd[f];void 0===r?(r=new Pp(l,p,n),a.Yd[f]=r):(r.link=l,r.angle=p,r.yc=n);r.Tv.set(m);f++}}}}I.free(h);a.Yd.sort(qp.prototype.l);
      k=a.Yd.length;d=-1;for(f=h=0;f<k;f++)g=a.Yd[f],void 0!==g&&(g.yc!==d&&(d=g.yc,h=0),g.pq=h,h++);d=-1;h=0;for(f=k-1;0<=f;f--)k=a.Yd[f],void 0!==k&&(k.yc!==d&&(d=k.yc,h=k.pq+1),k.em=h);f=a.Yd;n=a.port;d=a.node.portSpreading;h=I.alloc();k=I.alloc();g=I.alloc();l=I.alloc();n.ga(vc,h);n.ga(yc,k);n.ga(Gc,g);n.ga(Cc,l);r=p=m=n=0;if(d===ap)for(var q=0;q<f.length;q++){var u=f[q];if(null!==u){var v=u.link.computeThickness();switch(u.yc){case 8:p+=v;break;case 2:r+=v;break;case 1:n+=v;break;default:case 4:m+=
        v}}}var w=q=0,y=1,z=u=0;for(v=0;v<f.length;v++){var A=f[v];if(null!==A){if(q!==A.yc){q=A.yc;switch(q){case 8:var C=g;w=l;break;case 2:C=l;w=h;break;case 1:C=h;w=k;break;default:case 4:C=k,w=g}u=w.x-C.x;z=w.y-C.y;switch(q){case 8:p>Math.abs(u)?(y=Math.abs(u)/p,p=Math.abs(u)):y=1;break;case 2:r>Math.abs(z)?(y=Math.abs(z)/r,r=Math.abs(z)):y=1;break;case 1:n>Math.abs(u)?(y=Math.abs(u)/n,n=Math.abs(u)):y=1;break;default:case 4:m>Math.abs(z)?(y=Math.abs(z)/m,m=Math.abs(z)):y=1}w=0}var H=A.wq;if(d===ap){A=
        A.link.computeThickness();A*=y;H.set(C);switch(q){case 8:H.x=C.x+u/2+p/2-w-A/2;break;case 2:H.y=C.y+z/2+r/2-w-A/2;break;case 1:H.x=C.x+u/2-n/2+w+A/2;break;default:case 4:H.y=C.y+z/2-m/2+w+A/2}w+=A}else{var L=.5;d===No&&(L=(A.pq+1)/(A.em+1));H.x=C.x+u*L;H.y=C.y+z*L}}}I.free(h);I.free(k);I.free(g);I.free(l);C=a.Yd;for(f=0;f<C.length;f++)d=C[f],null!==d&&(d.rv=a.computeEndSegmentLength(d));a.yq=c;N.free(e)}c=a.Yd}for(a=0;a<c.length;a++)if(e=c[a],null!==e&&e.link===b)return e;return null}
    qp.prototype.l=function(a,b){return a===b?0:null===a?-1:null===b?1:a.yc<b.yc?-1:a.yc>b.yc?1:a.angle<b.angle?-1:a.angle>b.angle?1:0};qp.prototype.computeEndSegmentLength=function(a){var b=a.link,c=b.computeEndSegmentLength(this.node,this.port,uc,b.fromPort===this.port),d=a.pq;if(0>d)return c;var e=a.em;if(1>=e||!b.isOrthogonal)return c;b=a.Tv;var f=a.wq;if(2===a.yc||8===a.yc)d=e-1-d;return((a=2===a.yc||4===a.yc)?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)};qp.className="Knot";
    function Pp(a,b,c){this.link=a;this.angle=b;this.yc=c;this.Tv=new I;this.em=this.pq=0;this.wq=new I;this.rv=0}Pp.prototype.toString=function(){return this.link.toString()+" "+this.angle.toString()+" "+this.yc.toString()+":"+this.pq.toString()+"/"+this.em.toString()+" "+this.wq.toString()+" "+this.rv.toString()+" "+this.Tv.toString()};Pp.className="LinkInfo";function fl(){this.wh=this.Wg=$c;this.vh=this.Vg=this.uh=this.Ug=NaN;this.Tp=this.Kn=null;this.Up=this.Ln=Infinity}
    fl.prototype.copy=function(){var a=new fl;a.Wg=this.Wg.G();a.wh=this.wh.G();a.Ug=this.Ug;a.uh=this.uh;a.Vg=this.Vg;a.vh=this.vh;a.Kn=this.Kn;a.Tp=this.Tp;a.Ln=this.Ln;a.Up=this.Up;return a};fl.className="LinkSettings";function Fi(){Ya(this);this.I=this.B=null;this.oi=this.ao=!0;this.ho=!1;this.Wm=(new I(0,0)).freeze();this.co=!0;this.bo=null;this.Sw="";this.v=null;this.fo=!1;this.l=null}
    Fi.prototype.cloneProtected=function(a){a.ao=this.ao;a.oi=this.oi;a.ho=this.ho;a.Wm.assign(this.Wm);a.co=this.co;a.bo=this.bo;a.Sw=this.Sw;a.fo=!0};Fi.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};Fi.prototype.cb=function(){};Fi.prototype.toString=function(){var a=Ia(this.constructor);a+="(";null!==this.group&&(a+=" in "+this.group);null!==this.diagram&&(a+=" for "+this.diagram);return a+")"};
    Fi.prototype.C=function(){if(this.isValidLayout){var a=this.diagram;if(null!==a&&!a.undoManager.isUndoingRedoing){var b=a.animationManager;!b.isTicking&&(b.defaultAnimation.isAnimating&&b.Xc(),this.isOngoing&&a.kk||this.isInitial&&!a.kk)&&(this.isValidLayout=!1,a.Pb())}}};Fi.prototype.createNetwork=function(){return new Qp(this)};Fi.prototype.makeNetwork=function(a){var b=this.createNetwork();a instanceof R?(b.vg(a.nodes,!0),b.vg(a.links,!0)):a instanceof T?b.vg(a.memberParts):b.vg(a.iterator);return b};
    Fi.prototype.updateParts=function(){var a=this.diagram;if(null===a&&null!==this.network)for(var b=this.network.vertexes.iterator;b.next();){var c=b.value.node;if(null!==c&&(a=c.diagram,null!==a))break}this.isValidLayout=!0;try{null!==a&&a.ua("Layout"),this.commitLayout()}finally{null!==a&&a.Ua("Layout")}};Fi.prototype.commitLayout=function(){if(null!==this.network){for(var a=this.network.vertexes.iterator;a.next();)a.value.commit();if(this.isRouting)for(a=this.network.edges.iterator;a.next();)a.value.commit()}};
    Fi.prototype.doLayout=function(a){var b=new F;a instanceof R?(Rp(this,b,a.nodes,!0,this.uk,!0,!1,!0),Rp(this,b,a.parts,!0,this.uk,!0,!1,!0)):a instanceof T?Rp(this,b,a.memberParts,!1,this.uk,!0,!1,!0):b.addAll(a.iterator);var c=b.count;if(0<c){a=this.diagram;null!==a&&a.ua("Layout");c=Math.ceil(Math.sqrt(c));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);var d=this.arrangementOrigin.x,e=d,f=this.arrangementOrigin.y,g=0,h=0;for(b=b.iterator;b.next();){var k=b.value;Sp(k);var l=k.measuredBounds,
      m=l.width;l=l.height;k.moveTo(e,f);k instanceof T&&(k.uk=!1);e+=Math.max(m,50)+20;h=Math.max(h,Math.max(l,50));g>=c-1?(g=0,e=d,f+=h+20,h=0):g++}null!==a&&a.Ua("Layout")}this.isValidLayout=!0};Fi.prototype.uk=function(a){return!a.location.u()||a instanceof T&&a.uk?!0:!1};
    function Rp(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 T?null===k.layout?Rp(a,b,k.memberParts,!1,e,f,g,h):(Sp(k),b.add(k)):(Sp(k),b.add(k))):g&&k instanceof S?b.add(k):!h||!k.Wb()||k instanceof W||(Sp(k),b.add(k)))}}function Sp(a){var b=a.actualBounds;(0===b.width||0===b.height||isNaN(b.width)||isNaN(b.height))&&a.yb()}
    Fi.prototype.Zi=function(a,b){var c=this.boundsComputation;if(null!==c)return b||(b=new N),c(a,this,b);if(!b)return a.actualBounds;b.set(a.actualBounds);return b};Fi.prototype.Ax=function(a){var b=new F;a instanceof R?(Rp(this,b,a.nodes,!0,null,!0,!0,!0),Rp(this,b,a.links,!0,null,!0,!0,!0),Rp(this,b,a.parts,!0,null,!0,!0,!0)):a instanceof T?Rp(this,b,a.memberParts,!1,null,!0,!0,!0):Rp(this,b,a.iterator,!1,null,!0,!0,!0);return b};
    Fi.prototype.initialOrigin=function(a){var b=this.group;if(null!==b){var c=b.position.copy();(isNaN(c.x)||isNaN(c.y))&&c.set(a);b=b.placeholder;null!==b&&(c=b.ga(vc),(isNaN(c.x)||isNaN(c.y))&&c.set(a),a=b.padding,c.x+=a.left,c.y+=a.top);return c}return a};
    ma.Object.defineProperties(Fi.prototype,{diagram:{get:function(){return this.B},set:function(a){this.B=a}},group:{get:function(){return this.I},set:function(a){this.I!==a&&(this.I=a,null!==a&&(this.B=a.diagram))}},isOngoing:{get:function(){return this.ao},set:function(a){this.ao!==a&&(this.ao=a)}},isInitial:{get:function(){return this.oi},set:function(a){this.oi=a;a||(this.fo=!0)}},
      isViewportSized:{get:function(){return this.ho},set:function(a){this.ho!==a&&(this.ho=a)&&this.C()}},isRouting:{get:function(){return this.co},set:function(a){this.co!==a&&(this.co=a)}},isRealtime:{get:function(){return this.bo},set:function(a){this.bo!==a&&(this.bo=a)}},isValidLayout:{get:function(){return this.fo},set:function(a){this.fo!==a&&(this.fo=a,a||(a=this.diagram,null!==
        a&&(a.Gf=!0)))}},network:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a,null!==a&&(a.layout=this))}},boundsComputation:{get:function(){return this.v},set:function(a){this.v!==a&&(this.v=a,this.C())}},arrangementOrigin:{get:function(){return this.Wm},set:function(a){this.Wm.w(a)||(this.Wm.assign(a),this.C())}}});Fi.prototype.collectParts=Fi.prototype.Ax;Fi.prototype.getLayoutBounds=Fi.prototype.Zi;
    Fi.prototype.invalidateLayout=Fi.prototype.C;Fi.className="Layout";function Qp(a){Ya(this);this.ic=a;this.pf=new F;this.ee=new F;this.Dt=new G;this.yt=new G}Qp.prototype.clear=function(){if(this.pf)for(var a=this.pf.iterator;a.next();)a.value.clear();if(this.ee)for(a=this.ee.iterator;a.next();)a.value.clear();this.pf=new F;this.ee=new F;this.Dt=new G;this.yt=new G};
    Qp.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.pf.count+" edges: "+this.ee.count;if(1<a){for(var c=this.pf.iterator;c.next();)b+="\n    "+c.value.toString(a-1);for(c=this.ee.iterator;c.next();)b+="\n    "+c.value.toString(a-1)}return b};Qp.prototype.createVertex=function(){return new Tp(this)};Qp.prototype.createEdge=function(){return new Up(this)};
    Qp.prototype.vg=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 S){var b=a.fromNode;if(null===b||b.isLinkLabel)return!1;a=a.toNode;return null===a||a.isLinkLabel?!1:!0}return!1});for(a=a.iterator;a.next();){var d=a.value;if(d instanceof W&&(!b||d.isTopLevel)&&d.canLayout()&&c(d))if(d instanceof T&&null===d.layout)this.vg(d.memberParts,!1);else if(null===this.Wi(d)){var e=this.createVertex();e.node=
      d;this.Ch(e)}}for(a.reset();a.next();)if(d=a.value,d instanceof S&&(!b||d.isTopLevel)&&d.canLayout()&&c(d)&&null===this.kq(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.mk(f,e,d))}}};Qp.prototype.findGroupVertex=function(a){if(null===a)return null;var b=a.findVisibleNode();if(null===b)return null;a=this.Wi(b);if(null!==a)return a;for(b=b.containingGroup;null!==b;){a=this.Wi(b);if(null!==a)return a;b=b.containingGroup}return null};
    t=Qp.prototype;t.Ch=function(a){if(null!==a){this.pf.add(a);var b=a.node;null!==b&&this.Dt.add(b,a);a.network=this}};t.am=function(a){if(null===a)return null;var b=this.Wi(a);null===b&&(b=this.createVertex(),b.node=a,this.Ch(b));return b};t.qv=function(a){if(null!==a&&Vp(this,a)){for(var b=a.Eg,c=b.count-1;0<=c;c--){var d=b.L(c);this.ek(d)}b=a.wg;for(a=b.count-1;0<=a;a--)c=b.L(a),this.ek(c)}};
    function Vp(a,b){if(null===b)return!1;var c=a.pf.remove(b);c&&(b=b.node,null!==b&&a.Dt.remove(b));return c}t.cz=function(a){null!==a&&(a=this.Wi(a),null!==a&&this.qv(a))};t.Wi=function(a){return null===a?null:this.Dt.H(a)};t.bq=function(a){if(null!==a){Wp(this,a);var b=a.toVertex;null!==b&&b.hv(a);b=a.fromVertex;null!==b&&b.fv(a)}};function Wp(a,b){if(null!==b){a.ee.add(b);var c=b.link;null!==c&&null===a.kq(c)&&a.yt.add(c,b);b.network=a}}
    t.Jy=function(a){if(null===a)return null;var b=a.fromNode,c=a.toNode,d=this.kq(a);null===d?(d=this.createEdge(),d.link=a,null!==b&&(d.fromVertex=this.am(b)),null!==c&&(d.toVertex=this.am(c)),this.bq(d)):(null!==b?d.fromVertex=this.am(b):d.fromVertex=null,null!==c?d.toVertex=this.am(c):d.toVertex=null);return d};t.ek=function(a){if(null!==a){var b=a.toVertex;null!==b&&b.pv(a);b=a.fromVertex;null!==b&&b.ov(a);Xp(this,a)}};
    function Xp(a,b){null!==b&&a.ee.remove(b)&&(b=b.link,null!==b&&a.yt.remove(b))}t.bz=function(a){null!==a&&(a=this.kq(a),null!==a&&this.ek(a))};t.kq=function(a){return null===a?null:this.yt.H(a)};t.mk=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.bq(d);return d}return null};t.Em=function(a){if(null!==a){var b=a.fromVertex,c=a.toVertex;null!==b&&null!==c&&(b.ov(a),c.pv(a),a.Em(),b.hv(a),c.fv(a))}};
    t.iq=function(){for(var a=Fa(),b=this.ee.iterator;b.next();){var c=b.value;c.fromVertex===c.toVertex&&a.push(c)}b=a.length;for(c=0;c<b;c++)this.ek(a[c]);Ha(a)};Qp.prototype.deleteArtificialVertexes=function(){for(var a=Fa(),b=this.pf.iterator;b.next();){var c=b.value;null===c.node&&a.push(c)}c=a.length;for(b=0;b<c;b++)this.qv(a[b]);b=Fa();for(c=this.ee.iterator;c.next();){var d=c.value;null===d.link&&b.push(d)}c=b.length;for(d=0;d<c;d++)this.ek(b[d]);Ha(a);Ha(b)};
    function Yp(a){for(var b=Fa(),c=a.ee.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.ek(b[d]);Ha(b)}
    Qp.prototype.sy=function(a){void 0===a&&(a=!0);a&&(this.deleteArtificialVertexes(),Yp(this),this.iq());a=new E;for(var b=!0;b;){b=!1;for(var c=this.pf.iterator;c.next();){var d=c.value;if(0<d.Eg.count||0<d.wg.count){b=this.layout.createNetwork();a.add(b);Zp(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 Zp(a,b,c){if(null!==c&&c.network!==b){Vp(a,c);b.Ch(c);for(var d=c.sourceEdges;d.next();){var e=d.value;e.network!==b&&(Xp(a,e),Wp(b,e),Zp(a,b,e.fromVertex))}for(d=c.destinationEdges;d.next();)c=d.value,c.network!==b&&(Xp(a,c),Wp(b,c),Zp(a,b,c.toVertex))}}Qp.prototype.hz=function(){for(var a=new F,b=this.pf.iterator;b.next();)a.add(b.value.node);for(b=this.ee.iterator;b.next();)a.add(b.value.link);return a};
    ma.Object.defineProperties(Qp.prototype,{layout:{get:function(){return this.ic},set:function(a){null!==a&&(this.ic=a)}},vertexes:{get:function(){return this.pf}},edges:{get:function(){return this.ee}}});Qp.prototype.findAllParts=Qp.prototype.hz;Qp.prototype.splitIntoSubNetworks=Qp.prototype.sy;Qp.prototype.deleteSelfEdges=Qp.prototype.iq;Qp.prototype.reverseEdge=Qp.prototype.Em;Qp.prototype.linkVertexes=Qp.prototype.mk;
    Qp.prototype.findEdge=Qp.prototype.kq;Qp.prototype.deleteLink=Qp.prototype.bz;Qp.prototype.deleteEdge=Qp.prototype.ek;Qp.prototype.addLink=Qp.prototype.Jy;Qp.prototype.addEdge=Qp.prototype.bq;Qp.prototype.findVertex=Qp.prototype.Wi;Qp.prototype.deleteNode=Qp.prototype.cz;Qp.prototype.deleteVertex=Qp.prototype.qv;Qp.prototype.addNode=Qp.prototype.am;Qp.prototype.addVertex=Qp.prototype.Ch;Qp.prototype.addParts=Qp.prototype.vg;Qp.className="LayoutNetwork";
    function Tp(a){Ya(this);this.Yc=a;this.l=(new N(0,0,10,10)).freeze();this.v=(new I(5,5)).freeze();this.zi=this.hb=null;this.Eg=new E;this.wg=new E}Tp.prototype.clear=function(){this.zi=this.hb=null;this.Eg=new E;this.wg=new E};
    Tp.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutVertex#"+lb(this);if(0<a&&(b+=null!==this.node?"("+this.node.toString()+")":"",1<a)){a="";for(var c=!0,d=this.Eg.iterator;d.next();){var e=d.value;c?c=!1:a+=",";a+=e.toString(0)}e="";c=!0;for(d=this.wg.iterator;d.next();){var f=d.value;c?c=!1:e+=",";e+=f.toString(0)}b+=" sources: "+a+" destinations: "+e}return b};
    Tp.prototype.commit=function(){var a=this.hb;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 T)){c=N.alloc();var d=this.network.layout.Zi(a,c),e=a.locationObject.ga(Ac);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)}};Tp.prototype.hv=function(a){null!==a&&(this.Eg.contains(a)||this.Eg.add(a))};
    Tp.prototype.pv=function(a){null!==a&&this.Eg.remove(a)};Tp.prototype.fv=function(a){null!==a&&(this.wg.contains(a)||this.wg.add(a))};Tp.prototype.ov=function(a){null!==a&&this.wg.remove(a)};function $p(a,b){a=a.zi;b=b.zi;return a?b?(a=a.text,b=b.text,a<b?-1:a>b?1:0):1:null!==b?-1:0}
    ma.Object.defineProperties(Tp.prototype,{sourceEdgesArrayAccess:{get:function(){return this.Eg._dataArray}},destinationEdgesArrayAccess:{get:function(){return this.wg._dataArray}},data:{get:function(){return this.hb},set:function(a){this.hb=a;if(null!==a){var b=a.bounds;a=b.x;var c=b.y,d=b.width;b=b.height;this.v.h(d/2,b/2);this.l.h(a,c,d,b)}}},node:{get:function(){return this.zi},
        set:function(a){if(this.zi!==a){this.zi=a;a.yb();var b=this.network.layout,c=N.alloc(),d=b.Zi(a,c);b=d.x;var e=d.y,f=d.width;d=d.height;isNaN(b)&&(b=0);isNaN(e)&&(e=0);this.l.h(b,e,f,d);N.free(c);if(!(a instanceof T)&&(a=a.locationObject.ga(Ac),a.u())){this.v.h(a.x-b,a.y-e);return}this.v.h(f/2,d/2)}}},bounds:{get:function(){return this.l},set:function(a){this.l.w(a)||this.l.assign(a)}},focus:{get:function(){return this.v},set:function(a){this.v.w(a)||
        this.v.assign(a)}},centerX:{get:function(){return this.l.x+this.v.x},set:function(a){var b=this.l;b.x+this.v.x!==a&&(b.ea(),b.x=a-this.v.x,b.freeze())}},centerY:{get:function(){return this.l.y+this.v.y},set:function(a){var b=this.l;b.y+this.v.y!==a&&(b.ea(),b.y=a-this.v.y,b.freeze())}},focusX:{get:function(){return this.v.x},set:function(a){var b=this.v;b.x!==a&&(b.ea(),b.x=a,b.freeze())}},focusY:{
        get:function(){return this.v.y},set:function(a){var b=this.v;b.y!==a&&(b.ea(),b.y=a,b.freeze())}},x:{get:function(){return this.l.x},set:function(a){var b=this.l;b.x!==a&&(b.ea(),b.x=a,b.freeze())}},y:{get:function(){return this.l.y},set:function(a){var b=this.l;b.y!==a&&(b.ea(),b.y=a,b.freeze())}},width:{get:function(){return this.l.width},set:function(a){var b=this.l;b.width!==a&&(b.ea(),b.width=
          a,b.freeze())}},height:{get:function(){return this.l.height},set:function(a){var b=this.l;b.height!==a&&(b.ea(),b.height=a,b.freeze())}},network:{get:function(){return this.Yc},set:function(a){this.Yc=a}},sourceVertexes:{get:function(){for(var a=new F,b=this.sourceEdges;b.next();)a.add(b.value.fromVertex);return a.iterator}},destinationVertexes:{get:function(){for(var a=new F,b=
          this.destinationEdges;b.next();)a.add(b.value.toVertex);return a.iterator}},vertexes:{get:function(){for(var a=new F,b=this.sourceEdges;b.next();)a.add(b.value.fromVertex);for(b=this.destinationEdges;b.next();)a.add(b.value.toVertex);return a.iterator}},sourceEdges:{get:function(){return this.Eg.iterator}},destinationEdges:{get:function(){return this.wg.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.Eg.count+this.wg.count}}});Tp.prototype.deleteDestinationEdge=Tp.prototype.ov;Tp.prototype.addDestinationEdge=Tp.prototype.fv;Tp.prototype.deleteSourceEdge=Tp.prototype.pv;Tp.prototype.addSourceEdge=Tp.prototype.hv;Tp.className="LayoutVertex";Tp.standardComparer=$p;
    Tp.smartComparer=function(a,b){if(null!==a){if(null!==b){a=a.zi;var c=b.zi;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 Up(a){Ya(this);this.kd=a;this.rg=this.Tf=this.ul=this.hb=null}Up.prototype.clear=function(){this.rg=this.Tf=this.ul=this.hb=null};Up.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutEdge#"+lb(this);0<a&&(b+=null!==this.ul?"("+this.ul.toString()+")":"",1<a&&(b+=" "+(this.Tf?this.Tf.toString():"null")+" --\x3e "+(this.rg?this.rg.toString():"null")));return b};
    Up.prototype.Em=function(){var a=this.Tf;this.Tf=this.rg;this.rg=a};Up.prototype.commit=function(){};Up.prototype.Sx=function(a){return this.rg===a?this.Tf:this.Tf===a?this.rg:null};
    ma.Object.defineProperties(Up.prototype,{network:{get:function(){return this.kd},set:function(a){this.kd=a}},data:{get:function(){return this.hb},set:function(a){this.hb!==a&&(this.hb=a)}},link:{get:function(){return this.ul},set:function(a){this.ul!==a&&(this.ul=a)}},fromVertex:{get:function(){return this.Tf},set:function(a){this.Tf!==a&&(this.Tf=a)}},toVertex:{
        get:function(){return this.rg},set:function(a){this.rg!==a&&(this.rg=a)}}});Up.prototype.getOtherVertex=Up.prototype.Sx;Up.className="LayoutEdge";function Nk(){Fi.call(this);this.isViewportSized=!0;this.Zp=this.$p=NaN;this.Lg=(new M(NaN,NaN)).freeze();this.ff=(new M(10,10)).freeze();this.vb=aq;this.Ab=bq;this.Qc=cq;this.Kc=dq}la(Nk,Fi);
    Nk.prototype.cloneProtected=function(a){Fi.prototype.cloneProtected.call(this,a);a.$p=this.$p;a.Zp=this.Zp;a.Lg.assign(this.Lg);a.ff.assign(this.ff);a.vb=this.vb;a.Ab=this.Ab;a.Qc=this.Qc;a.Kc=this.Kc};Nk.prototype.cb=function(a){a.classType===Nk?a===cq||a===eq||a===fq||a===gq?this.sorting=a:a===bq||a===hq?this.arrangement=a:a===aq||a===iq?this.alignment=a:B("Unknown enum value: "+a):Fi.prototype.cb.call(this,a)};
    Nk.prototype.doLayout=function(a){this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);var b=this.Ax(a);a=this.diagram;for(var c=b.copy().iterator;c.next();){var d=c.value;if(!d.Ih()||null===d.fromNode&&null===d.toNode){if(d.yb(),d instanceof T)for(d=d.memberParts;d.next();)b.remove(d.value)}else b.remove(d)}var e=b.na();if(0!==e.length){switch(this.sorting){case gq:e.reverse();break;case cq:e.sort(this.comparer);break;case eq:e.sort(this.comparer),e.reverse()}var f=this.wrappingColumn;
      isNaN(f)&&(f=0);var g=this.wrappingWidth;isNaN(g)&&null!==a?(b=a.padding,g=Math.max(a.viewportBounds.width-b.left-b.right,0)):g=Math.max(this.wrappingWidth,0);0>=f&&0>=g&&(f=1);b=this.spacing.width;isFinite(b)||(b=0);c=this.spacing.height;isFinite(c)||(c=0);null!==a&&a.ua("Layout");d=[];switch(this.alignment){case iq: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.Zi(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.Zi(e[p],l);n=Math.max(n,r.height)}n=Math.max(n+k,1);p=this.arrangement;for(var q=r=this.arrangementOrigin.x,u=this.arrangementOrigin.y,v=0,w=0,y=0;y<e.length;y++){var z=e[y],A=this.Zi(z,l),C=Math.ceil((A.width+h)/m)*m,H=Math.ceil((A.height+k)/n)*n;switch(p){case hq:var L=Math.abs(q-A.width);break;default:L=q+A.width}if(0<f&&v>f-1||0<g&&0<v&&L-r>g)d.push(new N(0,u,g+h,w)),v=0,q=r,u+=w,w=0;w=Math.max(w,H);switch(p){case hq:A=-A.width;break;default:A=
        0}z.moveTo(q+A,u);switch(p){case hq:q-=C;break;default:q+=C}v++}d.push(new N(0,u,g+h,w));N.free(l);break;case aq:k=g;m=f;n=b;p=c;g=N.alloc();r=Math.max(this.cellSize.width,1);f=u=l=0;h=I.alloc();for(q=0;q<e.length;q++)w=e[q],v=this.Zi(w,g),w=w.wf(w.locationObject,w.locationSpot,h),l=Math.max(l,w.x),u=Math.max(u,v.width-w.x),f=Math.max(f,w.y);q=this.arrangement;switch(q){case hq:l+=n;break;default:u+=n}r=isFinite(r)?Math.max(r+n,1):Math.max(l+u,1);var K=w=this.arrangementOrigin.x;y=this.arrangementOrigin.y;
        u=0;k>=l&&(k-=l);l=z=0;C=Math.max(this.cellSize.height,1);A=f=0;H=!0;v=I.alloc();for(L=0;L<e.length;L++){var V=e[L],Q=this.Zi(V,g),ca=V.wf(V.locationObject,V.locationSpot,h);if(0<u)switch(q){case hq:K=(K-w-(Q.width-ca.x))/r;K=J.$(Math.round(K),K)?Math.round(K):Math.floor(K);K=K*r+w;break;default:K=(K-w+ca.x)/r,K=J.$(Math.round(K),K)?Math.round(K):Math.ceil(K),K=K*r+w}else switch(q){case hq:z=K+ca.x+Q.width;break;default:z=K-ca.x}switch(q){case hq:var pa=-(K+ca.x)+z;break;default:pa=K+Q.width-ca.x-
          z}if(0<m&&u>m-1||0<k&&0<u&&pa>k){d.push(new N(0,H?y-f:y,k+n,A+f+p));for(K=0;K<u&&L!==u;K++){pa=e[L-u+K];var O=pa.wf(pa.locationObject,pa.locationSpot,v);pa.moveTo(pa.position.x,pa.position.y+f-O.y)}A+=p;y=H?y+A:y+(A+f);u=A=f=0;K=w;H=!1}K===w&&(l=q===hq?Math.max(l,Q.width-ca.x):Math.min(l,-ca.x));f=Math.max(f,ca.y);A=Math.max(A,Q.height-ca.y);isFinite(C)&&(A=Math.max(A,Math.max(Q.height,C)-ca.y));H?V.moveTo(K-ca.x,y-ca.y):V.moveTo(K-ca.x,y);switch(q){case hq:K-=ca.x+n;break;default:K+=Q.width-ca.x+
          n}u++}d.push(new N(0,y,k+n,(H?A:A+f)+p));if(e.length!==u)for(k=0;k<u;k++)m=e[e.length-u+k],n=m.wf(m.locationObject,m.locationSpot,h),m.moveTo(m.position.x,m.position.y+f-n.y);I.free(h);I.free(v);if(q===hq)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===hq?this.commitLayers(d,new I(e+b/2-(f+e),g-c/2)):this.commitLayers(d,
        new I(e-b/2,g-c/2));null!==a&&a.Ua("Layout");this.isValidLayout=!0}};Nk.prototype.commitLayers=function(){};function dq(a,b){a=a.text;b=b.text;return a<b?-1:a>b?1:0}
    ma.Object.defineProperties(Nk.prototype,{wrappingWidth:{get:function(){return this.$p},set:function(a){this.$p!==a&&(0<a||isNaN(a))&&(this.$p=a,this.isViewportSized=isNaN(a),this.C())}},wrappingColumn:{get:function(){return this.Zp},set:function(a){this.Zp!==a&&(0<a||isNaN(a))&&(this.Zp=a,this.C())}},cellSize:{get:function(){return this.Lg},set:function(a){this.Lg.w(a)||(this.Lg.assign(a),this.C())}},spacing:{
        get:function(){return this.ff},set:function(a){this.ff.w(a)||(this.ff.assign(a),this.C())}},alignment:{get:function(){return this.vb},set:function(a){this.vb===a||a!==aq&&a!==iq||(this.vb=a,this.C())}},arrangement:{get:function(){return this.Ab},set:function(a){this.Ab===a||a!==bq&&a!==hq||(this.Ab=a,this.C())}},sorting:{get:function(){return this.Qc},set:function(a){this.Qc===a||a!==fq&&a!==gq&&
        a!==cq&&a!==eq||(this.Qc=a,this.C())}},comparer:{get:function(){return this.Kc},set:function(a){this.Kc!==a&&(this.Kc=a,this.C())}}});var iq=new D(Nk,"Position",0),aq=new D(Nk,"Location",1),bq=new D(Nk,"LeftToRight",2),hq=new D(Nk,"RightToLeft",3),fq=new D(Nk,"Forward",4),gq=new D(Nk,"Reverse",5),cq=new D(Nk,"Ascending",6),eq=new D(Nk,"Descending",7);Nk.className="GridLayout";Nk.standardComparer=dq;
    Nk.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};Nk.Position=iq;Nk.Location=aq;Nk.LeftToRight=bq;Nk.RightToLeft=hq;Nk.Forward=fq;Nk.Reverse=gq;Nk.Ascending=cq;Nk.Descending=eq;function ti(){this.So=new F;this.so=new F;this.Ca=new F;this.Pe=new G;this.Oe=new G;this.yj=new G;this.B=null;this.Tq=!1}t=ti.prototype;t.clear=function(){this.So.clear();this.so.clear();this.Ca.clear();this.Pe.clear();this.Oe.clear();this.yj.clear()};t.Zd=function(a){this.B=a};
    t.aj=function(a){if(a instanceof W){if(this.So.add(a),a instanceof T){var b=a.containingGroup;null===b?this.B.xh.add(a):b.zl.add(a);b=a.layout;null!==b&&(b.diagram=this.B)}}else a instanceof S?this.so.add(a):a instanceof Ke||this.Ca.add(a);b=a.data;null===b||a instanceof Ke||(a instanceof S?this.Oe.add(b,a):this.Pe.add(b,a))};
    t.Fc=function(a){a.Yj();if(a instanceof W){if(this.So.remove(a),a instanceof T){var b=a.containingGroup;null===b?this.B.xh.remove(a):b.zl.remove(a);b=a.layout;null!==b&&(b.diagram=null)}}else a instanceof S?this.so.remove(a):a instanceof Ke||this.Ca.remove(a);b=a.data;null===b||a instanceof Ke||(a instanceof S?this.Oe.remove(b):this.Pe.remove(b))};
    t.yd=function(){for(var a=this.B.nodeTemplateMap.iterator;a.next();){var b=a.value,c=a.key;(!b.Wb()||b instanceof T)&&B('Invalid node template in Diagram.nodeTemplateMap: template for "'+c+'" must be a Node or a simple Part, not a Group or Link: '+b)}for(a=this.B.groupTemplateMap.iterator;a.next();)b=a.value,c=a.key,b instanceof T||B('Invalid group template in Diagram.groupTemplateMap: template for "'+c+'" must be a Group, not a normal Node or Link: '+b);for(a=this.B.linkTemplateMap.iterator;a.next();)b=
      a.value,c=a.key,b instanceof S||B('Invalid link template in Diagram.linkTemplateMap: template for "'+c+'" must be a Link, not a normal Node or simple Part: '+b);a=Fa();for(b=this.B.selection.iterator;b.next();)(c=b.value.data)&&a.push(c);b=Fa();for(c=this.B.highlighteds.iterator;c.next();){var d=c.value.data;d&&b.push(d)}c=Fa();for(d=this.nodes.iterator;d.next();){var e=d.value;null!==e.data&&(c.push(e.data),c.push(e.location))}for(d=this.links.iterator;d.next();)e=d.value,null!==e.data&&(c.push(e.data),
      c.push(e.location));for(d=this.parts.iterator;d.next();)e=d.value,null!==e.data&&(c.push(e.data),c.push(e.location));this.removeAllModeledParts();this.addAllModeledParts();for(d=0;d<a.length;d++)e=this.wc(a[d]),null!==e&&(e.isSelected=!0);for(d=0;d<b.length;d++)e=this.wc(b[d]),null!==e&&(e.isHighlighted=!0);for(d=0;d<c.length;d+=2)e=this.wc(c[d]),null!==e&&(e.location=c[d+1]);Ha(a);Ha(b);Ha(c)};ti.prototype.addAllModeledParts=function(){this.addModeledParts(this.diagram.model.nodeDataArray)};
    ti.prototype.addModeledParts=function(a,b){var c=this,d=this.diagram.model;a.forEach(function(a){d.sb(a)&&jq(c,a,!1)});a.forEach(function(a){d.sb(a)&&c.resolveReferencesForData(a)});!1!==b&&pk(this.diagram,!1)};
    function jq(a,b,c){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.Pe.contains(b)){void 0===c&&(c=!0);a:{if(void 0!==b&&null!==b&&!a.B.undoManager.isUndoingRedoing&&!a.Pe.contains(b)){var d=a.ot(b);var e=Lo(a,b,d);if(null!==e&&(wg(e),e=e.copy(),null!==e)){var f=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.Jf=d;e.hb=b;a.Tq&&(e.bh="Tool");a.diagram.add(e);e.hb=null;e.data=b;a.diagram.skipsModelSourceBindings=f;d=e;break a}}d=null}null!==d&&c&&a.resolveReferencesForData(b)}}
    ti.prototype.insertLink=function(){return null};ti.prototype.resolveReferencesForData=function(){};ti.prototype.ot=function(a){return this.B.model.ot(a)};
    function Lo(a,b,c){a=a.B;var d=a.model;d.jk()&&d.Kv(b)?(b=a.groupTemplateMap.H(c),null===b&&(b=a.groupTemplateMap.H(""),null===b&&(kq||(kq=!0,wa('No Group template found for category "'+c+'"'),wa("  Using default group template")),b=a.gu))):(b=a.nodeTemplateMap.H(c),null===b&&(b=a.nodeTemplateMap.H(""),null===b&&(lq||(lq=!0,wa('No Node template found for category "'+c+'"'),wa("  Using default node template")),b=a.iu)));return b}ti.prototype.getLinkCategoryForData=function(){return""};
    ti.prototype.setLinkCategoryForData=function(){};ti.prototype.setFromNodeForLink=function(){};ti.prototype.setToNodeForLink=function(){};ti.prototype.findLinkTemplateForCategory=function(a){var b=this.B.linkTemplateMap.H(a);null===b&&(b=this.B.linkTemplateMap.H(""),null===b&&(mq||(mq=!0,wa('No Link template found for category "'+a+'"'),wa("  Using default link template")),b=this.B.hu));return b};ti.prototype.removeAllModeledParts=function(){this.Jt(this.diagram.model.nodeDataArray)};
    ti.prototype.Jt=function(a){var b=this;a.forEach(function(a){b.Gq(a)})};ti.prototype.Gq=function(a){a=this.wc(a);null!==a&&(Mj(this.diagram,a,!1),this.unresolveReferencesForPart(a))};ti.prototype.unresolveReferencesForPart=function(){};ti.prototype.removeDataForLink=function(){};ti.prototype.findPartForKey=function(a){if(null===a||void 0===a)return null;a=this.B.model.Ib(a);return null!==a?this.Pe.H(a):null};
    ti.prototype.Jb=function(a){if(null===a||void 0===a)return null;a=this.B.model.Ib(a);if(null===a)return null;a=this.Pe.H(a);return a instanceof W?a:null};ti.prototype.findLinkForKey=function(){return null};t=ti.prototype;t.wc=function(a){if(null===a)return null;var b=this.Pe.H(a);return null!==b?b:b=this.Oe.H(a)};t.Si=function(a){if(null===a)return null;a=this.Pe.H(a);return a instanceof W?a:null};t.vc=function(a){return null===a?null:this.Oe.H(a)};
    t.lt=function(a){for(var b=0;b<arguments.length;++b);b=new F;for(var c=this.So.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)&&nq(this,e,g)){b.add(d);break}}}return b.iterator};t.kt=function(a){for(var b=0;b<arguments.length;++b);b=new F;for(var c=this.so.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)&&nq(this,e,g)){b.add(d);break}}}return b.iterator};
    function nq(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&&!oq(a,e[g],h))return!1}}else if(!oq(a,e,f))return!1}return!0}function oq(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(!nq(a,b,c))return!1}else if(b!==c)return!1;return!0}
    ti.prototype.doModelChanged=function(a){if(this.B){var b=this.B;if(a.model===b.model){var c=a.change;b.doModelChanged(a);if(b.Z){b.Z=!1;try{var d=a.modelChange;if(""!==d)if(c===ue){if("nodeCategory"===d){var e=this.wc(a.object),f=a.newValue;null!==e&&"string"===typeof f&&(e.category=f)}else"nodeDataArray"===d&&(this.Jt(a.oldValue),this.addModeledParts(a.newValue));b.isModified=!0}else if(c===we){var g=a.newValue;"nodeDataArray"===d&&za(g)&&jq(this,g);b.isModified=!0}else if(c===xe){var h=a.oldValue;
      "nodeDataArray"===d&&za(h)&&this.Gq(h);b.isModified=!0}else c===ve&&("SourceChanged"===d?null!==a.object?this.updateDataBindings(a.object,a.propertyName):(this.Pq(),this.updateAllTargetBindings()):"ModelDisplaced"===d&&this.yd());else if(c===ue){var k=a.propertyName,l=a.object;if(l===b.model){if("nodeKeyProperty"===k||"nodeCategoryProperty"===k)b.undoManager.isUndoingRedoing||this.yd()}else this.updateDataBindings(l,k);b.isModified=!0}else if(c===we||c===xe){var m=a.change===we,n=m?a.newParam:a.oldParam,
      p=m?a.newValue:a.oldValue,r=this.yj.H(a.object);if(Array.isArray(r))for(a=0;a<r.length;a++){var q=r[a];if(m)nn(q,p,n);else if(!(0>n)){var u=n+fn(q);q.Fc(u,!0);An(q,u,n)}}b.isModified=!0}}finally{b.Z=!0}}}}};ti.prototype.updateAllTargetBindings=function(a){void 0===a&&(a="");for(var b=this.parts.iterator;b.next();)b.value.Ba(a);for(b=this.nodes.iterator;b.next();)b.value.Ba(a);for(b=this.links.iterator;b.next();)b.value.Ba(a)};
    ti.prototype.Pq=function(){for(var a=this.B.model,b=new F,c=a.nodeDataArray,d=0;d<c.length;d++)b.add(c[d]);var e=[];this.nodes.each(function(a){null===a.data||b.contains(a.data)||e.push(a.data)});this.parts.each(function(a){null===a.data||b.contains(a.data)||e.push(a.data)});e.forEach(function(b){pq(a,b,!1)});for(d=0;d<c.length;d++){var f=c[d];null===this.wc(f)&&qq(a,f,!1)}this.refreshDataBoundLinks();for(c=this.parts.iterator;c.next();)c.value.updateRelationshipsFromData();for(c=this.nodes.iterator;c.next();)c.value.updateRelationshipsFromData();
      for(c=this.links.iterator;c.next();)c.value.updateRelationshipsFromData()};ti.prototype.refreshDataBoundLinks=function(){};ti.prototype.updateRelationshipsFromData=function(){};
    ti.prototype.updateDataBindings=function(a,b){if("string"===typeof b){var c=this.wc(a);if(null!==c)c.Ba(b);else{c=null;for(var d=this.yj.iterator;d.next();){for(var e=d.value,f=0;f<e.length;f++){var g=e[f].Mx(a);null!==g&&(null===c&&(c=Fa()),c.push(g))}if(null!==c)break}if(null!==c){for(d=0;d<c.length;d++)c[d].Ba(b);Ha(c)}}a===this.diagram.model.modelData&&this.updateAllTargetBindings(b)}};
    function Ij(a,b){var c=b.si;if(Aa(c)){var d=a.yj.H(c);if(null===d)d=[],d.push(b),a.yj.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}function Lj(a,b,c){Gj(b,function(a){a=a.W.j;for(var b=a.length,d=0;d<b;d++)nk(c,a[d])});var d=b.si;if(Aa(d)){var e=a.yj.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.yj.remove(d);break}}}
    ti.prototype.ck=function(a,b,c){var d=new G;if(Aa(a))for(var e=0;e<a.length;e++)rq(this,a[e],b,d,c);else for(a=a.iterator;a.next();)rq(this,a.value,b,d,c);if(null!==b){c=b.model;a=b.toolManager.findTool("Dragging");a=null!==a?a.dragOptions.dragsLink:b.Qk.dragsLink;e=new F;for(var f=new G,g=d.iterator;g.next();){var h=g.value;if(h instanceof S)a||null!==h.fromNode&&null!==h.toNode||e.add(h);else if(h instanceof W&&null!==h.data&&c.qm()){var k=h;h=g.key;var l=h.zg();null!==l&&(l=d.H(l),null!==l?(c.He(k.data,
      c.ja(l.data)),k=b.vc(k.data),h=h.Vi(),null!==h&&null!==k&&f.add(h,k)):c.He(k.data,void 0))}}0<e.count&&b.Kt(e,!1);if(0<f.count)for(c=f.iterator;c.next();)d.add(c.key,c.value)}if(null!==b&&null!==this.B&&(b=b.model,c=b.afterCopyFunction,null!==c)){var m=new G;d.each(function(a){null!==a.key.data&&m.add(a.key.data,a.value.data)});c(m,b,this.B.model)}for(b=d.iterator;b.next();)b.value.Ba();return d};
    function rq(a,b,c,d,e){if(null===b||e&&!b.canCopy())return null;if(d.contains(b))return d.H(b);var f=a.copyPartData(b,c);if(!(f instanceof U))return null;f.isSelected=!1;f.isHighlighted=!1;d.add(b,f);if(b instanceof 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 T&&f instanceof T)for(b=b.memberParts;b.next();)g=rq(a,b.value,c,d,e),g instanceof S||null===g||(g.containingGroup=
      f)}else if(b instanceof S&&f instanceof S)for(g=b.fromNode,null!==g&&(g=d.H(g),null!==g&&(f.fromNode=g)),g=b.toNode,null!==g&&(g=d.H(g),null!==g&&(f.toNode=g)),b=b.labelNodes;b.next();)g=rq(a,b.value,c,d,e),null!==g&&g instanceof W&&(g.labeledLink=f);return f}
    ti.prototype.copyPartData=function(a,b){var c=null,d=a.data;if(null!==d&&null!==b){var e=b.model;a instanceof S||(d=e.copyNodeData(d),za(d)&&(e.qf(d),c=b.wc(d)))}else wg(a),c=a.copy(),null!==c&&(e=this.B,null!==b?b.add(c):null!==d&&null!==e&&null!==e.commandHandler&&e.commandHandler.copiesClipboardData&&(b=e.model,e=null,c instanceof S||(e=b.copyNodeData(d)),za(e)&&(c.data=e)));return c};
    ma.Object.defineProperties(ti.prototype,{nodes:{get:function(){return this.So}},links:{get:function(){return this.so}},parts:{get:function(){return this.Ca}},diagram:{get:function(){return this.B}},addsToTemporaryLayer:{get:function(){return this.Tq},set:function(a){this.Tq=a}}});ti.prototype.updateAllRelationshipsFromData=ti.prototype.Pq;
    ti.prototype.findLinksByExample=ti.prototype.kt;ti.prototype.findNodesByExample=ti.prototype.lt;ti.prototype.findLinkForData=ti.prototype.vc;ti.prototype.findNodeForData=ti.prototype.Si;ti.prototype.findPartForData=ti.prototype.wc;ti.prototype.findNodeForKey=ti.prototype.Jb;ti.prototype.removeModeledPart=ti.prototype.Gq;ti.prototype.removeModeledParts=ti.prototype.Jt;ti.prototype.rebuildParts=ti.prototype.yd;var lq=!1,kq=!1,mq=!1;ti.className="PartManager";
    function sq(a){ti.apply(this,arguments)}la(sq,ti);sq.prototype.addAllModeledParts=function(){var a=this.diagram.model;this.addModeledParts(a.nodeDataArray);tq(this,a.linkDataArray)};sq.prototype.addModeledParts=function(a){ti.prototype.addModeledParts.call(this,a,!1);for(a=this.links.iterator;a.next();)Mo(a.value);pk(this.diagram,!1)};function tq(a,b){b.forEach(function(b){uq(a,b)});pk(a.diagram,!1)}
    function uq(a,b){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.Oe.contains(b)){var c=a.getLinkCategoryForData(b),d=a.findLinkTemplateForCategory(c);if(null!==d){wg(d);var e=d.copy();if(null!==e){d=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.Jf=c;e.hb=b;c=a.diagram.model;var f=vq(c,b,!0);""!==f&&(e.fromPortId=f);f=wq(c,b,!0);void 0!==f&&(f=a.Jb(f),f instanceof W&&(e.fromNode=f));f=vq(c,b,!1);""!==f&&(e.toPortId=f);f=wq(c,b,!1);void 0!==f&&(f=a.Jb(f),
    f instanceof W&&(e.toNode=f));c=c.Ag(b);Array.isArray(c)&&c.forEach(function(b){b=a.Jb(b);null!==b&&(b.labeledLink=e)});a.Tq&&(e.bh="Tool");a.diagram.add(e);e.hb=null;e.data=b;a.diagram.skipsModelSourceBindings=d}}}}sq.prototype.removeAllModeledParts=function(){var a=this.diagram.model;xq(this,a.linkDataArray);this.Jt(a.nodeDataArray)};function xq(a,b){b.forEach(function(b){a.Gq(b)})}sq.prototype.getLinkCategoryForData=function(a){return this.diagram.model.zv(a)};
    sq.prototype.setLinkCategoryForData=function(a,b){return this.diagram.model.Mt(a,b)};sq.prototype.setFromNodeForLink=function(a,b){var c=this.diagram.model;c.ky(a.data,c.ja(null!==b?b.data:null))};sq.prototype.setToNodeForLink=function(a,b){var c=this.diagram.model;c.oy(a.data,c.ja(null!==b?b.data:null))};sq.prototype.removeDataForLink=function(a){this.diagram.model.zm(a.data)};
    sq.prototype.findPartForKey=function(a){var b=ti.prototype.findPartForKey.call(this,a);return null===b&&(a=this.diagram.model.xg(a),null!==a)?this.Oe.H(a):b};sq.prototype.findLinkForKey=function(a){if(null===a||void 0===a)return null;a=this.diagram.model.xg(a);return null!==a?this.Oe.H(a):null};
    sq.prototype.doModelChanged=function(a){var b=this;ti.prototype.doModelChanged.call(this,a);if(this.diagram){var c=this.diagram;if(a.model===c.model){var d=a.change;if(c.Z){c.Z=!1;try{var e=a.modelChange;if(""!==e)if(d===ue){if("linkFromKey"===e){var f=this.vc(a.object);if(null!==f){var g=this.Jb(a.newValue);f.fromNode=g}}else if("linkToKey"===e){var h=this.vc(a.object);if(null!==h){var k=this.Jb(a.newValue);h.toNode=k}}else if("linkFromPortId"===e){var l=this.vc(a.object);if(null!==l){var m=a.newValue;
      "string"===typeof m&&(l.fromPortId=m)}}else if("linkToPortId"===e){var n=this.vc(a.object);if(null!==n){var p=a.newValue;"string"===typeof p&&(n.toPortId=p)}}else if("nodeGroupKey"===e){var r=this.wc(a.object);if(null!==r){var q=a.newValue;if(void 0!==q){var u=this.Jb(q);u instanceof T?r.containingGroup=u:r.containingGroup=null}else r.containingGroup=null}}else if("linkLabelKeys"===e){var v=this.vc(a.object);if(null!==v){var w=a.oldValue,y=a.newValue;Array.isArray(w)&&w.forEach(function(a){a=b.Jb(a);
      null!==a&&(a.labeledLink=null)});Array.isArray(y)&&y.forEach(function(a){a=b.Jb(a);null!==a&&(a.labeledLink=v)})}}else if("linkCategory"===e){var z=this.vc(a.object),A=a.newValue;null!==z&&"string"===typeof A&&(z.category=A)}else"linkDataArray"===e&&(xq(this,a.oldValue),tq(this,a.newValue));c.isModified=!0}else if(d===we){var C=a.newValue;if("linkDataArray"===e&&"object"===typeof C&&null!==C)uq(this,C);else if("linkLabelKeys"===e&&yq(C)){var H=this.vc(a.object),L=this.Jb(C);null!==H&&null!==L&&(L.labeledLink=
      H)}c.isModified=!0}else{if(d===xe){var K=a.oldValue;if("linkDataArray"===e&&"object"===typeof K&&null!==K)this.Gq(K);else if("linkLabelKeys"===e&&yq(K)){var V=this.Jb(K);null!==V&&(V.labeledLink=null)}c.isModified=!0}}else if(d===ue){var Q=a.propertyName;a.object!==c.model||"linkFromKeyProperty"!==Q&&"linkToKeyProperty"!==Q&&"linkFromPortIdProperty"!==Q&&"linkToPortIdProperty"!==Q&&"linkLabelKeysProperty"!==Q&&"nodeIsGroupProperty"!==Q&&"nodeGroupKeyProperty"!==Q&&"linkCategoryProperty"!==Q||c.undoManager.isUndoingRedoing||
    this.yd();c.isModified=!0}}finally{c.Z=!0}}}}};sq.prototype.refreshDataBoundLinks=function(){var a=this,b=this.diagram.model,c=new F,d=b.linkDataArray;d.forEach(function(a){c.add(a)});var e=[];this.links.each(function(a){null===a.data||c.contains(a.data)||e.push(a.data)});e.forEach(function(a){zq(b,a,!1)});d.forEach(function(c){null===a.vc(c)&&Aq(b,c,!1)})};
    sq.prototype.updateRelationshipsFromData=function(a){var b=a.data;if(null!==b){var c=a.diagram;if(null!==c){var d=c.model;if(a instanceof S){var e=wq(d,b,!0);e=c.Jb(e);a.fromNode=e;e=wq(d,b,!1);e=c.Jb(e);a.toNode=e;b=d.Ag(b);if(0<b.length||0<a.labelNodes.count){if(1===b.length&&1===a.labelNodes.count){e=b[0];var f=a.labelNodes.first();if(d.ja(f.data)===e)return}e=(new F).addAll(b);var g=new F;a.labelNodes.each(function(a){null!==a.data&&(a=d.ja(a.data),void 0!==a&&g.add(a))});b=g.copy();b.Fq(e);e=
      e.copy();e.Fq(g);if(0<b.count||0<e.count)b.each(function(b){b=c.Jb(b);null!==b&&b.labeledLink===a&&(b.labeledLink=null)}),e.each(function(b){b=c.Jb(b);null!==b&&b.labeledLink!==a&&(b.labeledLink=a)})}}else!(a instanceof Ke)&&(b=d.Yi(b),b=c.findPartForKey(b),null===b||b instanceof T)&&(a.containingGroup=b)}}};
    sq.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.ja(a);if(void 0!==c){var d=Bq(b,c),e=this.wc(a);if(null!==d&&null!==e){d=d.iterator;for(var f={};d.next();){var g=d.value;b.sb(g)?e instanceof T&&b.Yi(g)===c&&(g=this.wc(g),null!==g&&(g.containingGroup=e)):(f.link=this.vc(g),null!==f.link&&e instanceof W&&(wq(b,g,!0)===c&&(f.link.fromNode=e),wq(b,g,!1)===c&&(f.link.toNode=e),g=b.Ag(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}}Cq(b,c)}a=b.Yi(a);void 0!==a&&(a=this.Jb(a),a instanceof T&&(e.containingGroup=a))}};sq.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof W){var c=b.ja(a.data);if(void 0!==c){for(var d=a.linksConnected;d.next();)Dq(b,c,d.value.data);a.isLinkLabel&&(d=a.labeledLink,null!==d&&Dq(b,c,d.data));if(a instanceof T)for(a=a.memberParts;a.next();)d=a.value.data,b.sb(d)&&Dq(b,c,d)}}};
    sq.prototype.copyPartData=function(a,b){var c=ti.prototype.copyPartData.call(this,a,b);if(a instanceof S)if(a=a.data,null!==a&&null!==b){var d=b.model;a=d.hq(a);"object"===typeof a&&null!==a&&(d.Ni(a),c=b.vc(a))}else null!==c&&(b=this.diagram,null!==a&&null!==b&&null!==b.commandHandler&&b.commandHandler.copiesClipboardData&&(b=b.model.hq(a),"object"===typeof b&&null!==b&&(c.data=b)));return c};
    sq.prototype.insertLink=function(a,b,c,d){var e=this.diagram,f=e.model,g=e.toolManager.findTool("Linking"),h="";null!==a&&(null===b&&(b=a),h=b.portId,null===h&&(h=""));b="";null!==c&&(null===d&&(d=c),b=d.portId,null===b&&(b=""));d=g.archetypeLinkData;if(d instanceof S){if(wg(d),f=d.copy(),null!==f)return f.fromNode=a,f.fromPortId=h,f.toNode=c,f.toPortId=b,e.add(f),a=g.archetypeLabelNodeData,a instanceof W&&(wg(a),a=a.copy(),null!==a&&(a.labeledLink=f,e.add(a))),f}else if(null!==d&&(d=f.hq(d),"object"===
    typeof d&&null!==d))return null!==a&&Eq(f,d,f.ja(a.data),!0),Fq(f,d,h,!0),null!==c&&Eq(f,d,f.ja(c.data),!1),Fq(f,d,b,!1),f.Ni(d),a=g.archetypeLabelNodeData,null===a||a instanceof W||(a=f.copyNodeData(a),"object"===typeof a&&null!==a&&(f.qf(a),a=f.ja(a),void 0!==a&&f.gv(d,a))),e.vc(d);return null};sq.prototype.findLinkForKey=sq.prototype.findLinkForKey;sq.prototype.findPartForKey=sq.prototype.findPartForKey;sq.prototype.removeAllModeledParts=sq.prototype.removeAllModeledParts;
    sq.prototype.addModeledParts=sq.prototype.addModeledParts;sq.prototype.addAllModeledParts=sq.prototype.addAllModeledParts;sq.className="GraphLinksPartManager";function Gq(){ti.apply(this,arguments);this.jh=null}la(Gq,ti);
    function Hq(a,b,c){if(null!==b&&null!==c){var d=a.diagram.toolManager.findTool("Linking"),e=b,f=c;if(a.diagram.isTreePathToChildren)for(b=f.linksConnected;b.next();){if(b.value.toNode===f)return}else for(e=c,f=b,b=e.linksConnected;b.next();)if(b.value.fromNode===e)return;if(null===d||!Of(d,e,f,null,!0))if(d=a.getLinkCategoryForData(c.data),b=a.findLinkTemplateForCategory(d),null!==b&&(wg(b),b=b.copy(),null!==b)){var g=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;b.Jf=d;
      b.hb=c.data;b.fromNode=e;b.toNode=f;a.diagram.add(b);b.hb=null;b.data=c.data;a.diagram.skipsModelSourceBindings=g}}}Gq.prototype.getLinkCategoryForData=function(a){return this.diagram.model.Av(a)};Gq.prototype.setLinkCategoryForData=function(a,b){this.diagram.model.hw(a,b)};
    Gq.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.He(a.data,d.ja(b));else{var e=this.jh;this.jh=a;null!==c&&d.He(c.data,void 0);d.He(b,d.ja(null!==a.toNode?a.toNode.data:null));this.jh=e}};
    Gq.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.jh;this.jh=a;null!==c&&d.He(c.data,void 0);d.He(b,d.ja(null!==a.fromNode?a.fromNode.data:null));this.jh=e}else d.He(a.data,d.ja(b))};Gq.prototype.removeDataForLink=function(a){this.diagram.model.He(a.data,void 0)};
    Gq.prototype.findLinkForKey=function(a){if(null===a||void 0===a)return null;a=this.diagram.model.Ib(a);return null!==a?this.Oe.H(a):null};
    Gq.prototype.doModelChanged=function(a){ti.prototype.doModelChanged.call(this,a);if(this.diagram){var b=this.diagram;if(a.model===b.model){var c=a.change;if(b.Z){b.Z=!1;try{var d=a.modelChange;if(""!==d){if(c===ue){if("nodeParentKey"===d){var e=a.object,f=this.Jb(a.newValue),g=this.Si(e);if(null!==this.jh)null!==f&&(this.jh.data=e,this.jh.category=this.getLinkCategoryForData(e));else if(null!==g){var h=g.Vi();null!==h?null===f?b.remove(h):b.isTreePathToChildren?h.fromNode=f:h.toNode=f:Hq(this,f,g)}}else if("parentLinkCategory"===
      d){var k=this.Si(a.object),l=a.newValue;if(null!==k&&"string"===typeof l){var m=k.Vi();null!==m&&(m.category=l)}}b.isModified=!0}}else if(c===ue){var n=a.propertyName;a.object===b.model&&"nodeParentKeyProperty"===n&&(b.undoManager.isUndoingRedoing||this.yd());b.isModified=!0}}finally{b.Z=!0}}}}};
    Gq.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.$i(b),b=c.Jb(b),d=a.zg(),b!==d&&(d=a.Vi(),null!==b?null!==d?c.isTreePathToChildren?d.fromNode=b:d.toNode=b:Hq(this,b,a):null!==d&&Mj(c,d,!1)))}}};Gq.prototype.updateDataBindings=function(a,b){ti.prototype.updateDataBindings.call(this,a,b);"string"===typeof b&&null!==this.wc(a)&&(a=this.vc(a),null!==a&&a.Ba(b))};
    Gq.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.ja(a);if(void 0!==c){var d=Bq(b,c),e=this.wc(a);if(null!==d&&null!==e){for(d=d.iterator;d.next();){var f=d.value;b.sb(f)&&e instanceof W&&b.$i(f)===c&&Hq(this,e,this.Si(f))}Cq(b,c)}a=b.$i(a);void 0!==a&&e instanceof W&&(a=this.Jb(a),Hq(this,a,e))}};
    Gq.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof W){var c=b.ja(a.data),d=this.vc(a.data);if(null!==d){d.isSelected=!1;d.isHighlighted=!1;var e=d.layer;if(null!==e){var f=e.Fc(-1,d,!1);0<=f&&this.diagram.Ya(xe,"parts",e,d,null,f,null);f=d.layerChanged;null!==f&&f(d,e,null)}}d=this.diagram.isTreePathToChildren;for(a=a.linksConnected;a.next();)e=a.value,e=(d?e.toNode:e.fromNode).data,b.sb(e)&&Dq(b,c,e)}};
    Gq.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.He(e.data,b.ja(d.data)),e.Vi()):null};Gq.prototype.findLinkForKey=Gq.prototype.findLinkForKey;Gq.className="TreePartManager";
    function Z(a){this.Wt=',\n  "insertedNodeKeys": ';this.Lw=',\n  "modifiedNodeData": ';this.Yt=',\n  "removedNodeKeys": ';this.Ph=null;Ya(this);this.tn=this.Qa="";this.Xf=!1;this.l={};this.Cc=[];this.ab=new G;this.Ai="key";this.Ok=this.wl=null;this.kn=this.ln=!1;this.nn=!0;this.Sm=null;this.Gj="category";this.Pf=new G;this.Fu=new E;this.qg=!1;this.v=null;this.undoManager=new ze;void 0!==a&&(this.nodeDataArray=a)}
    Z.prototype.cloneProtected=function(a){a.Qa=this.Qa;a.tn=this.tn;a.Xf=this.Xf;a.Ai=this.Ai;a.wl=this.wl;a.Ok=this.Ok;a.ln=this.ln;a.kn=this.kn;a.nn=this.nn;a.Sm=this.Sm;a.Gj=this.Gj};Z.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};Z.prototype.clear=function(){this.Cc=[];this.ab.clear();this.Pf.clear();this.undoManager.clear()};
    Z.prototype.toString=function(a){void 0===a&&(a=0);if(1<a)return this.Mq();var b=(""!==this.name?this.name:"")+" Model";if(0<a){b+="\n node data:";a=this.nodeDataArray;for(var c=a.length,d=0;d<c;d++){var e=a[d];b+=" "+this.ja(e)+":"+Ja(e)}}return b};
    Z.prototype.BA=function(a){a.change!==ve&&B("Model.toIncrementalData argument is not a Transaction ChangedEvent:"+a.toString());var b=a.object;if(!(a.isTransactionFinished&&b instanceof ye))return null;Iq(this,b);a=this.zw(b,"FinishedUndo"===a.propertyName);this.Ph=null;return a};
    Z.prototype.zw=function(a,b){var c=this,d=!1,e=new F,f=new F,g=new F,h=this.Ph;a.changes.each(function(a){a.model===c&&("nodeDataArray"===a.modelChange?a.change===we?e.add(a.newValue):a.change===xe&&g.add(a.oldValue):c.sb(a.object)?f.add(a.object):a.change!==ue||c.modelData!==a.object&&"modelData"!==a.propertyName?null!==a.object&&(h&&h.contains(a.object)?h.get(a.object).each(function(a){c.sb(a)&&f.add(a)}):Jq(c,a.object).each(function(a){f.add(a)})):d=!0)});var k=new F;e.each(function(a){k.add(c.ja(a));
      b||f.add(a)});var l=new F;g.each(function(a){l.add(c.ja(a));b&&f.add(a)});a=c.cloneDeep(f.na());var m=null;d&&(null===m&&(m={}),m.modelData=this.cloneDeep(this.modelData));0<k.count&&(null===m&&(m={}),b?m.removedNodeKeys=k.na():m.insertedNodeKeys=k.na());0<a.length&&(null===m&&(m={}),m.modifiedNodeData=a);0<l.count&&(null===m&&(m={}),b?m.insertedNodeKeys=l.na():m.removedNodeKeys=l.na());return m};Z.prototype.cloneDeep=function(a){return Kq(this,a,!0)};
    function Kq(a,b,c,d,e,f){function g(a,c){h?(void 0===a.__gohashid&&f.push(a),d.set(a,c)):(a=pb++,d.set(a,c),e.set(a,b))}if(!za(b))return b;f||(f=[]);var h=Object.isExtensible(b);d||(d=new G);if(h){var k=d.get(b);if(k)return k}else for(e||(e=new G),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(Kq(a,b[m],!1,d,e,f))}else if(b instanceof I||b instanceof M||b instanceof N||b instanceof oc||b instanceof P)k=b.copy(),
      g(b,k);else{if(b instanceof vl||b instanceof sd||b instanceof D)return b;if(b instanceof E)k=(new E).addAll(Kq(a,b.na(),!1,d,e,f)),g(b,k);else if(b instanceof F)k=(new F).addAll(Kq(a,b.na(),!1,d,e,f)),g(b,k);else if(b instanceof G)k=(new G).addAll(Kq(a,b.na(),!1,d,e,f)),g(b,k);else if(b instanceof Date)k=new Date(b.getTime()),g(b,k);else if(b instanceof RegExp)k=new RegExp(b),g(b,k),k.lastIndex=b.lastIndex;else if("function"===typeof b.copy)k=b.copy(),g(b,k);else for(m in k={},g(b,k),b)"__gohashid"!==
    m&&(k[m]=Kq(a,b[m],!1,d,e,f))}c&&f.forEach(function(a){delete a.__gohashid});return k}t=Z.prototype;
    t.zk=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.Eq=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 Lq(a){return',\n  "modelData": '+Mq(a,a.modelData)}
    function Nq(a,b){b=b.modelData;za(b)&&(a.Bm(b),a.modelData=b)}t.Aw=function(){var a=this.modelData,b=!1,c;for(c in a)if(!Oq(c,a[c])){b=!0;break}a="";b&&(a=Lq(this));return a+',\n  "nodeDataArray": '+Pq(this,this.nodeDataArray,!0)};t.Wv=function(a){Nq(this,a);a=a.nodeDataArray;Aa(a)&&(this.Bm(a),this.nodeDataArray=a)};
    function Qq(a,b,c,d){if(b===c)return!0;if(typeof b!==typeof c||"function"===typeof b||"function"===typeof c)return!1;if(Array.isArray(b)&&Array.isArray(c)){if(d.H(b)===c)return!0;d.add(b,c);if(b.length!==c.length)return!1;for(var e=0;e<b.length;e++)if(!Qq(a,b[e],c[e],d))return!1;return!0}if(za(b)&&za(c)){if(d.H(b)===c)return!0;d.add(b,c);for(var f in b){var g=b[f];if(!Oq(f,g)){var h=c[f];if(void 0===h||!Qq(a,g,h,d))return!1}}for(e in c)if(f=c[e],!Oq(e,f)&&(g=b[e],void 0===g||!Qq(a,g,f,d)))return!1;
      return!0}return!1}function Rq(a,b,c){a[c]!==b[c]&&B("Model.computeJsonDifference: Model."+c+' is not the same in both models: "'+a[c]+'" and "'+b[c]+'"')}
    t.Rq=function(a){Rq(this,a,"nodeKeyProperty");for(var b=new F,c=new F,d=(new F).addAll(this.ab.iteratorKeys),e=new G,f=a.nodeDataArray,g=f.length,h=0;h<g;h++){var k=f[h],l=a.ja(k);if(void 0!==l){d.remove(l);var m=this.Ib(l);null===m?(b.add(l),c.add(k)):Qq(this,m,k,e)||c.add(k)}else this.At(k),l=this.ja(k),b.add(l),c.add(k)}f="";Qq(this,this.modelData,a.modelData,e)||(f+=Lq(this));0<b.count&&(f+=this.Wt+Pq(this,b.na(),!0));0<c.count&&(f+=this.Lw+Pq(this,c.na(),!0));0<d.count&&(f+=this.Yt+Pq(this,d.na(),
      !0));return f};t.Vy=function(a,b){void 0===b&&(b=Sq(this,this));return'{ "class": '+this.quote(b)+', "incremental": 1'+this.zk()+this.Rq(a)+"}"};function Iq(a,b){function c(a,b){b=b.part.data;if(a!==b){var c=d.get(a);null===c?(c=new F,c.add(b),d.add(a,c)):c.add(b)}}var d=a.Ph;null===d&&(d=new G,b.changes.each(function(a){if(null!==a.diagram){var b=a.change;if(b===ue)(a=a.object.panel)&&(b=a.data)&&c(b,a);else if(b===we||b===xe)a=a.object,(b=a.itemArray)&&c(b,a)}}),a.Ph=d)}
    function Jq(a,b){for(var c=new F,d=0;d<a.nodeDataArray.length;d++){var e=a.nodeDataArray[d];Tq(a,b,e,e,c)}return c}function Tq(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(Tq(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(Tq(a,b,g,d,e))return!0}return!1}
    t.yw=function(a,b){var c=this,d=!1,e=new F,f=new F,g=new F,h=this.Ph;a.changes.each(function(a){a.model===c&&("nodeDataArray"===a.modelChange?a.change===we?e.add(a.newValue):a.change===xe&&g.add(a.oldValue):c.sb(a.object)?f.add(a.object):a.change!==ue||c.modelData!==a.object&&"modelData"!==a.propertyName?null!==a.object&&(h&&h.contains(a.object)?h.get(a.object).each(function(a){c.sb(a)&&f.add(a)}):Jq(c,a.object).each(function(a){f.add(a)})):d=!0)});var k=new F;e.each(function(a){k.add(c.ja(a));b||
    f.add(a)});var l=new F;g.each(function(a){l.add(c.ja(a));b&&f.add(a)});a="";d&&(a+=Lq(this));0<k.count&&(a+=(b?this.Yt:this.Wt)+Pq(this,k.na(),!0));0<f.count&&(a+=this.Lw+Pq(this,f.na(),!0));0<l.count&&(a+=(b?this.Wt:this.Yt)+Pq(this,l.na(),!0));return a};
    t.Dq=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");Nq(this,a);var b=a.insertedNodeKeys,c=a.modifiedNodeData,d=new G;if(Array.isArray(c))for(var e=0;e<c.length;e++){var f=c[e],g=this.ja(f);void 0!==g&&null!==g&&d.set(g,f)}if(Array.isArray(b))for(e=b.length,f=0;f<e;f++){g=b[f];var h=this.Ib(g);null===h&&(h=(h=d.get(g))?h:this.copyNodeData({}),this.Hm(h,g),this.qf(h))}if(Array.isArray(c))for(b=c.length,d=0;d<b;d++)if(e=c[d],f=this.ja(e),f=this.Ib(f),null!==f)for(var k in e)"__gohashid"===k||k===
    this.nodeKeyProperty||this.ik()&&k===this.nodeIsGroupProperty||this.setDataProperty(f,k,e[k]);a=a.removedNodeKeys;if(Array.isArray(a))for(c=a.length,k=0;k<c;k++)b=this.Ib(a[k]),null!==b&&this.Am(b)};
    t.ty=function(a,b){a.change!==ve&&B("Model.toIncrementalJson argument is not a Transaction ChangedEvent:"+a.toString());var c=a.object;if(!(a.isTransactionFinished&&c instanceof ye))return'{ "incremental": 0 }';void 0===b&&(b=Sq(this,this));Iq(this,c);a=this.yw(c,"FinishedUndo"===a.propertyName);this.Ph=null;return"2"===b?'{ "incremental": 2'+a+"}":'{ "class": '+this.quote(b)+', "incremental": 1'+this.zk()+a+"}"};t.CA=function(a,b){return this.ty(a,b)};
    t.Mq=function(a){void 0===a&&(a=Sq(this,this));return'{ "class": '+this.quote(a)+this.zk()+this.Aw()+"}"};t.toJSON=function(a){return this.Mq(a)};t.yx=function(a){var b=null;if("string"===typeof a)try{b=x.JSON.parse(a)}catch(d){}else"object"===typeof a?b=a:B("Unable to modify a Model from: "+a);var c=b.incremental;"number"!==typeof c&&B("Unable to apply non-incremental changes to Model: "+a);0!==c&&(this.ua("applyIncrementalJson"),this.Dq(b),this.Ua("applyIncrementalJson"))};t.Py=function(a){return this.yx(a)};
    Z.constructGraphLinksModel=function(){return new Z};t=Z.prototype;
    t.Bm=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.Bm(d);Array.isArray(a)?a[e]=d:B("Cannot replace an object in an HTMLCollection or NodeList at "+e)}}else if(za(a)){for(c in a)if(e=a[c],za(e)&&(e=this.Bm(e),a[c]=e,"points"===c&&Array.isArray(e))){d=0===e.length%2;for(var f=0;f<e.length;f++)if("number"!==typeof e[f]){d=!1;break}if(d){d=new E;for(f=0;f<e.length/2;f++)d.add(new I(e[2*f],e[2*f+1]));d.freeze();a[c]=d}}if("object"===typeof a){c=a;e=a["class"]||
      "";0===e.indexOf("go.")&&(e=e.substr(3));if("NaN"===e)c=NaN;else if("Date"===e)c=new Date(a.value);else if("Point"===e)c=new I(Uq(a.x),Uq(a.y));else if("Size"===e)c=new M(Uq(a.width),Uq(a.height));else if("Rect"===e)c=new N(Uq(a.x),Uq(a.y),Uq(a.width),Uq(a.height));else if("Margin"===e)c=new oc(Uq(a.top),Uq(a.right),Uq(a.bottom),Uq(a.left));else if("Spot"===e)"string"===typeof a["enum"]?c=ld(a["enum"]):c=new P(Uq(a.x),Uq(a.y),Uq(a.offsetX),Uq(a.offsetY));else if("Brush"===e){if(c=new vl,c.type=Za(vl,
      a.type),"string"===typeof a.color&&(c.color=a.color),a.start instanceof P&&(c.start=a.start),a.end instanceof P&&(c.end=a.end),"number"===typeof a.startRadius&&(c.startRadius=Uq(a.startRadius)),"number"===typeof a.endRadius&&(c.endRadius=Uq(a.endRadius)),a=a.colorStops,za(a))for(b in a)c.addColorStop(parseFloat(b),a[b])}else"Geometry"===e?(b=null,"string"===typeof a.path?b=Id(a.path):b=new sd,b.type=Za(sd,a.type),"number"===typeof a.startX&&(b.startX=Uq(a.startX)),"number"===typeof a.startY&&(b.startY=
      Uq(a.startY)),"number"===typeof a.endX&&(b.endX=Uq(a.endX)),"number"===typeof a.endY&&(b.endY=Uq(a.endY)),a.spot1 instanceof P&&(b.spot1=a.spot1),a.spot2 instanceof P&&(b.spot2=a.spot2),c=b):"EnumValue"===e&&(b=a.classType,0===b.indexOf("go.")&&(b=b.substr(3)),b=Vq(b),"function"===typeof b&&(c=Za(b,a.name)));a=c}}return a};
    t.quote=function(a){for(var b="",c=a.length,d=0;d<c;d++){var e=a[d];if('"'===e||"\\"===e)b+="\\"+e;else if("\b"===e)b+="\\b";else if("\f"===e)b+="\\f";else if("\n"===e)b+="\\n";else if("\r"===e)b+="\\r";else if("\t"===e)b+="\\t";else{var f=a.charCodeAt(d);b=16>f?b+("\\u000"+a.charCodeAt(d).toString(16)):32>f?b+("\\u00"+a.charCodeAt(d).toString(16)):8232===f?b+"\\u2028":8233===f?b+"\\u2029":b+e}}return'"'+b+'"'};
    t.Lm=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.Lm(a.valueOf()):Aa(a)?Pq(this,a):za(a)?Mq(this,a):"function"===typeof a?"null":a.toString()};
    function Pq(a,b,c){void 0===c&&(c=!1);var d=b.length;if(0>=d)return"[]";var e=new cb;e.add("[ ");c&&1<d&&e.add("\n");for(var f=0;f<d;f++){var g=b[f];void 0!==g&&(0<f&&(e.add(","),c&&e.add("\n")),e.add(a.Lm(g)))}c&&1<d&&e.add("\n");e.add(" ]");return e.toString()}function Oq(a,b){return void 0===b||"__gohashid"===a||"_"===a[0]||"function"===typeof b?!0:!1}function Wq(a){return isNaN(a)?"NaN":Infinity===a?"9e9999":-Infinity===a?"-9e9999":a}
    function Mq(a,b){var c=b;if(c instanceof I)b={"class":"go.Point",x:Wq(c.x),y:Wq(c.y)};else if(c instanceof M)b={"class":"go.Size",width:Wq(c.width),height:Wq(c.height)};else if(c instanceof N)b={"class":"go.Rect",x:Wq(c.x),y:Wq(c.y),width:Wq(c.width),height:Wq(c.height)};else if(c instanceof oc)b={"class":"go.Margin",top:Wq(c.top),right:Wq(c.right),bottom:Wq(c.bottom),left:Wq(c.left)};else if(c instanceof P)c.eb()?b={"class":"go.Spot",x:Wq(c.x),y:Wq(c.y),offsetX:Wq(c.offsetX),offsetY:Wq(c.offsetY)}:
      b={"class":"go.Spot","enum":c.toString()};else if(c instanceof vl){b={"class":"go.Brush",type:c.type.name};if(c.type===yl)b.color=c.color;else if(c.type===Bl||c.type===wl)b.start=c.start,b.end=c.end,c.type===wl&&(0!==c.startRadius&&(b.startRadius=Wq(c.startRadius)),isNaN(c.endRadius)||(b.endRadius=Wq(c.endRadius)));if(null!==c.colorStops){var d={};for(c=c.colorStops.iterator;c.next();)d[c.key]=c.value;b.colorStops=d}}else c instanceof sd?(b={"class":"go.Geometry",type:c.type.name},0!==c.startX&&(b.startX=
      Wq(c.startX)),0!==c.startY&&(b.startY=Wq(c.startY)),0!==c.endX&&(b.endX=Wq(c.endX)),0!==c.endY&&(b.endY=Wq(c.endY)),c.spot1.w(vc)||(b.spot1=c.spot1),c.spot2.w(Gc)||(b.spot2=c.spot2),c.type===td&&(b.path=yd(c))):c instanceof D&&(b={"class":"go.EnumValue",classType:Sq(a,c.classType),name:c.name});d="{";c=!0;for(var e in b){var f=Bn(b,e);if(!Oq(e,f))if(c?c=!1:d+=", ",d+='"'+e+'":',"points"===e&&f instanceof E){var g="[";for(f=f.iterator;f.next();){var h=f.value;1<g.length&&(g+=",");g+=a.Lm(h.x);g+=",";
      g+=a.Lm(h.y)}g+="]";d+=g}else d+=a.Lm(f)}return d+"}"}function Uq(a){return"number"===typeof a?a:"NaN"===a?NaN:"9e9999"===a?Infinity:"-9e9999"===a?-Infinity:parseFloat(a)}t.Bh=function(a){this.Fu.add(a)};t.wk=function(a){this.Fu.remove(a)};t.ct=function(a){this.skipsUndoManager||this.undoManager.Fv(a);for(var b=this.Fu,c=b.length,d=0;d<c;d++)b.L(d)(a)};t.Ya=function(a,b,c,d,e,f,g){Xq(this,"",a,b,c,d,e,f,g)};t.g=function(a,b,c,d,e){Xq(this,"",ue,a,this,b,c,d,e)};
    t.Gt=function(a,b,c,d,e,f){Xq(this,"",ue,b,a,c,d,e,f)};function Xq(a,b,c,d,e,f,g,h,k){void 0===h&&(h=null);void 0===k&&(k=null);var l=new te;l.model=a;l.change=c;l.modelChange=b;l.propertyName=d;l.object=e;l.oldValue=f;l.oldParam=h;l.newValue=g;l.newParam=k;a.ct(l)}
    Z.prototype.changeState=function(a,b){if(null!==a&&a.model===this)if(a.change===ue)Tj(a.object,a.propertyName,a.H(b));else if(a.change===we){var c=a.newParam;if("nodeDataArray"===a.modelChange){if(a=a.newValue,za(a)&&"number"===typeof c){var d=this.ja(a);b?(this.Cc[c]===a&&Da(this.Cc,c),void 0!==d&&this.ab.remove(d)):(this.Cc[c]!==a&&Ca(this.Cc,c,a),void 0!==d&&this.ab.add(d,a))}}else""===a.modelChange?((d=a.object)&&!Aa(d)&&a.propertyName&&(d=Bn(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())}else a.change===xe?(c=a.oldParam,"nodeDataArray"===a.modelChange?(a=a.oldValue,za(a)&&"number"===typeof c&&(d=this.ja(a),b?(this.Cc[c]!==a&&Ca(this.Cc,c,a),void 0!==d&&this.ab.add(d,a)):(this.Cc[c]===a&&Da(this.Cc,c),void 0!==d&&this.ab.remove(d)))):""===a.modelChange?((d=a.object)&&!Aa(d)&&a.propertyName&&(d=Bn(a.object,a.propertyName)),Aa(d)&&"number"===typeof c&&(a=a.oldValue,b?Ca(d,c,a):Da(d,c))):B("unknown ChangedEvent.Remove modelChange: "+
      a.toString())):a.change!==ve&&B("unknown ChangedEvent: "+a.toString())};Z.prototype.ua=function(a){return this.undoManager.ua(a)};Z.prototype.Ua=function(a){return this.undoManager.Ua(a)};Z.prototype.Bf=function(){return this.undoManager.Bf()};Z.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.ua(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.Ua(b):this.undoManager.Bf(),this.skipsUndoManager=c}};t=Z.prototype;
    t.Ba=function(a,b){void 0===b&&(b="");Xq(this,"SourceChanged",ve,b,a,null,null)};t.ja=function(a){if(null!==a){var b=this.Ai;if(""!==b&&(b=Bn(a,b),void 0!==b)){if(yq(b))return b;B("Key value for node data "+a+" is not a number or a string: "+b)}}};
    t.Hm=function(a,b){if(null!==a){var c=this.Ai;if(""!==c)if(this.sb(a)){var d=Bn(a,c);d!==b&&null===this.Ib(b)&&(Tj(a,c,b),void 0!==d&&this.ab.remove(d),this.ab.add(b,a),Xq(this,"nodeKey",ue,c,a,d,b),"string"===typeof c&&this.Ba(a,c),this.Hq(d,b))}else Tj(a,c,b)}};function yq(a){return"number"===typeof a||"string"===typeof a}t.sb=function(a){var b=this.ja(a);return void 0===b?!1:this.ab.H(b)===a};
    t.Ib=function(a){null===a&&B("Model.findNodeDataForKey:key must not be null");return void 0!==a&&yq(a)?this.ab.H(a):null};t.At=function(a){if(null!==a){var b=this.Ai;if(""!==b){var c=this.ja(a);if(void 0===c||this.ab.contains(c)){var d=this.wl;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.ab.contains(c))){Tj(a,b,c);return}if("string"===typeof c){for(d=2;this.ab.contains(c+d);)d++;Tj(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.ab.count-1;this.ab.contains(c);)c--;Tj(a,b,c)}}}}};
    t.qf=function(a){null!==a&&(nb(a),this.sb(a)||qq(this,a,!0))};function qq(a,b,c){var d=a.ja(b);if(void 0===d||a.ab.H(d)!==b)a.At(b),d=a.ja(b),void 0===d?B("Model.makeNodeDataKeyUnique failed on "+b+".  Data not added to Model."):(a.ab.add(d,b),d=null,c&&(d=a.Cc.length,Ca(a.Cc,d,b)),Xq(a,"nodeDataArray",we,"nodeDataArray",a,null,b,null,d),a.Dm(b),a.Cm(b))}t.Ly=function(a){if(Aa(a))for(var b=a.length,c=0;c<b;c++)this.qf(a[c]);else for(a=a.iterator;a.next();)this.qf(a.value)};
    t.Am=function(a){null!==a&&pq(this,a,!0)};function pq(a,b,c){var d=a.ja(b);void 0!==d&&a.ab.remove(d);d=null;if(c){a:if(c=a.Cc,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.Cc,d)}Xq(a,"nodeDataArray",xe,"nodeDataArray",a,b,null,d,null);a.Oq(b)}t.rA=function(a){if(Aa(a))for(var b=a.length,c=0;c<b;c++)this.Am(a[c]);else for(a=a.iterator;a.next();)this.Am(a.value)};
    t.iA=function(a){if(Aa(a)){for(var b=new F(this.ab.iteratorKeys),c=new F,d=a.length,e=0;e<d;e++){var f=a[e],g=this.ja(f);if(void 0!==g){c.add(g);var h=this.Ib(g);null!==h?this.Xj(h,f):(h={},this.Hm(h,g),this.Xj(h,f),this.qf(h))}else this.qf(f),c.add(this.ja(f))}for(a=b.iterator;a.next();)b=a.value,c.contains(b)||(b=this.Ib(b))&&this.Am(b);this.gq()}};t.Hq=function(a,b){void 0!==b&&(a=Bq(this,a),a instanceof F&&this.Pf.add(b,a))};t.uw=function(){};t.Dm=function(){};t.Cm=function(){};t.Oq=function(){};
    function Dq(a,b,c){if(void 0!==b){var d=a.Pf.H(b);null===d&&(d=new F,a.Pf.add(b,d));d.add(c)}}function Cq(a,b,c){if(void 0!==b){var d=a.Pf.H(b);d instanceof F&&(void 0===c||null===c?a.Pf.remove(b):(d.remove(c),0===d.count&&a.Pf.remove(b)))}}function Bq(a,b){if(void 0===b)return null;a=a.Pf.H(b);return a instanceof F?a:null}t.gq=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.Ok;a=null!==b?b(a,this):Yq(this,a,!0);za(a)&&Ya(a);return a};
    function Yq(a,b,c){if(a.copiesArrays&&Array.isArray(b)){var d=[];for(c=0;c<b.length;c++){var e=Yq(a,b[c],a.copiesArrayObjects);d.push(e)}Ya(d);return d}if(c&&za(b)){c=(c=b.constructor)?new c:{};e=a.copiesKey||"string"!==typeof a.nodeKeyProperty?null:a.nodeKeyProperty;for(d in b)if("__gohashid"===d)c.__gohashid=void 0;else if(d===e)c[e]=void 0;else{var f=Bn(b,d),g=Sq(a,f);"GraphObject"===g||"Diagram"===g||"Layer"===g||"RowColumnDefinition"===g||"AnimationManager"===g||"Tool"===g||"CommandHandler"===
    g||"Layout"===g||"InputEvent"===g||"DiagramEvent"===g||f instanceof Z||f instanceof ze||f instanceof ye||f instanceof te?Tj(c,d,f):(f=Yq(a,f,!1),Tj(c,d,f))}Ya(c);return c}return b instanceof I?b.copy():b instanceof M?b.copy():b instanceof N?b.copy():b instanceof P?b.copy():b instanceof oc?b.copy():b}
    Z.prototype.setDataProperty=function(a,b,c){if(this.sb(a))if(b===this.nodeKeyProperty)this.Hm(a,c);else{if(b===this.nodeCategoryProperty){this.Jq(a,c);return}}else!Zq&&a instanceof Y&&(Zq=!0,wa('Model.setDataProperty is modifying a GraphObject, "'+a.toString()+'"'),wa("  Is that really your intent?"));var d=Bn(a,b);d!==c&&(Tj(a,b,c),this.Gt(a,b,d,c))};t=Z.prototype;t.set=function(a,b,c){this.setDataProperty(a,b,c)};
    t.Xj=function(a,b){if(b){var c=this.sb(a),d;for(d in b)"__gohashid"===d||c&&d===this.nodeKeyProperty||this.setDataProperty(a,d,b[d])}};t.Hy=function(a,b){this.rt(a,-1,b)};t.rt=function(a,b,c){0>b&&(b=a.length);Ca(a,b,c);Xq(this,"",we,"",a,null,c,null,b)};t.Yv=function(a,b){void 0===b&&(b=-1);a===this.Cc&&B("Model.removeArrayItem should not be called on the Model.nodeDataArray");-1===b&&(b=a.length-1);var c=a[b];Da(a,b);Xq(this,"",xe,"",a,c,null,b,null)};
    t.ot=function(a){if(null===a)return"";var b=this.Gj;if(""===b)return"";b=Bn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;B("getCategoryForNodeData found a non-string category for "+a+": "+b);return""};t.Jq=function(a,b){if(null!==a){var c=this.Gj;if(""!==c)if(this.sb(a)){var d=Bn(a,c);void 0===d&&(d="");d!==b&&(Tj(a,c,b),Xq(this,"nodeCategory",ue,c,a,d,b))}else Tj(a,c,b)}};t.qm=function(){return!1};t.ik=function(){return!1};t.pm=function(){return!1};t.wt=function(){return!1};t.jk=function(){return!1};
    function Di(){return new Z}function Sq(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 Sq(a,b.constructor);return typeof b}function Vq(a){return $q[a]?$q[a]:void 0!==x.go&&x.go[a]?x.go[a]:null}function Bn(a,b){if(!a||!b)return null;try{if("function"===typeof b)var c=b(a);else"function"===typeof a.getAttribute?(c=a.getAttribute(b),null===c&&(c=void 0)):c=a[b]}catch(d){}return c}
    function Tj(a,b,c){if(a&&b)try{"function"===typeof b?b(a,c):"function"===typeof a.setAttribute?a.setAttribute(b,c):a[b]=c}catch(d){}}
    ma.Object.defineProperties(Z.prototype,{name:{get:function(){return this.Qa},set:function(a){var b=this.Qa;b!==a&&(this.Qa=a,this.g("name",b,a))}},dataFormat:{get:function(){return this.tn},set:function(a){var b=this.tn;b!==a&&(this.tn=a,this.g("dataFormat",b,a))}},isReadOnly:{get:function(){return this.Xf},set:function(a){var b=this.Xf;b!==a&&(this.Xf=a,this.g("isReadOnly",b,a))}},modelData:{
        get:function(){return this.l},set:function(a){var b=this.l;b!==a&&(this.l=a,this.g("modelData",b,a),this.Ba(a))}},undoManager:{get:function(){return this.v},set:function(a){var b=this.v;b!==a&&(null!==b&&b.gy(this),this.v=a,null!==a&&a.wx(this))}},skipsUndoManager:{get:function(){return this.qg},set:function(a){this.qg=a}},nodeKeyProperty:{get:function(){return this.Ai},set:function(a){var b=this.Ai;
          b!==a&&(""===a&&B("Model.nodeKeyProperty may not be the empty string"),0<this.ab.count&&B("Cannot set Model.nodeKeyProperty when there is existing node data"),this.Ai=a,this.g("nodeKeyProperty",b,a))}},makeUniqueKeyFunction:{get:function(){return this.wl},set:function(a){var b=this.wl;b!==a&&(this.wl=a,this.g("makeUniqueKeyFunction",b,a))}},nodeDataArray:{get:function(){return this.Cc},set:function(a){var b=this.Cc;if(b!==a){this.ab.clear();
          this.uw();for(var c=a.length,d=0;d<c;d++){var e=a[d];if(!za(e)){B("Model.nodeDataArray must only contain Objects, not: "+e);return}nb(e)}this.Cc=a;d=new E;for(e=0;e<c;e++){var f=a[e],g=this.ja(f);void 0===g?d.add(f):null!==this.ab.H(g)?d.add(f):this.ab.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.At(e),f=this.ja(e),void 0!==f&&this.ab.add(f,e);Xq(this,"nodeDataArray",ue,"nodeDataArray",this,b,a);for(b=0;b<c;b++)d=a[b],this.Dm(d),this.Cm(d);this.gq();Array.isArray(a)||(this.isReadOnly=!0)}}},
      copyNodeDataFunction:{get:function(){return this.Ok},set:function(a){var b=this.Ok;b!==a&&(this.Ok=a,this.g("copyNodeDataFunction",b,a))}},copiesArrays:{get:function(){return this.ln},set:function(a){var b=this.ln;b!==a&&(this.ln=a,this.g("copiesArrays",b,a))}},copiesArrayObjects:{get:function(){return this.kn},set:function(a){var b=this.kn;b!==a&&(this.kn=a,this.g("copiesArrayObjects",b,a))}},copiesKey:{
        get:function(){return this.nn},set:function(a){var b=this.nn;b!==a&&(this.nn=a,this.g("copiesKey",b,a))}},afterCopyFunction:{get:function(){return this.Sm},set:function(a){var b=this.Sm;b!==a&&(this.Sm=a,this.g("afterCopyFunction",b,a))}},nodeCategoryProperty:{get:function(){return this.Gj},set:function(a){var b=this.Gj;b!==a&&(this.Gj=a,this.g("nodeCategoryProperty",b,a))}}});
    ma.Object.defineProperties(Z,{type:{get:function(){return"Model"}}});Z.prototype.setCategoryForNodeData=Z.prototype.Jq;Z.prototype.getCategoryForNodeData=Z.prototype.ot;Z.prototype.removeArrayItem=Z.prototype.Yv;Z.prototype.insertArrayItem=Z.prototype.rt;Z.prototype.addArrayItem=Z.prototype.Hy;Z.prototype.assignAllDataProperties=Z.prototype.Xj;Z.prototype.set=Z.prototype.set;Z.prototype.clearUnresolvedReferences=Z.prototype.gq;Z.prototype.mergeNodeDataArray=Z.prototype.iA;
    Z.prototype.removeNodeDataCollection=Z.prototype.rA;Z.prototype.removeNodeData=Z.prototype.Am;Z.prototype.addNodeDataCollection=Z.prototype.Ly;Z.prototype.addNodeData=Z.prototype.qf;Z.prototype.makeNodeDataKeyUnique=Z.prototype.At;Z.prototype.findNodeDataForKey=Z.prototype.Ib;Z.prototype.containsNodeData=Z.prototype.sb;Z.prototype.setKeyForNodeData=Z.prototype.Hm;Z.prototype.getKeyForNodeData=Z.prototype.ja;Z.prototype.updateTargetBindings=Z.prototype.Ba;Z.prototype.commit=Z.prototype.commit;
    Z.prototype.rollbackTransaction=Z.prototype.Bf;Z.prototype.commitTransaction=Z.prototype.Ua;Z.prototype.startTransaction=Z.prototype.ua;Z.prototype.raiseDataChanged=Z.prototype.Gt;Z.prototype.raiseChanged=Z.prototype.g;Z.prototype.raiseChangedEvent=Z.prototype.Ya;Z.prototype.removeChangedListener=Z.prototype.wk;Z.prototype.addChangedListener=Z.prototype.Bh;Z.prototype.writeJsonValue=Z.prototype.Lm;Z.prototype.replaceJsonObjects=Z.prototype.Bm;Z.prototype.applyIncrementalJSON=Z.prototype.Py;
    Z.prototype.applyIncrementalJson=Z.prototype.yx;Z.prototype.toJSON=Z.prototype.toJSON;Z.prototype.toJson=Z.prototype.Mq;Z.prototype.toIncrementalJSON=Z.prototype.CA;Z.prototype.toIncrementalJson=Z.prototype.ty;Z.prototype.computeJsonDifference=Z.prototype.Vy;Z.prototype.toIncrementalData=Z.prototype.BA;Z.prototype.clear=Z.prototype.clear;var Zq=!1,$q={};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=Vq(d)):(e=Vq(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.Eq(c);b.Wv(c);return b};Z.safePropertyValue=Bn;Z.safePropertySet=Tj;$q.Brush=vl;$q.ChangedEvent=te;$q.Geometry=sd;$q.Margin=oc;$q.Panel=X;$q.Point=I;$q.Rect=N;$q.Size=M;$q.Spot=P;$q.Transaction=ye;$q.UndoManager=ze;function Mi(a,b,c){Ya(this);this.s=!1;void 0===a&&(a="");void 0===b&&(b=a);void 0===c&&(c=null);this.l=-1;this.bd=null;this.Wl=a;this.Vl=this.Qp=0;this.Ns=null;this.eo=!1;this.Ol=b;this.jn=c;this.Eo=ar;this.cn=null;this.qu=new F}
    Mi.prototype.copy=function(){var a=new Mi;a.Wl=this.Wl;a.Qp=this.Qp;a.Vl=this.Vl;a.Ns=this.Ns;a.eo=this.eo;a.Ol=this.Ol;a.jn=this.jn;a.Eo=this.Eo;a.cn=this.cn;return a};t=Mi.prototype;t.cb=function(a){a.classType===Mi&&(this.mode=a)};t.toString=function(){return"Binding("+this.targetProperty+":"+this.sourceProperty+(-1!==this.gj?" "+this.gj:"")+" "+this.mode.name+")"};t.freeze=function(){this.s=!0;return this};t.ea=function(){this.s=!1;return this};
    t.Xx=function(a){void 0===a&&(a=null);this.mode=ln;this.backConverter=a;return this};t.Aq=function(a){void 0===a&&(a="");this.sourceName=a;this.isToModel=!1;return this};t.kA=function(){this.sourceName=null;this.isToModel=!0;return this};function il(a,b,c){a=a.sourceName;return null===a||""===a?b:"/"===a?c.part:"."===a?c:".."===a?c.panel:b.Xa(a)}
    t.vw=function(a,b,c){var d=this.Ol;if(void 0===c||""===d||d===c){c=this.Wl;var e=this.jn;if(null===e&&""===c)wa("Binding error: target property is the empty string: "+this.toString());else{var f=b;""!==d&&(f=Bn(b,d));if(void 0!==f)if(null===e)""!==c&&Tj(a,c,f);else try{if(""!==c){var g=e(f,a);Tj(a,c,g)}else e(f,a)}catch(h){}}}};
    t.Qq=function(a,b,c,d){if(this.Eo===ln){var e=this.Wl;if(void 0===c||e===c){c=this.Ol;var f=this.cn,g=a;""!==e&&(g=Bn(a,e));if(void 0!==g&&!this.qu.contains(a))try{this.qu.add(a);var h=null!==d?d.diagram:null,k=null!==h?h.model:null;if(null===f)if(""!==c)null!==k?k.setDataProperty(b,c,g):Tj(b,c,g);else{if(null!==k&&null!==d&&0<=d.itemIndex&&null!==d.panel&&Array.isArray(d.panel.itemArray)){var l=d.itemIndex,m=d.panel.itemArray;k.Yv(m,l);k.rt(m,l,g)}}else try{if(""!==c){var n=f(g,b,k);null!==k?k.setDataProperty(b,
      c,n):Tj(b,c,n)}else{var p=f(g,b,k);if(void 0!==p&&null!==k&&null!==d&&0<=d.itemIndex&&null!==d.panel&&Array.isArray(d.panel.itemArray)){var r=d.itemIndex,q=d.panel.itemArray;k.Yv(q,r);k.rt(q,r,p)}}}catch(u){}}finally{this.qu.remove(a)}}}};
    ma.Object.defineProperties(Mi.prototype,{gj:{get:function(){return this.l},set:function(a){this.s&&ua(this);this.l=a}},targetProperty:{get:function(){return this.Wl},set:function(a){this.s&&ua(this);this.Wl=a}},sourceName:{get:function(){return this.Ns},set:function(a){this.s&&ua(this);this.Ns=a;null!==a&&(this.eo=!1)}},isToModel:{get:function(){return this.eo},set:function(a){this.s&&
        ua(this);this.eo=a}},sourceProperty:{get:function(){return this.Ol},set:function(a){this.s&&ua(this);this.Ol=a}},converter:{get:function(){return this.jn},set:function(a){this.s&&ua(this);this.jn=a}},backConverter:{get:function(){return this.cn},set:function(a){this.s&&ua(this);this.cn=a}},mode:{get:function(){return this.Eo},set:function(a){this.s&&ua(this);this.Eo=a}}});
    Mi.prototype.updateSource=Mi.prototype.Qq;Mi.prototype.updateTarget=Mi.prototype.vw;Mi.prototype.ofModel=Mi.prototype.kA;Mi.prototype.ofObject=Mi.prototype.Aq;Mi.prototype.makeTwoWay=Mi.prototype.Xx;var ar=new D(Mi,"OneWay",1),ln=new D(Mi,"TwoWay",2);Mi.className="Binding";Mi.parseEnum=function(a,b){return function(c){c=Za(a,c);return null===c?b:c}};Mi.toString=Ja;Mi.OneWay=ar;Mi.TwoWay=ln;
    function br(a,b){Z.call(this);this.Vt=',\n  "insertedLinkKeys": ';this.Kw=',\n  "modifiedLinkData": ';this.Xt=',\n  "removedLinkKeys": ';this.Oc=[];this.Yf=new F;this.ob=new G;this.wi="";this.ij=this.Nk=this.xl=null;this.We="from";this.Xe="to";this.Dj=this.Cj="";this.Bj="category";this.Md="";this.Bl="isGroup";this.se="group";this.mn=!1;void 0!==a&&(this.nodeDataArray=a);void 0!==b&&(this.linkDataArray=b)}la(br,Z);br.constructGraphLinksModel=Z.constructGraphLinksModel;
    br.prototype.cloneProtected=function(a){Z.prototype.cloneProtected.call(this,a);a.wi=this.wi;a.xl=this.xl;a.Nk=this.Nk;a.We=this.We;a.Xe=this.Xe;a.Cj=this.Cj;a.Dj=this.Dj;a.Bj=this.Bj;a.Md=this.Md;a.Bl=this.Bl;a.se=this.se;a.mn=this.mn};t=br.prototype;t.clear=function(){Z.prototype.clear.call(this);this.Oc=[];this.ob.clear();this.Yf.clear()};
    t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.Mq();var b=(""!==this.name?this.name:"")+" GraphLinksModel";if(0<a){b+="\n node data:";a=this.nodeDataArray;var c=a.length,d;for(d=0;d<c;d++){var e=a[d];b+=" "+this.ja(e)+":"+Ja(e)}b+="\n link data:";a=this.linkDataArray;c=a.length;for(d=0;d<c;d++)e=a[d],b+=" "+wq(this,e,!0)+"--\x3e"+wq(this,e,!1)}return b};
    t.zw=function(a,b){""===this.linkKeyProperty&&B("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalData() to succeed.");var c=Z.prototype.zw.call(this,a,b),d=this,e=new F,f=new F,g=new F,h=this.Ph;a.changes.each(function(a){a.model===d&&("linkDataArray"===a.modelChange?a.change===we?e.add(a.newValue):a.change===xe&&g.add(a.oldValue):d.cd(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.cd(a)&&f.add(a)}):
      cr(d,a.object).each(function(a){f.add(a)})))});var k=new F;e.each(function(a){k.add(d.Vb(a));b||f.add(a)});var l=new F;g.each(function(a){l.add(d.Vb(a));b&&f.add(a)});a=d.cloneDeep(f.na());0<k.count&&(null===c&&(c={}),b?c.removedLinkKeys=k.na():c.insertedLinkKeys=k.na());0<a.length&&(null===c&&(c={}),c.modifiedLinkData=a);0<l.count&&(null===c&&(c={}),b?c.insertedLinkKeys=l.na():c.removedLinkKeys=l.na());return c};
    t.zk=function(){var a=Z.prototype.zk.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.Eq=function(a){Z.prototype.Eq.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.Aw=function(){var a=Z.prototype.Aw.call(this),b=',\n  "linkDataArray": '+Pq(this,this.linkDataArray,!0);return a+b};t.Wv=function(a){Z.prototype.Wv.call(this,a);a=a.linkDataArray;Array.isArray(a)&&(this.Bm(a),this.linkDataArray=a)};
    t.Rq=function(a){if(!(a instanceof br))return B("Model.computeJsonDifference: newmodel must be a GraphLinksModel"),"";""===this.linkKeyProperty&&B("GraphLinksModel.linkKeyProperty must not be an empty string for .computeJsonDifference() to succeed.");var b=Z.prototype.Rq.call(this,a);Rq(this,a,"linkKeyProperty");Rq(this,a,"linkFromKeyProperty");Rq(this,a,"linkToKeyProperty");Rq(this,a,"linkLabelKeysProperty");Rq(this,a,"nodeIsGroupProperty");Rq(this,a,"nodeGroupKeyProperty");for(var c=new F,d=new F,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          e=(new F).addAll(this.ob.iteratorKeys),f=new G,g=a.linkDataArray,h=g.length,k=0;k<h;k++){var l=g[k],m=a.Vb(l);if(void 0!==m){e.remove(m);var n=this.xg(m);null===n?(c.add(m),d.add(l)):Qq(this,n,l,f)||d.add(l)}else this.xq(l),m=this.Vb(l),c.add(m),d.add(l)}a=b;0<c.count&&(a+=this.Vt+Pq(this,c.na(),!0));0<d.count&&(a+=this.Kw+Pq(this,d.na(),!0));0<e.count&&(a+=this.Xt+Pq(this,e.na(),!0));return a};
    function cr(a,b){for(var c=new F,d=0;d<a.linkDataArray.length;d++){var e=a.linkDataArray[d];Tq(a,b,e,e,c)}return c}
    t.yw=function(a,b){""===this.linkKeyProperty&&B("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalJson() to succeed.");var c=Z.prototype.yw.call(this,a,b),d=this,e=new F,f=new F,g=new F,h=this.Ph;a.changes.each(function(a){a.model===d&&("linkDataArray"===a.modelChange?a.change===we?e.add(a.newValue):a.change===xe&&g.add(a.oldValue):d.cd(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.cd(a)&&f.add(a)}):
      cr(d,a.object).each(function(a){f.add(a)})))});var k=new F;e.each(function(a){k.add(d.Vb(a));b||f.add(a)});var l=new F;g.each(function(a){l.add(d.Vb(a));b&&f.add(a)});a=c;0<k.count&&(a+=(b?this.Xt:this.Vt)+Pq(this,k.na(),!0));0<f.count&&(a+=this.Kw+Pq(this,f.na(),!0));0<l.count&&(a+=(b?this.Vt:this.Xt)+Pq(this,l.na(),!0));return a};
    t.Dq=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.Dq.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.xg(e);null===f&&(f=this.hq({}),this.Ot(f,e),this.Ni(f))}b=a.modifiedLinkData;
      if(Array.isArray(b))for(c=b.length,d=0;d<c;d++)if(e=b[d],f=this.Vb(e),f=this.xg(f),null!==f)for(var g in e)"__gohashid"!==g&&g!==this.linkKeyProperty&&this.setDataProperty(f,g,e[g]);a=a.removedLinkKeys;if(Array.isArray(a))for(g=a.length,b=0;b<g;b++)c=this.xg(a[b]),null!==c&&this.zm(c)};
    br.prototype.changeState=function(a,b){if(a.change===we){var c=a.newParam;if("linkDataArray"===a.modelChange){a=a.newValue;if(za(a)&&"number"===typeof c){var d=this.Vb(a);b?(this.Yf.remove(a),this.Oc[c]===a&&this.Oc.splice(c,1),void 0!==d&&this.ob.remove(d)):(this.Yf.add(a),this.Oc[c]!==a&&this.Oc.splice(c,0,a),void 0!==d&&this.ob.add(d,a))}return}if("linkLabelKeys"===a.modelChange){d=this.Ag(a.object);Array.isArray(d)&&"number"===typeof c&&(b?(c=d.indexOf(a.newValue),0<=c&&d.splice(c,1)):0>d.indexOf(a.newValue)&&
      d.splice(c,0,a.newValue));return}}else if(a.change===xe){c=a.oldParam;if("linkDataArray"===a.modelChange){a=a.oldValue;za(a)&&"number"===typeof c&&(d=this.Vb(a),b?(this.Yf.add(a),this.Oc[c]!==a&&this.Oc.splice(c,0,a),void 0!==d&&this.ob.add(d,a)):(this.Yf.remove(a),this.Oc[c]===a&&this.Oc.splice(c,1),void 0!==d&&this.ob.remove(d)));return}if("linkLabelKeys"===a.modelChange){d=this.Ag(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=br.prototype;t.rm=function(a){if(void 0!==a){var b=this.ij;if(null!==b){var c=this.Ib(a);null===c&&(c=this.copyNodeData(b),Tj(c,this.nodeKeyProperty,a),this.qf(c))}return a}};t.Ez=function(a){return wq(this,a,!0)};t.ky=function(a,b){Eq(this,a,b,!0)};t.Kz=function(a){return wq(this,a,!1)};t.oy=function(a,b){Eq(this,a,b,!1)};
    function wq(a,b,c){if(null!==b&&(a=c?a.We:a.Xe,""!==a&&(a=Bn(b,a),void 0!==a))){if(yq(a))return a;B((c?"FromKey":"ToKey")+" value for link data "+b+" is not a number or a string: "+a)}}function Eq(a,b,c,d){null===c&&(c=void 0);if(null!==b){var e=d?a.We:a.Xe;if(""!==e)if(c=a.rm(c),a.cd(b)){var f=Bn(b,e);f!==c&&(Cq(a,f,b),Tj(b,e,c),null===a.Ib(c)&&Dq(a,c,b),Xq(a,d?"linkFromKey":"linkToKey",ue,e,b,f,c),"string"===typeof e&&a.Ba(b,e))}else Tj(b,e,c)}}t.Fz=function(a){return vq(this,a,!0)};
    t.ly=function(a,b){Fq(this,a,b,!0)};t.Lz=function(a){return vq(this,a,!1)};t.py=function(a,b){Fq(this,a,b,!1)};function vq(a,b,c){if(null===b)return"";a=c?a.Cj:a.Dj;if(""===a)return"";b=Bn(b,a);return void 0===b?"":b}function Fq(a,b,c,d){if(null!==b){var e=d?a.Cj:a.Dj;if(""!==e)if(a.cd(b)){var f=Bn(b,e);void 0===f&&(f="");f!==c&&(Tj(b,e,c),Xq(a,d?"linkFromPortId":"linkToPortId",ue,e,b,f,c),"string"===typeof e&&a.Ba(b,e))}else Tj(b,e,c)}}
    t.Ag=function(a){if(null===a)return dr;var b=this.Md;if(""===b)return dr;a=Bn(a,b);return void 0===a?dr:a};t.gw=function(a,b){if(null!==a){var c=this.Md;if(""!==c)if(this.cd(a)){var d=Bn(a,c);void 0===d&&(d=dr);if(d!==b){if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)Cq(this,d[f],a);Tj(a,c,b);e=b.length;for(f=0;f<e;f++){var g=b[f];null===this.Ib(g)&&Dq(this,g,a)}Xq(this,"linkLabelKeys",ue,c,a,d,b);"string"===typeof c&&this.Ba(a,c)}}else Tj(a,c,b)}};
    t.gv=function(a,b){if(null!==b&&void 0!==b&&null!==a){var c=this.Md;if(""!==c){var d=Bn(a,c);if(void 0===d)c=[],c.push(b),this.gw(a,c);else if(Array.isArray(d)){var e=d.indexOf(b);0<=e||(e=d.length,d.push(b),this.cd(a)&&(null===this.Ib(b)&&Dq(this,b,a),Xq(this,"linkLabelKeys",we,c,a,null,b,null,e)))}else B(c+" property is not an Array; cannot addLabelKeyForLinkData: "+a)}}};
    t.ey=function(a,b){if(null!==b&&void 0!==b&&null!==a){var c=this.Md;if(""!==c){var d=Bn(a,c);if(Array.isArray(d)){var e=d.indexOf(b);0>e||(d.splice(e,1),this.cd(a)&&(Cq(this,b,a),Xq(this,"linkLabelKeys",xe,c,a,b,null,e,null)))}else void 0!==d&&B(c+" property is not an Array; cannot removeLabelKeyforLinkData: "+a)}}};t.Vb=function(a){if(null!==a){var b=this.wi;if(""!==b&&(b=Bn(a,b),void 0!==b)){if(yq(b))return b;B("Key value for link data "+a+" is not a number or a string: "+b)}}};
    t.Ot=function(a,b){if(null!==a){var c=this.wi;if(""!==c)if(this.cd(a)){var d=Bn(a,c);d!==b&&null===this.xg(b)&&(Tj(a,c,b),void 0!==d&&this.ob.remove(d),this.ob.add(b,a),Xq(this,"linkKey",ue,c,a,d,b),"string"===typeof c&&this.Ba(a,c))}else Tj(a,c,b)}};t.xg=function(a){null===a&&B("GraphLinksModel.findLinkDataForKey:key must not be null");return void 0!==a&&yq(a)?this.ob.H(a):null};
    t.xq=function(a){if(null!==a){var b=this.wi;if(""!==b){var c=this.Vb(a);if(void 0===c||this.ob.contains(c)){var d=this.xl;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.ob.contains(c))){Tj(a,b,c);return}if("string"===typeof c){for(d=2;this.ob.contains(c+d);)d++;Tj(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.ob.count-1;this.ob.contains(c);)c--;Tj(a,b,c)}}}}};t.cd=function(a){return null===a?!1:this.Yf.contains(a)};t.Ni=function(a){null!==a&&(nb(a),this.cd(a)||Aq(this,a,!0))};
    function Aq(a,b,c){if(""!==a.linkKeyProperty){var d=a.Vb(b);if(void 0!==d&&a.ob.H(d)===b)return;a.xq(b);d=a.Vb(b);if(void 0===d){B("GraphLinksModel.makeLinkDataKeyUnique failed on "+b+". Data not added to model.");return}a.ob.add(d,b)}a.Yf.add(b);d=null;c&&(d=a.Oc.length,a.Oc.splice(d,0,b));Xq(a,"linkDataArray",we,"linkDataArray",a,null,b,null,d);er(a,b)}t.Ky=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.Ni(a[c]);else for(a=a.iterator;a.next();)this.Ni(a.value)};
    t.zm=function(a){null!==a&&zq(this,a,!0)};function zq(a,b,c){a.Yf.remove(b);var d=a.Vb(b);void 0!==d&&a.ob.remove(d);d=null;if(c){d=a.Oc.indexOf(b);if(0>d)return;a.Oc.splice(d,1)}Xq(a,"linkDataArray",xe,"linkDataArray",a,b,null,d,null);c=wq(a,b,!0);Cq(a,c,b);c=wq(a,b,!1);Cq(a,c,b);d=a.Ag(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],Cq(a,c,b)}t.pA=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.zm(a[c]);else for(a=a.iterator;a.next();)this.zm(a.value)};
    t.hA=function(a){""===this.linkKeyProperty&&B("GraphLinksModel.linkKeyProperty must not be an empty string for .mergeLinkDataArray() to succeed.");if(Aa(a)){for(var b=new F(this.ob.iteratorKeys),c=new F,d=a.length,e=0;e<d;e++){var f=a[e],g=this.Vb(f);if(void 0!==g){c.add(g);var h=this.xg(g);null!==h?this.Xj(h,f):(h={},this.Ot(h,g),this.Xj(h,f),this.Ni(h))}else this.Ni(f),c.add(this.Vb(f))}for(a=b.iterator;a.next();)b=a.value,c.contains(b)||(b=this.xg(b))&&this.zm(b);this.gq()}};
    function er(a,b){var c=wq(a,b,!0);c=a.rm(c);null===a.Ib(c)&&Dq(a,c,b);c=wq(a,b,!1);c=a.rm(c);null===a.Ib(c)&&Dq(a,c,b);var d=a.Ag(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],null===a.Ib(c)&&Dq(a,c,b)}t.hq=function(a){if(null===a)return null;var b=this.Nk;a=null!==b?b(a,this):Yq(this,a,!0);za(a)&&(Ya(a),""!==this.We&&Tj(a,this.We,void 0),""!==this.Xe&&Tj(a,this.Xe,void 0),""!==this.Md&&Tj(a,this.Md,[]));return a};
    t.Kv=function(a){if(null===a)return!1;var b=this.Bl;return""===b?!1:Bn(a,b)?!0:!1};t.Yi=function(a){if(null!==a){var b=this.se;if(""!==b&&(b=Bn(a,b),void 0!==b)){if(yq(b))return b;B("GroupKey value for node data "+a+" is not a number or a string: "+b)}}};
    t.Nt=function(a,b){null===b&&(b=void 0);if(null!==a){var c=this.se;if(""!==c)if(this.sb(a)){var d=Bn(a,c);d!==b&&(Cq(this,d,a),Tj(a,c,b),null===this.Ib(b)&&Dq(this,b,a),Xq(this,"nodeGroupKey",ue,c,a,d,b),"string"===typeof c&&this.Ba(a,c))}else Tj(a,c,b)}};br.prototype.copyNodeData=function(a){if(null===a)return null;a=Z.prototype.copyNodeData.call(this,a);this.ak||""===this.se||void 0===Bn(a,this.se)||Tj(a,this.se,void 0);return a};
    br.prototype.setDataProperty=function(a,b,c){if(this.sb(a))if(b===this.nodeKeyProperty)this.Hm(a,c);else{if(b===this.nodeCategoryProperty){this.Jq(a,c);return}if(b===this.nodeGroupKeyProperty){this.Nt(a,c);return}}else if(this.cd(a)){if(b===this.linkFromKeyProperty){Eq(this,a,c,!0);return}if(b===this.linkToKeyProperty){Eq(this,a,c,!1);return}if(b===this.linkFromPortIdProperty){Fq(this,a,c,!0);return}if(b===this.linkToPortIdProperty){Fq(this,a,c,!1);return}if(b===this.linkKeyProperty){this.Ot(a,c);
      return}if(b===this.linkCategoryProperty){this.Mt(a,c);return}if(b===this.linkLabelKeysProperty){this.gw(a,c);return}}var d=Bn(a,b);d!==c&&(Tj(a,b,c),this.Gt(a,b,d,c))};t=br.prototype;t.Xj=function(a,b){if(b){var c=this.sb(a),d=this.cd(a),e;for(e in b)"__gohashid"===e||c&&e===this.nodeKeyProperty||c&&e===this.nodeIsGroupProperty&&Bn(a,e)===b[e]||d&&e===this.linkKeyProperty||this.setDataProperty(a,e,b[e])}};
    t.Hq=function(a,b){Z.prototype.Hq.call(this,a,b);for(var c=this.ab.iterator;c.next();)this.bw(c.value,a,b);for(c=this.Yf.iterator;c.next();){var d=c.value,e=a,f=b;if(wq(this,d,!0)===e){var g=this.We;Tj(d,g,f);Xq(this,"linkFromKey",ue,g,d,e,f);"string"===typeof g&&this.Ba(d,g)}wq(this,d,!1)===e&&(g=this.Xe,Tj(d,g,f),Xq(this,"linkToKey",ue,g,d,e,f),"string"===typeof g&&this.Ba(d,g));g=this.Ag(d);if(Array.isArray(g))for(var h=g.length,k=this.Md,l=0;l<h;l++)g[l]===e&&(g[l]=f,Xq(this,"linkLabelKeys",we,
      k,d,e,f,l,l))}};t.bw=function(a,b,c){if(this.Yi(a)===b){var d=this.se;Tj(a,d,c);Xq(this,"nodeGroupKey",ue,d,a,b,c);"string"===typeof d&&this.Ba(a,d)}};t.uw=function(){Z.prototype.uw.call(this);for(var a=this.linkDataArray,b=a.length,c=0;c<b;c++)er(this,a[c])};
    t.Dm=function(a){Z.prototype.Dm.call(this,a);a=this.ja(a);var b=Bq(this,a);if(null!==b){var c=Fa();for(b=b.iterator;b.next();){var d=b.value;if(this.sb(d)){if(this.Yi(d)===a){var e=this.se;Xq(this,"nodeGroupKey",ue,e,d,a,a);"string"===typeof e&&this.Ba(d,e);c.push(d)}}else if(wq(this,d,!0)===a&&(e=this.We,Xq(this,"linkFromKey",ue,e,d,a,a),"string"===typeof e&&this.Ba(d,e),c.push(d)),wq(this,d,!1)===a&&(e=this.Xe,Xq(this,"linkToKey",ue,e,d,a,a),"string"===typeof e&&this.Ba(d,e),c.push(d)),e=this.Ag(d),
      Array.isArray(e))for(var f=e.length,g=this.Md,h=0;h<f;h++)e[h]===a&&(Xq(this,"linkLabelKeys",we,g,d,a,a,h,h),c.push(d))}for(b=0;b<c.length;b++)Cq(this,a,c[b]);Ha(c)}};t.Cm=function(a){Z.prototype.Cm.call(this,a);var b=this.Yi(a);null===this.Ib(b)&&Dq(this,b,a)};t.Oq=function(a){Z.prototype.Oq.call(this,a);var b=this.Yi(a);Cq(this,b,a)};
    t.zv=function(a){if(null===a)return"";var b=this.Bj;if(""===b)return"";b=Bn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;B("getCategoryForLinkData found a non-string category for "+a+": "+b);return""};br.prototype.getLinkCategoryForData=function(a){return this.zv(a)};br.prototype.Mt=function(a,b){if(null!==a){var c=this.Bj;if(""!==c)if(this.cd(a)){var d=Bn(a,c);void 0===d&&(d="");d!==b&&(Tj(a,c,b),Xq(this,"linkCategory",ue,c,a,d,b),"string"===typeof c&&this.Ba(a,c))}else Tj(a,c,b)}};
    br.prototype.setLinkCategoryForData=function(a,b){this.Mt(a,b)};br.prototype.ik=function(){return!0};br.prototype.pm=function(){return!0};br.prototype.wt=function(){return!0};br.prototype.jk=function(){return!0};
    ma.Object.defineProperties(br.prototype,{archetypeNodeData:{get:function(){return this.ij},set:function(a){var b=this.ij;b!==a&&(this.ij=a,this.g("archetypeNodeData",b,a))}},linkFromKeyProperty:{get:function(){return this.We},set:function(a){var b=this.We;b!==a&&(this.We=a,this.g("linkFromKeyProperty",b,a))}},linkToKeyProperty:{get:function(){return this.Xe},set:function(a){var b=this.Xe;b!==a&&(this.Xe=a,this.g("linkToKeyProperty",
          b,a))}},linkFromPortIdProperty:{get:function(){return this.Cj},set:function(a){var b=this.Cj;b!==a&&(this.Cj=a,this.g("linkFromPortIdProperty",b,a))}},linkToPortIdProperty:{get:function(){return this.Dj},set:function(a){var b=this.Dj;b!==a&&(this.Dj=a,this.g("linkToPortIdProperty",b,a))}},linkLabelKeysProperty:{get:function(){return this.Md},set:function(a){var b=this.Md;b!==a&&(this.Md=a,this.g("linkLabelKeysProperty",
          b,a))}},linkDataArray:{get:function(){return this.Oc},set:function(a){var b=this.Oc;if(b!==a){this.ob.clear();for(var c=a.length,d=0;d<c;d++){var e=a[d];if(!za(e)){B("GraphLinksModel.linkDataArray must only contain Objects, not: "+e);return}nb(e)}this.Oc=a;if(""!==this.linkKeyProperty){d=new E;for(e=0;e<c;e++){var f=a[e],g=this.Vb(f);void 0===g?d.add(f):null!==this.ob.H(g)?d.add(f):this.ob.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.xq(e),f=this.Vb(e),void 0!==
        f&&this.ob.add(f,e)}d=new F;for(e=0;e<c;e++)d.add(a[e]);this.Yf=d;Xq(this,"linkDataArray",ue,"linkDataArray",this,b,a);for(b=0;b<c;b++)er(this,a[b])}}},linkKeyProperty:{get:function(){return this.wi},set:function(a){var b=this.wi;if(b!==a){this.wi=a;this.ob.clear();for(var c=this.linkDataArray.length,d=0;d<c;d++){var e=this.linkDataArray[d],f=this.Vb(e);void 0===f&&(this.xq(e),f=this.Vb(e));void 0!==f&&this.ob.add(f,e)}this.g("linkKeyProperty",b,a)}}},makeUniqueLinkKeyFunction:{
        get:function(){return this.xl},set:function(a){var b=this.xl;b!==a&&(this.xl=a,this.g("makeUniqueLinkKeyFunction",b,a))}},copyLinkDataFunction:{get:function(){return this.Nk},set:function(a){var b=this.Nk;b!==a&&(this.Nk=a,this.g("copyLinkDataFunction",b,a))}},nodeIsGroupProperty:{get:function(){return this.Bl},set:function(a){var b=this.Bl;b!==a&&(this.Bl=a,this.g("nodeIsGroupProperty",b,a))}},nodeGroupKeyProperty:{
        get:function(){return this.se},set:function(a){var b=this.se;b!==a&&(this.se=a,this.g("nodeGroupKeyProperty",b,a))}},ak:{get:function(){return this.mn},set:function(a){this.mn!==a&&(this.mn=a)}},linkCategoryProperty:{get:function(){return this.Bj},set:function(a){var b=this.Bj;b!==a&&(this.Bj=a,this.g("linkCategoryProperty",b,a))}}});ma.Object.defineProperties(br,{type:{get:function(){return"GraphLinksModel"}}});
    br.prototype.setCategoryForLinkData=br.prototype.Mt;br.prototype.getCategoryForLinkData=br.prototype.zv;br.prototype.assignAllDataProperties=br.prototype.Xj;br.prototype.setGroupKeyForNodeData=br.prototype.Nt;br.prototype.getGroupKeyForNodeData=br.prototype.Yi;br.prototype.isGroupForNodeData=br.prototype.Kv;br.prototype.copyLinkData=br.prototype.hq;br.prototype.mergeLinkDataArray=br.prototype.hA;br.prototype.removeLinkDataCollection=br.prototype.pA;br.prototype.removeLinkData=br.prototype.zm;
    br.prototype.addLinkDataCollection=br.prototype.Ky;br.prototype.addLinkData=br.prototype.Ni;br.prototype.containsLinkData=br.prototype.cd;br.prototype.makeLinkDataKeyUnique=br.prototype.xq;br.prototype.findLinkDataForKey=br.prototype.xg;br.prototype.setKeyForLinkData=br.prototype.Ot;br.prototype.getKeyForLinkData=br.prototype.Vb;br.prototype.removeLabelKeyForLinkData=br.prototype.ey;br.prototype.addLabelKeyForLinkData=br.prototype.gv;br.prototype.setLabelKeysForLinkData=br.prototype.gw;
    br.prototype.getLabelKeysForLinkData=br.prototype.Ag;br.prototype.setToPortIdForLinkData=br.prototype.py;br.prototype.getToPortIdForLinkData=br.prototype.Lz;br.prototype.setFromPortIdForLinkData=br.prototype.ly;br.prototype.getFromPortIdForLinkData=br.prototype.Fz;br.prototype.setToKeyForLinkData=br.prototype.oy;br.prototype.getToKeyForLinkData=br.prototype.Kz;br.prototype.setFromKeyForLinkData=br.prototype.ky;br.prototype.getFromKeyForLinkData=br.prototype.Ez;br.prototype.clear=br.prototype.clear;
    var dr=Object.freeze([]);br.className="GraphLinksModel";$q.GraphLinksModel=br;Z.constructGraphLinksModel=Z.constructGraphLinksModel=function(){return new br};Z.initDiagramModel=Di=function(){return new br};function fr(a){Z.call(this);this.te="parent";this.on=!1;this.Ij="parentLinkCategory";void 0!==a&&(this.nodeDataArray=a)}la(fr,Z);fr.constructGraphLinksModel=Z.constructGraphLinksModel;
    fr.prototype.cloneProtected=function(a){Z.prototype.cloneProtected.call(this,a);a.te=this.te;a.on=this.on;a.Ij=this.Ij};t=fr.prototype;t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.Mq();var b=(""!==this.name?this.name:"")+" TreeModel";if(0<a){b+="\n node data:";a=this.nodeDataArray;for(var c=a.length,d=0;d<c;d++){var e=a[d];b+=" "+this.ja(e)+":"+Ja(e)}}return b};
    t.zk=function(){var a=Z.prototype.zk.call(this),b="";"parent"!==this.nodeParentKeyProperty&&"string"===typeof this.nodeParentKeyProperty&&(b+=',\n  "nodeParentKeyProperty": '+this.quote(this.nodeParentKeyProperty));return a+b};t.Eq=function(a){Z.prototype.Eq.call(this,a);a.nodeParentKeyProperty&&(this.nodeParentKeyProperty=a.nodeParentKeyProperty)};t.Rq=function(a){Rq(this,a,"nodeParentKeyProperty");return Z.prototype.Rq.call(this,a)};
    t.Dq=function(a){void 0!==a.nodeParentKeyProperty&&a.nodeParentKeyProperty!==this.nodeParentKeyProperty&&B("applyIncrementalJson cannot change Model properties");Z.prototype.Dq.call(this,a)};t.rm=function(a){return a};t.$i=function(a){if(null!==a){var b=this.te;if(""!==b&&(b=Bn(a,b),void 0!==b)){if(yq(b))return b;B("ParentKey value for node data "+a+" is not a number or a string: "+b)}}};
    t.He=function(a,b){null===b&&(b=void 0);if(null!==a){var c=this.te;if(""!==c)if(b=this.rm(b),this.sb(a)){var d=Bn(a,c);d!==b&&(Cq(this,d,a),Tj(a,c,b),null===this.Ib(b)&&Dq(this,b,a),Xq(this,"nodeParentKey",ue,c,a,d,b),"string"===typeof c&&this.Ba(a,c))}else Tj(a,c,b)}};t.Av=function(a){if(null===a)return"";var b=this.Ij;if(""===b)return"";b=Bn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;B("getParentLinkCategoryForNodeData found a non-string category for "+a+": "+b);return""};
    fr.prototype.getLinkCategoryForData=function(a){return this.Av(a)};fr.prototype.hw=function(a,b){if(null!==a){var c=this.Ij;if(""!==c)if(this.sb(a)){var d=Bn(a,c);void 0===d&&(d="");d!==b&&(Tj(a,c,b),Xq(this,"parentLinkCategory",ue,c,a,d,b),"string"===typeof c&&this.Ba(a,c))}else Tj(a,c,b)}};fr.prototype.setLinkCategoryForData=function(a,b){this.hw(a,b)};
    fr.prototype.copyNodeData=function(a){if(null===a)return null;a=Z.prototype.copyNodeData.call(this,a);this.bk||""===this.te||void 0===Bn(a,this.te)||Tj(a,this.te,void 0);return a};fr.prototype.setDataProperty=function(a,b,c){if(this.sb(a))if(b===this.nodeKeyProperty)this.Hm(a,c);else{if(b===this.nodeCategoryProperty){this.Jq(a,c);return}if(b===this.nodeParentKeyProperty){this.He(a,c);return}}var d=Bn(a,b);d!==c&&(Tj(a,b,c),this.Gt(a,b,d,c))};t=fr.prototype;
    t.Hq=function(a,b){Z.prototype.Hq.call(this,a,b);for(var c=this.ab.iterator;c.next();)this.bw(c.value,a,b)};t.bw=function(a,b,c){if(this.$i(a)===b){var d=this.te;Tj(a,d,c);Xq(this,"nodeParentKey",ue,d,a,b,c);"string"===typeof d&&this.Ba(a,d)}};
    t.Dm=function(a){Z.prototype.Dm.call(this,a);a=this.ja(a);var b=Bq(this,a);if(null!==b){var c=Fa();for(b=b.iterator;b.next();){var d=b.value;if(this.sb(d)&&this.$i(d)===a){var e=this.te;Xq(this,"nodeParentKey",ue,e,d,a,a);"string"===typeof e&&this.Ba(d,e);c.push(d)}}for(b=0;b<c.length;b++)Cq(this,a,c[b]);Ha(c)}};t.Cm=function(a){Z.prototype.Cm.call(this,a);var b=this.$i(a);b=this.rm(b);null===this.Ib(b)&&Dq(this,b,a)};t.Oq=function(a){Z.prototype.Oq.call(this,a);var b=this.$i(a);Cq(this,b,a)};
    t.qm=function(){return!0};t.wt=function(){return!0};
    ma.Object.defineProperties(fr.prototype,{nodeParentKeyProperty:{get:function(){return this.te},set:function(a){var b=this.te;b!==a&&(this.te=a,this.g("nodeParentKeyProperty",b,a))}},bk:{get:function(){return this.on},set:function(a){this.on!==a&&(this.on=a)}},parentLinkCategoryProperty:{get:function(){return this.Ij},set:function(a){var b=this.Ij;b!==a&&(this.Ij=a,this.g("parentLinkCategoryProperty",b,a))}},
      linkCategoryProperty:{get:function(){return this.parentLinkCategoryProperty},set:function(a){this.parentLinkCategoryProperty=a}}});ma.Object.defineProperties(fr,{type:{get:function(){return"TreeModel"}}});fr.prototype.setParentLinkCategoryForNodeData=fr.prototype.hw;fr.prototype.getParentLinkCategoryForNodeData=fr.prototype.Av;fr.prototype.setParentKeyForNodeData=fr.prototype.He;fr.prototype.getParentKeyForNodeData=fr.prototype.$i;
    fr.className="TreeModel";$q.TreeModel=fr;function gr(){Fi.call(this);this.Vw=this.Cn=this.$b=0;this.Ar=360;this.Uw=hr;this.qj=0;this.Mw=new I;this.lr=this.Td=0;this.Zs=new ir;this.du=this.Hj=0;this.By=600;this.gp=NaN;this.Ym=1;this.Lp=0;this.Tl=360;this.Ab=hr;this.J=kr;this.Qc=lr;this.Kc=$p;this.ff=6;this.Qo=mr}la(gr,Fi);
    gr.prototype.cloneProtected=function(a){Fi.prototype.cloneProtected.call(this,a);a.gp=this.gp;a.Ym=this.Ym;a.Lp=this.Lp;a.Tl=this.Tl;a.Ab=this.Ab;a.J=this.J;a.Qc=this.Qc;a.Kc=this.Kc;a.ff=this.ff;a.Qo=this.Qo};
    gr.prototype.cb=function(a){if(a.classType===gr)if(a===nr||a===or||a===pr||a===qr||a===lr)this.sorting=a;else if(a===rr||a===sr||a===kr||a===tr)this.direction=a;else if(a===ur||a===vr||a===hr||a===wr)this.arrangement=a;else{if(a===xr||a===mr)this.nodeDiameterFormula=a}else Fi.prototype.cb.call(this,a)};gr.prototype.createNetwork=function(){return new yr(this)};
    gr.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);a=this.network.vertexes;if(1>=a.count)1===a.count&&(a=a.first(),a.centerX=0,a.centerY=0);else{var b=new E;b.addAll(a.iterator);a=new E;var c=new E;var d=this.sort(b);var e,f,g=this.lr;var h=this.arrangement;var k=this.nodeDiameterFormula;var l=this.radius;if(!isFinite(l)||0>=l)l=NaN;var m=this.aspectRatio;if(!isFinite(m)||0>=m)m=1;var n=this.startAngle;
      isFinite(n)||(n=0);var p=this.sweepAngle;if(!isFinite(p)||360<p||1>p)p=360;b=this.spacing;isFinite(b)||(b=NaN);h===wr&&k===xr?h=hr:h===wr&&k!==xr&&(h=this.arrangement);if((this.direction===rr||this.direction===sr)&&this.sorting!==lr){for(k=0;!(k>=d.length);k+=2){a.add(d.L(k));if(k+1>=d.length)break;c.add(d.L(k+1))}this.direction===rr?(this.arrangement===wr&&a.reverse(),d=new E,d.addAll(a),d.addAll(c)):(this.arrangement===wr&&c.reverse(),d=new E,d.addAll(c),d.addAll(a))}k=d.length;for(var r=f=e=0;r<
      d.length;r++){var q=n+p*f*(this.direction===kr?1:-1)/k,u=d.L(r).diameter;isNaN(u)&&(u=zr(d.L(r),q));360>p&&(0===r||r===d.length-1)&&(u/=2);e+=u;f++}if(isNaN(l)||h===wr){isNaN(b)&&(b=6);if(h!==hr&&h!==wr){f=-Infinity;for(g=0;g<k;g++)r=d.L(g),e=d.L(g===k-1?0:g+1),isNaN(r.diameter)&&zr(r,0),isNaN(e.diameter)&&zr(e,0),f=Math.max(f,(r.diameter+e.diameter)/2);g=f+b;h===ur?l=(f+b)/(2*Math.PI/k):l=Ar(this,g*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180)}else l=Ar(this,e+(360<=p?k:k-1)*(h!==wr?b:1.6*b),m,n*
        Math.PI/180,p*Math.PI/180);f=l*m}else if(f=l*m,r=Br(this,l,f,n*Math.PI/180,p*Math.PI/180),isNaN(b)){if(h===hr||h===wr)b=(r-e)/(360<=p?k:k-1)}else if(h===hr||h===wr)r=(r-e)/(360<=p?k:k-1),r<b?(l=Ar(this,e+b*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180),f=l*m):b=r;else{g=-Infinity;for(e=0;e<k;e++)q=d.L(e),u=d.L(e===k-1?0:e+1),isNaN(q.diameter)&&zr(q,0),isNaN(u.diameter)&&zr(u,0),g=Math.max(g,(q.diameter+u.diameter)/2);g+=b;e=Ar(this,g*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180);e>l?(l=e,f=l*m):g=
        r/(360<=p?k:k-1)}this.Uw=h;this.$b=l;this.Cn=m;this.Vw=n;this.Ar=p;this.qj=b;this.Td=f;this.lr=g;b=d;d=this.Uw;h=this.$b;l=this.Vw;m=this.Ar;n=this.qj;p=this.Td;k=this.lr;if(this.direction!==rr&&this.direction!==sr||d!==wr)if(this.direction===rr||this.direction===sr){g=0;switch(d){case vr:g=180*Cr(this,h,p,l,k)/Math.PI;break;case hr:k=b=0;g=a.first();null!==g&&(b=zr(g,Math.PI/2));g=c.first();null!==g&&(k=zr(g,Math.PI/2));g=180*Cr(this,h,p,l,n+(b+k)/2)/Math.PI;break;case ur:g=m/b.length}if(this.direction===
        rr){switch(d){case vr:Dr(this,a,l,tr);break;case hr:Er(this,a,l,tr);break;case ur:Fr(this,a,m/2,l,tr)}switch(d){case vr:Dr(this,c,l+g,kr);break;case hr:Er(this,c,l+g,kr);break;case ur:Fr(this,c,m/2,l+g,kr)}}else{switch(d){case vr:Dr(this,c,l,tr);break;case hr:Er(this,c,l,tr);break;case ur:Fr(this,c,m/2,l,tr)}switch(d){case vr:Dr(this,a,l+g,kr);break;case hr:Er(this,a,l+g,kr);break;case ur:Fr(this,a,m/2,l+g,kr)}}}else switch(d){case vr:Dr(this,b,l,this.direction);break;case hr:Er(this,b,l,this.direction);
        break;case ur:Fr(this,b,m,l,this.direction);break;case wr:Gr(this,b,m,l,this.direction)}else Gr(this,b,m,l-m/2,kr)}this.updateParts();this.network=null;this.isValidLayout=!0};function Fr(a,b,c,d,e){var f=a.Ar,g=a.$b;a=a.Td;d=d*Math.PI/180;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=d+(e===kr?k*c/(360<=f?h:h-1):-(k*c)/h),m=b.L(k),n=g*Math.tan(l)/a;n=Math.sqrt((g*g+a*a*n*n)/(1+n*n));m.centerX=n*Math.cos(l);m.centerY=n*Math.sin(l);m.actualAngle=180*l/Math.PI}}
    function Er(a,b,c,d){var e=a.$b,f=a.Td,g=a.qj;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=b.L(k),m=b.L(k===h-1?0:k+1),n=f*Math.sin(c);l.centerX=e*Math.cos(c);l.centerY=n;l.actualAngle=180*c/Math.PI;isNaN(l.diameter)&&zr(l,0);isNaN(m.diameter)&&zr(m,0);l=Cr(a,e,f,d===kr?c:-c,(l.diameter+m.diameter)/2+g);c+=d===kr?l:-l}}
    function Dr(a,b,c,d){var e=a.$b,f=a.Td,g=a.lr;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=b.L(k);l.centerX=e*Math.cos(c);l.centerY=f*Math.sin(c);l.actualAngle=180*c/Math.PI;l=Cr(a,e,f,d===kr?c:-c,g);c+=d===kr?l:-l}}function Gr(a,b,c,d,e){var f=a.Ar;a.Hj=0;a.Zs=new ir;if(360>c){for(f=d+(e===kr?f:-f);0>f;)f+=360;f%=360;180<f&&(f-=360);f*=Math.PI/180;a.du=f;Hr(a,b,c,d,e)}else Ir(a,b,c,d,e);a.Zs.commit(b)}
    function Ir(a,b,c,d,e){var f=a.$b,g=a.qj,h=a.Cn,k=f*Math.cos(d*Math.PI/180),l=a.Td*Math.sin(d*Math.PI/180),m=b.na();if(3===m.length)m[0].centerX=f,m[0].centerY=0,m[1].centerX=m[0].centerX-m[0].width/2-m[1].width/2-g,m[1].y=m[0].y,m[2].centerX=(m[0].centerX+m[1].centerX)/2,m[2].y=m[0].y-m[2].height-g;else if(4===m.length)m[0].centerX=f,m[0].centerY=0,m[2].centerX=-m[0].centerX,m[2].centerY=m[0].centerY,m[1].centerX=0,m[1].y=Math.min(m[0].y,m[2].y)-m[1].height-g,m[3].centerX=0,m[3].y=Math.max(m[0].y+
      m[0].height+g,m[2].y+m[2].height+g);else{f=I.alloc();for(var n=0;n<m.length;n++){m[n].centerX=k;m[n].centerY=l;if(n>=m.length-1)break;Jr(a,k,l,m,n,e,f)||Kr(a,k,l,m,n,e,f);k=f.x;l=f.y}I.free(f);a.Hj++;if(!(23<a.Hj)){k=m[0].centerX;l=m[0].centerY;f=m[m.length-1].centerX;n=m[m.length-1].centerY;var p=Math.abs(k-f)-((m[0].width+m[m.length-1].width)/2+g),r=Math.abs(l-n)-((m[0].height+m[m.length-1].height)/2+g);g=0;1>Math.abs(r)?Math.abs(k-f)<(m[0].width+m[m.length-1].width)/2&&(g=0):g=0<r?r:1>Math.abs(p)?
      0:p;k=Math.abs(f)>Math.abs(n)?0<f!==l>n:0<n!==k<f;if(k=e===kr?k:!k)g=-Math.abs(g),g=Math.min(g,-m[m.length-1].width),g=Math.min(g,-m[m.length-1].height);a.Zs.compare(g,m);1<Math.abs(g)&&(a.$b=8>a.Hj?a.$b-g/(2*Math.PI):5>m.length&&10<g?a.$b/2:a.$b-(0<g?1.7:-2.3),a.Td=a.$b*h,Ir(a,b,c,d,e))}}}
    function Hr(a,b,c,d,e){for(var f=a.$b,g=a.Td,h=a.Cn,k=f*Math.cos(d*Math.PI/180),l=g*Math.sin(d*Math.PI/180),m=I.alloc(),n=b.na(),p=0;p<n.length;p++){n[p].centerX=k;n[p].centerY=l;if(p>=n.length-1)break;Jr(a,k,l,n,p,e,m)||Kr(a,k,l,n,p,e,m);k=m.x;l=m.y}I.free(m);a.Hj++;if(!(23<a.Hj)){k=Math.atan2(l,k);k=e===kr?a.du-k:k-a.du;k=Math.abs(k)<Math.abs(k-2*Math.PI)?k:k-2*Math.PI;f=k*(f+g)/2;g=a.Zs;if(Math.abs(f)<Math.abs(g.km))for(g.km=f,g.Ak=[],g.Mm=[],k=0;k<n.length;k++)g.Ak[k]=n[k].bounds.x,g.Mm[k]=n[k].bounds.y;
      1<Math.abs(f)&&(a.$b=8>a.Hj?a.$b-f/(2*Math.PI):a.$b-(0<f?1.7:-2.3),a.Td=a.$b*h,Hr(a,b,c,d,e))}}function Jr(a,b,c,d,e,f,g){var h=a.$b,k=a.Td,l=0;a=(d[e].width+d[e+1].width)/2+a.qj;var m=!1;if(0<=c!==(f===kr)){if(f=b+a,f>h){f=b-a;if(f<-h)return g.x=f,g.y=l,!1;m=!0}}else if(f=b-a,f<-h){f=b+a;if(f>h)return g.x=f,g.y=l,!1;m=!0}l=Math.sqrt(1-Math.min(1,f*f/(h*h)))*k;0>c!==m&&(l=-l);if(Math.abs(c-l)>(d[e].height+d[e+1].height)/2)return g.x=f,g.y=l,!1;g.x=f;g.y=l;return!0}
    function Kr(a,b,c,d,e,f,g){var h=a.$b,k=a.Td,l=0;a=(d[e].height+d[e+1].height)/2+a.qj;d=!1;if(0<=b!==(f===kr)){if(f=c-a,f<-k){f=c+a;if(f>k){g.x=l;g.y=f;return}d=!0}}else if(f=c+a,f>k){f=c-a;if(f<-k){g.x=l;g.y=f;return}d=!0}l=Math.sqrt(1-Math.min(1,f*f/(k*k)))*h;0>b!==d&&(l=-l);g.x=l;g.y=f}gr.prototype.commitLayout=function(){this.commitNodes();this.isRouting&&this.commitLinks()};
    gr.prototype.commitNodes=function(){var a=null!==this.group&&null!==this.group.placeholder&&this.group.isSubGraphExpanded,b=a?this.group.location.copy():null,c=this.actualCenter;a?c=new I(0,0):(c.x=this.arrangementOrigin.x+this.$b,c.y=this.arrangementOrigin.y+this.Td);for(var d=this.network.vertexes.iterator;d.next();){var e=d.value;e.x+=c.x;e.y+=c.y;e.commit()}a&&(this.group.yb(),a=this.group.position.copy(),c=this.group.location.copy(),b=b.$d(c.$d(a)),this.group.move(b),this.Mw=b.$d(a))};
    gr.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};function Br(a,b,c,d,e){var f=a.By;if(.001>Math.abs(a.Cn-1))return void 0!==d&&void 0!==e?e*b:2*Math.PI*b;a=b>c?Math.sqrt(b*b-c*c)/b:Math.sqrt(c*c-b*b)/c;var g=0;var h=void 0!==d&&void 0!==e?e/(f+1):Math.PI/(2*(f+1));for(var k=0,l=0;l<=f;l++){void 0!==d&&void 0!==e?k=d+l*e/f:k=l*Math.PI/(2*f);var m=Math.sin(k);g+=Math.sqrt(1-a*a*m*m)*h}return void 0!==d&&void 0!==e?(b>c?b:c)*g:4*(b>c?b:c)*g}
    function Ar(a,b,c,d,e){return b/(void 0!==d&&void 0!==e?Br(a,1,c,d,e):Br(a,1,c))}function Cr(a,b,c,d,e){if(.001>Math.abs(a.Cn-1))return e/b;var f=b>c?Math.sqrt(b*b-c*c)/b:Math.sqrt(c*c-b*b)/c,g=0;a=2*Math.PI/(700*a.network.vertexes.count);b>c&&(d+=Math.PI/2);for(var h=0;;h++){var k=Math.sin(d+h*a);g+=(b>c?b:c)*Math.sqrt(1-f*f*k*k)*a;if(g>=e)return h*a}}
    gr.prototype.sort=function(a){switch(this.sorting){case pr:break;case qr:a.reverse();break;case nr:a.sort(this.comparer);break;case or:a.sort(this.comparer);a.reverse();break;case lr:for(var b=[],c=0;c<a.length;c++)b.push(0);c=new E;for(var d=0;d<a.length;d++){var e=-1,f=-1;if(0===d)for(var g=0;g<a.length;g++){var h=a.L(g).edgesCount;h>e&&(e=h,f=g)}else for(g=0;g<a.length;g++)h=b[g],h>e&&(e=h,f=g);c.add(a.L(f));b[f]=-1;f=a.L(f);for(g=f.sourceEdges;g.next();)e=a.indexOf(g.value.fromVertex),0>e||0<=
    b[e]&&b[e]++;for(f=f.destinationEdges;f.next();)e=a.indexOf(f.value.toVertex),0>e||0<=b[e]&&b[e]++}a=[];for(b=0;b<c.length;b++){e=c.L(b);a[b]=[];for(f=e.destinationEdges;f.next();)d=c.indexOf(f.value.toVertex),d!==b&&0>a[b].indexOf(d)&&a[b].push(d);for(e=e.sourceEdges;e.next();)d=c.indexOf(e.value.fromVertex),d!==b&&0>a[b].indexOf(d)&&a[b].push(d)}f=[];for(b=0;b<a.length;b++)f[b]=0;b=[];g=[];h=[];e=[];d=new E;for(var k=0,l=0;l<a.length;l++){var m=a[l].length;if(1===m)e.push(l);else if(0===m)d.add(c.L(l));
    else{if(0===k)b.push(l);else{for(var n=m=Infinity,p=-1,r=[],q=0;q<b.length;q++)0>a[b[q]].indexOf(b[q===b.length-1?0:q+1])&&r.push(q===b.length-1?0:q+1);if(0===r.length)for(q=0;q<b.length;q++)r.push(q);for(q=0;q<r.length;q++){for(var u=r[q],v=a[l],w=0,y=0;y<g.length;y++){var z=f[g[y]],A=f[h[y]];if(z<A){var C=z;z=A}else C=A;if(C<u&&u<=z)for(A=0;A<v.length;A++){var H=v[A];0>b.indexOf(H)||C<f[H]&&f[H]<z||C===f[H]||z===f[H]||w++}else for(A=0;A<v.length;A++)H=v[A],0>b.indexOf(H)||C<f[H]&&f[H]<z&&C!==f[H]&&
    z!==f[H]&&w++}v=w;for(y=w=0;y<a[l].length;y++)C=b.indexOf(a[l][y]),0<=C&&(C=Math.abs(u-(C>=u?C+1:C)),w+=C<b.length+1-C?C:b.length+1-C);for(y=0;y<g.length;y++)C=f[g[y]],z=f[h[y]],C>=u&&C++,z>=u&&z++,C>z&&(A=z,z=C,C=A),z-C<(b.length+2)/2===(C<u&&u<=z)&&w++;if(v<m||v===m&&w<n)m=v,n=w,p=u}b.splice(p,0,l);for(m=0;m<b.length;m++)f[b[m]]=m;for(m=0;m<a[l].length;m++)n=a[l][m],0<=b.indexOf(n)&&(g.push(l),h.push(n))}k++}}for(g=b.length;;){f=!0;for(h=0;h<e.length;h++)if(k=e[h],l=a[k][0],m=b.indexOf(l),0<=m){for(p=
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                n=0;p<a[l].length;p++)r=b.indexOf(a[l][p]),0>r||r===m||(q=r>m?r-m:m-r,n+=r<m!==q>g-q?1:-1);b.splice(0>n?m:m+1,0,k);e.splice(h,1);h--}else f=!1;if(f)break;else b.push(e[0]),e.splice(0,1)}for(a=0;a<b.length;a++)d.add(c.L(b[a]));return d;default:B("Invalid sorting type.")}return a};
    ma.Object.defineProperties(gr.prototype,{radius:{get:function(){return this.gp},set:function(a){this.gp!==a&&(0<a||isNaN(a))&&(this.gp=a,this.C())}},aspectRatio:{get:function(){return this.Ym},set:function(a){this.Ym!==a&&0<a&&(this.Ym=a,this.C())}},startAngle:{get:function(){return this.Lp},set:function(a){this.Lp!==a&&(this.Lp=a,this.C())}},sweepAngle:{get:function(){return this.Tl},
        set:function(a){this.Tl!==a&&(0<a&&360>=a?this.Tl=a:this.Tl=360,this.C())}},arrangement:{get:function(){return this.Ab},set:function(a){this.Ab===a||a!==wr&&a!==hr&&a!==vr&&a!==ur||(this.Ab=a,this.C())}},direction:{get:function(){return this.J},set:function(a){this.J===a||a!==kr&&a!==tr&&a!==rr&&a!==sr||(this.J=a,this.C())}},sorting:{get:function(){return this.Qc},set:function(a){this.Qc===a||a!==pr&&a!==qr&&
        a!==nr&&!or&&a!==lr||(this.Qc=a,this.C())}},comparer:{get:function(){return this.Kc},set:function(a){this.Kc!==a&&(this.Kc=a,this.C())}},spacing:{get:function(){return this.ff},set:function(a){this.ff!==a&&(this.ff=a,this.C())}},nodeDiameterFormula:{get:function(){return this.Qo},set:function(a){this.Qo===a||a!==mr&&a!==xr||(this.Qo=a,this.C())}},actualXRadius:{get:function(){return this.$b}},
      actualYRadius:{get:function(){return this.Td}},actualSpacing:{get:function(){return this.qj}},actualCenter:{get:function(){return this.Mw}}});
    var hr=new D(gr,"ConstantSpacing",0),vr=new D(gr,"ConstantDistance",1),ur=new D(gr,"ConstantAngle",2),wr=new D(gr,"Packed",3),kr=new D(gr,"Clockwise",4),tr=new D(gr,"Counterclockwise",5),rr=new D(gr,"BidirectionalLeft",6),sr=new D(gr,"BidirectionalRight",7),pr=new D(gr,"Forwards",8),qr=new D(gr,"Reverse",9),nr=new D(gr,"Ascending",10),or=new D(gr,"Descending",11),lr=new D(gr,"Optimized",12),mr=new D(gr,"Pythagorean",13),xr=new D(gr,"Circular",14);gr.className="CircularLayout";gr.ConstantSpacing=hr;
    gr.ConstantDistance=vr;gr.ConstantAngle=ur;gr.Packed=wr;gr.Clockwise=kr;gr.Counterclockwise=tr;gr.BidirectionalLeft=rr;gr.BidirectionalRight=sr;gr.Forwards=pr;gr.Reverse=qr;gr.Ascending=nr;gr.Descending=or;gr.Optimized=lr;gr.Pythagorean=mr;gr.Circular=xr;function ir(){this.km=-Infinity;this.Mm=this.Ak=null}
    ir.prototype.compare=function(a,b){if(0<a&&0>this.km||Math.abs(a)<Math.abs(this.km)&&!(0>a&&0<this.km))for(this.km=a,this.Ak=[],this.Mm=[],a=0;a<b.length;a++)this.Ak[a]=b[a].bounds.x,this.Mm[a]=b[a].bounds.y};ir.prototype.commit=function(a){if(null!==this.Ak&&null!==this.Mm)for(var b=0;b<this.Ak.length;b++){var c=a.L(b);c.x=this.Ak[b];c.y=this.Mm[b]}};ir.className="VertexArrangement";function yr(a){Qp.call(this,a)}la(yr,Qp);yr.prototype.createVertex=function(){return new Lr(this)};
    yr.prototype.createEdge=function(){return new Mr(this)};yr.className="CircularNetwork";function Lr(a){Tp.call(this,a);this.I=this.oj=NaN}la(Lr,Tp);
    function zr(a,b){var c=a.network;if(null===c)return NaN;c=c.layout;if(null===c)return NaN;if(c.arrangement===wr)if(c.nodeDiameterFormula===xr)a.oj=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.oj=Math.min(a.height/c,a.width/b)}else a.oj=c.nodeDiameterFormula===xr?Math.max(a.width,a.height):Math.sqrt(a.width*a.width+a.height*a.height);return a.oj}
    ma.Object.defineProperties(Lr.prototype,{diameter:{get:function(){return this.oj},set:function(a){this.oj!==a&&(this.oj=a)}},actualAngle:{get:function(){return this.I},set:function(a){this.I!==a&&(this.I=a)}}});Lr.className="CircularVertex";function Mr(a){Up.call(this,a)}la(Mr,Up);Mr.className="CircularEdge";
    function Nr(){Fi.call(this);this.zh=null;this.jo=0;this.Ad=(new M(100,100)).freeze();this.Xm=!1;this.df=!0;this.Zc=!1;this.yl=100;this.Fn=1;this.Uf=1E3;this.Ho=10;this.hp=Math;this.Uk=.05;this.Tk=50;this.Rk=150;this.Sk=0;this.wn=10;this.vn=5}la(Nr,Fi);
    Nr.prototype.cloneProtected=function(a){Fi.prototype.cloneProtected.call(this,a);a.Ad.assign(this.Ad);a.Xm=this.Xm;a.df=this.df;a.Zc=this.Zc;a.yl=this.yl;a.Fn=this.Fn;a.Uf=this.Uf;a.Ho=this.Ho;a.hp=this.hp;a.Uk=this.Uk;a.Tk=this.Tk;a.Rk=this.Rk;a.Sk=this.Sk;a.wn=this.wn;a.vn=this.vn};Nr.prototype.createNetwork=function(){return new Or(this)};
    Nr.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));a=this.maxIterations;if(0<this.network.vertexes.count){this.network.iq();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.iv();this.jo=0;if(this.needsClusterLayout()){b=this.network;for(c=b.sy().iterator;c.next();){this.network=
      c.value;for(var d=this.network.vertexes.iterator;d.next();){var e=d.value;e.xd=e.vertexes.count;e.Kh=1;e.$j=null;e.Ge=null}Pr(this,0,a)}this.network=b;c.reset();d=this.arrangementSpacing;for(var f=c.count,g=!0,h=e=0,k=Fa(),l=0;l<f+b.vertexes.count+2;l++)k[l]=null;f=0;c.reset();for(var m=N.alloc();c.next();)if(l=c.value,this.computeBounds(l,m),g)g=!1,e=m.x+m.width/2,h=m.y+m.height/2,k[0]=new I(m.x+m.width+d.width,m.y),k[1]=new I(m.x,m.y+m.height+d.height),f=2;else{var n=Qr(k,f,e,h,m.width,m.height,
      d),p=k[n],r=new I(p.x+m.width+d.width,p.y),q=new I(p.x,p.y+m.height+d.height);n+1<f&&k.splice(n+1,0,null);k[n]=r;k[n+1]=q;f++;n=p.x-m.x;p=p.y-m.y;for(l=l.vertexes.iterator;l.next();)r=l.value,r.centerX+=n,r.centerY+=p}N.free(m);for(l=b.vertexes.iterator;l.next();)g=l.value,r=g.bounds,2>f?(e=r.x+r.width/2,h=r.y+r.height/2,k[0]=new I(r.x+r.width+d.width,r.y),k[1]=new I(r.x,r.y+r.height+d.height),f=2):(m=Qr(k,f,e,h,r.width,r.height,d),p=k[m],n=new I(p.x+r.width+d.width,p.y),r=new I(p.x,p.y+r.height+
      d.height),m+1<f&&k.splice(m+1,0,null),k[m]=n,k[m+1]=r,f++,g.centerX=p.x+g.width/2,g.centerY=p.y+g.height/2);Ha(k);for(c.reset();c.next();){d=c.value;for(e=d.vertexes.iterator;e.next();)b.Ch(e.value);for(d=d.edges.iterator;d.next();)b.bq(d.value)}}Rr(this,a);this.updateParts()}this.yl=a;this.network=null;this.isValidLayout=!0};
    Nr.prototype.needsClusterLayout=function(){if(3>this.network.vertexes.count)return!1;for(var a=0,b=0,c=this.network.vertexes.first().bounds,d=this.network.vertexes.iterator;d.next();){if(d.value.bounds.Gc(c)&&(a++,2<a))return!0;if(10<b)break;b++}return!1};Nr.prototype.computeBounds=function(a,b){var c=!0;for(a=a.vertexes.iterator;a.next();){var d=a.value;c?(c=!1,b.set(d.bounds)):b.Hc(d.bounds)}return b};
    function Pr(a,b,c){if(Sr(a,b)){var d=a.Uf;a.Uf*=1+1/(b+1);var e=Tr(a,b),f=Math.max(0,Math.max(Math.min(a.network.vertexes.count,c*(b+1)/11),10));a.maxIterations+=f;Pr(a,b+1,c);Rr(a,f);Ur(a,e);b=e.vertexes.na();b.sort(function(a,b){return null===a||null===b||a===b?0:b.xd-a.xd});for(c=0;c<b.length;c++)Vr(a,b[c]);a.Uf=d}}
    function Sr(a,b){if(10<b||3>a.network.vertexes.count)return!1;a.zh=a.network.vertexes.na();a=a.zh;a.sort(function(a,b){return null===a||null===b||a===b?0:b.xd-a.xd});for(b=a.length-1;0<=b&&1>=a[b].xd;)b--;return 1<a.length-b}
    function Tr(a,b){for(var c=a.network,d=new Or(a),e=0;e<a.zh.length;e++){var f=a.zh[e];if(1<f.xd){d.Ch(f);var g=new Wr;g.Tt=f.xd;g.Ut=f.width;g.St=f.height;g.Bw=f.focus.x;g.Cw=f.focus.y;null===f.Ge&&(f.Ge=new E);f.Ge.add(g);f.ew=f.Ge.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.bq(h):e.network===d?(h=e.$j,null===h&&(h=new E,e.$j=h),h.add(g),e.xd--,e.Kh+=g.Kh):g.network===d&&(h=g.$j,null===h&&(h=new E,g.$j=h),h.add(e),
      g.xd--,g.Kh+=e.Kh)}for(e=d.edges.iterator;e.next();)f=e.value,f.length*=Math.max(1,J.sqrt((f.fromVertex.Kh+f.toVertex.Kh)/(4*b+1)));for(b=d.vertexes.iterator;b.next();){e=b.value;var k=e.$j;if(null!==k&&0<k.count&&(g=e.Ge.L(e.Ge.count-1).Tt-e.xd,!(0>=g))){for(var l=h=0,m=k.count-g;m<k.count;m++){var n=k.L(m),p=null;for(f=n.edges.iterator;f.next();){var r=f.value;if(r.Sx(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=J.sqrt((h+r+l*l*4/(g*g))/r);g=(h-1)*m/2;h=(h-1)*n/2;e.bounds=new N(f-p.x-g,k-p.y-h,m+2*g,n+2*h);e.focus=new I(p.x+g,p.y+h)}}a.network=d;return c}function Ur(a,b){for(var c=a.network.vertexes.iterator;c.next();){var d=c.value;d.network=b;if(null!==d.Ge){var e=d.Ge.L(d.ew);d.xd=e.Tt;var f=e.Bw,g=e.Cw;d.bounds=new N(d.centerX-f,d.centerY-g,e.Ut,e.St);d.focus=new I(f,g);d.ew--}}for(c=a.network.edges.iterator;c.next();)c.value.network=b;a.network=b}
    function Vr(a,b){var c=b.$j;if(null!==c&&0!==c.count){var d=b.centerX,e=b.centerY,f=b.width,g=b.height;null!==b.Ge&&0<b.Ge.count&&(g=b.Ge.L(0),f=g.Ut,g=g.St);f=J.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.xd?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.xd||a.isFixed(k))){m=null;for(n=k.edges.iterator;n.next();){m=n.value;break}n=k.width;var p=k.height;n=J.sqrt(n*n+p*p)/2;m=f+m.length+n;n=g+(b*(h/2>>1)+l)*(0===h%2?1:-1);k.centerX=d+m*Math.cos(n);k.centerY=e+m*Math.sin(n);h++}}}
    function Qr(a,b,c,d,e,f,g){var h=9E19,k=-1,l=0;a:for(;l<b;l++){var m=a[l],n=m.x-c,p=m.y-d;n=n*n+p*p;if(n<h){for(p=l-1;0<=p;p--)if(a[p].y>m.y&&a[p].x-m.x<e+g.width)continue a;for(p=l+1;p<b;p++)if(a[p].x>m.x&&a[p].y-m.y<f+g.height)continue a;k=l;h=n}}return k}Nr.prototype.iv=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)};
    Nr.prototype.addComments=function(a){var b=a.node;if(null!==b)for(b=b.uv();b.next();){var c=b.value;if("Comment"===c.category&&c.isVisible()){var d=this.network.Wi(c);null===d&&(d=this.network.am(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.mk(a,d,null));c.length=this.defaultCommentSpringLength}}};
    function Xr(a,b){var c=a.bounds,d=c.x;a=c.y;var e=c.width;c=c.height;var f=b.bounds,g=f.x;b=f.y;var h=f.width;f=f.height;return d+e<g?a>b+f?(c=d+e-g,a=a-b-f,J.sqrt(c*c+a*a)):a+c<b?(d=d+e-g,a=a+c-b,J.sqrt(d*d+a*a)):g-(d+e):d>g+h?a>b+f?(c=d-g-h,a=a-b-f,J.sqrt(c*c+a*a)):a+c<b?(d=d-g-h,a=a+c-b,J.sqrt(d*d+a*a)):d-(g+h):a>b+f?a-(b+f):a+c<b?b-(a+c):.1}function Rr(a,b){a.zh=null;for(b=a.jo+b;a.jo<b&&(a.jo++,Yr(a)););a.zh=null}
    function Yr(a){null===a.zh&&(a.zh=a.network.vertexes.na());var b=a.zh;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.Uf;var l=d=h=0;for(f=
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           0;f<b.length;f++){g=b[f];d=g.bounds;h=g.focus;k=d.x+h.x;var m=d.y+h.y;d=g.charge*a.electricalFieldX(k,m);l=g.charge*a.electricalFieldY(k,m);d+=g.mass*a.gravitationalFieldX(k,m);l+=g.mass*a.gravitationalFieldY(k,m);g.forceX+=d;g.forceY+=l;for(var n=f+1;n<b.length;n++){var p=b[n];if(p!==g){d=p.bounds;h=p.focus;l=d.x+h.x;var r=d.y+h.y;if(k-l>c||l-k>c){if(e)break}else if(m-r>c||r-m>c){if(!e)break}else{var q=Xr(g,p);1>q?(d=a.randomNumberGenerator,null===d&&(a.randomNumberGenerator=d=new Zr),q=d.random(),
      h=d.random(),k>l?(d=Math.abs(p.bounds.right-g.bounds.x),d=(1+d)*q):k<l?(d=Math.abs(p.bounds.x-g.bounds.right),d=-(1+d)*q):(d=Math.max(p.width,g.width),d=(1+d)*q-d/2),m>r?(l=Math.abs(p.bounds.bottom-g.bounds.y),l=(1+l)*h):k<l?(l=Math.abs(p.bounds.y-g.bounds.bottom),l=-(1+l)*h):(l=Math.max(p.height,g.height),l=(1+l)*h-l/2)):(h=-(g.charge*p.charge)/(q*q),d=(l-k)/q*h,l=(r-m)/q*h);g.forceX+=d;g.forceY+=l;p.forceX-=d;p.forceY-=l}}}}for(e=a.network.edges.iterator;e.next();)h=e.value,c=h.fromVertex,f=h.toVertex,
      g=c.bounds,k=c.focus,d=g.x+k.x,g=g.y+k.y,m=f.bounds,n=f.focus,k=m.x+n.x,m=m.y+n.y,n=Xr(c,f),1>n?(n=a.randomNumberGenerator,null===n&&(a.randomNumberGenerator=n=new Zr),h=n.random(),n=n.random(),d=(d>k?1:-1)*(1+(f.width>c.width?f.width:c.width))*h,l=(g>m?1:-1)*(1+(f.height>c.height?f.height:c.height))*n):(h=h.stiffness*(n-h.length),d=(k-d)/n*h,l=(m-g)/n*h),c.forceX+=d,c.forceY+=l,f.forceX-=d,f.forceY-=l;d=0;e=a.moveLimit;for(c=0;c<b.length;c++)f=b[c],a.isFixed(f)?a.moveFixedVertex(f):(g=f.forceX,k=
      f.forceY,g<-e?g=-e:g>e&&(g=e),k<-e?k=-e:k>e&&(k=e),f.centerX+=g,f.centerY+=k,d=Math.max(d,g*g+k*k));return d>a.epsilonDistance*a.epsilonDistance}Nr.prototype.moveFixedVertex=function(){};Nr.prototype.commitLayout=function(){this.iw();this.commitNodes();this.isRouting&&this.commitLinks()};Nr.prototype.iw=function(){if(this.setsPortSpots)for(var a=this.network.edges.iterator;a.next();){var b=a.value.link;null!==b&&(b.fromSpot=$c,b.toSpot=$c)}};
    Nr.prototype.commitNodes=function(){var a=0,b=0;if(this.arrangesToOrigin){var c=N.alloc();this.computeBounds(this.network,c);b=this.arrangementOrigin;a=b.x-c.x;b=b.y-c.y;N.free(c)}c=N.alloc();for(var d=this.network.vertexes.iterator;d.next();){var e=d.value;if(0!==a||0!==b)c.assign(e.bounds),c.x+=a,c.y+=b,e.bounds=c;e.commit()}N.free(c)};Nr.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};
    Nr.prototype.springStiffness=function(a){a=a.stiffness;return isNaN(a)?this.Uk:a};Nr.prototype.springLength=function(a){a=a.length;return isNaN(a)?this.Tk:a};Nr.prototype.electricalCharge=function(a){a=a.charge;return isNaN(a)?this.Rk:a};Nr.prototype.electricalFieldX=function(){return 0};Nr.prototype.electricalFieldY=function(){return 0};Nr.prototype.gravitationalMass=function(a){a=a.mass;return isNaN(a)?this.Sk:a};Nr.prototype.gravitationalFieldX=function(){return 0};
    Nr.prototype.gravitationalFieldY=function(){return 0};Nr.prototype.isFixed=function(a){return a.isFixed};
    ma.Object.defineProperties(Nr.prototype,{currentIteration:{get:function(){return this.jo}},arrangementSpacing:{get:function(){return this.Ad},set:function(a){this.Ad.w(a)||(this.Ad.assign(a),this.C())}},arrangesToOrigin:{get:function(){return this.Xm},set:function(a){this.Xm!==a&&(this.Xm=a,this.C())}},setsPortSpots:{get:function(){return this.df},set:function(a){this.df!==a&&(this.df=
          a,this.C())}},comments:{get:function(){return this.Zc},set:function(a){this.Zc!==a&&(this.Zc=a,this.C())}},maxIterations:{get:function(){return this.yl},set:function(a){this.yl!==a&&0<=a&&(this.yl=a,this.C())}},epsilonDistance:{get:function(){return this.Fn},set:function(a){this.Fn!==a&&0<a&&(this.Fn=a,this.C())}},infinityDistance:{get:function(){return this.Uf},set:function(a){this.Uf!==
        a&&1<a&&(this.Uf=a,this.C())}},moveLimit:{get:function(){return this.Ho},set:function(a){this.Ho!==a&&1<a&&(this.Ho=a,this.C())}},randomNumberGenerator:{get:function(){return this.hp},set:function(a){this.hp!==a&&(null!==a&&"function"!==typeof a.random&&B('ForceDirectedLayout.randomNumberGenerator must have a "random()" function on it: '+a),this.hp=a)}},defaultSpringStiffness:{get:function(){return this.Uk},
        set:function(a){this.Uk!==a&&(this.Uk=a,this.C())}},defaultSpringLength:{get:function(){return this.Tk},set:function(a){this.Tk!==a&&(this.Tk=a,this.C())}},defaultElectricalCharge:{get:function(){return this.Rk},set:function(a){this.Rk!==a&&(this.Rk=a,this.C())}},defaultGravitationalMass:{get:function(){return this.Sk},set:function(a){this.Sk!==a&&(this.Sk=a,this.C())}},defaultCommentSpringLength:{
        get:function(){return this.wn},set:function(a){this.wn!==a&&(this.wn=a,this.C())}},defaultCommentElectricalCharge:{get:function(){return this.vn},set:function(a){this.vn!==a&&(this.vn=a,this.C())}}});Nr.className="ForceDirectedLayout";function Wr(){this.Cw=this.Bw=this.St=this.Ut=this.Tt=0}Wr.className="ForceDirectedSubnet";function Or(a){Qp.call(this,a)}la(Or,Qp);Or.prototype.createVertex=function(){return new $r(this)};Or.prototype.createEdge=function(){return new as(this)};
    Or.className="ForceDirectedNetwork";function $r(a){Tp.call(this,a);this.Ia=!1;this.Za=this.I=NaN;this.Kh=this.xd=this.Ha=this.Y=0;this.Ge=this.$j=null;this.ew=0}la($r,Tp);
    ma.Object.defineProperties($r.prototype,{isFixed:{get:function(){return this.Ia},set:function(a){this.Ia!==a&&(this.Ia=a)}},charge:{get:function(){return this.I},set:function(a){this.I!==a&&(this.I=a)}},mass:{get:function(){return this.Za},set:function(a){this.Za!==a&&(this.Za=a)}},forceX:{get:function(){return this.Y},set:function(a){this.Y!==a&&(this.Y=a)}},forceY:{
        get:function(){return this.Ha},set:function(a){this.Ha!==a&&(this.Ha=a)}}});$r.className="ForceDirectedVertex";function as(a){Up.call(this,a);this.l=this.v=NaN}la(as,Up);ma.Object.defineProperties(as.prototype,{stiffness:{get:function(){return this.v},set:function(a){this.v!==a&&(this.v=a)}},length:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a)}}});as.className="ForceDirectedEdge";
    function Zr(){var a=0;void 0===a&&(a=42);this.seed=a;this.uy=48271;this.wy=2147483647;this.Q=44488.07041494893;this.yy=3399;this.vy=1/2147483647;this.random()}Zr.prototype.random=function(){var a=this.seed%this.Q*this.uy-this.seed/this.Q*this.yy;0<a?this.seed=a:this.seed=a+this.wy;return this.seed*this.vy};Zr.className="RandomNumberGenerator";
    function bs(){Fi.call(this);this.Zb=this.ne=25;this.J=0;this.Pk=cs;this.tl=ds;this.il=es;this.zj=4;this.Ek=fs;this.kg=7;this.df=!0;this.ro=4;this.Da=this.Zr=this.xa=-1;this.sd=this.Co=0;this.Ga=this.qd=this.rd=this.Ld=this.gc=null;this.Mo=0;this.Lo=this.Ej=null;this.Pd=0;this.No=null;this.Hf=new I;this.qe=[];this.qe.length=100}la(bs,Fi);
    bs.prototype.cloneProtected=function(a){Fi.prototype.cloneProtected.call(this,a);a.ne=this.ne;a.Zb=this.Zb;a.J=this.J;a.Pk=this.Pk;a.tl=this.tl;a.il=this.il;a.zj=this.zj;a.Ek=this.Ek;a.kg=this.kg;a.df=this.df;a.ro=this.ro};
    bs.prototype.cb=function(a){a.classType===bs?0===a.name.indexOf("Aggressive")?this.aggressiveOption=a:0===a.name.indexOf("Cycle")?this.cycleRemoveOption=a:0===a.name.indexOf("Init")?this.initializeOption=a:0===a.name.indexOf("Layer")?this.layeringOption=a:B("Unknown enum value: "+a):Fi.prototype.cb.call(this,a)};bs.prototype.createNetwork=function(){return new gs(this)};
    bs.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);this.Zr=-1;this.sd=this.Co=0;this.No=this.Lo=this.Ej=null;for(a=0;a<this.qe.length;a++)this.qe[a]=null;if(0<this.network.vertexes.count){this.network.iq();this.cycleRemoveOption!==hs&&this.removeCycles();for(a=this.network.vertexes.iterator;a.next();)a.value.layer=-1;this.xa=-1;this.assignLayers();for(a.reset();a.next();)this.xa=Math.max(this.xa,
      a.value.layer);this.cycleRemoveOption===hs&&this.removeCycles();a=this.network;for(var b=[],c=a.edges.iterator;c.next();){var d=c.value;d.valid=!1;b.push(d)}for(c=0;c<b.length;c++){d=b[c];var e=d.fromVertex,f=d.toVertex;if(!d.valid&&(null!==e.node&&null!==f.node||e.layer!==f.layer)){var g=0,h=0,k=0,l=0;if(null!==d.link){h=d.link;if(null===h)continue;var m=e.node;g=f.node;if(null===m||null===g)continue;var n=h.fromNode;k=h.toNode;var p=h.fromPort;h=h.toPort;if(d.rev){l=n;var r=p;n=k;p=h;k=l;h=r}var q=
      e.focus;l=f.focus;var u=d.rev?f.bounds:e.bounds;r=I.alloc();m!==n?u.u()&&n.isVisible()?n.actualBounds.u()?(n.wf(p,Ac,r),r.x+=n.actualBounds.x-u.x,r.y+=n.actualBounds.y-u.y):(n.wf(p,Ac,r),r.u()||r.assign(q)):r.assign(q):u.u()?(n.wf(p,Ac,r),r.u()||r.assign(q)):r.assign(q);n=d.rev?e.bounds:f.bounds;m=I.alloc();g!==k?n.u()&&k.isVisible()?k.actualBounds.u()?(k.wf(h,Ac,m),m.x+=k.actualBounds.x-n.x,m.y+=k.actualBounds.y-n.y):(k.wf(h,Ac,m),m.u()||m.assign(l)):m.assign(l):n.u()?(k.wf(h,Ac,m),m.u()||m.assign(l)):
      m.assign(l);90===this.J||270===this.J?(g=Math.round((r.x-q.x)/this.Zb),k=r.x,h=Math.round((m.x-l.x)/this.Zb),l=m.x):(g=Math.round((r.y-q.y)/this.Zb),k=r.y,h=Math.round((m.y-l.y)/this.Zb),l=m.y);I.free(r);I.free(m);d.portFromColOffset=g;d.portFromPos=k;d.portToColOffset=h;d.portToPos=l}else d.portFromColOffset=0,d.portFromPos=0,d.portToColOffset=0,d.portToPos=0;r=e.layer;m=f.layer;n=0;u=d.link;if(null!==u){var v=u.fromPort,w=u.toPort;if(null!==v&&null!==w){var y=u.fromNode;p=u.toNode;if(null!==y&&
      null!==p){var z=is(this,!0),A=is(this,!1),C=this.setsPortSpots?z:u.computeSpot(!0,v);q=this.setsPortSpots?A:u.computeSpot(!1,w);var H=u.isOrthogonal;C.gd()&&C.xf(A)&&q.gd()&&q.xf(z)?n=0:(z=u.getLinkPoint(y,v,C,!0,H,p,w,I.alloc()),A=u.getLinkDirection(y,v,z,C,!0,H,p,w),I.free(z),C.xt()||A!==js(this,d,!0)?this.setsPortSpots&&null!==y&&1===y.ports.count&&d.rev&&(n+=1):n+=1,C=u.getLinkPoint(p,w,q,!1,H,y,v,I.alloc()),u=u.getLinkDirection(p,w,C,q,!1,H,y,v),I.free(C),q.xt()||u!==js(this,d,!1)?this.setsPortSpots&&
      null!==p&&1===p.ports.count&&d.rev&&(n+=2):n+=2)}}}p=n;n=1===p||3===p?!0:!1;if(p=2===p||3===p?!0:!1)q=a.createVertex(),q.node=null,q.Wj=1,q.layer=r,q.near=e,a.Ch(q),e=a.mk(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.Wj=2;q.layer=r-1;a.Ch(q);e=a.mk(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.Wj=3,q.layer=r-1,a.Ch(q),e=a.mk(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.mk(q,f,d.link);e.valid=!n;n&&(q.near=f);e.rev=d.rev;e.portFromColOffset=0;e.portToColOffset=h;e.portFromPos=0;e.portToPos=l}else d.valid=!0}}a=this.gc=[];for(b=0;b<=this.xa;b++)a[b]=0;for(b=this.network.vertexes.iterator;b.next();)b.value.index=-1;this.initializeIndices();this.Zr=-1;for(c=this.sd=
      this.Co=0;c<=this.xa;c++)a[c]>a[this.sd]&&(this.Zr=a[c]-1,this.sd=c),a[c]<a[this.Co]&&(this.Co=c);this.No=[];for(c=0;c<a.length;c++)this.No[c]=[];for(b.reset();b.next();)a=b.value,this.No[a.layer][a.index]=a;this.Da=-1;for(a=0;a<=this.xa;a++){b=ks(this,a);c=0;d=this.gc[a];for(f=0;f<d;f++)e=b[f],c+=this.nodeMinColumnSpace(e,!0),e.column=c,c+=1,c+=this.nodeMinColumnSpace(e,!1);this.Da=Math.max(this.Da,c-1);ls(this,a,b)}this.reduceCrossings();this.straightenAndPack();this.updateParts()}this.network=
      null;this.isValidLayout=!0};bs.prototype.linkMinLength=function(){return 1};function ms(a){var b=a.fromVertex.node;a=a.toVertex.node;return null===b&&null===a?8:null===b||null===a?4:1}bs.prototype.nodeMinLayerSpace=function(a,b){return null===a.node?0:90===this.J||270===this.J?b?a.focus.y+10:a.bounds.height-a.focus.y+10:b?a.focus.x+10:a.bounds.width-a.focus.x+10};
    bs.prototype.nodeMinColumnSpace=function(a,b){if(null===a.node)return 0;var c=b?a.Rv:a.Qv;if(null!==c)return c;c=this.J;return 90===c||270===c?b?a.Rv=a.focus.x/this.Zb+1|0:a.Qv=(a.bounds.width-a.focus.x)/this.Zb+1|0:b?a.Rv=a.focus.y/this.Zb+1|0:a.Qv=(a.bounds.height-a.focus.y)/this.Zb+1|0};function ns(a){null===a.Ej&&(a.Ej=[]);for(var b=0,c=a.network.vertexes.iterator;c.next();){var d=c.value;a.Ej[b]=d.layer;b++;a.Ej[b]=d.column;b++;a.Ej[b]=d.index;b++}return a.Ej}
    function os(a,b){var c=0;for(a=a.network.vertexes.iterator;a.next();){var d=a.value;d.layer=b[c];c++;d.column=b[c];c++;d.index=b[c];c++}}
    function ps(a,b,c){var d=ks(a,b),e=a.gc[b];if(null===a.Lo||a.Lo.length<e*e)a.Lo=[];for(var f=a.Lo,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.Wj===l.Wj||h++}else for(m=g-1;m>k;m--)n=d[m],n.near===l&&n.Wj===l.Wj||h++;var p;if(0<=c)for(k=d[g].sourceEdgesArrayAccess,l=0;l<k.length;l++){var r=k[l];if(r.valid&&r.fromVertex.layer!==b)for(n=r.fromVertex.index,m=r.portToPos,r=r.portFromPos,p=l+1;p<k.length;p++){var q=
      k[p];if(q.valid&&q.fromVertex.layer!==b){var u=q.fromVertex.index;var v=q.portToPos;q=q.portFromPos;m<v&&(n>u||n===u&&r>q)&&h++;v<m&&(u>n||u===n&&q>r)&&h++}}}if(0>=c)for(k=d[g].destinationEdgesArrayAccess,l=0;l<k.length;l++)if(r=k[l],r.valid&&r.toVertex.layer!==b)for(n=r.toVertex.index,m=r.portToPos,r=r.portFromPos,p=l+1;p<k.length;p++)q=k[p],q.valid&&q.toVertex.layer!==b&&(u=q.toVertex.index,v=q.portToPos,q=q.portFromPos,r<q&&(n>u||n===u&&m>v)&&h++,q<r&&(u>n||u===n&&v>m)&&h++);f[g*e+g]=h;for(k=g+
      1;k<e;k++){var w=0,y=0;if(0<=c){h=d[g].sourceEdgesArrayAccess;var z=d[k].sourceEdgesArrayAccess;for(l=0;l<h.length;l++)if(r=h[l],r.valid&&r.fromVertex.layer!==b)for(n=r.fromVertex.index,r=r.portFromPos,p=0;p<z.length;p++)q=z[p],q.valid&&q.fromVertex.layer!==b&&(u=q.fromVertex.index,q=q.portFromPos,(n<u||n===u&&r<q)&&y++,(u<n||u===n&&q<r)&&w++)}if(0>=c)for(h=d[g].destinationEdgesArrayAccess,z=d[k].destinationEdgesArrayAccess,l=0;l<h.length;l++)if(r=h[l],r.valid&&r.toVertex.layer!==b)for(n=r.toVertex.index,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   m=r.portToPos,p=0;p<z.length;p++)q=z[p],q.valid&&q.toVertex.layer!==b&&(u=q.toVertex.index,v=q.portToPos,(n<u||n===u&&m<v)&&y++,(u<n||u===n&&v<m)&&w++);f[g*e+k]=w;f[k*e+g]=y}}ls(a,b,d);return f}bs.prototype.countCrossings=function(){for(var a=0,b=0;b<=this.xa;b++)for(var c=ps(this,b,1),d=this.gc[b],e=0;e<d;e++)for(var f=e;f<d;f++)a+=c[e*d+f];return a};
    function qs(a){for(var b=0,c=0;c<=a.xa;c++){for(var d=a,e=c,f=ks(d,e),g=d.gc[e],h=0,k=0;k<g;k++){var l=f[k].destinationEdgesArrayAccess;if(null!==l)for(var m=0;m<l.length;m++){var n=l[m];if(n.valid&&n.toVertex.layer!==e){var p=n.fromVertex.column+n.portFromColOffset;var r=n.toVertex.column+n.portToColOffset;h+=(Math.abs(p-r)+1)*ms(n)}}}ls(d,e,f);b+=h}return b}
    bs.prototype.normalize=function(){var a=Infinity;this.Da=-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.Da=Math.max(this.Da,c.column+this.nodeMinColumnSpace(c,!1))}for(b.reset();b.next();)b.value.column-=a;this.Da-=a};
    function rs(a,b,c){for(var d=ks(a,b),e=a.gc[b],f=[],g=0;g<e;g++){var h=d[g],k=null;0>=c&&(k=h.sourceEdgesArrayAccess);var l=null;0<=c&&(l=h.destinationEdgesArrayAccess);var m=0,n=0,p=h.near;null!==p&&p.layer===h.layer&&(m+=p.column-1,n++);if(null!==k)for(p=0;p<k.length;p++){h=k[p];var r=h.fromVertex;h.valid&&!h.rev&&r.layer!==b&&(m+=r.column,n++)}if(null!==l)for(k=0;k<l.length;k++)h=l[k],p=h.toVertex,h.valid&&!h.rev&&p.layer!==b&&(m+=p.column,n++);f[g]=0===n?-1:m/n}ls(a,b,d);return f}
    function ss(a,b,c){for(var d=ks(a,b),e=a.gc[b],f=[],g=0;g<e;g++){var h=d[g],k=null;0>=c&&(k=h.sourceEdgesArrayAccess);var l=null;0<=c&&(l=h.destinationEdgesArrayAccess);var m=0,n=[],p=h.near;null!==p&&p.layer===h.layer&&(n[m]=p.column-1,m++);h=void 0;if(null!==k)for(p=0;p<k.length;p++){h=k[p];var r=h.fromVertex;h.valid&&!h.rev&&r.layer!==b&&(n[m]=r.column+h.portFromColOffset,m++)}if(null!==l)for(k=0;k<l.length;k++)h=l[k],p=h.toVertex,h.valid&&!h.rev&&p.layer!==b&&(n[m]=p.column+h.portToColOffset,
      m++);0===m?f[g]=-1:(n.sort(function(a,b){return a-b}),l=m>>1,f[g]=0!==(m&1)?n[l]:n[l-1]+n[l]>>1)}ls(a,b,d);return f}function ts(a,b,c,d,e,f){if(b.component===d){b.component=c;if(e)for(var g=b.destinationEdges;g.next();){var h=g.value;var k=h.toVertex;var l=b.layer-k.layer;h=a.linkMinLength(h);l===h&&ts(a,k,c,d,e,f)}if(f)for(g=b.sourceEdges;g.next();)h=g.value,k=h.fromVertex,l=k.layer-b.layer,h=a.linkMinLength(h),l===h&&ts(a,k,c,d,e,f)}}
    function us(a,b,c,d,e,f){if(b.component===d){b.component=c;if(e)for(var g=b.destinationEdges;g.next();)us(a,g.value.toVertex,c,d,e,f);if(f)for(b=b.sourceEdges;b.next();)us(a,b.value.fromVertex,c,d,e,f)}}
    bs.prototype.removeCycles=function(){for(var a=this.network.edges.iterator;a.next();)a.value.rev=!1;switch(this.Pk){default:case vs:a=this.network;var b=0,c=a.vertexes.count-1,d=[];d.length=c+1;for(var e=a.vertexes.iterator;e.next();)e.value.valid=!0;for(;null!==ws(a);){for(e=xs(a);null!==e;)d[c]=e,c--,e.valid=!1,e=xs(a);for(e=ys(a);null!==e;)d[b]=e,b++,e.valid=!1,e=ys(a);e=null;for(var f=0,g=this.network.vertexes.iterator;g.next();){var h=g.value;if(h.valid){for(var k=0,l=h.destinationEdges;l.next();)l.value.toVertex.valid&&
    k++;l=0;for(var m=h.sourceEdges;m.next();)m.value.fromVertex.valid&&l++;if(null===e||f<k-l)e=h,f=k-l}}null!==e&&(d[b]=e,b++,e.valid=!1)}for(b=0;b<a.vertexes.count;b++)d[b].index=b;for(d=a.edges.iterator;d.next();)b=d.value,b.fromVertex.index>b.toVertex.index&&(a.Em(b),b.rev=!0);break;case cs:for(d=this.network.vertexes.iterator;d.next();)a=d.value,a.fm=-1,a.finish=-1;for(a=this.network.edges.iterator;a.next();)a.value.forest=!1;this.Mo=0;for(d.reset();d.next();)b=d.value,0===b.sourceEdges.count&&
    zs(this,b);for(d.reset();d.next();)b=d.value,-1===b.fm&&zs(this,b);for(a.reset();a.next();)d=a.value,d.forest||(b=d.fromVertex,c=b.finish,e=d.toVertex,f=e.finish,e.fm<b.fm&&c<f&&(this.network.Em(d),d.rev=!0));break;case hs:a=this.network;b=a.vertexes.iterator;for(d=Infinity;b.next();)d=Math.min(d,b.value.layer);if(Infinity>d){if(0>d)for(b.reset();b.next();)b.value.layer-=d;d=[];for(b.reset();b.next();)c=b.value,e=d[c.layer],void 0===e?d[c.layer]=[c]:e.push(c);for(c=b=0;c<d.length;c++)if(e=d[c],!e||
    0===e.length)b++;else if(0<c)for(f=0;f<e.length;f++)e[f].layer-=b;for(d=a.edges.iterator;d.next();)b=d.value,b.fromVertex.layer<b.toVertex.layer&&(a.Em(b),b.rev=!0)}}};function ws(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid)return b}return null}function xs(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid){for(var c=!0,d=b.destinationEdges;d.next();)if(d.value.toVertex.valid){c=!1;break}if(c)return b}}return null}
    function ys(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid){for(var c=!0,d=b.sourceEdges;d.next();)if(d.value.fromVertex.valid){c=!1;break}if(c)return b}}return null}function zs(a,b){b.fm=a.Mo;a.Mo++;for(var c=b.destinationEdges;c.next();){var d=c.value,e=d.toVertex;-1===e.fm&&(d.forest=!0,zs(a,e))}b.finish=a.Mo;a.Mo++}
    bs.prototype.assignLayers=function(){switch(this.tl){case As:Bs(this);break;case Cs:for(var a,b=this.network.vertexes.iterator;b.next();)a=Ds(this,b.value),this.xa=Math.max(a,this.xa);for(b.reset();b.next();)a=b.value,a.layer=this.xa-a.layer;break;default:case ds:Bs(this);for(b=this.network.vertexes.iterator;b.next();)b.value.valid=!1;for(b.reset();b.next();)a=b.value,0===a.sourceEdges.count&&Es(this,a);a=Infinity;for(b.reset();b.next();)a=Math.min(a,b.value.layer);this.xa=-1;for(b.reset();b.next();){var c=
      b.value;c.layer-=a;this.xa=Math.max(this.xa,c.layer)}}};function Bs(a){for(var b=a.network.vertexes.iterator;b.next();){var c=Fs(a,b.value);a.xa=Math.max(c,a.xa)}}function Fs(a,b){var c=0;if(-1===b.layer){for(var d=b.destinationEdges;d.next();){var e=d.value,f=e.toVertex;e=a.linkMinLength(e);c=Math.max(c,Fs(a,f)+e)}b.layer=c}else c=b.layer;return c}
    function Ds(a,b){var c=0;if(-1===b.layer){for(var d=b.sourceEdges;d.next();){var e=d.value,f=e.fromVertex;e=a.linkMinLength(e);c=Math.max(c,Ds(a,f)+e)}b.layer=c}else c=b.layer;return c}
    function Es(a,b){if(!b.valid){b.valid=!0;for(var c=b.destinationEdges;c.next();)Es(a,c.value.toVertex);for(c=a.network.vertexes.iterator;c.next();)c.value.component=-1;for(var d=b.sourceEdgesArrayAccess,e=d.length,f=0;f<e;f++){var g=d[f],h=g.fromVertex,k=g.toVertex;g=a.linkMinLength(g);h.layer-k.layer>g&&ts(a,h,0,-1,!0,!1)}for(ts(a,b,1,-1,!0,!0);0!==b.component;){f=0;d=Infinity;h=0;k=null;for(g=a.network.vertexes.iterator;g.next();){var l=g.value;if(1===l.component){var m=0,n=!1,p=l.sourceEdgesArrayAccess;
      e=p.length;for(var r=0;r<e;r++){var q=p[r],u=q.fromVertex;m+=1;1!==u.component&&(f+=1,u=u.layer-l.layer,q=a.linkMinLength(q),d=Math.min(d,u-q))}p=l.destinationEdgesArrayAccess;e=p.length;for(r=0;r<e;r++)q=p[r].toVertex,--m,1!==q.component?--f:n=!0;(null===k||m<h)&&!n&&(k=l,h=m)}}if(0<f){for(c.reset();c.next();)e=c.value,1===e.component&&(e.layer+=d);b.component=0}else k.component=0}for(c=a.network.vertexes.iterator;c.next();)c.value.component=-1;for(ts(a,b,1,-1,!0,!1);0!==b.component;){d=0;e=Infinity;
      f=0;h=null;for(k=a.network.vertexes.iterator;k.next();)if(g=k.value,1===g.component){l=0;m=!1;p=g.sourceEdgesArrayAccess;n=p.length;for(r=0;r<n;r++)q=p[r].fromVertex,l+=1,1!==q.component?d+=1:m=!0;p=g.destinationEdgesArrayAccess;n=p.length;for(r=0;r<n;r++)q=p[r],u=q.toVertex,--l,1!==u.component&&(--d,u=g.layer-u.layer,q=a.linkMinLength(q),e=Math.min(e,u-q));(null===h||l>f)&&!m&&(h=g,f=l)}if(0>d){for(c.reset();c.next();)d=c.value,1===d.component&&(d.layer-=e);b.component=0}else h.component=0}}}
    function js(a,b,c){return 90===a.J?c&&!b.rev||!c&&b.rev?270:90:180===a.J?c&&!b.rev||!c&&b.rev?0:180:270===a.J?c&&!b.rev||!c&&b.rev?90:270:c&&!b.rev||!c&&b.rev?180:0}
    bs.prototype.initializeIndices=function(){switch(this.il){default:case Gs:for(var a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;b.index=this.gc[c];this.gc[c]++}break;case es:a=this.network.vertexes.iterator;for(b=this.xa;0<=b;b--)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&Hs(this,c);break;case Is:for(a=this.network.vertexes.iterator,b=0;b<=this.xa;b++)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&Js(this,c)}};
    function Hs(a,b){var c=b.layer;b.index=a.gc[c];a.gc[c]++;b=b.destinationEdgesArrayAccess;for(c=!0;c;){c=!1;for(var d=0;d<b.length-1;d++){var e=b[d],f=b[d+1];e.portFromColOffset>f.portFromColOffset&&(c=!0,b[d]=f,b[d+1]=e)}}for(c=0;c<b.length;c++)d=b[c],d.valid&&(d=d.toVertex,-1===d.index&&Hs(a,d))}
    function Js(a,b){var c=b.layer;b.index=a.gc[c];a.gc[c]++;b=b.sourceEdgesArrayAccess;for(var d=!0;d;)for(d=!1,c=0;c<b.length-1;c++){var e=b[c],f=b[c+1];e.portToColOffset>f.portToColOffset&&(d=!0,b[c]=f,b[c+1]=e)}for(c=0;c<b.length;c++)d=b[c],d.valid&&(d=d.fromVertex,-1===d.index&&Js(a,d))}
    bs.prototype.reduceCrossings=function(){var a=this.countCrossings(),b=ns(this),c,d;for(c=0;c<this.zj;c++){for(d=0;d<=this.xa;d++)Ks(this,d,1),Ls(this,d,1);var e=this.countCrossings();e<a&&(a=e,b=ns(this));for(d=this.xa;0<=d;d--)Ks(this,d,-1),Ls(this,d,-1);e=this.countCrossings();e<a&&(a=e,b=ns(this))}os(this,b);for(c=0;c<this.zj;c++){for(d=0;d<=this.xa;d++)Ks(this,d,0),Ls(this,d,0);e=this.countCrossings();e<a&&(a=e,b=ns(this));for(d=this.xa;0<=d;d--)Ks(this,d,0),Ls(this,d,0);e=this.countCrossings();
      e<a&&(a=e,b=ns(this))}os(this,b);var f,g,h;switch(this.Ek){case Ms:break;case Ns:for(h=a+1;(d=this.countCrossings())<h;)for(h=d,c=this.xa;0<=c;c--)for(g=0;g<=c;g++){for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Ls(this,d,-1)||f;e=this.countCrossings();e>=a?os(this,b):(a=e,b=ns(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Ls(this,d,1)||f;e=this.countCrossings();e>=a?os(this,b):(a=e,b=ns(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Ls(this,d,1)||f;e>=a?os(this,b):(a=e,b=ns(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=
      Ls(this,d,-1)||f;e>=a?os(this,b):(a=e,b=ns(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Ls(this,d,0)||f;e>=a?os(this,b):(a=e,b=ns(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Ls(this,d,0)||f;e>=a?os(this,b):(a=e,b=ns(this))}break;default:case fs:for(c=this.xa,g=0,h=a+1;(d=this.countCrossings())<h;){h=d;for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Ls(this,d,-1)||f;e=this.countCrossings();e>=a?os(this,b):(a=e,b=ns(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Ls(this,d,1)||f;e=this.countCrossings();e>=a?os(this,b):
      (a=e,b=ns(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Ls(this,d,1)||f;e>=a?os(this,b):(a=e,b=ns(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Ls(this,d,-1)||f;e>=a?os(this,b):(a=e,b=ns(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Ls(this,d,0)||f;e>=a?os(this,b):(a=e,b=ns(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Ls(this,d,0)||f;e>=a?os(this,b):(a=e,b=ns(this))}}os(this,b)};
    function Ks(a,b,c){var d=ks(a,b),e=a.gc[b],f=ss(a,b,c),g=rs(a,b,c);for(c=0;c<e;c++)-1===g[c]&&(g[c]=d[c].column),-1===f[c]&&(f[c]=d[c].column);for(var h=!0,k;h;)for(h=!1,c=0;c<e-1;c++)if(f[c+1]<f[c]||f[c+1]===f[c]&&g[c+1]<g[c])h=!0,k=f[c],f[c]=f[c+1],f[c+1]=k,k=g[c],g[c]=g[c+1],g[c+1]=k,k=d[c],d[c]=d[c+1],d[c+1]=k;for(c=f=0;c<e;c++)k=d[c],k.index=c,f+=a.nodeMinColumnSpace(k,!0),k.column=f,f+=1,f+=a.nodeMinColumnSpace(k,!1);ls(a,b,d)}
    function Ls(a,b,c){var d=ks(a,b),e=a.gc[b];c=ps(a,b,c);var f;var g=[];for(f=0;f<e;f++)g[f]=-1;var h=[];for(f=0;f<e;f++)h[f]=-1;for(var k=!1,l=!0;l;)for(l=!1,f=0;f<e-1;f++){var m=c[d[f].index*e+d[f+1].index],n=c[d[f+1].index*e+d[f].index],p=0,r=0,q=d[f].column,u=d[f+1].column,v=a.nodeMinColumnSpace(d[f],!0),w=a.nodeMinColumnSpace(d[f],!1),y=a.nodeMinColumnSpace(d[f+1],!0),z=a.nodeMinColumnSpace(d[f+1],!1);v=q-v+y;w=u-w+z;var A=d[f].sourceEdges.iterator;for(A.reset();A.next();)if(y=A.value,z=y.fromVertex,
    y.valid&&z.layer===b){for(y=0;d[y]!==z;)y++;y<f&&(p+=2*(f-y),r+=2*(f+1-y));y===f+1&&(p+=1);y>f+1&&(p+=4*(y-f),r+=4*(y-(f+1)))}A=d[f].destinationEdges.iterator;for(A.reset();A.next();)if(y=A.value,z=y.toVertex,y.valid&&z.layer===b){for(y=0;d[y]!==z;)y++;y===f+1&&(r+=1)}A=d[f+1].sourceEdges.iterator;for(A.reset();A.next();)if(y=A.value,z=y.fromVertex,y.valid&&z.layer===b){for(y=0;d[y]!==z;)y++;y<f&&(p+=2*(f+1-y),r+=2*(f-y));y===f&&(r+=1);y>f+1&&(p+=4*(y-(f+1)),r+=4*(y-f))}A=d[f+1].destinationEdges.iterator;
      for(A.reset();A.next();)if(y=A.value,z=y.toVertex,y.valid&&z.layer===b){for(y=0;d[y]!==z;)y++;y===f&&(p+=1)}y=z=0;A=g[d[f].index];var C=h[d[f].index],H=g[d[f+1].index],L=h[d[f+1].index];-1!==A&&(z+=Math.abs(A-q),y+=Math.abs(A-w));-1!==C&&(z+=Math.abs(C-q),y+=Math.abs(C-w));-1!==H&&(z+=Math.abs(H-u),y+=Math.abs(H-v));-1!==L&&(z+=Math.abs(L-u),y+=Math.abs(L-v));if(r<p-.5||r===p&&n<m-.5||r===p&&n===m&&y<z-.5)l=k=!0,d[f].column=w,d[f+1].column=v,m=d[f],d[f]=d[f+1],d[f+1]=m}for(f=0;f<e;f++)d[f].index=
      f;ls(a,b,d);return k}
    bs.prototype.straightenAndPack=function(){var a=0!==(this.kg&1);var b=7===this.kg;1E3<this.network.edges.count&&!b&&(a=!1);if(a){var c=[];for(b=0;b<=this.xa;b++)c[b]=0;for(var d,e=this.network.vertexes.iterator;e.next();){var f=e.value;b=f.layer;d=f.column;f=this.nodeMinColumnSpace(f,!1);c[b]=Math.max(c[b],d+f)}for(e.reset();e.next();)f=e.value,b=f.layer,d=f.column,f.column=(8*(this.Da-c[b])>>1)+8*d;this.Da*=8}if(0!==(this.kg&2))for(c=!0;c;){c=!1;for(b=this.sd+1;b<=this.xa;b++)c=Os(this,b,1)||c;for(b=
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              this.sd-1;0<=b;b--)c=Os(this,b,-1)||c;c=Os(this,this.sd,0)||c}if(0!==(this.kg&4)){for(b=this.sd+1;b<=this.xa;b++)Ps(this,b,1);for(b=this.sd-1;0<=b;b--)Ps(this,b,-1);Ps(this,this.sd,0)}a&&(Qs(this,-1),Qs(this,1));if(0!==(this.kg&2))for(c=!0;c;){c=!1;c=Os(this,this.sd,0)||c;for(b=this.sd+1;b<=this.xa;b++)c=Os(this,b,0)||c;for(b=this.sd-1;0<=b;b--)c=Os(this,b,0)||c}};function Os(a,b,c){for(var d=!1;Rs(a,b,c);)d=!0;return d}
    function Rs(a,b,c){var d,e=ks(a,b),f=a.gc[b],g=rs(a,b,-1);if(0<c)for(d=0;d<f;d++)g[d]=-1;var h=rs(a,b,1);if(0>c)for(d=0;d<f;d++)h[d]=-1;for(var k=!1,l=!0;l;)for(l=!1,d=0;d<f;d++){var m=e[d].column,n=a.nodeMinColumnSpace(e[d],!0),p=a.nodeMinColumnSpace(e[d],!1),r=0;0>d-1||m-e[d-1].column-1>n+a.nodeMinColumnSpace(e[d-1],!1)?r=m-1:r=m;n=d+1>=f||e[d+1].column-m-1>p+a.nodeMinColumnSpace(e[d+1],!0)?m+1:m;var q=p=0,u=0;if(0>=c)for(var v=e[d].sourceEdges.iterator;v.next();){var w=v.value;var y=w.fromVertex;
      if(w.valid&&y.layer!==b){var z=ms(w);var A=w.portFromColOffset;w=w.portToColOffset;y=y.column;p+=(Math.abs(m+w-(y+A))+1)*z;q+=(Math.abs(r+w-(y+A))+1)*z;u+=(Math.abs(n+w-(y+A))+1)*z}}if(0<=c)for(v=e[d].destinationEdges.iterator;v.next();)w=v.value,y=w.toVertex,w.valid&&y.layer!==b&&(z=ms(w),A=w.portFromColOffset,w=w.portToColOffset,y=y.column,p+=(Math.abs(m+A-(y+w))+1)*z,q+=(Math.abs(r+A-(y+w))+1)*z,u+=(Math.abs(n+A-(y+w))+1)*z);w=A=z=0;v=g[e[d].index];y=h[e[d].index];-1!==v&&(z+=Math.abs(v-m),A+=
      Math.abs(v-r),w+=Math.abs(v-n));-1!==y&&(z+=Math.abs(y-m),A+=Math.abs(y-r),w+=Math.abs(y-n));if(q<p||q===p&&A<z)l=k=!0,e[d].column=r;else if(u<p||u===p&&w<z)l=k=!0,e[d].column=n}ls(a,b,e);a.normalize();return k}
    function Ps(a,b,c){var d=ks(a,b),e=a.gc[b],f=ss(a,b,c),g=[];for(c=0;c<e;c++)g[c]=f[c];for(f=!0;f;)for(f=!1,c=0;c<e;c++){var h=d[c].column,k=a.nodeMinColumnSpace(d[c],!0),l=a.nodeMinColumnSpace(d[c],!1),m=0;if(-1===g[c])if(0===c&&c===e-1)m=h;else if(0===c){var n=d[c+1].column;n-h===l+a.nodeMinColumnSpace(d[c+1],!0)?m=h-1:m=h}else c===e-1?(n=d[c-1].column,m=h-n===k+a.nodeMinColumnSpace(d[c-1],!1)?h+1:h):(n=d[c-1].column,k=n+a.nodeMinColumnSpace(d[c-1],!1)+k+1,n=d[c+1].column,l=n-a.nodeMinColumnSpace(d[c+
    1],!0)-l-1,m=(k+l)/2|0);else 0===c&&c===e-1?m=g[c]:0===c?(n=d[c+1].column,l=n-a.nodeMinColumnSpace(d[c+1],!0)-l-1,m=Math.min(g[c],l)):c===e-1?(n=d[c-1].column,k=n+a.nodeMinColumnSpace(d[c-1],!1)+k+1,m=Math.max(g[c],k)):(n=d[c-1].column,k=n+a.nodeMinColumnSpace(d[c-1],!1)+k+1,n=d[c+1].column,l=n-a.nodeMinColumnSpace(d[c+1],!0)-l-1,k<g[c]&&g[c]<l?m=g[c]:k>=g[c]?m=k:l<=g[c]&&(m=l));m!==h&&(f=!0,d[c].column=m)}ls(a,b,d);a.normalize()}
    function Ss(a,b){for(var c=!0,d=a.network.vertexes.iterator;d.next();){var e=d.value,f=a.nodeMinColumnSpace(e,!0),g=a.nodeMinColumnSpace(e,!1);if(e.column-f<=b&&e.column+g>=b){c=!1;break}}a=!1;if(c)for(d.reset();d.next();)c=d.value,c.column>b&&(--c.column,a=!0);return a}
    function Ts(a,b){var c=b+1;var d,e=[],f=[];for(d=0;d<=a.xa;d++)e[d]=!1,f[d]=!1;for(var g=a.network.vertexes.iterator;g.next();){d=g.value;var h=d.column-a.nodeMinColumnSpace(d,!0),k=d.column+a.nodeMinColumnSpace(d,!1);h<=b&&k>=b&&(e[d.layer]=!0);h<=c&&k>=c&&(f[d.layer]=!0)}h=!0;c=!1;for(d=0;d<=a.xa;d++)h=h&&!(e[d]&&f[d]);if(h)for(g.reset();g.next();)a=g.value,a.column>b&&(--a.column,c=!0);return c}
    function Qs(a,b){for(var c=0;c<=a.Da;c++)for(;Ss(a,c););a.normalize();for(c=0;c<a.Da;c++)for(;Ts(a,c););a.normalize();var d;if(0<b)for(c=0;c<=a.Da;c++){var e=ns(a);var f=qs(a);for(d=f+1;f<d;){d=f;Us(a,c,1);var g=qs(a);g>f?os(a,e):g<f&&(f=g,e=ns(a))}}if(0>b)for(c=a.Da;0<=c;c--)for(e=ns(a),f=qs(a),d=f+1;f<d;)d=f,Us(a,c,-1),g=qs(a),g>f?os(a,e):g<f&&(f=g,e=ns(a));a.normalize()}
    function Us(a,b,c){a.Pd=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.Pd)}if(0>c)for(d.reset();d.next();)e=d.value,e.column+a.nodeMinColumnSpace(e,!1)>=b&&(e.component=a.Pd);a.Pd++;for(d.reset();d.next();)b=d.value,-1===b.component&&(us(a,b,a.Pd,-1,!0,!0),a.Pd++);var f;b=[];for(f=0;f<a.Pd*a.Pd;f++)b[f]=!1;e=[];for(f=0;f<(a.xa+1)*(a.Da+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.Da,f.column+a.nodeMinColumnSpace(f,!1));h<=k;h++)e[g*(a.Da+1)+h]=f.component}for(f=0;f<=a.xa;f++){if(0<c)for(g=0;g<a.Da;g++)-1!==e[f*(a.Da+1)+g]&&-1!==e[f*(a.Da+1)+g+1]&&e[f*(a.Da+1)+g]!==e[f*(a.Da+1)+g+1]&&(b[e[f*(a.Da+1)+g]*a.Pd+e[f*(a.Da+1)+g+1]]=!0);if(0>c)for(g=a.Da;0<g;g--)-1!==e[f*(a.Da+1)+g]&&-1!==e[f*(a.Da+1)+g-1]&&e[f*(a.Da+1)+g]!==e[f*(a.Da+1)+g-1]&&(b[e[f*(a.Da+1)+g]*a.Pd+e[f*(a.Da+1)+g-1]]=!0)}e=
      [];for(f=0;f<a.Pd;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.Pd;f++)b[k*a.Pd+f]&&g.splice(0,0,f);if(0<c)for(d.reset();d.next();)a=d.value,e[a.component]&&--a.column;if(0>c)for(d.reset();d.next();)c=d.value,e[c.component]&&(c.column+=1)}
    bs.prototype.commitLayout=function(){if(this.setsPortSpots)for(var a=is(this,!0),b=is(this,!1),c=this.network.edges.iterator;c.next();){var d=c.value.link;null!==d&&(d.fromSpot=a,d.toSpot=b)}this.commitNodes();this.kv();this.isRouting&&this.commitLinks()};function is(a,b){return 270===a.J?b?ed:hd:90===a.J?b?hd:ed:180===a.J?b?fd:gd:b?gd:fd}
    bs.prototype.commitNodes=function(){this.Ld=[];this.rd=[];this.qd=[];this.Ga=[];for(var a=0;a<=this.xa;a++)this.Ld[a]=0,this.rd[a]=0,this.qd[a]=0,this.Ga[a]=0;for(a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;this.Ld[c]=Math.max(this.Ld[c],this.nodeMinLayerSpace(b,!0));this.rd[c]=Math.max(this.rd[c],this.nodeMinLayerSpace(b,!1))}b=0;c=this.ne;for(var d=0;d<=this.xa;d++){var e=c;0>=this.Ld[d]+this.rd[d]&&(e=0);0<d&&(b+=e/2);90===this.J||0===this.J?(b+=this.rd[d],this.qd[d]=b,
      b+=this.Ld[d]):(b+=this.Ld[d],this.qd[d]=b,b+=this.rd[d]);d<this.xa&&(b+=e/2);this.Ga[d]=b}c=b;b=this.arrangementOrigin;for(d=0;d<=this.xa;d++)270===this.J?this.qd[d]=b.y+this.qd[d]:90===this.J?(this.qd[d]=b.y+c-this.qd[d],this.Ga[d]=c-this.Ga[d]):180===this.J?this.qd[d]=b.x+this.qd[d]:(this.qd[d]=b.x+c-this.qd[d],this.Ga[d]=c-this.Ga[d]);a.reset();for(c=d=Infinity;a.next();){e=a.value;var f=e.layer,g=e.column|0;if(270===this.J||90===this.J){var h=b.x+this.Zb*g;f=this.qd[f]}else h=this.qd[f],f=b.y+
      this.Zb*g;e.centerX=h;e.centerY=f;d=Math.min(e.x,d);c=Math.min(e.y,c)}d=b.x-d;b=b.y-c;this.Hf=new I(d,b);for(a.reset();a.next();)c=a.value,c.x+=d,c.y+=b,c.commit()};
    bs.prototype.kv=function(){for(var a=0,b=this.ne,c=0;c<=this.xa;c++)a+=this.Ld[c],a+=this.rd[c];a+=this.xa*b;b=[];c=this.Zb*this.Da;for(var d=this.maxLayer;0<=d;d--)270===this.J?0===d?b.push(new N(0,0,c,Math.abs(this.Ga[0]))):b.push(new N(0,this.Ga[d-1],c,Math.abs(this.Ga[d-1]-this.Ga[d]))):90===this.J?0===d?b.push(new N(0,this.Ga[0],c,Math.abs(this.Ga[0]-a))):b.push(new N(0,this.Ga[d],c,Math.abs(this.Ga[d-1]-this.Ga[d]))):180===this.J?0===d?b.push(new N(0,0,Math.abs(this.Ga[0]),c)):b.push(new N(this.Ga[d-
    1],0,Math.abs(this.Ga[d-1]-this.Ga[d]),c)):0===d?b.push(new N(this.Ga[0],0,Math.abs(this.Ga[0]-a),c)):b.push(new N(this.Ga[d],0,Math.abs(this.Ga[d-1]-this.Ga[d]),c));this.commitLayers(b,this.Hf)};bs.prototype.commitLayers=function(){};
    bs.prototype.commitLinks=function(){for(var a=this.network.edges.iterator,b;a.next();)b=a.value.link,null!==b&&(b.Lh(),b.Zj(),b.sf());for(a.reset();a.next();)b=a.value.link,null!==b&&b.hj();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===og&&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.Zj(),b.rf(c.x,c.y),b.rf((2*c.x+g.x)/3,(2*c.y+g.y)/3),b.rf((c.x+2*g.x)/3,(c.y+2*g.y)/3),b.rf(g.x,g.y);else{var p=!1,r=!1;null!==g&&l===uc&&(p=!0);null!==h&&k===uc&&(r=!0);if(p||r){var q=b.i(0).x;c=b.i(0).y;m=b.i(3).x;d=b.i(3).y;p&&(90===this.J||270===this.J?(p=q,n=
      (c+d)/2):(p=(q+m)/2,n=c),b.K(1,p,n),l=b.getLinkPoint(e,g,l,!0,!1,f,h),l.u()||l.set(e.actualBounds.center),b.K(0,l.x,l.y));r&&(90===this.J||270===this.J?(l=m,c=(c+d)/2):(l=(q+m)/2,c=d),b.K(2,l,c),e=b.getLinkPoint(f,h,k,!1,!1,e,g),e.u()||e.set(f.actualBounds.center),b.K(3,e.x,e.y))}}b.sf()}else if(m.layer===n.layer)b.sf();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===og)r=!0,u=b.pointsCount,4<u&&b.points.removeRange(2,
      u-3),4===u&&(q=2);else{u=b.pointsCount;var v=l===uc,w=k===uc;2<u&&v&&w?b.points.removeRange(1,u-2):3<u&&v&&!w?b.points.removeRange(1,u-3):3<u&&!v&&w?b.points.removeRange(2,u-2):4<u&&!v&&!w&&b.points.removeRange(2,u-3)}if(c.rev){for(;null!==n&&m!==n;){var y=u=null;for(v=n.sourceEdges.iterator;v.next()&&(w=v.value,w.link!==c.link||(u=w.fromVertex,y=w.toVertex,null!==u.node)););if(u!==m){v=b.i(q-1).x;w=b.i(q-1).y;var z=u.centerX;var A=u.centerY;if(p)180===this.J||0===this.J?q===b.firstPickIndex+1?(b.m(q++,
      v,w),b.m(q++,v,A)):(null!==y?y.centerY:w)!==A&&(y=this.Ga[u.layer-1]+this.Hf.x,b.m(q++,y,w),b.m(q++,y,A)):q===b.firstPickIndex+1?(b.m(q++,v,w),b.m(q++,z,w)):(null!==y?y.centerX:v)!==z&&(y=this.Ga[u.layer-1]+this.Hf.y,b.m(q++,v,y),b.m(q++,z,y));else if(q===b.firstPickIndex+1){y=Math.max(10,this.Ld[n.layer]);var C=Math.max(10,this.rd[n.layer]);if(r)180===this.J?z<=n.bounds.x?(n=n.bounds.x,b.m(q++,n-y,A),b.m(q++,n,A),b.m(q++,n+C,A)):(b.m(q++,z-y,A),b.m(q++,z,A),b.m(q++,z+C,A)):90===this.J?A>=n.bounds.bottom?
      (n=n.bounds.y+n.bounds.height,b.m(q++,z,n+C),b.m(q++,z,n),b.m(q++,z,n-y)):(b.m(q++,z,A+C),b.m(q++,z,A),b.m(q++,z,A-y)):270===this.J?A<=n.bounds.y?(n=n.bounds.y,b.m(q++,z,n-y),b.m(q++,z,n),b.m(q++,z,n+C)):(b.m(q++,z,A-y),b.m(q++,z,A),b.m(q++,z,A+C)):0===this.J&&(z>=n.bounds.right?(n=n.bounds.x+n.bounds.width,b.m(q++,n+C,A),b.m(q++,n,A),b.m(q++,n-y,A)):(b.m(q++,z+C,A),b.m(q++,z,A),b.m(q++,z-y,A)));else{b.m(q++,v,w);var H=0;if(180===this.J||0===this.J){if(180===this.J?z>=n.bounds.right:z<=n.bounds.x)H=
      (0===this.J?-y:C)/2;b.m(q++,v+H,A)}else{if(270===this.J?A>=n.bounds.bottom:A<=n.bounds.y)H=(90===this.J?-y:C)/2;b.m(q++,z,w+H)}b.m(q++,z,A)}}else y=Math.max(10,this.Ld[u.layer]),C=Math.max(10,this.rd[u.layer]),180===this.J?(r&&b.m(q++,z-y,A),b.m(q++,z,A),r&&b.m(q++,z+C,A)):90===this.J?(r&&b.m(q++,z,A+C),b.m(q++,z,A),r&&b.m(q++,z,A-y)):270===this.J?(r&&b.m(q++,z,A-y),b.m(q++,z,A),r&&b.m(q++,z,A+C)):(r&&b.m(q++,z+C,A),b.m(q++,z,A),r&&b.m(q++,z-y,A))}n=u}if(null===h||l!==uc||p)if(v=b.i(q-1).x,w=b.i(q-
      1).y,z=b.i(q).x,A=b.i(q).y,p)n=this.rd[m.layer],180===this.J||0===this.J?(p=w,p>=m.bounds.y&&p<=m.bounds.bottom&&(180===this.J?z>=m.bounds.x:z<=m.bounds.right)&&(n=m.centerX+(180===this.J?-n:n),p<m.bounds.y+m.bounds.height/2?p=m.bounds.y-this.Zb/2:p=m.bounds.bottom+this.Zb/2,b.m(q++,n,w),b.m(q++,n,p)),b.m(q++,z,p)):(p=v,p>=m.bounds.x&&p<=m.bounds.right&&(270===this.J?A>=m.bounds.y:A<=m.bounds.bottom)&&(n=m.centerY+(270===this.J?-n:n),p<m.bounds.x+m.bounds.width/2?p=m.bounds.x-this.Zb/2:p=m.bounds.right+
      this.Zb/2,b.m(q++,v,n),b.m(q++,p,n)),b.m(q++,p,A)),b.m(q++,z,A);else if(r)y=Math.max(10,this.Ld[m.layer]),C=Math.max(10,this.rd[m.layer]),180===this.J&&z>=m.bounds.x?(n=m.bounds.x+m.bounds.width,b.K(q-2,n,w),b.K(q-1,n+C,w)):90===this.J&&A<=m.bounds.bottom?(n=m.bounds.y,b.K(q-2,v,n),b.K(q-1,v,n-y)):270===this.J&&A>=m.bounds.y?(n=m.bounds.y+m.bounds.height,b.K(q-2,v,n),b.K(q-1,v,n+C)):0===this.J&&z<=m.bounds.right&&(n=m.bounds.x,b.K(q-2,n,w),b.K(q-1,n-y,w));else{y=Math.max(10,this.Ld[m.layer]);C=Math.max(10,
      this.rd[m.layer]);p=0;if(180===this.J||0===this.J){if(180===this.J?z<=m.bounds.x:z>=m.bounds.right)p=(0===this.J?C:-y)/2;b.m(q++,z+p,w)}else{if(270===this.J?A<=m.bounds.y:A>=m.bounds.bottom)p=(90===this.J?C:-y)/2;b.m(q++,v,A+p)}b.m(q++,z,A)}}else{for(;null!==m&&m!==n;){y=u=null;for(m=m.destinationEdges.iterator;m.next()&&(v=m.value,v.link!==c.link||(u=v.toVertex,y=v.fromVertex,null!==y.node&&(y=null),null!==u.node)););u!==n&&(v=b.i(q-1).x,w=b.i(q-1).y,z=u.centerX,A=u.centerY,p?180===this.J||0===this.J?
      (null!==y?y.centerY:w)!==A&&(y=this.Ga[u.layer]+this.Hf.x,q===b.firstPickIndex+1&&(y=0===this.J?Math.max(y,v):Math.min(y,v)),b.m(q++,y,w),b.m(q++,y,A)):(null!==y?y.centerX:v)!==z&&(y=this.Ga[u.layer]+this.Hf.y,q===b.firstPickIndex+1&&(y=90===this.J?Math.max(y,w):Math.min(y,w)),b.m(q++,v,y),b.m(q++,z,y)):(y=Math.max(10,this.Ld[u.layer]),C=Math.max(10,this.rd[u.layer]),180===this.J?(b.m(q++,z+C,A),r&&b.m(q++,z,A),b.m(q++,z-y,A)):90===this.J?(b.m(q++,z,A-y),r&&b.m(q++,z,A),b.m(q++,z,A+C)):270===this.J?
      (b.m(q++,z,A+C),r&&b.m(q++,z,A),b.m(q++,z,A-y)):(b.m(q++,z-y,A),r&&b.m(q++,z,A),b.m(q++,z+C,A))));m=u}p&&(v=b.i(q-1).x,w=b.i(q-1).y,z=b.i(q).x,A=b.i(q).y,180===this.J||0===this.J?w!==A&&(y=0===this.J?Math.min(Math.max((z+v)/2,this.Ga[n.layer]+this.Hf.x),z):Math.max(Math.min((z+v)/2,this.Ga[n.layer]+this.Hf.x),z),b.m(q++,y,w),b.m(q++,y,A)):v!==z&&(y=90===this.J?Math.min(Math.max((A+w)/2,this.Ga[n.layer]+this.Hf.y),A):Math.max(Math.min((A+w)/2,this.Ga[n.layer]+this.Hf.y),A),b.m(q++,v,y),b.m(q++,z,y)))}null!==
    d&&r&&(null!==g&&(l===uc&&(l=b.i(0),d=b.i(2),l.w(d)||b.K(1,(l.x+d.x)/2,(l.y+d.y)/2)),l=b.getLinkPoint(e,g,uc,!0,!1,f,h),l.u()||l.set(e.actualBounds.center),b.K(0,l.x,l.y)),null!==h&&(k===uc&&(k=b.i(b.pointsCount-1),l=b.i(b.pointsCount-3),k.w(l)||b.K(b.pointsCount-2,(k.x+l.x)/2,(k.y+l.y)/2)),e=b.getLinkPoint(f,h,uc,!1,!1,e,g),e.u()||e.set(f.actualBounds.center),b.K(b.pointsCount-1,e.x,e.y)));b.sf();c.commit()}}}this.avoidOrthogonalOverlaps()};
    bs.prototype.avoidOrthogonalOverlaps=function(){if(!(0>=this.linkSpacing)){for(var a=new E,b=this.network.edges.iterator;b.next();){var c=b.value.link;null!==c&&c.isOrthogonal&&!a.contains(c)&&a.add(c)}if(0<a.count)if(90===this.J||270===this.J){b=0;c=[];for(a=a.iterator;a.next();){var d=a.value;if(null!==d&&d.isOrthogonal)for(var e=2;e<d.pointsCount-3;e++){var f=d.i(e);var g=d.i(e+1);if(this.A(f.y,g.y)&&!this.A(f.x,g.x)){var h=new Vs;h.layer=Math.floor(f.y/2);var k=d.i(0),l=d.i(d.pointsCount-1);h.first=
      k.x*k.x+k.y;h.Xb=l.x*l.x+l.y;h.Tc=Math.min(f.x,g.x);h.tc=Math.max(f.x,g.x);h.index=e;h.link=d;if(e+2<d.pointsCount){k=d.i(e-1);l=d.i(e+2);var m=0;k.y<f.y?m=l.y<f.y?3:f.x<g.x?2:1:k.y>f.y&&(m=l.y>f.y?0:g.x<f.x?2:1);h.l=m}c.push(h)}}}if(1<c.length)for(c.sort(this.jy),a=0;a<c.length;){f=c[a].layer;for(d=a+1;d<c.length&&c[d].layer===f;)d++;if(1<d-a)for(f=a;f<d;){g=c[f].tc;for(e=a+1;e<d&&c[e].Tc<g;)g=Math.max(g,c[e].tc),e++;g=e-f;if(1<g){this.ej(c,this.Lt,f,f+g);m=1;h=c[f].Xb;for(k=f;k<e;k++)l=c[k],l.Xb!==
    h&&(m++,h=l.Xb);this.ej(c,this.iy,f,f+g);var n=1;h=c[f].first;for(k=f;k<e;k++)l=c[k],l.first!==h&&(n++,h=l.first);k=!0;l=n;m<n?(k=!1,l=m,h=c[f].Xb,this.ej(c,this.Lt,f,f+g)):h=c[f].first;m=0;for(n=f;n<e;n++){var p=c[n];(k?p.first:p.Xb)!==h&&(m++,h=k?p.first:p.Xb);var r=p.link;f=r.i(p.index);g=r.i(p.index+1);var q=this.linkSpacing*(m-(l-1)/2);b++;r.Lh();r.K(p.index,f.x,f.y+q);r.K(p.index+1,g.x,g.y+q);r.sf()}}f=e}a=d}}else{b=0;c=[];for(a=a.iterator;a.next();)if(d=a.value,null!==d&&d.isOrthogonal)for(e=
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            2;e<d.pointsCount-3;e++)f=d.i(e),g=d.i(e+1),this.A(f.x,g.x)&&!this.A(f.y,g.y)&&(h=new Vs,h.layer=Math.floor(f.x/2),k=d.i(0),l=d.i(d.pointsCount-1),h.first=k.x+k.y*k.y,h.Xb=l.x+l.y*l.y,h.Tc=Math.min(f.y,g.y),h.tc=Math.max(f.y,g.y),h.index=e,h.link=d,e+2<d.pointsCount&&(k=d.i(e-1),l=d.i(e+2),m=0,k.x<f.x?m=l.x<f.x?3:f.y<g.y?2:1:k.x>f.x&&(m=l.x>f.x?0:g.y<f.y?2:1),h.l=m),c.push(h));if(1<c.length)for(c.sort(this.jy),a=0;a<c.length;){f=c[a].layer;for(d=a+1;d<c.length&&c[d].layer===f;)d++;if(1<d-a)for(f=
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 a;f<d;){g=c[f].tc;for(e=a+1;e<d&&c[e].Tc<g;)g=Math.max(g,c[e].tc),e++;g=e-f;if(1<g){this.ej(c,this.Lt,f,f+g);m=1;h=c[f].Xb;for(k=f;k<e;k++)l=c[k],l.Xb!==h&&(m++,h=l.Xb);this.ej(c,this.iy,f,f+g);n=1;h=c[f].first;for(k=f;k<e;k++)l=c[k],l.first!==h&&(n++,h=l.first);k=!0;l=n;m<n?(k=!1,l=m,h=c[f].Xb,this.ej(c,this.Lt,f,f+g)):h=c[f].first;m=0;for(n=f;n<e;n++)p=c[n],(k?p.first:p.Xb)!==h&&(m++,h=k?p.first:p.Xb),r=p.link,f=r.i(p.index),g=r.i(p.index+1),q=this.linkSpacing*(m-(l-1)/2),b++,r.Lh(),r.K(p.index,
      f.x+q,f.y),r.K(p.index+1,g.x+q,g.y),r.sf()}f=e}a=d}}}};t=bs.prototype;t.jy=function(a,b){return a instanceof Vs&&b instanceof Vs&&a!==b?a.layer<b.layer?-1:a.layer>b.layer?1:a.Tc<b.Tc?-1:a.Tc>b.Tc?1:a.tc<b.tc?-1:a.tc>b.tc?1:0:0};t.iy=function(a,b){return a instanceof Vs&&b instanceof Vs&&a!==b?a.first<b.first?-1:a.first>b.first||a.l<b.l?1:a.l>b.l||a.Tc<b.Tc?-1:a.Tc>b.Tc?1:a.tc<b.tc?-1:a.tc>b.tc?1:0:0};
    t.Lt=function(a,b){return a instanceof Vs&&b instanceof Vs&&a!==b?a.Xb<b.Xb?-1:a.Xb>b.Xb||a.l<b.l?1:a.l>b.l||a.Tc<b.Tc?-1:a.Tc>b.Tc?1:a.tc<b.tc?-1:a.tc>b.tc?1:0:0};t.A=function(a,b){a-=b;return-1<a&&1>a};
    t.ej=function(a,b,c,d){var e=a.length,f=d-c;if(!(1>=f))if((0>c||c>=e-1)&&B("not in range 0 <= from < length: "+c),2===f)d=a[c],e=a[c+1],0<b(d,e)&&(a[c]=e,a[c+1]=d);else if(0===c)if(d>=e)a.sort(b);else for(c=a.slice(0,d),c.sort(b),b=0;b<d;b++)a[b]=c[b];else if(d>=e)for(d=a.slice(c),d.sort(b),b=c;b<e;b++)a[b]=d[b-c];else for(e=a.slice(c,d),e.sort(b),b=c;b<d;b++)a[b]=e[b-c]};
    function ks(a,b){var c=a.gc[b];if(c>=a.qe.length){var d=[];for(var e=0;e<a.qe.length;e++)d[e]=a.qe[e];a.qe=d}void 0===a.qe[c]||null===a.qe[c]?d=[]:(d=a.qe[c],a.qe[c]=null);a=a.No[b];for(b=0;b<a.length;b++)c=a[b],d[c.index]=c;return d}function ls(a,b,c){a.qe[a.gc[b]]=c}
    ma.Object.defineProperties(bs.prototype,{layerSpacing:{get:function(){return this.ne},set:function(a){this.ne!==a&&0<=a&&(this.ne=a,this.C())}},columnSpacing:{get:function(){return this.Zb},set:function(a){this.Zb!==a&&0<a&&(this.Zb=a,this.C())}},direction:{get:function(){return this.J},set:function(a){this.J!==a&&(0===a||90===a||180===a||270===a?(this.J=a,this.C()):B("LayeredDigraphLayout.direction must be 0, 90, 180, or 270"))}},
      cycleRemoveOption:{get:function(){return this.Pk},set:function(a){this.Pk===a||a!==vs&&a!==cs&&a!==hs||(this.Pk=a,this.C())}},layeringOption:{get:function(){return this.tl},set:function(a){this.tl===a||a!==ds&&a!==As&&a!==Cs||(this.tl=a,this.C())}},initializeOption:{get:function(){return this.il},set:function(a){this.il===a||a!==es&&a!==Is&&a!==Gs||(this.il=a,this.C())}},iterations:{
        get:function(){return this.zj},set:function(a){this.zj!==a&&0<=a&&(this.zj=a,this.C())}},aggressiveOption:{get:function(){return this.Ek},set:function(a){this.Ek===a||a!==Ms&&a!==fs&&a!==Ns||(this.Ek=a,this.C())}},packOption:{get:function(){return this.kg},set:function(a){this.kg!==a&&0<=a&&8>a&&(this.kg=a,this.C())}},setsPortSpots:{get:function(){return this.df},set:function(a){this.df!==a&&(this.df=a,this.C())}},
      linkSpacing:{get:function(){return this.ro},set:function(a){this.ro!==a&&0<=a&&(this.ro=a,this.C())}},maxLayer:{get:function(){return this.xa}},maxIndex:{get:function(){return this.Zr}},maxColumn:{get:function(){return this.Da}},minIndexLayer:{get:function(){return this.Co}},maxIndexLayer:{get:function(){return this.sd}}});
    var cs=new D(bs,"CycleDepthFirst",0),vs=new D(bs,"CycleGreedy",1),hs=new D(bs,"CycleFromLayers",2),ds=new D(bs,"LayerOptimalLinkLength",0),As=new D(bs,"LayerLongestPathSink",1),Cs=new D(bs,"LayerLongestPathSource",2),es=new D(bs,"InitDepthFirstOut",0),Is=new D(bs,"InitDepthFirstIn",1),Gs=new D(bs,"InitNaive",2),Ms=new D(bs,"AggressiveNone",0),fs=new D(bs,"AggressiveLess",1),Ns=new D(bs,"AggressiveMore",2);bs.className="LayeredDigraphLayout";bs.CycleDepthFirst=cs;bs.CycleGreedy=vs;
    bs.CycleFromLayers=hs;bs.LayerOptimalLinkLength=ds;bs.LayerLongestPathSink=As;bs.LayerLongestPathSource=Cs;bs.InitDepthFirstOut=es;bs.InitDepthFirstIn=Is;bs.InitNaive=Gs;bs.AggressiveNone=Ms;bs.AggressiveLess=fs;bs.AggressiveMore=Ns;bs.PackNone=0;bs.PackExpand=1;bs.PackStraighten=2;bs.PackMedian=4;bs.PackAll=7;function Vs(){this.index=this.tc=this.Tc=this.Xb=this.first=this.layer=0;this.link=null;this.l=0}Vs.className="SegInfo";function gs(a){Qp.call(this,a)}la(gs,Qp);gs.prototype.createVertex=function(){return new Ws(this)};
    gs.prototype.createEdge=function(){return new Xs(this)};gs.className="LayeredDigraphNetwork";function Ws(a){Tp.call(this,a);this.Oa=this.Mg=this.ui=-1;this.I=NaN;this.Y=null;this.valid=!1;this.finish=this.fm=NaN;this.Wj=0;this.Qv=this.Rv=null}la(Ws,Tp);
    ma.Object.defineProperties(Ws.prototype,{layer:{get:function(){return this.ui},set:function(a){this.ui!==a&&(this.ui=a)}},column:{get:function(){return this.Mg},set:function(a){this.Mg!==a&&(this.Mg=a)}},index:{get:function(){return this.Oa},set:function(a){this.Oa!==a&&(this.Oa=a)}},component:{get:function(){return this.I},set:function(a){this.I!==a&&(this.I=a)}},near:{
        get:function(){return this.Y},set:function(a){this.Y!==a&&(this.Y=a)}}});Ws.className="LayeredDigraphVertex";function Xs(a){Up.call(this,a);this.l=this.Ia=this.Za=!1;this.Ha=this.I=NaN;this.Y=this.v=0}la(Xs,Up);
    ma.Object.defineProperties(Xs.prototype,{valid:{get:function(){return this.Za},set:function(a){this.Za!==a&&(this.Za=a)}},rev:{get:function(){return this.Ia},set:function(a){this.Ia!==a&&(this.Ia=a)}},forest:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a)}},portFromPos:{get:function(){return this.I},set:function(a){this.I!==a&&(this.I=a)}},portToPos:{
        get:function(){return this.Ha},set:function(a){this.Ha!==a&&(this.Ha=a)}},portFromColOffset:{get:function(){return this.v},set:function(a){this.v!==a&&(this.v=a)}},portToColOffset:{get:function(){return this.Y},set:function(a){this.Y!==a&&(this.Y=a)}}});Xs.className="LayeredDigraphEdge";
    function Ys(){Fi.call(this);this.Hb=new F;this.ap=Zs;this.$c=$s;this.Xp=at;this.Yr=bt;this.Nw=[];this.Zc=!0;this.Ab=ct;this.Ad=(new M(10,10)).freeze();var a=new dt(this);this.T=new et(a);this.U=new et(a);this.Xu=[]}la(Ys,Fi);Ys.prototype.cloneProtected=function(a){Fi.prototype.cloneProtected.call(this,a);a.ap=this.ap;a.Xp=this.Xp;a.Yr=this.Yr;a.Zc=this.Zc;a.Ab=this.Ab;a.Ad.assign(this.Ad);a.T.copyInheritedPropertiesFrom(this.T);a.U.copyInheritedPropertiesFrom(this.U)};
    Ys.prototype.cb=function(a){a.classType===Ys?0===a.name.indexOf("Alignment")?this.alignment=a:0===a.name.indexOf("Arrangement")?this.arrangement=a:0===a.name.indexOf("Compaction")?this.compaction=a:0===a.name.indexOf("Path")?this.path=a:0===a.name.indexOf("Sorting")?this.sorting=a:0===a.name.indexOf("Style")?this.treeStyle=a:B("Unknown enum value: "+a):Fi.prototype.cb.call(this,a)};Ys.prototype.createNetwork=function(){return new dt(this)};
    Ys.prototype.makeNetwork=function(a){function b(a){if(a instanceof W)return!a.isLinkLabel&&"Comment"!==a.category;if(a instanceof S){var b=a.fromNode;if(null===b||b.isLinkLabel||"Comment"===b.category)return!1;a=a.toNode;return null===a||a.isLinkLabel||"Comment"===a.category?!1:!0}return!1}var c=this.createNetwork();a instanceof R?(c.vg(a.nodes,!0,b),c.vg(a.links,!0,b)):a instanceof T?c.vg(a.memberParts,!1,b):c.vg(a.iterator,!1,b);return c};
    Ys.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));this.arrangement!==ft&&(this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin));var b=this.diagram;null===b&&a instanceof R&&(b=a);this.path===Zs&&null!==b?this.$c=b.isTreePathToChildren?$s:gt:this.$c=this.path===Zs?$s:this.path;if(0<this.network.vertexes.count){this.network.iq();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.Hb.count){a=
      new F;for(b=this.Hb.iterator;b.next();){var c=b.value;c instanceof W?(c=this.network.Wi(c),null!==c&&a.add(c)):c instanceof et&&a.add(c)}this.Hb=a}0===this.Hb.count&&this.findRoots();for(a=this.Hb.copy().iterator;a.next();)b=a.value,b.initialized||(b.initialized=!0,ht(this,b));b=this.network.vertexes;for(a=null;a=it(b),0<a.count;)b=jt(this,a),null!==b&&this.Hb.add(b),b.initialized=!0,ht(this,b),b=a;for(a=this.Hb.iterator;a.next();)b=a.value,b instanceof et&&kt(this,b);for(a=this.Hb.iterator;a.next();)b=
      a.value,b instanceof et&&lt(this,b);for(a=this.Hb.iterator;a.next();)b=a.value,b instanceof et&&mt(this,b);this.iv();if(this.layerStyle===nt){a=[];for(b=this.network.vertexes.iterator;b.next();){c=b.value;var d=c.parent;null===d&&(d=c);d=0===d.angle||180===d.angle;var e=a[c.level];void 0===e&&(e=0);a[c.level]=Math.max(e,d?c.width:c.height)}for(b=0;b<a.length;b++)void 0===a[b]&&(a[b]=0);this.Nw=a;for(b=this.network.vertexes.iterator;b.next();)c=b.value,d=c.parent,null===d&&(d=c),0===d.angle||180===
    d.angle?(180===d.angle&&(c.focusX+=a[c.level]-c.width),c.width=a[c.level]):(270===d.angle&&(c.focusY+=a[c.level]-c.height),c.height=a[c.level])}else if(this.layerStyle===ot)for(a=this.network.vertexes.iterator;a.next();){b=a.value;c=0===b.angle||180===b.angle;d=-1;for(e=0;e<b.children.length;e++){var f=b.children[e];d=Math.max(d,c?f.width:f.height)}if(0<=d)for(e=0;e<b.children.length;e++)f=b.children[e],c?(180===b.angle&&(f.focusX+=d-f.width),f.width=d):(270===b.angle&&(f.focusY+=d-f.height),f.height=
      d)}for(a=this.Hb.iterator;a.next();)b=a.value,b instanceof et&&this.layoutTree(b);this.arrangeTrees();this.updateParts()}this.network=null;this.Hb=new F;this.isValidLayout=!0};function it(a){var b=new F;for(a=a.iterator;a.next();){var c=a.value;c.initialized||b.add(c)}return b}
    Ys.prototype.findRoots=function(){for(var a=this.network.vertexes,b=a.iterator;b.next();){var c=b.value;switch(this.$c){case $s:0===c.sourceEdges.count&&this.Hb.add(c);break;case gt:0===c.destinationEdges.count&&this.Hb.add(c);break;default:B("Unhandled path value "+this.$c.toString())}}0===this.Hb.count&&(a=jt(this,a),null!==a&&this.Hb.add(a))};
    function jt(a,b){var c=999999,d=null;for(b=b.iterator;b.next();){var e=b.value;switch(a.$c){case $s:e.sourceEdges.count<c&&(c=e.sourceEdges.count,d=e);break;case gt:e.destinationEdges.count<c&&(c=e.destinationEdges.count,d=e);break;default:B("Unhandled path value "+a.$c.toString())}}return d}
    function ht(a,b){if(null!==b){switch(a.$c){case $s:if(0<b.destinationEdges.count){for(var c=new E,d=b.destinationVertexes;d.next();){var e=d.value;pt(a,b,e)&&c.add(e)}0<c.count&&(b.children=c.na())}break;case gt:if(0<b.sourceEdges.count){c=new E;for(d=b.sourceVertexes;d.next();)e=d.value,pt(a,b,e)&&c.add(e);0<c.count&&(b.children=c.na())}break;default:B("Unhandled path value"+a.$c.toString())}c=b.children;d=c.length;for(e=0;e<d;e++){var f=c[e];f.initialized=!0;f.level=b.level+1;f.parent=b;a.Hb.remove(f)}for(b=
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       0;b<d;b++)ht(a,c[b])}}function pt(a,b,c){if(c.initialized){if(null===b)var d=!1;else{for(d=b.parent;null!==d&&d!==c;)d=d.parent;d=d===c}if(d||c.level>b.level)return!1;a.removeChild(c.parent,c)}return!0}Ys.prototype.removeChild=function(a,b){if(null!==a&&null!==b){for(var c=a.children,d=0,e=0;e<c.length;e++)c[e]===b&&d++;if(0<d){d=Array(c.length-d);for(var f=e=0;f<c.length;f++)c[f]!==b&&(d[e++]=c[f]);a.children=d}}};
    function kt(a,b){if(null!==b){a.initializeTreeVertexValues(b);b.alignment===qt&&a.sortTreeVertexChildren(b);for(var c=0,d=b.childrenCount,e=0,f=b.children,g=f.length,h=0;h<g;h++){var k=f[h];kt(a,k);c+=k.descendantCount+1;d=Math.max(d,k.maxChildrenCount);e=Math.max(e,k.maxGenerationCount)}b.descendantCount=c;b.maxChildrenCount=d;b.maxGenerationCount=0<d?e+1:0}}
    function rt(a,b){switch(a.Xp){default:case at:return null!==b.parent?b.parent:a.T;case st:return null===b.parent?a.T:null===b.parent.parent?a.U:b.parent;case tt:return null!==b.parent?null!==b.parent.parent?b.parent.parent:a.U:a.T;case ut:var c=!0;if(0===b.childrenCount)c=!1;else for(var d=b.children,e=d.length,f=0;f<e;f++)if(0<d[f].childrenCount){c=!1;break}return c&&null!==b.parent?a.U:null!==b.parent?b.parent:a.T}}
    Ys.prototype.initializeTreeVertexValues=function(a){a.copyInheritedPropertiesFrom(rt(this,a));if(null!==a.parent&&a.parent.alignment===qt){for(var b=a.angle,c=a.parent.children,d=0;d<c.length&&a!==c[d];)d++;0===d%2?d!==c.length-1&&(b=90===b?180:180===b?270:270===b?180:270):b=90===b?0:180===b?90:270===b?0:90;a.angle=b}a.initialized=!0};function lt(a,b){if(null!==b){a.assignTreeVertexValues(b);b=b.children;for(var c=b.length,d=0;d<c;d++)lt(a,b[d])}}Ys.prototype.assignTreeVertexValues=function(){};
    function mt(a,b){if(null!==b){b.alignment!==qt&&a.sortTreeVertexChildren(b);b=b.children;for(var c=b.length,d=0;d<c;d++)mt(a,b[d])}}Ys.prototype.sortTreeVertexChildren=function(a){switch(a.sorting){case vt:break;case wt:a.children.reverse();break;case xt:a.children.sort(a.comparer);break;case yt:a.children.sort(a.comparer);a.children.reverse();break;default:B("Unhandled sorting value "+a.sorting.toString())}};Ys.prototype.iv=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)};
    Ys.prototype.addComments=function(a){var b=a.angle,c=a.parent,d=0;var e=!1;null!==c&&(d=c.angle,e=c.alignment,e=zt(e));b=90===b||270===b;d=90===d||270===d;c=0===a.childrenCount;var f=0,g=0,h=0,k=a.commentSpacing;if(null!==a.node)for(var l=a.node.uv();l.next();){var m=l.value;"Comment"===m.category&&m.canLayout()&&(null===a.comments&&(a.comments=[]),a.comments.push(m),m.yb(),m=m.measuredBounds,b&&!c||!e&&!d&&c||e&&d&&c?(f=Math.max(f,m.width),g+=m.height+Math.abs(h)):(f+=m.width+Math.abs(h),g=Math.max(g,
      m.height)),h=k)}null!==a.comments&&(b&&!c||!e&&!d&&c||e&&d&&c?(f+=Math.abs(a.commentMargin),g=Math.max(0,g-a.height)):(g+=Math.abs(a.commentMargin),f=Math.max(0,f-a.width)),e=N.allocAt(0,0,a.bounds.width+f,a.bounds.height+g),a.bounds=e,N.free(e))};function zt(a){return a===At||a===qt||a===Bt||a===Ct}function Dt(a){return a===At||a===qt}
    function Et(a){var b=a.parent;if(null!==b){var c=b.alignment;if(zt(c)){if(Dt(c)){b=b.children;for(c=0;c<b.length&&a!==b[c];)c++;return 0===c%2}if(c===Bt)return!0}}return!1}
    Ys.prototype.layoutComments=function(a){if(null!==a.comments){var b=a.node.measuredBounds,c=a.parent,d=a.angle,e=0;var f=!1;null!==c&&(e=c.angle,f=c.alignment,f=zt(f));d=90===d||270===d;c=90===e||270===e;for(var g=0===a.childrenCount,h=Et(a),k=0,l=a.comments,m=l.length,n=I.alloc(),p=0;p<m;p++){var r=l[p],q=r.measuredBounds;if(d&&!g||!f&&!c&&g||f&&c&&g){if(135<e&&!f||c&&h)if(0<=a.commentMargin)for(n.h(a.bounds.x-a.commentMargin-q.width,a.bounds.y+k),r.move(n),r=r.wd();r.next();){var u=r.value;u.fromSpot=
      fd;u.toSpot=gd}else for(n.h(a.bounds.x+2*a.focus.x-a.commentMargin,a.bounds.y+k),r.move(n),r=r.wd();r.next();)u=r.value,u.fromSpot=gd,u.toSpot=fd;else if(0<=a.commentMargin)for(n.h(a.bounds.x+2*a.focus.x+a.commentMargin,a.bounds.y+k),r.move(n),r=r.wd();r.next();)u=r.value,u.fromSpot=gd,u.toSpot=fd;else for(n.h(a.bounds.x+a.commentMargin-q.width,a.bounds.y+k),r.move(n),r=r.wd();r.next();)u=r.value,u.fromSpot=fd,u.toSpot=gd;k=0<=a.commentSpacing?k+(q.height+a.commentSpacing):k+(a.commentSpacing-q.height)}else{if(135<
      e&&!f||!c&&h)if(0<=a.commentMargin)for(n.h(a.bounds.x+k,a.bounds.y-a.commentMargin-q.height),r.move(n),r=r.wd();r.next();)u=r.value,u.fromSpot=ed,u.toSpot=hd;else for(n.h(a.bounds.x+k,a.bounds.y+2*a.focus.y-a.commentMargin),r.move(n),r=r.wd();r.next();)u=r.value,u.fromSpot=hd,u.toSpot=ed;else if(0<=a.commentMargin)for(n.h(a.bounds.x+k,a.bounds.y+2*a.focus.y+a.commentMargin),r.move(n),r=r.wd();r.next();)u=r.value,u.fromSpot=hd,u.toSpot=ed;else for(n.h(a.bounds.x+k,a.bounds.y+a.commentMargin-q.height),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                           r.move(n),r=r.wd();r.next();)u=r.value,u.fromSpot=ed,u.toSpot=hd;k=0<=a.commentSpacing?k+(q.width+a.commentSpacing):k+(a.commentSpacing-q.width)}}I.free(n);b=k-a.commentSpacing-(d?b.height:b.width);if(this.$c===$s)for(a=a.destinationEdges;a.next();)e=a.value.link,null===e||e.isAvoiding||(e.fromEndSegmentLength=0<b?b:NaN);else for(a=a.sourceEdges;a.next();)e=a.value.link,null===e||e.isAvoiding||(e.toEndSegmentLength=0<b?b:NaN)}};
    Ys.prototype.layoutTree=function(a){if(null!==a){for(var b=a.children,c=b.length,d=0;d<c;d++)this.layoutTree(b[d]);switch(a.compaction){case Ft:Gt(this,a);break;case Ht:if(a.alignment===qt)Gt(this,a);else if(0===a.childrenCount)d=a.parent,c=!1,b=0,null!==d&&(b=d.angle,c=d.alignment,c=zt(c)),d=Et(a),a.S.h(0,0),a.ta.h(a.width,a.height),null===a.parent||null===a.comments||(180!==b&&270!==b||c)&&!d?a.da.h(0,0):180===b&&!c||(90===b||270===b)&&d?a.da.h(a.width-2*a.focus.x,0):a.da.h(0,a.height-2*a.focus.y),
      a.vq=null,a.Iq=null;else{var e=It(a);b=90===e||270===e;var f=0,g=a.children,h=g.length;for(c=0;c<h;c++)d=g[c],f=Math.max(f,b?d.ta.width:d.ta.height);var k=a.alignment,l=k===Jt,m=zt(k),n=Math.max(0,a.breadthLimit);c=Kt(a);var p=a.nodeSpacing,r=Qt(a),q=a.rowSpacing,u=0;if(k===Rt||l||a.Fm||a.Gm&&1===a.maxGenerationCount)u=Math.max(0,a.rowIndent);d=a.width;var v=a.height,w=0,y=0,z=0,A=null,C=null,H=0,L=0,K=0,V=0,Q=0,ca=0,pa=0,O=0;m&&!Dt(k)&&135<e&&g.reverse();if(Dt(k))if(1<h)for(var xa=0;xa<h;xa++)0===
    xa%2&&xa!==h-1&&(O=Math.max(O,b?g[xa].ta.width:g[xa].ta.height));else 1===h&&(O=b?g[0].ta.width:g[0].ta.height);if(m){switch(k){case At:y=135>e?St(a,g,O,w,y):Tt(a,g,O,w,y);O=y.x;w=y.width;y=y.height;break;case Bt:for(A=0;A<h;A++)C=g[A],n=C.ta,z=0===ca?0:q,b?(C.S.h(f-n.width,V+z),w=Math.max(w,n.width),y=Math.max(y,V+z+n.height),V+=z+n.height):(C.S.h(K+z,f-n.height),w=Math.max(w,K+z+n.width),y=Math.max(y,n.height),K+=z+n.width),ca++;break;case Ct:for(A=0;A<h;A++)C=g[A],f=C.ta,n=0===ca?0:q,b?(C.S.h(p/
      2+a.focus.x,V+n),w=Math.max(w,f.width),y=Math.max(y,V+n+f.height),V+=n+f.height):(C.S.h(K+n,p/2+a.focus.y),w=Math.max(w,K+n+f.width),y=Math.max(y,f.height),K+=n+f.width),ca++}A=Ut(this,2);C=Ut(this,2);b?(A[0].h(0,0),A[1].h(0,y),C[0].h(w,0)):(A[0].h(0,0),A[1].h(w,0),C[0].h(0,y));C[1].h(w,y)}else for(xa=0;xa<h;xa++){var Ma=g[xa],hb=Ma.ta;if(b){0<n&&0<ca&&K+p+hb.width>n&&(K<f&&Vt(a,k,f-K,0,pa,xa-1),Q++,ca=0,pa=xa,z=y,K=0,V=135<e?-y-q:y+q);Wt(this,Ma,0,V);var Ea=0;if(0===ca){if(A=Ma.vq,C=Ma.Iq,H=hb.width,
      L=hb.height,null===A||null===C||e!==It(Ma))A=Ut(this,2),C=Ut(this,2),A[0].h(0,0),A[1].h(0,L),C[0].h(H,0),C[1].h(H,L)}else{var wb=Fa();L=Xt(this,a,Ma,A,C,H,L,wb);Ea=L.x;A=wb[0];C=wb[1];H=L.width;L=L.height;Ha(wb);K<hb.width&&0>Ea&&(Yt(a,-Ea,0,pa,xa-1),Zt(A,-Ea,0),Zt(C,-Ea,0),Ea=0)}Ma.S.h(Ea,V);w=Math.max(w,H);y=Math.max(y,z+(0===Q?0:q)+hb.height);K=H}else{0<n&&0<ca&&V+p+hb.height>n&&(V<f&&Vt(a,k,0,f-V,pa,xa-1),Q++,ca=0,pa=xa,z=w,V=0,K=135<e?-w-q:w+q);Wt(this,Ma,K,0);Ea=0;if(0===ca){if(A=Ma.vq,C=Ma.Iq,
      H=hb.width,L=hb.height,null===A||null===C||e!==It(Ma))A=Ut(this,2),C=Ut(this,2),A[0].h(0,0),A[1].h(H,0),C[0].h(0,L),C[1].h(H,L)}else wb=Fa(),L=Xt(this,a,Ma,A,C,H,L,wb),Ea=L.x,A=wb[0],C=wb[1],H=L.width,L=L.height,Ha(wb),V<hb.height&&0>Ea&&(Yt(a,0,-Ea,pa,xa-1),Zt(A,0,-Ea),Zt(C,0,-Ea),Ea=0);Ma.S.h(K,Ea);y=Math.max(y,L);w=Math.max(w,z+(0===Q?0:q)+hb.width);V=L}ca++}0<Q&&(b?(y+=Math.max(0,c),K<w&&Vt(a,k,w-K,0,pa,h-1),0<u&&(l||Yt(a,u,0,0,h-1),w+=u)):(w+=Math.max(0,c),V<y&&Vt(a,k,0,y-V,pa,h-1),0<u&&(l||
    Yt(a,0,u,0,h-1),y+=u)));u=l=0;switch(k){case $t:b?l+=w/2-a.focus.x-r/2:u+=y/2-a.focus.y-r/2;break;case au:0<Q?b?l+=w/2-a.focus.x-r/2:u+=y/2-a.focus.y-r/2:b?(O=g[0].S.x+g[0].da.x,l+=O+(g[h-1].S.x+g[h-1].da.x+2*g[h-1].focus.x-O)/2-a.focus.x-r/2):(O=g[0].S.y+g[0].da.y,u+=O+(g[h-1].S.y+g[h-1].da.y+2*g[h-1].focus.y-O)/2-a.focus.y-r/2);break;case Rt:b?(l-=r,w+=r):(u-=r,y+=r);break;case Jt:b?(l+=w-a.width+r,w+=r):(u+=y-a.height+r,y+=r);break;case At:b?1<h?l+=O+p/2-a.focus.x:l+=g[0].focus.x-a.focus.x+g[0].da.x:
      1<h?u+=O+p/2-a.focus.y:u+=g[0].focus.y-a.focus.y+g[0].da.y;break;case Bt:b?l+=w+p/2-a.focus.x:u+=y+p/2-a.focus.y;break;case Ct:break;default:B("Unhandled alignment value "+k.toString())}for(r=0;r<h;r++)O=g[r],b?O.S.h(O.S.x+O.da.x-l,O.S.y+(135<e?(m?-y:-O.ta.height)+O.da.y-c:v+c+O.da.y)):O.S.h(O.S.x+(135<e?(m?-w:-O.ta.width)+O.da.x-c:d+c+O.da.x),O.S.y+O.da.y-u);h=g=0;m?b?(w=bu(a,w,l),0>l&&(l=0),135<e&&(u+=y+c),y+=v+c,k===Ct&&(g+=p/2+a.focus.x),h+=v+c):(135<e&&(l+=w+c),w+=d+c,y=cu(a,y,u),0>u&&(u=0),
    k===Ct&&(h+=p/2+a.focus.y),g+=d+c):b?(null===a.comments?d>w&&(w=du(k,d-w,0),g=w.x,h=w.y,w=d,l=0):w=bu(a,w,l),0>l&&(g-=l,l=0),135<e&&(u+=y+c),y=Math.max(Math.max(y,v),y+v+c),h+=v+c):(135<e&&(l+=w+c),w=Math.max(Math.max(w,d),w+d+c),null===a.comments?v>y&&(y=du(k,0,v-y),g=y.x,h=y.y,y=v,u=0):y=cu(a,y,u),0>u&&(h-=u,u=0),g+=d+c);if(0<Q)e=Ut(this,4),Q=Ut(this,4),b?(e[2].h(0,v+c),e[3].h(e[2].x,y),Q[2].h(w,e[2].y),Q[3].h(Q[2].x,e[3].y)):(e[2].h(d+c,0),e[3].h(w,e[2].y),Q[2].h(e[2].x,y),Q[3].h(e[3].x,Q[2].y));
    else{e=Ut(this,A.length+2);Q=Ut(this,C.length+2);for(k=0;k<A.length;k++)m=A[k],e[k+2].h(m.x+g,m.y+h);for(k=0;k<C.length;k++)m=C[k],Q[k+2].h(m.x+g,m.y+h)}b?(e[0].h(l,0),e[1].h(e[0].x,v),e[2].y<e[1].y&&(e[2].x>e[0].x?e[2].assign(e[1]):e[1].assign(e[2])),e[3].y<e[2].y&&(e[3].x>e[0].x?e[3].assign(e[2]):e[2].assign(e[3])),Q[0].h(l+d,0),Q[1].h(Q[0].x,v),Q[2].y<Q[1].y&&(Q[2].x<Q[0].x?Q[2].assign(Q[1]):Q[1].assign(Q[2])),Q[3].y<Q[2].y&&(Q[3].x<Q[0].x?Q[3].assign(Q[2]):Q[2].assign(Q[3])),e[2].y-=c/2,Q[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])),Q[0].h(0,u+v),Q[1].h(d,Q[0].y),Q[2].x<Q[1].x&&(Q[2].y<Q[0].y?Q[2].assign(Q[1]):Q[1].assign(Q[2])),Q[3].x<Q[2].x&&(Q[3].y<Q[0].y?Q[3].assign(Q[2]):Q[2].assign(Q[3])),e[2].x-=c/2,Q[2].x-=c/2);eu(this,A);eu(this,C);a.vq=e;a.Iq=Q;a.da.h(l,u);a.ta.h(w,y)}break;default:B("Unhandled compaction value "+a.compaction.toString())}}};
    function Gt(a,b){if(0===b.childrenCount){var c=!1,d=0;null!==b.parent&&(d=b.parent.angle,c=b.parent.alignment,c=zt(c));var e=Et(b);b.S.h(0,0);b.ta.h(b.width,b.height);null===b.parent||null===b.comments||(180!==d&&270!==d||c)&&!e?b.da.h(0,0):180===d&&!c||(90===d||270===d)&&e?b.da.h(b.width-2*b.focus.x,0):b.da.h(0,b.height-2*b.focus.y)}else{d=It(b);c=90===d||270===d;var f=0;e=b.children;for(var g=e.length,h=0;h<g;h++){var k=e[h];f=Math.max(f,c?k.ta.width:k.ta.height)}var l=b.alignment,m=l===Rt,n=l===
      Jt;h=zt(l);var p=Math.max(0,b.breadthLimit);k=Kt(b);var r=b.nodeSpacing,q=Qt(b),u=m||n?0:q/2,v=b.rowSpacing,w=0;if(m||n||b.Fm||b.Gm&&1===b.maxGenerationCount)w=Math.max(0,b.rowIndent);m=b.width;var y=b.height,z=0,A=0,C=0,H=0,L=0,K=0,V=0,Q=0,ca=0;h&&!Dt(l)&&135<d&&e.reverse();if(Dt(l))if(1<g)for(var pa=0;pa<g;pa++){var O=e[pa],xa=O.ta;0===pa%2&&pa!==g-1&&(ca=Math.max(ca,(c?xa.width:xa.height)+fu(O)-r))}else 1===g&&(ca=c?e[0].ta.width:e[0].ta.height);if(h)switch(l){case At:case qt:A=135>d?St(b,e,ca,
      z,A):Tt(b,e,ca,z,A);ca=A.x;z=A.width;A=A.height;break;case Bt:for(a=0;a<g;a++)p=e[a],u=p.ta,C=0===V?0:v,c?(p.S.h(f-u.width,L+C),z=Math.max(z,u.width),A=Math.max(A,L+C+u.height),L+=C+u.height):(p.S.h(H+C,f-u.height),z=Math.max(z,H+C+u.width),A=Math.max(A,u.height),H+=C+u.width),V++;break;case Ct:for(f=0;f<g;f++)a=e[f],p=a.ta,u=0===V?0:v,c?(a.S.h(r/2+b.focus.x,L+u),z=Math.max(z,p.width),A=Math.max(A,L+u+p.height),L+=u+p.height):(a.S.h(H+u,r/2+b.focus.y),z=Math.max(z,H+u+p.width),A=Math.max(A,p.height),
      H+=u+p.width),V++}else for(pa=0;pa<g;pa++){O=e[pa];xa=O.ta;if(c){0<p&&0<V&&H+r+xa.width>p&&(H<f&&Vt(b,l,f-H,0,Q,pa-1),K++,V=0,Q=pa,C=A,H=0,L=135<d?-A-v:A+v);var Ma=0===V?u:r;Wt(a,O,0,L);O.S.h(H+Ma,L);z=Math.max(z,H+Ma+xa.width);A=Math.max(A,C+(0===K?0:v)+xa.height);H+=Ma+xa.width}else 0<p&&0<V&&L+r+xa.height>p&&(L<f&&Vt(b,l,0,f-L,Q,pa-1),K++,V=0,Q=pa,C=z,L=0,H=135<d?-z-v:z+v),Ma=0===V?u:r,Wt(a,O,H,0),O.S.h(H,L+Ma),A=Math.max(A,L+Ma+xa.height),z=Math.max(z,C+(0===K?0:v)+xa.width),L+=Ma+xa.height;V++}0<
    K&&(c?(A+=Math.max(0,k),H<z&&Vt(b,l,z-H,0,Q,g-1),0<w&&(n||Yt(b,w,0,0,g-1),z+=w)):(z+=Math.max(0,k),L<A&&Vt(b,l,0,A-L,Q,g-1),0<w&&(n||Yt(b,0,w,0,g-1),A+=w)));w=n=0;switch(l){case $t:c?n+=z/2-b.focus.x-q/2:w+=A/2-b.focus.y-q/2;break;case au:0<K?c?n+=z/2-b.focus.x-q/2:w+=A/2-b.focus.y-q/2:c?(l=e[0].S.x+e[0].da.x,n+=l+(e[g-1].S.x+e[g-1].da.x+2*e[g-1].focus.x-l)/2-b.focus.x-q/2):(l=e[0].S.y+e[0].da.y,w+=l+(e[g-1].S.y+e[g-1].da.y+2*e[g-1].focus.y-l)/2-b.focus.y-q/2);break;case Rt:c?(n-=q,z+=q):(w-=q,A+=
      q);break;case Jt:c?(n+=z-b.width+q,z+=q):(w+=A-b.height+q,A+=q);break;case At:case qt:c?1<g?n+=ca+r/2-b.focus.x:n+=e[0].focus.x-b.focus.x+e[0].da.x:1<g?w+=ca+r/2-b.focus.y:w+=e[0].focus.y-b.focus.y+e[0].da.y;break;case Bt:c?n+=z+r/2-b.focus.x:w+=A+r/2-b.focus.y;break;case Ct:break;default:B("Unhandled alignment value "+l.toString())}for(q=0;q<g;q++)l=e[q],c?l.S.h(l.S.x+l.da.x-n,l.S.y+(135<d?(h?-A:-l.ta.height)+l.da.y-k:y+k+l.da.y)):l.S.h(l.S.x+(135<d?(h?-z:-l.ta.width)+l.da.x-k:m+k+l.da.x),l.S.y+
      l.da.y-w);c?(z=bu(b,z,n),0>n&&(n=0),135<d&&(w+=A+k),A=Math.max(Math.max(A,y),A+y+k)):(135<d&&(n+=z+k),z=Math.max(Math.max(z,m),z+m+k),A=cu(b,A,w),0>w&&(w=0));b.da.h(n,w);b.ta.h(z,A)}}
    function St(a,b,c,d,e){var f=b.length;if(0===f)return new N(c,0,d,e);if(1===f)return a=b[0],d=a.ta.width,e=a.ta.height,new N(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=90===It(a),l=0,m=0,n=0,p=0;p<f;p++)if(!(0!==p%2||1<f&&p===f-1)){var r=b[p],q=r.ta,u=0===l?0:h;if(k){var v=fu(r)-g;r.S.h(c-(q.width+v),n+u);d=Math.max(d,q.width+v);e=Math.max(e,n+u+q.height);n+=u+q.height}else v=fu(r)-g,r.S.h(m+u,c-(q.height+v)),e=Math.max(e,q.height+v),d=Math.max(d,m+u+q.width),m+=u+q.width;l++}l=0;r=m;p=n;k?
      (m=c+g,n=0):(m=0,n=c+g);for(q=0;q<f;q++)if(0!==q%2){u=b[q];v=u.ta;var w=0===l?0:h;if(k){var y=fu(u)-g;u.S.h(m+y,n+w);d=Math.max(d,m+v.width+y);e=Math.max(e,n+w+v.height);n+=w+v.height}else y=fu(u)-g,u.S.h(m+w,n+y),d=Math.max(d,m+w+v.width),e=Math.max(e,n+v.height+y),m+=w+v.width;l++}1<f&&1===f%2&&(b=b[f-1],f=b.ta,h=null===b.parent?0:b.parent.rowSpacing,k?(b.S.h(c+g/2-b.focus.x-b.da.x,e+h),k=c+g/2-b.focus.x-b.da.x,d=Math.max(d,k+f.width),0>k&&(d-=k),e=Math.max(e,Math.max(p,n)+h+f.height),0>b.S.x&&
    (c=gu(a,b.S.x,!1,c,g))):(b.S.h(d+h,c+g/2-b.focus.y-b.da.y),d=Math.max(d,Math.max(r,m)+h+f.width),n=c+g/2-b.focus.y-b.da.y,e=Math.max(e,n+f.height),0>n&&(e-=n),0>b.S.y&&(c=gu(a,b.S.y,!0,c,g))));return new N(c,0,d,e)}
    function Tt(a,b,c,d,e){var f=b.length;if(0===f)return new N(c,0,d,e);if(1===f)return b=b[0],d=b.ta.width,e=b.ta.height,new N(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=270===It(a),l=0,m=0,n=0,p=0;p<f;p++)if(!(0!==p%2||1<f&&p===f-1)){var r=b[p],q=r.ta,u=0===l?0:h;if(k){var v=fu(r)-g;n-=u+q.height;r.S.h(c-(q.width+v),n);d=Math.max(d,q.width+v);e=Math.max(e,Math.abs(n))}else v=fu(r)-g,m-=u+q.width,r.S.h(m,c-(q.height+v)),e=Math.max(e,q.height+v),d=Math.max(d,Math.abs(m));l++}l=0;r=m;p=n;k?(m=
      c+g,n=0):(m=0,n=c+g);for(q=0;q<f;q++)if(0!==q%2){u=b[q];v=u.ta;var w=0===l?0:h;if(k){var y=fu(u)-g;n-=w+v.height;u.S.h(m+y,n);d=Math.max(d,m+v.width+y);e=Math.max(e,Math.abs(n))}else y=fu(u)-g,m-=w+v.width,u.S.h(m,n+y),e=Math.max(e,n+v.height+y),d=Math.max(d,Math.abs(m));l++}1<f&&1===f%2&&(h=b[f-1],l=h.ta,q=null===h.parent?0:h.parent.rowSpacing,k?(h.S.h(c+g/2-h.focus.x-h.da.x,-e-l.height-q),m=c+g/2-h.focus.x-h.da.x,d=Math.max(d,m+l.width),0>m&&(d-=m),e=Math.max(e,Math.abs(Math.min(p,n))+q+l.height),
    0>h.S.x&&(c=gu(a,h.S.x,!1,c,g))):(h.S.h(-d-l.width-q,c+g/2-h.focus.y-h.da.y),d=Math.max(d,Math.abs(Math.min(r,m))+q+l.width),n=c+g/2-h.focus.y-h.da.y,e=Math.max(e,n+l.height),0>n&&(e-=n),0>h.S.y&&(c=gu(a,h.S.y,!0,c,g))));for(a=0;a<f;a++)g=b[a],k?g.S.h(g.S.x,g.S.y+e):g.S.h(g.S.x+d,g.S.y);return new N(c,0,d,e)}function fu(a){return null===a.parent?0:a.parent.nodeSpacing}
    function gu(a,b,c,d,e){a=a.children;for(var f=a.length,g=0;g<f;g++)c?a[g].S.h(a[g].S.x,a[g].S.y-b):a[g].S.h(a[g].S.x-b,a[g].S.y);b=a[f-1];return Math.max(d,c?b.da.y+b.focus.y-e/2:b.da.x+b.focus.x-e/2)}
    function bu(a,b,c){switch(a.alignment){case au:case $t:return c+a.width>b&&(b=c+a.width),0>c&&(b-=c),b;case Rt:return a.width>b?a.width:b;case Jt:return 2*a.focus.x>b?a.width:b+a.width-2*a.focus.x;case At:case qt:return Math.max(a.width,Math.max(b,c+a.width)-Math.min(0,c));case Bt:return a.width-a.focus.x+a.nodeSpacing/2+b;case Ct:return Math.max(a.width,a.focus.x+a.nodeSpacing/2+b);default:return b}}
    function cu(a,b,c){switch(a.alignment){case au:case $t:return c+a.height>b&&(b=c+a.height),0>c&&(b-=c),b;case Rt:return a.height>b?a.height:b;case Jt:return 2*a.focus.y>b?a.height:b+a.height-2*a.focus.y;case At:case qt:return Math.max(a.height,Math.max(b,c+a.height)-Math.min(0,c));case Bt:return a.height-a.focus.y+a.nodeSpacing/2+b;case Ct:return Math.max(a.height,a.focus.y+a.nodeSpacing/2+b);default:return b}}
    function du(a,b,c){switch(a){case $t:b/=2;c/=2;break;case au:b/=2;c/=2;break;case Rt:c=b=0;break;case Jt:break;default:B("Unhandled alignment value "+a.toString())}return new I(b,c)}function Vt(a,b,c,d,e,f){b=du(b,c,d);Yt(a,b.x,b.y,e,f)}function Yt(a,b,c,d,e){if(0!==b||0!==c)for(a=a.children;d<=e;d++){var f=a[d].S;f.x+=b;f.y+=c}}
    function Wt(a,b,c,d){var e=b.parent;switch(a.$c){case $s:for(a=b.sourceEdges;a.next();)b=a.value,b.fromVertex===e&&b.relativePoint.h(c,d);break;case gt:for(a=b.destinationEdges;a.next();)b=a.value,b.toVertex===e&&b.relativePoint.h(c,d);break;default:B("Unhandled path value "+a.$c.toString())}}function Zt(a,b,c){for(var d=0;d<a.length;d++){var e=a[d];e.x+=b;e.y+=c}}
    function Xt(a,b,c,d,e,f,g,h){var k=It(b),l=90===k||270===k,m=b.nodeSpacing;b=d;var n=e;d=f;var p=g,r=c.vq,q=c.Iq;g=c.ta;var u=l?Math.max(p,g.height):Math.max(d,g.width);if(null===r||k!==It(c))r=Ut(a,2),q=Ut(a,2),l?(r[0].h(0,0),r[1].h(0,g.height),q[0].h(g.width,0),q[1].h(q[0].x,r[1].y)):(r[0].h(0,0),r[1].h(g.width,0),q[0].h(0,g.height),q[1].h(r[1].x,q[0].y));if(l){p=9999999;if(!(null===n||2>n.length||null===r||2>r.length))for(e=c=0;c<n.length&&e<r.length;){f=n[c];var v=r[e];k=v.x;l=v.y;k+=d;var w=
      f;c+1<n.length&&(w=n[c+1]);var y=v;v=y.x;y=y.y;e+1<r.length&&(y=r[e+1],v=y.x,y=y.y,v+=d);var z=p;f.y===l?z=k-f.x:f.y>l&&f.y<y?z=k+(f.y-l)/(y-l)*(v-k)-f.x:l>f.y&&l<w.y&&(z=k-(f.x+(l-f.y)/(w.y-f.y)*(w.x-f.x)));z<p&&(p=z);w.y<=f.y?c++:y<=l?e++:(w.y<=y&&c++,y<=w.y&&e++)}p=d-p;p+=m;c=r;e=p;if(null===b||2>b.length||null===c||2>c.length)d=null;else{m=Ut(a,b.length+c.length);for(d=f=k=0;f<c.length&&c[f].y<b[0].y;)l=c[f++],m[d++].h(l.x+e,l.y);for(;k<b.length;)l=b[k++],m[d++].h(l.x,l.y);for(k=b[b.length-1].y;f<
    c.length&&c[f].y<=k;)f++;for(;f<c.length&&c[f].y>k;)l=c[f++],m[d++].h(l.x+e,l.y);c=Ut(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);eu(a,m);d=c}f=q;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=Ut(a,n.length+f.length);for(e=l=c=0;c<n.length&&n[c].y<f[0].y;)w=n[c++],m[e++].h(w.x,w.y);for(;l<f.length;)w=f[l++],m[e++].h(w.x+k,w.y);for(f=f[f.length-1].y;c<n.length&&n[c].y<=f;)c++;for(;c<n.length&&n[c].y>f;)k=n[c++],m[e++].h(k.x,k.y);f=Ut(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);eu(a,m);e=f}f=
      Math.max(0,p)+g.width;g=u;eu(a,b);eu(a,r);eu(a,n);eu(a,q);h[0]=d;h[1]=e;return new N(p,0,f,g)}d=9999999;if(!(null===n||2>n.length||null===r||2>r.length))for(e=c=0;c<n.length&&e<r.length;)f=n[c],v=r[e],k=v.x,l=v.y,l+=p,w=f,c+1<n.length&&(w=n[c+1]),y=v,v=y.x,y=y.y,e+1<r.length&&(y=r[e+1],v=y.x,y=y.y,y+=p),z=d,f.x===k?z=l-f.y:f.x>k&&f.x<v?z=l+(f.x-k)/(v-k)*(y-l)-f.y:k>f.x&&k<w.x&&(z=l-(f.y+(k-f.x)/(w.x-f.x)*(w.y-f.y))),z<d&&(d=z),w.x<=f.x?c++:v<=k?e++:(w.x<=v&&c++,v<=w.x&&e++);p-=d;p+=m;c=r;e=p;if(null===
      b||2>b.length||null===c||2>c.length)d=null;else{m=Ut(a,b.length+c.length);for(d=f=k=0;f<c.length&&c[f].x<b[0].x;)l=c[f++],m[d++].h(l.x,l.y+e);for(;k<b.length;)l=b[k++],m[d++].h(l.x,l.y);for(k=b[b.length-1].x;f<c.length&&c[f].x<=k;)f++;for(;f<c.length&&c[f].x>k;)l=c[f++],m[d++].h(l.x,l.y+e);c=Ut(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);eu(a,m);d=c}f=q;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=Ut(a,n.length+f.length);for(e=l=c=0;c<n.length&&n[c].x<f[0].x;)w=n[c++],m[e++].h(w.x,w.y);
      for(;l<f.length;)w=f[l++],m[e++].h(w.x,w.y+k);for(f=f[f.length-1].x;c<n.length&&n[c].x<=f;)c++;for(;c<n.length&&n[c].x>f;)k=n[c++],m[e++].h(k.x,k.y);f=Ut(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);eu(a,m);e=f}f=u;g=Math.max(0,p)+g.height;eu(a,b);eu(a,r);eu(a,n);eu(a,q);h[0]=d;h[1]=e;return new N(p,0,f,g)}function Ut(a,b){a=a.Xu[b];if(void 0!==a&&(a=a.pop(),void 0!==a))return a;a=[];for(var c=0;c<b;c++)a[c]=new I;return a}
    function eu(a,b){var c=b.length,d=a.Xu[c];void 0===d&&(d=[],a.Xu[c]=d);d.push(b)}
    Ys.prototype.arrangeTrees=function(){if(this.Ab===ft)for(var a=this.Hb.iterator;a.next();){var b=a.value;if(b instanceof et){var c=b.node;if(null!==c){var d=c.position;c=d.x;d=d.y;isFinite(c)||(c=0);isFinite(d)||(d=0);hu(this,b,c,d)}}}else{a=[];for(b=this.Hb.iterator;b.next();)c=b.value,c instanceof et&&a.push(c);switch(this.sorting){case vt:break;case wt:a.reverse();break;case xt:a.sort(this.comparer);break;case yt:a.sort(this.comparer);a.reverse();break;default:B("Unhandled sorting value "+this.sorting.toString())}c=
      this.arrangementOrigin;b=c.x;c=c.y;for(d=0;d<a.length;d++){var e=a[d];hu(this,e,b+e.da.x,c+e.da.y);switch(this.Ab){case ct:c+=e.ta.height+this.Ad.height;break;case iu:b+=e.ta.width+this.Ad.width;break;default:B("Unhandled arrangement value "+this.Ab.toString())}}}};function hu(a,b,c,d){if(null!==b){b.x=c;b.y=d;b=b.children;for(var e=b.length,f=0;f<e;f++){var g=b[f];hu(a,g,c+g.S.x,d+g.S.y)}}}Ys.prototype.commitLayout=function(){this.iw();this.commitNodes();this.kv();this.isRouting&&this.commitLinks()};
    Ys.prototype.commitNodes=function(){for(var a=this.network.vertexes.iterator;a.next();)a.value.commit();for(a.reset();a.next();)this.layoutComments(a.value)};
    Ys.prototype.kv=function(){if(this.layerStyle===nt){for(var a=this.Nw,b=[],c=null,d=this.network.vertexes.iterator;d.next();){var e=d.value;null===c?c=e.bounds.copy():c.Hc(e.bounds);var f=b[e.level];void 0===f?f=Kt(e):f=Math.max(f,Kt(e));b[e.level]=f}for(d=0;d<b.length;d++)void 0===b[d]&&(b[d]=0);90===this.angle||270===this.angle?(c.Vc(this.nodeSpacing/2,this.layerSpacing),d=new I(-this.nodeSpacing/2,-this.layerSpacing/2)):(c.Vc(this.layerSpacing,this.nodeSpacing/2),d=new I(-this.layerSpacing/2,-this.nodeSpacing/
      2));e=[];c=90===this.angle||270===this.angle?c.width:c.height;f=0;if(180===this.angle||270===this.angle)for(var g=0;g<a.length;g++)f+=a[g]+b[g];for(g=0;g<a.length;g++){var h=a[g]+b[g];270===this.angle?(f-=h,e.push(new N(0,f,c,h))):90===this.angle?(e.push(new N(0,f,c,h)),f+=h):180===this.angle?(f-=h,e.push(new N(f,0,h,c))):(e.push(new N(f,0,h,c)),f+=h)}this.commitLayers(e,d)}};Ys.prototype.commitLayers=function(){};Ys.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};
    Ys.prototype.iw=function(){for(var a=this.Hb.iterator;a.next();){var b=a.value;b instanceof et&&ju(this,b)}};function ju(a,b){if(null!==b){a.setPortSpots(b);b=b.children;for(var c=b.length,d=0;d<c;d++)ju(a,b[d])}}
    Ys.prototype.setPortSpots=function(a){var b=a.alignment;if(zt(b)){var c=this.$c===$s,d=It(a);switch(d){case 0:var e=gd;break;case 90:e=hd;break;case 180:e=fd;break;default:e=ed}var f=a.children,g=f.length;switch(b){case At:case qt:for(b=0;b<g;b++){var h=f[b];h=(c?h.sourceEdges:h.destinationEdges).first();if(null!==h&&(h=h.link,null!==h)){var k=90===d||270===d?fd:ed;if(1===g||b===g-1&&1===g%2)switch(d){case 0:k=fd;break;case 90:k=ed;break;case 180:k=gd;break;default:k=hd}else 0===b%2&&(k=90===d||270===
    d?gd:hd);c?(a.setsPortSpot&&(h.fromSpot=e),a.setsChildPortSpot&&(h.toSpot=k)):(a.setsPortSpot&&(h.fromSpot=k),a.setsChildPortSpot&&(h.toSpot=e))}}break;case Bt:d=90===d||270===d?gd:hd;for(f=c?a.destinationEdges:a.sourceEdges;f.next();)g=f.value.link,null!==g&&(c?(a.setsPortSpot&&(g.fromSpot=e),a.setsChildPortSpot&&(g.toSpot=d)):(a.setsPortSpot&&(g.fromSpot=d),a.setsChildPortSpot&&(g.toSpot=e)));break;case Ct:for(d=90===d||270===d?fd:ed,f=c?a.destinationEdges:a.sourceEdges;f.next();)g=f.value.link,
    null!==g&&(c?(a.setsPortSpot&&(g.fromSpot=e),a.setsChildPortSpot&&(g.toSpot=d)):(a.setsPortSpot&&(g.fromSpot=d),a.setsChildPortSpot&&(g.toSpot=e)))}}else if(c=It(a),this.$c===$s)for(e=a.destinationEdges;e.next();){if(d=e.value.link,null!==d){if(a.setsPortSpot)if(a.portSpot.Mb())switch(c){case 0:d.fromSpot=gd;break;case 90:d.fromSpot=hd;break;case 180:d.fromSpot=fd;break;default:d.fromSpot=ed}else d.fromSpot=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.Mb())switch(c){case 0:d.toSpot=fd;break;
      case 90:d.toSpot=ed;break;case 180:d.toSpot=gd;break;default:d.toSpot=hd}else d.toSpot=a.childPortSpot}}else for(e=a.sourceEdges;e.next();)if(d=e.value.link,null!==d){if(a.setsPortSpot)if(a.portSpot.Mb())switch(c){case 0:d.toSpot=gd;break;case 90:d.toSpot=hd;break;case 180:d.toSpot=fd;break;default:d.toSpot=ed}else d.toSpot=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.Mb())switch(c){case 0:d.fromSpot=fd;break;case 90:d.fromSpot=ed;break;case 180:d.fromSpot=gd;break;default:d.fromSpot=hd}else d.fromSpot=
      a.childPortSpot}};function It(a){a=a.angle;return 45>=a?0:135>=a?90:225>=a?180:315>=a?270:0}function Kt(a){var b=It(a);b=90===b||270===b;var c=a.layerSpacing;if(0<a.layerSpacingParentOverlap){var d=Math.min(1,a.layerSpacingParentOverlap);c-=b?a.height*d:a.width*d}c<(b?-a.height:-a.width)&&(c=b?-a.height:-a.width);return c}function Qt(a){var b=It(a),c=a.nodeIndent;if(0<a.nodeIndentPastParent){var d=Math.min(1,a.nodeIndentPastParent);c+=90===b||270===b?a.width*d:a.height*d}return c=Math.max(0,c)}
    ma.Object.defineProperties(Ys.prototype,{roots:{get:function(){return this.Hb},set:function(a){this.Hb!==a&&(this.Hb=a,this.C())}},path:{get:function(){return this.ap},set:function(a){this.ap!==a&&(this.ap=a,this.C())}},treeStyle:{get:function(){return this.Xp},set:function(a){this.Ab===a||a!==at&&a!==tt&&a!==ut&&a!==st||(this.Xp=a,this.C())}},layerStyle:{get:function(){return this.Yr},
        set:function(a){this.Ab===a||a!==bt&&a!==ot&&a!==nt||(this.Yr=a,this.C())}},comments:{get:function(){return this.Zc},set:function(a){this.Zc!==a&&(this.Zc=a,this.C())}},arrangement:{get:function(){return this.Ab},set:function(a){this.Ab===a||a!==ct&&a!==iu&&a!==ft||(this.Ab=a,this.C())}},arrangementSpacing:{get:function(){return this.Ad},set:function(a){this.Ad.w(a)||(this.Ad.assign(a),this.C())}},rootDefaults:{
        get:function(){return this.T},set:function(a){this.T!==a&&(this.T=a,this.C())}},alternateDefaults:{get:function(){return this.U},set:function(a){this.U!==a&&(this.U=a,this.C())}},sorting:{get:function(){return this.T.sorting},set:function(a){this.T.sorting===a||a!==vt&&a!==wt&&a!==xt&&!yt||(this.T.sorting=a,this.C())}},comparer:{get:function(){return this.T.comparer},set:function(a){this.T.comparer!==
        a&&(this.T.comparer=a,this.C())}},angle:{get:function(){return this.T.angle},set:function(a){this.T.angle!==a&&(0===a||90===a||180===a||270===a?(this.T.angle=a,this.C()):B("TreeLayout.angle must be 0, 90, 180, or 270"))}},alignment:{get:function(){return this.T.alignment},set:function(a){this.T.alignment!==a&&(this.T.alignment=a,this.C())}},nodeIndent:{get:function(){return this.T.nodeIndent},set:function(a){this.T.nodeIndent!==
        a&&0<=a&&(this.T.nodeIndent=a,this.C())}},nodeIndentPastParent:{get:function(){return this.T.nodeIndentPastParent},set:function(a){this.T.nodeIndentPastParent!==a&&0<=a&&1>=a&&(this.T.nodeIndentPastParent=a,this.C())}},nodeSpacing:{get:function(){return this.T.nodeSpacing},set:function(a){this.T.nodeSpacing!==a&&(this.T.nodeSpacing=a,this.C())}},layerSpacing:{get:function(){return this.T.layerSpacing},set:function(a){this.T.layerSpacing!==
        a&&(this.T.layerSpacing=a,this.C())}},layerSpacingParentOverlap:{get:function(){return this.T.layerSpacingParentOverlap},set:function(a){this.T.layerSpacingParentOverlap!==a&&0<=a&&1>=a&&(this.T.layerSpacingParentOverlap=a,this.C())}},compaction:{get:function(){return this.T.compaction},set:function(a){this.T.compaction===a||a!==Ft&&a!==Ht||(this.T.compaction=a,this.C())}},breadthLimit:{get:function(){return this.T.breadthLimit},
        set:function(a){this.T.breadthLimit!==a&&0<=a&&(this.T.breadthLimit=a,this.C())}},rowSpacing:{get:function(){return this.T.rowSpacing},set:function(a){this.T.rowSpacing!==a&&(this.T.rowSpacing=a,this.C())}},rowIndent:{get:function(){return this.T.rowIndent},set:function(a){this.T.rowIndent!==a&&0<=a&&(this.T.rowIndent=a,this.C())}},commentSpacing:{get:function(){return this.T.commentSpacing},set:function(a){this.T.commentSpacing!==
        a&&(this.T.commentSpacing=a,this.C())}},commentMargin:{get:function(){return this.T.commentMargin},set:function(a){this.T.commentMargin!==a&&(this.T.commentMargin=a,this.C())}},setsPortSpot:{get:function(){return this.T.setsPortSpot},set:function(a){this.T.setsPortSpot!==a&&(this.T.setsPortSpot=a,this.C())}},portSpot:{get:function(){return this.T.portSpot},set:function(a){this.T.portSpot.w(a)||(this.T.portSpot=
          a,this.C())}},setsChildPortSpot:{get:function(){return this.T.setsChildPortSpot},set:function(a){this.T.setsChildPortSpot!==a&&(this.T.setsChildPortSpot=a,this.C())}},childPortSpot:{get:function(){return this.T.childPortSpot},set:function(a){this.T.childPortSpot.w(a)||(this.T.childPortSpot=a,this.C())}},alternateSorting:{get:function(){return this.U.sorting},set:function(a){this.U.sorting===a||a!==vt&&a!==wt&&
        a!==xt&&!yt||(this.U.sorting=a,this.C())}},alternateComparer:{get:function(){return this.U.comparer},set:function(a){this.U.comparer!==a&&(this.U.comparer=a,this.C())}},alternateAngle:{get:function(){return this.U.angle},set:function(a){this.U.angle===a||0!==a&&90!==a&&180!==a&&270!==a||(this.U.angle=a,this.C())}},alternateAlignment:{get:function(){return this.U.alignment},set:function(a){this.U.alignment!==
        a&&(this.U.alignment=a,this.C())}},alternateNodeIndent:{get:function(){return this.U.nodeIndent},set:function(a){this.U.nodeIndent!==a&&0<=a&&(this.U.nodeIndent=a,this.C())}},alternateNodeIndentPastParent:{get:function(){return this.U.nodeIndentPastParent},set:function(a){this.U.nodeIndentPastParent!==a&&0<=a&&1>=a&&(this.U.nodeIndentPastParent=a,this.C())}},alternateNodeSpacing:{get:function(){return this.U.nodeSpacing},
        set:function(a){this.U.nodeSpacing!==a&&(this.U.nodeSpacing=a,this.C())}},alternateLayerSpacing:{get:function(){return this.U.layerSpacing},set:function(a){this.U.layerSpacing!==a&&(this.U.layerSpacing=a,this.C())}},alternateLayerSpacingParentOverlap:{get:function(){return this.U.layerSpacingParentOverlap},set:function(a){this.U.layerSpacingParentOverlap!==a&&0<=a&&1>=a&&(this.U.layerSpacingParentOverlap=a,this.C())}},alternateCompaction:{
        get:function(){return this.U.compaction},set:function(a){this.U.compaction===a||a!==Ft&&a!==Ht||(this.U.compaction=a,this.C())}},alternateBreadthLimit:{get:function(){return this.U.breadthLimit},set:function(a){this.U.breadthLimit!==a&&0<=a&&(this.U.breadthLimit=a,this.C())}},alternateRowSpacing:{get:function(){return this.U.rowSpacing},set:function(a){this.U.rowSpacing!==a&&(this.U.rowSpacing=a,this.C())}},alternateRowIndent:{
        get:function(){return this.U.rowIndent},set:function(a){this.U.rowIndent!==a&&0<=a&&(this.U.rowIndent=a,this.C())}},alternateCommentSpacing:{get:function(){return this.U.commentSpacing},set:function(a){this.U.commentSpacing!==a&&(this.U.commentSpacing=a,this.C())}},alternateCommentMargin:{get:function(){return this.U.commentMargin},set:function(a){this.U.commentMargin!==a&&(this.U.commentMargin=a,this.C())}},alternateSetsPortSpot:{
        get:function(){return this.U.setsPortSpot},set:function(a){this.U.setsPortSpot!==a&&(this.U.setsPortSpot=a,this.C())}},alternatePortSpot:{get:function(){return this.U.portSpot},set:function(a){this.U.portSpot.w(a)||(this.U.portSpot=a,this.C())}},alternateSetsChildPortSpot:{get:function(){return this.U.setsChildPortSpot},set:function(a){this.U.setsChildPortSpot!==a&&(this.U.setsChildPortSpot=a,this.C())}},alternateChildPortSpot:{
        get:function(){return this.U.childPortSpot},set:function(a){this.U.childPortSpot.w(a)||(this.U.childPortSpot=a,this.C())}}});
    var Zs=new D(Ys,"PathDefault",-1),$s=new D(Ys,"PathDestination",0),gt=new D(Ys,"PathSource",1),vt=new D(Ys,"SortingForwards",10),wt=new D(Ys,"SortingReverse",11),xt=new D(Ys,"SortingAscending",12),yt=new D(Ys,"SortingDescending",13),$t=new D(Ys,"AlignmentCenterSubtrees",20),au=new D(Ys,"AlignmentCenterChildren",21),Rt=new D(Ys,"AlignmentStart",22),Jt=new D(Ys,"AlignmentEnd",23),At=new D(Ys,"AlignmentBus",24),qt=new D(Ys,"AlignmentBusBranching",25),Bt=new D(Ys,"AlignmentTopLeftBus",26),Ct=new D(Ys,
      "AlignmentBottomRightBus",27),Ft=new D(Ys,"CompactionNone",30),Ht=new D(Ys,"CompactionBlock",31),at=new D(Ys,"StyleLayered",40),ut=new D(Ys,"StyleLastParents",41),tt=new D(Ys,"StyleAlternating",42),st=new D(Ys,"StyleRootOnly",43),ct=new D(Ys,"ArrangementVertical",50),iu=new D(Ys,"ArrangementHorizontal",51),ft=new D(Ys,"ArrangementFixedRoots",52),bt=new D(Ys,"LayerIndividual",60),ot=new D(Ys,"LayerSiblings",61),nt=new D(Ys,"LayerUniform",62);Ys.className="TreeLayout";Ys.PathDefault=Zs;
    Ys.PathDestination=$s;Ys.PathSource=gt;Ys.SortingForwards=vt;Ys.SortingReverse=wt;Ys.SortingAscending=xt;Ys.SortingDescending=yt;Ys.AlignmentCenterSubtrees=$t;Ys.AlignmentCenterChildren=au;Ys.AlignmentStart=Rt;Ys.AlignmentEnd=Jt;Ys.AlignmentBus=At;Ys.AlignmentBusBranching=qt;Ys.AlignmentTopLeftBus=Bt;Ys.AlignmentBottomRightBus=Ct;Ys.CompactionNone=Ft;Ys.CompactionBlock=Ht;Ys.StyleLayered=at;Ys.StyleLastParents=ut;Ys.StyleAlternating=tt;Ys.StyleRootOnly=st;Ys.ArrangementVertical=ct;
    Ys.ArrangementHorizontal=iu;Ys.ArrangementFixedRoots=ft;Ys.LayerIndividual=bt;Ys.LayerSiblings=ot;Ys.LayerUniform=nt;function dt(a){Qp.call(this,a)}la(dt,Qp);dt.prototype.createVertex=function(){return new et(this)};dt.prototype.createEdge=function(){return new ku(this)};dt.className="TreeNetwork";
    function et(a){Tp.call(this,a);this.Ha=!1;this.Ic=null;this.I=[];this.kd=this.Za=this.Y=this.Ia=0;this.Zc=null;this.S=new I(0,0);this.ta=new M(0,0);this.da=new I(0,0);this.Gm=this.Fm=this.tA=!1;this.Iq=this.vq=null;this.Qc=vt;this.Kc=$p;this.Yb=0;this.vb=au;this.ks=this.js=0;this.ls=20;this.ne=50;this.Xr=0;this.jr=Ht;this.br=0;this.ys=25;this.ir=this.xs=10;this.hr=20;this.Ls=!0;this.us=$c;this.Ks=!0;this.er=$c}la(et,Tp);
    et.prototype.copyInheritedPropertiesFrom=function(a){null!==a&&(this.Qc=a.sorting,this.Kc=a.comparer,this.Yb=a.angle,this.vb=a.alignment,this.js=a.nodeIndent,this.ks=a.nodeIndentPastParent,this.ls=a.nodeSpacing,this.ne=a.layerSpacing,this.Xr=a.layerSpacingParentOverlap,this.jr=a.compaction,this.br=a.breadthLimit,this.ys=a.rowSpacing,this.xs=a.rowIndent,this.ir=a.commentSpacing,this.hr=a.commentMargin,this.Ls=a.setsPortSpot,this.us=a.portSpot,this.Ks=a.setsChildPortSpot,this.er=a.childPortSpot)};
    ma.Object.defineProperties(et.prototype,{initialized:{get:function(){return this.Ha},set:function(a){this.Ha!==a&&(this.Ha=a)}},parent:{get:function(){return this.Ic},set:function(a){this.Ic!==a&&(this.Ic=a)}},children:{get:function(){return this.I},set:function(a){if(this.I!==a){if(null!==a)for(var b=a.length,c=0;c<b;c++);this.I=a}}},level:{get:function(){return this.Ia},set:function(a){this.Ia!==
        a&&(this.Ia=a)}},descendantCount:{get:function(){return this.Y},set:function(a){this.Y!==a&&(this.Y=a)}},maxChildrenCount:{get:function(){return this.Za},set:function(a){this.Za!==a&&(this.Za=a)}},maxGenerationCount:{get:function(){return this.kd},set:function(a){this.kd!==a&&(this.kd=a)}},comments:{get:function(){return this.Zc},set:function(a){if(this.Zc!==a){if(null!==a)for(var b=
          a.length,c=0;c<b;c++);this.Zc=a}}},sorting:{get:function(){return this.Qc},set:function(a){this.Qc!==a&&(this.Qc=a)}},comparer:{get:function(){return this.Kc},set:function(a){this.Kc!==a&&(this.Kc=a)}},angle:{get:function(){return this.Yb},set:function(a){this.Yb!==a&&(this.Yb=a)}},alignment:{get:function(){return this.vb},set:function(a){this.vb!==a&&(this.vb=a)}},nodeIndent:{
        get:function(){return this.js},set:function(a){this.js!==a&&(this.js=a)}},nodeIndentPastParent:{get:function(){return this.ks},set:function(a){this.ks!==a&&(this.ks=a)}},nodeSpacing:{get:function(){return this.ls},set:function(a){this.ls!==a&&(this.ls=a)}},layerSpacing:{get:function(){return this.ne},set:function(a){this.ne!==a&&(this.ne=a)}},layerSpacingParentOverlap:{
        get:function(){return this.Xr},set:function(a){this.Xr!==a&&(this.Xr=a)}},compaction:{get:function(){return this.jr},set:function(a){this.jr!==a&&(this.jr=a)}},breadthLimit:{get:function(){return this.br},set:function(a){this.br!==a&&(this.br=a)}},rowSpacing:{get:function(){return this.ys},set:function(a){this.ys!==a&&(this.ys=a)}},rowIndent:{get:function(){return this.xs},set:function(a){this.xs!==
        a&&(this.xs=a)}},commentSpacing:{get:function(){return this.ir},set:function(a){this.ir!==a&&(this.ir=a)}},commentMargin:{get:function(){return this.hr},set:function(a){this.hr!==a&&(this.hr=a)}},setsPortSpot:{get:function(){return this.Ls},set:function(a){this.Ls!==a&&(this.Ls=a)}},portSpot:{get:function(){return this.us},set:function(a){this.us.w(a)||(this.us=a)}},setsChildPortSpot:{
        get:function(){return this.Ks},set:function(a){this.Ks!==a&&(this.Ks=a)}},childPortSpot:{get:function(){return this.er},set:function(a){this.er.w(a)||(this.er=a)}},childrenCount:{get:function(){return this.children.length}},relativePosition:{get:function(){return this.S},set:function(a){this.S.set(a)}},subtreeSize:{get:function(){return this.ta},set:function(a){this.ta.set(a)}},
      subtreeOffset:{get:function(){return this.da},set:function(a){this.da.set(a)}}});et.className="TreeVertex";function ku(a){Up.call(this,a);this.Nu=new I(0,0)}la(ku,Up);
    ku.prototype.commit=function(){var a=this.link;if(null!==a&&!a.isAvoiding){var b=this.network.layout,c=null,d=null;switch(b.$c){case $s:c=this.fromVertex;d=this.toVertex;break;case gt:c=this.toVertex;d=this.fromVertex;break;default:B("Unhandled path value "+b.$c.toString())}if(null!==c&&null!==d)if(b=this.Nu,0!==b.x||0!==b.y||c.tA){d=c.bounds;var e=It(c),f=Kt(c),g=c.rowSpacing;a.hj();var h=a.curve===og,k=a.isOrthogonal,l;a.Lh();if(k||h){for(l=2;4<a.pointsCount;)a.$v(2);var m=a.i(1);var n=a.i(2)}else{for(l=
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   1;3<a.pointsCount;)a.$v(1);m=a.i(0);n=a.i(a.pointsCount-1)}var p=a.i(a.pointsCount-1);0===e?(c.alignment===Jt?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-Qt(c))))):c.alignment===Rt?(e=d.top+b.y,0===b.y&&m.y<p.y-c.rowIndent&&(e=Math.max(e,Math.min(m.y,e+Qt(c))))):e=c.Fm||c.Gm&&1===c.maxGenerationCount?d.top-c.da.y+b.y:d.y+d.height/2+b.y,h?(a.m(l,m.x,e),l++,a.m(l,d.right+f,e),l++,a.m(l,d.right+f+(b.x-g)/3,e),l++,a.m(l,d.right+f+2*(b.x-g)/3,e),l++,a.m(l,d.right+f+(b.x-
      g),e),l++,a.m(l,n.x,e)):(k&&(a.m(l,d.right+f/2,m.y),l++),a.m(l,d.right+f/2,e),l++,a.m(l,d.right+f+b.x-(k?g/2:g),e),l++,k&&a.m(l,a.i(l-1).x,n.y))):90===e?(c.alignment===Jt?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-Qt(c))))):c.alignment===Rt?(e=d.left+b.x,0===b.x&&m.x<p.x-c.rowIndent&&(e=Math.max(e,Math.min(m.x,e+Qt(c))))):e=c.Fm||c.Gm&&1===c.maxGenerationCount?d.left-c.da.x+b.x:d.x+d.width/2+b.x,h?(a.m(l,e,m.y),l++,a.m(l,e,d.bottom+f),l++,a.m(l,e,d.bottom+f+(b.y-g)/
      3),l++,a.m(l,e,d.bottom+f+2*(b.y-g)/3),l++,a.m(l,e,d.bottom+f+(b.y-g)),l++,a.m(l,e,n.y)):(k&&(a.m(l,m.x,d.bottom+f/2),l++),a.m(l,e,d.bottom+f/2),l++,a.m(l,e,d.bottom+f+b.y-(k?g/2:g)),l++,k&&a.m(l,n.x,a.i(l-1).y))):180===e?(c.alignment===Jt?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-Qt(c))))):c.alignment===Rt?(e=d.top+b.y,0===b.y&&m.y<p.y-c.rowIndent&&(e=Math.max(e,Math.min(m.y,e+Qt(c))))):e=c.Fm||c.Gm&&1===c.maxGenerationCount?d.top-c.da.y+b.y:d.y+d.height/2+b.y,h?
      (a.m(l,m.x,e),l++,a.m(l,d.left-f,e),l++,a.m(l,d.left-f+(b.x+g)/3,e),l++,a.m(l,d.left-f+2*(b.x+g)/3,e),l++,a.m(l,d.left-f+(b.x+g),e),l++,a.m(l,n.x,e)):(k&&(a.m(l,d.left-f/2,m.y),l++),a.m(l,d.left-f/2,e),l++,a.m(l,d.left-f+b.x+(k?g/2:g),e),l++,k&&a.m(l,a.i(l-1).x,n.y))):270===e?(c.alignment===Jt?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-Qt(c))))):c.alignment===Rt?(e=d.left+b.x,0===b.x&&m.x<p.x-c.rowIndent&&(e=Math.max(e,Math.min(m.x,e+Qt(c))))):e=c.Fm||c.Gm&&1===c.maxGenerationCount?
      d.left-c.da.x+b.x:d.x+d.width/2+b.x,h?(a.m(l,e,m.y),l++,a.m(l,e,d.top-f),l++,a.m(l,e,d.top-f+(b.y+g)/3),l++,a.m(l,e,d.top-f+2*(b.y+g)/3),l++,a.m(l,e,d.top-f+(b.y+g)),l++,a.m(l,e,n.y)):(k&&(a.m(l,m.x,d.top-f/2),l++),a.m(l,e,d.top-f/2),l++,a.m(l,e,d.top-f+b.y+(k?g/2:g)),l++,k&&a.m(l,n.x,a.i(l-1).y))):B("Invalid angle "+e);a.sf()}else a=this.link,f=It(c),f!==It(d)&&(g=Kt(c),h=c.bounds,c=d.bounds,0===f&&c.left-h.right<g+1||90===f&&c.top-h.bottom<g+1||180===f&&h.left-c.right<g+1||270===f&&h.top-c.bottom<
    g+1||(a.hj(),c=a.curve===og,b=a.isOrthogonal,d=zt(this.fromVertex.alignment),a.Lh(),0===f?(f=h.right+g/2,c?4===a.pointsCount&&(c=a.i(3).y,a.K(1,f-20,a.i(1).y),a.m(2,f-20,c),a.m(3,f,c),a.m(4,f+20,c),a.K(5,a.i(5).x,c)):b?d?a.K(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.K(2,f,a.i(2).y),a.K(3,f,a.i(3).y)):4===a.pointsCount?a.m(2,f,a.i(2).y):3===a.pointsCount?a.K(1,f,a.i(2).y):2===a.pointsCount&&a.m(1,f,a.i(1).y)):90===f?(f=h.bottom+g/2,c?4===a.pointsCount&&(c=a.i(3).x,a.K(1,a.i(1).x,f-20),a.m(2,c,f-20),
      a.m(3,c,f),a.m(4,c,f+20),a.K(5,c,a.i(5).y)):b?d?a.K(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.K(2,a.i(2).x,f),a.K(3,a.i(3).x,f)):4===a.pointsCount?a.m(2,a.i(2).x,f):3===a.pointsCount?a.K(1,a.i(2).x,f):2===a.pointsCount&&a.m(1,a.i(1).x,f)):180===f?(f=h.left-g/2,c?4===a.pointsCount&&(c=a.i(3).y,a.K(1,f+20,a.i(1).y),a.m(2,f+20,c),a.m(3,f,c),a.m(4,f-20,c),a.K(5,a.i(5).x,c)):b?d?a.K(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.K(2,f,a.i(2).y),a.K(3,f,a.i(3).y)):4===a.pointsCount?a.m(2,f,a.i(2).y):3===a.pointsCount?
      a.K(1,f,a.i(2).y):2===a.pointsCount&&a.m(1,f,a.i(1).y)):270===f&&(f=h.top-g/2,c?4===a.pointsCount&&(c=a.i(3).x,a.K(1,a.i(1).x,f+20),a.m(2,c,f+20),a.m(3,c,f),a.m(4,c,f-20),a.K(5,c,a.i(5).y)):b?d?a.K(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.K(2,a.i(2).x,f),a.K(3,a.i(3).x,f)):4===a.pointsCount?a.m(2,a.i(2).x,f):3===a.pointsCount?a.K(1,a.i(2).x,f):2===a.pointsCount&&a.m(1,a.i(1).x,f)),a.sf()))}};
    ma.Object.defineProperties(ku.prototype,{relativePoint:{get:function(){return this.Nu},set:function(a){this.Nu.set(a)}}});ku.className="TreeEdge";
    Oa.prototype.initializeStandardTools=function(){this.Va("Action",new Cg,this.mouseDownTools);this.Va("Relinking",new bf,this.mouseDownTools);this.Va("LinkReshaping",new bg,this.mouseDownTools);this.Va("Rotating",new Ag,this.mouseDownTools);this.Va("Resizing",new tg,this.mouseDownTools);this.Va("Linking",new Vf,this.mouseMoveTools);this.Va("Dragging",new Re,this.mouseMoveTools);this.Va("DragSelecting",new Fg,this.mouseMoveTools);this.Va("Panning",new Gg,this.mouseMoveTools);this.Va("ContextMenu",new Ig,
      this.mouseUpTools);this.Va("TextEditing",new Tg,this.mouseUpTools);this.Va("ClickCreating",new Dg,this.mouseUpTools);this.Va("ClickSelecting",new Bg,this.mouseUpTools)};Cn("Horizontal",new zm);Cn("Spot",new Bm);Cn("Table",new Fm);Cn("Viewbox",new Km);Cn("TableRow",new Im);Cn("TableColumn",new Jm);Cn("Graduated",new Um);Cn("Grid",new Lm);si.add(br.type,sq);si.add(fr.type,Gq);
    var lu=x.go,mu={get licenseKey(){return R.licenseKey},set licenseKey(a){R.licenseKey=a},get version(){return R.version},Group:T,EnumValue:D,List:E,Set:F,Map:G,Point:I,Size:M,Rect:N,Margin:oc,Spot:P,Geometry:sd,PathFigure:ne,PathSegment:oe,InputEvent:qe,DiagramEvent:se,ChangedEvent:te,Model:Z,GraphLinksModel:br,TreeModel:fr,Binding:Mi,Transaction:ye,UndoManager:ze,CommandHandler:Tk,Tool:Be,DraggingTool:Re,DraggingInfo:cf,LinkingBaseTool:Jf,LinkingTool:Vf,RelinkingTool:bf,LinkReshapingTool:bg,ResizingTool:tg,
      RotatingTool:Ag,ClickSelectingTool:Bg,ActionTool:Cg,ClickCreatingTool:Dg,HTMLInfo:Pe,ContextMenuTool:Ig,DragSelectingTool:Fg,PanningTool:Gg,TextEditingTool:Tg,ToolManager:Oa,Animation:Ah,AnimationManager:wh,AnimationTrigger:bi,Layer:gi,Diagram:R,Palette:Lk,Overview:Ok,Brush:vl,GraphObject:Y,Panel:X,RowColumnDefinition:Uj,Shape:Kf,TextBlock:Ug,TextBlockMetrics:ko,Picture:mk,Part:U,Adornment:Ke,Node:W,Link:S,Placeholder:vg,Layout:Fi,LayoutNetwork:Qp,LayoutVertex:Tp,LayoutEdge:Up,GridLayout:Nk,PanelLayout:Ql,
      CircularLayout:gr,CircularNetwork:yr,CircularVertex:Lr,CircularEdge:Mr,ForceDirectedLayout:Nr,ForceDirectedNetwork:Or,ForceDirectedVertex:$r,ForceDirectedEdge:as,LayeredDigraphLayout:bs,LayeredDigraphNetwork:gs,LayeredDigraphVertex:Ws,LayeredDigraphEdge:Xs,TreeLayout:Ys,TreeNetwork:dt,TreeVertex:et,TreeEdge:ku};lu&&lu.version!==mu.version&&B("WARNING: a `go` object on the root object is already defined with a version mismatch."+lu.version+". Replaced with version: "+mu.version);x.go=mu;
    ("undefined"===typeof x||"undefined"===typeof x.module||"object"!==typeof x.module.exports)&&x.define&&"function"===typeof x.define&&x.define.amd&&x.define(mu); 'undefined'!==typeof module&&'object'===typeof module.exports&&(module.exports='undefined'!==typeof global?global.go:self.go); })();
  