(function(){var w=!!document.createElement("canvas").getContext,e=!!window.SVGAngle||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1"),b=!(w|e);var i=function(E,G){if(E){for(var F=0;F-1){F.splice(E,1)}return E!=-1},m=function(F,G){var E=D(F,G);if(E>-1){F.splice(E,1)}return E!=-1},r=function(G,F,E){if(i(G,E)==-1){G.push(F)}},l=function(H,F,G){var E=H[F];if(E==null){E=[],H[F]=E}E.push(G);return E};if(!window.console){window.console={time:function(){},timeEnd:function(){},group:function(){},groupEnd:function(){},log:function(){}}}var u=null,d=function(E,F){return o.CurrentLibrary.getAttribute(A(E),F)},f=function(F,G,E){o.CurrentLibrary.setAttribute(A(F),G,E)},x=function(F,E){o.CurrentLibrary.addClass(A(F),E)},k=function(F,E){return o.CurrentLibrary.hasClass(A(F),E)},n=function(F,E){o.CurrentLibrary.removeClass(A(F),E)},A=function(E){return o.CurrentLibrary.getElementObject(E)},s=function(E){return o.CurrentLibrary.getOffset(A(E))},a=function(E){return o.CurrentLibrary.getSize(A(E))},z=true,p=function(){if(z&&typeof console!="undefined"){try{var F=arguments[arguments.length-1];console.log(F)}catch(E){}}},C=function(E){if(z&&typeof console!="undefined"){console.group(E)}},h=function(E){if(z&&typeof console!="undefined"){console.groupEnd(E)}},B=function(E){if(z&&typeof console!="undefined"){console.time(E)}},t=function(E){if(z&&typeof console!="undefined"){console.timeEnd(E)}};EventGenerator=function(){var G={},F=this;var E=["ready"];this.bind=function(H,I){l(G,H,I)};this.fire=function(J,K,H){if(G[J]){for(var I=0;I1){for(var U=0;U=0?O.overlays[P]:null};this.getOverlays=function(){return O.overlays};this.hideOverlay=function(Q){var P=O.getOverlay(Q);if(P){P.hide()}};this.hideOverlays=function(){for(var P=0;P0){try{for(var bl=0;bl0?D(by,bx)!=-1:true},bp=(!bl&&bs.length>1)?{}:[],bv=function(by,bz){if(!bl&&bs.length>1){var bx=bp[by];if(bx==null){bx=[];bp[by]=bx}bx.push(bz)}else{bp.push(bz)}};for(var bo in aN){if(bm(bs,bo)){for(var bn=0;bn=4)?[bp[2],bp[3]]:[0,0],offsets:(bp.length==6)?[bp[4],bp[5]]:[0,0],elementId:bm};bn=new T(bo);bn.clone=function(){return new T(bo)}}}}}if(!bn.id){bn.id="anchor_"+ab()}return bn};this.makeAnchors=function(bn,bl,bk){var bo=[];for(var bm=0;bm0?bu[0]:null,bp=bu.length>0?0:-1,bt=this,bo=function(bx,bv,bB,bA,bw){var bz=bA[0]+(bx.x*bw[0]),by=bA[1]+(bx.y*bw[1]);return Math.sqrt(Math.pow(bv-bz,2)+Math.pow(bB-by,2))},bk=bl||function(bF,bw,bx,by,bv){var bA=bx[0]+(by[0]/2),bz=bx[1]+(by[1]/2);var bC=-1,bE=Infinity;for(var bB=0;bB=bn.left)||(bq.left<=bn.right&&bq.right>=bn.right)||(bq.left<=bn.left&&bq.right>=bn.right)||(bn.left<=bq.left&&bn.right>=bq.right)),bv=((bq.top<=bn.top&&bq.bottom>=bn.top)||(bq.top<=bn.bottom&&bq.bottom>=bn.bottom)||(bq.top<=bn.top&&bq.bottom>=bn.bottom)||(bn.top<=bq.top&&bn.bottom>=bq.bottom));if(!(bp||bv)){var bs=null,bm=false,bk=false,br=null;if(bn.left>bq.left&&bn.top>bq.top){bs=["right","top"]}else{if(bn.left>bq.left&&bq.top>bn.top){bs=["top","left"]}else{if(bn.leftbq.top){bs=["left","top"]}}}}return{orientation:M.DIAGONAL,a:bs,theta:bl,theta2:bo}}else{if(bp){return{orientation:M.HORIZONTAL,a:bq.topbk[0]?1:-1},S=function(bk){return function(bm,bl){var bn=true;if(bk){if(bm[0][0]bl[0][1]}}else{if(bm[0][0]>bl[0][0]){bn=true}else{bn=bm[0][1]>bl[0][1]}}return bn===false?-1:1}},H=function(bl,bk){var bn=bl[0][0]<0?-Math.PI-bl[0][0]:Math.PI-bl[0][0],bm=bk[0][0]<0?-Math.PI-bk[0][0]:Math.PI-bk[0][0];if(bn>bm){return 1}else{return bl[0][1]>bk[0][1]?1:-1}},aP={top:aX,right:S(true),bottom:S(true),left:H},af=function(bk,bl){return bk.sort(bl)},ac=function(bl,bk){var bn=W[bl],bo=Z[bl],bm=function(bv,bC,br,bu,bA,bz,bq){if(bu.length>0){var by=af(bu,aP[bv]),bw=bv==="right"||bv==="top",bp=aR(bv,bC,br,by,bA,bz,bw);var bD=function(bG,bF){var bE=bd([bF[0],bF[1]],bG.canvas);aa[bG.id]=[bE[0],bE[1],bF[2],bF[3]];az[bG.id]=bq};for(var bs=0;bs0){var bt=o.CurrentLibrary.getOffset(bu);bl[br][bw]={id:bw,offset:{left:bt.left-bx.left,top:bt.top-bx.top}}}}}};bq(bo)};this.endpointAdded=function(bq){var bu=o.CurrentLibrary,bx=document.body,bo=bc.getId(bq),bw=bu.getDOMElement(bq),bp=bw.parentNode,bs=bp==bx;bk[bo]=bk[bo]?bk[bo]+1:1;while(bp!=bx){var bt=bc.getId(bp);if(bn[bt]){var bz=-1,bv=bu.getElementObject(bp),br=o.CurrentLibrary.getOffset(bv);if(bl[bt][bo]==null){var by=o.CurrentLibrary.getOffset(bq);bl[bt][bo]={id:bo,offset:{left:by.left-br.left,top:by.top-br.top}}}break}bp=bp.parentNode}};this.endpointDeleted=function(bp){if(bk[bp.elementId]){bk[bp.elementId]--;if(bk[bp.elementId]<=0){for(var bo in bl){delete bl[bo][bp.elementId]}}}};this.getElementsForDraggable=function(bo){return bl[bo]};this.reset=function(){bn={};bm=[];bl={};bk={}}};bc.dragManager=new aK();var am=function(bC){var bv=this,bm=true;bv.idPrefix="_jsplumb_c_";bv.defaultLabelLocation=0.5;bv.defaultOverlayKeys=["Overlays","ConnectionOverlays"];this.parent=bC.parent;overlayCapableJsPlumbUIComponent.apply(this,arguments);this.isVisible=function(){return bm};this.setVisible=function(bE){bm=bE;bv[bE?"showOverlays":"hideOverlays"]();if(bv.connector&&bv.connector.canvas){bv.connector.canvas.style.display=bE?"block":"none"}};this.source=A(bC.source);this.target=A(bC.target);if(bC.sourceEndpoint){this.source=bC.sourceEndpoint.endpointWillMoveTo||bC.sourceEndpoint.getElement()}if(bC.targetEndpoint){this.target=bC.targetEndpoint.getElement()}bv.previousConnection=bC.previousConnection;var bs=bC.cost;bv.getCost=function(){return bs};bv.setCost=function(bE){bs=bE};var bq=bC.bidirectional===false?false:true;bv.isBidirectional=function(){return bq};this.sourceId=d(this.source,"id");this.targetId=d(this.target,"id");this.getAttachedElements=function(){return bv.endpoints};this.scope=bC.scope;this.endpoints=[];this.endpointStyles=[];var bB=function(bF,bE){if(bF){return bc.makeAnchor(bF,bE,bc)}},bz=function(bE,bK,bF,bH,bI,bG,bJ){if(bE){bv.endpoints[bK]=bE;bE.addConnection(bv)}else{if(!bF.endpoints){bF.endpoints=[null,null]}var bQ=bF.endpoints[bK]||bF.endpoint||bc.Defaults.Endpoints[bK]||o.Defaults.Endpoints[bK]||bc.Defaults.Endpoint||o.Defaults.Endpoint;if(!bF.endpointStyles){bF.endpointStyles=[null,null]}if(!bF.endpointHoverStyles){bF.endpointHoverStyles=[null,null]}var bO=bF.endpointStyles[bK]||bF.endpointStyle||bc.Defaults.EndpointStyles[bK]||o.Defaults.EndpointStyles[bK]||bc.Defaults.EndpointStyle||o.Defaults.EndpointStyle;if(bO.fillStyle==null&&bG!=null){bO.fillStyle=bG.strokeStyle}if(bO.outlineColor==null&&bG!=null){bO.outlineColor=bG.outlineColor}if(bO.outlineWidth==null&&bG!=null){bO.outlineWidth=bG.outlineWidth}var bN=bF.endpointHoverStyles[bK]||bF.endpointHoverStyle||bc.Defaults.EndpointHoverStyles[bK]||o.Defaults.EndpointHoverStyles[bK]||bc.Defaults.EndpointHoverStyle||o.Defaults.EndpointHoverStyle;if(bJ!=null){if(bN==null){bN={}}if(bN.fillStyle==null){bN.fillStyle=bJ.strokeStyle}}var bM=bF.anchors?bF.anchors[bK]:bF.anchor?bF.anchor:bB(bc.Defaults.Anchors[bK],bI)||bB(o.Defaults.Anchors[bK],bI)||bB(bc.Defaults.Anchor,bI)||bB(o.Defaults.Anchor,bI),bP=bF.uuids?bF.uuids[bK]:null,bL=av({paintStyle:bO,hoverPaintStyle:bN,endpoint:bQ,connections:[bv],uuid:bP,anchor:bM,source:bH,scope:bF.scope,container:bF.container,reattach:bF.reattach,detachable:bF.detachable});bv.endpoints[bK]=bL;if(bF.drawEndpoints===false){bL.setVisible(false,true,true)}return bL}};var bx=bz(bC.sourceEndpoint,0,bC,bv.source,bv.sourceId,bC.paintStyle,bC.hoverPaintStyle);if(bx){O(aI,this.sourceId,bx)}var bn=((bv.sourceId==bv.targetId)&&bC.targetEndpoint==null)?bx:bC.targetEndpoint,bw=bz(bn,1,bC,bv.target,bv.targetId,bC.paintStyle,bC.hoverPaintStyle);if(bw){O(aI,this.targetId,bw)}if(!this.scope){this.scope=this.endpoints[0].scope}if(bC.deleteEndpointsOnDetach){bv.endpointsToDeleteOnDetach=[bx,bw]}var bl=bc.Defaults.ConnectionsDetachable;if(bC.detachable===false){bl=false}if(bv.endpoints[0].connectionsDetachable===false){bl=false}if(bv.endpoints[1].connectionsDetachable===false){bl=false}if(bs==null){bs=bv.endpoints[0].getConnectionCost()}if(bC.bidirectional==null){bq=bv.endpoints[0].areConnectionsBidirectional()}this.isDetachable=function(){return bl===true};this.setDetachable=function(bE){bl=bE===true};var bD=o.extend({},this.endpoints[0].getParameters());o.extend(bD,this.endpoints[1].getParameters());o.extend(bD,bv.getParameters());bv.setParameters(bD);var bt=bv.setHover;bv.setHover=function(){bv.connector.setHover.apply(bv.connector,arguments);bt.apply(bv,arguments)};var bA=function(bE){if(u==null){bv.setHover(bE,false)}};this.setConnector=function(bE,bF){if(bv.connector!=null){aM(bv.connector.getDisplayElements(),bv.parent)}var bG={_jsPlumb:bv._jsPlumb,parent:bC.parent,cssClass:bC.cssClass,container:bC.container,tooltip:bv.tooltip};if(bE.constructor==String){this.connector=new o.Connectors[Q][bE](bG)}else{if(bE.constructor==Array){this.connector=new o.Connectors[Q][bE[0]](o.extend(bE[1],bG))}}bv.canvas=bv.connector.canvas;_bindListeners(bv.connector,bv,bA);if(!bF){bv.repaint()}};bv.setConnector(this.endpoints[0].connector||this.endpoints[1].connector||bC.connector||bc.Defaults.Connector||o.Defaults.Connector,true);this.setPaintStyle(this.endpoints[0].connectorStyle||this.endpoints[1].connectorStyle||bC.paintStyle||bc.Defaults.PaintStyle||o.Defaults.PaintStyle,true);this.setHoverPaintStyle(this.endpoints[0].connectorHoverStyle||this.endpoints[1].connectorHoverStyle||bC.hoverPaintStyle||bc.Defaults.HoverPaintStyle||o.Defaults.HoverPaintStyle,true);this.paintStyleInUse=this.paintStyle;this.moveParent=function(bH){var bG=o.CurrentLibrary,bF=bG.getParent(bv.connector.canvas);bG.removeElement(bv.connector.canvas,bF);bG.appendElement(bv.connector.canvas,bH);if(bv.connector.bgCanvas){bG.removeElement(bv.connector.bgCanvas,bF);bG.appendElement(bv.connector.bgCanvas,bH)}for(var bE=0;bE0){bE.connections[0].setHover(bR,false)}else{bE.setHover(bR)}};_bindListeners(bE.endpoint,bE,bQ);this.setPaintStyle(bP.paintStyle||bP.style||bc.Defaults.EndpointStyle||o.Defaults.EndpointStyle,true);this.setHoverPaintStyle(bP.hoverPaintStyle||bc.Defaults.EndpointHoverStyle||o.Defaults.EndpointHoverStyle,true);this.paintStyleInUse=this.paintStyle;this.connectorStyle=bP.connectorStyle;this.connectorHoverStyle=bP.connectorHoverStyle;this.connectorOverlays=bP.connectorOverlays;this.connector=bP.connector;this.connectorTooltip=bP.connectorTooltip;this.isSource=bP.isSource||false;this.isTarget=bP.isTarget||false;var bJ=bP.maxConnections||bc.Defaults.MaxConnections;this.getAttachedElements=function(){return bE.connections};this.canvas=this.endpoint.canvas;this.connections=bP.connections||[];this.scope=bP.scope||J;this.timestamp=null;bE.isReattach=bP.reattach||false;bE.connectionsDetachable=bc.Defaults.ConnectionsDetachable;if(bP.connectionsDetachable===false||bP.detachable===false){bE.connectionsDetachable=false}var bz=bP.dragAllowedWhenFull||true;this.computeAnchor=function(bR){return bE.anchor.compute(bR)};this.addConnection=function(bR){bE.connections.push(bR)};this.detach=function(bS,bX,bT,b0,bR){var bZ=i(bE.connections,function(b2){return b2.id==bS.id}),bY=false;b0=(b0!==false);if(bZ>=0){if(bT||bS._forceDetach||bS.isDetachable()||bS.isDetachAllowed(bS)){var b1=bS.endpoints[0]==bE?bS.endpoints[1]:bS.endpoints[0];if(bT||bS._forceDetach||(bE.isDetachAllowed(bS))){bE.connections.splice(bZ,1);if(!bX){b1.detach(bS,true,bT);if(bS.endpointsToDeleteOnDetach){for(var bW=0;bW0){bE.detach(bE.connections[0],false,true,bS,bR)}};this.detachFrom=function(bU,bT,bR){var bV=[];for(var bS=0;bS=0){bE.connections.splice(bR,1)}};this.getElement=function(){return bD};this.setElement=function(bT){var bV=E(bT);y(aI[bu],function(bW){return bW.id==bE.id});bD=A(bT);bu=E(bD);bE.elementId=bu;var bU=al({source:bV}),bS=bo.getParent(bE.canvas);bo.removeElement(bE.canvas,bS);bo.appendElement(bE.canvas,bU);for(var bR=0;bR0){var b3=bA(bU.elementWithPrecedence),b5=b3.endpoints[0]==bE?1:0,bW=b5==0?b3.sourceId:b3.targetId,b2=Z[bW],b4=W[bW];bT.txy=[b2.left,b2.top];bT.twh=b4;bT.tElement=b3.endpoints[b5]}bX=bE.anchor.compute(bT)}var b1=bB.compute(bX,bE.anchor.getOrientation(bB),bE.paintStyleInUse,bV||bE.paintStyleInUse);bB.paint(b1,bE.paintStyleInUse,bE.anchor);bE.timestamp=b0;for(var bY=0;bYF[0]){return(E[1]>F[1])?2:1}else{return(E[1]>F[1])?3:4}},intersects:function(J,I){var G=J.x,E=J.x+J.w,N=J.y,L=J.y+J.h,H=I.x,F=I.x+I.w,M=I.y,K=I.y+I.h;return((G0?o.util.segmentMultipliers[M]:o.util.inverseSegmentMultipliers[M],G=Math.atan(H),J=Math.abs(F*Math.sin(G))*L[1],K=Math.abs(F*Math.cos(G))*L[0];return{x:E.x+K,y:E.y+J}},perpendicularLineTo:function(G,H,I){var F=o.util.gradient(G,H),J=Math.atan(-1/F),K=I/2*Math.sin(J),E=I/2*Math.cos(J);return[{x:H.x+E,y:H.y+K},{x:H.x-E,y:H.y-K}]}};var q=function(E,J,G,F,I,H){return function(L){L=L||{};var K=L.jsPlumbInstance.makeAnchor([E,J,G,F,0,0],L.elementId,L.jsPlumbInstance);K.type=I;if(H){H(K,L)}return K}};o.Anchors.TopCenter=q(0.5,0,0,-1,"TopCenter");o.Anchors.BottomCenter=q(0.5,1,0,1,"BottomCenter");o.Anchors.LeftMiddle=q(0,0.5,-1,0,"LeftMiddle");o.Anchors.RightMiddle=q(1,0.5,1,0,"RightMiddle");o.Anchors.Center=q(0.5,0.5,0,0,"Center");o.Anchors.TopRight=q(1,0,0,-1,"TopRight");o.Anchors.BottomRight=q(1,1,0,1,"BottomRight");o.Anchors.TopLeft=q(0,0,0,-1,"TopLeft");o.Anchors.BottomLeft=q(0,1,0,1,"BottomLeft");o.Defaults.DynamicAnchors=function(E){return E.jsPlumbInstance.makeAnchors(["TopCenter","RightMiddle","BottomCenter","LeftMiddle"],E.elementId,E.jsPlumbInstance)};o.Anchors.AutoDefault=function(F){var E=F.jsPlumbInstance.makeDynamicAnchor(o.Defaults.DynamicAnchors(F));E.type="AutoDefault";return E};o.Anchors.Assign=q(0,0,0,0,"Assign",function(F,G){var E=G.position||"Fixed";F.positionFinder=E.constructor==String?G.jsPlumbInstance.AnchorPositionFinders[E]:E;F.constructorParams=G});o.Anchors.Continuous=function(E){return E.jsPlumbInstance.continuousAnchorFactory.get(E)};o.AnchorPositionFinders={Fixed:function(H,E,G,F){return[(H.left-E.left)/G[0],(H.top-E.top)/G[1]]},Grid:function(E,N,I,F){var M=E.left-N.left,L=E.top-N.top,K=I[0]/(F.grid[0]),J=I[1]/(F.grid[1]),H=Math.floor(M/K),G=Math.floor(L/J);return[((H*K)+(K/2))/I[0],((G*J)+(J/2))/I[1]]}}})();(function(){jsPlumb.DOMElementComponent=function(c){jsPlumb.jsPlumbUIComponent.apply(this,arguments);this.mousemove=this.dblclick=this.click=this.mousedown=this.mouseup=function(d){}};jsPlumb.Connectors.Straight=function(){this.type="Straight";var r=this,i=null,e,k,p,n,l,f,q,h,g,d,c,o,m;this.compute=function(A,J,s,z,F,t,D,v){var I=Math.abs(A[0]-J[0]),C=Math.abs(A[1]-J[1]),B=0.45*I,u=0.45*C;I*=1.9;C*=1.9;var G=Math.min(A[0],J[0])-B;var E=Math.min(A[1],J[1])-u;var H=Math.max(2*D,v);if(It){t=B}if(E<0){r+=E;var G=Math.abs(E);t+=G;p[0]+=G;f+=G;n+=G;l[0]+=G}var O=Math.min(e,m),M=Math.min(p[1],l[1]),A=Math.min(O,M),F=Math.max(e,m),D=Math.max(p[1],l[1]),x=Math.max(F,D);if(x>d){d=x}if(A<0){q+=A;var C=Math.abs(A);d+=C;p[1]+=C;e+=C;m+=C;l[1]+=C}if(K&&t=v){t=w;u=(v-o[w][0])/e[w];break}}return{segment:m[t],proportion:u,index:t}};this.compute=function(R,af,t,L,ap,F,P,K,ak,ah){m=[];q=0;e=[];d=c=0;h=af[0]ao?0:1,Z=[1,0][X];I=[];aq=[];I[X]=R[X]>af[X]?-1:1;aq[X]=R[X]>af[X]?1:-1;I[Z]=0;aq[Z]=0}if(ag2*f,S=Math.abs(A-al)>2*f,ac=U+((G-U)/2),aa=T+((E-T)/2),J=((I[0]*aq[0])+(I[1]*aq[1])),W=J==-1,Y=J==0,u=J==1;ae-=D;ad-=B;p=[ae,ad,ag,ao,C,A,am,al];var aj=[];i(U,T,C,A,am,al);var N=I[0]==0?"y":"x",H=W?"opposite":u?"orthogonal":"perpendicular",v=jsPlumb.util.segment([C,A],[am,al]),ab=I[N=="x"?0:1]==-1,M={x:[null,4,3,2,1],y:[null,2,1,4,3]};if(ab){v=M[N][v]}var O=function(ar,y,w,x){return ar+(y*((1-w)*x)+f)},z={oppositex:function(){if(t.elementId==L.elementId){var w=T+((1-ap.y)*ak.height)+f;return[[U,w],[G,w]]}else{if(Q&&(v==1||v==2)){return[[ac,A],[ac,al]]}else{return[[U,aa],[G,aa]]}}},orthogonalx:function(){if(v==1||v==2){return[[G,T]]}else{return[[U,E]]}},perpendicularx:function(){var w=(al+A)/2;if((v==1&&aq[1]==1)||(v==2&&aq[1]==-1)){if(Math.abs(am-C)>f){return[[G,T]]}else{return[[U,T],[U,w],[G,w]]}}else{if((v==3&&aq[1]==-1)||(v==4&&aq[1]==1)){return[[U,w],[G,w]]}else{if((v==3&&aq[1]==1)||(v==4&&aq[1]==-1)){return[[U,E]]}else{if((v==1&&aq[1]==-1)||(v==2&&aq[1]==1)){if(Math.abs(am-C)>f){return[[ac,T],[ac,E]]}else{return[[U,E]]}}}}}},oppositey:function(){if(t.elementId==L.elementId){var w=U+((1-ap.x)*ak.width)+f;return[[w,T],[w,E]]}else{if(S&&(v==2||v==3)){return[[C,aa],[am,aa]]}else{return[[ac,T],[ac,E]]}}},orthogonaly:function(){if(v==2||v==3){return[[U,E]]}else{return[[G,T]]}},perpendiculary:function(){var w=(am+C)/2;if((v==2&&aq[0]==-1)||(v==3&&aq[0]==1)){if(Math.abs(am-C)>f){return[[U,E]]}else{return[[U,aa],[G,aa]]}}else{if((v==1&&aq[0]==-1)||(v==4&&aq[0]==1)){var w=(am+C)/2;return[[w,T],[w,E]]}else{if((v==1&&aq[0]==1)||(v==4&&aq[0]==-1)){return[[G,T]]}else{if((v==2&&aq[0]==1)||(v==3&&aq[0]==-1)){if(Math.abs(al-A)>f){return[[U,aa],[G,aa]]}else{return[[G,T]]}}}}}}};var ai=z[H+N]();if(ai){for(var an=0;anp[3]){p[3]=c+(P*2)}if(d>p[2]){p[2]=d+(P*2)}return p};this.pointOnPath=function(t){return r.pointAlongPathFrom(t,0)};this.gradientAtPoint=function(t){return m[n(t)["index"]][4]};this.pointAlongPathFrom=function(w,A){var x=n(w),v=x.segment,z=x.proportion,u=m[x.index][5],t=m[x.index][4];var y={x:t==Infinity?v[2]:v[2]>v[0]?v[0]+((1-z)*u)-A:v[2]+(z*u)+A,y:t==0?v[3]:v[3]>v[1]?v[1]+((1-z)*u)-A:v[3]+(z*u)+A,segmentInfo:x};return y}};jsPlumb.Endpoints.Dot=function(d){this.type="Dot";var c=this;d=d||{};this.radius=d.radius||10;this.defaultOffset=0.5*this.radius;this.defaultInnerRadius=this.radius/3;this.compute=function(i,f,l,h){var g=l.radius||c.radius,e=i[0]-g,k=i[1]-g;return[e,k,g*2,g*2,g]}};jsPlumb.Endpoints.Rectangle=function(d){this.type="Rectangle";var c=this;d=d||{};this.width=d.width||20;this.height=d.height||20;this.compute=function(k,g,m,i){var h=m.width||c.width,f=m.height||c.height,e=k[0]-(h/2),l=k[1]-(f/2);return[e,l,h,f]}};var a=function(e){jsPlumb.DOMElementComponent.apply(this,arguments);var c=this;var d=[];this.getDisplayElements=function(){return d};this.appendDisplayElement=function(f){d.push(f)}};jsPlumb.Endpoints.Image=function(g){this.type="Image";a.apply(this,arguments);var l=this,f=false,e=g.width,d=g.height,i=null,c=g.endpoint;this.img=new Image();l.ready=false;this.img.onload=function(){l.ready=true;e=e||l.img.width;d=d||l.img.height;if(i){i(l)}};c.setImage=function(m,o){var n=m.constructor==String?m:m.src;i=o;l.img.src=m};c.setImage(g.src||g.url,g.onload);this.compute=function(o,m,p,n){l.anchorPoint=o;if(l.ready){return[o[0]-e/2,o[1]-d/2,e,d]}else{return[0,0,0,0]}};l.canvas=document.createElement("img"),f=false;l.canvas.style.margin=0;l.canvas.style.padding=0;l.canvas.style.outline=0;l.canvas.style.position="absolute";var h=g.cssClass?" "+g.cssClass:"";l.canvas.className=jsPlumb.endpointClass+h;if(e){l.canvas.setAttribute("width",e)}if(d){l.canvas.setAttribute("height",d)}jsPlumb.appendElement(l.canvas,g.parent);l.attachListeners(l.canvas,l);var k=function(p,o,n){if(!f){l.canvas.setAttribute("src",l.img.src);f=true}var m=l.anchorPoint[0]-(e/2),q=l.anchorPoint[1]-(d/2);jsPlumb.sizeCanvas(l.canvas,m,q,e,d)};this.paint=function(o,n,m){if(l.ready){k(o,n,m)}else{window.setTimeout(function(){l.paint(o,n,m)},200)}}};jsPlumb.Endpoints.Blank=function(d){var c=this;this.type="Blank";a.apply(this,arguments);this.compute=function(g,e,h,f){return[g[0],g[1],10,0]};c.canvas=document.createElement("div");c.canvas.style.display="block";c.canvas.style.width="1px";c.canvas.style.height="1px";c.canvas.style.background="transparent";c.canvas.style.position="absolute";c.canvas.className=c._jsPlumb.endpointClass;jsPlumb.appendElement(c.canvas,d.parent);this.paint=function(g,f,e){jsPlumb.sizeCanvas(c.canvas,g[0],g[1],g[2],g[3])}};jsPlumb.Endpoints.Triangle=function(c){this.type="Triangle";c=c||{};c.width=c.width||55;c.height=c.height||55;this.width=c.width;this.height=c.height;this.compute=function(i,f,l,h){var g=l.width||self.width,e=l.height||self.height,d=i[0]-(g/2),k=i[1]-(e/2);return[d,k,g,e]}};var b=function(e){var d=true,c=this;this.isAppendedAtTopLevel=true;this.component=e.component;this.loc=e.location==null?0.5:e.location;this.endpointLoc=e.endpointLocation==null?[0.5,0.5]:e.endpointLocation;this.setVisible=function(f){d=f;c.component.repaint()};this.isVisible=function(){return d};this.hide=function(){c.setVisible(false)};this.show=function(){c.setVisible(true)};this.incrementLocation=function(f){c.loc+=f;c.component.repaint()};this.setLocation=function(f){c.loc=f;c.component.repaint()};this.getLocation=function(){return c.loc}};jsPlumb.Overlays.Arrow=function(g){this.type="Arrow";b.apply(this,arguments);this.isAppendedAtTopLevel=false;g=g||{};var d=this;this.length=g.length||20;this.width=g.width||20;this.id=g.id;var f=(g.direction||1)<0?-1:1,e=g.paintStyle||{lineWidth:1},c=g.foldback||0.623;this.computeMaxSize=function(){return d.width*1.5};this.cleanup=function(){};this.draw=function(i,x,s){var m,t,h,n,l;if(i.pointAlongPathFrom){if(d.loc==1){m=i.pointOnPath(d.loc);t=i.pointAlongPathFrom(d.loc,-1);h=jsPlumb.util.pointOnLine(m,t,d.length)}else{if(d.loc==0){h=i.pointOnPath(d.loc);t=i.pointAlongPathFrom(d.loc,1);m=jsPlumb.util.pointOnLine(h,t,d.length)}else{m=i.pointAlongPathFrom(d.loc,f*d.length/2),t=i.pointOnPath(d.loc),h=jsPlumb.util.pointOnLine(m,t,d.length)}}n=jsPlumb.util.perpendicularLineTo(m,h,d.width);l=jsPlumb.util.pointOnLine(m,h,c*d.length);var w=Math.min(m.x,n[0].x,n[1].x),q=Math.max(m.x,n[0].x,n[1].x),v=Math.min(m.y,n[0].y,n[1].y),p=Math.max(m.y,n[0].y,n[1].y);var o={hxy:m,tail:n,cxy:l},r=e.strokeStyle||x.strokeStyle,u=e.fillStyle||x.strokeStyle,k=e.lineWidth||x.lineWidth;d.paint(i,o,k,r,u,s);return[w,q,v,p]}else{return[0,0,0,0]}}};jsPlumb.Overlays.PlainArrow=function(d){d=d||{};var c=jsPlumb.extend(d,{foldback:1});jsPlumb.Overlays.Arrow.call(this,c);this.type="PlainArrow"};jsPlumb.Overlays.Diamond=function(e){e=e||{};var c=e.length||40,d=jsPlumb.extend(e,{length:c/2,foldback:2});jsPlumb.Overlays.Arrow.call(this,d);this.type="Diamond"};jsPlumb.Overlays.Label=function(i){this.type="Label";jsPlumb.DOMElementComponent.apply(this,arguments);b.apply(this,arguments);this.labelStyle=i.labelStyle||jsPlumb.Defaults.LabelStyle;this.id=i.id;this.cachedDimensions=null;var e=i.label||"",c=this,f=false,k=document.createElement("div"),g=null;k.style.position="absolute";var d=i._jsPlumb.overlayClass+" "+(c.labelStyle.cssClass?c.labelStyle.cssClass:i.cssClass?i.cssClass:"");k.className=d;jsPlumb.appendElement(k,i.component.parent);jsPlumb.getId(k);c.attachListeners(k,c);c.canvas=k;var h=c.setVisible;c.setVisible=function(l){h(l);k.style.display=l?"block":"none"};this.getElement=function(){return k};this.cleanup=function(){if(k!=null){jsPlumb.CurrentLibrary.removeElement(k)}};this.setLabel=function(m){e=m;g=null;c.component.repaint()};this.getLabel=function(){return e};this.paint=function(l,n,m){if(!f){l.appendDisplayElement(k);c.attachListeners(k,l);f=true}k.style.left=(m[0]+n.minx)+"px";k.style.top=(m[1]+n.miny)+"px"};this.getTextDimensions=function(){if(typeof e=="function"){var l=e(c);k.innerHTML=l.replace(/\r\n/g,"
")}else{if(g==null){g=e;k.innerHTML=g.replace(/\r\n/g,"
")}}var n=jsPlumb.CurrentLibrary.getElementObject(k),m=jsPlumb.CurrentLibrary.getSize(n);return{width:m[0],height:m[1]}};this.computeMaxSize=function(l){var m=c.getTextDimensions(l);return m.width?Math.max(m.width,m.height)*1.5:0};this.draw=function(m,n,o){var q=c.getTextDimensions(m);if(q.width!=null){var p={x:0,y:0};if(m.pointOnPath){p=m.pointOnPath(c.loc)}else{var l=c.loc.constructor==Array?c.loc:c.endpointLoc;p={x:l[0]*o[2],y:l[1]*o[3]}}minx=p.x-(q.width/2),miny=p.y-(q.height/2);c.paint(m,{minx:minx,miny:miny,td:q,cxy:p},o);return[minx,minx+q.width,miny,miny+q.height]}else{return[0,0,0,0]}};this.reattachListeners=function(l){if(k){c.reattachListenersForElement(k,c,l)}}};jsPlumb.Overlays.GuideLines=function(){var c=this;c.length=50;c.lineWidth=5;this.type="GuideLines";b.apply(this,arguments);jsPlumb.jsPlumbUIComponent.apply(this,arguments);this.draw=function(e,l,k){var i=e.pointAlongPathFrom(c.loc,c.length/2),h=e.pointOnPath(c.loc),g=jsPlumb.util.pointOnLine(i,h,c.length),f=jsPlumb.util.perpendicularLineTo(i,g,40),d=jsPlumb.util.perpendicularLineTo(g,i,20);c.paint(e,[i,g,f,d],c.lineWidth,"red",null,k);return[Math.min(i.x,g.x),Math.min(i.y,g.y),Math.max(i.x,g.x),Math.max(i.y,g.y)]};this.computeMaxSize=function(){return 50};this.cleanup=function(){}}})();(function(){var c=function(e,g,d,f){this.m=(f-g)/(d-e);this.b=-1*((this.m*e)-g);this.rectIntersect=function(q,p,s,o){var n=[];var k=(p-this.b)/this.m;if(k>=q&&k<=(q+s)){n.push([k,(this.m*k)+this.b])}var t=(this.m*(q+s))+this.b;if(t>=p&&t<=(p+o)){n.push([(t-this.b)/this.m,t])}var k=((p+o)-this.b)/this.m;if(k>=q&&k<=(q+s)){n.push([k,(this.m*k)+this.b])}var t=(this.m*q)+this.b;if(t>=p&&t<=(p+o)){n.push([(t-this.b)/this.m,t])}if(n.length==2){var m=(n[0][0]+n[1][0])/2,l=(n[0][1]+n[1][1])/2;n.push([m,l]);var i=m<=q+(s/2)?-1:1,r=l<=p+(o/2)?-1:1;n.push([i,r]);return n}return null}},a=function(e,g,d,f){if(e<=d&&f<=g){return 1}else{if(e<=d&&g<=f){return 2}else{if(d<=e&&f>=g){return 3}}}return 4},b=function(g,f,i,e,h,m,l,d,k){if(d<=k){return[g,f]}if(i==1){if(e[3]<=0&&h[3]>=1){return[g+(e[2]<0.5?-1*m:m),f]}else{if(e[2]>=1&&h[2]<=0){return[g,f+(e[3]<0.5?-1*l:l)]}else{return[g+(-1*m),f+(-1*l)]}}}else{if(i==2){if(e[3]>=1&&h[3]<=0){return[g+(e[2]<0.5?-1*m:m),f]}else{if(e[2]>=1&&h[2]<=0){return[g,f+(e[3]<0.5?-1*l:l)]}else{return[g+(1*m),f+(-1*l)]}}}else{if(i==3){if(e[3]>=1&&h[3]<=0){return[g+(e[2]<0.5?-1*m:m),f]}else{if(e[2]<=0&&h[2]>=1){return[g,f+(e[3]<0.5?-1*l:l)]}else{return[g+(-1*m),f+(-1*l)]}}}else{if(i==4){if(e[3]<=0&&h[3]>=1){return[g+(e[2]<0.5?-1*m:m),f]}else{if(e[2]<=0&&h[2]>=1){return[g,f+(e[3]<0.5?-1*l:l)]}else{return[g+(1*m),f+(-1*l)]}}}}}}};jsPlumb.Connectors.StateMachine=function(l){var s=this,n=null,o,m,g,e,p=[],d=l.curviness||10,k=l.margin||5,q=l.proximityLimit||80,f=l.orientation&&l.orientation=="clockwise",i=l.loopbackRadius||25,h=false;this.type="StateMachine";l=l||{};this.compute=function(ab,F,U,G,aa,u,t,S){var O=Math.abs(ab[0]-F[0]),W=Math.abs(ab[1]-F[1]),Q=0.45*O,Z=0.45*W;O*=1.9;W*=1.9;t=t||1;var M=Math.min(ab[0],F[0])-Q,K=Math.min(ab[1],F[1])-Z;if(U.elementId!=G.elementId){h=false;o=ab[0]0&&v<1){v=1-v}var w=(v*2*Math.PI)+(Math.PI/2),u=n[4]+(n[6]*Math.cos(w)),t=n[5]+(n[6]*Math.sin(w));return{x:u,y:t}}else{return jsBezier.pointOnCurve(r(),v)}};this.gradientAtPoint=function(t){if(h){return Math.atan(t*2*Math.PI)}else{return jsBezier.gradientAtPoint(r(),t)}};this.pointAlongPathFrom=function(v,z){if(h){if(v>0&&v<1){v=1-v}var w=2*Math.PI*n[6],y=z/w*2*Math.PI,x=(v*2*Math.PI)-y+(Math.PI/2),u=n[4]+(n[6]*Math.cos(x)),t=n[5]+(n[6]*Math.sin(x));return{x:u,y:t}}return jsBezier.pointAlongCurveFrom(r(),v,z)}};jsPlumb.Connectors.canvas.StateMachine=function(f){f=f||{};var d=this,g=f.drawGuideline||true,e=f.avoidSelector;jsPlumb.Connectors.StateMachine.apply(this,arguments);jsPlumb.CanvasConnector.apply(this,arguments);this._paint=function(l){if(l.length==10){d.ctx.beginPath();d.ctx.moveTo(l[4],l[5]);d.ctx.quadraticCurveTo(l[8],l[9],l[6],l[7]);d.ctx.stroke()}else{d.ctx.save();d.ctx.beginPath();var k=0,i=2*Math.PI,h=l[7];d.ctx.arc(l[4],l[5],l[6],0,i,h);d.ctx.stroke();d.ctx.closePath();d.ctx.restore()}};this.createGradient=function(i,h){return h.createLinearGradient(i[4],i[5],i[6],i[7])}};jsPlumb.Connectors.svg.StateMachine=function(){var d=this;jsPlumb.Connectors.StateMachine.apply(this,arguments);jsPlumb.SvgConnector.apply(this,arguments);this.getPath=function(e){if(e.length==10){return"M "+e[4]+" "+e[5]+" C "+e[8]+" "+e[9]+" "+e[8]+" "+e[9]+" "+e[6]+" "+e[7]}else{return"M"+(e[8]+4)+" "+e[9]+" A "+e[6]+" "+e[6]+" 0 1,0 "+(e[8]-4)+" "+e[9]}}};jsPlumb.Connectors.vml.StateMachine=function(){jsPlumb.Connectors.StateMachine.apply(this,arguments);jsPlumb.VmlConnector.apply(this,arguments);var d=jsPlumb.vml.convertValue;this.getPath=function(k){if(k.length==10){return"m"+d(k[4])+","+d(k[5])+" c"+d(k[8])+","+d(k[9])+","+d(k[8])+","+d(k[9])+","+d(k[6])+","+d(k[7])+" e"}else{var h=d(k[8]-k[6]),g=d(k[9]-(2*k[6])),f=h+d(2*k[6]),e=g+d(2*k[6]),l=h+","+g+","+f+","+e;var i="ar "+l+","+d(k[8])+","+d(k[9])+","+d(k[8])+","+d(k[9])+" e";return i}}}})();(function(){var k={"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.createStyleSheet().addRule("jsplumb\\:group","behavior:url(#default#VML);position:absolute;");document.namespaces.add("jsplumb","urn:schemas-microsoft-com:vml")}jsPlumb.vml={};var b=1000,d={},h=function(q,p){var s=jsPlumb.getId(q),r=d[s];if(!r){r=o("group",[0,0,b,b],{"class":p});r.style.backgroundColor="red";d[s]=r;jsPlumb.appendElement(r,q)}return r},c=function(q,r){for(var p in r){q[p]=r[p]}},o=function(p,r,s){s=s||{};var q=document.createElement("jsplumb:"+p);q.className=(s["class"]?s["class"]+" ":"")+"jsplumb_vml";n(q,r);c(q,s);return q},n=function(q,p){q.style.left=p[0]+"px";q.style.top=p[1]+"px";q.style.width=p[2]+"px";q.style.height=p[3]+"px";q.style.position="absolute"},i=jsPlumb.vml.convertValue=function(p){return Math.floor(p*b)},e=function(s,q,r,p){if("transparent"===q){p.setOpacity(r,"0.0")}else{p.setOpacity(r,"1.0")}},g=function(t,p,w){var s={};if(p.strokeStyle){s.stroked="true";var x=jsPlumb.util.convertStyle(p.strokeStyle,true);s.strokecolor=x;e(s,x,"stroke",w);s.strokeweight=p.lineWidth+"px"}else{s.stroked="false"}if(p.fillStyle){s.filled="true";var q=jsPlumb.util.convertStyle(p.fillStyle,true);s.fillcolor=q;e(s,q,"fill",w)}else{s.filled="false"}if(p.dashstyle){if(w.strokeNode==null){w.strokeNode=o("stroke",[0,0,0,0],{dashstyle:p.dashstyle});t.appendChild(w.strokeNode)}else{w.strokeNode.dashstyle=p.dashstyle}}else{if(p["stroke-dasharray"]&&p.lineWidth){var y=p["stroke-dasharray"].indexOf(",")==-1?" ":",",u=p["stroke-dasharray"].split(y),r="";for(var v=0;v0&&C>0&&u=u&&w[2]<=C&&w[3]>=C)){return true}}var A=q.canvas.getContext("2d").getImageData(parseInt(u),parseInt(C),1,1);return A.data[0]!=0||A.data[1]!=0||A.data[2]!=0||A.data[3]!=0}return false};var p=false,o=false,t=null,s=false,r=function(v,u){return v!=null&&i(v,u)};this.mousemove=function(x){var z=n(x),w=f(x),v=document.elementFromPoint(w[0],w[1]),y=r(v,"_jsPlumb_overlay");var u=d==null&&(r(v,"_jsPlumb_endpoint")||r(v,"_jsPlumb_connector"));if(!p&&u&&q._over(x)){p=true;q.fire("mouseenter",q,x);return true}else{if(p&&(!q._over(x)||!u)&&!y){p=false;q.fire("mouseexit",q,x)}}q.fire("mousemove",q,x)};this.click=function(u){if(p&&q._over(u)&&!s){q.fire("click",q,u)}s=false};this.dblclick=function(u){if(p&&q._over(u)&&!s){q.fire("dblclick",q,u)}s=false};this.mousedown=function(u){if(q._over(u)&&!o){o=true;t=m(a(q.canvas));q.fire("mousedown",q,u)}};this.mouseup=function(u){o=false;q.fire("mouseup",q,u)};this.contextmenu=function(u){if(p&&q._over(u)&&!s){q.fire("contextmenu",q,u)}s=false}};var c=function(p){var o=document.createElement("canvas");p._jsPlumb.appendElement(o,p.parent);o.style.position="absolute";if(p["class"]){o.className=p["class"]}p._jsPlumb.getId(o,p.uuid);if(p.tooltip){o.setAttribute("title",p.tooltip)}return o};var l=function(p){k.apply(this,arguments);var o=[];this.getDisplayElements=function(){return o};this.appendDisplayElement=function(q){o.push(q)}};var h=jsPlumb.CanvasConnector=function(r){l.apply(this,arguments);var o=function(v,t){p.ctx.save();jsPlumb.extend(p.ctx,t);if(t.gradient){var u=p.createGradient(v,p.ctx);for(var s=0;sq?q=s:sl.location){l.location=0}return i(m,l.location)},nearestPointOnCurve:function(m,l){var n=h(m,l);return{point:a(l,l.length-1,n.location,null,null),location:n.location}},pointOnCurve:c,pointAlongCurveFrom:function(m,l,n){return k(m,l,n).point},perpendicularToCurveAt:function(m,l,n,o){l=k(m,l,null==o?0:o);m=i(m,l.location);o=Math.atan(-1/m);m=n/2*Math.sin(o);n=n/2*Math.cos(o);return[{x:l.point.x+n,y:l.point.y+m},{x:l.point.x-n,y:l.point.y-m}]}}})();