jquery.jsPlumb-1.2.2-all-min.js 25 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. (function(){var m=function(){var f=this,g=/MSIE/.test(navigator.userAgent)&&!window.opera,o=null,n=function(){c.repaintEverything()},i=true,j={},v={},s={},x=[],G={},H={},L=true,D=[],da={},Y="DEFAULT",ea=1200,Q=function(a,b,d){var e=function(l,p){if(l===p)return true;else if(typeof l=="object"&&typeof p=="object"){var q=true;for(var t in l)if(!e(l[t],p[t])){q=false;break}for(t in p)if(!e(p[t],l[t])){q=false;break}return q}};d=+d||0;for(var h=a.length;d<h;d++)if(e(a[d],b))return d;return-1},N=function(a,
  2. b,d){var e=a[b];if(e==null){e=[];a[b]=e}e.push(d);return e},T=function(a,b){var d=F(a,"id"),e=j[d];if(e){var h=""+(new Date).getTime();O(d,b);for(var l=x[d],p=D[d],q=0;q<e.length;q++){var t=e[q],E=t.anchor.compute([l.left,l.top],p,t);t.paint(E);t=t.connections;for(E=0;E<t.length;E++)t[E].paint(d,b,false,h)}}},fa=function(a,b){var d=null;if(typeof a=="object"&&a.length){d=[];for(var e=0;e<a.length;e++){var h=w(a[e]),l=F(h,"id");d.push(b(h,l))}}else{h=w(a);l=F(h,"id");d=b(h,l)}return d},Z=function(a,
  3. b){var d=da[a];if(d)for(var e in d)try{d[e][a](b)}catch(h){}},$={},w=function(a){if(typeof a=="string"){var b=$[a];if(!b){b=c.CurrentLibrary.getElementObject(a);$[a]=b}return b}else return c.CurrentLibrary.getElementObject(a)},F=function(a,b){var d=w(a);return c.CurrentLibrary.getAttribute(d,b)},aa=function(a,b,d){a=w(a);c.CurrentLibrary.setAttribute(a,b,d)},ga=function(a){a=w(a);return c.CurrentLibrary.getOffset(a)},ha=function(a){a=w(a);return c.CurrentLibrary.getSize(a)},R=function(a,b){var d=
  4. w(a),e=F(d,"id");if(!e){e=arguments.length==2?b:"_jsPlumb_"+new String((new Date).getTime());aa(d,"id",e)}return e},U=function(a,b,d){if(b=b==null?L:b)if(c.CurrentLibrary.isDragSupported(a)){d=d||f.Defaults.DragOptions||c.Defaults.DragOptions;d=c.extend({},d);b=c.CurrentLibrary.dragEvents.drag;d[b]=J(d[b],function(){var e=c.CurrentLibrary.getUIPosition(arguments);T(a,e);e=w(a);c.CurrentLibrary.addClass(e,"jsPlumb_dragged")});b=H[R(a)];d.disabled=b==null?false:!b;c.CurrentLibrary.initDraggable(a,d)}},
  5. ia=function(a,b,d){var e=document.createElement("canvas"),h=e;b?c.CurrentLibrary.appendElement(h,b):document.body.appendChild(h);e.style.position="absolute";if(a)e.className=a;R(e,d);if(g){c.sizeCanvas(e,0,0,ea,ea);e=G_vmlCanvasManager.initElement(e)}return e},ba=function(a,b){var d=j[a];if(d&&d.length)for(var e=0;e<d.length;e++)for(var h=0;h<d[e].connections.length;h++)if(b(d[e].connections[h]))return},I=function(a,b){if(a!=null)if(b)c.CurrentLibrary.removeElement(a,b);else try{document.body.removeChild(a)}catch(d){}},
  6. S=function(a,b,d){a=a[b];if(a!=null){d=Q(a,d);if(d>=0){delete a[d];a.splice(d,1);return true}}return false},ja=function(a,b){var d=F(a,"id");ba(d,function(e){e.canvas.style.display=b})},na=function(a){ba(a,function(b){b.canvas.style.display="none"==b.canvas.style.display?"block":"none"})},O=function(a,b,d){if(d||b==null){b=w(a);D[a]=ha(b);x[a]=ga(b)}else x[a]=b},J=function(a,b){a=a||function(){};b=b||function(){};return function(){var d=null;try{d=b.apply(this,arguments)}catch(e){}try{a.apply(this,
  7. arguments)}catch(h){}return d}},ka=function(a){var b=this;this.x=a.x||0;this.y=a.y||0;var d=a.orientation||[0,0],e=null;this.offsets=a.offsets||[0,0];this.compute=function(h,l,p){e=[h[0]+b.x*l[0]+b.offsets[0],h[1]+b.y*l[1]+b.offsets[1]];l=p?p.container:null;h={left:0,top:0};if(l!=null){var q=w(l);l=ga(q);p=c.CurrentLibrary.getScrollLeft(q);q=c.CurrentLibrary.getScrollTop(q);h.left=l.left-p;h.top=l.top-q;e[0]-=h.left;e[1]-=h.top}return e};this.getOrientation=function(){return d};this.equals=function(h){if(!h)return false;
  8. var l=h.getOrientation(),p=this.getOrientation();return this.x==h.x&&this.y==h.y&&this.offsets[0]==h.offsets[0]&&this.offsets[1]==h.offsets[1]&&p[0]==l[0]&&p[1]==l[1]}},oa=function(a){var b=a.reference,d=ha(w(a.referenceCanvas)),e=0,h=0,l=null;this.compute=function(p){h=e=0;return[p[0]+d[0]/2,p[1]+d[1]/2]};this.getOrientation=function(){if(l)return l;else{var p=b.getOrientation();return[Math.abs(p[0])*e*-1,Math.abs(p[1])*h*-1]}};this.over=function(p){l=p.getOrientation()};this.out=function(){l=null}},
  9. la=function(a){var b=this,d=new String("_jsplumb_c_"+(new Date).getTime());this.getId=function(){return d};this.container=a.container||f.Defaults.Container;this.source=w(a.source);this.target=w(a.target);if(a.sourceEndpoint)this.source=a.sourceEndpoint.getElement();if(a.targetEndpoint)this.target=a.targetEndpoint.getElement();this.sourceId=F(this.source,"id");this.targetId=F(this.target,"id");this.endpointsOnTop=a.endpointsOnTop!=null?a.endpointsOnTop:true;this.scope=a.scope;this.endpoints=[];this.endpointStyles=
  10. [];var e=function(p,q,t,E){if(p){b.endpoints[q]=p;p.addConnection(b)}else{if(!t.endpoints)t.endpoints=[null,null];p=t.endpoints[q]||t.endpoint||f.Defaults.Endpoints[q]||c.Defaults.Endpoints[q]||f.Defaults.Endpoint||c.Defaults.Endpoint||new c.Endpoints.Dot;if(!t.endpointStyles)t.endpointStyles=[null,null];var A=t.endpointStyles[q]||t.endpointStyle||f.Defaults.EndpointStyles[q]||c.Defaults.EndpointStyles[q]||f.Defaults.EndpointStyle||c.Defaults.EndpointStyle,y=t.anchors?t.anchors[q]:f.Defaults.Anchors[q]||
  11. c.Defaults.Anchors[q]||f.Defaults.Anchor||c.Defaults.Anchor||c.Anchors.BottomCenter,C=t.uuids?t.uuids[q]:null;t=t.uuids?new V({style:A,endpoint:p,connections:[b],uuid:C,anchor:y,source:E,container:b.container}):new V({style:A,endpoint:p,connections:[b],anchor:y,source:E,container:b.container});return b.endpoints[q]=t}},h=e(a.sourceEndpoint,0,a,b.source);h&&N(j,this.sourceId,h);(e=e(a.targetEndpoint,1,a,b.target))&&N(j,this.targetId,e);if(!this.scope)this.scope=this.endpoints[0].scope;this.connector=
  12. this.endpoints[0].connector||this.endpoints[1].connector||a.connector||f.Defaults.Connector||c.Defaults.Connector||new c.Connectors.Bezier;this.paintStyle=this.endpoints[0].connectorStyle||this.endpoints[1].connectorStyle||a.paintStyle||f.Defaults.PaintStyle||c.Defaults.PaintStyle;O(this.sourceId);O(this.targetId);e=x[this.sourceId];h=D[this.sourceId];e=this.endpoints[0].anchor.compute([e.left,e.top],h,this.endpoints[0]);this.endpoints[0].paint(e);e=x[this.targetId];h=D[this.targetId];e=this.endpoints[1].anchor.compute([e.left,
  13. e.top],h,this.endpoints[1]);this.endpoints[1].paint(e);var l=ia(c.connectorClass,b.container);this.canvas=l;this.paint=function(p,q,t){o&&o.debug("Painting Connection; element in motion is "+p+"; ui is ["+q+"]; recalc is ["+t+"]");var E=p!=this.sourceId,A=E?this.sourceId:this.targetId,y=E?0:1,C=E?1:0;if(this.canvas.getContext){O(p,q,t);O(A);t=x[p];q=x[A];p=D[p];var r=D[A];A=l.getContext("2d");t=this.endpoints[C].anchor.compute([t.left,t.top],p,this.endpoints[C]);this.endpoints[C].anchor.getOrientation();
  14. q=this.endpoints[y].anchor.compute([q.left,q.top],r,this.endpoints[y]);this.endpoints[y].anchor.getOrientation();y=this.connector.compute(t,q,this.endpoints[C].anchor,this.endpoints[y].anchor,this.paintStyle.lineWidth);c.sizeCanvas(l,y[0],y[1],y[2],y[3]);c.extend(A,this.paintStyle);if(this.paintStyle.gradient&&!g){E=E?A.createLinearGradient(y[4],y[5],y[6],y[7]):A.createLinearGradient(y[6],y[7],y[4],y[5]);for(C=0;C<this.paintStyle.gradient.stops.length;C++)E.addColorStop(this.paintStyle.gradient.stops[C][0],
  15. this.paintStyle.gradient.stops[C][1]);A.strokeStyle=E}this.connector.paint(y,A)}};this.repaint=function(){this.paint(this.sourceId,null,true)};U(b.source,a.draggable,a.dragOptions);U(b.target,a.draggable,a.dragOptions);this.source.resize&&this.source.resize(function(){c.repaint(b.sourceId)})},V=function(a){a=a||{};c.extend({},a);var b=this,d=new String("_jsplumb_e_"+(new Date).getTime());this.getId=function(){return d};b.anchor=a.anchor||c.Anchors.TopCenter;var e=a.endpoint||new c.Endpoints.Dot,h=
  16. a.style||f.Defaults.EndpointStyle||c.Defaults.EndpointStyle;this.connectorStyle=a.connectorStyle;this.connector=a.connector;this.isSource=a.isSource||false;this.isTarget=a.isTarget||false;var l=a.source,p=a.uuid;if(p)v[p]=b;this.container=a.container||c.Defaults.Container;var q=F(l,"id"),t=a.maxConnections||1;this.canvas=a.canvas||ia(c.endpointClass,this.container,a.uuid);this.connections=a.connections||[];this.scope=a.scope||Y;var E=a.reattach||false,A=null,y=null;this.dragAllowedWhenFull=a.dragAllowedWhenFull||
  17. true;this.addConnection=function(k){b.connections.push(k)};this.detach=function(k){var z=Q(b.connections,k);if(z>=0){var u=k.endpoints[0]==b?k.endpoints[1]:k.endpoints[0];b.connections.splice(z,1);u.detach(k)}};this.detachAll=function(){for(;b.connections.length>0;)b.detach(b.connections[0])};this.detachFrom=function(k){for(var z=[],u=0;u<b.connections.length;u++)if(b.connections[u].endpoints[1]==k||b.connections[u].endpoints[0]==k)z.push(b.connections[u]);for(u=0;u<z.length;u++){k.detach(z[u]);b.detach(z[u])}};
  18. this.getElement=function(){return l};this.getUuid=function(){return p};this.makeInPlaceCopy=function(){return new V({anchor:b.anchor,source:l,style:h,endpoint:e})};this.isConnectedTo=function(k){var z=false;if(k)for(var u=0;u<b.connections.length;u++)if(b.connections[u].endpoints[1]==k){z=true;break}return z};this.isFloating=function(){return A!=null};this.isFull=function(){return t<1?false:b.connections.length>=t};this.setDragAllowedWhenFull=function(k){b.dragAllowedWhenFull=k};this.equals=function(k){return this.anchor.equals(k.anchor)&&
  19. true};this.paint=function(k,z,u){o&&o.debug("Painting Endpoint with elementId ["+q+"]; anchorPoint is ["+k+"]");if(k==null){k=x[q];var K=D[q];if(k==null||K==null){O(q);k=x[q];K=D[q]}k=b.anchor.compute([k.left,k.top],K,b)}e.paint(k,b.anchor.getOrientation(),u||b.canvas,h,z||h)};this.removeConnection=this.detach;if(a.isSource&&c.CurrentLibrary.isDragSupported(l)){var C=null;var r=d=null,ma=false,P=null,B=a.dragOptions||{},M=c.extend({},c.CurrentLibrary.defaultDragOptions);B=c.extend(M,B);B.scope=B.scope||
  20. b.scope;M=c.CurrentLibrary.dragEvents.start;var W=c.CurrentLibrary.dragEvents.stop,X=c.CurrentLibrary.dragEvents.drag;B[M]=J(B[M],function(){r=b.connections.length<t?null:b.connections[0];if(b.isFull()&&!b.dragAllowedWhenFull)return false;y=b.makeInPlaceCopy();y.paint();C=document.createElement("div");var k=w(C);document.body.appendChild(C);var z=""+new String((new Date).getTime());aa(k,"id",z);O(z);aa(w(b.canvas),"dragId",z);aa(w(b.canvas),"elId",q);var u=new oa({reference:b.anchor,referenceCanvas:b.canvas});
  21. A=new V({style:{fillStyle:"rgba(0,0,0,0)"},endpoint:e,anchor:u,source:k});if(r==null)r=new la({sourceEndpoint:b,targetEndpoint:A,source:w(l),target:w(C),anchors:[b.anchor,u],paintStyle:a.connectorStyle,connector:a.connector});else{ma=true;k=r.sourceId==q?0:1;r.floatingAnchorIndex=k;b.removeConnection(r);if(k==0){P=[r.source,r.sourceId];r.source=w(C);r.sourceId=z}else{P=[r.target,r.targetId];r.target=w(C);r.targetId=z}r.suspendedEndpoint=r.endpoints[k];r.endpoints[k]=A}G[z]=r;A.addConnection(r);N(j,
  22. z,A)});B[X]=J(B[X],function(){var k=c.CurrentLibrary.getUIPosition(arguments);T(w(C),k)});B[W]=J(B[W],function(){S(j,d,A);var k=[C,A.canvas];for(var z in k)I(k[z],void 0);I(y.canvas,l);k=r.floatingAnchorIndex==null?1:r.floatingAnchorIndex;if(r.endpoints[k]==A)if(ma&&r.suspendedEndpoint)if(E){r.floatingAnchorIndex=null;if(k==0){r.source=P[0];r.sourceId=P[1]}else{r.target=P[0];r.targetId=P[1]}r.endpoints[k]=r.suspendedEndpoint;r.suspendedEndpoint.addConnection(r);c.repaint(P[1])}else{r.endpoints[0].removeConnection(r);
  23. r.endpoints[1].removeConnection(r);I(r.canvas);S(s,r.scope,r);Z("jsPlumbConnectionDetached",{source:r.source,target:r.target,sourceId:r.sourceId,targetId:r.targetId,sourceEndpoint:r.endpoints[0],targetEndpoint:r.endpoints[1]})}else{I(r.canvas);b.removeConnection(r)}r=null;delete A;delete y;b.paint()});M=w(b.canvas);c.CurrentLibrary.initDraggable(M,B)}if(a.isTarget&&c.CurrentLibrary.isDropSupported(l)){B=a.dropOptions||f.Defaults.DropOptions||c.Defaults.DropOptions;B=c.extend({},B);B.scope=B.scope||
  24. b.scope;M=c.CurrentLibrary.dragEvents.drop;W=c.CurrentLibrary.dragEvents.over;X=c.CurrentLibrary.dragEvents.out;B[M]=J(B[M],function(){var k=c.CurrentLibrary.getDragObject(arguments),z=F(w(k),"dragId");k=F(w(k),"elId");var u=G[z],K=u.floatingAnchorIndex==null?1:u.floatingAnchorIndex,pa=K==0?1:0;if(!b.isFull()&&!(K==0&&!b.isSource)&&!(K==1&&!b.isTarget)){if(K==0){u.source=l;u.sourceId=q}else{u.target=l;u.targetId=q}u.endpoints[K].removeConnection(u);u.suspendedEndpoint&&u.suspendedEndpoint.removeConnection(u);
  25. u.endpoints[K]=b;b.addConnection(u);u.endpoints[pa].addConnection(u);N(s,u.scope,u);U(l,a.draggable,{});c.repaint(k);Z("jsPlumbConnection",{source:u.source,target:u.target,sourceId:u.sourceId,targetId:u.targetId,sourceEndpoint:u.endpoints[0],targetEndpoint:u.endpoints[1]})}delete G[z]});B[W]=J(B[W],function(){var k=c.CurrentLibrary.getDragObject(arguments);k=F(w(k),"dragId");k=G[k];k.endpoints[k.floatingAnchorIndex==null?1:k.floatingAnchorIndex].anchor.over(b.anchor)});B[X]=J(B[X],function(){var k=
  26. c.CurrentLibrary.getDragObject(arguments);k=F(w(k),"dragId");k=G[k];k.endpoints[k.floatingAnchorIndex==null?1:k.floatingAnchorIndex].anchor.out()});c.CurrentLibrary.initDroppable(w(b.canvas),B)}return b};this.Defaults={Anchor:null,Anchors:[null,null],Connector:null,Container:null,DragOptions:{},DropOptions:{},Endpoint:null,Endpoints:[null,null],EndpointStyle:{fillStyle:null},EndpointStyles:[null,null],MaxConnections:null,PaintStyle:{lineWidth:10,strokeStyle:"red"},Scope:"_jsPlumb_DefaultScope"};this.connectorClass=
  27. "_jsPlumb_connector";this.endpointClass="_jsPlumb_endpoint";this.Anchors={};this.Connectors={};this.Endpoints={};this.addEndpoint=function(a,b){b=c.extend({},b);var d=w(a),e=F(d,"id");b.source=d;O(e);d=new V(b);N(j,e,d);var h=x[e];e=d.anchor.compute([h.left,h.top],D[e],d);d.paint(e);return d};this.addEndpoints=function(a,b){for(var d=[],e=0;e<b.length;e++)d.push(c.addEndpoint(a,b[e]));return d};this.animate=function(a,b,d){var e=w(a),h=F(a,"id");d=d||{};a=c.CurrentLibrary.dragEvents.step;var l=c.CurrentLibrary.dragEvents.complete;
  28. d[a]=J(d[a],function(){f.repaint(h)});d[l]=J(d[l],function(){f.repaint(h)});c.CurrentLibrary.animate(e,b,d)};this.clearCache=function(){delete $;$={}};this.connect=function(a){var b=c.extend({},a);if(a.uuids){var d=function(e){var h=v[a.uuids[e]];if(!h)throw"Endpoint with UUID "+a.uuids[e]+" not found.";return h};b.sourceEndpoint=d(0);b.targetEndpoint=d(1)}if(!(b.sourceEndpoint&&b.sourceEndpoint.isFull()))if(!(b.targetEndpoint&&b.targetEndpoint.isFull())){b=new la(b);N(s,b.scope,b);Z("jsPlumbConnection",
  29. {source:b.source,target:b.target,sourceId:b.sourceId,targetId:b.targetId,sourceEndpoint:b.endpoints[0],targetEndpoint:b.endpoints[1]});T(b.source);return b}};var ca=function(a){Z("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 d=function(e){if(e.sourceId==a&&e.targetId==b||e.targetId==a&&e.sourceId==b){I(e.canvas,e.container);e.endpoints[0].removeConnection(e);
  30. e.endpoints[1].removeConnection(e);S(s,e.scope,e);ca(e);return true}};ba(a,d)}else if(arguments.length==1){d=c.extend({},a);if(d.uuids)v[d.uuids[0]].detachFrom(v[d.uuids[1]]);else if(d.sourceEndpoint&&d.targetEndpoint)d.sourceEndpoint.detachFrom(d.targetEndpoint);else{a=R(d.source);b=R(d.target);d=function(e){if(e.sourceId==a&&e.targetId==b||e.targetId==a&&e.sourceId==b){I(e.canvas,e.container);e.endpoints[0].removeConnection(e);e.endpoints[1].removeConnection(e);S(s,e.scope,e);ca(e);return true}};
  31. ba(a,d)}}};this.detachAll=function(a){a=F(a,"id");if((a=j[a])&&a.length)for(var b=0;b<a.length;b++){var d=a[b].connections.length;if(d>0)for(var e=0;e<d;e++){var h=a[b].connections[0];I(h.canvas,h.container);h.endpoints[0].removeConnection(h);h.endpoints[1].removeConnection(h);S(s,h.scope,h);ca(h)}}};this.detachEverything=function(){for(var a in j){var b=j[a];if(b&&b.length)for(var d=0;d<b.length;d++){var e=b[d].connections.length;if(e>0)for(var h=0;h<e;h++){var l=b[d].connections[0];I(l.canvas,l.container);
  32. l.endpoints[0].removeConnection(l);l.endpoints[1].removeConnection(l);ca(l)}}}delete s;s={}};this.draggable=function(a,b){if(typeof a=="object"&&a.length)for(var d=0;d<a.length;d++){var e=w(a[d]);e&&U(e,true,b)}else(e=w(a))&&U(e,true,b)};this.extend=function(a,b){return c.CurrentLibrary.extend(a,b)};this.getConnections=function(a){var b={};a=a||{};var d=function(q){var t=[];if(q)if(typeof q=="string")t.push(q);else t=q;return t},e=d(a.scope),h=d(a.source);a=d(a.target);for(var l in s)if(e.length>
  33. 0?Q(e,l)!=-1:true){b[l]=[];for(d=0;d<s[l].length;d++){var p=s[l][d];(h.length>0?Q(h,p.sourceId)!=-1:true)&&(a.length>0?Q(a,p.targetId)!=-1:true)&&b[l].push({sourceId:p.sourceId,targetId:p.targetId,source:p.source,target:p.target,sourceEndpoint:p.endpoints[0],targetEndpoint:p.endpoints[1]})}}return b};this.getDefaultScope=function(){return Y};this.getEndpoint=function(a){return v[a]};this.getId=R;this.hide=function(a){ja(a,"none")};this.makeAnchor=function(a,b){var d={};if(arguments.length==1)c.extend(d,
  34. a);else{d={x:a,y:b};if(arguments.length>=4)d.orientation=[arguments[2],arguments[3]];if(arguments.length==6)d.offsets=[arguments[4],arguments[5]]}var e=new ka(d);e.clone=function(){return new ka(d)};return e};this.repaint=function(a){var b=function(e){e=w(e);T(e)};if(typeof a=="object")for(var d=0;d<a.length;d++)b(a[d]);else b(a)};this.repaintEverything=function(){for(var a in j)T(w(a))};this.removeAllEndpoints=function(a){a=F(a,"id");c.detachAll(a);var b=j[a];for(var d in b)I(b[d].canvas);j[a]=[]};
  35. this.removeEveryEndpoint=function(){for(var a in j){var b=j[a];if(b&&b.length)for(var d=0;d<b.length;d++)I(b[d].canvas,b[d].container)}delete j;j={}};this.removeEndpoint=function(a,b){var d=F(a,"id");j[d]&&S(j,d,b)&&I(b.canvas)};this.reset=function(){this.detachEverything();this.removeEveryEndpoint();this.clearCache()};this.setAutomaticRepaint=function(a){i=a};this.setDefaultNewCanvasSize=function(a){ea=a};this.setDefaultScope=function(a){Y=a};this.setDraggable=function(a,b){return fa(a,function(d,
  36. e){H[e]=b;c.CurrentLibrary.isDragSupported(d)&&c.CurrentLibrary.setDraggable(d,b)})};this.setDraggableByDefault=function(a){L=a};this.setDebugLog=function(a){o=a};this.setRepaintFunction=function(a){n=a};this.show=function(a){ja(a,"block")};this.sizeCanvas=function(a,b,d,e,h){if(a){a.style.height=h+"px";a.height=h;a.style.width=e+"px";a.width=e;a.style.left=b+"px";a.style.top=d+"px"}};this.getTestHarness=function(){return{endpointCount:function(a){return(a=j[a])?a.length:0},connectionCount:function(a){a=
  37. a||Y;return(a=s[a])?a.length:0},findIndex:Q,getId:R}};this.toggleVisible=this.toggle=na;this.toggleDraggable=function(a){return fa(a,function(b,d){var e=H[d]==null?L:H[d];e=!e;H[d]=e;c.CurrentLibrary.setDraggable(b,e);return e})};this.unload=function(){delete j;delete x;delete D;delete G;delete H};this.wrap=J;this.addListener=function(a,b){if(typeof a=="object"&&a.length)for(var d=0;d<a.length;d++)N(da,a[d],b);else N(da,a,b)}},c=window.jsPlumb=new m;c.getInstance=function(f){var g=new m;f&&c.extend(g.Defaults,
  38. f);return g}})();
  39. (function(){jsPlumb.Anchors.TopCenter=jsPlumb.makeAnchor(0.5,0,0,-1);jsPlumb.Anchors.BottomCenter=jsPlumb.makeAnchor(0.5,1,0,1);jsPlumb.Anchors.LeftMiddle=jsPlumb.makeAnchor(0,0.5,-1,0);jsPlumb.Anchors.RightMiddle=jsPlumb.makeAnchor(1,0.5,1,0);jsPlumb.Anchors.Center=jsPlumb.makeAnchor(0.5,0.5,0,0);jsPlumb.Anchors.TopRight=jsPlumb.makeAnchor(1,0,0,-1);jsPlumb.Anchors.BottomRight=jsPlumb.makeAnchor(1,1,0,1);jsPlumb.Anchors.TopLeft=jsPlumb.makeAnchor(0,0,0,-1);jsPlumb.Anchors.BottomLeft=jsPlumb.makeAnchor(0,
  40. 1,0,1);jsPlumb.Connectors.Straight=function(){this.compute=function(m,c,f,g,o){f=Math.abs(m[0]-c[0]);g=Math.abs(m[1]-c[1]);var n=0.45*f,i=0.45*g;f*=1.9;g*=1.9;var j=Math.min(m[0],c[0])-n,v=Math.min(m[1],c[1])-i;if(f<2*o){f=2*o;j=m[0]+(c[0]-m[0])/2-o;n=(f-Math.abs(m[0]-c[0]))/2}if(g<2*o){g=2*o;v=m[1]+(c[1]-m[1])/2-o;i=(g-Math.abs(m[1]-c[1]))/2}return[j,v,f,g,m[0]<c[0]?f-n:n,m[1]<c[1]?g-i:i,m[0]<c[0]?n:f-n,m[1]<c[1]?i:g-i]};this.paint=function(m,c){c.beginPath();c.moveTo(m[4],m[5]);c.lineTo(m[6],m[7]);
  41. c.stroke()}};jsPlumb.Connectors.Bezier=function(m){var c=this;this.majorAnchor=m||150;this.minorAnchor=10;this._findControlPoint=function(f,g,o,n,i){n=n.getOrientation();i=i.getOrientation();var j=[],v=c.majorAnchor,s=c.minorAnchor;if(n[0]!=i[0]||n[1]==i[1]){i[0]==0?j.push(o[0]<g[0]?f[0]+s:f[0]-s):j.push(f[0]+v*i[0]);i[1]==0?j.push(o[1]<g[1]?f[1]+s:f[1]-s):j.push(f[1]+v*n[1])}else{n[0]==0?j.push(g[0]<o[0]?f[0]+s:f[0]-s):j.push(f[0]-v*n[0]);n[1]==0?j.push(g[1]<o[1]?f[1]+s:f[1]-s):j.push(f[1]+v*i[1])}return j};
  42. this.compute=function(f,g,o,n,i){i=i||0;var j=Math.abs(f[0]-g[0])+i,v=Math.abs(f[1]-g[1])+i,s=Math.min(f[0],g[0])-i/2,x=Math.min(f[1],g[1])-i/2,G=f[0]<g[0]?j-i/2:i/2,H=f[1]<g[1]?v-i/2:i/2,L=f[0]<g[0]?i/2:j-i/2;i=f[1]<g[1]?i/2:v-i/2;var D=c._findControlPoint([G,H],f,g,o,n);f=c._findControlPoint([L,i],g,f,n,o);g=Math.min(Math.min(G,L),Math.min(D[0],f[0]));o=Math.max(Math.max(G,L),Math.max(D[0],f[0]));if(o>j)j=o;if(g<0){s+=g;g=Math.abs(g);j+=g;D[0]+=g;G+=g;L+=g;f[0]+=g}g=Math.min(Math.min(H,i),Math.min(D[1],
  43. f[1]));o=Math.max(Math.max(H,i),Math.max(D[1],f[1]));if(o>v)v=o;if(g<0){x+=g;g=Math.abs(g);v+=g;D[1]+=g;H+=g;i+=g;f[1]+=g}return[s,x,j,v,G,H,L,i,D[0],D[1],f[0],f[1]]};this.paint=function(f,g){g.beginPath();g.moveTo(f[4],f[5]);g.bezierCurveTo(f[8],f[9],f[10],f[11],f[6],f[7]);g.stroke()}};jsPlumb.Endpoints.Dot=function(m){m=m||{radius:10};var c=this;this.radius=m.radius;var f=0.5*this.radius,g=this.radius/3,o=function(n){try{return parseInt(n)}catch(i){if(n.substring(n.length-1)=="%")return parseInt(n.substring(0,
  44. n-1))}};this.paint=function(n,i,j,v,s){var x=v.radius||c.radius;jsPlumb.sizeCanvas(j,n[0]-x,n[1]-x,x*2,x*2);n=j.getContext("2d");j=jsPlumb.extend({},v);if(j.fillStyle==null)j.fillStyle=s.strokeStyle;jsPlumb.extend(n,j);s=/MSIE/.test(navigator.userAgent)&&!window.opera;if(v.gradient&&!s){s=v.gradient;j=f;var G=g;if(s.offset)j=o(s.offset);if(s.innerRadius)G=o(s.innerRadius);s=[j,G];i=n.createRadialGradient(x,x,x,x+(i[0]==1?s[0]*-1:s[0]),x+(i[1]==1?s[0]*-1:s[0]),s[1]);for(s=0;s<v.gradient.stops.length;s++)i.addColorStop(v.gradient.stops[s][0],
  45. v.gradient.stops[s][1]);n.fillStyle=i}n.beginPath();n.arc(x,x,x,0,Math.PI*2,true);n.closePath();n.fill()}};jsPlumb.Endpoints.Rectangle=function(m){m=m||{width:20,height:20};var c=this;this.width=m.width;this.height=m.height;this.paint=function(f,g,o,n,i){var j=n.width||c.width,v=n.height||c.height;jsPlumb.sizeCanvas(o,f[0]-j/2,f[1]-v/2,j,v);f=o.getContext("2d");o=jsPlumb.extend({},n);if(o.fillStyle==null)o.fillStyle=i.strokeStyle;jsPlumb.extend(f,o);i=/MSIE/.test(navigator.userAgent)&&!window.opera;
  46. if(n.gradient&&!i){g=f.createLinearGradient(g[0]==1?j:g[0]==0?j/2:0,g[1]==1?v:g[1]==0?v/2:0,g[0]==-1?j:g[0]==0?v/2:0,g[1]==-1?v:g[1]==0?v/2:0);for(i=0;i<n.gradient.stops.length;i++)g.addColorStop(n.gradient.stops[i][0],n.gradient.stops[i][1]);f.fillStyle=g}f.beginPath();f.rect(0,0,j,v);f.closePath();f.fill()}};jsPlumb.Endpoints.Triangle=function(m){m=m||{width:15,height:15};var c=this;this.width=m.width;this.height=m.height;this.paint=function(f,g,o,n){var i=n.width||c.width,j=n.height||c.height;
  47. jsPlumb.sizeCanvas(o,f[0]-i/2,f[1]-j/2,i,j);f=o.getContext("2d");var v=o=0,s=0;if(g[0]==1){o=i;v=j;s=180}if(g[1]==-1){o=i;s=90}if(g[1]==1){v=j;s=-90}f.fillStyle=n.fillStyle;f.translate(o,v);f.rotate(s*Math.PI/180);f.beginPath();f.moveTo(0,0);f.lineTo(i/2,j/2);f.lineTo(0,j);f.closePath();f.fill()}};jsPlumb.Endpoints.Image=function(m){var c=this;this.img=new Image;this.img.onload=function(){c.ready=true};this.img.src=m.url;var f=function(g,o,n,i){o=c.img.width||i.width;i=c.img.height||i.height;jsPlumb.sizeCanvas(n,
  48. g[0]-o/2,g[1]-i/2,o,i);n.getContext("2d").drawImage(c.img,0,0)};this.paint=function(g,o,n,i,j){c.ready?f(g,o,n,i,j):window.setTimeout(function(){c.paint(g,o,n,i,j)},200)}}})();
  49. (function(m){m.fn.plumb=function(c){c=m.extend({},c);return this.each(function(){var f=m.extend({source:m(this)},c);jsPlumb.connect(f)})};m.fn.detach=function(c){return this.each(function(){if(c){var f=m(this).attr("id");if(typeof c=="string")c=[c];for(var g=0;g<c.length;g++)jsPlumb.detach(f,c[g])}})};m.fn.detachAll=function(){return this.each(function(){var c=m(this).attr("id");jsPlumb.detachAll(c)})};m.fn.addEndpoint=function(c){var f=[];this.each(function(){f.push(jsPlumb.addEndpoint(m(this).attr("id"),
  50. c))});return f[0]};m.fn.addEndpoints=function(c){var f=[];return this.each(function(){for(var g=jsPlumb.addEndpoints(m(this).attr("id"),c),o=0;o<g.length;o++)f.push(g[o])})};m.fn.removeEndpoint=function(c){this.each(function(){jsPlumb.removeEndpoint(m(this).attr("id"),c)})}})(jQuery);
  51. (function(m){jsPlumb.CurrentLibrary={dragEvents:{start:"start",stop:"stop",drag:"drag",step:"step",over:"over",out:"out",drop:"drop",complete:"complete"},appendElement:function(c,f){jsPlumb.CurrentLibrary.getElementObject(f).append(c)},extend:function(c,f){return m.extend(c,f)},getElementObject:function(c){return typeof c=="string"?m("#"+c):m(c)},getOffset:function(c){return c.offset()},getSize:function(c){return[c.outerWidth(),c.outerHeight()]},getAttribute:function(c,f){return c.attr(f)},setAttribute:function(c,
  52. f,g){c.attr(f,g)},addClass:function(c,f){c.addClass(f)},initDraggable:function(c,f){f.helper=null;f.scope=f.scope||jsPlumb.Defaults.Scope;c.draggable(f)},isDragSupported:function(c){return c.draggable},setDraggable:function(c,f){c.draggable("option","disabled",!f)},initDroppable:function(c,f){f.scope=f.scope||jsPlumb.Defaults.Scope;c.droppable(f)},isDropSupported:function(c){return c.droppable},animate:function(c,f,g){c.animate(f,g)},getUIPosition:function(c){c=c[1];return c.absolutePosition||c.offset},
  53. getDragObject:function(c){return c[1].draggable},removeElement:function(c){jsPlumb.CurrentLibrary.getElementObject(c).remove()},getScrollLeft:function(c){return c.scrollLeft()},getScrollTop:function(c){return c.scrollTop()}}})(jQuery);