Comparing version 2.0.0-alpha6 to 2.0.0-alpha7
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Sigma=t():e.Sigma=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};return t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=15)}([function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(2),s=function(e){function t(){return n(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),t}(a.EventEmitter);t.default=s},function(e,t,r){"use strict";function n(e){if(void 0!==s[e])return s[e];var t=0,r=0,n=0;if("#"===e[0])4===e.length?(t=parseInt(e.charAt(1)+e.charAt(1),16),r=parseInt(e.charAt(2)+e.charAt(2),16),n=parseInt(e.charAt(3)+e.charAt(3),16)):(t=parseInt(e.charAt(1)+e.charAt(2),16),r=parseInt(e.charAt(3)+e.charAt(4),16),n=parseInt(e.charAt(5)+e.charAt(6),16));else if(u.test(e)){var i=e.match(h);t=+i[1],r=+i[2],n=+i[3]}var o=256*t*256+256*r+n;return s[e]=o,o}function i(e,t){var r=e.angle,n=e.ratio,i=e.x,o=e.y,s=t.width,u=t.height,h=(0,a.identity)(),l=(0,a.scale)((0,a.identity)(),1/n),c=(0,a.rotate)((0,a.identity)(),-r),d=(0,a.translate)((0,a.identity)(),-i,-o),f=(0,a.translate)((0,a.identity)(),s/2,u/2);return(0,a.multiply)(h,l),(0,a.multiply)(h,c),(0,a.multiply)(h,d),h=(0,a.multiply)(f,h)}function o(e,t,r,n){var i=n||new Uint8Array(4);return e.readPixels(t,r,1,1,e.RGBA,e.UNSIGNED_BYTE,i),i}Object.defineProperty(t,"__esModule",{value:!0}),t.floatColor=n,t.matrixFromCamera=i,t.extractPixel=o;var a=r(18),s={},u=/^\s*rgba?\s*\(/,h=/^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)\s*(,.*)?\)\s*$/},function(e,t){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(e){return"function"==typeof e}function i(e){return"number"==typeof e}function o(e){return"object"==typeof e&&null!==e}function a(e){return void 0===e}e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!i(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,r,i,s,u,h;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}if(r=this._events[e],a(r))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),r.apply(this,s)}else if(o(r))for(s=Array.prototype.slice.call(arguments,1),h=r.slice(),i=h.length,u=0;u<i;u++)h[u].apply(this,s);return!0},r.prototype.addListener=function(e,t){var i;if(!n(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,n(t.listener)?t.listener:t),this._events[e]?o(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,o(this._events[e])&&!this._events[e].warned&&(i=a(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&i>0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function r(){this.removeListener(e,r),i||(i=!0,t.apply(this,arguments))}if(!n(t))throw TypeError("listener must be a function");var i=!1;return r.listener=t,this.on(e,r),this},r.prototype.removeListener=function(e,t){var r,i,a,s;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],a=r.length,i=-1,r===t||n(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(r)){for(s=a;s-- >0;)if(r[s]===t||r[s].listener&&r[s].listener===t){i=s;break}if(i<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],n(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){return this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=r(2),u=r(14),h=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(u),l=r(9),c={easing:"quadraticInOut",duration:150},d=function(e){function t(e){n(this,t),e=e||{};var r=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return r.x=0,r.y=0,r.angle=0,r.ratio=1,r.width=e.width||0,r.height=e.height||0,r.nextFrame=null,r.enabled=!0,r}return o(t,e),a(t,[{key:"enable",value:function(){return this.enabled=!0,this}},{key:"disable",value:function(){return this.enabled=!1,this}},{key:"getState",value:function(){return{x:this.x,y:this.y,angle:this.angle,ratio:this.ratio}}},{key:"getDimensions",value:function(){return{width:this.width,height:this.height}}},{key:"isAnimated",value:function(){return!!this.nextFrame}},{key:"abstractDisplayToGraph",value:function(e,t){var r=Math.cos(this.angle),n=Math.sin(this.angle);return{x:(e*r-t*n)*this.ratio,y:(t*r+e*n)*this.ratio}}},{key:"displayToGraph",value:function(e,t){var r=Math.cos(this.angle),n=Math.sin(this.angle),i=this.width/2-(this.x*r+this.y*n)/this.ratio,o=this.height/2-(this.y*r-this.x*n)/this.ratio,a=e-i,s=t-o;return{x:(a*r-s*n)*this.ratio,y:(s*r+a*n)*this.ratio}}},{key:"graphToDisplay",value:function(e,t){var r=Math.cos(this.angle)/this.ratio,n=Math.sin(this.angle)/this.ratio;return{x:e*r+t*n+(this.width/2-this.x*r-this.y*n),y:t*r-e*n+(this.height/2-this.y*r+this.x*n)}}},{key:"viewRectangle",value:function(){var e=this.abstractDisplayToGraph(this.width,0),t=this.abstractDisplayToGraph(0,this.height),r=this.abstractDisplayToGraph(this.width/2,this.height/2),n=this.abstractDisplayToGraph(this.width/4,0).x,i=this.abstractDisplayToGraph(0,this.height/4,0).y;return{x1:this.x-r.x-n,y1:this.y-r.y-i,x2:this.x-r.x+n+e.x,y2:this.y-r.y-i+e.y,height:Math.sqrt(Math.pow(t.x,2)+Math.pow(t.y+2*i,2))}}},{key:"setState",value:function(e){return this.enabled?("x"in e&&(this.x=e.x),"y"in e&&(this.y=e.y),"angle"in e&&(this.angle=e.angle),"ratio"in e&&(this.ratio=e.ratio),this.emit("updated",this.getState()),this):this}},{key:"resize",value:function(e){return this.enabled?("width"in e&&(this.width=e.width),"height"in e&&(this.height=e.height),this.emit("resized",this.getDimensions()),this):this}},{key:"animate",value:function(e,t){var r=this;if(!this.enabled)return this;t=(0,l.assign)({},c,t);var n="function"==typeof t.easing?t.easing:h[t.easing];this.nextFrame&&cancelAnimationFrame(this.nextFrame);var i=Date.now(),o=this.getState(),a=function a(){var s=(Date.now()-i)/t.duration;if(s>=1)return r.nextFrame=null,void r.setState(e);var u=n(s),h={};"x"in e&&(h.x=o.x+(e.x-o.x)*u),"y"in e&&(h.y=o.y+(e.y-o.y)*u),"angle"in e&&(h.angle=o.angle+(e.angle-o.angle)*u),"ratio"in e&&(h.ratio=o.ratio+(e.ratio-o.ratio)*u),r.setState(h),r.nextFrame=requestAnimationFrame(a)};this.nextFrame?(cancelAnimationFrame(this.nextFrame),this.nextFrame=requestAnimationFrame(a)):a()}},{key:"animatedZoom",value:function(e){return e?"number"==typeof e?this.animate({ratio:this.ratio/e}):this.animate({ratio:this.ratio/(e.factor||1.5)},e):this.animate({ratio:this.ratio/1.5})}},{key:"animatedUnzoom",value:function(e){return e?"number"==typeof e?this.animate({ratio:this.ratio*e}):this.animate({ratio:this.ratio*(e.factor||1.5)},e):this.animate({ratio:1.5*this.ratio})}},{key:"animatedReset",value:function(e){return this.animate({x:0,y:0,ratio:1,angle:0},e)}}]),t}(s.EventEmitter);t.default=d},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=r(12),u=function(e){return e&&e.__esModule?e:{default:e}}(s),h=r(13),l=function(e){function t(e,r){n(this,t);var o=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return o.container=e,o.camera=r,o.enabled=!0,o.hasDragged=!1,o.downStartTime=null,o.startMouseX=null,o.startMouseY=null,o.isMouseDown=!1,o.isMoving=!0,o.movingTimeout=null,o.startCameraState=null,o.lastCameraState=null,o.clicks=0,o.doubleClickTimeout=null,o.wheelLock=!1,o.handleClick=o.handleClick.bind(o),o.handleDown=o.handleDown.bind(o),o.handleUp=o.handleUp.bind(o),o.handleMove=o.handleMove.bind(o),o.handleWheel=o.handleWheel.bind(o),o.handleOut=o.handleOut.bind(o),e.addEventListener("click",o.handleClick,!1),e.addEventListener("mousedown",o.handleDown,!1),e.addEventListener("mousemove",o.handleMove,!1),e.addEventListener("DOMMouseScroll",o.handleWheel,!1),e.addEventListener("mousewheel",o.handleWheel,!1),e.addEventListener("mouseout",o.handleOut,!1),document.addEventListener("mouseup",o.handleUp,!1),o}return o(t,e),a(t,[{key:"handleClick",value:function(e){var t=this;if(this.enabled){if(2===++this.clicks)return this.clicks=0,clearTimeout(this.doubleClickTimeout),this.doubleClickTimeout=null,this.handleDoubleClick(e);setTimeout(function(){t.clicks=0,t.doubleClickTimeout=null},300),this.emit("click",(0,h.getMouseCoords)(e))}}},{key:"handleDoubleClick",value:function(e){if(this.enabled){var t=(0,h.getCenter)(e),r=this.camera.getState(),n=this.camera.abstractDisplayToGraph((0,h.getX)(e)-t.x,(0,h.getY)(e)-t.y);return this.camera.animate({x:n.x*(1-1/2.2)+r.x,y:n.y*(1-1/2.2)+r.y,ratio:1/2.2*r.ratio},{easing:"quadraticInOut",duration:200}),e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation(),!1}}},{key:"handleDown",value:function(e){this.enabled&&(this.startCameraState=this.camera.getState(),this.lastCameraState=this.startCameraState,this.startMouseX=(0,h.getX)(e),this.startMouseY=(0,h.getY)(e),this.hasDragged=!1,this.downStartTime=Date.now(),e.which,this.isMouseDown=!0,this.emit("mousedown",(0,h.getMouseCoords)(e)))}},{key:"handleUp",value:function(e){if(this.enabled&&this.isMouseDown){this.isMouseDown=!1,this.movingTimeout&&(this.movingTimeout=null,clearTimeout(this.movingTimeout));var t=(0,h.getX)(e),r=(0,h.getY)(e),n=this.camera.getState();this.isMoving?this.camera.animate({x:n.x+3*(n.x-this.lastCameraState.x),y:n.y+3*(n.y-this.lastCameraState.y)},{duration:200,easing:"quadraticOut"}):this.startMouseX===t&&this.startMouseY===r||this.camera.setState({x:n.x,y:n.y}),this.emit("mouseup",(0,h.getMouseCoords)(e)),this.isMoving=!1}}},{key:"handleMove",value:function(e){var t=this;if(this.enabled){if(this.emit("mousemove",(0,h.getMouseCoords)(e)),this.isMouseDown){this.isMoving=!0,this.hasDragged=!0,this.movingTimeout&&clearTimeout(this.movingTimeout),this.movingTimeout=setTimeout(function(){t.movingTimeout=null,t.isMoving=!1},200);var r=this.camera.abstractDisplayToGraph((0,h.getX)(e)-this.startMouseX,(0,h.getY)(e)-this.startMouseY),n=this.startCameraState.x-r.x,i=this.startCameraState.y-r.y,o=this.camera.getState();o.x===n&&o.y===i||(this.lastCameraState=o,this.camera.setState({x:n,y:i}))}return e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation(),!1}}},{key:"handleWheel",value:function(e){var t=this;if(!this.enabled)return!1;var r=(0,h.getWheelDelta)(e);if(!r)return!1;if(this.wheelLock)return!1;this.wheelLock=!0,setTimeout(function(){return t.wheelLock=!1},30);var n=r>0?1/1.7:1.7,i=this.camera.getState(),o=n*i.ratio,a=(0,h.getCenter)(e),s=this.camera.abstractDisplayToGraph((0,h.getX)(e)-a.x,(0,h.getY)(e)-a.y);return this.camera.animate({x:s.x*(1-n)+i.x,y:s.y*(1-n)+i.y,ratio:o},{easing:this.camera.isAnimated()?"quadraticOut":"quadraticInOut",duration:200}),e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation(),!1}},{key:"handleOut",value:function(){}}]),t}(u.default);t.default=l},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t,r,n){return e===r||t===n}function o(e,t,r,n,i,o,a){return e<n+o&&e+r>n&&t<i+a&&t+r>i}function a(e,t,r,n,i,o,a,s){return e<i+a&&e+r>i&&t<o+s&&t+n>o}function s(e,t,r,n,i,o){var a=r+i/2,s=n+o/2,u=t<s,h=e<a;return u?h?y:b:h?_:x}function u(e,t){for(var r=[0,0];r.length;){var n=r.pop(),i=r.pop(),o=4*i+d,a=4*i+2*d,s=4*i+3*d,u=4*i+4*d,h=t[i+v],l=t[i+g],c=t[i+p],f=t[i+m],y=c/2,b=f/2;t[o+v]=h,t[o+g]=l,t[o+p]=y,t[o+m]=b,t[a+v]=h+y,t[a+g]=l,t[a+p]=y,t[a+m]=b,t[s+v]=h,t[s+g]=l+b,t[s+p]=y,t[s+m]=b,t[u+v]=h+y,t[u+g]=l+b,t[u+p]=y,t[u+m]=b,n<e-1&&(r.push(u,n+1),r.push(s,n+1),r.push(a,n+1),r.push(o,n+1))}}function h(e,t,r,n,i,a,s){for(var u=i-s,h=a-s,l=2*s,c=0,f=0;;){if(c>=e)return r[f]=r[f]||[],void r[f].push(n);var y=4*f+d,b=4*f+2*d,_=4*f+3*d,x=4*f+4*d,w=o(u,h,l,t[y+v],t[y+g],t[y+p],t[y+m]),T=o(u,h,l,t[b+v],t[b+g],t[b+p],t[b+m]),E=o(u,h,l,t[_+v],t[_+g],t[_+p],t[_+m]),A=o(u,h,l,t[x+v],t[x+g],t[x+p],t[x+m]),S=w+T+E+A;if(0===S)throw new Error("sigma/quadtree.insertNode: no collision (level: "+c+", key: "+n+", x: "+i+", y: "+a+", size: "+s+").");if(3===S)throw new Error("sigma/quadtree.insertNode: 3 impossible collisions (level: "+c+", key: "+n+", x: "+i+", y: "+a+", size: "+s+").");if(S>1)return r[f]=r[f]||[],void r[f].push(n);c++,w&&(f=y),T&&(f=b),E&&(f=_),A&&(f=x)}}function l(e,t,r,n,i,o,s){for(var u=[0,0],h=[],l=void 0;u.length;){var c=u.pop(),f=u.pop();if(l=r[f],l&&h.push.apply(h,l),!(c>=e)){var y=4*f+d,b=4*f+2*d,_=4*f+3*d,x=4*f+4*d,w=a(n,i,o,s,t[y+v],t[y+g],t[y+p],t[y+m]),T=a(n,i,o,s,t[b+v],t[b+g],t[b+p],t[b+m]),E=a(n,i,o,s,t[_+v],t[_+g],t[_+p],t[_+m]),A=a(n,i,o,s,t[x+v],t[x+g],t[x+p],t[x+m]);w&&u.push(y,c+1),T&&u.push(b,c+1),E&&u.push(_,c+1),A&&u.push(x,c+1)}}return h}Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),d=4,f=5,v=0,g=1,p=2,m=3,y=1,b=2,_=3,x=4,w=function(){function e(t){n(this,e),t=t||{};var r=Math.pow(4,f);this.data=new Float32Array(d*((4*r-1)/3)),this.containers={},this.cache=null,this.lastRectangle=null,t.boundaries&&this.resize(t.boundaries),"function"==typeof t.filter&&(this.nodeFilter=t.filter)}return c(e,[{key:"add",value:function(e,t,r,n){return h(f,this.data,this.containers,e,t,r,n),this}},{key:"resize",value:function(e){this.clear(),this.data[v]=e.x,this.data[g]=e.y,this.data[p]=e.width,this.data[m]=e.height,u(f,this.data)}},{key:"clear",value:function(){return this.containers={},this}},{key:"point",value:function(e,t){var r=[],n=0,i=0;do{this.containers[n]&&r.push.apply(r,this.containers[n]);n=4*n+s(e,t,this.data[n+v],this.data[n+g],this.data[n+p],this.data[n+m])*d,i++}while(i<=f);return r}},{key:"rectangle",value:function(e,t,r,n,o){var a=this.lastRectangle;if(a&&e===a.x1&&r===a.x2&&t===a.y1&&n===a.y2&&o===a.height)return this.cache;if(this.lastRectangle={x1:e,y1:t,x2:r,y2:n,height:o},!i(e,t,r,n))throw new Error("sigma/quadtree.rectangle: shifted view is not yet implemented.");var s=l(f,this.data,this.containers,e,t,Math.abs(e-r)||Math.abs(t-n),o);return this.cache=s,this.cache}}]),e}();t.default=w},function(e,t,r){"use strict";function n(e,t){e.fillStyle="#000",e.font="14px arial",e.fillText(t.label,t.x+t.size+3,t.y+14/3)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t,r){"use strict";function n(e,t){var r=document.createElement(e);if(!t)return r;for(var n in t)if("style"===n)for(var i in t[n])r.style[i]=t[n][i];else r.setAttribute(n,t[n]);return r}function i(){var e=window.screen;return void 0!==e.deviceXDPI&&void 0!==e.logicalXDPI&&e.deviceXDPI>e.logicalXDPI?e.systemXDPI/e.logicalXDPI:void 0!==window.devicePixelRatio?window.devicePixelRatio:1}function o(e,t){e=e||{};var r=e.mode||a.mode,n=e.height||1,i=e.width||1,o=t.maxX,s=t.maxY,u=t.minX,h=t.minY,l=(o+u)/2,c=(s+h)/2,d="outside"===r?Math.max(i/Math.max(o-u,1),n/Math.max(s-h,1)):Math.min(i/Math.max(o-u,1),n/Math.max(s-h,1)),f=function(e){return{x:(e.x-l)*d,y:(e.y-c)*d}};return f.inverse=function(e){return{x:e.x/d+l,y:e.y/d+c}},f}Object.defineProperty(t,"__esModule",{value:!0}),t.createElement=n,t.getPixelRatio=i,t.createNodeRescalingFunction=o;var a={mode:"inside",margin:0,minSize:1,maxSize:8}},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=r(21),a=function(){function e(t,r,i){n(this,e),this.vertexShaderSource=r,this.fragmentShaderSource=i,this.load(t)}return i(e,[{key:"load",value:function(e){return this.vertexShader=(0,o.loadVertexShader)(e,this.vertexShaderSource),this.fragmentShader=(0,o.loadFragmentShader)(e,this.fragmentShaderSource),this.program=(0,o.loadProgram)(e,[this.vertexShader,this.fragmentShader]),this.program}}]),e}();t.default=a},function(e,t,r){"use strict";function n(e){e=e||{};for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];for(var i=0,o=r.length;i<o;i++)if(r[i])for(var a in r[i])e[a]=r[i][a];return e}Object.defineProperty(t,"__esModule",{value:!0}),t.assign=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=r(0),h=n(u),l=r(3),c=n(l),d=r(4),f=n(d),v=r(5),g=n(v),p=r(20),m=n(p),y=r(19),b=n(y),_=r(6),x=n(_),w=r(16),T=n(w),E=r(9),A=r(7),S=r(1),P=(0,A.getPixelRatio)(),O=(0,A.getPixelRatio)(),M={hideEdgesOnMove:!1},L=function(e){function t(e,r){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));if(r=r||{},n.settings=(0,E.assign)({},M,r),!(e instanceof HTMLElement))throw new Error("sigma/renderers/webgl: container should be an html element.");n.sigma=null,n.captors={},n.container=e,n.elements={},n.contexts={},n.listeners={},n.quadtree=new g.default,n.nodeArray=null,n.nodeIndicesArray=null,n.nodeOrder={},n.nodeDataCache={},n.edgeArray=null,n.edgeIndicesArray=null,n.edgeOrder={},n.nodeRescalingFunction=null,n.width=0,n.height=0,n.highlightedNodes=new Set,n.hoveredNode=null,n.wasRenderedInThisFrame=!1,n.renderFrame=null,n.renderHighlightedNodesFrame=null,n.needToProcess=!1,n.needToSoftProcess=!1,n.pixel=new Uint8Array(4),n.createContext("edges"),n.createContext("nodes"),n.createContext("labels",!1),n.createContext("hovers",!1),n.createContext("mouse",!1);var a=n.contexts.nodes;return a.blendFunc(a.ONE,a.ONE_MINUS_SRC_ALPHA),a.enable(a.BLEND),a=n.contexts.edges,a.blendFunc(a.ONE,a.ONE_MINUS_SRC_ALPHA),a.enable(a.BLEND),n.nodePrograms={def:new m.default(n.contexts.nodes)},n.edgePrograms={def:new b.default(n.contexts.edges)},n.resize(),n.camera=new c.default({width:n.width,height:n.height}),n.bindCameraHandlers(),n.captors={mouse:new f.default(n.elements.mouse,n.camera)},n.bindEventHandlers(),n}return a(t,e),s(t,[{key:"testPixel",value:function(e,t,r){return(0,S.extractPixel)(e,t*O,(this.height-r)*O,this.pixel),0!==this.pixel[3]}},{key:"createContext",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=(0,A.createElement)("canvas",{class:"sigma-"+e,style:{position:"absolute"}});this.elements[e]=r,this.container.appendChild(r);var n={preserveDrawingBuffer:!0,antialias:!1},i=r.getContext(t?"webgl":"2d",n);return this.contexts[e]=i,this}},{key:"bindCameraHandlers",value:function(){var e=this;return this.listeners.camera=function(){e.scheduleRender()},this.camera.on("updated",this.listeners.camera),this}},{key:"bindEventHandlers",value:function(){var e=this;this.listeners.handleResize=function(){e.needToSoftProcess=!0,e.scheduleRender()},window.addEventListener("resize",this.listeners.handleResize);var t=function(e,t,r,n,i){return e>r-i&&e<r+i&&t>n-i&&t<n+i&&Math.sqrt(Math.pow(e-r,2)+Math.pow(t-n,2))<i},r=function(t,r){var n=e.camera.displayToGraph(t,r);return e.quadtree.point(n.x,n.y)};return this.listeners.handleMove=function(n){for(var i=Math.pow(e.camera.getState().ratio,.5),o=r(n.x,n.y),a=0,s=o.length;a<s;a++){var u=o[a],h=e.nodeDataCache[u],l=e.camera.graphToDisplay(h.x,h.y),c=h.size/i;if(t(n.x,n.y,l.x,l.y,c))return e.hoveredNode=u,e.emit("overNode",{node:u}),e.scheduleHighlightedNodesRender()}if(e.hoveredNode){var d=e.nodeDataCache[e.hoveredNode],f=e.camera.graphToDisplay(d.x,d.y),v=d.size/i;if(!t(n.x,n.y,f.x,f.y,v))return e.hoveredNode=null,e.emit("outNode",{node:e.hoveredNode}),e.scheduleHighlightedNodesRender()}},this.listeners.handleDown=function(n){for(var i=Math.pow(e.camera.getState().ratio,.5),o=r(n.x,n.y),a=0,s=o.length;a<s;a++){var u=o[a],h=e.nodeDataCache[u],l=e.camera.graphToDisplay(h.x,h.y),c=h.size/i;if(t(n.x,n.y,l.x,l.y,c))return e.emit("downNode",{node:u})}},this.listeners.handleClick=function(n){for(var i=Math.pow(e.camera.getState().ratio,.5),o=r(n.x,n.y),a=0,s=o.length;a<s;a++){var u=o[a],h=e.nodeDataCache[u],l=e.camera.graphToDisplay(h.x,h.y),c=h.size/i;if(t(n.x,n.y,l.x,l.y,c))return e.emit("clickNode",{node:u})}return e.emit("clickStage")},this.captors.mouse.on("mousemove",this.listeners.handleMove),this.captors.mouse.on("mousedown",this.listeners.handleDown),this.captors.mouse.on("click",this.listeners.handleClick),this}},{key:"bindGraphHandlers",value:function(){var e=this,t=this.sigma.getGraph();return this.listeners.graphUpdate=function(){e.needToProcess=!0,e.scheduleRender()},this.listeners.softGraphUpdate=function(){e.needToSoftProcess=!0,e.scheduleRender()},t.on("nodeAdded",this.listeners.graphUpdate),t.on("nodeDropped",this.listeners.graphUpdate),t.on("nodeAttributesUpdated",this.listeners.softGraphUpdate),t.on("edgeAdded",this.listeners.graphUpdate),t.on("nodeDropped",this.listeners.graphUpdate),t.on("edgeAttributesUpdated",this.listeners.softGraphUpdate),t.on("cleared",this.listeners.graphUpdate),this}},{key:"process",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.sigma.getGraph(),r=this.sigma.getGraphExtent();this.nodeRescalingFunction=(0,A.createNodeRescalingFunction)({width:this.width,height:this.height},r);var n=this.nodeRescalingFunction({x:r.minX,y:r.minY}),i=this.nodeRescalingFunction({x:r.maxX,y:r.maxY});this.quadtree.resize({x:n.x,y:n.y,width:i.x-n.x,height:i.y-n.y}),this.nodeRescaleCache={};var o=this.nodePrograms.def;e||(this.nodeArray=new Float32Array(m.default.POINTS*m.default.ATTRIBUTES*t.order),this.nodeOrder={});for(var a=t.nodes(),s=0,u=a.length;s<u;s++){var h=a[s];this.nodeOrder[h]=s;var l=this.sigma.getNodeData(h),c=this.nodeRescalingFunction(l),d=(0,E.assign)({},l,c);this.quadtree.add(h,d.x,d.y,d.size),this.nodeDataCache[h]=d,o.process(this.nodeArray,d,s*m.default.POINTS*m.default.ATTRIBUTES)}o.bufferData(this.contexts.nodes,this.nodeArray);var f=this.edgePrograms.def;e||(this.edgeArray=new Float32Array(b.default.POINTS*b.default.ATTRIBUTES*t.size),this.edgeOrder={});for(var v=t.edges(),g=0,p=v.length;g<p;g++){var y=v[g];this.edgeOrder[y]=g;var _=this.sigma.getEdgeData(y),x=t.extremities(y),w=this.nodeDataCache[x[0]],T=this.nodeDataCache[x[1]];f.process(this.edgeArray,w,T,_,g*b.default.POINTS*b.default.ATTRIBUTES)}return e||"function"!=typeof f.computeIndices||(this.edgeIndicesArray=f.computeIndices(this.edgeArray)),f.bufferData(this.contexts.edges,this.edgeArray,this.edgeIndicesArray),this}},{key:"processNode",value:function(e){var t=this.nodePrograms.def,r=this.sigma.getNodeData(e);return t.process(this.nodeArray,r,this.nodeOrder[e]*m.default.POINTS*m.default.ATTRIBUTES),this}},{key:"processEdge",value:function(e){var t=this.sigma.getGraph(),r=this.edgePrograms.def,n=this.sigma.getEdgeData(e),i=t.extremities(e),o=this.sigma.getNodeData(i[0]),a=this.sigma.getNodeData(i[1]);return r.process(this.edgeArray,o,a,n,this.edgeOrder[e]*b.default.POINTS*b.default.ATTRIBUTES),this}},{key:"bind",value:function(e){return this.sigma=e,this.bindGraphHandlers(),this.process(),this}},{key:"getCamera",value:function(){return this.camera}},{key:"getMouseCaptor",value:function(){return this.captors.mouse}},{key:"resize",value:function(e,t){var r=this.width,n=this.height;if(arguments.length>1?(this.width=e,this.height=t):(this.width=this.container.offsetWidth,this.height=this.container.offsetHeight),r===this.width&&n===this.height)return this;this.camera&&this.camera.resize({width:this.width,height:this.height});for(var i in this.elements){var o=this.elements[i];o.style.width=this.width+"px",o.style.height=this.height+"px"}for(var a in this.contexts){var s=this.contexts[a];s.scale?(this.elements[a].setAttribute("width",this.width*P+"px"),this.elements[a].setAttribute("height",this.height*P+"px"),1!==P&&s.scale(P,P)):(this.elements[a].setAttribute("width",this.width*O+"px"),this.elements[a].setAttribute("height",this.height*O+"px")),s.viewport&&s.viewport(0,0,this.width*O,this.height*O)}return this}},{key:"clear",value:function(){var e=this.contexts.nodes;return e.clear(e.COLOR_BUFFER_BIT),e=this.contexts.edges,e.clear(e.COLOR_BUFFER_BIT),e=this.contexts.labels,e.clearRect(0,0,this.width,this.height),e=this.contexts.hovers,e.clearRect(0,0,this.width,this.height),this}},{key:"render",value:function(){this.renderFrame&&(cancelAnimationFrame(this.renderFrame),this.renderFrame=null,this.needToProcess=!1,this.needToSoftProcess=!1),this.resize(),this.clear();var e=this.camera.getState(),t=(0,S.matrixFromCamera)(e,{width:this.width,height:this.height}),r=void 0,n=void 0;n=this.contexts.nodes,r=this.nodePrograms.def,r.render(n,this.nodeArray,{matrix:t,width:this.width,height:this.height,ratio:e.ratio,nodesPowRatio:.5,scalingRatio:O}),this.settings.hideEdgesOnMove&&this.camera.isAnimated()||(n=this.contexts.edges,r=this.edgePrograms.def,r.render(n,this.edgeArray,{matrix:t,width:this.width,height:this.height,ratio:e.ratio,edgesPowRatio:.5,scalingRatio:O,indices:this.edgeIndicesArray}));var i=void 0;if(e.ratio>=1)i=this.sigma.getGraph().nodes();else{var o=this.camera.viewRectangle();i=this.quadtree.rectangle(o.x1,o.y1,o.x2,o.y2,o.height)}for(var a=this.contexts.labels,s=Math.pow(e.ratio,.5),u=0,h=i.length;u<h;u++){var l=this.nodeDataCache[i[u]],c=this.camera.graphToDisplay(l.x,l.y),d=c.x,f=c.y,v=l.size/s;v<8||(0,x.default)(a,{label:l.label,size:v,x:d,y:f})}return this.renderHighlightedNodes(),this}},{key:"renderHighlightedNodes",value:function(){var e=this,t=this.camera,r=Math.pow(t.getState().ratio,.5),n=this.contexts.hovers;n.clearRect(0,0,this.width,this.height);var i=function(i){var o=e.nodeDataCache[i],a=t.graphToDisplay(o.x,o.y),s=a.x,u=a.y,h=o.size/r;(0,T.default)(n,{label:o.label,color:o.color,size:h,x:s,y:u})};this.hoveredNode&&i(this.hoveredNode),this.highlightedNodes.forEach(i)}},{key:"scheduleRender",value:function(){var e=this;if(this.renderFrame)return this;this.renderFrame=requestAnimationFrame(function(){(e.needToProcess||e.needToSoftProcess)&&e.process(e.needToSoftProcess),e.renderFrame=null,e.needToProcess=!1,e.needToSoftProcess=!1,e.render()})}},{key:"scheduleHighlightedNodesRender",value:function(){var e=this;if(this.renderHighlightedNodesFrame||this.renderFrame)return this;this.renderHighlightedNodesFrame=requestAnimationFrame(function(){e.renderHighlightedNodesFrame=null,e.renderHighlightedNodes()})}},{key:"highlightNode",value:function(e){return this.highlightedNodes.add(e),this.scheduleHighlightedNodesRender(),this}},{key:"unhighlightNode",value:function(e){return this.highlightedNodes.delete(e),this.scheduleHighlightedNodesRender(),this}}]),t}(h.default);t.default=L},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=r(22),s=n(a),u=r(0),h=n(u),l=function(){function e(t,r){if(i(this,e),!(0,s.default)(t))throw new Error("Sigma.constructor: given graph is not an instance of a graphology implementation.");if(!(r instanceof h.default))throw new Error("Sigma.constructor: given renderer is not an instance of a sigma Renderer.");this.graph=t,this.renderer=r,this.renderer.bind(this),this.state={},this.nodeStates=null,this.edgeStates=null,this.renderer.render()}return o(e,[{key:"getGraph",value:function(){return this.graph}},{key:"getNodeData",value:function(e){return this.graph.getNodeAttributes(e)}},{key:"getEdgeData",value:function(e){return this.graph.getEdgeAttributes(e)}},{key:"getGraphExtent",value:function(){for(var e=this.graph,t=e.nodes(),r=e.edges(),n=-1/0,i=-1/0,o=1/0,a=1/0,s=-1/0,u=-1/0,h=0,l=t.length;h<l;h++){var c=t[h],d=this.getNodeData(c);d.x>n&&(n=d.x),d.y>i&&(i=d.y),d.x<o&&(o=d.x),d.y<a&&(a=d.y);var f=d.size||1;f>s&&(s=f)}for(var v=0,g=r.length;v<g;v++){var p=r[v],m=this.getEdgeData(p),y=m.size||1;y>u&&(u=y)}return{maxX:n,maxY:i,minX:o,minY:a,maxNodeSize:s,maxEdgeSize:u}}}]),e}();t.default=l},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(2),s=function(e){function t(e,r){n(this,t);var o=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return o.container=e,o.camera=r,o}return o(t,e),t}(a.EventEmitter);t.default=s},function(e,t,r){"use strict";function n(e){if(void 0!==e.offsetX)return e.offsetX;if(void 0!==e.layerX)return e.layerX;if(void 0!==e.clientX)return e.clientX;throw new Error("sigma/captors/utils.getX: could not extract x from event.")}function i(e){if(void 0!==e.offsetY)return e.offsetY;if(void 0!==e.layerY)return e.layerY;if(void 0!==e.clientY)return e.clientY;throw new Error("sigma/captors/utils.getY: could not extract y from event.")}function o(e){var t=e.target.ownerSVGElement?e.target.ownerSVGElement.width:e.target.width;if("number"==typeof t)return t;if(void 0!==t&&void 0!==t.baseVal)return t.baseVal.value;throw new Error("sigma/captors/utils.getWidth: could not extract width from event.")}function a(e){var t=e.target.ownerSVGElement?e.target.ownerSVGElement.height:e.target.height;if("number"==typeof t)return t;if(void 0!==t&&void 0!==t.baseVal)return t.baseVal.value;throw new Error("sigma/captors/utils.getHeight: could not extract height from event.")}function s(e){var t=-1!==e.target.namespaceURI.indexOf("svg")?1:(0,l.getPixelRatio)();return{x:o(e)/(2*t),y:a(e)/(2*t)}}function u(e){return{x:n(e),y:i(e),clientX:e.clientX,clientY:e.clientY,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey,shiftKey:e.shiftKey}}function h(e){if(void 0!==e.wheelDelta)return e.wheelDelta;if(void 0!==e.detail)return-e.detail;throw new Error("sigma/captors/utils.getDelta: could not extract delta from event.")}Object.defineProperty(t,"__esModule",{value:!0}),t.getX=n,t.getY=i,t.getWidth=o,t.getHeight=a,t.getCenter=s,t.getMouseCoords=u,t.getWheelDelta=h;var l=r(7)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.linear=function(e){return e},t.quadraticIn=function(e){return e*e},t.quadraticOut=function(e){return e*(2-e)},t.quadraticInOut=function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)},t.cubicIn=function(e){return e*e*e},t.cubicOut=function(e){return--e*e*e+1},t.cubicInOut=function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}var i=r(11),o=n(i),a=r(0),s=n(a),u=r(3),h=n(u),l=r(5),c=n(l),d=r(4),f=n(d),v=r(10),g=n(v),p={Sigma:o.default,Renderer:s.default,Camera:h.default,QuadTree:c.default,MouseCaptor:f.default,WebGLRenderer:g.default};for(var m in p)o.default[m]=p[m];e.exports=o.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){e.font="14px arial",e.beginPath(),e.fillStyle="#fff",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=8,e.shadowColor="#000";var r=e.measureText(t.label).width,n=Math.round(t.x-7-2),i=Math.round(t.y-7-2),o=Math.round(r+7+t.size+9),s=Math.round(18),h=Math.round(9);e.moveTo(n,i+h),e.moveTo(n,i+h),e.arcTo(n,i,n+h,i,h),e.lineTo(n+o,i),e.lineTo(n+o,i+s),e.lineTo(n+h,i+s),e.arcTo(n,i+s,n,i+s-h,h),e.lineTo(n,i+h),e.closePath(),e.fill(),e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=0,(0,a.default)(e,t),(0,u.default)(e,t)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var o=r(17),a=n(o),s=r(6),u=n(s)},function(e,t,r){"use strict";function n(e,t){e.fillStyle=t.color,e.beginPath(),e.arc(t.x,t.y,t.size,0,i,!0),e.closePath(),e.fill()}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;var i=2*Math.PI},function(e,t,r){"use strict";function n(){return Float32Array.of(1,0,0,0,1,0,0,0,1)}function i(e,t){return e[0]=t,e[4]=t,e}function o(e,t){var r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=r,e[3]=-r,e[4]=n,e}function a(e,t,r){return e[6]=t,e[7]=r,e}function s(e,t){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],u=e[6],h=e[7],l=e[8],c=t[0],d=t[1],f=t[2],v=t[3],g=t[4],p=t[5],m=t[6],y=t[7],b=t[8];return e[0]=c*r+d*o+f*u,e[1]=c*n+d*a+f*h,e[2]=c*i+d*s+f*l,e[3]=v*r+g*o+p*u,e[4]=v*n+g*a+p*h,e[5]=v*i+g*s+p*l,e[6]=m*r+y*o+b*u,e[7]=m*n+y*a+b*h,e[8]=m*i+y*s+b*l,e}Object.defineProperty(t,"__esModule",{value:!0}),t.identity=n,t.scale=i,t.rotate=o,t.translate=a,t.multiply=s},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=r(8),h=n(u),l=r(1),c=r(24),d=n(c),f=r(23),v=n(f),g=function(e){function t(e){i(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,d.default,v.default));r.buffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,r.buffer),r.indicesBuffer=e.createBuffer(),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r.indicesBuffer),r.positionLocation=e.getAttribLocation(r.program,"a_position"),r.normalLocation=e.getAttribLocation(r.program,"a_normal"),r.thicknessLocation=e.getAttribLocation(r.program,"a_thickness"),r.colorLocation=e.getAttribLocation(r.program,"a_color"),r.resolutionLocation=e.getUniformLocation(r.program,"u_resolution"),r.ratioLocation=e.getUniformLocation(r.program,"u_ratio"),r.matrixLocation=e.getUniformLocation(r.program,"u_matrix"),e.enableVertexAttribArray(r.positionLocation),e.enableVertexAttribArray(r.normalLocation),e.enableVertexAttribArray(r.thicknessLocation),e.enableVertexAttribArray(r.colorLocation),e.vertexAttribPointer(r.positionLocation,2,e.FLOAT,!1,t.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,0),e.vertexAttribPointer(r.normalLocation,2,e.FLOAT,!1,t.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,8),e.vertexAttribPointer(r.thicknessLocation,1,e.FLOAT,!1,t.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,16),e.vertexAttribPointer(r.colorLocation,1,e.FLOAT,!1,t.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,20);var n=e.getExtension("OES_element_index_uint");return r.canUse32BitsIndices=!!n,r.IndicesArray=r.canUse32BitsIndices?Uint32Array:Uint16Array,r.indicesType=r.canUse32BitsIndices?e.UNSIGNED_INT:e.UNSIGNED_SHORT,r}return a(t,e),s(t,[{key:"process",value:function(e,r,n,i,o){if(r.hidden||n.hidden||i.hidden)for(var a=o+t.POINTS*t.ATTRIBUTES;o<a;o++)e[o]=0;var s=i.size||1,u=r.x,h=r.y,c=n.x,d=n.y,f=(0,l.floatColor)(i.color),v=c-u,g=d-h,p=v*v+g*g,m=0,y=0;p&&(p=1/Math.sqrt(p),m=-g*p,y=v*p),e[o++]=u,e[o++]=h,e[o++]=m,e[o++]=y,e[o++]=s,e[o++]=f,e[o++]=u,e[o++]=h,e[o++]=-m,e[o++]=-y,e[o++]=s,e[o++]=f,e[o++]=c,e[o++]=d,e[o++]=m,e[o++]=y,e[o++]=s,e[o++]=f,e[o++]=c,e[o++]=d,e[o++]=-m,e[o++]=-y,e[o++]=s,e[o++]=f}},{key:"computeIndices",value:function(e){for(var r=e.length/t.ATTRIBUTES,n=r+r/2,i=new this.IndicesArray(n),o=0,a=0;o<n;o+=4)i[a++]=o,i[a++]=o+1,i[a++]=o+2,i[a++]=o+2,i[a++]=o+1,i[a++]=o+3;return i}},{key:"bufferData",value:function(e,t,r){e.bufferData(e.ARRAY_BUFFER,t,e.DYNAMIC_DRAW),e.bufferData(e.ELEMENT_ARRAY_BUFFER,r,e.STATIC_DRAW)}},{key:"render",value:function(e,t,r){var n=this.program;e.useProgram(n),e.uniform2f(this.resolutionLocation,r.width,r.height),e.uniform1f(this.ratioLocation,r.ratio/Math.pow(r.ratio,r.edgesPowRatio)),e.uniformMatrix3fv(this.matrixLocation,!1,r.matrix),e.drawElements(e.TRIANGLES,r.indices.length,this.indicesType,0)}}]),t}(h.default);t.default=g,g.POINTS=4,g.ATTRIBUTES=6},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=r(8),h=n(u),l=r(1),c=r(26),d=n(c),f=r(25),v=n(f),g=function(e){function t(e){i(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,d.default,v.default));r.buffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,r.buffer);var n=r.program;return r.positionLocation=e.getAttribLocation(n,"a_position"),r.sizeLocation=e.getAttribLocation(n,"a_size"),r.colorLocation=e.getAttribLocation(n,"a_color"),r.resolutionLocation=e.getUniformLocation(n,"u_resolution"),r.matrixLocation=e.getUniformLocation(n,"u_matrix"),r.ratioLocation=e.getUniformLocation(n,"u_ratio"),r.scaleLocation=e.getUniformLocation(n,"u_scale"),e.enableVertexAttribArray(r.positionLocation),e.enableVertexAttribArray(r.sizeLocation),e.enableVertexAttribArray(r.colorLocation),e.vertexAttribPointer(r.positionLocation,2,e.FLOAT,!1,t.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,0),e.vertexAttribPointer(r.sizeLocation,1,e.FLOAT,!1,t.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,8),e.vertexAttribPointer(r.colorLocation,1,e.FLOAT,!1,t.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,12),r}return a(t,e),s(t,[{key:"process",value:function(e,t,r){var n=(0,l.floatColor)(t.color);e[r++]=t.x,e[r++]=t.y,e[r++]=t.size,e[r++]=n}},{key:"bufferData",value:function(e,t){e.bufferData(e.ARRAY_BUFFER,t,e.DYNAMIC_DRAW)}},{key:"render",value:function(e,r,n){var i=this.program;e.useProgram(i),e.uniform2f(this.resolutionLocation,n.width,n.height),e.uniform1f(this.ratioLocation,1/Math.pow(n.ratio,n.nodesPowRatio)),e.uniform1f(this.scaleLocation,n.scalingRatio),e.uniformMatrix3fv(this.matrixLocation,!1,n.matrix),e.drawArrays(e.POINTS,0,r.length/t.ATTRIBUTES)}}]),t}(h.default);t.default=g,g.POINTS=1,g.ATTRIBUTES=4},function(e,t,r){"use strict";function n(e,t,r){var n="VERTEX"===e?t.VERTEX_SHADER:t.FRAGMENT_SHADER,i=t.createShader(n);if(t.shaderSource(i,r),t.compileShader(i),!t.getShaderParameter(i,t.COMPILE_STATUS)){var o=t.getShaderInfoLog(i);throw t.deleteShader(i),new Error("sigma/renderers/weblg/shaders/utils.loadShader: error while compiling the shader:\n"+o+"\n"+r)}return i}function i(e,t){var r=e.createProgram(),n=void 0,i=void 0;for(n=0,i=t.length;n<i;n++)e.attachShader(r,t[n]);if(e.linkProgram(r),!e.getProgramParameter(r,e.LINK_STATUS))throw e.deleteProgram(r),new Error("sigma/renderers/weblg/shaders/utils.loadProgram: error while linking the program.");return r}Object.defineProperty(t,"__esModule",{value:!0}),t.loadProgram=i;var o=n.bind(null,"VERTEX"),a=n.bind(null,"FRAGMENT");t.loadVertexShader=o,t.loadFragmentShader=a},function(e,t){e.exports=function(e){return null!==e&&"object"==typeof e&&"function"==typeof e.addUndirectedEdgeWithKey&&"function"==typeof e.dropNodes&&"boolean"==typeof e.multi}},function(e,t){e.exports="precision mediump float;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_thickness;\n\nvoid main(void) {\n float feather = 1.3;\n vec4 color0 = vec4(0.0, 0.0, 0.0, 0.0);\n\n float radius = v_thickness;\n\n float dist = length(v_normal) * radius;\n\n float t = smoothstep(\n radius - feather,\n radius,\n dist\n );\n\n gl_FragColor = mix(v_color, color0, t);\n}\n"},function(e,t){e.exports="attribute vec2 a_position;\nattribute vec2 a_normal;\nattribute float a_thickness;\nattribute float a_color;\n\nuniform vec2 u_resolution;\nuniform float u_ratio;\nuniform mat3 u_matrix;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_thickness;\n\nvoid main() {\n\n float feather = 0.5;\n\n v_thickness = a_thickness * u_ratio / 2.0 + feather;\n\n // Scale from [[-1 1] [-1 1]] to the container:\n vec2 delta = vec2(a_normal * v_thickness);\n vec2 position = (u_matrix * vec3(a_position + delta, 1)).xy;\n position = (position / u_resolution * 2.0 - 1.0) * vec2(1, -1);\n\n // Applying\n gl_Position = vec4(position, 0, 1);\n\n v_normal = a_normal;\n v_thickness = max(1.0, length(delta) * u_matrix[0][0]);\n\n // Extract the color:\n float c = a_color;\n v_color.b = mod(c, 256.0); c = floor(c / 256.0);\n v_color.g = mod(c, 256.0); c = floor(c / 256.0);\n v_color.r = mod(c, 256.0); c = floor(c / 256.0); v_color /= 255.0;\n v_color.a = 1.0;\n}\n"},function(e,t){e.exports="precision mediump float;\n\nvarying vec4 color;\nvarying float ratio;\n\nvoid main(void) {\n float border = 0.05 * ratio;\n float radius = 0.5;\n\n vec4 color0 = vec4(0.0, 0.0, 0.0, 0.0);\n vec2 m = gl_PointCoord - vec2(0.5, 0.5);\n float dist = radius - length(m);\n\n float t = 0.0;\n if (dist > border)\n t = 1.0;\n else if (dist > 0.0)\n t = dist / border;\n\n gl_FragColor = mix(color0, color, t);\n}\n"},function(e,t){e.exports="attribute vec2 a_position;\nattribute float a_size;\nattribute float a_color;\n\nuniform vec2 u_resolution;\nuniform float u_ratio;\nuniform float u_scale;\nuniform mat3 u_matrix;\n\nvarying vec4 color;\nvarying float ratio;\n\nvoid main() {\n\n gl_Position = vec4(\n ((u_matrix * vec3(a_position, 1)).xy /\n u_resolution * 2.0 - 1.0) * vec2(1, -1),\n 0,\n 1\n );\n\n // Multiply the point size twice:\n // - x SCALING_RATIO to correct the canvas scaling\n // - x 2 to correct the formulae\n gl_PointSize = a_size * u_ratio * u_scale * 2.0;\n\n ratio = 1.0 / u_ratio;\n\n // Extract the color:\n float c = a_color;\n color.b = mod(c, 256.0); c = floor(c / 256.0);\n color.g = mod(c, 256.0); c = floor(c / 256.0);\n color.r = mod(c, 256.0); c = floor(c / 256.0); color /= 255.0;\n color.a = 1.0;\n}\n"}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Sigma=t():e.Sigma=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};return t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=15)}([function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(2),s=function(e){function t(){return n(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),t}(a.EventEmitter);t.default=s},function(e,t,r){"use strict";function n(e){if(void 0!==s[e])return s[e];var t=0,r=0,n=0;if("#"===e[0])4===e.length?(t=parseInt(e.charAt(1)+e.charAt(1),16),r=parseInt(e.charAt(2)+e.charAt(2),16),n=parseInt(e.charAt(3)+e.charAt(3),16)):(t=parseInt(e.charAt(1)+e.charAt(2),16),r=parseInt(e.charAt(3)+e.charAt(4),16),n=parseInt(e.charAt(5)+e.charAt(6),16));else if(h.test(e)){var i=e.match(u);t=+i[1],r=+i[2],n=+i[3]}var o=256*t*256+256*r+n;return s[e]=o,o}function i(e,t){var r=e.angle,n=e.ratio,i=e.x,o=e.y,s=t.width,h=t.height,u=(0,a.identity)(),l=(0,a.scale)((0,a.identity)(),1/n),c=(0,a.rotate)((0,a.identity)(),-r),d=(0,a.translate)((0,a.identity)(),-i,-o),f=(0,a.translate)((0,a.identity)(),s/2,h/2);return(0,a.multiply)(u,l),(0,a.multiply)(u,c),(0,a.multiply)(u,d),u=(0,a.multiply)(f,u)}function o(e,t,r,n){var i=n||new Uint8Array(4);return e.readPixels(t,r,1,1,e.RGBA,e.UNSIGNED_BYTE,i),i}Object.defineProperty(t,"__esModule",{value:!0}),t.floatColor=n,t.matrixFromCamera=i,t.extractPixel=o;var a=r(18),s={},h=/^\s*rgba?\s*\(/,u=/^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)\s*(,.*)?\)\s*$/},function(e,t){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(e){return"function"==typeof e}function i(e){return"number"==typeof e}function o(e){return"object"==typeof e&&null!==e}function a(e){return void 0===e}e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!i(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,r,i,s,h,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}if(r=this._events[e],a(r))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),r.apply(this,s)}else if(o(r))for(s=Array.prototype.slice.call(arguments,1),u=r.slice(),i=u.length,h=0;h<i;h++)u[h].apply(this,s);return!0},r.prototype.addListener=function(e,t){var i;if(!n(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,n(t.listener)?t.listener:t),this._events[e]?o(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,o(this._events[e])&&!this._events[e].warned&&(i=a(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&i>0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function r(){this.removeListener(e,r),i||(i=!0,t.apply(this,arguments))}if(!n(t))throw TypeError("listener must be a function");var i=!1;return r.listener=t,this.on(e,r),this},r.prototype.removeListener=function(e,t){var r,i,a,s;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],a=r.length,i=-1,r===t||n(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(r)){for(s=a;s-- >0;)if(r[s]===t||r[s].listener&&r[s].listener===t){i=s;break}if(i<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],n(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){return this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=r(2),h=r(14),u=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(h),l=r(9),c={easing:"quadraticInOut",duration:150},d=function(e){function t(e){n(this,t),e=e||{};var r=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return r.x=0,r.y=0,r.angle=0,r.ratio=1,r.width=e.width||0,r.height=e.height||0,r.nextFrame=null,r.enabled=!0,r}return o(t,e),a(t,[{key:"enable",value:function(){return this.enabled=!0,this}},{key:"disable",value:function(){return this.enabled=!1,this}},{key:"getState",value:function(){return{x:this.x,y:this.y,angle:this.angle,ratio:this.ratio}}},{key:"getDimensions",value:function(){return{width:this.width,height:this.height}}},{key:"isAnimated",value:function(){return!!this.nextFrame}},{key:"abstractDisplayToGraph",value:function(e,t){var r=Math.cos(this.angle),n=Math.sin(this.angle);return{x:(e*r-t*n)*this.ratio,y:(t*r+e*n)*this.ratio}}},{key:"displayToGraph",value:function(e,t){var r=Math.cos(this.angle),n=Math.sin(this.angle),i=this.width/2-(this.x*r+this.y*n)/this.ratio,o=this.height/2-(this.y*r-this.x*n)/this.ratio,a=e-i,s=t-o;return{x:(a*r-s*n)*this.ratio,y:(s*r+a*n)*this.ratio}}},{key:"graphToDisplay",value:function(e,t){var r=Math.cos(this.angle)/this.ratio,n=Math.sin(this.angle)/this.ratio;return{x:e*r+t*n+(this.width/2-this.x*r-this.y*n),y:t*r-e*n+(this.height/2-this.y*r+this.x*n)}}},{key:"viewRectangle",value:function(){var e=this.abstractDisplayToGraph(this.width,0),t=this.abstractDisplayToGraph(0,this.height),r=this.abstractDisplayToGraph(this.width/2,this.height/2),n=this.abstractDisplayToGraph(this.width/4,0).x,i=this.abstractDisplayToGraph(0,this.height/4,0).y;return{x1:this.x-r.x-n,y1:this.y-r.y-i,x2:this.x-r.x+n+e.x,y2:this.y-r.y-i+e.y,height:Math.sqrt(Math.pow(t.x,2)+Math.pow(t.y+2*i,2))}}},{key:"setState",value:function(e){return this.enabled?("x"in e&&(this.x=e.x),"y"in e&&(this.y=e.y),"angle"in e&&(this.angle=e.angle),"ratio"in e&&(this.ratio=e.ratio),this.emit("updated",this.getState()),this):this}},{key:"resize",value:function(e){return this.enabled?("width"in e&&(this.width=e.width),"height"in e&&(this.height=e.height),this.emit("resized",this.getDimensions()),this):this}},{key:"animate",value:function(e,t,r){var n=this;if(!this.enabled)return this;t=(0,l.assign)({},c,t);var i="function"==typeof t.easing?t.easing:u[t.easing];this.nextFrame&&cancelAnimationFrame(this.nextFrame);var o=Date.now(),a=this.getState(),s=function s(){var h=(Date.now()-o)/t.duration;if(h>=1)return n.nextFrame=null,n.setState(e),void("function"==typeof r&&r());var u=i(h),l={};"x"in e&&(l.x=a.x+(e.x-a.x)*u),"y"in e&&(l.y=a.y+(e.y-a.y)*u),"angle"in e&&(l.angle=a.angle+(e.angle-a.angle)*u),"ratio"in e&&(l.ratio=a.ratio+(e.ratio-a.ratio)*u),n.setState(l),n.nextFrame=requestAnimationFrame(s)};this.nextFrame?(cancelAnimationFrame(this.nextFrame),this.nextFrame=requestAnimationFrame(s)):s()}},{key:"animatedZoom",value:function(e){return e?"number"==typeof e?this.animate({ratio:this.ratio/e}):this.animate({ratio:this.ratio/(e.factor||1.5)},e):this.animate({ratio:this.ratio/1.5})}},{key:"animatedUnzoom",value:function(e){return e?"number"==typeof e?this.animate({ratio:this.ratio*e}):this.animate({ratio:this.ratio*(e.factor||1.5)},e):this.animate({ratio:1.5*this.ratio})}},{key:"animatedReset",value:function(e){return this.animate({x:0,y:0,ratio:1,angle:0},e)}}]),t}(s.EventEmitter);t.default=d},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=r(12),h=function(e){return e&&e.__esModule?e:{default:e}}(s),u=r(13),l=function(e){function t(e,r){n(this,t);var o=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return o.container=e,o.camera=r,o.enabled=!0,o.hasDragged=!1,o.downStartTime=null,o.startMouseX=null,o.startMouseY=null,o.isMouseDown=!1,o.isMoving=!0,o.movingTimeout=null,o.startCameraState=null,o.lastCameraState=null,o.clicks=0,o.doubleClickTimeout=null,o.wheelLock=!1,o.handleClick=o.handleClick.bind(o),o.handleDown=o.handleDown.bind(o),o.handleUp=o.handleUp.bind(o),o.handleMove=o.handleMove.bind(o),o.handleWheel=o.handleWheel.bind(o),o.handleOut=o.handleOut.bind(o),e.addEventListener("click",o.handleClick,!1),e.addEventListener("mousedown",o.handleDown,!1),e.addEventListener("mousemove",o.handleMove,!1),e.addEventListener("DOMMouseScroll",o.handleWheel,!1),e.addEventListener("mousewheel",o.handleWheel,!1),e.addEventListener("mouseout",o.handleOut,!1),document.addEventListener("mouseup",o.handleUp,!1),o}return o(t,e),a(t,[{key:"handleClick",value:function(e){var t=this;if(this.enabled){if(2===++this.clicks)return this.clicks=0,clearTimeout(this.doubleClickTimeout),this.doubleClickTimeout=null,this.handleDoubleClick(e);setTimeout(function(){t.clicks=0,t.doubleClickTimeout=null},300),this.emit("click",(0,u.getMouseCoords)(e))}}},{key:"handleDoubleClick",value:function(e){if(this.enabled){var t=(0,u.getCenter)(e),r=this.camera.getState(),n=this.camera.abstractDisplayToGraph((0,u.getX)(e)-t.x,(0,u.getY)(e)-t.y);return this.camera.animate({x:n.x*(1-1/2.2)+r.x,y:n.y*(1-1/2.2)+r.y,ratio:1/2.2*r.ratio},{easing:"quadraticInOut",duration:200}),e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation(),!1}}},{key:"handleDown",value:function(e){this.enabled&&(this.startCameraState=this.camera.getState(),this.lastCameraState=this.startCameraState,this.startMouseX=(0,u.getX)(e),this.startMouseY=(0,u.getY)(e),this.hasDragged=!1,this.downStartTime=Date.now(),e.which,this.isMouseDown=!0,this.emit("mousedown",(0,u.getMouseCoords)(e)))}},{key:"handleUp",value:function(e){if(this.enabled&&this.isMouseDown){this.isMouseDown=!1,this.movingTimeout&&(this.movingTimeout=null,clearTimeout(this.movingTimeout));var t=(0,u.getX)(e),r=(0,u.getY)(e),n=this.camera.getState();this.isMoving?this.camera.animate({x:n.x+3*(n.x-this.lastCameraState.x),y:n.y+3*(n.y-this.lastCameraState.y)},{duration:200,easing:"quadraticOut"}):this.startMouseX===t&&this.startMouseY===r||this.camera.setState({x:n.x,y:n.y}),this.emit("mouseup",(0,u.getMouseCoords)(e)),this.isMoving=!1}}},{key:"handleMove",value:function(e){var t=this;if(this.enabled){if(this.emit("mousemove",(0,u.getMouseCoords)(e)),this.isMouseDown){this.isMoving=!0,this.hasDragged=!0,this.movingTimeout&&clearTimeout(this.movingTimeout),this.movingTimeout=setTimeout(function(){t.movingTimeout=null,t.isMoving=!1},200);var r=this.camera.abstractDisplayToGraph((0,u.getX)(e)-this.startMouseX,(0,u.getY)(e)-this.startMouseY),n=this.startCameraState.x-r.x,i=this.startCameraState.y-r.y,o=this.camera.getState();o.x===n&&o.y===i||(this.lastCameraState=o,this.camera.setState({x:n,y:i}))}return e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation(),!1}}},{key:"handleWheel",value:function(e){var t=this;if(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation(),!this.enabled)return!1;var r=(0,u.getWheelDelta)(e);if(!r)return!1;if(this.wheelLock)return!1;this.wheelLock=!0;var n=r>0?1/1.7:1.7,i=this.camera.getState(),o=n*i.ratio,a=(0,u.getCenter)(e),s=this.camera.abstractDisplayToGraph((0,u.getX)(e)-a.x,(0,u.getY)(e)-a.y);return this.camera.animate({x:s.x*(1-n)+i.x,y:s.y*(1-n)+i.y,ratio:o},{easing:"linear",duration:200},function(){return t.wheelLock=!1}),!1}},{key:"handleOut",value:function(){}}]),t}(h.default);t.default=l},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t,r,n){return e===r||t===n}function o(e,t,r,n,i,o,a){return e<n+o&&e+r>n&&t<i+a&&t+r>i}function a(e,t,r,n,i,o,a,s){return e<i+a&&e+r>i&&t<o+s&&t+n>o}function s(e,t,r,n,i,o){var a=r+i/2,s=n+o/2,h=t<s,u=e<a;return h?u?y:b:u?_:x}function h(e,t){for(var r=[0,0];r.length;){var n=r.pop(),i=r.pop(),o=4*i+d,a=4*i+2*d,s=4*i+3*d,h=4*i+4*d,u=t[i+v],l=t[i+g],c=t[i+p],f=t[i+m],y=c/2,b=f/2;t[o+v]=u,t[o+g]=l,t[o+p]=y,t[o+m]=b,t[a+v]=u+y,t[a+g]=l,t[a+p]=y,t[a+m]=b,t[s+v]=u,t[s+g]=l+b,t[s+p]=y,t[s+m]=b,t[h+v]=u+y,t[h+g]=l+b,t[h+p]=y,t[h+m]=b,n<e-1&&(r.push(h,n+1),r.push(s,n+1),r.push(a,n+1),r.push(o,n+1))}}function u(e,t,r,n,i,a,s){for(var h=i-s,u=a-s,l=2*s,c=0,f=0;;){if(c>=e)return r[f]=r[f]||[],void r[f].push(n);var y=4*f+d,b=4*f+2*d,_=4*f+3*d,x=4*f+4*d,w=o(h,u,l,t[y+v],t[y+g],t[y+p],t[y+m]),T=o(h,u,l,t[b+v],t[b+g],t[b+p],t[b+m]),E=o(h,u,l,t[_+v],t[_+g],t[_+p],t[_+m]),A=o(h,u,l,t[x+v],t[x+g],t[x+p],t[x+m]),S=w+T+E+A;if(0===S)throw new Error("sigma/quadtree.insertNode: no collision (level: "+c+", key: "+n+", x: "+i+", y: "+a+", size: "+s+").");if(3===S)throw new Error("sigma/quadtree.insertNode: 3 impossible collisions (level: "+c+", key: "+n+", x: "+i+", y: "+a+", size: "+s+").");if(S>1)return r[f]=r[f]||[],void r[f].push(n);c++,w&&(f=y),T&&(f=b),E&&(f=_),A&&(f=x)}}function l(e,t,r,n,i,o,s){for(var h=[0,0],u=[],l=void 0;h.length;){var c=h.pop(),f=h.pop();if(l=r[f],l&&u.push.apply(u,l),!(c>=e)){var y=4*f+d,b=4*f+2*d,_=4*f+3*d,x=4*f+4*d,w=a(n,i,o,s,t[y+v],t[y+g],t[y+p],t[y+m]),T=a(n,i,o,s,t[b+v],t[b+g],t[b+p],t[b+m]),E=a(n,i,o,s,t[_+v],t[_+g],t[_+p],t[_+m]),A=a(n,i,o,s,t[x+v],t[x+g],t[x+p],t[x+m]);w&&h.push(y,c+1),T&&h.push(b,c+1),E&&h.push(_,c+1),A&&h.push(x,c+1)}}return u}Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),d=4,f=5,v=0,g=1,p=2,m=3,y=1,b=2,_=3,x=4,w=function(){function e(t){n(this,e),t=t||{};var r=Math.pow(4,f);this.data=new Float32Array(d*((4*r-1)/3)),this.containers={},this.cache=null,this.lastRectangle=null,t.boundaries&&this.resize(t.boundaries),"function"==typeof t.filter&&(this.nodeFilter=t.filter)}return c(e,[{key:"add",value:function(e,t,r,n){return u(f,this.data,this.containers,e,t,r,n),this}},{key:"resize",value:function(e){this.clear(),this.data[v]=e.x,this.data[g]=e.y,this.data[p]=e.width,this.data[m]=e.height,h(f,this.data)}},{key:"clear",value:function(){return this.containers={},this}},{key:"point",value:function(e,t){var r=[],n=0,i=0;do{this.containers[n]&&r.push.apply(r,this.containers[n]);n=4*n+s(e,t,this.data[n+v],this.data[n+g],this.data[n+p],this.data[n+m])*d,i++}while(i<=f);return r}},{key:"rectangle",value:function(e,t,r,n,o){var a=this.lastRectangle;if(a&&e===a.x1&&r===a.x2&&t===a.y1&&n===a.y2&&o===a.height)return this.cache;if(this.lastRectangle={x1:e,y1:t,x2:r,y2:n,height:o},!i(e,t,r,n))throw new Error("sigma/quadtree.rectangle: shifted view is not yet implemented.");var s=l(f,this.data,this.containers,e,t,Math.abs(e-r)||Math.abs(t-n),o);return this.cache=s,this.cache}}]),e}();t.default=w},function(e,t,r){"use strict";function n(e,t){e.fillStyle="#000",e.font="14px arial",e.fillText(t.label,t.x+t.size+3,t.y+14/3)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t,r){"use strict";function n(e,t){var r=document.createElement(e);if(!t)return r;for(var n in t)if("style"===n)for(var i in t[n])r.style[i]=t[n][i];else r.setAttribute(n,t[n]);return r}function i(){var e=window.screen;return void 0!==e.deviceXDPI&&void 0!==e.logicalXDPI&&e.deviceXDPI>e.logicalXDPI?e.systemXDPI/e.logicalXDPI:void 0!==window.devicePixelRatio?window.devicePixelRatio:1}function o(e,t){e=e||{};var r=e.mode||a.mode,n=e.height||1,i=e.width||1,o=t.maxX,s=t.maxY,h=t.minX,u=t.minY,l=(o+h)/2,c=(s+u)/2,d="outside"===r?Math.max(i/Math.max(o-h,1),n/Math.max(s-u,1)):Math.min(i/Math.max(o-h,1),n/Math.max(s-u,1)),f=function(e){return{x:(e.x-l)*d,y:(e.y-c)*d}};return f.inverse=function(e){return{x:e.x/d+l,y:e.y/d+c}},f}Object.defineProperty(t,"__esModule",{value:!0}),t.createElement=n,t.getPixelRatio=i,t.createNodeRescalingFunction=o;var a={mode:"inside",margin:0,minSize:1,maxSize:8}},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=r(21),a=function(){function e(t,r,i){n(this,e),this.vertexShaderSource=r,this.fragmentShaderSource=i,this.load(t)}return i(e,[{key:"load",value:function(e){return this.vertexShader=(0,o.loadVertexShader)(e,this.vertexShaderSource),this.fragmentShader=(0,o.loadFragmentShader)(e,this.fragmentShaderSource),this.program=(0,o.loadProgram)(e,[this.vertexShader,this.fragmentShader]),this.program}}]),e}();t.default=a},function(e,t,r){"use strict";function n(e){e=e||{};for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];for(var i=0,o=r.length;i<o;i++)if(r[i])for(var a in r[i])e[a]=r[i][a];return e}Object.defineProperty(t,"__esModule",{value:!0}),t.assign=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),h=r(0),u=n(h),l=r(3),c=n(l),d=r(4),f=n(d),v=r(5),g=n(v),p=r(20),m=n(p),y=r(19),b=n(y),_=r(6),x=n(_),w=r(16),T=n(w),E=r(9),A=r(7),S=r(1),P=(0,A.getPixelRatio)(),O=(0,A.getPixelRatio)(),M={hideEdgesOnMove:!1},L=function(e){function t(e,r){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));if(r=r||{},n.settings=(0,E.assign)({},M,r),!(e instanceof HTMLElement))throw new Error("sigma/renderers/webgl: container should be an html element.");n.sigma=null,n.captors={},n.container=e,n.elements={},n.contexts={},n.listeners={},n.quadtree=new g.default,n.nodeArray=null,n.nodeIndicesArray=null,n.nodeOrder={},n.nodeDataCache={},n.edgeArray=null,n.edgeIndicesArray=null,n.edgeOrder={},n.nodeRescalingFunction=null,n.width=0,n.height=0,n.highlightedNodes=new Set,n.hoveredNode=null,n.wasRenderedInThisFrame=!1,n.renderFrame=null,n.renderHighlightedNodesFrame=null,n.needToProcess=!1,n.needToSoftProcess=!1,n.pixel=new Uint8Array(4),n.createContext("edges"),n.createContext("nodes"),n.createContext("labels",!1),n.createContext("hovers",!1),n.createContext("mouse",!1);var a=n.contexts.nodes;return a.blendFunc(a.ONE,a.ONE_MINUS_SRC_ALPHA),a.enable(a.BLEND),a=n.contexts.edges,a.blendFunc(a.ONE,a.ONE_MINUS_SRC_ALPHA),a.enable(a.BLEND),n.nodePrograms={def:new m.default(n.contexts.nodes)},n.edgePrograms={def:new b.default(n.contexts.edges)},n.resize(),n.camera=new c.default({width:n.width,height:n.height}),n.bindCameraHandlers(),n.captors={mouse:new f.default(n.elements.mouse,n.camera)},n.bindEventHandlers(),n}return a(t,e),s(t,[{key:"testPixel",value:function(e,t,r){return(0,S.extractPixel)(e,t*O,(this.height-r)*O,this.pixel),0!==this.pixel[3]}},{key:"createContext",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=(0,A.createElement)("canvas",{class:"sigma-"+e,style:{position:"absolute"}});this.elements[e]=r,this.container.appendChild(r);var n={preserveDrawingBuffer:!0,antialias:!1},i=r.getContext(t?"webgl":"2d",n);return this.contexts[e]=i,this}},{key:"bindCameraHandlers",value:function(){var e=this;return this.listeners.camera=function(){e.scheduleRender()},this.camera.on("updated",this.listeners.camera),this}},{key:"bindEventHandlers",value:function(){var e=this;this.listeners.handleResize=function(){e.needToSoftProcess=!0,e.scheduleRender()},window.addEventListener("resize",this.listeners.handleResize);var t=function(e,t,r,n,i){return e>r-i&&e<r+i&&t>n-i&&t<n+i&&Math.sqrt(Math.pow(e-r,2)+Math.pow(t-n,2))<i},r=function(t,r){var n=e.camera.displayToGraph(t,r);return e.quadtree.point(n.x,n.y)};return this.listeners.handleMove=function(n){for(var i=Math.pow(e.camera.getState().ratio,.5),o=r(n.x,n.y),a=0,s=o.length;a<s;a++){var h=o[a],u=e.nodeDataCache[h],l=e.camera.graphToDisplay(u.x,u.y),c=u.size/i;if(t(n.x,n.y,l.x,l.y,c))return e.hoveredNode=h,e.emit("overNode",{node:h}),e.scheduleHighlightedNodesRender()}if(e.hoveredNode){var d=e.nodeDataCache[e.hoveredNode],f=e.camera.graphToDisplay(d.x,d.y),v=d.size/i;if(!t(n.x,n.y,f.x,f.y,v))return e.hoveredNode=null,e.emit("outNode",{node:e.hoveredNode}),e.scheduleHighlightedNodesRender()}},this.listeners.handleDown=function(n){for(var i=Math.pow(e.camera.getState().ratio,.5),o=r(n.x,n.y),a=0,s=o.length;a<s;a++){var h=o[a],u=e.nodeDataCache[h],l=e.camera.graphToDisplay(u.x,u.y),c=u.size/i;if(t(n.x,n.y,l.x,l.y,c))return e.emit("downNode",{node:h})}},this.listeners.handleClick=function(n){for(var i=Math.pow(e.camera.getState().ratio,.5),o=r(n.x,n.y),a=0,s=o.length;a<s;a++){var h=o[a],u=e.nodeDataCache[h],l=e.camera.graphToDisplay(u.x,u.y),c=u.size/i;if(t(n.x,n.y,l.x,l.y,c))return e.emit("clickNode",{node:h})}return e.emit("clickStage")},this.captors.mouse.on("mousemove",this.listeners.handleMove),this.captors.mouse.on("mousedown",this.listeners.handleDown),this.captors.mouse.on("click",this.listeners.handleClick),this}},{key:"bindGraphHandlers",value:function(){var e=this,t=this.sigma.getGraph();return this.listeners.graphUpdate=function(){e.needToProcess=!0,e.scheduleRender()},this.listeners.softGraphUpdate=function(){e.needToSoftProcess=!0,e.scheduleRender()},t.on("nodeAdded",this.listeners.graphUpdate),t.on("nodeDropped",this.listeners.graphUpdate),t.on("nodeAttributesUpdated",this.listeners.softGraphUpdate),t.on("edgeAdded",this.listeners.graphUpdate),t.on("nodeDropped",this.listeners.graphUpdate),t.on("edgeAttributesUpdated",this.listeners.softGraphUpdate),t.on("cleared",this.listeners.graphUpdate),this}},{key:"process",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.sigma.getGraph(),r=this.sigma.getGraphExtent();this.nodeRescalingFunction=(0,A.createNodeRescalingFunction)({width:this.width,height:this.height},r);var n=this.nodeRescalingFunction({x:r.minX,y:r.minY}),i=this.nodeRescalingFunction({x:r.maxX,y:r.maxY});this.quadtree.resize({x:n.x,y:n.y,width:i.x-n.x,height:i.y-n.y}),this.nodeRescaleCache={};var o=this.nodePrograms.def;e||(this.nodeArray=new Float32Array(m.default.POINTS*m.default.ATTRIBUTES*t.order),this.nodeOrder={});for(var a=t.nodes(),s=0,h=a.length;s<h;s++){var u=a[s];this.nodeOrder[u]=s;var l=this.sigma.getNodeData(u),c=this.nodeRescalingFunction(l),d=(0,E.assign)({},l,c);this.quadtree.add(u,d.x,d.y,d.size),this.nodeDataCache[u]=d,o.process(this.nodeArray,d,s*m.default.POINTS*m.default.ATTRIBUTES)}o.bufferData(this.contexts.nodes,this.nodeArray);var f=this.edgePrograms.def;e||(this.edgeArray=new Float32Array(b.default.POINTS*b.default.ATTRIBUTES*t.size),this.edgeOrder={});for(var v=t.edges(),g=0,p=v.length;g<p;g++){var y=v[g];this.edgeOrder[y]=g;var _=this.sigma.getEdgeData(y),x=t.extremities(y),w=this.nodeDataCache[x[0]],T=this.nodeDataCache[x[1]];f.process(this.edgeArray,w,T,_,g*b.default.POINTS*b.default.ATTRIBUTES)}return e||"function"!=typeof f.computeIndices||(this.edgeIndicesArray=f.computeIndices(this.edgeArray)),f.bufferData(this.contexts.edges,this.edgeArray,this.edgeIndicesArray),this}},{key:"processNode",value:function(e){var t=this.nodePrograms.def,r=this.sigma.getNodeData(e);return t.process(this.nodeArray,r,this.nodeOrder[e]*m.default.POINTS*m.default.ATTRIBUTES),this}},{key:"processEdge",value:function(e){var t=this.sigma.getGraph(),r=this.edgePrograms.def,n=this.sigma.getEdgeData(e),i=t.extremities(e),o=this.sigma.getNodeData(i[0]),a=this.sigma.getNodeData(i[1]);return r.process(this.edgeArray,o,a,n,this.edgeOrder[e]*b.default.POINTS*b.default.ATTRIBUTES),this}},{key:"bind",value:function(e){return this.sigma=e,this.bindGraphHandlers(),this.process(),this}},{key:"getCamera",value:function(){return this.camera}},{key:"getMouseCaptor",value:function(){return this.captors.mouse}},{key:"resize",value:function(e,t){var r=this.width,n=this.height;if(arguments.length>1?(this.width=e,this.height=t):(this.width=this.container.offsetWidth,this.height=this.container.offsetHeight),r===this.width&&n===this.height)return this;this.camera&&this.camera.resize({width:this.width,height:this.height});for(var i in this.elements){var o=this.elements[i];o.style.width=this.width+"px",o.style.height=this.height+"px"}for(var a in this.contexts){var s=this.contexts[a];s.scale?(this.elements[a].setAttribute("width",this.width*P+"px"),this.elements[a].setAttribute("height",this.height*P+"px"),1!==P&&s.scale(P,P)):(this.elements[a].setAttribute("width",this.width*O+"px"),this.elements[a].setAttribute("height",this.height*O+"px")),s.viewport&&s.viewport(0,0,this.width*O,this.height*O)}return this}},{key:"clear",value:function(){var e=this.contexts.nodes;return e.clear(e.COLOR_BUFFER_BIT),e=this.contexts.edges,e.clear(e.COLOR_BUFFER_BIT),e=this.contexts.labels,e.clearRect(0,0,this.width,this.height),e=this.contexts.hovers,e.clearRect(0,0,this.width,this.height),this}},{key:"render",value:function(){this.renderFrame&&(cancelAnimationFrame(this.renderFrame),this.renderFrame=null,this.needToProcess=!1,this.needToSoftProcess=!1),this.resize(),this.clear();var e=this.camera.getState(),t=(0,S.matrixFromCamera)(e,{width:this.width,height:this.height}),r=void 0,n=void 0;n=this.contexts.nodes,r=this.nodePrograms.def,r.render(n,this.nodeArray,{matrix:t,width:this.width,height:this.height,ratio:e.ratio,nodesPowRatio:.5,scalingRatio:O}),this.settings.hideEdgesOnMove&&this.camera.isAnimated()||(n=this.contexts.edges,r=this.edgePrograms.def,r.render(n,this.edgeArray,{matrix:t,width:this.width,height:this.height,ratio:e.ratio,edgesPowRatio:.5,scalingRatio:O,indices:this.edgeIndicesArray}));var i=void 0;if(e.ratio>=1)i=this.sigma.getGraph().nodes();else{var o=this.camera.viewRectangle();i=this.quadtree.rectangle(o.x1,o.y1,o.x2,o.y2,o.height)}for(var a=this.contexts.labels,s=Math.pow(e.ratio,.5),h=0,u=i.length;h<u;h++){var l=this.nodeDataCache[i[h]],c=this.camera.graphToDisplay(l.x,l.y),d=c.x,f=c.y,v=l.size/s;v<8||(0,x.default)(a,{label:l.label,size:v,x:d,y:f})}return this.renderHighlightedNodes(),this}},{key:"renderHighlightedNodes",value:function(){var e=this,t=this.camera,r=Math.pow(t.getState().ratio,.5),n=this.contexts.hovers;n.clearRect(0,0,this.width,this.height);var i=function(i){var o=e.nodeDataCache[i],a=t.graphToDisplay(o.x,o.y),s=a.x,h=a.y,u=o.size/r;(0,T.default)(n,{label:o.label,color:o.color,size:u,x:s,y:h})};this.hoveredNode&&i(this.hoveredNode),this.highlightedNodes.forEach(i)}},{key:"scheduleRender",value:function(){var e=this;if(this.renderFrame)return this;this.renderFrame=requestAnimationFrame(function(){(e.needToProcess||e.needToSoftProcess)&&e.process(e.needToSoftProcess),e.renderFrame=null,e.needToProcess=!1,e.needToSoftProcess=!1,e.render()})}},{key:"scheduleHighlightedNodesRender",value:function(){var e=this;if(this.renderHighlightedNodesFrame||this.renderFrame)return this;this.renderHighlightedNodesFrame=requestAnimationFrame(function(){e.renderHighlightedNodesFrame=null,e.renderHighlightedNodes()})}},{key:"highlightNode",value:function(e){return this.highlightedNodes.add(e),this.scheduleHighlightedNodesRender(),this}},{key:"unhighlightNode",value:function(e){return this.highlightedNodes.delete(e),this.scheduleHighlightedNodesRender(),this}}]),t}(u.default);t.default=L},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=r(22),s=n(a),h=r(0),u=n(h),l=function(){function e(t,r){if(i(this,e),!(0,s.default)(t))throw new Error("Sigma.constructor: given graph is not an instance of a graphology implementation.");if(!(r instanceof u.default))throw new Error("Sigma.constructor: given renderer is not an instance of a sigma Renderer.");this.graph=t,this.renderer=r,this.renderer.bind(this),this.state={},this.nodeStates=null,this.edgeStates=null,this.renderer.render()}return o(e,[{key:"getGraph",value:function(){return this.graph}},{key:"getNodeData",value:function(e){return this.graph.getNodeAttributes(e)}},{key:"getEdgeData",value:function(e){return this.graph.getEdgeAttributes(e)}},{key:"getGraphExtent",value:function(){for(var e=this.graph,t=e.nodes(),r=e.edges(),n=-1/0,i=-1/0,o=1/0,a=1/0,s=-1/0,h=-1/0,u=0,l=t.length;u<l;u++){var c=t[u],d=this.getNodeData(c);d.x>n&&(n=d.x),d.y>i&&(i=d.y),d.x<o&&(o=d.x),d.y<a&&(a=d.y);var f=d.size||1;f>s&&(s=f)}for(var v=0,g=r.length;v<g;v++){var p=r[v],m=this.getEdgeData(p),y=m.size||1;y>h&&(h=y)}return{maxX:n,maxY:i,minX:o,minY:a,maxNodeSize:s,maxEdgeSize:h}}}]),e}();t.default=l},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(2),s=function(e){function t(e,r){n(this,t);var o=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return o.container=e,o.camera=r,o}return o(t,e),t}(a.EventEmitter);t.default=s},function(e,t,r){"use strict";function n(e){if(void 0!==e.offsetX)return e.offsetX;if(void 0!==e.layerX)return e.layerX;if(void 0!==e.clientX)return e.clientX;throw new Error("sigma/captors/utils.getX: could not extract x from event.")}function i(e){if(void 0!==e.offsetY)return e.offsetY;if(void 0!==e.layerY)return e.layerY;if(void 0!==e.clientY)return e.clientY;throw new Error("sigma/captors/utils.getY: could not extract y from event.")}function o(e){var t=e.target.ownerSVGElement?e.target.ownerSVGElement.width:e.target.width;if("number"==typeof t)return t;if(void 0!==t&&void 0!==t.baseVal)return t.baseVal.value;throw new Error("sigma/captors/utils.getWidth: could not extract width from event.")}function a(e){var t=e.target.ownerSVGElement?e.target.ownerSVGElement.height:e.target.height;if("number"==typeof t)return t;if(void 0!==t&&void 0!==t.baseVal)return t.baseVal.value;throw new Error("sigma/captors/utils.getHeight: could not extract height from event.")}function s(e){var t=-1!==e.target.namespaceURI.indexOf("svg")?1:(0,l.getPixelRatio)();return{x:o(e)/(2*t),y:a(e)/(2*t)}}function h(e){return{x:n(e),y:i(e),clientX:e.clientX,clientY:e.clientY,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey,shiftKey:e.shiftKey}}function u(e){if(void 0!==e.wheelDelta)return e.wheelDelta/360;if(void 0!==e.detail)return e.detail/-9;throw new Error("sigma/captors/utils.getDelta: could not extract delta from event.")}Object.defineProperty(t,"__esModule",{value:!0}),t.getX=n,t.getY=i,t.getWidth=o,t.getHeight=a,t.getCenter=s,t.getMouseCoords=h,t.getWheelDelta=u;var l=r(7)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.linear=function(e){return e},t.quadraticIn=function(e){return e*e},t.quadraticOut=function(e){return e*(2-e)},t.quadraticInOut=function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)},t.cubicIn=function(e){return e*e*e},t.cubicOut=function(e){return--e*e*e+1},t.cubicInOut=function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}var i=r(11),o=n(i),a=r(0),s=n(a),h=r(3),u=n(h),l=r(5),c=n(l),d=r(4),f=n(d),v=r(10),g=n(v),p={Sigma:o.default,Renderer:s.default,Camera:u.default,QuadTree:c.default,MouseCaptor:f.default,WebGLRenderer:g.default};for(var m in p)o.default[m]=p[m];e.exports=o.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){e.font="14px arial",e.beginPath(),e.fillStyle="#fff",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=8,e.shadowColor="#000";var r=e.measureText(t.label).width,n=Math.round(t.x-7-2),i=Math.round(t.y-7-2),o=Math.round(r+7+t.size+9),s=Math.round(18),u=Math.round(9);e.moveTo(n,i+u),e.moveTo(n,i+u),e.arcTo(n,i,n+u,i,u),e.lineTo(n+o,i),e.lineTo(n+o,i+s),e.lineTo(n+u,i+s),e.arcTo(n,i+s,n,i+s-u,u),e.lineTo(n,i+u),e.closePath(),e.fill(),e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=0,(0,a.default)(e,t),(0,h.default)(e,t)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var o=r(17),a=n(o),s=r(6),h=n(s)},function(e,t,r){"use strict";function n(e,t){e.fillStyle=t.color,e.beginPath(),e.arc(t.x,t.y,t.size,0,i,!0),e.closePath(),e.fill()}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;var i=2*Math.PI},function(e,t,r){"use strict";function n(){return Float32Array.of(1,0,0,0,1,0,0,0,1)}function i(e,t){return e[0]=t,e[4]=t,e}function o(e,t){var r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=r,e[3]=-r,e[4]=n,e}function a(e,t,r){return e[6]=t,e[7]=r,e}function s(e,t){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],h=e[6],u=e[7],l=e[8],c=t[0],d=t[1],f=t[2],v=t[3],g=t[4],p=t[5],m=t[6],y=t[7],b=t[8];return e[0]=c*r+d*o+f*h,e[1]=c*n+d*a+f*u,e[2]=c*i+d*s+f*l,e[3]=v*r+g*o+p*h,e[4]=v*n+g*a+p*u,e[5]=v*i+g*s+p*l,e[6]=m*r+y*o+b*h,e[7]=m*n+y*a+b*u,e[8]=m*i+y*s+b*l,e}Object.defineProperty(t,"__esModule",{value:!0}),t.identity=n,t.scale=i,t.rotate=o,t.translate=a,t.multiply=s},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),h=r(8),u=n(h),l=r(1),c=r(24),d=n(c),f=r(23),v=n(f),g=function(e){function t(e){i(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,d.default,v.default));r.buffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,r.buffer),r.indicesBuffer=e.createBuffer(),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r.indicesBuffer),r.positionLocation=e.getAttribLocation(r.program,"a_position"),r.normalLocation=e.getAttribLocation(r.program,"a_normal"),r.thicknessLocation=e.getAttribLocation(r.program,"a_thickness"),r.colorLocation=e.getAttribLocation(r.program,"a_color"),r.resolutionLocation=e.getUniformLocation(r.program,"u_resolution"),r.ratioLocation=e.getUniformLocation(r.program,"u_ratio"),r.matrixLocation=e.getUniformLocation(r.program,"u_matrix"),r.scaleLocation=e.getUniformLocation(r.program,"u_scale"),e.enableVertexAttribArray(r.positionLocation),e.enableVertexAttribArray(r.normalLocation),e.enableVertexAttribArray(r.thicknessLocation),e.enableVertexAttribArray(r.colorLocation),e.vertexAttribPointer(r.positionLocation,2,e.FLOAT,!1,t.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,0),e.vertexAttribPointer(r.normalLocation,2,e.FLOAT,!1,t.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,8),e.vertexAttribPointer(r.thicknessLocation,1,e.FLOAT,!1,t.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,16),e.vertexAttribPointer(r.colorLocation,1,e.FLOAT,!1,t.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,20);var n=e.getExtension("OES_element_index_uint");return r.canUse32BitsIndices=!!n,r.IndicesArray=r.canUse32BitsIndices?Uint32Array:Uint16Array,r.indicesType=r.canUse32BitsIndices?e.UNSIGNED_INT:e.UNSIGNED_SHORT,r}return a(t,e),s(t,[{key:"process",value:function(e,r,n,i,o){if(r.hidden||n.hidden||i.hidden)for(var a=o+t.POINTS*t.ATTRIBUTES;o<a;o++)e[o]=0;var s=i.size||1,h=r.x,u=r.y,c=n.x,d=n.y,f=(0,l.floatColor)(i.color),v=c-h,g=d-u,p=v*v+g*g,m=0,y=0;p&&(p=1/Math.sqrt(p),m=-g*p,y=v*p),e[o++]=h,e[o++]=u,e[o++]=m,e[o++]=y,e[o++]=s,e[o++]=f,e[o++]=h,e[o++]=u,e[o++]=-m,e[o++]=-y,e[o++]=s,e[o++]=f,e[o++]=c,e[o++]=d,e[o++]=m,e[o++]=y,e[o++]=s,e[o++]=f,e[o++]=c,e[o++]=d,e[o++]=-m,e[o++]=-y,e[o++]=s,e[o++]=f}},{key:"computeIndices",value:function(e){for(var r=e.length/t.ATTRIBUTES,n=r+r/2,i=new this.IndicesArray(n),o=0,a=0;o<n;o+=4)i[a++]=o,i[a++]=o+1,i[a++]=o+2,i[a++]=o+2,i[a++]=o+1,i[a++]=o+3;return i}},{key:"bufferData",value:function(e,t,r){e.bufferData(e.ARRAY_BUFFER,t,e.DYNAMIC_DRAW),e.bufferData(e.ELEMENT_ARRAY_BUFFER,r,e.STATIC_DRAW)}},{key:"render",value:function(e,t,r){var n=this.program;e.useProgram(n),e.uniform2f(this.resolutionLocation,r.width,r.height),e.uniform1f(this.ratioLocation,r.ratio/Math.pow(r.ratio,r.edgesPowRatio)),e.uniformMatrix3fv(this.matrixLocation,!1,r.matrix),e.uniform1f(this.scaleLocation,r.ratio),e.drawElements(e.TRIANGLES,r.indices.length,this.indicesType,0)}}]),t}(u.default);t.default=g,g.POINTS=4,g.ATTRIBUTES=6},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),h=r(8),u=n(h),l=r(1),c=r(26),d=n(c),f=r(25),v=n(f),g=function(e){function t(e){i(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,d.default,v.default));r.buffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,r.buffer);var n=r.program;return r.positionLocation=e.getAttribLocation(n,"a_position"),r.sizeLocation=e.getAttribLocation(n,"a_size"),r.colorLocation=e.getAttribLocation(n,"a_color"),r.resolutionLocation=e.getUniformLocation(n,"u_resolution"),r.matrixLocation=e.getUniformLocation(n,"u_matrix"),r.ratioLocation=e.getUniformLocation(n,"u_ratio"),r.scaleLocation=e.getUniformLocation(n,"u_scale"),e.enableVertexAttribArray(r.positionLocation),e.enableVertexAttribArray(r.sizeLocation),e.enableVertexAttribArray(r.colorLocation),e.vertexAttribPointer(r.positionLocation,2,e.FLOAT,!1,t.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,0),e.vertexAttribPointer(r.sizeLocation,1,e.FLOAT,!1,t.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,8),e.vertexAttribPointer(r.colorLocation,1,e.FLOAT,!1,t.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,12),r}return a(t,e),s(t,[{key:"process",value:function(e,t,r){var n=(0,l.floatColor)(t.color);e[r++]=t.x,e[r++]=t.y,e[r++]=t.size,e[r++]=n}},{key:"bufferData",value:function(e,t){e.bufferData(e.ARRAY_BUFFER,t,e.DYNAMIC_DRAW)}},{key:"render",value:function(e,r,n){var i=this.program;e.useProgram(i),e.uniform2f(this.resolutionLocation,n.width,n.height),e.uniform1f(this.ratioLocation,1/Math.pow(n.ratio,n.nodesPowRatio)),e.uniform1f(this.scaleLocation,n.scalingRatio),e.uniformMatrix3fv(this.matrixLocation,!1,n.matrix),e.drawArrays(e.POINTS,0,r.length/t.ATTRIBUTES)}}]),t}(u.default);t.default=g,g.POINTS=1,g.ATTRIBUTES=4},function(e,t,r){"use strict";function n(e,t,r){var n="VERTEX"===e?t.VERTEX_SHADER:t.FRAGMENT_SHADER,i=t.createShader(n);if(t.shaderSource(i,r),t.compileShader(i),!t.getShaderParameter(i,t.COMPILE_STATUS)){var o=t.getShaderInfoLog(i);throw t.deleteShader(i),new Error("sigma/renderers/weblg/shaders/utils.loadShader: error while compiling the shader:\n"+o+"\n"+r)}return i}function i(e,t){var r=e.createProgram(),n=void 0,i=void 0;for(n=0,i=t.length;n<i;n++)e.attachShader(r,t[n]);if(e.linkProgram(r),!e.getProgramParameter(r,e.LINK_STATUS))throw e.deleteProgram(r),new Error("sigma/renderers/weblg/shaders/utils.loadProgram: error while linking the program.");return r}Object.defineProperty(t,"__esModule",{value:!0}),t.loadProgram=i;var o=n.bind(null,"VERTEX"),a=n.bind(null,"FRAGMENT");t.loadVertexShader=o,t.loadFragmentShader=a},function(e,t){e.exports=function(e){return null!==e&&"object"==typeof e&&"function"==typeof e.addUndirectedEdgeWithKey&&"function"==typeof e.dropNodes&&"boolean"==typeof e.multi}},function(e,t){e.exports="precision mediump float;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_thickness;\n\n// Note: twice the one defined in the vertex shader\nconst float feather = 1.0;\nconst vec4 color0 = vec4(0.0, 0.0, 0.0, 0.0);\n\nvoid main(void) {\n float dist = length(v_normal) * v_thickness;\n\n float t = smoothstep(\n v_thickness - feather,\n v_thickness,\n dist\n );\n\n gl_FragColor = mix(v_color, color0, t);\n}\n"},function(e,t){e.exports="attribute vec2 a_position;\nattribute vec2 a_normal;\nattribute float a_thickness;\nattribute float a_color;\n\nuniform vec2 u_resolution;\nuniform float u_ratio;\nuniform mat3 u_matrix;\nuniform float u_scale;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_thickness;\n\nconst float feather = 0.5;\n\nvoid main() {\n\n v_thickness = a_thickness * u_ratio / 2.0 + feather;\n\n // Scale from [[-1 1] [-1 1]] to the container:\n vec2 delta = vec2(a_normal * v_thickness);\n vec2 position = (u_matrix * vec3(a_position + delta, 1)).xy;\n position = (position / u_resolution * 2.0 - 1.0) * vec2(1, -1);\n\n // Applying\n gl_Position = vec4(position, 0, 1);\n\n v_normal = a_normal + vec2(sign(a_normal.x) * feather, sign(a_normal.y) * feather);\n // v_thickness = max(1.0, length(delta) / u_scale);\n v_thickness = max(1.0, v_thickness / u_scale);\n\n // Extract the color:\n float c = a_color;\n v_color.b = mod(c, 256.0); c = floor(c / 256.0);\n v_color.g = mod(c, 256.0); c = floor(c / 256.0);\n v_color.r = mod(c, 256.0); c = floor(c / 256.0); v_color /= 255.0;\n v_color.a = 1.0;\n}\n"},function(e,t){e.exports="precision mediump float;\n\nvarying vec4 color;\nvarying float border;\n\nconst float radius = 0.5;\n\nvoid main(void) {\n vec4 color0 = vec4(0.0, 0.0, 0.0, 0.0);\n vec2 m = gl_PointCoord - vec2(0.5, 0.5);\n float dist = radius - length(m);\n\n float t = 0.0;\n if (dist > border)\n t = 1.0;\n else if (dist > 0.0)\n t = dist / border;\n\n gl_FragColor = mix(color0, color, t);\n}\n"},function(e,t){e.exports="attribute vec2 a_position;\nattribute float a_size;\nattribute float a_color;\n\nuniform vec2 u_resolution;\nuniform float u_ratio;\nuniform float u_scale;\nuniform mat3 u_matrix;\n\nvarying vec4 color;\nvarying float border;\n\nvoid main() {\n\n gl_Position = vec4(\n ((u_matrix * vec3(a_position, 1)).xy /\n u_resolution * 2.0 - 1.0) * vec2(1, -1),\n 0,\n 1\n );\n\n // Multiply the point size twice:\n // - x SCALING_RATIO to correct the canvas scaling\n // - x 2 to correct the formulae\n gl_PointSize = a_size * u_ratio * u_scale * 2.0;\n\n border = (1.0 / u_ratio) * (0.5 / a_size);\n\n // Extract the color:\n float c = a_color;\n color.b = mod(c, 256.0); c = floor(c / 256.0);\n color.g = mod(c, 256.0); c = floor(c / 256.0);\n color.r = mod(c, 256.0); c = floor(c / 256.0); color /= 255.0;\n color.a = 1.0;\n}\n"}])}); |
@@ -309,3 +309,3 @@ 'use strict'; | ||
key: 'animate', | ||
value: function animate(state, options /*, callback */) { | ||
value: function animate(state, options, callback) { | ||
var _this2 = this; | ||
@@ -337,2 +337,4 @@ | ||
if (typeof callback === 'function') callback(); | ||
return; | ||
@@ -339,0 +341,0 @@ } |
@@ -257,2 +257,6 @@ 'use strict'; | ||
if (e.preventDefault) e.preventDefault();else e.returnValue = false; | ||
e.stopPropagation(); | ||
if (!this.enabled) return false; | ||
@@ -267,5 +271,2 @@ | ||
this.wheelLock = true; | ||
setTimeout(function () { | ||
return _this4.wheelLock = false; | ||
}, 30); | ||
@@ -288,10 +289,8 @@ // TODO: handle max zoom | ||
}, { | ||
easing: this.camera.isAnimated() ? 'quadraticOut' : 'quadraticInOut', | ||
easing: 'linear', | ||
duration: MOUSE_ZOOM_DURATION | ||
}, function () { | ||
return _this4.wheelLock = false; | ||
}); | ||
if (e.preventDefault) e.preventDefault();else e.returnValue = false; | ||
e.stopPropagation(); | ||
return false; | ||
@@ -298,0 +297,0 @@ } |
@@ -130,7 +130,7 @@ 'use strict'; | ||
function getWheelDelta(e) { | ||
if (typeof e.wheelDelta !== 'undefined') return e.wheelDelta; | ||
if (typeof e.wheelDelta !== 'undefined') return e.wheelDelta / 360; | ||
if (typeof e.detail !== 'undefined') return -e.detail; | ||
if (typeof e.detail !== 'undefined') return e.detail / -9; | ||
throw new Error('sigma/captors/utils.getDelta: could not extract delta from event.'); | ||
} |
{ | ||
"name": "sigma", | ||
"version": "2.0.0-alpha6", | ||
"version": "2.0.0-alpha7", | ||
"description": "A JavaScript library dedicated to graph drawing.", | ||
@@ -5,0 +5,0 @@ "homepage": "http://sigmajs.org", |
@@ -73,2 +73,3 @@ 'use strict'; | ||
}; | ||
// TODO: hide labels on move | ||
@@ -75,0 +76,0 @@ /** |
@@ -70,2 +70,3 @@ 'use strict'; | ||
_this.matrixLocation = gl.getUniformLocation(_this.program, 'u_matrix'); | ||
_this.scaleLocation = gl.getUniformLocation(_this.program, 'u_scale'); | ||
@@ -201,2 +202,4 @@ // Bindings | ||
gl.uniform1f(this.scaleLocation, params.ratio); | ||
// Drawing: | ||
@@ -203,0 +206,0 @@ gl.drawElements(gl.TRIANGLES, params.indices.length, this.indicesType, 0); |
@@ -16,3 +16,4 @@ var path = require('path'); | ||
path: path.join(__dirname, 'renderers', 'webgl', 'shaders'), | ||
filename: '[name].glsl' | ||
filename: '[name].glsl', | ||
libraryTarget: 'commonjs2' | ||
}, | ||
@@ -19,0 +20,0 @@ module: { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
390828
6062