mootools.jsPlumb-1.3.4-all-min.js 103 KB

1
  1. (function(){var t=!!document.createElement("canvas").getContext,d=!!window.SVGAngle||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1"),a=!(t|d);var n=function(C,D,A,G){var F=function(J,I){if(J===I){return true}else{if(typeof J=="object"&&typeof I=="object"){var K=true;for(var H in J){if(!F(J[H],I[H])){K=false;break}}for(var H in I){if(!F(I[H],J[H])){K=false;break}}return K}}};for(var E=+A||0,B=C.length;E<B;E++){if(F(C[E],D)){return E}}return -1},g=function(A,C){for(var B=0;B<A.length;B++){if(C(A[B])){return B}}return -1},v=function(B,C){var A=g(B,C);if(A>-1){B.splice(A,1)}return A!=-1};if(!window.console){window.console={time:function(){},timeEnd:function(){},group:function(){},groupEnd:function(){},log:function(){}}}var i=function(D,B,C){var A=D[B];if(A==null){A=[],D[B]=A}A.push(C);return A},r=null,c=function(A,B){return l.CurrentLibrary.getAttribute(x(A),B)},e=function(B,C,A){l.CurrentLibrary.setAttribute(x(B),C,A)},u=function(B,A){l.CurrentLibrary.addClass(x(B),A)},h=function(B,A){return l.CurrentLibrary.hasClass(x(B),A)},k=function(B,A){l.CurrentLibrary.removeClass(x(B),A)},x=function(A){return l.CurrentLibrary.getElementObject(A)},p=function(A){return l.CurrentLibrary.getOffset(x(A))},b=function(A){return l.CurrentLibrary.getSize(x(A))},w=true,m=function(){if(w&&typeof console!="undefined"){try{var B=arguments[arguments.length-1];console.log(B)}catch(A){}}},z=function(A){if(w&&typeof console!="undefined"){console.group(A)}},f=function(A){if(w&&typeof console!="undefined"){console.groupEnd(A)}},y=function(A){if(w&&typeof console!="undefined"){console.time(A)}},q=function(A){if(w&&typeof console!="undefined"){console.timeEnd(A)}};EventGenerator=function(){var C={},B=this;var A=["ready"];this.bind=function(D,E){i(C,D,E)};this.fire=function(F,G,D){if(C[F]){for(var E=0;E<C[F].length;E++){if(n(A,F)!=-1){C[F][E](G,D)}else{try{C[F][E](G,D)}catch(H){m("jsPlumb: fire failed for event "+F+" : "+H)}}}}};this.clearListeners=function(D){if(D){delete C[D]}else{delete C;C={}}};this.getListener=function(D){return C[D]}},_timestamp=function(){return""+(new Date()).getTime()},jsPlumbUIComponent=function(E){var P=this,L=arguments,J=false,N=E.parameters||{},B=P.idPrefix,D=B+(new Date()).getTime();P._jsPlumb=E._jsPlumb;P.getId=function(){return D};P.tooltip=E.tooltip;P.hoverClass=E.hoverClass;EventGenerator.apply(this);this.clone=function(){var Q=new Object();P.constructor.apply(Q,L);return Q};this.getParameter=function(Q){return N[Q]},this.getParameters=function(){return N},this.setParameter=function(Q,R){N[Q]=R},this.setParameters=function(Q){N=Q},this.overlayPlacements=[],this.paintStyle=null,this.hoverPaintStyle=null;var F=E.beforeDetach;this.isDetachAllowed=function(Q){var R=true;if(F){try{R=F(Q)}catch(S){m("jsPlumb: beforeDetach callback failed",S)}}return R};var H=E.beforeDrop;this.isDropAllowed=function(T,Q,R){var S=P._jsPlumb.checkCondition("beforeDrop",{sourceId:T,targetId:Q,scope:R});if(H){try{S=H({sourceId:T,targetId:Q,scope:R})}catch(U){m("jsPlumb: beforeDrop callback failed",U)}}return S};var M=function(){if(P.paintStyle&&P.hoverPaintStyle){var Q={};l.extend(Q,P.paintStyle);l.extend(Q,P.hoverPaintStyle);delete P.hoverPaintStyle;if(Q.gradient&&P.paintStyle.fillStyle){delete Q.gradient}P.hoverPaintStyle=Q}};this.setPaintStyle=function(Q,R){P.paintStyle=Q;P.paintStyleInUse=P.paintStyle;M();if(!R){P.repaint()}};this.setHoverPaintStyle=function(Q,R){P.hoverPaintStyle=Q;M();if(!R){P.repaint()}};this.setHover=function(Q,S,R){if(!P._jsPlumb.currentlyDragging){J=Q;if(P.hoverClass!=null&&P.canvas!=null){if(Q){G.addClass(P.canvas,P.hoverClass)}else{G.removeClass(P.canvas,P.hoverClass)}}if(P.hoverPaintStyle!=null){P.paintStyleInUse=Q?P.hoverPaintStyle:P.paintStyle;R=R||_timestamp();P.repaint({timestamp:R,recalc:false})}if(P.getAttachedElements&&!S){K(Q,_timestamp(),P)}}};this.isHover=function(){return J};var G=l.CurrentLibrary,O=["click","dblclick","mouseenter","mouseout","mousemove","mousedown","mouseup"],I={mouseout:"mouseexit"},C=function(S,T,R){var Q=I[R]||R;G.bind(S,R,function(U){T.fire(Q,T,U)})},A=function(S,R){var Q=I[R]||R;G.unbind(S,R)};this.attachListeners=function(R,S){for(var Q=0;Q<O.length;Q++){C(R,S,O[Q])}};var K=function(U,T,Q){var S=P.getAttachedElements();if(S){for(var R=0;R<S.length;R++){if(!Q||Q!=S[R]){S[R].setHover(U,true,T)}}}};this.reattachListenersForElement=function(R,S){for(var Q=0;Q<O.length;Q++){A(R,O[Q])}P.attachListeners(R,S)}};var s=function(B){this.Defaults={Anchor:"BottomCenter",Anchors:[null,null],ConnectionsDetachable:true,Connector:"Bezier",Container:null,DragOptions:{},DropOptions:{},Endpoint:"Dot",Endpoints:[null,null],EndpointStyle:{fillStyle:"#456"},EndpointStyles:[null,null],EndpointHoverStyle:null,EndpointHoverStyles:[null,null],HoverPaintStyle:null,LabelStyle:{color:"black"},LogEnabled:false,Overlays:[],MaxConnections:1,MouseEventsEnabled:true,PaintStyle:{lineWidth:8,strokeStyle:"#456"},RenderMode:"svg",Scope:"jsPlumb_DefaultScope"};if(B){l.extend(this.Defaults,B)}this.logEnabled=this.Defaults.LogEnabled;EventGenerator.apply(this);var aq=this.bind;this.bind=function(a0,aZ){if("ready"===a0&&C){aZ()}else{aq(a0,aZ)}};var aS=this,E=null,ab=function(){l.repaintEverything()},aU=true,ar=function(){if(aU){ab()}},aK=null,C=false,ay={},au={},av={},U={},aV={},aL={},aR={},aP=this.Defaults.MouseEventsEnabled,aY=[],Q=[],F=this.Defaults.Scope,L=null,J=function(a2,a0,a1){var aZ=a2[a0];if(aZ==null){aZ=[];a2[a0]=aZ}aZ.push(a1);return aZ},aw=function(a0,aZ){if(aS.Defaults.Container){l.CurrentLibrary.appendElement(a0,aS.Defaults.Container)}else{if(!aZ){document.body.appendChild(a0)}else{l.CurrentLibrary.appendElement(a0,aZ)}}},aj=1,W=function(){return""+aj++},an=function(aZ){return aZ._nodes?aZ._nodes:aZ},aG=function(aZ,a1,a0){var a2=c(aZ,"id");aS.anchorManager.redraw(a2,a1,a0)},am=function(a0,a2){var a3=null;if(a0.constructor==Array){a3=[];for(var aZ=0;aZ<a0.length;aZ++){var a1=x(a0[aZ]),a4=c(a1,"id");a3.push(a2(a1,a4))}}else{var a1=x(a0),a4=c(a1,"id");a3=a2(a1,a4)}return a3},ae=function(aZ){return av[aZ]},aH=function(a3,a2,a1){var aZ=a2==null?false:a2;if(aZ){if(l.CurrentLibrary.isDragSupported(a3)&&!l.CurrentLibrary.isAlreadyDraggable(a3)){var a0=a1||aS.Defaults.DragOptions||l.Defaults.DragOptions;a0=l.extend({},a0);var a5=l.CurrentLibrary.dragEvents.drag;var a4=l.CurrentLibrary.dragEvents.stop;a0[a5]=Y(a0[a5],function(){var a6=l.CurrentLibrary.getUIPosition(arguments);aG(a3,a6);u(a3,"jsPlumb_dragged")});a0[a4]=Y(a0[a4],function(){var a6=l.CurrentLibrary.getUIPosition(arguments);aG(a3,a6);k(a3,"jsPlumb_dragged")});aR[A(a3)]=true;var aZ=aR[A(a3)];a0.disabled=aZ==null?false:!aZ;l.CurrentLibrary.initDraggable(a3,a0,false)}}},ai=function(a2,ba){var aZ=l.extend({},a2);if(ba){l.extend(aZ,ba)}if(aZ.source&&aZ.source.endpoint){aZ.sourceEndpoint=aZ.source}if(aZ.source&&aZ.target.endpoint){aZ.targetEndpoint=aZ.target}if(a2.uuids){aZ.sourceEndpoint=ae(a2.uuids[0]);aZ.targetEndpoint=ae(a2.uuids[1])}if(aZ.sourceEndpoint&&aZ.sourceEndpoint.isFull()){m(aS,"could not add connection; source endpoint is full");return}if(aZ.targetEndpoint&&aZ.targetEndpoint.isFull()){m(aS,"could not add connection; target endpoint is full");return}if(aZ.sourceEndpoint&&aZ.sourceEndpoint.connectorOverlays){aZ.overlays=aZ.overlays||[];for(var a5=0;a5<aZ.sourceEndpoint.connectorOverlays.length;a5++){aZ.overlays.push(aZ.sourceEndpoint.connectorOverlays[a5])}}aZ.tooltip=a2.tooltip;if(!aZ.tooltip&&aZ.sourceEndpoint&&aZ.sourceEndpoint.connectorTooltip){aZ.tooltip=aZ.sourceEndpoint.connectorTooltip}if(aZ.target&&!aZ.target.endpoint){var a3=A(aZ.target),a0=az[a3];var a1=function(bd,bb,bc,be){if(be[bc]){if(aZ[bb]){aZ[bb][1]=be[bc]}else{if(aZ[bd]){aZ[bb]=[aZ[bd],be[bc]];aZ[bd]=null}else{aZ[bb]=[null,be[bc]]}}}};if(a0){a1("endpoint","endpoints","endpoint",a0);a1("endpointStyle","endpointStyles","paintStyle",a0);a1("endpointHoverStyle","endpointHoverStyles","hoverPaintStyle",a0)}}if(aZ.dynamicAnchors){var a7=aZ.dynamicAnchors.constructor==Array,a9=aZ.sourceEndpoint?aZ.sourceEndpoint.elementId:A(aZ.source),a8=aZ.targetEndpoint?aZ.targetEndpoint.elementId:A(aZ.target),a6=a7?new aa(l.makeAnchors(aZ.dynamicAnchors,a9,aS)):new aa(l.makeAnchors(aZ.dynamicAnchors.source,a9,aS)),a4=a7?new aa(l.makeAnchors(aZ.dynamicAnchors,a8,aS)):new aa(l.makeAnchors(aZ.dynamicAnchors.target,a8,aS));aZ.anchors=[a6,a4]}return aZ},P=function(a3){var a2=l.Defaults.ConnectionType||l.getDefaultConnectionType(),a1=l.Defaults.EndpointType||S,a0=l.CurrentLibrary.getParent;if(a3.container){a3.parent=a3.container}else{if(a3.sourceEndpoint){a3.parent=a3.sourceEndpoint.parent}else{if(a3.source.constructor==a1){a3.parent=a3.source.parent}else{a3.parent=a0(a3.source)}}}a3._jsPlumb=aS;var aZ=new a2(a3);aZ.id="con_"+W();aW("click","click",aZ);aW("dblclick","dblclick",aZ);return aZ},aX=function(aZ,a0){a0=a0||{};if(!aZ.suspendedEndpoint){J(ay,aZ.scope,aZ)}if(!a0.doNotFireConnectionEvent&&a0.fireEvent!==false){aS.fire("jsPlumbConnection",{connection:aZ,source:aZ.source,target:aZ.target,sourceId:aZ.sourceId,targetId:aZ.targetId,sourceEndpoint:aZ.endpoints[0],targetEndpoint:aZ.endpoints[1]})}aS.anchorManager.newConnection(aZ);aG(aZ.source)},aW=function(aZ,a0,a1){a1.bind(aZ,function(a3,a2){aS.fire(a0,a1,a2)})},af=function(a1){if(a1.container){return a1.container}else{var aZ=l.CurrentLibrary.getTagName(a1.source),a0=l.CurrentLibrary.getParent(a1.source);if(aZ.toLowerCase()==="td"){return l.CurrentLibrary.getParent(a0)}else{return a0}}},ak=function(a1){var a0=l.Defaults.EndpointType||S;a1.parent=af(a1);a1._jsPlumb=aS;var aZ=new a0(a1);aZ.id="ep_"+W();aW("click","endpointClick",aZ);aW("dblclick","endpointDblClick",aZ);return aZ},I=function(a1,a4,a3){var aZ=au[a1];if(aZ&&aZ.length){for(var a2=0;a2<aZ.length;a2++){for(var a0=0;a0<aZ[a2].connections.length;a0++){var a5=a4(aZ[a2].connections[a0]);if(a5){return}}if(a3){a3(aZ[a2])}}}},M=function(a0){for(var aZ in au){I(aZ,a0)}},ad=function(aZ,a0){if(aZ!=null&&aZ.parentNode!=null){aZ.parentNode.removeChild(aZ)}},ax=function(a1,a0){for(var aZ=0;aZ<a1.length;aZ++){ad(a1[aZ],a0)}},R=function(a3,a1,a2){if(a1!=null){var aZ=a3[a1];if(aZ!=null){var a0=n(aZ,a2);if(a0>=0){delete (aZ[a0]);aZ.splice(a0,1);return true}}}return false},aO=function(a0,aZ){return am(a0,function(a1,a2){aR[a2]=aZ;if(l.CurrentLibrary.isDragSupported(a1)){l.CurrentLibrary.setDraggable(a1,aZ)}})},aC=function(a1,a2,aZ){a2=a2==="block";var a0=null;if(aZ){if(a2){a0=function(a4){a4.setVisible(true,true,true)}}else{a0=function(a4){a4.setVisible(false,true,true)}}}var a3=c(a1,"id");I(a3,function(a5){if(a2&&aZ){var a4=a5.sourceId===a3?1:0;if(a5.endpoints[a4].isVisible()){a5.setVisible(true)}}else{a5.setVisible(a2)}},a0)},aM=function(aZ){return am(aZ,function(a1,a0){var a2=aR[a0]==null?false:aR[a0];a2=!a2;aR[a0]=a2;l.CurrentLibrary.setDraggable(a1,a2);return a2})},at=function(aZ,a1){var a0=null;if(a1){a0=function(a2){var a3=a2.isVisible();a2.setVisible(!a3)}}I(aZ,function(a3){var a2=a3.isVisible();a3.setVisible(!a2)},a0)},K=function(a4){var a2=a4.timestamp,aZ=a4.recalc,a3=a4.offset,a0=a4.elId;if(!aZ){if(a2&&a2===aV[a0]){return U[a0]}}if(aZ||!a3){var a1=x(a0);if(a1!=null){Q[a0]=b(a1);U[a0]=p(a1);aV[a0]=a2}}else{U[a0]=a3;if(Q[a0]==null){var a1=x(a0);if(a1!=null){Q[a0]=b(a1)}}}if(U[a0]&&!U[a0].right){U[a0].right=U[a0].left+Q[a0][0];U[a0].bottom=U[a0].top+Q[a0][1];U[a0].width=Q[a0][0];U[a0].height=Q[a0][1];U[a0].centerx=U[a0].left+(U[a0].width/2);U[a0].centery=U[a0].top+(U[a0].height/2)}return U[a0]},ap=function(aZ){var a0=U[aZ];if(!a0){a0=K(aZ)}return{o:a0,s:Q[aZ]}},A=function(aZ,a0){var a1=x(aZ);var a2=c(a1,"id");if(!a2||a2=="undefined"){if(arguments.length==2&&arguments[1]!=undefined){a2=a0}else{a2="jsPlumb_"+W()}e(a1,"id",a2)}return a2},Y=function(a1,aZ,a0){a1=a1||function(){};aZ=aZ||function(){};return function(){var a2=null;try{a2=aZ.apply(this,arguments)}catch(a3){m(aS,"jsPlumb function failed : "+a3)}if(a0==null||(a2!==a0)){try{a1.apply(this,arguments)}catch(a3){m(aS,"wrapped function failed : "+a3)}}return a2}};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(a0,aZ){return l.CurrentLibrary.addClass(a0,aZ)};this.removeClass=function(a0,aZ){return l.CurrentLibrary.removeClass(a0,aZ)};this.hasClass=function(a0,aZ){return l.CurrentLibrary.hasClass(a0,aZ)};this.addEndpoint=function(a1,a2,bb){bb=bb||{};var a0=l.extend({},bb);l.extend(a0,a2);a0.endpoint=a0.endpoint||aS.Defaults.Endpoint||l.Defaults.Endpoint;a0.paintStyle=a0.paintStyle||aS.Defaults.EndpointStyle||l.Defaults.EndpointStyle;a1=an(a1);var a3=[],a6=a1.length&&a1.constructor!=String?a1:[a1];for(var a4=0;a4<a6.length;a4++){var a9=x(a6[a4]),aZ=A(a9);a0.source=a9;K({elId:aZ});var a8=ak(a0);J(au,aZ,a8);var a7=U[aZ],a5=Q[aZ];var ba=a8.anchor.compute({xy:[a7.left,a7.top],wh:a5,element:a8});a8.paint({anchorLoc:ba});a3.push(a8)}return a3.length==1?a3[0]:a3};this.addEndpoints=function(a3,a0,aZ){var a2=[];for(var a1=0;a1<a0.length;a1++){var a4=aS.addEndpoint(a3,a0[a1],aZ);if(a4.constructor==Array){Array.prototype.push.apply(a2,a4)}else{a2.push(a4)}}return a2};this.animate=function(a1,a0,aZ){var a2=x(a1),a5=c(a1,"id");aZ=aZ||{};var a4=l.CurrentLibrary.dragEvents.step;var a3=l.CurrentLibrary.dragEvents.complete;aZ[a4]=Y(aZ[a4],function(){aS.repaint(a5)});aZ[a3]=Y(aZ[a3],function(){aS.repaint(a5)});l.CurrentLibrary.animate(a2,a0,aZ)};this.checkCondition=function(a1,a3){var aZ=aS.getListener(a1);var a2=true;if(aZ&&aZ.length>0){try{for(var a0=0;a0<aZ.length;a0++){a2=a2&&aZ[a0](a3)}}catch(a4){m(aS,"cannot check condition ["+a1+"]"+a4)}}return a2};this.connect=function(a2,a0){var aZ=ai(a2,a0);if(aZ){if(aZ.deleteEndpointsOnDetach==null){aZ.deleteEndpointsOnDetach=true}var a1=P(aZ);aX(a1,aZ);return a1}};this.deleteEndpoint=function(a0){var a5=(typeof a0=="string")?av[a0]:a0;if(a5){var a2=a5.getUuid();if(a2){av[a2]=null}a5.detachAll();ad(a5.canvas,a5.parent);aS.anchorManager.deleteEndpoint(a5);for(var a4 in au){var aZ=au[a4];if(aZ){var a3=[];for(var a1=0;a1<aZ.length;a1++){if(aZ[a1]!=a5){a3.push(aZ[a1])}}au[a4]=a3}}delete a5}};this.deleteEveryEndpoint=function(){for(var a1 in au){var aZ=au[a1];if(aZ&&aZ.length){for(var a0=0;a0<aZ.length;a0++){aS.deleteEndpoint(aZ[a0])}}}delete au;au={};delete av;av={}};var aE=function(a1,a3){var a0=l.Defaults.ConnectionType||l.getDefaultConnectionType(),aZ=a1.constructor==a0,a2=aZ?{connection:a1,source:a1.source,target:a1.target,sourceId:a1.sourceId,targetId:a1.targetId,sourceEndpoint:a1.endpoints[0],targetEndpoint:a1.endpoints[1]}:a1;if(a3){aS.fire("jsPlumbConnectionDetached",a2)}aS.anchorManager.connectionDetached(a2)};this.detach=function(){if(arguments.length==0){return}var a3=l.Defaults.ConnectionType||l.getDefaultConnectionType(),a4=arguments[0].constructor==a3,a2=arguments.length==2?a4?(arguments[1]||{}):arguments[0]:arguments[0],a7=(a2.fireEvent!==false),a1=a2.forceDetach,a0=a4?arguments[0]:a2.connection;if(a0){if(a1||(a0.isDetachAllowed(a0)&&a0.endpoints[0].isDetachAllowed(a0)&&a0.endpoints[1].isDetachAllowed(a0))){if(a1||aS.checkCondition("beforeDetach",a0)){a0.endpoints[0].detach(a0,false,true,a7)}}}else{var aZ=l.extend({},a2);if(aZ.uuids){ae(aZ.uuids[0]).detachFrom(ae(aZ.uuids[1]),a7)}else{if(aZ.sourceEndpoint&&aZ.targetEndpoint){aZ.sourceEndpoint.detachFrom(aZ.targetEndpoint)}else{var a6=A(aZ.source),a5=A(aZ.target);I(a6,function(a8){if((a8.sourceId==a6&&a8.targetId==a5)||(a8.targetId==a6&&a8.sourceId==a5)){if(aS.checkCondition("beforeDetach",a8)){a8.endpoints[0].detach(a8,false,true,a7)}}})}}}};this.detachAllConnections=function(a1,a2){a2=a2||{};a1=x(a1);var a3=c(a1,"id"),aZ=au[a3];if(aZ&&aZ.length){for(var a0=0;a0<aZ.length;a0++){aZ[a0].detachAll(a2.fireEvent)}}};this.detachEveryConnection=function(a1){a1=a1||{};for(var a2 in au){var aZ=au[a2];if(aZ&&aZ.length){for(var a0=0;a0<aZ.length;a0++){aZ[a0].detachAll(a1.fireEvent)}}}delete ay;ay={}};this.draggable=function(a1,aZ){if(typeof a1=="object"&&a1.length){for(var a0=0;a0<a1.length;a0++){var a2=x(a1[a0]);if(a2){aH(a2,true,aZ)}}}else{if(a1._nodes){for(var a0=0;a0<a1._nodes.length;a0++){var a2=x(a1._nodes[a0]);if(a2){aH(a2,true,aZ)}}}else{var a2=x(a1);if(a2){aH(a2,true,aZ)}}}};this.extend=function(a0,aZ){return l.CurrentLibrary.extend(a0,aZ)};this.getDefaultEndpointType=function(){return S};this.getDefaultConnectionType=function(){return ag};this.getConnections=function(ba){if(!ba){ba={}}else{if(ba.constructor==String){ba={scope:ba}}}var a7=function(bb){var bc=[];if(bb){if(typeof bb=="string"){bc.push(bb)}else{bc=bb}}return bc};var a8=ba.scope||l.getDefaultScope(),a6=a7(a8),aZ=a7(ba.source),a4=a7(ba.target),a0=function(bc,bb){return bc.length>0?n(bc,bb)!=-1:true},a3=a6.length>1?{}:[],a9=function(bc,bd){if(a6.length>1){var bb=a3[bc];if(bb==null){bb=[];a3[bc]=bb}bb.push(bd)}else{a3.push(bd)}};for(var a2 in ay){if(a0(a6,a2)){for(var a1=0;a1<ay[a2].length;a1++){var a5=ay[a2][a1];if(a0(aZ,a5.sourceId)&&a0(a4,a5.targetId)){a9(a2,a5)}}}}return a3};this.getAllConnections=function(){return ay};this.getDefaultScope=function(){return F};this.getEndpoint=ae;this.getEndpoints=function(aZ){return au[A(aZ)]};this.getId=A;this.getOffset=function(a0){var aZ=U[a0];return K({elId:a0})};this.getSelector=function(aZ){return l.CurrentLibrary.getSelector(aZ)};this.getSize=function(a0){var aZ=Q[a0];if(!aZ){K({elId:a0})}return Q[a0]};this.appendElement=aw;this.hide=function(aZ,a0){aC(aZ,"none",a0)};this.idstamp=W;this.init=function(){if(!C){aS.setRenderMode(aS.Defaults.RenderMode);var aZ=function(a0){l.CurrentLibrary.bind(document,a0,function(a6){if(!aS.currentlyDragging&&aP&&L==l.CANVAS){for(var a5 in ay){var a7=ay[a5];for(var a3=0;a3<a7.length;a3++){var a2=a7[a3].connector[a0](a6);if(a2){return}}}for(var a4 in au){var a1=au[a4];for(var a3=0;a3<a1.length;a3++){if(a1[a3].endpoint[a0](a6)){return}}}}})};aZ("click");aZ("dblclick");aZ("mousemove");aZ("mousedown");aZ("mouseup");C=true;aS.fire("ready")}};this.log=E;this.jsPlumbUIComponent=jsPlumbUIComponent;this.EventGenerator=EventGenerator;this.makeAnchor=function(){if(arguments.length==0){return null}var a4=arguments[0],a1=arguments[1],a0=arguments[2],a2=null;if(!a0){throw"NO JSPLUMB SET"}if(a4.compute&&a4.getOrientation){return a4}else{if(typeof a4=="string"){a2=aS.Anchors[arguments[0]]({elementId:a1,jsPlumbInstance:aS})}else{if(a4.constructor==Array){if(a4[0].constructor==Array||a4[0].constructor==String){if(a4.length==2&&a4[0].constructor==String&&a4[1].constructor==Object){var aZ=l.extend({elementId:a1,jsPlumbInstance:aS},a4[1]);a2=aS.Anchors[a4[0]](aZ)}else{a2=new aa(a4,null,a1)}}else{var a3={x:a4[0],y:a4[1],orientation:(a4.length>=4)?[a4[2],a4[3]]:[0,0],offsets:(a4.length==6)?[a4[4],a4[5]]:[0,0],elementId:a1};a2=new N(a3);a2.clone=function(){return new N(a3)}}}}}if(!a2.id){a2.id="anchor_"+W()}return a2};this.makeAnchors=function(a2,a0,aZ){var a3=[];for(var a1=0;a1<a2.length;a1++){if(typeof a2[a1]=="string"){a3.push(aS.Anchors[a2[a1]]({elementId:a0,jsPlumbInstance:aZ}))}else{if(a2[a1].constructor==Array){a3.push(l.makeAnchor(a2[a1],a0,aZ))}}}return a3};this.makeDynamicAnchor=function(aZ,a0){return new aa(aZ,a0)};var az={};this.makeTarget=function(a1,a2,a8){var a0=l.extend({},a8);l.extend(a0,a2);var a6=l.CurrentLibrary,a7=a0.scope||aS.Defaults.Scope,a3=a0.deleteEndpointsOnDetach||true,aZ=function(bd){var bb=A(bd);az[bb]=a0.endpoint;var ba=l.extend({},a0.dropOptions||{}),a9=function(){aS.currentlyDragging=false;var bq=x(a6.getDragObject(arguments)),bg=c(bq,"dragId"),bo=c(bq,"originalScope"),bl=aL[bg],bf=bl.endpoints[0],be=a0.endpoint?l.extend({},a0.endpoint):{};be.paintStyle=be.paintStyle||aS.Defaults.EndpointStyles[1]||aS.Defaults.EndpointStyle||l.Defaults.EndpointStyles[1]||l.Defaults.EndpointStyle;be.hoverPaintStyle=be.hoverPaintStyle||aS.Defaults.EndpointHoverStyles[1]||aS.Defaults.EndpointHoverStyle||l.Defaults.EndpointHoverStyles[1]||l.Defaults.EndpointHoverStyle;be.anchor=be.anchor||aS.Defaults.Anchors[1]||aS.Defaults.Anchor||l.Defaults.Anchors[1]||l.Defaults.Anchor;bf.anchor.locked=false;if(bo){a6.setDragScope(bq,bo)}var bj=bl.isDropAllowed(bl.sourceId,A(bd),bl.scope);if(bl.endpointsToDeleteOnDetach){if(bf===bl.endpointsToDeleteOnDetach[0]){bl.endpointsToDeleteOnDetach[0]=null}else{if(bf===bl.endpointsToDeleteOnDetach[1]){bl.endpointsToDeleteOnDetach[1]=null}}}if(bl.suspendedEndpoint){bl.targetId=bl.suspendedEndpoint.elementId;bl.target=a6.getElementObject(bl.suspendedEndpoint.elementId);bl.endpoints[1]=bl.suspendedEndpoint}if(bj){bf.detach(bl,false,true,true);var bp=l.addEndpoint(bd,be);if(bp.anchor.positionFinder!=null){var bm=a6.getUIPosition(arguments),bi=a6.getOffset(bd),bn=a6.getSize(bd),bh=bp.anchor.positionFinder(bm,bi,bn,bp.anchor);bp.anchor.x=bh[0];bp.anchor.y=bh[1]}var bk=l.connect({source:bf,target:bp,scope:bo,previousConnection:bl,container:bl.parent,doNotFireConnectionEvent:bf.endpointWillMoveAfterConnection});if(a3){bk.endpointsToDeleteOnDetach=[bf,bp]}}else{if(bl.suspendedEndpoint){if(bf.isReattach){bl.setHover(false);bl.floatingAnchorIndex=null;bl.suspendedEndpoint.addConnection(bl);l.repaint(bf.elementId)}else{bf.detach(bl,false,true,true)}}}};var bc=a6.dragEvents.drop;ba.scope=ba.scope||a7;ba[bc]=Y(ba[bc],a9);a6.initDroppable(bd,ba,true)};a1=an(a1);var a5=a1.length&&a1.constructor!=String?a1:[a1];for(var a4=0;a4<a5.length;a4++){aZ(x(a5[a4]))}};this.makeTargets=function(a1,a2,aZ){for(var a0=0;a0<a1.length;a0++){aS.makeTarget(a1[a0],a2,aZ)}};var ah={};this.makeSource=function(a3,a6,aZ){var a4=l.extend({},aZ);l.extend(a4,a6);var a2=l.CurrentLibrary,a5=function(be){var a8=A(be);ah[a8]=a4.endpoint||{};var bb=a2.dragEvents.stop,bd=a2.dragEvents.drag,ba=l.extend({},ah[a8].dragOptions||{}),a7=null,bc=false;ah[a8].endpoint=ah[a8].endpoint||aS.Defaults.Endpoints[0]||aS.Defaults.Endpoint;ah[a8].paintStyle=ah[a8].paintStyle||aS.Defaults.EndpointStyles[0]||aS.Defaults.EndpointStyle||l.Defaults.EndpointStyles[0]||l.Defaults.EndpointStyle;ah[a8].hoverPaintStyle=ah[a8].hoverPaintStyle||aS.Defaults.EndpointHoverStyles[0]||aS.Defaults.EndpointHoverStyle||l.Defaults.EndpointHoverStyles[0]||l.Defaults.EndpointHoverStyle;ah[a8].anchor=ah[a8].anchor||aS.Defaults.Anchors[0]||aS.Defaults.Anchor||l.Defaults.Anchors[0]||l.Defaults.Anchor;ba[bd]=Y(ba[bd],function(){bc=false});ba[bb]=function(){aS.currentlyDragging=false;if(a7.connections.length==0){l.deleteEndpoint(a7)}else{a2.unbind(a7.canvas,"mousedown");var bg=ah[a8].anchor||aS.Defaults.Anchor;a7.anchor=l.makeAnchor(bg,a8,aS);if(a4.parent){var bh=a2.getElementObject(a4.parent);if(bh){var bf=a7.elementId;a7.setElement(bh);a7.endpointWillMoveAfterConnection=false;aS.anchorManager.rehomeEndpoint(bf,bh);var bi=a7.connections[0];aX(bi);aS.repaintEverything()}}aS.repaint(a8)}};var a9=function(bh){K({elId:a8});var bj=U[a8],bg=Q[a8];if(a4.parent){var bk=l.CurrentLibrary.getElementObject(a4.parent),bi=A(bk);K({elId:bi});bj=U[bi];bg=Q[bi]}var bm=((bh.pageX||bh.page.x)-bj.left)/bg[0],bl=((bh.pageY||bh.page.y)-bj.top)/bg[1];var bo={};l.extend(bo,ah[a8]);bo.isSource=true;bo.anchor=[bm,bl,0,0];bo.dragOptions=ba;if(a4.parent){var bf=bo.container||l.Defaults.Container;if(bf){bo.container=bf}else{bo.container=l.CurrentLibrary.getParent(a4.parent)}}a7=l.addEndpoint(a8,bo);bc=true;a7.endpointWillMoveAfterConnection=a4.parent!=null;a7.endpointWillMoveTo=a4.parent?a2.getElementObject(a4.parent):null;var bn=function(){if(bc){l.deleteEndpoint(a7)}};aS.registerListener(a7.canvas,"mouseup",bn);aS.registerListener(be,"mouseup",bn);a2.trigger(a7.canvas,"mousedown",bh)};aS.registerListener(be,"mousedown",a9)};a3=an(a3);var a0=a3.length&&a3.constructor!=String?a3:[a3];for(var a1=0;a1<a0.length;a1++){a5(x(a0[a1]))}};this.makeSources=function(a1,a2,aZ){for(var a0=0;a0<a1.length;a0++){aS.makeSource(a1[a0],a2,aZ)}};this.ready=function(aZ){aS.bind("ready",aZ)},this.repaint=function(a0){var a1=function(a2){aG(x(a2))};if(typeof a0=="object"){for(var aZ=0;aZ<a0.length;aZ++){a1(a0[aZ])}}else{a1(a0)}};this.repaintEverything=function(){var a0=_timestamp();for(var aZ in au){aG(x(aZ),null,a0)}};this.removeAllEndpoints=function(a1){var aZ=c(a1,"id"),a2=au[aZ];if(a2){for(var a0=0;a0<a2.length;a0++){aS.deleteEndpoint(a2[a0])}}au[aZ]=[]};this.removeEveryEndpoint=this.deleteEveryEndpoint;this.removeEndpoint=function(aZ,a0){aS.deleteEndpoint(a0)};var T={},aJ=function(){for(var a0 in T){for(var aZ=0;aZ<T[a0].length;aZ++){var a1=T[a0][aZ];l.CurrentLibrary.unbind(a1.el,a1.event,a1.listener)}}T={}};this.registerListener=function(a0,aZ,a1){l.CurrentLibrary.bind(a0,aZ,a1);J(T,aZ,{el:a0,event:aZ,listener:a1})};this.reset=function(){this.deleteEveryEndpoint();this.clearListeners();aJ();this.anchorManager.reset()};this.setAutomaticRepaint=function(aZ){aU=aZ};this.setDefaultScope=function(aZ){F=aZ};this.setDraggable=aO;this.setDebugLog=function(aZ){E=aZ};this.setRepaintFunction=function(aZ){ab=aZ};this.setMouseEventsEnabled=function(aZ){aP=aZ};this.CANVAS="canvas";this.SVG="svg";this.VML="vml";this.setRenderMode=function(aZ){if(aZ){aZ=aZ.toLowerCase()}else{return}if(aZ!==l.CANVAS&&aZ!==l.SVG&&aZ!==l.VML){throw new Error("render mode must be one of jsPlumb.CANVAS, jsPlumb.SVG or jsPlumb.VML")}if(aZ===l.CANVAS&&t){L=l.CANVAS}else{if(aZ===l.SVG&&d){L=l.SVG}else{if(a){L=l.VML}}}return L};this.getRenderMode=function(){return L};this.show=function(aZ,a0){aC(aZ,"block",a0)};this.sizeCanvas=function(a1,aZ,a3,a0,a2){if(a1){a1.style.height=a2+"px";a1.height=a2;a1.style.width=a0+"px";a1.width=a0;a1.style.left=aZ+"px";a1.style.top=a3+"px"}};this.getTestHarness=function(){return{endpointsByElement:au,endpointCount:function(aZ){var a0=au[aZ];return a0?a0.length:0},connectionCount:function(aZ){aZ=aZ||F;var a0=ay[aZ];return a0?a0.length:0},findIndex:n,getId:A,makeAnchor:self.makeAnchor,makeDynamicAnchor:self.makeDynamicAnchor}};this.toggle=at;this.toggleVisible=at;this.toggleDraggable=aM;this.unload=function(){delete au;delete av;delete U;delete Q;delete aL;delete aR;delete aY};this.wrap=Y;this.addListener=this.bind;var aT=function(a4,a1){var a2=null,aZ=a4;if(a1.tagName.toLowerCase()==="svg"&&a1.parentNode){a2=a1.parentNode}else{if(a1.offsetParent){a2=a1.offsetParent}}if(a2!=null){var a0=a2.tagName.toLowerCase()==="body"?{left:0,top:0}:p(a2),a3=a2.tagName.toLowerCase()==="body"?{left:0,top:0}:{left:a2.scrollLeft,top:a2.scrollTop};aZ[0]=a4[0]-a0.left+a3.left;aZ[1]=a4[1]-a0.top+a3.top}return aZ};var N=function(a3){var a1=this;this.x=a3.x||0;this.y=a3.y||0;this.elementId=a3.elementId;var a0=a3.orientation||[0,0];var a2=null,aZ=null;this.offsets=a3.offsets||[0,0];a1.timestamp=null;this.compute=function(a8){var a7=a8.xy,a4=a8.wh,a5=a8.element,a6=a8.timestamp;if(a6&&a6===a1.timestamp){return aZ}aZ=[a7[0]+(a1.x*a4[0])+a1.offsets[0],a7[1]+(a1.y*a4[1])+a1.offsets[1]];aZ=aT(aZ,a5.canvas);a1.timestamp=a6;return aZ};this.getOrientation=function(){return a0};this.equals=function(a4){if(!a4){return false}var a5=a4.getOrientation();var a6=this.getOrientation();return this.x==a4.x&&this.y==a4.y&&this.offsets[0]==a4.offsets[0]&&this.offsets[1]==a4.offsets[1]&&a6[0]==a5[0]&&a6[1]==a5[1]};this.getCurrentLocation=function(){return aZ}};var aB=function(a5){var a3=a5.reference,a4=a5.referenceCanvas,a1=b(x(a4)),a0=0,a6=0,aZ=null,a2=null;this.compute=function(ba){var a9=ba.xy,a8=ba.element,a7=[a9[0]+(a1[0]/2),a9[1]+(a1[1]/2)];a7=aT(a7,a8.canvas);a2=a7;return a7};this.getOrientation=function(){if(aZ){return aZ}else{var a7=a3.getOrientation();return[Math.abs(a7[0])*a0*-1,Math.abs(a7[1])*a6*-1]}};this.over=function(a7){aZ=a7.getOrientation()};this.out=function(){aZ=null};this.getCurrentLocation=function(){return a2}};var aa=function(a1,a0,a6){this.isSelective=true;this.isDynamic=true;var a9=[],a7=function(ba){return ba.constructor==N?ba:l.makeAnchor(ba,a6,aS)};for(var a5=0;a5<a1.length;a5++){a9[a5]=a7(a1[a5])}this.addAnchor=function(ba){a9.push(a7(ba))};this.getAnchors=function(){return a9};this.locked=false;var a2=a9.length>0?a9[0]:null,a4=a9.length>0?0:-1,a8=this,a3=function(bc,ba,bg,bf,bb){var be=bf[0]+(bc.x*bb[0]),bd=bf[1]+(bc.y*bb[1]);return Math.sqrt(Math.pow(ba-be,2)+Math.pow(bg-bd,2))},aZ=a0||function(bk,bb,bc,bd,ba){var bf=bc[0]+(bd[0]/2),be=bc[1]+(bd[1]/2);var bh=-1,bj=Infinity;for(var bg=0;bg<ba.length;bg++){var bi=a3(ba[bg],bf,be,bk,bb);if(bi<bj){bh=bg+0;bj=bi}}return ba[bh]};this.compute=function(be){var bd=be.xy,ba=be.wh,bc=be.timestamp,bb=be.txy,bf=be.twh;if(a8.locked||bb==null||bf==null){return a2.compute(be)}else{be.timestamp=null}a2=aZ(bd,ba,bb,bf,a9);return a2.compute(be)};this.getCurrentLocation=function(){return a2!=null?a2.getCurrentLocation():null};this.getOrientation=function(){return a2!=null?a2.getOrientation():[0,0]};this.over=function(ba){if(a2!=null){a2.over(ba)}};this.out=function(){if(a2!=null){a2.out()}}};var aN={},V={},ao={},H={HORIZONTAL:"horizontal",VERTICAL:"vertical",DIAGONAL:"diagonal",IDENTITY:"identity"},aQ=function(a8,a9,a5,a2){if(a8===a9){return{orientation:H.IDENTITY,a:["top","top"]}}var a0=Math.atan2((a2.centery-a5.centery),(a2.centerx-a5.centerx)),a3=Math.atan2((a5.centery-a2.centery),(a5.centerx-a2.centerx)),a4=((a5.left<=a2.left&&a5.right>=a2.left)||(a5.left<=a2.right&&a5.right>=a2.right)||(a5.left<=a2.left&&a5.right>=a2.right)||(a2.left<=a5.left&&a2.right>=a5.right)),ba=((a5.top<=a2.top&&a5.bottom>=a2.top)||(a5.top<=a2.bottom&&a5.bottom>=a2.bottom)||(a5.top<=a2.top&&a5.bottom>=a2.bottom)||(a2.top<=a5.top&&a2.bottom>=a5.bottom));if(!(a4||ba)){var a7=null,a1=false,aZ=false,a6=null;if(a2.left>a5.left&&a2.top>a5.top){a7=["right","top"]}else{if(a2.left>a5.left&&a5.top>a2.top){a7=["top","left"]}else{if(a2.left<a5.left&&a2.top<a5.top){a7=["top","right"]}else{if(a2.left<a5.left&&a2.top>a5.top){a7=["left","top"]}}}}return{orientation:H.DIAGONAL,a:a7,theta:a0,theta2:a3}}else{if(a4){return{orientation:H.HORIZONTAL,a:a5.top<a2.top?["bottom","top"]:["top","bottom"],theta:a0,theta2:a3}}else{return{orientation:H.VERTICAL,a:a5.left<a2.left?["right","left"]:["left","right"],theta:a0,theta2:a3}}}},aD=function(bd,a9,a7,a8,be,ba,a1){var bf=[],a0=a9[be?0:1]/(a8.length+1);for(var bb=0;bb<a8.length;bb++){var bg=(bb+1)*a0,aZ=ba*a9[be?1:0];if(a1){bg=a9[be?0:1]-bg}var a6=(be?bg:aZ),a3=a7[0]+a6,a5=a6/a9[0],a4=(be?aZ:bg),a2=a7[1]+a4,bc=a4/a9[1];bf.push([a3,a2,a5,bc,a8[bb][1],a8[bb][2]])}return bf},aF=function(a0,aZ){return a0[0]>aZ[0]?1:-1},O=function(aZ){return function(a1,a0){var a2=true;if(aZ){if(a1[0][0]<a0[0][0]){a2=true}else{a2=a1[0][1]>a0[0][1]}}else{if(a1[0][0]>a0[0][0]){a2=true}else{a2=a1[0][1]>a0[0][1]}}return a2===false?-1:1}},D=function(a0,aZ){var a2=a0[0][0]<0?-Math.PI-a0[0][0]:Math.PI-a0[0][0],a1=aZ[0][0]<0?-Math.PI-aZ[0][0]:Math.PI-aZ[0][0];if(a2>a1){return 1}else{return a0[0][1]>aZ[0][1]?1:-1}},aA={top:aF,right:O(true),bottom:O(true),left:D},Z=function(aZ,a0){return aZ.sort(a0)},X=function(a0,aZ){var a2=Q[a0],a3=U[a0],a1=function(a9,bg,a5,a8,be,bd){if(a8.length>0){var bc=Z(a8,aA[a9]),ba=a9==="right"||a9==="top",a4=aD(a9,bg,a5,bc,be,bd,ba);var bh=function(bk,bj){var bi=aT([bj[0],bj[1]],bk.canvas);V[bk.id]=[bi[0],bi[1],bj[2],bj[3]]};for(var a6=0;a6<a4.length;a6++){var bb=a4[a6][4],bf=bb.endpoints[0].elementId===a0,a7=bb.endpoints[1].elementId===a0;if(bf){bh(bb.endpoints[0],a4[a6])}else{if(a7){bh(bb.endpoints[1],a4[a6])}}}}};a1("bottom",a2,[a3.left,a3.top],aZ.bottom,true,1);a1("top",a2,[a3.left,a3.top],aZ.top,true,0);a1("left",a2,[a3.left,a3.top],aZ.left,false,0);a1("right",a2,[a3.left,a3.top],aZ.right,false,1)},al=function(){var aZ={},a1={},a2={},a5=[],a0=this,a4={};this.reset=function(){a1={};a2={};a5=[];a4={}};this.newConnection=function(a9){var bb=a9.sourceId,a8=a9.targetId,a6=a9.endpoints,ba=true,a7=function(bc,bd,bf,be,bg){if(bf.constructor==aa||bf.constructor==N){J(a1,be,[bg,bd,bf.constructor==aa])}else{if(bb==a8){l.CurrentLibrary.removeElement(a6[1].canvas);ba=false}J(a2,be,bg)}};a7(0,a6[0],a6[0].anchor,a8,a9);if(ba){a7(1,a6[1],a6[1].anchor,bb,a9)}};this.connectionDetached=function(a6){var bb=a6.sourceId,bc=a6.targetId,bf=a6.connection.endpoints,ba=function(bg,bh,bj,bi,bl){if(bj.constructor==aB){}else{if(bj.constructor==aa||bj.constructor==N){var bk=a1[bi];if(bk){v(bk,function(bm){return bm[0].id==bl.id})}}else{R(a2,bi,bl)}}};ba(1,bf[1],bf[1].anchor,bb,a6.connection);ba(0,bf[0],bf[0].anchor,bc,a6.connection);var a7=a6.connection.sourceId,a8=a6.connection.targetId,be=a6.connection.endpoints[0].id,a9=a6.connection.endpoints[1].id,bd=function(bi,bg){if(bi){var bh=function(bj){return bj[4]==bg};v(bi.top,bh);v(bi.left,bh);v(bi.bottom,bh);v(bi.right,bh)}};bd(a4[a7],be);bd(a4[a8],a9);a0.redraw(a7);a0.redraw(a8)};this.add=function(a7,a6){J(aZ,a6,a7)};this.get=function(a6){return{standard:a1[a6]||[],continuous:a2[a6]||[],endpoints:aZ[a6],continuousAnchorEndpoints:a5}};this.deleteEndpoint=function(a7){var a6=n(a5,a7);if(a6>-1){a5.splice(a6,1)}else{R(aZ,a7.elementId,a7)}};this.clearFor=function(a6){delete aZ[a6];aZ[a6]=[]};var a3=function(bq,bd,bl,ba,bg,bh,bj,bf,bs,bi,a9,bp){var bn=-1,a8=-1,bb=ba.endpoints[bj],bk=bb.id,be=[1,0][bj],a6=[[bd,bl],ba,bg,bh,bk],a7=bq[bs],br=bb._continuousAnchorEdge?bq[bb._continuousAnchorEdge]:null;if(br){var bo=g(br,function(bt){return bt[4]==bk});if(bo!=-1){br.splice(bo,1);for(var bm=0;bm<br.length;bm++){a9.push(br[bm][1]);bp.push(br[bm][1].endpoints[bj])}}}for(var bm=0;bm<a7.length;bm++){if(bj==1&&a7[bm][3]===bh&&a8==-1){a8=bm}a9.push(a7[bm][1]);bp.push(a7[bm][1].endpoints[bj])}if(bn!=-1){a7[bn]=a6}else{var bc=bf?a8!=-1?a8:0:a7.length;a7.splice(bc,0,a6)}bb._continuousAnchorEdge=bs};this.redraw=function(bi,bk,a8){var bu=aZ[bi]||[],bt=a1[bi]||[],bs=a2[bi]||[],a7=[],br=[];a8=a8||_timestamp();K({elId:bi,offset:bk,recalc:false,timestamp:a8});var be=U[bi],ba=Q[bi],bg={};for(var bp=0;bp<bs.length;bp++){var bb=bs[bp],bd=bb.sourceId,a9=bb.targetId,bq=bd+"_"+a9,bn=a9+"_"+bd,bm=bg[bq],bf=ap(a9),a6=ap(bd),bh=bb.sourceId==bi?1:0;if(!a4[bd]){a4[bd]={top:[],right:[],bottom:[],left:[]}}if(!a4[a9]){a4[a9]={top:[],right:[],bottom:[],left:[]}}if(a9==bd){a3(a4[bd],-Math.PI/2,0,bb,false,a9,0,false,"top",bd,a7,br)}else{if(!bm){bm=aQ(bd,a9,a6.o,bf.o);bg[bq]=bm}a3(a4[bd],bm.theta,0,bb,false,a9,0,false,bm.a[0],bd,a7,br);a3(a4[a9],bm.theta2,-1,bb,true,bd,1,true,bm.a[1],a9,a7,br)}a7.push(bb);br.push(bb.endpoints[bh])}for(var bc in a4){X(bc,a4[bc])}for(var bp=0;bp<bu.length;bp++){bu[bp].paint({timestamp:a8,offset:be,dimensions:ba})}for(var bp=0;bp<br.length;bp++){br[bp].paint({timestamp:a8,offset:be,dimensions:ba})}for(var bp=0;bp<bt.length;bp++){var bj=bt[bp][1];if(bj.anchor.constructor==aa){bj.paint({elementWithPrecedence:bi});a7.push(bt[bp][0]);for(var bo=0;bo<bj.connections.length;bo++){if(bj.connections[bo]!==bt[bp][0]){a7.push(bj.connections[bo])}}}else{if(bj.anchor.constructor==N){a7.push(bt[bp][0])}}}var bl=aL[bi];if(bl){bl.paint({timestamp:a8,recalc:false,elId:bi})}for(var bp=0;bp<a7.length;bp++){a7[bp].paint({elId:bi,timestamp:a8,recalc:false})}};this.rehomeEndpoint=function(a6,ba){var a7=aZ[a6]||[],a8=aS.getId(ba);for(var a9=0;a9<a7.length;a9++){a0.add(a7[a9],a8)}a7.splice(0,a7.length)}};aS.anchorManager=new al();aS.continuousAnchorFactory={get:function(a0){var aZ=aN[a0.elementId];if(!aZ){aZ={type:"Continuous",compute:function(a1){return V[a1.element.id]||[0,0]},getCurrentLocation:function(a1){return V[a1.id]||[0,0]},getOrientation:function(a1){return ao[a1.id]||[0,0]},isDynamic:true,isContinuous:true};aN[a0.elementId]=aZ}return aZ}};var ag=function(bj){var ba=this,a1=true;ba.idPrefix="_jsplumb_c_";jsPlumbUIComponent.apply(this,arguments);this.isVisible=function(){return a1};this.setVisible=function(bl){a1=bl;if(ba.connector&&ba.connector.canvas){ba.connector.canvas.style.display=bl?"block":"none"}};this.parent=bj.parent;this.source=x(bj.source);this.target=x(bj.target);if(bj.sourceEndpoint){this.source=bj.sourceEndpoint.endpointWillMoveTo||bj.sourceEndpoint.getElement()}if(bj.targetEndpoint){this.target=bj.targetEndpoint.getElement()}ba.previousConnection=bj.previousConnection;this.sourceId=c(this.source,"id");this.targetId=c(this.target,"id");this.getAttachedElements=function(){return ba.endpoints};this.scope=bj.scope;this.endpoints=[];this.endpointStyles=[];var bg=function(bm,bl){if(bm){return l.makeAnchor(bm,bl,aS)}},be=function(bl,br,bm,bo,bp,bn,bq){if(bl){ba.endpoints[br]=bl;bl.addConnection(ba)}else{if(!bm.endpoints){bm.endpoints=[null,null]}var bx=bm.endpoints[br]||bm.endpoint||aS.Defaults.Endpoints[br]||l.Defaults.Endpoints[br]||aS.Defaults.Endpoint||l.Defaults.Endpoint;if(!bm.endpointStyles){bm.endpointStyles=[null,null]}if(!bm.endpointHoverStyles){bm.endpointHoverStyles=[null,null]}var bv=bm.endpointStyles[br]||bm.endpointStyle||aS.Defaults.EndpointStyles[br]||l.Defaults.EndpointStyles[br]||aS.Defaults.EndpointStyle||l.Defaults.EndpointStyle;if(bv.fillStyle==null&&bn!=null){bv.fillStyle=bn.strokeStyle}if(bv.outlineColor==null&&bn!=null){bv.outlineColor=bn.outlineColor}if(bv.outlineWidth==null&&bn!=null){bv.outlineWidth=bn.outlineWidth}var bu=bm.endpointHoverStyles[br]||bm.endpointHoverStyle||aS.Defaults.EndpointHoverStyles[br]||l.Defaults.EndpointHoverStyles[br]||aS.Defaults.EndpointHoverStyle||l.Defaults.EndpointHoverStyle;if(bq!=null){if(bu==null){bu={}}if(bu.fillStyle==null){bu.fillStyle=bq.strokeStyle}}var bt=bm.anchors?bm.anchors[br]:bm.anchor?bm.anchor:bg(aS.Defaults.Anchors[br],bp)||bg(l.Defaults.Anchors[br],bp)||bg(aS.Defaults.Anchor,bp)||bg(l.Defaults.Anchor,bp),bw=bm.uuids?bm.uuids[br]:null,bs=ak({paintStyle:bv,hoverPaintStyle:bu,endpoint:bx,connections:[ba],uuid:bw,anchor:bt,source:bo,container:bm.container,reattach:bm.reattach,detachable:bm.detachable});ba.endpoints[br]=bs;if(bm.drawEndpoints===false){bs.setVisible(false,true,true)}return bs}};var bc=be(bj.sourceEndpoint,0,bj,ba.source,ba.sourceId,bj.paintStyle,bj.hoverPaintStyle);if(bc){J(au,this.sourceId,bc)}var a3=((ba.sourceId==ba.targetId)&&bj.targetEndpoint==null)?bc:bj.targetEndpoint,bb=be(a3,1,bj,ba.target,ba.targetId,bj.paintStyle,bj.hoverPaintStyle);if(bb){J(au,this.targetId,bb)}if(!this.scope){this.scope=this.endpoints[0].scope}if(bj.deleteEndpointsOnDetach){ba.endpointsToDeleteOnDetach=[bc,bb]}var a0=aS.Defaults.ConnectionsDetachable;if(bj.detachable===false){a0=false}if(ba.endpoints[0].connectionsDetachable===false){a0=false}if(ba.endpoints[1].connectionsDetachable===false){a0=false}this.isDetachable=function(){return a0===true};this.setDetachable=function(bl){a0=bl===true};var bk=l.CurrentLibrary.extend({},this.endpoints[0].getParameters());l.CurrentLibrary.extend(bk,this.endpoints[1].getParameters());l.CurrentLibrary.extend(bk,ba.getParameters());ba.setParameters(bk);var bi=function(){ba.connector.bind("click",function(bl,bm){ba.fire("click",ba,bm)});ba.connector.bind("dblclick",function(bl,bm){ba.fire("dblclick",ba,bm)});ba.connector.bind("mouseenter",function(bl,bm){if(!ba.isHover()){if(r==null){ba.setHover(true,false)}ba.fire("mouseenter",ba,bm)}});ba.connector.bind("mouseexit",function(bl,bm){if(ba.isHover()){if(r==null){ba.setHover(false,false)}ba.fire("mouseexit",ba,bm)}})};this.setConnector=function(bl,bm){if(ba.connector!=null){ax(ba.connector.getDisplayElements(),ba.parent)}var bn={_jsPlumb:ba._jsPlumb,parent:bj.parent,cssClass:bj.cssClass,container:bj.container,tooltip:ba.tooltip};if(bl.constructor==String){this.connector=new l.Connectors[L][bl](bn)}else{if(bl.constructor==Array){this.connector=new l.Connectors[L][bl[0]](l.extend(bl[1],bn))}}ba.canvas=ba.connector.canvas;bi();if(!bm){ba.repaint()}};ba.setConnector(this.endpoints[0].connector||this.endpoints[1].connector||bj.connector||aS.Defaults.Connector||l.Defaults.Connector,true);var a7=ba.setHover;ba.setHover=function(){ba.connector.setHover.apply(ba.connector,arguments);a7.apply(ba,arguments)};this.setPaintStyle(this.endpoints[0].connectorStyle||this.endpoints[1].connectorStyle||bj.paintStyle||aS.Defaults.PaintStyle||l.Defaults.PaintStyle,true);this.setHoverPaintStyle(this.endpoints[0].connectorHoverStyle||this.endpoints[1].connectorHoverStyle||bj.hoverPaintStyle||aS.Defaults.HoverPaintStyle||l.Defaults.HoverPaintStyle,true);this.paintStyleInUse=this.paintStyle;this.overlays=[];var a8=function(bp){var bn=null;if(bp.constructor==Array){var bm=bp[0],bo=l.CurrentLibrary.extend({connection:ba,_jsPlumb:aS},bp[1]);if(bp.length==3){l.CurrentLibrary.extend(bo,bp[2])}bn=new l.Overlays[L][bm](bo);if(bo.events){for(var bl in bo.events){bn.bind(bl,bo.events[bl])}}}else{if(bp.constructor==String){bn=new l.Overlays[L][bp]({connection:ba,_jsPlumb:aS})}else{bn=bp}}ba.overlays.push(bn)};var a2=bj.overlays||aS.Defaults.Overlays;if(a2){for(var bf=0;bf<a2.length;bf++){a8(a2[bf])}}this.moveParent=function(bo){var bn=l.CurrentLibrary,bm=bn.getParent(ba.connector.canvas);bn.removeElement(ba.connector.canvas,bm);bn.appendElement(ba.connector.canvas,bo);if(ba.connector.bgCanvas){bn.removeElement(ba.connector.bgCanvas,bm);bn.appendElement(ba.connector.bgCanvas,bo)}for(var bl=0;bl<ba.overlays.length;bl++){if(ba.overlays[bl].isAppendedAtTopLevel){bn.removeElement(ba.overlays[bl].canvas,bm);bn.appendElement(ba.overlays[bl].canvas,bo);if(ba.overlays[bl].reattachListeners){ba.overlays[bl].reattachListeners()}}}if(ba.connector.reattachListeners){ba.connector.reattachListeners()}};var bh=function(bn){var bl=-1;for(var bm=0;bm<ba.overlays.length;bm++){if(bn===ba.overlays[bm].id){bl=bm;break}}return bl};this.addOverlay=function(bl){a8(bl);ba.repaint()};this.getOverlay=function(bm){var bl=bh(bm);return bl>=0?ba.overlays[bl]:null};this.hideOverlay=function(bm){var bl=ba.getOverlay(bm);if(bl){bl.hide()}};this.showOverlay=function(bm){var bl=ba.getOverlay(bm);if(bl){bl.show()}};this.removeAllOverlays=function(){ba.overlays.splice(0,ba.overlays.length);ba.repaint()};this.removeOverlay=function(bm){var bl=bh(bm);if(bl!=-1){var bn=ba.overlays[bl];bn.cleanup();ba.overlays.splice(bl,1)}};this.removeOverlays=function(){for(var bl=0;bl<arguments.length;bl++){ba.removeOverlay(arguments[bl])}};this.labelStyle=bj.labelStyle||aS.Defaults.LabelStyle||l.Defaults.LabelStyle;this.label=bj.label;if(this.label){this.overlays.push(new l.Overlays[L].Label({cssClass:bj.cssClass,labelStyle:this.labelStyle,label:this.label,connection:ba,_jsPlumb:aS}))}K({elId:this.sourceId});K({elId:this.targetId});this.setLabel=function(bl){ba.label=bl;aS.repaint(ba.source)};var a5=U[this.sourceId],a4=Q[this.sourceId],aZ=U[this.targetId],a6=Q[this.targetId],a9=_timestamp(),bd=this.endpoints[0].anchor.compute({xy:[a5.left,a5.top],wh:a4,element:this.endpoints[0],elementId:this.endpoints[0].elementId,txy:[aZ.left,aZ.top],twh:a6,tElement:this.endpoints[1],timestamp:a9});this.endpoints[0].paint({anchorLoc:bd,timestamp:a9});bd=this.endpoints[1].anchor.compute({xy:[aZ.left,aZ.top],wh:a6,element:this.endpoints[1],elementId:this.endpoints[1].elementId,txy:[a5.left,a5.top],twh:a4,tElement:this.endpoints[0],timestamp:a9});this.endpoints[1].paint({anchorLoc:bd,timestamp:a9});this.paint=function(bB){bB=bB||{};var bs=bB.elId,bt=bB.ui,br=bB.recalc,bm=bB.timestamp,bu=false,bA=bu?this.sourceId:this.targetId,bq=bu?this.targetId:this.sourceId,bn=bu?0:1,bC=bu?1:0;K({elId:bs,offset:bt,recalc:br,timestamp:bm});K({elId:bA,timestamp:bm});var bw=this.endpoints[bC],bl=this.endpoints[bn],bp=bw.anchor.getCurrentLocation(bw),bz=bl.anchor.getCurrentLocation(bl);var bo=0;for(var by=0;by<ba.overlays.length;by++){var bv=ba.overlays[by];if(bv.isVisible()){bo=Math.max(bo,bv.computeMaxSize(ba.connector))}}var bx=this.connector.compute(bp,bz,this.endpoints[bC],this.endpoints[bn],this.endpoints[bC].anchor,this.endpoints[bn].anchor,ba.paintStyleInUse.lineWidth,bo);ba.connector.paint(bx,ba.paintStyleInUse);for(var by=0;by<ba.overlays.length;by++){var bv=ba.overlays[by];if(bv.isVisible){ba.overlayPlacements[by]=bv.draw(ba.connector,ba.paintStyleInUse,bx)}}};this.repaint=function(bm){bm=bm||{};var bl=!(bm.recalc===false);this.paint({elId:this.sourceId,recalc:bl,timestamp:bm.timestamp})};if(this.source.resize){this.source.resize(function(bl){l.repaint(ba.sourceId)})}ba.repaint()};var aI=function(a0){var aZ=false;return function(){if(aZ){return true}var a1=l.CurrentLibrary.getUIPosition(arguments),a2=a0.element;if(a2){l.CurrentLibrary.setOffset(a2,a1);aG(x(a2),a1)}this.stopDrag=function(){aZ=true}}};var ac=function(a3,a2,a4,a1,aZ){var a0=new aB({reference:a2,referenceCanvas:a1});return ak({paintStyle:a3,endpoint:a4,anchor:a0,source:aZ,scope:"__floating"})};var G=function(a1,aZ){var a3=document.createElement("div");a3.style.position="absolute";var a0=x(a3);aw(a3,aZ);var a2=A(a0);K({elId:a2});a1.id=a2;a1.element=a0};var S=function(bq){var bg=this;bg.idPrefix="_jsplumb_e_";l.jsPlumbUIComponent.apply(this,arguments);bq=bq||{};var a2=true;this.isVisible=function(){return a2};this.setVisible=function(bt,bw,bs){a2=bt;if(bg.canvas){bg.canvas.style.display=bt?"block":"none"}if(!bw){for(var bv=0;bv<bg.connections.length;bv++){bg.connections[bv].setVisible(bt);if(!bs){var bu=bg===bg.connections[bv].endpoints[0]?1:0;if(bg.connections[bv].endpoints[bu].connections.length==1){bg.connections[bv].endpoints[bu].setVisible(bt,true,true)}}}}};var bf=bq.source,ba=bq.uuid,bo=null,a4=null;if(ba){av[ba]=bg}var a7=c(bf,"id");this.elementId=a7;this.element=bf;if(bq.dynamicAnchors){bg.anchor=new aa(l.makeAnchors(bq.dynamicAnchors))}else{bg.anchor=bq.anchor?l.makeAnchor(bq.anchor,a7,aS):bq.anchors?l.makeAnchor(bq.anchors,a7,aS):l.makeAnchor("TopCenter",a7,aS)}if(!bq._transient){aS.anchorManager.add(bg,a7)}var bd=bq.endpoint||aS.Defaults.Endpoint||l.Defaults.Endpoint||"Dot",a8={_jsPlumb:bg._jsPlumb,parent:bq.parent,container:bq.container,tooltip:bq.tooltip,connectorTooltip:bq.connectorTooltip,endpoint:bg};if(bd.constructor==String){bd=new l.Endpoints[L][bd](a8)}else{if(bd.constructor==Array){a8=l.extend(bd[1],a8);bd=new l.Endpoints[L][bd[0]](a8)}else{bd=bd.clone()}}this.clone=function(){var bs=new Object();bd.constructor.apply(bs,[a8]);return bs};bg.endpoint=bd;bg.type=bg.endpoint.type;var be=bg.setHover;bg.setHover=function(){bg.endpoint.setHover.apply(bg.endpoint,arguments);be.apply(bg,arguments)};var br=function(bs){if(bg.connections.length>0){bg.connections[0].setHover(bs,false)}else{bg.setHover(bs)}};this.endpoint.bind("click",function(bs){bg.fire("click",bg,bs)});this.endpoint.bind("dblclick",function(bs){bg.fire("dblclick",bg,bs)});this.endpoint.bind("mouseenter",function(bs,bt){if(!bg.isHover()){br(true);bg.fire("mouseenter",bg,bt)}});this.endpoint.bind("mouseexit",function(bs,bt){if(bg.isHover()){br(false);bg.fire("mouseexit",bg,bt)}});this.setPaintStyle(bq.paintStyle||bq.style||aS.Defaults.EndpointStyle||l.Defaults.EndpointStyle,true);this.setHoverPaintStyle(bq.hoverPaintStyle||aS.Defaults.EndpointHoverStyle||l.Defaults.EndpointHoverStyle,true);this.paintStyleInUse=this.paintStyle;this.connectorStyle=bq.connectorStyle;this.connectorHoverStyle=bq.connectorHoverStyle;this.connectorOverlays=bq.connectorOverlays;this.connector=bq.connector;this.connectorTooltip=bq.connectorTooltip;this.parent=bq.parent;this.isSource=bq.isSource||false;this.isTarget=bq.isTarget||false;var bl=bq.maxConnections||aS.Defaults.MaxConnections;this.getAttachedElements=function(){return bg.connections};this.canvas=this.endpoint.canvas;this.connections=bq.connections||[];this.scope=bq.scope||F;this.timestamp=null;bg.isReattach=bq.reattach||false;bg.connectionsDetachable=aS.Defaults.ConnectionsDetachable;if(bq.connectionsDetachable===false||bq.detachable===false){bg.connectionsDetachable=false}var bb=bq.dragAllowedWhenFull||true;this.computeAnchor=function(bs){return bg.anchor.compute(bs)};this.addConnection=function(bs){bg.connections.push(bs)};this.detach=function(bs,bw,bt,bA){var bz=n(bg.connections,bs),by=false;bA=(bA!==false);if(bz>=0){if(bt||bs._forceDetach||bs.isDetachable()||bs.isDetachAllowed(bs)){var bB=bs.endpoints[0]==bg?bs.endpoints[1]:bs.endpoints[0];if(bt||bs._forceDetach||(bg.isDetachAllowed(bs))){bg.connections.splice(bz,1);if(!bw){bB.detach(bs,true,bt);if(bs.endpointsToDeleteOnDetach){for(var bx=0;bx<bs.endpointsToDeleteOnDetach.length;bx++){var bu=bs.endpointsToDeleteOnDetach[bx];if(bu&&bu.connections.length==0){l.deleteEndpoint(bu)}}}}ax(bs.connector.getDisplayElements(),bs.parent);R(ay,bs.scope,bs);by=true;var bv=(!bw&&bA);aE(bs,bv)}}}return by};this.detachAll=function(bs){while(bg.connections.length>0){bg.detach(bg.connections[0],false,true,bs)}};this.detachFrom=function(bu,bt){var bv=[];for(var bs=0;bs<bg.connections.length;bs++){if(bg.connections[bs].endpoints[1]==bu||bg.connections[bs].endpoints[0]==bu){bv.push(bg.connections[bs])}}for(var bs=0;bs<bv.length;bs++){if(bg.detach(bv[bs],false,true,bt)){bv[bs].setHover(false,false)}}};this.detachFromConnection=function(bt){var bs=n(bg.connections,bt);if(bs>=0){bg.connections.splice(bs,1)}};this.getElement=function(){return bf};this.setElement=function(bu){var bw=A(bu);R(au,a7,bg);bf=x(bu);a7=A(bf);bg.elementId=a7;var bv=af({source:bw}),bt=a1.getParent(bg.canvas);a1.removeElement(bg.canvas,bt);a1.appendElement(bg.canvas,bv);for(var bs=0;bs<bg.connections.length;bs++){bg.connections[bs].moveParent(bv);bg.connections[bs].sourceId=a7;bg.connections[bs].source=bf}J(au,bw,bg);aS.repaint(bw)};this.getUuid=function(){return ba};this.makeInPlaceCopy=function(){return ak({anchor:bg.anchor,source:bf,paintStyle:this.paintStyle,endpoint:bd,_transient:true,scope:bg.scope})};this.isConnectedTo=function(bu){var bt=false;if(bu){for(var bs=0;bs<bg.connections.length;bs++){if(bg.connections[bs].endpoints[1]==bu){bt=true;break}}}return bt};this.isFloating=function(){return bo!=null};this.connectorSelector=function(){var bs=bg.connections[0];if(bg.isTarget&&bs){return bs}else{return(bg.connections.length<bl)||bl==-1?null:bs}};this.isFull=function(){return !(bg.isFloating()||bl<1||bg.connections.length<bl)};this.setDragAllowedWhenFull=function(bs){bb=bs};this.setStyle=bg.setPaintStyle;this.equals=function(bs){return this.anchor.equals(bs.anchor)};var bc=function(bt){var bs=0;if(bt!=null){for(var bu=0;bu<bg.connections.length;bu++){if(bg.connections[bu].sourceId==bt||bg.connections[bu].targetId==bt){bs=bu;break}}}return bg.connections[bs]};this.paint=function(bu){bu=bu||{};var bz=bu.timestamp,by=!(bu.recalc===false);if(!bz||bg.timestamp!==bz){K({elId:a7,timestamp:bz,recalc:by});var bx=bu.anchorPoint,bv=bu.connectorPaintStyle;if(bx==null){var bF=bu.offset||U[a7],bs=bu.dimensions||Q[a7];if(bF==null||bs==null){K({elId:a7,timestamp:bz});bF=U[a7];bs=Q[a7]}var bt={xy:[bF.left,bF.top],wh:bs,element:bg,timestamp:bz};if(by&&bg.anchor.isDynamic&&bg.connections.length>0){var bC=bc(bu.elementWithPrecedence),bE=bC.endpoints[0]==bg?1:0,bw=bE==0?bC.sourceId:bC.targetId,bB=U[bw],bD=Q[bw];bt.txy=[bB.left,bB.top];bt.twh=bD;bt.tElement=bC.endpoints[bE]}bx=bg.anchor.compute(bt)}var bA=bd.compute(bx,bg.anchor.getOrientation(bd),bg.paintStyleInUse,bv||bg.paintStyleInUse);bd.paint(bA,bg.paintStyleInUse,bg.anchor);bg.timestamp=bz}};this.repaint=this.paint;this.removeConnection=this.detach;if(l.CurrentLibrary.isDragSupported(bf)){var bk={id:null,element:null},bj=null,a0=false,a3=null,aZ=aI(bk);var a5=function(){bj=bg.connectorSelector();var bs=true;if(bj==null&&!bq.isSource){bs=false}if(bq.isSource&&bg.isFull()&&!bb){bs=false}if(bj!=null&&!bj.isDetachable()){bs=false}if(bs===false){if(l.CurrentLibrary.stopDrag){l.CurrentLibrary.stopDrag()}aZ.stopDrag();return false}if(bj&&!bg.isFull()&&bq.isSource){bj=null}K({elId:a7});a4=bg.makeInPlaceCopy();a4.paint();G(bk,bg.parent);var by=x(a4.canvas),bw=l.CurrentLibrary.getOffset(by),bt=aT([bw.left,bw.top],a4.canvas);l.CurrentLibrary.setOffset(bk.element,{left:bt[0],top:bt[1]});e(x(bg.canvas),"dragId",bk.id);e(x(bg.canvas),"elId",a7);bo=ac(bg.paintStyle,bg.anchor,bd,bg.canvas,bk.element);if(bj==null){bg.anchor.locked=true;bg.setHover(false,false);bj=P({sourceEndpoint:bg,targetEndpoint:bo,source:bg.endpointWillMoveTo||x(bf),target:bk.element,anchors:[bg.anchor,bo.anchor],paintStyle:bq.connectorStyle,hoverPaintStyle:bq.connectorHoverStyle,connector:bq.connector,overlays:bq.connectorOverlays})}else{a0=true;bj.connector.setHover(false,false);a6(x(a4.canvas),false,true);var bv=bj.endpoints[0].id==bg.id?0:1;bj.floatingAnchorIndex=bv;bg.detachFromConnection(bj);var bz=x(bg.canvas),bx=l.CurrentLibrary.getDragScope(bz);e(bz,"originalScope",bx);var bu=l.CurrentLibrary.getDropScope(bz);l.CurrentLibrary.setDragScope(bz,bu);if(bv==0){a3=[bj.source,bj.sourceId,bn,bx];bj.source=bk.element;bj.sourceId=bk.id}else{a3=[bj.target,bj.targetId,bn,bx];bj.target=bk.element;bj.targetId=bk.id}bj.endpoints[bv==0?1:0].anchor.locked=true;bj.suspendedEndpoint=bj.endpoints[bv];bj.suspendedEndpoint.setHover(false);bj.endpoints[bv]=bo}aL[bk.id]=bj;bo.addConnection(bj);J(au,bk.id,bo);aS.currentlyDragging=true};var a1=l.CurrentLibrary,bm=bq.dragOptions||{},bh=l.extend({},a1.defaultDragOptions),bi=a1.dragEvents.start,bp=a1.dragEvents.stop,a9=a1.dragEvents.drag;bm=l.extend(bh,bm);bm.scope=bm.scope||bg.scope;bm[bi]=Y(bm[bi],a5);bm[a9]=Y(bm[a9],aZ);bm[bp]=Y(bm[bp],function(){aS.currentlyDragging=false;R(au,bk.id,bo);ax([bk.element[0],bo.canvas],bf);ad(a4.canvas,bf);aS.anchorManager.clearFor(bk.id);var bs=bj.floatingAnchorIndex==null?1:bj.floatingAnchorIndex;bj.endpoints[bs==0?1:0].anchor.locked=false;if(bj.endpoints[bs]==bo){if(a0&&bj.suspendedEndpoint){if(bs==0){bj.source=a3[0];bj.sourceId=a3[1]}else{bj.target=a3[0];bj.targetId=a3[1]}l.CurrentLibrary.setDragScope(a3[2],a3[3]);bj.endpoints[bs]=bj.suspendedEndpoint;if(bg.isReattach||bj._forceDetach||!bj.endpoints[bs==0?1:0].detach(bj)){bj.setHover(false);bj.floatingAnchorIndex=null;bj.suspendedEndpoint.addConnection(bj);l.repaint(a3[1])}bj._forceDetach=null}else{ax(bj.connector.getDisplayElements(),bg.parent);bg.detachFromConnection(bj)}}bg.anchor.locked=false;bg.paint({recalc:false});bj.setHover(false,false);bj=null;a4=null;delete au[bo.elementId];bo.anchor=null;bo=null;aS.currentlyDragging=false});var bn=x(bg.canvas);l.CurrentLibrary.initDraggable(bn,bm,true)}var a6=function(bw,bz,bu){if((bq.isTarget||bz)&&l.CurrentLibrary.isDropSupported(bf)){var bs=bq.dropOptions||aS.Defaults.DropOptions||l.Defaults.DropOptions;bs=l.extend({},bs);bs.scope=bs.scope||bg.scope;var bx=l.CurrentLibrary.dragEvents.drop,by=l.CurrentLibrary.dragEvents.over,bt=l.CurrentLibrary.dragEvents.out,bv=function(){var bJ=x(l.CurrentLibrary.getDragObject(arguments)),bA=c(bJ,"dragId"),bC=c(bJ,"elId"),bI=c(bJ,"originalScope"),bF=aL[bA],bG=bF.floatingAnchorIndex==null?1:bF.floatingAnchorIndex,bH=bG==0?1:0;if(bI){l.CurrentLibrary.setDragScope(bJ,bI)}if(!bg.isFull()&&!(bG==0&&!bg.isSource)&&!(bG==1&&!bg.isTarget)){var bD=true;if(bF.suspendedEndpoint&&bF.suspendedEndpoint.id!=bg.id){if(!bF.isDetachAllowed(bF)||!bF.endpoints[bG].isDetachAllowed(bF)||!bF.suspendedEndpoint.isDetachAllowed(bF)||!aS.checkCondition("beforeDetach",bF)){bD=false}}if(bG==0){bF.source=bf;bF.sourceId=a7}else{bF.target=bf;bF.targetId=a7}bD=bD&&bg.isDropAllowed(bF.sourceId,bF.targetId,bF.scope);if(bD){bF.endpoints[bG].detachFromConnection(bF);if(bF.suspendedEndpoint){bF.suspendedEndpoint.detachFromConnection(bF)}bF.endpoints[bG]=bg;bg.addConnection(bF);if(!bF.suspendedEndpoint){aH(bf,bq.draggable,{})}else{var bE=bF.suspendedEndpoint.getElement(),bB=bF.suspendedEndpoint.elementId;aE({source:bG==0?bE:bF.source,target:bG==1?bE:bF.target,sourceId:bG==0?bB:bF.sourceId,targetId:bG==1?bB:bF.targetId,sourceEndpoint:bG==0?bF.suspendedEndpoint:bF.endpoints[0],targetEndpoint:bG==1?bF.suspendedEndpoint:bF.endpoints[1],connection:bF},true)}aX(bF)}else{if(bF.suspendedEndpoint){bF.endpoints[bG]=bF.suspendedEndpoint;bF.setHover(false);bF._forceDetach=true;if(bG==0){bF.source=bF.suspendedEndpoint.element;bF.sourceId=bF.suspendedEndpoint.elementId}else{bF.target=bF.suspendedEndpoint.element;bF.targetId=bF.suspendedEndpoint.elementId}bF.suspendedEndpoint.addConnection(bF);bF.endpoints[0].repaint();bF.repaint();l.repaint(bF.source.elementId);bF._forceDetach=false}}bF.floatingAnchorIndex=null}aS.currentlyDragging=false;delete aL[bA]};bs[bx]=Y(bs[bx],bv);bs[by]=Y(bs[by],function(){var bB=l.CurrentLibrary.getDragObject(arguments),bD=c(x(bB),"dragId"),bC=aL[bD];if(bC!=null){var bA=bC.floatingAnchorIndex==null?1:bC.floatingAnchorIndex;bC.endpoints[bA].anchor.over(bg.anchor)}});bs[bt]=Y(bs[bt],function(){var bB=l.CurrentLibrary.getDragObject(arguments),bD=c(x(bB),"dragId"),bC=aL[bD];if(bC!=null){var bA=bC.floatingAnchorIndex==null?1:bC.floatingAnchorIndex;bC.endpoints[bA].anchor.out()}});l.CurrentLibrary.initDroppable(bw,bs,true,bu)}};a6(x(bg.canvas),true,!(bq._transient||bg.anchor.isFloating));return bg}};var l=window.jsPlumb=new s();l.getInstance=function(B){var A=new s(B);A.init();return A};l.util={convertStyle:function(B,A){if("transparent"===B){return B}var G=B,F=function(H){return H.length==1?"0"+H:H},C=function(H){return F(Number(H).toString(16))},D=/(rgb[a]?\()(.*)(\))/;if(B.match(D)){var E=B.match(D)[2].split(",");G="#"+C(E[0])+C(E[1])+C(E[2]);if(!A&&E.length==4){G=G+C(E[3])}}return G},gradient:function(B,A){B=B.constructor==Array?B:[B.x,B.y];A=A.constructor==Array?A:[A.x,A.y];return(A[1]-B[1])/(A[0]-B[0])},normal:function(B,A){return -1/l.util.gradient(B,A)},segment:function(B,A){B=B.constructor==Array?B:[B.x,B.y];A=A.constructor==Array?A:[A.x,A.y];if(A[0]>B[0]){return(A[1]>B[1])?2:1}else{return(A[1]>B[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(A,E,B){var D=l.util.gradient(A,E),I=l.util.segment(A,E),H=B>0?l.util.segmentMultipliers[I]:l.util.inverseSegmentMultipliers[I],C=Math.atan(D),F=Math.abs(B*Math.sin(C))*H[1],G=Math.abs(B*Math.cos(C))*H[0];return{x:A.x+G,y:A.y+F}},perpendicularLineTo:function(C,D,E){var B=l.util.gradient(C,D),F=Math.atan(-1/B),G=E/2*Math.sin(F),A=E/2*Math.cos(F);return[{x:D.x+A,y:D.y+G},{x:D.x-A,y:D.y-G}]}};var o=function(A,F,C,B,E,D){return function(H){H=H||{};var G=l.makeAnchor([A,F,C,B,0,0],H.elementId,H.jsPlumbInstance);G.type=E;if(D){D(G,H)}return G}};l.Anchors.TopCenter=o(0.5,0,0,-1,"TopCenter");l.Anchors.BottomCenter=o(0.5,1,0,1,"BottomCenter");l.Anchors.LeftMiddle=o(0,0.5,-1,0,"LeftMiddle");l.Anchors.RightMiddle=o(1,0.5,1,0,"RightMiddle");l.Anchors.Center=o(0.5,0.5,0,0,"Center");l.Anchors.TopRight=o(1,0,0,-1,"TopRight");l.Anchors.BottomRight=o(1,1,0,1,"BottomRight");l.Anchors.TopLeft=o(0,0,0,-1,"TopLeft");l.Anchors.BottomLeft=o(0,1,0,1,"BottomLeft");l.Defaults.DynamicAnchors=function(A){return l.makeAnchors(["TopCenter","RightMiddle","BottomCenter","LeftMiddle"],A.elementId,A.jsPlumbInstance)};l.Anchors.AutoDefault=function(B){var A=l.makeDynamicAnchor(l.Defaults.DynamicAnchors(B));A.type="AutoDefault";return A};l.Anchors.Assign=o(0,0,0,0,"Assign",function(B,C){var A=C.position||"Fixed";B.positionFinder=A.constructor==String?l.AnchorPositionFinders[A]:A;B.constructorParams=C});l.Anchors.Continuous=function(A){return A.jsPlumbInstance.continuousAnchorFactory.get(A)};l.AnchorPositionFinders={Fixed:function(D,B,C,A){return[(D.left-B.left)/C[0],(D.top-B.top)/C[1]]},Grid:function(A,J,E,B){var I=A.left-J.left,H=A.top-J.top,G=E[0]/(B.constructorParams.grid[0]),F=E[1]/(B.constructorParams.grid[1]),D=Math.floor(I/G),C=Math.floor(H/F);return[((D*G)+(G/2))/E[0],((C*F)+(F/2))/E[1]]}}})();(function(){jsPlumb.DOMElementComponent=function(b){jsPlumb.jsPlumbUIComponent.apply(this,arguments);this.mousemove=this.dblclick=this.click=this.mousedown=this.mouseup=function(c){}};jsPlumb.Connectors.Straight=function(){this.type="Straight";var q=this,h=null,d,i,o,m,k,e,p,g,f,c,b,n,l;this.compute=function(z,I,r,v,E,s,C,u){var H=Math.abs(z[0]-I[0]),B=Math.abs(z[1]-I[1]),A=0.45*H,t=0.45*B;H*=1.9;B*=1.9;var F=Math.min(z[0],I[0])-A;var D=Math.min(z[1],I[1])-t;var G=Math.max(2*C,u);if(H<G){H=G;F=z[0]+((I[0]-z[0])/2)-(G/2);A=(H-Math.abs(z[0]-I[0]))/2}if(B<G){B=G;D=z[1]+((I[1]-z[1])/2)-(G/2);t=(B-Math.abs(z[1]-I[1]))/2}g=z[0]<I[0]?A:H-A;f=z[1]<I[1]?t:B-t;c=z[0]<I[0]?H-A:A;b=z[1]<I[1]?B-t:t;h=[F,D,H,B,g,f,c,b];m=c-g,k=b-f;d=jsPlumb.util.gradient({x:g,y:f},{x:c,y:b}),i=-1/d;o=-1*((d*g)-f);e=Math.atan(d);p=Math.atan(i);l=Math.sqrt((m*m)+(k*k));return h};this.pointOnPath=function(r){if(r==0){return{x:g,y:f}}else{if(r==1){return{x:c,y:b}}else{return jsPlumb.util.pointOnLine({x:g,y:f},{x:c,y:b},r*l)}}};this.gradientAtPoint=function(r){return d};this.pointAlongPathFrom=function(r,t){var s=q.pointOnPath(r);return jsPlumb.util.pointOnLine(s,{x:c,y:b},t)}};jsPlumb.Connectors.Bezier=function(f){var p=this;f=f||{};this.majorAnchor=f.curviness||150;this.minorAnchor=10;var i=null;this.type="Bezier";this._findControlPoint=function(B,q,w,r,u,z,s){var y=z.getOrientation(r),A=s.getOrientation(u),v=y[0]!=A[0]||y[1]==A[1],t=[],C=p.majorAnchor,x=p.minorAnchor;if(!v){if(y[0]==0){t.push(q[0]<w[0]?B[0]+x:B[0]-x)}else{t.push(B[0]-(C*y[0]))}if(y[1]==0){t.push(q[1]<w[1]?B[1]+x:B[1]-x)}else{t.push(B[1]+(C*A[1]))}}else{if(A[0]==0){t.push(w[0]<q[0]?B[0]+x:B[0]-x)}else{t.push(B[0]+(C*A[0]))}if(A[1]==0){t.push(w[1]<q[1]?B[1]+x:B[1]-x)}else{t.push(B[1]+(C*y[1]))}}return t};var o,n,k,c,b,k,g,e,d,m,h;this.compute=function(M,t,G,u,K,r,q,F){q=q||0;m=Math.abs(M[0]-t[0])+q;h=Math.abs(M[1]-t[1])+q;e=Math.min(M[0],t[0])-(q/2);d=Math.min(M[1],t[1])-(q/2);k=M[0]<t[0]?m-(q/2):(q/2);g=M[1]<t[1]?h-(q/2):(q/2);c=M[0]<t[0]?(q/2):m-(q/2);b=M[1]<t[1]?(q/2):h-(q/2);o=p._findControlPoint([k,g],M,t,G,u,K,r);n=p._findControlPoint([c,b],t,M,G,u,r,K);var E=Math.min(k,c),D=Math.min(o[0],n[0]),z=Math.min(E,D),L=Math.max(k,c),I=Math.max(o[0],n[0]),w=Math.max(L,I);if(w>m){m=w}if(z<0){e+=z;var B=Math.abs(z);m+=B;o[0]+=B;k+=B;c+=B;n[0]+=B}var J=Math.min(g,b),H=Math.min(o[1],n[1]),v=Math.min(J,H),A=Math.max(g,b),y=Math.max(o[1],n[1]),s=Math.max(A,y);if(s>h){h=s}if(v<0){d+=v;var x=Math.abs(v);h+=x;o[1]+=x;g+=x;b+=x;n[1]+=x}if(F&&m<F){var C=(F-m)/2;m=F;e-=C;k=k+C;c=c+C;o[0]=o[0]+C;n[0]=n[0]+C}if(F&&h<F){var C=(F-h)/2;h=F;d-=C;g=g+C;b=b+C;o[1]=o[1]+C;n[1]=n[1]+C}i=[e,d,m,h,k,g,c,b,o[0],o[1],n[0],n[1]];return i};var l=function(){return[{x:k,y:g},{x:o[0],y:o[1]},{x:n[0],y:n[1]},{x:c,y:b}]};this.pointOnPath=function(q){return jsBezier.pointOnCurve(l(),q)};this.gradientAtPoint=function(q){return jsBezier.gradientAtPoint(l(),q)};this.pointAlongPathFrom=function(q,r){return jsBezier.pointAlongCurveFrom(l(),q,r)}};jsPlumb.Connectors.Flowchart=function(g){this.type="Flowchart";g=g||{};var o=this,c=g.stub||g.minStubLength||30,i=[],n=0,l=[],b=[],m=[],e,d,h=function(r,q,v,u){var t=0;for(var s=0;s<i.length;s++){b[s]=i[s][5]/n;l[s]=[t,(t+=(i[s][5]/n))]}},p=function(){m.push(i.length);for(var q=0;q<i.length;q++){m.push(i[q][0]);m.push(i[q][1])}},f=function(B,w,A,z,v,u){var r=i.length==0?A:i[i.length-1][0],q=i.length==0?z:i[i.length-1][1],s=B==r?Infinity:0,t=Math.abs(B==r?w-q:B-r);i.push([B,w,r,q,s,t]);n+=t},k=function(s){var q=l.length-1,r=0;for(var t=0;t<l.length;t++){if(l[t][1]>=s){q=t;r=(s-l[t][0])/b[t];break}}return{segment:i[q],proportion:r,index:q}};this.compute=function(T,v,L,z,S,r,q,I){i=[];n=0;b=[];e=v[0]<T[0];d=v[1]<T[1];var A=q||1,u=(A/2)+(c*2),s=(A/2)+(c*2),P=S.orientation||S.getOrientation(L),t=r.orientation||r.getOrientation(z),G=e?v[0]:T[0],F=d?v[1]:T[1],H=Math.abs(v[0]-T[0])+2*u,O=Math.abs(v[1]-T[1])+2*s;if(H<I){u+=(I-H)/2;H=I}if(O<I){s+=(I-O)/2;O=I}var K=e?H-u:u,J=d?O-s:s,V=e?u:H-u,U=d?s:O-s,E=K+(P[0]*c),D=J+(P[1]*c),C=V+(t[0]*c),B=U+(t[1]*c),Q=E+((C-E)/2),N=D+((B-D)/2);G-=u;F-=s;m=[G,F,H,O,K,J,V,U];var M=[];f(E,D,K,J,V,U);if(P[0]==0){var R=D<B;if(R){f(E,N,K,J,V,U);f(Q,N,K,J,V,U);f(C,N,K,J,V,U)}else{f(Q,D,K,J,V,U);f(Q,B,K,J,V,U)}}else{var R=E<C;if(R){f(Q,D,K,J,V,U);f(Q,N,K,J,V,U);f(Q,B,K,J,V,U)}else{f(E,N,K,J,V,U);f(C,N,K,J,V,U)}}f(C,B,K,J,V,U);f(V,U,K,J,V,U);p();h(K,J,V,U);return m};this.pointOnPath=function(q){return o.pointAlongPathFrom(q,0)};this.gradientAtPoint=function(q){return i[k(q)["index"]][4]};this.pointAlongPathFrom=function(u,y){var v=k(u),t=v.segment,x=v.proportion,r=i[v.index][5],q=i[v.index][4];var w={x:q==Infinity?t[2]:t[2]>t[0]?t[0]+((1-x)*r)-y:t[2]+(x*r)+y,y:q==0?t[3]:t[3]>t[1]?t[1]+((1-x)*r)-y:t[3]+(x*r)+y,segmentInfo:v};return w}};jsPlumb.Endpoints.Dot=function(c){this.type="Dot";var b=this;c=c||{};this.radius=c.radius||10;this.defaultOffset=0.5*this.radius;this.defaultInnerRadius=this.radius/3;this.compute=function(h,e,k,g){var f=k.radius||b.radius,d=h[0]-f,i=h[1]-f;return[d,i,f*2,f*2,f]}};jsPlumb.Endpoints.Rectangle=function(c){this.type="Rectangle";var b=this;c=c||{};this.width=c.width||20;this.height=c.height||20;this.compute=function(i,f,l,h){var g=l.width||b.width,e=l.height||b.height,d=i[0]-(g/2),k=i[1]-(e/2);return[d,k,g,e]}};jsPlumb.Endpoints.Image=function(f){this.type="Image";jsPlumb.DOMElementComponent.apply(this,arguments);var k=this,e=false,d=f.width,c=f.height,h=null,b=f.endpoint;this.img=new Image();k.ready=false;this.img.onload=function(){k.ready=true;d=d||k.img.width;c=c||k.img.height;if(h){h(this)}};b.setImage=function(l,n){var m=l.constructor==String?l:l.src;h=n;k.img.src=l};b.setImage(f.src||f.url,f.onload);this.compute=function(n,l,o,m){k.anchorPoint=n;if(k.ready){return[n[0]-d/2,n[1]-c/2,d,c]}else{return[0,0,0,0]}};k.canvas=document.createElement("img"),e=false;k.canvas.style.margin=0;k.canvas.style.padding=0;k.canvas.style.outline=0;k.canvas.style.position="absolute";var g=f.cssClass?" "+f.cssClass:"";k.canvas.className=jsPlumb.endpointClass+g;if(d){k.canvas.setAttribute("width",d)}if(c){k.canvas.setAttribute("height",c)}jsPlumb.appendElement(k.canvas,f.parent);k.attachListeners(k.canvas,k);var i=function(o,n,m){if(!e){k.canvas.setAttribute("src",k.img.src);e=true}var l=k.anchorPoint[0]-(d/2),p=k.anchorPoint[1]-(c/2);jsPlumb.sizeCanvas(k.canvas,l,p,d,c)};this.paint=function(n,m,l){if(k.ready){i(n,m,l)}else{window.setTimeout(function(){k.paint(n,m,l)},200)}}};jsPlumb.Endpoints.Blank=function(c){var b=this;this.type="Blank";jsPlumb.DOMElementComponent.apply(this,arguments);this.compute=function(f,d,g,e){return[f[0],f[1],10,0]};b.canvas=document.createElement("div");b.canvas.style.display="block";b.canvas.style.width="1px";b.canvas.style.height="1px";b.canvas.style.background="transparent";b.canvas.style.position="absolute";b.canvas.className=b._jsPlumb.endpointClass;jsPlumb.appendElement(b.canvas,c.parent);this.paint=function(g,f,e){jsPlumb.sizeCanvas(b.canvas,g[0],g[1],g[2],g[3])}};jsPlumb.Endpoints.Triangle=function(b){this.type="Triangle";b=b||{};b.width=b.width||55;b.height=b.height||55;this.width=b.width;this.height=b.height;this.compute=function(h,e,k,g){var f=k.width||self.width,d=k.height||self.height,c=h[0]-(f/2),i=h[1]-(d/2);return[c,i,f,d]}};var a=function(d){var c=true,b=this;this.isAppendedAtTopLevel=true;this.connection=d.connection;this.loc=d.location==null?0.5:d.location;this.setVisible=function(e){c=e;b.connection.repaint()};this.isVisible=function(){return c};this.hide=function(){b.setVisible(false)};this.show=function(){b.setVisible(true)};this.incrementLocation=function(e){b.loc+=e;b.connection.repaint()};this.setLocation=function(e){b.loc=e;b.connection.repaint()};this.getLocation=function(){return b.loc}};jsPlumb.Overlays.Arrow=function(f){this.type="Arrow";a.apply(this,arguments);this.isAppendedAtTopLevel=false;f=f||{};var c=this;this.length=f.length||20;this.width=f.width||20;this.id=f.id;var e=(f.direction||1)<0?-1:1,d=f.paintStyle||{lineWidth:1},b=f.foldback||0.623;this.computeMaxSize=function(){return c.width*1.5};this.cleanup=function(){};this.draw=function(h,w,r){var l,s,g,m,k;if(c.loc==1){l=h.pointOnPath(c.loc);s=h.pointAlongPathFrom(c.loc,-1);g=jsPlumb.util.pointOnLine(l,s,c.length)}else{if(c.loc==0){g=h.pointOnPath(c.loc);s=h.pointAlongPathFrom(c.loc,1);l=jsPlumb.util.pointOnLine(g,s,c.length)}else{l=h.pointAlongPathFrom(c.loc,e*c.length/2),s=h.pointOnPath(c.loc),g=jsPlumb.util.pointOnLine(l,s,c.length)}}m=jsPlumb.util.perpendicularLineTo(l,g,c.width);k=jsPlumb.util.pointOnLine(l,g,b*c.length);var v=Math.min(l.x,m[0].x,m[1].x),p=Math.max(l.x,m[0].x,m[1].x),u=Math.min(l.y,m[0].y,m[1].y),o=Math.max(l.y,m[0].y,m[1].y);var n={hxy:l,tail:m,cxy:k},q=d.strokeStyle||w.strokeStyle,t=d.fillStyle||w.strokeStyle,i=d.lineWidth||w.lineWidth;c.paint(h,n,i,q,t,r);return[v,p,u,o]}};jsPlumb.Overlays.PlainArrow=function(c){c=c||{};var b=jsPlumb.extend(c,{foldback:1});jsPlumb.Overlays.Arrow.call(this,b);this.type="PlainArrow"};jsPlumb.Overlays.Diamond=function(d){d=d||{};var b=d.length||40,c=jsPlumb.extend(d,{length:b/2,foldback:2});jsPlumb.Overlays.Arrow.call(this,c);this.type="Diamond"};jsPlumb.Overlays.Label=function(h){this.type="Label";jsPlumb.DOMElementComponent.apply(this,arguments);a.apply(this,arguments);this.labelStyle=h.labelStyle||jsPlumb.Defaults.LabelStyle;this.id=h.id;this.cachedDimensions=null;var d=h.label||"",b=this,e=false,i=document.createElement("div"),f=null;i.style.position="absolute";var c=h._jsPlumb.overlayClass+" "+(b.labelStyle.cssClass?b.labelStyle.cssClass:h.cssClass?h.cssClass:"");i.className=c;jsPlumb.appendElement(i,h.connection.parent);jsPlumb.getId(i);b.attachListeners(i,b);b.canvas=i;var g=b.setVisible;b.setVisible=function(k){g(k);i.style.display=k?"block":"none"};this.getElement=function(){return i};this.cleanup=function(){if(i!=null){jsPlumb.CurrentLibrary.removeElement(i)}};this.setLabel=function(k){d=k;f=null;b.connection.repaint()};this.getLabel=function(){return d};this.paint=function(k,m,l){if(!e){k.appendDisplayElement(i);b.attachListeners(i,k);e=true}i.style.left=(l[0]+m.minx)+"px";i.style.top=(l[1]+m.miny)+"px"};this.getTextDimensions=function(l){if(typeof d=="function"){var k=d(b);i.innerHTML=k.replace(/\r\n/g,"<br/>")}else{if(f==null){f=d;i.innerHTML=f.replace(/\r\n/g,"<br/>")}}var n=jsPlumb.CurrentLibrary.getElementObject(i),m=jsPlumb.CurrentLibrary.getSize(n);return{width:m[0],height:m[1]}};this.computeMaxSize=function(k){var l=b.getTextDimensions(k);return l.width?Math.max(l.width,l.height)*1.5:0};this.draw=function(m,o,n){var q=b.getTextDimensions(m);if(q.width!=null){var p=m.pointOnPath(b.loc),l=p.x-(q.width/2),k=p.y-(q.height/2);b.paint(m,{minx:l,miny:k,td:q,cxy:p},n);return[l,l+q.width,k,k+q.height]}else{return[0,0,0,0]}};this.reattachListeners=function(){if(i){b.reattachListenersForElement(i,b)}}};jsPlumb.Overlays.GuideLines=function(){var b=this;b.length=50;b.lineWidth=5;this.type="GuideLines";a.apply(this,arguments);jsPlumb.jsPlumbUIComponent.apply(this,arguments);this.draw=function(d,k,i){var h=d.pointAlongPathFrom(b.loc,b.length/2),g=d.pointOnPath(b.loc),f=jsPlumb.util.pointOnLine(h,g,b.length),e=jsPlumb.util.perpendicularLineTo(h,f,40),c=jsPlumb.util.perpendicularLineTo(f,h,20);b.paint(d,[h,f,e,c],b.lineWidth,"red",null,i);return[Math.min(h.x,f.x),Math.min(h.y,f.y),Math.max(h.x,f.x),Math.max(h.y,f.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 h={"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.namespaces.add("jsplumb","urn:schemas-microsoft-com:vml")}jsPlumb.vml={};var b=1000,c=function(p,q){for(var n in q){p[n]=q[n]}},m=function(n,q,r){r=r||{};var p=document.createElement("jsplumb:"+n);p.className=(r["class"]?r["class"]+" ":"")+"jsplumb_vml";l(p,q);c(p,r);return p},l=function(p,n){p.style.left=n[0]+"px";p.style.top=n[1]+"px";p.style.width=n[2]+"px";p.style.height=n[3]+"px";p.style.position="absolute"},g=jsPlumb.vml.convertValue=function(n){return Math.floor(n*b)},d=function(q,o,p,n){if("transparent"===o){n.setOpacity(p,"0.0")}else{n.setOpacity(p,"1.0")}},f=function(r,n,u){var q={};if(n.strokeStyle){q.stroked="true";var v=jsPlumb.util.convertStyle(n.strokeStyle,true);q.strokecolor=v;d(q,v,"stroke",u);q.strokeweight=n.lineWidth+"px"}else{q.stroked="false"}if(n.fillStyle){q.filled="true";var o=jsPlumb.util.convertStyle(n.fillStyle,true);q.fillcolor=o;d(q,o,"fill",u)}else{q.filled="false"}if(n.dashstyle){if(u.strokeNode==null){u.strokeNode=m("stroke",[0,0,0,0],{dashstyle:n.dashstyle});r.appendChild(u.strokeNode)}else{u.strokeNode.dashstyle=n.dashstyle}}else{if(n["stroke-dasharray"]&&n.lineWidth){var w=n["stroke-dasharray"].indexOf(",")==-1?" ":",",s=n["stroke-dasharray"].split(w),p="";for(var t=0;t<s.length;t++){p+=(Math.floor(s[t]/n.lineWidth)+w)}if(u.strokeNode==null){u.strokeNode=m("stroke",[0,0,0,0],{dashstyle:p});r.appendChild(u.strokeNode)}else{u.strokeNode.dashstyle=p}}}c(r,q)},i=function(){var n=this;jsPlumb.jsPlumbUIComponent.apply(this,arguments);this.opacityNodes={stroke:null,fill:null};this.initOpacityNodes=function(o){n.opacityNodes.stroke=m("stroke",[0,0,1,1],{opacity:"0.0"});n.opacityNodes.fill=m("fill",[0,0,1,1],{opacity:"0.0"});o.appendChild(n.opacityNodes.stroke);o.appendChild(n.opacityNodes.fill)};this.setOpacity=function(o,q){var p=n.opacityNodes[o];if(p){p.opacity=""+q}}},e=jsPlumb.VmlConnector=function(q){var n=this;n.strokeNode=null;n.canvas=null;i.apply(this,arguments);var p=n._jsPlumb.connectorClass+(q.cssClass?(" "+q.cssClass):"");this.paint=function(v,s,u){if(s!=null){var z=n.getPath(v),t={path:z};if(s.outlineColor){var x=s.outlineWidth||1,y=s.lineWidth+(2*x),w={strokeStyle:jsPlumb.util.convertStyle(s.outlineColor),lineWidth:y};for(var r in h){w[r]=s[r]}if(n.bgCanvas==null){t["class"]=p;t.coordsize=(v[2]*b)+","+(v[3]*b);n.bgCanvas=m("shape",v,t);jsPlumb.appendElement(n.bgCanvas,q.parent);l(n.bgCanvas,v);o.push(n.bgCanvas)}else{t.coordsize=(v[2]*b)+","+(v[3]*b);l(n.bgCanvas,v);c(n.bgCanvas,t)}f(n.bgCanvas,w,n)}if(n.canvas==null){t["class"]=p;t.coordsize=(v[2]*b)+","+(v[3]*b);if(n.tooltip){t.label=n.tooltip}n.canvas=m("shape",v,t);jsPlumb.appendElement(n.canvas,q.parent);o.push(n.canvas);n.attachListeners(n.canvas,n);n.initOpacityNodes(n.canvas,["stroke"])}else{t.coordsize=(v[2]*b)+","+(v[3]*b);l(n.canvas,v);c(n.canvas,t)}f(n.canvas,s,n)}};var o=[n.canvas];this.getDisplayElements=function(){return o};this.appendDisplayElement=function(r){n.canvas.parentNode.appendChild(r);o.push(r)};this.reattachListeners=function(){if(n.canvas){n.reattachListenersForElement(n.canvas,n)}}},k=function(r){i.apply(this,arguments);var n=null,p=this,o=null,q=null;p.canvas=document.createElement("div");p.canvas.style.position="absolute";jsPlumb.appendElement(p.canvas,r.parent);if(p.tooltip){p.canvas.setAttribute("label",p.tooltip)}this.paint=function(v,t,s){var u={};jsPlumb.sizeCanvas(p.canvas,v[0],v[1],v[2],v[3]);if(n==null){u["class"]=jsPlumb.endpointClass;n=p.getVml([0,0,v[2],v[3]],u,s);p.canvas.appendChild(n);p.attachListeners(n,p);p.initOpacityNodes(n,["fill"])}else{l(n,[0,0,v[2],v[3]]);c(n,u)}f(n,t,p)};this.reattachListeners=function(){if(n){p.reattachListenersForElement(n,p)}}};jsPlumb.Connectors.vml.Bezier=function(){jsPlumb.Connectors.Bezier.apply(this,arguments);e.apply(this,arguments);this.getPath=function(n){return"m"+g(n[4])+","+g(n[5])+" c"+g(n[8])+","+g(n[9])+","+g(n[10])+","+g(n[11])+","+g(n[6])+","+g(n[7])+" e"}};jsPlumb.Connectors.vml.Straight=function(){jsPlumb.Connectors.Straight.apply(this,arguments);e.apply(this,arguments);this.getPath=function(n){return"m"+g(n[4])+","+g(n[5])+" l"+g(n[6])+","+g(n[7])+" e"}};jsPlumb.Connectors.vml.Flowchart=function(){jsPlumb.Connectors.Flowchart.apply(this,arguments);e.apply(this,arguments);this.getPath=function(o){var q="m "+g(o[4])+","+g(o[5])+" l";for(var n=0;n<o[8];n++){q=q+" "+g(o[9+(n*2)])+","+g(o[10+(n*2)])}q=q+" "+g(o[6])+","+g(o[7])+" e";return q}};jsPlumb.Endpoints.vml.Dot=function(){jsPlumb.Endpoints.Dot.apply(this,arguments);k.apply(this,arguments);this.getVml=function(o,p,n){return m("oval",o,p)}};jsPlumb.Endpoints.vml.Rectangle=function(){jsPlumb.Endpoints.Rectangle.apply(this,arguments);k.apply(this,arguments);this.getVml=function(o,p,n){return m("rect",o,p)}};jsPlumb.Endpoints.vml.Image=jsPlumb.Endpoints.Image;jsPlumb.Endpoints.vml.Blank=jsPlumb.Endpoints.Blank;jsPlumb.Overlays.vml.Label=jsPlumb.Overlays.Label;var a=function(r,p){r.apply(this,p);i.apply(this,arguments);var o=this,q=null;o.canvas=null;var n=function(t,s){return"m "+g(t.hxy.x)+","+g(t.hxy.y)+" l "+g(t.tail[0].x)+","+g(t.tail[0].y)+" "+g(t.cxy.x)+","+g(t.cxy.y)+" "+g(t.tail[1].x)+","+g(t.tail[1].y)+" x e"};this.paint=function(v,B,A,C,G,F){var t={};if(C){t.stroked="true";t.strokecolor=jsPlumb.util.convertStyle(C,true)}if(A){t.strokeweight=A+"px"}if(G){t.filled="true";t.fillcolor=G}var s=Math.min(B.hxy.x,B.tail[0].x,B.tail[1].x,B.cxy.x),E=Math.min(B.hxy.y,B.tail[0].y,B.tail[1].y,B.cxy.y),x=Math.max(B.hxy.x,B.tail[0].x,B.tail[1].x,B.cxy.x),u=Math.max(B.hxy.y,B.tail[0].y,B.tail[1].y,B.cxy.y),D=Math.abs(x-s),z=Math.abs(u-E),y=[s,E,D,z];t.path=n(B,F);t.coordsize=(F[2]*b)+","+(F[3]*b);y[0]=F[0];y[1]=F[1];y[2]=F[2];y[3]=F[3];if(o.canvas==null){o.canvas=m("shape",y,t);v.appendDisplayElement(o.canvas);o.attachListeners(o.canvas,v)}else{l(o.canvas,y);c(o.canvas,t)}};this.reattachListeners=function(){if(o.canvas){o.reattachListenersForElement(o.canvas,o)}}};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.xmnls=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.label=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("label",D.tooltip)}}else{g(D.svg,{"class":F});D.canvas=D.svg}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}]);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(E){return"M "+E[4]+" "+E[5]+" C "+E[8]+" "+E[9]+" "+E[10]+" "+E[11]+" "+E[6]+" "+E[7]}};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}]);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(o,n){return jsPlumb.CurrentLibrary.hasClass(a(o),n)},a=function(n){return jsPlumb.CurrentLibrary.getElementObject(n)},l=function(n){return jsPlumb.CurrentLibrary.getOffset(a(n))},m=function(n){return jsPlumb.CurrentLibrary.getPageXY(n)},f=function(n){return jsPlumb.CurrentLibrary.getClientXY(n)};var k=function(){var p=this;p.overlayPlacements=[];jsPlumb.jsPlumbUIComponent.apply(this,arguments);jsPlumb.EventGenerator.apply(this,arguments);this._over=function(w){var A=l(a(p.canvas)),C=m(w),t=C[0]-A.left,B=C[1]-A.top;if(t>0&&B>0&&t<p.canvas.width&&B<p.canvas.height){for(var u=0;u<p.overlayPlacements.length;u++){var v=p.overlayPlacements[u];if(v&&(v[0]<=t&&v[1]>=t&&v[2]<=B&&v[3]>=B)){return true}}var z=p.canvas.getContext("2d").getImageData(parseInt(t),parseInt(B),1,1);return z.data[0]!=0||z.data[1]!=0||z.data[2]!=0||z.data[3]!=0}return false};var o=false,n=false,s=null,r=false,q=function(u,t){return u!=null&&i(u,t)};this.mousemove=function(w){var y=m(w),v=f(w),u=document.elementFromPoint(v[0],v[1]),x=q(u,"_jsPlumb_overlay");var t=d==null&&(q(u,"_jsPlumb_endpoint")||q(u,"_jsPlumb_connector"));if(!o&&t&&p._over(w)){o=true;p.fire("mouseenter",p,w);return true}else{if(o&&(!p._over(w)||!t)&&!x){o=false;p.fire("mouseexit",p,w)}}p.fire("mousemove",p,w)};this.click=function(t){if(o&&p._over(t)&&!r){p.fire("click",p,t)}r=false};this.dblclick=function(t){if(o&&p._over(t)&&!r){p.fire("dblclick",p,t)}r=false};this.mousedown=function(t){if(p._over(t)&&!n){n=true;s=l(a(p.canvas));p.fire("mousedown",p,t)}};this.mouseup=function(t){n=false;p.fire("mouseup",p,t)}};var c=function(o){var n=document.createElement("canvas");jsPlumb.appendElement(n,o.parent);n.style.position="absolute";if(o["class"]){n.className=o["class"]}o._jsPlumb.getId(n,o.uuid);if(o.tooltip){n.setAttribute("label",o.tooltip)}return n};var h=jsPlumb.CanvasConnector=function(r){k.apply(this,arguments);var n=function(v,t){o.ctx.save();jsPlumb.extend(o.ctx,t);if(t.gradient){var u=o.createGradient(v,o.ctx);for(var s=0;s<t.gradient.stops.length;s++){u.addColorStop(t.gradient.stops[s][0],t.gradient.stops[s][1])}o.ctx.strokeStyle=u}o._paint(v);o.ctx.restore()};var o=this,q=o._jsPlumb.connectorClass+" "+(r.cssClass||"");o.canvas=c({"class":q,_jsPlumb:o._jsPlumb,parent:r.parent,tooltip:r.tooltip});o.ctx=o.canvas.getContext("2d");var p=[o.canvas];this.getDisplayElements=function(){return p};this.appendDisplayElement=function(s){p.push(s)};o.paint=function(w,t){if(t!=null){jsPlumb.sizeCanvas(o.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};n(w,u)}n(w,t)}}};var b=function(q){var o=this;k.apply(this,arguments);var p=o._jsPlumb.endpointClass+" "+(q.cssClass||""),n={"class":p,_jsPlumb:o._jsPlumb,parent:q.parent,tooltip:o.tooltip};o.canvas=c(n);o.ctx=o.canvas.getContext("2d");this.paint=function(w,t,r){jsPlumb.sizeCanvas(o.canvas,w[0],w[1],w[2],w[3]);if(t.outlineColor!=null){var v=t.outlineWidth||1,s=t.lineWidth+(2*v);var u={strokeStyle:t.outlineColor,lineWidth:s}}o._paint.apply(this,arguments)}};jsPlumb.Endpoints.canvas.Dot=function(q){jsPlumb.Endpoints.Dot.apply(this,arguments);b.apply(this,arguments);var p=this,o=function(r){try{return parseInt(r)}catch(s){if(r.substring(r.length-1)=="%"){return parseInt(r.substring(0,r-1))}}},n=function(t){var r=p.defaultOffset,s=p.defaultInnerRadius;t.offset&&(r=o(t.offset));t.innerRadius&&(s=o(t.innerRadius));return[r,s]};this._paint=function(z,s,w){if(s!=null){var A=p.canvas.getContext("2d"),t=w.getOrientation(p);jsPlumb.extend(A,s);if(s.gradient){var u=n(s.gradient),x=t[1]==1?u[0]*-1:u[0],r=t[0]==1?u[0]*-1:u[0],y=A.createRadialGradient(z[4],z[4],z[4],z[4]+r,z[4]+x,u[1]);for(var v=0;v<s.gradient.stops.length;v++){y.addColorStop(s.gradient.stops[v][0],s.gradient.stops[v][1])}A.fillStyle=y}A.beginPath();A.arc(z[4],z[4],z[4],0,Math.PI*2,true);A.closePath();if(s.fillStyle||s.gradient){A.fill()}if(s.strokeStyle){A.stroke()}}}};jsPlumb.Endpoints.canvas.Rectangle=function(o){var n=this;jsPlumb.Endpoints.Rectangle.apply(this,arguments);b.apply(this,arguments);this._paint=function(w,q,u){var z=n.canvas.getContext("2d"),s=u.getOrientation(n);jsPlumb.extend(z,q);if(q.gradient){var y=s[1]==1?w[3]:s[1]==0?w[3]/2:0;var x=s[1]==-1?w[3]:s[1]==0?w[3]/2:0;var r=s[0]==1?w[2]:s[0]==0?w[2]/2:0;var p=s[0]==-1?w[2]:s[0]==0?w[2]/2:0;var v=z.createLinearGradient(r,y,p,x);for(var t=0;t<q.gradient.stops.length;t++){v.addColorStop(q.gradient.stops[t][0],q.gradient.stops[t][1])}z.fillStyle=v}z.beginPath();z.rect(0,0,w[2],w[3]);z.closePath();if(q.fillStyle||q.gradient){z.fill()}if(q.strokeStyle){z.stroke()}}};jsPlumb.Endpoints.canvas.Triangle=function(o){var n=this;jsPlumb.Endpoints.Triangle.apply(this,arguments);b.apply(this,arguments);this._paint=function(w,p,u){var r=w[2],B=w[3],A=w[0],z=w[1],C=n.canvas.getContext("2d"),v=0,t=0,s=0,q=u.getOrientation(n);if(q[0]==1){v=r;t=B;s=180}if(q[1]==-1){v=r;s=90}if(q[1]==1){t=B;s=-90}C.fillStyle=p.fillStyle;C.translate(v,t);C.rotate(s*Math.PI/180);C.beginPath();C.moveTo(0,0);C.lineTo(r/2,B/2);C.lineTo(0,B);C.closePath();if(p.fillStyle||p.gradient){C.fill()}if(p.strokeStyle){C.stroke()}}};jsPlumb.Endpoints.canvas.Image=jsPlumb.Endpoints.Image;jsPlumb.Endpoints.canvas.Blank=jsPlumb.Endpoints.Blank;jsPlumb.Connectors.canvas.Bezier=function(){var n=this;jsPlumb.Connectors.Bezier.apply(this,arguments);h.apply(this,arguments);this._paint=function(o){n.ctx.beginPath();n.ctx.moveTo(o[4],o[5]);n.ctx.bezierCurveTo(o[8],o[9],o[10],o[11],o[6],o[7]);n.ctx.stroke()};this.createGradient=function(q,o,p){return n.ctx.createLinearGradient(q[6],q[7],q[4],q[5])}};jsPlumb.Connectors.canvas.Straight=function(){var n=this;jsPlumb.Connectors.Straight.apply(this,arguments);h.apply(this,arguments);this._paint=function(o){n.ctx.beginPath();n.ctx.moveTo(o[4],o[5]);n.ctx.lineTo(o[6],o[7]);n.ctx.stroke()};this.createGradient=function(p,o){return o.createLinearGradient(p[4],p[5],p[6],p[7])}};jsPlumb.Connectors.canvas.Flowchart=function(){var n=this;jsPlumb.Connectors.Flowchart.apply(this,arguments);h.apply(this,arguments);this._paint=function(p){n.ctx.beginPath();n.ctx.moveTo(p[4],p[5]);for(var o=0;o<p[8];o++){n.ctx.lineTo(p[9+(o*2)],p[10+(o*2)])}n.ctx.lineTo(p[6],p[7]);n.ctx.stroke()};this.createGradient=function(p,o){return o.createLinearGradient(p[4],p[5],p[6],p[7])}};jsPlumb.Overlays.canvas.Label=jsPlumb.Overlays.Label;var g=function(){jsPlumb.jsPlumbUIComponent.apply(this,arguments)};var e=function(o,n){o.apply(this,n);g.apply(this,arguments);this.paint=function(r,t,p,u,s){var q=r.ctx;q.lineWidth=p;q.beginPath();q.moveTo(t.hxy.x,t.hxy.y);q.lineTo(t.tail[0].x,t.tail[0].y);q.lineTo(t.cxy.x,t.cxy.y);q.lineTo(t.tail[1].x,t.tail[1].y);q.lineTo(t.hxy.x,t.hxy.y);q.closePath();if(u){q.strokeStyle=u;q.stroke()}if(s){q.fillStyle=s;q.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(){var e=new Class({Extends:Fx.Morph,onStep:null,initialize:function(n,m){this.parent(n,m);if(m.onStep){this.onStep=m.onStep}},step:function(m){this.parent(m);if(this.onStep){try{this.onStep()}catch(n){}}}});var b={},k={},i={},l={},g={};var f=function(n,p,o){if(p){var q=p.get("id");if(q){var m=k[q];if(m){if(m[o]){m[o](n,p)}}}}};var h=function(n,p){if(n){var o=n.get("id");if(o){var m=k[o];if(m){if(m.hoverClass){if(p){n.addClass(m.hoverClass)}else{n.removeClass(m.hoverClass)}}}}}};var d=function(p,m,o){var n=p[m];if(!n){n=[];p[m]=n}n.push(o)};var a=function(m){return $(m)},c=function(m){};jsPlumb.CurrentLibrary={addClass:function(n,m){n=jsPlumb.CurrentLibrary.getElementObject(n);try{if(n.className.constructor==SVGAnimatedString){jsPlumb.util.svg.addClass(n,m)}else{n.addClass(m)}}catch(o){n.addClass(m)}},animate:function(q,p,o){var n=new e(q,o);n.start(p)},appendElement:function(n,m){a(m).grab(n)},bind:function(m,n,o){m=a(m);m.addEvent(n,o)},dragEvents:{start:"onStart",stop:"onComplete",drag:"onDrag",step:"onStep",over:"onEnter",out:"onLeave",drop:"onDrop",complete:"onComplete"},extend:function(n,m){return $extend(n,m)},getAttribute:function(m,n){return m.get(n)},getClientXY:function(m){return[m.event.clientX,m.event.clientY]},getDragObject:function(m){return m[0]},getDragScope:function(n){var o=jsPlumb.getId(n),m=l[o];return m[0].scope},getDropScope:function(m){var n=jsPlumb.getId(m);return g[n]},getElementObject:a,getOffset:function(m){var n=m.getPosition();return{left:n.x,top:n.y}},getPageXY:function(m){return[m.event.pageX,m.event.pageY]},getParent:function(m){return jsPlumb.CurrentLibrary.getElementObject(m).getParent()},getScrollLeft:function(m){return null},getScrollTop:function(m){return null},getSelector:function(m){return $$(m)},getSize:function(n){var m=n.getSize();return[m.x,m.y]},getTagName:function(m){var n=jsPlumb.CurrentLibrary.getElementObject(m);return n!=null?n.tagName:null},getUIPosition:function(m){var n=m[0],o=jsPlumb.CurrentLibrary.getElementObject(n).getPosition();return{left:o.x,top:o.y}},hasClass:function(n,m){return n.hasClass(m)},initDraggable:function(n,w,p){var m=jsPlumb.getId(n);var r=l[m];if(!r){var o=0,q=null,t=jsPlumb.Defaults.DragOptions.zIndex||2000;w.onStart=jsPlumb.wrap(w.onStart,function(){o=this.element.getStyle("z-index");this.element.setStyle("z-index",t);r.originalZIndex=o;if(jsPlumb.Defaults.DragOptions.cursor){q=this.element.getStyle("cursor");this.element.setStyle("cursor",jsPlumb.Defaults.DragOptions.cursor)}});w.onComplete=jsPlumb.wrap(w.onComplete,function(){this.element.setStyle("z-index",o);if(q){this.element.setStyle("cursor",q)}c(r)});var v=""+(w.scope||jsPlumb.Defaults.Scope),s=function(x){return x.get("id")!=n.get("id")},u=b[v]?b[v].filter(s):[];if(p){w.droppables=u;w.onLeave=jsPlumb.wrap(w.onLeave,function(x,y){if(y){h(y,false);f(x,y,"onLeave")}});w.onEnter=jsPlumb.wrap(w.onEnter,function(x,y){if(y){h(y,true);f(x,y,"onEnter")}});w.onDrop=function(x,y){if(y){h(y,false);f(x,y,"onDrop")}}}else{w.droppables=[]}r=new Drag.Move(n,w);r.scope=v;r.originalZIndex=o;d(l,n.get("id"),r);if(p){d(i,v,r)}if(w.disabled){r.detach()}}return r},initDroppable:function(n,u,o,s){var t=u.scope;d(b,t,n);var m=jsPlumb.getId(n);n.setAttribute("_isPermanentDroppable",s);k[m]=u;g[m]=t;var q=function(v){return v.element!=n},r=i[t]?i[t].filter(q):[];for(var p=0;p<r.length;p++){r[p].droppables.push(n)}},isAlreadyDraggable:function(m){return l[jsPlumb.getId(m)]!=null},isDragSupported:function(n,m){return typeof Drag!="undefined"},isDropSupported:function(n,m){return(typeof Drag!=undefined&&typeof Drag.Move!=undefined)},removeClass:function(n,m){n=jsPlumb.CurrentLibrary.getElementObject(n);try{if(n.className.constructor==SVGAnimatedString){jsPlumb.util.svg.removeClass(n,m)}else{n.removeClass(m)}}catch(o){n.removeClass(m)}},removeElement:function(m,o){var n=a(m);if(n){n.dispose()}},setAttribute:function(n,o,m){n.set(o,m)},setDraggable:function(o,n){var m=l[o.get("id")];if(m){m.each(function(p){if(n){p.attach()}else{p.detach()}})}},setDragScope:function(p,o){var n=l[p.get("id")];var q=function(r){return r.get("id")!=p.get("id")};var m=b[o]?b[o].filter(q):[];n[0].droppables=m},setOffset:function(m,n){a(m).setPosition({x:n.left,y:n.top})},stopDrag:function(){for(var n in l){for(var m=0;m<l[n].length;m++){var o=l[n][m];o.stop();if(o.originalZIndex!=0){o.element.setStyle("z-index",o.originalZIndex)}}}},trigger:function(n,o,m){m.stopPropagation();a(n).fireEvent(o,m)},unbind:function(m,n,o){m=a(m);m.removeEvent(n,o)}};window.addEvent("domready",jsPlumb.init)})();(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}]}}})();