(function(){var r=!!document.createElement("canvas").getContext;var d=!!window.SVGAngle||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1");var a=!(r|d);var l=function(y,z,w,C){var B=function(E,D){if(E===D){return true}else{if(typeof E=="object"&&typeof D=="object"){var F=true;for(var v in E){if(!B(E[v],D[v])){F=false;break}}for(var v in D){if(!B(D[v],E[v])){F=false;break}}return F}}};for(var A=+w||0,x=y.length;A=0){delete (ax[ay]);ax.splice(ay,1);return true}}}return false},v=function(ay,ax){return I(ay,function(az,aA){ag[aA]=ax;if(i.CurrentLibrary.isDragSupported(az)){i.CurrentLibrary.setDraggable(az,ax)}})},ao=function(az,aA,ax){aA=aA==="block";var ay=null;if(ax){if(aA){ay=function(aC){aC.setVisible(true,true,true)}}else{ay=function(aC){aC.setVisible(false,true,true)}}}var aB=c(az,"id");U(aB,function(aD){if(aA&&ax){var aC=aD.sourceId===aB?1:0;if(aD.endpoints[aC].isVisible()){aD.setVisible(true)}}else{aD.setVisible(aA)}},ay)},N=function(ax){return I(ax,function(az,ay){var aA=ag[ay]==null?Y:ag[ay];aA=!aA;ag[ay]=aA;i.CurrentLibrary.setDraggable(az,aA);return aA})},x=function(ax,az){var ay=null;if(az){ay=function(aA){var aB=aA.isVisible();aA.setVisible(!aB)}}U(ax,function(aB){var aA=aB.isVisible();aB.setVisible(!aA)},ay)},E=function(aC){var aA=aC.timestamp,ax=aC.recalc,aB=aC.offset,ay=aC.elId;if(!ax){if(aA&&aA===C[ay]){return V[ay]}}if(ax||aB==null){var az=u(ay);if(az!=null){P[ay]=b(az);V[ay]=n(az);C[ay]=aA}}else{V[ay]=aB}return V[ay]},aw=function(ax,ay){var az=u(ax);var aA=c(az,"id");if(!aA||aA=="undefined"){if(arguments.length==2&&arguments[1]!=undefined){aA=ay}else{aA="jsPlumb_"+ar()}e(az,"id",aA)}return aA},am=function(az,ax,ay){az=az||function(){};ax=ax||function(){};return function(){var aA=null;try{aA=ax.apply(this,arguments)}catch(aB){k(D,"jsPlumb function failed : "+aB)}if(ay==null||(aA!==ay)){try{az.apply(this,arguments)}catch(aB){k(D,"wrapped function failed : "+aB)}}return aA}};this.connectorClass="_jsPlumb_connector";this.endpointClass="_jsPlumb_endpoint";this.overlayClass="_jsPlumb_overlay";this.Anchors={};this.Connectors={canvas:{},svg:{},vml:{}};this.Endpoints={canvas:{},svg:{},vml:{}};this.Overlays={canvas:{},svg:{},vml:{}};this.addEndpoint=function(az,aA,aJ){aJ=aJ||{};var ay=i.extend({},aJ);i.extend(ay,aA);ay.endpoint=ay.endpoint||D.Defaults.Endpoint||i.Defaults.Endpoint;ay.paintStyle=ay.paintStyle||D.Defaults.EndpointStyle||i.Defaults.EndpointStyle;az=w(az);var aB=[],aE=az.length&&az.constructor!=String?az:[az];for(var aC=0;aC0?l(aK,aJ)!=-1:true},aB=aE.length>1?{}:[],aH=function(aK,aL){if(aE.length>1){var aJ=aB[aK];if(aJ==null){aJ=[];aB[aK]=aJ}aJ.push(aL)}else{aB.push(aL)}};for(var aA in L){if(ay(aE,aA)){for(var az=0;az=4){ay.orientation=[arguments[2],arguments[3]]}if(arguments.length==6){ay.offsets=[arguments[4],arguments[5]]}}var aD=new ac(ay);aD.clone=function(){return new ac(ay)};return aD};this.makeAnchors=function(ay){var az=[];for(var ax=0;ax0?aG[0]:null,aC=aG.length>0?0:-1,aF=this,aB=function(aJ,aH,aN,aM,aI){var aL=aM[0]+(aJ.x*aI[0]),aK=aM[1]+(aJ.y*aI[1]);return Math.sqrt(Math.pow(aH-aL,2)+Math.pow(aN-aK,2))},ax=ay||function(aR,aI,aJ,aK,aH){var aM=aJ[0]+(aK[0]/2),aL=aJ[1]+(aK[1]/2);var aO=-1,aQ=Infinity;for(var aN=0;aN=0?aG.overlays[aS]:null};this.hideOverlay=function(aT){var aS=aG.getOverlay(aT);if(aS){aS.hide()}};this.showOverlay=function(aT){var aS=aG.getOverlay(aT);if(aS){aS.show()}};this.removeAllOverlays=function(){aG.overlays.splice(0,aG.overlays.length);aG.repaint()};this.removeOverlay=function(aT){var aS=aQ(aT);if(aS!=-1){aG.overlays.splice(aS,1)}};this.removeOverlays=function(){for(var aS=0;aSa6){a6=a8}}}var aZ=this.connector.compute(a1,aY,this.endpoints[a7].anchor,this.endpoints[a3].anchor,aG.paintStyleInUse.lineWidth,a6);aG.connector.paint(aZ,aG.paintStyleInUse);for(var aX=0;aX=0){aN.connections.splice(aZ,1);if(!a2){var a1=a0.endpoints[0]==aN?a0.endpoints[1]:a0.endpoints[0];a1.detach(a0,true);if(a0.endpointToDeleteOnDetach&&a0.endpointToDeleteOnDetach.connections.length==0){i.deleteEndpoint(a0.endpointToDeleteOnDetach)}}Q(a0.connector.getDisplayElements(),a0.parent);M(L,a0.scope,a0);if(!a2){ad(a0)}}};this.detachAll=function(){while(aN.connections.length>0){aN.detach(aN.connections[0])}};this.detachFrom=function(a0){var a1=[];for(var aZ=0;aZ=0){aN.connections.splice(aZ,1)}};this.getElement=function(){return aM};this.getUuid=function(){return aH};this.makeInPlaceCopy=function(){return an({anchor:aN.anchor,source:aM,paintStyle:this.paintStyle,endpoint:aL})};this.isConnectedTo=function(a1){var a0=false;if(a1){for(var aZ=0;aZ0){var a9=aK(a2.elementWithPrecedence);var bb=a9.endpoints[0]==aN?1:0;var a4=bb==0?a9.sourceId:a9.targetId;var a8=V[a4],ba=P[a4];a0.txy=[a8.left,a8.top];a0.twh=ba;a0.tElement=a9.endpoints[bb]}}a5=aN.anchor.compute(a0)}var a7=aL.compute(a5,aN.anchor.getOrientation(),aN.paintStyleInUse,a3||aN.paintStyleInUse);aL.paint(a7,aN.paintStyleInUse,aN.anchor);aN.timestamp=a6}};this.repaint=this.paint;this.removeConnection=this.detach;if(aY.isSource&&i.CurrentLibrary.isDragSupported(aM)){var aS=null,aO=null,aR=null,ax=false,aA=null;var aC=function(){aR=aN.connectorSelector();if(aN.isFull()&&!aI){return false}E({elId:aE});aB=aN.makeInPlaceCopy();aB.paint();aS=document.createElement("div");aS.style.position="absolute";var a6=u(aS);R(aS,aN.parent);var a0=aw(a6);var a7=u(aB.canvas),a5=i.CurrentLibrary.getOffset(a7),a2=aB.canvas.offsetParent!=null?aB.canvas.offsetParent.tagName.toLowerCase()==="body"?{left:0,top:0}:n(aB.canvas.offsetParent):{left:0,top:0};i.CurrentLibrary.setOffset(aS,{left:a5.left-a2.left,top:a5.top-a2.top});E({elId:a0});e(u(aN.canvas),"dragId",a0);e(u(aN.canvas),"elId",aE);var a8=new H({reference:aN.anchor,referenceCanvas:aN.canvas});aW=an({paintStyle:aN.paintStyle,endpoint:aL,anchor:a8,source:a6});if(aR==null){aN.anchor.locked=true;aR=au({sourceEndpoint:aN,targetEndpoint:aW,source:u(aM),target:u(aS),anchors:[aN.anchor,a8],paintStyle:aY.connectorStyle,hoverPaintStyle:aY.connectorHoverStyle,connector:aY.connector,overlays:aY.connectorOverlays});aR.connector.setHover(false)}else{ax=true;aR.connector.setHover(false);aD(u(aB.canvas));var a1=aR.sourceId==aE?0:1;aR.floatingAnchorIndex=a1;aN.detachFromConnection(aR);var a4=u(aN.canvas);var a3=i.CurrentLibrary.getDragScope(a4);e(a4,"originalScope",a3);var aZ=i.CurrentLibrary.getDropScope(a4);i.CurrentLibrary.setDragScope(a4,aZ);if(a1==0){aA=[aR.source,aR.sourceId,aV,a3];aR.source=u(aS);aR.sourceId=a0}else{aA=[aR.target,aR.targetId,aV,a3];aR.target=u(aS);aR.targetId=a0}aR.endpoints[a1==0?1:0].anchor.locked=true;aR.suspendedEndpoint=aR.endpoints[a1];aR.endpoints[a1]=aW}Z[a0]=aR;aW.addConnection(aR);S(ah,a0,aW);D.currentlyDragging=true};var ay=i.CurrentLibrary,aU=aY.dragOptions||{},aP=i.extend({},ay.defaultDragOptions),aQ=ay.dragEvents.start,aX=ay.dragEvents.stop,aG=ay.dragEvents.drag;aU=i.extend(aP,aU);aU.scope=aU.scope||aN.scope;aU[aQ]=am(aU[aQ],aC);aU[aG]=am(aU[aG],function(){var aZ=i.CurrentLibrary.getUIPosition(arguments);i.CurrentLibrary.setOffset(aS,aZ);at(u(aS),aZ)});aU[aX]=am(aU[aX],function(){M(ah,aO,aW);Q([aS,aW.canvas],aM);ae(aB.canvas,aM);var aZ=aR.floatingAnchorIndex==null?1:aR.floatingAnchorIndex;aR.endpoints[aZ==0?1:0].anchor.locked=false;if(aR.endpoints[aZ]==aW){if(ax&&aR.suspendedEndpoint){if(aZ==0){aR.source=aA[0];aR.sourceId=aA[1]}else{aR.target=aA[0];aR.targetId=aA[1]}i.CurrentLibrary.setDragScope(aA[2],aA[3]);aR.endpoints[aZ]=aR.suspendedEndpoint;if(aJ){aR.floatingAnchorIndex=null;aR.suspendedEndpoint.addConnection(aR);i.repaint(aA[1])}else{aR.endpoints[aZ==0?1:0].detach(aR)}}else{Q(aR.connector.getDisplayElements(),aN.parent);aN.detachFromConnection(aR)}}aN.anchor.locked=false;aN.paint();aR.setHover(false);aR.repaint();aR=null;delete aB;delete ah[aW.elementId];aW=null;delete aW;D.currentlyDragging=false});var aV=u(aN.canvas);i.CurrentLibrary.initDraggable(aV,aU)}var aD=function(a2){if(aY.isTarget&&i.CurrentLibrary.isDropSupported(aM)){var aZ=aY.dropOptions||D.Defaults.DropOptions||i.Defaults.DropOptions;aZ=i.extend({},aZ);aZ.scope=aZ.scope||aN.scope;var a5=null;var a3=i.CurrentLibrary.dragEvents.drop;var a4=i.CurrentLibrary.dragEvents.over;var a0=i.CurrentLibrary.dragEvents.out;var a1=function(){var be=u(i.CurrentLibrary.getDragObject(arguments));var a6=c(be,"dragId");var a8=c(be,"elId");var bd=c(be,"originalScope");if(bd){i.CurrentLibrary.setDragScope(be,bd)}var ba=Z[a6];var bb=ba.floatingAnchorIndex==null?1:ba.floatingAnchorIndex,bc=bb==0?1:0;if(!aN.isFull()&&!(bb==0&&!aN.isSource)&&!(bb==1&&!aN.isTarget)){if(bb==0){ba.source=aM;ba.sourceId=aE}else{ba.target=aM;ba.targetId=aE}ba.endpoints[bb].detachFromConnection(ba);if(ba.suspendedEndpoint){ba.suspendedEndpoint.detachFromConnection(ba)}ba.endpoints[bb]=aN;aN.addConnection(ba);if(!ba.suspendedEndpoint){S(L,ba.scope,ba);O(aM,aY.draggable,{})}else{var a9=ba.suspendedEndpoint.getElement(),a7=ba.suspendedEndpoint.elementId;D.fire("jsPlumbConnectionDetached",{source:bb==0?a9:ba.source,target:bb==1?a9:ba.target,sourceId:bb==0?a7:ba.sourceId,targetId:bb==1?a7:ba.targetId,sourceEndpoint:bb==0?ba.suspendedEndpoint:ba.endpoints[0],targetEndpoint:bb==1?ba.suspendedEndpoint:ba.endpoints[1],connection:ba})}i.repaint(a8);D.fire("jsPlumbConnection",{source:ba.source,target:ba.target,sourceId:ba.sourceId,targetId:ba.targetId,sourceEndpoint:ba.endpoints[0],targetEndpoint:ba.endpoints[1],connection:ba})}D.currentlyDragging=false;delete Z[a6]};aZ[a3]=am(aZ[a3],a1);aZ[a4]=am(aZ[a4],function(){var a7=i.CurrentLibrary.getDragObject(arguments);var a9=c(u(a7),"dragId");var a8=Z[a9];if(a8!=null){var a6=a8.floatingAnchorIndex==null?1:a8.floatingAnchorIndex;a8.endpoints[a6].anchor.over(aN.anchor)}});aZ[a0]=am(aZ[a0],function(){var a7=i.CurrentLibrary.getDragObject(arguments),a9=c(u(a7),"dragId"),a8=Z[a9];if(a8!=null){var a6=a8.floatingAnchorIndex==null?1:a8.floatingAnchorIndex;a8.endpoints[a6].anchor.out()}});i.CurrentLibrary.initDroppable(a2,aZ)}};aD(u(aN.canvas));return aN}};var i=window.jsPlumb=new q();i.getInstance=function(w){var v=new q(w);v.init();return v};var m=function(v,A,z,w){return function(){return i.makeAnchor(v,A,z,w)}};i.Anchors.TopCenter=m(0.5,0,0,-1);i.Anchors.BottomCenter=m(0.5,1,0,1);i.Anchors.LeftMiddle=m(0,0.5,-1,0);i.Anchors.RightMiddle=m(1,0.5,1,0);i.Anchors.Center=m(0.5,0.5,0,0);i.Anchors.TopRight=m(1,0,0,-1);i.Anchors.BottomRight=m(1,1,0,1);i.Anchors.TopLeft=m(0,0,0,-1);i.Anchors.BottomLeft=m(0,1,0,1);i.Defaults.DynamicAnchors=function(){return i.makeAnchors(["TopCenter","RightMiddle","BottomCenter","LeftMiddle"])};i.Anchors.AutoDefault=function(){return i.makeDynamicAnchor(i.Defaults.DynamicAnchors())}})();(function(){jsPlumb.DOMElementComponent=function(b){jsPlumb.jsPlumbUIComponent.apply(this,arguments);this.mousemove=this.dblclick=this.click=this.mousedown=this.mouseup=function(c){}};jsPlumb.Connectors.Straight=function(){this.type="Straight";var o=this;var h=null;var d,i,m,l,k,e,n,g,f,c,b;this.compute=function(s,G,C,p,z,r){var F=Math.abs(s[0]-G[0]);var v=Math.abs(s[1]-G[1]);var A=false,t=false;var u=0.45*F,q=0.45*v;F*=1.9;v*=1.9;var D=Math.min(s[0],G[0])-u;var B=Math.min(s[1],G[1])-q;var E=Math.max(2*z,r);if(F0?1:-1;var u=Math.abs(v*Math.sin(e));if(f>b){u=u*-1}var q=Math.abs(v*Math.cos(e));if(g>c){q=q*-1}return{x:t.x+(s*q),y:t.y+(s*u)}};this.perpendicularToPathAt=function(t,u,z){var v=o.pointAlongPathFrom(t,z);var s=o.gradientAtPoint(v.location);var r=Math.atan(-1/s);var w=u/2*Math.sin(r);var q=u/2*Math.cos(r);return[{x:v.x+q,y:v.y+w},{x:v.x-q,y:v.y-w}]}};jsPlumb.Connectors.Bezier=function(f){var p=this;f=f||{};this.majorAnchor=f.curviness||150;this.minorAnchor=10;var i=null;this.type="Bezier";this._findControlPoint=function(z,q,u,x,r){var w=x.getOrientation(),y=r.getOrientation();var t=w[0]!=y[0]||w[1]==y[1];var s=[];var A=p.majorAnchor,v=p.minorAnchor;if(!t){if(w[0]==0){s.push(q[0]m){m=v}if(y<0){e+=y;var z=Math.abs(y);m+=z;o[0]+=z;k+=z;c+=z;n[0]+=z}var H=Math.min(g,b);var F=Math.min(o[1],n[1]);var u=Math.min(H,F);var A=Math.max(g,b);var x=Math.max(o[1],n[1]);var s=Math.max(A,x);if(s>h){h=s}if(u<0){d+=u;var w=Math.abs(u);h+=w;o[1]+=w;g+=w;b+=w;n[1]+=w}if(E&&m=t){r=u;s=(t-m[u][0])/b[u];break}}return{segment:k[r],proportion:s,index:r}};this.compute=function(R,z,Q,s,r,I){k=[];i=[];b=[];h=[];segmentProportionals=[];e=z[0]u[0]?u[0]+((1-y)*t)-z:u[2]+(y*t)+z,y:r==0?u[3]:u[3]>u[1]?u[1]+((1-y)*t)-z:u[3]+(y*t)+z,segmentInfo:w};return x};this.perpendicularToPathAt=function(u,v,A){var w=o.pointAlongPathFrom(u,A);var t=i[w.segmentInfo.index];var s=Math.atan(-1/t);var z=v/2*Math.sin(s);var r=v/2*Math.cos(s);return[{x:w.x+r,y:w.y+z},{x:w.x-r,y:w.y-z}]}};jsPlumb.Endpoints.Dot=function(c){this.type="Dot";var b=this;c=c||{};this.radius=c.radius||10;this.defaultOffset=0.5*this.radius;this.defaultInnerRadius=this.radius/3;this.compute=function(h,e,k,g){var f=k.radius||b.radius;var d=h[0]-f;var i=h[1]-f;return[d,i,f*2,f*2,f]}};jsPlumb.Endpoints.Rectangle=function(c){this.type="Rectangle";var b=this;c=c||{};this.width=c.width||20;this.height=c.height||20;this.compute=function(i,f,l,h){var g=l.width||b.width;var e=l.height||b.height;var d=i[0]-(g/2);var k=i[1]-(e/2);return[d,k,g,e]}};jsPlumb.Endpoints.Image=function(e){this.type="Image";jsPlumb.DOMElementComponent.apply(this,arguments);var b=this,d=false;this.img=new Image();b.ready=false;this.img.onload=function(){b.ready=true};this.img.src=e.src||e.url;this.compute=function(h,f,i,g){b.anchorPoint=h;if(b.ready){return[h[0]-b.img.width/2,h[1]-b.img.height/2,b.img.width,b.img.height]}else{return[0,0,0,0]}};b.canvas=document.createElement("img"),d=false;b.canvas.style.margin=0;b.canvas.style.padding=0;b.canvas.style.outline=0;b.canvas.style.position="absolute";b.canvas.className=jsPlumb.endpointClass;jsPlumb.appendElement(b.canvas,e.parent);b.attachListeners(b.canvas,b);var c=function(l,k,h){if(!d){b.canvas.setAttribute("src",b.img.src);d=true}var i=b.img.width,g=b.img.height,f=b.anchorPoint[0]-(i/2),m=b.anchorPoint[1]-(g/2);jsPlumb.sizeCanvas(b.canvas,f,m,i,g)};this.paint=function(h,g,f){if(b.ready){c(h,g,f)}else{window.setTimeout(function(){b.paint(h,g,f)},200)}}};jsPlumb.Endpoints.Blank=function(c){var b=this;this.type="Blank";jsPlumb.DOMElementComponent.apply(this,arguments);this.compute=function(){return[0,0,10,0]};b.canvas=document.createElement("div");b.canvas.style.display="block";b.canvas.style.width="1px";b.canvas.style.height="1px";b.canvas.style.background="transparent";b.canvas.style.position="absolute";jsPlumb.appendElement(b.canvas,c.parent);this.paint=function(){}};jsPlumb.Endpoints.Triangle=function(b){this.type="Triangle";b=b||{};b.width=b.width||55;param.height=b.height||55;this.width=b.width;this.height=b.height;this.compute=function(h,e,k,g){var f=k.width||self.width;var d=k.height||self.height;var c=h[0]-(f/2);var i=h[1]-(d/2);return[c,i,f,d]}};var a=function(){var c=true,b=this;this.setVisible=function(d){c=d;b.connection.repaint()};this.isVisible=function(){return c};this.hide=function(){b.setVisible(false)};this.show=function(){b.setVisible(true)}};jsPlumb.Overlays.Arrow=function(g){this.type="Arrow";a.apply(this);g=g||{};var c=this;this.length=g.length||20;this.width=g.width||20;this.id=g.id;this.connection=g.connection;var f=(g.direction||1)<0?-1:1;var d=g.paintStyle||{lineWidth:1};this.loc=g.location==null?0.5:g.location;var b=g.foldback||0.623;var e=function(h,k){if(b==0.5){return h.pointOnPath(k)}else{var i=0.5-b;return h.pointAlongPathFrom(k,f*c.length*i)}};this.computeMaxSize=function(){return c.width*1.5};this.draw=function(l,r,x){var z=l.pointAlongPathFrom(c.loc,f*(c.length/2));var u=l.pointAlongPathFrom(c.loc,-1*f*(c.length/2)),C=u.x,B=u.y;var s=l.perpendicularToPathAt(c.loc,c.width,-1*f*(c.length/2));var k=e(l,c.loc);if(c.loc==1){var i=l.pointOnPath(c.loc);var w=(i.x-z.x)*f,v=(i.y-z.y)*f;k.x+=w;k.y+=v;u.x+=w;u.y+=v;s[0].x+=w;s[0].y+=v;s[1].x+=w;s[1].y+=v;z.x+=w;z.y+=v}if(c.loc==0){var i=l.pointOnPath(c.loc);var t=b>1?k:{x:s[0].x+((s[1].x-s[0].x)/2),y:s[0].y+((s[1].y-s[0].y)/2)};var w=(i.x-t.x)*f,v=(i.y-t.y)*f;k.x+=w;k.y+=v;u.x+=w;u.y+=v;s[0].x+=w;s[0].y+=v;s[1].x+=w;s[1].y+=v;z.x+=w;z.y+=v}var p=Math.min(z.x,s[0].x,s[1].x);var o=Math.max(z.x,s[0].x,s[1].x);var n=Math.min(z.y,s[0].y,s[1].y);var m=Math.max(z.y,s[0].y,s[1].y);var A={hxy:z,tail:s,cxy:k},y=d.strokeStyle||r.strokeStyle,q=d.fillStyle||r.strokeStyle,h=d.lineWidth||r.lineWidth;c.paint(l,A,h,y,q,x);return[p,o,n,m]}};jsPlumb.Overlays.PlainArrow=function(c){c=c||{};var b=jsPlumb.extend(c,{foldback:1});jsPlumb.Overlays.Arrow.call(this,b);this.type="PlainArrow"};jsPlumb.Overlays.Diamond=function(d){d=d||{};var b=d.length||40;var c=jsPlumb.extend(d,{length:b/2,foldback:2});jsPlumb.Overlays.Arrow.call(this,c);this.type="Diamond"};jsPlumb.Overlays.Label=function(e){this.type="Label";jsPlumb.DOMElementComponent.apply(this,arguments);a.apply(this);this.labelStyle=e.labelStyle||jsPlumb.Defaults.LabelStyle;this.labelStyle.font=this.labelStyle.font||"12px sans-serif";this.label=e.label||"banana";this.connection=e.connection;this.id=e.id;var l=this;var i=null,f=null,d=null,c=null;this.location=e.location||0.5;this.cachedDimensions=null;var k=false,d=null,b=document.createElement("div");b.style.position="absolute";b.style.font=l.labelStyle.font;b.style.color=l.labelStyle.color||"black";if(l.labelStyle.fillStyle){b.style.background=l.labelStyle.fillStyle}if(l.labelStyle.borderWidth>0){var h=l.labelStyle.borderStyle?l.labelStyle.borderStyle:"black";b.style.border=l.labelStyle.borderWidth+"px solid "+h}if(l.labelStyle.padding){b.style.padding=l.labelStyle.padding}var g=e._jsPlumb.overlayClass+" "+(l.labelStyle.cssClass?l.labelStyle.cssClass:e.cssClass?e.cssClass:"");b.className=g;jsPlumb.appendElement(b,e.connection.parent);jsPlumb.getId(b);l.attachListeners(b,l);var m=l.setVisible;l.setVisible=function(n){m(n);b.style.display=n?"block":"none"};this.paint=function(n,p,o){if(!k){n.appendDisplayElement(b);l.attachListeners(b,n);k=true}b.style.left=(o[0]+p.minx)+"px";b.style.top=(o[1]+p.miny)+"px"};this.getTextDimensions=function(n){d=typeof l.label=="function"?l.label(l):l.label;b.innerHTML=d.replace(/\r\n/g,"
");var p=jsPlumb.CurrentLibrary.getElementObject(b),o=jsPlumb.CurrentLibrary.getSize(p);return{width:o[0],height:o[1]}};this.computeMaxSize=function(n){var o=l.getTextDimensions(n);return o.width?Math.max(o.width,o.height)*1.5:0};this.draw=function(p,r,q){var t=l.getTextDimensions(p);if(t.width!=null){var s=p.pointOnPath(l.location);var o=s.x-(t.width/2);var n=s.y-(t.height/2);l.paint(p,{minx:o,miny:n,td:t,cxy:s},q);return[o,o+t.width,n,n+t.height]}else{return[0,0,0,0]}}}})();(function(){var h={"stroke-linejoin":"joinstyle",joinstyle:"joinstyle",endcap:"endcap",miterlimit:"miterlimit"};if(document.createStyleSheet){document.createStyleSheet().addRule(".jsplumb_vml","behavior:url(#default#VML);position:absolute;");document.createStyleSheet().addRule("jsplumb\\:textbox","behavior:url(#default#VML);position:absolute;");document.createStyleSheet().addRule("jsplumb\\:oval","behavior:url(#default#VML);position:absolute;");document.createStyleSheet().addRule("jsplumb\\:rect","behavior:url(#default#VML);position:absolute;");document.createStyleSheet().addRule("jsplumb\\:stroke","behavior:url(#default#VML);position:absolute;");document.createStyleSheet().addRule("jsplumb\\:shape","behavior:url(#default#VML);position:absolute;");document.namespaces.add("jsplumb","urn:schemas-microsoft-com:vml")}var c=1000,d=function(p,q){for(var n in q){p[n]=q[n]}},m=function(n,q,r){r=r||{};var p=document.createElement("jsplumb:"+n);p.className=(r["class"]?r["class"]+" ":"")+"jsplumb_vml";l(p,q);d(p,r);return p},l=function(p,n){p.style.left=n[0]+"px";p.style.top=n[1]+"px";p.style.width=n[2]+"px";p.style.height=n[3]+"px";p.style.position="absolute"},g=function(n){return Math.floor(n*c)},a=function(p,n){var v=p,u=function(o){return o.length==1?"0"+o:o},q=function(o){return u(Number(o).toString(16))},r=/(rgb[a]?\()(.*)(\))/;if(p.match(r)){var t=p.match(r)[2].split(",");v="#"+q(t[0])+q(t[1])+q(t[2]);if(!n&&t.length==4){v=v+q(t[3])}}return v},f=function(s,r,p){var u={};if(r.strokeStyle){u.stroked="true";u.strokecolor=a(r.strokeStyle,true);u.strokeweight=r.lineWidth+"px"}else{u.stroked="false"}if(r.fillStyle){u.filled="true";u.fillcolor=a(r.fillStyle,true)}else{u.filled="false"}if(r.dashstyle){if(p.strokeNode==null){p.strokeNode=m("stroke",[0,0,0,0],{dashstyle:r.dashstyle});s.appendChild(p.strokeNode)}else{p.strokeNode.dashstyle=r.dashstyle}}else{if(r["stroke-dasharray"]&&r.lineWidth){var o=r["stroke-dasharray"].indexOf(",")==-1?" ":",",t=r["stroke-dasharray"].split(o),n="";for(var q=0;q0&&F>0&&z=z&&B[2]<=F&&B[3]>=F)){return true}}var D=v.canvas.getContext("2d").getImageData(parseInt(z),parseInt(F),1,1);return D.data[0]!=0||D.data[1]!=0||D.data[2]!=0||D.data[3]!=0}return false};var u=false;var t=false,y=null,x=false;var w=function(A,z){return A!=null&&f(A,z)};this.mousemove=function(C){var E=e(C),B=i(C),A=document.elementFromPoint(B[0],B[1]),D=w(A,"_jsPlumb_overlay");var z=o==null&&(w(A,"_jsPlumb_endpoint")||w(A,"_jsPlumb_connector"));if(!u&&z&&v._over(C)){u=true;v.fire("mouseenter",v,C);return true}else{if(u&&(!v._over(C)||!z)&&!D){u=false;v.fire("mouseexit",v,C)}}v.fire("mousemove",v,C)};this.click=function(z){if(u&&v._over(z)&&!x){v.fire("click",v,z)}x=false};this.dblclick=function(z){if(u&&v._over(z)&&!x){v.fire("dblclick",v,z)}x=false};this.mousedown=function(z){if(v._over(z)&&!t){t=true;y=m(s(v.canvas));v.fire("mousedown",v,z)}};this.mouseup=function(z){t=false;v.fire("mouseup",v,z)}};var p=function(u){var t=document.createElement("canvas");jsPlumb.appendElement(t,u.parent);t.style.position="absolute";if(u["class"]){t.className=u["class"]}u._jsPlumb.getId(t,u.uuid);return t};var d=jsPlumb.CanvasConnector=function(x){n.apply(this,arguments);var t=function(B,z){u.ctx.save();jsPlumb.extend(u.ctx,z);if(z.gradient){var A=u.createGradient(B,u.ctx);for(var y=0;y0?1:-1}}var b={subtract:function(m,l){return{x:m.x-l.x,y:m.y-l.y}},dotProduct:function(m,l){return m.x*l.x+m.y*l.y},square:function(l){return Math.sqrt(l.x*l.x+l.y*l.y)},scale:function(m,l){return{x:m.x*l,y:m.y*l}}},d=Math.pow(2,-65),h=function(y,x){for(var s=[],v=x.length-1,r=2*v-1,t=[],w=[],o=[],p=[],q=[[1,0.6,0.3,0.1],[0.4,0.6,0.6,0.4],[0.1,0.3,0.6,1]],u=0;u<=v;u++){t[u]=b.subtract(x[u],y)}for(u=0;u<=v-1;u++){w[u]=b.subtract(x[u+1],x[u]);w[u]=b.scale(w[u],3)}for(u=0;u<=v-1;u++){for(var n=0;n<=v;n++){o[u]||(o[u]=[]);o[u][n]=b.dotProduct(w[u],t[n])}}for(u=0;u<=r;u++){p[u]||(p[u]=[]);p[u].y=0;p[u].x=parseFloat(u)/r}r=v-1;for(t=0;t<=v+r;t++){w=Math.min(t,v);for(u=Math.max(0,t-r);u<=w;u++){j=t-u;p[u+j].y+=o[j][u]*q[j][u]}}v=x.length-1;p=k(p,2*v-1,s,0);r=b.subtract(y,x[0]);o=b.square(r);for(u=q=0;u=64){y[0]=(E[0].x+E[D].x)/2;return 1}var s,r,p;v=E[0].y-E[D].y;w=E[D].x-E[0].x;A=E[0].x*E[D].y-E[D].x*E[0].y;t=max_distance_below=0;for(r=1;rt){t=p}else{if(p0?1:-1,r=null;n