mootools.jsPlumb-1.2.4-all-min.js 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. (function(){var Z=function(){var w=function(){var a={};this.bind=function(b,e){if(b.constructor==Array)for(var h=0;h<b.length;h++)C(a,b[h],e);else C(a,b,e)};this.fireUpdate=function(b,e){if(a[b])for(var h=0;h<a[b].length;h++)try{a[b][h][b](e)}catch(n){G("jsPlumb: fireUpdate failed for event "+b+";not fatal.")}};this.clearListeners=function(){delete a;a={}}},o=this,y=!!!document.createElement("canvas").getContext,t={},v={},u={},j={},f={},c={},d={},r=true,q=[],k="DEFAULT",g=1200,p=function(a,b,e){var h=
  2. function(m,A){if(m===A)return true;else if(typeof m=="object"&&typeof A=="object"){var D=true,F;for(F in m)if(!h(m[F],A[F])){D=false;break}for(F in A)if(!h(A[F],m[F])){D=false;break}return D}};e=+e||0;for(var n=a.length;e<n;e++)if(h(a[e],b))return e;return-1},C=function(a,b,e){var h=a[b];if(h==null){h=[];a[b]=h}h.push(e);return h},I=function(a,b,e){a=J(a,"id");var h=t[a];e||(e=""+(new Date).getTime());if(h){V({elId:a,offset:b,recalc:false,timestamp:e});for(var n=j[a],m=q[a],A=0;A<h.length;A++){h[A].paint({timestamp:e,
  3. offset:n,dimensions:m});for(var D=h[A].connections,F=0;F<D.length;F++){D[F].paint({elId:a,ui:b,recalc:false,timestamp:e});var B=D[F].endpoints[0]==h[A]?1:0;if(D[F].endpoints[B].anchor.isDynamic&&!D[F].endpoints[B].isFloating()){var N=B==0?D[F].sourceId:D[F].targetId,K=j[N];N=D[F].endpoints[B].anchor.compute({xy:[K.left,K.top],wh:q[N],element:D[F].endpoints[B],txy:[n.left,n.top],twh:m,tElement:h[A]});D[F].endpoints[B].paint({anchorLoc:N})}}}}},H=function(a,b){var e=null;if(a.constructor==Array){e=
  4. [];for(var h=0;h<a.length;h++){var n=x(a[h]),m=J(n,"id");e.push(b(n,m))}}else{n=x(a);m=J(n,"id");e=b(n,m)}return e},G=function(a){o.logEnabled&&typeof console!="undefined"&&console.log(a)},J=function(a,b){return l.CurrentLibrary.getAttribute(x(a),b)},x=function(a){return l.CurrentLibrary.getElementObject(a)},R=function(a){return l.CurrentLibrary.getSize(x(a))},W=function(a,b){var e=x(a),h=J(e,"id");if(!h){var n=h=arguments.length==2?b:"_jsPlumb_"+(""+(new Date).getTime());l.CurrentLibrary.setAttribute(x(e),
  5. "id",n)}return h},ca=function(a,b,e){if(b=b==null?r:b)if(l.CurrentLibrary.isDragSupported(a)){e=e||o.Defaults.DragOptions||l.Defaults.DragOptions;e=l.extend({},e);b=l.CurrentLibrary.dragEvents.drag;var h=l.CurrentLibrary.dragEvents.stop;e[b]=T(e[b],function(){var n=l.CurrentLibrary.getUIPosition(arguments);I(a,n);l.CurrentLibrary.addClass(x(a),"jsPlumb_dragged")});e[h]=T(e[h],function(){var n=l.CurrentLibrary.getUIPosition(arguments);I(a,n);l.CurrentLibrary.removeClass(x(a),"jsPlumb_dragged")});b=
  6. d[W(a)];e.disabled=b==null?false:!b;l.CurrentLibrary.initDraggable(a,e)}},ia=function(a,b,e){var h=document.createElement("canvas"),n=h;b?l.CurrentLibrary.appendElement(n,b):document.body.appendChild(n);h.style.position="absolute";if(a)h.className=a;W(h,e);if(y){l.sizeCanvas(h,0,0,g,g);h=G_vmlCanvasManager.initElement(h)}return h},ea=function(a,b){var e=t[a];if(e&&e.length)for(var h=0;h<e.length;h++)for(var n=0;n<e[h].connections.length;n++)if(b(e[h].connections[n]))return},X=function(a,b){if(a!=
  7. null)if(b)l.CurrentLibrary.removeElement(a,b);else try{document.body.removeChild(a)}catch(e){}},da=function(a,b,e){a=a[b];if(a!=null){e=p(a,e);if(e>=0){delete a[e];a.splice(e,1);return true}}return false},ja=function(a,b){ea(J(a,"id"),function(e){e.canvas.style.display=b})},na=function(a){ea(a,function(b){b.canvas.style.display="none"==b.canvas.style.display?"block":"none"})},V=function(a){var b=a.timestamp,e=a.recalc,h=a.offset;a=a.elId;if(!e)if(b&&b===f[a])return;if(e||h==null){e=x(a);q[a]=R(e);
  8. j[a]=l.CurrentLibrary.getOffset(x(e));f[a]=b}else j[a]=h},T=function(a,b){a=a||function(){};b=b||function(){};return function(){var e=null;try{e=b.apply(this,arguments)}catch(h){G("jsPlumb function failed : "+h)}try{a.apply(this,arguments)}catch(n){G("wrapped function failed : "+n)}return e}},ka=function(a){var b=this;this.x=a.x||0;this.y=a.y||0;var e=a.orientation||[0,0],h=null;this.offsets=a.offsets||[0,0];b.timestamp=null;this.compute=function(n){var m=n.xy,A=n.wh,D=n.element;if((n=n.timestamp)&&
  9. n===b.timestamp)return h;h=[m[0]+b.x*A[0]+b.offsets[0],m[1]+b.y*A[1]+b.offsets[1]];A=D?D.container:null;m={left:0,top:0};if(A!=null){var F=x(A);A=l.CurrentLibrary.getOffset(x(F));D=l.CurrentLibrary.getScrollLeft(F);F=l.CurrentLibrary.getScrollTop(F);m.left=A.left-D;m.top=A.top-F;h[0]-=m.left;h[1]-=m.top}b.timestamp=n;return h};this.getOrientation=function(){return e};this.equals=function(n){if(!n)return false;var m=n.getOrientation(),A=this.getOrientation();return this.x==n.x&&this.y==n.y&&this.offsets[0]==
  10. n.offsets[0]&&this.offsets[1]==n.offsets[1]&&A[0]==m[0]&&A[1]==m[1]};this.getCurrentLocation=function(){return h}},oa=function(a){var b=a.reference,e=R(x(a.referenceCanvas)),h=null,n=null;this.compute=function(m){var A=m.xy;m=m.element;A=[A[0]+e[0]/2,A[1]+e[1]/2];if(m.container!=null){m=l.CurrentLibrary.getOffset(x(m.container));A[0]-=m.left;A[1]-=m.top}return n=A};this.getOrientation=function(){if(h)return h;else{var m=b.getOrientation();return[Math.abs(m[0])*0*-1,Math.abs(m[1])*0*-1]}};this.over=
  11. function(m){h=m.getOrientation()};this.out=function(){h=null};this.getCurrentLocation=function(){return n}},pa=function(a){this.isDynamic=this.isSelective=true;var b=a||[];for(a=0;a<b.length;a++)b[a]=b[a].constructor==Array?l.makeAnchor(b[a]):b[a];this.addAnchor=function(n){b.push(n.constructor==Array?l.makeAnchor(n):n)};this.getAnchors=function(){return b};var e=b.length>0?b[0]:null;this.locked=false;var h=this;this.compute=function(n){var m=n.xy,A=n.wh,D=n.txy,F=n.twh;if(h.locked||D==null||F==null)return e.compute(n);
  12. else n.timestamp=null;var B=D[0]+F[0]/2;D=D[1]+F[1]/2;F=-1;for(var N=Infinity,K=0;K<b.length;K++){var O=Math.sqrt(Math.pow(B-(m[0]+b[K].x*A[0]),2)+Math.pow(D-(m[1]+b[K].y*A[1]),2));if(O<N){F=K+0;N=O}}e=b[F];return e.compute(n)};this.getCurrentLocation=function(){return e!=null?e.getCurrentLocation():null};this.getOrientation=function(){return e!=null?e.getOrientation():[0,0]};this.over=function(n){e!=null&&e.over(n)};this.out=function(){e!=null&&e.out()}},ha=function(a){w.apply(this);var b=this,e=
  13. new String("_jsplumb_c_"+(new Date).getTime());this.getId=function(){return e};this.container=a.container||o.Defaults.Container;this.source=x(a.source);this.target=x(a.target);if(a.sourceEndpoint)this.source=a.sourceEndpoint.getElement();if(a.targetEndpoint)this.target=a.targetEndpoint.getElement();this.sourceId=J(this.source,"id");this.targetId=J(this.target,"id");this.endpointsOnTop=a.endpointsOnTop!=null?a.endpointsOnTop:true;this.scope=a.scope;this.endpoints=[];this.endpointStyles=[];var h=function(B){if(B)return l.makeAnchor(B)},
  14. n=function(B,N,K,O){if(B){b.endpoints[N]=B;B.addConnection(b)}else{if(!K.endpoints)K.endpoints=[null,null];B=K.endpoints[N]||K.endpoint||o.Defaults.Endpoints[N]||l.Defaults.Endpoints[N]||o.Defaults.Endpoint||l.Defaults.Endpoint||new l.Endpoints.Dot;if(B.constructor==String)B=new l.Endpoints[B];if(!K.endpointStyles)K.endpointStyles=[null,null];var E=K.endpointStyles[N]||K.endpointStyle||o.Defaults.EndpointStyles[N]||l.Defaults.EndpointStyles[N]||o.Defaults.EndpointStyle||l.Defaults.EndpointStyle,S=
  15. K.anchors?K.anchors[N]:h(o.Defaults.Anchors[N])||h(l.Defaults.Anchors[N])||h(o.Defaults.Anchor)||h(l.Defaults.Anchor)||h("BottomCenter");K=new fa({style:E,endpoint:B,connections:[b],uuid:K.uuids?K.uuids[N]:null,anchor:S,source:O,container:b.container});return b.endpoints[N]=K}},m=n(a.sourceEndpoint,0,a,b.source);m&&C(t,this.sourceId,m);(n=n(a.targetEndpoint,1,a,b.target))&&C(t,this.targetId,n);if(!this.scope)this.scope=this.endpoints[0].scope;this.connector=this.endpoints[0].connector||this.endpoints[1].connector||
  16. a.connector||o.Defaults.Connector||l.Defaults.Connector||new l.Connectors.Bezier;if(this.connector.constructor==String)this.connector=new l.Connectors[this.connector];this.paintStyle=this.endpoints[0].connectorStyle||this.endpoints[1].connectorStyle||a.paintStyle||o.Defaults.PaintStyle||l.Defaults.PaintStyle;this.backgroundPaintStyle=this.endpoints[0].connectorBackgroundStyle||this.endpoints[1].connectorBackgroundStyle||a.backgroundPaintStyle||o.Defaults.BackgroundPaintStyle||l.Defaults.BackgroundPaintStyle;
  17. this.overlays=a.overlays||[];this.addOverlay=function(B){overlays.push(B)};this.labelStyle=a.labelStyle||o.Defaults.LabelStyle||l.Defaults.LabelStyle;(this.label=a.label)&&this.overlays.push(new l.Overlays.Label({labelStyle:this.labelStyle,label:this.label}));V({elId:this.sourceId});V({elId:this.targetId});this.distanceFrom=function(B){return b.connector.distanceFrom(B)};this.setLabel=function(B){b.label=B;o.repaint(b.source)};n=j[this.sourceId];m=q[this.sourceId];var A=j[this.targetId];otherWH=q[this.targetId];
  18. var D=this.endpoints[0].anchor.compute({xy:[n.left,n.top],wh:m,element:this.endpoints[0],txy:[A.left,A.top],twh:otherWH,tElement:this.endpoints[1]});this.endpoints[0].paint({anchorLoc:D});D=this.endpoints[1].anchor.compute({xy:[A.left,A.top],wh:otherWH,element:this.endpoints[1],txy:[n.left,n.top],twh:m,tElement:this.endpoints[0]});this.endpoints[1].paint({anchorLoc:D});var F=ia(l.connectorClass,b.container);this.canvas=F;this.paint=function(B){B=B||{};var N=B.elId,K=B.ui,O=B.recalc;B=B.timestamp;
  19. var E=this.targetId;if(this.canvas.getContext){V({elId:N,offset:K,recalc:O,timestamp:B});V({elId:E,timestamp:B});K=F.getContext("2d");O=this.endpoints[0].anchor.getCurrentLocation();this.endpoints[0].anchor.getOrientation();B=this.endpoints[1].anchor.getCurrentLocation();this.endpoints[1].anchor.getOrientation();for(var S=E=0;S<b.overlays.length;S++){var Q=b.overlays[S];Q=Q.computeMaxSize(b.connector,K);if(Q>E)E=Q}var M=this.connector.compute(O,B,this.endpoints[0].anchor,this.endpoints[1].anchor,
  20. this.paintStyle.lineWidth,E);l.sizeCanvas(F,M[0],M[1],M[2],M[3]);O=function(P,U){P.save();l.extend(P,U);if(U.gradient&&!y){for(var Y=b.connector.createGradient(M,P,N==this.sourceId),s=0;s<U.gradient.stops.length;s++)Y.addColorStop(U.gradient.stops[s][0],U.gradient.stops[s][1]);P.strokeStyle=Y}b.connector.paint(M,P);P.restore()};this.backgroundPaintStyle!=null&&O(K,this.backgroundPaintStyle);O(K,this.paintStyle);for(S=0;S<b.overlays.length;S++){Q=b.overlays[S];Q.draw(b.connector,K)}}};this.repaint=
  21. function(){this.paint({elId:this.sourceId,recalc:true})};ca(b.source,a.draggable,a.dragOptions);ca(b.target,a.draggable,a.dragOptions);this.source.resize&&this.source.resize(function(){l.repaint(b.sourceId)})},fa=function(a){a=a||{};var b=this,e=new String("_jsplumb_e_"+(new Date).getTime());this.getId=function(){return e};b.anchor=a.anchor?l.makeAnchor(a.anchor):l.makeAnchor("TopCenter");var h=a.endpoint||new l.Endpoints.Dot;if(h.constuctor==String)h=new l.Endpoints[h];b.endpoint=h;var n=a.style||
  22. o.Defaults.EndpointStyle||l.Defaults.EndpointStyle;this.connectorStyle=a.connectorStyle;this.connectorOverlays=a.connectorOverlays;this.connector=a.connector;this.isSource=a.isSource||false;this.isTarget=a.isTarget||false;var m=a.source,A=a.uuid,D=null,F=null;if(A)v[A]=b;this.container=a.container||o.Defaults.Container||l.Defaults.Container;var B=J(m,"id"),N=a.maxConnections||1;this.canvas=a.canvas||ia(l.endpointClass,this.container,a.uuid);this.connections=a.connections||[];this.scope=a.scope||k;
  23. this.timestamp=null;var K=a.reattach||false;this.dragAllowedWhenFull=a.dragAllowedWhenFull||true;this.computeAnchor=function(s){return b.anchor.compute(s)};this.addConnection=function(s){b.connections.push(s)};this.detach=function(s,L){var z=p(b.connections,s);if(z>=0){b.connections.splice(z,1);L||(s.endpoints[0]==b?s.endpoints[1]:s.endpoints[0]).detach(s,true)}X(s.canvas,s.container);da(u,s.scope,s);aa(s)};this.detachAll=function(){for(;b.connections.length>0;)b.detach(b.connections[0])};this.detachFrom=
  24. function(s){for(var L=[],z=0;z<b.connections.length;z++)if(b.connections[z].endpoints[1]==s||b.connections[z].endpoints[0]==s)L.push(b.connections[z]);for(z=0;z<L.length;z++)b.detach(L[z])};this.detachFromConnection=function(s){s=p(b.connections,s);s>=0&&b.connections.splice(s,1)};this.getElement=function(){return m};this.getUuid=function(){return A};this.makeInPlaceCopy=function(){return new fa({anchor:b.anchor,source:m,style:n,endpoint:h})};this.isConnectedTo=function(s){var L=false;if(s)for(var z=
  25. 0;z<b.connections.length;z++)if(b.connections[z].endpoints[1]==s){L=true;break}return L};this.isFloating=function(){return D!=null};this.isFull=function(){return N<1?false:b.connections.length>=N};this.setDragAllowedWhenFull=function(s){b.dragAllowedWhenFull=s};this.equals=function(s){return this.anchor.equals(s.anchor)};this.paint=function(s){s=s||{};var L=s.timestamp;if(!L||b.timestamp!==L){var z=s.anchorPoint,ba=s.canvas,qa=s.connectorPaintStyle;if(z==null){z=s.offset||j[B];s=s.dimensions||q[B];
  26. if(z==null||s==null){V({elId:B,timestamp:L});z=j[B];s=q[B]}s={xy:[z.left,z.top],wh:s,element:b,timestamp:L};if(b.anchor.isDynamic)if(b.connections.length>0){z=b.connections[0];var la=z.endpoints[0]==b?1:0,ga=la==0?z.sourceId:z.targetId,ma=j[ga];ga=q[ga];s.txy=[ma.left,ma.top];s.twh=ga;s.tElement=z.endpoints[la]}z=b.anchor.compute(s)}h.paint(z,b.anchor.getOrientation(),ba||b.canvas,n,qa||n);b.timestamp=L}};this.removeConnection=this.detach;if(a.isSource&&l.CurrentLibrary.isDragSupported(m)){var O=
  27. null;var E=e=null,S=false,Q=null,M=a.dragOptions||{},P=l.extend({},l.CurrentLibrary.defaultDragOptions);M=l.extend(P,M);M.scope=M.scope||b.scope;P=l.CurrentLibrary.dragEvents.start;var U=l.CurrentLibrary.dragEvents.stop,Y=l.CurrentLibrary.dragEvents.drag;M[P]=T(M[P],function(){E=b.connections.length<N?null:b.connections[0];if(b.isFull()&&!b.dragAllowedWhenFull)return false;V({elId:B});F=b.makeInPlaceCopy();F.paint();O=document.createElement("div");var s=x(O),L=O,z=b.container;z?l.CurrentLibrary.appendElement(L,
  28. z):document.body.appendChild(L);L=W(s);V({elId:L});z=x(b.canvas);l.CurrentLibrary.setAttribute(x(z),"dragId",L);z=x(b.canvas);l.CurrentLibrary.setAttribute(x(z),"elId",B);z=new oa({reference:b.anchor,referenceCanvas:b.canvas});D=new fa({style:{fillStyle:"rgba(0,0,0,0)"},endpoint:h,anchor:z,source:s});if(E==null){b.anchor.locked=true;E=new ha({sourceEndpoint:b,targetEndpoint:D,source:x(m),target:x(O),anchors:[b.anchor,z],paintStyle:a.connectorStyle,connector:a.connector,overlays:b.connectorOverlays})}else{S=
  29. true;s=E.sourceId==B?0:1;E.floatingAnchorIndex=s;b.detachFromConnection(E);if(s==0){Q=[E.source,E.sourceId];E.source=x(O);E.sourceId=L}else{Q=[E.target,E.targetId];E.target=x(O);E.targetId=L}E.endpoints[s==0?1:0].anchor.locked=true;E.suspendedEndpoint=E.endpoints[s];E.endpoints[s]=D}c[L]=E;D.addConnection(E);C(t,L,D)});M[Y]=T(M[Y],function(){var s=l.CurrentLibrary.getUIPosition(arguments);l.CurrentLibrary.setOffset(O,s);I(x(O),s)});M[U]=T(M[U],function(){da(t,e,D);for(var s=[O,D.canvas],L=0;L<s.length;L++)X(s[L],
  30. m);X(F.canvas,m);s=E.floatingAnchorIndex==null?1:E.floatingAnchorIndex;E.endpoints[s==0?1:0].anchor.locked=false;if(E.endpoints[s]==D)if(S&&E.suspendedEndpoint){if(s==0){E.source=Q[0];E.sourceId=Q[1]}else{E.target=Q[0];E.targetId=Q[1]}E.endpoints[s]=E.suspendedEndpoint;if(K){E.floatingAnchorIndex=null;E.suspendedEndpoint.addConnection(E);l.repaint(Q[1])}else{E.endpoints[1].detach(E);E.endpoints[0].detach(E)}}else{X(E.canvas,b.container);b.detachFromConnection(E)}b.anchor.locked=false;b.paint();E.repaint();
  31. E=null;delete D;delete F});P=x(b.canvas);l.CurrentLibrary.initDraggable(P,M)}if(a.isTarget&&l.CurrentLibrary.isDropSupported(m)){M=a.dropOptions||o.Defaults.DropOptions||l.Defaults.DropOptions;M=l.extend({},M);M.scope=M.scope||b.scope;P=l.CurrentLibrary.dragEvents.drop;U=l.CurrentLibrary.dragEvents.over;Y=l.CurrentLibrary.dragEvents.out;M[P]=T(M[P],function(){var s=l.CurrentLibrary.getDragObject(arguments),L=J(x(s),"dragId");s=J(x(s),"elId");var z=c[L],ba=z.floatingAnchorIndex==null?1:z.floatingAnchorIndex;
  32. if(!b.isFull()&&!(ba==0&&!b.isSource)&&!(ba==1&&!b.isTarget)){if(ba==0){z.source=m;z.sourceId=B}else{z.target=m;z.targetId=B}z.endpoints[ba].detachFromConnection(z);z.suspendedEndpoint&&z.suspendedEndpoint.detachFromConnection(z);z.endpoints[ba]=b;b.addConnection(z);C(u,z.scope,z);ca(m,a.draggable,{});l.repaint(s);o.fireUpdate("jsPlumbConnection",{source:z.source,target:z.target,sourceId:z.sourceId,targetId:z.targetId,sourceEndpoint:z.endpoints[0],targetEndpoint:z.endpoints[1]})}delete c[L]});M[U]=
  33. T(M[U],function(){var s=l.CurrentLibrary.getDragObject(arguments);s=J(x(s),"dragId");s=c[s];s.endpoints[s.floatingAnchorIndex==null?1:s.floatingAnchorIndex].anchor.over(b.anchor)});M[Y]=T(M[Y],function(){var s=l.CurrentLibrary.getDragObject(arguments);s=J(x(s),"dragId");s=c[s];s.endpoints[s.floatingAnchorIndex==null?1:s.floatingAnchorIndex].anchor.out()});l.CurrentLibrary.initDroppable(x(b.canvas),M)}return b};this.Defaults={Anchor:null,Anchors:[null,null],BackgroundPaintStyle:null,Connector:null,
  34. Container:null,DragOptions:{},DropOptions:{},Endpoint:null,Endpoints:[null,null],EndpointStyle:{fillStyle:null},EndpointStyles:[null,null],LabelStyle:{fillStyle:"rgba(0,0,0,0)",color:"black"},LogEnabled:true,MaxConnections:null,PaintStyle:{lineWidth:10,strokeStyle:"red"},Scope:"_jsPlumb_DefaultScope"};this.logEnabled=this.Defaults.LogEnabled;this.connectorClass="_jsPlumb_connector";this.endpointClass="_jsPlumb_endpoint";this.overlayClass="_jsPlumb_overlay";this.Anchors={};this.Connectors={};this.Endpoints=
  35. {};this.Overlays={};this.addEndpoint=function(a,b){b=l.extend({},b);b.endpoint=b.endpoint||o.Defaults.Endpoint||l.Defaults.Endpoint;b.endpointStyle=b.endpointStyle||o.Defaults.EndpointStyle||l.Defaults.EndpointStyle;var e=x(a),h=J(e,"id");b.source=e;V({elId:h});e=new fa(b);C(t,h,e);var n=j[h];h=e.anchor.compute({xy:[n.left,n.top],wh:q[h],element:e});e.paint({anchorLoc:h});return e};this.addEndpoints=function(a,b){for(var e=[],h=0;h<b.length;h++)e.push(o.addEndpoint(a,b[h]));return e};this.animate=
  36. function(a,b,e){var h=x(a),n=J(a,"id");e=e||{};a=l.CurrentLibrary.dragEvents.step;var m=l.CurrentLibrary.dragEvents.complete;e[a]=T(e[a],function(){o.repaint(n)});e[m]=T(e[m],function(){o.repaint(n)});l.CurrentLibrary.animate(h,b,e)};this.autoConnect=function(a){var b=[],e=[],h=a.endpoint||o.Defaults.EndpointStyle||l.Defaults.EndpointStyle,n=F||l.Defaults.DynamicAnchors(),m=function(B,N){for(var K=0;K<B.length;K++)N.push(B[K])},A=a.source,D=a.target,F=a.anchors;typeof A=="string"?b.push(x(A)):m(A,
  37. b);typeof D=="string"?e.push(x(D)):m(D,e);a=l.extend(a,{source:null,target:null,anchors:null});for(m=0;m<b.length;m++)for(A=0;A<e.length;A++){D=l.addEndpoint(b[m],l.extend({anchor:l.makeDynamicAnchor(n)},h));F=l.addEndpoint(e[A],l.extend({anchor:l.makeDynamicAnchor(n)},h));o.connect(l.extend(a,{sourceEndpoint:D,targetEndpoint:F}))}};this.connect=function(a){var b=l.extend({},a);if(a.uuids){b.sourceEndpoint=v[a.uuids[0]];b.targetEndpoint=v[a.uuids[1]]}if(b.sourceEndpoint&&b.sourceEndpoint.isFull())G("could not add connection; source endpoint is full");
  38. else if(b.targetEndpoint&&b.targetEndpoint.isFull())G("could not add connection; target endpoint is full");else{a=new ha(b);C(u,a.scope,a);o.fireUpdate("jsPlumbConnection",{source:a.source,target:a.target,sourceId:a.sourceId,targetId:a.targetId,sourceEndpoint:a.endpoints[0],targetEndpoint:a.endpoints[1]});I(a.source);return a}};this.deleteEndpoint=function(a){if(a=typeof a=="string"?v[a]:a){var b=a.getUuid();if(b)v[b]=null;a.detachAll();X(a.canvas,a.container);for(var e in t)if(b=t[e]){for(var h=
  39. [],n=0;n<b.length;n++)b[n]!=a&&h.push(b[n]);t[e]=h}delete a}};this.deleteEveryEndpoint=function(){for(var a in t){var b=t[a];if(b&&b.length)for(var e=0;e<b.length;e++)o.deleteEndpoint(b[e])}delete t;t={};delete v;v={}};var aa=function(a){o.fireUpdate("jsPlumbConnectionDetached",{source:a.source,target:a.target,sourceId:a.sourceId,targetId:a.targetId,sourceEndpoint:a.endpoints[0],targetEndpoint:a.endpoints[1]})};this.detach=function(a,b){if(arguments.length==2){var e=x(a),h=W(e);e=x(b);var n=W(e);
  40. ea(h,function(m){if(m.sourceId==h&&m.targetId==n||m.targetId==h&&m.sourceId==n){X(m.canvas,m.container);m.endpoints[0].removeConnection(m);m.endpoints[1].removeConnection(m);da(u,m.scope,m);aa(m)}})}else if(arguments.length==1)if(arguments[0].constructor==ha){arguments[0].endpoints[0].detachFrom(arguments[0].endpoints[1]);aa(arguments[0])}else if(arguments[0].connection){arguments[0].connection.endpoints[0].detachFrom(arguments[0].connection.endpoints[1]);aa(arguments[0].connection)}else{e=l.extend({},
  41. a);if(e.uuids)v[e.uuids[0]].detachFrom(v[e.uuids[1]]);else if(e.sourceEndpoint&&e.targetEndpoint)e.sourceEndpoint.detachFrom(e.targetEndpoint);else{sourceId=W(e.source);targetId=W(e.target);ea(sourceId,function(m){if(m.sourceId==sourceId&&m.targetId==targetId||m.targetId==sourceId&&m.sourceId==targetId){X(m.canvas,m.container);m.endpoints[0].removeConnection(m);m.endpoints[1].removeConnection(m);da(u,m.scope,m);aa(m)}})}}};this.detachAll=this.detachAllConnections=function(a){a=J(a,"id");if((a=t[a])&&
  42. a.length)for(var b=0;b<a.length;b++){var e=a[b].connections.length;if(e>0)for(var h=0;h<e;h++){var n=a[b].connections[0];X(n.canvas,n.container);n.endpoints[0].removeConnection(n);n.endpoints[1].removeConnection(n);da(u,n.scope,n);aa(n)}}};this.detachEverything=this.detachEveryConnection=function(){for(var a in t){var b=t[a];if(b&&b.length)for(var e=0;e<b.length;e++){var h=b[e].connections.length;if(h>0)for(var n=0;n<h;n++){var m=b[e].connections[0];X(m.canvas,m.container);m.endpoints[0].removeConnection(m);
  43. m.endpoints[1].removeConnection(m);aa(m)}}}delete u;u={}};this.draggable=function(a,b){if(typeof a=="object"&&a.length)for(var e=0;e<a.length;e++){var h=x(a[e]);h&&ca(h,true,b)}else(h=x(a))&&ca(h,true,b)};this.extend=function(a,b){return l.CurrentLibrary.extend(a,b)};this.getConnections=function(a){var b={};a=a||{};var e=function(D){var F=[];if(D)if(typeof D=="string")F.push(D);else F=D;return F},h=e(a.scope),n=e(a.source);a=e(a.target);for(var m in u)if(h.length>0?p(h,m)!=-1:true){b[m]=[];for(e=
  44. 0;e<u[m].length;e++){var A=u[m][e];(n.length>0?p(n,A.sourceId)!=-1:true)&&(a.length>0?p(a,A.targetId)!=-1:true)&&b[m].push({sourceId:A.sourceId,targetId:A.targetId,source:A.source,target:A.target,sourceEndpoint:A.endpoints[0],targetEndpoint:A.endpoints[1],connection:A})}}return b};this.getDefaultScope=function(){return k};this.getEndpoint=function(a){return v[a]};this.getId=W;this.hide=function(a){ja(a,"none")};this.makeAnchor=function(a,b){if(arguments.length==0)return null;var e={};if(arguments.length==
  45. 1){var h=arguments[0];if(h.compute&&h.getOrientation)return h;else if(typeof h=="string")return o.Anchors[arguments[0]]();else if(h.constructor==Array)return l.makeAnchor.apply(this,h);else typeof arguments[0]=="object"&&l.extend(e,a)}else{e={x:a,y:b};if(arguments.length>=4)e.orientation=[arguments[2],arguments[3]];if(arguments.length==6)e.offsets=[arguments[4],arguments[5]]}h=new ka(e);h.clone=function(){return new ka(e)};return h};this.makeAnchors=function(a){for(var b=[],e=0;e<a.length;e++)b.push(o.Anchors[a[e]]());
  46. return b};this.makeDynamicAnchor=function(a){return new pa(a)};this.repaint=function(a){if(typeof a=="object")for(var b=0;b<a.length;b++)I(x(a[b]));else I(x(a))};this.repaintEverything=function(){var a=""+(new Date).getTime(),b;for(b in t)I(x(b),null,a)};this.removeAllEndpoints=function(a){a=J(a,"id");var b=t[a],e;for(e in b)o.deleteEndpoint(b[e]);t[a]=[]};this.removeEveryEndpoint=this.deleteEveryEndpoint;this.removeEndpoint=function(a,b){o.deleteEndpoint(b)};this.reset=function(){this.deleteEveryEndpoint();
  47. this.clearListeners()};this.setAutomaticRepaint=function(){};this.setDefaultNewCanvasSize=function(a){g=a};this.setDefaultScope=function(a){k=a};this.setDraggable=function(a,b){return H(a,function(e,h){d[h]=b;l.CurrentLibrary.isDragSupported(e)&&l.CurrentLibrary.setDraggable(e,b)})};this.setDraggableByDefault=function(a){r=a};this.setDebugLog=function(){};this.setRepaintFunction=function(){};this.show=function(a){ja(a,"block")};this.sizeCanvas=function(a,b,e,h,n){if(a){a.style.height=n+"px";a.height=
  48. n;a.style.width=h+"px";a.width=h;a.style.left=b+"px";a.style.top=e+"px"}};this.getTestHarness=function(){return{endpointsByElement:t,endpointCount:function(a){return(a=t[a])?a.length:0},connectionCount:function(a){a=a||k;return(a=u[a])?a.length:0},findIndex:p,getId:W}};this.toggleVisible=this.toggle=na;this.toggleDraggable=function(a){return H(a,function(b,e){var h=d[e]==null?r:d[e];h=!h;d[e]=h;l.CurrentLibrary.setDraggable(b,h);return h})};this.unload=function(){delete t;delete v;delete j;delete q;
  49. delete c;delete d};this.wrap=T;w.apply(this);this.addListener=this.bind},l=window.jsPlumb=new Z;l.getInstance=function(w){var o=new Z;w&&l.extend(o.Defaults,w);return o}})();
  50. (function(){var Z=!!!document.createElement("canvas").getContext,l=function(w,o,y,t){return function(){return jsPlumb.makeAnchor(w,o,y,t)}};jsPlumb.Anchors.TopCenter=l(0.5,0,0,-1);jsPlumb.Anchors.BottomCenter=l(0.5,1,0,1);jsPlumb.Anchors.LeftMiddle=l(0,0.5,-1,0);jsPlumb.Anchors.RightMiddle=l(1,0.5,1,0);jsPlumb.Anchors.Center=l(0.5,0.5,0,0);jsPlumb.Anchors.TopRight=l(1,0,0,-1);jsPlumb.Anchors.BottomRight=l(1,1,0,1);jsPlumb.Anchors.TopLeft=l(0,0,0,-1);jsPlumb.Anchors.BottomLeft=l(0,1,0,1);jsPlumb.Defaults.DynamicAnchors=
  51. function(){return jsPlumb.makeAnchors(["TopCenter","RightMiddle","BottomCenter","LeftMiddle"])};jsPlumb.Anchors.AutoDefault=function(){return jsPlumb.makeDynamicAnchor(jsPlumb.Defaults.DynamicAnchors())};jsPlumb.Connectors.Straight=function(){var w=this,o=null,y,t,v,u,j,f,c,d,r;this.compute=function(q,k,g,p,C,I){g=Math.abs(q[0]-k[0]);p=Math.abs(q[1]-k[1]);var H=0.45*g,G=0.45*p;g*=1.9;p*=1.9;var J=Math.min(q[0],k[0])-H,x=Math.min(q[1],k[1])-G;C=Math.max(2*C,I);if(g<C){g=C;J=q[0]+(k[0]-q[0])/2-C/2;
  52. H=(g-Math.abs(q[0]-k[0]))/2}if(p<C){p=C;x=q[1]+(k[1]-q[1])/2-C/2;G=(p-Math.abs(q[1]-k[1]))/2}f=q[0]<k[0]?H:g-H;c=q[1]<k[1]?G:p-G;d=q[0]<k[0]?g-H:H;r=q[1]<k[1]?p-G:G;o=[J,x,g,p,f,c,d,r];v=d-f;u=r-c;y=u/v;t=-1*(y*f-c);j=Math.atan(y);return o};this.paint=function(q,k){k.beginPath();k.moveTo(q[4],q[5]);k.lineTo(q[6],q[7]);k.stroke()};this.pointOnPath=function(q){q=f+q*v;return[q,y==Infinity?q+t:y*q+t]};this.gradientAtPoint=function(){return y};this.pointAlongPathFrom=function(q,k){var g=w.pointOnPath(q),
  53. p=k>0?1:-1,C=Math.abs(k*Math.sin(j));if(c>r)C*=-1;var I=Math.abs(k*Math.cos(j));if(f>d)I*=-1;return[g[0]+p*I,g[1]+p*C]};this.perpendicularToPathAt=function(q,k,g){q=w.pointAlongPathFrom(q,k);k=w.gradientAtPoint(q.location);var p=Math.atan(-1/k);k=g/2*Math.sin(p);g=g/2*Math.cos(p);return[[q[0]+g,q[1]+k],[q[0]-g,q[1]-k]]};this.createGradient=function(q,k){return k.createLinearGradient(q[4],q[5],q[6],q[7])}};jsPlumb.Connectors.Bezier=function(w){var o=this;this.majorAnchor=w||150;this.minorAnchor=10;
  54. var y=null;this._findControlPoint=function(g,p,C,I,H){I=I.getOrientation();H=H.getOrientation();var G=[],J=o.majorAnchor,x=o.minorAnchor;if(I[0]!=H[0]||I[1]==H[1]){H[0]==0?G.push(C[0]<p[0]?g[0]+x:g[0]-x):G.push(g[0]+J*H[0]);H[1]==0?G.push(C[1]<p[1]?g[1]+x:g[1]-x):G.push(g[1]+J*I[1])}else{I[0]==0?G.push(p[0]<C[0]?g[0]+x:g[0]-x):G.push(g[0]-J*I[0]);I[1]==0?G.push(p[1]<C[1]?g[1]+x:g[1]-x):G.push(g[1]+J*H[1])}return G};var t,v,u,j,f,c,d,r,q;this.compute=function(g,p,C,I,H,G){H=H||0;r=Math.abs(g[0]-p[0])+
  55. H;q=Math.abs(g[1]-p[1])+H;c=Math.min(g[0],p[0])-H/2;d=Math.min(g[1],p[1])-H/2;u=g[0]<p[0]?r-H/2:H/2;f=g[1]<p[1]?q-H/2:H/2;j=g[0]<p[0]?H/2:r-H/2;_ty=g[1]<p[1]?H/2:q-H/2;t=o._findControlPoint([u,f],g,p,C,I);v=o._findControlPoint([j,_ty],p,g,I,C);g=Math.min(Math.min(u,j),Math.min(t[0],v[0]));p=Math.max(Math.max(u,j),Math.max(t[0],v[0]));if(p>r)r=p;if(g<0){c+=g;g=Math.abs(g);r+=g;t[0]+=g;u+=g;j+=g;v[0]+=g}g=Math.min(Math.min(f,_ty),Math.min(t[1],v[1]));p=Math.max(Math.max(f,_ty),Math.max(t[1],v[1]));
  56. if(p>q)q=p;if(g<0){d+=g;g=Math.abs(g);q+=g;t[1]+=g;f+=g;_ty+=g;v[1]+=g}if(G&&r<G){g=(G-r)/2;r=G;c-=g;u+=g;j+=g;t[0]+=g;v[0]+=g}if(G&&q<G){g=(G-q)/2;q=G;d-=g;f+=g;_ty+=g;t[1]+=g;v[1]+=g}return y=[c,d,r,q,u,f,j,_ty,t[0],t[1],v[0],v[1]]};this.paint=function(g,p){p.beginPath();p.moveTo(g[4],g[5]);p.bezierCurveTo(g[8],g[9],g[10],g[11],g[6],g[7]);p.stroke()};var k=function(){return[{x:u,y:f},{x:t[0],y:t[1]},{x:v[0],y:v[1]},{x:j,y:_ty}]};this.pointOnPath=function(g){return jsBezier.pointOnCurve(k(),g)};
  57. this.gradientAtPoint=function(g){return jsBezier.gradientAtPoint(k(),g)};this.pointAlongPathFrom=function(g,p){return jsBezier.pointAlongCurveFrom(k(),g,p)};this.perpendicularToPathAt=function(g,p,C){return jsBezier.perpendicularToCurveAt(k(),g,p,C)};this.createGradient=function(g,p,C){return C?p.createLinearGradient(g[4],g[5],g[6],g[7]):p.createLinearGradient(g[6],g[7],g[4],g[5])}};jsPlumb.Endpoints.Dot=function(w){w=w||{radius:10};var o=this;this.radius=w.radius;var y=0.5*this.radius,t=this.radius/
  58. 3,v=function(u){try{return parseInt(u)}catch(j){if(u.substring(u.length-1)=="%")return parseInt(u.substring(0,u-1))}};this.paint=function(u,j,f,c,d){var r=c.radius||o.radius;jsPlumb.sizeCanvas(f,u[0]-r,u[1]-r,r*2,r*2);u=f.getContext("2d");f=jsPlumb.extend({},c);if(f.fillStyle==null)f.fillStyle=d.strokeStyle;jsPlumb.extend(u,f);if(c.gradient&&!Z){d=c.gradient;f=y;var q=t;if(d.offset)f=v(d.offset);if(d.innerRadius)q=v(d.innerRadius);d=[f,q];j=u.createRadialGradient(r,r,r,r+(j[0]==1?d[0]*-1:d[0]),r+
  59. (j[1]==1?d[0]*-1:d[0]),d[1]);for(d=0;d<c.gradient.stops.length;d++)j.addColorStop(c.gradient.stops[d][0],c.gradient.stops[d][1]);u.fillStyle=j}u.beginPath();u.arc(r,r,r,0,Math.PI*2,true);u.closePath();u.fill()}};jsPlumb.Endpoints.Rectangle=function(w){w=w||{width:20,height:20};var o=this;this.width=w.width;this.height=w.height;this.paint=function(y,t,v,u,j){var f=u.width||o.width,c=u.height||o.height;jsPlumb.sizeCanvas(v,y[0]-f/2,y[1]-c/2,f,c);y=v.getContext("2d");v=jsPlumb.extend({},u);if(v.fillStyle==
  60. null)v.fillStyle=j.strokeStyle;jsPlumb.extend(y,v);j=/MSIE/.test(navigator.userAgent)&&!window.opera;if(u.gradient&&!j){t=y.createLinearGradient(t[0]==1?f:t[0]==0?f/2:0,t[1]==1?c:t[1]==0?c/2:0,t[0]==-1?f:t[0]==0?c/2:0,t[1]==-1?c:t[1]==0?c/2:0);for(j=0;j<u.gradient.stops.length;j++)t.addColorStop(u.gradient.stops[j][0],u.gradient.stops[j][1]);y.fillStyle=t}y.beginPath();y.rect(0,0,f,c);y.closePath();y.fill()}};jsPlumb.Endpoints.Triangle=function(w){w=w||{width:15,height:15};var o=this;this.width=w.width;
  61. this.height=w.height;this.paint=function(y,t,v,u){var j=u.width||o.width,f=u.height||o.height;jsPlumb.sizeCanvas(v,y[0]-j/2,y[1]-f/2,j,f);y=v.getContext("2d");var c=v=0,d=0;if(t[0]==1){v=j;c=f;d=180}if(t[1]==-1){v=j;d=90}if(t[1]==1){c=f;d=-90}y.fillStyle=u.fillStyle;y.translate(v,c);y.rotate(d*Math.PI/180);y.beginPath();y.moveTo(0,0);y.lineTo(j/2,f/2);y.lineTo(0,f);y.closePath();y.fill()}};jsPlumb.Endpoints.Image=function(w){var o=this;this.img=new Image;this.img.onload=function(){o.ready=true};this.img.src=
  62. w.src||w.url;var y=function(t,v,u,j){v=o.img.width||j.width;j=o.img.height||j.height;jsPlumb.sizeCanvas(u,t[0]-v/2,t[1]-j/2,v,j);u.getContext("2d").drawImage(o.img,0,0)};this.paint=function(t,v,u,j,f){o.ready?y(t,v,u,j,f):window.setTimeout(function(){o.paint(t,v,u,j,f)},200)}};jsPlumb.Overlays.Arrow=function(w){w=w||{};var o=this,y=w.length||20,t=w.width||20,v=w.fillStyle||"black",u=w.strokeStyle,j=w.lineWidth||1;this.loc=w.location||0.5;var f=w.foldback||0.623;this.computeMaxSize=function(){return t*
  63. 1.5};this.draw=function(c,d){var r=c.pointAlongPathFrom(o.loc,y/2);c.pointAlongPathFrom(o.loc,-y/2);var q=c.perpendicularToPathAt(o.loc,-y/2,t),k;k=o.loc;k=f==0.5?c.pointOnPath(k):c.pointAlongPathFrom(k,y*(0.5-f));d.lineWidth=j;d.beginPath();d.moveTo(r[0],r[1]);d.lineTo(q[0][0],q[0][1]);d.lineTo(k[0],k[1]);d.lineTo(q[1][0],q[1][1]);d.lineTo(r[0],r[1]);d.closePath();if(u){d.strokeStyle=u;d.stroke()}d.fillStyle=v;d.fill()}};jsPlumb.Overlays.PlainArrow=function(w){w=w||{};w=jsPlumb.extend(w,{foldback:1});
  64. jsPlumb.Overlays.Arrow.call(this,w)};jsPlumb.Overlays.Diamond=function(w){w=w||{};w=jsPlumb.extend(w,{length:(w.length||40)/2,foldback:2});jsPlumb.Overlays.Arrow.call(this,w)};jsPlumb.Overlays.Label=function(w){this.labelStyle=w.labelStyle||jsPlumb.Defaults.LabelStyle;this.label=w.label;var o=this,y=null,t=null,v=null,u=null;this.location=w.location||0.5;this.cachedDimensions=null;var j=function(f){if(o.cachedDimensions)return o.cachedDimensions;v=typeof o.label=="function"?o.label(o):o.label;var c=
  65. {};if(v){c=v.split("\n");f.save();if(o.labelStyle.font)f.font=o.labelStyle.font;var d,r=0;for(d=0;d<c.length;d++){var q=f.measureText(c[d]).width;if(q>r)r=q}d=r;r=f.measureText("M").width;u=o.labelStyle.padding||0.25;y=d+2*d*u;t=c.length*r+2*r*u;d=c.length*r;f.restore();c={width:y,height:t,lines:c,oneLine:r,padding:u,textHeight:d}}if(typeof o.label!="function")o.cachedDimensions=c;return c};this.computeMaxSize=function(f,c){var d=j(c);return d.width?Math.max(d.width,d.height)*1.5:0};this.draw=function(f,
  66. c){var d=j(c);if(d.width){var r=f.pointOnPath(o.location);if(o.labelStyle.font)c.font=o.labelStyle.font;c.fillStyle=o.labelStyle.fillStyle?o.labelStyle.fillStyle:"rgba(0,0,0,0)";c.fillRect(r[0]-d.width/2,r[1]-d.height/2,d.width,d.height);if(o.labelStyle.color)c.fillStyle=o.labelStyle.color;c.textBaseline="middle";c.textAlign="center";for(i=0;i<d.lines.length;i++)c.fillText(d.lines[i],r[0],r[1]-d.textHeight/2+d.oneLine/2+i*d.oneLine);if(o.labelStyle.borderWidth>0){c.strokeStyle=o.labelStyle.borderStyle||
  67. "black";c.strokeRect(r[0]-d.width/2,r[1]-d.height/2,d.width,d.height)}}}};jsPlumb.Overlays.Image=function(w){var o=this;this.location=w.location||0.5;this.img=new Image;var y=null,t=null,v,u,j=w.events||{};this.img.onload=function(){o.ready=true};this.img.src=w.src||w.url;t=window.setInterval(function(){if(o.ready){window.clearInterval(t);y=document.createElement("img");y.src=o.img.src;y.style.position="absolute";y.style.display="none";y.className="_jsPlumb_overlay";document.body.appendChild(y);for(var c in j)jsPlumb.CurrentLibrary.bind(y,
  68. c,j[c]);if(v&&u){f(v,u);v=u=null}}},250);this.computeMaxSize=function(){return[o.img.width,o.img.height]};var f=function(c,d){var r=c.pointOnPath(o.location),q=jsPlumb.CurrentLibrary.getElementObject(d.canvas);q=jsPlumb.CurrentLibrary.getOffset(q);jsPlumb.CurrentLibrary.setOffset(y,{left:q.left+r[0]-o.img.width/2,top:q.top+r[1]-o.img.height/2});y.style.display="block"};this.draw=function(c,d){if(o.ready)f(c,d);else{v=c;u=d}}}})();
  69. (function(){var Z=new Class({Extends:Fx.Morph,onStep:null,initialize:function(j,f){this.parent(j,f);if(f.onStep)this.onStep=f.onStep},step:function(){this.parent();if(this.onStep)try{this.onStep()}catch(j){}}}),l={},w={},o={},y={},t=function(j,f,c){if(f){var d=f.get("id");if(d)(d=w[d])&&d[c]&&d[c](j,f)}},v=function(j,f){if(j){var c=j.get("id");if(c)if(c=w[c])if(c.hoverClass)f?j.addClass(c.hoverClass):j.removeClass(c.hoverClass)}},u=function(j,f,c){var d=j[f];if(!d){d=[];j[f]=d}d.push(c)};jsPlumb.CurrentLibrary=
  70. {dragEvents:{start:"onStart",stop:"onComplete",drag:"onDrag",step:"onStep",over:"onEnter",out:"onLeave",drop:"onDrop",complete:"onComplete"},appendElement:function(j,f){jsPlumb.CurrentLibrary.getElementObject(f).grab(j)},bind:function(j,f,c){j=jsPlumb.CurrentLibrary.getElementObject(j);j.addEvent(f,c)},extend:function(j,f){return $extend(j,f)},getElementObject:function(j){return $(j)},getOffset:function(j){j=j.getPosition();return{left:j.x,top:j.y}},setOffset:function(j,f){jsPlumb.CurrentLibrary.getElementObject(j).setPosition({x:f.left,
  71. y:f.top})},getSize:function(j){j=j.getSize();return[j.x,j.y]},getAttribute:function(j,f){return j.get(f)},setAttribute:function(j,f,c){j.set(f,c)},addClass:function(j,f){j.addClass(f)},removeClass:function(j,f){j.removeClass(f)},initDraggable:function(j,f){var c=jsPlumb.getId(j),d=y[c];if(!d){var r=0,q=null,k=jsPlumb.Defaults.DragOptions.zIndex||2E3;f.onStart=jsPlumb.wrap(f.onStart,function(){r=this.element.getStyle("z-index");this.element.setStyle("z-index",k);if(jsPlumb.Defaults.DragOptions.cursor){q=
  72. this.element.getStyle("cursor");this.element.setStyle("cursor",jsPlumb.Defaults.DragOptions.cursor)}});f.onComplete=jsPlumb.wrap(f.onComplete,function(){this.element.setStyle("z-index",r);q&&this.element.setStyle("cursor",q)});c=f.scope||jsPlumb.Defaults.Scope;d=function(g){return g.get("id")!=j.get("id")};d=l[c]?l[c].filter(d):[];f.droppables=d;f.onLeave=jsPlumb.wrap(f.onLeave,function(g,p){if(p){v(p,false);t(g,p,"onLeave")}});f.onEnter=jsPlumb.wrap(f.onEnter,function(g,p){if(p){v(p,true);t(g,p,
  73. "onEnter")}});f.onDrop=function(g,p){if(p){v(p,false);t(g,p,"onDrop")}};d=new Drag.Move(j,f);u(o,c,d);u(y,j.get("id"),d);f.disabled&&d.detach()}return d},isDragSupported:function(){return typeof Drag!="undefined"},setDraggable:function(j,f){var c=y[j.get("id")];c&&c.each(function(d){f?d.attach():d.detach()})},initDroppable:function(j,f){var c=f.scope||jsPlumb.Defaults.Scope;u(l,c,j);var d=jsPlumb.getId(j);w[d]=f;d=function(r){return r.element!=j};c=o[c]?o[c].filter(d):[];for(d=0;d<c.length;d++)c[d].droppables.push(j)},
  74. isDropSupported:function(){if(typeof Drag!=undefined)return typeof Drag.Move!=undefined;return false},animate:function(j,f,c){(new Z(j,c)).start(f)},getUIPosition:function(j){j=j[0];return{left:j.offsetLeft,top:j.offsetTop}},getDragObject:function(j){return j[0]},removeElement:function(j){jsPlumb.CurrentLibrary.getElementObject(j).dispose()},getScrollLeft:function(){return null},getScrollTop:function(){return null}}})();
  75. (function(){var Z=Math.pow(2,-65),l=function(f,c){return{x:f.x-c.x,y:f.y-c.y}},w=function(f){return f.x*f.x+f.y*f.y},o=function(f,c){var d,r,q=Array(5),k,g,p,C;d=Array(4);p=Array(3);r=[];var I=[[1,0.6,0.3,0.1],[0.4,0.6,0.6,0.4],[0.1,0.3,0.6,1]];for(k=0;k<=3;k++)d[k]=l(c[k],f);for(k=0;k<=2;k++){p[k]=l(c[k+1],c[k]);p[k]={x:p[k].x*3,y:p[k].y*3}}for(k=0;k<=2;k++)for(C=0;C<=3;C++){r[k]||(r[k]=[]);r[k][C]=p[k].x*d[C].x+p[k].y*d[C].y}d=[];for(k=0;k<=5;k++){d[k]||(d[k]=[]);d[k].y=0;d[k].x=parseFloat(k)/5}for(p=
  76. 0;p<=5;p++){k=Math.max(0,p-2);C=Math.min(p,3);for(k=k;k<=C;k++){g=p-k;d[k+g].y+=r[g][k]*I[g][k]}}a:{p=Array(6);k=Array(6);r=Array(6);I=Array(6);C=0;var H;H=d[0].y==0?0:d[0].y>0?1:-1;for(var G=1;G<=5;G++){g=d[G].y==0?0:d[G].y>0?1:-1;g!=H&&C++;H=g}switch(C){case 0:d=0;break a;case 1:var J,x,R;C=d[0].y-d[5].y;g=d[5].x-d[0].x;H=d[0].x*d[5].y-d[5].x*d[0].y;G=max_distance_below=0;for(R=1;R<5;R++){J=C*d[R].x+g*d[R].y+H;if(J>G)G=J;else if(J<max_distance_below)max_distance_below=J}x=C;J=g;R=H-G;x=0*J-x*1;
  77. x=1/x;G=(1*R-J*0)*x;x=C;J=g;R=H-max_distance_below;x=0*J-x*1;x=1/x;C=(1*R-J*0)*x;if(Math.max(G,C)-Math.min(G,C)<Z?1:0){r=d[5].x-d[0].x;I=d[5].y-d[0].y;q[0]=0+1*(r*(d[0].y-0)-I*(d[0].x-0))*(1/(r*0-I*1));d=1;break a}}y(d,5,0.5,p,k);d=FindRoots(p,5,r,1);p=FindRoots(k,5,I,1);for(k=0;k<d;k++)q[k]=r[k];for(k=0;k<p;k++)q[k+d]=I[k];d=d+p}p=l(f,c[0]);I=w(p);for(k=r=0;k<d;k++){p=y(c,3,q[k],null,null);p=l(f,p);p=w(p);if(p<I){I=p;r=q[k]}}p=l(f,c[3]);p=w(p);if(p<I){I=p;r=1}return{t:r,d:I}},y=function(f,c,d,r,
  78. q){for(var k=[],g=0;g<=c;g++){k[0]||(k[0]=[]);k[0][g]=f[g]}for(f=1;f<=c;f++)for(g=0;g<=c-f;g++){k[f]||(k[f]=[]);k[f][g]||(k[f][g]={});k[f][g].x=(1-d)*k[f-1][g].x+d*k[f-1][g+1].x;k[f][g].y=(1-d)*k[f-1][g].y+d*k[f-1][g+1].y}if(r!=null)for(g=0;g<=c;g++)r[g]=k[g][0];if(q!=null)for(g=0;g<=c;g++)q[g]=k[c-g][g];return k[c][0]},t=function(f,c){return[f[0].x*c*c*c+f[1].x*3*c*c*(1-c)+f[2].x*3*c*(1-c)*(1-c)+f[3].x*(1-c)*(1-c)*(1-c),f[0].y*c*c*c+f[1].y*3*c*c*(1-c)+f[2].y*3*c*(1-c)*(1-c)+f[3].y*(1-c)*(1-c)*(1-
  79. c)]},v=function(f,c){return[f[0].x*c*c+f[1].x*2*c*(1-c)+f[2].x*(1-c)*(1-c),f[0].y*c*c+f[1].y*2*c*(1-c)+f[2].y*(1-c)*(1-c)]},u=function(f,c,d){var r=t(f,c),q=0;c=c;for(var k=d>0?1:-1,g=null;q<Math.abs(d);){c+=0.0050*k;g=t(f,c);q+=Math.sqrt(Math.pow(g[0]-r[0],2)+Math.pow(g[1]-r[1],2));r=g}return{point:g,location:c}},j=function(f,c){var d=t(f,c),r=v(f,c);return Math.atan((r[1]-d[1])/(r[0]-d[0]))};window.jsBezier={distanceFromCurve:o,gradientAtPoint:j,nearestPointOnCurve:function(f,c){var d=o(f,c);return y(c,
  80. 3,d.t,null,null)},pointOnCurve:t,pointAlongCurveFrom:function(f,c,d){return u(f,c,d).point},perpendicularToCurveAt:function(f,c,d,r){c=u(f,c,d);f=j(f,c.location);d=Math.atan(-1/f);f=r/2*Math.sin(d);r=r/2*Math.cos(d);return[[c.point[0]+r,c.point[1]+f],[c.point[0]-r,c.point[1]-f]]},quadraticPointOnCurve:v}})();