jsPlumbUtil={isArray:function(b){return Object.prototype.toString.call(b)==="[object Array]"},isString:function(a){return typeof a==="string"},isBoolean:function(a){return typeof a==="boolean"},isObject:function(a){return Object.prototype.toString.call(a)==="[object Object]"},isDate:function(a){return Object.prototype.toString.call(a)==="[object Date]"},isFunction:function(a){return Object.prototype.toString.call(a)==="[object Function]"},clone:function(d){if(this.isString(d)){return new String(d)}else{if(this.isBoolean(d)){return new Boolean(d)}else{if(this.isDate(d)){return new Date(d.getTime())}else{if(this.isFunction(d)){return d}else{if(this.isArray(d)){var c=[];for(var e=0;eb[0]){return(a[1]>b[1])?2:1}else{return(a[1]>b[1])?3:4}},intersects:function(f,e){var c=f.x,a=f.x+f.w,k=f.y,h=f.y+f.h,d=e.x,b=e.x+e.w,i=e.y,g=e.y+e.h;return((c<=d&&d<=a)&&(k<=i&&i<=h))||((c<=b&&b<=a)&&(k<=i&&i<=h))||((c<=d&&d<=a)&&(k<=g&&g<=h))||((c<=b&&d<=a)&&(k<=g&&g<=h))||((d<=c&&c<=b)&&(i<=k&&k<=g))||((d<=a&&a<=b)&&(i<=k&&k<=g))||((d<=c&&c<=b)&&(i<=h&&h<=g))||((d<=a&&c<=b)&&(i<=h&&h<=g))},segmentMultipliers:[null,[1,-1],[1,1],[-1,1],[-1,-1]],inverseSegmentMultipliers:[null,[-1,-1],[-1,1],[1,1],[1,-1]],pointOnLine:function(a,e,b){var d=jsPlumbUtil.gradient(a,e),i=jsPlumbUtil.segment(a,e),h=b>0?jsPlumbUtil.segmentMultipliers[i]:jsPlumbUtil.inverseSegmentMultipliers[i],c=Math.atan(d),f=Math.abs(b*Math.sin(c))*h[1],g=Math.abs(b*Math.cos(c))*h[0];return{x:a.x+g,y:a.y+f}},perpendicularLineTo:function(c,d,e){var b=jsPlumbUtil.gradient(c,d),f=Math.atan(-1/b),g=e/2*Math.sin(f),a=e/2*Math.cos(f);return[{x:d.x+a,y:d.y+g},{x:d.x-a,y:d.y-g}]},findWithFunction:function(b,d){if(b){for(var c=0;c-1){c.splice(b,1)}return b!=-1},remove:function(b,c){var a=jsPlumbUtil.indexOf(b,c);if(a>-1){b.splice(a,1)}return a!=-1},addWithFunction:function(c,b,a){if(jsPlumbUtil.findWithFunction(c,a)==-1){c.push(b)}},addToList:function(d,b,c){var a=d[b];if(a==null){a=[],d[b]=a}a.push(c);return a},EventGenerator:function(){var c={},b=this;var a=["ready"];this.bind=function(d,e){jsPlumbUtil.addToList(c,d,e);return b};this.fire=function(g,h,d){if(c[g]){for(var f=0;f';var e=f.firstChild;e.style.behavior="url(#default#VML)";d.vml=e?typeof e.adj=="object":true;f.parentNode.removeChild(f)}return d.vml};var c=function(i){var h={},g=[],f={},e={};this.register=function(n){var m=jsPlumb.CurrentLibrary;n=m.getElementObject(n);var p=i.getId(n),l=m.getDOMElement(n),k=m.getOffset(n);if(!h[p]){h[p]=n;g.push(n);f[p]={}}var o=function(u,q){if(u){for(var r=0;r0){var s=m.getOffset(t);f[p][v]={id:v,offset:{left:s.left-k.left,top:s.top-k.top}}}o(u.childNodes[r])}}}};o(l)};this.endpointAdded=function(m){var r=jsPlumb.CurrentLibrary,u=document.body,k=i.getId(m),t=r.getDOMElement(m),l=t.parentNode,o=l==u;e[k]=e[k]?e[k]+1:1;while(l!=u){var q=i.getId(l,null,true);if(q&&h[q]){var w=-1,s=r.getElementObject(l),n=r.getOffset(s);if(f[q][k]==null){var v=jsPlumb.CurrentLibrary.getOffset(m);f[q][k]={id:k,offset:{left:v.left-n.left,top:v.top-n.top}}}break}l=l.parentNode}};this.endpointDeleted=function(l){if(e[l.elementId]){e[l.elementId]--;if(e[l.elementId]<=0){for(var k in f){delete f[k][l.elementId]}}}};this.getElementsForDraggable=function(k){return f[k]};this.reset=function(){h={};g=[];f={};e={}}};if(!window.console){window.console={time:function(){},timeEnd:function(){},group:function(){},groupEnd:function(){},log:function(){}}}window.jsPlumbAdapter={headless:false,appendToRoot:function(e){document.body.appendChild(e)},getRenderModes:function(){return["canvas","svg","vml"]},isRenderModeAvailable:function(e){return{canvas:b,svg:a,vml:d()}[e]},getDragManager:function(e){return new c(e)},setRenderMode:function(i){var h;if(i){i=i.toLowerCase();var f=this.isRenderModeAvailable("canvas"),e=this.isRenderModeAvailable("svg"),g=this.isRenderModeAvailable("vml");if(i==="svg"){if(e){h="svg"}else{if(f){h="canvas"}else{if(g){h="vml"}}}}else{if(i==="canvas"&&f){h="canvas"}else{if(g){h="vml"}}}}return h}}})();(function(){var g=jsPlumbUtil.findWithFunction,G=jsPlumbUtil.indexOf,A=jsPlumbUtil.removeWithFunction,k=jsPlumbUtil.remove,r=jsPlumbUtil.addWithFunction,i=jsPlumbUtil.addToList,l=jsPlumbUtil.isArray,z=jsPlumbUtil.isString,u=jsPlumbUtil.isObject;var v=null,c=function(H,I){return n.CurrentLibrary.getAttribute(C(H),I)},d=function(I,J,H){n.CurrentLibrary.setAttribute(C(I),J,H)},y=function(I,H){n.CurrentLibrary.addClass(C(I),H)},h=function(I,H){return n.CurrentLibrary.hasClass(C(I),H)},m=function(I,H){n.CurrentLibrary.removeClass(C(I),H)},C=function(H){return n.CurrentLibrary.getElementObject(H)},s=function(I,H){var K=n.CurrentLibrary.getOffset(C(I));if(H!=null){var J=H.getZoom();return{left:K.left/J,top:K.top/J}}else{return K}},a=function(H){return n.CurrentLibrary.getSize(C(H))},o=jsPlumbUtil.log,F=jsPlumbUtil.group,f=jsPlumbUtil.groupEnd,E=jsPlumbUtil.time,t=jsPlumbUtil.timeEnd,p=function(){return""+(new Date()).getTime()},B=function(aa){var U=this,ab=arguments,S=false,M=aa.parameters||{},K=U.idPrefix,X=K+(new Date()).getTime(),W=null,ac=null;U._jsPlumb=aa._jsPlumb;U.getId=function(){return X};U.tooltip=aa.tooltip;U.hoverClass=aa.hoverClass||U._jsPlumb.Defaults.HoverClass||n.Defaults.HoverClass;jsPlumbUtil.EventGenerator.apply(this);this.clone=function(){var ad=new Object();U.constructor.apply(ad,ab);return ad};this.getParameter=function(ad){return M[ad]},this.getParameters=function(){return M},this.setParameter=function(ad,ae){M[ad]=ae},this.setParameters=function(ad){M=ad},this.overlayPlacements=[];var L=aa.beforeDetach;this.isDetachAllowed=function(ad){var ae=U._jsPlumb.checkCondition("beforeDetach",ad);if(L){try{ae=L(ad)}catch(af){o("jsPlumb: beforeDetach callback failed",af)}}return ae};var O=aa.beforeDrop;this.isDropAllowed=function(ai,af,ag,ad,ae){var ah=U._jsPlumb.checkCondition("beforeDrop",{sourceId:ai,targetId:af,scope:ag,connection:ad,dropEndpoint:ae});if(O){try{ah=O({sourceId:ai,targetId:af,scope:ag,connection:ad,dropEndpoint:ae})}catch(aj){o("jsPlumb: beforeDrop callback failed",aj)}}return ah};var Y=function(){if(W&&ac){var ad={};n.extend(ad,W);n.extend(ad,ac);delete U.hoverPaintStyle;if(ad.gradient&&W.fillStyle){delete ad.gradient}ac=ad}};this.setPaintStyle=function(ad,ae){W=ad;U.paintStyleInUse=W;Y();if(!ae){U.repaint()}};this.getPaintStyle=function(){return W};this.setHoverPaintStyle=function(ad,ae){ac=ad;Y();if(!ae){U.repaint()}};this.getHoverPaintStyle=function(){return ac};this.setHover=function(ad,af,ae){if(!U._jsPlumb.currentlyDragging&&!U._jsPlumb.isHoverSuspended()){S=ad;if(U.hoverClass!=null&&U.canvas!=null){if(ad){J.addClass(U.canvas,U.hoverClass)}else{J.removeClass(U.canvas,U.hoverClass)}}if(ac!=null){U.paintStyleInUse=ad?ac:W;ae=ae||p();U.repaint({timestamp:ae,recalc:false})}if(U.getAttachedElements&&!af){Z(ad,p(),U)}}};this.isHover=function(){return S};var V=null;this.setZIndex=function(ad){V=ad};this.getZIndex=function(){return V};var J=n.CurrentLibrary,I=["click","dblclick","mouseenter","mouseout","mousemove","mousedown","mouseup","contextmenu"],T={mouseout:"mouseexit"},N=function(af,ag,ae){var ad=T[ae]||ae;J.bind(af,ae,function(ah){ag.fire(ad,ag,ah)})},R=function(af,ae){var ad=T[ae]||ae;J.unbind(af,ae)};this.attachListeners=function(ae,af){for(var ad=0;ad1){for(var ad=0;ad=0?S.overlays[T]:null};this.getOverlays=function(){return S.overlays};this.hideOverlay=function(U){var T=S.getOverlay(U);if(T){T.hide()}};this.hideOverlays=function(){for(var T=0;T0){try{for(var bA=0;bA0?G(bB,bA)!=-1:!bz};this.getConnections=function(bI,bA){if(!bI){bI={}}else{if(bI.constructor==String){bI={scope:bI}}}var bH=bI.scope||br.getDefaultScope(),bG=bv(bH,true),bz=bv(bI.source),bE=bv(bI.target),bD=(!bA&&bG.length>1)?{}:[],bJ=function(bL,bM){if(!bA&&bG.length>1){var bK=bD[bL];if(bK==null){bK=[];bD[bL]=bK}bK.push(bM)}else{bD.push(bM)}};for(var bC in a0){if(aI(bG,bC)){for(var bB=0;bB0&&!bL.isSource),bG=(bC&&bJ.length>0&&!bL.isTarget);if(bN||bG){continue inner}bP.push(bL)}}}}return bf(bP)};this.getAllConnections=function(){return a0};this.getDefaultScope=function(){return R};this.getEndpoint=ax;this.getEndpoints=function(bz){return aV[H(bz)]};this.getId=H;this.getOffset=function(bA){var bz=aj[bA];return X({elId:bA})};this.getSelector=function(bz){return n.CurrentLibrary.getSelector(bz)};this.getSize=function(bA){var bz=ag[bA];if(!bz){X({elId:bA})}return ag[bA]};this.appendElement=aX;var aU=false;this.isHoverSuspended=function(){return aU};this.setHoverSuspended=function(bz){aU=bz};var aY=function(bz){return function(){return jsPlumbAdapter.isRenderModeAvailable(bz)}};this.isCanvasAvailable=aY("canvas");this.isSVGAvailable=aY("svg");this.isVMLAvailable=aY("vml");this.hide=function(bz,bA){a7(bz,"none",bA)};this.idstamp=an;this.init=function(){if(!K){br.setRenderMode(br.Defaults.RenderMode);var bz=function(bA){n.CurrentLibrary.bind(document,bA,function(bG){if(!br.currentlyDragging&&Y==n.CANVAS){for(var bF in a0){var bH=a0[bF];for(var bD=0;bD=4)?[bE[2],bE[3]]:[0,0],offsets:(bE.length==6)?[bE[4],bE[5]]:[0,0],elementId:bB};bC=new ab(bD);bC.clone=function(){return new ab(bD)}}}}}if(!bC.id){bC.id="anchor_"+an()}return bC};this.makeAnchors=function(bC,bA,bz){var bD=[];for(var bB=0;bB0&&bT>=at[bM]){if(bz){bz({element:bO,connection:bY},bR)}return false}bQ.anchor.locked=false;if(b1){bH.setDragScope(b3,b1)}var bW=proxyComponent.isDropAllowed(bY.sourceId,H(bO),bY.scope,bY,null);if(bY.endpointsToDeleteOnDetach){if(bQ===bY.endpointsToDeleteOnDetach[0]){bY.endpointsToDeleteOnDetach[0]=null}else{if(bQ===bY.endpointsToDeleteOnDetach[1]){bY.endpointsToDeleteOnDetach[1]=null}}}if(bY.suspendedEndpoint){bY.targetId=bY.suspendedEndpoint.elementId;bY.target=bH.getElementObject(bY.suspendedEndpoint.elementId);bY.endpoints[1]=bY.suspendedEndpoint}if(bW){bQ.detach(bY,false,true,false);var b2=aK[bM]||br.addEndpoint(bO,bA);if(bA.uniqueEndpoint){aK[bM]=b2}b2._makeTargetCreator=true;if(b2.anchor.positionFinder!=null){var bZ=bH.getUIPosition(arguments,br.getZoom()),bV=s(bO,br),b0=a(bO),bU=b2.anchor.positionFinder(bZ,bV,b0,b2.anchor.constructorParams);b2.anchor.x=bU[0];b2.anchor.y=bU[1]}var bX=br.connect({source:bQ,target:b2,scope:b1,previousConnection:bY,container:bY.parent,deleteEndpointsOnDetach:bE,doNotFireConnectionEvent:bQ.endpointWillMoveAfterConnection});if(bY.endpoints[1]._makeTargetCreator&&bY.endpoints[1].connections.length<2){br.deleteEndpoint(bY.endpoints[1])}if(bE){bX.endpointsToDeleteOnDetach=[bQ,b2]}bX.repaint()}else{if(bY.suspendedEndpoint){if(bQ.isReattach){bY.setHover(false);bY.floatingAnchorIndex=null;bY.suspendedEndpoint.addConnection(bY);br.repaint(bQ.elementId)}else{bQ.detach(bY,false,true,true,bR)}}}};var bN=bH.dragEvents.drop;bL.scope=bL.scope||bI;bL[bN]=ap(bL[bN],bK);bH.initDroppable(bO,bL,true)};bC=aL(bC);var bG=bC.length&&bC.constructor!=String?bC:[bC];for(var bF=0;bF=0&&bX>=N[bJ]){if(bA){bA({element:bQ,maxConnections:bC},bZ)}return false}if(bE.filter){var bV=bE.filter(bH.getOriginalEvent(bZ),bQ);if(bV===false){return}}var b3=X({elId:bK});var b2=((bZ.pageX||bZ.page.x)-b3.left)/b3.width,b1=((bZ.pageY||bZ.page.y)-b3.top)/b3.height,b7=b2,b6=b1;if(bB.parent){var b0=bH.getElementObject(bB.parent),bY=H(b0);b3=X({elId:bY});b7=((bZ.pageX||bZ.page.x)-b3.left)/b3.width,b6=((bZ.pageY||bZ.page.y)-b3.top)/b3.height}var b5={};n.extend(b5,bB);b5.isSource=true;b5.anchor=[b2,b1,0,0];b5.parentAnchor=[b7,b6,0,0];b5.dragOptions=bS;if(bB.parent){var bW=b5.container||br.Defaults.Container||n.Defaults.Container;if(bW){b5.container=bW}else{b5.container=n.CurrentLibrary.getParent(bB.parent)}}bU=br.addEndpoint(bK,b5);bO=true;bU.endpointWillMoveAfterConnection=bB.parent!=null;bU.endpointWillMoveTo=bB.parent?bH.getElementObject(bB.parent):null;var b4=function(){if(bO){br.deleteEndpoint(bU)}};br.registerListener(bU.canvas,"mouseup",b4);br.registerListener(bQ,"mouseup",b4);bH.trigger(bU.canvas,"mousedown",bZ)};br.registerListener(bQ,"mousedown",bM);J[bK]=bM};bD=aL(bD);var bG=bD.length&&bD.constructor!=String?bD:[bD];for(var bF=0;bF0?bJ[0]:null,bE=bJ.length>0?0:-1,bI=this,bD=function(bM,bK,bQ,bP,bL){var bO=bP[0]+(bM.x*bL[0]),bN=bP[1]+(bM.y*bL[1]);return Math.sqrt(Math.pow(bK-bO,2)+Math.pow(bQ-bN,2))},bz=bA||function(bU,bL,bM,bN,bK){var bP=bM[0]+(bN[0]/2),bO=bM[1]+(bN[1]/2);var bR=-1,bT=Infinity;for(var bQ=0;bQ=bC.left)||(bF.left<=bC.right&&bF.right>=bC.right)||(bF.left<=bC.left&&bF.right>=bC.right)||(bC.left<=bF.left&&bC.right>=bF.right)),bK=((bF.top<=bC.top&&bF.bottom>=bC.top)||(bF.top<=bC.bottom&&bF.bottom>=bC.bottom)||(bF.top<=bC.top&&bF.bottom>=bC.bottom)||(bC.top<=bF.top&&bC.bottom>=bF.bottom));if(!(bE||bK)){var bH=null,bB=false,bz=false,bG=null;if(bC.left>bF.left&&bC.top>bF.top){bH=["right","top"]}else{if(bC.left>bF.left&&bF.top>bC.top){bH=["top","left"]}else{if(bC.leftbF.top){bH=["left","top"]}}}}return{orientation:U.DIAGONAL,a:bH,theta:bA,theta2:bD}}else{if(bE){return{orientation:U.HORIZONTAL,a:bF.topbz[0]?1:-1},aa=function(bz){return function(bB,bA){var bC=true;if(bz){if(bB[0][0]bA[0][1]}}else{if(bB[0][0]>bA[0][0]){bC=true}else{bC=bB[0][1]>bA[0][1]}}return bC===false?-1:1}},M=function(bA,bz){var bC=bA[0][0]<0?-Math.PI-bA[0][0]:Math.PI-bA[0][0],bB=bz[0][0]<0?-Math.PI-bz[0][0]:Math.PI-bz[0][0];if(bC>bB){return 1}else{return bA[0][1]>bz[0][1]?1:-1}},a2={top:bb,right:aa(true),bottom:aa(true),left:M},ar=function(bz,bA){return bz.sort(bA)},ao=function(bA,bz){var bC=ag[bA],bD=aj[bA],bB=function(bK,bR,bG,bJ,bP,bO,bF){if(bJ.length>0){var bN=ar(bJ,a2[bK]),bL=bK==="right"||bK==="top",bE=a5(bK,bR,bG,bN,bP,bO,bL);var bS=function(bV,bU){var bT=bs([bU[0],bU[1]],bV.canvas);ak[bV.id]=[bT[0],bT[1],bU[2],bU[3]];aM[bV.id]=bF};for(var bH=0;bH0){bS.connections[0].setHover(b7,false)}else{bS.setHover(b7)}};D(bS.endpoint,bS,b6);this.setPaintStyle(b5.paintStyle||b5.style||br.Defaults.EndpointStyle||n.Defaults.EndpointStyle,true);this.setHoverPaintStyle(b5.hoverPaintStyle||br.Defaults.EndpointHoverStyle||n.Defaults.EndpointHoverStyle,true);this.paintStyleInUse=this.getPaintStyle();var bN=this.getPaintStyle();this.connectorStyle=b5.connectorStyle;this.connectorHoverStyle=b5.connectorHoverStyle;this.connectorOverlays=b5.connectorOverlays;this.connector=b5.connector;this.connectorTooltip=b5.connectorTooltip;this.connectorClass=b5.connectorClass;this.connectorHoverClass=b5.connectorHoverClass;this.isSource=b5.isSource||false;this.isTarget=b5.isTarget||false;var bY=b5.maxConnections||br.Defaults.MaxConnections;this.getAttachedElements=function(){return bS.connections};this.canvas=this.endpoint.canvas;this.connections=b5.connections||[];this.scope=b5.scope||R;this.connectionType=b5.connectionType;this.timestamp=null;bS.isReattach=b5.reattach||false;bS.connectionsDetachable=br.Defaults.ConnectionsDetachable;if(b5.connectionsDetachable===false||b5.detachable===false){bS.connectionsDetachable=false}var bM=b5.dragAllowedWhenFull||true;if(b5.onMaxConnections){bS.bind("maxConnections",b5.onMaxConnections)}this.computeAnchor=function(b7){return bS.anchor.compute(b7)};this.addConnection=function(b7){bS.connections.push(b7)};this.detach=function(b8,cd,b9,cg,b7){var cf=g(bS.connections,function(ci){return ci.id==b8.id}),ce=false;cg=(cg!==false);if(cf>=0){if(b9||b8._forceDetach||b8.isDetachable()||b8.isDetachAllowed(b8)){var ch=b8.endpoints[0]==bS?b8.endpoints[1]:b8.endpoints[0];if(b9||b8._forceDetach||(bS.isDetachAllowed(b8))){bS.connections.splice(cf,1);if(!cd){ch.detach(b8,true,b9);if(b8.endpointsToDeleteOnDetach){for(var cc=0;cc0){bS.detach(bS.connections[0],false,true,b8,b7)}};this.detachFrom=function(ca,b9,b7){var cb=[];for(var b8=0;b8=0){bS.connections.splice(b7,1)}};this.getElement=function(){return bR};this.setElement=function(ca,b7){var cc=H(ca);A(aV[bS.elementId],function(cd){return cd.id==bS.id});bR=C(ca);bJ=H(bR);bS.elementId=bJ;var cb=ay({source:cc,container:b7}),b9=bD.getParent(bS.canvas);bD.removeElement(bS.canvas,b9);bD.appendElement(bS.canvas,cb);for(var b8=0;b80){var cj=bO(ca.elementWithPrecedence),cl=cj.endpoints[0]==bS?1:0,cc=cl==0?cj.sourceId:cj.targetId,ci=aj[cc],ck=ag[cc];b9.txy=[ci.left,ci.top];b9.twh=ck;b9.tElement=cj.endpoints[cl]}cd=bS.anchor.compute(b9)}var ch=bP.compute(cd,bS.anchor.getOrientation(bS),bS.paintStyleInUse,cb||bS.paintStyleInUse);bP.paint(ch,bS.paintStyleInUse,bS.anchor);bS.timestamp=cg;for(var ce=0;ce0?u:n+u:u*n;return jsPlumbUtil.pointOnLine({x:i,y:h},{x:e,y:d},t)}}};this.gradientAtPoint=function(t){return f};this.pointAlongPathFrom=function(t,x,w){var v=s.pointOnPath(t,w),u=t==1?{x:i+((e-i)*10),y:h+((h-d)*10)}:{x:e,y:d};return jsPlumbUtil.pointOnLine(v,u,x)}};jsPlumb.Connectors.Bezier=function(w){var q=this;w=w||{};this.majorAnchor=w.curviness||150;this.minorAnchor=10;var u=null;this.type="Bezier";this._findControlPoint=function(I,x,D,y,B,G,z){var F=G.getOrientation(y),H=z.getOrientation(B),C=F[0]!=H[0]||F[1]==H[1],A=[],J=q.majorAnchor,E=q.minorAnchor;if(!C){if(F[0]==0){A.push(x[0]v){v=D}if(G<0){t+=G;var I=Math.abs(G);v+=I;r[0]+=I;g+=I;p+=I;m[0]+=I}var Q=Math.min(f,o),O=Math.min(r[1],m[1]),C=Math.min(Q,O),H=Math.max(f,o),F=Math.max(r[1],m[1]),z=Math.max(H,F);if(z>e){e=z}if(C<0){s+=C;var E=Math.abs(C);e+=E;r[1]+=E;f+=E;o+=E;m[1]+=E}if(M&&v0?0:1,x)}return x};this.pointOnPath=function(x,z){var y=d();x=n(y,x,z);return jsBezier.pointOnCurve(y,x)};this.gradientAtPoint=function(x,z){var y=d();x=n(y,x,z);return jsBezier.gradientAtPoint(y,x)};this.pointAlongPathFrom=function(x,A,z){var y=d();x=n(y,x,z);return jsBezier.pointAlongCurveFrom(y,x,A)}};jsPlumb.Connectors.Flowchart=function(z){this.type="Flowchart";z=z||{};var r=this,e=z.stub||z.minStubLength||30,i=jsPlumbUtil.isArray(e)?e[0]:e,o=jsPlumbUtil.isArray(e)?e[1]:e,t=z.gap||0,u=[],m=0,g=[],q=[],v=[],s,p,y=-Infinity,w=-Infinity,A=Infinity,x=Infinity,d=z.grid,f=function(G,C){var F=G%C,D=Math.floor(G/C),E=F>(C/2)?1:0;return(D+E)*C},n=function(C,F,E,D){return[E||d==null?C:f(C,d[0]),D||d==null?F:f(F,d[1])]},B=function(D,C,H,G){var F=0;for(var E=0;E0?E/m:(m+E)/m}var C=g.length-1,D=1;for(var F=0;F=E){C=F;D=(E-g[F][0])/q[F];break}}return{segment:u[C],proportion:D,index:C}};this.compute=function(Z,an,C,T,ay,N,X,S,at,ap){u=[];g=[];m=0;q=[];y=w=-Infinity;A=x=Infinity;s=an[0]ax?0:1,ah=[1,0][af];Q=[];az=[];Q[af]=Z[af]>an[af]?-1:1;az[af]=Z[af]>an[af]?1:-1;Q[ah]=0;az[ah]=0}var L=s?(ao-E)+(t*Q[0]):H+(t*Q[0]),K=p?(ax-D)+(t*Q[1]):G+(t*Q[1]),av=s?H+(t*az[0]):(ao-E)+(t*az[0]),au=p?G+(t*az[1]):(ax-D)+(t*az[1]),ac=L+(Q[0]*i),ab=K+(Q[1]*i),O=av+(az[0]*o),M=au+(az[1]*o),Y=Math.abs(L-av)>(i+o),aa=Math.abs(K-au)>(i+o),ak=ac+((O-ac)/2),ai=ab+((M-ab)/2),R=((Q[0]*az[0])+(Q[1]*az[1])),ae=R==-1,ag=R==0,F=R==1;am-=H;al-=G;v=[am,al,ao,ax,L,K,av,au];var ar=[];var V=Q[0]==0?"y":"x",P=ae?"opposite":F?"orthogonal":"perpendicular",I=jsPlumbUtil.segment([L,K],[av,au]),aj=Q[V=="x"?0:1]==-1,U={x:[null,4,3,2,1],y:[null,2,1,4,3]};if(aj){I=U[V][I]}k(ac,ab,L,K,av,au);var W=function(aD,aC,aA,aB){return aD+(aC*((1-aA)*aB)+Math.max(i,o))},J={oppositex:function(){if(C.elementId==T.elementId){var aA=ab+((1-ay.y)*at.height)+Math.max(i,o);return[[ac,aA],[O,aA]]}else{if(Y&&(I==1||I==2)){return[[ak,K],[ak,au]]}else{return[[ac,ai],[O,ai]]}}},orthogonalx:function(){if(I==1||I==2){return[[O,ab]]}else{return[[ac,M]]}},perpendicularx:function(){var aA=(au+K)/2;if((I==1&&az[1]==1)||(I==2&&az[1]==-1)){if(Math.abs(av-L)>Math.max(i,o)){return[[O,ab]]}else{return[[ac,ab],[ac,aA],[O,aA]]}}else{if((I==3&&az[1]==-1)||(I==4&&az[1]==1)){return[[ac,aA],[O,aA]]}else{if((I==3&&az[1]==1)||(I==4&&az[1]==-1)){return[[ac,M]]}else{if((I==1&&az[1]==-1)||(I==2&&az[1]==1)){if(Math.abs(av-L)>Math.max(i,o)){return[[ak,ab],[ak,M]]}else{return[[ac,M]]}}}}}},oppositey:function(){if(C.elementId==T.elementId){var aA=ac+((1-ay.x)*at.width)+Math.max(i,o);return[[aA,ab],[aA,M]]}else{if(aa&&(I==2||I==3)){return[[L,ai],[av,ai]]}else{return[[ak,ab],[ak,M]]}}},orthogonaly:function(){if(I==2||I==3){return[[ac,M]]}else{return[[O,ab]]}},perpendiculary:function(){var aA=(av+L)/2;if((I==2&&az[0]==-1)||(I==3&&az[0]==1)){if(Math.abs(av-L)>Math.max(i,o)){return[[ac,M]]}else{return[[ac,ai],[O,ai]]}}else{if((I==1&&az[0]==-1)||(I==4&&az[0]==1)){var aA=(av+L)/2;return[[aA,ab],[aA,M]]}else{if((I==1&&az[0]==1)||(I==4&&az[0]==-1)){return[[O,ab]]}else{if((I==2&&az[0]==1)||(I==3&&az[0]==-1)){if(Math.abs(au-K)>Math.max(i,o)){return[[ac,ai],[O,ai]]}else{return[[O,ab]]}}}}}}};var aq=J[P+V]();if(aq){for(var aw=0;awv[3]){v[3]=w+(X*2)}if(y>v[2]){v[2]=y+(X*2)}return v};this.pointOnPath=function(C,D){return r.pointAlongPathFrom(C,0,D)};this.gradientAtPoint=function(C,D){return u[h(C,D)["index"]][4]};this.pointAlongPathFrom=function(J,C,I){var K=h(J,I),G=K.segment,D=K.proportion,F=u[K.index][5],E=u[K.index][4];var H={x:E==Infinity?G[2]:G[2]>G[0]?G[0]+((1-D)*F)-C:G[2]+(D*F)+C,y:E==0?G[3]:G[3]>G[1]?G[1]+((1-D)*F)-C:G[3]+(D*F)+C,segmentInfo:K};return H}};jsPlumb.Endpoints.Dot=function(e){this.type="Dot";var d=this;e=e||{};this.radius=e.radius||10;this.defaultOffset=0.5*this.radius;this.defaultInnerRadius=this.radius/3;this.compute=function(k,g,m,i){var h=m.radius||d.radius,f=k[0]-h,l=k[1]-h;return[f,l,h*2,h*2,h]}};jsPlumb.Endpoints.Rectangle=function(e){this.type="Rectangle";var d=this;e=e||{};this.width=e.width||20;this.height=e.height||20;this.compute=function(l,h,n,k){var i=n.width||d.width,g=n.height||d.height,f=l[0]-(i/2),m=l[1]-(g/2);return[f,m,i,g]}};var b=function(f){jsPlumb.DOMElementComponent.apply(this,arguments);var d=this;var e=[];this.getDisplayElements=function(){return e};this.appendDisplayElement=function(g){e.push(g)}};jsPlumb.Endpoints.Image=function(i){this.type="Image";b.apply(this,arguments);var n=this,h=false,g=false,f=i.width,e=i.height,l=null,d=i.endpoint;this.img=new Image();n.ready=false;this.img.onload=function(){n.ready=true;f=f||n.img.width;e=e||n.img.height;if(l){l(n)}};d.setImage=function(o,q){var p=o.constructor==String?o:o.src;l=q;n.img.src=o;if(n.canvas!=null){n.canvas.setAttribute("src",o)}};d.setImage(i.src||i.url,i.onload);this.compute=function(q,o,r,p){n.anchorPoint=q;if(n.ready){return[q[0]-f/2,q[1]-e/2,f,e]}else{return[0,0,0,0]}};n.canvas=document.createElement("img"),h=false;n.canvas.style.margin=0;n.canvas.style.padding=0;n.canvas.style.outline=0;n.canvas.style.position="absolute";var k=i.cssClass?" "+i.cssClass:"";n.canvas.className=jsPlumb.endpointClass+k;if(f){n.canvas.setAttribute("width",f)}if(e){n.canvas.setAttribute("height",e)}jsPlumb.appendElement(n.canvas,i.parent);n.attachListeners(n.canvas,n);n.cleanup=function(){g=true};var m=function(r,q,p){if(!g){if(!h){n.canvas.setAttribute("src",n.img.src);n.appendDisplayElement(n.canvas);h=true}var o=n.anchorPoint[0]-(f/2),s=n.anchorPoint[1]-(e/2);jsPlumb.sizeCanvas(n.canvas,o,s,f,e)}};this.paint=function(q,p,o){if(n.ready){m(q,p,o)}else{window.setTimeout(function(){n.paint(q,p,o)},200)}}};jsPlumb.Endpoints.Blank=function(e){var d=this;this.type="Blank";b.apply(this,arguments);this.compute=function(h,f,i,g){return[h[0],h[1],10,0]};d.canvas=document.createElement("div");d.canvas.style.display="block";d.canvas.style.width="1px";d.canvas.style.height="1px";d.canvas.style.background="transparent";d.canvas.style.position="absolute";d.canvas.className=d._jsPlumb.endpointClass;jsPlumb.appendElement(d.canvas,e.parent);this.paint=function(h,g,f){jsPlumb.sizeCanvas(d.canvas,h[0],h[1],h[2],h[3])}};jsPlumb.Endpoints.Triangle=function(d){this.type="Triangle";d=d||{};d.width=d.width||55;d.height=d.height||55;this.width=d.width;this.height=d.height;this.compute=function(k,g,m,i){var h=m.width||self.width,f=m.height||self.height,e=k[0]-(h/2),l=k[1]-(f/2);return[e,l,h,f]}};var c=function(f){var e=true,d=this;this.isAppendedAtTopLevel=true;this.component=f.component;this.loc=f.location==null?0.5:f.location;this.endpointLoc=f.endpointLocation==null?[0.5,0.5]:f.endpointLocation;this.setVisible=function(g){e=g;d.component.repaint()};this.isVisible=function(){return e};this.hide=function(){d.setVisible(false)};this.show=function(){d.setVisible(true)};this.incrementLocation=function(g){d.loc+=g;d.component.repaint()};this.setLocation=function(g){d.loc=g;d.component.repaint()};this.getLocation=function(){return d.loc}};jsPlumb.Overlays.Arrow=function(h){this.type="Arrow";c.apply(this,arguments);this.isAppendedAtTopLevel=false;h=h||{};var e=this;this.length=h.length||20;this.width=h.width||20;this.id=h.id;var g=(h.direction||1)<0?-1:1,f=h.paintStyle||{lineWidth:1},d=h.foldback||0.623;this.computeMaxSize=function(){return e.width*1.5};this.cleanup=function(){};this.draw=function(m,A,v){var p,w,i,q,o;if(m.pointAlongPathFrom){if(jsPlumbUtil.isString(e.loc)||e.loc>1||e.loc<0){var k=parseInt(e.loc);p=m.pointAlongPathFrom(k,g*e.length/2,true),w=m.pointOnPath(k,true),i=jsPlumbUtil.pointOnLine(p,w,e.length)}else{if(e.loc==1){p=m.pointOnPath(e.loc);w=m.pointAlongPathFrom(e.loc,-1);i=jsPlumbUtil.pointOnLine(p,w,e.length)}else{if(e.loc==0){i=m.pointOnPath(e.loc);w=m.pointAlongPathFrom(e.loc,1);p=jsPlumbUtil.pointOnLine(i,w,e.length)}else{p=m.pointAlongPathFrom(e.loc,g*e.length/2),w=m.pointOnPath(e.loc),i=jsPlumbUtil.pointOnLine(p,w,e.length)}}}q=jsPlumbUtil.perpendicularLineTo(p,i,e.width);o=jsPlumbUtil.pointOnLine(p,i,d*e.length);var z=Math.min(p.x,q[0].x,q[1].x),t=Math.max(p.x,q[0].x,q[1].x),y=Math.min(p.y,q[0].y,q[1].y),s=Math.max(p.y,q[0].y,q[1].y);var r={hxy:p,tail:q,cxy:o},u=f.strokeStyle||A.strokeStyle,x=f.fillStyle||A.strokeStyle,n=f.lineWidth||A.lineWidth;e.paint(m,r,n,u,x,v);return[z,t,y,s]}else{return[0,0,0,0]}}};jsPlumb.Overlays.PlainArrow=function(e){e=e||{};var d=jsPlumb.extend(e,{foldback:1});jsPlumb.Overlays.Arrow.call(this,d);this.type="PlainArrow"};jsPlumb.Overlays.Diamond=function(f){f=f||{};var d=f.length||40,e=jsPlumb.extend(f,{length:d/2,foldback:2});jsPlumb.Overlays.Arrow.call(this,e);this.type="Diamond"};var a=function(i){jsPlumb.DOMElementComponent.apply(this,arguments);c.apply(this,arguments);var d=this,e=false;i=i||{};this.id=i.id;var l;var h=function(){l=i.create(i.component);l=jsPlumb.CurrentLibrary.getDOMElement(l);l.style.position="absolute";var m=i._jsPlumb.overlayClass+" "+(d.cssClass?d.cssClass:i.cssClass?i.cssClass:"");l.className=m;jsPlumb.appendElement(l,i.component.parent);i._jsPlumb.getId(l);d.attachListeners(l,d);d.canvas=l};this.getElement=function(){if(l==null){h()}return l};this.getDimensions=function(){return jsPlumb.CurrentLibrary.getSize(jsPlumb.CurrentLibrary.getElementObject(d.getElement()))};var f=null,k=function(m){if(f==null){f=d.getDimensions()}return f};this.clearCachedDimensions=function(){f=null};this.computeMaxSize=function(){var m=k();return Math.max(m[0],m[1])};var g=d.setVisible;d.setVisible=function(m){g(m);l.style.display=m?"block":"none"};this.cleanup=function(){if(l!=null){jsPlumb.CurrentLibrary.removeElement(l)}};this.paint=function(m,o,n){if(!e){d.getElement();m.appendDisplayElement(l);d.attachListeners(l,m);e=true}l.style.left=(n[0]+o.minx)+"px";l.style.top=(n[1]+o.miny)+"px"};this.draw=function(n,o,p){var t=k();if(t!=null&&t.length==2){var q={x:0,y:0};if(n.pointOnPath){var r=d.loc,s=false;if(jsPlumbUtil.isString(d.loc)||d.loc<0||d.loc>1){r=parseInt(d.loc);s=true}q=n.pointOnPath(r,s)}else{var m=d.loc.constructor==Array?d.loc:d.endpointLoc;q={x:m[0]*p[2],y:m[1]*p[3]}}minx=q.x-(t[0]/2),miny=q.y-(t[1]/2);d.paint(n,{minx:minx,miny:miny,td:t,cxy:q},p);return[minx,minx+t[0],miny,miny+t[1]]}else{return[0,0,0,0]}};this.reattachListeners=function(m){if(l){d.reattachListenersForElement(l,d,m)}}};jsPlumb.Overlays.Custom=function(d){this.type="Custom";a.apply(this,arguments)};jsPlumb.Overlays.Label=function(h){var d=this;this.labelStyle=h.labelStyle||jsPlumb.Defaults.LabelStyle;this.cssClass=this.labelStyle!=null?this.labelStyle.cssClass:null;h.create=function(){return document.createElement("div")};jsPlumb.Overlays.Custom.apply(this,arguments);this.type="Label";var f=h.label||"",d=this,g=null;this.setLabel=function(k){f=k;g=null;d.clearCachedDimensions();e();d.component.repaint()};var e=function(){if(typeof f=="function"){var k=f(d);d.getElement().innerHTML=k.replace(/\r\n/g,"
")}else{if(g==null){g=f;d.getElement().innerHTML=g.replace(/\r\n/g,"
")}}};this.getLabel=function(){return f};var i=this.getDimensions;this.getDimensions=function(){e();return i()}}})();(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 u=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,t=l.showLoopback!==false;this.type="StateMachine";l=l||{};this.compute=function(ad,H,W,I,ac,z,v,U){var Q=Math.abs(ad[0]-H[0]),Y=Math.abs(ad[1]-H[1]),S=0.45*Q,ab=0.45*Y;Q*=1.9;Y*=1.9;v=v||1;var O=Math.min(ad[0],H[0])-S,M=Math.min(ad[1],H[1])-ab;if(!t||(W.elementId!=I.elementId)){h=false;o=ad[0]0?0:1,v)}return v};this.pointOnPath=function(x,B){if(h){if(B){var y=Math.PI*2*i;x=x/y}if(x>0&&x<1){x=1-x}var z=(x*2*Math.PI)+(Math.PI/2),w=n[4]+(n[6]*Math.cos(z)),v=n[5]+(n[6]*Math.sin(z));return{x:w,y:v}}else{var A=r();x=s(A,x,B);return jsBezier.pointOnCurve(A,x)}};this.gradientAtPoint=function(v,y){if(h){if(y){var w=Math.PI*2*i;v=v/w}return Math.atan(v*2*Math.PI)}else{var x=r();v=s(x,v,y);return jsBezier.gradientAtPoint(x,v)}};this.pointAlongPathFrom=function(D,v,C){if(h){if(C){var B=Math.PI*2*i;D=D/B}if(D>0&&D<1){D=1-D}var B=2*Math.PI*n[6],w=v/B*2*Math.PI,z=(D*2*Math.PI)-w+(Math.PI/2),y=n[4]+(n[6]*Math.cos(z)),x=n[5]+(n[6]*Math.sin(z));return{x:y,y:x}}else{var A=r();D=s(A,D,C);return jsBezier.pointAlongCurveFrom(A,D,v)}}};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.bezierCurveTo(l[8],l[9],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 h={"stroke-linejoin":"joinstyle",joinstyle:"joinstyle",endcap:"endcap",miterlimit:"miterlimit"},c=null;if(document.createStyleSheet&&document.namespaces){var m=[".jsplumb_vml","jsplumb\\:textbox","jsplumb\\:oval","jsplumb\\:rect","jsplumb\\:stroke","jsplumb\\:shape","jsplumb\\:group"],g="behavior:url(#default#VML);position:absolute;";c=document.createStyleSheet();for(var r=0;r0&&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;s0?c[0].tagName:null},getUIPosition:function(c,d){d=d||1;if(c.length==1){ret={left:c[0].pageX,top:c[0].pageY}}else{var e=c[1],b=e.offset;ret=b||e.absolutePosition;e.position.left/=d;e.position.top/=d}return{left:ret.left/d,top:ret.top/d}},hasClass:function(c,b){return c.hasClass(b)},initDraggable:function(c,b,d){b=b||{};b.helper=null;if(d){b.scope=b.scope||jsPlumb.Defaults.Scope}c.draggable(b)},initDroppable:function(c,b){b.scope=b.scope||jsPlumb.Defaults.Scope;c.droppable(b)},isAlreadyDraggable:function(b){b=jsPlumb.CurrentLibrary.getElementObject(b);return b.hasClass("ui-draggable")},isDragSupported:function(c,b){return c.draggable},isDropSupported:function(c,b){return c.droppable},removeClass:function(c,b){c=jsPlumb.CurrentLibrary.getElementObject(c);try{if(c[0].className.constructor==SVGAnimatedString){jsPlumb.util.svg.removeClass(c[0],b)}}catch(d){}c.removeClass(b)},removeElement:function(b,c){jsPlumb.CurrentLibrary.getElementObject(b).remove()},setAttribute:function(c,d,b){c.attr(d,b)},setDraggable:function(c,b){c.draggable("option","disabled",!b)},setDragScope:function(c,b){c.draggable("option","scope",b)},setOffset:function(b,c){jsPlumb.CurrentLibrary.getElementObject(b).offset(c)},trigger:function(d,e,b){var c=jQuery._data(jsPlumb.CurrentLibrary.getElementObject(d)[0],"handle");c(b)},unbind:function(b,c,d){b=jsPlumb.CurrentLibrary.getElementObject(b);b.unbind(c,d)}};a(document).ready(jsPlumb.init)})(jQuery);(function(){"undefined"==typeof Math.sgn&&(Math.sgn=function(l){return 0==l?0:0=64){x[0]=(C[0].x+C[B].x)/2;return 1}var p,u=C[0].y-C[B].y;y=C[B].x-C[0].x;q=C[0].x*C[B].y-C[B].x*C[0].y;s=max_distance_below=0;for(p=1;ps?s=r:r0?1:-1,r=null;n1){l.location=1}if(l.location<0){l.location=0}return i(m,l.location)},nearestPointOnCurve:function(m,l){var n=h(m,l);return{point:k(l,l.length-1,n.location,null,null),location:n.location}},pointOnCurve:c,pointAlongCurveFrom:function(m,l,n){return b(m,l,n).point},perpendicularToCurveAt:function(m,l,n,o){l=b(m,l,o==null?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}]},locationAlongCurveFrom:function(m,l,n){return b(m,l,n).location}}})();