p&&q--}else{r=(a+c)/2;u=(b+d)/2;var w=(c+e)/2,v=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(r+w)/2;c=(u+v)/2;w=(w+e)/2;v=(v+f)/2;var y=(d+w)/2,z=(c+v)/2;q+=K.Fo(a,b,r,u,d,c,y,z,k,l,m,n,p);q+=K.Fo(y,z,w,v,e,f,g,h,k,l,m,n,p)}return q},qh:function(a,b,c,d,e,f,g){if(K.$(a,c)){b g&&(f=-f),f=(0>c?-1:1)*f+a,h=p*(f-a)+b),this.ne(d),this.yf(f,h),this.ne(e);else{this.ne(d);this.ne(e);h=N.alloc();b.mi(h);k=h.ca(e);p.mi(h);l=h.ca(d);if(k||l)g=b.ga(Rp(g),new I),this.dd(0,this.getLinkPointFromPoint(a,b,g,e,!0,g)),c=p.ga(Rp(c),new I),this.dd(1,this.getLinkPointFromPoint(f,p,c,d,!1,c));N.free(h)}}else{n=this.isAvoiding;p&&(m&&n||l)&&this.Ej();var z=l?this.computeCurviness():0;n=this.getLinkPoint(a,b,g,!0,m,d,e);q=u=r=0;if(m||!h||l)w=this.computeEndSegmentLength(a,b,g,!0),q=
this.getLinkDirection(a,b,n,g,!0,m,d,e),l&&(h||g.D(c)||!m&&1===g.x+c.x&&1===g.y+c.y)&&(q-=m?90:30,0>z&&(q-=180)),0>q?q+=360:360<=q&&(q-=360),l&&(w+=Math.abs(z)*(m?1:2)),0===q?r=w:90===q?u=w:180===q?r=-w:270===q?u=-w:(r=w*Math.cos(q*Math.PI/180),u=w*Math.sin(q*Math.PI/180)),g.Mc()&&l&&(w=b.ga(wc,I.alloc()),v=I.allocAt(w.x+1E3*r,w.y+1E3*u),this.getLinkPointFromPoint(a,b,w,v,!0,n),I.free(w),I.free(v));w=this.getLinkPoint(d,e,c,!1,m,a,b);var A=y=v=0;if(m||!k||l){var B=this.computeEndSegmentLength(d,e,
c,!1);A=this.getLinkDirection(d,e,w,c,!1,m,a,b);l&&(k||g.D(c)||!m&&1===g.x+c.x&&1===g.y+c.y)&&(A+=m?0:30,0>z&&(A+=180));0>A?A+=360:360<=A&&(A-=360);l&&(B+=Math.abs(z)*(m?1:2));0===A?v=B:90===A?y=B:180===A?v=-B:270===A?y=-B:(v=B*Math.cos(A*Math.PI/180),y=B*Math.sin(A*Math.PI/180));c.Mc()&&l&&(c=e.ga(wc,I.alloc()),g=I.allocAt(c.x+1E3*v,c.y+1E3*y),this.getLinkPointFromPoint(d,e,c,g,!1,w),I.free(c),I.free(g))}c=n;if(m||!h||l)c=new I(n.x+r,n.y+u);g=w;if(m||!k||l)g=new I(w.x+v,w.y+y);!p&&!m&&h&&3=a)return 0;if((e>g?e-g:g-e)<(f>h?f-h:h-f))if(f
l+1&&(g=Math.max((y-l)*L+a.Aa,g)),B+1l+1&&(b=a.position.x*L));if(a.tn)switch(a.bu){case "negative":b=-(r.scrollWidth-b-r.clientWidth);break;case "reverse":b=r.scrollWidth-b-r.clientWidth}r.scrollLeft=b;a.hasVerticalScrollbar&&a.allowVerticalScroll&&(E+1m+1&&(r.scrollTop=a.position.y*L));k=a.Aa;l=a.ya;r.style.width=k+(a.gf?a.Eb:0)+"px";r.style.height=l+(a.Be?a.Eb:0)+"px";return c!==k||d!==l||a.animationManager.Ab?(c=N.allocAt(e,n,p,q),a.onViewportBoundsChanged(c,a.viewportBounds,L,f),N.free(c),!1):!0}t=Q.prototype;
t.add=function(a){var b=a.diagram;if(b!==this&&(null!==b&&C("Cannot add part "+a.toString()+" to "+this.toString()+". It is already a part of "+b.toString()),b=this.Pj(a.layerName),null===b&&(b=this.Pj("")),null===b&&C('Cannot add a Part when unable find a Layer named "'+a.layerName+'" and there is no default Layer'),a.layer!==b)){var c=b.oi(99999999,a,a.diagram===this);0<=c&&this.cb(fe,"parts",b,null,a,null,c);b.isTemporary||this.Ya();a.C(1);c=a.layerChanged;null!==c&&c(a,null,b)}};
t.oi=function(a){this.partManager.oi(a);var b=this;Mj(a,function(a){Nj(b,a)});(a instanceof pe||a instanceof jf&&null!==a.placeholder)&&a.v();null!==a.data&&Mj(a,function(a){Oj(b.partManager,a)});!0!==Aj(a)&&!0!==Bj(a)||this.De.add(a);Pj(a,!0,this);Qj(a)?(a.actualBounds.w()&&this.N(Lj(a,a.actualBounds)),this.Ya()):a.isVisible()&&a.actualBounds.w()&&this.N(Lj(a,a.actualBounds));this.Rb()};
t.qc=function(a){a.Dj();this.partManager.qc(a);var b=this;null!==a.data&&Mj(a,function(a){Rj(b.partManager,a,b)});this.De.remove(a);Qj(a)?(a.actualBounds.w()&&this.N(Lj(a,a.actualBounds)),this.Ya()):a.isVisible()&&a.actualBounds.w()&&this.N(Lj(a,a.actualBounds));this.Rb()};t.remove=function(a){Sj(this,a,!0)};
function Sj(a,b,c){var d=b.layer;null!==d&&d.diagram===a&&(b.isSelected=!1,b.isHighlighted=!1,b.C(2),c&&b.Kj(),c=d.qc(-1,b,!1),0<=c&&a.cb(ge,"parts",d,b,null,c,null),a=b.layerChanged,null!==a&&a(b,d,null))}t.Is=function(a,b){void 0===b&&(b=!1);if(Aa(a))for(var c=a.length,d=0;dS||225S)&&r.rotate(-S,
X/2,wa/2);J=new N(0,0,X,wa);u.xi(J,E);r.Ga(u);E=-u.x+na/2*y.scale;y=-u.y+na/2*y.scale;w.assign(R);na=isNaN(R.x);var eb=isNaN(R.y);if(na||eb){X=X/2+3;wa=wa/2+3;var gb=45<=S&&135>=S,Eb=225<=S&&315>=S;L===Zf&&(gb||Eb)?(w.x=eb?X:R.y,w.y=na?wa:R.x,gb?0<=A||isNaN(A)&&.5>B||!na||(w.y=-wa):Eb&&((0<=A||isNaN(A)&&.5>B)&&na&&(w.y=-wa),eb&&(w.x=-X))):(na&&(w.x=0<=A||isNaN(A)&&.5>B?X:-X),eb&&(w.y=-wa),w.rotate(S))}else w.rotate(S);G+=w.x;ca+=w.y;J.set(z);J.h(G+E,ca+y,z.width,z.height);q.push(J);c.ed(J)}}if(null!==
g)for(d=g.labelNodes;d.next();)d.value.measure(Infinity,Infinity);a.jg=c;a.position.h(b.x+c.x,b.y+c.y);Pb(e,c.width||0,c.height||0);ld.free(r);I.free(u);I.free(w)}}}};
dn.prototype.arrange=function(a,b){var c=b.length;if(a instanceof pe||a instanceof T){var d=a,e=null;a instanceof pe&&(e=a,d=e.adornedPart);var f=a instanceof pe?null:d.path,g=a.j;if(0!==g.length){var h=0;if(null!==f&&h= 0",Bf,"strokeWidth:value")}},strokeCap:{
get:function(){return null!==this.Na?this.Na.Hr:"butt"},set:function(a){var b=this.strokeCap;b!==a&&("string"!==typeof a||"butt"!==a&&"round"!==a&&"square"!==a?xa(a,'"butt", "round", or "square"',Bf,"strokeCap"):(Sn(this),this.Na.Hr=a,this.N(),this.g("strokeCap",b,a)))}},strokeJoin:{get:function(){return null!==this.Na?this.Na.Ir:"miter"},set:function(a){var b=this.strokeJoin;b!==a&&("string"!==typeof a||"miter"!==a&&"bevel"!==a&&"round"!==a?xa(a,'"miter", "bevel", or "round"',
Bf,"strokeJoin"):(Sn(this),this.Na.Ir=a,this.N(),this.g("strokeJoin",b,a)))}},strokeMiterLimit:{get:function(){return null!==this.Na?this.Na.Jr:10},set:function(a){var b=this.strokeMiterLimit;if(b!==a&&1<=a){Sn(this);this.Na.Jr=a;this.N();var c=this.part;null!==c&&(c.ag=NaN);this.g("strokeMiterLimit",b,a)}}},strokeDashArray:{get:function(){return this.Yg},set:function(a){var b=this.Yg;if(b!==a){if(null!==a){for(var c=a.length,d=0,e=0;e