New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

sigma

Package Overview
Dependencies
Maintainers
2
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sigma - npm Package Compare versions

Comparing version 2.0.0-alpha7 to 2.0.0-alpha7-labelgrid

heuristics/labels.js

2

build/sigma.min.js

@@ -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(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"}])});
!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()}("undefined"!=typeof self?self:this,function(){return function(e){function t(i){if(r[i])return r[i].exports;var n=r[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,i){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:i})},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=10)}([function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(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(1),s=function(e){function t(){return i(this,t),n(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),t}(a.EventEmitter);t.default=s},function(e,t){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(e){return"function"==typeof e}function n(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(!n(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,n,s,h,l;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 u=new Error('Uncaught, unspecified "error" event. ('+t+")");throw u.context=t,u}if(r=this._events[e],a(r))return!1;if(i(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),l=r.slice(),n=l.length,h=0;h<n;h++)l[h].apply(this,s);return!0},r.prototype.addListener=function(e,t){var n;if(!i(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,i(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&&(n=a(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&n>0&&this._events[e].length>n&&(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),n||(n=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var n=!1;return r.listener=t,this.on(e,r),this},r.prototype.removeListener=function(e,t){var r,n,a,s;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],a=r.length,n=-1,r===t||i(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){n=s;break}if(n<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(n,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],i(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]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(i(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 i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(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 i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),s=r(1),h=r(13),l=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),u=r(4),c={easing:"quadraticInOut",duration:150},f=function(e){function t(e){i(this,t),e=e||{};var r=n(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),i=Math.sin(this.angle);return{x:(e*r-t*i)*this.ratio,y:(t*r+e*i)*this.ratio}}},{key:"displayToGraph",value:function(e,t){var r=Math.cos(this.angle),i=Math.sin(this.angle),n=this.width/2-(this.x*r+this.y*i)/this.ratio,o=this.height/2-(this.y*r-this.x*i)/this.ratio,a=e-n,s=t-o;return{x:(a*r-s*i)*this.ratio,y:(s*r+a*i)*this.ratio}}},{key:"graphToDisplay",value:function(e,t){var r=Math.cos(this.angle)/this.ratio,i=Math.sin(this.angle)/this.ratio;return{x:e*r+t*i+(this.width/2-this.x*r-this.y*i),y:t*r-e*i+(this.height/2-this.y*r+this.x*i)}}},{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),i=this.abstractDisplayToGraph(this.width/4,0).x,n=this.abstractDisplayToGraph(0,this.height/4,0).y;return{x1:this.x-r.x-i,y1:this.y-r.y-n,x2:this.x-r.x+i+e.x,y2:this.y-r.y-n+e.y,height:Math.sqrt(Math.pow(t.x,2)+Math.pow(t.y+2*n,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 i=this;if(!this.enabled)return this;t=(0,u.assign)({},c,t);var n="function"==typeof t.easing?t.easing:l[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 i.nextFrame=null,i.setState(e),void("function"==typeof r&&r());var l=n(h),u={};"x"in e&&(u.x=a.x+(e.x-a.x)*l),"y"in e&&(u.y=a.y+(e.y-a.y)*l),"angle"in e&&(u.angle=a.angle+(e.angle-a.angle)*l),"ratio"in e&&(u.ratio=a.ratio+(e.ratio-a.ratio)*l),i.setState(u),i.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=f},function(e,t,r){"use strict";function i(e){if(void 0!==s[e])return s[e];var t=0,r=0,i=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),i=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),i=parseInt(e.charAt(5)+e.charAt(6),16));else if(h.test(e)){var n=e.match(l);t=+n[1],r=+n[2],i=+n[3]}var o=256*t*256+256*r+i;return s[e]=o,o}function n(e,t){var r=e.angle,i=e.ratio,n=e.x,o=e.y,s=t.width,h=t.height,l=(0,a.identity)(),u=(0,a.scale)((0,a.identity)(),1/i),c=(0,a.rotate)((0,a.identity)(),-r),f=(0,a.translate)((0,a.identity)(),-n,-o),d=(0,a.translate)((0,a.identity)(),s/2,h/2);return(0,a.multiply)(l,u),(0,a.multiply)(l,c),(0,a.multiply)(l,f),l=(0,a.multiply)(d,l)}function o(e,t,r,i){var n=i||new Uint8Array(4);return e.readPixels(t,r,1,1,e.RGBA,e.UNSIGNED_BYTE,n),n}Object.defineProperty(t,"__esModule",{value:!0}),t.floatColor=i,t.matrixFromCamera=n,t.extractPixel=o;var a=r(20),s={},h=/^\s*rgba?\s*\(/,l=/^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)\s*(,.*)?\)\s*$/},function(e,t,r){"use strict";function i(e){e=e||{};for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];for(var n=0,o=r.length;n<o;n++)if(r[n])for(var a in r[n])e[a]=r[n][a];return e}Object.defineProperty(t,"__esModule",{value:!0}),t.assign=i},function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t,r,i){return e===r||t===i}function o(e,t,r,i,n,o,a){return e<i+o&&e+r>i&&t<n+a&&t+r>n}function a(e,t,r,i,n,o,a,s){return e<n+a&&e+r>n&&t<o+s&&t+i>o}function s(e,t,r,i,n,o){var a=r+n/2,s=i+o/2,h=t<s,l=e<a;return h?l?y:b:l?_:x}function h(e,t){for(var r=[0,0];r.length;){var i=r.pop(),n=r.pop(),o=4*n+f,a=4*n+2*f,s=4*n+3*f,h=4*n+4*f,l=t[n+v],u=t[n+g],c=t[n+p],d=t[n+m],y=c/2,b=d/2;t[o+v]=l,t[o+g]=u,t[o+p]=y,t[o+m]=b,t[a+v]=l+y,t[a+g]=u,t[a+p]=y,t[a+m]=b,t[s+v]=l,t[s+g]=u+b,t[s+p]=y,t[s+m]=b,t[h+v]=l+y,t[h+g]=u+b,t[h+p]=y,t[h+m]=b,i<e-1&&(r.push(h,i+1),r.push(s,i+1),r.push(a,i+1),r.push(o,i+1))}}function l(e,t,r,i,n,a,s){for(var h=n-s,l=a-s,u=2*s,c=0,d=0;;){if(c>=e)return r[d]=r[d]||[],void r[d].push(i);var y=4*d+f,b=4*d+2*f,_=4*d+3*f,x=4*d+4*f,w=o(h,l,u,t[y+v],t[y+g],t[y+p],t[y+m]),E=o(h,l,u,t[b+v],t[b+g],t[b+p],t[b+m]),M=o(h,l,u,t[_+v],t[_+g],t[_+p],t[_+m]),O=o(h,l,u,t[x+v],t[x+g],t[x+p],t[x+m]),P=w+E+M+O;if(0===P)throw new Error("sigma/quadtree.insertNode: no collision (level: "+c+", key: "+i+", x: "+n+", y: "+a+", size: "+s+").");if(3===P)throw new Error("sigma/quadtree.insertNode: 3 impossible collisions (level: "+c+", key: "+i+", x: "+n+", y: "+a+", size: "+s+").");if(P>1)return r[d]=r[d]||[],void r[d].push(i);c++,w&&(d=y),E&&(d=b),M&&(d=_),O&&(d=x)}}function u(e,t,r,i,n,o,s){for(var h=[0,0],l=[],u=void 0;h.length;){var c=h.pop(),d=h.pop();if(u=r[d],u&&l.push.apply(l,u),!(c>=e)){var y=4*d+f,b=4*d+2*f,_=4*d+3*f,x=4*d+4*f,w=a(i,n,o,s,t[y+v],t[y+g],t[y+p],t[y+m]),E=a(i,n,o,s,t[b+v],t[b+g],t[b+p],t[b+m]),M=a(i,n,o,s,t[_+v],t[_+g],t[_+p],t[_+m]),O=a(i,n,o,s,t[x+v],t[x+g],t[x+p],t[x+m]);w&&h.push(y,c+1),E&&h.push(b,c+1),M&&h.push(_,c+1),O&&h.push(x,c+1)}}return l}Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),f=4,d=5,v=0,g=1,p=2,m=3,y=1,b=2,_=3,x=4,w=function(){function e(t){i(this,e),t=t||{};var r=Math.pow(4,d);this.data=new Float32Array(f*((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,i){return l(d,this.data,this.containers,e,t,r,i),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(d,this.data)}},{key:"clear",value:function(){return this.containers={},this}},{key:"point",value:function(e,t){var r=[],i=0,n=0;do{this.containers[i]&&r.push.apply(r,this.containers[i]);i=4*i+s(e,t,this.data[i+v],this.data[i+g],this.data[i+p],this.data[i+m])*f,n++}while(n<=d);return r}},{key:"rectangle",value:function(e,t,r,i,o){var a=this.lastRectangle;if(a&&e===a.x1&&r===a.x2&&t===a.y1&&i===a.y2&&o===a.height)return this.cache;if(this.lastRectangle={x1:e,y1:t,x2:r,y2:i,height:o},!n(e,t,r,i))throw new Error("sigma/quadtree.rectangle: shifted view is not yet implemented.");var s=u(d,this.data,this.containers,e,t,Math.abs(e-r)||Math.abs(t-i),o);return this.cache=s,this.cache}}]),e}();t.default=w},function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(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 i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),s=r(14),h=function(e){return e&&e.__esModule?e:{default:e}}(s),l=r(15),u=function(e){function t(e,r){i(this,t);var o=n(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=!1,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,l.getMouseCoords)(e))}}},{key:"handleDoubleClick",value:function(e){if(this.enabled){var t=(0,l.getCenter)(e),r=this.camera.getState(),i=this.camera.abstractDisplayToGraph((0,l.getX)(e)-t.x,(0,l.getY)(e)-t.y);return this.camera.animate({x:i.x*(1-1/2.2)+r.x,y:i.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,l.getX)(e),this.startMouseY=(0,l.getY)(e),this.hasDragged=!1,this.downStartTime=Date.now(),e.which,this.isMouseDown=!0,this.emit("mousedown",(0,l.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,l.getX)(e),r=(0,l.getY)(e),i=this.camera.getState();this.isMoving?this.camera.animate({x:i.x+3*(i.x-this.lastCameraState.x),y:i.y+3*(i.y-this.lastCameraState.y)},{duration:200,easing:"quadraticOut"}):this.startMouseX===t&&this.startMouseY===r||this.camera.setState({x:i.x,y:i.y}),this.isMoving=!1,this.hasDragged=!1,this.emit("mouseup",(0,l.getMouseCoords)(e))}}},{key:"handleMove",value:function(e){var t=this;if(this.enabled){if(this.emit("mousemove",(0,l.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,l.getX)(e)-this.startMouseX,(0,l.getY)(e)-this.startMouseY),i=this.startCameraState.x-r.x,n=this.startCameraState.y-r.y,o=this.camera.getState();o.x===i&&o.y===n||(this.lastCameraState=o,this.camera.setState({x:i,y:n}))}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,l.getWheelDelta)(e);if(!r)return!1;if(this.wheelLock)return!1;this.wheelLock=!0;var i=r>0?1/1.7:1.7,n=this.camera.getState(),o=i*n.ratio,a=(0,l.getCenter)(e),s=this.camera.abstractDisplayToGraph((0,l.getX)(e)-a.x,(0,l.getY)(e)-a.y);return this.camera.animate({x:s.x*(1-i)+n.x,y:s.y*(1-i)+n.y,ratio:o},{easing:"linear",duration:200},function(){return t.wheelLock=!1}),!1}},{key:"handleOut",value:function(){}}]),t}(h.default);t.default=u},function(e,t,r){"use strict";function i(e,t){var r=document.createElement(e);if(!t)return r;for(var i in t)if("style"===i)for(var n in t[i])r.style[n]=t[i][n];else r.setAttribute(i,t[i]);return r}function n(){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,i=e.height||1,n=e.width||1,o=t.maxX,s=t.maxY,h=t.minX,l=t.minY,u=(o+h)/2,c=(s+l)/2,f="outside"===r?Math.max(n/Math.max(o-h,1),i/Math.max(s-l,1)):Math.min(n/Math.max(o-h,1),i/Math.max(s-l,1)),d=function(e){return{x:(e.x-u)*f,y:(e.y-c)*f}};return d.inverse=function(e){return{x:e.x/f+u,y:e.y/f+c}},d}Object.defineProperty(t,"__esModule",{value:!0}),t.createElement=i,t.getPixelRatio=n,t.createRescalingFunction=o;var a={mode:"inside",margin:0}},function(e,t,r){"use strict";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 n=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),o=r(19),a=function(){function e(t,r,n){i(this,e),this.vertexShaderSource=r,this.fragmentShaderSource=n,this.load(t)}return n(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 i(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=i},function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var n=r(11),o=i(n),a=r(0),s=i(a),h=r(2),l=i(h),u=r(5),c=i(u),f=r(6),d=i(f),v=r(16),g=i(v),p={Sigma:o.default,Renderer:s.default,Camera:l.default,QuadTree:c.default,MouseCaptor:d.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 i(e){return e&&e.__esModule?e:{default:e}}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 o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),a=r(12),s=i(a),h=r(0),l=i(h),u=function(){function e(t,r){if(n(this,e),!(0,s.default)(t))throw new Error("Sigma.constructor: given graph is not an instance of a graphology implementation.");if(!(r instanceof l.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(),i=-1/0,n=-1/0,o=1/0,a=1/0,s=-1/0,h=-1/0,l=0,u=t.length;l<u;l++){var c=t[l],f=this.getNodeData(c),d=f.size||1;f.x>i&&(i=f.x),f.y>n&&(n=f.y),f.x<o&&(o=f.x),f.y<a&&(a=f.y),d>s&&(s=d)}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:i,maxY:n,minX:o,minY:a,maxNodeSize:s,maxEdgeSize:h}}}]),e}();t.default=u},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,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 i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(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(1),s=function(e){function t(e,r){i(this,t);var o=n(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 i(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 n(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,u.getPixelRatio)();return{x:o(e)/(2*t),y:a(e)/(2*t)}}function h(e){return{x:i(e),y:n(e),clientX:e.clientX,clientY:e.clientY,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey,shiftKey:e.shiftKey}}function l(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=i,t.getY=n,t.getWidth=o,t.getHeight=a,t.getCenter=s,t.getMouseCoords=h,t.getWheelDelta=l;var u=r(7)},function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function n(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 i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),h=r(0),l=i(h),u=r(2),c=i(u),f=r(6),d=i(f),v=r(5),g=i(v),p=r(17),m=r(18),y=i(m),b=r(23),_=i(b),x=r(9),w=i(x),E=r(26),M=i(E),O=r(4),P=r(7),T=r(3),A=(0,P.getPixelRatio)(),L=(0,P.getPixelRatio)(),S={hideEdgesOnMove:!1,hideLabelsOnMove:!1},k=function(e){function t(e,r){n(this,t);var i=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));if(r=r||{},i.settings=(0,O.assign)({},S,r),!(e instanceof HTMLElement))throw new Error("sigma/renderers/webgl: container should be an html element.");i.sigma=null,i.captors={},i.container=e,i.elements={},i.contexts={},i.listeners={},i.quadtree=new g.default,i.nodeOrder={},i.nodeDataCache={},i.edgeOrder={},i.rescalingFunction=null,i.width=0,i.height=0,i.highlightedNodes=new Set,i.visibleNodes=new Set,i.displayedLabels=new Set,i.hoveredNode=null,i.wasRenderedInThisFrame=!1,i.renderFrame=null,i.renderHighlightedNodesFrame=null,i.needToProcess=!1,i.needToSoftProcess=!1,i.createContext("edges"),i.createContext("nodes"),i.createContext("labels",!1),i.createContext("hovers",!1),i.createContext("mouse",!1);var a=i.contexts.nodes;return a.blendFunc(a.ONE,a.ONE_MINUS_SRC_ALPHA),a.enable(a.BLEND),a=i.contexts.edges,a.blendFunc(a.ONE,a.ONE_MINUS_SRC_ALPHA),a.enable(a.BLEND),i.nodePrograms={def:new y.default(i.contexts.nodes)},i.edgePrograms={def:new _.default(i.contexts.edges)},i.resize(),i.camera=new c.default({width:i.width,height:i.height}),i.lastCameraState=i.camera.getState(),i.bindCameraHandlers(),i.captors={mouse:new d.default(i.elements.mouse,i.camera)},i.bindEventHandlers(),i}return a(t,e),s(t,[{key:"createContext",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=(0,P.createElement)("canvas",{class:"sigma-"+e,style:{position:"absolute"}});this.elements[e]=r,this.container.appendChild(r);var i={preserveDrawingBuffer:!0,antialias:!1},n=r.getContext(t?"webgl":"2d",i);return this.contexts[e]=n,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,i,n){return e>r-n&&e<r+n&&t>i-n&&t<i+n&&Math.sqrt(Math.pow(e-r,2)+Math.pow(t-i,2))<n},r=function(t,r){var i=e.camera.displayToGraph(t,r);return e.quadtree.point(i.x,i.y)};return this.listeners.handleMove=function(i){for(var n=Math.pow(e.camera.getState().ratio,.5),o=r(i.x,i.y),a=0,s=o.length;a<s;a++){var h=o[a],l=e.nodeDataCache[h],u=e.camera.graphToDisplay(l.x,l.y),c=l.size/n;if(t(i.x,i.y,u.x,u.y,c))return e.hoveredNode=h,e.emit("overNode",{node:h}),e.scheduleHighlightedNodesRender()}if(e.hoveredNode){var f=e.nodeDataCache[e.hoveredNode],d=e.camera.graphToDisplay(f.x,f.y),v=f.size/n;if(!t(i.x,i.y,d.x,d.y,v))return e.hoveredNode=null,e.emit("outNode",{node:e.hoveredNode}),e.scheduleHighlightedNodesRender()}},this.listeners.handleDown=function(i){for(var n=Math.pow(e.camera.getState().ratio,.5),o=r(i.x,i.y),a=0,s=o.length;a<s;a++){var h=o[a],l=e.nodeDataCache[h],u=e.camera.graphToDisplay(l.x,l.y),c=l.size/n;if(t(i.x,i.y,u.x,u.y,c))return e.emit("downNode",{node:h})}},this.listeners.handleClick=function(i){for(var n=Math.pow(e.camera.getState().ratio,.5),o=r(i.x,i.y),a=0,s=o.length;a<s;a++){var h=o[a],l=e.nodeDataCache[h],u=e.camera.graphToDisplay(l.x,l.y),c=l.size/n;if(t(i.x,i.y,u.x,u.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.rescalingFunction=(0,P.createRescalingFunction)({width:this.width,height:this.height},r);var i=this.rescalingFunction({x:r.minX,y:r.minY}),n=this.rescalingFunction({x:r.maxX,y:r.maxY});this.quadtree.resize({x:i.x,y:i.y,width:n.x-i.x,height:n.y-i.y});var o=this.nodePrograms.def;e||(o.allocate(t.order),this.nodeOrder={});for(var a=t.nodes(),s=0,h=a.length;s<h;s++){var l=a[s];this.nodeOrder[l]=s;var u=this.sigma.getNodeData(l),c=this.rescalingFunction(u),f=(0,O.assign)({},u,c);this.quadtree.add(l,f.x,f.y,f.size),this.nodeDataCache[l]=f,o.process(f,s)}o.bufferData();var d=this.edgePrograms.def;e||(d.allocate(t.size),this.edgeOrder={});for(var v=t.edges(),g=0,p=v.length;g<p;g++){var m=v[g];this.edgeOrder[m]=g;var y=this.sigma.getEdgeData(m),b=t.extremities(m),_=this.nodeDataCache[b[0]],x=this.nodeDataCache[b[1]];d.process(_,x,y,g)}return e||"function"!=typeof d.computeIndices||(this.edgeIndicesArray=d.computeIndices()),d.bufferData(),this}},{key:"processNode",value:function(e){var t=this.nodePrograms.def,r=this.sigma.getNodeData(e);return t.process(r,this.nodeOrder[e]),this}},{key:"processEdge",value:function(e){var t=this.sigma.getGraph(),r=this.edgePrograms.def,i=this.sigma.getEdgeData(e),n=t.extremities(e),o=this.sigma.getNodeData(n[0]),a=this.sigma.getNodeData(n[1]);return r.process(o,a,i,this.edgeOrder[e]),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,i=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&&i===this.height)return this;this.camera&&this.camera.resize({width:this.width,height:this.height});for(var n in this.elements){var o=this.elements[n];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*A+"px"),this.elements[a].setAttribute("height",this.height*A+"px"),1!==A&&s.scale(A,A)):(this.elements[a].setAttribute("width",this.width*L+"px"),this.elements[a].setAttribute("height",this.height*L+"px")),s.viewport&&s.viewport(0,0,this.width*L,this.height*L)}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);var e=this.camera.isAnimated()||this.captors.mouse.isMoving||this.captors.mouse.hasDragged||this.captors.mouse.wheelLock;this.resize(),this.clear();var t=this.camera.getState(),r=(0,T.matrixFromCamera)(t,{width:this.width,height:this.height}),i=void 0;if(i=this.nodePrograms.def,i.render({matrix:r,width:this.width,height:this.height,ratio:t.ratio,nodesPowRatio:.5,scalingRatio:L}),this.settings.hideEdgesOnMove&&e||(i=this.edgePrograms.def,i.render({matrix:r,width:this.width,height:this.height,ratio:t.ratio,edgesPowRatio:.5,scalingRatio:L})),this.settings.hideLabelsOnMove&&e)return this;var n=void 0;if(t.ratio>=1)n=this.sigma.getGraph().nodes();else{var o=this.camera.viewRectangle();n=this.quadtree.rectangle(o.x1,o.y1,o.x2,o.y2,o.height)}var a=(0,p.getLabelsToDisplay)(this.camera,this.lastCameraState,this.nodeDataCache,this.nodeOrder,n,this.visibleNodes,this.displayedLabels);this.displayedLabels=new Set(a),this.visibleNodes=new Set(n);for(var s=this.contexts.labels,h=Math.pow(t.ratio,.5),l=0,u=a.length;l<u;l++){var c=this.nodeDataCache[a[l]],f=this.camera.graphToDisplay(c.x,c.y),d=f.x,v=f.y,g=c.size/h;(0,w.default)(s,{label:c.label,size:g,x:d,y:v})}return this.renderHighlightedNodes(),this.lastCameraState=t,this}},{key:"renderHighlightedNodes",value:function(){var e=this,t=this.camera,r=Math.pow(t.getState().ratio,.5),i=this.contexts.hovers;i.clearRect(0,0,this.width,this.height);var n=function(n){var o=e.nodeDataCache[n],a=t.graphToDisplay(o.x,o.y),s=a.x,h=a.y,l=o.size/r;(0,M.default)(i,{label:o.label,color:o.color,size:l,x:s,y:h})};this.hoveredNode&&n(this.hoveredNode),this.highlightedNodes.forEach(n)}},{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}(l.default);t.default=k},function(e,t,r){"use strict";var i=r(2),n=function(e){return e&&e.__esModule?e:{default:e}}(i),o={width:200,height:150},a={width:400,height:300};t.getLabelsToDisplay=function(e,t,r,i,s,h,l,u){var c=e.getState(),f=e.getDimensions(),d=new n.default(f);d.setState({ratio:c.ratio});var v=c.ratio<t.ratio,g=c.x!==t.x||c.y!==t.x,p=c.ratio>t.ratio,m=!v&&!p&&c.ratio>=1,y=c.ratio>=1.3?a:o;if(m&&0!==l.size)return Array.from(l);for(var b=f.width%y.width,_=y.width+b/Math.floor(f.width/y.width),x=(f.height,y.height+b/Math.floor(f.height/y.height)),w={},E=new Set,M=v||g&&!p?Array.from(l):[],O=0,P=s.length;O<P;O++){var T=s[O],A=r[T];if(!g||v||p||l.has(T)||!h.has(T)){var L=e.graphToDisplay(A.x,A.y),S=(d.graphToDisplay(A.x,A.y),Math.floor(L.x/_)%_),k=Math.floor(L.y/x)%x,D=S+";"+k,R=w[D];if(p&&E.has(D)){if(!l.has(T))continue;var C=r[R[0]];if(A.size>C.size&&(R[0]=T),A.size===C.size){i[T]<i[R[0]]&&(R[0]=T)}}else void 0===R&&(R=[],w[D]=R),l.has(T)&&E.add(D),R.push(T)}}for(var F in w){var N=w[F];if(!(v||g&&!p)||!E.has(F)){N.sort(function(e,t){var n=r[e],o=r[t];if(n.size<o.size)return 1;if(n.size>o.size)return-1;var a=i[e],s=i[t];return a<s?1:a>s?-1:0});for(var j=0,z=N.length;j<1&&j<z;){var U=N[j];M.push(U),j++}}}return M}},function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function n(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 i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),h=r(8),l=i(h),u=r(3),c=r(21),f=i(c),d=r(22),v=i(d),g=4,p=function(e){function t(e){n(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,f.default,v.default));r.gl=e,r.array=null,r.buffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,r.buffer);var i=r.program;return r.positionLocation=e.getAttribLocation(i,"a_position"),r.sizeLocation=e.getAttribLocation(i,"a_size"),r.colorLocation=e.getAttribLocation(i,"a_color"),r.resolutionLocation=e.getUniformLocation(i,"u_resolution"),r.matrixLocation=e.getUniformLocation(i,"u_matrix"),r.ratioLocation=e.getUniformLocation(i,"u_ratio"),r.scaleLocation=e.getUniformLocation(i,"u_scale"),e.enableVertexAttribArray(r.positionLocation),e.enableVertexAttribArray(r.sizeLocation),e.enableVertexAttribArray(r.colorLocation),e.vertexAttribPointer(r.positionLocation,2,e.FLOAT,!1,g*Float32Array.BYTES_PER_ELEMENT,0),e.vertexAttribPointer(r.sizeLocation,1,e.FLOAT,!1,g*Float32Array.BYTES_PER_ELEMENT,8),e.vertexAttribPointer(r.colorLocation,1,e.FLOAT,!1,g*Float32Array.BYTES_PER_ELEMENT,12),r}return a(t,e),s(t,[{key:"allocate",value:function(e){this.array=new Float32Array(1*g*e)}},{key:"process",value:function(e,t){var r=(0,u.floatColor)(e.color),i=1*t*g,n=this.array;n[i++]=e.x,n[i++]=e.y,n[i++]=e.size,n[i]=r}},{key:"bufferData",value:function(){var e=this.gl;e.bufferData(e.ARRAY_BUFFER,this.array,e.DYNAMIC_DRAW)}},{key:"render",value:function(e){var t=this.gl,r=this.program;t.useProgram(r),t.uniform2f(this.resolutionLocation,e.width,e.height),t.uniform1f(this.ratioLocation,1/Math.pow(e.ratio,e.nodesPowRatio)),t.uniform1f(this.scaleLocation,e.scalingRatio),t.uniformMatrix3fv(this.matrixLocation,!1,e.matrix),t.drawArrays(t.POINTS,0,this.array.length/g)}}]),t}(l.default);t.default=p},function(e,t,r){"use strict";function i(e,t,r){var i="VERTEX"===e?t.VERTEX_SHADER:t.FRAGMENT_SHADER,n=t.createShader(i);if(t.shaderSource(n,r),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS)){var o=t.getShaderInfoLog(n);throw t.deleteShader(n),new Error("sigma/renderers/weblg/shaders/utils.loadShader: error while compiling the shader:\n"+o+"\n"+r)}return n}function n(e,t){var r=e.createProgram(),i=void 0,n=void 0;for(i=0,n=t.length;i<n;i++)e.attachShader(r,t[i]);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=n;var o=i.bind(null,"VERTEX"),a=i.bind(null,"FRAGMENT");t.loadVertexShader=o,t.loadFragmentShader=a},function(e,t,r){"use strict";function i(){return Float32Array.of(1,0,0,0,1,0,0,0,1)}function n(e,t){return e[0]=t,e[4]=t,e}function o(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=r,e[3]=-r,e[4]=i,e}function a(e,t,r){return e[6]=t,e[7]=r,e}function s(e,t){var r=e[0],i=e[1],n=e[2],o=e[3],a=e[4],s=e[5],h=e[6],l=e[7],u=e[8],c=t[0],f=t[1],d=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+f*o+d*h,e[1]=c*i+f*a+d*l,e[2]=c*n+f*s+d*u,e[3]=v*r+g*o+p*h,e[4]=v*i+g*a+p*l,e[5]=v*n+g*s+p*u,e[6]=m*r+y*o+b*h,e[7]=m*i+y*a+b*l,e[8]=m*n+y*s+b*u,e}Object.defineProperty(t,"__esModule",{value:!0}),t.identity=i,t.scale=n,t.rotate=o,t.translate=a,t.multiply=s},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"},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,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function n(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 i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),h=r(8),l=i(h),u=r(3),c=r(24),f=i(c),d=r(25),v=i(d),g=6,p=function(e){function t(e){n(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,f.default,v.default));r.gl=e,r.array=null,r.indicesArray=null,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,g*Float32Array.BYTES_PER_ELEMENT,0),e.vertexAttribPointer(r.normalLocation,2,e.FLOAT,!1,g*Float32Array.BYTES_PER_ELEMENT,8),e.vertexAttribPointer(r.thicknessLocation,1,e.FLOAT,!1,g*Float32Array.BYTES_PER_ELEMENT,16),e.vertexAttribPointer(r.colorLocation,1,e.FLOAT,!1,g*Float32Array.BYTES_PER_ELEMENT,20);var i=e.getExtension("OES_element_index_uint");return r.canUse32BitsIndices=!!i,r.IndicesArray=r.canUse32BitsIndices?Uint32Array:Uint16Array,r.indicesType=r.canUse32BitsIndices?e.UNSIGNED_INT:e.UNSIGNED_SHORT,r}return a(t,e),s(t,[{key:"allocate",value:function(e){this.array=new Float32Array(4*g*e)}},{key:"process",value:function(e,t,r,i){if(e.hidden||t.hidden||r.hidden)for(var n=y+4*g;y<n;y++)b[y]=0;var o=r.size||1,a=e.x,s=e.y,h=t.x,l=t.y,c=(0,u.floatColor)(r.color),f=h-a,d=l-s,v=f*f+d*d,p=0,m=0;v&&(v=1/Math.sqrt(v),p=-d*v,m=f*v);var y=4*g*i,b=this.array;b[y++]=a,b[y++]=s,b[y++]=p,b[y++]=m,b[y++]=o,b[y++]=c,b[y++]=a,b[y++]=s,b[y++]=-p,b[y++]=-m,b[y++]=o,b[y++]=c,b[y++]=h,b[y++]=l,b[y++]=p,b[y++]=m,b[y++]=o,b[y++]=c,b[y++]=h,b[y++]=l,b[y++]=-p,b[y++]=-m,b[y++]=o,b[y]=c}},{key:"computeIndices",value:function(){for(var e=this.array.length/g,t=e+e/2,r=new this.IndicesArray(t),i=0,n=0;i<t;i+=4)r[n++]=i,r[n++]=i+1,r[n++]=i+2,r[n++]=i+2,r[n++]=i+1,r[n++]=i+3;this.indicesArray=r}},{key:"bufferData",value:function(){var e=this.gl;e.bufferData(e.ARRAY_BUFFER,this.array,e.DYNAMIC_DRAW),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indicesArray,e.STATIC_DRAW)}},{key:"render",value:function(e){var t=this.gl,r=this.program;t.useProgram(r),t.uniform2f(this.resolutionLocation,e.width,e.height),t.uniform1f(this.ratioLocation,e.ratio/Math.pow(e.ratio,e.edgesPowRatio)),t.uniformMatrix3fv(this.matrixLocation,!1,e.matrix),t.uniform1f(this.scaleLocation,e.ratio),t.drawElements(t.TRIANGLES,this.indicesArray.length,this.indicesType,0)}}]),t}(l.default);t.default=p},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(0.5, 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 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 + feather / 1.5,\n dist\n );\n\n gl_FragColor = mix(v_color, color0, t);\n}\n"},function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function n(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,i=Math.round(t.x-7-2),n=Math.round(t.y-7-2),o=Math.round(r+7+t.size+9),s=Math.round(18),l=Math.round(9);e.moveTo(i,n+l),e.moveTo(i,n+l),e.arcTo(i,n,i+l,n,l),e.lineTo(i+o,n),e.lineTo(i+o,n+s),e.lineTo(i+l,n+s),e.arcTo(i,n+s,i,n+s-l,l),e.lineTo(i,n+l),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=n;var o=r(27),a=i(o),s=r(9),h=i(s)},function(e,t,r){"use strict";function i(e,t){e.fillStyle=t.color,e.beginPath(),e.arc(t.x,t.y,t.size,0,n,!0),e.closePath(),e.fill()}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var n=2*Math.PI}])});

@@ -66,3 +66,3 @@ 'use strict';

_this.isMouseDown = false;
_this.isMoving = true;
_this.isMoving = false;
_this.movingTimeout = null;

@@ -204,4 +204,5 @@ _this.startCameraState = null;

this.isMoving = false;
this.hasDragged = false;
this.emit('mouseup', (0, _utils.getMouseCoords)(e));
this.isMoving = false;
}

@@ -208,0 +209,0 @@ }, {

{
"name": "sigma",
"version": "2.0.0-alpha7",
"version": "2.0.0-alpha7-labelgrid",
"description": "A JavaScript library dedicated to graph drawing.",

@@ -45,14 +45,14 @@ "homepage": "http://sigmajs.org",

"faker": "^4.1.0",
"graphology": "^0.10.2",
"graphology-generators": "^0.6.1",
"graphology": "^0.11.0",
"graphology-generators": "^0.7.0",
"graphology-gexf": "^0.3.1",
"graphology-layout": "0.0.1",
"graphology-layout-forceatlas2": "0.1.0",
"graphology-layout-forceatlas2": "^0.1.1",
"html-webpack-plugin": "^2.22.0",
"mocha": "^3.0.2",
"mocha": "^4.0.1",
"raw-loader": "^0.5.1",
"rimraf": "^2.6.1",
"webpack": "^2.5.1",
"webpack": "^3.10.0",
"webpack-dev-server": "^2.4.5",
"worker-loader": "^0.8.0"
"worker-loader": "^1.1.0"
},

@@ -59,0 +59,0 @@ "keywords": [

@@ -25,3 +25,3 @@ 'use strict';

// TODO: a square can be represented as topleft + width
// TODO: a square can be represented as topleft + width, saying for the quad blocks (reduce mem)

@@ -34,2 +34,8 @@ // TODO: jsdoc

// TODO: frustum seems to return too much nodes
// NOTE: this is basically a MX-CIF Quadtree at this point
// NOTE: need to explore R-Trees for edges
// NOTE: need to explore 2d segment tree for edges
/**

@@ -36,0 +42,0 @@ * Constants.

@@ -8,3 +8,3 @@ 'use strict';

exports.getPixelRatio = getPixelRatio;
exports.createNodeRescalingFunction = createNodeRescalingFunction;
exports.createRescalingFunction = createRescalingFunction;
/**

@@ -58,19 +58,11 @@ * Sigma.js Rendering Utils

*/
var DEFAULT_NODE_RESCALE_OPTIONS = {
var DEFAULT_RESCALE_OPTIONS = {
mode: 'inside',
margin: 0,
minSize: 1,
maxSize: 8
margin: 0
};
var DEFAULT_EDGE_RESCALE_OPTIONS = {
minSize: 0.5,
maxSize: 1
};
// TODO: should we let the user handle size through, for instance, d3 scales?
// TODO: should we put the rescaling in the camera itself?
/**
* Factory returning a function rescaling the given node's position and/or size.
* Factory returning a function rescaling the given node's position.
*

@@ -81,6 +73,6 @@ * @param {object} options - Options.

*/
function createNodeRescalingFunction(options, extent) {
function createRescalingFunction(options, extent) {
options = options || {};
var mode = options.mode || DEFAULT_NODE_RESCALE_OPTIONS.mode,
var mode = options.mode || DEFAULT_RESCALE_OPTIONS.mode,
height = options.height || 1,

@@ -87,0 +79,0 @@ width = options.width || 1;

@@ -25,2 +25,4 @@ 'use strict';

var _labels = require('../../heuristics/labels');
var _node = require('./programs/node.fast');

@@ -72,5 +74,5 @@

var DEFAULT_SETTINGS = {
hideEdgesOnMove: false
hideEdgesOnMove: false,
hideLabelsOnMove: false
};
// TODO: hide labels on move

@@ -107,16 +109,12 @@ /**

// Indices
// TODO: this could be improved by key => index => floatArray
// TODO: the cache should erase keys on node delete
_this.quadtree = new _quadtree2.default();
_this.nodeArray = null;
_this.nodeIndicesArray = null;
_this.nodeOrder = {};
// TODO: this could be improved by key => index => floatArray
_this.nodeDataCache = {};
_this.edgeArray = null;
_this.edgeIndicesArray = null;
_this.edgeOrder = {};
// TODO: if we drop size scaling => this should become "rescalingFunction"
_this.nodeRescalingFunction = null;
// Rescaling function
_this.rescalingFunction = null;

@@ -129,2 +127,4 @@ // Starting dimensions

_this.highlightedNodes = new Set();
_this.visibleNodes = new Set();
_this.displayedLabels = new Set();
_this.hoveredNode = null;

@@ -136,3 +136,2 @@ _this.wasRenderedInThisFrame = false;

_this.needToSoftProcess = false;
_this.pixel = new Uint8Array(4);

@@ -173,2 +172,3 @@ // Initializing contexts

});
_this.lastCameraState = _this.camera.getState();

@@ -194,8 +194,8 @@ // Binding camera events

/**
* Method used to test a pixel of the given context.
* Internal function used to create a canvas context and add the relevant
* DOM elements.
*
* @param {WebGLContext} gl - Context.
* @param {number} x - Client x.
* @param {number} y - Client y.
* @return {boolean}
* @param {string} id - Context's id.
* @param {boolean} webgl - Whether the context is a webgl or canvas one.
* @return {WebGLRenderer}
*/

@@ -205,19 +205,2 @@

_createClass(WebGLRenderer, [{
key: 'testPixel',
value: function testPixel(gl, x, y) {
(0, _utils3.extractPixel)(gl, x * WEBGL_OVERSAMPLING_RATIO, (this.height - y) * WEBGL_OVERSAMPLING_RATIO, this.pixel);
return this.pixel[3] !== 0;
}
/**
* Internal function used to create a canvas context and add the relevant
* DOM elements.
*
* @param {string} id - Context's id.
* @param {boolean} webgl - Whether the context is a webgl or canvas one.
* @return {WebGLRenderer}
*/
}, {
key: 'createContext',

@@ -321,2 +304,3 @@ value: function createContext(id) {

// TODO: we should get the nearest node instead
if (mouseIsOnNode(e.x, e.y, pos.x, pos.y, size)) {

@@ -450,5 +434,5 @@ _this3.hoveredNode = node;

// Rescaling function
this.nodeRescalingFunction = (0, _utils2.createNodeRescalingFunction)({ width: this.width, height: this.height }, extent);
this.rescalingFunction = (0, _utils2.createRescalingFunction)({ width: this.width, height: this.height }, extent);
var minRescaled = this.nodeRescalingFunction({
var minRescaled = this.rescalingFunction({
x: extent.minX,

@@ -458,3 +442,3 @@ y: extent.minY

var maxRescaled = this.nodeRescalingFunction({
var maxRescaled = this.rescalingFunction({
x: extent.maxX,

@@ -471,9 +455,6 @@ y: extent.maxY

this.nodeRescaleCache = {};
var nodeProgram = this.nodePrograms.def;
if (!keepArrays) {
this.nodeArray = new Float32Array(_node2.default.POINTS * _node2.default.ATTRIBUTES * graph.order);
nodeProgram.allocate(graph.order);
this.nodeOrder = {};

@@ -491,3 +472,3 @@ }

var rescaledData = this.nodeRescalingFunction(data);
var rescaledData = this.rescalingFunction(data);

@@ -501,6 +482,7 @@ // TODO: Optimize this to be save a loop and one object, by using a reversed assign

nodeProgram.process(this.nodeArray, displayData, i * _node2.default.POINTS * _node2.default.ATTRIBUTES);
nodeProgram.process(displayData, i);
}
nodeProgram.bufferData(this.contexts.nodes, this.nodeArray);
// TODO: do we need to keep passing gl to the program?
nodeProgram.bufferData();

@@ -510,4 +492,3 @@ var edgeProgram = this.edgePrograms.def;

if (!keepArrays) {
this.edgeArray = new Float32Array(_edge2.default.POINTS * _edge2.default.ATTRIBUTES * graph.size);
edgeProgram.allocate(graph.size);
this.edgeOrder = {};

@@ -528,9 +509,9 @@ }

edgeProgram.process(this.edgeArray, sourceData, targetData, _data2, _i * _edge2.default.POINTS * _edge2.default.ATTRIBUTES);
edgeProgram.process(sourceData, targetData, _data2, _i);
}
// Computing edge indices if necessary
if (!keepArrays && typeof edgeProgram.computeIndices === 'function') this.edgeIndicesArray = edgeProgram.computeIndices(this.edgeArray);
if (!keepArrays && typeof edgeProgram.computeIndices === 'function') this.edgeIndicesArray = edgeProgram.computeIndices();
edgeProgram.bufferData(this.contexts.edges, this.edgeArray, this.edgeIndicesArray);
edgeProgram.bufferData();

@@ -554,3 +535,3 @@ return this;

nodeProgram.process(this.nodeArray, data, this.nodeOrder[key] * _node2.default.POINTS * _node2.default.ATTRIBUTES);
nodeProgram.process(data, this.nodeOrder[key]);

@@ -579,3 +560,3 @@ return this;

edgeProgram.process(this.edgeArray, sourceData, targetData, data, this.edgeOrder[key] * _edge2.default.POINTS * _edge2.default.ATTRIBUTES);
edgeProgram.process(sourceData, targetData, data, this.edgeOrder[key]);

@@ -741,2 +722,5 @@ return this;

// TODO: improve this heuristic
var moving = this.camera.isAnimated() || this.captors.mouse.isMoving || this.captors.mouse.hasDragged || this.captors.mouse.wheelLock;
// First we need to resize

@@ -752,11 +736,9 @@ this.resize();

var program = void 0,
gl = void 0;
var program = void 0;
// Drawing nodes
gl = this.contexts.nodes;
program = this.nodePrograms.def;
// TODO: should probably use another name for the `program` abstraction
program.render(gl, this.nodeArray, {
program.render({
matrix: cameraMatrix,

@@ -771,7 +753,6 @@ width: this.width,

// Drawing edges
if (!this.settings.hideEdgesOnMove || !this.camera.isAnimated()) {
gl = this.contexts.edges;
if (!this.settings.hideEdgesOnMove || !moving) {
program = this.edgePrograms.def;
program.render(gl, this.edgeArray, {
program.render({
matrix: cameraMatrix,

@@ -782,7 +763,9 @@ width: this.width,

edgesPowRatio: 0.5,
scalingRatio: WEBGL_OVERSAMPLING_RATIO,
indices: this.edgeIndicesArray
scalingRatio: WEBGL_OVERSAMPLING_RATIO
});
}
// Do not display labels on move per setting
if (this.settings.hideLabelsOnMove && moving) return this;
// Finding visible nodes to display their labels

@@ -803,2 +786,7 @@ var visibleNodes = void 0;

var worthyLabels = (0, _labels.getLabelsToDisplay)(this.camera, this.lastCameraState, this.nodeDataCache, this.nodeOrder, visibleNodes, this.visibleNodes, this.displayedLabels);
this.displayedLabels = new Set(worthyLabels);
this.visibleNodes = new Set(visibleNodes);
// Drawing labels

@@ -810,4 +798,4 @@ // TODO: POW RATIO is currently default 0.5 and harcoded

for (var i = 0, l = visibleNodes.length; i < l; i++) {
var data = this.nodeDataCache[visibleNodes[i]];
for (var i = 0, l = worthyLabels.length; i < l; i++) {
var data = this.nodeDataCache[worthyLabels[i]];

@@ -824,3 +812,4 @@ var _camera$graphToDispla = this.camera.graphToDisplay(data.x, data.y),

// TODO: this is the label threshold hardcoded
if (size < 8) continue;
// if (size < 8)
// continue;

@@ -838,2 +827,5 @@ (0, _label2.default)(context, {

// Storing last camera state
this.lastCameraState = cameraState;
return this;

@@ -840,0 +832,0 @@ }

@@ -38,2 +38,5 @@ 'use strict';

// WARNING: this code is deprecated. It needs to be re-adapted to work
// correctly to new APIs.
var EdgeFastProgram = function (_Program) {

@@ -78,4 +81,3 @@ _inherits(EdgeFastProgram, _Program);

var thickness = data.size || 1,
x1 = sourceData.x,
var x1 = sourceData.x,
y1 = sourceData.y,

@@ -82,0 +84,0 @@ x2 = targetData.x,

@@ -47,2 +47,5 @@ 'use strict';

var POINTS = 4,
ATTRIBUTES = 6;
var EdgeProgram = function (_Program) {

@@ -54,5 +57,12 @@ _inherits(EdgeProgram, _Program);

// Initializing buffers
// Binding context
var _this = _possibleConstructorReturn(this, (EdgeProgram.__proto__ || Object.getPrototypeOf(EdgeProgram)).call(this, gl, _edgeVert2.default, _edgeFrag2.default));
_this.gl = gl;
// Array data
_this.array = null;
_this.indicesArray = null;
// Initializing buffers
_this.buffer = gl.createBuffer();

@@ -80,6 +90,6 @@ gl.bindBuffer(gl.ARRAY_BUFFER, _this.buffer);

gl.vertexAttribPointer(_this.positionLocation, 2, gl.FLOAT, false, EdgeProgram.ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 0);
gl.vertexAttribPointer(_this.normalLocation, 2, gl.FLOAT, false, EdgeProgram.ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 8);
gl.vertexAttribPointer(_this.thicknessLocation, 1, gl.FLOAT, false, EdgeProgram.ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 16);
gl.vertexAttribPointer(_this.colorLocation, 1, gl.FLOAT, false, EdgeProgram.ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 20);
gl.vertexAttribPointer(_this.positionLocation, 2, gl.FLOAT, false, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 0);
gl.vertexAttribPointer(_this.normalLocation, 2, gl.FLOAT, false, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 8);
gl.vertexAttribPointer(_this.thicknessLocation, 1, gl.FLOAT, false, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 16);
gl.vertexAttribPointer(_this.colorLocation, 1, gl.FLOAT, false, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 20);

@@ -99,7 +109,12 @@ // Enabling the OES_element_index_uint extension

_createClass(EdgeProgram, [{
key: 'allocate',
value: function allocate(capacity) {
this.array = new Float32Array(POINTS * ATTRIBUTES * capacity);
}
}, {
key: 'process',
value: function process(array, sourceData, targetData, data, i) {
value: function process(sourceData, targetData, data, offset) {
if (sourceData.hidden || targetData.hidden || data.hidden) {
for (var l = i + EdgeProgram.POINTS * EdgeProgram.ATTRIBUTES; i < l; i++) {
for (var l = i + POINTS * ATTRIBUTES; i < l; i++) {
array[i] = 0;

@@ -131,2 +146,6 @@ }

var i = POINTS * ATTRIBUTES * offset;
var array = this.array;
// First point

@@ -162,8 +181,8 @@ array[i++] = x1;

array[i++] = thickness;
array[i++] = color;
array[i] = color;
}
}, {
key: 'computeIndices',
value: function computeIndices(array) {
var l = array.length / EdgeProgram.ATTRIBUTES;
value: function computeIndices() {
var l = this.array.length / ATTRIBUTES;

@@ -174,26 +193,29 @@ var size = l + l / 2;

for (var i = 0, c = 0; i < size; i += 4) {
indices[c++] = i;
indices[c++] = i + 1;
indices[c++] = i + 2;
indices[c++] = i + 2;
indices[c++] = i + 1;
indices[c++] = i + 3;
for (var _i = 0, c = 0; _i < size; _i += 4) {
indices[c++] = _i;
indices[c++] = _i + 1;
indices[c++] = _i + 2;
indices[c++] = _i + 2;
indices[c++] = _i + 1;
indices[c++] = _i + 3;
}
return indices;
this.indicesArray = indices;
}
}, {
key: 'bufferData',
value: function bufferData(gl, array, indicesArray) {
value: function bufferData() {
var gl = this.gl;
// Vertices data
gl.bufferData(gl.ARRAY_BUFFER, array, gl.DYNAMIC_DRAW);
gl.bufferData(gl.ARRAY_BUFFER, this.array, gl.DYNAMIC_DRAW);
// Indices data
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indicesArray, gl.STATIC_DRAW);
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this.indicesArray, gl.STATIC_DRAW);
}
}, {
key: 'render',
value: function render(gl, array, params) {
value: function render(params) {
var gl = this.gl;
var program = this.program;

@@ -211,3 +233,3 @@ gl.useProgram(program);

// Drawing:
gl.drawElements(gl.TRIANGLES, params.indices.length, this.indicesType, 0);
gl.drawElements(gl.TRIANGLES, this.indicesArray.length, this.indicesType, 0);
}

@@ -219,6 +241,2 @@ }]);

exports.default = EdgeProgram;
EdgeProgram.POINTS = 4;
EdgeProgram.ATTRIBUTES = 6;
exports.default = EdgeProgram;

@@ -39,2 +39,5 @@ 'use strict';

var POINTS = 1,
ATTRIBUTES = 4;
var NodeProgramFast = function (_Program) {

@@ -46,5 +49,11 @@ _inherits(NodeProgramFast, _Program);

// Initializing buffers
// Binding context
var _this = _possibleConstructorReturn(this, (NodeProgramFast.__proto__ || Object.getPrototypeOf(NodeProgramFast)).call(this, gl, _nodeFastVert2.default, _nodeFastFrag2.default));
_this.gl = gl;
// Array data
_this.array = null;
// Initializing buffers
_this.buffer = gl.createBuffer();

@@ -69,5 +78,5 @@ gl.bindBuffer(gl.ARRAY_BUFFER, _this.buffer);

gl.vertexAttribPointer(_this.positionLocation, 2, gl.FLOAT, false, NodeProgramFast.ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 0);
gl.vertexAttribPointer(_this.sizeLocation, 1, gl.FLOAT, false, NodeProgramFast.ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 8);
gl.vertexAttribPointer(_this.colorLocation, 1, gl.FLOAT, false, NodeProgramFast.ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 12);
gl.vertexAttribPointer(_this.positionLocation, 2, gl.FLOAT, false, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 0);
gl.vertexAttribPointer(_this.sizeLocation, 1, gl.FLOAT, false, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 8);
gl.vertexAttribPointer(_this.colorLocation, 1, gl.FLOAT, false, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 12);
return _this;

@@ -77,19 +86,32 @@ }

_createClass(NodeProgramFast, [{
key: 'allocate',
value: function allocate(capacity) {
this.array = new Float32Array(POINTS * ATTRIBUTES * capacity);
}
}, {
key: 'process',
value: function process(array, data, i) {
value: function process(data, offset) {
var color = (0, _utils.floatColor)(data.color);
var i = offset * POINTS * ATTRIBUTES;
var array = this.array;
array[i++] = data.x;
array[i++] = data.y;
array[i++] = data.size;
array[i++] = color;
array[i] = color;
}
}, {
key: 'bufferData',
value: function bufferData(gl, array) {
gl.bufferData(gl.ARRAY_BUFFER, array, gl.DYNAMIC_DRAW);
value: function bufferData() {
var gl = this.gl;
gl.bufferData(gl.ARRAY_BUFFER, this.array, gl.DYNAMIC_DRAW);
}
}, {
key: 'render',
value: function render(gl, array, params) {
value: function render(params) {
var gl = this.gl;
var program = this.program;

@@ -103,3 +125,3 @@ gl.useProgram(program);

gl.drawArrays(gl.POINTS, 0, array.length / NodeProgramFast.ATTRIBUTES);
gl.drawArrays(gl.POINTS, 0, this.array.length / ATTRIBUTES);
}

@@ -111,6 +133,2 @@ }]);

exports.default = NodeProgramFast;
NodeProgramFast.POINTS = 1;
NodeProgramFast.ATTRIBUTES = 4;
exports.default = NodeProgramFast;

@@ -44,2 +44,5 @@ 'use strict';

var POINTS = 3,
ATTRIBUTES = 5;
var NodeProgram = function (_Program) {

@@ -51,5 +54,11 @@ _inherits(NodeProgram, _Program);

// Initializing buffers
// Binding context
var _this = _possibleConstructorReturn(this, (NodeProgram.__proto__ || Object.getPrototypeOf(NodeProgram)).call(this, gl, _nodeVert2.default, _nodeFrag2.default));
_this.gl = gl;
// Array data
_this.array = null;
// Initializing buffers
_this.buffer = gl.createBuffer();

@@ -74,9 +83,9 @@ gl.bindBuffer(gl.ARRAY_BUFFER, _this.buffer);

gl.vertexAttribPointer(_this.positionLocation, 2, gl.FLOAT, false, NodeProgram.ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 0);
gl.vertexAttribPointer(_this.positionLocation, 2, gl.FLOAT, false, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 0);
gl.vertexAttribPointer(_this.sizeLocation, 1, gl.FLOAT, false, NodeProgram.ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 8);
gl.vertexAttribPointer(_this.sizeLocation, 1, gl.FLOAT, false, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 8);
gl.vertexAttribPointer(_this.colorLocation, 1, gl.FLOAT, false, NodeProgram.ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 12);
gl.vertexAttribPointer(_this.colorLocation, 1, gl.FLOAT, false, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 12);
gl.vertexAttribPointer(_this.angleLocation, 1, gl.FLOAT, false, NodeProgram.ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 16);
gl.vertexAttribPointer(_this.angleLocation, 1, gl.FLOAT, false, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 16);
return _this;

@@ -86,6 +95,15 @@ }

_createClass(NodeProgram, [{
key: 'allocate',
value: function allocate(capacity) {
this.array = new Float32Array(POINTS * ATTRIBUTES * capacity);
}
}, {
key: 'process',
value: function process(array, data, i) {
value: function process(data, offset) {
var color = (0, _utils.floatColor)(data.color);
var i = offset * POINTS * ATTRIBUTES;
var array = this.array;
array[i++] = data.x;

@@ -107,12 +125,20 @@ array[i++] = data.y;

array[i++] = color;
array[i++] = ANGLE_3;
array[i] = ANGLE_3;
}
}, {
key: 'bufferData',
value: function bufferData() {
var gl = this.gl;
gl.bufferData(gl.ARRAY_BUFFER, this.array, gl.DYNAMIC_DRAW);
}
}, {
key: 'render',
value: function render(gl, array, params) {
value: function render(params) {
var gl = this.gl;
var program = this.program;
gl.useProgram(program);
gl.bufferData(gl.ARRAY_BUFFER, array, gl.DYNAMIC_DRAW);
gl.uniform2f(this.resolutionLocation, params.width, params.height);

@@ -123,3 +149,3 @@ gl.uniform1f(this.ratioLocation, 1 / Math.pow(params.ratio, params.nodesPowRatio));

gl.drawArrays(gl.TRIANGLES, 0, array.length / NodeProgram.ATTRIBUTES);
gl.drawArrays(gl.TRIANGLES, 0, this.array.length / ATTRIBUTES);
}

@@ -131,6 +157,2 @@ }]);

exports.default = NodeProgram;
NodeProgram.POINTS = 3;
NodeProgram.ATTRIBUTES = 5;
exports.default = NodeProgram;

@@ -145,2 +145,4 @@ 'use strict';

var size = data.size || 1;
if (data.x > maxX) maxX = data.x;

@@ -152,4 +154,2 @@ if (data.y > maxY) maxY = data.y;

var size = data.size || 1;
if (size > maxNodeSize) maxNodeSize = size;

@@ -156,0 +156,0 @@ }

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc