yui.jsPlumb-1.3.6-all-min.js 109 KB

1
  1. (function(){var w=!!document.createElement("canvas").getContext,e=!!window.SVGAngle||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1"),b=!(w|e);var i=function(E,G){if(E){for(var F=0;F<E.length;F++){if(G(E[F])){return F}}}return -1},D=function(E,F){return i(E,function(G){return G==F})},y=function(F,G){var E=i(F,G);if(E>-1){F.splice(E,1)}return E!=-1},m=function(F,G){var E=D(F,G);if(E>-1){F.splice(E,1)}return E!=-1},r=function(G,F,E){if(i(G,E)==-1){G.push(F)}},l=function(H,F,G){var E=H[F];if(E==null){E=[],H[F]=E}E.push(G);return E};if(!window.console){window.console={time:function(){},timeEnd:function(){},group:function(){},groupEnd:function(){},log:function(){}}}var u=null,d=function(E,F){return o.CurrentLibrary.getAttribute(A(E),F)},f=function(F,G,E){o.CurrentLibrary.setAttribute(A(F),G,E)},x=function(F,E){o.CurrentLibrary.addClass(A(F),E)},k=function(F,E){return o.CurrentLibrary.hasClass(A(F),E)},n=function(F,E){o.CurrentLibrary.removeClass(A(F),E)},A=function(E){return o.CurrentLibrary.getElementObject(E)},s=function(E){return o.CurrentLibrary.getOffset(A(E))},a=function(E){return o.CurrentLibrary.getSize(A(E))},z=true,p=function(){if(z&&typeof console!="undefined"){try{var F=arguments[arguments.length-1];console.log(F)}catch(E){}}},C=function(E){if(z&&typeof console!="undefined"){console.group(E)}},h=function(E){if(z&&typeof console!="undefined"){console.groupEnd(E)}},B=function(E){if(z&&typeof console!="undefined"){console.time(E)}},t=function(E){if(z&&typeof console!="undefined"){console.timeEnd(E)}};EventGenerator=function(){var G={},F=this;var E=["ready"];this.bind=function(H,I){l(G,H,I)};this.fire=function(J,K,H){if(G[J]){for(var I=0;I<G[J].length;I++){if(i(E,function(M){return M===J})!=-1){G[J][I](K,H)}else{try{G[J][I](K,H)}catch(L){p("jsPlumb: fire failed for event "+J+" : "+L)}}}}};this.clearListeners=function(H){if(H){delete G[H]}else{delete G;G={}}};this.getListener=function(H){return G[H]}},_timestamp=function(){return""+(new Date()).getTime()},jsPlumbUIComponent=function(I){var T=this,P=arguments,N=false,R=I.parameters||{},F=T.idPrefix,H=F+(new Date()).getTime();T._jsPlumb=I._jsPlumb;T.getId=function(){return H};T.tooltip=I.tooltip;T.hoverClass=I.hoverClass;EventGenerator.apply(this);this.clone=function(){var U=new Object();T.constructor.apply(U,P);return U};this.getParameter=function(U){return R[U]},this.getParameters=function(){return R},this.setParameter=function(U,V){R[U]=V},this.setParameters=function(U){R=U},this.overlayPlacements=[],this.paintStyle=null,this.hoverPaintStyle=null;var J=I.beforeDetach;this.isDetachAllowed=function(U){var V=T._jsPlumb.checkCondition("beforeDetach",U);if(J){try{V=J(U)}catch(W){p("jsPlumb: beforeDetach callback failed",W)}}return V};var L=I.beforeDrop;this.isDropAllowed=function(X,U,V){var W=T._jsPlumb.checkCondition("beforeDrop",{sourceId:X,targetId:U,scope:V});if(L){try{W=L({sourceId:X,targetId:U,scope:V})}catch(Y){p("jsPlumb: beforeDrop callback failed",Y)}}return W};var Q=function(){if(T.paintStyle&&T.hoverPaintStyle){var U={};o.extend(U,T.paintStyle);o.extend(U,T.hoverPaintStyle);delete T.hoverPaintStyle;if(U.gradient&&T.paintStyle.fillStyle){delete U.gradient}T.hoverPaintStyle=U}};this.setPaintStyle=function(U,V){T.paintStyle=U;T.paintStyleInUse=T.paintStyle;Q();if(!V){T.repaint()}};this.setHoverPaintStyle=function(U,V){T.hoverPaintStyle=U;Q();if(!V){T.repaint()}};this.setHover=function(U,W,V){if(!T._jsPlumb.currentlyDragging&&!T._jsPlumb.isHoverSuspended()){N=U;if(T.hoverClass!=null&&T.canvas!=null){if(U){K.addClass(T.canvas,T.hoverClass)}else{K.removeClass(T.canvas,T.hoverClass)}}if(T.hoverPaintStyle!=null){T.paintStyleInUse=U?T.hoverPaintStyle:T.paintStyle;V=V||_timestamp();T.repaint({timestamp:V,recalc:false})}if(T.getAttachedElements&&!W){O(U,_timestamp(),T)}}};this.isHover=function(){return N};var K=o.CurrentLibrary,S=["click","dblclick","mouseenter","mouseout","mousemove","mousedown","mouseup","contextmenu"],M={mouseout:"mouseexit"},G=function(W,X,V){var U=M[V]||V;K.bind(W,V,function(Y){X.fire(U,X,Y)})},E=function(W,V){var U=M[V]||V;K.unbind(W,V)};this.attachListeners=function(V,W){for(var U=0;U<S.length;U++){G(V,W,S[U])}};var O=function(Y,X,U){var W=T.getAttachedElements();if(W){for(var V=0;V<W.length;V++){if(!U||U!=W[V]){W[V].setHover(Y,true,X)}}}};this.reattachListenersForElement=function(V){if(arguments.length>1){for(var U=0;U<S.length;U++){E(V,S[U])}for(var U=1;U<arguments.length;U++){T.attachListeners(V,arguments[U])}}}},overlayCapableJsPlumbUIComponent=function(J){jsPlumbUIComponent.apply(this,arguments);var O=this;this.overlays=[];var H=function(T){var R=null;if(T.constructor==Array){var Q=T[0],S=o.extend({component:O,_jsPlumb:O._jsPlumb},T[1]);if(T.length==3){o.extend(S,T[2])}R=new o.Overlays[O._jsPlumb.getRenderMode()][Q](S);if(S.events){for(var P in S.events){R.bind(P,S.events[P])}}}else{if(T.constructor==String){R=new o.Overlays[O._jsPlumb.getRenderMode()][T]({component:O,_jsPlumb:O._jsPlumb})}else{R=T}}O.overlays.push(R)},I=function(T){var P=O.defaultOverlayKeys||[],S=T.overlays,Q=function(U){return O._jsPlumb.Defaults[U]||o.Defaults[U]||[]};if(!S){S=[]}for(var R=0;R<P.length;R++){S.unshift.apply(S,Q(P[R]))}return S};var F=I(J);if(F){for(var K=0;K<F.length;K++){H(F[K])}}var E=function(R){var P=-1;for(var Q=0;Q<O.overlays.length;Q++){if(R===O.overlays[Q].id){P=Q;break}}return P};this.addOverlay=function(P){H(P);O.repaint()};this.getOverlay=function(Q){var P=E(Q);return P>=0?O.overlays[P]:null};this.hideOverlay=function(Q){var P=O.getOverlay(Q);if(P){P.hide()}};this.showOverlay=function(Q){var P=O.getOverlay(Q);if(P){P.show()}};this.removeAllOverlays=function(){O.overlays.splice(0,O.overlays.length);O.repaint()};this.removeOverlay=function(Q){var P=E(Q);if(P!=-1){var R=O.overlays[P];R.cleanup();O.overlays.splice(P,1)}};this.removeOverlays=function(){for(var P=0;P<arguments.length;P++){O.removeOverlay(arguments[P])}};var G="__label",N=function(R){var P={cssClass:R.cssClass,labelStyle:this.labelStyle,id:G,component:O,_jsPlumb:O._jsPlumb},Q=o.extend(P,R);return new o.Overlays[O._jsPlumb.getRenderMode()].Label(Q)};if(J.label){var L=J.labelLocation||O.defaultLabelLocation||0.5,M=J.labelStyle||O._jsPlumb.Defaults.LabelStyle||o.Defaults.LabelStyle;this.overlays.push(N({label:J.label,location:L,labelStyle:M}))}this.setLabel=function(P){var Q=O.getOverlay(G);if(!Q){var R=P.constructor==String||P.constructor==Function?{label:P}:P;Q=N(R);this.overlays.push(Q)}else{if(P.constructor==String||P.constructor==Function){Q.setLabel(P)}else{if(P.label){Q.setLabel(P.label)}if(P.location){Q.setLocation(P.location)}}}O.repaint()};this.getLabel=function(){var P=O.getOverlay(G);return P!=null?P.getLabel():null};this.getLabelOverlay=function(){return O.getOverlay(G)}},_bindListeners=function(G,E,F){G.bind("click",function(H,I){E.fire("click",E,I)});G.bind("dblclick",function(H,I){E.fire("dblclick",E,I)});G.bind("contextmenu",function(H,I){E.fire("contextmenu",E,I)});G.bind("mouseenter",function(H,I){if(!E.isHover()){F(true);E.fire("mouseenter",E,I)}});G.bind("mouseexit",function(H,I){if(E.isHover()){F(false);E.fire("mouseexit",E,I)}})};var g=0,c=function(){var E=g+1;g++;return E};var v=function(F){this.Defaults={Anchor:"BottomCenter",Anchors:[null,null],ConnectionsDetachable:true,ConnectionOverlays:[],Connector:"Bezier",Container:null,DragOptions:{},DropOptions:{},Endpoint:"Dot",EndpointOverlays:[],Endpoints:[null,null],EndpointStyle:{fillStyle:"#456"},EndpointStyles:[null,null],EndpointHoverStyle:null,EndpointHoverStyles:[null,null],HoverPaintStyle:null,LabelStyle:{color:"black"},LogEnabled:false,Overlays:[],MaxConnections:1,PaintStyle:{lineWidth:8,strokeStyle:"#456"},RenderMode:"svg",Scope:"jsPlumb_DefaultScope"};if(F){o.extend(this.Defaults,F)}this.logEnabled=this.Defaults.LogEnabled;EventGenerator.apply(this);var a8=this,ax=c(),az=a8.bind,ao={};for(var an in this.Defaults){ao[an]=this.Defaults[an]}this.bind=function(bg,bf){if("ready"===bg&&G){bf()}else{az.apply(a8,[bg,bf])}};a8.importDefaults=function(bg){for(var bf in bg){a8.Defaults[bf]=bg[bf]}};a8.restoreDefaults=function(){a8.Defaults=o.extend({},ao)};var I=null,af=function(){o.repaintEverything()},ba=true,aA=function(){if(ba){af()}},aZ=null,G=false,aJ={},aE={},aF={},Y={},bb={},a0={},a7={},be=[],V=[],J=this.Defaults.Scope,P=null,N=function(bi,bg,bh){var bf=bi[bg];if(bf==null){bf=[];bi[bg]=bf}bf.push(bh);return bf},aH=function(bg,bf){if(a8.Defaults.Container){o.CurrentLibrary.appendElement(bg,a8.Defaults.Container)}else{if(!bf){document.body.appendChild(bg)}else{o.CurrentLibrary.appendElement(bg,bf)}}},ap=1,aa=function(){return""+ap++},av=function(bf){return bf._nodes?bf._nodes:bf},aR=false,a1=function(bg,bf){aR=bg;if(bf){a8.repaintEverything()}},aV=function(bh,bj,bi){if(!aR){var bk=d(bh,"id"),bf=a8.dragManager.getElementsForDraggable(bk);if(bi==null){bi=_timestamp()}a8.anchorManager.redraw(bk,bj,bi);if(bf){for(var bg in bf){a8.anchorManager.redraw(bf[bg].id,bj,bi,bf[bg].offset)}}}},at=function(bg,bi){var bj=null;if(bg.constructor==Array){bj=[];for(var bf=0;bf<bg.length;bf++){var bh=A(bg[bf]),bk=d(bh,"id");bj.push(bi(bh,bk))}}else{var bh=A(bg),bk=d(bh,"id");bj=bi(bh,bk)}return bj},ai=function(bf){return aF[bf]},aW=function(bi,bf,bl){var bn=bf==null?false:bf,bj=o.CurrentLibrary;if(bn){if(bj.isDragSupported(bi)&&!bj.isAlreadyDraggable(bi)){var bm=bl||a8.Defaults.DragOptions||o.Defaults.DragOptions;bm=o.extend({},bm);var bk=bj.dragEvents.drag,bg=bj.dragEvents.stop,bh=bj.dragEvents.start;bm[bk]=ac(bm[bk],function(){var bo=bj.getUIPosition(arguments);aV(bi,bo);x(bi,"jsPlumb_dragged")});bm[bg]=ac(bm[bg],function(){var bo=bj.getUIPosition(arguments);aV(bi,bo);n(bi,"jsPlumb_dragged")});a7[E(bi)]=true;var bn=a7[E(bi)];bm.disabled=bn==null?false:!bn;bj.initDraggable(bi,bm,false);a8.dragManager.register(bi)}}},am=function(bl,bg){var bf=o.extend({},bl);if(bg){o.extend(bf,bg)}if(bf.source&&bf.source.endpoint){bf.sourceEndpoint=bf.source}if(bf.source&&bf.target.endpoint){bf.targetEndpoint=bf.target}if(bl.uuids){bf.sourceEndpoint=ai(bl.uuids[0]);bf.targetEndpoint=ai(bl.uuids[1])}if(bf.sourceEndpoint&&bf.sourceEndpoint.isFull()){p(a8,"could not add connection; source endpoint is full");return}if(bf.targetEndpoint&&bf.targetEndpoint.isFull()){p(a8,"could not add connection; target endpoint is full");return}if(bf.sourceEndpoint&&bf.sourceEndpoint.connectorOverlays){bf.overlays=bf.overlays||[];for(var bj=0;bj<bf.sourceEndpoint.connectorOverlays.length;bj++){bf.overlays.push(bf.sourceEndpoint.connectorOverlays[bj])}}bf.tooltip=bl.tooltip;if(!bf.tooltip&&bf.sourceEndpoint&&bf.sourceEndpoint.connectorTooltip){bf.tooltip=bf.sourceEndpoint.connectorTooltip}if(bf.target&&!bf.target.endpoint&&!bf.targetEndpoint&&!bf.newConnection){var bk=E(bf.target),bm=aK[bk],bh=au[bk];if(bm){var bi=bh!=null?bh:a8.addEndpoint(bf.target,bm);if(a2[bk]){au[bk]=bi}bf.targetEndpoint=bi}}if(bf.source&&!bf.source.endpoint&&!bf.sourceEndpoint&&!bf.newConnection){var bk=E(bf.source),bm=al[bk],bh=aQ[bk];if(bm){var bi=bh!=null?bh:a8.addEndpoint(bf.source,bm);if(aU[bk]){aQ[bk]=bi}bf.sourceEndpoint=bi}}return bf},U=function(bj){var bi=a8.Defaults.ConnectionType||a8.getDefaultConnectionType(),bh=a8.Defaults.EndpointType||W,bg=o.CurrentLibrary.getParent;if(bj.container){bj.parent=bj.container}else{if(bj.sourceEndpoint){bj.parent=bj.sourceEndpoint.parent}else{if(bj.source.constructor==bh){bj.parent=bj.source.parent}else{bj.parent=bg(bj.source)}}}bj._jsPlumb=a8;var bf=new bi(bj);bf.id="con_"+aa();bc("click","click",bf);bc("dblclick","dblclick",bf);bc("contextmenu","contextmenu",bf);return bf},bd=function(bg,bh,bf){bh=bh||{};if(!bg.suspendedEndpoint){N(aJ,bg.scope,bg)}if(!bh.doNotFireConnectionEvent&&bh.fireEvent!==false){a8.fire("jsPlumbConnection",{connection:bg,source:bg.source,target:bg.target,sourceId:bg.sourceId,targetId:bg.targetId,sourceEndpoint:bg.endpoints[0],targetEndpoint:bg.endpoints[1]},bf)}a8.anchorManager.newConnection(bg);aV(bg.source)},bc=function(bf,bg,bh){bh.bind(bf,function(bj,bi){a8.fire(bg,bh,bi)})},aj=function(bh){if(bh.container){return bh.container}else{var bf=o.CurrentLibrary.getTagName(bh.source),bg=o.CurrentLibrary.getParent(bh.source);if(bf&&bf.toLowerCase()==="td"){return o.CurrentLibrary.getParent(bg)}else{return bg}}},ar=function(bh){var bg=a8.Defaults.EndpointType||W;bh.parent=aj(bh);bh._jsPlumb=a8;var bf=new bg(bh);bf.id="ep_"+aa();bc("click","endpointClick",bf);bc("dblclick","endpointDblClick",bf);bc("contextmenu","contextmenu",bf);return bf},M=function(bh,bk,bj){var bf=aE[bh];if(bf&&bf.length){for(var bi=0;bi<bf.length;bi++){for(var bg=0;bg<bf[bi].connections.length;bg++){var bl=bk(bf[bi].connections[bg]);if(bl){return}}if(bj){bj(bf[bi])}}}},Q=function(bg){for(var bf in aE){M(bf,bg)}},ah=function(bf,bg){if(bf!=null&&bf.parentNode!=null){bf.parentNode.removeChild(bf)}},aI=function(bh,bg){for(var bf=0;bf<bh.length;bf++){ah(bh[bf],bg)}},a5=function(bg,bf){return at(bg,function(bh,bi){a7[bi]=bf;if(o.CurrentLibrary.isDragSupported(bh)){o.CurrentLibrary.setDraggable(bh,bf)}})},aO=function(bh,bi,bf){bi=bi==="block";var bg=null;if(bf){if(bi){bg=function(bk){bk.setVisible(true,true,true)}}else{bg=function(bk){bk.setVisible(false,true,true)}}}var bj=d(bh,"id");M(bj,function(bl){if(bi&&bf){var bk=bl.sourceId===bj?1:0;if(bl.endpoints[bk].isVisible()){bl.setVisible(true)}}else{bl.setVisible(bi)}},bg)},a3=function(bf){return at(bf,function(bh,bg){var bi=a7[bg]==null?false:a7[bg];bi=!bi;a7[bg]=bi;o.CurrentLibrary.setDraggable(bh,bi);return bi})},aB=function(bf,bh){var bg=null;if(bh){bg=function(bi){var bj=bi.isVisible();bi.setVisible(!bj)}}M(bf,function(bj){var bi=bj.isVisible();bj.setVisible(!bi)},bg)},O=function(bk){var bi=bk.timestamp,bf=bk.recalc,bj=bk.offset,bg=bk.elId;if(!bf){if(bi&&bi===bb[bg]){return Y[bg]}}if(bf||!bj){var bh=A(bg);if(bh!=null){V[bg]=a(bh);Y[bg]=s(bh);bb[bg]=bi}}else{Y[bg]=bj;if(V[bg]==null){var bh=A(bg);if(bh!=null){V[bg]=a(bh)}}}if(Y[bg]&&!Y[bg].right){Y[bg].right=Y[bg].left+V[bg][0];Y[bg].bottom=Y[bg].top+V[bg][1];Y[bg].width=V[bg][0];Y[bg].height=V[bg][1];Y[bg].centerx=Y[bg].left+(Y[bg].width/2);Y[bg].centery=Y[bg].top+(Y[bg].height/2)}return Y[bg]},ay=function(bf){var bg=Y[bf];if(!bg){bg=O({elId:bf})}return{o:bg,s:V[bf]}},E=function(bf,bg){var bh=A(bf);var bi=d(bh,"id");if(!bi||bi=="undefined"){if(arguments.length==2&&arguments[1]!=undefined){bi=bg}else{bi="jsPlumb_"+ax+"_"+aa()}f(bh,"id",bi)}return bi},ac=function(bh,bf,bg){bh=bh||function(){};bf=bf||function(){};return function(){var bi=null;try{bi=bf.apply(this,arguments)}catch(bj){p(a8,"jsPlumb function failed : "+bj)}if(bg==null||(bi!==bg)){try{bh.apply(this,arguments)}catch(bj){p(a8,"wrapped function failed : "+bj)}}return bi}};this.connectorClass="_jsPlumb_connector";this.endpointClass="_jsPlumb_endpoint";this.overlayClass="_jsPlumb_overlay";this.Anchors={};this.Connectors={canvas:{},svg:{},vml:{}};this.Endpoints={canvas:{},svg:{},vml:{}};this.Overlays={canvas:{},svg:{},vml:{}};this.addClass=function(bg,bf){return o.CurrentLibrary.addClass(bg,bf)};this.removeClass=function(bg,bf){return o.CurrentLibrary.removeClass(bg,bf)};this.hasClass=function(bg,bf){return o.CurrentLibrary.hasClass(bg,bf)};this.addEndpoint=function(bh,bi,br){br=br||{};var bg=o.extend({},br);o.extend(bg,bi);bg.endpoint=bg.endpoint||a8.Defaults.Endpoint||o.Defaults.Endpoint;bg.paintStyle=bg.paintStyle||a8.Defaults.EndpointStyle||o.Defaults.EndpointStyle;bh=av(bh);var bj=[],bm=bh.length&&bh.constructor!=String?bh:[bh];for(var bk=0;bk<bm.length;bk++){var bp=A(bm[bk]),bf=E(bp);bg.source=bp;O({elId:bf});var bo=ar(bg);if(bg.parentAnchor){bo.parentAnchor=bg.parentAnchor}N(aE,bf,bo);var bn=Y[bf],bl=V[bf];var bq=bo.anchor.compute({xy:[bn.left,bn.top],wh:bl,element:bo});bo.paint({anchorLoc:bq});bj.push(bo);a8.dragManager.endpointAdded(bp)}return bj.length==1?bj[0]:bj};this.addEndpoints=function(bj,bg,bf){var bi=[];for(var bh=0;bh<bg.length;bh++){var bk=a8.addEndpoint(bj,bg[bh],bf);if(bk.constructor==Array){Array.prototype.push.apply(bi,bk)}else{bi.push(bk)}}return bi};this.animate=function(bh,bg,bf){var bi=A(bh),bl=d(bh,"id");bf=bf||{};var bk=o.CurrentLibrary.dragEvents.step;var bj=o.CurrentLibrary.dragEvents.complete;bf[bk]=ac(bf[bk],function(){a8.repaint(bl)});bf[bj]=ac(bf[bj],function(){a8.repaint(bl)});o.CurrentLibrary.animate(bi,bg,bf)};this.checkCondition=function(bh,bj){var bf=a8.getListener(bh);var bi=true;if(bf&&bf.length>0){try{for(var bg=0;bg<bf.length;bg++){bi=bi&&bf[bg](bj)}}catch(bk){p(a8,"cannot check condition ["+bh+"]"+bk)}}return bi};this.connect=function(bi,bg){var bf=am(bi,bg);if(bf){if(bf.deleteEndpointsOnDetach==null){bf.deleteEndpointsOnDetach=true}var bh=U(bf);bd(bh,bf);return bh}};this.deleteEndpoint=function(bg){var bl=(typeof bg=="string")?aF[bg]:bg;if(bl){var bi=bl.getUuid();if(bi){aF[bi]=null}bl.detachAll();aI(bl.endpoint.getDisplayElements());a8.anchorManager.deleteEndpoint(bl);for(var bk in aE){var bf=aE[bk];if(bf){var bj=[];for(var bh=0;bh<bf.length;bh++){if(bf[bh]!=bl){bj.push(bf[bh])}}aE[bk]=bj}}a8.dragManager.endpointDeleted(bl)}};this.deleteEveryEndpoint=function(){for(var bh in aE){var bf=aE[bh];if(bf&&bf.length){for(var bg=0;bg<bf.length;bg++){a8.deleteEndpoint(bf[bg])}}}delete aE;aE={};delete aF;aF={}};var aS=function(bh,bj){var bg=a8.Defaults.ConnectionType||a8.getDefaultConnectionType(),bf=bh.constructor==bg,bi=bf?{connection:bh,source:bh.source,target:bh.target,sourceId:bh.sourceId,targetId:bh.targetId,sourceEndpoint:bh.endpoints[0],targetEndpoint:bh.endpoints[1]}:bh;if(bj){a8.fire("jsPlumbConnectionDetached",bi)}a8.anchorManager.connectionDetached(bi)};var aP=function(bf){a8.fire("connectionDrag",bf)};var aC=function(bf){a8.fire("connectionDragStop",bf)};this.detach=function(){if(arguments.length==0){return}var bj=a8.Defaults.ConnectionType||a8.getDefaultConnectionType(),bk=arguments[0].constructor==bj,bi=arguments.length==2?bk?(arguments[1]||{}):arguments[0]:arguments[0],bn=(bi.fireEvent!==false),bh=bi.forceDetach,bg=bk?arguments[0]:bi.connection;if(bg){if(bh||(bg.isDetachAllowed(bg)&&bg.endpoints[0].isDetachAllowed(bg)&&bg.endpoints[1].isDetachAllowed(bg))){if(bh||a8.checkCondition("beforeDetach",bg)){bg.endpoints[0].detach(bg,false,true,bn)}}}else{var bf=o.extend({},bi);if(bf.uuids){ai(bf.uuids[0]).detachFrom(ai(bf.uuids[1]),bn)}else{if(bf.sourceEndpoint&&bf.targetEndpoint){bf.sourceEndpoint.detachFrom(bf.targetEndpoint)}else{var bm=E(bf.source),bl=E(bf.target);M(bm,function(bo){if((bo.sourceId==bm&&bo.targetId==bl)||(bo.targetId==bm&&bo.sourceId==bl)){if(a8.checkCondition("beforeDetach",bo)){bo.endpoints[0].detach(bo,false,true,bn)}}})}}}};this.detachAllConnections=function(bh,bi){bi=bi||{};bh=A(bh);var bj=d(bh,"id"),bf=aE[bj];if(bf&&bf.length){for(var bg=0;bg<bf.length;bg++){bf[bg].detachAll(bi.fireEvent)}}};this.detachEveryConnection=function(bh){bh=bh||{};for(var bi in aE){var bf=aE[bi];if(bf&&bf.length){for(var bg=0;bg<bf.length;bg++){bf[bg].detachAll(bh.fireEvent)}}}delete aJ;aJ={}};this.draggable=function(bh,bf){if(typeof bh=="object"&&bh.length){for(var bg=0;bg<bh.length;bg++){var bi=A(bh[bg]);if(bi){aW(bi,true,bf)}}}else{if(bh._nodes){for(var bg=0;bg<bh._nodes.length;bg++){var bi=A(bh._nodes[bg]);if(bi){aW(bi,true,bf)}}}else{var bi=A(bh);if(bi){aW(bi,true,bf)}}}};this.extend=function(bg,bf){return o.CurrentLibrary.extend(bg,bf)};this.getDefaultEndpointType=function(){return W};this.getDefaultConnectionType=function(){return ak};this.getConnections=function(bq){if(!bq){bq={}}else{if(bq.constructor==String){bq={scope:bq}}}var bn=function(br){var bs=[];if(br){if(typeof br=="string"){bs.push(br)}else{bs=br}}return bs},bo=bq.scope||a8.getDefaultScope(),bm=bn(bo),bf=bn(bq.source),bk=bn(bq.target),bg=function(bs,br){return bs.length>0?D(bs,br)!=-1:true},bj=bm.length>1?{}:[],bp=function(bs,bt){if(bm.length>1){var br=bj[bs];if(br==null){br=[];bj[bs]=br}br.push(bt)}else{bj.push(bt)}};for(var bi in aJ){if(bg(bm,bi)){for(var bh=0;bh<aJ[bi].length;bh++){var bl=aJ[bi][bh];if(bg(bf,bl.sourceId)&&bg(bk,bl.targetId)){bp(bi,bl)}}}}return bj};this.getAllConnections=function(){return aJ};this.getDefaultScope=function(){return J};this.getEndpoint=ai;this.getEndpoints=function(bf){return aE[E(bf)]};this.getId=E;this.getOffset=function(bg){var bf=Y[bg];return O({elId:bg})};this.getSelector=function(bf){return o.CurrentLibrary.getSelector(bf)};this.getSize=function(bg){var bf=V[bg];if(!bf){O({elId:bg})}return V[bg]};this.appendElement=aH;var aD=false;this.isHoverSuspended=function(){return aD};this.setHoverSuspended=function(bf){aD=bf};this.hide=function(bf,bg){aO(bf,"none",bg)};this.idstamp=aa;this.init=function(){if(!G){a8.setRenderMode(a8.Defaults.RenderMode);var bf=function(bg){o.CurrentLibrary.bind(document,bg,function(bm){if(!a8.currentlyDragging&&P==o.CANVAS){for(var bl in aJ){var bn=aJ[bl];for(var bj=0;bj<bn.length;bj++){var bi=bn[bj].connector[bg](bm);if(bi){return}}}for(var bk in aE){var bh=aE[bk];for(var bj=0;bj<bh.length;bj++){if(bh[bj].endpoint[bg](bm)){return}}}}})};bf("click");bf("dblclick");bf("mousemove");bf("mousedown");bf("mouseup");bf("contextmenu");G=true;a8.fire("ready")}};this.log=I;this.jsPlumbUIComponent=jsPlumbUIComponent;this.EventGenerator=EventGenerator;this.makeAnchor=function(){if(arguments.length==0){return null}var bk=arguments[0],bh=arguments[1],bg=arguments[2],bi=null;if(!bg){throw"NO JSPLUMB SET"}if(bk.compute&&bk.getOrientation){return bk}else{if(typeof bk=="string"){bi=o.Anchors[arguments[0]]({elementId:bh,jsPlumbInstance:a8})}else{if(bk.constructor==Array){if(bk[0].constructor==Array||bk[0].constructor==String){if(bk.length==2&&bk[0].constructor==String&&bk[1].constructor==Object){var bf=o.extend({elementId:bh,jsPlumbInstance:a8},bk[1]);bi=o.Anchors[bk[0]](bf)}else{bi=new ae(bk,null,bh)}}else{var bj={x:bk[0],y:bk[1],orientation:(bk.length>=4)?[bk[2],bk[3]]:[0,0],offsets:(bk.length==6)?[bk[4],bk[5]]:[0,0],elementId:bh};bi=new S(bj);bi.clone=function(){return new S(bj)}}}}}if(!bi.id){bi.id="anchor_"+aa()}return bi};this.makeAnchors=function(bi,bg,bf){var bj=[];for(var bh=0;bh<bi.length;bh++){if(typeof bi[bh]=="string"){bj.push(o.Anchors[bi[bh]]({elementId:bg,jsPlumbInstance:bf}))}else{if(bi[bh].constructor==Array){bj.push(a8.makeAnchor(bi[bh],bg,bf))}}}return bj};this.makeDynamicAnchor=function(bf,bg){return new ae(bf,bg)};var aK={},au={},a2={};var T=function(bf,bg){bf.paintStyle=bf.paintStyle||a8.Defaults.EndpointStyles[bg]||a8.Defaults.EndpointStyle||o.Defaults.EndpointStyles[bg]||o.Defaults.EndpointStyle;bf.hoverPaintStyle=bf.hoverPaintStyle||a8.Defaults.EndpointHoverStyles[bg]||a8.Defaults.EndpointHoverStyle||o.Defaults.EndpointHoverStyles[bg]||o.Defaults.EndpointHoverStyle;bf.anchor=bf.anchor||a8.Defaults.Anchors[bg]||a8.Defaults.Anchor||o.Defaults.Anchors[bg]||o.Defaults.Anchor;bf.endpoint=bf.endpoint||a8.Defaults.Endpoints[bg]||a8.Defaults.Endpoint||o.Defaults.Endpoints[bg]||o.Defaults.Endpoint};this.makeTarget=function(bh,bi,bo){var bg=o.extend({},bo);o.extend(bg,bi);T(bg,1);var bm=o.CurrentLibrary,bn=bg.scope||a8.Defaults.Scope,bj=!(bg.deleteEndpointsOnDetach===false),bf=function(bt){var br=E(bt);aK[br]=bg;a2[br]=bg.uniqueEndpoint;var bq=o.extend({},bg.dropOptions||{}),bp=function(){a8.currentlyDragging=false;var bG=A(bm.getDragObject(arguments)),bw=d(bG,"dragId"),bE=d(bG,"originalScope"),bB=a0[bw],bv=bB.endpoints[0],bu=bg.endpoint?o.extend({},bg.endpoint):{};bv.anchor.locked=false;if(bE){bm.setDragScope(bG,bE)}var bz=bB.isDropAllowed(bB.sourceId,E(bt),bB.scope);if(bB.endpointsToDeleteOnDetach){if(bv===bB.endpointsToDeleteOnDetach[0]){bB.endpointsToDeleteOnDetach[0]=null}else{if(bv===bB.endpointsToDeleteOnDetach[1]){bB.endpointsToDeleteOnDetach[1]=null}}}if(bB.suspendedEndpoint){bB.targetId=bB.suspendedEndpoint.elementId;bB.target=bm.getElementObject(bB.suspendedEndpoint.elementId);bB.endpoints[1]=bB.suspendedEndpoint}if(bz){bv.detach(bB,false,true,false);var bF=au[br]||a8.addEndpoint(bt,bg);if(bg.uniqueEndpoint){au[br]=bF}if(bF.anchor.positionFinder!=null){var bC=bm.getUIPosition(arguments),by=bm.getOffset(bt),bD=bm.getSize(bt),bx=bF.anchor.positionFinder(bC,by,bD,bF.anchor.constructorParams);bF.anchor.x=bx[0];bF.anchor.y=bx[1]}var bA=a8.connect({source:bv,target:bF,scope:bE,previousConnection:bB,container:bB.parent,deleteEndpointsOnDetach:bj,doNotFireConnectionEvent:bv.endpointWillMoveAfterConnection});if(bj){bA.endpointsToDeleteOnDetach=[bv,bF]}bA.repaint()}else{if(bB.suspendedEndpoint){if(bv.isReattach){bB.setHover(false);bB.floatingAnchorIndex=null;bB.suspendedEndpoint.addConnection(bB);a8.repaint(bv.elementId)}else{bv.detach(bB,false,true,true)}}}};var bs=bm.dragEvents.drop;bq.scope=bq.scope||bn;bq[bs]=ac(bq[bs],bp);bm.initDroppable(bt,bq,true)};bh=av(bh);var bl=bh.length&&bh.constructor!=String?bh:[bh];for(var bk=0;bk<bl.length;bk++){bf(A(bl[bk]))}};this.makeTargets=function(bh,bi,bf){for(var bg=0;bg<bh.length;bg++){a8.makeTarget(bh[bg],bi,bf)}};var al={},aQ={},aU={};this.makeSource=function(bj,bm,bf){var bk=o.extend({},bf);o.extend(bk,bm);T(bk,0);var bi=o.CurrentLibrary,bl=function(bu){var bo=E(bu),bv=bk.parent,bn=bv!=null?a8.getId(bi.getElementObject(bv)):bo;al[bn]=bk;aU[bn]=bk.uniqueEndpoint;var bp=bi.dragEvents.stop,bt=bi.dragEvents.drag,bw=o.extend({},bk.dragOptions||{}),br=bw.drag,bx=bw.stop,by=null,bs=false;bw.scope=bw.scope||bk.scope;bw[bt]=ac(bw[bt],function(){if(br){br.apply(this,arguments)}bs=false});bw[bp]=function(){if(bx){bx.apply(this,arguments)}a8.currentlyDragging=false;if(by.connections.length==0){a8.deleteEndpoint(by)}else{bi.unbind(by.canvas,"mousedown");var bA=bk.anchor||a8.Defaults.Anchor,bB=by.anchor;by.anchor=a8.makeAnchor(bA,bo,a8);if(bk.parent){var bC=bi.getElementObject(bk.parent);if(bC){var bz=by.elementId;by.setElement(bC);by.endpointWillMoveAfterConnection=false;a8.anchorManager.rehomeEndpoint(bz,bC);by.connections[0].previousConnection=null;a8.anchorManager.connectionDetached({sourceId:by.connections[0].sourceId,targetId:by.connections[0].targetId,connection:by.connections[0]});bd(by.connections[0])}}by.repaint();a8.repaint(by.elementId);a8.repaint(by.connections[0].targetId)}};var bq=function(bA){var bF=O({elId:bo});var bE=((bA.pageX||bA.page.x)-bF.left)/bF.width,bD=((bA.pageY||bA.page.y)-bF.top)/bF.height,bJ=bE,bI=bD;if(bk.parent){var bC=o.CurrentLibrary.getElementObject(bk.parent),bB=E(bC);bF=O({elId:bB});bJ=((bA.pageX||bA.page.x)-bF.left)/bF.width,bI=((bA.pageY||bA.page.y)-bF.top)/bF.height}var bH={};o.extend(bH,bk);bH.isSource=true;bH.anchor=[bE,bD,0,0];bH.parentAnchor=[bJ,bI,0,0];bH.dragOptions=bw;if(bk.parent){var bz=bH.container||a8.Defaults.Container;if(bz){bH.container=bz}else{bH.container=o.CurrentLibrary.getParent(bk.parent)}}by=a8.addEndpoint(bo,bH);bs=true;by.endpointWillMoveAfterConnection=bk.parent!=null;by.endpointWillMoveTo=bk.parent?bi.getElementObject(bk.parent):null;var bG=function(){if(bs){a8.deleteEndpoint(by)}};a8.registerListener(by.canvas,"mouseup",bG);a8.registerListener(bu,"mouseup",bG);bi.trigger(by.canvas,"mousedown",bA)};a8.registerListener(bu,"mousedown",bq)};bj=av(bj);var bg=bj.length&&bj.constructor!=String?bj:[bj];for(var bh=0;bh<bg.length;bh++){bl(A(bg[bh]))}};this.makeSources=function(bh,bi,bf){for(var bg=0;bg<bh.length;bg++){a8.makeSource(bh[bg],bi,bf)}};this.ready=function(bf){a8.bind("ready",bf)},this.repaint=function(bg){var bh=function(bi){aV(A(bi))};if(typeof bg=="object"){for(var bf=0;bf<bg.length;bf++){bh(bg[bf])}}else{bh(bg)}};this.repaintEverything=function(){var bg=_timestamp();for(var bf in aE){aV(A(bf),null,bg)}};this.removeAllEndpoints=function(bh){var bf=d(bh,"id"),bi=aE[bf];if(bi){for(var bg=0;bg<bi.length;bg++){a8.deleteEndpoint(bi[bg])}}aE[bf]=[]};this.removeEveryEndpoint=this.deleteEveryEndpoint;this.removeEndpoint=function(bf,bg){a8.deleteEndpoint(bg)};var X={},aY=function(){for(var bg in X){for(var bf=0;bf<X[bg].length;bf++){var bh=X[bg][bf];o.CurrentLibrary.unbind(bh.el,bh.event,bh.listener)}}X={}};this.registerListener=function(bg,bf,bh){o.CurrentLibrary.bind(bg,bf,bh);N(X,bf,{el:bg,event:bf,listener:bh})};this.reset=function(){a8.deleteEveryEndpoint();a8.clearListeners();aK={};au={};a2={};al={};aQ={};aU={};aY();a8.anchorManager.reset();a8.dragManager.reset()};this.setAutomaticRepaint=function(bf){ba=bf};this.setDefaultScope=function(bf){J=bf};this.setDraggable=a5;this.setDebugLog=function(bf){I=bf};this.setRepaintFunction=function(bf){af=bf};this.setSuspendDrawing=a1;this.CANVAS="canvas";this.SVG="svg";this.VML="vml";this.setRenderMode=function(bf){if(bf){bf=bf.toLowerCase()}else{return}if(bf!==o.CANVAS&&bf!==o.SVG&&bf!==o.VML){throw new Error("render mode must be one of jsPlumb.CANVAS, jsPlumb.SVG or jsPlumb.VML")}if(bf===o.CANVAS&&w){P=o.CANVAS}else{if(bf===o.SVG&&e){P=o.SVG}else{if(b){P=o.VML}}}return P};this.getRenderMode=function(){return P};this.show=function(bf,bg){aO(bf,"block",bg)};this.sizeCanvas=function(bh,bf,bj,bg,bi){if(bh){bh.style.height=bi+"px";bh.height=bi;bh.style.width=bg+"px";bh.width=bg;bh.style.left=bf+"px";bh.style.top=bj+"px"}};this.getTestHarness=function(){return{endpointsByElement:aE,endpointCount:function(bf){var bg=aE[bf];return bg?bg.length:0},connectionCount:function(bf){bf=bf||J;var bg=aJ[bf];return bg?bg.length:0},getId:E,makeAnchor:self.makeAnchor,makeDynamicAnchor:self.makeDynamicAnchor}};this.toggle=aB;this.toggleVisible=aB;this.toggleDraggable=a3;this.unload=function(){};this.wrap=ac;this.addListener=this.bind;var a9=function(bk,bh){var bi=null,bf=bk;if(bh.tagName.toLowerCase()==="svg"&&bh.parentNode){bi=bh.parentNode}else{if(bh.offsetParent){bi=bh.offsetParent}}if(bi!=null){var bg=bi.tagName.toLowerCase()==="body"?{left:0,top:0}:s(bi),bj=bi.tagName.toLowerCase()==="body"?{left:0,top:0}:{left:bi.scrollLeft,top:bi.scrollTop};bf[0]=bk[0]-bg.left+bj.left;bf[1]=bk[1]-bg.top+bj.top}return bf};var S=function(bj){var bh=this;this.x=bj.x||0;this.y=bj.y||0;this.elementId=bj.elementId;var bg=bj.orientation||[0,0];var bi=null,bf=null;this.offsets=bj.offsets||[0,0];bh.timestamp=null;this.compute=function(bo){var bn=bo.xy,bk=bo.wh,bl=bo.element,bm=bo.timestamp;if(bm&&bm===bh.timestamp){return bf}bf=[bn[0]+(bh.x*bk[0])+bh.offsets[0],bn[1]+(bh.y*bk[1])+bh.offsets[1]];bf=a9(bf,bl.canvas);bh.timestamp=bm;return bf};this.getOrientation=function(bk){return bg};this.equals=function(bk){if(!bk){return false}var bl=bk.getOrientation();var bm=this.getOrientation();return this.x==bk.x&&this.y==bk.y&&this.offsets[0]==bk.offsets[0]&&this.offsets[1]==bk.offsets[1]&&bm[0]==bl[0]&&bm[1]==bl[1]};this.getCurrentLocation=function(){return bf}};var aM=function(bl){var bj=bl.reference,bk=bl.referenceCanvas,bh=a(A(bk)),bg=0,bm=0,bf=null,bi=null;this.x=0;this.y=0;this.isFloating=true;this.compute=function(bq){var bp=bq.xy,bo=bq.element,bn=[bp[0]+(bh[0]/2),bp[1]+(bh[1]/2)];bn=a9(bn,bo.canvas);bi=bn;return bn};this.getOrientation=function(bo){if(bf){return bf}else{var bn=bj.getOrientation(bo);return[Math.abs(bn[0])*bg*-1,Math.abs(bn[1])*bm*-1]}};this.over=function(bn){bf=bn.getOrientation()};this.out=function(){bf=null};this.getCurrentLocation=function(){return bi}};var ae=function(bh,bg,bm){this.isSelective=true;this.isDynamic=true;var bp=[],bo=this,bn=function(bq){return bq.constructor==S?bq:a8.makeAnchor(bq,bm,a8)};for(var bl=0;bl<bh.length;bl++){bp[bl]=bn(bh[bl])}this.addAnchor=function(bq){bp.push(bn(bq))};this.getAnchors=function(){return bp};this.locked=false;var bi=bp.length>0?bp[0]:null,bk=bp.length>0?0:-1,bo=this,bj=function(bs,bq,bw,bv,br){var bu=bv[0]+(bs.x*br[0]),bt=bv[1]+(bs.y*br[1]);return Math.sqrt(Math.pow(bq-bu,2)+Math.pow(bw-bt,2))},bf=bg||function(bA,br,bs,bt,bq){var bv=bs[0]+(bt[0]/2),bu=bs[1]+(bt[1]/2);var bx=-1,bz=Infinity;for(var bw=0;bw<bq.length;bw++){var by=bj(bq[bw],bv,bu,bA,br);if(by<bz){bx=bw+0;bz=by}}return bq[bx]};this.compute=function(bu){var bt=bu.xy,bq=bu.wh,bs=bu.timestamp,br=bu.txy,bv=bu.twh;if(bo.locked||br==null||bv==null){return bi.compute(bu)}else{bu.timestamp=null}bi=bf(bt,bq,br,bv,bp);bo.x=bi.x;bo.y=bi.y;return bi.compute(bu)};this.getCurrentLocation=function(){return bi!=null?bi.getCurrentLocation():null};this.getOrientation=function(bq){return bi!=null?bi.getOrientation(bq):[0,0]};this.over=function(bq){if(bi!=null){bi.over(bq)}};this.out=function(){if(bi!=null){bi.out()}}};var a4={},Z={},aw={},L={HORIZONTAL:"horizontal",VERTICAL:"vertical",DIAGONAL:"diagonal",IDENTITY:"identity"},a6=function(bo,bp,bl,bi){if(bo===bp){return{orientation:L.IDENTITY,a:["top","top"]}}var bg=Math.atan2((bi.centery-bl.centery),(bi.centerx-bl.centerx)),bj=Math.atan2((bl.centery-bi.centery),(bl.centerx-bi.centerx)),bk=((bl.left<=bi.left&&bl.right>=bi.left)||(bl.left<=bi.right&&bl.right>=bi.right)||(bl.left<=bi.left&&bl.right>=bi.right)||(bi.left<=bl.left&&bi.right>=bl.right)),bq=((bl.top<=bi.top&&bl.bottom>=bi.top)||(bl.top<=bi.bottom&&bl.bottom>=bi.bottom)||(bl.top<=bi.top&&bl.bottom>=bi.bottom)||(bi.top<=bl.top&&bi.bottom>=bl.bottom));if(!(bk||bq)){var bn=null,bh=false,bf=false,bm=null;if(bi.left>bl.left&&bi.top>bl.top){bn=["right","top"]}else{if(bi.left>bl.left&&bl.top>bi.top){bn=["top","left"]}else{if(bi.left<bl.left&&bi.top<bl.top){bn=["top","right"]}else{if(bi.left<bl.left&&bi.top>bl.top){bn=["left","top"]}}}}return{orientation:L.DIAGONAL,a:bn,theta:bg,theta2:bj}}else{if(bk){return{orientation:L.HORIZONTAL,a:bl.top<bi.top?["bottom","top"]:["top","bottom"],theta:bg,theta2:bj}}else{return{orientation:L.VERTICAL,a:bl.left<bi.left?["right","left"]:["left","right"],theta:bg,theta2:bj}}}},aN=function(bt,bp,bn,bo,bu,bq,bh){var bv=[],bg=bp[bu?0:1]/(bo.length+1);for(var br=0;br<bo.length;br++){var bw=(br+1)*bg,bf=bq*bp[bu?1:0];if(bh){bw=bp[bu?0:1]-bw}var bm=(bu?bw:bf),bj=bn[0]+bm,bl=bm/bp[0],bk=(bu?bf:bw),bi=bn[1]+bk,bs=bk/bp[1];bv.push([bj,bi,bl,bs,bo[br][1],bo[br][2]])}return bv},aT=function(bg,bf){return bg[0]>bf[0]?1:-1},R=function(bf){return function(bh,bg){var bi=true;if(bf){if(bh[0][0]<bg[0][0]){bi=true}else{bi=bh[0][1]>bg[0][1]}}else{if(bh[0][0]>bg[0][0]){bi=true}else{bi=bh[0][1]>bg[0][1]}}return bi===false?-1:1}},H=function(bg,bf){var bi=bg[0][0]<0?-Math.PI-bg[0][0]:Math.PI-bg[0][0],bh=bf[0][0]<0?-Math.PI-bf[0][0]:Math.PI-bf[0][0];if(bi>bh){return 1}else{return bg[0][1]>bf[0][1]?1:-1}},aL={top:aT,right:R(true),bottom:R(true),left:H},ad=function(bf,bg){return bf.sort(bg)},ab=function(bg,bf){var bi=V[bg],bj=Y[bg],bh=function(bq,bx,bm,bp,bv,bu,bl){if(bp.length>0){var bt=ad(bp,aL[bq]),br=bq==="right"||bq==="top",bk=aN(bq,bx,bm,bt,bv,bu,br);var by=function(bB,bA){var bz=a9([bA[0],bA[1]],bB.canvas);Z[bB.id]=[bz[0],bz[1],bA[2],bA[3]];aw[bB.id]=bl};for(var bn=0;bn<bk.length;bn++){var bs=bk[bn][4],bw=bs.endpoints[0].elementId===bg,bo=bs.endpoints[1].elementId===bg;if(bw){by(bs.endpoints[0],bk[bn])}else{if(bo){by(bs.endpoints[1],bk[bn])}}}}};bh("bottom",bi,[bj.left,bj.top],bf.bottom,true,1,[0,1]);bh("top",bi,[bj.left,bj.top],bf.top,true,0,[0,-1]);bh("left",bi,[bj.left,bj.top],bf.left,false,0,[-1,0]);bh("right",bi,[bj.left,bj.top],bf.right,false,1,[1,0])},aq=function(){var bf={},bl={},bh={},bi={},bg=this,bk={};this.reset=function(){bf={};bl={};bk={}};this.newConnection=function(bp){var br=bp.sourceId,bo=bp.targetId,bm=bp.endpoints,bq=true,bn=function(bs,bt,bv,bu,bw){if((br==bo)&&bv.isContinuous){o.CurrentLibrary.removeElement(bm[1].canvas);bq=false}N(bl,bu,[bw,bt,bv.constructor==ae])};bn(0,bm[0],bm[0].anchor,bo,bp);if(bq){bn(1,bm[1],bm[1].anchor,br,bp)}};this.connectionDetached=function(bm){var bn=bm.connection||bm;var bs=bn.sourceId,bt=bn.targetId,bw=bn.endpoints,br=function(bx,by,bA,bz,bB){if(bA.constructor==aM){}else{y(bl[bz],function(bC){return bC[0].id==bB.id})}};br(1,bw[1],bw[1].anchor,bs,bn);br(0,bw[0],bw[0].anchor,bt,bn);var bo=bn.sourceId,bp=bn.targetId,bv=bn.endpoints[0].id,bq=bn.endpoints[1].id,bu=function(bz,bx){if(bz){var by=function(bA){return bA[4]==bx};y(bz.top,by);y(bz.left,by);y(bz.bottom,by);y(bz.right,by)}};bu(bk[bo],bv);bu(bk[bp],bq);bg.redraw(bo);bg.redraw(bp)};this.add=function(bn,bm){N(bf,bm,bn)};this.getConnectionsFor=function(bm){return bl[bm]};this.getEndpointsFor=function(bm){return bf[bm]};this.deleteEndpoint=function(bm){y(bf[bm.elementId],function(bn){return bn.id==bm.id})};this.clearFor=function(bm){delete bf[bm];bf[bm]=[]};var bj=function(bG,bt,bB,bq,bw,bx,bz,bv,bI,by,bp,bF){var bD=-1,bo=-1,br=bq.endpoints[bz],bA=br.id,bu=[1,0][bz],bm=[[bt,bB],bq,bw,bx,bA],bn=bG[bI],bH=br._continuousAnchorEdge?bG[br._continuousAnchorEdge]:null;if(bH){var bE=i(bH,function(bJ){return bJ[4]==bA});if(bE!=-1){bH.splice(bE,1);for(var bC=0;bC<bH.length;bC++){r(bp,bH[bC][1],function(bJ){return bJ.id==bH[bC][1].id});r(bF,bH[bC][1].endpoints[bz],function(bJ){return bJ.id==bH[bC][1].endpoints[bz].id})}}}for(var bC=0;bC<bn.length;bC++){if(bz==1&&bn[bC][3]===bx&&bo==-1){bo=bC}r(bp,bn[bC][1],function(bJ){return bJ.id==bn[bC][1].id});r(bF,bn[bC][1].endpoints[bz],function(bJ){return bJ.id==bn[bC][1].endpoints[bz].id})}if(bD!=-1){bn[bD]=bm}else{var bs=bv?bo!=-1?bo:0:bn.length;bn.splice(bs,0,bm)}br._continuousAnchorEdge=bI};this.redraw=function(bB,bD,bo,br){var bM=bf[bB]||[],bL=bl[bB]||[],bn=[],bK=[],bp=[];bo=bo||_timestamp();br=br||{left:0,top:0};if(bD){bD={left:bD.left+br.left,top:bD.top+br.top}}O({elId:bB,offset:bD,recalc:false,timestamp:bo});var bw=Y[bB],bs=V[bB],by={};for(var bI=0;bI<bL.length;bI++){var bt=bL[bI][0],bv=bt.sourceId,bq=bt.targetId,bu=bt.endpoints[0].anchor.isContinuous,bA=bt.endpoints[1].anchor.isContinuous;if(bu||bA){var bJ=bv+"_"+bq,bG=bq+"_"+bv,bF=by[bJ],bz=bt.sourceId==bB?1:0;if(bu&&!bk[bv]){bk[bv]={top:[],right:[],bottom:[],left:[]}}if(bA&&!bk[bq]){bk[bq]={top:[],right:[],bottom:[],left:[]}}if(bB!=bq){O({elId:bq,timestamp:bo})}if(bB!=bv){O({elId:bv,timestamp:bo})}var bx=ay(bq),bm=ay(bv);if(bq==bv&&(bu||bA)){bj(bk[bv],-Math.PI/2,0,bt,false,bq,0,false,"top",bv,bn,bK)}else{if(!bF){bF=a6(bv,bq,bm.o,bx.o);by[bJ]=bF}if(bu){bj(bk[bv],bF.theta,0,bt,false,bq,0,false,bF.a[0],bv,bn,bK)}if(bA){bj(bk[bq],bF.theta2,-1,bt,true,bv,1,true,bF.a[1],bq,bn,bK)}}if(bu){r(bp,bv,function(bN){return bN===bv})}if(bA){r(bp,bq,function(bN){return bN===bq})}r(bn,bt,function(bN){return bN.id==bt.id});if((bu&&bz==0)||(bA&&bz==1)){r(bK,bt.endpoints[bz],function(bN){return bN.id==bt.endpoints[bz].id})}}}for(var bI=0;bI<bp.length;bI++){ab(bp[bI],bk[bp[bI]])}for(var bI=0;bI<bM.length;bI++){bM[bI].paint({timestamp:bo,offset:bw,dimensions:bs})}for(var bI=0;bI<bK.length;bI++){bK[bI].paint({timestamp:bo,offset:bw,dimensions:bs})}for(var bI=0;bI<bL.length;bI++){var bC=bL[bI][1];if(bC.anchor.constructor==ae){bC.paint({elementWithPrecedence:bB});r(bn,bL[bI][0],function(bN){return bN.id==bL[bI][0].id});for(var bH=0;bH<bC.connections.length;bH++){if(bC.connections[bH]!==bL[bI][0]){r(bn,bC.connections[bH],function(bN){return bN.id==bC.connections[bH].id})}}}else{if(bC.anchor.constructor==S){r(bn,bL[bI][0],function(bN){return bN.id==bL[bI][0].id})}}}var bE=a0[bB];if(bE){bE.paint({timestamp:bo,recalc:false,elId:bB})}for(var bI=0;bI<bn.length;bI++){bn[bI].paint({elId:bB,timestamp:bo,recalc:false})}};this.rehomeEndpoint=function(bm,bq){var bn=bf[bm]||[],bo=a8.getId(bq);for(var bp=0;bp<bn.length;bp++){bg.add(bn[bp],bo)}bn.splice(0,bn.length)}};a8.anchorManager=new aq();a8.continuousAnchorFactory={get:function(bg){var bf=a4[bg.elementId];if(!bf){bf={type:"Continuous",compute:function(bh){return Z[bh.element.id]||[0,0]},getCurrentLocation:function(bh){return Z[bh.id]||[0,0]},getOrientation:function(bh){return aw[bh.id]||[0,0]},isDynamic:true,isContinuous:true};a4[bg.elementId]=bf}return bf}};var aG=function(){var bi={},bh=[],bg={},bf={};this.register=function(bk){bk=o.CurrentLibrary.getElementObject(bk);var bm=a8.getId(bk),bj=o.CurrentLibrary.getDOMElement(bk);if(!bi[bm]){bi[bm]=bk;bh.push(bk);bg[bm]={}}var bl=function(bq){var bt=o.CurrentLibrary.getElementObject(bq),bs=o.CurrentLibrary.getOffset(bt);for(var bn=0;bn<bq.childNodes.length;bn++){if(bq.childNodes[bn].nodeType!=3){var bp=o.CurrentLibrary.getElementObject(bq.childNodes[bn]),br=a8.getId(bp);if(bf[br]&&bf[br]>0){var bo=o.CurrentLibrary.getOffset(bp);bg[bm][br]={id:br,offset:{left:bo.left-bs.left,top:bo.top-bs.top}}}}}};bl(bj)};this.endpointAdded=function(bl){var bp=o.CurrentLibrary,bs=document.body,bj=a8.getId(bl),br=bp.getDOMElement(bl),bk=br.parentNode,bn=bk==bs;bf[bj]=bf[bj]?bf[bj]+1:1;while(bk!=bs){var bo=a8.getId(bk);if(bi[bo]){var bu=-1,bq=bp.getElementObject(bk),bm=o.CurrentLibrary.getOffset(bq);if(bg[bo][bj]==null){var bt=o.CurrentLibrary.getOffset(bl);bg[bo][bj]={id:bj,offset:{left:bt.left-bm.left,top:bt.top-bm.top}}}break}bk=bk.parentNode}};this.endpointDeleted=function(bk){if(bf[bk.elementId]){bf[bk.elementId]--;if(bf[bk.elementId]<=0){for(var bj in bg){delete bg[bj][bk.elementId]}}}};this.getElementsForDraggable=function(bj){return bg[bj]};this.reset=function(){bi={};bh=[];bg={};bf={}}};a8.dragManager=new aG();var ak=function(bx){var bq=this,bh=true;bq.idPrefix="_jsplumb_c_";bq.defaultLabelLocation=0.5;bq.defaultOverlayKeys=["Overlays","ConnectionOverlays"];this.parent=bx.parent;overlayCapableJsPlumbUIComponent.apply(this,arguments);this.isVisible=function(){return bh};this.setVisible=function(bz){bh=bz;if(bq.connector&&bq.connector.canvas){bq.connector.canvas.style.display=bz?"block":"none"}};this.source=A(bx.source);this.target=A(bx.target);if(bx.sourceEndpoint){this.source=bx.sourceEndpoint.endpointWillMoveTo||bx.sourceEndpoint.getElement()}if(bx.targetEndpoint){this.target=bx.targetEndpoint.getElement()}bq.previousConnection=bx.previousConnection;var bn=bx.cost;bq.getCost=function(){return bn};bq.setCost=function(bz){bn=bz};var bl=bx.bidirectional===false?false:true;bq.isBidirectional=function(){return bl};this.sourceId=d(this.source,"id");this.targetId=d(this.target,"id");this.getAttachedElements=function(){return bq.endpoints};this.scope=bx.scope;this.endpoints=[];this.endpointStyles=[];var bw=function(bA,bz){if(bA){return a8.makeAnchor(bA,bz,a8)}},bu=function(bz,bF,bA,bC,bD,bB,bE){if(bz){bq.endpoints[bF]=bz;bz.addConnection(bq)}else{if(!bA.endpoints){bA.endpoints=[null,null]}var bL=bA.endpoints[bF]||bA.endpoint||a8.Defaults.Endpoints[bF]||o.Defaults.Endpoints[bF]||a8.Defaults.Endpoint||o.Defaults.Endpoint;if(!bA.endpointStyles){bA.endpointStyles=[null,null]}if(!bA.endpointHoverStyles){bA.endpointHoverStyles=[null,null]}var bJ=bA.endpointStyles[bF]||bA.endpointStyle||a8.Defaults.EndpointStyles[bF]||o.Defaults.EndpointStyles[bF]||a8.Defaults.EndpointStyle||o.Defaults.EndpointStyle;if(bJ.fillStyle==null&&bB!=null){bJ.fillStyle=bB.strokeStyle}if(bJ.outlineColor==null&&bB!=null){bJ.outlineColor=bB.outlineColor}if(bJ.outlineWidth==null&&bB!=null){bJ.outlineWidth=bB.outlineWidth}var bI=bA.endpointHoverStyles[bF]||bA.endpointHoverStyle||a8.Defaults.EndpointHoverStyles[bF]||o.Defaults.EndpointHoverStyles[bF]||a8.Defaults.EndpointHoverStyle||o.Defaults.EndpointHoverStyle;if(bE!=null){if(bI==null){bI={}}if(bI.fillStyle==null){bI.fillStyle=bE.strokeStyle}}var bH=bA.anchors?bA.anchors[bF]:bA.anchor?bA.anchor:bw(a8.Defaults.Anchors[bF],bD)||bw(o.Defaults.Anchors[bF],bD)||bw(a8.Defaults.Anchor,bD)||bw(o.Defaults.Anchor,bD),bK=bA.uuids?bA.uuids[bF]:null,bG=ar({paintStyle:bJ,hoverPaintStyle:bI,endpoint:bL,connections:[bq],uuid:bK,anchor:bH,source:bC,scope:bA.scope,container:bA.container,reattach:bA.reattach,detachable:bA.detachable});bq.endpoints[bF]=bG;if(bA.drawEndpoints===false){bG.setVisible(false,true,true)}return bG}};var bs=bu(bx.sourceEndpoint,0,bx,bq.source,bq.sourceId,bx.paintStyle,bx.hoverPaintStyle);if(bs){N(aE,this.sourceId,bs)}var bi=((bq.sourceId==bq.targetId)&&bx.targetEndpoint==null)?bs:bx.targetEndpoint,br=bu(bi,1,bx,bq.target,bq.targetId,bx.paintStyle,bx.hoverPaintStyle);if(br){N(aE,this.targetId,br)}if(!this.scope){this.scope=this.endpoints[0].scope}if(bx.deleteEndpointsOnDetach){bq.endpointsToDeleteOnDetach=[bs,br]}var bg=a8.Defaults.ConnectionsDetachable;if(bx.detachable===false){bg=false}if(bq.endpoints[0].connectionsDetachable===false){bg=false}if(bq.endpoints[1].connectionsDetachable===false){bg=false}if(bn==null){bn=bq.endpoints[0].getConnectionCost()}if(bx.bidirectional==null){bl=bq.endpoints[0].areConnectionsBidirectional()}this.isDetachable=function(){return bg===true};this.setDetachable=function(bz){bg=bz===true};var by=o.extend({},this.endpoints[0].getParameters());o.extend(by,this.endpoints[1].getParameters());o.extend(by,bq.getParameters());bq.setParameters(by);var bo=bq.setHover;bq.setHover=function(){bq.connector.setHover.apply(bq.connector,arguments);bo.apply(bq,arguments)};var bv=function(bz){if(u==null){bq.setHover(bz,false)}};this.setConnector=function(bz,bA){if(bq.connector!=null){aI(bq.connector.getDisplayElements(),bq.parent)}var bB={_jsPlumb:bq._jsPlumb,parent:bx.parent,cssClass:bx.cssClass,container:bx.container,tooltip:bq.tooltip};if(bz.constructor==String){this.connector=new o.Connectors[P][bz](bB)}else{if(bz.constructor==Array){this.connector=new o.Connectors[P][bz[0]](o.extend(bz[1],bB))}}bq.canvas=bq.connector.canvas;_bindListeners(bq.connector,bq,bv);if(!bA){bq.repaint()}};bq.setConnector(this.endpoints[0].connector||this.endpoints[1].connector||bx.connector||a8.Defaults.Connector||o.Defaults.Connector,true);this.setPaintStyle(this.endpoints[0].connectorStyle||this.endpoints[1].connectorStyle||bx.paintStyle||a8.Defaults.PaintStyle||o.Defaults.PaintStyle,true);this.setHoverPaintStyle(this.endpoints[0].connectorHoverStyle||this.endpoints[1].connectorHoverStyle||bx.hoverPaintStyle||a8.Defaults.HoverPaintStyle||o.Defaults.HoverPaintStyle,true);this.paintStyleInUse=this.paintStyle;this.moveParent=function(bC){var bB=o.CurrentLibrary,bA=bB.getParent(bq.connector.canvas);bB.removeElement(bq.connector.canvas,bA);bB.appendElement(bq.connector.canvas,bC);if(bq.connector.bgCanvas){bB.removeElement(bq.connector.bgCanvas,bA);bB.appendElement(bq.connector.bgCanvas,bC)}for(var bz=0;bz<bq.overlays.length;bz++){if(bq.overlays[bz].isAppendedAtTopLevel){bB.removeElement(bq.overlays[bz].canvas,bA);bB.appendElement(bq.overlays[bz].canvas,bC);if(bq.overlays[bz].reattachListeners){bq.overlays[bz].reattachListeners(bq.connector)}}}if(bq.connector.reattachListeners){bq.connector.reattachListeners()}};O({elId:this.sourceId});O({elId:this.targetId});var bk=Y[this.sourceId],bj=V[this.sourceId],bf=Y[this.targetId],bm=V[this.targetId],bp=_timestamp(),bt=this.endpoints[0].anchor.compute({xy:[bk.left,bk.top],wh:bj,element:this.endpoints[0],elementId:this.endpoints[0].elementId,txy:[bf.left,bf.top],twh:bm,tElement:this.endpoints[1],timestamp:bp});this.endpoints[0].paint({anchorLoc:bt,timestamp:bp});bt=this.endpoints[1].anchor.compute({xy:[bf.left,bf.top],wh:bm,element:this.endpoints[1],elementId:this.endpoints[1].elementId,txy:[bk.left,bk.top],twh:bj,tElement:this.endpoints[0],timestamp:bp});this.endpoints[1].paint({anchorLoc:bt,timestamp:bp});this.paint=function(bQ){bQ=bQ||{};var bH=bQ.elId,bI=bQ.ui,bF=bQ.recalc,bA=bQ.timestamp,bJ=false,bP=bJ?this.sourceId:this.targetId,bE=bJ?this.targetId:this.sourceId,bB=bJ?0:1,bR=bJ?1:0;var bS=O({elId:bH,offset:bI,recalc:bF,timestamp:bA}),bG=O({elId:bP,timestamp:bA});var bL=this.endpoints[bR],bz=this.endpoints[bB],bD=bL.anchor.getCurrentLocation(bL),bO=bz.anchor.getCurrentLocation(bz);var bC=0;for(var bN=0;bN<bq.overlays.length;bN++){var bK=bq.overlays[bN];if(bK.isVisible()){bC=Math.max(bC,bK.computeMaxSize(bq.connector))}}var bM=this.connector.compute(bD,bO,this.endpoints[bR],this.endpoints[bB],this.endpoints[bR].anchor,this.endpoints[bB].anchor,bq.paintStyleInUse.lineWidth,bC,bS,bG);bq.connector.paint(bM,bq.paintStyleInUse);for(var bN=0;bN<bq.overlays.length;bN++){var bK=bq.overlays[bN];if(bK.isVisible){bq.overlayPlacements[bN]=bK.draw(bq.connector,bq.paintStyleInUse,bM)}}};this.repaint=function(bA){bA=bA||{};var bz=!(bA.recalc===false);this.paint({elId:this.sourceId,recalc:bz,timestamp:bA.timestamp})};bq.repaint()};var aX=function(bg){var bf=false;return{drag:function(){if(bf){return true}var bh=o.CurrentLibrary.getUIPosition(arguments),bi=bg.element;if(bi){o.CurrentLibrary.setOffset(bi,bh);aV(A(bi),bh)}},stopDrag:function(){bf=true}}};var ag=function(bj,bi,bk,bh,bf){var bg=new aM({reference:bi,referenceCanvas:bh});return ar({paintStyle:bj,endpoint:bk,anchor:bg,source:bf,scope:"__floating"})};var K=function(bh,bf){var bj=document.createElement("div");bj.style.position="absolute";var bg=A(bj);aH(bj,bf);var bi=E(bg);O({elId:bi});bh.id=bi;bh.element=bg};var W=function(bK){var bz=this;bz.idPrefix="_jsplumb_e_";bz.defaultLabelLocation=[0.5,0.5];bz.defaultOverlayKeys=["Overlays","EndpointOverlays"];this.parent=bK.parent;overlayCapableJsPlumbUIComponent.apply(this,arguments);bK=bK||{};var bj=true,bs=!(bK.enabled===false);this.isVisible=function(){return bj};this.setVisible=function(bN,bQ,bM){bj=bN;if(bz.canvas){bz.canvas.style.display=bN?"block":"none"}if(!bQ){for(var bP=0;bP<bz.connections.length;bP++){bz.connections[bP].setVisible(bN);if(!bM){var bO=bz===bz.connections[bP].endpoints[0]?1:0;if(bz.connections[bP].endpoints[bO].connections.length==1){bz.connections[bP].endpoints[bO].setVisible(bN,true,true)}}}}};this.isEnabled=function(){return bs};this.setEnabled=function(bM){bs=bM};var by=bK.source,br=bK.uuid,bI=null,bl=null;if(br){aF[br]=bz}var bo=d(by,"id");this.elementId=bo;this.element=by;var bh=bK.connectionCost;this.getConnectionCost=function(){return bh};this.setConnectionCost=function(bM){bh=bM};var bH=bK.connectionsBidirectional===false?false:true;this.areConnectionsBidirectional=function(){return bH};this.setConnectionsBidirectional=function(bM){bH=bM};bz.anchor=bK.anchor?a8.makeAnchor(bK.anchor,bo,a8):bK.anchors?a8.makeAnchor(bK.anchors,bo,a8):a8.makeAnchor("TopCenter",bo,a8);if(!bK._transient){a8.anchorManager.add(bz,bo)}var bw=bK.endpoint||a8.Defaults.Endpoint||o.Defaults.Endpoint||"Dot",bp={_jsPlumb:bz._jsPlumb,parent:bK.parent,container:bK.container,tooltip:bK.tooltip,connectorTooltip:bK.connectorTooltip,endpoint:bz};if(bw.constructor==String){bw=new o.Endpoints[P][bw](bp)}else{if(bw.constructor==Array){bp=o.extend(bw[1],bp);bw=new o.Endpoints[P][bw[0]](bp)}else{bw=bw.clone()}}var bt=o.extend({},bp);bw.clone=function(){var bM=new Object();bw.constructor.apply(bM,[bt]);return bM};bz.endpoint=bw;bz.type=bz.endpoint.type;var bx=bz.setHover;bz.setHover=function(){bz.endpoint.setHover.apply(bz.endpoint,arguments);bx.apply(bz,arguments)};var bL=function(bM){if(bz.connections.length>0){bz.connections[0].setHover(bM,false)}else{bz.setHover(bM)}};_bindListeners(bz.endpoint,bz,bL);this.setPaintStyle(bK.paintStyle||bK.style||a8.Defaults.EndpointStyle||o.Defaults.EndpointStyle,true);this.setHoverPaintStyle(bK.hoverPaintStyle||a8.Defaults.EndpointHoverStyle||o.Defaults.EndpointHoverStyle,true);this.paintStyleInUse=this.paintStyle;this.connectorStyle=bK.connectorStyle;this.connectorHoverStyle=bK.connectorHoverStyle;this.connectorOverlays=bK.connectorOverlays;this.connector=bK.connector;this.connectorTooltip=bK.connectorTooltip;this.isSource=bK.isSource||false;this.isTarget=bK.isTarget||false;var bE=bK.maxConnections||a8.Defaults.MaxConnections;this.getAttachedElements=function(){return bz.connections};this.canvas=this.endpoint.canvas;this.connections=bK.connections||[];this.scope=bK.scope||J;this.timestamp=null;bz.isReattach=bK.reattach||false;bz.connectionsDetachable=a8.Defaults.ConnectionsDetachable;if(bK.connectionsDetachable===false||bK.detachable===false){bz.connectionsDetachable=false}var bu=bK.dragAllowedWhenFull||true;this.computeAnchor=function(bM){return bz.anchor.compute(bM)};this.addConnection=function(bM){bz.connections.push(bM)};this.detach=function(bM,bQ,bN,bU){var bT=i(bz.connections,function(bW){return bW.id==bM.id}),bS=false;bU=(bU!==false);if(bT>=0){if(bN||bM._forceDetach||bM.isDetachable()||bM.isDetachAllowed(bM)){var bV=bM.endpoints[0]==bz?bM.endpoints[1]:bM.endpoints[0];if(bN||bM._forceDetach||(bz.isDetachAllowed(bM))){bz.connections.splice(bT,1);if(!bQ){bV.detach(bM,true,bN);if(bM.endpointsToDeleteOnDetach){for(var bR=0;bR<bM.endpointsToDeleteOnDetach.length;bR++){var bO=bM.endpointsToDeleteOnDetach[bR];if(bO&&bO.connections.length==0){a8.deleteEndpoint(bO)}}}}aI(bM.connector.getDisplayElements(),bM.parent);y(aJ[bM.scope],function(bW){return bW.id==bM.id});bS=true;var bP=(!bQ&&bU);aS(bM,bP)}}}return bS};this.detachAll=function(bM){while(bz.connections.length>0){bz.detach(bz.connections[0],false,true,bM)}};this.detachFrom=function(bO,bN){var bP=[];for(var bM=0;bM<bz.connections.length;bM++){if(bz.connections[bM].endpoints[1]==bO||bz.connections[bM].endpoints[0]==bO){bP.push(bz.connections[bM])}}for(var bM=0;bM<bP.length;bM++){if(bz.detach(bP[bM],false,true,bN)){bP[bM].setHover(false,false)}}};this.detachFromConnection=function(bN){var bM=i(bz.connections,function(bO){return bO.id==bN.id});if(bM>=0){bz.connections.splice(bM,1)}};this.getElement=function(){return by};this.setElement=function(bO){var bQ=E(bO);y(aE[bo],function(bR){return bR.id==bz.id});by=A(bO);bo=E(by);bz.elementId=bo;var bP=aj({source:bQ}),bN=bi.getParent(bz.canvas);bi.removeElement(bz.canvas,bN);bi.appendElement(bz.canvas,bP);for(var bM=0;bM<bz.connections.length;bM++){bz.connections[bM].moveParent(bP);bz.connections[bM].sourceId=bo;bz.connections[bM].source=by}N(aE,bQ,bz)};this.getUuid=function(){return br};this.makeInPlaceCopy=function(){return ar({anchor:bz.anchor,source:by,paintStyle:this.paintStyle,endpoint:bw,_transient:true,scope:bz.scope})};this.isConnectedTo=function(bO){var bN=false;if(bO){for(var bM=0;bM<bz.connections.length;bM++){if(bz.connections[bM].endpoints[1]==bO){bN=true;break}}}return bN};this.isFloating=function(){return bI!=null};this.connectorSelector=function(){var bM=bz.connections[0];if(bz.isTarget&&bM){return bM}else{return(bz.connections.length<bE)||bE==-1?null:bM}};this.isFull=function(){return !(bz.isFloating()||bE<1||bz.connections.length<bE)};this.setDragAllowedWhenFull=function(bM){bu=bM};this.setStyle=bz.setPaintStyle;this.equals=function(bM){return this.anchor.equals(bM.anchor)};var bv=function(bN){var bM=0;if(bN!=null){for(var bO=0;bO<bz.connections.length;bO++){if(bz.connections[bO].sourceId==bN||bz.connections[bO].targetId==bN){bM=bO;break}}}return bz.connections[bM]};this.paint=function(bP){bP=bP||{};var bV=bP.timestamp,bU=!(bP.recalc===false);if(!bV||bz.timestamp!==bV){O({elId:bo,timestamp:bV,recalc:bU});var b1=bP.offset||Y[bo];if(b1){var bS=bP.anchorPoint,bQ=bP.connectorPaintStyle;if(bS==null){var bM=bP.dimensions||V[bo];if(b1==null||bM==null){O({elId:bo,timestamp:bV});b1=Y[bo];bM=V[bo]}var bO={xy:[b1.left,b1.top],wh:bM,element:bz,timestamp:bV};if(bU&&bz.anchor.isDynamic&&bz.connections.length>0){var bY=bv(bP.elementWithPrecedence),b0=bY.endpoints[0]==bz?1:0,bR=b0==0?bY.sourceId:bY.targetId,bX=Y[bR],bZ=V[bR];bO.txy=[bX.left,bX.top];bO.twh=bZ;bO.tElement=bY.endpoints[b0]}bS=bz.anchor.compute(bO)}var bW=bw.compute(bS,bz.anchor.getOrientation(bw),bz.paintStyleInUse,bQ||bz.paintStyleInUse);bw.paint(bW,bz.paintStyleInUse,bz.anchor);bz.timestamp=bV;for(var bT=0;bT<bz.overlays.length;bT++){var bN=bz.overlays[bT];if(bN.isVisible){bz.overlayPlacements[bT]=bN.draw(bz.endpoint,bz.paintStyleInUse,bW)}}}}};this.repaint=this.paint;this.removeConnection=this.detach;if(o.CurrentLibrary.isDragSupported(by)){var bD={id:null,element:null},bC=null,bg=false,bk=null,bf=aX(bD);var bm=function(){bC=bz.connectorSelector();var bM=true;if(!bs){bM=false}if(bC==null&&!bK.isSource){bM=false}if(bK.isSource&&bz.isFull()&&!bu){bM=false}if(bC!=null&&!bC.isDetachable()){bM=false}if(bM===false){if(o.CurrentLibrary.stopDrag){o.CurrentLibrary.stopDrag()}bf.stopDrag();return false}if(bC&&!bz.isFull()&&bK.isSource){bC=null}O({elId:bo});bl=bz.makeInPlaceCopy();bl.paint();K(bD,bz.parent);var bS=A(bl.canvas),bQ=o.CurrentLibrary.getOffset(bS),bN=a9([bQ.left,bQ.top],bl.canvas);o.CurrentLibrary.setOffset(bD.element,{left:bN[0],top:bN[1]});if(bz.parentAnchor){bz.anchor=a8.makeAnchor(bz.parentAnchor,bz.elementId,a8)}f(A(bz.canvas),"dragId",bD.id);f(A(bz.canvas),"elId",bo);bI=ag(bz.paintStyle,bz.anchor,bw,bz.canvas,bD.element);if(bC==null){bz.anchor.locked=true;bz.setHover(false,false);bC=U({sourceEndpoint:bz,targetEndpoint:bI,source:bz.endpointWillMoveTo||A(by),target:bD.element,anchors:[bz.anchor,bI.anchor],paintStyle:bK.connectorStyle,hoverPaintStyle:bK.connectorHoverStyle,connector:bK.connector,overlays:bK.connectorOverlays})}else{bg=true;bC.connector.setHover(false,false);bn(A(bl.canvas),false,true);var bP=bC.endpoints[0].id==bz.id?0:1;bC.floatingAnchorIndex=bP;bz.detachFromConnection(bC);var bT=A(bz.canvas),bR=o.CurrentLibrary.getDragScope(bT);f(bT,"originalScope",bR);var bO=o.CurrentLibrary.getDropScope(bT);o.CurrentLibrary.setDragScope(bT,bO);if(bP==0){bk=[bC.source,bC.sourceId,bG,bR];bC.source=bD.element;bC.sourceId=bD.id}else{bk=[bC.target,bC.targetId,bG,bR];bC.target=bD.element;bC.targetId=bD.id}bC.endpoints[bP==0?1:0].anchor.locked=true;bC.suspendedEndpoint=bC.endpoints[bP];bC.suspendedEndpoint.setHover(false);bC.endpoints[bP]=bI;aP(bC)}a0[bD.id]=bC;bI.addConnection(bC);N(aE,bD.id,bI);a8.currentlyDragging=true};var bi=o.CurrentLibrary,bF=bK.dragOptions||{},bA=o.extend({},bi.defaultDragOptions),bB=bi.dragEvents.start,bJ=bi.dragEvents.stop,bq=bi.dragEvents.drag;bF=o.extend(bA,bF);bF.scope=bF.scope||bz.scope;bF[bB]=ac(bF[bB],bm);bF[bq]=ac(bF[bq],bf.drag);bF[bJ]=ac(bF[bJ],function(){a8.currentlyDragging=false;y(aE[bD.id],function(bN){return bN.id==bI.id});aI([bD.element[0],bI.canvas],by);ah(bl.canvas,by);a8.anchorManager.clearFor(bD.id);var bM=bC.floatingAnchorIndex==null?1:bC.floatingAnchorIndex;bC.endpoints[bM==0?1:0].anchor.locked=false;if(bC.endpoints[bM]==bI){if(bg&&bC.suspendedEndpoint){if(bM==0){bC.source=bk[0];bC.sourceId=bk[1]}else{bC.target=bk[0];bC.targetId=bk[1]}o.CurrentLibrary.setDragScope(bk[2],bk[3]);bC.endpoints[bM]=bC.suspendedEndpoint;if(bz.isReattach||bC._forceDetach||!bC.endpoints[bM==0?1:0].detach(bC)){bC.setHover(false);bC.floatingAnchorIndex=null;bC.suspendedEndpoint.addConnection(bC);a8.repaint(bk[1])}bC._forceDetach=null}else{aI(bC.connector.getDisplayElements(),bz.parent);bz.detachFromConnection(bC)}}bz.anchor.locked=false;bz.paint({recalc:false});bC.setHover(false,false);aC(bC);bC=null;bl=null;delete aE[bI.elementId];bI.anchor=null;bI=null;a8.currentlyDragging=false});var bG=A(bz.canvas);o.CurrentLibrary.initDraggable(bG,bF,true)}var bn=function(bO,bT,bR,bU){if((bK.isTarget||bT)&&o.CurrentLibrary.isDropSupported(by)){var bP=bK.dropOptions||a8.Defaults.DropOptions||o.Defaults.DropOptions;bP=o.extend({},bP);bP.scope=bP.scope||bz.scope;var bN=o.CurrentLibrary.dragEvents.drop,bS=o.CurrentLibrary.dragEvents.over,bM=o.CurrentLibrary.dragEvents.out,bQ=function(bV){var b6=A(o.CurrentLibrary.getDragObject(arguments)),bW=d(b6,"dragId"),bY=d(b6,"elId"),b5=d(b6,"originalScope"),b1=a0[bW];if(b1!=null){var b2=b1.floatingAnchorIndex==null?1:b1.floatingAnchorIndex,b3=b2==0?1:0;if(b5){o.CurrentLibrary.setDragScope(b6,b5)}var b4=bU!=null?bU.isEnabled():true;if(!bz.isFull()&&!(b2==0&&!bz.isSource)&&!(b2==1&&!bz.isTarget)&&b4){var bZ=true;if(b1.suspendedEndpoint&&b1.suspendedEndpoint.id!=bz.id){if(!b1.isDetachAllowed(b1)||!b1.endpoints[b2].isDetachAllowed(b1)||!b1.suspendedEndpoint.isDetachAllowed(b1)||!a8.checkCondition("beforeDetach",b1)){bZ=false}}if(b2==0){b1.source=by;b1.sourceId=bo}else{b1.target=by;b1.targetId=bo}bZ=bZ&&bz.isDropAllowed(b1.sourceId,b1.targetId,b1.scope);if(bZ){b1.endpoints[b2].detachFromConnection(b1);if(b1.suspendedEndpoint){b1.suspendedEndpoint.detachFromConnection(b1)}b1.endpoints[b2]=bz;bz.addConnection(b1);if(!b1.suspendedEndpoint){aW(by,bK.draggable,{})}else{var b0=b1.suspendedEndpoint.getElement(),bX=b1.suspendedEndpoint.elementId;aS({source:b2==0?b0:b1.source,target:b2==1?b0:b1.target,sourceId:b2==0?bX:b1.sourceId,targetId:b2==1?bX:b1.targetId,sourceEndpoint:b2==0?b1.suspendedEndpoint:b1.endpoints[0],targetEndpoint:b2==1?b1.suspendedEndpoint:b1.endpoints[1],connection:b1},true)}bd(b1,null,bV)}else{if(b1.suspendedEndpoint){b1.endpoints[b2]=b1.suspendedEndpoint;b1.setHover(false);b1._forceDetach=true;if(b2==0){b1.source=b1.suspendedEndpoint.element;b1.sourceId=b1.suspendedEndpoint.elementId}else{b1.target=b1.suspendedEndpoint.element;b1.targetId=b1.suspendedEndpoint.elementId}b1.suspendedEndpoint.addConnection(b1);b1.endpoints[0].repaint();b1.repaint();a8.repaint(b1.source.elementId);b1._forceDetach=false}}b1.floatingAnchorIndex=null}a8.currentlyDragging=false;delete a0[bW]}};bP[bN]=ac(bP[bN],bQ);bP[bS]=ac(bP[bS],function(){if(bz.isTarget){var bW=o.CurrentLibrary.getDragObject(arguments),bY=d(A(bW),"dragId"),bX=a0[bY];if(bX!=null){var bV=bX.floatingAnchorIndex==null?1:bX.floatingAnchorIndex;bX.endpoints[bV].anchor.over(bz.anchor)}}});bP[bM]=ac(bP[bM],function(){if(bz.isTarget){var bW=o.CurrentLibrary.getDragObject(arguments),bY=d(A(bW),"dragId"),bX=a0[bY];if(bX!=null){var bV=bX.floatingAnchorIndex==null?1:bX.floatingAnchorIndex;bX.endpoints[bV].anchor.out()}}});o.CurrentLibrary.initDroppable(bO,bP,true,bR)}};bn(A(bz.canvas),true,!(bK._transient||bz.anchor.isFloating),bz);return bz}};var o=window.jsPlumb=new v();o.getInstance=function(F){var E=new v(F);E.init();return E};o.util={convertStyle:function(F,E){if("transparent"===F){return F}var K=F,J=function(L){return L.length==1?"0"+L:L},G=function(L){return J(Number(L).toString(16))},H=/(rgb[a]?\()(.*)(\))/;if(F.match(H)){var I=F.match(H)[2].split(",");K="#"+G(I[0])+G(I[1])+G(I[2]);if(!E&&I.length==4){K=K+G(I[3])}}return K},gradient:function(F,E){F=F.constructor==Array?F:[F.x,F.y];E=E.constructor==Array?E:[E.x,E.y];return(E[1]-F[1])/(E[0]-F[0])},normal:function(F,E){return -1/o.util.gradient(F,E)},segment:function(F,E){F=F.constructor==Array?F:[F.x,F.y];E=E.constructor==Array?E:[E.x,E.y];if(E[0]>F[0]){return(E[1]>F[1])?2:1}else{return(E[1]>F[1])?3:4}},segmentMultipliers:[null,[1,-1],[1,1],[-1,1],[-1,-1]],inverseSegmentMultipliers:[null,[-1,-1],[-1,1],[1,1],[1,-1]],pointOnLine:function(E,I,F){var H=o.util.gradient(E,I),M=o.util.segment(E,I),L=F>0?o.util.segmentMultipliers[M]:o.util.inverseSegmentMultipliers[M],G=Math.atan(H),J=Math.abs(F*Math.sin(G))*L[1],K=Math.abs(F*Math.cos(G))*L[0];return{x:E.x+K,y:E.y+J}},perpendicularLineTo:function(G,H,I){var F=o.util.gradient(G,H),J=Math.atan(-1/F),K=I/2*Math.sin(J),E=I/2*Math.cos(J);return[{x:H.x+E,y:H.y+K},{x:H.x-E,y:H.y-K}]}};var q=function(E,J,G,F,I,H){return function(L){L=L||{};var K=L.jsPlumbInstance.makeAnchor([E,J,G,F,0,0],L.elementId,L.jsPlumbInstance);K.type=I;if(H){H(K,L)}return K}};o.Anchors.TopCenter=q(0.5,0,0,-1,"TopCenter");o.Anchors.BottomCenter=q(0.5,1,0,1,"BottomCenter");o.Anchors.LeftMiddle=q(0,0.5,-1,0,"LeftMiddle");o.Anchors.RightMiddle=q(1,0.5,1,0,"RightMiddle");o.Anchors.Center=q(0.5,0.5,0,0,"Center");o.Anchors.TopRight=q(1,0,0,-1,"TopRight");o.Anchors.BottomRight=q(1,1,0,1,"BottomRight");o.Anchors.TopLeft=q(0,0,0,-1,"TopLeft");o.Anchors.BottomLeft=q(0,1,0,1,"BottomLeft");o.Defaults.DynamicAnchors=function(E){return E.jsPlumbInstance.makeAnchors(["TopCenter","RightMiddle","BottomCenter","LeftMiddle"],E.elementId,E.jsPlumbInstance)};o.Anchors.AutoDefault=function(F){var E=F.jsPlumbInstance.makeDynamicAnchor(o.Defaults.DynamicAnchors(F));E.type="AutoDefault";return E};o.Anchors.Assign=q(0,0,0,0,"Assign",function(F,G){var E=G.position||"Fixed";F.positionFinder=E.constructor==String?G.jsPlumbInstance.AnchorPositionFinders[E]:E;F.constructorParams=G});o.Anchors.Continuous=function(E){return E.jsPlumbInstance.continuousAnchorFactory.get(E)};o.AnchorPositionFinders={Fixed:function(H,E,G,F){return[(H.left-E.left)/G[0],(H.top-E.top)/G[1]]},Grid:function(E,N,I,F){var M=E.left-N.left,L=E.top-N.top,K=I[0]/(F.grid[0]),J=I[1]/(F.grid[1]),H=Math.floor(M/K),G=Math.floor(L/J);return[((H*K)+(K/2))/I[0],((G*J)+(J/2))/I[1]]}}})();(function(){jsPlumb.DOMElementComponent=function(c){jsPlumb.jsPlumbUIComponent.apply(this,arguments);this.mousemove=this.dblclick=this.click=this.mousedown=this.mouseup=function(d){}};jsPlumb.Connectors.Straight=function(){this.type="Straight";var r=this,i=null,e,k,p,n,l,f,q,h,g,d,c,o,m;this.compute=function(A,J,s,z,F,t,D,v){var I=Math.abs(A[0]-J[0]),C=Math.abs(A[1]-J[1]),B=0.45*I,u=0.45*C;I*=1.9;C*=1.9;var G=Math.min(A[0],J[0])-B;var E=Math.min(A[1],J[1])-u;var H=Math.max(2*D,v);if(I<H){I=H;G=A[0]+((J[0]-A[0])/2)-(H/2);B=(I-Math.abs(A[0]-J[0]))/2}if(C<H){C=H;E=A[1]+((J[1]-A[1])/2)-(H/2);u=(C-Math.abs(A[1]-J[1]))/2}h=A[0]<J[0]?B:I-B;g=A[1]<J[1]?u:C-u;d=A[0]<J[0]?I-B:B;c=A[1]<J[1]?C-u:u;i=[G,E,I,C,h,g,d,c];n=d-h,l=c-g;e=jsPlumb.util.gradient({x:h,y:g},{x:d,y:c}),k=-1/e;p=-1*((e*h)-g);f=Math.atan(e);q=Math.atan(k);m=Math.sqrt((n*n)+(l*l));return i};this.pointOnPath=function(s){if(s==0){return{x:h,y:g}}else{if(s==1){return{x:d,y:c}}else{return jsPlumb.util.pointOnLine({x:h,y:g},{x:d,y:c},s*m)}}};this.gradientAtPoint=function(s){return e};this.pointAlongPathFrom=function(s,v){var u=r.pointOnPath(s),t=s==1?{x:h+((d-h)*10),y:g+((g-c)*10)}:{x:d,y:c};return jsPlumb.util.pointOnLine(u,t,v)}};jsPlumb.Connectors.Bezier=function(u){var o=this;u=u||{};this.majorAnchor=u.curviness||150;this.minorAnchor=10;var s=null;this.type="Bezier";this._findControlPoint=function(G,v,B,w,z,E,x){var D=E.getOrientation(w),F=x.getOrientation(z),A=D[0]!=F[0]||D[1]==F[1],y=[],H=o.majorAnchor,C=o.minorAnchor;if(!A){if(D[0]==0){y.push(v[0]<B[0]?G[0]+C:G[0]-C)}else{y.push(G[0]-(H*D[0]))}if(D[1]==0){y.push(v[1]<B[1]?G[1]+C:G[1]-C)}else{y.push(G[1]+(H*F[1]))}}else{if(F[0]==0){y.push(B[0]<v[0]?G[0]+C:G[0]-C)}else{y.push(G[0]+(H*F[0]))}if(F[1]==0){y.push(B[1]<v[1]?G[1]+C:G[1]-C)}else{y.push(G[1]+(H*D[1]))}}return y};var p,l,f,n,m,f,e,r,q,t,d,h,g,k,i;this.compute=function(R,y,L,z,P,w,v,K){v=v||0;t=Math.abs(R[0]-y[0])+v;d=Math.abs(R[1]-y[1])+v;r=Math.min(R[0],y[0])-(v/2);q=Math.min(R[1],y[1])-(v/2);f=R[0]<y[0]?t-(v/2):(v/2);e=R[1]<y[1]?d-(v/2):(v/2);n=R[0]<y[0]?(v/2):t-(v/2);m=R[1]<y[1]?(v/2):d-(v/2);p=o._findControlPoint([f,e],R,y,L,z,P,w);l=o._findControlPoint([n,m],y,R,L,z,w,P);var J=Math.min(f,n),I=Math.min(p[0],l[0]),E=Math.min(J,I),Q=Math.max(f,n),N=Math.max(p[0],l[0]),B=Math.max(Q,N);if(B>t){t=B}if(E<0){r+=E;var G=Math.abs(E);t+=G;p[0]+=G;f+=G;n+=G;l[0]+=G}var O=Math.min(e,m),M=Math.min(p[1],l[1]),A=Math.min(O,M),F=Math.max(e,m),D=Math.max(p[1],l[1]),x=Math.max(F,D);if(x>d){d=x}if(A<0){q+=A;var C=Math.abs(A);d+=C;p[1]+=C;e+=C;m+=C;l[1]+=C}if(K&&t<K){var H=(K-t)/2;t=K;r-=H;f=f+H;n=n+H;p[0]=p[0]+H;l[0]=l[0]+H}if(K&&d<K){var H=(K-d)/2;d=K;q-=H;e=e+H;m=m+H;p[1]=p[1]+H;l[1]=l[1]+H}s=[r,q,t,d,f,e,n,m,p[0],p[1],l[0],l[1]];return s};var c=function(){return[{x:f,y:e},{x:p[0],y:p[1]},{x:l[0],y:l[1]},{x:n,y:m}]};this.pointOnPath=function(v){return jsBezier.pointOnCurve(c(),v)};this.gradientAtPoint=function(v){return jsBezier.gradientAtPoint(c(),v)};this.pointAlongPathFrom=function(v,w){return jsBezier.pointAlongCurveFrom(c(),v,w)}};jsPlumb.Connectors.Flowchart=function(k){this.type="Flowchart";k=k||{};var r=this,f=k.stub||k.minStubLength||30,m=[],q=0,o=[],e=[],p=[],h,g,d=0,c=0,l=function(u,t,y,x){var w=0;for(var v=0;v<m.length;v++){e[v]=m[v][5]/q;o[v]=[w,(w+=(m[v][5]/q))]}},s=function(){p.push(m.length);for(var t=0;t<m.length;t++){p.push(m[t][0]);p.push(m[t][1])}},i=function(E,B,D,C,A,z){var u=m.length==0?D:m[m.length-1][0],t=m.length==0?C:m[m.length-1][1],v=E==u?Infinity:0,w=Math.abs(E==u?B-t:E-u);m.push([E,B,u,t,v,w]);q+=w;d=Math.max(d,E);c=Math.max(c,B)},n=function(v){var t=o.length-1,u=1;for(var w=0;w<o.length;w++){if(o[w][1]>=v){t=w;u=(v-o[w][0])/e[w];break}}return{segment:m[t],proportion:u,index:t}};this.compute=function(R,af,t,L,ap,F,P,K,ak,ah){m=[];q=0;e=[];d=c=0;h=af[0]<R[0];g=af[1]<R[1];var V=P||1,D=(V/2)+(f*2),B=(V/2)+(f*2),I=ap.orientation||ap.getOrientation(t),aq=F.orientation||F.getOrientation(L),ae=h?af[0]:R[0],ad=g?af[1]:R[1],ag=Math.abs(af[0]-R[0])+2*D,ao=Math.abs(af[1]-R[1])+2*B;if(I[0]==0&&I[1]==0||aq[0]==0&&aq[1]==0){var X=ag>ao?0:1,Z=[1,0][X];I=[];aq=[];I[X]=R[X]>af[X]?-1:1;aq[X]=R[X]>af[X]?1:-1;I[Z]=0;aq[Z]=0}if(ag<K){D+=(K-ag)/2;ag=K}if(ao<K){B+=(K-ao)/2;ao=K}var C=h?ag-D:D,A=g?ao-B:B,am=h?D:ag-D,al=g?B:ao-B,U=C+(I[0]*f),T=A+(I[1]*f),G=am+(aq[0]*f),E=al+(aq[1]*f),Q=Math.abs(C-am)>2*f,S=Math.abs(A-al)>2*f,ac=U+((G-U)/2),aa=T+((E-T)/2),J=((I[0]*aq[0])+(I[1]*aq[1])),W=J==-1,Y=J==0,u=J==1;ae-=D;ad-=B;p=[ae,ad,ag,ao,C,A,am,al];var aj=[];i(U,T,C,A,am,al);var N=I[0]==0?"y":"x",H=W?"opposite":u?"orthogonal":"perpendicular",v=jsPlumb.util.segment([C,A],[am,al]),ab=I[N=="x"?0:1]==-1,M={x:[null,4,3,2,1],y:[null,2,1,4,3]};if(ab){v=M[N][v]}var O=function(ar,y,w,x){return ar+(y*((1-w)*x)+f)},z={oppositex:function(){if(t.elementId==L.elementId){var w=T+((1-ap.y)*ak.height)+f;return[[U,w],[G,w]]}else{if(Q&&(v==1||v==2)){return[[ac,A],[ac,al]]}else{return[[U,aa],[G,aa]]}}},orthogonalx:function(){if(v==1||v==2){return[[G,T]]}else{return[[U,E]]}},perpendicularx:function(){var w=(al+A)/2;if((v==1&&aq[1]==1)||(v==2&&aq[1]==-1)){if(Math.abs(am-C)>f){return[[G,T]]}else{return[[U,T],[U,w],[G,w]]}}else{if((v==3&&aq[1]==-1)||(v==4&&aq[1]==1)){return[[U,w],[G,w]]}else{if((v==3&&aq[1]==1)||(v==4&&aq[1]==-1)){return[[U,E]]}else{if((v==1&&aq[1]==-1)||(v==2&&aq[1]==1)){if(Math.abs(am-C)>f){return[[ac,T],[ac,E]]}else{return[[U,E]]}}}}}},oppositey:function(){if(t.elementId==L.elementId){var w=U+((1-ap.x)*ak.width)+f;return[[w,T],[w,E]]}else{if(S&&(v==2||v==3)){return[[C,aa],[am,aa]]}else{return[[ac,T],[ac,E]]}}},orthogonaly:function(){if(v==2||v==3){return[[U,E]]}else{return[[G,T]]}},perpendiculary:function(){var w=(am+C)/2;if((v==2&&aq[0]==-1)||(v==3&&aq[0]==1)){if(Math.abs(am-C)>f){return[[U,E]]}else{return[[U,aa],[G,aa]]}}else{if((v==1&&aq[0]==-1)||(v==4&&aq[0]==1)){var w=(am+C)/2;return[[w,T],[w,E]]}else{if((v==1&&aq[0]==1)||(v==4&&aq[0]==-1)){return[[G,T]]}else{if((v==2&&aq[0]==1)||(v==3&&aq[0]==-1)){if(Math.abs(al-A)>f){return[[U,aa],[G,aa]]}else{return[[G,T]]}}}}}}};var ai=z[H+N]();if(ai){for(var an=0;an<ai.length;an++){i(ai[an][0],ai[an][1],C,A,am,al)}}i(G,E,C,A,am,al);i(am,al,C,A,am,al);s();l(C,A,am,al);if(c>p[3]){p[3]=c+(P*2)}if(d>p[2]){p[2]=d+(P*2)}return p};this.pointOnPath=function(t){return r.pointAlongPathFrom(t,0)};this.gradientAtPoint=function(t){return m[n(t)["index"]][4]};this.pointAlongPathFrom=function(w,A){var x=n(w),v=x.segment,z=x.proportion,u=m[x.index][5],t=m[x.index][4];var y={x:t==Infinity?v[2]:v[2]>v[0]?v[0]+((1-z)*u)-A:v[2]+(z*u)+A,y:t==0?v[3]:v[3]>v[1]?v[1]+((1-z)*u)-A:v[3]+(z*u)+A,segmentInfo:x};return y}};jsPlumb.Endpoints.Dot=function(d){this.type="Dot";var c=this;d=d||{};this.radius=d.radius||10;this.defaultOffset=0.5*this.radius;this.defaultInnerRadius=this.radius/3;this.compute=function(i,f,l,h){var g=l.radius||c.radius,e=i[0]-g,k=i[1]-g;return[e,k,g*2,g*2,g]}};jsPlumb.Endpoints.Rectangle=function(d){this.type="Rectangle";var c=this;d=d||{};this.width=d.width||20;this.height=d.height||20;this.compute=function(k,g,m,i){var h=m.width||c.width,f=m.height||c.height,e=k[0]-(h/2),l=k[1]-(f/2);return[e,l,h,f]}};var a=function(e){jsPlumb.DOMElementComponent.apply(this,arguments);var c=this;var d=[];this.getDisplayElements=function(){return d};this.appendDisplayElement=function(f){d.push(f)}};jsPlumb.Endpoints.Image=function(g){this.type="Image";a.apply(this,arguments);var l=this,f=false,e=g.width,d=g.height,i=null,c=g.endpoint;this.img=new Image();l.ready=false;this.img.onload=function(){l.ready=true;e=e||l.img.width;d=d||l.img.height;if(i){i(l)}};c.setImage=function(m,o){var n=m.constructor==String?m:m.src;i=o;l.img.src=m};c.setImage(g.src||g.url,g.onload);this.compute=function(o,m,p,n){l.anchorPoint=o;if(l.ready){return[o[0]-e/2,o[1]-d/2,e,d]}else{return[0,0,0,0]}};l.canvas=document.createElement("img"),f=false;l.canvas.style.margin=0;l.canvas.style.padding=0;l.canvas.style.outline=0;l.canvas.style.position="absolute";var h=g.cssClass?" "+g.cssClass:"";l.canvas.className=jsPlumb.endpointClass+h;if(e){l.canvas.setAttribute("width",e)}if(d){l.canvas.setAttribute("height",d)}jsPlumb.appendElement(l.canvas,g.parent);l.attachListeners(l.canvas,l);var k=function(p,o,n){if(!f){l.canvas.setAttribute("src",l.img.src);f=true}var m=l.anchorPoint[0]-(e/2),q=l.anchorPoint[1]-(d/2);jsPlumb.sizeCanvas(l.canvas,m,q,e,d)};this.paint=function(o,n,m){if(l.ready){k(o,n,m)}else{window.setTimeout(function(){l.paint(o,n,m)},200)}}};jsPlumb.Endpoints.Blank=function(d){var c=this;this.type="Blank";a.apply(this,arguments);this.compute=function(g,e,h,f){return[g[0],g[1],10,0]};c.canvas=document.createElement("div");c.canvas.style.display="block";c.canvas.style.width="1px";c.canvas.style.height="1px";c.canvas.style.background="transparent";c.canvas.style.position="absolute";c.canvas.className=c._jsPlumb.endpointClass;jsPlumb.appendElement(c.canvas,d.parent);this.paint=function(g,f,e){jsPlumb.sizeCanvas(c.canvas,g[0],g[1],g[2],g[3])}};jsPlumb.Endpoints.Triangle=function(c){this.type="Triangle";c=c||{};c.width=c.width||55;c.height=c.height||55;this.width=c.width;this.height=c.height;this.compute=function(i,f,l,h){var g=l.width||self.width,e=l.height||self.height,d=i[0]-(g/2),k=i[1]-(e/2);return[d,k,g,e]}};var b=function(e){var d=true,c=this;this.isAppendedAtTopLevel=true;this.component=e.component;this.loc=e.location==null?0.5:e.location;this.endpointLoc=e.endpointLocation==null?[0.5,0.5]:e.endpointLocation;this.setVisible=function(f){d=f;c.component.repaint()};this.isVisible=function(){return d};this.hide=function(){c.setVisible(false)};this.show=function(){c.setVisible(true)};this.incrementLocation=function(f){c.loc+=f;c.component.repaint()};this.setLocation=function(f){c.loc=f;c.component.repaint()};this.getLocation=function(){return c.loc}};jsPlumb.Overlays.Arrow=function(g){this.type="Arrow";b.apply(this,arguments);this.isAppendedAtTopLevel=false;g=g||{};var d=this;this.length=g.length||20;this.width=g.width||20;this.id=g.id;var f=(g.direction||1)<0?-1:1,e=g.paintStyle||{lineWidth:1},c=g.foldback||0.623;this.computeMaxSize=function(){return d.width*1.5};this.cleanup=function(){};this.draw=function(i,x,s){var m,t,h,n,l;if(i.pointAlongPathFrom){if(d.loc==1){m=i.pointOnPath(d.loc);t=i.pointAlongPathFrom(d.loc,-1);h=jsPlumb.util.pointOnLine(m,t,d.length)}else{if(d.loc==0){h=i.pointOnPath(d.loc);t=i.pointAlongPathFrom(d.loc,1);m=jsPlumb.util.pointOnLine(h,t,d.length)}else{m=i.pointAlongPathFrom(d.loc,f*d.length/2),t=i.pointOnPath(d.loc),h=jsPlumb.util.pointOnLine(m,t,d.length)}}n=jsPlumb.util.perpendicularLineTo(m,h,d.width);l=jsPlumb.util.pointOnLine(m,h,c*d.length);var w=Math.min(m.x,n[0].x,n[1].x),q=Math.max(m.x,n[0].x,n[1].x),v=Math.min(m.y,n[0].y,n[1].y),p=Math.max(m.y,n[0].y,n[1].y);var o={hxy:m,tail:n,cxy:l},r=e.strokeStyle||x.strokeStyle,u=e.fillStyle||x.strokeStyle,k=e.lineWidth||x.lineWidth;d.paint(i,o,k,r,u,s);return[w,q,v,p]}else{return[0,0,0,0]}}};jsPlumb.Overlays.PlainArrow=function(d){d=d||{};var c=jsPlumb.extend(d,{foldback:1});jsPlumb.Overlays.Arrow.call(this,c);this.type="PlainArrow"};jsPlumb.Overlays.Diamond=function(e){e=e||{};var c=e.length||40,d=jsPlumb.extend(e,{length:c/2,foldback:2});jsPlumb.Overlays.Arrow.call(this,d);this.type="Diamond"};jsPlumb.Overlays.Label=function(i){this.type="Label";jsPlumb.DOMElementComponent.apply(this,arguments);b.apply(this,arguments);this.labelStyle=i.labelStyle||jsPlumb.Defaults.LabelStyle;this.id=i.id;this.cachedDimensions=null;var e=i.label||"",c=this,f=false,k=document.createElement("div"),g=null;k.style.position="absolute";var d=i._jsPlumb.overlayClass+" "+(c.labelStyle.cssClass?c.labelStyle.cssClass:i.cssClass?i.cssClass:"");k.className=d;jsPlumb.appendElement(k,i.component.parent);jsPlumb.getId(k);c.attachListeners(k,c);c.canvas=k;var h=c.setVisible;c.setVisible=function(l){h(l);k.style.display=l?"block":"none"};this.getElement=function(){return k};this.cleanup=function(){if(k!=null){jsPlumb.CurrentLibrary.removeElement(k)}};this.setLabel=function(m){e=m;g=null;c.component.repaint()};this.getLabel=function(){return e};this.paint=function(l,n,m){if(!f){l.appendDisplayElement(k);c.attachListeners(k,l);f=true}k.style.left=(m[0]+n.minx)+"px";k.style.top=(m[1]+n.miny)+"px"};this.getTextDimensions=function(){if(typeof e=="function"){var l=e(c);k.innerHTML=l.replace(/\r\n/g,"<br/>")}else{if(g==null){g=e;k.innerHTML=g.replace(/\r\n/g,"<br/>")}}var n=jsPlumb.CurrentLibrary.getElementObject(k),m=jsPlumb.CurrentLibrary.getSize(n);return{width:m[0],height:m[1]}};this.computeMaxSize=function(l){var m=c.getTextDimensions(l);return m.width?Math.max(m.width,m.height)*1.5:0};this.draw=function(m,n,o){var q=c.getTextDimensions(m);if(q.width!=null){var p={x:0,y:0};if(m.pointOnPath){p=m.pointOnPath(c.loc)}else{var l=c.loc.constructor==Array?c.loc:c.endpointLoc;p={x:l[0]*o[2],y:l[1]*o[3]}}minx=p.x-(q.width/2),miny=p.y-(q.height/2);c.paint(m,{minx:minx,miny:miny,td:q,cxy:p},o);return[minx,minx+q.width,miny,miny+q.height]}else{return[0,0,0,0]}};this.reattachListeners=function(l){if(k){c.reattachListenersForElement(k,c,l)}}};jsPlumb.Overlays.GuideLines=function(){var c=this;c.length=50;c.lineWidth=5;this.type="GuideLines";b.apply(this,arguments);jsPlumb.jsPlumbUIComponent.apply(this,arguments);this.draw=function(e,l,k){var i=e.pointAlongPathFrom(c.loc,c.length/2),h=e.pointOnPath(c.loc),g=jsPlumb.util.pointOnLine(i,h,c.length),f=jsPlumb.util.perpendicularLineTo(i,g,40),d=jsPlumb.util.perpendicularLineTo(g,i,20);c.paint(e,[i,g,f,d],c.lineWidth,"red",null,k);return[Math.min(i.x,g.x),Math.min(i.y,g.y),Math.max(i.x,g.x),Math.max(i.y,g.y)]};this.computeMaxSize=function(){return 50};this.cleanup=function(){}}})();(function(){var c=function(e,g,d,f){this.m=(f-g)/(d-e);this.b=-1*((this.m*e)-g);this.rectIntersect=function(q,p,s,o){var n=[];var k=(p-this.b)/this.m;if(k>=q&&k<=(q+s)){n.push([k,(this.m*k)+this.b])}var t=(this.m*(q+s))+this.b;if(t>=p&&t<=(p+o)){n.push([(t-this.b)/this.m,t])}var k=((p+o)-this.b)/this.m;if(k>=q&&k<=(q+s)){n.push([k,(this.m*k)+this.b])}var t=(this.m*q)+this.b;if(t>=p&&t<=(p+o)){n.push([(t-this.b)/this.m,t])}if(n.length==2){var m=(n[0][0]+n[1][0])/2,l=(n[0][1]+n[1][1])/2;n.push([m,l]);var i=m<=q+(s/2)?-1:1,r=l<=p+(o/2)?-1:1;n.push([i,r]);return n}return null}},a=function(e,g,d,f){if(e<=d&&f<=g){return 1}else{if(e<=d&&g<=f){return 2}else{if(d<=e&&f>=g){return 3}}}return 4},b=function(g,f,i,e,h,m,l,d,k){if(d<=k){return[g,f]}if(i==1){if(e[3]<=0&&h[3]>=1){return[g+(e[2]<0.5?-1*m:m),f]}else{if(e[2]>=1&&h[2]<=0){return[g,f+(e[3]<0.5?-1*l:l)]}else{return[g+(-1*m),f+(-1*l)]}}}else{if(i==2){if(e[3]>=1&&h[3]<=0){return[g+(e[2]<0.5?-1*m:m),f]}else{if(e[2]>=1&&h[2]<=0){return[g,f+(e[3]<0.5?-1*l:l)]}else{return[g+(1*m),f+(-1*l)]}}}else{if(i==3){if(e[3]>=1&&h[3]<=0){return[g+(e[2]<0.5?-1*m:m),f]}else{if(e[2]<=0&&h[2]>=1){return[g,f+(e[3]<0.5?-1*l:l)]}else{return[g+(-1*m),f+(-1*l)]}}}else{if(i==4){if(e[3]<=0&&h[3]>=1){return[g+(e[2]<0.5?-1*m:m),f]}else{if(e[2]<=0&&h[2]>=1){return[g,f+(e[3]<0.5?-1*l:l)]}else{return[g+(1*m),f+(-1*l)]}}}}}}};jsPlumb.Connectors.StateMachine=function(l){var s=this,n=null,o,m,g,e,p=[],d=l.curviness||10,k=l.margin||5,q=l.proximityLimit||80,f=l.orientation&&l.orientation=="clockwise",i=l.loopbackRadius||25,h=false;this.type="StateMachine";l=l||{};this.compute=function(ab,F,U,G,aa,u,t,S){var O=Math.abs(ab[0]-F[0]),W=Math.abs(ab[1]-F[1]),Q=0.45*O,Z=0.45*W;O*=1.9;W*=1.9;t=t||1;var M=Math.min(ab[0],F[0])-Q,K=Math.min(ab[1],F[1])-Z;if(U.elementId!=G.elementId){h=false;o=ab[0]<F[0]?Q:O-Q;m=ab[1]<F[1]?Z:W-Z;g=ab[0]<F[0]?O-Q:Q;e=ab[1]<F[1]?W-Z:Z;if(ab[2]==0){o-=k}if(ab[2]==1){o+=k}if(ab[3]==0){m-=k}if(ab[3]==1){m+=k}if(F[2]==0){g-=k}if(F[2]==1){g+=k}if(F[3]==0){e-=k}if(F[3]==1){e+=k}var L=(o+g)/2,J=(m+e)/2,v=(-1*L)/J,T=Math.atan(v),N=(v==Infinity||v==-Infinity)?0:Math.abs(d/2*Math.sin(T)),P=(v==Infinity||v==-Infinity)?0:Math.abs(d/2*Math.cos(T)),z=a(o,m,g,e),H=Math.sqrt(Math.pow(g-o,2)+Math.pow(e-m,2));p=b(L,J,z,ab,F,d,d,H,q);var E=Math.max(Math.abs(p[0]-o)*3,Math.abs(p[0]-g)*3,Math.abs(g-o),2*t,S),I=Math.max(Math.abs(p[1]-m)*3,Math.abs(p[1]-e)*3,Math.abs(e-m),2*t,S);if(O<E){var R=E-O;M-=(R/2);o+=(R/2);g+=(R/2);O=E;p[0]+=(R/2)}if(W<I){var Y=I-W;K-=(Y/2);m+=(Y/2);e+=(Y/2);W=I;p[1]+=(Y/2)}n=[M,K,O,W,o,m,g,e,p[0],p[1]]}else{h=true;var X=ab[0],V=ab[0],D=ab[1]-k,B=ab[1]-k,C=X,A=D-i;O=((2*t)+(4*i)),W=((2*t)+(4*i));M=C-i-t-i,K=A-i-t-i;n=[M,K,O,W,C-M,A-K,i,f,X-M,D-K,V-M,B-K]}return n};var r=function(){return[{x:g,y:e},{x:p[0],y:p[1]},{x:p[0]+1,y:p[1]+1},{x:o,y:m}]};this.pointOnPath=function(v){if(h){if(v>0&&v<1){v=1-v}var w=(v*2*Math.PI)+(Math.PI/2),u=n[4]+(n[6]*Math.cos(w)),t=n[5]+(n[6]*Math.sin(w));return{x:u,y:t}}else{return jsBezier.pointOnCurve(r(),v)}};this.gradientAtPoint=function(t){if(h){return Math.atan(t*2*Math.PI)}else{return jsBezier.gradientAtPoint(r(),t)}};this.pointAlongPathFrom=function(v,z){if(h){if(v>0&&v<1){v=1-v}var w=2*Math.PI*n[6],y=z/w*2*Math.PI,x=(v*2*Math.PI)-y+(Math.PI/2),u=n[4]+(n[6]*Math.cos(x)),t=n[5]+(n[6]*Math.sin(x));return{x:u,y:t}}return jsBezier.pointAlongCurveFrom(r(),v,z)}};jsPlumb.Connectors.canvas.StateMachine=function(f){f=f||{};var d=this,g=f.drawGuideline||true,e=f.avoidSelector;jsPlumb.Connectors.StateMachine.apply(this,arguments);jsPlumb.CanvasConnector.apply(this,arguments);this._paint=function(l){if(l.length==10){d.ctx.beginPath();d.ctx.moveTo(l[4],l[5]);d.ctx.quadraticCurveTo(l[8],l[9],l[6],l[7]);d.ctx.stroke()}else{d.ctx.save();d.ctx.beginPath();var k=0,i=2*Math.PI,h=l[7];d.ctx.arc(l[4],l[5],l[6],0,i,h);d.ctx.stroke();d.ctx.closePath();d.ctx.restore()}};this.createGradient=function(i,h){return h.createLinearGradient(i[4],i[5],i[6],i[7])}};jsPlumb.Connectors.svg.StateMachine=function(){var d=this;jsPlumb.Connectors.StateMachine.apply(this,arguments);jsPlumb.SvgConnector.apply(this,arguments);this.getPath=function(e){if(e.length==10){return"M "+e[4]+" "+e[5]+" C "+e[8]+" "+e[9]+" "+e[8]+" "+e[9]+" "+e[6]+" "+e[7]}else{return"M"+(e[8]+4)+" "+e[9]+" A "+e[6]+" "+e[6]+" 0 1,0 "+(e[8]-4)+" "+e[9]}}};jsPlumb.Connectors.vml.StateMachine=function(){jsPlumb.Connectors.StateMachine.apply(this,arguments);jsPlumb.VmlConnector.apply(this,arguments);var d=jsPlumb.vml.convertValue;this.getPath=function(k){if(k.length==10){return"m"+d(k[4])+","+d(k[5])+" c"+d(k[8])+","+d(k[9])+","+d(k[8])+","+d(k[9])+","+d(k[6])+","+d(k[7])+" e"}else{var h=d(k[8]-k[6]),g=d(k[9]-(2*k[6])),f=h+d(2*k[6]),e=g+d(2*k[6]),l=h+","+g+","+f+","+e;var i="ar "+l+","+d(k[8])+","+d(k[9])+","+d(k[8])+","+d(k[9])+" e";return i}}}})();(function(){var k={"stroke-linejoin":"joinstyle",joinstyle:"joinstyle",endcap:"endcap",miterlimit:"miterlimit"};if(document.createStyleSheet){document.createStyleSheet().addRule(".jsplumb_vml","behavior:url(#default#VML);position:absolute;");document.createStyleSheet().addRule("jsplumb\\:textbox","behavior:url(#default#VML);position:absolute;");document.createStyleSheet().addRule("jsplumb\\:oval","behavior:url(#default#VML);position:absolute;");document.createStyleSheet().addRule("jsplumb\\:rect","behavior:url(#default#VML);position:absolute;");document.createStyleSheet().addRule("jsplumb\\:stroke","behavior:url(#default#VML);position:absolute;");document.createStyleSheet().addRule("jsplumb\\:shape","behavior:url(#default#VML);position:absolute;");document.createStyleSheet().addRule("jsplumb\\:group","behavior:url(#default#VML);position:absolute;");document.namespaces.add("jsplumb","urn:schemas-microsoft-com:vml")}jsPlumb.vml={};var b=1000,d={},h=function(q,p){var s=jsPlumb.getId(q),r=d[s];if(!r){r=o("group",[0,0,b,b],{"class":p});r.style.backgroundColor="red";d[s]=r;jsPlumb.appendElement(r,q)}return r},c=function(q,r){for(var p in r){q[p]=r[p]}},o=function(p,r,s){s=s||{};var q=document.createElement("jsplumb:"+p);q.className=(s["class"]?s["class"]+" ":"")+"jsplumb_vml";n(q,r);c(q,s);return q},n=function(q,p){q.style.left=p[0]+"px";q.style.top=p[1]+"px";q.style.width=p[2]+"px";q.style.height=p[3]+"px";q.style.position="absolute"},i=jsPlumb.vml.convertValue=function(p){return Math.floor(p*b)},e=function(s,q,r,p){if("transparent"===q){p.setOpacity(r,"0.0")}else{p.setOpacity(r,"1.0")}},g=function(t,p,w){var s={};if(p.strokeStyle){s.stroked="true";var x=jsPlumb.util.convertStyle(p.strokeStyle,true);s.strokecolor=x;e(s,x,"stroke",w);s.strokeweight=p.lineWidth+"px"}else{s.stroked="false"}if(p.fillStyle){s.filled="true";var q=jsPlumb.util.convertStyle(p.fillStyle,true);s.fillcolor=q;e(s,q,"fill",w)}else{s.filled="false"}if(p.dashstyle){if(w.strokeNode==null){w.strokeNode=o("stroke",[0,0,0,0],{dashstyle:p.dashstyle});t.appendChild(w.strokeNode)}else{w.strokeNode.dashstyle=p.dashstyle}}else{if(p["stroke-dasharray"]&&p.lineWidth){var y=p["stroke-dasharray"].indexOf(",")==-1?" ":",",u=p["stroke-dasharray"].split(y),r="";for(var v=0;v<u.length;v++){r+=(Math.floor(u[v]/p.lineWidth)+y)}if(w.strokeNode==null){w.strokeNode=o("stroke",[0,0,0,0],{dashstyle:r});t.appendChild(w.strokeNode)}else{w.strokeNode.dashstyle=r}}}c(t,s)},l=function(){var p=this;jsPlumb.jsPlumbUIComponent.apply(this,arguments);this.opacityNodes={stroke:null,fill:null};this.initOpacityNodes=function(r){p.opacityNodes.stroke=o("stroke",[0,0,1,1],{opacity:"0.0"});p.opacityNodes.fill=o("fill",[0,0,1,1],{opacity:"0.0"});r.appendChild(p.opacityNodes.stroke);r.appendChild(p.opacityNodes.fill)};this.setOpacity=function(r,t){var s=p.opacityNodes[r];if(s){s.opacity=""+t}};var q=[];this.getDisplayElements=function(){return q};this.appendDisplayElement=function(s,r){if(!r){p.canvas.parentNode.appendChild(s)}q.push(s)}},f=jsPlumb.VmlConnector=function(r){var p=this;p.strokeNode=null;p.canvas=null;l.apply(this,arguments);var q=p._jsPlumb.connectorClass+(r.cssClass?(" "+r.cssClass):"");this.paint=function(w,t,v){if(t!=null){var A=p.getPath(w),u={path:A};if(t.outlineColor){var y=t.outlineWidth||1,z=t.lineWidth+(2*y),x={strokeStyle:jsPlumb.util.convertStyle(t.outlineColor),lineWidth:z};for(var s in k){x[s]=t[s]}if(p.bgCanvas==null){u["class"]=q;u.coordsize=(w[2]*b)+","+(w[3]*b);p.bgCanvas=o("shape",w,u);r._jsPlumb.appendElement(p.bgCanvas,r.parent);n(p.bgCanvas,w);p.appendDisplayElement(p.bgCanvas,true)}else{u.coordsize=(w[2]*b)+","+(w[3]*b);n(p.bgCanvas,w);c(p.bgCanvas,u)}g(p.bgCanvas,x,p)}if(p.canvas==null){u["class"]=q;u.coordsize=(w[2]*b)+","+(w[3]*b);if(p.tooltip){u.label=p.tooltip}p.canvas=o("shape",w,u);r._jsPlumb.appendElement(p.canvas,r.parent);p.appendDisplayElement(p.canvas,true);p.attachListeners(p.canvas,p);p.initOpacityNodes(p.canvas,["stroke"])}else{u.coordsize=(w[2]*b)+","+(w[3]*b);n(p.canvas,w);c(p.canvas,u)}g(p.canvas,t,p)}};this.reattachListeners=function(){if(p.canvas){p.reattachListenersForElement(p.canvas,p)}}},m=function(t){l.apply(this,arguments);var p=null,r=this,q=null,s=null;r.canvas=document.createElement("div");r.canvas.style.position="absolute";t._jsPlumb.appendElement(r.canvas,t.parent);if(r.tooltip){r.canvas.setAttribute("label",r.tooltip)}this.paint=function(x,v,u){var w={};jsPlumb.sizeCanvas(r.canvas,x[0],x[1],x[2],x[3]);if(p==null){w["class"]=jsPlumb.endpointClass;p=r.getVml([0,0,x[2],x[3]],w,u);r.canvas.appendChild(p);r.attachListeners(p,r);r.appendDisplayElement(p,true);r.appendDisplayElement(r.canvas,true);r.initOpacityNodes(p,["fill"])}else{n(p,[0,0,x[2],x[3]]);c(p,w)}g(p,v,r)};this.reattachListeners=function(){if(p){r.reattachListenersForElement(p,r)}}};jsPlumb.Connectors.vml.Bezier=function(){jsPlumb.Connectors.Bezier.apply(this,arguments);f.apply(this,arguments);this.getPath=function(p){return"m"+i(p[4])+","+i(p[5])+" c"+i(p[8])+","+i(p[9])+","+i(p[10])+","+i(p[11])+","+i(p[6])+","+i(p[7])+" e"}};jsPlumb.Connectors.vml.Straight=function(){jsPlumb.Connectors.Straight.apply(this,arguments);f.apply(this,arguments);this.getPath=function(p){return"m"+i(p[4])+","+i(p[5])+" l"+i(p[6])+","+i(p[7])+" e"}};jsPlumb.Connectors.vml.Flowchart=function(){jsPlumb.Connectors.Flowchart.apply(this,arguments);f.apply(this,arguments);this.getPath=function(r){var s="m "+i(r[4])+","+i(r[5])+" l";for(var q=0;q<r[8];q++){s=s+" "+i(r[9+(q*2)])+","+i(r[10+(q*2)])}s=s+" "+i(r[6])+","+i(r[7])+" e";return s}};jsPlumb.Endpoints.vml.Dot=function(){jsPlumb.Endpoints.Dot.apply(this,arguments);m.apply(this,arguments);this.getVml=function(q,r,p){return o("oval",q,r)}};jsPlumb.Endpoints.vml.Rectangle=function(){jsPlumb.Endpoints.Rectangle.apply(this,arguments);m.apply(this,arguments);this.getVml=function(q,r,p){return o("rect",q,r)}};jsPlumb.Endpoints.vml.Image=jsPlumb.Endpoints.Image;jsPlumb.Endpoints.vml.Blank=jsPlumb.Endpoints.Blank;jsPlumb.Overlays.vml.Label=jsPlumb.Overlays.Label;var a=function(t,r){t.apply(this,r);l.apply(this,arguments);var q=this,s=null;q.canvas=null;var p=function(v,u){return"m "+i(v.hxy.x)+","+i(v.hxy.y)+" l "+i(v.tail[0].x)+","+i(v.tail[0].y)+" "+i(v.cxy.x)+","+i(v.cxy.y)+" "+i(v.tail[1].x)+","+i(v.tail[1].y)+" x e"};this.paint=function(y,D,C,E,I,H){var v={};if(E){v.stroked="true";v.strokecolor=jsPlumb.util.convertStyle(E,true)}if(C){v.strokeweight=C+"px"}if(I){v.filled="true";v.fillcolor=I}var u=Math.min(D.hxy.x,D.tail[0].x,D.tail[1].x,D.cxy.x),G=Math.min(D.hxy.y,D.tail[0].y,D.tail[1].y,D.cxy.y),z=Math.max(D.hxy.x,D.tail[0].x,D.tail[1].x,D.cxy.x),x=Math.max(D.hxy.y,D.tail[0].y,D.tail[1].y,D.cxy.y),F=Math.abs(z-u),B=Math.abs(x-G),A=[u,G,F,B];v.path=p(D,H);v.coordsize=(H[2]*b)+","+(H[3]*b);A[0]=H[0];A[1]=H[1];A[2]=H[2];A[3]=H[3];if(q.canvas==null){q.canvas=o("shape",A,v);y.appendDisplayElement(q.canvas);q.attachListeners(q.canvas,y)}else{n(q.canvas,A);c(q.canvas,v)}};this.reattachListeners=function(){if(q.canvas){q.reattachListenersForElement(q.canvas,q)}}};jsPlumb.Overlays.vml.Arrow=function(){a.apply(this,[jsPlumb.Overlays.Arrow,arguments])};jsPlumb.Overlays.vml.PlainArrow=function(){a.apply(this,[jsPlumb.Overlays.PlainArrow,arguments])};jsPlumb.Overlays.vml.Diamond=function(){a.apply(this,[jsPlumb.Overlays.Diamond,arguments])}})();(function(){var l={joinstyle:"stroke-linejoin","stroke-linejoin":"stroke-linejoin","stroke-dashoffset":"stroke-dashoffset","stroke-linecap":"stroke-linecap"},w="stroke-dasharray",A="dashstyle",e="linearGradient",b="radialGradient",c="fill",a="stop",z="stroke",q="stroke-width",h="style",m="none",t="jsplumb_gradient_",o="lineWidth",C={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml"},g=function(F,D){for(var E in D){F.setAttribute(E,""+D[E])}},f=function(E,D){var F=document.createElementNS(C.svg,E);D=D||{};D.version="1.1";D.xmlns=C.xhtml;g(F,D);return F},n=function(D){return"position:absolute;left:"+D[0]+"px;top:"+D[1]+"px"},i=function(E){for(var D=0;D<E.childNodes.length;D++){if(E.childNodes[D].tagName==e||E.childNodes[D].tagName==b){E.removeChild(E.childNodes[D])}}},v=function(N,I,F,D,J){var G=t+J._jsPlumb.idstamp();i(N);if(!F.gradient.offset){var L=f(e,{id:G});N.appendChild(L)}else{var L=f(b,{id:G});N.appendChild(L)}for(var K=0;K<F.gradient.stops.length;K++){var H=K;if(D.length==8){H=D[4]<D[6]?K:F.gradient.stops.length-1-K}else{H=D[4]<D[6]?F.gradient.stops.length-1-K:K}var M=jsPlumb.util.convertStyle(F.gradient.stops[H][1],true);var O=f(a,{offset:Math.floor(F.gradient.stops[K][0]*100)+"%","stop-color":M});L.appendChild(O)}var E=F.strokeStyle?z:c;I.setAttribute(h,E+":url(#"+G+")")},x=function(K,G,E,D,H){if(E.gradient){v(K,G,E,D,H)}else{i(K);G.setAttribute(h,"")}G.setAttribute(c,E.fillStyle?jsPlumb.util.convertStyle(E.fillStyle,true):m);G.setAttribute(z,E.strokeStyle?jsPlumb.util.convertStyle(E.strokeStyle,true):m);if(E.lineWidth){G.setAttribute(q,E.lineWidth)}if(E[A]&&E[o]&&!E[w]){var L=E[A].indexOf(",")==-1?" ":",",I=E[A].split(L),F="";I.forEach(function(M){F+=(Math.floor(M*E.lineWidth)+L)});G.setAttribute(w,F)}else{if(E[w]){G.setAttribute(w,E[w])}}for(var J in l){if(E[J]){G.setAttribute(l[J],E[J])}}},B=function(F){var D=/([0-9].)(p[xt])\s(.*)/;var E=F.match(D);return{size:E[1]+E[2],font:E[3]}},r=function(I,J,E){var K=E.split(" "),H=I.className,G=H.baseVal.split(" ");for(var F=0;F<K.length;F++){if(J){if(G.indexOf(K[F])==-1){G.push(K[F])}}else{var D=G.indexOf(K[F]);if(D!=-1){G.splice(D,1)}}}I.className.baseVal=G.join(" ")},u=function(E,D){r(E,true,D)},k=function(E,D){r(E,false,D)};jsPlumb.util.svg={addClass:u,removeClass:k};var s=function(H){var D=this,G=H.pointerEventsSpec||"all";jsPlumb.jsPlumbUIComponent.apply(this,H.originalArgs);D.canvas=null,D.path=null,D.svg=null;var F=H.cssClass+" "+(H.originalArgs[0].cssClass||""),I={style:"",width:0,height:0,"pointer-events":G,position:"absolute"};if(D.tooltip){I.title=D.tooltip}D.svg=f("svg",I);if(H.useDivWrapper){D.canvas=document.createElement("div");D.canvas.style.position="absolute";jsPlumb.sizeCanvas(D.canvas,0,0,1,1);D.canvas.className=F;if(D.tooltip){D.canvas.setAttribute("title",D.tooltip)}}else{g(D.svg,{"class":F});D.canvas=D.svg}H._jsPlumb.appendElement(D.canvas,H.originalArgs[0]["parent"]);if(H.useDivWrapper){D.canvas.appendChild(D.svg)}var E=[D.canvas];this.getDisplayElements=function(){return E};this.appendDisplayElement=function(J){E.push(J)};this.paint=function(M,L,K){if(L!=null){var J=M[0],N=M[1];if(H.useDivWrapper){jsPlumb.sizeCanvas(D.canvas,M[0],M[1],M[2],M[3]);J=0,N=0}g(D.svg,{style:n([J,N,M[2],M[3]]),width:M[2],height:M[3]});D._paint.apply(this,arguments)}}};var d=jsPlumb.SvgConnector=function(E){var D=this;s.apply(this,[{cssClass:E._jsPlumb.connectorClass,originalArgs:arguments,pointerEventsSpec:"none",tooltip:E.tooltip,_jsPlumb:E._jsPlumb}]);this._paint=function(L,H){var K=D.getPath(L),F={d:K},J=null;F["pointer-events"]="all";if(H.outlineColor){var I=H.outlineWidth||1,G=H.lineWidth+(2*I),J=jsPlumb.CurrentLibrary.extend({},H);J.strokeStyle=jsPlumb.util.convertStyle(H.outlineColor);J.lineWidth=G;if(D.bgPath==null){D.bgPath=f("path",F);D.svg.appendChild(D.bgPath);D.attachListeners(D.bgPath,D)}else{g(D.bgPath,F)}x(D.svg,D.bgPath,J,L,D)}if(D.path==null){D.path=f("path",F);D.svg.appendChild(D.path);D.attachListeners(D.path,D)}else{g(D.path,F)}x(D.svg,D.path,H,L,D)};this.reattachListeners=function(){if(D.bgPath){D.reattachListenersForElement(D.bgPath,D)}if(D.path){D.reattachListenersForElement(D.path,D)}}};jsPlumb.Connectors.svg.Bezier=function(D){jsPlumb.Connectors.Bezier.apply(this,arguments);d.apply(this,arguments);this.getPath=function(F){var E="M "+F[4]+" "+F[5];E+=(" C "+F[8]+" "+F[9]+" "+F[10]+" "+F[11]+" "+F[6]+" "+F[7]);return E}};jsPlumb.Connectors.svg.Straight=function(D){jsPlumb.Connectors.Straight.apply(this,arguments);d.apply(this,arguments);this.getPath=function(E){return"M "+E[4]+" "+E[5]+" L "+E[6]+" "+E[7]}};jsPlumb.Connectors.svg.Flowchart=function(){var D=this;jsPlumb.Connectors.Flowchart.apply(this,arguments);d.apply(this,arguments);this.getPath=function(F){var G="M "+F[4]+","+F[5];for(var E=0;E<F[8];E++){G=G+" L "+F[9+(E*2)]+" "+F[10+(E*2)]}G=G+" "+F[6]+","+F[7];return G}};var y=function(E){var D=this;s.apply(this,[{cssClass:E._jsPlumb.endpointClass,originalArgs:arguments,pointerEventsSpec:"all",useDivWrapper:true,_jsPlumb:E._jsPlumb}]);this._paint=function(H,G){var F=jsPlumb.extend({},G);if(F.outlineColor){F.strokeWidth=F.outlineWidth;F.strokeStyle=jsPlumb.util.convertStyle(F.outlineColor,true)}if(D.node==null){D.node=D.makeNode(H,F);D.svg.appendChild(D.node);D.attachListeners(D.node,D)}x(D.svg,D.node,F,H,D);n(D.node,H)};this.reattachListeners=function(){if(D.node){D.reattachListenersForElement(D.node,D)}}};jsPlumb.Endpoints.svg.Dot=function(){jsPlumb.Endpoints.Dot.apply(this,arguments);y.apply(this,arguments);this.makeNode=function(E,D){return f("circle",{cx:E[2]/2,cy:E[3]/2,r:E[2]/2})}};jsPlumb.Endpoints.svg.Rectangle=function(){jsPlumb.Endpoints.Rectangle.apply(this,arguments);y.apply(this,arguments);this.makeNode=function(E,D){return f("rect",{width:E[2],height:E[3]})}};jsPlumb.Endpoints.svg.Image=jsPlumb.Endpoints.Image;jsPlumb.Endpoints.svg.Blank=jsPlumb.Endpoints.Blank;jsPlumb.Overlays.svg.Label=jsPlumb.Overlays.Label;var p=function(H,F){H.apply(this,F);jsPlumb.jsPlumbUIComponent.apply(this,F);this.isAppendedAtTopLevel=false;var D=this,G=null;this.paint=function(J,M,I,N,K){if(G==null){G=f("path");J.svg.appendChild(G);D.attachListeners(G,J);D.attachListeners(G,D)}var L=F&&(F.length==1)?(F[0].cssClass||""):"";g(G,{d:E(M),"class":L,stroke:N?N:null,fill:K?K:null})};var E=function(I){return"M"+I.hxy.x+","+I.hxy.y+" L"+I.tail[0].x+","+I.tail[0].y+" L"+I.cxy.x+","+I.cxy.y+" L"+I.tail[1].x+","+I.tail[1].y+" L"+I.hxy.x+","+I.hxy.y};this.reattachListeners=function(){if(G){D.reattachListenersForElement(G,D)}}};jsPlumb.Overlays.svg.Arrow=function(){p.apply(this,[jsPlumb.Overlays.Arrow,arguments])};jsPlumb.Overlays.svg.PlainArrow=function(){p.apply(this,[jsPlumb.Overlays.PlainArrow,arguments])};jsPlumb.Overlays.svg.Diamond=function(){p.apply(this,[jsPlumb.Overlays.Diamond,arguments])};jsPlumb.Overlays.svg.GuideLines=function(){var I=null,D=this,H=null,G,F;jsPlumb.Overlays.GuideLines.apply(this,arguments);this.paint=function(K,M,J,N,L){if(I==null){I=f("path");K.svg.appendChild(I);D.attachListeners(I,K);D.attachListeners(I,D);G=f("path");K.svg.appendChild(G);D.attachListeners(G,K);D.attachListeners(G,D);F=f("path");K.svg.appendChild(F);D.attachListeners(F,K);D.attachListeners(F,D)}g(I,{d:E(M[0],M[1]),stroke:"red",fill:null});g(G,{d:E(M[2][0],M[2][1]),stroke:"blue",fill:null});g(F,{d:E(M[3][0],M[3][1]),stroke:"green",fill:null})};var E=function(K,J){return"M "+K.x+","+K.y+" L"+J.x+","+J.y}}})();(function(){var d=null,i=function(p,o){return jsPlumb.CurrentLibrary.hasClass(a(p),o)},a=function(o){return jsPlumb.CurrentLibrary.getElementObject(o)},m=function(o){return jsPlumb.CurrentLibrary.getOffset(a(o))},n=function(o){return jsPlumb.CurrentLibrary.getPageXY(o)},f=function(o){return jsPlumb.CurrentLibrary.getClientXY(o)};var k=function(){var q=this;q.overlayPlacements=[];jsPlumb.jsPlumbUIComponent.apply(this,arguments);jsPlumb.EventGenerator.apply(this,arguments);this._over=function(z){var B=m(a(q.canvas)),D=n(z),u=D[0]-B.left,C=D[1]-B.top;if(u>0&&C>0&&u<q.canvas.width&&C<q.canvas.height){for(var v=0;v<q.overlayPlacements.length;v++){var w=q.overlayPlacements[v];if(w&&(w[0]<=u&&w[1]>=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;s<t.gradient.stops.length;s++){u.addColorStop(t.gradient.stops[s][0],t.gradient.stops[s][1])}p.ctx.strokeStyle=u}p._paint(v);p.ctx.restore()};var p=this,q=p._jsPlumb.connectorClass+" "+(r.cssClass||"");p.canvas=c({"class":q,_jsPlumb:p._jsPlumb,parent:r.parent,tooltip:r.tooltip});p.ctx=p.canvas.getContext("2d");p.appendDisplayElement(p.canvas);p.paint=function(w,t){if(t!=null){jsPlumb.sizeCanvas(p.canvas,w[0],w[1],w[2],w[3]);if(t.outlineColor!=null){var v=t.outlineWidth||1,s=t.lineWidth+(2*v),u={strokeStyle:t.outlineColor,lineWidth:s};o(w,u)}o(w,t)}}};var b=function(r){var p=this;l.apply(this,arguments);var q=p._jsPlumb.endpointClass+" "+(r.cssClass||""),o={"class":q,_jsPlumb:p._jsPlumb,parent:r.parent,tooltip:p.tooltip};p.canvas=c(o);p.ctx=p.canvas.getContext("2d");p.appendDisplayElement(p.canvas);this.paint=function(x,u,s){jsPlumb.sizeCanvas(p.canvas,x[0],x[1],x[2],x[3]);if(u.outlineColor!=null){var w=u.outlineWidth||1,t=u.lineWidth+(2*w);var v={strokeStyle:u.outlineColor,lineWidth:t}}p._paint.apply(this,arguments)}};jsPlumb.Endpoints.canvas.Dot=function(r){jsPlumb.Endpoints.Dot.apply(this,arguments);b.apply(this,arguments);var q=this,p=function(s){try{return parseInt(s)}catch(t){if(s.substring(s.length-1)=="%"){return parseInt(s.substring(0,s-1))}}},o=function(u){var s=q.defaultOffset,t=q.defaultInnerRadius;u.offset&&(s=p(u.offset));u.innerRadius&&(t=p(u.innerRadius));return[s,t]};this._paint=function(A,t,x){if(t!=null){var B=q.canvas.getContext("2d"),u=x.getOrientation(q);jsPlumb.extend(B,t);if(t.gradient){var v=o(t.gradient),y=u[1]==1?v[0]*-1:v[0],s=u[0]==1?v[0]*-1:v[0],z=B.createRadialGradient(A[4],A[4],A[4],A[4]+s,A[4]+y,v[1]);for(var w=0;w<t.gradient.stops.length;w++){z.addColorStop(t.gradient.stops[w][0],t.gradient.stops[w][1])}B.fillStyle=z}B.beginPath();B.arc(A[4],A[4],A[4],0,Math.PI*2,true);B.closePath();if(t.fillStyle||t.gradient){B.fill()}if(t.strokeStyle){B.stroke()}}}};jsPlumb.Endpoints.canvas.Rectangle=function(p){var o=this;jsPlumb.Endpoints.Rectangle.apply(this,arguments);b.apply(this,arguments);this._paint=function(x,r,v){var A=o.canvas.getContext("2d"),t=v.getOrientation(o);jsPlumb.extend(A,r);if(r.gradient){var z=t[1]==1?x[3]:t[1]==0?x[3]/2:0;var y=t[1]==-1?x[3]:t[1]==0?x[3]/2:0;var s=t[0]==1?x[2]:t[0]==0?x[2]/2:0;var q=t[0]==-1?x[2]:t[0]==0?x[2]/2:0;var w=A.createLinearGradient(s,z,q,y);for(var u=0;u<r.gradient.stops.length;u++){w.addColorStop(r.gradient.stops[u][0],r.gradient.stops[u][1])}A.fillStyle=w}A.beginPath();A.rect(0,0,x[2],x[3]);A.closePath();if(r.fillStyle||r.gradient){A.fill()}if(r.strokeStyle){A.stroke()}}};jsPlumb.Endpoints.canvas.Triangle=function(p){var o=this;jsPlumb.Endpoints.Triangle.apply(this,arguments);b.apply(this,arguments);this._paint=function(z,q,v){var s=z[2],C=z[3],B=z[0],A=z[1],D=o.canvas.getContext("2d"),w=0,u=0,t=0,r=v.getOrientation(o);if(r[0]==1){w=s;u=C;t=180}if(r[1]==-1){w=s;t=90}if(r[1]==1){u=C;t=-90}D.fillStyle=q.fillStyle;D.translate(w,u);D.rotate(t*Math.PI/180);D.beginPath();D.moveTo(0,0);D.lineTo(s/2,C/2);D.lineTo(0,C);D.closePath();if(q.fillStyle||q.gradient){D.fill()}if(q.strokeStyle){D.stroke()}}};jsPlumb.Endpoints.canvas.Image=jsPlumb.Endpoints.Image;jsPlumb.Endpoints.canvas.Blank=jsPlumb.Endpoints.Blank;jsPlumb.Connectors.canvas.Bezier=function(){var o=this;jsPlumb.Connectors.Bezier.apply(this,arguments);h.apply(this,arguments);this._paint=function(p){o.ctx.beginPath();o.ctx.moveTo(p[4],p[5]);o.ctx.bezierCurveTo(p[8],p[9],p[10],p[11],p[6],p[7]);o.ctx.stroke()};this.createGradient=function(r,p,q){return o.ctx.createLinearGradient(r[6],r[7],r[4],r[5])}};jsPlumb.Connectors.canvas.Straight=function(){var o=this;jsPlumb.Connectors.Straight.apply(this,arguments);h.apply(this,arguments);this._paint=function(p){o.ctx.beginPath();o.ctx.moveTo(p[4],p[5]);o.ctx.lineTo(p[6],p[7]);o.ctx.stroke()};this.createGradient=function(q,p){return p.createLinearGradient(q[4],q[5],q[6],q[7])}};jsPlumb.Connectors.canvas.Flowchart=function(){var o=this;jsPlumb.Connectors.Flowchart.apply(this,arguments);h.apply(this,arguments);this._paint=function(q){o.ctx.beginPath();o.ctx.moveTo(q[4],q[5]);for(var p=0;p<q[8];p++){o.ctx.lineTo(q[9+(p*2)],q[10+(p*2)])}o.ctx.lineTo(q[6],q[7]);o.ctx.stroke()};this.createGradient=function(q,p){return p.createLinearGradient(q[4],q[5],q[6],q[7])}};jsPlumb.Overlays.canvas.Label=jsPlumb.Overlays.Label;var g=function(){jsPlumb.jsPlumbUIComponent.apply(this,arguments)};var e=function(p,o){p.apply(this,o);g.apply(this,arguments);this.paint=function(s,u,q,v,t){var r=s.ctx;r.lineWidth=q;r.beginPath();r.moveTo(u.hxy.x,u.hxy.y);r.lineTo(u.tail[0].x,u.tail[0].y);r.lineTo(u.cxy.x,u.cxy.y);r.lineTo(u.tail[1].x,u.tail[1].y);r.lineTo(u.hxy.x,u.hxy.y);r.closePath();if(v){r.strokeStyle=v;r.stroke()}if(t){r.fillStyle=t;r.fill()}}};jsPlumb.Overlays.canvas.Arrow=function(){e.apply(this,[jsPlumb.Overlays.Arrow,arguments])};jsPlumb.Overlays.canvas.PlainArrow=function(){e.apply(this,[jsPlumb.Overlays.PlainArrow,arguments])};jsPlumb.Overlays.canvas.Diamond=function(){e.apply(this,[jsPlumb.Overlays.Diamond,arguments])}})();(function(){if(!Array.prototype.indexOf){Array.prototype.indexOf=function(w,t,y){for(var x=+t||0,u=this.length;x<u;x++){if(this[x]===w||y&&this[x]==w){return x}}return -1}}var c;YUI().use("node","dd","anim","node-event-simulate",function(s){c=s;c.on("domready",function(){jsPlumb.init()})});var e=function(v,t,u){var s=v[t];if(!s){s=[];v[t]=s}s.push(u)},g=["drag:mouseDown","drag:afterMouseDown","drag:mouseup","drag:align","drag:removeHandle","drag:addHandle","drag:removeInvalid","drag:addInvalid","drag:start","drag:end","drag:drag","drag:over","drag:enter","drag:exit","drag:drophit","drag:dropmiss","drop:over","drop:enter","drop:exit","drop:hit"],m=["tween"],r=function(s){return function(){try{return s.apply(this,arguments)}catch(t){}}},f=function(s){var u={};for(var t in s){if(g.indexOf(t)==-1){u[t]=s[t]}}return u},n=function(s,u,x){for(var v in u){if(x.indexOf(v)!=-1){var t=r(u[v]);s.on(v,t)}}},d={},p={},l={},q={},h={},k=function(t,v){if(t){var u=t.get("id");if(u){var s=p[u];if(s){if(s.hoverClass){if(v){t.addClass(s.hoverClass)}else{t.removeClass(s.hoverClass)}}}}}},i=null,b=function(u,t){for(var s in t){u[s]=t[s]}return u},o=function(s,t){return s.getAttribute(t)},a=function(t){if(t==null){return null}var s=null;s=typeof t=="string"?c.one("#"+t):t._node?t:c.one(t);return s};jsPlumb.CurrentLibrary={addClass:function(t,s){jsPlumb.CurrentLibrary.getElementObject(t).addClass(s)},animate:function(v,u,t){var w=b({node:v,to:u},t);var x=o(v,"id");w.tween=jsPlumb.wrap(u.tween,function(){jsPlumb.repaint(x)});var s=new c.Anim(w);n(s,w,m);s.run()},appendElement:function(t,s){a(s).append(t)},bind:function(s,t,u){a(s).on(t,u)},dragEvents:{start:"drag:start",stop:"drag:end",drag:"drag:drag",step:"step",over:"drop:enter",out:"drop:exit",drop:"drop:hit"},extend:b,getAttribute:o,getClientXY:function(s){return[s.clientX,s.clientY]},getDragObject:function(s){if(s[0].drag){i=s[0].drag.el}return i},getDragScope:function(t){var u=jsPlumb.getId(t);var s=q[u];return s.scope},getDropScope:function(s){var t=jsPlumb.getId(s);return h[t]},getDOMElement:function(s){if(typeof(s)=="String"){return document.getElementById(s)}else{if(s._node){return s._node}else{return s}}},getElementObject:a,getOffset:function(s){var t=c.DOM.getXY(s._node);return{left:t[0],top:t[1]}},getPageXY:function(s){return[s.pageX,s.pageY]},getParent:function(s){return jsPlumb.CurrentLibrary.getElementObject(s).get("parentNode")},getScrollLeft:function(s){return 0},getScrollTop:function(s){return 0},getSelector:function(t){var u=c.all(t);return u&&u._nodes?u._nodes:[]},getSize:function(s){return[s._node.offsetWidth,s._node.offsetHeight]},getTagName:function(s){var t=jsPlumb.CurrentLibrary.getElementObject(s);return t!=null&&t._node!=null?t._node.tagName:null},getUIPosition:function(s){var u=s[0].currentTarget.el._node,t=c.DOM.getXY(u);return{left:t[0],top:t[1]}},hasClass:function(t,s){return t.hasClass(s)},initDraggable:function(w,t){var u=f(t);var x=jsPlumb.getId(w);u.node="#"+x;var s=new c.DD.Drag(u);s.el=w;var v=t.scope||jsPlumb.Defaults.Scope;s.scope=v;q[x]=s;e(l,v,s);n(s,t,g)},initDroppable:function(w,t){var u=f(t);var x=jsPlumb.getId(w);u.node="#"+x;var s=new c.DD.Drop(u);p[x]=t;t=b({},t);var v=t.scope||jsPlumb.Defaults.Scope;h[x]=v;t["drop:enter"]=jsPlumb.wrap(t["drop:enter"],function(y){if(y.drag.scope!==v){return true}k(w,true)},true);t["drop:exit"]=jsPlumb.wrap(t["drop:exit"],function(y){k(w,false)});t["drop:hit"]=jsPlumb.wrap(t["drop:hit"],function(y){if(y.drag.scope!==v){return true}k(w,false)},true);n(s,t,g)},isAlreadyDraggable:function(s){s=a(s);return s.hasClass("yui3-dd-draggable")},isDragSupported:function(s){return true},isDropSupported:function(s){return true},removeClass:function(t,s){jsPlumb.CurrentLibrary.getElementObject(t).removeClass(s)},removeElement:function(s){a(s).remove()},setAttribute:function(u,s,t){u.setAttribute(s,t)},setDraggable:function(u,t){var v=jsPlumb.getId(u);var s=q[v];if(s){s.set("lock",!t)}},setDragScope:function(u,t){var v=jsPlumb.getId(u);var s=q[v];if(s){s.scope=t}},setOffset:function(s,t){s=a(s);s.set("top",t.top);s.set("left",t.left)},stopDrag:function(){c.DD.DDM.stopDrag()},trigger:function(t,u,s){s.stopPropagation();a(t).simulate(u,{pageX:s.pageX,pageY:s.pageY,clientX:s.clientX,clientY:s.clientY})},unbind:function(s,t,u){a(s).detach(t,u)}}})();(function(){if("undefined"==typeof Math.sgn){Math.sgn=function(l){return 0==l?0:0<l?1:-1}}var d={subtract:function(m,l){return{x:m.x-l.x,y:m.y-l.y}},dotProduct:function(m,l){return m.x*l.x+m.y*l.y},square:function(l){return Math.sqrt(l.x*l.x+l.y*l.y)},scale:function(m,l){return{x:m.x*l,y:m.y*l}}},f=Math.pow(2,-65),h=function(y,x){for(var t=[],v=x.length-1,r=2*v-1,s=[],w=[],p=[],q=[],o=[[1,0.6,0.3,0.1],[0.4,0.6,0.6,0.4],[0.1,0.3,0.6,1]],u=0;u<=v;u++){s[u]=d.subtract(x[u],y)}for(u=0;u<=v-1;u++){w[u]=d.subtract(x[u+1],x[u]),w[u]=d.scale(w[u],3)}for(u=0;u<=v-1;u++){for(var l=0;l<=v;l++){p[u]||(p[u]=[]),p[u][l]=d.dotProduct(w[u],s[l])}}for(u=0;u<=r;u++){q[u]||(q[u]=[]),q[u].y=0,q[u].x=parseFloat(u)/r}r=v-1;for(s=0;s<=v+r;s++){u=Math.max(0,s-r);for(w=Math.min(s,v);u<=w;u++){j=s-u,q[u+j].y+=p[j][u]*o[j][u]}}v=x.length-1;q=b(q,2*v-1,t,0);r=d.subtract(y,x[0]);p=d.square(r);for(u=o=0;u<q;u++){r=d.subtract(y,a(x,v,t[u],null,null)),r=d.square(r),r<p&&(p=r,o=t[u])}r=d.subtract(y,x[v]);r=d.square(r);r<p&&(p=r,o=1);return{location:o,distance:p}},b=function(C,B,x,z){var v=[],w=[],A=[],t=[],u=0,r,y;y=Math.sgn(C[0].y);for(var q=1;q<=B;q++){r=Math.sgn(C[q].y),r!=y&&u++,y=r}switch(u){case 0:return 0;case 1:if(64<=z){return x[0]=(C[0].x+C[B].x)/2,1}var p,u=C[0].y-C[B].y;r=C[B].x-C[0].x;y=C[0].x*C[B].y-C[B].x*C[0].y;q=max_distance_below=0;for(p=1;p<B;p++){var s=u*C[p].x+r*C[p].y+y;s>q?q=s:s<max_distance_below&&(max_distance_below=s)}p=r;q=(1*(y-q)-0*p)*(1/(0*p-1*u));p=r;u=(1*(y-max_distance_below)-0*p)*(1/(0*p-1*u));r=Math.min(q,u);if(Math.max(q,u)-r<f){return A=C[B].x-C[0].x,t=C[B].y-C[0].y,x[0]=0+1*(A*(C[0].y-0)-t*(C[0].x-0))*(1/(0*A-1*t)),1}}a(C,B,0.5,v,w);C=b(v,B,A,z+1);B=b(w,B,t,z+1);for(z=0;z<C;z++){x[z]=A[z]}for(z=0;z<B;z++){x[z+C]=t[z]}return C+B},a=function(m,l,p,q,n){for(var o=[[]],r=0;r<=l;r++){o[0][r]=m[r]}for(m=1;m<=l;m++){for(r=0;r<=l-m;r++){o[m]||(o[m]=[]),o[m][r]||(o[m][r]={}),o[m][r].x=(1-p)*o[m-1][r].x+p*o[m-1][r+1].x,o[m][r].y=(1-p)*o[m-1][r].y+p*o[m-1][r+1].y}}if(null!=q){for(r=0;r<=l;r++){q[r]=o[r][0]}}if(null!=n){for(r=0;r<=l;r++){n[r]=o[l-r][r]}}return o[l][0]},g={},e=function(t){var s=g[t];if(!s){var s=[],p=function(u){return function(){return u}},q=function(){return function(u){return u}},n=function(){return function(u){return 1-u}},o=function(u){return function(v){for(var x=1,w=0;w<u.length;w++){x*=u[w](v)}return x}};s.push(new function(){return function(u){return Math.pow(u,t)}});for(var r=1;r<t;r++){for(var l=[new p(t)],m=0;m<t-r;m++){l.push(new q)}for(m=0;m<r;m++){l.push(new n)}s.push(new o(l))}s.push(new function(){return function(u){return Math.pow(1-u,t)}});g[t]=s}return s},c=function(m,l){for(var p=e(m.length-1),q=0,n=0,o=0;o<m.length;o++){q+=m[o].x*p[o](l),n+=m[o].y*p[o](l)}return{x:q,y:n}},k=function(m,l,p){for(var q=c(m,l),n=0,o=0<p?1:-1,r=null;n<Math.abs(p);){l+=0.005*o,r=c(m,l),n+=Math.sqrt(Math.pow(r.x-q.x,2)+Math.pow(r.y-q.y,2)),q=r}return{point:r,location:l}},i=function(m,l){var o=c(m,l),p=c(m.slice(0,m.length-1),l),n=p.y-o.y,o=p.x-o.x;return 0==n?Infinity:Math.atan(n/o)};window.jsBezier={distanceFromCurve:h,gradientAtPoint:i,gradientAtPointAlongCurveFrom:function(m,l,n){l=k(m,l,n);if(1<l.location){l.location=1}if(0>l.location){l.location=0}return i(m,l.location)},nearestPointOnCurve:function(m,l){var n=h(m,l);return{point:a(l,l.length-1,n.location,null,null),location:n.location}},pointOnCurve:c,pointAlongCurveFrom:function(m,l,n){return k(m,l,n).point},perpendicularToCurveAt:function(m,l,n,o){l=k(m,l,null==o?0:o);m=i(m,l.location);o=Math.atan(-1/m);m=n/2*Math.sin(o);n=n/2*Math.cos(o);return[{x:l.point.x+n,y:l.point.y+m},{x:l.point.x-n,y:l.point.y-m}]}}})();