(function(){var u=/MSIE/.test(navigator.userAgent)&&!window.opera,s=null,f=function(){j.repaintEverything()},g=true,l={},k=[],h={},m={},d=true,e=[],p=1200,w=function(a,b,c){var i=function(q,t){if(q===t)return true;else if(typeof q=="object"&&typeof t=="object"){var v=true;for(var x in q)if(!i(q[x],t[x])){v=false;break}for(x in t)if(!i(t[x],q[x])){v=false;break}return v}};c=+c||0;for(var n=a.length;c=0){delete a[c];a.splice(c,1);return true}}return false},Y=function(a,b){var c=z(a,"id");U(c,function(i){i.canvas.style.display=b})},Z=function(a){U(a,function(b){b.canvas.style.display="none"==b.canvas.style.display?"block":"none"})},M=function(a,b,c){if(c||b==null){A(a);e[a]=V(a);b=j.CurrentLibrary.getElementObject(a); b=j.CurrentLibrary.getOffset(b);k[a]=b}else k[a]=b},J=function(a,b){a=a||function(){};b=b||function(){};return function(){try{b.apply(this,arguments)}catch(c){}try{a.apply(this,arguments)}catch(i){}}},ba=function(a){var b=this;this.x=a.x||0;this.y=a.y||0;var c=a.orientation||[0,0];this.offsets=a.offsets||[0,0];this.compute=function(i,n){return[i[0]+b.x*n[0]+b.offsets[0],i[1]+b.y*n[1]+b.offsets[1]]};this.getOrientation=function(){return c}},ca=function(a){var b=a.reference,c=V(a.referenceCanvas),i= 0,n=0,q=null;this.compute=function(t){n=i=0;return[t[0]+c[0]/2,t[1]+c[1]/2]};this.getOrientation=function(){if(q)return q;else{var t=b.getOrientation();return[Math.abs(t[0])*i*-1,Math.abs(t[1])*n*-1]}};this.over=function(t){q=t.getOrientation()};this.out=function(){q=null}},aa=function(a){var b=this;this.source=A(a.source);this.target=A(a.target);this.sourceId=z(this.source,"id");this.targetId=z(this.target,"id");this.endpointsOnTop=a.endpointsOnTop!=null?a.endpointsOnTop:true;this.endpoints=[];this.endpointStyles= [];var c=function(q,t,v){if(q)b.endpoints[t]=q;else{if(!v.endpoints)v.endpoints=[null,null];q=v.endpoints[t]||v.endpoint||j.Defaults.Endpoints[t]||j.Defaults.Endpoint||new j.Endpoints.Dot;if(!v.endpointStyles)v.endpointStyles=[null,null];b.endpoints[t]=new S({style:v.endpointStyles[t]||v.endpointStyle||j.Defaults.EndpointStyles[t]||j.Defaults.EndpointStyle,endpoint:q,connections:[b],anchor:v.anchors?v.anchors[t]:j.Defaults.Anchors[t]||j.Anchors.BottomCenter,source:b.source})}};c(a.sourceEndpoint, 0,a);c(a.targetEndpoint,1,a);this.connector=this.endpoints[0].connector||this.endpoints[1].connector||a.connector||j.Defaults.Connector||new j.Connectors.Bezier;this.paintStyle=this.endpoints[0].connectorStyle||this.endpoints[1].connectorStyle||a.paintStyle||j.Defaults.PaintStyle;M(this.sourceId);M(this.targetId);c=k[this.sourceId];var i=e[this.sourceId];c=this.endpoints[0].anchor.compute([c.left,c.top],i);this.endpoints[0].paint(c);c=k[this.targetId];i=e[this.targetId];c=this.endpoints[1].anchor.compute([c.left, c.top],i);this.endpoints[1].paint(c);var n=W(j.connectorClass);this.canvas=n;this.paint=function(q,t,v){s&&s.debug("Painting Connection; element in motion is "+q+"; ui is ["+t+"]; recalc is ["+v+"]");var x=q!=this.sourceId,H=x?this.sourceId:this.targetId,y=x?0:1,r=x?1:0;if(this.canvas.getContext){M(q,t,v);v&&M(H);t=k[q];v=k[H];q=e[q];var P=e[H];H=n.getContext("2d");var K=this.endpoints[r].anchor.compute([t.left,t.top],q,[v.left,v.top],P);this.endpoints[r].anchor.getOrientation();t=this.endpoints[y].anchor.compute([v.left, v.top],P,[t.left,t.top],q);this.endpoints[y].anchor.getOrientation();y=this.connector.compute(K,t,this.endpoints[r].anchor,this.endpoints[y].anchor,this.paintStyle.lineWidth);j.sizeCanvas(n,y[0],y[1],y[2],y[3]);j.extend(H,this.paintStyle);if(this.paintStyle.gradient&&!u){x=x?H.createLinearGradient(y[4],y[5],y[6],y[7]):H.createLinearGradient(y[6],y[7],y[4],y[5]);for(r=0;r=0&&b.connections.splice(o,1)};this.makeInPlaceCopy=function(){return new S({anchor:b.anchor,source:n,style:i,endpoint:c})};this.isConnectedTo=function(o){var D=false;if(o)for(var B=0;B=t};this.paint=function(o,D,B){s&&s.debug("Painting Endpoint with elementId ["+q+"]; anchorPoint is ["+o+"]");if(o==null){o=k[q];var O=e[q];if(o==null||O==null){M(q);o=k[q];O=e[q]}o=b.anchor.compute([o.left,o.top],O)}c.paint(o,b.anchor.getOrientation(),B||b.canvas,i,D||i)};if(a.isSource&&j.CurrentLibrary.isDragSupported(n)){var y=null,r=null,P=false,K=null,C=a.dragOptions|| {},L=j.extend({},j.CurrentLibrary.defaultDragOptions);C=j.extend(L,C);L=j.CurrentLibrary.dragEvents.start;var Q=j.CurrentLibrary.dragEvents.stop,R=j.CurrentLibrary.dragEvents.drag;C[L]=J(C[L],function(){H=b.makeInPlaceCopy();H.paint();y=document.createElement("div");document.body.appendChild(y);var o=""+new String((new Date).getTime());F(A(y),"id",o);M(o);F(A(b.canvas),"dragId",o);F(A(b.canvas),"elId",q);var D=new ca({reference:b.anchor,referenceCanvas:b.canvas});x=new S({style:{fillStyle:"rgba(0,0,0,0)"}, endpoint:c,anchor:D,source:y});r=b.connections.length==0||b.connections.length0)for(var i=0;i0)for(var n=0;n=4)c.orientation=[arguments[2],arguments[3]];if(arguments.length==6)c.offsets=[arguments[4],arguments[5]]}return new ba(c)},repaint:function(a){var b=function(i){i=A(i);I(i)};if(typeof a=="object")for(var c=0;cm)m=l;if(g<0){e+=g;g=Math.abs(g);m+=g;G[0]+=g;w+=g;I+=g;f[0]+=g}g=Math.min(Math.min(E,h),Math.min(G[1], f[1]));l=Math.max(Math.max(E,h),Math.max(G[1],f[1]));if(l>d)d=l;if(g<0){p+=g;g=Math.abs(g);d+=g;G[1]+=g;E+=g;h+=g;f[1]+=g}return[e,p,m,d,w,E,I,h,G[0],G[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(u){u=u||{radius:10};var s=this;this.radius=u.radius;var f=0.5*this.radius,g=this.radius/3,l=function(k){try{return parseInt(k)}catch(h){if(k.substring(k.length-1)=="%")return parseInt(k.substring(0, k-1))}};this.paint=function(k,h,m,d,e){var p=d.radius||s.radius;jsPlumb.sizeCanvas(m,k[0]-p,k[1]-p,p*2,p*2);k=m.getContext("2d");m=jsPlumb.extend({},d);if(m.fillStyle==null)m.fillStyle=e.strokeStyle;jsPlumb.extend(k,m);e=/MSIE/.test(navigator.userAgent)&&!window.opera;if(d.gradient&&!e){e=d.gradient;m=f;var w=g;if(e.offset)m=l(e.offset);if(e.innerRadius)w=l(e.innerRadius);e=[m,w];h=k.createRadialGradient(p,p,p,p+(h[0]==1?e[0]*-1:e[0]),p+(h[1]==1?e[0]*-1:e[0]),e[1]);for(e=0;e