react-sigma-conglei
Version:
Lightweight but powerful library for drawing network graphs built on top of dunnock/react-sigma
1 lines • 199 kB
JavaScript
var ReactSigma=function(e){function t(n){if(i[n])return i[n].exports;var r=i[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var i={};return t.m=e,t.c=i,t.i=function(e){return e},t.d=function(e,i,n){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=20)}([function(e,t){e.exports=void 0},function(e,t,i){"use strict";function n(e,t){return o.a.Children.map(e,function(e){return o.a.cloneElement(e,t)})}t.a=n;var r=i(0),o=i.n(r)},function(e,t){!function(e){function t(n){if(i[n])return i[n].exports;var r=i[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var i={};t.m=e,t.c=i,t.i=function(e){return e},t.d=function(e,i,n){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=81)}(Array(34).concat([function(e,t){(function(){(function(e){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.captors"),sigma.captors.mouse=function(e,t,i){function n(e){var t,i,n;if(A("mouseEnabled")&&(w.dispatchEvent("mousemove",sigma.utils.mouseCoords(e)),m))return y=!0,v=!0,x&&clearTimeout(x),x=setTimeout(function(){y=!1},A("dragTimeout")),sigma.misc.animation.killAll(_),_.isMoving=!0,n=_.cameraPosition(sigma.utils.getX(e)-f,sigma.utils.getY(e)-p,!0),t=c-n.x,i=u-n.y,t===_.x&&i===_.y||(h=_.x,g=_.y,_.goTo({x:t,y:i})),e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation(),!1}function r(e){if(A("mouseEnabled")&&m){m=!1,x&&clearTimeout(x),_.isMoving=!1;var t=sigma.utils.getX(e),i=sigma.utils.getY(e);y?(sigma.misc.animation.killAll(_),sigma.misc.animation.camera(_,{x:_.x+A("mouseInertiaRatio")*(_.x-h),y:_.y+A("mouseInertiaRatio")*(_.y-g)},{easing:"quadraticOut",duration:A("mouseInertiaDuration")})):f===t&&p===i||_.goTo({x:_.x,y:_.y}),w.dispatchEvent("mouseup",sigma.utils.mouseCoords(e)),y=!1}}function o(e){if(A("mouseEnabled"))switch(c=_.x,u=_.y,h=_.x,g=_.y,f=sigma.utils.getX(e),p=sigma.utils.getY(e),v=!1,b=(new Date).getTime(),e.which){case 2:break;case 3:w.dispatchEvent("rightclick",sigma.utils.mouseCoords(e,f,p));break;default:m=!0,w.dispatchEvent("mousedown",sigma.utils.mouseCoords(e,f,p))}}function s(e){A("mouseEnabled")&&w.dispatchEvent("mouseout")}function a(e){if(A("mouseEnabled")){var t=sigma.utils.mouseCoords(e);t.isDragging=(new Date).getTime()-b>100&&v,w.dispatchEvent("click",t)}return e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation(),!1}function l(e){var t,i,n;if(A("mouseEnabled"))return i=1/A("doubleClickZoomingRatio"),w.dispatchEvent("doubleclick",sigma.utils.mouseCoords(e,f,p)),A("doubleClickEnabled")&&(t=_.cameraPosition(sigma.utils.getX(e)-sigma.utils.getCenter(e).x,sigma.utils.getY(e)-sigma.utils.getCenter(e).y,!0),n={duration:A("doubleClickZoomDuration")},sigma.utils.zoomTo(_,t.x,t.y,i,n)),e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation(),!1}function d(e){var t,i,n,r=sigma.utils.getDelta(e);if(A("mouseEnabled")&&A("mouseWheelEnabled")&&0!==r)return i=r>0?1/A("zoomingRatio"):A("zoomingRatio"),t=_.cameraPosition(sigma.utils.getX(e)-sigma.utils.getCenter(e).x,sigma.utils.getY(e)-sigma.utils.getCenter(e).y,!0),n={duration:A("mouseZoomDuration")},sigma.utils.zoomTo(_,t.x,t.y,i,n),e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation(),!1}var c,u,h,g,f,p,m,y,v,b,x,w=this,E=e,_=t,A=i;sigma.classes.dispatcher.extend(this),sigma.utils.doubleClick(E,"click",l),E.addEventListener("DOMMouseScroll",d,!1),E.addEventListener("mousewheel",d,!1),E.addEventListener("mousemove",n,!1),E.addEventListener("mousedown",o,!1),E.addEventListener("click",a,!1),E.addEventListener("mouseout",s,!1),document.addEventListener("mouseup",r,!1),this.kill=function(){sigma.utils.unbindDoubleClick(E,"click"),E.removeEventListener("DOMMouseScroll",d),E.removeEventListener("mousewheel",d),E.removeEventListener("mousemove",n),E.removeEventListener("mousedown",o),E.removeEventListener("click",a),E.removeEventListener("mouseout",s),document.removeEventListener("mouseup",r)}}}).call(this)}).call(window)},function(e,t){(function(){(function(e){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.captors"),sigma.captors.touch=function(e,t,i){function n(e){var t=sigma.utils.getOffset(C);return{x:e.pageX-t.left,y:e.pageY-t.top}}function r(e){if(M("touchEnabled")){var t,i,r,o,s,a;switch(P=e.touches,P.length){case 1:k.isMoving=!0,E=1,l=k.x,d=k.y,h=k.x,g=k.y,s=n(P[0]),m=s.x,y=s.y;break;case 2:return k.isMoving=!0,E=2,s=n(P[0]),a=n(P[1]),t=s.x,r=s.y,i=a.x,o=a.y,h=k.x,g=k.y,c=k.angle,u=k.ratio,l=k.x,d=k.y,m=t,y=r,v=i,b=o,x=Math.atan2(b-y,v-m),w=Math.sqrt((b-y)*(b-y)+(v-m)*(v-m)),e.preventDefault(),!1}}}function o(e){if(M("touchEnabled")){P=e.touches;var t=M("touchInertiaRatio");switch(T&&(_=!1,clearTimeout(T)),E){case 2:if(1===e.touches.length){r(e),e.preventDefault();break}case 1:k.isMoving=!1,S.dispatchEvent("stopDrag"),_&&(A=!1,sigma.misc.animation.camera(k,{x:k.x+t*(k.x-h),y:k.y+t*(k.y-g)},{easing:"quadraticOut",duration:M("touchInertiaDuration")})),_=!1,E=0}}}function s(e){if(!A&&M("touchEnabled")){var t,i,r,o,s,a,C,N,O,z,j,L,I,R,F,B,D;switch(P=e.touches,_=!0,T&&clearTimeout(T),T=setTimeout(function(){_=!1},M("dragTimeout")),E){case 1:N=n(P[0]),t=N.x,r=N.y,z=k.cameraPosition(t-m,r-y,!0),R=l-z.x,F=d-z.y,R===k.x&&F===k.y||(h=k.x,g=k.y,k.goTo({x:R,y:F}),S.dispatchEvent("mousemove",sigma.utils.mouseCoords(e,N.x,N.y)),S.dispatchEvent("drag"));break;case 2:N=n(P[0]),O=n(P[1]),t=N.x,r=N.y,i=O.x,o=O.y,j=k.cameraPosition((m+v)/2-sigma.utils.getCenter(e).x,(y+b)/2-sigma.utils.getCenter(e).y,!0),C=k.cameraPosition((t+i)/2-sigma.utils.getCenter(e).x,(r+o)/2-sigma.utils.getCenter(e).y,!0),L=Math.atan2(o-r,i-t)-x,I=Math.sqrt((o-r)*(o-r)+(i-t)*(i-t))/w,t=j.x,r=j.y,B=u/I,t*=I,r*=I,D=c-L,s=Math.cos(-L),a=Math.sin(-L),i=t*s+r*a,o=r*s-t*a,t=i,r=o,R=t-C.x+l,F=r-C.y+d,B===k.ratio&&D===k.angle&&R===k.x&&F===k.y||(h=k.x,g=k.y,f=k.angle,p=k.ratio,k.goTo({x:R,y:F,angle:D,ratio:B}),S.dispatchEvent("drag"))}return e.preventDefault(),!1}}function a(e){var t,i,r;if(e.touches&&1===e.touches.length&&M("touchEnabled"))return A=!0,i=1/M("doubleClickZoomingRatio"),t=n(e.touches[0]),S.dispatchEvent("doubleclick",sigma.utils.mouseCoords(e,t.x,t.y)),M("doubleClickEnabled")&&(t=k.cameraPosition(t.x-sigma.utils.getCenter(e).x,t.y-sigma.utils.getCenter(e).y,!0),r={duration:M("doubleClickZoomDuration"),onComplete:function(){A=!1}},sigma.utils.zoomTo(k,t.x,t.y,i,r)),e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation(),!1}var l,d,c,u,h,g,f,p,m,y,v,b,x,w,E,_,A,T,S=this,C=e,k=t,M=i,P=[];sigma.classes.dispatcher.extend(this),sigma.utils.doubleClick(C,"touchstart",a),C.addEventListener("touchstart",r,!1),C.addEventListener("touchend",o,!1),C.addEventListener("touchcancel",o,!1),C.addEventListener("touchleave",o,!1),C.addEventListener("touchmove",s,!1),this.kill=function(){sigma.utils.unbindDoubleClick(C,"touchstart"),C.addEventListener("touchstart",r),C.addEventListener("touchend",o),C.addEventListener("touchcancel",o),C.addEventListener("touchleave",o),C.addEventListener("touchmove",s)}}}).call(this)}).call(window)},function(e,t){(function(){(function(e){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.classes"),sigma.classes.camera=function(e,t,i,n){sigma.classes.dispatcher.extend(this),Object.defineProperty(this,"graph",{value:t}),Object.defineProperty(this,"id",{value:e}),Object.defineProperty(this,"readPrefix",{value:"read_cam"+e+":"}),Object.defineProperty(this,"prefix",{value:"cam"+e+":"}),this.x=0,this.y=0,this.ratio=1,this.angle=0,this.isAnimated=!1,this.settings="object"==typeof n&&n?i.embedObject(n):i},sigma.classes.camera.prototype.goTo=function(t){if(!this.settings("enableCamera"))return this;var i,n,r=t||{},o=["x","y","ratio","angle"];for(i=0,n=o.length;i<n;i++)if(r[o[i]]!==e){if("number"!=typeof r[o[i]]||isNaN(r[o[i]]))throw'Value for "'+o[i]+'" is not a number.';this[o[i]]=r[o[i]]}return this.dispatchEvent("coordinatesUpdated"),this},sigma.classes.camera.prototype.applyView=function(t,i,n){n=n||{},i=i!==e?i:this.prefix,t=t!==e?t:this.readPrefix;var r,o,s,a=n.nodes||this.graph.nodes(),l=n.edges||this.graph.edges(),d=Math.cos(this.angle)/this.ratio,c=Math.sin(this.angle)/this.ratio,u=Math.pow(this.ratio,this.settings("nodesPowRatio")),h=Math.pow(this.ratio,this.settings("edgesPowRatio")),g=(n.width||0)/2-this.x*d-this.y*c,f=(n.height||0)/2-this.y*d+this.x*c;for(r=0,o=a.length;r<o;r++)s=a[r],s[i+"x"]=(s[t+"x"]||0)*d+(s[t+"y"]||0)*c+g,s[i+"y"]=(s[t+"y"]||0)*d-(s[t+"x"]||0)*c+f,s[i+"size"]=(s[t+"size"]||0)/u;for(r=0,o=l.length;r<o;r++)l[r][i+"size"]=(l[r][t+"size"]||0)/h;return this},sigma.classes.camera.prototype.graphPosition=function(e,t,i){var n=0,r=0,o=Math.cos(this.angle),s=Math.sin(this.angle);return i||(n=-(this.x*o+this.y*s)/this.ratio,r=-(this.y*o-this.x*s)/this.ratio),{x:(e*o+t*s)/this.ratio+n,y:(t*o-e*s)/this.ratio+r}},sigma.classes.camera.prototype.cameraPosition=function(e,t,i){var n=0,r=0,o=Math.cos(this.angle),s=Math.sin(this.angle);return i||(n=-(this.x*o+this.y*s)/this.ratio,r=-(this.y*o-this.x*s)/this.ratio),{x:((e-n)*o-(t-r)*s)*this.ratio,y:((t-r)*o+(e-n)*s)*this.ratio}},sigma.classes.camera.prototype.getMatrix=function(){var e=sigma.utils.matrices.scale(1/this.ratio),t=sigma.utils.matrices.rotation(this.angle),i=sigma.utils.matrices.translation(-this.x,-this.y);return sigma.utils.matrices.multiply(i,sigma.utils.matrices.multiply(t,e))},sigma.classes.camera.prototype.getRectangle=function(e,t){var i=this.cameraPosition(e,0,!0),n=this.cameraPosition(0,t,!0),r=this.cameraPosition(e/2,t/2,!0),o=this.cameraPosition(e/4,0,!0).x,s=this.cameraPosition(0,t/4,!0).y;return{x1:this.x-r.x-o,y1:this.y-r.y-s,x2:this.x-r.x+o+i.x,y2:this.y-r.y-s+i.y,height:Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y+2*s,2))}}}).call(this)}).call(window)},function(e,t,i){(function(){(function(){"use strict";var i=function(){var e,t,n={},r=Array.prototype.slice.call(arguments,0),o=function(e,t){var i,s,a,l;{if(1!==arguments.length||"string"!=typeof e){if("object"==typeof e&&"string"==typeof t)return void 0!==(e||{})[t]?e[t]:o(t);for(i="object"==typeof e&&void 0===t?e:{},"string"==typeof e&&(i[e]=t),s=0,l=Object.keys(i),a=l.length;s<a;s++)n[l[s]]=i[l[s]];return this}if(void 0!==n[e])return n[e];for(s=0,a=r.length;s<a;s++)if(void 0!==r[s][e])return r[s][e]}};for(o.embedObjects=function(){var e=r.concat(n).concat(Array.prototype.splice.call(arguments,0));return i.apply({},e)},e=0,t=arguments.length;e<t;e++)o(arguments[e]);return o};void 0!==this.sigma?(this.sigma.classes=this.sigma.classes||{},this.sigma.classes.configurable=i):(void 0!==e&&e.exports&&(t=e.exports=i),t.configurable=i)}).call(this)}).call(window)},function(e,t,i){(function(){(function(){"use strict";var i=function(){Object.defineProperty(this,"_handlers",{value:{}})};i.prototype.bind=function(e,t){var i,n,r,o;if(1===arguments.length&&"object"==typeof arguments[0])for(e in arguments[0])this.bind(e,arguments[0][e]);else{if(2!==arguments.length||"function"!=typeof arguments[1])throw"bind: Wrong arguments.";for(o="string"==typeof e?e.split(" "):e,i=0,n=o.length;i!==n;i+=1)(r=o[i])&&(this._handlers[r]||(this._handlers[r]=[]),this._handlers[r].push({handler:t}))}return this},i.prototype.unbind=function(e,t){var i,n,r,o,s,a,l,d="string"==typeof e?e.split(" "):e;if(!arguments.length){for(s in this._handlers)delete this._handlers[s];return this}if(t)for(i=0,n=d.length;i!==n;i+=1){if(l=d[i],this._handlers[l]){for(a=[],r=0,o=this._handlers[l].length;r!==o;r+=1)this._handlers[l][r].handler!==t&&a.push(this._handlers[l][r]);this._handlers[l]=a}this._handlers[l]&&0===this._handlers[l].length&&delete this._handlers[l]}else for(i=0,n=d.length;i!==n;i+=1)delete this._handlers[d[i]];return this},i.prototype.dispatchEvent=function(e,t){var i,n,r,o,s,a,l,d=this,c="string"==typeof e?e.split(" "):e;for(t=void 0===t?{}:t,i=0,n=c.length;i!==n;i+=1)if(l=c[i],this._handlers[l]){for(a=d.getEvent(l,t),s=[],r=0,o=this._handlers[l].length;r!==o;r+=1)this._handlers[l][r].handler(a),this._handlers[l][r].one||s.push(this._handlers[l][r]);this._handlers[l]=s}return this},i.prototype.getEvent=function(e,t){return{type:e,data:t||{},target:this}},i.extend=function(e,t){var n;for(n in i.prototype)i.prototype.hasOwnProperty(n)&&(e[n]=i.prototype[n]);i.apply(e,t)},void 0!==this.sigma?(this.sigma.classes=this.sigma.classes||{},this.sigma.classes.dispatcher=i):(void 0!==e&&e.exports&&(t=e.exports=i),t.dispatcher=i)}).call(this)}).call(window)},function(e,t,i){(function(){(function(i){"use strict";function n(e,t){var i=t.x+t.width/2,n=t.y+t.height/2,r=e.y<n,o=e.x<i;return r?o?0:1:o?2:3}function r(e,t){for(var i=[],n=0;n<4;n++)e.x2>=t[n][0].x&&e.x1<=t[n][1].x&&e.y1+e.height>=t[n][0].y&&e.y1<=t[n][2].y&&i.push(n);return i}function o(e,t){for(var i=[],n=0;n<4;n++)u.collision(e,t[n])&&i.push(n);return i}function s(e,t){var i,n,r=t.level+1,o=Math.round(t.bounds.width/2),s=Math.round(t.bounds.height/2),a=Math.round(t.bounds.x),l=Math.round(t.bounds.y);switch(e){case 0:i=a,n=l;break;case 1:i=a+o,n=l;break;case 2:i=a,n=l+s;break;case 3:i=a+o,n=l+s}return c({x:i,y:n,width:o,height:s},r,t.maxElements,t.maxLevel)}function a(e,t,n){if(n.level<n.maxLevel)for(var o=r(t,n.corners),l=0,d=o.length;l<d;l++)n.nodes[o[l]]===i&&(n.nodes[o[l]]=s(o[l],n)),a(e,t,n.nodes[o[l]]);else n.elements.push(e)}function l(e,t){if(t.level<t.maxLevel){var r=n(e,t.bounds);return t.nodes[r]!==i?l(e,t.nodes[r]):[]}return t.elements}function d(e,t,n,r){if(r=r||{},t.level<t.maxLevel)for(var o=n(e,t.corners),s=0,a=o.length;s<a;s++)t.nodes[o[s]]!==i&&d(e,t.nodes[o[s]],n,r);else for(var l=0,c=t.elements.length;l<c;l++)r[t.elements[l].id]===i&&(r[t.elements[l].id]=t.elements[l]);return r}function c(e,t,i,n){return{level:t||0,bounds:e,corners:u.splitSquare(e),maxElements:i||40,maxLevel:n||8,elements:[],nodes:[]}}var u={pointToSquare:function(e){return{x1:e.x-e.size,y1:e.y-e.size,x2:e.x+e.size,y2:e.y-e.size,height:2*e.size}},lineToSquare:function(e){return e.y1<e.y2?e.x1<e.x2?{x1:e.x1-e.size,y1:e.y1-e.size,x2:e.x2+e.size,y2:e.y1-e.size,height:e.y2-e.y1+2*e.size}:{x1:e.x2-e.size,y1:e.y1-e.size,x2:e.x1+e.size,y2:e.y1-e.size,height:e.y2-e.y1+2*e.size}:e.x1<e.x2?{x1:e.x1-e.size,y1:e.y2-e.size,x2:e.x2+e.size,y2:e.y2-e.size,height:e.y1-e.y2+2*e.size}:{x1:e.x2-e.size,y1:e.y2-e.size,x2:e.x1+e.size,y2:e.y2-e.size,height:e.y1-e.y2+2*e.size}},quadraticCurveToSquare:function(e,t){var i=sigma.utils.getPointOnQuadraticCurve(.5,e.x1,e.y1,e.x2,e.y2,t.x,t.y),n=Math.min(e.x1,e.x2,i.x),r=Math.max(e.x1,e.x2,i.x),o=Math.min(e.y1,e.y2,i.y),s=Math.max(e.y1,e.y2,i.y);return{x1:n-e.size,y1:o-e.size,x2:r+e.size,y2:o-e.size,height:s-o+2*e.size}},selfLoopToSquare:function(e){var t=sigma.utils.getSelfLoopControlPoints(e.x,e.y,e.size),i=Math.min(e.x,t.x1,t.x2),n=Math.max(e.x,t.x1,t.x2),r=Math.min(e.y,t.y1,t.y2),o=Math.max(e.y,t.y1,t.y2);return{x1:i-e.size,y1:r-e.size,x2:n+e.size,y2:r-e.size,height:o-r+2*e.size}},isAxisAligned:function(e){return e.x1===e.x2||e.y1===e.y2},axisAlignedTopPoints:function(e){return e.y1===e.y2&&e.x1<e.x2?e:e.x1===e.x2&&e.y2>e.y1?{x1:e.x1-e.height,y1:e.y1,x2:e.x1,y2:e.y1,height:e.height}:e.x1===e.x2&&e.y2<e.y1?{x1:e.x1,y1:e.y2,x2:e.x2+e.height,y2:e.y2,height:e.height}:{x1:e.x2,y1:e.y1-e.height,x2:e.x1,y2:e.y1-e.height,height:e.height}},lowerLeftCoor:function(e){var t=Math.sqrt(Math.pow(e.x2-e.x1,2)+Math.pow(e.y2-e.y1,2));return{x:e.x1-(e.y2-e.y1)*e.height/t,y:e.y1+(e.x2-e.x1)*e.height/t}},lowerRightCoor:function(e,t){return{x:t.x-e.x1+e.x2,y:t.y-e.y1+e.y2}},rectangleCorners:function(e){var t=this.lowerLeftCoor(e),i=this.lowerRightCoor(e,t);return[{x:e.x1,y:e.y1},{x:e.x2,y:e.y2},{x:t.x,y:t.y},{x:i.x,y:i.y}]},splitSquare:function(e){return[[{x:e.x,y:e.y},{x:e.x+e.width/2,y:e.y},{x:e.x,y:e.y+e.height/2},{x:e.x+e.width/2,y:e.y+e.height/2}],[{x:e.x+e.width/2,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width/2,y:e.y+e.height/2},{x:e.x+e.width,y:e.y+e.height/2}],[{x:e.x,y:e.y+e.height/2},{x:e.x+e.width/2,y:e.y+e.height/2},{x:e.x,y:e.y+e.height},{x:e.x+e.width/2,y:e.y+e.height}],[{x:e.x+e.width/2,y:e.y+e.height/2},{x:e.x+e.width,y:e.y+e.height/2},{x:e.x+e.width/2,y:e.y+e.height},{x:e.x+e.width,y:e.y+e.height}]]},axis:function(e,t){return[{x:e[1].x-e[0].x,y:e[1].y-e[0].y},{x:e[1].x-e[3].x,y:e[1].y-e[3].y},{x:t[0].x-t[2].x,y:t[0].y-t[2].y},{x:t[0].x-t[1].x,y:t[0].y-t[1].y}]},projection:function(e,t){var i=(e.x*t.x+e.y*t.y)/(Math.pow(t.x,2)+Math.pow(t.y,2));return{x:i*t.x,y:i*t.y}},axisCollision:function(e,t,i){for(var n=[],r=[],o=0;o<4;o++){var s=this.projection(t[o],e),a=this.projection(i[o],e);n.push(s.x*e.x+s.y*e.y),r.push(a.x*e.x+a.y*e.y)}var l=Math.max.apply(Math,n),d=Math.max.apply(Math,r),c=Math.min.apply(Math,n);return Math.min.apply(Math,r)<=l&&d>=c},collision:function(e,t){for(var i=this.axis(e,t),n=!0,r=0;r<4;r++)n=n&&this.axisCollision(i[r],e,t);return n}},h=function(){this._geom=u,this._tree=null,this._cache={query:!1,result:!1},this._enabled=!0};h.prototype.index=function(e,t){if(!this._enabled)return this._tree;if(!t.bounds)throw"sigma.classes.edgequad.index: bounds information not given.";var i,n,r,o,s,l=t.prefix||"";this._tree=c(t.bounds,0,t.maxElements,t.maxLevel);for(var d=e.edges(),h=0,g=d.length;h<g;h++)n=e.nodes(d[h].source),r=e.nodes(d[h].target),s={x1:n[l+"x"],y1:n[l+"y"],x2:r[l+"x"],y2:r[l+"y"],size:d[h][l+"size"]||0},"curve"===d[h].type||"curvedArrow"===d[h].type?n.id===r.id?(o={x:n[l+"x"],y:n[l+"y"],size:n[l+"size"]||0},a(d[h],u.selfLoopToSquare(o),this._tree)):(i=sigma.utils.getQuadraticControlPoint(s.x1,s.y1,s.x2,s.y2),a(d[h],u.quadraticCurveToSquare(s,i),this._tree)):a(d[h],u.lineToSquare(s),this._tree);return this._cache={query:!1,result:!1},this._tree},h.prototype.point=function(e,t){return this._enabled&&this._tree?l({x:e,y:t},this._tree)||[]:[]},h.prototype.area=function(e){if(!this._enabled)return[];var t,i,n=JSON.stringify(e);if(this._cache.query===n)return this._cache.result;u.isAxisAligned(e)?(t=r,i=u.axisAlignedTopPoints(e)):(t=o,i=u.rectangleCorners(e));var s=this._tree?d(i,this._tree,t):[],a=[];for(var l in s)a.push(s[l]);return this._cache.query=n,this._cache.result=a,a},void 0!==this.sigma?(this.sigma.classes=this.sigma.classes||{},this.sigma.classes.edgequad=h):(void 0!==e&&e.exports&&(t=e.exports=h),t.edgequad=h)}).call(this)}).call(window)},function(e,t,i){(function(){(function(i){"use strict";function n(e,t,i){return function(){var n,r;for(n in d[e])d[e][n].apply(t,arguments);r=i.apply(t,arguments);for(n in l[e])l[e][n].apply(t,arguments);return r}}function r(e){var t;for(t in e)"hasOwnProperty"in e&&!e.hasOwnProperty(t)||delete e[t];return e}var o=Object.create(null),s=Object.create(null),a=Object.create(null),l=Object.create(null),d=Object.create(null),c={immutable:!0,clone:!0},u=function(e){return c[e]},h=function(e){var t,i,r;r={settings:e||u,nodesArray:[],edgesArray:[],nodesIndex:Object.create(null),edgesIndex:Object.create(null),inNeighborsIndex:Object.create(null),outNeighborsIndex:Object.create(null),allNeighborsIndex:Object.create(null),inNeighborsCount:Object.create(null),outNeighborsCount:Object.create(null),allNeighborsCount:Object.create(null)};for(t in a)a[t].call(r);for(t in o)i=n(t,r,o[t]),this[t]=i,r[t]=i};h.addMethod=function(e,t){if("string"!=typeof e||"function"!=typeof t||2!==arguments.length)throw"addMethod: Wrong arguments.";if(o[e]||h[e])throw'The method "'+e+'" already exists.';return o[e]=t,l[e]=Object.create(null),d[e]=Object.create(null),this},h.hasMethod=function(e){return!(!o[e]&&!h[e])},h.attach=function(e,t,i,n){if("string"!=typeof e||"string"!=typeof t||"function"!=typeof i||arguments.length<3||arguments.length>4)throw"attach: Wrong arguments.";var r;if("constructor"===e)r=a;else if(n){if(!d[e])throw'The method "'+e+'" does not exist.';r=d[e]}else{if(!l[e])throw'The method "'+e+'" does not exist.';r=l[e]}if(r[t])throw'A function "'+t+'" is already attached to the method "'+e+'".';return r[t]=i,this},h.attachBefore=function(e,t,i){return this.attach(e,t,i,!0)},h.addIndex=function(e,t){if("string"!=typeof e||Object(t)!==t||2!==arguments.length)throw"addIndex: Wrong arguments.";if(s[e])throw'The index "'+e+'" already exists.';var i;s[e]=t;for(i in t){if("function"!=typeof t[i])throw"The bindings must be functions.";h.attach(i,e,t[i])}return this},h.addMethod("addNode",function(e){if(Object(e)!==e||1!==arguments.length)throw"addNode: Wrong arguments.";if("string"!=typeof e.id&&"number"!=typeof e.id)throw"The node must have a string or number id.";if(this.nodesIndex[e.id])throw'The node "'+e.id+'" already exists.';var t,i=e.id,n=Object.create(null);if(this.settings("clone"))for(t in e)"id"!==t&&(n[t]=e[t]);else n=e;return this.settings("immutable")?Object.defineProperty(n,"id",{value:i,enumerable:!0}):n.id=i,this.inNeighborsIndex[i]=Object.create(null),this.outNeighborsIndex[i]=Object.create(null),this.allNeighborsIndex[i]=Object.create(null),this.inNeighborsCount[i]=0,this.outNeighborsCount[i]=0,this.allNeighborsCount[i]=0,this.nodesArray.push(n),this.nodesIndex[n.id]=n,this}),h.addMethod("addEdge",function(e){if(Object(e)!==e||1!==arguments.length)throw"addEdge: Wrong arguments.";if("string"!=typeof e.id&&"number"!=typeof e.id)throw"The edge must have a string or number id.";if("string"!=typeof e.source&&"number"!=typeof e.source||!this.nodesIndex[e.source])throw"The edge source must have an existing node id.";if("string"!=typeof e.target&&"number"!=typeof e.target||!this.nodesIndex[e.target])throw"The edge target must have an existing node id.";if(this.edgesIndex[e.id])throw'The edge "'+e.id+'" already exists.';var t,i=Object.create(null);if(this.settings("clone"))for(t in e)"id"!==t&&"source"!==t&&"target"!==t&&(i[t]=e[t]);else i=e;return this.settings("immutable")?(Object.defineProperty(i,"id",{value:e.id,enumerable:!0}),Object.defineProperty(i,"source",{value:e.source,enumerable:!0}),Object.defineProperty(i,"target",{value:e.target,enumerable:!0})):(i.id=e.id,i.source=e.source,i.target=e.target),this.edgesArray.push(i),this.edgesIndex[i.id]=i,this.inNeighborsIndex[i.target][i.source]||(this.inNeighborsIndex[i.target][i.source]=Object.create(null)),this.inNeighborsIndex[i.target][i.source][i.id]=i,this.outNeighborsIndex[i.source][i.target]||(this.outNeighborsIndex[i.source][i.target]=Object.create(null)),this.outNeighborsIndex[i.source][i.target][i.id]=i,this.allNeighborsIndex[i.source][i.target]||(this.allNeighborsIndex[i.source][i.target]=Object.create(null)),this.allNeighborsIndex[i.source][i.target][i.id]=i,i.target!==i.source&&(this.allNeighborsIndex[i.target][i.source]||(this.allNeighborsIndex[i.target][i.source]=Object.create(null)),this.allNeighborsIndex[i.target][i.source][i.id]=i),this.inNeighborsCount[i.target]++,this.outNeighborsCount[i.source]++,this.allNeighborsCount[i.target]++,this.allNeighborsCount[i.source]++,this}),h.addMethod("dropNode",function(e){if("string"!=typeof e&&"number"!=typeof e||1!==arguments.length)throw"dropNode: Wrong arguments.";if(!this.nodesIndex[e])throw'The node "'+e+'" does not exist.';var t,i,n;for(delete this.nodesIndex[e],t=0,n=this.nodesArray.length;t<n;t++)if(this.nodesArray[t].id===e){this.nodesArray.splice(t,1);break}for(t=this.edgesArray.length-1;t>=0;t--)this.edgesArray[t].source!==e&&this.edgesArray[t].target!==e||this.dropEdge(this.edgesArray[t].id);delete this.inNeighborsIndex[e],delete this.outNeighborsIndex[e],delete this.allNeighborsIndex[e],delete this.inNeighborsCount[e],delete this.outNeighborsCount[e],delete this.allNeighborsCount[e];for(i in this.nodesIndex)delete this.inNeighborsIndex[i][e],delete this.outNeighborsIndex[i][e],delete this.allNeighborsIndex[i][e];return this}),h.addMethod("dropEdge",function(e){if("string"!=typeof e&&"number"!=typeof e||1!==arguments.length)throw"dropEdge: Wrong arguments.";if(!this.edgesIndex[e])throw'The edge "'+e+'" does not exist.';var t,i,n;for(n=this.edgesIndex[e],delete this.edgesIndex[e],t=0,i=this.edgesArray.length;t<i;t++)if(this.edgesArray[t].id===e){this.edgesArray.splice(t,1);break}return delete this.inNeighborsIndex[n.target][n.source][n.id],Object.keys(this.inNeighborsIndex[n.target][n.source]).length||delete this.inNeighborsIndex[n.target][n.source],delete this.outNeighborsIndex[n.source][n.target][n.id],Object.keys(this.outNeighborsIndex[n.source][n.target]).length||delete this.outNeighborsIndex[n.source][n.target],delete this.allNeighborsIndex[n.source][n.target][n.id],Object.keys(this.allNeighborsIndex[n.source][n.target]).length||delete this.allNeighborsIndex[n.source][n.target],n.target!==n.source&&(delete this.allNeighborsIndex[n.target][n.source][n.id],Object.keys(this.allNeighborsIndex[n.target][n.source]).length||delete this.allNeighborsIndex[n.target][n.source]),this.inNeighborsCount[n.target]--,this.outNeighborsCount[n.source]--,this.allNeighborsCount[n.source]--,this.allNeighborsCount[n.target]--,this}),h.addMethod("kill",function(){this.nodesArray.length=0,this.edgesArray.length=0,delete this.nodesArray,delete this.edgesArray,delete this.nodesIndex,delete this.edgesIndex,delete this.inNeighborsIndex,delete this.outNeighborsIndex,delete this.allNeighborsIndex,delete this.inNeighborsCount,delete this.outNeighborsCount,delete this.allNeighborsCount}),h.addMethod("clear",function(){return this.nodesArray.length=0,this.edgesArray.length=0,r(this.nodesIndex),r(this.edgesIndex),r(this.nodesIndex),r(this.inNeighborsIndex),r(this.outNeighborsIndex),r(this.allNeighborsIndex),r(this.inNeighborsCount),r(this.outNeighborsCount),r(this.allNeighborsCount),this}),h.addMethod("read",function(e){var t,i,n;for(i=e.nodes||[],t=0,n=i.length;t<n;t++)this.addNode(i[t]);for(i=e.edges||[],t=0,n=i.length;t<n;t++)this.addEdge(i[t]);return this}),h.addMethod("nodes",function(e){if(!arguments.length)return this.nodesArray.slice(0);if(1===arguments.length&&("string"==typeof e||"number"==typeof e))return this.nodesIndex[e];if(1===arguments.length&&"[object Array]"===Object.prototype.toString.call(e)){var t,i,n=[];for(t=0,i=e.length;t<i;t++){if("string"!=typeof e[t]&&"number"!=typeof e[t])throw"nodes: Wrong arguments.";n.push(this.nodesIndex[e[t]])}return n}throw"nodes: Wrong arguments."}),h.addMethod("degree",function(e,t){if(t={in:this.inNeighborsCount,out:this.outNeighborsCount}[t||""]||this.allNeighborsCount,"string"==typeof e||"number"==typeof e)return t[e];if("[object Array]"===Object.prototype.toString.call(e)){var i,n,r=[];for(i=0,n=e.length;i<n;i++){if("string"!=typeof e[i]&&"number"!=typeof e[i])throw"degree: Wrong arguments.";r.push(t[e[i]])}return r}throw"degree: Wrong arguments."}),h.addMethod("edges",function(e){if(!arguments.length)return this.edgesArray.slice(0);if(1===arguments.length&&("string"==typeof e||"number"==typeof e))return this.edgesIndex[e];if(1===arguments.length&&"[object Array]"===Object.prototype.toString.call(e)){var t,i,n=[];for(t=0,i=e.length;t<i;t++){if("string"!=typeof e[t]&&"number"!=typeof e[t])throw"edges: Wrong arguments.";n.push(this.edgesIndex[e[t]])}return n}throw"edges: Wrong arguments."}),"undefined"!=typeof sigma?(sigma.classes=sigma.classes||Object.create(null),sigma.classes.graph=h):(void 0!==e&&e.exports&&(t=e.exports=h),t.graph=h)}).call(this)}).call(window)},function(e,t,i){(function(){(function(i){"use strict";function n(e,t){var i=t.x+t.width/2,n=t.y+t.height/2,r=e.y<n,o=e.x<i;return r?o?0:1:o?2:3}function r(e,t){for(var i=[],n=0;n<4;n++)e.x2>=t[n][0].x&&e.x1<=t[n][1].x&&e.y1+e.height>=t[n][0].y&&e.y1<=t[n][2].y&&i.push(n);return i}function o(e,t){for(var i=[],n=0;n<4;n++)u.collision(e,t[n])&&i.push(n);return i}function s(e,t){var i,n,r=t.level+1,o=Math.round(t.bounds.width/2),s=Math.round(t.bounds.height/2),a=Math.round(t.bounds.x),l=Math.round(t.bounds.y);switch(e){case 0:i=a,n=l;break;case 1:i=a+o,n=l;break;case 2:i=a,n=l+s;break;case 3:i=a+o,n=l+s}return c({x:i,y:n,width:o,height:s},r,t.maxElements,t.maxLevel)}function a(e,t,n){if(n.level<n.maxLevel)for(var o=r(t,n.corners),l=0,d=o.length;l<d;l++)n.nodes[o[l]]===i&&(n.nodes[o[l]]=s(o[l],n)),a(e,t,n.nodes[o[l]]);else n.elements.push(e)}function l(e,t){if(t.level<t.maxLevel){var r=n(e,t.bounds);return t.nodes[r]!==i?l(e,t.nodes[r]):[]}return t.elements}function d(e,t,n,r){if(r=r||{},t.level<t.maxLevel)for(var o=n(e,t.corners),s=0,a=o.length;s<a;s++)t.nodes[o[s]]!==i&&d(e,t.nodes[o[s]],n,r);else for(var l=0,c=t.elements.length;l<c;l++)r[t.elements[l].id]===i&&(r[t.elements[l].id]=t.elements[l]);return r}function c(e,t,i,n){return{level:t||0,bounds:e,corners:u.splitSquare(e),maxElements:i||20,maxLevel:n||4,elements:[],nodes:[]}}var u={pointToSquare:function(e){return{x1:e.x-e.size,y1:e.y-e.size,x2:e.x+e.size,y2:e.y-e.size,height:2*e.size}},isAxisAligned:function(e){return e.x1===e.x2||e.y1===e.y2},axisAlignedTopPoints:function(e){return e.y1===e.y2&&e.x1<e.x2?e:e.x1===e.x2&&e.y2>e.y1?{x1:e.x1-e.height,y1:e.y1,x2:e.x1,y2:e.y1,height:e.height}:e.x1===e.x2&&e.y2<e.y1?{x1:e.x1,y1:e.y2,x2:e.x2+e.height,y2:e.y2,height:e.height}:{x1:e.x2,y1:e.y1-e.height,x2:e.x1,y2:e.y1-e.height,height:e.height}},lowerLeftCoor:function(e){var t=Math.sqrt(Math.pow(e.x2-e.x1,2)+Math.pow(e.y2-e.y1,2));return{x:e.x1-(e.y2-e.y1)*e.height/t,y:e.y1+(e.x2-e.x1)*e.height/t}},lowerRightCoor:function(e,t){return{x:t.x-e.x1+e.x2,y:t.y-e.y1+e.y2}},rectangleCorners:function(e){var t=this.lowerLeftCoor(e),i=this.lowerRightCoor(e,t);return[{x:e.x1,y:e.y1},{x:e.x2,y:e.y2},{x:t.x,y:t.y},{x:i.x,y:i.y}]},splitSquare:function(e){return[[{x:e.x,y:e.y},{x:e.x+e.width/2,y:e.y},{x:e.x,y:e.y+e.height/2},{x:e.x+e.width/2,y:e.y+e.height/2}],[{x:e.x+e.width/2,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width/2,y:e.y+e.height/2},{x:e.x+e.width,y:e.y+e.height/2}],[{x:e.x,y:e.y+e.height/2},{x:e.x+e.width/2,y:e.y+e.height/2},{x:e.x,y:e.y+e.height},{x:e.x+e.width/2,y:e.y+e.height}],[{x:e.x+e.width/2,y:e.y+e.height/2},{x:e.x+e.width,y:e.y+e.height/2},{x:e.x+e.width/2,y:e.y+e.height},{x:e.x+e.width,y:e.y+e.height}]]},axis:function(e,t){return[{x:e[1].x-e[0].x,y:e[1].y-e[0].y},{x:e[1].x-e[3].x,y:e[1].y-e[3].y},{x:t[0].x-t[2].x,y:t[0].y-t[2].y},{x:t[0].x-t[1].x,y:t[0].y-t[1].y}]},projection:function(e,t){var i=(e.x*t.x+e.y*t.y)/(Math.pow(t.x,2)+Math.pow(t.y,2));return{x:i*t.x,y:i*t.y}},axisCollision:function(e,t,i){for(var n=[],r=[],o=0;o<4;o++){var s=this.projection(t[o],e),a=this.projection(i[o],e);n.push(s.x*e.x+s.y*e.y),r.push(a.x*e.x+a.y*e.y)}var l=Math.max.apply(Math,n),d=Math.max.apply(Math,r),c=Math.min.apply(Math,n);return Math.min.apply(Math,r)<=l&&d>=c},collision:function(e,t){for(var i=this.axis(e,t),n=!0,r=0;r<4;r++)n=n&&this.axisCollision(i[r],e,t);return n}},h=function(){this._geom=u,this._tree=null,this._cache={query:!1,result:!1}};h.prototype.index=function(e,t){if(!t.bounds)throw"sigma.classes.quad.index: bounds information not given.";var i=t.prefix||"";this._tree=c(t.bounds,0,t.maxElements,t.maxLevel);for(var n=0,r=e.length;n<r;n++)a(e[n],u.pointToSquare({x:e[n][i+"x"],y:e[n][i+"y"],size:e[n][i+"size"]}),this._tree);return this._cache={query:!1,result:!1},this._tree},h.prototype.point=function(e,t){return this._tree?l({x:e,y:t},this._tree)||[]:[]},h.prototype.area=function(e){var t,i,n=JSON.stringify(e);if(this._cache.query===n)return this._cache.result;u.isAxisAligned(e)?(t=r,i=u.axisAlignedTopPoints(e)):(t=o,i=u.rectangleCorners(e));var s=this._tree?d(i,this._tree,t):[],a=[];for(var l in s)a.push(s[l]);return this._cache.query=n,this._cache.result=a,a},void 0!==this.sigma?(this.sigma.classes=this.sigma.classes||{},this.sigma.classes.quad=h):(void 0!==e&&e.exports&&(t=e.exports=h),t.quad=h)}).call(this)}).call(window)},function(e,t,i){(function(){!function(i){"use strict";function n(e,t){var i,r,o,s;if(arguments.length)if(1===arguments.length&&Object(arguments[0])===arguments[0])for(e in arguments[0])n(e,arguments[0][e]);else if(arguments.length>1)for(s=Array.isArray(e)?e:e.split(/ /),i=0,r=s.length;i!==r;i+=1)o=s[i],P[o]||(P[o]=[]),P[o].push({handler:t})}function r(e,t){var i,n,r,o,s,a,l=Array.isArray(e)?e:e.split(/ /);if(arguments.length)if(t)for(i=0,n=l.length;i!==n;i+=1){if(a=l[i],P[a]){for(s=[],r=0,o=P[a].length;r!==o;r+=1)P[a][r].handler!==t&&s.push(P[a][r]);P[a]=s}P[a]&&0===P[a].length&&delete P[a]}else for(i=0,n=l.length;i!==n;i+=1)delete P[l[i]];else P=Object.create(null)}function o(e,t){var i,n,r,o,s,a,l=Array.isArray(e)?e:e.split(/ /);for(t=void 0===t?{}:t,i=0,r=l.length;i!==r;i+=1)if(a=l[i],P[a])for(s={type:a,data:t||{}},n=0,o=P[a].length;n!==o;n+=1)try{P[a][n].handler(s)}catch(e){}}function s(){var e,t,i,n,r=!1,o=x(),s=T.shift();if(i=s.job(),o=x()-o,s.done++,s.time+=o,s.currentTime+=o,s.weightTime=s.currentTime/(s.weight||1),s.averageTime=s.time/s.done,!(n=s.count?s.count<=s.done:!i)){for(e=0,t=T.length;e<t;e++)if(T[e].weightTime>s.weightTime){T.splice(e,0,s),r=!0;break}r||T.push(s)}return n?s:null}function a(e){var t=T.length;A[e.id]=e,e.status="running",t&&(e.weightTime=T[t-1].weightTime,e.currentTime=e.weightTime*(e.weight||1)),e.startTime=x(),o("jobStarted",v(e)),T.push(e)}function l(){var e,t,i;for(e in _)t=_[e],t.after?S[e]=t:a(t),delete _[e];for(E=!!T.length;T.length&&x()-w<M.frameDuration;)if(i=s()){c(i.id);for(e in S)S[e].after===i.id&&(a(S[e]),delete S[e])}E?(w=x(),o("enterFrame"),setTimeout(l,0)):o("stop")}function d(e,t){var i,n,r;if(Array.isArray(e)){for(k=!0,i=0,n=e.length;i<n;i++)d(e[i].id,y(e[i],t));k=!1,E||(w=x(),o("start"),l())}else if("object"==typeof e)if("string"==typeof e.id)d(e.id,e);else{k=!0;for(i in e)"function"==typeof e[i]?d(i,y({job:e[i]},t)):d(i,y(e[i],t));k=!1,E||(w=x(),o("start"),l())}else{if("string"!=typeof e)throw new Error("[conrad.addJob] Wrong arguments.");if(h(e))throw new Error('[conrad.addJob] Job with id "'+e+'" already exists.');if("function"==typeof t)r={id:e,done:0,time:0,status:"waiting",currentTime:0,averageTime:0,weightTime:0,job:t};else{if("object"!=typeof t)throw new Error("[conrad.addJob] Wrong arguments.");r=y({id:e,done:0,time:0,status:"waiting",currentTime:0,averageTime:0,weightTime:0},t)}_[e]=r,o("jobAdded",v(r)),E||k||(w=x(),o("start"),l())}return this}function c(e){var t,i,n,r,s=!1;if(Array.isArray(e))for(t=0,i=e.length;t<i;t++)c(e[t]);else{if("string"!=typeof e)throw new Error("[conrad.killJob] Wrong arguments.");for(n=[A,S,_],t=0,i=n.length;t<i;t++)e in n[t]&&(r=n[t][e],M.history&&(r.status="done",C.push(r)),o("jobEnded",v(r)),delete n[t][e],"function"==typeof r.end&&r.end(),s=!0);for(n=T,t=0,i=n.length;t<i;t++)if(n[t].id===e){n.splice(t,1);break}if(!s)throw new Error('[conrad.killJob] Job "'+e+'" not found.')}return this}function u(){var e,t=y(_,A,S);if(M.history)for(e in t)t[e].status="done",C.push(t[e]),"function"==typeof t[e].end&&t[e].end();return _={},S={},A={},T=[],E=!1,this}function h(e){var t=_[e]||A[e]||S[e];return t?y(t):null}function g(e,t){var i;if("string"==typeof a1&&1===arguments.length)return M[a1];i="object"==typeof a1&&1===arguments.length?a1||{}:{},"string"==typeof a1&&(i[a1]=a2);for(var n in i)void 0!==i[n]?M[n]=i[n]:delete M[n];return this}function f(){return E}function p(){return C=[],this}function m(e,t){var i,n,r,o,s,a,l;if(!arguments.length){s=[];for(n in _)s.push(_[n]);for(n in S)s.push(S[n]);for(n in A)s.push(A[n]);s=s.concat(C)}if("string"==typeof e)switch(e){case"waiting":s=b(S);break;case"running":s=b(A);break;case"done":s=C;break;default:a=e}if(e instanceof RegExp&&(a=e),!a&&("string"==typeof t||t instanceof RegExp)&&(a=t),a){if(l="string"==typeof a,s instanceof Array)i=s;else if("object"==typeof s){i=[];for(n in s)i=i.concat(s[n])}else{i=[];for(n in _)i.push(_[n]);for(n in S)i.push(S[n]);for(n in A)i.push(A[n]);i=i.concat(C)}for(s=[],r=0,o=i.length;r<o;r++)(l?i[r].id===a:i[r].id.match(a))&&s.push(i[r])}return v(s)}function y(){var e,t,i={},n=arguments.length;for(e=n-1;e>=0;e--)for(t in arguments[e])i[t]=arguments[e][t];return i}function v(e){var t,i,n;if(!e)return e;if(Array.isArray(e))for(t=[],i=0,n=e.length;i<n;i++)t.push(v(e[i]));else if("object"==typeof e){t={};for(i in e)t[i]=v(e[i])}else t=e;return t}function b(e){var t,i=[];for(t in e)i.push(e[t]);return i}function x(){return Date.now?Date.now():(new Date).getTime()}if(i.conrad)throw new Error("conrad already exists");var w,E=!1,_={},A={},T=[],S={},C=[],k=!1,M={frameDuration:20,history:!0},P=Object.create(null);Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)});var N={hasJob:h,addJob:d,killJob:c,killAll:u,settings:g,getStats:m,isRunning:f,clearHistory:p,bind:n,unbind:r,version:"0.1.0"};void 0!==e&&e.exports&&(t=e.exports=N),t.conrad=N,i.conrad=N}(this)}).call(window)},function(e,t){(function(){(function(e){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.middlewares"),sigma.middlewares.copy=function(e,t){var i,n,r;if(t+""!=e+""){for(r=this.graph.nodes(),i=0,n=r.length;i<n;i++)r[i][t+"x"]=r[i][e+"x"],r[i][t+"y"]=r[i][e+"y"],r[i][t+"size"]=r[i][e+"size"];for(r=this.graph.edges(),i=0,n=r.length;i<n;i++)r[i][t+"size"]=r[i][e+"size"]}}}).call(this)}).call(window)},function(e,t){(function(){(function(e){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.middlewares"),sigma.utils.pkg("sigma.utils"),sigma.middlewares.rescale=function(e,t,i){var n,r,o,s,a,l,d,c,u=this.graph.nodes(),h=this.graph.edges(),g=this.settings.embedObjects(i||{}),f=g("bounds")||sigma.utils.getBoundaries(this.graph,e,!0),p=f.minX,m=f.minY,y=f.maxX,v=f.maxY,b=f.sizeMax,x=f.weightMax,w=g("width")||1,E=g("height")||1,_=g("autoRescale"),A={nodePosition:1,nodeSize:1,edgeSize:1};for(_ instanceof Array||(_=["nodePosition","nodeSize","edgeSize"]),n=0,r=_.length;n<r;n++)if(!A[_[n]])throw new Error('The rescale setting "'+_[n]+'" is not recognized.');var T=~_.indexOf("nodePosition"),S=~_.indexOf("nodeSize"),C=~_.indexOf("edgeSize");for(d="outside"===g("scalingMode")?Math.max(w/Math.max(y-p,1),E/Math.max(v-m,1)):Math.min(w/Math.max(y-p,1),E/Math.max(v-m,1)),c=(g("rescaleIgnoreSize")?0:(g("maxNodeSize")||b)/d)+(g("sideMargin")||0),y+=c,p-=c,v+=c,m-=c,d="outside"===g("scalingMode")?Math.max(w/Math.max(y-p,1),E/Math.max(v-m,1)):Math.min(w/Math.max(y-p,1),E/Math.max(v-m,1)),g("maxNodeSize")||g("minNodeSize")?g("maxNodeSize")===g("minNodeSize")?(o=0,s=+g("maxNodeSize")):(o=(g("maxNodeSize")-g("minNodeSize"))/b,s=+g("minNodeSize")):(o=1,s=0),g("maxEdgeSize")||g("minEdgeSize")?g("maxEdgeSize")===g("minEdgeSize")?(a=0,l=+g("minEdgeSize")):(a=(g("maxEdgeSize")-g("minEdgeSize"))/x,l=+g("minEdgeSize")):(a=1,l=0),n=0,r=h.length;n<r;n++)h[n][t+"size"]=h[n][e+"size"]*(C?a:1)+(C?l:0);for(n=0,r=u.length;n<r;n++)u[n][t+"size"]=u[n][e+"size"]*(S?o:1)+(S?s:0),u[n][t+"x"]=(u[n][e+"x"]-(y+p)/2)*(T?d:1),u[n][t+"y"]=(u[n][e+"y"]-(v+m)/2)*(T?d:1)},sigma.utils.getBoundaries=function(e,t,i){var n,r,o=e.edges(),s=e.nodes(),a=-1/0,l=-1/0,d=1/0,c=1/0,u=-1/0,h=-1/0;if(i)for(n=0,r=o.length;n<r;n++)a=Math.max(o[n][t+"size"],a);for(n=0,r=s.length;n<r;n++)l=Math.max(s[n][t+"size"],l),u=Math.max(s[n][t+"x"],u),d=Math.min(s[n][t+"x"],d),h=Math.max(s[n][t+"y"],h),c=Math.min(s[n][t+"y"],c);return a=a||1,l=l||1,{weightMax:a,sizeMax:l,minX:d,minY:c,maxX:u,maxY:h}}}).call(this)}).call(window)},function(e,t){(function(){(function(e){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.misc.animation.running");var t=function(){var e=0;return function(){return""+ ++e}}();sigma.misc.animation.camera=function(i,n,r){if(!(i instanceof sigma.classes.camera&&"object"==typeof n&&n))throw"animation.camera: Wrong arguments.";if("number"!=typeof n.x&&"number"!=typeof n.y&&"number"!=typeof n.ratio&&"number"!=typeof n.angle)throw"There must be at least one valid coordinate in the given val.";var o,s,a,l,d,c=r||{},u=sigma.utils.dateNow();return d={x:i.x,y:i.y,ratio:i.ratio,angle:i.angle},c.duration,l="function"!=typeof c.easing?sigma.utils.easings[c.easing||"quadraticInOut"]:c.easing,o=function(){var t,r=c.duration?(sigma.utils.dateNow()-u)/c.duration:1;r>=1?(i.isAnimated=!1,i.goTo({x:n.x!==e?n.x:d.x,y:n.y!==e?n.y:d.y,ratio:n.ratio!==e?n.ratio:d.ratio,angle:n.angle!==e?n.angle:d.angle}),cancelAnimationFrame(s),delete sigma.misc.animation.running[s],"function"==typeof c.onComplete&&c.onComplete()):(t=l(r),i.isAnimated=!0,i.goTo({x:n.x!==e?d.x+(n.x-d.x)*t:d.x,y:n.y!==e?d.y+(n.y-d.y)*t:d.y,ratio:n.ratio!==e?d.ratio+(n.ratio-d.ratio)*t:d.ratio,angle:n.angle!==e?d.angle+(n.angle-d.angle)*t:d.angle}),"function"==typeof c.onNewFrame&&c.onNewFrame(),a.frameId=requestAnimationFrame(o))},s=t(),a={frameId:requestAnimationFrame(o),target:i,type:"camera",options:c,fn:o},sigma.misc.animation.running[s]=a,s},sigma.misc.animation.kill=function(e){if(1!==arguments.length||"number"!=typeof e)throw"animation.kill: Wrong arguments.";var t=sigma.misc.animation.running[e];return t&&(cancelAnimationFrame(e),delete sigma.misc.animation.running[t.frameId],"camera"===t.type&&(t.target.isAnimated=!1),"function"==typeof(t.options||{}).onComplete&&t.options.onComplete()),this},sigma.misc.animation.killAll=function(e){var t,i,n=0,r="string"==typeof e?e:null,o="object"==typeof e?e:null,s=sigma.misc.animation.running;for(i in s)r&&s[i].type!==r||o&&s[i].target!==o||(t=sigma.misc.animation.running[i],cancelAnimationFrame(t.frameId),delete sigma.misc.animation.running[i],"camera"===t.type&&(t.target.isAnimated=!1),n++,"function"==typeof(t.options||{}).onComplete&&t.options.onComplete());return n},sigma.misc.animation.has=function(e){var t,i="string"==typeof e?e:null,n="object"==typeof e?e:null,r=sigma.misc.animation.running;for(t in r)if(!(i&&r[t].type!==i||n&&r[t].target!==n))return!0;return!1}}).call(this)}).call(window)},function(e,t){(function(){(function(e){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.misc"),sigma.misc.bindDOMEvents=function(e){function t(e){this.attr=function(t){return e.getAttributeNS(null,t)},this.tag=e.tagName,this.class=this.attr("class"),this.id=this.attr("id"),this.isNode=function(){return!!~this.class.indexOf(s.settings("classPrefix")+"-node")},this.isEdge=function(){return!!~this.class.indexOf(s.settings("classPrefix")+"-edge")},this.isHover=function(){return!!~this.class.indexOf(s.settings("classPrefix")+"-hover")}}function i(e){if(s.settings("eventsEnabled")){s.dispatchEvent("click",e);var i=new t(e.target);i.isNode()?s.dispatchEvent("clickNode",{node:a.nodes(i.attr("data-node-id"))}):s.dispatchEvent("clickStage"),e.preventDefault(),e.stopPropagation()}}function n(e){if(s.settings("eventsEnabled")){s.dispatchEvent("doubleClick",e);var i=new t(e.target);i.isNode()?s.dispatchEvent("doubleClickNode",{node:a.nodes(i.attr("data-node-id"))}):s.dispatchEvent("doubleClickStage"),e.preventDefault(),e.stopPropagation()}}function r(e){var i=e.toElement||e.target;if(s.settings("eventsEnabled")&&i){var n=new t(i);if(n.isNode())s.dispatchEvent("overNode",{node:a.nodes(n.attr("data-node-id"))});else if(n.isEdge()){var r=a.edges(n.attr("data-edge-id"));s.dispatchEvent("overEdge",{edge:r,source:a.nodes(r.source),target:a.nodes(r.target)})}}}function o(e){var i=e.fromElement||e.originalTarget;if(s.settings("eventsEnabled")){var n=new t(i);if(n.isNode())s.dispatchEvent("outNode",{node:a.nodes(n.attr("data-node-id"))});else if(n.isEdge()){var r=a.edges(n.attr("data-edge-id"));s.dispatchEvent("outEdge",{edge:r,source:a.nodes(r.source),target:a.nodes(r.target)})}}}var s=this,a=this.graph;e.addEventListener("click",i,!1),sigma.utils.doubleClick(e,"click",n),e.addEventListener("touchstart",i,!1),sigma.utils.doubleClick(e,"touchstart",n),e.addEventListener("mouseover",r,!0),e.addEventListener("mouseout",o,!0)}}).call(this)}).call(window)},function(e,t){(function(){(function(e){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.misc"),sigma.misc.bindEvents=function(t){function i(e){e&&(s="x"in e.data?e.data.x:s,a="y"in e.data?e.data.y:a);var i,n,r,o,d,c,u,h,g=[],f=s+l.width/2,p=a+l.height/2,m=l.camera.cameraPosition(s,a),y=l.camera.quadtree.point(m.x,m.y);if(y.length)for(i=0,r=y.length;i<r;i++)if(o=y[i],d=o[t+"x"],c=o[t+"y"],u=o[t+"size"],!o.hidden&&f>d-u&&f<d+u&&p>c-u&&p<c+u&&Math.sqrt(Math.pow(f-d,2)+Math.pow(p-c,2))<u){for(h=!1,n=0;n<g.length;n++)if(o.size>g[n].size){g.splice(n,0,o),h=!0;break}h||g.push(o)}return g}function n(i){function n(e,t){for(y=!1,d=0;d<e.length;d++)if(t.size>e[d].size){e.splice(d,0,t),y=!0;break}y||e.push(t)}if(!l.settings("enableEdgeHovering"))return[];var r=sigma.renderers.canvas&&l instanceof sigma.renderers.canvas;if(!r)throw new Error("The edge events feature is not compatible with the WebGL renderer");i&&(s="x"in i.data?i.data.x:s,a="y"in i.data?i.data.y:a);var o,d,c,u,h,g,f,p,m,y,v=l.settings("edgeHoverPrecision"),b={},x=[],w=s+l.width/2,E=a+l.height/2,_=l.camera.cameraPosition(s,a),A=[];if(r){var T=l.camera.quadtree.area(l.camera.getRectangle(l.width,l.height));for(u=T,o=0,c=u.length;o<c;o++)b[u[o].id]=u[o]}if(l.camera.edgequadtree!==e&&(A=l.camera.edgequadtree.point(_.x,_.y)),A.length)for(o=0,c=A.length;o<c;o++)h=A[o],f=l.graph.nodes(h.source),p=l.graph.nodes(h.target),g=h[t+"size"]||h["read_"+t+"size"],!h.hidden&&!f.hidden&&!p.hidden&&(!r||b[h.source]||b[h.target])&&sigma.utils.getDistance(f[t+"x"],f[t+"y"],w,E)>f[t+"size"]&&sigma.utils.getDistance(p[t+"x"],p[t+"y"],w,E)>p[t+"size"]&&("curve"==h.type||"curvedArrow"==h.type?f.id===p.id?(m=sigma.utils.getSelfLoopControlPoints(f[t+"x"],f[t+"y"],f[t+"size"]),sigma.utils.isPointOnBezierCurve(w,E,f[t+"x"],f[t+"y"],p[t+"x"],p[t+"y"],m.x1,m.y1,m.x2,m.y2,Math.max(g,v))&&n(x,h)):(m=sigma.utils.getQuadraticControlPoint(f[t+"x"],f[t+"y"],p[t+"x"],p[t+"y"]),sigma.utils.isPointOnQuadraticCurve(w,E,f[t+"x"],f[t+"y"],p[t+"x"],p[t+"y"],m.x,m.y,Math.max(g,v))&&n(x,h)):sigma.utils.isPointOnSegment(w,E,f[t+"x"],f[t+"y"],p[t+"x"],p[t+"y"],Math.max(g,v))&&n(x,h));return x}var r,o,s,a,l=this;for(r=0,o=this.captors.length;r<o;r++)!function(e){function t(e){l.settings("eventsEnabled")&&(l.dispatchEvent("click",e.data),d=i(e),c=n(e),d.length?(l.dispatchEvent("clickNode",{node:d[0],captor:e.data}),l.dispatchEvent("clickNodes",{node:d,captor:e.data})):c.length?(l.dispatchEvent("clickEdge",{edge:c[0],captor:e.data}),l.dispatchEvent("clickEdges",{edge:c,captor:e.data})):l.dispatchEvent("clickStage",{captor:e.data}))}function r(e){l.settings("eventsEnabled")&&(l.dispatchEvent("doubleClick",e.data),d=i(e),c=n(e),d.length?(l.dispatchEvent("doubleClickNode",{node:d[0],captor:e.data}),l.dispatchEvent("doubleClickNodes",{node:d,captor:e.data})):c.length?(l.dispatchEvent("doubleClickEdge",{edge:c[0],captor:e.data}),l.dispatchEvent("doubleClickEdges",{edge:c,captor:e.data})):l.dispatchEvent("doubleClickStage",{captor:e.data}))}function o(e){l.settings("eventsEnabled")&&(l.dispatchEvent("rightClick",e.data),d=i(e),c=n(e),d.length?(l.dispatchEvent("rightClickNode",{node:d[0],captor:e.data}),l.dispatchEvent("rightClickNodes",{node:d,captor:e.data})):c.length?(l.dispatchEvent("rightClickEdge",{edge:c[0],captor:e.data}),l.dispatchEvent("rightClickEdges",{edge:c,captor:e.data})):l.dispatchEvent("rightClickStage",{captor:e.data}))}function s(e){if(l.settings("eventsEnabled")){var t,i,n,r,o=[],s=[];for(t in u)o.push(u[t]);for(u={},i=0,n=o.length;i<n;i++)l.dispatchEvent("outNode",{node:o[i],captor:e.data});for(o.length&&l.dispatchEvent("outNodes",{nodes:o,captor:e.data}),h={},i=0,r=s.length;i<r;i++)l.dispatchEvent("outEdge",{edge:s[i],captor:e.data});s.length&&l.dispatchEvent("outEdges",{edges:s,captor:e.data})}}function a(e){if(l.settings("eventsEnabled")){d=i(e),c=n(e);var t,r,o,s,a=[],g=[],f={},p=d.length,m=[],y=[],v={},b=c.length;for(t=0;t<p;t++)o=d[t],f[o.id]=o,u[o.id]||(g.push(o),u[o.id]=o);for(r in u)f[r]||(a.push(u[r]),delete u[r]);for(t=0,p=g.length;t<p;t++)l.dispatchEvent("overNode",{node:g[t],captor:e.data});for(t=0,p=a.length;t<p;t++)l.dispatchEvent("outNode",{node:a[t],captor:e.data});for(g.length&&l.dispatchEvent("overNodes",{nodes:g,captor:e.data}),a.length&&l.dispatchEvent("outNodes",{nodes:a,captor:e.data}),t=0;t<b;t++)s=c[t],v[s.id]=s,h[s.id]||(y.push(s),h[s.id]=s);for(r in h)v[r]||(m.push(h[r]),delete h[r]);for(t=0,b=y.length;t<b;t++)l.dispatchEvent("overEdge",{edge:y[t],captor:e.data});for(t=0,b=m.length;t<b;t++)l.dispatchEvent("outEdge",{edge:m[t],captor:e.data});y.length&&l.dispatchEvent("overEdges",{edges:y,captor:e.data}),m.length&&l.dispatchEvent("outEdges",{edges:m,captor:e.data})}}var d,c,u={},h={};e.bind("click",t),e.bind("mousedown",a),e.bind("mouseup",a),e.bind("mousemove",a),e.bind("mouseout",s),e.bind("doubleclick",r),e.bind("rightclick",o),l.bind("render",a)}(this.captors[r])}}).call(this)}).call(window)},function(e,t){(function(){(function(e){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.misc"),sigma.misc.drawHovers=function(e){function t(){var t,o,s,a,l,d=i.contexts.hover.canvas,c=i.settings("defaultNodeType"),u=i.settings("defaultEdgeType"),h=sigma.canvas.hovers,g=sigma.canvas.edgehovers,f=sigma.canvas.extremities,p=i.settings.embedObjects({prefix:e});if(i.contexts.hover.clearRect(0,0,d.width,d.height),p("enableHovering")&&p("singleHover")&&Object.keys(n).length&&(a=n[Object.keys(n)[0]],(h[a.type]||h[c]||h.def)(a,i.contexts.hover,p)),p("enableHovering")&&!p("singleHover"))for(t in n)(h[n[t].type]||h[c]||h.def)(n[t],i.contexts.hover,p);if(p("enableEdgeHovering")&&p("singleHover")&&Object.keys(r).length&&(l=r[Object.keys(r)[0]],o=i.graph.nodes(l.source),s=i.graph.nodes(l.target),l.hidden||((g[l.type]||g[u]||g.def)(l,o,s,i.contexts.hover,p),p("edgeHoverExtremities")?(f[l.type]||f.def)(l,o,s,i.contexts.hover,p):((sigma.canvas.nodes[o.type]||sigma.canvas.nodes.def)(o,i.contexts.hover,p),(sigma.canvas.nodes[s.type]||sigma.canvas.