Comparing version 2.0.0-alpha14 to 2.0.0-alpha15
@@ -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()}("undefined"!=typeof self?self: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.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=11)}([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,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(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),l=r.slice(),i=l.length,h=0;h<i;h++)l[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(0),h=r(12),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},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=.5,r.y=.5,r.angle=0,r.ratio=1,r.width=e.width||0,r.height=e.height||0,r.nextFrame=null,r.previousState=r.getState(),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:"getPreviousState",value:function(){var e=this.previousState;return{x:e.x,y:e.y,angle:e.angle,ratio:e.ratio}}},{key:"getDimensions",value:function(){return{width:this.width,height:this.height}}},{key:"isAnimated",value:function(){return!!this.nextFrame}},{key:"graphToViewport",value:function(e,t,r){var n=Math.min(e.width,e.height),i=n/e.width,o=n/e.height;return{x:(t-this.x+this.ratio/2/i)*(n/this.ratio),y:(this.y-r+this.ratio/2/o)*(n/this.ratio)}}},{key:"viewportToGraph",value:function(e,t,r){var n=Math.min(e.width,e.height),i=n/e.width,o=n/e.height;return{x:this.ratio/n*t+this.x-this.ratio/2/i,y:-(this.ratio/n*r-this.y-this.ratio/2/o)}}},{key:"viewRectangle",value:function(e){var t=0*this.width/8,r=0*this.height/8,n=this.viewportToGraph(e,0-t,0-r),i=this.viewportToGraph(e,this.width+t,0-r),o=this.viewportToGraph(e,0,this.height+r);return{x1:n.x,y1:n.y,x2:i.x,y2:i.y,height:i.y-o.y}}},{key:"setState",value:function(e){return this.enabled?(this.previousState=this.getState(),"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,u.assign)({},c,t);var i="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 n.nextFrame=null,n.setState(e),void("function"==typeof r&&r());var l=i(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),n.setState(u),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){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(l);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,l=(0,a.identity)(),u=Math.min(s,h),c=(0,a.translate)((0,a.identity)(),-i,-o),d=(0,a.scale)((0,a.identity)(),1/n),f=(0,a.rotate)((0,a.identity)(),-r),v=(0,a.scale)((0,a.identity)(),u/s*2,u/h*2);return(0,a.multiply)(l,v),(0,a.multiply)(l,f),(0,a.multiply)(l,d),(0,a.multiply)(l,c),l}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(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 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(0),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){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,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,l=e<a;return h?l?w:_:l?x:E}function h(e,t){for(var r=[0,0];r.length;){var n=r.pop(),i=r.pop(),o=4*i+v,a=4*i+2*v,s=4*i+3*v,h=4*i+4*v,l=t[i+g],u=t[i+m],c=t[i+y],d=t[i+b],f=c/2,p=d/2;t[o+g]=l,t[o+m]=u,t[o+y]=f,t[o+b]=p,t[a+g]=l+f,t[a+m]=u,t[a+y]=f,t[a+b]=p,t[s+g]=l,t[s+m]=u+p,t[s+y]=f,t[s+b]=p,t[h+g]=l+f,t[h+m]=u+p,t[h+y]=f,t[h+b]=p,n<e-1&&(r.push(h,n+1),r.push(s,n+1),r.push(a,n+1),r.push(o,n+1))}}function l(e,t,r,n,i,a,s){for(var h=i-s,l=a-s,u=2*s,c=0,d=0;;){if(c>=e)return r[d]=r[d]||[],void r[d].push(n);var f=4*d+v,p=4*d+2*v,w=4*d+3*v,_=4*d+4*v,x=o(h,l,u,t[f+g],t[f+m],t[f+y],t[f+b]),E=o(h,l,u,t[p+g],t[p+m],t[p+y],t[p+b]),A=o(h,l,u,t[w+g],t[w+m],t[w+y],t[w+b]),L=o(h,l,u,t[_+g],t[_+m],t[_+y],t[_+b]),O=x+E+A+L;if(0===O)throw new Error("sigma/quadtree.insertNode: no collision (level: "+c+", key: "+n+", x: "+i+", y: "+a+", size: "+s+").");if(3===O)throw new Error("sigma/quadtree.insertNode: 3 impossible collisions (level: "+c+", key: "+n+", x: "+i+", y: "+a+", size: "+s+").");if(O>1)return r[d]=r[d]||[],void r[d].push(n);c++,x&&(d=f),E&&(d=p),A&&(d=w),L&&(d=_)}}function u(e,t,r,n,i,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&&(0,f.default)(l,u),!(c>=e)){var p=4*d+v,w=4*d+2*v,_=4*d+3*v,x=4*d+4*v,E=a(n,i,o,s,t[p+g],t[p+m],t[p+y],t[p+b]),A=a(n,i,o,s,t[w+g],t[w+m],t[w+y],t[w+b]),L=a(n,i,o,s,t[_+g],t[_+m],t[_+y],t[_+b]),O=a(n,i,o,s,t[x+g],t[x+m],t[x+y],t[x+b]);E&&h.push(p,c+1),A&&h.push(w,c+1),L&&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 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=r(13),f=function(e){return e&&e.__esModule?e:{default:e}}(d),v=4,p=5,g=0,m=1,y=2,b=3,w=1,_=2,x=3,E=4,A=function(){function e(t){n(this,e),t=t||{};var r=Math.pow(4,p);this.data=new Float32Array(v*((4*r-1)/3)),this.containers={},this.cache=null,this.lastRectangle=null,t.boundaries?this.resize(t.boundaries):this.resize({x:0,y:0,width:1,height:1}),"function"==typeof t.filter&&(this.nodeFilter=t.filter)}return c(e,[{key:"add",value:function(e,t,r,n){return l(p,this.data,this.containers,e,t,r,n),this}},{key:"resize",value:function(e){this.clear(),this.data[g]=e.x,this.data[m]=e.y,this.data[y]=e.width,this.data[b]=e.height,h(p,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+g],this.data[n+m],this.data[n+y],this.data[n+b])*v,i++}while(i<=p);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=u(p,this.data,this.containers,e,t,Math.abs(e-r)||Math.abs(t-n),o);return this.cache=s,this.cache}}]),e}();t.default=A},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(1),l=n(h),u=r(14),c=n(u),d=r(15),f=function(e){function t(e,r){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return n.container=e,n.camera=r,n.enabled=!0,n.hasDragged=!1,n.downStartTime=null,n.lastMouseX=null,n.lastMouseY=null,n.isMouseDown=!1,n.isMoving=!1,n.movingTimeout=null,n.startCameraState=null,n.lastCameraState=null,n.clicks=0,n.doubleClickTimeout=null,n.wheelLock=!1,n.handleClick=n.handleClick.bind(n),n.handleDown=n.handleDown.bind(n),n.handleUp=n.handleUp.bind(n),n.handleMove=n.handleMove.bind(n),n.handleWheel=n.handleWheel.bind(n),n.handleOut=n.handleOut.bind(n),e.addEventListener("click",n.handleClick,!1),e.addEventListener("mousedown",n.handleDown,!1),e.addEventListener("mousemove",n.handleMove,!1),e.addEventListener("DOMMouseScroll",n.handleWheel,!1),e.addEventListener("mousewheel",n.handleWheel,!1),e.addEventListener("mouseout",n.handleOut,!1),document.addEventListener("mouseup",n.handleUp,!1),n}return a(t,e),s(t,[{key:"kill",value:function(){var e=this.container;e.removeEventListener("click",this.handleClick),e.removeEventListener("mousedown",this.handleDown),e.removeEventListener("mousemove",this.handleMove),e.removeEventListener("DOMMouseScroll",this.handleWheel),e.removeEventListener("mousewheel",this.handleWheel),e.removeEventListener("mouseout",this.handleOut),document.removeEventListener("mouseup",this.handleUp)}},{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,d.getMouseCoords)(e))}}},{key:"handleDoubleClick",value:function(e){if(this.enabled){var t=(0,d.getCenter)(e),r=this.camera.getState(),n=r.ratio/2.2,i={width:this.container.offsetWidth,height:this.container.offsetHeight},o=(0,d.getX)(e),a=(0,d.getY)(e),s=new l.default;s.ratio=n,s.x=r.x,s.y=r.y;var h=this.camera.viewportToGraph(i,o,a),u=this.camera.viewportToGraph(i,t.x,t.y),c=s.viewportToGraph(i,o,a),f=s.viewportToGraph(i,t.x,t.y),v=c.x-f.x-h.x+u.x,p=c.y-f.y-h.y+u.y;return this.camera.animate({x:r.x-v,y:r.y-p,ratio:n},{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.lastMouseX=(0,d.getX)(e),this.lastMouseY=(0,d.getY)(e),this.hasDragged=!1,this.downStartTime=Date.now(),e.which,this.isMouseDown=!0,this.emit("mousedown",(0,d.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,d.getX)(e),r=(0,d.getY)(e),n=this.camera.getState(),i=this.camera.getPreviousState();this.isMoving?this.camera.animate({x:n.x+3*(n.x-i.x),y:n.y+3*(n.y-i.y)},{duration:200,easing:"quadraticOut"}):this.lastMouseX===t&&this.lastMouseY===r||this.camera.setState({x:n.x,y:n.y}),this.isMoving=!1,this.hasDragged=!1,this.emit("mouseup",(0,d.getMouseCoords)(e))}}},{key:"handleMove",value:function(e){var t=this;if(this.enabled){if(this.emit("mousemove",(0,d.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={width:this.container.offsetWidth,height:this.container.offsetHeight},n=(0,d.getX)(e),i=(0,d.getY)(e),o=this.camera.viewportToGraph(r,this.lastMouseX,this.lastMouseY),a=this.camera.viewportToGraph(r,n,i),s=o.x-a.x,h=o.y-a.y,l=this.camera.getState(),u=l.x+s,c=l.y+h;this.camera.setState({x:u,y:c}),this.lastMouseX=n,this.lastMouseY=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,d.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,d.getCenter)(e),s={width:this.container.offsetWidth,height:this.container.offsetHeight},h=(0,d.getX)(e),u=(0,d.getY)(e),c=new l.default;c.ratio=o,c.x=i.x,c.y=i.y;var f=this.camera.viewportToGraph(s,h,u),v=this.camera.viewportToGraph(s,a.x,a.y),p=c.viewportToGraph(s,h,u),g=c.viewportToGraph(s,a.x,a.y),m=p.x-g.x-f.x+v.x,y=p.y-g.y-f.y+v.y;return this.camera.animate({x:i.x-m,y:i.y-y,ratio:o},{easing:"linear",duration:200},function(){return t.wheelLock=!1}),!1}},{key:"handleOut",value:function(){}}]),t}(c.default);t.default=f},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){var t=a(e.x,2),r=t[0],n=t[1],i=a(e.y,2),o=i[0],s=i[1],h=Math.max(n-r,s-o),l=(n+r)/2,u=(s+o)/2,c=function(e){return{x:.5+(e.x-l)/h,y:.5+(e.y-u)/h}};return c.inverse=function(e){return{x:l+h*(e.x-.5),y:u+h*(e.y-.5)}},c.ratio=h,c}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&s.return&&s.return()}finally{if(i)throw o}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.createElement=n,t.getPixelRatio=i,t.createNormalizationFunction=o},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";function n(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e){return function(){function t(r){i(this,t),this.programs=e.map(function(e){return new e(r)})}return a(t,[{key:"allocate",value:function(e){this.programs.forEach(function(t){return t.allocate(e)})}},{key:"process",value:function(){var e=arguments;this.programs.forEach(function(t){return t.process.apply(t,n(e))})}},{key:"computeIndices",value:function(){this.programs.forEach(function(e){"function"==typeof e.computeIndices&&e.computeIndices()})}},{key:"bufferData",value:function(){this.programs.forEach(function(e){return e.bufferData()})}},{key:"render",value:function(){var e=arguments;this.programs.forEach(function(t){t.bind(),t.bufferData(),t.render.apply(t,n(e))})}}]),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}}();t.createCompoundProgram=o;var s=r(19),h=function(){function e(t,r,n){i(this,e),this.vertexShaderSource=r,this.fragmentShaderSource=n,this.load(t)}return a(e,[{key:"load",value:function(e){return this.vertexShader=(0,s.loadVertexShader)(e,this.vertexShaderSource),this.fragmentShader=(0,s.loadFragmentShader)(e,this.fragmentShaderSource),this.program=(0,s.loadProgram)(e,[this.vertexShader,this.fragmentShader]),this.program}}]),e}();t.default=h},function(e,t,r){"use strict";function n(e,t,r){var n=r.labelSize,i=r.labelFont,o=r.labelWeight;e.fillStyle="#000",e.font=o+" "+n+"px "+i,e.fillText(t.label,t.x+t.size+3,t.y+n/3)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.WebGLRenderer=t.MouseCaptor=t.QuadTree=t.Camera=t.Renderer=void 0;var i=r(3),o=n(i),a=r(1),s=n(a),h=r(5),l=n(h),u=r(6),c=n(u),d=r(16),f=n(d);t.Renderer=o.default,t.Camera=s.default,t.QuadTree=l.default,t.MouseCaptor=c.default,t.WebGLRenderer=f.default},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){e.exports=function(e,t){var r=e.length,n=t.length;if(0!==n){e.length+=t.length;for(var i=0;i<n;i++)e[r+i]=t[i]}}},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(0),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,u.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 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=n,t.getY=i,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 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(17),l=r(8),u=n(l),c=r(3),d=n(c),f=r(1),v=n(f),p=r(6),g=n(p),m=r(5),y=n(m),b=r(18),w=n(b),_=r(23),x=n(_),E=r(10),A=n(E),L=r(26),O=n(L),P=r(4),T=r(7),M=r(2),k=r(28),S=r(29),C=(0,T.getPixelRatio)(),R=(0,T.getPixelRatio)(),D={hideEdgesOnMove:!1,hideLabelsOnMove:!1,renderLabels:!0,zIndex:!1,labelFont:"Arial",labelSize:14,labelWeight:"normal"},N=function(e){function t(e,r,n){i(this,t);var a=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));if(n=n||{},a.settings=(0,P.assign)({},D,n),!(0,u.default)(e))throw new Error("sigma/renderers/webgl: invalid graph instance.");if(!(r instanceof HTMLElement))throw new Error("sigma/renderers/webgl: container should be an html element.");a.graph=e,a.captors={},a.container=r,a.elements={},a.contexts={},a.listeners={},a.quadtree=new y.default,a.nodeOrder={},a.nodeDataCache={},a.edgeOrder={},a.nodeExtent=null,a.edgeExtent=null,a.normalizationFunction=null,a.width=0,a.height=0,a.highlightedNodes=new Set,a.previousVisibleNodes=new Set,a.displayedLabels=new Set,a.hoveredNode=null,a.wasRenderedInThisFrame=!1,a.renderFrame=null,a.renderHighlightedNodesFrame=null,a.needToProcess=!1,a.needToSoftProcess=!1,a.createContext("edges"),a.createContext("nodes"),a.createContext("labels",!1),a.createContext("hovers",!1),a.createContext("mouse",!1);var s=a.contexts.nodes;return s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA),s.enable(s.BLEND),s=a.contexts.edges,s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA),s.enable(s.BLEND),a.nodePrograms={def:new w.default(a.contexts.nodes)},a.edgePrograms={def:new x.default(a.contexts.edges)},a.resize(),a.camera=new v.default({width:a.width,height:a.height}),a.bindCameraHandlers(),a.captors={mouse:new g.default(a.elements.mouse,a.camera)},a.bindEventHandlers(),a.bindGraphHandlers(),a.process(),a.render(),a}return a(t,e),s(t,[{key:"createContext",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=(0,T.createElement)("canvas",{class:"sigma-"+e,style:{position:"absolute"}});this.elements[e]=r,this.container.appendChild(r);var n={preserveDrawingBuffer:!1,antialias:!1},i=void 0;return t?(i=r.getContext("webgl",n),i||(i=r.getContext("webgl",n)),i||(i=r.getContext("experimental-webgl",n))):i=r.getContext("2d",n),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.viewportToGraph(e,t,r);return e.quadtree.point(n.x,1-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=1/0,s=null,h=0,l=o.length;h<l;h++){var u=o[h],c=e.nodeDataCache[u],d=e.camera.graphToViewport(e,c.x,c.y),f=c.size/i;if(t(n.x,n.y,d.x,d.y,f)){var v=Math.sqrt(Math.pow(n.x-d.x,2)+Math.pow(n.y-d.y,2));v<a&&(a=v,s=u)}}if(s)return e.hoveredNode=s,e.emit("overNode",{node:s}),e.scheduleHighlightedNodesRender();if(e.hoveredNode){var p=e.nodeDataCache[e.hoveredNode],g=e.camera.graphToViewport(e,p.x,p.y),m=p.size/i;if(!t(n.x,n.y,g.x,g.y,m))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],l=e.nodeDataCache[h],u=e.camera.graphToViewport(e,l.x,l.y),c=l.size/i;if(t(n.x,n.y,u.x,u.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],l=e.nodeDataCache[h],u=e.camera.graphToViewport(e,l.x,l.y),c=l.size/i;if(t(n.x,n.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.graph;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.graph;this.quadtree.clear();var r=["x","y"];this.settings.zIndex&&(r.push("z"),this.edgeExtent=(0,h.edgeExtent)(t,["z"])),this.nodeExtent=(0,h.nodeExtent)(t,r),this.normalizationFunction=(0,T.createNormalizationFunction)(this.nodeExtent);var n=this.nodePrograms.def;e||(n.allocate(t.order),this.nodeOrder={});var i=t.nodes();this.settings.zIndex&&(i=(0,S.zIndexOrdering)(this.edgeExtent.z,function(e){return t.getNodeAttribute(e,"z")},i));for(var o=0,a=i.length;o<a;o++){var s=i[o];this.nodeOrder[s]=o;var l=t.getNodeAttributes(s),u=this.normalizationFunction(l),c=(0,P.assign)({},l,u);this.quadtree.add(s,c.x,1-c.y,c.size/this.width),this.nodeDataCache[s]=c,n.process(c,o)}n.bufferData();var d=this.edgePrograms.def;e||(d.allocate(t.size),this.edgeOrder={});var f=t.edges();this.settings.zIndex&&(f=(0,S.zIndexOrdering)(this.edgeExtent.z,function(e){return t.getEdgeAttribute(e,"z")},f));for(var v=0,p=f.length;v<p;v++){var g=f[v];this.edgeOrder[g]=v;var m=t.getEdgeAttributes(g),y=t.extremities(g),b=this.nodeDataCache[y[0]],w=this.nodeDataCache[y[1]];d.process(b,w,m,v)}return e||"function"!=typeof d.computeIndices||d.computeIndices(),d.bufferData(),this}},{key:"processNode",value:function(e){var t=this.nodePrograms.def,r=this.graph.getNodeAttributes(e);return t.process(r,this.nodeOrder[e]),this}},{key:"processEdge",value:function(e){var t=this.graph,r=this.edgePrograms.def,n=t.getEdgeAttributes(e),i=t.extremities(e),o=t.getNodeAttributes(i[0]),a=t.getNodeAttributes(i[1]);return r.process(o,a,n,this.edgeOrder[e]),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*C+"px"),this.elements[a].setAttribute("height",this.height*C+"px"),1!==C&&s.scale(C,C)):(this.elements[a].setAttribute("width",this.width*R+"px"),this.elements[a].setAttribute("height",this.height*R+"px")),s.viewport&&s.viewport(0,0,this.width*R,this.height*R)}return this}},{key:"clear",value:function(){return this.contexts.labels.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,M.matrixFromCamera)(t,{width:this.width,height:this.height}),n=void 0;if(n=this.nodePrograms.def,n.render({matrix:r,width:this.width,height:this.height,ratio:t.ratio,nodesPowRatio:.5,scalingRatio:R}),this.settings.hideEdgesOnMove&&e||(n=this.edgePrograms.def,n.render({matrix:r,width:this.width,height:this.height,ratio:t.ratio,nodesPowRatio:.5,edgesPowRatio:.5,scalingRatio:R})),this.settings.hideLabelsOnMove&&e)return this;var i=void 0;if(t.ratio>=1)i=this.graph.nodes();else{var o=this.camera.viewRectangle(this);i=this.quadtree.rectangle(o.x1,1-o.y1,o.x2,1-o.y2,o.height)}if(!this.settings.renderLabels)return this;for(var a=(0,k.labelsToDisplayFromGrid)({cache:this.nodeDataCache,camera:this.camera,displayedLabels:this.displayedLabels,previousVisibleNodes:this.previousVisibleNodes,visibleNodes:i}),s=this.contexts.labels,h=Math.pow(t.ratio,.5),l=0,u=a.length;l<u;l++){var c=this.nodeDataCache[a[l]],d=this.camera.graphToViewport(this,c.x,c.y),f=d.x,v=d.y,p=c.size/h;(0,A.default)(s,{label:c.label,size:p,x:f,y:v},this.settings)}return this.previousVisibleNodes=new Set(i),this.displayedLabels=new Set(a),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.graphToViewport(e,o.x,o.y),s=a.x,h=a.y,l=o.size/r;(0,O.default)(n,{label:o.label,color:o.color,size:l,x:s,y:h},e.settings)};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}},{key:"kill",value:function(){var e=this.graph;this.camera.removeListener("updated",this.listeners.camera),window.removeEventListener("resize",this.listeners.handleResize),this.captors.mouse.kill(),e.removeListener("nodeAdded",this.listeners.graphUpdate),e.removeListener("nodeDropped",this.listeners.graphUpdate),e.removeListener("nodeAttributesUpdated",this.listeners.softGraphUpdate),e.removeListener("edgeAdded",this.listeners.graphUpdate),e.removeListener("nodeDropped",this.listeners.graphUpdate),e.removeListener("edgeAttributesUpdated",this.listeners.softGraphUpdate),e.removeListener("cleared",this.listeners.graphUpdate),this.quadtree=null,this.nodeOrder=null,this.nodeDataCache=null,this.edgeOrder=null,this.highlightedNodes=null,this.previousVisibleNodes=null,this.displayedLabels=null;for(var t=this.container;t.firstChild;)t.removeChild(t.firstChild)}}]),t}(d.default);t.default=N},function(e,t,r){function n(e,t){if(!o(e))throw new Error("graphology-metrics/extent: the given graph is not a valid graphology instance.");var r,n,i,a,s,h,l,u=[].concat(t),c=e.nodes(),d={};for(s=0;s<u.length;s++)a=u[s],d[a]=[1/0,-1/0];for(h=0,l=c.length;h<l;h++)for(r=c[h],n=e.getNodeAttributes(r),s=0;s<u.length;s++)a=u[s],i=n[a],i<d[a][0]&&(d[a][0]=i),i>d[a][1]&&(d[a][1]=i);return"string"==typeof t?d[t]:d}function i(e,t){if(!o(e))throw new Error("graphology-metrics/extent: the given graph is not a valid graphology instance.");var r,n,i,a,s,h,l,u=[].concat(t),c=e.edges(),d={};for(s=0;s<u.length;s++)a=u[s],d[a]=[1/0,-1/0];for(h=0,l=c.length;h<l;h++)for(r=c[h],n=e.getEdgeAttributes(r),s=0;s<u.length;s++)a=u[s],i=n[a],i<d[a][0]&&(d[a][0]=i),i>d[a][1]&&(d[a][1]=i);return"string"==typeof t?d[t]:d}var o=r(8),a=n;a.nodeExtent=n,a.edgeExtent=i,e.exports=a},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(9),l=n(h),u=r(2),c=r(21),d=n(c),f=r(22),v=n(f),p=4,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.gl=e,r.array=null,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,p*Float32Array.BYTES_PER_ELEMENT,0),e.vertexAttribPointer(r.sizeLocation,1,e.FLOAT,!1,p*Float32Array.BYTES_PER_ELEMENT,8),e.vertexAttribPointer(r.colorLocation,1,e.FLOAT,!1,p*Float32Array.BYTES_PER_ELEMENT,12),r}return a(t,e),s(t,[{key:"allocate",value:function(e){this.array=new Float32Array(1*p*e)}},{key:"process",value:function(e,t){var r=(0,u.floatColor)(e.color),n=1*t*p,i=this.array;if(e.hidden)return i[n++]=0,i[n++]=0,i[n++]=0,void(i[n++]=0);i[n++]=e.x,i[n++]=e.y,i[n++]=e.size,i[n]=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/p)}}]),t}(l.default);t.default=g},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,r){"use strict";function n(){return Float32Array.of(1,0,0,0,1,0,0,0,1)}function i(e,t,r){return e[0]=t,e[4]=arguments.length>2?r: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],l=e[7],u=e[8],c=t[0],d=t[1],f=t[2],v=t[3],p=t[4],g=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*l,e[2]=c*i+d*s+f*u,e[3]=v*r+p*o+g*h,e[4]=v*n+p*a+g*l,e[5]=v*i+p*s+g*u,e[6]=m*r+y*o+b*h,e[7]=m*n+y*a+b*l,e[8]=m*i+y*s+b*u,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){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 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 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(9),l=n(h),u=r(2),c=r(24),d=n(c),f=r(25),v=n(f),p=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.gl=e,r.array=null,r.indicesArray=null,r.buffer=e.createBuffer(),r.indicesBuffer=e.createBuffer(),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"),r.bind();var n="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext,a=n||e.getExtension("OES_element_index_uint");return r.canUse32BitsIndices=!!a,r.IndicesArray=r.canUse32BitsIndices?Uint32Array:Uint16Array,r.indicesType=r.canUse32BitsIndices?e.UNSIGNED_INT:e.UNSIGNED_SHORT,r}return a(t,e),s(t,[{key:"bind",value:function(){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,this.buffer),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indicesBuffer),e.enableVertexAttribArray(this.positionLocation),e.enableVertexAttribArray(this.normalLocation),e.enableVertexAttribArray(this.thicknessLocation),e.enableVertexAttribArray(this.colorLocation),e.vertexAttribPointer(this.positionLocation,2,e.FLOAT,!1,6*Float32Array.BYTES_PER_ELEMENT,0),e.vertexAttribPointer(this.normalLocation,2,e.FLOAT,!1,6*Float32Array.BYTES_PER_ELEMENT,8),e.vertexAttribPointer(this.thicknessLocation,1,e.FLOAT,!1,6*Float32Array.BYTES_PER_ELEMENT,16),e.vertexAttribPointer(this.colorLocation,1,e.FLOAT,!1,6*Float32Array.BYTES_PER_ELEMENT,20)}},{key:"allocate",value:function(e){this.array=new Float32Array(24*e)}},{key:"process",value:function(e,t,r,n){if(e.hidden||t.hidden||r.hidden)for(var i=24*n,o=i+24;i<o;i++)this.array[i]=0;else{var a=r.size||1,s=e.x,h=e.y,l=t.x,c=t.y,d=(0,u.floatColor)(r.color),f=l-s,v=c-h,p=f*f+v*v,g=0,m=0;p&&(p=1/Math.sqrt(p),g=-v*p,m=f*p);var y=24*n,b=this.array;b[y++]=s,b[y++]=h,b[y++]=g,b[y++]=m,b[y++]=a,b[y++]=d,b[y++]=s,b[y++]=h,b[y++]=-g,b[y++]=-m,b[y++]=a,b[y++]=d,b[y++]=l,b[y++]=c,b[y++]=g,b[y++]=m,b[y++]=a,b[y++]=d,b[y++]=l,b[y++]=c,b[y++]=-g,b[y++]=-m,b[y++]=a,b[y]=d}}},{key:"computeIndices",value:function(){for(var e=this.array.length/6,t=e+e/2,r=new this.IndicesArray(t),n=0,i=0;n<t;n+=4)r[i++]=n,r[i++]=n+1,r[i++]=n+2,r[i++]=n+2,r[i++]=n+1,r[i++]=n+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),t.uniformMatrix3fv(this.matrixLocation,!1,e.matrix),t.uniform1f(this.scaleLocation,e.scalingRatio),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.8;\n\nvoid main() {\n\n // Computing thickness in pixels\n float pow_ratio = 1.0 / pow(u_ratio, 0.5);\n float thickness = a_thickness / 2.0 * pow_ratio / u_scale;\n\n // Adding a small feather for AA\n thickness += feather;\n\n // Computing delta relative to viewport\n vec2 delta = (a_normal * thickness) / u_resolution;\n\n vec2 position = (u_matrix * vec3(a_position, 1)).xy;\n position += delta;\n\n // Applying\n gl_Position = vec4(position, 0, 1);\n\n v_normal = a_normal;\n v_thickness = thickness;\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\nconst float feather = 0.8;\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,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t,r){var n=r.labelSize,i=r.labelFont,o=r.labelWeight;e.font=o+" "+n+"px "+i,e.beginPath(),e.fillStyle="#fff",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=8,e.shadowColor="#000";var s=e.measureText(t.label).width,l=Math.round(t.x-n/2-2),u=Math.round(t.y-n/2-2),c=Math.round(s+n/2+t.size+9),d=Math.round(n+4),f=Math.round(n/2+2);e.moveTo(l,u+f),e.moveTo(l,u+f),e.arcTo(l,u,l+f,u,f),e.lineTo(l+c,u),e.lineTo(l+c,u+d),e.lineTo(l+f,u+d),e.arcTo(l,u+d,l,u+d-f,f),e.lineTo(l,u+f),e.closePath(),e.fill(),e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=0,(0,a.default)(e,t),(0,h.default)(e,t,r)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var o=r(27),a=n(o),s=r(10),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";var n={width:200,height:150},i={width:400,height:300};t.labelsToDisplayFromGrid=function(e){var t=e.cache,r=e.camera,o=e.displayedLabels,a=e.previousVisibleNodes,s=e.visibleNodes,h=r.getState(),l=r.getPreviousState(),u=r.getDimensions(),c=h.ratio<l.ratio,d=h.x!==l.x||h.y!==l.x,f=h.ratio>l.ratio,v=!c&&!f&&h.ratio>=1;if(f&&Math.trunc(10*h.ratio)%3!=0)return Array.from(o);if(v&&0!==o.size)return Array.from(o);for(var p=h.ratio>=1.3?i:n,g=u.width%p.width,m=p.width+g/Math.floor(u.width/p.width),y=u.height%p.height,b=p.height+y/Math.floor(u.height/p.height),w={},_=new Set,x=[],E=0,A=s.length;E<A;E++){var L=s[E],O=t[L];if(!d||c||f||o.has(L)||!a.has(L)){var P=r.graphToViewport(u,O.x,O.y),T=Math.floor(P.x/m),M=Math.floor(P.y/b),k=T+";"+M;if((c||d&&!f)&&o.has(L))_.add(k),x.push(L);else if(!_.has(k))if(void 0===w[k])w[k]=L;else{var S=w[k],C=t[S];(O.size>C.size||O.size===C.size&&L>S)&&(w[k]=L)}}}for(var R in w)x.push(w[R]);return x}},function(e,t,r){"use strict";var n=function(){function e(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&s.return&&s.return()}finally{if(i)throw o}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.zIndexOrdering=function(e,t,r){var i=(r.length,n(e,2)),o=i[0],a=i[1],s=a-o;return 0===s||s===-1/0?r:r.sort(function(e,r){var n=t(e),i=t(r);return n<i?-1:n>i?1:0})}}])}); | ||
!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(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.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=11)}([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,l,h;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var u=new Error('Uncaught, unspecified "error" event. ('+t+")");throw u.context=t,u}if(r=this._events[e],a(r))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),r.apply(this,s)}else if(o(r))for(s=Array.prototype.slice.call(arguments,1),h=r.slice(),i=h.length,l=0;l<i;l++)h[l].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(0),l=r(12),h=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(l),u=r(4),c={easing:"quadraticInOut",duration:150},d=function(e){function t(){n(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.x=.5,e.y=.5,e.angle=0,e.ratio=1,e.nextFrame=null,e.previousState=e.getState(),e.enabled=!0,e}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:"getPreviousState",value:function(){var e=this.previousState;return{x:e.x,y:e.y,angle:e.angle,ratio:e.ratio}}},{key:"isAnimated",value:function(){return!!this.nextFrame}},{key:"graphToViewport",value:function(e,t,r){var n=Math.min(e.width,e.height),i=n/e.width,o=n/e.height;return{x:(t-this.x+this.ratio/2/i)*(n/this.ratio),y:(this.y-r+this.ratio/2/o)*(n/this.ratio)}}},{key:"viewportToGraph",value:function(e,t,r){var n=Math.min(e.width,e.height),i=n/e.width,o=n/e.height;return{x:this.ratio/n*t+this.x-this.ratio/2/i,y:-(this.ratio/n*r-this.y-this.ratio/2/o)}}},{key:"viewRectangle",value:function(e){var t=0*e.width/8,r=0*e.height/8,n=this.viewportToGraph(e,0-t,0-r),i=this.viewportToGraph(e,e.width+t,0-r),o=this.viewportToGraph(e,0,e.height+r);return{x1:n.x,y1:n.y,x2:i.x,y2:i.y,height:i.y-o.y}}},{key:"setState",value:function(e){return this.enabled?(this.previousState=this.getState(),"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:"animate",value:function(e,t,r){var n=this;if(!this.enabled)return this;t=(0,u.assign)({},c,t);var i="function"==typeof t.easing?t.easing:h[t.easing];this.nextFrame&&cancelAnimationFrame(this.nextFrame);var o=Date.now(),a=this.getState(),s=function s(){var l=(Date.now()-o)/t.duration;if(l>=1)return n.nextFrame=null,n.setState(e),void("function"==typeof r&&r());var h=i(l),u={};"x"in e&&(u.x=a.x+(e.x-a.x)*h),"y"in e&&(u.y=a.y+(e.y-a.y)*h),"angle"in e&&(u.angle=a.angle+(e.angle-a.angle)*h),"ratio"in e&&(u.ratio=a.ratio+(e.ratio-a.ratio)*h),n.setState(u),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){if(void 0!==s[e])return s[e];var t=0,r=0,n=0,i=1;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(c.test(e)){var o=e.match(d);t=+o[1],r=+o[2],n=+o[3],o[4]&&(i=+o[4])}i=255*i|0;var a=4278190079&(i<<24|n<<16|r<<8|t);h[0]=a;var l=u[0];return s[e]=l,l}function i(e,t){var r=e.angle,n=e.ratio,i=e.x,o=e.y,s=t.width,l=t.height,h=(0,a.identity)(),u=Math.min(s,l),c=(0,a.translate)((0,a.identity)(),-i,-o),d=(0,a.scale)((0,a.identity)(),1/n),f=(0,a.rotate)((0,a.identity)(),-r),v=(0,a.scale)((0,a.identity)(),u/s*2,u/l*2);return(0,a.multiply)(h,v),(0,a.multiply)(h,f),(0,a.multiply)(h,d),(0,a.multiply)(h,c),h}function o(e,t,r,n){var i=n||new Uint8Array(4);return e.readPixels(t,r,1,1,e.RGBA,e.UNSIGNED_BYTE,i),i}Object.defineProperty(t,"__esModule",{value:!0}),t.floatColor=n,t.matrixFromCamera=i,t.extractPixel=o;var a=r(21),s={},l=new Int8Array(4),h=new Int32Array(l.buffer,0,1),u=new Float32Array(l.buffer,0,1),c=/^\s*rgba?\s*\(/,d=/^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)(?:\s*,\s*(.*)?)?\)\s*$/},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(0),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){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,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,l=t<s,h=e<a;return l?h?w:_:h?x:E}function l(e,t){for(var r=[0,0];r.length;){var n=r.pop(),i=r.pop(),o=4*i+v,a=4*i+2*v,s=4*i+3*v,l=4*i+4*v,h=t[i+g],u=t[i+y],c=t[i+m],d=t[i+b],f=c/2,p=d/2;t[o+g]=h,t[o+y]=u,t[o+m]=f,t[o+b]=p,t[a+g]=h+f,t[a+y]=u,t[a+m]=f,t[a+b]=p,t[s+g]=h,t[s+y]=u+p,t[s+m]=f,t[s+b]=p,t[l+g]=h+f,t[l+y]=u+p,t[l+m]=f,t[l+b]=p,n<e-1&&(r.push(l,n+1),r.push(s,n+1),r.push(a,n+1),r.push(o,n+1))}}function h(e,t,r,n,i,a,s){for(var l=i-s,h=a-s,u=2*s,c=0,d=0;;){if(c>=e)return r[d]=r[d]||[],void r[d].push(n);var f=4*d+v,p=4*d+2*v,w=4*d+3*v,_=4*d+4*v,x=o(l,h,u,t[f+g],t[f+y],t[f+m],t[f+b]),E=o(l,h,u,t[p+g],t[p+y],t[p+m],t[p+b]),A=o(l,h,u,t[w+g],t[w+y],t[w+m],t[w+b]),L=o(l,h,u,t[_+g],t[_+y],t[_+m],t[_+b]),P=x+E+A+L;if(0===P)throw new Error("sigma/quadtree.insertNode: no collision (level: "+c+", key: "+n+", x: "+i+", y: "+a+", size: "+s+").");if(3===P)throw new Error("sigma/quadtree.insertNode: 3 impossible collisions (level: "+c+", key: "+n+", x: "+i+", y: "+a+", size: "+s+").");if(P>1)return r[d]=r[d]||[],void r[d].push(n);c++,x&&(d=f),E&&(d=p),A&&(d=w),L&&(d=_)}}function u(e,t,r,n,i,o,s){for(var l=[0,0],h=[],u=void 0;l.length;){var c=l.pop(),d=l.pop();if(u=r[d],u&&(0,f.default)(h,u),!(c>=e)){var p=4*d+v,w=4*d+2*v,_=4*d+3*v,x=4*d+4*v,E=a(n,i,o,s,t[p+g],t[p+y],t[p+m],t[p+b]),A=a(n,i,o,s,t[w+g],t[w+y],t[w+m],t[w+b]),L=a(n,i,o,s,t[_+g],t[_+y],t[_+m],t[_+b]),P=a(n,i,o,s,t[x+g],t[x+y],t[x+m],t[x+b]);E&&l.push(p,c+1),A&&l.push(w,c+1),L&&l.push(_,c+1),P&&l.push(x,c+1)}}return h}Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),d=r(13),f=function(e){return e&&e.__esModule?e:{default:e}}(d),v=4,p=5,g=0,y=1,m=2,b=3,w=1,_=2,x=3,E=4,A=function(){function e(t){n(this,e),t=t||{};var r=Math.pow(4,p);this.data=new Float32Array(v*((4*r-1)/3)),this.containers={},this.cache=null,this.lastRectangle=null,t.boundaries?this.resize(t.boundaries):this.resize({x:0,y:0,width:1,height:1}),"function"==typeof t.filter&&(this.nodeFilter=t.filter)}return c(e,[{key:"add",value:function(e,t,r,n){return h(p,this.data,this.containers,e,t,r,n),this}},{key:"resize",value:function(e){this.clear(),this.data[g]=e.x,this.data[y]=e.y,this.data[m]=e.width,this.data[b]=e.height,l(p,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+g],this.data[n+y],this.data[n+m],this.data[n+b])*v,i++}while(i<=p);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=u(p,this.data,this.containers,e,t,Math.abs(e-r)||Math.abs(t-n),o);return this.cache=s,this.cache}}]),e}();t.default=A},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}}(),l=r(1),h=n(l),u=r(14),c=n(u),d=r(15),f=function(e){function t(e,r){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return n.container=e,n.camera=r,n.enabled=!0,n.hasDragged=!1,n.downStartTime=null,n.lastMouseX=null,n.lastMouseY=null,n.isMouseDown=!1,n.isMoving=!1,n.movingTimeout=null,n.startCameraState=null,n.lastCameraState=null,n.clicks=0,n.doubleClickTimeout=null,n.wheelLock=!1,n.handleClick=n.handleClick.bind(n),n.handleDown=n.handleDown.bind(n),n.handleUp=n.handleUp.bind(n),n.handleMove=n.handleMove.bind(n),n.handleWheel=n.handleWheel.bind(n),n.handleOut=n.handleOut.bind(n),e.addEventListener("click",n.handleClick,!1),e.addEventListener("mousedown",n.handleDown,!1),e.addEventListener("mousemove",n.handleMove,!1),e.addEventListener("DOMMouseScroll",n.handleWheel,!1),e.addEventListener("mousewheel",n.handleWheel,!1),e.addEventListener("mouseout",n.handleOut,!1),document.addEventListener("mouseup",n.handleUp,!1),n}return a(t,e),s(t,[{key:"kill",value:function(){var e=this.container;e.removeEventListener("click",this.handleClick),e.removeEventListener("mousedown",this.handleDown),e.removeEventListener("mousemove",this.handleMove),e.removeEventListener("DOMMouseScroll",this.handleWheel),e.removeEventListener("mousewheel",this.handleWheel),e.removeEventListener("mouseout",this.handleOut),document.removeEventListener("mouseup",this.handleUp)}},{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,d.getMouseCoords)(e))}}},{key:"handleDoubleClick",value:function(e){if(this.enabled){var t=(0,d.getCenter)(e),r=this.camera.getState(),n=r.ratio/2.2,i={width:this.container.offsetWidth,height:this.container.offsetHeight},o=(0,d.getX)(e),a=(0,d.getY)(e),s=new h.default;s.ratio=n,s.x=r.x,s.y=r.y;var l=this.camera.viewportToGraph(i,o,a),u=this.camera.viewportToGraph(i,t.x,t.y),c=s.viewportToGraph(i,o,a),f=s.viewportToGraph(i,t.x,t.y),v=c.x-f.x-l.x+u.x,p=c.y-f.y-l.y+u.y;return this.camera.animate({x:r.x-v,y:r.y-p,ratio:n},{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.lastMouseX=(0,d.getX)(e),this.lastMouseY=(0,d.getY)(e),this.hasDragged=!1,this.downStartTime=Date.now(),e.which,this.isMouseDown=!0,this.emit("mousedown",(0,d.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,d.getX)(e),r=(0,d.getY)(e),n=this.camera.getState(),i=this.camera.getPreviousState();this.isMoving?this.camera.animate({x:n.x+3*(n.x-i.x),y:n.y+3*(n.y-i.y)},{duration:200,easing:"quadraticOut"}):this.lastMouseX===t&&this.lastMouseY===r||this.camera.setState({x:n.x,y:n.y}),this.isMoving=!1,this.hasDragged=!1,this.emit("mouseup",(0,d.getMouseCoords)(e))}}},{key:"handleMove",value:function(e){var t=this;if(this.enabled){if(this.emit("mousemove",(0,d.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={width:this.container.offsetWidth,height:this.container.offsetHeight},n=(0,d.getX)(e),i=(0,d.getY)(e),o=this.camera.viewportToGraph(r,this.lastMouseX,this.lastMouseY),a=this.camera.viewportToGraph(r,n,i),s=o.x-a.x,l=o.y-a.y,h=this.camera.getState(),u=h.x+s,c=h.y+l;this.camera.setState({x:u,y:c}),this.lastMouseX=n,this.lastMouseY=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,d.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,d.getCenter)(e),s={width:this.container.offsetWidth,height:this.container.offsetHeight},l=(0,d.getX)(e),u=(0,d.getY)(e),c=new h.default;c.ratio=o,c.x=i.x,c.y=i.y;var f=this.camera.viewportToGraph(s,l,u),v=this.camera.viewportToGraph(s,a.x,a.y),p=c.viewportToGraph(s,l,u),g=c.viewportToGraph(s,a.x,a.y),y=p.x-g.x-f.x+v.x,m=p.y-g.y-f.y+v.y;return this.camera.animate({x:i.x-y,y:i.y-m,ratio:o},{easing:"linear",duration:200},function(){return t.wheelLock=!1}),!1}},{key:"handleOut",value:function(){}}]),t}(c.default);t.default=f},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){var t=a(e.x,2),r=t[0],n=t[1],i=a(e.y,2),o=i[0],s=i[1],l=Math.max(n-r,s-o),h=(n+r)/2,u=(s+o)/2,c=function(e){return{x:.5+(e.x-h)/l,y:.5+(e.y-u)/l}};return c.applyTo=function(e){e.x=.5+(e.x-h)/l,e.y=.5+(e.y-u)/l},c.inverse=function(e){return{x:h+l*(e.x-.5),y:u+l*(e.y-.5)}},c.ratio=l,c}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&s.return&&s.return()}finally{if(i)throw o}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.createElement=n,t.getPixelRatio=i,t.createNormalizationFunction=o},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";function n(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e){return function(){function t(r){i(this,t),this.programs=e.map(function(e){return new e(r)})}return a(t,[{key:"allocate",value:function(e){this.programs.forEach(function(t){return t.allocate(e)})}},{key:"process",value:function(){var e=arguments;this.programs.forEach(function(t){return t.process.apply(t,n(e))})}},{key:"computeIndices",value:function(){this.programs.forEach(function(e){"function"==typeof e.computeIndices&&e.computeIndices()})}},{key:"bufferData",value:function(){this.programs.forEach(function(e){return e.bufferData()})}},{key:"render",value:function(){var e=arguments;this.programs.forEach(function(t){t.bind(),t.bufferData(),t.render.apply(t,n(e))})}}]),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}}();t.createCompoundProgram=o;var s=r(20),l=function(){function e(t,r,n){i(this,e),this.vertexShaderSource=r,this.fragmentShaderSource=n,this.load(t)}return a(e,[{key:"load",value:function(e){return this.vertexShader=(0,s.loadVertexShader)(e,this.vertexShaderSource),this.fragmentShader=(0,s.loadFragmentShader)(e,this.fragmentShaderSource),this.program=(0,s.loadProgram)(e,[this.vertexShader,this.fragmentShader]),this.program}}]),e}();t.default=l},function(e,t,r){"use strict";function n(e,t,r){var n=r.labelSize,i=r.labelFont,o=r.labelWeight;e.fillStyle="#000",e.font=o+" "+n+"px "+i,e.fillText(t.label,t.x+t.size+3,t.y+n/3)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.WebGLRenderer=t.MouseCaptor=t.QuadTree=t.Camera=t.Renderer=void 0;var i=r(3),o=n(i),a=r(1),s=n(a),l=r(5),h=n(l),u=r(6),c=n(u),d=r(16),f=n(d);t.Renderer=o.default,t.Camera=s.default,t.QuadTree=h.default,t.MouseCaptor=c.default,t.WebGLRenderer=f.default},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){e.exports=function(e,t){var r=e.length,n=t.length;if(0!==n){e.length+=t.length;for(var i=0;i<n;i++)e[r+i]=t[i]}}},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(0),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,u.getPixelRatio)();return{x:o(e)/(2*t),y:a(e)/(2*t)}}function l(e){return{x:n(e),y:i(e),clientX:e.clientX,clientY:e.clientY,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey,shiftKey:e.shiftKey}}function h(e){if(void 0!==e.wheelDelta)return e.wheelDelta/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=l,t.getWheelDelta=h;var u=r(7)},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}}(),l=r(17),h=r(8),u=n(h),c=r(3),d=n(c),f=r(1),v=n(f),p=r(6),g=n(p),y=r(5),m=n(y),b=r(18),w=r(19),_=n(w),x=r(24),E=n(x),A=r(10),L=n(A),P=r(27),T=n(P),M=r(4),k=r(7),S=r(2),O=r(29),C=r(30),D=(0,k.getPixelRatio)(),R=(0,k.getPixelRatio)(),N={hideEdgesOnMove:!1,hideLabelsOnMove:!1,renderLabels:!0,defaultNodeColor:"#999",defaultEdgeColor:"#ccc",labelFont:"Arial",labelSize:14,labelWeight:"normal",nodeReducer:null,edgeReducer:null,zIndex:!1},F=function(e){function t(e,r,n){i(this,t);var a=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));if(n=n||{},a.settings=(0,M.assign)({},N,n),!(0,u.default)(e))throw new Error("sigma/renderers/webgl: invalid graph instance.");if(!(r instanceof HTMLElement))throw new Error("sigma/renderers/webgl: container should be an html element.");a.graph=e,a.captors={},a.container=r,a.elements={},a.contexts={},a.listeners={},a.quadtree=new m.default,a.nodeDataCache={},a.edgeDataCache={},a.nodeExtent=null,a.edgeExtent=null,a.initializeCache(),a.normalizationFunction=null,a.width=0,a.height=0,a.highlightedNodes=new Set,a.previousVisibleNodes=new Set,a.displayedLabels=new Set,a.hoveredNode=null,a.wasRenderedInThisFrame=!1,a.renderFrame=null,a.renderHighlightedNodesFrame=null,a.needToProcess=!1,a.needToSoftProcess=!1,a.createContext("edges"),a.createContext("nodes"),a.createContext("labels",!1),a.createContext("hovers",!1),a.createContext("mouse",!1);var s=a.contexts.nodes;return s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA),s.enable(s.BLEND),s=a.contexts.edges,s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA),s.enable(s.BLEND),a.nodePrograms={def:new _.default(a.contexts.nodes)},a.edgePrograms={def:new E.default(a.contexts.edges)},a.resize(),a.camera=new v.default({width:a.width,height:a.height}),a.bindCameraHandlers(),a.captors={mouse:new g.default(a.elements.mouse,a.camera)},a.bindEventHandlers(),a.bindGraphHandlers(),a.process(),a.render(),a}return a(t,e),s(t,[{key:"createContext",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=(0,k.createElement)("canvas",{class:"sigma-"+e,style:{position:"absolute"}});this.elements[e]=r,this.container.appendChild(r);var n={preserveDrawingBuffer:!1,antialias:!1},i=void 0;return t?(i=r.getContext("webgl",n),i||(i=r.getContext("webgl",n)),i||(i=r.getContext("experimental-webgl",n))):i=r.getContext("2d",n),this.contexts[e]=i,this}},{key:"initializeCache",value:function(){for(var e=this.graph,t=e.nodes(),r=0,n=t.length;r<n;r++)this.nodeDataCache[t[r]]=new b.NodeDisplayData(r,this.settings);for(var i=e.edges(),o=0,a=i.length;o<a;o++)this.edgeDataCache[i[o]]=new b.EdgeDisplayData(o,this.settings)}},{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.viewportToGraph(e,t,r);return e.quadtree.point(n.x,1-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=1/0,s=null,l=0,h=o.length;l<h;l++){var u=o[l],c=e.nodeDataCache[u],d=e.camera.graphToViewport(e,c.x,c.y),f=c.size/i;if(t(n.x,n.y,d.x,d.y,f)){var v=Math.sqrt(Math.pow(n.x-d.x,2)+Math.pow(n.y-d.y,2));v<a&&(a=v,s=u)}}if(s)return e.hoveredNode=s,e.emit("overNode",{node:s}),e.scheduleHighlightedNodesRender();if(e.hoveredNode){var p=e.nodeDataCache[e.hoveredNode],g=e.camera.graphToViewport(e,p.x,p.y),y=p.size/i;if(!t(n.x,n.y,g.x,g.y,y))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 l=o[a],h=e.nodeDataCache[l],u=e.camera.graphToViewport(e,h.x,h.y),c=h.size/i;if(t(n.x,n.y,u.x,u.y,c))return e.emit("downNode",{node:l})}},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 l=o[a],h=e.nodeDataCache[l],u=e.camera.graphToViewport(e,h.x,h.y),c=h.size/i;if(t(n.x,n.y,u.x,u.y,c))return e.emit("clickNode",{node:l})}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.graph;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.graph,r=this.settings;this.quadtree.clear();var n=["x","y"];this.settings.zIndex&&(n.push("z"),this.edgeExtent=(0,l.edgeExtent)(t,["z"])),this.nodeExtent=(0,l.nodeExtent)(t,n),this.normalizationFunction=(0,k.createNormalizationFunction)(this.nodeExtent);var i=this.nodePrograms.def;e||i.allocate(t.order);var o=t.nodes();this.settings.zIndex&&(o=(0,C.zIndexOrdering)(this.edgeExtent.z,function(e){return t.getNodeAttribute(e,"z")},o));for(var a=0,s=o.length;a<s;a++){var h=o[a],u=t.getNodeAttributes(h),c=this.nodeDataCache[h];r.nodeReducer&&(u=r.nodeReducer(h,u)),c.assign(u),this.normalizationFunction.applyTo(c),this.quadtree.add(h,c.x,1-c.y,c.size/this.width),i.process(c,a),c.index=a}i.bufferData();var d=this.edgePrograms.def;e||d.allocate(t.size);var f=t.edges();this.settings.zIndex&&(f=(0,C.zIndexOrdering)(this.edgeExtent.z,function(e){return t.getEdgeAttribute(e,"z")},f));for(var v=0,p=f.length;v<p;v++){var g=f[v],y=t.getEdgeAttributes(g),m=this.edgeDataCache[g];r.edgeReducer&&(y=r.edgeReducer(g,y)),m.assign(y);var b=t.extremities(g),w=this.nodeDataCache[b[0]],_=this.nodeDataCache[b[1]];d.process(w,_,m,v),m.index=v}return e||"function"!=typeof d.computeIndices||d.computeIndices(),d.bufferData(),this}},{key:"processNode",value:function(e){var t=this.nodePrograms.def,r=this.graph.getNodeAttributes(e);return t.process(r,this.nodeDataCache[e].index),this}},{key:"processEdge",value:function(e){var t=this.graph,r=this.edgePrograms.def,n=t.getEdgeAttributes(e),i=t.extremities(e),o=t.getNodeAttributes(i[0]),a=t.getNodeAttributes(i[1]);return r.process(o,a,n,this.edgeDataCache[e].index),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),0===this.width)throw new Error("sigma/renderers/webgl: container as no width.");if(0===this.height)throw new Error("sigma/renderers/webgl: container as no height.");if(r===this.width&&n===this.height)return this;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*D+"px"),this.elements[a].setAttribute("height",this.height*D+"px"),1!==D&&s.scale(D,D)):(this.elements[a].setAttribute("width",this.width*R+"px"),this.elements[a].setAttribute("height",this.height*R+"px")),s.viewport&&s.viewport(0,0,this.width*R,this.height*R)}return this}},{key:"clear",value:function(){return this.contexts.labels.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,S.matrixFromCamera)(t,{width:this.width,height:this.height}),n=void 0;if(n=this.nodePrograms.def,n.render({matrix:r,width:this.width,height:this.height,ratio:t.ratio,nodesPowRatio:.5,scalingRatio:R}),this.settings.hideEdgesOnMove&&e||(n=this.edgePrograms.def,n.render({matrix:r,width:this.width,height:this.height,ratio:t.ratio,nodesPowRatio:.5,edgesPowRatio:.5,scalingRatio:R})),this.settings.hideLabelsOnMove&&e)return this;var i=void 0;if(t.ratio>=1)i=this.graph.nodes();else{var o=this.camera.viewRectangle(this);i=this.quadtree.rectangle(o.x1,1-o.y1,o.x2,1-o.y2,o.height)}if(!this.settings.renderLabels)return this;for(var a=(0,O.labelsToDisplayFromGrid)({cache:this.nodeDataCache,camera:this.camera,displayedLabels:this.displayedLabels,previousVisibleNodes:this.previousVisibleNodes,visibleNodes:i,dimensions:this}),s=this.contexts.labels,l=Math.pow(t.ratio,.5),h=0,u=a.length;h<u;h++){var c=this.nodeDataCache[a[h]],d=this.camera.graphToViewport(this,c.x,c.y),f=d.x,v=d.y,p=c.size/l;(0,L.default)(s,{label:c.label,size:p,x:f,y:v},this.settings)}return this.previousVisibleNodes=new Set(i),this.displayedLabels=new Set(a),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.graphToViewport(e,o.x,o.y),s=a.x,l=a.y,h=o.size/r;(0,T.default)(n,{label:o.label,color:o.color,size:h,x:s,y:l},e.settings)};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:"refresh",value:function(){return this.needToSoftProcess=!0,this.scheduleRender(),this}},{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}},{key:"kill",value:function(){var e=this.graph;this.camera.removeListener("updated",this.listeners.camera),window.removeEventListener("resize",this.listeners.handleResize),this.captors.mouse.kill(),e.removeListener("nodeAdded",this.listeners.graphUpdate),e.removeListener("nodeDropped",this.listeners.graphUpdate),e.removeListener("nodeAttributesUpdated",this.listeners.softGraphUpdate),e.removeListener("edgeAdded",this.listeners.graphUpdate),e.removeListener("nodeDropped",this.listeners.graphUpdate),e.removeListener("edgeAttributesUpdated",this.listeners.softGraphUpdate),e.removeListener("cleared",this.listeners.graphUpdate),this.quadtree=null,this.nodeDataCache=null,this.edgeDataCache=null,this.highlightedNodes=null,this.previousVisibleNodes=null,this.displayedLabels=null;for(var t=this.container;t.firstChild;)t.removeChild(t.firstChild)}}]),t}(d.default);t.default=F},function(e,t,r){function n(e,t){if(!o(e))throw new Error("graphology-metrics/extent: the given graph is not a valid graphology instance.");var r,n,i,a,s,l,h,u=[].concat(t),c=e.nodes(),d={};for(s=0;s<u.length;s++)a=u[s],d[a]=[1/0,-1/0];for(l=0,h=c.length;l<h;l++)for(r=c[l],n=e.getNodeAttributes(r),s=0;s<u.length;s++)a=u[s],i=n[a],i<d[a][0]&&(d[a][0]=i),i>d[a][1]&&(d[a][1]=i);return"string"==typeof t?d[t]:d}function i(e,t){if(!o(e))throw new Error("graphology-metrics/extent: the given graph is not a valid graphology instance.");var r,n,i,a,s,l,h,u=[].concat(t),c=e.edges(),d={};for(s=0;s<u.length;s++)a=u[s],d[a]=[1/0,-1/0];for(l=0,h=c.length;l<h;l++)for(r=c[l],n=e.getEdgeAttributes(r),s=0;s<u.length;s++)a=u[s],i=n[a],i<d[a][0]&&(d[a][0]=i),i>d[a][1]&&(d[a][1]=i);return"string"==typeof t?d[t]:d}var o=r(8),a=n;a.nodeExtent=n,a.edgeExtent=i,e.exports=a},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}}();t.NodeDisplayData=function(){function e(t,r){n(this,e),this.index=t,this.x=0,this.y=0,this.size=2,this.color=r.defaultNodeColor,this.hidden=!1,this.label=""}return i(e,[{key:"assign",value:function(e){"x"in e&&(this.x=e.x),"y"in e&&(this.y=e.y),"size"in e&&(this.size=e.size),"color"in e&&(this.color=e.color),"hidden"in e&&(this.hidden=e.hidden),"label"in e&&(this.label=e.label)}}]),e}(),t.EdgeDisplayData=function(){function e(t,r){n(this,e),this.index=t,this.size=1,this.color=r.defaultEdgeColor,this.hidden=!1}return i(e,[{key:"assign",value:function(e){"size"in e&&(this.size=e.size),"color"in e&&(this.color=e.color),"hidden"in e&&(this.hidden=e.hidden)}}]),e}()},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}}(),l=r(9),h=n(l),u=r(2),c=r(22),d=n(c),f=r(23),v=n(f),p=4,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.gl=e,r.array=null,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.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,p*Float32Array.BYTES_PER_ELEMENT,0),e.vertexAttribPointer(r.sizeLocation,1,e.FLOAT,!1,p*Float32Array.BYTES_PER_ELEMENT,8),e.vertexAttribPointer(r.colorLocation,4,e.UNSIGNED_BYTE,!0,p*Float32Array.BYTES_PER_ELEMENT,12),r}return a(t,e),s(t,[{key:"allocate",value:function(e){this.array=new Float32Array(1*p*e)}},{key:"process",value:function(e,t){var r=(0,u.floatColor)(e.color),n=1*t*p,i=this.array;if(e.hidden)return i[n++]=0,i[n++]=0,i[n++]=0,void(i[n++]=0);i[n++]=e.x,i[n++]=e.y,i[n++]=e.size,i[n]=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.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/p)}}]),t}(h.default);t.default=g},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,r){"use strict";function n(){return Float32Array.of(1,0,0,0,1,0,0,0,1)}function i(e,t,r){return e[0]=t,e[4]=arguments.length>2?r: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],l=e[6],h=e[7],u=e[8],c=t[0],d=t[1],f=t[2],v=t[3],p=t[4],g=t[5],y=t[6],m=t[7],b=t[8];return e[0]=c*r+d*o+f*l,e[1]=c*n+d*a+f*h,e[2]=c*i+d*s+f*u,e[3]=v*r+p*o+g*l,e[4]=v*n+p*a+g*h,e[5]=v*i+p*s+g*u,e[6]=y*r+m*o+b*l,e[7]=y*n+m*a+b*h,e[8]=y*i+m*s+b*u,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){e.exports="attribute vec2 a_position;\nattribute float a_size;\nattribute vec4 a_color;\n\nuniform float u_ratio;\nuniform float u_scale;\nuniform mat3 u_matrix;\n\nvarying vec4 v_color;\nvarying float v_border;\n\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n\n gl_Position = vec4(\n (u_matrix * vec3(a_position, 1)).xy,\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 v_border = (1.0 / u_ratio) * (0.5 / a_size);\n\n // Extract the color:\n v_color = a_color;\n v_color.a *= bias;\n}\n"},function(e,t){e.exports="precision mediump float;\n\nvarying vec4 v_color;\nvarying float v_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 > v_border)\n t = 1.0;\n else if (dist > 0.0)\n t = dist / v_border;\n\n // gl_FragColor = mix(color0, v_color, t);\n gl_FragColor = mix(color0, v_color, t);\n}\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}}(),l=r(9),h=n(l),u=r(2),c=r(25),d=n(c),f=r(26),v=n(f),p=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.gl=e,r.array=null,r.indicesArray=null,r.buffer=e.createBuffer(),r.indicesBuffer=e.createBuffer(),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"),r.bind();var n="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext,a=n||e.getExtension("OES_element_index_uint");return r.canUse32BitsIndices=!!a,r.IndicesArray=r.canUse32BitsIndices?Uint32Array:Uint16Array,r.indicesType=r.canUse32BitsIndices?e.UNSIGNED_INT:e.UNSIGNED_SHORT,r}return a(t,e),s(t,[{key:"bind",value:function(){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,this.buffer),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indicesBuffer),e.enableVertexAttribArray(this.positionLocation),e.enableVertexAttribArray(this.normalLocation),e.enableVertexAttribArray(this.thicknessLocation),e.enableVertexAttribArray(this.colorLocation),e.vertexAttribPointer(this.positionLocation,2,e.FLOAT,!1,6*Float32Array.BYTES_PER_ELEMENT,0),e.vertexAttribPointer(this.normalLocation,2,e.FLOAT,!1,6*Float32Array.BYTES_PER_ELEMENT,8),e.vertexAttribPointer(this.thicknessLocation,1,e.FLOAT,!1,6*Float32Array.BYTES_PER_ELEMENT,16),e.vertexAttribPointer(this.colorLocation,4,e.UNSIGNED_BYTE,!0,6*Float32Array.BYTES_PER_ELEMENT,20)}},{key:"allocate",value:function(e){this.array=new Float32Array(24*e)}},{key:"process",value:function(e,t,r,n){if(e.hidden||t.hidden||r.hidden)for(var i=24*n,o=i+24;i<o;i++)this.array[i]=0;else{var a=r.size||1,s=e.x,l=e.y,h=t.x,c=t.y,d=(0,u.floatColor)(r.color),f=h-s,v=c-l,p=f*f+v*v,g=0,y=0;p&&(p=1/Math.sqrt(p),g=-v*p,y=f*p);var m=24*n,b=this.array;b[m++]=s,b[m++]=l,b[m++]=g,b[m++]=y,b[m++]=a,b[m++]=d,b[m++]=s,b[m++]=l,b[m++]=-g,b[m++]=-y,b[m++]=a,b[m++]=d,b[m++]=h,b[m++]=c,b[m++]=g,b[m++]=y,b[m++]=a,b[m++]=d,b[m++]=h,b[m++]=c,b[m++]=-g,b[m++]=-y,b[m++]=a,b[m]=d}}},{key:"computeIndices",value:function(){for(var e=this.array.length/6,t=e+e/2,r=new this.IndicesArray(t),n=0,i=0;n<e;n+=4)r[i++]=n,r[i++]=n+1,r[i++]=n+2,r[i++]=n+2,r[i++]=n+1,r[i++]=n+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),t.uniformMatrix3fv(this.matrixLocation,!1,e.matrix),t.uniform1f(this.scaleLocation,e.scalingRatio),t.drawElements(t.TRIANGLES,this.indicesArray.length,this.indicesType,0)}}]),t}(h.default);t.default=p},function(e,t){e.exports="attribute vec2 a_position;\nattribute vec2 a_normal;\nattribute float a_thickness;\nattribute vec4 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.8;\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n\n // Computing thickness in pixels\n float pow_ratio = 1.0 / pow(u_ratio, 0.5);\n float thickness = a_thickness / 2.0 * pow_ratio / u_scale;\n\n // Adding a small feather for AA\n thickness += feather;\n\n // Computing delta relative to viewport\n vec2 delta = (a_normal * thickness) / u_resolution;\n\n vec2 position = (u_matrix * vec3(a_position, 1)).xy;\n position += delta;\n\n // Applying\n gl_Position = vec4(position, 0, 1);\n\n v_normal = a_normal;\n v_thickness = thickness;\n\n // Extract the color:\n v_color = a_color;\n v_color.a *= bias;\n}\n"},function(e,t){e.exports="precision mediump float;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_thickness;\n\nconst float feather = 0.8;\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,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t,r){var n=r.labelSize,i=r.labelFont,o=r.labelWeight;e.font=o+" "+n+"px "+i,e.beginPath(),e.fillStyle="#fff",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=8,e.shadowColor="#000";var s=e.measureText(t.label).width,h=Math.round(t.x-n/2-2),u=Math.round(t.y-n/2-2),c=Math.round(s+n/2+t.size+9),d=Math.round(n+4),f=Math.round(n/2+2);e.moveTo(h,u+f),e.moveTo(h,u+f),e.arcTo(h,u,h+f,u,f),e.lineTo(h+c,u),e.lineTo(h+c,u+d),e.lineTo(h+f,u+d),e.arcTo(h,u+d,h,u+d-f,f),e.lineTo(h,u+f),e.closePath(),e.fill(),e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=0,(0,a.default)(e,t),(0,l.default)(e,t,r)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var o=r(28),a=n(o),s=r(10),l=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";var n={width:200,height:150},i={width:400,height:300};t.labelsToDisplayFromGrid=function(e){var t=e.cache,r=e.camera,o=e.displayedLabels,a=e.previousVisibleNodes,s=e.visibleNodes,l=e.dimensions,h=r.getState(),u=r.getPreviousState(),c=h.ratio<u.ratio,d=h.x!==u.x||h.y!==u.x,f=h.ratio>u.ratio,v=!c&&!f&&h.ratio>=1;if(f&&Math.trunc(10*h.ratio)%3!=0)return Array.from(o);if(v&&0!==o.size)return Array.from(o);for(var p=h.ratio>=1.3?i:n,g=l.width%p.width,y=p.width+g/Math.floor(l.width/p.width),m=l.height%p.height,b=p.height+m/Math.floor(l.height/p.height),w={},_=new Set,x=[],E=0,A=s.length;E<A;E++){var L=s[E],P=t[L];if(!d||c||f||o.has(L)||!a.has(L)){var T=r.graphToViewport(l,P.x,P.y),M=Math.floor(T.x/y),k=Math.floor(T.y/b),S=M+";"+k;if((c||d&&!f)&&o.has(L))_.add(S),x.push(L);else if(!_.has(S))if(void 0===w[S])w[S]=L;else{var O=w[S],C=t[O];(P.size>C.size||P.size===C.size&&L>O)&&(w[S]=L)}}}for(var D in w)x.push(w[D]);return x}},function(e,t,r){"use strict";t.zIndexOrdering=function(e,t,r){return r.sort(function(e,r){var n=t(e)||0,i=t(r)||0;return n<i?-1:n>i?1:0})}}])}); |
@@ -56,7 +56,5 @@ 'use strict'; | ||
function Camera(dimensions) { | ||
function Camera() { | ||
_classCallCheck(this, Camera); | ||
dimensions = dimensions || {}; | ||
// Properties | ||
@@ -69,4 +67,2 @@ var _this = _possibleConstructorReturn(this, (Camera.__proto__ || Object.getPrototypeOf(Camera)).call(this)); | ||
_this.ratio = 1; | ||
_this.width = dimensions.width || 0; | ||
_this.height = dimensions.height || 0; | ||
@@ -144,17 +140,2 @@ // State | ||
/** | ||
* Method used to retrieve the camera's dimensions. | ||
* | ||
* @return {object} | ||
*/ | ||
}, { | ||
key: 'getDimensions', | ||
value: function getDimensions() { | ||
return { | ||
width: this.width, | ||
height: this.height | ||
}; | ||
} | ||
/** | ||
* Method used to check whether the camera is currently being animated. | ||
@@ -240,8 +221,8 @@ * | ||
// TODO: reduce relative margin? | ||
var marginX = 0 * this.width / 8, | ||
marginY = 0 * this.height / 8; | ||
var marginX = 0 * dimensions.width / 8, | ||
marginY = 0 * dimensions.height / 8; | ||
var p1 = this.viewportToGraph(dimensions, 0 - marginX, 0 - marginY), | ||
p2 = this.viewportToGraph(dimensions, this.width + marginX, 0 - marginY), | ||
h = this.viewportToGraph(dimensions, 0, this.height + marginY); | ||
p2 = this.viewportToGraph(dimensions, dimensions.width + marginX, 0 - marginY), | ||
h = this.viewportToGraph(dimensions, 0, dimensions.height + marginY); | ||
@@ -292,24 +273,2 @@ return { | ||
/** | ||
* Method used to resize the camera's dimensions. | ||
* | ||
* @param {object} dimensions - New dimensions. | ||
* @return {Camera} | ||
*/ | ||
}, { | ||
key: 'resize', | ||
value: function resize(dimensions) { | ||
if (!this.enabled) return this; | ||
if ('width' in dimensions) this.width = dimensions.width; | ||
if ('height' in dimensions) this.height = dimensions.height; | ||
this.emit('resized', this.getDimensions()); | ||
return this; | ||
} | ||
/** | ||
* Method used to animate the camera. | ||
@@ -316,0 +275,0 @@ * |
@@ -55,9 +55,8 @@ 'use strict'; | ||
previousVisibleNodes = params.previousVisibleNodes, | ||
visibleNodes = params.visibleNodes; | ||
visibleNodes = params.visibleNodes, | ||
dimensions = params.dimensions; | ||
var cameraState = camera.getState(), | ||
previousCameraState = camera.getPreviousState(), | ||
dimensions = camera.getDimensions(); | ||
previousCameraState = camera.getPreviousState(); | ||
// State | ||
@@ -64,0 +63,0 @@ // TODO: the panning is false because of not working y condition, though |
"use strict"; | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
/** | ||
@@ -22,17 +20,16 @@ * Sigma.js zIndex Heuristics | ||
exports.zIndexOrdering = function (extent, getter, elements) { | ||
var n = elements.length; | ||
// const n = elements.length; | ||
var _extent = _slicedToArray(extent, 2), | ||
min = _extent[0], | ||
max = _extent[1]; | ||
// const [min, max] = extent; | ||
var k = max - min; | ||
// const k = max - min; | ||
// No ordering needs to be done | ||
if (k === 0 || k === -Infinity) return elements; | ||
// if (k === 0 || k === -Infinity) | ||
// return elements; | ||
// If k is > n, we'll use a standard sort | ||
if (true || k > n) return elements.sort(function (a, b) { | ||
var zA = getter(a), | ||
zB = getter(b); | ||
return elements.sort(function (a, b) { | ||
var zA = getter(a) || 0, | ||
zB = getter(b) || 0; | ||
@@ -39,0 +36,0 @@ if (zA < zB) return -1; |
{ | ||
"name": "sigma", | ||
"version": "2.0.0-alpha14", | ||
"version": "2.0.0-alpha15", | ||
"description": "A JavaScript library dedicated to graph drawing.", | ||
@@ -40,3 +40,5 @@ "homepage": "http://sigmajs.org", | ||
"babel-core": "^6.14.0", | ||
"babel-eslint": "^8.2.5", | ||
"babel-loader": "^7.1.4", | ||
"babel-plugin-transform-object-rest-spread": "^6.26.0", | ||
"babel-preset-es2015": "^6.14.0", | ||
@@ -74,6 +76,9 @@ "chroma-js": "^1.3.6", | ||
"es2015" | ||
], | ||
"plugins": [ | ||
"transform-object-rest-spread" | ||
] | ||
}, | ||
"eslintConfig": { | ||
"extends": "@yomguithereal/eslint-config/es6" | ||
"extends": "@yomguithereal/eslint-config/es7" | ||
}, | ||
@@ -80,0 +85,0 @@ "dependencies": { |
@@ -83,3 +83,8 @@ 'use strict'; | ||
// TODO: unit test this | ||
// TODO: possibility to apply this in batch over array of indices | ||
fn.applyTo = function (data) { | ||
data.x = 0.5 + (data.x - dX) / ratio; | ||
data.y = 0.5 + (data.y - dY) / ratio; | ||
}; | ||
fn.inverse = function (data) { | ||
@@ -86,0 +91,0 @@ return { |
@@ -31,2 +31,4 @@ 'use strict'; | ||
var _displayData2 = require('../display-data'); | ||
var _node = require('./programs/node.fast'); | ||
@@ -82,11 +84,19 @@ | ||
var DEFAULT_SETTINGS = { | ||
// Performance | ||
hideEdgesOnMove: false, | ||
hideLabelsOnMove: false, | ||
renderLabels: true, | ||
zIndex: false, | ||
// TEMPORARY LABEL SETTINGS | ||
// Component rendering | ||
defaultNodeColor: '#999', | ||
defaultEdgeColor: '#ccc', | ||
labelFont: 'Arial', | ||
labelSize: 14, | ||
labelWeight: 'normal' | ||
labelWeight: 'normal', | ||
nodeReducer: null, | ||
edgeReducer: null, | ||
// Features | ||
zIndex: false | ||
}; | ||
@@ -130,10 +140,11 @@ | ||
// TODO: this could be improved by key => index => floatArray | ||
// TODO: the cache should erase keys on node delete | ||
// TODO: the cache should erase keys on node delete & add new | ||
_this.quadtree = new _quadtree2.default(); | ||
_this.nodeOrder = {}; | ||
_this.nodeDataCache = {}; | ||
_this.edgeOrder = {}; | ||
_this.edgeDataCache = {}; | ||
_this.nodeExtent = null; | ||
_this.edgeExtent = null; | ||
_this.initializeCache(); | ||
// Normalization function | ||
@@ -269,2 +280,24 @@ _this.normalizationFunction = null; | ||
/** | ||
* Method used to initialize display data cache. | ||
* | ||
* @return {WebGLRenderer} | ||
*/ | ||
}, { | ||
key: 'initializeCache', | ||
value: function initializeCache() { | ||
var graph = this.graph; | ||
var nodes = graph.nodes(); | ||
for (var i = 0, l = nodes.length; i < l; i++) { | ||
this.nodeDataCache[nodes[i]] = new _displayData2.NodeDisplayData(i, this.settings); | ||
}var edges = graph.edges(); | ||
for (var _i = 0, _l = edges.length; _i < _l; _i++) { | ||
this.edgeDataCache[edges[_i]] = new _displayData2.EdgeDisplayData(_i, this.settings); | ||
} | ||
} | ||
/** | ||
* Method binding camera handlers. | ||
@@ -477,3 +510,4 @@ * | ||
var graph = this.graph; | ||
var graph = this.graph, | ||
settings = this.settings; | ||
@@ -498,6 +532,3 @@ // Clearing the quad | ||
if (!keepArrays) { | ||
nodeProgram.allocate(graph.order); | ||
this.nodeOrder = {}; | ||
} | ||
if (!keepArrays) nodeProgram.allocate(graph.order); | ||
@@ -507,2 +538,5 @@ var nodes = graph.nodes(); | ||
// Handling node z-index | ||
// TODO: z-index needs us to compute display data before hand | ||
// TODO: remains to be seen if reducers are a good or bad thing and if we | ||
// should store display data in flat byte arrays indices | ||
if (this.settings.zIndex) nodes = (0, _zIndex.zIndexOrdering)(this.edgeExtent.z, function (node) { | ||
@@ -515,17 +549,17 @@ return graph.getNodeAttribute(node, 'z'); | ||
this.nodeOrder[node] = i; | ||
var data = graph.getNodeAttributes(node); | ||
var rescaledData = this.normalizationFunction(data); | ||
var displayData = this.nodeDataCache[node]; | ||
// TODO: Optimize this to save a loop and one object, by using a reversed assign | ||
var displayData = (0, _utils.assign)({}, data, rescaledData); | ||
if (settings.nodeReducer) data = settings.nodeReducer(node, data); | ||
// TODO: this size normalization does not work | ||
// TODO: should assign default also somewhere here if there is a reducer | ||
displayData.assign(data); | ||
this.normalizationFunction.applyTo(displayData); | ||
this.quadtree.add(node, displayData.x, 1 - displayData.y, displayData.size / this.width); | ||
this.nodeDataCache[node] = displayData; | ||
nodeProgram.process(displayData, i); | ||
nodeProgram.process(displayData, i); | ||
displayData.index = i; | ||
} | ||
@@ -537,6 +571,3 @@ | ||
if (!keepArrays) { | ||
edgeProgram.allocate(graph.size); | ||
this.edgeOrder = {}; | ||
} | ||
if (!keepArrays) edgeProgram.allocate(graph.size); | ||
@@ -550,13 +581,20 @@ var edges = graph.edges(); | ||
for (var _i = 0, _l = edges.length; _i < _l; _i++) { | ||
var edge = edges[_i]; | ||
for (var _i2 = 0, _l2 = edges.length; _i2 < _l2; _i2++) { | ||
var edge = edges[_i2]; | ||
this.edgeOrder[edge] = _i; | ||
var _data2 = graph.getEdgeAttributes(edge); | ||
var _data2 = graph.getEdgeAttributes(edge), | ||
extremities = graph.extremities(edge), | ||
var _displayData = this.edgeDataCache[edge]; | ||
if (settings.edgeReducer) _data2 = settings.edgeReducer(edge, _data2); | ||
_displayData.assign(_data2); | ||
var extremities = graph.extremities(edge), | ||
sourceData = this.nodeDataCache[extremities[0]], | ||
targetData = this.nodeDataCache[extremities[1]]; | ||
edgeProgram.process(sourceData, targetData, _data2, _i); | ||
edgeProgram.process(sourceData, targetData, _displayData, _i2); | ||
_displayData.index = _i2; | ||
} | ||
@@ -586,3 +624,3 @@ | ||
nodeProgram.process(data, this.nodeOrder[key]); | ||
nodeProgram.process(data, this.nodeDataCache[key].index); | ||
@@ -611,3 +649,3 @@ return this; | ||
edgeProgram.process(sourceData, targetData, data, this.edgeOrder[key]); | ||
edgeProgram.process(sourceData, targetData, data, this.edgeDataCache[key].index); | ||
@@ -668,9 +706,9 @@ return this; | ||
if (this.width === 0) throw new Error('sigma/renderers/webgl: container as no width.'); | ||
if (this.height === 0) throw new Error('sigma/renderers/webgl: container as no height.'); | ||
// If nothing has changed, we can stop right here | ||
if (previousWidth === this.width && previousHeight === this.height) return this; | ||
// Resizing camera | ||
// TODO: maybe move this elsewhere | ||
if (this.camera) this.camera.resize({ width: this.width, height: this.height }); | ||
// Sizing dom elements | ||
@@ -773,3 +811,2 @@ for (var id in this.elements) { | ||
// TODO: should probably use another name for the `program` abstraction | ||
program.render({ | ||
@@ -825,3 +862,4 @@ matrix: cameraMatrix, | ||
previousVisibleNodes: this.previousVisibleNodes, | ||
visibleNodes: visibleNodes | ||
visibleNodes: visibleNodes, | ||
dimensions: this | ||
}); | ||
@@ -967,2 +1005,17 @@ | ||
/** | ||
* Method used to manually refresh. | ||
* | ||
* @return {WebGLRenderer} | ||
*/ | ||
}, { | ||
key: 'refresh', | ||
value: function refresh() { | ||
this.needToSoftProcess = true; | ||
this.scheduleRender(); | ||
return this; | ||
} | ||
/** | ||
* Method used to highlight a node. | ||
@@ -1038,5 +1091,4 @@ * | ||
this.quadtree = null; | ||
this.nodeOrder = null; | ||
this.nodeDataCache = null; | ||
this.edgeOrder = null; | ||
this.edgeDataCache = null; | ||
@@ -1043,0 +1095,0 @@ this.highlightedNodes = null; |
@@ -92,3 +92,5 @@ 'use strict'; | ||
gl.vertexAttribPointer(this.radiusLocation, 1, gl.FLOAT, false, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 20); | ||
gl.vertexAttribPointer(this.colorLocation, 1, gl.FLOAT, false, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 24); | ||
gl.vertexAttribPointer(this.colorLocation, 4, gl.UNSIGNED_BYTE, true, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 24); | ||
// TODO: maybe we can optimize here by packing this in a bit mask | ||
gl.vertexAttribPointer(this.barycentricLocation, 3, gl.FLOAT, false, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 28); | ||
@@ -192,7 +194,7 @@ } | ||
gl.uniform2f(this.resolutionLocation, params.width, params.height); | ||
gl.uniform1f(this.ratioLocation, 1 / Math.pow(params.ratio, params.edgesPowRatio)); | ||
gl.uniform1f(this.ratioLocation, params.ratio); | ||
gl.uniformMatrix3fv(this.matrixLocation, false, params.matrix); | ||
gl.uniform1f(this.scaleLocation, params.ratio); | ||
gl.uniform1f(this.scaleLocation, params.scalingRatio); | ||
@@ -199,0 +201,0 @@ // Drawing: |
@@ -115,3 +115,3 @@ 'use strict'; | ||
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); | ||
gl.vertexAttribPointer(this.colorLocation, 4, gl.UNSIGNED_BYTE, true, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 20); | ||
} | ||
@@ -200,3 +200,3 @@ }, { | ||
for (var i = 0, c = 0; i < size; i += 4) { | ||
for (var i = 0, c = 0; i < l; i += 4) { | ||
indices[c++] = i; | ||
@@ -203,0 +203,0 @@ indices[c++] = i + 1; |
@@ -66,3 +66,2 @@ 'use strict'; | ||
_this.colorLocation = gl.getAttribLocation(program, 'a_color'); | ||
_this.resolutionLocation = gl.getUniformLocation(program, 'u_resolution'); | ||
_this.matrixLocation = gl.getUniformLocation(program, 'u_matrix'); | ||
@@ -79,3 +78,3 @@ _this.ratioLocation = gl.getUniformLocation(program, 'u_ratio'); | ||
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); | ||
gl.vertexAttribPointer(_this.colorLocation, 4, gl.UNSIGNED_BYTE, true, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 12); | ||
return _this; | ||
@@ -127,3 +126,2 @@ } | ||
gl.uniform2f(this.resolutionLocation, params.width, params.height); | ||
gl.uniform1f(this.ratioLocation, 1 / Math.pow(params.ratio, params.nodesPowRatio)); | ||
@@ -130,0 +128,0 @@ gl.uniform1f(this.scaleLocation, params.scalingRatio); |
@@ -23,5 +23,8 @@ 'use strict'; | ||
var INT8 = new Int8Array(4); | ||
var INT32 = new Int32Array(INT8.buffer, 0, 1); | ||
var FLOAT32 = new Float32Array(INT8.buffer, 0, 1); | ||
var RGBA_TEST_REGEX = /^\s*rgba?\s*\(/; | ||
var RGBA_EXTRACT_REGEX = /^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)\s*(,.*)?\)\s*$/; | ||
var RGBA_EXTRACT_REGEX = /^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)(?:\s*,\s*(.*)?)?\)\s*$/; | ||
@@ -35,3 +38,4 @@ function floatColor(val) { | ||
g = 0, | ||
b = 0; | ||
b = 0, | ||
a = 1; | ||
@@ -58,6 +62,14 @@ // Handling hexadecimal notation | ||
b = +match[3]; | ||
if (match[4]) a = +match[4]; | ||
} | ||
var color = r * 256 * 256 + g * 256 + b; | ||
a = a * 255 | 0; | ||
var bits = (a << 24 | b << 16 | g << 8 | r) & 0xfeffffff; | ||
INT32[0] = bits; | ||
var color = FLOAT32[0]; | ||
FLOAT_COLOR_CACHE[val] = color; | ||
@@ -64,0 +76,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1313662
55
24031
26