5 Star 9 Fork 4

范诗豪/电路图下载地址

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
go.js 851.00 KB
一键复制 编辑 原始数据 按行查看 历史
fanshihao 提交于 2021-01-09 15:30 . update
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084
/*
* GoJS v2.0.3 JavaScript Library for HTML Diagrams
* Northwoods Software, https://www.nwoods.com/
* GoJS and Northwoods Software are registered trademarks of Northwoods Software Corporation.
* Copyright (C) 1998-2019 by Northwoods Software Corporation. All Rights Reserved.
* THIS SOFTWARE IS LICENSED. THE LICENSE AGREEMENT IS AT: https://gojs.net/2.0.3/license.html.
*/
(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 ca(a){for(var b,c=[];!(b=a.next()).done;)c.push(b.value);return c}var da="function"==typeof Object.create?Object.create:function(a){function b(){}b.prototype=a;return new b},ha;
if("function"==typeof Object.setPrototypeOf)ha=Object.setPrototypeOf;else{var ka;a:{var la={a:!0},ma={};try{ma.__proto__=la;ka=ma.a;break a}catch(a){}ka=!1}ha=ka?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null}var na=ha;
function oa(a,b){a.prototype=da(b.prototype);a.prototype.constructor=a;if(na)na(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.fA=b.prototype}var pa="undefined"!=typeof window&&window===self?self:"undefined"!=typeof global&&null!=global?global:self,qa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};
function ra(a){if(a){for(var b=pa,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&&qa(b,c,{writable:!0,value:a})}}ra(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 w="object"===typeof self&&self.self===self&&self||"object"===typeof global&&global.global===global&&global||"object"===typeof window&&window.window===window&&window||{};void 0===w.requestAnimationFrame&&(w.requestAnimationFrame=w.setImmediate);function sa(){}function ta(a,b){var c=-1;return function(){var d=this,e=arguments;-1!==c&&w.clearTimeout(c);c=ua(function(){c=-1;a.apply(d,e)},b)}}function ua(a,b){return w.setTimeout(a,b)}function va(a){return w.document.createElement(a)}
function A(a){throw Error(a);}function wa(a,b){a="The object is frozen, so its properties cannot be set: "+a.toString();void 0!==b&&(a+=" to value: "+b);A(a)}function xa(a,b,c,d){c=null===c?"*":"string"===typeof c?c:"function"===typeof c&&"string"===typeof c.className?c.className:"";void 0!==d&&(c+="."+d);A(c+" is not in the range "+b+": "+a)}function ya(a){w.console&&w.console.log(a)}
function za(){w.console&&w.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 Ca(a){return"object"===typeof a&&null!==a}function Ea(a){return Array.isArray(a)||w.NodeList&&a instanceof w.NodeList||w.HTMLCollection&&a instanceof w.HTMLCollection}function Ga(a){return Array.prototype.slice.call(a)}
function Ia(a,b,c){Array.isArray(a)?b>=a.length?a.push(c):a.splice(b,0,c):A("Cannot insert an object into an HTMLCollection or NodeList: "+c+" at "+b)}function Ja(a,b){Array.isArray(a)?b>=a.length?a.pop():a.splice(b,1):A("Cannot remove an object from an HTMLCollection or NodeList at "+b)}function Ka(){var a=La.pop();return void 0===a?[]:a}function Oa(a){a.length=0;La.push(a)}
function Pa(a){if("function"===typeof a){if(a.className)return a.className;if(a.name)return a.name;var b=a.toString();b=b.substring(9,b.indexOf("(")).trim();if(""!==b)return a._className=b}else if(Ca(a)&&a.constructor)return Pa(a.constructor);return typeof a}
function Qa(a){var b=a;Ca(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 Sa(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.Wz;if(c&&c[b])return!0;a=Object.getPrototypeOf(a)}return!1}
function Ta(a,b,c){Object.defineProperty(Ua.prototype,a,{get:b,set:c})}function Va(){var a=Wa;if(0===a.length)for(var b=w.document.getElementsByTagName("canvas"),c=b.length,d=0;d<c;d++){var e=b[d];e.parentElement&&e.parentElement.F&&a.push(e.parentElement.F)}return a}
function Za(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 bb=void 0!==w.navigator&&0<w.navigator.userAgent.indexOf("MSIE 9.0"),cb=void 0!==w.navigator&&0<w.navigator.userAgent.indexOf("MSIE 10.0"),db=void 0!==w.navigator&&0<w.navigator.userAgent.indexOf("Trident/7"),gb=void 0!==w.navigator&&0<w.navigator.userAgent.indexOf("Edge/"),ib=void 0!==w.navigator&&void 0!==w.navigator.platform&&0<=w.navigator.platform.toUpperCase().indexOf("MAC"),lb=void 0!==w.navigator&&void 0!==w.navigator.platform&&null!==w.navigator.platform.match(/(iPhone|iPod|iPad)/i),
La=[];Object.freeze([]);var Wa=[];sa.className="Util";sa.Dx="32ab5ff3b26f42dc0ed90f224c2913b5";sa.adym="gojs.net";sa.vfo="28e646fdb0";sa.className="Util";function D(a,b,c){mb(this);this.l=a;this.Ua=b;this.u=c}D.prototype.toString=function(){return"EnumValue."+this.Ua};function qb(a,b){return void 0===b||null===b||""===b?null:a[b]}
pa.Object.defineProperties(D.prototype,{classType:{get:function(){return this.l}},name:{get:function(){return this.Ua}},value:{get:function(){return this.u}}});D.className="EnumValue";function sb(){this.jw=[]}sb.prototype.toString=function(){return this.jw.join("")};sb.prototype.add=function(a){""!==a&&this.jw.push(a)};sb.className="StringBuilder";function tb(){}tb.className="PropertyCollection";
function ub(){}ub.prototype.reset=function(){};ub.prototype.next=function(){return!1};ub.prototype.dd=function(){return!1};ub.prototype.first=function(){return null};ub.prototype.any=function(){return!1};ub.prototype.all=function(){return!0};ub.prototype.each=function(){return this};ub.prototype.map=function(){return this};ub.prototype.filter=function(){return this};ub.prototype.xd=function(){};ub.prototype.toString=function(){return"EmptyIterator"};
pa.Object.defineProperties(ub.prototype,{iterator:{get:function(){return this}},count:{get:function(){return 0}}});ub.prototype.first=ub.prototype.first;ub.prototype.hasNext=ub.prototype.dd;ub.prototype.next=ub.prototype.next;ub.prototype.reset=ub.prototype.reset;var xb=null;ub.className="EmptyIterator";xb=new ub;function yb(a){this.key=-1;this.value=a}yb.prototype.reset=function(){this.key=-1};
yb.prototype.next=function(){return-1===this.key?(this.key=0,!0):!1};yb.prototype.dd=function(){return this.next()};yb.prototype.first=function(){this.key=0;return this.value};yb.prototype.any=function(a){this.key=-1;return a(this.value)};yb.prototype.all=function(a){this.key=-1;return a(this.value)};yb.prototype.each=function(a){this.key=-1;a(this.value);return this};yb.prototype.map=function(a){return new yb(a(this.value))};
yb.prototype.filter=function(a){return a(this.value)?new yb(this.value):xb};yb.prototype.xd=function(){this.value=null};yb.prototype.toString=function(){return"SingletonIterator("+this.value+")"};pa.Object.defineProperties(yb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return 1}}});yb.prototype.first=yb.prototype.first;yb.prototype.hasNext=yb.prototype.dd;yb.prototype.next=yb.prototype.next;
yb.prototype.reset=yb.prototype.reset;yb.className="SingletonIterator";function zb(a){this.pb=a;this.Xe=null;a.Ja=null;this.la=a.Ba;this.Sa=-1}zb.prototype.reset=function(){var a=this.pb;a.Ja=null;this.la=a.Ba;this.Sa=-1};zb.prototype.next=function(){var a=this.pb;if(a.Ba!==this.la&&0>this.key)return!1;a=a.j;var b=a.length,c=++this.Sa,d=this.Xe;if(null!==d)for(;c<b;){var e=a[c];if(d(e))return this.key=this.Sa=c,this.value=e,!0;c++}else{if(c<b)return this.key=c,this.value=a[c],!0;this.xd()}return!1};
zb.prototype.dd=function(){return this.next()};zb.prototype.first=function(){var a=this.pb;this.la=a.Ba;this.Sa=0;a=a.j;var b=a.length,c=this.Xe;if(null!==c){for(var d=0;d<b;){var e=a[d];if(c(e))return this.key=this.Sa=d,this.value=e;d++}return null}return 0<b?(a=a[0],this.key=0,this.value=a):null};zb.prototype.any=function(a){var b=this.pb;b.Ja=null;this.Sa=-1;b=b.j;for(var c=b.length,d=this.Xe,e=0;e<c;e++){var f=b[e];if((null===d||d(f))&&a(f))return!0}return!1};
zb.prototype.all=function(a){var b=this.pb;b.Ja=null;this.Sa=-1;b=b.j;for(var c=b.length,d=this.Xe,e=0;e<c;e++){var f=b[e];if((null===d||d(f))&&!a(f))return!1}return!0};zb.prototype.each=function(a){var b=this.pb;b.Ja=null;this.Sa=-1;b=b.j;for(var c=b.length,d=this.Xe,e=0;e<c;e++){var f=b[e];(null===d||d(f))&&a(f)}return this};
zb.prototype.map=function(a){var b=this.pb;b.Ja=null;this.Sa=-1;var c=[];b=b.j;for(var d=b.length,e=this.Xe,f=0;f<d;f++){var g=b[f];(null===e||e(g))&&c.push(a(g))}a=new E;a.j=c;a.kb();return a.iterator};zb.prototype.filter=function(a){var b=this.pb;b.Ja=null;this.Sa=-1;var c=[];b=b.j;for(var d=b.length,e=this.Xe,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.kb();return a.iterator};
zb.prototype.xd=function(){this.key=-1;this.value=null;this.la=-1;this.Xe=null;this.pb.Ja=this};zb.prototype.toString=function(){return"ListIterator@"+this.Sa+"/"+this.pb.count};
pa.Object.defineProperties(zb.prototype,{iterator:{get:function(){return this}},predicate:{get:function(){return this.Xe},set:function(a){this.Xe=a}},count:{get:function(){var a=this.Xe;if(null!==a){for(var b=0,c=this.pb.j,d=c.length,e=0;e<d;e++)a(c[e])&&b++;return b}return this.pb.j.length}}});zb.prototype.first=zb.prototype.first;zb.prototype.hasNext=zb.prototype.dd;zb.prototype.next=zb.prototype.next;
zb.prototype.reset=zb.prototype.reset;zb.className="ListIterator";function Ab(a){this.pb=a;a.Qg=null;this.la=a.Ba;this.Sa=a.j.length}Ab.prototype.reset=function(){var a=this.pb;a.Qg=null;this.la=a.Ba;this.Sa=a.j.length};Ab.prototype.next=function(){var a=this.pb;if(a.Ba!==this.la&&0>this.key)return!1;var b=--this.Sa;if(0<=b)return this.key=b,this.value=a.j[b],!0;this.xd();return!1};Ab.prototype.dd=function(){return this.next()};
Ab.prototype.first=function(){var a=this.pb;this.la=a.Ba;var b=a.j;this.Sa=a=b.length-1;return 0<=a?(b=b[a],this.key=a,this.value=b):null};Ab.prototype.any=function(a){var b=this.pb;b.Qg=null;b=b.j;var c=b.length;this.Sa=c;for(--c;0<=c;c--)if(a(b[c]))return!0;return!1};Ab.prototype.all=function(a){var b=this.pb;b.Qg=null;b=b.j;var c=b.length;this.Sa=c;for(--c;0<=c;c--)if(!a(b[c]))return!1;return!0};
Ab.prototype.each=function(a){var b=this.pb;b.Qg=null;b=b.j;var c=b.length;this.Sa=c;for(--c;0<=c;c--)a(b[c]);return this};Ab.prototype.map=function(a){var b=this.pb;b.Qg=null;var c=[];b=b.j;var d=b.length;this.Sa=d;for(--d;0<=d;d--)c.push(a(b[d]));a=new E;a.j=c;a.kb();return a.iterator};Ab.prototype.filter=function(a){var b=this.pb;b.Qg=null;var c=[];b=b.j;var d=b.length;this.Sa=d;for(--d;0<=d;d--){var e=b[d];a(e)&&c.push(e)}a=new E;a.j=c;a.kb();return a.iterator};
Ab.prototype.xd=function(){this.key=-1;this.value=null;this.la=-1;this.pb.Qg=this};Ab.prototype.toString=function(){return"ListIteratorBackwards("+this.Sa+"/"+this.pb.count+")"};pa.Object.defineProperties(Ab.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.pb.j.length}}});Ab.prototype.first=Ab.prototype.first;Ab.prototype.hasNext=Ab.prototype.dd;Ab.prototype.next=Ab.prototype.next;Ab.prototype.reset=Ab.prototype.reset;
Ab.className="ListIteratorBackwards";function E(a){mb(this);this.v=!1;this.j=[];this.Ba=0;this.Qg=this.Ja=null;void 0!==a&&("function"===typeof a||"string"===typeof a?za():this.addAll(a))}t=E.prototype;t.kb=function(){var a=this.Ba;a++;999999999<a&&(a=0);this.Ba=a};t.freeze=function(){this.v=!0;return this};t.ha=function(){this.v=!1;return this};t.toString=function(){return"List()#"+Bb(this)};t.add=function(a){if(null===a)return this;this.v&&wa(this,a);this.j.push(a);this.kb();return this};
t.push=function(a){this.add(a)};t.addAll=function(a){if(null===a)return this;this.v&&wa(this);var b=this.j;if(Ea(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.kb();return this};t.clear=function(){this.v&&wa(this);this.j.length=0;this.kb()};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.N=function(a){var b=this.j;(0>a||a>=b.length)&&xa(a,"0 <= i < length",E,"elt:i");return b[a]};t.get=function(a){return this.N(a)};t.gd=function(a,b){var c=this.j;(0>a||a>=c.length)&&xa(a,"0 <= i < length",E,"setElt:i");this.v&&wa(this,a);c[a]=b};t.set=function(a,b){this.gd(a,b)};t.first=function(){var a=this.j;return 0===a.length?null:a[0]};t.Sb=function(){var a=this.j,b=a.length;return 0<b?a[b-1]:null};t.pop=function(){this.v&&wa(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.kb();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.kb();return b};t=E.prototype;t.Ib=function(a,b){0>a&&xa(a,">= 0",E,"insertAt:i");this.v&&wa(this,a);var c=this.j;a>=c.length?c.push(b):c.splice(a,0,b);this.kb()};t.remove=function(a){if(null===a)return!1;this.v&&wa(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.kb();return!0};t.delete=function(a){return this.remove(a)};
t.mb=function(a){var b=this.j;(0>a||a>=b.length)&&xa(a,"0 <= i < length",E,"removeAt:i");this.v&&wa(this,a);a===b.length-1?b.pop():b.splice(a,1);this.kb()};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.v&&wa(this);for(var e=a,f=b+1;f<d;)c[e++]=c[f++];c.length=d-(b-a+1);this.kb();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.Mv=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.v&&wa(this);this.j.sort(a);this.kb();return this};
t.Ti=function(a,b,c){var d=this.j,e=d.length;void 0===b&&(b=0);void 0===c&&(c=e);this.v&&wa(this);var f=c-b;if(1>=f)return this;(0>b||b>=e-1)&&xa(b,"0 <= from < length",E,"sortRange:from");if(2===f)return c=d[b],e=d[b+1],0<a(c,e)&&(d[b]=e,d[b+1]=c,this.kb()),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.kb();return this};
t.reverse=function(){this.v&&wa(this);this.j.reverse();this.kb();return this};
pa.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 xb;var a=this.Ja;return null!==a?(a.reset(),a):new zb(this)}},iteratorBackwards:{
get:function(){if(0>=this.j.length)return xb;var a=this.Qg;return null!==a?(a.reset(),a):new Ab(this)}}});E.prototype.reverse=E.prototype.reverse;E.prototype.sortRange=E.prototype.Ti;E.prototype.sort=E.prototype.sort;E.prototype.toSet=E.prototype.Mv;E.prototype.toArray=E.prototype.Na;E.prototype.removeRange=E.prototype.removeRange;E.prototype.removeAt=E.prototype.mb;E.prototype["delete"]=E.prototype.delete;E.prototype.remove=E.prototype.remove;E.prototype.insertAt=E.prototype.Ib;
E.prototype.pop=E.prototype.pop;E.prototype.last=E.prototype.Sb;E.prototype.first=E.prototype.first;E.prototype.set=E.prototype.set;E.prototype.setElt=E.prototype.gd;E.prototype.get=E.prototype.get;E.prototype.elt=E.prototype.N;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.ha;
E.prototype.freeze=E.prototype.freeze;E.className="List";function Cb(a){this.cg=a;a.Ja=null;this.la=a.Ba;this.na=null}Cb.prototype.reset=function(){var a=this.cg;a.Ja=null;this.la=a.Ba;this.na=null};Cb.prototype.next=function(){var a=this.cg;if(a.Ba!==this.la&&null===this.key)return!1;var b=this.na;b=null===b?a.fa:b.oa;if(null!==b)return this.na=b,this.value=b.value,this.key=b.key,!0;this.xd();return!1};Cb.prototype.dd=function(){return this.next()};
Cb.prototype.first=function(){var a=this.cg;this.la=a.Ba;a=a.fa;if(null!==a){this.na=a;var b=a.value;this.key=a.key;return this.value=b}return null};Cb.prototype.any=function(a){var b=this.cg;this.na=b.Ja=null;for(b=b.fa;null!==b;){if(a(b.value))return!0;b=b.oa}return!1};Cb.prototype.all=function(a){var b=this.cg;this.na=b.Ja=null;for(b=b.fa;null!==b;){if(!a(b.value))return!1;b=b.oa}return!0};Cb.prototype.each=function(a){var b=this.cg;this.na=b.Ja=null;for(b=b.fa;null!==b;)a(b.value),b=b.oa;return this};
Cb.prototype.map=function(a){var b=this.cg;b.Ja=null;var c=new E;for(b=b.fa;null!==b;)c.add(a(b.value)),b=b.oa;return c.iterator};Cb.prototype.filter=function(a){var b=this.cg;b.Ja=null;var c=new E;for(b=b.fa;null!==b;){var d=b.value;a(d)&&c.add(d);b=b.oa}return c.iterator};Cb.prototype.xd=function(){this.value=this.key=null;this.la=-1;this.cg.Ja=this};Cb.prototype.toString=function(){return null!==this.na?"SetIterator@"+this.na.value:"SetIterator"};
pa.Object.defineProperties(Cb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.cg.Cb}}});Cb.prototype.first=Cb.prototype.first;Cb.prototype.hasNext=Cb.prototype.dd;Cb.prototype.next=Cb.prototype.next;Cb.prototype.reset=Cb.prototype.reset;Cb.className="SetIterator";
function F(a){mb(this);this.v=!1;this.Db={};this.Cb=0;this.Ja=null;this.Ba=0;this.Re=this.fa=null;void 0!==a&&("function"===typeof a||"string"===typeof a?za():this.addAll(a))}t=F.prototype;t.kb=function(){var a=this.Ba;a++;999999999<a&&(a=0);this.Ba=a};t.freeze=function(){this.v=!0;return this};t.ha=function(){this.v=!1;return this};t.toString=function(){return"Set()#"+Bb(this)};
t.add=function(a){if(null===a)return this;this.v&&wa(this,a);var b=a;Ca(a)&&(b=Db(a));void 0===this.Db[b]&&(this.Cb++,a=new Fb(a,a),this.Db[b]=a,b=this.Re,null===b?this.fa=a:(a.sl=b,b.oa=a),this.Re=a,this.kb());return this};t.addAll=function(a){if(null===a)return this;this.v&&wa(this);if(Ea(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 Ca(a)&&(b=Bb(a),void 0===b)?!1:void 0!==this.Db[b]};t.has=function(a){return this.contains(a)};t.py=function(a){if(null===a)return!0;for(a=a.iterator;a.next();)if(!this.contains(a.value))return!1;return!0};t.qy=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.fa;return null===a?null:a.value};
F.prototype.any=function(a){for(var b=this.fa;null!==b;){if(a(b.value))return!0;b=b.oa}return!1};F.prototype.all=function(a){for(var b=this.fa;null!==b;){if(!a(b.value))return!1;b=b.oa}return!0};F.prototype.each=function(a){for(var b=this.fa;null!==b;)a(b.value),b=b.oa;return this};F.prototype.map=function(a){for(var b=new F,c=this.fa;null!==c;)b.add(a(c.value)),c=c.oa;return b};F.prototype.filter=function(a){for(var b=new F,c=this.fa;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.v&&wa(this,a);var b=a;if(Ca(a)&&(b=Bb(a),void 0===b))return!1;a=this.Db[b];if(void 0===a)return!1;var c=a.oa,d=a.sl;null!==c&&(c.sl=d);null!==d&&(d.oa=c);this.fa===a&&(this.fa=c);this.Re===a&&(this.Re=d);delete this.Db[b];this.Cb--;this.kb();return!0};t.delete=function(a){return this.remove(a)};
t.iq=function(a){if(null===a)return this;this.v&&wa(this);if(Ea(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.Jz=function(a){if(null===a||0===this.count)return this;this.v&&wa(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.iq(a);return this};t.clear=function(){this.v&&wa(this);this.Db={};this.Cb=0;null!==this.Ja&&this.Ja.reset();this.Re=this.fa=null;this.kb()};
F.prototype.copy=function(){var a=new F,b=this.Db,c;for(c in b)a.add(b[c].value);return a};F.prototype.Na=function(){var a=Array(this.Cb),b=this.Db,c=0,d;for(d in b)a[c]=b[d].value,c++;return a};F.prototype.Lv=function(){var a=new E,b=this.Db,c;for(c in b)a.add(b[c].value);return a};function mb(a){a.__gohashid=Gb++}function Db(a){var b=a.__gohashid;void 0===b&&(b=Gb++,a.__gohashid=b);return b}function Bb(a){return a.__gohashid}
pa.Object.defineProperties(F.prototype,{count:{get:function(){return this.Cb}},size:{get:function(){return this.Cb}},iterator:{get:function(){if(0>=this.Cb)return xb;var a=this.Ja;return null!==a?(a.reset(),a):new Cb(this)}}});F.prototype.toList=F.prototype.Lv;F.prototype.toArray=F.prototype.Na;F.prototype.clear=F.prototype.clear;F.prototype.retainAll=F.prototype.Jz;F.prototype.removeAll=F.prototype.iq;
F.prototype["delete"]=F.prototype.delete;F.prototype.remove=F.prototype.remove;F.prototype.first=F.prototype.first;F.prototype.containsAny=F.prototype.qy;F.prototype.containsAll=F.prototype.py;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.ha;F.prototype.freeze=F.prototype.freeze;var Gb=1;F.className="Set";F.uniqueHash=mb;F.hashIdUnique=Db;F.hashId=Bb;
function Hb(a){this.ja=a;this.la=a.Ba;this.na=null}Hb.prototype.reset=function(){this.la=this.ja.Ba;this.na=null};Hb.prototype.next=function(){var a=this.ja;if(a.Ba!==this.la&&null===this.key)return!1;var b=this.na;b=null===b?a.fa:b.oa;if(null!==b)return this.na=b,this.value=this.key=a=b.key,!0;this.xd();return!1};Hb.prototype.dd=function(){return this.next()};Hb.prototype.first=function(){var a=this.ja;this.la=a.Ba;a=a.fa;return null!==a?(this.na=a,this.value=this.key=a=a.key):null};
Hb.prototype.any=function(a){var b=this.ja;this.na=null;for(b=b.fa;null!==b;){if(a(b.key))return!0;b=b.oa}return!1};Hb.prototype.all=function(a){var b=this.ja;this.na=null;for(b=b.fa;null!==b;){if(!a(b.key))return!1;b=b.oa}return!0};Hb.prototype.each=function(a){var b=this.ja;this.na=null;for(b=b.fa;null!==b;)a(b.key),b=b.oa;return this};Hb.prototype.map=function(a){var b=this.ja;this.na=null;var c=new E;for(b=b.fa;null!==b;)c.add(a(b.key)),b=b.oa;return c.iterator};
Hb.prototype.filter=function(a){var b=this.ja;this.na=null;var c=new E;for(b=b.fa;null!==b;){var d=b.key;a(d)&&c.add(d);b=b.oa}return c.iterator};Hb.prototype.xd=function(){this.value=this.key=null;this.la=-1};Hb.prototype.toString=function(){return null!==this.na?"MapKeySetIterator@"+this.na.value:"MapKeySetIterator"};pa.Object.defineProperties(Hb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ja.Cb}}});
Hb.prototype.first=Hb.prototype.first;Hb.prototype.hasNext=Hb.prototype.dd;Hb.prototype.next=Hb.prototype.next;Hb.prototype.reset=Hb.prototype.reset;Hb.className="MapKeySetIterator";function Ib(a){F.call(this);mb(this);this.v=!0;this.ja=a}oa(Ib,F);t=Ib.prototype;t.freeze=function(){return this};t.ha=function(){return this};t.toString=function(){return"MapKeySet("+this.ja.toString()+")"};t.add=function(){A("This Set is read-only: "+this.toString());return this};t.contains=function(a){return this.ja.contains(a)};
t.has=function(a){return this.contains(a)};t.remove=function(){A("This Set is read-only: "+this.toString());return!1};t.delete=function(a){return this.remove(a)};t.clear=function(){A("This Set is read-only: "+this.toString())};t.first=function(){var a=this.ja.fa;return null!==a?a.key:null};Ib.prototype.any=function(a){for(var b=this.ja.fa;null!==b;){if(a(b.key))return!0;b=b.oa}return!1};Ib.prototype.all=function(a){for(var b=this.ja.fa;null!==b;){if(!a(b.key))return!1;b=b.oa}return!0};
Ib.prototype.each=function(a){for(var b=this.ja.fa;null!==b;)a(b.key),b=b.oa;return this};Ib.prototype.map=function(a){for(var b=new F,c=this.ja.fa;null!==c;)b.add(a(c.key)),c=c.oa;return b};Ib.prototype.filter=function(a){for(var b=new F,c=this.ja.fa;null!==c;){var d=c.key;a(d)&&b.add(d);c=c.oa}return b};Ib.prototype.copy=function(){return new Ib(this.ja)};Ib.prototype.Mv=function(){var a=new F,b=this.ja.Db,c;for(c in b)a.add(b[c].key);return a};
Ib.prototype.Na=function(){var a=this.ja.Db,b=Array(this.ja.Cb),c=0,d;for(d in a)b[c]=a[d].key,c++;return b};Ib.prototype.Lv=function(){var a=new E,b=this.ja.Db,c;for(c in b)a.add(b[c].key);return a};pa.Object.defineProperties(Ib.prototype,{count:{get:function(){return this.ja.Cb}},size:{get:function(){return this.ja.Cb}},iterator:{get:function(){return 0>=this.ja.Cb?xb:new Hb(this.ja)}}});
Ib.prototype.toList=Ib.prototype.Lv;Ib.prototype.toArray=Ib.prototype.Na;Ib.prototype.toSet=Ib.prototype.Mv;Ib.prototype.first=Ib.prototype.first;Ib.prototype.clear=Ib.prototype.clear;Ib.prototype["delete"]=Ib.prototype.delete;Ib.prototype.remove=Ib.prototype.remove;Ib.prototype.has=Ib.prototype.has;Ib.prototype.contains=Ib.prototype.contains;Ib.prototype.add=Ib.prototype.add;Ib.prototype.thaw=Ib.prototype.ha;Ib.prototype.freeze=Ib.prototype.freeze;Ib.className="MapKeySet";
function Jb(a){this.ja=a;a.Qe=null;this.la=a.Ba;this.na=null}Jb.prototype.reset=function(){var a=this.ja;a.Qe=null;this.la=a.Ba;this.na=null};Jb.prototype.next=function(){var a=this.ja;if(a.Ba!==this.la&&null===this.key)return!1;var b=this.na;b=null===b?a.fa:b.oa;if(null!==b)return this.na=b,this.value=b.value,this.key=b.key,!0;this.xd();return!1};Jb.prototype.dd=function(){return this.next()};
Jb.prototype.first=function(){var a=this.ja;this.la=a.Ba;a=a.fa;if(null!==a){this.na=a;var b=a.value;this.key=a.key;return this.value=b}return null};Jb.prototype.any=function(a){var b=this.ja;this.na=b.Qe=null;for(b=b.fa;null!==b;){if(a(b.value))return!0;b=b.oa}return!1};Jb.prototype.all=function(a){var b=this.ja;this.na=b.Qe=null;for(b=b.fa;null!==b;){if(!a(b.value))return!1;b=b.oa}return!0};Jb.prototype.each=function(a){var b=this.ja;this.na=b.Qe=null;for(b=b.fa;null!==b;)a(b.value),b=b.oa;return this};
Jb.prototype.map=function(a){var b=this.ja;this.na=b.Qe=null;var c=new E;for(b=b.fa;null!==b;)c.add(a(b.value)),b=b.oa;return c.iterator};Jb.prototype.filter=function(a){var b=this.ja;this.na=b.Qe=null;var c=new E;for(b=b.fa;null!==b;){var d=b.value;a(d)&&c.add(d);b=b.oa}return c.iterator};Jb.prototype.xd=function(){this.value=this.key=null;this.la=-1;this.ja.Qe=this};Jb.prototype.toString=function(){return null!==this.na?"MapValueSetIterator@"+this.na.value:"MapValueSetIterator"};
pa.Object.defineProperties(Jb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ja.Cb}}});Jb.prototype.first=Jb.prototype.first;Jb.prototype.hasNext=Jb.prototype.dd;Jb.prototype.next=Jb.prototype.next;Jb.prototype.reset=Jb.prototype.reset;Jb.className="MapValueSetIterator";function Fb(a,b){this.key=a;this.value=b;this.sl=this.oa=null}Fb.prototype.toString=function(){return"{"+this.key+":"+this.value+"}"};
Fb.className="KeyValuePair";function Kb(a){this.ja=a;a.Ja=null;this.la=a.Ba;this.na=null}Kb.prototype.reset=function(){var a=this.ja;a.Ja=null;this.la=a.Ba;this.na=null};Kb.prototype.next=function(){var a=this.ja;if(a.Ba!==this.la&&null===this.key)return!1;var b=this.na;b=null===b?a.fa:b.oa;if(null!==b)return this.na=b,this.key=b.key,this.value=b.value,!0;this.xd();return!1};Kb.prototype.dd=function(){return this.next()};
Kb.prototype.first=function(){var a=this.ja;this.la=a.Ba;a=a.fa;return null!==a?(this.na=a,this.key=a.key,this.value=a.value,a):null};Kb.prototype.any=function(a){var b=this.ja;this.na=b.Ja=null;for(b=b.fa;null!==b;){if(a(b))return!0;b=b.oa}return!1};Kb.prototype.all=function(a){var b=this.ja;this.na=b.Ja=null;for(b=b.fa;null!==b;){if(!a(b))return!1;b=b.oa}return!0};Kb.prototype.each=function(a){var b=this.ja;this.na=b.Ja=null;for(b=b.fa;null!==b;)a(b),b=b.oa;return this};
Kb.prototype.map=function(a){var b=this.ja;this.na=b.Ja=null;var c=new E;for(b=b.fa;null!==b;)c.add(a(b)),b=b.oa;return c.iterator};Kb.prototype.filter=function(a){var b=this.ja;this.na=b.Ja=null;var c=new E;for(b=b.fa;null!==b;)a(b)&&c.add(b),b=b.oa;return c.iterator};Kb.prototype.xd=function(){this.value=this.key=null;this.la=-1;this.ja.Ja=this};Kb.prototype.toString=function(){return null!==this.na?"MapIterator@"+this.na:"MapIterator"};
pa.Object.defineProperties(Kb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ja.Cb}}});Kb.prototype.first=Kb.prototype.first;Kb.prototype.hasNext=Kb.prototype.dd;Kb.prototype.next=Kb.prototype.next;Kb.prototype.reset=Kb.prototype.reset;Kb.className="MapIterator";
function Lb(a){mb(this);this.v=!1;this.Db={};this.Cb=0;this.Qe=this.Ja=null;this.Ba=0;this.Re=this.fa=null;void 0!==a&&("function"===typeof a||"string"===typeof a?za():this.addAll(a))}t=Lb.prototype;t.kb=function(){var a=this.Ba;a++;999999999<a&&(a=0);this.Ba=a};t.freeze=function(){this.v=!0;return this};t.ha=function(){this.v=!1;return this};t.toString=function(){return"Map()#"+Bb(this)};
t.add=function(a,b){this.v&&wa(this,a);var c=a;Ca(a)&&(c=Db(a));var d=this.Db[c];void 0===d?(this.Cb++,a=new Fb(a,b),this.Db[c]=a,c=this.Re,null===c?this.fa=a:(a.sl=c,c.oa=a),this.Re=a,this.kb()):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(Ea(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];this.add(d.key,d.value)}else for(a=a.iterator;a.next();)b=a.value,this.add(b.key,b.value);return this};t.first=function(){return this.fa};
Lb.prototype.any=function(a){for(var b=this.fa;null!==b;){if(a(b))return!0;b=b.oa}return!1};Lb.prototype.all=function(a){for(var b=this.fa;null!==b;){if(!a(b))return!1;b=b.oa}return!0};Lb.prototype.each=function(a){for(var b=this.fa;null!==b;)a(b),b=b.oa;return this};Lb.prototype.map=function(a){for(var b=new Lb,c=this.fa;null!==c;)b.add(c.key,a(c)),c=c.oa;return b};Lb.prototype.filter=function(a){for(var b=new Lb,c=this.fa;null!==c;)a(c)&&b.add(c.key,c.value),c=c.oa;return b};t=Lb.prototype;
t.contains=function(a){var b=a;return Ca(a)&&(b=Bb(a),void 0===b)?!1:void 0!==this.Db[b]};t.has=function(a){return this.contains(a)};t.J=function(a){var b=a;if(Ca(a)&&(b=Bb(a),void 0===b))return null;a=this.Db[b];return void 0===a?null:a.value};t.get=function(a){return this.J(a)};
t.remove=function(a){if(null===a)return!1;this.v&&wa(this,a);var b=a;if(Ca(a)&&(b=Bb(a),void 0===b))return!1;a=this.Db[b];if(void 0===a)return!1;var c=a.oa,d=a.sl;null!==c&&(c.sl=d);null!==d&&(d.oa=c);this.fa===a&&(this.fa=c);this.Re===a&&(this.Re=d);delete this.Db[b];this.Cb--;this.kb();return!0};t.delete=function(a){return this.remove(a)};t.clear=function(){this.v&&wa(this);this.Db={};this.Cb=0;null!==this.Ja&&this.Ja.reset();null!==this.Qe&&this.Qe.reset();this.Re=this.fa=null;this.kb()};
Lb.prototype.copy=function(){var a=new Lb,b=this.Db,c;for(c in b){var d=b[c];a.add(d.key,d.value)}return a};Lb.prototype.Na=function(){var a=this.Db,b=Array(this.Cb),c=0,d;for(d in a){var e=a[d];b[c]=new Fb(e.key,e.value);c++}return b};Lb.prototype.Xd=function(){return new Ib(this)};
pa.Object.defineProperties(Lb.prototype,{count:{get:function(){return this.Cb}},size:{get:function(){return this.Cb}},iterator:{get:function(){if(0>=this.count)return xb;var a=this.Ja;return null!==a?(a.reset(),a):new Kb(this)}},iteratorKeys:{get:function(){return 0>=this.count?xb:new Hb(this)}},iteratorValues:{get:function(){if(0>=this.count)return xb;
var a=this.Qe;return null!==a?(a.reset(),a):new Jb(this)}}});Lb.prototype.toKeySet=Lb.prototype.Xd;Lb.prototype.toArray=Lb.prototype.Na;Lb.prototype.clear=Lb.prototype.clear;Lb.prototype["delete"]=Lb.prototype.delete;Lb.prototype.remove=Lb.prototype.remove;Lb.prototype.get=Lb.prototype.get;Lb.prototype.getValue=Lb.prototype.J;Lb.prototype.has=Lb.prototype.has;Lb.prototype.contains=Lb.prototype.contains;Lb.prototype.first=Lb.prototype.first;Lb.prototype.addAll=Lb.prototype.addAll;
Lb.prototype.set=Lb.prototype.set;Lb.prototype.add=Lb.prototype.add;Lb.prototype.thaw=Lb.prototype.ha;Lb.prototype.freeze=Lb.prototype.freeze;Lb.className="Map";function G(a,b){void 0===a?this.D=this.C=0:"number"===typeof a&&"number"===typeof b?(this.C=a,this.D=b):A("Invalid arguments to Point constructor: "+a+", "+b);this.v=!1}G.prototype.assign=function(a){this.C=a.C;this.D=a.D;return this};G.prototype.h=function(a,b){this.C=a;this.D=b;return this};
G.prototype.sg=function(a,b){this.C=a;this.D=b;return this};G.prototype.set=function(a){this.C=a.C;this.D=a.D;return this};G.prototype.copy=function(){var a=new G;a.C=this.C;a.D=this.D;return a};t=G.prototype;t.ga=function(){this.v=!0;Object.freeze(this);return this};t.I=function(){return Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.v=!0;return this};t.ha=function(){Object.isFrozen(this)&&A("cannot thaw constant: "+this);this.v=!1;return this};
function Nb(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 G(c,e)}return new G}function Ob(a){return a.x.toString()+" "+a.y.toString()}t.toString=function(){return"Point("+this.x+","+this.y+")"};t.A=function(a){return a instanceof G?this.C===a.x&&this.D===a.y:!1};t.Bi=function(a,b){return this.C===a&&this.D===b};t.Qa=function(a){return H.w(this.C,a.x)&&H.w(this.D,a.y)};
t.add=function(a){this.C+=a.x;this.D+=a.y;return this};t.Wd=function(a){this.C-=a.x;this.D-=a.y;return this};t.offset=function(a,b){this.C+=a;this.D+=b;return this};G.prototype.rotate=function(a){if(0===a)return this;var b=this.C,c=this.D;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.C=a*b-d*c;this.D=d*b+a*c;return this};t=G.prototype;
t.scale=function(a,b){this.C*=a;this.D*=b;return this};t.Ae=function(a){var b=a.x-this.C;a=a.y-this.D;return b*b+a*a};t.cd=function(a,b){a-=this.C;b-=this.D;return a*a+b*b};t.normalize=function(){var a=this.C,b=this.D,c=Math.sqrt(a*a+b*b);0<c&&(this.C=a/c,this.D=b/c);return this};t.Wa=function(a){return Pb(a.x-this.C,a.y-this.D)};t.direction=function(a,b){return Pb(a-this.C,b-this.D)};
function Pb(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.Dz=function(a,b,c,d){H.Oi(a,b,c,d,this.C,this.D,this);return this};t.Ez=function(a,b){H.Oi(a.x,a.y,b.x,b.y,this.C,this.D,this);return this};t.Oz=function(a,b,c,d){H.Qp(this.C,this.D,a,b,c,d,this);return this};t.Pz=function(a,b){H.Qp(this.C,this.D,a.x,a.y,b.width,b.height,this);return this};
t.Ri=function(a,b){this.C=a.x+b.x*a.width+b.offsetX;this.D=a.y+b.y*a.height+b.offsetY;return this};t.mk=function(a,b,c,d,e){this.C=a+e.x*c+e.offsetX;this.D=b+e.y*d+e.offsetY;return this};t.transform=function(a){a.ta(this);return this};function Qb(a,b){b.Td(a);return a}function Rb(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 Sb(a,b,c,d){a=c-a;b=d-b;return a*a+b*b}
function Tb(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.s=function(){return isFinite(this.x)&&isFinite(this.y)};G.alloc=function(){var a=$b.pop();return void 0===a?new G:a};G.allocAt=function(a,b){var c=$b.pop();if(void 0===c)return new G(a,b);c.x=a;c.y=b;return c};G.free=function(a){$b.push(a)};
pa.Object.defineProperties(G.prototype,{x:{get:function(){return this.C},set:function(a){this.C=a}},y:{get:function(){return this.D},set:function(a){this.D=a}}});G.prototype.isReal=G.prototype.s;G.prototype.setSpot=G.prototype.mk;G.prototype.setRectSpot=G.prototype.Ri;G.prototype.snapToGridPoint=G.prototype.Pz;G.prototype.snapToGrid=G.prototype.Oz;G.prototype.projectOntoLineSegmentPoint=G.prototype.Ez;G.prototype.projectOntoLineSegment=G.prototype.Dz;
G.prototype.direction=G.prototype.direction;G.prototype.directionPoint=G.prototype.Wa;G.prototype.normalize=G.prototype.normalize;G.prototype.distanceSquared=G.prototype.cd;G.prototype.distanceSquaredPoint=G.prototype.Ae;G.prototype.scale=G.prototype.scale;G.prototype.rotate=G.prototype.rotate;G.prototype.offset=G.prototype.offset;G.prototype.subtract=G.prototype.Wd;G.prototype.add=G.prototype.add;G.prototype.equalsApprox=G.prototype.Qa;G.prototype.equalTo=G.prototype.Bi;G.prototype.equals=G.prototype.A;
G.prototype.set=G.prototype.set;G.prototype.setTo=G.prototype.sg;var ac=null,bc=null,cc=null,dc=null,ec=null,$b=[];G.className="Point";G.parse=Nb;G.stringify=Ob;G.distanceLineSegmentSquared=Rb;G.distanceSquared=Sb;G.direction=Tb;G.Origin=ac=(new G(0,0)).ga();G.InfiniteTopLeft=bc=(new G(-Infinity,-Infinity)).ga();G.InfiniteBottomRight=cc=(new G(Infinity,Infinity)).ga();G.SixPoint=dc=(new G(6,6)).ga();G.NoPoint=ec=(new G(NaN,NaN)).ga();G.parse=Nb;G.stringify=Ob;G.distanceLineSegmentSquared=Rb;
G.distanceSquared=Sb;G.direction=Tb;function K(a,b){void 0===a?this.Y=this.$=0:"number"===typeof a&&(0<=a||isNaN(a))&&"number"===typeof b&&(0<=b||isNaN(b))?(this.$=a,this.Y=b):A("Invalid arguments to Size constructor: "+a+", "+b);this.v=!1}var fc,gc,hc,ic,kc,lc,mc;K.prototype.assign=function(a){this.$=a.$;this.Y=a.Y;return this};K.prototype.h=function(a,b){this.$=a;this.Y=b;return this};K.prototype.sg=function(a,b){this.$=a;this.Y=b;return this};K.prototype.set=function(a){this.$=a.$;this.Y=a.Y;return this};
K.prototype.copy=function(){var a=new K;a.$=this.$;a.Y=this.Y;return a};t=K.prototype;t.ga=function(){this.v=!0;Object.freeze(this);return this};t.I=function(){return Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.v=!0;return this};t.ha=function(){Object.isFrozen(this)&&A("cannot thaw constant: "+this);this.v=!1;return this};
function nc(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));return new K(c,e)}return new K}function oc(a){return a.width.toString()+" "+a.height.toString()}t.toString=function(){return"Size("+this.width+","+this.height+")"};t.A=function(a){return a instanceof K?this.$===a.width&&this.Y===a.height:!1};t.Bi=function(a,b){return this.$===a&&this.Y===b};
t.Qa=function(a){return H.w(this.$,a.width)&&H.w(this.Y,a.height)};t.s=function(){return isFinite(this.width)&&isFinite(this.height)};K.alloc=function(){var a=pc.pop();return void 0===a?new K:a};K.free=function(a){pc.push(a)};
pa.Object.defineProperties(K.prototype,{width:{get:function(){return this.$},set:function(a){0>a&&xa(a,">= 0",K,"width");this.$=a}},height:{get:function(){return this.Y},set:function(a){0>a&&xa(a,">= 0",K,"height");this.Y=a}}});K.prototype.isReal=K.prototype.s;K.prototype.equalsApprox=K.prototype.Qa;K.prototype.equalTo=K.prototype.Bi;K.prototype.equals=K.prototype.A;K.prototype.set=K.prototype.set;K.prototype.setTo=K.prototype.sg;
var pc=[];K.className="Size";K.parse=nc;K.stringify=oc;K.ZeroSize=fc=(new K(0,0)).ga();K.OneSize=gc=(new K(1,1)).ga();K.SixSize=hc=(new K(6,6)).ga();K.EightSize=ic=(new K(8,8)).ga();K.TenSize=kc=(new K(10,10)).ga();K.InfiniteSize=lc=(new K(Infinity,Infinity)).ga();K.NoSize=mc=(new K(NaN,NaN)).ga();K.parse=nc;K.stringify=oc;
function L(a,b,c,d){void 0===a?this.Y=this.$=this.D=this.C=0:a instanceof G?b instanceof G?(this.C=Math.min(a.C,b.C),this.D=Math.min(a.D,b.D),this.$=Math.abs(a.C-b.C),this.Y=Math.abs(a.D-b.D)):b instanceof K?(this.C=a.C,this.D=a.D,this.$=b.$,this.Y=b.Y):A("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.C=a,this.D=b,this.$=c,this.Y=d):A("Invalid arguments to Rect constructor: "+
a+", "+b+", "+c+", "+d);this.v=!1}t=L.prototype;t.assign=function(a){this.C=a.C;this.D=a.D;this.$=a.$;this.Y=a.Y;return this};t.h=function(a,b,c,d){this.C=a;this.D=b;this.$=c;this.Y=d;return this};function sc(a,b,c){a.$=b;a.Y=c}t.sg=function(a,b,c,d){this.C=a;this.D=b;this.$=c;this.Y=d;return this};t.set=function(a){this.C=a.C;this.D=a.D;this.$=a.$;this.Y=a.Y;return this};t.jd=function(a){this.C=a.C;this.D=a.D;return this};t.Mz=function(a){this.$=a.$;this.Y=a.Y;return this};
L.prototype.copy=function(){var a=new L;a.C=this.C;a.D=this.D;a.$=this.$;a.Y=this.Y;return a};t=L.prototype;t.ga=function(){this.v=!0;Object.freeze(this);return this};t.I=function(){return Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.v=!0;return this};t.ha=function(){Object.isFrozen(this)&&A("cannot thaw constant: "+this);this.v=!1;return this};
function tc(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));for(var f=0;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));for(var g=0;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));return new L(c,e,f,g)}return new L}function uc(a){return a.x.toString()+" "+a.y.toString()+" "+a.width.toString()+" "+a.height.toString()}
t.toString=function(){return"Rect("+this.x+","+this.y+","+this.width+","+this.height+")"};t.A=function(a){return a instanceof L?this.C===a.x&&this.D===a.y&&this.$===a.width&&this.Y===a.height:!1};t.Bi=function(a,b,c,d){return this.C===a&&this.D===b&&this.$===c&&this.Y===d};t.Qa=function(a){return H.w(this.C,a.x)&&H.w(this.D,a.y)&&H.w(this.$,a.width)&&H.w(this.Y,a.height)};function xc(a,b){return H.ca(a.C,b.x)&&H.ca(a.D,b.y)&&H.ca(a.$,b.width)&&H.ca(a.Y,b.height)}
t.ea=function(a){return this.C<=a.x&&this.C+this.$>=a.x&&this.D<=a.y&&this.D+this.Y>=a.y};t.mf=function(a){return this.C<=a.x&&a.x+a.width<=this.C+this.$&&this.D<=a.y&&a.y+a.height<=this.D+this.Y};t.contains=function(a,b,c,d){void 0===c&&(c=0);void 0===d&&(d=0);return this.C<=a&&a+c<=this.C+this.$&&this.D<=b&&b+d<=this.D+this.Y};t.reset=function(){this.Y=this.$=this.D=this.C=0};t.offset=function(a,b){this.C+=a;this.D+=b;return this};t.Tc=function(a,b){return yc(this,b,a,b,a)};
t.Ip=function(a){return yc(this,a.top,a.right,a.bottom,a.left)};t.Kv=function(a){return yc(this,-a.top,-a.right,-a.bottom,-a.left)};t.gz=function(a,b,c,d){return yc(this,a,b,c,d)};function yc(a,b,c,d,e){var f=a.$;c+e<=-f?(a.C+=f/2,a.$=0):(a.C-=e,a.$+=c+e);c=a.Y;b+d<=-c?(a.D+=c/2,a.Y=0):(a.D-=b,a.Y+=b+d);return a}t.kz=function(a){return zc(this,a.x,a.y,a.width,a.height)};t.bv=function(a,b,c,d){return zc(this,a,b,c,d)};
function zc(a,b,c,d,e){var f=Math.max(a.C,b),g=Math.max(a.D,c);b=Math.min(a.C+a.$,b+d);c=Math.min(a.D+a.Y,c+e);a.C=f;a.D=g;a.$=Math.max(0,b-f);a.Y=Math.max(0,c-g);return a}t.Ic=function(a){return this.cv(a.x,a.y,a.width,a.height)};t.cv=function(a,b,c,d){var e=this.$,f=this.C;if(Infinity!==e&&Infinity!==c&&(e+=f,c+=a,isNaN(c)||isNaN(e)||f>c||a>e))return!1;a=this.Y;c=this.D;return Infinity!==a&&Infinity!==d&&(a+=c,d+=b,isNaN(d)||isNaN(a)||c>d||b>a)?!1:!0};
function Ac(a,b,c){var d=a.$,e=a.C,f=b.x-c;if(e>b.width+c+c+f||f>d+e)return!1;d=a.Y;a=a.D;e=b.y-c;return a>b.height+c+c+e||e>d+a?!1:!0}t.He=function(a){return Bc(this,a.x,a.y,0,0)};t.Uc=function(a){return Bc(this,a.C,a.D,a.$,a.Y)};t.Rv=function(a,b,c,d){void 0===c&&(c=0);void 0===d&&(d=0);return Bc(this,a,b,c,d)};function Bc(a,b,c,d,e){var f=Math.min(a.C,b),g=Math.min(a.D,c);b=Math.max(a.C+a.$,b+d);c=Math.max(a.D+a.Y,c+e);a.C=f;a.D=g;a.$=b-f;a.Y=c-g;return a}
t.mk=function(a,b,c){this.C=a-c.offsetX-c.x*this.$;this.D=b-c.offsetY-c.y*this.Y;return this};function Cc(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 Dc(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.s=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)};t.mz=function(){return 0===this.width&&0===this.height};L.alloc=function(){var a=Fc.pop();return void 0===a?new L:a};
L.allocAt=function(a,b,c,d){var e=Fc.pop();return void 0===e?new L(a,b,c,d):e.h(a,b,c,d)};L.free=function(a){Fc.push(a)};
pa.Object.defineProperties(L.prototype,{x:{get:function(){return this.C},set:function(a){this.C=a}},y:{get:function(){return this.D},set:function(a){this.D=a}},width:{get:function(){return this.$},set:function(a){0>a&&xa(a,">= 0",L,"width");this.$=a}},height:{get:function(){return this.Y},set:function(a){0>a&&xa(a,">= 0",L,"height");this.Y=a}},left:{
get:function(){return this.C},set:function(a){this.C=a}},top:{get:function(){return this.D},set:function(a){this.D=a}},right:{get:function(){return this.C+this.$},set:function(a){this.C+=a-(this.C+this.$)}},bottom:{get:function(){return this.D+this.Y},set:function(a){this.D+=a-(this.D+this.Y)}},position:{get:function(){return new G(this.C,this.D)},set:function(a){this.C=a.x;this.D=
a.y}},size:{get:function(){return new K(this.$,this.Y)},set:function(a){this.$=a.width;this.Y=a.height}},center:{get:function(){return new G(this.C+this.$/2,this.D+this.Y/2)},set:function(a){this.C=a.x-this.$/2;this.D=a.y-this.Y/2}},centerX:{get:function(){return this.C+this.$/2},set:function(a){this.C=a-this.$/2}},centerY:{get:function(){return this.D+this.Y/2},set:function(a){this.D=
a-this.Y/2}}});L.prototype.isEmpty=L.prototype.mz;L.prototype.isReal=L.prototype.s;L.prototype.setSpot=L.prototype.mk;L.prototype.union=L.prototype.Rv;L.prototype.unionRect=L.prototype.Uc;L.prototype.unionPoint=L.prototype.He;L.prototype.intersects=L.prototype.cv;L.prototype.intersectsRect=L.prototype.Ic;L.prototype.intersect=L.prototype.bv;L.prototype.intersectRect=L.prototype.kz;L.prototype.grow=L.prototype.gz;L.prototype.subtractMargin=L.prototype.Kv;L.prototype.addMargin=L.prototype.Ip;
L.prototype.inflate=L.prototype.Tc;L.prototype.offset=L.prototype.offset;L.prototype.contains=L.prototype.contains;L.prototype.containsRect=L.prototype.mf;L.prototype.containsPoint=L.prototype.ea;L.prototype.equalsApprox=L.prototype.Qa;L.prototype.equalTo=L.prototype.Bi;L.prototype.equals=L.prototype.A;L.prototype.setSize=L.prototype.Mz;L.prototype.setPoint=L.prototype.jd;L.prototype.set=L.prototype.set;L.prototype.setTo=L.prototype.sg;var Gc=null,Hc=null,Fc=[];L.className="Rect";L.parse=tc;
L.stringify=uc;L.contains=Cc;L.intersects=Dc;L.ZeroRect=Gc=(new L(0,0,0,0)).ga();L.NoRect=Hc=(new L(NaN,NaN,NaN,NaN)).ga();L.parse=tc;L.stringify=uc;L.contains=Cc;L.intersects=Dc;
function Ic(a,b,c,d){void 0===a?this.ke=this.$d=this.se=this.ve=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):A("Invalid arguments to Margin constructor: "+a+", "+b+", "+c+", "+d);this.v=!1}Ic.prototype.assign=function(a){this.ve=a.ve;this.se=a.se;this.$d=a.$d;this.ke=a.ke;return this};Ic.prototype.sg=function(a,b,c,d){this.ve=a;this.se=b;this.$d=c;this.ke=d;return this};
Ic.prototype.set=function(a){this.ve=a.ve;this.se=a.se;this.$d=a.$d;this.ke=a.ke;return this};Ic.prototype.copy=function(){var a=new Ic;a.ve=this.ve;a.se=this.se;a.$d=this.$d;a.ke=this.ke;return a};t=Ic.prototype;t.ga=function(){this.v=!0;Object.freeze(this);return this};t.I=function(){return Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.v=!0;return this};t.ha=function(){Object.isFrozen(this)&&A("cannot thaw constant: "+this);this.v=!1;return this};
function Jc(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 Ic;for(var e=NaN;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));if(isNaN(e))return new Ic(c);for(var f=NaN;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));if(isNaN(f))return new Ic(c,e);for(var g=NaN;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));return isNaN(g)?new Ic(c,e):new Ic(c,e,f,g)}return new Ic}
function Kc(a){return a.top.toString()+" "+a.right.toString()+" "+a.bottom.toString()+" "+a.left.toString()}t.toString=function(){return"Margin("+this.top+","+this.right+","+this.bottom+","+this.left+")"};t.A=function(a){return a instanceof Ic?this.ve===a.top&&this.se===a.right&&this.$d===a.bottom&&this.ke===a.left:!1};t.Bi=function(a,b,c,d){return this.ve===a&&this.se===b&&this.$d===c&&this.ke===d};
t.Qa=function(a){return H.w(this.ve,a.top)&&H.w(this.se,a.right)&&H.w(this.$d,a.bottom)&&H.w(this.ke,a.left)};t.s=function(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)};Ic.alloc=function(){var a=Nc.pop();return void 0===a?new Ic:a};Ic.free=function(a){Nc.push(a)};
pa.Object.defineProperties(Ic.prototype,{top:{get:function(){return this.ve},set:function(a){this.ve=a}},right:{get:function(){return this.se},set:function(a){this.se=a}},bottom:{get:function(){return this.$d},set:function(a){this.$d=a}},left:{get:function(){return this.ke},set:function(a){this.ke=a}}});Ic.prototype.isReal=Ic.prototype.s;Ic.prototype.equalsApprox=Ic.prototype.Qa;
Ic.prototype.equalTo=Ic.prototype.Bi;Ic.prototype.equals=Ic.prototype.A;Ic.prototype.set=Ic.prototype.set;Ic.prototype.setTo=Ic.prototype.sg;var Oc=null,Pc=null,Nc=[];Ic.className="Margin";Ic.parse=Jc;Ic.stringify=Kc;Ic.ZeroMargin=Oc=(new Ic(0,0,0,0)).ga();Ic.TwoMargin=Pc=(new Ic(2,2,2,2)).ga();Ic.parse=Jc;Ic.stringify=Kc;function Qc(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0}
Qc.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};Qc.prototype.copy=function(){var a=new Qc;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=Qc.prototype;t.toString=function(){return"Transform("+this.m11+","+this.m12+","+this.m21+","+this.m22+","+this.dx+","+this.dy+")"};
t.A=function(a){return a instanceof Qc?this.m11===a.m11&&this.m12===a.m12&&this.m21===a.m21&&this.m22===a.m22&&this.dx===a.dx&&this.dy===a.dy:!1};t.$s=function(){return 0===this.dx&&0===this.dy&&1===this.m11&&0===this.m12&&0===this.m21&&1===this.m22};t.reset=function(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0;return this};
t.multiply=function(a){var b=this.m12*a.m11+this.m22*a.m12,c=this.m11*a.m21+this.m21*a.m22,d=this.m12*a.m21+this.m22*a.m22,e=this.m11*a.dx+this.m21*a.dy+this.dx,f=this.m12*a.dx+this.m22*a.dy+this.dy;this.m11=this.m11*a.m11+this.m21*a.m12;this.m12=b;this.m21=c;this.m22=d;this.dx=e;this.dy=f;return this};
t.iv=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.Zs=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};
Qc.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=Qc.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.ta=function(a){var b=a.C,c=a.D;a.C=b*this.m11+c*this.m21+this.dx;a.D=b*this.m12+c*this.m22+this.dy;return a};t.Td=function(a){var b=1/(this.m11*this.m22-this.m12*this.m21),c=-this.m12*b,d=this.m11*b,e=b*(this.m12*this.dx-this.m11*this.dy),f=a.C,g=a.D;a.C=f*this.m22*b+g*-this.m21*b+b*(this.m21*this.dy-this.m22*this.dx);a.D=f*c+g*d+e;return a};
t.Qv=function(a){var b=a.C,c=a.D,d=b+a.$,e=c+a.Y,f=this.m11,g=this.m12,h=this.m21,k=this.m22,l=this.dx,m=this.dy,n=b*f+c*h+l,p=b*g+c*k+m,q=d*f+c*h+l,r=d*g+c*k+m;c=b*f+e*h+l;b=b*g+e*k+m;f=d*f+e*h+l;d=d*g+e*k+m;e=Math.min(n,q);n=Math.max(n,q);q=Math.min(p,r);p=Math.max(p,r);e=Math.min(e,c);n=Math.max(n,c);q=Math.min(q,b);p=Math.max(p,b);e=Math.min(e,f);n=Math.max(n,f);q=Math.min(q,d);p=Math.max(p,d);a.C=e;a.D=q;a.$=n-e;a.Y=p-q;return a};Qc.alloc=function(){var a=Rc.pop();return void 0===a?new Qc:a};
Qc.free=function(a){Rc.push(a)};Qc.prototype.transformRect=Qc.prototype.Qv;Qc.prototype.invertedTransformPoint=Qc.prototype.Td;Qc.prototype.transformPoint=Qc.prototype.ta;Qc.prototype.scale=Qc.prototype.scale;Qc.prototype.translate=Qc.prototype.translate;Qc.prototype.rotate=Qc.prototype.rotate;Qc.prototype.invert=Qc.prototype.Zs;Qc.prototype.multiplyInverted=Qc.prototype.iv;Qc.prototype.multiply=Qc.prototype.multiply;Qc.prototype.reset=Qc.prototype.reset;Qc.prototype.isIdentity=Qc.prototype.$s;
Qc.prototype.equals=Qc.prototype.A;Qc.prototype.set=Qc.prototype.set;var Rc=[];Qc.className="Transform";Qc.xF="54a702f3e53909c447824c6706603faf4c";function O(a,b,c,d){void 0===a?this.Md=this.Ld=this.D=this.C=0:(void 0===b&&(b=0),void 0===c&&(c=0),void 0===d&&(d=0),this.x=a,this.y=b,this.offsetX=c,this.offsetY=d);this.v=!1}var Sc,Tc,Uc,Vc,cd,dd,ed,fd,gd,hd,id,jd,pd,qd,rd,sd,td,ud,vd,wd,zd,Ad,Bd,Cd,Dd,Ed,Fd,Gd,Hd,Id,Jd,Rd,Sd,Td,Ud,Vd;
O.prototype.assign=function(a){this.C=a.C;this.D=a.D;this.Ld=a.Ld;this.Md=a.Md;return this};O.prototype.sg=function(a,b,c,d){this.C=a;this.D=b;this.Ld=c;this.Md=d;return this};O.prototype.set=function(a){this.C=a.C;this.D=a.D;this.Ld=a.Ld;this.Md=a.Md;return this};O.prototype.copy=function(){var a=new O;a.C=this.C;a.D=this.D;a.Ld=this.Ld;a.Md=this.Md;return a};t=O.prototype;t.ga=function(){this.v=!0;Object.freeze(this);return this};t.I=function(){return Object.isFrozen(this)?this:this.copy().freeze()};
t.freeze=function(){this.v=!0;return this};t.ha=function(){Object.isFrozen(this)&&A("cannot thaw constant: "+this);this.v=!1;return this};function Wd(a,b){a.C=NaN;a.D=NaN;a.Ld=b;return a}
function Xd(a){if("string"===typeof a){a=a.trim();if("None"===a)return Sc;if("TopLeft"===a)return Tc;if("Top"===a||"TopCenter"===a||"MiddleTop"===a)return Uc;if("TopRight"===a)return Vc;if("Left"===a||"LeftCenter"===a||"MiddleLeft"===a)return cd;if("Center"===a)return dd;if("Right"===a||"RightCenter"===a||"MiddleRight"===a)return ed;if("BottomLeft"===a)return fd;if("Bottom"===a||"BottomCenter"===a||"MiddleBottom"===a)return gd;if("BottomRight"===a)return hd;if("TopSide"===a)return id;if("LeftSide"===
a)return jd;if("RightSide"===a)return pd;if("BottomSide"===a)return qd;if("TopBottomSides"===a)return rd;if("LeftRightSides"===a)return sd;if("TopLeftSides"===a)return td;if("TopRightSides"===a)return ud;if("BottomLeftSides"===a)return vd;if("BottomRightSides"===a)return wd;if("NotTopSide"===a)return zd;if("NotLeftSide"===a)return Ad;if("NotRightSide"===a)return Bd;if("NotBottomSide"===a)return Cd;if("AllSides"===a)return Dd;if("Default"===a)return Ed;a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;
var d=a[b++];void 0!==d&&0<d.length&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(e=parseFloat(d));for(var f=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(f=parseFloat(d));for(var g=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(g=parseFloat(d));return new O(c,e,f,g)}return new O}function Yd(a){return a.gb()?a.x.toString()+" "+a.y.toString()+" "+a.offsetX.toString()+" "+a.offsetY.toString():a.toString()}
t.toString=function(){return this.gb()?0===this.Ld&&0===this.Md?"Spot("+this.x+","+this.y+")":"Spot("+this.x+","+this.y+","+this.offsetX+","+this.offsetY+")":this.A(Sc)?"None":this.A(Tc)?"TopLeft":this.A(Uc)?"Top":this.A(Vc)?"TopRight":this.A(cd)?"Left":this.A(dd)?"Center":this.A(ed)?"Right":this.A(fd)?"BottomLeft":this.A(gd)?"Bottom":this.A(hd)?"BottomRight":this.A(id)?"TopSide":this.A(jd)?"LeftSide":this.A(pd)?"RightSide":this.A(qd)?"BottomSide":this.A(rd)?"TopBottomSides":this.A(sd)?"LeftRightSides":
this.A(td)?"TopLeftSides":this.A(ud)?"TopRightSides":this.A(vd)?"BottomLeftSides":this.A(wd)?"BottomRightSides":this.A(zd)?"NotTopSide":this.A(Ad)?"NotLeftSide":this.A(Bd)?"NotRightSide":this.A(Cd)?"NotBottomSide":this.A(Dd)?"AllSides":this.A(Ed)?"Default":"None"};t.A=function(a){return a instanceof O?(this.C===a.x||isNaN(this.C)&&isNaN(a.x))&&(this.D===a.y||isNaN(this.D)&&isNaN(a.y))&&this.Ld===a.offsetX&&this.Md===a.offsetY:!1};
t.mv=function(){return new O(.5-(this.C-.5),.5-(this.D-.5),-this.Ld,-this.Md)};t.pf=function(a){if(!this.qf())return!1;if(!a.qf())if(a.A(Fd))a=jd;else if(a.A(Gd))a=pd;else if(a.A(Hd))a=id;else if(a.A(Id))a=qd;else return!1;a=a.offsetY;return(this.Md&a)===a};t.gb=function(){return!isNaN(this.x)&&!isNaN(this.y)};t.kc=function(){return isNaN(this.x)||isNaN(this.y)};t.qf=function(){return isNaN(this.x)&&isNaN(this.y)&&1===this.offsetX&&0!==this.offsetY};
t.bt=function(){return isNaN(this.x)&&isNaN(this.y)&&0===this.offsetX&&0===this.offsetY};t.Kb=function(){return isNaN(this.x)&&isNaN(this.y)&&-1===this.offsetX&&0===this.offsetY};O.alloc=function(){var a=Zd.pop();return void 0===a?new O:a};O.free=function(a){Zd.push(a)};
pa.Object.defineProperties(O.prototype,{x:{get:function(){return this.C},set:function(a){this.C=a}},y:{get:function(){return this.D},set:function(a){this.D=a}},offsetX:{get:function(){return this.Ld},set:function(a){this.Ld=a}},offsetY:{get:function(){return this.Md},set:function(a){this.Md=a}}});O.prototype.isDefault=O.prototype.Kb;O.prototype.isNone=O.prototype.bt;
O.prototype.isSide=O.prototype.qf;O.prototype.isNoSpot=O.prototype.kc;O.prototype.isSpot=O.prototype.gb;O.prototype.includesSide=O.prototype.pf;O.prototype.opposite=O.prototype.mv;O.prototype.equals=O.prototype.A;O.prototype.set=O.prototype.set;O.prototype.setTo=O.prototype.sg;var Zd=[];O.className="Spot";O.parse=Xd;O.stringify=Yd;O.None=Sc=Wd(new O(0,0,0,0),0).ga();O.Default=Ed=Wd(new O(0,0,-1,0),-1).ga();O.TopLeft=Tc=(new O(0,0,0,0)).ga();O.TopCenter=Uc=(new O(.5,0,0,0)).ga();
O.TopRight=Vc=(new O(1,0,0,0)).ga();O.LeftCenter=cd=(new O(0,.5,0,0)).ga();O.Center=dd=(new O(.5,.5,0,0)).ga();O.RightCenter=ed=(new O(1,.5,0,0)).ga();O.BottomLeft=fd=(new O(0,1,0,0)).ga();O.BottomCenter=gd=(new O(.5,1,0,0)).ga();O.BottomRight=hd=(new O(1,1,0,0)).ga();O.MiddleTop=Jd=Uc;O.MiddleLeft=Rd=cd;O.MiddleRight=Sd=ed;O.MiddleBottom=Td=gd;O.Top=Hd=Uc;O.Left=Fd=cd;O.Right=Gd=ed;O.Bottom=Id=gd;O.TopSide=id=Wd(new O(0,0,1,1),1).ga();O.LeftSide=jd=Wd(new O(0,0,1,2),1).ga();
O.RightSide=pd=Wd(new O(0,0,1,4),1).ga();O.BottomSide=qd=Wd(new O(0,0,1,8),1).ga();O.TopBottomSides=rd=Wd(new O(0,0,1,9),1).ga();O.LeftRightSides=sd=Wd(new O(0,0,1,6),1).ga();O.TopLeftSides=td=Wd(new O(0,0,1,3),1).ga();O.TopRightSides=ud=Wd(new O(0,0,1,5),1).ga();O.BottomLeftSides=vd=Wd(new O(0,0,1,10),1).ga();O.BottomRightSides=wd=Wd(new O(0,0,1,12),1).ga();O.NotTopSide=zd=Wd(new O(0,0,1,14),1).ga();O.NotLeftSide=Ad=Wd(new O(0,0,1,13),1).ga();O.NotRightSide=Bd=Wd(new O(0,0,1,11),1).ga();
O.NotBottomSide=Cd=Wd(new O(0,0,1,7),1).ga();O.AllSides=Dd=Wd(new O(0,0,1,15),1).ga();Ud=(new O(.156,.156)).ga();Vd=(new O(.844,.844)).ga();O.parse=Xd;O.stringify=Yd;
var H={Uz:"7da71ca0ad381e90",wg:(Math.sqrt(2)-1)/3*4,bw:null,sqrt:function(a){if(0>=a)return 0;var b=H.bw;if(null===b){b=[];for(var c=0;2E3>=c;c++)b[c]=Math.sqrt(c);H.bw=b}return 1>a?(c=1/a,2E3>=c?1/b[c|0]:Math.sqrt(a)):2E3>=a?b[a|0]:Math.sqrt(a)},w:function(a,b){a-=b;return.5>a&&-.5<a},ca:function(a,b){a-=b;return 5E-8>a&&-5E-8<a},Tb: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},Es:function(a,b,c,d,e,f,g,h,k,l,m,n){if(H.Tb(a,b,g,h,n,c,d)&&H.Tb(a,b,g,h,n,e,f))return H.Tb(a,b,g,h,n,l,m);var p=(a+c)/2,q=(b+d)/2,r=(c+e)/2,u=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(p+r)/2;c=(q+u)/2;r=(r+e)/2;u=(u+f)/2;var x=(d+r)/2,v=(c+u)/2;return H.Es(a,
b,p,q,d,c,x,v,k,l,m,n)||H.Es(x,v,r,u,e,f,g,h,k,l,m,n)},ly: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},ky:function(a,b,c,d,e,f,g,h){var k=(c+e)/2,l=(d+f)/2;return Tb(((a+c)/2+k)/2,((b+d)/2+l)/2,(k+(e+g)/2)/2,(l+(f+h)/2)/2)},Ql:function(a,b,c,d,e,f,g,h,k,l){if(H.Tb(a,b,g,h,k,c,d)&&H.Tb(a,b,g,h,k,e,f))Bc(l,a,b,0,0),Bc(l,g,h,0,0);else{var m=(a+c)/2,n=(b+d)/2,p=(c+e)/2,q=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(m+p)/2;c=(n+q)/
2;p=(p+e)/2;q=(q+f)/2;var r=(d+p)/2,u=(c+q)/2;H.Ql(a,b,m,n,d,c,r,u,k,l);H.Ql(r,u,p,q,e,f,g,h,k,l)}return l},ye:function(a,b,c,d,e,f,g,h,k,l){if(H.Tb(a,b,g,h,k,c,d)&&H.Tb(a,b,g,h,k,e,f))0===l.length&&(l.push(a),l.push(b)),l.push(g),l.push(h);else{var m=(a+c)/2,n=(b+d)/2,p=(c+e)/2,q=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(m+p)/2;c=(n+q)/2;p=(p+e)/2;q=(q+f)/2;var r=(d+p)/2,u=(c+q)/2;H.ye(a,b,m,n,d,c,r,u,k,l);H.ye(r,u,p,q,e,f,g,h,k,l)}return l},Xz:function(a,b,c,d,e,f,g,h,k,l,m,n,p,q){var r=1-k;a=a*r+c*k;b=b*
r+d*k;c=c*r+e*k;d=d*r+f*k;e=e*r+g*k;f=f*r+h*k;h=a*r+c*k;g=b*r+d*k;c=c*r+e*k;d=d*r+f*k;var u=h*r+c*k;k=g*r+d*k;l.h(a,b);m.h(h,g);n.h(u,k);p.h(c,d);q.h(e,f)},pv:function(a,b,c,d,e,f,g,h,k,l){if(H.Tb(a,b,e,f,l,c,d))return H.Tb(a,b,e,f,l,h,k);var m=(a+c)/2,n=(b+d)/2;c=(c+e)/2;d=(d+f)/2;var p=(m+c)/2,q=(n+d)/2;return H.pv(a,b,m,n,p,q,g,h,k,l)||H.pv(p,q,c,d,e,f,g,h,k,l)},dA: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},ov:function(a,b,c,d,e,f,g,h){if(H.Tb(a,b,e,f,g,c,d))Bc(h,
a,b,0,0),Bc(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;H.ov(a,b,k,l,m,n,g,h);H.ov(m,n,c,d,e,f,g,h)}return h},gq:function(a,b,c,d,e,f,g,h){if(H.Tb(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;H.gq(a,b,k,l,m,n,g,h);H.gq(m,n,c,d,e,f,g,h)}return h},Jp:function(a,b,c,d,e,f,g,h,k,l,m,n,p,q){if(H.Tb(a,b,g,h,p,c,d)&&H.Tb(a,b,g,h,p,e,f)){var r=(a-g)*(l-n)-(b-h)*(k-m);
if(0===r)return!1;p=((a*h-b*g)*(k-m)-(a-g)*(k*n-l*m))/r;r=((a*h-b*g)*(l-n)-(b-h)*(k*n-l*m))/r;if((k>m?k-m:m-k)<(l>n?l-n:n-l)){if(b<h?g=b:(g=h,h=b),r<g||r>h)return!1}else if(a<g?h=a:(h=g,g=a),p<h||p>g)return!1;q.h(p,r);return!0}r=(a+c)/2;var u=(b+d)/2;c=(c+e)/2;d=(d+f)/2;e=(e+g)/2;f=(f+h)/2;var x=(r+c)/2,v=(u+d)/2;c=(c+e)/2;d=(d+f)/2;var y=(x+c)/2,z=(v+d)/2,B=(m-k)*(m-k)+(n-l)*(n-l),C=!1;H.Jp(a,b,r,u,x,v,y,z,k,l,m,n,p,q)&&(a=(q.x-k)*(q.x-k)+(q.y-l)*(q.y-l),a<B&&(B=a,C=!0));a=q.x;b=q.y;H.Jp(y,z,c,d,
e,f,g,h,k,l,m,n,p,q)&&((q.x-k)*(q.x-k)+(q.y-l)*(q.y-l)<B?C=!0:q.h(a,b));return C},Kp:function(a,b,c,d,e,f,g,h,k,l,m,n,p){var q=0;if(H.Tb(a,b,g,h,p,c,d)&&H.Tb(a,b,g,h,p,e,f)){p=(a-g)*(l-n)-(b-h)*(k-m);if(0===p)return q;var r=((a*h-b*g)*(k-m)-(a-g)*(k*n-l*m))/p,u=((a*h-b*g)*(l-n)-(b-h)*(k*n-l*m))/p;if(r>=m)return q;if((k>m?k-m:m-k)<(l>n?l-n:n-l)){if(b<h?(a=b,b=h):a=h,u<a||u>b)return q}else if(a<g?(b=a,a=g):b=g,r<b||r>a)return q;0<p?q++:0>p&&q--}else{r=(a+c)/2;u=(b+d)/2;var x=(c+e)/2,v=(d+f)/2;e=(e+
g)/2;f=(f+h)/2;d=(r+x)/2;c=(u+v)/2;x=(x+e)/2;v=(v+f)/2;var y=(d+x)/2,z=(c+v)/2;q+=H.Kp(a,b,r,u,d,c,y,z,k,l,m,n,p);q+=H.Kp(y,z,x,v,e,f,g,h,k,l,m,n,p)}return q},Oi:function(a,b,c,d,e,f,g){if(H.ca(a,c)){b<d?(c=b,b=d):c=d;if(f<c)return g.h(a,c),!1;if(f>b)return g.h(a,b),!1;g.h(a,f);return!0}if(H.ca(b,d)){a<c?(d=a,a=c):d=c;if(e<d)return g.h(d,b),!1;if(e>a)return g.h(a,b),!1;g.h(e,b);return!0}e=((a-e)*(a-c)+(b-f)*(b-d))/((c-a)*(c-a)+(d-b)*(d-b));if(-5E-6>e)return g.h(a,b),!1;if(1.000005<e)return g.h(c,
d),!1;g.h(a+e*(c-a),b+e*(d-b));return!0},Ee:function(a,b,c,d,e,f,g,h,k){if(H.w(a,c)&&H.w(b,d))return k.h(a,b),!1;if(H.ca(e,g))return H.ca(a,c)?(H.Oi(a,b,c,d,e,f,k),!1):H.Oi(a,b,c,d,e,(d-b)/(c-a)*(e-a)+b,k);h=(h-f)/(g-e);if(H.ca(a,c)){c=h*(a-e)+f;b<d?(e=b,b=d):e=d;if(c<e)return k.h(a,e),!1;if(c>b)return k.h(a,b),!1;k.h(a,c);return!0}g=(d-b)/(c-a);if(H.ca(h,g))return H.Oi(a,b,c,d,e,f,k),!1;e=(g*a-h*e+f-b)/(g-h);if(H.ca(g,0)){a<c?(d=a,a=c):d=c;if(e<d)return k.h(d,b),!1;if(e>a)return k.h(a,b),!1;k.h(e,
b);return!0}return H.Oi(a,b,c,d,e,g*(e-a)+b,k)},aA:function(a,b,c,d,e){return H.Ee(c.x,c.y,d.x,d.y,a.x,a.y,b.x,b.y,e)},$z:function(a,b,c,d,e,f,g,h,k,l){function m(c,d){var e=(c-a)*(c-a)+(d-b)*(d-b);e<n&&(n=e,k.h(c,d))}var n=Infinity;m(k.x,k.y);var p=0,q=0,r=0,u=0;e<g?(p=e,q=g):(p=g,q=e);f<h?(r=e,u=g):(r=g,u=e);p=(q-p)/2+l;l=(u-r)/2+l;e=(e+g)/2;f=(f+h)/2;if(0===p||0===l)return k;if(.5>(c>a?c-a:a-c)){p=1-(c-e)*(c-e)/(p*p);if(0>p)return k;p=Math.sqrt(p);d=-l*p+f;m(c,l*p+f);m(c,d)}else{c=(d-b)/(c-a);
d=1/(p*p)+c*c/(l*l);h=2*c*(b-c*a)/(l*l)-2*c*f/(l*l)-2*e/(p*p);p=h*h-4*d*(2*c*a*f/(l*l)-2*b*f/(l*l)+f*f/(l*l)+e*e/(p*p)-1+(b-c*a)*(b-c*a)/(l*l));if(0>p)return k;p=Math.sqrt(p);l=(-h+p)/(2*d);m(l,c*l-c*a+b);p=(-h-p)/(2*d);m(p,c*p-c*a+b)}return k},Sc:function(a,b,c,d,e,f,g,h,k){var l=1E21,m=a,n=b;if(H.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)}H.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));H.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));H.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},Zz: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},Xs:function(a,b,c){var d=b.x,e=b.y,f=c.x,g=c.y,h=a.left,k=a.right,l=a.top,m=a.bottom;return d===f?(e<g?(f=e,e=g):f=g,h<=d&&d<=k&&f<=m&&e>=l):e===
g?(d<f?(g=d,d=f):g=f,l<=e&&e<=m&&g<=k&&d>=h):a.ea(b)||a.ea(c)||H.Ws(h,l,k,l,d,e,f,g)||H.Ws(k,l,k,m,d,e,f,g)||H.Ws(k,m,h,m,d,e,f,g)||H.Ws(h,m,h,l,d,e,f,g)?!0:!1},Ws:function(a,b,c,d,e,f,g,h){return 0>=H.Hs(a,b,c,d,e,f)*H.Hs(a,b,c,d,g,h)&&0>=H.Hs(e,f,g,h,a,b)*H.Hs(e,f,g,h,c,d)},Hs: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},cq:function(a){0>a&&(a+=360);360<=a&&(a-=360);return a},Yw: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(H.ty(c,l,e,a,b)),d-=Math.abs(e-l),l=e;return f},ty: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)]},Qp: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},ix: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},yy: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 H.zy(k,0===g?a:b,l,c,0,0)},zy: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},Ie:new tb,
zm:new tb};H.za=H.Uz;function $d(a){mb(this);this.v=!1;void 0===a&&(a=ae);this.va=a;this.Bc=this.nc=this.bd=this.ad=0;this.ej=new E;this.fr=this.ej.Ba;this.Nq=(new L).freeze();this.ra=!0;this.Lm=this.uk=null;this.Mm=NaN;this.cf=Tc;this.df=hd;this.Zk=this.al=NaN;this.Cf=be}
$d.prototype.copy=function(){var a=new $d;a.va=this.va;a.ad=this.ad;a.bd=this.bd;a.nc=this.nc;a.Bc=this.Bc;for(var b=this.ej.j,c=b.length,d=a.ej,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.fr=this.fr;a.Nq.assign(this.Nq);a.ra=this.ra;a.uk=this.uk;a.Lm=this.Lm;a.Mm=this.Mm;a.cf=this.cf.I();a.df=this.df.I();a.al=this.al;a.Zk=this.Zk;a.Cf=this.Cf;return a};t=$d.prototype;t.ga=function(){this.freeze();Object.freeze(this);return this};
t.freeze=function(){this.v=!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.ha=function(){Object.isFrozen(this)&&A("cannot thaw constant: "+this);this.v=!1;var a=this.figures;a.ha();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].ha();return this};
t.Qa=function(a){if(!(a instanceof $d))return!1;if(this.type!==a.type)return this.type===ge&&a.type===ae?he(this,a):a.type===ge&&this.type===ae?he(a,this):!1;if(this.type===ae){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].Qa(a[d]))return!1;return!0}return H.w(this.startX,a.startX)&&H.w(this.startY,a.startY)&&H.w(this.endX,a.endX)&&H.w(this.endY,a.endY)};
function he(a,b){return a.type!==ge||b.type!==ae?!1:1===b.figures.count&&(b=b.figures.N(0),1===b.segments.count&&H.w(a.startX,b.startX)&&H.w(a.startY,b.startY)&&(b=b.segments.N(0),b.type===ie&&H.w(a.endX,b.endX)&&H.w(a.endY,b.endY)))?!0:!1}function je(a){return a.toString()}t.fb=function(a){a.classType===$d&&(this.type=a)};
t.toString=function(a){void 0===a&&(a=-1);switch(this.type){case ge: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 ke:var b=new L(this.startX,this.startY,0,0);b.Rv(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 le:b=new L(this.startX,this.startY,0,0);b.Rv(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 ae: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 me(a,b){function c(){return u>=B-1?!0:null!==k[u+1].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/)}function d(){u++;return k[u]}function e(){var a=new G(parseFloat(d()),parseFloat(d()));x===x.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=v.toLowerCase();return"c"!==a&&"s"!==a&&"q"!==a&&"t"!==a?z:new G(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=
Ka(),n="",p=!1,q=0;q<l.length;q++){var r=l[q];"."!==r||p?"."===r?(m.push(n),n="."):n+=r:(p=!0,n+=r)}m.push(n);k.splice(a,1);for(l=0;l<m.length;l++)k.splice(a+l,0,m[l]);a+=m.length-1;Oa(m)}}var u=-1,x="",v="";m=new G(0,0);var y=new G(0,0),z=new G(0,0),B=k.length;a=ne(null);n=l=!1;p=!0;for(q=null;!(u>=B-1);)if(v=x,x=d(),""!==x)switch(x.toUpperCase()){case "X":p=!0;n=l=!1;break;case "M":q=f();null===a.ec||!0===p?(oe(a,q.x,q.y,l,!n),p=!1):a.moveTo(q.x,q.y);for(m=z;!c();)q=f(),a.lineTo(q.x,q.y);break;
case "L":for(;!c();)q=f(),a.lineTo(q.x,q.y);break;case "H":for(;!c();)z=new G((x===x.toLowerCase()?z.x:0)+parseFloat(d()),z.y),a.lineTo(z.x,z.y);break;case "V":for(;!c();)z=new G(z.x,(x===x.toLowerCase()?z.y:0)+parseFloat(d())),a.lineTo(z.x,z.y);break;case "C":for(;!c();){q=e();r=g();var C=f();se(a,q.x,q.y,r.x,r.y,C.x,C.y)}break;case "S":for(;!c();)q=h(),r=g(),C=f(),se(a,q.x,q.y,r.x,r.y,C.x,C.y);break;case "Q":for(;!c();)q=g(),r=f(),te(a,q.x,q.y,r.x,r.y);break;case "T":for(;!c();)y=q=h(),r=f(),te(a,
q.x,q.y,r.x,r.y);break;case "B":for(;!c();){q=parseFloat(d());r=parseFloat(d());C=parseFloat(d());var I=parseFloat(d()),J=parseFloat(d()),M=J,U=!1;c()||(M=parseFloat(d()),c()||(U=0!==parseFloat(d())));x===x.toLowerCase()&&(C+=z.x,I+=z.y);a.arcTo(q,r,C,I,J,M,U)}break;case "A":for(;!c();)q=Math.abs(parseFloat(d())),r=Math.abs(parseFloat(d())),C=parseFloat(d()),I=!!parseFloat(d()),J=!!parseFloat(d()),M=f(),ue(a,q,r,C,I,J,M.x,M.y);break;case "Z":ve(a);z=m;break;case "F":q="";for(r=1;k[u+r];)if(null!==
k[u+r].match(/[Uu]/))r++;else if(null===k[u+r].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/))r++;else{q=k[u+r];break}q.match(/[Mm]/)?l=!0:0<a.ec.segments.length&&(a.ec.isFilled=!0);break;case "U":q="";for(r=1;k[u+r];)if(null!==k[u+r].match(/[Ff]/))r++;else if(null===k[u+r].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/))r++;else{q=k[u+r];break}q.match(/[Mm]/)?n=!0:a.nq(!1)}m=a.Rs;we=a;if(b)for(b=m.figures.iterator;b.next();)b.value.isFilled=!0;return m}
function xe(a,b){for(var c=a.length,d=G.alloc(),e=0;e<c;e++){var f=a[e];d.x=f[0];d.y=f[1];b.ta(d);f[0]=d.x;f[1]=d.y;d.x=f[2];d.y=f[3];b.ta(d);f[2]=d.x;f[3]=d.y;d.x=f[4];d.y=f[5];b.ta(d);f[4]=d.x;f[5]=d.y;d.x=f[6];d.y=f[7];b.ta(d);f[6]=d.x;f[7]=d.y}G.free(d)}t.gv=function(){if(this.ra||this.fr!==this.figures.Ba)return!0;for(var a=this.figures.j,b=a.length,c=0;c<b;c++)if(a[c].gv())return!0;return!1};
$d.prototype.computeBounds=function(){this.ra=!1;this.Lm=this.uk=null;this.Mm=NaN;this.fr=this.figures.Ba;for(var a=this.figures.j,b=a.length,c=0;c<b;c++){var d=a[c];d.ra=!1;var e=d.segments;d.ns=e.Ba;d=e.j;e=d.length;for(var f=0;f<e;f++){var g=d[f];g.ra=!1;g.Je=null}}a=this.Nq;a.ha();isNaN(this.al)||isNaN(this.Zk)?a.h(0,0,0,0):a.h(0,0,this.al,this.Zk);ye(this,a,!1);Bc(a,0,0,0,0);a.freeze()};$d.prototype.Ww=function(){var a=new L;ye(this,a,!0);return a};
function ye(a,b,c){switch(a.type){case ge:case ke:case le:c?b.h(a.ad,a.bd,0,0):Bc(b,a.ad,a.bd,0,0);Bc(b,a.nc,a.Bc,0,0);break;case ae: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):Bc(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 ie:case ze:k=n.endX;l=n.endY;Bc(b,k,l,0,0);break;case Ae:H.Ql(k,l,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.5,b);k=n.endX;l=n.endY;
break;case Be:H.ov(k,l,n.point1X,n.point1Y,n.endX,n.endY,.5,b);k=n.endX;l=n.endY;break;case Ce:case De:var p=n.type===Ce?Ee(n,f):Fe(n,f,k,l),q=p.length;if(0===q){k=n.centerX;l=n.centerY;Bc(b,k,l,0,0);break}n=null;for(var r=0;r<q;r++)n=p[r],H.Ql(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:A("Unknown Segment type: "+n.type)}}}break;default:A("Unknown Geometry type: "+a.type)}}
$d.prototype.normalize=function(){this.v&&wa(this);var a=this.Ww();this.offset(-a.x,-a.y);return new G(-a.x,-a.y)};$d.prototype.offset=function(a,b){this.v&&wa(this);this.transform(1,0,0,1,a,b);return this};$d.prototype.scale=function(a,b){this.v&&wa(this);this.transform(a,0,0,b,0,0);return this};$d.prototype.rotate=function(a,b,c){this.v&&wa(this);void 0===b&&(b=0);void 0===c&&(c=0);var d=Qc.alloc();d.reset();d.rotate(a,b,c);this.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);Qc.free(d);return this};
t=$d.prototype;
t.transform=function(a,b,c,d,e,f){switch(this.type){case ge:case ke:case le:var g=this.ad;var h=this.bd;this.ad=g*a+h*c+e;this.bd=g*b+h*d+f;g=this.nc;h=this.Bc;this.nc=g*a+h*c+e;this.Bc=g*b+h*d+f;break;case ae:for(var k=this.figures.j,l=k.length,m=0;m<l;m++){var n=k[m];g=n.startX;h=n.startY;n.startX=g*a+h*c+e;n.startY=g*b+h*d+f;n=n.segments.j;for(var p=n.length,q=0;q<p;q++){var r=n[q];switch(r.type){case ie:case ze:g=r.endX;h=r.endY;r.endX=g*a+h*c+e;r.endY=g*b+h*d+f;break;case Ae:g=r.point1X;h=r.point1Y;
r.point1X=g*a+h*c+e;r.point1Y=g*b+h*d+f;g=r.point2X;h=r.point2Y;r.point2X=g*a+h*c+e;r.point2Y=g*b+h*d+f;g=r.endX;h=r.endY;r.endX=g*a+h*c+e;r.endY=g*b+h*d+f;break;case Be:g=r.point1X;h=r.point1Y;r.point1X=g*a+h*c+e;r.point1Y=g*b+h*d+f;g=r.endX;h=r.endY;r.endX=g*a+h*c+e;r.endY=g*b+h*d+f;break;case Ce:g=r.centerX;h=r.centerY;r.centerX=g*a+h*c+e;r.centerY=g*b+h*d+f;0!==b&&(g=180*Math.atan2(b,a)/Math.PI,0>g&&(g+=360),r.startAngle+=g);0>a&&(r.startAngle=180-r.startAngle,r.sweepAngle=-r.sweepAngle);0>d&&
(r.startAngle=-r.startAngle,r.sweepAngle=-r.sweepAngle);r.radiusX*=Math.sqrt(a*a+c*c);void 0!==r.radiusY&&(r.radiusY*=Math.sqrt(b*b+d*d));break;case De:g=r.endX;h=r.endY;r.endX=g*a+h*c+e;r.endY=g*b+h*d+f;0!==b&&(g=180*Math.atan2(b,a)/Math.PI,0>g&&(g+=360),r.xAxisRotation+=g);0>a&&(r.xAxisRotation=180-r.xAxisRotation,r.isClockwiseArc=!r.isClockwiseArc);0>d&&(r.xAxisRotation=-r.xAxisRotation,r.isClockwiseArc=!r.isClockwiseArc);r.radiusX*=Math.sqrt(a*a+c*c);r.radiusY*=Math.sqrt(b*b+d*d);break;default:A("Unknown Segment type: "+
r.type)}}}}this.ra=!0;return this};
t.ea=function(a,b,c,d){var e=a.x;a=a.y;for(var f=this.bounds.x-20,g=0,h,k,l,m,n,p=this.figures.j,q=p.length,r=0;r<q;r++){var u=p[r];if(u.isFilled){if(c&&u.ea(e,a,b))return!0;var x=u.segments;h=u.startX;k=u.startY;for(var v=h,y=k,z=x.j,B=0;B<=x.length;B++){var C=void 0;if(B!==x.length){C=z[B];var I=C.type;m=C.endX;n=C.endY}else I=ie,m=v,n=y;switch(I){case ze:v=Ge(e,a,f,a,h,k,v,y);if(isNaN(v))return!0;g+=v;v=m;y=n;break;case ie:h=Ge(e,a,f,a,h,k,m,n);if(isNaN(h))return!0;g+=h;break;case Ae:l=H.Kp(h,
k,C.point1X,C.point1Y,C.point2X,C.point2Y,m,n,f,a,e,a,.5);g+=l;break;case Be:l=H.Kp(h,k,(h+2*C.point1X)/3,(k+2*C.point1Y)/3,(2*C.point1X+m)/3,(2*C.point1Y+n)/3,m,n,f,a,e,a,.5);g+=l;break;case Ce:case De:I=C.type===Ce?Ee(C,u):Fe(C,u,h,k);var J=I.length;if(0===J){h=Ge(e,a,f,a,h,k,C.centerX,C.centerY);if(isNaN(h))return!0;g+=h;break}C=null;for(var M=0;M<J;M++){C=I[M];if(0===M){l=Ge(e,a,f,a,h,k,C[0],C[1]);if(isNaN(l))return!0;g+=l}l=H.Kp(C[0],C[1],C[2],C[3],C[4],C[5],C[6],C[7],f,a,e,a,.5);g+=l}null!==
C&&(m=C[6],n=C[7]);break;default:A("Unknown Segment type: "+C.type)}h=m;k=n}if(0!==g)return!0;g=0}else if(u.ea(e,a,d?b:b+2))return!0}return 0!==g};function Ge(a,b,c,d,e,f,g,h){if(H.Tb(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 Se(a,b,c,d){a=a.figures.j;for(var e=a.length,f=0;f<e;f++)if(a[f].ea(b,c,d))return!0;return!1}
t.Yu=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=new G);if(this.type===ge)return b.h(this.startX+a*(this.endX-this.startX),this.startY+a*(this.endY-this.startY)),b;for(var c=this.flattenedSegments,d=this.flattenedLengths,e=c.length,f=this.flattenedTotalLength*a,g=0,h=0;h<e;h++){var k=d[h],l=k.length;for(a=0;a<l;a++){var m=k[a];if(g+m>=f)return d=(f-g)/m,c=c[h],e=c[2*a],h=c[2*a+1],b.h(e+(c[2*a+2]-e)*d,h+(c[2*a+3]-h)*d),b;g+=m}}b.h(NaN,NaN);return b};
t.jx=function(a){if(this.type===ge){var b=this.startX,c=this.startY,d=this.endX,e=this.endY;if(b!==d||c!==e){var f=a.x;a=a.y;if(b===d){if(c<e){var g=c;d=e}else g=e,d=c;return a<=g?g===c?0:1:a>=d?d===c?0:1:Math.abs(a-c)/(d-g)}return c===e?(b<d?g=b:(g=d,d=b),f<=g?g===b?0:1:f>=d?d===b?0:1:Math.abs(f-b)/(d-g)):((f-b)*(f-b)+(a-c)*(a-c))/((d-b)*(d-b)+(e-c)*(e-c))}}else if(this.type===ke){g=this.startX;var h=this.startY,k=this.endX;e=this.endY;if(g!==k||h!==e){b=k-g;c=e-h;f=2*b+2*c;d=a.x;a=a.y;d=Math.min(Math.max(d,
g),k);a=Math.min(Math.max(a,h),e);g=Math.abs(d-g);k=Math.abs(d-k);h=Math.abs(a-h);e=Math.abs(a-e);var l=Math.min(g,k,h,e);if(l===h)return d/f;if(l===k)return(b+a)/f;if(l===e)return(2*b+c-d)/f;if(l===g)return(2*b+2*c-a)/f}}else{b=this.flattenedSegments;c=this.flattenedLengths;f=this.flattenedTotalLength;d=G.alloc();e=Infinity;h=g=0;k=b.length;for(var m=l=0,n=0;n<k;n++)for(var p=b[n],q=c[n],r=p.length,u=0;u<r;u+=2){var x=p[u],v=p[u+1];if(0!==u){H.Oi(l,m,x,v,a.x,a.y,d);var y=(d.x-a.x)*(d.x-a.x)+(d.y-
a.y)*(d.y-a.y);y<e&&(e=y,g=h,g+=Math.sqrt((d.x-l)*(d.x-l)+(d.y-m)*(d.y-m)));h+=q[(u-2)/2]}l=x;m=v}G.free(d);a=g/f;return 0>a?0:1<a?1:a}return 0};
function Te(a){if(null===a.uk){var b=a.uk=[],c=a.Lm=[],d=[],e=[];if(a.type===ge)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===ke)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===le){var f=new Ue;f.startX=a.endX;f.startY=(a.startY+a.endY)/2;var g=new Ve(Ce);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=Ee(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];H.ye(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(We(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 ze:4<=d.length&&(b.push(d),c.push(We(d)));d=[];d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;h=g;k=f;break;case ie:d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;break;case Ae:H.ye(g,f,p.point1X,p.point1Y,p.point2X,p.point2Y,p.endX,p.endY,
.5,d);g=p.endX;f=p.endY;break;case Be:H.gq(g,f,p.point1X,p.point1Y,p.endX,p.endY,.5,d);g=p.endX;f=p.endY;break;case Ce:var q=Ee(p,e),r=q.length;if(0===r){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(var u=0;u<r;u++){var x=q[u];H.ye(g,f,x[2],x[3],x[4],x[5],x[6],x[7],.5,d);g=x[6];f=x[7]}break;case De:q=Fe(p,e,g,f);r=q.length;if(0===r){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(u=0;u<r;u++)x=q[u],H.ye(g,f,x[2],x[3],x[4],x[5],x[6],x[7],.5,d),g=x[6],
f=x[7];break;default:A("Segment not of valid type: "+p.type)}p.isClosed&&(d.push(h),d.push(k))}4<=d.length&&(b.push(d),c.push(We(d)))}}}function We(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(Sb(c,d,g,h)));c=g;d=h}return b}t.add=function(a){this.ej.add(a);return this};t.vm=function(a,b,c,d,e,f,g,h){this.v&&wa(this);this.cf=(new O(a,b,e,f)).freeze();this.df=(new O(c,d,g,h)).freeze();return this};
pa.Object.defineProperties($d.prototype,{flattenedSegments:{get:function(){Te(this);return this.uk}},flattenedLengths:{get:function(){Te(this);return this.Lm}},flattenedTotalLength:{get:function(){var a=this.Mm;if(isNaN(a)){if(this.type===ge){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===ke)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.Mm=a}return a}},type:{get:function(){return this.va},set:function(a){this.va!==a&&(this.v&&wa(this,a),this.va=a,this.ra=!0)}},startX:{get:function(){return this.ad},set:function(a){this.ad!==a&&(this.v&&wa(this,a),this.ad=a,this.ra=!0)}},startY:{get:function(){return this.bd},set:function(a){this.bd!==
a&&(this.v&&wa(this,a),this.bd=a,this.ra=!0)}},endX:{get:function(){return this.nc},set:function(a){this.nc!==a&&(this.v&&wa(this,a),this.nc=a,this.ra=!0)}},endY:{get:function(){return this.Bc},set:function(a){this.Bc!==a&&(this.v&&wa(this,a),this.Bc=a,this.ra=!0)}},figures:{get:function(){return this.ej},set:function(a){this.ej!==a&&(this.v&&wa(this,a),this.ej=a,this.ra=!0)}},spot1:{
get:function(){return this.cf},set:function(a){this.v&&wa(this,a);this.cf=a.I()}},spot2:{get:function(){return this.df},set:function(a){this.v&&wa(this,a);this.df=a.I()}},defaultStretch:{get:function(){return this.Cf},set:function(a){this.v&&wa(this,a);this.Cf=a}},bounds:{get:function(){this.gv()&&this.computeBounds();return this.Nq}}});$d.prototype.setSpots=$d.prototype.vm;$d.prototype.add=$d.prototype.add;
$d.prototype.getFractionForPoint=$d.prototype.jx;$d.prototype.getPointAlongPath=$d.prototype.Yu;$d.prototype.transform=$d.prototype.transform;$d.prototype.rotate=$d.prototype.rotate;$d.prototype.scale=$d.prototype.scale;$d.prototype.offset=$d.prototype.offset;$d.prototype.normalize=$d.prototype.normalize;$d.prototype.computeBoundsWithoutOrigin=$d.prototype.Ww;$d.prototype.equalsApprox=$d.prototype.Qa;
var ge=new D($d,"Line",0),ke=new D($d,"Rectangle",1),le=new D($d,"Ellipse",2),ae=new D($d,"Path",3);$d.className="Geometry";$d.stringify=je;$d.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};$d.parse=me;$d.Line=ge;$d.Rectangle=ke;$d.Ellipse=le;$d.Path=ae;
function Ue(a,b,c,d){mb(this);this.v=!1;void 0===c&&(c=!0);this.xr=c;void 0===d&&(d=!0);this.Ar=d;void 0!==a?this.ad=a:this.ad=0;void 0!==b?this.bd=b:this.bd=0;this.yl=new E;this.ns=this.yl.Ba;this.ra=!0}Ue.prototype.copy=function(){var a=new Ue;a.xr=this.xr;a.Ar=this.Ar;a.ad=this.ad;a.bd=this.bd;for(var b=this.yl.j,c=b.length,d=a.yl,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.ns=this.ns;a.ra=this.ra;return a};t=Ue.prototype;
t.Qa=function(a){if(!(a instanceof Ue&&H.w(this.startX,a.startX)&&H.w(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].Qa(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.v=!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.ha=function(){this.v=!1;var a=this.segments;a.ha();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].ha();return this};t.gv=function(){if(this.ra)return!0;var a=this.segments;if(this.ns!==a.Ba)return!0;a=a.j;for(var b=a.length,c=0;c<b;c++)if(a[c].ra)return!0;return!1};t.add=function(a){this.yl.add(a);return this};
t.ea=function(a,b,c){for(var d=this.startX,e=this.startY,f=d,g=e,h=this.segments.j,k=h.length,l=0;l<k;l++){var m=h[l];switch(m.type){case ze:f=m.endX;g=m.endY;d=m.endX;e=m.endY;break;case ie:if(H.Tb(d,e,m.endX,m.endY,c,a,b))return!0;d=m.endX;e=m.endY;break;case Ae:if(H.Es(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 Be:if(H.pv(d,e,m.point1X,m.point1Y,m.endX,m.endY,.5,a,b,c))return!0;d=m.endX;e=m.endY;break;case Ce:case De:var n=m.type===
Ce?Ee(m,this):Fe(m,this,d,e),p=n.length;if(0===p){if(H.Tb(d,e,m.centerX,m.centerY,c,a,b))return!0;d=m.centerX;e=m.centerY;break}for(var q=null,r=0;r<p;r++)if(q=n[r],0===r&&H.Tb(d,e,q[0],q[1],c,a,b)||H.Es(q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7],.5,a,b,c))return!0;null!==q&&(d=q[6],e=q[7]);break;default:A("Unknown Segment type: "+m.type)}if(m.isClosed&&(d!==f||e!==g)&&H.Tb(d,e,f,g,c,a,b))return!0}return!1};
pa.Object.defineProperties(Ue.prototype,{isFilled:{get:function(){return this.xr},set:function(a){this.v&&wa(this,a);this.xr=a}},isShadowed:{get:function(){return this.Ar},set:function(a){this.v&&wa(this,a);this.Ar=a}},startX:{get:function(){return this.ad},set:function(a){this.v&&wa(this,a);this.ad=a;this.ra=!0}},startY:{get:function(){return this.bd},set:function(a){this.v&&wa(this,
a);this.bd=a;this.ra=!0}},segments:{get:function(){return this.yl},set:function(a){this.v&&wa(this,a);this.yl=a;this.ra=!0}}});Ue.prototype.add=Ue.prototype.add;Ue.prototype.equalsApprox=Ue.prototype.Qa;Ue.className="PathFigure";
function Ve(a,b,c,d,e,f,g,h){mb(this);this.v=!1;void 0===a&&(a=ie);this.va=a;void 0!==b?this.nc=b:this.nc=0;void 0!==c?this.Bc=c:this.Bc=0;void 0===d&&(d=0);void 0===e&&(e=0);void 0===f&&(f=0);void 0===g&&(g=0);a===De?(a=f%360,0>a&&(a+=360),this.re=a,this.li=0,this.mi=Math.max(d,0),this.Yg=Math.max(e,0),this.el="boolean"===typeof g?!!g:!1,this.Bk=!!h):(this.re=d,this.li=e,a===Ce&&(f=Math.max(f,0)),this.mi=f,"number"===typeof g?(a===Ce&&(g=Math.max(g,0)),this.Yg=g):this.Yg=0,this.Bk=this.el=!1);this.jj=
!1;this.ra=!0;this.Je=null}Ve.prototype.copy=function(){var a=new Ve;a.va=this.va;a.nc=this.nc;a.Bc=this.Bc;a.re=this.re;a.li=this.li;a.mi=this.mi;a.Yg=this.Yg;a.el=this.el;a.Bk=this.Bk;a.jj=this.jj;a.ra=this.ra;return a};t=Ve.prototype;
t.Qa=function(a){if(!(a instanceof Ve)||this.type!==a.type||this.isClosed!==a.isClosed)return!1;switch(this.type){case ze:case ie:return H.w(this.endX,a.endX)&&H.w(this.endY,a.endY);case Ae:return H.w(this.endX,a.endX)&&H.w(this.endY,a.endY)&&H.w(this.point1X,a.point1X)&&H.w(this.point1Y,a.point1Y)&&H.w(this.point2X,a.point2X)&&H.w(this.point2Y,a.point2Y);case Be:return H.w(this.endX,a.endX)&&H.w(this.endY,a.endY)&&H.w(this.point1X,a.point1X)&&H.w(this.point1Y,a.point1Y);case Ce:return H.w(this.startAngle,
a.startAngle)&&H.w(this.sweepAngle,a.sweepAngle)&&H.w(this.centerX,a.centerX)&&H.w(this.centerY,a.centerY)&&H.w(this.radiusX,a.radiusX)&&H.w(this.radiusY,a.radiusY);case De:return this.isClockwiseArc===a.isClockwiseArc&&this.isLargeArc===a.isLargeArc&&H.w(this.xAxisRotation,a.xAxisRotation)&&H.w(this.endX,a.endX)&&H.w(this.endY,a.endY)&&H.w(this.radiusX,a.radiusX)&&H.w(this.radiusY,a.radiusY);default:return!1}};t.fb=function(a){a.classType===Ve&&(this.type=a)};
t.toString=function(a){void 0===a&&(a=-1);switch(this.type){case ze:a=0>a?"M"+this.endX.toString()+" "+this.endY.toString():"M"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case ie:a=0>a?"L"+this.endX.toString()+" "+this.endY.toString():"L"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Ae: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 Be: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 Ce: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 De: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.jj?"z":"")};t.freeze=function(){this.v=!0;return this};t.ha=function(){this.v=!1;return this};t.close=function(){this.jj=!0;return this};
function Ee(a,b){if(null!==a.Je&&!1===b.ra)return a.Je;var c=a.radiusX,d=a.radiusY;void 0===d&&(d=c);if(0===c||0===d)return a.Je=[],a.Je;b=a.re;var e=a.li,f=H.Yw(0,0,c<d?c:d,a.startAngle,a.startAngle+a.sweepAngle,!1);if(c!==d){var g=Qc.alloc();g.reset();c<d?g.scale(1,d/c):g.scale(c/d,1);xe(f,g);Qc.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.Je=f;return a.Je}
function Fe(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.Je&&!1===b.ra)return a.Je;b=a.mi;var f=a.Yg;0===b&&(b=1E-4);0===f&&(f=1E-4);var g=Math.PI/180*a.re,h=a.el,k=a.Bk,l=a.nc,m=a.Bc,n=Math.cos(g),p=Math.sin(g),q=n*(c-l)/2+p*(d-m)/2;g=-p*(c-l)/2+n*(d-m)/2;var r=q*q/(b*b)+g*g/(f*f);1<r&&(b*=Math.sqrt(r),f*=Math.sqrt(r));r=(h===k?-1:1)*Math.sqrt((b*b*f*f-b*b*g*g-f*f*q*q)/(b*b*g*g+f*f*q*q));isNaN(r)&&(r=0);h=r*b*g/f;r=r*-f*
q/b;isNaN(h)&&(h=0);isNaN(r)&&(r=0);c=(c+l)/2+n*h-p*r;d=(d+m)/2+p*h+n*r;m=e(1,0,(q-h)/b,(g-r)/f);n=(q-h)/b;l=(g-r)/f;q=(-q-h)/b;h=(-g-r)/f;g=e(n,l,q,h);q=(n*q+l*h)/(Math.sqrt(n*n+l*l)*Math.sqrt(q*q+h*h));-1>=q?g=Math.PI:1<=q&&(g=0);!k&&0<g&&(g-=2*Math.PI);k&&0>g&&(g+=2*Math.PI);k=b>f?1:b/f;q=b>f?f/b:1;b=H.Yw(0,0,b>f?b:f,m,m+g,!0);f=Qc.alloc();f.reset();f.translate(c,d);f.rotate(a.re,0,0);f.scale(k,q);xe(b,f);Qc.free(f);a.Je=b;return a.Je}
pa.Object.defineProperties(Ve.prototype,{isClosed:{get:function(){return this.jj},set:function(a){this.jj!==a&&(this.jj=a,this.ra=!0)}},type:{get:function(){return this.va},set:function(a){this.v&&wa(this,a);this.va=a;this.ra=!0}},endX:{get:function(){return this.nc},set:function(a){this.v&&wa(this,a);this.nc=a;this.ra=!0}},endY:{get:function(){return this.Bc},set:function(a){this.v&&
wa(this,a);this.Bc=a;this.ra=!0}},point1X:{get:function(){return this.re},set:function(a){this.v&&wa(this,a);this.re=a;this.ra=!0}},point1Y:{get:function(){return this.li},set:function(a){this.v&&wa(this,a);this.li=a;this.ra=!0}},point2X:{get:function(){return this.mi},set:function(a){this.v&&wa(this,a);this.mi=a;this.ra=!0}},point2Y:{get:function(){return this.Yg},set:function(a){this.v&&
wa(this,a);this.Yg=a;this.ra=!0}},centerX:{get:function(){return this.re},set:function(a){this.v&&wa(this,a);this.re=a;this.ra=!0}},centerY:{get:function(){return this.li},set:function(a){this.v&&wa(this,a);this.li=a;this.ra=!0}},radiusX:{get:function(){return this.mi},set:function(a){0>a&&xa(a,">= zero",Ve,"radiusX");this.v&&wa(this,a);this.mi=a;this.ra=!0}},radiusY:{get:function(){return this.Yg},
set:function(a){0>a&&xa(a,">= zero",Ve,"radiusY");this.v&&wa(this,a);this.Yg=a;this.ra=!0}},startAngle:{get:function(){return this.nc},set:function(a){this.nc!==a&&(this.v&&wa(this,a),a%=360,0>a&&(a+=360),this.nc=a,this.ra=!0)}},sweepAngle:{get:function(){return this.Bc},set:function(a){this.v&&wa(this,a);360<a&&(a=360);-360>a&&(a=-360);this.Bc=a;this.ra=!0}},isClockwiseArc:{get:function(){return this.Bk},set:function(a){this.v&&
wa(this,a);this.Bk=a;this.ra=!0}},isLargeArc:{get:function(){return this.el},set:function(a){this.v&&wa(this,a);this.el=a;this.ra=!0}},xAxisRotation:{get:function(){return this.re},set:function(a){a%=360;0>a&&(a+=360);this.v&&wa(this,a);this.re=a;this.ra=!0}}});Ve.prototype.equalsApprox=Ve.prototype.Qa;
var ze=new D(Ve,"Move",0),ie=new D(Ve,"Line",1),Ae=new D(Ve,"Bezier",2),Be=new D(Ve,"QuadraticBezier",3),Ce=new D(Ve,"Arc",4),De=new D(Ve,"SvgArc",4);Ve.className="PathSegment";Ve.Move=ze;Ve.Line=ie;Ve.Bezier=Ae;Ve.QuadraticBezier=Be;Ve.Arc=Ce;Ve.SvgArc=De;function Xe(){this.F=null;this.zu=(new G(0,0)).freeze();this.Pt=(new G(0,0)).freeze();this.Gq=this.Pr=0;this.Hq=1;this.Er="";this.zs=this.Yq=!1;this.Xq=this.Jq=0;this.zg=this.lr=this.yr=!1;this.dr=null;this.xs=0;this.Pd=this.ws=null}
Xe.prototype.copy=function(){var a=new Xe;return this.clone(a)};Xe.prototype.clone=function(a){a.F=this.F;a.zu.assign(this.viewPoint);a.Pt.assign(this.documentPoint);a.Pr=this.Pr;a.Gq=this.Gq;a.Hq=this.Hq;a.Er=this.Er;a.Yq=this.Yq;a.zs=this.zs;a.Jq=this.Jq;a.Xq=this.Xq;a.yr=this.yr;a.lr=this.lr;a.zg=this.zg;a.dr=this.dr;a.xs=this.xs;a.ws=this.ws;a.Pd=this.Pd;return a};
Xe.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};Xe.prototype.Tp=function(a,b){var c=this.diagram;if(null===c)return b;Ye(c,this.event,a,b);return b};
Xe.prototype.Zy=function(a,b){var c=this.diagram;if(null===c)return b;Ye(c,this.event,a,b);b.assign(c.vt(b));return b};
pa.Object.defineProperties(Xe.prototype,{diagram:{get:function(){return this.F},set:function(a){this.F=a}},viewPoint:{get:function(){return this.zu},set:function(a){this.zu.assign(a)}},documentPoint:{get:function(){return this.Pt},set:function(a){this.Pt.assign(a)}},modifiers:{get:function(){return this.Pr},set:function(a){this.Pr=a}},button:{get:function(){return this.Gq},
set:function(a){this.Gq=a;if(null===this.event)switch(a){case 0:this.buttons=1;break;case 1:this.buttons=4;break;case 2:this.buttons=2}}},buttons:{get:function(){return this.Hq},set:function(a){this.Hq=a}},key:{get:function(){return this.Er},set:function(a){this.Er=a}},down:{get:function(){return this.Yq},set:function(a){this.Yq=a}},up:{get:function(){return this.zs},set:function(a){this.zs=
a}},clickCount:{get:function(){return this.Jq},set:function(a){this.Jq=a}},delta:{get:function(){return this.Xq},set:function(a){this.Xq=a}},isMultiTouch:{get:function(){return this.yr},set:function(a){this.yr=a}},handled:{get:function(){return this.lr},set:function(a){this.lr=a}},bubbles:{get:function(){return this.zg},set:function(a){this.zg=a}},event:{
get:function(){return this.dr},set:function(a){this.dr=a}},isTouchEvent:{get:function(){var a=w.TouchEvent,b=this.event;return a&&b instanceof a?!0:(a=w.PointerEvent)&&b instanceof a&&("touch"===b.pointerType||"pen"===b.pointerType)}},timestamp:{get:function(){return this.xs},set:function(a){this.xs=a}},targetDiagram:{get:function(){return this.ws},set:function(a){this.ws=a}},targetObject:{
get:function(){return this.Pd},set:function(a){this.Pd=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}}});
Xe.prototype.getMultiTouchDocumentPoint=Xe.prototype.Zy;Xe.prototype.getMultiTouchViewPoint=Xe.prototype.Tp;Xe.className="InputEvent";function Ze(){this.F=null;this.Ua="";this.Yr=this.us=null}Ze.prototype.copy=function(){var a=new Ze;a.F=this.F;a.Ua=this.Ua;a.us=this.us;a.Yr=this.Yr;return a};Ze.prototype.toString=function(){var a="*"+this.name;null!==this.subject&&(a+=":"+this.subject.toString());null!==this.parameter&&(a+="("+this.parameter.toString()+")");return a};
pa.Object.defineProperties(Ze.prototype,{diagram:{get:function(){return this.F},set:function(a){this.F=a}},name:{get:function(){return this.Ua},set:function(a){this.Ua=a}},subject:{get:function(){return this.us},set:function(a){this.us=a}},parameter:{get:function(){return this.Yr},set:function(a){this.Yr=a}}});Ze.className="DiagramEvent";
function $e(){this.Tm=af;this.Bj=this.Or="";this.wo=this.xo=this.Co=this.Do=this.Bo=this.F=this.Zb=null}$e.prototype.clear=function(){this.wo=this.xo=this.Co=this.Do=this.Bo=this.F=this.Zb=null};
$e.prototype.copy=function(){var a=new $e;a.Tm=this.Tm;a.Or=this.Or;a.Bj=this.Bj;a.Zb=this.Zb;a.F=this.F;a.Bo=this.Bo;var b=this.Do;a.Do=Ca(b)&&"function"===typeof b.I?b.I():b;b=this.Co;a.Co=Ca(b)&&"function"===typeof b.I?b.I():b;b=this.xo;a.xo=Ca(b)&&"function"===typeof b.I?b.I():b;b=this.wo;a.wo=Ca(b)&&"function"===typeof b.I?b.I():b;return a};$e.prototype.fb=function(a){a.classType===$e&&(this.change=a)};
$e.prototype.toString=function(){var a="";a=this.change===bf?a+"* ":this.change===af?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===bf?null!==this.oldValue&&(a+=" "+this.oldValue):(null!==this.object&&(a+=Qa(this.object)),null!==this.oldValue&&(a+=" old: "+Qa(this.oldValue)),null!==
this.oldParam&&(a+=" "+this.oldParam),null!==this.newValue&&(a+=" new: "+Qa(this.newValue)),null!==this.newParam&&(a+=" "+this.newParam));return a};$e.prototype.J=function(a){return a?this.oldValue:this.newValue};$e.prototype.az=function(a){return a?this.oldParam:this.newParam};$e.prototype.canUndo=function(){return null!==this.model||null!==this.diagram?!0:!1};$e.prototype.undo=function(){this.canUndo()&&(null!==this.model?this.model.Oj(this,!0):null!==this.diagram&&this.diagram.Oj(this,!0))};
$e.prototype.canRedo=function(){return null!==this.model||null!==this.diagram?!0:!1};$e.prototype.redo=function(){this.canRedo()&&(null!==this.model?this.model.Oj(this,!1):null!==this.diagram&&this.diagram.Oj(this,!1))};
pa.Object.defineProperties($e.prototype,{model:{get:function(){return this.Zb},set:function(a){this.Zb=a}},diagram:{get:function(){return this.F},set:function(a){this.F=a}},change:{get:function(){return this.Tm},set:function(a){this.Tm=a}},modelChange:{get:function(){return this.Or},set:function(a){this.Or=a}},propertyName:{get:function(){return this.Bj},
set:function(a){this.Bj=a}},isTransactionFinished:{get:function(){return this.Tm===bf&&("CommittedTransaction"===this.Bj||"FinishedUndo"===this.Bj||"FinishedRedo"===this.Bj)}},object:{get:function(){return this.Bo},set:function(a){this.Bo=a}},oldValue:{get:function(){return this.Do},set:function(a){this.Do=a}},oldParam:{get:function(){return this.Co},set:function(a){this.Co=a}},
newValue:{get:function(){return this.xo},set:function(a){this.xo=a}},newParam:{get:function(){return this.wo},set:function(a){this.wo=a}}});$e.prototype.redo=$e.prototype.redo;$e.prototype.canRedo=$e.prototype.canRedo;$e.prototype.undo=$e.prototype.undo;$e.prototype.canUndo=$e.prototype.canUndo;$e.prototype.getParam=$e.prototype.az;$e.prototype.getValue=$e.prototype.J;$e.prototype.clear=$e.prototype.clear;
var bf=new D($e,"Transaction",-1),af=new D($e,"Property",0),cf=new D($e,"Insert",1),df=new D($e,"Remove",2);$e.className="ChangedEvent";$e.Transaction=bf;$e.Property=af;$e.Insert=cf;$e.Remove=df;function ef(){this.u=(new E).freeze();this.Ua="";this.l=!1}ef.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.N(c);null!==d&&(b+="\n "+d.toString())}}return b};
ef.prototype.clear=function(){var a=this.changes;a.ha();for(var b=a.count-1;0<=b;b--){var c=a.N(b);null!==c&&c.clear()}a.clear();a.freeze()};ef.prototype.canUndo=function(){return this.isComplete};ef.prototype.undo=function(){if(this.canUndo())for(var a=this.changes.count-1;0<=a;a--){var b=this.changes.N(a);null!==b&&b.undo()}};ef.prototype.canRedo=function(){return this.isComplete};
ef.prototype.redo=function(){if(this.canRedo())for(var a=this.changes.count,b=0;b<a;b++){var c=this.changes.N(b);null!==c&&c.redo()}};pa.Object.defineProperties(ef.prototype,{changes:{get:function(){return this.u}},name:{get:function(){return this.Ua},set:function(a){this.Ua=a}},isComplete:{get:function(){return this.l},set:function(a){this.l=a}}});ef.prototype.redo=ef.prototype.redo;ef.prototype.canRedo=ef.prototype.canRedo;
ef.prototype.undo=ef.prototype.undo;ef.prototype.canUndo=ef.prototype.canUndo;ef.prototype.clear=ef.prototype.clear;ef.className="Transaction";function ff(){this.gu=new F;this.Dc=!1;this.K=(new E).freeze();this.ee=-1;this.u=999;this.he=!1;this.Vq=null;this.xi=0;this.l=!1;this.oe=(new E).freeze();this.ol=new E;this.Wt=!0;this.$t=!1}
ff.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.N(d);b+="]";if(void 0!==a&&0<a)for(c=this.history.count,d=0;d<c;d++)b+="\n "+this.history.N(d).toString(a-1);return b};
ff.prototype.clear=function(){var a=this.history;a.ha();for(var b=a.count-1;0<=b;b--){var c=a.N(b);null!==c&&c.clear()}a.clear();this.ee=-1;a.freeze();this.he=!1;this.Vq=null;this.xi=0;this.oe.ha();this.oe.clear();this.oe.freeze();this.ol.clear()};ff.prototype.copyProperties=function(a){this.isEnabled=a.isEnabled;this.maxHistoryLength=a.maxHistoryLength;this.checksTransactionLevel=a.checksTransactionLevel};t=ff.prototype;t.Pw=function(a){this.gu.add(a)};t.xx=function(a){this.gu.remove(a)};
t.Aa=function(a){void 0===a&&(a="");null===a&&(a="");if(this.isUndoingRedoing)return!1;!0===this.Wt&&(this.Wt=!1,this.xi++,this.yb("StartingFirstTransaction",a,this.currentTransaction),0<this.xi&&this.xi--);this.isEnabled&&(this.oe.ha(),this.oe.add(a),this.oe.freeze(),null===this.currentTransaction?this.ol.add(0):this.ol.add(this.currentTransaction.changes.count));this.xi++;var b=1===this.transactionLevel;b&&this.yb("StartedTransaction",a,this.currentTransaction);return b};
t.Za=function(a){void 0===a&&(a="");return jf(this,!0,a)};t.tf=function(){return jf(this,!1,"")};
function jf(a,b,c){if(a.isUndoingRedoing)return!1;a.checksTransactionLevel&&1>a.transactionLevel&&ya("Ending transaction without having started a transaction: "+c);var d=1===a.transactionLevel;d&&b&&a.yb("CommittingTransaction",c,a.currentTransaction);var e=0;if(0<a.transactionLevel&&(a.xi--,a.isEnabled)){var f=a.oe.count;0<f&&(""===c&&(c=a.oe.N(0)),a.oe.ha(),a.oe.mb(f-1),a.oe.freeze());f=a.ol.count;0<f&&(e=a.ol.N(f-1),a.ol.mb(f-1))}f=a.currentTransaction;if(d){if(b){a.$t=!1;if(a.isEnabled&&null!==
f){b=f;b.isComplete=!0;b.name=c;d=a.history;d.ha();for(e=d.count-1;e>a.historyIndex;e--)f=d.N(e),null!==f&&f.clear(),d.mb(e),a.$t=!0;e=a.maxHistoryLength;0<=e&&(0===e?d.clear():d.count>=e&&(f=d.N(0),null!==f&&f.clear(),d.mb(0),a.ee--));0!==e&&(d.add(b),a.ee++);d.freeze();f=b}a.yb("CommittedTransaction",c,f)}else{a.he=!0;try{a.isEnabled&&null!==f&&(f.isComplete=!0,f.undo())}finally{a.yb("RolledBackTransaction",c,f),a.he=!1}null!==f&&f.clear()}a.Vq=null;return!0}if(a.isEnabled&&!b&&null!==f){a=e;c=
f.changes;for(b=c.count-1;b>=a;b--)d=c.N(b),null!==d&&d.undo(),c.ha(),c.mb(b);c.freeze()}return!1}ff.prototype.canUndo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToUndo;return null!==a&&a.canUndo()?!0:!1};ff.prototype.undo=function(){if(this.canUndo()){var a=this.transactionToUndo;try{this.he=!0,this.yb("StartingUndo","Undo",a),this.ee--,a.undo()}catch(b){ya("undo error: "+b.toString())}finally{this.yb("FinishedUndo","Undo",a),this.he=!1}}};
ff.prototype.canRedo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToRedo;return null!==a&&a.canRedo()?!0:!1};ff.prototype.redo=function(){if(this.canRedo()){var a=this.transactionToRedo;try{this.he=!0,this.yb("StartingRedo","Redo",a),this.ee++,a.redo()}catch(b){ya("redo error: "+b.toString())}finally{this.yb("FinishedRedo","Redo",a),this.he=!1}}};
ff.prototype.yb=function(a,b,c){void 0===c&&(c=null);var d=new $e;d.change=bf;d.propertyName=a;d.object=c;d.oldValue=b;for(a=this.models;a.next();)b=a.value,d.model=b,b.Fs(d)};
ff.prototype.av=function(a){if(this.isEnabled&&!this.isUndoingRedoing&&!this.skipsEvent(a)){var b=this.currentTransaction;null===b&&(this.Vq=b=new ef);var c=a.copy();b=b.changes;b.ha();b.add(c);b.freeze();this.checksTransactionLevel&&0>=this.transactionLevel&&!this.Wt&&(a=a.diagram,null!==a&&!1===a.Mi||ya("Change not within a transaction: "+c.toString()))}};
ff.prototype.skipsEvent=function(a){if(null===a||0>a.change.value)return!0;a=a.object;if(void 0!==a.layer){if(a=a.layer,null!==a&&a.isTemporary)return!0}else if(a.isTemporary)return!0;return!1};
pa.Object.defineProperties(ff.prototype,{models:{get:function(){return this.gu.iterator}},isEnabled:{get:function(){return this.Dc},set:function(a){this.Dc=a}},transactionToUndo:{get:function(){return 0<=this.historyIndex&&this.historyIndex<=this.history.count-1?this.history.N(this.historyIndex):null}},transactionToRedo:{get:function(){return this.historyIndex<this.history.count-
1?this.history.N(this.historyIndex+1):null}},isUndoingRedoing:{get:function(){return this.he}},history:{get:function(){return this.K}},maxHistoryLength:{get:function(){return this.u},set:function(a){this.u=a}},historyIndex:{get:function(){return this.ee}},currentTransaction:{get:function(){return this.Vq}},transactionLevel:{
get:function(){return this.xi}},isInTransaction:{get:function(){return 0<this.xi}},checksTransactionLevel:{get:function(){return this.l},set:function(a){this.l=a}},nestedTransactionNames:{get:function(){return this.oe}}});ff.prototype.handleChanged=ff.prototype.av;ff.prototype.redo=ff.prototype.redo;ff.prototype.undo=ff.prototype.undo;ff.prototype.canUndo=ff.prototype.canUndo;
ff.prototype.rollbackTransaction=ff.prototype.tf;ff.prototype.commitTransaction=ff.prototype.Za;ff.prototype.startTransaction=ff.prototype.Aa;ff.prototype.removeModel=ff.prototype.xx;ff.prototype.addModel=ff.prototype.Pw;ff.prototype.clear=ff.prototype.clear;ff.className="UndoManager";function kf(){mb(this);this.F=lf;this.Ua="";this.Dc=!0;this.Ub=!1;this.aw=null;this.Yx=new Xe;this.Cs=-1}kf.prototype.hb=function(a){this.F=a};
kf.prototype.toString=function(){return""!==this.name?this.name+" Tool":Pa(this.constructor)};kf.prototype.updateAdornments=function(){};kf.prototype.canStart=function(){return this.isEnabled};kf.prototype.doStart=function(){};kf.prototype.doActivate=function(){this.isActive=!0};kf.prototype.doDeactivate=function(){this.isActive=!1};kf.prototype.doStop=function(){};kf.prototype.doCancel=function(){this.transactionResult=null;this.stopTool()};
kf.prototype.stopTool=function(){var a=this.diagram;a.currentTool===this&&(a.currentTool=null,a.currentCursor="")};kf.prototype.doMouseDown=function(){!this.isActive&&this.canStart()&&this.doActivate()};kf.prototype.doMouseMove=function(){};kf.prototype.doMouseUp=function(){this.stopTool()};kf.prototype.doMouseWheel=function(){};kf.prototype.canStartMultiTouch=function(){return!0};
kf.prototype.standardPinchZoomStart=function(){var a=this.diagram,b=a.lastInput,c=b.Tp(0,G.allocAt(NaN,NaN)),d=b.Tp(1,G.allocAt(NaN,NaN));if(c.s()&&d.s()&&(this.doCancel(),a.$l("hasGestureZoom"))){a.Eo=a.scale;var e=d.x-c.x,f=d.y-c.y;a.Fw=Math.sqrt(e*e+f*f);b.bubbles=!1}G.free(c);G.free(d)};
kf.prototype.standardPinchZoomMove=function(){var a=this.diagram,b=a.lastInput,c=b.Tp(0,G.allocAt(NaN,NaN)),d=b.Tp(1,G.allocAt(NaN,NaN));if(c.s()&&d.s()&&(this.doCancel(),a.$l("hasGestureZoom"))){var e=d.x-c.x,f=d.y-c.y;f=Math.sqrt(e*e+f*f)/a.Fw;e=new G((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.Eo;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}G.free(c);G.free(d)};
kf.prototype.doKeyDown=function(){"Esc"===this.diagram.lastInput.key&&this.doCancel()};kf.prototype.doKeyUp=function(){};kf.prototype.Aa=function(a){void 0===a&&(a=this.name);this.transactionResult=null;return this.diagram.Aa(a)};kf.prototype.ug=function(){var a=this.diagram;return null===this.transactionResult?a.tf():a.Za(this.transactionResult)};
kf.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.lastInput,c=a.Yl(b.documentPoint,!1);if(null!==c)if(ib?b.meta:b.control){a.aa("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!b.isSelected);a.aa("ChangedSelection",a.selection)}else if(b.shift){if(!c.isSelected){a.aa("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!0);a.aa("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||(ib?b.meta:b.control)||b.shift||a.Gs()}};kf.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.Rb(d.documentPoint,a,b);d.targetObject=a;mf(a,d,c);return d.handled};
function mf(a,b,c){b.handled=!1;if(null===a||a.qg()){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.aa(e,a)}else{switch(d){case 1:e="BackgroundSingleClicked";break;case 2:e="BackgroundDoubleClicked";break;case 3:e="BackgroundContextClicked"}0!==d&&c.aa(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)}}}
kf.prototype.standardMouseOver=function(){var a=this.diagram,b=a.lastInput;if(!0!==a.animationManager.rb){var c=a.skipsUndoManager;a.skipsUndoManager=!0;var d=a.ge?a.Rb(b.documentPoint,null,null):null;b.targetObject=d;var e=!1;if(d!==a.Gk){var f=a.Gk,g=f;a.Gk=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.pg(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.pg(d))break;g(b,d,f);e=!0;if(b.handled)break}d=d.panel}d=a.Gk}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.cc();a.skipsUndoManager=c}};kf.prototype.doCurrentObjectChanged=function(){};
kf.prototype.standardMouseWheel=function(){var a=this.diagram,b=a.lastInput,c=b.delta;if(0!==c&&a.documentBounds.s()){var d=a.commandHandler,e=a.toolManager.mouseWheelBehavior;if(null!==d&&(e===nf&&!b.shift||e===of&&b.control)&&(0<c?d.canIncreaseZoom():d.canDecreaseZoom()))e=a.zoomPoint,a.zoomPoint=b.viewPoint,0<c?d.increaseZoom():d.decreaseZoom(),a.zoomPoint=e,b.bubbles=!1;else if(e===nf&&b.shift||e===of&&!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(cb||db||gb)h=1,0<e&&(e=3),0>e&&(e=-3),0<g&&(g=3),0>g&&(g=-3);if(void 0===h||void 0===e||void 0===g||0===e&&0===g||b.shift)!b.shift&&a.allowVerticalScroll?(f=3*f*a.scrollVerticalLineChange,0<c?a.scroll("pixel","up",f):a.scroll("pixel","down",f)):b.shift&&a.allowHorizontalScroll&&(f=3*f*a.scrollHorizontalLineChange,0<c?a.scroll("pixel","left",f):a.scroll("pixel","right",f));else{switch(h){case 0:c="pixel";break;case 1:c="line";break;case 2:c="page";break;default:c="pixel"}0!==e&&a.allowHorizontalScroll&&
(0<e?a.scroll(c,"left",-e):a.scroll(c,"right",e));0!==g&&a.allowVerticalScroll&&(0<g?a.scroll(c,"up",-g):a.scroll(c,"down",g))}a.position.A(d)||(b.bubbles=!1)}}};kf.prototype.standardWaitAfter=function(a,b){void 0===b&&(b=this.diagram.lastInput);this.cancelWaitAfter();var c=this,d=b.clone(this.Yx);this.Cs=ua(function(){c.doWaitAfter(d)},a)};kf.prototype.cancelWaitAfter=function(){-1!==this.Cs&&w.clearTimeout(this.Cs);this.Cs=-1};kf.prototype.doWaitAfter=function(){};
kf.prototype.findToolHandleAt=function(a,b){a=this.diagram.Rb(a,function(a){for(;null!==a&&!(a.panel instanceof pf);)a=a.panel;return a});return null===a?null:a.part.category===b?a:null};kf.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};
pa.Object.defineProperties(kf.prototype,{diagram:{get:function(){return this.F},set:function(a){a instanceof P&&(this.F=a)}},name:{get:function(){return this.Ua},set:function(a){this.Ua=a}},isEnabled:{get:function(){return this.Dc},set:function(a){this.Dc=a}},isActive:{get:function(){return this.Ub},set:function(a){this.Ub=a}},transactionResult:{get:function(){return this.aw},
set:function(a){this.aw=a}}});kf.prototype.stopTransaction=kf.prototype.ug;kf.prototype.startTransaction=kf.prototype.Aa;kf.className="Tool";function Ua(){kf.call(this);this.name="ToolManager";this.Jc=new E;this.Vc=new E;this.vg=new E;this.ba=this.La=850;this.u=(new K(2,2)).ga();this.Vb=5E3;this.Ma=of;this.K=qf;this.Uq=this.l=null;this.Hj=-1}oa(Ua,kf);Ua.prototype.initializeStandardTools=function(){};
Ua.prototype.updateAdornments=function(a){var b=this.currentToolTip;if(b instanceof pf&&this.Uq===a){var c=b.adornedObject;(null!==a?c.part===a:null===c)?this.showToolTip(b,c):this.hideToolTip()}};
Ua.prototype.doMouseDown=function(){var a=this.diagram,b=a.lastInput;b.isTouchEvent&&this.gestureBehavior===rf&&(b.bubbles=!1);if(b.isMultiTouch){this.cancelWaitAfter();if(this.gestureBehavior===sf){b.bubbles=!0;return}if(this.gestureBehavior===rf)return;if(a.currentTool.canStartMultiTouch()){a.currentTool.standardPinchZoomStart();return}}for(var c=this.mouseDownTools.length,d=0;d<c;d++){var e=this.mouseDownTools.N(d);e.hb(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===of?this.mouseWheelBehavior=nf:this.mouseWheelBehavior===nf&&(this.mouseWheelBehavior=of));this.doActivate();this.standardWaitAfter(this.holdDelay,b)};
Ua.prototype.doMouseMove=function(){var a=this.diagram,b=a.lastInput;if(b.isMultiTouch){if(this.gestureBehavior===sf){b.bubbles=!0;return}if(this.gestureBehavior===rf)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.N(d);e.hb(this.diagram);if(e.canStart()){a.doFocus();a.currentTool=e;a.currentTool===e&&(e.isActive||e.doActivate(),e.doMouseMove());return}}tf(this,
a);a=b.event;null===a||"mousemove"!==a.type&&"pointermove"!==a.type&&a.cancelable||(b.bubbles=!0)};function tf(a,b){a.standardMouseOver();a.isBeyondDragSize()&&a.standardWaitAfter(a.isActive?a.holdDelay:a.hoverDelay,b.lastInput)}Ua.prototype.doCurrentObjectChanged=function(a,b){a=this.currentToolTip;null===a||null!==b&&a instanceof pf&&(b===a||b.pg(a))||this.hideToolTip()};
Ua.prototype.doWaitAfter=function(a){var b=this.diagram;b.Da&&(this.doMouseHover(),this.isActive||this.doToolTip(),a.isTouchEvent&&!b.lastInput.handled&&(a=a.copy(),a.button=2,a.buttons=2,b.lastInput=a,b.Jl=!0,b.doMouseUp()))};
Ua.prototype.doMouseHover=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.Rb(b.documentPoint,null,null));var c=b.targetObject;if(null!==c)for(b.handled=!1;null!==c;){a=this.isActive?c.mouseHold:c.mouseHover;if(null!==a&&(a(b,c),b.handled))break;c=c.panel}else c=this.isActive?a.mouseHold:a.mouseHover,null!==c&&c(b)};
Ua.prototype.doToolTip=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.Rb(b.documentPoint,null,null));b=b.targetObject;if(null!==b){if(a=this.currentToolTip,!(a instanceof pf)||b!==a&&!b.pg(a)){for(;null!==b;){a=b.toolTip;if(null!==a){this.showToolTip(a,b);return}b=b.panel}this.hideToolTip()}}else b=a.toolTip,null!==b?this.showToolTip(b,null):this.hideToolTip()};
Ua.prototype.showToolTip=function(a,b){var c=this.diagram;a!==this.currentToolTip&&this.hideToolTip();if(a instanceof pf){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.ac();this.positionToolTip(a,b)}else a instanceof uf&&a!==this.currentToolTip&&a.show(b,c,this);this.currentToolTip=a;-1!==this.Hj&&(w.clearTimeout(this.Hj),
this.Hj=-1);a=this.toolTipDuration;if(0<a&&Infinity!==a){var e=this;this.Hj=ua(function(){e.hideToolTip()},a)}};Ua.prototype.positionToolTip=function(a){if(null===a.placeholder){var b=this.diagram,c=b.lastInput.documentPoint.copy(),d=a.measuredBounds,e=b.viewportBounds;b.lastInput.isTouchEvent&&(c.x-=d.width);c.x+d.width>e.right&&(c.x-=d.width+5/b.scale);c.x<e.x&&(c.x=e.x);c.y=c.y+20/b.scale+d.height>e.bottom?c.y-(d.height+5/b.scale):c.y+20/b.scale;c.y<e.y&&(c.y=e.y);a.position=c}};
Ua.prototype.hideToolTip=function(){-1!==this.Hj&&(w.clearTimeout(this.Hj),this.Hj=-1);var a=this.diagram,b=this.currentToolTip;null!==b&&(b instanceof pf?(a.remove(b),null!==this.Uq&&this.Uq.sf(b.category),b.data=null,b.adornedObject=null):b instanceof uf&&null!==b.hide&&b.hide(a,this),this.currentToolTip=null)};
Ua.prototype.doMouseUp=function(){this.cancelWaitAfter();var a=this.diagram;if(this.isActive)for(var b=this.mouseUpTools.length,c=0;c<b;c++){var d=this.mouseUpTools.N(c);d.hb(this.diagram);if(d.canStart()){a.doFocus();a.currentTool=d;a.currentTool===d&&(d.isActive||d.doActivate(),d.doMouseUp());return}}a.doFocus();this.doDeactivate()};Ua.prototype.doMouseWheel=function(){this.standardMouseWheel()};Ua.prototype.doKeyDown=function(){var a=this.diagram;null!==a.commandHandler&&a.commandHandler.doKeyDown()};
Ua.prototype.doKeyUp=function(){var a=this.diagram;null!==a.commandHandler&&a.commandHandler.doKeyUp()};Ua.prototype.findTool=function(a){for(var b=this.mouseDownTools.length,c=0;c<b;c++){var d=this.mouseDownTools.N(c);if(d.name===a)return d}b=this.mouseMoveTools.length;for(c=0;c<b;c++)if(d=this.mouseMoveTools.N(c),d.name===a)return d;b=this.mouseUpTools.length;for(c=0;c<b;c++)if(d=this.mouseUpTools.N(c),d.name===a)return d;return null};
Ua.prototype.replaceTool=function(a,b){null!==b&&b.hb(this.diagram);for(var c=this.mouseDownTools.length,d=0;d<c;d++){var e=this.mouseDownTools.N(d);if(e.name===a)return null!==b?this.mouseDownTools.gd(d,b):this.mouseDownTools.mb(d),e}c=this.mouseMoveTools.length;for(d=0;d<c;d++)if(e=this.mouseMoveTools.N(d),e.name===a)return null!==b?this.mouseMoveTools.gd(d,b):this.mouseMoveTools.mb(d),e;c=this.mouseUpTools.length;for(d=0;d<c;d++)if(e=this.mouseUpTools.N(d),e.name===a)return null!==b?this.mouseUpTools.gd(d,
b):this.mouseUpTools.mb(d),e;return null};function vf(a,b,c,d){null!==c&&(c.name=b,c.hb(a.diagram));a.findTool(b)?a.replaceTool(b,c):null!==c&&d.add(c)}
pa.Object.defineProperties(Ua.prototype,{mouseWheelBehavior:{get:function(){return this.Ma},set:function(a){this.Ma=a}},gestureBehavior:{get:function(){return this.K},set:function(a){this.K=a}},currentToolTip:{get:function(){return this.l},set:function(a){this.l=a;this.Uq=null!==a&&a instanceof pf?a.adornedPart:null}},mouseDownTools:{get:function(){return this.Jc}},mouseMoveTools:{
get:function(){return this.Vc}},mouseUpTools:{get:function(){return this.vg}},hoverDelay:{get:function(){return this.La},set:function(a){this.La=a}},holdDelay:{get:function(){return this.ba},set:function(a){this.ba=a}},dragSize:{get:function(){return this.u},set:function(a){this.u=a.I()}},toolTipDuration:{get:function(){return this.Vb},
set:function(a){this.Vb=a}}});var of=new D(Ua,"WheelScroll",0),nf=new D(Ua,"WheelZoom",1),wf=new D(Ua,"WheelNone",2),qf=new D(Ua,"GestureZoom",3),rf=new D(Ua,"GestureCancel",4),sf=new D(Ua,"GestureNone",5);Ua.className="ToolManager";Ua.WheelScroll=of;Ua.WheelZoom=nf;Ua.WheelNone=wf;Ua.GestureZoom=qf;Ua.GestureCancel=rf;Ua.GestureNone=sf;
function xf(){kf.call(this);this.name="Dragging";this.K=this.Jc=!0;this.u=this.Ma=this.ba=this.$f=null;this.vn=this.Vc=!1;this.El=new G(NaN,NaN);this.ss=new G;this.Vb=!0;this.Nk=100;this.Gg=[];this.vg=(new F).freeze();this.La=new yf}oa(xf,kf);
xf.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.Nk)?!1:null!==this.findDraggablePart()};
xf.prototype.findDraggablePart=function(){var a=this.diagram;a=a.Yl(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};
xf.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.Yl(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.aa("ChangingSelection",a.selection),b=a.lastInput,(ib?b.meta:b.control)||b.shift||Hf(a),this.currentPart.isSelected=!0,a.aa("ChangedSelection",a.selection))}}};
xf.prototype.doActivate=function(){var a=this.diagram;null===this.currentPart&&this.standardMouseSelect();var b=this.currentPart;null!==b&&(b.canMove()||b.canCopy())&&(If=null,this.isActive=!0,this.El.set(a.position),Jf(this,a.selection),this.Gg.length=0,this.draggedParts=this.computeEffectiveCollection(a.selection,this.dragOptions),a.Si=!0,!0===a.Ce("temporaryPixelRatio")&&30<a.au&&(a.ue=1),Kf(a,this.draggedParts),this.Aa("Drag"),this.startPoint=a.firstInput.documentPoint,a.isMouseCaptured=!0,a.allowDragOut&&
(this.isDragOutStarted=!0,this.vn=!1,If=this,Lf=this.diagram,this.doSimulatedDragOut()))};function Jf(a,b){if(a.dragsLink){var c=a.diagram;c.allowRelink&&(c.model.$j()&&1===b.count&&b.first()instanceof S?(a.draggedLink=b.first(),a.draggedLink.canRelinkFrom()&&a.draggedLink.canRelinkTo()&&a.draggedLink.Pj(),a.$f=c.toolManager.findTool("Relinking"),null===a.$f&&(a.$f=new Mf,a.$f.hb(c))):(a.draggedLink=null,a.$f=null))}}
xf.prototype.computeEffectiveCollection=function(a,b){return this.diagram.commandHandler.computeEffectiveCollection(a,b)};xf.prototype.pd=function(a){return void 0===a?new Nf(ac):this.isGridSnapEnabled?new Nf(new G(Math.round(a.x),Math.round(a.y))):new Nf(a.copy())};
xf.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.uf();Of(this);Pf(a,this.draggedParts);this.draggedParts=this.currentPart=null;this.vn=this.isDragOutStarted=!1;if(0<Qf.count){for(var b=Qf,c=b.length,d=0;d<c;d++){var e=b.N(d);Rf(e);Sf(e);Of(e);e.diagram.uf()}b.clear()}Rf(this);this.El.h(NaN,NaN);If=Lf=null;Sf(this);a.isMouseCaptured=!1;a.currentCursor="";a.Si=!1;this.ug();Tf(a,!0)};
function Of(a){var b=a.diagram,c=b.skipsUndoManager;b.skipsUndoManager=!0;Uf(a,b.lastInput,null);b.skipsUndoManager=c;a.Gg.length=0}function Vf(){var a=If;Sf(a);Wf(a);var b=a.diagram;a.El.s()&&(b.position=a.El);b.uf()}xf.prototype.doCancel=function(){Sf(this);Wf(this);var a=this.diagram;this.El.s()&&(a.position=this.El);this.stopTool()};xf.prototype.doKeyDown=function(){this.isActive&&("Esc"===this.diagram.lastInput.key?this.doCancel():this.doMouseMove())};
xf.prototype.doKeyUp=function(){this.isActive&&this.doMouseMove()};function Xf(a,b){var c=Infinity,d=Infinity,e=-Infinity,f=-Infinity;for(a=a.iterator;a.next();){var g=a.value;if(g.Lb()&&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 Yf(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.tf(),c.Aa("Drag")):Wf(a);c.skipsUndoManager=!b;c.partManager.addsToTemporaryLayer=!b;a.startPoint=c.firstInput.documentPoint;b=a.copiesEffectiveCollection?a.draggedParts.Xd():c.selection;c=c.Uj(b,c,!0);for(b=c.iterator;b.next();)b.value.location=
b.key.location;b=L.alloc();Xf(c,b);L.free(b);b=new Lb;for(d=a.draggedParts.iterator;d.next();){var e=d.key;e.Lb()&&e.canCopy()&&(e=c.J(e),null!==e&&(e.ac(),b.add(e,a.pd(e.location))))}for(c=c.iterator;c.next();)d=c.value,d instanceof S&&d.canCopy()&&b.add(d,a.pd());a.copiedParts=b;Jf(a,b.Xd());null!==a.draggedLink&&(c=a.draggedLink,b=c.routeBounds,Zf(c,a.startPoint.x-(b.x+b.width/2),a.startPoint.y-(b.y+b.height/2)))}}}
function Sf(a){var b=a.diagram;if(null!==a.copiedParts&&(b.nt(a.copiedParts.Xd(),!1),a.copiedParts=null,null!==a.draggedParts))for(var c=a.draggedParts.iterator;c.next();)c.key instanceof S&&(c.value.point=new G(0,0));b.skipsUndoManager=!1;b.partManager.addsToTemporaryLayer=!1;a.startPoint=b.firstInput.documentPoint}
function Rf(a){if(null!==a.draggedLink){if(a.dragsLink&&null!==a.$f){var b=a.$f;b.diagram.remove(b.temporaryFromNode);b.diagram.remove(b.temporaryToNode)}a.draggedLink=null;a.$f=null}}function $f(a,b,c){var d=a.diagram,e=a.startPoint,f=G.alloc();f.assign(d.lastInput.documentPoint);a.moveParts(b,f.Wd(e),c);G.free(f);!0===d.Ce("temporaryPixelRatio")&&null===d.ue&&30<d.au&&(d.ue=1,d.lt())}xf.prototype.moveParts=function(a,b,c){var d=this.diagram;null!==d&&ag(d,a,b,this.dragOptions,c)};
function Wf(a){if(null!==a.draggedParts){for(var b=a.diagram,c=a.draggedParts.iterator;c.next();){var d=c.key;d.Lb()&&(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.pd());Zf(d,-e.x,-e.y)}b.fd()}}function cg(a,b){if(null===b)return!0;b=b.part;return null===b||b instanceof pf||b.layer.isTemporary||a.draggedParts&&a.draggedParts.contains(b)||a.copiedParts&&a.copiedParts.contains(b)?!0:!1}
function dg(a,b){var c=a.diagram;a.dragsLink&&(null!==a.draggedLink&&(a.draggedLink.fromNode=null,a.draggedLink.toNode=null),eg(a,!1));var d=fg(c,b,null,function(b){return!cg(a,b)}),e=c.lastInput;e.targetObject=d;var f=c.skipsUndoManager,g=!1;try{c.skipsUndoManager=!0;g=Uf(a,e,d);if(!a.isActive&&null===If)return;if(null===d||c.handlesDragDropForTopLevelParts){var h=c.mouseDragOver;null!==h&&(h(e),g=!0)}if(!a.isActive&&null===If)return;a.doDragOver(b,d);if(!a.isActive&&null===If)return}finally{c.skipsUndoManager=
f,g&&c.fd()}(c.allowHorizontalScroll||c.allowVerticalScroll)&&c.Ks(e.viewPoint)}function Uf(a,b,c){var d=!1,e=a.Gg.length,f=0<e?a.Gg[0]:null;if(c===f)return!1;b.handled=!1;for(var g=0;g<e;g++){var h=a.Gg[g],k=h.mouseDragLeave;if(null!==k&&(k(b,h,c),d=!0,b.handled))break}a.Gg.length=0;if(!a.isActive&&null===If||null===c)return d;b.handled=!1;for(e=c;null!==e;)a.Gg.push(e),e=gg(e);e=a.Gg.length;for(c=0;c<e&&(g=a.Gg[c],h=g.mouseDragEnter,null===h||(h(b,g,f),d=!0,!b.handled));c++);return d}
function gg(a){var b=a.panel;return null!==b?b:a instanceof T&&!(a instanceof hg)&&(a=a.containingGroup,null!==a&&a.handlesDragDropForMembers)?a:null}function ig(a,b,c){var d=a.$f;if(null===d)return null;var e=a.diagram.mg(b,d.portGravity,function(a){return d.findValidLinkablePort(a,c)});a=G.alloc();var f=Infinity,g=null;for(e=e.iterator;e.next();){var h=e.value;if(null!==h.part){var k=h.ma(dd,a);k=b.Ae(k);k<f&&(g=h,f=k)}}G.free(a);return g}
function eg(a,b){var c=a.draggedLink;if(null!==c&&!(2>c.pointsCount)){var d=a.diagram;if(!d.isReadOnly){var e=a.$f;if(null!==e){var f=null,g=null;null===c.fromNode&&(f=ig(a,c.i(0),!1),null!==f&&(g=f.part));var h=null,k=null;null===c.toNode&&(h=ig(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.sx&&d.aa("LinkRelinked",c,d.sx),c.toPort!==d.tx&&d.aa("LinkRelinked",c,d.tx)):jg(e,g,f,k,h):jg(e,null,null,null,null)}}}}xf.prototype.doDragOver=function(){};
function kg(a,b){var c=a.diagram;a.dragsLink&&eg(a,!0);Of(a);var d=fg(c,b,null,function(b){return!cg(a,b)}),e=c.lastInput;e.targetObject=d;if(null!==d){e.handled=!1;for(var f=d;null!==f;){var g=f.mouseDrop;if(null!==g&&(g(e,f),e.handled))break;lg(a,e,f);f=gg(f)}}else f=c.mouseDrop,null!==f&&f(e);if(a.isActive||null!==If){for(e=(a.copiedParts||a.draggedParts).iterator;e.next();)f=e.key,f instanceof V&&f.linksConnected.each(function(a){a.suspendsRouting=!1});a.doDropOnto(b,d);if(a.isActive||null!==
If){b=L.alloc();for(d=c.selection.iterator;d.next();)e=d.value,e instanceof V&&mg(a,c,e,b);L.free(b)}}}function lg(a,b,c){a=a.diagram;c instanceof T&&null===c.containingGroup&&!(c instanceof hg)&&a.handlesDragDropForTopLevelParts&&(c=a.mouseDrop,null!==c&&c(b))}
function mg(a,b,c,d){var e=!1;c.getAvoidableRect(d);b.viewportBounds.mf(d)&&(e=!0);b=b.links;for(a=a.copiedParts||a.draggedParts;b.next();){var f=b.value;if(!e||ng(f))a.contains(f)&&a.contains(c)||!f.Ud(c)&&f.isAvoiding&&Ac(f.actualBounds,d,0)&&f.Ra()}}xf.prototype.doDropOnto=function(){};
xf.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram,b=a.lastInput;this.simulatedMouseMove(b.event,null,b.targetDiagram||null)||null===this.currentPart||null===this.draggedParts||(this.mayCopy()?(a.currentCursor="copy",Yf(this,!1),Kf(a,this.copiedParts),$f(this,this.copiedParts,!1),Pf(a,this.copiedParts)):this.mayMove()?(Sf(this),$f(this,this.draggedParts,!0)):this.mayDragOut()?(a.currentCursor="no-drop",Yf(this,!1),$f(this,this.copiedParts,!1)):Sf(this),dg(this,a.lastInput.documentPoint))}};
xf.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram,b=a.lastInput;if(!this.simulatedMouseUp(b.event,null,b.documentPoint,b.targetDiagram)){var c=!1;(b=this.mayCopy())&&null!==this.copiedParts?(Sf(this),Yf(this,!0),Kf(a,this.copiedParts),$f(this,this.copiedParts,!1),Pf(a,this.copiedParts),null!==this.copiedParts&&a.Cv(this.copiedParts.Xd())):(c=!0,Sf(this),this.mayMove()&&($f(this,this.draggedParts,!0),dg(this,a.lastInput.documentPoint)));this.vn=!0;kg(this,a.lastInput.documentPoint);
if(this.isActive){var d=b?this.copiedParts.Xd():this.draggedParts.Xd();this.copiedParts=null;if(c&&null!==this.draggedParts)for(c=this.draggedParts.iterator;c.next();){var e=c.key;e instanceof V&&(e=e.containingGroup,null===e||null===e.placeholder||this.draggedParts.contains(e)||e.placeholder.o())}a.Xa();Pf(a,this.draggedParts);this.transactionResult=b?"Copy":"Move";a.aa(b?"SelectionCopied":"SelectionMoved",d)}this.stopTool()}}};
xf.prototype.simulatedMouseMove=function(a,b,c){if(null===If)return!1;var d=If.diagram;c instanceof P||(c=null);var e=Lf;c!==e&&(null!==e&&e!==d&&(e.uf(),If.isDragOutStarted=!1,e=e.toolManager.findTool("Dragging"),null!==e&&e.doSimulatedDragLeave()),Lf=c,null!==c&&c!==d&&(Vf(),e=c.toolManager.findTool("Dragging"),null!==e&&(Qf.contains(e)||Qf.add(e),e.doSimulatedDragEnter())));if(null===c||c===d||!c.allowDrop||c.isReadOnly||!c.allowInsert)return!1;d=c.toolManager.findTool("Dragging");null!==d&&(null!==
a?(void 0!==a.targetTouches&&(0<a.targetTouches.length?a=a.targetTouches[0]:0<a.changedTouches.length&&(a=a.changedTouches[0])),b=c.getMouse(a)):null===b&&(b=new G),c.lastInput.documentPoint=b,c.lastInput.viewPoint=c.ut(b),c.lastInput.down=!1,c.lastInput.up=!1,d.doSimulatedDragOver());return!0};
xf.prototype.simulatedMouseUp=function(a,b,c,d){if(null===If)return!1;null===d&&(d=b);b=Lf;var e=If.diagram;if(d!==b){var f=b.toolManager.findTool("Dragging");if(null!==b&&b!==e&&null!==f)return b.uf(),If.isDragOutStarted=!1,f.doSimulatedDragLeave(),!1;Lf=d;b=d.toolManager.findTool("Dragging");null!==d&&null!==b&&(Vf(),Qf.contains(b)||Qf.add(b),b.doSimulatedDragEnter())}return null===d?(If.doCancel(),!0):d!==this.diagram?(null!==a?(void 0!==a.targetTouches&&(0<a.targetTouches.length?a=a.targetTouches[0]:
0<a.changedTouches.length&&(a=a.changedTouches[0])),c=d.getMouse(a)):null===c&&(c=new G),d.lastInput.documentPoint=c,d.lastInput.viewPoint=d.ut(c),d.lastInput.down=!1,d.lastInput.up=!0,a=d.toolManager.findTool("Dragging"),null!==a&&a.doSimulatedDrop(),a=If,null!==a&&(d=a.mayCopy(),a.transactionResult=d?"Copy":"Move",a.stopTool()),!0):!1};
xf.prototype.mayCopy=function(){if(!this.isCopyEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowCopy||(ib?!a.lastInput.alt:!a.lastInput.control))return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.Lb()&&b.canCopy())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1};
xf.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.Lb()&&b.canCopy())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1};
xf.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.Lb()&&b.canMove())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canMove()?!0:!1};xf.prototype.computeBorder=function(a,b,c){return this.vn||null===this.draggedParts||this.draggedParts.contains(a)?null:c.assign(b)};xf.prototype.Wy=function(){return If};
xf.prototype.mayDragIn=function(){var a=this.diagram;if(!a.allowDrop||a.isReadOnly||a.isModelReadOnly||!a.allowInsert)return!1;var b=If;return null===b||b.diagram.model.dataFormat!==a.model.dataFormat?!1:!0};xf.prototype.doSimulatedDragEnter=function(){if(this.mayDragIn()){var a=this.diagram;a.animationManager.vd();og(a);a.animationManager.vd();a=If;null!==a&&(a.diagram.currentCursor="copy",a.diagram.Si=!1)}};xf.prototype.doSimulatedDragLeave=function(){var a=If;null!==a&&a.doSimulatedDragOut();this.doCancel()};
xf.prototype.doSimulatedDragOver=function(){var a=this.diagram,b=If;null!==b&&null!==b.draggedParts&&this.mayDragIn()&&(a.currentCursor="copy",pg(this,b.draggedParts.Xd(),!1,a.firstInput),$f(this,this.copiedParts,!1),dg(this,a.lastInput.documentPoint))};
xf.prototype.doSimulatedDrop=function(){var a=this.diagram,b=If;if(null!==b){var c=b.diagram;b.vn=!0;Sf(this);this.mayDragIn()&&(this.Aa("Drop"),pg(this,b.draggedParts.Xd(),!0,a.lastInput),$f(this,this.copiedParts,!1),null!==this.copiedParts&&a.Cv(this.copiedParts.Xd()),kg(this,a.lastInput.documentPoint),a.Xa(),b=a.selection,null!==this.copiedParts?this.transactionResult="ExternalCopy":b=new F,this.copiedParts=null,a.doFocus(),a.aa("ExternalObjectsDropped",b,c),this.ug())}};
function pg(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.Uj(b,e,!0);var f=L.alloc();Xf(b,f);d=f.x+f.width/2;e=f.y+f.height/2;L.free(f);f=a.ss;var g=new Lb,h=G.alloc();for(b=b.iterator;b.next();){var k=b.value,l=c.J(k);k.Lb()&&k.canCopy()?(k=k.location,h.h(f.x-(d-k.x),f.y-(e-k.y)),l.location=h,l.ac(),g.add(l,a.pd(h))):l instanceof S&&k.canCopy()&&(Zf(l,f.x-d,f.y-e),
g.add(l,a.pd()))}G.free(h);a.copiedParts=g;Jf(a,g.Xd());null!==a.draggedLink&&(c=a.draggedLink,d=c.routeBounds,Zf(c,a.startPoint.x-(d.x+d.width/2),a.startPoint.y-(d.y+d.height/2)))}}}xf.prototype.doSimulatedDragOut=function(){var a=this.diagram;a.Si=!1;this.mayCopy()||this.mayMove()?a.currentCursor="":a.currentCursor="no-drop"};xf.prototype.computeMove=function(a,b,c,d){c=this.diagram;return null!==c?c.computeMove(a,b,this.dragOptions,d):new G};
pa.Object.defineProperties(xf.prototype,{isCopyEnabled:{get:function(){return this.Jc},set:function(a){this.Jc=a}},copiesEffectiveCollection:{get:function(){return this.K},set:function(a){this.K=a}},dragOptions:{get:function(){return this.La},set:function(a){this.La=a}},isGridSnapEnabled:{get:function(){return this.dragOptions.isGridSnapEnabled},set:function(a){this.dragOptions.isGridSnapEnabled=
a}},isComplexRoutingRealtime:{get:function(){return this.Vb},set:function(a){this.Vb=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){null===this.diagram||this.dragOptions.gridSnapCellSize.A(a)||(a=a.I(),this.dragOptions.gridSnapCellSize=
a)}},gridSnapCellSpot:{get:function(){return this.dragOptions.gridSnapCellSpot},set:function(a){this.dragOptions.gridSnapCellSpot.A(a)||(a=a.I(),this.dragOptions.gridSnapCellSpot=a)}},gridSnapOrigin:{get:function(){return this.dragOptions.gridSnapOrigin},set:function(a){this.dragOptions.gridSnapOrigin.A(a)||(a=a.I(),this.dragOptions.gridSnapOrigin=a)}},dragsLink:{get:function(){return this.dragOptions.dragsLink},
set:function(a){this.dragOptions.dragsLink=a}},dragsTree:{get:function(){return this.dragOptions.dragsTree},set:function(a){this.dragOptions.dragsTree=a}},currentPart:{get:function(){return this.ba},set:function(a){this.ba=a}},copiedParts:{get:function(){return this.u},set:function(a){this.u=a}},draggedParts:{get:function(){return this.Ma},set:function(a){this.Ma=a}},draggingParts:{
get:function(){return null!==this.copiedParts?this.copiedParts.Xd():null!==this.draggedParts?this.draggedParts.Xd():this.vg}},draggedLink:{get:function(){return this.diagram.draggedLink},set:function(a){this.diagram.draggedLink=a}},isDragOutStarted:{get:function(){return this.Vc},set:function(a){this.Vc=a}},startPoint:{get:function(){return this.ss},set:function(a){this.ss.A(a)||this.ss.assign(a)}},
delay:{get:function(){return this.Nk},set:function(a){this.Nk=a}}});xf.prototype.getDraggingSource=xf.prototype.Wy;var Qf=null,If=null,Lf=null;xf.className="DraggingTool";Qf=new E;Ta("draggingTool",function(){return this.findTool("Dragging")},function(a){vf(this,"Dragging",a,this.mouseMoveTools)});Ua.prototype.doCancel=function(){null!==If&&If.doCancel();kf.prototype.doCancel.call(this)};
function qg(){kf.call(this);this.vg=100;this.ba=!1;var a=new S,b=new W;b.isPanelMain=!0;b.stroke="blue";a.add(b);b=new W;b.toArrow="Standard";b.fill="blue";b.stroke="blue";a.add(b);a.layerName="Tool";this.Em=a;a=new V;b=new W;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke="magenta";b.strokeWidth=2;b.desiredSize=gc;a.add(b);a.selectable=!1;a.layerName="Tool";this.Cm=a;this.Dm=b;a=new V;b=new W;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke="magenta";b.strokeWidth=2;b.desiredSize=gc;a.add(b);
a.selectable=!1;a.layerName="Tool";this.tq=a;this.$v=b;this.Vc=this.Jc=this.Ma=this.La=this.Vb=null;this.K=!0;this.Nx=new Lb;this.Am=this.hi=this.Bm=null}oa(qg,kf);qg.prototype.doStop=function(){this.diagram.uf();this.originalToPort=this.originalToNode=this.originalFromPort=this.originalFromNode=this.originalLink=null;this.validPortsCache.clear();this.targetPort=null};
qg.prototype.copyPortProperties=function(a,b,c,d,e){if(null!==a&&null!==b&&null!==c&&null!==d){var f=b.Be(),g=K.alloc();g.width=b.naturalBounds.width*f;g.height=b.naturalBounds.height*f;d.desiredSize=g;K.free(g);e?(d.toSpot=b.toSpot,d.toEndSegmentLength=b.toEndSegmentLength):(d.fromSpot=b.fromSpot,d.fromEndSegmentLength=b.fromEndSegmentLength);c.locationSpot=dd;f=G.alloc();c.location=b.ma(dd,f);G.free(f);d.angle=b.Hi();null!==this.portTargeted&&this.portTargeted(a,b,c,d,e)}};
qg.prototype.setNoTargetPortProperties=function(a,b,c){null!==b&&(b.desiredSize=gc,b.fromSpot=Sc,b.toSpot=Sc);null!==a&&(a.location=this.diagram.lastInput.documentPoint);null!==this.portTargeted&&this.portTargeted(null,null,a,b,c)};qg.prototype.doMouseDown=function(){this.isActive&&this.doMouseMove()};
qg.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram;this.targetPort=this.findTargetPort(this.isForwards);if(null!==this.targetPort&&this.targetPort.part instanceof V){var b=this.targetPort.part;this.isForwards?this.copyPortProperties(b,this.targetPort,this.temporaryToNode,this.temporaryToPort,!0):this.copyPortProperties(b,this.targetPort,this.temporaryFromNode,this.temporaryFromPort,!1)}else this.isForwards?this.setNoTargetPortProperties(this.temporaryToNode,this.temporaryToPort,
!0):this.setNoTargetPortProperties(this.temporaryFromNode,this.temporaryFromPort,!1);(a.allowHorizontalScroll||a.allowVerticalScroll)&&a.Ks(a.lastInput.viewPoint)}};qg.prototype.findValidLinkablePort=function(a,b){if(null===a)return null;var c=a.part;if(!(c instanceof V))return null;for(;null!==a;){var d=b?a.toLinkable:a.fromLinkable;if(!0===d&&(null!==a.portId||a instanceof V)&&(b?this.isValidTo(c,a):this.isValidFrom(c,a)))return a;if(!1===d)break;a=a.panel}return null};
qg.prototype.findTargetPort=function(a){var b=this.diagram,c=b.lastInput.documentPoint,d=this.portGravity;0>=d&&(d=.1);var e=this,f=b.mg(c,d,function(b){return e.findValidLinkablePort(b,a)},null,!0);d=Infinity;b=null;for(f=f.iterator;f.next();){var g=f.value,h=g.part;if(h instanceof V){var k=g.ma(dd,G.alloc()),l=c.x-k.x,m=c.y-k.y;G.free(k);k=l*l+m*m;k<d&&(l=this.validPortsCache.J(g),null!==l?l&&(b=g,d=k):a&&this.isValidLink(this.originalFromNode,this.originalFromPort,h,g)||!a&&this.isValidLink(h,
g,this.originalToNode,this.originalToPort)?(this.validPortsCache.add(g,!0),b=g,d=k):this.validPortsCache.add(g,!1))}}return null!==b&&(c=b.part,c instanceof V&&(null===c.layer||c.layer.allowLink))?b:null};
qg.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.Pp(b).count>=c)return!1}return!0};
qg.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.sd(b).count>=c)return!1}return!0};
qg.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};qg.prototype.isLinked=function(a,b){if(null===a||null===b)return!1;var c=a.part;if(!(c instanceof V))return!1;a=a.portId;null===a&&(a="");var d=b.part;if(!(d instanceof V))return!1;b=b.portId;null===b&&(b="");for(b=d.sd(b);b.next();)if(d=b.value,d.fromNode===c&&d.fromPortId===a)return!0;return!1};
qg.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};qg.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 rg(this,c,b,d)};
function rg(a,b,c,d){if(b===c)return!0;var e=b.fromNode;if(null!==e&&e.isLinkLabel&&(d.add(e),rg(a,e.labeledLink,c,d)))return!0;b=b.toNode;return null!==b&&b.isLinkLabel&&(d.add(b),rg(a,b.labeledLink,c,d))?!0:!1}
qg.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!==sg){if(d===tg){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!ug(this,a,b,c,!0)}if(d===vg){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!ug(this,a,b,c,!0)}if(d===wg)return a===b?a=!0:(d=new F,d.add(b),a=xg(this,d,a,b,c)),!a;if(d===yg)return!ug(this,a,b,c,!1);if(d===zg)return a===b?a=!0:(d=new F,d.add(b),a=Ag(this,d,a,b,c)),!a}return!0};function ug(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&&ug(a,g,c,d,e)))return!0}return!1}
function xg(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&&xg(a,b,g,d,e)))return!0}return!1}function Ag(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&&Ag(a,b,h,d,e))return!0}}return!1}
pa.Object.defineProperties(qg.prototype,{portGravity:{get:function(){return this.vg},set:function(a){0<=a&&(this.vg=a)}},isUnconnectedLinkValid:{get:function(){return this.ba},set:function(a){this.ba=a}},temporaryLink:{get:function(){return this.Em},set:function(a){this.Em=a}},temporaryFromNode:{get:function(){return this.Cm},set:function(a){this.Cm=a}},temporaryFromPort:{
get:function(){return this.Dm},set:function(a){this.Dm=a}},temporaryToNode:{get:function(){return this.tq},set:function(a){this.tq=a}},temporaryToPort:{get:function(){return this.$v},set:function(a){this.$v=a}},originalLink:{get:function(){return this.Vb},set:function(a){this.Vb=a}},originalFromNode:{get:function(){return this.La},set:function(a){this.La=a}},originalFromPort:{
get:function(){return this.Ma},set:function(a){this.Ma=a}},originalToNode:{get:function(){return this.Jc},set:function(a){this.Jc=a}},originalToPort:{get:function(){return this.Vc},set:function(a){this.Vc=a}},isForwards:{get:function(){return this.K},set:function(a){this.K=a}},validPortsCache:{get:function(){return this.Nx}},targetPort:{
get:function(){return this.Bm},set:function(a){this.Bm=a}},linkValidation:{get:function(){return this.hi},set:function(a){this.hi=a}},portTargeted:{get:function(){return this.Am},set:function(a){this.Am=a}}});qg.className="LinkingBaseTool";function Hg(){qg.call(this);this.name="Linking";this.u={};this.l=null;this.L=Ig;this.Bh=null}oa(Hg,qg);
Hg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowLink||!a.model.at()||!a.lastInput.left||a.currentTool!==this&&!this.isBeyondDragSize()?!1:null!==this.findLinkablePort()};
Hg.prototype.findLinkablePort=function(){var a=this.diagram,b=this.startObject;null===b&&(b=a.Rb(a.firstInput.documentPoint,null,null));if(null===b||!(b.part instanceof V))return null;a=this.direction;if(a===Ig||a===Jg){var c=this.findValidLinkablePort(b,!1);if(null!==c)return this.isForwards=!0,c}if(a===Ig||a===Kg)if(b=this.findValidLinkablePort(b,!0),null!==b)return this.isForwards=!1,b;return null};
Hg.prototype.doActivate=function(){var a=this.diagram,b=this.findLinkablePort();null!==b&&(this.Aa(this.name),a.isMouseCaptured=!0,a.currentCursor="pointer",this.isForwards?(null===this.temporaryToNode||this.temporaryToNode.location.s()||(this.temporaryToNode.location=a.lastInput.documentPoint),this.originalFromPort=b,b=this.originalFromPort.part,b instanceof V&&(this.originalFromNode=b),this.copyPortProperties(this.originalFromNode,this.originalFromPort,this.temporaryFromNode,this.temporaryFromPort,
!1)):(null===this.temporaryFromNode||this.temporaryFromNode.location.s()||(this.temporaryFromNode.location=a.lastInput.documentPoint),this.originalToPort=b,b=this.originalToPort.part,b instanceof V&&(this.originalToNode=b),this.copyPortProperties(this.originalToNode,this.originalToPort,this.temporaryToNode,this.temporaryToPort,!0)),a.add(this.temporaryFromNode),a.add(this.temporaryToNode),null!==this.temporaryLink&&(null!==this.temporaryFromNode&&(this.temporaryLink.fromNode=this.temporaryFromNode),
null!==this.temporaryToNode&&(this.temporaryLink.toNode=this.temporaryToNode),this.temporaryLink.isTreeLink=this.isNewTreeLink(),this.temporaryLink.Ra(),a.add(this.temporaryLink)),this.isActive=!0)};Hg.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.ug()};Hg.prototype.doStop=function(){qg.prototype.doStop.call(this);this.startObject=null};
Hg.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram,b=this.transactionResult=null,c=null,d=null,e=null,f=this.targetPort=this.findTargetPort(this.isForwards);if(null!==f){var g=f.part;g instanceof V&&(this.isForwards?(null!==this.originalFromNode&&(b=this.originalFromNode,c=this.originalFromPort),d=g,e=f):(b=g,c=f,null!==this.originalToNode&&(d=this.originalToNode,e=this.originalToPort)))}else this.isForwards?null!==this.originalFromNode&&this.isUnconnectedLinkValid&&(b=this.originalFromNode,
c=this.originalFromPort):null!==this.originalToNode&&this.isUnconnectedLinkValid&&(d=this.originalToNode,e=this.originalToPort);null!==b||null!==d?(g=this.insertLink(b,c,d,e),null!==g?(null===f&&(this.isForwards?g.defaultToPoint=a.lastInput.documentPoint:g.defaultFromPoint=a.lastInput.documentPoint),a.allowSelect&&a.select(g),this.transactionResult=this.name,a.aa("LinkDrawn",g)):(a.model.Iu(),this.doNoLink(b,c,d,e))):this.isForwards?this.doNoLink(this.originalFromNode,this.originalFromPort,null,null):
this.doNoLink(null,null,this.originalToNode,this.originalToPort)}this.stopTool()};Hg.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};Hg.prototype.insertLink=function(a,b,c,d){return this.diagram.partManager.insertLink(a,b,c,d)};Hg.prototype.doNoLink=function(){};
pa.Object.defineProperties(Hg.prototype,{archetypeLinkData:{get:function(){return this.u},set:function(a){this.u=a}},archetypeLabelNodeData:{get:function(){return this.l},set:function(a){this.l=a}},direction:{get:function(){return this.L},set:function(a){this.L=a}},startObject:{get:function(){return this.Bh},set:function(a){this.Bh=a}}});
var Ig=new D(Hg,"Either",0),Jg=new D(Hg,"ForwardsOnly",0),Kg=new D(Hg,"BackwardsOnly",0);Hg.className="LinkingTool";Hg.Either=Ig;Hg.ForwardsOnly=Jg;Hg.BackwardsOnly=Kg;
function Mf(){qg.call(this);this.name="Relinking";var a=new W;a.figure="Diamond";a.desiredSize=ic;a.fill="lightblue";a.stroke="dodgerblue";a.cursor="pointer";a.segmentIndex=0;this.u=a;a=new W;a.figure="Diamond";a.desiredSize=ic;a.fill="lightblue";a.stroke="dodgerblue";a.cursor="pointer";a.segmentIndex=-1;this.Bh=a;this.l=null;this.Ew=new L}oa(Mf,qg);
Mf.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.s()&&a.isVisible()&&d.actualBounds.s()&&d.rf()&&(c=a.Xj(b),null===c&&(c=this.makeAdornment(d,!1),a.nh(b,c)))}null===c&&a.sf(b);b="RelinkTo";c=null;a.isSelected&&!this.diagram.isReadOnly&&(d=a.selectionObject,null!==d&&a.canRelinkTo()&&a.actualBounds.s()&&a.isVisible()&&d.actualBounds.s()&&d.rf()&&
(c=a.Xj(b),null===c?(c=this.makeAdornment(d,!0),a.nh(b,c)):c.o()));null===c&&a.sf(b)}};Mf.prototype.makeAdornment=function(a,b){var c=new pf;c.type=X.Link;b=b?this.toHandleArchetype:this.fromHandleArchetype;null!==b&&c.add(b.copy());c.adornedObject=a;return c};
Mf.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowRelink||!a.model.at()||!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};
Mf.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 pf&&c.adornedPart instanceof S))return;this.handle=b;this.isForwards=null===c||"RelinkTo"===c.category;this.originalLink=c.adornedPart}this.Aa(this.name);a.isMouseCaptured=!0;a.currentCursor="pointer";
this.originalFromPort=this.originalLink.fromPort;this.originalFromNode=this.originalLink.fromNode;this.originalToPort=this.originalLink.toPort;this.originalToNode=this.originalLink.toNode;this.Ew.set(this.originalLink.actualBounds);null!==this.originalLink&&0<this.originalLink.pointsCount&&(null===this.originalLink.fromNode&&(null!==this.temporaryFromPort&&(this.temporaryFromPort.desiredSize=fc),null!==this.temporaryFromNode&&(this.temporaryFromNode.location=this.originalLink.i(0))),null===this.originalLink.toNode&&
(null!==this.temporaryToPort&&(this.temporaryToPort.desiredSize=fc),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.Ra(),a.add(this.temporaryLink));this.isActive=!0};
Mf.prototype.copyLinkProperties=function(a,b){if(null!==a&&null!==b){b.adjusting=a.adjusting;b.corner=a.corner;var c=a.curve;if(c===Lg||c===Mg)c=Ng;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}};
Mf.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.ug()};Mf.prototype.doStop=function(){qg.prototype.doStop.call(this);this.handle=null};
Mf.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram;this.transactionResult=null;var b=this.originalFromNode,c=this.originalFromPort,d=this.originalToNode,e=this.originalToPort,f=this.originalLink;this.targetPort=this.findTargetPort(this.isForwards);if(null!==this.targetPort){var g=this.targetPort.part;g instanceof V&&(this.isForwards?(d=g,e=this.targetPort):(b=g,c=this.targetPort))}else this.isUnconnectedLinkValid?this.isForwards?e=d=null:c=b=null:f=null;null!==f?(this.reconnectLink(f,
this.isForwards?d:b,this.isForwards?e:c,this.isForwards),null===this.targetPort&&(this.isForwards?f.defaultToPoint=a.lastInput.documentPoint:f.defaultFromPoint=a.lastInput.documentPoint,f.Ra()),a.allowSelect&&(f.isSelected=!0),this.transactionResult=this.name,a.aa("LinkRelinked",f,this.isForwards?this.originalToPort:this.originalFromPort)):this.doNoRelink(this.originalLink,this.isForwards);this.originalLink.Xp(this.Ew)}this.stopTool()};
Mf.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};Mf.prototype.doNoRelink=function(){};
function jg(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)}
pa.Object.defineProperties(Mf.prototype,{fromHandleArchetype:{get:function(){return this.u},set:function(a){this.u=a}},toHandleArchetype:{get:function(){return this.Bh},set:function(a){this.Bh=a}},handle:{get:function(){return this.l},set:function(a){if(null!==a&&!(a.part instanceof pf))throw Error("new handle is not in an Adornment: "+a);this.l=a}}});Mf.className="RelinkingTool";
Ta("linkingTool",function(){return this.findTool("Linking")},function(a){vf(this,"Linking",a,this.mouseMoveTools)});Ta("relinkingTool",function(){return this.findTool("Relinking")},function(a){vf(this,"Relinking",a,this.mouseDownTools)});
function Og(){kf.call(this);this.name="LinkReshaping";var a=new W;a.figure="Rectangle";a.desiredSize=hc;a.fill="lightblue";a.stroke="dodgerblue";this.u=a;a=new W;a.figure="Diamond";a.desiredSize=ic;a.fill="lightblue";a.stroke="dodgerblue";a.cursor="move";this.K=a;this.ba=3;this.Dt=this.l=null;this.ql=new G;this.Xr=new E}oa(Og,kf);Og.prototype.Zu=function(a){return a&&a.cs&&0!==a.cs.value?a.cs:Pg};Og.prototype.um=function(a,b){a.cs=b};
Og.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.s()&&a.isVisible()&&c.actualBounds.s()&&c.rf()&&(b=a.Xj(this.name),null===b||b.Bw!==a.pointsCount||b.Mw!==a.resegmentable)&&(b=this.makeAdornment(c),null!==b&&(b.Bw=a.pointsCount,b.Mw=a.resegmentable,a.nh(this.name,b)))}null===b&&a.sf(this.name)}};
Og.prototype.makeAdornment=function(a){var b=a.part,c=b.pointsCount,d=b.isOrthogonal,e=null;if(null!==b.points&&1<c){e=new pf;e.type=X.Link;c=b.firstPickIndex;var f=b.lastPickIndex,g=d?1:0;if(b.resegmentable&&b.computeCurve()!==Qg)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);H.w(k.x,l.x)&&
H.w(k.y,l.y)&&(l=b.i(c-1));H.w(k.x,l.x)?(this.um(h,Rg),h.cursor="n-resize"):H.w(k.y,l.y)&&(this.um(h,Sg),h.cursor="w-resize")}else g===f-1&&d?(k=b.i(f-1),l=b.i(f),H.w(k.x,l.x)&&H.w(k.y,l.y)&&(k=b.i(f+1)),H.w(k.x,l.x)?(this.um(h,Rg),h.cursor="n-resize"):H.w(k.y,l.y)&&(this.um(h,Sg),h.cursor="w-resize")):g!==f&&(this.um(h,Tg),h.cursor="move");e.add(h)}e.adornedObject=a}return e};Og.prototype.makeHandle=function(){var a=this.handleArchetype;return null===a?null:a.copy()};
Og.prototype.makeResegmentHandle=function(){var a=this.midHandleArchetype;return null===a?null:a.copy()};Og.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};
Og.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.Dt=b;a.isMouseCaptured=!0;this.Aa(this.name);if(b.resegmentable&&999===this.handle.fromMaxLinks){var c=b.points.copy(),d=this.getResegmentingPoint();c.Ib(this.handle.segmentIndex+1,d);b.isOrthogonal&&c.Ib(this.handle.segmentIndex+1,d);b.points=c;b.Jb();b.updateAdornments();
this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name);if(null===this.handle){this.doDeactivate();return}}this.ql=b.i(this.handle.segmentIndex);this.Xr=b.points.copy();this.isActive=!0}}};Og.prototype.doDeactivate=function(){this.ug();this.Dt=this.handle=null;this.isActive=this.diagram.isMouseCaptured=!1};Og.prototype.doCancel=function(){var a=this.adornedLink;null!==a&&(a.points=this.Xr);this.stopTool()};Og.prototype.getResegmentingPoint=function(){return this.handle.ma(dd)};
Og.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeReshape(a.lastInput.documentPoint),this.reshape(a))};
Og.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&&(Ug(this,g,d,e,f,!0)||Ug(this,g,d,e,f,!1))){var h=b.points.copy();Ug(this,g,d,
e,f,!0)?(h.gd(c-2,new G(g.x,(f.y+g.y)/2)),h.gd(c+1,new G(f.x,(f.y+g.y)/2))):(h.gd(c-2,new G((f.x+g.x)/2,g.y)),h.gd(c+1,new G((f.x+g.x)/2,f.y)));h.mb(c);h.mb(c-1);b.points=h;b.Jb()}else g=b.i(c+2),Math.abs(e.x-f.x)<this.resegmentingDistance&&Math.abs(e.y-f.y)<this.resegmentingDistance&&(Ug(this,d,e,f,g,!0)||Ug(this,d,e,f,g,!1))&&(h=b.points.copy(),Ug(this,d,e,f,g,!0)?(h.gd(c-1,new G(d.x,(d.y+g.y)/2)),h.gd(c+2,new G(g.x,(d.y+g.y)/2))):(h.gd(c-1,new G((d.x+g.x)/2,d.y)),h.gd(c+2,new G((d.x+g.x)/2,g.y))),
h.mb(c+1),h.mb(c),b.points=h,b.Jb())}}else g=G.alloc(),H.Oi(d.x,d.y,f.x,f.y,e.x,e.y,g)&&g.Ae(e)<this.resegmentingDistance*this.resegmentingDistance&&(d=b.points.copy(),d.mb(c),b.points=d,b.Jb()),G.free(g)}a.Xa();this.transactionResult=this.name;a.aa("LinkReshaped",this.adornedLink,this.Xr)}this.stopTool()};
function Ug(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}
Og.prototype.reshape=function(a){var b=this.adornedLink;b.Ah();var c=this.handle.segmentIndex,d=this.Zu(this.handle);if(b.isOrthogonal)if(c===b.firstPickIndex+1)c=b.firstPickIndex+1,d===Rg?(b.M(c,b.i(c-1).x,a.y),b.M(c+1,b.i(c+2).x,a.y)):d===Sg&&(b.M(c,a.x,b.i(c-1).y),b.M(c+1,a.x,b.i(c+2).y));else if(c===b.lastPickIndex-1)c=b.lastPickIndex-1,d===Rg?(b.M(c-1,b.i(c-2).x,a.y),b.M(c,b.i(c+1).x,a.y)):d===Sg&&(b.M(c-1,a.x,b.i(c-2).y),b.M(c,a.x,b.i(c+1).y));else{d=c;var e=b.i(d),f=b.i(d-1),g=b.i(d+1);H.w(f.x,
e.x)&&H.w(e.y,g.y)?(H.w(f.x,b.i(d-2).x)&&!H.w(f.y,b.i(d-2).y)?(b.m(d,a.x,f.y),c++,d++):b.M(d-1,a.x,f.y),H.w(g.y,b.i(d+2).y)&&!H.w(g.x,b.i(d+2).x)?b.m(d+1,g.x,a.y):b.M(d+1,g.x,a.y)):H.w(f.y,e.y)&&H.w(e.x,g.x)?(H.w(f.y,b.i(d-2).y)&&!H.w(f.x,b.i(d-2).x)?(b.m(d,f.x,a.y),c++,d++):b.M(d-1,f.x,a.y),H.w(g.x,b.i(d+2).x)&&!H.w(g.y,b.i(d+2).y)?b.m(d+1,a.x,g.y):b.M(d+1,a.x,g.y)):H.w(f.x,e.x)&&H.w(e.x,g.x)?(H.w(f.x,b.i(d-2).x)&&!H.w(f.y,b.i(d-2).y)?(b.m(d,a.x,f.y),c++,d++):b.M(d-1,a.x,f.y),H.w(g.x,b.i(d+2).x)&&
!H.w(g.y,b.i(d+2).y)?b.m(d+1,a.x,g.y):b.M(d+1,a.x,g.y)):H.w(f.y,e.y)&&H.w(e.y,g.y)&&(H.w(f.y,b.i(d-2).y)&&!H.w(f.x,b.i(d-2).x)?(b.m(d,f.x,a.y),c++,d++):b.M(d-1,f.x,a.y),H.w(g.y,b.i(d+2).y)&&!H.w(g.x,b.i(d+2).x)?b.m(d+1,g.x,a.y):b.M(d+1,g.x,a.y));b.M(c,a.x,a.y)}else b.M(c,a.x,a.y),d=b.fromNode,e=b.fromPort,null!==d&&(f=d.findVisibleNode(),null!==f&&f!==d&&(d=f,e=d.port)),1===c&&b.computeSpot(!0,e).kc()&&(f=e.ma(dd,G.alloc()),d=b.getLinkPointFromPoint(d,e,f,a,!0,G.alloc()),b.M(0,d.x,d.y),G.free(f),
G.free(d)),d=b.toNode,e=b.toPort,null!==d&&(f=d.findVisibleNode(),null!==f&&f!==d&&(d=f,e=d.port)),c===b.pointsCount-2&&b.computeSpot(!1,e).kc()&&(c=e.ma(dd,G.alloc()),a=b.getLinkPointFromPoint(d,e,c,a,!1,G.alloc()),b.M(b.pointsCount-1,a.x,a.y),G.free(c),G.free(a));b.lf()};Og.prototype.computeReshape=function(a){var b=this.adornedLink,c=this.handle.segmentIndex;switch(this.Zu(this.handle)){case Tg:return a;case Rg:return new G(b.i(c).x,a.y);case Sg:return new G(a.x,b.i(c).y);default:case Pg:return b.i(c)}};
pa.Object.defineProperties(Og.prototype,{handleArchetype:{get:function(){return this.u},set:function(a){this.u=a}},midHandleArchetype:{get:function(){return this.K},set:function(a){this.K=a}},handle:{get:function(){return this.l},set:function(a){if(null!==a&&!(a.part instanceof pf))throw Error("new handle is not in an Adornment: "+a);this.l=a}},adornedLink:{get:function(){return this.Dt}},
resegmentingDistance:{get:function(){return this.ba},set:function(a){this.ba=a}},originalPoint:{get:function(){return this.ql}},originalPoints:{get:function(){return this.Xr}}});Og.prototype.setReshapingBehavior=Og.prototype.um;Og.prototype.getReshapingBehavior=Og.prototype.Zu;var Pg=new D(Og,"None",0),Sg=new D(Og,"Horizontal",1),Rg=new D(Og,"Vertical",2),Tg=new D(Og,"All",3);Og.className="LinkReshapingTool";
Og.None=Pg;Og.Horizontal=Sg;Og.Vertical=Rg;Og.All=Tg;Ta("linkReshapingTool",function(){return this.findTool("LinkReshaping")},function(a){vf(this,"LinkReshaping",a,this.mouseDownTools)});
function Vg(){kf.call(this);this.name="Resizing";this.Of=(new K(1,1)).freeze();this.Nf=(new K(9999,9999)).freeze();this.Ag=(new K(NaN,NaN)).freeze();this.K=!1;this.Zd=null;var a=new W;a.alignmentFocus=dd;a.figure="Rectangle";a.desiredSize=hc;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.u=a;this.l=null;this.ql=new G;this.Dw=new K;this.Fo=new G;this.Ut=new K(0,0);this.Tt=new K(Infinity,Infinity);this.St=new K(1,1);this.Aw=!0}oa(Vg,kf);
Vg.prototype.updateAdornments=function(a){if(!(null===a||a instanceof S)){if(a.isSelected&&!this.diagram.isReadOnly){var b=a.resizeObject,c=a.Xj(this.name);if(null!==b&&a.canResize()&&a.actualBounds.s()&&a.isVisible()&&b.actualBounds.s()&&b.rf()){if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){b=b.Hi();ng(a)&&this.updateResizeHandles(c,b);a.nh(this.name,c);return}}}a.sf(this.name)}};
Vg.prototype.makeAdornment=function(a){var b=a.part.resizeAdornmentTemplate;if(null===b){b=new pf;b.type=X.Spot;b.locationSpot=dd;var c=new Wg;c.isPanelMain=!0;b.add(c);b.add(this.makeHandle(a,Tc));b.add(this.makeHandle(a,Vc));b.add(this.makeHandle(a,hd));b.add(this.makeHandle(a,fd));b.add(this.makeHandle(a,Jd));b.add(this.makeHandle(a,Sd));b.add(this.makeHandle(a,Td));b.add(this.makeHandle(a,Rd))}else if(Xg(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};
Vg.prototype.makeHandle=function(a,b){a=this.handleArchetype;if(null===a)return null;a=a.copy();a.alignment=b;return a};
Vg.prototype.updateResizeHandles=function(a,b){if(null!==a)if(!a.alignment.Kb()&&("pointer"===a.cursor||0<a.cursor.indexOf("resize")))a:{var c=a.alignment;c.kc()&&(c=dd);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)};Vg.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};
Vg.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.ql.set(this.adornedObject.ma(this.handle.alignment.mv())),this.Fo.set(this.adornedObject.part.location),this.Dw.set(this.adornedObject.desiredSize),this.St=this.computeCellSize(),this.Ut=this.computeMinSize(),this.Tt=this.computeMaxSize(),a.isMouseCaptured=
!0,this.Aw=a.animationManager.isEnabled,a.animationManager.isEnabled=!1,this.Aa(this.name),this.isActive=!0))};Vg.prototype.doDeactivate=function(){var a=this.diagram;this.ug();this.Zd=this.handle=null;this.isActive=a.isMouseCaptured=!1;a.animationManager.isEnabled=this.Aw};Vg.prototype.doCancel=function(){null!==this.adornedObject&&(this.adornedObject.desiredSize=this.originalDesiredSize,this.adornedObject.part.location=this.originalLocation);this.stopTool()};
Vg.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive){var b=this.Ut,c=this.Tt,d=this.St,e=this.adornedObject.Ts(a.lastInput.documentPoint,G.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);a.fd();G.free(e)}};
Vg.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.Ut,c=this.Tt,d=this.St,e=this.adornedObject.Ts(a.lastInput.documentPoint,G.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);G.free(e);a.Xa();this.transactionResult=this.name;a.aa("PartResized",this.adornedObject,this.originalDesiredSize)}this.stopTool()};
Vg.prototype.resize=function(a){var b=this.diagram,c=this.adornedObject,d=c.part;c.desiredSize=a.size;d.ac();a=this.adornedObject.ma(this.handle.alignment.mv());d instanceof hg?(c=new E,c.add(d),b.moveParts(c,this.ql.copy().Wd(a),!0)):d.location=d.location.copy().Wd(a).add(this.ql)};
Vg.prototype.computeResize=function(a,b,c,d,e,f){b.kc()&&(b=dd);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=G.alloc();H.Qp(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)));G.free(p);return a};Vg.prototype.computeReshape=function(){var a=Yg;this.adornedObject instanceof W&&(a=Zg(this.adornedObject));return!(a===$g||this.diagram.lastInput.shift)};
Vg.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};Vg.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};
Vg.prototype.computeCellSize=function(){var a=new K(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};
pa.Object.defineProperties(Vg.prototype,{handleArchetype:{get:function(){return this.u},set:function(a){this.u=a}},handle:{get:function(){return this.l},set:function(a){if(null!==a&&!(a.part instanceof pf))throw Error("new handle is not in an Adornment: "+a);this.l=a}},adornedObject:{get:function(){return this.Zd},set:function(a){if(null!==a&&a.part instanceof pf)throw Error("new handle must not be in an Adornment: "+
a);this.Zd=a}},minSize:{get:function(){return this.Of},set:function(a){if(!this.Of.A(a)){var b=a.width;isNaN(b)&&(b=0);a=a.height;isNaN(a)&&(a=0);this.Of.h(b,a)}}},maxSize:{get:function(){return this.Nf},set:function(a){if(!this.Nf.A(a)){var b=a.width;isNaN(b)&&(b=Infinity);a=a.height;isNaN(a)&&(a=Infinity);this.Nf.h(b,a)}}},cellSize:{get:function(){return this.Ag},set:function(a){this.Ag.A(a)||this.Ag.assign(a)}},
isGridSnapEnabled:{get:function(){return this.K},set:function(a){this.K=a}},originalDesiredSize:{get:function(){return this.Dw}},originalLocation:{get:function(){return this.Fo}}});Vg.className="ResizingTool";Ta("resizingTool",function(){return this.findTool("Resizing")},function(a){vf(this,"Resizing",a,this.mouseDownTools)});
function ah(){kf.call(this);this.name="Rotating";this.Ma=45;this.La=2;this.Fo=new G;this.Zd=null;var a=new W;a.figure="Ellipse";a.desiredSize=ic;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.u=a;this.l=null;this.Cw=0;this.nu=new G(NaN,NaN);this.K=0;this.ba=50}oa(ah,kf);
ah.prototype.updateAdornments=function(a){if(null!==a){if(a.xh()){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.s()&&a.isVisible()&&b.actualBounds.s()&&b.rf())){var c=a.Xj(this.name);if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){c.angle=b.Hi();null===c.placeholder&&(c.location=this.computeAdornmentLocation(b));a.nh(this.name,c);return}}a.sf(this.name)}};
ah.prototype.makeAdornment=function(a){var b=a.part.rotateAdornmentTemplate;if(null===b){b=new pf;b.type=X.Position;b.locationSpot=dd;var c=this.handleArchetype;null!==c&&b.add(c.copy())}else if(Xg(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};ah.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};
ah.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.Cw=this.adornedObject.angle,this.nu=this.computeRotationPoint(this.adornedObject),this.Fo=this.adornedObject.part.location.copy(),a.isMouseCaptured=!0,a.delaysLayout=!0,this.Aa(this.name),this.isActive=!0)};
ah.prototype.computeRotationPoint=function(a){var b=a.part,c=b.locationObject;return b.rotationSpot.gb()?a.ma(b.rotationSpot):a===b||a===c?c.ma(b.locationSpot):a.ma(dd)};
ah.prototype.computeAdornmentLocation=function(a){var b=this.rotationPoint;b.s()||(b=this.computeRotationPoint(a));b=a.Ts(b);var c=this.handleAngle;0>c?c+=360:360<=c&&(c-=360);c=Math.round(45*Math.round(c/45));var d=this.handleDistance;0===c?b.x=a.naturalBounds.width+d:45===c?(b.x=a.naturalBounds.width+d,b.y=a.naturalBounds.height+d):90===c?b.y=a.naturalBounds.height+d:135===c?(b.x=-d,b.y=a.naturalBounds.height+d):180===c?b.x=-d:225===c?(b.x=-d,b.y=-d):270===c?b.y=-d:315===c&&(b.x=a.naturalBounds.width+
d,b.y=-d);return a.ma(b)};ah.prototype.doDeactivate=function(){var a=this.diagram;this.ug();this.Zd=this.handle=null;this.nu=new G(NaN,NaN);this.isActive=a.isMouseCaptured=!1};ah.prototype.doCancel=function(){this.diagram.delaysLayout=!1;this.rotate(this.originalAngle);this.stopTool()};ah.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeRotate(a.lastInput.documentPoint),this.rotate(a))};
ah.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){a.delaysLayout=!1;var b=this.computeRotate(a.lastInput.documentPoint);this.rotate(b);a.Xa();this.transactionResult=this.name;a.aa("PartRotated",this.adornedObject,this.originalAngle)}this.stopTool()};ah.prototype.rotate=function(a){var b=this.adornedObject;if(null!==b){b.angle=a;b=b.part;b.ac();var c=b.locationObject,d=b.rotateObject;if(c===d||c.pg(d))c=this.Fo.copy(),b.location=c.Wd(this.rotationPoint).rotate(a-this.originalAngle).add(this.rotationPoint)}};
ah.prototype.computeRotate=function(a){a=this.rotationPoint.Wa(a)-this.handleAngle;var b=this.adornedObject.panel;null!==b&&(a-=b.Hi());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};
pa.Object.defineProperties(ah.prototype,{handleArchetype:{get:function(){return this.u},set:function(a){this.u=a}},handle:{get:function(){return this.l},set:function(a){if(null!==a&&!(a.part instanceof pf))throw Error("new handle is not in an Adornment: "+a);this.l=a}},adornedObject:{get:function(){return this.Zd},set:function(a){if(null!==a&&a.part instanceof pf)throw Error("new handle must not be in an Adornment: "+
a);this.Zd=a}},snapAngleMultiple:{get:function(){return this.Ma},set:function(a){this.Ma=a}},snapAngleEpsilon:{get:function(){return this.La},set:function(a){this.La=a}},originalAngle:{get:function(){return this.Cw}},rotationPoint:{get:function(){return this.nu}},handleAngle:{get:function(){return this.K},set:function(a){this.K=a}},handleDistance:{
get:function(){return this.ba},set:function(a){this.ba=a}}});ah.className="RotatingTool";Ta("rotatingTool",function(){return this.findTool("Rotating")},function(a){vf(this,"Rotating",a,this.mouseDownTools)});function bh(){kf.call(this);this.name="ClickSelecting"}oa(bh,kf);bh.prototype.canStart=function(){return!this.isEnabled||this.isBeyondDragSize()?!1:!0};
bh.prototype.doMouseUp=function(){this.isActive&&(this.standardMouseSelect(),!this.standardMouseClick()&&this.diagram.lastInput.isTouchEvent&&this.diagram.toolManager.doToolTip());this.stopTool()};bh.className="ClickSelectingTool";function ch(){kf.call(this);this.name="Action";this.rk=null}oa(ch,kf);
ch.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram,b=a.lastInput,c=a.Rb(b.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a});if(null!==c){if(!c.isActionable)return!1;this.rk=c;a.Gk=a.Rb(b.documentPoint,null,null);return!0}return!1};ch.prototype.doMouseDown=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.rk;null!==b&&(a.targetObject=b,null!==b.actionDown&&b.actionDown(a,b))}else this.canStart()&&this.doActivate()};
ch.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.rk;null!==b&&(a.targetObject=b,null!==b.actionMove&&b.actionMove(a,b))}};ch.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.rk;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()};
ch.prototype.doCancel=function(){var a=this.diagram.lastInput,b=this.rk;null!==b&&(a.targetObject=b,null!==b.actionCancel&&b.actionCancel(a,b),this.stopTool())};ch.prototype.doStop=function(){this.rk=null};ch.className="ActionTool";function dh(){kf.call(this);this.name="ClickCreating";this.Yi=null;this.u=!0;this.l=!1;this.uw=new G(0,0)}oa(dh,kf);
dh.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.uw=a.lastInput.viewPoint.copy()),2!==a.lastInput.clickCount||this.isBeyondDragSize(this.uw))return!1}else if(1!==a.lastInput.clickCount)return!1;return a.currentTool!==this&&null!==a.Yl(a.lastInput.documentPoint,!0)?!1:!0};
dh.prototype.doMouseUp=function(){var a=this.diagram;this.isActive&&this.insertPart(a.lastInput.documentPoint);this.stopTool()};
dh.prototype.insertPart=function(a){var b=this.diagram,c=this.archetypeNodeData;if(null===c)return null;this.Aa(this.name);var d=null;c instanceof T?c.Lb()&&(Xg(c),d=c.copy(),null!==d&&b.add(d)):null!==c&&(c=b.model.copyNodeData(c),Ca(c)&&(b.model.jf(c),d=b.vc(c)));null!==d&&(c=G.allocAt(a.x,a.y),this.isGridSnapEnabled&&eh(this.diagram,d,a,c),d.location=c,b.allowSelect&&b.select(d),G.free(c));b.Xa();this.transactionResult=this.name;b.aa("PartCreated",d);this.ug();return d};
pa.Object.defineProperties(dh.prototype,{archetypeNodeData:{get:function(){return this.Yi},set:function(a){this.Yi=a}},isDoubleClick:{get:function(){return this.u},set:function(a){this.u=a}},isGridSnapEnabled:{get:function(){return this.l},set:function(a){this.l=a}}});dh.className="ClickCreatingTool";
function fh(){kf.call(this);this.name="DragSelecting";this.Nk=175;this.u=!1;var a=new T;a.layerName="Tool";a.selectable=!1;var b=new W;b.name="SHAPE";b.figure="Rectangle";b.fill=null;b.stroke="magenta";a.add(b);this.l=a}oa(fh,kf);
fh.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.Yl(b.documentPoint,!0))?!1:!0};fh.prototype.doActivate=function(){var a=this.diagram;this.isActive=!0;a.isMouseCaptured=!0;a.skipsUndoManager=!0;a.add(this.box);this.doMouseMove()};
fh.prototype.doDeactivate=function(){var a=this.diagram;a.uf();a.remove(this.box);a.skipsUndoManager=!1;this.isActive=a.isMouseCaptured=!1};fh.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive&&null!==this.box){var b=this.computeBoxBounds(),c=this.box.$a("SHAPE");null===c&&(c=this.box.zb());var d=K.alloc().h(b.width,b.height);b=G.alloc().h(b.x,b.y);c.desiredSize=d;this.box.position=b;K.free(d);G.free(b);(a.allowHorizontalScroll||a.allowVerticalScroll)&&a.Ks(a.lastInput.viewPoint)}};
fh.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram;a.remove(this.box);try{a.currentCursor="wait",a.aa("ChangingSelection",a.selection),this.selectInRect(this.computeBoxBounds()),a.aa("ChangedSelection",a.selection)}finally{a.currentCursor=""}}this.stopTool()};fh.prototype.computeBoxBounds=function(){var a=this.diagram;return new L(a.firstInput.documentPoint,a.lastInput.documentPoint)};
fh.prototype.selectInRect=function(a){var b=this.diagram,c=b.lastInput;a=b.hx(a,this.isPartialInclusion);if(ib?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)}};pa.Object.defineProperties(fh.prototype,{delay:{get:function(){return this.Nk},set:function(a){this.Nk=a}},isPartialInclusion:{get:function(){return this.u},set:function(a){this.u=a}},box:{get:function(){return this.l},set:function(a){this.l=a}}});fh.className="DragSelectingTool";
function gh(){kf.call(this);this.name="Panning";this.iu=new G;this.Xx=new G;this.zg=!1;var a=this;this.Gw=function(){w.document.removeEventListener("scroll",a.Gw,!1);a.stopTool()}}oa(gh,kf);gh.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};
gh.prototype.doActivate=function(){var a=this.diagram;this.zg?(a.lastInput.bubbles=!0,w.document.addEventListener("scroll",this.Gw,!1)):(a.currentCursor="move",a.isMouseCaptured=!0,this.iu.assign(a.position));this.isActive=!0};gh.prototype.doDeactivate=function(){var a=this.diagram;a.currentCursor="";this.isActive=a.isMouseCaptured=!1};gh.prototype.doCancel=function(){var a=this.diagram;a.position=this.iu;a.isMouseCaptured=!1;this.stopTool()};gh.prototype.doMouseMove=function(){this.move()};
gh.prototype.doMouseUp=function(){this.move();this.stopTool()};gh.prototype.move=function(){var a=this.diagram;if(this.isActive&&a)if(this.zg)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.Xx.h(e,c)}};
pa.Object.defineProperties(gh.prototype,{bubbles:{get:function(){return this.zg},set:function(a){this.zg=a}},originalPosition:{get:function(){return this.iu}}});gh.className="PanningTool";Ta("clickCreatingTool",function(){return this.findTool("ClickCreating")},function(a){vf(this,"ClickCreating",a,this.mouseUpTools)});Ta("clickSelectingTool",function(){return this.findTool("ClickSelecting")},function(a){vf(this,"ClickSelecting",a,this.mouseUpTools)});
Ta("panningTool",function(){return this.findTool("Panning")},function(a){vf(this,"Panning",a,this.mouseMoveTools)});Ta("dragSelectingTool",function(){return this.findTool("DragSelecting")},function(a){vf(this,"DragSelecting",a,this.mouseMoveTools)});Ta("actionTool",function(){return this.findTool("Action")},function(a){vf(this,"Action",a,this.mouseDownTools)});function uf(){this.ba=this.K=this.l=this.u=null}
pa.Object.defineProperties(uf.prototype,{mainElement:{get:function(){return this.K},set:function(a){this.K=a}},show:{get:function(){return this.u},set:function(a){this.u!==a&&(this.u=a)}},hide:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a)}},valueFunction:{get:function(){return this.ba},set:function(a){this.ba=a}}});uf.className="HTMLInfo";
function hh(a,b,c){this.text=a;this.Vw=b;this.visible=c}hh.className="ContextMenuButtonInfo";function ih(){kf.call(this);this.name="ContextMenu";this.u=this.Jt=this.l=null;this.zw=new G;this.Kt=null;var a=this;this.xu=function(){a.stopTool()}}oa(ih,kf);
function jh(a){var b=new uf;b.show=function(a,b,c){c.showDefaultContextMenu()};b.hide=function(a,b){b.hideDefaultContextMenu()};kh=b;a.xu=function(){a.stopTool()};b=va("div");var c=va("div");b.style.cssText="top: 0px;z-index:10002;position: fixed;display: none;text-align: center;left: 25%;width: 50%;background-color: #F5F5F5;padding: 16px;border: 16px solid #444;border-radius: 10px;margin-top: 10px";c.style.cssText="z-index:10001;position: fixed;display: none;top: 0;left: 0;width: 100%;height: 100%;background-color: black;opacity: 0.8;";
var d=va("style");w.document.getElementsByTagName("head")[0].appendChild(d);d.sheet.insertRule(".goCXul { list-style: none; }",0);d.sheet.insertRule(".goCXli {font:700 1.5em Helvetica, Arial, sans-serif;position: relative;min-width: 60px; }",0);d.sheet.insertRule(".goCXa {color: #444;display: inline-block;padding: 4px;text-decoration: none;margin: 2px;border: 1px solid gray;border-radius: 10px; }",0);b.addEventListener("contextmenu",lh,!1);b.addEventListener("selectstart",lh,!1);c.addEventListener("contextmenu",
lh,!1);b.className="goCXforeground";c.className="goCXbackground";w.document.body&&(w.document.body.appendChild(b),w.document.body.appendChild(c));mh=b;nh=c;oh=!0}function lh(a){a.preventDefault();return!1}ih.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};ih.prototype.doStart=function(){this.zw.set(this.diagram.firstInput.documentPoint)};
ih.prototype.doStop=function(){this.hideContextMenu();this.currentObject=null};ih.prototype.findObjectWithContextMenu=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.lastInput,d=null;a instanceof P||(a instanceof Y?d=a:d=b.Rb(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};
ih.prototype.doActivate=function(){};ih.prototype.doMouseDown=function(){kf.prototype.doMouseDown.call(this);if(this.isActive&&this.currentContextMenu instanceof pf){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doMouseDown(),a.doDeactivate())}this.diagram.toolManager.mouseDownTools.contains(this)&&ph(this)};
ih.prototype.doMouseUp=function(){if(this.isActive&&this.currentContextMenu instanceof pf){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doCancel(),a.doDeactivate())}ph(this)};
function ph(a){var b=a.diagram;if(a.isActive){var c=a.currentContextMenu;if(null!==c){if(!(c instanceof uf)){var d=b.Rb(b.lastInput.documentPoint,null,null);null!==d&&d.pg(c)&&a.standardMouseClick(null,null)}a.stopTool();a.canStart()&&(b.currentTool=a,a.doMouseUp())}}else a.canStart()&&(qh(a,!0),a.isActive||a.stopTool())}
function qh(a,b,c){void 0===c&&(c=null);b&&a.standardMouseSelect();if(!a.standardMouseClick())if(a.isActive=!0,b=kh,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)}ih.prototype.doMouseMove=function(){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.doMouseMove();this.isActive&&this.diagram.toolManager.doMouseMove()};
ih.prototype.showContextMenu=function(a,b){var c=this.diagram;a!==this.currentContextMenu&&this.hideContextMenu();if(a instanceof pf){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.ac();this.positionContextMenu(a,b)}else a instanceof uf&&a.show(b,c,this);this.currentContextMenu=a};
ih.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}};
ih.prototype.hideContextMenu=function(){var a=this.diagram,b=this.currentContextMenu;null!==b&&(b instanceof pf?(a.remove(b),null!==this.Jt&&this.Jt.sf(b.category),b.data=null,b.adornedObject=null):b instanceof uf&&(null!==b.hide?b.hide(a,this):null!==b.mainElement&&(b.mainElement.style.display="none")),this.currentContextMenu=null,this.standardMouseOver())};
function rh(){var a=new E;a.add(new hh("Copy",function(a){a.commandHandler.copySelection()},function(a){return a.commandHandler.canCopySelection()}));a.add(new hh("Cut",function(a){a.commandHandler.cutSelection()},function(a){return a.commandHandler.canCutSelection()}));a.add(new hh("Delete",function(a){a.commandHandler.deleteSelection()},function(a){return a.commandHandler.canDeleteSelection()}));a.add(new hh("Paste",function(a){a.commandHandler.pasteSelection(a.lastInput.documentPoint)},function(a){return a.commandHandler.canPasteSelection()}));
a.add(new hh("Select All",function(a){a.commandHandler.selectAll()},function(a){return a.commandHandler.canSelectAll()}));a.add(new hh("Undo",function(a){a.commandHandler.undo()},function(a){return a.commandHandler.canUndo()}));a.add(new hh("Redo",function(a){a.commandHandler.redo()},function(a){return a.commandHandler.canRedo()}));a.add(new hh("Scroll To Part",function(a){a.commandHandler.scrollToPart()},function(a){return a.commandHandler.canScrollToPart()}));a.add(new hh("Zoom To Fit",function(a){a.commandHandler.zoomToFit()},
function(a){return a.commandHandler.canZoomToFit()}));a.add(new hh("Reset Zoom",function(a){a.commandHandler.resetZoom()},function(a){return a.commandHandler.canResetZoom()}));a.add(new hh("Group Selection",function(a){a.commandHandler.groupSelection()},function(a){return a.commandHandler.canGroupSelection()}));a.add(new hh("Ungroup Selection",function(a){a.commandHandler.ungroupSelection()},function(a){return a.commandHandler.canUngroupSelection()}));a.add(new hh("Edit Text",function(a){a.commandHandler.editTextBlock()},
function(a){return a.commandHandler.canEditTextBlock()}));return a}
ih.prototype.showDefaultContextMenu=function(){var a=this.diagram;null===this.Kt&&(this.Kt=rh());mh.innerHTML="";nh.addEventListener("click",this.xu,!1);var b=this,c=va("ul");c.className="goCXul";mh.appendChild(c);c.innerHTML="";for(var d=this.Kt.iterator;d.next();){var e=d.value,f=e.visible;if("function"===typeof e.Vw&&("function"!==typeof f||f(a))){f=va("li");f.className="goCXli";var g=va("a");g.className="goCXa";g.href="#";g.Px=e.Vw;g.addEventListener("click",function(c){this.Px(a);b.stopTool();
c.preventDefault();return!1},!1);g.textContent=e.text;f.appendChild(g);c.appendChild(f)}}mh.style.display="block";nh.style.display="block"};ih.prototype.hideDefaultContextMenu=function(){null!==this.currentContextMenu&&this.currentContextMenu===kh&&(mh.style.display="none",nh.style.display="none",nh.removeEventListener("click",this.xu,!1),this.currentContextMenu=null)};
pa.Object.defineProperties(ih.prototype,{currentContextMenu:{get:function(){return this.l},set:function(a){this.l=a;this.Jt=a instanceof pf?a.adornedPart:null}},defaultTouchContextMenu:{get:function(){!1===oh&&null===kh&&sh&&jh(this);return kh},set:function(a){null===a&&(oh=!0);kh=a}},currentObject:{get:function(){return this.u},set:function(a){this.u=a}},mouseDownPoint:{get:function(){return this.zw}}});
var kh=null,oh=!1,nh=null,mh=null;ih.className="ContextMenuTool";Ta("contextMenuTool",function(){return this.findTool("ContextMenu")},function(a){vf(this,"ContextMenu",a,this.mouseUpTools)});function th(){kf.call(this);this.name="TextEditing";this.hh=new uh;this.Ma=null;this.La=vh;this.ui=null;this.la=wh;this.K=1;this.ba=!0;this.u=null;this.l=new uf;this.Lt=null;xh(this,this.l)}oa(th,kf);
function xh(a,b){if(sh){var c=va("textarea");a.Lt=c;c.addEventListener("input",function(){if(null!==a.textBlock){var b=a.qx(this.value);this.style.width=20+b.measuredBounds.width*this.Qz+"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(yh)):9===c?(a.acceptText(zh),b.preventDefault()):27===c&&(a.doCancel(),null!==a.diagram&&a.diagram.doFocus())}},!1);c.addEventListener("focus",
function(){if(null!==a.currentTextEditor&&a.state!==wh){var b=a.Lt;a.la===Ah&&(a.la=Bh);"function"===typeof b.select&&a.selectsTextOnActivate&&(b.select(),b.setSelectionRange(0,9999))}},!1);c.addEventListener("blur",function(){if(null!==a.currentTextEditor&&a.state!==wh){var b=a.Lt;"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 uh&&f instanceof th)if(f.state===Ch)c.style.border="3px solid red",c.focus();else{var d=a.ma(dd),e=b.position,k=b.scale,l=a.Be()*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.Qz=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)}}}
th.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(null===a||a.isReadOnly||!a.lastInput.left||this.isBeyondDragSize())return!1;var b=a.Rb(a.lastInput.documentPoint);if(!(null!==b&&b instanceof uh&&b.editable&&b.part.canEdit()))return!1;b=b.part;return null===b||this.starting===vh&&!b.isSelected||this.starting===Gh&&2>a.lastInput.clickCount?!1:!0};th.prototype.doStart=function(){this.isActive||null===this.textBlock||this.doActivate()};
th.prototype.doActivate=function(){if(!this.isActive){var a=this.diagram;if(null!==a){var b=this.textBlock;null===b&&(b=a.Rb(a.lastInput.documentPoint));if(null!==b&&b instanceof uh&&(this.textBlock=b,null!==b.part)){this.isActive=!0;this.la=Ah;var c=this.defaultTextEditor;null!==b.textEditor&&(c=b.textEditor);this.hh=this.textBlock.copy();var d=new L(this.textBlock.ma(Tc),this.textBlock.ma(hd));a.Bv(d);c.show(b,a,this);this.currentTextEditor=c}}}};th.prototype.doCancel=function(){this.stopTool()};
th.prototype.doMouseUp=function(){!this.isActive&&this.canStart()&&this.doActivate()};th.prototype.doMouseDown=function(){this.isActive&&this.acceptText(Hh)};
th.prototype.acceptText=function(a){switch(a){case Hh:if(this.la===Ih)this.currentTextEditor instanceof HTMLElement&&this.currentTextEditor.focus();else if(this.la===Ah||this.la===Ch||this.la===Bh)this.la=Jh,Kh(this);break;case Lh:case yh:case zh:if(yh!==a||!0!==this.textBlock.isMultiline)if(this.la===Ah||this.la===Ch||this.la===Bh)this.la=Jh,Kh(this)}};
function Kh(a){var b=a.textBlock,c=a.diagram,d=a.currentTextEditor;if(null!==b&&null!==d){var e=b.text,f="";null!==d.valueFunction&&(f=d.valueFunction());a.isValidText(b,e,f)?(a.Aa(a.name),a.la=Ih,a.transactionResult=a.name,b.text=f,null!==b.textEdited&&b.textEdited(b,e,f),null!==c&&c.aa("TextEdited",b,e),a.ug(),a.stopTool(),null!==c&&c.doFocus()):(a.la=Ch,null!==b.errorFunction&&b.errorFunction(a,e,f),d.show(b,c,a))}}
th.prototype.doDeactivate=function(){var a=this.diagram;null!==a&&(this.la=wh,this.textBlock=null,null!==this.currentTextEditor&&this.currentTextEditor.hide(a,this),this.isActive=!1)};th.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};th.prototype.qx=function(a){var b=this.hh;b.text=a;b.measure(this.textBlock.fl,Infinity);return b};
pa.Object.defineProperties(th.prototype,{textBlock:{get:function(){return this.Ma},set:function(a){this.Ma=a}},currentTextEditor:{get:function(){return this.u},set:function(a){this.u=a}},defaultTextEditor:{get:function(){return this.l},set:function(a){this.l=a}},starting:{get:function(){return this.La},set:function(a){this.La=a}},textValidation:{get:function(){return this.ui},
set:function(a){this.ui=a}},minimumEditorScale:{get:function(){return this.K},set:function(a){this.K=a}},selectsTextOnActivate:{get:function(){return this.ba},set:function(a){this.ba=a}},state:{get:function(){return this.la},set:function(a){this.la!==a&&(this.la=a)}}});th.prototype.measureTemporaryTextBlock=th.prototype.qx;
var Lh=new D(th,"LostFocus",0),Hh=new D(th,"MouseDown",1),zh=new D(th,"Tab",2),yh=new D(th,"Enter",3),Mh=new D(th,"SingleClick",0),vh=new D(th,"SingleClickSelected",1),Gh=new D(th,"DoubleClick",2),wh=new D(th,"StateNone",0),Ah=new D(th,"StateActive",1),Bh=new D(th,"StateEditing",2),Jh=new D(th,"StateValidating",3),Ch=new D(th,"StateInvalid",4),Ih=new D(th,"StateValidated",5);th.className="TextEditingTool";th.LostFocus=Lh;th.MouseDown=Hh;th.Tab=zh;th.Enter=yh;th.SingleClick=Mh;
th.SingleClickSelected=vh;th.DoubleClick=Gh;th.StateNone=wh;th.StateActive=Ah;th.StateEditing=Bh;th.StateValidating=Jh;th.StateInvalid=Ch;th.StateValidated=Ih;Ta("textEditingTool",function(){return this.findTool("TextEditing")},function(a){vf(this,"TextEditing",a,this.mouseUpTools)});
function Nh(){this.mw=Oh;this.F=lf;this.on=this.pn=null;this.Xi=this.qn=this.rn=0;this.xk=this.We=this.rb=this.Br=this.Og=!1;this.Pg=this.Dc=!0;this.Rq=this.Qq=this.lw=null;this.kw=0;this.Tq=new Lb;this.Rt=600;this.Rx=new G(0,0);this.iw=this.hw=this.Jw=!1;this.wk=new F;this.vj=new Lb;this.er=new F;this.Sq=null}Nh.prototype.hb=function(a){this.F=a};function Oh(a,b,c,d){a/=d/2;return 1>a?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b}Nh.prototype.canStart=function(){return!0};t=Nh.prototype;
t.Pi=function(a,b){this.Dc&&(void 0!==b&&(this.Sq=b),this.Pg||this.F.Mi)&&(this.wk.add(a),this.canStart(a)&&(this.Og&&this.vd(),this.We=this.rb=!0))};t.Cz=function(a,b){this.Dc&&(void 0===b&&(this.Sq=b),this.Pg||this.F.Mi)&&(this.wk.add(a),this.canStart(a)&&(this.Og&&this.vd(),this.rb=!0))};
function Ph(a){if(a.Dc&&(a.wk.clear(),a.rb))if(!a.xk)a.rb=!1,a.We=!1;else if(0===a.Xi){var b=+new Date;a.Xi=b;w.requestAnimationFrame(function(){if(!1!==a.rb&&!a.Og&&a.Xi===b){var c=a.F;c.Ce("temporaryPixelRatio")&&(c.ue=1);Qh(c);a.rb=!1;a.We=!1;c.aa("AnimationStarting");Rh(a,b)}})}}function Sh(a,b,c){b=b.position;b instanceof G&&!b.s()&&a.wk.contains("Expand SubGraph")&&b.assign(c.position)}
t.jg=function(a,b,c,d,e){if(!(!this.rb||"position"===b&&c.A(d)||a instanceof T&&!a.isAnimated)){if(this.wk.contains("Remove")&&a instanceof T&&a.Lb()){var f=a.diagram;a=a.copy();f.add(a);this.er.add(a);f={angle:0};var g={angle:500};Sh(this,f,g);this.vj.add(a,new Th(f,g,e))}f=this.vj;if(f.contains(a)){g=f.J(a);f=g.start;var h=g.end;void 0===f[b]&&(f[b]=Uh(c));g.Is&&void 0!==h[b]?g.Ms[b]=Uh(d):(e||(g.Ms[b]=Uh(d)),h[b]=Uh(d))}else g={},h={},g[b]=Uh(c),h[b]=Uh(d),Sh(this,g,h),g=new Th(g,h,e),f.add(a,
g);e&&0===b.indexOf("position:")&&a instanceof T&&(g.Ms.location=Uh(a.location));this.xk=!0}};function Uh(a){return a instanceof G?a.copy():a instanceof K?a.copy():a}function Vh(a,b){if(!a.Og)return!1;a=a.vj.J(b);return null!==a&&a.sv}
function Rh(a,b){function c(){if(!1!==e.Og&&e.Xi===b){var a=+new Date,f=a>r?l:a-q;Wh(e);Xh(e,d,p,g,f,l);e.Qq&&e.Qq();og(d);Yh(e);a>r?Zh(e):w.requestAnimationFrame(c)}}var d=a.F;if(null!==d){var e=a,f=a.Sq||{},g=f.Yz||a.mw,h=f.bA||null,k=f.cA||null,l=f.duration||a.Rt,m=a.Rx;for(f=a.vj.iterator;f.next();){var n=f.value.start.position;n instanceof G&&(n.s()||n.assign(m))}a.lw=g;a.Qq=h;a.Rq=k;a.kw=l;a.Tq=a.vj;var p=a.Tq;for(f=p.iterator;f.next();)h=f.value.end,h["position:placeholder"]&&(k=f.key.findVisibleNode(),
k instanceof hg&&null!==k.placeholder&&(m=k.placeholder,k=m.ma(Tc),m=m.padding,k.x+=m.left,k.y+=m.top,h["position:placeholder"]=k));a.Og=!0;Wh(a);Xh(a,d,p,g,0,l);og(a.F,!0);Yh(a);var q=+new Date,r=q+l;e.Xi===b&&w.requestAnimationFrame(function(){c()})}}function Wh(a){if(!a.Br){var b=a.F;a.Jw=b.skipsUndoManager;a.hw=b.skipsModelSourceBindings;a.iw=b.Si;b.skipsUndoManager=!0;b.skipsModelSourceBindings=!0;b.Si=!0;a.Br=!0}}
function Yh(a){var b=a.F;b.skipsUndoManager=a.Jw;b.skipsModelSourceBindings=a.hw;b.Si=a.iw;a.Br=!1}function Xh(a,b,c,d,e,f){for(c=c.iterator;c.next();){var g=c.key,h=c.value,k=h.start;h=h.end;for(var l in h)if(("position"!==l||!h["position:placeholder"]&&!h["position:node"])&&void 0!==$h[l])$h[l](g,k[l],h[l],d,e,f)}d=b.ev;b.ev=!0;l=a.mw;0!==a.rn&&0!==a.qn&&(c=a.rn,b.Ca=l(e,c,a.qn-c,f));null!==a.pn&&null!==a.on&&(c=a.pn,a=a.on,b.sa=new G(l(e,c.x,a.x-c.x,f),l(e,c.y,a.y-c.y,f)));b.ev=d}
t.vd=function(){!0===this.rb&&(this.We=this.rb=!1,this.Xi=0,this.xk&&this.F.cc());this.Og&&this.Dc&&Zh(this)};
function Zh(a){a.Og=!1;a.xk=!1;Wh(a);for(var b=a.F,c=a.lw,d=a.kw,e=a.Tq,f=a.er.iterator;f.next();)b.remove(f.value);for(e=e.iterator;e.next();){f=e.key;var g=e.value,h=g.start,k=g.end,l=g.Ms,m;for(m in k)if(void 0!==$h[m]){var n=m;!g.Is||"position:node"!==n&&"position:placeholder"!==n||(n="position");$h[n](f,h[m],void 0!==l[m]?l[m]:g.Is?h[m]:k[m],c,d,d)}g.Is&&void 0!==l.location&&f instanceof T&&(f.location=l.location);g.sv&&f instanceof T&&f.Mb(!1)}for(c=a.F.links;c.next();)d=c.value,null!==d.ul&&
(d.points=d.ul,d.ul=null);b.dt.clear();Tf(b,!1);b.Xa();b.R();b.fd();ai(b);Yh(a);a.Rq&&a.Rq();a.Xi=0;a.Tq=new Lb;a.Rq=null;a.Qq=null;a.pn=null;a.on=null;a.rn=0;a.qn=0;a.vj=new Lb;0<a.er.count&&(a.er=new F);a.Sq=null;b.aa("AnimationFinished");b.cc()}
t.Hp=function(a,b){if(this.We){var c=a.actualBounds,d=b.actualBounds,e=null;b instanceof hg&&(e=b.placeholder);null!==e?(c=e.ma(Tc),e=e.padding,c.x+=e.left,c.y+=e.top,this.jg(a,"position",c,a.position,!1)):this.jg(a,"position",new G(d.x+d.width/2-c.width/2,d.y+d.height/2-c.height/2),a.position,!1);this.jg(a,"scale",.01,a.scale,!1);if(a instanceof hg)for(a=a.memberParts;a.next();)e=a.value,e instanceof V&&this.Hp(e,b)}};
t.Gp=function(a,b){if(a.isVisible()&&this.We){var c=null;b instanceof hg&&(c=b.placeholder);null!==c?this.jg(a,"position:placeholder",a.position,c,!0):this.jg(a,"position:node",a.position,b,!0);this.jg(a,"scale",a.scale,.01,!0);this.rb&&(c=this.vj,c.contains(a)&&(c.J(a).sv=!0));if(a instanceof hg)for(a=a.memberParts;a.next();)c=a.value,c instanceof V&&this.Gp(c,b)}};function bi(a,b,c){a.We&&!b.A(c)&&(null===a.pn&&b.s()&&null===a.on&&(a.pn=b.copy()),a.on=c.copy(),a.xk=!0)}
function ci(a,b,c){a.We&&a.F.Mi&&(0===a.rn&&0===a.qn&&(a.rn=b),a.qn=c,a.xk=!0)}
pa.Object.defineProperties(Nh.prototype,{animationReasons:{get:function(){return this.wk}},isEnabled:{get:function(){return this.Dc},set:function(a){this.Dc=a}},duration:{get:function(){return this.Rt},set:function(a){1>a&&xa(a,">= 1",Nh,"duration");this.Rt=a}},isAnimating:{get:function(){return this.Og}},isTicking:{get:function(){return this.Br}},isInitial:{
get:function(){return this.Pg},set:function(a){this.Pg=a}}});Nh.prototype.stopAnimation=Nh.prototype.vd;Nh.prototype.addToAnimation=Nh.prototype.jg;Nh.prototype.prepareAnimation=Nh.prototype.Cz;Nh.prototype.prepareAutomaticAnimation=Nh.prototype.Pi;Nh.className="AnimationManager";function Th(a,b,c){this.start=a;this.end=b;this.Ms={};this.Is=c;this.sv=!1}Th.className="AnimationStates";
var $h={position:function(a,b,c,d,e,f){e!==f?a.tt(d(e,b.x,c.x-b.x,f),d(e,b.y,c.y-b.y,f)):a.position=new G(d(e,b.x,c.x-b.x,f),d(e,b.y,c.y-b.y,f))},"position:placeholder":function(a,b,c,d,e,f){e!==f?a.tt(d(e,b.x,c.x-b.x,f),d(e,b.y,c.y-b.y,f)):a.position=new G(d(e,b.x,c.x-b.x,f),d(e,b.y,c.y-b.y,f))},"position:node":function(a,b,c,d,e,f){var g=a.actualBounds,h=c.actualBounds;c=h.x+h.width/2-g.width/2;g=h.y+h.height/2-g.height/2;e!==f?a.tt(d(e,b.x,c-b.x,f),d(e,b.y,g-b.y,f)):a.position=new G(d(e,b.x,c-
b.x,f),d(e,b.y,g-b.y,f))},opacity:function(a,b,c,d,e,f){a.opacity=d(e,b,c-b,f)},scale:function(a,b,c,d,e,f){a.scale=d(e,b,c-b,f)},angle:function(a,b,c,d,e,f){a.angle=d(e,b,c-b,f)},visible:function(a,b,c,d,e,f){a.visible=e!==f?b:c}};function di(){mb(this);this.F=null;this.Fa=new E;this.Ua="";this.lb=1;this.u=!1;this.zj=this.K=this.Mh=this.Lh=this.Kh=this.Jh=this.Hh=this.Ih=this.Gh=this.Oh=this.Fh=this.Nh=this.Eh=this.Dh=!0;this.l=!1;this.Go=[]}t=di.prototype;t.hb=function(a){this.F=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.Fa.iterator;h.next();){var k=h.value;k instanceof hg?e++:k instanceof V?d++:k instanceof S?f++:k instanceof pf?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.Fa.iterator;a.next();)c=a.value,h+="\n "+c.toString(),d=c.data,null!==d&&Bb(d)&&(h+=" #"+Bb(d)),c instanceof V?h+=" "+
Qa(d):c instanceof S&&(h+=" "+Qa(c.fromNode)+" "+Qa(c.toNode));return b+" "+this.Fa.count+": "+h};t.Rb=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);if(!1===this.zj)return null;var d=!1;null!==this.diagram&&this.diagram.viewportBounds.ea(a)&&(d=!0);for(var e=G.alloc(),f=this.Fa.j,g=f.length;g--;){var h=f[g];if((!0!==d||!1!==ng(h))&&h.isVisible()&&(e.assign(a),Qb(e,h.rd),h=h.Rb(e,b,c),null!==h&&(null!==b&&(h=b(h)),null!==h&&(null===c||c(h)))))return G.free(e),h}G.free(e);return null};
t.Di=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.zj)return d;var e=!1;null!==this.diagram&&this.diagram.viewportBounds.ea(a)&&(e=!0);for(var f=G.alloc(),g=this.Fa.j,h=g.length;h--;){var k=g[h];if((!0!==e||!1!==ng(k))&&k.isVisible()){f.assign(a);Qb(f,k.rd);var l=k;k.Di(f,b,c,d)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||d.add(l))}}G.free(f);return d};
t.lg=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.zj)return e;var f=!1;null!==this.diagram&&this.diagram.viewportBounds.mf(a)&&(f=!0);for(var g=this.Fa.j,h=g.length;h--;){var k=g[h];if((!0!==f||!1!==ng(k))&&k.isVisible()){var l=k;k.lg(a,b,c,d,e)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||e.add(l))}}return e};
t.mg=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.zj)return f;var g=!1;null!==this.diagram&&this.diagram.viewportBounds.ea(a)&&(g=!0);for(var h=G.alloc(),k=G.alloc(),l=this.Fa.j,m=l.length;m--;){var n=l[m];if((!0!==g||!1!==ng(n))&&n.isVisible()){h.assign(a);Qb(h,n.rd);k.h(a.x+b,a.y);Qb(k,n.rd);var p=n;n.mg(h,k,c,d,e,f)&&(null!==c&&(p=c(p)),null===
p||null!==d&&!d(p)||f.add(p))}}G.free(h);G.free(k);return f};
t.hd=function(a,b){if(this.visible){var c=void 0===b?a.viewportBounds:b;var d=this.Fa.j,e=d.length;a=Ka();b=Ka();for(var f=0;f<e;f++){var g=d[f];g.yw=f;g instanceof S&&!1===g.Kc||g instanceof pf&&null!==g.adornedPart||(Ac(g.actualBounds,c,10)?(g.hd(!0),a.push(g)):(g.hd(!1),null!==g.adornments&&0<g.adornments.count&&b.push(g)))}for(c=0;c<a.length;c++)for(d=a[c],ei(d),d=d.adornments;d.next();)e=d.value,e.measure(Infinity,Infinity),e.arrange(),e.hd(!0);for(c=0;c<b.length;c++)d=b[c],d.updateAdornments(),
fi(d,!0);Oa(a);Oa(b)}};t.ic=function(a,b,c){if(this.visible&&0!==this.lb&&(void 0===c&&(c=!0),c||!this.isTemporary)){c=this.Fa.j;var d=c.length;if(0!==d){1!==this.lb&&(a.globalAlpha=this.lb);var e=this.Go;e.length=0;for(var f=b.scale,g=0;g<d;g++){var h=c[g];if(ng(h)){if(h instanceof S&&(h.isOrthogonal&&e.push(h),!1===h.Kc))continue;var k=h.actualBounds;1<k.width*f||1<k.height*f?h.ic(a,b):gi(a,h)}}a.globalAlpha=1}}};
function gi(a,b){var c=b.actualBounds,d=b.naturalBounds;if(0!==c.width&&0!==c.height&&!isNaN(c.x)&&!isNaN(c.y)&&b.isVisible()){var e=b.transform;null!==b.areaBackground&&(hi(b,a,b.areaBackground,!0,!0,d,c),a.fillRect(c.x,c.y,c.width,c.height));null===b.areaBackground&&null===b.background&&(hi(b,a,"rgba(0,0,0,0.4)",!0,!1,d,c),a.fillRect(c.x,c.y,c.width,c.height));null!==b.background&&(a.transform(e.m11,e.m12,e.m21,e.m22,e.dx,e.dy),hi(b,a,b.background,!0,!1,d,c),a.fillRect(0,0,d.width,d.height),e.$s()||
(b=1/(e.m11*e.m22-e.m12*e.m21),a.transform(e.m22*b,-e.m12*b,-e.m21*b,e.m11*b,b*(e.m21*e.dy-e.m22*e.dx),b*(e.m12*e.dx-e.m11*e.dy))))}}t.g=function(a,b,c,d,e){var f=this.diagram;null!==f&&f.ab(af,a,this,b,c,d,e)};t.Li=function(a,b,c){var d=this.Fa;b.ei=this;if(a>=d.count)a=d.count;else if(d.N(a)===b)return-1;d.Ib(a,b);b.Vp(c);d=this.diagram;null!==d&&(c?d.R():d.Li(b));ii(this,a,b);return a};
t.xc=function(a,b,c){if(!c&&b.layer!==this&&null!==b.layer)return b.layer.xc(a,b,c);var d=this.Fa;if(0>a||a>=d.length){if(a=d.indexOf(b),0>a)return-1}else if(d.N(a)!==b&&(a=d.indexOf(b),0>a))return-1;b.Wp(c);d.mb(a);d=this.diagram;null!==d&&(c?d.R():d.xc(b));b.ei=null;return a};
function ii(a,b,c){b=ji(a,b,c);if(c instanceof hg&&null!==c&&isNaN(c.zOrder)){if(0!==c.memberParts.count){for(var d=-1,e=a.Fa.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.Fa,e.mb(b),e.Ib(d,c))}c=c.containingGroup;null!==c&&ii(a,-1,c)}}
function ji(a,b,c){var d=c.zOrder;if(isNaN(d))return b;a=a.Fa;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.N(f).zOrder;if(!isNaN(g))break;f--}for(var h=b+1,k=NaN;h<e;){k=a.N(h).zOrder;if(!isNaN(k))break;h++}if(!isNaN(g)&&g>d)for(;;){if(-1===f||g<=d){f++;if(f===b)break;a.mb(b);a.Ib(f,c);return f}for(g=NaN;0<=--f&&(g=a.N(f).zOrder,isNaN(g)););}else if(!isNaN(k)&&k<d)for(;;){if(h===e||k>=d){h--;if(h===b)break;a.mb(b);a.Ib(h,c);return h}for(k=NaN;++h<
e&&(k=a.N(h).zOrder,isNaN(k)););}return b}t.clear=function(){for(var a=this.Fa.Na(),b=a.length,c=0;c<b;c++)a[c].hd(!1),this.xc(-1,a[c],!1);this.Go.length=0};
pa.Object.defineProperties(di.prototype,{parts:{get:function(){return this.Fa.iterator}},partsBackwards:{get:function(){return this.Fa.iteratorBackwards}},diagram:{get:function(){return this.F}},name:{get:function(){return this.Ua},set:function(a){var b=this.Ua;if(b!==a){var c=this.diagram;if(null!==c)for(""===b&&A("Cannot rename default Layer to: "+a),c=c.layers;c.next();)c.value.name===
a&&A("Layer.name is already present in this diagram: "+a);this.Ua=a;this.g("name",b,a);for(a=this.Fa.iterator;a.next();)a.value.layerName=this.Ua}}},opacity:{get:function(){return this.lb},set:function(a){var b=this.lb;b!==a&&((0>a||1<a)&&xa(a,"0 <= value <= 1",di,"opacity"),this.lb=a,this.g("opacity",b,a),a=this.diagram,null!==a&&a.R())}},isTemporary:{get:function(){return this.u},set:function(a){var b=this.u;b!==a&&(this.u=a,this.g("isTemporary",
b,a))}},visible:{get:function(){return this.K},set:function(a){var b=this.K;if(b!==a){this.K=a;this.g("visible",b,a);for(b=this.Fa.iterator;b.next();)b.value.Mb(a);a=this.diagram;null!==a&&a.R()}}},pickable:{get:function(){return this.zj},set:function(a){var b=this.zj;b!==a&&(this.zj=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.Xa())}},allowCopy:{get:function(){return this.Dh},set:function(a){var b=this.Dh;b!==a&&(this.Dh=a,this.g("allowCopy",b,a))}},allowDelete:{get:function(){return this.Eh},set:function(a){var b=this.Eh;b!==a&&(this.Eh=a,this.g("allowDelete",b,a))}},allowTextEdit:{get:function(){return this.Nh},set:function(a){var b=this.Nh;b!==a&&(this.Nh=a,this.g("allowTextEdit",b,a))}},allowGroup:{
get:function(){return this.Fh},set:function(a){var b=this.Fh;b!==a&&(this.Fh=a,this.g("allowGroup",b,a))}},allowUngroup:{get:function(){return this.Oh},set:function(a){var b=this.Oh;b!==a&&(this.Oh=a,this.g("allowUngroup",b,a))}},allowLink:{get:function(){return this.Gh},set:function(a){var b=this.Gh;b!==a&&(this.Gh=a,this.g("allowLink",b,a))}},allowRelink:{get:function(){return this.Ih},set:function(a){var b=
this.Ih;b!==a&&(this.Ih=a,this.g("allowRelink",b,a))}},allowMove:{get:function(){return this.Hh},set:function(a){var b=this.Hh;b!==a&&(this.Hh=a,this.g("allowMove",b,a))}},allowReshape:{get:function(){return this.Jh},set:function(a){var b=this.Jh;b!==a&&(this.Jh=a,this.g("allowReshape",b,a))}},allowResize:{get:function(){return this.Kh},set:function(a){var b=this.Kh;b!==a&&(this.Kh=a,this.g("allowResize",b,a))}},
allowRotate:{get:function(){return this.Lh},set:function(a){var b=this.Lh;b!==a&&(this.Lh=a,this.g("allowRotate",b,a))}},allowSelect:{get:function(){return this.Mh},set:function(a){var b=this.Mh;b!==a&&(this.Mh=a,this.g("allowSelect",b,a))}}});di.prototype.findObjectsNear=di.prototype.mg;di.prototype.findObjectsIn=di.prototype.lg;di.prototype.findObjectsAt=di.prototype.Di;di.prototype.findObjectAt=di.prototype.Rb;di.className="Layer";
function P(a){function b(){w.document.removeEventListener("DOMContentLoaded",b,!1);c.setRTL()}1<arguments.length&&A("Diagram constructor can only take one optional argument, the DIV HTML element or its id.");ki||(li(),ki=!0);mb(this);lf=this;Wa=[];this.ob=!0;this.vk=new Nh;this.vk.hb(this);this.Gb=17;this.Qn=!1;this.ou="default";this.Ia=null;var c=this;sh&&(null!==w.document.body?this.setRTL():w.document.addEventListener("DOMContentLoaded",b,!1));this.Pa=new E;this.wa=this.xa=0;this.Da=null;this.mu=
new Lb;this.Zg=this.Yc=null;this.zv();this.$k=null;this.yv();this.sa=(new G(NaN,NaN)).freeze();this.Wq=this.Ca=1;this.sr=(new G(NaN,NaN)).freeze();this.tr=NaN;this.Nr=1E-4;this.Lr=100;this.tb=new Qc;this.Ds=(new G(NaN,NaN)).freeze();this.hr=(new L(NaN,NaN,NaN,NaN)).freeze();this.pi=(new Ic(0,0,0,0)).freeze();this.js=mi;this.ms=!1;this.fs=this.bs=null;this.Zi=ni;this.aj=Ed;this.$h=ni;this.Ln=Ed;this.ur=this.rr=Tc;this.oc=!0;this.Mn=!1;this.Dd=new F;this.Vh=new Lb;this.un=!0;this.Qm=250;this.yk=-1;
this.Rm=(new Ic(16,16,16,16)).freeze();this.Ok=this.qd=!1;this.Tk=!0;this.Wh=new Xe;this.Wh.diagram=this;this.Ye=new Xe;this.Ye.diagram=this;this.oj=new Xe;this.oj.diagram=this;this.me=this.yf=null;this.Jl=!1;this.Nt=this.Ot=null;this.Dq=w.PointerEvent&&(cb||db||gb)&&w.navigator&&!1!==w.navigator.msPointerEnabled;oi(this);this.wi=new F;this.Cr=!0;this.ys=pi;this.Vb=!1;this.As=sg;this.Ma=null;qi.add("Model",ri);this.ba=this.La=this.Ub=null;this.Pq="";this.nn="auto";this.Pf=this.Qr=this.Rf=this.Sf=
this.Uf=this.Af=this.Ef=this.zf=null;this.mr=!1;this.Bf=this.eg=this.Tf=this.Qf=null;this.hu=!1;this.ku={};this.rl=[null,null];this.K=null;this.Mt=this.tu=this.Bh=this.bh=!1;this.Vc=!0;this.kj=this.Yb=!1;this.Zb=null;var d=this;this.vg=function(a){var b=d.partManager;if(a.model===b.diagram.model&&b.diagram.da){b.diagram.da=!1;try{var c=a.change;""===a.modelChange&&c===af&&b.updateDataBindings(a.object,a.propertyName)}finally{b.diagram.da=!0}}};this.Am=function(a){d.partManager.doModelChanged(a)};
this.Lw=!0;this.ee=-2;this.Aj=new Lb;this.ju=new E;this.Jf=!1;this.Eh=this.Dh=this.vq=this.Dc=!0;this.wq=!1;this.Cq=this.Aq=this.Mh=this.Lh=this.Kh=this.Jh=this.Hh=this.Ih=this.Gh=this.zq=this.Oh=this.Fh=this.Nh=this.xq=!0;this.ge=this.Jc=!1;this.Bq=this.yq=this.pr=this.nr=!0;this.ls=this.hs=16;this.qu=this.gs=!1;this.bp=this.ks=null;this.ru=this.su=0;this.eb=(new Ic(5)).freeze();this.os=(new F).freeze();this.Mr=999999999;this.qr=(new F).freeze();this.ai=this.ij=this.Ng=!0;this.Yh=this.Mg=!1;this.gc=
null;this.yg=!0;this.fe=!1;this.tq=new F;this.ww=new F;this.Nb=null;this.Eo=1;this.Fw=0;this.we={scale:1,position:new G,bounds:new L,nx:!1};this.Kw=(new L(NaN,NaN,NaN,NaN)).freeze();this.Bp=(new K(NaN,NaN)).freeze();this.sn=(new L(NaN,NaN,NaN,NaN)).freeze();this.Dr=!1;this.$q=null;si(this);this.Ir=this.kr=this.Tr=this.ow=this.nw=this.pw=this.Sg=this.Xh=this.Vf=null;ti(this);this.Eb=null;this.jr=!1;this.Gk=null;this.partManager=new ri;this.toolManager=new Ua;this.toolManager.initializeStandardTools();
this.currentTool=this.defaultTool=this.toolManager;this.Zq=null;this.Ik=new yf;this.Wr=this.Vr=null;this.rp=!1;this.commandHandler=ui();this.model=vi();this.bh=!0;this.layout=new wi;this.bh=!1;this.rw=this.Qt=null;this.$b=1;this.ue=null;this.au=9999;this.Se=1;this.gl=0;this.Fr=new G;this.yu=500;this.Eq=new G;this.Pe=!1;this.preventDefault=this.lt=this.im=this.jm=this.hm=this.gm=this.gk=this.ik=this.hk=this.ek=this.fk=this.Vv=this.Nv=this.Ov=this.Pv=this.oi=this.Xo=this.ni=this.Wo=null;this.u=!1;this.Zh=
new xi;this.vs=!1;void 0!==a&&yi(this,a);this.ob=!1}P.prototype.clear=function(){this.model.clear();zi=null;Ai="";Bi(this,!1);this.sn=(new L(NaN,NaN,NaN,NaN)).freeze();this.R()};
function Bi(a,b){var c=null;null!==a.Eb&&(c=a.Eb.part);a.animationManager.vd();for(var d=[],e=a.Pa.length,f=0;f<e;f++){var g=a.Pa.j[f];if(b)for(var h=g.parts;h.next();){var k=h.value;k!==c&&null===k.data&&d.push(k)}g.clear()}a.partManager.clear();a.Dd.clear();a.Vh.clear();a.wi.clear();a.os.ha();a.os.clear();a.os.freeze();a.qr.ha();a.qr.clear();a.qr.freeze();a.Gk=null;La=[];null!==c&&(a.add(c),a.partManager.parts.remove(c));if(b)for(b=0;b<d.length;b++)a.add(d[b])}function ui(){return null}
P.prototype.reset=function(){this.ob=!0;this.clear();this.vk=new Nh;this.vk.hb(this);this.Pa=new E;this.zv();this.yv();this.sa=(new G(NaN,NaN)).freeze();this.Ca=1;this.sr=(new G(NaN,NaN)).freeze();this.tr=NaN;this.Nr=1E-4;this.Lr=100;this.Ds=(new G(NaN,NaN)).freeze();this.hr=(new L(NaN,NaN,NaN,NaN)).freeze();this.pi=(new Ic(0,0,0,0)).freeze();this.js=mi;this.ms=!1;this.fs=this.bs=null;this.Zi=ni;this.aj=Ed;this.$h=ni;this.Ln=Ed;this.ur=this.rr=Tc;this.Qm=250;this.Rm=(new Ic(16,16,16,16)).freeze();
this.Cr=!0;this.ys=pi;this.As=sg;this.nn="auto";this.Pf=this.Qr=this.Rf=this.Sf=this.Uf=this.Af=this.Ef=this.zf=null;this.mr=!1;this.Bf=this.eg=this.Tf=this.Qf=null;this.Jf=!1;this.Eh=this.Dh=this.vq=this.Dc=!0;this.wq=!1;this.Bq=this.yq=this.pr=this.nr=this.Cq=this.Aq=this.Mh=this.Lh=this.Kh=this.Jh=this.Hh=this.Ih=this.Gh=this.zq=this.Oh=this.Fh=this.Nh=this.xq=!0;this.ls=this.hs=16;this.eb=(new Ic(5)).freeze();this.Mr=999999999;this.gc=null;this.Dr=!1;ti(this);this.Eb=null;this.partManager=new ri;
this.toolManager=new Ua;this.toolManager.initializeStandardTools();this.Wr=this.Vr=this.Zq=null;this.rp=!1;this.Ik.reset();this.mu=new Lb;this.mu.clear();this.currentTool=this.defaultTool=this.toolManager;this.commandHandler=ui();this.bh=!0;si(this);this.layout=new wi;this.bh=!1;this.model=vi();this.model.undoManager=new ff;this.fe=!1;this.Tk=!0;this.ob=this.qd=!1;this.R();this.me=this.yf=null;oi(this);this.Pq=""};
function ti(a){a.Vf=new Lb;var b=new V,c=new uh;c.bind(new Ci("text","",Qa));b.add(c);a.pw=b;a.Vf.add("",b);b=new V;c=new uh;c.stroke="brown";c.bind(new Ci("text","",Qa));b.add(c);a.Vf.add("Comment",b);b=new V;b.selectable=!1;b.avoidable=!1;c=new W;c.figure="Ellipse";c.fill="black";c.stroke=null;c.desiredSize=(new K(3,3)).ga();b.add(c);a.Vf.add("LinkLabel",b);a.Xh=new Lb;b=new hg;b.selectionObjectName="GROUPPANEL";b.type=X.Vertical;c=new uh;c.font="bold 12pt sans-serif";c.bind(new Ci("text","",Qa));
b.add(c);c=new X(X.Auto);c.name="GROUPPANEL";var d=new W;d.figure="Rectangle";d.fill="rgba(128,128,128,0.2)";d.stroke="black";c.add(d);d=new Wg;d.padding=(new Ic(5,5,5,5)).ga();c.add(d);b.add(c);a.nw=b;a.Xh.add("",b);a.Sg=new Lb;b=new S;c=new W;c.isPanelMain=!0;b.add(c);c=new W;c.toArrow="Standard";c.fill="black";c.stroke=null;c.strokeWidth=0;b.add(c);a.ow=b;a.Sg.add("",b);b=new S;c=new W;c.isPanelMain=!0;c.stroke="brown";b.add(c);a.Sg.add("Comment",b);b=new pf;b.type=X.Auto;c=new W;c.fill=null;c.stroke=
"dodgerblue";c.strokeWidth=3;b.add(c);c=new Wg;c.margin=(new Ic(1.5,1.5,1.5,1.5)).ga();b.add(c);a.Tr=b;a.kr=b;b=new pf;b.type=X.Link;c=new W;c.isPanelMain=!0;c.fill=null;c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);a.Ir=b}
P.prototype.setRTL=function(a){a=void 0===a?this.div:a;null===a&&(a=w.document.body);var b=va("div");b.dir="rtl";b.style.cssText="font-size: 14px; width: 1px; height: 1px; position: absolute; top: -1000px; overflow: scroll;";b.textContent="A";a.appendChild(b);var c="reverse";0<b.scrollLeft?c="default":(b.scrollLeft=1,0===b.scrollLeft&&(c="negative"));a.removeChild(b);this.ou=c};
P.prototype.setScrollWidth=function(a){a=void 0===a?this.div:a;null===a&&(a=w.document.body);var b=0;if(sh){var c=Gi;b=Hi;null===c&&(c=Gi=va("p"),c.style.width="100%",c.style.height="200px",c.style.boxSizing="content-box",b=Hi=va("div"),b.style.position="absolute",b.style.visibility="hidden",b.style.width="200px",b.style.height="150px",b.style.boxSizing="content-box",b.appendChild(c));b.style.overflow="hidden";a.appendChild(b);var d=c.offsetWidth;b.style.overflow="scroll";c=c.offsetWidth;d===c&&(c=
b.clientWidth);a.removeChild(b);b=d-c;0!==b||lb||(b=11)}this.Gb=b};P.prototype.fb=function(a){a.classType===P&&(this.autoScale=a)};P.prototype.toString=function(a){void 0===a&&(a=0);var b="";this.div&&this.div.id&&(b=this.div.id);b='Diagram "'+b+'"';if(0>=a)return b;for(var c=this.Pa.iterator;c.next();)b+="\n "+c.value.toString(a-1);return b};
function Ii(a){var b=a.Da.Ga;b instanceof HTMLCanvasElement&&(a.Dq?(b.addEventListener("pointerdown",a.gm,!1),b.addEventListener("pointermove",a.hm,!1),b.addEventListener("pointerup",a.jm,!1),b.addEventListener("pointerout",a.im,!1)):(b.addEventListener("touchstart",a.Pv,!1),b.addEventListener("touchmove",a.Ov,!1),b.addEventListener("touchend",a.Nv,!1),b.addEventListener("mousemove",a.fk,!1),b.addEventListener("mousedown",a.ek,!1),b.addEventListener("mouseup",a.hk,!1),b.addEventListener("mouseout",
a.gk,!1)),b.addEventListener("mouseenter",a.Ay,!1),b.addEventListener("mouseleave",a.By,!1),b.addEventListener("wheel",a.ik,!1),b.addEventListener("keydown",a.pz,!1),b.addEventListener("keyup",a.qz,!1),b.addEventListener("blur",a.my,!1),b.addEventListener("focus",a.ny,!1),b.addEventListener("selectstart",function(a){a.preventDefault();return!1},!1),b.addEventListener("contextmenu",function(a){a.preventDefault();return!1},!1),b.addEventListener("gesturestart",function(b){a.toolManager.gestureBehavior!==
sf&&(a.toolManager.gestureBehavior===rf?b.preventDefault():a.Pe&&a.lastInput.handled||(b.preventDefault(),a.Eo=a.scale,a.currentTool.doCancel()))},!1),b.addEventListener("gesturechange",function(b){if(a.toolManager.gestureBehavior!==sf)if(a.toolManager.gestureBehavior===rf)b.preventDefault();else if(!a.Pe||!a.lastInput.handled){b.preventDefault();var c=b.scale;if(null!==a.Eo){var e=a.Da.getBoundingClientRect();b=new G(b.pageX-window.scrollX-a.xa/e.width*e.left,b.pageY-window.scrollY-a.wa/e.height*
e.top);c=a.Eo*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),w.addEventListener("resize",a.Vv,!1))}function Tf(a,b){null!==a.ue&&(a.ue=null,b&&a.lt())}P.prototype.computePixelRatio=function(){return null!==this.ue?this.ue:w.devicePixelRatio||1};P.prototype.doMouseMove=function(){this.currentTool.doMouseMove()};P.prototype.doMouseDown=function(){this.currentTool.doMouseDown()};P.prototype.doMouseUp=function(){this.currentTool.doMouseUp()};
P.prototype.doMouseWheel=function(){this.currentTool.doMouseWheel()};P.prototype.doKeyDown=function(){this.currentTool.doKeyDown()};P.prototype.doKeyUp=function(){this.currentTool.doKeyUp()};P.prototype.doFocus=function(){this.focus()};P.prototype.focus=function(){if(this.Da)if(this.scrollsPageOnFocus)this.Da.focus();else{var a=w.scrollX||w.pageXOffset,b=w.scrollY||w.pageYOffset;this.Da.focus();w.scrollTo(a,b)}};P.prototype.ny=function(){this.F.aa("GainedFocus")};P.prototype.my=function(){this.F.aa("LostFocus")};
function Qh(a){if(null!==a.Da){var b=a.Ia;if(0!==b.clientWidth&&0!==b.clientHeight){a.setScrollWidth();var c=a.Yh?a.Gb:0,d=a.Mg?a.Gb:0,e=a.$b;a.$b=a.computePixelRatio();a.$b!==e&&(a.Mn=!0,a.cc());if(b.clientWidth!==a.xa+c||b.clientHeight!==a.wa+d)a.ij=!0,a.oc=!0,b=a.layout,null!==b&&b.isViewportSized&&a.autoScale===ni&&(a.Ok=!0,b.B()),a.Yb||a.cc()}}}
function si(a){var b=new di;b.name="Background";a.Nl(b);b=new di;b.name="";a.Nl(b);b=new di;b.name="Foreground";a.Nl(b);b=new di;b.name="Adornment";b.isTemporary=!0;a.Nl(b);b=new di;b.name="Tool";b.isTemporary=!0;b.isBoundsIncluded=!0;a.Nl(b);b=new di;b.name="Grid";b.allowSelect=!1;b.pickable=!1;b.isTemporary=!0;a.Ow(b,a.Xl("Background"))}
function Ji(a){a.Eb=new X(X.Grid);a.Eb.name="GRID";var b=new W;b.figure="LineH";b.stroke="lightgray";b.strokeWidth=.5;b.interval=1;a.Eb.add(b);b=new W;b.figure="LineH";b.stroke="gray";b.strokeWidth=.5;b.interval=5;a.Eb.add(b);b=new W;b.figure="LineH";b.stroke="gray";b.strokeWidth=1;b.interval=10;a.Eb.add(b);b=new W;b.figure="LineV";b.stroke="lightgray";b.strokeWidth=.5;b.interval=1;a.Eb.add(b);b=new W;b.figure="LineV";b.stroke="gray";b.strokeWidth=.5;b.interval=5;a.Eb.add(b);b=new W;b.figure="LineV";
b.stroke="gray";b.strokeWidth=1;b.interval=10;a.Eb.add(b);b=new T;b.add(a.Eb);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.Eb.visible=!1}function Ki(){this.F.qu?this.F.qu=!1:this.F.isEnabled?this.F.Zw(this):Li(this.F)}function Mi(a){this.F.isEnabled?(this.F.su=a.target.scrollTop,this.F.ru=a.target.scrollLeft):Li(this.F)}
P.prototype.Zw=function(a){if(null!==this.Da){this.gs=!0;var b=this.documentBounds,c=this.viewportBounds,d=this.pi,e=b.x-d.left,f=b.y-d.top,g=b.width+d.left+d.right,h=b.height+d.top+d.bottom,k=b.right+d.right;d=b.bottom+d.bottom;var l=c.x;b=c.y;var m=c.width,n=c.height,p=c.right,q=c.bottom;c=this.scale;var r=a.scrollLeft;if(this.Qn)switch(this.ou){case "negative":r=r+a.scrollWidth-a.clientWidth;break;case "reverse":r=a.scrollWidth-r-a.clientWidth}var u=r;m<g||n<h?(r=G.allocAt(this.position.x,this.position.y),
this.allowHorizontalScroll&&this.ru!==u&&(r.x=u/c+e,this.ru=u),this.allowVerticalScroll&&this.su!==a.scrollTop&&(r.y=a.scrollTop/c+f,this.su=a.scrollTop),this.position=r,G.free(r),this.ij=this.gs=!1):(r=G.alloc(),a.Tx&&this.allowHorizontalScroll&&(e<l&&(this.position=r.h(u+e,this.position.y)),k>p&&(this.position=r.h(-(this.ks.scrollWidth-this.xa)+u-this.xa/c+k,this.position.y))),a.Ux&&this.allowVerticalScroll&&(f<b&&(this.position=r.h(this.position.x,a.scrollTop+f)),d>q&&(this.position=r.h(this.position.x,
-(this.ks.scrollHeight-this.wa)+a.scrollTop-this.wa/c+d))),G.free(r),Ni(this),this.ij=this.gs=!1,b=this.documentBounds,c=this.viewportBounds,k=b.right,p=c.right,d=b.bottom,q=c.bottom,e=b.x,l=c.x,f=b.y,b=c.y,m>=g&&e>=l&&k<=p&&(this.bp.style.width="1px"),n>=h&&f>=b&&d<=q&&(this.bp.style.height="1px"))}};P.prototype.computeBounds=function(){0<this.Dd.count&&Oi(this);return Pi(this)};
function Pi(a){if(a.fixedBounds.s()){var b=a.fixedBounds.copy();b.Ip(a.eb);return b}for(var c=!0,d=a.Pa.j,e=d.length,f=0;f<e;f++){var g=d[f];if(g.visible&&(!g.isTemporary||g.isBoundsIncluded)){g=g.Fa.j;for(var h=g.length,k=0;k<h;k++){var l=g[k];l.isInDocumentBounds&&l.isVisible()&&(l=l.actualBounds,l.s()&&(c?(c=!1,b=l.copy()):b.Uc(l)))}}}c&&(b=new L(0,0,0,0));b.Ip(a.eb);return b}
P.prototype.computePartsBounds=function(a,b){void 0===b&&(b=!1);var c=null;if(Ea(a))for(var d=0;d<a.length;d++){var e=a[d];!b&&e instanceof S||(e.ac(),null===c?c=e.actualBounds.copy():c.Uc(e.actualBounds))}else for(a=a.iterator;a.next();)d=a.value,!b&&d instanceof S||(d.ac(),null===c?c=d.actualBounds.copy():c.Uc(d.actualBounds));return null===c?new L(NaN,NaN,0,0):c};
function Qi(a,b){if((b||a.fe)&&!a.ob&&null!==a.Da&&!a.animationManager.isAnimating&&a.documentBounds.s()){a.ob=!0;var c=a.Zi;b&&a.$h!==ni&&(c=a.$h);var d=c!==ni?Ri(a,c):a.scale;c=a.viewportBounds.copy();var e=a.xa/d,f=a.wa/d,g=null,h=a.animationManager;h.rb&&(g=a.sa.copy());var k=a.aj,l=a.Ln;b&&!k.gb()&&(l.gb()||l.Kb())&&(k=l.Kb()?dd:l);Si(a,a.documentBounds,e,f,k,b);null!==g&&bi(h,g,a.sa);b=a.scale;a.scale=d;a.ob=!1;d=a.viewportBounds;d.Qa(c)||a.fq(c,d,b,!1)}}
function Ri(a,b){var c=a.Wq;if(null===a.Da)return c;a.Ng&&Ti(a,a.computeBounds());var d=a.documentBounds;if(!d.s())return c;var e=d.width;d=d.height;var f=a.xa,g=a.wa,h=f/e,k=g/d;return b===Ui?(b=Math.min(k,h),b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):b===Vi?(b=k>h?(g-a.Gb)/d:(f-a.Gb)/e,b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):a.scale}
P.prototype.zoomToFit=function(){this.scale=Ri(this,Ui);this.scrollMode!==mi&&Si(this,this.documentBounds,this.xa/this.Ca,this.wa/this.Ca,this.aj,!0)};t=P.prototype;
t.Vz=function(a,b){void 0===b&&(b=Ui);var c=a.width,d=a.height;if(!(0===c||0===d||isNaN(c)&&isNaN(d))){var e=1;if(b===Ui||b===Vi)if(isNaN(c))e=this.viewportBounds.height*this.scale/d;else if(isNaN(d))e=this.viewportBounds.width*this.scale/c;else{e=this.xa;var f=this.wa;e=b===Vi?f/d>e/c?(f-(this.Mg?this.Gb:0))/d:(e-(this.Yh?this.Gb:0))/c:Math.min(f/d,e/c)}this.scale=e;this.position=new G(a.x,a.y)}};
t.hy=function(a,b){this.Ng&&Ti(this,this.computeBounds());var c=this.documentBounds,d=this.viewportBounds;this.position=new G(c.x+(a.x*c.width+a.offsetX)-(b.x*d.width-b.offsetX),c.y+(a.y*c.height+a.offsetY)-(b.y*d.height-b.offsetY))};
function Si(a,b,c,d,e,f){a.sa.ha();var g=a.sa,h=g.x,k=g.y;if(f||a.scrollMode===mi)e.gb()&&(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.pi,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.eb.left;g.y=isFinite(k)?k:-a.eb.top;null!==a.positionComputation&&(b=a.positionComputation(a,g),g.x=b.x,g.y=b.y);a.sa.freeze()}t.Yl=function(a,b){void 0===b&&(b=!0);if(b){if(a=fg(this,a,function(a){return a.part},function(a){return a.canSelect()}),a instanceof T)return a}else if(a=fg(this,a,function(a){return a.part}),a instanceof T)return a;return null};
t.Rb=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);Oi(this);for(var d=this.Pa.iteratorBackwards;d.next();){var e=d.value;if(e.visible&&(e=e.Rb(a,b,c),null!==e))return e}return null};function fg(a,b,c,d){void 0===c&&(c=null);void 0===d&&(d=null);Oi(a);for(a=a.Pa.iteratorBackwards;a.next();){var e=a.value;if(e.visible&&!e.isTemporary&&(e=e.Rb(b,c,d),null!==e))return e}return null}
t.Ky=function(a,b,c){void 0===b&&(b=!0);return Wi(this,a,function(a){return a.part},b?function(a){return a instanceof T&&a.canSelect()}:null,c)};function Wi(a,b,c,d,e){void 0===c&&(c=null);void 0===d&&(d=null);e instanceof E||e instanceof F||(e=new F);Oi(a);for(a=a.Pa.iteratorBackwards;a.next();){var f=a.value;f.visible&&!f.isTemporary&&f.Di(b,c,d,e)}return e}
t.Di=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof E||d instanceof F||(d=new F);Oi(this);for(var e=this.Pa.iteratorBackwards;e.next();){var f=e.value;f.visible&&f.Di(a,b,c,d)}return d};t.hx=function(a,b,c,d){void 0===b&&(b=!1);void 0===c&&(c=!0);return Xi(this,a,function(a){return a instanceof T&&(!c||a.canSelect())},b,d)};
t.lg=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);Oi(this);for(var f=this.Pa.iteratorBackwards;f.next();){var g=f.value;g.visible&&g.lg(a,b,c,d,e)}return e};function Xi(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);Oi(a);for(a=a.Pa.iteratorBackwards;a.next();){var g=a.value;g.visible&&!g.isTemporary&&g.lg(b,f,c,d,e)}return e}
t.Ly=function(a,b,c,d,e){void 0===c&&(c=!0);void 0===d&&(d=!0);return Yi(this,a,b,function(a){return a instanceof T&&(!d||a.canSelect())},c,e)};t.mg=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);Oi(this);for(var g=this.Pa.iteratorBackwards;g.next();){var h=g.value;h.visible&&h.mg(a,b,c,d,e,f)}return f};
function Yi(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);Oi(a);for(a=a.Pa.iteratorBackwards;a.next();){var h=a.value;h.visible&&!h.isTemporary&&h.mg(b,c,g,d,e,f)}return f}P.prototype.acceptEvent=function(a){return Zi(this,a,a instanceof MouseEvent)};
function Zi(a,b,c){var d=a.Ye;a.Ye=a.oj;a.oj=d;d.diagram=a;d.event=b;c?$i(a,b,d):(d.viewPoint=a.Ye.viewPoint,d.documentPoint=a.Ye.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||bb||(d.buttons=b.buttons);ib&&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=aj(b);d.targetObject=null;return d}
function aj(a){var b=a.target.F;if(!b){var c=a.path;c||"function"!==typeof a.composedPath||(c=a.composedPath());c&&c[0]&&(b=c[0].F)}return b?b:null}function bj(a,b,c,d){var e=cj(a,b,!0,!1,!0,d);$i(a,c,e);e.targetDiagram=aj(b);e.targetObject=null;d||e.clone(a.Wh);return e}
function dj(a,b,c,d){var e;d=cj(a,b,!1,!1,!1,d);null!==c?((e=w.document.elementFromPoint(c.clientX,c.clientY))&&e.F?(b=c,c=e.F):(b=void 0!==b.targetTouches?b.targetTouches[0]:b,c=a),d.targetDiagram=c,$i(a,b,d)):null!==a.Ye?(d.documentPoint=a.Ye.documentPoint,d.viewPoint=a.Ye.viewPoint,d.targetDiagram=a.Ye.targetDiagram):null!==a.Wh&&(d.documentPoint=a.Wh.documentPoint,d.viewPoint=a.Wh.viewPoint,d.targetDiagram=a.Wh.targetDiagram);d.targetObject=null;return d}
function cj(a,b,c,d,e,f){var g=a.Ye;a.Ye=a.oj;a.oj=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.Dq&&b instanceof w.PointerEvent&&"touch"!==b.pointerType&&(g.button=b.button,void 0===b.buttons||bb||(g.buttons=b.buttons),ib&&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 ej(a,b){if(a.bubbles)return!0;void 0!==b.stopPropagation&&b.stopPropagation();b.preventDefault();b.cancelBubble=!0;return!1}
P.prototype.pz=function(a){var b=this.F;if(!this.F.isEnabled)return!1;var c=Zi(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 ej(c,a)};
P.prototype.qz=function(a){var b=this.F;if(!b.isEnabled)return!1;var c=Zi(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 ej(c,a)};
P.prototype.Ay=function(a){var b=this.F;if(!b.isEnabled)return!1;var c=Zi(b,a,!0);null!==b.mouseEnter&&b.mouseEnter(c);return ej(c,a)};P.prototype.By=function(a){var b=this.F;if(!b.isEnabled)return!1;var c=Zi(b,a,!0);null!==b.mouseLeave&&b.mouseLeave(c);return ej(c,a)};
P.prototype.getMouse=function(a){var b=this.Da;if(null===b)return new G(0,0);var c=b.getBoundingClientRect();b=a.clientX-this.xa/c.width*c.left;a=a.clientY-this.wa/c.height*c.top;return null!==this.tb?Qb(new G(b,a),this.tb):new G(b,a)};
function $i(a,b,c){var d=a.Da,e=a.xa,f=a.wa,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.tb?(b=G.allocAt(g,h),a.tb.Td(b),c.documentPoint.assign(b),G.free(b)):c.documentPoint.h(g,h)}
function Ye(a,b,c,d){if(void 0!==b.targetTouches){if(2>b.targetTouches.length)return;b=b.targetTouches[c]}else if(null!==a.rl[0])b=a.rl[c];else return;c=a.Da;null!==c&&(c=c.getBoundingClientRect(),d.h(b.clientX-a.xa/c.width*c.left,b.clientY-a.wa/c.height*c.top))}t=P.prototype;t.Xa=function(){this.Ng||(this.Ng=!0,this.cc(!0))};function ai(a){a.Yb||Oi(a);a.Ng&&Ti(a,a.computeBounds())}t.zh=function(){this.ob||this.Yb||(this.R(),fj(this),Ni(this),this.Xa(),this.fd())};t.oz=function(){return this.qd};
t.vy=function(a){void 0===a&&(a=null);var b=this.animationManager,c=b.isEnabled;b.vd();b.isEnabled=!1;og(this);this.fe=!1;b.isEnabled=c;null!==a&&ua(a,1)};t.cc=function(a){void 0===a&&(a=!1);if(!0!==this.qd&&!(this.ob||!1===a&&this.Yb)){this.qd=!0;var b=this;w.requestAnimationFrame(function(){b.qd&&b.fd()})}};t.fd=function(){if(!this.Tk||this.qd)this.Tk&&(this.Tk=!1),og(this)};function gj(a,b){a.animationManager.isAnimating||a.ob||!a.ij||Li(a)||(b&&Oi(a),Qi(a,!1))}
function og(a,b){if(!a.Yb&&(a.qd=!1,null!==a.Ia||a.Bp.s())){a.Yb=!0;var c=a.animationManager,d=a.ju;if(!c.isTicking&&0!==d.length){for(var e=d.j,f=e.length,g=0;g<f;g++){var h=e[g];hj(h,!1);h.o()}d.clear()}d=a.ww;0<d.count&&(d.each(function(a){a.Uv()}),d.clear());e=d=!1;c.isAnimating&&(e=!0,d=a.skipsUndoManager,a.skipsUndoManager=!0);c.rb||Qh(a);gj(a,!1);null!==a.Eb&&(a.Eb.visible&&!a.jr&&(ij(a),a.jr=!0),!a.Eb.visible&&a.jr&&(a.jr=!1));Oi(a);f=!1;if(!a.fe||a.yg)a.fe?jj(a,!a.Ok):(a.Aa("Initial Layout"),
!1===c.isEnabled&&c.vd(),jj(a,!1)),f=!0;a.Ok=!1;Oi(a);a.tu||c.isAnimating||ai(a);gj(a,!0);f&&(a.fe||kj(a),a.aa("LayoutCompleted"));Oi(a);f&&!a.fe&&(a.fe=!0,a.Za("Initial Layout"),a.skipsUndoManager||a.undoManager.clear(),ua(function(){a.isModified=!1},1));a.Hu();Ph(c);b||a.ic(a.Yc);e&&(a.skipsUndoManager=d);a.Yb=!1}}
function kj(a){var b=a.Pa.j;a.hd(b,b.length,a);a.$h!==ni?a.scale=Ri(a,a.$h):a.Zi!==ni?a.scale=Ri(a,a.Zi):(b=a.initialScale,isFinite(b)&&0<b&&(a.scale=b));b=a.initialPosition;if(b.s())a.position=b;else{b=G.alloc();b.Ri(a.documentBounds,a.initialDocumentSpot);var c=a.viewportBounds;c=L.allocAt(0,0,c.width,c.height);var d=G.alloc();d.Ri(c,a.initialViewportSpot);d.h(b.x-d.x,b.y-d.y);a.position=d;L.free(c);G.free(d);G.free(b);fj(a);gj(a,!0);Qi(a,!0)}a.aa("InitialLayoutCompleted");ij(a)}
function Oi(a){if((a.Yb||!a.animationManager.isAnimating)&&0!==a.Dd.count){for(var b=0;23>b;b++){var c=a.Dd.iterator;if(null===c||0===a.Dd.count)break;a.Dd=new F;a.Uv(c,a.Dd)}a.nodes.each(function(a){a instanceof hg&&0!==(a.Z&65536)!==!1&&(a.Z=a.Z^65536)})}}
t.Uv=function(a,b){for(a.reset();a.next();){var c=a.value;!c.Lb()||c instanceof hg||(c.Ni()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))}for(a.reset();a.next();)c=a.value,c instanceof hg&&c.isVisible()&&lj(this,c);for(a.reset();a.next();)c=a.value,c instanceof S&&c.isVisible()&&(c.Ni()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c));for(a.reset();a.next();)c=a.value,c instanceof pf&&c.isVisible()&&(c.Ni()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))};
function lj(a,b){for(var c=Ka(),d=Ka(),e=b.memberParts;e.next();){var f=e.value;f.isVisible()&&(f instanceof hg?(mj(f)||nj(f)||oj(f))&&lj(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();Oa(c);b.measure(Infinity,Infinity);b.arrange();a=d.length;for(b=0;b<a;b++)c=d[b],c.measure(Infinity,Infinity),c.arrange();Oa(d)}
t.hd=function(a,b,c,d){if(this.ai||this.animationManager.isAnimating)for(var e=0;e<b;e++)a[e].hd(c,d)};
t.ic=function(a,b){void 0===b&&(b=null);if(null!==this.Ia){null===this.Da&&A("No canvas specified");var c=this.animationManager;if(!c.rb){var d=new Date;pj(this);if("0"!==this.Ia.style.opacity){var e=a!==this.Yc,f=this.Pa.j,g=f.length,h=this;this.hd(f,g,h);if(e)a.Qc(!0),Ni(this);else if(!this.oc&&null===b&&!c.isAnimating)return;g=this.sa;var k=this.Ca,l=Math.round(g.x*k)/k,m=Math.round(g.y*k)/k;c=this.tb;c.reset();1!==k&&c.scale(k);0===g.x&&0===g.y||c.translate(-l,-m);k=this.$b;a.setTransform(1,0,
0,1,0,0);a.scale(k,k);a.clearRect(0,0,this.xa,this.wa);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=null!==b?function(c){var d=b;if(c.visible&&0!==c.lb){var e=c.Fa.j,f=e.length;if(0!==f){1!==c.lb&&(a.globalAlpha=c.lb);c=c.Go;c.length=0;for(var g=h.scale,k=0;k<f;k++){var l=e[k];if(ng(l)&&!d.contains(l)){if(l instanceof S&&(l.isOrthogonal&&c.push(l),!1===l.Kc))continue;var m=l.actualBounds;1<m.width*g||1<m.height*g?l.ic(a,h):gi(a,l)}}a.globalAlpha=1}}}:function(b){b.ic(a,
h)};qj(this,a);g=f.length;for(m=0;m<g;m++)a.setTransform(1,0,0,1,0,0),a.scale(k,k),a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy),l(f[m]);this.Zh&&rj(this.Zh,this)&&this.$q();e?(this.Yc.Qc(!0),Ni(this)):this.oc=this.ai=!1;d=+new Date-+d;null===this.ue&&(this.au=d)}}}};
function sj(a,b,c,d,e,f,g,h,k,l){if(null!==a.Ia){null===a.Da&&A("No canvas specified");void 0===g&&(g=null);void 0===h&&(h=null);void 0===k&&(k=!1);void 0===l&&(l=!1);pj(a);a.Yc.Qc(!0);Ni(a);a.kj=!0;var m=a.Ca;a.Ca=e;var n=a.Pa.j,p=n.length;try{var q=new L(f.x,f.y,d.width/e,d.height/e),r=q.copy();r.Ip(c);ij(a,r);Oi(a);a.hd(n,p,a,q);var u=a.$b;b.setTransform(1,0,0,1,0,0);b.scale(u,u);b.clearRect(0,0,d.width,d.height);null!==h&&""!==h&&(b.fillStyle=h,b.fillRect(0,0,d.width,d.height));var x=Qc.alloc();
x.reset();x.translate(c.left,c.top);x.scale(e);0===f.x&&0===f.y||x.translate(-f.x,-f.y);b.setTransform(x.m11,x.m12,x.m21,x.m22,x.dx,x.dy);Qc.free(x);qj(a,b);if(null!==g){var v=new F,y=g.iterator;for(y.reset();y.next();){var z=y.value;!1===l&&"Grid"===z.layer.name||null===z||v.add(z)}var B=function(c){var d=k;if(c.visible&&0!==c.lb&&(void 0===d&&(d=!0),d||!c.isTemporary)){d=c.Fa.j;var e=d.length;if(0!==e){1!==c.lb&&(b.globalAlpha=c.lb);c=c.Go;c.length=0;for(var f=a.scale,g=0;g<e;g++){var h=d[g];if(ng(h)&&
v.contains(h)){if(h instanceof S&&(h.isOrthogonal&&c.push(h),!1===h.Kc))continue;var l=h.actualBounds;1<l.width*f||1<l.height*f?h.ic(b,a):gi(b,h)}}b.globalAlpha=1}}}}else if(!k&&l){var C=a.grid.part,I=C.layer;B=function(c){c===I?C.ic(b,a):c.ic(b,a,k)}}else B=function(c){c.ic(b,a,k)};for(c=0;c<p;c++)B(n[c]);a.kj=!1;a.Zh&&rj(a.Zh,a)&&a.$q()}finally{a.Ca=m,a.Yc.Qc(!0),Ni(a),a.hd(n,p,a),ij(a)}}}t.Ce=function(a){return this.Zg[a]};t.Ex=function(a,b){this.Zg[a]=b;this.zh()};
t.zv=function(){this.Zg=new tb;this.Zg.drawShadows=!0;this.Zg.textGreeking=!0;this.Zg.viewportOptimizations=lb||cb||db?!1:!0;this.Zg.temporaryPixelRatio=!0;this.Zg.pictureRatioOptimization=!0};function qj(a,b){a=a.Zg;null!==a&&(void 0!==a.imageSmoothingEnabled&&b.rt(!!a.imageSmoothingEnabled),a=a.defaultFont,void 0!==a&&null!==a&&(b.font=a))}t.$l=function(a){return this.$k[a]};t.Lz=function(a,b){this.$k[a]=b};
t.yv=function(){this.$k=new tb;this.$k.extraTouchArea=10;this.$k.extraTouchThreshold=10;this.$k.hasGestureZoom=!0};t.Iv=function(a){tj(this,a)};
function tj(a,b){var c=a instanceof X,d=a instanceof P,e;for(e in b){""===e&&A("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.$a(k);else if(f=a[k],void 0===f||null===f)f=a.toolManager[k];Ca(f)?g=e.substr(h+1):A("Unable to find object named: "+k+" in "+a.toString()+" when trying to set property: "+e)}}if("_"!==g[0]&&!Sa(f,g))if(d&&"ModelChanged"===g){a.Qw(b[g]);continue}else if(d&&"Changed"===g){a.oh(b[g]);continue}else if(d&&
Sa(a.toolManager,g))f=a.toolManager;else if(d&&uj(a,g)){a.Kj(g,b[g]);continue}else if(a instanceof Z&&"Changed"===g){a.oh(b[g]);continue}else A('Trying to set undefined property "'+g+'" on object: '+f.toString());f[g]=b[e];"_"===g[0]&&f instanceof Y&&f.Nw(g)}}t.Hu=function(){if(0===this.undoManager.transactionLevel&&0!==this.Vh.count){for(;0<this.Vh.count;){var a=this.Vh;this.Vh=new Lb;for(a=a.iterator;a.next();){var b=a.key;b.Xp(a.value);b.bc()}}this.R()}};
t.R=function(a){void 0===a&&(a=null);if(null===a)this.oc=!0,this.cc();else{var b=this.viewportBounds;null!==a&&a.s()&&b.Ic(a)&&(this.oc=!0,this.cc())}this.aa("InvalidateDraw")};
t.lx=function(a,b){if(!0!==this.oc){this.oc=!0;var c=!0===this.Ce("temporaryPixelRatio");if(!0===this.Ce("viewportOptimizations")&&this.scrollMode!==vj&&this.pi.Bi(0,0,0,0)&&b.width===a.width&&b.height===a.height){var d=this.scale,e=Math.max(a.x,b.x),f=Math.max(a.y,b.y);d=L.allocAt(e,f,Math.max(0,Math.min(a.x+a.width,b.x+b.width)-e)*d,Math.max(0,Math.min(a.y+a.height,b.y+b.height)-f)*d);if(!this.vs&&0<d.width&&0<d.height){if(!(this.Yb||(this.qd=!1,null===this.Ia||(this.Yb=!0,this.Hu(),this.documentBounds.s()||
Ti(this,this.computeBounds()),e=this.Da,null===e||e instanceof wj)))){var g=this.$b;f=this.xa*g;var h=this.wa*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.Qt;a=this.rw;k.width!==f&&(k.width=f);k.height!==h&&(k.height=h);a.clearRect(0,0,f,h);k=190*g;var m=70*g,n=Math.max(l,0),p=Math.max(b,0),q=Math.floor(f-n),r=Math.floor(h-p);a.rt(!1);a.drawImage(e.Ga,n,p,q,r,0,0,q,r);rj(this.Zh,this)&&a.clearRect(0,0,k,m);e=Ka();a=Ka();
r=Math.abs(l);q=Math.abs(b);var u=0===n?0:f-r;n=G.allocAt(u,0);r=G.allocAt(r+u,h);a.push(new L(Math.min(n.x,r.x),Math.min(n.y,r.y),Math.abs(n.x-r.x),Math.abs(n.y-r.y)));var x=this.tb;x.reset();x.scale(g,g);1!==this.Ca&&x.scale(this.Ca);g=this.sa;(0!==g.x||0!==g.y)&&isFinite(g.x)&&isFinite(g.y)&&x.translate(-g.x,-g.y);Qb(n,x);Qb(r,x);e.push(new L(Math.min(n.x,r.x),Math.min(n.y,r.y),Math.abs(n.x-r.x),Math.abs(n.y-r.y)));u=0===p?0:h-q;n.h(0,u);r.h(f,q+u);a.push(new L(Math.min(n.x,r.x),Math.min(n.y,r.y),
Math.abs(n.x-r.x),Math.abs(n.y-r.y)));Qb(n,x);Qb(r,x);e.push(new L(Math.min(n.x,r.x),Math.min(n.y,r.y),Math.abs(n.x-r.x),Math.abs(n.y-r.y)));rj(this.Zh,this)&&(f=0<l?0:-l,h=0<b?0:-b,n.h(f,h),r.h(k+f,m+h),a.push(new L(Math.min(n.x,r.x),Math.min(n.y,r.y),Math.abs(n.x-r.x),Math.abs(n.y-r.y))),Qb(n,x),Qb(r,x),e.push(new L(Math.min(n.x,r.x),Math.min(n.y,r.y),Math.abs(n.x-r.x),Math.abs(n.y-r.y))));G.free(n);G.free(r);gj(this,!1);null===this.Ia&&A("No div specified");null===this.Da&&A("No canvas specified");
if(!this.animationManager.rb&&(f=this.Yc,this.oc)){pj(this);h=this.$b;f.setTransform(1,0,0,1,0,0);f.clearRect(0,0,this.xa*h,this.wa*h);f.rt(!1);f.drawImage(this.Qt.Ga,0<l?0:Math.round(-l),0<b?0:Math.round(-b));l=this.sa;g=this.Ca;k=Math.round(l.x*g)/g;m=Math.round(l.y*g)/g;b=this.tb;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.Pa.j;l=b.length;this.hd(b,l,this);qj(this,f);for(h=0;h<l;h++)if(p=b[h],g=e,p.visible&&0!==p.lb){1!==p.lb&&(f.globalAlpha=p.lb);k=p.Go;k.length=0;m=this.scale;p=p.Fa.j;n=p.length;q=g.length;for(r=0;r<n;r++)if(x=p[r],ng(x)){if(x instanceof S&&(x.isOrthogonal&&k.push(x),!1===x.Kc))continue;u=xj(x,x.actualBounds);a:{var v=2/m;for(var y=4/m,z=0;z<q;z++){var B=g[z];if(0!==B.width&&0!==B.height&&u.cv(B.x-
v,B.y-v,B.width+y,B.height+y)){v=!0;break a}}v=!1}v&&(1<u.width*m||1<u.height*m?x.ic(f,this):gi(f,x))}f.globalAlpha=1}f.restore();f.Qc(!0);this.Zh&&rj(this.Zh,this)&&this.$q();this.oc=this.ai=!1;this.lt()}Oa(e);Oa(a);this.Yb=!1}}else this.fd();L.free(d);c&&(this.ue=1,this.fd(),Tf(this,!0))}else c?(this.ue=1,this.fd(),Tf(this,!0)):this.fd()}};function fj(a){!1===a.ij&&(a.ij=!0)}function Ni(a){!1===a.ai&&(a.ai=!0)}function pj(a){!1!==a.Mn&&(a.Mn=!1,yj(a,a.xa,a.wa))}
function yj(a,b,c){var d=a.$b;a.Da.resize(b*d,c*d,b,c)&&(a.oc=!0,a.Yc.Qc(!0))}
function Li(a){var b=a.Da;if(null===b)return!0;var c=a.Ia,d=a.xa,e=a.wa,f=a.Kw.copy();if(!f.s())return!0;var g=!1,h=a.Yh?a.Gb:0,k=a.Mg?a.Gb:0,l=c.clientWidth||d+h;c=c.clientHeight||e+k;if(l!==d+h||c!==e+k)a.Yh=!1,a.Mg=!1,k=h=0,a.xa=l,a.wa=c,g=a.Mn=!0;a.ij=!1;var m=a.documentBounds,n=0,p=0,q=0,r=0;l=f.width;c=f.height;var u=a.pi;a.contentAlignment.gb()?(m.width>l&&(n=u.left,p=u.right),m.height>c&&(q=u.top,r=u.bottom)):(n=u.left,p=u.right,q=u.top,r=u.bottom);u=m.width+n+p;var x=m.height+q+r;n=m.x-n;
var v=f.x;p=m.right+p;var y=f.right+h;q=m.y-q;var z=f.y;r=m.bottom+r;var B=f.bottom+k,C="1px",I="1px";m=a.scale;var J=!(u<l+h),M=!(x<c+k);a.scrollMode===mi&&(J||M)&&(J&&a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(C=1,n+1<v&&(C=Math.max((v-n)*m+a.xa,C)),p>y+1&&(C=Math.max((p-y)*m+a.xa,C)),l+h+1<u&&(C=Math.max((u-l+h)*m+a.xa,C)),C=C.toString()+"px"),M&&a.hasVerticalScrollbar&&a.allowVerticalScroll&&(I=1,q+1<z&&(I=Math.max((z-q)*m+a.wa,I)),r>B+1&&(I=Math.max((r-B)*m+a.wa,I)),c+k+1<x&&(I=Math.max((x-
c+k)*m+a.wa,I)),I=I.toString()+"px"));M="1px"!==C;J="1px"!==I;M&&J||!M&&!J||(J&&(y-=a.Gb),M&&(B-=a.Gb),u<l+h||!a.hasHorizontalScrollbar||!a.allowHorizontalScroll||(h=1,n+1<v&&(h=Math.max((v-n)*m+a.xa,h)),p>y+1&&(h=Math.max((p-y)*m+a.xa,h)),l+1<u&&(h=Math.max((u-l)*m+a.xa,h)),C=h.toString()+"px"),M="1px"!==C,h=a.wa,M!==a.Mg&&(h=M?a.wa-a.Gb:a.wa+a.Gb),x<c+k||!a.hasVerticalScrollbar||!a.allowVerticalScroll||(k=1,q+1<z&&(k=Math.max((z-q)*m+h,k)),r>B+1&&(k=Math.max((r-B)*m+h,k)),c+1<x&&(k=Math.max((x-
c)*m+h,k)),I=k.toString()+"px"),J="1px"!==I);if(a.gs&&M===a.Mg&&J===a.Yh)return d===a.xa&&e===a.wa||a.fd(),!1;M!==a.Mg&&("1px"===C?a.wa=a.wa+a.Gb:a.wa=Math.max(a.wa-a.Gb,1),g=!0);a.Mg=M;a.bp.style.width=C;J!==a.Yh&&("1px"===I?a.xa=a.xa+a.Gb:a.xa=Math.max(a.xa-a.Gb,1),g=!0,a.Qn&&(k=G.alloc(),J?(b.style.left=a.Gb+"px",a.position=k.h(a.sa.x+a.Gb/a.scale,a.sa.y)):(b.style.left="0px",a.position=k.h(a.sa.x-a.Gb/a.scale,a.sa.y)),G.free(k)));a.Yh=J;a.bp.style.height=I;a.qu=!0;g&&(a.Mn=!0);b=a.ks;k=b.scrollLeft;
a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(l+1<u?k=(a.position.x-n)*m:n+1<v?k=b.scrollWidth-b.clientWidth:p>y+1&&(k=a.position.x*m));if(a.Qn)switch(a.ou){case "negative":k=-(b.scrollWidth-k-b.clientWidth);break;case "reverse":k=b.scrollWidth-k-b.clientWidth}b.scrollLeft=k;a.hasVerticalScrollbar&&a.allowVerticalScroll&&(c+1<x?b.scrollTop=(a.position.y-q)*m:q+1<z?b.scrollTop=b.scrollHeight-b.clientHeight:r>B+1&&(b.scrollTop=a.position.y*m));l=a.xa;c=a.wa;b.style.width=l+(a.Yh?a.Gb:0)+"px";
b.style.height=c+(a.Mg?a.Gb:0)+"px";return d!==l||e!==c||a.animationManager.rb?(a.fq(f,a.viewportBounds,m,g),!1):!0}
t.add=function(a){var b=a.diagram;if(b!==this&&(null!==b&&A("Cannot add part "+a.toString()+" to "+this.toString()+". It is already a part of "+b.toString()),b=this.Xl(a.layerName),null===b&&(b=this.Xl("")),null===b&&A('Cannot add a Part when unable find a Layer named "'+a.layerName+'" and there is no default Layer'),a.layer!==b)){var c=b.Li(99999999,a,a.diagram===this);0<=c&&this.ab(cf,"parts",b,null,a,null,c);b.isTemporary||this.Xa();a.B(1);c=a.layerChanged;null!==c&&c(a,null,b)}};
t.Li=function(a){this.partManager.Li(a);var b=this;zj(a,function(a){Aj(b,a)});(a instanceof pf||a instanceof hg&&null!==a.placeholder)&&a.o();null!==a.data&&zj(a,function(a){Bj(b.partManager,a)});!0!==nj(a)&&!0!==oj(a)||this.Dd.add(a);Cj(a,!0,this);Dj(a)?(a.actualBounds.s()&&this.R(xj(a,a.actualBounds)),this.Xa()):a.isVisible()&&a.actualBounds.s()&&this.R(xj(a,a.actualBounds));this.cc()};
t.xc=function(a){a.Pj();this.partManager.xc(a);var b=this;zj(a,function(a){Ej(b,a)});null!==a.data&&zj(a,function(a){Fj(b.partManager,a)});this.Dd.remove(a);Dj(a)?(a.actualBounds.s()&&this.R(xj(a,a.actualBounds)),this.Xa()):a.isVisible()&&a.actualBounds.s()&&this.R(xj(a,a.actualBounds));this.cc()};t.remove=function(a){Gj(this,a,!0)};
function Gj(a,b,c){var d=b.layer;if(null!==d&&d.diagram===a){b.isSelected=!1;b.isHighlighted=!1;var e=a.animationManager;e.We&&b.Lb()&&e.animationReasons.contains("Remove")&&e.jg(b,"scale",b.scale,.01,!1);b.B(2);c&&b.Vj();c=d.xc(-1,b,!1);0<=c&&a.ab(df,"parts",d,b,null,c,null);a=b.layerChanged;null!==a&&a(b,d,null)}}
t.nt=function(a,b){if(Ea(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.Uj=function(a,b,c){return this.partManager.Uj(a,b,c)};
P.prototype.moveParts=function(a,b,c,d){void 0===d&&(d=Hj(this));if(null!==this.toolManager){var e=new Lb;if(null!==a)if(Ea(a))for(var f=0;f<a.length;f++)Ij(this,e,a[f],c,d);else for(a=a.iterator;a.next();)Ij(this,e,a.value,c,d);else{for(a=this.parts;a.next();)Ij(this,e,a.value,c,d);for(a=this.nodes;a.next();)Ij(this,e,a.value,c,d);for(a=this.links;a.next();)Ij(this,e,a.value,c,d)}ag(this,e,b,d,c)}};
function Ij(a,b,c,d,e){void 0===e&&(e=Hj(a));if(!b.contains(c)&&(!d||c.canMove()||c.canCopy()))if(c instanceof V){b.add(c,a.pd(e,c,c.location));if(c instanceof hg)for(var f=c.memberParts;f.next();)Ij(a,b,f.value,d,e);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)&&Ij(a,b,g,d,e)}}if(e.dragsTree)for(c=c.Vu();c.next();)Ij(a,b,c.value,d,e)}else if(c instanceof S)for(b.add(c,a.pd(e,c)),c=c.labelNodes;c.next();)Ij(a,
b,c.value,d,e);else c instanceof pf||b.add(c,a.pd(e,c,c.location))}
function ag(a,b,c,d,e){if(null!==b&&0!==b.count){var f=G.alloc(),g=G.alloc();g.assign(c);isNaN(g.x)&&(g.x=0);isNaN(g.y)&&(g.y=0);(c=a.rp)||Kf(a,b);for(var h=Ka(),k=Ka(),l=b.iterator,m=G.alloc();l.next();){var n=l.key,p=l.value;if(n.Lb()){var q=Jj(a,n,b);if(null!==q)h.push(new Kj(n,p,q));else if(!e||n.canMove())q=p.point,f.assign(q),a.computeMove(n,f.add(g),d,m),n.location=m,void 0===p.shifted&&(p.shifted=new G),p.shifted.assign(m.Wd(q))}else l.key instanceof S&&k.push(l.na)}G.free(m);e=h.length;for(l=
0;l<e;l++)n=h[l],f.assign(n.info.point),void 0===n.$u.shifted&&(n.$u.shifted=new G),n.node.location=f.add(n.$u.shifted);e=G.alloc();l=G.alloc();n=k.length;for(p=0;p<n;p++){var r=k[p];q=r.key;if(q instanceof S)if(q.suspendsRouting){m=q.fromNode;var u=q.toNode;if(null!==a.draggedLink&&d.dragsLink)if(u=r.value.point,null===q.dragComputation)b.add(q,a.pd(d,q,g)),Zf(q,g.x-u.x,g.y-u.y);else{r=G.allocAt(0,0);(m=q.i(0))&&m.s()&&r.assign(m);var x=m=G.alloc().assign(r).add(g);d.isGridSnapEnabled&&(d.isGridSnapRealtime||
a.lastInput.up)&&(x=G.alloc(),eh(a,q,m,x,d));m.assign(q.dragComputation(q,m,x)).Wd(r);b.add(q,a.pd(d,q,m));Zf(q,m.x-u.x,m.y-u.y);G.free(r);G.free(m);x!==m&&G.free(x)}else null!==m&&(e.assign(m.location),x=b.J(m),null!==x&&e.Wd(x.point)),null!==u&&(l.assign(u.location),x=b.J(u),null!==x&&l.Wd(x.point)),null!==m&&null!==u?e.Qa(l)?(m=r.value.point,u=f,u.assign(e),u.Wd(m),b.add(q,a.pd(d,q,e)),Zf(q,u.x,u.y)):(q.suspendsRouting=!1,q.Ra()):(r=r.value.point,m=null!==m?e:null!==u?l:g,b.add(q,a.pd(d,q,m)),
Zf(q,m.x-r.x,m.y-r.y))}else if(null===q.fromNode||null===q.toNode)m=r.value.point,b.add(q,a.pd(d,q,g)),Zf(q,g.x-m.x,g.y-m.y)}G.free(f);G.free(g);G.free(e);G.free(l);Oa(h);Oa(k);c||(Oi(a),Pf(a,b))}}
P.prototype.computeMove=function(a,b,c,d){void 0===d&&(d=new G);d.assign(b);if(null===a)return d;var e=b,f=c.isGridSnapEnabled;f&&(c.isGridSnapRealtime||this.lastInput.up)&&(e=G.alloc(),eh(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&&G.free(e);return d};function Hj(a){var b=a.toolManager.findTool("Dragging");return null!==b?b.dragOptions:a.Ik}
function eh(a,b,c,d,e){void 0===e&&(e=Hj(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=G.allocAt(0,0);f.mk(0,0,a,b,e);H.Qp(c.x,c.y,h+f.x,g+f.y,a,b,d);G.free(f)}}function Kf(a,b){if(null!==b)for(a.rp=!0,a=b.iterator;a.next();)b=a.key,b instanceof S&&(b.suspendsRouting=!0)}
function Pf(a,b){if(null!==b){for(b=b.iterator;b.next();){var c=b.key;c instanceof S&&(c.suspendsRouting=!1,Lj(c)&&c.Ra())}a.rp=!1}}function Jj(a,b,c){b=b.containingGroup;if(null!==b){a=Jj(a,b,c);if(null!==a)return a;a=c.J(b);if(null!==a)return a}return null}t=P.prototype;t.pd=function(a,b,c){if(void 0===c)return new Nf(ac);var d=a.isGridSnapEnabled;a.fz||null===b.containingGroup||(d=!1);return d?new Nf(new G(Math.round(c.x),Math.round(c.y))):new Nf(c.copy())};
function Mj(a,b,c){null!==b.diagram&&b.diagram!==a&&A("Cannot share a Layer with another Diagram: "+b+" of "+b.diagram);null===c?null!==b.diagram&&A("Cannot add an existing Layer to this Diagram again: "+b):(c.diagram!==a&&A("Existing Layer must be in this Diagram: "+c+" not in "+c.diagram),b===c&&A("Cannot move a Layer before or after itself: "+b));if(b.diagram!==a){b=b.name;a=a.Pa;c=a.count;for(var d=0;d<c;d++)a.N(d).name===b&&A("Cannot add Layer with the name '"+b+"'; a Layer with the same name is already present in this Diagram.")}}
t.Nl=function(a){Mj(this,a,null);a.hb(this);var b=this.Pa,c=b.count-1;if(!a.isTemporary)for(;0<=c&&b.N(c).isTemporary;)c--;b.Ib(c+1,a);null!==this.Zb&&this.ab(cf,"layers",this,null,a,null,c+1);this.R();this.Xa()};t.Ow=function(a,b){Mj(this,a,b);a.hb(this);var c=this.Pa,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.Zb&&this.ab(df,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.N(f)===b){c.Ib(f,a);break}null!==this.Zb&&this.ab(cf,"layers",this,null,a,null,f);this.R();0>d&&this.Xa()};
t.$x=function(a,b){Mj(this,a,b);a.hb(this);var c=this.Pa,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.Zb&&this.ab(df,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.N(f)===b){c.Ib(f+1,a);break}null!==this.Zb&&this.ab(cf,"layers",this,null,a,null,f+1);this.R();0>d&&this.Xa()};
t.Fz=function(a){a.diagram!==this&&A("Cannot remove a Layer from another Diagram: "+a+" of "+a.diagram);if(""!==a.name){var b=this.Pa,c=b.indexOf(a);if(b.remove(a)){for(b=a.Fa.copy().iterator;b.next();){var d=b.value,e=d.layerName;e!==a.name?d.layerName=e:d.layerName=""}null!==this.Zb&&this.ab(df,"layers",this,a,null,c,null);this.R();this.Xa()}}};t.Xl=function(a){for(var b=this.layers;b.next();){var c=b.value;if(c.name===a)return c}return null};
t.Qw=function(a){null===this.me&&(this.me=new E);this.me.add(a);this.model.oh(a)};t.Hz=function(a){null!==this.me&&(this.me.remove(a),0===this.me.count&&(this.me=null));this.model.lk(a)};t.oh=function(a){null===this.yf&&(this.yf=new E);this.yf.add(a)};t.lk=function(a){null!==this.yf&&(this.yf.remove(a),0===this.yf.count&&(this.yf=null))};t.Fs=function(a){this.skipsUndoManager||this.undoManager.av(a);a.change!==bf&&(this.isModified=!0);if(null!==this.yf)for(var b=this.yf,c=b.length,d=0;d<c;d++)b.N(d)(a)};
t.ab=function(a,b,c,d,e,f,g){void 0===f&&(f=null);void 0===g&&(g=null);var h=new $e;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.Fs(h)};t.g=function(a,b,c,d,e){this.ab(af,a,this,b,c,d,e)};
t.Oj=function(a,b){if(null!==a&&a.diagram===this){var c=this.skipsModelSourceBindings;try{this.skipsModelSourceBindings=!0;var d=a.change;if(d===af){var e=a.object;Nj(e,a.propertyName,a.J(b));if(e instanceof Y){var f=e.part;null!==f&&f.Jb()}this.isModified=!0}else if(d===cf){var g=a.object,h=a.newParam,k=a.newValue;if(g instanceof X)if("number"===typeof h&&k instanceof Y){b?g.xc(h):g.Ib(h,k);var l=g.part;null!==l&&l.Jb()}else{if("number"===typeof h&&k instanceof Oj)if(b)k.isRow?g.wv(h):g.uv(h);else{var m=
k.isRow?g.getRowDefinition(k.index):g.getColumnDefinition(k.index);m.Tl(k)}}else if(g instanceof di){var n=!0===a.oldParam;"number"===typeof h&&k instanceof T&&(b?(k.isSelected=!1,k.isHighlighted=!1,k.Jb(),g.xc(n?h:-1,k,n)):g.Li(h,k,n))}else g instanceof P?"number"===typeof h&&k instanceof di&&(b?this.Pa.mb(h):(k.hb(this),this.Pa.Ib(h,k))):A("unknown ChangedEvent.Insert object: "+a.toString());this.isModified=!0}else if(d===df){var p=a.object,q=a.oldParam,r=a.oldValue;if(p instanceof X)"number"===
typeof q&&r instanceof Y?b?p.Ib(q,r):p.xc(q):"number"===typeof q&&r instanceof Oj&&(b?(m=r.isRow?p.getRowDefinition(r.index):p.getColumnDefinition(r.index),m.Tl(r)):r.isRow?p.wv(q):p.uv(q));else if(p instanceof di){var u=!0===a.newParam;"number"===typeof q&&r instanceof T&&(b?0>p.Fa.indexOf(r)&&p.Li(q,r,u):(r.isSelected=!1,r.isHighlighted=!1,r.Jb(),p.xc(u?q:-1,r,u)))}else p instanceof P?"number"===typeof q&&r instanceof di&&(b?(r.hb(this),this.Pa.Ib(q,r)):this.Pa.mb(q)):A("unknown ChangedEvent.Remove object: "+
a.toString());this.isModified=!0}else d!==bf&&A("unknown ChangedEvent: "+a.toString())}finally{this.skipsModelSourceBindings=c}}};t.Aa=function(a){return this.undoManager.Aa(a)};t.Za=function(a){return this.undoManager.Za(a)};t.tf=function(){return this.undoManager.tf()};
P.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.Aa(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.Za(b):this.undoManager.tf(),this.skipsUndoManager=c}};P.prototype.updateAllTargetBindings=function(a){this.partManager.updateAllTargetBindings(a)};t=P.prototype;t.qq=function(){this.partManager.qq()};
function Pj(a,b,c){var d=a.animationManager;if(a.ob||a.Yb)a.Ca=c,d.rb&&ci(d,b,a.Ca);else if(a.ob=!0,null===a.Da)a.Ca=c;else{var e=a.viewportBounds.copy(),f=a.xa,g=a.wa;e.width=a.xa/b;e.height=a.wa/b;var h=a.zoomPoint.x,k=a.zoomPoint.y,l=a.contentAlignment;isNaN(h)&&(l.qf()?l.pf(jd)?h=0:l.pf(pd)&&(h=f-1):h=l.gb()?l.x*(f-1):f/2);isNaN(k)&&(l.qf()?l.pf(id)?k=0:l.pf(qd)&&(k=g-1):k=l.gb()?l.y*(g-1):g/2);null!==a.scaleComputation&&(c=a.scaleComputation(a,c));c<a.minScale&&(c=a.minScale);c>a.maxScale&&(c=
a.maxScale);f=G.allocAt(a.sa.x+h/b-h/c,a.sa.y+k/b-k/c);a.position=f;G.free(f);a.Ca=c;a.fq(e,a.viewportBounds,b,!1);a.ob=!1;Qi(a,!1);d.rb&&ci(d,b,a.Ca);a.R();fj(a)}}
t.fq=function(a,b,c,d){if(!a.A(b)){void 0===d&&(d=!1);d||fj(this);Ni(this);var e=this.layout;null===e||!e.isViewportSized||this.autoScale!==ni||d||a.width===b.width&&a.height===b.height||e.B();e=this.currentTool;!0===this.ge&&e instanceof Ua&&(this.lastInput.documentPoint=this.vt(this.lastInput.viewPoint),tf(e,this));this.ob||this.lx(a,b);ij(this);this.we.scale=c;this.we.position.x=a.x;this.we.position.y=a.y;this.we.bounds.assign(a);this.we.nx=d;this.aa("ViewportBoundsChanged",this.we,a);this.isVirtualized&&
this.links.each(function(a){a.isAvoiding&&a.actualBounds.Ic(b)&&a.Ra()})}};
function ij(a,b){void 0===b&&(b=null);var c=a.Eb;if(null!==c&&c.visible){for(var d=K.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||(Qj(l.figure)?f=f*m/H.ix(f,m):e=e*m/H.ix(e,m))}g=c.gridCellSize;d.h(f*g.width,e*g.height);if(null!==b)e=b.width,f=b.height,a=b.x,g=b.y;else{b=L.alloc();a=a.viewportBounds;b.h(a.x,a.y,a.width,a.height);if(!b.s()){L.free(b);return}e=b.width;f=b.height;a=b.x;g=b.y;L.free(b)}c.width=e+2*d.width;c.height=f+2*d.height;b=G.alloc();H.Qp(a,g,0,0,
d.width,d.height,b);b.offset(-d.width,-d.height);K.free(d);c.part.location=b;G.free(b)}}t.Gs=function(){var a=0<this.selection.count;a&&this.aa("ChangingSelection",this.selection);Hf(this);a&&this.aa("ChangedSelection",this.selection)};function Hf(a){a=a.selection;if(0<a.count){for(var b=a.Na(),c=b.length,d=0;d<c;d++)b[d].isSelected=!1;a.ha();a.clear();a.freeze()}}
t.select=function(a){null!==a&&a.layer.diagram===this&&(!a.isSelected||1<this.selection.count)&&(this.aa("ChangingSelection",this.selection),Hf(this),a.isSelected=!0,this.aa("ChangedSelection",this.selection))};
t.Cv=function(a){this.aa("ChangingSelection",this.selection);Hf(this);if(Ea(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];d instanceof T||A("Diagram.selectCollection given something that is not a Part: "+d);d.isSelected=!0}else for(a=a.iterator;a.next();)b=a.value,b instanceof T||A("Diagram.selectCollection given something that is not a Part: "+b),b.isSelected=!0;this.aa("ChangedSelection",this.selection)};
t.Sw=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.ha();a.clear();a.freeze()}};t.hz=function(a){null!==a&&a.layer.diagram===this&&(!a.isHighlighted||1<this.highlighteds.count)&&(this.Sw(),a.isHighlighted=!0)};
t.iz=function(a){a=(new F).addAll(a);for(var b=this.highlighteds.copy().iq(a).iterator;b.next();)b.value.isHighlighted=!1;for(a=a.iterator;a.next();)b=a.value,b instanceof T||A("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=G.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));G.free(d);return}A("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:A("scrolling direction must be 'up', 'down', 'left', or 'right', not: "+b);this.position=c};
t.Bv=function(a){var b=this.viewportBounds;b.mf(a)||(a=a.center,a.x-=b.width/2,a.y-=b.height/2,this.position=a)};t.Gu=function(a){var b=this.viewportBounds;a=a.center;a.x-=b.width/2;a.y-=b.height/2;this.position=a};t.ut=function(a){var b=this.tb;b.reset();1!==this.Ca&&b.scale(this.Ca);var c=this.sa;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return a.copy().transform(this.tb)};
t.Sz=function(a){var b=this.tb,c=a.x,d=a.y,e=c+a.width,f=d+a.height,g=b.m11,h=b.m12,k=b.m21,l=b.m22,m=b.dx,n=b.dy,p=c*g+d*k+m;b=c*h+d*l+n;var q=e*g+d*k+m;a=e*h+d*l+n;d=c*g+f*k+m;c=c*h+f*l+n;g=e*g+f*k+m;e=e*h+f*l+n;f=Math.min(p,q);p=Math.max(p,q);q=Math.min(b,a);b=Math.max(b,a);f=Math.min(f,d);p=Math.max(p,d);q=Math.min(q,c);b=Math.max(b,c);f=Math.min(f,g);p=Math.max(p,g);q=Math.min(q,e);b=Math.max(b,e);return new L(f,q,p-f,b-q)};
t.vt=function(a){var b=this.tb;b.reset();1!==this.Ca&&b.scale(this.Ca);var c=this.sa;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return Qb(a.copy(),this.tb)};function Rj(a){var b=a.isModified;a.Lw!==b&&(a.Lw=b,a.aa("Modified"))}function Sj(a){a=qi.get(a);return null!==a?new a:new ri}
P.prototype.doModelChanged=function(a){if(a.model===this.model){var b=a.change,c=a.propertyName;if(b===bf&&"S"===c[0])if("StartingFirstTransaction"===c){var d=this;a=this.toolManager;a.mouseDownTools.each(function(a){a.hb(d)});a.mouseMoveTools.each(function(a){a.hb(d)});a.mouseUpTools.each(function(a){a.hb(d)});this.Yb||this.fe||(this.Ok=!0,this.Tk&&(this.qd=!0))}else"StartingUndo"===c||"StartingRedo"===c?(a=this.animationManager,a.isAnimating&&!this.skipsUndoManager&&a.vd(),this.aa("ChangingSelection",
this.selection)):"StartedTransaction"===c&&(a=this.animationManager,a.isAnimating&&!this.skipsUndoManager&&a.vd());else if(this.da){this.da=!1;try{if(""===a.modelChange&&b===bf){if("FinishedUndo"===c||"FinishedRedo"===c)this.aa("ChangedSelection",this.selection),Oi(this);var e=this.animationManager;"RolledBackTransaction"===c&&e.vd();this.Ok=!0;this.fd();0===this.undoManager.transactionLevel&&Ph(e);"CommittedTransaction"===c&&this.undoManager.$t&&(this.ee=Math.min(this.ee,this.undoManager.historyIndex-
1));var f=a.isTransactionFinished;f&&(Rj(this),this.dt.clear());if(!this.hu&&f){this.hu=!0;var g=this;ua(function(){g.currentTool.standardMouseOver();g.hu=!1},10)}}}finally{this.da=!0}}}};function Aj(a,b){b=b.W.j;for(var c=b.length,d=0;d<c;d++)Wj(a,b[d])}
function Wj(a,b){if(b instanceof ak){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){var d=b.Hg;null!==d&&(d.Vk instanceof Event&&null!==b.Cc&&b.Cc(b,d.Vk),!0===d.On&&(null!==b.ef&&b.ef(b,d.pu),null!==b.diagram&&b.diagram.ju.add(b)));c=c.src;d=a.Aj.J(c);if(null===d)d=[],d.push(b),a.Aj.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}}function Ej(a,b){b=b.W.j;for(var c=b.length,d=0;d<c;d++)bk(a,b[d])}
function bk(a,b){if(b instanceof ak){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){c=c.src;var d=a.Aj.J(c);if(null!==d)for(var e=0;e<d.length;e++)if(d[e]===b){d.splice(e,1);0===d.length&&(a.Aj.remove(c),ck(c));break}}}}P.prototype.ud=function(){this.partManager.ud()};P.prototype.Gp=function(a,b){this.vk.Gp(a,b)};P.prototype.Hp=function(a,b){this.vk.Hp(a,b)};P.prototype.findPartForKey=function(a){return this.partManager.findPartForKey(a)};t=P.prototype;t.Hb=function(a){return this.partManager.Hb(a)};
t.vc=function(a){return this.partManager.vc(a)};t.Ci=function(a){return this.partManager.Ci(a)};t.uc=function(a){return this.partManager.uc(a)};t.Ps=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.Ps.apply(this.partManager,b instanceof Array?b:ca(ba(b)))};t.Os=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.Os.apply(this.partManager,b instanceof Array?b:ca(ba(b)))};
function Ti(a,b){a.Ng=!1;var c=a.sn;c.A(b)||(b=b.I(),a.sn=b,Qi(a,!1),a.aa("DocumentBoundsChanged",null,c.copy()),fj(a))}t.Py=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.Oy=function(){return this.wi.iterator};t.sz=function(a){Oi(this);a&&dk(this,!0);this.Ok=!0;og(this)};
function dk(a,b){for(var c=a.wi.iterator;c.next();)ek(a,c.value,b);null!==a.layout&&(b?a.layout.isValidLayout=!1:a.layout.B())}function ek(a,b,c){if(null!==b){for(var d=b.nl.iterator;d.next();)ek(a,d.value,c);null!==b.layout&&(c?b.layout.isValidLayout=!1:b.layout.B())}}
function jj(a,b){if(a.yg&&!a.Mt){var c=a.da;a.da=!0;var d=a.undoManager.transactionLevel,e=a.layout;try{0===d&&a.Aa("Layout");var f=a.animationManager;1>=d&&!f.isAnimating&&!f.rb&&(b||f.Pi("Layout"));a.yg=!1;for(var g=a.wi.iterator;g.next();)fk(a,g.value,b,d);e.isValidLayout||(!b||e.isRealtime||null===e.isRealtime||0===d?(e.doLayout(a),Oi(a),e.isValidLayout=!0):a.yg=!0)}finally{0===d&&a.Za("Layout"),a.yg=!e.isValidLayout,a.da=c}}}
function fk(a,b,c,d){if(null!==b){for(var e=b.nl.iterator;e.next();)fk(a,e.value,c,d);e=b.layout;null===e||e.isValidLayout||(!c||e.isRealtime||0===d?(b.jk=!b.location.s(),e.doLayout(b),b.B(32),lj(a,b),e.isValidLayout=!0):a.yg=!0)}}t.Vy=function(){for(var a=new E,b=this.nodes;b.next();){var c=b.value;c.isTopLevel&&null===c.Fi()&&a.add(c)}return a.iterator};
function oi(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 Lb,d=new Lb;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.Ot=c;a.Nt=d}
function uj(a,b){var c=a.Nt.J(b);return null!==c?c:a.Nt.J(b.toLowerCase())}function gk(a,b){var c=a.Ot.J(b);if(null!==c)return c;c=a.Ot.J(b.toLowerCase());if(null!==c)return c;A("Unknown DiagramEvent name: "+b);return null}t.Kj=function(a,b){a=gk(this,a);null!==a&&a.add(b)};t.km=function(a,b){a=gk(this,a);null!==a&&a.remove(b)};
t.aa=function(a,b,c){var d=gk(this,a),e=new Ze;e.diagram=this;a=uj(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.N(0)(e);else if(0!==b)for(d=d.Na(),c=0;c<b;c++)(0,d[c])(e)};function hk(a){if(a.animationManager.isAnimating)return!1;var b=a.currentTool;return b===a.toolManager.findTool("Dragging")?!a.rp||b.isComplexRoutingRealtime:!0}t.bk=function(a,b){void 0===b&&(b=null);return ik(this,!1,null,b).bk(a.x,a.y,a.width,a.height)};
P.prototype.computeOccupiedArea=function(){return this.isVirtualized?this.viewportBounds.copy():this.Ng?Pi(this):this.documentBounds.copy()};
function ik(a,b,c,d){null===a.Nb&&(a.Nb=new jk);if(a.Nb.Ys||a.Nb.group!==c||a.Nb.Hx!==d){if(null===c){b=a.computeOccupiedArea();b.Tc(100,100);a.Nb.initialize(b);b=L.alloc();for(var e=a.nodes;e.next();){var f=e.value,g=f.layer;null!==g&&g.visible&&!g.isTemporary&&kk(a,f,d,b)}L.free(b)}else{0<c.memberParts.count&&(b=a.computePartsBounds(c.memberParts,!1),b.Tc(20,20),a.Nb.initialize(b));b=L.alloc();for(e=c.memberParts;e.next();)f=e.value,f instanceof V&&kk(a,f,d,b);L.free(b)}a.Nb.group=c;a.Nb.Hx=d;a.Nb.Ys=
!1}else b&&lk(a.Nb);return a.Nb}function kk(a,b,c,d){if(b!==c)if(b.isVisible()&&b.avoidable&&!b.isLinkLabel){var e=b.getAvoidableRect(d),f=a.Nb.Sl;c=a.Nb.Rl;d=e.x+e.width;b=e.y+e.height;for(var g=e.x;g<d;g+=f){for(var h=e.y;h<b;h+=c)mk(a.Nb,g,h);mk(a.Nb,g,b)}for(e=e.y;e<b;e+=c)mk(a.Nb,d,e);mk(a.Nb,d,b)}else if(b instanceof hg)for(b=b.memberParts;b.next();)e=b.value,e instanceof V&&kk(a,e,c,d)}
function nk(a,b){null!==a.Nb&&!a.Nb.Ys&&(void 0===b&&(b=null),null===b||b.avoidable&&!b.isLinkLabel)&&(a.Nb.Ys=!0)}t=P.prototype;t.Ks=function(a){this.Eq.assign(a);ok(this,this.Eq).Qa(this.position)?this.uf():pk(this)};
function pk(a){-1===a.yk&&(a.yk=ua(function(){if(-1!==a.yk&&(a.uf(),null!==a.lastInput.event)){var b=ok(a,a.Eq);b.Qa(a.position)||(a.position=b,a.lastInput.documentPoint=a.vt(a.Eq),a.doMouseMove(),a.Ng=!0,Ti(a,a.documentBounds.copy().Uc(a.computeBounds())),a.oc=!0,a.fd(),pk(a))}},a.Qm))}t.uf=function(){-1!==this.yk&&(w.clearTimeout(this.yk),this.yk=-1)};
function ok(a,b){var c=a.position,d=a.Rm;if(0>=d.top&&0>=d.left&&0>=d.right&&0>=d.bottom)return c;var e=a.viewportBounds,f=a.scale;e=L.allocAt(0,0,e.width*f,e.height*f);var g=G.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.Qa(ac)||(c=new G(c.x+g.x/f,c.y+g.y/f));L.free(e);G.free(g);return c}t.ft=function(){return null};t.hv=function(){return null};t.gy=function(a,b){this.mu.add(a,b)};
t.vz=function(a){if(!sh)return null;void 0===a&&(a=new tb);a.returnType="Image";return this.ox(a)};t.ox=function(a){function b(){var k=+new Date;d=!0;for(e.reset();e.next();)if(!e.value[0].jl){d=!1;break}d||k-g>f?qk(h,a,c):w.requestAnimationFrame(b)}void 0===a&&(a=new tb);for(var c=a.callback,d=!0,e=this.Aj.iterator;e.next();)if(!e.value[0].jl){d=!1;break}if("function"!==typeof c||d)return qk(this,a,c);var f=a.callbackTimeout||300,g=+new Date,h=this;w.requestAnimationFrame(function(){b()});return null};
function qk(a,b,c){var d=rk(a,b,"canvas",null);if(null===d)return null;a=d.V.canvas;var e=null;if(null!==a)switch(e=b.returnType,void 0===e?e="string":e=e.toLowerCase(),e){case "imagedata":e=d.getImageData(0,0,a.width,a.height);break;case "image":d=(b.document||document).createElement("img");d.src=a.toDataURL(b.type,b.details);e=d;break;case "blob":"function"!==typeof c&&A('Error: Diagram.makeImageData called with "returnType: toBlob", but no required "callback" function property defined.');if("function"===
typeof a.toBlob)return a.toBlob(c,b.type,b.details),"toBlob";if("function"===typeof a.msToBlob)return c(a.msToBlob()),"msToBlob";c(null);return null;default:e=a.toDataURL(b.type,b.details)}return"function"===typeof c?(c(e),null):e}
function rk(a,b,c,d){a.animationManager.vd();a.fd();if(null===a.Da)return null;"object"!==typeof b&&A("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 K(Infinity,Infinity):new K(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,q=b.elementFinished||null,r=b.showTemporary;
void 0===r&&(r=!n);b=b.showGrid;void 0===b&&(b=r);null!==e&&isNaN(e.width)&&isNaN(e.height)&&(e=null);"number"===typeof l?l=new Ic(l):l instanceof Ic||A("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.Yc.Qc(!0);n=new sk(null,p);var u=n.context;if(!(e||f||k||h)){n.width=a.xa+Math.ceil(l.left+l.right);n.height=a.wa+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.Np=q;sj(a,d.context,l,new K(n.width,n.height),a.Ca,a.sa,k,m,r,b);return d.context}a.un=!1;sj(a,u,l,new K(n.width,n.height),a.Ca,a.sa,k,m,r,b);a.un=!0;return n.context}var x=a.Wq,v=a.documentBounds.copy();v.Kv(a.eb);if(r)for(var y=a.Pa.j,z=y.length,B=0;B<z;B++){var C=y[B];if(C.visible&&C.isTemporary){C=C.Fa.j;for(var I=C.length,J=0;J<I;J++){var M=C[J];M.isInDocumentBounds&&M.isVisible()&&(M=M.actualBounds,M.s()&&v.Uc(M))}}}y=new G(v.x,v.y);if(null!==k){z=
!0;B=k.iterator;for(B.reset();B.next();)if(C=B.value,C instanceof T&&(I=C.layer,(null===I||I.visible)&&(null===I||r||!I.isTemporary)&&C.isVisible()&&(C=C.actualBounds,C.s())))if(z){z=!1;var U=C.copy()}else U.Uc(C);z&&(U=new L(0,0,0,0));v.width=U.width;v.height=U.height;y.x=U.x;y.y=U.y}null!==h&&h.s()&&(y=h,f||(f=x));U=h=0;null!==l&&(h=l.left+l.right,U=l.top+l.bottom);z=B=0;null!==e&&(B=e.width,z=e.height,isFinite(B)&&(B=Math.max(0,B-h)),isFinite(z)&&(z=Math.max(0,z-U)));null!==e&&null!==f?("NaN"===
f&&(f=x),e.s()?(e=B,v=z):isNaN(z)?(e=B,v=v.height*f):(e=v.width*f,v=z)):null!==e?e.s()?(f=Math.min(B/v.width,z/v.height),e=B,v=z):isNaN(z)?(f=B/v.width,e=B,v=v.height*f):(f=z/v.height,e=v.width*f,v=z):null!==f?"NaN"===f&&g.s()?(f=Math.min((g.width-h)/v.width,(g.height-U)/v.height),f>x?(f=x,e=v.width,v=v.height):(e=g.width,v=g.height)):(e=v.width*f,v=v.height*f):(f=x,e=v.width,v=v.height);null!==l?(e+=h,v+=U):l=new Ic(0);null!==g&&(x=g.width,g=g.height,isNaN(x)&&(x=2E3),isNaN(g)&&(g=2E3),isFinite(x)&&
(e=Math.min(e,x)),isFinite(g)&&(v=Math.min(v,g)));n.width=Math.ceil(e);n.height=Math.ceil(v);if("SVG"===c){if(null===d)return null;d.resize(n.width,n.height,n.width,n.height);d.ownerDocument=p;d.Np=q;sj(a,d.context,l,new K(Math.ceil(e),Math.ceil(v)),f,y,k,m,r,b);return d.context}a.un=!1;sj(a,u,l,new K(Math.ceil(e),Math.ceil(v)),f,y,k,m,r,b);a.un=!0;return n.context}
pa.Object.defineProperties(P.prototype,{div:{get:function(){return this.Ia},set:function(a){if(this.Ia!==a){Wa=[];var b=this.Ia;null!==b?(b.F=void 0,b.innerHTML="",null!==this.Da&&(b=this.Da.Ga,b.removeEventListener("touchstart",this.Pv,!1),b.removeEventListener("touchmove",this.Ov,!1),b.removeEventListener("touchend",this.Nv,!1),this.Da.$w()),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.Yc=this.Da=null,w.removeEventListener("resize",this.Vv,!1),w.removeEventListener("mousemove",this.fk,!0),w.removeEventListener("mousedown",this.ek,!0),w.removeEventListener("mouseup",this.hk,!0),w.removeEventListener("wheel",this.ik,!0),w.removeEventListener("mouseout",this.gk,!0),lf===this&&(lf=null)):this.fe=!1;this.Ia=null;if(null!==a){if(b=a.F)b.div=null;yi(this,a);this.zh()}}}},ev:{
get:function(){return this.ob},set:function(a){this.ob=a}},Mi:{get:function(){return this.fe}},draggedLink:{get:function(){return this.Zq},set:function(a){this.Zq!==a&&(this.Zq=a,null!==a&&(this.Vr=a.fromPort,this.Wr=a.toPort))}},sx:{get:function(){return this.Vr},set:function(a){this.Vr=a}},tx:{get:function(){return this.Wr},set:function(a){this.Wr=a}},animationManager:{
get:function(){return this.vk}},undoManager:{get:function(){return this.Zb.undoManager}},skipsUndoManager:{get:function(){return this.bh},set:function(a){this.bh=a;this.Zb.skipsUndoManager=a}},delaysLayout:{get:function(){return this.Mt},set:function(a){this.Mt=a}},validCycle:{get:function(){return this.As},set:function(a){var b=this.As;b!==a&&(this.As=a,this.g("validCycle",
b,a))}},layers:{get:function(){return this.Pa.iterator}},isModelReadOnly:{get:function(){var a=this.Zb;return null===a?!1:a.isReadOnly},set:function(a){var b=this.Zb;null!==b&&(b.isReadOnly=a)}},isReadOnly:{get:function(){return this.Jf},set:function(a){var b=this.Jf;b!==a&&(this.Jf=a,this.g("isReadOnly",b,a))}},isEnabled:{get:function(){return this.Dc},set:function(a){var b=this.Dc;
b!==a&&(this.Dc=a,this.g("isEnabled",b,a))}},allowClipboard:{get:function(){return this.vq},set:function(a){var b=this.vq;b!==a&&(this.vq=a,this.g("allowClipboard",b,a))}},allowCopy:{get:function(){return this.Dh},set:function(a){var b=this.Dh;b!==a&&(this.Dh=a,this.g("allowCopy",b,a))}},allowDelete:{get:function(){return this.Eh},set:function(a){var b=this.Eh;b!==a&&(this.Eh=a,this.g("allowDelete",b,a))}},allowDragOut:{
get:function(){return this.wq},set:function(a){var b=this.wq;b!==a&&(this.wq=a,this.g("allowDragOut",b,a))}},allowDrop:{get:function(){return this.xq},set:function(a){var b=this.xq;b!==a&&(this.xq=a,this.g("allowDrop",b,a))}},allowTextEdit:{get:function(){return this.Nh},set:function(a){var b=this.Nh;b!==a&&(this.Nh=a,this.g("allowTextEdit",b,a))}},allowGroup:{get:function(){return this.Fh},set:function(a){var b=
this.Fh;b!==a&&(this.Fh=a,this.g("allowGroup",b,a))}},allowUngroup:{get:function(){return this.Oh},set:function(a){var b=this.Oh;b!==a&&(this.Oh=a,this.g("allowUngroup",b,a))}},allowInsert:{get:function(){return this.zq},set:function(a){var b=this.zq;b!==a&&(this.zq=a,this.g("allowInsert",b,a))}},allowLink:{get:function(){return this.Gh},set:function(a){var b=this.Gh;b!==a&&(this.Gh=a,this.g("allowLink",b,a))}},
allowRelink:{get:function(){return this.Ih},set:function(a){var b=this.Ih;b!==a&&(this.Ih=a,this.g("allowRelink",b,a))}},allowMove:{get:function(){return this.Hh},set:function(a){var b=this.Hh;b!==a&&(this.Hh=a,this.g("allowMove",b,a))}},allowReshape:{get:function(){return this.Jh},set:function(a){var b=this.Jh;b!==a&&(this.Jh=a,this.g("allowReshape",b,a))}},allowResize:{get:function(){return this.Kh},
set:function(a){var b=this.Kh;b!==a&&(this.Kh=a,this.g("allowResize",b,a))}},allowRotate:{get:function(){return this.Lh},set:function(a){var b=this.Lh;b!==a&&(this.Lh=a,this.g("allowRotate",b,a))}},allowSelect:{get:function(){return this.Mh},set:function(a){var b=this.Mh;b!==a&&(this.Mh=a,this.g("allowSelect",b,a))}},allowUndo:{get:function(){return this.Aq},set:function(a){var b=this.Aq;b!==a&&(this.Aq=a,this.g("allowUndo",
b,a))}},allowZoom:{get:function(){return this.Cq},set:function(a){var b=this.Cq;b!==a&&(this.Cq=a,this.g("allowZoom",b,a))}},hasVerticalScrollbar:{get:function(){return this.pr},set:function(a){var b=this.pr;b!==a&&(this.pr=a,fj(this),this.R(),this.g("hasVerticalScrollbar",b,a),Qi(this,!1))}},hasHorizontalScrollbar:{get:function(){return this.nr},set:function(a){var b=this.nr;b!==a&&(this.nr=a,fj(this),this.R(),
this.g("hasHorizontalScrollbar",b,a),Qi(this,!1))}},allowHorizontalScroll:{get:function(){return this.yq},set:function(a){var b=this.yq;b!==a&&(this.yq=a,this.g("allowHorizontalScroll",b,a),Qi(this,!1))}},allowVerticalScroll:{get:function(){return this.Bq},set:function(a){var b=this.Bq;b!==a&&(this.Bq=a,this.g("allowVerticalScroll",b,a),Qi(this,!1))}},scrollHorizontalLineChange:{get:function(){return this.hs},
set:function(a){var b=this.hs;b!==a&&(0>a&&xa(a,">= 0",P,"scrollHorizontalLineChange"),this.hs=a,this.g("scrollHorizontalLineChange",b,a))}},scrollVerticalLineChange:{get:function(){return this.ls},set:function(a){var b=this.ls;b!==a&&(0>a&&xa(a,">= 0",P,"scrollVerticalLineChange"),this.ls=a,this.g("scrollVerticalLineChange",b,a))}},lastInput:{get:function(){return this.oj},set:function(a){this.oj=a}},firstInput:{
get:function(){return this.Wh},set:function(a){this.Wh=a}},currentCursor:{get:function(){return this.Pq},set:function(a){""===a&&(a=this.nn);if(this.Pq!==a){var b=this.Da,c=this.Ia;if(null!==b){this.Pq=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.nn},set:function(a){""===a&&(a="auto");var b=this.nn;b!==a&&(this.nn=a,this.g("defaultCursor",b,a))}},click:{get:function(){return this.zf},set:function(a){var b=this.zf;b!==a&&(this.zf=a,this.g("click",b,a))}},doubleClick:{get:function(){return this.Ef},set:function(a){var b=this.Ef;b!==a&&(this.Ef=a,this.g("doubleClick",b,a))}},contextClick:{get:function(){return this.Af},
set:function(a){var b=this.Af;b!==a&&(this.Af=a,this.g("contextClick",b,a))}},mouseOver:{get:function(){return this.Uf},set:function(a){var b=this.Uf;b!==a&&(this.Uf=a,this.g("mouseOver",b,a))}},mouseHover:{get:function(){return this.Sf},set:function(a){var b=this.Sf;b!==a&&(this.Sf=a,this.g("mouseHover",b,a))}},mouseHold:{get:function(){return this.Rf},set:function(a){var b=this.Rf;b!==a&&(this.Rf=a,this.g("mouseHold",
b,a))}},mouseDragOver:{get:function(){return this.Qr},set:function(a){var b=this.Qr;b!==a&&(this.Qr=a,this.g("mouseDragOver",b,a))}},mouseDrop:{get:function(){return this.Pf},set:function(a){var b=this.Pf;b!==a&&(this.Pf=a,this.g("mouseDrop",b,a))}},handlesDragDropForTopLevelParts:{get:function(){return this.mr},set:function(a){var b=this.mr;b!==a&&(this.mr=a,this.g("handlesDragDropForTopLevelParts",b,a))}},
mouseEnter:{get:function(){return this.Qf},set:function(a){var b=this.Qf;b!==a&&(this.Qf=a,this.g("mouseEnter",b,a))}},mouseLeave:{get:function(){return this.Tf},set:function(a){var b=this.Tf;b!==a&&(this.Tf=a,this.g("mouseLeave",b,a))}},toolTip:{get:function(){return this.eg},set:function(a){var b=this.eg;b!==a&&(this.eg=a,this.g("toolTip",b,a))}},contextMenu:{get:function(){return this.Bf},
set:function(a){var b=this.Bf;b!==a&&(this.Bf=a,this.g("contextMenu",b,a))}},commandHandler:{get:function(){return this.K},set:function(a){this.K!==a&&(this.K=a,a.hb(this))}},toolManager:{get:function(){return this.Ub},set:function(a){this.Ub!==a&&(this.Ub=a,a.hb(this))}},defaultTool:{get:function(){return this.La},set:function(a){var b=this.La;b!==a&&(this.La=a,a.hb(this),this.currentTool===b&&(this.currentTool=
a))}},currentTool:{get:function(){return this.ba},set:function(a){var b=this.ba;null!==b&&(b.isActive&&b.doDeactivate(),b.cancelWaitAfter(),b.doStop());null===a&&(a=this.defaultTool);null!==a&&(this.ba=a,a.hb(this),a.doStart())}},selection:{get:function(){return this.os}},maxSelectionCount:{get:function(){return this.Mr},set:function(a){var b=this.Mr;if(b!==a)if(0<=a&&!isNaN(a)){if(this.Mr=a,this.g("maxSelectionCount",
b,a),!this.undoManager.isUndoingRedoing&&(a=this.selection.count-a,0<a)){this.aa("ChangingSelection",this.selection);b=this.selection.Na();for(var c=0;c<a;c++)b[c].isSelected=!1;this.aa("ChangedSelection",this.selection)}}else xa(a,">= 0",P,"maxSelectionCount")}},nodeSelectionAdornmentTemplate:{get:function(){return this.Tr},set:function(a){var b=this.Tr;b!==a&&(this.Tr=a,this.g("nodeSelectionAdornmentTemplate",b,a))}},groupSelectionAdornmentTemplate:{
get:function(){return this.kr},set:function(a){var b=this.kr;b!==a&&(this.kr=a,this.g("groupSelectionAdornmentTemplate",b,a))}},linkSelectionAdornmentTemplate:{get:function(){return this.Ir},set:function(a){var b=this.Ir;b!==a&&(this.Ir=a,this.g("linkSelectionAdornmentTemplate",b,a))}},highlighteds:{get:function(){return this.qr}},isModified:{get:function(){var a=this.undoManager;return a.isEnabled?
null!==a.currentTransaction?!0:this.u&&this.ee!==a.historyIndex:this.u},set:function(a){if(this.u!==a){this.u=a;var b=this.undoManager;!a&&b.isEnabled&&(this.ee=b.historyIndex);a||Rj(this)}}},model:{get:function(){return this.Zb},set:function(a){var b=this.Zb;if(b!==a){this.currentTool.doCancel();null!==b&&b.undoManager!==a.undoManager&&b.undoManager.isInTransaction&&A("Do not replace a Diagram.model while a transaction is in progress.");Bi(this,!0);this.fe=!1;this.Tk=
!0;this.ee=-2;this.qd=!1;var c=this.Yb;this.Yb=!0;this.animationManager.Pi("Model");null!==b&&(null!==this.me&&this.me.each(function(a){b.lk(a)}),b.lk(this.Am));this.Zb=a;this.partManager=Sj(this.Zb.constructor.type);a.oh(this.vg);this.partManager.addAllModeledParts();a.lk(this.vg);a.oh(this.Am);null!==this.me&&this.me.each(function(b){a.oh(b)});this.Yb=c;this.ob||this.R();null!==b&&a.undoManager.copyProperties(b.undoManager)}}},da:{get:function(){return this.Vc},set:function(a){this.Vc=
a}},dt:{get:function(){return this.tq}},skipsModelSourceBindings:{get:function(){return this.Bh},set:function(a){this.Bh=a}},Si:{get:function(){return this.tu},set:function(a){this.tu=a}},nodeTemplate:{get:function(){return this.Vf.J("")},set:function(a){var b=this.Vf.J("");b!==a&&(this.Vf.add("",a),this.g("nodeTemplate",b,a),this.undoManager.isUndoingRedoing||this.ud())}},nodeTemplateMap:{
get:function(){return this.Vf},set:function(a){var b=this.Vf;b!==a&&(this.Vf=a,this.g("nodeTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.ud())}},groupTemplate:{get:function(){return this.Xh.J("")},set:function(a){var b=this.Xh.J("");b!==a&&(this.Xh.add("",a),this.g("groupTemplate",b,a),this.undoManager.isUndoingRedoing||this.ud())}},groupTemplateMap:{get:function(){return this.Xh},set:function(a){var b=this.Xh;b!==
a&&(this.Xh=a,this.g("groupTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.ud())}},linkTemplate:{get:function(){return this.Sg.J("")},set:function(a){var b=this.Sg.J("");b!==a&&(this.Sg.add("",a),this.g("linkTemplate",b,a),this.undoManager.isUndoingRedoing||this.ud())}},linkTemplateMap:{get:function(){return this.Sg},set:function(a){var b=this.Sg;b!==a&&(this.Sg=a,this.g("linkTemplateMap",b,a),this.undoManager.isUndoingRedoing||
this.ud())}},isMouseOverDiagram:{get:function(){return this.ge},set:function(a){this.ge=a}},isMouseCaptured:{get:function(){return this.Jc},set:function(a){var b=this.Da;null!==b&&(b=b.Ga,b instanceof SVGElement||(a?(this.lastInput.bubbles=!1,this.Dq?(b.removeEventListener("pointermove",this.hm,!1),b.removeEventListener("pointerdown",this.gm,!1),b.removeEventListener("pointerup",this.jm,!1),b.removeEventListener("pointerout",this.im,!1),
w.addEventListener("pointermove",this.hm,!0),w.addEventListener("pointerdown",this.gm,!0),w.addEventListener("pointerup",this.jm,!0),w.addEventListener("pointerout",this.im,!0)):(b.removeEventListener("mousemove",this.fk,!1),b.removeEventListener("mousedown",this.ek,!1),b.removeEventListener("mouseup",this.hk,!1),b.removeEventListener("mouseout",this.gk,!1),w.addEventListener("mousemove",this.fk,!0),w.addEventListener("mousedown",this.ek,!0),w.addEventListener("mouseup",this.hk,!0),w.addEventListener("mouseout",
this.gk,!0)),b.removeEventListener("wheel",this.ik,!1),w.addEventListener("wheel",this.ik,!0),w.addEventListener("selectstart",this.preventDefault,!1)):(this.Dq?(w.removeEventListener("pointermove",this.hm,!0),w.removeEventListener("pointerdown",this.gm,!0),w.removeEventListener("pointerup",this.jm,!0),w.removeEventListener("pointerout",this.im,!0),b.addEventListener("pointermove",this.hm,!1),b.addEventListener("pointerdown",this.gm,!1),b.addEventListener("pointerup",this.jm,!1),b.addEventListener("pointerout",
this.im,!1)):(w.removeEventListener("mousemove",this.fk,!0),w.removeEventListener("mousedown",this.ek,!0),w.removeEventListener("mouseup",this.hk,!0),w.removeEventListener("mouseout",this.gk,!0),b.addEventListener("mousemove",this.fk,!1),b.addEventListener("mousedown",this.ek,!1),b.addEventListener("mouseup",this.hk,!1),b.addEventListener("mouseout",this.gk,!1)),w.removeEventListener("wheel",this.ik,!0),w.removeEventListener("selectstart",this.preventDefault,!1),b.addEventListener("wheel",this.ik,
!1)),this.Jc=a))}},position:{get:function(){return this.sa},set:function(a){var b=G.alloc().assign(this.sa);if(!b.A(a)){var c=this.viewportBounds.copy();this.sa.assign(a);this.ob||null===this.Da&&!this.Bp.s()||(this.ob=!0,a=this.scale,Si(this,this.sn,this.xa/a,this.wa/a,this.aj,!1),this.ob=!1);bi(this.animationManager,b,this.sa);this.ob||this.fq(c,this.viewportBounds,this.Ca,!1)}G.free(b)}},initialPosition:{get:function(){return this.sr},
set:function(a){this.sr.A(a)||(this.sr=a.I())}},initialScale:{get:function(){return this.tr},set:function(a){this.tr!==a&&(this.tr=a)}},grid:{get:function(){null===this.Eb&&Ji(this);return this.Eb},set:function(a){var b=this.Eb;if(b!==a){null===b&&(Ji(this),b=this.Eb);a.type!==X.Grid&&A("Diagram.grid must be a Panel of type Panel.Grid");var c=b.panel;null!==c&&c.remove(b);this.Eb=a;a.name="GRID";null!==c&&c.add(a);ij(this);this.R();this.g("grid",
b,a)}}},viewportBounds:{get:function(){var a=this.Kw,b=this.sa,c=this.Ca;if(null===this.Da)return this.Bp.s()&&a.h(b.x,b.y,this.xa/c,this.wa/c),a;a.h(b.x,b.y,Math.max(this.xa,0)/c,Math.max(this.wa,0)/c);return a}},viewSize:{get:function(){return this.Bp},set:function(a){var b=this.viewSize;b.A(a)||(this.Bp=a=a.I(),this.xa=a.width,this.wa=a.height,this.Xa(),this.g("viewSize",b,a))}},fixedBounds:{get:function(){return this.hr},
set:function(a){var b=this.hr;b.A(a)||(-Infinity!==a.width&&Infinity!==a.height&&-Infinity!==a.height||A("fixedBounds width/height must not be Infinity"),this.hr=a=a.I(),this.Xa(),this.g("fixedBounds",b,a))}},scrollMargin:{get:function(){return this.pi},set:function(a){"number"===typeof a&&(a=new Ic(a));var b=this.pi;b.A(a)||(this.pi=a=a.I(),this.g("scrollMargin",b,a),this.zh())}},scrollMode:{get:function(){return this.js},set:function(a){var b=
this.js;b!==a&&(this.js=a,a===mi&&Qi(this,!1),this.g("scrollMode",b,a),this.zh())}},scrollsPageOnFocus:{get:function(){return this.ms},set:function(a){var b=this.ms;b!==a&&(this.ms=a,this.g("scrollsPageOnFocus",b,a))}},positionComputation:{get:function(){return this.bs},set:function(a){var b=this.bs;b!==a&&(this.bs=a,Qi(this,!1),this.g("positionComputation",b,a))}},scaleComputation:{get:function(){return this.fs},
set:function(a){var b=this.fs;b!==a&&(this.fs=a,Pj(this,this.scale,this.scale),this.g("scaleComputation",b,a))}},documentBounds:{get:function(){return this.sn}},isVirtualized:{get:function(){return this.Dr},set:function(a){var b=this.Dr;b!==a&&(this.Dr=a,this.g("isVirtualized",b,a))}},scale:{get:function(){return this.Ca},set:function(a){var b=this.Ca;b!==a&&Pj(this,b,a)}},defaultScale:{
get:function(){return this.Wq},set:function(a){this.Wq=a}},autoScale:{get:function(){return this.Zi},set:function(a){var b=this.Zi;b!==a&&(this.Zi=a,this.g("autoScale",b,a),a!==ni&&Qi(this,!1))}},initialAutoScale:{get:function(){return this.$h},set:function(a){var b=this.$h;b!==a&&(this.$h=a,this.g("initialAutoScale",b,a))}},initialViewportSpot:{get:function(){return this.ur},set:function(a){var b=this.ur;b!==
a&&(a.gb()||A("initialViewportSpot must be a specific Spot: "+a),this.ur=a,this.g("initialViewportSpot",b,a))}},initialDocumentSpot:{get:function(){return this.rr},set:function(a){var b=this.rr;b!==a&&(a.gb()||A("initialViewportSpot must be a specific Spot: "+a),this.rr=a,this.g("initialDocumentSpot",b,a))}},minScale:{get:function(){return this.Nr},set:function(a){var b=this.Nr;b!==a&&(0<a?(this.Nr=a,this.g("minScale",b,a),a>this.scale&&
(this.scale=a)):xa(a,"> 0",P,"minScale"))}},maxScale:{get:function(){return this.Lr},set:function(a){var b=this.Lr;b!==a&&(0<a?(this.Lr=a,this.g("maxScale",b,a),a<this.scale&&(this.scale=a)):xa(a,"> 0",P,"maxScale"))}},zoomPoint:{get:function(){return this.Ds},set:function(a){this.Ds.A(a)||(this.Ds=a=a.I())}},contentAlignment:{get:function(){return this.aj},set:function(a){var b=this.aj;b.A(a)||(this.aj=a=a.I(),
this.g("contentAlignment",b,a),Qi(this,!1))}},initialContentAlignment:{get:function(){return this.Ln},set:function(a){var b=this.Ln;b.A(a)||(this.Ln=a=a.I(),this.g("initialContentAlignment",b,a))}},padding:{get:function(){return this.eb},set:function(a){"number"===typeof a&&(a=new Ic(a));var b=this.eb;b.A(a)||(this.eb=a=a.I(),this.Xa(),this.g("padding",b,a))}},partManager:{get:function(){return this.Ma},set:function(a){var b=
this.Ma;b!==a&&(null!==a.diagram&&A("Cannot share PartManagers between Diagrams: "+a.toString()),null!==b&&b.hb(null),this.Ma=a,a.hb(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.gc},set:function(a){var b=
this.gc;b!==a&&(this.gc=a,a.diagram=this,a.group=null,this.yg=!0,this.g("layout",b,a),this.cc())}},isTreePathToChildren:{get:function(){return this.Cr},set:function(a){var b=this.Cr;if(b!==a&&(this.Cr=a,this.g("isTreePathToChildren",b,a),!this.undoManager.isUndoingRedoing))for(a=this.nodes;a.next();)tk(a.value)}},treeCollapsePolicy:{get:function(){return this.ys},set:function(a){var b=this.ys;b!==a&&(a!==pi&&a!==uk&&a!==vk&&A("Unknown Diagram.treeCollapsePolicy: "+
a),this.ys=a,this.g("treeCollapsePolicy",b,a))}},De:{get:function(){return this.Vb},set:function(a){this.Vb=a}},autoScrollInterval:{get:function(){return this.Qm},set:function(a){var b=this.Qm;b!==a&&(this.Qm=a,this.g("autoScrollInterval",b,a))}},autoScrollRegion:{get:function(){return this.Rm},set:function(a){"number"===typeof a&&(a=new Ic(a));var b=this.Rm;b.A(a)||(this.Rm=a=a.I(),this.Xa(),this.g("autoScrollRegion",
b,a))}}});pa.Object.defineProperties(P,{licenseKey:{get:function(){return wk.Sb()},set:function(a){wk.add(a)}},version:{get:function(){return xk}}});P.prototype.makeImageData=P.prototype.ox;P.prototype.makeImage=P.prototype.vz;P.prototype.addRenderer=P.prototype.gy;P.prototype.makeSVG=P.prototype.hv;P.prototype.makeSvg=P.prototype.ft;P.prototype.stopAutoScroll=P.prototype.uf;P.prototype.doAutoScroll=P.prototype.Ks;
P.prototype.isUnoccupied=P.prototype.bk;P.prototype.raiseDiagramEvent=P.prototype.aa;P.prototype.removeDiagramListener=P.prototype.km;P.prototype.addDiagramListener=P.prototype.Kj;P.prototype.findTreeRoots=P.prototype.Vy;P.prototype.layoutDiagram=P.prototype.sz;P.prototype.findTopLevelGroups=P.prototype.Oy;P.prototype.findTopLevelNodesAndLinks=P.prototype.Py;P.prototype.findLinksByExample=P.prototype.Os;P.prototype.findNodesByExample=P.prototype.Ps;P.prototype.findLinkForData=P.prototype.uc;
P.prototype.findNodeForData=P.prototype.Ci;P.prototype.findPartForData=P.prototype.vc;P.prototype.findNodeForKey=P.prototype.Hb;P.prototype.findPartForKey=P.prototype.findPartForKey;P.prototype.rebuildParts=P.prototype.ud;P.prototype.transformViewToDoc=P.prototype.vt;P.prototype.transformRectDocToView=P.prototype.Sz;P.prototype.transformDocToView=P.prototype.ut;P.prototype.centerRect=P.prototype.Gu;P.prototype.scrollToRect=P.prototype.Bv;P.prototype.scroll=P.prototype.scroll;
P.prototype.highlightCollection=P.prototype.iz;P.prototype.highlight=P.prototype.hz;P.prototype.clearHighlighteds=P.prototype.Sw;P.prototype.selectCollection=P.prototype.Cv;P.prototype.select=P.prototype.select;P.prototype.clearSelection=P.prototype.Gs;P.prototype.updateAllRelationshipsFromData=P.prototype.qq;P.prototype.updateAllTargetBindings=P.prototype.updateAllTargetBindings;P.prototype.commit=P.prototype.commit;P.prototype.rollbackTransaction=P.prototype.tf;P.prototype.commitTransaction=P.prototype.Za;
P.prototype.startTransaction=P.prototype.Aa;P.prototype.raiseChanged=P.prototype.g;P.prototype.raiseChangedEvent=P.prototype.ab;P.prototype.removeChangedListener=P.prototype.lk;P.prototype.addChangedListener=P.prototype.oh;P.prototype.removeModelChangedListener=P.prototype.Hz;P.prototype.addModelChangedListener=P.prototype.Qw;P.prototype.findLayer=P.prototype.Xl;P.prototype.removeLayer=P.prototype.Fz;P.prototype.addLayerAfter=P.prototype.$x;P.prototype.addLayerBefore=P.prototype.Ow;
P.prototype.addLayer=P.prototype.Nl;P.prototype.moveParts=P.prototype.moveParts;P.prototype.copyParts=P.prototype.Uj;P.prototype.removeParts=P.prototype.nt;P.prototype.remove=P.prototype.remove;P.prototype.add=P.prototype.add;P.prototype.clearDelayedGeometries=P.prototype.Hu;P.prototype.setProperties=P.prototype.Iv;P.prototype.resetInputOptions=P.prototype.yv;P.prototype.setInputOption=P.prototype.Lz;P.prototype.getInputOption=P.prototype.$l;P.prototype.resetRenderingHints=P.prototype.zv;
P.prototype.setRenderingHint=P.prototype.Ex;P.prototype.getRenderingHint=P.prototype.Ce;P.prototype.maybeUpdate=P.prototype.fd;P.prototype.requestUpdate=P.prototype.cc;P.prototype.delayInitialization=P.prototype.vy;P.prototype.isUpdateRequested=P.prototype.oz;P.prototype.redraw=P.prototype.zh;P.prototype.invalidateDocumentBounds=P.prototype.Xa;P.prototype.findObjectsNear=P.prototype.mg;P.prototype.findPartsNear=P.prototype.Ly;P.prototype.findObjectsIn=P.prototype.lg;P.prototype.findPartsIn=P.prototype.hx;
P.prototype.findObjectsAt=P.prototype.Di;P.prototype.findPartsAt=P.prototype.Ky;P.prototype.findObjectAt=P.prototype.Rb;P.prototype.findPartAt=P.prototype.Yl;P.prototype.alignDocument=P.prototype.hy;P.prototype.zoomToRect=P.prototype.Vz;P.prototype.zoomToFit=P.prototype.zoomToFit;P.prototype.diagramScroll=P.prototype.Zw;P.prototype.focus=P.prototype.focus;P.prototype.reset=P.prototype.reset;P.useDOM=function(a){sh=a?void 0!==w.document:!1};P.isUsingDOM=function(){return sh};
var lf=null,qi=new Lb,Hi=null,Gi=null,sh=void 0!==w.document,zi=null,Ai="",ni=new D(P,"None",0),Ui=new D(P,"Uniform",1),Vi=new D(P,"UniformToFill",2),sg=new D(P,"CycleAll",10),wg=new D(P,"CycleNotDirected",11),yg=new D(P,"CycleNotDirectedFast",12),zg=new D(P,"CycleNotUndirected",13),tg=new D(P,"CycleDestinationTree",14),vg=new D(P,"CycleSourceTree",15),mi=new D(P,"DocumentScroll",1),vj=new D(P,"InfiniteScroll",2),pi=new D(P,"TreeParentCollapsed",21),uk=new D(P,"AllParentsCollapsed",22),vk=new D(P,
"AnyParentsCollapsed",23),wk=new E,xk="2.0.3",yk=null,ki=!1;function li(){if(sh){var a=w.document.createElement("canvas"),b=a.getContext("2d"),c=Za("7ca11abfd022028846");b[c]=Za("398c3597c01238");for(var d=["5da73c80a36455d4038e4972187c3cae51fd22",sa.Dx+"4ae6247590da4bb21c324ba3a84e385776",Qc.xF+"fb236cdfda5de14c134ba1a95a2d4c7cc6f93c1387",H.za],e=1;5>e;e++)b[Za("7ca11abfd7330390")](Za(d[e-1]),10,15*e);b[c]=Za("39f046ebb36e4b");for(c=1;5>c;c++)b[Za("7ca11abfd7330390")](Za(d[c-1]),10,15*c);yk=a}}
P.className="Diagram";P.fromDiv=function(a){var b=a;"string"===typeof a&&(b=w.document.getElementById(a));return b instanceof HTMLDivElement&&b.F instanceof P?b.F:null};P.inherit=function(a,b){function c(){}if(Object.getPrototypeOf(a).prototype)throw Error("Used go.Diagram.inherit defining already defined class \n"+a);c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a};P.None=ni;P.Uniform=Ui;P.UniformToFill=Vi;P.CycleAll=sg;P.CycleNotDirected=wg;P.CycleNotDirectedFast=yg;
P.CycleNotUndirected=zg;P.CycleDestinationTree=tg;P.CycleSourceTree=vg;P.DocumentScroll=mi;P.InfiniteScroll=vj;P.TreeParentCollapsed=pi;P.AllParentsCollapsed=uk;P.AnyParentsCollapsed=vk;function xi(){this.Vx=null;this.l="zz@orderNum";"63ad05bbe23a1786468a4c741b6d2"===this._tk?this.Me=this.l=!0:this.Me=null}
function rj(a,b){b.Yc.setTransform(b.$b,0,0,b.$b,0,0);if(null===a.Me){b="f";var c=w[Za("76a715b2f73f148a")][Za("72ba13b5")];a.Me=!0;if(sh){var d=P[Za("76a115b6ed251eaf4692")];if(d)for(var e=wk.iterator;e.next();){d=e.value;d=Za(d).split(Za("39e9"));if(6>d.length)break;var f=Za(d[1]).split(".");if("7da71ca0"!==d[4])break;var g=Za(sa[Za("6cae19")]).split(".");if(f[0]>g[0]||f[0]===g[0]&&f[1]>=g[1]){f=c[Za("76ad18b4f73e")];for(g=c[Za("73a612b6fb191d")](Za("35e7"))+2;g<f;g++)b+=c[g];f=b[Za("73a612b6fb191d")](Za(d[2]));
0>f&&Za(d[2])!==Za("7da71ca0ad381e90")&&(f=b[Za("73a612b6fb191d")](Za("76a715b2ef3e149757")));0>f&&(f=b[Za("73a612b6fb191d")](Za("76a715b2ef3e149757")));a.Me=!(0<=f&&f<b[Za("73a612b6fb191d")](Za("35")));if(!a.Me)break;f=Za(d[2]);if("#"!==f[0])break;g=w.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[Za("79a417a0f0181a8946")]=
d;if(w.document[Za("78a712aa")]){w.document[Za("78a712aa")][Za("7bb806b6ed32388c4a875b")](g);h=w.getComputedStyle(g).getPropertyValue(Za("78a704b7e62456904c9b12701b6532a8"));w.document[Za("78a712aa")][Za("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.Me=!1;break}else if(bb||cb||db||gb)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.Me=!1;break}}}else a.Me=null,a.Me=!1}}else{k=c[Za("76ad18b4f73e")];for(e=c[Za("73a612b6fb191d")](Za("35e7"))+2;e<k;e++)b+=c[e];c=b[Za("73a612b6fb191d")](Za("7da71ca0ad381e90"));a.Me=!(0<=c&&c<b[Za("73a612b6fb191d")](Za("35")))}}}return 0<a.Me&&a!==a.Vx?!0:!1}
function yi(a,b){if(sh){void 0!==b&&null!==b||A("Diagram setup requires an argument DIV.");null!==a.Ia&&A("Diagram has already completed setup.");"string"===typeof b?a.Ia=w.document.getElementById(b):b instanceof HTMLDivElement?a.Ia=b:A("No DIV or DIV id supplied: "+b);null===a.Ia&&A("Invalid DIV id; could not get element with id: "+b);void 0!==a.Ia.F&&A("Invalid div id; div already has a Diagram associated with it.");"static"===w.getComputedStyle(a.Ia,null).position&&(a.Ia.style.position="relative");
a.Ia.style["-webkit-tap-highlight-color"]="rgba(255, 255, 255, 0)";a.Ia.style["-ms-touch-action"]="none";a.Ia.innerHTML="";a.Ia.F=a;var c=a.vs?new wj(a):new sk(a);void 0!==c.style&&(c.style.position="absolute",c.style.top="0px",c.style.left="0px","rtl"===w.getComputedStyle(a.Ia,null).getPropertyValue("direction")&&(a.Qn=!0),c.style.zIndex="2",c.style.userSelect="none",c.style.webkitUserSelect="none",c.style.MozUserSelect="none");a.Da=c;a.Yc=c.context;b=a.Yc;a.$b=a.computePixelRatio();a.xa=a.Ia.clientWidth||
1;a.wa=a.Ia.clientHeight||1;yj(a,a.xa,a.wa);a.$q=function(){return true;};;a.Ia.insertBefore(c.Ga,a.Ia.firstChild);c=new sk(null);c.width=1;c.height=1;a.Qt=c;a.rw=c.context;if(sh){c=va("div");var d=va("div");c.style.position="absolute";c.style.overflow="auto";c.style.width=a.xa+"px";c.style.height=a.wa+"px";c.style.zIndex="1";d.style.position="absolute";d.style.width="1px";d.style.height="1px";a.Ia.appendChild(c);c.appendChild(d);c.onscroll=Ki;c.onmousedown=Mi;c.ontouchstart=
Mi;c.F=a;c.Tx=!0;c.Ux=!0;a.ks=c;a.bp=d}a.lt=ta(function(){a.ue=null;a.R()},300);a.Vv=ta(function(){Qh(a)},250);a.preventDefault=function(a){a.preventDefault();return!1};a.fk=function(b){if(a.isEnabled){a.ge=!0;var c=Zi(a,b,!0);a.doMouseMove();a.currentTool.isBeyondDragSize()&&(a.Se=0);ej(c,b)}};a.ek=function(b){if(a.isEnabled)if(a.ge=!0,a.Pe)b.preventDefault();else{var c=Zi(a,b,!0);c.down=!0;c.clickCount=b.detail;if(cb||db)b.timeStamp-a.gl<a.yu&&!a.currentTool.isBeyondDragSize()?a.Se++:a.Se=1,a.gl=
b.timeStamp,c.clickCount=a.Se;c.clone(a.firstInput);a.doMouseDown();1===b.button?b.preventDefault():ej(c,b)}};a.hk=function(b){if(a.isEnabled)if(a.Pe&&2===b.button)b.preventDefault();else if(a.Pe&&0===b.button&&(a.Pe=!1),a.Jl)b.preventDefault();else{a.ge=!0;var c=Zi(a,b,!0);c.up=!0;c.clickCount=b.detail;if(cb||db)c.clickCount=a.Se;c.bubbles=b.bubbles;c.targetDiagram=aj(b);a.doMouseUp();a.uf();ej(c,b)}};a.ik=function(b){if(a.isEnabled){var c=Zi(a,b,!0);c.bubbles=!0;if(void 0!==b.deltaX){var d=0<b.deltaX?
1:-1;var e=0<b.deltaY?1:-1;c.delta=Math.abs(b.deltaX)>Math.abs(b.deltaY)?-d:-e}else void 0!==b.wheelDeltaX?(d=0<b.wheelDeltaX?-1:1,e=0<b.wheelDeltaY?-1:1,c.delta=Math.abs(b.wheelDeltaX)>Math.abs(b.wheelDeltaY)?-d:-e):c.delta=void 0!==b.wheelDelta?0<b.wheelDelta?1:-1:0;a.doMouseWheel();ej(c,b)}};a.gk=function(b){a.isEnabled&&(a.ge=!1,Zi(a,b,!0),b=a.currentTool,b.cancelWaitAfter(),b.standardMouseOver())};a.Pv=function(b){if(a.isEnabled){a.Jl=!1;a.Pe=!0;var c=bj(a,b,b.targetTouches[0],1<b.touches.length);
a.doMouseDown();ej(c,b)}};a.Ov=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=dj(a,b,c,1<b.touches.length);a.doMouseMove();ej(c,b)}};a.Nv=function(b){if(a.isEnabled)if(a.Jl)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=cj(a,b,!1,!0,!1,!1);if(null!==d){c=w.document.elementFromPoint(d.clientX,
d.clientY);null!==c&&c.F instanceof P&&c.F!==a&&$i(c.F,d,e);$i(a,d,e);var k=d.screenX;d=d.screenY;var l=a.Fr;b.timeStamp-a.gl<a.yu&&!(25<Math.abs(l.x-k)||25<Math.abs(l.y-d))?a.Se++:a.Se=1;e.clickCount=a.Se;a.gl=b.timeStamp;a.Fr.h(k,d)}null===c?e.targetDiagram=aj(b):c.F?e.targetDiagram=c.F:e.targetDiagram=null;e.targetObject=null;a.doMouseUp();ej(e,b);a.Pe=!1}};a.gm=function(b){if(a.isEnabled){a.ge=!0;var c=a.ku;void 0===c[b.pointerId]&&(c[b.pointerId]=b);c=a.rl;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.Jl=!1,a.Pe=!0;c=bj(a,b,b,d);a.doMouseDown();1===b.button?b.preventDefault():ej(c,b)}};a.hm=function(b){if(a.isEnabled){a.ge=!0;var c=a.rl;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=dj(a,b,b,null!==c[1]),a.doMouseMove(),ej(c,b))}};a.jm=function(b){if(a.isEnabled){a.ge=!0;var c="touch"===b.pointerType||"pen"===b.pointerType,d=a.ku;if(c&&a.Jl)delete d[b.pointerId],b.preventDefault();else if(d=a.rl,null!==d[0]&&d[0].pointerId===b.pointerId){d[0]=null;d=cj(a,b,!1,!0,!0,!1);var e=w.document.elementFromPoint(b.clientX,b.clientY);null!==e&&e.F instanceof P&&e.F!==a&&$i(e.F,b,d);$i(a,b,d);var k=a.Fr,l=c?25:10;b.timeStamp-a.gl<a.yu&&!(Math.abs(k.x-b.screenX)>l||Math.abs(k.y-
b.screenY)>l)?a.Se++:a.Se=1;d.clickCount=a.Se;a.gl=b.timeStamp;a.Fr.sg(b.screenX,b.screenY);null===e?d.targetDiagram=aj(b):e.F?d.targetDiagram=e.F:d.targetDiagram=null;d.targetObject=null;a.doMouseUp();ej(d,b);c&&(a.Pe=!1)}else null!==d[1]&&d[1].pointerId===b.pointerId&&(d[1]=null)}};a.im=function(b){if(a.isEnabled){a.ge=!1;var c=a.ku;c[b.pointerId]&&delete c[b.pointerId];c=a.rl;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.Qc(!0);Ii(a)}}xi.className="DiagramHelper";function Nf(a){this.l=void 0===a?new G:a;this.u=new G}pa.Object.defineProperties(Nf.prototype,{point:{get:function(){return this.l},set:function(a){this.l=a}},shifted:{get:function(){return this.u},set:function(a){this.u=a}}});Nf.className="DraggingInfo";
function Kj(a,b,c){this.node=a;this.info=b;this.$u=c}Kj.className="DraggingNodeInfoPair";function yf(){this.reset()}yf.prototype.reset=function(){this.isGridSnapEnabled=!1;this.isGridSnapRealtime=!0;this.gridSnapCellSize=(new K(NaN,NaN)).freeze();this.gridSnapCellSpot=Tc;this.gridSnapOrigin=(new G(NaN,NaN)).freeze();this.fz=this.dragsTree=this.dragsLink=!1};
function zk(a){1<arguments.length&&A("Palette constructor can only take one optional argument, the DIV HTML element or its id.");P.call(this,a);this.allowDragOut=!0;this.allowMove=!1;this.isReadOnly=!0;this.contentAlignment=Uc;this.layout=new Ak}oa(zk,P);zk.className="Palette";
function Bk(a){1<arguments.length&&A("Overview constructor can only take one optional argument, the DIV HTML element or its id.");P.call(this,a);this.animationManager.isEnabled=!1;this.ob=!0;this.Wf=null;this.ar=!0;this.Ex("drawShadows",!1);var b=new T,c=new W;c.stroke="magenta";c.strokeWidth=2;c.fill="transparent";c.name="BOXSHAPE";b.selectable=!0;b.selectionAdorned=!1;b.selectionObjectName="BOXSHAPE";b.locationObjectName="BOXSHAPE";b.resizeObjectName="BOXSHAPE";b.cursor="move";b.add(c);this.l=b;
this.allowDelete=this.allowCopy=!1;this.allowSelect=!0;this.autoScrollRegion=new Ic(0,0,0,0);this.vu=new sk(null);this.Wx=this.vu.context;vf(this.toolManager,"Dragging",new Ck,this.toolManager.mouseMoveTools);var d=this;this.click=function(){var a=d.Wf;if(null!==a){var b=a.viewportBounds,c=d.lastInput.documentPoint;a.position=new G(c.x-b.width/2,c.y-b.height/2)}};this.Em=function(){d.Xa();Dk(d)};this.Cm=function(){null!==d.Wf&&(d.Xa(),d.R())};this.Dm=function(){d.R()};this.Bm=function(){null!==d.Wf&&
Dk(d)};this.autoScale=Ui;this.ob=!1}oa(Bk,P);
function Ek(a){a.ob||a.Yb||!1!==a.qd||(a.qd=!0,w.requestAnimationFrame(function(){if(a.qd&&!a.Yb&&(a.qd=!1,null!==a.Ia)){a.Yb=!0;Oi(a);a.documentBounds.s()||Ti(a,a.computeBounds());null===a.Ia&&A("No div specified");null===a.Da&&A("No canvas specified");ei(a.box);if(a.oc){var b=a.Wf;if(null!==b&&!b.animationManager.isAnimating&&!b.animationManager.rb){b=a.Yc;var c=a.vu;b.setTransform(1,0,0,1,0,0);b.clearRect(0,0,a.Da.width,a.Da.height);b.drawImage(c.Ga,0,0);c=a.tb;c.reset();1!==a.scale&&c.scale(a.scale);
0===a.position.x&&0===a.position.y||c.translate(-a.position.x,-a.position.y);b.scale(a.$b,a.$b);b.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy);c=a.Pa.j;for(var d=c.length,e=0;e<d;e++)c[e].ic(b,a);a.ai=!1;a.oc=!1}}a.Yb=!1}}))}Bk.prototype.computePixelRatio=function(){return 1};
Bk.prototype.ic=function(){null===this.Ia&&A("No div specified");null===this.Da&&A("No canvas specified");if(!(this.Da instanceof wj)&&(ei(this.box),this.oc)){var a=this.Wf;if(null!==a&&!a.animationManager.isAnimating){pj(this);var b=a.grid;null===b||!b.visible||isNaN(b.width)||isNaN(b.height)||(ij(a),Oi(a));var c=this.Da;b=this.Yc;var d=this.vu,e=this.Wx;d.width=c.width;d.height=c.height;b.Qc(!0);b.setTransform(1,0,0,1,0,0);b.clearRect(0,0,c.width,c.height);d=this.tb;d.reset();1!==this.scale&&d.scale(this.scale);
0===this.position.x&&0===this.position.y||d.translate(-this.position.x,-this.position.y);b.scale(this.$b,this.$b);b.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);d=this.ar;var f=this.viewportBounds;a=a.Pa.j;for(var g=a.length,h=0;h<g;h++){var k=a[h],l=d;if(k.visible&&0!==k.lb&&(void 0===l&&(l=!0),l||!k.isTemporary)){1!==k.lb&&(b.globalAlpha=k.lb);l=this.scale;k=k.Fa.j;for(var m=k.length,n=0;n<m;n++){var p=k[n],q=p.actualBounds;q.Ic(f)&&(1<q.width*l||1<q.height*l?p.ic(b,this):gi(b,p))}b.globalAlpha=
1}}e.drawImage(c.Ga,0,0);c=this.Pa.j;e=c.length;for(d=0;d<e;d++)c[d].ic(b,this);this.oc=this.ai=!1}}};function Dk(a){var b=a.box;if(null!==b){var c=a.Wf;if(null!==c){a.oc=!0;c=c.viewportBounds;var d=b.selectionObject,e=K.alloc();e.h(c.width,c.height);d.desiredSize=e;K.free(e);a=2/a.scale;d instanceof W&&(d.strokeWidth=a);b.location=new G(c.x-a/2,c.y-a/2);b.isSelected=!0}}}
Bk.prototype.computeBounds=function(){var a=this.Wf;if(null===a)return Gc;var b=a.documentBounds.copy();b.Uc(a.viewportBounds);return b};Bk.prototype.lx=function(){!0!==this.oc&&(this.oc=!0,Ek(this))};Bk.prototype.fq=function(a,b,c,d){this.ob||(Ni(this),this.R(),fj(this),this.Xa(),Dk(this),this.we.scale=c,this.we.position.x=a.x,this.we.position.y=a.y,this.we.bounds.assign(a),this.we.nx=d,this.aa("ViewportBoundsChanged",this.we,a))};
pa.Object.defineProperties(Bk.prototype,{observed:{get:function(){return this.Wf},set:function(a){var b=this.Wf;a instanceof Bk&&A("Overview.observed Diagram may not be an Overview itself: "+a);b!==a&&(null!==b&&(this.remove(this.box),b.km("ViewportBoundsChanged",this.Em),b.km("DocumentBoundsChanged",this.Cm),b.km("InvalidateDraw",this.Dm),b.km("AnimationFinished",this.Bm)),this.Wf=a,null!==a&&(a.Kj("ViewportBoundsChanged",this.Em),a.Kj("DocumentBoundsChanged",this.Cm),
a.Kj("InvalidateDraw",this.Dm),a.Kj("AnimationFinished",this.Bm),this.add(this.box),Dk(this)),this.Xa(),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),Dk(this),this.g("box",b,a))}},drawsTemporaryLayers:{get:function(){return this.ar},set:function(a){this.ar!==a&&(this.ar=a,this.zh())}}});Bk.className="Overview";
function Ck(){xf.call(this);this.l=null}oa(Ck,xf);
Ck.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 G(c.width/2,c.height/2),a=a.firstInput.documentPoint,b.position=new G(a.x-this.l.x,a.y-this.l.y));return!0};
Ck.prototype.doActivate=function(){this.l=null;xf.prototype.doActivate.call(this)};Ck.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 G(d.x-c.x,d.y-c.y)}a=a.lastInput.documentPoint;b.position=new G(a.x-this.l.x,a.y-this.l.y)}}};Ck.className="OverviewDraggingTool";
function Fk(){mb(this);this.F=lf;this.Ub=this.K=this.u=!0;this.ba=this.La=this.Vb=this.Ma=!1;this.ii=this.l=null;this.Vc=1.05;this.bu=NaN;this.xw=null;this.Bu=NaN;this.Au=Gc;this.ag=null;this.Jc=200}Fk.prototype.toString=function(){return"CommandHandler"};Fk.prototype.hb=function(a){this.F=a};
Fk.prototype.doKeyDown=function(){var a=this.diagram,b=a.lastInput,c=ib?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()};
Fk.prototype.doKeyUp=function(){this.diagram.lastInput.bubbles=!0};Fk.prototype.stopCommand=function(){var a=this.diagram,b=a.currentTool;b instanceof Ua&&a.allowSelect&&a.Gs();null!==b&&b.doCancel()};Fk.prototype.canStopCommand=function(){return!0};
Fk.prototype.selectAll=function(){var a=this.diagram;a.R();try{a.currentCursor="wait";a.aa("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.aa("ChangedSelection",a.selection),a.currentCursor=""}};Fk.prototype.canSelectAll=function(){return this.diagram.allowSelect};
Fk.prototype.deleteSelection=function(){var a=this.diagram;try{a.currentCursor="wait";a.Aa("Delete");a.aa("ChangingSelection",a.selection);a.aa("SelectionDeleting",a.selection);for(var b=new F,c=a.selection.iterator;c.next();)Gk(b,c.value,!0,this.deletesTree?Infinity:0,this.deletesConnectedLinks?null:!1,function(a){return a.canDelete()});a.nt(b,!0);a.aa("SelectionDeleted",b)}finally{a.aa("ChangedSelection",a.selection),a.Za("Delete"),a.currentCursor=""}};
Fk.prototype.canDeleteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowDelete||0===a.selection.count?!1:!0};Fk.prototype.copySelection=function(){var a=this.diagram,b=new F;for(a=a.selection.iterator;a.next();)Gk(b,a.value,!0,this.copiesTree?Infinity:0,this.copiesConnectedLinks,function(a){return a.canCopy()});this.copyToClipboard(b)};Fk.prototype.canCopySelection=function(){var a=this.diagram;return a.allowCopy&&a.allowClipboard&&0!==a.selection.count?!0:!1};
Fk.prototype.cutSelection=function(){this.copySelection();this.deleteSelection()};Fk.prototype.canCutSelection=function(){var a=this.diagram;return!a.isReadOnly&&!a.isModelReadOnly&&a.allowCopy&&a.allowDelete&&a.allowClipboard&&0!==a.selection.count?!0:!1};
Fk.prototype.copyToClipboard=function(a){var b=this.diagram,c=null;if(null===a)zi=null,Ai="";else{c=b.model;var d=!1,e=!1,f=null;try{c.dm()&&(d=c.Tj,c.Tj=this.copiesParentKey),c.$j()&&(e=c.Sj,c.Sj=this.copiesGroupKey),f=b.Uj(a,null,!0)}finally{c.dm()&&(c.Tj=d),c.$j()&&(c.Sj=e),c=new E,c.addAll(f),zi=c,Ai=b.model.dataFormat}}b.aa("ClipboardChanged",c)};
Fk.prototype.pasteFromClipboard=function(){var a=new F,b=zi;if(null===b)return a;var c=this.diagram;if(Ai!==c.model.dataFormat)return a;var d=c.model,e=!1,f=!1,g=null;try{d.dm()&&(e=d.Tj,d.Tj=this.copiesParentKey),d.$j()&&(f=d.Sj,d.Sj=this.copiesGroupKey),g=c.Uj(b,c,!1)}finally{for(d.dm()&&(d.Tj=e),d.$j()&&(d.Sj=f),b=g.iterator;b.next();)c=b.value,d=b.key,c.location.s()||(d.location.s()?c.location=d.location:!c.position.s()&&d.position.s()&&(c.position=d.position)),a.add(c)}return a};
Fk.prototype.pasteSelection=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.currentCursor="wait";b.Aa("Paste");b.aa("ChangingSelection",b.selection);var c=this.pasteFromClipboard();0<c.count&&Hf(b);for(var d=c.iterator;d.next();)d.value.isSelected=!0;b.aa("ChangedSelection",b.selection);if(null!==a){var e=b.computePartsBounds(b.selection);if(e.s()){var f=this.computeEffectiveCollection(b.selection,b.Ik);ag(b,f,new G(a.x-e.centerX,a.y-e.centerY),b.Ik,!1)}}b.aa("ClipboardPasted",c)}finally{b.Za("Paste"),
b.currentCursor=""}};Fk.prototype.canPasteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowClipboard||null===zi||0===zi.count||Ai!==a.model.dataFormat?!1:!0};Fk.prototype.undo=function(){this.diagram.undoManager.undo()};Fk.prototype.canUndo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canUndo()};Fk.prototype.redo=function(){this.diagram.undoManager.redo()};
Fk.prototype.canRedo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canRedo()};Fk.prototype.decreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);var b=this.diagram;b.autoScale===ni&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};Fk.prototype.canDecreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);var b=this.diagram;if(b.autoScale!==ni)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};
Fk.prototype.increaseZoom=function(a){void 0===a&&(a=this.zoomFactor);var b=this.diagram;b.autoScale===ni&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};Fk.prototype.canIncreaseZoom=function(a){void 0===a&&(a=this.zoomFactor);var b=this.diagram;if(b.autoScale!==ni)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};Fk.prototype.resetZoom=function(a){void 0===a&&(a=this.defaultScale);var b=this.diagram;a<b.minScale||a>b.maxScale||(b.scale=a)};
Fk.prototype.canResetZoom=function(a){void 0===a&&(a=this.defaultScale);var b=this.diagram;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};Fk.prototype.zoomToFit=function(){var a=this.diagram,b=a.scale,c=a.position;b===this.Bu&&!isNaN(this.bu)&&a.documentBounds.A(this.Au)?(a.scale=this.bu,a.position=this.xw,this.Bu=NaN,this.Au=Gc):(this.bu=b,this.xw=c.copy(),a.zoomToFit(),this.Bu=a.scale,this.Au=a.documentBounds.copy())};Fk.prototype.canZoomToFit=function(){return this.diagram.allowZoom};
Fk.prototype.scrollToPart=function(a){void 0===a&&(a=null);var b=this.diagram;if(null===a){try{null!==this.ag&&(this.ag.next()?a=this.ag.value:this.ag=null)}catch(k){this.ag=null}null===a&&(0<b.highlighteds.count?this.ag=b.highlighteds.iterator:0<b.selection.count&&(this.ag=b.selection.iterator),null!==this.ag&&this.ag.next()&&(a=this.ag.value))}if(null!==a){var c=b.animationManager;c.Pi("Scroll To Part");var d=this.scrollToPartPause;if(0<d){var e=Hk(this,a,[a]),f=function(){b.Aa();for(var a=e.pop();0<
e.length&&a instanceof V&&a.isTreeExpanded&&(!(a instanceof hg)||a.isSubGraphExpanded);)a=e.pop();0<e.length?(a instanceof T&&b.Bv(a.actualBounds),a instanceof V&&!a.isTreeExpanded&&(a.isTreeExpanded=!0),a instanceof hg&&!a.isSubGraphExpanded&&(a.isSubGraphExpanded=!0)):(a instanceof T&&b.Gu(a.actualBounds),b.km("LayoutCompleted",g));b.Za("Scroll To Part")},g=function(){ua(f,(c.isEnabled?c.duration:0)+d)};b.Kj("LayoutCompleted",g);f()}else{var h=b.position.copy();b.Gu(a.actualBounds);h.Qa(b.position)&&
c.vd()}}};function Hk(a,b,c){if(b.isVisible())return c;if(b instanceof pf)Hk(a,b.adornedPart,c);else if(b instanceof S){var d=b.fromNode;null!==d&&Hk(a,d,c);b=b.toNode;null!==b&&Hk(a,b,c)}else b instanceof V&&(d=b.labeledLink,null!==d&&Hk(a,d,c),d=b.ng(),null!==d&&(d.isTreeExpanded||d.wasTreeExpanded||c.push(d),Hk(a,d,c))),b=b.containingGroup,null!==b&&(b.isSubGraphExpanded||b.wasSubGraphExpanded||c.push(b),Hk(a,b,c));return c}
Fk.prototype.canScrollToPart=function(a){void 0===a&&(a=null);if(null!==a&&!(a instanceof T))return!1;a=this.diagram;return 0===a.selection.count&&0===a.highlighteds.count?!1:a.allowHorizontalScroll&&a.allowVerticalScroll};
Fk.prototype.collapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Aa("Collapse Tree");b.animationManager.Pi("Collapse Tree");var c=new E;if(null!==a&&a.isTreeExpanded)a.collapseTree(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof V&&e.isTreeExpanded&&(e.collapseTree(),c.add(e))}b.aa("TreeCollapsed",c)}finally{b.Za("Collapse Tree")}};
Fk.prototype.canCollapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a){if(!(a instanceof V&&a.isTreeExpanded))return!1;if(0<a.Rp().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof V&&b.isTreeExpanded&&0<b.Rp().count)return!0;return!1};
Fk.prototype.expandTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Aa("Expand Tree");b.animationManager.Pi("Expand Tree");var c=new E;if(null!==a&&!a.isTreeExpanded)a.expandTree(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof V&&!e.isTreeExpanded&&(e.expandTree(),c.add(e))}b.aa("TreeExpanded",c)}finally{b.Za("Expand Tree")}};
Fk.prototype.canExpandTree=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a){if(!(a instanceof V)||a.isTreeExpanded)return!1;if(0<a.Rp().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof V&&!b.isTreeExpanded&&0<b.Rp().count)return!0;return!1};
Fk.prototype.groupSelection=function(){var a=this.diagram,b=a.model;if(b.ak()){var c=this.archetypeGroupData;if(null!==c){var d=null;try{a.currentCursor="wait";a.Aa("Group");a.aa("ChangingSelection",a.selection);for(var e=new E,f=a.selection.iterator;f.next();){var g=f.value;g.Lb()&&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.Ud(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.Ud(n)){e=!0;break}if(e)n=n.containingGroup;else break}if(c instanceof hg)Xg(c),d=c.copy(),null!==d&&a.add(d);else if(b.fv(c)){var q=b.copyNodeData(c);Ca(q)&&(b.jf(q),d=a.Ci(q))}if(null!==d){null!==n&&this.isValidMember(n,d)&&(d.containingGroup=n);for(var r=h.iterator;r.next();){var u=r.value;this.isValidMember(d,u)&&(u.containingGroup=d)}a.select(d)}}a.aa("ChangedSelection",a.selection);a.aa("SelectionGrouped",d)}finally{a.Za("Group"),a.currentCursor=
""}}}};Fk.prototype.canGroupSelection=function(){var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowGroup||!a.model.ak()||null===this.archetypeGroupData)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.Lb()&&b.canGroup())return!0}return!1};
function Ik(a){var b=Ka();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.Ud(b[g])){f=!1;break}f&&a.add(e)}Oa(b);return a}
Fk.prototype.isValidMember=function(a,b){if(null===b||a===b||b instanceof S)return!1;if(null!==a){if(a===b||a.Ud(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};
Fk.prototype.ungroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.model;if(c.ak())try{b.currentCursor="wait";b.Aa("Ungroup");b.aa("ChangingSelection",b.selection);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 hg&&f.canUngroup()&&d.add(f)}var g=new E;if(0<d.count){b.Gs();for(var h=d.iterator;h.next();){var k=h.value;k.expandSubGraph();var l=k.containingGroup,m=null!==l&&null!==l.data?c.pa(l.data):void 0;g.addAll(k.memberParts);
for(var n=g.iterator;n.next();){var p=n.value;p.isSelected=!0;if(!(p instanceof S)){var q=p.data;null!==q?c.qt(q,m):p.containingGroup=l}}b.remove(k)}}b.aa("ChangedSelection",b.selection);b.aa("SelectionUngrouped",d,g)}finally{b.Za("Ungroup"),b.currentCursor=""}};
Fk.prototype.canUngroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly||b.isModelReadOnly||!b.allowDelete||!b.allowUngroup||!b.model.ak())return!1;if(null!==a){if(!(a instanceof hg))return!1;if(a.canUngroup())return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof hg&&b.canUngroup())return!0;return!1};
Fk.prototype.addTopLevelParts=function(a,b){var c=!0;for(a=Ik(a).iterator;a.next();){var d=a.value;null!==d.containingGroup&&(!b||this.isValidMember(null,d)?d.containingGroup=null:c=!1)}return c};
Fk.prototype.collapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Aa("Collapse SubGraph");b.animationManager.Pi("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 hg&&e.isSubGraphExpanded&&(e.collapseSubGraph(),c.add(e))}b.aa("SubGraphCollapsed",c)}finally{b.Za("Collapse SubGraph")}};
Fk.prototype.canCollapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof hg&&a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof hg&&b.isSubGraphExpanded)return!0;return!1};
Fk.prototype.expandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Aa("Expand SubGraph");b.animationManager.Pi("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 hg&&!e.isSubGraphExpanded&&(e.expandSubGraph(),c.add(e))}b.aa("SubGraphExpanded",c)}finally{b.Za("Expand SubGraph")}};
Fk.prototype.canExpandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof hg&&!a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof hg&&!b.isSubGraphExpanded)return!0;return!1};
Fk.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.Wl(function(a){return a instanceof uh&&a.editable})}null!==a&&(b.currentTool=null,c.textBlock=a,b.currentTool=c)}};
Fk.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 uh))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.Wl(function(a){return a instanceof uh&&a.editable}),null!==a))return!0;return!1};
Fk.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.ma(dd):b.isMouseOverDiagram||(e=b.viewportBounds,e=new G(e.x+e.width/2,e.y+e.height/2));null!==e&&(d.viewPoint=b.ut(e),d.documentPoint=e,d.left=!1,d.right=!0,d.up=!0);b.currentTool=c;qh(c,!1,a)}};
Fk.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};
Fk.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.Ik);d=new Lb;if(null===a)return d;for(var f=a.iterator;f.next();)Ij(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};
pa.Object.defineProperties(Fk.prototype,{diagram:{get:function(){return this.F}},copiesClipboardData:{get:function(){return this.u},set:function(a){this.u=a}},copiesConnectedLinks:{get:function(){return this.K},set:function(a){this.K=a}},deletesConnectedLinks:{get:function(){return this.Ub},set:function(a){this.Ub=a}},copiesTree:{get:function(){return this.Ma},
set:function(a){this.Ma=a}},deletesTree:{get:function(){return this.Vb},set:function(a){this.Vb=a}},copiesParentKey:{get:function(){return this.La},set:function(a){this.La=a}},copiesGroupKey:{get:function(){return this.ba},set:function(a){this.ba=a}},archetypeGroupData:{get:function(){return this.l},set:function(a){this.l=a}},memberValidation:{get:function(){return this.ii},
set:function(a){this.ii=a}},defaultScale:{get:function(){return this.diagram.defaultScale},set:function(a){this.diagram.defaultScale=a}},zoomFactor:{get:function(){return this.Vc},set:function(a){1<a||A("zoomFactor must be larger than 1.0, not: "+a);this.Vc=a}},scrollToPartPause:{get:function(){return this.Jc},set:function(a){this.Jc=a}}});Fk.className="CommandHandler";ui=function(){return new Fk};
function Y(){mb(this);this.G=4225027;this.lb=1;this.Zf=null;this.Ua="";this.dc=this.ib=null;this.sa=(new G(NaN,NaN)).freeze();this.Mc=mc;this.Of=fc;this.Nf=lc;this.tb=new Qc;this.Ch=new Qc;this.Lf=new Qc;this.Ca=this.Pk=1;this.zc=0;this.te=Jk;this.Tg=Oc;this.qc=(new L(NaN,NaN,NaN,NaN)).freeze();this.vb=(new L(NaN,NaN,NaN,NaN)).freeze();this.hc=(new L(0,0,NaN,NaN)).freeze();this.P=this.Lo=this.Mo=null;this.tk=this.wb=Ed;this.Yo=0;this.Zo=1;this.Bg=0;this.Wm=1;this.op=null;this.cp=-Infinity;this.vl=
0;this.wl=ac;this.xl=Ng;this.fn="";this.bb=this.O=null;this.Ak=-1;this.zl=this.kd=this.Rh=this.Cl=null;this.cs=Yg;this.yj=null}var be,Yg,$g,Jk,Kk,Lk,Mk,Nk,Ok,Pk;
Y.prototype.cloneProtected=function(a){a.G=this.G|6144;a.lb=this.lb;a.Ua=this.Ua;a.ib=this.ib;a.dc=this.dc;a.sa.assign(this.sa);a.Mc=this.Mc.I();a.Of=this.Of.I();a.Nf=this.Nf.I();a.Lf=this.Lf.copy();a.Ca=this.Ca;a.zc=this.zc;a.te=this.te;a.Tg=this.Tg.I();a.qc.assign(this.qc);a.vb.assign(this.vb);a.hc.assign(this.hc);a.Lo=this.Lo;null!==this.P&&(a.P=this.P.copy());a.wb=this.wb.I();a.tk=this.tk.I();a.Yo=this.Yo;a.Zo=this.Zo;a.Bg=this.Bg;a.Wm=this.Wm;a.op=this.op;a.cp=this.cp;a.vl=this.vl;a.wl=this.wl.I();
a.xl=this.xl;a.fn=this.fn;null!==this.O&&(a.O=this.O.copy());a.bb=this.bb;a.Ak=this.Ak;null!==this.Rh&&(a.Rh=Ga(this.Rh));null!==this.kd&&(a.kd=this.kd.copy());a.zl=this.zl};Y.prototype.Nw=function(a){var b=this.Rh;if(Ea(b))for(var c=0;c<b.length;c++){if(b[c]===a)return}else this.Rh=b=[];b.push(a)};Y.prototype.nf=function(a){a.Mo=null;a.yj=null;a.o()};
Y.prototype.clone=function(){var a=new this.constructor;this.cloneProtected(a);if(null!==this.Rh)for(var b=0;b<this.Rh.length;b++){var c=this.Rh[b];a[c]=this[c]}return a};Y.prototype.copy=function(){return this.clone()};t=Y.prototype;t.fb=function(a){a.classType===S?0===a.name.indexOf("Orient")?this.segmentOrientation=a:A("Unknown Link enum value for GraphObject.segmentOrientation property: "+a):a.classType===Y&&(this.stretch=a)};t.toString=function(){return Pa(this.constructor)+"#"+Bb(this)};
function Qk(a){null===a.O&&(a.O=new Rk)}t.Hc=function(){if(null===this.P){var a=new Sk;a.Kg=Sc;a.kh=Sc;a.Ig=10;a.ih=10;a.Jg=0;a.jh=0;this.P=a}};t.ab=function(a,b,c,d,e,f,g){var h=this.part;if(null!==h&&(h.kk(a,b,c,d,e,f,g),Tk(this)&&c===this&&a===af&&Uk(this,h,b),this instanceof X&&c===h&&0!==(h.G&16777216)&&null!==h.data))for(a=this.W.j,c=a.length,d=0;d<c;d++)e=a[d],e instanceof X&&zj(e,function(a){null!==a.data&&0!==(a.G&16777216)&&a.Ea(b)})};
function Uk(a,b,c){var d=a.Ei();if(null!==d)for(var e=a.bb.iterator;e.next();){var f=e.value,g=null;if(null!==f.sourceName){g=Vk(f,d,a);if(null===g)continue;f.rq(a,g,c,null)}else if(f.isToModel){var h=b.diagram;null===h||h.skipsModelSourceBindings||f.rq(a,h.model.modelData,c,d)}else{h=d.data;if(null===h)continue;var k=b.diagram;null===k||k.skipsModelSourceBindings||f.rq(a,h,c,d)}g===a&&(h=d.Ns(f.Vi),null!==h&&f.Tv(h,g,c))}}t.Ns=function(a){return this.Ak===a?this:null};
t.g=function(a,b,c){this.ab(af,a,this,b,c)};function Wk(a,b,c,d,e){var f=a.qc,g=a.Lf;g.reset();Xk(a,g,b,c,d,e);a.Lf=g;f.h(b,c,d,e);g.$s()||g.Qv(f)}function Yk(a,b,c,d){if(!1===a.pickable)return!1;d.multiply(a.transform);return c?a.Ic(b,d):a.rh(b,d)}
t.gx=function(a,b,c){if(!1===this.pickable)return!1;var d=this.naturalBounds;b=a.Ae(b);return c?Rb(a.x,a.y,0,0,0,d.height)<=b||Rb(a.x,a.y,0,d.height,d.width,d.height)<=b||Rb(a.x,a.y,d.width,d.height,d.width,0)<=b||Rb(a.x,a.y,d.width,0,0,0)<=b:a.cd(0,0)<=b&&a.cd(0,d.height)<=b&&a.cd(d.width,0)<=b&&a.cd(d.width,d.height)<=b};t.Yd=function(){return!0};
t.ea=function(a){var b=G.alloc();b.assign(a);this.transform.ta(b);var c=this.actualBounds;if(!c.s())return G.free(b),!1;var d=this.diagram;if(null!==d&&d.Pe){var e=d.$l("extraTouchThreshold"),f=d.$l("extraTouchArea"),g=f/2,h=this.naturalBounds;d=this.Be()*d.scale;var k=1/d;if(h.width*d<e&&h.height*d<e)return a=Cc(c.x-g*k,c.y-g*k,c.width+f*k,c.height+f*k,b.x,b.y),G.free(b),a}e=!1;if(this instanceof pf||this instanceof W?Cc(c.x-5,c.y-5,c.width+10,c.height+10,b.x,b.y):c.ea(b))this.kd&&!this.kd.ea(b)?
e=!1:null!==this.dc&&c.ea(b)?e=!0:null!==this.ib&&this.hc.ea(a)?e=!0:e=this.sh(a);G.free(b);return e};t.sh=function(a){var b=this.naturalBounds;return Cc(0,0,b.width,b.height,a.x,a.y)};
t.mf=function(a){if(0===this.angle)return this.actualBounds.mf(a);var b=this.naturalBounds;b=L.allocAt(0,0,b.width,b.height);var c=this.transform,d=!1,e=G.allocAt(a.x,a.y);b.ea(c.Td(e))&&(e.h(a.x,a.bottom),b.ea(c.Td(e))&&(e.h(a.right,a.bottom),b.ea(c.Td(e))&&(e.h(a.right,a.y),b.ea(c.Td(e))&&(d=!0))));G.free(e);L.free(b);return d};
t.rh=function(a,b){if(void 0===b)return a.mf(this.actualBounds);var c=this.naturalBounds,d=!1,e=G.allocAt(0,0);a.ea(b.ta(e))&&(e.h(0,c.height),a.ea(b.ta(e))&&(e.h(c.width,c.height),a.ea(b.ta(e))&&(e.h(c.width,0),a.ea(b.ta(e))&&(d=!0))));G.free(e);return d};
t.Ic=function(a,b){if(void 0===b&&(b=this.transform,0===this.angle))return a.Ic(this.actualBounds);var c=this.naturalBounds,d=G.allocAt(0,0),e=G.allocAt(0,c.height),f=G.allocAt(c.width,c.height),g=G.allocAt(c.width,0),h=!1;if(a.ea(b.ta(d))||a.ea(b.ta(e))||a.ea(b.ta(f))||a.ea(b.ta(g)))h=!0;else{c=L.allocAt(0,0,c.width,c.height);var k=G.allocAt(a.x,a.y);c.ea(b.Td(k))?h=!0:(k.h(a.x,a.bottom),c.ea(b.Td(k))?h=!0:(k.h(a.right,a.bottom),c.ea(b.Td(k))?h=!0:(k.h(a.right,a.y),c.ea(b.Td(k))&&(h=!0))));G.free(k);
L.free(c);!h&&(H.Xs(a,d,e)||H.Xs(a,e,f)||H.Xs(a,f,g)||H.Xs(a,g,d))&&(h=!0)}G.free(d);G.free(e);G.free(f);G.free(g);return h};t.ma=function(a,b){void 0===b&&(b=new G);if(a instanceof O){var c=this.naturalBounds;b.h(a.x*c.width+a.offsetX,a.y*c.height+a.offsetY)}else b.set(a);this.rd.ta(b);return b};
t.Sp=function(a){void 0===a&&(a=new L);var b=this.naturalBounds,c=this.rd,d=G.allocAt(0,0).transform(c);a.h(d.x,d.y,0,0);d.h(b.width,0).transform(c);Bc(a,d.x,d.y,0,0);d.h(b.width,b.height).transform(c);Bc(a,d.x,d.y,0,0);d.h(0,b.height).transform(c);Bc(a,d.x,d.y,0,0);G.free(d);return a};t.Hi=function(){var a=this.rd;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.Be=function(){if(0!==(this.G&4096)===!1)return this.Pk;var a=this.Ca;return null!==this.panel?a*this.panel.Be():a};t.Ts=function(a,b){void 0===b&&(b=new G);b.assign(a);this.rd.Td(b);return b};t.Sc=function(a,b,c){return this.Zj(a.x,a.y,b.x,b.y,c)};
t.Zj=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,H.Sc(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=H.Sc(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!==mj(this)){var e=this.Tg,f=e.right+e.left;e=e.top+e.bottom;a=Math.max(a-f,0);b=Math.max(b-e,0);c=Math.max((c||0)-f,0);d=Math.max((d||0)-e,0);f=this.angle;e=this.desiredSize;var g=0;this instanceof W&&(g=this.strokeWidth);90===f||270===f?(a=isFinite(e.height)?e.height+g:a,b=isFinite(e.width)?e.width+g:b):(a=isFinite(e.width)?e.width+g:a,b=isFinite(e.height)?e.height+g:b);e=c||0;g=d||0;var h=this instanceof X;switch(Zk(this,!0)){case Yg:g=e=0;h&&(b=a=Infinity);
break;case be:isFinite(a)&&a>c&&(e=a);isFinite(b)&&b>d&&(g=b);break;case Kk:isFinite(a)&&a>c&&(e=a);g=0;h&&(b=Infinity);break;case Lk:isFinite(b)&&b>d&&(g=b),e=0,h&&(a=Infinity)}h=this.maxSize;var k=this.minSize;e>h.width&&k.width<h.width&&(e=h.width);g>h.height&&k.height<h.height&&(g=h.height);c=Math.max(e/this.scale,k.width);d=Math.max(g/this.scale,k.height);h.width<c&&(c=Math.min(k.width,c));h.height<d&&(d=Math.min(k.height,d));a=Math.min(h.width,a);b=Math.min(h.height,b);a=Math.max(c,a);b=Math.max(d,
b);if(90===f||270===f)f=a,a=b,b=f,f=c,c=d,d=f;this.qc.ha();this.fm(a,b,c,d);this.qc.freeze();this.qc.s()||A("Non-real measuredBounds has been set. Object "+this+", measuredBounds: "+this.qc.toString());hj(this,!1)}};Y.prototype.fm=function(){};Y.prototype.rg=function(){return!1};
Y.prototype.arrange=function(a,b,c,d,e){this.bl();var f=L.alloc();f.assign(this.vb);this.vb.ha();!1===nj(this)?this.vb.h(a,b,c,d):this.qh(a,b,c,d);this.vb.freeze();void 0===e?this.kd=null:this.kd=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.hc,d=this.measuredBounds,null!==this.areaBackground&&(d=this.vb),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 uh&&(a=this.naturalBounds,
this.Kr>a.height||this.metrics.maxLineWidth>a.width)))c=!0;this.G=c?this.G|256:this.G&-257;this.vb.s()||A("Non-real actualBounds has been set. Object "+this+", actualBounds: "+this.vb.toString());this.it(f,this.vb);$k(this,!1);L.free(f)};t=Y.prototype;t.qh=function(){};
function al(a,b,c,d,e){a.vb.h(b,c,d,e);if(!a.desiredSize.s()){var f=a.qc;c=a.Tg;b=c.right+c.left;var g=c.top+c.bottom;c=f.width+b;f=f.height+g;d+=b;e+=g;b=Zk(a,!0);c===d&&f===e&&(b=Yg);switch(b){case Yg:if(c>d||f>e)hj(a,!0),a.measure(c>d?d:c,f>e?e:f,0,0);break;case be:hj(a,!0);a.measure(d,e,0,0);break;case Kk:hj(a,!0);a.measure(d,f,0,0);break;case Lk:hj(a,!0),a.measure(c,e,0,0)}}}
t.it=function(a,b){var c=this.part;null!==c&&null!==c.diagram&&(c.selectionObject!==this&&c.resizeObject!==this&&c.rotateObject!==this||bl(c,!0),this.R(),xc(a,b)||(c.wh(),this.Ao(c)))};t.Ao=function(a){null!==this.portId&&(bl(a,!0),a instanceof V&&cl(a,this))};
t.ic=function(a,b){if(this.visible){var c=this instanceof X&&(this.type===X.TableRow||this.type===X.TableColumn),d=this.vb;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.ax(a,b))if(c)dl(this,a,b);else{this instanceof S&&this.dk(!1);c=this.transform;var g=this.panel;0!==(this.G&4096)===!0&&el(this);var h=this.part,k=!1,l=0;if(h&&b.Ce("drawShadows")&&(k=h.isShadowed)){var m=h.ri;l=Math.max(m.y,m.x)*
b.scale*b.$b}if(!(m=b.kj)){var n=this.hc;m=this.Ch;var p=m.m11,q=m.m21,r=m.dx,u=m.m12,x=m.m22,v=m.dy,y,z=y=0;m=y*p+z*q+r;var B=y*u+z*x+v;y=n.width+l;z=0;var C=y*p+z*q+r;y=y*u+z*x+v;m=Math.min(m,C);B=Math.min(B,y);var I=Math.max(m,C)-m;var J=Math.max(B,y)-B;y=n.width+l;z=n.height+l;C=y*p+z*q+r;y=y*u+z*x+v;m=Math.min(m,C);B=Math.min(B,y);I=Math.max(m+I,C)-m;J=Math.max(B+J,y)-B;y=0;z=n.height+l;C=y*p+z*q+r;y=y*u+z*x+v;m=Math.min(m,C);B=Math.min(B,y);I=Math.max(m+I,C)-m;J=Math.max(B+J,y)-B;l=b.viewportBounds;
n=l.C;p=l.D;m=!(m>l.$+n||n>I+m||B>l.Y+p||p>J+B)}if(m){m=0!==(this.G&256);a.clipInsteadOfFill&&(m=!1);this instanceof uh&&(a.font=this.font);if(m){B=g.Yd()?g.naturalBounds:g.actualBounds;null!==this.kd?(n=this.kd,I=n.x,J=n.y,l=n.width,n=n.height):(I=Math.max(d.x,B.x),J=Math.max(d.y,B.y),l=Math.min(d.right,B.right)-I,n=Math.min(d.bottom,B.bottom)-J);if(I>d.width+d.x||d.x>B.width+B.x){1!==e&&(a.globalAlpha=f);return}a.save();a.beginPath();a.rect(I,J,l,n);a.clip()}if(this.rg()){if(!h.isVisible()){1!==
e&&(a.globalAlpha=f);return}k&&(B=h.ri,a.Jv(B.x*b.scale*b.$b,B.y*b.scale*b.$b,h.Nd),fl(a),a.shadowColor=h.Fj)}!0===this.shadowVisible?fl(a):!1===this.shadowVisible&&gl(a);h=this.naturalBounds;null!==this.dc&&(hi(this,a,this.dc,!0,!0,h,d),this.dc instanceof hl&&this.dc.type===il?(a.beginPath(),a.rect(d.x,d.y,d.width,d.height),a.Sd(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.G&512)||null!==g&&(g.type===X.Auto||g.type===X.Spot)&&
g.zb()!==this)&&null===this.shadowVisible&&gl(a);null!==this.ib&&(l=this.naturalBounds,I=B=0,J=l.width,l=l.height,n=0,this instanceof W&&(l=this.qa.bounds,B=l.x,I=l.y,J=l.width,l=l.height,n=this.strokeWidth),hi(this,a,this.ib,!0,!1,h,d),this.ib instanceof hl&&this.ib.type===il?(a.beginPath(),a.rect(B-n/2,I-n/2,J+n,l+n),a.Sd(this.ib)):a.fillRect(B-n/2,I-n/2,J+n,l+n));k&&(null!==this.ib||null!==this.dc||null!==g&&0!==(g.G&512)||null!==g&&(g.type===X.Auto||g.type===X.Spot)&&g.zb()!==this)?(jl(this,!0),
null===this.shadowVisible&&gl(a)):jl(this,!1);this.Ai(a,b);k&&0!==(this.G&512)===!0&&fl(a);this.rg()&&k&&gl(a);m?(a.restore(),this instanceof X?a.Qc(!0):a.Qc(!1)):c.$s()||(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.ax=function(){return!1};
function dl(a,b,c){var d=a.vb,e=a.hc;null!==a.dc&&(hi(a,b,a.dc,!0,!0,e,d),a.dc instanceof hl&&a.dc.type===il?(b.beginPath(),b.rect(d.x,d.y,d.width,d.height),b.Sd(a.dc)):b.fillRect(d.x,d.y,d.width,d.height));null!==a.ib&&(hi(a,b,a.ib,!0,!1,e,d),a.ib instanceof hl&&a.ib.type===il?(b.beginPath(),b.rect(d.x,d.y,d.width,d.height),b.Sd(a.ib)):b.fillRect(d.x,d.y,d.width,d.height));a.Ai(b,c)}t.Ai=function(){};
function hi(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===kl)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 ll)&&c.be&&(c.type===ml||c.Dk===h&&c.Ht===k))var l=c.be;else{var m=0,n=0,p=0,q=0,r=0,u=0;u=r=0;e&&(r=g.x,u=g.y);m=c.start.x*h+c.start.offsetX;n=c.start.y*k+c.start.offsetY;p=c.end.x*h+c.end.offsetX;q=c.end.y*k+c.end.offsetY;m+=r;p+=r;n+=u;q+=u;if(c.type===nl)l=
b.createLinearGradient(m,n,p,q);else if(c.type===il)u=isNaN(c.endRadius)?Math.max(h,k)/2:c.endRadius,isNaN(c.startRadius)?(r=0,u=Math.max(h,k)/2):r=c.startRadius,l=b.createRadialGradient(m,n,r,p,q,u);else if(c.type===ml)try{l=b.createPattern(c.pattern,"repeat")}catch(v){l=null}if(c.type!==ml&&(e=c.colorStops,null!==e))for(e=e.iterator;e.next();)l.addColorStop(e.key,e.value);if(f&&(c.be=l,null!==l&&(c.Dk=h,c.Ht=k),null===l&&c.type===ml&&-1!==c.Dk)){c.Dk=-1;var x=a.diagram;null!==x&&-1===c.Dk&&ua(function(){x.zh()},
600)}}d?b.fillStyle=l:b.strokeStyle=l}}}t.pg=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.rf=function(){if(!this.visible)return!1;var a=this.panel;return null!==a?a.rf():!0};t.qg=function(){for(var a=this instanceof X?this:this.panel;null!==a&&a.isEnabled;)a=a.panel;return null===a};
function el(a){if(0!==(a.G&2048)===!0){var b=a.tb;b.reset();if(!a.vb.s()||!a.qc.s()){ol(a,!1);return}b.translate(a.vb.x-a.qc.x,a.vb.y-a.qc.y);if(1!==a.scale||0!==a.angle){var c=a.naturalBounds;Xk(a,b,c.x,c.y,c.width,c.height)}ol(a,!1);pl(a,!0)}0!==(a.G&4096)===!0&&(b=a.panel,null===b?(a.Ch.set(a.tb),a.Pk=a.scale,pl(a,!1)):null!==b.rd&&(c=a.Ch,c.reset(),b.Yd()?c.multiply(b.Ch):null!==b.panel&&c.multiply(b.panel.Ch),c.multiply(a.tb),a.Pk=a.scale*b.Pk,pl(a,!1)))}
function Xk(a,b,c,d,e,f){1!==a.scale&&b.scale(a.scale);if(0!==a.angle){var g=dd;a.rg()&&a.locationSpot.gb()&&(g=a.locationSpot);var h=G.alloc();if(a instanceof T&&a.locationObject!==a)for(c=a.locationObject,d=c.naturalBounds,h.mk(d.x,d.y,d.width,d.height,g),c.Lf.ta(h),h.offset(-c.measuredBounds.x,-c.measuredBounds.y),g=c.panel;null!==g&&g!==a;)g.Lf.ta(h),h.offset(-g.measuredBounds.x,-g.measuredBounds.y),g=g.panel;else h.mk(c,d,e,f,g);b.rotate(a.angle,h.x,h.y);G.free(h)}}
t.o=function(a){void 0===a&&(a=!1);if(!0!==mj(this)){hj(this,!0);$k(this,!0);var b=this.panel;null===b||a||b.o()}};t.bm=function(){!0!==mj(this)&&(hj(this,!0),$k(this,!0))};function ql(a){if(!1===nj(a)){var b=a.panel;null!==b?b.o():a.rg()&&(b=a.diagram,null!==b&&(b.Dd.add(a),a instanceof V&&a.ed(),b.cc()));$k(a,!0)}}t.bl=function(){0!==(this.G&2048)===!1&&(ol(this,!0),pl(this,!0))};t.dv=function(){pl(this,!0)};t.R=function(){var a=this.part;null!==a&&a.R()};
function Zk(a,b){var c=a.stretch,d=a.panel;if(null!==d&&d.type===X.Table)return rl(a,d.getRowDefinition(a.row),d.getColumnDefinition(a.column),b);if(null!==d&&d.type===X.Auto&&d.zb()===a)return sl(a,be,b);if(c===Jk){if(null!==d){if(d.type===X.Spot&&d.zb()===a)return sl(a,be,b);c=d.defaultStretch;return c===Jk?sl(a,Yg,b):sl(a,c,b)}return sl(a,Yg,b)}return sl(a,c,b)}
function rl(a,b,c,d){var e=a.stretch;if(e!==Jk)return sl(a,e,d);var f=e=null;switch(b.stretch){case Lk:f=!0;break;case be:f=!0}switch(c.stretch){case Kk:e=!0;break;case be:e=!0}b=a.panel.defaultStretch;null===e&&(e=b===Kk||b===be);null===f&&(f=b===Lk||b===be);return!0===e&&!0===f?sl(a,be,d):!0===e?sl(a,Kk,d):!0===f?sl(a,Lk,d):sl(a,Yg,d)}
function sl(a,b,c){if(c)return b;if(b===Yg)return Yg;c=a.desiredSize;if(c.s())return Yg;a=a.angle;if(!isNaN(c.width))if(90!==a&&270!==a){if(b===Kk)return Yg;if(b===be)return Lk}else{if(b===Lk)return Yg;if(b===be)return Kk}if(!isNaN(c.height))if(90!==a&&270!==a){if(b===Lk)return Yg;if(b===be)return Kk}else{if(b===Kk)return Yg;if(b===be)return Lk}return b}function jl(a,b){a.G=b?a.G|512:a.G&-513}function Tk(a){return 0!==(a.G&1024)}function tl(a,b){a.G=b?a.G|1024:a.G&-1025}
function ol(a,b){a.G=b?a.G|2048:a.G&-2049}function pl(a,b){a.G=b?a.G|4096:a.G&-4097}function mj(a){return 0!==(a.G&8192)}function hj(a,b){a.G=b?a.G|8192:a.G&-8193}function nj(a){return 0!==(a.G&16384)}function $k(a,b){a.G=b?a.G|16384:a.G&-16385}t.Qi=function(a){this.Zf=a};t.Hv=function(){};t.Gv=function(a){this.sa=a;ql(this);return!0};t.tt=function(a,b){this.sa.h(a,b);this.bl()};
function ul(a){var b=a.part;if(b instanceof V&&(null!==a.portId||a===b.port)){var c=b.diagram;null===c||c.undoManager.isUndoingRedoing||cl(b,a)}}function vl(a){var b=a.diagram;null===b||b.undoManager.isUndoingRedoing||(a instanceof X?a instanceof V?a.ed():a.wm(a,function(a){ul(a)}):ul(a))}t.bind=function(a){a.Pd=this;var b=this.Ei();null!==b&&wl(b)&&A("Cannot add a Binding to a template that has already been copied: "+a);null===this.bb&&(this.bb=new E);this.bb.add(a)};
t.Ei=function(){for(var a=this instanceof X?this:this.panel;null!==a;){if(null!==a.Ph)return a;a=a.panel}return null};t.Iv=function(a){tj(this,a)};
function xl(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=yl.J(a);"function"===typeof f?(c=Ga(arguments),d=f(c),Ca(d)||A('GraphObject.make invoked object builder "'+a+'", but it did not return an Object')):e=w.go[a]}null===d&&(void 0!==e&&null!==e&&e.constructor||A("GraphObject.make requires a class function or GoJS class name or name of an object builder, not: "+a),d=new e);e=1;if(d instanceof P&&1<c.length){f=
d;var g=c[1];if("string"===typeof g||g instanceof HTMLDivElement)yi(f,g),e++}for(;e<c.length;e++)f=c[e],void 0===f?A("Undefined value at argument "+e+" for object being constructed by GraphObject.make: "+d):zl(d,f);return d}
function zl(a,b){if("string"===typeof b)if(a instanceof uh)a.text=b;else if(a instanceof W)a.figure=b;else if(a instanceof ak)a.source=b;else if(a instanceof X)b=Al.J(b),null!==b&&(a.type=b);else if(a instanceof hl){var c=qb(hl,b);null!==c?a.type=c:A("Unknown Brush type as an argument to GraphObject.make: "+b)}else a instanceof $d?(b=qb($d,b),null!==b&&(a.type=b)):a instanceof Ve&&(b=qb(Ve,b),null!==b&&(a.type=b));else if(b instanceof Y)a instanceof X||A("A GraphObject can only be added to a Panel, not to: "+
a),a.add(b);else if(b instanceof Oj){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 Oj?d.Tl(b):A("A RowColumnDefinition can only be added to an object that implements getRowDefinition/getColumnDefinition, not to: "+a)}else if(b instanceof D)"function"===typeof a.fb&&a.fb(b);else if(b instanceof Bl)a.type=b;else if(b instanceof Ci)a instanceof Y?a.bind(b):a instanceof
Oj?a.bind(b):A("A Binding can only be applied to a GraphObject or RowColumnDefinition, not to: "+a);else if(b instanceof Ue)a instanceof $d?a.figures.add(b):A("A PathFigure can only be added to a Geometry, not to: "+a);else if(b instanceof Ve)a instanceof Ue?a.segments.add(b):A("A PathSegment can only be added to a PathFigure, not to: "+a);else if(b instanceof wi)a instanceof P?a.layout=b:a instanceof hg?a.layout=b:A("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++)zl(a,b[c]);else if("object"===typeof b&&null!==b)if(a instanceof hl){c=new tb;for(var e in b)d=parseFloat(e),isNaN(d)?c[e]=b[e]:a.addColorStop(d,b[e]);tj(a,c)}else if(a instanceof Oj){void 0!==b.row?(e=b.row,(void 0===e||null===e||Infinity===e||isNaN(e)||0>e)&&A("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)&&A("Must specify non-negative integer column for RowColumnDefinition "+
b+", not: "+e),a.isRow=!1,a.index=e);e=new tb;for(c in b)"row"!==c&&"column"!==c&&(e[c]=b[c]);tj(a,e)}else tj(a,b);else A('Unknown initializer "'+b+'" for object being constructed by GraphObject.make: '+a)}function Cl(a,b){yl.add(a,b)}function Dl(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}
pa.Object.defineProperties(Y.prototype,{shadowVisible:{get:function(){return this.zl},set:function(a){var b=this.zl;b!==a&&(this.zl=a,this.R(),this.g("shadowVisible",b,a))}},enabledChanged:{get:function(){return null!==this.O?this.O.yn:null},set:function(a){Qk(this);var b=this.O.yn;b!==a&&(this.O.yn=a,this.g("enabledChanged",b,a))}},segmentOrientation:{get:function(){return this.xl},set:function(a){var b=this.xl;
b!==a&&(this.xl=a,this.o(),this.g("segmentOrientation",b,a),a===Ng&&(this.angle=0))}},segmentIndex:{get:function(){return this.cp},set:function(a){a=Math.round(a);var b=this.cp;b!==a&&(this.cp=a,this.o(),this.g("segmentIndex",b,a))}},segmentFraction:{get:function(){return this.vl},set:function(a){isNaN(a)?a=0:0>a?a=0:1<a&&(a=1);var b=this.vl;b!==a&&(this.vl=a,this.o(),this.g("segmentFraction",b,a))}},segmentOffset:{
get:function(){return this.wl},set:function(a){var b=this.wl;b.A(a)||(this.wl=a=a.I(),this.o(),this.g("segmentOffset",b,a))}},stretch:{get:function(){return this.te},set:function(a){var b=this.te;b!==a&&(this.te=a,this.o(),this.g("stretch",b,a))}},name:{get:function(){return this.Ua},set:function(a){var b=this.Ua;b!==a&&(this.Ua=a,null!==this.part&&(this.part.tj=null),this.g("name",b,a))}},opacity:{get:function(){return this.lb},
set:function(a){var b=this.lb;b!==a&&((0>a||1<a)&&xa(a,"0 <= value <= 1",Y,"opacity"),this.lb=a,this.g("opacity",b,a),a=this.diagram,b=this.part,null!==a&&null!==b&&a.R(xj(b,b.actualBounds)))}},visible:{get:function(){return 0!==(this.G&1)},set:function(a){var b=0!==(this.G&1);b!==a&&(this.G^=1,this.g("visible",b,a),b=this.panel,null!==b?b.o():this.rg()&&this.Mb(a),this.R(),vl(this))}},pickable:{get:function(){return 0!==(this.G&2)},set:function(a){var b=
0!==(this.G&2);b!==a&&(this.G^=2,this.g("pickable",b,a))}},fromLinkableDuplicates:{get:function(){return 0!==(this.G&4)},set:function(a){var b=0!==(this.G&4);b!==a&&(this.G^=4,this.g("fromLinkableDuplicates",b,a))}},fromLinkableSelfNode:{get:function(){return 0!==(this.G&8)},set:function(a){var b=0!==(this.G&8);b!==a&&(this.G^=8,this.g("fromLinkableSelfNode",b,a))}},toLinkableDuplicates:{get:function(){return 0!==
(this.G&16)},set:function(a){var b=0!==(this.G&16);b!==a&&(this.G^=16,this.g("toLinkableDuplicates",b,a))}},toLinkableSelfNode:{get:function(){return 0!==(this.G&32)},set:function(a){var b=0!==(this.G&32);b!==a&&(this.G^=32,this.g("toLinkableSelfNode",b,a))}},isPanelMain:{get:function(){return 0!==(this.G&64)},set:function(a){var b=0!==(this.G&64);b!==a&&(this.G^=64,this.o(),this.g("isPanelMain",b,a))}},isActionable:{
get:function(){return 0!==(this.G&128)},set:function(a){var b=0!==(this.G&128);b!==a&&(this.G^=128,this.g("isActionable",b,a))}},areaBackground:{get:function(){return this.dc},set:function(a){var b=this.dc;b!==a&&(a instanceof hl&&a.freeze(),this.dc=a,this.R(),this.g("areaBackground",b,a))}},background:{get:function(){return this.ib},set:function(a){var b=this.ib;b!==a&&(a instanceof hl&&a.freeze(),this.ib=a,this.R(),this.g("background",
b,a))}},part:{get:function(){if(this.rg())return this;if(null!==this.yj)return this.yj;var a;for(a=this.panel;a;){if(a instanceof T)return this.yj=a;a=a.panel}return null}},svg:{get:function(){return this.vs},set:function(a){this.vs=a}},panel:{get:function(){return this.Zf}},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.sa},set:function(a){var b=a.x,c=a.y,d=this.sa,e=d.x,f=d.y;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))?this.Hv():(a=a.I(),this.Gv(a,d)&&this.g("position",d,a))}},actualBounds:{get:function(){return this.vb}},scale:{get:function(){return this.Ca},set:function(a){var b=this.Ca;b!==a&&(0>=a&&A("GraphObject.scale for "+
this+" must be greater than zero, not: "+a),this.Ca=a,this.o(),this.g("scale",b,a))}},angle:{get:function(){return this.zc},set:function(a){var b=this.zc;b!==a&&(a%=360,0>a&&(a+=360),b!==a&&(this.zc=a,vl(this),this.o(),this.g("angle",b,a)))}},desiredSize:{get:function(){return this.Mc},set:function(a){var b=a.width,c=a.height,d=this.Mc,e=d.width,f=d.height;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))||(this.Mc=a=a.I(),this.o(),
this instanceof W&&this.bc(),this.g("desiredSize",d,a),Tk(this)&&(a=this.part,null!==a&&(Uk(this,a,"width"),Uk(this,a,"height"))))}},width:{get:function(){return this.Mc.width},set:function(a){var b=this.Mc.width;b===a||isNaN(b)&&isNaN(a)||(b=this.Mc,this.Mc=a=(new K(a,this.Mc.height)).freeze(),this.o(),this instanceof W&&this.bc(),this.g("desiredSize",b,a),Tk(this)&&(a=this.part,null!==a&&Uk(this,a,"width")))}},height:{get:function(){return this.Mc.height},
set:function(a){var b=this.Mc.height;b===a||isNaN(b)&&isNaN(a)||(b=this.Mc,this.Mc=a=(new K(this.Mc.width,a)).freeze(),this.o(),this instanceof W&&this.bc(),this.g("desiredSize",b,a),Tk(this)&&(a=this.part,null!==a&&Uk(this,a,"height")))}},minSize:{get:function(){return this.Of},set:function(a){var b=this.Of;b.A(a)||(a=a.copy(),isNaN(a.width)&&(a.width=0),isNaN(a.height)&&(a.height=0),a.freeze(),this.Of=a,this.o(),this.g("minSize",b,a))}},maxSize:{
get:function(){return this.Nf},set:function(a){var b=this.Nf;b.A(a)||(a=a.copy(),isNaN(a.width)&&(a.width=Infinity),isNaN(a.height)&&(a.height=Infinity),a.freeze(),this.Nf=a,this.o(),this.g("maxSize",b,a))}},measuredBounds:{get:function(){return this.qc}},naturalBounds:{get:function(){return this.hc}},margin:{get:function(){return this.Tg},set:function(a){"number"===typeof a&&(a=new Ic(a));var b=this.Tg;b.A(a)||
(this.Tg=a=a.I(),this.o(),this.g("margin",b,a))}},transform:{get:function(){0!==(this.G&2048)===!0&&el(this);return this.tb}},rd:{get:function(){0!==(this.G&4096)===!0&&el(this);return this.Ch}},alignment:{get:function(){return this.wb},set:function(a){var b=this.wb;b.A(a)||(a.kc()&&!a.Kb()&&A("GraphObject.alignment for "+this+" must be a real Spot or Spot.Default, not: "+a),this.wb=a=a.I(),ql(this),this.g("alignment",
b,a))}},column:{get:function(){return this.Bg},set:function(a){a=Math.round(a);var b=this.Bg;b!==a&&(0>a&&xa(a,">= 0",Y,"column"),this.Bg=a,this.o(),this.g("column",b,a))}},columnSpan:{get:function(){return this.Wm},set:function(a){a=Math.round(a);var b=this.Wm;b!==a&&(1>a&&xa(a,">= 1",Y,"columnSpan"),this.Wm=a,this.o(),this.g("columnSpan",b,a))}},row:{get:function(){return this.Yo},set:function(a){a=Math.round(a);
var b=this.Yo;b!==a&&(0>a&&xa(a,">= 0",Y,"row"),this.Yo=a,this.o(),this.g("row",b,a))}},rowSpan:{get:function(){return this.Zo},set:function(a){a=Math.round(a);var b=this.Zo;b!==a&&(1>a&&xa(a,">= 1",Y,"rowSpan"),this.Zo=a,this.o(),this.g("rowSpan",b,a))}},spanAllocation:{get:function(){return this.op},set:function(a){var b=this.op;b!==a&&(this.op=a,this.o(),this.g("spanAllocation",b,a))}},alignmentFocus:{get:function(){return this.tk},
set:function(a){var b=this.tk;b.A(a)||(this.tk=a=a.I(),this.o(),this.g("alignmentFocus",b,a))}},portId:{get:function(){return this.Lo},set:function(a){var b=this.Lo;if(b!==a){var c=this.part;null===c||c instanceof V||(A("Cannot set portID on a Link: "+a),c=null);null!==b&&null!==c&&El(c,this);this.Lo=a;null!==a&&null!==c&&(c.vh=!0,Fl(c,this));this.g("portId",b,a)}}},toSpot:{get:function(){return null!==this.P?this.P.kh:Sc},set:function(a){this.Hc();
var b=this.P.kh;b.A(a)||(a=a.I(),this.P.kh=a,this.g("toSpot",b,a),ul(this))}},toEndSegmentLength:{get:function(){return null!==this.P?this.P.ih:10},set:function(a){this.Hc();var b=this.P.ih;b!==a&&(0>a&&xa(a,">= 0",Y,"toEndSegmentLength"),this.P.ih=a,this.g("toEndSegmentLength",b,a),ul(this))}},toShortLength:{get:function(){return null!==this.P?this.P.jh:0},set:function(a){this.Hc();var b=this.P.jh;b!==a&&(this.P.jh=a,this.g("toShortLength",
b,a),ul(this))}},toLinkable:{get:function(){return null!==this.P?this.P.wp:null},set:function(a){this.Hc();var b=this.P.wp;b!==a&&(this.P.wp=a,this.g("toLinkable",b,a))}},toMaxLinks:{get:function(){return null!==this.P?this.P.xp:Infinity},set:function(a){this.Hc();var b=this.P.xp;b!==a&&(0>a&&xa(a,">= 0",Y,"toMaxLinks"),this.P.xp=a,this.g("toMaxLinks",b,a))}},fromSpot:{get:function(){return null!==this.P?this.P.Kg:
Sc},set:function(a){this.Hc();var b=this.P.Kg;b.A(a)||(a=a.I(),this.P.Kg=a,this.g("fromSpot",b,a),ul(this))}},fromEndSegmentLength:{get:function(){return null!==this.P?this.P.Ig:10},set:function(a){this.Hc();var b=this.P.Ig;b!==a&&(0>a&&xa(a,">= 0",Y,"fromEndSegmentLength"),this.P.Ig=a,this.g("fromEndSegmentLength",b,a),ul(this))}},fromShortLength:{get:function(){return null!==this.P?this.P.Jg:0},set:function(a){this.Hc();var b=this.P.Jg;
b!==a&&(this.P.Jg=a,this.g("fromShortLength",b,a),ul(this))}},fromLinkable:{get:function(){return null!==this.P?this.P.An:null},set:function(a){this.Hc();var b=this.P.An;b!==a&&(this.P.An=a,this.g("fromLinkable",b,a))}},fromMaxLinks:{get:function(){return null!==this.P?this.P.Bn:Infinity},set:function(a){this.Hc();var b=this.P.Bn;b!==a&&(0>a&&xa(a,">= 0",Y,"fromMaxLinks"),this.P.Bn=a,this.g("fromMaxLinks",b,a))}},cursor:{
get:function(){return this.fn},set:function(a){var b=this.fn;b!==a&&(this.fn=a,this.g("cursor",b,a))}},click:{get:function(){return null!==this.O?this.O.zf:null},set:function(a){Qk(this);var b=this.O.zf;b!==a&&(this.O.zf=a,this.g("click",b,a))}},doubleClick:{get:function(){return null!==this.O?this.O.Ef:null},set:function(a){Qk(this);var b=this.O.Ef;b!==a&&(this.O.Ef=a,this.g("doubleClick",b,a))}},contextClick:{
get:function(){return null!==this.O?this.O.Af:null},set:function(a){Qk(this);var b=this.O.Af;b!==a&&(this.O.Af=a,this.g("contextClick",b,a))}},mouseEnter:{get:function(){return null!==this.O?this.O.Qf:null},set:function(a){Qk(this);var b=this.O.Qf;b!==a&&(this.O.Qf=a,this.g("mouseEnter",b,a))}},mouseLeave:{get:function(){return null!==this.O?this.O.Tf:null},set:function(a){Qk(this);var b=this.O.Tf;b!==a&&(this.O.Tf=a,this.g("mouseLeave",
b,a))}},mouseOver:{get:function(){return null!==this.O?this.O.Uf:null},set:function(a){Qk(this);var b=this.O.Uf;b!==a&&(this.O.Uf=a,this.g("mouseOver",b,a))}},mouseHover:{get:function(){return null!==this.O?this.O.Sf:null},set:function(a){Qk(this);var b=this.O.Sf;b!==a&&(this.O.Sf=a,this.g("mouseHover",b,a))}},mouseHold:{get:function(){return null!==this.O?this.O.Rf:null},set:function(a){Qk(this);var b=this.O.Rf;
b!==a&&(this.O.Rf=a,this.g("mouseHold",b,a))}},mouseDragEnter:{get:function(){return null!==this.O?this.O.qo:null},set:function(a){Qk(this);var b=this.O.qo;b!==a&&(this.O.qo=a,this.g("mouseDragEnter",b,a))}},mouseDragLeave:{get:function(){return null!==this.O?this.O.ro:null},set:function(a){Qk(this);var b=this.O.ro;b!==a&&(this.O.ro=a,this.g("mouseDragLeave",b,a))}},mouseDrop:{get:function(){return null!==this.O?
this.O.Pf:null},set:function(a){Qk(this);var b=this.O.Pf;b!==a&&(this.O.Pf=a,this.g("mouseDrop",b,a))}},actionDown:{get:function(){return null!==this.O?this.O.Gm:null},set:function(a){Qk(this);var b=this.O.Gm;b!==a&&(this.O.Gm=a,this.g("actionDown",b,a))}},actionMove:{get:function(){return null!==this.O?this.O.Hm:null},set:function(a){Qk(this);var b=this.O.Hm;b!==a&&(this.O.Hm=a,this.g("actionMove",b,a))}},actionUp:{
get:function(){return null!==this.O?this.O.Im:null},set:function(a){Qk(this);var b=this.O.Im;b!==a&&(this.O.Im=a,this.g("actionUp",b,a))}},actionCancel:{get:function(){return null!==this.O?this.O.Fm:null},set:function(a){Qk(this);var b=this.O.Fm;b!==a&&(this.O.Fm=a,this.g("actionCancel",b,a))}},toolTip:{get:function(){return null!==this.O?this.O.eg:null},set:function(a){Qk(this);var b=this.O.eg;b!==a&&(this.O.eg=a,this.g("toolTip",b,a))}},
contextMenu:{get:function(){return null!==this.O?this.O.Bf:null},set:function(a){Qk(this);var b=this.O.Bf;b!==a&&(this.O.Bf=a,this.g("contextMenu",b,a))}}});Y.prototype.setProperties=Y.prototype.Iv;Y.prototype.findTemplateBinder=Y.prototype.Ei;Y.prototype.bind=Y.prototype.bind;Y.prototype.isEnabledObject=Y.prototype.qg;Y.prototype.isVisibleObject=Y.prototype.rf;Y.prototype.isContainedBy=Y.prototype.pg;Y.prototype.getNearestIntersectionPoint=Y.prototype.Sc;
Y.prototype.getLocalPoint=Y.prototype.Ts;Y.prototype.getDocumentScale=Y.prototype.Be;Y.prototype.getDocumentAngle=Y.prototype.Hi;Y.prototype.getDocumentBounds=Y.prototype.Sp;Y.prototype.getDocumentPoint=Y.prototype.ma;Y.prototype.intersectsRect=Y.prototype.Ic;Y.prototype.containedInRect=Y.prototype.rh;Y.prototype.containsRect=Y.prototype.mf;Y.prototype.containsPoint=Y.prototype.ea;Y.prototype.raiseChanged=Y.prototype.g;Y.prototype.raiseChangedEvent=Y.prototype.ab;Y.prototype.addCopyProperty=Y.prototype.Nw;
var yl=null;Y.className="GraphObject";yl=new Lb;
Cl("Button",function(){function a(a,b){return null!==a.diagram.Rb(a.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a},function(a){return a===b})}var b=xl(X,X.Auto,{isActionable:!0,enabledChanged:function(a,b){if(a instanceof X){var c=a.$a("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"},xl(W,{name:"ButtonBorder",figure:"RoundedRectangle",spot1:new O(0,0,2.76142374915397,2.761423749153969),spot2:new O(1,1,-2.76142374915397,-2.761423749153969),parameter1:2,parameter2:2,fill:"#F5F5F5",stroke:"#BDBDBD"}));b.mouseEnter=function(a,b){if(b.qg()&&b instanceof X&&(a=b.$a("ButtonBorder"),a instanceof W)){var c=b._buttonFillOver;b._buttonFillNormal=a.fill;a.fill=c;c=b._buttonStrokeOver;b._buttonStrokeNormal=a.stroke;a.stroke=c}};
b.mouseLeave=function(a,b){b.qg()&&b instanceof X&&(a=b.$a("ButtonBorder"),a instanceof W&&(a.fill=b._buttonFillNormal,a.stroke=b._buttonStrokeNormal))};b.actionDown=function(a,b){if(b.qg()&&b instanceof X&&null!==b._buttonFillPressed&&0===a.button){var c=b.$a("ButtonBorder");if(c instanceof W){a=a.diagram;var d=a.skipsUndoManager;a.skipsUndoManager=!0;var g=b._buttonFillPressed;b._buttonFillOver=c.fill;c.fill=g;g=b._buttonStrokePressed;b._buttonStrokeOver=c.stroke;c.stroke=g;a.skipsUndoManager=d}}};
b.actionUp=function(b,d){if(d.qg()&&d instanceof X&&null!==d._buttonFillPressed&&0===b.button){var c=d.$a("ButtonBorder");if(c instanceof W){var f=b.diagram,g=f.skipsUndoManager;f.skipsUndoManager=!0;a(b,d)?(c.fill=d._buttonFillOver,c.stroke=d._buttonStrokeOver):(c.fill=d._buttonFillNormal,c.stroke=d._buttonStrokeNormal);f.skipsUndoManager=g}}};b.actionCancel=function(b,d){if(d.qg()&&d instanceof X&&null!==d._buttonFillPressed){var c=d.$a("ButtonBorder");if(c instanceof W){var f=b.diagram,g=f.skipsUndoManager;
f.skipsUndoManager=!0;a(b,d)?(c.fill=d._buttonFillOver,c.stroke=d._buttonStrokeOver):(c.fill=d._buttonFillNormal,c.stroke=d._buttonStrokeNormal);f.skipsUndoManager=g}}};b.actionMove=function(b,d){if(d.qg()&&d instanceof X&&null!==d._buttonFillPressed){var c=b.diagram;if(0===c.firstInput.button&&(c.currentTool.standardMouseOver(),a(b,d)&&(b=d.$a("ButtonBorder"),b instanceof W))){var f=c.skipsUndoManager;c.skipsUndoManager=!0;var g=d._buttonFillPressed;b.fill!==g&&(b.fill=g);g=d._buttonStrokePressed;
b.stroke!==g&&(b.stroke=g);c.skipsUndoManager=f}}};return b});
Cl("TreeExpanderButton",function(){var a=xl("Button",{_treeExpandedFigure:"MinusLine",_treeCollapsedFigure:"PlusLine"},xl(W,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:ic},(new Ci("figure","isTreeExpanded",function(a,c){c=c.panel;return a?c._treeExpandedFigure:c._treeCollapsedFigure})).eq()),{visible:!1},(new Ci("visible","isTreeLeaf",function(a){return!a})).eq());a.click=function(a,c){c=c.part;c instanceof pf&&(c=c.adornedPart);if(c instanceof V){var b=c.diagram;
if(null!==b){b=b.commandHandler;if(c.isTreeExpanded){if(!b.canCollapseTree(c))return}else if(!b.canExpandTree(c))return;a.handled=!0;c.isTreeExpanded?b.collapseTree(c):b.expandTree(c)}}};return a});
Cl("SubGraphExpanderButton",function(){var a=xl("Button",{_subGraphExpandedFigure:"MinusLine",_subGraphCollapsedFigure:"PlusLine"},xl(W,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:ic},(new Ci("figure","isSubGraphExpanded",function(a,c){c=c.panel;return a?c._subGraphExpandedFigure:c._subGraphCollapsedFigure})).eq()));a.click=function(a,c){c=c.part;c instanceof pf&&(c=c.adornedPart);if(c instanceof hg){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});Cl("ToolTip",function(){return xl(pf,X.Auto,{isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new G(0,3),shadowBlur:5},xl(W,{name:"Border",figure:"RoundedRectangle",parameter1:1,parameter2:1,fill:"#F5F5F5",stroke:"#F0F0F0",spot1:new O(0,0,4,6),spot2:new O(1,1,-4,-4)}))});
Cl("ContextMenu",function(){return xl(pf,X.Vertical,{background:"#F5F5F5",isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new G(0,3),shadowBlur:5},new Ci("background","",function(a){return null!==a.adornedPart&&null!==a.placeholder?null:"#F5F5F5"}))});Cl("ContextMenuButton",function(){var a=xl("Button");a.stretch=Kk;var b=a.$a("ButtonBorder");b instanceof W&&(b.figure="Rectangle",b.strokeWidth=0,b.spot1=new O(0,0,2,3),b.spot2=new O(1,1,-2,-2));return a});
Cl("PanelExpanderButton",function(a){var b=Dl(a,"COLLAPSIBLE"),c=xl("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},xl(W,{name:"ButtonIcon",strokeWidth:2},(new Ci("geometryString","visible",function(a){return a?c._buttonExpandedFigure:c._buttonCollapsedFigure})).eq(b)));
a=c.$a("ButtonBorder");a instanceof W&&(a.stroke=null,a.fill="rgba(0, 0, 0, 0)");c.click=function(a,c){a=c.diagram;if(null!==a&&!a.isReadOnly){var d=c.Ei();null===d&&(d=c.part);null!==d&&(c=d.$a(b),null!==c&&(a.Aa("Collapse/Expand Panel"),c.visible=!c.visible,a.Za("Collapse/Expand Panel")))}};return c});
Cl("CheckBoxButton",function(a){var b=Dl(a);a=xl("Button",{desiredSize:new K(14,14)},xl(W,{name:"ButtonIcon",geometryString:"M0 0 M0 8.85 L4.9 13.75 16.2 2.45 M16.2 16.2",strokeWidth:2,stretch:be,geometryStretch:$g,visible:!1},""!==b?(new Ci("visible",b)).px():[]));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.$a("ButtonIcon");c.Aa("checkbox");f.visible=!f.visible;"function"===typeof d._doClick&&d._doClick(a,
d);c.Za("checkbox")}}};return a});
Cl("CheckBox",function(a){a=Dl(a);a=xl("CheckBoxButton",a,{name:"Button",isActionable:!1,margin:new Ic(0,1,0,0)});var b=xl(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=Yg=new D(Y,"None",0);Y.Default=Jk=new D(Y,"Default",0);Y.Vertical=Lk=new D(Y,"Vertical",4);Y.Horizontal=Kk=new D(Y,"Horizontal",5);Y.Fill=be=new D(Y,"Fill",3);Y.Uniform=$g=new D(Y,"Uniform",1);
Y.UniformToFill=Mk=new D(Y,"UniformToFill",2);Y.FlipVertical=Nk=new D(Y,"FlipVertical",1);Y.FlipHorizontal=Ok=new D(Y,"FlipHorizontal",2);Y.FlipBoth=Pk=new D(Y,"FlipBoth",3);Y.make=xl;Y.getBuilders=function(){var a=new Lb,b;for(b in yl)if(b!==b.toLowerCase()){var c=yl.J(b);"function"===typeof c&&a.add(b,c)}a.freeze();return a};Y.defineBuilder=Cl;Y.takeBuilderArgument=Dl;
function Rk(){this.yn=this.Bf=this.eg=this.Fm=this.Im=this.Hm=this.Gm=this.Pf=this.ro=this.qo=this.Rf=this.Sf=this.Uf=this.Tf=this.Qf=this.Af=this.Ef=this.zf=null}Rk.prototype.copy=function(){var a=new Rk;a.zf=this.zf;a.Ef=this.Ef;a.Af=this.Af;a.Qf=this.Qf;a.Tf=this.Tf;a.Uf=this.Uf;a.Sf=this.Sf;a.Rf=this.Rf;a.qo=this.qo;a.ro=this.ro;a.Pf=this.Pf;a.Gm=this.Gm;a.Hm=this.Hm;a.Im=this.Im;a.Fm=this.Fm;a.eg=this.eg;a.Bf=this.Bf;a.yn=this.yn;return a};Rk.className="GraphObjectEventHandlers";
function Gl(){this.Oa=[1,0,0,1,0,0]}Gl.prototype.copy=function(){var a=new Gl;a.Oa[0]=this.Oa[0];a.Oa[1]=this.Oa[1];a.Oa[2]=this.Oa[2];a.Oa[3]=this.Oa[3];a.Oa[4]=this.Oa[4];a.Oa[5]=this.Oa[5];return a};Gl.prototype.translate=function(a,b){this.Oa[4]+=this.Oa[0]*a+this.Oa[2]*b;this.Oa[5]+=this.Oa[1]*a+this.Oa[3]*b};Gl.prototype.scale=function(a,b){this.Oa[0]*=a;this.Oa[1]*=a;this.Oa[2]*=b;this.Oa[3]*=b};Gl.className="STransform";
function Hl(a){this.type=a;this.r2=this.y2=this.x2=this.r1=this.y1=this.x1=0;this.Uw=[];this.pattern=null}Hl.prototype.addColorStop=function(a,b){this.Uw.push({offset:a,color:b})};Hl.className="SGradient";
function wj(a,b){this.ownerDocument=a=void 0===b?w.document:b;this.zz="http://www.w3.org/2000/svg";void 0!==a&&(this.Ga=this.ub("svg",{width:"1px",height:"1px",viewBox:"0 0 1 1"}),this.Ga.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns","http://www.w3.org/2000/svg"),this.Ga.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"));this.Np=null;this.context=new Il(this)}
wj.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.Ga.setAttributeNS(null,"width",c+"px"),this.Ga.setAttributeNS(null,"height",d+"px"),this.Ga.setAttributeNS(null,"viewBox","0 0 "+c+" "+d),this.context.du.firstElementChild.setAttributeNS(null,"width",c+"px"),this.context.du.firstElementChild.setAttributeNS(null,"height",d+"px"),!0):!1};
wj.prototype.ub=function(a,b,c){a=this.ownerDocument.createElementNS(this.zz,a);if(Ca(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};wj.prototype.getBoundingClientRect=function(){return this.Ga.getBoundingClientRect()};wj.prototype.focus=function(){this.Ga.focus()};wj.prototype.$w=function(){this.ownerDocument=null};
pa.Object.defineProperties(wj.prototype,{width:{get:function(){return this.Ga.width.baseVal.value},set:function(a){this.Ga.width=a}},height:{get:function(){return this.Ga.height.baseVal.value},set:function(a){this.Ga.height=a}},style:{get:function(){return this.Ga.style}}});wj.className="SVGSurface";
function Il(a){this.nk=a;this.svg=a.Ga;this.stack=[];this.wc=[];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.Nd=this.kp=this.jp=0;this.Yp=null;this.path=[];this.Zt=!1;this.eh=null;this.fh=0;this.Rd=new Gl;
Jl(this,1,0,0,1,0,0);var b=Gb++,c=this.ub("clipPath",{id:"mainClip"+b});c.appendChild(this.ub("rect",{x:0,y:0,width:a.width,height:a.height}));this.du=c;this.nk.Ga.appendChild(c);this.wc[0].setAttributeNS(null,"clip-path","url(#mainClip"+b+")");this.Bz={}}t=Il.prototype;
t.reset=function(){this.stack=[];this.wc=[];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.Nd=this.kp=this.jp=0;this.Yp=null;this.path=[];this.Rd=new Gl;Jl(this,1,0,0,1,0,0);var a=Gb++,b=this.ub("clipPath",
{id:"mainClip"+a});b.appendChild(this.ub("rect",{x:0,y:0,width:this.nk.width,height:this.nk.height}));this.du=b;this.nk.Ga.appendChild(b);this.wc[0].setAttributeNS(null,"clip-path","url(#mainClip"+a+")")};
t.arc=function(a,b,c,d,e,f,g,h){var k=2*Math.PI,l=k-1E-6,m=c*Math.cos(d),n=c*Math.sin(d),p=a+m,q=b+n,r=f?0:1;d=f?d-e:e-d;(1E-6<Math.abs(g-p)||1E-6<Math.abs(h-q))&&this.path.push(["L",p,+q]);0>d&&(d=d%k+k);d>l?(this.path.push(["A",c,c,0,1,r,a-m,b-n]),this.path.push(["A",c,c,0,1,r,p,q])):1E-6<d&&this.path.push(["A",c,c,0,+(d>=Math.PI),r,a+c*Math.cos(e),b+c*Math.sin(e)])};t.beginPath=function(){this.path=[]};t.bezierCurveTo=function(a,b,c,d,e,f){this.path.push(["C",a,b,c,d,e,f])};t.clearRect=function(){};
t.clip=function(){this.addPath("clipPath",this.path,this.Rd);this.addPath("clipPath",this.path,new Gl)};t.closePath=function(){this.path.push(["z"])};t.createLinearGradient=function(a,b,c,d){var e=new Hl("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.src);var c=this.Bz;if(c[b])return"url(#"+c[b]+")";var d="PATTERN"+Gb++,e={x:0,y:0,width:a.width,height:a.height,href:b};a=this.ub("pattern",{width:a.width,height:a.height,id:d,patternUnits:"userSpaceOnUse"});a.appendChild(this.ub("image",e));this.svg.appendChild(a);c[b]=d;return"url(#"+d+")"};
t.createRadialGradient=function(a,b,c,d,e,f){var g=new Hl("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.src);var m=a instanceof HTMLImageElement?a.naturalWidth:a.width,n=a instanceof HTMLImageElement?a.naturalHeight:a.height;void 0===d&&(f=b,g=c,h=d=m,k=e=n);d=d||0;e=e||0;f=f||0;g=g||0;h=h||0;k=k||0;l={x:0,y:0,width:m,height:n,href:l,preserveAspectRatio:"xMidYMid slice"};H.ca(d,h)&&H.ca(e,k)||(l.preserveAspectRatio="none");a="";h/=d;k/=e;if(0!==f||0!==g)a+=" translate("+
f+", "+g+")";if(1!==h||1!==k)a+=" scale("+h+", "+k+")";if(0!==b||0!==c)a+=" translate("+-b+", "+-c+")";if(0!==b||0!==c||d!==m||e!==n)f="CLIP"+Gb++,g=this.ub("clipPath",{id:f}),g.appendChild(this.ub("rect",{x:b,y:c,width:d,height:e})),this.svg.appendChild(g),l["clip-path"]="url(#"+f+")";Kl(this,"image",l,this.Rd,a);this.addElement("image",l)};t.fill=function(){this.addPath("fill",this.path,this.Rd)};t.Sd=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]};Kl(this,"fill",a,this.Rd);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};Kl(this,"fill",b,this.Rd);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.Rd=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.Rd.copy())};
t.setTransform=function(a,b,c,d,e,f){1===a&&0===b&&0===c&&1===d&&0===e&&0===f||Jl(this,a,b,c,d,e,f)};t.scale=function(a,b){this.Rd.scale(a,b)};t.translate=function(a,b){this.Rd.translate(a,b)};t.transform=function(){};t.stroke=function(){this.addPath("stroke",this.path,this.Rd)};t.Ui=function(){this.clipInsteadOfFill||this.stroke()};t.ub=function(a,b,c){return this.nk.ub(a,b,c)};
t.addElement=function(a,b,c){a=this.ub(a,b,c);0<this.wc.length?this.wc[this.wc.length-1].appendChild(a):this.svg.appendChild(a);return this.Yp=a};
function Kl(a,b,c,d,e){1!==a.globalAlpha&&(c.opacity=a.globalAlpha);"fill"===b?(a.fillStyle instanceof Hl?c.fill=Ll(a,a.fillStyle):(/^rgba\(/.test(a.fillStyle)&&(b=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(a.fillStyle),c.fill="rgb("+b[1]+","+b[2]+","+b[3]+")",c["fill-opacity"]=b[4]),c.fill=a.fillStyle),c.stroke="none"):"stroke"===b&&(c.fill="none",a.strokeStyle instanceof Hl?c.stroke=Ll(a,a.strokeStyle):(/^rgba\(/.test(a.strokeStyle)&&(b=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(a.strokeStyle),
c.stroke="rgb("+b[1]+","+b[2]+","+b[3]+")",c["stroke-opacity"]=b[4]),c.stroke=a.strokeStyle),c["stroke-width"]=a.lineWidth,c["stroke-linecap"]=a.lineCap,c["stroke-linejoin"]=a.lineJoin,c["stroke-miterlimit"]=a.miterLimit);a=d.Oa;a="matrix("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+")";void 0!==e&&(a+=e);c.transform=a}
function Ll(a,b){var c="GRAD"+Gb++;if("linear"===b.type)var d=a.ub("linearGradient",{x1:b.x1,x2:b.x2,y1:b.y1,y2:b.y2,id:c,gradientUnits:"userSpaceOnUse"});else if("radial"===b.type)d=a.ub("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.Uw;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.ub("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=Ga(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.Zt&&(b["stroke-dasharray"]=this.eh.toString(),b["stroke-dashoffset"]=this.fh);Kl(this,a,b,c);"clipPath"===a?(a="CLIP"+Gb++,c=this.ub("clipPath",{id:a}),c.appendChild(this.ub("path",b)),this.svg.appendChild(c),
0<this.wc.length&&this.wc[this.wc.length-1].setAttributeNS(null,"clip-path","url(#"+a+")")):this.addElement("path",b)};function Jl(a,b,c,d,e,f,g){var h=new Gl;h.Oa=[b,c,d,e,f,g];b={};Kl(a,"g",b,h);h=a.addElement("g",b);a.wc.push(h)}
t.nq=function(){if(0!==this.shadowOffsetX||0!==this.shadowOffsetY||0!==this.shadowBlur){var a="SHADOW"+Gb++,b=this.addElement("filter",{id:a,x:"-100%",y:"-100%",width:"300%",height:"300%"},null);var c=this.ub("feGaussianBlur",{"in":"SourceAlpha",result:"blur",eA:this.shadowBlur/2});var d=this.ub("feFlood",{"in":"blur",result:"flood","flood-color":this.shadowColor});var e=this.ub("feComposite",{"in":"flood",in2:"blur",operator:"in",result:"comp"});var f=this.ub("feOffset",{"in":"comp",result:"offsetBlur",
dx:this.shadowOffsetX,dy:this.shadowOffsetY});var g=this.ub("feMerge",{});g.appendChild(this.ub("feMergeNode",{"in":"offsetBlur"}));g.appendChild(this.ub("feMergeNode",{"in":"SourceGraphic"}));b.appendChild(c);b.appendChild(d);b.appendChild(e);b.appendChild(f);b.appendChild(g);0<this.wc.length&&this.wc[this.wc.length-1].setAttributeNS(null,"filter","url(#"+a+")")}};t.Jv=function(a,b,c){this.jp=a;this.kp=b;this.Nd=c};function gl(a){a.shadowOffsetX=0;a.shadowOffsetY=0;a.shadowBlur=0}
function fl(a){a.shadowOffsetX=a.jp;a.shadowOffsetY=a.kp;a.shadowBlur=a.Nd}t.Ls=function(a,b){this.Zt=!0;this.eh=a;this.fh=b};t.Js=function(){this.Zt=!1};t.Qc=function(){};t.rt=function(){};Il.prototype.rotate=function(){};Il.prototype.getImageData=function(){return null};Il.prototype.measureText=function(){return null};Il.className="SVGContext";P.prototype.ft=function(a){var b=new wj(this,w.document);void 0===a&&(a=new tb);a=rk(this,a,"SVG",b);return null!==a?a.svg:null};P.prototype.makeSvg=P.prototype.ft;
P.prototype.hv=function(a){return this.ft(a)};P.prototype.makeSVG=P.prototype.hv;
Y.prototype.ax=function(a,b){if(!(a instanceof Il))return!1;if(!this.visible)return!0;var c=null,d=a.Yp;if(this instanceof X&&(this.type===X.TableRow||this.type===X.TableColumn))return dl(this,a,b),!0;var e=this.vb;if(0===e.width||0===e.height||isNaN(e.x)||isNaN(e.y))return!0;var f=this.transform,g=this.panel;0!==(this.G&4096)===!0&&el(this);var h=0!==(this.G&256),k=!1;this instanceof uh&&(a.font=this.font);if(h){k=g.Yd()?g.naturalBounds:g.actualBounds;if(null!==this.kd){var l=this.kd;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;Jl(a,1,0,0,1,0,0);a.save();a.beginPath();a.rect(m,n,p,l);a.clip()}if(this.rg()&&!this.isVisible())return!0;a.Rd.Oa=[1,0,0,1,0,0];this instanceof uh&&1<this.lineCount&&Jl(a,1,0,0,1,0,0);m=!1;this.rg()&&this.isShadowed&&b.Ce("drawShadows")&&(n=this.ri,a.Jv(n.x*b.scale*b.$b,n.y*b.scale*
b.$b,this.Nd),fl(a),a.shadowColor=this.Fj);n=!1;this.part&&b.Ce("drawShadows")&&(n=this.part.isShadowed);!0===this.shadowVisible?(fl(a),!1===m&&n&&(Jl(a,1,0,0,1,0,0),a.nq(),m=!0)):!1===this.shadowVisible&&gl(a);p=this.naturalBounds;null!==this.areaBackground&&(hi(this,a,this.areaBackground,!0,!0,p,e),!1===m&&n&&(Jl(a,1,0,0,1,0,0),a.nq(),m=!0),this.areaBackground instanceof hl&&this.areaBackground.type===il?(a.beginPath(),a.rect(e.x,e.y,e.width,e.height),a.Sd(this.areaBackground)):a.fillRect(e.x,e.y,
e.width,e.height));this instanceof X?Jl(a,f.m11,f.m12,f.m21,f.m22,f.dx,f.dy):a.Rd.Oa=[f.m11,f.m12,f.m21,f.m22,f.dx,f.dy];if(null!==this.background){!1===m&&n&&(Jl(a,1,0,0,1,0,0),a.nq(),m=!0);var q=this.naturalBounds;l=f=0;var r=q.width;q=q.height;var u=0;this instanceof W&&(q=this.geometry.bounds,f=q.x,l=q.y,r=q.width,q=q.height,u=this.strokeWidth);hi(this,a,this.background,!0,!1,p,e);this.background instanceof hl&&this.background.type===il?(a.beginPath(),a.rect(f-u/2,l-u/2,r+u,q+u),a.Sd(this.background)):
a.fillRect(f-u/2,l-u/2,r+u,q+u)}n&&(null!==this.background||null!==this.areaBackground||null!==g&&0!==(g.G&512)||null!==g&&(g.type===X.Auto||g.type===X.Spot)&&g.zb()!==this)?(jl(this,!0),null===this.shadowVisible&&gl(a)):jl(this,!1);this.Ai(a,b);n&&0!==(this.G&512)===!0&&fl(a);this.rg()&&n&&gl(a);h&&(a.restore(),k&&a.wc.pop());this instanceof X&&(c=a.wc.pop());!0===m&&a.wc.pop();this instanceof uh&&1<this.lineCount&&(c=a.wc.pop());null!==a.nk.Np&&(null===c&&(d===a.Yp?(Jl(a,1,0,0,1,0,0),c=a.wc.pop()):
c=a.Yp),a.nk.Np(this,c));this.svg=c;return!0};function sk(a,b){this.ownerDocument=b=void 0===b?w.document:b;this.Np=null;b=b.createElement("canvas");b.tabIndex=0;this.Ga=b;this.Ga.innerHTML="This text is displayed if your browser does not support the Canvas HTML element.";this.context=new ll(b);b.F=a}sk.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};
sk.prototype.toDataURL=function(a,b){return this.Ga.toDataURL(a,b)};sk.prototype.getBoundingClientRect=function(){return this.Ga.getBoundingClientRect()};sk.prototype.focus=function(){this.Ga.focus()};sk.prototype.$w=function(){this.ownerDocument=this.Ga.F=null};
pa.Object.defineProperties(sk.prototype,{width:{get:function(){return this.Ga.width},set:function(a){this.Ga.width=a}},height:{get:function(){return this.Ga.height},set:function(a){this.Ga.height=a}},style:{get:function(){return this.Ga.style}}});sk.className="CanvasSurface";
function ll(a){a.getContext&&a.getContext("2d")||A("Browser does not support HTML Canvas Element");this.V=a.getContext("2d");this.Et=this.Gt=this.Ft="";this.Vm=!1;this.Nd=this.kp=this.jp=0}t=ll.prototype;t.rt=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()};ll.prototype.rotate=function(a){this.V.rotate(a)};t=ll.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.Sd=function(a){if(a instanceof hl&&a.type===il){var b=a.Dk;a=a.Ht;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.Vm?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.Vm?this.clip():this.fill()};t.Ui=function(){this.Vm||this.stroke()};t.Jv=function(a,b,c){this.jp=a;this.kp=b;this.Nd=c};
t.Ls=function(a,b){var c=this.V;void 0!==c.setLineDash&&(c.setLineDash(a),c.lineDashOffset=b)};t.Js=function(){var a=this.V;void 0!==a.setLineDash&&(a.setLineDash(Ml),a.lineDashOffset=0)};t.Qc=function(a){a&&(this.Ft="");this.Et=this.Gt=""};
pa.Object.defineProperties(ll.prototype,{fillStyle:{get:function(){return this.V.fillStyle},set:function(a){this.Et!==a&&(this.Et=this.V.fillStyle=a)}},font:{get:function(){return this.V.font},set:function(a){this.Ft!==a&&(this.Ft=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.Gt!==a&&(this.Gt=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.Vm},
set:function(a){this.Vm=a}}});var Ml=Object.freeze([]);ll.className="CanvasSurfaceContext";function Nl(){this.ba=this.u=this.K=this.l=0}Nl.className="ColorNumbers";function hl(a){Ol||(Pl(),Ol=!0);mb(this);this.v=!1;void 0===a?(this.va=kl,this.Ck="black"):"string"===typeof a?(this.va=kl,this.Ck=a):(this.va=a,this.Ck="black");a=this.va;a===nl?(this.Dl=Uc,this.Qk=gd):this.Qk=a===il?this.Dl=dd:this.Dl=Sc;this.ts=0;this.cr=NaN;this.be=this.Zr=this.ae=null;this.Ht=this.Dk=0}
hl.prototype.copy=function(){var a=new hl;a.va=this.va;a.Ck=this.Ck;a.Dl=this.Dl.I();a.Qk=this.Qk.I();a.ts=this.ts;a.cr=this.cr;null!==this.ae&&(a.ae=this.ae.copy());a.Zr=this.Zr;return a};t=hl.prototype;t.freeze=function(){this.v=!0;null!==this.ae&&this.ae.freeze();return this};t.ha=function(){Object.isFrozen(this)&&A("cannot thaw constant: "+this);this.v=!1;null!==this.ae&&this.ae.ha();return this};t.fb=function(a){a.classType===hl&&(this.type=a)};
t.toString=function(){var a="Brush(";if(this.type===kl)a+=this.color;else if(a=this.type===nl?a+"Linear ":this.type===il?a+"Radial ":this.type===ml?a+"Pattern ":a+"(unknown) ",a+=this.start+" "+this.end,null!==this.colorStops)for(var b=this.colorStops.iterator;b.next();)a+=" "+b.key+":"+b.value;return a+")"};
t.addColorStop=function(a,b){this.v&&wa(this);("number"!==typeof a||!isFinite(a)||1<a||0>a)&&xa(a,"0 <= loc <= 1",hl,"addColorStop:loc");null===this.ae&&(this.ae=new Lb);this.ae.add(a,b);this.va===kl&&(this.type=nl);this.be=null;return this};
t.uz=function(a,b){this.v&&wa(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?Ql:b;if(this.type===kl)Rl(this.color),this.color=Sl(a,b);else if((this.type===nl||this.type===il)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)Rl(c.value),this.addColorStop(c.key,Sl(a,b));return this};function Tl(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?Ql:c;Rl(a);return Sl(b,c)}
t.uy=function(a,b){this.v&&wa(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?Ql:b;if(this.type===kl)Rl(this.color),this.color=Sl(-a,b);else if((this.type===nl||this.type===il)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)Rl(c.value),this.addColorStop(c.key,Sl(-a,b));return this};function Ul(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?Ql:c;Rl(a);return Sl(-b,c)}
function Vl(a,b,c){Rl(a);a=Wl.l;var d=Wl.K,e=Wl.u,f=Wl.ba;Rl(b);void 0===c&&(c=.5);return"rgba("+Math.round((Wl.l-a)*c+a)+", "+Math.round((Wl.K-d)*c+d)+", "+Math.round((Wl.u-e)*c+e)+", "+Math.round((Wl.ba-f)*c+f)+")"}
t.mx=function(){if(this.type===kl)return Xl(this.color);if((this.type===nl||this.type===il)&&null!==this.colorStops){var a=this.colorStops;if(this.type===il)return Xl(a.first().value);if(null!==a.get(.5))return Xl(a.get(.5));if(2===a.count)return a=a.Na(),Xl(Vl(a[0].value,a[1].value));for(var b=a.iterator,c=-1,d=-1,e=1,f=1;b.next();){var g=b.key,h=Math.abs(.5-b.key);e>f&&h<e?(c=g,e=h):f>=e&&h<f&&(d=g,f=h)}c>d&&(c=[d,d=c][0]);b=d-c;return Xl(Vl(a.get(c),a.get(d),1-e/b))}return!1};
function Xl(a){if(null===a)return null;if(a instanceof hl)return a.mx();Rl(a);return 128>(299*Wl.l+587*Wl.K+114*Wl.u)/1E3}
function Sl(a,b){switch(b){case Ql:var c=100*Yl(Wl.l);b=100*Yl(Wl.K);var d=100*Yl(Wl.u);Zl.l=.4124564*c+.3575761*b+.1804375*d;Zl.K=.2126729*c+.7151522*b+.072175*d;Zl.u=.0193339*c+.119192*b+.9503041*d;Zl.ba=Wl.ba;c=$l(Zl.l/am[0]);b=$l(Zl.K/am[1]);d=$l(Zl.u/am[2]);bm.l=116*b-16;bm.K=500*(c-b);bm.u=200*(b-d);bm.ba=Zl.ba;bm.l=Math.min(100,Math.max(0,bm.l+100*a));a=(bm.l+16)/116;c=a-bm.u/200;Zl.l=am[0]*cm(bm.K/500+a);Zl.K=am[1]*(bm.l>dm*em?Math.pow(a,3):bm.l/dm);Zl.u=am[2]*cm(c);Zl.ba=bm.ba;a=-.969266*
Zl.l+1.8760108*Zl.K+.041556*Zl.u;c=.0556434*Zl.l+-.2040259*Zl.K+1.0572252*Zl.u;Wl.l=255*fm((3.2404542*Zl.l+-1.5371385*Zl.K+-.4985314*Zl.u)/100);Wl.K=255*fm(a/100);Wl.u=255*fm(c/100);Wl.ba=Zl.ba;Wl.l=Math.round(Wl.l);255<Wl.l?Wl.l=255:0>Wl.l&&(Wl.l=0);Wl.K=Math.round(Wl.K);255<Wl.K?Wl.K=255:0>Wl.K&&(Wl.K=0);Wl.u=Math.round(Wl.u);255<Wl.u?Wl.u=255:0>Wl.u&&(Wl.u=0);return"rgba("+Wl.l+", "+Wl.K+", "+Wl.u+", "+Wl.ba+")";case gm:b=Wl.l/255;d=Wl.K/255;var e=Wl.u/255,f=Math.max(b,d,e),g=Math.min(b,d,e),h=
f-g;g=(f+g)/2;if(0===h)c=b=0;else{switch(f){case b:c=(d-e)/h%6;break;case d:c=(e-b)/h+2;break;case e:c=(b-d)/h+4}c*=60;0>c&&(c+=360);b=h/(1-Math.abs(2*g-1))}hm.l=Math.round(c);hm.K=Math.round(100*b);hm.u=Math.round(100*g);hm.ba=Wl.ba;hm.u=Math.min(100,Math.max(0,hm.u+100*a));return"hsla("+hm.l+", "+hm.K+"%, "+hm.u+"%, "+hm.ba+")";default:return A("Unknown color space: "+b),"rgba(0, 0, 0, 1)"}}
function Rl(a){Ol||(Pl(),Ol=!0);var b=im;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,Wl.l=a[0],Wl.K=a[1],Wl.u=a[2],Wl.ba=a[3]/255):(b.fillStyle="#FFFFFF",b.fillStyle=a,Wl.l=0,Wl.K=0,Wl.u=0,Wl.ba=1)}}function Yl(a){a/=255;return.04045>=a?a/12.92:Math.pow((a+.055)/1.055,2.4)}function fm(a){return.0031308>=a?12.92*a:1.055*Math.pow(a,1/2.4)-.055}
function $l(a){return a>em?Math.pow(a,1/3):(dm*a+16)/116}function cm(a){var b=a*a*a;return b>em?b:(116*a-16)/dm}function Pl(){im=sh?(new sk(null)).context:null}
pa.Object.defineProperties(hl.prototype,{type:{get:function(){return this.va},set:function(a){this.v&&wa(this,a);this.va=a;this.start.kc()&&(a===nl?this.start=Uc:a===il&&(this.start=dd));this.end.kc()&&(a===nl?this.end=gd:a===il&&(this.end=dd));this.be=null}},color:{get:function(){return this.Ck},set:function(a){this.v&&wa(this,a);this.Ck=a;this.be=null}},start:{get:function(){return this.Dl},set:function(a){this.v&&
wa(this,a);this.Dl=a.I();this.be=null}},end:{get:function(){return this.Qk},set:function(a){this.v&&wa(this,a);this.Qk=a.I();this.be=null}},startRadius:{get:function(){return this.ts},set:function(a){this.v&&wa(this,a);0>a&&xa(a,">= zero",hl,"startRadius");this.ts=a;this.be=null}},endRadius:{get:function(){return this.cr},set:function(a){this.v&&wa(this,a);0>a&&xa(a,">= zero",hl,"endRadius");this.cr=a;this.be=
null}},colorStops:{get:function(){return this.ae},set:function(a){this.v&&wa(this,a);this.ae=a;this.be=null}},pattern:{get:function(){return this.Zr},set:function(a){this.v&&wa(this,a);this.Zr=a;this.be=null}}});hl.prototype.isDark=hl.prototype.mx;hl.prototype.darkenBy=hl.prototype.uy;hl.prototype.lightenBy=hl.prototype.uz;hl.prototype.addColorStop=hl.prototype.addColorStop;
var em=216/24389,dm=24389/27,am=[95.047,100,108.883],im=null,Wl=new Nl,hm=new Nl,Zl=new Nl,bm=new Nl,Ol=!1;hl.className="Brush";var kl;hl.Solid=kl=new D(hl,"Solid",0);var nl;hl.Linear=nl=new D(hl,"Linear",1);var il;hl.Radial=il=new D(hl,"Radial",2);var ml;hl.Pattern=ml=new D(hl,"Pattern",4);var Ql;hl.Lab=Ql=new D(hl,"Lab",5);var gm;hl.HSL=gm=new D(hl,"HSL",6);
hl.randomColor=function(a,b){void 0===a&&(a=128);void 0===b&&(b=Math.max(a,255));var c=Math.abs(b-a);b=Math.floor(a+Math.random()*c).toString(16);var d=Math.floor(a+Math.random()*c).toString(16);a=Math.floor(a+Math.random()*c).toString(16);2>b.length&&(b="0"+b);2>d.length&&(d="0"+d);2>a.length&&(a="0"+a);return"#"+b+d+a};
hl.isValidColor=function(a){if("black"===a)return!0;if(""===a)return!1;Ol||(Pl(),Ol=!0);var b=im;if(null===b)return!0;b.fillStyle="#000000";var c=b.fillStyle;b.fillStyle=a;if(b.fillStyle!==c)return!0;b.fillStyle="#FFFFFF";c=b.fillStyle;b.fillStyle=a;return b.fillStyle!==c};hl.lighten=function(a){return Tl(a)};hl.lightenBy=Tl;hl.darken=function(a){return Ul(a)};hl.darkenBy=Ul;hl.mix=Vl;hl.isDark=Xl;function Bl(){this.name="Base"}Bl.prototype.measure=function(){};
Bl.prototype.wz=function(a,b,c,d,e){a.measure(b,c,d,e)};Bl.prototype.arrange=function(){};Bl.prototype.jy=function(a,b,c,d,e,f){a.arrange(b,c,d,e,f)};pa.Object.defineProperties(Bl.prototype,{classType:{get:function(){return X}}});Bl.prototype.arrangeElement=Bl.prototype.jy;Bl.prototype.measureElement=Bl.prototype.wz;Bl.className="PanelLayout";function jm(){this.name="Base";this.name="Position"}oa(jm,Bl);
jm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;a=km(a);for(var k=0;k<h;k++){var l=d[k];if(l.visible||l===a){var m=l.margin,n=m.right+m.left;m=m.top+m.bottom;l.measure(b,c,f,g);var p=l.measuredBounds;n=Math.max(p.width+n,0);m=Math.max(p.height+m,0);p=l.position.x;var q=l.position.y;isFinite(p)||(p=0);isFinite(q)||(q=0);l instanceof W&&l.isGeometryPositioned&&(l=l.strokeWidth/2,p-=l,q-=l);Bc(e,p,q,n,m)}}};
jm.prototype.arrange=function(a,b,c){var d=b.length,e=a.padding;a=c.x-e.left;c=c.y-e.top;for(e=0;e<d;e++){var f=b[e],g=f.measuredBounds,h=f.margin,k=f.position.x,l=f.position.y;k=isNaN(k)?-a:k-a;l=isNaN(l)?-c:l-c;if(f instanceof W&&f.isGeometryPositioned){var m=f.strokeWidth/2;k-=m;l-=m}f.visible&&f.arrange(k+h.left,l+h.top,g.width,g.height)}};function lm(){this.name="Base";this.name="Horizontal"}oa(lm,Bl);
lm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;b=Ka();f=km(a);for(var k=0;k<h;k++){var l=d[k];if(l.visible||l===f){var m=Zk(l,!1);if(m!==Yg&&m!==Kk)b.push(l);else{l.measure(Infinity,c,0,g);m=l.margin;l=l.measuredBounds;var n=Math.max(l.height+m.top+m.bottom,0);e.width+=Math.max(l.width+m.right+m.left,0);e.height=Math.max(e.height,n)}}}d=b.length;a.desiredSize.height?c=Math.min(a.desiredSize.height,a.maxSize.height):0!==e.height&&(c=Math.min(e.height,a.maxSize.height));for(a=0;a<d;a++)if(k=
b[a],k.visible||k===f)m=k.margin,h=m.right+m.left,m=m.top+m.bottom,k.measure(Infinity,c,0,g),k=k.measuredBounds,m=Math.max(k.height+m,0),e.width+=Math.max(k.width+h,0),e.height=Math.max(e.height,m);Oa(b)};
lm.prototype.arrange=function(a,b,c){for(var d=b.length,e=a.padding,f=e.top,g=a.isOpposite,h=g?c.width:e.left,k=0;k<d;k++){var l=f,m=b[k];if(m.visible){var n=m.measuredBounds,p=m.margin,q=p.top+p.bottom,r=f+e.bottom,u=n.height,x=Zk(m,!1);if(isNaN(m.desiredSize.height)&&x===be||x===Lk)u=Math.max(c.height-q-r,0);q=u+q+r;r=m.alignment;r.Kb()&&(r=a.defaultAlignment);r.gb()||(r=dd);g&&(h-=n.width+p.left+p.right);m.arrange(h+r.offsetX+p.left,l+r.offsetY+p.top+(c.height*r.y-q*r.y),n.width,u);g||(h+=n.width+
p.left+p.right)}}};function mm(){this.name="Base";this.name="Vertical"}oa(mm,Bl);
mm.prototype.measure=function(a,b,c,d,e,f){var g=d.length;c=Ka();for(var h=km(a),k=0;k<g;k++){var l=d[k];if(l.visible||l===h){var m=Zk(l,!1);if(m!==Yg&&m!==Lk)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;sc(e,Math.max(e.width,Math.max(l.width+m,0)),e.height+Math.max(l.height+n,0))}}}d=c.length;if(0!==d){a.desiredSize.width?b=Math.min(a.desiredSize.width,a.maxSize.width):0!==e.width&&(b=Math.min(e.width,a.maxSize.width));for(a=0;a<d;a++)if(k=
c[a],k.visible||k===h)l=k.margin,g=l.right+l.left,l=l.top+l.bottom,k.measure(b,Infinity,f,0),k=k.measuredBounds,l=Math.max(k.height+l,0),e.width=Math.max(e.width,Math.max(k.width+g,0)),e.height+=l;Oa(c)}};
mm.prototype.arrange=function(a,b,c){for(var d=b.length,e=a.padding,f=e.left,g=a.isOpposite,h=g?c.height:e.top,k=0;k<d;k++){var l=f,m=b[k];if(m.visible){var n=m.measuredBounds,p=m.margin,q=p.left+p.right,r=f+e.right,u=n.width,x=Zk(m,!1);if(isNaN(m.desiredSize.width)&&x===be||x===Kk)u=Math.max(c.width-q-r,0);q=u+q+r;r=m.alignment;r.Kb()&&(r=a.defaultAlignment);r.gb()||(r=dd);g&&(h-=n.height+p.bottom+p.top);m.arrange(l+r.offsetX+p.left+(c.width*r.x-q*r.x),h+r.offsetY+p.top,u,n.height);g||(h+=n.height+
p.bottom+p.top)}}};function nm(){this.name="Base";this.name="Spot"}oa(nm,Bl);
nm.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 q=Math.max(f+m,0);var r=Math.max(g+n,0);for(var u=a.isClipping,x=L.allocAt(-l.left,-l.top,q,r),v=!0,y=km(a),z=0;z<h;z++){var B=d[z];if(B!==k&&(B.visible||B===y)){l=B.margin;q=l.right+l.left;r=l.top+l.bottom;p=Zk(B,!1);switch(p){case be:b=f;c=g;break;case Kk:b=f;break;case Lk:c=g}B.measure(b,c,0,0);p=B.measuredBounds;q=
Math.max(p.width+q,0);r=Math.max(p.height+r,0);var C=B.alignment;C.Kb()&&(C=a.defaultAlignment);C.gb()||(C=dd);var I=B.alignmentFocus;I.Kb()&&(I=dd);var J=null;B instanceof X&&""!==B.xg&&(B.arrange(0,0,p.width,p.height),J=B.$a(B.xg),J===B&&(J=null));if(null!==J){l=J.naturalBounds;p=J.margin;for(l=G.allocAt(I.x*l.width-I.offsetX-p.left,I.y*l.height-I.offsetY-p.top);J!==B;)J.transform.ta(l),J=J.panel;B=C.x*f+C.offsetX-l.x;p=C.y*g+C.offsetY-l.y;G.free(l)}else B=C.x*f+C.offsetX-(I.x*p.width+I.offsetX)-
l.left,p=C.y*g+C.offsetY-(I.y*p.height+I.offsetY)-l.top;v?(v=!1,e.h(B,p,q,r)):Bc(e,B,p,q,r)}}v?e.assign(x):u?e.bv(x.x,x.y,x.width,x.height):Bc(e,x.x,x.y,x.width,x.height);L.free(x);p=k.stretch;p===Jk&&(p=Zk(k,!1));switch(p){case Yg:return;case be:if(!isFinite(b)&&!isFinite(c))return;break;case Kk:if(!isFinite(b))return;break;case Lk:if(!isFinite(c))return}p=k.measuredBounds;f=p.width;g=p.height;q=Math.max(f+m,0);r=Math.max(g+n,0);l=k.margin;x=L.allocAt(-l.left,-l.top,q,r);for(b=0;b<h;b++)c=d[b],c===
k||!c.visible&&c!==y||(l=c.margin,q=l.right+l.left,r=l.top+l.bottom,p=c.measuredBounds,q=Math.max(p.width+q,0),r=Math.max(p.height+r,0),m=c.alignment,m.Kb()&&(m=a.defaultAlignment),m.gb()||(m=dd),c=c.alignmentFocus,c.Kb()&&(c=dd),v?(v=!1,e.h(m.x*f+m.offsetX-(c.x*p.width+c.offsetX)-l.left,m.y*g+m.offsetY-(c.y*p.height+c.offsetY)-l.top,q,r)):Bc(e,m.x*f+m.offsetX-(c.x*p.width+c.offsetX)-l.left,m.y*g+m.offsetY-(c.y*p.height+c.offsetY)-l.top,q,r));v?e.assign(x):u?e.bv(x.x,x.y,x.width,x.height):Bc(e,x.x,
x.y,x.width,x.height);L.free(x)};
nm.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 q=p.measuredBounds,r=q.width;q=q.height;m=p.alignment;m.Kb()&&(m=a.defaultAlignment);m.gb()||(m=dd);var u=p.alignmentFocus;u.Kb()&&(u=dd);l=null;p instanceof X&&""!==p.xg&&(l=p.$a(p.xg),l===p&&(l=null));if(null!==l){var x=l.naturalBounds;for(u=G.allocAt(u.x*x.width-u.offsetX,u.y*x.height-
u.offsetY);l!==p;)l.transform.ta(u),l=l.panel;l=m.x*g+m.offsetX-u.x;m=m.y*f+m.offsetY-u.y;G.free(u)}else l=m.x*g+m.offsetX-(u.x*r+u.offsetX),m=m.y*f+m.offsetY-(u.y*q+u.offsetY);l-=c.x;m-=c.y;p.visible&&p.arrange(k+l,h+m,r,q)}}};function om(){this.name="Base";this.name="Auto"}oa(om,Bl);
om.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,q=l.top+l.bottom;k.measure(b,c,f,g);l=k.measuredBounds;var r=0,u=null;k instanceof W&&(u=k,r=u.strokeWidth*u.scale);var x=Math.max(l.width+p,0);l=Math.max(l.height+q,0);var v=pm(k),y=v.x*x+v.offsetX;v=v.y*l+v.offsetY;var z=qm(k),B=z.x*x+z.offsetX;z=z.y*l+z.offsetY;isFinite(b)&&(m=Math.max(Math.abs(y-B)-r,0));isFinite(c)&&(n=Math.max(Math.abs(v-z)-r,0));r=K.alloc();r.h(0,0);a=km(a);for(z=0;z<h;z++)v=
d[z],v===k||!v.visible&&v!==a||(l=v.margin,x=l.right+l.left,y=l.top+l.bottom,v.measure(m,n,0,0),l=v.measuredBounds,x=Math.max(l.width+x,0),l=Math.max(l.height+y,0),r.h(Math.max(x,r.width),Math.max(l,r.height)));if(1===h)e.width=x,e.height=l,K.free(r);else{v=pm(k);z=qm(k);h=d=0;z.x!==v.x&&z.y!==v.y&&(d=r.width/Math.abs(z.x-v.x),h=r.height/Math.abs(z.y-v.y));K.free(r);r=0;null!==u&&(r=u.strokeWidth*u.scale,Zg(u)===$g&&(d=h=Math.max(d,h)));d+=Math.abs(v.offsetX)+Math.abs(z.offsetX)+r;h+=Math.abs(v.offsetY)+
Math.abs(z.offsetY)+r;u=k.stretch;u===Jk&&(u=Zk(k,!1));switch(u){case Yg:g=f=0;break;case be:isFinite(b)&&(d=b);isFinite(c)&&(h=c);break;case Kk:isFinite(b)&&(d=b);g=0;break;case Lk:f=0,isFinite(c)&&(h=c)}k.bm();k.measure(d,h,f,g);e.width=k.measuredBounds.width+p;e.height=k.measuredBounds.height+q}};
om.prototype.arrange=function(a,b){var c=b.length,d=a.zb(),e=d.measuredBounds,f=L.alloc();f.h(0,0,1,1);var g=d.margin,h=g.left;g=g.top;var k=a.padding,l=k.left;k=k.top;d.arrange(l+h,k+g,e.width,e.height);var m=pm(d),n=qm(d),p=m.y*e.height+m.offsetY,q=n.x*e.width+n.offsetX;n=n.y*e.height+n.offsetY;f.x=m.x*e.width+m.offsetX;f.y=p;Bc(f,q,n,0,0);f.x+=h+l;f.y+=g+k;for(e=0;e<c;e++)h=b[e],h!==d&&(l=h.measuredBounds,g=h.margin,k=Math.max(l.width+g.right+g.left,0),m=Math.max(l.height+g.top+g.bottom,0),p=h.alignment,
p.Kb()&&(p=a.defaultAlignment),p.gb()||(p=dd),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&&(Cc(f.x,f.y,f.width,f.height,k,g,l.width,l.height)?h.arrange(k,g,l.width,l.height):h.arrange(k,g,l.width,l.height,new L(f.x,f.y,f.width,f.height))));L.free(f)};function rm(){this.name="Base";this.name="Table"}oa(rm,Bl);
rm.prototype.measure=function(a,b,c,d,e,f,g){for(var h=d.length,k=Ka(),l=Ka(),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 q=p.W.j,r=q.length,u=0;u<r;u++){var x=q[u];p.type===X.TableRow?x.row=n.row:p.type===X.TableColumn&&(x.column=n.column);k.push(x)}}}h=k.length;0===h&&(a.getRowDefinition(0),a.getColumnDefinition(0));for(var v=[],y=0;y<h;y++){var z=k[y];hj(z,!0);$k(z,!0);v[z.row]||(v[z.row]=
[]);v[z.row][z.column]||(v[z.row][z.column]=[]);v[z.row][z.column].push(z)}Oa(k);var B=Ka(),C=Ka(),I=Ka(),J={count:0},M={count:0},U=b,Q=c,ia=a.sb;h=ia.length;for(var ja=0;ja<h;ja++){var N=ia[ja];void 0!==N&&(N.actual=0)}ia=a.nb;h=ia.length;for(var R=0;R<h;R++)N=ia[R],void 0!==N&&(N.actual=0);for(var Aa=v.length,ob=0,Ha=0;Ha<Aa;Ha++)v[Ha]&&(ob=Math.max(ob,v[Ha].length));var Da=Math.min(a.topIndex,Aa-1),Fa=Math.min(a.leftIndex,ob-1),Ra=0;Aa=v.length;for(var Ub=km(a),$a=0;$a<Aa;$a++)if(v[$a]){ob=v[$a].length;
for(var Xa=a.getRowDefinition($a),Ma=Xa.actual=0;Ma<ob;Ma++)if(v[$a][Ma]){var fa=a.getColumnDefinition(Ma);void 0===B[Ma]&&(fa.actual=0,B[Ma]=!0);for(var ea=v[$a][Ma],hb=ea.length,jb=0;jb<hb;jb++){var Na=ea[jb];if(Na.visible||Na===Ub){var ce=1<Na.rowSpan||1<Na.columnSpan;ce&&($a<Da||Ma<Fa||C.push(Na));var Kd=Na.margin,vb=Kd.right+Kd.left,zf=Kd.top+Kd.bottom;var Eb=rl(Na,Xa,fa,!1);var pe=Na.desiredSize,Wc=!isNaN(pe.height),Vb=!isNaN(pe.width)&&Wc;ce||Eb===Yg||Vb||$a<Da||Ma<Fa||(void 0!==J[Ma]||Eb!==
be&&Eb!==Kk||(J[Ma]=-1,J.count++),void 0!==M[$a]||Eb!==be&&Eb!==Lk||(M[$a]=-1,M.count++),I.push(Na));Na.measure(Infinity,Infinity,0,0);if(!($a<Da||Ma<Fa)){var Ld=Na.measuredBounds,Ec=Math.max(Ld.width+vb,0),He=Math.max(Ld.height+zf,0);if(1===Na.rowSpan&&(Eb===Yg||Eb===Kk)){N=a.getRowDefinition($a);var Ie=N.tc();Ra=Math.max(He-N.actual,0);Ra+Ie>Q&&(Ra=Math.max(Q-Ie,0));var Af=0===N.actual;N.actual=N.actual+Ra;Q=Math.max(Q-(Ra+(Af?Ie:0)),0)}if(1===Na.columnSpan&&(Eb===Yg||Eb===Lk)){N=a.getColumnDefinition(Ma);
var gf=N.tc();Ra=Math.max(Ec-N.actual,0);Ra+gf>U&&(Ra=Math.max(U-gf,0));var Bf=0===N.actual;N.actual=N.actual+Ra;U=Math.max(U-(Ra+(Bf?gf:0)),0)}ce&&Na.bm()}}}}}Oa(B);var Wb=0,Ya=0;h=a.columnCount;for(var ab=0;ab<h;ab++){var Lc=a.nb[ab];void 0!==Lc&&(Wb+=Lc.ka,0!==Lc.ka&&(Wb+=Lc.tc()))}h=a.rowCount;for(var Cf=0;Cf<h;Cf++){var jc=a.sb[Cf];void 0!==jc&&(Ya+=jc.ka,0!==jc.ka&&(Ya+=jc.tc()))}U=Math.max(b-Wb,0);var Md=Q=Math.max(c-Ya,0),qc=U;h=I.length;for(var Nd=0;Nd<h;Nd++){var Xb=I[Nd],Dh=a.getRowDefinition(Xb.row),
Eh=a.getColumnDefinition(Xb.column),Je=Xb.measuredBounds,pb=Xb.margin,Df=pb.right+pb.left,Ke=pb.top+pb.bottom;J[Xb.column]=0===Eh.actual&&void 0!==J[Xb.column]?Math.max(Je.width+Df,J[Xb.column]):null;M[Xb.row]=0===Dh.actual&&void 0!==M[Xb.row]?Math.max(Je.height+Ke,M[Xb.row]):null}var Yb=0,Le=0,Mc;for(Mc in M)"count"!==Mc&&(Yb+=M[Mc]);for(Mc in J)"count"!==Mc&&(Le+=J[Mc]);for(var eb=K.alloc(),Me=0;Me<h;Me++){var rb=I[Me];if(rb.visible||rb===Ub){var rc=a.getRowDefinition(rb.row),kb=a.getColumnDefinition(rb.column),
Xc=0;isFinite(kb.width)?Xc=kb.width:(isFinite(U)&&null!==J[rb.column]?0===Le?Xc=kb.actual+U:Xc=J[rb.column]/Le*qc:null!==J[rb.column]?Xc=U:Xc=kb.actual||U,Xc=Math.max(0,Xc-kb.tc()));var Yc=0;isFinite(rc.height)?Yc=rc.height:(isFinite(Q)&&null!==M[rb.row]?0===Yb?Yc=rc.actual+Q:Yc=M[rb.row]/Yb*Md:null!==M[rb.row]?Yc=Q:Yc=rc.actual||Q,Yc=Math.max(0,Yc-rc.tc()));eb.h(Math.max(kb.minimum,Math.min(Xc,kb.maximum)),Math.max(rc.minimum,Math.min(Yc,rc.maximum)));Eb=rl(rb,rc,kb,!1);switch(Eb){case Kk:eb.height=
Math.max(eb.height,rc.actual+Q);break;case Lk:eb.width=Math.max(eb.width,kb.actual+U)}var xd=rb.margin,Bg=xd.right+xd.left,Ef=xd.top+xd.bottom;rb.bm();rb.measure(eb.width,eb.height,kb.minimum,rc.minimum);var Ff=rb.measuredBounds,hf=Math.max(Ff.width+Bg,0),kd=Math.max(Ff.height+Ef,0);isFinite(U)&&(hf=Math.min(hf,eb.width));isFinite(Q)&&(kd=Math.min(kd,eb.height));var Od=0;Od=rc.actual;rc.actual=Math.max(rc.actual,kd);Ra=rc.actual-Od;Q=Math.max(Q-Ra,0);Od=kb.actual;kb.actual=Math.max(kb.actual,hf);
Ra=kb.actual-Od;U=Math.max(U-Ra,0)}}Oa(I);var ld=K.alloc(),md=Ka(),nb=Ka();h=C.length;if(0!==h)for(var fb=0;fb<Aa;fb++)if(v[fb]){ob=v[fb].length;var nd=a.getRowDefinition(fb);md[fb]=nd.actual;for(var Zc=0;Zc<ob;Zc++)if(v[fb][Zc]){var od=a.getColumnDefinition(Zc);nb[Zc]=od.actual}}for(var vc=0;vc<h;vc++){var Ba=C[vc];if(Ba.visible||Ba===Ub){var $c=a.getRowDefinition(Ba.row),Zb=a.getColumnDefinition(Ba.column);eb.h(Math.max(Zb.minimum,Math.min(b,Zb.maximum)),Math.max($c.minimum,Math.min(c,$c.maximum)));
Eb=rl(Ba,$c,Zb,!1);switch(Eb){case be:0!==nb[Zb.index]&&(eb.width=Math.min(eb.width,nb[Zb.index]));0!==md[$c.index]&&(eb.height=Math.min(eb.height,md[$c.index]));break;case Kk:0!==nb[Zb.index]&&(eb.width=Math.min(eb.width,nb[Zb.index]));break;case Lk:0!==md[$c.index]&&(eb.height=Math.min(eb.height,md[$c.index]))}isFinite(Zb.width)&&(eb.width=Zb.width);isFinite($c.height)&&(eb.height=$c.height);ld.h(0,0);for(var de=1;de<Ba.rowSpan&&!(Ba.row+de>=a.rowCount);de++)N=a.getRowDefinition(Ba.row+de),Ra=0,
Ra=Eb===be||Eb===Lk?Math.max(N.minimum,0===md[Ba.row+de]?N.maximum:Math.min(md[Ba.row+de],N.maximum)):Math.max(N.minimum,isNaN(N.Oc)?N.maximum:Math.min(N.Oc,N.maximum)),ld.height+=Ra;for(var Ne=1;Ne<Ba.columnSpan&&!(Ba.column+Ne>=a.columnCount);Ne++)N=a.getColumnDefinition(Ba.column+Ne),Ra=0,Ra=Eb===be||Eb===Kk?Math.max(N.minimum,0===nb[Ba.column+Ne]?N.maximum:Math.min(nb[Ba.column+Ne],N.maximum)):Math.max(N.minimum,isNaN(N.Oc)?N.maximum:Math.min(N.Oc,N.maximum)),ld.width+=Ra;eb.width+=ld.width;eb.height+=
ld.height;var ee=Ba.margin,wc=ee.right+ee.left,qe=ee.top+ee.bottom;Ba.measure(eb.width,eb.height,f,g);for(var ad=Ba.measuredBounds,wb=Math.max(ad.width+wc,0),Pd=Math.max(ad.height+qe,0),Mb=0,re=0;re<Ba.rowSpan&&!(Ba.row+re>=a.rowCount);re++)N=a.getRowDefinition(Ba.row+re),Mb+=N.total||0;if(Mb<Pd){var yd=Pd-Mb,fe=Pd-Mb;if(null!==Ba.spanAllocation)for(var Cg=Ba.spanAllocation,bd=0;bd<Ba.rowSpan&&!(0>=yd)&&!(Ba.row+bd>=a.rowCount);bd++){N=a.getRowDefinition(Ba.row+bd);var Oe=N.ka||0,Dg=Cg(Ba,N,fe);N.actual=
Math.min(N.maximum,Oe+Dg);N.ka!==Oe&&(yd-=N.ka-Oe)}for(;0<yd;){var Gf=N.ka||0;isNaN(N.height)&&N.maximum>Gf&&(N.actual=Math.min(N.maximum,Gf+yd),N.ka!==Gf&&(yd-=N.ka-Gf));if(0===N.index)break;N=a.getRowDefinition(N.index-1)}}for(var Pe=0,Eg=0;Eg<Ba.columnSpan&&!(Ba.column+Eg>=a.columnCount);Eg++)N=a.getColumnDefinition(Ba.column+Eg),Pe+=N.total||0;if(Pe<wb){var bg=wb-Pe,Di=wb-Pe;if(null!==Ba.spanAllocation)for(var Qe=Ba.spanAllocation,Re=0;Re<Ba.columnSpan&&!(0>=bg)&&!(Ba.column+Re>=a.columnCount);Re++){N=
a.getColumnDefinition(Ba.column+Re);var Fh=N.ka||0,kt=Qe(Ba,N,Di);N.actual=Math.min(N.maximum,Fh+kt);N.ka!==Fh&&(bg-=N.ka-Fh)}for(;0<bg;){var Tj=N.ka||0;isNaN(N.width)&&N.maximum>Tj&&(N.actual=Math.min(N.maximum,Tj+bg),N.ka!==Tj&&(bg-=N.ka-Tj));if(0===N.index)break;N=a.getColumnDefinition(N.index-1)}}}}Oa(C);K.free(ld);K.free(eb);void 0!==md&&Oa(md);void 0!==nb&&Oa(nb);var Fg=0,Gg=0,Uj=a.desiredSize,Oq=a.maxSize;Eb=Zk(a,!0);var Ei=Ya=Wb=0,Fi=0;h=a.columnCount;for(var Vj=0;Vj<h;Vj++)void 0!==a.nb[Vj]&&
(N=a.getColumnDefinition(Vj),isFinite(N.width)?(Ei+=N.width,Ei+=N.tc()):sm(N)===tm?(Ei+=N.ka,Ei+=N.tc()):0!==N.ka&&(Wb+=N.ka,Wb+=N.tc()));isFinite(Uj.width)?Fg=Math.min(Uj.width,Oq.width):Fg=Eb!==Yg&&isFinite(b)?b:Wb;Fg=Math.max(Fg,a.minSize.width);Fg=Math.max(Fg-Ei,0);for(var lt=0===Wb?1:Math.max(Fg/Wb,1),Xj=0;Xj<h;Xj++)void 0!==a.nb[Xj]&&(N=a.getColumnDefinition(Xj),isFinite(N.width)||sm(N)===tm||(N.actual=N.ka*lt),N.position=e.width,0!==N.ka&&(e.width+=N.ka,e.width+=N.tc()));h=a.rowCount;for(var Yj=
0;Yj<h;Yj++)void 0!==a.sb[Yj]&&(N=a.getRowDefinition(Yj),isFinite(N.height)?(Fi+=N.height,Fi+=N.tc()):sm(N)===tm?(Fi+=N.ka,Fi+=N.tc()):0!==N.ka&&(Ya+=N.ka,0!==N.ka&&(Ya+=N.tc())));isFinite(Uj.height)?Gg=Math.min(Uj.height,Oq.height):Gg=Eb!==Yg&&isFinite(c)?c:Ya;Gg=Math.max(Gg,a.minSize.height);Gg=Math.max(Gg-Fi,0);for(var mt=0===Ya?1:Math.max(Gg/Ya,1),Zj=0;Zj<h;Zj++)void 0!==a.sb[Zj]&&(N=a.getRowDefinition(Zj),isFinite(N.height)||sm(N)===tm||(N.actual=N.ka*mt),N.position=e.height,0!==N.ka&&(e.height+=
N.ka,0!==N.ka&&(e.height+=N.tc())));h=l.length;for(var jn=0;jn<h;jn++){var Qd=l[jn],kn=0,ln=0;Qd.type===X.TableRow?(kn=e.width,N=a.getRowDefinition(Qd.row),ln=N.actual):(N=a.getColumnDefinition(Qd.column),kn=N.actual,ln=e.height);Qd.measuredBounds.h(0,0,kn,ln);hj(Qd,!1);v[Qd.row]||(v[Qd.row]=[]);v[Qd.row][Qd.column]||(v[Qd.row][Qd.column]=[]);v[Qd.row][Qd.column].push(Qd)}Oa(l);a.$o=v};
rm.prototype.arrange=function(a,b,c){var d=b.length,e=a.padding,f=e.left;e=e.top;for(var g=a.$o,h,k,l=g.length,m=0,n=0;n<l;n++)g[n]&&(m=Math.max(m,g[n].length));for(n=Math.min(a.topIndex,l-1);n!==l&&(void 0===a.sb[n]||0===a.sb[n].ka);)n++;n=Math.min(n,l-1);n=-a.sb[n].position;for(h=Math.min(a.leftIndex,m-1);h!==m&&(void 0===a.nb[h]||0===a.nb[h].ka);)h++;h=Math.min(h,m-1);for(var p=-a.nb[h].position,q=K.alloc(),r=0;r<l;r++)if(g[r]){m=g[r].length;var u=a.getRowDefinition(r);k=u.position+n+e;0!==u.ka&&
(k+=u.Ku());for(var x=0;x<m;x++)if(g[r][x]){var v=a.getColumnDefinition(x);h=v.position+p+f;0!==v.ka&&(h+=v.Ku());for(var y=g[r][x],z=y.length,B=0;B<z;B++){var C=y[B],I=C.measuredBounds,J=C instanceof X?C:null;if(null===J||J.type!==X.TableRow&&J.type!==X.TableColumn){q.h(0,0);for(var M=1;M<C.rowSpan&&!(r+M>=a.rowCount);M++)J=a.getRowDefinition(r+M),q.height+=J.total;for(M=1;M<C.columnSpan&&!(x+M>=a.columnCount);M++)J=a.getColumnDefinition(x+M),q.width+=J.total;var U=v.ka+q.width,Q=u.ka+q.height;M=
h;J=k;var ia=U,ja=Q,N=h,R=k,Aa=U,ob=Q;h+U>c.width&&(Aa=Math.max(c.width-h,0));k+Q>c.height&&(ob=Math.max(c.height-k,0));var Ha=C.alignment;if(Ha.Kb()){Ha=a.defaultAlignment;Ha.gb()||(Ha=dd);var Da=Ha.x;var Fa=Ha.y;var Ra=Ha.offsetX;Ha=Ha.offsetY;var Ub=v.alignment,$a=u.alignment;Ub.gb()&&(Da=Ub.x,Ra=Ub.offsetX);$a.gb()&&(Fa=$a.y,Ha=$a.offsetY)}else Da=Ha.x,Fa=Ha.y,Ra=Ha.offsetX,Ha=Ha.offsetY;if(isNaN(Da)||isNaN(Fa))Fa=Da=.5,Ha=Ra=0;Ub=I.width;$a=I.height;var Xa=C.margin,Ma=Xa.left+Xa.right,fa=Xa.top+
Xa.bottom,ea=rl(C,u,v,!1);!isNaN(C.desiredSize.width)||ea!==be&&ea!==Kk||(Ub=Math.max(U-Ma,0));!isNaN(C.desiredSize.height)||ea!==be&&ea!==Lk||($a=Math.max(Q-fa,0));U=C.maxSize;Q=C.minSize;Ub=Math.min(U.width,Ub);$a=Math.min(U.height,$a);Ub=Math.max(Q.width,Ub);$a=Math.max(Q.height,$a);U=$a+fa;M+=ia*Da-(Ub+Ma)*Da+Ra+Xa.left;J+=ja*Fa-U*Fa+Ha+Xa.top;C.visible&&(Cc(N,R,Aa,ob,M,J,I.width,I.height)?C.arrange(M,J,Ub,$a):C.arrange(M,J,Ub,$a,new L(N,R,Aa,ob)))}else C.bl(),C.actualBounds.ha(),ia=C.actualBounds,
M=L.allocAt(ia.x,ia.y,ia.width,ia.height),ia.x=J.type===X.TableRow?f:h,ia.y=J.type===X.TableColumn?e:k,ia.width=I.width,ia.height=I.height,C.actualBounds.freeze(),$k(C,!1),xc(M,ia)||(I=C.part,null!==I&&(I.wh(),C.Ao(I))),L.free(M)}}}K.free(q);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.ha(),c.naturalBounds.h(0,0,f.width,f.height),c.naturalBounds.freeze())};
function um(){this.name="Base";this.name="TableRow"}oa(um,Bl);um.prototype.measure=function(){};um.prototype.arrange=function(){};function vm(){this.name="Base";this.name="TableColumn"}oa(vm,Bl);vm.prototype.measure=function(){};vm.prototype.arrange=function(){};function wm(){this.name="Base";this.name="Viewbox"}oa(wm,Bl);
wm.prototype.measure=function(a,b,c,d,e,f,g){1<d.length&&A("Viewbox Panel cannot contain more than one GraphObject.");d=d[0];d.Ca=1;d.bm();d.measure(Infinity,Infinity,f,g);var h=d.measuredBounds,k=d.margin,l=k.right+k.left;k=k.top+k.bottom;if(isFinite(b)||isFinite(c)){var m=d.scale,n=h.width;h=h.height;var p=Math.max(b-l,0),q=Math.max(c-k,0),r=1;a.viewboxStretch===$g?0!==n&&0!==h&&(r=Math.min(p/n,q/h)):0!==n&&0!==h&&(r=Math.max(p/n,q/h));0===r&&(r=1E-4);d.Ca*=r;m!==d.scale&&(hj(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)};wm.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.Kb()&&(g=a.defaultAlignment);g.gb()||(g=dd);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 xm(){this.name="Base";this.name="Grid"}oa(xm,Bl);
xm.prototype.measure=function(){};xm.prototype.arrange=function(){};function ym(){this.name="Base";this.name="Link"}oa(ym,Bl);
ym.prototype.measure=function(a,b,c,d,e){c=d.length;if(a instanceof pf||a instanceof S){var f=null,g=null,h=null;a instanceof S&&(g=f=a);a instanceof pf&&(h=a,f=h.adornedPart);if(f instanceof S){var k=f;if(0===c)sc(a.naturalBounds,0,0),a.measuredBounds.h(0,0,0,0);else{var l=a instanceof pf?null:f.path,m=f.routeBounds;b=a.fg;b.h(0,0,m.width,m.height);var n=k.points;f=f.pointsCount;null!==h?h.dk(!1):null!==g&&g.dk(!1);var p=m.width,q=m.height;a.location.h(m.x,m.y);a.l.length=0;null!==l&&(zm(a,p,q,l),
h=l.measuredBounds,b.Uc(h),a.l.push(h));h=Qc.alloc();for(var r=G.alloc(),u=G.alloc(),x=0;x<c;x++){var v=d[x];if(v!==l)if(v.isPanelMain&&v instanceof W){zm(a,p,q,v);var y=v.measuredBounds;b.Uc(y);a.l.push(y)}else if(2>f)v.measure(Infinity,Infinity,0,0),y=v.measuredBounds,b.Uc(y),a.l.push(y);else{var z=v.segmentIndex;y=v.segmentFraction;var B=v.alignmentFocus;B.kc()&&(B=dd);var C=v.segmentOrientation,I=v.segmentOffset;if(z<-f||z>=f){y=k.midPoint;var J=k.midAngle;if(C!==Ng){var M=k.computeAngle(v,C,
J);v.zc=M}M=y.x-m.x;var U=y.y-m.y}else{M=0;if(0<=z){U=n.N(z);var Q=z<f-1?n.N(z+1):U}else M=f+z,U=n.N(M),Q=0<M?n.N(M-1):U;if(U.Qa(Q)){0<=z?(J=0<z?n.N(z-1):U,M=z<f-2?n.N(z+2):Q):(J=M<f-1?n.N(M+1):U,M=1<M?n.N(M-2):Q);var ia=J.Ae(U),ja=Q.Ae(M);J=ia>ja+10?0<=z?J.Wa(U):U.Wa(J):ja>ia+10?0<=z?Q.Wa(M):M.Wa(Q):0<=z?J.Wa(M):M.Wa(J)}else J=0<=z?U.Wa(Q):Q.Wa(U);C!==Ng&&(M=k.computeAngle(v,C,J),v.zc=M);M=U.x+(Q.x-U.x)*y-m.x;U=U.y+(Q.y-U.y)*y-m.y}v.measure(Infinity,Infinity,0,0);y=v.measuredBounds;ja=v.naturalBounds;
ia=0;v instanceof W&&(ia=v.strokeWidth);Q=ja.width+ia;ja=ja.height+ia;h.reset();h.translate(-y.x,-y.y);h.scale(v.scale,v.scale);h.rotate(C===Ng?v.angle:J,Q/2,ja/2);C!==Am&&C!==Bm||h.rotate(90,Q/2,ja/2);C!==Cm&&C!==Dm||h.rotate(-90,Q/2,ja/2);C===Em&&(45<J&&135>J||225<J&&315>J)&&h.rotate(-J,Q/2,ja/2);C=new L(0,0,Q,ja);r.Ri(C,B);h.ta(r);B=-r.x+ia/2*v.scale;v=-r.y+ia/2*v.scale;u.assign(I);isNaN(u.x)&&(u.x=0<=z?Q/2+3:-(Q/2+3));isNaN(u.y)&&(u.y=-(ja/2+3));u.rotate(J);M+=u.x;U+=u.y;C.set(y);C.h(M+B,U+v,
y.width,y.height);a.l.push(C);b.Uc(C)}}if(null!==g)for(d=g.labelNodes;d.next();)d.value.measure(Infinity,Infinity);a.fg=b;a=a.location;a.h(a.x+b.x,a.y+b.y);sc(e,b.width||0,b.height||0);Qc.free(h);G.free(r);G.free(u)}}}};
ym.prototype.arrange=function(a,b){var c=b.length;if(a instanceof pf||a instanceof S){var d=null,e=null,f=null;a instanceof S&&(e=d=a);a instanceof pf&&(f=a,d=f.adornedPart);var g=a instanceof pf?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.fg.x,l.y-a.fg.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.fg.x,n.y-a.fg.y,n.width,n.height)}}}b=d.points;c=b.count;if(2<=c&&a instanceof S)for(d=
a.labelNodes;d.next();){n=a;g=d.value;h=g.segmentIndex;var p=g.segmentFraction;l=g.alignmentFocus;var q=g.segmentOrientation;k=g.segmentOffset;if(h<-c||h>=c){var r=n.midPoint;m=n.midAngle;q!==Ng&&(n=n.computeAngle(g,q,m),g.angle=n);n=r.x;var u=r.y}else{var x=0;0<=h?(u=b.j[h],r=h<c-1?b.j[h+1]:u):(x=c+h,u=b.j[x],r=0<x?b.j[x-1]:u);if(u.Qa(r)){0<=h?(m=0<h?b.j[h-1]:u,x=h<c-2?b.j[h+2]:r):(m=x<c-1?b.j[x+1]:u,x=1<x?b.j[x-2]:r);var v=m.Ae(u),y=r.Ae(x);m=v>y+10?0<=h?m.Wa(u):u.Wa(m):y>v+10?0<=h?r.Wa(x):x.Wa(r):
0<=h?m.Wa(x):x.Wa(m)}else m=0<=h?u.Wa(r):r.Wa(u);q!==Ng&&(n=n.computeAngle(g,q,m),g.angle=n);n=u.x+(r.x-u.x)*p;u=u.y+(r.y-u.y)*p}l.bt()?g.location=new G(n,u):(l.kc()&&(l=dd),r=Qc.alloc(),r.reset(),r.scale(g.scale,g.scale),r.rotate(g.angle,0,0),p=g.naturalBounds,p=L.allocAt(0,0,p.width,p.height),q=G.alloc(),q.Ri(p,l),r.ta(q),l=-q.x,x=-q.y,k=k.copy(),isNaN(k.x)&&(0<=h?k.x=q.x+3:k.x=-(q.x+3)),isNaN(k.y)&&(k.y=-(q.y+3)),k.rotate(m),n+=k.x,u+=k.y,r.Qv(p),l+=p.x,x+=p.y,h=G.allocAt(n+l,u+x),g.move(h),G.free(h),
G.free(q),L.free(p),Qc.free(r))}null!==f?f.dk(!1):null!==e&&e.dk(!1)}};function zm(a,b,c,d){if(!1!==mj(d)){var e=d.strokeWidth;0===e&&a instanceof pf&&a.type===X.Link&&a.adornedObject instanceof W&&(e=a.adornedObject.strokeWidth);e*=d.Ca;a instanceof S&&null!==a.qa?(a=a.qa.bounds,Wk(d,a.x-e/2,a.y-e/2,a.width+e,a.height+e)):a instanceof pf&&null!==a.adornedPart.qa?(a=a.adornedPart.qa.bounds,Wk(d,a.x-e/2,a.y-e/2,a.width+e,a.height+e)):Wk(d,-(e/2),-(e/2),b+e,c+e);hj(d,!1)}}
function Fm(){this.name="Base";this.name="Graduated"}oa(Fm,Bl);
Fm.prototype.measure=function(a,b,c,d,e,f,g){var h=a.zb();a.fj=[];var k=h.margin,l=k.right+k.left,m=k.top+k.bottom;h.measure(b,c,f,g);var n=h.measuredBounds,p=new L(-k.left,-k.top,Math.max(n.width+l,0),Math.max(n.height+m,0));a.fj.push(p);e.assign(p);for(var q=h.geometry,r=h.strokeWidth,u=q.flattenedSegments,x=q.flattenedLengths,v=q.flattenedTotalLength,y=u.length,z=0,B=0,C=Ka(),I=0;I<y;I++){var J=u[I],M=[];B=z=0;for(var U=J.length,Q=0;Q<U;Q+=2){var ia=J[Q],ja=J[Q+1];if(0!==Q){var N=180*Math.atan2(ja-
B,ia-z)/Math.PI;0>N&&(N+=360);M.push(N)}z=ia;B=ja}C.push(M)}if(null===a.Lg){for(var R=[],Aa=a.W.j,ob=Aa.length,Ha=0;Ha<ob;Ha++){var Da=Aa[Ha],Fa=[];R.push(Fa);if(Da.visible)for(var Ra=Da.interval,Ub=0;Ub<ob;Ub++){var $a=Aa[Ub];if($a.visible&&Da!==$a&&!(Da instanceof W&&!($a instanceof W)||Da instanceof uh&&!($a instanceof uh))){var Xa=$a.interval;Xa>Ra&&Fa.push(Xa)}}}a.Lg=R}var Ma=a.Lg;var fa=a.W.j,ea=fa.length,hb=0,jb=0,Na=v;a.hj=[];for(var ce,Kd=0;Kd<ea;Kd++){var vb=fa[Kd];ce=[];if(vb.visible&&
vb!==h){var zf=vb.interval,Eb=a.graduatedTickUnit;if(!(2>Eb*zf*v/a.graduatedRange)){var pe=x[0][0],Wc=0,Vb=0;jb=v*vb.graduatedStart-1E-4;Na=v*vb.graduatedEnd+1E-4;var Ld=Eb*zf,Ec=a.graduatedTickBase;if(Ec<a.graduatedMin){var He=(a.graduatedMin-Ec)/Ld;He=0===He%1?He:Math.floor(He+1);Ec+=He*Ld}else Ec>a.graduatedMin+Ld&&(Ec-=Math.floor((Ec-a.graduatedMin)/Ld)*Ld);for(var Ie=Ma[Kd];Ec<=a.graduatedMax;){a:{for(var Af=Ie.length,gf=0;gf<Af;gf++)if(H.ca((Ec-a.graduatedTickBase)%(Ie[gf]*a.graduatedTickUnit),
0)){var Bf=!1;break a}Bf=!0}if(Bf&&(null===vb.graduatedSkip||!vb.graduatedSkip(Ec))&&(hb=(Ec-a.graduatedMin)*v/a.graduatedRange,hb>v&&(hb=v),jb<=hb&&hb<=Na)){for(var Wb=C[Wc][Vb],Ya=x[Wc][Vb];Wc<x.length;){for(;hb>pe&&Vb<x[Wc].length-1;)Vb++,Wb=C[Wc][Vb],Ya=x[Wc][Vb],pe+=Ya;if(hb<=pe)break;Wc++;Vb=0;Wb=C[Wc][Vb];Ya=x[Wc][Vb];pe+=Ya}var ab=u[Wc],Lc=ab[2*Vb],Cf=ab[2*Vb+1],jc=(hb-(pe-Ya))/Ya,Md=new G(Lc+(ab[2*Vb+2]-Lc)*jc+r/2-q.bounds.x,Cf+(ab[2*Vb+3]-Cf)*jc+r/2-q.bounds.y);Md.scale(h.scale,h.scale);
var qc=Wb,Nd=C[Wc];1E-4>jc?0<Vb?qc=Nd[Vb-1]:H.ca(ab[0],ab[ab.length-2])&&H.ca(ab[1],ab[ab.length-1])&&(qc=Nd[Nd.length-1]):.9999<jc&&(Vb+1<Nd.length?qc=Nd[Vb+1]:H.ca(ab[0],ab[ab.length-2])&&H.ca(ab[1],ab[ab.length-1])&&(qc=Nd[0]));Wb!==qc&&(180<Math.abs(Wb-qc)&&(Wb<qc?Wb+=360:qc+=360),Wb=(Wb+qc)/2%360);if(vb instanceof uh){var Xb="";null!==vb.graduatedFunction?(Xb=vb.graduatedFunction(Ec),Xb=null!==Xb&&void 0!==Xb?Xb.toString():""):Xb=(+Ec.toFixed(2)).toString();""!==Xb&&ce.push([Md,Wb,Xb])}else ce.push([Md,
Wb])}Ec+=Ld}}}a.hj.push(ce)}Oa(C);for(var Dh=a.hj,Eh=d.length,Je=0;Je<Eh;Je++){var pb=d[Je],Df=Dh[Je];if(pb.visible&&pb!==h&&0!==Df.length){if(pb instanceof W){var Ke=a,Yb=e,Le=pb.alignmentFocus;Le.kc()&&(Le=Uc);var Mc=pb.angle;pb.zc=0;pb.measure(Infinity,Infinity,0,0);pb.zc=Mc;var eb=pb.measuredBounds,Me=eb.width,rb=eb.height,rc=L.allocAt(0,0,Me,rb),kb=G.alloc();kb.Ri(rc,Le);L.free(rc);for(var Xc=-kb.x,Yc=-kb.y,xd=new L,Bg=Df.length,Ef=0;Ef<Bg;Ef++)for(var Ff=Df[Ef],hf=Ff[0].x,kd=Ff[0].y,Od=Ff[1],
ld=0;4>ld;ld++){switch(ld){case 0:kb.h(Xc,Yc);break;case 1:kb.h(Xc+Me,Yc);break;case 2:kb.h(Xc,Yc+rb);break;case 3:kb.h(Xc+Me,Yc+rb)}kb.rotate(Od+pb.angle);kb.offset(hf,kd);0===Ef&&0===ld?xd.h(kb.x,kb.y,0,0):xd.He(kb);kb.offset(-hf,-kd);kb.rotate(-Od-pb.angle)}G.free(kb);Ke.fj.push(xd);Bc(Yb,xd.x,xd.y,xd.width,xd.height)}else if(pb instanceof uh){var md=a,nb=e;null===md.hh&&(md.hh=new uh);var fb=md.hh;Gm(fb,pb);var nd=pb.alignmentFocus;nd.kc()&&(nd=Uc);for(var Zc=pb.segmentOrientation,od=pb.segmentOffset,
vc=null,Ba=0,$c=0,Zb=0,de=0,Ne=Df.length,ee=0;ee<Ne;ee++){var wc=Df[ee];Ba=wc[0].x;$c=wc[0].y;Zb=wc[1];Zc!==Ng&&(de=S.computeAngle(Zc,Zb),fb.zc=de);fb.text=wc[2];fb.measure(Infinity,Infinity,0,0);var qe=fb.measuredBounds,ad=fb.naturalBounds,wb=ad.width,Pd=ad.height,Mb=Qc.alloc();Mb.reset();Mb.translate(-qe.x,-qe.y);Mb.scale(fb.scale,fb.scale);Mb.rotate(Zc===Ng?fb.angle:Zb,wb/2,Pd/2);Zc!==Am&&Zc!==Bm||Mb.rotate(90,wb/2,Pd/2);Zc!==Cm&&Zc!==Dm||Mb.rotate(-90,wb/2,Pd/2);Zc===Em&&(45<Zb&&135>Zb||225<Zb&&
315>Zb)&&Mb.rotate(-Zb,wb/2,Pd/2);var re=L.allocAt(0,0,wb,Pd),yd=G.alloc();yd.Ri(re,nd);Mb.ta(yd);var fe=-yd.x,Cg=-yd.y,bd=G.alloc();bd.assign(od);isNaN(bd.x)&&(bd.x=wb/2+3);isNaN(bd.y)&&(bd.y=-(Pd/2+3));bd.rotate(Zb);Ba+=bd.x+fe;$c+=bd.y+Cg;var Oe=new L(Ba,$c,qe.width,qe.height),Dg=new L(qe.x,qe.y,qe.width,qe.height),Gf=new L(ad.x,ad.y,ad.width,ad.height),Pe=new Hm;Pe.Tl(fb.metrics);wc.push(de);wc.push(fb.lineCount);wc.push(Pe);wc.push(Oe);wc.push(Dg);wc.push(Gf);0===ee?vc=Oe.copy():vc.Uc(Oe);G.free(bd);
G.free(yd);L.free(re);Qc.free(Mb)}md.fj.push(vc);Bc(nb,vc.x,vc.y,vc.width,vc.height)}hj(pb,!1)}}};Fm.prototype.arrange=function(a,b,c){if(null!==a.fj){var d=a.zb(),e=a.hj,f=a.fj,g=0,h=f[g];g++;d.arrange(h.x-c.x,h.y-c.y,h.width,h.height);for(var k=b.length,l=0;l<k;l++){var m=b[l];h=e[l];m.visible&&m!==d&&0!==h.length&&(h=f[g],g++,m.arrange(h.x-c.x,h.y-c.y,h.width,h.height))}a.fj=null}};
function X(a){Y.call(this);this.va=void 0===a?X.Position:a;null===this.va&&A("Panel type not specified or PanelLayout not loaded: "+a);this.W=new E;this.eb=Oc;this.va===X.Grid&&(this.isAtomic=!0);this.kn=Ed;this.Cf=Jk;this.va===X.Table&&Im(this);this.Cp=$g;this.In=kc;this.Jn=ac;this.Fn=0;this.En=100;this.Hn=10;this.Gn=0;this.Ph=this.jb=this.Lg=this.fj=this.hj=null;this.Wn=NaN;this.ie=this.di=null;this.cl="category";this.Ed=null;this.fg=new L(NaN,NaN,NaN,NaN);this.hh=this.$o=this.si=null;this.xg=""}
oa(X,Y);function Im(a){a.bj=Oc;a.Fg=1;a.Uh=null;a.Th=null;a.Eg=1;a.Dg=null;a.Sh=null;a.sb=[];a.nb=[];a.Dj=Jm;a.$i=Jm;a.vi=0;a.fi=0}
X.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.va=this.va;a.eb=this.eb.I();a.kn=this.kn.I();a.Cf=this.Cf;if(a.va===X.Table){a.bj=this.bj.I();a.Fg=this.Fg;a.Uh=this.Uh;a.Th=this.Th;a.Eg=this.Eg;a.Dg=this.Dg;a.Sh=this.Sh;var b=[];if(0<this.sb.length)for(var c=this.sb,d=c.length,e=0;e<d;e++)if(void 0!==c[e]){var f=c[e].copy();f.Qi(a);b[e]=f}a.sb=b;b=[];if(0<this.nb.length)for(c=this.nb,d=c.length,e=0;e<d;e++)void 0!==c[e]&&(f=c[e].copy(),f.Qi(a),b[e]=f);a.nb=b;a.Dj=
this.Dj;a.$i=this.$i;a.vi=this.vi;a.fi=this.fi}a.Cp=this.Cp;a.In=this.In.I();a.Jn=this.Jn.I();a.Fn=this.Fn;a.En=this.En;a.Hn=this.Hn;a.Gn=this.Gn;a.hj=this.hj;a.Lg=this.Lg;a.jb=this.jb;a.Ph=this.Ph;a.Wn=this.Wn;a.di=this.di;a.ie=this.ie;a.cl=this.cl;a.fg.assign(this.fg);a.xg=this.xg;null!==this.$o&&(a.$o=this.$o)};X.prototype.nf=function(a){Y.prototype.nf.call(this,a);a.W=this.W;for(var b=a.W.j,c=b.length,d=0;d<c;d++)b[d].Zf=a;a.si=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.Qi(a);e.yj=null;var f=a.W,g=f.count;f.Ib(g,e);f=a.part;if(null!==f){f.tj=null;null!==e.portId&&f instanceof V&&(f.vh=!0);var h=a.diagram;null!==h&&h.undoManager.isUndoingRedoing||f.ab(cf,"elements",a,null,e,null,g)}}return a}return null};t=X.prototype;t.toString=function(){return"Panel("+this.type+")#"+Bb(this)};
t.Ao=function(a){Y.prototype.Ao.call(this,a);for(var b=this.W.j,c=b.length,d=0;d<c;d++)b[d].Ao(a)};
t.Ai=function(a,b){if(this.va===X.Grid){b=this.Be()*b.scale;0>=b&&(b=1);var c=this.gridCellSize,d=c.width;c=c.height;var e=this.naturalBounds,f=this.actualBounds,g=e.width,h=e.height,k=Math.ceil(g/d),l=Math.ceil(h/c),m=this.gridOrigin;a.save();a.beginPath();a.rect(0,0,g,h);a.clip();for(var n=[],p=this.W.j,q=p.length,r=0;r<q;r++){var u=p[r],x=[];n.push(x);if(u.visible){u=Qj(u.figure);for(var v=r+1;v<q;v++){var y=p[v];y.visible&&Qj(y.figure)===u&&(y=y.interval,2<=y&&x.push(y))}}}p=this.W.j;q=p.length;
for(r=0;r<q;r++){var z=p[r];if(z.visible&&(x=z.interval,!(2>d*x*b))){u=z.opacity;v=1;if(1!==u){if(0===u)continue;v=a.globalAlpha;a.globalAlpha=v*u}y=n[r];var B=!1,C=z.strokeDashArray;null!==C&&(B=!0,a.Ls(C,z.strokeDashOffset));if("LineV"===z.figure&&null!==z.stroke){a.lineWidth=z.strokeWidth;hi(this,a,z.stroke,!1,!1,e,f);a.beginPath();for(C=z=Math.floor(-m.x/d);C<=z+k;C++){var I=C*d+m.x;0<=I&&I<=g&&Km(C,x,y)&&(a.moveTo(I,0),a.lineTo(I,h))}a.stroke()}else if("LineH"===z.figure&&null!==z.stroke){a.lineWidth=
z.strokeWidth;hi(this,a,z.stroke,!1,!1,e,f);a.beginPath();for(C=z=Math.floor(-m.y/c);C<=z+l;C++)I=C*c+m.y,0<=I&&I<=h&&Km(C,x,y)&&(a.moveTo(0,I),a.lineTo(g,I));a.stroke()}else if("BarV"===z.figure&&null!==z.fill)for(hi(this,a,z.fill,!0,!1,e,f),z=z.width,isNaN(z)&&(z=d),I=C=Math.floor(-m.x/d);I<=C+k;I++){var J=I*d+m.x;0<=J&&J<=g&&Km(I,x,y)&&a.fillRect(J,0,z,h)}else if("BarH"===z.figure&&null!==z.fill)for(hi(this,a,z.fill,!0,!1,e,f),z=z.height,isNaN(z)&&(z=c),I=C=Math.floor(-m.y/c);I<=C+l;I++)J=I*c+
m.y,0<=J&&J<=h&&Km(I,x,y)&&a.fillRect(0,J,g,z);B&&a.Js();1!==u&&(a.globalAlpha=v)}}a.restore();a.Qc(!1)}else if(this.va===X.Graduated){d=b.kj;b.kj=!0;e=this.naturalBounds;c=e.width;e=e.height;a.save();a.beginPath();a.rect(-1,-1,c+1,e+1);a.clip();c=this.zb();c.ic(a,b);e=this.Be()*b.scale;0>=e&&(e=1);f=c.actualBounds;g=this.W.j;h=this.hj;k=g.length;for(l=0;l<k;l++)if(p=g[l],m=h[l],n=m.length,p.visible&&p!==c&&0!==m.length)if(p instanceof W){if(!(2>this.graduatedTickUnit*p.interval*e))for(q=p.measuredBounds,
r=p.strokeWidth*p.scale,x=p.alignmentFocus,x.kc()&&(x=Uc),u=0;u<n;u++)v=m[u][0],y=m[u][1],B=x,z=p.tb,z.reset(),z.translate(v.x+f.x,v.y+f.y),z.rotate(y+p.angle,0,0),z.translate(-q.width*B.x+B.offsetX+r/2,-q.height*B.y+B.offsetY+r/2),z.scale(p.scale,p.scale),ol(p,!1),p.Ch.set(p.tb),p.Pk=p.scale,pl(p,!1),p.ic(a,b),p.tb.reset()}else if(p instanceof uh)for(null===this.hh&&(this.hh=new uh),q=this.hh,Gm(q,p),p=0;p<n;p++)u=m[p],3<u.length&&(r=u[6],q.Ob=u[2],q.zc=u[3],q.pc=u[4],q.nd=u[5],q.hc=u[8],q.arrange(r.x,
r.y,r.width,r.height),r=u[6],q.arrange(r.x,r.y,r.width,r.height),x=u[7],u=u[8],v=q.tb,v.reset(),v.translate(r.x+f.x,r.y+f.y),v.translate(-x.x,-x.y),Xk(q,v,u.x,u.y,u.width,u.height),ol(q,!1),q.Ch.set(q.tb),q.Pk=q.scale,pl(q,!1),q.ic(a,b));b.kj=d;a.restore();a.Qc(!0)}else{this.va===X.Table&&(a.lineCap="butt",Lm(this,a,!0,this.sb,!0),Lm(this,a,!1,this.nb,!0),Mm(this,a,!0,this.sb),Mm(this,a,!1,this.nb),Lm(this,a,!0,this.sb,!1),Lm(this,a,!1,this.nb,!1));(d=this.isClipping)&&a.save();c=this.zb();e=this.W.j;
f=e.length;for(g=0;g<f;g++)h=e[g],d&&h===c&&(a.clipInsteadOfFill=!0),h.ic(a,b),d&&h===c&&(a.clipInsteadOfFill=!1);d&&(a.restore(),a.Qc(!0))}};
function Mm(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.Fg:a.Eg);var n=l.separatorStroke;null===n&&(n=c?a.Uh:a.Dg);if(0!==m&&null!==n){hi(a,b,n,!1,!1,g,f);n=!1;var p=l.separatorDashArray;null===p&&(p=c?a.Th:a.Sh);null!==p&&(n=!0,b.Ls(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.eb;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.Js()}}}}
function Lm(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.tc(),p=l.separatorStrokeWidth;isNaN(p)&&(p=c?a.Fg:a.Eg);var q=l.separatorStroke;null===q&&(q=c?a.Uh:a.Dg);null===q&&(p=0);n-=p;p=l.position+p;n+=l.actual;p+n>m&&(n=m-p);0>=n||(m=a.eb,hi(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 Km(a,b,c){if(0!==a%b)return!1;b=c.length;for(var d=0;d<b;d++)if(0===a%c[d])return!1;return!0}function Qj(a){return"LineV"===a||"BarV"===a}
t.Zj=function(a,b,c,d,e){var f=this.Yd(),g=this.transform,h=1/(g.m11*g.m22-g.m12*g.m21),k=g.m22*h,l=-g.m12*h,m=-g.m21*h,n=g.m11*h,p=h*(g.m21*g.dy-g.m22*g.dx),q=h*(g.m12*g.dx-g.m11*g.dy);if(null!==this.areaBackground)return g=this.actualBounds,H.Sc(g.left,g.top,g.right,g.bottom,a,b,c,d,e);if(null!==this.background)return f=a*k+b*m+p,h=a*l+b*n+q,a=c*k+d*m+p,k=c*l+d*n+q,e.h(0,0),c=this.naturalBounds,f=H.Sc(0,0,c.width,c.height,f,h,a,k,e),e.transform(g),f;f||(k=1,m=l=0,n=1,q=p=0);h=a*k+b*m+p;a=a*l+b*
n+q;k=c*k+d*m+p;c=c*l+d*n+q;e.h(k,c);d=(k-h)*(k-h)+(c-a)*(c-a);l=!1;n=this.W.j;q=n.length;m=G.alloc();p=null;b=Infinity;var r=null;this.isClipping&&(r=G.alloc(),p=this.zb(),(l=p.Zj(h,a,k,c,r))&&(b=(h-r.x)*(h-r.x)+(a-r.y)*(a-r.y)));for(var u=0;u<q;u++){var x=n[u];x.visible&&x!==p&&x.Zj(h,a,k,c,m)&&(l=!0,x=(h-m.x)*(h-m.x)+(a-m.y)*(a-m.y),x<d&&(d=x,e.set(m)))}this.isClipping&&(b>d&&e.set(r),G.free(r));G.free(m);f&&e.transform(g);return l};
t.o=function(a){Y.prototype.o.call(this,a);a=null;if(this.va===X.Auto||this.va===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.s()){var f=Zk(e,!1);(e instanceof Wg||e instanceof X||e instanceof uh||f!==Yg)&&e.o(!0)}}};t.bm=function(){if(!1===mj(this)){hj(this,!0);$k(this,!0);for(var a=this.W.j,b=a.length,c=0;c<b;c++)a[c].bm()}};
t.bl=function(){if(0!==(this.G&2048)===!1){ol(this,!0);pl(this,!0);for(var a=this.W.j,b=a.length,c=0;c<b;c++)a[c].dv()}};t.dv=function(){pl(this,!0);for(var a=this.W.j,b=a.length,c=0;c<b;c++)a[c].dv()};
t.fm=function(a,b,c,d){var e=this.fg;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.eb;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.va.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);sc(e,a,k);sc(this.naturalBounds,a,k);Wk(this,0,0,a,k)};t.zb=function(){if(null===this.si){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.si=d}this.si=a[0]}return this.si};function km(a){return null!==a.part?a.part.locationObject:null}
t.qh=function(a,b,c,d){var e=this.W.j;this.actualBounds.h(a,b,c,d);if(0!==e.length){if(!this.desiredSize.s()){a=Zk(this,!0);var f=this.measuredBounds;b=f.width;f=f.height;var g=this.Tg,h=g.left+g.right;g=g.top+g.bottom;b===c&&f===d&&(a=Yg);switch(a){case Yg:if(b>c||f>d)this.o(),this.measure(b>c?c:b,f>d?d:f,0,0);break;case be:this.o(!0);this.measure(c+h,d+g,0,0);break;case Kk:this.o(!0);this.measure(c+h,f+g,0,0);break;case Lk:this.o(!0),this.measure(b+h,d+g,0,0)}}this.va.arrange(this,e,this.fg)}};
t.sh=function(a){var b=this.naturalBounds,c=km(this);if(Cc(0,0,b.width,b.height,a.x,a.y)){b=this.W.j;for(var d=b.length,e=G.allocAt(0,0);d--;){var f=b[d];if(f.visible||f===c)if(Qb(e.set(a),f.transform),f.ea(e))return G.free(e),!0}G.free(e);return null===this.ib&&null===this.dc?!1:!0}return!1};t.Ns=function(a){if(this.Ak===a)return this;for(var b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d].Ns(a);if(null!==e)return e}return null};
t.wm=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.wm(a[d],b)}};function zj(a,b){Nm(a,a,b)}function Nm(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&&Nm(a,f,c)}}function Om(a,b){Pm(a,a,b)}function Pm(a,b,c){c(b);if(b instanceof X){b=b.W.j;for(var d=b.length,e=0;e<d;e++)Pm(a,b[e],c)}}t.Wl=function(a){return Qm(this,this,a)};
function Qm(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=Qm(a,b[e],c);if(null!==f)return f}}return null}t.$a=function(a){if(this.name===a)return this;var b=this.W.j,c=b.length;null===this.di&&null===this.ie||(c=Rm(this));for(var d=0;d<c;d++){var e=b[d];if(e instanceof X){var f=e.$a(a);if(null!==f)return f}if(e.name===a)return e}return null};
function Sm(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,Sm(e));else if(e instanceof W){a:{switch(e.Rk){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.gh/2*e.Gj*e.Be()}c=Math.max(c,e)}}return c}t.Yd=function(){return!(this.type===X.TableRow||this.type===X.TableColumn)};
t.Rb=function(a,b,c){if(!1===this.pickable)return null;void 0===b&&(b=null);void 0===c&&(c=null);if(nj(this))return null;var d=this.naturalBounds,e=1/this.Be(),f=this.Yd(),g=f?a:Qb(G.allocAt(a.x,a.y),this.transform),h=this.diagram,k=10,l=5;null!==h&&(k=h.$l("extraTouchArea"),l=k/2);if(Cc(-(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=G.alloc();l=(k=this.isClipping)?this.zb():null;if(k&&(l.Yd()?Qb(h.set(a),l.transform):h.set(a),!l.ea(h)))return G.free(h),
f||G.free(g),null;for(var n=km(this);m--;){var p=e[m];if(p.visible||p===n)if(p.Yd()?Qb(h.set(a),p.transform):h.set(a),!k||p!==l){var q=null;p instanceof X?q=p.Rb(h,b,c):!0===p.pickable&&p.ea(h)&&(q=p);if(null!==q&&(null!==b&&(q=b(q)),null!==q&&(null===c||c(q))))return G.free(h),f||G.free(g),q}}G.free(h)}if(null===this.background&&null===this.areaBackground)return f||G.free(g),null;a=Cc(0,0,d.width,d.height,g.x,g.y)?this:null;f||G.free(g);return a}f||G.free(g);return null};
t.Di=function(a,b,c,d){if(!1===this.pickable)return!1;void 0===b&&(b=null);void 0===c&&(c=null);d instanceof E||d instanceof F||(d=new E);var e=this.naturalBounds,f=this.Yd(),g=f?a:Qb(G.allocAt(a.x,a.y),this.transform);e=Cc(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=G.alloc(),m=km(this);k--;){var n=h[k];if(n.visible||n===m){n.Yd()?Qb(l.set(a),n.transform):l.set(a);var p=n;n=n instanceof X?n:null;(null!==
n?n.Di(l,b,c,d):p.ea(l))&&!1!==p.pickable&&(null!==b&&(p=b(p)),null===p||null!==c&&!c(p)||d.add(p))}}G.free(l)}f||G.free(g);return e&&(null!==this.background||null!==this.areaBackground)}f||G.free(g);return!1};
t.lg=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=Qc.alloc(),g.reset());g.multiply(this.transform);if(this.rh(a,g))return Tm(this,b,c,e),void 0===f&&Qc.free(g),!0;if(this.Ic(a,g)){if(!this.isAtomic)for(var h=km(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=Qc.alloc();p.set(g);
if(null!==m?m.lg(a,b,c,d,e,p):Yk(n,a,d,p))null!==b&&(n=b(n)),null===n||null!==c&&!c(n)||e.add(n);Qc.free(p)}}}void 0===f&&Qc.free(g);return d}void 0===f&&Qc.free(g);return!1};function Tm(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&&Tm(g,b,c,d),null!==b&&(g=b(g)),null===g||null!==c&&!c(g)||d.add(g))}}}
t.mg=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.Yd(),k=h?a:Qb(G.allocAt(a.x,a.y),this.transform),l=h?b:Qb(G.allocAt(b.x,b.y),this.transform),m=k.Ae(l),n=0<k.x&&k.x<g.width&&0<k.y&&k.y<g.height||Rb(k.x,k.y,0,0,0,g.height)<=m||Rb(k.x,k.y,0,g.height,g.width,g.height)<=m||Rb(k.x,k.y,g.width,g.height,g.width,0)<=m||Rb(k.x,k.y,g.width,0,0,0)<=m;g=k.cd(0,0)<=m&&k.cd(0,g.height)<=m&&k.cd(g.width,0)<=m&&k.cd(g.width,g.height)<=
m;h||(G.free(k),G.free(l));if(n){if(!this.isAtomic){k=G.alloc();l=G.alloc();m=km(this);for(var p=this.W.j,q=p.length;q--;){var r=p[q];if(r.visible||r===m){var u=r.actualBounds,x=this.naturalBounds;if(!h||!(u.x>x.width||u.y>x.height||0>u.x+u.width||0>u.y+u.height))if(r.Yd()?(u=r.transform,Qb(k.set(a),u),Qb(l.set(b),u)):(k.set(a),l.set(b)),u=r,r=r instanceof X?r:null,null!==r?r.mg(k,l,c,d,e,f):u.gx(k,l,e))null!==c&&(u=c(u)),null===u||null!==d&&!d(u)||f.add(u)}}G.free(k);G.free(l)}return e?n:g}return!1};
function pm(a){var b=null;a instanceof W&&(b=a.spot1,b===Ed&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot1));null===b&&(b=Tc);return b}function qm(a){var b=null;a instanceof W&&(b=a.spot2,b===Ed&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot2));null===b&&(b=hd);return b}t.add=function(a){this.Ib(this.W.count,a)};t.N=function(a){return this.W.N(a)};
t.Ib=function(a,b){b instanceof T&&A("Cannot add a Part to a Panel: "+b+"; use a Panel instead");if(this===b||this.pg(b))this===b&&A("Cannot make a Panel contain itself: "+this.toString()),A("Cannot make a Panel indirectly contain itself: "+this.toString()+" already contains "+b.toString());var c=b.panel;null!==c&&c!==this&&A("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.va!==X.Grid||b instanceof W||A("Can only add Shapes to a Grid Panel, not: "+b);this.va!==X.Graduated||b instanceof W||b instanceof uh||A("Can only add Shapes or TextBlocks to a Graduated Panel, not: "+b);b.Qi(this);b.yj=null;if(null!==this.itemArray){var d=b.data;null!==d&&"object"===typeof d&&(null===this.Ed&&(this.Ed=new Lb),this.Ed.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.mb(f);d=f}else A("element "+b.toString()+" has panel "+c.toString()+" but is not contained by it.")}if(0>a||a>e.count)a=e.count;e.Ib(a,b);if(0===a||b.isPanelMain)this.si=null;mj(this)||this.o();b.o(!1);null!==b.portId?this.vh=!0:b instanceof X&&!0===b.vh&&(this.vh=!0);this.Lg=null;c=this.part;null!==c&&(c.tj=null,c.Ug=NaN,this.vh&&c instanceof V&&(c.vh=!0),c.vh&&c instanceof V&&(c.rc=null),e=this.diagram,null!==e&&e.undoManager.isUndoingRedoing||(-1!==d&&c.ab(df,"elements",this,b,null,d,null),c.ab(cf,
"elements",this,null,b,null,a),this.qg()||Um(this,b,!1)))};function Vm(a,b){a.G=b?a.G|16777216:a.G&-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.xc(d,!0)};t.mb=function(a){0<=a&&this.xc(a,!0)};
t.xc=function(a,b){var c=this.W,d=c.N(a);d.yj=null;d.Qi(null);if(null!==this.Ed){var e=d.data;"object"===typeof e&&this.Ed.remove(e)}c.mb(a);hj(this,!1);this.o();this.si===d&&(this.si=null);this.Lg=null;var f=this.part;null!==f&&(f.tj=null,f.Ug=NaN,f.Jb(),f instanceof V&&(d instanceof X?d.wm(d,function(a,c){El(f,c,b)}):El(f,d,b)),c=this.diagram,null!==c&&c.undoManager.isUndoingRedoing||f.ab(df,"elements",this,d,null,a,null))};
X.prototype.getRowDefinition=function(a){0>a&&xa(a,">= 0",X,"getRowDefinition:idx");a=Math.round(a);var b=this.sb;if(void 0===b)return null;if(void 0===b[a]){var c=new Oj;c.Qi(this);c.isRow=!0;c.index=a;b[a]=c}return b[a]};X.prototype.wv=function(a){0>a&&xa(a,">= 0",X,"removeRowDefinition:idx");a=Math.round(a);var b=this.sb;void 0!==b&&(this.ab(df,"coldefs",this,b[a],null,a,null),b[a]&&delete b[a],this.o())};
X.prototype.getColumnDefinition=function(a){0>a&&xa(a,">= 0",X,"getColumnDefinition:idx");a=Math.round(a);var b=this.nb;if(void 0===b)return null;if(void 0===b[a]){var c=new Oj;c.Qi(this);c.isRow=!1;c.index=a;b[a]=c}return b[a]};t=X.prototype;t.uv=function(a){0>a&&xa(a,">= 0",X,"removeColumnDefinition:idx");a=Math.round(a);var b=this.nb;void 0!==b&&(this.ab(df,"coldefs",this,b[a],null,a,null),b[a]&&delete b[a],this.o())};
t.My=function(a){if(0>a||this.type!==X.Table)return-1;for(var b=0,c=this.sb,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.Ey=function(a){if(0>a||this.type!==X.Table)return-1;for(var b=0,c=this.nb,d=c.length,e=this.fi;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))break}return e};
t.dz=function(a,b){void 0===b&&(b=new G(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.Yu((a-this.graduatedMin)/this.graduatedRange,b);return c.transform.ta(b)};t.ez=function(a){if(this.type!==X.Graduated)return NaN;var b=this.zb();b.transform.Td(a);return b.geometry.jx(a)*this.graduatedRange+this.graduatedMin};function wl(a){a=a.Ph;return null!==a&&a.v}
function Xg(a){var b=a.Ph;if(null===b)null!==a.data&&A("Template cannot have .data be non-null: "+a),a.Ph=b=new E;else if(b.v)return;var c=new E;Vm(a,!1);a.wm(a,function(a,d){var e=d.bb;if(null!==e)for(tl(d,!1),e=e.iterator;e.next();){var f=e.value;f.mode===Wm&&tl(d,!0);var g=f.sourceName;null!==g&&("/"===g&&Vm(a,!0),g=Vk(f,a,d),null!==g&&(c.add(g),null===g.Cl&&(g.Cl=new E),g.Cl.add(f)));b.add(f)}if(d instanceof X&&d.type===X.Table){if(0<d.sb.length)for(a=d.sb,e=a.length,f=0;f<e;f++)if(g=a[f],void 0!==
g&&null!==g.bb)for(var h=g.bb.iterator;h.next();){var k=h.value;k.Pd=g;k.sp=2;k.Kl=g.index;b.add(k)}if(0<d.nb.length)for(d=d.nb,a=d.length,e=0;e<a;e++)if(f=d[e],void 0!==f&&null!==f.bb)for(g=f.bb.iterator;g.next();)h=g.value,h.Pd=f,h.sp=1,h.Kl=f.index,b.add(h)}});for(var d=c.iterator;d.next();){var e=d.value;if(null!==e.Cl){tl(e,!0);for(var f=e.Cl.iterator;f.next();){var g=f.value;null===e.bb&&(e.bb=new E);e.bb.add(g)}}e.Cl=null}for(d=b.iterator;d.next();)if(e=d.value,f=e.Pd,null!==f){e.Pd=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.$a(g),null!==k?(f=k,e.targetProperty=h):ya('Warning: unable to find GraphObject named "'+g+'" for Binding: '+e.toString()));f instanceof Oj?(g=Bb(f.panel),e.Vi=void 0===g?-1:g,f.panel.Ak=e.Vi):f instanceof Y?(g=Bb(f),e.Vi=void 0===g?-1:g,f.Ak=e.Vi):A("Unknown type of binding target: "+f)}b.freeze();a instanceof T&&a.Lb()&&a.ac()}
t.sy=function(){var a=this.copy();Om(a,function(a){a instanceof X&&(a.Ph=null,a.jb=null);var b=a.bb;null!==b&&(a.bb=null,b.each(function(b){a.bind(b.copy())}))});return a};
t.Ea=function(a){var b=this.Ph;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.$a(e);else{var f=this.diagram;null!==f&&c.isToModel&&(d=f.model.modelData)}if(null!==d){f=this;var g=c.Vi;if(-1!==g){if(f=this.Ns(g),null===f)continue}else null!==c.Pd&&(f=c.Pd);"/"===e?d=f.part:"."===
e?d=f:".."===e&&(d=f.panel);e=c.sp;if(0!==e){if(!(f instanceof X))continue;1===e?f=f.getColumnDefinition(c.Kl):2===e&&(f=f.getRowDefinition(c.Kl))}void 0!==f&&c.Tv(f,d)}}}};function Xm(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 Rm(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.N(c);if(!(d instanceof W&&d.isPanelMain))break}return c}return a.type===X.Table&&0<a.W.length&&(a=a.W.N(0),a.isPanelMain&&a instanceof X&&(a.type===X.TableRow||a.type===X.TableColumn))?1:0}t.kt=function(){for(var a=Rm(this);this.W.length>a;)this.xc(this.W.length-1,!1);a=this.itemArray;if(null!==a)for(var b=a.length,c=0;c<b;c++)Ym(this,a[c],c)};
t.ex=function(a){return void 0===a||null===a||null===this.Ed?null:this.Ed.J(a)};
function Ym(a,b,c){if(!(void 0===b||null===b||0>c)){var d=Zm(a,b),e=a.itemTemplateMap,f=null;null!==e&&(f=e.J(d));null===f&&($m||($m=!0,ya('No item template Panel found for category "'+d+'" on '+a),ya(" Using default item template."),d=new X,e=new uh,e.bind(new Ci("text","",Qa)),d.add(e),an=d),f=an);d=f;null!==d&&(Xg(d),d=d.copy(),0!==(d.G&16777216)&&(e=a.Ei(),null!==e&&Vm(e,!0)),"object"===typeof b&&(null===a.Ed&&(a.Ed=new Lb),a.Ed.add(b,d)),e=c+Rm(a),a.Ib(e,d),d.jb=b,bn(a,e,c),d.jb=null,d.data=
b)}}function bn(a,b,c){for(a=a.W;b<a.length;){var d=a.N(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 Zm(a,b){if(null===b)return"";a=a.cl;if("function"===typeof a)a=a(b);else if("string"===typeof a&&"object"===typeof b){if(""===a)return"";a=cn(b,a)}else return"";if(void 0===a)return"";if("string"===typeof a)return a;A("Panel.getCategoryForItemData found a non-string category for "+b+": "+a);return""}
function Um(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||Um(a,f,c)}}}function dn(a,b){Al.add(a,b)}
pa.Object.defineProperties(X.prototype,{type:{get:function(){return this.va},set:function(a){var b=this.va;b!==a&&(this.va=a,this.va===X.Grid?this.isAtomic=!0:this.va===X.Table&&Im(this),this.o(),this.g("type",b,a))}},elements:{get:function(){return this.W.iterator}},naturalBounds:{get:function(){return this.hc}},padding:{get:function(){return this.eb},set:function(a){"number"===
typeof a?(0>a&&xa(a,">= 0",X,"padding"),a=new Ic(a)):(0>a.left&&xa(a.left,">= 0",X,"padding:value.left"),0>a.right&&xa(a.right,">= 0",X,"padding:value.right"),0>a.top&&xa(a.top,">= 0",X,"padding:value.top"),0>a.bottom&&xa(a.bottom,">= 0",X,"padding:value.bottom"));var b=this.eb;b.A(a)||(this.eb=a=a.I(),this.o(),this.g("padding",b,a))}},defaultAlignment:{get:function(){return this.kn},set:function(a){var b=this.kn;b.A(a)||(this.kn=a=a.I(),this.o(),this.g("defaultAlignment",
b,a))}},defaultStretch:{get:function(){return this.Cf},set:function(a){var b=this.Cf;b!==a&&(this.Cf=a,this.o(),this.g("defaultStretch",b,a))}},defaultSeparatorPadding:{get:function(){return void 0===this.bj?Oc:this.bj},set:function(a){if(void 0!==this.bj){"number"===typeof a&&(a=new Ic(a));var b=this.bj;b.A(a)||(this.bj=a=a.I(),this.o(),this.g("defaultSeparatorPadding",b,a))}}},defaultRowSeparatorStroke:{get:function(){return void 0===
this.Uh?null:this.Uh},set:function(a){var b=this.Uh;b!==a&&(null===a||"string"===typeof a||a instanceof hl)&&(a instanceof hl&&a.freeze(),this.Uh=a,this.R(),this.g("defaultRowSeparatorStroke",b,a))}},defaultRowSeparatorStrokeWidth:{get:function(){return void 0===this.Fg?1:this.Fg},set:function(a){if(void 0!==this.Fg){var b=this.Fg;b!==a&&isFinite(a)&&0<=a&&(this.Fg=a,this.o(),this.g("defaultRowSeparatorStrokeWidth",b,a))}}},defaultRowSeparatorDashArray:{
get:function(){return void 0===this.Th?null:this.Th},set:function(a){if(void 0!==this.Th){var b=this.Th;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)||A("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.Th=a;this.R();this.g("defaultRowSeparatorDashArray",b,a)}}}},defaultColumnSeparatorStroke:{get:function(){return void 0===
this.Dg?null:this.Dg},set:function(a){if(void 0!==this.Dg){var b=this.Dg;b!==a&&(null===a||"string"===typeof a||a instanceof hl)&&(a instanceof hl&&a.freeze(),this.Dg=a,this.R(),this.g("defaultColumnSeparatorStroke",b,a))}}},defaultColumnSeparatorStrokeWidth:{get:function(){return void 0===this.Eg?1:this.Eg},set:function(a){if(void 0!==this.Eg){var b=this.Eg;b!==a&&isFinite(a)&&0<=a&&(this.Eg=a,this.o(),this.g("defaultColumnSeparatorStrokeWidth",b,a))}}},defaultColumnSeparatorDashArray:{
get:function(){return void 0===this.Sh?null:this.Sh},set:function(a){if(void 0!==this.Sh){var b=this.Sh;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)||A("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.Sh=a;this.R();this.g("defaultColumnSeparatorDashArray",b,a)}}}},viewboxStretch:{get:function(){return this.Cp},
set:function(a){var b=this.Cp;b!==a&&(this.Cp=a,this.o(),this.g("viewboxStretch",b,a))}},gridCellSize:{get:function(){return this.In},set:function(a){var b=this.In;if(!b.A(a)){a.s()&&0!==a.width&&0!==a.height||A("Invalid Panel.gridCellSize: "+a);this.In=a.I();var c=this.diagram;null!==c&&this===c.grid&&ij(c);this.R();this.g("gridCellSize",b,a)}}},gridOrigin:{get:function(){return this.Jn},set:function(a){var b=this.Jn;if(!b.A(a)){a.s()||
A("Invalid Panel.gridOrigin: "+a);this.Jn=a.I();var c=this.diagram;null!==c&&this===c.grid&&ij(c);this.R();this.g("gridOrigin",b,a)}}},graduatedMin:{get:function(){return this.Fn},set:function(a){var b=this.Fn;b!==a&&(this.Fn=a,this.o(),this.g("graduatedMin",b,a),Tk(this)&&(a=this.part,null!==a&&Uk(this,a,"graduatedRange")))}},graduatedMax:{get:function(){return this.En},set:function(a){var b=this.En;b!==a&&(this.En=a,this.o(),this.g("graduatedMax",
b,a),Tk(this)&&(a=this.part,null!==a&&Uk(this,a,"graduatedRange")))}},graduatedRange:{get:function(){return this.graduatedMax-this.graduatedMin}},graduatedTickUnit:{get:function(){return this.Hn},set:function(a){var b=this.Hn;b!==a&&0<a&&(this.Hn=a,this.o(),this.g("graduatedTickUnit",b,a))}},graduatedTickBase:{get:function(){return this.Gn},set:function(a){var b=this.Gn;b!==a&&(this.Gn=a,this.o(),this.g("graduatedTickBase",
b,a))}},vh:{get:function(){return 0!==(this.G&8388608)},set:function(a){0!==(this.G&8388608)!==a&&(this.G^=8388608)}},rowCount:{get:function(){return void 0===this.sb?0:this.sb.length}},columnCount:{get:function(){return void 0===this.nb?0:this.nb.length}},rowSizing:{get:function(){return void 0===this.Dj?Jm:this.Dj},set:function(a){if(void 0!==this.Dj){var b=this.Dj;b!==a&&(this.Dj=
a,this.o(),this.g("rowSizing",b,a))}}},columnSizing:{get:function(){return void 0===this.$i?Jm:this.$i},set:function(a){if(void 0!==this.$i){var b=this.$i;b!==a&&(this.$i=a,this.o(),this.g("columnSizing",b,a))}}},topIndex:{get:function(){return void 0===this.vi?0:this.vi},set:function(a){if(void 0!==this.vi){var b=this.vi;b!==a&&((!isFinite(a)||0>a)&&A("Panel.topIndex must be greater than zero and a real number, not: "+a),this.vi=a,this.o(),
this.g("topIndex",b,a))}}},leftIndex:{get:function(){return void 0===this.fi?0:this.fi},set:function(a){if(void 0!==this.fi){var b=this.fi;b!==a&&((!isFinite(a)||0>a)&&A("Panel.leftIndex must be greater than zero and a real number, not: "+a),this.fi=a,this.o(),this.g("leftIndex",b,a))}}},data:{get:function(){return this.jb},set:function(a){var b=this.jb;if(b!==a){var c=this instanceof T&&!(this instanceof pf);Xg(this);this.jb=a;var d=this.diagram;
null!==d&&(c?(c=d.partManager,this instanceof S?(null!==b&&c.Cg.remove(b),null!==a&&c.Cg.add(a,this)):this instanceof T&&(null!==b&&c.Le.remove(b),null!==a&&c.Le.add(a,this))):(c=this.panel,null!==c&&null!==c.Ed&&(null!==b&&c.Ed.remove(b),null!==a&&c.Ed.add(a,this))));this.g("data",b,a);null!==d&&d.undoManager.isUndoingRedoing||null!==a&&this.Ea()}}},itemIndex:{get:function(){return this.Wn},set:function(a){var b=this.Wn;b!==a&&(this.Wn=a,this.g("itemIndex",b,a))}},itemArray:{
get:function(){return this.di},set:function(a){var b=this.di;if(b!==a||null!==a&&Xm(this,a)){var c=this.diagram;b!==a&&(null!==c&&null!==b&&Fj(c.partManager,this),this.di=a,null!==c&&null!==a&&Bj(c.partManager,this));this.g("itemArray",b,a);null!==c&&c.undoManager.isUndoingRedoing||this.kt()}}},itemTemplate:{get:function(){return null===this.ie?null:this.ie.J("")},set:function(a){if(null===this.ie){if(null===a)return;this.ie=new Lb}var b=this.ie.J("");b!==
a&&((a instanceof T||a.isPanelMain)&&A("Panel.itemTemplate must not be a Part or be Panel.isPanelMain: "+a),this.ie.add("",a),this.g("itemTemplate",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.kt())}},itemTemplateMap:{get:function(){return this.ie},set:function(a){var b=this.ie;if(b!==a){for(var c=a.iterator;c.next(););this.ie=a;this.g("itemTemplateMap",b,a);a=this.diagram;null!==a&&a.undoManager.isUndoingRedoing||this.kt()}}},itemCategoryProperty:{
get:function(){return this.cl},set:function(a){var b=this.cl;b!==a&&(this.cl=a,this.g("itemCategoryProperty",b,a))}},isAtomic:{get:function(){return 0!==(this.G&1048576)},set:function(a){var b=0!==(this.G&1048576);b!==a&&(this.G^=1048576,this.g("isAtomic",b,a))}},isClipping:{get:function(){return 0!==(this.G&2097152)},set:function(a){var b=0!==(this.G&2097152);b!==a&&(this.G^=2097152,this.o(),this.g("isClipping",b,a))}},isOpposite:{
get:function(){return 0!==(this.G&33554432)},set:function(a){var b=0!==(this.G&33554432);b!==a&&(this.G^=33554432,this.o(),this.g("isOpposite",b,a))}},isEnabled:{get:function(){return 0!==(this.G&4194304)},set:function(a){var b=0!==(this.G&4194304);if(b!==a){var c=null===this.panel||this.panel.qg();this.G^=4194304;this.g("isEnabled",b,a);b=this.diagram;null!==b&&b.undoManager.isUndoingRedoing||c&&Um(this,this,a)}}},alignmentFocusName:{
get:function(){return this.xg},set:function(a){var b=this.xg;b!==a&&(this.xg=a,this.o(),this.g("alignmentFocusName",b,a))}}});
pa.Object.defineProperties(X,{Position:{get:function(){return Al.J("Position")}},Horizontal:{get:function(){return Al.J("Horizontal")}},Vertical:{get:function(){return Al.J("Vertical")}},Spot:{get:function(){return Al.J("Spot")}},Auto:{get:function(){return Al.J("Auto")}},Table:{get:function(){return Al.J("Table")}},Viewbox:{
get:function(){return Al.J("Viewbox")}},TableRow:{get:function(){return Al.J("TableRow")}},TableColumn:{get:function(){return Al.J("TableColumn")}},Link:{get:function(){return Al.J("Link")}},Grid:{get:function(){return Al.J("Grid")}},Graduated:{get:function(){return Al.J("Graduated")}}});X.prototype.findItemPanelForData=X.prototype.ex;
X.prototype.rebuildItemElements=X.prototype.kt;X.prototype.updateTargetBindings=X.prototype.Ea;X.prototype.copyTemplate=X.prototype.sy;X.prototype.graduatedValueForPoint=X.prototype.ez;X.prototype.graduatedPointForValue=X.prototype.dz;X.prototype.findColumnForLocalX=X.prototype.Ey;X.prototype.findRowForLocalY=X.prototype.My;X.prototype.removeColumnDefinition=X.prototype.uv;X.prototype.removeRowDefinition=X.prototype.wv;X.prototype.removeAt=X.prototype.mb;X.prototype.remove=X.prototype.remove;
X.prototype.insertAt=X.prototype.Ib;X.prototype.elt=X.prototype.N;X.prototype.add=X.prototype.add;X.prototype.findObject=X.prototype.$a;X.prototype.findInVisualTree=X.prototype.Wl;X.prototype.walkVisualTreeFrom=X.prototype.wm;X.prototype.findMainElement=X.prototype.zb;var $m=!1,an=null,Al=new Lb;X.className="Panel";X.definePanelLayout=dn;dn("Position",new jm);dn("Vertical",new mm);dn("Auto",new om);dn("Link",new ym);dn("Grid",new xm);
function Oj(){mb(this);this.Zf=null;this.zr=!0;this.Sa=0;this.Oc=NaN;this.Wg=0;this.Vg=Infinity;this.wb=Ed;this.sa=this.ka=0;this.bb=null;this.lp=en;this.te=Jk;this.hp=this.bg=null;this.ip=NaN;this.ib=this.Ej=null;this.en=!1}
Oj.prototype.copy=function(){var a=new Oj;a.zr=this.zr;a.Sa=this.Sa;a.Oc=this.Oc;a.Wg=this.Wg;a.Vg=this.Vg;a.wb=this.wb;a.ka=this.ka;a.sa=this.sa;a.te=this.te;a.lp=this.lp;null===this.bg?a.bg=null:a.bg=this.bg.I();a.hp=this.hp;a.ip=this.ip;a.Ej=null;null!==this.Ej&&(a.separatorDashArray=Ga(this.separatorDashArray));a.ib=this.ib;a.en=this.en;a.bb=this.bb;return a};t=Oj.prototype;
t.Tl=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.bg=null===a.separatorPadding?null:a.separatorPadding.I();this.separatorStroke=a.separatorStroke;this.separatorStrokeWidth=a.separatorStrokeWidth;this.Ej=null;a.separatorDashArray&&(this.Ej=Ga(a.separatorDashArray));this.background=a.background;this.coversSeparators=a.coversSeparators;this.bb=a.bb};
t.fb=function(a){a.classType===Oj&&(this.sizing=a)};t.toString=function(){return"RowColumnDefinition "+(this.isRow?"(Row ":"(Column ")+this.index+") #"+Bb(this)};t.Qi=function(a){this.Zf=a};
t.Ku=function(){var a=0,b=0,c=this.Zf,d=this.isRow;if(null!==c&&c.type===X.Table)for(var e=d?c.sb.length:c.nb.length,f=0;f<e;f++){var g=d?c.sb[f]:c.nb[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.bg;if(null===b)if(null!==c)b=
c.defaultSeparatorPadding;else return a;return a+(this.isRow?b.top:b.left)};
t.tc=function(){var a=0,b=this.Zf,c=0,d=this.isRow;if(null!==b&&b.type===X.Table)for(var e=d?b.sb.length:b.nb.length,f=0;f<e;f++){var g=d?b.sb[f]:b.nb[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.bg;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.yb=function(a,b,c){var d=this.Zf;if(null!==d&&(d.ab(af,a,this,b,c,void 0,void 0),null!==this.bb&&(b=d.diagram,null!==b&&!b.skipsModelSourceBindings&&(d=d.Ei(),null!==d&&(b=d.data,null!==b)))))for(c=this.bb.iterator;c.next();)c.value.rq(this,b,a,d)};function sm(a){if(a.sizing===en){var b=a.Zf;return a.isRow?b.rowSizing:b.columnSizing}return a.sizing}
t.bind=function(a){a.Pd=this;var b=this.panel;if(null!==b){var c=b.Ei();null!==c&&wl(c)&&A("Cannot add a Binding to a RowColumnDefinition that is already frozen: "+a+" on "+b)}null===this.bb&&(this.bb=new E);this.bb.add(a)};
pa.Object.defineProperties(Oj.prototype,{panel:{get:function(){return this.Zf}},isRow:{get:function(){return this.zr},set:function(a){this.zr=a}},index:{get:function(){return this.Sa},set:function(a){this.Sa=a}},height:{get:function(){return this.Oc},set:function(a){var b=this.Oc;b!==a&&(0>a&&xa(a,">= 0",Oj,"height"),this.Oc=a,this.actual=this.ka,null!==this.panel&&this.panel.o(),
this.yb("height",b,a))}},width:{get:function(){return this.Oc},set:function(a){var b=this.Oc;b!==a&&(0>a&&xa(a,">= 0",Oj,"width"),this.Oc=a,this.actual=this.ka,null!==this.panel&&this.panel.o(),this.yb("width",b,a))}},minimum:{get:function(){return this.Wg},set:function(a){var b=this.Wg;b!==a&&((0>a||!isFinite(a))&&xa(a,">= 0",Oj,"minimum"),this.Wg=a,this.actual=this.ka,null!==this.panel&&this.panel.o(),this.yb("minimum",b,a))}},maximum:{
get:function(){return this.Vg},set:function(a){var b=this.Vg;b!==a&&(0>a&&xa(a,">= 0",Oj,"maximum"),this.Vg=a,this.actual=this.ka,null!==this.panel&&this.panel.o(),this.yb("maximum",b,a))}},alignment:{get:function(){return this.wb},set:function(a){var b=this.wb;b.A(a)||(this.wb=a.I(),null!==this.panel&&this.panel.o(),this.yb("alignment",b,a))}},stretch:{get:function(){return this.te},set:function(a){var b=this.te;b!==a&&(this.te=
a,null!==this.panel&&this.panel.o(),this.yb("stretch",b,a))}},separatorPadding:{get:function(){return this.bg},set:function(a){"number"===typeof a&&(a=new Ic(a));var b=this.bg;null!==a&&null!==b&&b.A(a)||(null!==a&&(a=a.I()),this.bg=a,null!==this.panel&&this.panel.o(),this.yb("separatorPadding",b,a))}},separatorStroke:{get:function(){return this.hp},set:function(a){var b=this.hp;b!==a&&(null===a||"string"===typeof a||a instanceof hl)&&(a instanceof
hl&&a.freeze(),this.hp=a,null!==this.panel&&this.panel.o(),this.yb("separatorStroke",b,a))}},separatorStrokeWidth:{get:function(){return this.ip},set:function(a){var b=this.ip;b!==a&&(this.ip=a,null!==this.panel&&this.panel.o(),this.yb("separatorStrokeWidth",b,a))}},separatorDashArray:{get:function(){return this.Ej},set:function(a){var b=this.Ej;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)||A("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.Ej=a;null!==this.panel&&this.panel.R();this.yb("separatorDashArray",b,a)}}},background:{get:function(){return this.ib},set:function(a){var b=this.ib;b!==a&&(null===a||"string"===typeof a||a instanceof hl)&&(a instanceof hl&&a.freeze(),this.ib=a,null!==this.panel&&this.panel.R(),this.yb("background",b,a))}},coversSeparators:{
get:function(){return this.en},set:function(a){var b=this.en;b!==a&&(this.en=a,null!==this.panel&&this.panel.R(),this.yb("coversSeparators",b,a))}},sizing:{get:function(){return this.lp},set:function(a){var b=this.lp;b!==a&&(this.lp=a,null!==this.panel&&this.panel.o(),this.yb("sizing",b,a))}},actual:{get:function(){return this.ka},set:function(a){this.ka=isNaN(this.Oc)?Math.max(Math.min(this.Vg,a),this.Wg):Math.max(Math.min(this.Vg,
this.Oc),this.Wg)}},total:{get:function(){return this.ka+this.tc()},set:function(a){this.ka=isNaN(this.Oc)?Math.max(Math.min(this.Vg,a),this.Wg):Math.max(Math.min(this.Vg,this.Oc),this.Wg);this.ka=Math.max(0,this.ka-this.tc())}},position:{get:function(){return this.sa},set:function(a){this.sa=a}}});Oj.prototype.bind=Oj.prototype.bind;Oj.prototype.computeEffectiveSpacing=Oj.prototype.tc;Oj.prototype.computeEffectiveSpacingTop=Oj.prototype.Ku;
var en=new D(Oj,"Default",0),tm=new D(Oj,"None",1),Jm=new D(Oj,"ProportionalExtra",2);Oj.className="RowColumnDefinition";Oj.Default=en;Oj.None=tm;Oj.ProportionalExtra=Jm;function W(){Y.call(this);this.Od=this.qa=null;this.Rk="None";this.Dn=Jk;this.Gc=this.Sk="black";this.gh=1;this.Fl="butt";this.Gl="miter";this.Gj=10;this.eh=null;this.fh=0;this.df=this.cf=Ed;this.Io=this.Ho=NaN;this.Nn=!1;this.Ko=null;this.Uk=this.Ml="None";this.Cd=1;this.Bd=0;this.zd=1;this.Ad=null}oa(W,Y);
W.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.qa=this.qa;a.Rk=this.Rk;a.Dn=this.Dn;a.Od=this.Od;a.Sk=this.Sk;a.Gc=this.Gc;a.gh=this.gh;a.Fl=this.Fl;a.Gl=this.Gl;a.Gj=this.Gj;null!==this.eh&&(a.eh=Ga(this.eh));a.fh=this.fh;a.cf=this.cf.I();a.df=this.df.I();a.Ho=this.Ho;a.Io=this.Io;a.Nn=this.Nn;a.Ko=this.Ko;a.Ml=this.Ml;a.Uk=this.Uk;a.Cd=this.Cd;a.Bd=this.Bd;a.zd=this.zd;a.Ad=this.Ad};t=W.prototype;
t.fb=function(a){a===Yg||a===$g||a===Mk||a===Jk?this.geometryStretch=a:Y.prototype.fb.call(this,a)};t.toString=function(){return"Shape("+("None"!==this.figure?this.figure:"None"!==this.toArrow?this.toArrow:this.fromArrow)+")#"+Bb(this)};
function fn(a,b,c,d){var e=c.length;if(!(4>e)){var f=d.measuredBounds,g=Math.max(1,f.width);f=f.height;for(var h=c[0],k=c[1],l,m,n,p,q,r,u=0,x=Ka(),v=2;v<e;v+=2)l=c[v],m=c[v+1],n=l-h,h=m-k,0===n&&(n=.001),p=h/n,q=Math.atan2(h,n),r=Math.sqrt(n*n+h*h),x.push([n,q,p,r]),u+=r,h=l,k=m;h=c[0];k=c[1];n=d.measuredBounds.width;d instanceof W&&(n-=d.strokeWidth);1>n&&(n=1);e=c=n;l=g/2;m=0===l?!1:!0;v=0;r=x[v];n=r[0];q=r[1];p=r[2];r=r[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){Oa(x);return}e>r?(y=e-r,e=r):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(q);a.translate(-(g/2),-(f/2));0===y&&d.Ai(a,b);a.translate(g/2,f/2);a.rotate(-q);a.translate(-h,-k);u-=e;r-=e;if(0!==y){v++;if(v===x.length){Oa(x);return}r=x[v];n=r[0];q=r[1];p=r[2];r=r[3];e=y}}Oa(x)}}
t.Ai=function(a,b){var c=this.Gc,d=this.Sk;if(null!==c||null!==d){var e=this.actualBounds,f=this.naturalBounds;null!==d&&hi(this,a,d,!0,!1,f,e);null!==c&&hi(this,a,c,!1,!1,f,e);e=this.part;f=this.gh;0===f&&null!==e&&(f=e instanceof pf&&e.type===X.Link&&"Selection"===e.category&&e.adornedObject instanceof W&&e.adornedPart.zb()===e.adornedObject?e.adornedObject.strokeWidth:0);a.lineWidth=f;a.lineJoin=this.Gl;a.lineCap=this.Fl;a.miterLimit=this.Gj;var g=!1;e&&b.Ce("drawShadows")&&(g=e.isShadowed);var h=
!0;null!==c&&null===d&&(h=!1);e=!1;var k=this.strokeDashArray;null!==k&&(e=!0,a.Ls(k,this.fh));var l=this.qa;if(null!==l){if(l.type===ge)a.beginPath(),a.moveTo(l.startX,l.startY),a.lineTo(l.endX,l.endY),null!==d&&a.Sd(d),0!==f&&null!==c&&a.Ui();else if(l.type===ke){var m=l.startX,n=l.startY,p=l.endX,q=l.endY;k=Math.min(m,p);l=Math.min(n,q);m=Math.abs(p-m);n=Math.abs(q-n);null!==d&&(a.beginPath(),a.rect(k,l,m,n),a.Sd(d));null!==c&&(p=d=c=0,h&&g&&(c=a.shadowOffsetX,d=a.shadowOffsetY,p=a.shadowBlur,
a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0),0!==f&&(a.beginPath(),a.rect(k,l,m,n),a.Ui()),h&&g&&(a.shadowOffsetX=c,a.shadowOffsetY=d,a.shadowBlur=p))}else if(l.type===le)n=l.startX,k=l.startY,p=l.endX,q=l.endY,l=Math.abs(p-n)/2,m=Math.abs(q-k)/2,n=Math.min(n,p)+l,k=Math.min(k,q)+m,a.beginPath(),a.moveTo(n,k-m),a.bezierCurveTo(n+H.wg*l,k-m,n+l,k-H.wg*m,n+l,k),a.bezierCurveTo(n+l,k+H.wg*m,n+H.wg*l,k+m,n,k+m),a.bezierCurveTo(n-H.wg*l,k+m,n-l,k+H.wg*m,n-l,k),a.bezierCurveTo(n-l,k-H.wg*m,n-H.wg*
l,k-m,n,k-m),a.closePath(),null!==d&&a.Sd(d),0!==f&&null!==c&&(h&&g?(f=a.shadowOffsetX,g=a.shadowOffsetY,c=a.shadowBlur,a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0,a.Ui(),a.shadowOffsetX=f,a.shadowOffsetY=g,a.shadowBlur=c):a.Ui());else if(l.type===ae)for(k=l.figures,l=k.length,m=0;m<l;m++){n=k.j[m];a.beginPath();a.moveTo(n.startX,n.startY);p=n.segments.j;q=p.length;for(var r=null,u=0;u<q;u++){var x=p[u];switch(x.type){case ze:a.moveTo(x.endX,x.endY);break;case ie:a.lineTo(x.endX,x.endY);break;
case Ae:a.bezierCurveTo(x.point1X,x.point1Y,x.point2X,x.point2Y,x.endX,x.endY);break;case Be:a.quadraticCurveTo(x.point1X,x.point1Y,x.endX,x.endY);break;case Ce:if(x.radiusX===x.radiusY){var v=Math.PI/180;a.arc(x.point1X,x.point1Y,x.radiusX,x.startAngle*v,(x.startAngle+x.sweepAngle)*v,0>x.sweepAngle,null!==r?r.endX:n.startX,null!==r?r.endY:n.startY)}else if(r=Ee(x,n),v=r.length,0===v)a.lineTo(x.centerX,x.centerY);else for(var y=0;y<v;y++){var z=r[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 De:y=v=0;if(null!==r&&r.type===Ce){r=Ee(r,n);z=r.length;if(0===z){a.lineTo(x.centerX,x.centerY);break}r=r[z-1]||null;null!==r&&(v=r[6],y=r[7])}else v=null!==r?r.endX:n.startX,y=null!==r?r.endY:n.startY;r=Fe(x,n,v,y);v=r.length;if(0===v){a.lineTo(x.centerX,x.centerY);break}for(y=0;y<v;y++)z=r[y],a.bezierCurveTo(z[2],z[3],z[4],z[5],z[6],z[7]);break;default:A("Segment not of valid type: "+x.type)}x.isClosed&&a.closePath();r=x}g?(u=q=p=0,n.isShadowed?(!0===n.isFilled&&
null!==d?(a.Sd(d),h=!0):h=!1,0!==f&&null!==c&&(h&&(p=a.shadowOffsetX,q=a.shadowOffsetY,u=a.shadowBlur,a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0),a.Ui(),h&&(a.shadowOffsetX=p,a.shadowOffsetY=q,a.shadowBlur=u))):(h&&(p=a.shadowOffsetX,q=a.shadowOffsetY,u=a.shadowBlur,a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0),!0===n.isFilled&&null!==d&&a.Sd(d),0!==f&&null!==c&&a.Ui(),h&&(a.shadowOffsetX=p,a.shadowOffsetY=q,a.shadowBlur=u))):(!0===n.isFilled&&null!==d&&a.Sd(d),0!==f&&null!==c&&a.Ui())}e&&
a.Js();if(null!==this.pathPattern){e=this.pathPattern;e.measure(Infinity,Infinity);f=e.measuredBounds;e.arrange(0,0,f.width,f.height);g=this.geometry;a.save();a.beginPath();f=Ka();if(g.type===ge)f.push(g.startX),f.push(g.startY),f.push(g.endX),f.push(g.endY),fn(a,b,f,e);else if(g.type===ae)for(g=g.figures.iterator;g.next();){c=g.value;f.length=0;f.push(c.startX);f.push(c.startY);d=c.startX;h=c.startY;k=d;l=h;m=c.segments.j;n=m.length;for(p=0;p<n;p++){q=m[p];switch(q.type){case ze:fn(a,b,f,e);f.length=
0;f.push(q.endX);f.push(q.endY);d=q.endX;h=q.endY;k=d;l=h;break;case ie:f.push(q.endX);f.push(q.endY);d=q.endX;h=q.endY;break;case Ae:H.ye(d,h,q.point1X,q.point1Y,q.point2X,q.point2Y,q.endX,q.endY,.5,f);d=q.endX;h=q.endY;break;case Be:H.gq(d,h,q.point1X,q.point1Y,q.endX,q.endY,.5,f);d=q.endX;h=q.endY;break;case Ce:u=Ee(q,c);x=u.length;if(0===x){f.push(q.centerX);f.push(q.centerY);d=q.centerX;h=q.centerY;break}for(r=0;r<x;r++)v=u[r],H.ye(d,h,v[2],v[3],v[4],v[5],v[6],v[7],.5,f),d=v[6],h=v[7];break;
case De:u=Fe(q,c,d,h);x=u.length;if(0===x){f.push(q.centerX);f.push(q.centerY);d=q.centerX;h=q.centerY;break}for(r=0;r<x;r++)v=u[r],H.ye(d,h,v[2],v[3],v[4],v[5],v[6],v[7],.5,f),d=v[6],h=v[7];break;default:A("Segment not of valid type: "+q.type)}q.isClosed&&(f.push(k),f.push(l),fn(a,b,f,e))}fn(a,b,f,e)}else if(g.type===ke)f.push(g.startX),f.push(g.startY),f.push(g.endX),f.push(g.startY),f.push(g.endX),f.push(g.endY),f.push(g.startX),f.push(g.endY),f.push(g.startX),f.push(g.startY),fn(a,b,f,e);else if(g.type===
le){h=new Ue;h.startX=g.endX;h.startY=(g.startY+g.endY)/2;d=new Ve(Ce);d.startAngle=0;d.sweepAngle=360;d.centerX=(g.startX+g.endX)/2;d.centerY=(g.startY+g.endY)/2;d.radiusX=Math.abs(g.startX-g.endX)/2;d.radiusY=Math.abs(g.startY-g.endY)/2;h.add(d);g=Ee(d,h);c=g.length;if(0===c)f.push(d.centerX),f.push(d.centerY);else for(d=h.startX,h=h.startY,k=0;k<c;k++)l=g[k],H.ye(d,h,l[2],l[3],l[4],l[5],l[6],l[7],.5,f),d=l[6],h=l[7];fn(a,b,f,e)}Oa(f);a.restore();a.Qc(!1)}}}};
t.ma=function(a,b){void 0===b&&(b=new G);if(a instanceof O){a.kc()&&A("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.rd.ta(b);return b};
t.Sp=function(a){void 0===a&&(a=new L);var b=this.naturalBounds,c=this.rd;b=L.allocAt(b.x,b.y,b.width,b.height);var d=this.strokeWidth;b.Tc(d/2,d/2);d=G.allocAt(b.x,b.y).transform(c);a.h(d.x,d.y,0,0);d.h(b.right,b.y).transform(c);Bc(a,d.x,d.y,0,0);d.h(b.right,b.bottom).transform(c);Bc(a,d.x,d.y,0,0);d.h(b.x,b.bottom).transform(c);Bc(a,d.x,d.y,0,0);L.free(b);G.free(d);return a};
t.sh=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!==ge||b||(e+=2);var f=L.alloc();f.assign(d);f.Tc(e+2,e+2);if(!f.ea(a))return L.free(f),!1;d=e+1E-4;if(c.type===ge){if(null===this.stroke)return!1;d=(c.endX-c.startX)*(a.x-c.startX)+(c.endY-c.startY)*(a.y-c.startY);if(0>(c.startX-c.endX)*(a.x-c.endX)+(c.startY-c.endY)*(a.y-c.endY)||0>d)return!1;L.free(f);return H.Tb(c.startX,c.startY,c.endX,c.endY,e,a.x,a.y)}if(c.type===
ke){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.Tc(-d,-d);if(f.ea(a))return L.free(f),!1;f.Tc(d,d)}null!==this.stroke&&f.Tc(e,e);a=f.ea(a);L.free(f);return a}if(c.type===le){g=c.startX;e=c.startY;h=c.endX;var k=c.endY;c=Math.min(g,h);b=Math.min(e,k);g=Math.abs(h-g)/2;e=Math.abs(k-e)/2;c=a.x-(c+g);b=a.y-(b+e);if(null===this.fill){g-=d;e-=d;if(0>=g||0>=e||1>=c*c/(g*g)+b*b/(e*e))return L.free(f),!1;
g+=d;e+=d}null!==this.stroke&&(g+=d,e+=d);L.free(f);return 0>=g||0>=e?!1:1>=c*c/(g*g)+b*b/(e*e)}if(c.type===ae)return L.free(f),null===this.fill?Se(c,a.x,a.y,e):c.ea(a,e,1<this.strokeWidth,b);A("Unknown Geometry type: "+c.type);return!1};
t.fm=function(a,b,c,d){var e=this.desiredSize,f=this.gh;a=Math.max(a,0);b=Math.max(b,0);if(null!==this.Od)var g=this.geometry.bounds;else{var h=this.figure,k=gn[h];if(void 0===k){var l=H.Ie[h];"string"===typeof l&&(l=H.Ie[l]);"function"===typeof l?(k=l(null,100,100),gn[h]=k):A("Unsupported Figure: "+h)}g=k.bounds}h=g.width;k=g.height;l=g.width;var m=g.height;switch(Zk(this,!0)){case Yg:d=c=0;break;case be:l=Math.max(a-f,0);m=Math.max(b-f,0);break;case Kk:l=Math.max(a-f,0);d=0;break;case Lk: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=Zg(this);switch(c){case Yg:break;case be:h=l;k=m;break;case $g:c=Math.min(l/h,m/k);isFinite(c)||(c=1);h*=c;k*=c;break;default:A(c+" is not a valid geometryStretch.")}null!==this.Od?(h=Math.max(h,.01),k=Math.max(k,
.01),g=null!==this.Od?this.Od:this.qa,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.qa=c):null!==this.qa&&H.ca(this.qa.al,a-f)&&H.ca(this.qa.Zk,b-f)||(this.qa=W.makeGeometry(this,h,k));g=this.qa.bounds;Infinity===a||Infinity===b?Wk(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):Wk(this,-(f/2),-(f/2),l+f,m+f)};
function Zg(a){var b=a.geometryStretch;return null!==a.Od?b===Jk?be:b:b===Jk?gn[a.figure].defaultStretch:b}t.qh=function(a,b,c,d){al(this,a,b,c,d)};t.Sc=function(a,b,c){return this.Zj(a.x,a.y,b.x,b.y,c)};
t.Zj=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.gh/2;l=this.qa;null===l&&(this.measure(Infinity,Infinity),l=this.qa);p=l.bounds;m=!1;if(l.type===ge)if(1.5>=this.strokeWidth)m=H.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=Ka();a=new G;H.Ee(l.startX+d,l.startY+m,l.endX+d,l.endY+m,f,g,h,k,a)&&b.push(a);a=new G;H.Ee(l.startX-d,l.startY-m,l.endX-d,l.endY-m,f,g,h,k,a)&&b.push(a);a=new G;H.Ee(l.startX+d,l.startY+m,l.startX-d,l.startY-m,f,g,h,k,a)&&b.push(a);a=new G;H.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 Oa(b),!1;m=!0;k=Infinity;for(d=0;d<h;d++)a=b[d],c=(a.x-f)*(a.x-f)+(a.y-g)*(a.y-g),c<k&&(k=c,e.x=a.x,e.y=a.y);Oa(b)}else if(l.type===ke)m=H.Sc(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===le){b=L.allocAt(p.x,p.y,p.width,p.height).Tc(n,n);a:if(0===b.width)m=H.Ee(b.x,b.y,b.x,b.y+b.height,f,g,h,k,e);else if(0===b.height)m=H.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}L.free(b)}else if(l.type===ae){p=G.alloc();var q=h-f;var r=k-g;var u=q*q+r*r;e.x=h;e.y=k;for(var x=0;x<l.figures.count;x++){var v=l.figures.j[x],y=v.segments;q=v.startX;r=v.startY;for(var z=q,B=r,C=0;C<y.count;C++){var I=
y.j[C],J=I.type;var M=I.endX;var U=I.endY;var Q=!1;switch(J){case ze:z=M;B=U;break;case ie:Q=hn(q,r,M,U,f,g,h,k,p);break;case Ae:Q=H.Jp(q,r,I.point1X,I.point1Y,I.point2X,I.point2Y,M,U,f,g,h,k,.6,p);break;case Be:Q=H.Jp(q,r,(q+2*I.point1X)/3,(r+2*I.point1Y)/3,(2*I.point1X+M)/3,(2*I.point1X+M)/3,M,U,f,g,h,k,.6,p);break;case Ce:case De:J=I.type===Ce?Ee(I,v):Fe(I,v,q,r);var ia=J.length;if(0===ia){Q=hn(q,r,I.centerX,I.centerY,f,g,h,k,p);break}U=null;for(M=0;M<ia;M++){U=J[M];if(0===M&&hn(q,r,U[0],U[1],
f,g,h,k,p)){var ja=mn(f,g,p,u,e);ja<u&&(u=ja,m=!0)}H.Jp(U[0],U[1],U[2],U[3],U[4],U[5],U[6],U[7],f,g,h,k,.6,p)&&(ja=mn(f,g,p,u,e),ja<u&&(u=ja,m=!0))}M=U[6];U=U[7];break;default:A("Unknown Segment type: "+J)}q=M;r=U;Q&&(Q=mn(f,g,p,u,e),Q<u&&(u=Q,m=!0));I.isClosed&&(M=z,U=B,hn(q,r,M,U,f,g,h,k,p)&&(I=mn(f,g,p,u,e),I<u&&(u=I,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;G.free(p)}else A("Unknown Geometry type: "+l.type);if(!m)return!1;this.transform.ta(e);return!0};
function mn(a,b,c,d,e){a=c.x-a;b=c.y-b;b=a*a+b*b;return b<d?(e.x=c.x,e.y=c.y,b):d}function hn(a,b,c,d,e,f,g,h,k){var l=!1,m=(e-g)*(b-d)-(f-h)*(a-c);if(0===m)return!1;k.x=((e*h-f*g)*(a-c)-(e-g)*(a*d-b*c))/m;k.y=((e*h-f*g)*(b-d)-(f-h)*(a*d-b*c))/m;(a>c?a-c:c-a)<(b>d?b-d:d-b)?(a=b<d?b:d,b=b<d?d:b,(k.y>a||H.ca(k.y,a))&&(k.y<b||H.ca(k.y,b))&&(l=!0)):(b=a<c?a:c,a=a<c?c:a,(k.x>b||H.ca(k.x,b))&&(k.x<a||H.ca(k.x,a))&&(l=!0));return l}
t.rh=function(a,b){if(void 0===b)return a.mf(this.actualBounds);var c=this.qa;null===c&&(this.measure(Infinity,Infinity),c=this.qa);c=c.bounds;var d=this.strokeWidth/2,e=!1,f=G.alloc();f.h(c.x-d,c.y-d);a.ea(b.ta(f))&&(f.h(c.x-d,c.bottom+d),a.ea(b.ta(f))&&(f.h(c.right+d,c.bottom+d),a.ea(b.ta(f))&&(f.h(c.right+d,c.y-d),a.ea(b.ta(f))&&(e=!0))));G.free(f);return e};
t.Ic=function(a,b){if(this.rh(a,b)||void 0===b&&(b=this.transform,a.mf(this.actualBounds)))return!0;var c=Qc.alloc();c.set(b);c.Zs();var d=a.left,e=a.right,f=a.top;a=a.bottom;var g=G.alloc();g.h(d,f);c.ta(g);if(this.sh(g,!0))return G.free(g),!0;g.h(e,f);c.ta(g);if(this.sh(g,!0))return G.free(g),!0;g.h(d,a);c.ta(g);if(this.sh(g,!0))return G.free(g),!0;g.h(e,a);c.ta(g);if(this.sh(g,!0))return G.free(g),!0;var h=G.alloc(),k=G.alloc();c.set(b);c.iv(this.transform);c.Zs();h.x=e;h.y=f;h.transform(c);g.x=
d;g.y=f;g.transform(c);b=!1;nn(this,g,h,k)?b=!0:(g.x=e,g.y=a,g.transform(c),nn(this,g,h,k)?b=!0:(h.x=d,h.y=a,h.transform(c),nn(this,g,h,k)?b=!0:(g.x=d,g.y=f,g.transform(c),nn(this,g,h,k)&&(b=!0))));G.free(g);Qc.free(c);G.free(h);G.free(k);return b};function nn(a,b,c,d){if(!a.Sc(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.gx=function(a,b,c){function d(a,b){for(var c=a.length,d=0;d<c;d+=2)if(b.cd(a[d],a[d+1])>e)return!0;return!1}if(c&&null!==this.fill&&this.sh(a,!0))return!0;var e=a.Ae(b),f=e;1.5<this.strokeWidth&&(e=this.strokeWidth/2+Math.sqrt(e),e*=e);b=this.qa;if(null===b&&(this.measure(Infinity,Infinity),b=this.qa,null===b))return!1;if(!c){var g=b.bounds,h=g.x,k=g.y,l=g.x+g.width;g=g.y+g.height;if(Sb(a.x,a.y,h,k)<=e&&Sb(a.x,a.y,l,k)<=e&&Sb(a.x,a.y,h,g)<=e&&Sb(a.x,a.y,l,g)<=e)return!0}h=b.startX;k=b.startY;l=
b.endX;g=b.endY;if(b.type===ge){if(c=(h-l)*(a.x-l)+(k-g)*(a.y-g),Rb(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===ke)return b=!1,c&&(b=Rb(a.x,a.y,h,k,h,g)<=e||Rb(a.x,a.y,h,k,l,k)<=e||Rb(a.x,a.y,l,k,l,g)<=e||Rb(a.x,a.y,h,g,l,g)<=e),b;if(b.type===le){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 Rb(a.x,a.y,h,k,l,g)<=e?!0:!1;if(c){if(a=H.yy(m,n,b,f),a*a<=e)return!0}else return Sb(b,f,-m,0)>=e||Sb(b,f,0,-n)>=e||Sb(b,
f,0,n)>=e||Sb(b,f,m,0)>=e?!1:!0}else if(b.type===ae){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&&Rb(a.x,a.y,f,h,f,l)>e&&Rb(a.x,a.y,f,h,k,h)>e&&Rb(a.x,a.y,k,l,f,l)>e&&Rb(a.x,a.y,k,l,k,h)>e)return!1;f=Math.sqrt(e);if(c){if(null===this.fill?Se(b,a.x,a.y,f):b.ea(a,f,!0))return!0}else{c=b.figures;for(b=0;b<c.count;b++){f=c.j[b];g=f.startX;m=f.startY;if(a.cd(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 ze:case ie:g=n.endX;m=
n.endY;if(a.cd(g,m)>e)return!1;break;case Ae:var p=Ka();H.ye(g,m,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.8,p);g=d(p,a);Oa(p);if(g)return!1;g=n.endX;m=n.endY;if(a.cd(g,m)>e)return!1;break;case Be:p=Ka();H.gq(g,m,n.point1X,n.point1Y,n.endX,n.endY,.8,p);g=d(p,a);Oa(p);if(g)return!1;g=n.endX;m=n.endY;if(a.cd(g,m)>e)return!1;break;case Ce:case De:p=n.type===Ce?Ee(n,f):Fe(n,f,g,m);var q=p.length;if(0===q){g=n.centerX;m=n.centerY;if(a.cd(g,m)>e)return!1;break}n=null;for(var r=Ka(),u=0;u<q;u++)if(n=
p[u],r.length=0,H.ye(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],.8,r),d(r,a))return Oa(r),!1;Oa(r);null!==n&&(g=n[6],m=n[7]);break;default:A("Unknown Segment type: "+n.type)}}return!0}}}return!1};t.bc=function(){this.qa=null};function on(a){var b=a.diagram;null!==b&&b.undoManager.isUndoingRedoing||(a.segmentOrientation=pn,"None"!==a.Ml?(a.segmentIndex=-1,a.alignmentFocus=Sd):"None"!==a.Uk&&(a.segmentIndex=0,a.alignmentFocus=new O(1-Sd.x,Sd.y)))}
W.makeGeometry=function(a,b,c){if("None"!==a.toArrow)var d=qn[a.toArrow];else"None"!==a.fromArrow?d=qn[a.fromArrow]:(d=H.Ie[a.figure],"string"===typeof d&&(d=H.Ie[d]),void 0===d&&A("Unknown Shape.figure: "+a.figure),d=d(a,b,c),d.al=b,d.Zk=c);if(null===d){var e=H.Ie.Rectangle;"function"===typeof e&&(d=e(a,b,c))}return d};
function rn(a){var b=qn[a];if(void 0===b){var c=a.toLowerCase();if("none"===c)return"None";b=qn[c];if(void 0===b){var d=null,e;for(e in H.zm)if(e.toLowerCase()===c){d=e;break}if(null!==d)return a=me(H.zm[d],!1),qn[d]=a,c!==d&&(qn[c]=d),d}}return"string"===typeof b?b:b instanceof $d?a:null}
pa.Object.defineProperties(W.prototype,{geometry:{get:function(){return null!==this.qa?this.qa:this.Od},set:function(a){var b=this.qa;if(b!==a){null!==a?this.Od=this.qa=a.freeze():this.Od=this.qa=null;var c=this.part;null!==c&&(c.Ug=NaN);this.o();this.g("geometry",b,a);Tk(this)&&(a=this.part,null!==a&&Uk(this,a,"geometryString"))}}},geometryString:{get:function(){return null===this.geometry?"":this.geometry.toString()},set:function(a){a=
me(a);var b=a.normalize();this.geometry=a;this.position=a=G.allocAt(-b.x,-b.y);G.free(a)}},isGeometryPositioned:{get:function(){return this.Nn},set:function(a){var b=this.Nn;b!==a&&(this.Nn=a,this.o(),this.g("isGeometryPositioned",b,a))}},fill:{get:function(){return this.Sk},set:function(a){var b=this.Sk;b!==a&&(a instanceof hl&&a.freeze(),this.Sk=a,this.R(),this.g("fill",b,a))}},stroke:{get:function(){return this.Gc},
set:function(a){var b=this.Gc;b!==a&&(a instanceof hl&&a.freeze(),this.Gc=a,this.R(),this.g("stroke",b,a))}},strokeWidth:{get:function(){return this.gh},set:function(a){var b=this.gh;if(b!==a)if(0<=a){this.gh=a;this.o();var c=this.part;null!==c&&(c.Ug=NaN);this.g("strokeWidth",b,a)}else xa(a,"value >= 0",W,"strokeWidth:value")}},strokeCap:{get:function(){return this.Fl},set:function(a){var b=this.Fl;b!==a&&("string"!==typeof a||"butt"!==
a&&"round"!==a&&"square"!==a?xa(a,'"butt", "round", or "square"',W,"strokeCap"):(this.Fl=a,this.R(),this.g("strokeCap",b,a)))}},strokeJoin:{get:function(){return this.Gl},set:function(a){var b=this.Gl;b!==a&&("string"!==typeof a||"miter"!==a&&"bevel"!==a&&"round"!==a?xa(a,'"miter", "bevel", or "round"',W,"strokeJoin"):(this.Gl=a,this.R(),this.g("strokeJoin",b,a)))}},strokeMiterLimit:{get:function(){return this.Gj},set:function(a){var b=this.Gj;
if(b!==a&&1<=a){this.Gj=a;this.R();var c=this.part;null!==c&&(c.Ug=NaN);this.g("strokeMiterLimit",b,a)}}},strokeDashArray:{get:function(){return this.eh},set:function(a){var b=this.eh;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)||A("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.eh=a;this.R();this.g("strokeDashArray",b,a)}}},strokeDashOffset:{
get:function(){return this.fh},set:function(a){var b=this.fh;b!==a&&0<=a&&(this.fh=a,this.R(),this.g("strokeDashOffset",b,a))}},figure:{get:function(){return this.Rk},set:function(a){var b=this.Rk;if(b!==a){var c=H.Ie[a];"function"===typeof c?c=a:(c=H.Ie[a.toLowerCase()])||A("Unknown Shape.figure: "+a);b!==c&&(a=this.part,null!==a&&(a.Ug=NaN),this.Rk=c,this.Od=null,this.bc(),this.o(),this.g("figure",b,c))}}},toArrow:{get:function(){return this.Ml},
set:function(a){var b=this.Ml;!0===a?a="Standard":!1===a&&(a="");if(b!==a){var c=rn(a);null===c?A("Unknown Shape.toArrow: "+a):b!==c&&(this.Ml=c,this.Od=null,this.bc(),this.o(),on(this),this.g("toArrow",b,c))}}},fromArrow:{get:function(){return this.Uk},set:function(a){var b=this.Uk;!0===a?a="Standard":!1===a&&(a="");if(b!==a){var c=rn(a);null===c?A("Unknown Shape.fromArrow: "+a):b!==c&&(this.Uk=c,this.Od=null,this.bc(),this.o(),on(this),this.g("fromArrow",b,c))}}},spot1:{
get:function(){return this.cf},set:function(a){var b=this.cf;b.A(a)||(this.cf=a=a.I(),this.o(),this.g("spot1",b,a))}},spot2:{get:function(){return this.df},set:function(a){var b=this.df;b.A(a)||(this.df=a=a.I(),this.o(),this.g("spot2",b,a))}},parameter1:{get:function(){return this.Ho},set:function(a){var b=this.Ho;b!==a&&(this.Ho=a,this.bc(),this.o(),this.g("parameter1",b,a))}},parameter2:{get:function(){return this.Io},
set:function(a){var b=this.Io;b!==a&&(this.Io=a,this.bc(),this.o(),this.g("parameter2",b,a))}},naturalBounds:{get:function(){if(null!==this.qa)return this.hc.assign(this.qa.bounds),this.hc;var a=this.desiredSize;return new L(0,0,a.width,a.height)}},pathPattern:{get:function(){return this.Ko},set:function(a){var b=this.Ko;b!==a&&(this.Ko=a,this.R(),this.g("pathPattern",b,a))}},geometryStretch:{get:function(){return this.Dn},
set:function(a){var b=this.Dn;b!==a&&(this.Dn=a,this.g("geometryStretch",b,a))}},interval:{get:function(){return this.Cd},set:function(a){var b=this.Cd;a=Math.floor(a);if(b!==a&&0<=a){this.Cd=a;var c=this.diagram;null!==c&&this.panel===c.grid&&ij(c);this.o();c=this.panel;null!==c&&(c.Lg=null);this.g("interval",b,a)}}},graduatedStart:{get:function(){return this.Bd},set:function(a){var b=this.Bd;b!==a&&(0>a?a=0:1<a&&(a=1),this.Bd=a,this.o(),
this.g("graduatedStart",b,a))}},graduatedEnd:{get:function(){return this.zd},set:function(a){var b=this.zd;b!==a&&(0>a?a=0:1<a&&(a=1),this.zd=a,this.o(),this.g("graduatedEnd",b,a))}},graduatedSkip:{get:function(){return this.Ad},set:function(a){var b=this.Ad;b!==a&&(this.Ad=a,this.o(),this.g("graduatedSkip",b,a))}}});W.prototype.intersectsRect=W.prototype.Ic;W.prototype.containedInRect=W.prototype.rh;
W.prototype.getNearestIntersectionPoint=W.prototype.Sc;W.prototype.getDocumentBounds=W.prototype.Sp;W.prototype.getDocumentPoint=W.prototype.ma;var qn=new tb,gn=new tb;W.className="Shape";W.getFigureGenerators=function(){var a=new Lb,b;for(b in H.Ie)b!==b.toLowerCase()&&a.add(b,H.Ie[b]);a.freeze();return a};W.defineFigureGenerator=function(a,b){var c=a.toLowerCase(),d=H.Ie;d[a]=b;d[c]=a};
W.getArrowheadGeometries=function(){var a=new Lb;for(d in H.zm)if(void 0===qn[d]){var b=me(H.zm[d],!1);qn[d]=b;b=d.toLowerCase();b!==d&&(qn[b]=d)}for(var c in qn)if(c!==c.toLowerCase()){var d=qn[c];d instanceof $d&&a.add(c,d)}a.freeze();return a};W.defineArrowheadGeometry=function(a,b){var c=null;"string"===typeof b?c=me(b,!1):c=b;b=a.toLowerCase();"none"!==b&&a!==b||A("Shape.defineArrowheadGeometry name must not be empty or None or all-lower-case: "+a);var d=qn;d[a]=c;d[b]=a};
function uh(){Y.call(this);sn||(tn(),sn=!0);this.Ob="";this.Gc="black";this.de="13px sans-serif";this.ti="start";this.yd=Yg;this.yi=Hd;this.lj=!0;this.bi=this.ci=!1;this.Xf=un;this.hg=vn;this.Kr=this.pc=0;this.eu=this.fu=null;this.nd=new Hm;this.xn=!1;this.Cc=this.Um=this.tp=this.ui=this.vp=null;this.bf=this.af=0;this.le=Infinity;this.fl=0;this.Cd=1;this.Bd=0;this.zd=1;this.Ad=this.gj=null}oa(uh,Y);
uh.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.Ob=this.Ob;a.Gc=this.Gc;a.de=this.de;a.ti=this.ti;a.yd=this.yd;a.yi=this.yi;a.lj=this.lj;a.ci=this.ci;a.bi=this.bi;a.Xf=this.Xf;a.hg=this.hg;a.pc=this.pc;a.Kr=this.Kr;a.fu=this.fu;a.eu=this.eu;a.nd.Tl(this.nd);a.xn=this.xn;a.vp=this.vp;a.ui=this.ui;a.tp=this.tp;a.Um=this.Um;a.Cc=this.Cc;a.af=this.af;a.bf=this.bf;a.le=this.le;a.fl=this.fl;a.Cd=this.Cd;a.Bd=this.Bd;a.zd=this.zd;a.gj=this.gj;a.Ad=this.Ad};
function Gm(a,b){a.G=b.G|6144;a.lb=b.opacity;a.ib=b.background;a.dc=b.areaBackground;a.Mc=b.desiredSize.I();a.Of=b.minSize.I();a.Nf=b.maxSize.I();a.Lf=b.Lf.copy();a.Ca=b.scale;a.zc=b.angle;a.te=b.stretch;a.Tg=b.margin.I();a.wb=b.alignment.I();a.tk=b.alignmentFocus.I();a.vl=b.segmentFraction;a.wl=b.segmentOffset.I();a.xl=b.segmentOrientation;null!==b.kd&&(a.kd=b.kd.copy());a.zl=b.shadowVisible;b instanceof uh&&(a.Ob=b.Ob,a.Gc=b.Gc,a.de=b.de,a.ti=b.ti,a.yd=b.yd,a.yi=b.yi,a.lj=b.lj,a.ci=b.ci,a.bi=b.bi,
a.Xf=b.Xf,a.hg=b.hg,a.nd.Gf=null,a.af=b.af,a.bf=b.bf,a.le=b.le,a.fl=b.fl,a.Cd=b.Cd,a.Bd=b.Bd,a.zd=b.zd,a.gj=b.gj,a.Ad=b.Ad)}t=uh.prototype;t.fb=function(a){a.classType===uh?this.wrap=a:Y.prototype.fb.call(this,a)};t.toString=function(){return 22<this.Ob.length?'TextBlock("'+this.Ob.substring(0,20)+'"...)':'TextBlock("'+this.Ob+'")'};t.o=function(){Y.prototype.o.call(this);this.eu=this.fu=null};
t.Ai=function(a,b){if(null!==this.Gc&&0!==this.Ob.length&&null!==this.de){var c=this.naturalBounds,d=this.actualBounds,e=c.width,f=c.height,g=wn(this),h=a.textAlign=this.ti,k=b.Qn;"start"===h?h=k?"right":"left":"end"===h&&(h=k?"left":"right");k=this.ci;var l=this.bi;hi(this,a,this.Gc,!0,!1,c,d);(k||l)&&hi(this,a,this.Gc,!1,!1,c,d);d=0;c=!1;var m=G.allocAt(0,0);this.rd.ta(m);var n=G.allocAt(0,g);this.rd.ta(n);var p=m.Ae(n);G.free(m);G.free(n);m=b.scale;8>p*m*m&&(c=!0);b.Yc!==a&&(c=!1);!1===b.Ce("textGreeking")&&
(c=!1);b=this.af;p=this.bf;switch(this.flip){case Ok:a.translate(e,0);a.scale(-1,1);break;case Nk:a.translate(0,f);a.scale(1,-1);break;case Pk:a.translate(e,f),a.scale(-1,-1)}m=this.pc;n=(b+g+p)*m;f>n&&(d=this.yi,d=d.y*f-d.y*n+d.offsetY);n=this.nd;for(var q=0;q<m;q++){var r=n.Wc[q];r>e&&(r=e);d+=b;var u=n.Ac[q],x=a,v=d,y=h,z=0;if(c)"left"===y?z=0:"right"===y?z=e-r:"center"===y&&(z=(e-r)/2),x.fillRect(0+z,v+.25*g,r,1);else{"left"===y?z=0:"right"===y?z=e:"center"===y&&(z=e/2);var B=null!==xn?xn(this,
g):.75*g;x.fillText(u,0+z,v+B);u=g/20|0;0===u&&(u=1);"right"===y?z-=r:"center"===y&&(z-=r/2);k&&(y=null!==yn?yn(this,g):.8*g,x.beginPath(),x.lineWidth=u,x.moveTo(0+z,v+y),x.lineTo(0+z+r,v+y),x.stroke());l&&(x.beginPath(),x.lineWidth=u,v=v+g-g/2.2|0,0!==u%2&&(v+=.5),x.moveTo(0+z,v),x.lineTo(0+z+r,v),x.stroke())}d+=g+p}switch(this.flip){case Ok:a.scale(-1,1);a.translate(-e,0);break;case Nk:a.scale(1,-1);a.translate(0,-f);break;case Pk:a.scale(-1,-1),a.translate(-e,-f)}}};
t.fm=function(a,b,c,d){this.fl=a;var e=this.de;null!==zn&&An!==e&&(An=zn.font=e);e=this.nd;e.reset();var f;if(isNaN(this.desiredSize.width)){var g=this.Ob.replace(/\r\n/g,"\n").replace(/\r/g,"\n");if(0===g.length)g=0;else if(this.isMultiline){for(var h=f=0,k=!1;!k;){var l=g.indexOf("\n",h);-1===l&&(l=g.length,k=!0);f=Math.max(f,Bn(g.substr(h,l-h).trim()));h=l+1}g=f}else f=g.indexOf("\n",0),0<=f&&(g=g.substr(0,f)),g=Bn(g);g=Math.min(g,a/this.scale);g=Math.max(8,g)}else g=this.desiredSize.width;null!==
this.panel&&(g=Math.min(g,this.panel.maxSize.width));f=Cn(this,g,e);isNaN(this.desiredSize.height)?f=Math.min(f,b/this.scale):f=this.desiredSize.height;h=f;if(0!==e.Ec&&1!==e.Ac.length&&this.Xf===Dn&&(b=this.de,b=this.Xf===Dn?En(b):0,k=this.af+this.bf,k=Math.max(0,wn(this)+k),h=Math.min(this.maxLines-1,Math.max(Math.floor(h/k+.01)-1,0)),!(h+1>=e.Ac.length))){k=e.Ac[h];for(b=Math.max(1,a-b);Bn(k)>b&&1<k.length;)k=k.substr(0,k.length-1);k+=Fn;b=Bn(k);e.Ac[h]=k;e.Ac=e.Ac.slice(0,h+1);e.Wc[h]=b;e.Wc=
e.Wc.slice(0,h+1);e.gg=e.Ac.length;e.Ec=Math.max(e.Ec,b);this.pc=e.gg}if(this.wrap===Gn||isNaN(this.desiredSize.width))g=isNaN(a)?e.Ec:Math.min(a,e.Ec),isNaN(this.desiredSize.width)&&(g=Math.max(8,g));g=Math.max(c,g);f=Math.max(d,f);sc(this.hc,g,f);Wk(this,0,0,g,f)};t.qh=function(a,b,c,d){al(this,a,b,c,d)};
function Hn(a,b,c,d,e){b=b.trim();var f=0;var g=a.de;var h=a.af+a.bf;h=Math.max(0,wn(a)+h);var k=a.Xf===Dn?En(g):0;if(a.pc>=a.le)null!==e&&e.h(0,h);else{var l=b;if(a.hg===In)if(c.gg=1,g=Bn(b),0===k||g<=d)c.Ec=Math.max(c.Ec,g),c.Wc.push(c.Ec),c.Ac.push(b),null!==e&&e.h(g,h);else{f=Jn(a,l);l=l.substr(f.length);b=Jn(a,l);for(g=Bn(f+b);0<b.length&&g<=d;)f+=b,l=l.substr(b.length),b=Jn(a,l),g=Bn((f+b).trim());f+=b.trim();for(d=Math.max(1,d-k);Bn(f)>d&&1<f.length;)f=f.substr(0,f.length-1);f+=Fn;b=Bn(f);
c.Wc.push(b);c.Ec=b;c.Ac.push(f);null!==e&&e.h(b,h)}else{k=0;0===l.length&&(k=1,c.Wc.push(0),c.Ac.push(l));for(;0<l.length;){var m=Jn(a,l);for(l=l.substr(m.length);Bn(m)>d;){var n=1;g=Bn(m.substr(0,n));for(b=0;g<=d;)n++,b=g,g=Bn(m.substr(0,n));1===n?(c.Wc[a.pc+k]=g,f=Math.max(f,g)):(c.Wc[a.pc+k]=b,f=Math.max(f,b));n--;1>n&&(n=1);c.Ac[a.pc+k]=m.substr(0,n);k++;m=m.substr(n);if(a.pc+k>a.le)break}b=Jn(a,l);for(g=Bn(m+b);0<b.length&&g<=d;)m+=b,l=l.substr(b.length),b=Jn(a,l),g=Bn((m+b).trim());m=m.trim();
if(""!==m&&("\u00ad"===m[m.length-1]&&(m=m.substring(0,m.length-1)+"\u2010"),0===b.length?(c.Wc.push(g),f=Math.max(f,g)):(b=Bn(m),c.Wc.push(b),f=Math.max(f,b)),c.Ac.push(m),k++,a.pc+k>a.le))break}c.gg=Math.min(a.le,k);c.Ec=Math.max(c.Ec,f);null!==e&&e.h(c.Ec,h*c.gg)}}}function Jn(a,b){if(a.hg===Kn)return b.substr(0,1);a=b.length;for(var c=0,d=Ln;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 Bn(a){return null===zn?8*a.length:zn.measureText(a).width}function wn(a){if(null!==a.nd.Gf)return a.nd.Gf;var b=a.de;if(null===zn){var c=16;return a.nd.Gf=c}void 0!==Mn[b]&&5E3>Nn?c=Mn[b]:(c=1.3*zn.measureText("M").width,Mn[b]=c,Nn++);return a.nd.Gf=c}function En(a){if(null===zn)return 6;if(void 0!==On[a]&&5E3>Pn)var b=On[a];else b=zn.measureText(Fn).width,On[a]=b,Pn++;return b}
function Cn(a,b,c){var d=a.Ob.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),e=a.af+a.bf;e=Math.max(0,wn(a)+e);if(0===d.length)return c.Ec=0,a.pc=1,e;if(!a.isMultiline){var f=d.indexOf("\n",0);0<=f&&(d=d.substr(0,f))}f=0;for(var g=a.pc=0,h,k=!1;!k;){h=d.indexOf("\n",g);-1===h&&(h=d.length,k=!0);if(g<=h){g=d.substr(g,h-g);if(a.hg!==In){c.gg=0;var l=K.alloc();Hn(a,g,c,b,l);f+=l.height;K.free(l);a.pc+=c.gg}else Hn(a,g,c,b,null),f+=e,a.pc++;a.pc===a.le&&(k=!0)}g=h+1}return a.Kr=f}
function tn(){Ln=/[ \u200b\u00ad]/;Mn=new tb;On=new tb;zn=sh?(new sk(null)).context:null}
pa.Object.defineProperties(uh.prototype,{font:{get:function(){return this.de},set:function(a){var b=this.de;b!==a&&(this.de=a,this.nd.Gf=null,this.o(),this.g("font",b,a))}},text:{get:function(){return this.Ob},set:function(a){var b=this.Ob;null!==a&&void 0!==a?a=a.toString():a="";b!==a&&(this.Ob=a,this.o(),this.g("text",b,a))}},textAlign:{get:function(){return this.ti},set:function(a){var b=this.ti;b===a||"start"!==
a&&"end"!==a&&"left"!==a&&"right"!==a&&"center"!==a||(this.ti=a,this.R(),this.g("textAlign",b,a))}},flip:{get:function(){return this.yd},set:function(a){var b=this.yd;b!==a&&(this.yd=a,this.R(),this.g("flip",b,a))}},verticalAlignment:{get:function(){return this.yi},set:function(a){var b=this.yi;b.A(a)||(this.yi=a=a.I(),ql(this),this.g("verticalAlignment",b,a))}},naturalBounds:{get:function(){if(!this.hc.s()){var a=
K.alloc();Hn(this,this.Ob,this.nd,999999,a);var b=a.width;K.free(a);a=Cn(this,b,this.nd);var c=this.desiredSize;isNaN(c.width)||(b=c.width);isNaN(c.height)||(a=c.height);sc(this.hc,b,a)}return this.hc}},isMultiline:{get:function(){return this.lj},set:function(a){var b=this.lj;b!==a&&(this.lj=a,this.o(),this.g("isMultiline",b,a))}},isUnderline:{get:function(){return this.ci},set:function(a){var b=this.ci;b!==a&&(this.ci=a,this.R(),this.g("isUnderline",
b,a))}},isStrikethrough:{get:function(){return this.bi},set:function(a){var b=this.bi;b!==a&&(this.bi=a,this.R(),this.g("isStrikethrough",b,a))}},wrap:{get:function(){return this.hg},set:function(a){var b=this.hg;b!==a&&(this.hg=a,this.o(),this.g("wrap",b,a))}},overflow:{get:function(){return this.Xf},set:function(a){var b=this.Xf;b!==a&&(this.Xf=a,this.o(),this.g("overflow",b,a))}},stroke:{
get:function(){return this.Gc},set:function(a){var b=this.Gc;b!==a&&(a instanceof hl&&a.freeze(),this.Gc=a,this.R(),this.g("stroke",b,a))}},lineCount:{get:function(){return this.pc}},editable:{get:function(){return this.xn},set:function(a){var b=this.xn;b!==a&&(this.xn=a,this.g("editable",b,a))}},textEditor:{get:function(){return this.vp},set:function(a){var b=this.vp;b!==a&&(this.vp=a,this.g("textEditor",b,
a))}},errorFunction:{get:function(){return this.Cc},set:function(a){var b=this.Cc;b!==a&&(this.Cc=a,this.g("errorFunction",b,a))}},interval:{get:function(){return this.Cd},set:function(a){var b=this.Cd;a=Math.floor(a);if(b!==a&&0<=a){this.Cd=a;this.o();var c=this.panel;null!==c&&(c.Lg=null);this.g("interval",b,a)}}},graduatedStart:{get:function(){return this.Bd},set:function(a){var b=this.Bd;b!==a&&(0>a?a=0:
1<a&&(a=1),this.Bd=a,this.o(),this.g("graduatedStart",b,a))}},graduatedEnd:{get:function(){return this.zd},set:function(a){var b=this.zd;b!==a&&(0>a?a=0:1<a&&(a=1),this.zd=a,this.o(),this.g("graduatedEnd",b,a))}},graduatedFunction:{get:function(){return this.gj},set:function(a){var b=this.gj;b!==a&&(this.gj=a,this.o(),this.g("graduatedFunction",b,a))}},graduatedSkip:{get:function(){return this.Ad},set:function(a){var b=
this.Ad;b!==a&&(this.Ad=a,this.o(),this.g("graduatedSkip",b,a))}},textValidation:{get:function(){return this.ui},set:function(a){var b=this.ui;b!==a&&(this.ui=a,this.g("textValidation",b,a))}},textEdited:{get:function(){return this.tp},set:function(a){var b=this.tp;b!==a&&(this.tp=a,this.g("textEdited",b,a))}},spacingAbove:{get:function(){return this.af},set:function(a){var b=this.af;b!==a&&(this.af=a,this.g("spacingAbove",
b,a))}},spacingBelow:{get:function(){return this.bf},set:function(a){var b=this.bf;b!==a&&(this.bf=a,this.g("spacingBelow",b,a))}},maxLines:{get:function(){return this.le},set:function(a){var b=this.le;b!==a&&(a=Math.floor(a),0>=a&&xa(a,"> 0",uh,"maxLines"),this.le=a,this.g("maxLines",b,a),this.o())}},metrics:{get:function(){return this.nd}},choices:{get:function(){return this.Um},
set:function(a){var b=this.Um;b!==a&&(this.Um=a,this.g("choices",b,a))}}});var xn=null,yn=null,In=new D(uh,"None",0),Gn=new D(uh,"WrapFit",1),vn=new D(uh,"WrapDesiredSize",2),Kn=new D(uh,"WrapBreakAll",3),un=new D(uh,"OverflowClip",0),Dn=new D(uh,"OverflowEllipsis",1),Ln=null,Mn=null,Nn=0,On=null,Pn=0,Fn="...",An="",zn=null,sn=!1;uh.className="TextBlock";uh.getEllipsis=function(){return Fn};uh.setEllipsis=function(a){Fn=a;On=new tb;Pn=0};uh.getBaseline=function(){return xn};
uh.setBaseline=function(a){xn=a;a=Va();for(var b=a.length,c=0;c<b;c++)a[c].zh()};uh.getUnderline=function(){return yn};uh.setUnderline=function(a){yn=a;a=Va();for(var b=a.length,c=0;c<b;c++)a[c].zh()};uh.isValidFont=function(a){sn||(tn(),sn=!0);if(null===zn)return!0;var b=zn.font;if(a===b||"10px sans-serif"===a)return!0;zn.font="10px sans-serif";zn.font=a;var c=zn.font;if("10px sans-serif"!==c)return zn.font=b,!0;zn.font="19px serif";var d=zn.font;zn.font=a;c=zn.font;zn.font=b;return c!==d};
uh.None=In;uh.WrapFit=Gn;uh.WrapDesiredSize=vn;uh.WrapBreakAll=Kn;uh.OverflowClip=un;uh.OverflowEllipsis=Dn;function Hm(){this.Ec=this.gg=0;this.Wc=[];this.Ac=[];this.Gf=null}Hm.prototype.reset=function(){this.Ec=this.gg=0;this.Gf=null;this.Wc=[];this.Ac=[]};Hm.prototype.Tl=function(a){this.gg=a.gg;this.Gf=a.Gf;this.Ec=a.Ec;this.Wc=Ga(a.Wc);this.Ac=Ga(a.Ac)};
pa.Object.defineProperties(Hm.prototype,{arrSize:{get:function(){return this.Wc}},arrText:{get:function(){return this.Ac}},maxLineWidth:{get:function(){return this.Ec}},fontHeight:{get:function(){return this.Gf}}});Hm.className="TextBlockMetrics";
function ak(){Y.call(this);this.Hg=null;this.np="";this.dh=Hc;this.Xk=be;this.ef=this.Cc=null;this.Wk=dd;this.yd=Yg;this.Il=null;this.Yt=!1;this.gr=!0;this.jl=!1;this.Al=null}oa(ak,Y);ak.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.element=this.Hg;a.np=this.np;a.dh=this.dh.I();a.Xk=this.Xk;a.yd=this.yd;a.Cc=this.Cc;a.ef=this.ef;a.Wk=this.Wk.I();a.gr=this.gr;a.Al=this.Al};t=ak.prototype;
t.fb=function(a){a===Yg||a===$g||a===Mk?this.imageStretch=a:Y.prototype.fb.call(this,a)};t.toString=function(){return"Picture("+this.source+")#"+Bb(this)};function ck(a){void 0===a&&(a="");""!==a?Qn[a]&&(delete Qn[a],Rn--):(Qn=new tb,Rn=0)}function Sn(a,b){a.On=!0;a.Vk=!1;for(var c,d=Va(),e=d.length,f=0;f<e;f++){var g=d[f],h=g.Aj.J(a.src);if(null!==h)for(var k=h.length,l=0;l<k;l++)c=h[l],g.ju.add(c),g.cc(),null===a.pu&&(a.pu=b,null!==c.ef&&c.ef(c,b))}}
function Tn(a,b){a.Vk=b;for(var c,d=Va(),e=d.length,f=0;f<e;f++)if(c=d[f].Aj.J(a.src),null!==c){for(var g=c.length,h=Ka(),k=0;k<g;k++)h.push(c[k]);for(k=0;k<g;k++)c=h[k],null!==c.Cc&&c.Cc(c,b);Oa(h)}}
t.Ai=function(a,b){var c=this.Hg;if(null!==c){var d=c.src;null!==d&&""!==d||A('Element has no source ("src") attribute: '+c);if(!(c.Vk instanceof Event)&&!0===c.On){d=this.naturalBounds;var e=0,f=0,g=this.Yt,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.s()&&(e=this.dh.x,f=this.dh.y,h=this.dh.width,g=this.dh.height);var m=h,n=g,
p=this.Xk,q=this.Wk;switch(p){case Yg:if(this.sourceRect.s())break;m>=d.width&&(e=e+q.offsetX+(m*q.x-d.width*q.x));n>=d.height&&(f=f+q.offsetY+(n*q.y-d.height*q.y));h=Math.min(d.width,m);g=Math.min(d.height,n);break;case be:m=d.width;n=d.height;break;case $g:case Mk:p===$g?(p=Math.min(d.height/n,d.width/m),m*=p,n*=p):p===Mk&&(p=Math.max(d.height/n,d.width/m),m*=p,n*=p,m>=d.width&&(e=(e+q.offsetX+(m*q.x-d.width*q.x)/m)*h),n>=d.height&&(f=(f+q.offsetY+(n*q.y-d.height*q.y)/n)*g),h*=1/(m/d.width),g*=
1/(n/d.height),m=d.width,n=d.height)}p=this.Be()*b.scale;var r=h*g/(m*p*n*p),u=Qn[this.source];p=null;var x=Un;if(c.On&&void 0!==u&&r>x*x)for(2>u.Pl.length&&(Vn(u,4,k,l),Vn(u,16,k,l)),k=u.Pl,l=k.length,p=k[0],x=0;x<l;x++)if(k[x].ratio*k[x].ratio<r)p=k[x];else break;if(!b.un){if(null===this.Il)if(null===this.Hg)this.Il=!1;else{k=(new sk(null)).context;k.drawImage(this.Hg,0,0);try{k.getImageData(0,0,1,1).data[3]&&(this.Il=!1),this.Il=!1}catch(v){this.Il=!0}}if(this.Il)return}k=0;m<d.width&&(k=q.offsetX+
(d.width*q.x-m*q.x));l=0;n<d.height&&(l=q.offsetY+(d.height*q.y-n*q.y));switch(this.flip){case Ok:a.translate(Math.min(d.width,m),0);a.scale(-1,1);break;case Nk:a.translate(0,Math.min(d.height,n));a.scale(1,-1);break;case Pk:a.translate(Math.min(d.width,m),Math.min(d.height,n)),a.scale(-1,-1)}if(b.Ce("pictureRatioOptimization")&&!b.kj&&void 0!==u&&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(v){this.gr=!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(v){this.gr=!1}switch(this.flip){case Ok:a.scale(-1,1);a.translate(-Math.min(d.width,m),0);break;case Nk:a.scale(1,-1);a.translate(0,-Math.min(d.height,n));break;case Pk:a.scale(-1,-1),a.translate(-Math.min(d.width,m),-Math.min(d.height,n))}}}}};
t.fm=function(a,b,c,d){var e=this.desiredSize,f=Zk(this,!0),g=this.Hg,h=this.Yt;if(h||!this.jl&&g&&g.complete)this.jl=!0;null===g&&(isFinite(e.width)||(a=0),isFinite(e.height)||(b=0));isFinite(e.width)||f===be||f===Kk?(isFinite(a)||(a=this.sourceRect.s()?this.sourceRect.width:h?+g.width:g.naturalWidth),c=0):null!==g&&!1!==this.jl&&(a=this.sourceRect.s()?this.sourceRect.width:h?+g.width:g.naturalWidth);isFinite(e.height)||f===be||f===Lk?(isFinite(b)||(b=this.sourceRect.s()?this.sourceRect.height:h?
+g.height:g.naturalHeight),d=0):null!==g&&!1!==this.jl&&(b=this.sourceRect.s()?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));sc(this.hc,a,b);Wk(this,0,0,a,b)};t.qh=function(a,b,c,d){al(this,a,b,c,d)};
pa.Object.defineProperties(ak.prototype,{element:{get:function(){return this.Hg},set:function(a){var b=this.Hg;if(b!==a){null===a||a instanceof HTMLImageElement||a instanceof HTMLVideoElement||a instanceof HTMLCanvasElement||A("Picture.element must be an instance of Image, Canvas, or Video, not: "+a);this.Yt=a instanceof HTMLCanvasElement;this.Hg=a;if(null!==a)if(a instanceof HTMLCanvasElement||!0===a.complete)a.Vk instanceof Event&&null!==this.Cc&&this.Cc(this,a.Vk),
!0===a.On&&null!==this.ef&&this.ef(this,a.pu),a.On=!0,this.desiredSize.s()||(hj(this,!1),this.o());else{var c=this;a.vw||(a.addEventListener("load",function(b){Sn(a,b);c.desiredSize.s()||(hj(c,!1),c.o())}),a.addEventListener("error",function(b){Tn(a,b)}),a.vw=!0)}this.g("element",b,a);this.R()}}},source:{get:function(){return this.np},set:function(a){var b=this.np;if(b!==a){this.np=a;var c=Qn,d=this.diagram,e=null;if(void 0!==c[a])e=c[a].Pl[0].source;else{30<Rn&&(ck(),
c=Qn);e=va("img");var f=this;e.addEventListener("load",function(a){Sn(e,a);f.desiredSize.s()||(hj(f,!1),f.o())});e.addEventListener("error",function(a){Tn(e,a)});e.vw=!0;var g=this.Al;null!==g&&(e.crossOrigin=g(this));e.src=a;c[a]=new Wn(e);Rn++}null!==d&&bk(d,this);this.element=e;null!==d&&Wj(d,this);this.o();this.R();this.g("source",b,a)}}},sourceCrossOrigin:{get:function(){return this.Al},set:function(a){if(this.Al!==a&&(this.Al=a,null!==this.element)){var b=this.element.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.dh},set:function(a){var b=this.dh;b.A(a)||(this.dh=a=a.I(),this.R(),this.g("sourceRect",b,a))}},imageStretch:{get:function(){return this.Xk},set:function(a){var b=this.Xk;b!==a&&(this.Xk=a,this.R(),this.g("imageStretch",b,a))}},flip:{get:function(){return this.yd},
set:function(a){var b=this.yd;b!==a&&(this.yd=a,this.R(),this.g("flip",b,a))}},imageAlignment:{get:function(){return this.Wk},set:function(a){var b=this.Wk;b.A(a)||(this.Wk=a=a.I(),this.o(),this.g("imageAlignment",b,a))}},errorFunction:{get:function(){return this.Cc},set:function(a){var b=this.Cc;b!==a&&(this.Cc=a,this.g("errorFunction",b,a))}},successFunction:{get:function(){return this.ef},set:function(a){var b=
this.ef;b!==a&&(this.ef=a,this.g("successFunction",b,a))}},naturalBounds:{get:function(){return this.hc}}});var Qn=null,Rn=0,Un=4;ak.className="Picture";Qn=new tb;ak.clearCache=ck;function Wn(a){this.Pl=[new Xn(a,1)]}function Vn(a,b,c,d){var e=new sk(null),f=e.context,g=1/b;e.width=c/b;e.height=d/b;b=new Xn(e.Ga,b);c=a.Pl[a.Pl.length-1];f.setTransform(g*c.ratio,0,0,g*c.ratio,0,0);f.drawImage(c.source,0,0);a.Pl.push(b)}Wn.className="PictureCacheArray";
function Xn(a,b){this.source=a;this.ratio=b}Xn.className="PictureCacheInstance";function Yn(){this.Rs=new $d;this.ec=null}t=Yn.prototype;t.reset=function(a){null!==a?(this.Rs=a,a.figures.clear()):this.Rs=new $d;this.ec=null};function oe(a,b,c,d,e){a.ec=new Ue;a.ec.startX=b;a.ec.startY=c;a.ec.isFilled=d;a.Rs.figures.add(a.ec);void 0!==e&&(a.ec.isShadowed=e)}function ve(a){var b=a.ec.segments.length;0<b&&a.ec.segments.N(b-1).close()}t.nq=function(a){this.ec.isShadowed=a};
t.moveTo=function(a,b,c){void 0===c&&(c=!1);var d=new Ve(ze);d.endX=a;d.endY=b;c&&d.close();this.ec.segments.add(d)};t.lineTo=function(a,b,c){void 0===c&&(c=!1);var d=new Ve(ie);d.endX=a;d.endY=b;c&&d.close();this.ec.segments.add(d)};function se(a,b,c,d,e,f,g){var h;void 0===h&&(h=!1);var k=new Ve(Ae);k.point1X=b;k.point1Y=c;k.point2X=d;k.point2Y=e;k.endX=f;k.endY=g;h&&k.close();a.ec.segments.add(k)}
function te(a,b,c,d,e){var f;void 0===f&&(f=!1);var g=new Ve(Be);g.point1X=b;g.point1Y=c;g.endX=d;g.endY=e;f&&g.close();a.ec.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 Ve(Ce);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.ec.segments.add(h)};function ue(a,b,c,d,e,f,g,h){var k;void 0===k&&(k=!1);b=new Ve(De,g,h,b,c,d,e,f);k&&b.close();a.ec.segments.add(b)}
function ne(a){var b=we;if(null!==b)return we=null,b.reset(a),b;b=new Yn;b.reset(a);return b}var we=null;Yn.className="StreamGeometryContext";function Zn(a,b){var c=a.toLowerCase(),d=H.Ie;d[a]=b;d[c]=a}Zn("Rectangle",function(a,b,c){a=new $d(ke);a.startX=0;a.startY=0;a.endX=b;a.endY=c;return a});Zn("Square",function(a,b,c){a=new $d(ke);a.startX=0;a.startY=0;a.endX=b;a.endY=c;a.defaultStretch=$g;return a});
Zn("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*H.wg;b=(new $d).add((new Ue(d,0,!0)).add(new Ve(ie,b-d,0)).add(new Ve(Ae,b,d,b-a,0,b,a)).add(new Ve(ie,b,c-d)).add(new Ve(Ae,b-d,c,b,c-a,b-a,c)).add(new Ve(ie,d,c)).add(new Ve(Ae,0,c-d,a,c,0,c-a)).add(new Ve(ie,0,d)).add((new Ve(Ae,d,0,0,a,a,0)).close()));1<a&&(b.spot1=new O(0,0,a,a),b.spot2=new O(1,1,-a,-a));return b});Zn("Border","RoundedRectangle");
Zn("Ellipse",function(a,b,c){a=new $d(le);a.startX=0;a.startY=0;a.endX=b;a.endY=c;a.spot1=Ud;a.spot2=Vd;return a});Zn("Circle",function(a,b,c){a=new $d(le);a.startX=0;a.startY=0;a.endX=b;a.endY=c;a.spot1=Ud;a.spot2=Vd;a.defaultStretch=$g;return a});Zn("TriangleRight",function(a,b,c){return(new $d).add((new Ue(0,0)).add(new Ve(ie,b,.5*c)).add((new Ve(ie,0,c)).close())).vm(0,.25,.5,.75)});
Zn("TriangleDown",function(a,b,c){return(new $d).add((new Ue(0,0)).add(new Ve(ie,b,0)).add((new Ve(ie,.5*b,c)).close())).vm(.25,0,.75,.5)});Zn("TriangleLeft",function(a,b,c){return(new $d).add((new Ue(b,c)).add(new Ve(ie,0,.5*c)).add((new Ve(ie,b,0)).close())).vm(.5,.25,1,.75)});Zn("TriangleUp",function(a,b,c){return(new $d).add((new Ue(b,c)).add(new Ve(ie,0,c)).add((new Ve(ie,.5*b,0)).close())).vm(.25,.5,.75,1)});Zn("Triangle","TriangleUp");
Zn("Diamond",function(a,b,c){return(new $d).add((new Ue(.5*b,0)).add(new Ve(ie,0,.5*c)).add(new Ve(ie,.5*b,c)).add((new Ve(ie,b,.5*c)).close())).vm(.25,.25,.75,.75)});Zn("LineH",function(a,b,c){a=new $d(ge);a.startX=0;a.startY=c/2;a.endX=b;a.endY=c/2;return a});Zn("LineV",function(a,b,c){a=new $d(ge);a.startX=b/2;a.startY=0;a.endX=b/2;a.endY=c;return a});Zn("None","Rectangle");Zn("BarH","Rectangle");Zn("BarV","Rectangle");Zn("MinusLine","LineH");
Zn("PlusLine",function(a,b,c){return(new $d).add((new Ue(0,c/2,!1)).add(new Ve(ie,b,c/2)).add(new Ve(ze,b/2,0)).add(new Ve(ie,b/2,c)))});Zn("XLine",function(a,b,c){return(new $d).add((new Ue(0,c,!1)).add(new Ve(ie,b,0)).add(new Ve(ze,0,0)).add(new Ve(ie,b,c)))});
H.zm={"":"",Standard:"F1 m 0,0 l 8,4 -8,4 2,-4 z",Backward:"F1 m 8,0 l -2,4 2,4 -8,-4 z",Triangle:"F1 m 0,0 l 8,4.62 -8,4.62 z",BackwardTriangle:"F1 m 8,4 l 0,4 -8,-4 8,-4 0,4 z",Boomerang:"F1 m 0,0 l 8,4 -8,4 4,-4 -4,-4 z",BackwardBoomerang:"F1 m 8,0 l -8,4 8,4 -4,-4 4,-4 z",SidewaysV:"m 0,0 l 8,4 -8,4 0,-1 6,-3 -6,-3 0,-1 z",BackwardV:"m 8,0 l -8,4 8,4 0,-1 -6,-3 6,-3 0,-1 z",OpenTriangle:"m 0,0 l 8,4 -8,4",BackwardOpenTriangle:"m 8,0 l -8,4 8,4",OpenTriangleLine:"m 0,0 l 8,4 -8,4 m 8.5,0 l 0,-8",
BackwardOpenTriangleLine:"m 8,0 l -8,4 8,4 m -8.5,0 l 0,-8",OpenTriangleTop:"m 0,0 l 8,4 m 0,4",BackwardOpenTriangleTop:"m 8,0 l -8,4 m 0,4",OpenTriangleBottom:"m 0,8 l 8,-4",BackwardOpenTriangleBottom:"m 0,4 l 8,4",HalfTriangleTop:"F1 m 0,0 l 0,4 8,0 z m 0,8",BackwardHalfTriangleTop:"F1 m 8,0 l 0,4 -8,0 z m 0,8",HalfTriangleBottom:"F1 m 0,4 l 0,4 8,-4 z",BackwardHalfTriangleBottom:"F1 m 8,4 l 0,4 -8,-4 z",ForwardSemiCircle:"m 4,0 b 270 180 0 4 4",BackwardSemiCircle:"m 4,8 b 90 180 0 -4 4",Feather:"m 0,0 l 3,4 -3,4",
BackwardFeather:"m 3,0 l -3,4 3,4",DoubleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardDoubleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4",TripleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardTripleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4 m 3,-8 l -3,4 3,4",ForwardSlash:"m 0,8 l 5,-8",BackSlash:"m 0,0 l 5,8",DoubleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8",DoubleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8",TripleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8 m -2,8 l 4,-8",
TripleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8 m -2,-8 l 4,8",Fork:"m 0,4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4",LineFork:"m 0,0 l 0,8 m 0,-4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardLineFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4 m 8,-8 l 0,8",CircleFork:"F1 m 6,4 b 0 360 -3 0 3 z m 0,0 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",BackwardCircleFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 6,0 b 0 360 -3 0 3",CircleLineFork:"F1 m 6,4 b 0 360 -3 0 3 z m 1,-4 l 0,8 m 0,-4 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",
BackwardCircleLineFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 0,-4 l 0,8 m 7,-4 b 0 360 -3 0 3",Circle:"F1 m 8,4 b 0 360 -4 0 4 z",Block:"F1 m 0,0 l 0,8 8,0 0,-8 z",StretchedDiamond:"F1 m 0,3 l 5,-3 5,3 -5,3 -5,-3 z",Diamond:"F1 m 0,4 l 4,-4 4,4 -4,4 -4,-4 z",Chevron:"F1 m 0,0 l 5,0 3,4 -3,4 -5,0 3,-4 -3,-4 z",StretchedChevron:"F1 m 0,0 l 8,0 3,4 -3,4 -8,0 3,-4 -3,-4 z",NormalArrow:"F1 m 0,2 l 4,0 0,-2 4,4 -4,4 0,-2 -4,0 z",X:"m 0,0 l 8,8 m 0,-8 l -8,8",TailedNormalArrow:"F1 m 0,0 l 2,0 1,2 3,0 0,-2 2,4 -2,4 0,-2 -3,0 -1,2 -2,0 1,-4 -1,-4 z",
DoubleTriangle:"F1 m 0,0 l 4,4 -4,4 0,-8 z m 4,0 l 4,4 -4,4 0,-8 z",BigEndArrow:"F1 m 0,0 l 5,2 0,-2 3,4 -3,4 0,-2 -5,2 0,-8 z",ConcaveTailArrow:"F1 m 0,2 h 4 v -2 l 4,4 -4,4 v -2 h -4 l 2,-2 -2,-2 z",RoundedTriangle:"F1 m 0,1 a 1,1 0 0 1 1,-1 l 7,3 a 0.5,1 0 0 1 0,2 l -7,3 a 1,1 0 0 1 -1,-1 l 0,-6 z",SimpleArrow:"F1 m 1,2 l -1,-2 2,0 1,2 -1,2 -2,0 1,-2 5,0 0,-2 2,2 -2,2 0,-2 z",AccelerationArrow:"F1 m 0,0 l 0,8 0.2,0 0,-8 -0.2,0 z m 2,0 l 0,8 1,0 0,-8 -1,0 z m 3,0 l 2,0 2,4 -2,4 -2,0 0,-8 z",BoxArrow:"F1 m 0,0 l 4,0 0,2 2,0 0,-2 2,4 -2,4 0,-2 -2,0 0,2 -4,0 0,-8 z",
TriangleLine:"F1 m 8,4 l -8,-4 0,8 8,-4 z m 0.5,4 l 0,-8",CircleEndedArrow:"F1 m 10,4 l -2,-3 0,2 -2,0 0,2 2,0 0,2 2,-3 z m -4,0 b 0 360 -3 0 3 z",DynamicWidthArrow:"F1 m 0,3 l 2,0 2,-1 2,-2 2,4 -2,4 -2,-2 -2,-1 -2,0 0,-2 z",EquilibriumArrow:"m 0,3 l 8,0 -3,-3 m 3,5 l -8,0 3,3",FastForward:"F1 m 0,0 l 3.5,4 0,-4 3.5,4 0,-4 1,0 0,8 -1,0 0,-4 -3.5,4 0,-4 -3.5,4 0,-8 z",Kite:"F1 m 0,4 l 2,-4 6,4 -6,4 -2,-4 z",HalfArrowTop:"F1 m 0,0 l 4,4 4,0 -8,-4 z m 0,8",HalfArrowBottom:"F1 m 0,8 l 4,-4 4,0 -8,4 z",
OpposingDirectionDoubleArrow:"F1 m 0,4 l 2,-4 0,2 4,0 0,-2 2,4 -2,4 0,-2 -4,0 0,2 -2,-4 z",PartialDoubleTriangle:"F1 m 0,0 4,3 0,-3 4,4 -4,4 0,-3 -4,3 0,-8 z",LineCircle:"F1 m 0,0 l 0,8 m 7 -4 b 0 360 -3 0 3 z",DoubleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",TripleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",CircleLine:"F1 m 6 4 b 0 360 -3 0 3 z m 1,-4 l 0,8",DiamondCircle:"F1 m 8,4 l -4,4 -4,-4 4,-4 4,4 m 8,0 b 0 360 -4 0 4 z",PlusCircle:"F1 m 8,4 b 0 360 -4 0 4 l -8 0 z m -4 -4 l 0 8",
OpenRightTriangleTop:"m 8,0 l 0,4 -8,0 m 0,4",OpenRightTriangleBottom:"m 8,8 l 0,-4 -8,0",Line:"m 0,0 l 0,8",DoubleLine:"m 0,0 l 0,8 m 2,0 l 0,-8",TripleLine:"m 0,0 l 0,8 m 2,0 l 0,-8 m 2,0 l 0,8",PentagonArrow:"F1 m 8,4 l -4,-4 -4,0 0,8 4,0 4,-4 z"};
function T(a){X.call(this,a);this.H=2408959;this.Rg=this.xf="";this.To=this.Qo=this.ep=this.Yn=null;this.gp="";this.vf=this.Kn=this.fp=this.ah=null;this.So="";this.Ro=mc;this.Ob=this.Uo="";this.ei=this.Xm=this.Qh=null;this.Mf=(new G(NaN,NaN)).freeze();this.eo="";this.Ve=null;this.fo=Tc;this.Vo=Ed;this.oo=bc;this.ho=cc;this.tn=null;this.Zn=127;this.ri=dc;this.Fj="gray";this.Nd=4;this.yw=-1;this.Fp=NaN;this.Qx=new L;this.tj=null;this.Ug=NaN}oa(T,X);
T.prototype.cloneProtected=function(a){X.prototype.cloneProtected.call(this,a);a.H=this.H&-4097|49152;a.xf=this.xf;a.Rg=this.Rg;a.Yn=this.Yn;a.ep=this.ep;a.Qo=this.Qo;a.To=this.To;a.gp=this.gp;a.fp=this.fp;a.Kn=this.Kn;a.vf=null;a.So=this.So;a.Ro=this.Ro.I();a.Uo=this.Uo;a.Vo=this.Vo.I();a.Ob=this.Ob;a.Xm=this.Xm;a.Mf.assign(this.Mf);a.eo=this.eo;a.fo=this.fo.I();a.oo=this.oo.I();a.ho=this.ho.I();a.tn=this.tn;a.Zn=this.Zn;a.ri=this.ri.I();a.Fj=this.Fj;a.Nd=this.Nd;a.Fp=this.Fp};
T.prototype.nf=function(a){X.prototype.nf.call(this,a);a.wh();a.ah=null;a.Ve=null;a.tj=null};T.prototype.toString=function(){var a=Pa(this.constructor)+"#"+Bb(this);null!==this.data&&(a+="("+Qa(this.data)+")");return a};T.prototype.kk=function(a,b,c,d,e,f,g){var h=this.diagram;null!==h&&(a===cf&&"elements"===b?e instanceof X?zj(e,function(a){Bj(h.partManager,a);Aj(h,a)}):Wj(h,e):a===df&&"elements"===b&&(e instanceof X?zj(e,function(a){Fj(h.partManager,a);Ej(h,a)}):bk(h,e)),h.ab(a,b,c,d,e,f,g))};
T.prototype.Ea=function(a){X.prototype.Ea.call(this,a);if(null!==this.data){a=this.W.j;for(var b=a.length,c=0;c<b;c++){var d=a[c];d instanceof X&&zj(d,function(a){null!==a.data&&a.Ea()})}}};T.prototype.updateRelationshipsFromData=function(){null!==this.data&&this.diagram.partManager.updateRelationshipsFromData(this)};T.prototype.Xj=function(a){var b=this.vf;return null===b?null:b.J(a)};
T.prototype.nh=function(a,b){if(null!==b){var c=null,d=this.vf;null!==d&&(c=d.J(a));if(c!==b){if(null!==c){var e=c.diagram;null!==e&&e.remove(c)}null===d&&(this.vf=d=new Lb);b.xf!==a&&(b.category=a);d.add(a,b);a=this.diagram;null!==a&&(a.add(b),a=b.adornedObject,null!==a&&(a=a.Ei(),null!==a&&(b.data=a.data)))}}};T.prototype.sf=function(a){var b=this.vf;if(null!==b){var c=b.J(a);if(null!==c){var d=c.diagram;null!==d&&d.remove(c)}b.remove(a);0===b.count&&(this.vf=null)}};
T.prototype.Pj=function(){var a=this.vf;if(null!==a){var b=Ka();for(a=a.iterator;a.next();)b.push(a.key);a=b.length;for(var c=0;c<a;c++)this.sf(b[c]);Oa(b)}};
T.prototype.updateAdornments=function(){var a=this.diagram;if(null!==a){for(var b=this.adornments;b.next();){var c=b.value;c.o();c.placeholder&&c.placeholder.o()}a:{if(this.isSelected&&this.selectionAdorned&&(b=this.selectionObject,null!==b&&this.actualBounds.s()&&this.isVisible()&&b.rf()&&b.actualBounds.s())){c=this.Xj("Selection");if(null===c){c=this.selectionAdornmentTemplate;null===c&&(c=this.xh()?a.linkSelectionAdornmentTemplate:this instanceof hg?a.groupSelectionAdornmentTemplate:a.nodeSelectionAdornmentTemplate);
if(!(c instanceof pf))break a;Xg(c);c=c.copy();null!==c&&(this.xh()&&this.selectionObject===this.path&&(c.type=X.Link),c.adornedObject=b)}if(null!==c){if(null!==c.placeholder){var d=b.Be(),e=0;b instanceof W&&(e=b.strokeWidth);var f=K.alloc();f.h((b.naturalBounds.width+e)*d,(b.naturalBounds.height+e)*d);K.free(f)}c.type===X.Link?c.o():(b=G.alloc(),G.free(b));this.nh("Selection",c);break a}}this.sf("Selection")}$n(this,a);for(b=this.adornments;b.next();)b.value.Ea()}};
T.prototype.Jb=function(){var a=this.diagram;null!==a&&(Ni(a),0!==(this.H&16384)!==!0&&(fi(this,!0),a.cc()))};function ei(a){0!==(a.H&16384)!==!1&&(a.updateAdornments(),fi(a,!1))}function $n(a,b){b.toolManager.mouseDownTools.each(function(b){b.isEnabled&&b.updateAdornments(a)});b.toolManager.updateAdornments(a)}function ao(a){if(!1===oj(a)){var b=a.diagram;null!==b&&(b.Dd.add(a),b.cc());bo(a,!0);a.bl()}}
function co(a){a.H|=2097152;if(!1!==oj(a)){var b=a.position,c=a.location;c.s()&&b.s()||eo(a,b,c);c=a.vb;var d=L.alloc().assign(c);c.ha();c.x=b.x;c.y=b.y;c.freeze();a.it(d,c);L.free(d);bo(a,!1)}}T.prototype.move=function(a,b){!0===b?this.location=a:this.position=a};T.prototype.moveTo=function(a,b,c){a=G.allocAt(a,b);this.move(a,c);G.free(a)};
T.prototype.isVisible=function(){if(!this.visible)return!1;var a=this.layer;if(null!==a&&!a.visible)return!1;a=this.diagram;if(null!==a&&Vh(a.animationManager,this))return!0;a=this.containingGroup;return null===a||a.isSubGraphExpanded&&a.isVisible()?!0:!1};t=T.prototype;t.Mb=function(a){var b=this.diagram;a?(this.B(4),this.Jb(),null!==b&&b.Dd.add(this)):(this.B(8),this.Pj());this.wh();null!==b&&(b.Xa(),b.R())};
t.$a=function(a){if(this.name===a)return this;var b=this.tj;null===b&&(this.tj=b=new Lb);if(null!==b.J(a))return b.J(a);var c=X.prototype.$a.call(this,a);if(null!==c)return b.set(a,c),c;b.set(a,null);return null};t.uh=function(a,b,c){void 0===c&&(c=new G);b=b.kc()?dd: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.ta(c);for(a=a.panel;null!==a&&a!==this;)a.transform.ta(c),a=a.panel;this.Lf.ta(c);c.offset(-this.qc.x,-this.qc.y);return c};
t.Sp=function(a){void 0===a&&(a=new L);return a.assign(this.actualBounds)};t.ac=function(){!0===mj(this)&&(this instanceof hg&&this.memberParts.each(function(a){a.ac()}),this.measure(Infinity,Infinity));this.arrange()};
function xj(a,b){var c=a.Qx;isNaN(a.Ug)&&(a.Ug=Sm(a));var d=a.Ug;var e=2*d;if(!a.isShadowed)return c.h(b.x-1-d,b.y-1-d,b.width+2+e,b.height+2+e),c;d=b.x;e=b.y;var f=b.width;b=b.height;var g=a.shadowBlur;a=a.shadowOffset;f+=g;b+=g;d-=g/2;e-=g/2;0<a.x?f+=a.x:(d+=a.x,f-=a.x);0<a.y?b+=a.y:(e+=a.y,b-=a.y);c.h(d-1,e-1,f+2,b+2);return c}
T.prototype.arrange=function(){if(!1===nj(this))co(this);else{var a=this.vb,b=L.alloc();b.assign(a);a.ha();var c=ng(this);this.qh(0,0,this.qc.width,this.qc.height);var d=this.position;eo(this,d,this.location);a.x=d.x;a.y=d.y;a.freeze();this.it(b,a);$k(this,!1);b.A(a)?this.hd(c):!this.Lb()||H.w(b.width,a.width)&&H.w(b.height,a.height)||0<=this.yw&&this.B(16);L.free(b);bo(this,!1)}};t=T.prototype;
t.it=function(a,b){var c=this.diagram;if(null!==c){var d=!1;if(!1===c.Ng&&a.s()){var e=L.alloc();e.assign(c.documentBounds);e.Kv(c.padding);a.x>e.x&&a.y>e.y&&a.right<e.right&&a.bottom<e.bottom&&b.x>e.x&&b.y>e.y&&b.right<e.right&&b.bottom<e.bottom&&(d=!0);L.free(e)}0!==(this.H&65536)!==!0&&a.A(b)||Cj(this,d,c);c.R();xc(a,b)||(this instanceof V&&!c.undoManager.isUndoingRedoing&&this.ed(),this.wh())}};
t.Gv=function(a,b){if(this.xh()||!a.s())return!1;var c=this.diagram;if(null!==c&&(fo(this,c,a,b),!0===c.undoManager.isUndoingRedoing))return!0;this.sa=a;this.H&=-2097153;c=this.Mf;if(c.s()){var d=c.copy();c.h(c.x+(a.x-b.x),c.y+(a.y-b.y));this.g("location",d,c)}!1===oj(this)&&!1===nj(this)&&(ao(this),co(this));return!0};function fo(a,b,c,d){null===b||a instanceof pf||(b=b.animationManager,b.We&&b.jg(a,"position",d.copy(),c.copy(),!1))}
t.tt=function(a,b){var c=this.Mf,d=this.sa;oj(this)||nj(this)?c.h(NaN,NaN):c.h(c.x+a-d.x,c.y+b-d.y);d.h(a,b);ao(this)};t.Hv=function(){this.H&=-2097153;ao(this)};
function eo(a,b,c){var d=G.alloc(),e=a.locationSpot,f=a.locationObject;e.kc()&&A("determineOffset: Part's locationSpot must be real: "+e.toString());var g=f.naturalBounds,h=f instanceof W?f.strokeWidth:0;d.mk(0,0,g.width+h,g.height+h,e);if(f!==a)for(d.offset(-h/2,-h/2),f.transform.ta(d),e=f.panel;null!==e&&e!==a;)e.transform.ta(d),e=e.panel;a.Lf.ta(d);d.offset(-a.qc.x,-a.qc.y);e=a.diagram;f=c.s();g=b.s();f&&g?0!==(a.H&2097152)?go(a,b,c,e,d):ho(a,b,c,e,d):f?go(a,b,c,e,d):g&&ho(a,b,c,e,d);a.H|=2097152;
G.free(d);a.bl()}function go(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.We||a instanceof pf||c.jg(a,"position",new G(f,g),b,!1),e||b.x===f&&b.y===g||(c=d.skipsUndoManager,d.skipsUndoManager=!0,a.g("position",new G(f,g),b),d.skipsUndoManager=c))}function ho(a,b,c,d,e){var f=c.copy();c.h(b.x+e.x,b.y+e.y);c.A(f)||null===d||(b=d.skipsUndoManager,d.skipsUndoManager=!0,a.g("location",f,c),d.skipsUndoManager=b)}
function Cj(a,b,c){bl(a,!1);a instanceof V&&nk(c,a);a.layer.isTemporary||b||c.Xa();b=a.vb;var d=c.viewportBounds;d.s()?ng(a)?(Ac(b,d,10)||a.hd(!1),a.updateAdornments()):b.Ic(d)?(a.hd(!0),a.updateAdornments()):a.Jb():c.ai=!0}t.Ni=function(){return!0};t.Lb=function(){return!0};t.xh=function(){return!1};t.rg=function(){return!0};
function io(a,b,c,d){b.constructor===a.constructor||jo||(jo=!0,ya('Should not change the class of the Part when changing category from "'+c+'" to "'+d+'"'),ya(" Old class: "+Pa(a.constructor)+", new class: "+Pa(b.constructor)+", part: "+a.toString()));a.Pj();var e=a.data;c=a.layerName;var f=a.isSelected,g=a.isHighlighted,h=!0,k=!0,l=!1;a instanceof V&&(h=a.isTreeLeaf,k=a.isTreeExpanded,l=a.wasTreeExpanded);b.nf(a);b.cloneProtected(a);a.xf=d;a.o();a.R();b=a.diagram;d=!0;null!==b&&(d=b.skipsUndoManager,
b.skipsUndoManager=!0);a.jb=e;null!==e&&a.Ea();null!==b&&(b.skipsUndoManager=d);e=a.layerName;e!==c&&(a.Rg=c,a.layerName=e);a instanceof V&&(a.isTreeLeaf=h,a.isTreeExpanded=k,a.wasTreeExpanded=l,a.Lb()&&a.B(64));a.isSelected=f;a.isHighlighted=g}T.prototype.canCopy=function(){if(!this.copyable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowCopy)return!1;a=a.diagram;return null===a?!0:a.allowCopy?!0:!1};
T.prototype.canDelete=function(){if(!this.deletable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowDelete)return!1;a=a.diagram;return null===a?!0:a.allowDelete?!0:!1};T.prototype.canEdit=function(){if(!this.textEditable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowTextEdit)return!1;a=a.diagram;return null===a?!0:a.allowTextEdit?!0:!1};
T.prototype.canGroup=function(){if(!this.groupable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowGroup)return!1;a=a.diagram;return null===a?!0:a.allowGroup?!0:!1};T.prototype.canMove=function(){if(!this.movable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowMove)return!1;a=a.diagram;return null===a?!0:a.allowMove?!0:!1};
T.prototype.canReshape=function(){if(!this.reshapable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowReshape)return!1;a=a.diagram;return null===a?!0:a.allowReshape?!0:!1};T.prototype.canResize=function(){if(!this.resizable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowResize)return!1;a=a.diagram;return null===a?!0:a.allowResize?!0:!1};
T.prototype.canRotate=function(){if(!this.rotatable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowRotate)return!1;a=a.diagram;return null===a?!0:a.allowRotate?!0:!1};T.prototype.canSelect=function(){if(!this.selectable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowSelect)return!1;a=a.diagram;return null===a?!0:a.allowSelect?!0:!1};function fi(a,b){a.H=b?a.H|16384:a.H&-16385}function oj(a){return 0!==(a.H&32768)}function bo(a,b){a.H=b?a.H|32768:a.H&-32769}
function bl(a,b){a.H=b?a.H|65536:a.H&-65537}function ng(a){return 0!==(a.H&131072)}t=T.prototype;t.hd=function(a){this.H=a?this.H|131072:this.H&-131073};function ko(a,b){a.H=b?a.H|1048576:a.H&-1048577}t.wh=function(){var a=this.containingGroup;null!==a&&(a.o(),null!==a.placeholder&&a.placeholder.o(),a.ed())};t.R=function(){var a=this.diagram;null!==a&&!nj(this)&&!oj(this)&&this.isVisible()&&this.vb.s()&&a.R(xj(this,this.vb))};
t.o=function(){X.prototype.o.call(this);var a=this.diagram;null!==a&&(a.Dd.add(this),this instanceof V&&null!==this.labeledLink&&ql(this.labeledLink),a.cc(!0))};t.Vp=function(a){a||(a=this.Qh,null!==a&&lo(a,this))};t.Wp=function(a){a||(a=this.Qh,null!==a&&mo(a,this))};t.Vj=function(){var a=this.data;if(null!==a){var b=this.diagram;null!==b&&(b=b.model,null!==b&&b.mm(a))}};t.Ny=function(){return no(this,this)};
function no(a,b){var c=b.containingGroup;return null!==c?1+no(a,c):b instanceof V&&(b=b.labeledLink,null!==b)?no(a,b):0}t.Qy=function(){return oo(this,this)};function oo(a,b){var c=b.containingGroup;return null!==c||b instanceof V&&(c=b.labeledLink,null!==c)?oo(a,c):b}t.Ud=function(a){return a instanceof hg?po(this,this,a):!1};function po(a,b,c){if(b===c||null===c)return!1;var d=b.containingGroup;return null===d||d!==c&&!po(a,d,c)?b instanceof V&&(b=b.labeledLink,null!==b)?po(a,b,c):!1:!0}
t.bx=function(a){if(null===a)return null;if(this===a)return this.containingGroup;for(var b=this;null!==b;){b instanceof hg&&ko(b,!0);if(b instanceof V){var c=b.labeledLink;null!==c&&(b=c)}b=b.containingGroup}c=null;for(b=a;null!==b;){if(0!==(b.H&1048576)){c=b;break}b instanceof V&&(a=b.labeledLink,null!==a&&(b=a));b=b.containingGroup}for(b=this;null!==b;)b instanceof hg&&ko(b,!1),b instanceof V&&(a=b.labeledLink,null!==a&&(b=a)),b=b.containingGroup;return c};
T.prototype.canLayout=function(){if(!this.isLayoutPositioned||!this.isVisible())return!1;var a=this.layer;return null!==a&&a.isTemporary||this instanceof V&&this.isLinkLabel?!1:!0};
T.prototype.B=function(a){void 0===a&&(a=16777215);if(this.isLayoutPositioned&&0!==(a&this.layoutConditions)){var b=this.layer;null!==b&&b.isTemporary||this instanceof V&&this.isLinkLabel?b=!1:(b=this.diagram,b=null!==b&&b.undoManager.isUndoingRedoing?!1:!0)}else b=!1;if(b)if(b=this.Qh,null!==b){var c=b.layout;null!==c?c.B():b.B(a)}else a=this.diagram,null!==a&&(a=a.layout,null!==a&&a.B())};function Dj(a){if(!a.isVisible())return!1;a=a.layer;return null!==a&&a.isTemporary?!1:!0}
function Gk(a,b,c,d,e,f){void 0===f&&(f=null);if(!(a.contains(b)||null!==f&&!f(b)||b instanceof pf))if(a.add(b),b instanceof V){if(c&&b instanceof hg)for(var g=b.memberParts;g.next();)Gk(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)&&Gk(a,h,c,d,e,f)}}if(1<d)for(b=b.Vu();b.next();)Gk(a,b.value,c,d-1,e,f)}else if(b instanceof S)for(b=b.labelNodes;b.next();)Gk(a,
b.value,c,d,e,f)}
pa.Object.defineProperties(T.prototype,{key:{get:function(){var a=this.diagram;if(null!==a)return a.model.pa(this.data)}},adornments:{get:function(){return null===this.vf?xb:this.vf.iteratorValues}},layer:{get:function(){return this.ei}},diagram:{get:function(){var a=this.ei;return null!==a?a.diagram:null}},layerName:{get:function(){return this.Rg},set:function(a){var b=
this.Rg;if(b!==a){var c=this.diagram;if(null===c||null!==c.Xl(a)&&!c.partManager.addsToTemporaryLayer)if(this.Rg=a,null!==c&&c.Xa(),this.g("layerName",b,a),b=this.layer,null!==b&&b.name!==a&&(c=b.diagram,null!==c&&(a=c.Xl(a),null!==a&&a!==b))){var d=b.xc(-1,this,!0);0<=d&&c.ab(df,"parts",b,this,null,d,!0);d=a.Li(99999999,this,!0);b.visible!==a.visible&&this.Mb(a.visible);0<=d&&c.ab(cf,"parts",a,null,this,!0,d);d=this.layerChanged;if(null!==d){var e=c.da;c.da=!0;d(this,b,a);c.da=e}}}}},layerChanged:{
get:function(){return this.Yn},set:function(a){var b=this.Yn;b!==a&&(this.Yn=a,this.g("layerChanged",b,a))}},zOrder:{get:function(){return this.Fp},set:function(a){var b=this.Fp;if(b!==a){this.Fp=a;var c=this.layer;null!==c&&ii(c,-1,this);this.g("zOrder",b,a);a=this.diagram;null!==a&&a.R()}}},locationObject:{get:function(){if(null===this.Ve){var a=this.locationObjectName;""!==a?(a=this.$a(a),null!==a?this.Ve=a:this.Ve=this):
this instanceof pf?this.type!==X.Link&&null!==this.placeholder?this.Ve=this.placeholder:this.Ve=this:this.Ve=this}return this.Ve.visible?this.Ve:this}},minLocation:{get:function(){return this.oo},set:function(a){var b=this.oo;b.A(a)||(this.oo=a=a.I(),this.g("minLocation",b,a))}},maxLocation:{get:function(){return this.ho},set:function(a){var b=this.ho;b.A(a)||(this.ho=a=a.I(),this.g("maxLocation",b,a))}},locationObjectName:{
get:function(){return this.eo},set:function(a){var b=this.eo;b!==a&&(this.eo=a,this.Ve=null,this.o(),this.g("locationObjectName",b,a))}},locationSpot:{get:function(){return this.fo},set:function(a){var b=this.fo;b.A(a)||(this.fo=a=a.I(),this.o(),this.g("locationSpot",b,a))}},location:{get:function(){return this.Mf},set:function(a){var b=a.x,c=a.y,d=this.Mf,e=d.x,f=d.y;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))||
(a=a.I(),b=a,this.xh()?b=!1:(this.Mf=b,this.H|=2097152,!1===nj(this)&&(ao(this),c=this.sa,c.s()&&(e=c.copy(),c.h(c.x+(b.x-d.x),c.y+(b.y-d.y)),fo(this,this.diagram,c,e),this.g("position",e,c))),b=!0),b&&this.g("location",d,a))}},category:{get:function(){return this.xf},set:function(a){var b=this.xf;if(b!==a){var c=this.diagram,d=this.data,e=null;if(null!==c&&null!==d&&!(this instanceof pf)){var f=c.model.undoManager;f.isEnabled&&!f.isUndoingRedoing&&(e=this.clone(),e.W.addAll(this.W))}this.xf=
a;this.g("category",b,a);null===c||null===d||this instanceof pf?this instanceof pf&&(e=this.adornedPart,null!==e&&(a=e.vf,null!==a&&a.remove(b),e.nh(this.category,this))):(f=c.model,f.undoManager.isUndoingRedoing||(this.xh()?(c.partManager.setLinkCategoryForData(d,a),c=c.partManager.findLinkTemplateForCategory(a),null!==c&&(Xg(c),c=c.copy(),null!==c&&io(this,c,b,a))):(null!==f&&f.mq(d,a),c=qo(c.partManager,d,a),null!==c&&(Xg(c),c=c.copy(),null===c||c instanceof S||(c.location=this.location,io(this,
c,b,a)))),null!==e&&(b=this.clone(),b.W.addAll(this.W),this.g("self",e,b))))}}},self:{get:function(){return this},set:function(a){io(this,a,this.category,a.category)}},copyable:{get:function(){return 0!==(this.H&1)},set:function(a){var b=0!==(this.H&1);b!==a&&(this.H^=1,this.g("copyable",b,a))}},deletable:{get:function(){return 0!==(this.H&2)},set:function(a){var b=0!==(this.H&2);b!==a&&(this.H^=2,this.g("deletable",
b,a))}},textEditable:{get:function(){return 0!==(this.H&4)},set:function(a){var b=0!==(this.H&4);b!==a&&(this.H^=4,this.g("textEditable",b,a),this.Jb())}},groupable:{get:function(){return 0!==(this.H&8)},set:function(a){var b=0!==(this.H&8);b!==a&&(this.H^=8,this.g("groupable",b,a))}},movable:{get:function(){return 0!==(this.H&16)},set:function(a){var b=0!==(this.H&16);b!==a&&(this.H^=16,this.g("movable",b,a))}},
selectionAdorned:{get:function(){return 0!==(this.H&32)},set:function(a){var b=0!==(this.H&32);b!==a&&(this.H^=32,this.g("selectionAdorned",b,a),this.Jb())}},isInDocumentBounds:{get:function(){return 0!==(this.H&64)},set:function(a){var b=0!==(this.H&64);if(b!==a){this.H^=64;var c=this.diagram;null!==c&&c.Xa();this.g("isInDocumentBounds",b,a)}}},isLayoutPositioned:{get:function(){return 0!==(this.H&128)},set:function(a){var b=
0!==(this.H&128);b!==a&&(this.H^=128,this.g("isLayoutPositioned",b,a),this.B(a?4:8))}},selectable:{get:function(){return 0!==(this.H&256)},set:function(a){var b=0!==(this.H&256);b!==a&&(this.H^=256,this.g("selectable",b,a),this.Jb())}},reshapable:{get:function(){return 0!==(this.H&512)},set:function(a){var b=0!==(this.H&512);b!==a&&(this.H^=512,this.g("reshapable",b,a),this.Jb())}},resizable:{get:function(){return 0!==
(this.H&1024)},set:function(a){var b=0!==(this.H&1024);b!==a&&(this.H^=1024,this.g("resizable",b,a),this.Jb())}},rotatable:{get:function(){return 0!==(this.H&2048)},set:function(a){var b=0!==(this.H&2048);b!==a&&(this.H^=2048,this.g("rotatable",b,a),this.Jb())}},isSelected:{get:function(){return 0!==(this.H&4096)},set:function(a){var b=0!==(this.H&4096);if(b!==a){var c=this.diagram;if(!a||this.canSelect()&&!(null!==c&&c.selection.count>=
c.maxSelectionCount)){this.H^=4096;var d=!1;if(null!==c){d=c.skipsUndoManager;c.skipsUndoManager=!0;var e=c.selection;e.ha();a?e.add(this):e.remove(this);e.freeze()}this.g("isSelected",b,a);this.Jb();a=this.selectionChanged;null!==a&&a(this);null!==c&&(c.cc(),c.skipsUndoManager=d)}}}},isHighlighted:{get:function(){return 0!==(this.H&524288)},set:function(a){var b=0!==(this.H&524288);if(b!==a){this.H^=524288;var c=this.diagram;null!==c&&(c=c.highlighteds,c.ha(),a?c.add(this):
c.remove(this),c.freeze());this.g("isHighlighted",b,a);this.R();a=this.highlightedChanged;null!==a&&a(this)}}},isShadowed:{get:function(){return 0!==(this.H&8192)},set:function(a){var b=0!==(this.H&8192);b!==a&&(this.H^=8192,this.g("isShadowed",b,a),this.R())}},isAnimated:{get:function(){return 0!==(this.H&262144)},set:function(a){var b=0!==(this.H&262144);b!==a&&(this.H^=262144,this.g("isAnimated",b,a))}},highlightedChanged:{
get:function(){return this.Kn},set:function(a){var b=this.Kn;b!==a&&(this.Kn=a,this.g("highlightedChanged",b,a))}},selectionObjectName:{get:function(){return this.gp},set:function(a){var b=this.gp;b!==a&&(this.gp=a,this.ah=null,this.g("selectionObjectName",b,a))}},selectionAdornmentTemplate:{get:function(){return this.ep},set:function(a){var b=this.ep;b!==a&&(this.ep=a,this.g("selectionAdornmentTemplate",b,a))}},selectionObject:{
get:function(){if(null===this.ah){var a=this.selectionObjectName;null!==a&&""!==a?(a=this.$a(a),null!==a?this.ah=a:this.ah=this):this instanceof S?(a=this.path,null!==a?this.ah=a:this.ah=this):this.ah=this}return this.ah}},selectionChanged:{get:function(){return this.fp},set:function(a){var b=this.fp;b!==a&&(this.fp=a,this.g("selectionChanged",b,a))}},resizeAdornmentTemplate:{get:function(){return this.Qo},set:function(a){var b=
this.Qo;b!==a&&(this.Qo=a,this.g("resizeAdornmentTemplate",b,a))}},resizeObjectName:{get:function(){return this.So},set:function(a){var b=this.So;b!==a&&(this.So=a,this.g("resizeObjectName",b,a))}},resizeObject:{get:function(){var a=this.resizeObjectName;return""!==a&&(a=this.$a(a),null!==a)?a:this}},resizeCellSize:{get:function(){return this.Ro},set:function(a){var b=this.Ro;b.A(a)||(this.Ro=a=a.I(),this.g("resizeCellSize",
b,a))}},rotateAdornmentTemplate:{get:function(){return this.To},set:function(a){var b=this.To;b!==a&&(this.To=a,this.g("rotateAdornmentTemplate",b,a))}},rotateObjectName:{get:function(){return this.Uo},set:function(a){var b=this.Uo;b!==a&&(this.Uo=a,this.g("rotateObjectName",b,a))}},rotateObject:{get:function(){var a=this.rotateObjectName;return""!==a&&(a=this.$a(a),null!==a)?a:this}},rotationSpot:{
get:function(){return this.Vo},set:function(a){var b=this.Vo;b.A(a)||(this.Vo=a=a.I(),this.g("rotationSpot",b,a))}},text:{get:function(){return this.Ob},set:function(a){var b=this.Ob;b!==a&&(this.Ob=a,this.g("text",b,a))}},containingGroup:{get:function(){return this.Qh},set:function(a){if(this.Lb()){var b=this.Qh;if(b!==a){null===a||this!==a&&!a.Ud(this)||(this===a&&A("Cannot make a Group a member of itself: "+this.toString()),
A("Cannot make a Group indirectly contain itself: "+this.toString()+" already contains "+a.toString()));this.B(2);var c=this.diagram;null!==b?mo(b,this):this instanceof hg&&null!==c&&c.wi.remove(this);this.Qh=a;null!==a?lo(a,this):this instanceof hg&&null!==c&&c.wi.add(this);this.B(1);if(null!==c){var d=this.data,e=c.model;if(null!==d&&e.ak()){var f=e.pa(null!==a?a.data:null);e.qt(d,f)}}d=this.containingGroupChanged;null!==d&&(e=!0,null!==c&&(e=c.da,c.da=!0),d(this,b,a),null!==c&&(c.da=e));if(this instanceof
hg)for(c=new F,Gk(c,this,!0,0,!0),c=c.iterator;c.next();)if(d=c.value,d instanceof V)for(d=d.linksConnected;d.next();)ro(d.value);if(this instanceof V){for(c=this.linksConnected;c.next();)ro(c.value);c=this.labeledLink;null!==c&&ro(c)}this.g("containingGroup",b,a);null!==a&&(b=a.layer,null!==b&&ii(b,-1,a))}}else A("cannot set the Part.containingGroup of a Link or Adornment")}},containingGroupChanged:{get:function(){return this.Xm},set:function(a){var b=this.Xm;b!==a&&
(this.Xm=a,this.g("containingGroupChanged",b,a))}},isTopLevel:{get:function(){return null!==this.containingGroup||this instanceof V&&null!==this.labeledLink?!1:!0}},layoutConditions:{get:function(){return this.Zn},set:function(a){var b=this.Zn;b!==a&&(this.Zn=a,this.g("layoutConditions",b,a))}},dragComputation:{get:function(){return this.tn},set:function(a){var b=this.tn;b!==a&&(this.tn=a,this.g("dragComputation",
b,a))}},shadowOffset:{get:function(){return this.ri},set:function(a){var b=this.ri;b.A(a)||(this.ri=a=a.I(),this.R(),this.g("shadowOffset",b,a))}},shadowColor:{get:function(){return this.Fj},set:function(a){var b=this.Fj;b!==a&&(this.Fj=a,this.R(),this.g("shadowColor",b,a))}},shadowBlur:{get:function(){return this.Nd},set:function(a){var b=this.Nd;b!==a&&(this.Nd=a,this.R(),this.g("shadowBlur",b,a))}}});
T.prototype.invalidateLayout=T.prototype.B;T.prototype.findCommonContainingGroup=T.prototype.bx;T.prototype.isMemberOf=T.prototype.Ud;T.prototype.findTopLevelPart=T.prototype.Qy;T.prototype.findSubGraphLevel=T.prototype.Ny;T.prototype.ensureBounds=T.prototype.ac;T.prototype.getDocumentBounds=T.prototype.Sp;T.prototype.getRelativePoint=T.prototype.uh;T.prototype.findObject=T.prototype.$a;T.prototype.moveTo=T.prototype.moveTo;T.prototype.invalidateAdornments=T.prototype.Jb;
T.prototype.clearAdornments=T.prototype.Pj;T.prototype.removeAdornment=T.prototype.sf;T.prototype.addAdornment=T.prototype.nh;T.prototype.findAdornment=T.prototype.Xj;T.prototype.updateTargetBindings=T.prototype.Ea;var jo=!1;T.className="Part";T.LayoutNone=0;T.LayoutAdded=1;T.LayoutRemoved=2;T.LayoutShown=4;T.LayoutHidden=8;T.LayoutNodeSized=16;T.LayoutGroupLayout=32;T.LayoutNodeReplaced=64;T.LayoutStandard=127;T.LayoutAll=16777215;
function pf(a){T.call(this,a);this.H&=-257;this.Rg="Adornment";this.Zd=null;this.Bw=0;this.Mw=!1;this.l=[];this.Va=null}oa(pf,T);pf.prototype.toString=function(){var a=this.adornedPart;return"Adornment("+this.category+")"+(null!==a?a.toString():"")};pf.prototype.updateRelationshipsFromData=function(){};
pf.prototype.dk=function(a){var b=this.adornedObject.part;if(b instanceof S&&this.adornedObject instanceof W){var c=b.path;b.dk(a);a=c.geometry;b=this.W.j;c=b.length;for(var d=0;d<c;d++){var e=b[d];e.isPanelMain&&e instanceof W&&(e.qa=a)}}};pf.prototype.Ni=function(){var a=this.Zd;if(null===a)return!0;a=a.part;return null===a||!nj(a)};pf.prototype.Lb=function(){return!1};
pf.prototype.kk=function(a,b,c,d,e,f,g){if(a===cf&&"elements"===b)if(e instanceof Wg)null===this.Va&&(this.Va=e);else{if(e instanceof X){var h=e.Wl(function(a){return a instanceof Wg});h instanceof Wg&&null===this.Va&&(this.Va=h)}}else a===df&&"elements"===b&&null!==this.Va&&(d===this.Va?this.Va=null:d instanceof X&&this.Va.pg(d)&&(this.Va=null));T.prototype.kk.call(this,a,b,c,d,e,f,g)};pf.prototype.updateAdornments=function(){};pf.prototype.Vj=function(){};
pa.Object.defineProperties(pf.prototype,{placeholder:{get:function(){return this.Va}},adornedObject:{get:function(){return this.Zd},set:function(a){var b=this.adornedPart,c=null;null!==a&&(c=a.part);null===b||null!==a&&b===c||b.sf(this.category);this.Zd=a;null!==c&&c.nh(this.category,this)}},adornedPart:{get:function(){var a=this.Zd;return null!==a?a.part:null}},containingGroup:{
get:function(){return null}}});pf.className="Adornment";function V(a){T.call(this,a);this.Z=13;this.Ya=new E;this.zp=this.dl=this.hi=this.ao=this.$n=null;this.zk=Pc;this.rc=this.Ke=null;this.No=so;this.lh=!1}oa(V,T);V.prototype.cloneProtected=function(a){T.prototype.cloneProtected.call(this,a);a.Z=this.Z;a.Z=this.Z&-17;a.$n=this.$n;a.ao=this.ao;a.hi=this.hi;a.zp=this.zp;a.zk=this.zk.I();a.No=this.No};t=V.prototype;t.nf=function(a){T.prototype.nf.call(this,a);a.ed();a.Ke=this.Ke;a.rc=null};
function to(a,b){null!==b&&(null===a.Ke&&(a.Ke=new F),a.Ke.add(b))}function uo(a,b,c,d){if(null===b||null===a.Ke)return null;for(var e=a.Ke.iterator;e.next();){var f=e.value;if(f.gt===a&&f.jv===b&&f.ux===c&&f.vx===d||f.gt===b&&f.jv===a&&f.ux===d&&f.vx===c)return f}return null}t.lz=function(a,b,c){if(void 0===b||null===b)b="";if(void 0===c||null===c)c="";a=uo(this,a,b,c);null!==a&&a.am()};
t.kk=function(a,b,c,d,e,f,g){a===cf&&"elements"===b?this.rc=null:a===df&&"elements"===b&&(this.rc=null);T.prototype.kk.call(this,a,b,c,d,e,f,g)};t.ed=function(a){void 0===a&&(a=null);for(var b=this.linksConnected;b.next();){var c=b.value;null!==a&&a.contains(c)||(vo(this,c.fromPort),vo(this,c.toPort),c.Ra())}};function cl(a,b){for(var c=a.linksConnected;c.next();){var d=c.value;if(d.fromPort===b||d.toPort===b)vo(a,d.fromPort),vo(a,d.toPort),d.Ra()}}
function vo(a,b){null!==b&&(b=b.Mo,null!==b&&b.am(),a=a.containingGroup,null===a||a.isSubGraphExpanded||vo(a,a.port))}t.Ni=function(){return!0};V.prototype.getAvoidableRect=function(a){a.set(this.actualBounds);a.Ip(this.zk);return a};V.prototype.findVisibleNode=function(){for(var a=this;null!==a&&!a.isVisible();)a=a.containingGroup;return a};
V.prototype.isVisible=function(){if(!T.prototype.isVisible.call(this))return!1;var a=!0,b=pi,c=this.diagram;if(null!==c){if(Vh(c.animationManager,this))return!0;a=c.isTreePathToChildren;b=c.treeCollapsePolicy}if(b===pi){if(a=this.ng(),null!==a&&!a.isTreeExpanded)return!1}else if(b===uk){if(a=a?this.Tu():this.Uu(),0<a.count&&a.all(function(a){return!a.isTreeExpanded}))return!1}else if(b===vk&&(a=a?this.Tu():this.Uu(),0<a.count&&a.any(function(a){return!a.isTreeExpanded})))return!1;a=this.labeledLink;
return null!==a?a.isVisible():!0};t=V.prototype;t.Mb=function(a){T.prototype.Mb.call(this,a);for(var b=this.linksConnected;b.next();)b.value.Mb(a)};t.Ru=function(a){void 0===a&&(a=null);if(null===a)return this.Ya.iterator;var b=new zb(this.Ya),c=this;b.predicate=function(b){return b.fromNode===c&&b.fromPortId===a||b.toNode===c&&b.toPortId===a};return b};
t.Pp=function(a){void 0===a&&(a=null);var b=new zb(this.Ya),c=this;b.predicate=function(b){return b.fromNode!==c?!1:null===a?!0:b.fromPortId===a};return b};t.sd=function(a){void 0===a&&(a=null);var b=new zb(this.Ya),c=this;b.predicate=function(b){return b.toNode!==c?!1:null===a?!0:b.toPortId===a};return b};
t.Su=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.Ya.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 yb(c):xb};
t.Uu=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.Ya.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 yb(c):xb};
t.Tu=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.Ya.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 yb(c):xb};
t.Iy=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);var d=new zb(this.Ya),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.Jy=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);var d=new zb(this.Ya),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 wo(a,b,c){vo(a,c);var d=a.Ya.contains(b);d||a.Ya.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.da,g.da=!0);e(a,b,c);null!==g&&(g.da=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.lh||(e.lh=f),!f.isTreeLeaf||null!==a&&a.undoManager.isUndoingRedoing||(d?c===f&&(f.isTreeLeaf=!1):b===f&&(f.isTreeLeaf=!1))))}
function xo(a,b,c){vo(a,c);var d=a.Ya.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.da,e.da=!0);f(a,b,c);null!==e&&(e.da=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.lh=!1),null===b||b.isTreeLeaf||(0===b.Ya.count?(b.lh=null,null!==e&&e.undoManager.isUndoingRedoing||(b.isTreeLeaf=!0)):tk(b)))}
function tk(a){a.lh=!1;if(0!==a.Ya.count){var b=!0,c=a.diagram;if(null===c||!c.undoManager.isUndoingRedoing){null!==c&&(b=c.isTreePathToChildren);for(c=a.Ya.iterator;c.next();){var d=c.value;if(d.isTreeLink)if(b){if(d.fromNode===a){a.isTreeLeaf=!1;return}}else if(d.toNode===a){a.isTreeLeaf=!1;return}}a.isTreeLeaf=!0}}}V.prototype.updateRelationshipsFromData=function(){var a=this.diagram;null!==a&&a.partManager.updateRelationshipsFromData(this)};t=V.prototype;
t.Vp=function(a){T.prototype.Vp.call(this,a);a||(tk(this),a=this.dl,null!==a&&yo(a,this))};t.Wp=function(a){T.prototype.Wp.call(this,a);a||(a=this.dl,null!==a&&null!==a.$c&&(a.$c.remove(this),a.o()))};
t.Vj=function(){if(0<this.Ya.count){var a=this.diagram;if(null!==a)for(var b=null!==a.commandHandler?a.commandHandler.deletesConnectedLinks:!0,c=this.Ya.copy().iterator;c.next();){var d=c.value;b?a.remove(d):(d.fromNode===this&&(d.fromNode=null),d.toNode===this&&(d.toNode=null))}}this.labeledLink=null;T.prototype.Vj.call(this)};t.Qs=function(a){if(null===this.rc){if(""===a&&!1===this.vh)return this;zo(this)}var b=this.rc.J(a);return null!==b||""!==a&&(b=this.rc.J(""),null!==b)?b:this};
function zo(a){null===a.rc?a.rc=new Lb:a.rc.clear();a.wm(a,function(a,c){Fl(a,c)});0===a.rc.count&&a.rc.add("",a)}function Fl(a,b){var c=b.portId;null!==c&&null!==a.rc&&a.rc.add(c,b)}function El(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.Ru(d);a.next();)d=a.value,null===c&&(c=Ka()),c.push(d);if(null!==c){for(a=0;a<c.length;a++)b.remove(c[a]);Oa(c)}}}
t.nz=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.Ya.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.Ya.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.Uy=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this;if(a)for(;;){a=null;for(var c=b.Ya.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.Ya.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.Fy=function(a){if(null===a)return null;if(this===a)return this;for(var b=this;null!==b;)ko(b,!0),b=b.ng();var c=null;for(b=a;null!==b;){if(0!==(b.H&1048576)){c=b;break}b=b.ng()}for(b=this;null!==b;)ko(b,!1),b=b.ng();return c};t.Fi=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this.Ya.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.ng=function(){var a=this.lh;if(null===a)return null;if(a instanceof V)return a;var b=!0;a=this.diagram;null!==a&&(b=a.isTreePathToChildren);a=this.Ya.iterator;if(b)for(;a.next();){if(b=a.value,b.isTreeLink&&(b=b.fromNode,b!==this))return this.lh=b}else for(;a.next();)if(b=a.value,b.isTreeLink&&(b=b.toNode,b!==this))return this.lh=b;return this.lh=null};t.Sy=function(){function a(b,d){if(null!==b){d.add(b);var c=b.Fi();null!==c&&(d.add(c),a(b.ng(),d))}}var b=new F;a(this,b);return b};
t.Ry=function(){return Ao(this,this)};function Ao(a,b){b=b.ng();return null===b?0:1+Ao(a,b)}t.Rp=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=new zb(this.Ya);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.Vu=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);var c=b=null,d=this.Ya.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 yb(c):xb};
t.Ty=function(a){void 0===a&&(a=Infinity);var b=new F;Gk(b,this,!1,a,!0);return b};V.prototype.collapseTree=function(a){void 0===a&&(a=1);1>a&&(a=1);var b=this.diagram;if(null!==b&&!b.De){b.De=!0;var c=new F;c.add(this);Bo(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===pi);b.De=!1}};function Bo(a,b,c,d,e,f,g){if(1<d)for(var h=c?a.Pp():a.sd();h.next();){var k=h.value;k.isTreeLink&&(k=k.Us(a),null===k||k===a||b.contains(k)||(b.add(k),Bo(k,b,c,d-1,e,f,g)))}else Co(a,b,c,e,f,g)}
function Co(a,b,c,d,e,f){for(var g=e===a?!0:a.isTreeExpanded,h=c?a.Pp():a.sd();h.next();){var k=h.value;if(k.isTreeLink&&(k=k.Us(a),null!==k&&k!==a)){var l=b.contains(k);l||b.add(k);g&&(f&&d.Gp(k,e),k.wh(),k.Mb(!1));k.isTreeExpanded&&(k.wasTreeExpanded=k.isTreeExpanded,l||Co(k,b,c,d,e,f))}}a.isTreeExpanded=!1}
V.prototype.expandTree=function(a){void 0===a&&(a=2);2>a&&(a=2);var b=this.diagram;if(null!==b&&!b.De){b.De=!0;var c=new F;c.add(this);Do(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===pi);b.De=!1}};
function Do(a,b,c,d,e,f,g){for(var h=f===a?!1:a.isTreeExpanded,k=c?a.Pp():a.sd();k.next();){var l=k.value;l.isTreeLink&&(h||l.Kc||l.Ra(),l=l.Us(a),null!==l&&l!==a&&!b.contains(l)&&(b.add(l),h||(l.Mb(!0),l.wh(),g&&e.Hp(l,f)),2<d||l.wasTreeExpanded))&&(l.wasTreeExpanded=!1,Do(l,b,c,d-1,e,f,g))}a.isTreeExpanded=!0}
pa.Object.defineProperties(V.prototype,{portSpreading:{get:function(){return this.No},set:function(a){var b=this.No;b!==a&&(this.No=a,this.g("portSpreading",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.ed())}},avoidable:{get:function(){return 0!==(this.Z&8)},set:function(a){var b=0!==(this.Z&8);if(b!==a){this.Z^=8;var c=this.diagram;null!==c&&nk(c,this);this.g("avoidable",b,a)}}},avoidableMargin:{
get:function(){return this.zk},set:function(a){"number"===typeof a&&(a=new Ic(a));var b=this.zk;if(!b.A(a)){this.zk=a=a.I();var c=this.diagram;null!==c&&nk(c,this);this.g("avoidableMargin",b,a)}}},linksConnected:{get:function(){return this.Ya.iterator}},linkConnected:{get:function(){return this.$n},set:function(a){var b=this.$n;b!==a&&(this.$n=a,this.g("linkConnected",b,a))}},linkDisconnected:{get:function(){return this.ao},
set:function(a){var b=this.ao;b!==a&&(this.ao=a,this.g("linkDisconnected",b,a))}},linkValidation:{get:function(){return this.hi},set:function(a){var b=this.hi;b!==a&&(this.hi=a,this.g("linkValidation",b,a))}},isLinkLabel:{get:function(){return null!==this.dl}},labeledLink:{get:function(){return this.dl},set:function(a){var b=this.dl;if(b!==a){var c=this.diagram,d=this.data;if(null!==b){null!==b.$c&&(b.$c.remove(this),
b.o());if(null!==c&&null!==d&&!c.undoManager.isUndoingRedoing){var e=b.data,f=c.model;if(null!==e&&f.cm()){var g=f.pa(d);void 0!==g&&f.wx(e,g)}}this.containingGroup=null}this.dl=a;null!==a&&(yo(a,this),null===c||null===d||c.undoManager.isUndoingRedoing||(e=a.data,c=c.model,null!==e&&c.cm()&&(d=c.pa(d),void 0!==d&&c.Du(e,d))),this.containingGroup=a.containingGroup);ql(this);this.g("labeledLink",b,a)}}},port:{get:function(){return this.Qs("")}},ports:{
get:function(){null===this.rc&&zo(this);return this.rc.iteratorValues}},isTreeExpanded:{get:function(){return 0!==(this.Z&1)},set:function(a){var b=0!==(this.Z&1);if(b!==a){this.Z^=1;var c=this.diagram;this.g("isTreeExpanded",b,a);b=this.treeExpandedChanged;if(null!==b){var d=!0;null!==c&&(d=c.da,c.da=!0);b(this);null!==c&&(c.da=d)}null!==c&&c.undoManager.isUndoingRedoing?this.Mb(a):a?this.expandTree():this.collapseTree()}}},wasTreeExpanded:{
get:function(){return 0!==(this.Z&2)},set:function(a){var b=0!==(this.Z&2);b!==a&&(this.Z^=2,this.g("wasTreeExpanded",b,a))}},treeExpandedChanged:{get:function(){return this.zp},set:function(a){var b=this.zp;b!==a&&(this.zp=a,this.g("treeExpandedChanged",b,a))}},isTreeLeaf:{get:function(){return 0!==(this.Z&4)},set:function(a){var b=0!==(this.Z&4);b!==a&&(this.Z^=4,this.g("isTreeLeaf",b,a))}}});V.prototype.expandTree=V.prototype.expandTree;
V.prototype.collapseTree=V.prototype.collapseTree;V.prototype.findTreeParts=V.prototype.Ty;V.prototype.findTreeChildrenNodes=V.prototype.Vu;V.prototype.findTreeChildrenLinks=V.prototype.Rp;V.prototype.findTreeLevel=V.prototype.Ry;V.prototype.findTreeParentChain=V.prototype.Sy;V.prototype.findTreeParentNode=V.prototype.ng;V.prototype.findTreeParentLink=V.prototype.Fi;V.prototype.findCommonTreeParent=V.prototype.Fy;V.prototype.findTreeRoot=V.prototype.Uy;V.prototype.isInTreeOf=V.prototype.nz;
V.prototype.findPort=V.prototype.Qs;V.prototype.findLinksTo=V.prototype.Jy;V.prototype.findLinksBetween=V.prototype.Iy;V.prototype.findNodesInto=V.prototype.Tu;V.prototype.findNodesOutOf=V.prototype.Uu;V.prototype.findNodesConnected=V.prototype.Su;V.prototype.findLinksInto=V.prototype.sd;V.prototype.findLinksOutOf=V.prototype.Pp;V.prototype.findLinksConnected=V.prototype.Ru;V.prototype.invalidateConnectedLinks=V.prototype.ed;V.prototype.invalidateLinkBundle=V.prototype.lz;
var Eo=new D(V,"SpreadingNone",10),so=new D(V,"SpreadingEvenly",11),Fo=new D(V,"SpreadingPacked",12);V.className="Node";V.SpreadingNone=Eo;V.SpreadingEvenly=so;V.SpreadingPacked=Fo;function hg(a){V.call(this,a);this.Z|=4608;this.lo=new F;this.nl=new F;this.Va=this.qp=this.ii=this.mo=this.ko=null;this.gc=new wi;this.gc.group=this}oa(hg,V);
hg.prototype.cloneProtected=function(a){V.prototype.cloneProtected.call(this,a);this.Z=this.Z&-32769;a.ko=this.ko;a.mo=this.mo;a.ii=this.ii;a.qp=this.qp;var b=a.Wl(function(a){return a instanceof Wg});b instanceof Wg?a.Va=b:a.Va=null;null!==this.gc?(a.gc=this.gc.copy(),a.gc.group=a):(null!==a.gc&&(a.gc.group=null),a.gc=null)};t=hg.prototype;
t.nf=function(a){V.prototype.nf.call(this,a);var b=a.Yj();for(a=a.memberParts;a.next();){var c=a.value;c.o();c.B(8);c.Pj();if(c instanceof V)c.ed(b);else if(c instanceof S)for(c=c.labelNodes;c.next();)c.value.ed(b)}};
t.kk=function(a,b,c,d,e,f,g){if(a===cf&&"elements"===b)if(e instanceof Wg)null===this.Va?this.Va=e:this.Va!==e&&A("Cannot insert a second Placeholder into the visual tree of a Group.");else{if(e instanceof X){var h=e.Wl(function(a){return a instanceof Wg});h instanceof Wg&&(null===this.Va?this.Va=h:this.Va!==h&&A("Cannot insert a second Placeholder into the visual tree of a Group."))}}else a===df&&"elements"===b&&null!==this.Va&&(d===this.Va?this.Va=null:d instanceof X&&this.Va.pg(d)&&(this.Va=null));
V.prototype.kk.call(this,a,b,c,d,e,f,g)};t.qh=function(a,b,c,d){this.Ve=this.Va;V.prototype.qh.call(this,a,b,c,d)};t.Ni=function(){if(!V.prototype.Ni.call(this))return!1;for(var a=this.memberParts;a.next();){var b=a.value;if(b instanceof V){if(b.isVisible()&&nj(b))return!1}else if(b instanceof S&&b.isVisible()&&nj(b)&&b.fromNode!==this&&b.toNode!==this)return!1}return!0};
function lo(a,b){if(a.lo.add(b)){b instanceof hg&&a.nl.add(b);var c=a.memberAdded;if(null!==c){var d=!0,e=a.diagram;null!==e&&(d=e.da,e.da=!0);c(a,b);null!==e&&(e.da=d)}a.isVisible()&&a.isSubGraphExpanded||b.Mb(!1)}b instanceof S&&!a.computesBoundsIncludingLinks||(b=a.Va,null===b&&(b=a),b.o())}
function mo(a,b){if(a.lo.remove(b)){b instanceof hg&&a.nl.remove(b);var c=a.memberRemoved;if(null!==c){var d=!0,e=a.diagram;null!==e&&(d=e.da,e.da=!0);c(a,b);null!==e&&(e.da=d)}a.isVisible()&&a.isSubGraphExpanded||b.Mb(!0)}b instanceof S&&!a.computesBoundsIncludingLinks||(b=a.Va,null===b&&(b=a),b.o())}t.Vj=function(){if(0<this.lo.count){var a=this.diagram;if(null!==a)for(var b=this.lo.copy().iterator;b.next();)a.remove(b.value)}V.prototype.Vj.call(this)};
hg.prototype.canAddMembers=function(a){var b=this.diagram;if(null===b)return!1;b=b.commandHandler;for(a=Ik(a).iterator;a.next();)if(!b.isValidMember(this,a.value))return!1;return!0};hg.prototype.addMembers=function(a,b){var c=this.diagram;if(null===c)return!1;c=c.commandHandler;var d=!0;for(a=Ik(a).iterator;a.next();){var e=a.value;!b||c.isValidMember(this,e)?e.containingGroup=this:d=!1}return d};
hg.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=hg.prototype;
t.ed=function(a){void 0===a&&(a=null);var b=0!==(this.Z&65536);V.prototype.ed.call(this,a);if(!b)for(0!==(this.Z&65536)!==!0&&(this.Z=this.Z^65536),b=this.Qu();b.next();){var c=b.value;if(null===a||!a.contains(c)){var d=c.fromNode;null!==d&&d!==this&&d.Ud(this)&&!d.isVisible()?(vo(d,c.fromPort),vo(d,c.toPort),c.Ra()):(d=c.toNode,null!==d&&d!==this&&d.Ud(this)&&!d.isVisible()&&(vo(d,c.fromPort),vo(d,c.toPort),c.Ra()))}}};
t.Qu=function(){var a=this.Yj();a.add(this);for(var b=new F,c=a.iterator;c.next();){var d=c.value;if(d instanceof V)for(d=d.linksConnected;d.next();){var e=d.value;a.contains(e)||b.add(e)}}return b.iterator};t.Hy=function(){var a=this.Yj();a.add(this);for(var b=new F,c=a.iterator;c.next();){var d=c.value;if(d instanceof V)for(d=d.linksConnected;d.next();){var e=d.value,f=e.fromNode;a.contains(f)&&f!==this||b.add(f);e=e.toNode;a.contains(e)&&e!==this||b.add(e)}}return b.iterator};
t.Gy=function(){function a(b,d){null!==b&&(d.add(b),a(b.containingGroup,d))}var b=new F;a(this,b);return b};t.Yj=function(){var a=new F;Gk(a,this,!0,0,!0);a.remove(this);return a};t.Mb=function(a){V.prototype.Mb.call(this,a);for(var b=this.memberParts;b.next();)b.value.Mb(a)};hg.prototype.collapseSubGraph=function(){var a=this.diagram;if(null!==a&&!a.De){a.De=!0;var b=this.Yj();Go(this,b,a,this);a.De=!1}};
function Go(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Mb(!1);f instanceof hg&&f.isSubGraphExpanded&&(f.wasSubGraphExpanded=f.isSubGraphExpanded,Go(f,b,c,d));if(f instanceof V)f.ed(b),c.Gp(f,d);else if(f instanceof S)for(f=f.labelNodes;f.next();)f.value.ed(b)}a.isSubGraphExpanded=!1}hg.prototype.expandSubGraph=function(){var a=this.diagram;if(null!==a&&!a.De){a.De=!0;var b=this.Yj();Ho(this,b,a,this);a.De=!1}};
function Ho(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Mb(!0);f instanceof hg&&f.wasSubGraphExpanded&&(f.wasSubGraphExpanded=!1,Ho(f,b,c,d));if(f instanceof V)f.ed(b),c.Hp(f,d);else if(f instanceof S)for(f=f.labelNodes;f.next();)f.value.ed(b)}a.isSubGraphExpanded=!0}
hg.prototype.move=function(a,b){void 0===b&&(b=!1);var c=b?this.location:this.position,d=c.x;isNaN(d)&&(d=0);c=c.y;isNaN(c)&&(c=0);d=a.x-d;c=a.y-c;var e=G.allocAt(d,c);V.prototype.move.call(this,a,b);a=new F;for(b=this.Yj().iterator;b.next();){var f=b.value;f instanceof S&&(f.suspendsRouting&&a.add(f),f.Kc||f.fromNode!==this&&f.toNode!==this)&&(f.suspendsRouting=!0)}for(b.reset();b.next();)if(f=b.value,!(f.xh()||f instanceof V&&f.isLinkLabel)){var g=f.position,h=f.location;g.s()?(e.x=g.x+d,e.y=g.y+
c,f.position=e):h.s()&&(e.x=h.x+d,e.y=h.y+c,f.location=e)}for(b.reset();b.next();)if(f=b.value,f instanceof S&&(f.suspendsRouting=a.contains(f),f.Kc||f.fromNode!==this&&f.toNode!==this))g=f.position,e.x=g.x+d,e.y=g.y+c,e.s()?f.move(e):f.Ra(),Lj(f)&&f.Ra();G.free(e)};
pa.Object.defineProperties(hg.prototype,{placeholder:{get:function(){return this.Va}},computesBoundsAfterDrag:{get:function(){return 0!==(this.Z&2048)},set:function(a){var b=0!==(this.Z&2048);b!==a&&(this.Z^=2048,this.g("computesBoundsAfterDrag",b,a))}},computesBoundsIncludingLinks:{get:function(){return 0!==(this.Z&4096)},set:function(a){var b=0!==(this.Z&4096);b!==a&&(this.Z^=4096,this.g("computesBoundsIncludingLinks",
b,a))}},computesBoundsIncludingLocation:{get:function(){return 0!==(this.Z&8192)},set:function(a){var b=0!==(this.Z&8192);b!==a&&(this.Z^=8192,this.g("computesBoundsIncludingLocation",b,a))}},handlesDragDropForMembers:{get:function(){return 0!==(this.Z&16384)},set:function(a){var b=0!==(this.Z&16384);b!==a&&(this.Z^=16384,this.g("handlesDragDropForMembers",b,a))}},memberParts:{get:function(){return this.lo.iterator}},
layout:{get:function(){return this.gc},set:function(a){var b=this.gc;if(b!==a){null!==b&&(b.diagram=null,b.group=null);this.gc=a;var c=this.diagram;null!==a&&(a.diagram=c,a.group=this);null!==c&&(c.yg=!0);this.g("layout",b,a);null!==c&&c.cc()}}},memberAdded:{get:function(){return this.ko},set:function(a){var b=this.ko;b!==a&&(this.ko=a,this.g("memberAdded",b,a))}},memberRemoved:{get:function(){return this.mo},
set:function(a){var b=this.mo;b!==a&&(this.mo=a,this.g("memberRemoved",b,a))}},memberValidation:{get:function(){return this.ii},set:function(a){var b=this.ii;b!==a&&(this.ii=a,this.g("memberValidation",b,a))}},ungroupable:{get:function(){return 0!==(this.Z&256)},set:function(a){var b=0!==(this.Z&256);b!==a&&(this.Z^=256,this.g("ungroupable",b,a))}},isSubGraphExpanded:{get:function(){return 0!==(this.Z&512)},
set:function(a){var b=0!==(this.Z&512);if(b!==a){this.Z^=512;var c=this.diagram;this.g("isSubGraphExpanded",b,a);b=this.subGraphExpandedChanged;if(null!==b){var d=!0;null!==c&&(d=c.da,c.da=!0);b(this);null!==c&&(c.da=d)}null!==c&&c.undoManager.isUndoingRedoing?(null!==this.Va&&this.Va.o(),this.memberParts.each(function(a){a.updateAdornments()})):a?this.expandSubGraph():this.collapseSubGraph()}}},wasSubGraphExpanded:{get:function(){return 0!==(this.Z&1024)},set:function(a){var b=
0!==(this.Z&1024);b!==a&&(this.Z^=1024,this.g("wasSubGraphExpanded",b,a))}},subGraphExpandedChanged:{get:function(){return this.qp},set:function(a){var b=this.qp;b!==a&&(this.qp=a,this.g("subGraphExpandedChanged",b,a))}},jk:{get:function(){return 0!==(this.Z&32768)},set:function(a){0!==(this.Z&32768)!==a&&(this.Z^=32768)}}});hg.prototype.expandSubGraph=hg.prototype.expandSubGraph;hg.prototype.collapseSubGraph=hg.prototype.collapseSubGraph;
hg.prototype.findSubGraphParts=hg.prototype.Yj;hg.prototype.findContainingGroupChain=hg.prototype.Gy;hg.prototype.findExternalNodesConnected=hg.prototype.Hy;hg.prototype.findExternalLinksConnected=hg.prototype.Qu;hg.className="Group";function Wg(){Y.call(this);this.eb=Oc;this.ap=new L(NaN,NaN,NaN,NaN)}oa(Wg,Y);Wg.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.eb=this.eb.I();a.ap=this.ap.copy()};
Wg.prototype.sh=function(a){if(null===this.background&&null===this.areaBackground)return!1;var b=this.naturalBounds;return Cc(0,0,b.width,b.height,a.x,a.y)};
Wg.prototype.fm=function(){var a=this.part;null!==a&&(a instanceof hg||a instanceof pf)||A("Placeholder is not inside a Group or Adornment.");if(a instanceof hg){var b=this.computeBorder(this.ap),c=this.minSize,d=this.hc;sc(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);Wk(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.isAnimating||
isNaN(b.x)||isNaN(b.y)||(c=G.alloc(),c.Ri(b,a.locationSpot),c.A(a.location)||(a.location=new G(c.x,c.y)),G.free(c))}else{b=this.hc;c=this.eb;d=c.left+c.right;var e=c.top+c.bottom,f=a.adornedObject;a.angle=f.Hi();var g=0;f instanceof W&&(g=f.strokeWidth);var h=f.Be(),k=f.naturalBounds,l=(k.width+g)*h;g=(k.height+g)*h;a.type!==X.Link&&(f=f.ma("Selection"===a.category?Tc:a.locationSpot,G.alloc()),a.location=f,G.free(f));isNaN(l)||isNaN(g)?(a=a.adornedObject,l=a.ma(Tc,G.alloc()),f=L.allocAt(l.x,l.y,0,
0),f.He(a.ma(hd,l)),f.He(a.ma(Vc,l)),f.He(a.ma(fd,l)),sc(b,f.width+d||0,f.height+e||0),Wk(this,-c.left,-c.top,b.width,b.height),G.free(l),L.free(f)):(sc(b,l+d||0,g+e||0),Wk(this,-c.left,-c.top,b.width,b.height))}};Wg.prototype.qh=function(a,b,c,d){this.actualBounds.h(a,b,c,d)};
Wg.prototype.computeBorder=function(a){var b=this.part,c=b.diagram;if(null!==c&&b instanceof hg&&!b.layer.isTemporary&&b.computesBoundsAfterDrag&&this.ap.s()){var d=c.toolManager.findTool("Dragging");if(d===c.currentTool&&(c=d.computeBorder(b,this.ap,a),null!==c))return c}c=L.alloc();d=this.computeMemberBounds(c);var e=this.eb;b instanceof hg&&!b.isSubGraphExpanded?a.h(d.x-e.left,d.y-e.top,0,0):a.h(d.x-e.left,d.y-e.top,Math.max(d.width+e.left+e.right,0),Math.max(d.height+e.top+e.bottom,0));L.free(c);
b instanceof hg&&b.computesBoundsIncludingLocation&&b.location.s()&&a.He(b.location);return a};
Wg.prototype.computeMemberBounds=function(a){if(!(this.part instanceof hg))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(mj(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};pa.Object.defineProperties(Wg.prototype,{padding:{get:function(){return this.eb},set:function(a){"number"===typeof a&&(a=new Ic(a));var b=this.eb;b.A(a)||(this.eb=a=a.I(),this.g("padding",b,a))}}});Wg.className="Placeholder";
function S(){T.call(this,X.Link);this.Ta=8;this.Ne=null;this.Oe="";this.ff=this.Cn=null;this.gf="";this.yp=null;this.Jm=Ng;this.dn=0;this.gn=Ng;this.hn=NaN;this.Cj=Io;this.mp=.5;this.$c=null;this.xb=(new E).freeze();this.ul=this.Xg=null;this.tl=new L;this.qa=new $d;this.wr=!0;this.K=this.u=this.wf=this.Ff=null;this.l=[];this.wu=new G;this.ir=this.Iw=this.Hw=null;this.Xt=NaN;this.P=null}oa(S,T);
S.prototype.cloneProtected=function(a){T.prototype.cloneProtected.call(this,a);a.Ta=this.Ta&-113;a.Oe=this.Oe;a.Cn=this.Cn;a.gf=this.gf;a.yp=this.yp;a.Jm=this.Jm;a.dn=this.dn;a.gn=this.gn;a.hn=this.hn;a.Cj=this.Cj;a.mp=this.mp;null!==this.P&&(a.P=this.P.copy())};t=S.prototype;t.nf=function(a){T.prototype.nf.call(this,a);this.Oe=a.Oe;this.gf=a.gf;a.Xg=null;a.Ra();a.wf=this.wf;var b=a.fromPort;null!==b&&vo(a.fromNode,b);b=a.toPort;null!==b&&vo(a.toNode,b)};
t.fb=function(a){a.classType===S?2===(a.value&2)?this.routing=a:a===Qg||a===Mg||a===Lg?this.curve=a:a===Jo||a===Ko||a===Lo?this.adjusting=a:a!==Io&&a!==Ng&&A("Unknown Link enum value for a Link property: "+a):T.prototype.fb.call(this,a)};t.Hc=function(){null===this.P&&(this.P=new Sk)};t.Ni=function(){var a=this.fromNode;if(null!==a){var b=a.findVisibleNode();null!==b&&(a=b);if(nj(a)||oj(a))return!1}a=this.toNode;return null!==a&&(b=a.findVisibleNode(),null!==b&&(a=b),nj(a)||oj(a))?!1:!0};t.Gv=function(){return!1};
t.Hv=function(){};t.Lb=function(){return!1};S.prototype.computeAngle=function(a,b,c){return S.computeAngle(b,c)};S.computeAngle=function(a,b){switch(a){default:case Ng:a=0;break;case pn:a=b;break;case Am:a=b+90;break;case Cm:a=b-90;break;case Mo:a=b+180;break;case No:a=H.cq(b);90<a&&270>a&&(a-=180);break;case Bm:a=H.cq(b+90);90<a&&270>a&&(a-=180);break;case Dm:a=H.cq(b-90);90<a&&270>a&&(a-=180);break;case Em:a=H.cq(b);if(45<a&&135>a||225<a&&315>a)return 0;90<a&&270>a&&(a-=180)}return H.cq(a)};
function ro(a){var b=a.fromNode,c=a.toNode,d=null;null!==b?d=null!==c?b.bx(c):b.containingGroup:null!==c?d=c.containingGroup:d=null;b=d;c=a.Qh;if(c!==b){null!==c&&mo(c,a);a.Qh=b;null!==b&&lo(b,a);var e=a.containingGroupChanged;if(null!==e){var f=!0,g=a.diagram;null!==g&&(f=g.da,g.da=!0);e(a,c,b);null!==g&&(g.da=f)}!a.Kc||a.Hw!==c&&a.Iw!==c||a.Ra()}if(a.isLabeledLink)for(a=a.labelNodes;a.next();)a.value.containingGroup=d}t=S.prototype;
t.wh=function(){var a=this.containingGroup;null!==a&&this.fromNode!==a&&this.toNode!==a&&a.computesBoundsIncludingLinks&&T.prototype.wh.call(this)};t.Us=function(a){var b=this.fromNode;return a===b?this.toNode:b};t.$y=function(a){var b=this.fromPort;return a===b?this.toPort:b};function yo(a,b){null===a.$c&&(a.$c=new F);a.$c.add(b);a.o()}
t.Vp=function(a){T.prototype.Vp.call(this,a);Oo(this)&&this.Xp(this.actualBounds);if(!a){a=this.Ne;var b=null;null!==a&&(b=this.fromPort,wo(a,this,b));var c=this.ff;if(null!==c){var d=this.toPort;c===a&&d===b||wo(c,this,d)}Po(this)}};t.Wp=function(a){T.prototype.Wp.call(this,a);Oo(this)&&this.Xp(this.actualBounds);if(!a){a=this.Ne;var b=null;null!==a&&(b=this.fromPort,xo(a,this,b));var c=this.ff;if(null!==c){var d=this.toPort;c===a&&d===b||xo(c,this,d)}Qo(this)}};
t.Vj=function(){this.Kc=!0;if(null!==this.$c){var a=this.diagram;if(null!==a)for(var b=this.$c.copy().iterator;b.next();)a.remove(b.value)}null!==this.data&&(a=this.diagram,null!==a&&a.partManager.removeDataForLink(this))};S.prototype.updateRelationshipsFromData=function(){if(null!==this.data){var a=this.diagram;null!==a&&a.partManager.updateRelationshipsFromData(this)}};
S.prototype.move=function(a,b){var c=b?this.location:this.position,d=c.x;isNaN(d)&&(d=0);var e=c.y;isNaN(e)&&(e=0);d=a.x-d;e=a.y-e;!0===b?T.prototype.move.call(this,a,!1):(a=G.allocAt(c.x+d,c.y+e),T.prototype.move.call(this,a,!1),G.free(a));Zf(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(ec),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()===Qg))return this.qa.Yu(.5,a),a.add(this.i(0)),c=this.qa.figures.first(),a.offset(-c.startX,-c.startY),a;if(this.computeCurve()===Qg){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);H.ly(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).Wa(this.i(1));if(this.isOrthogonal&&(15<=this.computeCorner()||this.computeCurve()===Qg)){a:{a=this.qa;var b=.5;0>b?b=0:1<b&&(b=1);if(a.type===ge)a=180*Math.atan2(a.endY-a.startY,a.endX-a.startX)/Math.PI;else{var c=a.flattenedSegments,d=a.flattenedLengths,e=c.length;b=a.flattenedTotalLength*b;for(var f=0,g=0;g<e;g++){var h=d[g],k=h.length;for(a=0;a<k;a++){var l=h[a];if(f+l>=b){b=c[g];c=b[2*a];
d=b[2*a+1];e=b[2*a+2];a=b[2*a+3];a=1>Math.abs(e-c)&&1>Math.abs(a-d)?0:1>Math.abs(e-c)?0<=a-d?90:270:1>Math.abs(a-d)?0<=e-c?0:180:180*Math.atan2(a-d,e-c)/Math.PI;break a}f+=l}}a=NaN}}return a}if(this.computeCurve()===Qg&&4<=a){d=(a-1)/3|0;c=3*(d/2|0);if(1===d%2)return c=Math.floor(c),a=this.i(c),d=this.i(c+1),e=this.i(c+2),c=this.i(c+3),H.ky(a.x,a.y,d.x,d.y,e.x,e.y,c.x,c.y);if(0<c&&c+1<a)return this.i(c-1).Wa(this.i(c+1))}d=this.flattenedLengths;e=this.flattenedTotalLength;for(c=b=0;b<e/2&&c<a;){f=
d[c];if(b+f>e/2)break;b+=f;c++}d=this.i(c);e=this.i(c+1);if(1>Math.abs(d.x-e.x)&&1>Math.abs(d.y-e.y)){if(0<c&&c+2<a)return this.i(c-1).Wa(this.i(c+2))}else{if(1>Math.abs(d.x-e.x))return d.y>e.y?270:90;if(1>Math.abs(d.y-e.y))return d.x>e.x?180:0}return d.Wa(e)};t=S.prototype;t.i=function(a){return this.xb.j[a]};t.jd=function(a,b){this.xb.gd(a,b)};t.M=function(a,b,c){this.xb.gd(a,new G(b,c))};t.jz=function(a,b){this.xb.Ib(a,b)};t.m=function(a,b,c){this.xb.Ib(a,new G(b,c))};t.xe=function(a){this.xb.add(a)};
t.kf=function(a,b){this.xb.add(new G(a,b))};t.vv=function(a){this.xb.mb(a)};t.Qj=function(){this.xb.clear()};function Zf(a,b,c){if(0!==b||0!==c){for(var d=a.Kc,e=new E,f=a.xb.iterator;f.next();){var g=f.value;e.add((new G(g.x+b,g.y+c)).freeze())}e.freeze();f=a.xb;a.xb=e;isNaN(b)||isNaN(c)||a.diagram.animationManager.rb?a.o():(a.Mf.h(a.Mf.x+b,a.Mf.y+c),a.sa.h(a.sa.x+b,a.sa.y+c),ql(a));d&&Ro(a);b=a.diagram;null!==b&&b.animationManager.rb&&(a.ul=e);a.g("points",f,e)}}
t.Ah=function(){null===this.Xg&&(this.Xg=this.xb,this.xb=this.xb.copy())};
t.lf=function(){if(null!==this.Xg){for(var a=this.Xg,b=this.xb,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.bc();break}}else this.o(),this.bc();this.Xg=null;c=this.diagram;null!==c&&c.animationManager.rb&&(this.ul=b);Ro(this);this.g("points",
a,b)}};t.yx=function(){null!==this.Xg&&(this.xb=this.Xg,this.Xg=null)};function Ro(a){0===a.xb.count?a.Kc=!1:(a.Kc=!0,a.ir=null,a.Xt=NaN,a.defaultFromPoint=a.i(0),a.defaultToPoint=a.i(a.pointsCount-1),So(a,!1))}t.Ra=function(){if(!this.suspendsRouting){var a=this.diagram;a&&(a.dt.contains(this)||a.undoManager.isUndoingRedoing||a.animationManager.isTicking&&!a.animationManager.isAnimating)||(a=this.path,null!==a&&(this.Kc=!1,this.o(),a.o()))}};
t.Wi=function(){if(!this.Kc&&!this.Lu){var a=!0;try{this.Lu=!0,this.Ah(),a=this.computePoints()}finally{this.Lu=!1,a?this.lf():this.yx()}}};
S.prototype.computePoints=function(){var a=this.diagram;if(null===a)return!1;var b=this.fromNode,c=null;null===b?(a.ni||(a.Wo=new W,a.Wo.desiredSize=fc,a.Wo.strokeWidth=0,a.ni=new V,a.ni.add(a.Wo),a.ni.ac()),this.defaultFromPoint&&(a.ni.position=a.ni.location=this.defaultFromPoint,a.ni.ac(),b=a.ni,c=a.Wo)):c=this.fromPort;if(null!==c&&!b.isVisible()){var d=b.findVisibleNode();null!==d&&d!==b?(b=d,c=d.port):b=d}this.Hw=b;if(null===b||!b.location.s())return!1;for(;!(null===c||c.actualBounds.s()&&c.rf());)c=
c.panel;if(null===c)return!1;var e=this.toNode,f=null;null===e?(a.oi||(a.Xo=new W,a.Xo.desiredSize=fc,a.Xo.strokeWidth=0,a.oi=new V,a.oi.add(a.Xo),a.oi.ac()),this.defaultToPoint&&(a.oi.position=a.oi.location=this.defaultToPoint,a.oi.ac(),e=a.oi,f=a.Xo)):f=this.toPort;null===f||e.isVisible()||(a=e.findVisibleNode(),null!==a&&a!==e?(e=a,f=a.port):e=a);this.Iw=e;if(null===e||!e.location.s())return!1;for(;!(null===f||f.actualBounds.s()&&f.rf());)f=f.panel;if(null===f)return!1;var g=this.pointsCount;d=
this.computeSpot(!0,c);a=this.computeSpot(!1,f);var h=To(d),k=To(a),l=c===f&&null!==c,m=this.isOrthogonal,n=this.curve===Qg;this.Ff=l&&!m?n=!0:!1;var p=this.adjusting===Ng||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.Qj(),n){g=this.getLinkPoint(b,c,d,!0,!1,e,f);p=this.getLinkPoint(e,
f,a,!1,!1,b,c);h=p.x-g.x;k=p.y-g.y;l=this.computeCurviness();n=m=0;var q=g.x+h/3,r=g.y+k/3,u=q,x=r;H.w(k,0)?x=0<h?x-l:x+l:(m=-h/k,n=Math.sqrt(l*l/(m*m+1)),0>l&&(n=-n),u=(0>k?-1:1)*n+q,x=m*(u-q)+r);q=g.x+2*h/3;r=g.y+2*k/3;var v=q,y=r;H.w(k,0)?y=0<h?y-l:y+l:(v=(0>k?-1:1)*n+q,y=m*(v-q)+r);this.Qj();this.xe(g);this.kf(u,x);this.kf(v,y);this.xe(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,H.w(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.xe(d),this.kf(g,h)):this.xe(d),this.xe(a)}else{n=this.isAvoiding;p&&(m&&n||l)&&this.Qj();var z=l?this.computeCurviness():0;n=this.getLinkPoint(b,c,d,!0,m,e,f);q=u=r=0;if(m||!h||l)x=this.computeEndSegmentLength(b,c,d,!0),q=this.getLinkDirection(b,c,n,d,!0,m,e,f),l&&(h||d.A(a)||!m&&1===d.x+
a.x&&1===d.y+a.y)&&(q-=m?90:30,0>z&&(q-=180)),0>q?q+=360:360<=q&&(q-=360),l&&(x+=Math.abs(z)*(m?1:2)),0===q?r=x:90===q?u=x:180===q?r=-x:270===q?u=-x:(r=x*Math.cos(q*Math.PI/180),u=x*Math.sin(q*Math.PI/180)),d.kc()&&l&&(x=c.ma(dd,G.alloc()),v=G.allocAt(x.x+1E3*r,x.y+1E3*u),this.getLinkPointFromPoint(b,c,x,v,!0,n),G.free(x),G.free(v));x=this.getLinkPoint(e,f,a,!1,m,b,c);var B=y=v=0;if(m||!k||l){var C=this.computeEndSegmentLength(e,f,a,!1);B=this.getLinkDirection(e,f,x,a,!1,m,b,c);l&&(k||d.A(a)||!m&&
1===d.x+a.x&&1===d.y+a.y)&&(B+=m?0:30,0>z&&(B+=180));0>B?B+=360:360<=B&&(B-=360);l&&(C+=Math.abs(z)*(m?1:2));0===B?v=C:90===B?y=C:180===B?v=-C:270===B?y=-C:(v=C*Math.cos(B*Math.PI/180),y=C*Math.sin(B*Math.PI/180));a.kc()&&l&&(a=f.ma(dd,G.alloc()),d=G.allocAt(a.x+1E3*v,a.y+1E3*y),this.getLinkPointFromPoint(e,f,a,d,!1,x),G.free(a),G.free(d))}a=n;if(m||!h||l)a=new G(n.x+r,n.y+u);d=x;if(m||!k||l)d=new G(x.x+v,x.y+y);!p&&!m&&h&&3<g&&this.adjustPoints(0,n,g-2,d)?this.jd(g-1,x):!p&&!m&&k&&3<g&&this.adjustPoints(1,
a,g-1,x)?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,x)):(this.Qj(),this.xe(n),(m||!h||l)&&this.xe(a),m&&this.addOrthoPoints(a,q,d,B,b,e),(m||!k||l)&&this.xe(d),this.xe(x))}return!0};function Uo(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 G);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.Yd()||(e=e.panel);if(null===e){e=d.x;d=d.y;var g=c.x;c=c.y}else{a=e.rd;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.Zj(e,d,g,c,f);null!==
a&&f.transform(a);return f};function Vo(a,b){var c=b.Mo;null===c&&(c=new Wo,c.port=b,c.node=b.part,b.Mo=c);return Xo(c,a)}
S.prototype.getLinkPoint=function(a,b,c,d,e,f,g,h){void 0===h&&(h=new G);if(c.gb()&&!To(c))return b.ma(c,h),h;if(c.qf()){var k=Vo(this,b);if(null!==k){h.assign(k.$p);if(e&&this.routing===Yo){var l=Vo(this,g);if(null!==l&&k.Ul<l.Ul){k=G.alloc();l=G.alloc();var m=new L(b.ma(Tc,k),b.ma(hd,l)),n=this.computeSpot(!d,g);a=this.getLinkPoint(f,g,n,!d,e,a,b,l);(c.pf(jd)||c.pf(pd))&&a.y>=m.y&&a.y<=m.y+m.height?h.y=a.y:(c.pf(id)||c.pf(qd))&&a.x>=m.x&&a.x<=m.x+m.width&&(h.x=a.x);G.free(k);G.free(l)}}return h}}c=
b.ma(.5===c.x&&.5===c.y?c:dd,G.alloc());this.pointsCount>(e?6:2)?(g=d?this.i(1):this.i(this.pointsCount-2),e&&(g=Uo(c,g.copy()))):(k=this.computeSpot(!d,g),f=G.alloc(),g=g.ma(.5===k.x&&.5===k.y?k:dd,f),e&&(g=Uo(c,g)),G.free(f));this.getLinkPointFromPoint(a,b,c,g,d,h);G.free(c);return h};
S.prototype.getLinkDirection=function(a,b,c,d,e,f,g,h){a:if(d.gb())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.qf()&&(k=Vo(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.ma(dd,G.alloc());this.pointsCount>(f?6:2)?(h=e?this.i(1):this.i(this.pointsCount-2),h=f?Uo(k,h.copy()):c):(c=G.alloc(),h=h.ma(dd,c),G.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;G.free(k);k=c}d.kc()&&g.Ud(a)&&(k+=180,360<=k&&(k-=360));if(To(d))return k;a=b.Hi();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.qf()&&(a=Vo(this,b),null!==a))return a.Pu;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=dd:(b=this.fromSpot,b.Kb()&&(b=a.fromSpot),a=b===Ed?Sc:b)):(a=b?b:this.toPort,null===a?a=dd:(b=this.toSpot,b.Kb()&&(b=a.toSpot),a=b===Ed?Sc:b));return a};function To(a){return a===Sc||.5===a.x&&.5===a.y}S.prototype.computeOtherPoint=function(a,b){a=b.ma(dd);b=b.Mo;b=null!==b?Xo(b,this):null;null!==b&&(a=b.$p);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.lg=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=Qc.alloc(),g.reset());g.multiply(this.transform);if(this.rh(a,g))return Tm(this,b,c,e),void 0===f&&Qc.free(g),!0;if(this.Ic(a,g)){var h=!1;if(!this.isAtomic)for(var k=this.W.j,l=k.length;l--;){var m=k[l];if(m.visible||m===this.locationObject){var n=m.actualBounds,p=this.naturalBounds;if(!(n.x>p.width||n.y>p.height||0>n.x+n.width||0>n.y+n.height)){n=Qc.alloc();n.set(g);
if(m instanceof X)h=m.lg(a,b,c,d,e,n);else if(this.path===m){if(m instanceof W){h=m;p=a;var q=d;if(!1===h.pickable)h=!1;else if(n.multiply(h.transform),q)b:{var r=p,u=n;if(h.rh(r,u))h=!0;else{if(void 0===u&&(u=h.transform,r.mf(h.actualBounds))){h=!0;break b}p=r.left;q=r.right;var x=r.top;r=r.bottom;var v=G.alloc(),y=G.alloc(),z=G.alloc(),B=Qc.alloc();B.set(u);B.iv(h.transform);B.Zs();y.x=q;y.y=x;y.transform(B);v.x=p;v.y=x;v.transform(B);u=!1;nn(h,v,y,z)?u=!0:(v.x=q,v.y=r,v.transform(B),nn(h,v,y,z)?
u=!0:(y.x=p,y.y=r,y.transform(B),nn(h,v,y,z)?u=!0:(v.x=p,v.y=x,v.transform(B),nn(h,v,y,z)&&(u=!0))));Qc.free(B);G.free(v);G.free(y);G.free(z);h=u}}else h=h.rh(p,n)}}else h=Yk(m,a,d,n);h&&(null!==b&&(m=b(m)),m&&(null===c||c(m))&&e.add(m));Qc.free(n)}}}void 0===f&&Qc.free(g);return h||null!==this.background||null!==this.areaBackground}void 0===f&&Qc.free(g);return!1};
S.prototype.computeCurve=function(){if(null===this.Ff){var a=this.fromPort,b=this.isOrthogonal;this.Ff=null!==a&&a===this.toPort&&!b}return this.Ff?Qg:this.curve};S.prototype.computeCorner=function(){if(this.curve===Qg)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===pn||d===No||d===Mo?a=Math.max(a,e):d===Cm||d===Dm||d===Am||d===Bm?a=Math.max(a,g):(b=b.ma(dd).Wa(c.ma(dd))/180*Math.PI,a=Math.max(a,
Math.abs(Math.sin(b)*g)+Math.abs(Math.cos(b)*e)+1));this.curve===Qg&&(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.adjusting===Ng&&c.Ra()}};
S.prototype.computeCurviness=function(){var a=this.curviness;if(isNaN(a)){a=16;var b=this.wf;if(null!==b){for(var c=Ka(),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.gt===this.fromNode&&(a=-a);Oa(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.wf};
S.prototype.adjustPoints=function(a,b,c,d){var e=this.adjusting;if(this.isOrthogonal){if(e===Ko)return!1;e===Lo&&(e=Jo)}switch(e){case Ko:var f=this.i(a),g=this.i(c);if(!f.Qa(b)||!g.Qa(d)){e=f.x;f=f.y;var h=g.x-e,k=g.y-f,l=Math.sqrt(h*h+k*k);if(!H.ca(l,0)){if(H.ca(h,0))var m=0>k?-Math.PI/2:Math.PI/2;else m=Math.atan(k/Math.abs(h)),0>h&&(m=Math.PI-m);g=b.x;var n=b.y;h=d.x-g;var p=d.y-n;k=Math.sqrt(h*h+p*p);H.ca(h,0)?p=0>p?-Math.PI/2:Math.PI/2:(p=Math.atan(p/Math.abs(h)),0>h&&(p=Math.PI-p));l=k/l;m=
p-m;this.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),H.ca(b,0)||(H.ca(h,0)?k=0>k?-Math.PI/2:Math.PI/2:(k=Math.atan(k/Math.abs(h)),0>h&&(k=Math.PI-k)),h=k+m,b*=l,this.M(a,g+b*Math.cos(h),n+b*Math.sin(h)));this.jd(c,d)}}return!0;case Lo:f=this.i(a);n=this.i(c);if(!f.Qa(b)||!n.Qa(d)){e=f.x;f=f.y;g=n.x;n=n.y;l=(g-e)*(g-e)+(n-f)*(n-f);h=b.x;m=b.y;k=d.x;p=d.y;var q=1;if(0!==k-h){var r=(p-m)/(k-h);q=Math.sqrt(1+1/(r*r))}else r=9E9;this.jd(a,b);for(a+=1;a<c;a++){b=this.i(a);
var u=b.x,x=b.y,v=.5;0!==l&&(v=((e-u)*(e-g)+(f-x)*(f-n))/l);var y=e+v*(g-e),z=f+v*(n-f);b=Math.sqrt((u-y)*(u-y)+(x-z)*(x-z));x<r*(u-y)+z&&(b=-b);0<r&&(b=-b);u=h+v*(k-h);v=m+v*(p-m);0!==r?(b=u+b/q,this.M(a,b,v-(b-u)/r)):this.M(a,u,v+b)}this.jd(c,d)}return!0;case Jo: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,H.w(e.y,f.y)?H.w(f.x,g.x)?m=b.y:H.w(f.y,g.y)&&(h=b.x):H.w(e.x,f.x)&&(H.w(f.y,g.y)?h=b.x:H.w(f.x,g.x)&&(m=b.y)),this.M(a+1,h,m),e=this.i(c),f=this.i(c-
1),g=this.i(c-2),h=f.x,m=f.y,k=h,p=m,H.w(e.y,f.y)?H.w(f.x,g.x)?m=d.y:H.w(f.y,g.y)&&(h=d.x):H.w(e.x,f.x)&&(H.w(f.y,g.y)?h=d.x:H.w(f.x,g.x)&&(m=d.y)),this.M(c-1,h,m),Lj(this))){this.M(a+1,n,l);this.M(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.s()&&h.s()){g.Tc(8,8);h.Tc(8,8);g.He(a);h.He(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 G(c.x,a.y);var l=new G(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 G(a.x,c.y);l=new G((a.x+c.x)/2,c.y);if(180===d||90===d&&c.y<g.top||270===d&&c.y>g.bottom)180===d&&(h.ea(a)||g.ea(c))?k.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):
c.y<a.y&&(180===d||90===d)?k.y=this.computeMidOrthoPosition(a.x,g.top,c.x,Math.max(c.y,h.bottom),!0):c.y>a.y&&(180===d||270===d)&&(k.y=this.computeMidOrthoPosition(a.x,g.bottom,c.x,Math.min(c.y,h.top),!0)),l.x=c.x,l.y=k.y;if(k.y>g.top&&k.y<g.bottom)if(c.x>=g.left&&c.x<=a.x||a.x<=h.right&&a.x>=c.x){if(90===d||270===d)k=new G(Math.max((a.x+c.x)/2,a.x),a.y),l=new G(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 G(c.x,a.y),l=new G(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 G(a.x,c.y);l=new G((a.x+c.x)/2,c.y);if(0===d||90===d&&c.y<g.top||270===d&&c.y>g.bottom)0===d&&(h.ea(a)||g.ea(c))?k.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):c.y<a.y&&(0===d||90===d)?k.y=this.computeMidOrthoPosition(a.x,g.top,c.x,Math.max(c.y,h.bottom),!0):c.y>a.y&&(0===d||270===d)&&(k.y=this.computeMidOrthoPosition(a.x,g.bottom,c.x,Math.min(c.y,h.top),!0)),l.x=c.x,l.y=k.y;if(k.y>g.top&&k.y<g.bottom)if(c.x<=
g.right&&c.x>=a.x||a.x>=h.left&&a.x<=c.x){if(90===d||270===d)k=new G(Math.min((a.x+c.x)/2,a.x),a.y),l=new G(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 G(a.x,c.y),l=new G((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 G(c.x,a.y);l=new G(c.x,(a.y+c.y)/2);if(270===d||0===d&&c.x<g.left||180===d&&c.x>g.right)270===d&&(h.ea(a)||g.ea(c))?k.x=this.computeMidOrthoPosition(a.x,
a.y,c.x,c.y,!1):c.x<a.x&&(270===d||0===d)?k.x=this.computeMidOrthoPosition(g.left,a.y,Math.max(c.x,h.right),c.y,!1):c.x>a.x&&(270===d||180===d)&&(k.x=this.computeMidOrthoPosition(g.right,a.y,Math.min(c.x,h.left),c.y,!1)),l.x=k.x,l.y=c.y;if(k.x>g.left&&k.x<g.right)if(c.y>=g.top&&c.y<=a.y||a.y<=h.bottom&&a.y>=c.y){if(0===d||180===d)k=new G(a.x,Math.max((a.y+c.y)/2,a.y)),l=new G(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 G(a.x,c.y),l=new G((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 G(c.x,a.y);l=new G(c.x,(a.y+c.y)/2);if(90===d||0===d&&c.x<g.left||180===d&&c.x>g.right)90===d&&(h.ea(a)||g.ea(c))?k.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):c.x<a.x&&(90===d||0===d)?k.x=this.computeMidOrthoPosition(g.left,a.y,Math.max(c.x,h.right),c.y,!1):c.x>a.x&&(90===d||180===d)&&(k.x=this.computeMidOrthoPosition(g.right,a.y,Math.min(c.x,h.left),c.y,!1)),l.x=k.x,l.y=c.y;if(k.x>g.left&&
k.x<g.right)if(c.y<=g.bottom&&c.y>=a.y||a.y>=h.top&&a.y<=c.y){if(0===d||180===d)k=new G(a.x,Math.min((a.y+c.y)/2,a.y)),l=new G(c.x,k.y)}else k.x=180===d||(90===d||270===d)&&c.x<a.x?Math.min(c.x,270===d?g.left:Math.min(g.left,h.left)):Math.max(c.x,270===d?g.right:Math.max(g.right,h.right)),l.x=k.x,l.y=c.y}var m=k,n=l,p=c;if(this.isAvoiding){var q=this.diagram;if(null===q||!hk(q)||g.ea(p)&&!f.Ud(e)||h.ea(a)&&!e.Ud(f)||e===f||this.layer.isTemporary)b=!1;else{var r=ik(q,!0,this.containingGroup,null);
if(r.bk(Math.min(a.x,m.x),Math.min(a.y,m.y),Math.abs(a.x-m.x),Math.abs(a.y-m.y))&&r.bk(Math.min(m.x,n.x),Math.min(m.y,n.y),Math.abs(m.x-n.x),Math.abs(m.y-n.y))&&r.bk(Math.min(n.x,p.x),Math.min(n.y,p.y),Math.abs(n.x-p.x),Math.abs(n.y-p.y)))b=!1;else{e=a;f=p;var u=c=null;if(q.isVirtualized){q=r.bounds.copy();q.Tc(-r.Sl,-r.Rl);var x=G.alloc();Zo(r,a.x,a.y)||(H.Sc(q.x,q.y,q.x+q.width,q.y+q.height,a.x,a.y,m.x,m.y,x)?(c=a=x.copy(),b=x.Wa(m)):H.Sc(q.x,q.y,q.x+q.width,q.y+q.height,m.x,m.y,n.x,n.y,x)?(c=a=
x.copy(),b=x.Wa(n)):H.Sc(q.x,q.y,q.x+q.width,q.y+q.height,n.x,n.y,p.x,p.y,x)&&(c=a=x.copy(),b=x.Wa(p)));Zo(r,p.x,p.y)||(H.Sc(q.x,q.y,q.x+q.width,q.y+q.height,p.x,p.y,n.x,n.y,x)?(u=p=x.copy(),d=n.Wa(x)):H.Sc(q.x,q.y,q.x+q.width,q.y+q.height,n.x,n.y,m.x,m.y,x)?(u=p=x.copy(),d=m.Wa(x)):H.Sc(q.x,q.y,q.x+q.width,q.y+q.height,m.x,m.y,a.x,a.y,x)&&(u=p=x.copy(),d=a.Wa(x)));G.free(x)}g=g.copy().Uc(h);h=r.Nz;g.Tc(r.Sl*h,r.Rl*h);$o(r,a,b,p,d,g);h=ap(r,p.x,p.y);!r.abort&&h>=bp&&(lk(r),h=r.rz,g.Tc(r.Sl*h,r.Rl*
h),$o(r,a,b,p,d,g),h=ap(r,p.x,p.y));!r.abort&&h>=bp&&r.Tz&&(lk(r),$o(r,a,b,p,d,r.bounds),h=ap(r,p.x,p.y));if(!r.abort&&h<bp&&ap(r,p.x,p.y)!==cp){dp(this,r,p.x,p.y,d,!0);g=this.i(2);if(4>this.pointsCount)0===b||180===b?(g.x=a.x,g.y=p.y):(g.x=p.x,g.y=a.y),this.M(2,g.x,g.y),this.m(3,g.x,g.y);else if(p=this.i(3),0===b||180===b)H.w(g.x,p.x)?(g=0===b?Math.max(g.x,a.x):Math.min(g.x,a.x),this.M(2,g,a.y),this.M(3,g,p.y)):H.w(g.y,p.y)?(Math.abs(a.y-g.y)<=r.Rl/2&&(this.M(2,g.x,a.y),this.M(3,p.x,a.y)),this.m(2,
g.x,a.y)):this.M(2,a.x,g.y);else if(90===b||270===b)H.w(g.y,p.y)?(g=90===b?Math.max(g.y,a.y):Math.min(g.y,a.y),this.M(2,a.x,g),this.M(3,p.x,g)):H.w(g.x,p.x)?(Math.abs(a.x-g.x)<=r.Sl/2&&(this.M(2,a.x,g.y),this.M(3,a.x,p.y)),this.m(2,a.x,g.y)):this.M(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.kf(f.x,u.y):this.kf(u.x,f.y));b=!0}else b=!1}}}else b=
!1;b||(this.xe(k),this.xe(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 Lj(a){if(null===a.diagram||!a.isAvoiding||!hk(a.diagram))return!1;var b=a.points.j,c=b.length;if(4>c)return!1;a=ik(a.diagram,!0,a.containingGroup,null);for(var d=1;d<c-2;d++){var e=b[d],f=b[d+1];if(!a.bk(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 dp(a,b,c,d,e,f){var g=b.Sl,h=b.Rl,k=ap(b,c,d),l=c,m=d;for(0===e?l+=g:90===e?m+=h:180===e?l-=g:m-=h;k>ep&&ap(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>ep)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>ep&&(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),ap(b,l,m)===k-1?dp(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),ap(b,l,m)===k-1&&dp(a,b,l,m,f,!1)));a.kf(c,d)}S.prototype.Dy=function(a){var b=a.x;a=a.y;for(var c=this.i(0),d=this.i(1),e=Rb(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=Rb(b,a,d.x,d.y,c.x,c.y);d=c;h<e&&(f=g,e=h)}return f};S.prototype.bc=function(){this.wr=!0};
S.prototype.dk=function(a){if(!a){if(!1===this.Kc)return;a=this.zb();if(!this.wr&&(null===a||null!==a.geometry))return}this.qa=this.makeGeometry();a=this.path;if(null!==a){a.qa=this.qa;for(var b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d];e!==a&&e.isPanelMain&&e instanceof W&&(e.qa=this.qa)}}};
S.prototype.makeGeometry=function(){var a=this.qa,b=this.pointsCount;if(2>b)return a.type=ge,a;var c=!1,d=this.diagram;null!==d&&Oo(this)&&d.Vh.contains(this)&&(0!==this.tl.width||0!==this.tl.height)&&(c=!0);var e=this.i(0).copy(),f=e.copy();d=this.xb.j;var g=this.computeCurve();if(g===Qg&&3<=b&&!H.ca(this.smoothness,0))if(3===b){var h=this.i(1);d=Math.min(e.x,h.x);var k=Math.min(e.y,h.y);h=this.i(2);d=Math.min(d,h.x);k=Math.min(k,h.y)}else{if(this.isOrthogonal)for(k=0;k<b;k++)h=d[k],f.x=Math.min(h.x,
f.x),f.y=Math.min(h.y,f.y);else for(d=3;d<b;d+=3)d+3>=b&&(d=b-1),k=this.i(d),f.x=Math.min(k.x,f.x),f.y=Math.min(k.y,f.y);d=f.x;k=f.y}else{for(k=0;k<b;k++)h=d[k],f.x=Math.min(h.x,f.x),f.y=Math.min(h.y,f.y);d=f.x;k=f.y}d-=this.wu.x;k-=this.wu.y;e.x-=d;e.y-=k;if(2!==b||Oo(this)){a.type=ae;h=ne(a);0!==this.computeShortLength(!0)&&(e=fp(this,e,!0,f));oe(h,e.x,e.y,!1);if(g===Qg&&3<=b&&!H.ca(this.smoothness,0))if(3===b)c=this.i(1),b=c.x-d,c=c.y-k,e=this.i(2).copy(),e.x-=d,e.y-=k,0!==this.computeShortLength(!1)&&
(e=fp(this,e,!1,f)),se(h,b,c,b,c,e.x,e.y);else if(this.isOrthogonal){f=new G(d,k);e=this.i(1).copy();g=new G(d,k);b=new G(d,k);c=this.i(0);for(var l,m=this.smoothness/3,n=1;n<this.pointsCount-1;n++){l=this.i(n);var p=c,q=l,r=this.i(gp(this,l,n,!1));if(!H.ca(p.x,q.x)||!H.ca(q.x,r.x))if(!H.ca(p.y,q.y)||!H.ca(q.y,r.y)){var u=m;isNaN(u)&&(u=this.smoothness/3);var x=p.x;p=p.y;var v=q.x;q=q.y;var y=r.x;r=r.y;var z=u*hp(x,p,v,q);u*=hp(v,q,y,r);H.ca(p,q)&&H.ca(v,y)&&(v>x?r>q?(g.x=v-z,g.y=q-z,b.x=v+u,b.y=
q+u):(g.x=v-z,g.y=q+z,b.x=v+u,b.y=q-u):r>q?(g.x=v+z,g.y=q-z,b.x=v-u,b.y=q+u):(g.x=v+z,g.y=q+z,b.x=v-u,b.y=q-u));H.ca(x,v)&&H.ca(q,r)&&(q>p?(y>v?(g.x=v-z,g.y=q-z,b.x=v+u):(g.x=v+z,g.y=q-z,b.x=v-u),b.y=q+u):(y>v?(g.x=v-z,g.y=q+z,b.x=v+u):(g.x=v+z,g.y=q+z,b.x=v-u),b.y=q-u));if(H.ca(x,v)&&H.ca(v,y)||H.ca(p,q)&&H.ca(q,r))x=.5*(x+y),p=.5*(p+r),g.x=x,g.y=p,b.x=x,b.y=p;1===n?(e.x=.5*(c.x+l.x),e.y=.5*(c.y+l.y)):2===n&&H.ca(c.x,this.i(0).x)&&H.ca(c.y,this.i(0).y)&&(e.x=.5*(c.x+l.x),e.y=.5*(c.y+l.y));se(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=fp(this,e.copy(),!1,ac));f=.5*(f+e.x);c=.5*(c+e.y);se(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=fp(this,g.copy(),!1,ac)),se(h,f.x-d,f.y-k,e.x-d,e.y-k,g.x-d,g.y-k);else{f=G.alloc();f.assign(this.i(0));g=1;for(e=0;g<b;){g=gp(this,f,g,1<g);m=this.i(g);if(g>=
b-1){if(!f.A(m))0!==this.computeShortLength(!1)&&(m=fp(this,m.copy(),!1,ac)),ip(this,h,-d,-k,f,m,c);else if(0===e)for(g=1;g<b;)m=this.i(g++),ip(this,h,-d,-k,f,m,c),f.assign(m);break}e=gp(this,m,g+1,g<b-3);g=-d;l=-k;n=this.i(e);x=c;H.w(f.y,m.y)&&H.w(m.x,n.x)?(p=this.computeCorner(),p=Math.min(p,Math.abs(m.x-f.x)/2),p=u=Math.min(p,Math.abs(n.y-m.y)/2),H.w(p,0)?(ip(this,h,g,l,f,m,x),f.assign(m)):(v=m.x,q=m.y,y=v,r=q,m.x>f.x?v=m.x-p:v=m.x+p,n.y>m.y?r=m.y+u:r=m.y-u,ip(this,h,g,l,f,new G(v,q),x),te(h,m.x+
g,m.y+l,y+g,r+l),f.h(y,r))):H.w(f.x,m.x)&&H.w(m.y,n.y)?(p=this.computeCorner(),p=Math.min(p,Math.abs(m.y-f.y)/2),p=u=Math.min(p,Math.abs(n.x-m.x)/2),H.w(u,0)?(ip(this,h,g,l,f,m,x),f.assign(m)):(v=m.x,q=m.y,y=v,r=q,m.y>f.y?q=m.y-p:q=m.y+p,n.x>m.x?y=m.x+u:y=m.x-u,ip(this,h,g,l,f,new G(v,q),x),te(h,m.x+g,m.y+l,y+g,r+l),f.h(y,r))):(ip(this,h,g,l,f,m,x),f.assign(m));g=e}G.free(f)}we=h}else h=this.i(1).copy(),h.x-=d,h.y-=k,0!==this.computeShortLength(!0)&&(e=fp(this,e,!0,f)),0!==this.computeShortLength(!1)&&
(h=fp(this,h,!1,f)),a.type=ge,a.startX=e.x,a.startY=e.y,a.endX=h.x,a.endY=h.y;return a};function hp(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 H.ca(a,0)?b:H.ca(b,0)?a:Math.sqrt(a*a+b*b)}
function fp(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=hp(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=hp(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 gp(a,b,c,d){for(var e=a.pointsCount,f=b;H.ca(b.x,f.x)&&H.ca(b.y,f.y);){if(c>=e)return e-1;f=a.i(c++)}if(!H.ca(b.x,f.x)&&!H.ca(b.y,f.y))return c-1;for(var g=f;H.ca(b.x,f.x)&&H.ca(f.x,g.x)&&(!d||(b.y>=f.y?f.y>=g.y:f.y<=g.y))||H.ca(b.y,f.y)&&H.ca(f.y,g.y)&&(!d||(b.x>=f.x?f.x>=g.x:f.x<=g.x));){if(c>=e)return e-1;g=a.i(c++)}return c-2}
function ip(a,b,c,d,e,f,g){if(!g&&Oo(a)){g=[];var h=0;a.isVisible()&&(h=jp(a,e,f,g));if(0<h)if(H.w(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===Mg?oe(b,n,p,!1):se(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===Mg?oe(b,l,n,!1):se(b,m,k,l,k,l,n)}else if(H.w(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===Mg?oe(b,p,l,!1):se(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===Mg?oe(b,n,k,!1):se(b,l,m,l,k,n,k)}}b.lineTo(f.x+c,f.y+d)}
function jp(a,b,c,d){var e=a.diagram;if(null===e||b.A(c))return 0;for(e=e.layers;e.next();){var f=e.value;if(null!==f&&f.visible){f=f.Fa.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()&&Oo(k)){var l=k.routeBounds;l.s()&&a.routeBounds.Ic(l)&&!a.usesSamePort(k)&&(l=k.path,null!==l&&l.rf()&&kp(b,c,d,k))}}}}}0<d.length&&d.sort(function(a,b){return a-b});return d.length}
function kp(a,b,c,d){for(var e=H.w(a.y,b.y),f=d.pointsCount,g=d.i(0),h=G.alloc(),k=1;k<f;k++){var l=d.i(k);if(k<f-1){var m=d.i(k+1);if(g.y===l.y&&l.y===m.y){if(l.x>g.x&&m.x>=l.x||l.x<g.x&&m.x<=l.x)continue}else if(g.x===l.x&&l.x===m.x&&(l.y>g.y&&m.y>=l.y||l.y<g.y&&m.y<=l.y))continue}a:{m=a.x;var n=a.y,p=b.x,q=b.y,r=g.x;g=g.y;var u=l.x,x=l.y;if(!H.w(m,p)){if(H.w(n,q)&&H.w(r,u)&&Math.min(m,p)<r&&Math.max(m,p)>r&&Math.min(g,x)<n&&Math.max(g,x)>n&&!H.w(g,x)){h.x=r;h.y=n;m=!0;break a}}else if(!H.w(n,q)&&
H.w(g,x)&&Math.min(n,q)<g&&Math.max(n,q)>g&&Math.min(r,u)<m&&Math.max(r,u)>m&&!H.w(r,u)){h.x=m;h.y=g;m=!0;break a}h.x=0;h.y=0;m=!1}m&&(e?c.push(h.x):c.push(h.y));g=l}G.free(h)}function Oo(a){a=a.curve;return a===Lg||a===Mg}function So(a,b){if(b||Oo(a))b=a.diagram,null===b||b.Si||b.Vh.contains(a)||0===a.tl.width&&0===a.tl.height||b.Vh.add(a,a.tl)}
S.prototype.Xp=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.Fa.j;for(var g=e.length,h=0;h<g;h++){var k=e[h];k instanceof S&&(k===this?f=!0:f&&lp(this,k,a))}}else if(d)for(f=e.Fa.j,e=f.length,g=0;g<e;g++)h=f[g],h instanceof S&&lp(this,h,a)}}}};
function lp(a,b,c){if(null!==b&&null!==b.qa&&Oo(b)){var d=b.routeBounds;d.s()&&(a.routeBounds.Ic(d)||c.Ic(d))&&(a.usesSamePort(b)||b.bc())}}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.Qa(e))return!0;b=this.i(b-1);a=a.i(c-1);if(b.Qa(a)||d.Qa(a)||b.Qa(e))return!0}else if(this.fromNode===a.fromNode||this.toNode===a.toNode||this.fromNode===a.toNode||this.toNode===a.fromNode)return!0;return!1};
S.prototype.isVisible=function(){if(!T.prototype.isVisible.call(this))return!1;var a=this.containingGroup,b=!0,c=this.diagram;null!==c&&(b=c.isTreePathToChildren);c=this.fromNode;if(null!==c){if(this.isTreeLink&&b&&!c.isTreeExpanded)return!1;if(c===a)return!0;for(var d=c;null!==d;){if(d.labeledLink===this)return!0;d=d.containingGroup}c=c.findVisibleNode();if(null===c||c===a)return!1}c=this.toNode;if(null!==c){if(this.isTreeLink&&!b&&!c.isTreeExpanded)return!1;if(c===a)return!0;for(b=c;null!==b;){if(b.labeledLink===
this)return!0;b=b.containingGroup}b=c.findVisibleNode();if(null===b||b===a)return!1}return!0};S.prototype.Mb=function(a){T.prototype.Mb.call(this,a);null!==this.wf&&this.wf.am();if(null!==this.$c)for(var b=this.$c.iterator;b.next();)b.value.Mb(a)};
function Po(a){var b=a.Ne;if(null!==b){var c=a.ff;if(null!==c){for(var d=a.Oe,e=a.gf,f=a=null,g=b.Ya.j,h=g.length,k=0;k<h;k++){var l=g[k];if(l.Ne===b&&l.Oe===d&&l.ff===c&&l.gf===e||l.Ne===c&&l.Oe===e&&l.ff===b&&l.gf===d)null===f?f=l:(null===a&&(a=[],a.push(f)),a.push(l))}if(null!==a){f=uo(b,c,d,e);null===f&&(f=new mp(b,d,c,e),to(b,f),to(c,f));f.links=a;for(b=0;b<a.length;b++)a[b].wf=f;f.am()}}}}function Qo(a){var b=a.wf;null!==b&&(a.wf=null,a=b.links.indexOf(a),0<=a&&(Ja(b.links,a),b.am()))}
S.prototype.xh=function(){return!0};
pa.Object.defineProperties(S.prototype,{fromNode:{get:function(){return this.Ne},set:function(a){var b=this.Ne;if(b!==a){var c=this.fromPort;null!==b&&(this.ff!==b&&xo(b,this,c),Qo(this),this.B(2));this.Ne=a;null!==a&&this.Mb(a.isVisible());this.Ff=null;this.Ra();var d=this.diagram;null!==d&&d.partManager.setFromNodeForLink(this,a,b);var e=this.fromPort,f=this.fromPortChanged;if(null!==f){var g=!0;null!==d&&(g=d.da,d.da=!0);f(this,c,e);null!==d&&(d.da=g)}null!==a&&(this.ff!==
a&&wo(a,this,e),Po(this),this.B(1));this.g("fromNode",b,a);ro(this)}}},fromPortId:{get:function(){return this.Oe},set:function(a){var b=this.Oe;if(b!==a){var c=this.fromPort;null!==c&&vo(this.fromNode,c);Qo(this);this.Oe=a;var d=this.fromPort;null!==d&&vo(this.fromNode,d);var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.cm()&&g.Cx(f,a)}c!==d&&(this.Ff=null,this.Ra(),f=this.fromPortChanged,null!==f&&(g=!0,null!==e&&(g=e.da,e.da=!0),f(this,c,d),null!==
e&&(e.da=g)));Po(this);this.g("fromPortId",b,a)}}},fromPort:{get:function(){var a=this.Ne;return null===a?null:a.Qs(this.Oe)}},fromPortChanged:{get:function(){return this.Cn},set:function(a){var b=this.Cn;b!==a&&(this.Cn=a,this.g("fromPortChanged",b,a))}},toNode:{get:function(){return this.ff},set:function(a){var b=this.ff;if(b!==a){var c=this.toPort;null!==b&&(this.Ne!==b&&xo(b,this,c),Qo(this),this.B(2));this.ff=
a;null!==a&&this.Mb(a.isVisible());this.Ff=null;this.Ra();var d=this.diagram;null!==d&&d.partManager.setToNodeForLink(this,a,b);var e=this.toPort,f=this.toPortChanged;if(null!==f){var g=!0;null!==d&&(g=d.da,d.da=!0);f(this,c,e);null!==d&&(d.da=g)}null!==a&&(this.Ne!==a&&wo(a,this,e),Po(this),this.B(1));this.g("toNode",b,a);ro(this)}}},toPortId:{get:function(){return this.gf},set:function(a){var b=this.gf;if(b!==a){var c=this.toPort;null!==c&&vo(this.toNode,c);Qo(this);
this.gf=a;var d=this.toPort;null!==d&&vo(this.toNode,d);var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.cm()&&g.Gx(f,a)}c!==d&&(this.Ff=null,this.Ra(),f=this.toPortChanged,null!==f&&(g=!0,null!==e&&(g=e.da,e.da=!0),f(this,c,d),null!==e&&(e.da=g)));Po(this);this.g("toPortId",b,a)}}},toPort:{get:function(){var a=this.ff;return null===a?null:a.Qs(this.gf)}},toPortChanged:{get:function(){return this.yp},set:function(a){var b=
this.yp;b!==a&&(this.yp=a,this.g("toPortChanged",b,a))}},fromSpot:{get:function(){return null!==this.P?this.P.Kg:Ed},set:function(a){this.Hc();var b=this.P.Kg;b.A(a)||(a=a.I(),this.P.Kg=a,this.g("fromSpot",b,a),this.Ra())}},fromEndSegmentLength:{get:function(){return null!==this.P?this.P.Ig:NaN},set:function(a){this.Hc();var b=this.P.Ig;b!==a&&(0>a&&xa(a,">= 0",S,"fromEndSegmentLength"),this.P.Ig=a,this.g("fromEndSegmentLength",b,a),this.Ra())}},
fromShortLength:{get:function(){return null!==this.P?this.P.Jg:NaN},set:function(a){this.Hc();var b=this.P.Jg;b!==a&&(this.P.Jg=a,this.g("fromShortLength",b,a),this.Ra(),this.bc())}},toSpot:{get:function(){return null!==this.P?this.P.kh:Ed},set:function(a){this.Hc();var b=this.P.kh;b.A(a)||(a=a.I(),this.P.kh=a,this.g("toSpot",b,a),this.Ra())}},toEndSegmentLength:{get:function(){return null!==this.P?this.P.ih:
NaN},set:function(a){this.Hc();var b=this.P.ih;b!==a&&(0>a&&xa(a,">= 0",S,"toEndSegmentLength"),this.P.ih=a,this.g("toEndSegmentLength",b,a),this.Ra())}},toShortLength:{get:function(){return null!==this.P?this.P.jh:NaN},set:function(a){this.Hc();var b=this.P.jh;b!==a&&(this.P.jh=a,this.g("toShortLength",b,a),this.Ra(),this.bc())}},isLabeledLink:{get:function(){return null===this.$c?!1:0<this.$c.count}},labelNodes:{
get:function(){return null===this.$c?xb:this.$c.iterator}},relinkableFrom:{get:function(){return 0!==(this.Ta&1)},set:function(a){var b=0!==(this.Ta&1);b!==a&&(this.Ta^=1,this.g("relinkableFrom",b,a),this.Jb())}},relinkableTo:{get:function(){return 0!==(this.Ta&2)},set:function(a){var b=0!==(this.Ta&2);b!==a&&(this.Ta^=2,this.g("relinkableTo",b,a),this.Jb())}},resegmentable:{get:function(){return 0!==(this.Ta&
4)},set:function(a){var b=0!==(this.Ta&4);b!==a&&(this.Ta^=4,this.g("resegmentable",b,a),this.Jb())}},isTreeLink:{get:function(){return 0!==(this.Ta&8)},set:function(a){var b=0!==(this.Ta&8);b!==a&&(this.Ta^=8,this.g("isTreeLink",b,a),null!==this.fromNode&&tk(this.fromNode),null!==this.toNode&&tk(this.toNode))}},path:{get:function(){var a=this.zb();return a instanceof W?a:null}},routeBounds:{get:function(){this.Wi();
var a=this.tl,b=Infinity,c=Infinity,d=this.pointsCount;if(0===d)a.h(NaN,NaN,0,0);else{if(1===d)d=this.i(0),b=Math.min(d.x,b),c=Math.min(d.y,c),a.h(d.x,d.y,0,0);else if(2===d){d=this.i(0);var e=this.i(1);b=Math.min(d.x,e.x);c=Math.min(d.y,e.y);a.h(d.x,d.y,0,0);a.He(e)}else if(this.computeCurve()===Qg&&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);H.Ql(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);H.Ql(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.He(f),e=2;e<d;e++)f=this.i(e),b=Math.min(f.x,b),c=Math.min(f.y,c),a.He(f);this.wu.h(b-a.x,c-a.y)}return a}},midPoint:{get:function(){this.Wi();return this.computeMidPoint(new G)}},midAngle:{
get:function(){this.Wi();return this.computeMidAngle()}},flattenedLengths:{get:function(){if(null===this.ir){this.Kc||Ro(this);for(var a=this.ir=[],b=this.pointsCount,c=0;c<b-1;c++){var d=this.i(c);var e=this.i(c+1);H.ca(d.x,e.x)?(d=e.y-d.y,0>d&&(d=-d)):H.ca(d.y,e.y)?(d=e.x-d.x,0>d&&(d=-d)):d=Math.sqrt(d.Ae(e));a.push(d)}}return this.ir}},flattenedTotalLength:{get:function(){var a=this.Xt;if(isNaN(a)){for(var b=this.flattenedLengths,
c=b.length,d=a=0;d<c;d++)a+=b[d];this.Xt=a}return a}},points:{get:function(){return this.xb},set:function(a){var b=this.xb;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 G(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(!Ca(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 G(e.x,e.y)).freeze())}}else if(a instanceof E)for(c=a.copy(),a=c.iterator;a.next();)a.value.freeze();else A("Link.points value is not an instance of List or Array: "+a);c.freeze();this.xb=c;this.bc();this.o();Ro(this);a=this.diagram;null!==a&&(a.Mi||a.undoManager.isUndoingRedoing||a.dt.add(this),a.animationManager.rb&&(this.ul=c));this.g("points",b,c)}}},pointsCount:{get:function(){return this.xb.count}},
Kc:{get:function(){return 0!==(this.Ta&16)},set:function(a){0!==(this.Ta&16)!==a&&(this.Ta^=16)}},suspendsRouting:{get:function(){return 0!==(this.Ta&32)},set:function(a){0!==(this.Ta&32)!==a&&(this.Ta^=32)}},Lu:{get:function(){return 0!==(this.Ta&64)},set:function(a){0!==(this.Ta&64)!==a&&(this.Ta^=64)}},defaultFromPoint:{get:function(){return this.u},set:function(a){this.u=a.copy()}},
defaultToPoint:{get:function(){return this.K},set:function(a){this.K=a.copy()}},isOrthogonal:{get:function(){return 2===(this.Cj.value&2)}},isAvoiding:{get:function(){return 4===(this.Cj.value&4)}},geometry:{get:function(){this.wr&&(this.Wi(),this.qa=this.makeGeometry(),this.wr=!1);return this.qa}},firstPickIndex:{get:function(){return 2>=this.pointsCount?
0:this.isOrthogonal||!To(this.computeSpot(!0))?1:0}},lastPickIndex:{get:function(){var a=this.pointsCount;return 0===a?0:2>=a?a-1:this.isOrthogonal||!To(this.computeSpot(!1))?a-2:a-1}},adjusting:{get:function(){return this.Jm},set:function(a){var b=this.Jm;b!==a&&(this.Jm=a,this.g("adjusting",b,a))}},corner:{get:function(){return this.dn},set:function(a){var b=this.dn;b!==a&&(this.dn=a,this.bc(),this.g("corner",
b,a))}},curve:{get:function(){return this.gn},set:function(a){var b=this.gn;b!==a&&(this.gn=a,this.Ra(),this.bc(),So(this,b===Mg||b===Lg||a===Mg||a===Lg),this.g("curve",b,a))}},curviness:{get:function(){return this.hn},set:function(a){var b=this.hn;b!==a&&(this.hn=a,this.Ra(),this.bc(),this.g("curviness",b,a))}},routing:{get:function(){return this.Cj},set:function(a){var b=this.Cj;b!==a&&(this.Cj=a,this.Ff=null,
this.Ra(),So(this,2===(b.value&2)||2===(a.value&2)),this.g("routing",b,a))}},smoothness:{get:function(){return this.mp},set:function(a){var b=this.mp;b!==a&&(this.mp=a,this.bc(),this.g("smoothness",b,a))}},key:{get:function(){var a=this.diagram;if(null!==a&&a.model.cm())return a.model.jc(this.data)}}});S.prototype.invalidateOtherJumpOvers=S.prototype.Xp;S.prototype.findClosestSegment=S.prototype.Dy;S.prototype.updateRoute=S.prototype.Wi;
S.prototype.invalidateRoute=S.prototype.Ra;S.prototype.rollbackRoute=S.prototype.yx;S.prototype.commitRoute=S.prototype.lf;S.prototype.startRoute=S.prototype.Ah;S.prototype.clearPoints=S.prototype.Qj;S.prototype.removePoint=S.prototype.vv;S.prototype.addPointAt=S.prototype.kf;S.prototype.addPoint=S.prototype.xe;S.prototype.insertPointAt=S.prototype.m;S.prototype.insertPoint=S.prototype.jz;S.prototype.setPointAt=S.prototype.M;S.prototype.setPoint=S.prototype.jd;S.prototype.getPoint=S.prototype.i;
S.prototype.getOtherPort=S.prototype.$y;S.prototype.getOtherNode=S.prototype.Us;
var Io=new D(S,"Normal",1),np=new D(S,"Orthogonal",2),op=new D(S,"AvoidsNodes",6),Yo=new D(S,"AvoidsNodesStraight",7),Ng=new D(S,"None",0),Qg=new D(S,"Bezier",9),Mg=new D(S,"JumpGap",10),Lg=new D(S,"JumpOver",11),Jo=new D(S,"End",17),Ko=new D(S,"Scale",18),Lo=new D(S,"Stretch",19),pn=new D(S,"OrientAlong",21),Am=new D(S,"OrientPlus90",22),Cm=new D(S,"OrientMinus90",23),Mo=new D(S,"OrientOpposite",24),No=new D(S,"OrientUpright",25),Bm=new D(S,"OrientPlus90Upright",26),Dm=new D(S,"OrientMinus90Upright",
27),Em=new D(S,"OrientUpright45",28);S.className="Link";S.Normal=Io;S.Orthogonal=np;S.AvoidsNodes=op;S.AvoidsNodesStraight=Yo;S.None=Ng;S.Bezier=Qg;S.JumpGap=Mg;S.JumpOver=Lg;S.End=Jo;S.Scale=Ko;S.Stretch=Lo;S.OrientAlong=pn;S.OrientPlus90=Am;S.OrientMinus90=Cm;S.OrientOpposite=Mo;S.OrientUpright=No;S.OrientPlus90Upright=Bm;S.OrientMinus90Upright=Dm;S.OrientUpright45=Em;function mp(a,b,c,d){mb(this);this.he=this.vr=!1;this.gt=a;this.ux=b;this.jv=c;this.vx=d;this.links=[]}
mp.prototype.am=function(){if(!this.vr){var a=this.links;0<a.length&&(a=a[0].diagram,null!==a&&(a.ww.add(this),this.he=a.undoManager.isUndoingRedoing))}this.vr=!0};mp.prototype.Uv=function(){if(this.vr){this.vr=!1;var a=this.links;if(0<a.length){var b=a[0],c=b.diagram;c=null===c||c.Mi&&!this.he;this.he=!1;b.arrangeBundledLinks(a,c);1===a.length&&(b.wf=null,a.length=0)}0===a.length&&(a=this.gt,null!==this&&null!==a.Ke&&a.Ke.remove(this),a=this.jv,null!==this&&null!==a.Ke&&a.Ke.remove(this))}};
mp.className="LinkBundle";function jk(){mb(this);this.Hx=this.group=null;this.Ys=!0;this.abort=!1;this.Jd=this.Hd=1;this.jo=this.io=-1;this.mc=this.lc=8;this.Bb=[[]];this.Jj=this.Ij=0;this.Tz=!1;this.Nz=22;this.rz=111}
jk.prototype.initialize=function(a){if(!(0>=a.width||0>=a.height)){var b=a.y,c=a.x+a.width,d=a.y+a.height;this.Hd=Math.floor((a.x-this.lc)/this.lc)*this.lc;this.Jd=Math.floor((b-this.mc)/this.mc)*this.mc;this.io=Math.ceil((c+2*this.lc)/this.lc)*this.lc;this.jo=Math.ceil((d+2*this.mc)/this.mc)*this.mc;a=1+(Math.ceil((this.io-this.Hd)/this.lc)|0);b=1+(Math.ceil((this.jo-this.Jd)/this.mc)|0);if(null===this.Bb||this.Ij<a-1||this.Jj<b-1){c=[];for(d=0;d<=a;d++)c[d]=[];this.Bb=c;this.Ij=a-1;this.Jj=b-1}a=
pp;if(null!==this.Bb)for(b=0;b<=this.Ij;b++)for(c=0;c<=this.Jj;c++)this.Bb[b][c]=a}};function Zo(a,b,c){return a.Hd<=b&&b<=a.io&&a.Jd<=c&&c<=a.jo}function ap(a,b,c){if(!Zo(a,b,c))return pp;b-=a.Hd;b/=a.lc;c-=a.Jd;c/=a.mc;return a.Bb[b|0][c|0]}function mk(a,b,c){Zo(a,b,c)&&(b-=a.Hd,b/=a.lc,c-=a.Jd,c/=a.mc,a.Bb[b|0][c|0]=cp)}function lk(a){if(null!==a.Bb)for(var b=0;b<=a.Ij;b++)for(var c=0;c<=a.Jj;c++)a.Bb[b][c]>=ep&&(a.Bb[b][c]=pp)}
jk.prototype.bk=function(a,b,c,d){if(a>this.io||a+c<this.Hd||b>this.jo||b+d<this.Jd)return!0;a=(a-this.Hd)/this.lc|0;b=(b-this.Jd)/this.mc|0;c=Math.max(0,c)/this.lc+1|0;var e=Math.max(0,d)/this.mc+1|0;0>a&&(c+=a,a=0);0>b&&(e+=b,b=0);if(0>c||0>e)return!0;d=Math.min(a+c-1,this.Ij)|0;for(c=Math.min(b+e-1,this.Jj)|0;a<=d;a++)for(e=b;e<=c;e++)if(this.Bb[a][e]===cp)return!1;return!0};
function qp(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>=ep&&n<bp)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)qp(a,b,c,1,!e,f,g,h,k),qp(a,b,c,-1,!e,f,g,h,k);else for(c+=d;c>l;c+=d)qp(a,b,c,1,!e,f,g,h,k),qp(a,b,c,-1,!e,f,g,h,k);else if(0<d)for(b+=d;b<l;b+=d)qp(a,b,c,1,!e,f,g,h,k),qp(a,b,c,-1,!e,f,g,h,k);else for(b+=d;b>l;b+=d)qp(a,b,c,1,!e,f,g,h,k),qp(a,b,c,-1,!e,f,g,h,
k)}}function rp(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=cp,m=ep;for(a.Bb[b][c]=m;l===cp&&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 sp(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=cp,m=bp;for(a.Bb[b][c]=m;l===cp&&b>f&&b<g&&c>h&&c<k;)a.Bb[b][c]=m,e?c+=d:b+=d,l=a.Bb[b][c]}
function $o(a,b,c,d,e,f){if(null!==a.Bb){a.abort=!1;var g=b.x,h=b.y;if(Zo(a,g,h)&&(g-=a.Hd,g/=a.lc,h-=a.Jd,h/=a.mc,b=d.x,d=d.y,Zo(a,b,d)))if(b-=a.Hd,b/=a.lc,d-=a.Jd,d/=a.mc,1>=Math.abs(g-b)&&1>=Math.abs(h-d))a.abort=!0;else{var k=f.x,l=f.y,m=f.x+f.width,n=f.y+f.height;k-=a.Hd;k/=a.lc;l-=a.Jd;l/=a.mc;m-=a.Hd;m/=a.lc;n-=a.Jd;n/=a.mc;f=Math.max(0,Math.min(a.Ij,k|0));m=Math.min(a.Ij,Math.max(0,m|0));l=Math.max(0,Math.min(a.Jj,l|0));n=Math.min(a.Jj,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]===cp?(rp(a,g,h,k,c,f,m,l,n),rp(a,g,h,1,!c,f,m,l,n),rp(a,g,h,-1,!c,f,m,l,n)):rp(a,g,h,k,c,g,h,g,h);a.Bb[b][d]===cp?(sp(a,b,d,0===e||90===e?1:-1,90===e||270===e,f,m,l,n),sp(a,b,d,1,!(90===e||270===e),f,m,l,n),sp(a,b,d,-1,!(90===e||270===e),f,m,l,n)):sp(a,b,d,k,c,b,d,b,d);a.abort||(qp(a,g,h,1,!1,f,m,l,n),qp(a,g,h,-1,!1,f,m,l,n),qp(a,g,h,1,!0,f,m,l,n),qp(a,g,h,-1,!0,f,m,l,n))}}}
pa.Object.defineProperties(jk.prototype,{bounds:{get:function(){return new L(this.Hd,this.Jd,this.io-this.Hd,this.jo-this.Jd)}},Sl:{get:function(){return this.lc},set:function(a){0<a&&a!==this.lc&&(this.lc=a,this.initialize(this.bounds))}},Rl:{get:function(){return this.mc},set:function(a){0<a&&a!==this.mc&&(this.mc=a,this.initialize(this.bounds))}}});var cp=0,ep=1,bp=999999,pp=bp+1;jk.className="PositionArray";
function Wo(){mb(this);this.port=this.node=null;this.Vd=[];this.bq=!1}Wo.prototype.toString=function(){for(var a=this.Vd,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 tp(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}Wo.prototype.am=function(){this.Vd.length=0};
function Xo(a,b){var c=a.Vd;if(0===c.length){a:if(!a.bq){c=a.bq;a.bq=!0;var d=null,e=a.node;e=e instanceof hg?e:null;if(null===e||e.isSubGraphExpanded)var f=a.node.Ru(a.port.portId);else{if(!e.actualBounds.s()){a.bq=c;break a}d=e;f=d.Qu()}var g=a.Vd.length=0,h=a.port.ma(Tc,G.alloc()),k=a.port.ma(hd,G.alloc());e=L.allocAt(h.x,h.y,0,0);e.He(k);G.free(h);G.free(k);h=G.allocAt(e.x+e.width/2,e.y+e.height/2);k=a.port.Hi();for(f=f.iterator;f.next();){var l=f.value;if(l.isVisible()&&l.fromPort!==l.toPort){var m=
l.fromPort===a.port||null!==l.fromNode&&l.fromNode.Ud(d),n=l.computeSpot(m,a.port);if(n.qf()&&(m=m?l.toPort:l.fromPort,null!==m)){var p=m.part;if(null!==p){var q=p.findVisibleNode();null!==q&&q!==p&&(p=q,m=p.port);m=l.computeOtherPoint(p,m);p=h.Wa(m);p-=k;0>p&&(p+=360);n=tp(e,n,p,l.isOrthogonal);0===n?(n=4,180<p&&(p-=360)):n=90===n?8:180===n?2:1;q=a.Vd[g];void 0===q?(q=new up(l,p,n),a.Vd[g]=q):(q.link=l,q.angle=p,q.yc=n);q.nv.set(m);g++}}}}G.free(h);a.Vd.sort(Wo.prototype.l);k=a.Vd.length;d=-1;for(g=
h=0;g<k;g++)f=a.Vd[g],void 0!==f&&(f.yc!==d&&(d=f.yc,h=0),f.Up=h,h++);d=-1;h=0;for(g=k-1;0<=g;g--)k=a.Vd[g],void 0!==k&&(k.yc!==d&&(d=k.yc,h=k.Up+1),k.Ul=h);g=a.Vd;n=a.port;d=a.node.portSpreading;h=G.alloc();k=G.alloc();f=G.alloc();l=G.alloc();n.ma(Tc,h);n.ma(Vc,k);n.ma(hd,f);n.ma(fd,l);q=p=m=n=0;if(d===Fo)for(var r=0;r<g.length;r++){var u=g[r];if(null!==u){var x=u.link.computeThickness();switch(u.yc){case 8:p+=x;break;case 2:q+=x;break;case 1:n+=x;break;default:case 4:m+=x}}}var v=r=0,y=1,z=u=0;
for(x=0;x<g.length;x++){var B=g[x];if(null!==B){if(r!==B.yc){r=B.yc;switch(r){case 8:var C=f;v=l;break;case 2:C=l;v=h;break;case 1:C=h;v=k;break;default:case 4:C=k,v=f}u=v.x-C.x;z=v.y-C.y;switch(r){case 8:p>Math.abs(u)?(y=Math.abs(u)/p,p=Math.abs(u)):y=1;break;case 2:q>Math.abs(z)?(y=Math.abs(z)/q,q=Math.abs(z)):y=1;break;case 1:n>Math.abs(u)?(y=Math.abs(u)/n,n=Math.abs(u)):y=1;break;default:case 4:m>Math.abs(z)?(y=Math.abs(z)/m,m=Math.abs(z)):y=1}v=0}var I=B.$p;if(d===Fo){B=B.link.computeThickness();
B*=y;I.set(C);switch(r){case 8:I.x=C.x+u/2+p/2-v-B/2;break;case 2:I.y=C.y+z/2+q/2-v-B/2;break;case 1:I.x=C.x+u/2-n/2+v+B/2;break;default:case 4:I.y=C.y+z/2-m/2+v+B/2}v+=B}else{var J=.5;d===so&&(J=(B.Up+1)/(B.Ul+1));I.x=C.x+u*J;I.y=C.y+z*J}}}G.free(h);G.free(k);G.free(f);G.free(l);C=a.Vd;for(g=0;g<C.length;g++)d=C[g],null!==d&&(d.Pu=a.computeEndSegmentLength(d));a.bq=c;L.free(e)}c=a.Vd}for(a=0;a<c.length;a++)if(e=c[a],null!==e&&e.link===b)return e;return null}
Wo.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};Wo.prototype.computeEndSegmentLength=function(a){var b=a.link,c=b.computeEndSegmentLength(this.node,this.port,Sc,b.fromPort===this.port),d=a.Up;if(0>d)return c;var e=a.Ul;if(1>=e||!b.isOrthogonal)return c;b=a.nv;var f=a.$p;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)};Wo.className="Knot";
function up(a,b,c){this.link=a;this.angle=b;this.yc=c;this.nv=new G;this.Ul=this.Up=0;this.$p=new G;this.Pu=0}up.prototype.toString=function(){return this.link.toString()+" "+this.angle.toString()+" "+this.yc.toString()+":"+this.Up.toString()+"/"+this.Ul.toString()+" "+this.$p.toString()+" "+this.Pu.toString()+" "+this.nv.toString()};up.className="LinkInfo";function Sk(){this.kh=this.Kg=Ed;this.jh=this.Jg=this.ih=this.Ig=NaN;this.wp=this.An=null;this.xp=this.Bn=Infinity}
Sk.prototype.copy=function(){var a=new Sk;a.Kg=this.Kg.I();a.kh=this.kh.I();a.Ig=this.Ig;a.ih=this.ih;a.Jg=this.Jg;a.jh=this.jh;a.An=this.An;a.wp=this.wp;a.Bn=this.Bn;a.xp=this.xp;return a};Sk.className="LinkSettings";function wi(){mb(this);this.K=this.F=null;this.Pg=this.Pn=!0;this.Vn=!1;this.Nm=(new G(0,0)).freeze();this.Sn=!0;this.Rn=null;this.qw="";this.u=null;this.Un=!1;this.l=null}
wi.prototype.cloneProtected=function(a){a.Pn=this.Pn;a.Pg=this.Pg;a.Vn=this.Vn;a.Nm.assign(this.Nm);a.Sn=this.Sn;a.Rn=this.Rn;a.qw=this.qw;a.Un=!0};wi.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};wi.prototype.fb=function(){};wi.prototype.toString=function(){var a=Pa(this.constructor);a+="(";null!==this.group&&(a+=" in "+this.group);null!==this.diagram&&(a+=" for "+this.diagram);return a+")"};
wi.prototype.B=function(){if(this.isValidLayout){var a=this.diagram;if(null!==a&&!a.undoManager.isUndoingRedoing){var b=a.animationManager;!b.isTicking&&(b.isAnimating&&b.vd(),this.isOngoing&&a.Mi||this.isInitial&&!a.Mi)&&(this.isValidLayout=!1,a.cc())}}};wi.prototype.createNetwork=function(){return new vp(this)};wi.prototype.makeNetwork=function(a){var b=this.createNetwork();a instanceof P?(b.ig(a.nodes,!0),b.ig(a.links,!0)):a instanceof hg?b.ig(a.memberParts):b.ig(a.iterator);return b};
wi.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.Aa("Layout"),this.commitLayout()}finally{null!==a&&a.Za("Layout")}};wi.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()}};
wi.prototype.doLayout=function(a){var b=new F;a instanceof P?(wp(this,b,a.nodes,!0,this.jk,!0,!1,!0),wp(this,b,a.parts,!0,this.jk,!0,!1,!0)):a instanceof hg?wp(this,b,a.memberParts,!1,this.jk,!0,!1,!0):b.addAll(a.iterator);var c=b.count;if(0<c){a=this.diagram;null!==a&&a.Aa("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;xp(k);var l=
k.measuredBounds,m=l.width;l=l.height;k.moveTo(e,f);k instanceof hg&&(k.jk=!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.Za("Layout")}this.isValidLayout=!0};wi.prototype.jk=function(a){return!a.location.s()||a instanceof hg&&a.jk?!0:!1};
function wp(a,b,c,d,e,f,g,h){for(c=c.iterator;c.next();){var k=c.value;d&&!k.isTopLevel||null!==e&&!e(k)||!k.canLayout()||(f&&k instanceof V?k.isLinkLabel||(k instanceof hg?null===k.layout?wp(a,b,k.memberParts,!1,e,f,g,h):(xp(k),b.add(k)):(xp(k),b.add(k))):g&&k instanceof S?b.add(k):!h||!k.Lb()||k instanceof V||(xp(k),b.add(k)))}}function xp(a){var b=a.actualBounds;(0===b.width||0===b.height||isNaN(b.width)||isNaN(b.height))&&a.ac()}
wi.prototype.Ji=function(a,b){var c=this.boundsComputation;if(null!==c)return b||(b=new L),c(a,this,b);if(!b)return a.actualBounds;b.set(a.actualBounds);return b};wi.prototype.Tw=function(a){var b=new F;a instanceof P?(wp(this,b,a.nodes,!0,null,!0,!0,!0),wp(this,b,a.links,!0,null,!0,!0,!0),wp(this,b,a.parts,!0,null,!0,!0,!0)):a instanceof hg?wp(this,b,a.memberParts,!1,null,!0,!0,!0):wp(this,b,a.iterator,!1,null,!0,!0,!0);return b};
wi.prototype.initialOrigin=function(a){var b=this.group;if(null!==b){var c=b.position.copy();(isNaN(c.x)||isNaN(c.y))&&c.set(a);b=b.placeholder;null!==b&&(c=b.ma(Tc),(isNaN(c.x)||isNaN(c.y))&&c.set(a),a=b.padding,c.x+=a.left,c.y+=a.top);return c}return a};
pa.Object.defineProperties(wi.prototype,{diagram:{get:function(){return this.F},set:function(a){this.F=a}},group:{get:function(){return this.K},set:function(a){this.K!==a&&(this.K=a,null!==a&&(this.F=a.diagram))}},isOngoing:{get:function(){return this.Pn},set:function(a){this.Pn!==a&&(this.Pn=a)}},isInitial:{get:function(){return this.Pg},set:function(a){this.Pg=a;a||(this.Un=!0)}},
isViewportSized:{get:function(){return this.Vn},set:function(a){this.Vn!==a&&(this.Vn=a)&&this.B()}},isRouting:{get:function(){return this.Sn},set:function(a){this.Sn!==a&&(this.Sn=a)}},isRealtime:{get:function(){return this.Rn},set:function(a){this.Rn!==a&&(this.Rn=a)}},isValidLayout:{get:function(){return this.Un},set:function(a){this.Un!==a&&(this.Un=a,a||(a=this.diagram,null!==
a&&(a.yg=!0)))}},network:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a,null!==a&&(a.layout=this))}},boundsComputation:{get:function(){return this.u},set:function(a){this.u!==a&&(this.u=a,this.B())}},arrangementOrigin:{get:function(){return this.Nm},set:function(a){this.Nm.A(a)||(this.Nm.assign(a),this.B())}}});wi.prototype.collectParts=wi.prototype.Tw;wi.prototype.getLayoutBounds=wi.prototype.Ji;
wi.prototype.invalidateLayout=wi.prototype.B;wi.className="Layout";function vp(a){mb(this);this.gc=a;this.hf=new F;this.ce=new F;this.ht=new Lb;this.ct=new Lb}vp.prototype.clear=function(){if(this.hf)for(var a=this.hf.iterator;a.next();)a.value.clear();if(this.ce)for(a=this.ce.iterator;a.next();)a.value.clear();this.hf=new F;this.ce=new F;this.ht=new Lb;this.ct=new Lb};
vp.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.hf.count+" edges: "+this.ce.count;if(1<a){for(var c=this.hf.iterator;c.next();)b+="\n "+c.value.toString(a-1);for(c=this.ce.iterator;c.next();)b+="\n "+c.value.toString(a-1)}return b};vp.prototype.createVertex=function(){return new yp(this)};vp.prototype.createEdge=function(){return new zp(this)};
vp.prototype.ig=function(a,b,c){if(null!==a){void 0===b&&(b=!1);void 0===c&&(c=null);null===c&&(c=function(a){if(a instanceof V)return!a.isLinkLabel;if(a instanceof S){var b=a.fromNode;if(null===b||b.isLinkLabel)return!1;a=a.toNode;return null===a||a.isLinkLabel?!1:!0}return!1});for(a=a.iterator;a.next();){var d=a.value;if(d instanceof V&&(!b||d.isTopLevel)&&d.canLayout()&&c(d))if(d instanceof hg&&null===d.layout)this.ig(d.memberParts,!1);else if(null===this.Gi(d)){var e=this.createVertex();e.node=
d;this.ph(e)}}for(a.reset();a.next();)if(d=a.value,d instanceof S&&(!b||d.isTopLevel)&&d.canLayout()&&c(d)&&null===this.Op(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.ck(f,e,d))}}};vp.prototype.findGroupVertex=function(a){if(null===a)return null;var b=a.findVisibleNode();if(null===b)return null;a=this.Gi(b);if(null!==a)return a;for(b=b.containingGroup;null!==b;){a=this.Gi(b);if(null!==a)return a;b=b.containingGroup}return null};
t=vp.prototype;t.ph=function(a){if(null!==a){this.hf.add(a);var b=a.node;null!==b&&this.ht.add(b,a);a.network=this}};t.Ol=function(a){if(null===a)return null;var b=this.Gi(a);null===b&&(b=this.createVertex(),b.node=a,this.ph(b));return b};t.Ou=function(a){if(null!==a&&Ap(this,a)){for(var b=a.tg,c=b.count-1;0<=c;c--){var d=b.N(c);this.Wj(d)}b=a.kg;for(a=b.count-1;0<=a;a--)c=b.N(a),this.Wj(c)}};function Ap(a,b){if(null===b)return!1;var c=a.hf.remove(b);c&&a.ht.remove(b.node);return c}
t.xy=function(a){null!==a&&(a=this.Gi(a),null!==a&&this.Ou(a))};t.Gi=function(a){return null===a?null:this.ht.J(a)};t.Lj=function(a){if(null!==a){this.ce.add(a);var b=a.link;null!==b&&null===this.Op(b)&&this.ct.add(b,a);b=a.toVertex;null!==b&&b.Eu(a);b=a.fromVertex;null!==b&&b.Cu(a);a.network=this}};
t.ay=function(a){if(null===a)return null;var b=a.fromNode,c=a.toNode,d=this.Op(a);null===d?(d=this.createEdge(),d.link=a,null!==b&&(d.fromVertex=this.Ol(b)),null!==c&&(d.toVertex=this.Ol(c)),this.Lj(d)):(null!==b?d.fromVertex=this.Ol(b):d.fromVertex=null,null!==c?d.toVertex=this.Ol(c):d.toVertex=null);return d};t.Wj=function(a){if(null!==a){var b=a.toVertex;null!==b&&b.Nu(a);b=a.fromVertex;null!==b&&b.Mu(a);Bp(this,a)}};function Bp(a,b){null!==b&&a.ce.remove(b)&&a.ct.remove(b.link)}
t.wy=function(a){null!==a&&(a=this.Op(a),null!==a&&this.Wj(a))};t.Op=function(a){return null===a?null:this.ct.J(a)};t.ck=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.Lj(d);return d}return null};t.qm=function(a){if(null!==a){var b=a.fromVertex,c=a.toVertex;null!==b&&null!==c&&(b.Mu(a),c.Nu(a),a.qm(),b.Eu(a),c.Cu(a))}};
t.Mp=function(){for(var a=Ka(),b=this.ce.iterator;b.next();){var c=b.value;c.fromVertex===c.toVertex&&a.push(c)}b=a.length;for(c=0;c<b;c++)this.Wj(a[c]);Oa(a)};vp.prototype.deleteArtificialVertexes=function(){for(var a=Ka(),b=this.hf.iterator;b.next();){var c=b.value;null===c.node&&a.push(c)}c=a.length;for(b=0;b<c;b++)this.Ou(a[b]);b=Ka();for(c=this.ce.iterator;c.next();){var d=c.value;null===d.link&&b.push(d)}c=b.length;for(d=0;d<c;d++)this.Wj(b[d]);Oa(a);Oa(b)};
function Cp(a){for(var b=Ka(),c=a.ce.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.Wj(b[d]);Oa(b)}
vp.prototype.Ix=function(){this.deleteArtificialVertexes();Cp(this);this.Mp();for(var a=new E,b=!0;b;){b=!1;for(var c=this.hf.iterator;c.next();){var d=c.value;if(0<d.tg.count||0<d.kg.count){b=this.layout.createNetwork();a.add(b);Dp(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 Dp(a,b,c){if(null!==c&&c.network!==b){Ap(a,c);b.ph(c);for(var d=c.sourceEdges;d.next();){var e=d.value;e.network!==b&&(Bp(a,e),b.Lj(e),Dp(a,b,e.fromVertex))}for(d=c.destinationEdges;d.next();)c=d.value,c.network!==b&&(Bp(a,c),b.Lj(c),Dp(a,b,c.toVertex))}}vp.prototype.Cy=function(){for(var a=new F,b=this.hf.iterator;b.next();)a.add(b.value.node);for(b=this.ce.iterator;b.next();)a.add(b.value.link);return a};
pa.Object.defineProperties(vp.prototype,{layout:{get:function(){return this.gc},set:function(a){null!==a&&(this.gc=a)}},vertexes:{get:function(){return this.hf}},edges:{get:function(){return this.ce}}});vp.prototype.findAllParts=vp.prototype.Cy;vp.prototype.splitIntoSubNetworks=vp.prototype.Ix;vp.prototype.deleteSelfEdges=vp.prototype.Mp;vp.prototype.reverseEdge=vp.prototype.qm;vp.prototype.linkVertexes=vp.prototype.ck;
vp.prototype.findEdge=vp.prototype.Op;vp.prototype.deleteLink=vp.prototype.wy;vp.prototype.deleteEdge=vp.prototype.Wj;vp.prototype.addLink=vp.prototype.ay;vp.prototype.addEdge=vp.prototype.Lj;vp.prototype.findVertex=vp.prototype.Gi;vp.prototype.deleteNode=vp.prototype.xy;vp.prototype.deleteVertex=vp.prototype.Ou;vp.prototype.addNode=vp.prototype.Ol;vp.prototype.addVertex=vp.prototype.ph;vp.prototype.addParts=vp.prototype.ig;vp.className="LayoutNetwork";
function yp(a){mb(this);this.Vc=a;this.l=(new L(0,0,10,10)).freeze();this.u=(new G(5,5)).freeze();this.ji=this.jb=null;this.tg=new E;this.kg=new E}yp.prototype.clear=function(){this.ji=this.jb=null;this.tg=new E;this.kg=new E};
yp.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutVertex#"+Bb(this);if(0<a&&(b+=null!==this.node?"("+this.node.toString()+")":"",1<a)){a="";for(var c=!0,d=this.tg.iterator;d.next();){var e=d.value;c?c=!1:a+=",";a+=e.toString(0)}e="";c=!0;for(d=this.kg.iterator;d.next();){var f=d.value;c?c=!1:e+=",";e+=f.toString(0)}b+=" sources: "+a+" destinations: "+e}return b};
yp.prototype.commit=function(){var a=this.jb;if(null!==a){var b=this.bounds,c=a.bounds;Ca(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 hg)){c=L.alloc();var d=this.network.layout.Ji(a,c),e=a.locationObject.ma(dd);if(d.s()&&e.s()){a.moveTo(b.x+this.focusX-(e.x-d.x),b.y+this.focusY-(e.y-d.y));L.free(c);return}L.free(c)}a.moveTo(b.x,b.y)}};yp.prototype.Eu=function(a){null!==a&&(this.tg.contains(a)||this.tg.add(a))};
yp.prototype.Nu=function(a){null!==a&&this.tg.remove(a)};yp.prototype.Cu=function(a){null!==a&&(this.kg.contains(a)||this.kg.add(a))};yp.prototype.Mu=function(a){null!==a&&this.kg.remove(a)};function Ep(a,b){a=a.ji;b=b.ji;return a?b?(a=a.text,b=b.text,a<b?-1:a>b?1:0):1:null!==b?-1:0}
pa.Object.defineProperties(yp.prototype,{sourceEdgesArrayAccess:{get:function(){return this.tg._dataArray}},destinationEdgesArrayAccess:{get:function(){return this.kg._dataArray}},data:{get:function(){return this.jb},set:function(a){this.jb=a;if(null!==a){var b=a.bounds;a=b.x;var c=b.y,d=b.width;b=b.height;this.u.h(d/2,b/2);this.l.h(a,c,d,b)}}},node:{get:function(){return this.ji},
set:function(a){if(this.ji!==a){this.ji=a;a.ac();var b=this.network.layout,c=L.alloc(),d=b.Ji(a,c);b=d.x;var e=d.y,f=d.width;d=d.height;isNaN(b)&&(b=0);isNaN(e)&&(e=0);this.l.h(b,e,f,d);L.free(c);if(!(a instanceof hg)&&(a=a.locationObject.ma(dd),a.s())){this.u.h(a.x-b,a.y-e);return}this.u.h(f/2,d/2)}}},bounds:{get:function(){return this.l},set:function(a){this.l.A(a)||this.l.assign(a)}},focus:{get:function(){return this.u},set:function(a){this.u.A(a)||
this.u.assign(a)}},centerX:{get:function(){return this.l.x+this.u.x},set:function(a){var b=this.l;b.x+this.u.x!==a&&(b.ha(),b.x=a-this.u.x,b.freeze())}},centerY:{get:function(){return this.l.y+this.u.y},set:function(a){var b=this.l;b.y+this.u.y!==a&&(b.ha(),b.y=a-this.u.y,b.freeze())}},focusX:{get:function(){return this.u.x},set:function(a){var b=this.u;b.x!==a&&(b.ha(),b.x=a,b.freeze())}},focusY:{
get:function(){return this.u.y},set:function(a){var b=this.u;b.y!==a&&(b.ha(),b.y=a,b.freeze())}},x:{get:function(){return this.l.x},set:function(a){var b=this.l;b.x!==a&&(b.ha(),b.x=a,b.freeze())}},y:{get:function(){return this.l.y},set:function(a){var b=this.l;b.y!==a&&(b.ha(),b.y=a,b.freeze())}},width:{get:function(){return this.l.width},set:function(a){var b=this.l;b.width!==a&&(b.ha(),b.width=
a,b.freeze())}},height:{get:function(){return this.l.height},set:function(a){var b=this.l;b.height!==a&&(b.ha(),b.height=a,b.freeze())}},network:{get:function(){return this.Vc},set:function(a){this.Vc=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.tg.iterator}},destinationEdges:{get:function(){return this.kg.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.tg.count+this.kg.count}}});yp.prototype.deleteDestinationEdge=yp.prototype.Mu;yp.prototype.addDestinationEdge=yp.prototype.Cu;yp.prototype.deleteSourceEdge=yp.prototype.Nu;yp.prototype.addSourceEdge=yp.prototype.Eu;yp.className="LayoutVertex";yp.standardComparer=Ep;
yp.smartComparer=function(a,b){if(null!==a){if(null!==b){a=a.ji;var c=b.ji;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 zp(a){mb(this);this.Vb=a;this.dg=this.Hf=this.il=this.jb=null}zp.prototype.clear=function(){this.dg=this.Hf=this.il=this.jb=null};zp.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutEdge#"+Bb(this);0<a&&(b+=null!==this.il?"("+this.il.toString()+")":"",1<a&&(b+=" "+(this.Hf?this.Hf.toString():"null")+" --\x3e "+(this.dg?this.dg.toString():"null")));return b};
zp.prototype.qm=function(){var a=this.Hf;this.Hf=this.dg;this.dg=a};zp.prototype.commit=function(){};zp.prototype.kx=function(a){return this.dg===a?this.Hf:this.Hf===a?this.dg:null};
pa.Object.defineProperties(zp.prototype,{network:{get:function(){return this.Vb},set:function(a){this.Vb=a}},data:{get:function(){return this.jb},set:function(a){this.jb!==a&&(this.jb=a)}},link:{get:function(){return this.il},set:function(a){this.il!==a&&(this.il=a)}},fromVertex:{get:function(){return this.Hf},set:function(a){this.Hf!==a&&(this.Hf=a)}},toVertex:{
get:function(){return this.dg},set:function(a){this.dg!==a&&(this.dg=a)}}});zp.prototype.getOtherVertex=zp.prototype.kx;zp.className="LayoutEdge";function Ak(){wi.call(this);this.isViewportSized=!0;this.Dp=this.Ep=NaN;this.Ag=(new K(NaN,NaN)).freeze();this.$e=(new K(10,10)).freeze();this.wb=Fp;this.Ab=Gp;this.Pc=Hp;this.Lc=Ip}oa(Ak,wi);
Ak.prototype.cloneProtected=function(a){wi.prototype.cloneProtected.call(this,a);a.Ep=this.Ep;a.Dp=this.Dp;a.Ag.assign(this.Ag);a.$e.assign(this.$e);a.wb=this.wb;a.Ab=this.Ab;a.Pc=this.Pc;a.Lc=this.Lc};Ak.prototype.fb=function(a){a.classType===Ak?a===Hp||a===Jp||a===Kp||a===Lp?this.sorting=a:a===Gp||a===Mp?this.arrangement=a:a===Fp||a===Np?this.alignment=a:A("Unknown enum value: "+a):wi.prototype.fb.call(this,a)};
Ak.prototype.doLayout=function(a){this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);var b=this.Tw(a);a=this.diagram;for(var c=b.copy().iterator;c.next();){var d=c.value;if(!d.xh()||null===d.fromNode&&null===d.toNode){if(d.ac(),d instanceof hg)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 Lp:e.reverse();break;case Hp:e.sort(this.comparer);break;case Jp: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.Aa("Layout");d=[];switch(this.alignment){case Np:var h=b,k=c,l=L.alloc(),m=Math.max(this.cellSize.width,1);if(!isFinite(m))for(var n=m=0;n<e.length;n++){var p=this.Ji(e[n],l);m=Math.max(m,p.width)}m=Math.max(m+h,1);n=Math.max(this.cellSize.height,
1);if(!isFinite(n))for(p=n=0;p<e.length;p++){var q=this.Ji(e[p],l);n=Math.max(n,q.height)}n=Math.max(n+k,1);p=this.arrangement;for(var r=q=this.arrangementOrigin.x,u=this.arrangementOrigin.y,x=0,v=0,y=0;y<e.length;y++){var z=e[y],B=this.Ji(z,l),C=Math.ceil((B.width+h)/m)*m,I=Math.ceil((B.height+k)/n)*n;switch(p){case Mp:var J=Math.abs(r-B.width);break;default:J=r+B.width}if(0<f&&x>f-1||0<g&&0<x&&J>g)d.push(new L(0,u,g+h,v)),x=0,r=q,u+=v,v=0;v=Math.max(v,I);switch(p){case Mp:B=-B.width;break;default:B=
0}z.moveTo(r+B,u);switch(p){case Mp:r-=C;break;default:r+=C}x++}d.push(new L(0,u,g+h,v));L.free(l);break;case Fp:k=g;m=f;n=b;p=c;g=L.alloc();q=Math.max(this.cellSize.width,1);f=u=l=0;h=G.alloc();for(r=0;r<e.length;r++)v=e[r],x=this.Ji(v,g),v=v.uh(v.locationObject,v.locationSpot,h),l=Math.max(l,v.x),u=Math.max(u,x.width-v.x),f=Math.max(f,v.y);r=this.arrangement;switch(r){case Mp:l+=n;break;default:u+=n}q=isFinite(q)?Math.max(q+n,1):Math.max(l+u,1);var M=v=this.arrangementOrigin.x;y=this.arrangementOrigin.y;
u=0;k>=l&&(k-=l);l=z=0;C=Math.max(this.cellSize.height,1);B=f=0;I=!0;x=G.alloc();for(J=0;J<e.length;J++){var U=e[J],Q=this.Ji(U,g),ia=U.uh(U.locationObject,U.locationSpot,h);if(0<u)switch(r){case Mp:M=(M-v-(Q.width-ia.x))/q;M=H.ca(Math.round(M),M)?Math.round(M):Math.floor(M);M=M*q+v;break;default:M=(M-v+ia.x)/q,M=H.ca(Math.round(M),M)?Math.round(M):Math.ceil(M),M=M*q+v}else switch(r){case Mp:z=M+ia.x+Q.width;break;default:z=M-ia.x}switch(r){case Mp:var ja=-(M+ia.x)+z;break;default:ja=M+Q.width-ia.x-
z}if(0<m&&u>m-1||0<k&&0<u&&ja>k){d.push(new L(0,I?y-f:y,k+n,B+f+p));for(M=0;M<u&&J!==u;M++){ja=e[J-u+M];var N=ja.uh(ja.locationObject,ja.locationSpot,x);ja.moveTo(ja.position.x,ja.position.y+f-N.y)}B+=p;y=I?y+B:y+(B+f);u=B=f=0;M=v;I=!1}M===v&&(l=r===Mp?Math.max(l,Q.width-ia.x):Math.min(l,-ia.x));f=Math.max(f,ia.y);B=Math.max(B,Q.height-ia.y);isFinite(C)&&(B=Math.max(B,Math.max(Q.height,C)-ia.y));I?U.moveTo(M-ia.x,y-ia.y):U.moveTo(M-ia.x,y);switch(r){case Mp:M-=ia.x+n;break;default:M+=Q.width-ia.x+
n}u++}d.push(new L(0,y,k+n,(I?B:B+f)+p));if(e.length!==u)for(k=0;k<u;k++)m=e[e.length-u+k],n=m.uh(m.locationObject,m.locationSpot,h),m.moveTo(m.position.x,m.position.y+f-n.y);G.free(h);G.free(x);if(r===Mp)for(e=0;e<d.length;e++)f=d[e],f.width+=l,f.x-=l;else for(e=0;e<d.length;e++)f=d[e],f.x>l&&(f.width+=f.x-l,f.x=l);L.free(g)}for(h=f=g=e=0;h<d.length;h++)k=d[h],e=Math.min(e,k.x),g=Math.min(g,k.y),f=Math.max(f,k.x+k.width);this.arrangement===Mp?this.commitLayers(d,new G(e+b/2-(f+e),g-c/2)):this.commitLayers(d,
new G(e-b/2,g-c/2));null!==a&&a.Za("Layout");this.isValidLayout=!0}};Ak.prototype.commitLayers=function(){};function Ip(a,b){a=a.text;b=b.text;return a<b?-1:a>b?1:0}
pa.Object.defineProperties(Ak.prototype,{wrappingWidth:{get:function(){return this.Ep},set:function(a){this.Ep!==a&&(0<a||isNaN(a))&&(this.Ep=a,this.isViewportSized=isNaN(a),this.B())}},wrappingColumn:{get:function(){return this.Dp},set:function(a){this.Dp!==a&&(0<a||isNaN(a))&&(this.Dp=a,this.B())}},cellSize:{get:function(){return this.Ag},set:function(a){this.Ag.A(a)||(this.Ag.assign(a),this.B())}},spacing:{
get:function(){return this.$e},set:function(a){this.$e.A(a)||(this.$e.assign(a),this.B())}},alignment:{get:function(){return this.wb},set:function(a){this.wb===a||a!==Fp&&a!==Np||(this.wb=a,this.B())}},arrangement:{get:function(){return this.Ab},set:function(a){this.Ab===a||a!==Gp&&a!==Mp||(this.Ab=a,this.B())}},sorting:{get:function(){return this.Pc},set:function(a){this.Pc===a||a!==Kp&&a!==Lp&&
a!==Hp&&a!==Jp||(this.Pc=a,this.B())}},comparer:{get:function(){return this.Lc},set:function(a){this.Lc!==a&&(this.Lc=a,this.B())}}});var Np=new D(Ak,"Position",0),Fp=new D(Ak,"Location",1),Gp=new D(Ak,"LeftToRight",2),Mp=new D(Ak,"RightToLeft",3),Kp=new D(Ak,"Forward",4),Lp=new D(Ak,"Reverse",5),Hp=new D(Ak,"Ascending",6),Jp=new D(Ak,"Descending",7);Ak.className="GridLayout";Ak.standardComparer=Ip;
Ak.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};Ak.Position=Np;Ak.Location=Fp;Ak.LeftToRight=Gp;Ak.RightToLeft=Mp;Ak.Forward=Kp;Ak.Reverse=Lp;Ak.Ascending=Hp;Ak.Descending=Jp;function ri(){this.zo=new F;this.co=new F;this.Fa=new F;this.Le=new Lb;this.Cg=new Lb;this.mj=new Lb;this.F=null;this.uq=!1}t=ri.prototype;t.clear=function(){this.zo.clear();this.co.clear();this.Fa.clear();this.Le.clear();this.Cg.clear();this.mj.clear()};t.hb=function(a){this.F=a};
t.Li=function(a){if(a instanceof V){if(this.zo.add(a),a instanceof hg){var b=a.containingGroup;null===b?this.F.wi.add(a):b.nl.add(a);b=a.layout;null!==b&&(b.diagram=this.F)}}else a instanceof S?this.co.add(a):a instanceof pf||this.Fa.add(a);b=a.data;null===b||a instanceof pf||(a instanceof S?this.Cg.add(b,a):this.Le.add(b,a))};
t.xc=function(a){a.Pj();if(a instanceof V){if(this.zo.remove(a),a instanceof hg){var b=a.containingGroup;null===b?this.F.wi.remove(a):b.nl.remove(a);b=a.layout;null!==b&&(b.diagram=null)}}else a instanceof S?this.co.remove(a):a instanceof pf||this.Fa.remove(a);b=a.data;null===b||a instanceof pf||(a instanceof S?this.Cg.remove(b):this.Le.remove(b))};
t.ud=function(){for(var a=this.F.nodeTemplateMap.iterator;a.next();){var b=a.value,c=a.key;(!b.Lb()||b instanceof hg)&&A('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.F.groupTemplateMap.iterator;a.next();)b=a.value,c=a.key,b instanceof hg||A('Invalid group template in Diagram.groupTemplateMap: template for "'+c+'" must be a Group, not a normal Node or Link: '+b);for(a=this.F.linkTemplateMap.iterator;a.next();)b=
a.value,c=a.key,b instanceof S||A('Invalid link template in Diagram.linkTemplateMap: template for "'+c+'" must be a Link, not a normal Node or simple Part: '+b);a=Ka();for(b=this.F.selection.iterator;b.next();)(c=b.value.data)&&a.push(c);b=Ka();for(c=this.F.highlighteds.iterator;c.next();){var d=c.value.data;d&&b.push(d)}c=Ka();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.vc(a[d]),null!==e&&(e.isSelected=!0);for(d=0;d<b.length;d++)e=this.vc(b[d]),null!==e&&(e.isHighlighted=!0);for(d=0;d<c.length;d+=2)e=this.vc(c[d]),null!==e&&(e.location=c[d+1]);Oa(a);Oa(b);Oa(c)};ri.prototype.addAllModeledParts=function(){this.addModeledParts(this.diagram.model.nodeDataArray)};
ri.prototype.addModeledParts=function(a,b){var c=this,d=this.diagram.model;a.forEach(function(a){d.Pb(a)&&Op(c,a,!1)});a.forEach(function(a){d.Pb(a)&&c.resolveReferencesForData(a)});!1!==b&&dk(this.diagram,!1)};
function Op(a,b,c){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.Le.contains(b)){void 0===c&&(c=!0);a:{if(void 0!==b&&null!==b&&!a.F.undoManager.isUndoingRedoing&&!a.Le.contains(b)){var d=a.Ss(b);var e=qo(a,b,d);if(null!==e&&(Xg(e),e=e.copy(),null!==e)){var f=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.xf=d;e.jb=b;a.uq&&(e.Rg="Tool");a.diagram.add(e);e.jb=null;e.data=b;a.diagram.skipsModelSourceBindings=f;d=e;break a}}d=null}null!==d&&c&&a.resolveReferencesForData(b)}}
ri.prototype.insertLink=function(){return null};ri.prototype.resolveReferencesForData=function(){};ri.prototype.Ss=function(a){return this.F.model.Ss(a)};
function qo(a,b,c){a=a.F;var d=a.model;d.ak()&&d.fv(b)?(b=a.groupTemplateMap.J(c),null===b&&(b=a.groupTemplateMap.J(""),null===b&&(Pp||(Pp=!0,ya('No Group template found for category "'+c+'"'),ya(" Using default group template")),b=a.nw))):(b=a.nodeTemplateMap.J(c),null===b&&(b=a.nodeTemplateMap.J(""),null===b&&(Qp||(Qp=!0,ya('No Node template found for category "'+c+'"'),ya(" Using default node template")),b=a.pw)));return b}ri.prototype.getLinkCategoryForData=function(){return""};
ri.prototype.setLinkCategoryForData=function(){};ri.prototype.setFromNodeForLink=function(){};ri.prototype.setToNodeForLink=function(){};ri.prototype.findLinkTemplateForCategory=function(a){var b=this.F.linkTemplateMap.J(a);null===b&&(b=this.F.linkTemplateMap.J(""),null===b&&(Rp||(Rp=!0,ya('No Link template found for category "'+a+'"'),ya(" Using default link template")),b=this.F.ow));return b};ri.prototype.removeAllModeledParts=function(){this.mt(this.diagram.model.nodeDataArray)};
ri.prototype.mt=function(a){var b=this;a.forEach(function(a){b.jq(a)})};ri.prototype.jq=function(a){a=this.vc(a);null!==a&&(Gj(this.diagram,a,!1),this.unresolveReferencesForPart(a))};ri.prototype.unresolveReferencesForPart=function(){};ri.prototype.removeDataForLink=function(){};ri.prototype.findPartForKey=function(a){if(null===a||void 0===a)return null;a=this.F.model.Qb(a);return null!==a?this.Le.J(a):null};t=ri.prototype;
t.Hb=function(a){if(null===a||void 0===a)return null;a=this.F.model.Qb(a);if(null===a)return null;a=this.Le.J(a);return a instanceof V?a:null};t.vc=function(a){if(null===a)return null;var b=this.Le.J(a);return null!==b?b:b=this.Cg.J(a)};t.Ci=function(a){if(null===a)return null;a=this.Le.J(a);return a instanceof V?a:null};t.uc=function(a){return null===a?null:this.Cg.J(a)};
t.Ps=function(a){for(var b=0;b<arguments.length;++b);b=new F;for(var c=this.zo.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(Ca(g)&&Sp(this,e,g)){b.add(d);break}}}return b.iterator};t.Os=function(a){for(var b=0;b<arguments.length;++b);b=new F;for(var c=this.co.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(Ca(g)&&Sp(this,e,g)){b.add(d);break}}}return b.iterator};
function Sp(a,b,c){for(var d in c){var e=b[d],f=c[d];if(Ea(f)){if(!Ea(e)||e.length<f.length)return!1;for(var g=0;g<e.length;g++){var h=f[g];if(void 0!==h&&!Tp(a,e[g],h))return!1}}else if(!Tp(a,e,f))return!1}return!0}function Tp(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(Ca(b)&&Ca(c)){if(!Sp(a,b,c))return!1}else if(b!==c)return!1;return!0}
ri.prototype.doModelChanged=function(a){if(this.F){var b=this.F;if(a.model===b.model){var c=a.change;b.doModelChanged(a);if(b.da){b.da=!1;try{var d=a.modelChange;if(""!==d)if(c===af){if("nodeCategory"===d){var e=this.vc(a.object),f=a.newValue;null!==e&&"string"===typeof f&&(e.category=f)}else"nodeDataArray"===d&&(this.mt(a.oldValue),this.addModeledParts(a.newValue));b.isModified=!0}else if(c===cf){var g=a.newValue;"nodeDataArray"===d&&Ca(g)&&Op(this,g);b.isModified=!0}else if(c===df){var h=a.oldValue;
"nodeDataArray"===d&&Ca(h)&&this.jq(h);b.isModified=!0}else c===bf&&("SourceChanged"===d?null!==a.object?this.updateDataBindings(a.object,a.propertyName):(this.qq(),this.updateAllTargetBindings()):"ModelDisplaced"===d&&this.ud());else if(c===af){var k=a.propertyName,l=a.object;if(l===b.model){if("nodeKeyProperty"===k||"nodeCategoryProperty"===k)b.undoManager.isUndoingRedoing||this.ud()}else this.updateDataBindings(l,k);b.isModified=!0}else if(c===cf||c===df){var m=a.change===cf,n=m?a.newParam:a.oldParam,
p=m?a.newValue:a.oldValue,q=this.mj.J(a.object);if(Array.isArray(q))for(a=0;a<q.length;a++){var r=q[a];if(m)Ym(r,p,n);else if(!(0>n)){var u=n+Rm(r);r.xc(u,!0);bn(r,u,n)}}b.isModified=!0}}finally{b.da=!0}}}}};ri.prototype.updateAllTargetBindings=function(a){void 0===a&&(a="");for(var b=this.parts.iterator;b.next();)b.value.Ea(a);for(b=this.nodes.iterator;b.next();)b.value.Ea(a);for(b=this.links.iterator;b.next();)b.value.Ea(a)};
ri.prototype.qq=function(){for(var a=this.F.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){Up(a,b,!1)});for(d=0;d<c.length;d++){var f=c[d];null===this.vc(f)&&Vp(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()};ri.prototype.refreshDataBoundLinks=function(){};ri.prototype.updateRelationshipsFromData=function(){};
ri.prototype.updateDataBindings=function(a,b){if("string"===typeof b){var c=this.vc(a);if(null!==c)c.Ea(b);else{c=null;for(var d=this.mj.iterator;d.next();){for(var e=d.value,f=0;f<e.length;f++){var g=e[f].ex(a);null!==g&&(null===c&&(c=Ka()),c.push(g))}if(null!==c)break}if(null!==c){for(d=0;d<c.length;d++)c[d].Ea(b);Oa(c)}}a===this.diagram.model.modelData&&this.updateAllTargetBindings(b)}};
function Bj(a,b){var c=b.di;if(Ea(c)){var d=a.mj.J(c);if(null===d)d=[],d.push(b),a.mj.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}function Fj(a,b){var c=b.di;if(Ea(c)){var d=a.mj.J(c);if(null!==d)for(var e=0;e<d.length;e++)if(d[e]===b){d.splice(e,1);0===d.length&&a.mj.remove(c);break}}}
ri.prototype.Uj=function(a,b,c){var d=new Lb;if(Ea(a))for(var e=0;e<a.length;e++)Wp(this,a[e],b,d,c);else for(a=a.iterator;a.next();)Wp(this,a.value,b,d,c);if(null!==b){c=b.model;a=b.toolManager.findTool("Dragging");a=null!==a?a.dragOptions.dragsLink:b.Ik.dragsLink;e=new F;for(var f=new Lb,g=d.iterator;g.next();){var h=g.value;if(h instanceof S)a||null!==h.fromNode&&null!==h.toNode||e.add(h);else if(h instanceof V&&null!==h.data&&c.dm()){var k=h;h=g.key;var l=h.ng();null!==l&&(l=d.J(l),null!==l?(c.Ge(k.data,
c.pa(l.data)),k=b.uc(k.data),h=h.Fi(),null!==h&&null!==k&&f.add(h,k)):c.Ge(k.data,void 0))}}0<e.count&&b.nt(e,!1);if(0<f.count)for(c=f.iterator;c.next();)d.add(c.key,c.value)}if(null!==b&&null!==this.F&&(b=b.model,c=b.afterCopyFunction,null!==c)){var m=new Lb;d.each(function(a){null!==a.key.data&&m.add(a.key.data,a.value.data)});c(m,b,this.F.model)}for(b=d.iterator;b.next();)b.value.Ea();return d};
function Wp(a,b,c,d,e){if(null===b||e&&!b.canCopy())return null;if(d.contains(b))return d.J(b);var f=a.copyPartData(b,c);if(!(f instanceof T))return null;f.isSelected=!1;f.isHighlighted=!1;d.add(b,f);if(b instanceof V){for(var g=b.linksConnected;g.next();){var h=g.value;if(h.fromNode===b){var k=d.J(h);null!==k&&(k.fromNode=f)}h.toNode===b&&(h=d.J(h),null!==h&&(h.toNode=f))}if(b instanceof hg&&f instanceof hg)for(b=b.memberParts;b.next();)g=Wp(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.J(g),null!==g&&(f.fromNode=g)),g=b.toNode,null!==g&&(g=d.J(g),null!==g&&(f.toNode=g)),b=b.labelNodes;b.next();)g=Wp(a,b.value,c,d,e),null!==g&&g instanceof V&&(g.labeledLink=f);return f}
ri.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),Ca(d)&&(e.jf(d),c=b.vc(d)))}else Xg(a),c=a.copy(),null!==c&&(e=this.F,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)),Ca(e)&&(c.data=e)));return c};
pa.Object.defineProperties(ri.prototype,{nodes:{get:function(){return this.zo}},links:{get:function(){return this.co}},parts:{get:function(){return this.Fa}},diagram:{get:function(){return this.F}},addsToTemporaryLayer:{get:function(){return this.uq},set:function(a){this.uq=a}}});ri.prototype.updateAllRelationshipsFromData=ri.prototype.qq;
ri.prototype.findLinksByExample=ri.prototype.Os;ri.prototype.findNodesByExample=ri.prototype.Ps;ri.prototype.findLinkForData=ri.prototype.uc;ri.prototype.findNodeForData=ri.prototype.Ci;ri.prototype.findPartForData=ri.prototype.vc;ri.prototype.findNodeForKey=ri.prototype.Hb;ri.prototype.removeModeledPart=ri.prototype.jq;ri.prototype.removeModeledParts=ri.prototype.mt;ri.prototype.rebuildParts=ri.prototype.ud;var Qp=!1,Pp=!1,Rp=!1;ri.className="PartManager";
function Xp(a){ri.apply(this,arguments)}oa(Xp,ri);Xp.prototype.addAllModeledParts=function(){var a=this.diagram.model;this.addModeledParts(a.nodeDataArray);Yp(this,a.linkDataArray)};Xp.prototype.addModeledParts=function(a){ri.prototype.addModeledParts.call(this,a,!1);for(a=this.links.iterator;a.next();)ro(a.value);dk(this.diagram,!1)};function Yp(a,b){b.forEach(function(b){Zp(a,b)});dk(a.diagram,!1)}
function Zp(a,b){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.Cg.contains(b)){var c=a.getLinkCategoryForData(b),d=a.findLinkTemplateForCategory(c);if(null!==d){Xg(d);var e=d.copy();if(null!==e){d=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.xf=c;e.jb=b;c=a.diagram.model;var f=$p(c,b,!0);""!==f&&(e.fromPortId=f);f=aq(c,b,!0);void 0!==f&&(f=a.Hb(f),f instanceof V&&(e.fromNode=f));f=$p(c,b,!1);""!==f&&(e.toPortId=f);f=aq(c,b,!1);void 0!==f&&(f=a.Hb(f),
f instanceof V&&(e.toNode=f));c=c.og(b);Array.isArray(c)&&c.forEach(function(b){b=a.Hb(b);null!==b&&(b.labeledLink=e)});a.uq&&(e.Rg="Tool");a.diagram.add(e);e.jb=null;e.data=b;a.diagram.skipsModelSourceBindings=d}}}}Xp.prototype.removeAllModeledParts=function(){var a=this.diagram.model;bq(this,a.linkDataArray);this.mt(a.nodeDataArray)};function bq(a,b){b.forEach(function(b){a.jq(b)})}Xp.prototype.getLinkCategoryForData=function(a){return this.diagram.model.Wu(a)};
Xp.prototype.setLinkCategoryForData=function(a,b){return this.diagram.model.pt(a,b)};Xp.prototype.setFromNodeForLink=function(a,b){var c=this.diagram.model;c.Bx(a.data,c.pa(null!==b?b.data:null))};Xp.prototype.setToNodeForLink=function(a,b){var c=this.diagram.model;c.Fx(a.data,c.pa(null!==b?b.data:null))};Xp.prototype.removeDataForLink=function(a){this.diagram.model.lm(a.data)};
Xp.prototype.findPartForKey=function(a){var b=ri.prototype.findPartForKey.call(this,a);return null===b&&(a=this.diagram.model.th(a),null!==a)?this.Cg.J(a):b};
Xp.prototype.doModelChanged=function(a){var b=this;ri.prototype.doModelChanged.call(this,a);if(this.diagram){var c=this.diagram;if(a.model===c.model){var d=a.change;if(c.da){c.da=!1;try{var e=a.modelChange;if(""!==e)if(d===af){if("linkFromKey"===e){var f=this.uc(a.object);if(null!==f){var g=this.Hb(a.newValue);f.fromNode=g}}else if("linkToKey"===e){var h=this.uc(a.object);if(null!==h){var k=this.Hb(a.newValue);h.toNode=k}}else if("linkFromPortId"===e){var l=this.uc(a.object);if(null!==l){var m=a.newValue;
"string"===typeof m&&(l.fromPortId=m)}}else if("linkToPortId"===e){var n=this.uc(a.object);if(null!==n){var p=a.newValue;"string"===typeof p&&(n.toPortId=p)}}else if("nodeGroupKey"===e){var q=this.vc(a.object);if(null!==q){var r=a.newValue;if(void 0!==r){var u=this.Hb(r);u instanceof hg?q.containingGroup=u:q.containingGroup=null}else q.containingGroup=null}}else if("linkLabelKeys"===e){var x=this.uc(a.object);if(null!==x){var v=a.oldValue,y=a.newValue;Array.isArray(v)&&v.forEach(function(a){a=b.Hb(a);
null!==a&&(a.labeledLink=null)});Array.isArray(y)&&y.forEach(function(a){a=b.Hb(a);null!==a&&(a.labeledLink=x)})}}else if("linkCategory"===e){var z=this.uc(a.object),B=a.newValue;null!==z&&"string"===typeof B&&(z.category=B)}else"linkDataArray"===e&&(bq(this,a.oldValue),Yp(this,a.newValue));c.isModified=!0}else if(d===cf){var C=a.newValue;if("linkDataArray"===e&&"object"===typeof C&&null!==C)Zp(this,C);else if("linkLabelKeys"===e&&cq(C)){var I=this.uc(a.object),J=this.Hb(C);null!==I&&null!==J&&(J.labeledLink=
I)}c.isModified=!0}else{if(d===df){var M=a.oldValue;if("linkDataArray"===e&&"object"===typeof M&&null!==M)this.jq(M);else if("linkLabelKeys"===e&&cq(M)){var U=this.Hb(M);null!==U&&(U.labeledLink=null)}c.isModified=!0}}else if(d===af){var Q=a.propertyName,ia=a.object;if(ia===c.model){if("linkFromKeyProperty"===Q||"linkToKeyProperty"===Q||"linkFromPortIdProperty"===Q||"linkToPortIdProperty"===Q||"linkLabelKeysProperty"===Q||"nodeIsGroupProperty"===Q||"nodeGroupKeyProperty"===Q||"linkCategoryProperty"===
Q)c.undoManager.isUndoingRedoing||this.ud()}else this.updateDataBindings(ia,Q);c.isModified=!0}}finally{c.da=!0}}}}};Xp.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){dq(b,a,!1)});d.forEach(function(c){null===a.uc(c)&&eq(b,c,!1)})};
Xp.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=aq(d,b,!0);e=c.Hb(e);a.fromNode=e;e=aq(d,b,!1);e=c.Hb(e);a.toNode=e;b=d.og(b);if(0<b.length||0<a.labelNodes.count){if(1===b.length&&1===a.labelNodes.count){e=b[0];var f=a.labelNodes.first();if(d.pa(f.data)===e)return}e=(new F).addAll(b);var g=new F;a.labelNodes.each(function(a){null!==a.data&&(a=d.pa(a.data),void 0!==a&&g.add(a))});b=g.copy();b.iq(e);e=
e.copy();e.iq(g);if(0<b.count||0<e.count)b.each(function(b){b=c.Hb(b);null!==b&&b.labeledLink===a&&(b.labeledLink=null)}),e.each(function(b){b=c.Hb(b);null!==b&&b.labeledLink!==a&&(b.labeledLink=a)})}}else!(a instanceof pf)&&(b=d.Ii(b),b=c.findPartForKey(b),null===b||b instanceof hg)&&(a.containingGroup=b)}}};
Xp.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.pa(a);if(void 0!==c){var d=fq(b,c),e=this.vc(a);if(null!==d&&null!==e){d=d.iterator;for(var f={};d.next();){var g=d.value;b.Pb(g)?e instanceof hg&&b.Ii(g)===c&&(g=this.vc(g),null!==g&&(g.containingGroup=e)):(f.link=this.uc(g),null!==f.link&&e instanceof V&&(aq(b,g,!0)===c&&(f.link.fromNode=e),aq(b,g,!1)===c&&(f.link.toNode=e),g=b.og(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}}gq(b,c)}a=b.Ii(a);void 0!==a&&(a=this.Hb(a),a instanceof hg&&(e.containingGroup=a))}};Xp.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof V){var c=b.pa(a.data);if(void 0!==c){for(var d=a.linksConnected;d.next();)hq(b,c,d.value.data);a.isLinkLabel&&(d=a.labeledLink,null!==d&&hq(b,c,d.data));if(a instanceof hg)for(a=a.memberParts;a.next();)d=a.value.data,b.Pb(d)&&hq(b,c,d)}}};
Xp.prototype.copyPartData=function(a,b){var c=ri.prototype.copyPartData.call(this,a,b);if(a instanceof S)if(a=a.data,null!==a&&null!==b){var d=b.model;a=d.Lp(a);"object"===typeof a&&null!==a&&(d.zi(a),c=b.uc(a))}else null!==c&&(b=this.diagram,null!==a&&null!==b&&null!==b.commandHandler&&b.commandHandler.copiesClipboardData&&(b=b.model.Lp(a),"object"===typeof b&&null!==b&&(c.data=b)));return c};
Xp.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(Xg(d),f=d.copy(),null!==f)return f.fromNode=a,f.fromPortId=h,f.toNode=c,f.toPortId=b,e.add(f),a=g.archetypeLabelNodeData,a instanceof V&&(Xg(a),a=a.copy(),null!==a&&(a.labeledLink=f,e.add(a))),f}else if(null!==d&&(d=f.Lp(d),"object"===
typeof d&&null!==d))return null!==a&&iq(f,d,f.pa(a.data),!0),jq(f,d,h,!0),null!==c&&iq(f,d,f.pa(c.data),!1),jq(f,d,b,!1),f.zi(d),a=g.archetypeLabelNodeData,null===a||a instanceof V||(a=f.copyNodeData(a),"object"===typeof a&&null!==a&&(f.jf(a),a=f.pa(a),void 0!==a&&f.Du(d,a))),e.uc(d);return null};Xp.prototype.findPartForKey=Xp.prototype.findPartForKey;Xp.prototype.removeAllModeledParts=Xp.prototype.removeAllModeledParts;Xp.prototype.addModeledParts=Xp.prototype.addModeledParts;
Xp.prototype.addAllModeledParts=Xp.prototype.addAllModeledParts;Xp.className="GraphLinksPartManager";function kq(){ri.apply(this,arguments);this.$g=null}oa(kq,ri);
function lq(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||!ug(d,e,f,null,!0))if(d=a.getLinkCategoryForData(c.data),b=a.findLinkTemplateForCategory(d),null!==b&&(Xg(b),b=b.copy(),null!==b)){var g=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;b.xf=d;
b.jb=c.data;b.fromNode=e;b.toNode=f;a.diagram.add(b);b.jb=null;b.data=c.data;a.diagram.skipsModelSourceBindings=g}}}kq.prototype.getLinkCategoryForData=function(a){return this.diagram.model.Xu(a)};kq.prototype.setLinkCategoryForData=function(a,b){this.diagram.model.Ev(a,b)};
kq.prototype.setFromNodeForLink=function(a,b,c){var d=this.diagram.model;void 0===c&&(c=null);b=null!==b?b.data:null;if(this.diagram.isTreePathToChildren)d.Ge(a.data,d.pa(b));else{var e=this.$g;this.$g=a;null!==c&&d.Ge(c.data,void 0);d.Ge(b,d.pa(null!==a.toNode?a.toNode.data:null));this.$g=e}};
kq.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.$g;this.$g=a;null!==c&&d.Ge(c.data,void 0);d.Ge(b,d.pa(null!==a.fromNode?a.fromNode.data:null));this.$g=e}else d.Ge(a.data,d.pa(b))};kq.prototype.removeDataForLink=function(a){this.diagram.model.Ge(a.data,void 0)};
kq.prototype.doModelChanged=function(a){ri.prototype.doModelChanged.call(this,a);if(this.diagram){var b=this.diagram;if(a.model===b.model){var c=a.change;if(b.da){b.da=!1;try{var d=a.modelChange;if(""!==d){if(c===af){if("nodeParentKey"===d){var e=a.object,f=this.Hb(a.newValue),g=this.Ci(e);if(null!==this.$g)null!==f&&(this.$g.data=e,this.$g.category=this.getLinkCategoryForData(e));else if(null!==g){var h=g.Fi();null!==h?null===f?b.remove(h):b.isTreePathToChildren?h.fromNode=f:h.toNode=f:lq(this,f,
g)}}else if("parentLinkCategory"===d){var k=this.Ci(a.object),l=a.newValue;if(null!==k&&"string"===typeof l){var m=k.Fi();null!==m&&(m.category=l)}}b.isModified=!0}}else if(c===af){var n=a.propertyName,p=a.object;p===b.model?"nodeParentKeyProperty"===n&&(b.undoManager.isUndoingRedoing||this.ud()):this.updateDataBindings(p,n);b.isModified=!0}}finally{b.da=!0}}}}};
kq.prototype.updateRelationshipsFromData=function(a){var b=a.data;if(null!==b){var c=a.diagram;if(null!==c){var d=c.model;a instanceof V&&(b=d.Ki(b),b=c.Hb(b),d=a.ng(),b!==d&&(d=a.Fi(),null!==b?null!==d?c.isTreePathToChildren?d.fromNode=b:d.toNode=b:lq(this,b,a):null!==d&&Gj(c,d,!1)))}}};kq.prototype.updateDataBindings=function(a,b){ri.prototype.updateDataBindings.call(this,a,b);"string"===typeof b&&null!==this.vc(a)&&(a=this.uc(a),null!==a&&a.Ea(b))};
kq.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.pa(a);if(void 0!==c){var d=fq(b,c),e=this.vc(a);if(null!==d&&null!==e){for(d=d.iterator;d.next();){var f=d.value;b.Pb(f)&&e instanceof V&&b.Ki(f)===c&&lq(this,e,this.Ci(f))}gq(b,c)}a=b.Ki(a);void 0!==a&&e instanceof V&&(a=this.Hb(a),lq(this,a,e))}};
kq.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof V){var c=b.pa(a.data),d=this.uc(a.data);if(null!==d){d.isSelected=!1;d.isHighlighted=!1;var e=d.layer;if(null!==e){var f=e.xc(-1,d,!1);0<=f&&this.diagram.ab(df,"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.Pb(e)&&hq(b,c,e)}};
kq.prototype.insertLink=function(a,b,c){b=this.diagram.model;var d=a,e=c;this.diagram.isTreePathToChildren||(d=c,e=a);return null!==d&&null!==e?(b.Ge(e.data,b.pa(d.data)),e.Fi()):null};kq.className="TreePartManager";
function Z(a){this.At=',\n "insertedNodeKeys": ';this.dw=',\n "modifiedNodeData": ';this.Ct=',\n "removedNodeKeys": ';mb(this);this.jn=this.Ua="";this.Jf=!1;this.l={};this.Fc=[];this.cb=new Lb;this.ki="key";this.Fk=this.kl=null;this.Zm=this.$m=!1;this.bn=!0;this.Km=null;this.uj="category";this.Df=new Lb;this.cu=new E;this.bh=!1;this.u=null;this.undoManager=new ff;void 0!==a&&(this.nodeDataArray=a)}
Z.prototype.cloneProtected=function(a){a.Ua=this.Ua;a.jn=this.jn;a.Jf=this.Jf;a.ki=this.ki;a.kl=this.kl;a.Fk=this.Fk;a.$m=this.$m;a.Zm=this.Zm;a.bn=this.bn;a.Km=this.Km;a.uj=this.uj};Z.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};t=Z.prototype;t.clear=function(){this.Fc=[];this.cb.clear();this.Df.clear();this.undoManager.clear()};
t.toString=function(a){void 0===a&&(a=0);if(1<a)return this.oq();var b=(""!==this.name?this.name:"")+" Model";if(0<a){b+="\n node data:";a=this.nodeDataArray;for(var c=a.length,d=0;d<c;d++){var e=a[d];b+=" "+this.pa(e)+":"+Qa(e)}}return b};
t.pk=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.hq=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);a.copiesKey||(this.copiesKey=!1);a.nodeCategoryProperty&&(this.nodeCategoryProperty=a.nodeCategoryProperty)};function mq(a){return',\n "modelData": '+nq(a,a.modelData)}
function oq(a,b){b=b.modelData;Ca(b)&&(a.nm(b),a.modelData=b)}t.Xv=function(){var a=this.modelData,b=!1,c;for(c in a)if(!pq(c,a[c])){b=!0;break}a="";b&&(a=mq(this));return a+',\n "nodeDataArray": '+qq(this,this.nodeDataArray,!0)};t.rv=function(a){oq(this,a);a=a.nodeDataArray;Ea(a)&&(this.nm(a),this.nodeDataArray=a)};
function rq(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.J(b)===c)return!0;d.add(b,c);if(b.length!==c.length)return!1;for(var e=0;e<b.length;e++)if(!rq(a,b[e],c[e],d))return!1;return!0}if(Ca(b)&&Ca(c)){if(d.J(b)===c)return!0;d.add(b,c);for(var f in b){var g=b[f];if(!pq(f,g)){var h=c[f];if(void 0===h||!rq(a,g,h,d))return!1}}for(e in c)if(f=c[e],!pq(e,f)&&(g=b[e],void 0===g||!rq(a,g,f,d)))return!1;
return!0}return!1}function sq(a,b,c){a[c]!==b[c]&&A("Model.computeJsonDifference: Model."+c+' is not the same in both models: "'+a[c]+'" and "'+b[c]+'"')}
t.sq=function(a){sq(this,a,"nodeKeyProperty");for(var b=new F,c=new F,d=(new F).addAll(this.cb.iteratorKeys),e=new Lb,f=a.nodeDataArray,g=f.length,h=0;h<g;h++){var k=f[h],l=a.pa(k);if(void 0!==l){d.remove(l);var m=this.Qb(l);null===m?(b.add(l),c.add(k)):rq(this,m,k,e)||c.add(k)}else this.et(k),l=this.pa(k),b.add(l),c.add(k)}f="";rq(this,this.modelData,a.modelData,e)||(f+=mq(this));0<b.count&&(f+=this.At+qq(this,b.Na(),!0));0<c.count&&(f+=this.dw+qq(this,c.Na(),!0));0<d.count&&(f+=this.Ct+qq(this,
d.Na(),!0));return f};t.Xw=function(a,b){void 0===b&&(this.constructor===Z?b="go.Model":b=tq(this,this));return'{ "class": '+this.quote(b)+', "incremental": 1'+this.pk()+this.sq(a)+"}"};t.oy=function(a,b){return this.Xw(a,b)};
t.Wv=function(a,b){var c=this,d=!1,e=new F,f=new F,g=new F;a.changes.each(function(a){a.model===c&&("nodeDataArray"===a.modelChange?a.change===cf?e.add(a.newValue):a.change===df&&g.add(a.oldValue):c.Pb(a.object)?f.add(a.object):c.modelData===a.object&&a.change===af&&(d=!0))});var h=new F;e.each(function(a){h.add(c.pa(a));b||f.add(a)});var k=new F;g.each(function(a){k.add(c.pa(a));b&&f.add(a)});a="";d&&(a+=mq(this));0<h.count&&(a+=(b?this.Ct:this.At)+qq(this,h.Na(),!0));0<f.count&&(a+=this.dw+qq(this,
f.Na(),!0));0<k.count&&(a+=(b?this.At:this.Ct)+qq(this,k.Na(),!0));return a};
t.qv=function(a){oq(this,a);var b=a.insertedNodeKeys,c=a.modifiedNodeData,d=new Lb;if(Array.isArray(c))for(var e=0;e<c.length;e++){var f=c[e],g=this.pa(f);void 0!==g&&null!==g&&d.set(g,f)}if(Array.isArray(b))for(e=b.length,f=0;f<e;f++){g=b[f];var h=this.Qb(g);null===h&&(h=(h=d.get(g))?h:this.copyNodeData({}),this.tm(h,g),this.jf(h))}if(Array.isArray(c))for(b=c.length,d=0;d<b;d++)if(e=c[d],f=this.pa(e),f=this.Qb(f),null!==f)for(var k in e)"__gohashid"===k||k===this.nodeKeyProperty||this.$j()&&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.Qb(a[k]),null!==b&&this.mm(b)};
t.Jx=function(a,b){a.change!==bf&&A("Model.toIncrementalJson argument is not a Transaction ChangedEvent:"+a.toString());var c=a.object;if(!(a.isTransactionFinished&&c instanceof ef))return'{ "incremental": 0 }';void 0===b&&(this.constructor===Z?b="go.Model":b=tq(this,this));return'{ "class": '+this.quote(b)+', "incremental": 1'+this.pk()+this.Wv(c,"FinishedUndo"===a.propertyName)+"}"};t.Rz=function(a,b){return this.Jx(a,b)};
t.oq=function(a){void 0===a&&(this.constructor===Z?a="go.Model":a=tq(this,this));return'{ "class": '+this.quote(a)+this.pk()+this.Xv()+"}"};t.toJSON=function(a){return this.oq(a)};t.Rw=function(a){var b=null;if("string"===typeof a)try{b=w.JSON.parse(a)}catch(d){}else"object"===typeof a?b=a:A("Unable to modify a Model from: "+a);var c=b.incremental;"number"!==typeof c&&A("Unable to apply non-incremental changes to Model: "+a);0!==c&&(this.Aa("applyIncrementalJson"),this.qv(b),this.Za("applyIncrementalJson"))};
t.iy=function(a){return this.Rw(a)};Z.constructGraphLinksModel=function(){return new Z};t=Z.prototype;
t.nm=function(a){if(Ea(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];if(Ca(d)){var e=c;d=this.nm(d);Array.isArray(a)?a[e]=d:A("Cannot replace an object in an HTMLCollection or NodeList at "+e)}}else if(Ca(a)){for(c in a)if(e=a[c],Ca(e)&&(e=this.nm(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 G(e[2*f],e[2*f+1]));d.freeze();a[c]=d}}if("object"===typeof a){c=a;e=a["class"];
if("NaN"===e)c=NaN;else if("Date"===e)c=new Date(a.value);else if("go.Point"===e)c=new G(uq(a.x),uq(a.y));else if("go.Size"===e)c=new K(uq(a.width),uq(a.height));else if("go.Rect"===e)c=new L(uq(a.x),uq(a.y),uq(a.width),uq(a.height));else if("go.Margin"===e)c=new Ic(uq(a.top),uq(a.right),uq(a.bottom),uq(a.left));else if("go.Spot"===e)"string"===typeof a["enum"]?c=Xd(a["enum"]):c=new O(uq(a.x),uq(a.y),uq(a.offsetX),uq(a.offsetY));else if("go.Brush"===e){if(c=new hl,c.type=qb(hl,a.type),"string"===
typeof a.color&&(c.color=a.color),a.start instanceof O&&(c.start=a.start),a.end instanceof O&&(c.end=a.end),"number"===typeof a.startRadius&&(c.startRadius=uq(a.startRadius)),"number"===typeof a.endRadius&&(c.endRadius=uq(a.endRadius)),a=a.colorStops,Ca(a))for(b in a)c.addColorStop(parseFloat(b),a[b])}else"go.Geometry"===e?(b=null,"string"===typeof a.path?b=me(a.path):b=new $d,b.type=qb($d,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 O&&(b.spot1=a.spot1),a.spot2 instanceof O&&(b.spot2=a.spot2),c=b):"go.EnumValue"===e&&(b=a.classType,0===b.indexOf("go.")&&(b=b.substr(3)),c=qb(vq[b]?vq[b]:null,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.xm=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.xm(a.valueOf()):Ea(a)?qq(this,a):Ca(a)?nq(this,a):"function"===typeof a?"null":a.toString()};
function qq(a,b,c){void 0===c&&(c=!1);var d=b.length;if(0>=d)return"[]";var e=new sb;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.xm(g)))}c&&1<d&&e.add("\n");e.add(" ]");return e.toString()}function pq(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 nq(a,b){var c=b;if(c instanceof G)b={"class":"go.Point",x:wq(c.x),y:wq(c.y)};else if(c instanceof K)b={"class":"go.Size",width:wq(c.width),height:wq(c.height)};else if(c instanceof L)b={"class":"go.Rect",x:wq(c.x),y:wq(c.y),width:wq(c.width),height:wq(c.height)};else if(c instanceof Ic)b={"class":"go.Margin",top:wq(c.top),right:wq(c.right),bottom:wq(c.bottom),left:wq(c.left)};else if(c instanceof O)c.gb()?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 hl){b={"class":"go.Brush",type:c.type.name};if(c.type===kl)b.color=c.color;else if(c.type===nl||c.type===il)b.start=c.start,b.end=c.end,c.type===il&&(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 $d?(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.A(Tc)||(b.spot1=c.spot1),c.spot2.A(hd)||(b.spot2=c.spot2),c.type===ae&&(b.path=je(c))):c instanceof D&&(b={"class":"go.EnumValue",classType:tq(a,c.classType),name:c.name});d="{";c=!0;for(var e in b){var f=cn(b,e);if(!pq(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.xm(h.x);g+=",";
g+=a.xm(h.y)}g+="]";d+=g}else d+=a.xm(f)}return d+"}"}function uq(a){return"number"===typeof a?a:"NaN"===a?NaN:"9e9999"===a?Infinity:"-9e9999"===a?-Infinity:parseFloat(a)}t.oh=function(a){this.cu.add(a)};t.lk=function(a){this.cu.remove(a)};t.Fs=function(a){this.skipsUndoManager||this.undoManager.av(a);for(var b=this.cu,c=b.length,d=0;d<c;d++)b.N(d)(a)};t.ab=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,"",af,a,this,b,c,d,e)};
t.jt=function(a,b,c,d,e,f){xq(this,"",af,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 $e;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.Fs(l)}
t.Oj=function(a,b){if(null!==a&&a.model===this)if(a.change===af)Nj(a.object,a.propertyName,a.J(b));else if(a.change===cf){var c=a.newParam;if("nodeDataArray"===a.modelChange){if(a=a.newValue,Ca(a)&&"number"===typeof c){var d=this.pa(a);b?(this.Fc[c]===a&&Ja(this.Fc,c),void 0!==d&&this.cb.remove(d)):(this.Fc[c]!==a&&Ia(this.Fc,c,a),void 0!==d&&this.cb.add(d,a))}}else""===a.modelChange?((d=a.object)&&!Ea(d)&&a.propertyName&&(d=cn(a.object,a.propertyName)),Ea(d)&&"number"===typeof c&&(a=a.newValue,b?
Ja(d,c):Ia(d,c,a))):A("unknown ChangedEvent.Insert modelChange: "+a.toString())}else a.change===df?(c=a.oldParam,"nodeDataArray"===a.modelChange?(a=a.oldValue,Ca(a)&&"number"===typeof c&&(d=this.pa(a),b?(this.Fc[c]!==a&&Ia(this.Fc,c,a),void 0!==d&&this.cb.add(d,a)):(this.Fc[c]===a&&Ja(this.Fc,c),void 0!==d&&this.cb.remove(d)))):""===a.modelChange?((d=a.object)&&!Ea(d)&&a.propertyName&&(d=cn(a.object,a.propertyName)),Ea(d)&&"number"===typeof c&&(a=a.oldValue,b?Ia(d,c,a):Ja(d,c))):A("unknown ChangedEvent.Remove modelChange: "+
a.toString())):a.change!==bf&&A("unknown ChangedEvent: "+a.toString())};t.Aa=function(a){return this.undoManager.Aa(a)};t.Za=function(a){return this.undoManager.Za(a)};t.tf=function(){return this.undoManager.tf()};Z.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.Aa(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.Za(b):this.undoManager.tf(),this.skipsUndoManager=c}};t=Z.prototype;
t.Ea=function(a,b){void 0===b&&(b="");xq(this,"SourceChanged",bf,b,a,null,null)};t.pa=function(a){if(null!==a){var b=this.ki;if(""!==b&&(b=cn(a,b),void 0!==b)){if(cq(b))return b;A("Key value for node data "+a+" is not a number or a string: "+b)}}};
t.tm=function(a,b){if(null!==a){var c=this.ki;if(""!==c)if(this.Pb(a)){var d=cn(a,c);d!==b&&null===this.Qb(b)&&(Nj(a,c,b),void 0!==d&&this.cb.remove(d),this.cb.add(b,a),xq(this,"nodeKey",af,c,a,d,b),"string"===typeof c&&this.Ea(a,c),this.kq(d,b))}else Nj(a,c,b)}};function cq(a){return"number"===typeof a||"string"===typeof a}t.Pb=function(a){var b=this.pa(a);return void 0===b?!1:this.cb.J(b)===a};
t.Qb=function(a){null===a&&A("Model.findNodeDataForKey:key must not be null");return void 0!==a&&cq(a)?this.cb.J(a):null};t.et=function(a){if(null!==a){var b=this.ki;if(""!==b){var c=this.pa(a);if(void 0===c||this.cb.contains(c)){var d=this.kl;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.cb.contains(c))){Nj(a,b,c);return}if("string"===typeof c){for(d=2;this.cb.contains(c+d);)d++;Nj(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.cb.count-1;this.cb.contains(c);)c--;Nj(a,b,c)}}}}};
t.jf=function(a){null!==a&&(Db(a),this.Pb(a)||Vp(this,a,!0))};function Vp(a,b,c){var d=a.pa(b);if(void 0===d||a.cb.J(d)!==b)a.et(b),d=a.pa(b),void 0===d?A("Model.makeNodeDataKeyUnique failed on "+b+". Data not added to Model."):(a.cb.add(d,b),d=null,c&&(d=a.Fc.length,Ia(a.Fc,d,b)),xq(a,"nodeDataArray",cf,"nodeDataArray",a,null,b,null,d),a.pm(b),a.om(b))}t.ey=function(a){if(Ea(a))for(var b=a.length,c=0;c<b;c++)this.jf(a[c]);else for(a=a.iterator;a.next();)this.jf(a.value)};
t.mm=function(a){null!==a&&Up(this,a,!0)};function Up(a,b,c){var d=a.pa(b);void 0!==d&&a.cb.remove(d);d=null;if(c){a:if(c=a.Fc,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;Ja(a.Fc,d)}xq(a,"nodeDataArray",df,"nodeDataArray",a,b,null,d,null);a.pq(b)}t.Iz=function(a){if(Ea(a))for(var b=a.length,c=0;c<b;c++)this.mm(a[c]);else for(a=a.iterator;a.next();)this.mm(a.value)};
t.yz=function(a){if(Ea(a)){for(var b=new F(this.cb.iteratorKeys),c=new F,d=a.length,e=0;e<d;e++){var f=a[e],g=this.pa(f);if(void 0!==g){c.add(g);var h=this.Qb(g);null!==h?this.Nj(h,f):(h={},this.tm(h,g),this.Nj(h,f),this.jf(h))}else this.jf(f),c.add(this.pa(f))}for(a=b.iterator;a.next();)b=a.value,c.contains(b)||(b=this.Qb(b))&&this.mm(b)}};t.kq=function(a,b){void 0!==b&&(a=fq(this,a),a instanceof F&&this.Df.add(b,a))};t.Sv=function(){};t.pm=function(){};t.om=function(){};t.pq=function(){};
function hq(a,b,c){if(void 0!==b){var d=a.Df.J(b);null===d&&(d=new F,a.Df.add(b,d));d.add(c)}}function gq(a,b,c){if(void 0!==b){var d=a.Df.J(b);d instanceof F&&(void 0===c||null===c?a.Df.remove(b):(d.remove(c),0===d.count&&a.Df.remove(b)))}}function fq(a,b){if(void 0===b)return null;a=a.Df.J(b);return a instanceof F?a:null}t.Iu=function(a){void 0===a?this.Df.clear():this.Df.remove(a)};
Z.prototype.copyNodeData=function(a){if(null===a)return null;var b=this.Fk;a=null!==b?b(a,this):yq(this,a,!0);Ca(a)&&mb(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)}mb(d);return d}if(c&&Ca(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=cn(b,d),g=tq(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 ff||f instanceof ef||f instanceof $e?Nj(c,d,f):(f=yq(a,f,!1),Nj(c,d,f))}mb(c);return c}return b instanceof G?b.copy():b instanceof K?b.copy():b instanceof L?b.copy():b instanceof O?b.copy():b instanceof Ic?b.copy():b}
Z.prototype.setDataProperty=function(a,b,c){if(this.Pb(a))if(b===this.nodeKeyProperty)this.tm(a,c);else{if(b===this.nodeCategoryProperty){this.mq(a,c);return}}else!zq&&a instanceof Y&&(zq=!0,ya('Model.setDataProperty is modifying a GraphObject, "'+a.toString()+'"'),ya(" Is that really your intent?"));var d=cn(a,b);d!==c&&(Nj(a,b,c),this.jt(a,b,d,c))};t=Z.prototype;t.set=function(a,b,c){this.setDataProperty(a,b,c)};
t.Nj=function(a,b){if(b){var c=this.Pb(a),d;for(d in b)"__gohashid"===d||c&&d===this.nodeKeyProperty||this.setDataProperty(a,d,b[d])}};t.Zx=function(a,b){this.Vs(a,-1,b)};t.Vs=function(a,b,c){0>b&&(b=a.length);Ia(a,b,c);xq(this,"",cf,"",a,null,c,null,b)};t.tv=function(a,b){void 0===b&&(b=-1);a===this.Fc&&A("Model.removeArrayItem should not be called on the Model.nodeDataArray");-1===b&&(b=a.length-1);var c=a[b];Ja(a,b);xq(this,"",df,"",a,c,null,b,null)};
t.Ss=function(a){if(null===a)return"";var b=this.uj;if(""===b)return"";b=cn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;A("getCategoryForNodeData found a non-string category for "+a+": "+b);return""};t.mq=function(a,b){if(null!==a){var c=this.uj;if(""!==c)if(this.Pb(a)){var d=cn(a,c);void 0===d&&(d="");d!==b&&(Nj(a,c,b),xq(this,"nodeCategory",af,c,a,d,b))}else Nj(a,c,b)}};t.dm=function(){return!1};t.$j=function(){return!1};t.cm=function(){return!1};t.at=function(){return!1};t.ak=function(){return!1};
function vi(){return new Z}function tq(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 tq(a,b.constructor);return typeof b}function cn(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 Nj(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){}}
pa.Object.defineProperties(Z.prototype,{name:{get:function(){return this.Ua},set:function(a){var b=this.Ua;b!==a&&(this.Ua=a,this.g("name",b,a))}},dataFormat:{get:function(){return this.jn},set:function(a){var b=this.jn;b!==a&&(this.jn=a,this.g("dataFormat",b,a))}},isReadOnly:{get:function(){return this.Jf},set:function(a){var b=this.Jf;b!==a&&(this.Jf=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.Ea(a))}},undoManager:{get:function(){return this.u},set:function(a){var b=this.u;b!==a&&(null!==b&&b.xx(this),this.u=a,null!==a&&a.Pw(this))}},skipsUndoManager:{get:function(){return this.bh},set:function(a){this.bh=a}},nodeKeyProperty:{get:function(){return this.ki},set:function(a){var b=this.ki;
b!==a&&(""===a&&A("Model.nodeKeyProperty may not be the empty string"),0<this.cb.count&&A("Cannot set Model.nodeKeyProperty when there is existing node data"),this.ki=a,this.g("nodeKeyProperty",b,a))}},makeUniqueKeyFunction:{get:function(){return this.kl},set:function(a){var b=this.kl;b!==a&&(this.kl=a,this.g("makeUniqueKeyFunction",b,a))}},nodeDataArray:{get:function(){return this.Fc},set:function(a){var b=this.Fc;if(b!==a){this.cb.clear();
this.Sv();for(var c=a.length,d=0;d<c;d++){var e=a[d];if(!Ca(e)){A("Model.nodeDataArray must only contain Objects, not: "+e);return}Db(e)}this.Fc=a;d=new E;for(e=0;e<c;e++){var f=a[e],g=this.pa(f);void 0===g?d.add(f):null!==this.cb.J(g)?d.add(f):this.cb.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.et(e),f=this.pa(e),void 0!==f&&this.cb.add(f,e);xq(this,"nodeDataArray",af,"nodeDataArray",this,b,a);for(b=0;b<c;b++)d=a[b],this.pm(d),this.om(d);this.Iu();Array.isArray(a)||(this.isReadOnly=!0)}}},
copyNodeDataFunction:{get:function(){return this.Fk},set:function(a){var b=this.Fk;b!==a&&(this.Fk=a,this.g("copyNodeDataFunction",b,a))}},copiesArrays:{get:function(){return this.$m},set:function(a){var b=this.$m;b!==a&&(this.$m=a,this.g("copiesArrays",b,a))}},copiesArrayObjects:{get:function(){return this.Zm},set:function(a){var b=this.Zm;b!==a&&(this.Zm=a,this.g("copiesArrayObjects",b,a))}},copiesKey:{
get:function(){return this.bn},set:function(a){var b=this.bn;b!==a&&(this.bn=a,this.g("copiesKey",b,a))}},afterCopyFunction:{get:function(){return this.Km},set:function(a){var b=this.Km;b!==a&&(this.Km=a,this.g("afterCopyFunction",b,a))}},nodeCategoryProperty:{get:function(){return this.uj},set:function(a){var b=this.uj;b!==a&&(this.uj=a,this.g("nodeCategoryProperty",b,a))}}});
pa.Object.defineProperties(Z,{type:{get:function(){return"Model"}}});Z.prototype.setCategoryForNodeData=Z.prototype.mq;Z.prototype.getCategoryForNodeData=Z.prototype.Ss;Z.prototype.removeArrayItem=Z.prototype.tv;Z.prototype.insertArrayItem=Z.prototype.Vs;Z.prototype.addArrayItem=Z.prototype.Zx;Z.prototype.assignAllDataProperties=Z.prototype.Nj;Z.prototype.set=Z.prototype.set;Z.prototype.clearUnresolvedReferences=Z.prototype.Iu;Z.prototype.mergeNodeDataArray=Z.prototype.yz;
Z.prototype.removeNodeDataCollection=Z.prototype.Iz;Z.prototype.removeNodeData=Z.prototype.mm;Z.prototype.addNodeDataCollection=Z.prototype.ey;Z.prototype.addNodeData=Z.prototype.jf;Z.prototype.makeNodeDataKeyUnique=Z.prototype.et;Z.prototype.findNodeDataForKey=Z.prototype.Qb;Z.prototype.containsNodeData=Z.prototype.Pb;Z.prototype.setKeyForNodeData=Z.prototype.tm;Z.prototype.getKeyForNodeData=Z.prototype.pa;Z.prototype.updateTargetBindings=Z.prototype.Ea;Z.prototype.commit=Z.prototype.commit;
Z.prototype.rollbackTransaction=Z.prototype.tf;Z.prototype.commitTransaction=Z.prototype.Za;Z.prototype.startTransaction=Z.prototype.Aa;Z.prototype.raiseDataChanged=Z.prototype.jt;Z.prototype.raiseChanged=Z.prototype.g;Z.prototype.raiseChangedEvent=Z.prototype.ab;Z.prototype.removeChangedListener=Z.prototype.lk;Z.prototype.addChangedListener=Z.prototype.oh;Z.prototype.writeJsonValue=Z.prototype.xm;Z.prototype.replaceJsonObjects=Z.prototype.nm;Z.prototype.applyIncrementalJSON=Z.prototype.iy;
Z.prototype.applyIncrementalJson=Z.prototype.Rw;Z.prototype.toJSON=Z.prototype.toJSON;Z.prototype.toJson=Z.prototype.oq;Z.prototype.toIncrementalJSON=Z.prototype.Rz;Z.prototype.toIncrementalJson=Z.prototype.Jx;Z.prototype.computeJSONDifference=Z.prototype.oy;Z.prototype.computeJsonDifference=Z.prototype.Xw;Z.prototype.clear=Z.prototype.clear;var zq=!1,vq={};Z.className="Model";
Z.fromJSON=Z.fromJson=function(a,b){void 0===b&&(b=null);var c=null;if("string"===typeof a)try{c=w.JSON.parse(a)}catch(f){}else"object"===typeof a?c=a:A("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]?vq[d]:null):(e=vq[d]?vq[d]:null,void 0===e&&(e=w[d]));"function"===typeof e&&(a=new e)}catch(f){}null===a||a instanceof Z?b=a:A("Unable to construct a Model of declared class: "+c["class"])}null===
b&&(b=Z.constructGraphLinksModel());b.hq(c);b.rv(c);return b};Z.safePropertyValue=cn;Z.safePropertySet=Nj;vq.Brush=hl;vq.ChangedEvent=$e;vq.Geometry=$d;vq.GraphObject=Y;vq.Margin=Ic;vq.Panel=X;vq.Point=G;vq.Rect=L;vq.Size=K;vq.Spot=O;vq.Transaction=ef;vq.UndoManager=ff;function Ci(a,b,c){mb(this);this.v=!1;void 0===a&&(a="");void 0===b&&(b=a);void 0===c&&(c=null);this.l=-1;this.Pd=null;this.Ll=a;this.Kl=this.sp=0;this.rs=null;this.Tn=!1;this.Bl=b;this.Ym=c;this.po=Aq;this.Sm=null;this.Vt=new F}
Ci.prototype.copy=function(){var a=new Ci;a.Ll=this.Ll;a.sp=this.sp;a.Kl=this.Kl;a.rs=this.rs;a.Tn=this.Tn;a.Bl=this.Bl;a.Ym=this.Ym;a.po=this.po;a.Sm=this.Sm;return a};t=Ci.prototype;t.fb=function(a){a.classType===Ci&&(this.mode=a)};t.toString=function(){return"Binding("+this.targetProperty+":"+this.sourceProperty+(-1!==this.Vi?" "+this.Vi:"")+" "+this.mode.name+")"};t.freeze=function(){this.v=!0;return this};t.ha=function(){this.v=!1;return this};
t.px=function(a){void 0===a&&(a=null);this.mode=Wm;this.backConverter=a;return this};t.eq=function(a){void 0===a&&(a="");this.sourceName=a;this.isToModel=!1;return this};t.Az=function(){this.sourceName=null;this.isToModel=!0;return this};function Vk(a,b,c){a=a.sourceName;return null===a||""===a?b:"/"===a?c.part:"."===a?c:".."===a?c.panel:b.$a(a)}
t.Tv=function(a,b,c){var d=this.Bl;if(void 0===c||""===d||d===c){c=this.Ll;var e=this.Ym;if(null===e&&""===c)ya("Binding error: target property is the empty string: "+this.toString());else{var f=b;""!==d&&(f=cn(b,d));if(void 0!==f)if(null===e)""!==c&&Nj(a,c,f);else try{if(""!==c){var g=e(f,a);Nj(a,c,g)}else e(f,a)}catch(h){}}}};
t.rq=function(a,b,c,d){if(this.po===Wm){var e=this.Ll;if(void 0===c||e===c){c=this.Bl;var f=this.Sm,g=a;""!==e&&(g=cn(a,e));if(void 0!==g&&!this.Vt.contains(a))try{this.Vt.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):Nj(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.tv(m,l);k.Vs(m,l,g)}}else try{if(""!==c){var n=f(g,b,k);null!==k?k.setDataProperty(b,
c,n):Nj(b,c,n)}else{var p=f(g,b,k);if(void 0!==p&&null!==k&&null!==d&&0<=d.itemIndex&&null!==d.panel&&Array.isArray(d.panel.itemArray)){var q=d.itemIndex,r=d.panel.itemArray;k.tv(r,q);k.Vs(r,q,p)}}}catch(u){}}finally{this.Vt.remove(a)}}}};
pa.Object.defineProperties(Ci.prototype,{Vi:{get:function(){return this.l},set:function(a){this.v&&wa(this);this.l=a}},targetProperty:{get:function(){return this.Ll},set:function(a){this.v&&wa(this);this.Ll=a}},sourceName:{get:function(){return this.rs},set:function(a){this.v&&wa(this);this.rs=a;null!==a&&(this.Tn=!1)}},isToModel:{get:function(){return this.Tn},set:function(a){this.v&&
wa(this);this.Tn=a}},sourceProperty:{get:function(){return this.Bl},set:function(a){this.v&&wa(this);this.Bl=a}},converter:{get:function(){return this.Ym},set:function(a){this.v&&wa(this);this.Ym=a}},backConverter:{get:function(){return this.Sm},set:function(a){this.v&&wa(this);this.Sm=a}},mode:{get:function(){return this.po},set:function(a){this.v&&wa(this);this.po=a}}});
Ci.prototype.updateSource=Ci.prototype.rq;Ci.prototype.updateTarget=Ci.prototype.Tv;Ci.prototype.ofModel=Ci.prototype.Az;Ci.prototype.ofObject=Ci.prototype.eq;Ci.prototype.makeTwoWay=Ci.prototype.px;var Aq=new D(Ci,"OneWay",1),Wm=new D(Ci,"TwoWay",2);Ci.className="Binding";Ci.parseEnum=function(a,b){return function(c){c=qb(a,c);return null===c?b:c}};Ci.toString=Qa;Ci.OneWay=Aq;Ci.TwoWay=Wm;
function Bq(a,b){Z.call(this);this.zt=',\n "insertedLinkKeys": ';this.cw=',\n "modifiedLinkData": ';this.Bt=',\n "removedLinkKeys": ';this.Nc=[];this.Kf=new F;this.qb=new Lb;this.gi="";this.Yi=this.Ek=this.ll=null;this.Te="from";this.Ue="to";this.rj=this.qj="";this.pj="category";this.Gd="";this.pl="isGroup";this.pe="group";this.an=!1;void 0!==a&&(this.nodeDataArray=a);void 0!==b&&(this.linkDataArray=b)}oa(Bq,Z);Bq.constructGraphLinksModel=Z.constructGraphLinksModel;
Bq.prototype.cloneProtected=function(a){Z.prototype.cloneProtected.call(this,a);a.gi=this.gi;a.ll=this.ll;a.Ek=this.Ek;a.Te=this.Te;a.Ue=this.Ue;a.qj=this.qj;a.rj=this.rj;a.pj=this.pj;a.Gd=this.Gd;a.pl=this.pl;a.pe=this.pe;a.an=this.an};t=Bq.prototype;t.clear=function(){Z.prototype.clear.call(this);this.Nc=[];this.qb.clear();this.Kf.clear()};
t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.oq();var b=(""!==this.name?this.name:"")+" GraphLinksModel";if(0<a){b+="\n node data:";a=this.nodeDataArray;var c=a.length,d;for(d=0;d<c;d++){var e=a[d];b+=" "+this.pa(e)+":"+Qa(e)}b+="\n link data:";a=this.linkDataArray;c=a.length;for(d=0;d<c;d++)e=a[d],b+=" "+aq(this,e,!0)+"--\x3e"+aq(this,e,!1)}return b};
t.pk=function(){var a=Z.prototype.pk.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.hq=function(a){Z.prototype.hq.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.Xv=function(){var a=Z.prototype.Xv.call(this),b=',\n "linkDataArray": '+qq(this,this.linkDataArray,!0);return a+b};t.rv=function(a){Z.prototype.rv.call(this,a);a=a.linkDataArray;Array.isArray(a)&&(this.nm(a),this.linkDataArray=a)};
t.sq=function(a){if(!(a instanceof Bq))return A("Model.computeJsonDifference: newmodel must be a GraphLinksModel"),"";var b=Z.prototype.sq.call(this,a);sq(this,a,"linkKeyProperty");sq(this,a,"linkFromKeyProperty");sq(this,a,"linkToKeyProperty");sq(this,a,"linkLabelKeysProperty");sq(this,a,"nodeIsGroupProperty");sq(this,a,"nodeGroupKeyProperty");for(var c=new F,d=new F,e=(new F).addAll(this.qb.iteratorKeys),f=new Lb,g=a.linkDataArray,h=g.length,k=0;k<h;k++){var l=g[k],m=a.jc(l);if(void 0!==m){e.remove(m);
var n=this.th(m);null===n?(c.add(m),d.add(l)):rq(this,n,l,f)||d.add(l)}else this.aq(l),m=this.jc(l),c.add(m),d.add(l)}a=b;0<c.count&&(a+=this.zt+qq(this,c.Na(),!0));0<d.count&&(a+=this.cw+qq(this,d.Na(),!0));0<e.count&&(a+=this.Bt+qq(this,e.Na(),!0));return a};
t.Wv=function(a,b){var c=Z.prototype.Wv.call(this,a,b),d=this,e=new F,f=new F,g=new F;a.changes.each(function(a){a.model===d&&("linkDataArray"===a.modelChange?a.change===cf?e.add(a.newValue):a.change===df&&g.add(a.oldValue):d.ze(a.object)&&f.add(a.object))});var h=new F;e.each(function(a){h.add(d.jc(a));b||f.add(a)});var k=new F;g.each(function(a){k.add(d.jc(a));b&&f.add(a)});a=c;0<h.count&&(a+=(b?this.Bt:this.zt)+qq(this,h.Na(),!0));0<f.count&&(a+=this.cw+qq(this,f.Na(),!0));0<k.count&&(a+=(b?this.zt:
this.Bt)+qq(this,k.Na(),!0));return a};
t.qv=function(a){Z.prototype.qv.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.th(e);null===f&&(f=this.Lp({}),this.st(f,e),this.zi(f))}b=a.modifiedLinkData;if(Array.isArray(b))for(c=b.length,d=0;d<c;d++)if(e=b[d],f=this.jc(e),f=this.th(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.th(a[b]),null!==c&&this.lm(c)};
t.Oj=function(a,b){if(a.change===cf){var c=a.newParam;if("linkDataArray"===a.modelChange){a=a.newValue;if(Ca(a)&&"number"===typeof c){var d=this.jc(a);b?(this.Kf.remove(a),this.Nc[c]===a&&this.Nc.splice(c,1),void 0!==d&&this.qb.remove(d)):(this.Kf.add(a),this.Nc[c]!==a&&this.Nc.splice(c,0,a),void 0!==d&&this.qb.add(d,a))}return}if("linkLabelKeys"===a.modelChange){d=this.og(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===df){c=a.oldParam;if("linkDataArray"===a.modelChange){a=a.oldValue;Ca(a)&&"number"===typeof c&&(d=this.jc(a),b?(this.Kf.add(a),this.Nc[c]!==a&&this.Nc.splice(c,0,a),void 0!==d&&this.qb.add(d,a)):(this.Kf.remove(a),this.Nc[c]===a&&this.Nc.splice(c,1),void 0!==d&&this.qb.remove(d)));return}if("linkLabelKeys"===a.modelChange){d=this.og(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.Oj.call(this,a,b)};t.em=function(a){if(void 0!==a){var b=this.Yi;if(null!==b){var c=this.Qb(a);null===c&&(c=this.copyNodeData(b),Nj(c,this.nodeKeyProperty,a),this.jf(c))}return a}};t.Xy=function(a){return aq(this,a,!0)};t.Bx=function(a,b){iq(this,a,b,!0)};t.bz=function(a){return aq(this,a,!1)};t.Fx=function(a,b){iq(this,a,b,!1)};
function aq(a,b,c){if(null!==b&&(a=c?a.Te:a.Ue,""!==a&&(a=cn(b,a),void 0!==a))){if(cq(a))return a;A((c?"FromKey":"ToKey")+" value for link data "+b+" is not a number or a string: "+a)}}function iq(a,b,c,d){null===c&&(c=void 0);if(null!==b){var e=d?a.Te:a.Ue;if(""!==e)if(c=a.em(c),a.ze(b)){var f=cn(b,e);f!==c&&(gq(a,f,b),Nj(b,e,c),null===a.Qb(c)&&hq(a,c,b),xq(a,d?"linkFromKey":"linkToKey",af,e,b,f,c),"string"===typeof e&&a.Ea(b,e))}else Nj(b,e,c)}}t.Yy=function(a){return $p(this,a,!0)};
t.Cx=function(a,b){jq(this,a,b,!0)};t.cz=function(a){return $p(this,a,!1)};t.Gx=function(a,b){jq(this,a,b,!1)};function $p(a,b,c){if(null===b)return"";a=c?a.qj:a.rj;if(""===a)return"";b=cn(b,a);return void 0===b?"":b}function jq(a,b,c,d){if(null!==b){var e=d?a.qj:a.rj;if(""!==e)if(a.ze(b)){var f=cn(b,e);void 0===f&&(f="");f!==c&&(Nj(b,e,c),xq(a,d?"linkFromPortId":"linkToPortId",af,e,b,f,c),"string"===typeof e&&a.Ea(b,e))}else Nj(b,e,c)}}
t.og=function(a){if(null===a)return Cq;var b=this.Gd;if(""===b)return Cq;a=cn(a,b);return void 0===a?Cq:a};t.Dv=function(a,b){if(null!==a){var c=this.Gd;if(""!==c)if(this.ze(a)){var d=cn(a,c);void 0===d&&(d=Cq);if(d!==b){if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)gq(this,d[f],a);Nj(a,c,b);e=b.length;for(f=0;f<e;f++){var g=b[f];null===this.Qb(g)&&hq(this,g,a)}xq(this,"linkLabelKeys",af,c,a,d,b);"string"===typeof c&&this.Ea(a,c)}}else Nj(a,c,b)}};
t.Du=function(a,b){if(null!==b&&void 0!==b&&null!==a){var c=this.Gd;if(""!==c){var d=cn(a,c);if(void 0===d)c=[],c.push(b),this.Dv(a,c);else if(Array.isArray(d)){var e=d.indexOf(b);0<=e||(e=d.length,d.push(b),this.ze(a)&&(null===this.Qb(b)&&hq(this,b,a),xq(this,"linkLabelKeys",cf,c,a,null,b,null,e)))}else A(c+" property is not an Array; cannot addLabelKeyForLinkData: "+a)}}};
t.wx=function(a,b){if(null!==b&&void 0!==b&&null!==a){var c=this.Gd;if(""!==c){var d=cn(a,c);if(Array.isArray(d)){var e=d.indexOf(b);0>e||(d.splice(e,1),this.ze(a)&&(gq(this,b,a),xq(this,"linkLabelKeys",df,c,a,b,null,e,null)))}else void 0!==d&&A(c+" property is not an Array; cannot removeLabelKeyforLinkData: "+a)}}};t.jc=function(a){if(null!==a){var b=this.gi;if(""!==b&&(b=cn(a,b),void 0!==b)){if(cq(b))return b;A("Key value for link data "+a+" is not a number or a string: "+b)}}};
t.st=function(a,b){if(null!==a){var c=this.gi;if(""!==c)if(this.ze(a)){var d=cn(a,c);d!==b&&null===this.th(b)&&(Nj(a,c,b),void 0!==d&&this.qb.remove(d),this.qb.add(b,a),xq(this,"linkKey",af,c,a,d,b),"string"===typeof c&&this.Ea(a,c))}else Nj(a,c,b)}};t.th=function(a){null===a&&A("GraphLinksModel.findLinkDataForKey:key must not be null");return void 0!==a&&cq(a)?this.qb.J(a):null};
t.aq=function(a){if(null!==a){var b=this.gi;if(""!==b){var c=this.jc(a);if(void 0===c||this.qb.contains(c)){var d=this.ll;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.qb.contains(c))){Nj(a,b,c);return}if("string"===typeof c){for(d=2;this.qb.contains(c+d);)d++;Nj(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.qb.count-1;this.qb.contains(c);)c--;Nj(a,b,c)}}}}};t.ze=function(a){return null===a?!1:this.Kf.contains(a)};t.zi=function(a){null!==a&&(Db(a),this.ze(a)||eq(this,a,!0))};
function eq(a,b,c){if(""!==a.linkKeyProperty){var d=a.jc(b);if(void 0!==d&&a.qb.J(d)===b)return;a.aq(b);d=a.jc(b);if(void 0===d){A("GraphLinksModel.makeLinkDataKeyUnique failed on "+b+". Data not added to model.");return}a.qb.add(d,b)}a.Kf.add(b);d=null;c&&(d=a.Nc.length,a.Nc.splice(d,0,b));xq(a,"linkDataArray",cf,"linkDataArray",a,null,b,null,d);Dq(a,b)}t.by=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.zi(a[c]);else for(a=a.iterator;a.next();)this.zi(a.value)};
t.lm=function(a){null!==a&&dq(this,a,!0)};function dq(a,b,c){a.Kf.remove(b);var d=a.jc(b);void 0!==d&&a.qb.remove(d);d=null;if(c){d=a.Nc.indexOf(b);if(0>d)return;a.Nc.splice(d,1)}xq(a,"linkDataArray",df,"linkDataArray",a,b,null,d,null);c=aq(a,b,!0);gq(a,c,b);c=aq(a,b,!1);gq(a,c,b);d=a.og(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],gq(a,c,b)}t.Gz=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.lm(a[c]);else for(a=a.iterator;a.next();)this.lm(a.value)};
t.xz=function(a){if(Ea(a)){for(var b=new F(this.qb.iteratorKeys),c=new F,d=a.length,e=0;e<d;e++){var f=a[e],g=this.jc(f);if(void 0!==g){c.add(g);var h=this.th(g);null!==h?this.Nj(h,f):(h={},this.st(h,g),this.Nj(h,f),this.zi(h))}else this.zi(f),c.add(this.jc(f))}for(a=b.iterator;a.next();)b=a.value,c.contains(b)||(b=this.th(b))&&this.lm(b)}};
function Dq(a,b){var c=aq(a,b,!0);c=a.em(c);null===a.Qb(c)&&hq(a,c,b);c=aq(a,b,!1);c=a.em(c);null===a.Qb(c)&&hq(a,c,b);var d=a.og(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],null===a.Qb(c)&&hq(a,c,b)}t.Lp=function(a){if(null===a)return null;var b=this.Ek;a=null!==b?b(a,this):yq(this,a,!0);Ca(a)&&(mb(a),""!==this.Te&&Nj(a,this.Te,void 0),""!==this.Ue&&Nj(a,this.Ue,void 0),""!==this.Gd&&Nj(a,this.Gd,[]));return a};
t.fv=function(a){if(null===a)return!1;var b=this.pl;return""===b?!1:cn(a,b)?!0:!1};t.Ii=function(a){if(null!==a){var b=this.pe;if(""!==b&&(b=cn(a,b),void 0!==b)){if(cq(b))return b;A("GroupKey value for node data "+a+" is not a number or a string: "+b)}}};
t.qt=function(a,b){null===b&&(b=void 0);if(null!==a){var c=this.pe;if(""!==c)if(this.Pb(a)){var d=cn(a,c);d!==b&&(gq(this,d,a),Nj(a,c,b),null===this.Qb(b)&&hq(this,b,a),xq(this,"nodeGroupKey",af,c,a,d,b),"string"===typeof c&&this.Ea(a,c))}else Nj(a,c,b)}};Bq.prototype.copyNodeData=function(a){if(null===a)return null;a=Z.prototype.copyNodeData.call(this,a);this.Sj||""===this.pe||void 0===cn(a,this.pe)||Nj(a,this.pe,void 0);return a};
Bq.prototype.setDataProperty=function(a,b,c){if(this.Pb(a))if(b===this.nodeKeyProperty)this.tm(a,c);else{if(b===this.nodeCategoryProperty){this.mq(a,c);return}if(b===this.nodeGroupKeyProperty){this.qt(a,c);return}}else if(this.ze(a)){if(b===this.linkFromKeyProperty){iq(this,a,c,!0);return}if(b===this.linkToKeyProperty){iq(this,a,c,!1);return}if(b===this.linkFromPortIdProperty){jq(this,a,c,!0);return}if(b===this.linkToPortIdProperty){jq(this,a,c,!1);return}if(b===this.linkKeyProperty){this.st(a,c);
return}if(b===this.linkCategoryProperty){this.pt(a,c);return}if(b===this.linkLabelKeysProperty){this.Dv(a,c);return}}var d=cn(a,b);d!==c&&(Nj(a,b,c),this.jt(a,b,d,c))};t=Bq.prototype;t.Nj=function(a,b){if(b){var c=this.Pb(a),d=this.ze(a),e;for(e in b)"__gohashid"===e||c&&e===this.nodeKeyProperty||d&&e===this.linkKeyProperty||this.setDataProperty(a,e,b[e])}};
t.kq=function(a,b){Z.prototype.kq.call(this,a,b);for(var c=this.cb.iterator;c.next();)this.xv(c.value,a,b);for(c=this.Kf.iterator;c.next();){var d=c.value,e=a,f=b;if(aq(this,d,!0)===e){var g=this.Te;Nj(d,g,f);xq(this,"linkFromKey",af,g,d,e,f);"string"===typeof g&&this.Ea(d,g)}aq(this,d,!1)===e&&(g=this.Ue,Nj(d,g,f),xq(this,"linkToKey",af,g,d,e,f),"string"===typeof g&&this.Ea(d,g));g=this.og(d);if(Array.isArray(g))for(var h=g.length,k=this.Gd,l=0;l<h;l++)g[l]===e&&(g[l]=f,xq(this,"linkLabelKeys",cf,
k,d,e,f,l,l))}};t.xv=function(a,b,c){if(this.Ii(a)===b){var d=this.pe;Nj(a,d,c);xq(this,"nodeGroupKey",af,d,a,b,c);"string"===typeof d&&this.Ea(a,d)}};t.Sv=function(){Z.prototype.Sv.call(this);for(var a=this.linkDataArray,b=a.length,c=0;c<b;c++)Dq(this,a[c])};
t.pm=function(a){Z.prototype.pm.call(this,a);a=this.pa(a);var b=fq(this,a);if(null!==b){var c=Ka();for(b=b.iterator;b.next();){var d=b.value;if(this.Pb(d)){if(this.Ii(d)===a){var e=this.pe;xq(this,"nodeGroupKey",af,e,d,a,a);"string"===typeof e&&this.Ea(d,e);c.push(d)}}else if(aq(this,d,!0)===a&&(e=this.Te,xq(this,"linkFromKey",af,e,d,a,a),"string"===typeof e&&this.Ea(d,e),c.push(d)),aq(this,d,!1)===a&&(e=this.Ue,xq(this,"linkToKey",af,e,d,a,a),"string"===typeof e&&this.Ea(d,e),c.push(d)),e=this.og(d),
Array.isArray(e))for(var f=e.length,g=this.Gd,h=0;h<f;h++)e[h]===a&&(xq(this,"linkLabelKeys",cf,g,d,a,a,h,h),c.push(d))}for(b=0;b<c.length;b++)gq(this,a,c[b]);Oa(c)}};t.om=function(a){Z.prototype.om.call(this,a);var b=this.Ii(a);null===this.Qb(b)&&hq(this,b,a)};t.pq=function(a){Z.prototype.pq.call(this,a);var b=this.Ii(a);gq(this,b,a)};
t.Wu=function(a){if(null===a)return"";var b=this.pj;if(""===b)return"";b=cn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;A("getCategoryForLinkData found a non-string category for "+a+": "+b);return""};Bq.prototype.getLinkCategoryForData=function(a){return this.Wu(a)};Bq.prototype.pt=function(a,b){if(null!==a){var c=this.pj;if(""!==c)if(this.ze(a)){var d=cn(a,c);void 0===d&&(d="");d!==b&&(Nj(a,c,b),xq(this,"linkCategory",af,c,a,d,b),"string"===typeof c&&this.Ea(a,c))}else Nj(a,c,b)}};
Bq.prototype.setLinkCategoryForData=function(a,b){this.pt(a,b)};Bq.prototype.$j=function(){return!0};Bq.prototype.cm=function(){return!0};Bq.prototype.at=function(){return!0};Bq.prototype.ak=function(){return!0};
pa.Object.defineProperties(Bq.prototype,{archetypeNodeData:{get:function(){return this.Yi},set:function(a){var b=this.Yi;b!==a&&(this.Yi=a,this.g("archetypeNodeData",b,a))}},linkFromKeyProperty:{get:function(){return this.Te},set:function(a){var b=this.Te;b!==a&&(this.Te=a,this.g("linkFromKeyProperty",b,a))}},linkToKeyProperty:{get:function(){return this.Ue},set:function(a){var b=this.Ue;b!==a&&(this.Ue=a,this.g("linkToKeyProperty",
b,a))}},linkFromPortIdProperty:{get:function(){return this.qj},set:function(a){var b=this.qj;b!==a&&(this.qj=a,this.g("linkFromPortIdProperty",b,a))}},linkToPortIdProperty:{get:function(){return this.rj},set:function(a){var b=this.rj;b!==a&&(this.rj=a,this.g("linkToPortIdProperty",b,a))}},linkLabelKeysProperty:{get:function(){return this.Gd},set:function(a){var b=this.Gd;b!==a&&(this.Gd=a,this.g("linkLabelKeysProperty",
b,a))}},linkDataArray:{get:function(){return this.Nc},set:function(a){var b=this.Nc;if(b!==a){this.qb.clear();for(var c=a.length,d=0;d<c;d++){var e=a[d];if(!Ca(e)){A("GraphLinksModel.linkDataArray must only contain Objects, not: "+e);return}Db(e)}this.Nc=a;if(""!==this.linkKeyProperty){d=new E;for(e=0;e<c;e++){var f=a[e],g=this.jc(f);void 0===g?d.add(f):null!==this.qb.J(g)?d.add(f):this.qb.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.aq(e),f=this.jc(e),void 0!==
f&&this.qb.add(f,e)}d=new F;for(e=0;e<c;e++)d.add(a[e]);this.Kf=d;xq(this,"linkDataArray",af,"linkDataArray",this,b,a);for(b=0;b<c;b++)Dq(this,a[b])}}},linkKeyProperty:{get:function(){return this.gi},set:function(a){var b=this.gi;if(b!==a){this.gi=a;this.qb.clear();for(var c=this.linkDataArray.length,d=0;d<c;d++){var e=this.linkDataArray[d],f=this.jc(e);void 0===f&&(this.aq(e),f=this.jc(e));void 0!==f&&this.qb.add(f,e)}this.g("linkKeyProperty",b,a)}}},makeUniqueLinkKeyFunction:{
get:function(){return this.ll},set:function(a){var b=this.ll;b!==a&&(this.ll=a,this.g("makeUniqueLinkKeyFunction",b,a))}},copyLinkDataFunction:{get:function(){return this.Ek},set:function(a){var b=this.Ek;b!==a&&(this.Ek=a,this.g("copyLinkDataFunction",b,a))}},nodeIsGroupProperty:{get:function(){return this.pl},set:function(a){var b=this.pl;b!==a&&(this.pl=a,this.g("nodeIsGroupProperty",b,a))}},nodeGroupKeyProperty:{
get:function(){return this.pe},set:function(a){var b=this.pe;b!==a&&(this.pe=a,this.g("nodeGroupKeyProperty",b,a))}},Sj:{get:function(){return this.an},set:function(a){this.an!==a&&(this.an=a)}},linkCategoryProperty:{get:function(){return this.pj},set:function(a){var b=this.pj;b!==a&&(this.pj=a,this.g("linkCategoryProperty",b,a))}}});pa.Object.defineProperties(Bq,{type:{get:function(){return"GraphLinksModel"}}});
Bq.prototype.setCategoryForLinkData=Bq.prototype.pt;Bq.prototype.getCategoryForLinkData=Bq.prototype.Wu;Bq.prototype.assignAllDataProperties=Bq.prototype.Nj;Bq.prototype.setGroupKeyForNodeData=Bq.prototype.qt;Bq.prototype.getGroupKeyForNodeData=Bq.prototype.Ii;Bq.prototype.isGroupForNodeData=Bq.prototype.fv;Bq.prototype.copyLinkData=Bq.prototype.Lp;Bq.prototype.mergeLinkDataArray=Bq.prototype.xz;Bq.prototype.removeLinkDataCollection=Bq.prototype.Gz;Bq.prototype.removeLinkData=Bq.prototype.lm;
Bq.prototype.addLinkDataCollection=Bq.prototype.by;Bq.prototype.addLinkData=Bq.prototype.zi;Bq.prototype.containsLinkData=Bq.prototype.ze;Bq.prototype.makeLinkDataKeyUnique=Bq.prototype.aq;Bq.prototype.findLinkDataForKey=Bq.prototype.th;Bq.prototype.setKeyForLinkData=Bq.prototype.st;Bq.prototype.getKeyForLinkData=Bq.prototype.jc;Bq.prototype.removeLabelKeyForLinkData=Bq.prototype.wx;Bq.prototype.addLabelKeyForLinkData=Bq.prototype.Du;Bq.prototype.setLabelKeysForLinkData=Bq.prototype.Dv;
Bq.prototype.getLabelKeysForLinkData=Bq.prototype.og;Bq.prototype.setToPortIdForLinkData=Bq.prototype.Gx;Bq.prototype.getToPortIdForLinkData=Bq.prototype.cz;Bq.prototype.setFromPortIdForLinkData=Bq.prototype.Cx;Bq.prototype.getFromPortIdForLinkData=Bq.prototype.Yy;Bq.prototype.setToKeyForLinkData=Bq.prototype.Fx;Bq.prototype.getToKeyForLinkData=Bq.prototype.bz;Bq.prototype.setFromKeyForLinkData=Bq.prototype.Bx;Bq.prototype.getFromKeyForLinkData=Bq.prototype.Xy;Bq.prototype.clear=Bq.prototype.clear;
var Cq=Object.freeze([]);Bq.className="GraphLinksModel";vq.GraphLinksModel=Bq;Z.constructGraphLinksModel=Z.constructGraphLinksModel=function(){return new Bq};Z.initDiagramModel=vi=function(){return new Bq};function Eq(a){Z.call(this);this.qe="parent";this.cn=!1;this.xj="parentLinkCategory";void 0!==a&&(this.nodeDataArray=a)}oa(Eq,Z);Eq.constructGraphLinksModel=Z.constructGraphLinksModel;
Eq.prototype.cloneProtected=function(a){Z.prototype.cloneProtected.call(this,a);a.qe=this.qe;a.cn=this.cn;a.xj=this.xj};t=Eq.prototype;t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.oq();var b=(""!==this.name?this.name:"")+" TreeModel";if(0<a){b+="\n node data:";a=this.nodeDataArray;for(var c=a.length,d=0;d<c;d++){var e=a[d];b+=" "+this.pa(e)+":"+Qa(e)}}return b};
t.pk=function(){var a=Z.prototype.pk.call(this),b="";"parent"!==this.nodeParentKeyProperty&&"string"===typeof this.nodeParentKeyProperty&&(b+=',\n "nodeParentKeyProperty": '+this.quote(this.nodeParentKeyProperty));return a+b};t.hq=function(a){Z.prototype.hq.call(this,a);a.nodeParentKeyProperty&&(this.nodeParentKeyProperty=a.nodeParentKeyProperty)};t.sq=function(a){sq(this,a,"nodeParentKeyProperty");return Z.prototype.sq.call(this,a)};t.em=function(a){return a};
t.Ki=function(a){if(null!==a){var b=this.qe;if(""!==b&&(b=cn(a,b),void 0!==b)){if(cq(b))return b;A("ParentKey value for node data "+a+" is not a number or a string: "+b)}}};t.Ge=function(a,b){null===b&&(b=void 0);if(null!==a){var c=this.qe;if(""!==c)if(b=this.em(b),this.Pb(a)){var d=cn(a,c);d!==b&&(gq(this,d,a),Nj(a,c,b),null===this.Qb(b)&&hq(this,b,a),xq(this,"nodeParentKey",af,c,a,d,b),"string"===typeof c&&this.Ea(a,c))}else Nj(a,c,b)}};
t.Xu=function(a){if(null===a)return"";var b=this.xj;if(""===b)return"";b=cn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;A("getParentLinkCategoryForNodeData found a non-string category for "+a+": "+b);return""};Eq.prototype.getLinkCategoryForData=function(a){return this.Xu(a)};
Eq.prototype.Ev=function(a,b){if(null!==a){var c=this.xj;if(""!==c)if(this.Pb(a)){var d=cn(a,c);void 0===d&&(d="");d!==b&&(Nj(a,c,b),xq(this,"parentLinkCategory",af,c,a,d,b),"string"===typeof c&&this.Ea(a,c))}else Nj(a,c,b)}};Eq.prototype.setLinkCategoryForData=function(a,b){this.Ev(a,b)};Eq.prototype.copyNodeData=function(a){if(null===a)return null;a=Z.prototype.copyNodeData.call(this,a);this.Tj||""===this.qe||void 0===cn(a,this.qe)||Nj(a,this.qe,void 0);return a};
Eq.prototype.setDataProperty=function(a,b,c){if(this.Pb(a))if(b===this.nodeKeyProperty)this.tm(a,c);else{if(b===this.nodeCategoryProperty){this.mq(a,c);return}if(b===this.nodeParentKeyProperty){this.Ge(a,c);return}}var d=cn(a,b);d!==c&&(Nj(a,b,c),this.jt(a,b,d,c))};t=Eq.prototype;t.kq=function(a,b){Z.prototype.kq.call(this,a,b);for(var c=this.cb.iterator;c.next();)this.xv(c.value,a,b)};
t.xv=function(a,b,c){if(this.Ki(a)===b){var d=this.qe;Nj(a,d,c);xq(this,"nodeParentKey",af,d,a,b,c);"string"===typeof d&&this.Ea(a,d)}};t.pm=function(a){Z.prototype.pm.call(this,a);a=this.pa(a);var b=fq(this,a);if(null!==b){var c=Ka();for(b=b.iterator;b.next();){var d=b.value;if(this.Pb(d)&&this.Ki(d)===a){var e=this.qe;xq(this,"nodeParentKey",af,e,d,a,a);"string"===typeof e&&this.Ea(d,e);c.push(d)}}for(b=0;b<c.length;b++)gq(this,a,c[b]);Oa(c)}};
t.om=function(a){Z.prototype.om.call(this,a);var b=this.Ki(a);b=this.em(b);null===this.Qb(b)&&hq(this,b,a)};t.pq=function(a){Z.prototype.pq.call(this,a);var b=this.Ki(a);gq(this,b,a)};t.dm=function(){return!0};t.at=function(){return!0};
pa.Object.defineProperties(Eq.prototype,{nodeParentKeyProperty:{get:function(){return this.qe},set:function(a){var b=this.qe;b!==a&&(this.qe=a,this.g("nodeParentKeyProperty",b,a))}},Tj:{get:function(){return this.cn},set:function(a){this.cn!==a&&(this.cn=a)}},parentLinkCategoryProperty:{get:function(){return this.xj},set:function(a){var b=this.xj;b!==a&&(this.xj=a,this.g("parentLinkCategoryProperty",b,a))}},
linkCategoryProperty:{get:function(){return this.parentLinkCategoryProperty},set:function(a){this.parentLinkCategoryProperty=a}}});pa.Object.defineProperties(Eq,{type:{get:function(){return"TreeModel"}}});Eq.prototype.setParentLinkCategoryForNodeData=Eq.prototype.Ev;Eq.prototype.getParentLinkCategoryForNodeData=Eq.prototype.Xu;Eq.prototype.setParentKeyForNodeData=Eq.prototype.Ge;Eq.prototype.getParentKeyForNodeData=Eq.prototype.Ki;
Eq.className="TreeModel";vq.TreeModel=Eq;function Fq(){wi.call(this);this.tw=this.wn=this.Xb=0;this.br=360;this.sw=Gq;this.dj=0;this.ew=new G;this.Oq=this.Qd=0;this.Bs=new Hq;this.It=this.wj=0;this.Sx=600;this.Oo=NaN;this.Pm=1;this.pp=0;this.Hl=360;this.Ab=Gq;this.L=Iq;this.Pc=Jq;this.Lc=Ep;this.$e=6;this.yo=Kq}oa(Fq,wi);
Fq.prototype.cloneProtected=function(a){wi.prototype.cloneProtected.call(this,a);a.Oo=this.Oo;a.Pm=this.Pm;a.pp=this.pp;a.Hl=this.Hl;a.Ab=this.Ab;a.L=this.L;a.Pc=this.Pc;a.Lc=this.Lc;a.$e=this.$e;a.yo=this.yo};
Fq.prototype.fb=function(a){if(a.classType===Fq)if(a===Lq||a===Mq||a===Nq||a===Pq||a===Jq)this.sorting=a;else if(a===Qq||a===Rq||a===Iq||a===Sq)this.direction=a;else if(a===Tq||a===Uq||a===Gq||a===Vq)this.arrangement=a;else{if(a===Wq||a===Kq)this.nodeDiameterFormula=a}else wi.prototype.fb.call(this,a)};Fq.prototype.createNetwork=function(){return new Xq(this)};
Fq.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);a=this.network.vertexes;if(1>=a.count)1===a.count&&(a=a.first(),a.centerX=0,a.centerY=0);else{var b=new E;b.addAll(a.iterator);a=new E;var c=new E;var d=this.sort(b);var e,f,g=this.Oq;var h=this.arrangement;var k=this.nodeDiameterFormula;var l=this.radius;if(!isFinite(l)||0>=l)l=NaN;var m=this.aspectRatio;if(!isFinite(m)||0>=m)m=1;var n=this.startAngle;
isFinite(n)||(n=0);var p=this.sweepAngle;if(!isFinite(p)||360<p||1>p)p=360;b=this.spacing;isFinite(b)||(b=NaN);h===Vq&&k===Wq?h=Gq:h===Vq&&k!==Wq&&(h=this.arrangement);if((this.direction===Qq||this.direction===Rq)&&this.sorting!==Jq){for(k=0;!(k>=d.length);k+=2){a.add(d.N(k));if(k+1>=d.length)break;c.add(d.N(k+1))}this.direction===Qq?(this.arrangement===Vq&&a.reverse(),d=new E,d.addAll(a),d.addAll(c)):(this.arrangement===Vq&&c.reverse(),d=new E,d.addAll(c),d.addAll(a))}k=d.length;for(var q=f=e=0;q<
d.length;q++){var r=n+p*f*(this.direction===Iq?1:-1)/k,u=d.N(q).diameter;isNaN(u)&&(u=Yq(d.N(q),r));360>p&&(0===q||q===d.length-1)&&(u/=2);e+=u;f++}if(isNaN(l)||h===Vq){isNaN(b)&&(b=6);if(h!==Gq&&h!==Vq){f=-Infinity;for(g=0;g<k;g++)q=d.N(g),e=d.N(g===k-1?0:g+1),isNaN(q.diameter)&&Yq(q,0),isNaN(e.diameter)&&Yq(e,0),f=Math.max(f,(q.diameter+e.diameter)/2);g=f+b;h===Tq?l=(f+b)/(2*Math.PI/k):l=Zq(this,g*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180)}else l=Zq(this,e+(360<=p?k:k-1)*(h!==Vq?b:1.6*b),m,n*
Math.PI/180,p*Math.PI/180);f=l*m}else if(f=l*m,q=$q(this,l,f,n*Math.PI/180,p*Math.PI/180),isNaN(b)){if(h===Gq||h===Vq)b=(q-e)/(360<=p?k:k-1)}else if(h===Gq||h===Vq)q=(q-e)/(360<=p?k:k-1),q<b?(l=Zq(this,e+b*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180),f=l*m):b=q;else{g=-Infinity;for(e=0;e<k;e++)r=d.N(e),u=d.N(e===k-1?0:e+1),isNaN(r.diameter)&&Yq(r,0),isNaN(u.diameter)&&Yq(u,0),g=Math.max(g,(r.diameter+u.diameter)/2);g+=b;e=Zq(this,g*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180);e>l?(l=e,f=l*m):g=
q/(360<=p?k:k-1)}this.sw=h;this.Xb=l;this.wn=m;this.tw=n;this.br=p;this.dj=b;this.Qd=f;this.Oq=g;b=d;d=this.sw;h=this.Xb;l=this.tw;m=this.br;n=this.dj;p=this.Qd;k=this.Oq;if(this.direction!==Qq&&this.direction!==Rq||d!==Vq)if(this.direction===Qq||this.direction===Rq){g=0;switch(d){case Uq:g=180*ar(this,h,p,l,k)/Math.PI;break;case Gq:k=b=0;g=a.first();null!==g&&(b=Yq(g,Math.PI/2));g=c.first();null!==g&&(k=Yq(g,Math.PI/2));g=180*ar(this,h,p,l,n+(b+k)/2)/Math.PI;break;case Tq:g=m/b.length}if(this.direction===
Qq){switch(d){case Uq:br(this,a,l,Sq);break;case Gq:cr(this,a,l,Sq);break;case Tq:dr(this,a,m/2,l,Sq)}switch(d){case Uq:br(this,c,l+g,Iq);break;case Gq:cr(this,c,l+g,Iq);break;case Tq:dr(this,c,m/2,l+g,Iq)}}else{switch(d){case Uq:br(this,c,l,Sq);break;case Gq:cr(this,c,l,Sq);break;case Tq:dr(this,c,m/2,l,Sq)}switch(d){case Uq:br(this,a,l+g,Iq);break;case Gq:cr(this,a,l+g,Iq);break;case Tq:dr(this,a,m/2,l+g,Iq)}}}else switch(d){case Uq:br(this,b,l,this.direction);break;case Gq:cr(this,b,l,this.direction);
break;case Tq:dr(this,b,m,l,this.direction);break;case Vq:er(this,b,m,l,this.direction)}else er(this,b,m,l-m/2,Iq)}this.updateParts();this.network=null;this.isValidLayout=!0};function dr(a,b,c,d,e){var f=a.br,g=a.Xb;a=a.Qd;d=d*Math.PI/180;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=d+(e===Iq?k*c/(360<=f?h:h-1):-(k*c)/h),m=b.N(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 cr(a,b,c,d){var e=a.Xb,f=a.Qd,g=a.dj;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=b.N(k),m=b.N(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)&&Yq(l,0);isNaN(m.diameter)&&Yq(m,0);l=ar(a,e,f,d===Iq?c:-c,(l.diameter+m.diameter)/2+g);c+=d===Iq?l:-l}}
function br(a,b,c,d){var e=a.Xb,f=a.Qd,g=a.Oq;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=b.N(k);l.centerX=e*Math.cos(c);l.centerY=f*Math.sin(c);l.actualAngle=180*c/Math.PI;l=ar(a,e,f,d===Iq?c:-c,g);c+=d===Iq?l:-l}}function er(a,b,c,d,e){var f=a.br;a.wj=0;a.Bs=new Hq;if(360>c){for(f=d+(e===Iq?f:-f);0>f;)f+=360;f%=360;180<f&&(f-=360);f*=Math.PI/180;a.It=f;fr(a,b,c,d,e)}else gr(a,b,c,d,e);a.Bs.commit(b)}
function gr(a,b,c,d,e){var f=a.Xb,g=a.dj,h=a.wn,k=f*Math.cos(d*Math.PI/180),l=a.Qd*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=G.alloc();for(var n=0;n<m.length;n++){m[n].centerX=k;m[n].centerY=l;if(n>=m.length-1)break;hr(a,k,l,m,n,e,f)||ir(a,k,l,m,n,e,f);k=f.x;l=f.y}G.free(f);a.wj++;if(!(23<a.wj)){k=m[0].centerX;l=m[0].centerY;f=m[m.length-1].centerX;n=m[m.length-1].centerY;var p=Math.abs(k-f)-((m[0].width+m[m.length-1].width)/2+g),q=Math.abs(l-n)-((m[0].height+m[m.length-1].height)/2+g);g=0;1>Math.abs(q)?Math.abs(k-f)<(m[0].width+m[m.length-1].width)/2&&(g=0):g=0<q?q:1>Math.abs(p)?
0:p;k=Math.abs(f)>Math.abs(n)?0<f!==l>n:0<n!==k<f;if(k=e===Iq?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.Bs.compare(g,m);1<Math.abs(g)&&(a.Xb=8>a.wj?a.Xb-g/(2*Math.PI):5>m.length&&10<g?a.Xb/2:a.Xb-(0<g?1.7:-2.3),a.Qd=a.Xb*h,gr(a,b,c,d,e))}}}
function fr(a,b,c,d,e){for(var f=a.Xb,g=a.Qd,h=a.wn,k=f*Math.cos(d*Math.PI/180),l=g*Math.sin(d*Math.PI/180),m=G.alloc(),n=b.Na(),p=0;p<n.length;p++){n[p].centerX=k;n[p].centerY=l;if(p>=n.length-1)break;hr(a,k,l,n,p,e,m)||ir(a,k,l,n,p,e,m);k=m.x;l=m.y}G.free(m);a.wj++;if(!(23<a.wj)){k=Math.atan2(l,k);k=e===Iq?a.It-k:k-a.It;k=Math.abs(k)<Math.abs(k-2*Math.PI)?k:k-2*Math.PI;f=k*(f+g)/2;g=a.Bs;if(Math.abs(f)<Math.abs(g.Zl))for(g.Zl=f,g.qk=[],g.ym=[],k=0;k<n.length;k++)g.qk[k]=n[k].bounds.x,g.ym[k]=n[k].bounds.y;
1<Math.abs(f)&&(a.Xb=8>a.wj?a.Xb-f/(2*Math.PI):a.Xb-(0<f?1.7:-2.3),a.Qd=a.Xb*h,fr(a,b,c,d,e))}}function hr(a,b,c,d,e,f,g){var h=a.Xb,k=a.Qd,l=0;a=(d[e].width+d[e+1].width)/2+a.dj;var m=!1;if(0<=c!==(f===Iq)){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 ir(a,b,c,d,e,f,g){var h=a.Xb,k=a.Qd,l=0;a=(d[e].height+d[e+1].height)/2+a.dj;d=!1;if(0<=b!==(f===Iq)){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}Fq.prototype.commitLayout=function(){this.commitNodes();this.isRouting&&this.commitLinks()};
Fq.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 G(0,0):(c.x=this.arrangementOrigin.x+this.Xb,c.y=this.arrangementOrigin.y+this.Qd);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.ac(),a=this.group.position.copy(),c=this.group.location.copy(),b=b.Wd(c.Wd(a)),this.group.move(b),this.ew=b.Wd(a))};
Fq.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};function $q(a,b,c,d,e){var f=a.Sx;if(.001>Math.abs(a.wn-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 Zq(a,b,c,d,e){return b/(void 0!==d&&void 0!==e?$q(a,1,c,d,e):$q(a,1,c))}function ar(a,b,c,d,e){if(.001>Math.abs(a.wn-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}}
Fq.prototype.sort=function(a){switch(this.sorting){case Nq:break;case Pq:a.reverse();break;case Lq:a.sort(this.comparer);break;case Mq:a.sort(this.comparer);a.reverse();break;case Jq: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.N(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.N(f));b[f]=-1;f=a.N(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.N(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.N(l));
else{if(0===k)b.push(l);else{for(var n=m=Infinity,p=-1,q=[],r=0;r<b.length;r++)0>a[b[r]].indexOf(b[r===b.length-1?0:r+1])&&q.push(r===b.length-1?0:r+1);if(0===q.length)for(r=0;r<b.length;r++)q.push(r);for(r=0;r<q.length;r++){for(var u=q[r],x=a[l],v=0,y=0;y<g.length;y++){var z=f[g[y]],B=f[h[y]];if(z<B){var C=z;z=B}else C=B;if(C<u&&u<=z)for(B=0;B<x.length;B++){var I=x[B];0>b.indexOf(I)||C<f[I]&&f[I]<z||C===f[I]||z===f[I]||v++}else for(B=0;B<x.length;B++)I=x[B],0>b.indexOf(I)||C<f[I]&&f[I]<z&&C!==f[I]&&
z!==f[I]&&v++}x=v;for(y=v=0;y<a[l].length;y++)C=b.indexOf(a[l][y]),0<=C&&(C=Math.abs(u-(C>=u?C+1:C)),v+=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&&(B=z,z=C,C=B),z-C<(b.length+2)/2===(C<u&&u<=z)&&v++;if(x<m||x===m&&v<n)m=x,n=v,p=u}b.splice(p,0,l);for(m=0;m<b.length;m++)f[b[m]]=m;for(m=0;m<a[l].length;m++)n=a[l][m],0<=b.indexOf(n)&&(g.push(l),h.push(n))}k++}}for(g=b.length;;){f=!0;for(h=0;h<e.length;h++)if(k=e[h],l=a[k][0],m=b.indexOf(l),0<=m){for(p=
n=0;p<a[l].length;p++)q=b.indexOf(a[l][p]),0>q||q===m||(r=q>m?q-m:m-q,n+=q<m!==r>g-r?1:-1);b.splice(0>n?m:m+1,0,k);e.splice(h,1);h--}else f=!1;if(f)break;else b.push(e[0]),e.splice(0,1)}for(a=0;a<b.length;a++)d.add(c.N(b[a]));return d;default:A("Invalid sorting type.")}return a};
pa.Object.defineProperties(Fq.prototype,{radius:{get:function(){return this.Oo},set:function(a){this.Oo!==a&&(0<a||isNaN(a))&&(this.Oo=a,this.B())}},aspectRatio:{get:function(){return this.Pm},set:function(a){this.Pm!==a&&0<a&&(this.Pm=a,this.B())}},startAngle:{get:function(){return this.pp},set:function(a){this.pp!==a&&(this.pp=a,this.B())}},sweepAngle:{get:function(){return this.Hl},
set:function(a){this.Hl!==a&&(0<a&&360>=a?this.Hl=a:this.Hl=360,this.B())}},arrangement:{get:function(){return this.Ab},set:function(a){this.Ab===a||a!==Vq&&a!==Gq&&a!==Uq&&a!==Tq||(this.Ab=a,this.B())}},direction:{get:function(){return this.L},set:function(a){this.L===a||a!==Iq&&a!==Sq&&a!==Qq&&a!==Rq||(this.L=a,this.B())}},sorting:{get:function(){return this.Pc},set:function(a){this.Pc===a||a!==Nq&&a!==Pq&&
a!==Lq&&!Mq&&a!==Jq||(this.Pc=a,this.B())}},comparer:{get:function(){return this.Lc},set:function(a){this.Lc!==a&&(this.Lc=a,this.B())}},spacing:{get:function(){return this.$e},set:function(a){this.$e!==a&&(this.$e=a,this.B())}},nodeDiameterFormula:{get:function(){return this.yo},set:function(a){this.yo===a||a!==Kq&&a!==Wq||(this.yo=a,this.B())}},actualXRadius:{get:function(){return this.Xb}},
actualYRadius:{get:function(){return this.Qd}},actualSpacing:{get:function(){return this.dj}},actualCenter:{get:function(){return this.ew}}});
var Gq=new D(Fq,"ConstantSpacing",0),Uq=new D(Fq,"ConstantDistance",1),Tq=new D(Fq,"ConstantAngle",2),Vq=new D(Fq,"Packed",3),Iq=new D(Fq,"Clockwise",4),Sq=new D(Fq,"Counterclockwise",5),Qq=new D(Fq,"BidirectionalLeft",6),Rq=new D(Fq,"BidirectionalRight",7),Nq=new D(Fq,"Forwards",8),Pq=new D(Fq,"Reverse",9),Lq=new D(Fq,"Ascending",10),Mq=new D(Fq,"Descending",11),Jq=new D(Fq,"Optimized",12),Kq=new D(Fq,"Pythagorean",13),Wq=new D(Fq,"Circular",14);Fq.className="CircularLayout";Fq.ConstantSpacing=Gq;
Fq.ConstantDistance=Uq;Fq.ConstantAngle=Tq;Fq.Packed=Vq;Fq.Clockwise=Iq;Fq.Counterclockwise=Sq;Fq.BidirectionalLeft=Qq;Fq.BidirectionalRight=Rq;Fq.Forwards=Nq;Fq.Reverse=Pq;Fq.Ascending=Lq;Fq.Descending=Mq;Fq.Optimized=Jq;Fq.Pythagorean=Kq;Fq.Circular=Wq;function Hq(){this.Zl=-Infinity;this.ym=this.qk=null}
Hq.prototype.compare=function(a,b){if(0<a&&0>this.Zl||Math.abs(a)<Math.abs(this.Zl)&&!(0>a&&0<this.Zl))for(this.Zl=a,this.qk=[],this.ym=[],a=0;a<b.length;a++)this.qk[a]=b[a].bounds.x,this.ym[a]=b[a].bounds.y};Hq.prototype.commit=function(a){if(null!==this.qk&&null!==this.ym)for(var b=0;b<this.qk.length;b++){var c=a.N(b);c.x=this.qk[b];c.y=this.ym[b]}};Hq.className="VertexArrangement";function Xq(a){vp.call(this,a)}oa(Xq,vp);Xq.prototype.createVertex=function(){return new jr(this)};
Xq.prototype.createEdge=function(){return new kr(this)};Xq.className="CircularNetwork";function jr(a){yp.call(this,a);this.K=this.cj=NaN}oa(jr,yp);
function Yq(a,b){var c=a.network;if(null===c)return NaN;c=c.layout;if(null===c)return NaN;if(c.arrangement===Vq)if(c.nodeDiameterFormula===Wq)a.cj=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.cj=Math.min(a.height/c,a.width/b)}else a.cj=c.nodeDiameterFormula===Wq?Math.max(a.width,a.height):Math.sqrt(a.width*a.width+a.height*a.height);return a.cj}
pa.Object.defineProperties(jr.prototype,{diameter:{get:function(){return this.cj},set:function(a){this.cj!==a&&(this.cj=a)}},actualAngle:{get:function(){return this.K},set:function(a){this.K!==a&&(this.K=a)}}});jr.className="CircularVertex";function kr(a){zp.call(this,a)}oa(kr,zp);kr.className="CircularEdge";
function lr(){wi.call(this);this.mh=null;this.Xn=0;this.wd=(new K(100,100)).freeze();this.Om=!1;this.Ze=!0;this.Xc=!1;this.ml=100;this.zn=1;this.If=1E3;this.so=10;this.Po=Math;this.Mk=.05;this.Lk=50;this.Jk=150;this.Kk=0;this.mn=10;this.ln=5}oa(lr,wi);
lr.prototype.cloneProtected=function(a){wi.prototype.cloneProtected.call(this,a);a.wd.assign(this.wd);a.Om=this.Om;a.Ze=this.Ze;a.Xc=this.Xc;a.ml=this.ml;a.zn=this.zn;a.If=this.If;a.so=this.so;a.Po=this.Po;a.Mk=this.Mk;a.Lk=this.Lk;a.Jk=this.Jk;a.Kk=this.Kk;a.mn=this.mn;a.ln=this.ln};lr.prototype.createNetwork=function(){return new mr(this)};
lr.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));a=this.maxIterations;if(0<this.network.vertexes.count){this.network.Mp();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.Fu();this.Xn=0;if(this.needsClusterLayout()){b=this.network;for(c=b.Ix().iterator;c.next();){this.network=
c.value;for(var d=this.network.vertexes.iterator;d.next();){var e=d.value;e.td=e.vertexes.count;e.yh=1;e.Rj=null;e.Fe=null}nr(this,0,a)}this.network=b;c.reset();d=this.arrangementSpacing;for(var f=c.count,g=!0,h=e=0,k=Ka(),l=0;l<f+b.vertexes.count+2;l++)k[l]=null;f=0;c.reset();for(var m=L.alloc();c.next();)if(l=c.value,this.computeBounds(l,m),g)g=!1,e=m.x+m.width/2,h=m.y+m.height/2,k[0]=new G(m.x+m.width+d.width,m.y),k[1]=new G(m.x,m.y+m.height+d.height),f=2;else{var n=or(k,f,e,h,m.width,m.height,
d),p=k[n],q=new G(p.x+m.width+d.width,p.y),r=new G(p.x,p.y+m.height+d.height);n+1<f&&k.splice(n+1,0,null);k[n]=q;k[n+1]=r;f++;n=p.x-m.x;p=p.y-m.y;for(l=l.vertexes.iterator;l.next();)q=l.value,q.centerX+=n,q.centerY+=p}L.free(m);for(l=b.vertexes.iterator;l.next();)g=l.value,q=g.bounds,2>f?(e=q.x+q.width/2,h=q.y+q.height/2,k[0]=new G(q.x+q.width+d.width,q.y),k[1]=new G(q.x,q.y+q.height+d.height),f=2):(m=or(k,f,e,h,q.width,q.height,d),p=k[m],n=new G(p.x+q.width+d.width,p.y),q=new G(p.x,p.y+q.height+
d.height),m+1<f&&k.splice(m+1,0,null),k[m]=n,k[m+1]=q,f++,g.centerX=p.x+g.width/2,g.centerY=p.y+g.height/2);Oa(k);for(c.reset();c.next();){d=c.value;for(e=d.vertexes.iterator;e.next();)b.ph(e.value);for(d=d.edges.iterator;d.next();)b.Lj(d.value)}}pr(this,a);this.updateParts()}this.ml=a;this.network=null;this.isValidLayout=!0};
lr.prototype.needsClusterLayout=function(){if(3>this.network.vertexes.count)return!1;for(var a=0,b=0,c=this.network.vertexes.first().bounds,d=this.network.vertexes.iterator;d.next();){if(d.value.bounds.Ic(c)&&(a++,2<a))return!0;if(10<b)break;b++}return!1};lr.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.Uc(d.bounds)}return b};
function nr(a,b,c){if(qr(a,b)){var d=a.If;a.If*=1+1/(b+1);var e=rr(a,b),f=Math.max(0,Math.max(Math.min(a.network.vertexes.count,c*(b+1)/11),10));a.maxIterations+=f;nr(a,b+1,c);pr(a,f);sr(a,e);b=e.vertexes.Na();b.sort(function(a,b){return null===a||null===b||a===b?0:b.td-a.td});for(c=0;c<b.length;c++)tr(a,b[c]);a.If=d}}
function qr(a,b){if(10<b||3>a.network.vertexes.count)return!1;a.mh=a.network.vertexes.Na();a=a.mh;a.sort(function(a,b){return null===a||null===b||a===b?0:b.td-a.td});for(b=a.length-1;0<=b&&1>=a[b].td;)b--;return 1<a.length-b}
function rr(a,b){for(var c=a.network,d=new mr(a),e=0;e<a.mh.length;e++){var f=a.mh[e];if(1<f.td){d.ph(f);var g=new ur;g.xt=f.td;g.yt=f.width;g.wt=f.height;g.Yv=f.focus.x;g.Zv=f.focus.y;null===f.Fe&&(f.Fe=new E);f.Fe.add(g);f.Av=f.Fe.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.Lj(h):e.network===d?(h=e.Rj,null===h&&(h=new E,e.Rj=h),h.add(g),e.td--,e.yh+=g.yh):g.network===d&&(h=g.Rj,null===h&&(h=new E,g.Rj=h),h.add(e),
g.td--,g.yh+=e.yh)}for(e=d.edges.iterator;e.next();)f=e.value,f.length*=Math.max(1,H.sqrt((f.fromVertex.yh+f.toVertex.yh)/(4*b+1)));for(b=d.vertexes.iterator;b.next();){e=b.value;var k=e.Rj;if(null!==k&&0<k.count&&(g=e.Fe.N(e.Fe.count-1).xt-e.td,!(0>=g))){for(var l=h=0,m=k.count-g;m<k.count;m++){var n=k.N(m),p=null;for(f=n.edges.iterator;f.next();){var q=f.value;if(q.kx(n)===e){p=q;break}}null!==p&&(l+=p.length,h+=n.width*n.height)}f=e.centerX;k=e.centerY;m=e.width;n=e.height;p=e.focus;q=m*n;1>q&&
(q=1);h=H.sqrt((h+q+l*l*4/(g*g))/q);g=(h-1)*m/2;h=(h-1)*n/2;e.bounds=new L(f-p.x-g,k-p.y-h,m+2*g,n+2*h);e.focus=new G(p.x+g,p.y+h)}}a.network=d;return c}function sr(a,b){for(var c=a.network.vertexes.iterator;c.next();){var d=c.value;d.network=b;if(null!==d.Fe){var e=d.Fe.N(d.Av);d.td=e.xt;var f=e.Yv,g=e.Zv;d.bounds=new L(d.centerX-f,d.centerY-g,e.yt,e.wt);d.focus=new G(f,g);d.Av--}}for(c=a.network.edges.iterator;c.next();)c.value.network=b;a.network=b}
function tr(a,b){var c=b.Rj;if(null!==c&&0!==c.count){var d=b.centerX,e=b.centerY,f=b.width,g=b.height;null!==b.Fe&&0<b.Fe.count&&(g=b.Fe.N(0),f=g.yt,g=g.wt);f=H.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.td?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.td||a.isFixed(k))){m=null;for(n=k.edges.iterator;n.next();){m=n.value;break}n=k.width;var p=k.height;n=H.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 or(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}lr.prototype.Fu=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)};
lr.prototype.addComments=function(a){var b=a.node;if(null!==b)for(b=b.Su();b.next();){var c=b.value;if("Comment"===c.category&&c.isVisible()){var d=this.network.Gi(c);null===d&&(d=this.network.Ol(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.ck(a,d,null));c.length=this.defaultCommentSpringLength}}};
function vr(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,H.sqrt(c*c+a*a)):a+c<b?(d=d+e-g,a=a+c-b,H.sqrt(d*d+a*a)):g-(d+e):d>g+h?a>b+f?(c=d-g-h,a=a-b-f,H.sqrt(c*c+a*a)):a+c<b?(d=d-g-h,a=a+c-b,H.sqrt(d*d+a*a)):d-(g+h):a>b+f?a-(b+f):a+c<b?b-(a+c):.1}function pr(a,b){a.mh=null;for(b=a.Xn+b;a.Xn<b&&(a.Xn++,wr(a)););a.mh=null}
function wr(a){null===a.mh&&(a.mh=a.network.vertexes.Na());var b=a.mh;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.If;var l=d=h=0;for(f=
0;f<b.length;f++){g=b[f];d=g.bounds;h=g.focus;k=d.x+h.x;var m=d.y+h.y;d=g.charge*a.electricalFieldX(k,m);l=g.charge*a.electricalFieldY(k,m);d+=g.mass*a.gravitationalFieldX(k,m);l+=g.mass*a.gravitationalFieldY(k,m);g.forceX+=d;g.forceY+=l;for(var n=f+1;n<b.length;n++){var p=b[n];if(p!==g){d=p.bounds;h=p.focus;l=d.x+h.x;var q=d.y+h.y;if(k-l>c||l-k>c){if(e)break}else if(m-q>c||q-m>c){if(!e)break}else{var r=vr(g,p);1>r?(d=a.randomNumberGenerator,null===d&&(a.randomNumberGenerator=d=new xr),r=d.random(),
h=d.random(),k>l?(d=Math.abs(p.bounds.right-g.bounds.x),d=(1+d)*r):k<l?(d=Math.abs(p.bounds.x-g.bounds.right),d=-(1+d)*r):(d=Math.max(p.width,g.width),d=(1+d)*r-d/2),m>q?(l=Math.abs(p.bounds.bottom-g.bounds.y),l=(1+l)*h):k<l?(l=Math.abs(p.bounds.y-g.bounds.bottom),l=-(1+l)*h):(l=Math.max(p.height,g.height),l=(1+l)*h-l/2)):(h=-(g.charge*p.charge)/(r*r),d=(l-k)/r*h,l=(q-m)/r*h);g.forceX+=d;g.forceY+=l;p.forceX-=d;p.forceY-=l}}}}for(e=a.network.edges.iterator;e.next();)h=e.value,c=h.fromVertex,f=h.toVertex,
g=c.bounds,k=c.focus,d=g.x+k.x,g=g.y+k.y,m=f.bounds,n=f.focus,k=m.x+n.x,m=m.y+n.y,n=vr(c,f),1>n?(n=a.randomNumberGenerator,null===n&&(a.randomNumberGenerator=n=new xr),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}lr.prototype.moveFixedVertex=function(){};lr.prototype.commitLayout=function(){this.Fv();this.commitNodes();this.isRouting&&this.commitLinks()};lr.prototype.Fv=function(){if(this.setsPortSpots)for(var a=this.network.edges.iterator;a.next();){var b=a.value.link;null!==b&&(b.fromSpot=Ed,b.toSpot=Ed)}};
lr.prototype.commitNodes=function(){var a=0,b=0;if(this.arrangesToOrigin){var c=L.alloc();this.computeBounds(this.network,c);b=this.arrangementOrigin;a=b.x-c.x;b=b.y-c.y;L.free(c)}c=L.alloc();for(var d=this.network.vertexes.iterator;d.next();){var e=d.value;if(0!==a||0!==b)c.assign(e.bounds),c.x+=a,c.y+=b,e.bounds=c;e.commit()}L.free(c)};lr.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};
lr.prototype.springStiffness=function(a){a=a.stiffness;return isNaN(a)?this.Mk:a};lr.prototype.springLength=function(a){a=a.length;return isNaN(a)?this.Lk:a};lr.prototype.electricalCharge=function(a){a=a.charge;return isNaN(a)?this.Jk:a};lr.prototype.electricalFieldX=function(){return 0};lr.prototype.electricalFieldY=function(){return 0};lr.prototype.gravitationalMass=function(a){a=a.mass;return isNaN(a)?this.Kk:a};lr.prototype.gravitationalFieldX=function(){return 0};
lr.prototype.gravitationalFieldY=function(){return 0};lr.prototype.isFixed=function(a){return a.isFixed};
pa.Object.defineProperties(lr.prototype,{currentIteration:{get:function(){return this.Xn}},arrangementSpacing:{get:function(){return this.wd},set:function(a){this.wd.A(a)||(this.wd.assign(a),this.B())}},arrangesToOrigin:{get:function(){return this.Om},set:function(a){this.Om!==a&&(this.Om=a,this.B())}},setsPortSpots:{get:function(){return this.Ze},set:function(a){this.Ze!==a&&(this.Ze=
a,this.B())}},comments:{get:function(){return this.Xc},set:function(a){this.Xc!==a&&(this.Xc=a,this.B())}},maxIterations:{get:function(){return this.ml},set:function(a){this.ml!==a&&0<=a&&(this.ml=a,this.B())}},epsilonDistance:{get:function(){return this.zn},set:function(a){this.zn!==a&&0<a&&(this.zn=a,this.B())}},infinityDistance:{get:function(){return this.If},set:function(a){this.If!==
a&&1<a&&(this.If=a,this.B())}},moveLimit:{get:function(){return this.so},set:function(a){this.so!==a&&1<a&&(this.so=a,this.B())}},randomNumberGenerator:{get:function(){return this.Po},set:function(a){this.Po!==a&&(null!==a&&"function"!==typeof a.random&&A('ForceDirectedLayout.randomNumberGenerator must have a "random()" function on it: '+a),this.Po=a)}},defaultSpringStiffness:{get:function(){return this.Mk},
set:function(a){this.Mk!==a&&(this.Mk=a,this.B())}},defaultSpringLength:{get:function(){return this.Lk},set:function(a){this.Lk!==a&&(this.Lk=a,this.B())}},defaultElectricalCharge:{get:function(){return this.Jk},set:function(a){this.Jk!==a&&(this.Jk=a,this.B())}},defaultGravitationalMass:{get:function(){return this.Kk},set:function(a){this.Kk!==a&&(this.Kk=a,this.B())}},defaultCommentSpringLength:{
get:function(){return this.mn},set:function(a){this.mn!==a&&(this.mn=a,this.B())}},defaultCommentElectricalCharge:{get:function(){return this.ln},set:function(a){this.ln!==a&&(this.ln=a,this.B())}}});lr.className="ForceDirectedLayout";function ur(){this.Zv=this.Yv=this.wt=this.yt=this.xt=0}ur.className="ForceDirectedSubnet";function mr(a){vp.call(this,a)}oa(mr,vp);mr.prototype.createVertex=function(){return new yr(this)};mr.prototype.createEdge=function(){return new zr(this)};
mr.className="ForceDirectedNetwork";function yr(a){yp.call(this,a);this.Ma=!1;this.Ub=this.K=NaN;this.yh=this.td=this.La=this.ba=0;this.Fe=this.Rj=null;this.Av=0}oa(yr,yp);
pa.Object.defineProperties(yr.prototype,{isFixed:{get:function(){return this.Ma},set:function(a){this.Ma!==a&&(this.Ma=a)}},charge:{get:function(){return this.K},set:function(a){this.K!==a&&(this.K=a)}},mass:{get:function(){return this.Ub},set:function(a){this.Ub!==a&&(this.Ub=a)}},forceX:{get:function(){return this.ba},set:function(a){this.ba!==a&&(this.ba=a)}},forceY:{
get:function(){return this.La},set:function(a){this.La!==a&&(this.La=a)}}});yr.className="ForceDirectedVertex";function zr(a){zp.call(this,a);this.l=this.u=NaN}oa(zr,zp);pa.Object.defineProperties(zr.prototype,{stiffness:{get:function(){return this.u},set:function(a){this.u!==a&&(this.u=a)}},length:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a)}}});zr.className="ForceDirectedEdge";
function xr(){var a=0;void 0===a&&(a=42);this.seed=a;this.Kx=48271;this.Mx=2147483647;this.Q=44488.07041494893;this.Ox=3399;this.Lx=1/2147483647;this.random()}xr.prototype.random=function(){var a=this.seed%this.Q*this.Kx-this.seed/this.Q*this.Ox;0<a?this.seed=a:this.seed=a+this.Mx;return this.seed*this.Lx};xr.className="RandomNumberGenerator";
function Ar(){wi.call(this);this.Wb=this.je=25;this.L=0;this.Hk=Br;this.hl=Cr;this.Yk=Dr;this.nj=4;this.sk=Er;this.Yf=7;this.Ze=!0;this.bo=4;this.Ha=this.Jr=this.ya=-1;this.od=this.no=0;this.Ka=this.ld=this.md=this.Fd=this.fc=null;this.uo=0;this.to=this.sj=null;this.Kd=0;this.vo=null;this.gw=new G;this.ne=[];this.ne.length=100}oa(Ar,wi);
Ar.prototype.cloneProtected=function(a){wi.prototype.cloneProtected.call(this,a);a.je=this.je;a.Wb=this.Wb;a.L=this.L;a.Hk=this.Hk;a.hl=this.hl;a.Yk=this.Yk;a.nj=this.nj;a.sk=this.sk;a.Yf=this.Yf;a.Ze=this.Ze;a.bo=this.bo};
Ar.prototype.fb=function(a){a.classType===Ar?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:A("Unknown enum value: "+a):wi.prototype.fb.call(this,a)};Ar.prototype.createNetwork=function(){return new Fr(this)};
Ar.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);this.Jr=-1;this.od=this.no=0;this.vo=this.to=this.sj=null;for(a=0;a<this.ne.length;a++)this.ne[a]=null;if(0<this.network.vertexes.count){this.network.Mp();this.cycleRemoveOption!==Gr&&this.removeCycles();for(a=this.network.vertexes.iterator;a.next();)a.value.layer=-1;this.ya=-1;this.assignLayers();for(a.reset();a.next();)this.ya=Math.max(this.ya,
a.value.layer);this.cycleRemoveOption===Gr&&this.removeCycles();a=this.network;for(var b=[],c=a.edges.iterator;c.next();){var d=c.value;d.valid=!1;b.push(d)}for(c=0;c<b.length;c++){d=b[c];var e=d.fromVertex,f=d.toVertex;if(!d.valid&&(null!==e.node&&null!==f.node||e.layer!==f.layer)){var g=0,h=0,k=0,l=0;if(null!==d.link){h=d.link;if(null===h)continue;var m=e.node;g=f.node;if(null===m||null===g)continue;var n=h.fromNode;k=h.toNode;var p=h.fromPort;h=h.toPort;if(d.rev){l=n;var q=p;n=k;p=h;k=l;h=q}var r=
e.focus;l=f.focus;var u=d.rev?f.bounds:e.bounds;q=G.alloc();m!==n?u.s()&&n.isVisible()&&n.actualBounds.s()?(n.uh(p,dd,q),q.x+=n.actualBounds.x-u.x,q.y+=n.actualBounds.y-u.y):q.assign(r):u.s()?(n.uh(p,dd,q),q.s()||q.assign(r)):q.assign(r);n=d.rev?e.bounds:f.bounds;m=G.alloc();g!==k?n.s()&&k.isVisible()&&k.actualBounds.s()?(k.uh(h,dd,m),m.x+=k.actualBounds.x-n.x,m.y+=k.actualBounds.y-n.y):m.assign(l):n.s()?(k.uh(h,dd,m),m.s()||m.assign(l)):m.assign(l);90===this.L||270===this.L?(g=Math.round((q.x-r.x)/
this.Wb),k=q.x,h=Math.round((m.x-l.x)/this.Wb),l=m.x):(g=Math.round((q.y-r.y)/this.Wb),k=q.y,h=Math.round((m.y-l.y)/this.Wb),l=m.y);G.free(q);G.free(m);d.portFromColOffset=g;d.portFromPos=k;d.portToColOffset=h;d.portToPos=l}else d.portFromColOffset=0,d.portFromPos=0,d.portToColOffset=0,d.portToPos=0;q=e.layer;m=f.layer;n=0;u=d.link;if(null!==u){var x=u.fromPort,v=u.toPort;if(null!==x&&null!==v){var y=u.fromNode;p=u.toNode;if(null!==y&&null!==p){var z=Hr(this,!0),B=Hr(this,!1),C=this.setsPortSpots?
z:u.computeSpot(!0,x);r=this.setsPortSpots?B:u.computeSpot(!1,v);var I=u.isOrthogonal;C.qf()&&C.pf(B)&&r.qf()&&r.pf(z)?n=0:(z=u.getLinkPoint(y,x,C,!0,I,p,v,G.alloc()),B=u.getLinkDirection(y,x,z,C,!0,I,p,v),G.free(z),C.bt()||B!==Ir(this,d,!0)?this.setsPortSpots&&null!==y&&1===y.ports.count&&d.rev&&(n+=1):n+=1,C=u.getLinkPoint(p,v,r,!1,I,y,x,G.alloc()),u=u.getLinkDirection(p,v,C,r,!1,I,y,x),G.free(C),r.bt()||u!==Ir(this,d,!1)?this.setsPortSpots&&null!==p&&1===p.ports.count&&d.rev&&(n+=2):n+=2)}}}p=
n;n=1===p||3===p?!0:!1;if(p=2===p||3===p?!0:!1)r=a.createVertex(),r.node=null,r.Mj=1,r.layer=q,r.near=e,a.ph(r),e=a.ck(e,r,d.link),e.valid=!1,e.rev=d.rev,e.portFromColOffset=g,e.portToColOffset=0,e.portFromPos=k,e.portToPos=0,e=r;u=1;n&&u--;if(q-m>u&&0<q){d.valid=!1;r=a.createVertex();r.node=null;r.Mj=2;r.layer=q-1;a.ph(r);e=a.ck(e,r,d.link);e.valid=!0;e.rev=d.rev;e.portFromColOffset=p?0:g;e.portToColOffset=0;e.portFromPos=p?0:k;e.portToPos=0;e=r;for(q--;q-m>u&&0<q;)r=a.createVertex(),r.node=null,
r.Mj=3,r.layer=q-1,a.ph(r),e=a.ck(e,r,d.link),e.valid=!0,e.rev=d.rev,e.portFromColOffset=0,e.portToColOffset=0,e.portFromPos=0,e.portToPos=0,e=r,q--;e=a.ck(r,f,d.link);e.valid=!n;n&&(r.near=f);e.rev=d.rev;e.portFromColOffset=0;e.portToColOffset=h;e.portFromPos=0;e.portToPos=l}else d.valid=!0}}a=this.fc=[];for(b=0;b<=this.ya;b++)a[b]=0;for(b=this.network.vertexes.iterator;b.next();)b.value.index=-1;this.initializeIndices();this.Jr=-1;for(c=this.od=this.no=0;c<=this.ya;c++)a[c]>a[this.od]&&(this.Jr=
a[c]-1,this.od=c),a[c]<a[this.no]&&(this.no=c);this.vo=[];for(c=0;c<a.length;c++)this.vo[c]=[];for(b.reset();b.next();)a=b.value,this.vo[a.layer][a.index]=a;this.Ha=-1;for(a=0;a<=this.ya;a++){b=Jr(this,a);c=0;d=this.fc[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.Ha=Math.max(this.Ha,c-1);Kr(this,a,b)}this.reduceCrossings();this.straightenAndPack();this.updateParts()}this.network=null;this.isValidLayout=!0};
Ar.prototype.linkMinLength=function(){return 1};function Lr(a){var b=a.fromVertex.node;a=a.toVertex.node;return null===b&&null===a?8:null===b||null===a?4:1}Ar.prototype.nodeMinLayerSpace=function(a,b){return null===a.node?0:90===this.L||270===this.L?b?a.focus.y+10:a.bounds.height-a.focus.y+10:b?a.focus.x+10:a.bounds.width-a.focus.x+10};
Ar.prototype.nodeMinColumnSpace=function(a,b){if(null===a.node)return 0;var c=b?a.lv:a.kv;if(null!==c)return c;c=this.L;return 90===c||270===c?b?a.lv=a.focus.x/this.Wb+1|0:a.kv=(a.bounds.width-a.focus.x)/this.Wb+1|0:b?a.lv=a.focus.y/this.Wb+1|0:a.kv=(a.bounds.height-a.focus.y)/this.Wb+1|0};function Mr(a){null===a.sj&&(a.sj=[]);for(var b=0,c=a.network.vertexes.iterator;c.next();){var d=c.value;a.sj[b]=d.layer;b++;a.sj[b]=d.column;b++;a.sj[b]=d.index;b++}return a.sj}
function Nr(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 Or(a,b,c){var d=Jr(a,b),e=a.fc[b];if(null===a.to||a.to.length<e*e)a.to=[];for(var f=a.to,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.Mj===l.Mj||h++}else for(m=g-1;m>k;m--)n=d[m],n.near===l&&n.Mj===l.Mj||h++;var p;if(0<=c)for(k=d[g].sourceEdgesArrayAccess,l=0;l<k.length;l++){var q=k[l];if(q.valid&&q.fromVertex.layer!==b)for(n=q.fromVertex.index,m=q.portToPos,q=q.portFromPos,p=l+1;p<k.length;p++){var r=
k[p];if(r.valid&&r.fromVertex.layer!==b){var u=r.fromVertex.index;var x=r.portToPos;r=r.portFromPos;m<x&&(n>u||n===u&&q>r)&&h++;x<m&&(u>n||u===n&&r>q)&&h++}}}if(0>=c)for(k=d[g].destinationEdgesArrayAccess,l=0;l<k.length;l++)if(q=k[l],q.valid&&q.toVertex.layer!==b)for(n=q.toVertex.index,m=q.portToPos,q=q.portFromPos,p=l+1;p<k.length;p++)r=k[p],r.valid&&r.toVertex.layer!==b&&(u=r.toVertex.index,x=r.portToPos,r=r.portFromPos,q<r&&(n>u||n===u&&m>x)&&h++,r<q&&(u>n||u===n&&x>m)&&h++);f[g*e+g]=h;for(k=g+
1;k<e;k++){var v=0,y=0;if(0<=c){h=d[g].sourceEdgesArrayAccess;var z=d[k].sourceEdgesArrayAccess;for(l=0;l<h.length;l++)if(q=h[l],q.valid&&q.fromVertex.layer!==b)for(n=q.fromVertex.index,q=q.portFromPos,p=0;p<z.length;p++)r=z[p],r.valid&&r.fromVertex.layer!==b&&(u=r.fromVertex.index,r=r.portFromPos,(n<u||n===u&&q<r)&&y++,(u<n||u===n&&r<q)&&v++)}if(0>=c)for(h=d[g].destinationEdgesArrayAccess,z=d[k].destinationEdgesArrayAccess,l=0;l<h.length;l++)if(q=h[l],q.valid&&q.toVertex.layer!==b)for(n=q.toVertex.index,
m=q.portToPos,p=0;p<z.length;p++)r=z[p],r.valid&&r.toVertex.layer!==b&&(u=r.toVertex.index,x=r.portToPos,(n<u||n===u&&m<x)&&y++,(u<n||u===n&&x<m)&&v++);f[g*e+k]=v;f[k*e+g]=y}}Kr(a,b,d);return f}Ar.prototype.countCrossings=function(){for(var a=0,b=0;b<=this.ya;b++)for(var c=Or(this,b,1),d=this.fc[b],e=0;e<d;e++)for(var f=e;f<d;f++)a+=c[e*d+f];return a};
function Pr(a){for(var b=0,c=0;c<=a.ya;c++){for(var d=a,e=c,f=Jr(d,e),g=d.fc[e],h=0,k=0;k<g;k++){var l=f[k].destinationEdgesArrayAccess;if(null!==l)for(var m=0;m<l.length;m++){var n=l[m];if(n.valid&&n.toVertex.layer!==e){var p=n.fromVertex.column+n.portFromColOffset;var q=n.toVertex.column+n.portToColOffset;h+=(Math.abs(p-q)+1)*Lr(n)}}}Kr(d,e,f);b+=h}return b}
Ar.prototype.normalize=function(){var a=Infinity;this.Ha=-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.Ha=Math.max(this.Ha,c.column+this.nodeMinColumnSpace(c,!1))}for(b.reset();b.next();)b.value.column-=a;this.Ha-=a};
function Qr(a,b,c){for(var d=Jr(a,b),e=a.fc[b],f=[],g=0;g<e;g++){var h=d[g],k=null;0>=c&&(k=h.sourceEdgesArrayAccess);var l=null;0<=c&&(l=h.destinationEdgesArrayAccess);var m=0,n=0,p=h.near;null!==p&&p.layer===h.layer&&(m+=p.column-1,n++);if(null!==k)for(p=0;p<k.length;p++){h=k[p];var q=h.fromVertex;h.valid&&!h.rev&&q.layer!==b&&(m+=q.column,n++)}if(null!==l)for(k=0;k<l.length;k++)h=l[k],p=h.toVertex,h.valid&&!h.rev&&p.layer!==b&&(m+=p.column,n++);f[g]=0===n?-1:m/n}Kr(a,b,d);return f}
function Rr(a,b,c){for(var d=Jr(a,b),e=a.fc[b],f=[],g=0;g<e;g++){var h=d[g],k=null;0>=c&&(k=h.sourceEdgesArrayAccess);var l=null;0<=c&&(l=h.destinationEdgesArrayAccess);var m=0,n=[],p=h.near;null!==p&&p.layer===h.layer&&(n[m]=p.column-1,m++);h=void 0;if(null!==k)for(p=0;p<k.length;p++){h=k[p];var q=h.fromVertex;h.valid&&!h.rev&&q.layer!==b&&(n[m]=q.column+h.portFromColOffset,m++)}if(null!==l)for(k=0;k<l.length;k++)h=l[k],p=h.toVertex,h.valid&&!h.rev&&p.layer!==b&&(n[m]=p.column+h.portToColOffset,
m++);0===m?f[g]=-1:(n.sort(function(a,b){return a-b}),l=m>>1,f[g]=0!==(m&1)?n[l]:n[l-1]+n[l]>>1)}Kr(a,b,d);return f}function Sr(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&&Sr(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&&Sr(a,k,c,d,e,f)}}
function Tr(a,b,c,d,e,f){if(b.component===d){b.component=c;if(e)for(var g=b.destinationEdges;g.next();)Tr(a,g.value.toVertex,c,d,e,f);if(f)for(b=b.sourceEdges;b.next();)Tr(a,b.value.fromVertex,c,d,e,f)}}
Ar.prototype.removeCycles=function(){for(var a=this.network.edges.iterator;a.next();)a.value.rev=!1;switch(this.Hk){default:case Ur: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!==Vr(a);){for(e=Wr(a);null!==e;)d[c]=e,c--,e.valid=!1,e=Wr(a);for(e=Xr(a);null!==e;)d[b]=e,b++,e.valid=!1,e=Xr(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.qm(b),b.rev=!0);break;case Br:for(d=this.network.vertexes.iterator;d.next();)a=d.value,a.Vl=-1,a.finish=-1;for(a=this.network.edges.iterator;a.next();)a.value.forest=!1;this.uo=0;for(d.reset();d.next();)b=d.value,0===b.sourceEdges.count&&
Yr(this,b);for(d.reset();d.next();)b=d.value,-1===b.Vl&&Yr(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.Vl<b.Vl&&c<f&&(this.network.qm(d),d.rev=!0));break;case Gr: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.qm(b),b.rev=!0)}}};function Vr(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid)return b}return null}function Wr(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 Xr(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 Yr(a,b){b.Vl=a.uo;a.uo++;for(var c=b.destinationEdges;c.next();){var d=c.value,e=d.toVertex;-1===e.Vl&&(d.forest=!0,Yr(a,e))}b.finish=a.uo;a.uo++}
Ar.prototype.assignLayers=function(){switch(this.hl){case Zr:$r(this);break;case as:for(var a,b=this.network.vertexes.iterator;b.next();)a=bs(this,b.value),this.ya=Math.max(a,this.ya);for(b.reset();b.next();)a=b.value,a.layer=this.ya-a.layer;break;default:case Cr:$r(this);for(b=this.network.vertexes.iterator;b.next();)b.value.valid=!1;for(b.reset();b.next();)a=b.value,0===a.sourceEdges.count&&cs(this,a);a=Infinity;for(b.reset();b.next();)a=Math.min(a,b.value.layer);this.ya=-1;for(b.reset();b.next();){var c=
b.value;c.layer-=a;this.ya=Math.max(this.ya,c.layer)}}};function $r(a){for(var b=a.network.vertexes.iterator;b.next();){var c=ds(a,b.value);a.ya=Math.max(c,a.ya)}}function ds(a,b){var c=0;if(-1===b.layer){for(var d=b.destinationEdges;d.next();){var e=d.value,f=e.toVertex;e=a.linkMinLength(e);c=Math.max(c,ds(a,f)+e)}b.layer=c}else c=b.layer;return c}
function bs(a,b){var c=0;if(-1===b.layer){for(var d=b.sourceEdges;d.next();){var e=d.value,f=e.fromVertex;e=a.linkMinLength(e);c=Math.max(c,bs(a,f)+e)}b.layer=c}else c=b.layer;return c}
function cs(a,b){if(!b.valid){b.valid=!0;for(var c=b.destinationEdges;c.next();)cs(a,c.value.toVertex);for(c=a.network.vertexes.iterator;c.next();)c.value.component=-1;for(var d=b.sourceEdgesArrayAccess,e=d.length,f=0;f<e;f++){var g=d[f],h=g.fromVertex,k=g.toVertex;g=a.linkMinLength(g);h.layer-k.layer>g&&Sr(a,h,0,-1,!0,!1)}for(Sr(a,b,1,-1,!0,!0);0!==b.component;){f=0;d=Infinity;h=0;k=null;for(g=a.network.vertexes.iterator;g.next();){var l=g.value;if(1===l.component){var m=0,n=!1,p=l.sourceEdgesArrayAccess;
e=p.length;for(var q=0;q<e;q++){var r=p[q],u=r.fromVertex;m+=1;1!==u.component&&(f+=1,u=u.layer-l.layer,r=a.linkMinLength(r),d=Math.min(d,u-r))}p=l.destinationEdgesArrayAccess;e=p.length;for(q=0;q<e;q++)r=p[q].toVertex,--m,1!==r.component?--f:n=!0;(null===k||m<h)&&!n&&(k=l,h=m)}}if(0<f){for(c.reset();c.next();)e=c.value,1===e.component&&(e.layer+=d);b.component=0}else k.component=0}for(c=a.network.vertexes.iterator;c.next();)c.value.component=-1;for(Sr(a,b,1,-1,!0,!1);0!==b.component;){d=0;e=Infinity;
f=0;h=null;for(k=a.network.vertexes.iterator;k.next();)if(g=k.value,1===g.component){l=0;m=!1;p=g.sourceEdgesArrayAccess;n=p.length;for(q=0;q<n;q++)r=p[q].fromVertex,l+=1,1!==r.component?d+=1:m=!0;p=g.destinationEdgesArrayAccess;n=p.length;for(q=0;q<n;q++)r=p[q],u=r.toVertex,--l,1!==u.component&&(--d,u=g.layer-u.layer,r=a.linkMinLength(r),e=Math.min(e,u-r));(null===h||l>f)&&!m&&(h=g,f=l)}if(0>d){for(c.reset();c.next();)d=c.value,1===d.component&&(d.layer-=e);b.component=0}else h.component=0}}}
function Ir(a,b,c){return 90===a.L?c&&!b.rev||!c&&b.rev?270:90:180===a.L?c&&!b.rev||!c&&b.rev?0:180:270===a.L?c&&!b.rev||!c&&b.rev?90:270:c&&!b.rev||!c&&b.rev?180:0}
Ar.prototype.initializeIndices=function(){switch(this.Yk){default:case es:for(var a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;b.index=this.fc[c];this.fc[c]++}break;case Dr:a=this.network.vertexes.iterator;for(b=this.ya;0<=b;b--)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&fs(this,c);break;case gs:for(a=this.network.vertexes.iterator,b=0;b<=this.ya;b++)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&hs(this,c)}};
function fs(a,b){var c=b.layer;b.index=a.fc[c];a.fc[c]++;b=b.destinationEdgesArrayAccess;for(c=!0;c;){c=!1;for(var d=0;d<b.length-1;d++){var e=b[d],f=b[d+1];e.portFromColOffset>f.portFromColOffset&&(c=!0,b[d]=f,b[d+1]=e)}}for(c=0;c<b.length;c++)d=b[c],d.valid&&(d=d.toVertex,-1===d.index&&fs(a,d))}
function hs(a,b){var c=b.layer;b.index=a.fc[c];a.fc[c]++;b=b.sourceEdgesArrayAccess;for(var d=!0;d;)for(d=!1,c=0;c<b.length-1;c++){var e=b[c],f=b[c+1];e.portToColOffset>f.portToColOffset&&(d=!0,b[c]=f,b[c+1]=e)}for(c=0;c<b.length;c++)d=b[c],d.valid&&(d=d.fromVertex,-1===d.index&&hs(a,d))}
Ar.prototype.reduceCrossings=function(){var a=this.countCrossings(),b=Mr(this),c,d;for(c=0;c<this.nj;c++){for(d=0;d<=this.ya;d++)is(this,d,1),js(this,d,1);var e=this.countCrossings();e<a&&(a=e,b=Mr(this));for(d=this.ya;0<=d;d--)is(this,d,-1),js(this,d,-1);e=this.countCrossings();e<a&&(a=e,b=Mr(this))}Nr(this,b);for(c=0;c<this.nj;c++){for(d=0;d<=this.ya;d++)is(this,d,0),js(this,d,0);e=this.countCrossings();e<a&&(a=e,b=Mr(this));for(d=this.ya;0<=d;d--)is(this,d,0),js(this,d,0);e=this.countCrossings();
e<a&&(a=e,b=Mr(this))}Nr(this,b);var f,g,h;switch(this.sk){case ks:break;case ls:for(h=a+1;(d=this.countCrossings())<h;)for(h=d,c=this.ya;0<=c;c--)for(g=0;g<=c;g++){for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=js(this,d,-1)||f;e=this.countCrossings();e>=a?Nr(this,b):(a=e,b=Mr(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=js(this,d,1)||f;e=this.countCrossings();e>=a?Nr(this,b):(a=e,b=Mr(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=js(this,d,1)||f;e>=a?Nr(this,b):(a=e,b=Mr(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=
js(this,d,-1)||f;e>=a?Nr(this,b):(a=e,b=Mr(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=js(this,d,0)||f;e>=a?Nr(this,b):(a=e,b=Mr(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=js(this,d,0)||f;e>=a?Nr(this,b):(a=e,b=Mr(this))}break;default:case Er:for(c=this.ya,g=0,h=a+1;(d=this.countCrossings())<h;){h=d;for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=js(this,d,-1)||f;e=this.countCrossings();e>=a?Nr(this,b):(a=e,b=Mr(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=js(this,d,1)||f;e=this.countCrossings();e>=a?Nr(this,b):
(a=e,b=Mr(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=js(this,d,1)||f;e>=a?Nr(this,b):(a=e,b=Mr(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=js(this,d,-1)||f;e>=a?Nr(this,b):(a=e,b=Mr(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=js(this,d,0)||f;e>=a?Nr(this,b):(a=e,b=Mr(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=js(this,d,0)||f;e>=a?Nr(this,b):(a=e,b=Mr(this))}}Nr(this,b)};
function is(a,b,c){var d=Jr(a,b),e=a.fc[b],f=Rr(a,b,c),g=Qr(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);Kr(a,b,d)}
function js(a,b,c){var d=Jr(a,b),e=a.fc[b];c=Or(a,b,c);var f;var g=[];for(f=0;f<e;f++)g[f]=-1;var h=[];for(f=0;f<e;f++)h[f]=-1;for(var k=!1,l=!0;l;)for(l=!1,f=0;f<e-1;f++){var m=c[d[f].index*e+d[f+1].index],n=c[d[f+1].index*e+d[f].index],p=0,q=0,r=d[f].column,u=d[f+1].column,x=a.nodeMinColumnSpace(d[f],!0),v=a.nodeMinColumnSpace(d[f],!1),y=a.nodeMinColumnSpace(d[f+1],!0),z=a.nodeMinColumnSpace(d[f+1],!1);x=r-x+y;v=u-v+z;var B=d[f].sourceEdges.iterator;for(B.reset();B.next();)if(y=B.value,z=y.fromVertex,
y.valid&&z.layer===b){for(y=0;d[y]!==z;)y++;y<f&&(p+=2*(f-y),q+=2*(f+1-y));y===f+1&&(p+=1);y>f+1&&(p+=4*(y-f),q+=4*(y-(f+1)))}B=d[f].destinationEdges.iterator;for(B.reset();B.next();)if(y=B.value,z=y.toVertex,y.valid&&z.layer===b){for(y=0;d[y]!==z;)y++;y===f+1&&(q+=1)}B=d[f+1].sourceEdges.iterator;for(B.reset();B.next();)if(y=B.value,z=y.fromVertex,y.valid&&z.layer===b){for(y=0;d[y]!==z;)y++;y<f&&(p+=2*(f+1-y),q+=2*(f-y));y===f&&(q+=1);y>f+1&&(p+=4*(y-(f+1)),q+=4*(y-f))}B=d[f+1].destinationEdges.iterator;
for(B.reset();B.next();)if(y=B.value,z=y.toVertex,y.valid&&z.layer===b){for(y=0;d[y]!==z;)y++;y===f&&(p+=1)}y=z=0;B=g[d[f].index];var C=h[d[f].index],I=g[d[f+1].index],J=h[d[f+1].index];-1!==B&&(z+=Math.abs(B-r),y+=Math.abs(B-v));-1!==C&&(z+=Math.abs(C-r),y+=Math.abs(C-v));-1!==I&&(z+=Math.abs(I-u),y+=Math.abs(I-x));-1!==J&&(z+=Math.abs(J-u),y+=Math.abs(J-x));if(q<p-.5||q===p&&n<m-.5||q===p&&n===m&&y<z-.5)l=k=!0,d[f].column=v,d[f+1].column=x,m=d[f],d[f]=d[f+1],d[f+1]=m}for(f=0;f<e;f++)d[f].index=
f;Kr(a,b,d);return k}
Ar.prototype.straightenAndPack=function(){var a=0!==(this.Yf&1);var b=7===this.Yf;1E3<this.network.edges.count&&!b&&(a=!1);if(a){var c=[];for(b=0;b<=this.ya;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.Ha-c[b])>>1)+8*d;this.Ha*=8}if(0!==(this.Yf&2))for(c=!0;c;){c=!1;for(b=this.od+1;b<=this.ya;b++)c=ms(this,b,1)||c;for(b=
this.od-1;0<=b;b--)c=ms(this,b,-1)||c;c=ms(this,this.od,0)||c}if(0!==(this.Yf&4)){for(b=this.od+1;b<=this.ya;b++)ns(this,b,1);for(b=this.od-1;0<=b;b--)ns(this,b,-1);ns(this,this.od,0)}a&&(os(this,-1),os(this,1));if(0!==(this.Yf&2))for(c=!0;c;){c=!1;c=ms(this,this.od,0)||c;for(b=this.od+1;b<=this.ya;b++)c=ms(this,b,0)||c;for(b=this.od-1;0<=b;b--)c=ms(this,b,0)||c}};function ms(a,b,c){for(var d=!1;ps(a,b,c);)d=!0;return d}
function ps(a,b,c){var d,e=Jr(a,b),f=a.fc[b],g=Qr(a,b,-1);if(0<c)for(d=0;d<f;d++)g[d]=-1;var h=Qr(a,b,1);if(0>c)for(d=0;d<f;d++)h[d]=-1;for(var k=!1,l=!0;l;)for(l=!1,d=0;d<f;d++){var m=e[d].column,n=a.nodeMinColumnSpace(e[d],!0),p=a.nodeMinColumnSpace(e[d],!1),q=0;0>d-1||m-e[d-1].column-1>n+a.nodeMinColumnSpace(e[d-1],!1)?q=m-1:q=m;n=d+1>=f||e[d+1].column-m-1>p+a.nodeMinColumnSpace(e[d+1],!0)?m+1:m;var r=p=0,u=0;if(0>=c)for(var x=e[d].sourceEdges.iterator;x.next();){var v=x.value;var y=v.fromVertex;
if(v.valid&&y.layer!==b){var z=Lr(v);var B=v.portFromColOffset;v=v.portToColOffset;y=y.column;p+=(Math.abs(m+v-(y+B))+1)*z;r+=(Math.abs(q+v-(y+B))+1)*z;u+=(Math.abs(n+v-(y+B))+1)*z}}if(0<=c)for(x=e[d].destinationEdges.iterator;x.next();)v=x.value,y=v.toVertex,v.valid&&y.layer!==b&&(z=Lr(v),B=v.portFromColOffset,v=v.portToColOffset,y=y.column,p+=(Math.abs(m+B-(y+v))+1)*z,r+=(Math.abs(q+B-(y+v))+1)*z,u+=(Math.abs(n+B-(y+v))+1)*z);v=B=z=0;x=g[e[d].index];y=h[e[d].index];-1!==x&&(z+=Math.abs(x-m),B+=
Math.abs(x-q),v+=Math.abs(x-n));-1!==y&&(z+=Math.abs(y-m),B+=Math.abs(y-q),v+=Math.abs(y-n));if(r<p||r===p&&B<z)l=k=!0,e[d].column=q;else if(u<p||u===p&&v<z)l=k=!0,e[d].column=n}Kr(a,b,e);a.normalize();return k}
function ns(a,b,c){var d=Jr(a,b),e=a.fc[b],f=Rr(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)}Kr(a,b,d);a.normalize()}
function qs(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 rs(a,b){var c=b+1;var d,e=[],f=[];for(d=0;d<=a.ya;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.ya;d++)h=h&&!(e[d]&&f[d]);if(h)for(g.reset();g.next();)a=g.value,a.column>b&&(--a.column,c=!0);return c}
function os(a,b){for(var c=0;c<=a.Ha;c++)for(;qs(a,c););a.normalize();for(c=0;c<a.Ha;c++)for(;rs(a,c););a.normalize();var d;if(0<b)for(c=0;c<=a.Ha;c++){var e=Mr(a);var f=Pr(a);for(d=f+1;f<d;){d=f;ss(a,c,1);var g=Pr(a);g>f?Nr(a,e):g<f&&(f=g,e=Mr(a))}}if(0>b)for(c=a.Ha;0<=c;c--)for(e=Mr(a),f=Pr(a),d=f+1;f<d;)d=f,ss(a,c,-1),g=Pr(a),g>f?Nr(a,e):g<f&&(f=g,e=Mr(a));a.normalize()}
function ss(a,b,c){a.Kd=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.Kd)}if(0>c)for(d.reset();d.next();)e=d.value,e.column+a.nodeMinColumnSpace(e,!1)>=b&&(e.component=a.Kd);a.Kd++;for(d.reset();d.next();)b=d.value,-1===b.component&&(Tr(a,b,a.Kd,-1,!0,!0),a.Kd++);var f;b=[];for(f=0;f<a.Kd*a.Kd;f++)b[f]=!1;e=[];for(f=0;f<(a.ya+1)*(a.Ha+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.Ha,f.column+a.nodeMinColumnSpace(f,!1));h<=k;h++)e[g*(a.Ha+1)+h]=f.component}for(f=0;f<=a.ya;f++){if(0<c)for(g=0;g<a.Ha;g++)-1!==e[f*(a.Ha+1)+g]&&-1!==e[f*(a.Ha+1)+g+1]&&e[f*(a.Ha+1)+g]!==e[f*(a.Ha+1)+g+1]&&(b[e[f*(a.Ha+1)+g]*a.Kd+e[f*(a.Ha+1)+g+1]]=!0);if(0>c)for(g=a.Ha;0<g;g--)-1!==e[f*(a.Ha+1)+g]&&-1!==e[f*(a.Ha+1)+g-1]&&e[f*(a.Ha+1)+g]!==e[f*(a.Ha+1)+g-1]&&(b[e[f*(a.Ha+1)+g]*a.Kd+e[f*(a.Ha+1)+g-1]]=!0)}e=
[];for(f=0;f<a.Kd;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.Kd;f++)b[k*a.Kd+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)}
Ar.prototype.commitLayout=function(){if(this.setsPortSpots)for(var a=Hr(this,!0),b=Hr(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.Ju();this.isRouting&&this.commitLinks()};function Hr(a,b){return 270===a.L?b?Jd:Td:90===a.L?b?Td:Jd:180===a.L?b?Rd:Sd:b?Sd:Rd}
Ar.prototype.commitNodes=function(){this.Fd=[];this.md=[];this.ld=[];this.Ka=[];for(var a=0;a<=this.ya;a++)this.Fd[a]=0,this.md[a]=0,this.ld[a]=0,this.Ka[a]=0;for(a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;this.Fd[c]=Math.max(this.Fd[c],this.nodeMinLayerSpace(b,!0));this.md[c]=Math.max(this.md[c],this.nodeMinLayerSpace(b,!1))}b=0;c=this.je;for(var d=0;d<=this.ya;d++){var e=c;0>=this.Fd[d]+this.md[d]&&(e=0);0<d&&(b+=e/2);90===this.L||0===this.L?(b+=this.md[d],this.ld[d]=b,
b+=this.Fd[d]):(b+=this.Fd[d],this.ld[d]=b,b+=this.md[d]);d<this.ya&&(b+=e/2);this.Ka[d]=b}c=b;b=this.arrangementOrigin;for(d=0;d<=this.ya;d++)270===this.L?this.ld[d]=b.y+this.ld[d]:90===this.L?(this.ld[d]=b.y+c-this.ld[d],this.Ka[d]=c-this.Ka[d]):180===this.L?this.ld[d]=b.x+this.ld[d]:(this.ld[d]=b.x+c-this.ld[d],this.Ka[d]=c-this.Ka[d]);a.reset();for(c=d=Infinity;a.next();){e=a.value;var f=e.layer,g=e.column|0;if(270===this.L||90===this.L){var h=b.x+this.Wb*g;f=this.ld[f]}else h=this.ld[f],f=b.y+
this.Wb*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.gw=new G(d,b);for(a.reset();a.next();)c=a.value,c.x+=d,c.y+=b,c.commit()};
Ar.prototype.Ju=function(){for(var a=0,b=this.je,c=0;c<=this.ya;c++)a+=this.Fd[c],a+=this.md[c];a+=this.ya*b;b=[];c=this.Wb*this.Ha;for(var d=this.maxLayer;0<=d;d--)270===this.L?0===d?b.push(new L(0,0,c,Math.abs(this.Ka[0]))):b.push(new L(0,this.Ka[d-1],c,Math.abs(this.Ka[d-1]-this.Ka[d]))):90===this.L?0===d?b.push(new L(0,this.Ka[0],c,Math.abs(this.Ka[0]-a))):b.push(new L(0,this.Ka[d],c,Math.abs(this.Ka[d-1]-this.Ka[d]))):180===this.L?0===d?b.push(new L(0,0,Math.abs(this.Ka[0]),c)):b.push(new L(this.Ka[d-
1],0,Math.abs(this.Ka[d-1]-this.Ka[d]),c)):0===d?b.push(new L(this.Ka[0],0,Math.abs(this.Ka[0]-a),c)):b.push(new L(this.Ka[d],0,Math.abs(this.Ka[d-1]-this.Ka[d]),c));this.commitLayers(b,this.gw)};Ar.prototype.commitLayers=function(){};
Ar.prototype.commitLinks=function(){for(var a=this.network.edges.iterator,b;a.next();)b=a.value.link,null!==b&&(b.Ah(),b.Qj(),b.lf());for(a.reset();a.next();)b=a.value.link,null!==b&&b.Wi();for(a.reset();a.next();){var c=a.value;b=c.link;if(null!==b){b.Ah();var d=b,e=d.fromNode,f=d.toNode,g=d.fromPort,h=d.toPort;if(null!==e){var k=e.findVisibleNode();null!==k&&k!==e&&(e=k,g=k.port)}if(null!==f){var l=f.findVisibleNode();null!==l&&l!==f&&(f=l,h=l.port)}var m=b.computeSpot(!0,g),n=b.computeSpot(!1,
h),p=c.fromVertex,q=c.toVertex;if(c.valid){if(b.curve===Qg&&4===b.pointsCount)if(p.column===q.column){var r=b.getLinkPoint(e,g,m,!0,!1,f,h),u=b.getLinkPoint(f,h,n,!1,!1,e,g);r.s()||r.set(e.actualBounds.center);u.s()||u.set(f.actualBounds.center);b.Qj();b.kf(r.x,r.y);b.kf((2*r.x+u.x)/3,(2*r.y+u.y)/3);b.kf((r.x+2*u.x)/3,(r.y+2*u.y)/3);b.kf(u.x,u.y)}else{var x=!1,v=!1;null!==g&&m===Sc&&(x=!0);null!==h&&n===Sc&&(v=!0);if(x||v){var y=b.i(0).x,z=b.i(0).y,B=b.i(3).x,C=b.i(3).y;if(x){if(90===this.L||270===
this.L){var I=y;var J=(z+C)/2}else I=(y+B)/2,J=z;b.M(1,I,J);var M=b.getLinkPoint(e,g,m,!0,!1,f,h);M.s()||M.set(e.actualBounds.center);b.M(0,M.x,M.y)}if(v){if(90===this.L||270===this.L){var U=B;var Q=(z+C)/2}else U=(y+B)/2,Q=C;b.M(2,U,Q);var ia=b.getLinkPoint(f,h,n,!1,!1,e,g);ia.s()||ia.set(f.actualBounds.center);b.M(3,ia.x,ia.y)}}}b.lf()}else if(p.layer===q.layer)b.lf();else{var ja=!1,N=!1,R=b.firstPickIndex+1;if(b.isOrthogonal){N=!0;var Aa=b.pointsCount;4<Aa&&b.points.removeRange(2,Aa-3)}else if(b.curve===
Qg)ja=!0,Aa=b.pointsCount,4<Aa&&b.points.removeRange(2,Aa-3),R=2;else{Aa=b.pointsCount;var ob=m===Sc,Ha=n===Sc;2<Aa&&ob&&Ha?b.points.removeRange(1,Aa-2):3<Aa&&ob&&!Ha?b.points.removeRange(1,Aa-3):3<Aa&&!ob&&Ha?b.points.removeRange(2,Aa-2):4<Aa&&!ob&&!Ha&&b.points.removeRange(2,Aa-3)}var Da;if(c.rev){for(var Fa;null!==q&&p!==q;){var Ra=Da=null;for(var Ub=q.sourceEdges.iterator;Ub.next();){var $a=Ub.value;if($a.link===c.link&&(Da=$a.fromVertex,Ra=$a.toVertex,null===Da.node))break}if(Da!==p){var Xa=
b.i(R-1).x;var Ma=b.i(R-1).y;var fa=Da.centerX;var ea=Da.centerY;if(N)if(180===this.L||0===this.L)if(2===R)b.m(R++,Xa,Ma),b.m(R++,Xa,ea);else{if((null!==Ra?Ra.centerY:Ma)!==ea){var hb=this.Ka[Da.layer-1];b.m(R++,hb,Ma);b.m(R++,hb,ea)}}else 2===R?(b.m(R++,Xa,Ma),b.m(R++,fa,Ma)):(null!==Ra?Ra.centerX:Xa)!==fa&&(hb=this.Ka[Da.layer-1],b.m(R++,Xa,hb),b.m(R++,fa,hb));else if(2===R){var jb=Math.max(10,this.Fd[q.layer]);var Na=Math.max(10,this.md[q.layer]);if(ja)180===this.L?fa<=q.bounds.x?(Fa=q.bounds.x,
b.m(R++,Fa-jb,ea),b.m(R++,Fa,ea),b.m(R++,Fa+Na,ea)):(b.m(R++,fa-jb,ea),b.m(R++,fa,ea),b.m(R++,fa+Na,ea)):90===this.L?ea>=q.bounds.bottom?(Fa=q.bounds.y+q.bounds.height,b.m(R++,fa,Fa+Na),b.m(R++,fa,Fa),b.m(R++,fa,Fa-jb)):(b.m(R++,fa,ea+Na),b.m(R++,fa,ea),b.m(R++,fa,ea-jb)):270===this.L?ea<=q.bounds.y?(Fa=q.bounds.y,b.m(R++,fa,Fa-jb),b.m(R++,fa,Fa),b.m(R++,fa,Fa+Na)):(b.m(R++,fa,ea-jb),b.m(R++,fa,ea),b.m(R++,fa,ea+Na)):0===this.L&&(fa>=q.bounds.right?(Fa=q.bounds.x+q.bounds.width,b.m(R++,Fa+Na,ea),
b.m(R++,Fa,ea),b.m(R++,Fa-jb,ea)):(b.m(R++,fa+Na,ea),b.m(R++,fa,ea),b.m(R++,fa-jb,ea)));else{b.m(R++,Xa,Ma);var ce=0;if(180===this.L||0===this.L){if(180===this.L?fa>=q.bounds.right:fa<=q.bounds.x)ce=(0===this.L?-jb:Na)/2;b.m(R++,Xa+ce,ea)}else{if(270===this.L?ea>=q.bounds.bottom:ea<=q.bounds.y)ce=(90===this.L?-jb:Na)/2;b.m(R++,fa,Ma+ce)}b.m(R++,fa,ea)}}else jb=Math.max(10,this.Fd[Da.layer]),Na=Math.max(10,this.md[Da.layer]),180===this.L?(ja&&b.m(R++,fa-jb,ea),b.m(R++,fa,ea),ja&&b.m(R++,fa+Na,ea)):
90===this.L?(ja&&b.m(R++,fa,ea+Na),b.m(R++,fa,ea),ja&&b.m(R++,fa,ea-jb)):270===this.L?(ja&&b.m(R++,fa,ea-jb),b.m(R++,fa,ea),ja&&b.m(R++,fa,ea+Na)):(ja&&b.m(R++,fa+Na,ea),b.m(R++,fa,ea),ja&&b.m(R++,fa-jb,ea))}q=Da}if(null===h||m!==Sc||N)if(Xa=b.i(R-1).x,Ma=b.i(R-1).y,fa=b.i(R).x,ea=b.i(R).y,N){var Kd=this.md[p.layer];if(180===this.L||0===this.L){var vb=Ma;vb>=p.bounds.y&&vb<=p.bounds.bottom&&(180===this.L?fa>=p.bounds.x:fa<=p.bounds.right)&&(Fa=p.centerX+(180===this.L?-Kd:Kd),vb<p.bounds.y+p.bounds.height/
2?vb=p.bounds.y-this.Wb/2:vb=p.bounds.bottom+this.Wb/2,b.m(R++,Fa,Ma),b.m(R++,Fa,vb));b.m(R++,fa,vb)}else vb=Xa,vb>=p.bounds.x&&vb<=p.bounds.right&&(270===this.L?ea>=p.bounds.y:ea<=p.bounds.bottom)&&(Fa=p.centerY+(270===this.L?-Kd:Kd),vb<p.bounds.x+p.bounds.width/2?vb=p.bounds.x-this.Wb/2:vb=p.bounds.right+this.Wb/2,b.m(R++,Xa,Fa),b.m(R++,vb,Fa)),b.m(R++,vb,ea);b.m(R++,fa,ea)}else if(ja)jb=Math.max(10,this.Fd[p.layer]),Na=Math.max(10,this.md[p.layer]),180===this.L&&fa>=p.bounds.x?(Fa=p.bounds.x+p.bounds.width,
b.M(R-2,Fa,Ma),b.M(R-1,Fa+Na,Ma)):90===this.L&&ea<=p.bounds.bottom?(Fa=p.bounds.y,b.M(R-2,Xa,Fa),b.M(R-1,Xa,Fa-jb)):270===this.L&&ea>=p.bounds.y?(Fa=p.bounds.y+p.bounds.height,b.M(R-2,Xa,Fa),b.M(R-1,Xa,Fa+Na)):0===this.L&&fa<=p.bounds.right&&(Fa=p.bounds.x,b.M(R-2,Fa,Ma),b.M(R-1,Fa-jb,Ma));else{jb=Math.max(10,this.Fd[p.layer]);Na=Math.max(10,this.md[p.layer]);var zf=0;if(180===this.L||0===this.L){if(180===this.L?fa<=p.bounds.x:fa>=p.bounds.right)zf=(0===this.L?Na:-jb)/2;b.m(R++,fa+zf,Ma)}else{if(270===
this.L?ea<=p.bounds.y:ea>=p.bounds.bottom)zf=(90===this.L?Na:-jb)/2;b.m(R++,Xa,ea+zf)}b.m(R++,fa,ea)}}else{for(;null!==p&&p!==q;){Ra=Da=null;for(var Eb=p.destinationEdges.iterator;Eb.next();){var pe=Eb.value;if(pe.link===c.link&&(Da=pe.toVertex,Ra=pe.fromVertex,null!==Ra.node&&(Ra=null),null===Da.node))break}Da!==q&&(Xa=b.i(R-1).x,Ma=b.i(R-1).y,fa=Da.centerX,ea=Da.centerY,N?180===this.L||0===this.L?(null!==Ra?Ra.centerY:Ma)!==ea&&(hb=this.Ka[Da.layer],2===R&&(hb=0===this.L?Math.max(hb,Xa):Math.min(hb,
Xa)),b.m(R++,hb,Ma),b.m(R++,hb,ea)):(null!==Ra?Ra.centerX:Xa)!==fa&&(hb=this.Ka[Da.layer],2===R&&(hb=90===this.L?Math.max(hb,Ma):Math.min(hb,Ma)),b.m(R++,Xa,hb),b.m(R++,fa,hb)):(jb=Math.max(10,this.Fd[Da.layer]),Na=Math.max(10,this.md[Da.layer]),180===this.L?(b.m(R++,fa+Na,ea),ja&&b.m(R++,fa,ea),b.m(R++,fa-jb,ea)):90===this.L?(b.m(R++,fa,ea-jb),ja&&b.m(R++,fa,ea),b.m(R++,fa,ea+Na)):270===this.L?(b.m(R++,fa,ea+Na),ja&&b.m(R++,fa,ea),b.m(R++,fa,ea-jb)):(b.m(R++,fa-jb,ea),ja&&b.m(R++,fa,ea),b.m(R++,
fa+Na,ea))));p=Da}N&&(Xa=b.i(R-1).x,Ma=b.i(R-1).y,fa=b.i(R).x,ea=b.i(R).y,180===this.L||0===this.L?Ma!==ea&&(hb=0===this.L?Math.min(Math.max((fa+Xa)/2,this.Ka[q.layer]),fa):Math.max(Math.min((fa+Xa)/2,this.Ka[q.layer]),fa),b.m(R++,hb,Ma),b.m(R++,hb,ea)):Xa!==fa&&(hb=90===this.L?Math.min(Math.max((ea+Ma)/2,this.Ka[q.layer]),ea):Math.max(Math.min((ea+Ma)/2,this.Ka[q.layer]),ea),b.m(R++,Xa,hb),b.m(R++,fa,hb)))}if(null!==d&&ja){if(null!==g){if(m===Sc){var Wc=b.i(0),Vb=b.i(2);Wc.A(Vb)||b.M(1,(Wc.x+Vb.x)/
2,(Wc.y+Vb.y)/2)}var Ld=b.getLinkPoint(e,g,Sc,!0,!1,f,h);Ld.s()||Ld.set(e.actualBounds.center);b.M(0,Ld.x,Ld.y)}if(null!==h){if(n===Sc){var Ec=b.i(b.pointsCount-1),He=b.i(b.pointsCount-3);Ec.A(He)||b.M(b.pointsCount-2,(Ec.x+He.x)/2,(Ec.y+He.y)/2)}var Ie=b.getLinkPoint(f,h,Sc,!1,!1,e,g);Ie.s()||Ie.set(f.actualBounds.center);b.M(b.pointsCount-1,Ie.x,Ie.y)}}b.lf();c.commit()}}}for(var Af=new E,gf=this.network.edges.iterator;gf.next();){var Bf=gf.value.link;null!==Bf&&Bf.isOrthogonal&&!Af.contains(Bf)&&
Af.add(Bf)}if(0<Af.count)if(90===this.L||270===this.L){for(var Wb=0,Ya=[],ab,Lc,Cf=Af.iterator;Cf.next();){var jc=Cf.value;if(null!==jc&&jc.isOrthogonal)for(var Md=2;Md<jc.pointsCount-3;Md++)if(ab=jc.i(Md),Lc=jc.i(Md+1),this.w(ab.y,Lc.y)&&!this.w(ab.x,Lc.x)){var qc=new ts;qc.layer=Math.floor(ab.y/2);var Nd=jc.i(0),Xb=jc.i(jc.pointsCount-1);qc.first=Nd.x*Nd.x+Nd.y;qc.Sb=Xb.x*Xb.x+Xb.y;qc.Rc=Math.min(ab.x,Lc.x);qc.sc=Math.max(ab.x,Lc.x);qc.index=Md;qc.link=jc;if(Md+2<jc.pointsCount){var Dh=jc.i(Md-
1),Eh=jc.i(Md+2),Je=0;Dh.y<ab.y?Je=Eh.y<ab.y?3:ab.x<Lc.x?2:1:Dh.y>ab.y&&(Je=Eh.y>ab.y?0:Lc.x<ab.x?2:1);qc.l=Je}Ya.push(qc)}}if(1<Ya.length){Ya.sort(this.Ax);for(var pb=0;pb<Ya.length;){for(var Df=Ya[pb].layer,Ke=pb+1;Ke<Ya.length&&Ya[Ke].layer===Df;)Ke++;if(1<Ke-pb)for(var Yb=pb;Yb<Ke;){for(var Le=Ya[Yb].sc,Mc=pb+1;Mc<Ke&&Ya[Mc].Rc<Le;)Le=Math.max(Le,Ya[Mc].sc),Mc++;var eb=Mc-Yb;if(1<eb){this.Ti(Ya,this.ot,Yb,Yb+eb);for(var Me=1,rb=Ya[Yb].Sb,rc=Yb;rc<Mc;rc++){var kb=Ya[rc];kb.Sb!==rb&&(Me++,rb=kb.Sb)}this.Ti(Ya,
this.zx,Yb,Yb+eb);var Xc=1;rb=Ya[Yb].first;for(var Yc=Yb;Yc<Mc;Yc++){var xd=Ya[Yc];xd.first!==rb&&(Xc++,rb=xd.first)}var Bg=!0,Ef=Xc;Me<Xc?(Bg=!1,Ef=Me,rb=Ya[Yb].Sb,this.Ti(Ya,this.ot,Yb,Yb+eb)):rb=Ya[Yb].first;for(var Ff=0,hf=Yb;hf<Mc;hf++){var kd=Ya[hf];(Bg?kd.first:kd.Sb)!==rb&&(Ff++,rb=Bg?kd.first:kd.Sb);var Od=kd.link;ab=Od.i(kd.index);Lc=Od.i(kd.index+1);var ld=this.linkSpacing*(Ff-(Ef-1)/2);Wb++;Od.Ah();Od.M(kd.index,ab.x,ab.y+ld);Od.M(kd.index+1,Lc.x,Lc.y+ld);Od.lf()}}Yb=Mc}pb=Ke}}}else{for(var md=
0,nb=[],fb,nd,Zc=Af.iterator;Zc.next();){var od=Zc.value;if(null!==od&&od.isOrthogonal)for(var vc=2;vc<od.pointsCount-3;vc++)if(fb=od.i(vc),nd=od.i(vc+1),this.w(fb.x,nd.x)&&!this.w(fb.y,nd.y)){var Ba=new ts;Ba.layer=Math.floor(fb.x/2);var $c=od.i(0),Zb=od.i(od.pointsCount-1);Ba.first=$c.x+$c.y*$c.y;Ba.Sb=Zb.x+Zb.y*Zb.y;Ba.Rc=Math.min(fb.y,nd.y);Ba.sc=Math.max(fb.y,nd.y);Ba.index=vc;Ba.link=od;if(vc+2<od.pointsCount){var de=od.i(vc-1),Ne=od.i(vc+2),ee=0;de.x<fb.x?ee=Ne.x<fb.x?3:fb.y<nd.y?2:1:de.x>
fb.x&&(ee=Ne.x>fb.x?0:nd.y<fb.y?2:1);Ba.l=ee}nb.push(Ba)}}if(1<nb.length){nb.sort(this.Ax);for(var wc=0;wc<nb.length;){for(var qe=nb[wc].layer,ad=wc+1;ad<nb.length&&nb[ad].layer===qe;)ad++;if(1<ad-wc)for(var wb=wc;wb<ad;){for(var Pd=nb[wb].sc,Mb=wc+1;Mb<ad&&nb[Mb].Rc<Pd;)Pd=Math.max(Pd,nb[Mb].sc),Mb++;var re=Mb-wb;if(1<re){this.Ti(nb,this.ot,wb,wb+re);for(var yd=1,fe=nb[wb].Sb,Cg=wb;Cg<Mb;Cg++){var bd=nb[Cg];bd.Sb!==fe&&(yd++,fe=bd.Sb)}this.Ti(nb,this.zx,wb,wb+re);var Oe=1;fe=nb[wb].first;for(var Dg=
wb;Dg<Mb;Dg++){var Gf=nb[Dg];Gf.first!==fe&&(Oe++,fe=Gf.first)}var Pe=!0,Eg=Oe;yd<Oe?(Pe=!1,Eg=yd,fe=nb[wb].Sb,this.Ti(nb,this.ot,wb,wb+re)):fe=nb[wb].first;for(var bg=0,Di=wb;Di<Mb;Di++){var Qe=nb[Di];(Pe?Qe.first:Qe.Sb)!==fe&&(bg++,fe=Pe?Qe.first:Qe.Sb);var Re=Qe.link;fb=Re.i(Qe.index);nd=Re.i(Qe.index+1);var Fh=this.linkSpacing*(bg-(Eg-1)/2);md++;Re.Ah();Re.M(Qe.index,fb.x+Fh,fb.y);Re.M(Qe.index+1,nd.x+Fh,nd.y);Re.lf()}}wb=Mb}wc=ad}}}};t=Ar.prototype;
t.Ax=function(a,b){return a instanceof ts&&b instanceof ts&&a!==b?a.layer<b.layer?-1:a.layer>b.layer?1:a.Rc<b.Rc?-1:a.Rc>b.Rc?1:a.sc<b.sc?-1:a.sc>b.sc?1:0:0};t.zx=function(a,b){return a instanceof ts&&b instanceof ts&&a!==b?a.first<b.first?-1:a.first>b.first||a.l<b.l?1:a.l>b.l||a.Rc<b.Rc?-1:a.Rc>b.Rc?1:a.sc<b.sc?-1:a.sc>b.sc?1:0:0};t.ot=function(a,b){return a instanceof ts&&b instanceof ts&&a!==b?a.Sb<b.Sb?-1:a.Sb>b.Sb||a.l<b.l?1:a.l>b.l||a.Rc<b.Rc?-1:a.Rc>b.Rc?1:a.sc<b.sc?-1:a.sc>b.sc?1:0:0};
t.w=function(a,b){a-=b;return-1<a&&1>a};t.Ti=function(a,b,c,d){var e=a.length,f=d-c;if(!(1>=f))if((0>c||c>=e-1)&&A("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 Jr(a,b){var c=a.fc[b];if(c>=a.ne.length){var d=[];for(var e=0;e<a.ne.length;e++)d[e]=a.ne[e];a.ne=d}void 0===a.ne[c]||null===a.ne[c]?d=[]:(d=a.ne[c],a.ne[c]=null);a=a.vo[b];for(b=0;b<a.length;b++)c=a[b],d[c.index]=c;return d}function Kr(a,b,c){a.ne[a.fc[b]]=c}
pa.Object.defineProperties(Ar.prototype,{layerSpacing:{get:function(){return this.je},set:function(a){this.je!==a&&0<=a&&(this.je=a,this.B())}},columnSpacing:{get:function(){return this.Wb},set:function(a){this.Wb!==a&&0<a&&(this.Wb=a,this.B())}},direction:{get:function(){return this.L},set:function(a){this.L!==a&&(0===a||90===a||180===a||270===a?(this.L=a,this.B()):A("LayeredDigraphLayout.direction must be 0, 90, 180, or 270"))}},
cycleRemoveOption:{get:function(){return this.Hk},set:function(a){this.Hk===a||a!==Ur&&a!==Br&&a!==Gr||(this.Hk=a,this.B())}},layeringOption:{get:function(){return this.hl},set:function(a){this.hl===a||a!==Cr&&a!==Zr&&a!==as||(this.hl=a,this.B())}},initializeOption:{get:function(){return this.Yk},set:function(a){this.Yk===a||a!==Dr&&a!==gs&&a!==es||(this.Yk=a,this.B())}},iterations:{
get:function(){return this.nj},set:function(a){this.nj!==a&&0<=a&&(this.nj=a,this.B())}},aggressiveOption:{get:function(){return this.sk},set:function(a){this.sk===a||a!==ks&&a!==Er&&a!==ls||(this.sk=a,this.B())}},packOption:{get:function(){return this.Yf},set:function(a){this.Yf!==a&&0<=a&&8>a&&(this.Yf=a,this.B())}},setsPortSpots:{get:function(){return this.Ze},set:function(a){this.Ze!==a&&(this.Ze=a,this.B())}},
linkSpacing:{get:function(){return this.bo},set:function(a){this.bo!==a&&0<=a&&(this.bo=a,this.B())}},maxLayer:{get:function(){return this.ya}},maxIndex:{get:function(){return this.Jr}},maxColumn:{get:function(){return this.Ha}},minIndexLayer:{get:function(){return this.no}},maxIndexLayer:{get:function(){return this.od}}});
var Br=new D(Ar,"CycleDepthFirst",0),Ur=new D(Ar,"CycleGreedy",1),Gr=new D(Ar,"CycleFromLayers",2),Cr=new D(Ar,"LayerOptimalLinkLength",0),Zr=new D(Ar,"LayerLongestPathSink",1),as=new D(Ar,"LayerLongestPathSource",2),Dr=new D(Ar,"InitDepthFirstOut",0),gs=new D(Ar,"InitDepthFirstIn",1),es=new D(Ar,"InitNaive",2),ks=new D(Ar,"AggressiveNone",0),Er=new D(Ar,"AggressiveLess",1),ls=new D(Ar,"AggressiveMore",2);Ar.className="LayeredDigraphLayout";Ar.CycleDepthFirst=Br;Ar.CycleGreedy=Ur;
Ar.CycleFromLayers=Gr;Ar.LayerOptimalLinkLength=Cr;Ar.LayerLongestPathSink=Zr;Ar.LayerLongestPathSource=as;Ar.InitDepthFirstOut=Dr;Ar.InitDepthFirstIn=gs;Ar.InitNaive=es;Ar.AggressiveNone=ks;Ar.AggressiveLess=Er;Ar.AggressiveMore=ls;Ar.PackNone=0;Ar.PackExpand=1;Ar.PackStraighten=2;Ar.PackMedian=4;Ar.PackAll=7;function ts(){this.index=this.sc=this.Rc=this.Sb=this.first=this.layer=0;this.link=null;this.l=0}ts.className="SegInfo";function Fr(a){vp.call(this,a)}oa(Fr,vp);Fr.prototype.createVertex=function(){return new us(this)};
Fr.prototype.createEdge=function(){return new vs(this)};Fr.className="LayeredDigraphNetwork";function us(a){yp.call(this,a);this.Sa=this.Bg=this.ei=-1;this.K=NaN;this.ba=null;this.valid=!1;this.finish=this.Vl=NaN;this.Mj=0;this.kv=this.lv=null}oa(us,yp);
pa.Object.defineProperties(us.prototype,{layer:{get:function(){return this.ei},set:function(a){this.ei!==a&&(this.ei=a)}},column:{get:function(){return this.Bg},set:function(a){this.Bg!==a&&(this.Bg=a)}},index:{get:function(){return this.Sa},set:function(a){this.Sa!==a&&(this.Sa=a)}},component:{get:function(){return this.K},set:function(a){this.K!==a&&(this.K=a)}},near:{
get:function(){return this.ba},set:function(a){this.ba!==a&&(this.ba=a)}}});us.className="LayeredDigraphVertex";function vs(a){zp.call(this,a);this.l=this.Ma=this.Ub=!1;this.La=this.K=NaN;this.ba=this.u=0}oa(vs,zp);
pa.Object.defineProperties(vs.prototype,{valid:{get:function(){return this.Ub},set:function(a){this.Ub!==a&&(this.Ub=a)}},rev:{get:function(){return this.Ma},set:function(a){this.Ma!==a&&(this.Ma=a)}},forest:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a)}},portFromPos:{get:function(){return this.K},set:function(a){this.K!==a&&(this.K=a)}},portToPos:{
get:function(){return this.La},set:function(a){this.La!==a&&(this.La=a)}},portFromColOffset:{get:function(){return this.u},set:function(a){this.u!==a&&(this.u=a)}},portToColOffset:{get:function(){return this.ba},set:function(a){this.ba!==a&&(this.ba=a)}}});vs.className="LayeredDigraphEdge";
function ws(){wi.call(this);this.Fb=new F;this.Jo=xs;this.Zc=ys;this.Ap=zs;this.Hr=As;this.fw=[];this.Xc=!0;this.Ab=Bs;this.wd=(new K(10,10)).freeze();var a=new Cs(this);this.T=new Ds(a);this.U=new Ds(a);this.uu=[]}oa(ws,wi);ws.prototype.cloneProtected=function(a){wi.prototype.cloneProtected.call(this,a);a.Jo=this.Jo;a.Ap=this.Ap;a.Hr=this.Hr;a.Xc=this.Xc;a.Ab=this.Ab;a.wd.assign(this.wd);a.T.copyInheritedPropertiesFrom(this.T);a.U.copyInheritedPropertiesFrom(this.U)};
ws.prototype.fb=function(a){a.classType===ws?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:A("Unknown enum value: "+a):wi.prototype.fb.call(this,a)};ws.prototype.createNetwork=function(){return new Cs(this)};
ws.prototype.makeNetwork=function(a){function b(a){if(a instanceof V)return!a.isLinkLabel&&"Comment"!==a.category;if(a instanceof S){var b=a.fromNode;if(null===b||b.isLinkLabel||"Comment"===b.category)return!1;a=a.toNode;return null===a||a.isLinkLabel||"Comment"===a.category?!1:!0}return!1}var c=this.createNetwork();a instanceof P?(c.ig(a.nodes,!0,b),c.ig(a.links,!0,b)):a instanceof hg?c.ig(a.memberParts,!1,b):c.ig(a.iterator,!1,b);return c};
ws.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));this.arrangement!==Es&&(this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin));var b=this.diagram;null===b&&a instanceof P&&(b=a);this.path===xs&&null!==b?this.Zc=b.isTreePathToChildren?ys:Fs:this.Zc=this.path===xs?ys:this.path;if(0<this.network.vertexes.count){this.network.Mp();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.Fb.count){a=
new F;for(b=this.Fb.iterator;b.next();){var c=b.value;c instanceof V?(c=this.network.Gi(c),null!==c&&a.add(c)):c instanceof Ds&&a.add(c)}this.Fb=a}0===this.Fb.count&&this.findRoots();for(a=this.Fb.copy().iterator;a.next();)b=a.value,b.initialized||(b.initialized=!0,Gs(this,b));b=this.network.vertexes;for(a=null;a=Hs(b),0<a.count;)b=Is(this,a),null!==b&&this.Fb.add(b),b.initialized=!0,Gs(this,b),b=a;for(a=this.Fb.iterator;a.next();)b=a.value,b instanceof Ds&&Js(this,b);for(a=this.Fb.iterator;a.next();)b=
a.value,b instanceof Ds&&Ks(this,b);for(a=this.Fb.iterator;a.next();)b=a.value,b instanceof Ds&&Ls(this,b);this.Fu();if(this.layerStyle===Ms){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.fw=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===Ns)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.Fb.iterator;a.next();)b=a.value,b instanceof Ds&&this.layoutTree(b);this.arrangeTrees();this.updateParts()}this.network=null;this.Fb=new F;this.isValidLayout=!0};function Hs(a){var b=new F;for(a=a.iterator;a.next();){var c=a.value;c.initialized||b.add(c)}return b}
ws.prototype.findRoots=function(){for(var a=this.network.vertexes,b=a.iterator;b.next();){var c=b.value;switch(this.Zc){case ys:0===c.sourceEdges.count&&this.Fb.add(c);break;case Fs:0===c.destinationEdges.count&&this.Fb.add(c);break;default:A("Unhandled path value "+this.Zc.toString())}}0===this.Fb.count&&(a=Is(this,a),null!==a&&this.Fb.add(a))};
function Is(a,b){var c=999999,d=null;for(b=b.iterator;b.next();){var e=b.value;switch(a.Zc){case ys:e.sourceEdges.count<c&&(c=e.sourceEdges.count,d=e);break;case Fs:e.destinationEdges.count<c&&(c=e.destinationEdges.count,d=e);break;default:A("Unhandled path value "+a.Zc.toString())}}return d}
function Gs(a,b){if(null!==b){switch(a.Zc){case ys:if(0<b.destinationEdges.count){for(var c=new E,d=b.destinationVertexes;d.next();){var e=d.value;Os(a,b,e)&&c.add(e)}0<c.count&&(b.children=c.Na())}break;case Fs:if(0<b.sourceEdges.count){c=new E;for(d=b.sourceVertexes;d.next();)e=d.value,Os(a,b,e)&&c.add(e);0<c.count&&(b.children=c.Na())}break;default:A("Unhandled path value"+a.Zc.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.Fb.remove(f)}for(b=
0;b<d;b++)Gs(a,c[b])}}function Os(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}ws.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 Js(a,b){if(null!==b){a.initializeTreeVertexValues(b);b.alignment===Ps&&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];Js(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 Qs(a,b){switch(a.Ap){default:case zs:return null!==b.parent?b.parent:a.T;case Rs:return null===b.parent?a.T:null===b.parent.parent?a.U:b.parent;case Ss:return null!==b.parent?null!==b.parent.parent?b.parent.parent:a.U:a.T;case Ts: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}}
ws.prototype.initializeTreeVertexValues=function(a){a.copyInheritedPropertiesFrom(Qs(this,a));if(null!==a.parent&&a.parent.alignment===Ps){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 Ks(a,b){if(null!==b){a.assignTreeVertexValues(b);b=b.children;for(var c=b.length,d=0;d<c;d++)Ks(a,b[d])}}ws.prototype.assignTreeVertexValues=function(){};
function Ls(a,b){if(null!==b){b.alignment!==Ps&&a.sortTreeVertexChildren(b);b=b.children;for(var c=b.length,d=0;d<c;d++)Ls(a,b[d])}}ws.prototype.sortTreeVertexChildren=function(a){switch(a.sorting){case Us:break;case Vs:a.children.reverse();break;case Ws:a.children.sort(a.comparer);break;case Xs:a.children.sort(a.comparer);a.children.reverse();break;default:A("Unhandled sorting value "+a.sorting.toString())}};ws.prototype.Fu=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)};
ws.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=Ys(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.Su();l.next();){var m=l.value;"Comment"===m.category&&m.canLayout()&&(null===a.comments&&(a.comments=[]),a.comments.push(m),m.ac(),m=m.measuredBounds,b&&!c||!e&&!d&&c||e&&d&&c?(f=Math.max(f,m.width),g+=m.height+Math.abs(h)):(f+=m.width+Math.abs(h),g=Math.max(g,
m.height)),h=k)}null!==a.comments&&(b&&!c||!e&&!d&&c||e&&d&&c?(f+=Math.abs(a.commentMargin),g=Math.max(0,g-a.height)):(g+=Math.abs(a.commentMargin),f=Math.max(0,f-a.width)),e=L.allocAt(0,0,a.bounds.width+f,a.bounds.height+g),a.bounds=e,L.free(e))};function Ys(a){return a===Zs||a===Ps||a===$s||a===at}function bt(a){return a===Zs||a===Ps}
function ct(a){var b=a.parent;if(null!==b){var c=b.alignment;if(Ys(c)){if(bt(c)){b=b.children;for(c=0;c<b.length&&a!==b[c];)c++;return 0===c%2}if(c===$s)return!0}}return!1}
ws.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=Ys(f));d=90===d||270===d;c=90===e||270===e;for(var g=0===a.childrenCount,h=ct(a),k=0,l=a.comments,m=l.length,n=G.alloc(),p=0;p<m;p++){var q=l[p],r=q.measuredBounds;if(d&&!g||!f&&!c&&g||f&&c&&g){if(135<e&&!f||c&&h)if(0<=a.commentMargin)for(n.h(a.bounds.x-a.commentMargin-r.width,a.bounds.y+k),q.move(n),q=q.sd();q.next();){var u=q.value;u.fromSpot=
Rd;u.toSpot=Sd}else for(n.h(a.bounds.x+2*a.focus.x-a.commentMargin,a.bounds.y+k),q.move(n),q=q.sd();q.next();)u=q.value,u.fromSpot=Sd,u.toSpot=Rd;else if(0<=a.commentMargin)for(n.h(a.bounds.x+2*a.focus.x+a.commentMargin,a.bounds.y+k),q.move(n),q=q.sd();q.next();)u=q.value,u.fromSpot=Sd,u.toSpot=Rd;else for(n.h(a.bounds.x+a.commentMargin-r.width,a.bounds.y+k),q.move(n),q=q.sd();q.next();)u=q.value,u.fromSpot=Rd,u.toSpot=Sd;k=0<=a.commentSpacing?k+(r.height+a.commentSpacing):k+(a.commentSpacing-r.height)}else{if(135<
e&&!f||!c&&h)if(0<=a.commentMargin)for(n.h(a.bounds.x+k,a.bounds.y-a.commentMargin-r.height),q.move(n),q=q.sd();q.next();)u=q.value,u.fromSpot=Jd,u.toSpot=Td;else for(n.h(a.bounds.x+k,a.bounds.y+2*a.focus.y-a.commentMargin),q.move(n),q=q.sd();q.next();)u=q.value,u.fromSpot=Td,u.toSpot=Jd;else if(0<=a.commentMargin)for(n.h(a.bounds.x+k,a.bounds.y+2*a.focus.y+a.commentMargin),q.move(n),q=q.sd();q.next();)u=q.value,u.fromSpot=Td,u.toSpot=Jd;else for(n.h(a.bounds.x+k,a.bounds.y+a.commentMargin-r.height),
q.move(n),q=q.sd();q.next();)u=q.value,u.fromSpot=Jd,u.toSpot=Td;k=0<=a.commentSpacing?k+(r.width+a.commentSpacing):k+(a.commentSpacing-r.width)}}G.free(n);b=k-a.commentSpacing-(d?b.height:b.width);if(this.Zc===ys)for(a=a.destinationEdges;a.next();)e=a.value.link,null===e||e.isAvoiding||(e.fromEndSegmentLength=0<b?b:NaN);else for(a=a.sourceEdges;a.next();)e=a.value.link,null===e||e.isAvoiding||(e.toEndSegmentLength=0<b?b:NaN)}};
ws.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 dt:et(this,a);break;case ft:if(a.alignment===Ps)et(this,a);else if(0===a.childrenCount)d=a.parent,c=!1,b=0,null!==d&&(b=d.angle,c=d.alignment,c=Ys(c)),d=ct(a),a.S.h(0,0),a.ua.h(a.width,a.height),null===a.parent||null===a.comments||(180!==b&&270!==b||c)&&!d?a.ia.h(0,0):180===b&&!c||(90===b||270===b)&&d?a.ia.h(a.width-2*a.focus.x,0):a.ia.h(0,a.height-2*a.focus.y),
a.Zp=null,a.lq=null;else{var e=gt(a);b=90===e||270===e;var f=0,g=a.children,h=g.length;for(c=0;c<h;c++)d=g[c],f=Math.max(f,b?d.ua.width:d.ua.height);var k=a.alignment,l=k===ht,m=Ys(k),n=Math.max(0,a.breadthLimit);c=it(a);var p=a.nodeSpacing,q=jt(a),r=a.rowSpacing,u=0;if(k===nt||l||a.rm||a.sm&&1===a.maxGenerationCount)u=Math.max(0,a.rowIndent);d=a.width;var x=a.height,v=0,y=0,z=0,B=null,C=null,I=0,J=0,M=0,U=0,Q=0,ia=0,ja=0,N=0;m&&!bt(k)&&135<e&&g.reverse();if(bt(k))if(1<h)for(var R=0;R<h;R++)0===R%
2&&R!==h-1&&(N=Math.max(N,b?g[R].ua.width:g[R].ua.height));else 1===h&&(N=b?g[0].ua.width:g[0].ua.height);if(m){switch(k){case Zs:y=135>e?ot(a,g,N,v,y):pt(a,g,N,v,y);N=y.x;v=y.width;y=y.height;break;case $s:for(B=0;B<h;B++)C=g[B],n=C.ua,z=0===ia?0:r,b?(C.S.h(f-n.width,U+z),v=Math.max(v,n.width),y=Math.max(y,U+z+n.height),U+=z+n.height):(C.S.h(M+z,f-n.height),v=Math.max(v,M+z+n.width),y=Math.max(y,n.height),M+=z+n.width),ia++;break;case at:for(B=0;B<h;B++)C=g[B],f=C.ua,n=0===ia?0:r,b?(C.S.h(p/2+a.focus.x,
U+n),v=Math.max(v,f.width),y=Math.max(y,U+n+f.height),U+=n+f.height):(C.S.h(M+n,p/2+a.focus.y),v=Math.max(v,M+n+f.width),y=Math.max(y,f.height),M+=n+f.width),ia++}B=qt(this,2);C=qt(this,2);b?(B[0].h(0,0),B[1].h(0,y),C[0].h(v,0)):(B[0].h(0,0),B[1].h(v,0),C[0].h(0,y));C[1].h(v,y)}else for(R=0;R<h;R++){var Aa=g[R],ob=Aa.ua;if(b){0<n&&0<ia&&M+p+ob.width>n&&(M<f&&rt(a,k,f-M,0,ja,R-1),Q++,ia=0,ja=R,z=y,M=0,U=135<e?-y-r:y+r);st(this,Aa,0,U);var Ha=0;if(0===ia){if(B=Aa.Zp,C=Aa.lq,I=ob.width,J=ob.height,null===
B||null===C||e!==gt(Aa))B=qt(this,2),C=qt(this,2),B[0].h(0,0),B[1].h(0,J),C[0].h(I,0),C[1].h(I,J)}else{var Da=Ka();J=tt(this,a,Aa,B,C,I,J,Da);Ha=J.x;B=Da[0];C=Da[1];I=J.width;J=J.height;Oa(Da);M<ob.width&&0>Ha&&(ut(a,-Ha,0,ja,R-1),vt(B,-Ha,0),vt(C,-Ha,0),Ha=0)}Aa.S.h(Ha,U);v=Math.max(v,I);y=Math.max(y,z+(0===Q?0:r)+ob.height);M=I}else{0<n&&0<ia&&U+p+ob.height>n&&(U<f&&rt(a,k,0,f-U,ja,R-1),Q++,ia=0,ja=R,z=v,U=0,M=135<e?-v-r:v+r);st(this,Aa,M,0);Ha=0;if(0===ia){if(B=Aa.Zp,C=Aa.lq,I=ob.width,J=ob.height,
null===B||null===C||e!==gt(Aa))B=qt(this,2),C=qt(this,2),B[0].h(0,0),B[1].h(I,0),C[0].h(0,J),C[1].h(I,J)}else Da=Ka(),J=tt(this,a,Aa,B,C,I,J,Da),Ha=J.x,B=Da[0],C=Da[1],I=J.width,J=J.height,Oa(Da),U<ob.height&&0>Ha&&(ut(a,0,-Ha,ja,R-1),vt(B,0,-Ha),vt(C,0,-Ha),Ha=0);Aa.S.h(M,Ha);y=Math.max(y,J);v=Math.max(v,z+(0===Q?0:r)+ob.width);U=J}ia++}0<Q&&(b?(y+=Math.max(0,c),M<v&&rt(a,k,v-M,0,ja,h-1),0<u&&(l||ut(a,u,0,0,h-1),v+=u)):(v+=Math.max(0,c),U<y&&rt(a,k,0,y-U,ja,h-1),0<u&&(l||ut(a,0,u,0,h-1),y+=u)));
u=l=0;switch(k){case wt:b?l+=v/2-a.focus.x-q/2:u+=y/2-a.focus.y-q/2;break;case xt:0<Q?b?l+=v/2-a.focus.x-q/2:u+=y/2-a.focus.y-q/2:b?(N=g[0].S.x+g[0].ia.x,l+=N+(g[h-1].S.x+g[h-1].ia.x+2*g[h-1].focus.x-N)/2-a.focus.x-q/2):(N=g[0].S.y+g[0].ia.y,u+=N+(g[h-1].S.y+g[h-1].ia.y+2*g[h-1].focus.y-N)/2-a.focus.y-q/2);break;case nt:b?(l-=q,v+=q):(u-=q,y+=q);break;case ht:b?(l+=v-a.width+q,v+=q):(u+=y-a.height+q,y+=q);break;case Zs:b?1<h?l+=N+p/2-a.focus.x:l+=g[0].focus.x-a.focus.x+g[0].ia.x:1<h?u+=N+p/2-a.focus.y:
u+=g[0].focus.y-a.focus.y+g[0].ia.y;break;case $s:b?l+=v+p/2-a.focus.x:u+=y+p/2-a.focus.y;break;case at:break;default:A("Unhandled alignment value "+k.toString())}for(q=0;q<h;q++)N=g[q],b?N.S.h(N.S.x+N.ia.x-l,N.S.y+(135<e?(m?-y:-N.ua.height)+N.ia.y-c:x+c+N.ia.y)):N.S.h(N.S.x+(135<e?(m?-v:-N.ua.width)+N.ia.x-c:d+c+N.ia.x),N.S.y+N.ia.y-u);h=g=0;m?b?(v=yt(a,v,l),0>l&&(l=0),135<e&&(u+=y+c),y+=x+c,k===at&&(g+=p/2+a.focus.x),h+=x+c):(135<e&&(l+=v+c),v+=d+c,y=zt(a,y,u),0>u&&(u=0),k===at&&(h+=p/2+a.focus.y),
g+=d+c):b?(null===a.comments?d>v&&(v=At(k,d-v,0),g=v.x,h=v.y,v=d,l=0):v=yt(a,v,l),0>l&&(g-=l,l=0),135<e&&(u+=y+c),y=Math.max(Math.max(y,x),y+x+c),h+=x+c):(135<e&&(l+=v+c),v=Math.max(Math.max(v,d),v+d+c),null===a.comments?x>y&&(y=At(k,0,x-y),g=y.x,h=y.y,y=x,u=0):y=zt(a,y,u),0>u&&(h-=u,u=0),g+=d+c);if(0<Q)e=qt(this,4),Q=qt(this,4),b?(e[2].h(0,x+c),e[3].h(e[2].x,y),Q[2].h(v,e[2].y),Q[3].h(Q[2].x,e[3].y)):(e[2].h(d+c,0),e[3].h(v,e[2].y),Q[2].h(e[2].x,y),Q[3].h(e[3].x,Q[2].y));else{e=qt(this,B.length+
2);Q=qt(this,C.length+2);for(k=0;k<B.length;k++)m=B[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,x),e[2].y<e[1].y&&(e[2].x>e[0].x?e[2].assign(e[1]):e[1].assign(e[2])),e[3].y<e[2].y&&(e[3].x>e[0].x?e[3].assign(e[2]):e[2].assign(e[3])),Q[0].h(l+d,0),Q[1].h(Q[0].x,x),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+x),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);Bt(this,B);Bt(this,C);a.Zp=e;a.lq=Q;a.ia.h(l,u);a.ua.h(v,y)}break;default:A("Unhandled compaction value "+a.compaction.toString())}}};
function et(a,b){if(0===b.childrenCount){var c=!1,d=0;null!==b.parent&&(d=b.parent.angle,c=b.parent.alignment,c=Ys(c));var e=ct(b);b.S.h(0,0);b.ua.h(b.width,b.height);null===b.parent||null===b.comments||(180!==d&&270!==d||c)&&!e?b.ia.h(0,0):180===d&&!c||(90===d||270===d)&&e?b.ia.h(b.width-2*b.focus.x,0):b.ia.h(0,b.height-2*b.focus.y)}else{d=gt(b);c=90===d||270===d;var f=0;e=b.children;for(var g=e.length,h=0;h<g;h++){var k=e[h];f=Math.max(f,c?k.ua.width:k.ua.height)}var l=b.alignment,m=l===nt,n=l===
ht;h=Ys(l);var p=Math.max(0,b.breadthLimit);k=it(b);var q=b.nodeSpacing,r=jt(b),u=m||n?0:r/2,x=b.rowSpacing,v=0;if(m||n||b.rm||b.sm&&1===b.maxGenerationCount)v=Math.max(0,b.rowIndent);m=b.width;var y=b.height,z=0,B=0,C=0,I=0,J=0,M=0,U=0,Q=0,ia=0;h&&!bt(l)&&135<d&&e.reverse();if(bt(l))if(1<g)for(var ja=0;ja<g;ja++){var N=e[ja],R=N.ua;0===ja%2&&ja!==g-1&&(ia=Math.max(ia,(c?R.width:R.height)+Ct(N)-q))}else 1===g&&(ia=c?e[0].ua.width:e[0].ua.height);if(h)switch(l){case Zs:case Ps:B=135>d?ot(b,e,ia,z,
B):pt(b,e,ia,z,B);ia=B.x;z=B.width;B=B.height;break;case $s:for(a=0;a<g;a++)p=e[a],u=p.ua,C=0===U?0:x,c?(p.S.h(f-u.width,J+C),z=Math.max(z,u.width),B=Math.max(B,J+C+u.height),J+=C+u.height):(p.S.h(I+C,f-u.height),z=Math.max(z,I+C+u.width),B=Math.max(B,u.height),I+=C+u.width),U++;break;case at:for(f=0;f<g;f++)a=e[f],p=a.ua,u=0===U?0:x,c?(a.S.h(q/2+b.focus.x,J+u),z=Math.max(z,p.width),B=Math.max(B,J+u+p.height),J+=u+p.height):(a.S.h(I+u,q/2+b.focus.y),z=Math.max(z,I+u+p.width),B=Math.max(B,p.height),
I+=u+p.width),U++}else for(ja=0;ja<g;ja++){N=e[ja];R=N.ua;if(c){0<p&&0<U&&I+q+R.width>p&&(I<f&&rt(b,l,f-I,0,Q,ja-1),M++,U=0,Q=ja,C=B,I=0,J=135<d?-B-x:B+x);var Aa=0===U?u:q;st(a,N,0,J);N.S.h(I+Aa,J);z=Math.max(z,I+Aa+R.width);B=Math.max(B,C+(0===M?0:x)+R.height);I+=Aa+R.width}else 0<p&&0<U&&J+q+R.height>p&&(J<f&&rt(b,l,0,f-J,Q,ja-1),M++,U=0,Q=ja,C=z,J=0,I=135<d?-z-x:z+x),Aa=0===U?u:q,st(a,N,I,0),N.S.h(I,J+Aa),B=Math.max(B,J+Aa+R.height),z=Math.max(z,C+(0===M?0:x)+R.width),J+=Aa+R.height;U++}0<M&&(c?
(B+=Math.max(0,k),I<z&&rt(b,l,z-I,0,Q,g-1),0<v&&(n||ut(b,v,0,0,g-1),z+=v)):(z+=Math.max(0,k),J<B&&rt(b,l,0,B-J,Q,g-1),0<v&&(n||ut(b,0,v,0,g-1),B+=v)));v=n=0;switch(l){case wt:c?n+=z/2-b.focus.x-r/2:v+=B/2-b.focus.y-r/2;break;case xt:0<M?c?n+=z/2-b.focus.x-r/2:v+=B/2-b.focus.y-r/2:c?(l=e[0].S.x+e[0].ia.x,n+=l+(e[g-1].S.x+e[g-1].ia.x+2*e[g-1].focus.x-l)/2-b.focus.x-r/2):(l=e[0].S.y+e[0].ia.y,v+=l+(e[g-1].S.y+e[g-1].ia.y+2*e[g-1].focus.y-l)/2-b.focus.y-r/2);break;case nt:c?(n-=r,z+=r):(v-=r,B+=r);break;
case ht:c?(n+=z-b.width+r,z+=r):(v+=B-b.height+r,B+=r);break;case Zs:case Ps:c?1<g?n+=ia+q/2-b.focus.x:n+=e[0].focus.x-b.focus.x+e[0].ia.x:1<g?v+=ia+q/2-b.focus.y:v+=e[0].focus.y-b.focus.y+e[0].ia.y;break;case $s:c?n+=z+q/2-b.focus.x:v+=B+q/2-b.focus.y;break;case at:break;default:A("Unhandled alignment value "+l.toString())}for(r=0;r<g;r++)l=e[r],c?l.S.h(l.S.x+l.ia.x-n,l.S.y+(135<d?(h?-B:-l.ua.height)+l.ia.y-k:y+k+l.ia.y)):l.S.h(l.S.x+(135<d?(h?-z:-l.ua.width)+l.ia.x-k:m+k+l.ia.x),l.S.y+l.ia.y-v);
c?(z=yt(b,z,n),0>n&&(n=0),135<d&&(v+=B+k),B+=y+k):(135<d&&(n+=z+k),z+=m+k,B=zt(b,B,v),0>v&&(v=0));b.ia.h(n,v);b.ua.h(z,B)}}
function ot(a,b,c,d,e){var f=b.length;if(0===f)return new L(c,0,d,e);if(1===f)return a=b[0],d=a.ua.width,e=a.ua.height,new L(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=90===gt(a),l=0,m=0,n=0,p=0;p<f;p++)if(!(0!==p%2||1<f&&p===f-1)){var q=b[p],r=q.ua,u=0===l?0:h;if(k){var x=Ct(q)-g;q.S.h(c-(r.width+x),n+u);d=Math.max(d,r.width+x);e=Math.max(e,n+u+r.height);n+=u+r.height}else x=Ct(q)-g,q.S.h(m+u,c-(r.height+x)),e=Math.max(e,r.height+x),d=Math.max(d,m+u+r.width),m+=u+r.width;l++}l=0;q=m;p=n;k?
(m=c+g,n=0):(m=0,n=c+g);for(r=0;r<f;r++)if(0!==r%2){u=b[r];x=u.ua;var v=0===l?0:h;if(k){var y=Ct(u)-g;u.S.h(m+y,n+v);d=Math.max(d,m+x.width+y);e=Math.max(e,n+v+x.height);n+=v+x.height}else y=Ct(u)-g,u.S.h(m+v,n+y),d=Math.max(d,m+v+x.width),e=Math.max(e,n+x.height+y),m+=v+x.width;l++}1<f&&1===f%2&&(b=b[f-1],f=b.ua,h=null===b.parent?0:b.parent.rowSpacing,k?(b.S.h(c+g/2-b.focus.x-b.ia.x,e+h),k=c+g/2-b.focus.x-b.ia.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=Dt(a,b.S.x,!1,c,g))):(b.S.h(d+h,c+g/2-b.focus.y-b.ia.y),d=Math.max(d,Math.max(q,m)+h+f.width),n=c+g/2-b.focus.y-b.ia.y,e=Math.max(e,n+f.height),0>n&&(e-=n),0>b.S.y&&(c=Dt(a,b.S.y,!0,c,g))));return new L(c,0,d,e)}
function pt(a,b,c,d,e){var f=b.length;if(0===f)return new L(c,0,d,e);if(1===f)return b=b[0],d=b.ua.width,e=b.ua.height,new L(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=270===gt(a),l=0,m=0,n=0,p=0;p<f;p++)if(!(0!==p%2||1<f&&p===f-1)){var q=b[p],r=q.ua,u=0===l?0:h;if(k){var x=Ct(q)-g;n-=u+r.height;q.S.h(c-(r.width+x),n);d=Math.max(d,r.width+x);e=Math.max(e,Math.abs(n))}else x=Ct(q)-g,m-=u+r.width,q.S.h(m,c-(r.height+x)),e=Math.max(e,r.height+x),d=Math.max(d,Math.abs(m));l++}l=0;q=m;p=n;k?(m=
c+g,n=0):(m=0,n=c+g);for(r=0;r<f;r++)if(0!==r%2){u=b[r];x=u.ua;var v=0===l?0:h;if(k){var y=Ct(u)-g;n-=v+x.height;u.S.h(m+y,n);d=Math.max(d,m+x.width+y);e=Math.max(e,Math.abs(n))}else y=Ct(u)-g,m-=v+x.width,u.S.h(m,n+y),e=Math.max(e,n+x.height+y),d=Math.max(d,Math.abs(m));l++}1<f&&1===f%2&&(h=b[f-1],l=h.ua,r=null===h.parent?0:h.parent.rowSpacing,k?(h.S.h(c+g/2-h.focus.x-h.ia.x,-e-l.height-r),m=c+g/2-h.focus.x-h.ia.x,d=Math.max(d,m+l.width),0>m&&(d-=m),e=Math.max(e,Math.abs(Math.min(p,n))+r+l.height),
0>h.S.x&&(c=Dt(a,h.S.x,!1,c,g))):(h.S.h(-d-l.width-r,c+g/2-h.focus.y-h.ia.y),d=Math.max(d,Math.abs(Math.min(q,m))+r+l.width),n=c+g/2-h.focus.y-h.ia.y,e=Math.max(e,n+l.height),0>n&&(e-=n),0>h.S.y&&(c=Dt(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 L(c,0,d,e)}function Ct(a){return null===a.parent?0:a.parent.nodeSpacing}
function Dt(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.ia.y+b.focus.y-e/2:b.ia.x+b.focus.x-e/2)}
function yt(a,b,c){switch(a.alignment){case xt:case wt:return c+a.width>b&&(b=c+a.width),0>c&&(b-=c),b;case nt:return a.width>b?a.width:b;case ht:return 2*a.focus.x>b?a.width:b+a.width-2*a.focus.x;case Zs:case Ps:return Math.max(a.width,Math.max(b,c+a.width)-Math.min(0,c));case $s:return a.width-a.focus.x+a.nodeSpacing/2+b;case at:return Math.max(a.width,a.focus.x+a.nodeSpacing/2+b);default:return b}}
function zt(a,b,c){switch(a.alignment){case xt:case wt:return c+a.height>b&&(b=c+a.height),0>c&&(b-=c),b;case nt:return a.height>b?a.height:b;case ht:return 2*a.focus.y>b?a.height:b+a.height-2*a.focus.y;case Zs:case Ps:return Math.max(a.height,Math.max(b,c+a.height)-Math.min(0,c));case $s:return a.height-a.focus.y+a.nodeSpacing/2+b;case at:return Math.max(a.height,a.focus.y+a.nodeSpacing/2+b);default:return b}}
function At(a,b,c){switch(a){case wt:b/=2;c/=2;break;case xt:b/=2;c/=2;break;case nt:c=b=0;break;case ht:break;default:A("Unhandled alignment value "+a.toString())}return new G(b,c)}function rt(a,b,c,d,e,f){b=At(b,c,d);ut(a,b.x,b.y,e,f)}function ut(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 st(a,b,c,d){var e=b.parent;switch(a.Zc){case ys:for(a=b.sourceEdges;a.next();)b=a.value,b.fromVertex===e&&b.relativePoint.h(c,d);break;case Fs:for(a=b.destinationEdges;a.next();)b=a.value,b.toVertex===e&&b.relativePoint.h(c,d);break;default:A("Unhandled path value "+a.Zc.toString())}}function vt(a,b,c){for(var d=0;d<a.length;d++){var e=a[d];e.x+=b;e.y+=c}}
function tt(a,b,c,d,e,f,g,h){var k=gt(b),l=90===k||270===k,m=b.nodeSpacing;b=d;var n=e;d=f;var p=g,q=c.Zp,r=c.lq;g=c.ua;var u=l?Math.max(p,g.height):Math.max(d,g.width);if(null===q||k!==gt(c))q=qt(a,2),r=qt(a,2),l?(q[0].h(0,0),q[1].h(0,g.height),r[0].h(g.width,0),r[1].h(r[0].x,q[1].y)):(q[0].h(0,0),q[1].h(g.width,0),r[0].h(0,g.height),r[1].h(q[1].x,r[0].y));if(l){p=9999999;if(!(null===n||2>n.length||null===q||2>q.length))for(e=c=0;c<n.length&&e<q.length;){f=n[c];var x=q[e];k=x.x;l=x.y;k+=d;var v=
f;c+1<n.length&&(v=n[c+1]);var y=x;x=y.x;y=y.y;e+1<q.length&&(y=q[e+1],x=y.x,y=y.y,x+=d);var z=p;f.y===l?z=k-f.x:f.y>l&&f.y<y?z=k+(f.y-l)/(y-l)*(x-k)-f.x:l>f.y&&l<v.y&&(z=k-(f.x+(l-f.y)/(v.y-f.y)*(v.x-f.x)));z<p&&(p=z);v.y<=f.y?c++:y<=l?e++:(v.y<=y&&c++,y<=v.y&&e++)}p=d-p;p+=m;c=q;e=p;if(null===b||2>b.length||null===c||2>c.length)d=null;else{m=qt(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=qt(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);Bt(a,m);d=c}f=r;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=qt(a,n.length+f.length);for(e=l=c=0;c<n.length&&n[c].y<f[0].y;)v=n[c++],m[e++].h(v.x,v.y);for(;l<f.length;)v=f[l++],m[e++].h(v.x+k,v.y);for(f=f[f.length-1].y;c<n.length&&n[c].y<=f;)c++;for(;c<n.length&&n[c].y>f;)k=n[c++],m[e++].h(k.x,k.y);f=qt(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);Bt(a,m);e=f}f=
Math.max(0,p)+g.width;g=u;Bt(a,b);Bt(a,q);Bt(a,n);Bt(a,r);h[0]=d;h[1]=e;return new L(p,0,f,g)}d=9999999;if(!(null===n||2>n.length||null===q||2>q.length))for(e=c=0;c<n.length&&e<q.length;)f=n[c],x=q[e],k=x.x,l=x.y,l+=p,v=f,c+1<n.length&&(v=n[c+1]),y=x,x=y.x,y=y.y,e+1<q.length&&(y=q[e+1],x=y.x,y=y.y,y+=p),z=d,f.x===k?z=l-f.y:f.x>k&&f.x<x?z=l+(f.x-k)/(x-k)*(y-l)-f.y:k>f.x&&k<v.x&&(z=l-(f.y+(k-f.x)/(v.x-f.x)*(v.y-f.y))),z<d&&(d=z),v.x<=f.x?c++:x<=k?e++:(v.x<=x&&c++,x<=v.x&&e++);p-=d;p+=m;c=q;e=p;if(null===
b||2>b.length||null===c||2>c.length)d=null;else{m=qt(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=qt(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);Bt(a,m);d=c}f=r;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=qt(a,n.length+f.length);for(e=l=c=0;c<n.length&&n[c].x<f[0].x;)v=n[c++],m[e++].h(v.x,v.y);
for(;l<f.length;)v=f[l++],m[e++].h(v.x,v.y+k);for(f=f[f.length-1].x;c<n.length&&n[c].x<=f;)c++;for(;c<n.length&&n[c].x>f;)k=n[c++],m[e++].h(k.x,k.y);f=qt(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);Bt(a,m);e=f}f=u;g=Math.max(0,p)+g.height;Bt(a,b);Bt(a,q);Bt(a,n);Bt(a,r);h[0]=d;h[1]=e;return new L(p,0,f,g)}function qt(a,b){a=a.uu[b];if(void 0!==a&&(a=a.pop(),void 0!==a))return a;a=[];for(var c=0;c<b;c++)a[c]=new G;return a}
function Bt(a,b){var c=b.length,d=a.uu[c];void 0===d&&(d=[],a.uu[c]=d);d.push(b)}
ws.prototype.arrangeTrees=function(){if(this.Ab===Es)for(var a=this.Fb.iterator;a.next();){var b=a.value;if(b instanceof Ds){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);Et(this,b,c,d)}}}else{a=[];for(b=this.Fb.iterator;b.next();)c=b.value,c instanceof Ds&&a.push(c);switch(this.sorting){case Us:break;case Vs:a.reverse();break;case Ws:a.sort(this.comparer);break;case Xs:a.sort(this.comparer);a.reverse();break;default:A("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];Et(this,e,b+e.ia.x,c+e.ia.y);switch(this.Ab){case Bs:c+=e.ua.height+this.wd.height;break;case Ft:b+=e.ua.width+this.wd.width;break;default:A("Unhandled arrangement value "+this.Ab.toString())}}}};function Et(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];Et(a,g,c+g.S.x,d+g.S.y)}}}ws.prototype.commitLayout=function(){this.Fv();this.commitNodes();this.Ju();this.isRouting&&this.commitLinks()};
ws.prototype.commitNodes=function(){for(var a=this.network.vertexes.iterator;a.next();)a.value.commit();for(a.reset();a.next();)this.layoutComments(a.value)};
ws.prototype.Ju=function(){if(this.layerStyle===Ms){for(var a=this.fw,b=[],c=null,d=this.network.vertexes.iterator;d.next();){var e=d.value;null===c?c=e.bounds.copy():c.Uc(e.bounds);var f=b[e.level];void 0===f?f=it(e):f=Math.max(f,it(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.Tc(this.nodeSpacing/2,this.layerSpacing),d=new G(-this.nodeSpacing/2,-this.layerSpacing/2)):(c.Tc(this.layerSpacing,this.nodeSpacing/2),d=new G(-this.layerSpacing/2,-this.nodeSpacing/
2));e=[];c=90===this.angle||270===this.angle?c.width:c.height;f=0;if(180===this.angle||270===this.angle)for(var g=0;g<a.length;g++)f+=a[g]+b[g];for(g=0;g<a.length;g++){var h=a[g]+b[g];270===this.angle?(f-=h,e.push(new L(0,f,c,h))):90===this.angle?(e.push(new L(0,f,c,h)),f+=h):180===this.angle?(f-=h,e.push(new L(f,0,h,c))):(e.push(new L(f,0,h,c)),f+=h)}this.commitLayers(e,d)}};ws.prototype.commitLayers=function(){};ws.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};
ws.prototype.Fv=function(){for(var a=this.Fb.iterator;a.next();){var b=a.value;b instanceof Ds&&Gt(this,b)}};function Gt(a,b){if(null!==b){a.setPortSpots(b);b=b.children;for(var c=b.length,d=0;d<c;d++)Gt(a,b[d])}}
ws.prototype.setPortSpots=function(a){var b=a.alignment;if(Ys(b)){var c=this.Zc===ys,d=gt(a);switch(d){case 0:var e=Sd;break;case 90:e=Td;break;case 180:e=Rd;break;default:e=Jd}var f=a.children,g=f.length;switch(b){case Zs:case Ps:for(b=0;b<g;b++){var h=f[b];h=(c?h.sourceEdges:h.destinationEdges).first();if(null!==h&&(h=h.link,null!==h)){var k=90===d||270===d?Rd:Jd;if(1===g||b===g-1&&1===g%2)switch(d){case 0:k=Rd;break;case 90:k=Jd;break;case 180:k=Sd;break;default:k=Td}else 0===b%2&&(k=90===d||270===
d?Sd:Td);c?(a.setsPortSpot&&(h.fromSpot=e),a.setsChildPortSpot&&(h.toSpot=k)):(a.setsPortSpot&&(h.fromSpot=k),a.setsChildPortSpot&&(h.toSpot=e))}}break;case $s:d=90===d||270===d?Sd:Td;for(f=c?a.destinationEdges:a.sourceEdges;f.next();)g=f.value.link,null!==g&&(c?(a.setsPortSpot&&(g.fromSpot=e),a.setsChildPortSpot&&(g.toSpot=d)):(a.setsPortSpot&&(g.fromSpot=d),a.setsChildPortSpot&&(g.toSpot=e)));break;case at:for(d=90===d||270===d?Rd:Jd,f=c?a.destinationEdges:a.sourceEdges;f.next();)g=f.value.link,
null!==g&&(c?(a.setsPortSpot&&(g.fromSpot=e),a.setsChildPortSpot&&(g.toSpot=d)):(a.setsPortSpot&&(g.fromSpot=d),a.setsChildPortSpot&&(g.toSpot=e)))}}else if(c=gt(a),this.Zc===ys)for(e=a.destinationEdges;e.next();){if(d=e.value.link,null!==d){if(a.setsPortSpot)if(a.portSpot.Kb())switch(c){case 0:d.fromSpot=Sd;break;case 90:d.fromSpot=Td;break;case 180:d.fromSpot=Rd;break;default:d.fromSpot=Jd}else d.fromSpot=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.Kb())switch(c){case 0:d.toSpot=Rd;break;
case 90:d.toSpot=Jd;break;case 180:d.toSpot=Sd;break;default:d.toSpot=Td}else d.toSpot=a.childPortSpot}}else for(e=a.sourceEdges;e.next();)if(d=e.value.link,null!==d){if(a.setsPortSpot)if(a.portSpot.Kb())switch(c){case 0:d.toSpot=Sd;break;case 90:d.toSpot=Td;break;case 180:d.toSpot=Rd;break;default:d.toSpot=Jd}else d.toSpot=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.Kb())switch(c){case 0:d.fromSpot=Rd;break;case 90:d.fromSpot=Jd;break;case 180:d.fromSpot=Sd;break;default:d.fromSpot=Td}else d.fromSpot=
a.childPortSpot}};function gt(a){a=a.angle;return 45>=a?0:135>=a?90:225>=a?180:315>=a?270:0}function it(a){var b=gt(a);b=90===b||270===b;var c=a.layerSpacing;if(0<a.layerSpacingParentOverlap){var d=Math.min(1,a.layerSpacingParentOverlap);c-=b?a.height*d:a.width*d}c<(b?-a.height:-a.width)&&(c=b?-a.height:-a.width);return c}function jt(a){var b=gt(a),c=a.nodeIndent;if(0<a.nodeIndentPastParent){var d=Math.min(1,a.nodeIndentPastParent);c+=90===b||270===b?a.width*d:a.height*d}return c=Math.max(0,c)}
pa.Object.defineProperties(ws.prototype,{roots:{get:function(){return this.Fb},set:function(a){this.Fb!==a&&(this.Fb=a,this.B())}},path:{get:function(){return this.Jo},set:function(a){this.Jo!==a&&(this.Jo=a,this.B())}},treeStyle:{get:function(){return this.Ap},set:function(a){this.Ab===a||a!==zs&&a!==Ss&&a!==Ts&&a!==Rs||(this.Ap=a,this.B())}},layerStyle:{get:function(){return this.Hr},
set:function(a){this.Ab===a||a!==As&&a!==Ns&&a!==Ms||(this.Hr=a,this.B())}},comments:{get:function(){return this.Xc},set:function(a){this.Xc!==a&&(this.Xc=a,this.B())}},arrangement:{get:function(){return this.Ab},set:function(a){this.Ab===a||a!==Bs&&a!==Ft&&a!==Es||(this.Ab=a,this.B())}},arrangementSpacing:{get:function(){return this.wd},set:function(a){this.wd.A(a)||(this.wd.assign(a),this.B())}},rootDefaults:{
get:function(){return this.T},set:function(a){this.T!==a&&(this.T=a,this.B())}},alternateDefaults:{get:function(){return this.U},set:function(a){this.U!==a&&(this.U=a,this.B())}},sorting:{get:function(){return this.T.sorting},set:function(a){this.T.sorting===a||a!==Us&&a!==Vs&&a!==Ws&&!Xs||(this.T.sorting=a,this.B())}},comparer:{get:function(){return this.T.comparer},set:function(a){this.T.comparer!==
a&&(this.T.comparer=a,this.B())}},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.B()):A("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.B())}},nodeIndent:{get:function(){return this.T.nodeIndent},set:function(a){this.T.nodeIndent!==
a&&0<=a&&(this.T.nodeIndent=a,this.B())}},nodeIndentPastParent:{get:function(){return this.T.nodeIndentPastParent},set:function(a){this.T.nodeIndentPastParent!==a&&0<=a&&1>=a&&(this.T.nodeIndentPastParent=a,this.B())}},nodeSpacing:{get:function(){return this.T.nodeSpacing},set:function(a){this.T.nodeSpacing!==a&&(this.T.nodeSpacing=a,this.B())}},layerSpacing:{get:function(){return this.T.layerSpacing},set:function(a){this.T.layerSpacing!==
a&&(this.T.layerSpacing=a,this.B())}},layerSpacingParentOverlap:{get:function(){return this.T.layerSpacingParentOverlap},set:function(a){this.T.layerSpacingParentOverlap!==a&&0<=a&&1>=a&&(this.T.layerSpacingParentOverlap=a,this.B())}},compaction:{get:function(){return this.T.compaction},set:function(a){this.T.compaction===a||a!==dt&&a!==ft||(this.T.compaction=a,this.B())}},breadthLimit:{get:function(){return this.T.breadthLimit},
set:function(a){this.T.breadthLimit!==a&&0<=a&&(this.T.breadthLimit=a,this.B())}},rowSpacing:{get:function(){return this.T.rowSpacing},set:function(a){this.T.rowSpacing!==a&&(this.T.rowSpacing=a,this.B())}},rowIndent:{get:function(){return this.T.rowIndent},set:function(a){this.T.rowIndent!==a&&0<=a&&(this.T.rowIndent=a,this.B())}},commentSpacing:{get:function(){return this.T.commentSpacing},set:function(a){this.T.commentSpacing!==
a&&(this.T.commentSpacing=a,this.B())}},commentMargin:{get:function(){return this.T.commentMargin},set:function(a){this.T.commentMargin!==a&&(this.T.commentMargin=a,this.B())}},setsPortSpot:{get:function(){return this.T.setsPortSpot},set:function(a){this.T.setsPortSpot!==a&&(this.T.setsPortSpot=a,this.B())}},portSpot:{get:function(){return this.T.portSpot},set:function(a){this.T.portSpot.A(a)||(this.T.portSpot=
a,this.B())}},setsChildPortSpot:{get:function(){return this.T.setsChildPortSpot},set:function(a){this.T.setsChildPortSpot!==a&&(this.T.setsChildPortSpot=a,this.B())}},childPortSpot:{get:function(){return this.T.childPortSpot},set:function(a){this.T.childPortSpot.A(a)||(this.T.childPortSpot=a,this.B())}},alternateSorting:{get:function(){return this.U.sorting},set:function(a){this.U.sorting===a||a!==Us&&a!==Vs&&
a!==Ws&&!Xs||(this.U.sorting=a,this.B())}},alternateComparer:{get:function(){return this.U.comparer},set:function(a){this.U.comparer!==a&&(this.U.comparer=a,this.B())}},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.B())}},alternateAlignment:{get:function(){return this.U.alignment},set:function(a){this.U.alignment!==
a&&(this.U.alignment=a,this.B())}},alternateNodeIndent:{get:function(){return this.U.nodeIndent},set:function(a){this.U.nodeIndent!==a&&0<=a&&(this.U.nodeIndent=a,this.B())}},alternateNodeIndentPastParent:{get:function(){return this.U.nodeIndentPastParent},set:function(a){this.U.nodeIndentPastParent!==a&&0<=a&&1>=a&&(this.U.nodeIndentPastParent=a,this.B())}},alternateNodeSpacing:{get:function(){return this.U.nodeSpacing},
set:function(a){this.U.nodeSpacing!==a&&(this.U.nodeSpacing=a,this.B())}},alternateLayerSpacing:{get:function(){return this.U.layerSpacing},set:function(a){this.U.layerSpacing!==a&&(this.U.layerSpacing=a,this.B())}},alternateLayerSpacingParentOverlap:{get:function(){return this.U.layerSpacingParentOverlap},set:function(a){this.U.layerSpacingParentOverlap!==a&&0<=a&&1>=a&&(this.U.layerSpacingParentOverlap=a,this.B())}},alternateCompaction:{
get:function(){return this.U.compaction},set:function(a){this.U.compaction===a||a!==dt&&a!==ft||(this.U.compaction=a,this.B())}},alternateBreadthLimit:{get:function(){return this.U.breadthLimit},set:function(a){this.U.breadthLimit!==a&&0<=a&&(this.U.breadthLimit=a,this.B())}},alternateRowSpacing:{get:function(){return this.U.rowSpacing},set:function(a){this.U.rowSpacing!==a&&(this.U.rowSpacing=a,this.B())}},alternateRowIndent:{
get:function(){return this.U.rowIndent},set:function(a){this.U.rowIndent!==a&&0<=a&&(this.U.rowIndent=a,this.B())}},alternateCommentSpacing:{get:function(){return this.U.commentSpacing},set:function(a){this.U.commentSpacing!==a&&(this.U.commentSpacing=a,this.B())}},alternateCommentMargin:{get:function(){return this.U.commentMargin},set:function(a){this.U.commentMargin!==a&&(this.U.commentMargin=a,this.B())}},alternateSetsPortSpot:{
get:function(){return this.U.setsPortSpot},set:function(a){this.U.setsPortSpot!==a&&(this.U.setsPortSpot=a,this.B())}},alternatePortSpot:{get:function(){return this.U.portSpot},set:function(a){this.U.portSpot.A(a)||(this.U.portSpot=a,this.B())}},alternateSetsChildPortSpot:{get:function(){return this.U.setsChildPortSpot},set:function(a){this.U.setsChildPortSpot!==a&&(this.U.setsChildPortSpot=a,this.B())}},alternateChildPortSpot:{
get:function(){return this.U.childPortSpot},set:function(a){this.U.childPortSpot.A(a)||(this.U.childPortSpot=a,this.B())}}});
var xs=new D(ws,"PathDefault",-1),ys=new D(ws,"PathDestination",0),Fs=new D(ws,"PathSource",1),Us=new D(ws,"SortingForwards",10),Vs=new D(ws,"SortingReverse",11),Ws=new D(ws,"SortingAscending",12),Xs=new D(ws,"SortingDescending",13),wt=new D(ws,"AlignmentCenterSubtrees",20),xt=new D(ws,"AlignmentCenterChildren",21),nt=new D(ws,"AlignmentStart",22),ht=new D(ws,"AlignmentEnd",23),Zs=new D(ws,"AlignmentBus",24),Ps=new D(ws,"AlignmentBusBranching",25),$s=new D(ws,"AlignmentTopLeftBus",26),at=new D(ws,
"AlignmentBottomRightBus",27),dt=new D(ws,"CompactionNone",30),ft=new D(ws,"CompactionBlock",31),zs=new D(ws,"StyleLayered",40),Ts=new D(ws,"StyleLastParents",41),Ss=new D(ws,"StyleAlternating",42),Rs=new D(ws,"StyleRootOnly",43),Bs=new D(ws,"ArrangementVertical",50),Ft=new D(ws,"ArrangementHorizontal",51),Es=new D(ws,"ArrangementFixedRoots",52),As=new D(ws,"LayerIndividual",60),Ns=new D(ws,"LayerSiblings",61),Ms=new D(ws,"LayerUniform",62);ws.className="TreeLayout";ws.PathDefault=xs;
ws.PathDestination=ys;ws.PathSource=Fs;ws.SortingForwards=Us;ws.SortingReverse=Vs;ws.SortingAscending=Ws;ws.SortingDescending=Xs;ws.AlignmentCenterSubtrees=wt;ws.AlignmentCenterChildren=xt;ws.AlignmentStart=nt;ws.AlignmentEnd=ht;ws.AlignmentBus=Zs;ws.AlignmentBusBranching=Ps;ws.AlignmentTopLeftBus=$s;ws.AlignmentBottomRightBus=at;ws.CompactionNone=dt;ws.CompactionBlock=ft;ws.StyleLayered=zs;ws.StyleLastParents=Ts;ws.StyleAlternating=Ss;ws.StyleRootOnly=Rs;ws.ArrangementVertical=Bs;
ws.ArrangementHorizontal=Ft;ws.ArrangementFixedRoots=Es;ws.LayerIndividual=As;ws.LayerSiblings=Ns;ws.LayerUniform=Ms;function Cs(a){vp.call(this,a)}oa(Cs,vp);Cs.prototype.createVertex=function(){return new Ds(this)};Cs.prototype.createEdge=function(){return new Ht(this)};Cs.className="TreeNetwork";
function Ds(a){yp.call(this,a);this.La=!1;this.Jc=null;this.K=[];this.Vb=this.Ub=this.ba=this.Ma=0;this.Xc=null;this.S=new G(0,0);this.ua=new K(0,0);this.ia=new G(0,0);this.sm=this.rm=this.Kz=!1;this.lq=this.Zp=null;this.Pc=Us;this.Lc=Ep;this.zc=0;this.wb=xt;this.Sr=this.Rr=0;this.Ur=20;this.je=50;this.Gr=0;this.Mq=ft;this.Fq=0;this.es=25;this.Lq=this.ds=10;this.Kq=20;this.qs=!0;this.$r=Ed;this.ps=!0;this.Iq=Ed}oa(Ds,yp);
Ds.prototype.copyInheritedPropertiesFrom=function(a){null!==a&&(this.Pc=a.sorting,this.Lc=a.comparer,this.zc=a.angle,this.wb=a.alignment,this.Rr=a.nodeIndent,this.Sr=a.nodeIndentPastParent,this.Ur=a.nodeSpacing,this.je=a.layerSpacing,this.Gr=a.layerSpacingParentOverlap,this.Mq=a.compaction,this.Fq=a.breadthLimit,this.es=a.rowSpacing,this.ds=a.rowIndent,this.Lq=a.commentSpacing,this.Kq=a.commentMargin,this.qs=a.setsPortSpot,this.$r=a.portSpot,this.ps=a.setsChildPortSpot,this.Iq=a.childPortSpot)};
pa.Object.defineProperties(Ds.prototype,{initialized:{get:function(){return this.La},set:function(a){this.La!==a&&(this.La=a)}},parent:{get:function(){return this.Jc},set:function(a){this.Jc!==a&&(this.Jc=a)}},children:{get:function(){return this.K},set:function(a){if(this.K!==a){if(null!==a)for(var b=a.length,c=0;c<b;c++);this.K=a}}},level:{get:function(){return this.Ma},set:function(a){this.Ma!==
a&&(this.Ma=a)}},descendantCount:{get:function(){return this.ba},set:function(a){this.ba!==a&&(this.ba=a)}},maxChildrenCount:{get:function(){return this.Ub},set:function(a){this.Ub!==a&&(this.Ub=a)}},maxGenerationCount:{get:function(){return this.Vb},set:function(a){this.Vb!==a&&(this.Vb=a)}},comments:{get:function(){return this.Xc},set:function(a){if(this.Xc!==a){if(null!==a)for(var b=
a.length,c=0;c<b;c++);this.Xc=a}}},sorting:{get:function(){return this.Pc},set:function(a){this.Pc!==a&&(this.Pc=a)}},comparer:{get:function(){return this.Lc},set:function(a){this.Lc!==a&&(this.Lc=a)}},angle:{get:function(){return this.zc},set:function(a){this.zc!==a&&(this.zc=a)}},alignment:{get:function(){return this.wb},set:function(a){this.wb!==a&&(this.wb=a)}},nodeIndent:{
get:function(){return this.Rr},set:function(a){this.Rr!==a&&(this.Rr=a)}},nodeIndentPastParent:{get:function(){return this.Sr},set:function(a){this.Sr!==a&&(this.Sr=a)}},nodeSpacing:{get:function(){return this.Ur},set:function(a){this.Ur!==a&&(this.Ur=a)}},layerSpacing:{get:function(){return this.je},set:function(a){this.je!==a&&(this.je=a)}},layerSpacingParentOverlap:{
get:function(){return this.Gr},set:function(a){this.Gr!==a&&(this.Gr=a)}},compaction:{get:function(){return this.Mq},set:function(a){this.Mq!==a&&(this.Mq=a)}},breadthLimit:{get:function(){return this.Fq},set:function(a){this.Fq!==a&&(this.Fq=a)}},rowSpacing:{get:function(){return this.es},set:function(a){this.es!==a&&(this.es=a)}},rowIndent:{get:function(){return this.ds},set:function(a){this.ds!==
a&&(this.ds=a)}},commentSpacing:{get:function(){return this.Lq},set:function(a){this.Lq!==a&&(this.Lq=a)}},commentMargin:{get:function(){return this.Kq},set:function(a){this.Kq!==a&&(this.Kq=a)}},setsPortSpot:{get:function(){return this.qs},set:function(a){this.qs!==a&&(this.qs=a)}},portSpot:{get:function(){return this.$r},set:function(a){this.$r.A(a)||(this.$r=a)}},setsChildPortSpot:{
get:function(){return this.ps},set:function(a){this.ps!==a&&(this.ps=a)}},childPortSpot:{get:function(){return this.Iq},set:function(a){this.Iq.A(a)||(this.Iq=a)}},childrenCount:{get:function(){return this.children.length}},relativePosition:{get:function(){return this.S},set:function(a){this.S.set(a)}},subtreeSize:{get:function(){return this.ua},set:function(a){this.ua.set(a)}},
subtreeOffset:{get:function(){return this.ia},set:function(a){this.ia.set(a)}}});Ds.className="TreeVertex";function Ht(a){zp.call(this,a);this.lu=new G(0,0)}oa(Ht,zp);
Ht.prototype.commit=function(){var a=this.link;if(null!==a&&!a.isAvoiding){var b=this.network.layout,c=null,d=null;switch(b.Zc){case ys:c=this.fromVertex;d=this.toVertex;break;case Fs:c=this.toVertex;d=this.fromVertex;break;default:A("Unhandled path value "+b.Zc.toString())}if(null!==c&&null!==d)if(b=this.lu,0!==b.x||0!==b.y||c.Kz){d=c.bounds;var e=gt(c),f=it(c),g=c.rowSpacing;a.Wi();var h=a.curve===Qg,k=a.isOrthogonal,l;a.Ah();if(k||h){for(l=2;4<a.pointsCount;)a.vv(2);var m=a.i(1);var n=a.i(2)}else{for(l=
1;3<a.pointsCount;)a.vv(1);m=a.i(0);n=a.i(a.pointsCount-1)}var p=a.i(a.pointsCount-1);0===e?(c.alignment===ht?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-jt(c))))):c.alignment===nt?(e=d.top+b.y,0===b.y&&m.y<p.y-c.rowIndent&&(e=Math.max(e,Math.min(m.y,e+jt(c))))):e=c.rm||c.sm&&1===c.maxGenerationCount?d.top-c.ia.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===ht?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-jt(c))))):c.alignment===nt?(e=d.left+b.x,0===b.x&&m.x<p.x-c.rowIndent&&(e=Math.max(e,Math.min(m.x,e+jt(c))))):e=c.rm||c.sm&&1===c.maxGenerationCount?d.left-c.ia.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===ht?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-jt(c))))):c.alignment===nt?(e=d.top+b.y,0===b.y&&m.y<p.y-c.rowIndent&&(e=Math.max(e,Math.min(m.y,e+jt(c))))):e=c.rm||c.sm&&1===c.maxGenerationCount?d.top-c.ia.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===ht?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-jt(c))))):c.alignment===nt?(e=d.left+b.x,0===b.x&&m.x<p.x-c.rowIndent&&(e=Math.max(e,Math.min(m.x,e+jt(c))))):e=c.rm||c.sm&&1===c.maxGenerationCount?
d.left-c.ia.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))):A("Invalid angle "+e);a.lf()}else a=this.link,f=gt(c),f!==gt(d)&&(g=it(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.Wi(),c=a.curve===Qg,b=a.isOrthogonal,d=Ys(this.fromVertex.alignment),a.Ah(),0===f?(f=h.right+g/2,c?4===a.pointsCount&&(c=a.i(3).y,a.M(1,f-20,a.i(1).y),a.m(2,f-20,c),a.m(3,f,c),a.m(4,f+20,c),a.M(5,a.i(5).x,c)):b?d?a.M(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.M(2,f,a.i(2).y),a.M(3,f,a.i(3).y)):4===a.pointsCount?a.m(2,f,a.i(2).y):3===a.pointsCount?a.M(1,f,a.i(2).y):2===a.pointsCount&&a.m(1,f,a.i(1).y)):90===f?(f=h.bottom+g/2,c?4===a.pointsCount&&(c=a.i(3).x,a.M(1,a.i(1).x,f-20),a.m(2,c,f-20),
a.m(3,c,f),a.m(4,c,f+20),a.M(5,c,a.i(5).y)):b?d?a.M(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.M(2,a.i(2).x,f),a.M(3,a.i(3).x,f)):4===a.pointsCount?a.m(2,a.i(2).x,f):3===a.pointsCount?a.M(1,a.i(2).x,f):2===a.pointsCount&&a.m(1,a.i(1).x,f)):180===f?(f=h.left-g/2,c?4===a.pointsCount&&(c=a.i(3).y,a.M(1,f+20,a.i(1).y),a.m(2,f+20,c),a.m(3,f,c),a.m(4,f-20,c),a.M(5,a.i(5).x,c)):b?d?a.M(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.M(2,f,a.i(2).y),a.M(3,f,a.i(3).y)):4===a.pointsCount?a.m(2,f,a.i(2).y):3===a.pointsCount?
a.M(1,f,a.i(2).y):2===a.pointsCount&&a.m(1,f,a.i(1).y)):270===f&&(f=h.top-g/2,c?4===a.pointsCount&&(c=a.i(3).x,a.M(1,a.i(1).x,f+20),a.m(2,c,f+20),a.m(3,c,f),a.m(4,c,f-20),a.M(5,c,a.i(5).y)):b?d?a.M(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.M(2,a.i(2).x,f),a.M(3,a.i(3).x,f)):4===a.pointsCount?a.m(2,a.i(2).x,f):3===a.pointsCount?a.M(1,a.i(2).x,f):2===a.pointsCount&&a.m(1,a.i(1).x,f)),a.lf()))}};
pa.Object.defineProperties(Ht.prototype,{relativePoint:{get:function(){return this.lu},set:function(a){this.lu.set(a)}}});Ht.className="TreeEdge";
Ua.prototype.initializeStandardTools=function(){vf(this,"Action",new ch,this.mouseDownTools);vf(this,"Relinking",new Mf,this.mouseDownTools);vf(this,"LinkReshaping",new Og,this.mouseDownTools);vf(this,"Rotating",new ah,this.mouseDownTools);vf(this,"Resizing",new Vg,this.mouseDownTools);vf(this,"Linking",new Hg,this.mouseMoveTools);vf(this,"Dragging",new xf,this.mouseMoveTools);vf(this,"DragSelecting",new fh,this.mouseMoveTools);vf(this,"Panning",new gh,this.mouseMoveTools);vf(this,"ContextMenu",new ih,
this.mouseUpTools);vf(this,"TextEditing",new th,this.mouseUpTools);vf(this,"ClickCreating",new dh,this.mouseUpTools);vf(this,"ClickSelecting",new bh,this.mouseUpTools)};dn("Horizontal",new lm);dn("Spot",new nm);dn("Table",new rm);dn("Viewbox",new wm);dn("TableRow",new um);dn("TableColumn",new vm);dn("Graduated",new Fm);qi.add(Bq.type,Xp);qi.add(Eq.type,kq);
var It=w.go,Jt={get licenseKey(){return P.licenseKey},set licenseKey(a){P.licenseKey=a},get version(){return P.version},Group:hg,EnumValue:D,List:E,Set:F,Map:Lb,Point:G,Size:K,Rect:L,Margin:Ic,Spot:O,Geometry:$d,PathFigure:Ue,PathSegment:Ve,InputEvent:Xe,DiagramEvent:Ze,ChangedEvent:$e,Model:Z,GraphLinksModel:Bq,TreeModel:Eq,Binding:Ci,Transaction:ef,UndoManager:ff,CommandHandler:Fk,Tool:kf,DraggingTool:xf,DraggingInfo:Nf,LinkingBaseTool:qg,LinkingTool:Hg,RelinkingTool:Mf,LinkReshapingTool:Og,ResizingTool:Vg,
RotatingTool:ah,ClickSelectingTool:bh,ActionTool:ch,ClickCreatingTool:dh,HTMLInfo:uf,ContextMenuTool:ih,DragSelectingTool:fh,PanningTool:gh,TextEditingTool:th,ToolManager:Ua,AnimationManager:Nh,Layer:di,Diagram:P,Palette:zk,Overview:Bk,Brush:hl,GraphObject:Y,Panel:X,RowColumnDefinition:Oj,Shape:W,TextBlock:uh,TextBlockMetrics:Hm,Picture:ak,Part:T,Adornment:pf,Node:V,Link:S,Placeholder:Wg,Layout:wi,LayoutNetwork:vp,LayoutVertex:yp,LayoutEdge:zp,GridLayout:Ak,PanelLayout:Bl,CircularLayout:Fq,CircularNetwork:Xq,
CircularVertex:jr,CircularEdge:kr,ForceDirectedLayout:lr,ForceDirectedNetwork:mr,ForceDirectedVertex:yr,ForceDirectedEdge:zr,LayeredDigraphLayout:Ar,LayeredDigraphNetwork:Fr,LayeredDigraphVertex:us,LayeredDigraphEdge:vs,TreeLayout:ws,TreeNetwork:Cs,TreeVertex:Ds,TreeEdge:Ht};It&&It.version!==Jt.version&&A("WARNING: a `go` object on the root object is already defined with a version mismatch."+It.version+". Replaced with version: "+Jt.version);w.go=Jt;
("undefined"===typeof w||"undefined"===typeof w.module||"object"!==typeof w.module.exports)&&w.define&&"function"===typeof w.define&&w.define.amd&&w.define(Jt); 'undefined'!==typeof module&&'object'===typeof module.exports&&(module.exports='undefined'!==typeof global?global.go:self.go); })();
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ruaruaruaruarua/circuitDiagram.git
git@gitee.com:ruaruaruaruarua/circuitDiagram.git
ruaruaruaruarua
circuitDiagram
电路图下载地址
master

搜索帮助