!function(){"undefined"==typeof Math.sgn&&(Math.sgn=function(a){return 0==a?0:a>0?1:-1});var a={subtract:function(a,b){return{x:a.x-b.x,y:a.y-b.y}},dotProduct:function(a,b){return a.x*b.x+a.y*b.y},square:function(a){return Math.sqrt(a.x*a.x+a.y*a.y)},scale:function(a,b){return{x:a.x*b,y:a.y*b}}},b=64,c=Math.pow(2,-b-1),d=function(b,c){for(var d=[],e=f(b,c),h=c.length-1,i=2*h-1,j=g(e,i,d,0),k=a.subtract(b,c[0]),m=a.square(k),n=0,o=0;j>o;o++){k=a.subtract(b,l(c,h,d[o],null,null));var p=a.square(k);m>p&&(m=p,n=d[o])}return k=a.subtract(b,c[h]),p=a.square(k),m>p&&(m=p,n=1),{location:n,distance:m}},e=function(a,b){var c=d(a,b);return{point:l(b,b.length-1,c.location,null,null),location:c.location}},f=function(b,c){for(var d=c.length-1,e=2*d-1,f=[],g=[],h=[],i=[],k=[[1,.6,.3,.1],[.4,.6,.6,.4],[.1,.3,.6,1]],l=0;d>=l;l++)f[l]=a.subtract(c[l],b);for(var l=0;d-1>=l;l++)g[l]=a.subtract(c[l+1],c[l]),g[l]=a.scale(g[l],3);for(var m=0;d-1>=m;m++)for(var n=0;d>=n;n++)h[m]||(h[m]=[]),h[m][n]=a.dotProduct(g[m],f[n]);for(l=0;e>=l;l++)i[l]||(i[l]=[]),i[l].y=0,i[l].x=parseFloat(l)/e;for(var o=d,p=d-1,q=0;o+p>=q;q++){var r=Math.max(0,q-p),s=Math.min(q,o);for(l=r;s>=l;l++)j=q-l,i[l+j].y+=h[j][l]*k[j][l]}return i},g=function(a,c,d,e){var f,j,m=[],n=[],o=[],p=[];switch(h(a,c)){case 0:return 0;case 1:if(e>=b)return d[0]=(a[0].x+a[c].x)/2,1;if(i(a,c))return d[0]=k(a,c),1}l(a,c,.5,m,n),f=g(m,c,o,e+1),j=g(n,c,p,e+1);for(var q=0;f>q;q++)d[q]=o[q];for(var q=0;j>q;q++)d[q+f]=p[q];return f+j},h=function(a,b){var c,d,e=0;c=d=Math.sgn(a[0].y);for(var f=1;b>=f;f++)c=Math.sgn(a[f].y),c!=d&&e++,d=c;return e},i=function(a,b){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;i=a[0].y-a[b].y,j=a[b].x-a[0].x,k=a[0].x*a[b].y-a[b].x*a[0].y;for(var t=max_distance_below=0,u=1;b>u;u++){var v=i*a[u].x+j*a[u].y+k;v>t?t=v:max_distance_below>v&&(max_distance_below=v)}return n=0,o=1,p=0,q=i,r=j,s=k-t,l=n*r-q*o,m=1/l,e=(o*s-r*p)*m,q=i,r=j,s=k-max_distance_below,l=n*r-q*o,m=1/l,f=(o*s-r*p)*m,g=Math.min(e,f),h=Math.max(e,f),d=h-g,c>d?1:0},k=function(a,b){var c=1,d=0,e=a[b].x-a[0].x,f=a[b].y-a[0].y,g=a[0].x-0,h=a[0].y-0,i=e*d-f*c,j=1/i,k=(e*h-f*g)*j;return 0+c*k},l=function(a,b,c,d,e){for(var f=[[]],g=0;b>=g;g++)f[0][g]=a[g];for(var h=1;b>=h;h++)for(var g=0;b-h>=g;g++)f[h]||(f[h]=[]),f[h][g]||(f[h][g]={}),f[h][g].x=(1-c)*f[h-1][g].x+c*f[h-1][g+1].x,f[h][g].y=(1-c)*f[h-1][g].y+c*f[h-1][g+1].y;if(null!=d)for(g=0;b>=g;g++)d[g]=f[g][0];if(null!=e)for(g=0;b>=g;g++)e[g]=f[b-g][g];return f[b][0]},m={},n=function(a){var b=m[a];if(!b){b=[];var c=function(){return function(b){return Math.pow(b,a)}},d=function(){return function(b){return Math.pow(1-b,a)}},e=function(a){return function(){return a}},f=function(){return function(a){return a}},g=function(){return function(a){return 1-a}},h=function(a){return function(b){for(var c=1,d=0;di;i++){for(var j=[new e(a)],k=0;a-i>k;k++)j.push(new f);for(var k=0;i>k;k++)j.push(new g);b.push(new h(j))}b.push(new d),m[a]=b}return b},o=function(a,b){for(var c=n(a.length-1),d=0,e=0,f=0;f0?1:-1,h=null;ed;)d+=.005*e,f=o(a,d),c+=p(f,b),b=f;return c},t=function(a,b,c){return r(a,b,c).point},u=function(a,b,c){return r(a,b,c).location},v=function(a,b){var c=o(a,b),d=o(a.slice(0,a.length-1),b),e=d.y-c.y,f=d.x-c.x;return 0==e?1/0:Math.atan(e/f)},w=function(a,b,c){var d=r(a,b,c);return d.location>1&&(d.location=1),d.location<0&&(d.location=0),v(a,d.location)},x=function(a,b,c,d){d=null==d?0:d;var e=r(a,b,d),f=v(a,e.location),g=Math.atan(-1/f),h=c/2*Math.sin(g),i=c/2*Math.cos(g);return[{x:e.point.x+i,y:e.point.y+h},{x:e.point.x-i,y:e.point.y-h}]};window.jsBezier={distanceFromCurve:d,gradientAtPoint:v,gradientAtPointAlongCurveFrom:w,nearestPointOnCurve:e,pointOnCurve:o,pointAlongCurveFrom:t,perpendicularToCurveAt:x,locationAlongCurveFrom:u,getLength:s}}(),function(){"use strict";var a=this.Biltong={},b=function(a){return"[object Array]"===Object.prototype.toString.call(a)},c=function(a,c,d){return a=b(a)?a:[a.x,a.y],c=b(c)?c:[c.x,c.y],d(a,c)},d=a.gradient=function(a,b){return c(a,b,function(a,b){return b[0]==a[0]?b[1]>a[1]?1/0:-1/0:b[1]==a[1]?b[0]>a[0]?0:-0:(b[1]-a[1])/(b[0]-a[0])})},e=(a.normal=function(a,b){return-1/d(a,b)},a.lineLength=function(a,b){return c(a,b,function(a,b){return Math.sqrt(Math.pow(b[1]-a[1],2)+Math.pow(b[0]-a[0],2))})},a.quadrant=function(a,b){return c(a,b,function(a,b){return b[0]>a[0]?b[1]>a[1]?2:1:b[0]==a[0]?b[1]>a[1]?2:1:b[1]>a[1]?3:4})}),f=(a.theta=function(a,b){return c(a,b,function(a,b){var c=d(a,b),f=Math.atan(c),g=e(a,b);return(4==g||3==g)&&(f+=Math.PI),0>f&&(f+=2*Math.PI),f})},a.intersects=function(a,b){var c=a.x,d=a.x+a.w,e=a.y,f=a.y+a.h,g=b.x,h=b.x+b.w,i=b.y,j=b.y+b.h;return g>=c&&d>=g&&i>=e&&f>=i||h>=c&&d>=h&&i>=e&&f>=i||g>=c&&d>=g&&j>=e&&f>=j||h>=c&&d>=g&&j>=e&&f>=j||c>=g&&h>=c&&e>=i&&j>=e||d>=g&&h>=d&&e>=i&&j>=e||c>=g&&h>=c&&f>=i&&j>=f||d>=g&&h>=c&&f>=i&&j>=f},a.encloses=function(a,b,c){var d=a.x,e=a.x+a.w,f=a.y,g=a.y+a.h,h=b.x,i=b.x+b.w,j=b.y,k=b.y+b.h,l=function(a,b,d,e){return c?b>=a&&d>=e:b>a&&d>e};return l(d,h,e,i)&&l(f,j,g,k)},[null,[1,-1],[1,1],[-1,1],[-1,-1]]),g=[null,[-1,-1],[-1,1],[1,1],[1,-1]];a.pointOnLine=function(a,b,c){var h=d(a,b),i=e(a,b),j=c>0?f[i]:g[i],k=Math.atan(h),l=Math.abs(c*Math.sin(k))*j[1],m=Math.abs(c*Math.cos(k))*j[0];return{x:a.x+m,y:a.y+l}},a.perpendicularLineTo=function(a,b,c){var e=d(a,b),f=Math.atan(-1/e),g=c/2*Math.sin(f),h=c/2*Math.cos(f);return[{x:b.x+h,y:b.y+g},{x:b.x-h,y:b.y-g}]}}.call(this),function(){"use strict";var a={android:navigator.userAgent.toLowerCase().indexOf("android")>-1},b=function(a,b,c){c=c||a.parentNode;for(var d=c.querySelectorAll(b),e=0;ec&&a[c]!=b;c++);c-1&&9>t,v=function(a,b){if(null==a)return[0,0];var c=A(a),d=z(c,0);return[d[b+"X"],d[b+"Y"]]},w=function(a){return null==a?[0,0]:u?[a.clientX+document.documentElement.scrollLeft,a.clientY+document.documentElement.scrollTop]:v(a,"page")},x=function(a){return v(a,"screen")},y=function(a){return v(a,"client")},z=function(a,b){return a.item?a.item(b):a[b]},A=function(a){return a.touches&&a.touches.length>0?a.touches:a.changedTouches&&a.changedTouches.length>0?a.changedTouches:a.targetTouches&&a.targetTouches.length>0?a.targetTouches:[a]},B=function(a){return A(a).length},C=function(a,b,c,d){if(g(a,b,c),d.__tauid=c.__tauid,a.addEventListener)a.addEventListener(b,c,!1);else if(a.attachEvent){var e=b+c.__tauid;a["e"+e]=c,a[e]=function(){a["e"+e]&&a["e"+e](window.event)},a.attachEvent("on"+b,a[e])}},D=function(a,b,d){null!=d&&E(a,function(){var a=c(this);if(h(a,b,d),null!=d.__tauid)if(a.removeEventListener)a.removeEventListener(b,d,!1);else if(this.detachEvent){var e=b+d.__tauid;a[e]&&a.detachEvent("on"+b,a[e]),a[e]=null,a["e"+e]=null}})},E=function(a,b){if(null!=a){a="string"!=typeof a&&null==a.tagName&&null!=a.length?a:"string"==typeof a?document.querySelectorAll(a):[a];for(var c=0;c=f.length,i=function(){return e[g[1]]||function(){return e[g[1]]=[],e[g[1]]}()};if(h)g?i()[g[3]]=c:e[a]=c;else if(g){var j=i();e=j[g[3]]||function(){return j[g[3]]={},j[g[3]]}()}else e=e[a]||function(){return e[a]={},e[a]}()}),a}},functionChain:function(a,b,c){for(var d=0;d-1&&a.splice(c,1),-1!=c},remove:function(a,b){var c=k.indexOf(a,b);return c>-1&&a.splice(c,1),-1!=c},addWithFunction:function(a,b,c){-1==k.findWithFunction(a,c)&&a.push(b)},addToList:function(a,b,c,d){var e=a[b];return null==e&&(e=[],a[b]=e),e[d?"unshift":"push"](c),e},extend:function(b,c){var d;for(c=a(c)?c:[c],d=0;d2)for(d=2;dh&&j!==!1;){if(c[d])a[d][h].apply(this,[e,f]);else try{j=a[d][h].apply(this,[e,f])}catch(l){k.log("jsPlumb: fire failed for event "+d+" : "+l)}h++,(null==a||null==a[d])&&(i=!0)}}return this},this.unbind=function(b){return b?delete a[b]:a={},this},this.getListener=function(b){return a[b]},this.setSuspendEvents=function(a){b=a},this.isSuspendEvents=function(){return b},this.cleanupListeners=function(){for(var b in a)a[b]=null}},k.EventGenerator.prototype={cleanup:function(){this.cleanupListeners()}},Function.prototype.bind||(Function.prototype.bind=function(a){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var b=Array.prototype.slice.call(arguments,1),c=this,d=function(){},e=function(){return c.apply(this instanceof d&&a?this:a,b.concat(Array.prototype.slice.call(arguments)))};return d.prototype=this.prototype,e.prototype=new d,e})}.call(this),function(){"use strict";var a=this,b=a.jsPlumbUtil;b.ieVersion=/MSIE\s([\d.]+)/.test(navigator.userAgent)?new Number(RegExp.$1):-1,b.oldIE=b.ieVersion>-1&&b.ieVersion<9,b.matchesSelector=function(a,b,c){c=c||a.parentNode;for(var d=c.querySelectorAll(b),e=0;e';var b=a.firstChild;null!=b&&null!=b.style?(b.style.behavior="url(#default#VML)",c.vml=b?"object"==typeof b.adj:!0):c.vml=!1,a.parentNode.removeChild(a)}return c.vml},d=function(){var a=-1;if("Microsoft Internet Explorer"==navigator.appName){var b=navigator.userAgent,c=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");null!=c.exec(b)&&(a=parseFloat(RegExp.$1))}return a}(),e=d>-1&&9>d,f=function(a,b){if(null==a)return[0,0];var c=k(a),d=j(c,0);return[d[b+"X"],d[b+"Y"]]},g=function(a){return null==a?[0,0]:e?[a.clientX+document.documentElement.scrollLeft,a.clientY+document.documentElement.scrollTop]:f(a,"page")},h=function(a){return f(a,"screen")},i=function(a){return f(a,"client")},j=function(a,b){return a.item?a.item(b):a[b]},k=function(a){return a.touches&&a.touches.length>0?a.touches:a.changedTouches&&a.changedTouches.length>0?a.changedTouches:a.targetTouches&&a.targetTouches.length>0?a.targetTouches:[a]},l=function(a){var b={},c=[],d={},e={},f={};this.register=function(g){var h=a.getId(g),i=jsPlumbAdapter.getOffset(g,a);b[h]||(b[h]=g,c.push(g),d[h]={});var j=function(b){if(b)for(var c=0;c0){var l=jsPlumbAdapter.getOffset(g,a);d[h][k]={id:k,offset:{left:l.left-i.left,top:l.top-i.top}},f[k]=h}j(b.childNodes[c])}};j(g)},this.updateOffsets=function(b){if(null!=b){var c=jsPlumb.getDOMElement(b),e=a.getId(c),g=d[e],h=jsPlumbAdapter.getOffset(c,a);if(g)for(var i in g){var j=jsPlumb.getElementObject(i),k=jsPlumbAdapter.getOffset(j,a);d[e][i]={id:i,offset:{left:k.left-h.left,top:k.top-h.top}},f[i]=e}}},this.endpointAdded=function(c,g){g=g||a.getId(c);var h=document.body,i=c.parentNode;for(e[g]=e[g]?e[g]+1:1;null!=i&&i!=h;){var j=a.getId(i,null,!0);if(j&&b[j]){var k=jsPlumbAdapter.getOffset(i,a);if(null==d[j][g]){var l=jsPlumbAdapter.getOffset(c,a);d[j][g]={id:g,offset:{left:l.left-k.left,top:l.top-k.top}},f[g]=j}break}i=i.parentNode}},this.endpointDeleted=function(a){if(e[a.elementId]&&(e[a.elementId]--,e[a.elementId]<=0))for(var b in d)d[b]&&(delete d[b][a.elementId],delete f[a.elementId])},this.changeId=function(a,b){d[b]=d[a],d[a]={},f[b]=f[a],f[a]=null},this.getElementsForDraggable=function(a){return d[a]},this.elementRemoved=function(a){var b=f[a];b&&(delete d[b][a],delete f[a])},this.reset=function(){b={},c=[],d={},e={}},this.dragEnded=function(b){var c=a.getId(b),d=f[c];d&&this.updateOffsets(d)},this.setParent=function(b,c,e,g){var h=f[c];if(h){d[g]||(d[g]={}),d[g][c]=d[h][c],delete d[h][c];var i=jsPlumbAdapter.getOffset(e,a),j=jsPlumbAdapter.getOffset(b,a);d[g][c].offset={left:j.left-i.left,top:j.top-i.top},f[c]=g}},this.getDragAncestor=function(b){var c=jsPlumb.getDOMElement(b),d=a.getId(c),e=f[d];return e?jsPlumb.getDOMElement(e):null}};window.console||(window.console={time:function(){},timeEnd:function(){},group:function(){},groupEnd:function(){},log:function(){}});var m=function(a){return null==a?null:a.replace(/^\s\s*/,"").replace(/\s\s*$/,"")},n=function(a,b){b=m(b),"undefined"!=typeof a.className.baseVal?a.className.baseVal=b:a.className=b},o=function(a){return"undefined"==typeof a.className.baseVal?a.className:a.className.baseVal},p=function(a,b,c){b=null==b?[]:jsPlumbUtil.isArray(b)?b:b.split(/\s+/),c=null==c?[]:jsPlumbUtil.isArray(c)?c:c.split(/\s+/);var d=o(a),e=d.split(/\s+/),f=function(a,b){for(var c=0;cf;f++)d&&d==e[f]||e[f].setHover(b,!0,c)},g=function(a){return null==a?null:a.split(" ")},h=function(b,c,d){if(b.getDefaultType){for(var e=b.getTypeDescriptor(),f=a.merge({},b.getDefaultType()),g=0,h=b._jsPlumb.types.length;h>g;g++)f=a.merge(f,b._jsPlumb.instance.getType(b._jsPlumb.types[g],e),["cssClass"]);c&&(f=a.populate(f,c)),b.applyType(f,d),d||b.repaint()}},i=window.jsPlumbUIComponent=function(b){jsPlumbUtil.EventGenerator.apply(this,arguments);var c=this,d=arguments,e=c.idPrefix,f=e+(new Date).getTime();if(this._jsPlumb={instance:b._jsPlumb,parameters:b.parameters||{},paintStyle:null,hoverPaintStyle:null,paintStyleInUse:null,hover:!1,beforeDetach:b.beforeDetach,beforeDrop:b.beforeDrop,overlayPlacements:[],hoverClass:b.hoverClass||b._jsPlumb.Defaults.HoverClass,types:[]},this.getId=function(){return f},b.events)for(var g in b.events)c.bind(g,b.events[g]);this.clone=function(){var a={};return this.constructor.apply(a,d),a}.bind(this),this.isDetachAllowed=function(b){var c=!0;if(this._jsPlumb.beforeDetach)try{c=this._jsPlumb.beforeDetach(b)}catch(d){a.log("jsPlumb: beforeDetach callback failed",d)}return c},this.isDropAllowed=function(b,c,d,e,f,g,h){var i=this._jsPlumb.instance.checkCondition("beforeDrop",{sourceId:b,targetId:c,scope:d,connection:e,dropEndpoint:f,source:g,target:h});if(this._jsPlumb.beforeDrop)try{i=this._jsPlumb.beforeDrop({sourceId:b,targetId:c,scope:d,connection:e,dropEndpoint:f,source:g,target:h})}catch(j){a.log("jsPlumb: beforeDrop callback failed",j)}return i};var h=[];this.setListenerComponent=function(a){for(var b=0;bf;f++)this.hasType(d[f])||(this._jsPlumb.types.push(d[f]),e=!0);e&&h(this,b,c)}},removeType:function(b,c){var d=g(b),e=!1,f=function(b){var c=a.indexOf(this._jsPlumb.types,b);return-1!=c?(j(this,c),this._jsPlumb.types.splice(c,1),!0):!1}.bind(this);if(null!=d){for(var i=0,k=d.length;k>i;i++)e=f(d[i])||e;e&&h(this,null,c)}},clearTypes:function(a){for(var b=this._jsPlumb.types.length,c=0;b>c;c++)j(this,0),this._jsPlumb.types.splice(0,1);h(this,{},a)},toggleType:function(a,b,c){var d=g(a);if(null!=d){for(var e=0,f=d.length;f>e;e++){var i=jsPlumbUtil.indexOf(this._jsPlumb.types,d[e]);-1!=i?(j(this,i),this._jsPlumb.types.splice(i,1)):this._jsPlumb.types.push(d[e])}h(this,b,c)}},applyType:function(a,b){if(this.setPaintStyle(a.paintStyle,b),this.setHoverPaintStyle(a.hoverPaintStyle,b),a.parameters)for(var c in a.parameters)this.setParameter(c,a.parameters[c])},setPaintStyle:function(a,b){this._jsPlumb.paintStyle=a,this._jsPlumb.paintStyleInUse=this._jsPlumb.paintStyle,d(this),b||this.repaint()},getPaintStyle:function(){return this._jsPlumb.paintStyle},setHoverPaintStyle:function(a,b){this._jsPlumb.hoverPaintStyle=a,d(this),b||this.repaint()},getHoverPaintStyle:function(){return this._jsPlumb.hoverPaintStyle},destroy:function(){this.cleanupListeners(),this.clone=null,this._jsPlumb=null},isHover:function(){return this._jsPlumb.hover},setHover:function(a,b,d){if(this._jsPlumb&&!this._jsPlumb.instance.currentlyDragging&&!this._jsPlumb.instance.isHoverSuspended()){if(this._jsPlumb.hover=a,null!=this.canvas){if(null!=this._jsPlumb.instance.hoverClass){var e=a?"addClass":"removeClass";this._jsPlumb.instance[e](this.canvas,this._jsPlumb.instance.hoverClass)}null!=this._jsPlumb.hoverClass&&this._jsPlumb.instance[e](this.canvas,this._jsPlumb.hoverClass)}null!=this._jsPlumb.hoverPaintStyle&&(this._jsPlumb.paintStyleInUse=a?this._jsPlumb.hoverPaintStyle:this._jsPlumb.paintStyle,this._jsPlumb.instance.isSuspendDrawing()||(d=d||c(),this.repaint({timestamp:d,recalc:!1}))),this.getAttachedElements&&!b&&f(this,a,c(),this)}}});var k="__label",l=function(a,b){for(var c=-1,d=0,e=a._jsPlumb.overlays.length;e>d;d++)if(b===a._jsPlumb.overlays[d].id){c=d;break}return c},m=function(a,b){var c={cssClass:b.cssClass,labelStyle:a.labelStyle,id:k,component:a,_jsPlumb:a._jsPlumb.instance},d=t.extend(c,b);return new(t.Overlays[a._jsPlumb.instance.getRenderMode()].Label)(d)},n=function(b,c){var d=null;if(a.isArray(c)){var e=c[0],f=t.extend({component:b,_jsPlumb:b._jsPlumb.instance},c[1]);3==c.length&&t.extend(f,c[2]),d=new(t.Overlays[b._jsPlumb.instance.getRenderMode()][e])(f)}else d=c.constructor==String?new(t.Overlays[b._jsPlumb.instance.getRenderMode()][c])({component:b,_jsPlumb:b._jsPlumb.instance}):c;b._jsPlumb.overlays.push(d)},o=function(a,b){var c=a.defaultOverlayKeys||[],d=b.overlays,e=function(b){return a._jsPlumb.instance.Defaults[b]||t.Defaults[b]||[]};d||(d=[]);for(var f=0,g=c.length;g>f;f++)d.unshift.apply(d,e(c[f]));return d},p=window.OverlayCapableJsPlumbUIComponent=function(a){i.apply(this,arguments),this._jsPlumb.overlays=[];var b=o(this,a);if(b)for(var c=0,d=b.length;d>c;c++)n(this,b[c]);if(a.label){var e=a.labelLocation||this.defaultLabelLocation||.5,f=a.labelStyle||this._jsPlumb.instance.Defaults.LabelStyle;this._jsPlumb.overlays.push(m(this,{label:a.label,location:e,labelStyle:f}))}this.setListenerComponent=function(a){if(this._jsPlumb)for(var b=0;bc;c++)this.addOverlay(a.overlays[c],!0)},setHover:function(a){if(this._jsPlumb&&!this._jsPlumb.instance.isConnectionBeingDragged())for(var b=0,c=this._jsPlumb.overlays.length;c>b;b++)this._jsPlumb.overlays[b][a?"addClass":"removeClass"](this._jsPlumb.instance.hoverClass)},addOverlay:function(a,b){n(this,a),b||this.repaint()},getOverlay:function(a){var b=l(this,a);return b>=0?this._jsPlumb.overlays[b]:null},getOverlays:function(){return this._jsPlumb.overlays},hideOverlay:function(a){var b=this.getOverlay(a);b&&b.hide()},hideOverlays:function(){for(var a=0,b=this._jsPlumb.overlays.length;b>a;a++)this._jsPlumb.overlays[a].hide() },showOverlay:function(a){var b=this.getOverlay(a);b&&b.show()},showOverlays:function(){for(var a=0,b=this._jsPlumb.overlays.length;b>a;a++)this._jsPlumb.overlays[a].show()},removeAllOverlays:function(a){for(var b=0,c=this._jsPlumb.overlays.length;c>b;b++)this._jsPlumb.overlays[b].cleanup&&this._jsPlumb.overlays[b].cleanup();this._jsPlumb.overlays.splice(0,this._jsPlumb.overlays.length),this._jsPlumb.overlayPositions=null,a||this.repaint()},removeOverlay:function(a){var b=l(this,a);if(-1!=b){var c=this._jsPlumb.overlays[b];c.cleanup&&c.cleanup(),this._jsPlumb.overlays.splice(b,1),this._jsPlumb.overlayPositions&&delete this._jsPlumb.overlayPositions[a]}},removeOverlays:function(){for(var a=0,b=arguments.length;b>a;a++)this.removeOverlay(arguments[a])},moveParent:function(a){this.bgCanvas&&(this.bgCanvas.parentNode.removeChild(this.bgCanvas),a.appendChild(this.bgCanvas)),this.canvas.parentNode.removeChild(this.canvas),a.appendChild(this.canvas);for(var b=0;b *",function(c){b(a,c)}),f.on(n,a,"._jsPlumb_endpoint, ._jsPlumb_endpoint > *, ._jsPlumb_endpoint svg *",function(c){b(a,c)}),f.on(n,a,"._jsPlumb_overlay, ._jsPlumb_overlay *",function(c){b(a,c)})},d=0;di;i++)d=f.getElementObject(b[i]),g=f.getDOMElement(d),e=f.getAttribute(g,"id"),h.push(c.apply(f,[g,e]))}else d=f.getDOMElement(b),e=f.getId(d),h=c.apply(f,[d,e]);return h},K=function(a){return u[a]},L=function(b,c,d,e){if(!jsPlumbAdapter.headless){var g=null==c?!1:c;if(g&&t.isDragSupported(b,f)&&!t.isAlreadyDraggable(b,f)){var h=d||f.Defaults.DragOptions;h=t.extend({},h);var i=t.dragEvents.drag,j=t.dragEvents.stop,k=t.dragEvents.start,l=f.getDOMElement(b),m=f.dragManager.getDragAncestor(l),n={left:0,top:0},o=n,p=!1;rb(e,b),h[k]=a.wrap(h[k],function(){return o=null!=m?jsPlumbAdapter.getOffset(m,f):n,f.setHoverSuspended(!0),f.select({source:b}).addClass(f.elementDraggingClass+" "+f.sourceElementDraggingClass,!0),f.select({target:b}).addClass(f.elementDraggingClass+" "+f.targetElementDraggingClass,!0),f.setConnectionBeingDragged(!0),h.canDrag?d.canDrag():void 0},!1),h[i]=a.wrap(h[i],function(){var a=f.getUIPosition(arguments,f.getZoom());a.left+=o.left,a.top+=o.top,I(b,a,null,!0),p&&f.addClass(b,"jsPlumb_dragged"),p=!0}),h[j]=a.wrap(h[j],function(){var a=f.getUIPosition(arguments,f.getZoom(),!0);I(b,a),p=!1,f.removeClass(b,"jsPlumb_dragged"),f.setHoverSuspended(!1),f.select({source:b}).removeClass(f.elementDraggingClass+" "+f.sourceElementDraggingClass,!0),f.select({target:b}).removeClass(f.elementDraggingClass+" "+f.targetElementDraggingClass,!0),f.setConnectionBeingDragged(!1),f.dragManager.dragEnded(b)});var q=X(b);y[q]=!0;var r=y[q];h.disabled=null==r?!1:!r,f.initDraggable(b,h),f.dragManager.register(b)}}},M=function(a,b){for(var c=a.scope.split(/\s/),d=b.scope.split(/\s/),e=0;ee;e++)d.overlays.push(d.sourceEndpoint.connectorOverlays[e])}!d["pointer-events"]&&d.sourceEndpoint&&d.sourceEndpoint.connectorPointerEvents&&(d["pointer-events"]=d.sourceEndpoint.connectorPointerEvents);var h=function(a,b){var c=t.extend({},a);for(var d in b)b[d]&&(c[d]=b[d]);return c},i=function(a,b,c){return f.addEndpoint(a,h(b,{anchor:d.anchors?d.anchors[c]:d.anchor,endpoint:d.endpoints?d.endpoints[c]:d.endpoint,paintStyle:d.endpointStyles?d.endpointStyles[c]:d.endpointStyle,hoverPaintStyle:d.endpointHoverStyles?d.endpointHoverStyles[c]:d.endpointHoverStyle}))},j=function(a,b,c){if(d[a]&&!d[a].endpoint&&!d[a+"Endpoint"]&&!d.newConnection){var e=X(d[a]),f=c[e];if(f){if(!f.enabled)return!1;var g=null!=f.endpoint&&f.endpoint._jsPlumb?f.endpoint:i(d[a],f.def,b);if(f.uniqueEndpoint&&(f.endpoint=g),g.isFull())return!1;d[a+"Endpoint"]=g,g._doNotDeleteOnDetach=!1,g._deleteOnDetach=!0}}};return j("source",0,this.sourceEndpointDefinitions)!==!1&&j("target",1,this.targetEndpointDefinitions)!==!1?(d.sourceEndpoint&&d.targetEndpoint&&(M(d.sourceEndpoint,d.targetEndpoint)||(d=null)),d):void 0}.bind(f),O=function(a){var b=f.Defaults.ConnectionType||f.getDefaultConnectionType();a._jsPlumb=f,a.newConnection=O,a.newEndpoint=Q,a.endpointsByUUID=u,a.endpointsByElement=s,a.finaliseConnection=P;var c=new b(a);return c.id="con_"+G(),c.isDetachable()&&(c.endpoints[0].initDraggable(),c.endpoints[1].initDraggable()),c},P=f.finaliseConnection=function(a,b,c,d){if(b=b||{},a.suspendedEndpoint||q.push(a),a.endpoints[0].isTemporarySource=!1,(null==a.suspendedEndpoint||d)&&f.anchorManager.newConnection(a),I(a.source),!b.doNotFireConnectionEvent&&b.fireEvent!==!1){var e={connection:a,source:a.source,target:a.target,sourceId:a.sourceId,targetId:a.targetId,sourceEndpoint:a.endpoints[0],targetEndpoint:a.endpoints[1]};f.fire("connection",e,c)}},Q=function(a,b){var c=f.Defaults.EndpointType||t.Endpoint,d=t.extend({},a);d._jsPlumb=f,d.newConnection=O,d.newEndpoint=Q,d.endpointsByUUID=u,d.endpointsByElement=s,d.fireDetachEvent=$,d.elementId=b||X(d.source);var e=new c(d);return e.id="ep_"+G(),rb(d.elementId,d.source),jsPlumbAdapter.headless||f.dragManager.endpointAdded(d.source,b),e},R=function(a,b,c){var d=s[a];if(d&&d.length)for(var e=0,f=d.length;f>e;e++){for(var g=0,h=d[e].connections.length;h>g;g++){var i=b(d[e].connections[g]);if(i)return}c&&c(d[e])}},S=function(a,b){return J(a,function(a,c){y[c]=b,this.isDragSupported(a)&&this.setElementDraggable(a,b)})},T=function(a,b,c){b="block"===b;var d=null;c&&(d=b?function(a){a.setVisible(!0,!0,!0)}:function(a){a.setVisible(!1,!0,!0)});var e=l(a);R(e.id,function(a){if(b&&c){var d=a.sourceId===e.id?1:0;a.endpoints[d].isVisible()&&a.setVisible(!0)}else a.setVisible(b)},d)},U=function(a){return J(a,function(a,b){var c=null==y[b]?!1:y[b];return c=!c,y[b]=c,this.setDraggable(a,c),c}.bind(this))},V=function(a,b){var c=null;b&&(c=function(a){var b=a.isVisible();a.setVisible(!b)}),R(a,function(a){var b=a.isVisible();a.setVisible(!b)},c)},W=function(a){var b=w[a];return b?{o:b,s:A[a]}:tb({elId:a})},X=function(a,b,c){if(jsPlumbUtil.isString(a))return a;if(null==a)return null;var d=f.getAttribute(a,"id");return d&&"undefined"!==d||(2==arguments.length&&void 0!==arguments[1]?d=b:(1==arguments.length||3==arguments.length&&!arguments[2])&&(d="jsPlumb_"+g+"_"+G()),c||f.setAttribute(a,"id",d)),d};this.setConnectionBeingDragged=function(a){z=a},this.isConnectionBeingDragged=function(){return z},this.connectorClass="_jsPlumb_connector",this.hoverClass="_jsPlumb_hover",this.endpointClass="_jsPlumb_endpoint",this.endpointConnectedClass="_jsPlumb_endpoint_connected",this.endpointFullClass="_jsPlumb_endpoint_full",this.endpointDropAllowedClass="_jsPlumb_endpoint_drop_allowed",this.endpointDropForbiddenClass="_jsPlumb_endpoint_drop_forbidden",this.overlayClass="_jsPlumb_overlay",this.draggingClass="_jsPlumb_dragging",this.elementDraggingClass="_jsPlumb_element_dragging",this.sourceElementDraggingClass="_jsPlumb_source_element_dragging",this.targetElementDraggingClass="_jsPlumb_target_element_dragging",this.endpointAnchorClassPrefix="_jsPlumb_endpoint_anchor",this.hoverSourceClass="_jsPlumb_source_hover",this.hoverTargetClass="_jsPlumb_target_hover",this.dragSelectClass="_jsPlumb_drag_select",this.Anchors={},this.Connectors={svg:{},vml:{}},this.Endpoints={svg:{},vml:{}},this.Overlays={svg:{},vml:{}},this.ConnectorRenderers={},this.SVG="svg",this.VML="vml",this.addEndpoint=function(b,c,d){d=d||{};var e=t.extend({},d);t.extend(e,c),e.endpoint=e.endpoint||f.Defaults.Endpoint,e.paintStyle=e.paintStyle||f.Defaults.EndpointStyle;for(var g=[],h=a.isArray(b)||null!=b.length&&!a.isString(b)?b:[b],i=0,j=h.length;j>i;i++){e.source=f.getDOMElement(h[i]),pb(e.source);var k=X(e.source),l=Q(e,k),m=rb(k,e.source).info.o;a.addToList(s,k,l),B||l.paint({anchorLoc:l.anchor.compute({xy:[m.left,m.top],wh:A[k],element:l,timestamp:C}),timestamp:C}),g.push(l),l._doNotDeleteOnDetach=!0}return 1==g.length?g[0]:g},this.addEndpoints=function(b,c,d){for(var e=[],g=0,h=c.length;h>g;g++){var i=f.addEndpoint(b,c[g],d);a.isArray(i)?Array.prototype.push.apply(e,i):e.push(i)}return e},this.animate=function(b,c,d){d=d||{};var e=f.getElementObject(b),g=f.getDOMElement(b),h=X(g),i=t.animEvents.step,j=t.animEvents.complete;d[i]=a.wrap(d[i],function(){f.revalidate(h)}),d[j]=a.wrap(d[j],function(){f.revalidate(h)}),f.doAnimate(e,c,d)},this.checkCondition=function(b,c){var d=f.getListener(b),e=!0;if(d&&d.length>0)try{for(var g=0,h=d.length;h>g;g++)e=e&&d[g](c)}catch(i){a.log(f,"cannot check condition ["+b+"]"+i)}return e},this.connect=function(a,b){var c,d=N(a,b);if(d){if(null==d.source&&null==d.sourceEndpoint)return jsPlumbUtil.log("Cannot establish connection - source does not exist"),void 0;if(null==d.target&&null==d.targetEndpoint)return jsPlumbUtil.log("Cannot establish connection - target does not exist"),void 0;pb(d.source),c=O(d),P(c,d)}return c};var Y=[{el:"source",elId:"sourceId",epDefs:"sourceEndpointDefinitions"},{el:"target",elId:"targetId",epDefs:"targetEndpointDefinitions"}],Z=function(a,b,c,d){var e,f,g,h=Y[c],i=a[h.elId],j=(a[h.el],a.endpoints[c]),k={index:c,originalSourceId:0===c?i:a.sourceId,newSourceId:a.sourceId,originalTargetId:1==c?i:a.targetId,newTargetId:a.targetId,connection:a};if(b.constructor==t.Endpoint)e=b,e.addConnection(a);else if(f=X(b),g=this[h.epDefs][f],f===a[h.elId])e=null;else if(g){if(!g.enabled)return;e=null!=g.endpoint&&g.endpoint._jsPlumb?g.endpoint:this.addEndpoint(b,g.def),g.uniqueEndpoint&&(g.endpoint=e),e._doNotDeleteOnDetach=!1,e._deleteOnDetach=!0,e.addConnection(a)}else e=a.makeEndpoint(0===c,b,f),e._doNotDeleteOnDetach=!1,e._deleteOnDetach=!0;return null!=e&&(j.detachFromConnection(a),a.endpoints[c]=e,a[h.el]=e.element,a[h.elId]=e.elementId,k[0===c?"newSourceId":"newTargetId"]=e.elementId,_(k),d||a.repaint()),k}.bind(this);this.setSource=function(a,b,c){var d=Z(a,b,0,c);this.anchorManager.sourceChanged(d.originalSourceId,d.newSourceId,a)},this.setTarget=function(a,b,c){var d=Z(a,b,1,c);this.anchorManager.updateOtherEndpoint(d.originalSourceId,d.originalTargetId,d.newTargetId,a)},this.deleteEndpoint=function(a,b){var c="string"==typeof a?u[a]:a;return c&&f.deleteObject({endpoint:c,dontUpdateHover:b}),f},this.deleteEveryEndpoint=function(){var a=f.setSuspendDrawing(!0);for(var b in s){var c=s[b];if(c&&c.length)for(var d=0,e=c.length;e>d;d++)f.deleteEndpoint(c[d],!0)}return s={},v={},u={},f.anchorManager.reset(),f.dragManager.reset(),a||f.setSuspendDrawing(!1),f};var $=function(a,b,c){var d=f.Defaults.ConnectionType||f.getDefaultConnectionType(),e=a.constructor==d,g=e?{connection:a,source:a.source,target:a.target,sourceId:a.sourceId,targetId:a.targetId,sourceEndpoint:a.endpoints[0],targetEndpoint:a.endpoints[1]}:a;b&&f.fire("connectionDetached",g,c),f.anchorManager.connectionDetached(g)},_=f.fireMoveEvent=function(a,b){f.fire("connectionMoved",a,b)};this.unregisterEndpoint=function(a){a._jsPlumb.uuid&&(u[a._jsPlumb.uuid]=null),f.anchorManager.deleteEndpoint(a);for(var b in s){var c=s[b];if(c){for(var d=[],e=0,g=c.length;g>e;e++)c[e]!=a&&d.push(c[e]);s[b]=d}s[b].length<1&&delete s[b]}},this.detach=function(){if(0!==arguments.length){var a=f.Defaults.ConnectionType||f.getDefaultConnectionType(),b=arguments[0].constructor==a,c=2==arguments.length?b?arguments[1]||{}:arguments[0]:arguments[0],d=c.fireEvent!==!1,e=c.forceDetach,g=b?arguments[0]:c.connection;if(g)(e||jsPlumbUtil.functionChain(!0,!1,[[g.endpoints[0],"isDetachAllowed",[g]],[g.endpoints[1],"isDetachAllowed",[g]],[g,"isDetachAllowed",[g]],[f,"checkCondition",["beforeDetach",g]]]))&&g.endpoints[0].detach(g,!1,!0,d);else{var h=t.extend({},c);if(h.uuids)K(h.uuids[0]).detachFrom(K(h.uuids[1]),d);else if(h.sourceEndpoint&&h.targetEndpoint)h.sourceEndpoint.detachFrom(h.targetEndpoint);else{var i=X(f.getDOMElement(h.source)),j=X(f.getDOMElement(h.target));R(i,function(a){(a.sourceId==i&&a.targetId==j||a.targetId==i&&a.sourceId==j)&&f.checkCondition("beforeDetach",a)&&a.endpoints[0].detach(a,!1,!0,d)})}}}},this.detachAllConnections=function(a,b){b=b||{},a=f.getDOMElement(a);var c=X(a),d=s[c];if(d&&d.length)for(var e=0,g=d.length;g>e;e++)d[e].detachAll(b.fireEvent!==!1);return f},this.detachEveryConnection=function(a){return a=a||{},f.doWhileSuspended(function(){for(var b in s){var c=s[b];if(c&&c.length)for(var d=0,e=c.length;e>d;d++)c[d].detachAll(a.fireEvent!==!1)}q.length=0}),f},this.deleteObject=function(a){var b={endpoints:{},connections:{},endpointCount:0,connectionCount:0},c=a.fireEvent!==!1,d=a.deleteAttachedObjects!==!1,e=function(c){if(null!=c&&null==b.connections[c.id]&&(a.dontUpdateHover||null==c._jsPlumb||c.setHover(!1),b.connections[c.id]=c,b.connectionCount++,d))for(var e=0;ec;c++)e=l(a[c]),e.el&&L(e.el,!0,b,e.id);else e=l(a),e.el&&L(e.el,!0,b,e.id);return f};var ab=function(a,b,c,d){for(var e=0,f=a.length;f>e;e++)a[e][b].apply(a[e],c);return d(a)},bb=function(a,b,c){for(var d=[],e=0,f=a.length;f>e;e++)d.push([a[e][b].apply(a[e],c),a[e]]);return d},cb=function(a,b,c){return function(){return ab(a,b,arguments,c)}},db=function(a,b){return function(){return bb(a,b,arguments)}},eb=function(a,b){var c=[];if(a)if("string"==typeof a){if("*"===a)return a;c.push(a)}else if(b)c=a;else if(a.length)for(var d=0,e=a.length;e>d;d++)c.push(l(a[d]).id);else c.push(l(a).id);return c},fb=function(a,b,c){return"*"===a?!0:a.length>0?-1!=jsPlumbUtil.indexOf(a,b):!c};this.getConnections=function(a,b){a?a.constructor==String&&(a={scope:a}):a={};for(var c=a.scope||f.getDefaultScope(),d=eb(c,!0),e=eb(a.source),g=eb(a.target),h=!b&&d.length>1?{}:[],i=function(a,c){if(!b&&d.length>1){var e=h[a];null==e&&(e=h[a]=[]),e.push(c)}else h.push(c)},j=0,k=q.length;k>j;j++){var l=q[j];fb(d,l.scope)&&fb(e,l.sourceId)&&fb(g,l.targetId)&&i(l.scope,l)}return h};var gb=function(a,b){return function(c){for(var d=0,e=a.length;e>d;d++)c(a[d]);return b(a)}},hb=function(a){return function(b){return a[b]}},ib=function(a,b){var c,d,e={length:a.length,each:gb(a,b),get:hb(a)},f=["setHover","removeAllOverlays","setLabel","addClass","addOverlay","removeOverlay","removeOverlays","showOverlay","hideOverlay","showOverlays","hideOverlays","setPaintStyle","setHoverPaintStyle","setSuspendEvents","setParameter","setParameters","setVisible","repaint","addType","toggleType","removeType","removeClass","setType","bind","unbind"],g=["getLabel","getOverlay","isHover","getParameter","getParameters","getPaintStyle","getHoverPaintStyle","isVisible","hasType","getType","isSuspendEvents"];for(c=0,d=f.length;d>c;c++)e[f[c]]=cb(a,f[c],b);for(c=0,d=g.length;d>c;c++)e[g[c]]=db(a,g[c]);return e},jb=function(a){var b=ib(a,jb);return t.extend(b,{setDetachable:cb(a,"setDetachable",jb),setReattach:cb(a,"setReattach",jb),setConnector:cb(a,"setConnector",jb),detach:function(){for(var b=0,c=a.length;c>b;b++)f.detach(a[b])},isDetachable:db(a,"isDetachable"),isReattach:db(a,"isReattach")})},kb=function(a){var b=ib(a,kb);return t.extend(b,{setEnabled:cb(a,"setEnabled",kb),setAnchor:cb(a,"setAnchor",kb),isEnabled:db(a,"isEnabled"),detachAll:function(){for(var b=0,c=a.length;c>b;b++)a[b].detachAll()},remove:function(){for(var b=0,c=a.length;c>b;b++)f.deleteObject({endpoint:a[b]})}})};this.select=function(a){return a=a||{},a.scope=a.scope||"*",jb(a.connections||f.getConnections(a,!0))},this.selectEndpoints=function(a){a=a||{},a.scope=a.scope||"*";var b=!a.element&&!a.source&&!a.target,c=b?"*":eb(a.element),d=b?"*":eb(a.source),e=b?"*":eb(a.target),f=eb(a.scope,!0),g=[];for(var h in s){var i=fb(c,h,!0),j=fb(d,h,!0),k="*"!=d,l=fb(e,h,!0),m="*"!=e;if(i||j||l)a:for(var n=0,o=s[h].length;o>n;n++){var p=s[h][n];if(fb(f,p.scope,!0)){var q=k&&d.length>0&&!p.isSource,r=m&&e.length>0&&!p.isTarget;if(q||r)continue a;g.push(p)}}}return kb(g)},this.getAllConnections=function(){return q},this.getDefaultScope=function(){return D},this.getEndpoint=K,this.getEndpoints=function(a){return s[l(a).id]},this.getDefaultEndpointType=function(){return t.Endpoint},this.getDefaultConnectionType=function(){return t.Connection},this.getId=X,this.getOffset=function(a){return tb({elId:a}).o},this.appendElement=H;var lb=!1;this.isHoverSuspended=function(){return lb},this.setHoverSuspended=function(a){lb=a};var mb=function(a){return function(){return jsPlumbAdapter.isRenderModeAvailable(a)}};this.isSVGAvailable=mb("svg"),this.isVMLAvailable=mb("vml"),this.hide=function(a,b){return T(a,"none",b),f},this.idstamp=G,this.connectorsInitialized=!1;var nb=[],ob=["svg","vml"];this.registerConnectorType=function(a,b){nb.push([a,b])};var pb=function(a){if(!n&&a){var b=f.getDOMElement(a);b.offsetParent&&f.setContainer(b.offsetParent)}},qb=function(){f.Defaults.Container&&f.setContainer(f.Defaults.Container)},rb=f.manage=function(a,b){return v[a]||(v[a]={el:b,endpoints:[],connections:[]},v[a].info=tb({elId:a,timestamp:C})),v[a]},sb=function(a){delete v[a]},tb=this.updateOffset=function(a){var c,d=a.timestamp,e=a.recalc,g=a.offset,h=a.elId;return B&&!d&&(d=C),!e&&d&&d===x[h]?{o:a.offset||w[h],s:A[h]}:(e||!g&&null==w[h]?(c=v[h]?v[h].el:null,null!=c&&(A[h]=f.getSize(c),w[h]=b(c,f),x[h]=d)):(w[h]=g||w[h],null==A[h]&&(c=v[h].el,null!=c&&(A[h]=f.getSize(c))),x[h]=d),w[h]&&!w[h].right&&(w[h].right=w[h].left+A[h][0],w[h].bottom=w[h].top+A[h][1],w[h].width=A[h][0],w[h].height=A[h][1],w[h].centerx=w[h].left+w[h].width/2,w[h].centery=w[h].top+w[h].height/2),{o:w[h],s:A[h]})};this.init=function(){var a=function(a,b,c){t.Connectors[a][b]=function(){c.apply(this,arguments),t.ConnectorRenderers[a].apply(this,arguments)},jsPlumbUtil.extend(t.Connectors[a][b],[c,t.ConnectorRenderers[a]])};if(!t.connectorsInitialized){for(var b=0;b=4?[d[2],d[3]]:[0,0],offsets:d.length>=6?[d[4],d[5]]:[0,0],elementId:e,jsPlumbInstance:f,cssClass:7==d.length?d[6]:null};g=new t.Anchor(h),g.clone=function(){return new t.Anchor(h)}}return g.id||(g.id="anchor_"+G()),g},this.makeAnchors=function(b,c,d){for(var e=[],g=0,h=b.length;h>g;g++)"string"==typeof b[g]?e.push(t.Anchors[b[g]]({elementId:c,jsPlumbInstance:d})):a.isArray(b[g])&&e.push(f.makeAnchor(b[g],c,d));return e},this.makeDynamicAnchor=function(a,b){return new t.DynamicAnchor({anchors:a,selector:b,elementId:null,jsPlumbInstance:f})},this.targetEndpointDefinitions={};var ub=function(a,b,c){a.paintStyle=a.paintStyle||c.Defaults.EndpointStyles[b]||c.Defaults.EndpointStyle,a.hoverPaintStyle=a.hoverPaintStyle||c.Defaults.EndpointHoverStyles[b]||c.Defaults.EndpointHoverStyle,a.anchor=a.anchor||c.Defaults.Anchors[b]||c.Defaults.Anchor,a.endpoint=a.endpoint||c.Defaults.Endpoints[b]||c.Defaults.Endpoint};this.sourceEndpointDefinitions={};var vb=function(a,b,c,d,e){for(var f=a.target||a.srcElement,g=!1,h=d.getSelector(b,c),i=0;i0&&b>=c.maxConnections;return g&&k&&k({element:d.el,connection:jpc},a),g},element:d.el,elementId:e,isSource:!1,isTarget:!0,addClass:function(a){f.addClass(d.el,a)},removeClass:function(a){f.removeClass(d.el,a)},onDrop:function(a){var b=a.endpoints[0];b.anchor.locked=!1},isDropAllowed:function(){return m.isDropAllowed.apply(m,arguments)},getEndpoint:function(a){var c=f.getElementObject(d.el),e=d.el._jsPlumbTarget,h=e.endpoint;if((null==h||null==h._jsPlumb)&&(h=f.addEndpoint(c,g)),g.uniqueEndpoint&&(e.endpoint=h),h._doNotDeleteOnDetach=!1,h._deleteOnDetach=!0,a.isDetachable()&&h.initDraggable(),null!=h.anchor.positionFinder){var i=f.getUIPosition(arguments,this.getZoom()),j=b(c,this),k=f.getSize(c),l=h.anchor.positionFinder(i,j,k,h.anchor.constructorParams);h.anchor.x=l[0],h.anchor.y=l[1]}return h}}),q=t.dragEvents.drop;n.scope=n.scope||h,n[q]=a.wrap(n[q],p),g.allowLoopback===!1&&(n.canDrop=function(a){var b=a.getDragElement()._jsPlumbRelatedElement;return b!=d.el}),this.initDroppable(this.getElementObject(d.el),n,"internal")}.bind(this),n=c.length&&c.constructor!=String?c:[c],o=0,p=n.length;p>o;o++)m(n[o]);return this},this.unmakeTarget=function(a,b){var c=l(a);return t.destroyDroppable(c.el),b||delete this.targetEndpointDefinitions[c.id],this},this.makeSource=function(c,d,e){var g=t.extend({},e);t.extend(g,d),ub(g,0,this);for(var h=g.maxConnections||1,i=g.onMaxConnections,j=function(c){var d=c.id,e=this.getElementObject(c.el),j=this.getDOMElement(e),l=function(){return null==g.parent?null:"parent"===g.parent?c.el.parentNode:f.getDOMElement(g.parent)},m=null!=g.parent?this.getId(l()):d;pb(m),this.sourceEndpointDefinitions[m]={def:g,uniqueEndpoint:g.uniqueEndpoint,maxConnections:h,enabled:!0};var o=t.dragEvents.stop,p=t.dragEvents.drag,q=t.extend({},g.dragOptions||{}),r=q.drag,s=q.stop,u=null,v=!1;q.scope=q.scope||g.scope,q[p]=a.wrap(q[p],function(){r&&r.apply(this,arguments),v=!1}),q[o]=a.wrap(q[o],function(){if(s&&s.apply(this,arguments),this.currentlyDragging=!1,null!=u._jsPlumb){var a=g.anchor||this.Defaults.Anchor,c=u.anchor,e=u.connections[0],f=this.makeAnchor(a,d,this),h=u.element;if(null!=f.positionFinder){var i=b(h,this),j=this.getSize(h),k={left:i.left+c.x*j[0],top:i.top+c.y*j[1]},m=f.positionFinder(k,i,j,f.constructorParams);f.x=m[0],f.y=m[1]}if(u.setAnchor(f,!0),g.parent){var o=l();if(o){var p=g.container||n;u.setElement(o,p)}}u.repaint(),this.repaint(u.elementId),this.repaint(e.targetId)}}.bind(this));var w=function(a){var b=this.getOriginalEvent(a);if(3!==a.which&&2!==a.button){var c=this.sourceEndpointDefinitions[m];if(d=this.getId(this.getDOMElement(e)),c.enabled){if(g.filter){var n=jsPlumbUtil.isString(g.filter)?vb(b,e,g.filter,this,g.filterExclude):g.filter(b,e);if(n===!1)return}var o=this.select({source:m}).length;if(c.maxConnections>=0&&c.uniqueEndpoint&&o>=c.maxConnections)return i&&i({element:e,maxConnections:h},a),!1;var p=jsPlumbAdapter.getPositionOnElement(b,j,k),r={};t.extend(r,g),r.isTemporarySource=!0,r.anchor=[p[0],p[1],0,0],r.dragOptions=q,u=this.addEndpoint(d,r),v=!0,u.endpointWillMoveTo=g.parent?l():null,c.uniqueEndpoint&&(c.endpoint?u.finalEndpoint=c.endpoint:c.endpoint=u),u._doNotDeleteOnDetach=!1,u._deleteOnDetach=!0;var s=function(){f.off(u.canvas,"mouseup",s),f.off(e,"mouseup",s),v&&(v=!1,f.deleteEndpoint(u))};f.on(u.canvas,"mouseup",s),f.on(e,"mouseup",s),f.trigger(u.canvas,"mousedown",a),jsPlumbUtil.consume(a)}}}.bind(this);this.on(e,"mousedown",w),this.sourceEndpointDefinitions[m].trigger=w,g.filter&&jsPlumbUtil.isString(g.filter)&&f.setDragFilter(e,g.filter)}.bind(this),m=c.length&&c.constructor!=String?c:[c],o=0,p=m.length;p>o;o++)j(l(m[o]));return this},this.unmakeSource=function(a,b){var c=l(a),d=this.sourceEndpointDefinitions[c.id].trigger;return d&&f.off(c.el,"mousedown",d),b||delete this.sourceEndpointDefinitions[c.id],this},this.unmakeEverySource=function(){for(var a in this.sourceEndpointDefinitions)f.unmakeSource(a,!0);return this.sourceEndpointDefinitions={},this};var wb=function(a,b){b=jsPlumbUtil.isArray(b)?b:[b];for(var c=X(a),d=0;dg;g++){var i=l(c[g]);f[i.id]&&(f[i.id].enabled=e?!f[i.id].enabled:d)}else{var j=l(c).id;f[j].enabled=e?!f[j].enabled:d}return this}.bind(this),zb=function(b,c){return a.isString(b)||!b.length?c.apply(this,[b]):b.length?c.apply(this,[b[0]]):void 0}.bind(this);this.toggleSourceEnabled=function(a){return yb("source",a,null,!0),this.isSourceEnabled(a)},this.setSourceEnabled=function(a,b){return yb("source",a,b)},this.isSource=function(a){return zb(a,function(a){return null!=this.sourceEndpointDefinitions[l(a).id]}.bind(this))},this.isSourceEnabled=function(a){return zb(a,function(a){var b=this.sourceEndpointDefinitions[l(a).id];return b&&b.enabled===!0}.bind(this))},this.toggleTargetEnabled=function(a){return yb("target",a,null,!0),this.isTargetEnabled(a)},this.isTarget=function(a){return zb(a,function(a){return null!=this.targetEndpointDefinitions[l(a).id]}.bind(this))},this.isTargetEnabled=function(a){return zb(a,function(a){var b=this.targetEndpointDefinitions[l(a).id];return b&&b.enabled===!0}.bind(this))},this.setTargetEnabled=function(a,b){return yb("target",a,b)},this.ready=function(a){f.bind("ready",a) },this.repaint=function(a,b,c){if("object"==typeof a&&a.length)for(var d=0,e=a.length;e>d;d++)I(a[d],b,c);else I(a,b,c);return f},this.revalidate=function(a){var b=f.getId(a);return f.updateOffset({elId:b,recalc:!0}),f.repaint(a)},this.repaintEverything=function(a){var b,d=c();for(b in s)f.updateOffset({elId:b,recalc:!0,timestamp:d});for(b in s)I(b,null,d,a);return this},this.removeAllEndpoints=function(a,b){var c=function(a){var d,e,g=l(a),h=s[g.id];if(h)for(d=0,e=h.length;e>d;d++)f.deleteEndpoint(h[d]);if(delete s[g.id],b&&g.el&&3!=g.el.nodeType&&8!=g.el.nodeType)for(d=0,e=g.el.childNodes.length;e>d;d++)c(g.el.childNodes[d])};return c(a),this},this.remove=function(a,b){var c=l(a);return f.doWhileSuspended(function(){f.removeAllEndpoints(c.id,!0),f.dragManager.elementRemoved(c.id),delete f.floatingConnections[c.id],f.anchorManager.clearFor(c.id),f.anchorManager.removeFloatingConnection(c.id)},b===!1),sb(c.id),c.el&&(f.removeElement(c.el),c.el._jsPlumb=null),f},this.reset=function(){f.setSuspendEvents(!0),f.deleteEveryEndpoint(),f.unbind(),this.targetEndpointDefinitions={},this.sourceEndpointDefinitions={},q.length=0,f.setSuspendEvents(!1)};var Ab=function(a){a.canvas&&a.canvas.parentNode&&a.canvas.parentNode.removeChild(a.canvas),a.cleanup(),a.destroy()},Bb=function(a){Ab(a)};this.clear=function(){f.select().each(Bb),f.selectEndpoints().each(Bb),s={},u={}},this.setDefaultScope=function(a){return D=a,f},this.setDraggable=S,this.setId=function(a,b,c){var d;jsPlumbUtil.isString(a)?d=a:(a=this.getDOMElement(a),d=this.getId(a));var e=this.getConnections({source:d,scope:"*"},!0),f=this.getConnections({target:d,scope:"*"},!0);b=""+b,c?a=this.getDOMElement(b):(a=this.getDOMElement(d),this.setAttribute(a,"id",b)),s[b]=s[d]||[];for(var g=0,h=s[b].length;h>g;g++)s[b][g].setElementId(b),s[b][g].setReferenceElement(a);delete s[d],this.anchorManager.changeId(d,b),this.dragManager&&this.dragManager.changeId(d,b),v[b]=v[d],delete v[d];var i=function(c,d,e){for(var f=0,g=c.length;g>f;f++)c[f].endpoints[d].setElementId(b),c[f].endpoints[d].setReferenceElement(a),c[f][e+"Id"]=b,c[f][e]=a};i(e,0,"source"),i(f,1,"target"),this.repaint(b)},this.setDebugLog=function(a){o=a},this.setSuspendDrawing=function(a,b){var c=B;return B=a,C=a?(new Date).getTime():null,b&&this.repaintEverything(),c},this.isSuspendDrawing=function(){return B},this.getSuspendedAt=function(){return C},this.doWhileSuspended=function(b,c){var d=this.isSuspendDrawing();d||this.setSuspendDrawing(!0);try{b()}catch(e){a.log("Function run while suspended failed",e)}d||this.setSuspendDrawing(!1,!c)},this.getOffset=function(a){return w[a]},this.getCachedData=W,this.timestamp=c,this.setRenderMode=function(a){if(a!==t.SVG&&a!==t.VML)throw new TypeError("Render mode ["+a+"] not supported");return E=jsPlumbAdapter.setRenderMode(a)},this.getRenderMode=function(){return E},this.show=function(a,b){return T(a,"block",b),f},this.toggleVisible=V,this.toggleDraggable=U,this.addListener=this.bind,jsPlumbAdapter.headless||(f.dragManager=jsPlumbAdapter.getDragManager(f),f.recalculateOffsets=f.dragManager.updateOffsets)};jsPlumbUtil.extend(s,jsPlumbUtil.EventGenerator,{setAttribute:function(a,b,c){this.setAttribute(a,b,c)},getAttribute:function(a,b){return this.getAttribute(t.getDOMElement(a),b)},registerConnectionType:function(a,b){this._connectionTypes[a]=t.extend({},b)},registerConnectionTypes:function(a){for(var b in a)this._connectionTypes[b]=t.extend({},a[b])},registerEndpointType:function(a,b){this._endpointTypes[a]=t.extend({},b)},registerEndpointTypes:function(a){for(var b in a)this._endpointTypes[b]=t.extend({},a[b])},getType:function(a,b){return"connection"===b?this._connectionTypes[a]:this._endpointTypes[a]},setIdChanged:function(a,b){this.setId(a,b,!0)},setParent:function(a,b){var c=this.getElementObject(a),d=this.getDOMElement(c),e=this.getId(d),f=this.getElementObject(b),g=this.getDOMElement(f),h=this.getId(g);d.parentNode.removeChild(d),g.appendChild(d),this.dragManager.setParent(c,e,f,h)},getSize:function(a){return[a.offsetWidth,a.offsetHeight]},getWidth:function(a){return a.offsetWidth},getHeight:function(a){return a.offsetHeight},extend:function(a,b,c){var d;if(c)for(d=0;d0)for(var b=0;b0?"add":"remove")+"Class"](h.endpointConnectedClass),this[(this.isFull()?"add":"remove")+"Class"](h.endpointFullClass)},this.detachFromConnection=function(a,b,c){b=null==b?f(a,this):b,b>=0&&(this.connections.splice(b,1),this[(this.connections.length>0?"add":"remove")+"Class"](h.endpointConnectedClass),this[(this.isFull()?"add":"remove")+"Class"](h.endpointFullClass)),!c&&this._deleteOnDetach&&0===this.connections.length&&h.deleteObject({endpoint:this,fireEvent:!1,deleteAttachedObjects:!1})},this.detach=function(a,b,c,d,e,g,i){var j=null==i?f(a,this):i,k=!1;return d=d!==!1,j>=0&&(c||a._forceDetach||a.isDetachable()&&a.isDetachAllowed(a)&&this.isDetachAllowed(a)&&h.checkCondition("beforeDetach",a))&&(h.deleteObject({connection:a,fireEvent:!b&&d,originalEvent:e,deleteAttachedObjects:!1}),k=!0),k},this.detachAll=function(a,b){for(;this.connections.length>0;)this.detach(this.connections[0],!1,!0,a!==!1,b,this,0);return this},this.detachFrom=function(a,b,c){for(var d=[],e=0;e0){var l=e(this,a.elementWithPrecedence),m=l.endpoints[0]==this?1:0,n=0===m?l.sourceId:l.targetId,o=h.getCachedData(n),p=o.o,q=o.s;k.txy=[p.left,p.top],k.twh=q,k.tElement=l.endpoints[m]}g=this.anchor.compute(k)}this.endpoint.compute(g,this.anchor.getOrientation(this),this._jsPlumb.paintStyleInUse,i||this.paintStyleInUse),this.endpoint.paint(this._jsPlumb.paintStyleInUse,this.anchor),this.timestamp=b;for(var r=0;r0}.bind(this),h.initDraggable(this.canvas,p,"internal"),this.canvas._jsPlumbRelatedElement=this.element,q=!0}},(this.isSource||this.isTarget||this.isTemporarySource)&&this.initDraggable();var r=function(a,b,c,d){if((this.isTarget||b)&&jsPlumb.isDropSupported(this.element)){var e=g.dropOptions||h.Defaults.DropOptions||jsPlumb.Defaults.DropOptions;e=jsPlumb.extend({},e),e.scope=e.scope||this.scope;var f=jsPlumb.dragEvents.drop,i=jsPlumb.dragEvents.over,k=jsPlumb.dragEvents.out,l=this,m=h.EndpointDropHandler({getEndpoint:function(){return l},jsPlumb:h,enabled:function(){return null!=d?d.isEnabled():!0},isFull:function(){return d.isFull()},element:this.element,elementId:this.elementId,isSource:this.isSource,isTarget:this.isTarget,addClass:function(a){l.addClass(a)},removeClass:function(a){l.removeClass(a)},isDropAllowed:function(){return l.isDropAllowed.apply(l,arguments)}});e[f]=j.wrap(e[f],m),e[i]=j.wrap(e[i],function(){var a=jsPlumb.getDragObject(arguments),b=h.getAttribute(jsPlumb.getDOMElement(a),"dragId"),c=h.floatingConnections[b];if(null!=c){var d=h.getFloatingAnchorIndex(c),e=this.isTarget&&0!==d||c.suspendedEndpoint&&this.referenceEndpoint&&this.referenceEndpoint.id==c.suspendedEndpoint.id;if(e){var f=h.checkCondition("checkDropAllowed",{sourceEndpoint:c.endpoints[d],targetEndpoint:this,connection:c});this[(f?"add":"remove")+"Class"](h.endpointDropAllowedClass),this[(f?"remove":"add")+"Class"](h.endpointDropForbiddenClass),c.endpoints[d].anchor.over(this.anchor,this)}}}.bind(this)),e[k]=j.wrap(e[k],function(){var a=jsPlumb.getDragObject(arguments),b=null==a?null:h.getAttribute(jsPlumb.getDOMElement(a),"dragId"),c=b?h.floatingConnections[b]:null;if(null!=c){var d=h.getFloatingAnchorIndex(c),e=this.isTarget&&0!==d||c.suspendedEndpoint&&this.referenceEndpoint&&this.referenceEndpoint.id==c.suspendedEndpoint.id;e&&(this.removeClass(h.endpointDropAllowedClass),this.removeClass(h.endpointDropForbiddenClass),c.endpoints[d].anchor.out())}}.bind(this)),h.initDroppable(a,e,"internal",c)}}.bind(this);return this.anchor.isFloating||r(i(this.canvas),!0,!(g._transient||this.anchor.isFloating),this),g.type&&this.addType(g.type,g.data,h.isSuspendDrawing()),this},jsPlumbUtil.extend(jsPlumb.Endpoint,OverlayCapableJsPlumbUIComponent,{getTypeDescriptor:function(){return"endpoint"},isVisible:function(){return this._jsPlumb.visible},setVisible:function(a,b,c){if(this._jsPlumb.visible=a,this.canvas&&(this.canvas.style.display=a?"block":"none"),this[a?"showOverlays":"hideOverlays"](),!b)for(var d=0;db.dist?1:0});for(var o=k[0].source,p=k[0].target,q=0;qc[0][0],d===!1?-1:1}},p=function(a,b){var c=a[0][0]<0?-Math.PI-a[0][0]:Math.PI-a[0][0],d=b[0][0]<0?-Math.PI-b[0][0]:Math.PI-b[0][0];return c>d?1:a[0][1]>b[0][1]?1:-1},q={top:function(a,b){return a[0]>b[0]?1:-1},right:o(!0),bottom:o(!0),left:p},r=function(a,b){return a.sort(b)},s=function(a,b){var d=k.getCachedData(a),f=d.s,g=d.o,h=function(b,d,f,g,h,i,j){if(g.length>0)for(var k=r(g,q[b]),l="right"===b||"top"===b,m=n(b,d,f,k,h,i,l),o=function(a,b){c[a.id]=[b[0],b[1],b[2],b[3]],e[a.id]=j},p=0;p-1&&(h[b].splice(f,1),jsPlumbUtil.addToList(h,c,[d,d.endpoints[0],d.endpoints[0].anchor.constructor==jsPlumb.DynamicAnchor]))},this.sourceChanged=function(a,b,c){if(a!==b){jsPlumbUtil.removeWithFunction(h[a],function(a){return a[0].id===c.id});var d=jsPlumbUtil.findWithFunction(h[c.targetId],function(a){return a[0].id===c.id});d>-1&&(h[c.targetId][d][0]=c,h[c.targetId][d][1]=c.endpoints[0],h[c.targetId][d][2]=c.endpoints[0].anchor.constructor==jsPlumb.DynamicAnchor),jsPlumbUtil.addToList(h,b,[c,c.endpoints[1],c.endpoints[1].anchor.constructor==jsPlumb.DynamicAnchor])}},this.rehomeEndpoint=function(a,c,d){var e=b[c]||[],f=k.getId(d);if(f!==c){var g=jsPlumbUtil.indexOf(e,a);if(g>-1){var h=e.splice(g,1)[0];i.add(h,f)}}for(var j=0;j0?this.anchors[0]:null,e=(this.anchors.length>0?0:-1,d),f=this,g=function(a,b,c,d,e){var f=d[0]+a.x*e[0],g=d[1]+a.y*e[1],h=d[0]+e[0]/2,i=d[1]+e[1]/2;return Math.sqrt(Math.pow(b-f,2)+Math.pow(c-g,2))+Math.sqrt(Math.pow(h-f,2)+Math.pow(i-g,2))},h=b.selector||function(a,b,c,d,e){for(var f=c[0]+d[0]/2,h=c[1]+d[1]/2,i=-1,j=1/0,k=0;kl&&(i=k+0,j=l)}return e[i]};this.compute=function(a){var b=a.xy,c=a.wh,g=a.timestamp,i=a.txy,j=a.twh;this.timestamp=g;var k=f.getUserDefinedLocation();return null!=k?k:this.locked||null==i||null==j?d.compute(a):(a.timestamp=null,d=h(b,c,i,j,this.anchors),this.x=d.x,this.y=d.y,d!=e&&this.fire("anchorChanged",d),e=d,d.compute(a))},this.getCurrentLocation=function(a){return this.getUserDefinedLocation()||(null!=d?d.getCurrentLocation(a):null)},this.getOrientation=function(a){return null!=d?d.getOrientation(a):[0,0]},this.over=function(a,b){null!=d&&d.over(a,b)},this.out=function(){null!=d&&d.out()},this.getCssClass=function(){return d&&d.getCssClass()||""}},jsPlumbUtil.extend(jsPlumb.DynamicAnchor,jsPlumb.Anchor);var b=function(a,b,c,d,e,f){jsPlumb.Anchors[e]=function(g){var h=g.jsPlumbInstance.makeAnchor([a,b,c,d,0,0],g.elementId,g.jsPlumbInstance);return h.type=e,f&&f(h,g),h}};b(.5,0,0,-1,"TopCenter"),b(.5,1,0,1,"BottomCenter"),b(0,.5,-1,0,"LeftMiddle"),b(1,.5,1,0,"RightMiddle"),b(.5,0,0,-1,"Top"),b(.5,1,0,1,"Bottom"),b(0,.5,-1,0,"Left"),b(1,.5,1,0,"Right"),b(.5,.5,0,0,"Center"),b(1,0,0,-1,"TopRight"),b(1,1,0,1,"BottomRight"),b(0,0,0,-1,"TopLeft"),b(0,1,0,1,"BottomLeft"),jsPlumb.Defaults.DynamicAnchors=function(a){return a.jsPlumbInstance.makeAnchors(["TopCenter","RightMiddle","BottomCenter","LeftMiddle"],a.elementId,a.jsPlumbInstance)},jsPlumb.Anchors.AutoDefault=function(a){var b=a.jsPlumbInstance.makeDynamicAnchor(jsPlumb.Defaults.DynamicAnchors(a));return b.type="AutoDefault",b};var c=function(a,b){jsPlumb.Anchors[a]=function(c){var d=c.jsPlumbInstance.makeAnchor(["Continuous",{faces:b}],c.elementId,c.jsPlumbInstance);return d.type=a,d}};jsPlumb.Anchors.Continuous=function(a){return a.jsPlumbInstance.continuousAnchorFactory.get(a)},c("ContinuousLeft",["left"]),c("ContinuousTop",["top"]),c("ContinuousBottom",["bottom"]),c("ContinuousRight",["right"]),b(0,0,0,0,"Assign",function(a,b){var c=b.position||"Fixed";a.positionFinder=c.constructor==String?b.jsPlumbInstance.AnchorPositionFinders[c]:c,a.constructorParams=b}),jsPlumbInstance.prototype.AnchorPositionFinders={Fixed:function(a,b,c){return[(a.left-b.left)/c[0],(a.top-b.top)/c[1]]},Grid:function(a,b,c,d){var e=a.left-b.left,f=a.top-b.top,g=c[0]/d.grid[0],h=c[1]/d.grid[1],i=Math.floor(e/g),j=Math.floor(f/h);return[(i*g+g/2)/c[0],(j*h+h/2)/c[1]]}},jsPlumb.Anchors.Perimeter=function(a){a=a||{};var b=a.anchorCount||60,c=a.shape;if(!c)throw new Error("no shape supplied to Perimeter Anchor type");var d=function(){for(var a=.5,c=2*Math.PI/b,d=0,e=[],f=0;b>f;f++){var g=a+a*Math.sin(d),h=a+a*Math.cos(d);e.push([g,h,0,0]),d+=c}return e},e=function(a){for(var c=b/a.length,d=[],e=function(a,e,f,g,h){c=b*h;for(var i=(f-a)/c,j=(g-e)/c,k=0;c>k;k++)d.push([a+i*k,e+j*k,0,0])},f=0;f0?a:b+a:a*b;return Biltong.pointOnLine({x:e,y:g},{x:f,y:h},d)}return{x:f,y:h}}return{x:e,y:g}},this.gradientAtPoint=function(){return c},this.pointAlongPathFrom=function(a,b,c){var d=this.pointOnPath(a,c),i=0>=b?{x:e,y:g}:{x:f,y:h};return 0>=b&&Math.abs(b)>1&&(b*=-1),Biltong.pointOnLine(d,i,b)};var j=function(a,b,c){return c>=Math.min(a,b)&&c<=Math.max(a,b)},k=function(a,b,c){return Math.abs(c-a)a-b?b:i>c-a?c:a};this.pointOnPath=function(b,d){if(0===b)return{x:this.x1,y:this.y1,theta:this.startAngle};if(1==b)return{x:this.x2,y:this.y2,theta:this.endAngle};d&&(b/=h);var e=c(this,b),f=a.cx+a.r*Math.cos(e),g=a.cy+a.r*Math.sin(e);return{x:j(f),y:j(g),theta:e}},this.gradientAtPoint=function(b,c){var d=this.pointOnPath(b,c),e=Biltong.normal([a.cx,a.cy],[d.x,d.y]);return this.anticlockwise||1/0!=e&&e!=-1/0||(e*=-1),e},this.pointAlongPathFrom=function(b,c,d){var e=this.pointOnPath(b,d),g=2*(c/f)*Math.PI,h=this.anticlockwise?-1:1,i=e.theta+h*g,j=a.cx+this.radius*Math.cos(i),k=a.cy+this.radius*Math.sin(i);return{x:j,y:k}}},Bezier:function(a){this.curve=[{x:a.x1,y:a.y1},{x:a.cp1x,y:a.cp1y},{x:a.cp2x,y:a.cp2y},{x:a.x2,y:a.y2}],jsPlumb.Segments.AbstractSegment.apply(this,arguments),this.bounds={minX:Math.min(a.x1,a.x2,a.cp1x,a.cp2x),minY:Math.min(a.y1,a.y2,a.cp1y,a.cp2y),maxX:Math.max(a.x1,a.x2,a.cp1x,a.cp2x),maxY:Math.max(a.y1,a.y2,a.cp1y,a.cp2y)},this.type="Bezier";var b=function(a,b,c){return c&&(b=jsBezier.locationAlongCurveFrom(a,b>0?0:1,b)),b};this.pointOnPath=function(a,c){return a=b(this.curve,a,c),jsBezier.pointOnCurve(this.curve,a)},this.gradientAtPoint=function(a,c){return a=b(this.curve,a,c),jsBezier.gradientAtPoint(this.curve,a)},this.pointAlongPathFrom=function(a,c,d){return a=b(this.curve,a,d),jsBezier.pointAlongCurveFrom(this.curve,a,c)},this.getLength=function(){return jsBezier.getLength(this.curve)},this.getBounds=function(){return this.bounds}}};var a=function(){this.resetBounds=function(){this.bounds={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}},this.resetBounds()};jsPlumb.Connectors.AbstractConnector=function(b){a.apply(this,arguments);var c=[],d=0,e=[],f=[],g=b.stub||0,h=jsPlumbUtil.isArray(g)?g[0]:g,i=jsPlumbUtil.isArray(g)?g[1]:g,j=b.gap||0,k=jsPlumbUtil.isArray(j)?j[0]:j,l=jsPlumbUtil.isArray(j)?j[1]:j,m=null,n=!1,o=null;this.getPath=function(){},this.setPath=function(){},this.findSegmentForPoint=function(a,b){for(var d={d:1/0,s:null,x:null,y:null,l:null},e=0;e0?a/d:(d+a)/d);for(var g=e.length-1,h=1,i=0;i=a){g=i,h=1==a?1:0===a?0:(a-e[i][0])/f[i];break}return{segment:c[g],proportion:h,index:g}},r=function(a,b,e){if(e.x1!=e.x2||e.y1!=e.y2){var f=new jsPlumb.Segments[b](e);c.push(f),d+=f.getLength(),a.updateBounds(f)}},s=function(){d=c.length=e.length=f.length=0};this.setSegments=function(a){m=[],d=0;for(var b=0;bo?0:1,q=[1,0][p];f=[],g=[],f[p]=a.sourcePos[p]>a.targetPos[p]?-1:1,g[p]=a.sourcePos[p]>a.targetPos[p]?1:-1,f[q]=0,g[q]=0}var r=c?n+k*f[0]:k*f[0],s=d?o+k*f[1]:k*f[1],t=c?l*g[0]:n+l*g[0],u=d?l*g[1]:o+l*g[1],v=f[0]*g[0]+f[1]*g[1],w={sx:r,sy:s,tx:t,ty:u,lw:e,xSpan:Math.abs(t-r),ySpan:Math.abs(u-s),mx:(r+t)/2,my:(s+u)/2,so:f,to:g,x:j,y:m,w:n,h:o,segment:b,startStubX:r+f[0]*h,startStubY:s+f[1]*h,endStubX:t+g[0]*i,endStubY:u+g[1]*i,isXGreaterThanStubTimes2:Math.abs(r-t)>h+i,isYGreaterThanStubTimes2:Math.abs(s-u)>h+i,opposite:-1==v,perpendicular:0===v,orthogonal:1==v,sourceAxis:0===f[0]?"y":"x",points:[j,m,n,o,r,s,t,u]};return w.anchorOrientation=w.opposite?"opposite":w.orthogonal?"orthogonal":"perpendicular",w};return this.getSegments=function(){return c},this.updateBounds=function(a){var b=a.getBounds();this.bounds.minX=Math.min(this.bounds.minX,b.minX),this.bounds.maxX=Math.max(this.bounds.maxX,b.maxX),this.bounds.minY=Math.min(this.bounds.minY,b.minY),this.bounds.maxY=Math.max(this.bounds.maxY,b.maxY)},this.pointOnPath=function(a,b){var c=q(a,b);return c.segment&&c.segment.pointOnPath(c.proportion,!1)||[0,0]},this.gradientAtPoint=function(a,b){var c=q(a,b);return c.segment&&c.segment.gradientAtPoint(c.proportion,!1)||0},this.pointAlongPathFrom=function(a,b,c){var d=q(a,c);return d.segment&&d.segment.pointAlongPathFrom(d.proportion,b,!1)||[0,0]},this.compute=function(a){n||(o=t.call(this,a)),s(),this._compute(o,a),this.x=o.points[0],this.y=o.points[1],this.w=o.points[2],this.h=o.points[3],this.segment=o.segment,p()},{addSegment:r,prepareCompute:t,sourceStub:h,targetStub:i,maxStub:Math.max(h,i),sourceGap:k,targetGap:l,maxGap:Math.max(k,l)}},jsPlumbUtil.extend(jsPlumb.Connectors.AbstractConnector,a);var b=jsPlumb.Connectors.Straight=function(){this.type="Straight";var a=jsPlumb.Connectors.AbstractConnector.apply(this,arguments);this._compute=function(b){a.addSegment(this,"Straight",{x1:b.sx,y1:b.sy,x2:b.startStubX,y2:b.startStubY}),a.addSegment(this,"Straight",{x1:b.startStubX,y1:b.startStubY,x2:b.endStubX,y2:b.endStubY}),a.addSegment(this,"Straight",{x1:b.endStubX,y1:b.endStubY,x2:b.tx,y2:b.ty})}};jsPlumbUtil.extend(jsPlumb.Connectors.Straight,jsPlumb.Connectors.AbstractConnector),jsPlumb.registerConnectorType(b,"Straight"),jsPlumb.Endpoints.AbstractEndpoint=function(b){a.apply(this,arguments);var c=this.compute=function(){var a=this._compute.apply(this,arguments);return this.x=a[0],this.y=a[1],this.w=a[2],this.h=a[3],this.bounds.minX=this.x,this.bounds.minY=this.y,this.bounds.maxX=this.x+this.w,this.bounds.maxY=this.y+this.h,a};return{compute:c,cssClass:b.cssClass}},jsPlumbUtil.extend(jsPlumb.Endpoints.AbstractEndpoint,a),jsPlumb.Endpoints.Dot=function(a){this.type="Dot",jsPlumb.Endpoints.AbstractEndpoint.apply(this,arguments),a=a||{},this.radius=a.radius||10,this.defaultOffset=.5*this.radius,this.defaultInnerRadius=this.radius/3,this._compute=function(a,b,c){this.radius=c.radius||this.radius;var d=a[0]-this.radius,e=a[1]-this.radius,f=2*this.radius,g=2*this.radius;if(c.strokeStyle){var h=c.lineWidth||1;d-=h,e-=h,f+=2*h,g+=2*h}return[d,e,f,g,this.radius]}},jsPlumbUtil.extend(jsPlumb.Endpoints.Dot,jsPlumb.Endpoints.AbstractEndpoint),jsPlumb.Endpoints.Rectangle=function(a){this.type="Rectangle",jsPlumb.Endpoints.AbstractEndpoint.apply(this,arguments),a=a||{},this.width=a.width||20,this.height=a.height||20,this._compute=function(a,b,c){var d=c.width||this.width,e=c.height||this.height,f=a[0]-d/2,g=a[1]-e/2;return[f,g,d,e]}},jsPlumbUtil.extend(jsPlumb.Endpoints.Rectangle,jsPlumb.Endpoints.AbstractEndpoint);var c=function(){jsPlumb.jsPlumbUIComponent.apply(this,arguments),this._jsPlumb.displayElements=[]};jsPlumbUtil.extend(c,jsPlumb.jsPlumbUIComponent,{getDisplayElements:function(){return this._jsPlumb.displayElements},appendDisplayElement:function(a){this._jsPlumb.displayElements.push(a)}}),jsPlumb.Endpoints.Image=function(a){this.type="Image",c.apply(this,arguments),jsPlumb.Endpoints.AbstractEndpoint.apply(this,arguments);var b=a.onload,d=a.src||a.url,e=a.cssClass?" "+a.cssClass:"";this._jsPlumb.img=new Image,this._jsPlumb.ready=!1,this._jsPlumb.initialized=!1,this._jsPlumb.deleted=!1,this._jsPlumb.widthToUse=a.width,this._jsPlumb.heightToUse=a.height,this._jsPlumb.endpoint=a.endpoint,this._jsPlumb.img.onload=function(){null!=this._jsPlumb&&(this._jsPlumb.ready=!0,this._jsPlumb.widthToUse=this._jsPlumb.widthToUse||this._jsPlumb.img.width,this._jsPlumb.heightToUse=this._jsPlumb.heightToUse||this._jsPlumb.img.height,b&&b(this)) }.bind(this),this._jsPlumb.endpoint.setImage=function(a,c){var d=a.constructor==String?a:a.src;b=c,this._jsPlumb.img.src=d,null!=this.canvas&&this.canvas.setAttribute("src",this._jsPlumb.img.src)}.bind(this),this._jsPlumb.endpoint.setImage(d,b),this._compute=function(a){return this.anchorPoint=a,this._jsPlumb.ready?[a[0]-this._jsPlumb.widthToUse/2,a[1]-this._jsPlumb.heightToUse/2,this._jsPlumb.widthToUse,this._jsPlumb.heightToUse]:[0,0,0,0]},this.canvas=document.createElement("img"),this.canvas.style.margin=0,this.canvas.style.padding=0,this.canvas.style.outline=0,this.canvas.style.position="absolute",this.canvas.className=this._jsPlumb.instance.endpointClass+e,this._jsPlumb.widthToUse&&this.canvas.setAttribute("width",this._jsPlumb.widthToUse),this._jsPlumb.heightToUse&&this.canvas.setAttribute("height",this._jsPlumb.heightToUse),this._jsPlumb.instance.appendElement(this.canvas),this.actuallyPaint=function(){if(!this._jsPlumb.deleted){this._jsPlumb.initialized||(this.canvas.setAttribute("src",this._jsPlumb.img.src),this.appendDisplayElement(this.canvas),this._jsPlumb.initialized=!0);var a=this.anchorPoint[0]-this._jsPlumb.widthToUse/2,b=this.anchorPoint[1]-this._jsPlumb.heightToUse/2;jsPlumbUtil.sizeElement(this.canvas,a,b,this._jsPlumb.widthToUse,this._jsPlumb.heightToUse)}},this.paint=function(a,b){null!=this._jsPlumb&&(this._jsPlumb.ready?this.actuallyPaint(a,b):window.setTimeout(function(){this.paint(a,b)}.bind(this),200))}},jsPlumbUtil.extend(jsPlumb.Endpoints.Image,[c,jsPlumb.Endpoints.AbstractEndpoint],{cleanup:function(){this._jsPlumb.deleted=!0,this.canvas&&this.canvas.parentNode.removeChild(this.canvas),this.canvas=null}}),jsPlumb.Endpoints.Blank=function(a){jsPlumb.Endpoints.AbstractEndpoint.apply(this,arguments),this.type="Blank",c.apply(this,arguments),this._compute=function(a){return[a[0],a[1],10,0]};var b=a.cssClass?" "+a.cssClass:"";this.canvas=document.createElement("div"),this.canvas.style.display="block",this.canvas.style.width="1px",this.canvas.style.height="1px",this.canvas.style.background="transparent",this.canvas.style.position="absolute",this.canvas.className=this._jsPlumb.instance.endpointClass+b,this._jsPlumb.instance.appendElement(this.canvas),this.paint=function(){jsPlumbUtil.sizeElement(this.canvas,this.x,this.y,this.w,this.h)}},jsPlumbUtil.extend(jsPlumb.Endpoints.Blank,[jsPlumb.Endpoints.AbstractEndpoint,c],{cleanup:function(){this.canvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}}),jsPlumb.Endpoints.Triangle=function(a){this.type="Triangle",jsPlumb.Endpoints.AbstractEndpoint.apply(this,arguments),a=a||{},a.width=a.width||55,a.height=a.height||55,this.width=a.width,this.height=a.height,this._compute=function(a,b,c){var d=c.width||self.width,e=c.height||self.height,f=a[0]-d/2,g=a[1]-e/2;return[f,g,d,e]}};var d=jsPlumb.Overlays.AbstractOverlay=function(a){this.visible=!0,this.isAppendedAtTopLevel=!0,this.component=a.component,this.loc=null==a.location?.5:a.location,this.endpointLoc=null==a.endpointLocation?[.5,.5]:a.endpointLocation};d.prototype={cleanup:function(){this.component=null,this.canvas=null,this.endpointLoc=null},setVisible:function(a){this.visible=a,this.component.repaint()},isVisible:function(){return this.visible},hide:function(){this.setVisible(!1)},show:function(){this.setVisible(!0)},incrementLocation:function(a){this.loc+=a,this.component.repaint()},setLocation:function(a){this.loc=a,this.component.repaint()},getLocation:function(){return this.loc}},jsPlumb.Overlays.Arrow=function(a){this.type="Arrow",d.apply(this,arguments),this.isAppendedAtTopLevel=!1,a=a||{};var b=jsPlumbUtil,c=Biltong;this.length=a.length||20,this.width=a.width||20,this.id=a.id;var e=(a.direction||1)<0?-1:1,f=a.paintStyle||{lineWidth:1},g=a.foldback||.623;this.computeMaxSize=function(){return 1.5*self.width},this.draw=function(a,d){var h,i,j,k,l;if(a.pointAlongPathFrom){if(b.isString(this.loc)||this.loc>1||this.loc<0){var m=parseInt(this.loc,10),n=this.loc<0?1:0;h=a.pointAlongPathFrom(n,m,!1),i=a.pointAlongPathFrom(n,m-e*this.length/2,!1),j=c.pointOnLine(h,i,this.length)}else if(1==this.loc){if(h=a.pointOnPath(this.loc),i=a.pointAlongPathFrom(this.loc,-this.length),j=c.pointOnLine(h,i,this.length),-1==e){var o=j;j=h,h=o}}else if(0===this.loc){if(j=a.pointOnPath(this.loc),i=a.pointAlongPathFrom(this.loc,this.length),h=c.pointOnLine(j,i,this.length),-1==e){var p=j;j=h,h=p}}else h=a.pointAlongPathFrom(this.loc,e*this.length/2),i=a.pointOnPath(this.loc),j=c.pointOnLine(h,i,this.length);k=c.perpendicularLineTo(h,j,this.width),l=c.pointOnLine(h,j,g*this.length);var q={hxy:h,tail:k,cxy:l},r=f.strokeStyle||d.strokeStyle,s=f.fillStyle||d.strokeStyle,t=f.lineWidth||d.lineWidth;return{component:a,d:q,lineWidth:t,strokeStyle:r,fillStyle:s,minX:Math.min(h.x,k[0].x,k[1].x),maxX:Math.max(h.x,k[0].x,k[1].x),minY:Math.min(h.y,k[0].y,k[1].y),maxY:Math.max(h.y,k[0].y,k[1].y)}}return{component:a,minX:0,maxX:0,minY:0,maxY:0}}},jsPlumbUtil.extend(jsPlumb.Overlays.Arrow,d),jsPlumb.Overlays.PlainArrow=function(a){a=a||{};var b=jsPlumb.extend(a,{foldback:1});jsPlumb.Overlays.Arrow.call(this,b),this.type="PlainArrow"},jsPlumbUtil.extend(jsPlumb.Overlays.PlainArrow,jsPlumb.Overlays.Arrow),jsPlumb.Overlays.Diamond=function(a){a=a||{};var b=a.length||40,c=jsPlumb.extend(a,{length:b/2,foldback:2});jsPlumb.Overlays.Arrow.call(this,c),this.type="Diamond"},jsPlumbUtil.extend(jsPlumb.Overlays.Diamond,jsPlumb.Overlays.Arrow);var e=function(a,b){return(null==a._jsPlumb.cachedDimensions||b)&&(a._jsPlumb.cachedDimensions=a.getDimensions()),a._jsPlumb.cachedDimensions},f=function(a){jsPlumb.jsPlumbUIComponent.apply(this,arguments),d.apply(this,arguments);var b=this.fire;this.fire=function(){b.apply(this,arguments),this.component&&this.component.fire.apply(this.component,arguments)},this.id=a.id,this._jsPlumb.div=null,this._jsPlumb.initialised=!1,this._jsPlumb.component=a.component,this._jsPlumb.cachedDimensions=null,this._jsPlumb.create=a.create,this._jsPlumb.initiallyInvisible=a.visible===!1,this.getElement=function(){if(null==this._jsPlumb.div){var b=this._jsPlumb.div=jsPlumb.getDOMElement(this._jsPlumb.create(this._jsPlumb.component));b.style.position="absolute",b.className=this._jsPlumb.instance.overlayClass+" "+(this.cssClass?this.cssClass:a.cssClass?a.cssClass:""),this._jsPlumb.instance.appendElement(b),this._jsPlumb.instance.getId(b),this.canvas=b;var c="translate(-50%, -50%)";b.style.webkitTransform=c,b.style.mozTransform=c,b.style.msTransform=c,b.style.oTransform=c,b.style.transform=c,b._jsPlumb=this,a.visible===!1&&(b.style.display="none")}return this._jsPlumb.div},this.draw=function(a,b,c){var d=e(this);if(null!=d&&2==d.length){var f={x:0,y:0};if(c)f={x:c[0],y:c[1]};else if(a.pointOnPath){var g=this.loc,h=!1;(jsPlumbUtil.isString(this.loc)||this.loc<0||this.loc>1)&&(g=parseInt(this.loc,10),h=!0),f=a.pointOnPath(g,h)}else{var i=this.loc.constructor==Array?this.loc:this.endpointLoc;f={x:i[0]*a.w,y:i[1]*a.h}}var j=f.x-d[0]/2,k=f.y-d[1]/2;return{component:a,d:{minx:j,miny:k,td:d,cxy:f},minX:j,maxX:j+d[0],minY:k,maxY:k+d[1]}}return{minX:0,maxX:0,minY:0,maxY:0}}};jsPlumbUtil.extend(f,[jsPlumb.jsPlumbUIComponent,d],{getDimensions:function(){return jsPlumbUtil.oldIE?jsPlumb.getSize(this.getElement()):[1,1]},setVisible:function(a){this._jsPlumb.div.style.display=a?"block":"none",a&&this._jsPlumb.initiallyInvisible&&(e(this,!0),this.component.repaint(),this._jsPlumb.initiallyInvisible=!1)},clearCachedDimensions:function(){this._jsPlumb.cachedDimensions=null},cleanup:function(){null!=this._jsPlumb.div&&(this._jsPlumb.div._jsPlumb=null,this._jsPlumb.instance.removeElement(this._jsPlumb.div))},computeMaxSize:function(){var a=e(this);return Math.max(a[0],a[1])},paint:function(a){this._jsPlumb.initialised||(this.getElement(),a.component.appendDisplayElement(this._jsPlumb.div),this._jsPlumb.initialised=!0),this._jsPlumb.div.style.left=a.component.x+a.d.minx+"px",this._jsPlumb.div.style.top=a.component.y+a.d.miny+"px"}}),jsPlumb.Overlays.Custom=function(){this.type="Custom",f.apply(this,arguments)},jsPlumbUtil.extend(jsPlumb.Overlays.Custom,f),jsPlumb.Overlays.GuideLines=function(){var a=this;a.length=50,a.lineWidth=5,this.type="GuideLines",d.apply(this,arguments),jsPlumb.jsPlumbUIComponent.apply(this,arguments),this.draw=function(b){var c=b.pointAlongPathFrom(a.loc,a.length/2),d=b.pointOnPath(a.loc),e=Biltong.pointOnLine(c,d,a.length),f=Biltong.perpendicularLineTo(c,e,40),g=Biltong.perpendicularLineTo(e,c,20);return{connector:b,head:c,tail:e,headLine:g,tailLine:f,minX:Math.min(c.x,e.x,g[0].x,g[1].x),minY:Math.min(c.y,e.y,g[0].y,g[1].y),maxX:Math.max(c.x,e.x,g[0].x,g[1].x),maxY:Math.max(c.y,e.y,g[0].y,g[1].y)}}},jsPlumb.Overlays.Label=function(a){this.labelStyle=a.labelStyle,this.cssClass=null!=this.labelStyle?this.labelStyle.cssClass:null;var b=jsPlumb.extend({create:function(){return document.createElement("div")}},a);if(jsPlumb.Overlays.Custom.call(this,b),this.type="Label",this.label=a.label||"",this.labelText=null,this.labelStyle){var c=this.getElement();if(this.labelStyle.font=this.labelStyle.font||"12px sans-serif",c.style.font=this.labelStyle.font,c.style.color=this.labelStyle.color||"black",this.labelStyle.fillStyle&&(c.style.background=this.labelStyle.fillStyle),this.labelStyle.borderWidth>0){var d=this.labelStyle.borderStyle?this.labelStyle.borderStyle:"black";c.style.border=this.labelStyle.borderWidth+"px solid "+d}this.labelStyle.padding&&(c.style.padding=this.labelStyle.padding)}},jsPlumbUtil.extend(jsPlumb.Overlays.Label,jsPlumb.Overlays.Custom,{cleanup:function(){this.div=null,this.label=null,this.labelText=null,this.cssClass=null,this.labelStyle=null},getLabel:function(){return this.label},setLabel:function(a){this.label=a,this.labelText=null,this.clearCachedDimensions(),this.update(),this.component.repaint()},getDimensions:function(){return this.update(),f.prototype.getDimensions.apply(this,arguments)},update:function(){if("function"==typeof this.label){var a=this.label(this);this.getElement().innerHTML=a.replace(/\r\n/g,"
")}else null==this.labelText&&(this.labelText=this.label,this.getElement().innerHTML=this.labelText.replace(/\r\n/g,"
"))}})}(),function(){"use strict";var a=function(a){var b=a._mottle;return b||(b=a._mottle=new Mottle),b};jsPlumb.extend(jsPlumbInstance.prototype,{getEventManager:function(){return a(this)},on:function(){this.getEventManager().on.apply(this,arguments)},off:function(){this.getEventManager().off.apply(this,arguments)}})}.call(this),function(){"use strict";var a=function(a){this.type="Flowchart",a=a||{},a.stub=null==a.stub?30:a.stub;var b,c=jsPlumb.Connectors.AbstractConnector.apply(this,arguments),d=null==a.midpoint?.5:a.midpoint,e=[],f=(a.grid,a.alwaysRespectStubs),g=null,h=null,i=null,j=null!=a.cornerRadius?a.cornerRadius:0,k=function(a){return 0>a?-1:0===a?0:1},l=function(a,b,c,d){if(h!=b||i!=c){var e=null==h?d.sx:h,f=null==i?d.sy:i,g=e==b?"v":"h",j=k(b-e),l=k(c-f);h=b,i=c,a.push([e,f,b,c,g,j,l])}},m=function(a){return Math.sqrt(Math.pow(a[0]-a[2],2)+Math.pow(a[1]-a[3],2))},n=function(a){var b=[];return b.push.apply(b,a),b},o=function(a,b,d){for(var e,f,g=0;g0&&e[4]!=f[4]){var h=Math.min(j,m(e),m(f));e[2]-=e[5]*h,e[3]-=e[6]*h,f[0]+=f[5]*h,f[1]+=f[6]*h;var i=e[6]==f[5]&&1==f[5]||e[6]==f[5]&&0===f[5]&&e[5]!=f[6]||e[6]==f[5]&&-1==f[5],k=f[1]>e[3]?1:-1,l=f[0]>e[2]?1:-1,o=k==l,p=o&&i||!o&&!i?f[0]:e[2],q=o&&i||!o&&!i?e[3]:f[1];c.addSegment(a,"Straight",{x1:e[0],y1:e[1],x2:e[2],y2:e[3]}),c.addSegment(a,"Arc",{r:h,x1:e[2],y1:e[3],x2:f[0],y2:f[1],cx:p,cy:q,ac:i})}else{var r=e[2]==e[0]?0:e[2]>e[0]?d.lw/2:-(d.lw/2),s=e[3]==e[1]?0:e[3]>e[1]?d.lw/2:-(d.lw/2);c.addSegment(a,"Straight",{x1:e[0]-r,y1:e[1]-s,x2:e[2]+r,y2:e[3]+s})}e=f}null!=f&&c.addSegment(a,"Straight",{x1:f[0],y1:f[1],x2:f[2],y2:f[3]})};this.setSegments=function(a){g=a},this.isEditable=function(){return!0},this.getOriginalSegments=function(){return g||e},this._compute=function(a,j){if(j.clearEdits&&(g=null),null!=g)return o(this,g,a),void 0;e=[],h=null,i=null,b=null;var k=a.startStubX+(a.endStubX-a.startStubX)*d,m=a.startStubY+(a.endStubY-a.startStubY)*d,n={x:[0,1],y:[1,0]},p=function(){return[a.startStubX,a.startStubY,a.endStubX,a.endStubY]},q={perpendicular:p,orthogonal:p,opposite:function(b){var c=a,d="x"==b?0:1,e={x:function(){return 1==c.so[d]&&(c.startStubX>c.endStubX&&c.tx>c.startStubX||c.sx>c.endStubX&&c.tx>c.sx)||-1==c.so[d]&&(c.startStubXc.endStubY&&c.ty>c.startStubY||c.sy>c.endStubY&&c.ty>c.sy)||-1==c.so[d]&&(c.startStubYj[b][0],s=e[b][p][0],t=e[b][p][1],u=d[b][p][q];return c.segment==u[3]||c.segment==u[2]&&r?f[b]:c.segment==u[2]&&s>t?g[b]:c.segment==u[2]&&t>=s||c.segment==u[1]&&!r?i[b]:c.segment==u[0]||c.segment==u[1]&&r?h[b]:void 0},orthogonal:function(b,c,d,e,f){var g=a,h={x:-1==g.so[0]?Math.min(c,e):Math.max(c,e),y:-1==g.so[1]?Math.min(c,e):Math.max(c,e)}[b];return{x:[[h,d],[h,f],[e,f]],y:[[d,h],[f,h],[f,e]]}[b]},opposite:function(b,d,e,f){var g=a,h={x:"y",y:"x"}[b],i={x:"height",y:"width"}[b],l=g["is"+b.toUpperCase()+"GreaterThanStubTimes2"];if(j.sourceEndpoint.elementId==j.targetEndpoint.elementId){var n=e+(1-j.sourceEndpoint.anchor[h])*j.sourceInfo[i]+c.maxStub;return{x:[[d,n],[f,n]],y:[[n,d],[n,f]]}[b]}return!l||1==g.so[t]&&d>f||-1==g.so[t]&&f>d?{x:[[d,m],[f,m]],y:[[k,d],[k,f]]}[b]:1==g.so[t]&&f>d||-1==g.so[t]&&d>f?{x:[[k,g.sy],[k,g.ty]],y:[[g.sx,m],[g.tx,m]]}[b]:void 0}},s=q[a.anchorOrientation](a.sourceAxis),t="x"==a.sourceAxis?0:1,u="x"==a.sourceAxis?1:0,v=s[t],w=s[u],x=s[t+2],y=s[u+2];l(e,s[0],s[1],a);var z=r[a.anchorOrientation](a.sourceAxis,v,w,x,y);if(z)for(var A=0;A=a&&b>=d?1:c>=a&&d>=b?2:a>=c&&d>=b?3:4},b=function(a,b,c,d,e,f,g,h,i){return i>=h?[a,b]:1===c?d[3]<=0&&e[3]>=1?[a+(d[2]<.5?-1*f:f),b]:d[2]>=1&&e[2]<=0?[a,b+(d[3]<.5?-1*g:g)]:[a+-1*f,b+-1*g]:2===c?d[3]>=1&&e[3]<=0?[a+(d[2]<.5?-1*f:f),b]:d[2]>=1&&e[2]<=0?[a,b+(d[3]<.5?-1*g:g)]:[a+1*f,b+-1*g]:3===c?d[3]>=1&&e[3]<=0?[a+(d[2]<.5?-1*f:f),b]:d[2]<=0&&e[2]>=1?[a,b+(d[3]<.5?-1*g:g)]:[a+-1*f,b+-1*g]:4===c?d[3]<=0&&e[3]>=1?[a+(d[2]<.5?-1*f:f),b]:d[2]<=0&&e[2]>=1?[a,b+(d[3]<.5?-1*g:g)]:[a+1*f,b+-1*g]:void 0},c=function(c){c=c||{},this.type="StateMachine";var d=jsPlumb.Connectors.AbstractConnector.apply(this,arguments),e=c.curviness||10,f=c.margin||5,g=c.proximityLimit||80,h=c.orientation&&"clockwise"===c.orientation,i=c.loopbackRadius||25,j=c.showLoopback!==!1;this._compute=function(c,k){var l=Math.abs(k.sourcePos[0]-k.targetPos[0]),m=Math.abs(k.sourcePos[1]-k.targetPos[1]);if(Math.min(k.sourcePos[0],k.targetPos[0]),Math.min(k.sourcePos[1],k.targetPos[1]),j&&k.sourceEndpoint.elementId===k.targetEndpoint.elementId){var n=k.sourcePos[0],o=(k.sourcePos[0],k.sourcePos[1]-f),p=(k.sourcePos[1]-f,n),q=o-i,r=2*i,s=2*i,t=p-i,u=q-i;c.points[0]=t,c.points[1]=u,c.points[2]=r,c.points[3]=s,d.addSegment(this,"Arc",{loopback:!0,x1:n-t+4,y1:o-u,startAngle:0,endAngle:2*Math.PI,r:i,ac:!h,x2:n-t-4,y2:o-u,cx:p-t,cy:q-u})}else{var v=k.sourcePos[0]c?a.insertBefore(b,a.childNodes[c]):a.appendChild(b)};jsPlumbUtil.svg={node:q,attr:p,pos:r};var w=function(a){var b=a.pointerEventsSpec||"all",c={};jsPlumb.jsPlumbUIComponent.apply(this,a.originalArgs),this.canvas=null,this.path=null,this.svg=null,this.bgCanvas=null;var d=a.cssClass+" "+(a.originalArgs[0].cssClass||""),e={style:"",width:0,height:0,"pointer-events":b,position:"absolute"};this.svg=q("svg",e),a.useDivWrapper?(this.canvas=document.createElement("div"),this.canvas.style.position="absolute",jsPlumbUtil.sizeElement(this.canvas,0,0,1,1),this.canvas.className=d):(p(this.svg,{"class":d}),this.canvas=this.svg),a._jsPlumb.appendElement(this.canvas,a.originalArgs[0].parent),a.useDivWrapper&&this.canvas.appendChild(this.svg);var f=[this.canvas];return this.getDisplayElements=function(){return f},this.appendDisplayElement=function(a){f.push(a)},this.paint=function(b,d,e){if(null!=b){var f,g=[this.x,this.y],h=[this.w,this.h];null!=e&&(e.xmin<0&&(g[0]+=e.xmin),e.ymin<0&&(g[1]+=e.ymin),h[0]=e.xmax+(e.xmin<0?-e.xmin:0),h[1]=e.ymax+(e.ymin<0?-e.ymin:0)),a.useDivWrapper?(jsPlumbUtil.sizeElement(this.canvas,g[0],g[1],h[0],h[1]),g[0]=0,g[1]=0,f=r([0,0])):f=r([g[0],g[1]]),c.paint.apply(this,arguments),p(this.svg,{style:f,width:h[0],height:h[1]})}},{renderer:c}};jsPlumbUtil.extend(w,jsPlumb.jsPlumbUIComponent,{cleanup:function(){this.canvas&&(this.canvas._jsPlumb=null),this.svg&&(this.svg._jsPlumb=null),this.bgCanvas&&(this.bgCanvas._jsPlumb=null),this.canvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.bgCanvas&&this.bgCanvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.svg=null,this.canvas=null,this.path=null,this.group=null},setVisible:function(a){this.canvas&&(this.canvas.style.display=a?"block":"none")}}),jsPlumb.ConnectorRenderers.svg=function(a){var b=this,c=w.apply(this,[{cssClass:a._jsPlumb.connectorClass,originalArgs:arguments,pointerEventsSpec:"none",_jsPlumb:a._jsPlumb}]);c.renderer.paint=function(c,d,e){var f=b.getSegments(),g="",h=[0,0];if(e.xmin<0&&(h[0]=-e.xmin),e.ymin<0&&(h[1]=-e.ymin),f.length>0){for(var i=0;iMath.PI?1:0,d=a.anticlockwise?0:1;return"M"+a.x1+" "+a.y1+" A "+a.radius+" "+b.r+" 0 "+c+","+d+" "+a.x2+" "+a.y2}}[a.type]()}}};var x=window.SvgEndpoint=function(a){var b=w.apply(this,[{cssClass:a._jsPlumb.endpointClass,originalArgs:arguments,pointerEventsSpec:"all",useDivWrapper:!0,_jsPlumb:a._jsPlumb}]);b.renderer.paint=function(a){var b=jsPlumb.extend({},a);b.outlineColor&&(b.strokeWidth=b.outlineWidth,b.strokeStyle=jsPlumbUtil.convertStyle(b.outlineColor,!0)),null==this.node?(this.node=this.makeNode(b),this.svg.appendChild(this.node)):null!=this.updateNode&&this.updateNode(this.node),u(this.svg,this.node,b,[this.x,this.y,this.w,this.h],this),r(this.node,[this.x,this.y])}.bind(this)};jsPlumbUtil.extend(x,w),jsPlumb.Endpoints.svg.Dot=function(){jsPlumb.Endpoints.Dot.apply(this,arguments),x.apply(this,arguments),this.makeNode=function(){return q("circle",{cx:this.w/2,cy:this.h/2,r:this.radius})},this.updateNode=function(a){p(a,{cx:this.w/2,cy:this.h/2,r:this.radius})}},jsPlumbUtil.extend(jsPlumb.Endpoints.svg.Dot,[jsPlumb.Endpoints.Dot,x]),jsPlumb.Endpoints.svg.Rectangle=function(){jsPlumb.Endpoints.Rectangle.apply(this,arguments),x.apply(this,arguments),this.makeNode=function(){return q("rect",{width:this.w,height:this.h})},this.updateNode=function(a){p(a,{width:this.w,height:this.h})}},jsPlumbUtil.extend(jsPlumb.Endpoints.svg.Rectangle,[jsPlumb.Endpoints.Rectangle,x]),jsPlumb.Endpoints.svg.Image=jsPlumb.Endpoints.Image,jsPlumb.Endpoints.svg.Blank=jsPlumb.Endpoints.Blank,jsPlumb.Overlays.svg.Label=jsPlumb.Overlays.Label,jsPlumb.Overlays.svg.Custom=jsPlumb.Overlays.Custom;var y=function(a,b){a.apply(this,b),jsPlumb.jsPlumbUIComponent.apply(this,b),this.isAppendedAtTopLevel=!1,this.path=null,this.paint=function(a,d){if(a.component.svg&&d){null==this.path&&(this.path=q("path",{"pointer-events":"all"}),a.component.svg.appendChild(this.path),this.canvas=a.component.svg);var e=b&&1==b.length?b[0].cssClass||"":"",f=[0,0];d.xmin<0&&(f[0]=-d.xmin),d.ymin<0&&(f[1]=-d.ymin),p(this.path,{d:c(a.d),"class":e,stroke:a.strokeStyle?a.strokeStyle:null,fill:a.fillStyle?a.fillStyle:null,transform:"translate("+f[0]+","+f[1]+")"})}};var c=function(a){return"M"+a.hxy.x+","+a.hxy.y+" L"+a.tail[0].x+","+a.tail[0].y+" L"+a.cxy.x+","+a.cxy.y+" L"+a.tail[1].x+","+a.tail[1].y+" L"+a.hxy.x+","+a.hxy.y}};jsPlumbUtil.extend(y,[jsPlumb.jsPlumbUIComponent,jsPlumb.Overlays.AbstractOverlay],{cleanup:function(){null!=this.path&&this._jsPlumb.instance.removeElement(this.path)},setVisible:function(a){null!=this.path&&(this.path.style.display=a?"block":"none")}}),jsPlumb.Overlays.svg.Arrow=function(){y.apply(this,[jsPlumb.Overlays.Arrow,arguments])},jsPlumbUtil.extend(jsPlumb.Overlays.svg.Arrow,[jsPlumb.Overlays.Arrow,y]),jsPlumb.Overlays.svg.PlainArrow=function(){y.apply(this,[jsPlumb.Overlays.PlainArrow,arguments])},jsPlumbUtil.extend(jsPlumb.Overlays.svg.PlainArrow,[jsPlumb.Overlays.PlainArrow,y]),jsPlumb.Overlays.svg.Diamond=function(){y.apply(this,[jsPlumb.Overlays.Diamond,arguments])},jsPlumbUtil.extend(jsPlumb.Overlays.svg.Diamond,[jsPlumb.Overlays.Diamond,y]),jsPlumb.Overlays.svg.GuideLines=function(){var a,b,c=null,d=this;jsPlumb.Overlays.GuideLines.apply(this,arguments),this.paint=function(f,g){null==c&&(c=q("path"),f.connector.svg.appendChild(c),d.attachListeners(c,f.connector),d.attachListeners(c,d),a=q("path"),f.connector.svg.appendChild(a),d.attachListeners(a,f.connector),d.attachListeners(a,d),b=q("path"),f.connector.svg.appendChild(b),d.attachListeners(b,f.connector),d.attachListeners(b,d));var h=[0,0];g.xmin<0&&(h[0]=-g.xmin),g.ymin<0&&(h[1]=-g.ymin),p(c,{d:e(f.head,f.tail),stroke:"red",fill:null,transform:"translate("+h[0]+","+h[1]+")"}),p(a,{d:e(f.tailLine[0],f.tailLine[1]),stroke:"blue",fill:null,transform:"translate("+h[0]+","+h[1]+")"}),p(b,{d:e(f.headLine[0],f.headLine[1]),stroke:"green",fill:null,transform:"translate("+h[0]+","+h[1]+")"})};var e=function(a,b){return"M "+a.x+","+a.y+" L"+b.x+","+b.y}},jsPlumbUtil.extend(jsPlumb.Overlays.svg.GuideLines,jsPlumb.Overlays.GuideLines)}(),function(){"use strict";var a={"stroke-linejoin":"joinstyle",joinstyle:"joinstyle",endcap:"endcap",miterlimit:"miterlimit"},b=null;if(document.createStyleSheet&&document.namespaces){var c=[".jsplumb_vml","jsplumb\\:textbox","jsplumb\\:oval","jsplumb\\:rect","jsplumb\\:stroke","jsplumb\\:shape","jsplumb\\:group"],d="behavior:url(#default#VML);position:absolute;";b=document.createStyleSheet();for(var e=0;e