Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fixes, cleaned up noise in the developer console
zadam81f4966a1af2
diff --git a/electron.js b/electron.jsindex 8296d04356..fbaea6758e 100644--- a/electron.js+++ b/electron.js@@ -44,4 +44,6 @@ app.on('will-quit', () => {globalShortcut.unregisterAll();});+process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true';+require('./src/www');diff --git a/libraries/jsplumb.js b/libraries/jsplumb.jsindex d1ba1fa150..53023fdedf 100644--- a/libraries/jsplumb.js+++ b/libraries/jsplumb.js@@ -1,7 +1 @@-(function(){function a(a,b){return[-a[0][b]+3*a[1][b]+-3*a[2][b]+a[3][b],3*a[0][b]-6*a[1][b]+3*a[2][b],-3*a[0][b]+3*a[1][b],a[0][b]]}function b(b){return[a(b,"x"),a(b,"y")]}function c(a){return 0>a?-1:a>0?1:0}function d(a,b,d,e){var f,g,h=b/a,i=d/a,j=e/a,k=(3*i-Math.pow(h,2))/9,l=(9*h*i-27*j-2*Math.pow(h,3))/54,m=Math.pow(k,3)+Math.pow(l,2),n=[];if(m>=0)f=c(l+Math.sqrt(m))*Math.pow(Math.abs(l+Math.sqrt(m)),1/3),g=c(l-Math.sqrt(m))*Math.pow(Math.abs(l-Math.sqrt(m)),1/3),n[0]=-h/3+(f+g),n[1]=-h/3-(f+g)/2,n[2]=-h/3-(f+g)/2,0!==Math.abs(Math.sqrt(3)*(f-g)/2)&&(n[1]=-1,n[2]=-1);else{var o=Math.acos(l/Math.sqrt(-Math.pow(k,3)));n[0]=2*Math.sqrt(-k)*Math.cos(o/3)-h/3,n[1]=2*Math.sqrt(-k)*Math.cos((o+2*Math.PI)/3)-h/3,n[2]=2*Math.sqrt(-k)*Math.cos((o+4*Math.PI)/3)-h/3}for(var p=0;3>p;p++)(n[p]<0||n[p]>1)&&(n[p]=-1);return n}"undefined"==typeof Math.sgn&&(Math.sgn=function(a){return 0==a?0:a>0?1:-1});var e={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}}},f=64,g=Math.pow(2,-f-1),h=function(a,b){for(var c=[],d=j(a,b),f=b.length-1,g=2*f-1,h=k(d,g,c,0),i=e.subtract(a,b[0]),l=e.square(i),m=0,n=0;h>n;n++){i=e.subtract(a,o(b,f,c[n],null,null));var p=e.square(i);l>p&&(l=p,m=c[n])}return i=e.subtract(a,b[f]),p=e.square(i),l>p&&(l=p,m=1),{location:m,distance:l}},i=function(a,b){var c=h(a,b);return{point:o(b,b.length-1,c.location,null,null),location:c.location}},j=function(a,b){for(var c=b.length-1,d=2*c-1,f=[],g=[],h=[],i=[],j=[[1,.6,.3,.1],[.4,.6,.6,.4],[.1,.3,.6,1]],k=0;c>=k;k++)f[k]=e.subtract(b[k],a);for(var k=0;c-1>=k;k++)g[k]=e.subtract(b[k+1],b[k]),g[k]=e.scale(g[k],3);for(var l=0;c-1>=l;l++)for(var m=0;c>=m;m++)h[l]||(h[l]=[]),h[l][m]=e.dotProduct(g[l],f[m]);for(k=0;d>=k;k++)i[k]||(i[k]=[]),i[k].y=0,i[k].x=parseFloat(k)/d;for(var n=c,o=c-1,p=0;n+o>=p;p++){var q=Math.max(0,p-o),r=Math.min(p,n);for(k=q;r>=k;k++){var s=p-k;i[k+s].y+=h[s][k]*j[s][k]}}return i},k=function(a,b,c,d){var e,g,h=[],i=[],j=[],p=[];switch(l(a,b)){case 0:return 0;case 1:if(d>=f)return c[0]=(a[0].x+a[b].x)/2,1;if(m(a,b))return c[0]=n(a,b),1}o(a,b,.5,h,i),e=k(h,b,j,d+1),g=k(i,b,p,d+1);for(var q=0;e>q;q++)c[q]=j[q];for(var q=0;g>q;q++)c[q+e]=p[q];return e+g},l=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},m=function(a,b){var c,d,e,f,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;var t,u;t=u=0;for(var v=1;b>v;v++){var w=i*a[v].x+j*a[v].y+k;w>t?t=w:u>w&&(u=w)}return n=0,o=1,p=0,q=i,r=j,s=k-t,l=n*r-q*o,m=1/l,d=(o*s-r*p)*m,q=i,r=j,s=k-u,l=n*r-q*o,m=1/l,e=(o*s-r*p)*m,f=Math.min(d,e),h=Math.max(d,e),c=h-f,g>c?1:0},n=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},o=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]},p={},q=function(a){var b=p[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(b){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;d<a.length;d++)c*=a[d](b);return c}};b.push(new c);for(var i=1;a>i;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),p[a]=b}return b},r=function(a,b){for(var c=q(a.length-1),d=0,e=0,f=0;f<a.length;f++)d+=a[f].x*c[f](b),e+=a[f].y*c[f](b);return{x:d,y:e}},s=function(a,b){return Math.sqrt(Math.pow(a.x-b.x,2)+Math.pow(a.y-b.y,2))},t=function(a){return a[0].x===a[1].x&&a[0].y===a[1].y},u=function(a,b,c){if(t(a))return{point:a[0],location:b};for(var d=r(a,b),e=0,f=b,g=c>0?1:-1,h=null;e<Math.abs(c);)f+=.005*g,h=r(a,f),e+=s(h,d),d=h;return{point:h,location:f}},v=function(a){if(t(a))return 0;for(var b=r(a,0),c=0,d=0,e=1,f=null;1>d;)d+=.005*e,f=r(a,d),c+=s(f,b),b=f;return c},w=function(a,b,c){return u(a,b,c).point},x=function(a,b,c){return u(a,b,c).location},y=function(a,b){var c=r(a,b),d=r(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)},z=function(a,b,c){var d=u(a,b,c);return d.location>1&&(d.location=1),d.location<0&&(d.location=0),y(a,d.location)},A=function(a,b,c,d){d=null==d?0:d;var e=u(a,b,d),f=y(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}]},B=function(a,c,e,f,g){var h=f-c,i=a-e,j=a*(c-f)+c*(e-a),k=b(g),l=[h*k[0][0]+i*k[1][0],h*k[0][1]+i*k[1][1],h*k[0][2]+i*k[1][2],h*k[0][3]+i*k[1][3]+j],m=d.apply(null,l),n=[];if(null!=m)for(var o=0;3>o;o++){var p,q=m[o],r=Math.pow(q,2),s=Math.pow(q,3),t=[k[0][0]*s+k[0][1]*r+k[0][2]*q+k[0][3],k[1][0]*s+k[1][1]*r+k[1][2]*q+k[1][3]];p=e-a!==0?(t[0]-a)/(e-a):(t[1]-c)/(f-c),q>=0&&1>=q&&p>=0&&1>=p&&n.push(t)}return n},C=function(a,b,c,d,e){var f=[];return f.push.apply(f,B(a,b,a+c,b,e)),f.push.apply(f,B(a+c,b,a+c,b+d,e)),f.push.apply(f,B(a+c,b+d,a,b+d,e)),f.push.apply(f,B(a,b+d,a,b,e)),f},D=function(a,b){var c=[];return c.push.apply(c,B(a.x,a.y,a.x+a.w,a.y,b)),c.push.apply(c,B(a.x+a.w,a.y,a.x+a.w,a.y+a.h,b)),c.push.apply(c,B(a.x+a.w,a.y+a.h,a.x,a.y+a.h,b)),c.push.apply(c,B(a.x,a.y+a.h,a.x,a.y,b)),c},E=this.jsBezier={distanceFromCurve:h,gradientAtPoint:y,gradientAtPointAlongCurveFrom:z,nearestPointOnCurve:i,pointOnCurve:r,pointAlongCurveFrom:w,perpendicularToCurveAt:A,locationAlongCurveFrom:x,getLength:v,lineIntersection:B,boxIntersection:C,boundingBoxIntersection:D,version:"0.9.0"};"undefined"!=typeof exports&&(exports.jsBezier=E)}).call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.Biltong={version:"0.4.0"};"undefined"!=typeof exports&&(exports.Biltong=b);var c=function(a){return"[object Array]"===Object.prototype.toString.call(a)},d=function(a,b,d){return a=c(a)?a:[a.x,a.y],b=c(b)?b:[b.x,b.y],d(a,b)},e=b.gradient=function(a,b){return d(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])})},f=(b.normal=function(a,b){return-1/e(a,b)},b.lineLength=function(a,b){return d(a,b,function(a,b){return Math.sqrt(Math.pow(b[1]-a[1],2)+Math.pow(b[0]-a[0],2))})},b.quadrant=function(a,b){return d(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})}),g=(b.theta=function(a,b){return d(a,b,function(a,b){var c=e(a,b),d=Math.atan(c),g=f(a,b);return(4==g||3==g)&&(d+=Math.PI),0>d&&(d+=2*Math.PI),d})},b.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},b.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]]),h=[null,[-1,-1],[-1,1],[1,1],[1,-1]];b.pointOnLine=function(a,b,c){var d=e(a,b),i=f(a,b),j=c>0?g[i]:h[i],k=Math.atan(d),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}},b.perpendicularLineTo=function(a,b,c){var d=e(a,b),f=Math.atan(-1/d),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("undefined"!=typeof window?window:this),function(){"use strict";function a(a,b,c,d,e,f,g,h){return new Touch({target:b,identifier:J(),pageX:c,pageY:d,screenX:e,screenY:f,clientX:g||e,clientY:h||f})}function b(){var a=[];return Array.prototype.push.apply(a,arguments),a.item=function(a){return this[a]},a}function c(c,d,e,f,g,h,i,j){return b(a.apply(null,arguments))}var d=this,e=function(a,b,c){c=c||a.parentNode;for(var d=c.querySelectorAll(b),e=0;e<d.length;e++)if(d[e]===a)return!0;return!1},f=function(a){return"string"==typeof a||a.constructor===String?document.getElementById(a):a},g=function(a){return a.srcElement||a.target},h=function(a,b,c,d){if(d){if("undefined"!=typeof a.path&&a.path.indexOf)return{path:a.path,end:a.path.indexOf(c)};var e={path:[],end:-1},f=function(a){e.path.push(a),a===c?e.end=e.path.length-1:null!=a.parentNode&&f(a.parentNode)};return f(b),e}return{path:[b],end:1}},i=function(a,b){for(var c=0,d=a.length;d>c&&a[c]!=b;c++);c<a.length&&a.splice(c,1)},j=1,k=function(a,b,c){var d=j++;return a.__ta=a.__ta||{},a.__ta[b]=a.__ta[b]||{},a.__ta[b][d]=c,c.__tauid=d,d},l=function(a,b,c){if(a.__ta&&a.__ta[b]&&delete a.__ta[b][c.__tauid],c.__taExtra){for(var d=0;d<c.__taExtra.length;d++)H(a,c.__taExtra[d][0],c.__taExtra[d][1]);c.__taExtra.length=0}c.__taUnstore&&c.__taUnstore()},m=function(a,b,c,d){if(null==a)return c;var f=a.split(","),i=function(d){i.__tauid=c.__tauid;var j=g(d),k=j,l=h(d,j,b,null!=a);if(-1!=l.end)for(var m=0;m<l.end;m++){k=l.path[m];for(var n=0;n<f.length;n++)e(k,f[n],b)&&c.apply(k,arguments)}};return n(c,d,i),i},n=function(a,b,c){a.__taExtra=a.__taExtra||[],a.__taExtra.push([b,c])},o=function(a,b,c,d){if(u&&w[b]){var e=m(d,a,c,w[b]);G(a,w[b],e,c)}"focus"===b&&null==a.getAttribute("tabindex")&&a.setAttribute("tabindex","1"),G(a,b,m(d,a,c,b),c)},p=function(a,b,c,d){if(null==a.__taSmartClicks){var e=function(b){a.__tad=A(b)},f=function(b){a.__tau=A(b)},h=function(b){if(a.__tad&&a.__tau&&a.__tad[0]===a.__tau[0]&&a.__tad[1]===a.__tau[1])for(var c=0;c<a.__taSmartClicks.length;c++)a.__taSmartClicks[c].apply(g(b),[b])};o(a,"mousedown",e,d),o(a,"mouseup",f,d),o(a,"click",h,d),a.__taSmartClicks=[]}a.__taSmartClicks.push(c),c.__taUnstore=function(){i(a.__taSmartClicks,c)}},q={tap:{touches:1,taps:1},dbltap:{touches:1,taps:2},contextmenu:{touches:2,taps:1}},r=function(a,b){return function(c,d,f,j){if("contextmenu"==d&&v)o(c,d,f,j);else{if(null==c.__taTapHandler){var k=c.__taTapHandler={tap:[],dbltap:[],contextmenu:[],down:!1,taps:0,downSelectors:[]},l=function(d){for(var f=g(d),i=h(d,f,c,null!=j),l=!1,m=0;m<i.end;m++){if(l)return;f=i.path[m];for(var o=0;o<k.downSelectors.length;o++)if(null==k.downSelectors[o]||e(f,k.downSelectors[o],c)){k.down=!0,setTimeout(n,a),setTimeout(p,b),l=!0;break}}},m=function(a){if(k.down){var b,d,f=g(a);k.taps++;var i=F(a);for(var j in q)if(q.hasOwnProperty(j)){var l=q[j];if(l.touches===i&&(1===l.taps||l.taps===k.taps))for(var m=0;m<k[j].length;m++){d=h(a,f,c,null!=k[j][m][1]);for(var n=0;n<d.end;n++)if(b=d.path[n],null==k[j][m][1]||e(b,k[j][m][1],c)){k[j][m][0].apply(b,[a]);break}}}}},n=function(){k.down=!1},p=function(){k.taps=0};o(c,"mousedown",l),o(c,"mouseup",m)}c.__taTapHandler.downSelectors.push(j),c.__taTapHandler[d].push([f,j]),f.__taUnstore=function(){i(c.__taTapHandler[d],f)}}}},s=function(a,b,c,d){for(var e in c.__tamee[a])c.__tamee[a].hasOwnProperty(e)&&c.__tamee[a][e].apply(d,[b])},t=function(){var a=[];return function(b,c,d,f){if(!b.__tamee){b.__tamee={over:!1,mouseenter:[],mouseexit:[]};var h=function(c){var d=g(c);(null==f&&d==b&&!b.__tamee.over||e(d,f,b)&&(null==d.__tamee||!d.__tamee.over))&&(s("mouseenter",c,b,d),d.__tamee=d.__tamee||{},d.__tamee.over=!0,a.push(d))},i=function(c){for(var d=g(c),f=0;f<a.length;f++)d!=a[f]||e(c.relatedTarget||c.toElement,"*",d)||(d.__tamee.over=!1,a.splice(f,1),s("mouseexit",c,b,d))};G(b,"mouseover",m(f,b,h,"mouseover"),h),G(b,"mouseout",m(f,b,i,"mouseout"),i)}d.__taUnstore=function(){delete b.__tamee[c][d.__tauid]},k(b,c,d),b.__tamee[c][d.__tauid]=d}},u="ontouchstart"in document.documentElement,v="onmousedown"in document.documentElement,w={mousedown:"touchstart",mouseup:"touchend",mousemove:"touchmove"},x=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}(),y=x>-1&&9>x,z=function(a,b){if(null==a)return[0,0];var c=E(a),d=D(c,0);return[d[b+"X"],d[b+"Y"]]},A=function(a){return null==a?[0,0]:y?[a.clientX+document.documentElement.scrollLeft,a.clientY+document.documentElement.scrollTop]:z(a,"page")},B=function(a){return z(a,"screen")},C=function(a){return z(a,"client")},D=function(a,b){return a.item?a.item(b):a[b]},E=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]},F=function(a){return E(a).length},G=function(a,b,c,d){if(k(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])}},H=function(a,b,c){null!=c&&I(a,function(){var d=f(this);if(l(d,b,c),null!=c.__tauid)if(d.removeEventListener)d.removeEventListener(b,c,!1),u&&w[b]&&d.removeEventListener(w[b],c,!1);else if(this.detachEvent){var e=b+c.__tauid;d[e]&&d.detachEvent("on"+b,d[e]),d[e]=null,d["e"+e]=null}c.__taTouchProxy&&H(a,c.__taTouchProxy[1],c.__taTouchProxy[0])})},I=function(a,b){if(null!=a){a="undefined"!=typeof Window&&"unknown"!=typeof a.top&&a==a.top?[a]:"string"!=typeof a&&null==a.tagName&&null!=a.length?a:"string"==typeof a?document.querySelectorAll(a):[a];for(var c=0;c<a.length;c++)b.apply(a[c])}},J=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"==a?b:3&b|8;return c.toString(16)})};d.Mottle=function(a){a=a||{};var b=a.clickThreshold||250,d=a.dblClickThreshold||450,e=new t,g=new r(b,d),h=a.smartClicks,i=function(a,b,c,d){null!=c&&I(a,function(){var a=f(this);h&&"click"===b?p(a,b,c,d):"tap"===b||"dbltap"===b||"contextmenu"===b?g(a,b,c,d):"mouseenter"===b||"mouseexit"==b?e(a,b,c,d):o(a,b,c,d)})};this.remove=function(a){return I(a,function(){var a=f(this);if(a.__ta)for(var b in a.__ta)if(a.__ta.hasOwnProperty(b))for(var c in a.__ta[b])a.__ta[b].hasOwnProperty(c)&&H(a,b,a.__ta[b][c]);a.parentNode&&a.parentNode.removeChild(a)}),this},this.on=function(a,b,c,d){var e=arguments[0],f=4==arguments.length?arguments[2]:null,g=arguments[1],h=arguments[arguments.length-1];return i(e,g,h,f),this},this.off=function(a,b,c){return H(a,b,c),this},this.trigger=function(a,b,d,e){var g=v&&("undefined"==typeof MouseEvent||null==d||d.constructor===MouseEvent),h=u&&!v&&w[b]?w[b]:b,i=!(u&&!v&&w[b]),j=A(d),k=B(d),l=C(d);return I(a,function(){var a,m=f(this);d=d||{screenX:k[0],screenY:k[1],clientX:l[0],clientY:l[1]};var n=function(a){e&&(a.payload=e)},o={TouchEvent:function(a){var b=c(window,m,0,j[0],j[1],k[0],k[1],l[0],l[1]),d=a.initTouchEvent||a.initEvent;d(h,!0,!0,window,null,k[0],k[1],l[0],l[1],!1,!1,!1,!1,b,b,b,1,0)},MouseEvents:function(a){a.initMouseEvent(h,!0,!0,window,0,k[0],k[1],l[0],l[1],!1,!1,!1,!1,1,m)}};if(document.createEvent){var p=!i&&!g&&u&&w[b],q=p?"TouchEvent":"MouseEvents";a=document.createEvent(q),o[q](a),n(a),m.dispatchEvent(a)}else document.createEventObject&&(a=document.createEventObject(),a.eventType=a.eventName=h,a.screenX=k[0],a.screenY=k[1],a.clientX=l[0],a.clientY=l[1],n(a),m.fireEvent("on"+h,a))}),this}},d.Mottle.consume=function(a,b){a.stopPropagation?a.stopPropagation():a.returnValue=!1,!b&&a.preventDefault&&a.preventDefault()},d.Mottle.pageLocation=A,d.Mottle.setForceTouchEvents=function(a){u=a},d.Mottle.setForceMouseEvents=function(a){v=a},d.Mottle.version="0.8.0","undefined"!=typeof exports&&(exports.Mottle=d.Mottle)}.call("undefined"==typeof window?this:window),function(){"use strict";var a=this,b=function(a,b,c){return-1===a.indexOf(b)?(c?a.unshift(b):a.push(b),!0):!1},c=function(a,b){var c=a.indexOf(b);-1!==c&&a.splice(c,1)},d=function(a,b){for(var c=[],d=0;d<a.length;d++)-1===b.indexOf(a[d])&&c.push(a[d]);return c},e=function(a){return null==a?!1:"string"==typeof a||a.constructor===String},f=function(a){var b=a.getBoundingClientRect(),c=document.body,d=document.documentElement,e=window.pageYOffset||d.scrollTop||c.scrollTop,f=window.pageXOffset||d.scrollLeft||c.scrollLeft,g=d.clientTop||c.clientTop||0,h=d.clientLeft||c.clientLeft||0,i=b.top+e-g,j=b.left+f-h;return{top:Math.round(i),left:Math.round(j)}},g=function(a,b,c){c=c||a.parentNode;for(var d=c.querySelectorAll(b),e=0;e<d.length;e++)if(d[e]===a)return!0;return!1},h=function(a,b,c){if(g(b,c,a))return b;for(var d=b.parentNode;null!=d&&d!==a;){if(g(d,c,a))return d;d=d.parentNode}},i=function(a,b,c){for(var d=null,e=b.getAttribute("katavorio-draggable"),f=null!=e?"[katavorio-draggable='"+e+"'] ":"",i=0;i<a.length;i++)if(d=h(b,c,f+a[i].selector),null!=d){if(a[i].filter){var j=g(c,a[i].filter,d),k=a[i].filterExclude===!0;if(k&&!j||j)return null}return[a[i],d]}return null},j=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}(),k=10,l=10,m=j>-1&&9>j,n=9===j,o=function(a){if(m)return[a.clientX+document.documentElement.scrollLeft,a.clientY+document.documentElement.scrollTop];var b=q(a),c=p(b,0);return n?[c.pageX||c.clientX,c.pageY||c.clientY]:[c.pageX,c.pageY]},p=function(a,b){return a.item?a.item(b):a[b]},q=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]},r={delegatedDraggable:"katavorio-delegated-draggable",draggable:"katavorio-draggable",droppable:"katavorio-droppable",drag:"katavorio-drag",selected:"katavorio-drag-selected",active:"katavorio-drag-active",hover:"katavorio-drag-hover",noSelect:"katavorio-drag-no-select",ghostProxy:"katavorio-ghost-proxy",clonedDrag:"katavorio-clone-drag"},s="katavorio-drag-scope",t=["stop","start","drag","drop","over","out","beforeStart"],u=function(){},v=function(){return!0},w=function(a,b,c){for(var d=0;d<a.length;d++)a[d]!=c&&b(a[d])},x=function(a,b,c,d){w(a,function(a){a.setActive(b),b&&a.updatePosition(),c&&a.setHover(d,b)})},y=function(a,b){if(null!=a){a=e(a)||null!=a.tagName||null==a.length?[a]:a;for(var c=0;c<a.length;c++)b.apply(a[c],[a[c]])}},z=function(a){a.stopPropagation?(a.stopPropagation(),a.preventDefault()):a.returnValue=!1},A="input,textarea,select,button,option",B=function(a,b,c){var d=a.srcElement||a.target;return!g(d,c.getInputFilterSelector(),b)},C=function(a,b,c,d){this.params=b||{},this.el=a,this.params.addClass(this.el,this._class),this.uuid=H();var e=!0;return this.setEnabled=function(a){e=a},this.isEnabled=function(){return e},this.toggleEnabled=function(){e=!e},this.setScope=function(a){this.scopes=a?a.split(/\s+/):[d]},this.addScope=function(a){var b={};y(this.scopes,function(a){b[a]=!0}),y(a?a.split(/\s+/):[],function(a){b[a]=!0}),this.scopes=[];for(var c in b)this.scopes.push(c)},this.removeScope=function(a){var b={};y(this.scopes,function(a){b[a]=!0}),y(a?a.split(/\s+/):[],function(a){delete b[a]}),this.scopes=[];for(var c in b)this.scopes.push(c)},this.toggleScope=function(a){var b={};y(this.scopes,function(a){b[a]=!0}),y(a?a.split(/\s+/):[],function(a){b[a]?delete b[a]:b[a]=!0}),this.scopes=[];for(var c in b)this.scopes.push(c)},this.setScope(b.scope),this.k=b.katavorio,b.katavorio},D=function(){return!0},E=function(){return!1},F=function(a,b,c,d){this._class=c.draggable;var h=C.apply(this,arguments);this.rightButtonCanDrag=this.params.rightButtonCanDrag;var j,m,n,p,q=[0,0],s=null,t=null,u=[0,0],w=!1,y=[0,0],A=this.params.consumeStartEvent!==!1,F=this.el,G=this.params.clone,J=(this.params.scroll,b.multipleDrop!==!1),K=!1,L=b.ghostProxy===!0?D:b.ghostProxy&&"function"==typeof b.ghostProxy?b.ghostProxy:E,M=function(a){return a.cloneNode(!0)},N=null,O=[],P=null,Q=b.ghostProxyParent;if(b.selector){var R=a.getAttribute("katavorio-draggable");null==R&&(R=""+(new Date).getTime(),a.setAttribute("katavorio-draggable",R)),O.push(b)}var S=b.snapThreshold,T=function(a,b,c,d,e){var f=Math.floor(a[0]/b),g=b*f,h=g+b,i=Math.abs(a[0]-g)<=d?g:Math.abs(h-a[0])<=d?h:a[0],j=Math.floor(a[1]/c),k=c*j,l=k+c,m=Math.abs(a[1]-k)<=e?k:Math.abs(l-a[1])<=e?l:a[1];return[i,m]};this.posses=[],this.posseRoles={},this.toGrid=function(a){if(null==this.params.grid)return a;var b=this.params.grid?this.params.grid[0]/2:S?S:k/2,c=this.params.grid?this.params.grid[1]/2:S?S:l/2;return T(a,this.params.grid[0],this.params.grid[1],b,c)},this.snap=function(a,b){if(null!=F){a=a||(this.params.grid?this.params.grid[0]:k),b=b||(this.params.grid?this.params.grid[1]:l);var c=this.params.getPosition(F),d=this.params.grid?this.params.grid[0]/2:S,e=this.params.grid?this.params.grid[1]/2:S,f=T(c,a,b,d,e);return this.params.setPosition(F,f),f}},this.setUseGhostProxy=function(a){L=a?D:E};var U,V=function(a){return b.allowNegative===!1?[Math.max(0,a[0]),Math.max(0,a[1])]:a},W=function(a){U="function"==typeof a?a:a?function(a,b,c,d){return V([Math.max(0,Math.min(c.w-d[0],a[0])),Math.max(0,Math.min(c.h-d[1],a[1]))])}.bind(this):function(a){return V(a)}}.bind(this);W("function"==typeof this.params.constrain?this.params.constrain:this.params.constrain||this.params.containment),this.setConstrain=function(a){W(a)};var X;this.setRevert=function(a){X=a},this.params.revert&&(X=this.params.revert);var Y=function(a){return"function"==typeof a?(a._katavorioId=H(),a._katavorioId):a},Z={},$=function(a){for(var b in Z){var c=Z[b],d=c[0](a);if(c[1]&&(d=!d),!d)return!1}return!0},_=this.setFilter=function(b,c){if(b){var d=Y(b);Z[d]=[function(c){var d,f=c.srcElement||c.target;return e(b)?d=g(f,b,a):"function"==typeof b&&(d=b(c,a)),d},c!==!1]}};this.addFilter=_,this.removeFilter=function(a){var b="function"==typeof a?a._katavorioId:a;delete Z[b]};this.clearAllFilters=function(){Z={}},this.canDrag=this.params.canDrag||v;var aa,ba=[],ca=[];this.addSelector=function(a){a.selector&&O.push(a)},this.downListener=function(a){if(!a.defaultPrevented){var b=this.rightButtonCanDrag||3!==a.which&&2!==a.button;if(b&&this.isEnabled()&&this.canDrag()){var d=$(a)&&B(a,this.el,this.k);if(d){if(P=null,N=null,O.length>0){var e=i(O,this.el,a.target||a.srcElement);if(null!=e&&(P=e[0],N=e[1]),null==N)return}else N=this.el;if(G)if(F=N.cloneNode(!0),this.params.addClass(F,r.clonedDrag),F.setAttribute("id",null),F.style.position="absolute",null!=this.params.parent){var g=this.params.getPosition(this.el);F.style.left=g[0]+"px",F.style.top=g[1]+"px",this.params.parent.appendChild(F)}else{var j=f(N);F.style.left=j.left+"px",F.style.top=j.top+"px",document.body.appendChild(F)}else F=N;A&&z(a),q=o(a),F&&F.parentNode&&(y=[F.parentNode.scrollLeft,F.parentNode.scrollTop]),this.params.bind(document,"mousemove",this.moveListener),this.params.bind(document,"mouseup",this.upListener),h.markSelection(this),h.markPosses(this),this.params.addClass(document.body,c.noSelect),ea("beforeStart",{el:this.el,pos:s,e:a,drag:this})}else this.params.consumeFilteredEvents&&z(a)}}}.bind(this),this.moveListener=function(a){if(q){if(!w){var b=ea("start",{el:this.el,pos:s,e:a,drag:this});if(b!==!1){if(!q)return;this.mark(!0),w=!0}else this.abort()}if(q){ca.length=0;var c=o(a),d=c[0]-q[0],e=c[1]-q[1],f=this.params.ignoreZoom?1:h.getZoom();F&&F.parentNode&&(d+=F.parentNode.scrollLeft-y[0],e+=F.parentNode.scrollTop-y[1]),d/=f,e/=f,this.moveBy(d,e,a),h.updateSelection(d,e,this),h.updatePosses(d,e,this)}}}.bind(this),this.upListener=function(a){q&&(q=null,this.params.unbind(document,"mousemove",this.moveListener),this.params.unbind(document,"mouseup",this.upListener),this.params.removeClass(document.body,c.noSelect),this.unmark(a),h.unmarkSelection(this,a),h.unmarkPosses(this,a),this.stop(a),h.notifyPosseDragStop(this,a),w=!1,ca.length=0,G?(F&&F.parentNode&&F.parentNode.removeChild(F),F=null):X&&X(F,this.params.getPosition(F))===!0&&(this.params.setPosition(F,s),ea("revert",F)))}.bind(this),this.getFilters=function(){return Z},this.abort=function(){null!=q&&this.upListener()},this.getDragElement=function(a){return a?N||this.el:F||this.el};var da={start:[],drag:[],stop:[],over:[],out:[],beforeStart:[],revert:[]};b.events.start&&da.start.push(b.events.start),b.events.beforeStart&&da.beforeStart.push(b.events.beforeStart),b.events.stop&&da.stop.push(b.events.stop),b.events.drag&&da.drag.push(b.events.drag),b.events.revert&&da.revert.push(b.events.revert),this.on=function(a,b){da[a]&&da[a].push(b)},this.off=function(a,b){if(da[a]){for(var c=[],d=0;d<da[a].length;d++)da[a][d]!==b&&c.push(da[a][d]);da[a]=c}};var ea=function(a,b){var c=null;if(P&&P[a])c=P[a](b);else if(da[a])for(var d=0;d<da[a].length;d++)try{var e=da[a][d](b);null!=e&&(c=e)}catch(f){}return c};this.notifyStart=function(a){ea("start",{el:this.el,pos:this.params.getPosition(F),e:a,drag:this})},this.stop=function(a,b){if(b||w){var c=[],d=h.getSelection(),e=this.params.getPosition(F);if(d.length>0)for(var f=0;f<d.length;f++){var g=this.params.getPosition(d[f].el);c.push([d[f].el,{left:g[0],top:g[1]},d[f]])}else c.push([F,{left:e[0],top:e[1]},this]);ea("stop",{el:F,pos:fa||e,finalPos:e,e:a,drag:this,selection:c})}},this.mark=function(a){s=this.params.getPosition(F),t=this.params.getPosition(F,!0),u=[t[0]-s[0],t[1]-s[1]],this.size=this.params.getSize(F),ba=h.getMatchingDroppables(this),x(ba,!0,!1,this),this.params.addClass(F,this.params.dragClass||c.drag);var b;b=this.params.getConstrainingRectangle?this.params.getConstrainingRectangle(F):this.params.getSize(F.parentNode),aa={w:b[0],h:b[1]},n=0,p=0,a&&h.notifySelectionDragStart(this)};var fa;this.unmark=function(a,d){if(x(ba,!1,!0,this),K&&L(N,F)?(fa=[F.offsetLeft-n,F.offsetTop-p],F.parentNode.removeChild(F),F=N):fa=null,this.params.removeClass(F,this.params.dragClass||c.drag),ba.length=0,K=!1,!d){ca.length>0&&fa&&b.setPosition(N,fa),ca.sort(I);for(var e=0;e<ca.length;e++){var f=ca[e].drop(this,a);if(f===!0)break}}},this.moveBy=function(a,c,d){ca.length=0;var e=this.toGrid([s[0]+a,s[1]+c]),f=U(e,F,aa,this.size);if(L(this.el,F))if(e[0]!==f[0]||e[1]!==f[1]){if(!K){var g=M(N);b.addClass(g,r.ghostProxy),Q?(Q.appendChild(g),j=b.getPosition(N.parentNode,!0),m=b.getPosition(b.ghostProxyParent,!0),n=j[0]-m[0],p=j[1]-m[1]):N.parentNode.appendChild(g),F=g,K=!0}f=e}else K&&(F.parentNode.removeChild(F),F=N,K=!1,j=null,m=null,n=0,p=0);var h={x:f[0],y:f[1],w:this.size[0],h:this.size[1]},i={x:h.x+u[0],y:h.y+u[1],w:h.w,h:h.h},k=null;this.params.setPosition(F,[f[0]+n,f[1]+p]);for(var l=0;l<ba.length;l++){var o={x:ba[l].pagePosition[0],y:ba[l].pagePosition[1],w:ba[l].size[0],h:ba[l].size[1]};this.params.intersects(i,o)&&(J||null==k||k===ba[l].el)&&ba[l].canDrop(this)?(k||(k=ba[l].el),ca.push(ba[l]),ba[l].setHover(this,!0,d)):ba[l].isHover()&&ba[l].setHover(this,!1,d)}ea("drag",{el:this.el,pos:f,e:d,drag:this})},this.destroy=function(){this.params.unbind(this.el,"mousedown",this.downListener),this.params.unbind(document,"mousemove",this.moveListener),this.params.unbind(document,"mouseup",this.upListener),this.downListener=null,this.upListener=null,this.moveListener=null},this.params.bind(this.el,"mousedown",this.downListener),this.params.handle?_(this.params.handle,!1):_(this.params.filter,this.params.filterExclude)},G=function(a,b,c,d){this._class=c.droppable,this.params=b||{},this.rank=b.rank||0,this._activeClass=this.params.activeClass||c.active,this._hoverClass=this.params.hoverClass||c.hover,C.apply(this,arguments);var e=!1;this.allowLoopback=this.params.allowLoopback!==!1,this.setActive=function(a){this.params[a?"addClass":"removeClass"](this.el,this._activeClass)},this.updatePosition=function(){this.position=this.params.getPosition(this.el),this.pagePosition=this.params.getPosition(this.el,!0),this.size=this.params.getSize(this.el)},this.canDrop=this.params.canDrop||function(a){return!0},this.isHover=function(){return e},this.setHover=function(a,b,c){(b||null==this.el._katavorioDragHover||this.el._katavorioDragHover===a.el._katavorio)&&(this.params[b?"addClass":"removeClass"](this.el,this._hoverClass),this.el._katavorioDragHover=b?a.el._katavorio:null,e!==b&&this.params.events[b?"over":"out"]({el:this.el,e:c,drag:a,drop:this}),e=b)},this.drop=function(a,b){return this.params.events.drop({drag:a,e:b,drop:this})},this.destroy=function(){this._class=null,this._activeClass=null,this._hoverClass=null,e=null}},H=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"===a?b:3&b|8;return c.toString(16)})},I=function(a,b){return a.rank<b.rank?1:a.rank>b.rank?-1:0},J=function(a){return null==a?null:(a="string"==typeof a||a.constructor===String?document.getElementById(a):a,null==a?null:(a._katavorio=a._katavorio||H(),a))};a.Katavorio=function(a){var f=[],g={};this._dragsByScope={},this._dropsByScope={};var h=1,i=function(a,b){y(a,function(a){for(var c=0;c<a.scopes.length;c++)b[a.scopes[c]]=b[a.scopes[c]]||[],b[a.scopes[c]].push(a)})},j=function(b,c){var d=0;return y(b,function(b){for(var e=0;e<b.scopes.length;e++)if(c[b.scopes[e]]){var f=a.indexOf(c[b.scopes[e]],b);-1!==f&&(c[b.scopes[e]].splice(f,1),d++)}}),d>0},k=(this.getMatchingDroppables=function(a){for(var b=[],c={},d=0;d<a.scopes.length;d++){var e=this._dropsByScope[a.scopes[d]];if(e)for(var f=0;f<e.length;f++)!e[f].canDrop(a)||c[e[f].uuid]||!e[f].allowLoopback&&e[f].el===a.el||(c[e[f].uuid]=!0,b.push(e[f]))}return b.sort(I),b},function(b){b=b||{};var c,d={events:{}};for(c in a)d[c]=a[c];for(c in b)d[c]=b[c];for(c=0;c<t.length;c++)d.events[t[c]]=b[t[c]]||u;return d.katavorio=this,d}.bind(this)),l=function(a,b){for(var c=0;c<t.length;c++)b[t[c]]&&a.on(t[c],b[t[c]])}.bind(this),m={},n=a.css||{},o=a.scope||s;for(var p in r)m[p]=r[p];for(var p in n)m[p]=n[p];var q=a.inputFilterSelector||A;this.getInputFilterSelector=function(){return q},this.setInputFilterSelector=function(a){return q=a,this},this.draggable=function(b,c){var d=[];return y(b,function(b){if(b=J(b),null!=b)if(null==b._katavorioDrag){var e=k(c);b._katavorioDrag=new F(b,e,m,o),i(b._katavorioDrag,this._dragsByScope),d.push(b._katavorioDrag),a.addClass(b,e.selector?m.delegatedDraggable:m.draggable)}else l(b._katavorioDrag,c)}.bind(this)),d},this.droppable=function(b,c){var d=[];return y(b,function(b){if(b=J(b),null!=b){var e=new G(b,k(c),m,o);b._katavorioDrop=b._katavorioDrop||[],b._katavorioDrop.push(e),i(e,this._dropsByScope),d.push(e),a.addClass(b,m.droppable)}}.bind(this)),d},this.select=function(b){return y(b,function(){var b=J(this);b&&b._katavorioDrag&&(g[b._katavorio]||(f.push(b._katavorioDrag),g[b._katavorio]=[b,f.length-1],a.addClass(b,m.selected)))}),this},this.deselect=function(b){return y(b,function(){var b=J(this);if(b&&b._katavorio){var c=g[b._katavorio];if(c){for(var d=[],e=0;e<f.length;e++)f[e].el!==b&&d.push(f[e]);f=d,delete g[b._katavorio],a.removeClass(b,m.selected)}}}),this},this.deselectAll=function(){for(var b in g){var c=g[b];a.removeClass(c[0],m.selected)}f.length=0,g={}},this.markSelection=function(a){w(f,function(a){a.mark()},a)},this.markPosses=function(a){a.posses&&y(a.posses,function(b){a.posseRoles[b]&&C[b]&&w(C[b].members,function(a){a.mark()},a)})},this.unmarkSelection=function(a,b){w(f,function(a){a.unmark(b)},a)},this.unmarkPosses=function(a,b){a.posses&&y(a.posses,function(c){a.posseRoles[c]&&C[c]&&w(C[c].members,function(a){a.unmark(b,!0)},a)})},this.getSelection=function(){return f.slice(0)},this.updateSelection=function(a,b,c){w(f,function(c){c.moveBy(a,b)},c)};var v=function(a,b){b.posses&&y(b.posses,function(c){b.posseRoles[c]&&C[c]&&w(C[c].members,function(b){a(b)},b)})};this.updatePosses=function(a,b,c){v(function(c){c.moveBy(a,b)},c)},this.notifyPosseDragStop=function(a,b){v(function(a){a.stop(b,!0)},a)},this.notifySelectionDragStop=function(a,b){w(f,function(a){a.stop(b,!0)},a)},this.notifySelectionDragStart=function(a,b){w(f,function(a){a.notifyStart(b)},a)},this.setZoom=function(a){h=a},this.getZoom=function(){return h};var x=function(a,b,c,d){y(a,function(a){j(a,c),a[d](b),i(a,c)})};y(["set","add","remove","toggle"],function(a){-this[a+"Scope"]=function(b,c){x(b._katavorioDrag,c,this._dragsByScope,a+"Scope"),x(b._katavorioDrop,c,this._dropsByScope,a+"Scope")}.bind(this),this[a+"DragScope"]=function(b,c){x(b.constructor===F?b:b._katavorioDrag,c,this._dragsByScope,a+"Scope")}.bind(this),this[a+"DropScope"]=function(b,c){x(b.constructor===G?b:b._katavorioDrop,c,this._dropsByScope,a+"Scope")}.bind(this)}.bind(this)),this.snapToGrid=function(a,b){for(var c in this._dragsByScope)w(this._dragsByScope[c],function(c){c.snap(a,b)})},this.getDragsForScope=function(a){return this._dragsByScope[a]},this.getDropsForScope=function(a){return this._dropsByScope[a]};var z=function(a,b,c){if(a=J(a),a[b]){var d=f.indexOf(a[b]);d>=0&&f.splice(d,1),j(a[b],c)&&y(a[b],function(a){a.destroy()}),delete a[b]}},B=function(a,b,c,d){a=J(a),a[b]&&a[b].off(c,d)};this.elementRemoved=function(a){this.destroyDraggable(a),this.destroyDroppable(a)},this.destroyDraggable=function(a,b,c){1===arguments.length?z(a,"_katavorioDrag",this._dragsByScope):B(a,"_katavorioDrag",b,c)},this.destroyDroppable=function(a,b,c){1===arguments.length?z(a,"_katavorioDrop",this._dropsByScope):B(a,"_katavorioDrop",b,c)},this.reset=function(){this._dragsByScope={},this._dropsByScope={},f=[],g={},C={}};var C={},D=function(a,c,d){var f=e(c)?c:c.id,g=e(c)?!0:c.active!==!1,h=C[f]||function(){var a={name:f,members:[]};return C[f]=a,a}();return y(a,function(a){if(a._katavorioDrag){if(d&&null!=a._katavorioDrag.posseRoles[h.name])return;b(h.members,a._katavorioDrag),b(a._katavorioDrag.posses,h.name),a._katavorioDrag.posseRoles[h.name]=g}}),h};this.addToPosse=function(a,b){for(var c=[],d=1;d<arguments.length;d++)c.push(D(a,arguments[d]));return 1===c.length?c[0]:c},this.setPosse=function(a,b){for(var c=[],e=1;e<arguments.length;e++)c.push(D(a,arguments[e],!0).name);return y(a,function(a){if(a._katavorioDrag){var b=d(a._katavorioDrag.posses,c),e=[];Array.prototype.push.apply(e,a._katavorioDrag.posses);for(var f=0;f<b.length;f++)this.removeFromPosse(a,b[f])}}.bind(this)),1===c.length?c[0]:c},this.removeFromPosse=function(a,b){if(arguments.length<2)throw new TypeError("No posse id provided for remove operation");for(var d=1;d<arguments.length;d++)b=arguments[d],y(a,function(a){if(a._katavorioDrag&&a._katavorioDrag.posses){var d=a._katavorioDrag;y(b,function(a){c(C[a].members,d),c(d.posses,a),delete d.posseRoles[a]})}})},this.removeFromAllPosses=function(a){y(a,function(a){if(a._katavorioDrag&&a._katavorioDrag.posses){var b=a._katavorioDrag;y(b.posses,function(a){c(C[a].members,b)}),b.posses.length=0,b.posseRoles={}}})},this.setPosseState=function(a,b,c){var d=C[b];d&&y(a,function(a){a._katavorioDrag&&a._katavorioDrag.posses&&(a._katavorioDrag.posseRoles[d.name]=c)})}},a.Katavorio.version="1.0.0","undefined"!=typeof exports&&(exports.Katavorio=a.Katavorio)}.call("undefined"!=typeof window?window:this),function(){function a(a){return"[object Array]"===Object.prototype.toString.call(a)}function b(a){return"[object Number]"===Object.prototype.toString.call(a)}function c(a){return"string"==typeof a}function d(a){return"boolean"==typeof a}function e(a){return null==a}function f(a){return null==a?!1:"[object Object]"===Object.prototype.toString.call(a)}function g(a){return"[object Date]"===Object.prototype.toString.call(a)}function h(a){return"[object Function]"===Object.prototype.toString.call(a)}function i(a){return h(a)&&null!=a.name&&a.name.length>0}function j(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0}function k(b){if(c(b))return""+b;if(d(b))return!!b;if(g(b))return new Date(b.getTime());if(h(b))return b;if(a(b)){for(var e=[],i=0;i<b.length;i++)e.push(k(b[i]));return e}if(f(b)){var j={};for(var l in b)j[l]=k(b[l]);return j}return b}function l(b,e,g,h){var i,j,l={},m={};for(g=g||[],h=h||[],j=0;j<g.length;j++)l[g[j]]=!0;for(j=0;j<h.length;j++)m[h[j]]=!0;var n=k(b);for(j in e)if(null==n[j]||m[j])n[j]=e[j];else if(c(e[j])||d(e[j]))l[j]?(i=[],i.push.apply(i,a(n[j])?n[j]:[n[j]]),i.push.apply(i,d(e[j])?e[j]:[e[j]]),n[j]=i):n[j]=e[j];else if(a(e[j]))i=[],a(n[j])&&i.push.apply(i,n[j]),i.push.apply(i,e[j]),n[j]=i;else if(f(e[j])){f(n[j])||(n[j]={});for(var o in e[j])n[j][o]=e[j][o]}return n}function m(a,b,c){if(null!=a){var d=a,e=d;return b.replace(/([^\.])+/g,function(a,b,d,f){var g=a.match(/([^\[0-9]+){1}(\[)([0-9+])/),h=d+a.length>=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]}();return""}),a}}function n(a,b,c){for(var d=0;d<c.length;d++){var e=c[d][0][c[d][1]].apply(c[d][0],c[d][2]);if(e===b)return e}return a}function o(b,d,e,g){var i=function(a){var b=a.match(/(\${.*?})/g);if(null!=b)for(var c=0;c<b.length;c++){var e=d[b[c].substring(2,b[c].length-1)]||"";null!=e&&(a=a.replace(b[c],e))}return a},j=function(b){if(null!=b){if(c(b))return i(b);if(!h(b)||g||null!=e&&0!==(b.name||"").indexOf(e)){if(a(b)){for(var k=[],l=0;l<b.length;l++)k.push(j(b[l]));return k}if(f(b)){var m={};for(var n in b)m[n]=j(b[n]);return m}return b}return b(d)}};return j(b)}function p(a,b){if(a)for(var c=0;c<a.length;c++)if(b(a[c]))return c;return-1}function q(a,b){var c=p(a,b);return c>-1&&a.splice(c,1),-1!==c}function r(a,b){var c=a.indexOf(b);return c>-1&&a.splice(c,1),-1!==c}function s(a,b,c){-1===p(a,c)&&a.push(b)}function t(a,b,c,d){var e=a[b];return null==e&&(e=[],a[b]=e),e[d?"unshift":"push"](c),e}function u(a,b,c){return-1===a.indexOf(b)?(c?a.unshift(b):a.push(b),!0):!1}function v(b,c,d){var e;c=a(c)?c:[c];var f=function(a){for(var c=a.__proto__;null!=c;)if(null!=c.prototype){for(var d in c.prototype)c.prototype.hasOwnProperty(d)&&!b.prototype.hasOwnProperty(d)&&(b.prototype[d]=c.prototype[d]);c=c.prototype.__proto__}else c=null};for(e=0;e<c.length;e++){for(var g in c[e].prototype)c[e].prototype.hasOwnProperty(g)&&!b.prototype.hasOwnProperty(g)&&(b.prototype[g]=c[e].prototype[g]);f(c[e])}var h=function(a,b){return function(){for(e=0;e<c.length;e++)c[e].prototype[a]&&c[e].prototype[a].apply(this,arguments);return b.apply(this,arguments)}},i=function(a){for(var c in a)b.prototype[c]=h(c,a[c])};if(arguments.length>2)for(e=2;e<arguments.length;e++)i(arguments[e]);return b}function w(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"===a?b:3&b|8;return c.toString(16)})}function x(a){if(null==a)return null;for(var b=a.replace(/^\s\s*/,""),c=/\s/,d=b.length;c.test(b.charAt(--d)););return b.slice(0,d+1)}function y(a,b){a=null==a.length||"string"==typeof a?[a]:a;for(var c=0;c<a.length;c++)b(a[c])}function z(a,b){for(var c=[],d=0;d<a.length;d++)c.push(b(a[d]));return c}function A(a,b,c){c=c||"parent";var d=function(a){return a?b[a]:null},e=function(a){return a?d(a[c]):null},f=function(a,b){if(null==a)return b;var c=["anchor","anchors","cssClass","connector","paintStyle","hoverPaintStyle","endpoint","endpoints"];"override"===b.mergeStrategy&&Array.prototype.push.apply(c,["events","overlays"]);var d=l(a,b,[],c);return f(e(a),d)},g=function(a){if(null==a)return{};if("string"==typeof a)return d(a);if(a.length){for(var b=!1,c=0,e=void 0;!b&&c<a.length;)e=g(a[c]),e?b=!0:c++;return e}},h=g(a);return h?f(e(h),h):{}}function B(){for(var a=[],b=0;b<arguments.length;b++)a[b]=arguments[b];if(E.logEnabled&&"undefined"!=typeof console)try{var c=arguments[arguments.length-1];console.log(c)}catch(d){}}function C(a,b,c){return function(){var d=null;try{null!=b&&(d=b.apply(this,arguments))}catch(e){B("jsPlumb function failed : "+e)}if(null!=a&&(null==c||d!==c))try{d=a.apply(this,arguments)}catch(e){B("wrapped function failed : "+e)}return d}}var D=this;D.jsPlumbUtil=D.jsPlumbUtil||{};var E=D.jsPlumbUtil;"undefined"!=typeof exports&&(exports.jsPlumbUtil=E),E.isArray=a,E.isNumber=b,E.isString=c,E.isBoolean=d,E.isNull=e,E.isObject=f,E.isDate=g,E.isFunction=h,E.isNamedFunction=i,E.isEmpty=j,E.clone=k,E.merge=l,E.replace=m,E.functionChain=n,E.populate=o,E.findWithFunction=p,E.removeWithFunction=q,E.remove=r,E.addWithFunction=s,E.addToList=t,E.suggest=u,E.extend=v,E.uuid=w,E.fastTrim=x,E.each=y,E.map=z,E.mergeWithParents=A,E.logEnabled=!0,E.log=B,E.wrap=C;var F=function(){function a(){var a=this;this._listeners={},this.eventsSuspended=!1,this.tick=!1,this.eventsToDieOn={ready:!0},this.queue=[],this.bind=function(b,c,d){var e=function(b){t(a._listeners,b,c,d),c.__jsPlumb=c.__jsPlumb||{},c.__jsPlumb[w()]=b};if("string"==typeof b)e(b);else if(null!=b.length)for(var f=0;f<b.length;f++)e(b[f]);return a},this.fire=function(a,b,c){if(this.tick)this.queue.unshift(arguments);else{if(this.tick=!0,!this.eventsSuspended&&this._listeners[a]){var d=this._listeners[a].length,e=0,f=!1,g=null;if(!this.shouldFireEvent||this.shouldFireEvent(a,b,c))for(;!f&&d>e&&g!==!1;){if(this.eventsToDieOn[a])this._listeners[a][e].apply(this,[b,c]);else try{g=this._listeners[a][e].apply(this,[b,c])}catch(h){B("jsPlumb: fire failed for event "+a+" : "+h)}e++,(null==this._listeners||null==this._listeners[a])&&(f=!0)}}this.tick=!1,this._drain()}return this},this._drain=function(){var b=a.queue.pop();b&&a.fire.apply(a,b)},this.unbind=function(a,b){if(0===arguments.length)this._listeners={};else if(1===arguments.length){if("string"==typeof a)delete this._listeners[a];else if(a.__jsPlumb){var c=void 0;for(var d in a.__jsPlumb)c=a.__jsPlumb[d],r(this._listeners[c]||[],a)}}else 2===arguments.length&&r(this._listeners[a]||[],b);return this},this.getListener=function(b){return a._listeners[b]},this.setSuspendEvents=function(b){a.eventsSuspended=b},this.isSuspendEvents=function(){return a.eventsSuspended},this.silently=function(b){a.setSuspendEvents(!0);try{b()}catch(c){B("Cannot execute silent function "+c)}a.setSuspendEvents(!1)},this.cleanupListeners=function(){for(var b in a._listeners)a._listeners[b]=null}}return a}();E.EventGenerator=F}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this;a.jsPlumbUtil.matchesSelector=function(a,b,c){c=c||a.parentNode;for(var d=c.querySelectorAll(b),e=0;e<d.length;e++)if(d[e]===a)return!0;return!1},a.jsPlumbUtil.consume=function(a,b){a.stopPropagation?a.stopPropagation():a.returnValue=!1,!b&&a.preventDefault&&a.preventDefault()},a.jsPlumbUtil.sizeElement=function(a,b,c,d,e){a&&(a.style.height=e+"px",a.height=e,a.style.width=d+"px",a.width=d,a.style.left=b+"px",a.style.top=c+"px")}}.call("undefined"!=typeof window?window:this),function(){var a={deriveAnchor:function(a,b,c,d){return{top:["TopRight","TopLeft"],bottom:["BottomRight","BottomLeft"]}[a][b]}},b=this,c=function(a){this.count=0,this.instance=a,this.lists={},this.instance.addList=function(a,b){return this.listManager.addList(a,b)},this.instance.removeList=function(a){this.listManager.removeList(a)},this.instance.bind("manageElement",function(a){for(var b=this.instance.getSelector(a.el,"[jtk-scrollable-list]"),c=0;c<b.length;c++)this.addList(b[c])}.bind(this)),this.instance.bind("unmanageElement",function(a){this.removeList(a.el)}),this.instance.bind("connection",function(a,b){null==b&&(this._maybeUpdateParentList(a.source),this._maybeUpdateParentList(a.target))}.bind(this))};b.jsPlumbListManager=c,c.prototype={addList:function(b,c){var e=this.instance.extend({},a);c=this.instance.extend(e,c||{});var f=[this.instance.getInstanceIndex(),this.count++].join("_");this.lists[f]=new d(this.instance,b,c,f)},removeList:function(a){var b=this.lists[a._jsPlumbList];b&&(b.destroy(),delete this.lists[a._jsPlumbList])},_maybeUpdateParentList:function(a){for(var b=a.parentNode,c=this.instance.getContainer();null!=b&&b!==c;){if(null!=b._jsPlumbList&&null!=this.lists[b._jsPlumbList])return void b._jsPlumbScrollHandler();b=b.parentNode}}};var d=function(a,b,c,d){function e(a,b,d,e){return c.anchor?c.anchor:c.deriveAnchor(a,b,d,e)}function f(a,b,d,e){return c.deriveEndpoint?c.deriveEndpoint(a,b,d,e):c.endpoint?c.endpoint:d.type}function g(b){for(var c=b.parentNode,d=a.getContainer();null!=c&&c!==d;){if(a.hasClass(c,"jtk-managed"))return void a.recalculateOffsets(c);c=c.parentNode}}b._jsPlumbList=d;var h=function(c){for(var d=a.getSelector(b,".jtk-managed"),h=a.getId(b),i=0;i<d.length;i++){if(d[i].offsetTop<b.scrollTop)d[i]._jsPlumbProxies||(d[i]._jsPlumbProxies=d[i]._jsPlumbProxies||[],a.select({source:d[i]}).each(function(c){a.proxyConnection(c,0,b,h,function(){return f("top",0,c.endpoints[0],c)},function(){return e("top",0,c.endpoints[0],c)}),d[i]._jsPlumbProxies.push([c,0])}),a.select({target:d[i]}).each(function(c){a.proxyConnection(c,1,b,h,function(){return f("top",1,c.endpoints[1],c)},function(){return e("top",1,c.endpoints[1],c)}),d[i]._jsPlumbProxies.push([c,1])}));else if(d[i].offsetTop>b.scrollTop+b.offsetHeight)d[i]._jsPlumbProxies||(d[i]._jsPlumbProxies=d[i]._jsPlumbProxies||[],a.select({source:d[i]}).each(function(c){a.proxyConnection(c,0,b,h,function(){return f("bottom",0,c.endpoints[0],c)},function(){return e("bottom",0,c.endpoints[0],c)}),d[i]._jsPlumbProxies.push([c,0])}),a.select({target:d[i]}).each(function(c){a.proxyConnection(c,1,b,h,function(){return f("bottom",1,c.endpoints[1],c)},function(){return e("bottom",1,c.endpoints[1],c)}),d[i]._jsPlumbProxies.push([c,1])}));else if(d[i]._jsPlumbProxies){for(var j=0;j<d[i]._jsPlumbProxies.length;j++)a.unproxyConnection(d[i]._jsPlumbProxies[j][0],d[i]._jsPlumbProxies[j][1],h);delete d[i]._jsPlumbProxies}a.revalidate(d[i])}g(b)};a.setAttribute(b,"jtk-scrollable-list","true"),b._jsPlumbScrollHandler=h,a.on(b,"scroll",h),h(),this.destroy=function(){a.off(b,"scroll",h),delete b._jsPlumbScrollHandler;for(var c=a.getSelector(b,".jtk-managed"),d=a.getId(b),e=0;e<c.length;e++)if(c[e]._jsPlumbProxies){for(var f=0;f<c[e]._jsPlumbProxies.length;f++)a.unproxyConnection(c[e]._jsPlumbProxies[f][0],c[e]._jsPlumbProxies[f][1],d);delete c[e]._jsPlumbProxies}}}}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumbUtil,c=function(){return""+(new Date).getTime()},d=function(a){if(a._jsPlumb.paintStyle&&a._jsPlumb.hoverPaintStyle){var b={};o.extend(b,a._jsPlumb.paintStyle),o.extend(b,a._jsPlumb.hoverPaintStyle),delete a._jsPlumb.hoverPaintStyle,b.gradient&&a._jsPlumb.paintStyle.fill&&delete b.gradient,a._jsPlumb.hoverPaintStyle=b}},e=["tap","dbltap","click","dblclick","mouseover","mouseout","mousemove","mousedown","mouseup","contextmenu"],f=function(a,b,c,d){var e=a.getAttachedElements();if(e)for(var f=0,g=e.length;g>f;f++)d&&d===e[f]||e[f].setHover(b,!0,c)},g=function(a){return null==a?null:a.split(" ")},h=function(a,b,c){for(var d in b)a[d]=c},i=function(a,c,d){if(a.getDefaultType){var e=a.getTypeDescriptor(),f={},g=a.getDefaultType(),i=b.merge({},g);h(f,g,"__default");for(var j=0,k=a._jsPlumb.types.length;k>j;j++){var l=a._jsPlumb.types[j];if("__default"!==l){var m=a._jsPlumb.instance.getType(l,e);if(null!=m){var n=["anchor","anchors","connector","paintStyle","hoverPaintStyle","endpoint","endpoints","connectorOverlays","connectorStyle","connectorHoverStyle","endpointStyle","endpointHoverStyle"],o=[];"override"===m.mergeStrategy?Array.prototype.push.apply(n,["events","overlays","cssClass"]):o.push("cssClass"),i=b.merge(i,m,o,n),h(f,m,l)}}}c&&(i=b.populate(i,c,"_")),a.applyType(i,d,f),d||a.repaint()}},j=a.jsPlumbUIComponent=function(a){b.EventGenerator.apply(this,arguments);var c=this,d=arguments,e=c.idPrefix,f=e+(new Date).getTime();this._jsPlumb={instance:a._jsPlumb,parameters:a.parameters||{},paintStyle:null,hoverPaintStyle:null,paintStyleInUse:null,hover:!1,beforeDetach:a.beforeDetach,beforeDrop:a.beforeDrop,overlayPlacements:[],hoverClass:a.hoverClass||a._jsPlumb.Defaults.HoverClass,types:[],typeCache:{}},this.cacheTypeItem=function(a,b,c){this._jsPlumb.typeCache[c]=this._jsPlumb.typeCache[c]||{},this._jsPlumb.typeCache[c][a]=b},this.getCachedTypeItem=function(a,b){return this._jsPlumb.typeCache[b]?this._jsPlumb.typeCache[b][a]:null},this.getId=function(){return f};var g=a.overlays||[],h={};if(this.defaultOverlayKeys){for(var i=0;i<this.defaultOverlayKeys.length;i++)Array.prototype.push.apply(g,this._jsPlumb.instance.Defaults[this.defaultOverlayKeys[i]]||[]);for(i=0;i<g.length;i++){var j=o.convertToFullOverlaySpec(g[i]);h[j[1].id]=j}}var k={overlays:h,parameters:a.parameters||{},scope:a.scope||this._jsPlumb.instance.getDefaultScope()};if(this.getDefaultType=function(){return k},this.appendToDefaultType=function(a){for(var b in a)k[b]=a[b]},a.events)for(var l in a.events)c.bind(l,a.events[l]);this.clone=function(){var a=Object.create(this.constructor.prototype);return this.constructor.apply(a,d),a}.bind(this),this.isDetachAllowed=function(a){var c=!0;if(this._jsPlumb.beforeDetach)try{c=this._jsPlumb.beforeDetach(a)}catch(d){b.log("jsPlumb: beforeDetach callback failed",d)}return c},this.isDropAllowed=function(a,c,d,e,f,g,h){var i=this._jsPlumb.instance.checkCondition("beforeDrop",{sourceId:a,targetId:c,scope:d,connection:e,dropEndpoint:f,source:g,target:h});if(this._jsPlumb.beforeDrop)try{i=this._jsPlumb.beforeDrop({sourceId:a,targetId:c,scope:d,connection:e,dropEndpoint:f,source:g,target:h})}catch(j){b.log("jsPlumb: beforeDrop callback failed",j)}return i};var m=[];this.setListenerComponent=function(a){for(var b=0;b<m.length;b++)m[b][3]=a}},k=function(a,b){var c=a._jsPlumb.types[b],d=a._jsPlumb.instance.getType(c,a.getTypeDescriptor());null!=d&&d.cssClass&&a.canvas&&a._jsPlumb.instance.removeClass(a.canvas,d.cssClass)};b.extend(a.jsPlumbUIComponent,b.EventGenerator,{getParameter:function(a){return this._jsPlumb.parameters[a]},setParameter:function(a,b){this._jsPlumb.parameters[a]=b},getParameters:function(){return this._jsPlumb.parameters},setParameters:function(a){this._jsPlumb.parameters=a},getClass:function(){return o.getClass(this.canvas)},hasClass:function(a){return o.hasClass(this.canvas,a)},addClass:function(a){o.addClass(this.canvas,a)},removeClass:function(a){o.removeClass(this.canvas,a)},updateClasses:function(a,b){o.updateClasses(this.canvas,a,b)},setType:function(a,b,c){this.clearTypes(),this._jsPlumb.types=g(a)||[],i(this,b,c)},getType:function(){return this._jsPlumb.types},reapplyTypes:function(a,b){i(this,a,b)},hasType:function(a){return-1!==this._jsPlumb.types.indexOf(a)},addType:function(a,b,c){var d=g(a),e=!1;if(null!=d){for(var f=0,h=d.length;h>f;f++)this.hasType(d[f])||(this._jsPlumb.types.push(d[f]),e=!0);e&&i(this,b,c)}},removeType:function(a,b,c){var d=g(a),e=!1,f=function(a){var b=this._jsPlumb.types.indexOf(a);return-1!==b?(k(this,b),this._jsPlumb.types.splice(b,1),!0):!1}.bind(this);if(null!=d){for(var h=0,j=d.length;j>h;h++)e=f(d[h])||e;e&&i(this,b,c)}},clearTypes:function(a,b){for(var c=this._jsPlumb.types.length,d=0;c>d;d++)k(this,0),this._jsPlumb.types.splice(0,1);i(this,a,b)},toggleType:function(a,b,c){var d=g(a);if(null!=d){for(var e=0,f=d.length;f>e;e++){var h=this._jsPlumb.types.indexOf(d[e]);-1!==h?(k(this,h),this._jsPlumb.types.splice(h,1)):this._jsPlumb.types.push(d[e])}i(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]);this._jsPlumb.paintStyleInUse=this.getPaintStyle()},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(a){(a||null==this.typeId)&&(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()){this._jsPlumb.hover=a;var e=a?"addClass":"removeClass";null!=this.canvas&&(null!=this._jsPlumb.instance.hoverClass&&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 l=0,m=function(){var a=l+1;return l++,a},n=a.jsPlumbInstance=function(d){this.version="2.12.3",this.Defaults={Anchor:"Bottom",Anchors:[null,null],ConnectionsDetachable:!0,ConnectionOverlays:[],Connector:"Bezier",Container:null,DoNotThrowErrors:!1,DragOptions:{},DropOptions:{},Endpoint:"Dot",EndpointOverlays:[],Endpoints:[null,null],EndpointStyle:{fill:"#456"},EndpointStyles:[null,null],EndpointHoverStyle:null,EndpointHoverStyles:[null,null],HoverPaintStyle:null,LabelStyle:{color:"black"},LogEnabled:!1,Overlays:[],MaxConnections:1,PaintStyle:{"stroke-width":4,stroke:"#456"},ReattachConnections:!1,RenderMode:"svg",Scope:"jsPlumb_DefaultScope"},d&&o.extend(this.Defaults,d),this.logEnabled=this.Defaults.LogEnabled,this._connectionTypes={},this._endpointTypes={},b.EventGenerator.apply(this);var f=this,g=m(),h=f.bind,i={},k=1,l=function(a){if(null==a)return null;if(3===a.nodeType||8===a.nodeType)return{el:a,text:!0};var c=f.getElement(a);return{el:c,id:b.isString(a)&&null==c?a:T(c)}};this.getInstanceIndex=function(){return g},this.setZoom=function(a,b){return k=a,f.fire("zoom",k),b&&f.repaintEverything(),!0},this.getZoom=function(){return k};for(var n in this.Defaults)i[n]=this.Defaults[n];var p,q=[];this.unbindContainer=function(){if(null!=p&&q.length>0)for(var a=0;a<q.length;a++)f.off(p,q[a][0],q[a][1])},this.setContainer=function(a){this.unbindContainer(),a=this.getElement(a),this.select().each(function(b){b.moveParent(a)}),this.selectEndpoints().each(function(b){b.moveParent(a)});var b=p;p=a,q.length=0;for(var c={endpointclick:"endpointClick",endpointdblclick:"endpointDblClick"},d=function(a,b,d){var e=b.srcElement||b.target,g=(e&&e.parentNode?e.parentNode._jsPlumb:null)||(e?e._jsPlumb:null)||(e&&e.parentNode&&e.parentNode.parentNode?e.parentNode.parentNode._jsPlumb:null);if(g){g.fire(a,g,b);var h=d?c[d+a]||a:a;f.fire(h,g.component||g,b)}},g=function(a,b,c){q.push([a,c]),f.on(p,a,b,c)},h=function(a){g(a,".jtk-connector",function(b){d(a,b)}),g(a,".jtk-endpoint",function(b){d(a,b,"endpoint")}),g(a,".jtk-overlay",function(b){d(a,b)})},i=0;i<e.length;i++)h(e[i]);for(var j in w){var k=w[j].el;k.parentNode===b&&(b.removeChild(k),p.appendChild(k))}},this.getContainer=function(){return p},this.bind=function(a,b){"ready"===a&&s?b():h.apply(f,[a,b])},f.importDefaults=function(a){for(var b in a)f.Defaults[b]=a[b];return a.Container&&f.setContainer(a.Container),f},f.restoreDefaults=function(){return f.Defaults=o.extend({},i),f};var r=null,s=!1,t=[],u={},v={},w={},x={},y={},z=!1,A=[],B=!1,C=null,D=this.Defaults.Scope,E=1,F=function(){return""+E++},G=function(a,b){p?p.appendChild(a):b?this.getElement(b).appendChild(a):this.appendToRoot(a)}.bind(this),H=function(a,b,d,e){if(!B){var g,h=T(a),i=f.getDragManager();i&&(g=i.getElementsForDraggable(h)),null==d&&(d=c());var j=oa({elId:h,offset:b,recalc:!1,timestamp:d});if(g&&j&&j.o)for(var k in g)oa({elId:g[k].id,offset:{left:j.o.left+g[k].offset.left,top:j.o.top+g[k].offset.top},recalc:!1,timestamp:d});if(f.anchorManager.redraw(h,b,d,null,e),g)for(var l in g)f.anchorManager.redraw(g[l].id,b,d,g[l].offset,e,!0)}},I=function(a){return v[a]},J=function(a,b){for(var c=a.scope.split(/\s/),d=b.scope.split(/\s/),e=0;e<c.length;e++)for(var f=0;f<d.length;f++)if(d[f]===c[e])return!0;return!1},K=function(a,b){var c=o.extend({},a);for(var d in b)b[d]&&(c[d]=b[d]);return c},L=function(a,c){var d=o.extend({},a);if(c&&o.extend(d,c),d.source&&(d.source.endpoint?d.sourceEndpoint=d.source:d.source=f.getElement(d.source)),d.target&&(d.target.endpoint?d.targetEndpoint=d.target:d.target=f.getElement(d.target)),a.uuids&&(d.sourceEndpoint=I(a.uuids[0]),d.targetEndpoint=I(a.uuids[1])),d.sourceEndpoint&&d.sourceEndpoint.isFull())return void b.log(f,"could not add connection; source endpoint is full");if(d.targetEndpoint&&d.targetEndpoint.isFull())return void b.log(f,"could not add connection; target endpoint is full");if(!d.type&&d.sourceEndpoint&&(d.type=d.sourceEndpoint.connectionType),d.sourceEndpoint&&d.sourceEndpoint.connectorOverlays){d.overlays=d.overlays||[];for(var e=0,g=d.sourceEndpoint.connectorOverlays.length;g>e;e++)d.overlays.push(d.sourceEndpoint.connectorOverlays[e])}d.sourceEndpoint&&d.sourceEndpoint.scope&&(d.scope=d.sourceEndpoint.scope),!d["pointer-events"]&&d.sourceEndpoint&&d.sourceEndpoint.connectorPointerEvents&&(d["pointer-events"]=d.sourceEndpoint.connectorPointerEvents);var h=function(a,b,c){var e=K(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});return delete e.label,f.addEndpoint(a,e)},i=function(a,b,c,e){if(d[a]&&!d[a].endpoint&&!d[a+"Endpoint"]&&!d.newConnection){var f=T(d[a]),g=c[f];if(g=g?g[e]:null){if(!g.enabled)return!1;var i=null!=g.endpoint&&g.endpoint._jsPlumb?g.endpoint:h(d[a],g.def,b);if(i.isFull())return!1;d[a+"Endpoint"]=i,!d.scope&&g.def.scope&&(d.scope=g.def.scope),g.uniqueEndpoint?g.endpoint?i.finalEndpoint=g.endpoint:(g.endpoint=i,i.setDeleteOnEmpty(!1)):i.setDeleteOnEmpty(!0),0===b&&g.def.connectorOverlays&&(d.overlays=d.overlays||[],Array.prototype.push.apply(d.overlays,g.def.connectorOverlays))}}};return i("source",0,this.sourceEndpointDefinitions,d.type||"default")!==!1&&i("target",1,this.targetEndpointDefinitions,d.type||"default")!==!1?(d.sourceEndpoint&&d.targetEndpoint&&(J(d.sourceEndpoint,d.targetEndpoint)||(d=null)),d):void 0}.bind(f),M=function(a){var b=f.Defaults.ConnectionType||f.getDefaultConnectionType();a._jsPlumb=f,a.newConnection=M,a.newEndpoint=O,a.endpointsByUUID=v,a.endpointsByElement=u,a.finaliseConnection=N,a.id="con_"+F();var c=new b(a);return c.isDetachable()&&(c.endpoints[0].initDraggable("_jsPlumbSource"),c.endpoints[1].initDraggable("_jsPlumbTarget")),c},N=f.finaliseConnection=function(a,b,c,d){if(b=b||{},a.suspendedEndpoint||t.push(a),a.pending=null,a.endpoints[0].isTemporarySource=!1,d!==!1&&f.anchorManager.newConnection(a),H(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)}},O=function(a,b){var c=f.Defaults.EndpointType||o.Endpoint,d=o.extend({},a);d._jsPlumb=f,d.newConnection=M,d.newEndpoint=O,d.endpointsByUUID=v,d.endpointsByElement=u,d.fireDetachEvent=W,d.elementId=b||T(d.source);var e=new c(d);return e.id="ep_"+F(),na(d.elementId,d.source),o.headless||f.getDragManager().endpointAdded(d.source,b),e},P=function(a,b,c){var d=u[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])}},Q=function(a,b,c){b="block"===b;var d=null;c&&(d=function(a){a.setVisible(b,!0,!0)});var e=l(a);P(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)},R=function(a,b){var c=null;b&&(c=function(a){var b=a.isVisible();a.setVisible(!b)}),P(a,function(a){var b=a.isVisible();a.setVisible(!b)},c)},S=function(a){var b=x[a];return b?{o:b,s:A[a]}:oa({elId:a})},T=function(a,c,d){if(b.isString(a))return a;if(null==a)return null;var e=f.getAttribute(a,"id");return e&&"undefined"!==e||(2===arguments.length&&void 0!==arguments[1]?e=c:(1===arguments.length||3===arguments.length&&!arguments[2])&&(e="jsPlumb_"+g+"_"+F()),d||f.setAttribute(a,"id",e)),e};this.setConnectionBeingDragged=function(a){z=a},this.isConnectionBeingDragged=function(){return z},this.getManagedElements=function(){return w},this.connectorClass="jtk-connector",this.connectorOutlineClass="jtk-connector-outline",this.connectedClass="jtk-connected",this.hoverClass="jtk-hover",this.endpointClass="jtk-endpoint",this.endpointConnectedClass="jtk-endpoint-connected",this.endpointFullClass="jtk-endpoint-full",this.endpointDropAllowedClass="jtk-endpoint-drop-allowed",this.endpointDropForbiddenClass="jtk-endpoint-drop-forbidden",this.overlayClass="jtk-overlay",this.draggingClass="jtk-dragging",this.elementDraggingClass="jtk-element-dragging",this.sourceElementDraggingClass="jtk-source-element-dragging",this.targetElementDraggingClass="jtk-target-element-dragging",this.endpointAnchorClassPrefix="jtk-endpoint-anchor",this.hoverSourceClass="jtk-source-hover",this.hoverTargetClass="jtk-target-hover",this.dragSelectClass="jtk-drag-select",this.Anchors={},this.Connectors={svg:{}},this.Endpoints={svg:{}},this.Overlays={svg:{}},this.ConnectorRenderers={},this.SVG="svg",this.addEndpoint=function(a,c,d){d=d||{};var e=o.extend({},d);o.extend(e,c),e.endpoint=e.endpoint||f.Defaults.Endpoint,e.paintStyle=e.paintStyle||f.Defaults.EndpointStyle;for(var g=[],h=b.isArray(a)||null!=a.length&&!b.isString(a)?a:[a],i=0,j=h.length;j>i;i++){e.source=f.getElement(h[i]),la(e.source);var k=T(e.source),l=O(e,k),m=na(k,e.source).info.o;b.addToList(u,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)}return 1===g.length?g[0]:g},this.addEndpoints=function(a,c,d){for(var e=[],g=0,h=c.length;h>g;g++){var i=f.addEndpoint(a,c[g],d);b.isArray(i)?Array.prototype.push.apply(e,i):e.push(i)}return e},this.animate=function(a,c,d){if(!this.animationSupported)return!1;d=d||{};var e=f.getElement(a),g=T(e),h=o.animEvents.step,i=o.animEvents.complete;d[h]=b.wrap(d[h],function(){f.revalidate(g)}),d[i]=b.wrap(d[i],function(){f.revalidate(g)}),f.doAnimate(e,c,d)},this.checkCondition=function(a,c){var d=f.getListener(a),e=!0;if(d&&d.length>0){var g=Array.prototype.slice.call(arguments,1);try{for(var h=0,i=d.length;i>h;h++)e=e&&d[h].apply(d[h],g)}catch(j){b.log(f,"cannot check condition ["+a+"]"+j)}}return e},this.connect=function(a,c){var d,e=L(a,c);if(e){if(null==e.source&&null==e.sourceEndpoint)return void b.log("Cannot establish connection - source does not exist");if(null==e.target&&null==e.targetEndpoint)return void b.log("Cannot establish connection - target does not exist");la(e.source),d=M(e),N(d,e)}return d};var U=[{el:"source",elId:"sourceId",epDefs:"sourceEndpointDefinitions"},{el:"target",elId:"targetId",epDefs:"targetEndpointDefinitions"}],V=function(a,b,c,d){var e,f,g,h=U[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===o.Endpoint)e=b,e.addConnection(a),b=e.element;else if(f=T(b),g=this[h.epDefs][f],f===a[h.elId])e=null;else if(g)for(var l in g){if(!g[l].enabled)return;e=null!=g[l].endpoint&&g[l].endpoint._jsPlumb?g[l].endpoint:this.addEndpoint(b,g[l].def),g[l].uniqueEndpoint&&(g[l].endpoint=e),e.addConnection(a)}else e=a.makeEndpoint(0===c,b,f);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,X(k),d||a.repaint()),k.element=b,k}.bind(this);this.setSource=function(a,b,c){var d=V(a,b,0,c);this.anchorManager.sourceChanged(d.originalSourceId,d.newSourceId,a,d.el)},this.setTarget=function(a,b,c){var d=V(a,b,1,c);this.anchorManager.updateOtherEndpoint(d.originalSourceId,d.originalTargetId,d.newTargetId,a)},this.deleteEndpoint=function(a,b,c){var d="string"==typeof a?v[a]:a;return d&&f.deleteObject({endpoint:d,dontUpdateHover:b,deleteAttachedObjects:c}),f},this.deleteEveryEndpoint=function(){var a=f.setSuspendDrawing(!0);for(var b in u){var c=u[b];if(c&&c.length)for(var d=0,e=c.length;e>d;d++)f.deleteEndpoint(c[d],!0)}u={},w={},v={},x={},y={},f.anchorManager.reset();var g=f.getDragManager();return g&&g.reset(),-a||f.setSuspendDrawing(!1),f};var W=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.fire("internal.connectionDetached",g,c),f.anchorManager.connectionDetached(g)},X=f.fireMoveEvent=function(a,b){f.fire("connectionMoved",a,b)};this.unregisterEndpoint=function(a){a._jsPlumb.uuid&&(v[a._jsPlumb.uuid]=null),f.anchorManager.deleteEndpoint(a);for(var b in u){var c=u[b];if(c){for(var d=[],e=0,g=c.length;g>e;e++)c[e]!==a&&d.push(c[e]);u[b]=d}u[b].length<1&&delete u[b]}};var Y="isDetachAllowed",Z="beforeDetach",$="checkCondition";this.deleteConnection=function(a,c){return null!=a&&(c=c||{},c.force||b.functionChain(!0,!1,[[a.endpoints[0],Y,[a]],[a.endpoints[1],Y,[a]],[a,Y,[a]],[f,$,[Z,a]]]))?(a.setHover(!1),W(a,!a.pending&&c.fireEvent!==!1,c.originalEvent),a.endpoints[0].detachFromConnection(a),a.endpoints[1].detachFromConnection(a),b.removeWithFunction(t,function(b){return a.id===b.id}),a.cleanup(),a.destroy(),!0):!1},this.deleteEveryConnection=function(a){a=a||{};var b=t.length,c=0;return f.batch(function(){for(var d=0;b>d;d++)c+=f.deleteConnection(t[0],a)?1:0}),c},this.deleteConnectionsForElement=function(a,b){b=b||{},a=f.getElement(a);var c=T(a),d=u[c];if(d&&d.length)for(var e=0,g=d.length;g>e;e++)d[e].deleteEveryConnection(b);return f},this.deleteObject=function(a){var c={endpoints:{},connections:{},endpointCount:0,connectionCount:0},d=a.deleteAttachedObjects!==!1,e=function(b){null!=b&&null==c.connections[b.id]&&(a.dontUpdateHover||null==b._jsPlumb||b.setHover(!1),c.connections[b.id]=b,c.connectionCount++)},g=function(b){if(null!=b&&null==c.endpoints[b.id]&&(a.dontUpdateHover||null==b._jsPlumb||b.setHover(!1),c.endpoints[b.id]=b,c.endpointCount++,d))for(var f=0;f<b.connections.length;f++){var g=b.connections[f];e(g)}};a.connection?e(a.connection):g(a.endpoint);for(var h in c.connections){var i=c.connections[h];if(i._jsPlumb){b.removeWithFunction(t,function(a){return i.id===a.id}),W(i,a.fireEvent===!1?!1:!i.pending,a.originalEvent);var j=null==a.deleteAttachedObjects?null:!a.deleteAttachedObjects;i.endpoints[0].detachFromConnection(i,null,j),i.endpoints[1].detachFromConnection(i,null,j),i.cleanup(!0),i.destroy(!0)}}for(var k in c.endpoints){var l=c.endpoints[k];l._jsPlumb&&(f.unregisterEndpoint(l),l.cleanup(!0),l.destroy(!0))}return c};var _=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)},aa=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},ba=function(a,b,c){return function(){return _(a,b,arguments,c)}},ca=function(a,b){return function(){return aa(a,b,arguments)}},da=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},ea=function(a,b,c){return"*"===a?!0:a.length>0?-1!==a.indexOf(b):!c};this.getConnections=function(a,b){a?a.constructor===String&&(a={scope:a}):a={};for(var c=a.scope||f.getDefaultScope(),d=da(c,!0),e=da(a.source),g=da(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=t.length;k>j;j++){var l=t[j],m=l.proxies&&l.proxies[0]?l.proxies[0].originalEp.elementId:l.sourceId,n=l.proxies&&l.proxies[1]?l.proxies[1].originalEp.elementId:l.targetId;ea(d,l.scope)&&ea(e,m)&&ea(g,n)&&i(l.scope,l)}return h};var fa=function(a,b){return function(c){for(var d=0,e=a.length;e>d;d++)c(a[d]);return b(a)}},ga=function(a){return function(b){return a[b]}},ha=function(a,b){var c,d,e={length:a.length,each:fa(a,b),get:ga(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]]=ba(a,f[c],b);for(c=0,d=g.length;d>c;c++)e[g[c]]=ca(a,g[c]);return e},ia=function(a){var b=ha(a,ia);return o.extend(b,{setDetachable:ba(a,"setDetachable",ia),setReattach:ba(a,"setReattach",ia),setConnector:ba(a,"setConnector",ia),"delete":function(){for(var b=0,c=a.length;c>b;b++)f.deleteConnection(a[b])},isDetachable:ca(a,"isDetachable"),isReattach:ca(a,"isReattach")})},ja=function(a){var b=ha(a,ja);return o.extend(b,{setEnabled:ba(a,"setEnabled",ja),setAnchor:ba(a,"setAnchor",ja),isEnabled:ca(a,"isEnabled"),deleteEveryConnection:function(){for(var b=0,c=a.length;c>b;b++)a[b].deleteEveryConnection()},"delete":function(){for(var b=0,c=a.length;c>b;b++)f.deleteEndpoint(a[b])}})};this.select=function(a){return a=a||{},a.scope=a.scope||"*",ia(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?"*":da(a.element),d=b?"*":da(a.source),e=b?"*":da(a.target),f=da(a.scope,!0),g=[];for(var h in u){var i=ea(c,h,!0),j=ea(d,h,!0),k="*"!==d,l=ea(e,h,!0),m="*"!==e;if(i||j||l)a:for(var n=0,o=u[h].length;o>n;n++){var p=u[h][n];if(ea(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 ja(g)},this.getAllConnections=function(){return t},this.getDefaultScope=function(){return D},this.getEndpoint=I,this.getEndpoints=function(a){return u[l(a).id]||[]},this.getDefaultEndpointType=function(){return o.Endpoint},this.getDefaultConnectionType=function(){return o.Connection},this.getId=T,this.draw=H,this.info=l,this.appendElement=G;var ka=!1;this.isHoverSuspended=function(){return ka},this.setHoverSuspended=function(a){ka=a},this.hide=function(a,b){return Q(a,"none",b),f},this.idstamp=F;var la=function(a){if(!p&&a){var b=f.getElement(a);b.offsetParent&&f.setContainer(b.offsetParent)}},ma=function(){f.Defaults.Container&&f.setContainer(f.Defaults.Container)},na=f.manage=function(a,b,c){return w[a]||(w[a]={el:b,endpoints:[],connections:[]},w[a].info=oa({elId:a,timestamp:C}),f.addClass(b,"jtk-managed"),c||f.fire("manageElement",{id:a,info:w[a].info,el:b})),w[a]},oa=(f.unmanage=function(a){if(w[a]){var b=w[a].el;f.removeClass(b,"jtk-managed"),delete w[a],f.fire("unmanageElement",{id:a,el:b})}},function(a){var b,c=a.timestamp,d=a.recalc,e=a.offset,g=a.elId;return B&&!c&&(c=C),!d&&c&&c===y[g]?{o:a.offset||x[g],s:A[g]}:(d||!e&&null==x[g]?(b=w[g]?w[g].el:null,null!=b&&(A[g]=f.getSize(b),x[g]=f.getOffset(b),y[g]=c)):(x[g]=e||x[g],null==A[g]&&(b=w[g].el,null!=b&&(A[g]=f.getSize(b))),y[g]=c),x[g]&&!x[g].right&&(x[g].right=x[g].left+A[g][0],x[g].bottom=x[g].top+A[g][1],x[g].width=A[g][0],x[g].height=A[g][1],x[g].centerx=x[g].left+x[g].width/2,x[g].centery=x[g].top+x[g].height/2),{o:x[g],s:A[g]})});this.updateOffset=oa,this.init=function(){s||(ma(),f.anchorManager=new a.jsPlumb.AnchorManager({jsPlumbInstance:f}),s=!0,f.fire("ready",f))}.bind(this),this.log=r,this.jsPlumbUIComponent=j,this.makeAnchor=function(){var c,d=function(b,c){if(a.jsPlumb.Anchors[b])return new a.jsPlumb.Anchors[b](c);if(!f.Defaults.DoNotThrowErrors)throw{msg:"jsPlumb: unknown anchor type '"+b+"'"}};if(0===arguments.length)return null;var e=arguments[0],g=arguments[1],h=(arguments[2],null);if(e.compute&&e.getOrientation)return e;if("string"==typeof e)h=d(arguments[0],{elementId:g,jsPlumbInstance:f});else if(b.isArray(e))if(b.isArray(e[0])||b.isString(e[0]))2===e.length&&b.isObject(e[1])?b.isString(e[0])?(c=a.jsPlumb.extend({elementId:g,jsPlumbInstance:f},e[1]),h=d(e[0],c)):(c=a.jsPlumb.extend({elementId:g,jsPlumbInstance:f,anchors:e[0]},e[1]),h=new a.jsPlumb.DynamicAnchor(c)):h=new o.DynamicAnchor({anchors:e,selector:null,elementId:g,jsPlumbInstance:f});else{var i={x:e[0],y:e[1],orientation:e.length>=4?[e[2],e[3]]:[0,0],offsets:e.length>=6?[e[4],e[5]]:[0,0],elementId:g,jsPlumbInstance:f,cssClass:7===e.length?e[6]:null};h=new a.jsPlumb.Anchor(i),h.clone=function(){return new a.jsPlumb.Anchor(i)}}return h.id||(h.id="anchor_"+F()),h},this.makeAnchors=function(c,d,e){for(var g=[],h=0,i=c.length;i>h;h++)"string"==typeof c[h]?g.push(a.jsPlumb.Anchors[c[h]]({elementId:d,jsPlumbInstance:e})):b.isArray(c[h])&&g.push(f.makeAnchor(c[h],d,e));return g},this.makeDynamicAnchor=function(b,c){return new a.jsPlumb.DynamicAnchor({anchors:b,selector:c,elementId:null,jsPlumbInstance:f})},this.targetEndpointDefinitions={},this.sourceEndpointDefinitions={};var pa=function(a,b,c,d,e){for(var f=a.target||a.srcElement,g=!1,h=d.getSelector(b,c),i=0;i<h.length;i++)if(h[i]===f){g=!0;break}return e?!g:g},qa=function(c,d,e,g,h){var i=new j(d),k=d._jsPlumb.EndpointDropHandler({jsPlumb:f,enabled:function(){return c.def.enabled},isFull:function(){var a=f.select({target:c.id}).length;return c.def.maxConnections>0&&a>=c.def.maxConnections},element:c.el,elementId:c.id,isSource:g,isTarget:h,addClass:function(a){f.addClass(c.el,a)},removeClass:function(a){f.removeClass(c.el,a)},onDrop:function(a){var b=a.endpoints[0];b.anchor.unlock()},isDropAllowed:function(){return i.isDropAllowed.apply(i,arguments)},isRedrop:function(a){return null!=a.suspendedElement&&null!=a.suspendedEndpoint&&a.suspendedEndpoint.element===c.el},getEndpoint:function(b){var e=c.def.endpoint;if(null==e||null==e._jsPlumb){var g=f.deriveEndpointAndAnchorSpec(b.getType().join(" "),!0),h=g.endpoints?a.jsPlumb.extend(d,{endpoint:c.def.def.endpoint||g.endpoints[1]}):d;g.anchors&&(h=a.jsPlumb.extend(h,{anchor:c.def.def.anchor||g.anchors[1]})),e=f.addEndpoint(c.el,h),e._mtNew=!0}if(d.uniqueEndpoint&&(c.def.endpoint=e),e.setDeleteOnEmpty(!0),b.isDetachable()&&e.initDraggable(),null!=e.anchor.positionFinder){var i=f.getUIPosition(arguments,f.getZoom()),j=f.getOffset(c.el),k=f.getSize(c.el),l=null==i?[0,0]:e.anchor.positionFinder(i,j,k,e.anchor.constructorParams);e.anchor.x=l[0],e.anchor.y=l[1]}return e},maybeCleanup:function(a){a._mtNew&&0===a.connections.length?f.deleteObject({endpoint:a}):delete a._mtNew}}),l=a.jsPlumb.dragEvents.drop;return e.scope=e.scope||d.scope||f.Defaults.Scope,e[l]=b.wrap(e[l],k,!0),e.rank=d.rank||0,h&&(e[a.jsPlumb.dragEvents.over]=function(){return!0}),d.allowLoopback===!1&&(e.canDrop=function(a){var b=a.getDragElement()._jsPlumbRelatedElement;return b!==c.el}),f.initDroppable(c.el,e,"internal"),k};this.makeTarget=function(b,c,d){var e=a.jsPlumb.extend({_jsPlumb:this},d);a.jsPlumb.extend(e,c);for(var g=e.maxConnections||-1,h=function(b){var c=l(b),d=c.id,h=a.jsPlumb.extend({},e.dropOptions||{}),i=e.connectionType||"default";this.targetEndpointDefinitions[d]=this.targetEndpointDefinitions[d]||{},la(d),c.el._isJsPlumbGroup&&null==h.rank&&(h.rank=-1);var j={def:a.jsPlumb.extend({},e),uniqueEndpoint:e.uniqueEndpoint,maxConnections:g,enabled:!0};e.createEndpoint&&(j.uniqueEndpoint=!0,j.endpoint=f.addEndpoint(b,j.def),j.endpoint.setDeleteOnEmpty(!1)),c.def=j,this.targetEndpointDefinitions[d][i]=j,qa(c,e,h,e.isSource===!0,!0),c.el._katavorioDrop[c.el._katavorioDrop.length-1].targetDef=j}.bind(this),i=b.length&&b.constructor!==String?b:[b],j=0,k=i.length;k>j;j++)h(i[j]);return this},this.unmakeTarget=function(a,b){var c=l(a);return f.destroyDroppable(c.el,"internal"),b||delete this.targetEndpointDefinitions[c.id],this},this.makeSource=function(c,d,e){var g=a.jsPlumb.extend({_jsPlumb:this},e);a.jsPlumb.extend(g,d);var h=g.connectionType||"default",i=f.deriveEndpointAndAnchorSpec(h);g.endpoint=g.endpoint||i.endpoints[0],g.anchor=g.anchor||i.anchors[0];for(var j=g.maxConnections||-1,m=g.onMaxConnections,n=function(d){var e=d.id,i=this.getElement(d.el);this.sourceEndpointDefinitions[e]=this.sourceEndpointDefinitions[e]||{},la(e);var l={def:a.jsPlumb.extend({},g),uniqueEndpoint:g.uniqueEndpoint,maxConnections:j,enabled:!0};g.createEndpoint&&(l.uniqueEndpoint=!0,l.endpoint=f.addEndpoint(c,l.def),l.endpoint.setDeleteOnEmpty(!1)),this.sourceEndpointDefinitions[e][h]=l,d.def=l;var n=a.jsPlumb.dragEvents.stop,o=a.jsPlumb.dragEvents.drag,p=a.jsPlumb.extend({},g.dragOptions||{}),q=p.drag,r=p.stop,s=null,t=!1;p.scope=p.scope||g.scope,p[o]=b.wrap(p[o],function(){q&&q.apply(this,arguments),t=!1}),p[n]=b.wrap(p[n],function(){if(r&&r.apply(this,arguments),this.currentlyDragging=!1,null!=s._jsPlumb){var a=g.anchor||this.Defaults.Anchor,b=s.anchor,c=s.connections[0],d=this.makeAnchor(a,e,this),h=s.element;if(null!=d.positionFinder){var i=f.getOffset(h),j=this.getSize(h),k={left:i.left+b.x*j[0],top:i.top+b.y*j[1]},l=d.positionFinder(k,i,j,d.constructorParams);d.x=l[0],d.y=l[1]}s.setAnchor(d,!0),s.repaint(),this.repaint(s.elementId),null!=c&&this.repaint(c.targetId)}}.bind(this));var u=function(c){if(3!==c.which&&2!==c.button){var l=this.sourceEndpointDefinitions[e][h];if(l.enabled){if(e=this.getId(this.getElement(d.el)),g.filter){var n=b.isString(g.filter)?pa(c,d.el,g.filter,this,g.filterExclude):g.filter(c,d.el);if(n===!1)return}var o=this.select({source:e}).length;if(l.maxConnections>=0&&o>=l.maxConnections)return m&&m({element:d.el,maxConnections:j},c),!1;var q=a.jsPlumb.getPositionOnElement(c,i,k),r={};a.jsPlumb.extend(r,l.def),r.isTemporarySource=!0,r.anchor=[q[0],q[1],0,0],r.dragOptions=p,l.def.scope&&(r.scope=l.def.scope),s=this.addEndpoint(e,r),t=!0,s.setDeleteOnEmpty(!0),l.uniqueEndpoint&&(l.endpoint?s.finalEndpoint=l.endpoint:(l.endpoint=s,s.setDeleteOnEmpty(!1)));var u=function(){f.off(s.canvas,"mouseup",u),f.off(d.el,"mouseup",u),t&&(t=!1,f.deleteEndpoint(s))};f.on(s.canvas,"mouseup",u),f.on(d.el,"mouseup",u);var v={};if(l.def.extract)for(var w in l.def.extract){var x=(c.srcElement||c.target).getAttribute(w);x&&(v[l.def.extract[w]]=x)}f.trigger(s.canvas,"mousedown",c,v),b.consume(c)}}}.bind(this);this.on(d.el,"mousedown",u),l.trigger=u,g.filter&&(b.isString(g.filter)||b.isFunction(g.filter))&&f.setDragFilter(d.el,g.filter);var v=a.jsPlumb.extend({},g.dropOptions||{});qa(d,g,v,!0,g.isTarget===!0)}.bind(this),o=c.length&&c.constructor!==String?c:[c],p=0,q=o.length;q>p;p++)n(l(o[p]));return this},this.unmakeSource=function(a,b,c){var d=l(a);f.destroyDroppable(d.el,"internal");var e=this.sourceEndpointDefinitions[d.id];if(e)for(var g in e)if(null==b||b===g){var h=e[g].trigger;h&&f.off(d.el,"mousedown",h),c||delete this.sourceEndpointDefinitions[d.id][g]}return this},this.unmakeEverySource=function(){for(var a in this.sourceEndpointDefinitions)f.unmakeSource(a,null,!0);return this.sourceEndpointDefinitions={},this};var ra=function(a,c,d){c=b.isArray(c)?c:[c];var e=T(a);d=d||"default";for(var f=0;f<c.length;f++){var g=this[c[f]][e];if(g&&g[d])return g[d].def.scope||this.Defaults.Scope}}.bind(this),sa=function(a,c,d,e){d=b.isArray(d)?d:[d];var f=T(a);e=e||"default";for(var g=0;g<d.length;g++){var h=this[d[g]][f];h&&h[e]&&(h[e].def.scope=c)}}.bind(this);this.getScope=function(a,b){return ra(a,["sourceEndpointDefinitions","targetEndpointDefinitions"])},this.getSourceScope=function(a){return ra(a,"sourceEndpointDefinitions")},this.getTargetScope=function(a){return ra(a,"targetEndpointDefinitions")},this.setScope=function(a,b,c){this.setSourceScope(a,b,c),this.setTargetScope(a,b,c)},this.setSourceScope=function(a,b,c){sa(a,b,"sourceEndpointDefinitions",c),this.setDragScope(a,b)},this.setTargetScope=function(a,b,c){sa(a,b,"targetEndpointDefinitions",c),this.setDropScope(a,b)},this.unmakeEveryTarget=function(){for(var a in this.targetEndpointDefinitions)f.unmakeTarget(a,!0);return this.targetEndpointDefinitions={},this};var ta=function(a,c,d,e,g){var h,i,j,k="source"===a?this.sourceEndpointDefinitions:this.targetEndpointDefinitions;if(g=g||"default",c.length&&!b.isString(c)){h=[];for(var m=0,n=c.length;n>m;m++)i=l(c[m]),k[i.id]&&k[i.id][g]&&(h[m]=k[i.id][g].enabled,j=e?!h[m]:d,k[i.id][g].enabled=j,f[j?"removeClass":"addClass"](i.el,"jtk-"+a+"-disabled"))}else{i=l(c);var o=i.id;k[o]&&k[o][g]&&(h=k[o][g].enabled,j=e?!h:d,k[o][g].enabled=j,f[j?"removeClass":"addClass"](i.el,"jtk-"+a+"-disabled"))}return h}.bind(this),ua=function(a,c){return b.isString(a)||!a.length?c.apply(this,[a]):a.length?c.apply(this,[a[0]]):void 0}.bind(this);this.toggleSourceEnabled=function(a,b){return ta("source",a,null,!0,b),this.isSourceEnabled(a,b)},this.setSourceEnabled=function(a,b,c){return ta("source",a,b,null,c)},this.isSource=function(a,b){return b=b||"default",ua(a,function(a){var c=this.sourceEndpointDefinitions[l(a).id];return null!=c&&null!=c[b]}.bind(this))},this.isSourceEnabled=function(a,b){return b=b||"default",ua(a,function(a){var c=this.sourceEndpointDefinitions[l(a).id];return c&&c[b]&&c[b].enabled===!0}.bind(this))},this.toggleTargetEnabled=function(a,b){return ta("target",a,null,!0,b),this.isTargetEnabled(a,b)},this.isTarget=function(a,b){return b=b||"default",ua(a,function(a){var c=this.targetEndpointDefinitions[l(a).id];return null!=c&&null!=c[b]}.bind(this))},this.isTargetEnabled=function(a,b){return b=b||"default",ua(a,function(a){var c=this.targetEndpointDefinitions[l(a).id];return c&&c[b]&&c[b].enabled===!0}.bind(this))},this.setTargetEnabled=function(a,b,c){return ta("target",a,b,null,c)},this.ready=function(a){f.bind("ready",a)};var va=function(a,b){if("object"==typeof a&&a.length)for(var c=0,d=a.length;d>c;c++)b(a[c]);else b(a);return f};this.repaint=function(a,b,c){return va(a,function(a){H(a,b,c)})},this.revalidate=function(a,b,c){return va(a,function(a){var d=c?a:f.getId(a);f.updateOffset({elId:d,recalc:!0,timestamp:b});var e=f.getDragManager();e&&e.updateOffsets(d),f.repaint(a)})},this.repaintEverything=function(){var a,b=c();for(a in u)f.updateOffset({elId:a,recalc:!0,timestamp:b});for(a in u)H(a,null,b);return this},this.removeAllEndpoints=function(a,b,c){c=c||[];var d=function(a){var e,g,h=l(a),i=u[h.id];if(i)for(c.push(h),e=0,g=i.length;g>e;e++)f.deleteEndpoint(i[e],!1);if(delete u[h.id],b&&h.el&&3!==h.el.nodeType&&8!==h.el.nodeType)for(e=0,g=h.el.childNodes.length;g>e;e++)d(h.el.childNodes[e])};return d(a),this};var wa=function(a,b){f.removeAllEndpoints(a.id,!0,b);for(var c=f.getDragManager(),d=function(a){c&&c.elementRemoved(a.id),f.anchorManager.clearFor(a.id),f.anchorManager.removeFloatingConnection(a.id),f.isSource(a.el)&&f.unmakeSource(a.el),f.isTarget(a.el)&&f.unmakeTarget(a.el),f.destroyDraggable(a.el),f.destroyDroppable(a.el),delete f.floatingConnections[a.id],delete w[a.id],delete x[a.id],a.el&&(f.removeElement(a.el),a.el._jsPlumb=null)},e=1;e<b.length;e++)d(b[e]);d(a)};this.remove=function(a,b){var c=l(a),d=[];return c.text?c.el.parentNode.removeChild(c.el):c.id&&f.batch(function(){wa(c,d)},b===!0),f},this.empty=function(a,b){var c=[],d=function(a,b){var e=l(a);if(e.text)e.el.parentNode.removeChild(e.el);else if(e.el){for(;e.el.childNodes.length>0;)d(e.el.childNodes[0]);b||wa(e,c)}};return f.batch(function(){d(a,!0)},b===!1),f},this.reset=function(a){f.silently(function(){ka=!1,f.removeAllGroups(),f.removeGroupManager(),f.deleteEveryEndpoint(),a||f.unbind(),this.targetEndpointDefinitions={},this.sourceEndpointDefinitions={},t.length=0,this.doReset&&this.doReset()}.bind(this))};var xa=function(a){a.canvas&&a.canvas.parentNode&&a.canvas.parentNode.removeChild(a.canvas),a.cleanup(),a.destroy()};this.clear=function(){f.select().each(xa),f.selectEndpoints().each(xa),u={},v={}},this.setDefaultScope=function(a){return D=a,f},this.deriveEndpointAndAnchorSpec=function(a,b){for(var c=((b?"":"default ")+a).split(/[\s]/),d=null,e=null,g=null,h=null,i=0;i<c.length;i++){var j=f.getType(c[i],"connection");j&&(j.endpoints&&(d=j.endpoints),j.endpoint&&(e=j.endpoint),j.anchors&&(h=j.anchors),j.anchor&&(g=j.anchor))}return{endpoints:d?d:[e,e],anchors:h?h:[g,g]}},this.setId=function(a,c,d){var e;b.isString(a)?e=a:(a=this.getElement(a),e=this.getId(a));var f=this.getConnections({source:e,scope:"*"},!0),g=this.getConnections({target:e,scope:"*"},!0);c=""+c,d?a=this.getElement(c):(a=this.getElement(e),this.setAttribute(a,"id",c)),u[c]=u[e]||[];for(var h=0,i=u[c].length;i>h;h++)u[c][h].setElementId(c),u[c][h].setReferenceElement(a);delete u[e],this.sourceEndpointDefinitions[c]=this.sourceEndpointDefinitions[e],delete this.sourceEndpointDefinitions[e],this.targetEndpointDefinitions[c]=this.targetEndpointDefinitions[e],delete this.targetEndpointDefinitions[e],this.anchorManager.changeId(e,c);var j=this.getDragManager();j&&j.changeId(e,c),w[c]=w[e],delete w[e];var k=function(b,d,e){for(var f=0,g=b.length;g>f;f++)b[f].endpoints[d].setElementId(c),b[f].endpoints[d].setReferenceElement(a),b[f][e+"Id"]=c,b[f][e]=a};k(f,0,"source"),k(g,1,"target"),this.repaint(c)},this.setDebugLog=function(a){r=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.batch=function(a,c){var d=this.isSuspendDrawing();d||this.setSuspendDrawing(!0);try{a()}catch(e){b.log("Function run while suspended failed",e)}d||this.setSuspendDrawing(!1,!c)},this.doWhileSuspended=this.batch,this.getCachedData=S,this.timestamp=c,this.show=function(a,b){return Q(a,"block",b),f},this.toggleVisible=R,this.addListener=this.bind;var ya=[];this.registerFloatingConnection=function(a,c,d){ya[a.id]=c,b.addToList(u,a.id,d)},this.getFloatingConnectionFor=function(a){return ya[a]},this.listManager=new a.jsPlumbListManager(this)};b.extend(a.jsPlumbInstance,b.EventGenerator,{setAttribute:function(a,b,c){this.setAttribute(a,b,c)},getAttribute:function(b,c){return this.getAttribute(a.jsPlumb.getElement(b),c)},convertToFullOverlaySpec:function(a){return b.isString(a)&&(a=[a,{}]),a[1].id=a[1].id||b.uuid(),a},registerConnectionType:function(b,c){if(this._connectionTypes[b]=a.jsPlumb.extend({},c),c.overlays){for(var d={},e=0;e<c.overlays.length;e++){var f=this.convertToFullOverlaySpec(c.overlays[e]);d[f[1].id]=f}this._connectionTypes[b].overlays=d}},registerConnectionTypes:function(a){for(var b in a)this.registerConnectionType(b,a[b])},registerEndpointType:function(b,c){if(this._endpointTypes[b]=a.jsPlumb.extend({},c),c.overlays){for(var d={},e=0;e<c.overlays.length;e++){var f=this.convertToFullOverlaySpec(c.overlays[e]);d[f[1].id]=f}this._endpointTypes[b].overlays=d}},registerEndpointTypes:function(a){for(var b in a)this.registerEndpointType(b,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.getElement(a),d=this.getId(c),e=this.getElement(b),f=this.getId(e),g=this.getDragManager();c.parentNode.removeChild(c),e.appendChild(c),g&&g.setParent(c,d,e,f)},extend:function(a,b,c){var d;if(c)for(d=0;d<c.length;d++)a[c[d]]=b[c[d]];else for(d in b)a[d]=b[d];return a},floatingConnections:{},getFloatingAnchorIndex:function(a){return a.endpoints[0].isFloating()?0:a.endpoints[1].isFloating()?1:-1},proxyConnection:function(a,b,c,d,e,f){var g,h=a.endpoints[b].elementId,i=a.endpoints[b];a.proxies=a.proxies||[],g=a.proxies[b]?a.proxies[b].ep:this.addEndpoint(c,{endpoint:e(a,b),anchor:f(a,b),parameters:{isProxyEndpoint:!0}}),g.setDeleteOnEmpty(!0),a.proxies[b]={ep:g,originalEp:i},0===b?this.anchorManager.sourceChanged(h,d,a,c):(this.anchorManager.updateOtherEndpoint(a.endpoints[0].elementId,h,d,a),a.target=c,a.targetId=d),i.detachFromConnection(a,null,!0),g.connections=[a],a.endpoints[b]=g,i.setVisible(!1),a.setVisible(!0),this.revalidate(c)},unproxyConnection:function(a,b,c){if(null!=a._jsPlumb&&null!=a.proxies&&null!=a.proxies[b]){var d=a.proxies[b].originalEp.element,e=a.proxies[b].originalEp.elementId;a.endpoints[b]=a.proxies[b].originalEp,0===b?this.anchorManager.sourceChanged(c,e,a,d):(this.anchorManager.updateOtherEndpoint(a.endpoints[0].elementId,c,e,a),a.target=d,a.targetId=e),a.proxies[b].ep.detachFromConnection(a,null),a.proxies[b].originalEp.addConnection(a),a.isVisible()&&a.proxies[b].originalEp.setVisible(!0),delete a.proxies[b]}}});var o=new n;a.jsPlumb=o,o.getInstance=function(a,b){var c=new n(a);if(b)for(var d in b)c[d]=b[d];return c.init(),c},o.each=function(a,b){if(null!=a)if("string"==typeof a)b(o.getElement(a));else if(null!=a.length)for(var c=0;c<a.length;c++)b(o.getElement(a[c]));else b(a)},"undefined"!=typeof exports&&(exports.jsPlumb=o)}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumb,c=a.jsPlumbUtil,d="__label",e=function(a,c){var e={cssClass:c.cssClass,labelStyle:a.labelStyle,id:d,component:a,_jsPlumb:a._jsPlumb.instance},f=b.extend(e,c);return new(b.Overlays[a._jsPlumb.instance.getRenderMode()].Label)(f)},f=function(a,d){var e=null;if(c.isArray(d)){var f=d[0],g=b.extend({component:a,_jsPlumb:a._jsPlumb.instance},d[1]);3===d.length&&b.extend(g,d[2]),e=new(b.Overlays[a._jsPlumb.instance.getRenderMode()][f])(g)}else e=d.constructor===String?new(b.Overlays[a._jsPlumb.instance.getRenderMode()][d])({component:a,_jsPlumb:a._jsPlumb.instance}):d;return e.id=e.id||c.uuid(),a.cacheTypeItem("overlay",e,e.id),a._jsPlumb.overlays[e.id]=e,e};b.OverlayCapableJsPlumbUIComponent=function(b){a.jsPlumbUIComponent.apply(this,arguments),this._jsPlumb.overlays={},this._jsPlumb.overlayPositions={},b.label&&(this.getDefaultType().overlays[d]=["Label",{label:b.label,location:b.labelLocation||this.defaultLabelLocation||.5,labelStyle:b.labelStyle||this._jsPlumb.instance.Defaults.LabelStyle,id:d}]),this.setListenerComponent=function(a){if(this._jsPlumb)for(var b in this._jsPlumb.overlays)this._jsPlumb.overlays[b].setListenerComponent(a)}},b.OverlayCapableJsPlumbUIComponent.applyType=function(a,b){if(b.overlays){var c,d={};for(c in b.overlays){var e=a._jsPlumb.overlays[b.overlays[c][1].id];if(e)e.updateFrom(b.overlays[c][1]),d[b.overlays[c][1].id]=!0;else{var f=a.getCachedTypeItem("overlay",b.overlays[c][1].id);null!=f?(f.reattach(a._jsPlumb.instance,a),f.setVisible(!0),f.updateFrom(b.overlays[c][1]),a._jsPlumb.overlays[f.id]=f):f=a.addOverlay(b.overlays[c],!0),d[f.id]=!0}}for(c in a._jsPlumb.overlays)null==d[a._jsPlumb.overlays[c].id]&&a.removeOverlay(a._jsPlumb.overlays[c].id,!0)}},c.extend(b.OverlayCapableJsPlumbUIComponent,a.jsPlumbUIComponent,{setHover:function(a,b){if(this._jsPlumb&&!this._jsPlumb.instance.isConnectionBeingDragged())for(var c in this._jsPlumb.overlays)this._jsPlumb.overlays[c][a?"addClass":"removeClass"](this._jsPlumb.instance.hoverClass)},addOverlay:function(a,b){var d=f(this,a);if(this.getData&&"Label"===d.type&&c.isArray(a)){var e=this.getData(),g=a[1];if(e){var h=g.labelLocationAttribute||"labelLocation",i=e?e[h]:null;i&&(d.loc=i)}}return b||this.repaint(),d},getOverlay:function(a){return this._jsPlumb.overlays[a]},getOverlays:function(){return this._jsPlumb.overlays},hideOverlay:function(a){var b=this.getOverlay(a);b&&b.hide()},hideOverlays:function(){for(var a in this._jsPlumb.overlays)this._jsPlumb.overlays[a].hide()},showOverlay:function(a){var b=this.getOverlay(a);b&&b.show()},showOverlays:function(){for(var a in this._jsPlumb.overlays)this._jsPlumb.overlays[a].show()},removeAllOverlays:function(a){for(var b in this._jsPlumb.overlays)this._jsPlumb.overlays[b].cleanup&&this._jsPlumb.overlays[b].cleanup();this._jsPlumb.overlays={},this._jsPlumb.overlayPositions=null,this._jsPlumb.overlayPlacements={},a||this.repaint()},removeOverlay:function(a,b){var c=this._jsPlumb.overlays[a];c&&(c.setVisible(!1),!b&&c.cleanup&&c.cleanup(),delete this._jsPlumb.overlays[a],this._jsPlumb.overlayPositions&&delete this._jsPlumb.overlayPositions[a],this._jsPlumb.overlayPlacements&&delete this._jsPlumb.overlayPlacements[a])},removeOverlays:function(){for(var a=0,b=arguments.length;b>a;a++)this.removeOverlay(arguments[a])},moveParent:function(a){if(this.bgCanvas&&(this.bgCanvas.parentNode.removeChild(this.bgCanvas),a.appendChild(this.bgCanvas)),this.canvas&&this.canvas.parentNode){this.canvas.parentNode.removeChild(this.canvas),a.appendChild(this.canvas);for(var b in this._jsPlumb.overlays)if(this._jsPlumb.overlays[b].isAppendedAtTopLevel){var c=this._jsPlumb.overlays[b].getElement();c.parentNode.removeChild(c),a.appendChild(c)}}},getLabel:function(){var a=this.getOverlay(d);return null!=a?a.getLabel():null},getLabelOverlay:function(){return this.getOverlay(d)},setLabel:function(a){var b=this.getOverlay(d);if(b)a.constructor===String||a.constructor===Function?b.setLabel(a):(a.label&&b.setLabel(a.label),a.location&&b.setLocation(a.location));else{var c=a.constructor===String||a.constructor===Function?{label:a}:a;b=e(this,c),this._jsPlumb.overlays[d]=b}this._jsPlumb.instance.isSuspendDrawing()||this.repaint()},cleanup:function(a){for(var b in this._jsPlumb.overlays)this._jsPlumb.overlays[b].cleanup(a),this._jsPlumb.overlays[b].destroy(a);a&&(this._jsPlumb.overlays={},this._jsPlumb.overlayPositions=null)},setVisible:function(a){this[a?"showOverlays":"hideOverlays"]()},setAbsoluteOverlayPosition:function(a,b){this._jsPlumb.overlayPositions[a.id]=b},getAbsoluteOverlayPosition:function(a){return this._jsPlumb.overlayPositions?this._jsPlumb.overlayPositions[a.id]:null},_clazzManip:function(a,b,c){if(!c)for(var d in this._jsPlumb.overlays)this._jsPlumb.overlays[d][a+"Class"](b)},addClass:function(a,b){this._clazzManip("add",a,b)},removeClass:function(a,b){this._clazzManip("remove",a,b)}})}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumb,c=a.jsPlumbUtil,d=function(a,b,c){var d=!1;return{drag:function(){if(d)return d=!1,!0;if(b.element){var e=c.getUIPosition(arguments,c.getZoom());null!=e&&c.setPosition(b.element,e),c.repaint(b.element,e),a.paint({anchorPoint:a.anchor.getCurrentLocation({element:a})})}},stopDrag:function(){d=!0}}},e=function(a,b,c,d){var e=b.createElement("div",{position:"absolute"});b.appendElement(e);var f=b.getId(e);b.setPosition(e,c),e.style.width=d[0]+"px",e.style.height=d[1]+"px",b.manage(f,e,!0),a.id=f,a.element=e},f=function(a,c,d,e,f,g,h,i){var j=new b.FloatingAnchor({reference:c,referenceCanvas:e,jsPlumbInstance:g});return h({paintStyle:a,endpoint:d,anchor:j,source:f,scope:i})},g=["connectorStyle","connectorHoverStyle","connectorOverlays","connector","connectionType","connectorClass","connectorHoverClass"],h=function(a,b){var c=0;if(null!=b)for(var d=0;d<a.connections.length;d++)if(a.connections[d].sourceId===b||a.connections[d].targetId===b){c=d;break}return a.connections[c]};b.Endpoint=function(a){var i=a._jsPlumb,j=a.newConnection,k=a.newEndpoint;this.idPrefix="_jsplumb_e_",this.defaultLabelLocation=[.5,.5],this.defaultOverlayKeys=["Overlays","EndpointOverlays"],b.OverlayCapableJsPlumbUIComponent.apply(this,arguments),this.appendToDefaultType({connectionType:a.connectionType,maxConnections:null==a.maxConnections?this._jsPlumb.instance.Defaults.MaxConnections:a.maxConnections,paintStyle:a.endpointStyle||a.paintStyle||a.style||this._jsPlumb.instance.Defaults.EndpointStyle||b.Defaults.EndpointStyle,hoverPaintStyle:a.endpointHoverStyle||a.hoverPaintStyle||this._jsPlumb.instance.Defaults.EndpointHoverStyle||b.Defaults.EndpointHoverStyle,connectorStyle:a.connectorStyle,connectorHoverStyle:a.connectorHoverStyle,connectorClass:a.connectorClass,connectorHoverClass:a.connectorHoverClass,connectorOverlays:a.connectorOverlays,connector:a.connector,connectorTooltip:a.connectorTooltip}),this._jsPlumb.enabled=!(a.enabled===!1),this._jsPlumb.visible=!0,this.element=b.getElement(a.source),this._jsPlumb.uuid=a.uuid,this._jsPlumb.floatingEndpoint=null;var l=null;this._jsPlumb.uuid&&(a.endpointsByUUID[this._jsPlumb.uuid]=this),this.elementId=a.elementId,this.dragProxy=a.dragProxy,this._jsPlumb.connectionCost=a.connectionCost,this._jsPlumb.connectionsDirected=a.connectionsDirected,this._jsPlumb.currentAnchorClass="",this._jsPlumb.events={};var m=a.deleteOnEmpty===!0;this.setDeleteOnEmpty=function(a){m=a};var n=function(){var a=i.endpointAnchorClassPrefix+"-"+this._jsPlumb.currentAnchorClass;this._jsPlumb.currentAnchorClass=this.anchor.getCssClass();-var c=i.endpointAnchorClassPrefix+(this._jsPlumb.currentAnchorClass?"-"+this._jsPlumb.currentAnchorClass:"");this.removeClass(a),this.addClass(c),b.updateClasses(this.element,c,a)}.bind(this);this.prepareAnchor=function(a){var b=this._jsPlumb.instance.makeAnchor(a,this.elementId,i);return b.bind("anchorChanged",function(a){this.fire("anchorChanged",{endpoint:this,anchor:a}),n()}.bind(this)),b},this.setPreparedAnchor=function(a,b){return this._jsPlumb.instance.continuousAnchorFactory.clear(this.elementId),this.anchor=a,n(),b||this._jsPlumb.instance.repaint(this.elementId),this},this.setAnchor=function(a,b){var c=this.prepareAnchor(a);return this.setPreparedAnchor(c,b),this};var o=function(a){if(this.connections.length>0)for(var b=0;b<this.connections.length;b++)this.connections[b].setHover(a,!1);else this.setHover(a)}.bind(this);this.bind("mouseover",function(){o(!0)}),this.bind("mouseout",function(){o(!1)}),a._transient||this._jsPlumb.instance.anchorManager.add(this,this.elementId),this.prepareEndpoint=function(d,e){var f,g=function(a,c){var d=i.getRenderMode();if(b.Endpoints[d][a])return new b.Endpoints[d][a](c);if(!i.Defaults.DoNotThrowErrors)throw{msg:"jsPlumb: unknown endpoint type '"+a+"'"}},h={_jsPlumb:this._jsPlumb.instance,cssClass:a.cssClass,container:a.container,tooltip:a.tooltip,connectorTooltip:a.connectorTooltip,endpoint:this};return c.isString(d)?f=g(d,h):c.isArray(d)?(h=c.merge(d[1],h),f=g(d[0],h)):f=d.clone(),f.clone=function(){return c.isString(d)?g(d,h):c.isArray(d)?(h=c.merge(d[1],h),g(d[0],h)):void 0}.bind(this),f.typeId=e,f},this.setEndpoint=function(a,b){var c=this.prepareEndpoint(a);this.setPreparedEndpoint(c,!0)},this.setPreparedEndpoint=function(a,b){null!=this.endpoint&&(this.endpoint.cleanup(),this.endpoint.destroy()),this.endpoint=a,this.type=this.endpoint.type,this.canvas=this.endpoint.canvas},b.extend(this,a,g),this.isSource=a.isSource||!1,this.isTemporarySource=a.isTemporarySource||!1,this.isTarget=a.isTarget||!1,this.connections=a.connections||[],this.connectorPointerEvents=a["connector-pointer-events"],this.scope=a.scope||i.getDefaultScope(),this.timestamp=null,this.reattachConnections=a.reattach||i.Defaults.ReattachConnections,this.connectionsDetachable=i.Defaults.ConnectionsDetachable,(a.connectionsDetachable===!1||a.detachable===!1)&&(this.connectionsDetachable=!1),this.dragAllowedWhenFull=a.dragAllowedWhenFull!==!1,a.onMaxConnections&&this.bind("maxConnections",a.onMaxConnections),this.addConnection=function(a){this.connections.push(a),this[(this.connections.length>0?"add":"remove")+"Class"](i.endpointConnectedClass),this[(this.isFull()?"add":"remove")+"Class"](i.endpointFullClass)},this.detachFromConnection=function(a,b,c){b=null==b?this.connections.indexOf(a):b,b>=0&&(this.connections.splice(b,1),this[(this.connections.length>0?"add":"remove")+"Class"](i.endpointConnectedClass),this[(this.isFull()?"add":"remove")+"Class"](i.endpointFullClass)),!c&&m&&0===this.connections.length&&i.deleteObject({endpoint:this,fireEvent:!1,deleteAttachedObjects:c!==!0})},this.deleteEveryConnection=function(a){for(var b=this.connections.length,c=0;b>c;c++)i.deleteConnection(this.connections[0],a)},this.detachFrom=function(a,b,c){for(var d=[],e=0;e<this.connections.length;e++)(this.connections[e].endpoints[1]===a||this.connections[e].endpoints[0]===a)&&d.push(this.connections[e]);for(var f=0,g=d.length;g>f;f++)i.deleteConnection(d[0]);return this},this.getElement=function(){return this.element},this.setElement=function(d){var e=this._jsPlumb.instance.getId(d),f=this.elementId;return c.removeWithFunction(a.endpointsByElement[this.elementId],function(a){return a.id===this.id}.bind(this)),this.element=b.getElement(d),this.elementId=i.getId(this.element),i.anchorManager.rehomeEndpoint(this,f,this.element),i.dragManager.endpointAdded(this.element),c.addToList(a.endpointsByElement,e,this),this},this.makeInPlaceCopy=function(){var b=this.anchor.getCurrentLocation({element:this}),c=this.anchor.getOrientation(this),d=this.anchor.getCssClass(),e={bind:function(){},compute:function(){return[b[0],b[1]]},getCurrentLocation:function(){return[b[0],b[1]]},getOrientation:function(){return c},getCssClass:function(){return d}};return k({dropOptions:a.dropOptions,anchor:e,source:this.element,paintStyle:this.getPaintStyle(),endpoint:a.hideOnDrag?"Blank":this.endpoint,_transient:!0,scope:this.scope,reference:this})},this.connectorSelector=function(){return this.connections[0]},this.setStyle=this.setPaintStyle,this.paint=function(a){a=a||{};var b=a.timestamp,c=!(a.recalc===!1);if(!b||this.timestamp!==b){var d=i.updateOffset({elId:this.elementId,timestamp:b}),e=a.offset?a.offset.o:d.o;if(null!=e){var f=a.anchorPoint,g=a.connectorPaintStyle;if(null==f){var j=a.dimensions||d.s,k={xy:[e.left,e.top],wh:j,element:this,timestamp:b};if(c&&this.anchor.isDynamic&&this.connections.length>0){var l=h(this,a.elementWithPrecedence),m=l.endpoints[0]===this?1:0,n=0===m?l.sourceId:l.targetId,o=i.getCachedData(n),p=o.o,q=o.s;k.index=0===m?1:0,k.connection=l,k.txy=[p.left,p.top],k.twh=q,k.tElement=l.endpoints[m]}else this.connections.length>0&&(k.connection=this.connections[0]);f=this.anchor.compute(k)}this.endpoint.compute(f,this.anchor.getOrientation(this),this._jsPlumb.paintStyleInUse,g||this.paintStyleInUse),this.endpoint.paint(this._jsPlumb.paintStyleInUse,this.anchor),this.timestamp=b;for(var r in this._jsPlumb.overlays)if(this._jsPlumb.overlays.hasOwnProperty(r)){var s=this._jsPlumb.overlays[r];s.isVisible()&&(this._jsPlumb.overlayPlacements[r]=s.draw(this.endpoint,this._jsPlumb.paintStyleInUse),s.paint(this._jsPlumb.overlayPlacements[r]))}}}},this.getTypeDescriptor=function(){return"endpoint"},this.isVisible=function(){return this._jsPlumb.visible},this.repaint=this.paint;var p=!1;this.initDraggable=function(){if(!p&&b.isDragSupported(this.element)){var g,h={id:null,element:null},m=null,n=!1,o=null,q=d(this,h,i),r=a.dragOptions||{},s={},t=b.dragEvents.start,u=b.dragEvents.stop,v=b.dragEvents.drag,w=b.dragEvents.beforeStart,x=function(a){g=a.e.payload||{}},y=function(c){m=this.connectorSelector();var d=!0;this.isEnabled()||(d=!1),null!=m||this.isSource||this.isTemporarySource||(d=!1),!this.isSource||!this.isFull()||null!=m&&this.dragAllowedWhenFull||(d=!1),null==m||m.isDetachable(this)||(this.isFull()?d=!1:m=null);var l=i.checkCondition(null==m?"beforeDrag":"beforeStartDetach",{endpoint:this,source:this.element,sourceId:this.elementId,connection:m});if(l===!1?d=!1:"object"==typeof l?b.extend(l,g||{}):l=g||{},d===!1)return i.stopDrag&&i.stopDrag(this.canvas),q.stopDrag(),!1;for(var p=0;p<this.connections.length;p++)this.connections[p].setHover(!1);this.addClass("endpointDrag"),i.setConnectionBeingDragged(!0),m&&!this.isFull()&&this.isSource&&(m=null),i.updateOffset({elId:this.elementId});var r=this._jsPlumb.instance.getOffset(this.canvas),s=this.canvas,t=this._jsPlumb.instance.getSize(this.canvas);e(h,i,r,t),i.setAttributes(this.canvas,{dragId:h.id,elId:this.elementId});var u=this.dragProxy||this.endpoint;if(null==this.dragProxy&&null!=this.connectionType){var v=this._jsPlumb.instance.deriveEndpointAndAnchorSpec(this.connectionType);v.endpoints[1]&&(u=v.endpoints[1])}var w=this._jsPlumb.instance.makeAnchor("Center");w.isFloating=!0,this._jsPlumb.floatingEndpoint=f(this.getPaintStyle(),w,u,this.canvas,h.element,i,k,this.scope);var x=this._jsPlumb.floatingEndpoint.anchor;if(null==m)this.setHover(!1,!1),m=j({sourceEndpoint:this,targetEndpoint:this._jsPlumb.floatingEndpoint,source:this.element,target:h.element,anchors:[this.anchor,this._jsPlumb.floatingEndpoint.anchor],paintStyle:a.connectorStyle,hoverPaintStyle:a.connectorHoverStyle,connector:a.connector,overlays:a.connectorOverlays,type:this.connectionType,cssClass:this.connectorClass,hoverClass:this.connectorHoverClass,scope:a.scope,data:l}),m.pending=!0,m.addClass(i.draggingClass),this._jsPlumb.floatingEndpoint.addClass(i.draggingClass),this._jsPlumb.floatingEndpoint.anchor=x,i.fire("connectionDrag",m),i.anchorManager.newConnection(m);else{n=!0,m.setHover(!1);var y=m.endpoints[0].id===this.id?0:1;this.detachFromConnection(m,null,!0);var z=i.getDragScope(s);i.setAttribute(this.canvas,"originalScope",z),i.fire("connectionDrag",m),0===y?(o=[m.source,m.sourceId,s,z],i.anchorManager.sourceChanged(m.endpoints[y].elementId,h.id,m,h.element)):(o=[m.target,m.targetId,s,z],m.target=h.element,m.targetId=h.id,i.anchorManager.updateOtherEndpoint(m.sourceId,m.endpoints[y].elementId,m.targetId,m)),m.suspendedEndpoint=m.endpoints[y],m.suspendedElement=m.endpoints[y].getElement(),m.suspendedElementId=m.endpoints[y].elementId,m.suspendedElementType=0===y?"source":"target",m.suspendedEndpoint.setHover(!1),this._jsPlumb.floatingEndpoint.referenceEndpoint=m.suspendedEndpoint,m.endpoints[y]=this._jsPlumb.floatingEndpoint,m.addClass(i.draggingClass),this._jsPlumb.floatingEndpoint.addClass(i.draggingClass)}i.registerFloatingConnection(h,m,this._jsPlumb.floatingEndpoint),i.currentlyDragging=!0}.bind(this),z=function(){if(i.setConnectionBeingDragged(!1),m&&null!=m.endpoints){var a=i.getDropEvent(arguments),b=i.getFloatingAnchorIndex(m);if(m.endpoints[0===b?1:0].anchor.unlock(),m.removeClass(i.draggingClass),this._jsPlumb&&(m.deleteConnectionNow||m.endpoints[b]===this._jsPlumb.floatingEndpoint)&&n&&m.suspendedEndpoint){0===b?(m.floatingElement=m.source,m.floatingId=m.sourceId,m.floatingEndpoint=m.endpoints[0],m.floatingIndex=0,m.source=o[0],m.sourceId=o[1]):(m.floatingElement=m.target,m.floatingId=m.targetId,m.floatingEndpoint=m.endpoints[1],m.floatingIndex=1,m.target=o[0],m.targetId=o[1]);var c=this._jsPlumb.floatingEndpoint;i.setDragScope(o[2],o[3]),m.endpoints[b]=m.suspendedEndpoint,m.isReattach()||m._forceReattach||m._forceDetach||!i.deleteConnection(m,{originalEvent:a})?(m.setHover(!1),m._forceDetach=null,m._forceReattach=null,this._jsPlumb.floatingEndpoint.detachFromConnection(m),m.suspendedEndpoint.addConnection(m),1===b?i.anchorManager.updateOtherEndpoint(m.sourceId,m.floatingId,m.targetId,m):i.anchorManager.sourceChanged(m.floatingId,m.sourceId,m,m.source),i.repaint(o[1])):i.deleteObject({endpoint:c})}this.deleteAfterDragStop?i.deleteObject({endpoint:this}):this._jsPlumb&&this.paint({recalc:!1}),i.fire("connectionDragStop",m,a),m.pending&&i.fire("connectionAborted",m,a),i.currentlyDragging=!1,m.suspendedElement=null,m.suspendedEndpoint=null,m=null}h&&h.element&&i.remove(h.element,!1,!1),l&&i.deleteObject({endpoint:l}),this._jsPlumb&&(this.canvas.style.visibility="visible",this.anchor.unlock(),this._jsPlumb.floatingEndpoint=null)}.bind(this);r=b.extend(s,r),r.scope=this.scope||r.scope,r[w]=c.wrap(r[w],x,!1),r[t]=c.wrap(r[t],y,!1),r[v]=c.wrap(r[v],q.drag),r[u]=c.wrap(r[u],z),r.multipleDrop=!1,r.canDrag=function(){return this.isSource||this.isTemporarySource||this.connections.length>0&&this.connectionsDetachable!==!1}.bind(this),i.initDraggable(this.canvas,r,"internal"),this.canvas._jsPlumbRelatedElement=this.element,p=!0}};var q=a.endpoint||this._jsPlumb.instance.Defaults.Endpoint||b.Defaults.Endpoint;this.setEndpoint(q,!0);var r=a.anchor?a.anchor:a.anchors?a.anchors:i.Defaults.Anchor||"Top";this.setAnchor(r,!0);var s=["default",a.type||""].join(" ");this.addType(s,a.data,!0),this.canvas=this.endpoint.canvas,this.canvas._jsPlumb=this,this.initDraggable();var t=function(d,e,f,g){if(b.isDropSupported(this.element)){var h=a.dropOptions||i.Defaults.DropOptions||b.Defaults.DropOptions;h=b.extend({},h),h.scope=h.scope||this.scope;var j=b.dragEvents.drop,k=b.dragEvents.over,l=b.dragEvents.out,m=this,n=i.EndpointDropHandler({getEndpoint:function(){return m},jsPlumb:i,enabled:function(){return null!=f?f.isEnabled():!0},isFull:function(){return f.isFull()},element:this.element,elementId:this.elementId,isSource:this.isSource,isTarget:this.isTarget,addClass:function(a){m.addClass(a)},removeClass:function(a){m.removeClass(a)},isDropAllowed:function(){return m.isDropAllowed.apply(m,arguments)},reference:g,isRedrop:function(a,b){return a.suspendedEndpoint&&b.reference&&a.suspendedEndpoint.id===b.reference.id}});h[j]=c.wrap(h[j],n,!0),h[k]=c.wrap(h[k],function(){var a=b.getDragObject(arguments),c=i.getAttribute(b.getElement(a),"dragId"),d=i.getFloatingConnectionFor(c);if(null!=d){var e=i.getFloatingAnchorIndex(d),f=this.isTarget&&0!==e||d.suspendedEndpoint&&this.referenceEndpoint&&this.referenceEndpoint.id===d.suspendedEndpoint.id;if(f){var g=i.checkCondition("checkDropAllowed",{sourceEndpoint:d.endpoints[e],targetEndpoint:this,connection:d});this[(g?"add":"remove")+"Class"](i.endpointDropAllowedClass),this[(g?"remove":"add")+"Class"](i.endpointDropForbiddenClass),d.endpoints[e].anchor.over(this.anchor,this)}}}.bind(this)),h[l]=c.wrap(h[l],function(){var a=b.getDragObject(arguments),c=null==a?null:i.getAttribute(b.getElement(a),"dragId"),d=c?i.getFloatingConnectionFor(c):null;if(null!=d){var e=i.getFloatingAnchorIndex(d),f=this.isTarget&&0!==e||d.suspendedEndpoint&&this.referenceEndpoint&&this.referenceEndpoint.id===d.suspendedEndpoint.id;f&&(this.removeClass(i.endpointDropAllowedClass),this.removeClass(i.endpointDropForbiddenClass),d.endpoints[e].anchor.out())}}.bind(this)),i.initDroppable(d,h,"internal",e)}}.bind(this);return this.anchor.isFloating||t(this.canvas,!(a._transient||this.anchor.isFloating),this,a.reference),this},c.extend(b.Endpoint,b.OverlayCapableJsPlumbUIComponent,{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;d<this.connections.length;d++)if(this.connections[d].setVisible(a),!c){var e=this===this.connections[d].endpoints[0]?1:0;1===this.connections[d].endpoints[e].connections.length&&this.connections[d].endpoints[e].setVisible(a,!0,!0)}},getAttachedElements:function(){return this.connections},applyType:function(a,c){this.setPaintStyle(a.endpointStyle||a.paintStyle,c),this.setHoverPaintStyle(a.endpointHoverStyle||a.hoverPaintStyle,c),null!=a.maxConnections&&(this._jsPlumb.maxConnections=a.maxConnections),a.scope&&(this.scope=a.scope),b.extend(this,a,g),null!=a.cssClass&&this.canvas&&this._jsPlumb.instance.addClass(this.canvas,a.cssClass),b.OverlayCapableJsPlumbUIComponent.applyType(this,a)},isEnabled:function(){return this._jsPlumb.enabled},setEnabled:function(a){this._jsPlumb.enabled=a},cleanup:function(){var a=this._jsPlumb.instance.endpointAnchorClassPrefix+(this._jsPlumb.currentAnchorClass?"-"+this._jsPlumb.currentAnchorClass:"");b.removeClass(this.element,a),this.anchor=null,this.endpoint.cleanup(!0),this.endpoint.destroy(),this.endpoint=null,this._jsPlumb.instance.destroyDraggable(this.canvas,"internal"),this._jsPlumb.instance.destroyDroppable(this.canvas,"internal")},setHover:function(a){this.endpoint&&this._jsPlumb&&!this._jsPlumb.instance.isConnectionBeingDragged()&&this.endpoint.setHover(a)},isFull:function(){return 0===this._jsPlumb.maxConnections?!0:!(this.isFloating()||this._jsPlumb.maxConnections<0||this.connections.length<this._jsPlumb.maxConnections)},isFloating:function(){return null!=this.anchor&&this.anchor.isFloating},isConnectedTo:function(a){var b=!1;if(a)for(var c=0;c<this.connections.length;c++)if(this.connections[c].endpoints[1]===a||this.connections[c].endpoints[0]===a){b=!0;break}return b},getConnectionCost:function(){return this._jsPlumb.connectionCost},setConnectionCost:function(a){this._jsPlumb.connectionCost=a},areConnectionsDirected:function(){return this._jsPlumb.connectionsDirected},setConnectionsDirected:function(a){this._jsPlumb.connectionsDirected=a},setElementId:function(a){this.elementId=a,this.anchor.elementId=a},setReferenceElement:function(a){this.element=b.getElement(a)},setDragAllowedWhenFull:function(a){this.dragAllowedWhenFull=a},equals:function(a){return this.anchor.equals(a.anchor)},getUuid:function(){return this._jsPlumb.uuid},computeAnchor:function(a){return this.anchor.compute(a)}}),a.jsPlumbInstance.prototype.EndpointDropHandler=function(a){return function(b){var d=a.jsPlumb;a.removeClass(d.endpointDropAllowedClass),a.removeClass(d.endpointDropForbiddenClass);var e=d.getDropEvent(arguments),f=d.getDragObject(arguments),g=d.getAttribute(f,"dragId"),h=(d.getAttribute(f,"elId"),d.getAttribute(f,"originalScope")),i=d.getFloatingConnectionFor(g);if(null!=i){var j=null!=i.suspendedEndpoint;if(!j||null!=i.suspendedEndpoint._jsPlumb){var k=a.getEndpoint(i);if(null!=k){if(a.isRedrop(i,a))return i._forceReattach=!0,i.setHover(!1),void(a.maybeCleanup&&a.maybeCleanup(k));var l=d.getFloatingAnchorIndex(i);if(0===l&&!a.isSource||1===l&&!a.isTarget)return void(a.maybeCleanup&&a.maybeCleanup(k));a.onDrop&&a.onDrop(i),h&&d.setDragScope(f,h);var m=a.isFull(b);if(m&&k.fire("maxConnections",{endpoint:this,connection:i,maxConnections:k._jsPlumb.maxConnections},e),!m&&a.enabled()){var n=!0;0===l?(i.floatingElement=i.source,i.floatingId=i.sourceId,i.floatingEndpoint=i.endpoints[0],i.floatingIndex=0,i.source=a.element,i.sourceId=a.elementId):(i.floatingElement=i.target,i.floatingId=i.targetId,i.floatingEndpoint=i.endpoints[1],i.floatingIndex=1,i.target=a.element,i.targetId=a.elementId),j&&i.suspendedEndpoint.id!==k.id&&(i.isDetachAllowed(i)&&i.endpoints[l].isDetachAllowed(i)&&i.suspendedEndpoint.isDetachAllowed(i)&&d.checkCondition("beforeDetach",i)||(n=!1));var o=function(b){i.endpoints[l].detachFromConnection(i),i.suspendedEndpoint&&i.suspendedEndpoint.detachFromConnection(i),i.endpoints[l]=k,k.addConnection(i);var f=k.getParameters();for(var g in f)i.setParameter(g,f[g]);if(j){var h=i.suspendedEndpoint.elementId;d.fireMoveEvent({index:l,originalSourceId:0===l?h:i.sourceId,newSourceId:0===l?k.elementId:i.sourceId,originalTargetId:1===l?h:i.targetId,newTargetId:1===l?k.elementId:i.targetId,originalSourceEndpoint:0===l?i.suspendedEndpoint:i.endpoints[0],newSourceEndpoint:0===l?k:i.endpoints[0],originalTargetEndpoint:1===l?i.suspendedEndpoint:i.endpoints[1],newTargetEndpoint:1===l?k:i.endpoints[1],connection:i},e)}else f.draggable&&d.initDraggable(this.element,a.dragOptions,"internal",d);if(1===l?d.anchorManager.updateOtherEndpoint(i.sourceId,i.floatingId,i.targetId,i):d.anchorManager.sourceChanged(i.floatingId,i.sourceId,i,i.source),i.endpoints[0].finalEndpoint){var m=i.endpoints[0];m.detachFromConnection(i),i.endpoints[0]=i.endpoints[0].finalEndpoint,i.endpoints[0].addConnection(i)}c.isObject(b)&&i.mergeData(b),d.finaliseConnection(i,null,e,!1),i.setHover(!1),d.revalidate(i.endpoints[0].element)}.bind(this),p=function(){i.suspendedEndpoint&&(i.endpoints[l]=i.suspendedEndpoint,i.setHover(!1),i._forceDetach=!0,0===l?(i.source=i.suspendedEndpoint.element,i.sourceId=i.suspendedEndpoint.elementId):(i.target=i.suspendedEndpoint.element,i.targetId=i.suspendedEndpoint.elementId),i.suspendedEndpoint.addConnection(i),1===l?d.anchorManager.updateOtherEndpoint(i.sourceId,i.floatingId,i.targetId,i):d.anchorManager.sourceChanged(i.floatingId,i.sourceId,i,i.source),d.repaint(i.sourceId),i._forceDetach=!1)};if(n=n&&a.isDropAllowed(i.sourceId,i.targetId,i.scope,i,k))return o(n),!0;p()}a.maybeCleanup&&a.maybeCleanup(k),d.currentlyDragging=!1}}}}}}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumb,c=a.jsPlumbUtil,d=function(a,d,e,f,g){if(b.Connectors[d]=b.Connectors[d]||{},null==b.Connectors[d][e]){if(null==b.Connectors[e]){if(a.Defaults.DoNotThrowErrors)return null;throw new TypeError("jsPlumb: unknown connector type '"+e+"'")}b.Connectors[d][e]=function(){b.Connectors[e].apply(this,arguments),b.ConnectorRenderers[d].apply(this,arguments)},c.extend(b.Connectors[d][e],[b.Connectors[e],b.ConnectorRenderers[d]])}return new b.Connectors[d][e](f,g)},e=function(a,b,c){return a?c.makeAnchor(a,b,c):null},f=function(a,b,d,e){null!=b&&(b._jsPlumbConnections=b._jsPlumbConnections||{},e?delete b._jsPlumbConnections[a.id]:b._jsPlumbConnections[a.id]=!0,c.isEmpty(b._jsPlumbConnections)?d.removeClass(b,d.connectedClass):d.addClass(b,d.connectedClass))};b.Connection=function(a){var d=a.newEndpoint;this.id=a.id,this.connector=null,this.idPrefix="_jsplumb_c_",this.defaultLabelLocation=.5,this.defaultOverlayKeys=["Overlays","ConnectionOverlays"],this.previousConnection=a.previousConnection,this.source=b.getElement(a.source),this.target=b.getElement(a.target),b.OverlayCapableJsPlumbUIComponent.apply(this,arguments),a.sourceEndpoint?(this.source=a.sourceEndpoint.getElement(),this.sourceId=a.sourceEndpoint.elementId):this.sourceId=this._jsPlumb.instance.getId(this.source),a.targetEndpoint?(this.target=a.targetEndpoint.getElement(),this.targetId=a.targetEndpoint.elementId):this.targetId=this._jsPlumb.instance.getId(this.target),this.scope=a.scope,this.endpoints=[],this.endpointStyles=[];var e=this._jsPlumb.instance;e.manage(this.sourceId,this.source),e.manage(this.targetId,this.target),this._jsPlumb.visible=!0,this._jsPlumb.params={cssClass:a.cssClass,container:a.container,"pointer-events":a["pointer-events"],editorParams:a.editorParams,overlays:a.overlays},this._jsPlumb.lastPaintedAt=null,this.bind("mouseover",function(){this.setHover(!0)}.bind(this)),this.bind("mouseout",function(){this.setHover(!1)}.bind(this)),this.makeEndpoint=function(b,c,f,g,h){return f=f||this._jsPlumb.instance.getId(c),this.prepareEndpoint(e,d,this,g,b?0:1,a,c,f,h)},a.type&&(a.endpoints=a.endpoints||this._jsPlumb.instance.deriveEndpointAndAnchorSpec(a.type).endpoints);var f=this.makeEndpoint(!0,this.source,this.sourceId,a.sourceEndpoint),g=this.makeEndpoint(!1,this.target,this.targetId,a.targetEndpoint);f&&c.addToList(a.endpointsByElement,this.sourceId,f),g&&c.addToList(a.endpointsByElement,this.targetId,g),this.scope||(this.scope=this.endpoints[0].scope),null!=a.deleteEndpointsOnEmpty&&(this.endpoints[0].setDeleteOnEmpty(a.deleteEndpointsOnEmpty),this.endpoints[1].setDeleteOnEmpty(a.deleteEndpointsOnEmpty));var h=e.Defaults.ConnectionsDetachable;a.detachable===!1&&(h=!1),this.endpoints[0].connectionsDetachable===!1&&(h=!1),this.endpoints[1].connectionsDetachable===!1&&(h=!1);var i=a.reattach||this.endpoints[0].reattachConnections||this.endpoints[1].reattachConnections||e.Defaults.ReattachConnections;this.appendToDefaultType({detachable:h,reattach:i,paintStyle:this.endpoints[0].connectorStyle||this.endpoints[1].connectorStyle||a.paintStyle||e.Defaults.PaintStyle||b.Defaults.PaintStyle,hoverPaintStyle:this.endpoints[0].connectorHoverStyle||this.endpoints[1].connectorHoverStyle||a.hoverPaintStyle||e.Defaults.HoverPaintStyle||b.Defaults.HoverPaintStyle});var j=e.getSuspendedAt();if(!e.isSuspendDrawing()){var k=e.getCachedData(this.sourceId),l=k.o,m=k.s,n=e.getCachedData(this.targetId),o=n.o,p=n.s,q=j||e.timestamp(),r=this.endpoints[0].anchor.compute({xy:[l.left,l.top],wh:m,element:this.endpoints[0],elementId:this.endpoints[0].elementId,txy:[o.left,o.top],twh:p,tElement:this.endpoints[1],timestamp:q});this.endpoints[0].paint({anchorLoc:r,timestamp:q}),r=this.endpoints[1].anchor.compute({xy:[o.left,o.top],wh:p,element:this.endpoints[1],elementId:this.endpoints[1].elementId,txy:[l.left,l.top],twh:m,tElement:this.endpoints[0],timestamp:q}),this.endpoints[1].paint({anchorLoc:r,timestamp:q})}this.getTypeDescriptor=function(){return"connection"},this.getAttachedElements=function(){return this.endpoints},this.isDetachable=function(a){return this._jsPlumb.detachable===!1?!1:null!=a?a.connectionsDetachable===!0:this._jsPlumb.detachable===!0},this.setDetachable=function(a){this._jsPlumb.detachable=a===!0},this.isReattach=function(){return this._jsPlumb.reattach===!0||this.endpoints[0].reattachConnections===!0||this.endpoints[1].reattachConnections===!0},this.setReattach=function(a){this._jsPlumb.reattach=a===!0},this._jsPlumb.cost=a.cost||this.endpoints[0].getConnectionCost(),this._jsPlumb.directed=a.directed,null==a.directed&&(this._jsPlumb.directed=this.endpoints[0].areConnectionsDirected());var s=b.extend({},this.endpoints[1].getParameters());b.extend(s,this.endpoints[0].getParameters()),b.extend(s,this.getParameters()),this.setParameters(s),this.setConnector(this.endpoints[0].connector||this.endpoints[1].connector||a.connector||e.Defaults.Connector||b.Defaults.Connector,!0);var t=null!=a.data&&c.isObject(a.data)?a.data:{};this.getData=function(){return t},this.setData=function(a){t=a||{}},this.mergeData=function(a){t=b.extend(t,a)};var u=["default",this.endpoints[0].connectionType,this.endpoints[1].connectionType,a.type].join(" ");/[^\s]/.test(u)&&this.addType(u,a.data,!0),this.updateConnectedClass()},c.extend(b.Connection,b.OverlayCapableJsPlumbUIComponent,{applyType:function(a,c,d){var e=null;null!=a.connector&&(e=this.getCachedTypeItem("connector",d.connector),null==e&&(e=this.prepareConnector(a.connector,d.connector),this.cacheTypeItem("connector",e,d.connector)),this.setPreparedConnector(e)),null!=a.detachable&&this.setDetachable(a.detachable),null!=a.reattach&&this.setReattach(a.reattach),a.scope&&(this.scope=a.scope),null!=a.cssClass&&this.canvas&&this._jsPlumb.instance.addClass(this.canvas,a.cssClass);var f=null;a.anchor?(f=this.getCachedTypeItem("anchors",d.anchor),null==f&&(f=[this._jsPlumb.instance.makeAnchor(a.anchor),this._jsPlumb.instance.makeAnchor(a.anchor)],this.cacheTypeItem("anchors",f,d.anchor))):a.anchors&&(f=this.getCachedTypeItem("anchors",d.anchors),null==f&&(f=[this._jsPlumb.instance.makeAnchor(a.anchors[0]),this._jsPlumb.instance.makeAnchor(a.anchors[1])],this.cacheTypeItem("anchors",f,d.anchors))),null!=f&&(this.endpoints[0].anchor=f[0],this.endpoints[1].anchor=f[1],this.endpoints[1].anchor.isDynamic&&this._jsPlumb.instance.repaint(this.endpoints[1].elementId)),b.OverlayCapableJsPlumbUIComponent.applyType(this,a)},addClass:function(a,b){b&&(this.endpoints[0].addClass(a),this.endpoints[1].addClass(a),this.suspendedEndpoint&&this.suspendedEndpoint.addClass(a)),this.connector&&this.connector.addClass(a)},removeClass:function(a,b){b&&(this.endpoints[0].removeClass(a),this.endpoints[1].removeClass(a),this.suspendedEndpoint&&this.suspendedEndpoint.removeClass(a)),this.connector&&this.connector.removeClass(a)},isVisible:function(){return this._jsPlumb.visible},setVisible:function(a){this._jsPlumb.visible=a,this.connector&&this.connector.setVisible(a),this.repaint()},cleanup:function(){this.updateConnectedClass(!0),this.endpoints=null,this.source=null,this.target=null,null!=this.connector&&(this.connector.cleanup(!0),this.connector.destroy(!0)),this.connector=null},updateConnectedClass:function(a){this._jsPlumb&&(f(this,this.source,this._jsPlumb.instance,a),f(this,this.target,this._jsPlumb.instance,a))},setHover:function(b){this.connector&&this._jsPlumb&&!this._jsPlumb.instance.isConnectionBeingDragged()&&(this.connector.setHover(b),a.jsPlumb[b?"addClass":"removeClass"](this.source,this._jsPlumb.instance.hoverSourceClass),a.jsPlumb[b?"addClass":"removeClass"](this.target,this._jsPlumb.instance.hoverTargetClass))},getUuids:function(){return[this.endpoints[0].getUuid(),this.endpoints[1].getUuid()]},getCost:function(){return this._jsPlumb?this._jsPlumb.cost:-(1/0)},setCost:function(a){this._jsPlumb.cost=a},isDirected:function(){return this._jsPlumb.directed},getConnector:function(){return this.connector},prepareConnector:function(a,b){var e,f={_jsPlumb:this._jsPlumb.instance,cssClass:this._jsPlumb.params.cssClass,container:this._jsPlumb.params.container,"pointer-events":this._jsPlumb.params["pointer-events"]},g=this._jsPlumb.instance.getRenderMode();return c.isString(a)?e=d(this._jsPlumb.instance,g,a,f,this):c.isArray(a)&&(e=1===a.length?d(this._jsPlumb.instance,g,a[0],f,this):d(this._jsPlumb.instance,g,a[0],c.merge(a[1],f),this)),null!=b&&(e.typeId=b),e},setPreparedConnector:function(a,b,c,d){if(this.connector!==a){var e,f="";if(null!=this.connector&&(e=this.connector,f=e.getClass(),this.connector.cleanup(),this.connector.destroy()),this.connector=a,d&&this.cacheTypeItem("connector",a,d),this.canvas=this.connector.canvas,this.bgCanvas=this.connector.bgCanvas,this.connector.reattach(this._jsPlumb.instance),this.addClass(f),this.canvas&&(this.canvas._jsPlumb=this),this.bgCanvas&&(this.bgCanvas._jsPlumb=this),null!=e)for(var g=this.getOverlays(),h=0;h<g.length;h++)g[h].transfer&&g[h].transfer(this.connector);c||this.setListenerComponent(this.connector),b||this.repaint()}},setConnector:function(a,b,c,d){var e=this.prepareConnector(a,d);this.setPreparedConnector(e,b,c,d)},paint:function(a){if(!this._jsPlumb.instance.isSuspendDrawing()&&this._jsPlumb.visible){a=a||{};var b=a.timestamp,c=!1,d=c?this.sourceId:this.targetId,e=c?this.targetId:this.sourceId,f=c?0:1,g=c?1:0;if(null==b||b!==this._jsPlumb.lastPaintedAt){var h=this._jsPlumb.instance.updateOffset({elId:e}).o,i=this._jsPlumb.instance.updateOffset({elId:d}).o,j=this.endpoints[g],k=this.endpoints[f],l=j.anchor.getCurrentLocation({xy:[h.left,h.top],wh:[h.width,h.height],element:j,timestamp:b}),m=k.anchor.getCurrentLocation({xy:[i.left,i.top],wh:[i.width,i.height],element:k,timestamp:b});this.connector.resetBounds(),this.connector.compute({sourcePos:l,targetPos:m,sourceOrientation:j.anchor.getOrientation(j),targetOrientation:k.anchor.getOrientation(k),sourceEndpoint:this.endpoints[g],targetEndpoint:this.endpoints[f],"stroke-width":this._jsPlumb.paintStyleInUse.strokeWidth,sourceInfo:h,targetInfo:i});var n={minX:1/0,minY:1/0,maxX:-(1/0),maxY:-(1/0)};for(var o in this._jsPlumb.overlays)if(this._jsPlumb.overlays.hasOwnProperty(o)){var p=this._jsPlumb.overlays[o];p.isVisible()&&(this._jsPlumb.overlayPlacements[o]=p.draw(this.connector,this._jsPlumb.paintStyleInUse,this.getAbsoluteOverlayPosition(p)),n.minX=Math.min(n.minX,this._jsPlumb.overlayPlacements[o].minX),n.maxX=Math.max(n.maxX,this._jsPlumb.overlayPlacements[o].maxX),n.minY=Math.min(n.minY,this._jsPlumb.overlayPlacements[o].minY),n.maxY=Math.max(n.maxY,this._jsPlumb.overlayPlacements[o].maxY))}var q=parseFloat(this._jsPlumb.paintStyleInUse.strokeWidth||1)/2,r=parseFloat(this._jsPlumb.paintStyleInUse.strokeWidth||0),s={xmin:Math.min(this.connector.bounds.minX-(q+r),n.minX),ymin:Math.min(this.connector.bounds.minY-(q+r),n.minY),xmax:Math.max(this.connector.bounds.maxX+(q+r),n.maxX),ymax:Math.max(this.connector.bounds.maxY+(q+r),n.maxY)};this.connector.paintExtents=s,this.connector.paint(this._jsPlumb.paintStyleInUse,null,s);for(var t in this._jsPlumb.overlays)if(this._jsPlumb.overlays.hasOwnProperty(t)){var u=this._jsPlumb.overlays[t];u.isVisible()&&u.paint(this._jsPlumb.overlayPlacements[t],s)}}this._jsPlumb.lastPaintedAt=b}},repaint:function(a){var b=jsPlumb.extend(a||{},{});b.elId=this.sourceId,this.paint(b)},prepareEndpoint:function(a,c,d,f,g,h,i,j,k){var l;if(f)d.endpoints[g]=f,f.addConnection(d);else{h.endpoints||(h.endpoints=[null,null]);var m=k||h.endpoints[g]||h.endpoint||a.Defaults.Endpoints[g]||b.Defaults.Endpoints[g]||a.Defaults.Endpoint||b.Defaults.Endpoint;h.endpointStyles||(h.endpointStyles=[null,null]),h.endpointHoverStyles||(h.endpointHoverStyles=[null,null]);var n=h.endpointStyles[g]||h.endpointStyle||a.Defaults.EndpointStyles[g]||b.Defaults.EndpointStyles[g]||a.Defaults.EndpointStyle||b.Defaults.EndpointStyle;null==n.fill&&null!=h.paintStyle&&(n.fill=h.paintStyle.stroke),null==n.outlineStroke&&null!=h.paintStyle&&(n.outlineStroke=h.paintStyle.outlineStroke),null==n.outlineWidth&&null!=h.paintStyle&&(n.outlineWidth=h.paintStyle.outlineWidth);var o=h.endpointHoverStyles[g]||h.endpointHoverStyle||a.Defaults.EndpointHoverStyles[g]||b.Defaults.EndpointHoverStyles[g]||a.Defaults.EndpointHoverStyle||b.Defaults.EndpointHoverStyle;null!=h.hoverPaintStyle&&(null==o&&(o={}),null==o.fill&&(o.fill=h.hoverPaintStyle.stroke));var p=h.anchors?h.anchors[g]:h.anchor?h.anchor:e(a.Defaults.Anchors[g],j,a)||e(b.Defaults.Anchors[g],j,a)||e(a.Defaults.Anchor,j,a)||e(b.Defaults.Anchor,j,a),q=h.uuids?h.uuids[g]:null;l=c({paintStyle:n,hoverPaintStyle:o,endpoint:m,connections:[d],uuid:q,anchor:p,source:i,scope:h.scope,reattach:h.reattach||a.Defaults.ReattachConnections,detachable:h.detachable||a.Defaults.ConnectionsDetachable}),null==f&&l.setDeleteOnEmpty(!0),d.endpoints[g]=l,h.drawEndpoints===!1&&l.setVisible(!1,!0,!0)}return l},replaceEndpoint:function(a,b){-var c=this.endpoints[a],d=c.elementId,e=this._jsPlumb.instance.getEndpoints(d),f=e.indexOf(c),g=this.makeEndpoint(0===a,c.element,d,null,b);this.endpoints[a]=g,e.splice(f,1,g),this._jsPlumb.instance.deleteObject({endpoint:c,deleteAttachedObjects:!1}),this._jsPlumb.instance.fire("endpointReplaced",{previous:c,current:g}),this._jsPlumb.instance.anchorManager.updateOtherEndpoint(this.endpoints[0].elementId,this.endpoints[1].elementId,this.endpoints[1].elementId,this)}})}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumbUtil,c=a.jsPlumb;c.AnchorManager=function(a){var d={},e={},f={},g={},h=this,i={},j=a.jsPlumbInstance,k={},l=function(a,b,c,d,e,f,g){for(var h=[],i=b[e?0:1]/(d.length+1),j=0;j<d.length;j++){var k=(j+1)*i,l=f*b[e?1:0];g&&(k=b[e?0:1]-k);var m=e?k:l,n=c[0]+m,o=m/b[0],p=e?l:k,q=c[1]+p,r=p/b[1];h.push([n,q,o,r,d[j][1],d[j][2]])}return h},m=function(a){return function(b,c){var d=!0;return d=a?b[0][0]<c[0][0]:b[0][0]>c[0][0],d===!1?-1:1}},n=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:-1},o={top:function(a,b){return a[0]>b[0]?1:-1},right:m(!0),bottom:m(!0),left:n},p=function(a,b){return a.sort(b)},q=function(a,b){var c=j.getCachedData(a),d=c.s,g=c.o,h=function(b,c,d,g,h,i,j){if(g.length>0)for(var k=p(g,o[b]),m="right"===b||"top"===b,n=l(b,c,d,k,h,i,m),q=function(a,b){e[a.id]=[b[0],b[1],b[2],b[3]],f[a.id]=j},r=0;r<n.length;r++){var s=n[r][4],t=s.endpoints[0].elementId===a,u=s.endpoints[1].elementId===a;t&&q(s.endpoints[0],n[r]),u&&q(s.endpoints[1],n[r])}};h("bottom",d,[g.left,g.top],b.bottom,!0,1,[0,1]),h("top",d,[g.left,g.top],b.top,!0,0,[0,-1]),h("left",d,[g.left,g.top],b.left,!1,0,[-1,0]),h("right",d,[g.left,g.top],b.right,!1,1,[1,0])};this.reset=function(){d={},g={},i={}},this.addFloatingConnection=function(a,b){k[a]=b},this.removeFloatingConnection=function(a){delete k[a]},this.newConnection=function(a){var d=a.sourceId,e=a.targetId,f=a.endpoints,h=!0,i=function(i,j,k,l,m){d===e&&k.isContinuous&&(a._jsPlumb.instance.removeElement(f[1].canvas),h=!1),b.addToList(g,l,[m,j,k.constructor===c.DynamicAnchor])};i(0,f[0],f[0].anchor,e,a),h&&i(1,f[1],f[1].anchor,d,a)};var r=function(a){!function(a,c){if(a){var d=function(a){return a[4]===c};b.removeWithFunction(a.top,d),b.removeWithFunction(a.left,d),b.removeWithFunction(a.bottom,d),b.removeWithFunction(a.right,d)}}(i[a.elementId],a.id)};this.connectionDetached=function(a,c){var d=a.connection||a,e=a.sourceId,f=a.targetId,i=d.endpoints,j=function(a,c,d,e,f){b.removeWithFunction(g[e],function(a){return a[0].id===f.id})};j(1,i[1],i[1].anchor,e,d),j(0,i[0],i[0].anchor,f,d),d.floatingId&&(j(d.floatingIndex,d.floatingEndpoint,d.floatingEndpoint.anchor,d.floatingId,d),r(d.floatingEndpoint)),r(d.endpoints[0]),r(d.endpoints[1]),c||(h.redraw(d.sourceId),d.targetId!==d.sourceId&&h.redraw(d.targetId))},this.add=function(a,c){b.addToList(d,c,a)},this.changeId=function(a,b){g[b]=g[a],d[b]=d[a],delete g[a],delete d[a]},this.getConnectionsFor=function(a){return g[a]||[]},this.getEndpointsFor=function(a){return d[a]||[]},this.deleteEndpoint=function(a){b.removeWithFunction(d[a.elementId],function(b){return b.id===a.id}),r(a)},this.clearFor=function(a){delete d[a],d[a]=[]};var s=function(c,d,e,f,g,h,i,j,k,l,m,n){var o,p,q=-1,r=-1,s=f.endpoints[i],t=s.id,u=[1,0][i],v=[[d,e],f,g,h,t],w=c[k],x=s._continuousAnchorEdge?c[s._continuousAnchorEdge]:null;if(x){var y=b.findWithFunction(x,function(a){return a[4]===t});if(-1!==y)for(x.splice(y,1),o=0;o<x.length;o++)p=x[o][1],b.addWithFunction(m,p,function(a){return a.id===p.id}),b.addWithFunction(n,x[o][1].endpoints[i],function(a){return a.id===p.endpoints[i].id}),b.addWithFunction(n,x[o][1].endpoints[u],function(a){return a.id===p.endpoints[u].id})}for(o=0;o<w.length;o++)p=w[o][1],1===a.idx&&w[o][3]===h&&-1===r&&(r=o),b.addWithFunction(m,p,function(a){return a.id===p.id}),b.addWithFunction(n,w[o][1].endpoints[i],function(a){return a.id===p.endpoints[i].id}),b.addWithFunction(n,w[o][1].endpoints[u],function(a){return a.id===p.endpoints[u].id});if(-1!==q)w[q]=v;else{var z=j?-1!==r?r:0:w.length;w.splice(z,0,v)}s._continuousAnchorEdge=k};this.updateOtherEndpoint=function(a,d,e,f){var h=b.findWithFunction(g[a],function(a){return a[0].id===f.id}),i=b.findWithFunction(g[d],function(a){return a[0].id===f.id});-1!==h&&(g[a][h][0]=f,g[a][h][1]=f.endpoints[1],g[a][h][2]=f.endpoints[1].anchor.constructor===c.DynamicAnchor),i>-1&&(g[d].splice(i,1),b.addToList(g,e,[f,f.endpoints[0],f.endpoints[0].anchor.constructor===c.DynamicAnchor])),f.updateConnectedClass()},this.sourceChanged=function(a,d,e,f){if(a!==d){e.sourceId=d,e.source=f,b.removeWithFunction(g[a],function(a){return a[0].id===e.id});var h=b.findWithFunction(g[e.targetId],function(a){return a[0].id===e.id});h>-1&&(g[e.targetId][h][0]=e,g[e.targetId][h][1]=e.endpoints[0],g[e.targetId][h][2]=e.endpoints[0].anchor.constructor===c.DynamicAnchor),b.addToList(g,d,[e,e.endpoints[1],e.endpoints[1].anchor.constructor===c.DynamicAnchor]),e.endpoints[1].anchor.isContinuous&&(e.source===e.target?e._jsPlumb.instance.removeElement(e.endpoints[1].canvas):null==e.endpoints[1].canvas.parentNode&&e._jsPlumb.instance.appendElement(e.endpoints[1].canvas)),e.updateConnectedClass()}},this.rehomeEndpoint=function(a,b,c){var e=d[b]||[],f=j.getId(c);if(f!==b){var g=e.indexOf(a);if(g>-1){var i=e.splice(g,1)[0];h.add(i,f)}}for(var k=0;k<a.connections.length;k++)a.connections[k].sourceId===b?h.sourceChanged(b,a.elementId,a.connections[k],a.element):a.connections[k].targetId===b&&(a.connections[k].targetId=a.elementId,a.connections[k].target=a.element,h.updateOtherEndpoint(a.connections[k].sourceId,b,a.elementId,a.connections[k]))},this.redraw=function(a,e,f,h,l,m){if(!j.isSuspendDrawing()){var n=d[a]||[],o=g[a]||[],p=[],r=[],t=[];f=f||j.timestamp(),h=h||{left:0,top:0},e&&(e={left:e.left+h.left,top:e.top+h.top});for(var u=j.updateOffset({elId:a,offset:e,recalc:!1,timestamp:f}),v={},w=0;w<o.length;w++){var x=o[w][0],y=x.sourceId,z=x.targetId,A=x.endpoints[0].anchor.isContinuous,B=x.endpoints[1].anchor.isContinuous;if(A||B){var C=y+"_"+z,D=v[C],E=x.sourceId===a?1:0;A&&!i[y]&&(i[y]={top:[],right:[],bottom:[],left:[]}),B&&!i[z]&&(i[z]={top:[],right:[],bottom:[],left:[]}),a!==z&&j.updateOffset({elId:z,timestamp:f}),a!==y&&j.updateOffset({elId:y,timestamp:f});var F=j.getCachedData(z),G=j.getCachedData(y);z===y&&(A||B)?(s(i[y],-Math.PI/2,0,x,!1,z,0,!1,"top",y,p,r),s(i[z],-Math.PI/2,0,x,!1,y,1,!1,"top",z,p,r)):(D||(D=this.calculateOrientation(y,z,G.o,F.o,x.endpoints[0].anchor,x.endpoints[1].anchor,x),v[C]=D),A&&s(i[y],D.theta,0,x,!1,z,0,!1,D.a[0],y,p,r),B&&s(i[z],D.theta2,-1,x,!0,y,1,!0,D.a[1],z,p,r)),A&&b.addWithFunction(t,y,function(a){return a===y}),B&&b.addWithFunction(t,z,function(a){return a===z}),b.addWithFunction(p,x,function(a){return a.id===x.id}),(A&&0===E||B&&1===E)&&b.addWithFunction(r,x.endpoints[E],function(a){return a.id===x.endpoints[E].id})}}for(w=0;w<n.length;w++)0===n[w].connections.length&&n[w].anchor.isContinuous&&(i[a]||(i[a]={top:[],right:[],bottom:[],left:[]}),s(i[a],-Math.PI/2,0,{endpoints:[n[w],n[w]],paint:function(){}},!1,a,0,!1,n[w].anchor.getDefaultFace(),a,p,r),b.addWithFunction(t,a,function(b){return b===a}));for(w=0;w<t.length;w++)q(t[w],i[t[w]]);for(w=0;w<n.length;w++)n[w].paint({timestamp:f,offset:u,dimensions:u.s,recalc:m!==!0});for(w=0;w<r.length;w++){var H=j.getCachedData(r[w].elementId);r[w].paint({timestamp:null,offset:H,dimensions:H.s})}for(w=0;w<o.length;w++){var I=o[w][1];if(I.anchor.constructor===c.DynamicAnchor){I.paint({elementWithPrecedence:a,timestamp:f}),b.addWithFunction(p,o[w][0],function(a){return a.id===o[w][0].id});for(var J=0;J<I.connections.length;J++)I.connections[J]!==o[w][0]&&b.addWithFunction(p,I.connections[J],function(a){return a.id===I.connections[J].id})}else b.addWithFunction(p,o[w][0],function(a){return a.id===o[w][0].id})}var K=k[a];for(K&&K.paint({timestamp:f,recalc:!1,elId:a}),w=0;w<p.length;w++)p[w].paint({elId:a,timestamp:null,recalc:!1,clearEdits:l})}};var t=function(a){b.EventGenerator.apply(this),this.type="Continuous",this.isDynamic=!0,this.isContinuous=!0;for(var c=a.faces||["top","right","bottom","left"],d=!(a.clockwise===!1),g={},h={top:"bottom",right:"left",left:"right",bottom:"top"},i={top:"right",right:"bottom",left:"top",bottom:"left"},j={top:"left",right:"top",left:"bottom",bottom:"right"},k=d?i:j,l=d?j:i,m=a.cssClass||"",n=null,o=null,p=["left","right"],q=["top","bottom"],r=null,s=0;s<c.length;s++)g[c[s]]=!0;this.getDefaultFace=function(){return 0===c.length?"top":c[0]},this.isRelocatable=function(){return!0},this.isSnapOnRelocate=function(){return!0},this.verifyEdge=function(a){return g[a]?a:g[h[a]]?h[a]:g[k[a]]?k[a]:g[l[a]]?l[a]:a},this.isEdgeSupported=function(a){return null==r?null==o?g[a]===!0:o===a:-1!==r.indexOf(a)},this.setCurrentFace=function(a,b){n=a,b&&null!=o&&(o=n)},this.getCurrentFace=function(){return n},this.getSupportedFaces=function(){var a=[];for(var b in g)g[b]&&a.push(b);return a},this.lock=function(){o=n},this.unlock=function(){o=null},this.isLocked=function(){return null!=o},this.lockCurrentAxis=function(){null!=n&&(r="left"===n||"right"===n?p:q)},this.unlockCurrentAxis=function(){r=null},this.compute=function(a){return e[a.element.id]||[0,0]},this.getCurrentLocation=function(a){return e[a.element.id]||[0,0]},this.getOrientation=function(a){return f[a.id]||[0,0]},this.getCssClass=function(){return m}};j.continuousAnchorFactory={get:function(a){return new t(a)},clear:function(a){delete e[a]}}},c.AnchorManager.prototype.calculateOrientation=function(a,b,c,d,e,f){var g={HORIZONTAL:"horizontal",VERTICAL:"vertical",DIAGONAL:"diagonal",IDENTITY:"identity"},h=["left","top","right","bottom"];if(a===b)return{orientation:g.IDENTITY,a:["top","top"]};var i=Math.atan2(d.centery-c.centery,d.centerx-c.centerx),j=Math.atan2(c.centery-d.centery,c.centerx-d.centerx),k=[],l={};!function(a,b){for(var c=0;c<a.length;c++)l[a[c]]={left:[b[c].left,b[c].centery],right:[b[c].right,b[c].centery],top:[b[c].centerx,b[c].top],bottom:[b[c].centerx,b[c].bottom]}}(["source","target"],[c,d]);for(var m=0;m<h.length;m++)for(var n=0;n<h.length;n++)k.push({source:h[m],target:h[n],dist:Biltong.lineLength(l.source[h[m]],l.target[h[n]])});k.sort(function(a,b){return a.dist<b.dist?-1:a.dist>b.dist?1:0});for(var o=k[0].source,p=k[0].target,q=0;q<k.length&&(o=!e.isContinuous||e.isEdgeSupported(k[q].source)?k[q].source:null,p=!f.isContinuous||f.isEdgeSupported(k[q].target)?k[q].target:null,null==o||null==p);q++);return e.isContinuous&&e.setCurrentFace(o),f.isContinuous&&f.setCurrentFace(p),{a:[o,p],theta:i,theta2:j}},c.Anchor=function(a){this.x=a.x||0,this.y=a.y||0,this.elementId=a.elementId,this.cssClass=a.cssClass||"",this.userDefinedLocation=null,this.orientation=a.orientation||[0,0],this.lastReturnValue=null,this.offsets=a.offsets||[0,0],this.timestamp=null;var c=a.relocatable!==!1;this.isRelocatable=function(){return c},this.setRelocatable=function(a){c=a};var d=a.snapOnRelocate!==!1;this.isSnapOnRelocate=function(){return d};var e=!1;this.lock=function(){e=!0},this.unlock=function(){e=!1},this.isLocked=function(){return e},b.EventGenerator.apply(this),this.compute=function(a){var b=a.xy,c=a.wh,d=a.timestamp;return a.clearUserDefinedLocation&&(this.userDefinedLocation=null),d&&d===this.timestamp?this.lastReturnValue:(null!=this.userDefinedLocation?this.lastReturnValue=this.userDefinedLocation:this.lastReturnValue=[b[0]+this.x*c[0]+this.offsets[0],b[1]+this.y*c[1]+this.offsets[1],this.x,this.y],this.timestamp=d,this.lastReturnValue)},this.getCurrentLocation=function(a){return a=a||{},null==this.lastReturnValue||null!=a.timestamp&&this.timestamp!==a.timestamp?this.compute(a):this.lastReturnValue},this.setPosition=function(a,b,c,d,f){(!e||f)&&(this.x=a,this.y=b,this.orientation=[c,d],this.lastReturnValue=null)}},b.extend(c.Anchor,b.EventGenerator,{equals:function(a){if(!a)return!1;var b=a.getOrientation(),c=this.getOrientation();return this.x===a.x&&this.y===a.y&&this.offsets[0]===a.offsets[0]&&this.offsets[1]===a.offsets[1]&&c[0]===b[0]&&c[1]===b[1]},getUserDefinedLocation:function(){return this.userDefinedLocation},setUserDefinedLocation:function(a){this.userDefinedLocation=a},clearUserDefinedLocation:function(){this.userDefinedLocation=null},getOrientation:function(){return this.orientation},getCssClass:function(){return this.cssClass}}),c.FloatingAnchor=function(a){c.Anchor.apply(this,arguments);var b=a.reference,d=a.referenceCanvas,e=c.getSize(d),f=0,g=0,h=null,i=null;this.orientation=null,this.x=0,this.y=0,this.isFloating=!0,this.compute=function(a){var b=a.xy,c=[b[0]+e[0]/2,b[1]+e[1]/2];return i=c,c},this.getOrientation=function(a){if(h)return h;var c=b.getOrientation(a);return[Math.abs(c[0])*f*-1,Math.abs(c[1])*g*-1]},this.over=function(a,b){h=a.getOrientation(b)},this.out=function(){h=null},this.getCurrentLocation=function(a){return null==i?this.compute(a):i}},b.extend(c.FloatingAnchor,c.Anchor);var d=function(a,b,d){return a.constructor===c.Anchor?a:b.makeAnchor(a,d,b)};c.DynamicAnchor=function(a){c.Anchor.apply(this,arguments),this.isDynamic=!0,this.anchors=[],this.elementId=a.elementId,this.jsPlumbInstance=a.jsPlumbInstance;for(var b=0;b<a.anchors.length;b++)this.anchors[b]=d(a.anchors[b],this.jsPlumbInstance,this.elementId);this.getAnchors=function(){return this.anchors};var e=this.anchors.length>0?this.anchors[0]:null,f=e,g=this,h=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))},i=a.selector||function(a,b,c,d,e){for(var f=c[0]+d[0]/2,g=c[1]+d[1]/2,i=-1,j=1/0,k=0;k<e.length;k++){var l=h(e[k],f,g,a,b);j>l&&(i=k+0,j=l)}return e[i]};this.compute=function(a){var b=a.xy,c=a.wh,d=a.txy,h=a.twh;this.timestamp=a.timestamp;var j=g.getUserDefinedLocation();return null!=j?j:this.isLocked()||null==d||null==h?e.compute(a):(a.timestamp=null,e=i(b,c,d,h,this.anchors),this.x=e.x,this.y=e.y,e!==f&&this.fire("anchorChanged",e),f=e,e.compute(a))},this.getCurrentLocation=function(a){return this.getUserDefinedLocation()||(null!=e?e.getCurrentLocation(a):null)},this.getOrientation=function(a){return null!=e?e.getOrientation(a):[0,0]},this.over=function(a,b){null!=e&&e.over(a,b)},this.out=function(){null!=e&&e.out()},this.setAnchor=function(a){e=a},this.getCssClass=function(){return e&&e.getCssClass()||""},this.setAnchorCoordinates=function(a){var b=jsPlumbUtil.findWithFunction(this.anchors,function(b){return b.x===a[0]&&b.y===a[1]});return-1!==b?(this.setAnchor(this.anchors[b]),!0):!1}},b.extend(c.DynamicAnchor,c.Anchor);var e=function(a,b,d,e,f,g){c.Anchors[f]=function(c){var h=c.jsPlumbInstance.makeAnchor([a,b,d,e,0,0],c.elementId,c.jsPlumbInstance);return h.type=f,g&&g(h,c),h}};e(.5,0,0,-1,"TopCenter"),e(.5,1,0,1,"BottomCenter"),e(0,.5,-1,0,"LeftMiddle"),e(1,.5,1,0,"RightMiddle"),e(.5,0,0,-1,"Top"),e(.5,1,0,1,"Bottom"),e(0,.5,-1,0,"Left"),e(1,.5,1,0,"Right"),e(.5,.5,0,0,"Center"),e(1,0,0,-1,"TopRight"),e(1,1,0,1,"BottomRight"),e(0,0,0,-1,"TopLeft"),e(0,1,0,1,"BottomLeft"),c.Defaults.DynamicAnchors=function(a){return a.jsPlumbInstance.makeAnchors(["TopCenter","RightMiddle","BottomCenter","LeftMiddle"],a.elementId,a.jsPlumbInstance)},c.Anchors.AutoDefault=function(a){var b=a.jsPlumbInstance.makeDynamicAnchor(c.Defaults.DynamicAnchors(a));return b.type="AutoDefault",b};var f=function(a,b){c.Anchors[a]=function(c){var d=c.jsPlumbInstance.makeAnchor(["Continuous",{faces:b}],c.elementId,c.jsPlumbInstance);return d.type=a,d}};c.Anchors.Continuous=function(a){return a.jsPlumbInstance.continuousAnchorFactory.get(a)},f("ContinuousLeft",["left"]),f("ContinuousTop",["top"]),f("ContinuousBottom",["bottom"]),f("ContinuousRight",["right"]),e(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}),a.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]]}},c.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,i,j){c=b*h;for(var k=(f-a)/c,l=(g-e)/c,m=0;c>m;m++)d.push([a+k*m,e+l*m,null==i?0:i,null==j?0:j])},f=0;f<a.length;f++)e.apply(null,a[f]);return d},f=function(a){for(var b=[],c=0;c<a.length;c++)b.push([a[c][0],a[c][1],a[c][2],a[c][3],1/a.length,a[c][4],a[c][5]]);return e(b)},g=function(){return f([[0,0,1,0,0,-1],[1,0,1,1,1,0],[1,1,0,1,0,1],[0,1,0,0,-1,0]])},h={Circle:d,Ellipse:d,Diamond:function(){return f([[.5,0,1,.5],[1,.5,.5,1],[.5,1,0,.5],[0,.5,.5,0]])},Rectangle:g,Square:g,Triangle:function(){return f([[.5,0,1,1],[1,1,0,1],[0,1,.5,0]])},Path:function(a){for(var b=a.points,c=[],d=0,f=0;f<b.length-1;f++){var g=Math.sqrt(Math.pow(b[f][2]-b[f][0])+Math.pow(b[f][3]-b[f][1]));d+=g,c.push([b[f][0],b[f][1],b[f+1][0],b[f+1][1],g])}for(var h=0;h<c.length;h++)c[h][4]=c[h][4]/d;return e(c)}},i=function(a,b){for(var c=[],d=b/180*Math.PI,e=0;e<a.length;e++){var f=a[e][0]-.5,g=a[e][1]-.5;c.push([.5+(f*Math.cos(d)-g*Math.sin(d)),.5+(f*Math.sin(d)+g*Math.cos(d)),a[e][2],a[e][3]])}return c};if(!h[c])throw new Error("Shape ["+c+"] is unknown by Perimeter Anchor type");var j=h[c](a);a.rotation&&(j=i(j,a.rotation));var k=a.jsPlumbInstance.makeDynamicAnchor(j);return k.type="Perimeter",k}}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumb,c=a.jsPlumbUtil,d=a.Biltong;b.Segments={AbstractSegment:function(a){this.params=a,this.findClosestPointOnPath=function(a,b){return{d:1/0,x:null,y:null,l:null}},this.getBounds=function(){return{minX:Math.min(a.x1,a.x2),minY:Math.min(a.y1,a.y2),maxX:Math.max(a.x1,a.x2),maxY:Math.max(a.y1,a.y2)}},this.lineIntersection=function(a,b,c,d){return[]},this.boxIntersection=function(a,b,c,d){var e=[];return e.push.apply(e,this.lineIntersection(a,b,a+c,b)),e.push.apply(e,this.lineIntersection(a+c,b,a+c,b+d)),e.push.apply(e,this.lineIntersection(a+c,b+d,a,b+d)),e.push.apply(e,this.lineIntersection(a,b+d,a,b)),e},this.boundingBoxIntersection=function(a){return this.boxIntersection(a.x,a.y,a.w,a.y)}},Straight:function(a){var c,e,f,g,h,i,j,k=(b.Segments.AbstractSegment.apply(this,arguments),function(){c=Math.sqrt(Math.pow(h-g,2)+Math.pow(j-i,2)),e=d.gradient({x:g,y:i},{x:h,y:j}),f=-1/e});this.type="Straight",this.getLength=function(){return c},this.getGradient=function(){return e},this.getCoordinates=function(){return{x1:g,y1:i,x2:h,y2:j}},this.setCoordinates=function(a){g=a.x1,i=a.y1,h=a.x2,j=a.y2,k()},this.setCoordinates({x1:a.x1,y1:a.y1,x2:a.x2,y2:a.y2}),this.getBounds=function(){return{minX:Math.min(g,h),minY:Math.min(i,j),maxX:Math.max(g,h),maxY:Math.max(i,j)}},this.pointOnPath=function(a,b){if(0!==a||b){if(1!==a||b){var e=b?a>0?a:c+a:a*c;return d.pointOnLine({x:g,y:i},{x:h,y:j},e)}return{x:h,y:j}}return{x:g,y:i}},this.gradientAtPoint=function(a){return e},this.pointAlongPathFrom=function(a,b,c){var e=this.pointOnPath(a,c),f=0>=b?{x:g,y:i}:{x:h,y:j};return 0>=b&&Math.abs(b)>1&&(b*=-1),d.pointOnLine(e,f,b)};var l=function(a,b,c){return c>=Math.min(a,b)&&c<=Math.max(a,b)},m=function(a,b,c){return Math.abs(c-a)<Math.abs(c-b)?a:b};this.findClosestPointOnPath=function(a,b){var k={d:1/0,x:null,y:null,l:null,x1:g,x2:h,y1:i,y2:j};if(0===e)k.y=i,k.x=l(g,h,a)?a:m(g,h,a);else if(e===1/0||e===-(1/0))k.x=g,k.y=l(i,j,b)?b:m(i,j,b);else{var n=i-e*g,o=b-f*a,p=(o-n)/(e-f),q=e*p+n;k.x=l(g,h,p)?p:m(g,h,p),k.y=l(i,j,q)?q:m(i,j,q)}var r=d.lineLength([k.x,k.y],[g,i]);return k.d=d.lineLength([a,b],[k.x,k.y]),k.l=r/c,k};var n=function(a,b,c){return c>b?a>=b&&c>=a:b>=a&&a>=c},o=n;this.lineIntersection=function(a,b,c,f){var k=Math.abs(d.gradient({x:a,y:b},{x:c,y:f})),l=Math.abs(e),m=l===1/0?g:i-l*g,n=[],p=k===1/0?a:b-k*a;if(k!==l)if(k===1/0&&0===l)o(a,g,h)&&o(i,b,f)&&(n=[a,i]);else if(0===k&&l===1/0)o(b,i,j)&&o(g,a,c)&&(n=[g,b]);else{var q,r;k===1/0?(q=a,o(q,g,h)&&(r=l*a+m,o(r,b,f)&&(n=[q,r]))):0===k?(r=b,o(r,i,j)&&(q=(b-m)/l,o(q,a,c)&&(n=[q,r]))):(q=(p-m)/(l-k),r=l*q+m,o(q,g,h)&&o(r,i,j)&&(n=[q,r]))}return n},this.boxIntersection=function(a,b,c,d){var e=[];return e.push.apply(e,this.lineIntersection(a,b,a+c,b)),e.push.apply(e,this.lineIntersection(a+c,b,a+c,b+d)),e.push.apply(e,this.lineIntersection(a+c,b+d,a,b+d)),e.push.apply(e,this.lineIntersection(a,b+d,a,b)),e},this.boundingBoxIntersection=function(a){return this.boxIntersection(a.x,a.y,a.w,a.h)}},Arc:function(a){var c=(b.Segments.AbstractSegment.apply(this,arguments),function(b,c){return d.theta([a.cx,a.cy],[b,c])}),e=function(a,b){if(a.anticlockwise){var c=a.startAngle<a.endAngle?a.startAngle+f:a.startAngle,d=Math.abs(c-a.endAngle);return c-d*b}var e=a.endAngle<a.startAngle?a.endAngle+f:a.endAngle,g=Math.abs(e-a.startAngle);return a.startAngle+g*b},f=2*Math.PI;this.radius=a.r,this.anticlockwise=a.ac,this.type="Arc",a.startAngle&&a.endAngle?(this.startAngle=a.startAngle,this.endAngle=a.endAngle,this.x1=a.cx+this.radius*Math.cos(a.startAngle),this.y1=a.cy+this.radius*Math.sin(a.startAngle),this.x2=a.cx+this.radius*Math.cos(a.endAngle),this.y2=a.cy+this.radius*Math.sin(a.endAngle)):(this.startAngle=c(a.x1,a.y1),this.endAngle=c(a.x2,a.y2),this.x1=a.x1,this.y1=a.y1,this.x2=a.x2,this.y2=a.y2),this.endAngle<0&&(this.endAngle+=f),this.startAngle<0&&(this.startAngle+=f);var g=this.endAngle<this.startAngle?this.endAngle+f:this.endAngle;this.sweep=Math.abs(g-this.startAngle),this.anticlockwise&&(this.sweep=f-this.sweep);var h=2*Math.PI*this.radius,i=this.sweep/f,j=h*i;this.getLength=function(){return j},this.getBounds=function(){return{minX:a.cx-a.r,maxX:a.cx+a.r,minY:a.cy-a.r,maxY:a.cy+a.r}};var k=1e-10,l=function(a){var b=Math.floor(a),c=Math.ceil(a);return k>a-b?b:k>c-a?c:a};this.pointOnPath=function(b,c){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};c&&(b/=j);var d=e(this,b),f=a.cx+a.r*Math.cos(d),g=a.cy+a.r*Math.sin(d);return{x:l(f),y:l(g),theta:d}},this.gradientAtPoint=function(b,c){var e=this.pointOnPath(b,c),f=d.normal([a.cx,a.cy],[e.x,e.y]);return this.anticlockwise||f!==1/0&&f!==-(1/0)||(f*=-1),f},this.pointAlongPathFrom=function(b,c,d){var e=this.pointOnPath(b,d),f=c/h*2*Math.PI,g=this.anticlockwise?-1:1,i=e.theta+g*f,j=a.cx+this.radius*Math.cos(i),k=a.cy+this.radius*Math.sin(i);return{x:j,y:k}}},Bezier:function(c){this.curve=[{x:c.x1,y:c.y1},{x:c.cp1x,y:c.cp1y},{x:c.cp2x,y:c.cp2y},{x:c.x2,y:c.y2}];b.Segments.AbstractSegment.apply(this,arguments);this.bounds={minX:Math.min(c.x1,c.x2,c.cp1x,c.cp2x),minY:Math.min(c.y1,c.y2,c.cp1y,c.cp2y),maxX:Math.max(c.x1,c.x2,c.cp1x,c.cp2x),maxY:Math.max(c.y1,c.y2,c.cp1y,c.cp2y)},this.type="Bezier";var d=function(b,c,d){return d&&(c=a.jsBezier.locationAlongCurveFrom(b,c>0?0:1,c)),c};this.pointOnPath=function(b,c){return b=d(this.curve,b,c),a.jsBezier.pointOnCurve(this.curve,b)},this.gradientAtPoint=function(b,c){return b=d(this.curve,b,c),a.jsBezier.gradientAtPoint(this.curve,b)},this.pointAlongPathFrom=function(b,c,e){return b=d(this.curve,b,e),a.jsBezier.pointAlongCurveFrom(this.curve,b,c)},this.getLength=function(){return a.jsBezier.getLength(this.curve)},this.getBounds=function(){return this.bounds},this.findClosestPointOnPath=function(b,c){var d=a.jsBezier.nearestPointOnCurve({x:b,y:c},this.curve);return{d:Math.sqrt(Math.pow(d.point.x-b,2)+Math.pow(d.point.y-c,2)),x:d.point.x,y:d.point.y,l:1-d.location,s:this}},this.lineIntersection=function(b,c,d,e){return a.jsBezier.lineIntersection(b,c,d,e,this.curve)}}},b.SegmentRenderer={getPath:function(a,b){return{Straight:function(b){var c=a.getCoordinates();return(b?"M "+c.x1+" "+c.y1+" ":"")+"L "+c.x2+" "+c.y2},Bezier:function(b){var c=a.params;return(b?"M "+c.x2+" "+c.y2+" ":"")+"C "+c.cp2x+" "+c.cp2y+" "+c.cp1x+" "+c.cp1y+" "+c.x1+" "+c.y1},Arc:function(b){var c=a.params,d=a.sweep>Math.PI?1:0,e=a.anticlockwise?0:1;return(b?"M"+a.x1+" "+a.y1+" ":"")+"A "+a.radius+" "+c.r+" 0 "+d+","+e+" "+a.x2+" "+a.y2}}[a.type](b)}};var e=function(){this.resetBounds=function(){this.bounds={minX:1/0,minY:1/0,maxX:-(1/0),maxY:-(1/0)}},this.resetBounds()};b.Connectors.AbstractConnector=function(a){e.apply(this,arguments);var f=[],g=0,h=[],i=[],j=a.stub||0,k=c.isArray(j)?j[0]:j,l=c.isArray(j)?j[1]:j,m=a.gap||0,n=c.isArray(m)?m[0]:m,o=c.isArray(m)?m[1]:m,p=null,q=null;this.getPathData=function(){for(var a="",c=0;c<f.length;c++)a+=b.SegmentRenderer.getPath(f[c],0===c),a+=" ";return a},this.findSegmentForPoint=function(a,b){for(var c={d:1/0,s:null,x:null,y:null,l:null},d=0;d<f.length;d++){var e=f[d].findClosestPointOnPath(a,b);e.d<c.d&&(c.d=e.d,c.l=e.l,c.x=e.x,c.y=e.y,c.s=f[d],c.x1=e.x1,c.x2=e.x2,c.y1=e.y1,c.y2=e.y2,c.index=d,c.connectorLocation=h[d][0]+e.l*(h[d][1]-h[d][0]))}return c},this.lineIntersection=function(a,b,c,d){for(var e=[],g=0;g<f.length;g++)e.push.apply(e,f[g].lineIntersection(a,b,c,d));return e},this.boxIntersection=function(a,b,c,d){for(var e=[],g=0;g<f.length;g++)e.push.apply(e,f[g].boxIntersection(a,b,c,d));return e},this.boundingBoxIntersection=function(a){for(var b=[],c=0;c<f.length;c++)b.push.apply(b,f[c].boundingBoxIntersection(a));return b};var r=function(){for(var a=0,b=0;b<f.length;b++){var c=f[b].getLength();i[b]=c/g,h[b]=[a,a+=c/g]}},s=function(a,b){b&&(a=a>0?a/g:(g+a)/g);for(var c=h.length-1,d=1,e=0;e<h.length;e++)if(h[e][1]>=a){c=e,d=1===a?1:0===a?0:(a-h[e][0])/i[e];break}return{segment:f[c],proportion:d,index:c}},t=function(a,c,d){if(d.x1!==d.x2||d.y1!==d.y2){var e=new b.Segments[c](d);f.push(e),g+=e.getLength(),a.updateBounds(e)}},u=function(){g=f.length=h.length=i.length=0};this.setSegments=function(a){p=[],g=0;for(var b=0;b<a.length;b++)p.push(a[b]),g+=a[b].getLength()},this.getLength=function(){return g};var v=function(a){this.strokeWidth=a.strokeWidth;var b=d.quadrant(a.sourcePos,a.targetPos),c=a.targetPos[0]<a.sourcePos[0],e=a.targetPos[1]<a.sourcePos[1],f=a.strokeWidth||1,g=a.sourceEndpoint.anchor.getOrientation(a.sourceEndpoint),h=a.targetEndpoint.anchor.getOrientation(a.targetEndpoint),i=c?a.targetPos[0]:a.sourcePos[0],j=e?a.targetPos[1]:a.sourcePos[1],m=Math.abs(a.targetPos[0]-a.sourcePos[0]),p=Math.abs(a.targetPos[1]-a.sourcePos[1]);if(0===g[0]&&0===g[1]||0===h[0]&&0===h[1]){var q=m>p?0:1,r=[1,0][q];g=[],h=[],g[q]=a.sourcePos[q]>a.targetPos[q]?-1:1,h[q]=a.sourcePos[q]>a.targetPos[q]?1:-1,g[r]=0,h[r]=0}var s=c?m+n*g[0]:n*g[0],t=e?p+n*g[1]:n*g[1],u=c?o*h[0]:m+o*h[0],v=e?o*h[1]:p+o*h[1],w=g[0]*h[0]+g[1]*h[1],x={sx:s,sy:t,tx:u,ty:v,lw:f,xSpan:Math.abs(u-s),ySpan:Math.abs(v-t),mx:(s+u)/2,my:(t+v)/2,so:g,to:h,x:i,y:j,w:m,h:p,segment:b,startStubX:s+g[0]*k,startStubY:t+g[1]*k,endStubX:u+h[0]*l,endStubY:v+h[1]*l,isXGreaterThanStubTimes2:Math.abs(s-u)>k+l,isYGreaterThanStubTimes2:Math.abs(t-v)>k+l,opposite:-1===w,perpendicular:0===w,orthogonal:1===w,sourceAxis:0===g[0]?"y":"x",points:[i,j,m,p,s,t,u,v],stubs:[k,l]};return x.anchorOrientation=x.opposite?"opposite":x.orthogonal?"orthogonal":"perpendicular",x};this.getSegments=function(){return f},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)};return this.pointOnPath=function(a,b){var c=s(a,b);return c.segment&&c.segment.pointOnPath(c.proportion,!1)||[0,0]},this.gradientAtPoint=function(a,b){var c=s(a,b);return c.segment&&c.segment.gradientAtPoint(c.proportion,!1)||0},this.pointAlongPathFrom=function(a,b,c){var d=s(a,c);return d.segment&&d.segment.pointAlongPathFrom(d.proportion,b,!1)||[0,0]},this.compute=function(a){q=v.call(this,a),u(),this._compute(q,a),this.x=q.points[0],this.y=q.points[1],this.w=q.points[2],this.h=q.points[3],this.segment=q.segment,r()},{addSegment:t,prepareCompute:v,sourceStub:k,targetStub:l,maxStub:Math.max(k,l),sourceGap:n,targetGap:o,maxGap:Math.max(n,o)}},c.extend(b.Connectors.AbstractConnector,e),b.Endpoints.AbstractEndpoint=function(a){e.apply(this,arguments);var b=this.compute=function(a,b,c,d){var e=this._compute.apply(this,arguments);return this.x=e[0],this.y=e[1],this.w=e[2],this.h=e[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,e};return{compute:b,cssClass:a.cssClass}},c.extend(b.Endpoints.AbstractEndpoint,e),b.Endpoints.Dot=function(a){this.type="Dot";b.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,d){this.radius=c.radius||this.radius;var e=a[0]-this.radius,f=a[1]-this.radius,g=2*this.radius,h=2*this.radius;if(c.stroke){var i=c.strokeWidth||1;e-=i,f-=i,g+=2*i,h+=2*i}return[e,f,g,h,this.radius]}},c.extend(b.Endpoints.Dot,b.Endpoints.AbstractEndpoint),b.Endpoints.Rectangle=function(a){this.type="Rectangle";b.Endpoints.AbstractEndpoint.apply(this,arguments);a=a||{},this.width=a.width||20,this.height=a.height||20,this._compute=function(a,b,c,d){var e=c.width||this.width,f=c.height||this.height,g=a[0]-e/2,h=a[1]-f/2;return[g,h,e,f]}},c.extend(b.Endpoints.Rectangle,b.Endpoints.AbstractEndpoint);var f=function(a){b.jsPlumbUIComponent.apply(this,arguments),this._jsPlumb.displayElements=[]};c.extend(f,b.jsPlumbUIComponent,{getDisplayElements:function(){return this._jsPlumb.displayElements},appendDisplayElement:function(a){this._jsPlumb.displayElements.push(a)}}),b.Endpoints.Image=function(d){this.type="Image",f.apply(this,arguments),b.Endpoints.AbstractEndpoint.apply(this,arguments);var e=d.onload,g=d.src||d.url,h=d.cssClass?" "+d.cssClass:"";this._jsPlumb.img=new Image,this._jsPlumb.ready=!1,this._jsPlumb.initialized=!1,this._jsPlumb.deleted=!1,this._jsPlumb.widthToUse=d.width,this._jsPlumb.heightToUse=d.height,this._jsPlumb.endpoint=d.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,e&&e(this))}.bind(this),this._jsPlumb.endpoint.setImage=function(a,b){var c=a.constructor===String?a:a.src;e=b,this._jsPlumb.img.src=c,null!=this.canvas&&this.canvas.setAttribute("src",this._jsPlumb.img.src)}.bind(this),this._jsPlumb.endpoint.setImage(g,e),this._compute=function(a,b,c,d){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=b.createElement("img",{position:"absolute",margin:0,padding:0,outline:0},this._jsPlumb.instance.endpointClass+h),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(a,b,d){if(!this._jsPlumb.deleted){this._jsPlumb.initialized||(this.canvas.setAttribute("src",this._jsPlumb.img.src),this.appendDisplayElement(this.canvas),this._jsPlumb.initialized=!0);var e=this.anchorPoint[0]-this._jsPlumb.widthToUse/2,f=this.anchorPoint[1]-this._jsPlumb.heightToUse/2;c.sizeElement(this.canvas,e,f,this._jsPlumb.widthToUse,this._jsPlumb.heightToUse)}},this.paint=function(b,c){null!=this._jsPlumb&&(this._jsPlumb.ready?this.actuallyPaint(b,c):a.setTimeout(function(){this.paint(b,c)}.bind(this),200))}},c.extend(b.Endpoints.Image,[f,b.Endpoints.AbstractEndpoint],{cleanup:function(a){a&&(this._jsPlumb.deleted=!0,this.canvas&&this.canvas.parentNode.removeChild(this.canvas),this.canvas=null);-}}),b.Endpoints.Blank=function(a){b.Endpoints.AbstractEndpoint.apply(this,arguments);this.type="Blank",f.apply(this,arguments),this._compute=function(a,b,c,d){return[a[0],a[1],10,0]};var d=a.cssClass?" "+a.cssClass:"";this.canvas=b.createElement("div",{display:"block",width:"1px",height:"1px",background:"transparent",position:"absolute"},this._jsPlumb.instance.endpointClass+d),this._jsPlumb.instance.appendElement(this.canvas),this.paint=function(a,b){c.sizeElement(this.canvas,this.x,this.y,this.w,this.h)}},c.extend(b.Endpoints.Blank,[b.Endpoints.AbstractEndpoint,f],{cleanup:function(){this.canvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}}),b.Endpoints.Triangle=function(a){this.type="Triangle",b.Endpoints.AbstractEndpoint.apply(this,arguments);var c=this;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,d,e){var f=d.width||c.width,g=d.height||c.height,h=a[0]-f/2,i=a[1]-g/2;return[h,i,f,g]}};var g=b.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,this.visible=a.visible!==!1};g.prototype={cleanup:function(a){a&&(this.component=null,this.canvas=null,this.endpointLoc=null)},reattach:function(a,b){},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},updateFrom:function(){}},b.Overlays.Arrow=function(a){this.type="Arrow",g.apply(this,arguments),this.isAppendedAtTopLevel=!1,a=a||{};var e=this;this.length=a.length||20,this.width=a.width||20,this.id=a.id,this.direction=(a.direction||1)<0?-1:1;var f=a.paintStyle||{"stroke-width":1},h=a.foldback||.623;this.computeMaxSize=function(){return 1.5*e.width},this.elementCreated=function(c,d){if(this.path=c,a.events)for(var e in a.events)b.on(c,e,a.events[e])},this.draw=function(a,b){var e,g,i,j,k;if(a.pointAlongPathFrom){if(c.isString(this.loc)||this.loc>1||this.loc<0){var l=parseInt(this.loc,10),m=this.loc<0?1:0;e=a.pointAlongPathFrom(m,l,!1),g=a.pointAlongPathFrom(m,l-this.direction*this.length/2,!1),i=d.pointOnLine(e,g,this.length)}else if(1===this.loc){if(e=a.pointOnPath(this.loc),g=a.pointAlongPathFrom(this.loc,-this.length),i=d.pointOnLine(e,g,this.length),-1===this.direction){var n=i;i=e,e=n}}else if(0===this.loc){if(i=a.pointOnPath(this.loc),g=a.pointAlongPathFrom(this.loc,this.length),e=d.pointOnLine(i,g,this.length),-1===this.direction){var o=i;i=e,e=o}}else e=a.pointAlongPathFrom(this.loc,this.direction*this.length/2),g=a.pointOnPath(this.loc),i=d.pointOnLine(e,g,this.length);j=d.perpendicularLineTo(e,i,this.width),k=d.pointOnLine(e,i,h*this.length);var p={hxy:e,tail:j,cxy:k},q=f.stroke||b.stroke,r=f.fill||b.stroke,s=f.strokeWidth||b.strokeWidth;return{component:a,d:p,"stroke-width":s,stroke:q,fill:r,minX:Math.min(e.x,j[0].x,j[1].x),maxX:Math.max(e.x,j[0].x,j[1].x),minY:Math.min(e.y,j[0].y,j[1].y),maxY:Math.max(e.y,j[0].y,j[1].y)}}return{component:a,minX:0,maxX:0,minY:0,maxY:0}}},c.extend(b.Overlays.Arrow,g,{updateFrom:function(a){this.length=a.length||this.length,this.width=a.width||this.width,this.direction=null!=a.direction?a.direction:this.direction,this.foldback=a.foldback||this.foldback},cleanup:function(){this.path&&this.canvas&&this.canvas.removeChild(this.path)}}),b.Overlays.PlainArrow=function(a){a=a||{};var c=b.extend(a,{foldback:1});b.Overlays.Arrow.call(this,c),this.type="PlainArrow"},c.extend(b.Overlays.PlainArrow,b.Overlays.Arrow),b.Overlays.Diamond=function(a){a=a||{};var c=a.length||40,d=b.extend(a,{length:c/2,foldback:2});b.Overlays.Arrow.call(this,d),this.type="Diamond"},c.extend(b.Overlays.Diamond,b.Overlays.Arrow);var h=function(a,b){return(null==a._jsPlumb.cachedDimensions||b)&&(a._jsPlumb.cachedDimensions=a.getDimensions()),a._jsPlumb.cachedDimensions},i=function(a){b.jsPlumbUIComponent.apply(this,arguments),g.apply(this,arguments);var d=this.fire;this.fire=function(){d.apply(this,arguments),this.component&&this.component.fire.apply(this.component,arguments)},this.detached=!1,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 c=this._jsPlumb.div=b.getElement(this._jsPlumb.create(this._jsPlumb.component));c.style.position="absolute",jsPlumb.addClass(c,this._jsPlumb.instance.overlayClass+" "+(this.cssClass?this.cssClass:a.cssClass?a.cssClass:"")),this._jsPlumb.instance.appendElement(c),this._jsPlumb.instance.getId(c),this.canvas=c;var d="translate(-50%, -50%)";c.style.webkitTransform=d,c.style.mozTransform=d,c.style.msTransform=d,c.style.oTransform=d,c.style.transform=d,c._jsPlumb=this,a.visible===!1&&(c.style.display="none")}return this._jsPlumb.div},this.draw=function(a,b,d){var e=h(this);if(null!=e&&2===e.length){var f={x:0,y:0};if(d)f={x:d[0],y:d[1]};else if(a.pointOnPath){var g=this.loc,i=!1;(c.isString(this.loc)||this.loc<0||this.loc>1)&&(g=parseInt(this.loc,10),i=!0),f=a.pointOnPath(g,i)}else{var j=this.loc.constructor===Array?this.loc:this.endpointLoc;f={x:j[0]*a.w,y:j[1]*a.h}}var k=f.x-e[0]/2,l=f.y-e[1]/2;return{component:a,d:{minx:k,miny:l,td:e,cxy:f},minX:k,maxX:k+e[0],minY:l,maxY:l+e[1]}}return{minX:0,maxX:0,minY:0,maxY:0}}};c.extend(i,[b.jsPlumbUIComponent,g],{getDimensions:function(){return[1,1]},setVisible:function(a){this._jsPlumb.div&&(this._jsPlumb.div.style.display=a?"block":"none",a&&this._jsPlumb.initiallyInvisible&&(h(this,!0),this.component.repaint(),this._jsPlumb.initiallyInvisible=!1))},clearCachedDimensions:function(){this._jsPlumb.cachedDimensions=null},cleanup:function(a){a?null!=this._jsPlumb.div&&(this._jsPlumb.div._jsPlumb=null,this._jsPlumb.instance.removeElement(this._jsPlumb.div)):(this._jsPlumb&&this._jsPlumb.div&&this._jsPlumb.div.parentNode&&this._jsPlumb.div.parentNode.removeChild(this._jsPlumb.div),this.detached=!0)},reattach:function(a,b){null!=this._jsPlumb.div&&a.getContainer().appendChild(this._jsPlumb.div),this.detached=!1},computeMaxSize:function(){var a=h(this);return Math.max(a[0],a[1])},paint:function(a,b){this._jsPlumb.initialised||(this.getElement(),a.component.appendDisplayElement(this._jsPlumb.div),this._jsPlumb.initialised=!0,this.detached&&this._jsPlumb.div.parentNode.removeChild(this._jsPlumb.div)),this._jsPlumb.div.style.left=a.component.x+a.d.minx+"px",this._jsPlumb.div.style.top=a.component.y+a.d.miny+"px"}}),b.Overlays.Custom=function(a){this.type="Custom",i.apply(this,arguments)},c.extend(b.Overlays.Custom,i),b.Overlays.GuideLines=function(){var a=this;a.length=50,a.strokeWidth=5,this.type="GuideLines",g.apply(this,arguments),b.jsPlumbUIComponent.apply(this,arguments),this.draw=function(b,c){var e=b.pointAlongPathFrom(a.loc,a.length/2),f=b.pointOnPath(a.loc),g=d.pointOnLine(e,f,a.length),h=d.perpendicularLineTo(e,g,40),i=d.perpendicularLineTo(g,e,20);return{connector:b,head:e,tail:g,headLine:i,tailLine:h,minX:Math.min(e.x,g.x,i[0].x,i[1].x),minY:Math.min(e.y,g.y,i[0].y,i[1].y),maxX:Math.max(e.x,g.x,i[0].x,i[1].x),maxY:Math.max(e.y,g.y,i[0].y,i[1].y)}}},b.Overlays.Label=function(a){this.labelStyle=a.labelStyle;this.cssClass=null!=this.labelStyle?this.labelStyle.cssClass:null;var c=b.extend({create:function(){return b.createElement("div")}},a);if(b.Overlays.Custom.call(this,c),this.type="Label",this.label=a.label||"",this.labelText=null,this.labelStyle){var d=this.getElement();if(this.labelStyle.font=this.labelStyle.font||"12px sans-serif",d.style.font=this.labelStyle.font,d.style.color=this.labelStyle.color||"black",this.labelStyle.fill&&(d.style.background=this.labelStyle.fill),this.labelStyle.borderWidth>0){var e=this.labelStyle.borderStyle?this.labelStyle.borderStyle:"black";d.style.border=this.labelStyle.borderWidth+"px solid "+e}this.labelStyle.padding&&(d.style.padding=this.labelStyle.padding)}},c.extend(b.Overlays.Label,b.Overlays.Custom,{cleanup:function(a){a&&(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(),i.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,"<br/>")}else null==this.labelText&&(this.labelText=this.label,this.getElement().innerHTML=this.labelText.replace(/\r\n/g,"<br/>"))},updateFrom:function(a){null!=a.label&&this.setLabel(a.label)}})}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumbUtil,c=a.jsPlumbInstance,d="jtk-group-collapsed",e="jtk-group-expanded",f="[jtk-group-content]",g="elementDraggable",h="stop",i="revert",j="_groupManager",k="_jsPlumbGroup",l="_jsPlumbGroupDrag",m="group:addMember",n="group:removeMember",o="group:add",p="group:remove",q="group:expand",r="group:collapse",s="groupDragStop",t="connectionMoved",u="internal.connectionDetached",v="removeAll",w="orphanAll",x="show",y="hide",z=function(a){function c(a){delete a.proxies;var c,d=i[a.id];null!=d&&(c=function(b){return b.id===a.id},b.removeWithFunction(d.connections.source,c),b.removeWithFunction(d.connections.target,c),delete i[a.id]),d=j[a.id],null!=d&&(c=function(b){return b.id===a.id},b.removeWithFunction(d.connections.source,c),b.removeWithFunction(d.connections.target,c),delete j[a.id])}function f(b,c){for(var d=b.getMembers(),e=0;e<d.length;e++)a[c?x:y](d[e],!0)}function g(b){var c=b.getMembers(),d=a.getConnections({source:c,scope:"*"},!0),e=a.getConnections({target:c,scope:"*"},!0),f={};b.connections.source.length=0,b.connections.target.length=0;var g=function(a){for(var c=0;c<a.length;c++)f[a[c].id]||(f[a[c].id]=!0,a[c].source._jsPlumbGroup===b?(a[c].target._jsPlumbGroup!==b&&b.connections.source.push(a[c]),i[a[c].id]=b):a[c].target._jsPlumbGroup===b&&(b.connections.target.push(a[c]),j[a[c].id]=b))};g(d),g(e)}var h={},i={},j={},l=this;a.bind("connection",function(a){null!=a.source[k]&&null!=a.target[k]&&a.source[k]===a.target[k]?(i[a.connection.id]=a.source[k],j[a.connection.id]=a.source[k]):(null!=a.source[k]&&(b.suggest(a.source[k].connections.source,a.connection),i[a.connection.id]=a.source[k]),null!=a.target[k]&&(b.suggest(a.target[k].connections.target,a.connection),j[a.connection.id]=a.target[k]))}),a.bind(u,function(a){c(a.connection)}),a.bind(t,function(a){var b=0===a.index?i:j,c=b[a.connection.id];if(c){var d=c.connections[0===a.index?"source":"target"],e=d.indexOf(a.connection);-1!==e&&d.splice(e,1)}}),this.addGroup=function(b){a.addClass(b.getEl(),e),h[b.id]=b,b.manager=this,g(b),a.fire(o,{group:b})},this.addToGroup=function(b,c,d){if(b=this.getGroup(b)){var e=b.getEl();if(c._isJsPlumbGroup)return;var f=c._jsPlumbGroup;if(f!==b){var g=a.getOffset(c,!0),h=b.collapsed?a.getOffset(e,!0):a.getOffset(b.getDragArea(),!0);null!=f&&(f.remove(c,!1,d,!1,b),l.updateConnectionsForGroup(f)),b.add(c,d);var i=function(a,c){var d=0===c?1:0;a.each(function(a){a.setVisible(!1),a.endpoints[d].element._jsPlumbGroup===b?(a.endpoints[d].setVisible(!1),s(a,d,b)):(a.endpoints[c].setVisible(!1),n(a,c,b))})};b.collapsed&&(i(a.select({source:c}),0),i(a.select({target:c}),1));var j=a.getId(c);a.dragManager.setParent(c,j,e,a.getId(e),g);var k={left:g.left-h.left,top:g.top-h.top};if(a.setPosition(c,k),a.dragManager.revalidateParent(c,j,g),l.updateConnectionsForGroup(b),a.revalidate(j),!d){var o={group:b,el:c,pos:k};f&&(o.sourceGroup=f),a.fire(m,o)}}}},this.removeFromGroup=function(a,b,c){a=this.getGroup(a),a&&a.remove(b,null,c)},this.getGroup=function(a){var c=a;if(b.isString(a)&&(c=h[a],null==c))throw new TypeError("No such group ["+a+"]");return c},this.getGroups=function(){var a=[];for(var b in h)a.push(h[b]);return a},this.removeGroup=function(b,c,d,e){b=this.getGroup(b),this.expandGroup(b,!0);var f=b[c?v:w](d,e);return a.remove(b.getEl()),delete h[b.id],delete a._groups[b.id],a.fire(p,{group:b}),f},this.removeAllGroups=function(a,b,c){for(var d in h)this.removeGroup(h[d],a,b,c)};var n=function(b,c,d){var e=b.endpoints[0===c?1:0].element;if(!e[k]||e[k].shouldProxy()||!e[k].collapsed){var f=d.getEl(),g=a.getId(f);a.proxyConnection(b,c,f,g,function(a,b){return d.getEndpoint(a,b)},function(a,b){return d.getAnchor(a,b)})}};this.collapseGroup=function(b){if(b=this.getGroup(b),null!=b&&!b.collapsed){var c=b.getEl();if(f(b,!1),b.shouldProxy()){var g=function(a,c){for(var d=0;d<a.length;d++){var e=a[d];n(e,c,b)}};g(b.connections.source,0),g(b.connections.target,1)}b.collapsed=!0,a.removeClass(c,e),a.addClass(c,d),a.revalidate(c),a.fire(r,{group:b})}};var s=function(b,c,d){a.unproxyConnection(b,c,a.getId(d.getEl()))};this.expandGroup=function(b,c){if(b=this.getGroup(b),null!=b&&b.collapsed){var g=b.getEl();if(f(b,!0),b.shouldProxy()){var h=function(a,c){for(var d=0;d<a.length;d++){var e=a[d];s(e,c,b)}};h(b.connections.source,0),h(b.connections.target,1)}b.collapsed=!1,a.addClass(g,e),a.removeClass(g,d),a.revalidate(g),this.repaintGroup(b),c||a.fire(q,{group:b})}},this.repaintGroup=function(b){b=this.getGroup(b);for(var c=b.getMembers(),d=0;d<c.length;d++)a.revalidate(c[d])},this.updateConnectionsForGroup=g,this.refreshAllGroups=function(){for(var b in h)g(h[b]),a.dragManager.updateOffsets(a.getId(h[b].getEl()))}},A=function(c,d){function e(a){return a.offsetParent}function j(a,b){var d=e(a),f=c.getSize(d),g=c.getSize(a),h=b[0],i=h+g[0],j=b[1],k=j+g[1];return i>0&&h<f[0]&&k>0&&j<f[1]}function m(a){var b=c.getId(a),d=c.getOffset(a);return a.parentNode.removeChild(a),c.getContainer().appendChild(a),c.setPosition(a,d),delete a._jsPlumbGroup,q(a),c.dragManager.clearParent(a,b),[b,d]}function o(a){var b=null;if(!j(a.el,a.pos)){var d=a.el._jsPlumbGroup;A?c.remove(a.el):b=m(a.el),d.remove(a.el)}return b}function p(a){var b=c.getId(a);c.revalidate(a),c.dragManager.revalidateParent(a,b)}function q(a){a._katavorioDrag&&((A||z)&&a._katavorioDrag.off(h,o),A||z||!y||(a._katavorioDrag.off(i,p),a._katavorioDrag.setRevert(null)))}function r(a){a._katavorioDrag&&((A||z)&&a._katavorioDrag.on(h,o),x&&a._katavorioDrag.setConstrain(!0),w&&a._katavorioDrag.setUseGhostProxy(!0),A||z||!y||(a._katavorioDrag.on(i,p),a._katavorioDrag.setRevert(function(a,b){return!j(a,b)})))}var t=this,u=d.el;this.getEl=function(){return u},this.id=d.id||b.uuid(),u._isJsPlumbGroup=!0;var v=this.getDragArea=function(){var a=c.getSelector(u,f);return a&&a.length>0?a[0]:u},w=d.ghost===!0,x=w||d.constrain===!0,y=d.revert!==!1,z=d.orphan===!0,A=d.prune===!0,B=d.dropOverride===!0,C=d.proxied!==!1,D=[];if(this.connections={source:[],target:[],internal:[]},this.getAnchor=function(a,b){return d.anchor||"Continuous"},this.getEndpoint=function(a,b){return d.endpoint||["Dot",{radius:10}]},this.collapsed=!1,d.draggable!==!1){var E={stop:function(a){c.fire(s,jsPlumb.extend(a,{group:t}))},scope:l};d.dragOptions&&a.jsPlumb.extend(E,d.dragOptions),c.draggable(d.el,E)}d.droppable!==!1&&c.droppable(d.el,{drop:function(a){var b=a.drag.el;if(!b._isJsPlumbGroup){var d=b._jsPlumbGroup;if(d!==t){if(null!=d&&d.overrideDrop(b,t))return;c.getGroupManager().addToGroup(t,b,!1)}}}});var F=function(a,b){for(var c=null==a.nodeType?a:[a],d=0;d<c.length;d++)b(c[d])};this.overrideDrop=function(a,b){return B&&(y||A||z)},this.add=function(a,b){var d=v();F(a,function(a){if(null!=a._jsPlumbGroup){if(a._jsPlumbGroup===t)return;a._jsPlumbGroup.remove(a,!0,b,!1)}a._jsPlumbGroup=t,D.push(a),c.isAlreadyDraggable(a)&&r(a),a.parentNode!==d&&d.appendChild(a)}),c.getGroupManager().updateConnectionsForGroup(t)},this.remove=function(a,d,e,f,g){F(a,function(a){if(delete a._jsPlumbGroup,b.removeWithFunction(D,function(b){return b===a}),d)try{t.getDragArea().removeChild(a)}catch(f){jsPlumbUtil.log("Could not remove element from Group "+f)}if(q(a),!e){var h={group:t,el:a};g&&(h.targetGroup=g),c.fire(n,h)}}),f||c.getGroupManager().updateConnectionsForGroup(t)},this.removeAll=function(a,b){for(var d=0,e=D.length;e>d;d++){var f=D[0];t.remove(f,a,b,!0),c.remove(f,!0)}D.length=0,c.getGroupManager().updateConnectionsForGroup(t)},this.orphanAll=function(){for(var a={},b=0;b<D.length;b++){var c=m(D[b]);a[c[0]]=c[1]}return D.length=0,a},this.getMembers=function(){return D},u[k]=this,c.bind(g,function(a){a.el._jsPlumbGroup===this&&r(a.el)}.bind(this)),this.shouldProxy=function(){return C},c.getGroupManager().addGroup(this)};c.prototype.addGroup=function(a){var b=this;if(b._groups=b._groups||{},null!=b._groups[a.id])throw new TypeError("cannot create Group ["+a.id+"]; a Group with that ID exists");if(null!=a.el[k])throw new TypeError("cannot create Group ["+a.id+"]; the given element is already a Group");var c=new A(b,a);return b._groups[c.id]=c,a.collapsed&&this.collapseGroup(c),c},c.prototype.addToGroup=function(a,b,c){var d=function(b){var d=this.getId(b);this.manage(d,b),this.getGroupManager().addToGroup(a,b,c)}.bind(this);if(Array.isArray(b))for(var e=0;e<b.length;e++)d(b[e]);else d(b)},c.prototype.removeFromGroup=function(a,b,c){this.getGroupManager().removeFromGroup(a,b,c)},c.prototype.removeGroup=function(a,b,c,d){return this.getGroupManager().removeGroup(a,b,c,d)},c.prototype.removeAllGroups=function(a,b,c){this.getGroupManager().removeAllGroups(a,b,c)},c.prototype.getGroup=function(a){return this.getGroupManager().getGroup(a)},c.prototype.getGroups=function(){return this.getGroupManager().getGroups()},c.prototype.expandGroup=function(a){this.getGroupManager().expandGroup(a)},c.prototype.collapseGroup=function(a){this.getGroupManager().collapseGroup(a)},c.prototype.repaintGroup=function(a){this.getGroupManager().repaintGroup(a)},c.prototype.toggleGroup=function(a){a=this.getGroupManager().getGroup(a),null!=a&&this.getGroupManager()[a.collapsed?"expandGroup":"collapseGroup"](a)},c.prototype.getGroupManager=function(){var a=this[j];return null==a&&(a=this[j]=new z(this)),a},c.prototype.removeGroupManager=function(){delete this[j]},c.prototype.getGroupFor=function(a){return a=this.getElement(a),a?a[k]:void 0}}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumb,c=a.jsPlumbUtil,d="Straight",e="Arc",f=function(a){this.type="Flowchart",a=a||{},a.stub=null==a.stub?30:a.stub;var c,f,g=b.Connectors.AbstractConnector.apply(this,arguments),h=null==a.midpoint?.5:a.midpoint,i=a.alwaysRespectStubs===!0,j=null,k=null,l=null!=a.cornerRadius?a.cornerRadius:0,m=(a.loopbackRadius||25,function(a){return 0>a?-1:0===a?0:1}),n=function(a){return[m(a[2]-a[0]),m(a[3]-a[1])]},o=function(a,b,c,d){if(j!==b||k!==c){var e=null==j?d.sx:j,f=null==k?d.sy:k,g=e===b?"v":"h";j=b,k=c,a.push([e,f,b,c,g])}},p=function(a){return Math.sqrt(Math.pow(a[0]-a[2],2)+Math.pow(a[1]-a[3],2))},q=function(a){var b=[];return b.push.apply(b,a),b},r=function(a,b,c){for(var f,h,i,j=null,k=0;k<b.length-1;k++){if(j=j||q(b[k]),f=q(b[k+1]),h=n(j),i=n(f),l>0&&j[4]!==f[4]){var m=Math.min(p(j),p(f)),o=Math.min(l,m/2);j[2]-=h[0]*o,j[3]-=h[1]*o,f[0]+=i[0]*o,f[1]+=i[1]*o;var r=h[1]===i[0]&&1===i[0]||h[1]===i[0]&&0===i[0]&&h[0]!==i[1]||h[1]===i[0]&&-1===i[0],s=f[1]>j[3]?1:-1,t=f[0]>j[2]?1:-1,u=s===t,v=u&&r||!u&&!r?f[0]:j[2],w=u&&r||!u&&!r?j[3]:f[1];g.addSegment(a,d,{x1:j[0],y1:j[1],x2:j[2],y2:j[3]}),g.addSegment(a,e,{r:o,x1:j[2],y1:j[3],x2:f[0],y2:f[1],cx:v,cy:w,ac:r})}else{var x=j[2]===j[0]?0:j[2]>j[0]?c.lw/2:-(c.lw/2),y=j[3]===j[1]?0:j[3]>j[1]?c.lw/2:-(c.lw/2);g.addSegment(a,d,{x1:j[0]-x,y1:j[1]-y,x2:j[2]+x,y2:j[3]+y})}j=f}null!=f&&g.addSegment(a,d,{x1:f[0],y1:f[1],x2:f[2],y2:f[3]})};this._compute=function(a,b){c=[],j=null,k=null,f=null;var d=function(){return[a.startStubX,a.startStubY,a.endStubX,a.endStubY]},e={perpendicular:d,orthogonal:d,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.startStubX<c.endStubX&&c.tx<c.startStubX||c.sx<c.endStubX&&c.tx<c.sx)},y:function(){return 1===c.so[d]&&(c.startStubY>c.endStubY&&c.ty>c.startStubY||c.sy>c.endStubY&&c.ty>c.sy)||-1===c.so[d]&&(c.startStubY<c.endStubY&&c.ty<c.startStubY||c.sy<c.endStubY&&c.ty<c.sy)}};return!i&&e[b]()?{x:[(a.sx+a.tx)/2,a.startStubY,(a.sx+a.tx)/2,a.endStubY],y:[a.startStubX,(a.sy+a.ty)/2,a.endStubX,(a.sy+a.ty)/2]}[b]:[a.startStubX,a.startStubY,a.endStubX,a.endStubY]}},l=e[a.anchorOrientation](a.sourceAxis),m="x"===a.sourceAxis?0:1,n="x"===a.sourceAxis?1:0,p=l[m],q=l[n],s=l[m+2],t=l[n+2];o(c,l[0],l[1],a);var u=a.startStubX+(a.endStubX-a.startStubX)*h,v=a.startStubY+(a.endStubY-a.startStubY)*h,w={x:[0,1],y:[1,0]},x={perpendicular:function(b){var c=a,d={x:[[[1,2,3,4],null,[2,1,4,3]],null,[[4,3,2,1],null,[3,4,1,2]]],y:[[[3,2,1,4],null,[2,3,4,1]],null,[[4,1,2,3],null,[1,4,3,2]]]},e={x:[[c.startStubX,c.endStubX],null,[c.endStubX,c.startStubX]],y:[[c.startStubY,c.endStubY],null,[c.endStubY,c.startStubY]]},f={x:[[u,c.startStubY],[u,c.endStubY]],y:[[c.startStubX,v],[c.endStubX,v]]},g={x:[[c.endStubX,c.startStubY]],y:[[c.startStubX,c.endStubY]]},h={x:[[c.startStubX,c.endStubY],[c.endStubX,c.endStubY]],y:[[c.endStubX,c.startStubY],[c.endStubX,c.endStubY]]},i={x:[[c.startStubX,v],[c.endStubX,v],[c.endStubX,c.endStubY]],y:[[u,c.startStubY],[u,c.endStubY],[c.endStubX,c.endStubY]]},j={x:[c.startStubY,c.endStubY],y:[c.startStubX,c.endStubX]},k=w[b][0],l=w[b][1],m=c.so[k]+1,n=c.to[l]+1,o=-1===c.to[l]&&j[b][1]<j[b][0]||1===c.to[l]&&j[b][1]>j[b][0],p=e[b][m][0],q=e[b][m][1],r=d[b][m][n];return c.segment===r[3]||c.segment===r[2]&&o?f[b]:c.segment===r[2]&&p>q?g[b]:c.segment===r[2]&&q>=p||c.segment===r[1]&&!o?i[b]:c.segment===r[0]||c.segment===r[1]&&o?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(c,d,e,f){var h=a,i={x:"y",y:"x"}[c],j={x:"height",y:"width"}[c],k=h["is"+c.toUpperCase()+"GreaterThanStubTimes2"];if(b.sourceEndpoint.elementId===b.targetEndpoint.elementId){var l=e+(1-b.sourceEndpoint.anchor[i])*b.sourceInfo[j]+g.maxStub;return{x:[[d,l],[f,l]],y:[[l,d],[l,f]]}[c]}return!k||1===h.so[m]&&d>f||-1===h.so[m]&&f>d?{x:[[d,v],[f,v]],y:[[u,d],[u,f]]}[c]:1===h.so[m]&&f>d||-1===h.so[m]&&d>f?{x:[[u,h.sy],[u,h.ty]],y:[[h.sx,v],[h.tx,v]]}[c]:void 0}},y=x[a.anchorOrientation](a.sourceAxis,p,q,s,t);if(y)for(var z=0;z<y.length;z++)o(c,y[z][0],y[z][1],a);o(c,l[2],l[3],a),o(c,a.tx,a.ty,a),r(this,c,a)}};b.Connectors.Flowchart=f,c.extend(b.Connectors.Flowchart,b.Connectors.AbstractConnector)}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumb,c=a.jsPlumbUtil;b.Connectors.AbstractBezierConnector=function(a){a=a||{};var c,d=a.showLoopback!==!1,e=(a.curviness||10,a.margin||5),f=(a.proximityLimit||80,a.orientation&&"clockwise"===a.orientation),g=a.loopbackRadius||25,h=!1;return this._compute=function(a,b){var i=b.sourcePos,j=b.targetPos,k=Math.abs(i[0]-j[0]),l=Math.abs(i[1]-j[1]);if(d&&b.sourceEndpoint.elementId===b.targetEndpoint.elementId){h=!0;var m=b.sourcePos[0],n=b.sourcePos[1]-e,o=m,p=n-g,q=o-g,r=p-g;k=2*g,l=2*g,a.points[0]=q,a.points[1]=r,a.points[2]=k,a.points[3]=l,c.addSegment(this,"Arc",{loopback:!0,x1:m-q+4,y1:n-r,startAngle:0,endAngle:2*Math.PI,r:g,ac:!f,x2:m-q-4,y2:n-r,cx:o-q,cy:p-r})}else h=!1,this._computeBezier(a,b,i,j,k,l)},c=b.Connectors.AbstractConnector.apply(this,arguments)},c.extend(b.Connectors.AbstractBezierConnector,b.Connectors.AbstractConnector);var d=function(a){a=a||{},this.type="Bezier";var c=b.Connectors.AbstractBezierConnector.apply(this,arguments),d=a.curviness||150,e=10;this.getCurviness=function(){return d},this._findControlPoint=function(a,b,c,f,g,h,i){var j=h[0]!==i[0]||h[1]===i[1],k=[];return j?(0===i[0]?k.push(c[0]<b[0]?a[0]+e:a[0]-e):k.push(a[0]+d*i[0]),0===i[1]?k.push(c[1]<b[1]?a[1]+e:a[1]-e):k.push(a[1]+d*h[1])):(0===h[0]?k.push(b[0]<c[0]?a[0]+e:a[0]-e):k.push(a[0]-d*h[0]),0===h[1]?k.push(b[1]<c[1]?a[1]+e:a[1]-e):k.push(a[1]+d*i[1])),k},this._computeBezier=function(a,b,d,e,f,g){var h,i,j=d[0]<e[0]?f:0,k=d[1]<e[1]?g:0,l=d[0]<e[0]?0:f,m=d[1]<e[1]?0:g;h=this._findControlPoint([j,k],d,e,b.sourceEndpoint,b.targetEndpoint,a.so,a.to),i=this._findControlPoint([l,m],e,d,b.targetEndpoint,b.sourceEndpoint,a.to,a.so),c.addSegment(this,"Bezier",{x1:j,y1:k,x2:l,y2:m,cp1x:h[0],cp1y:h[1],cp2x:i[0],cp2y:i[1]})}};b.Connectors.Bezier=d,c.extend(d,b.Connectors.AbstractBezierConnector)}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumb,c=a.jsPlumbUtil,d=function(a,b,c,d){return c>=a&&b>=d?1:c>=a&&d>=b?2:a>=c&&d>=b?3:4},e=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+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+f,b+-1*g]:void 0},f=function(a){a=a||{},this.type="StateMachine";var c,f=b.Connectors.AbstractBezierConnector.apply(this,arguments),g=a.curviness||10,h=a.margin||5,i=a.proximityLimit||80;a.orientation&&"clockwise"===a.orientation;this._computeBezier=function(a,b,j,k,l,m){var n=b.sourcePos[0]<b.targetPos[0]?0:l,o=b.sourcePos[1]<b.targetPos[1]?0:m,p=b.sourcePos[0]<b.targetPos[0]?l:0,q=b.sourcePos[1]<b.targetPos[1]?m:0;0===b.sourcePos[2]&&(n-=h),1===b.sourcePos[2]&&(n+=h),0===b.sourcePos[3]&&(o-=h),1===b.sourcePos[3]&&(o+=h),0===b.targetPos[2]&&(p-=h),1===b.targetPos[2]&&(p+=h),0===b.targetPos[3]&&(q-=h),1===b.targetPos[3]&&(q+=h);var r,s,t,u,v=(n+p)/2,w=(o+q)/2,x=d(n,o,p,q),y=Math.sqrt(Math.pow(p-n,2)+Math.pow(q-o,2));c=e(v,w,x,b.sourcePos,b.targetPos,g,g,y,i),r=c[0],s=c[0],t=c[1],u=c[1],f.addSegment(this,"Bezier",{x1:p,y1:q,x2:n,y2:o,cp1x:r,cp1y:t,cp2x:s,cp2y:u})}};b.Connectors.StateMachine=f,c.extend(f,b.Connectors.AbstractBezierConnector)}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumb,c=a.jsPlumbUtil,d="Straight",e=function(a){this.type=d;var c=b.Connectors.AbstractConnector.apply(this,arguments);this._compute=function(a,b){c.addSegment(this,d,{x1:a.sx,y1:a.sy,x2:a.startStubX,y2:a.startStubY}),c.addSegment(this,d,{x1:a.startStubX,y1:a.startStubY,x2:a.endStubX,y2:a.endStubY}),c.addSegment(this,d,{x1:a.endStubX,y1:a.endStubY,x2:a.tx,y2:a.ty})}};b.Connectors.Straight=e,c.extend(e,b.Connectors.AbstractConnector)}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumb,c=a.jsPlumbUtil,d={"stroke-linejoin":"stroke-linejoin","stroke-dashoffset":"stroke-dashoffset","stroke-linecap":"stroke-linecap"},e="stroke-dasharray",f="dashstyle",g="linearGradient",h="radialGradient",i="defs",j="fill",k="stop",l="stroke",m="stroke-width",n="style",o="none",p="jsplumb_gradient_",q="strokeWidth",r={svg:"http://www.w3.org/2000/svg"},s=function(a,b){for(var c in b)a.setAttribute(c,""+b[c])},t=function(a,c){return c=c||{},c.version="1.1",c.xmlns=r.svg,b.createElementNS(r.svg,a,null,null,c)},u=function(a){return"position:absolute;left:"+a[0]+"px;top:"+a[1]+"px"},v=function(a){for(var b=a.querySelectorAll(" defs,linearGradient,radialGradient"),c=0;c<b.length;c++)b[c].parentNode.removeChild(b[c])},w=function(a,b,c,d,e){var f=p+e._jsPlumb.instance.idstamp();v(a);var m;m=c.gradient.offset?t(h,{id:f}):t(g,{id:f,gradientUnits:"userSpaceOnUse"});var n=t(i);a.appendChild(n),n.appendChild(m);for(var o=0;o<c.gradient.stops.length;o++){var q=1===e.segment||2===e.segment?o:c.gradient.stops.length-1-o,r=c.gradient.stops[q][1],s=t(k,{offset:Math.floor(100*c.gradient.stops[o][0])+"%","stop-color":r});m.appendChild(s)}var u=c.stroke?l:j;b.setAttribute(u,"url(#"+f+")")},x=function(a,b,c,g,h){if(b.setAttribute(j,c.fill?c.fill:o),b.setAttribute(l,c.stroke?c.stroke:o),c.gradient?w(a,b,c,g,h):(v(a),b.setAttribute(n,"")),c.strokeWidth&&b.setAttribute(m,c.strokeWidth),c[f]&&c[q]&&!c[e]){var i=-1===c[f].indexOf(",")?" ":",",k=c[f].split(i),p="";k.forEach(function(a){p+=Math.floor(a*c.strokeWidth)+i}),b.setAttribute(e,p)}else c[e]&&b.setAttribute(e,c[e]);for(var r in d)c[r]&&b.setAttribute(d[r],c[r])},y=function(a,b,c){a.childNodes.length>c?a.insertBefore(b,a.childNodes[c]):a.appendChild(b)};c.svg={node:t,attr:s,pos:u};var z=function(a){var d=a.pointerEventsSpec||"all",e={};b.jsPlumbUIComponent.apply(this,a.originalArgs),this.canvas=null,this.path=null,this.svg=null,this.bgCanvas=null;var f=a.cssClass+" "+(a.originalArgs[0].cssClass||""),g={style:"",width:0,height:0,"pointer-events":d,position:"absolute"};this.svg=t("svg",g),a.useDivWrapper?(this.canvas=b.createElement("div",{position:"absolute"}),c.sizeElement(this.canvas,0,0,1,1),this.canvas.className=f):(s(this.svg,{"class":f}),this.canvas=this.svg),a._jsPlumb.appendElement(this.canvas,a.originalArgs[0].parent),a.useDivWrapper&&this.canvas.appendChild(this.svg);var h=[this.canvas];return this.getDisplayElements=function(){return h},this.appendDisplayElement=function(a){h.push(a)},this.paint=function(b,d,f){if(null!=b){var g,h=[this.x,this.y],i=[this.w,this.h];null!=f&&(f.xmin<0&&(h[0]+=f.xmin),f.ymin<0&&(h[1]+=f.ymin),i[0]=f.xmax+(f.xmin<0?-f.xmin:0),i[1]=f.ymax+(f.ymin<0?-f.ymin:0)),a.useDivWrapper?(c.sizeElement(this.canvas,h[0],h[1],i[0],i[1]),h[0]=0,h[1]=0,g=u([0,0])):g=u([h[0],h[1]]),e.paint.apply(this,arguments),s(this.svg,{style:g,width:i[0]||0,height:i[1]||0})}},{renderer:e}};c.extend(z,b.jsPlumbUIComponent,{cleanup:function(a){a||null==this.typeId?(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):(this.canvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.bgCanvas&&this.bgCanvas.parentNode&&this.bgCanvas.parentNode.removeChild(this.bgCanvas))},reattach:function(a){var b=a.getContainer();this.canvas&&null==this.canvas.parentNode&&b.appendChild(this.canvas),this.bgCanvas&&null==this.bgCanvas.parentNode&&b.appendChild(this.bgCanvas)},setVisible:function(a){this.canvas&&(this.canvas.style.display=a?"block":"none")}}),b.ConnectorRenderers.svg=function(a){var c=this,d=z.apply(this,[{cssClass:a._jsPlumb.connectorClass,originalArgs:arguments,pointerEventsSpec:"none",_jsPlumb:a._jsPlumb}]);d.renderer.paint=function(d,e,f){var g=c.getSegments(),h="",i=[0,0];if(f.xmin<0&&(i[0]=-f.xmin),f.ymin<0&&(i[1]=-f.ymin),g.length>0){h=c.getPathData();var j={d:h,transform:"translate("+i[0]+","+i[1]+")","pointer-events":a["pointer-events"]||"visibleStroke"},k=null,l=[c.x,c.y,c.w,c.h];if(d.outlineStroke){var m=d.outlineWidth||1,n=d.strokeWidth+2*m;k=b.extend({},d),delete k.gradient,k.stroke=d.outlineStroke,k.strokeWidth=n,null==c.bgPath?(c.bgPath=t("path",j),b.addClass(c.bgPath,b.connectorOutlineClass),y(c.svg,c.bgPath,0)):s(c.bgPath,j),x(c.svg,c.bgPath,k,l,c)}null==c.path?(c.path=t("path",j),y(c.svg,c.path,d.outlineStroke?1:0)):s(c.path,j),x(c.svg,c.path,d,l,c)}}},c.extend(b.ConnectorRenderers.svg,z);var A=b.SvgEndpoint=function(a){var c=z.apply(this,[{cssClass:a._jsPlumb.endpointClass,originalArgs:arguments,pointerEventsSpec:"all",useDivWrapper:!0,_jsPlumb:a._jsPlumb}]);c.renderer.paint=function(a){var c=b.extend({},a);c.outlineStroke&&(c.stroke=c.outlineStroke),null==this.node?(this.node=this.makeNode(c),this.svg.appendChild(this.node)):null!=this.updateNode&&this.updateNode(this.node),-x(this.svg,this.node,c,[this.x,this.y,this.w,this.h],this),u(this.node,[this.x,this.y])}.bind(this)};c.extend(A,z),b.Endpoints.svg.Dot=function(){b.Endpoints.Dot.apply(this,arguments),A.apply(this,arguments),this.makeNode=function(a){return t("circle",{cx:this.w/2,cy:this.h/2,r:this.radius})},this.updateNode=function(a){s(a,{cx:this.w/2,cy:this.h/2,r:this.radius})}},c.extend(b.Endpoints.svg.Dot,[b.Endpoints.Dot,A]),b.Endpoints.svg.Rectangle=function(){b.Endpoints.Rectangle.apply(this,arguments),A.apply(this,arguments),this.makeNode=function(a){return t("rect",{width:this.w,height:this.h})},this.updateNode=function(a){s(a,{width:this.w,height:this.h})}},c.extend(b.Endpoints.svg.Rectangle,[b.Endpoints.Rectangle,A]),b.Endpoints.svg.Image=b.Endpoints.Image,b.Endpoints.svg.Blank=b.Endpoints.Blank,b.Overlays.svg.Label=b.Overlays.Label,b.Overlays.svg.Custom=b.Overlays.Custom;var B=function(a,c){a.apply(this,c),b.jsPlumbUIComponent.apply(this,c),this.isAppendedAtTopLevel=!1;this.path=null,this.paint=function(a,b){if(a.component.svg&&b){null==this.path&&(this.path=t("path",{"pointer-events":"all"}),a.component.svg.appendChild(this.path),this.elementCreated&&this.elementCreated(this.path,a.component),this.canvas=a.component.svg);var e=c&&1===c.length?c[0].cssClass||"":"",f=[0,0];b.xmin<0&&(f[0]=-b.xmin),b.ymin<0&&(f[1]=-b.ymin),s(this.path,{d:d(a.d),"class":e,stroke:a.stroke?a.stroke:null,fill:a.fill?a.fill:null,transform:"translate("+f[0]+","+f[1]+")"})}};var d=function(a){return isNaN(a.cxy.x)||isNaN(a.cxy.y)?"":"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};this.transfer=function(a){a.canvas&&this.path&&this.path.parentNode&&(this.path.parentNode.removeChild(this.path),a.canvas.appendChild(this.path))}};c.extend(B,[b.jsPlumbUIComponent,b.Overlays.AbstractOverlay],{cleanup:function(a){null!=this.path&&(a?this._jsPlumb.instance.removeElement(this.path):this.path.parentNode&&this.path.parentNode.removeChild(this.path))},reattach:function(a,b){this.path&&b.canvas&&b.canvas.appendChild(this.path)},setVisible:function(a){null!=this.path&&(this.path.style.display=a?"block":"none")}}),b.Overlays.svg.Arrow=function(){B.apply(this,[b.Overlays.Arrow,arguments])},c.extend(b.Overlays.svg.Arrow,[b.Overlays.Arrow,B]),b.Overlays.svg.PlainArrow=function(){B.apply(this,[b.Overlays.PlainArrow,arguments])},c.extend(b.Overlays.svg.PlainArrow,[b.Overlays.PlainArrow,B]),b.Overlays.svg.Diamond=function(){B.apply(this,[b.Overlays.Diamond,arguments])},c.extend(b.Overlays.svg.Diamond,[b.Overlays.Diamond,B]),b.Overlays.svg.GuideLines=function(){var a,c,d=null,e=this;b.Overlays.GuideLines.apply(this,arguments),this.paint=function(b,g){null==d&&(d=t("path"),b.connector.svg.appendChild(d),e.attachListeners(d,b.connector),e.attachListeners(d,e),a=t("path"),b.connector.svg.appendChild(a),e.attachListeners(a,b.connector),e.attachListeners(a,e),c=t("path"),b.connector.svg.appendChild(c),e.attachListeners(c,b.connector),e.attachListeners(c,e));var h=[0,0];g.xmin<0&&(h[0]=-g.xmin),g.ymin<0&&(h[1]=-g.ymin),s(d,{d:f(b.head,b.tail),stroke:"red",fill:null,transform:"translate("+h[0]+","+h[1]+")"}),s(a,{d:f(b.tailLine[0],b.tailLine[1]),stroke:"blue",fill:null,transform:"translate("+h[0]+","+h[1]+")"}),s(c,{d:f(b.headLine[0],b.headLine[1]),stroke:"green",fill:null,transform:"translate("+h[0]+","+h[1]+")"})};var f=function(a,b){return"M "+a.x+","+a.y+" L"+b.x+","+b.y}},c.extend(b.Overlays.svg.GuideLines,b.Overlays.GuideLines)}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumb,c=a.jsPlumbUtil,d=a.Katavorio,e=a.Biltong,f=function(b){var c=b._mottle;return c||(c=b._mottle=new a.Mottle),c},g=function(a,c){c=c||"main";var f="_katavorio_"+c,g=a[f],h=a.getEventManager();return g||(g=new d({bind:h.on,unbind:h.off,getSize:b.getSize,getConstrainingRectangle:function(a){return[a.parentNode.scrollWidth,a.parentNode.scrollHeight]},getPosition:function(b,c){var d=a.getOffset(b,c,b._katavorioDrag?b.offsetParent:null);return[d.left,d.top]},setPosition:function(a,b){a.style.left=b[0]+"px",a.style.top=b[1]+"px"},addClass:b.addClass,removeClass:b.removeClass,intersects:e.intersects,indexOf:function(a,b){return a.indexOf(b)},scope:a.getDefaultScope(),css:{noSelect:a.dragSelectClass,droppable:"jtk-droppable",draggable:"jtk-draggable",drag:"jtk-drag",selected:"jtk-drag-selected",active:"jtk-drag-active",hover:"jtk-drag-hover",ghostProxy:"jtk-ghost-proxy"}}),g.setZoom(a.getZoom()),a[f]=g,a.bind("zoom",g.setZoom)),g},h=function(a){var b=a.el._jsPlumbDragOptions,c=!0;return b.canDrag&&(c=b.canDrag()),c&&(this.setHoverSuspended(!0),this.select({source:a.el}).addClass(this.elementDraggingClass+" "+this.sourceElementDraggingClass,!0),this.select({target:a.el}).addClass(this.elementDraggingClass+" "+this.targetElementDraggingClass,!0),this.setConnectionBeingDragged(!0)),c},i=function(a){var b=this.getUIPosition(arguments,this.getZoom());if(null!=b){var c=a.el._jsPlumbDragOptions;this.draw(a.el,b,null,!0),c._dragging&&this.addClass(a.el,"jtk-dragged"),c._dragging=!0}},j=function(a){for(var b,c=a.selection,d=function(a){null!=a[1]&&(b=this.getUIPosition([{el:a[2].el,pos:[a[1].left,a[1].top]}]),this.draw(a[2].el,b)),delete a[0]._jsPlumbDragOptions._dragging,this.removeClass(a[0],"jtk-dragged"),this.select({source:a[2].el}).removeClass(this.elementDraggingClass+" "+this.sourceElementDraggingClass,!0),this.select({target:a[2].el}).removeClass(this.elementDraggingClass+" "+this.targetElementDraggingClass,!0),this.getDragManager().dragEnded(a[2].el)}.bind(this),e=0;e<c.length;e++)d(c[e]);this.setHoverSuspended(!1),this.setConnectionBeingDragged(!1)},k=function(a,b){var d=function(d){if(null!=b[d]){if(c.isString(b[d])){var e=b[d].match(/-=/)?-1:1,f=b[d].substring(2);return a[d]+e*f}return b[d]}return a[d]};return[d("left"),d("top")]},l=function(a,b){if(null==b)return[0,0];var c=q(b),d=p(c,0);return[d[a+"X"],d[a+"Y"]]},m=l.bind(this,"page"),n=l.bind(this,"screen"),o=l.bind(this,"client"),p=function(a,b){return a.item?a.item(b):a[b]},q=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]},r=function(a){var b={},c=[],d={},e={},f={};this.register=function(g){var h,i=a.getId(g);b[i]||(b[i]=g,c.push(g),d[i]={});var j=function(b){if(b)for(var c=0;c<b.childNodes.length;c++)if(3!==b.childNodes[c].nodeType&&8!==b.childNodes[c].nodeType){var k=jsPlumb.getElement(b.childNodes[c]),l=a.getId(b.childNodes[c],null,!0);if(l&&e[l]&&e[l]>0){h||(h=a.getOffset(g));var m=a.getOffset(k);d[i][l]={id:l,offset:{left:m.left-h.left,top:m.top-h.top}},f[l]=i}j(b.childNodes[c])}};j(g)},this.updateOffsets=function(b,c){if(null!=b){c=c||{};var e,g=jsPlumb.getElement(b),h=a.getId(g),i=d[h];if(i)for(var j in i)if(i.hasOwnProperty(j)){var k=jsPlumb.getElement(j),l=c[j]||a.getOffset(k);if(null==k.offsetParent&&null!=d[h][j])continue;e||(e=a.getOffset(g)),d[h][j]={id:j,offset:{left:l.left-e.left,top:l.top-e.top}},f[j]=h}}},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=a.getOffset(i);if(null==d[j][g]){var l=a.getOffset(c);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.hasOwnProperty(b)&&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){if(null!=b.offsetParent){var c=a.getId(b),d=f[c];d&&this.updateOffsets(d)}},this.setParent=function(b,c,e,g,h){var i=f[c];d[g]||(d[g]={});var j=a.getOffset(e),k=h||a.getOffset(b);i&&d[i]&&delete d[i][c],d[g][c]={id:c,offset:{left:k.left-j.left,top:k.top-j.top}},f[c]=g},this.clearParent=function(a,b){var c=f[b];c&&(delete d[c][b],delete f[b])},this.revalidateParent=function(b,c,d){var e=f[c];if(e){var g={};g[c]=d,this.updateOffsets(e,g),a.revalidate(e)}},this.getDragAncestor=function(b){var c=jsPlumb.getElement(b),d=a.getId(c),e=f[d];return e?jsPlumb.getElement(e):null}},s=function(a,b,d){b=c.fastTrim(b),"undefined"!=typeof a.className.baseVal?a.className.baseVal=b:a.className=b;try{var e=a.classList;if(null!=e){for(;e.length>0;)e.remove(e.item(0));for(var f=0;f<d.length;f++)d[f]&&e.add(d[f])}}catch(g){c.log("JSPLUMB: cannot set class list",g)}},t=function(a){return"undefined"==typeof a.className.baseVal?a.className:a.className.baseVal},u=function(a,b,d){b=null==b?[]:c.isArray(b)?b:b.split(/\s+/),d=null==d?[]:c.isArray(d)?d:d.split(/\s+/);var e=t(a),f=e.split(/\s+/),g=function(a,b){for(var c=0;c<b.length;c++)if(a)-1===f.indexOf(b[c])&&f.push(b[c]);else{var d=f.indexOf(b[c]);-1!==d&&f.splice(d,1)}};g(!0,b),g(!1,d),s(a,f.join(" "),f)};a.jsPlumb.extend(a.jsPlumbInstance.prototype,{headless:!1,pageLocation:m,screenLocation:n,clientLocation:o,getDragManager:function(){return null==this.dragManager&&(this.dragManager=new r(this)),this.dragManager},recalculateOffsets:function(a){this.getDragManager().updateOffsets(a)},createElement:function(a,b,c,d){return this.createElementNS(null,a,b,c,d)},createElementNS:function(a,b,c,d,e){var f,g=null==a?document.createElement(b):document.createElementNS(a,b);c=c||{};for(f in c)g.style[f]=c[f];d&&(g.className=d),e=e||{};for(f in e)g.setAttribute(f,""+e[f]);return g},getAttribute:function(a,b){return null!=a.getAttribute?a.getAttribute(b):null},setAttribute:function(a,b,c){null!=a.setAttribute&&a.setAttribute(b,c)},setAttributes:function(a,b){for(var c in b)b.hasOwnProperty(c)&&a.setAttribute(c,b[c])},appendToRoot:function(a){document.body.appendChild(a)},getRenderModes:function(){return["svg"]},getClass:t,addClass:function(a,b){jsPlumb.each(a,function(a){u(a,b)})},hasClass:function(a,b){return a=jsPlumb.getElement(a),a.classList?a.classList.contains(b):-1!==t(a).indexOf(b)},removeClass:function(a,b){jsPlumb.each(a,function(a){u(a,null,b)})},toggleClass:function(a,b){jsPlumb.hasClass(a,b)?jsPlumb.removeClass(a,b):jsPlumb.addClass(a,b)},updateClasses:function(a,b,c){jsPlumb.each(a,function(a){u(a,b,c)})},setClass:function(a,b){null!=b&&jsPlumb.each(a,function(a){s(a,b,b.split(/\s+/))})},setPosition:function(a,b){a.style.left=b.left+"px",a.style.top=b.top+"px"},getPosition:function(a){var b=function(b){var c=a.style[b];return c?c.substring(0,c.length-2):0};return{left:b("left"),top:b("top")}},getStyle:function(a,b){return"undefined"!=typeof window.getComputedStyle?getComputedStyle(a,null).getPropertyValue(b):a.currentStyle[b]},getSelector:function(a,b){var c=null;return c=1===arguments.length?null!=a.nodeType?a:document.querySelectorAll(a):a.querySelectorAll(b)},getOffset:function(a,b,c){a=jsPlumb.getElement(a),c=c||this.getContainer();for(var d={left:a.offsetLeft,top:a.offsetTop},e=b||null!=c&&a!==c&&a.offsetParent!==c?a.offsetParent:null,f=function(a){null!=a&&a!==document.body&&(a.scrollTop>0||a.scrollLeft>0)&&(d.left-=a.scrollLeft,d.top-=a.scrollTop)}.bind(this);null!=e;)d.left+=e.offsetLeft,d.top+=e.offsetTop,f(e),e=b?e.offsetParent:e.offsetParent===c?null:e.offsetParent;if(null!=c&&!b&&(c.scrollTop>0||c.scrollLeft>0)){var g=null!=a.offsetParent?this.getStyle(a.offsetParent,"position"):"static",h=this.getStyle(a,"position");"absolute"!==h&&"fixed"!==h&&"absolute"!==g&&"fixed"!==g&&(d.left-=c.scrollLeft,d.top-=c.scrollTop)}return d},getPositionOnElement:function(a,b,c){var d="undefined"!=typeof b.getBoundingClientRect?b.getBoundingClientRect():{left:0,top:0,width:0,height:0},e=document.body,f=document.documentElement,g=window.pageYOffset||f.scrollTop||e.scrollTop,h=window.pageXOffset||f.scrollLeft||e.scrollLeft,i=f.clientTop||e.clientTop||0,j=f.clientLeft||e.clientLeft||0,k=0,l=0,m=d.top+g-i+k*c,n=d.left+h-j+l*c,o=jsPlumb.pageLocation(a),p=d.width||b.offsetWidth*c,q=d.height||b.offsetHeight*c,r=(o[0]-n)/p,s=(o[1]-m)/q;return[r,s]},getAbsolutePosition:function(a){var b=function(b){var c=a.style[b];return c?parseFloat(c.substring(0,c.length-2)):void 0};return[b("left"),b("top")]},setAbsolutePosition:function(a,b,c,d){c?this.animate(a,{left:"+="+(b[0]-c[0]),top:"+="+(b[1]-c[1])},d):(a.style.left=b[0]+"px",a.style.top=b[1]+"px")},getSize:function(a){return[a.offsetWidth,a.offsetHeight]},getWidth:function(a){return a.offsetWidth},getHeight:function(a){return a.offsetHeight},getRenderMode:function(){return"svg"},draggable:function(a,b){var d;return a=c.isArray(a)||null!=a.length&&!c.isString(a)?a:[a],Array.prototype.slice.call(a).forEach(function(a){d=this.info(a),d.el&&this._initDraggableIfNecessary(d.el,!0,b,d.id,!0)}.bind(this)),this},snapToGrid:function(a,b,c){var d=[],e=function(a){var e=this.info(a);if(null!=e.el&&e.el._katavorioDrag){var f=e.el._katavorioDrag.snap(b,c);this.revalidate(e.el),d.push([e.el,f])}}.bind(this);if(1===arguments.length||3===arguments.length)e(a,b,c);else{var f=this.getManagedElements();for(var g in f)e(g,arguments[0],arguments[1])}return d},initDraggable:function(a,b,c){g(this,c).draggable(a,b),a._jsPlumbDragOptions=b},destroyDraggable:function(a,b){g(this,b).destroyDraggable(a),delete a._jsPlumbDragOptions},unbindDraggable:function(a,b,c,d){g(this,d).destroyDraggable(a,b,c)},setDraggable:function(a,b){return jsPlumb.each(a,function(a){this.isDragSupported(a)&&(this._draggableStates[this.getAttribute(a,"id")]=b,this.setElementDraggable(a,b))}.bind(this))},_draggableStates:{},toggleDraggable:function(a){var b;return jsPlumb.each(a,function(a){var c=this.getAttribute(a,"id");return b=null==this._draggableStates[c]?!1:this._draggableStates[c],b=!b,this._draggableStates[c]=b,this.setDraggable(a,b),b}.bind(this)),b},_initDraggableIfNecessary:function(a,b,d,e,f){if(!jsPlumb.headless){var g=null==b?!1:b;if(g&&jsPlumb.isDragSupported(a,this)){var k=d||this.Defaults.DragOptions;if(k=jsPlumb.extend({},k),jsPlumb.isAlreadyDraggable(a,this))d.force&&this.initDraggable(a,k);else{var l=jsPlumb.dragEvents.drag,m=jsPlumb.dragEvents.stop,n=jsPlumb.dragEvents.start;this.manage(e,a),k[n]=c.wrap(k[n],h.bind(this)),k[l]=c.wrap(k[l],i.bind(this)),k[m]=c.wrap(k[m],j.bind(this));var o=this.getId(a);this._draggableStates[o]=!0;var p=this._draggableStates[o];k.disabled=null==p?!1:!p,this.initDraggable(a,k),this.getDragManager().register(a),f&&this.fire("elementDraggable",{el:a,options:k})}}}},animationSupported:!0,getElement:function(a){return null==a?null:(a="string"==typeof a?a:null!=a.length&&null==a.enctype?a[0]:a,"string"==typeof a?document.getElementById(a):a)},removeElement:function(a){g(this).elementRemoved(a),this.getEventManager().remove(a)},doAnimate:function(a,c,d){d=d||{};var e=this.getOffset(a),f=k(e,c),g=f[0]-e.left,h=f[1]-e.top,i=d.duration||250,j=15,l=i/j,m=j/i*g,n=j/i*h,o=0,p=setInterval(function(){b.setPosition(a,{left:e.left+m*(o+1),top:e.top+n*(o+1)}),null!=d.step&&d.step(o,Math.ceil(l)),o++,o>=l&&(window.clearInterval(p),null!=d.complete&&d.complete())},j)},destroyDroppable:function(a,b){g(this,b).destroyDroppable(a)},unbindDroppable:function(a,b,c,d){g(this,d).destroyDroppable(a,b,c)},droppable:function(a,b){a=c.isArray(a)||null!=a.length&&!c.isString(a)?a:[a];var d;return b=b||{},b.allowLoopback=!1,Array.prototype.slice.call(a).forEach(function(a){d=this.info(a),d.el&&this.initDroppable(d.el,b)}.bind(this)),this},initDroppable:function(a,b,c){g(this,c).droppable(a,b)},isAlreadyDraggable:function(a){return null!=a._katavorioDrag},isDragSupported:function(a,b){return!0},isDropSupported:function(a,b){return!0},isElementDraggable:function(a){return a=b.getElement(a),a._katavorioDrag&&a._katavorioDrag.isEnabled()},getDragObject:function(a){return a[0].drag.getDragElement()},getDragScope:function(a){return a._katavorioDrag&&a._katavorioDrag.scopes.join(" ")||""},getDropEvent:function(a){return a[0].e},getUIPosition:function(a,b){var c=a[0].el;if(null==c.offsetParent)return null;var d=a[0].finalPos||a[0].pos,e={left:d[0],top:d[1]};if(c._katavorioDrag&&c.offsetParent!==this.getContainer()){var f=this.getOffset(c.offsetParent);e.left+=f.left,e.top+=f.top}return e},setDragFilter:function(a,b,c){a._katavorioDrag&&a._katavorioDrag.setFilter(b,c)},setElementDraggable:function(a,c){a=b.getElement(a),a._katavorioDrag&&a._katavorioDrag.setEnabled(c)},setDragScope:function(a,b){a._katavorioDrag&&a._katavorioDrag.k.setDragScope(a,b)},setDropScope:function(a,b){a._katavorioDrop&&a._katavorioDrop.length>0&&a._katavorioDrop[0].k.setDropScope(a,b)},addToPosse:function(a,c){var d=Array.prototype.slice.call(arguments,1),e=g(this);b.each(a,function(a){a=[b.getElement(a)],a.push.apply(a,d),e.addToPosse.apply(e,a)})},setPosse:function(a,c){var d=Array.prototype.slice.call(arguments,1),e=g(this);b.each(a,function(a){a=[b.getElement(a)],a.push.apply(a,d),e.setPosse.apply(e,a)})},removeFromPosse:function(a,c){var d=Array.prototype.slice.call(arguments,1),e=g(this);b.each(a,function(a){a=[b.getElement(a)],a.push.apply(a,d),e.removeFromPosse.apply(e,a)})},removeFromAllPosses:function(a){var c=g(this);b.each(a,function(a){c.removeFromAllPosses(b.getElement(a))})},setPosseState:function(a,c,d){var e=g(this);b.each(a,function(a){e.setPosseState(b.getElement(a),c,d)})},dragEvents:{start:"start",stop:"stop",drag:"drag",step:"step",over:"over",out:"out",drop:"drop",complete:"complete",beforeStart:"beforeStart"},animEvents:{step:"step",complete:"complete"},stopDrag:function(a){a._katavorioDrag&&a._katavorioDrag.abort()},addToDragSelection:function(a){g(this).select(a)},removeFromDragSelection:function(a){g(this).deselect(a)},clearDragSelection:function(){g(this).deselectAll()},trigger:function(a,b,c,d){this.getEventManager().trigger(a,b,c,d)},doReset:function(){for(var a in this)0===a.indexOf("_katavorio_")&&this[a].reset()},getEventManager:function(){return f(this)},on:function(a,b,c){return this.getEventManager().on.apply(this,arguments),this},off:function(a,b,c){return this.getEventManager().off.apply(this,arguments),this}});var v=function(a){var b=function(){/complete|loaded|interactive/.test(document.readyState)&&"undefined"!=typeof document.body&&null!=document.body?a():setTimeout(b,9)};b()};v(b.init)}.call("undefined"!=typeof window?window:this);\ No newline at end of file+(function(){void 0===Math.sgn&&(Math.sgn=function(t){return 0==t?0:t>0?1:-1});var t=function(t,e){return{x:t.x-e.x,y:t.y-e.y}},e=function(t,e){return t.x*e.x+t.y*e.y},n=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},i=function(t,e){return{x:t.x*e,y:t.y*e}},s=Math.pow(2,-65),o=function(e,i){for(var s=[],o=r(e,i),l=i.length-1,u=a(o,2*l-1,s,0),c=t(e,i[0]),d=n(c),p=0,f=0;f<u;f++){c=t(e,h(i,l,s[f],null,null));var g=n(c);g<d&&(d=g,p=s[f])}return c=t(e,i[l]),(g=n(c))<d&&(d=g,p=1),{location:p,distance:d}},r=function(n,s){for(var o=s.length-1,r=2*o-1,a=[],l=[],u=[],c=[],h=[[1,.6,.3,.1],[.4,.6,.6,.4],[.1,.3,.6,1]],d=0;d<=o;d++)a[d]=t(s[d],n);for(d=0;d<=o-1;d++)l[d]=t(s[d+1],s[d]),l[d]=i(l[d],3);for(var p=0;p<=o-1;p++)for(var f=0;f<=o;f++)u[p]||(u[p]=[]),u[p][f]=e(l[p],a[f]);for(d=0;d<=r;d++)c[d]||(c[d]=[]),c[d].y=0,c[d].x=parseFloat(d)/r;for(var g=o,m=o-1,v=0;v<=g+m;v++){var b=Math.max(0,v-m),y=Math.min(v,g);for(d=b;d<=y;d++){var P=v-d;c[d+P].y+=u[P][d]*h[P][d]}}return c},a=function(t,e,n,i){var s,o,r=[],d=[],p=[],f=[];switch(l(t,e)){case 0:return 0;case 1:if(i>=64)return n[0]=(t[0].x+t[e].x)/2,1;if(u(t,e))return n[0]=c(t,e),1}h(t,e,.5,r,d),s=a(r,e,p,i+1),o=a(d,e,f,i+1);for(var g=0;g<s;g++)n[g]=p[g];for(g=0;g<o;g++)n[g+s]=f[g];return s+o},l=function(t,e){var n,i,s=0;n=i=Math.sgn(t[0].y);for(var o=1;o<=e;o++)(n=Math.sgn(t[o].y))!=i&&s++,i=n;return s},u=function(t,e){var n,i,o,r,a,l,u,c,h;r=t[0].y-t[e].y,a=t[e].x-t[0].x,l=t[0].x*t[e].y-t[e].x*t[0].y,c=h=0;for(var d=1;d<e;d++){var p=r*t[d].x+a*t[d].y+l;p>c?c=p:p<h&&(h=p)}return 0,1,0,n=(1*(l-c)-0*(u=a))*(1/(0*u-1*r)),i=(1*(l-h)-0*(u=a))*(1/(0*u-1*r)),o=Math.min(n,i),Math.max(n,i)-o<s?1:0},c=function(t,e){var n=t[e].x-t[0].x,i=t[e].y-t[0].y,s=t[0].x-0;return 0+1*((n*(t[0].y-0)-i*s)*(1/(0*n-1*i)))},h=function(t,e,n,i,s){for(var o=[[]],r=0;r<=e;r++)o[0][r]=t[r];for(var a=1;a<=e;a++)for(r=0;r<=e-a;r++)o[a]||(o[a]=[]),o[a][r]||(o[a][r]={}),o[a][r].x=(1-n)*o[a-1][r].x+n*o[a-1][r+1].x,o[a][r].y=(1-n)*o[a-1][r].y+n*o[a-1][r+1].y;if(null!=i)for(r=0;r<=e;r++)i[r]=o[r][0];if(null!=s)for(r=0;r<=e;r++)s[r]=o[e-r][r];return o[e][0]},d={},p=function(t,e){for(var n=function(t){var e=d[t];if(!e){var n=function(t){return function(e){return t}},i=function(){return function(t){return t}},s=function(){return function(t){return 1-t}},o=function(t){return function(e){for(var n=1,i=0;i<t.length;i++)n*=t[i](e);return n}};(e=[]).push(new function(){return function(e){return Math.pow(e,t)}});for(var r=1;r<t;r++){for(var a=[new n(t)],l=0;l<t-r;l++)a.push(new i);for(l=0;l<r;l++)a.push(new s);e.push(new o(a))}e.push(new function(){return function(e){return Math.pow(1-e,t)}}),d[t]=e}return e}(t.length-1),i=0,s=0,o=0;o<t.length;o++)i+=t[o].x*n[o](e),s+=t[o].y*n[o](e);return{x:i,y:s}},f=function(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))},g=function(t){return t[0].x===t[1].x&&t[0].y===t[1].y},m=function(t,e,n){if(g(t))return{point:t[0],location:e};for(var i=p(t,e),s=0,o=e,r=n>0?1:-1,a=null;s<Math.abs(n);)a=p(t,o+=.005*r),s+=f(a,i),i=a;return{point:a,location:o}},v=function(t,e){var n=p(t,e),i=p(t.slice(0,t.length-1),e),s=i.y-n.y,o=i.x-n.x;return 0===s?1/0:Math.atan(s/o)},b=function(t,e,n,i,s){var o=i-e,r=t-n,a=t*(e-i)+e*(n-t),l=function(t){return[y(t,"x"),y(t,"y")]}(s),u=[o*l[0][0]+r*l[1][0],o*l[0][1]+r*l[1][1],o*l[0][2]+r*l[1][2],o*l[0][3]+r*l[1][3]+a],c=function(t,e,n,i){var s,o,r=e/t,a=n/t,l=i/t,u=(3*a-Math.pow(r,2))/9,c=(9*r*a-27*l-2*Math.pow(r,3))/54,h=Math.pow(u,3)+Math.pow(c,2),d=[];if(h>=0)s=P(c+Math.sqrt(h))*Math.pow(Math.abs(c+Math.sqrt(h)),1/3),o=P(c-Math.sqrt(h))*Math.pow(Math.abs(c-Math.sqrt(h)),1/3),d[0]=-r/3+(s+o),d[1]=-r/3-(s+o)/2,d[2]=-r/3-(s+o)/2,0!==Math.abs(Math.sqrt(3)*(s-o)/2)&&(d[1]=-1,d[2]=-1);else{var p=Math.acos(c/Math.sqrt(-Math.pow(u,3)));d[0]=2*Math.sqrt(-u)*Math.cos(p/3)-r/3,d[1]=2*Math.sqrt(-u)*Math.cos((p+2*Math.PI)/3)-r/3,d[2]=2*Math.sqrt(-u)*Math.cos((p+4*Math.PI)/3)-r/3}for(var f=0;f<3;f++)(d[f]<0||d[f]>1)&&(d[f]=-1);return d}.apply(null,u),h=[];if(null!=c)for(var d=0;d<3;d++){var p,f=c[d],g=Math.pow(f,2),m=Math.pow(f,3),v=[l[0][0]*m+l[0][1]*g+l[0][2]*f+l[0][3],l[1][0]*m+l[1][1]*g+l[1][2]*f+l[1][3]];p=n-t!=0?(v[0]-t)/(n-t):(v[1]-e)/(i-e),f>=0&&f<=1&&p>=0&&p<=1&&h.push(v)}return h};function y(t,e){return[-t[0][e]+3*t[1][e]+-3*t[2][e]+t[3][e],3*t[0][e]-6*t[1][e]+3*t[2][e],-3*t[0][e]+3*t[1][e],t[0][e]]}function P(t){return t<0?-1:t>0?1:0}var x=this.jsBezier={distanceFromCurve:o,gradientAtPoint:v,gradientAtPointAlongCurveFrom:function(t,e,n){var i=m(t,e,n);return i.location>1&&(i.location=1),i.location<0&&(i.location=0),v(t,i.location)},nearestPointOnCurve:function(t,e){var n=o(t,e);return{point:h(e,e.length-1,n.location,null,null),location:n.location}},pointOnCurve:p,pointAlongCurveFrom:function(t,e,n){return m(t,e,n).point},perpendicularToCurveAt:function(t,e,n,i){var s=m(t,e,i=null==i?0:i),o=v(t,s.location),r=Math.atan(-1/o),a=n/2*Math.sin(r),l=n/2*Math.cos(r);return[{x:s.point.x+l,y:s.point.y+a},{x:s.point.x-l,y:s.point.y-a}]},locationAlongCurveFrom:function(t,e,n){return m(t,e,n).location},getLength:function(t){if(g(t))return 0;for(var e=p(t,0),n=0,i=0,s=null;i<1;)s=p(t,i+=.005),n+=f(s,e),e=s;return n},lineIntersection:b,boxIntersection:function(t,e,n,i,s){var o=[];return o.push.apply(o,b(t,e,t+n,e,s)),o.push.apply(o,b(t+n,e,t+n,e+i,s)),o.push.apply(o,b(t+n,e+i,t,e+i,s)),o.push.apply(o,b(t,e+i,t,e,s)),o},boundingBoxIntersection:function(t,e){var n=[];return n.push.apply(n,b(t.x,t.y,t.x+t.w,t.y,e)),n.push.apply(n,b(t.x+t.w,t.y,t.x+t.w,t.y+t.h,e)),n.push.apply(n,b(t.x+t.w,t.y+t.h,t.x,t.y+t.h,e)),n.push.apply(n,b(t.x,t.y+t.h,t.x,t.y,e)),n},version:"0.9.0"};"undefined"!=typeof exports&&(exports.jsBezier=x)}).call("undefined"!=typeof window?window:this),function(){"use strict";var t=this.Biltong={version:"0.4.0"};"undefined"!=typeof exports&&(exports.Biltong=t);var e=function(t){return"[object Array]"===Object.prototype.toString.call(t)},n=function(t,n,i){return i(t=e(t)?t:[t.x,t.y],n=e(n)?n:[n.x,n.y])},i=t.gradient=function(t,e){return n(t,e,function(t,e){return e[0]==t[0]?e[1]>t[1]?1/0:-1/0:e[1]==t[1]?e[0]>t[0]?0:-0:(e[1]-t[1])/(e[0]-t[0])})},s=(t.normal=function(t,e){return-1/i(t,e)},t.lineLength=function(t,e){return n(t,e,function(t,e){return Math.sqrt(Math.pow(e[1]-t[1],2)+Math.pow(e[0]-t[0],2))})},t.quadrant=function(t,e){return n(t,e,function(t,e){return e[0]>t[0]?e[1]>t[1]?2:1:e[0]==t[0]?e[1]>t[1]?2:1:e[1]>t[1]?3:4})}),o=(t.theta=function(t,e){return n(t,e,function(t,e){var n=i(t,e),o=Math.atan(n),r=s(t,e);return 4!=r&&3!=r||(o+=Math.PI),o<0&&(o+=2*Math.PI),o})},t.intersects=function(t,e){var n=t.x,i=t.x+t.w,s=t.y,o=t.y+t.h,r=e.x,a=e.x+e.w,l=e.y,u=e.y+e.h;return n<=r&&r<=i&&s<=l&&l<=o||n<=a&&a<=i&&s<=l&&l<=o||n<=r&&r<=i&&s<=u&&u<=o||n<=a&&r<=i&&s<=u&&u<=o||r<=n&&n<=a&&l<=s&&s<=u||r<=i&&i<=a&&l<=s&&s<=u||r<=n&&n<=a&&l<=o&&o<=u||r<=i&&n<=a&&l<=o&&o<=u},t.encloses=function(t,e,n){var i=t.x,s=t.x+t.w,o=t.y,r=t.y+t.h,a=e.x,l=e.x+e.w,u=e.y,c=e.y+e.h,h=function(t,e,i,s){return n?t<=e&&i>=s:t<e&&i>s};return h(i,a,s,l)&&h(o,u,r,c)},[null,[1,-1],[1,1],[-1,1],[-1,-1]]),r=[null,[-1,-1],[-1,1],[1,1],[1,-1]];t.pointOnLine=function(t,e,n){var a=i(t,e),l=s(t,e),u=n>0?o[l]:r[l],c=Math.atan(a),h=Math.abs(n*Math.sin(c))*u[1],d=Math.abs(n*Math.cos(c))*u[0];return{x:t.x+d,y:t.y+h}},t.perpendicularLineTo=function(t,e,n){var s=i(t,e),o=Math.atan(-1/s),r=n/2*Math.sin(o),a=n/2*Math.cos(o);return[{x:e.x+a,y:e.y+r},{x:e.x-a,y:e.y-r}]}}.call("undefined"!=typeof window?window:this),function(){"use strict";function t(t,e,n,i,s,o,r,a){return function(){var t=[];return Array.prototype.push.apply(t,arguments),t.item=function(t){return this[t]},t}(function(t,e,n,i,s,o,r,a){return new Touch({target:e,identifier:w(),pageX:n,pageY:i,screenX:s,screenY:o,clientX:r||s,clientY:a||o})}.apply(null,arguments))}var e=function(t,e,n){for(var i=(n=n||t.parentNode).querySelectorAll(e),s=0;s<i.length;s++)if(i[s]===t)return!0;return!1},n=function(t){return"string"==typeof t||t.constructor===String?document.getElementById(t):t},i=function(t){return t.srcElement||t.target},s=function(t,e,n,i){if(i){if(void 0!==t.path&&t.path.indexOf)return{path:t.path,end:t.path.indexOf(n)};var s={path:[],end:-1},o=function(t){s.path.push(t),t===n?s.end=s.path.length-1:null!=t.parentNode&&o(t.parentNode)};return o(e),s}return{path:[e],end:1}},o=function(t,e){for(var n=0,i=t.length;n<i&&t[n]!=e;n++);n<t.length&&t.splice(n,1)},r=1,a=function(t,e,n){var i=r++;return t.__ta=t.__ta||{},t.__ta[e]=t.__ta[e]||{},t.__ta[e][i]=n,n.__tauid=i,i},l=function(t,n,o,r){if(null==t)return o;var a=t.split(","),l=function(r){l.__tauid=o.__tauid;var u=i(r),c=u,h=s(r,u,n,null!=t);if(-1!=h.end)for(var d=0;d<h.end;d++){c=h.path[d];for(var p=0;p<a.length;p++)e(c,a[p],n)&&o.apply(c,arguments)}};return u(o,r,l),l},u=function(t,e,n){t.__taExtra=t.__taExtra||[],t.__taExtra.push([e,n])},c=function(t,e,n,i){if(g&&v[e]){var s=l(i,t,n,v[e]);E(t,v[e],s,n)}"focus"===e&&null==t.getAttribute("tabindex")&&t.setAttribute("tabindex","1"),E(t,e,l(i,t,n,e),n)},h={tap:{touches:1,taps:1},dbltap:{touches:1,taps:2},contextmenu:{touches:2,taps:1}},d=function(t,n){return function(r,a,l,u){if("contextmenu"==a&&m)c(r,a,l,u);else{if(null==r.__taTapHandler){var d=r.__taTapHandler={tap:[],dbltap:[],contextmenu:[],down:!1,taps:0,downSelectors:[]},p=function(){d.down=!1},f=function(){d.taps=0};c(r,"mousedown",function(o){for(var a=i(o),l=s(o,a,r,null!=u),c=!1,h=0;h<l.end;h++){if(c)return;a=l.path[h];for(var g=0;g<d.downSelectors.length;g++)if(null==d.downSelectors[g]||e(a,d.downSelectors[g],r)){d.down=!0,setTimeout(p,t),setTimeout(f,n),c=!0;break}}}),c(r,"mouseup",function(t){if(d.down){var n,o,a=i(t);d.taps++;var l=j(t);for(var u in h)if(h.hasOwnProperty(u)){var c=h[u];if(c.touches===l&&(1===c.taps||c.taps===d.taps))for(var p=0;p<d[u].length;p++){o=s(t,a,r,null!=d[u][p][1]);for(var f=0;f<o.end;f++)if(n=o.path[f],null==d[u][p][1]||e(n,d[u][p][1],r)){d[u][p][0].apply(n,[t]);break}}}}})}r.__taTapHandler.downSelectors.push(u),r.__taTapHandler[a].push([l,u]),l.__taUnstore=function(){o(r.__taTapHandler[a],l)}}}},p=function(t,e,n,i){for(var s in n.__tamee[t])n.__tamee[t].hasOwnProperty(s)&&n.__tamee[t][s].apply(i,[e])},f=function(){var t=[];return function(n,s,o,r){if(!n.__tamee){n.__tamee={over:!1,mouseenter:[],mouseexit:[]};var u=function(s){var o=i(s);(null==r&&o==n&&!n.__tamee.over||e(o,r,n)&&(null==o.__tamee||!o.__tamee.over))&&(p("mouseenter",s,n,o),o.__tamee=o.__tamee||{},o.__tamee.over=!0,t.push(o))},c=function(s){for(var o=i(s),r=0;r<t.length;r++)o!=t[r]||e(s.relatedTarget||s.toElement,"*",o)||(o.__tamee.over=!1,t.splice(r,1),p("mouseexit",s,n,o))};E(n,"mouseover",l(r,n,u,"mouseover"),u),E(n,"mouseout",l(r,n,c,"mouseout"),c)}o.__taUnstore=function(){delete n.__tamee[s][o.__tauid]},a(n,s,o),n.__tamee[s][o.__tauid]=o}},g="ontouchstart"in document.documentElement,m="onmousedown"in document.documentElement,v={mousedown:"touchstart",mouseup:"touchend",mousemove:"touchmove"},b=function(){var t=-1;if("Microsoft Internet Explorer"==navigator.appName){var e=navigator.userAgent;null!=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(e)&&(t=parseFloat(RegExp.$1))}return t}(),y=b>-1&&b<9,P=function(t,e){if(null==t)return[0,0];var n=C(t),i=_(n,0);return[i[e+"X"],i[e+"Y"]]},x=function(t){return null==t?[0,0]:y?[t.clientX+document.documentElement.scrollLeft,t.clientY+document.documentElement.scrollTop]:P(t,"page")},_=function(t,e){return t.item?t.item(e):t[e]},C=function(t){return t.touches&&t.touches.length>0?t.touches:t.changedTouches&&t.changedTouches.length>0?t.changedTouches:t.targetTouches&&t.targetTouches.length>0?t.targetTouches:[t]},j=function(t){return C(t).length},E=function(t,e,n,i){if(a(t,e,n),i.__tauid=n.__tauid,t.addEventListener)t.addEventListener(e,n,!1);else if(t.attachEvent){var s=e+n.__tauid;t["e"+s]=n,t[s]=function(){t["e"+s]&&t["e"+s](window.event)},t.attachEvent("on"+e,t[s])}},S=function(t,e,i){null!=i&&D(t,function(){var s=n(this);if(function(t,e,n){if(t.__ta&&t.__ta[e]&&delete t.__ta[e][n.__tauid],n.__taExtra){for(var i=0;i<n.__taExtra.length;i++)S(t,n.__taExtra[i][0],n.__taExtra[i][1]);n.__taExtra.length=0}n.__taUnstore&&n.__taUnstore()}(s,e,i),null!=i.__tauid)if(s.removeEventListener)s.removeEventListener(e,i,!1),g&&v[e]&&s.removeEventListener(v[e],i,!1);else if(this.detachEvent){var o=e+i.__tauid;s[o]&&s.detachEvent("on"+e,s[o]),s[o]=null,s["e"+o]=null}i.__taTouchProxy&&S(t,i.__taTouchProxy[1],i.__taTouchProxy[0])})},D=function(t,e){if(null!=t){t="undefined"!=typeof Window&&"unknown"!=typeof t.top&&t==t.top?[t]:"string"!=typeof t&&null==t.tagName&&null!=t.length?t:"string"==typeof t?document.querySelectorAll(t):[t];for(var n=0;n<t.length;n++)e.apply(t[n])}},w=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)})};this.Mottle=function(e){var s=(e=e||{}).clickThreshold||250,r=e.dblClickThreshold||450,a=new f,l=new d(s,r),u=e.smartClicks,h=function(t,e,s,r){null!=s&&D(t,function(){var t=n(this);u&&"click"===e?function(t,e,n,s){null==t.__taSmartClicks&&(c(t,"mousedown",function(e){t.__tad=x(e)},s),c(t,"mouseup",function(e){t.__tau=x(e)},s),c(t,"click",function(e){if(t.__tad&&t.__tau&&t.__tad[0]===t.__tau[0]&&t.__tad[1]===t.__tau[1])for(var n=0;n<t.__taSmartClicks.length;n++)t.__taSmartClicks[n].apply(i(e),[e])},s),t.__taSmartClicks=[]);t.__taSmartClicks.push(n),n.__taUnstore=function(){o(t.__taSmartClicks,n)}}(t,0,s,r):"tap"===e||"dbltap"===e||"contextmenu"===e?l(t,e,s,r):"mouseenter"===e||"mouseexit"==e?a(t,e,s,r):c(t,e,s,r)})};this.remove=function(t){return D(t,function(){var t=n(this);if(t.__ta)for(var e in t.__ta)if(t.__ta.hasOwnProperty(e))for(var i in t.__ta[e])t.__ta[e].hasOwnProperty(i)&&S(t,e,t.__ta[e][i]);t.parentNode&&t.parentNode.removeChild(t)}),this},this.on=function(t,e,n,i){var s=arguments[0],o=4==arguments.length?arguments[2]:null,r=arguments[1],a=arguments[arguments.length-1];return h(s,r,a,o),this},this.off=function(t,e,n){return S(t,e,n),this},this.trigger=function(e,i,s,o){var r=m&&("undefined"==typeof MouseEvent||null==s||s.constructor===MouseEvent),a=g&&!m&&v[i]?v[i]:i,l=!(g&&!m&&v[i]),u=x(s),c=P(s,"screen"),h=function(t){return P(t,"client")}(s);return D(e,function(){var e,d=n(this);s=s||{screenX:c[0],screenY:c[1],clientX:h[0],clientY:h[1]};var p=function(t){o&&(t.payload=o)},f={TouchEvent:function(e){var n=t(window,d,0,u[0],u[1],c[0],c[1],h[0],h[1]);(e.initTouchEvent||e.initEvent)(a,!0,!0,window,null,c[0],c[1],h[0],h[1],!1,!1,!1,!1,n,n,n,1,0)},MouseEvents:function(t){t.initMouseEvent(a,!0,!0,window,0,c[0],c[1],h[0],h[1],!1,!1,!1,!1,1,d)}};if(document.createEvent){var m=!l&&!r&&g&&v[i]?"TouchEvent":"MouseEvents";e=document.createEvent(m),f[m](e),p(e),d.dispatchEvent(e)}else document.createEventObject&&((e=document.createEventObject()).eventType=e.eventName=a,e.screenX=c[0],e.screenY=c[1],e.clientX=h[0],e.clientY=h[1],p(e),d.fireEvent("on"+a,e))}),this}},this.Mottle.consume=function(t,e){t.stopPropagation?t.stopPropagation():t.returnValue=!1,!e&&t.preventDefault&&t.preventDefault()},this.Mottle.pageLocation=x,this.Mottle.setForceTouchEvents=function(t){g=t},this.Mottle.setForceMouseEvents=function(t){m=t},this.Mottle.version="0.8.0","undefined"!=typeof exports&&(exports.Mottle=this.Mottle)}.call("undefined"==typeof window?this:window),function(){"use strict";var t=function(t,e,n){return-1===t.indexOf(e)&&(n?t.unshift(e):t.push(e),!0)},e=function(t,e){var n=t.indexOf(e);-1!==n&&t.splice(n,1)},n=function(t){return null!=t&&("string"==typeof t||t.constructor===String)},i=function(t,e,n){for(var i=(n=n||t.parentNode).querySelectorAll(e),s=0;s<i.length;s++)if(i[s]===t)return!0;return!1},s=function(t,e,n){if(i(e,n,t))return e;for(var s=e.parentNode;null!=s&&s!==t;){if(i(s,n,t))return s;s=s.parentNode}},o=function(){var t=-1;if("Microsoft Internet Explorer"===navigator.appName){var e=navigator.userAgent;null!=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(e)&&(t=parseFloat(RegExp.$1))}return t}(),r=o>-1&&o<9,a=9===o,l=function(t){if(r)return[t.clientX+document.documentElement.scrollLeft,t.clientY+document.documentElement.scrollTop];var e=c(t),n=u(e,0);return a?[n.pageX||n.clientX,n.pageY||n.clientY]:[n.pageX,n.pageY]},u=function(t,e){return t.item?t.item(e):t[e]},c=function(t){return t.touches&&t.touches.length>0?t.touches:t.changedTouches&&t.changedTouches.length>0?t.changedTouches:t.targetTouches&&t.targetTouches.length>0?t.targetTouches:[t]},h={delegatedDraggable:"katavorio-delegated-draggable",draggable:"katavorio-draggable",droppable:"katavorio-droppable",drag:"katavorio-drag",selected:"katavorio-drag-selected",active:"katavorio-drag-active",hover:"katavorio-drag-hover",noSelect:"katavorio-drag-no-select",ghostProxy:"katavorio-ghost-proxy",clonedDrag:"katavorio-clone-drag"},d=["stop","start","drag","drop","over","out","beforeStart"],p=function(){},f=function(){return!0},g=function(t,e,n){for(var i=0;i<t.length;i++)t[i]!=n&&e(t[i])},m=function(t,e,n,i){g(t,function(t){t.setActive(e),e&&t.updatePosition(),n&&t.setHover(i,e)})},v=function(t,e){if(null!=t){t=n(t)||null!=t.tagName||null==t.length?[t]:t;for(var i=0;i<t.length;i++)e.apply(t[i],[t[i]])}},b=function(t){t.stopPropagation?(t.stopPropagation(),t.preventDefault()):t.returnValue=!1},y=function(t,e,n,i){this.params=e||{},this.el=t,this.params.addClass(this.el,this._class),this.uuid=j();var s=!0;return this.setEnabled=function(t){s=t},this.isEnabled=function(){return s},this.toggleEnabled=function(){s=!s},this.setScope=function(t){this.scopes=t?t.split(/\s+/):[i]},this.addScope=function(t){var e={};for(var n in v(this.scopes,function(t){e[t]=!0}),v(t?t.split(/\s+/):[],function(t){e[t]=!0}),this.scopes=[],e)this.scopes.push(n)},this.removeScope=function(t){var e={};for(var n in v(this.scopes,function(t){e[t]=!0}),v(t?t.split(/\s+/):[],function(t){delete e[t]}),this.scopes=[],e)this.scopes.push(n)},this.toggleScope=function(t){var e={};for(var n in v(this.scopes,function(t){e[t]=!0}),v(t?t.split(/\s+/):[],function(t){e[t]?delete e[t]:e[t]=!0}),this.scopes=[],e)this.scopes.push(n)},this.setScope(e.scope),this.k=e.katavorio,e.katavorio},P=function(){return!0},x=function(){return!1},_=function(t,e,o,r){this._class=o.draggable;var a=y.apply(this,arguments);this.rightButtonCanDrag=this.params.rightButtonCanDrag;var u,c,d,p,g=[0,0],v=null,_=null,C=[0,0],S=!1,D=[0,0],w=!1!==this.params.consumeStartEvent,I=this.el,A=this.params.clone,k=(this.params.scroll,!1!==e.multipleDrop),M=!1,O=!0===e.ghostProxy?P:e.ghostProxy&&"function"==typeof e.ghostProxy?e.ghostProxy:x,T=null,L=[],F=null,G=e.ghostProxyParent;if(e.selector){var N=t.getAttribute("katavorio-draggable");null==N&&(N=""+(new Date).getTime(),t.setAttribute("katavorio-draggable",N)),L.push(e)}var U,B=e.snapThreshold,R=function(t,e,n,i,s){var o=e*Math.floor(t[0]/e),r=o+e,a=Math.abs(t[0]-o)<=i?o:Math.abs(r-t[0])<=i?r:t[0],l=n*Math.floor(t[1]/n),u=l+n;return[a,Math.abs(t[1]-l)<=s?l:Math.abs(u-t[1])<=s?u:t[1]]};this.posses=[],this.posseRoles={},this.toGrid=function(t){if(null==this.params.grid)return t;var e=this.params.grid?this.params.grid[0]/2:B||5,n=this.params.grid?this.params.grid[1]/2:B||5;return R(t,this.params.grid[0],this.params.grid[1],e,n)},this.snap=function(t,e){if(null!=I){t=t||(this.params.grid?this.params.grid[0]:10),e=e||(this.params.grid?this.params.grid[1]:10);var n=this.params.getPosition(I),i=this.params.grid?this.params.grid[0]/2:B,s=this.params.grid?this.params.grid[1]/2:B,o=R(n,t,e,i,s);return this.params.setPosition(I,o),o}},this.setUseGhostProxy=function(t){O=t?P:x};var H,X=function(t){return!1===e.allowNegative?[Math.max(0,t[0]),Math.max(0,t[1])]:t},Y=function(t){U="function"==typeof t?t:t?function(t,e,n,i){return X([Math.max(0,Math.min(n.w-i[0],t[0])),Math.max(0,Math.min(n.h-i[1],t[1]))])}.bind(this):function(t){return X(t)}}.bind(this);Y("function"==typeof this.params.constrain?this.params.constrain:this.params.constrain||this.params.containment),this.setConstrain=function(t){Y(t)},this.setRevert=function(t){H=t},this.params.revert&&(H=this.params.revert);var W={},z=this.setFilter=function(e,s){if(e){var o="function"==typeof(r=e)?(r._katavorioId=j(),r._katavorioId):r;W[o]=[function(s){var o,r=s.srcElement||s.target;return n(e)?o=i(r,e,t):"function"==typeof e&&(o=e(s,t)),o},!1!==s]}var r};this.addFilter=z,this.removeFilter=function(t){var e="function"==typeof t?t._katavorioId:t;delete W[e]};this.clearAllFilters=function(){W={}},this.canDrag=this.params.canDrag||f;var V,q=[],J=[];this.addSelector=function(t){t.selector&&L.push(t)},this.downListener=function(t){var e,n,r,u,c,d,p,f,m;if(!t.defaultPrevented&&((this.rightButtonCanDrag||3!==t.which&&2!==t.button)&&this.isEnabled()&&this.canDrag()))if(function(t){for(var e in W){var n=W[e],i=n[0](t);if(n[1]&&(i=!i),!i)return!1}return!0}(t)&&function(t,e,n){var s=t.srcElement||t.target;return!i(s,n.getInputFilterSelector(),e)}(t,this.el,this.k)){if(F=null,T=null,L.length>0){var y=function(t,e,n){for(var o=null,r=e.getAttribute("katavorio-draggable"),a=null!=r?"[katavorio-draggable='"+r+"'] ":"",l=0;l<t.length;l++)if(null!=(o=s(e,n,a+t[l].selector))){if(t[l].filter){var u=i(n,t[l].filter,o);if(!0===t[l].filterExclude&&!u||u)return null}return[t[l],o]}return null}(L,this.el,t.target||t.srcElement);if(null!=y&&(F=y[0],T=y[1]),null==T)return}else T=this.el;if(A)if(I=T.cloneNode(!0),this.params.addClass(I,h.clonedDrag),I.setAttribute("id",null),I.style.position="absolute",null!=this.params.parent){var P=this.params.getPosition(this.el);I.style.left=P[0]+"px",I.style.top=P[1]+"px",this.params.parent.appendChild(I)}else{var x=(e=T.getBoundingClientRect(),n=document.body,r=document.documentElement,u=window.pageYOffset||r.scrollTop||n.scrollTop,c=window.pageXOffset||r.scrollLeft||n.scrollLeft,d=r.clientTop||n.clientTop||0,p=r.clientLeft||n.clientLeft||0,f=e.top+u-d,m=e.left+c-p,{top:Math.round(f),left:Math.round(m)});I.style.left=x.left+"px",I.style.top=x.top+"px",document.body.appendChild(I)}else I=T;w&&b(t),g=l(t),I&&I.parentNode&&(D=[I.parentNode.scrollLeft,I.parentNode.scrollTop]),this.params.bind(document,"mousemove",this.moveListener),this.params.bind(document,"mouseup",this.upListener),a.markSelection(this),a.markPosses(this),this.params.addClass(document.body,o.noSelect),$("beforeStart",{el:this.el,pos:v,e:t,drag:this})}else this.params.consumeFilteredEvents&&b(t)}.bind(this),this.moveListener=function(t){if(g){if(!S)if(!1!==$("start",{el:this.el,pos:v,e:t,drag:this})){if(!g)return;this.mark(!0),S=!0}else this.abort();if(g){J.length=0;var e=l(t),n=e[0]-g[0],i=e[1]-g[1],s=this.params.ignoreZoom?1:a.getZoom();I&&I.parentNode&&(n+=I.parentNode.scrollLeft-D[0],i+=I.parentNode.scrollTop-D[1]),n/=s,i/=s,this.moveBy(n,i,t),a.updateSelection(n,i,this),a.updatePosses(n,i,this)}}}.bind(this),this.upListener=function(t){g&&(g=null,this.params.unbind(document,"mousemove",this.moveListener),this.params.unbind(document,"mouseup",this.upListener),this.params.removeClass(document.body,o.noSelect),this.unmark(t),a.unmarkSelection(this,t),a.unmarkPosses(this,t),this.stop(t),a.notifyPosseDragStop(this,t),S=!1,J.length=0,A?(I&&I.parentNode&&I.parentNode.removeChild(I),I=null):H&&!0===H(I,this.params.getPosition(I))&&(this.params.setPosition(I,v),$("revert",I)))}.bind(this),this.getFilters=function(){return W},this.abort=function(){null!=g&&this.upListener()},this.getDragElement=function(t){return t?T||this.el:I||this.el};var Z={start:[],drag:[],stop:[],over:[],out:[],beforeStart:[],revert:[]};e.events.start&&Z.start.push(e.events.start),e.events.beforeStart&&Z.beforeStart.push(e.events.beforeStart),e.events.stop&&Z.stop.push(e.events.stop),e.events.drag&&Z.drag.push(e.events.drag),e.events.revert&&Z.revert.push(e.events.revert),this.on=function(t,e){Z[t]&&Z[t].push(e)},this.off=function(t,e){if(Z[t]){for(var n=[],i=0;i<Z[t].length;i++)Z[t][i]!==e&&n.push(Z[t][i]);Z[t]=n}};var K,$=function(t,e){var n=null;if(F&&F[t])n=F[t](e);else if(Z[t])for(var i=0;i<Z[t].length;i++)try{var s=Z[t][i](e);null!=s&&(n=s)}catch(t){}return n};this.notifyStart=function(t){$("start",{el:this.el,pos:this.params.getPosition(I),e:t,drag:this})},this.stop=function(t,e){if(e||S){var n=[],i=a.getSelection(),s=this.params.getPosition(I);if(i.length>0)for(var o=0;o<i.length;o++){var r=this.params.getPosition(i[o].el);n.push([i[o].el,{left:r[0],top:r[1]},i[o]])}else n.push([I,{left:s[0],top:s[1]},this]);$("stop",{el:I,pos:K||s,finalPos:s,e:t,drag:this,selection:n})}},this.mark=function(t){var e;v=this.params.getPosition(I),_=this.params.getPosition(I,!0),C=[_[0]-v[0],_[1]-v[1]],this.size=this.params.getSize(I),q=a.getMatchingDroppables(this),m(q,!0,!1,this),this.params.addClass(I,this.params.dragClass||o.drag),e=this.params.getConstrainingRectangle?this.params.getConstrainingRectangle(I):this.params.getSize(I.parentNode),V={w:e[0],h:e[1]},d=0,p=0,t&&a.notifySelectionDragStart(this)},this.unmark=function(t,n){if(m(q,!1,!0,this),M&&O(T,I)?(K=[I.offsetLeft-d,I.offsetTop-p],I.parentNode.removeChild(I),I=T):K=null,this.params.removeClass(I,this.params.dragClass||o.drag),q.length=0,M=!1,!n){J.length>0&&K&&e.setPosition(T,K),J.sort(E);for(var i=0;i<J.length;i++){if(!0===J[i].drop(this,t))break}}},this.moveBy=function(t,n,i){J.length=0;var s=this.toGrid([v[0]+t,v[1]+n]),o=U(s,I,V,this.size);if(O(this.el,I))if(s[0]!==o[0]||s[1]!==o[1]){if(!M){var r=T.cloneNode(!0);e.addClass(r,h.ghostProxy),G?(G.appendChild(r),u=e.getPosition(T.parentNode,!0),c=e.getPosition(e.ghostProxyParent,!0),d=u[0]-c[0],p=u[1]-c[1]):T.parentNode.appendChild(r),I=r,M=!0}o=s}else M&&(I.parentNode.removeChild(I),I=T,M=!1,u=null,c=null,d=0,p=0);var a={x:o[0],y:o[1],w:this.size[0],h:this.size[1]},l={x:a.x+C[0],y:a.y+C[1],w:a.w,h:a.h},f=null;this.params.setPosition(I,[o[0]+d,o[1]+p]);for(var g=0;g<q.length;g++){var m={x:q[g].pagePosition[0],y:q[g].pagePosition[1],w:q[g].size[0],h:q[g].size[1]};this.params.intersects(l,m)&&(k||null==f||f===q[g].el)&&q[g].canDrop(this)?(f||(f=q[g].el),J.push(q[g]),q[g].setHover(this,!0,i)):q[g].isHover()&&q[g].setHover(this,!1,i)}$("drag",{el:this.el,pos:o,e:i,drag:this})},this.destroy=function(){this.params.unbind(this.el,"mousedown",this.downListener),this.params.unbind(document,"mousemove",this.moveListener),this.params.unbind(document,"mouseup",this.upListener),this.downListener=null,this.upListener=null,this.moveListener=null},this.params.bind(this.el,"mousedown",this.downListener),this.params.handle?z(this.params.handle,!1):z(this.params.filter,this.params.filterExclude)},C=function(t,e,n,i){this._class=n.droppable,this.params=e||{},this.rank=e.rank||0,this._activeClass=this.params.activeClass||n.active,this._hoverClass=this.params.hoverClass||n.hover,y.apply(this,arguments);var s=!1;this.allowLoopback=!1!==this.params.allowLoopback,this.setActive=function(t){this.params[t?"addClass":"removeClass"](this.el,this._activeClass)},this.updatePosition=function(){this.position=this.params.getPosition(this.el),this.pagePosition=this.params.getPosition(this.el,!0),this.size=this.params.getSize(this.el)},this.canDrop=this.params.canDrop||function(t){return!0},this.isHover=function(){return s},this.setHover=function(t,e,n){(e||null==this.el._katavorioDragHover||this.el._katavorioDragHover===t.el._katavorio)&&(this.params[e?"addClass":"removeClass"](this.el,this._hoverClass),this.el._katavorioDragHover=e?t.el._katavorio:null,s!==e&&this.params.events[e?"over":"out"]({el:this.el,e:n,drag:t,drop:this}),s=e)},this.drop=function(t,e){return this.params.events.drop({drag:t,e:e,drop:this})},this.destroy=function(){this._class=null,this._activeClass=null,this._hoverClass=null,s=null}},j=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})},E=function(t,e){return t.rank<e.rank?1:t.rank>e.rank?-1:0},S=function(t){return null==t?null:null==(t="string"==typeof t||t.constructor===String?document.getElementById(t):t)?null:(t._katavorio=t._katavorio||j(),t)};this.Katavorio=function(i){var s=[],o={};this._dragsByScope={},this._dropsByScope={};var r=1,a=function(t,e){v(t,function(t){for(var n=0;n<t.scopes.length;n++)e[t.scopes[n]]=e[t.scopes[n]]||[],e[t.scopes[n]].push(t)})},l=function(t,e){var n=0;return v(t,function(t){for(var s=0;s<t.scopes.length;s++)if(e[t.scopes[s]]){var o=i.indexOf(e[t.scopes[s]],t);-1!==o&&(e[t.scopes[s]].splice(o,1),n++)}}),n>0},u=(this.getMatchingDroppables=function(t){for(var e=[],n={},i=0;i<t.scopes.length;i++){var s=this._dropsByScope[t.scopes[i]];if(s)for(var o=0;o<s.length;o++)!s[o].canDrop(t)||n[s[o].uuid]||!s[o].allowLoopback&&s[o].el===t.el||(n[s[o].uuid]=!0,e.push(s[o]))}return e.sort(E),e},function(t){t=t||{};var e,n={events:{}};for(e in i)n[e]=i[e];for(e in t)n[e]=t[e];for(e=0;e<d.length;e++)n.events[d[e]]=t[d[e]]||p;return n.katavorio=this,n}.bind(this)),c=function(t,e){for(var n=0;n<d.length;n++)e[d[n]]&&t.on(d[n],e[d[n]])}.bind(this),f={},m=i.css||{},b=i.scope||"katavorio-drag-scope";for(var y in h)f[y]=h[y];for(var y in m)f[y]=m[y];var P=i.inputFilterSelector||"input,textarea,select,button,option";this.getInputFilterSelector=function(){return P},this.setInputFilterSelector=function(t){return P=t,this},this.draggable=function(t,e){var n=[];return v(t,function(t){if(null!=(t=S(t)))if(null==t._katavorioDrag){var s=u(e);t._katavorioDrag=new _(t,s,f,b),a(t._katavorioDrag,this._dragsByScope),n.push(t._katavorioDrag),i.addClass(t,s.selector?f.delegatedDraggable:f.draggable)}else c(t._katavorioDrag,e)}.bind(this)),n},this.droppable=function(t,e){var n=[];return v(t,function(t){if(null!=(t=S(t))){var s=new C(t,u(e),f,b);t._katavorioDrop=t._katavorioDrop||[],t._katavorioDrop.push(s),a(s,this._dropsByScope),n.push(s),i.addClass(t,f.droppable)}}.bind(this)),n},this.select=function(t){return v(t,function(){var t=S(this);t&&t._katavorioDrag&&(o[t._katavorio]||(s.push(t._katavorioDrag),o[t._katavorio]=[t,s.length-1],i.addClass(t,f.selected)))}),this},this.deselect=function(t){return v(t,function(){var t=S(this);if(t&&t._katavorio&&o[t._katavorio]){for(var e=[],n=0;n<s.length;n++)s[n].el!==t&&e.push(s[n]);s=e,delete o[t._katavorio],i.removeClass(t,f.selected)}}),this},this.deselectAll=function(){for(var t in o){var e=o[t];i.removeClass(e[0],f.selected)}s.length=0,o={}},this.markSelection=function(t){g(s,function(t){t.mark()},t)},this.markPosses=function(t){t.posses&&v(t.posses,function(e){t.posseRoles[e]&&I[e]&&g(I[e].members,function(t){t.mark()},t)})},this.unmarkSelection=function(t,e){g(s,function(t){t.unmark(e)},t)},this.unmarkPosses=function(t,e){t.posses&&v(t.posses,function(n){t.posseRoles[n]&&I[n]&&g(I[n].members,function(t){t.unmark(e,!0)},t)})},this.getSelection=function(){return s.slice(0)},this.updateSelection=function(t,e,n){g(s,function(n){n.moveBy(t,e)},n)};var x=function(t,e){e.posses&&v(e.posses,function(n){e.posseRoles[n]&&I[n]&&g(I[n].members,function(e){t(e)},e)})};this.updatePosses=function(t,e,n){x(function(n){n.moveBy(t,e)},n)},this.notifyPosseDragStop=function(t,e){x(function(t){t.stop(e,!0)},t)},this.notifySelectionDragStop=function(t,e){g(s,function(t){t.stop(e,!0)},t)},this.notifySelectionDragStart=function(t,e){g(s,function(t){t.notifyStart(e)},t)},this.setZoom=function(t){r=t},this.getZoom=function(){return r};var j=function(t,e,n,i){v(t,function(t){l(t,n),t[i](e),a(t,n)})};v(["set","add","remove","toggle"],function(t){this[t+"Scope"]=function(e,n){j(e._katavorioDrag,n,this._dragsByScope,t+"Scope"),j(e._katavorioDrop,n,this._dropsByScope,t+"Scope")}.bind(this),this[t+"DragScope"]=function(e,n){j(e.constructor===_?e:e._katavorioDrag,n,this._dragsByScope,t+"Scope")}.bind(this),this[t+"DropScope"]=function(e,n){j(e.constructor===C?e:e._katavorioDrop,n,this._dropsByScope,t+"Scope")}.bind(this)}.bind(this)),this.snapToGrid=function(t,e){for(var n in this._dragsByScope)g(this._dragsByScope[n],function(n){n.snap(t,e)})},this.getDragsForScope=function(t){return this._dragsByScope[t]},this.getDropsForScope=function(t){return this._dropsByScope[t]};var D=function(t,e,n){if((t=S(t))[e]){var i=s.indexOf(t[e]);i>=0&&s.splice(i,1),l(t[e],n)&&v(t[e],function(t){t.destroy()}),delete t[e]}},w=function(t,e,n,i){(t=S(t))[e]&&t[e].off(n,i)};this.elementRemoved=function(t){this.destroyDraggable(t),this.destroyDroppable(t)},this.destroyDraggable=function(t,e,n){1===arguments.length?D(t,"_katavorioDrag",this._dragsByScope):w(t,"_katavorioDrag",e,n)},this.destroyDroppable=function(t,e,n){1===arguments.length?D(t,"_katavorioDrop",this._dropsByScope):w(t,"_katavorioDrop",e,n)},this.reset=function(){this._dragsByScope={},this._dropsByScope={},s=[],o={},I={}};var I={},A=function(e,i,s){var o,r=n(i)?i:i.id,a=!!n(i)||!1!==i.active,l=I[r]||(o={name:r,members:[]},I[r]=o,o);return v(e,function(e){if(e._katavorioDrag){if(s&&null!=e._katavorioDrag.posseRoles[l.name])return;t(l.members,e._katavorioDrag),t(e._katavorioDrag.posses,l.name),e._katavorioDrag.posseRoles[l.name]=a}}),l};this.addToPosse=function(t,e){for(var n=[],i=1;i<arguments.length;i++)n.push(A(t,arguments[i]));return 1===n.length?n[0]:n},this.setPosse=function(t,e){for(var n=[],i=1;i<arguments.length;i++)n.push(A(t,arguments[i],!0).name);return v(t,function(t){if(t._katavorioDrag){var e=function(t,e){for(var n=[],i=0;i<t.length;i++)-1===e.indexOf(t[i])&&n.push(t[i]);return n}(t._katavorioDrag.posses,n);Array.prototype.push.apply([],t._katavorioDrag.posses);for(var i=0;i<e.length;i++)this.removeFromPosse(t,e[i])}}.bind(this)),1===n.length?n[0]:n},this.removeFromPosse=function(t,n){if(arguments.length<2)throw new TypeError("No posse id provided for remove operation");for(var i=1;i<arguments.length;i++)n=arguments[i],v(t,function(t){if(t._katavorioDrag&&t._katavorioDrag.posses){var i=t._katavorioDrag;v(n,function(t){e(I[t].members,i),e(i.posses,t),delete i.posseRoles[t]})}})},this.removeFromAllPosses=function(t){v(t,function(t){if(t._katavorioDrag&&t._katavorioDrag.posses){var n=t._katavorioDrag;v(n.posses,function(t){e(I[t].members,n)}),n.posses.length=0,n.posseRoles={}}})},this.setPosseState=function(t,e,n){var i=I[e];i&&v(t,function(t){t._katavorioDrag&&t._katavorioDrag.posses&&(t._katavorioDrag.posseRoles[i.name]=n)})}},this.Katavorio.version="1.0.0","undefined"!=typeof exports&&(exports.Katavorio=this.Katavorio)}.call("undefined"!=typeof window?window:this),function(){this.jsPlumbUtil=this.jsPlumbUtil||{};var t=this.jsPlumbUtil;function e(t){return"[object Array]"===Object.prototype.toString.call(t)}function n(t){return"string"==typeof t}function i(t){return"boolean"==typeof t}function s(t){return null!=t&&"[object Object]"===Object.prototype.toString.call(t)}function o(t){return"[object Date]"===Object.prototype.toString.call(t)}function r(t){return"[object Function]"===Object.prototype.toString.call(t)}function a(t){if(n(t))return""+t;if(i(t))return!!t;if(o(t))return new Date(t.getTime());if(r(t))return t;if(e(t)){for(var l=[],u=0;u<t.length;u++)l.push(a(t[u]));return l}if(s(t)){var c={};for(var h in t)c[h]=a(t[h]);return c}return t}function l(t,o,r,l){var u,c,h={},d={};for(r=r||[],l=l||[],c=0;c<r.length;c++)h[r[c]]=!0;for(c=0;c<l.length;c++)d[l[c]]=!0;var p=a(t);for(c in o)if(null==p[c]||d[c])p[c]=o[c];else if(n(o[c])||i(o[c]))h[c]?((u=[]).push.apply(u,e(p[c])?p[c]:[p[c]]),u.push.apply(u,i(o[c])?o[c]:[o[c]]),p[c]=u):p[c]=o[c];else if(e(o[c]))u=[],e(p[c])&&u.push.apply(u,p[c]),u.push.apply(u,o[c]),p[c]=u;else if(s(o[c]))for(var f in s(p[c])||(p[c]={}),o[c])p[c][f]=o[c][f];return p}function u(t,e){if(t)for(var n=0;n<t.length;n++)if(e(t[n]))return n;return-1}function c(t,e){var n=t.indexOf(e);return n>-1&&t.splice(n,1),-1!==n}function h(t,e,n,i){var s=t[e];return null==s&&(s=[],t[e]=s),s[i?"unshift":"push"](n),s}function d(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})}function p(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(t.logEnabled&&"undefined"!=typeof console)try{var i=arguments[arguments.length-1];console.log(i)}catch(t){}}"undefined"!=typeof exports&&(exports.jsPlumbUtil=t),t.isArray=e,t.isNumber=function(t){return"[object Number]"===Object.prototype.toString.call(t)},t.isString=n,t.isBoolean=i,t.isNull=function(t){return null==t},t.isObject=s,t.isDate=o,t.isFunction=r,t.isNamedFunction=function(t){return r(t)&&null!=t.name&&t.name.length>0},t.isEmpty=function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0},t.clone=a,t.merge=l,t.replace=function(t,e,n){if(null!=t){var i=t;return e.replace(/([^\.])+/g,function(t,e,s,o){var r=t.match(/([^\[0-9]+){1}(\[)([0-9+])/),a=function(){return i[r[1]]||(i[r[1]]=[],i[r[1]])};if(s+t.length>=o.length)r?a()[r[3]]=n:i[t]=n;else if(r){var l=a();i=l[r[3]]||(l[r[3]]={},l[r[3]])}else i=i[t]||(i[t]={},i[t]);return""}),t}},t.functionChain=function(t,e,n){for(var i=0;i<n.length;i++){var s=n[i][0][n[i][1]].apply(n[i][0],n[i][2]);if(s===e)return s}return t},t.populate=function(t,i,o,a){var l=function(t){if(null!=t){if(n(t))return function(t){var e=t.match(/(\${.*?})/g);if(null!=e)for(var n=0;n<e.length;n++){var s=i[e[n].substring(2,e[n].length-1)]||"";null!=s&&(t=t.replace(e[n],s))}return t}(t);if(!r(t)||a||null!=o&&0!==(t.name||"").indexOf(o)){if(e(t)){for(var u=[],c=0;c<t.length;c++)u.push(l(t[c]));return u}if(s(t)){var h={};for(var d in t)h[d]=l(t[d]);return h}return t}return t(i)}};return l(t)},t.findWithFunction=u,t.removeWithFunction=function(t,e){var n=u(t,e);return n>-1&&t.splice(n,1),-1!==n},t.remove=c,t.addWithFunction=function(t,e,n){-1===u(t,n)&&t.push(e)},t.addToList=h,t.suggest=function(t,e,n){return-1===t.indexOf(e)&&(n?t.unshift(e):t.push(e),!0)},t.extend=function(t,n,i){var s;n=e(n)?n:[n];var o=function(e){for(var n=e.__proto__;null!=n;)if(null!=n.prototype){for(var i in n.prototype)n.prototype.hasOwnProperty(i)&&!t.prototype.hasOwnProperty(i)&&(t.prototype[i]=n.prototype[i]);n=n.prototype.__proto__}else n=null};for(s=0;s<n.length;s++){for(var r in n[s].prototype)n[s].prototype.hasOwnProperty(r)&&!t.prototype.hasOwnProperty(r)&&(t.prototype[r]=n[s].prototype[r]);o(n[s])}var a=function(t,e){return function(){for(s=0;s<n.length;s++)n[s].prototype[t]&&n[s].prototype[t].apply(this,arguments);return e.apply(this,arguments)}},l=function(e){for(var n in e)t.prototype[n]=a(n,e[n])};if(arguments.length>2)for(s=2;s<arguments.length;s++)l(arguments[s]);return t},t.uuid=d,t.fastTrim=function(t){if(null==t)return null;for(var e=t.replace(/^\s\s*/,""),n=/\s/,i=e.length;n.test(e.charAt(--i)););return e.slice(0,i+1)},t.each=function(t,e){t=null==t.length||"string"==typeof t?[t]:t;for(var n=0;n<t.length;n++)e(t[n])},t.map=function(t,e){for(var n=[],i=0;i<t.length;i++)n.push(e(t[i]));return n},t.mergeWithParents=function(t,e,n){n=n||"parent";var i=function(t){return t?e[t]:null},s=function(t){return t?i(t[n]):null},o=function(t,e){if(null==t)return e;var n=["anchor","anchors","cssClass","connector","paintStyle","hoverPaintStyle","endpoint","endpoints"];"override"===e.mergeStrategy&&Array.prototype.push.apply(n,["events","overlays"]);var i=l(t,e,[],n);return o(s(t),i)},r=function(t){if(null==t)return{};if("string"==typeof t)return i(t);if(t.length){for(var e=!1,n=0,s=void 0;!e&&n<t.length;)(s=r(t[n]))?e=!0:n++;return s}},a=r(t);return a?o(s(a),a):{}},t.logEnabled=!0,t.log=p,t.wrap=function(t,e,n){return function(){var i=null;try{null!=e&&(i=e.apply(this,arguments))}catch(t){p("jsPlumb function failed : "+t)}if(null!=t&&(null==n||i!==n))try{i=t.apply(this,arguments)}catch(t){p("wrapped function failed : "+t)}return i}};var f=function(){return function(){var t=this;this._listeners={},this.eventsSuspended=!1,this.tick=!1,this.eventsToDieOn={ready:!0},this.queue=[],this.bind=function(e,n,i){var s=function(e){h(t._listeners,e,n,i),n.__jsPlumb=n.__jsPlumb||{},n.__jsPlumb[d()]=e};if("string"==typeof e)s(e);else if(null!=e.length)for(var o=0;o<e.length;o++)s(e[o]);return t},this.fire=function(t,e,n){if(this.tick)this.queue.unshift(arguments);else{if(this.tick=!0,!this.eventsSuspended&&this._listeners[t]){var i=this._listeners[t].length,s=0,o=!1,r=null;if(!this.shouldFireEvent||this.shouldFireEvent(t,e,n))for(;!o&&s<i&&!1!==r;){if(this.eventsToDieOn[t])this._listeners[t][s].apply(this,[e,n]);else try{r=this._listeners[t][s].apply(this,[e,n])}catch(e){p("jsPlumb: fire failed for event "+t+" : "+e)}s++,null!=this._listeners&&null!=this._listeners[t]||(o=!0)}}this.tick=!1,this._drain()}return this},this._drain=function(){var e=t.queue.pop();e&&t.fire.apply(t,e)},this.unbind=function(t,e){if(0===arguments.length)this._listeners={};else if(1===arguments.length){if("string"==typeof t)delete this._listeners[t];else if(t.__jsPlumb){var n=void 0;for(var i in t.__jsPlumb)n=t.__jsPlumb[i],c(this._listeners[n]||[],t)}}else 2===arguments.length&&c(this._listeners[t]||[],e);return this},this.getListener=function(e){return t._listeners[e]},this.setSuspendEvents=function(e){t.eventsSuspended=e},this.isSuspendEvents=function(){return t.eventsSuspended},this.silently=function(e){t.setSuspendEvents(!0);try{e()}catch(t){p("Cannot execute silent function "+t)}t.setSuspendEvents(!1)},this.cleanupListeners=function(){for(var e in t._listeners)t._listeners[e]=null}}}();t.EventGenerator=f}.call("undefined"!=typeof window?window:this),function(){"use strict";this.jsPlumbUtil.matchesSelector=function(t,e,n){for(var i=(n=n||t.parentNode).querySelectorAll(e),s=0;s<i.length;s++)if(i[s]===t)return!0;return!1},this.jsPlumbUtil.consume=function(t,e){t.stopPropagation?t.stopPropagation():t.returnValue=!1,!e&&t.preventDefault&&t.preventDefault()},this.jsPlumbUtil.sizeElement=function(t,e,n,i,s){t&&(t.style.height=s+"px",t.height=s,t.style.width=i+"px",t.width=i,t.style.left=e+"px",t.style.top=n+"px")}}.call("undefined"!=typeof window?window:this),function(){var t={deriveAnchor:function(t,e,n,i){return{top:["TopRight","TopLeft"],bottom:["BottomRight","BottomLeft"]}[t][e]}},e=function(t){this.count=0,this.instance=t,this.lists={},this.instance.addList=function(t,e){return this.listManager.addList(t,e)},this.instance.removeList=function(t){this.listManager.removeList(t)},this.instance.bind("manageElement",function(t){for(var e=this.instance.getSelector(t.el,"[jtk-scrollable-list]"),n=0;n<e.length;n++)this.addList(e[n])}.bind(this)),this.instance.bind("unmanageElement",function(t){this.removeList(t.el)}),this.instance.bind("connection",function(t,e){null==e&&(this._maybeUpdateParentList(t.source),this._maybeUpdateParentList(t.target))}.bind(this))};this.jsPlumbListManager=e,e.prototype={addList:function(e,i){var s=this.instance.extend({},t);i=this.instance.extend(s,i||{});var o=[this.instance.getInstanceIndex(),this.count++].join("_");this.lists[o]=new n(this.instance,e,i,o)},removeList:function(t){var e=this.lists[t._jsPlumbList];e&&(e.destroy(),delete this.lists[t._jsPlumbList])},_maybeUpdateParentList:function(t){for(var e=t.parentNode,n=this.instance.getContainer();null!=e&&e!==n;){if(null!=e._jsPlumbList&&null!=this.lists[e._jsPlumbList])return void e._jsPlumbScrollHandler();e=e.parentNode}}};var n=function(t,e,n,i){function s(t,e,i,s){return n.anchor?n.anchor:n.deriveAnchor(t,e,i,s)}function o(t,e,i,s){return n.deriveEndpoint?n.deriveEndpoint(t,e,i,s):n.endpoint?n.endpoint:i.type}e._jsPlumbList=i;var r=function(n){for(var i=t.getSelector(e,".jtk-managed"),r=t.getId(e),a=0;a<i.length;a++){if(i[a].offsetTop<e.scrollTop)i[a]._jsPlumbProxies||(i[a]._jsPlumbProxies=i[a]._jsPlumbProxies||[],t.select({source:i[a]}).each(function(n){t.proxyConnection(n,0,e,r,function(){return o("top",0,n.endpoints[0],n)},function(){return s("top",0,n.endpoints[0],n)}),i[a]._jsPlumbProxies.push([n,0])}),t.select({target:i[a]}).each(function(n){t.proxyConnection(n,1,e,r,function(){return o("top",1,n.endpoints[1],n)},function(){return s("top",1,n.endpoints[1],n)}),i[a]._jsPlumbProxies.push([n,1])}));else if(i[a].offsetTop>e.scrollTop+e.offsetHeight)i[a]._jsPlumbProxies||(i[a]._jsPlumbProxies=i[a]._jsPlumbProxies||[],t.select({source:i[a]}).each(function(n){t.proxyConnection(n,0,e,r,function(){return o("bottom",0,n.endpoints[0],n)},function(){return s("bottom",0,n.endpoints[0],n)}),i[a]._jsPlumbProxies.push([n,0])}),t.select({target:i[a]}).each(function(n){t.proxyConnection(n,1,e,r,function(){return o("bottom",1,n.endpoints[1],n)},function(){return s("bottom",1,n.endpoints[1],n)}),i[a]._jsPlumbProxies.push([n,1])}));else if(i[a]._jsPlumbProxies){for(var l=0;l<i[a]._jsPlumbProxies.length;l++)t.unproxyConnection(i[a]._jsPlumbProxies[l][0],i[a]._jsPlumbProxies[l][1],r);delete i[a]._jsPlumbProxies}t.revalidate(i[a])}!function(e){for(var n=e.parentNode,i=t.getContainer();null!=n&&n!==i;){if(t.hasClass(n,"jtk-managed"))return void t.recalculateOffsets(n);n=n.parentNode}}(e)};t.setAttribute(e,"jtk-scrollable-list","true"),e._jsPlumbScrollHandler=r,t.on(e,"scroll",r),r(),this.destroy=function(){t.off(e,"scroll",r),delete e._jsPlumbScrollHandler;for(var n=t.getSelector(e,".jtk-managed"),i=t.getId(e),s=0;s<n.length;s++)if(n[s]._jsPlumbProxies){for(var o=0;o<n[s]._jsPlumbProxies.length;o++)t.unproxyConnection(n[s]._jsPlumbProxies[o][0],n[s]._jsPlumbProxies[o][1],i);delete n[s]._jsPlumbProxies}}}}.call("undefined"!=typeof window?window:this),function(){"use strict";var t=this,e=t.jsPlumbUtil,n=function(){return""+(new Date).getTime()},i=function(t){if(t._jsPlumb.paintStyle&&t._jsPlumb.hoverPaintStyle){var e={};d.extend(e,t._jsPlumb.paintStyle),d.extend(e,t._jsPlumb.hoverPaintStyle),delete t._jsPlumb.hoverPaintStyle,e.gradient&&t._jsPlumb.paintStyle.fill&&delete e.gradient,t._jsPlumb.hoverPaintStyle=e}},s=["tap","dbltap","click","dblclick","mouseover","mouseout","mousemove","mousedown","mouseup","contextmenu"],o=function(t){return null==t?null:t.split(" ")},r=function(t,e,n){for(var i in e)t[i]=n},a=function(t,n,i){if(t.getDefaultType){var s=t.getTypeDescriptor(),o={},a=t.getDefaultType(),l=e.merge({},a);r(o,a,"__default");for(var u=0,c=t._jsPlumb.types.length;u<c;u++){var h=t._jsPlumb.types[u];if("__default"!==h){var d=t._jsPlumb.instance.getType(h,s);if(null!=d){var p=["anchor","anchors","connector","paintStyle","hoverPaintStyle","endpoint","endpoints","connectorOverlays","connectorStyle","connectorHoverStyle","endpointStyle","endpointHoverStyle"],f=[];"override"===d.mergeStrategy?Array.prototype.push.apply(p,["events","overlays","cssClass"]):f.push("cssClass"),l=e.merge(l,d,f,p),r(o,d,h)}}}n&&(l=e.populate(l,n,"_")),t.applyType(l,i,o),i||t.repaint()}},l=t.jsPlumbUIComponent=function(t){e.EventGenerator.apply(this,arguments);var n=arguments,i=this.idPrefix+(new Date).getTime();this._jsPlumb={instance:t._jsPlumb,parameters:t.parameters||{},paintStyle:null,hoverPaintStyle:null,paintStyleInUse:null,hover:!1,beforeDetach:t.beforeDetach,beforeDrop:t.beforeDrop,overlayPlacements:[],hoverClass:t.hoverClass||t._jsPlumb.Defaults.HoverClass,types:[],typeCache:{}},this.cacheTypeItem=function(t,e,n){this._jsPlumb.typeCache[n]=this._jsPlumb.typeCache[n]||{},this._jsPlumb.typeCache[n][t]=e},this.getCachedTypeItem=function(t,e){return this._jsPlumb.typeCache[e]?this._jsPlumb.typeCache[e][t]:null},this.getId=function(){return i};var s=t.overlays||[],o={};if(this.defaultOverlayKeys){for(var r=0;r<this.defaultOverlayKeys.length;r++)Array.prototype.push.apply(s,this._jsPlumb.instance.Defaults[this.defaultOverlayKeys[r]]||[]);for(r=0;r<s.length;r++){var a=d.convertToFullOverlaySpec(s[r]);o[a[1].id]=a}}var l={overlays:o,parameters:t.parameters||{},scope:t.scope||this._jsPlumb.instance.getDefaultScope()};if(this.getDefaultType=function(){return l},this.appendToDefaultType=function(t){for(var e in t)l[e]=t[e]},t.events)for(var u in t.events)this.bind(u,t.events[u]);this.clone=function(){var t=Object.create(this.constructor.prototype);return this.constructor.apply(t,n),t}.bind(this),this.isDetachAllowed=function(t){var n=!0;if(this._jsPlumb.beforeDetach)try{n=this._jsPlumb.beforeDetach(t)}catch(t){e.log("jsPlumb: beforeDetach callback failed",t)}return n},this.isDropAllowed=function(t,n,i,s,o,r,a){var l=this._jsPlumb.instance.checkCondition("beforeDrop",{sourceId:t,targetId:n,scope:i,connection:s,dropEndpoint:o,source:r,target:a});if(this._jsPlumb.beforeDrop)try{l=this._jsPlumb.beforeDrop({sourceId:t,targetId:n,scope:i,connection:s,dropEndpoint:o,source:r,target:a})}catch(t){e.log("jsPlumb: beforeDrop callback failed",t)}return l};var c=[];this.setListenerComponent=function(t){for(var e=0;e<c.length;e++)c[e][3]=t}},u=function(t,e){var n=t._jsPlumb.types[e],i=t._jsPlumb.instance.getType(n,t.getTypeDescriptor());null!=i&&i.cssClass&&t.canvas&&t._jsPlumb.instance.removeClass(t.canvas,i.cssClass)};e.extend(t.jsPlumbUIComponent,e.EventGenerator,{getParameter:function(t){return this._jsPlumb.parameters[t]},setParameter:function(t,e){this._jsPlumb.parameters[t]=e},getParameters:function(){return this._jsPlumb.parameters},setParameters:function(t){this._jsPlumb.parameters=t},getClass:function(){return d.getClass(this.canvas)},hasClass:function(t){return d.hasClass(this.canvas,t)},addClass:function(t){d.addClass(this.canvas,t)},removeClass:function(t){d.removeClass(this.canvas,t)},updateClasses:function(t,e){d.updateClasses(this.canvas,t,e)},setType:function(t,e,n){this.clearTypes(),this._jsPlumb.types=o(t)||[],a(this,e,n)},getType:function(){return this._jsPlumb.types},reapplyTypes:function(t,e){a(this,t,e)},hasType:function(t){return-1!==this._jsPlumb.types.indexOf(t)},addType:function(t,e,n){var i=o(t),s=!1;if(null!=i){for(var r=0,l=i.length;r<l;r++)this.hasType(i[r])||(this._jsPlumb.types.push(i[r]),s=!0);s&&a(this,e,n)}},removeType:function(t,e,n){var i=o(t),s=!1,r=function(t){var e=this._jsPlumb.types.indexOf(t);return-1!==e&&(u(this,e),this._jsPlumb.types.splice(e,1),!0)}.bind(this);if(null!=i){for(var l=0,c=i.length;l<c;l++)s=r(i[l])||s;s&&a(this,e,n)}},clearTypes:function(t,e){for(var n=this._jsPlumb.types.length,i=0;i<n;i++)u(this,0),this._jsPlumb.types.splice(0,1);a(this,t,e)},toggleType:function(t,e,n){var i=o(t);if(null!=i){for(var s=0,r=i.length;s<r;s++){var l=this._jsPlumb.types.indexOf(i[s]);-1!==l?(u(this,l),this._jsPlumb.types.splice(l,1)):this._jsPlumb.types.push(i[s])}a(this,e,n)}},applyType:function(t,e){if(this.setPaintStyle(t.paintStyle,e),this.setHoverPaintStyle(t.hoverPaintStyle,e),t.parameters)for(var n in t.parameters)this.setParameter(n,t.parameters[n]);this._jsPlumb.paintStyleInUse=this.getPaintStyle()},setPaintStyle:function(t,e){this._jsPlumb.paintStyle=t,this._jsPlumb.paintStyleInUse=this._jsPlumb.paintStyle,i(this),e||this.repaint()},getPaintStyle:function(){return this._jsPlumb.paintStyle},setHoverPaintStyle:function(t,e){this._jsPlumb.hoverPaintStyle=t,i(this),e||this.repaint()},getHoverPaintStyle:function(){return this._jsPlumb.hoverPaintStyle},destroy:function(t){(t||null==this.typeId)&&(this.cleanupListeners(),this.clone=null,this._jsPlumb=null)},isHover:function(){return this._jsPlumb.hover},setHover:function(t,e,i){if(this._jsPlumb&&!this._jsPlumb.instance.currentlyDragging&&!this._jsPlumb.instance.isHoverSuspended()){this._jsPlumb.hover=t;var s=t?"addClass":"removeClass";null!=this.canvas&&(null!=this._jsPlumb.instance.hoverClass&&this._jsPlumb.instance[s](this.canvas,this._jsPlumb.instance.hoverClass),null!=this._jsPlumb.hoverClass&&this._jsPlumb.instance[s](this.canvas,this._jsPlumb.hoverClass)),null!=this._jsPlumb.hoverPaintStyle&&(this._jsPlumb.paintStyleInUse=t?this._jsPlumb.hoverPaintStyle:this._jsPlumb.paintStyle,this._jsPlumb.instance.isSuspendDrawing()||(i=i||n(),this.repaint({timestamp:i,recalc:!1}))),this.getAttachedElements&&!e&&function(t,e,n,i){var s=t.getAttachedElements();if(s)for(var o=0,r=s.length;o<r;o++)i&&i===s[o]||s[o].setHover(e,!0,n)}(this,t,n(),this)}}});var c=0,h=t.jsPlumbInstance=function(i){this.version="2.12.9",this.Defaults={Anchor:"Bottom",Anchors:[null,null],ConnectionsDetachable:!0,ConnectionOverlays:[],Connector:"Bezier",Container:null,DoNotThrowErrors:!1,DragOptions:{},DropOptions:{},Endpoint:"Dot",EndpointOverlays:[],Endpoints:[null,null],EndpointStyle:{fill:"#456"},EndpointStyles:[null,null],EndpointHoverStyle:null,EndpointHoverStyles:[null,null],HoverPaintStyle:null,LabelStyle:{color:"black"},LogEnabled:!1,Overlays:[],MaxConnections:1,PaintStyle:{"stroke-width":4,stroke:"#456"},ReattachConnections:!1,RenderMode:"svg",Scope:"jsPlumb_DefaultScope"},i&&d.extend(this.Defaults,i),this.logEnabled=this.Defaults.LogEnabled,this._connectionTypes={},this._endpointTypes={},e.EventGenerator.apply(this);var o=this,r=function(){var t=c+1;return c++,t}(),a=o.bind,u={},h=1,p=function(t){if(null==t)return null;if(3===t.nodeType||8===t.nodeType)return{el:t,text:!0};var n=o.getElement(t);return{el:n,id:e.isString(t)&&null==n?t:R(n)}};for(var f in this.getInstanceIndex=function(){return r},this.setZoom=function(t,e){return h=t,o.fire("zoom",h),e&&o.repaintEverything(),!0},this.getZoom=function(){return h},this.Defaults)u[f]=this.Defaults[f];var g,m=[];this.unbindContainer=function(){if(null!=g&&m.length>0)for(var t=0;t<m.length;t++)o.off(g,m[t][0],m[t][1])},this.setContainer=function(t){this.unbindContainer(),t=this.getElement(t),this.select().each(function(e){e.moveParent(t)}),this.selectEndpoints().each(function(e){e.moveParent(t)});var e=g;g=t,m.length=0;for(var n={endpointclick:"endpointClick",endpointdblclick:"endpointDblClick"},i=function(t,e,i){var s=e.srcElement||e.target,r=(s&&s.parentNode?s.parentNode._jsPlumb:null)||(s?s._jsPlumb:null)||(s&&s.parentNode&&s.parentNode.parentNode?s.parentNode.parentNode._jsPlumb:null);if(r){r.fire(t,r,e);var a=i&&n[i+t]||t;o.fire(a,r.component||r,e)}},r=function(t,e,n){m.push([t,n]),o.on(g,t,e,n)},a=function(t){r(t,".jtk-connector",function(e){i(t,e)}),r(t,".jtk-endpoint",function(e){i(t,e,"endpoint")}),r(t,".jtk-overlay",function(e){i(t,e)})},l=0;l<s.length;l++)a(s[l]);for(var u in _){var c=_[u].el;c.parentNode===e&&(e.removeChild(c),g.appendChild(c))}},this.getContainer=function(){return g},this.bind=function(t,e){"ready"===t&&b?e():a.apply(o,[t,e])},o.importDefaults=function(t){for(var e in t)o.Defaults[e]=t[e];return t.Container&&o.setContainer(t.Container),o},o.restoreDefaults=function(){return o.Defaults=d.extend({},u),o};var v=null,b=!1,y=[],P={},x={},_={},C={},j={},E=!1,S=[],D=!1,w=null,I=this.Defaults.Scope,A=1,k=function(){return""+A++},M=function(t,e){g?g.appendChild(t):e?this.getElement(e).appendChild(t):this.appendToRoot(t)}.bind(this),O=function(t,e,i,s){if(!D){var r,a=R(t),l=o.getDragManager();l&&(r=l.getElementsForDraggable(a)),null==i&&(i=n());var u=st({elId:a,offset:e,recalc:!1,timestamp:i});if(r&&u&&u.o)for(var c in r)st({elId:r[c].id,offset:{left:u.o.left+r[c].offset.left,top:u.o.top+r[c].offset.top},recalc:!1,timestamp:i});if(o.anchorManager.redraw(a,e,i,null,s),r)for(var h in r)o.anchorManager.redraw(r[h].id,e,i,r[h].offset,s,!0)}},T=function(t){return x[t]},L=function(t,n){var i=d.extend({},t);if(n&&d.extend(i,n),i.source&&(i.source.endpoint?i.sourceEndpoint=i.source:i.source=o.getElement(i.source)),i.target&&(i.target.endpoint?i.targetEndpoint=i.target:i.target=o.getElement(i.target)),t.uuids&&(i.sourceEndpoint=T(t.uuids[0]),i.targetEndpoint=T(t.uuids[1])),i.sourceEndpoint&&i.sourceEndpoint.isFull())e.log(o,"could not add connection; source endpoint is full");else if(i.targetEndpoint&&i.targetEndpoint.isFull())e.log(o,"could not add connection; target endpoint is full");else{if(!i.type&&i.sourceEndpoint&&(i.type=i.sourceEndpoint.connectionType),i.sourceEndpoint&&i.sourceEndpoint.connectorOverlays){i.overlays=i.overlays||[];for(var s=0,r=i.sourceEndpoint.connectorOverlays.length;s<r;s++)i.overlays.push(i.sourceEndpoint.connectorOverlays[s])}i.sourceEndpoint&&i.sourceEndpoint.scope&&(i.scope=i.sourceEndpoint.scope),!i["pointer-events"]&&i.sourceEndpoint&&i.sourceEndpoint.connectorPointerEvents&&(i["pointer-events"]=i.sourceEndpoint.connectorPointerEvents);var a=function(t,e,n){var s=function(t,e){var n=d.extend({},t);for(var i in e)e[i]&&(n[i]=e[i]);return n}(e,{anchor:i.anchors?i.anchors[n]:i.anchor,endpoint:i.endpoints?i.endpoints[n]:i.endpoint,paintStyle:i.endpointStyles?i.endpointStyles[n]:i.endpointStyle,hoverPaintStyle:i.endpointHoverStyles?i.endpointHoverStyles[n]:i.endpointHoverStyle});return o.addEndpoint(t,s)},l=function(t,e,n,s){if(i[t]&&!i[t].endpoint&&!i[t+"Endpoint"]&&!i.newConnection){var o=n[R(i[t])];if(o=o?o[s]:null){if(!o.enabled)return!1;var r=d.extend({},o.def);delete r.label;var l=null!=o.endpoint&&o.endpoint._jsPlumb?o.endpoint:a(i[t],r,e);if(l.isFull())return!1;i[t+"Endpoint"]=l,!i.scope&&r.scope&&(i.scope=r.scope),o.uniqueEndpoint?o.endpoint?l.finalEndpoint=o.endpoint:(o.endpoint=l,l.setDeleteOnEmpty(!1)):l.setDeleteOnEmpty(!0),0===e&&o.def.connectorOverlays&&(i.overlays=i.overlays||[],Array.prototype.push.apply(i.overlays,o.def.connectorOverlays))}}};if(!1!==l("source",0,this.sourceEndpointDefinitions,i.type||"default")&&!1!==l("target",1,this.targetEndpointDefinitions,i.type||"default"))return i.sourceEndpoint&&i.targetEndpoint&&(function(t,e){for(var n=t.scope.split(/\s/),i=e.scope.split(/\s/),s=0;s<n.length;s++)for(var o=0;o<i.length;o++)if(i[o]===n[s])return!0;return!1}(i.sourceEndpoint,i.targetEndpoint)||(i=null)),i}}.bind(o),F=function(t){var e=o.Defaults.ConnectionType||o.getDefaultConnectionType();t._jsPlumb=o,t.newConnection=F,t.newEndpoint=N,t.endpointsByUUID=x,t.endpointsByElement=P,t.finaliseConnection=G,t.id="con_"+k();var n=new e(t);return n.isDetachable()&&(n.endpoints[0].initDraggable("_jsPlumbSource"),n.endpoints[1].initDraggable("_jsPlumbTarget")),n},G=o.finaliseConnection=function(t,e,n,i){if(e=e||{},t.suspendedEndpoint||y.push(t),t.pending=null,t.endpoints[0].isTemporarySource=!1,!1!==i&&o.anchorManager.newConnection(t),O(t.source),!e.doNotFireConnectionEvent&&!1!==e.fireEvent){var s={connection:t,source:t.source,target:t.target,sourceId:t.sourceId,targetId:t.targetId,sourceEndpoint:t.endpoints[0],targetEndpoint:t.endpoints[1]};o.fire("connection",s,n)}},N=function(t,e){var n=o.Defaults.EndpointType||d.Endpoint,i=d.extend({},t);i._jsPlumb=o,i.newConnection=F,i.newEndpoint=N,i.endpointsByUUID=x,i.endpointsByElement=P,i.fireDetachEvent=Y,i.elementId=e||R(i.source);var s=new n(i);return s.id="ep_"+k(),it(i.elementId,i.source),d.headless||o.getDragManager().endpointAdded(i.source,e),s},U=function(t,e,n){var i=P[t];if(i&&i.length)for(var s=0,o=i.length;s<o;s++){for(var r=0,a=i[s].connections.length;r<a;r++){if(e(i[s].connections[r]))return}n&&n(i[s])}},B=function(t,e,n){e="block"===e;var i=null;n&&(i=function(t){t.setVisible(e,!0,!0)});var s=p(t);U(s.id,function(t){if(e&&n){var i=t.sourceId===s.id?1:0;t.endpoints[i].isVisible()&&t.setVisible(!0)}else t.setVisible(e)},i)},R=function(t,n,i){if(e.isString(t))return t;if(null==t)return null;var s=o.getAttribute(t,"id");return s&&"undefined"!==s||(2===arguments.length&&void 0!==arguments[1]?s=n:(1===arguments.length||3===arguments.length&&!arguments[2])&&(s="jsPlumb_"+r+"_"+k()),i||o.setAttribute(t,"id",s)),s};this.setConnectionBeingDragged=function(t){E=t},this.isConnectionBeingDragged=function(){return E},this.getManagedElements=function(){return _},this.connectorClass="jtk-connector",this.connectorOutlineClass="jtk-connector-outline",this.connectedClass="jtk-connected",this.hoverClass="jtk-hover",this.endpointClass="jtk-endpoint",this.endpointConnectedClass="jtk-endpoint-connected",this.endpointFullClass="jtk-endpoint-full",this.endpointDropAllowedClass="jtk-endpoint-drop-allowed",this.endpointDropForbiddenClass="jtk-endpoint-drop-forbidden",this.overlayClass="jtk-overlay",this.draggingClass="jtk-dragging",this.elementDraggingClass="jtk-element-dragging",this.sourceElementDraggingClass="jtk-source-element-dragging",this.targetElementDraggingClass="jtk-target-element-dragging",this.endpointAnchorClassPrefix="jtk-endpoint-anchor",this.hoverSourceClass="jtk-source-hover",this.hoverTargetClass="jtk-target-hover",this.dragSelectClass="jtk-drag-select",this.Anchors={},this.Connectors={svg:{}},this.Endpoints={svg:{}},this.Overlays={svg:{}},this.ConnectorRenderers={},this.SVG="svg",this.addEndpoint=function(t,n,i){i=i||{};var s=d.extend({},i);d.extend(s,n),s.endpoint=s.endpoint||o.Defaults.Endpoint,s.paintStyle=s.paintStyle||o.Defaults.EndpointStyle;for(var r=[],a=e.isArray(t)||null!=t.length&&!e.isString(t)?t:[t],l=0,u=a.length;l<u;l++){s.source=o.getElement(a[l]),nt(s.source);var c=R(s.source),h=N(s,c),p=it(c,s.source).info.o;e.addToList(P,c,h),D||h.paint({anchorLoc:h.anchor.compute({xy:[p.left,p.top],wh:S[c],element:h,timestamp:w}),timestamp:w}),r.push(h)}return 1===r.length?r[0]:r},this.addEndpoints=function(t,n,i){for(var s=[],r=0,a=n.length;r<a;r++){var l=o.addEndpoint(t,n[r],i);e.isArray(l)?Array.prototype.push.apply(s,l):s.push(l)}return s},this.animate=function(t,n,i){if(!this.animationSupported)return!1;i=i||{};var s=o.getElement(t),r=R(s),a=d.animEvents.step,l=d.animEvents.complete;i[a]=e.wrap(i[a],function(){o.revalidate(r)}),i[l]=e.wrap(i[l],function(){o.revalidate(r)}),o.doAnimate(s,n,i)},this.checkCondition=function(t,n){var i=o.getListener(t),s=!0;if(i&&i.length>0){var r=Array.prototype.slice.call(arguments,1);try{for(var a=0,l=i.length;a<l;a++)s=s&&i[a].apply(i[a],r)}catch(n){e.log(o,"cannot check condition ["+t+"]"+n)}}return s},this.connect=function(t,n){var i,s=L(t,n);if(s){if(null==s.source&&null==s.sourceEndpoint)return void e.log("Cannot establish connection - source does not exist");if(null==s.target&&null==s.targetEndpoint)return void e.log("Cannot establish connection - target does not exist");nt(s.source),i=F(s),G(i,s)}return i};var H=[{el:"source",elId:"sourceId",epDefs:"sourceEndpointDefinitions"},{el:"target",elId:"targetId",epDefs:"targetEndpointDefinitions"}],X=function(t,e,n,i){var s,o,r,a=H[n],l=t[a.elId],u=(t[a.el],t.endpoints[n]),c={index:n,originalSourceId:0===n?l:t.sourceId,newSourceId:t.sourceId,originalTargetId:1===n?l:t.targetId,newTargetId:t.targetId,connection:t};if(e.constructor===d.Endpoint)(s=e).addConnection(t),e=s.element;else if(o=R(e),r=this[a.epDefs][o],o===t[a.elId])s=null;else if(r)for(var h in r){if(!r[h].enabled)return;s=null!=r[h].endpoint&&r[h].endpoint._jsPlumb?r[h].endpoint:this.addEndpoint(e,r[h].def),r[h].uniqueEndpoint&&(r[h].endpoint=s),s.addConnection(t)}else s=t.makeEndpoint(0===n,e,o);return null!=s&&(u.detachFromConnection(t),t.endpoints[n]=s,t[a.el]=s.element,t[a.elId]=s.elementId,c[0===n?"newSourceId":"newTargetId"]=s.elementId,W(c),i||t.repaint()),c.element=e,c}.bind(this);this.setSource=function(t,e,n){var i=X(t,e,0,n);this.anchorManager.sourceChanged(i.originalSourceId,i.newSourceId,t,i.el)},this.setTarget=function(t,e,n){var i=X(t,e,1,n);this.anchorManager.updateOtherEndpoint(i.originalSourceId,i.originalTargetId,i.newTargetId,t)},this.deleteEndpoint=function(t,e,n){var i="string"==typeof t?x[t]:t;return i&&o.deleteObject({endpoint:i,dontUpdateHover:e,deleteAttachedObjects:n}),o},this.deleteEveryEndpoint=function(){var t=o.setSuspendDrawing(!0);for(var e in P){var n=P[e];if(n&&n.length)for(var i=0,s=n.length;i<s;i++)o.deleteEndpoint(n[i],!0)}P={},_={},x={},C={},j={},o.anchorManager.reset();var r=o.getDragManager();return r&&r.reset(),t||o.setSuspendDrawing(!1),o};var Y=function(t,e,n){var i=o.Defaults.ConnectionType||o.getDefaultConnectionType(),s=t.constructor===i?{connection:t,source:t.source,target:t.target,sourceId:t.sourceId,targetId:t.targetId,sourceEndpoint:t.endpoints[0],targetEndpoint:t.endpoints[1]}:t;e&&o.fire("connectionDetached",s,n),o.fire("internal.connectionDetached",s,n),o.anchorManager.connectionDetached(s)},W=o.fireMoveEvent=function(t,e){o.fire("connectionMoved",t,e)};this.unregisterEndpoint=function(t){for(var e in t._jsPlumb.uuid&&(x[t._jsPlumb.uuid]=null),o.anchorManager.deleteEndpoint(t),P){var n=P[e];if(n){for(var i=[],s=0,r=n.length;s<r;s++)n[s]!==t&&i.push(n[s]);P[e]=i}P[e].length<1&&delete P[e]}};this.deleteConnection=function(t,n){return!(null==t||!(n=n||{}).force&&!e.functionChain(!0,!1,[[t.endpoints[0],"isDetachAllowed",[t]],[t.endpoints[1],"isDetachAllowed",[t]],[t,"isDetachAllowed",[t]],[o,"checkCondition",["beforeDetach",t]]]))&&(t.setHover(!1),Y(t,!t.pending&&!1!==n.fireEvent,n.originalEvent),t.endpoints[0].detachFromConnection(t),t.endpoints[1].detachFromConnection(t),e.removeWithFunction(y,function(e){return t.id===e.id}),t.cleanup(),t.destroy(),!0)},this.deleteEveryConnection=function(t){t=t||{};var e=y.length,n=0;return o.batch(function(){for(var i=0;i<e;i++)n+=o.deleteConnection(y[0],t)?1:0}),n},this.deleteConnectionsForElement=function(t,e){e=e||{},t=o.getElement(t);var n=R(t),i=P[n];if(i&&i.length)for(var s=0,r=i.length;s<r;s++)i[s].deleteEveryConnection(e);return o},this.deleteObject=function(t){var n={endpoints:{},connections:{},endpointCount:0,connectionCount:0},i=!1!==t.deleteAttachedObjects,s=function(e){null!=e&&null==n.connections[e.id]&&(t.dontUpdateHover||null==e._jsPlumb||e.setHover(!1),n.connections[e.id]=e,n.connectionCount++)};for(var r in t.connection?s(t.connection):function(e){if(null!=e&&null==n.endpoints[e.id]&&(t.dontUpdateHover||null==e._jsPlumb||e.setHover(!1),n.endpoints[e.id]=e,n.endpointCount++,i))for(var o=0;o<e.connections.length;o++){var r=e.connections[o];s(r)}}(t.endpoint),n.connections){var a=n.connections[r];if(a._jsPlumb){e.removeWithFunction(y,function(t){return a.id===t.id}),Y(a,!1!==t.fireEvent&&!a.pending,t.originalEvent);var l=null==t.deleteAttachedObjects?null:!t.deleteAttachedObjects;a.endpoints[0].detachFromConnection(a,null,l),a.endpoints[1].detachFromConnection(a,null,l),a.cleanup(!0),a.destroy(!0)}}for(var u in n.endpoints){var c=n.endpoints[u];c._jsPlumb&&(o.unregisterEndpoint(c),c.cleanup(!0),c.destroy(!0))}return n};var z=function(t,e,n){return function(){return function(t,e,n,i){for(var s=0,o=t.length;s<o;s++)t[s][e].apply(t[s],n);return i(t)}(t,e,arguments,n)}},V=function(t,e){return function(){return function(t,e,n){for(var i=[],s=0,o=t.length;s<o;s++)i.push([t[s][e].apply(t[s],n),t[s]]);return i}(t,e,arguments)}},q=function(t,e){var n=[];if(t)if("string"==typeof t){if("*"===t)return t;n.push(t)}else if(e)n=t;else if(t.length)for(var i=0,s=t.length;i<s;i++)n.push(p(t[i]).id);else n.push(p(t).id);return n},J=function(t,e,n){return"*"===t||(t.length>0?-1!==t.indexOf(e):!n)};this.getConnections=function(t,e){t?t.constructor===String&&(t={scope:t}):t={};for(var n=t.scope||o.getDefaultScope(),i=q(n,!0),s=q(t.source),r=q(t.target),a=!e&&i.length>1?{}:[],l=function(t,n){if(!e&&i.length>1){var s=a[t];null==s&&(s=a[t]=[]),s.push(n)}else a.push(n)},u=0,c=y.length;u<c;u++){var h=y[u],d=h.proxies&&h.proxies[0]?h.proxies[0].originalEp.elementId:h.sourceId,p=h.proxies&&h.proxies[1]?h.proxies[1].originalEp.elementId:h.targetId;J(i,h.scope)&&J(s,d)&&J(r,p)&&l(h.scope,h)}return a};var Z=function(t,e){return function(n){for(var i=0,s=t.length;i<s;i++)n(t[i]);return e(t)}},K=function(t){return function(e){return t[e]}},$=function(t,e){var n,i,s={length:t.length,each:Z(t,e),get:K(t)},o=["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"],r=["getLabel","getOverlay","isHover","getParameter","getParameters","getPaintStyle","getHoverPaintStyle","isVisible","hasType","getType","isSuspendEvents"];for(n=0,i=o.length;n<i;n++)s[o[n]]=z(t,o[n],e);for(n=0,i=r.length;n<i;n++)s[r[n]]=V(t,r[n]);return s},Q=function(t){var e=$(t,Q);return d.extend(e,{setDetachable:z(t,"setDetachable",Q),setReattach:z(t,"setReattach",Q),setConnector:z(t,"setConnector",Q),delete:function(){for(var e=0,n=t.length;e<n;e++)o.deleteConnection(t[e])},isDetachable:V(t,"isDetachable"),isReattach:V(t,"isReattach")})},tt=function(t){var e=$(t,tt);return d.extend(e,{setEnabled:z(t,"setEnabled",tt),setAnchor:z(t,"setAnchor",tt),isEnabled:V(t,"isEnabled"),deleteEveryConnection:function(){for(var e=0,n=t.length;e<n;e++)t[e].deleteEveryConnection()},delete:function(){for(var e=0,n=t.length;e<n;e++)o.deleteEndpoint(t[e])}})};this.select=function(t){return(t=t||{}).scope=t.scope||"*",Q(t.connections||o.getConnections(t,!0))},this.selectEndpoints=function(t){(t=t||{}).scope=t.scope||"*";var e=!t.element&&!t.source&&!t.target,n=e?"*":q(t.element),i=e?"*":q(t.source),s=e?"*":q(t.target),o=q(t.scope,!0),r=[];for(var a in P){var l=J(n,a,!0),u=J(i,a,!0),c="*"!==i,h=J(s,a,!0),d="*"!==s;if(l||u||h)t:for(var p=0,f=P[a].length;p<f;p++){var g=P[a][p];if(J(o,g.scope,!0)){var m=c&&i.length>0&&!g.isSource,v=d&&s.length>0&&!g.isTarget;if(m||v)continue t;r.push(g)}}}return tt(r)},this.getAllConnections=function(){return y},this.getDefaultScope=function(){return I},this.getEndpoint=T,this.getEndpoints=function(t){return P[p(t).id]||[]},this.getDefaultEndpointType=function(){return d.Endpoint},this.getDefaultConnectionType=function(){return d.Connection},this.getId=R,this.draw=O,this.info=p,this.appendElement=M;var et=!1;this.isHoverSuspended=function(){return et},this.setHoverSuspended=function(t){et=t},this.hide=function(t,e){return B(t,"none",e),o},this.idstamp=k;var nt=function(t){if(!g&&t){var e=o.getElement(t);e.offsetParent&&o.setContainer(e.offsetParent)}},it=o.manage=function(t,e,n){return _[t]||(_[t]={el:e,endpoints:[],connections:[]},_[t].info=st({elId:t,timestamp:w}),o.addClass(e,"jtk-managed"),n||o.fire("manageElement",{id:t,info:_[t].info,el:e})),_[t]},st=(o.unmanage=function(t){if(_[t]){var e=_[t].el;o.removeClass(e,"jtk-managed"),delete _[t],o.fire("unmanageElement",{id:t,el:e})}},function(t){var e,n=t.timestamp,i=t.recalc,s=t.offset,r=t.elId;return D&&!n&&(n=w),!i&&n&&n===j[r]?{o:t.offset||C[r],s:S[r]}:(i||!s&&null==C[r]?null!=(e=_[r]?_[r].el:null)&&(S[r]=o.getSize(e),C[r]=o.getOffset(e),j[r]=n):(C[r]=s||C[r],null==S[r]&&null!=(e=_[r].el)&&(S[r]=o.getSize(e)),j[r]=n),C[r]&&!C[r].right&&(C[r].right=C[r].left+S[r][0],C[r].bottom=C[r].top+S[r][1],C[r].width=S[r][0],C[r].height=S[r][1],C[r].centerx=C[r].left+C[r].width/2,C[r].centery=C[r].top+C[r].height/2),{o:C[r],s:S[r]})});this.updateOffset=st,this.init=function(){b||(o.Defaults.Container&&o.setContainer(o.Defaults.Container),o.anchorManager=new t.jsPlumb.AnchorManager({jsPlumbInstance:o}),b=!0,o.fire("ready",o))}.bind(this),this.log=v,this.jsPlumbUIComponent=l,this.makeAnchor=function(){var n,i=function(e,n){if(t.jsPlumb.Anchors[e])return new t.jsPlumb.Anchors[e](n);if(!o.Defaults.DoNotThrowErrors)throw{msg:"jsPlumb: unknown anchor type '"+e+"'"}};if(0===arguments.length)return null;var s=arguments[0],r=arguments[1],a=(arguments[2],null);if(s.compute&&s.getOrientation)return s;if("string"==typeof s)a=i(arguments[0],{elementId:r,jsPlumbInstance:o});else if(e.isArray(s))if(e.isArray(s[0])||e.isString(s[0]))2===s.length&&e.isObject(s[1])?e.isString(s[0])?(n=t.jsPlumb.extend({elementId:r,jsPlumbInstance:o},s[1]),a=i(s[0],n)):(n=t.jsPlumb.extend({elementId:r,jsPlumbInstance:o,anchors:s[0]},s[1]),a=new t.jsPlumb.DynamicAnchor(n)):a=new d.DynamicAnchor({anchors:s,selector:null,elementId:r,jsPlumbInstance:o});else{var l={x:s[0],y:s[1],orientation:s.length>=4?[s[2],s[3]]:[0,0],offsets:s.length>=6?[s[4],s[5]]:[0,0],elementId:r,jsPlumbInstance:o,cssClass:7===s.length?s[6]:null};(a=new t.jsPlumb.Anchor(l)).clone=function(){return new t.jsPlumb.Anchor(l)}}return a.id||(a.id="anchor_"+k()),a},this.makeAnchors=function(n,i,s){for(var r=[],a=0,l=n.length;a<l;a++)"string"==typeof n[a]?r.push(t.jsPlumb.Anchors[n[a]]({elementId:i,jsPlumbInstance:s})):e.isArray(n[a])&&r.push(o.makeAnchor(n[a],i,s));return r},this.makeDynamicAnchor=function(e,n){return new t.jsPlumb.DynamicAnchor({anchors:e,selector:n,elementId:null,jsPlumbInstance:o})},this.targetEndpointDefinitions={},this.sourceEndpointDefinitions={};var ot=function(n,i,s,r,a){var u=new l(i),c=i._jsPlumb.EndpointDropHandler({jsPlumb:o,enabled:function(){return n.def.enabled},isFull:function(){var t=o.select({target:n.id}).length;return n.def.maxConnections>0&&t>=n.def.maxConnections},element:n.el,elementId:n.id,isSource:r,isTarget:a,addClass:function(t){o.addClass(n.el,t)},removeClass:function(t){o.removeClass(n.el,t)},onDrop:function(t){t.endpoints[0].anchor.unlock()},isDropAllowed:function(){return u.isDropAllowed.apply(u,arguments)},isRedrop:function(t){return null!=t.suspendedElement&&null!=t.suspendedEndpoint&&t.suspendedEndpoint.element===n.el},getEndpoint:function(e){var s=n.def.endpoint;if(null==s||null==s._jsPlumb){var r=o.deriveEndpointAndAnchorSpec(e.getType().join(" "),!0),a=r.endpoints?t.jsPlumb.extend(i,{endpoint:n.def.def.endpoint||r.endpoints[1]}):i;r.anchors&&(a=t.jsPlumb.extend(a,{anchor:n.def.def.anchor||r.anchors[1]})),(s=o.addEndpoint(n.el,a))._mtNew=!0}if(i.uniqueEndpoint&&(n.def.endpoint=s),s.setDeleteOnEmpty(!0),e.isDetachable()&&s.initDraggable(),null!=s.anchor.positionFinder){var l=o.getUIPosition(arguments,o.getZoom()),u=o.getOffset(n.el),c=o.getSize(n.el),h=null==l?[0,0]:s.anchor.positionFinder(l,u,c,s.anchor.constructorParams);s.anchor.x=h[0],s.anchor.y=h[1]}return s},maybeCleanup:function(t){t._mtNew&&0===t.connections.length?o.deleteObject({endpoint:t}):delete t._mtNew}}),h=t.jsPlumb.dragEvents.drop;return s.scope=s.scope||i.scope||o.Defaults.Scope,s[h]=e.wrap(s[h],c,!0),s.rank=i.rank||0,a&&(s[t.jsPlumb.dragEvents.over]=function(){return!0}),!1===i.allowLoopback&&(s.canDrop=function(t){return t.getDragElement()._jsPlumbRelatedElement!==n.el}),o.initDroppable(n.el,s,"internal"),c};this.makeTarget=function(e,n,i){var s=t.jsPlumb.extend({_jsPlumb:this},i);t.jsPlumb.extend(s,n);for(var r=s.maxConnections||-1,a=function(e){var n=p(e),i=n.id,a=t.jsPlumb.extend({},s.dropOptions||{}),l=s.connectionType||"default";this.targetEndpointDefinitions[i]=this.targetEndpointDefinitions[i]||{},nt(i),n.el._isJsPlumbGroup&&null==a.rank&&(a.rank=-1);var u={def:t.jsPlumb.extend({},s),uniqueEndpoint:s.uniqueEndpoint,maxConnections:r,enabled:!0};s.createEndpoint&&(u.uniqueEndpoint=!0,u.endpoint=o.addEndpoint(e,u.def),u.endpoint.setDeleteOnEmpty(!1)),n.def=u,this.targetEndpointDefinitions[i][l]=u,ot(n,s,a,!0===s.isSource,!0),n.el._katavorioDrop[n.el._katavorioDrop.length-1].targetDef=u}.bind(this),l=e.length&&e.constructor!==String?e:[e],u=0,c=l.length;u<c;u++)a(l[u]);return this},this.unmakeTarget=function(t,e){var n=p(t);return o.destroyDroppable(n.el,"internal"),e||delete this.targetEndpointDefinitions[n.id],this},this.makeSource=function(n,i,s){var r=t.jsPlumb.extend({_jsPlumb:this},s);t.jsPlumb.extend(r,i);var a=r.connectionType||"default",l=o.deriveEndpointAndAnchorSpec(a);r.endpoint=r.endpoint||l.endpoints[0],r.anchor=r.anchor||l.anchors[0];for(var u=r.maxConnections||-1,c=r.onMaxConnections,d=function(i){var s=i.id,l=this.getElement(i.el);this.sourceEndpointDefinitions[s]=this.sourceEndpointDefinitions[s]||{},nt(s);var d={def:t.jsPlumb.extend({},r),uniqueEndpoint:r.uniqueEndpoint,maxConnections:u,enabled:!0};r.createEndpoint&&(d.uniqueEndpoint=!0,d.endpoint=o.addEndpoint(n,d.def),d.endpoint.setDeleteOnEmpty(!1)),this.sourceEndpointDefinitions[s][a]=d,i.def=d;var p=t.jsPlumb.dragEvents.stop,f=t.jsPlumb.dragEvents.drag,g=t.jsPlumb.extend({},r.dragOptions||{}),m=g.drag,v=g.stop,b=null,y=!1;g.scope=g.scope||r.scope,g[f]=e.wrap(g[f],function(){m&&m.apply(this,arguments),y=!1}),g[p]=e.wrap(g[p],function(){if(v&&v.apply(this,arguments),this.currentlyDragging=!1,null!=b._jsPlumb){var t=r.anchor||this.Defaults.Anchor,e=b.anchor,n=b.connections[0],i=this.makeAnchor(t,s,this),a=b.element;if(null!=i.positionFinder){var l=o.getOffset(a),u=this.getSize(a),c={left:l.left+e.x*u[0],top:l.top+e.y*u[1]},h=i.positionFinder(c,l,u,i.constructorParams);i.x=h[0],i.y=h[1]}b.setAnchor(i,!0),b.repaint(),this.repaint(b.elementId),null!=n&&this.repaint(n.targetId)}}.bind(this));var P=function(n){if(3!==n.which&&2!==n.button){var d=this.sourceEndpointDefinitions[s][a];if(d.enabled){if(s=this.getId(this.getElement(i.el)),r.filter)if(!1===(e.isString(r.filter)?function(t,e,n,i,s){for(var o=t.target||t.srcElement,r=!1,a=i.getSelector(e,n),l=0;l<a.length;l++)if(a[l]===o){r=!0;break}return s?!r:r}(n,i.el,r.filter,this,r.filterExclude):r.filter(n,i.el)))return;var p=this.select({source:s}).length;if(d.maxConnections>=0&&p>=d.maxConnections)return c&&c({element:i.el,maxConnections:u},n),!1;var f=t.jsPlumb.getPositionOnElement(n,l,h),m={};t.jsPlumb.extend(m,d.def),m.isTemporarySource=!0,m.anchor=[f[0],f[1],0,0],m.dragOptions=g,d.def.scope&&(m.scope=d.def.scope),b=this.addEndpoint(s,m),y=!0,b.setDeleteOnEmpty(!0),d.uniqueEndpoint&&(d.endpoint?b.finalEndpoint=d.endpoint:(d.endpoint=b,b.setDeleteOnEmpty(!1)));var v=function(){o.off(b.canvas,"mouseup",v),o.off(i.el,"mouseup",v),y&&(y=!1,o.deleteEndpoint(b))};o.on(b.canvas,"mouseup",v),o.on(i.el,"mouseup",v);var P={};if(d.def.extract)for(var x in d.def.extract){var _=(n.srcElement||n.target).getAttribute(x);_&&(P[d.def.extract[x]]=_)}o.trigger(b.canvas,"mousedown",n,P),e.consume(n)}}}.bind(this);this.on(i.el,"mousedown",P),d.trigger=P,r.filter&&(e.isString(r.filter)||e.isFunction(r.filter))&&o.setDragFilter(i.el,r.filter);var x=t.jsPlumb.extend({},r.dropOptions||{});ot(i,r,x,!0,!0===r.isTarget)}.bind(this),f=n.length&&n.constructor!==String?n:[n],g=0,m=f.length;g<m;g++)d(p(f[g]));return this},this.unmakeSource=function(t,e,n){var i=p(t);o.destroyDroppable(i.el,"internal");var s=this.sourceEndpointDefinitions[i.id];if(s)for(var r in s)if(null==e||e===r){var a=s[r].trigger;a&&o.off(i.el,"mousedown",a),n||delete this.sourceEndpointDefinitions[i.id][r]}return this},this.unmakeEverySource=function(){for(var t in this.sourceEndpointDefinitions)o.unmakeSource(t,null,!0);return this.sourceEndpointDefinitions={},this};var rt=function(t,n,i){n=e.isArray(n)?n:[n];var s=R(t);i=i||"default";for(var o=0;o<n.length;o++){var r=this[n[o]][s];if(r&&r[i])return r[i].def.scope||this.Defaults.Scope}}.bind(this),at=function(t,n,i,s){i=e.isArray(i)?i:[i];var o=R(t);s=s||"default";for(var r=0;r<i.length;r++){var a=this[i[r]][o];a&&a[s]&&(a[s].def.scope=n)}}.bind(this);this.getScope=function(t,e){return rt(t,["sourceEndpointDefinitions","targetEndpointDefinitions"])},this.getSourceScope=function(t){return rt(t,"sourceEndpointDefinitions")},this.getTargetScope=function(t){return rt(t,"targetEndpointDefinitions")},this.setScope=function(t,e,n){this.setSourceScope(t,e,n),this.setTargetScope(t,e,n)},this.setSourceScope=function(t,e,n){at(t,e,"sourceEndpointDefinitions",n),this.setDragScope(t,e)},this.setTargetScope=function(t,e,n){at(t,e,"targetEndpointDefinitions",n),this.setDropScope(t,e)},this.unmakeEveryTarget=function(){for(var t in this.targetEndpointDefinitions)o.unmakeTarget(t,!0);return this.targetEndpointDefinitions={},this};var lt=function(t,n,i,s,r){var a,l,u,c="source"===t?this.sourceEndpointDefinitions:this.targetEndpointDefinitions;if(r=r||"default",n.length&&!e.isString(n)){a=[];for(var h=0,d=n.length;h<d;h++)c[(l=p(n[h])).id]&&c[l.id][r]&&(a[h]=c[l.id][r].enabled,u=s?!a[h]:i,c[l.id][r].enabled=u,o[u?"removeClass":"addClass"](l.el,"jtk-"+t+"-disabled"))}else{var f=(l=p(n)).id;c[f]&&c[f][r]&&(a=c[f][r].enabled,u=s?!a:i,c[f][r].enabled=u,o[u?"removeClass":"addClass"](l.el,"jtk-"+t+"-disabled"))}return a}.bind(this),ut=function(t,n){return e.isString(t)||!t.length?n.apply(this,[t]):t.length?n.apply(this,[t[0]]):void 0}.bind(this);this.toggleSourceEnabled=function(t,e){return lt("source",t,null,!0,e),this.isSourceEnabled(t,e)},this.setSourceEnabled=function(t,e,n){return lt("source",t,e,null,n)},this.isSource=function(t,e){return e=e||"default",ut(t,function(t){var n=this.sourceEndpointDefinitions[p(t).id];return null!=n&&null!=n[e]}.bind(this))},this.isSourceEnabled=function(t,e){return e=e||"default",ut(t,function(t){var n=this.sourceEndpointDefinitions[p(t).id];return n&&n[e]&&!0===n[e].enabled}.bind(this))},this.toggleTargetEnabled=function(t,e){return lt("target",t,null,!0,e),this.isTargetEnabled(t,e)},this.isTarget=function(t,e){return e=e||"default",ut(t,function(t){var n=this.targetEndpointDefinitions[p(t).id];return null!=n&&null!=n[e]}.bind(this))},this.isTargetEnabled=function(t,e){return e=e||"default",ut(t,function(t){var n=this.targetEndpointDefinitions[p(t).id];return n&&n[e]&&!0===n[e].enabled}.bind(this))},this.setTargetEnabled=function(t,e,n){return lt("target",t,e,null,n)},this.ready=function(t){o.bind("ready",t)};var ct=function(t,e){if("object"==typeof t&&t.length)for(var n=0,i=t.length;n<i;n++)e(t[n]);else e(t);return o};this.repaint=function(t,e,n){return ct(t,function(t){O(t,e,n)})},this.revalidate=function(t,e,n){return ct(t,function(t){var i=n?t:o.getId(t);o.updateOffset({elId:i,recalc:!0,timestamp:e});var s=o.getDragManager();s&&s.updateOffsets(i),o.repaint(t)})},this.repaintEverything=function(){var t,e=n();for(t in P)o.updateOffset({elId:t,recalc:!0,timestamp:e});for(t in P)O(t,null,e);return this},this.removeAllEndpoints=function(t,e,n){n=n||[];var i=function(t){var s,r,a=p(t),l=P[a.id];if(l)for(n.push(a),s=0,r=l.length;s<r;s++)o.deleteEndpoint(l[s],!1);if(delete P[a.id],e&&a.el&&3!==a.el.nodeType&&8!==a.el.nodeType)for(s=0,r=a.el.childNodes.length;s<r;s++)i(a.el.childNodes[s])};return i(t),this};var ht=function(t,e){o.removeAllEndpoints(t.id,!0,e);for(var n=o.getDragManager(),i=function(t){n&&n.elementRemoved(t.id),o.anchorManager.clearFor(t.id),o.anchorManager.removeFloatingConnection(t.id),o.isSource(t.el)&&o.unmakeSource(t.el),o.isTarget(t.el)&&o.unmakeTarget(t.el),o.destroyDraggable(t.el),o.destroyDroppable(t.el),delete o.floatingConnections[t.id],delete _[t.id],delete C[t.id],t.el&&(o.removeElement(t.el),t.el._jsPlumb=null)},s=1;s<e.length;s++)i(e[s]);i(t)};this.remove=function(t,e){var n=p(t),i=[];return n.text&&n.el.parentNode?n.el.parentNode.removeChild(n.el):n.id&&o.batch(function(){ht(n,i)},!0===e),o},this.empty=function(t,e){var n=[],i=function(t,e){var s=p(t);if(s.text)s.el.parentNode.removeChild(s.el);else if(s.el){for(;s.el.childNodes.length>0;)i(s.el.childNodes[0]);e||ht(s,n)}};return o.batch(function(){i(t,!0)},!1===e),o},this.reset=function(t){o.silently(function(){et=!1,o.removeAllGroups(),o.removeGroupManager(),o.deleteEveryEndpoint(),t||o.unbind(),this.targetEndpointDefinitions={},this.sourceEndpointDefinitions={},y.length=0,this.doReset&&this.doReset()}.bind(this))};var dt=function(t){t.canvas&&t.canvas.parentNode&&t.canvas.parentNode.removeChild(t.canvas),t.cleanup(),t.destroy()};this.clear=function(){o.select().each(dt),o.selectEndpoints().each(dt),P={},x={}},this.setDefaultScope=function(t){return I=t,o},this.deriveEndpointAndAnchorSpec=function(t,e){for(var n=((e?"":"default ")+t).split(/[\s]/),i=null,s=null,r=null,a=null,l=0;l<n.length;l++){var u=o.getType(n[l],"connection");u&&(u.endpoints&&(i=u.endpoints),u.endpoint&&(s=u.endpoint),u.anchors&&(a=u.anchors),u.anchor&&(r=u.anchor))}return{endpoints:i||[s,s],anchors:a||[r,r]}},this.setId=function(t,n,i){var s;e.isString(t)?s=t:(t=this.getElement(t),s=this.getId(t));var o=this.getConnections({source:s,scope:"*"},!0),r=this.getConnections({target:s,scope:"*"},!0);n=""+n,i?t=this.getElement(n):(t=this.getElement(s),this.setAttribute(t,"id",n)),P[n]=P[s]||[];for(var a=0,l=P[n].length;a<l;a++)P[n][a].setElementId(n),P[n][a].setReferenceElement(t);delete P[s],this.sourceEndpointDefinitions[n]=this.sourceEndpointDefinitions[s],delete this.sourceEndpointDefinitions[s],this.targetEndpointDefinitions[n]=this.targetEndpointDefinitions[s],delete this.targetEndpointDefinitions[s],this.anchorManager.changeId(s,n);var u=this.getDragManager();u&&u.changeId(s,n),_[n]=_[s],delete _[s];var c=function(e,i,s){for(var o=0,r=e.length;o<r;o++)e[o].endpoints[i].setElementId(n),e[o].endpoints[i].setReferenceElement(t),e[o][s+"Id"]=n,e[o][s]=t};c(o,0,"source"),c(r,1,"target"),this.repaint(n)},this.setDebugLog=function(t){v=t},this.setSuspendDrawing=function(t,e){var n=D;return D=t,w=t?(new Date).getTime():null,e&&this.repaintEverything(),n},this.isSuspendDrawing=function(){return D},this.getSuspendedAt=function(){return w},this.batch=function(t,n){var i=this.isSuspendDrawing();i||this.setSuspendDrawing(!0);try{t()}catch(t){e.log("Function run while suspended failed",t)}i||this.setSuspendDrawing(!1,!n)},this.doWhileSuspended=this.batch,this.getCachedData=function(t){var e=C[t];return e?{o:e,s:S[t]}:st({elId:t})},this.timestamp=n,this.show=function(t,e){return B(t,"block",e),o},this.toggleVisible=function(t,e){var n=null;e&&(n=function(t){var e=t.isVisible();t.setVisible(!e)}),U(t,function(t){var e=t.isVisible();t.setVisible(!e)},n)},this.addListener=this.bind;var pt=[];this.registerFloatingConnection=function(t,n,i){pt[t.id]=n,e.addToList(P,t.id,i)},this.getFloatingConnectionFor=function(t){return pt[t]},this.listManager=new t.jsPlumbListManager(this)};e.extend(t.jsPlumbInstance,e.EventGenerator,{setAttribute:function(t,e,n){this.setAttribute(t,e,n)},getAttribute:function(e,n){return this.getAttribute(t.jsPlumb.getElement(e),n)},convertToFullOverlaySpec:function(t){return e.isString(t)&&(t=[t,{}]),t[1].id=t[1].id||e.uuid(),t},registerConnectionType:function(e,n){if(this._connectionTypes[e]=t.jsPlumb.extend({},n),n.overlays){for(var i={},s=0;s<n.overlays.length;s++){var o=this.convertToFullOverlaySpec(n.overlays[s]);i[o[1].id]=o}this._connectionTypes[e].overlays=i}},registerConnectionTypes:function(t){for(var e in t)this.registerConnectionType(e,t[e])},registerEndpointType:function(e,n){if(this._endpointTypes[e]=t.jsPlumb.extend({},n),n.overlays){for(var i={},s=0;s<n.overlays.length;s++){var o=this.convertToFullOverlaySpec(n.overlays[s]);i[o[1].id]=o}this._endpointTypes[e].overlays=i}},registerEndpointTypes:function(t){for(var e in t)this.registerEndpointType(e,t[e])},getType:function(t,e){return"connection"===e?this._connectionTypes[t]:this._endpointTypes[t]},setIdChanged:function(t,e){this.setId(t,e,!0)},setParent:function(t,e){var n=this.getElement(t),i=this.getId(n),s=this.getElement(e),o=this.getId(s),r=this.getDragManager();n.parentNode.removeChild(n),s.appendChild(n),r&&r.setParent(n,i,s,o)},extend:function(t,e,n){var i;if(n)for(i=0;i<n.length;i++)t[n[i]]=e[n[i]];else for(i in e)t[i]=e[i];return t},floatingConnections:{},getFloatingAnchorIndex:function(t){return t.endpoints[0].isFloating()?0:t.endpoints[1].isFloating()?1:-1},proxyConnection:function(t,e,n,i,s,o){var r,a=t.endpoints[e].elementId,l=t.endpoints[e];t.proxies=t.proxies||[],(r=t.proxies[e]?t.proxies[e].ep:this.addEndpoint(n,{endpoint:s(t,e),anchor:o(t,e),parameters:{isProxyEndpoint:!0}})).setDeleteOnEmpty(!0),t.proxies[e]={ep:r,originalEp:l},0===e?this.anchorManager.sourceChanged(a,i,t,n):(this.anchorManager.updateOtherEndpoint(t.endpoints[0].elementId,a,i,t),t.target=n,t.targetId=i),l.detachFromConnection(t,null,!0),r.connections=[t],t.endpoints[e]=r,l.setVisible(!1),t.setVisible(!0),this.revalidate(n)},unproxyConnection:function(t,e,n){if(null!=t._jsPlumb&&null!=t.proxies&&null!=t.proxies[e]){var i=t.proxies[e].originalEp.element,s=t.proxies[e].originalEp.elementId;t.endpoints[e]=t.proxies[e].originalEp,0===e?this.anchorManager.sourceChanged(n,s,t,i):(this.anchorManager.updateOtherEndpoint(t.endpoints[0].elementId,n,s,t),t.target=i,t.targetId=s),t.proxies[e].ep.detachFromConnection(t,null),t.proxies[e].originalEp.addConnection(t),t.isVisible()&&t.proxies[e].originalEp.setVisible(!0),delete t.proxies[e]}}});var d=new h;t.jsPlumb=d,d.getInstance=function(t,e){var n=new h(t);if(e)for(var i in e)n[i]=e[i];return n.init(),n},d.each=function(t,e){if(null!=t)if("string"==typeof t)e(d.getElement(t));else if(null!=t.length)for(var n=0;n<t.length;n++)e(d.getElement(t[n]));else e(t)},"undefined"!=typeof exports&&(exports.jsPlumb=d)}.call("undefined"!=typeof window?window:this),function(){"use strict";var t=this,e=t.jsPlumb,n=t.jsPlumbUtil;e.OverlayCapableJsPlumbUIComponent=function(e){t.jsPlumbUIComponent.apply(this,arguments),this._jsPlumb.overlays={},this._jsPlumb.overlayPositions={},e.label&&(this.getDefaultType().overlays.__label=["Label",{label:e.label,location:e.labelLocation||this.defaultLabelLocation||.5,labelStyle:e.labelStyle||this._jsPlumb.instance.Defaults.LabelStyle,id:"__label"}]),this.setListenerComponent=function(t){if(this._jsPlumb)for(var e in this._jsPlumb.overlays)this._jsPlumb.overlays[e].setListenerComponent(t)}},e.OverlayCapableJsPlumbUIComponent.applyType=function(t,e){if(e.overlays){var n,i={};for(n in e.overlays){var s=t._jsPlumb.overlays[e.overlays[n][1].id];if(s)s.updateFrom(e.overlays[n][1]),i[e.overlays[n][1].id]=!0;else{var o=t.getCachedTypeItem("overlay",e.overlays[n][1].id);null!=o?(o.reattach(t._jsPlumb.instance,t),o.setVisible(!0),o.updateFrom(e.overlays[n][1]),t._jsPlumb.overlays[o.id]=o):o=t.addOverlay(e.overlays[n],!0),i[o.id]=!0}}for(n in t._jsPlumb.overlays)null==i[t._jsPlumb.overlays[n].id]&&t.removeOverlay(t._jsPlumb.overlays[n].id,!0)}},n.extend(e.OverlayCapableJsPlumbUIComponent,t.jsPlumbUIComponent,{setHover:function(t,e){if(this._jsPlumb&&!this._jsPlumb.instance.isConnectionBeingDragged())for(var n in this._jsPlumb.overlays)this._jsPlumb.overlays[n][t?"addClass":"removeClass"](this._jsPlumb.instance.hoverClass)},addOverlay:function(t,i){var s=function(t,i){var s=null;if(n.isArray(i)){var o=i[0],r=e.extend({component:t,_jsPlumb:t._jsPlumb.instance},i[1]);3===i.length&&e.extend(r,i[2]),s=new(e.Overlays[t._jsPlumb.instance.getRenderMode()][o])(r)}else s=i.constructor===String?new(e.Overlays[t._jsPlumb.instance.getRenderMode()][i])({component:t,_jsPlumb:t._jsPlumb.instance}):i;return s.id=s.id||n.uuid(),t.cacheTypeItem("overlay",s,s.id),t._jsPlumb.overlays[s.id]=s,s}(this,t);if(this.getData&&"Label"===s.type&&n.isArray(t)){var o=this.getData(),r=t[1];if(o){var a=r.labelLocationAttribute||"labelLocation",l=o?o[a]:null;l&&(s.loc=l)}}return i||this.repaint(),s},getOverlay:function(t){return this._jsPlumb.overlays[t]},getOverlays:function(){return this._jsPlumb.overlays},hideOverlay:function(t){var e=this.getOverlay(t);e&&e.hide()},hideOverlays:function(){for(var t in this._jsPlumb.overlays)this._jsPlumb.overlays[t].hide()},showOverlay:function(t){var e=this.getOverlay(t);e&&e.show()},showOverlays:function(){for(var t in this._jsPlumb.overlays)this._jsPlumb.overlays[t].show()},removeAllOverlays:function(t){for(var e in this._jsPlumb.overlays)this._jsPlumb.overlays[e].cleanup&&this._jsPlumb.overlays[e].cleanup();this._jsPlumb.overlays={},this._jsPlumb.overlayPositions=null,this._jsPlumb.overlayPlacements={},t||this.repaint()},removeOverlay:function(t,e){var n=this._jsPlumb.overlays[t];n&&(n.setVisible(!1),!e&&n.cleanup&&n.cleanup(),delete this._jsPlumb.overlays[t],this._jsPlumb.overlayPositions&&delete this._jsPlumb.overlayPositions[t],this._jsPlumb.overlayPlacements&&delete this._jsPlumb.overlayPlacements[t])},removeOverlays:function(){for(var t=0,e=arguments.length;t<e;t++)this.removeOverlay(arguments[t])},moveParent:function(t){if(this.bgCanvas&&(this.bgCanvas.parentNode.removeChild(this.bgCanvas),t.appendChild(this.bgCanvas)),this.canvas&&this.canvas.parentNode)for(var e in this.canvas.parentNode.removeChild(this.canvas),t.appendChild(this.canvas),this._jsPlumb.overlays)if(this._jsPlumb.overlays[e].isAppendedAtTopLevel){var n=this._jsPlumb.overlays[e].getElement();n.parentNode.removeChild(n),t.appendChild(n)}},getLabel:function(){var t=this.getOverlay("__label");return null!=t?t.getLabel():null},getLabelOverlay:function(){return this.getOverlay("__label")},setLabel:function(t){var n=this.getOverlay("__label");n?t.constructor===String||t.constructor===Function?n.setLabel(t):(t.label&&n.setLabel(t.label),t.location&&n.setLocation(t.location)):(n=function(t,n){var i={cssClass:n.cssClass,labelStyle:t.labelStyle,id:"__label",component:t,_jsPlumb:t._jsPlumb.instance},s=e.extend(i,n);return new(e.Overlays[t._jsPlumb.instance.getRenderMode()].Label)(s)}(this,t.constructor===String||t.constructor===Function?{label:t}:t),this._jsPlumb.overlays.__label=n);this._jsPlumb.instance.isSuspendDrawing()||this.repaint()},cleanup:function(t){for(var e in this._jsPlumb.overlays)this._jsPlumb.overlays[e].cleanup(t),this._jsPlumb.overlays[e].destroy(t);t&&(this._jsPlumb.overlays={},this._jsPlumb.overlayPositions=null)},setVisible:function(t){this[t?"showOverlays":"hideOverlays"]()},setAbsoluteOverlayPosition:function(t,e){this._jsPlumb.overlayPositions[t.id]=e},getAbsoluteOverlayPosition:function(t){return this._jsPlumb.overlayPositions?this._jsPlumb.overlayPositions[t.id]:null},_clazzManip:function(t,e,n){if(!n)for(var i in this._jsPlumb.overlays)this._jsPlumb.overlays[i][t+"Class"](e)},addClass:function(t,e){this._clazzManip("add",t,e)},removeClass:function(t,e){this._clazzManip("remove",t,e)}})}.call("undefined"!=typeof window?window:this),function(){"use strict";var t=this.jsPlumb,e=this.jsPlumbUtil,n=["connectorStyle","connectorHoverStyle","connectorOverlays","connector","connectionType","connectorClass","connectorHoverClass"];t.Endpoint=function(i){var s=i._jsPlumb,o=i.newConnection,r=i.newEndpoint;this.idPrefix="_jsplumb_e_",this.defaultLabelLocation=[.5,.5],this.defaultOverlayKeys=["Overlays","EndpointOverlays"],t.OverlayCapableJsPlumbUIComponent.apply(this,arguments),this.appendToDefaultType({connectionType:i.connectionType,maxConnections:null==i.maxConnections?this._jsPlumb.instance.Defaults.MaxConnections:i.maxConnections,paintStyle:i.endpointStyle||i.paintStyle||i.style||this._jsPlumb.instance.Defaults.EndpointStyle||t.Defaults.EndpointStyle,hoverPaintStyle:i.endpointHoverStyle||i.hoverPaintStyle||this._jsPlumb.instance.Defaults.EndpointHoverStyle||t.Defaults.EndpointHoverStyle,connectorStyle:i.connectorStyle,connectorHoverStyle:i.connectorHoverStyle,connectorClass:i.connectorClass,connectorHoverClass:i.connectorHoverClass,connectorOverlays:i.connectorOverlays,connector:i.connector,connectorTooltip:i.connectorTooltip}),this._jsPlumb.enabled=!(!1===i.enabled),this._jsPlumb.visible=!0,this.element=t.getElement(i.source),this._jsPlumb.uuid=i.uuid,this._jsPlumb.floatingEndpoint=null;this._jsPlumb.uuid&&(i.endpointsByUUID[this._jsPlumb.uuid]=this),this.elementId=i.elementId,this.dragProxy=i.dragProxy,this._jsPlumb.connectionCost=i.connectionCost,this._jsPlumb.connectionsDirected=i.connectionsDirected,this._jsPlumb.currentAnchorClass="",this._jsPlumb.events={};var a=!0===i.deleteOnEmpty;this.setDeleteOnEmpty=function(t){a=t};var l=function(){var e=s.endpointAnchorClassPrefix+"-"+this._jsPlumb.currentAnchorClass;this._jsPlumb.currentAnchorClass=this.anchor.getCssClass();var n=s.endpointAnchorClassPrefix+(this._jsPlumb.currentAnchorClass?"-"+this._jsPlumb.currentAnchorClass:"");this.removeClass(e),this.addClass(n),t.updateClasses(this.element,n,e)}.bind(this);this.prepareAnchor=function(t){var e=this._jsPlumb.instance.makeAnchor(t,this.elementId,s);return e.bind("anchorChanged",function(t){this.fire("anchorChanged",{endpoint:this,anchor:t}),l()}.bind(this)),e},this.setPreparedAnchor=function(t,e){return this._jsPlumb.instance.continuousAnchorFactory.clear(this.elementId),this.anchor=t,l(),e||this._jsPlumb.instance.repaint(this.elementId),this},this.setAnchor=function(t,e){var n=this.prepareAnchor(t);return this.setPreparedAnchor(n,e),this};var u=function(t){if(this.connections.length>0)for(var e=0;e<this.connections.length;e++)this.connections[e].setHover(t,!1);else this.setHover(t)}.bind(this);this.bind("mouseover",function(){u(!0)}),this.bind("mouseout",function(){u(!1)}),i._transient||this._jsPlumb.instance.anchorManager.add(this,this.elementId),this.prepareEndpoint=function(n,o){var r,a=function(e,n){var i=s.getRenderMode();if(t.Endpoints[i][e])return new t.Endpoints[i][e](n);if(!s.Defaults.DoNotThrowErrors)throw{msg:"jsPlumb: unknown endpoint type '"+e+"'"}},l={_jsPlumb:this._jsPlumb.instance,cssClass:i.cssClass,container:i.container,tooltip:i.tooltip,connectorTooltip:i.connectorTooltip,endpoint:this};return e.isString(n)?r=a(n,l):e.isArray(n)?(l=e.merge(n[1],l),r=a(n[0],l)):r=n.clone(),r.clone=function(){return e.isString(n)?a(n,l):e.isArray(n)?(l=e.merge(n[1],l),a(n[0],l)):void 0}.bind(this),r.typeId=o,r},this.setEndpoint=function(t,e){var n=this.prepareEndpoint(t);this.setPreparedEndpoint(n,!0)},this.setPreparedEndpoint=function(t,e){null!=this.endpoint&&(this.endpoint.cleanup(),this.endpoint.destroy()),this.endpoint=t,this.type=this.endpoint.type,this.canvas=this.endpoint.canvas},t.extend(this,i,n),this.isSource=i.isSource||!1,this.isTemporarySource=i.isTemporarySource||!1,this.isTarget=i.isTarget||!1,this.connections=i.connections||[],this.connectorPointerEvents=i["connector-pointer-events"],this.scope=i.scope||s.getDefaultScope(),this.timestamp=null,this.reattachConnections=i.reattach||s.Defaults.ReattachConnections,this.connectionsDetachable=s.Defaults.ConnectionsDetachable,!1!==i.connectionsDetachable&&!1!==i.detachable||(this.connectionsDetachable=!1),this.dragAllowedWhenFull=!1!==i.dragAllowedWhenFull,i.onMaxConnections&&this.bind("maxConnections",i.onMaxConnections),this.addConnection=function(t){this.connections.push(t),this[(this.connections.length>0?"add":"remove")+"Class"](s.endpointConnectedClass),this[(this.isFull()?"add":"remove")+"Class"](s.endpointFullClass)},this.detachFromConnection=function(t,e,n){(e=null==e?this.connections.indexOf(t):e)>=0&&(this.connections.splice(e,1),this[(this.connections.length>0?"add":"remove")+"Class"](s.endpointConnectedClass),this[(this.isFull()?"add":"remove")+"Class"](s.endpointFullClass)),!n&&a&&0===this.connections.length&&s.deleteObject({endpoint:this,fireEvent:!1,deleteAttachedObjects:!0!==n})},this.deleteEveryConnection=function(t){for(var e=this.connections.length,n=0;n<e;n++)s.deleteConnection(this.connections[0],t)},this.detachFrom=function(t,e,n){for(var i=[],o=0;o<this.connections.length;o++)this.connections[o].endpoints[1]!==t&&this.connections[o].endpoints[0]!==t||i.push(this.connections[o]);for(var r=0,a=i.length;r<a;r++)s.deleteConnection(i[0]);return this},this.getElement=function(){return this.element},this.setElement=function(n){var o=this._jsPlumb.instance.getId(n),r=this.elementId;return e.removeWithFunction(i.endpointsByElement[this.elementId],function(t){return t.id===this.id}.bind(this)),this.element=t.getElement(n),this.elementId=s.getId(this.element),s.anchorManager.rehomeEndpoint(this,r,this.element),s.dragManager.endpointAdded(this.element),e.addToList(i.endpointsByElement,o,this),this},this.makeInPlaceCopy=function(){var t=this.anchor.getCurrentLocation({element:this}),e=this.anchor.getOrientation(this),n=this.anchor.getCssClass(),s={bind:function(){},compute:function(){return[t[0],t[1]]},getCurrentLocation:function(){return[t[0],t[1]]},getOrientation:function(){return e},getCssClass:function(){return n}};return r({dropOptions:i.dropOptions,anchor:s,source:this.element,paintStyle:this.getPaintStyle(),endpoint:i.hideOnDrag?"Blank":this.endpoint,_transient:!0,scope:this.scope,reference:this})},this.connectorSelector=function(){return this.connections[0]},this.setStyle=this.setPaintStyle,this.paint=function(t){var e=(t=t||{}).timestamp,n=!(!1===t.recalc);if(!e||this.timestamp!==e){var i=s.updateOffset({elId:this.elementId,timestamp:e}),o=t.offset?t.offset.o:i.o;if(null!=o){var r=t.anchorPoint,a=t.connectorPaintStyle;if(null==r){var l=t.dimensions||i.s,u={xy:[o.left,o.top],wh:l,element:this,timestamp:e};if(n&&this.anchor.isDynamic&&this.connections.length>0){var c=function(t,e){var n=0;if(null!=e)for(var i=0;i<t.connections.length;i++)if(t.connections[i].sourceId===e||t.connections[i].targetId===e){n=i;break}return t.connections[n]}(this,t.elementWithPrecedence),h=c.endpoints[0]===this?1:0,d=0===h?c.sourceId:c.targetId,p=s.getCachedData(d),f=p.o,g=p.s;u.index=0===h?1:0,u.connection=c,u.txy=[f.left,f.top],u.twh=g,u.tElement=c.endpoints[h]}else this.connections.length>0&&(u.connection=this.connections[0]);r=this.anchor.compute(u)}for(var m in this.endpoint.compute(r,this.anchor.getOrientation(this),this._jsPlumb.paintStyleInUse,a||this.paintStyleInUse),this.endpoint.paint(this._jsPlumb.paintStyleInUse,this.anchor),this.timestamp=e,this._jsPlumb.overlays)if(this._jsPlumb.overlays.hasOwnProperty(m)){var v=this._jsPlumb.overlays[m];v.isVisible()&&(this._jsPlumb.overlayPlacements[m]=v.draw(this.endpoint,this._jsPlumb.paintStyleInUse),v.paint(this._jsPlumb.overlayPlacements[m]))}}}},this.getTypeDescriptor=function(){return"endpoint"},this.isVisible=function(){return this._jsPlumb.visible},this.repaint=this.paint;var c=!1;this.initDraggable=function(){if(!c&&t.isDragSupported(this.element)){var n,a={id:null,element:null},l=null,u=!1,h=null,d=function(t,e,n){var i=!1;return{drag:function(){if(i)return i=!1,!0;if(e.element){var s=n.getUIPosition(arguments,n.getZoom());null!=s&&n.setPosition(e.element,s),n.repaint(e.element,s),t.paint({anchorPoint:t.anchor.getCurrentLocation({element:t})})}},stopDrag:function(){i=!0}}}(this,a,s),p=i.dragOptions||{},f=t.dragEvents.start,g=t.dragEvents.stop,m=t.dragEvents.drag,v=t.dragEvents.beforeStart,b=function(e){l=this.connectorSelector();var c=!0;this.isEnabled()||(c=!1),null!=l||this.isSource||this.isTemporarySource||(c=!1),!this.isSource||!this.isFull()||null!=l&&this.dragAllowedWhenFull||(c=!1),null==l||l.isDetachable(this)||(this.isFull()?c=!1:l=null);var p=s.checkCondition(null==l?"beforeDrag":"beforeStartDetach",{endpoint:this,source:this.element,sourceId:this.elementId,connection:l});if(!1===p?c=!1:"object"==typeof p?t.extend(p,n||{}):p=n||{},!1===c)return s.stopDrag&&s.stopDrag(this.canvas),d.stopDrag(),!1;for(var f=0;f<this.connections.length;f++)this.connections[f].setHover(!1);this.addClass("endpointDrag"),s.setConnectionBeingDragged(!0),l&&!this.isFull()&&this.isSource&&(l=null),s.updateOffset({elId:this.elementId});var g=this._jsPlumb.instance.getOffset(this.canvas),m=this.canvas,v=this._jsPlumb.instance.getSize(this.canvas);!function(t,e,n,i){var s=e.createElement("div",{position:"absolute"});e.appendElement(s);var o=e.getId(s);e.setPosition(s,n),s.style.width=i[0]+"px",s.style.height=i[1]+"px",e.manage(o,s,!0),t.id=o,t.element=s}(a,s,g,v),s.setAttributes(this.canvas,{dragId:a.id,elId:this.elementId});var b=this.dragProxy||this.endpoint;if(null==this.dragProxy&&null!=this.connectionType){var y=this._jsPlumb.instance.deriveEndpointAndAnchorSpec(this.connectionType);y.endpoints[1]&&(b=y.endpoints[1])}var P=this._jsPlumb.instance.makeAnchor("Center");P.isFloating=!0,this._jsPlumb.floatingEndpoint=function(e,n,i,s,o,r,a,l){return a({paintStyle:e,endpoint:i,anchor:new t.FloatingAnchor({reference:n,referenceCanvas:s,jsPlumbInstance:r}),source:o,scope:l})}(this.getPaintStyle(),P,b,this.canvas,a.element,s,r,this.scope);var x=this._jsPlumb.floatingEndpoint.anchor;if(null==l)this.setHover(!1,!1),(l=o({sourceEndpoint:this,targetEndpoint:this._jsPlumb.floatingEndpoint,source:this.element,target:a.element,anchors:[this.anchor,this._jsPlumb.floatingEndpoint.anchor],paintStyle:i.connectorStyle,hoverPaintStyle:i.connectorHoverStyle,connector:i.connector,overlays:i.connectorOverlays,type:this.connectionType,cssClass:this.connectorClass,hoverClass:this.connectorHoverClass,scope:i.scope,data:p})).pending=!0,l.addClass(s.draggingClass),this._jsPlumb.floatingEndpoint.addClass(s.draggingClass),this._jsPlumb.floatingEndpoint.anchor=x,s.fire("connectionDrag",l),s.anchorManager.newConnection(l);else{u=!0,l.setHover(!1);var _=l.endpoints[0].id===this.id?0:1;this.detachFromConnection(l,null,!0);var C=s.getDragScope(m);s.setAttribute(this.canvas,"originalScope",C),s.fire("connectionDrag",l),0===_?(h=[l.source,l.sourceId,m,C],s.anchorManager.sourceChanged(l.endpoints[_].elementId,a.id,l,a.element)):(h=[l.target,l.targetId,m,C],l.target=a.element,l.targetId=a.id,s.anchorManager.updateOtherEndpoint(l.sourceId,l.endpoints[_].elementId,l.targetId,l)),l.suspendedEndpoint=l.endpoints[_],l.suspendedElement=l.endpoints[_].getElement(),l.suspendedElementId=l.endpoints[_].elementId,l.suspendedElementType=0===_?"source":"target",l.suspendedEndpoint.setHover(!1),this._jsPlumb.floatingEndpoint.referenceEndpoint=l.suspendedEndpoint,l.endpoints[_]=this._jsPlumb.floatingEndpoint,l.addClass(s.draggingClass),this._jsPlumb.floatingEndpoint.addClass(s.draggingClass)}s.registerFloatingConnection(a,l,this._jsPlumb.floatingEndpoint),s.currentlyDragging=!0}.bind(this),y=function(){if(s.setConnectionBeingDragged(!1),l&&null!=l.endpoints){var t=s.getDropEvent(arguments),e=s.getFloatingAnchorIndex(l);if(l.endpoints[0===e?1:0].anchor.unlock(),l.removeClass(s.draggingClass),this._jsPlumb&&(l.deleteConnectionNow||l.endpoints[e]===this._jsPlumb.floatingEndpoint)&&u&&l.suspendedEndpoint){0===e?(l.floatingElement=l.source,l.floatingId=l.sourceId,l.floatingEndpoint=l.endpoints[0],l.floatingIndex=0,l.source=h[0],l.sourceId=h[1]):(l.floatingElement=l.target,l.floatingId=l.targetId,l.floatingEndpoint=l.endpoints[1],l.floatingIndex=1,l.target=h[0],l.targetId=h[1]);var n=this._jsPlumb.floatingEndpoint;s.setDragScope(h[2],h[3]),l.endpoints[e]=l.suspendedEndpoint,l.isReattach()||l._forceReattach||l._forceDetach||!s.deleteConnection(l,{originalEvent:t})?(l.setHover(!1),l._forceDetach=null,l._forceReattach=null,this._jsPlumb.floatingEndpoint.detachFromConnection(l),l.suspendedEndpoint.addConnection(l),1===e?s.anchorManager.updateOtherEndpoint(l.sourceId,l.floatingId,l.targetId,l):s.anchorManager.sourceChanged(l.floatingId,l.sourceId,l,l.source),s.repaint(h[1])):s.deleteObject({endpoint:n})}this.deleteAfterDragStop?s.deleteObject({endpoint:this}):this._jsPlumb&&this.paint({recalc:!1}),s.fire("connectionDragStop",l,t),l.pending&&s.fire("connectionAborted",l,t),s.currentlyDragging=!1,l.suspendedElement=null,l.suspendedEndpoint=null,l=null}a&&a.element&&s.remove(a.element,!1,!1),this._jsPlumb&&(this.canvas.style.visibility="visible",this.anchor.unlock(),this._jsPlumb.floatingEndpoint=null)}.bind(this);(p=t.extend({},p)).scope=this.scope||p.scope,p[v]=e.wrap(p[v],function(t){n=t.e.payload||{}},!1),p[f]=e.wrap(p[f],b,!1),p[m]=e.wrap(p[m],d.drag),p[g]=e.wrap(p[g],y),p.multipleDrop=!1,p.canDrag=function(){return this.isSource||this.isTemporarySource||this.connections.length>0&&!1!==this.connectionsDetachable}.bind(this),s.initDraggable(this.canvas,p,"internal"),this.canvas._jsPlumbRelatedElement=this.element,c=!0}};var h=i.endpoint||this._jsPlumb.instance.Defaults.Endpoint||t.Defaults.Endpoint;this.setEndpoint(h,!0);var d=i.anchor?i.anchor:i.anchors?i.anchors:s.Defaults.Anchor||"Top";this.setAnchor(d,!0);var p=["default",i.type||""].join(" ");this.addType(p,i.data,!0),this.canvas=this.endpoint.canvas,this.canvas._jsPlumb=this,this.initDraggable();var f=function(n,o,r,a){if(t.isDropSupported(this.element)){var l=i.dropOptions||s.Defaults.DropOptions||t.Defaults.DropOptions;(l=t.extend({},l)).scope=l.scope||this.scope;var u=t.dragEvents.drop,c=t.dragEvents.over,h=t.dragEvents.out,d=this,p=s.EndpointDropHandler({getEndpoint:function(){return d},jsPlumb:s,enabled:function(){return null==r||r.isEnabled()},isFull:function(){return r.isFull()},element:this.element,elementId:this.elementId,isSource:this.isSource,isTarget:this.isTarget,addClass:function(t){d.addClass(t)},removeClass:function(t){d.removeClass(t)},isDropAllowed:function(){return d.isDropAllowed.apply(d,arguments)},reference:a,isRedrop:function(t,e){return t.suspendedEndpoint&&e.reference&&t.suspendedEndpoint.id===e.reference.id}});l[u]=e.wrap(l[u],p,!0),l[c]=e.wrap(l[c],function(){var e=t.getDragObject(arguments),n=s.getAttribute(t.getElement(e),"dragId"),i=s.getFloatingConnectionFor(n);if(null!=i){var o=s.getFloatingAnchorIndex(i);if(this.isTarget&&0!==o||i.suspendedEndpoint&&this.referenceEndpoint&&this.referenceEndpoint.id===i.suspendedEndpoint.id){var r=s.checkCondition("checkDropAllowed",{sourceEndpoint:i.endpoints[o],targetEndpoint:this,connection:i});this[(r?"add":"remove")+"Class"](s.endpointDropAllowedClass),this[(r?"remove":"add")+"Class"](s.endpointDropForbiddenClass),i.endpoints[o].anchor.over(this.anchor,this)}}}.bind(this)),l[h]=e.wrap(l[h],function(){var e=t.getDragObject(arguments),n=null==e?null:s.getAttribute(t.getElement(e),"dragId"),i=n?s.getFloatingConnectionFor(n):null;if(null!=i){var o=s.getFloatingAnchorIndex(i);(this.isTarget&&0!==o||i.suspendedEndpoint&&this.referenceEndpoint&&this.referenceEndpoint.id===i.suspendedEndpoint.id)&&(this.removeClass(s.endpointDropAllowedClass),this.removeClass(s.endpointDropForbiddenClass),i.endpoints[o].anchor.out())}}.bind(this)),s.initDroppable(n,l,"internal",o)}}.bind(this);return this.anchor.isFloating||f(this.canvas,!(i._transient||this.anchor.isFloating),this,i.reference),this},e.extend(t.Endpoint,t.OverlayCapableJsPlumbUIComponent,{setVisible:function(t,e,n){if(this._jsPlumb.visible=t,this.canvas&&(this.canvas.style.display=t?"block":"none"),this[t?"showOverlays":"hideOverlays"](),!e)for(var i=0;i<this.connections.length;i++)if(this.connections[i].setVisible(t),!n){var s=this===this.connections[i].endpoints[0]?1:0;1===this.connections[i].endpoints[s].connections.length&&this.connections[i].endpoints[s].setVisible(t,!0,!0)}},getAttachedElements:function(){return this.connections},applyType:function(e,i){this.setPaintStyle(e.endpointStyle||e.paintStyle,i),this.setHoverPaintStyle(e.endpointHoverStyle||e.hoverPaintStyle,i),null!=e.maxConnections&&(this._jsPlumb.maxConnections=e.maxConnections),e.scope&&(this.scope=e.scope),t.extend(this,e,n),null!=e.cssClass&&this.canvas&&this._jsPlumb.instance.addClass(this.canvas,e.cssClass),t.OverlayCapableJsPlumbUIComponent.applyType(this,e)},isEnabled:function(){return this._jsPlumb.enabled},setEnabled:function(t){this._jsPlumb.enabled=t},cleanup:function(){var e=this._jsPlumb.instance.endpointAnchorClassPrefix+(this._jsPlumb.currentAnchorClass?"-"+this._jsPlumb.currentAnchorClass:"");t.removeClass(this.element,e),this.anchor=null,this.endpoint.cleanup(!0),this.endpoint.destroy(),this.endpoint=null,this._jsPlumb.instance.destroyDraggable(this.canvas,"internal"),this._jsPlumb.instance.destroyDroppable(this.canvas,"internal")},setHover:function(t){this.endpoint&&this._jsPlumb&&!this._jsPlumb.instance.isConnectionBeingDragged()&&this.endpoint.setHover(t)},isFull:function(){return 0===this._jsPlumb.maxConnections||!(this.isFloating()||this._jsPlumb.maxConnections<0||this.connections.length<this._jsPlumb.maxConnections)},isFloating:function(){return null!=this.anchor&&this.anchor.isFloating},isConnectedTo:function(t){var e=!1;if(t)for(var n=0;n<this.connections.length;n++)if(this.connections[n].endpoints[1]===t||this.connections[n].endpoints[0]===t){e=!0;break}return e},getConnectionCost:function(){return this._jsPlumb.connectionCost},setConnectionCost:function(t){this._jsPlumb.connectionCost=t},areConnectionsDirected:function(){return this._jsPlumb.connectionsDirected},setConnectionsDirected:function(t){this._jsPlumb.connectionsDirected=t},setElementId:function(t){this.elementId=t,this.anchor.elementId=t},setReferenceElement:function(e){this.element=t.getElement(e)},setDragAllowedWhenFull:function(t){this.dragAllowedWhenFull=t},equals:function(t){return this.anchor.equals(t.anchor)},getUuid:function(){return this._jsPlumb.uuid},computeAnchor:function(t){return this.anchor.compute(t)}}),this.jsPlumbInstance.prototype.EndpointDropHandler=function(t){return function(n){var i=t.jsPlumb;t.removeClass(i.endpointDropAllowedClass),t.removeClass(i.endpointDropForbiddenClass);var s=i.getDropEvent(arguments),o=i.getDragObject(arguments),r=i.getAttribute(o,"dragId"),a=(i.getAttribute(o,"elId"),i.getAttribute(o,"originalScope")),l=i.getFloatingConnectionFor(r);if(null!=l){var u=null!=l.suspendedEndpoint;if(!u||null!=l.suspendedEndpoint._jsPlumb){var c=t.getEndpoint(l);if(null!=c){if(t.isRedrop(l,t))return l._forceReattach=!0,l.setHover(!1),void(t.maybeCleanup&&t.maybeCleanup(c));var h=i.getFloatingAnchorIndex(l);if(0===h&&!t.isSource||1===h&&!t.isTarget)t.maybeCleanup&&t.maybeCleanup(c);else{t.onDrop&&t.onDrop(l),a&&i.setDragScope(o,a);var d=t.isFull(n);if(d&&c.fire("maxConnections",{endpoint:this,connection:l,maxConnections:c._jsPlumb.maxConnections},s),!d&&t.enabled()){var p=!0;0===h?(l.floatingElement=l.source,l.floatingId=l.sourceId,l.floatingEndpoint=l.endpoints[0],l.floatingIndex=0,l.source=t.element,l.sourceId=t.elementId):(l.floatingElement=l.target,l.floatingId=l.targetId,l.floatingEndpoint=l.endpoints[1],l.floatingIndex=1,l.target=t.element,l.targetId=t.elementId),u&&l.suspendedEndpoint.id!==c.id&&(l.isDetachAllowed(l)&&l.endpoints[h].isDetachAllowed(l)&&l.suspendedEndpoint.isDetachAllowed(l)&&i.checkCondition("beforeDetach",l)||(p=!1));var f=function(n){l.endpoints[h].detachFromConnection(l),l.suspendedEndpoint&&l.suspendedEndpoint.detachFromConnection(l),l.endpoints[h]=c,c.addConnection(l);var o=c.getParameters();for(var r in o)l.setParameter(r,o[r]);if(u){var a=l.suspendedEndpoint.elementId;i.fireMoveEvent({index:h,originalSourceId:0===h?a:l.sourceId,newSourceId:0===h?c.elementId:l.sourceId,originalTargetId:1===h?a:l.targetId,newTargetId:1===h?c.elementId:l.targetId,originalSourceEndpoint:0===h?l.suspendedEndpoint:l.endpoints[0],newSourceEndpoint:0===h?c:l.endpoints[0],originalTargetEndpoint:1===h?l.suspendedEndpoint:l.endpoints[1],newTargetEndpoint:1===h?c:l.endpoints[1],connection:l},s)}else o.draggable&&i.initDraggable(this.element,t.dragOptions,"internal",i);(1===h?i.anchorManager.updateOtherEndpoint(l.sourceId,l.floatingId,l.targetId,l):i.anchorManager.sourceChanged(l.floatingId,l.sourceId,l,l.source),l.endpoints[0].finalEndpoint)&&(l.endpoints[0].detachFromConnection(l),l.endpoints[0]=l.endpoints[0].finalEndpoint,l.endpoints[0].addConnection(l));e.isObject(n)&&l.mergeData(n),i.finaliseConnection(l,null,s,!1),l.setHover(!1),i.revalidate(l.endpoints[0].element)}.bind(this);if(p=p&&t.isDropAllowed(l.sourceId,l.targetId,l.scope,l,c))return f(p),!0;l.suspendedEndpoint&&(l.endpoints[h]=l.suspendedEndpoint,l.setHover(!1),l._forceDetach=!0,0===h?(l.source=l.suspendedEndpoint.element,l.sourceId=l.suspendedEndpoint.elementId):(l.target=l.suspendedEndpoint.element,l.targetId=l.suspendedEndpoint.elementId),l.suspendedEndpoint.addConnection(l),1===h?i.anchorManager.updateOtherEndpoint(l.sourceId,l.floatingId,l.targetId,l):i.anchorManager.sourceChanged(l.floatingId,l.sourceId,l,l.source),i.repaint(l.sourceId),l._forceDetach=!1)}t.maybeCleanup&&t.maybeCleanup(c),i.currentlyDragging=!1}}}}}}}.call("undefined"!=typeof window?window:this),function(){"use strict";var t=this,e=t.jsPlumb,n=t.jsPlumbUtil,i=function(t,i,s,o,r){if(e.Connectors[i]=e.Connectors[i]||{},null==e.Connectors[i][s]){if(null==e.Connectors[s]){if(t.Defaults.DoNotThrowErrors)return null;throw new TypeError("jsPlumb: unknown connector type '"+s+"'")}e.Connectors[i][s]=function(){e.Connectors[s].apply(this,arguments),e.ConnectorRenderers[i].apply(this,arguments)},n.extend(e.Connectors[i][s],[e.Connectors[s],e.ConnectorRenderers[i]])}return new e.Connectors[i][s](o,r)},s=function(t,e,n){return t?n.makeAnchor(t,e,n):null},o=function(t,e,i,s){null!=e&&(e._jsPlumbConnections=e._jsPlumbConnections||{},s?delete e._jsPlumbConnections[t.id]:e._jsPlumbConnections[t.id]=!0,n.isEmpty(e._jsPlumbConnections)?i.removeClass(e,i.connectedClass):i.addClass(e,i.connectedClass))};e.Connection=function(t){var i=t.newEndpoint;this.id=t.id,this.connector=null,this.idPrefix="_jsplumb_c_",this.defaultLabelLocation=.5,this.defaultOverlayKeys=["Overlays","ConnectionOverlays"],this.previousConnection=t.previousConnection,this.source=e.getElement(t.source),this.target=e.getElement(t.target),e.OverlayCapableJsPlumbUIComponent.apply(this,arguments),t.sourceEndpoint?(this.source=t.sourceEndpoint.getElement(),this.sourceId=t.sourceEndpoint.elementId):this.sourceId=this._jsPlumb.instance.getId(this.source),t.targetEndpoint?(this.target=t.targetEndpoint.getElement(),this.targetId=t.targetEndpoint.elementId):this.targetId=this._jsPlumb.instance.getId(this.target),this.scope=t.scope,this.endpoints=[],this.endpointStyles=[];var s=this._jsPlumb.instance;s.manage(this.sourceId,this.source),s.manage(this.targetId,this.target),this._jsPlumb.visible=!0,this._jsPlumb.params={cssClass:t.cssClass,container:t.container,"pointer-events":t["pointer-events"],editorParams:t.editorParams,overlays:t.overlays},this._jsPlumb.lastPaintedAt=null,this.bind("mouseover",function(){this.setHover(!0)}.bind(this)),this.bind("mouseout",function(){this.setHover(!1)}.bind(this)),this.makeEndpoint=function(e,n,o,r,a){return o=o||this._jsPlumb.instance.getId(n),this.prepareEndpoint(s,i,this,r,e?0:1,t,n,o,a)},t.type&&(t.endpoints=t.endpoints||this._jsPlumb.instance.deriveEndpointAndAnchorSpec(t.type).endpoints);var o=this.makeEndpoint(!0,this.source,this.sourceId,t.sourceEndpoint),r=this.makeEndpoint(!1,this.target,this.targetId,t.targetEndpoint);o&&n.addToList(t.endpointsByElement,this.sourceId,o),r&&n.addToList(t.endpointsByElement,this.targetId,r),this.scope||(this.scope=this.endpoints[0].scope),null!=t.deleteEndpointsOnEmpty&&(this.endpoints[0].setDeleteOnEmpty(t.deleteEndpointsOnEmpty),this.endpoints[1].setDeleteOnEmpty(t.deleteEndpointsOnEmpty));var a=s.Defaults.ConnectionsDetachable;!1===t.detachable&&(a=!1),!1===this.endpoints[0].connectionsDetachable&&(a=!1),!1===this.endpoints[1].connectionsDetachable&&(a=!1);var l=t.reattach||this.endpoints[0].reattachConnections||this.endpoints[1].reattachConnections||s.Defaults.ReattachConnections;this.appendToDefaultType({detachable:a,reattach:l,paintStyle:this.endpoints[0].connectorStyle||this.endpoints[1].connectorStyle||t.paintStyle||s.Defaults.PaintStyle||e.Defaults.PaintStyle,hoverPaintStyle:this.endpoints[0].connectorHoverStyle||this.endpoints[1].connectorHoverStyle||t.hoverPaintStyle||s.Defaults.HoverPaintStyle||e.Defaults.HoverPaintStyle});var u=s.getSuspendedAt();if(!s.isSuspendDrawing()){var c=s.getCachedData(this.sourceId),h=c.o,d=c.s,p=s.getCachedData(this.targetId),f=p.o,g=p.s,m=u||s.timestamp(),v=this.endpoints[0].anchor.compute({xy:[h.left,h.top],wh:d,element:this.endpoints[0],elementId:this.endpoints[0].elementId,txy:[f.left,f.top],twh:g,tElement:this.endpoints[1],timestamp:m});this.endpoints[0].paint({anchorLoc:v,timestamp:m}),v=this.endpoints[1].anchor.compute({xy:[f.left,f.top],wh:g,element:this.endpoints[1],elementId:this.endpoints[1].elementId,txy:[h.left,h.top],twh:d,tElement:this.endpoints[0],timestamp:m}),this.endpoints[1].paint({anchorLoc:v,timestamp:m})}this.getTypeDescriptor=function(){return"connection"},this.getAttachedElements=function(){return this.endpoints},this.isDetachable=function(t){return!1!==this._jsPlumb.detachable&&(null!=t?!0===t.connectionsDetachable:!0===this._jsPlumb.detachable)},this.setDetachable=function(t){this._jsPlumb.detachable=!0===t},this.isReattach=function(){return!0===this._jsPlumb.reattach||!0===this.endpoints[0].reattachConnections||!0===this.endpoints[1].reattachConnections},this.setReattach=function(t){this._jsPlumb.reattach=!0===t},this._jsPlumb.cost=t.cost||this.endpoints[0].getConnectionCost(),this._jsPlumb.directed=t.directed,null==t.directed&&(this._jsPlumb.directed=this.endpoints[0].areConnectionsDirected());var b=e.extend({},this.endpoints[1].getParameters());e.extend(b,this.endpoints[0].getParameters()),e.extend(b,this.getParameters()),this.setParameters(b),this.setConnector(this.endpoints[0].connector||this.endpoints[1].connector||t.connector||s.Defaults.Connector||e.Defaults.Connector,!0);var y=null!=t.data&&n.isObject(t.data)?t.data:{};this.getData=function(){return y},this.setData=function(t){y=t||{}},this.mergeData=function(t){y=e.extend(y,t)};var P=["default",this.endpoints[0].connectionType,this.endpoints[1].connectionType,t.type].join(" ");/[^\s]/.test(P)&&this.addType(P,t.data,!0),this.updateConnectedClass()},n.extend(e.Connection,e.OverlayCapableJsPlumbUIComponent,{applyType:function(t,n,i){var s=null;null!=t.connector&&(null==(s=this.getCachedTypeItem("connector",i.connector))&&(s=this.prepareConnector(t.connector,i.connector),this.cacheTypeItem("connector",s,i.connector)),this.setPreparedConnector(s)),null!=t.detachable&&this.setDetachable(t.detachable),null!=t.reattach&&this.setReattach(t.reattach),t.scope&&(this.scope=t.scope),null!=t.cssClass&&this.canvas&&this._jsPlumb.instance.addClass(this.canvas,t.cssClass);var o=null;t.anchor?null==(o=this.getCachedTypeItem("anchors",i.anchor))&&(o=[this._jsPlumb.instance.makeAnchor(t.anchor),this._jsPlumb.instance.makeAnchor(t.anchor)],this.cacheTypeItem("anchors",o,i.anchor)):t.anchors&&null==(o=this.getCachedTypeItem("anchors",i.anchors))&&(o=[this._jsPlumb.instance.makeAnchor(t.anchors[0]),this._jsPlumb.instance.makeAnchor(t.anchors[1])],this.cacheTypeItem("anchors",o,i.anchors)),null!=o&&(this.endpoints[0].anchor=o[0],this.endpoints[1].anchor=o[1],this.endpoints[1].anchor.isDynamic&&this._jsPlumb.instance.repaint(this.endpoints[1].elementId)),e.OverlayCapableJsPlumbUIComponent.applyType(this,t)},addClass:function(t,e){e&&(this.endpoints[0].addClass(t),this.endpoints[1].addClass(t),this.suspendedEndpoint&&this.suspendedEndpoint.addClass(t)),this.connector&&this.connector.addClass(t)},removeClass:function(t,e){e&&(this.endpoints[0].removeClass(t),this.endpoints[1].removeClass(t),this.suspendedEndpoint&&this.suspendedEndpoint.removeClass(t)),this.connector&&this.connector.removeClass(t)},isVisible:function(){return this._jsPlumb.visible},setVisible:function(t){this._jsPlumb.visible=t,this.connector&&this.connector.setVisible(t),this.repaint()},cleanup:function(){this.updateConnectedClass(!0),this.endpoints=null,this.source=null,this.target=null,null!=this.connector&&(this.connector.cleanup(!0),this.connector.destroy(!0)),this.connector=null},updateConnectedClass:function(t){this._jsPlumb&&(o(this,this.source,this._jsPlumb.instance,t),o(this,this.target,this._jsPlumb.instance,t))},setHover:function(e){this.connector&&this._jsPlumb&&!this._jsPlumb.instance.isConnectionBeingDragged()&&(this.connector.setHover(e),t.jsPlumb[e?"addClass":"removeClass"](this.source,this._jsPlumb.instance.hoverSourceClass),t.jsPlumb[e?"addClass":"removeClass"](this.target,this._jsPlumb.instance.hoverTargetClass))},getUuids:function(){return[this.endpoints[0].getUuid(),this.endpoints[1].getUuid()]},getCost:function(){return this._jsPlumb?this._jsPlumb.cost:-1/0},setCost:function(t){this._jsPlumb.cost=t},isDirected:function(){return this._jsPlumb.directed},getConnector:function(){return this.connector},prepareConnector:function(t,e){var s,o={_jsPlumb:this._jsPlumb.instance,cssClass:this._jsPlumb.params.cssClass,container:this._jsPlumb.params.container,"pointer-events":this._jsPlumb.params["pointer-events"]},r=this._jsPlumb.instance.getRenderMode();return n.isString(t)?s=i(this._jsPlumb.instance,r,t,o,this):n.isArray(t)&&(s=1===t.length?i(this._jsPlumb.instance,r,t[0],o,this):i(this._jsPlumb.instance,r,t[0],n.merge(t[1],o),this)),null!=e&&(s.typeId=e),s},setPreparedConnector:function(t,e,n,i){if(this.connector!==t){var s,o="";if(null!=this.connector&&(o=(s=this.connector).getClass(),this.connector.cleanup(),this.connector.destroy()),this.connector=t,i&&this.cacheTypeItem("connector",t,i),this.canvas=this.connector.canvas,this.bgCanvas=this.connector.bgCanvas,this.connector.reattach(this._jsPlumb.instance),this.addClass(o),this.canvas&&(this.canvas._jsPlumb=this),this.bgCanvas&&(this.bgCanvas._jsPlumb=this),null!=s)for(var r=this.getOverlays(),a=0;a<r.length;a++)r[a].transfer&&r[a].transfer(this.connector);n||this.setListenerComponent(this.connector),e||this.repaint()}},setConnector:function(t,e,n,i){var s=this.prepareConnector(t,i);this.setPreparedConnector(s,e,n,i)},paint:function(t){if(!this._jsPlumb.instance.isSuspendDrawing()&&this._jsPlumb.visible){var e=(t=t||{}).timestamp,n=this.targetId,i=this.sourceId;if(null==e||e!==this._jsPlumb.lastPaintedAt){var s=this._jsPlumb.instance.updateOffset({elId:i}).o,o=this._jsPlumb.instance.updateOffset({elId:n}).o,r=this.endpoints[0],a=this.endpoints[1],l=r.anchor.getCurrentLocation({xy:[s.left,s.top],wh:[s.width,s.height],element:r,timestamp:e}),u=a.anchor.getCurrentLocation({xy:[o.left,o.top],wh:[o.width,o.height],element:a,timestamp:e});if(this.connector.resetBounds(),this.connector.compute({sourcePos:l,targetPos:u,sourceOrientation:r.anchor.getOrientation(r),targetOrientation:a.anchor.getOrientation(a),sourceEndpoint:this.endpoints[0],targetEndpoint:this.endpoints[1],"stroke-width":this._jsPlumb.paintStyleInUse.strokeWidth,sourceInfo:s,targetInfo:o}),this.connector.bounds.minX===1/0||this.connector.bounds.maxX===-1/0||this.connector.bounds.minY===1/0||this.connector.bounds.maxY===-1/0)return;var c={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(var h in this._jsPlumb.overlays)if(this._jsPlumb.overlays.hasOwnProperty(h)){var d=this._jsPlumb.overlays[h];d.isVisible()&&(this._jsPlumb.overlayPlacements[h]=d.draw(this.connector,this._jsPlumb.paintStyleInUse,this.getAbsoluteOverlayPosition(d)),c.minX=Math.min(c.minX,this._jsPlumb.overlayPlacements[h].minX),c.maxX=Math.max(c.maxX,this._jsPlumb.overlayPlacements[h].maxX),c.minY=Math.min(c.minY,this._jsPlumb.overlayPlacements[h].minY),c.maxY=Math.max(c.maxY,this._jsPlumb.overlayPlacements[h].maxY))}var p=parseFloat(this._jsPlumb.paintStyleInUse.strokeWidth||1)/2,f=parseFloat(this._jsPlumb.paintStyleInUse.strokeWidth||0),g={xmin:Math.min(this.connector.bounds.minX-(p+f),c.minX),ymin:Math.min(this.connector.bounds.minY-(p+f),c.minY),xmax:Math.max(this.connector.bounds.maxX+(p+f),c.maxX),ymax:Math.max(this.connector.bounds.maxY+(p+f),c.maxY)};for(var m in this.connector.paintExtents=g,this.connector.paint(this._jsPlumb.paintStyleInUse,null,g),this._jsPlumb.overlays)if(this._jsPlumb.overlays.hasOwnProperty(m)){var v=this._jsPlumb.overlays[m];v.isVisible()&&v.paint(this._jsPlumb.overlayPlacements[m],g)}}this._jsPlumb.lastPaintedAt=e}},repaint:function(t){var e=jsPlumb.extend(t||{},{});e.elId=this.sourceId,this.paint(e)},prepareEndpoint:function(t,n,i,o,r,a,l,u,c){var h;if(o)i.endpoints[r]=o,o.addConnection(i);else{a.endpoints||(a.endpoints=[null,null]);var d=c||a.endpoints[r]||a.endpoint||t.Defaults.Endpoints[r]||e.Defaults.Endpoints[r]||t.Defaults.Endpoint||e.Defaults.Endpoint;a.endpointStyles||(a.endpointStyles=[null,null]),a.endpointHoverStyles||(a.endpointHoverStyles=[null,null]);var p=a.endpointStyles[r]||a.endpointStyle||t.Defaults.EndpointStyles[r]||e.Defaults.EndpointStyles[r]||t.Defaults.EndpointStyle||e.Defaults.EndpointStyle;null==p.fill&&null!=a.paintStyle&&(p.fill=a.paintStyle.stroke),null==p.outlineStroke&&null!=a.paintStyle&&(p.outlineStroke=a.paintStyle.outlineStroke),null==p.outlineWidth&&null!=a.paintStyle&&(p.outlineWidth=a.paintStyle.outlineWidth);var f=a.endpointHoverStyles[r]||a.endpointHoverStyle||t.Defaults.EndpointHoverStyles[r]||e.Defaults.EndpointHoverStyles[r]||t.Defaults.EndpointHoverStyle||e.Defaults.EndpointHoverStyle;null!=a.hoverPaintStyle&&(null==f&&(f={}),null==f.fill&&(f.fill=a.hoverPaintStyle.stroke));var g=a.anchors?a.anchors[r]:a.anchor?a.anchor:s(t.Defaults.Anchors[r],u,t)||s(e.Defaults.Anchors[r],u,t)||s(t.Defaults.Anchor,u,t)||s(e.Defaults.Anchor,u,t);h=n({paintStyle:p,hoverPaintStyle:f,endpoint:d,connections:[i],uuid:a.uuids?a.uuids[r]:null,anchor:g,source:l,scope:a.scope,reattach:a.reattach||t.Defaults.ReattachConnections,detachable:a.detachable||t.Defaults.ConnectionsDetachable}),null==o&&h.setDeleteOnEmpty(!0),i.endpoints[r]=h,!1===a.drawEndpoints&&h.setVisible(!1,!0,!0)}return h},replaceEndpoint:function(t,e){var n=this.endpoints[t],i=n.elementId,s=this._jsPlumb.instance.getEndpoints(i),o=s.indexOf(n),r=this.makeEndpoint(0===t,n.element,i,null,e);this.endpoints[t]=r,s.splice(o,1,r),this._jsPlumb.instance.deleteObject({endpoint:n,deleteAttachedObjects:!1}),this._jsPlumb.instance.fire("endpointReplaced",{previous:n,current:r}),this._jsPlumb.instance.anchorManager.updateOtherEndpoint(this.endpoints[0].elementId,this.endpoints[1].elementId,this.endpoints[1].elementId,this)}})}.call("undefined"!=typeof window?window:this),function(){"use strict";var t=this.jsPlumbUtil,e=this.jsPlumb;e.AnchorManager=function(n){var i={},s={},o={},r={},a=this,l={},u=n.jsPlumbInstance,c={},h=function(t,e){return e[0][0]-t[0][0]},d=function(t,e){return(t[0][0]<0?-Math.PI-t[0][0]:Math.PI-t[0][0])-(e[0][0]<0?-Math.PI-e[0][0]:Math.PI-e[0][0])},p={top:d,right:h,bottom:h,left:d},f=function(t,e){var n=u.getCachedData(t),i=n.s,r=n.o,a=function(e,n,i,r,a,l,u){if(r.length>0)for(var c=function(t,e,n,i,s,o,r){for(var a=[],l=e[s?0:1]/(i.length+1),u=0;u<i.length;u++){var c=(u+1)*l,h=o*e[s?1:0];r&&(c=e[s?0:1]-c);var d=s?c:h,p=n[0]+d,f=d/e[0],g=s?h:c,m=n[1]+g,v=g/e[1];a.push([p,m,f,v,i[u][1],i[u][2]])}return a}(0,n,i,(v=p[e],r.sort(v)),a,l,"right"===e||"top"===e),h=function(t,e){s[t.id]=[e[0],e[1],e[2],e[3]],o[t.id]=u},d=0;d<c.length;d++){var f=c[d][4],g=f.endpoints[0].elementId===t,m=f.endpoints[1].elementId===t;g&&h(f.endpoints[0],c[d]),m&&h(f.endpoints[1],c[d])}var v};a("bottom",i,[r.left,r.top],e.bottom,!0,1,[0,1]),a("top",i,[r.left,r.top],e.top,!0,0,[0,-1]),a("left",i,[r.left,r.top],e.left,!1,0,[-1,0]),a("right",i,[r.left,r.top],e.right,!1,1,[1,0])};this.reset=function(){i={},r={},l={}},this.addFloatingConnection=function(t,e){c[t]=e},this.removeFloatingConnection=function(t){delete c[t]},this.newConnection=function(n){var i=n.sourceId,s=n.targetId,o=n.endpoints,a=!0,l=function(l,u,c,h,d){i===s&&c.isContinuous&&(n._jsPlumb.instance.removeElement(o[1].canvas),a=!1),t.addToList(r,h,[d,u,c.constructor===e.DynamicAnchor])};l(0,o[0],o[0].anchor,s,n),a&&l(0,o[1],o[1].anchor,i,n)};var g=function(e){!function(e,n){if(e){var i=function(t){return t[4]===n};t.removeWithFunction(e.top,i),t.removeWithFunction(e.left,i),t.removeWithFunction(e.bottom,i),t.removeWithFunction(e.right,i)}}(l[e.elementId],e.id)};this.connectionDetached=function(e,n){var i=e.connection||e,s=e.sourceId,o=e.targetId,l=i.endpoints,u=function(e,n,i,s,o){t.removeWithFunction(r[s],function(t){return t[0].id===o.id})};u(0,l[1],l[1].anchor,s,i),u(0,l[0],l[0].anchor,o,i),i.floatingId&&(u(i.floatingIndex,i.floatingEndpoint,i.floatingEndpoint.anchor,i.floatingId,i),g(i.floatingEndpoint)),g(i.endpoints[0]),g(i.endpoints[1]),n||(a.redraw(i.sourceId),i.targetId!==i.sourceId&&a.redraw(i.targetId))},this.add=function(e,n){t.addToList(i,n,e)},this.changeId=function(t,e){r[e]=r[t],i[e]=i[t],delete r[t],delete i[t]},this.getConnectionsFor=function(t){return r[t]||[]},this.getEndpointsFor=function(t){return i[t]||[]},this.deleteEndpoint=function(e){t.removeWithFunction(i[e.elementId],function(t){return t.id===e.id}),g(e)},this.clearFor=function(t){delete i[t],i[t]=[]};var m=function(e,i,s,o,r,a,l,u,c,h,d,p){var f,g,m=-1,v=o.endpoints[l],b=v.id,y=[1,0][l],P=[[i,s],o,r,a,b],x=e[c],_=v._continuousAnchorEdge?e[v._continuousAnchorEdge]:null;if(_){var C=t.findWithFunction(_,function(t){return t[4]===b});if(-1!==C)for(_.splice(C,1),f=0;f<_.length;f++)g=_[f][1],t.addWithFunction(d,g,function(t){return t.id===g.id}),t.addWithFunction(p,_[f][1].endpoints[l],function(t){return t.id===g.endpoints[l].id}),t.addWithFunction(p,_[f][1].endpoints[y],function(t){return t.id===g.endpoints[y].id})}for(f=0;f<x.length;f++)g=x[f][1],1===n.idx&&x[f][3]===a&&-1===m&&(m=f),t.addWithFunction(d,g,function(t){return t.id===g.id}),t.addWithFunction(p,x[f][1].endpoints[l],function(t){return t.id===g.endpoints[l].id}),t.addWithFunction(p,x[f][1].endpoints[y],function(t){return t.id===g.endpoints[y].id});var j=u?-1!==m?m:0:x.length;x.splice(j,0,P),v._continuousAnchorEdge=c};this.updateOtherEndpoint=function(n,i,s,o){var a=t.findWithFunction(r[n],function(t){return t[0].id===o.id}),l=t.findWithFunction(r[i],function(t){return t[0].id===o.id});-1!==a&&(r[n][a][0]=o,r[n][a][1]=o.endpoints[1],r[n][a][2]=o.endpoints[1].anchor.constructor===e.DynamicAnchor),l>-1&&(r[i].splice(l,1),t.addToList(r,s,[o,o.endpoints[0],o.endpoints[0].anchor.constructor===e.DynamicAnchor])),o.updateConnectedClass()},this.sourceChanged=function(n,i,s,o){if(n!==i){s.sourceId=i,s.source=o,t.removeWithFunction(r[n],function(t){return t[0].id===s.id});var a=t.findWithFunction(r[s.targetId],function(t){return t[0].id===s.id});a>-1&&(r[s.targetId][a][0]=s,r[s.targetId][a][1]=s.endpoints[0],r[s.targetId][a][2]=s.endpoints[0].anchor.constructor===e.DynamicAnchor),t.addToList(r,i,[s,s.endpoints[1],s.endpoints[1].anchor.constructor===e.DynamicAnchor]),s.endpoints[1].anchor.isContinuous&&(s.source===s.target?s._jsPlumb.instance.removeElement(s.endpoints[1].canvas):null==s.endpoints[1].canvas.parentNode&&s._jsPlumb.instance.appendElement(s.endpoints[1].canvas)),s.updateConnectedClass()}},this.rehomeEndpoint=function(t,e,n){var s=i[e]||[],o=u.getId(n);if(o!==e){var r=s.indexOf(t);if(r>-1){var l=s.splice(r,1)[0];a.add(l,o)}}for(var c=0;c<t.connections.length;c++)t.connections[c].sourceId===e?a.sourceChanged(e,t.elementId,t.connections[c],t.element):t.connections[c].targetId===e&&(t.connections[c].targetId=t.elementId,t.connections[c].target=t.element,a.updateOtherEndpoint(t.connections[c].sourceId,e,t.elementId,t.connections[c]))},this.redraw=function(n,s,o,a,h,d){if(!u.isSuspendDrawing()){var p=i[n]||[],g=r[n]||[],v=[],b=[],y=[];o=o||u.timestamp(),a=a||{left:0,top:0},s&&(s={left:s.left+a.left,top:s.top+a.top});for(var P=u.updateOffset({elId:n,offset:s,recalc:!1,timestamp:o}),x={},_=0;_<g.length;_++){var C=g[_][0],j=C.sourceId,E=C.targetId,S=C.endpoints[0].anchor.isContinuous,D=C.endpoints[1].anchor.isContinuous;if(S||D){var w=j+"_"+E,I=x[w],A=C.sourceId===n?1:0;S&&!l[j]&&(l[j]={top:[],right:[],bottom:[],left:[]}),D&&!l[E]&&(l[E]={top:[],right:[],bottom:[],left:[]}),n!==E&&u.updateOffset({elId:E,timestamp:o}),n!==j&&u.updateOffset({elId:j,timestamp:o});var k=u.getCachedData(E),M=u.getCachedData(j);E===j&&(S||D)?(m(l[j],-Math.PI/2,0,C,!1,E,0,!1,"top",0,v,b),m(l[E],-Math.PI/2,0,C,!1,j,1,!1,"top",0,v,b)):(I||(I=this.calculateOrientation(j,E,M.o,k.o,C.endpoints[0].anchor,C.endpoints[1].anchor,C),x[w]=I),S&&m(l[j],I.theta,0,C,!1,E,0,!1,I.a[0],0,v,b),D&&m(l[E],I.theta2,-1,C,!0,j,1,!0,I.a[1],0,v,b)),S&&t.addWithFunction(y,j,function(t){return t===j}),D&&t.addWithFunction(y,E,function(t){return t===E}),t.addWithFunction(v,C,function(t){return t.id===C.id}),(S&&0===A||D&&1===A)&&t.addWithFunction(b,C.endpoints[A],function(t){return t.id===C.endpoints[A].id})}}for(_=0;_<p.length;_++)0===p[_].connections.length&&p[_].anchor.isContinuous&&(l[n]||(l[n]={top:[],right:[],bottom:[],left:[]}),m(l[n],-Math.PI/2,0,{endpoints:[p[_],p[_]],paint:function(){}},!1,n,0,!1,p[_].anchor.getDefaultFace(),0,v,b),t.addWithFunction(y,n,function(t){return t===n}));for(_=0;_<y.length;_++)f(y[_],l[y[_]]);for(_=0;_<p.length;_++)p[_].paint({timestamp:o,offset:P,dimensions:P.s,recalc:!0!==d});for(_=0;_<b.length;_++){var O=u.getCachedData(b[_].elementId);b[_].paint({timestamp:null,offset:O,dimensions:O.s})}for(_=0;_<g.length;_++){var T=g[_][1];if(T.anchor.constructor===e.DynamicAnchor){T.paint({elementWithPrecedence:n,timestamp:o}),t.addWithFunction(v,g[_][0],function(t){return t.id===g[_][0].id});for(var L=0;L<T.connections.length;L++)T.connections[L]!==g[_][0]&&t.addWithFunction(v,T.connections[L],function(t){return t.id===T.connections[L].id})}else t.addWithFunction(v,g[_][0],function(t){return t.id===g[_][0].id})}var F=c[n];for(F&&F.paint({timestamp:o,recalc:!1,elId:n}),_=0;_<v.length;_++)v[_].paint({elId:n,timestamp:null,recalc:!1,clearEdits:h})}};var v=function(e){t.EventGenerator.apply(this),this.type="Continuous",this.isDynamic=!0,this.isContinuous=!0;for(var n=e.faces||["top","right","bottom","left"],i=!(!1===e.clockwise),r={},a={top:"bottom",right:"left",left:"right",bottom:"top"},l={top:"right",right:"bottom",left:"top",bottom:"left"},u={top:"left",right:"top",left:"bottom",bottom:"right"},c=i?l:u,h=i?u:l,d=e.cssClass||"",p=null,f=null,g=["left","right"],m=["top","bottom"],v=null,b=0;b<n.length;b++)r[n[b]]=!0;this.getDefaultFace=function(){return 0===n.length?"top":n[0]},this.isRelocatable=function(){return!0},this.isSnapOnRelocate=function(){return!0},this.verifyEdge=function(t){return r[t]?t:r[a[t]]?a[t]:r[c[t]]?c[t]:r[h[t]]?h[t]:t},this.isEdgeSupported=function(t){return null==v?null==f?!0===r[t]:f===t:-1!==v.indexOf(t)},this.setCurrentFace=function(t,e){p=t,e&&null!=f&&(f=p)},this.getCurrentFace=function(){return p},this.getSupportedFaces=function(){var t=[];for(var e in r)r[e]&&t.push(e);return t},this.lock=function(){f=p},this.unlock=function(){f=null},this.isLocked=function(){return null!=f},this.lockCurrentAxis=function(){null!=p&&(v="left"===p||"right"===p?g:m)},this.unlockCurrentAxis=function(){v=null},this.compute=function(t){return s[t.element.id]||[0,0]},this.getCurrentLocation=function(t){return s[t.element.id]||[0,0]},this.getOrientation=function(t){return o[t.id]||[0,0]},this.getCssClass=function(){return d}};u.continuousAnchorFactory={get:function(t){return new v(t)},clear:function(t){delete s[t]}}},e.AnchorManager.prototype.calculateOrientation=function(t,e,n,i,s,o){var r=["left","top","right","bottom"];if(t===e)return{orientation:"identity",a:["top","top"]};var a=Math.atan2(i.centery-n.centery,i.centerx-n.centerx),l=Math.atan2(n.centery-i.centery,n.centerx-i.centerx),u=[],c={};!function(t,e){for(var n=0;n<t.length;n++)c[t[n]]={left:[e[n].left,e[n].centery],right:[e[n].right,e[n].centery],top:[e[n].centerx,e[n].top],bottom:[e[n].centerx,e[n].bottom]}}(["source","target"],[n,i]);for(var h=0;h<r.length;h++)for(var d=0;d<r.length;d++)u.push({source:r[h],target:r[d],dist:Biltong.lineLength(c.source[r[h]],c.target[r[d]])});u.sort(function(t,e){return t.dist<e.dist?-1:t.dist>e.dist?1:0});for(var p=u[0].source,f=u[0].target,g=0;g<u.length&&(p=!s.isContinuous||s.isEdgeSupported(u[g].source)?u[g].source:null,f=!o.isContinuous||o.isEdgeSupported(u[g].target)?u[g].target:null,null==p||null==f);g++);return s.isContinuous&&s.setCurrentFace(p),o.isContinuous&&o.setCurrentFace(f),{a:[p,f],theta:a,theta2:l}},e.Anchor=function(e){this.x=e.x||0,this.y=e.y||0,this.elementId=e.elementId,this.cssClass=e.cssClass||"",this.userDefinedLocation=null,this.orientation=e.orientation||[0,0],this.lastReturnValue=null,this.offsets=e.offsets||[0,0],this.timestamp=null;var n=!1!==e.relocatable;this.isRelocatable=function(){return n},this.setRelocatable=function(t){n=t};var i=!1!==e.snapOnRelocate;this.isSnapOnRelocate=function(){return i};var s=!1;this.lock=function(){s=!0},this.unlock=function(){s=!1},this.isLocked=function(){return s},t.EventGenerator.apply(this),this.compute=function(t){var e=t.xy,n=t.wh,i=t.timestamp;return t.clearUserDefinedLocation&&(this.userDefinedLocation=null),i&&i===this.timestamp?this.lastReturnValue:(null!=this.userDefinedLocation?this.lastReturnValue=this.userDefinedLocation:this.lastReturnValue=[e[0]+this.x*n[0]+this.offsets[0],e[1]+this.y*n[1]+this.offsets[1],this.x,this.y],this.timestamp=i,this.lastReturnValue)},this.getCurrentLocation=function(t){return t=t||{},null==this.lastReturnValue||null!=t.timestamp&&this.timestamp!==t.timestamp?this.compute(t):this.lastReturnValue},this.setPosition=function(t,e,n,i,o){s&&!o||(this.x=t,this.y=e,this.orientation=[n,i],this.lastReturnValue=null)}},t.extend(e.Anchor,t.EventGenerator,{equals:function(t){if(!t)return!1;var e=t.getOrientation(),n=this.getOrientation();return this.x===t.x&&this.y===t.y&&this.offsets[0]===t.offsets[0]&&this.offsets[1]===t.offsets[1]&&n[0]===e[0]&&n[1]===e[1]},getUserDefinedLocation:function(){return this.userDefinedLocation},setUserDefinedLocation:function(t){this.userDefinedLocation=t},clearUserDefinedLocation:function(){this.userDefinedLocation=null},getOrientation:function(){return this.orientation},getCssClass:function(){return this.cssClass}}),e.FloatingAnchor=function(t){e.Anchor.apply(this,arguments);var n=t.reference,i=t.referenceCanvas,s=e.getSize(i),o=null,r=null;this.orientation=null,this.x=0,this.y=0,this.isFloating=!0,this.compute=function(t){var e=t.xy,n=[e[0]+s[0]/2,e[1]+s[1]/2];return r=n,n},this.getOrientation=function(t){if(o)return o;var e=n.getOrientation(t);return[0*Math.abs(e[0])*-1,0*Math.abs(e[1])*-1]},this.over=function(t,e){o=t.getOrientation(e)},this.out=function(){o=null},this.getCurrentLocation=function(t){return null==r?this.compute(t):r}},t.extend(e.FloatingAnchor,e.Anchor);e.DynamicAnchor=function(t){e.Anchor.apply(this,arguments),this.isDynamic=!0,this.anchors=[],this.elementId=t.elementId,this.jsPlumbInstance=t.jsPlumbInstance;for(var n=0;n<t.anchors.length;n++)this.anchors[n]=(i=t.anchors[n],s=this.jsPlumbInstance,o=this.elementId,i.constructor===e.Anchor?i:s.makeAnchor(i,o,s));var i,s,o;this.getAnchors=function(){return this.anchors};var r=this.anchors.length>0?this.anchors[0]:null,a=r,l=this,u=function(t,e,n,i,s){var o=i[0]+t.x*s[0],r=i[1]+t.y*s[1],a=i[0]+s[0]/2,l=i[1]+s[1]/2;return Math.sqrt(Math.pow(e-o,2)+Math.pow(n-r,2))+Math.sqrt(Math.pow(a-o,2)+Math.pow(l-r,2))},c=t.selector||function(t,e,n,i,s){for(var o=n[0]+i[0]/2,r=n[1]+i[1]/2,a=-1,l=1/0,c=0;c<s.length;c++){var h=u(s[c],o,r,t,e);h<l&&(a=c+0,l=h)}return s[a]};this.compute=function(t){var e=t.xy,n=t.wh,i=t.txy,s=t.twh;this.timestamp=t.timestamp;var o=l.getUserDefinedLocation();return null!=o?o:this.isLocked()||null==i||null==s?r.compute(t):(t.timestamp=null,r=c(e,n,i,s,this.anchors),this.x=r.x,this.y=r.y,r!==a&&this.fire("anchorChanged",r),a=r,r.compute(t))},this.getCurrentLocation=function(t){return this.getUserDefinedLocation()||(null!=r?r.getCurrentLocation(t):null)},this.getOrientation=function(t){return null!=r?r.getOrientation(t):[0,0]},this.over=function(t,e){null!=r&&r.over(t,e)},this.out=function(){null!=r&&r.out()},this.setAnchor=function(t){r=t},this.getCssClass=function(){return r&&r.getCssClass()||""},this.setAnchorCoordinates=function(t){var e=jsPlumbUtil.findWithFunction(this.anchors,function(e){return e.x===t[0]&&e.y===t[1]});return-1!==e&&(this.setAnchor(this.anchors[e]),!0)}},t.extend(e.DynamicAnchor,e.Anchor);var n=function(t,n,i,s,o,r){e.Anchors[o]=function(e){var a=e.jsPlumbInstance.makeAnchor([t,n,i,s,0,0],e.elementId,e.jsPlumbInstance);return a.type=o,r&&r(a,e),a}};n(.5,0,0,-1,"TopCenter"),n(.5,1,0,1,"BottomCenter"),n(0,.5,-1,0,"LeftMiddle"),n(1,.5,1,0,"RightMiddle"),n(.5,0,0,-1,"Top"),n(.5,1,0,1,"Bottom"),n(0,.5,-1,0,"Left"),n(1,.5,1,0,"Right"),n(.5,.5,0,0,"Center"),n(1,0,0,-1,"TopRight"),n(1,1,0,1,"BottomRight"),n(0,0,0,-1,"TopLeft"),n(0,1,0,1,"BottomLeft"),e.Defaults.DynamicAnchors=function(t){return t.jsPlumbInstance.makeAnchors(["TopCenter","RightMiddle","BottomCenter","LeftMiddle"],t.elementId,t.jsPlumbInstance)},e.Anchors.AutoDefault=function(t){var n=t.jsPlumbInstance.makeDynamicAnchor(e.Defaults.DynamicAnchors(t));return n.type="AutoDefault",n};var i=function(t,n){e.Anchors[t]=function(e){var i=e.jsPlumbInstance.makeAnchor(["Continuous",{faces:n}],e.elementId,e.jsPlumbInstance);return i.type=t,i}};e.Anchors.Continuous=function(t){return t.jsPlumbInstance.continuousAnchorFactory.get(t)},i("ContinuousLeft",["left"]),i("ContinuousTop",["top"]),i("ContinuousBottom",["bottom"]),i("ContinuousRight",["right"]),n(0,0,0,0,"Assign",function(t,e){var n=e.position||"Fixed";t.positionFinder=n.constructor===String?e.jsPlumbInstance.AnchorPositionFinders[n]:n,t.constructorParams=e}),this.jsPlumbInstance.prototype.AnchorPositionFinders={Fixed:function(t,e,n){return[(t.left-e.left)/n[0],(t.top-e.top)/n[1]]},Grid:function(t,e,n,i){var s=t.left-e.left,o=t.top-e.top,r=n[0]/i.grid[0],a=n[1]/i.grid[1],l=Math.floor(s/r),u=Math.floor(o/a);return[(l*r+r/2)/n[0],(u*a+a/2)/n[1]]}},e.Anchors.Perimeter=function(t){var e=(t=t||{}).anchorCount||60,n=t.shape;if(!n)throw new Error("no shape supplied to Perimeter Anchor type");var i=function(){for(var t=2*Math.PI/e,n=0,i=[],s=0;s<e;s++){var o=.5+.5*Math.sin(n),r=.5+.5*Math.cos(n);i.push([o,r,0,0]),n+=t}return i},s=function(t){for(var n=e/t.length,i=[],s=function(t,s,o,r,a,l,u){for(var c=(o-t)/(n=e*a),h=(r-s)/n,d=0;d<n;d++)i.push([t+c*d,s+h*d,null==l?0:l,null==u?0:u])},o=0;o<t.length;o++)s.apply(null,t[o]);return i},o=function(t){for(var e=[],n=0;n<t.length;n++)e.push([t[n][0],t[n][1],t[n][2],t[n][3],1/t.length,t[n][4],t[n][5]]);return s(e)},r=function(){return o([[0,0,1,0,0,-1],[1,0,1,1,1,0],[1,1,0,1,0,1],[0,1,0,0,-1,0]])},a={Circle:i,Ellipse:i,Diamond:function(){return o([[.5,0,1,.5],[1,.5,.5,1],[.5,1,0,.5],[0,.5,.5,0]])},Rectangle:r,Square:r,Triangle:function(){return o([[.5,0,1,1],[1,1,0,1],[0,1,.5,0]])},Path:function(t){for(var e=t.points,n=[],i=0,o=0;o<e.length-1;o++){var r=Math.sqrt(Math.pow(e[o][2]-e[o][0])+Math.pow(e[o][3]-e[o][1]));i+=r,n.push([e[o][0],e[o][1],e[o+1][0],e[o+1][1],r])}for(var a=0;a<n.length;a++)n[a][4]=n[a][4]/i;return s(n)}};if(!a[n])throw new Error("Shape ["+n+"] is unknown by Perimeter Anchor type");var l=a[n](t);t.rotation&&(l=function(t,e){for(var n=[],i=e/180*Math.PI,s=0;s<t.length;s++){var o=t[s][0]-.5,r=t[s][1]-.5;n.push([o*Math.cos(i)-r*Math.sin(i)+.5,o*Math.sin(i)+r*Math.cos(i)+.5,t[s][2],t[s][3]])}return n}(l,t.rotation));var u=t.jsPlumbInstance.makeDynamicAnchor(l);return u.type="Perimeter",u}}.call("undefined"!=typeof window?window:this),function(){"use strict";var t=this,e=t.jsPlumb,n=t.jsPlumbUtil,i=t.Biltong;e.Segments={AbstractSegment:function(t){this.params=t,this.findClosestPointOnPath=function(t,e){return{d:1/0,x:null,y:null,l:null}},this.getBounds=function(){return{minX:Math.min(t.x1,t.x2),minY:Math.min(t.y1,t.y2),maxX:Math.max(t.x1,t.x2),maxY:Math.max(t.y1,t.y2)}},this.lineIntersection=function(t,e,n,i){return[]},this.boxIntersection=function(t,e,n,i){var s=[];return s.push.apply(s,this.lineIntersection(t,e,t+n,e)),s.push.apply(s,this.lineIntersection(t+n,e,t+n,e+i)),s.push.apply(s,this.lineIntersection(t+n,e+i,t,e+i)),s.push.apply(s,this.lineIntersection(t,e+i,t,e)),s},this.boundingBoxIntersection=function(t){return this.boxIntersection(t.x,t.y,t.w,t.y)}},Straight:function(t){var n,s,o,r,a,l,u;e.Segments.AbstractSegment.apply(this,arguments);this.type="Straight",this.getLength=function(){return n},this.getGradient=function(){return s},this.getCoordinates=function(){return{x1:r,y1:l,x2:a,y2:u}},this.setCoordinates=function(t){r=t.x1,l=t.y1,a=t.x2,u=t.y2,n=Math.sqrt(Math.pow(a-r,2)+Math.pow(u-l,2)),s=i.gradient({x:r,y:l},{x:a,y:u}),o=-1/s},this.setCoordinates({x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}),this.getBounds=function(){return{minX:Math.min(r,a),minY:Math.min(l,u),maxX:Math.max(r,a),maxY:Math.max(l,u)}},this.pointOnPath=function(t,e){if(0!==t||e){if(1!==t||e){var s=e?t>0?t:n+t:t*n;return i.pointOnLine({x:r,y:l},{x:a,y:u},s)}return{x:a,y:u}}return{x:r,y:l}},this.gradientAtPoint=function(t){return s},this.pointAlongPathFrom=function(t,e,n){var s=this.pointOnPath(t,n),o=e<=0?{x:r,y:l}:{x:a,y:u};return e<=0&&Math.abs(e)>1&&(e*=-1),i.pointOnLine(s,o,e)};var c=function(t,e,n){return n>=Math.min(t,e)&&n<=Math.max(t,e)},h=function(t,e,n){return Math.abs(n-t)<Math.abs(n-e)?t:e};this.findClosestPointOnPath=function(t,e){var d={d:1/0,x:null,y:null,l:null,x1:r,x2:a,y1:l,y2:u};if(0===s)d.y=l,d.x=c(r,a,t)?t:h(r,a,t);else if(s===1/0||s===-1/0)d.x=r,d.y=c(l,u,e)?e:h(l,u,e);else{var p=l-s*r,f=(e-o*t-p)/(s-o),g=s*f+p;d.x=c(r,a,f)?f:h(r,a,f),d.y=c(l,u,g)?g:h(l,u,g)}var m=i.lineLength([d.x,d.y],[r,l]);return d.d=i.lineLength([t,e],[d.x,d.y]),d.l=m/n,d};var d=function(t,e,n){return n>e?e<=t&&t<=n:e>=t&&t>=n};this.lineIntersection=function(t,e,n,o){var c=Math.abs(i.gradient({x:t,y:e},{x:n,y:o})),h=Math.abs(s),p=h===1/0?r:l-h*r,f=[],g=c===1/0?t:e-c*t;if(c!==h)if(c===1/0&&0===h)d(t,r,a)&&d(l,e,o)&&(f=[t,l]);else if(0===c&&h===1/0)d(e,l,u)&&d(r,t,n)&&(f=[r,e]);else{var m,v;c===1/0?d(m=t,r,a)&&d(v=h*t+p,e,o)&&(f=[m,v]):0===c?d(v=e,l,u)&&d(m=(e-p)/h,t,n)&&(f=[m,v]):(v=h*(m=(g-p)/(h-c))+p,d(m,r,a)&&d(v,l,u)&&(f=[m,v]))}return f},this.boxIntersection=function(t,e,n,i){var s=[];return s.push.apply(s,this.lineIntersection(t,e,t+n,e)),s.push.apply(s,this.lineIntersection(t+n,e,t+n,e+i)),s.push.apply(s,this.lineIntersection(t+n,e+i,t,e+i)),s.push.apply(s,this.lineIntersection(t,e+i,t,e)),s},this.boundingBoxIntersection=function(t){return this.boxIntersection(t.x,t.y,t.w,t.h)}},Arc:function(t){e.Segments.AbstractSegment.apply(this,arguments);var n=function(e,n){return i.theta([t.cx,t.cy],[e,n])},s=2*Math.PI;this.radius=t.r,this.anticlockwise=t.ac,this.type="Arc",t.startAngle&&t.endAngle?(this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.x1=t.cx+this.radius*Math.cos(t.startAngle),this.y1=t.cy+this.radius*Math.sin(t.startAngle),this.x2=t.cx+this.radius*Math.cos(t.endAngle),this.y2=t.cy+this.radius*Math.sin(t.endAngle)):(this.startAngle=n(t.x1,t.y1),this.endAngle=n(t.x2,t.y2),this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2),this.endAngle<0&&(this.endAngle+=s),this.startAngle<0&&(this.startAngle+=s);var o=this.endAngle<this.startAngle?this.endAngle+s:this.endAngle;this.sweep=Math.abs(o-this.startAngle),this.anticlockwise&&(this.sweep=s-this.sweep);var r=2*Math.PI*this.radius,a=this.sweep/s,l=r*a;this.getLength=function(){return l},this.getBounds=function(){return{minX:t.cx-t.r,maxX:t.cx+t.r,minY:t.cy-t.r,maxY:t.cy+t.r}};var u=function(t){var e=Math.floor(t),n=Math.ceil(t);return t-e<1e-10?e:n-t<1e-10?n:t};this.pointOnPath=function(e,n){if(0===e)return{x:this.x1,y:this.y1,theta:this.startAngle};if(1===e)return{x:this.x2,y:this.y2,theta:this.endAngle};n&&(e/=l);var i=function(t,e){if(t.anticlockwise){var n=t.startAngle<t.endAngle?t.startAngle+s:t.startAngle;return n-Math.abs(n-t.endAngle)*e}var i=t.endAngle<t.startAngle?t.endAngle+s:t.endAngle,o=Math.abs(i-t.startAngle);return t.startAngle+o*e}(this,e),o=t.cx+t.r*Math.cos(i),r=t.cy+t.r*Math.sin(i);return{x:u(o),y:u(r),theta:i}},this.gradientAtPoint=function(e,n){var s=this.pointOnPath(e,n),o=i.normal([t.cx,t.cy],[s.x,s.y]);return this.anticlockwise||o!==1/0&&o!==-1/0||(o*=-1),o},this.pointAlongPathFrom=function(e,n,i){var s=this.pointOnPath(e,i),o=n/r*2*Math.PI,a=this.anticlockwise?-1:1,l=s.theta+a*o;return{x:t.cx+this.radius*Math.cos(l),y:t.cy+this.radius*Math.sin(l)}}},Bezier:function(n){this.curve=[{x:n.x1,y:n.y1},{x:n.cp1x,y:n.cp1y},{x:n.cp2x,y:n.cp2y},{x:n.x2,y:n.y2}];e.Segments.AbstractSegment.apply(this,arguments);this.bounds={minX:Math.min(n.x1,n.x2,n.cp1x,n.cp2x),minY:Math.min(n.y1,n.y2,n.cp1y,n.cp2y),maxX:Math.max(n.x1,n.x2,n.cp1x,n.cp2x),maxY:Math.max(n.y1,n.y2,n.cp1y,n.cp2y)},this.type="Bezier";var i=function(e,n,i){return i&&(n=t.jsBezier.locationAlongCurveFrom(e,n>0?0:1,n)),n};this.pointOnPath=function(e,n){return e=i(this.curve,e,n),t.jsBezier.pointOnCurve(this.curve,e)},this.gradientAtPoint=function(e,n){return e=i(this.curve,e,n),t.jsBezier.gradientAtPoint(this.curve,e)},this.pointAlongPathFrom=function(e,n,s){return e=i(this.curve,e,s),t.jsBezier.pointAlongCurveFrom(this.curve,e,n)},this.getLength=function(){return t.jsBezier.getLength(this.curve)},this.getBounds=function(){return this.bounds},this.findClosestPointOnPath=function(e,n){var i=t.jsBezier.nearestPointOnCurve({x:e,y:n},this.curve);return{d:Math.sqrt(Math.pow(i.point.x-e,2)+Math.pow(i.point.y-n,2)),x:i.point.x,y:i.point.y,l:1-i.location,s:this}},this.lineIntersection=function(e,n,i,s){return t.jsBezier.lineIntersection(e,n,i,s,this.curve)}}},e.SegmentRenderer={getPath:function(t,e){return{Straight:function(e){var n=t.getCoordinates();return(e?"M "+n.x1+" "+n.y1+" ":"")+"L "+n.x2+" "+n.y2},Bezier:function(e){var n=t.params;return(e?"M "+n.x2+" "+n.y2+" ":"")+"C "+n.cp2x+" "+n.cp2y+" "+n.cp1x+" "+n.cp1y+" "+n.x1+" "+n.y1},Arc:function(e){var n=t.params,i=t.sweep>Math.PI?1:0,s=t.anticlockwise?0:1;return(e?"M"+t.x1+" "+t.y1+" ":"")+"A "+t.radius+" "+n.r+" 0 "+i+","+s+" "+t.x2+" "+t.y2}}[t.type](e)}};var s=function(){this.resetBounds=function(){this.bounds={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}},this.resetBounds()};e.Connectors.AbstractConnector=function(t){s.apply(this,arguments);var o=[],r=0,a=[],l=[],u=t.stub||0,c=n.isArray(u)?u[0]:u,h=n.isArray(u)?u[1]:u,d=t.gap||0,p=n.isArray(d)?d[0]:d,f=n.isArray(d)?d[1]:d,g=null,m=null;this.getPathData=function(){for(var t="",n=0;n<o.length;n++)t+=e.SegmentRenderer.getPath(o[n],0===n),t+=" ";return t},this.findSegmentForPoint=function(t,e){for(var n={d:1/0,s:null,x:null,y:null,l:null},i=0;i<o.length;i++){var s=o[i].findClosestPointOnPath(t,e);s.d<n.d&&(n.d=s.d,n.l=s.l,n.x=s.x,n.y=s.y,n.s=o[i],n.x1=s.x1,n.x2=s.x2,n.y1=s.y1,n.y2=s.y2,n.index=i,n.connectorLocation=a[i][0]+s.l*(a[i][1]-a[i][0]))}return n},this.lineIntersection=function(t,e,n,i){for(var s=[],r=0;r<o.length;r++)s.push.apply(s,o[r].lineIntersection(t,e,n,i));return s},this.boxIntersection=function(t,e,n,i){for(var s=[],r=0;r<o.length;r++)s.push.apply(s,o[r].boxIntersection(t,e,n,i));return s},this.boundingBoxIntersection=function(t){for(var e=[],n=0;n<o.length;n++)e.push.apply(e,o[n].boundingBoxIntersection(t));return e};var v=function(t,e){e&&(t=t>0?t/r:(r+t)/r);for(var n=a.length-1,i=1,s=0;s<a.length;s++)if(a[s][1]>=t){n=s,i=1===t?1:0===t?0:(t-a[s][0])/l[s];break}return{segment:o[n],proportion:i,index:n}};this.setSegments=function(t){g=[],r=0;for(var e=0;e<t.length;e++)g.push(t[e]),r+=t[e].getLength()},this.getLength=function(){return r};var b=function(t){this.strokeWidth=t.strokeWidth;var e=i.quadrant(t.sourcePos,t.targetPos),n=t.targetPos[0]<t.sourcePos[0],s=t.targetPos[1]<t.sourcePos[1],o=t.strokeWidth||1,r=t.sourceEndpoint.anchor.getOrientation(t.sourceEndpoint),a=t.targetEndpoint.anchor.getOrientation(t.targetEndpoint),l=n?t.targetPos[0]:t.sourcePos[0],u=s?t.targetPos[1]:t.sourcePos[1],d=Math.abs(t.targetPos[0]-t.sourcePos[0]),g=Math.abs(t.targetPos[1]-t.sourcePos[1]);if(0===r[0]&&0===r[1]||0===a[0]&&0===a[1]){var m=d>g?0:1,v=[1,0][m];a=[],(r=[])[m]=t.sourcePos[m]>t.targetPos[m]?-1:1,a[m]=t.sourcePos[m]>t.targetPos[m]?1:-1,r[v]=0,a[v]=0}var b=n?d+p*r[0]:p*r[0],y=s?g+p*r[1]:p*r[1],P=n?f*a[0]:d+f*a[0],x=s?f*a[1]:g+f*a[1],_=r[0]*a[0]+r[1]*a[1],C={sx:b,sy:y,tx:P,ty:x,lw:o,xSpan:Math.abs(P-b),ySpan:Math.abs(x-y),mx:(b+P)/2,my:(y+x)/2,so:r,to:a,x:l,y:u,w:d,h:g,segment:e,startStubX:b+r[0]*c,startStubY:y+r[1]*c,endStubX:P+a[0]*h,endStubY:x+a[1]*h,isXGreaterThanStubTimes2:Math.abs(b-P)>c+h,isYGreaterThanStubTimes2:Math.abs(y-x)>c+h,opposite:-1===_,perpendicular:0===_,orthogonal:1===_,sourceAxis:0===r[0]?"y":"x",points:[l,u,d,g,b,y,P,x],stubs:[c,h]};return C.anchorOrientation=C.opposite?"opposite":C.orthogonal?"orthogonal":"perpendicular",C};this.getSegments=function(){return o},this.updateBounds=function(t){var e=t.getBounds();this.bounds.minX=Math.min(this.bounds.minX,e.minX),this.bounds.maxX=Math.max(this.bounds.maxX,e.maxX),this.bounds.minY=Math.min(this.bounds.minY,e.minY),this.bounds.maxY=Math.max(this.bounds.maxY,e.maxY)};return this.pointOnPath=function(t,e){var n=v(t,e);return n.segment&&n.segment.pointOnPath(n.proportion,!1)||[0,0]},this.gradientAtPoint=function(t,e){var n=v(t,e);return n.segment&&n.segment.gradientAtPoint(n.proportion,!1)||0},this.pointAlongPathFrom=function(t,e,n){var i=v(t,n);return i.segment&&i.segment.pointAlongPathFrom(i.proportion,e,!1)||[0,0]},this.compute=function(t){m=b.call(this,t),r=o.length=a.length=l.length=0,this._compute(m,t),this.x=m.points[0],this.y=m.points[1],this.w=m.points[2],this.h=m.points[3],this.segment=m.segment,function(){for(var t=0,e=0;e<o.length;e++){var n=o[e].getLength();l[e]=n/r,a[e]=[t,t+=n/r]}}()},{addSegment:function(t,n,i){if(i.x1!==i.x2||i.y1!==i.y2){var s=new e.Segments[n](i);o.push(s),r+=s.getLength(),t.updateBounds(s)}},prepareCompute:b,sourceStub:c,targetStub:h,maxStub:Math.max(c,h),sourceGap:p,targetGap:f,maxGap:Math.max(p,f)}},n.extend(e.Connectors.AbstractConnector,s),e.Endpoints.AbstractEndpoint=function(t){return s.apply(this,arguments),{compute:this.compute=function(t,e,n,i){var s=this._compute.apply(this,arguments);return this.x=s[0],this.y=s[1],this.w=s[2],this.h=s[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,s},cssClass:t.cssClass}},n.extend(e.Endpoints.AbstractEndpoint,s),e.Endpoints.Dot=function(t){this.type="Dot";e.Endpoints.AbstractEndpoint.apply(this,arguments);t=t||{},this.radius=t.radius||10,this.defaultOffset=.5*this.radius,this.defaultInnerRadius=this.radius/3,this._compute=function(t,e,n,i){this.radius=n.radius||this.radius;var s=t[0]-this.radius,o=t[1]-this.radius,r=2*this.radius,a=2*this.radius;if(n.stroke){var l=n.strokeWidth||1;s-=l,o-=l,r+=2*l,a+=2*l}return[s,o,r,a,this.radius]}},n.extend(e.Endpoints.Dot,e.Endpoints.AbstractEndpoint),e.Endpoints.Rectangle=function(t){this.type="Rectangle";e.Endpoints.AbstractEndpoint.apply(this,arguments);t=t||{},this.width=t.width||20,this.height=t.height||20,this._compute=function(t,e,n,i){var s=n.width||this.width,o=n.height||this.height;return[t[0]-s/2,t[1]-o/2,s,o]}},n.extend(e.Endpoints.Rectangle,e.Endpoints.AbstractEndpoint);var o=function(t){e.jsPlumbUIComponent.apply(this,arguments),this._jsPlumb.displayElements=[]};n.extend(o,e.jsPlumbUIComponent,{getDisplayElements:function(){return this._jsPlumb.displayElements},appendDisplayElement:function(t){this._jsPlumb.displayElements.push(t)}}),e.Endpoints.Image=function(i){this.type="Image",o.apply(this,arguments),e.Endpoints.AbstractEndpoint.apply(this,arguments);var s=i.onload,r=i.src||i.url,a=i.cssClass?" "+i.cssClass:"";this._jsPlumb.img=new Image,this._jsPlumb.ready=!1,this._jsPlumb.initialized=!1,this._jsPlumb.deleted=!1,this._jsPlumb.widthToUse=i.width,this._jsPlumb.heightToUse=i.height,this._jsPlumb.endpoint=i.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,s&&s(this))}.bind(this),this._jsPlumb.endpoint.setImage=function(t,e){var n=t.constructor===String?t:t.src;s=e,this._jsPlumb.img.src=n,null!=this.canvas&&this.canvas.setAttribute("src",this._jsPlumb.img.src)}.bind(this),this._jsPlumb.endpoint.setImage(r,s),this._compute=function(t,e,n,i){return this.anchorPoint=t,this._jsPlumb.ready?[t[0]-this._jsPlumb.widthToUse/2,t[1]-this._jsPlumb.heightToUse/2,this._jsPlumb.widthToUse,this._jsPlumb.heightToUse]:[0,0,0,0]},this.canvas=e.createElement("img",{position:"absolute",margin:0,padding:0,outline:0},this._jsPlumb.instance.endpointClass+a),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(t,e,i){if(!this._jsPlumb.deleted){this._jsPlumb.initialized||(this.canvas.setAttribute("src",this._jsPlumb.img.src),this.appendDisplayElement(this.canvas),this._jsPlumb.initialized=!0);var s=this.anchorPoint[0]-this._jsPlumb.widthToUse/2,o=this.anchorPoint[1]-this._jsPlumb.heightToUse/2;n.sizeElement(this.canvas,s,o,this._jsPlumb.widthToUse,this._jsPlumb.heightToUse)}},this.paint=function(e,n){null!=this._jsPlumb&&(this._jsPlumb.ready?this.actuallyPaint(e,n):t.setTimeout(function(){this.paint(e,n)}.bind(this),200))}},n.extend(e.Endpoints.Image,[o,e.Endpoints.AbstractEndpoint],{cleanup:function(t){t&&(this._jsPlumb.deleted=!0,this.canvas&&this.canvas.parentNode.removeChild(this.canvas),this.canvas=null)}}),e.Endpoints.Blank=function(t){e.Endpoints.AbstractEndpoint.apply(this,arguments);this.type="Blank",o.apply(this,arguments),this._compute=function(t,e,n,i){return[t[0],t[1],10,0]};var i=t.cssClass?" "+t.cssClass:"";this.canvas=e.createElement("div",{display:"block",width:"1px",height:"1px",background:"transparent",position:"absolute"},this._jsPlumb.instance.endpointClass+i),this._jsPlumb.instance.appendElement(this.canvas),this.paint=function(t,e){n.sizeElement(this.canvas,this.x,this.y,this.w,this.h)}},n.extend(e.Endpoints.Blank,[e.Endpoints.AbstractEndpoint,o],{cleanup:function(){this.canvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}}),e.Endpoints.Triangle=function(t){this.type="Triangle",e.Endpoints.AbstractEndpoint.apply(this,arguments);var n=this;(t=t||{}).width=t.width||55,t.height=t.height||55,this.width=t.width,this.height=t.height,this._compute=function(t,e,i,s){var o=i.width||n.width,r=i.height||n.height;return[t[0]-o/2,t[1]-r/2,o,r]}};var r=e.Overlays.AbstractOverlay=function(t){this.visible=!0,this.isAppendedAtTopLevel=!0,this.component=t.component,this.loc=null==t.location?.5:t.location,this.endpointLoc=null==t.endpointLocation?[.5,.5]:t.endpointLocation,this.visible=!1!==t.visible};r.prototype={cleanup:function(t){t&&(this.component=null,this.canvas=null,this.endpointLoc=null)},reattach:function(t,e){},setVisible:function(t){this.visible=t,this.component.repaint()},isVisible:function(){return this.visible},hide:function(){this.setVisible(!1)},show:function(){this.setVisible(!0)},incrementLocation:function(t){this.loc+=t,this.component.repaint()},setLocation:function(t){this.loc=t,this.component.repaint()},getLocation:function(){return this.loc},updateFrom:function(){}},e.Overlays.Arrow=function(t){this.type="Arrow",r.apply(this,arguments),this.isAppendedAtTopLevel=!1,t=t||{};var s=this;this.length=t.length||20,this.width=t.width||20,this.id=t.id,this.direction=(t.direction||1)<0?-1:1;var o=t.paintStyle||{"stroke-width":1},a=t.foldback||.623;this.computeMaxSize=function(){return 1.5*s.width},this.elementCreated=function(n,i){if(this.path=n,t.events)for(var s in t.events)e.on(n,s,t.events[s])},this.draw=function(t,e){var s,r,l,u;if(t.pointAlongPathFrom){if(n.isString(this.loc)||this.loc>1||this.loc<0){var c=parseInt(this.loc,10),h=this.loc<0?1:0;s=t.pointAlongPathFrom(h,c,!1),r=t.pointAlongPathFrom(h,c-this.direction*this.length/2,!1),l=i.pointOnLine(s,r,this.length)}else if(1===this.loc){if(s=t.pointOnPath(this.loc),r=t.pointAlongPathFrom(this.loc,-this.length),l=i.pointOnLine(s,r,this.length),-1===this.direction){var d=l;l=s,s=d}}else if(0===this.loc){if(l=t.pointOnPath(this.loc),r=t.pointAlongPathFrom(this.loc,this.length),s=i.pointOnLine(l,r,this.length),-1===this.direction){var p=l;l=s,s=p}}else s=t.pointAlongPathFrom(this.loc,this.direction*this.length/2),r=t.pointOnPath(this.loc),l=i.pointOnLine(s,r,this.length);var f={hxy:s,tail:u=i.perpendicularLineTo(s,l,this.width),cxy:i.pointOnLine(s,l,a*this.length)},g=o.stroke||e.stroke,m=o.fill||e.stroke;return{component:t,d:f,"stroke-width":o.strokeWidth||e.strokeWidth,stroke:g,fill:m,minX:Math.min(s.x,u[0].x,u[1].x),maxX:Math.max(s.x,u[0].x,u[1].x),minY:Math.min(s.y,u[0].y,u[1].y),maxY:Math.max(s.y,u[0].y,u[1].y)}}return{component:t,minX:0,maxX:0,minY:0,maxY:0}}},n.extend(e.Overlays.Arrow,r,{updateFrom:function(t){this.length=t.length||this.length,this.width=t.width||this.width,this.direction=null!=t.direction?t.direction:this.direction,this.foldback=t.foldback||this.foldback},cleanup:function(){this.path&&this.canvas&&this.canvas.removeChild(this.path)}}),e.Overlays.PlainArrow=function(t){t=t||{};var n=e.extend(t,{foldback:1});e.Overlays.Arrow.call(this,n),this.type="PlainArrow"},n.extend(e.Overlays.PlainArrow,e.Overlays.Arrow),e.Overlays.Diamond=function(t){var n=(t=t||{}).length||40,i=e.extend(t,{length:n/2,foldback:2});e.Overlays.Arrow.call(this,i),this.type="Diamond"},n.extend(e.Overlays.Diamond,e.Overlays.Arrow);var a=function(t,e){return(null==t._jsPlumb.cachedDimensions||e)&&(t._jsPlumb.cachedDimensions=t.getDimensions()),t._jsPlumb.cachedDimensions},l=function(t){e.jsPlumbUIComponent.apply(this,arguments),r.apply(this,arguments);var i=this.fire;this.fire=function(){i.apply(this,arguments),this.component&&this.component.fire.apply(this.component,arguments)},this.detached=!1,this.id=t.id,this._jsPlumb.div=null,this._jsPlumb.initialised=!1,this._jsPlumb.component=t.component,this._jsPlumb.cachedDimensions=null,this._jsPlumb.create=t.create,this._jsPlumb.initiallyInvisible=!1===t.visible,this.getElement=function(){if(null==this._jsPlumb.div){var n=this._jsPlumb.div=e.getElement(this._jsPlumb.create(this._jsPlumb.component));n.style.position="absolute",jsPlumb.addClass(n,this._jsPlumb.instance.overlayClass+" "+(this.cssClass?this.cssClass:t.cssClass?t.cssClass:"")),this._jsPlumb.instance.appendElement(n),this._jsPlumb.instance.getId(n),this.canvas=n;var i="translate(-50%, -50%)";n.style.webkitTransform=i,n.style.mozTransform=i,n.style.msTransform=i,n.style.oTransform=i,n.style.transform=i,n._jsPlumb=this,!1===t.visible&&(n.style.display="none")}return this._jsPlumb.div},this.draw=function(t,e,i){var s=a(this);if(null!=s&&2===s.length){var o={x:0,y:0};if(i)o={x:i[0],y:i[1]};else if(t.pointOnPath){var r=this.loc,l=!1;(n.isString(this.loc)||this.loc<0||this.loc>1)&&(r=parseInt(this.loc,10),l=!0),o=t.pointOnPath(r,l)}else{var u=this.loc.constructor===Array?this.loc:this.endpointLoc;o={x:u[0]*t.w,y:u[1]*t.h}}var c=o.x-s[0]/2,h=o.y-s[1]/2;return{component:t,d:{minx:c,miny:h,td:s,cxy:o},minX:c,maxX:c+s[0],minY:h,maxY:h+s[1]}}return{minX:0,maxX:0,minY:0,maxY:0}}};n.extend(l,[e.jsPlumbUIComponent,r],{getDimensions:function(){return[1,1]},setVisible:function(t){this._jsPlumb.div&&(this._jsPlumb.div.style.display=t?"block":"none",t&&this._jsPlumb.initiallyInvisible&&(a(this,!0),this.component.repaint(),this._jsPlumb.initiallyInvisible=!1))},clearCachedDimensions:function(){this._jsPlumb.cachedDimensions=null},cleanup:function(t){t?null!=this._jsPlumb.div&&(this._jsPlumb.div._jsPlumb=null,this._jsPlumb.instance.removeElement(this._jsPlumb.div)):(this._jsPlumb&&this._jsPlumb.div&&this._jsPlumb.div.parentNode&&this._jsPlumb.div.parentNode.removeChild(this._jsPlumb.div),this.detached=!0)},reattach:function(t,e){null!=this._jsPlumb.div&&t.getContainer().appendChild(this._jsPlumb.div),this.detached=!1},computeMaxSize:function(){var t=a(this);return Math.max(t[0],t[1])},paint:function(t,e){this._jsPlumb.initialised||(this.getElement(),t.component.appendDisplayElement(this._jsPlumb.div),this._jsPlumb.initialised=!0,this.detached&&this._jsPlumb.div.parentNode.removeChild(this._jsPlumb.div)),this._jsPlumb.div.style.left=t.component.x+t.d.minx+"px",this._jsPlumb.div.style.top=t.component.y+t.d.miny+"px"}}),e.Overlays.Custom=function(t){this.type="Custom",l.apply(this,arguments)},n.extend(e.Overlays.Custom,l),e.Overlays.GuideLines=function(){var t=this;t.length=50,t.strokeWidth=5,this.type="GuideLines",r.apply(this,arguments),e.jsPlumbUIComponent.apply(this,arguments),this.draw=function(e,n){var s=e.pointAlongPathFrom(t.loc,t.length/2),o=e.pointOnPath(t.loc),r=i.pointOnLine(s,o,t.length),a=i.perpendicularLineTo(s,r,40),l=i.perpendicularLineTo(r,s,20);return{connector:e,head:s,tail:r,headLine:l,tailLine:a,minX:Math.min(s.x,r.x,l[0].x,l[1].x),minY:Math.min(s.y,r.y,l[0].y,l[1].y),maxX:Math.max(s.x,r.x,l[0].x,l[1].x),maxY:Math.max(s.y,r.y,l[0].y,l[1].y)}}},e.Overlays.Label=function(t){this.labelStyle=t.labelStyle;this.cssClass=null!=this.labelStyle?this.labelStyle.cssClass:null;var n=e.extend({create:function(){return e.createElement("div")}},t);if(e.Overlays.Custom.call(this,n),this.type="Label",this.label=t.label||"",this.labelText=null,this.labelStyle){var i=this.getElement();if(this.labelStyle.font=this.labelStyle.font||"12px sans-serif",i.style.font=this.labelStyle.font,i.style.color=this.labelStyle.color||"black",this.labelStyle.fill&&(i.style.background=this.labelStyle.fill),this.labelStyle.borderWidth>0){var s=this.labelStyle.borderStyle?this.labelStyle.borderStyle:"black";i.style.border=this.labelStyle.borderWidth+"px solid "+s}this.labelStyle.padding&&(i.style.padding=this.labelStyle.padding)}},n.extend(e.Overlays.Label,e.Overlays.Custom,{cleanup:function(t){t&&(this.div=null,this.label=null,this.labelText=null,this.cssClass=null,this.labelStyle=null)},getLabel:function(){return this.label},setLabel:function(t){this.label=t,this.labelText=null,this.clearCachedDimensions(),this.update(),this.component.repaint()},getDimensions:function(){return this.update(),l.prototype.getDimensions.apply(this,arguments)},update:function(){if("function"==typeof this.label){var t=this.label(this);this.getElement().innerHTML=t.replace(/\r\n/g,"<br/>")}else null==this.labelText&&(this.labelText=this.label,this.getElement().innerHTML=this.labelText.replace(/\r\n/g,"<br/>"))},updateFrom:function(t){null!=t.label&&this.setLabel(t.label)}})}.call("undefined"!=typeof window?window:this),function(){"use strict";var t=this,e=t.jsPlumbUtil,n=t.jsPlumbInstance,i="stop",s="revert",o="_jsPlumbGroup",r="show",a="hide",l=function(t){var n={},i={},s={},l=this;function u(e,n){for(var i=e.getMembers(),s=0;s<i.length;s++)t[n?r:a](i[s],!0)}t.bind("connection",function(t){null!=t.source[o]&&null!=t.target[o]&&t.source[o]===t.target[o]?(i[t.connection.id]=t.source[o],s[t.connection.id]=t.source[o]):(null!=t.source[o]&&(e.suggest(t.source[o].connections.source,t.connection),i[t.connection.id]=t.source[o]),null!=t.target[o]&&(e.suggest(t.target[o].connections.target,t.connection),s[t.connection.id]=t.target[o]))}),t.bind("internal.connectionDetached",function(t){!function(t){delete t.proxies;var n,o=i[t.id];null!=o&&(n=function(e){return e.id===t.id},e.removeWithFunction(o.connections.source,n),e.removeWithFunction(o.connections.target,n),delete i[t.id]),null!=(o=s[t.id])&&(n=function(e){return e.id===t.id},e.removeWithFunction(o.connections.source,n),e.removeWithFunction(o.connections.target,n),delete s[t.id])}(t.connection)}),t.bind("connectionMoved",function(t){var e=(0===t.index?i:s)[t.connection.id];if(e){var n=e.connections[0===t.index?"source":"target"],o=n.indexOf(t.connection);-1!==o&&n.splice(o,1)}}),this.addGroup=function(e){t.addClass(e.getEl(),"jtk-group-expanded"),n[e.id]=e,e.manager=this,d(e),t.fire("group:add",{group:e})},this.addToGroup=function(e,n,i){if(e=this.getGroup(e)){var s=e.getEl();if(n._isJsPlumbGroup)return;var o=n._jsPlumbGroup;if(o!==e){t.removeFromDragSelection(n);var r=t.getOffset(n,!0),a=e.collapsed?t.getOffset(s,!0):t.getOffset(e.getDragArea(),!0);null!=o&&(o.remove(n,!1,i,!1,e),l.updateConnectionsForGroup(o)),e.add(n,i);var u=function(t,n){var i=0===n?1:0;t.each(function(t){t.setVisible(!1),t.endpoints[i].element._jsPlumbGroup===e?(t.endpoints[i].setVisible(!1),h(t,i,e)):(t.endpoints[n].setVisible(!1),c(t,n,e))})};e.collapsed&&(u(t.select({source:n}),0),u(t.select({target:n}),1));var d=t.getId(n);t.dragManager.setParent(n,d,s,t.getId(s),r);var p={left:r.left-a.left,top:r.top-a.top};if(t.setPosition(n,p),t.dragManager.revalidateParent(n,d,r),l.updateConnectionsForGroup(e),t.revalidate(d),!i){var f={group:e,el:n,pos:p};o&&(f.sourceGroup=o),t.fire("group:addMember",f)}}}},this.removeFromGroup=function(t,e,n){(t=this.getGroup(t))&&t.remove(e,null,n)},this.getGroup=function(t){var i=t;if(e.isString(t)&&null==(i=n[t]))throw new TypeError("No such group ["+t+"]");return i},this.getGroups=function(){var t=[];for(var e in n)t.push(n[e]);return t},this.removeGroup=function(e,i,s,o){e=this.getGroup(e),this.expandGroup(e,!0);var r=e[i?"removeAll":"orphanAll"](s,o);return t.remove(e.getEl()),delete n[e.id],delete t._groups[e.id],t.fire("group:remove",{group:e}),r},this.removeAllGroups=function(t,e,i){for(var s in n)this.removeGroup(n[s],t,e,i)};var c=function(e,n,i){var s=e.endpoints[0===n?1:0].element;if(!s[o]||s[o].shouldProxy()||!s[o].collapsed){var r=i.getEl(),a=t.getId(r);t.proxyConnection(e,n,r,a,function(t,e){return i.getEndpoint(t,e)},function(t,e){return i.getAnchor(t,e)})}};this.collapseGroup=function(e){if(null!=(e=this.getGroup(e))&&!e.collapsed){var n=e.getEl();if(u(e,!1),e.shouldProxy()){var i=function(t,n){for(var i=0;i<t.length;i++){var s=t[i];c(s,n,e)}};i(e.connections.source,0),i(e.connections.target,1)}e.collapsed=!0,t.removeClass(n,"jtk-group-expanded"),t.addClass(n,"jtk-group-collapsed"),t.revalidate(n),t.fire("group:collapse",{group:e})}};var h=function(e,n,i){t.unproxyConnection(e,n,t.getId(i.getEl()))};function d(e){var n=e.getMembers(),o=t.getConnections({source:n,scope:"*"},!0),r=t.getConnections({target:n,scope:"*"},!0),a={};e.connections.source.length=0,e.connections.target.length=0;var l=function(t){for(var n=0;n<t.length;n++)a[t[n].id]||(a[t[n].id]=!0,t[n].source._jsPlumbGroup===e?(t[n].target._jsPlumbGroup!==e&&e.connections.source.push(t[n]),i[t[n].id]=e):t[n].target._jsPlumbGroup===e&&(e.connections.target.push(t[n]),s[t[n].id]=e))};l(o),l(r)}this.expandGroup=function(e,n){if(null!=(e=this.getGroup(e))&&e.collapsed){var i=e.getEl();if(u(e,!0),e.shouldProxy()){var s=function(t,n){for(var i=0;i<t.length;i++){var s=t[i];h(s,n,e)}};s(e.connections.source,0),s(e.connections.target,1)}e.collapsed=!1,t.addClass(i,"jtk-group-expanded"),t.removeClass(i,"jtk-group-collapsed"),t.revalidate(i),this.repaintGroup(e),n||t.fire("group:expand",{group:e})}},this.repaintGroup=function(e){for(var n=(e=this.getGroup(e)).getMembers(),i=0;i<n.length;i++)t.revalidate(n[i])},this.updateConnectionsForGroup=d,this.refreshAllGroups=function(){for(var e in n)d(n[e]),t.dragManager.updateOffsets(t.getId(n[e].getEl()))}},u=function(n,r){var a=this,l=r.el;this.getEl=function(){return l},this.id=r.id||e.uuid(),l._isJsPlumbGroup=!0;var u=this.getDragArea=function(){var t=n.getSelector(l,"[jtk-group-content]");return t&&t.length>0?t[0]:l},c=!0===r.ghost,h=c||!0===r.constrain,d=!1!==r.revert,p=!0===r.orphan,f=!0===r.prune,g=!0===r.dropOverride,m=!1!==r.proxied,v=[];if(this.connections={source:[],target:[],internal:[]},this.getAnchor=function(t,e){return r.anchor||"Continuous"},this.getEndpoint=function(t,e){return r.endpoint||["Dot",{radius:10}]},this.collapsed=!1,!1!==r.draggable){var b={drag:function(){for(var t=0;t<v.length;t++)n.draw(v[t])},stop:function(t){n.fire("groupDragStop",jsPlumb.extend(t,{group:a}))},scope:"_jsPlumbGroupDrag"};r.dragOptions&&t.jsPlumb.extend(b,r.dragOptions),n.draggable(r.el,b)}!1!==r.droppable&&n.droppable(r.el,{drop:function(t){var e=t.drag.el;if(!e._isJsPlumbGroup){var i=e._jsPlumbGroup;if(i!==a){if(null!=i&&i.overrideDrop(e,a))return;n.getGroupManager().addToGroup(a,e,!1)}}}});var y=function(t,e){for(var n=null==t.nodeType?t:[t],i=0;i<n.length;i++)e(n[i])};function P(t,e){var i=function(t){return t.offsetParent}(t),s=n.getSize(i),o=n.getSize(t),r=e[0],a=r+o[0],l=e[1],u=l+o[1];return a>0&&r<s[0]&&u>0&&l<s[1]}function x(t){var e=n.getId(t),i=n.getOffset(t);return t.parentNode.removeChild(t),n.getContainer().appendChild(t),n.setPosition(t,i),j(t),n.dragManager.clearParent(t,e),[e,i]}function _(t){var e=[];function i(t,e,i){var s=null;if(!P(t,[e,i])){var o=t._jsPlumbGroup;f?n.remove(t):s=x(t),o.remove(t)}return s}for(var s=0;s<t.selection.length;s++)e.push(i(t.selection[s][0],t.selection[s][1].left,t.selection[s][1].top));return 1===e.length?e[0]:e}function C(t){var e=n.getId(t);n.revalidate(t),n.dragManager.revalidateParent(t,e)}function j(t){t._katavorioDrag&&((f||p)&&t._katavorioDrag.off(i,_),f||p||!d||(t._katavorioDrag.off(s,C),t._katavorioDrag.setRevert(null)))}function E(t){t._katavorioDrag&&((f||p)&&t._katavorioDrag.on(i,_),h&&t._katavorioDrag.setConstrain(!0),c&&t._katavorioDrag.setUseGhostProxy(!0),f||p||!d||(t._katavorioDrag.on(s,C),t._katavorioDrag.setRevert(function(t,e){return!P(t,e)})))}this.overrideDrop=function(t,e){return g&&(d||f||p)},this.add=function(t,e){var i=u();y(t,function(t){if(null!=t._jsPlumbGroup){if(t._jsPlumbGroup===a)return;t._jsPlumbGroup.remove(t,!0,e,!1)}t._jsPlumbGroup=a,v.push(t),n.isAlreadyDraggable(t)&&E(t),t.parentNode!==i&&i.appendChild(t)}),n.getGroupManager().updateConnectionsForGroup(a)},this.remove=function(t,i,s,o,r){y(t,function(t){if(t._jsPlumbGroup===a){if(delete t._jsPlumbGroup,e.removeWithFunction(v,function(e){return e===t}),i)try{a.getDragArea().removeChild(t)}catch(t){jsPlumbUtil.log("Could not remove element from Group "+t)}if(j(t),!s){var o={group:a,el:t};r&&(o.targetGroup=r),n.fire("group:removeMember",o)}}}),o||n.getGroupManager().updateConnectionsForGroup(a)},this.removeAll=function(t,e){for(var i=0,s=v.length;i<s;i++){var o=v[0];a.remove(o,t,e,!0),n.remove(o,!0)}v.length=0,n.getGroupManager().updateConnectionsForGroup(a)},this.orphanAll=function(){for(var t={},e=0;e<v.length;e++){var n=x(v[e]);t[n[0]]=n[1]}return v.length=0,t},this.getMembers=function(){return v},l[o]=this,n.bind("elementDraggable",function(t){t.el._jsPlumbGroup===this&&E(t.el)}.bind(this)),this.shouldProxy=function(){return m},n.getGroupManager().addGroup(this)};n.prototype.addGroup=function(t){var e=this;if(e._groups=e._groups||{},null!=e._groups[t.id])throw new TypeError("cannot create Group ["+t.id+"]; a Group with that ID exists");if(null!=t.el[o])throw new TypeError("cannot create Group ["+t.id+"]; the given element is already a Group");var n=new u(e,t);return e._groups[n.id]=n,t.collapsed&&this.collapseGroup(n),n},n.prototype.addToGroup=function(t,e,n){var i=function(e){var i=this.getId(e);this.manage(i,e),this.getGroupManager().addToGroup(t,e,n)}.bind(this);if(Array.isArray(e))for(var s=0;s<e.length;s++)i(e[s]);else i(e)},n.prototype.removeFromGroup=function(t,e,n){this.getGroupManager().removeFromGroup(t,e,n)},n.prototype.removeGroup=function(t,e,n,i){return this.getGroupManager().removeGroup(t,e,n,i)},n.prototype.removeAllGroups=function(t,e,n){this.getGroupManager().removeAllGroups(t,e,n)},n.prototype.getGroup=function(t){return this.getGroupManager().getGroup(t)},n.prototype.getGroups=function(){return this.getGroupManager().getGroups()},n.prototype.expandGroup=function(t){this.getGroupManager().expandGroup(t)},n.prototype.collapseGroup=function(t){this.getGroupManager().collapseGroup(t)},n.prototype.repaintGroup=function(t){this.getGroupManager().repaintGroup(t)},n.prototype.toggleGroup=function(t){null!=(t=this.getGroupManager().getGroup(t))&&this.getGroupManager()[t.collapsed?"expandGroup":"collapseGroup"](t)},n.prototype.getGroupManager=function(){var t=this._groupManager;return null==t&&(t=this._groupManager=new l(this)),t},n.prototype.removeGroupManager=function(){delete this._groupManager},n.prototype.getGroupFor=function(t){if(t=this.getElement(t))return t[o]}}.call("undefined"!=typeof window?window:this),function(){"use strict";var t=this.jsPlumb,e=this.jsPlumbUtil;t.Connectors.Flowchart=function(e){this.type="Flowchart",(e=e||{}).stub=null==e.stub?30:e.stub;var n,i=t.Connectors.AbstractConnector.apply(this,arguments),s=null==e.midpoint?.5:e.midpoint,o=!0===e.alwaysRespectStubs,r=null,a=null,l=null!=e.cornerRadius?e.cornerRadius:0,u=(e.loopbackRadius,function(t){return t<0?-1:0===t?0:1}),c=function(t){return[u(t[2]-t[0]),u(t[3]-t[1])]},h=function(t,e,n,i){if(r!==e||a!==n){var s=null==r?i.sx:r,o=null==a?i.sy:a,l=s===e?"v":"h";r=e,a=n,t.push([s,o,e,n,l])}},d=function(t){return Math.sqrt(Math.pow(t[0]-t[2],2)+Math.pow(t[1]-t[3],2))},p=function(t){var e=[];return e.push.apply(e,t),e};this._compute=function(t,e){n=[],r=null,a=null;var u=function(){return[t.startStubX,t.startStubY,t.endStubX,t.endStubY]},f={perpendicular:u,orthogonal:u,opposite:function(e){var n=t,i="x"===e?0:1;return!o&&{x:function(){return 1===n.so[i]&&(n.startStubX>n.endStubX&&n.tx>n.startStubX||n.sx>n.endStubX&&n.tx>n.sx)||-1===n.so[i]&&(n.startStubX<n.endStubX&&n.tx<n.startStubX||n.sx<n.endStubX&&n.tx<n.sx)},y:function(){return 1===n.so[i]&&(n.startStubY>n.endStubY&&n.ty>n.startStubY||n.sy>n.endStubY&&n.ty>n.sy)||-1===n.so[i]&&(n.startStubY<n.endStubY&&n.ty<n.startStubY||n.sy<n.endStubY&&n.ty<n.sy)}}[e]()?{x:[(t.sx+t.tx)/2,t.startStubY,(t.sx+t.tx)/2,t.endStubY],y:[t.startStubX,(t.sy+t.ty)/2,t.endStubX,(t.sy+t.ty)/2]}[e]:[t.startStubX,t.startStubY,t.endStubX,t.endStubY]}}[t.anchorOrientation](t.sourceAxis),g="x"===t.sourceAxis?0:1,m="x"===t.sourceAxis?1:0,v=f[g],b=f[m],y=f[g+2],P=f[m+2];h(n,f[0],f[1],t);var x=t.startStubX+(t.endStubX-t.startStubX)*s,_=t.startStubY+(t.endStubY-t.startStubY)*s,C={x:[0,1],y:[1,0]},j={perpendicular:function(e){var n=t,i={x:[[n.startStubX,n.endStubX],null,[n.endStubX,n.startStubX]],y:[[n.startStubY,n.endStubY],null,[n.endStubY,n.startStubY]]},s={x:[[x,n.startStubY],[x,n.endStubY]],y:[[n.startStubX,_],[n.endStubX,_]]},o={x:[[n.endStubX,n.startStubY]],y:[[n.startStubX,n.endStubY]]},r={x:[[n.startStubX,n.endStubY],[n.endStubX,n.endStubY]],y:[[n.endStubX,n.startStubY],[n.endStubX,n.endStubY]]},a={x:[[n.startStubX,_],[n.endStubX,_],[n.endStubX,n.endStubY]],y:[[x,n.startStubY],[x,n.endStubY],[n.endStubX,n.endStubY]]},l={x:[n.startStubY,n.endStubY],y:[n.startStubX,n.endStubX]},u=C[e][0],c=C[e][1],h=n.so[u]+1,d=n.to[c]+1,p=-1===n.to[c]&&l[e][1]<l[e][0]||1===n.to[c]&&l[e][1]>l[e][0],f=i[e][h][0],g=i[e][h][1],m={x:[[[1,2,3,4],null,[2,1,4,3]],null,[[4,3,2,1],null,[3,4,1,2]]],y:[[[3,2,1,4],null,[2,3,4,1]],null,[[4,1,2,3],null,[1,4,3,2]]]}[e][h][d];return n.segment===m[3]||n.segment===m[2]&&p?s[e]:n.segment===m[2]&&g<f?o[e]:n.segment===m[2]&&g>=f||n.segment===m[1]&&!p?a[e]:n.segment===m[0]||n.segment===m[1]&&p?r[e]:void 0},orthogonal:function(e,n,i,s,o){var r=t,a={x:-1===r.so[0]?Math.min(n,s):Math.max(n,s),y:-1===r.so[1]?Math.min(n,s):Math.max(n,s)}[e];return{x:[[a,i],[a,o],[s,o]],y:[[i,a],[o,a],[o,s]]}[e]},opposite:function(n,s,o,r){var a=t,l={x:"y",y:"x"}[n],u={x:"height",y:"width"}[n],c=a["is"+n.toUpperCase()+"GreaterThanStubTimes2"];if(e.sourceEndpoint.elementId===e.targetEndpoint.elementId){var h=o+(1-e.sourceEndpoint.anchor[l])*e.sourceInfo[u]+i.maxStub;return{x:[[s,h],[r,h]],y:[[h,s],[h,r]]}[n]}return!c||1===a.so[g]&&s>r||-1===a.so[g]&&s<r?{x:[[s,_],[r,_]],y:[[x,s],[x,r]]}[n]:1===a.so[g]&&s<r||-1===a.so[g]&&s>r?{x:[[x,a.sy],[x,a.ty]],y:[[a.sx,_],[a.tx,_]]}[n]:void 0}}[t.anchorOrientation](t.sourceAxis,v,b,y,P);if(j)for(var E=0;E<j.length;E++)h(n,j[E][0],j[E][1],t);h(n,f[2],f[3],t),h(n,t.tx,t.ty,t),function(t,e,n){for(var s,o,r,a=null,u=0;u<e.length-1;u++){if(a=a||p(e[u]),s=p(e[u+1]),o=c(a),r=c(s),l>0&&a[4]!==s[4]){var h=Math.min(d(a),d(s)),f=Math.min(l,h/2);a[2]-=o[0]*f,a[3]-=o[1]*f,s[0]+=r[0]*f,s[1]+=r[1]*f;var g=o[1]===r[0]&&1===r[0]||o[1]===r[0]&&0===r[0]&&o[0]!==r[1]||o[1]===r[0]&&-1===r[0],m=(s[1]>a[3]?1:-1)==(s[0]>a[2]?1:-1),v=m&&g||!m&&!g?s[0]:a[2],b=m&&g||!m&&!g?a[3]:s[1];i.addSegment(t,"Straight",{x1:a[0],y1:a[1],x2:a[2],y2:a[3]}),i.addSegment(t,"Arc",{r:f,x1:a[2],y1:a[3],x2:s[0],y2:s[1],cx:v,cy:b,ac:g})}else{var y=a[2]===a[0]?0:a[2]>a[0]?n.lw/2:-n.lw/2,P=a[3]===a[1]?0:a[3]>a[1]?n.lw/2:-n.lw/2;i.addSegment(t,"Straight",{x1:a[0]-y,y1:a[1]-P,x2:a[2]+y,y2:a[3]+P})}a=s}null!=s&&i.addSegment(t,"Straight",{x1:s[0],y1:s[1],x2:s[2],y2:s[3]})}(this,n,t)}},e.extend(t.Connectors.Flowchart,t.Connectors.AbstractConnector)}.call("undefined"!=typeof window?window:this),function(){"use strict";var t=this.jsPlumb,e=this.jsPlumbUtil;t.Connectors.AbstractBezierConnector=function(e){var n,i=!1!==(e=e||{}).showLoopback,s=(e.curviness,e.margin||5),o=(e.proximityLimit,e.orientation&&"clockwise"===e.orientation),r=e.loopbackRadius||25;return this._compute=function(t,e){var a=e.sourcePos,l=e.targetPos,u=Math.abs(a[0]-l[0]),c=Math.abs(a[1]-l[1]);if(i&&e.sourceEndpoint.elementId===e.targetEndpoint.elementId){!0;var h=e.sourcePos[0],d=e.sourcePos[1]-s,p=h,f=d-r,g=p-r,m=f-r;u=2*r,c=2*r,t.points[0]=g,t.points[1]=m,t.points[2]=u,t.points[3]=c,n.addSegment(this,"Arc",{loopback:!0,x1:h-g+4,y1:d-m,startAngle:0,endAngle:2*Math.PI,r:r,ac:!o,x2:h-g-4,y2:d-m,cx:p-g,cy:f-m})}else!1,this._computeBezier(t,e,a,l,u,c)},n=t.Connectors.AbstractConnector.apply(this,arguments)},e.extend(t.Connectors.AbstractBezierConnector,t.Connectors.AbstractConnector);var n=function(e){e=e||{},this.type="Bezier";var n=t.Connectors.AbstractBezierConnector.apply(this,arguments),i=e.curviness||150;this.getCurviness=function(){return i},this._findControlPoint=function(t,e,n,s,o,r,a){var l=[];return r[0]!==a[0]||r[1]===a[1]?(0===a[0]?l.push(n[0]<e[0]?t[0]+10:t[0]-10):l.push(t[0]+i*a[0]),0===a[1]?l.push(n[1]<e[1]?t[1]+10:t[1]-10):l.push(t[1]+i*r[1])):(0===r[0]?l.push(e[0]<n[0]?t[0]+10:t[0]-10):l.push(t[0]-i*r[0]),0===r[1]?l.push(e[1]<n[1]?t[1]+10:t[1]-10):l.push(t[1]+i*a[1])),l},this._computeBezier=function(t,e,i,s,o,r){var a,l,u=i[0]<s[0]?o:0,c=i[1]<s[1]?r:0,h=i[0]<s[0]?0:o,d=i[1]<s[1]?0:r;a=this._findControlPoint([u,c],i,s,e.sourceEndpoint,e.targetEndpoint,t.so,t.to),l=this._findControlPoint([h,d],s,i,e.targetEndpoint,e.sourceEndpoint,t.to,t.so),n.addSegment(this,"Bezier",{x1:u,y1:c,x2:h,y2:d,cp1x:a[0],cp1y:a[1],cp2x:l[0],cp2y:l[1]})}};t.Connectors.Bezier=n,e.extend(n,t.Connectors.AbstractBezierConnector)}.call("undefined"!=typeof window?window:this),function(){"use strict";var t=this.jsPlumb,e=this.jsPlumbUtil,n=function(e){e=e||{},this.type="StateMachine";var n,i=t.Connectors.AbstractBezierConnector.apply(this,arguments),s=e.curviness||10,o=e.margin||5,r=e.proximityLimit||80;e.orientation&&e.orientation;this._computeBezier=function(t,e,a,l,u,c){var h=e.sourcePos[0]<e.targetPos[0]?0:u,d=e.sourcePos[1]<e.targetPos[1]?0:c,p=e.sourcePos[0]<e.targetPos[0]?u:0,f=e.sourcePos[1]<e.targetPos[1]?c:0;0===e.sourcePos[2]&&(h-=o),1===e.sourcePos[2]&&(h+=o),0===e.sourcePos[3]&&(d-=o),1===e.sourcePos[3]&&(d+=o),0===e.targetPos[2]&&(p-=o),1===e.targetPos[2]&&(p+=o),0===e.targetPos[3]&&(f-=o),1===e.targetPos[3]&&(f+=o);var g,m,v,b,y,P,x,_,C=(h+p)/2,j=(d+f)/2,E=(P=d,_=f,(y=h)<=(x=p)&&_<=P?1:y<=x&&P<=_?2:x<=y&&_>=P?3:4),S=Math.sqrt(Math.pow(p-h,2)+Math.pow(f-d,2));g=(n=function(t,e,n,i,s,o,r,a,l){return a<=l?[t,e]:1===n?i[3]<=0&&s[3]>=1?[t+(i[2]<.5?-1*o:o),e]:i[2]>=1&&s[2]<=0?[t,e+(i[3]<.5?-1*r:r)]:[t+-1*o,e+-1*r]:2===n?i[3]>=1&&s[3]<=0?[t+(i[2]<.5?-1*o:o),e]:i[2]>=1&&s[2]<=0?[t,e+(i[3]<.5?-1*r:r)]:[t+o,e+-1*r]:3===n?i[3]>=1&&s[3]<=0?[t+(i[2]<.5?-1*o:o),e]:i[2]<=0&&s[2]>=1?[t,e+(i[3]<.5?-1*r:r)]:[t+-1*o,e+-1*r]:4===n?i[3]<=0&&s[3]>=1?[t+(i[2]<.5?-1*o:o),e]:i[2]<=0&&s[2]>=1?[t,e+(i[3]<.5?-1*r:r)]:[t+o,e+-1*r]:void 0}(C,j,E,e.sourcePos,e.targetPos,s,s,S,r))[0],m=n[0],v=n[1],b=n[1],i.addSegment(this,"Bezier",{x1:p,y1:f,x2:h,y2:d,cp1x:g,cp1y:v,cp2x:m,cp2y:b})}};t.Connectors.StateMachine=n,e.extend(n,t.Connectors.AbstractBezierConnector)}.call("undefined"!=typeof window?window:this),function(){"use strict";var t=this.jsPlumb,e=this.jsPlumbUtil,n=function(e){this.type="Straight";var n=t.Connectors.AbstractConnector.apply(this,arguments);this._compute=function(t,e){n.addSegment(this,"Straight",{x1:t.sx,y1:t.sy,x2:t.startStubX,y2:t.startStubY}),n.addSegment(this,"Straight",{x1:t.startStubX,y1:t.startStubY,x2:t.endStubX,y2:t.endStubY}),n.addSegment(this,"Straight",{x1:t.endStubX,y1:t.endStubY,x2:t.tx,y2:t.ty})}};t.Connectors.Straight=n,e.extend(n,t.Connectors.AbstractConnector)}.call("undefined"!=typeof window?window:this),function(){"use strict";var t=this.jsPlumb,e=this.jsPlumbUtil,n={"stroke-linejoin":"stroke-linejoin","stroke-dashoffset":"stroke-dashoffset","stroke-linecap":"stroke-linecap"},i="http://www.w3.org/2000/svg",s=function(t,e){for(var n in e)t.setAttribute(n,""+e[n])},o=function(e,n){return(n=n||{}).version="1.1",n.xmlns=i,t.createElementNS(i,e,null,null,n)},r=function(t){return"position:absolute;left:"+t[0]+"px;top:"+t[1]+"px"},a=function(t){for(var e=t.querySelectorAll(" defs,linearGradient,radialGradient"),n=0;n<e.length;n++)e[n].parentNode.removeChild(e[n])},l=function(t,e,i,s,r){if(e.setAttribute("fill",i.fill?i.fill:"none"),e.setAttribute("stroke",i.stroke?i.stroke:"none"),i.gradient?function(t,e,n,i,s){var r,l="jsplumb_gradient_"+s._jsPlumb.instance.idstamp();a(t),r=n.gradient.offset?o("radialGradient",{id:l}):o("linearGradient",{id:l,gradientUnits:"userSpaceOnUse"});var u=o("defs");t.appendChild(u),u.appendChild(r);for(var c=0;c<n.gradient.stops.length;c++){var h=1===s.segment||2===s.segment?c:n.gradient.stops.length-1-c,d=n.gradient.stops[h][1],p=o("stop",{offset:Math.floor(100*n.gradient.stops[c][0])+"%","stop-color":d});r.appendChild(p)}var f=n.stroke?"stroke":"fill";e.setAttribute(f,"url(#"+l+")")}(t,e,i,0,r):(a(t),e.setAttribute("style","")),i.strokeWidth&&e.setAttribute("stroke-width",i.strokeWidth),i.dashstyle&&i.strokeWidth&&!i["stroke-dasharray"]){var l=-1===i.dashstyle.indexOf(",")?" ":",",u=i.dashstyle.split(l),c="";u.forEach(function(t){c+=Math.floor(t*i.strokeWidth)+l}),e.setAttribute("stroke-dasharray",c)}else i["stroke-dasharray"]&&e.setAttribute("stroke-dasharray",i["stroke-dasharray"]);for(var h in n)i[h]&&e.setAttribute(n[h],i[h])},u=function(t,e,n){t.childNodes.length>n?t.insertBefore(e,t.childNodes[n]):t.appendChild(e)};e.svg={node:o,attr:s,pos:r};var c=function(n){var i=n.pointerEventsSpec||"all",a={};t.jsPlumbUIComponent.apply(this,n.originalArgs),this.canvas=null,this.path=null,this.svg=null,this.bgCanvas=null;var l=n.cssClass+" "+(n.originalArgs[0].cssClass||""),u={style:"",width:0,height:0,"pointer-events":i,position:"absolute"};this.svg=o("svg",u),n.useDivWrapper?(this.canvas=t.createElement("div",{position:"absolute"}),e.sizeElement(this.canvas,0,0,1,1),this.canvas.className=l):(s(this.svg,{class:l}),this.canvas=this.svg),n._jsPlumb.appendElement(this.canvas,n.originalArgs[0].parent),n.useDivWrapper&&this.canvas.appendChild(this.svg);var c=[this.canvas];return this.getDisplayElements=function(){return c},this.appendDisplayElement=function(t){c.push(t)},this.paint=function(t,i,o){if(null!=t){var l,u=[this.x,this.y],c=[this.w,this.h];null!=o&&(o.xmin<0&&(u[0]+=o.xmin),o.ymin<0&&(u[1]+=o.ymin),c[0]=o.xmax+(o.xmin<0?-o.xmin:0),c[1]=o.ymax+(o.ymin<0?-o.ymin:0)),n.useDivWrapper?(e.sizeElement(this.canvas,u[0],u[1],c[0],c[1]),u[0]=0,u[1]=0,l=r([0,0])):l=r([u[0],u[1]]),a.paint.apply(this,arguments),s(this.svg,{style:l,width:c[0]||0,height:c[1]||0})}},{renderer:a}};e.extend(c,t.jsPlumbUIComponent,{cleanup:function(t){t||null==this.typeId?(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):(this.canvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.bgCanvas&&this.bgCanvas.parentNode&&this.bgCanvas.parentNode.removeChild(this.bgCanvas))},reattach:function(t){var e=t.getContainer();this.canvas&&null==this.canvas.parentNode&&e.appendChild(this.canvas),this.bgCanvas&&null==this.bgCanvas.parentNode&&e.appendChild(this.bgCanvas)},setVisible:function(t){this.canvas&&(this.canvas.style.display=t?"block":"none")}}),t.ConnectorRenderers.svg=function(e){var n=this;c.apply(this,[{cssClass:e._jsPlumb.connectorClass,originalArgs:arguments,pointerEventsSpec:"none",_jsPlumb:e._jsPlumb}]).renderer.paint=function(i,r,a){var c=n.getSegments(),h=[0,0];if(a.xmin<0&&(h[0]=-a.xmin),a.ymin<0&&(h[1]=-a.ymin),c.length>0){var d={d:n.getPathData(),transform:"translate("+h[0]+","+h[1]+")","pointer-events":e["pointer-events"]||"visibleStroke"},p=null;n.x,n.y,n.w,n.h;if(i.outlineStroke){var f=i.outlineWidth||1,g=i.strokeWidth+2*f;delete(p=t.extend({},i)).gradient,p.stroke=i.outlineStroke,p.strokeWidth=g,null==n.bgPath?(n.bgPath=o("path",d),t.addClass(n.bgPath,t.connectorOutlineClass),u(n.svg,n.bgPath,0)):s(n.bgPath,d),l(n.svg,n.bgPath,p,0,n)}null==n.path?(n.path=o("path",d),u(n.svg,n.path,i.outlineStroke?1:0)):s(n.path,d),l(n.svg,n.path,i,0,n)}}},e.extend(t.ConnectorRenderers.svg,c);var h=t.SvgEndpoint=function(e){c.apply(this,[{cssClass:e._jsPlumb.endpointClass,originalArgs:arguments,pointerEventsSpec:"all",useDivWrapper:!0,_jsPlumb:e._jsPlumb}]).renderer.paint=function(e){var n=t.extend({},e);n.outlineStroke&&(n.stroke=n.outlineStroke),null==this.node?(this.node=this.makeNode(n),this.svg.appendChild(this.node)):null!=this.updateNode&&this.updateNode(this.node),l(this.svg,this.node,n,(this.x,this.y,this.w,this.h),this),r(this.node,(this.x,this.y))}.bind(this)};e.extend(h,c),t.Endpoints.svg.Dot=function(){t.Endpoints.Dot.apply(this,arguments),h.apply(this,arguments),this.makeNode=function(t){return o("circle",{cx:this.w/2,cy:this.h/2,r:this.radius})},this.updateNode=function(t){s(t,{cx:this.w/2,cy:this.h/2,r:this.radius})}},e.extend(t.Endpoints.svg.Dot,[t.Endpoints.Dot,h]),t.Endpoints.svg.Rectangle=function(){t.Endpoints.Rectangle.apply(this,arguments),h.apply(this,arguments),this.makeNode=function(t){return o("rect",{width:this.w,height:this.h})},this.updateNode=function(t){s(t,{width:this.w,height:this.h})}},e.extend(t.Endpoints.svg.Rectangle,[t.Endpoints.Rectangle,h]),t.Endpoints.svg.Image=t.Endpoints.Image,t.Endpoints.svg.Blank=t.Endpoints.Blank,t.Overlays.svg.Label=t.Overlays.Label,t.Overlays.svg.Custom=t.Overlays.Custom;var d=function(e,n){e.apply(this,n),t.jsPlumbUIComponent.apply(this,n),this.isAppendedAtTopLevel=!1;this.path=null,this.paint=function(t,e){if(t.component.svg&&e){null==this.path&&(this.path=o("path",{"pointer-events":"all"}),t.component.svg.appendChild(this.path),this.elementCreated&&this.elementCreated(this.path,t.component),this.canvas=t.component.svg);var r=n&&1===n.length&&n[0].cssClass||"",a=[0,0];e.xmin<0&&(a[0]=-e.xmin),e.ymin<0&&(a[1]=-e.ymin),s(this.path,{d:i(t.d),class:r,stroke:t.stroke?t.stroke:null,fill:t.fill?t.fill:null,transform:"translate("+a[0]+","+a[1]+")"})}};var i=function(t){return isNaN(t.cxy.x)||isNaN(t.cxy.y)?"":"M"+t.hxy.x+","+t.hxy.y+" L"+t.tail[0].x+","+t.tail[0].y+" L"+t.cxy.x+","+t.cxy.y+" L"+t.tail[1].x+","+t.tail[1].y+" L"+t.hxy.x+","+t.hxy.y};this.transfer=function(t){t.canvas&&this.path&&this.path.parentNode&&(this.path.parentNode.removeChild(this.path),t.canvas.appendChild(this.path))}};e.extend(d,[t.jsPlumbUIComponent,t.Overlays.AbstractOverlay],{cleanup:function(t){null!=this.path&&(t?this._jsPlumb.instance.removeElement(this.path):this.path.parentNode&&this.path.parentNode.removeChild(this.path))},reattach:function(t,e){this.path&&e.canvas&&e.canvas.appendChild(this.path)},setVisible:function(t){null!=this.path&&(this.path.style.display=t?"block":"none")}}),t.Overlays.svg.Arrow=function(){d.apply(this,[t.Overlays.Arrow,arguments])},e.extend(t.Overlays.svg.Arrow,[t.Overlays.Arrow,d]),t.Overlays.svg.PlainArrow=function(){d.apply(this,[t.Overlays.PlainArrow,arguments])},e.extend(t.Overlays.svg.PlainArrow,[t.Overlays.PlainArrow,d]),t.Overlays.svg.Diamond=function(){d.apply(this,[t.Overlays.Diamond,arguments])},e.extend(t.Overlays.svg.Diamond,[t.Overlays.Diamond,d]),t.Overlays.svg.GuideLines=function(){var e,n,i=null,r=this;t.Overlays.GuideLines.apply(this,arguments),this.paint=function(t,l){null==i&&(i=o("path"),t.connector.svg.appendChild(i),r.attachListeners(i,t.connector),r.attachListeners(i,r),e=o("path"),t.connector.svg.appendChild(e),r.attachListeners(e,t.connector),r.attachListeners(e,r),n=o("path"),t.connector.svg.appendChild(n),r.attachListeners(n,t.connector),r.attachListeners(n,r));var u=[0,0];l.xmin<0&&(u[0]=-l.xmin),l.ymin<0&&(u[1]=-l.ymin),s(i,{d:a(t.head,t.tail),stroke:"red",fill:null,transform:"translate("+u[0]+","+u[1]+")"}),s(e,{d:a(t.tailLine[0],t.tailLine[1]),stroke:"blue",fill:null,transform:"translate("+u[0]+","+u[1]+")"}),s(n,{d:a(t.headLine[0],t.headLine[1]),stroke:"green",fill:null,transform:"translate("+u[0]+","+u[1]+")"})};var a=function(t,e){return"M "+t.x+","+t.y+" L"+e.x+","+e.y}},e.extend(t.Overlays.svg.GuideLines,t.Overlays.GuideLines)}.call("undefined"!=typeof window?window:this),function(){"use strict";var t=this,e=t.jsPlumb,n=t.jsPlumbUtil,i=t.Katavorio,s=t.Biltong,o=function(t,n){var o="_katavorio_"+(n=n||"main"),r=t[o],a=t.getEventManager();return r||((r=new i({bind:a.on,unbind:a.off,getSize:e.getSize,getConstrainingRectangle:function(t){return[t.parentNode.scrollWidth,t.parentNode.scrollHeight]},getPosition:function(e,n){var i=t.getOffset(e,n,e._katavorioDrag?e.offsetParent:null);return[i.left,i.top]},setPosition:function(t,e){t.style.left=e[0]+"px",t.style.top=e[1]+"px"},addClass:e.addClass,removeClass:e.removeClass,intersects:s.intersects,indexOf:function(t,e){return t.indexOf(e)},scope:t.getDefaultScope(),css:{noSelect:t.dragSelectClass,droppable:"jtk-droppable",draggable:"jtk-draggable",drag:"jtk-drag",selected:"jtk-drag-selected",active:"jtk-drag-active",hover:"jtk-drag-hover",ghostProxy:"jtk-ghost-proxy"}})).setZoom(t.getZoom()),t[o]=r,t.bind("zoom",r.setZoom)),r},r=function(t,e){if(null==e)return[0,0];var n=h(e),i=c(n,0);return[i[t+"X"],i[t+"Y"]]},a=r.bind(this,"page"),l=r.bind(this,"screen"),u=r.bind(this,"client"),c=function(t,e){return t.item?t.item(e):t[e]},h=function(t){return t.touches&&t.touches.length>0?t.touches:t.changedTouches&&t.changedTouches.length>0?t.changedTouches:t.targetTouches&&t.targetTouches.length>0?t.targetTouches:[t]},d=function(t){var e={},n=[],i={},s={},o={};this.register=function(r){var a,l=t.getId(r);e[l]||(e[l]=r,n.push(r),i[l]={});var u=function(e){if(e)for(var n=0;n<e.childNodes.length;n++)if(3!==e.childNodes[n].nodeType&&8!==e.childNodes[n].nodeType){var c=jsPlumb.getElement(e.childNodes[n]),h=t.getId(e.childNodes[n],null,!0);if(h&&s[h]&&s[h]>0){a||(a=t.getOffset(r));var d=t.getOffset(c);i[l][h]={id:h,offset:{left:d.left-a.left,top:d.top-a.top}},o[h]=l}u(e.childNodes[n])}};u(r)},this.updateOffsets=function(e,n){if(null!=e){n=n||{};var s,r=jsPlumb.getElement(e),a=t.getId(r),l=i[a];if(l)for(var u in l)if(l.hasOwnProperty(u)){var c=jsPlumb.getElement(u),h=n[u]||t.getOffset(c);if(null==c.offsetParent&&null!=i[a][u])continue;s||(s=t.getOffset(r)),i[a][u]={id:u,offset:{left:h.left-s.left,top:h.top-s.top}},o[u]=a}}},this.endpointAdded=function(n,r){r=r||t.getId(n);var a=document.body,l=n.parentNode;for(s[r]=s[r]?s[r]+1:1;null!=l&&l!==a;){var u=t.getId(l,null,!0);if(u&&e[u]){var c=t.getOffset(l);if(null==i[u][r]){var h=t.getOffset(n);i[u][r]={id:r,offset:{left:h.left-c.left,top:h.top-c.top}},o[r]=u}break}l=l.parentNode}},this.endpointDeleted=function(t){if(s[t.elementId]&&(s[t.elementId]--,s[t.elementId]<=0))for(var e in i)i.hasOwnProperty(e)&&i[e]&&(delete i[e][t.elementId],delete o[t.elementId])},this.changeId=function(t,e){i[e]=i[t],i[t]={},o[e]=o[t],o[t]=null},this.getElementsForDraggable=function(t){return i[t]},this.elementRemoved=function(t){var e=o[t];e&&(delete i[e][t],delete o[t])},this.reset=function(){e={},n=[],i={},s={}},this.dragEnded=function(e){if(null!=e.offsetParent){var n=t.getId(e),i=o[n];i&&this.updateOffsets(i)}},this.setParent=function(e,n,s,r,a){var l=o[n];i[r]||(i[r]={});var u=t.getOffset(s),c=a||t.getOffset(e);l&&i[l]&&delete i[l][n],i[r][n]={id:n,offset:{left:c.left-u.left,top:c.top-u.top}},o[n]=r},this.clearParent=function(t,e){var n=o[e];n&&(delete i[n][e],delete o[e])},this.revalidateParent=function(e,n,i){var s=o[n];if(s){var r={};r[n]=i,this.updateOffsets(s,r),t.revalidate(s)}},this.getDragAncestor=function(e){var n=jsPlumb.getElement(e),i=t.getId(n),s=o[i];return s?jsPlumb.getElement(s):null}},p=function(t,e,i){e=n.fastTrim(e),void 0!==t.className.baseVal?t.className.baseVal=e:t.className=e;try{var s=t.classList;if(null!=s){for(;s.length>0;)s.remove(s.item(0));for(var o=0;o<i.length;o++)i[o]&&s.add(i[o])}}catch(t){n.log("JSPLUMB: cannot set class list",t)}},f=function(t){return void 0===t.className.baseVal?t.className:t.className.baseVal},g=function(t,e,i){e=null==e?[]:n.isArray(e)?e:e.split(/\s+/),i=null==i?[]:n.isArray(i)?i:i.split(/\s+/);var s=f(t).split(/\s+/),o=function(t,e){for(var n=0;n<e.length;n++)if(t)-1===s.indexOf(e[n])&&s.push(e[n]);else{var i=s.indexOf(e[n]);-1!==i&&s.splice(i,1)}};o(!0,e),o(!1,i),p(t,s.join(" "),s)};t.jsPlumb.extend(t.jsPlumbInstance.prototype,{headless:!1,pageLocation:a,screenLocation:l,clientLocation:u,getDragManager:function(){return null==this.dragManager&&(this.dragManager=new d(this)),this.dragManager},recalculateOffsets:function(t){this.getDragManager().updateOffsets(t)},createElement:function(t,e,n,i){return this.createElementNS(null,t,e,n,i)},createElementNS:function(t,e,n,i,s){var o,r=null==t?document.createElement(e):document.createElementNS(t,e);for(o in n=n||{})r.style[o]=n[o];for(o in i&&(r.className=i),s=s||{})r.setAttribute(o,""+s[o]);return r},getAttribute:function(t,e){return null!=t.getAttribute?t.getAttribute(e):null},setAttribute:function(t,e,n){null!=t.setAttribute&&t.setAttribute(e,n)},setAttributes:function(t,e){for(var n in e)e.hasOwnProperty(n)&&t.setAttribute(n,e[n])},appendToRoot:function(t){document.body.appendChild(t)},getRenderModes:function(){return["svg"]},getClass:f,addClass:function(t,e){jsPlumb.each(t,function(t){g(t,e)})},hasClass:function(t,e){return(t=jsPlumb.getElement(t)).classList?t.classList.contains(e):-1!==f(t).indexOf(e)},removeClass:function(t,e){jsPlumb.each(t,function(t){g(t,null,e)})},toggleClass:function(t,e){jsPlumb.hasClass(t,e)?jsPlumb.removeClass(t,e):jsPlumb.addClass(t,e)},updateClasses:function(t,e,n){jsPlumb.each(t,function(t){g(t,e,n)})},setClass:function(t,e){null!=e&&jsPlumb.each(t,function(t){p(t,e,e.split(/\s+/))})},setPosition:function(t,e){t.style.left=e.left+"px",t.style.top=e.top+"px"},getPosition:function(t){var e=function(e){var n=t.style[e];return n?n.substring(0,n.length-2):0};return{left:e("left"),top:e("top")}},getStyle:function(t,e){return void 0!==window.getComputedStyle?getComputedStyle(t,null).getPropertyValue(e):t.currentStyle[e]},getSelector:function(t,e){return 1===arguments.length?null!=t.nodeType?t:document.querySelectorAll(t):t.querySelectorAll(e)},getOffset:function(t,e,n){t=jsPlumb.getElement(t),n=n||this.getContainer();for(var i={left:t.offsetLeft,top:t.offsetTop},s=e||null!=n&&t!==n&&t.offsetParent!==n?t.offsetParent:null,o=function(t){null!=t&&t!==document.body&&(t.scrollTop>0||t.scrollLeft>0)&&(i.left-=t.scrollLeft,i.top-=t.scrollTop)}.bind(this);null!=s;)i.left+=s.offsetLeft,i.top+=s.offsetTop,o(s),s=e?s.offsetParent:s.offsetParent===n?null:s.offsetParent;if(null!=n&&!e&&(n.scrollTop>0||n.scrollLeft>0)){var r=null!=t.offsetParent?this.getStyle(t.offsetParent,"position"):"static",a=this.getStyle(t,"position");"absolute"!==a&&"fixed"!==a&&"absolute"!==r&&"fixed"!==r&&(i.left-=n.scrollLeft,i.top-=n.scrollTop)}return i},getPositionOnElement:function(t,e,n){var i=void 0!==e.getBoundingClientRect?e.getBoundingClientRect():{left:0,top:0,width:0,height:0},s=document.body,o=document.documentElement,r=window.pageYOffset||o.scrollTop||s.scrollTop,a=window.pageXOffset||o.scrollLeft||s.scrollLeft,l=o.clientTop||s.clientTop||0,u=o.clientLeft||s.clientLeft||0,c=i.top+r-l+0*n,h=i.left+a-u+0*n,d=jsPlumb.pageLocation(t),p=i.width||e.offsetWidth*n,f=i.height||e.offsetHeight*n;return[(d[0]-h)/p,(d[1]-c)/f]},getAbsolutePosition:function(t){var e=function(e){var n=t.style[e];if(n)return parseFloat(n.substring(0,n.length-2))};return[e("left"),e("top")]},setAbsolutePosition:function(t,e,n,i){n?this.animate(t,{left:"+="+(e[0]-n[0]),top:"+="+(e[1]-n[1])},i):(t.style.left=e[0]+"px",t.style.top=e[1]+"px")},getSize:function(t){return[t.offsetWidth,t.offsetHeight]},getWidth:function(t){return t.offsetWidth},getHeight:function(t){return t.offsetHeight},getRenderMode:function(){return"svg"},draggable:function(t,e){var i;return t=n.isArray(t)||null!=t.length&&!n.isString(t)?t:[t],Array.prototype.slice.call(t).forEach(function(t){(i=this.info(t)).el&&this._initDraggableIfNecessary(i.el,!0,e,i.id,!0)}.bind(this)),this},snapToGrid:function(t,e,n){var i=[],s=function(t){var s=this.info(t);if(null!=s.el&&s.el._katavorioDrag){var o=s.el._katavorioDrag.snap(e,n);this.revalidate(s.el),i.push([s.el,o])}}.bind(this);if(1===arguments.length||3===arguments.length)s(t,e,n);else{var o=this.getManagedElements();for(var r in o)s(r,arguments[0],arguments[1])}return i},initDraggable:function(t,e,n){o(this,n).draggable(t,e),t._jsPlumbDragOptions=e},destroyDraggable:function(t,e){o(this,e).destroyDraggable(t),delete t._jsPlumbDragOptions},unbindDraggable:function(t,e,n,i){o(this,i).destroyDraggable(t,e,n)},setDraggable:function(t,e){return jsPlumb.each(t,function(t){this.isDragSupported(t)&&(this._draggableStates[this.getAttribute(t,"id")]=e,this.setElementDraggable(t,e))}.bind(this))},_draggableStates:{},toggleDraggable:function(t){var e;return jsPlumb.each(t,function(t){var n=this.getAttribute(t,"id");return e=!(e=null!=this._draggableStates[n]&&this._draggableStates[n]),this._draggableStates[n]=e,this.setDraggable(t,e),e}.bind(this)),e},_initDraggableIfNecessary:function(t,e,i,s,o){if(!jsPlumb.headless&&(null!=e&&e&&jsPlumb.isDragSupported(t,this))){var r=i||this.Defaults.DragOptions;if(r=jsPlumb.extend({},r),jsPlumb.isAlreadyDraggable(t,this))i.force&&this.initDraggable(t,r);else{var a=jsPlumb.dragEvents.drag,l=jsPlumb.dragEvents.stop,u=jsPlumb.dragEvents.start;this.manage(s,t),r[u]=n.wrap(r[u],function(t){var e=t.el._jsPlumbDragOptions,n=!0;return e.canDrag&&(n=e.canDrag()),n&&(this.setHoverSuspended(!0),this.select({source:t.el}).addClass(this.elementDraggingClass+" "+this.sourceElementDraggingClass,!0),this.select({target:t.el}).addClass(this.elementDraggingClass+" "+this.targetElementDraggingClass,!0),this.setConnectionBeingDragged(!0)),n}.bind(this)),r[a]=n.wrap(r[a],function(t){var e=this.getUIPosition(arguments,this.getZoom());if(null!=e){var n=t.el._jsPlumbDragOptions;this.draw(t.el,e,null,!0),n._dragging&&this.addClass(t.el,"jtk-dragged"),n._dragging=!0}}.bind(this)),r[l]=n.wrap(r[l],function(t){for(var e,n=t.selection,i=function(t){null!=t[1]&&(e=this.getUIPosition([{el:t[2].el,pos:[t[1].left,t[1].top]}]),this.draw(t[2].el,e)),null!=t[0]._jsPlumbDragOptions&&delete t[0]._jsPlumbDragOptions._dragging,this.removeClass(t[0],"jtk-dragged"),this.select({source:t[2].el}).removeClass(this.elementDraggingClass+" "+this.sourceElementDraggingClass,!0),this.select({target:t[2].el}).removeClass(this.elementDraggingClass+" "+this.targetElementDraggingClass,!0),this.getDragManager().dragEnded(t[2].el)}.bind(this),s=0;s<n.length;s++)i(n[s]);this.setHoverSuspended(!1),this.setConnectionBeingDragged(!1)}.bind(this));var c=this.getId(t);this._draggableStates[c]=!0;var h=this._draggableStates[c];r.disabled=null!=h&&!h,this.initDraggable(t,r),this.getDragManager().register(t),o&&this.fire("elementDraggable",{el:t,options:r})}}},animationSupported:!0,getElement:function(t){return null==t?null:"string"==typeof(t="string"==typeof t?t:null!=t.length&&null==t.enctype?t[0]:t)?document.getElementById(t):t},removeElement:function(t){o(this).elementRemoved(t),this.getEventManager().remove(t)},doAnimate:function(t,i,s){s=s||{};var o=this.getOffset(t),r=function(t,e){var i=function(i){if(null!=e[i]){if(n.isString(e[i])){var s=e[i].match(/-=/)?-1:1,o=e[i].substring(2);return t[i]+s*o}return e[i]}return t[i]};return[i("left"),i("top")]}(o,i),a=r[0]-o.left,l=r[1]-o.top,u=s.duration||250,c=u/15,h=15/u*a,d=15/u*l,p=0,f=setInterval(function(){e.setPosition(t,{left:o.left+h*(p+1),top:o.top+d*(p+1)}),null!=s.step&&s.step(p,Math.ceil(c)),++p>=c&&(window.clearInterval(f),null!=s.complete&&s.complete())},15)},destroyDroppable:function(t,e){o(this,e).destroyDroppable(t)},unbindDroppable:function(t,e,n,i){o(this,i).destroyDroppable(t,e,n)},droppable:function(t,e){var i;return t=n.isArray(t)||null!=t.length&&!n.isString(t)?t:[t],(e=e||{}).allowLoopback=!1,Array.prototype.slice.call(t).forEach(function(t){(i=this.info(t)).el&&this.initDroppable(i.el,e)}.bind(this)),this},initDroppable:function(t,e,n){o(this,n).droppable(t,e)},isAlreadyDraggable:function(t){return null!=t._katavorioDrag},isDragSupported:function(t,e){return!0},isDropSupported:function(t,e){return!0},isElementDraggable:function(t){return(t=e.getElement(t))._katavorioDrag&&t._katavorioDrag.isEnabled()},getDragObject:function(t){return t[0].drag.getDragElement()},getDragScope:function(t){return t._katavorioDrag&&t._katavorioDrag.scopes.join(" ")||""},getDropEvent:function(t){return t[0].e},getUIPosition:function(t,e){var n=t[0].el;if(null==n.offsetParent)return null;var i=t[0].finalPos||t[0].pos,s={left:i[0],top:i[1]};if(n._katavorioDrag&&n.offsetParent!==this.getContainer()){var o=this.getOffset(n.offsetParent);s.left+=o.left,s.top+=o.top}return s},setDragFilter:function(t,e,n){t._katavorioDrag&&t._katavorioDrag.setFilter(e,n)},setElementDraggable:function(t,n){(t=e.getElement(t))._katavorioDrag&&t._katavorioDrag.setEnabled(n)},setDragScope:function(t,e){t._katavorioDrag&&t._katavorioDrag.k.setDragScope(t,e)},setDropScope:function(t,e){t._katavorioDrop&&t._katavorioDrop.length>0&&t._katavorioDrop[0].k.setDropScope(t,e)},addToPosse:function(t,n){var i=Array.prototype.slice.call(arguments,1),s=o(this);e.each(t,function(t){(t=[e.getElement(t)]).push.apply(t,i),s.addToPosse.apply(s,t)})},setPosse:function(t,n){var i=Array.prototype.slice.call(arguments,1),s=o(this);e.each(t,function(t){(t=[e.getElement(t)]).push.apply(t,i),s.setPosse.apply(s,t)})},removeFromPosse:function(t,n){var i=Array.prototype.slice.call(arguments,1),s=o(this);e.each(t,function(t){(t=[e.getElement(t)]).push.apply(t,i),s.removeFromPosse.apply(s,t)})},removeFromAllPosses:function(t){var n=o(this);e.each(t,function(t){n.removeFromAllPosses(e.getElement(t))})},setPosseState:function(t,n,i){var s=o(this);e.each(t,function(t){s.setPosseState(e.getElement(t),n,i)})},dragEvents:{start:"start",stop:"stop",drag:"drag",step:"step",over:"over",out:"out",drop:"drop",complete:"complete",beforeStart:"beforeStart"},animEvents:{step:"step",complete:"complete"},stopDrag:function(t){t._katavorioDrag&&t._katavorioDrag.abort()},addToDragSelection:function(t){var e=this.getElement(t);null==e||!e._isJsPlumbGroup&&null!=e._jsPlumbGroup||o(this).select(t)},removeFromDragSelection:function(t){o(this).deselect(t)},getDragSelection:function(){return o(this).getSelection()},clearDragSelection:function(){o(this).deselectAll()},trigger:function(t,e,n,i){this.getEventManager().trigger(t,e,n,i)},doReset:function(){for(var t in this)0===t.indexOf("_katavorio_")&&this[t].reset()},getEventManager:function(){return(n=(e=this)._mottle)||(n=e._mottle=new t.Mottle),n;var e,n},on:function(t,e,n){return this.getEventManager().on.apply(this,arguments),this},off:function(t,e,n){return this.getEventManager().off.apply(this,arguments),this}});var m,v;m=e.init,(v=function(){/complete|loaded|interactive/.test(document.readyState)&&void 0!==document.body&&null!=document.body?m():setTimeout(v,9)})()}.call("undefined"!=typeof window?window:this);\ No newline at end of filediff --git a/package-lock.json b/package-lock.jsonindex b6795e3521..24030adef6 100644--- a/package-lock.json+++ b/package-lock.json@@ -639,9 +639,12 @@"integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA=="},"agent-base": {- "version": "5.1.1",- "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz",- "integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g=="+ "version": "6.0.0",+ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.0.tgz",+ "integrity": "sha512-j1Q7cSCqN+AwrmDd+pzgqc0/NpC655x2bUf5ZjRIO77DcNBFmh+OgRNzF6OKdCC9RSCb19fGd99+bhXFdkRNqw==",+ "requires": {+ "debug": "4"+ }},"ajv": {"version": "6.10.2",@@ -2015,9 +2018,9 @@}},"cross-zip": {- "version": "2.1.6",- "resolved": "https://registry.npmjs.org/cross-zip/-/cross-zip-2.1.6.tgz",- "integrity": "sha512-xLIETNkzRcU6jGRzenJyRFxahbtP4628xEKMTI/Ql0Vu8m4h8M7uRLVi7E5OYHuJ6VQPsG4icJumKAFUvfm0+A==",+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/cross-zip/-/cross-zip-3.0.0.tgz",+ "integrity": "sha512-cm+l8PJ6WiSQmKZ/x8DGvUm2u/3FX2JFs1AFd18gdHaVhP5Lf4oE6Jrj2Jd05JYSioz5x+nIRVp0zBQuzuCRcQ==","dev": true,"requires": {"rimraf": "^3.0.0"@@ -3089,14 +3092,14 @@}},"electron-packager": {- "version": "14.2.0",- "resolved": "https://registry.npmjs.org/electron-packager/-/electron-packager-14.2.0.tgz",- "integrity": "sha512-6JHv0zfRpxpFta4MJBt7RtcS6zhtl4f76ombZKqicgl5I3Ighx8WBQRYUKMdAO3tNYEq/B0i1FYsBp6oXzlTfA==",+ "version": "14.2.1",+ "resolved": "https://registry.npmjs.org/electron-packager/-/electron-packager-14.2.1.tgz",+ "integrity": "sha512-g6y3BVrAOz/iavKD+VMFbehrQcwCWuA3CZvVbmmbQuCfegGA1ytwWn0BNIDDrEdbuz31Fti7mnNHhb5L+3Wq9A==","dev": true,"requires": {"@electron/get": "^1.6.0","asar": "^2.0.1",- "cross-zip": "^2.1.5",+ "cross-zip": "^3.0.0","debug": "^4.0.1","electron-notarize": "^0.2.0","electron-osx-sign": "^0.4.11",@@ -4876,11 +4879,11 @@}},"https-proxy-agent": {- "version": "4.0.0",- "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz",- "integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==",+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz",+ "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==","requires": {- "agent-base": "5",+ "agent-base": "6","debug": "4"}},diff --git a/package.json b/package.jsonindex f1a139d2b0..3d558c07f9 100644--- a/package.json+++ b/package.json@@ -43,7 +43,7 @@"html": "1.0.0","html2plaintext": "2.1.2","http-proxy-agent": "4.0.0",- "https-proxy-agent": "4.0.0",+ "https-proxy-agent": "5.0.0","image-type": "4.1.0","imagemin": "7.0.1","imagemin-giflossy": "5.1.10",@@ -78,7 +78,7 @@"devDependencies": {"electron": "8.0.0","electron-builder": "22.3.2",- "electron-packager": "14.2.0",+ "electron-packager": "14.2.1","electron-rebuild": "1.10.0","jsdoc": "3.6.3","lorem-ipsum": "2.0.3"diff --git a/src/public/javascripts/desktop.js b/src/public/javascripts/desktop.jsindex 954388f339..38620c0023 100644--- a/src/public/javascripts/desktop.js+++ b/src/public/javascripts/desktop.js@@ -32,6 +32,8 @@ import options from "./services/options.js";import noteContentRenderer from "./services/note_content_renderer.js";import appContext from "./services/app_context.js";+window.glob.PROFILING_LOG = false;+window.glob.isDesktop = utils.isDesktop;window.glob.isMobile = utils.isMobile;diff --git a/src/public/javascripts/services/link_map.js b/src/public/javascripts/services/link_map.jsindex 557442dac5..c7c1299bf5 100644--- a/src/public/javascripts/services/link_map.js+++ b/src/public/javascripts/services/link_map.js@@ -176,7 +176,7 @@ export default class LinkMap {.addClass('link-' + edge.target.id);}else {- console.log(`connection not created for`, edge);+ console.debug(`connection not created for`, edge);}});diff --git a/src/public/javascripts/services/server.js b/src/public/javascripts/services/server.jsindex 54e5fb04ea..82b9713586 100644--- a/src/public/javascripts/services/server.js+++ b/src/public/javascripts/services/server.js@@ -78,7 +78,9 @@ async function call(method, url, data, headers = {}) {const end = Date.now();- console.log(`${method} ${url} took ${end-start}ms`);+ if (glob.PROFILING_LOG) {+ console.log(`${method} ${url} took ${end - start}ms`);+ }const maxSyncIdStr = resp.headers['trilium-max-sync-id'];diff --git a/src/public/javascripts/services/tab_context.js b/src/public/javascripts/services/tab_context.jsindex 5831d47ce9..3eced57d20 100644--- a/src/public/javascripts/services/tab_context.js+++ b/src/public/javascripts/services/tab_context.js@@ -88,7 +88,7 @@ class TabContext extends Component {}isActive() {- return this.appContext.activeTabId === this.tabId;+ return this.tabManager.activeTabId === this.tabId;}getTabState() {@@ -99,7 +99,7 @@ class TabContext extends Component {return {tabId: this.tabId,notePath: this.notePath,- active: this.appContext.activeTabId === this.tabId+ active: this.tabManager.activeTabId === this.tabId}}diff --git a/src/public/javascripts/widgets/calendar.js b/src/public/javascripts/widgets/calendar.jsindex f6e61eff79..73a4277a8d 100644--- a/src/public/javascripts/widgets/calendar.js+++ b/src/public/javascripts/widgets/calendar.js@@ -32,6 +32,18 @@ export default class CalendarWidget extends CollapsibleWidget {&& this.note.hasOwnedLabel("dateNote");}+ setTabContextListener({tabContext}) {+ super.setTabContextListener({tabContext});++ console.log("set tab context", tabContext.tabId, "to", this.componentId);+ }++ async refresh() {+ super.refresh();++ //console.trace("tab", this.tabContext.tabId);+ }+async doRenderBody() {await libraryLoader.requireLibrary(libraryLoader.CALENDAR_WIDGET);diff --git a/src/public/javascripts/widgets/component.js b/src/public/javascripts/widgets/component.jsindex b9e2f51540..0fa44bbe00 100644--- a/src/public/javascripts/widgets/component.js+++ b/src/public/javascripts/widgets/component.js@@ -28,7 +28,7 @@ export default class Component {const end = Date.now();- if (end - start > 10) {+ if (end - start > 10 && glob.PROFILING_LOG) {console.log(`Event ${name} in component ${this.componentId} took ${end-start}ms`);}diff --git a/src/public/javascripts/widgets/tab_aware_widget.js b/src/public/javascripts/widgets/tab_aware_widget.jsindex 32b87259b9..ab14c4602e 100644--- a/src/public/javascripts/widgets/tab_aware_widget.js+++ b/src/public/javascripts/widgets/tab_aware_widget.js@@ -44,7 +44,7 @@ export default class TabAwareWidget extends BasicWidget {}async isEnabled() {- return !!this.note;+ return !!this.note && this.tabContext.isActive();}async refresh() {@@ -56,7 +56,7 @@ export default class TabAwareWidget extends BasicWidget {const end = Date.now();- if (end - start > 10) {+ if (glob.PROFILING_LOG && end - start > 10) {console.log(`Refresh of ${this.componentId} took ${end-start}ms`);}}diff --git a/src/public/javascripts/widgets/tab_row.js b/src/public/javascripts/widgets/tab_row.jsindex ac452b0ad6..dce17a458f 100644--- a/src/public/javascripts/widgets/tab_row.js+++ b/src/public/javascripts/widgets/tab_row.js@@ -409,12 +409,6 @@ export default class TabRowWidget extends BasicWidget {});}- get activeTabId() {- const tabEl = this.activeTabEl;-- return tabEl ? tabEl.getAttribute('data-tab-id') : null;- }-get activeTabEl() {return this.$widget.find('.note-tab[active]')[0];}