landscape-widget 0.4.0-rc.2 → 0.4.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define("landscape-widget",["@jupyter-widgets/base"],(e=>(()=>{var t={930:(e,t,n)=>{(t=n(364)(!1)).push([e.id,".custom-widget {\n padding: 5px;\n}\n\n.landscape-container {\n height: 100%;\n width: 100%;\n}\n",""]),e.exports=t},969:(e,t,n)=>{(t=n(364)(!1)).push([e.id,".graph-container .controls-container>button{display:flex;justify-content:center;align-items:center;border-radius:4px;border:none;margin:0 4px 0 0;padding:0;background-color:#e2e4e7}.graph-container .controls-container>button:hover{background-color:#cbcdd0}.graph-container .controls-container>button.active{background-color:#bddde8}.graph-container .controls-container>button[data-tooltip]:before{position:absolute;display:none;pointer-events:none;transition:opacity .3s;content:attr(data-tooltip);background-color:#33455f;color:#fff;font-size:1rem;line-height:1.4;border-radius:4px;padding:4px 8px;max-width:300px;margin-bottom:14px;white-space:nowrap;font-weight:500;bottom:100%}.graph-container .controls-container>button[data-tooltip]:hover:before{display:block}.graph-container .controls-container>button[data-tooltip]:last-of-type:before{left:100%;transform:translateX(-100%)}.graph-container .webgl-overlay{font-size:20px;text-align:center;opacity:.9}.graph-container .webgl-overlay>button{font-size:16px;background-color:#007bff;color:#fff;border:none;border-radius:4px}.slider-container{position:absolute;top:0;width:490px;display:flex;border:1px solid #d3d3d3;border-radius:4px;height:40px;box-sizing:border-box}.slider-container .slider-wrapper{display:flex;align-items:center;padding:0 5px}.slider-container .slider-wrapper .slider-label{margin:0;font-size:14px}.slider-container .slider-wrapper .slider{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:110px;height:4px;margin-right:10px;margin-left:5px;border-radius:4px;background:#2196f3;outline:none;cursor:pointer}.slider-container .slider-wrapper .slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:16px;height:16px;background:#2196f3;border-radius:50%}.slider-container .slider-wrapper .slider::-moz-range-thumb{width:16px;height:16px;background:#2196f3;border-radius:50%;border:none}.slider-container .slider-wrapper .slider:hover::-webkit-slider-thumb{background:#1976d2}.slider-container .slider-wrapper .slider:hover::-moz-range-thumb{background:#1976d2}.slider-container .slider-wrapper .slider:hover::-ms-thumb{background:#1976d2}.slider-container .slider-wrapper .slider:active::-webkit-slider-thumb{background:#0d47a1}.slider-container .slider-wrapper .slider:active::-moz-range-thumb{background:#0d47a1}.slider-container .slider-wrapper .slider:active::-ms-thumb{background:#0d47a1}.slider-container .slider-wrapper .slider-value{min-width:20px;text-align:center}\n",""]),e.exports=t},858:function(e){var t;t=()=>(()=>{var e={187:e=>{"use strict";var t,n="object"==typeof Reflect?Reflect:null,i=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var r=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(n,i){function r(n){e.removeListener(t,o),i(n)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",r),n([].slice.call(arguments))}g(e,t,o,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&g(e,"error",t,{once:!0})}(e,r)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var a=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function h(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function u(e,t,n,i){var r,o,a,u;if(s(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),a=o[t]),void 0===a)a=o[t]=n,++e._eventsCount;else if("function"==typeof a?a=o[t]=i?[n,a]:[a,n]:i?a.unshift(n):a.push(n),(r=h(e))>0&&a.length>r&&!a.warned){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=a.length,u=c,console&&console.warn&&console.warn(u)}return e}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=c.bind(i);return r.listener=n,i.wrapFn=r,r}function l(e,t,n){var i=e._events;if(void 0===i)return[];var r=i[t];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(r):p(r,r.length)}function f(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function p(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e[i];return n}function g(e,t,n,i){if("function"==typeof e.on)i.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function r(o){i.once&&e.removeEventListener(t,r),n(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");a=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return h(this)},o.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,o=this._events;if(void 0!==o)r=r&&void 0===o.error;else if(!r)return!1;if(r){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var h=o[e];if(void 0===h)return!1;if("function"==typeof h)i(h,this,t);else{var u=h.length,c=p(h,u);for(n=0;n<u;++n)i(c[n],this,t)}return!0},o.prototype.addListener=function(e,t){return u(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return u(this,e,t,!0)},o.prototype.once=function(e,t){return s(t),this.on(e,d(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,d(this,e,t)),this},o.prototype.removeListener=function(e,t){var n,i,r,o,a;if(s(t),void 0===(i=this._events))return this;if(void 0===(n=i[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(r=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){a=n[o].listener,r=o;break}if(r<0)return this;0===r?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,r),1===n.length&&(i[e]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",e,a||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,n,i;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var r,o=Object.keys(n);for(i=0;i<o.length;++i)"removeListener"!==(r=o[i])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},o.prototype.listeners=function(e){return l(this,e,!0)},o.prototype.rawListeners=function(e){return l(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},o.prototype.listenerCount=f,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},803:(e,t,n)=>{var i=n(186),r=(n(212).B,n(325).De,n(341));t.kS=function(e){var t=[];return function(e,t){if(!i(e))throw new Error("graphology-components: the given graph is not a valid graphology instance.");if(e.order){var n=new r(e),o=n.push.bind(n);n.forEachNodeYetUnseen((function(i){var r,a=[];for(n.push(i);0!==n.size;)r=n.pop(),a.push(r),e.forEachNeighbor(r,o);t(a)}))}}(e,(function(e){t.push(e)})),t}},341:e=>{function t(e){this.graph=e,this.stack=new Array(e.order),this.seen=new Set,this.size=0}t.prototype.hasAlreadySeenEverything=function(){return this.seen.size===this.graph.order},t.prototype.countUnseenNodes=function(){return this.graph.order-this.seen.size},t.prototype.forEachNodeYetUnseen=function(e){var t=this.seen,n=this.graph;n.someNode((function(i,r){return t.size===n.order||!t.has(i)&&!!e(i,r)}))},t.prototype.has=function(e){return this.seen.has(e)},t.prototype.push=function(e){var t=this.seen.size;return this.seen.add(e),t!==this.seen.size&&(this.stack[this.size++]=e,!0)},t.prototype.pushWith=function(e,t){var n=this.seen.size;return this.seen.add(e),n!==this.seen.size&&(this.stack[this.size++]=t,!0)},t.prototype.pop=function(){if(0!==this.size)return this.stack[--this.size]},e.exports=t},847:e=>{e.exports={linLogMode:!1,outboundAttractionDistribution:!1,adjustSizes:!1,edgeWeightInfluence:1,scalingRatio:1,strongGravityMode:!1,gravity:1,slowDown:1,barnesHutOptimize:!1,barnesHutTheta:.5}},739:(e,t)=>{t.assign=function(e){e=e||{};var t,n,i,r=Array.prototype.slice.call(arguments).slice(1);for(t=0,i=r.length;t<i;t++)if(r[t])for(n in r[t])e[n]=r[t][n];return e},t.validateSettings=function(e){return"linLogMode"in e&&"boolean"!=typeof e.linLogMode?{message:"the `linLogMode` setting should be a boolean."}:"outboundAttractionDistribution"in e&&"boolean"!=typeof e.outboundAttractionDistribution?{message:"the `outboundAttractionDistribution` setting should be a boolean."}:"adjustSizes"in e&&"boolean"!=typeof e.adjustSizes?{message:"the `adjustSizes` setting should be a boolean."}:"edgeWeightInfluence"in e&&"number"!=typeof e.edgeWeightInfluence?{message:"the `edgeWeightInfluence` setting should be a number."}:!("scalingRatio"in e)||"number"==typeof e.scalingRatio&&e.scalingRatio>=0?"strongGravityMode"in e&&"boolean"!=typeof e.strongGravityMode?{message:"the `strongGravityMode` setting should be a boolean."}:!("gravity"in e)||"number"==typeof e.gravity&&e.gravity>=0?"slowDown"in e&&!("number"==typeof e.slowDown||e.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in e&&"boolean"!=typeof e.barnesHutOptimize?{message:"the `barnesHutOptimize` setting should be a boolean."}:!("barnesHutTheta"in e)||"number"==typeof e.barnesHutTheta&&e.barnesHutTheta>=0?null:{message:"the `barnesHutTheta` setting should be a number >= 0."}:{message:"the `gravity` setting should be a number >= 0."}:{message:"the `scalingRatio` setting should be a number >= 0."}},t.graphToByteArrays=function(e,t){var n,i=e.order,r=e.size,o={},a=new Float32Array(10*i),s=new Float32Array(3*r);return n=0,e.forEachNode((function(e,t){o[e]=n,a[n]=t.x,a[n+1]=t.y,a[n+2]=0,a[n+3]=0,a[n+4]=0,a[n+5]=0,a[n+6]=1,a[n+7]=1,a[n+8]=t.size||1,a[n+9]=t.fixed?1:0,n+=10})),n=0,e.forEachEdge((function(e,i,r,h,u,c,d){var l=o[r],f=o[h],p=t(e,i,r,h,u,c,d);a[l+6]+=p,a[f+6]+=p,s[n]=l,s[n+1]=f,s[n+2]=p,n+=3})),{nodes:a,edges:s}},t.assignLayoutChanges=function(e,t,n){var i=0;e.updateEachNodeAttributes((function(e,r){return r.x=t[i],r.y=t[i+1],i+=10,n?n(e,r):r}))},t.readGraphPositions=function(e,t){var n=0;e.forEachNode((function(e,i){t[n]=i.x,t[n+1]=i.y,n+=10}))},t.collectLayoutChanges=function(e,t,n){for(var i=e.nodes(),r={},o=0,a=0,s=t.length;o<s;o+=10){if(n){var h=Object.assign({},e.getNodeAttributes(i[a]));h.x=t[o],h.y=t[o+1],h=n(i[a],h),r[i[a]]={x:h.x,y:h.y}}else r[i[a]]={x:t[o],y:t[o+1]};a++}return r},t.createWorker=function(e){var t=window.URL||window.webkitURL,n=e.toString(),i=t.createObjectURL(new Blob(["("+n+").call(this);"],{type:"text/javascript"})),r=new Worker(i);return t.revokeObjectURL(i),r}},325:(e,t)=>{t.De=function(e,t,n,i,r,o){return o=Object.assign({},o),t?null==n?e.addUndirectedEdge(i,r,o):e.addUndirectedEdgeWithKey(n,i,r,o):null==n?e.addDirectedEdge(i,r,o):e.addDirectedEdgeWithKey(n,i,r,o)}},212:(e,t)=>{t.B=function(e,t,n){return n=Object.assign({},n),e.addNode(t,n)}},186:e=>{e.exports=function(e){return null!==e&&"object"==typeof e&&"function"==typeof e.addUndirectedEdgeWithKey&&"function"==typeof e.dropNode&&"boolean"==typeof e.multi}},698:function(e){e.exports=function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,i(e,t)}function n(e){return n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},n(e)}function i(e,t){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},i(e,t)}function r(e,t,n){return r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&i(o,n.prototype),o},r.apply(null,arguments)}function o(e){var t="function"==typeof Map?new Map:void 0;return o=function(e){if(null===e||(o=e,-1===Function.toString.call(o).indexOf("[native code]")))return e;var o;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,a)}function a(){return r(e,arguments,n(this).constructor)}return a.prototype=Object.create(e.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),i(a,e)},o(e)}function a(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var s=function(){for(var e=arguments[0],t=1,n=arguments.length;t<n;t++)if(arguments[t])for(var i in arguments[t])e[i]=arguments[t][i];return e};function h(e,t,n,i){var r=e._nodes.get(t),o=null;return r?o="mixed"===i?r.out&&r.out[n]||r.undirected&&r.undirected[n]:"directed"===i?r.out&&r.out[n]:r.undirected&&r.undirected[n]:o}function u(t){return"object"===e(t)&&null!==t}function c(e){var t;for(t in e)return!1;return!0}function d(e,t,n){Object.defineProperty(e,t,{enumerable:!1,configurable:!1,writable:!0,value:n})}function l(e,t,n){var i={enumerable:!0,configurable:!0};"function"==typeof n?i.get=n:(i.value=n,i.writable=!1),Object.defineProperty(e,t,i)}function f(e){return!(!u(e)||e.attributes&&!Array.isArray(e.attributes))}"function"==typeof Object.assign&&(s=Object.assign);var p,g={exports:{}},v="object"==typeof Reflect?Reflect:null,m=v&&"function"==typeof v.apply?v.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};p=v&&"function"==typeof v.ownKeys?v.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var y=Number.isNaN||function(e){return e!=e};function b(){b.init.call(this)}g.exports=b,g.exports.once=function(e,t){return new Promise((function(n,i){function r(n){e.removeListener(t,o),i(n)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",r),n([].slice.call(arguments))}A(e,t,o,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&A(e,"error",t,{once:!0})}(e,r)}))},b.EventEmitter=b,b.prototype._events=void 0,b.prototype._eventsCount=0,b.prototype._maxListeners=void 0;var w=10;function x(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function C(e){return void 0===e._maxListeners?b.defaultMaxListeners:e._maxListeners}function _(e,t,n,i){var r,o,a,s;if(x(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),a=o[t]),void 0===a)a=o[t]=n,++e._eventsCount;else if("function"==typeof a?a=o[t]=i?[n,a]:[a,n]:i?a.unshift(n):a.push(n),(r=C(e))>0&&a.length>r&&!a.warned){a.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=e,h.type=t,h.count=a.length,s=h,console&&console.warn&&console.warn(s)}return e}function E(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function k(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=E.bind(i);return r.listener=n,i.wrapFn=r,r}function S(e,t,n){var i=e._events;if(void 0===i)return[];var r=i[t];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(r):N(r,r.length)}function L(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function N(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e[i];return n}function A(e,t,n,i){if("function"==typeof e.on)i.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function r(o){i.once&&e.removeEventListener(t,r),n(o)}))}}function T(e){if("function"!=typeof e)throw new Error("obliterator/iterator: expecting a function!");this.next=e}Object.defineProperty(b,"defaultMaxListeners",{enumerable:!0,get:function(){return w},set:function(e){if("number"!=typeof e||e<0||y(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");w=e}}),b.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},b.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||y(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},b.prototype.getMaxListeners=function(){return C(this)},b.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i="error"===e,r=this._events;if(void 0!==r)i=i&&void 0===r.error;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var s=r[e];if(void 0===s)return!1;if("function"==typeof s)m(s,this,t);else{var h=s.length,u=N(s,h);for(n=0;n<h;++n)m(u[n],this,t)}return!0},b.prototype.addListener=function(e,t){return _(this,e,t,!1)},b.prototype.on=b.prototype.addListener,b.prototype.prependListener=function(e,t){return _(this,e,t,!0)},b.prototype.once=function(e,t){return x(t),this.on(e,k(this,e,t)),this},b.prototype.prependOnceListener=function(e,t){return x(t),this.prependListener(e,k(this,e,t)),this},b.prototype.removeListener=function(e,t){var n,i,r,o,a;if(x(t),void 0===(i=this._events))return this;if(void 0===(n=i[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(r=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){a=n[o].listener,r=o;break}if(r<0)return this;0===r?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,r),1===n.length&&(i[e]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",e,a||t)}return this},b.prototype.off=b.prototype.removeListener,b.prototype.removeAllListeners=function(e){var t,n,i;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var r,o=Object.keys(n);for(i=0;i<o.length;++i)"removeListener"!==(r=o[i])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},b.prototype.listeners=function(e){return S(this,e,!0)},b.prototype.rawListeners=function(e){return S(this,e,!1)},b.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):L.call(e,t)},b.prototype.listenerCount=L,b.prototype.eventNames=function(){return this._eventsCount>0?p(this._events):[]},"undefined"!=typeof Symbol&&(T.prototype[Symbol.iterator]=function(){return this}),T.of=function(){var e=arguments,t=e.length,n=0;return new T((function(){return n>=t?{done:!0}:{done:!1,value:e[n++]}}))},T.empty=function(){return new T((function(){return{done:!0}}))},T.fromSequence=function(e){var t=0,n=e.length;return new T((function(){return t>=n?{done:!0}:{done:!1,value:e[t++]}}))},T.is=function(e){return e instanceof T||"object"==typeof e&&null!==e&&"function"==typeof e.next};var M=T,D={};D.ARRAY_BUFFER_SUPPORT="undefined"!=typeof ArrayBuffer,D.SYMBOL_SUPPORT="undefined"!=typeof Symbol;var R=M,G=D,P=G.ARRAY_BUFFER_SUPPORT,F=G.SYMBOL_SUPPORT,z=function(e){var t=function(e){return"string"==typeof e||Array.isArray(e)||P&&ArrayBuffer.isView(e)?R.fromSequence(e):"object"!=typeof e||null===e?null:F&&"function"==typeof e[Symbol.iterator]?e[Symbol.iterator]():"function"==typeof e.next?e:null}(e);if(!t)throw new Error("obliterator: target is not iterable nor a valid iterator.");return t},O=z,I=function(e,t){for(var n,i=arguments.length>1?t:1/0,r=i!==1/0?new Array(i):[],o=0,a=O(e);;){if(o===i)return r;if((n=a.next()).done)return o!==t&&(r.length=o),r;r[o++]=n.value}},B=function(e){function n(t){var n;return(n=e.call(this)||this).name="GraphError",n.message=t,n}return t(n,e),n}(o(Error)),U=function(e){function n(t){var i;return(i=e.call(this,t)||this).name="InvalidArgumentsGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(a(i),n.prototype.constructor),i}return t(n,e),n}(B),j=function(e){function n(t){var i;return(i=e.call(this,t)||this).name="NotFoundGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(a(i),n.prototype.constructor),i}return t(n,e),n}(B),V=function(e){function n(t){var i;return(i=e.call(this,t)||this).name="UsageGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(a(i),n.prototype.constructor),i}return t(n,e),n}(B);function H(e,t){this.key=e,this.attributes=t,this.clear()}function W(e,t){this.key=e,this.attributes=t,this.clear()}function q(e,t){this.key=e,this.attributes=t,this.clear()}function Z(e,t,n,i,r){this.key=t,this.attributes=r,this.undirected=e,this.source=n,this.target=i}function Y(e,t,n,i,r,o,a){var s,h,u,c;if(i=""+i,0===n){if(!(s=e._nodes.get(i)))throw new j("Graph.".concat(t,': could not find the "').concat(i,'" node in the graph.'));u=r,c=o}else if(3===n){if(r=""+r,!(h=e._edges.get(r)))throw new j("Graph.".concat(t,': could not find the "').concat(r,'" edge in the graph.'));var d=h.source.key,l=h.target.key;if(i===d)s=h.target;else{if(i!==l)throw new j("Graph.".concat(t,': the "').concat(i,'" node is not attached to the "').concat(r,'" edge (').concat(d,", ").concat(l,")."));s=h.source}u=o,c=a}else{if(!(h=e._edges.get(i)))throw new j("Graph.".concat(t,': could not find the "').concat(i,'" edge in the graph.'));s=1===n?h.source:h.target,u=r,c=o}return[s,u,c]}H.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}},W.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}},q.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}},Z.prototype.attach=function(){var e="out",t="in";this.undirected&&(e=t="undirected");var n=this.source.key,i=this.target.key;this.source[e][i]=this,this.undirected&&n===i||(this.target[t][n]=this)},Z.prototype.attachMulti=function(){var e="out",t="in",n=this.source.key,i=this.target.key;this.undirected&&(e=t="undirected");var r=this.source[e],o=r[i];if(void 0===o)return r[i]=this,void(this.undirected&&n===i||(this.target[t][n]=this));o.previous=this,this.next=o,r[i]=this,this.target[t][n]=this},Z.prototype.detach=function(){var e=this.source.key,t=this.target.key,n="out",i="in";this.undirected&&(n=i="undirected"),delete this.source[n][t],delete this.target[i][e]},Z.prototype.detachMulti=function(){var e=this.source.key,t=this.target.key,n="out",i="in";this.undirected&&(n=i="undirected"),void 0===this.previous?void 0===this.next?(delete this.source[n][t],delete this.target[i][e]):(this.next.previous=void 0,this.source[n][t]=this.next,this.target[i][e]=this.next):(this.previous.next=this.next,void 0!==this.next&&(this.next.previous=this.previous))};var X=[{name:function(e){return"get".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r){var o=Y(this,t,n,e,i,r),a=o[0],s=o[1];return a.attributes[s]}}},{name:function(e){return"get".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,i){return Y(this,t,n,e,i)[0].attributes}}},{name:function(e){return"has".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r){var o=Y(this,t,n,e,i,r),a=o[0],s=o[1];return a.attributes.hasOwnProperty(s)}}},{name:function(e){return"set".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r,o){var a=Y(this,t,n,e,i,r,o),s=a[0],h=a[1],u=a[2];return s.attributes[h]=u,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:h}),this}}},{name:function(e){return"update".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r,o){var a=Y(this,t,n,e,i,r,o),s=a[0],h=a[1],u=a[2];if("function"!=typeof u)throw new U("Graph.".concat(t,": updater should be a function."));var c=s.attributes,d=u(c[h]);return c[h]=d,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:h}),this}}},{name:function(e){return"remove".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r){var o=Y(this,t,n,e,i,r),a=o[0],s=o[1];return delete a.attributes[s],this.emit("nodeAttributesUpdated",{key:a.key,type:"remove",attributes:a.attributes,name:s}),this}}},{name:function(e){return"replace".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r){var o=Y(this,t,n,e,i,r),a=o[0],s=o[1];if(!u(s))throw new U("Graph.".concat(t,": provided attributes are not a plain object."));return a.attributes=s,this.emit("nodeAttributesUpdated",{key:a.key,type:"replace",attributes:a.attributes}),this}}},{name:function(e){return"merge".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r){var o=Y(this,t,n,e,i,r),a=o[0],h=o[1];if(!u(h))throw new U("Graph.".concat(t,": provided attributes are not a plain object."));return s(a.attributes,h),this.emit("nodeAttributesUpdated",{key:a.key,type:"merge",attributes:a.attributes,data:h}),this}}},{name:function(e){return"update".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r){var o=Y(this,t,n,e,i,r),a=o[0],s=o[1];if("function"!=typeof s)throw new U("Graph.".concat(t,": provided updater is not a function."));return a.attributes=s(a.attributes),this.emit("nodeAttributesUpdated",{key:a.key,type:"update",attributes:a.attributes}),this}}}],K=[{name:function(e){return"get".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new V("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new V("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+e,a=""+i;if(i=arguments[2],!(r=h(this,o,a,n)))throw new j("Graph.".concat(t,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new V("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(r=this._edges.get(e)))throw new j("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return r.attributes[i]}}},{name:function(e){return"get".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new V("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>1){if(this.multi)throw new V("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var r=""+e,o=""+arguments[1];if(!(i=h(this,r,o,n)))throw new j("Graph.".concat(t,': could not find an edge for the given path ("').concat(r,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new V("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(i=this._edges.get(e)))throw new j("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return i.attributes}}},{name:function(e){return"has".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new V("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new V("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+e,a=""+i;if(i=arguments[2],!(r=h(this,o,a,n)))throw new j("Graph.".concat(t,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new V("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(r=this._edges.get(e)))throw new j("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return r.attributes.hasOwnProperty(i)}}},{name:function(e){return"set".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r){var o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new V("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new V("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var a=""+e,s=""+i;if(i=arguments[2],r=arguments[3],!(o=h(this,a,s,n)))throw new j("Graph.".concat(t,': could not find an edge for the given path ("').concat(a,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new V("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(o=this._edges.get(e)))throw new j("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return o.attributes[i]=r,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:i}),this}}},{name:function(e){return"update".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r){var o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new V("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new V("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var a=""+e,s=""+i;if(i=arguments[2],r=arguments[3],!(o=h(this,a,s,n)))throw new j("Graph.".concat(t,': could not find an edge for the given path ("').concat(a,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new V("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(o=this._edges.get(e)))throw new j("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}if("function"!=typeof r)throw new U("Graph.".concat(t,": updater should be a function."));return o.attributes[i]=r(o.attributes[i]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:i}),this}}},{name:function(e){return"remove".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new V("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new V("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+e,a=""+i;if(i=arguments[2],!(r=h(this,o,a,n)))throw new j("Graph.".concat(t,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new V("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(r=this._edges.get(e)))throw new j("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return delete r.attributes[i],this.emit("edgeAttributesUpdated",{key:r.key,type:"remove",attributes:r.attributes,name:i}),this}}},{name:function(e){return"replace".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new V("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new V("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+e,a=""+i;if(i=arguments[2],!(r=h(this,o,a,n)))throw new j("Graph.".concat(t,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new V("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(r=this._edges.get(e)))throw new j("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}if(!u(i))throw new U("Graph.".concat(t,": provided attributes are not a plain object."));return r.attributes=i,this.emit("edgeAttributesUpdated",{key:r.key,type:"replace",attributes:r.attributes}),this}}},{name:function(e){return"merge".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new V("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new V("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+e,a=""+i;if(i=arguments[2],!(r=h(this,o,a,n)))throw new j("Graph.".concat(t,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new V("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(r=this._edges.get(e)))throw new j("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}if(!u(i))throw new U("Graph.".concat(t,": provided attributes are not a plain object."));return s(r.attributes,i),this.emit("edgeAttributesUpdated",{key:r.key,type:"merge",attributes:r.attributes,data:i}),this}}},{name:function(e){return"update".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new V("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new V("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+e,a=""+i;if(i=arguments[2],!(r=h(this,o,a,n)))throw new j("Graph.".concat(t,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new V("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(r=this._edges.get(e)))throw new j("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}if("function"!=typeof i)throw new U("Graph.".concat(t,": provided updater is not a function."));return r.attributes=i(r.attributes),this.emit("edgeAttributesUpdated",{key:r.key,type:"update",attributes:r.attributes}),this}}}],J=M,$=z,Q=function(){var e=arguments,t=null,n=-1;return new J((function(){for(var i=null;;){if(null===t){if(++n>=e.length)return{done:!0};t=$(e[n])}if(!0!==(i=t.next()).done)break;t=null}return i}))},ee=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function te(e,t,n,i){var r=!1;for(var o in t)if(o!==i){var a=t[o];if(r=n(a.key,a.attributes,a.source.key,a.target.key,a.source.attributes,a.target.attributes,a.undirected),e&&r)return a.key}}function ne(e,t,n,i){var r,o,a,s=!1;for(var h in t)if(h!==i){r=t[h];do{if(o=r.source,a=r.target,s=n(r.key,r.attributes,o.key,a.key,o.attributes,a.attributes,r.undirected),e&&s)return r.key;r=r.next}while(void 0!==r)}}function ie(e,t){var n,i=Object.keys(e),r=i.length,o=0;return new M((function(){do{if(n)n=n.next;else{if(o>=r)return{done:!0};var a=i[o++];if(a===t){n=void 0;continue}n=e[a]}}while(!n);return{done:!1,value:{edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected}}}))}function re(e,t,n,i){var r=t[n];if(r){var o=r.source,a=r.target;return i(r.key,r.attributes,o.key,a.key,o.attributes,a.attributes,r.undirected)&&e?r.key:void 0}}function oe(e,t,n,i){var r=t[n];if(r){var o=!1;do{if(o=i(r.key,r.attributes,r.source.key,r.target.key,r.source.attributes,r.target.attributes,r.undirected),e&&o)return r.key;r=r.next}while(void 0!==r)}}function ae(e,t){var n=e[t];return void 0!==n.next?new M((function(){if(!n)return{done:!0};var e={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:e}})):M.of({edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected})}function se(e,t,n,i){if(0!==t.size)for(var r,o,a="mixed"!==n&&n!==t.type,s="undirected"===n,h=!1,u=t._edges.values();!0!==(r=u.next()).done;)if(o=r.value,!a||o.undirected===s){var c=o,d=c.key,l=c.attributes,f=c.source,p=c.target;if(h=i(d,l,f.key,p.key,f.attributes,p.attributes,o.undirected),e&&h)return d}}function he(e,t,n,i,r,o){var a,s=t?ne:te;if("undirected"!==n){if("out"!==i&&(a=s(e,r.in,o),e&&a))return a;if("in"!==i&&(a=s(e,r.out,o,i?void 0:r.key),e&&a))return a}if("directed"!==n&&(a=s(e,r.undirected,o),e&&a))return a}function ue(e,t,n,i,r,o,a){var s,h=n?oe:re;if("undirected"!==t){if(void 0!==r.in&&"out"!==i&&(s=h(e,r.in,o,a),e&&s))return s;if(void 0!==r.out&&"in"!==i&&(i||r.key!==o)&&(s=h(e,r.out,o,a),e&&s))return s}if("directed"!==t&&void 0!==r.undirected&&(s=h(e,r.undirected,o,a),e&&s))return s}var ce=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function de(){this.A=null,this.B=null}function le(e,t,n,i,r){for(var o in i){var a=i[o],s=a.source,h=a.target,u=s===n?h:s;if(!t||!t.has(u.key)){var c=r(u.key,u.attributes);if(e&&c)return u.key}}}function fe(e,t,n,i,r){if("mixed"!==t){if("undirected"===t)return le(e,null,i,i.undirected,r);if("string"==typeof n)return le(e,null,i,i[n],r)}var o,a=new de;if("undirected"!==t){if("out"!==n){if(o=le(e,null,i,i.in,r),e&&o)return o;a.wrap(i.in)}if("in"!==n){if(o=le(e,a,i,i.out,r),e&&o)return o;a.wrap(i.out)}}if("directed"!==t&&(o=le(e,a,i,i.undirected,r),e&&o))return o}function pe(e,t,n){var i=Object.keys(n),r=i.length,o=0;return new M((function(){var a=null;do{if(o>=r)return e&&e.wrap(n),{done:!0};var s=n[i[o++]],h=s.source,u=s.target;a=h===t?u:h,e&&e.has(a.key)&&(a=null)}while(null===a);return{done:!1,value:{neighbor:a.key,attributes:a.attributes}}}))}function ge(e,t,n,i,r){for(var o,a,s,h,u,c,d,l=i._nodes.values(),f=i.type;!0!==(o=l.next()).done;){var p=!1;if(a=o.value,"undirected"!==f)for(s in h=a.out){u=h[s];do{if(c=u.target,p=!0,d=r(a.key,c.key,a.attributes,c.attributes,u.key,u.attributes,u.undirected),e&&d)return u;u=u.next}while(u)}if("directed"!==f)for(s in h=a.undirected)if(!(t&&a.key>s)){u=h[s];do{if((c=u.target).key!==s&&(c=u.source),p=!0,d=r(a.key,c.key,a.attributes,c.attributes,u.key,u.attributes,u.undirected),e&&d)return u;u=u.next}while(u)}if(n&&!p&&(d=r(a.key,null,a.attributes,null,null,null,null),e&&d))return null}}function ve(e){if(!u(e))throw new U('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in e))throw new U("Graph.import: serialized node is missing its key.");if("attributes"in e&&(!u(e.attributes)||null===e.attributes))throw new U("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function me(e){if(!u(e))throw new U('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in e))throw new U("Graph.import: serialized edge is missing its source.");if(!("target"in e))throw new U("Graph.import: serialized edge is missing its target.");if("attributes"in e&&(!u(e.attributes)||null===e.attributes))throw new U("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in e&&"boolean"!=typeof e.undirected)throw new U("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}de.prototype.wrap=function(e){null===this.A?this.A=e:null===this.B&&(this.B=e)},de.prototype.has=function(e){return null!==this.A&&e in this.A||null!==this.B&&e in this.B};var ye,be=(ye=255&Math.floor(256*Math.random()),function(){return ye++}),we=new Set(["directed","undirected","mixed"]),xe=new Set(["domain","_events","_eventsCount","_maxListeners"]),Ce={allowSelfLoops:!0,multi:!1,type:"mixed"};function _e(e,t,n){var i=new e.NodeDataClass(t,n);return e._nodes.set(t,i),e.emit("nodeAdded",{key:t,attributes:n}),i}function Ee(e,t,n,i,r,o,a,s){if(!i&&"undirected"===e.type)throw new V("Graph.".concat(t,": you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead."));if(i&&"directed"===e.type)throw new V("Graph.".concat(t,": you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead."));if(s&&!u(s))throw new U("Graph.".concat(t,': invalid attributes. Expecting an object but got "').concat(s,'"'));if(o=""+o,a=""+a,s=s||{},!e.allowSelfLoops&&o===a)throw new V("Graph.".concat(t,': source & target are the same ("').concat(o,"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false."));var h=e._nodes.get(o),c=e._nodes.get(a);if(!h)throw new j("Graph.".concat(t,': source node "').concat(o,'" not found.'));if(!c)throw new j("Graph.".concat(t,': target node "').concat(a,'" not found.'));var d={key:null,undirected:i,source:o,target:a,attributes:s};if(n)r=e._edgeKeyGenerator();else if(r=""+r,e._edges.has(r))throw new V("Graph.".concat(t,': the "').concat(r,'" edge already exists in the graph.'));if(!e.multi&&(i?void 0!==h.undirected[a]:void 0!==h.out[a]))throw new V("Graph.".concat(t,': an edge linking "').concat(o,'" to "').concat(a,"\" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option."));var l=new Z(i,r,h,c,s);e._edges.set(r,l);var f=o===a;return i?(h.undirectedDegree++,c.undirectedDegree++,f&&(h.undirectedLoops++,e._undirectedSelfLoopCount++)):(h.outDegree++,c.inDegree++,f&&(h.directedLoops++,e._directedSelfLoopCount++)),e.multi?l.attachMulti():l.attach(),i?e._undirectedSize++:e._directedSize++,d.key=r,e.emit("edgeAdded",d),r}function ke(e,t,n,i,r,o,a,h,c){if(!i&&"undirected"===e.type)throw new V("Graph.".concat(t,": you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead."));if(i&&"directed"===e.type)throw new V("Graph.".concat(t,": you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead."));if(h)if(c){if("function"!=typeof h)throw new U("Graph.".concat(t,': invalid updater function. Expecting a function but got "').concat(h,'"'))}else if(!u(h))throw new U("Graph.".concat(t,': invalid attributes. Expecting an object but got "').concat(h,'"'));var d;if(o=""+o,a=""+a,c&&(d=h,h=void 0),!e.allowSelfLoops&&o===a)throw new V("Graph.".concat(t,': source & target are the same ("').concat(o,"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false."));var l,f,p=e._nodes.get(o),g=e._nodes.get(a);if(!n&&(l=e._edges.get(r))){if(!(l.source.key===o&&l.target.key===a||i&&l.source.key===a&&l.target.key===o))throw new V("Graph.".concat(t,': inconsistency detected when attempting to merge the "').concat(r,'" edge with "').concat(o,'" source & "').concat(a,'" target vs. ("').concat(l.source.key,'", "').concat(l.target.key,'").'));f=l}if(f||e.multi||!p||(f=i?p.undirected[a]:p.out[a]),f){var v=[f.key,!1,!1,!1];if(c?!d:!h)return v;if(c){var m=f.attributes;f.attributes=d(m),e.emit("edgeAttributesUpdated",{type:"replace",key:f.key,attributes:f.attributes})}else s(f.attributes,h),e.emit("edgeAttributesUpdated",{type:"merge",key:f.key,attributes:f.attributes,data:h});return v}h=h||{},c&&d&&(h=d(h));var y={key:null,undirected:i,source:o,target:a,attributes:h};if(n)r=e._edgeKeyGenerator();else if(r=""+r,e._edges.has(r))throw new V("Graph.".concat(t,': the "').concat(r,'" edge already exists in the graph.'));var b=!1,w=!1;p||(p=_e(e,o,{}),b=!0,o===a&&(g=p,w=!0)),g||(g=_e(e,a,{}),w=!0),l=new Z(i,r,p,g,h),e._edges.set(r,l);var x=o===a;return i?(p.undirectedDegree++,g.undirectedDegree++,x&&(p.undirectedLoops++,e._undirectedSelfLoopCount++)):(p.outDegree++,g.inDegree++,x&&(p.directedLoops++,e._directedSelfLoopCount++)),e.multi?l.attachMulti():l.attach(),i?e._undirectedSize++:e._directedSize++,y.key=r,e.emit("edgeAdded",y),[r,!0,b,w]}function Se(e,t){e._edges.delete(t.key);var n=t.source,i=t.target,r=t.attributes,o=t.undirected,a=n===i;o?(n.undirectedDegree--,i.undirectedDegree--,a&&(n.undirectedLoops--,e._undirectedSelfLoopCount--)):(n.outDegree--,i.inDegree--,a&&(n.directedLoops--,e._directedSelfLoopCount--)),e.multi?t.detachMulti():t.detach(),o?e._undirectedSize--:e._directedSize--,e.emit("edgeDropped",{key:t.key,attributes:r,source:n.key,target:i.key,undirected:o})}var Le=function(n){function i(e){var t;if(t=n.call(this)||this,"boolean"!=typeof(e=s({},Ce,e)).multi)throw new U("Graph.constructor: invalid 'multi' option. Expecting a boolean but got \"".concat(e.multi,'".'));if(!we.has(e.type))throw new U('Graph.constructor: invalid \'type\' option. Should be one of "mixed", "directed" or "undirected" but got "'.concat(e.type,'".'));if("boolean"!=typeof e.allowSelfLoops)throw new U("Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got \"".concat(e.allowSelfLoops,'".'));var i="mixed"===e.type?H:"directed"===e.type?W:q;d(a(t),"NodeDataClass",i);var r="geid_"+be()+"_",o=0;return d(a(t),"_attributes",{}),d(a(t),"_nodes",new Map),d(a(t),"_edges",new Map),d(a(t),"_directedSize",0),d(a(t),"_undirectedSize",0),d(a(t),"_directedSelfLoopCount",0),d(a(t),"_undirectedSelfLoopCount",0),d(a(t),"_edgeKeyGenerator",(function(){var e;do{e=r+o++}while(t._edges.has(e));return e})),d(a(t),"_options",e),xe.forEach((function(e){return d(a(t),e,t[e])})),l(a(t),"order",(function(){return t._nodes.size})),l(a(t),"size",(function(){return t._edges.size})),l(a(t),"directedSize",(function(){return t._directedSize})),l(a(t),"undirectedSize",(function(){return t._undirectedSize})),l(a(t),"selfLoopCount",(function(){return t._directedSelfLoopCount+t._undirectedSelfLoopCount})),l(a(t),"directedSelfLoopCount",(function(){return t._directedSelfLoopCount})),l(a(t),"undirectedSelfLoopCount",(function(){return t._undirectedSelfLoopCount})),l(a(t),"multi",t._options.multi),l(a(t),"type",t._options.type),l(a(t),"allowSelfLoops",t._options.allowSelfLoops),l(a(t),"implementation",(function(){return"graphology"})),t}t(i,n);var r=i.prototype;return r._resetInstanceCounters=function(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0},r.hasNode=function(e){return this._nodes.has(""+e)},r.hasDirectedEdge=function(e,t){if("undirected"===this.type)return!1;if(1===arguments.length){var n=""+e,i=this._edges.get(n);return!!i&&!i.undirected}if(2===arguments.length){e=""+e,t=""+t;var r=this._nodes.get(e);return!!r&&r.out.hasOwnProperty(t)}throw new U("Graph.hasDirectedEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},r.hasUndirectedEdge=function(e,t){if("directed"===this.type)return!1;if(1===arguments.length){var n=""+e,i=this._edges.get(n);return!!i&&i.undirected}if(2===arguments.length){e=""+e,t=""+t;var r=this._nodes.get(e);return!!r&&r.undirected.hasOwnProperty(t)}throw new U("Graph.hasDirectedEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},r.hasEdge=function(e,t){if(1===arguments.length){var n=""+e;return this._edges.has(n)}if(2===arguments.length){e=""+e,t=""+t;var i=this._nodes.get(e);return!!i&&(void 0!==i.out&&i.out.hasOwnProperty(t)||void 0!==i.undirected&&i.undirected.hasOwnProperty(t))}throw new U("Graph.hasEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},r.directedEdge=function(e,t){if("undirected"!==this.type){if(e=""+e,t=""+t,this.multi)throw new V("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");var n=this._nodes.get(e);if(!n)throw new j('Graph.directedEdge: could not find the "'.concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new j('Graph.directedEdge: could not find the "'.concat(t,'" target node in the graph.'));var i=n.out&&n.out[t]||void 0;return i?i.key:void 0}},r.undirectedEdge=function(e,t){if("directed"!==this.type){if(e=""+e,t=""+t,this.multi)throw new V("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");var n=this._nodes.get(e);if(!n)throw new j('Graph.undirectedEdge: could not find the "'.concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new j('Graph.undirectedEdge: could not find the "'.concat(t,'" target node in the graph.'));var i=n.undirected&&n.undirected[t]||void 0;return i?i.key:void 0}},r.edge=function(e,t){if(this.multi)throw new V("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new j('Graph.edge: could not find the "'.concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new j('Graph.edge: could not find the "'.concat(t,'" target node in the graph.'));var i=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(i)return i.key},r.areDirectedNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new j('Graph.areDirectedNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&(t in n.in||t in n.out)},r.areOutNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new j('Graph.areOutNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&t in n.out},r.areInNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new j('Graph.areInNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&t in n.in},r.areUndirectedNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new j('Graph.areUndirectedNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"directed"!==this.type&&t in n.undirected},r.areNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new j('Graph.areNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&(t in n.in||t in n.out)||"directed"!==this.type&&t in n.undirected},r.areInboundNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new j('Graph.areInboundNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&t in n.in||"directed"!==this.type&&t in n.undirected},r.areOutboundNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new j('Graph.areOutboundNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&t in n.out||"directed"!==this.type&&t in n.undirected},r.inDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new j('Graph.inDegree: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.inDegree},r.outDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new j('Graph.outDegree: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.outDegree},r.directedDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new j('Graph.directedDegree: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.inDegree+t.outDegree},r.undirectedDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new j('Graph.undirectedDegree: could not find the "'.concat(e,'" node in the graph.'));return"directed"===this.type?0:t.undirectedDegree},r.inboundDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new j('Graph.inboundDegree: could not find the "'.concat(e,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=t.undirectedDegree),"undirected"!==this.type&&(n+=t.inDegree),n},r.outboundDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new j('Graph.outboundDegree: could not find the "'.concat(e,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=t.undirectedDegree),"undirected"!==this.type&&(n+=t.outDegree),n},r.degree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new j('Graph.degree: could not find the "'.concat(e,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=t.undirectedDegree),"undirected"!==this.type&&(n+=t.inDegree+t.outDegree),n},r.inDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new j('Graph.inDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.inDegree-t.directedLoops},r.outDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new j('Graph.outDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.outDegree-t.directedLoops},r.directedDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new j('Graph.directedDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.inDegree+t.outDegree-2*t.directedLoops},r.undirectedDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new j('Graph.undirectedDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));return"directed"===this.type?0:t.undirectedDegree-2*t.undirectedLoops},r.inboundDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new j('Graph.inboundDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));var n=0,i=0;return"directed"!==this.type&&(n+=t.undirectedDegree,i+=2*t.undirectedLoops),"undirected"!==this.type&&(n+=t.inDegree,i+=t.directedLoops),n-i},r.outboundDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new j('Graph.outboundDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));var n=0,i=0;return"directed"!==this.type&&(n+=t.undirectedDegree,i+=2*t.undirectedLoops),"undirected"!==this.type&&(n+=t.outDegree,i+=t.directedLoops),n-i},r.degreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new j('Graph.degreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));var n=0,i=0;return"directed"!==this.type&&(n+=t.undirectedDegree,i+=2*t.undirectedLoops),"undirected"!==this.type&&(n+=t.inDegree+t.outDegree,i+=2*t.directedLoops),n-i},r.source=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new j('Graph.source: could not find the "'.concat(e,'" edge in the graph.'));return t.source.key},r.target=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new j('Graph.target: could not find the "'.concat(e,'" edge in the graph.'));return t.target.key},r.extremities=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new j('Graph.extremities: could not find the "'.concat(e,'" edge in the graph.'));return[t.source.key,t.target.key]},r.opposite=function(e,t){e=""+e,t=""+t;var n=this._edges.get(t);if(!n)throw new j('Graph.opposite: could not find the "'.concat(t,'" edge in the graph.'));var i=n.source.key,r=n.target.key;if(e===i)return r;if(e===r)return i;throw new j('Graph.opposite: the "'.concat(e,'" node is not attached to the "').concat(t,'" edge (').concat(i,", ").concat(r,")."))},r.hasExtremity=function(e,t){e=""+e,t=""+t;var n=this._edges.get(e);if(!n)throw new j('Graph.hasExtremity: could not find the "'.concat(e,'" edge in the graph.'));return n.source.key===t||n.target.key===t},r.isUndirected=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new j('Graph.isUndirected: could not find the "'.concat(e,'" edge in the graph.'));return t.undirected},r.isDirected=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new j('Graph.isDirected: could not find the "'.concat(e,'" edge in the graph.'));return!t.undirected},r.isSelfLoop=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new j('Graph.isSelfLoop: could not find the "'.concat(e,'" edge in the graph.'));return t.source===t.target},r.addNode=function(e,t){var n=function(e,t,n){if(n&&!u(n))throw new U('Graph.addNode: invalid attributes. Expecting an object but got "'.concat(n,'"'));if(t=""+t,n=n||{},e._nodes.has(t))throw new V('Graph.addNode: the "'.concat(t,'" node already exist in the graph.'));var i=new e.NodeDataClass(t,n);return e._nodes.set(t,i),e.emit("nodeAdded",{key:t,attributes:n}),i}(this,e,t);return n.key},r.mergeNode=function(e,t){if(t&&!u(t))throw new U('Graph.mergeNode: invalid attributes. Expecting an object but got "'.concat(t,'"'));e=""+e,t=t||{};var n=this._nodes.get(e);return n?(t&&(s(n.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:e,attributes:n.attributes,data:t})),[e,!1]):(n=new this.NodeDataClass(e,t),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:t}),[e,!0])},r.updateNode=function(e,t){if(t&&"function"!=typeof t)throw new U('Graph.updateNode: invalid updater function. Expecting a function but got "'.concat(t,'"'));e=""+e;var n=this._nodes.get(e);if(n){if(t){var i=n.attributes;n.attributes=t(i),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:n.attributes})}return[e,!1]}var r=t?t({}):{};return n=new this.NodeDataClass(e,r),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:r}),[e,!0]},r.dropNode=function(e){e=""+e;var t,n=this._nodes.get(e);if(!n)throw new j('Graph.dropNode: could not find the "'.concat(e,'" node in the graph.'));if("undirected"!==this.type){for(var i in n.out){t=n.out[i];do{Se(this,t),t=t.next}while(t)}for(var r in n.in){t=n.in[r];do{Se(this,t),t=t.next}while(t)}}if("directed"!==this.type)for(var o in n.undirected){t=n.undirected[o];do{Se(this,t),t=t.next}while(t)}this._nodes.delete(e),this.emit("nodeDropped",{key:e,attributes:n.attributes})},r.dropEdge=function(e){var t;if(arguments.length>1){var n=""+arguments[0],i=""+arguments[1];if(!(t=h(this,n,i,this.type)))throw new j('Graph.dropEdge: could not find the "'.concat(n,'" -> "').concat(i,'" edge in the graph.'))}else if(e=""+e,!(t=this._edges.get(e)))throw new j('Graph.dropEdge: could not find the "'.concat(e,'" edge in the graph.'));return Se(this,t),this},r.dropDirectedEdge=function(e,t){if(arguments.length<2)throw new V("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new V("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");var n=h(this,e=""+e,t=""+t,"directed");if(!n)throw new j('Graph.dropDirectedEdge: could not find a "'.concat(e,'" -> "').concat(t,'" edge in the graph.'));return Se(this,n),this},r.dropUndirectedEdge=function(e,t){if(arguments.length<2)throw new V("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new V("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");var n=h(this,e,t,"undirected");if(!n)throw new j('Graph.dropUndirectedEdge: could not find a "'.concat(e,'" -> "').concat(t,'" edge in the graph.'));return Se(this,n),this},r.clear=function(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")},r.clearEdges=function(){for(var e,t=this._nodes.values();!0!==(e=t.next()).done;)e.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")},r.getAttribute=function(e){return this._attributes[e]},r.getAttributes=function(){return this._attributes},r.hasAttribute=function(e){return this._attributes.hasOwnProperty(e)},r.setAttribute=function(e,t){return this._attributes[e]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this},r.updateAttribute=function(e,t){if("function"!=typeof t)throw new U("Graph.updateAttribute: updater should be a function.");var n=this._attributes[e];return this._attributes[e]=t(n),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this},r.removeAttribute=function(e){return delete this._attributes[e],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:e}),this},r.replaceAttributes=function(e){if(!u(e))throw new U("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=e,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this},r.mergeAttributes=function(e){if(!u(e))throw new U("Graph.mergeAttributes: provided attributes are not a plain object.");return s(this._attributes,e),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:e}),this},r.updateAttributes=function(e){if("function"!=typeof e)throw new U("Graph.updateAttributes: provided updater is not a function.");return this._attributes=e(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this},r.updateEachNodeAttributes=function(e,t){if("function"!=typeof e)throw new U("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!f(t))throw new U("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var n,i,r=this._nodes.values();!0!==(n=r.next()).done;)(i=n.value).attributes=e(i.key,i.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})},r.updateEachEdgeAttributes=function(e,t){if("function"!=typeof e)throw new U("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!f(t))throw new U("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var n,i,r,o,a=this._edges.values();!0!==(n=a.next()).done;)r=(i=n.value).source,o=i.target,i.attributes=e(i.key,i.attributes,r.key,o.key,r.attributes,o.attributes,i.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})},r.forEachAdjacencyEntry=function(e){if("function"!=typeof e)throw new U("Graph.forEachAdjacencyEntry: expecting a callback.");ge(!1,!1,!1,this,e)},r.forEachAdjacencyEntryWithOrphans=function(e){if("function"!=typeof e)throw new U("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");ge(!1,!1,!0,this,e)},r.forEachAssymetricAdjacencyEntry=function(e){if("function"!=typeof e)throw new U("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");ge(!1,!0,!1,this,e)},r.forEachAssymetricAdjacencyEntryWithOrphans=function(e){if("function"!=typeof e)throw new U("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");ge(!1,!0,!0,this,e)},r.nodes=function(){return"function"==typeof Array.from?Array.from(this._nodes.keys()):I(this._nodes.keys(),this._nodes.size)},r.forEachNode=function(e){if("function"!=typeof e)throw new U("Graph.forEachNode: expecting a callback.");for(var t,n,i=this._nodes.values();!0!==(t=i.next()).done;)e((n=t.value).key,n.attributes)},r.findNode=function(e){if("function"!=typeof e)throw new U("Graph.findNode: expecting a callback.");for(var t,n,i=this._nodes.values();!0!==(t=i.next()).done;)if(e((n=t.value).key,n.attributes))return n.key},r.mapNodes=function(e){if("function"!=typeof e)throw new U("Graph.mapNode: expecting a callback.");for(var t,n,i=this._nodes.values(),r=new Array(this.order),o=0;!0!==(t=i.next()).done;)n=t.value,r[o++]=e(n.key,n.attributes);return r},r.someNode=function(e){if("function"!=typeof e)throw new U("Graph.someNode: expecting a callback.");for(var t,n,i=this._nodes.values();!0!==(t=i.next()).done;)if(e((n=t.value).key,n.attributes))return!0;return!1},r.everyNode=function(e){if("function"!=typeof e)throw new U("Graph.everyNode: expecting a callback.");for(var t,n,i=this._nodes.values();!0!==(t=i.next()).done;)if(!e((n=t.value).key,n.attributes))return!1;return!0},r.filterNodes=function(e){if("function"!=typeof e)throw new U("Graph.filterNodes: expecting a callback.");for(var t,n,i=this._nodes.values(),r=[];!0!==(t=i.next()).done;)e((n=t.value).key,n.attributes)&&r.push(n.key);return r},r.reduceNodes=function(e,t){if("function"!=typeof e)throw new U("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new U("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");for(var n,i,r=t,o=this._nodes.values();!0!==(n=o.next()).done;)r=e(r,(i=n.value).key,i.attributes);return r},r.nodeEntries=function(){var e=this._nodes.values();return new M((function(){var t=e.next();if(t.done)return t;var n=t.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}))},r.export=function(){var e=this,t=new Array(this._nodes.size),n=0;this._nodes.forEach((function(e,i){t[n++]=function(e,t){var n={key:e};return c(t.attributes)||(n.attributes=s({},t.attributes)),n}(i,e)}));var i=new Array(this._edges.size);return n=0,this._edges.forEach((function(t,r){i[n++]=function(e,t,n){var i={key:t,source:n.source.key,target:n.target.key};return c(n.attributes)||(i.attributes=s({},n.attributes)),"mixed"===e&&n.undirected&&(i.undirected=!0),i}(e.type,r,t)})),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:t,edges:i}},r.import=function(e){var t,n,r,o,a,s=this,h=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e instanceof i)return e.forEachNode((function(e,t){h?s.mergeNode(e,t):s.addNode(e,t)})),e.forEachEdge((function(e,t,n,i,r,o,a){h?a?s.mergeUndirectedEdgeWithKey(e,n,i,t):s.mergeDirectedEdgeWithKey(e,n,i,t):a?s.addUndirectedEdgeWithKey(e,n,i,t):s.addDirectedEdgeWithKey(e,n,i,t)})),this;if(!u(e))throw new U("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!u(e.attributes))throw new U("Graph.import: invalid attributes. Expecting a plain object.");h?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}if(e.nodes){if(r=e.nodes,!Array.isArray(r))throw new U("Graph.import: invalid nodes. Expecting an array.");for(t=0,n=r.length;t<n;t++){ve(o=r[t]);var c=o,d=c.key,l=c.attributes;h?this.mergeNode(d,l):this.addNode(d,l)}}if(e.edges){var f=!1;if("undirected"===this.type&&(f=!0),r=e.edges,!Array.isArray(r))throw new U("Graph.import: invalid edges. Expecting an array.");for(t=0,n=r.length;t<n;t++){me(a=r[t]);var p=a,g=p.source,v=p.target,m=p.attributes,y=p.undirected,b=void 0===y?f:y;"key"in a?(h?b?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:b?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey).call(this,a.key,g,v,m):(h?b?this.mergeUndirectedEdge:this.mergeDirectedEdge:b?this.addUndirectedEdge:this.addDirectedEdge).call(this,g,v,m)}}return this},r.nullCopy=function(e){var t=new i(s({},this._options,e));return t.replaceAttributes(s({},this.getAttributes())),t},r.emptyCopy=function(e){var t=this.nullCopy(e);return this._nodes.forEach((function(e,n){var i=s({},e.attributes);e=new t.NodeDataClass(n,i),t._nodes.set(n,e)})),t},r.copy=function(e){if("string"==typeof(e=e||{}).type&&e.type!==this.type&&"mixed"!==e.type)throw new V('Graph.copy: cannot create an incompatible copy from "'.concat(this.type,'" type to "').concat(e.type,'" because this would mean losing information about the current graph.'));if("boolean"==typeof e.multi&&e.multi!==this.multi&&!0!==e.multi)throw new V("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if("boolean"==typeof e.allowSelfLoops&&e.allowSelfLoops!==this.allowSelfLoops&&!0!==e.allowSelfLoops)throw new V("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");for(var t,n,i=this.emptyCopy(e),r=this._edges.values();!0!==(t=r.next()).done;)Ee(i,"copy",!1,(n=t.value).undirected,n.key,n.source.key,n.target.key,s({},n.attributes));return i},r.toJSON=function(){return this.export()},r.toString=function(){return"[object Graph]"},r.inspect=function(){var t=this,n={};this._nodes.forEach((function(e,t){n[t]=e.attributes}));var i={},r={};this._edges.forEach((function(e,n){var o,a=e.undirected?"--":"->",s="",h=e.source.key,u=e.target.key;e.undirected&&h>u&&(o=h,h=u,u=o);var c="(".concat(h,")").concat(a,"(").concat(u,")");n.startsWith("geid_")?t.multi&&(void 0===r[c]?r[c]=0:r[c]++,s+="".concat(r[c],". ")):s+="[".concat(n,"]: "),i[s+=c]=e.attributes}));var o={};for(var a in this)this.hasOwnProperty(a)&&!xe.has(a)&&"function"!=typeof this[a]&&"symbol"!==e(a)&&(o[a]=this[a]);return o.attributes=this._attributes,o.nodes=n,o.edges=i,d(o,"constructor",this.constructor),o},i}(g.exports.EventEmitter);"undefined"!=typeof Symbol&&(Le.prototype[Symbol.for("nodejs.util.inspect.custom")]=Le.prototype.inspect),[{name:function(e){return"".concat(e,"Edge")},generateKey:!0},{name:function(e){return"".concat(e,"DirectedEdge")},generateKey:!0,type:"directed"},{name:function(e){return"".concat(e,"UndirectedEdge")},generateKey:!0,type:"undirected"},{name:function(e){return"".concat(e,"EdgeWithKey")}},{name:function(e){return"".concat(e,"DirectedEdgeWithKey")},type:"directed"},{name:function(e){return"".concat(e,"UndirectedEdgeWithKey")},type:"undirected"}].forEach((function(e){["add","merge","update"].forEach((function(t){var n=e.name(t),i="add"===t?Ee:ke;e.generateKey?Le.prototype[n]=function(r,o,a){return i(this,n,!0,"undirected"===(e.type||this.type),null,r,o,a,"update"===t)}:Le.prototype[n]=function(r,o,a,s){return i(this,n,!1,"undirected"===(e.type||this.type),r,o,a,s,"update"===t)}}))})),function(e){X.forEach((function(t){var n=t.name,i=t.attacher;i(e,n("Node"),0),i(e,n("Source"),1),i(e,n("Target"),2),i(e,n("Opposite"),3)}))}(Le),function(e){K.forEach((function(t){var n=t.name,i=t.attacher;i(e,n("Edge"),"mixed"),i(e,n("DirectedEdge"),"directed"),i(e,n("UndirectedEdge"),"undirected")}))}(Le),function(e){ee.forEach((function(t){!function(e,t){var n=t.name,i=t.type,r=t.direction;e.prototype[n]=function(e,t){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return[];if(!arguments.length)return function(e,t){if(0===e.size)return[];if("mixed"===t||t===e.type)return"function"==typeof Array.from?Array.from(e._edges.keys()):I(e._edges.keys(),e._edges.size);for(var n,i,r="undirected"===t?e.undirectedSize:e.directedSize,o=new Array(r),a="undirected"===t,s=e._edges.values(),h=0;!0!==(n=s.next()).done;)(i=n.value).undirected===a&&(o[h++]=i.key);return o}(this,i);if(1===arguments.length){e=""+e;var o=this._nodes.get(e);if(void 0===o)throw new j("Graph.".concat(n,': could not find the "').concat(e,'" node in the graph.'));return function(e,t,n,i){var r=[];return he(!1,e,t,n,i,(function(e){r.push(e)})),r}(this.multi,"mixed"===i?this.type:i,r,o)}if(2===arguments.length){e=""+e,t=""+t;var a=this._nodes.get(e);if(!a)throw new j("Graph.".concat(n,': could not find the "').concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new j("Graph.".concat(n,': could not find the "').concat(t,'" target node in the graph.'));return function(e,t,n,i,r){var o=[];return ue(!1,e,t,n,i,r,(function(e){o.push(e)})),o}(i,this.multi,r,a,t)}throw new U("Graph.".concat(n,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(e,t),function(e,t){var n=t.name,i=t.type,r=t.direction,o="forEach"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[o]=function(e,t,n){if("mixed"===i||"mixed"===this.type||i===this.type){if(1===arguments.length)return se(!1,this,i,n=e);if(2===arguments.length){e=""+e,n=t;var a=this._nodes.get(e);if(void 0===a)throw new j("Graph.".concat(o,': could not find the "').concat(e,'" node in the graph.'));return he(!1,this.multi,"mixed"===i?this.type:i,r,a,n)}if(3===arguments.length){e=""+e,t=""+t;var s=this._nodes.get(e);if(!s)throw new j("Graph.".concat(o,': could not find the "').concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new j("Graph.".concat(o,': could not find the "').concat(t,'" target node in the graph.'));return ue(!1,i,this.multi,r,s,t,n)}throw new U("Graph.".concat(o,": too many arguments (expecting 1, 2 or 3 and got ").concat(arguments.length,")."))}};var a="map"+n[0].toUpperCase()+n.slice(1);e.prototype[a]=function(){var e,t=Array.prototype.slice.call(arguments),n=t.pop();if(0===t.length){var r=0;"directed"!==i&&(r+=this.undirectedSize),"undirected"!==i&&(r+=this.directedSize),e=new Array(r);var a=0;t.push((function(t,i,r,o,s,h,u){e[a++]=n(t,i,r,o,s,h,u)}))}else e=[],t.push((function(t,i,r,o,a,s,h){e.push(n(t,i,r,o,a,s,h))}));return this[o].apply(this,t),e};var s="filter"+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(){var e=Array.prototype.slice.call(arguments),t=e.pop(),n=[];return e.push((function(e,i,r,o,a,s,h){t(e,i,r,o,a,s,h)&&n.push(e)})),this[o].apply(this,e),n};var h="reduce"+n[0].toUpperCase()+n.slice(1);e.prototype[h]=function(){var e,t,n=Array.prototype.slice.call(arguments);if(n.length<2||n.length>4)throw new U("Graph.".concat(h,": invalid number of arguments (expecting 2, 3 or 4 and got ").concat(n.length,")."));if("function"==typeof n[n.length-1]&&"function"!=typeof n[n.length-2])throw new U("Graph.".concat(h,": missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array."));2===n.length?(e=n[0],t=n[1],n=[]):3===n.length?(e=n[1],t=n[2],n=[n[0]]):4===n.length&&(e=n[2],t=n[3],n=[n[0],n[1]]);var i=t;return n.push((function(t,n,r,o,a,s,h){i=e(i,t,n,r,o,a,s,h)})),this[o].apply(this,n),i}}(e,t),function(e,t){var n=t.name,i=t.type,r=t.direction,o="find"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[o]=function(e,t,n){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return!1;if(1===arguments.length)return se(!0,this,i,n=e);if(2===arguments.length){e=""+e,n=t;var a=this._nodes.get(e);if(void 0===a)throw new j("Graph.".concat(o,': could not find the "').concat(e,'" node in the graph.'));return he(!0,this.multi,"mixed"===i?this.type:i,r,a,n)}if(3===arguments.length){e=""+e,t=""+t;var s=this._nodes.get(e);if(!s)throw new j("Graph.".concat(o,': could not find the "').concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new j("Graph.".concat(o,': could not find the "').concat(t,'" target node in the graph.'));return ue(!0,i,this.multi,r,s,t,n)}throw new U("Graph.".concat(o,": too many arguments (expecting 1, 2 or 3 and got ").concat(arguments.length,")."))};var a="some"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(){var e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((function(e,n,i,r,o,a,s){return t(e,n,i,r,o,a,s)})),!!this[o].apply(this,e)};var s="every"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(){var e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((function(e,n,i,r,o,a,s){return!t(e,n,i,r,o,a,s)})),!this[o].apply(this,e)}}(e,t),function(e,t){var n=t.name,i=t.type,r=t.direction,o=n.slice(0,-1)+"Entries";e.prototype[o]=function(e,t){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return M.empty();if(!arguments.length)return function(e,t){if(0===e.size)return M.empty();var n="mixed"!==t&&t!==e.type,i="undirected"===t,r=e._edges.values();return new M((function(){for(var e,t;;){if((e=r.next()).done)return e;if(t=e.value,!n||t.undirected===i)break}return{value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected},done:!1}}))}(this,i);if(1===arguments.length){e=""+e;var n=this._nodes.get(e);if(!n)throw new j("Graph.".concat(o,': could not find the "').concat(e,'" node in the graph.'));return function(e,t,n){var i=M.empty();return"undirected"!==e&&("out"!==t&&void 0!==n.in&&(i=Q(i,ie(n.in))),"in"!==t&&void 0!==n.out&&(i=Q(i,ie(n.out,t?void 0:n.key)))),"directed"!==e&&void 0!==n.undirected&&(i=Q(i,ie(n.undirected))),i}(i,r,n)}if(2===arguments.length){e=""+e,t=""+t;var a=this._nodes.get(e);if(!a)throw new j("Graph.".concat(o,': could not find the "').concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new j("Graph.".concat(o,': could not find the "').concat(t,'" target node in the graph.'));return function(e,t,n,i){var r=M.empty();return"undirected"!==e&&(void 0!==n.in&&"out"!==t&&i in n.in&&(r=Q(r,ae(n.in,i))),void 0!==n.out&&"in"!==t&&i in n.out&&(t||n.key!==i)&&(r=Q(r,ae(n.out,i)))),"directed"!==e&&void 0!==n.undirected&&i in n.undirected&&(r=Q(r,ae(n.undirected,i))),r}(i,r,a,t)}throw new U("Graph.".concat(o,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(e,t)}))}(Le),function(e){ce.forEach((function(t){(function(e,t){var n=t.name,i=t.type,r=t.direction;e.prototype[n]=function(e){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return[];e=""+e;var t=this._nodes.get(e);if(void 0===t)throw new j("Graph.".concat(n,': could not find the "').concat(e,'" node in the graph.'));return function(e,t,n){if("mixed"!==e){if("undirected"===e)return Object.keys(n.undirected);if("string"==typeof t)return Object.keys(n[t])}var i=[];return fe(!1,e,t,n,(function(e){i.push(e)})),i}("mixed"===i?this.type:i,r,t)}})(e,t),function(e,t){var n=t.name,i=t.type,r=t.direction,o="forEach"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[o]=function(e,t){if("mixed"===i||"mixed"===this.type||i===this.type){e=""+e;var n=this._nodes.get(e);if(void 0===n)throw new j("Graph.".concat(o,': could not find the "').concat(e,'" node in the graph.'));fe(!1,"mixed"===i?this.type:i,r,n,t)}};var a="map"+n[0].toUpperCase()+n.slice(1);e.prototype[a]=function(e,t){var n=[];return this[o](e,(function(e,i){n.push(t(e,i))})),n};var s="filter"+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(e,t){var n=[];return this[o](e,(function(e,i){t(e,i)&&n.push(e)})),n};var h="reduce"+n[0].toUpperCase()+n.slice(1);e.prototype[h]=function(e,t,n){if(arguments.length<3)throw new U("Graph.".concat(h,": missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array."));var i=n;return this[o](e,(function(e,n){i=t(i,e,n)})),i}}(e,t),function(e,t){var n=t.name,i=t.type,r=t.direction,o=n[0].toUpperCase()+n.slice(1,-1),a="find"+o;e.prototype[a]=function(e,t){if("mixed"===i||"mixed"===this.type||i===this.type){e=""+e;var n=this._nodes.get(e);if(void 0===n)throw new j("Graph.".concat(a,': could not find the "').concat(e,'" node in the graph.'));return fe(!0,"mixed"===i?this.type:i,r,n,t)}};var s="some"+o;e.prototype[s]=function(e,t){return!!this[a](e,t)};var h="every"+o;e.prototype[h]=function(e,t){return!this[a](e,(function(e,n){return!t(e,n)}))}}(e,t),function(e,t){var n=t.name,i=t.type,r=t.direction,o=n.slice(0,-1)+"Entries";e.prototype[o]=function(e){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return M.empty();e=""+e;var t=this._nodes.get(e);if(void 0===t)throw new j("Graph.".concat(o,': could not find the "').concat(e,'" node in the graph.'));return function(e,t,n){if("mixed"!==e){if("undirected"===e)return pe(null,n,n.undirected);if("string"==typeof t)return pe(null,n,n[t])}var i=M.empty(),r=new de;return"undirected"!==e&&("out"!==t&&(i=Q(i,pe(r,n,n.in))),"in"!==t&&(i=Q(i,pe(r,n,n.out)))),"directed"!==e&&(i=Q(i,pe(r,n,n.undirected))),i}("mixed"===i?this.type:i,r,t)}}(e,t)}))}(Le);var Ne=function(e){function n(t){var n=s({type:"directed"},t);if("multi"in n&&!1!==n.multi)throw new U("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("directed"!==n.type)throw new U('DirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(Le),Ae=function(e){function n(t){var n=s({type:"undirected"},t);if("multi"in n&&!1!==n.multi)throw new U("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("undirected"!==n.type)throw new U('UndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(Le),Te=function(e){function n(t){var n=s({multi:!0},t);if("multi"in n&&!0!==n.multi)throw new U("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");return e.call(this,n)||this}return t(n,e),n}(Le),Me=function(e){function n(t){var n=s({type:"directed",multi:!0},t);if("multi"in n&&!0!==n.multi)throw new U("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("directed"!==n.type)throw new U('MultiDirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(Le),De=function(e){function n(t){var n=s({type:"undirected",multi:!0},t);if("multi"in n&&!0!==n.multi)throw new U("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("undirected"!==n.type)throw new U('MultiUndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(Le);function Re(e){e.from=function(t,n){var i=s({},t.options,n),r=new e(i);return r.import(t),r}}return Re(Le),Re(Ne),Re(Ae),Re(Te),Re(Me),Re(De),Le.Graph=Le,Le.DirectedGraph=Ne,Le.UndirectedGraph=Ae,Le.MultiGraph=Te,Le.MultiDirectedGraph=Me,Le.MultiUndirectedGraph=De,Le.InvalidArgumentsGraphError=U,Le.NotFoundGraphError=j,Le.UsageGraphError=V,Le}()}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{"use strict";function e(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(t,n){for(var i=0;i<n.length;i++){var r=n[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,e(r.key),r)}}function o(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(s=function(){return!!e})()}function h(e,t,n){return t=a(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,s()?Reflect.construct(t,n||[],a(e).constructor):t.apply(e,n))}function u(e,t){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},u(e,t)}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function l(e,t){if(e){if("string"==typeof e)return d(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,o,a,s=[],h=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;h=!1}else for(;!(h=(i=o.call(n)).done)&&(s.push(i.value),s.length!==t);h=!0);}catch(e){u=!0,r=e}finally{try{if(!h&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw r}}return s}}(e,t)||l(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}n.r(i),n.d(i,{ForceAtlasAnimator:()=>dn,GraphManager:()=>Sn,GraphView:()=>Dn,LinearAnimator:()=>Nn,MultiResolutionGraph:()=>Kn,getLayoutSettings:()=>wn,initialGraphLayout:()=>pn,relativeComponentLayout:()=>an});var p={black:"#000000",silver:"#C0C0C0",gray:"#808080",grey:"#808080",white:"#FFFFFF",maroon:"#800000",red:"#FF0000",purple:"#800080",fuchsia:"#FF00FF",green:"#008000",lime:"#00FF00",olive:"#808000",yellow:"#FFFF00",navy:"#000080",blue:"#0000FF",teal:"#008080",aqua:"#00FFFF",darkblue:"#00008B",mediumblue:"#0000CD",darkgreen:"#006400",darkcyan:"#008B8B",deepskyblue:"#00BFFF",darkturquoise:"#00CED1",mediumspringgreen:"#00FA9A",springgreen:"#00FF7F",cyan:"#00FFFF",midnightblue:"#191970",dodgerblue:"#1E90FF",lightseagreen:"#20B2AA",forestgreen:"#228B22",seagreen:"#2E8B57",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",limegreen:"#32CD32",mediumseagreen:"#3CB371",turquoise:"#40E0D0",royalblue:"#4169E1",steelblue:"#4682B4",darkslateblue:"#483D8B",mediumturquoise:"#48D1CC",indigo:"#4B0082",darkolivegreen:"#556B2F",cadetblue:"#5F9EA0",cornflowerblue:"#6495ED",rebeccapurple:"#663399",mediumaquamarine:"#66CDAA",dimgray:"#696969",dimgrey:"#696969",slateblue:"#6A5ACD",olivedrab:"#6B8E23",slategray:"#708090",slategrey:"#708090",lightslategray:"#778899",lightslategrey:"#778899",mediumslateblue:"#7B68EE",lawngreen:"#7CFC00",chartreuse:"#7FFF00",aquamarine:"#7FFFD4",skyblue:"#87CEEB",lightskyblue:"#87CEFA",blueviolet:"#8A2BE2",darkred:"#8B0000",darkmagenta:"#8B008B",saddlebrown:"#8B4513",darkseagreen:"#8FBC8F",lightgreen:"#90EE90",mediumpurple:"#9370DB",darkviolet:"#9400D3",palegreen:"#98FB98",darkorchid:"#9932CC",yellowgreen:"#9ACD32",sienna:"#A0522D",brown:"#A52A2A",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",lightblue:"#ADD8E6",greenyellow:"#ADFF2F",paleturquoise:"#AFEEEE",lightsteelblue:"#B0C4DE",powderblue:"#B0E0E6",firebrick:"#B22222",darkgoldenrod:"#B8860B",mediumorchid:"#BA55D3",rosybrown:"#BC8F8F",darkkhaki:"#BDB76B",mediumvioletred:"#C71585",indianred:"#CD5C5C",peru:"#CD853F",chocolate:"#D2691E",tan:"#D2B48C",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",thistle:"#D8BFD8",orchid:"#DA70D6",goldenrod:"#DAA520",palevioletred:"#DB7093",crimson:"#DC143C",gainsboro:"#DCDCDC",plum:"#DDA0DD",burlywood:"#DEB887",lightcyan:"#E0FFFF",lavender:"#E6E6FA",darksalmon:"#E9967A",violet:"#EE82EE",palegoldenrod:"#EEE8AA",lightcoral:"#F08080",khaki:"#F0E68C",aliceblue:"#F0F8FF",honeydew:"#F0FFF0",azure:"#F0FFFF",sandybrown:"#F4A460",wheat:"#F5DEB3",beige:"#F5F5DC",whitesmoke:"#F5F5F5",mintcream:"#F5FFFA",ghostwhite:"#F8F8FF",salmon:"#FA8072",antiquewhite:"#FAEBD7",linen:"#FAF0E6",lightgoldenrodyellow:"#FAFAD2",oldlace:"#FDF5E6",magenta:"#FF00FF",deeppink:"#FF1493",orangered:"#FF4500",tomato:"#FF6347",hotpink:"#FF69B4",coral:"#FF7F50",darkorange:"#FF8C00",lightsalmon:"#FFA07A",orange:"#FFA500",lightpink:"#FFB6C1",pink:"#FFC0CB",gold:"#FFD700",peachpuff:"#FFDAB9",navajowhite:"#FFDEAD",moccasin:"#FFE4B5",bisque:"#FFE4C4",mistyrose:"#FFE4E1",blanchedalmond:"#FFEBCD",papayawhip:"#FFEFD5",lavenderblush:"#FFF0F5",seashell:"#FFF5EE",cornsilk:"#FFF8DC",lemonchiffon:"#FFFACD",floralwhite:"#FFFAF0",snow:"#FFFAFA",lightyellow:"#FFFFE0",ivory:"#FFFFF0"},g=new Int8Array(4),v=new Int32Array(g.buffer,0,1),m=new Float32Array(g.buffer,0,1),y=/^\s*rgba?\s*\(/,b=/^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)(?:\s*,\s*(.*)?)?\)\s*$/,w={};for(var x in p)w[x]=_(p[x]),w[p[x]]=w[x];function C(e,t,n,i,r){return v[0]=i<<24|n<<16|t<<8|e,r&&(v[0]=4278190079&v[0]),m[0]}function _(e){if(e=e.toLowerCase(),void 0!==w[e])return w[e];var t=function(e){var t=0,n=0,i=0,r=1;if("#"===e[0])4===e.length?(t=parseInt(e.charAt(1)+e.charAt(1),16),n=parseInt(e.charAt(2)+e.charAt(2),16),i=parseInt(e.charAt(3)+e.charAt(3),16)):(t=parseInt(e.charAt(1)+e.charAt(2),16),n=parseInt(e.charAt(3)+e.charAt(4),16),i=parseInt(e.charAt(5)+e.charAt(6),16)),9===e.length&&(r=parseInt(e.charAt(7)+e.charAt(8),16)/255);else if(y.test(e)){var o=e.match(b);o&&(t=+o[1],n=+o[2],i=+o[3],o[4]&&(r=+o[4]))}return{r:t,g:n,b:i,a:r}}(e),n=t.r,i=t.g,r=t.b,o=t.a,a=C(n,i,r,o=255*o|0,!0);return w[e]=a,a}var E={};function k(e){if(void 0!==E[e])return E[e];var t=C((16711680&e)>>>16,(65280&e)>>>8,255&e,255,!0);return E[e]=t,t}function S(e,t,n,i){return n+(t<<8)+(e<<16)}function L(e,t,n,i,r,o){var a=Math.floor(n/o*r),s=Math.floor(e.drawingBufferHeight/o-i/o*r),h=new Uint8Array(4);e.bindFramebuffer(e.FRAMEBUFFER,t),e.readPixels(a,s,1,1,e.RGBA,e.UNSIGNED_BYTE,h);var u=f(h,4);return[u[0],u[1],u[2],u[3]]}function N(t,n,i){return(n=e(n))in t?Object.defineProperty(t,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[n]=i,t}function A(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function T(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?A(Object(n),!0).forEach((function(t){N(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):A(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function M(){return M="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var i=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=a(e)););return e}(e,t);if(i){var r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}},M.apply(null,arguments)}function D(e,t,n,i){var r=M(a(1&i?e.prototype:e),t,n);return 2&i&&"function"==typeof r?function(e){return r.apply(n,e)}:r}function R(e){var t=0;return e.forEach((function(e){return t+=function(e){return e.normalized?1:e.size}(e)})),t}function G(e,t,n){var i="VERTEX"===e?t.VERTEX_SHADER:t.FRAGMENT_SHADER,r=t.createShader(i);if(null===r)throw new Error("loadShader: error while creating the shader");if(t.shaderSource(r,n),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)){var o=t.getShaderInfoLog(r);throw t.deleteShader(r),new Error("loadShader: error while compiling the shader:\n".concat(o,"\n").concat(n))}return r}function P(e){var t=e.gl,n=e.buffer,i=e.program,r=e.vertexShader,o=e.fragmentShader;t.deleteShader(r),t.deleteShader(o),t.deleteProgram(i),t.deleteBuffer(n)}var F="#define PICKING_MODE\n",z=N(N(N(N(N(N(N(N({},WebGL2RenderingContext.BOOL,1),WebGL2RenderingContext.BYTE,1),WebGL2RenderingContext.UNSIGNED_BYTE,1),WebGL2RenderingContext.SHORT,2),WebGL2RenderingContext.UNSIGNED_SHORT,2),WebGL2RenderingContext.INT,4),WebGL2RenderingContext.UNSIGNED_INT,4),WebGL2RenderingContext.FLOAT,4),O=o((function e(n,i,r){t(this,e),N(this,"array",new Float32Array),N(this,"constantArray",new Float32Array),N(this,"capacity",0),N(this,"verticesCount",0);var o=this.getDefinition();if(this.VERTICES=o.VERTICES,this.VERTEX_SHADER_SOURCE=o.VERTEX_SHADER_SOURCE,this.FRAGMENT_SHADER_SOURCE=o.FRAGMENT_SHADER_SOURCE,this.UNIFORMS=o.UNIFORMS,this.ATTRIBUTES=o.ATTRIBUTES,this.METHOD=o.METHOD,this.CONSTANT_ATTRIBUTES="CONSTANT_ATTRIBUTES"in o?o.CONSTANT_ATTRIBUTES:[],this.CONSTANT_DATA="CONSTANT_DATA"in o?o.CONSTANT_DATA:[],this.isInstanced="CONSTANT_ATTRIBUTES"in o,this.ATTRIBUTES_ITEMS_COUNT=R(this.ATTRIBUTES),this.STRIDE=this.VERTICES*this.ATTRIBUTES_ITEMS_COUNT,this.renderer=r,this.normalProgram=this.getProgramInfo("normal",n,o.VERTEX_SHADER_SOURCE,o.FRAGMENT_SHADER_SOURCE,null),this.pickProgram=i?this.getProgramInfo("pick",n,F+o.VERTEX_SHADER_SOURCE,F+o.FRAGMENT_SHADER_SOURCE,i):null,this.isInstanced){var a=R(this.CONSTANT_ATTRIBUTES);if(this.CONSTANT_DATA.length!==this.VERTICES)throw new Error("Program: error while getting constant data (expected ".concat(this.VERTICES," items, received ").concat(this.CONSTANT_DATA.length," instead)"));this.constantArray=new Float32Array(this.CONSTANT_DATA.length*a);for(var s=0;s<this.CONSTANT_DATA.length;s++){var h=this.CONSTANT_DATA[s];if(h.length!==a)throw new Error("Program: error while getting constant data (one vector has ".concat(h.length," items instead of ").concat(a,")"));for(var u=0;u<h.length;u++)this.constantArray[s*a+u]=h[u]}this.STRIDE=this.ATTRIBUTES_ITEMS_COUNT}}),[{key:"kill",value:function(){P(this.normalProgram),this.pickProgram&&(P(this.pickProgram),this.pickProgram=null)}},{key:"getProgramInfo",value:function(e,t,n,i,r){var o=this.getDefinition(),a=t.createBuffer();if(null===a)throw new Error("Program: error while creating the WebGL buffer.");var s=function(e,t){return G("VERTEX",e,t)}(t,n),h=function(e,t){return G("FRAGMENT",e,t)}(t,i),u=function(e,t){var n,i,r=e.createProgram();if(null===r)throw new Error("loadProgram: error while creating the program.");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("loadProgram: error while linking the program.");return r}(t,[s,h]),c={};o.UNIFORMS.forEach((function(e){var n=t.getUniformLocation(u,e);n&&(c[e]=n)}));var d,l={};if(o.ATTRIBUTES.forEach((function(e){l[e.name]=t.getAttribLocation(u,e.name)})),"CONSTANT_ATTRIBUTES"in o&&(o.CONSTANT_ATTRIBUTES.forEach((function(e){l[e.name]=t.getAttribLocation(u,e.name)})),null===(d=t.createBuffer())))throw new Error("Program: error while creating the WebGL constant buffer.");return{name:e,program:u,gl:t,frameBuffer:r,buffer:a,constantBuffer:d||{},uniformLocations:c,attributeLocations:l,isPicking:"pick"===e,vertexShader:s,fragmentShader:h}}},{key:"bindProgram",value:function(e){var t=this,n=0,i=e.gl,r=e.buffer;this.isInstanced?(i.bindBuffer(i.ARRAY_BUFFER,e.constantBuffer),n=0,this.CONSTANT_ATTRIBUTES.forEach((function(i){return n+=t.bindAttribute(i,e,n,!1)})),i.bufferData(i.ARRAY_BUFFER,this.constantArray,i.STATIC_DRAW),i.bindBuffer(i.ARRAY_BUFFER,e.buffer),n=0,this.ATTRIBUTES.forEach((function(i){return n+=t.bindAttribute(i,e,n,!0)})),i.bufferData(i.ARRAY_BUFFER,this.array,i.DYNAMIC_DRAW)):(i.bindBuffer(i.ARRAY_BUFFER,r),n=0,this.ATTRIBUTES.forEach((function(i){return n+=t.bindAttribute(i,e,n)})),i.bufferData(i.ARRAY_BUFFER,this.array,i.DYNAMIC_DRAW)),i.bindBuffer(i.ARRAY_BUFFER,null)}},{key:"unbindProgram",value:function(e){var t=this;this.isInstanced?(this.CONSTANT_ATTRIBUTES.forEach((function(n){return t.unbindAttribute(n,e,!1)})),this.ATTRIBUTES.forEach((function(n){return t.unbindAttribute(n,e,!0)}))):this.ATTRIBUTES.forEach((function(n){return t.unbindAttribute(n,e)}))}},{key:"bindAttribute",value:function(e,t,n,i){var r=z[e.type];if("number"!=typeof r)throw new Error('Program.bind: yet unsupported attribute type "'.concat(e.type,'"'));var o=t.attributeLocations[e.name],a=t.gl;if(-1!==o){a.enableVertexAttribArray(o);var s=this.isInstanced?(i?this.ATTRIBUTES_ITEMS_COUNT:R(this.CONSTANT_ATTRIBUTES))*Float32Array.BYTES_PER_ELEMENT:this.ATTRIBUTES_ITEMS_COUNT*Float32Array.BYTES_PER_ELEMENT;if(a.vertexAttribPointer(o,e.size,e.type,e.normalized||!1,s,n),this.isInstanced&&i)if(a instanceof WebGL2RenderingContext)a.vertexAttribDivisor(o,1);else{var h=a.getExtension("ANGLE_instanced_arrays");h&&h.vertexAttribDivisorANGLE(o,1)}}return e.size*r}},{key:"unbindAttribute",value:function(e,t,n){var i=t.attributeLocations[e.name],r=t.gl;if(-1!==i&&(r.disableVertexAttribArray(i),this.isInstanced&&n))if(r instanceof WebGL2RenderingContext)r.vertexAttribDivisor(i,0);else{var o=r.getExtension("ANGLE_instanced_arrays");o&&o.vertexAttribDivisorANGLE(i,0)}}},{key:"reallocate",value:function(e){e!==this.capacity&&(this.capacity=e,this.verticesCount=this.VERTICES*e,this.array=new Float32Array(this.isInstanced?this.capacity*this.ATTRIBUTES_ITEMS_COUNT:this.verticesCount*this.ATTRIBUTES_ITEMS_COUNT))}},{key:"hasNothingToRender",value:function(){return 0===this.verticesCount}},{key:"renderProgram",value:function(e,t){var n=t.gl,i=t.program;n.enable(n.BLEND),n.useProgram(i),this.setUniforms(e,t),this.drawWebGL(this.METHOD,t)}},{key:"render",value:function(e){this.hasNothingToRender()||(this.pickProgram&&(this.pickProgram.gl.viewport(0,0,e.width*e.pixelRatio/e.downSizingRatio,e.height*e.pixelRatio/e.downSizingRatio),this.bindProgram(this.pickProgram),this.renderProgram(T(T({},e),{},{pixelRatio:e.pixelRatio/e.downSizingRatio}),this.pickProgram),this.unbindProgram(this.pickProgram)),this.normalProgram.gl.viewport(0,0,e.width*e.pixelRatio,e.height*e.pixelRatio),this.bindProgram(this.normalProgram),this.renderProgram(e,this.normalProgram),this.unbindProgram(this.normalProgram))}},{key:"drawWebGL",value:function(e,t){var n=t.gl,i=t.frameBuffer;if(n.bindFramebuffer(n.FRAMEBUFFER,i),this.isInstanced)if(n instanceof WebGL2RenderingContext)n.drawArraysInstanced(e,0,this.VERTICES,this.capacity);else{var r=n.getExtension("ANGLE_instanced_arrays");r&&r.drawArraysInstancedANGLE(e,0,this.VERTICES,this.capacity)}else n.drawArrays(e,0,this.verticesCount)}}]),I=function(e){function n(){return t(this,n),h(this,n,arguments)}return c(n,e),o(n,[{key:"kill",value:function(){D(n,"kill",this,3)([])}},{key:"process",value:function(e,t,n){var i=t*this.STRIDE;if(!n.hidden)return this.processVisibleItem(k(e),i,n);for(var r=i+this.STRIDE;i<r;i++)this.array[i]=0}}])}(O),B=function(e){function n(){var e;t(this,n);for(var i=arguments.length,r=new Array(i),o=0;o<i;o++)r[o]=arguments[o];return N(e=h(this,n,[].concat(r)),"drawLabel",void 0),e}return c(n,e),o(n,[{key:"kill",value:function(){D(n,"kill",this,3)([])}},{key:"process",value:function(e,t,n,i,r){var o=t*this.STRIDE;if(!(r.hidden||n.hidden||i.hidden))return this.processVisibleItem(k(e),o,n,i,r);for(var a=o+this.STRIDE;o<a;o++)this.array[o]=0}}])}(O);function U(e,t,n){if(t.label){var i=n.labelSize,r=n.labelFont,o=n.labelWeight,a=n.labelColor.attribute?t[n.labelColor.attribute]||n.labelColor.color||"#000":n.labelColor.color;e.fillStyle=a,e.font="".concat(o," ").concat(i,"px ").concat(r),e.fillText(t.label,t.x+t.size+3,t.y+i/3)}}var j=WebGLRenderingContext,V=j.UNSIGNED_BYTE,H=j.FLOAT,W=["u_sizeRatio","u_correctionRatio","u_matrix"],q=function(e){function n(){return t(this,n),h(this,n,arguments)}return c(n,e),o(n,[{key:"getDefinition",value:function(){return{VERTICES:3,VERTEX_SHADER_SOURCE:"\nattribute vec4 a_id;\nattribute vec4 a_color;\nattribute vec2 a_position;\nattribute float a_size;\nattribute float a_angle;\n\nuniform mat3 u_matrix;\nuniform float u_sizeRatio;\nuniform float u_correctionRatio;\n\nvarying vec4 v_color;\nvarying vec2 v_diffVector;\nvarying float v_radius;\nvarying float v_border;\n\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n float size = a_size * u_correctionRatio / u_sizeRatio * 4.0;\n vec2 diffVector = size * vec2(cos(a_angle), sin(a_angle));\n vec2 position = a_position + diffVector;\n gl_Position = vec4(\n (u_matrix * vec3(position, 1)).xy,\n 0,\n 1\n );\n\n v_diffVector = diffVector;\n v_radius = size / 2.0;\n\n #ifdef PICKING_MODE\n // For picking mode, we use the ID as the color:\n v_color = a_id;\n #else\n // For normal mode, we use the color:\n v_color = a_color;\n #endif\n\n v_color.a *= bias;\n}\n",FRAGMENT_SHADER_SOURCE:"\nprecision highp float;\n\nvarying vec4 v_color;\nvarying vec2 v_diffVector;\nvarying float v_radius;\n\nuniform float u_correctionRatio;\n\nconst vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);\n\nvoid main(void) {\n float border = u_correctionRatio * 2.0;\n float dist = length(v_diffVector) - v_radius + border;\n\n // No antialiasing for picking mode:\n #ifdef PICKING_MODE\n if (dist > border)\n gl_FragColor = transparent;\n else\n gl_FragColor = v_color;\n\n #else\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(v_color, transparent, t);\n #endif\n}\n",METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:W,ATTRIBUTES:[{name:"a_position",size:2,type:H},{name:"a_size",size:1,type:H},{name:"a_color",size:4,type:V,normalized:!0},{name:"a_id",size:4,type:V,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:"a_angle",size:1,type:H}],CONSTANT_DATA:[[n.ANGLE_1],[n.ANGLE_2],[n.ANGLE_3]]}}},{key:"processVisibleItem",value:function(e,t,n){var i=this.array,r=_(n.color);i[t++]=n.x,i[t++]=n.y,i[t++]=n.size,i[t++]=r,i[t++]=e}},{key:"setUniforms",value:function(e,t){var n=t.gl,i=t.uniformLocations,r=i.u_sizeRatio,o=i.u_correctionRatio,a=i.u_matrix;n.uniform1f(o,e.correctionRatio),n.uniform1f(r,e.sizeRatio),n.uniformMatrix3fv(a,!1,e.matrix)}}])}(I);N(q,"ANGLE_1",0),N(q,"ANGLE_2",2*Math.PI/3),N(q,"ANGLE_3",4*Math.PI/3);var Z=WebGLRenderingContext,Y=Z.UNSIGNED_BYTE,X=Z.FLOAT,K=["u_matrix","u_sizeRatio","u_correctionRatio","u_minEdgeThickness","u_lengthToThicknessRatio","u_widenessToThicknessRatio"],J={extremity:"target",lengthToThicknessRatio:2.5,widenessToThicknessRatio:2};function $(e){var n=T(T({},J),e||{});return function(e){function i(){return t(this,i),h(this,i,arguments)}return c(i,e),o(i,[{key:"getDefinition",value:function(){return{VERTICES:3,VERTEX_SHADER_SOURCE:"\nattribute vec2 a_position;\nattribute vec2 a_normal;\nattribute float a_radius;\nattribute vec3 a_barycentric;\n\n#ifdef PICKING_MODE\nattribute vec4 a_id;\n#else\nattribute vec4 a_color;\n#endif\n\nuniform mat3 u_matrix;\nuniform float u_sizeRatio;\nuniform float u_correctionRatio;\nuniform float u_minEdgeThickness;\nuniform float u_lengthToThicknessRatio;\nuniform float u_widenessToThicknessRatio;\n\nvarying vec4 v_color;\n\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n float minThickness = u_minEdgeThickness;\n\n float normalLength = length(a_normal);\n vec2 unitNormal = a_normal / normalLength;\n\n // These first computations are taken from edge.vert.glsl and\n // edge.clamped.vert.glsl. Please read it to get better comments on what's\n // happening:\n float pixelsThickness = max(normalLength / u_sizeRatio, minThickness);\n float webGLThickness = pixelsThickness * u_correctionRatio;\n float webGLNodeRadius = a_radius * 2.0 * u_correctionRatio / u_sizeRatio;\n float webGLArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0;\n float webGLArrowHeadThickness = webGLThickness * u_widenessToThicknessRatio;\n\n float da = a_barycentric.x;\n float db = a_barycentric.y;\n float dc = a_barycentric.z;\n\n vec2 delta = vec2(\n da * (webGLNodeRadius * unitNormal.y)\n + db * ((webGLNodeRadius + webGLArrowHeadLength) * unitNormal.y + webGLArrowHeadThickness * unitNormal.x)\n + dc * ((webGLNodeRadius + webGLArrowHeadLength) * unitNormal.y - webGLArrowHeadThickness * unitNormal.x),\n\n da * (-webGLNodeRadius * unitNormal.x)\n + db * (-(webGLNodeRadius + webGLArrowHeadLength) * unitNormal.x + webGLArrowHeadThickness * unitNormal.y)\n + dc * (-(webGLNodeRadius + webGLArrowHeadLength) * unitNormal.x - webGLArrowHeadThickness * unitNormal.y)\n );\n\n vec2 position = (u_matrix * vec3(a_position + delta, 1)).xy;\n\n gl_Position = vec4(position, 0, 1);\n\n #ifdef PICKING_MODE\n // For picking mode, we use the ID as the color:\n v_color = a_id;\n #else\n // For normal mode, we use the color:\n v_color = a_color;\n #endif\n\n v_color.a *= bias;\n}\n",FRAGMENT_SHADER_SOURCE:"\nprecision mediump float;\n\nvarying vec4 v_color;\n\nvoid main(void) {\n gl_FragColor = v_color;\n}\n",METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:K,ATTRIBUTES:[{name:"a_position",size:2,type:X},{name:"a_normal",size:2,type:X},{name:"a_radius",size:1,type:X},{name:"a_color",size:4,type:Y,normalized:!0},{name:"a_id",size:4,type:Y,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:"a_barycentric",size:3,type:X}],CONSTANT_DATA:[[1,0,0],[0,1,0],[0,0,1]]}}},{key:"processVisibleItem",value:function(e,t,i,r,o){if("source"===n.extremity){var a=[r,i];i=a[0],r=a[1]}var s=o.size||1,h=r.size||1,u=i.x,c=i.y,d=r.x,l=r.y,f=_(o.color),p=d-u,g=l-c,v=p*p+g*g,m=0,y=0;v&&(m=-g*(v=1/Math.sqrt(v))*s,y=p*v*s);var b=this.array;b[t++]=d,b[t++]=l,b[t++]=-m,b[t++]=-y,b[t++]=h,b[t++]=f,b[t++]=e}},{key:"setUniforms",value:function(e,t){var i=t.gl,r=t.uniformLocations,o=r.u_matrix,a=r.u_sizeRatio,s=r.u_correctionRatio,h=r.u_minEdgeThickness,u=r.u_lengthToThicknessRatio,c=r.u_widenessToThicknessRatio;i.uniformMatrix3fv(o,!1,e.matrix),i.uniform1f(a,e.sizeRatio),i.uniform1f(s,e.correctionRatio),i.uniform1f(h,e.minEdgeThickness),i.uniform1f(u,n.lengthToThicknessRatio),i.uniform1f(c,n.widenessToThicknessRatio)}}])}(B)}$();var Q="\nprecision mediump float;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_thickness;\nvarying float v_feather;\n\nconst vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);\n\nvoid main(void) {\n // We only handle antialiasing for normal mode:\n #ifdef PICKING_MODE\n gl_FragColor = v_color;\n #else\n float dist = length(v_normal) * v_thickness;\n\n float t = smoothstep(\n v_thickness - v_feather,\n v_thickness,\n dist\n );\n\n gl_FragColor = mix(v_color, transparent, t);\n #endif\n}\n",ee=WebGLRenderingContext,te=ee.UNSIGNED_BYTE,ne=ee.FLOAT,ie=["u_matrix","u_zoomRatio","u_sizeRatio","u_correctionRatio","u_pixelRatio","u_feather","u_minEdgeThickness","u_lengthToThicknessRatio"],re={lengthToThicknessRatio:J.lengthToThicknessRatio};function oe(e){var n=T(T({},re),e||{});return function(e){function i(){return t(this,i),h(this,i,arguments)}return c(i,e),o(i,[{key:"getDefinition",value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:"\nattribute vec4 a_id;\nattribute vec4 a_color;\nattribute vec2 a_normal;\nattribute float a_normalCoef;\nattribute vec2 a_positionStart;\nattribute vec2 a_positionEnd;\nattribute float a_positionCoef;\nattribute float a_radius;\nattribute float a_radiusCoef;\n\nuniform mat3 u_matrix;\nuniform float u_zoomRatio;\nuniform float u_sizeRatio;\nuniform float u_pixelRatio;\nuniform float u_correctionRatio;\nuniform float u_minEdgeThickness;\nuniform float u_lengthToThicknessRatio;\nuniform float u_feather;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_thickness;\nvarying float v_feather;\n\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n float minThickness = u_minEdgeThickness;\n\n float radius = a_radius * a_radiusCoef;\n vec2 normal = a_normal * a_normalCoef;\n vec2 position = a_positionStart * (1.0 - a_positionCoef) + a_positionEnd * a_positionCoef;\n\n float normalLength = length(normal);\n vec2 unitNormal = normal / normalLength;\n\n // These first computations are taken from edge.vert.glsl. Please read it to\n // get better comments on what's happening:\n float pixelsThickness = max(normalLength, minThickness * u_sizeRatio);\n float webGLThickness = pixelsThickness * u_correctionRatio / u_sizeRatio;\n\n // Here, we move the point to leave space for the arrow head:\n float direction = sign(radius);\n float webGLNodeRadius = direction * radius * 2.0 * u_correctionRatio / u_sizeRatio;\n float webGLArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0;\n\n vec2 compensationVector = vec2(-direction * unitNormal.y, direction * unitNormal.x) * (webGLNodeRadius + webGLArrowHeadLength);\n\n // Here is the proper position of the vertex\n gl_Position = vec4((u_matrix * vec3(position + unitNormal * webGLThickness + compensationVector, 1)).xy, 0, 1);\n\n v_thickness = webGLThickness / u_zoomRatio;\n\n v_normal = unitNormal;\n\n v_feather = u_feather * u_correctionRatio / u_zoomRatio / u_pixelRatio * 2.0;\n\n #ifdef PICKING_MODE\n // For picking mode, we use the ID as the color:\n v_color = a_id;\n #else\n // For normal mode, we use the color:\n v_color = a_color;\n #endif\n\n v_color.a *= bias;\n}\n",FRAGMENT_SHADER_SOURCE:Q,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:ie,ATTRIBUTES:[{name:"a_positionStart",size:2,type:ne},{name:"a_positionEnd",size:2,type:ne},{name:"a_normal",size:2,type:ne},{name:"a_color",size:4,type:te,normalized:!0},{name:"a_id",size:4,type:te,normalized:!0},{name:"a_radius",size:1,type:ne}],CONSTANT_ATTRIBUTES:[{name:"a_positionCoef",size:1,type:ne},{name:"a_normalCoef",size:1,type:ne},{name:"a_radiusCoef",size:1,type:ne}],CONSTANT_DATA:[[0,1,0],[0,-1,0],[1,1,1],[1,1,1],[0,-1,0],[1,-1,-1]]}}},{key:"processVisibleItem",value:function(e,t,n,i,r){var o=r.size||1,a=n.x,s=n.y,h=i.x,u=i.y,c=_(r.color),d=h-a,l=u-s,f=i.size||1,p=d*d+l*l,g=0,v=0;p&&(g=-l*(p=1/Math.sqrt(p))*o,v=d*p*o);var m=this.array;m[t++]=a,m[t++]=s,m[t++]=h,m[t++]=u,m[t++]=g,m[t++]=v,m[t++]=c,m[t++]=e,m[t++]=f}},{key:"setUniforms",value:function(e,t){var i=t.gl,r=t.uniformLocations,o=r.u_matrix,a=r.u_zoomRatio,s=r.u_feather,h=r.u_pixelRatio,u=r.u_correctionRatio,c=r.u_sizeRatio,d=r.u_minEdgeThickness,l=r.u_lengthToThicknessRatio;i.uniformMatrix3fv(o,!1,e.matrix),i.uniform1f(a,e.zoomRatio),i.uniform1f(c,e.sizeRatio),i.uniform1f(u,e.correctionRatio),i.uniform1f(h,e.pixelRatio),i.uniform1f(s,e.antiAliasingFeather),i.uniform1f(d,e.minEdgeThickness),i.uniform1f(l,n.lengthToThicknessRatio)}}])}(B)}oe();var ae,se,he=(se=[oe(ae),$(ae)],o((function e(n,i,r){t(this,e),N(this,"drawLabel",void 0),this.programs=se.map((function(e){return new e(n,i,r)}))}),[{key:"reallocate",value:function(e){this.programs.forEach((function(t){return t.reallocate(e)}))}},{key:"process",value:function(e,t,n,i,r){this.programs.forEach((function(o){return o.process(e,t,n,i,r)}))}},{key:"render",value:function(e){this.programs.forEach((function(t){return t.render(e)}))}},{key:"kill",value:function(){this.programs.forEach((function(e){return e.kill()}))}}])),ue=he,ce=WebGLRenderingContext,de=ce.UNSIGNED_BYTE,le=ce.FLOAT,fe=["u_matrix","u_zoomRatio","u_sizeRatio","u_correctionRatio","u_pixelRatio","u_feather","u_minEdgeThickness"],pe=function(e){function n(){return t(this,n),h(this,n,arguments)}return c(n,e),o(n,[{key:"getDefinition",value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:'\nattribute vec4 a_id;\nattribute vec4 a_color;\nattribute vec2 a_normal;\nattribute float a_normalCoef;\nattribute vec2 a_positionStart;\nattribute vec2 a_positionEnd;\nattribute float a_positionCoef;\n\nuniform mat3 u_matrix;\nuniform float u_sizeRatio;\nuniform float u_zoomRatio;\nuniform float u_pixelRatio;\nuniform float u_correctionRatio;\nuniform float u_minEdgeThickness;\nuniform float u_feather;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_thickness;\nvarying float v_feather;\n\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n float minThickness = u_minEdgeThickness;\n\n vec2 normal = a_normal * a_normalCoef;\n vec2 position = a_positionStart * (1.0 - a_positionCoef) + a_positionEnd * a_positionCoef;\n\n float normalLength = length(normal);\n vec2 unitNormal = normal / normalLength;\n\n // We require edges to be at least "minThickness" pixels thick *on screen*\n // (so we need to compensate the size ratio):\n float pixelsThickness = max(normalLength, minThickness * u_sizeRatio);\n\n // Then, we need to retrieve the normalized thickness of the edge in the WebGL\n // referential (in a ([0, 1], [0, 1]) space), using our "magic" correction\n // ratio:\n float webGLThickness = pixelsThickness * u_correctionRatio / u_sizeRatio;\n\n // Here is the proper position of the vertex\n gl_Position = vec4((u_matrix * vec3(position + unitNormal * webGLThickness, 1)).xy, 0, 1);\n\n // For the fragment shader though, we need a thickness that takes the "magic"\n // correction ratio into account (as in webGLThickness), but so that the\n // antialiasing effect does not depend on the zoom level. So here\'s yet\n // another thickness version:\n v_thickness = webGLThickness / u_zoomRatio;\n\n v_normal = unitNormal;\n\n v_feather = u_feather * u_correctionRatio / u_zoomRatio / u_pixelRatio * 2.0;\n\n #ifdef PICKING_MODE\n // For picking mode, we use the ID as the color:\n v_color = a_id;\n #else\n // For normal mode, we use the color:\n v_color = a_color;\n #endif\n\n v_color.a *= bias;\n}\n',FRAGMENT_SHADER_SOURCE:Q,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:fe,ATTRIBUTES:[{name:"a_positionStart",size:2,type:le},{name:"a_positionEnd",size:2,type:le},{name:"a_normal",size:2,type:le},{name:"a_color",size:4,type:de,normalized:!0},{name:"a_id",size:4,type:de,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:"a_positionCoef",size:1,type:le},{name:"a_normalCoef",size:1,type:le}],CONSTANT_DATA:[[0,1],[0,-1],[1,1],[1,1],[0,-1],[1,-1]]}}},{key:"processVisibleItem",value:function(e,t,n,i,r){var o=r.size||1,a=n.x,s=n.y,h=i.x,u=i.y,c=_(r.color),d=h-a,l=u-s,f=d*d+l*l,p=0,g=0;f&&(p=-l*(f=1/Math.sqrt(f))*o,g=d*f*o);var v=this.array;v[t++]=a,v[t++]=s,v[t++]=h,v[t++]=u,v[t++]=p,v[t++]=g,v[t++]=c,v[t++]=e}},{key:"setUniforms",value:function(e,t){var n=t.gl,i=t.uniformLocations,r=i.u_matrix,o=i.u_zoomRatio,a=i.u_feather,s=i.u_pixelRatio,h=i.u_correctionRatio,u=i.u_sizeRatio,c=i.u_minEdgeThickness;n.uniformMatrix3fv(r,!1,e.matrix),n.uniform1f(o,e.zoomRatio),n.uniform1f(u,e.sizeRatio),n.uniform1f(h,e.correctionRatio),n.uniform1f(s,e.pixelRatio),n.uniform1f(a,e.antiAliasingFeather),n.uniform1f(c,e.minEdgeThickness)}}])}(B),ge=function(e){function n(){var e;return t(this,n),(e=h(this,n)).rawEmitter=e,e}return c(n,e),o(n)}(n(187).EventEmitter),ve=n(186),me=n.n(ve),ye={linear:function(e){return e},quadraticIn:function(e){return e*e},quadraticOut:function(e){return e*(2-e)},quadraticInOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)},cubicIn:function(e){return e*e*e},cubicOut:function(e){return--e*e*e+1},cubicInOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},be={easing:"quadraticInOut",duration:150};function we(){return Float32Array.of(1,0,0,0,1,0,0,0,1)}function xe(e,t,n){return e[0]=t,e[4]="number"==typeof n?n:t,e}function Ce(e,t){var n=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=n,e[3]=-n,e[4]=i,e}function _e(e,t,n){return e[6]=t,e[7]=n,e}function Ee(e,t){var n=e[0],i=e[1],r=e[2],o=e[3],a=e[4],s=e[5],h=e[6],u=e[7],c=e[8],d=t[0],l=t[1],f=t[2],p=t[3],g=t[4],v=t[5],m=t[6],y=t[7],b=t[8];return e[0]=d*n+l*o+f*h,e[1]=d*i+l*a+f*u,e[2]=d*r+l*s+f*c,e[3]=p*n+g*o+v*h,e[4]=p*i+g*a+v*u,e[5]=p*r+g*s+v*c,e[6]=m*n+y*o+b*h,e[7]=m*i+y*a+b*u,e[8]=m*r+y*s+b*c,e}function ke(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=e[0],r=e[1],o=e[3],a=e[4],s=e[6],h=e[7],u=t.x,c=t.y;return{x:u*i+c*o+s*n,y:u*r+c*a+h*n}}function Se(e,t,n,i,r){var o=e.angle,a=e.ratio,s=e.x,h=e.y,u=t.width,c=t.height,d=we(),l=Math.min(u,c)-2*i,f=function(e,t){var n=e.height/e.width,i=t.height/t.width;return n<1&&i>1||n>1&&i<1?1:Math.min(Math.max(i,1/i),Math.max(1/n,n))}(t,n);return r?(Ee(d,_e(we(),s,h)),Ee(d,xe(we(),a)),Ee(d,Ce(we(),o)),Ee(d,xe(we(),u/l/2/f,c/l/2/f))):(Ee(d,xe(we(),l/u*2*f,l/c*2*f)),Ee(d,Ce(we(),-o)),Ee(d,xe(we(),1/a)),Ee(d,_e(we(),-s,-h))),d}function Le(){return void 0!==window.devicePixelRatio?window.devicePixelRatio:1}function Ne(e,t,n){return n.sort((function(e,n){var i=t(e)||0,r=t(n)||0;return i<r?-1:i>r?1:0}))}function Ae(e){var t=f(e.x,2),n=t[0],i=t[1],r=f(e.y,2),o=r[0],a=r[1],s=Math.max(i-n,a-o),h=(i+n)/2,u=(a+o)/2;(0===s||Math.abs(s)===1/0||isNaN(s))&&(s=1),isNaN(h)&&(h=0),isNaN(u)&&(u=0);var c=function(e){return{x:.5+(e.x-h)/s,y:.5+(e.y-u)/s}};return c.applyTo=function(e){e.x=.5+(e.x-h)/s,e.y=.5+(e.y-u)/s},c.inverse=function(e){return{x:h+s*(e.x-.5),y:u+s*(e.y-.5)}},c.ratio=s,c}function Te(e){return Te="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Te(e)}function Me(e,t){var n=t.size;if(0!==n){var i=e.length;e.length+=n;var r=0;t.forEach((function(t){e[i+r]=t,r++}))}}function De(e){e=e||{};for(var t=0,n=arguments.length<=1?0:arguments.length-1;t<n;t++){var i=t+1<1||arguments.length<=t+1?void 0:arguments[t+1];i&&Object.assign(e,i)}return e}var Re={hideEdgesOnMove:!1,hideLabelsOnMove:!1,renderLabels:!0,renderEdgeLabels:!1,enableEdgeEvents:!1,defaultNodeColor:"#999",defaultNodeType:"circle",defaultEdgeColor:"#ccc",defaultEdgeType:"line",labelFont:"Arial",labelSize:14,labelWeight:"normal",labelColor:{color:"#000"},edgeLabelFont:"Arial",edgeLabelSize:14,edgeLabelWeight:"normal",edgeLabelColor:{attribute:"color"},stagePadding:30,defaultDrawEdgeLabel:function(e,t,n,i,r){var o=r.edgeLabelSize,a=r.edgeLabelFont,s=r.edgeLabelWeight,h=r.edgeLabelColor.attribute?t[r.edgeLabelColor.attribute]||r.edgeLabelColor.color||"#000":r.edgeLabelColor.color,u=t.label;if(u){e.fillStyle=h,e.font="".concat(s," ").concat(o,"px ").concat(a);var c,d,l=n.size,f=i.size,p=n.x,g=n.y,v=i.x,m=i.y,y=v-p,b=m-g,w=Math.sqrt(y*y+b*b);if(!(w<l+f)){c=((p+=y*l/w)+(v-=y*f/w))/2,d=((g+=b*l/w)+(m-=b*f/w))/2,y=v-p,b=m-g,w=Math.sqrt(y*y+b*b);var x,C=e.measureText(u).width;if(C>w){for(u+="…",C=e.measureText(u).width;C>w&&u.length>1;)u=u.slice(0,-2)+"…",C=e.measureText(u).width;if(u.length<4)return}x=y>0?b>0?Math.acos(y/w):Math.asin(b/w):b>0?Math.acos(y/w)+Math.PI:Math.asin(y/w)+Math.PI/2,e.save(),e.translate(c,d),e.rotate(x),e.fillText(u,-C/2,t.size/2+o),e.restore()}}},defaultDrawNodeLabel:U,defaultDrawNodeHover:function(e,t,n){var i=n.labelSize,r=n.labelFont,o=n.labelWeight;if(e.font="".concat(o," ").concat(i,"px ").concat(r),e.fillStyle="#FFF",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=8,e.shadowColor="#000","string"==typeof t.label){var a=e.measureText(t.label).width,s=Math.round(a+5),h=Math.round(i+4),u=Math.max(t.size,i/2)+2,c=Math.asin(h/2/u),d=Math.sqrt(Math.abs(Math.pow(u,2)-Math.pow(h/2,2)));e.beginPath(),e.moveTo(t.x+d,t.y+h/2),e.lineTo(t.x+u+s,t.y+h/2),e.lineTo(t.x+u+s,t.y-h/2),e.lineTo(t.x+d,t.y-h/2),e.arc(t.x,t.y,u,c,-c),e.closePath(),e.fill()}else e.beginPath(),e.arc(t.x,t.y,t.size+2,0,2*Math.PI),e.closePath(),e.fill();e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=0,U(e,t,n)},minEdgeThickness:1.7,antiAliasingFeather:1,dragTimeout:100,draggedEventsTolerance:3,inertiaDuration:200,inertiaRatio:3,zoomDuration:250,zoomingRatio:1.7,doubleClickTimeout:300,doubleClickZoomingRatio:2.2,doubleClickZoomingDuration:200,tapMoveTolerance:10,zoomToSizeRatioFunction:Math.sqrt,itemSizesReference:"screen",autoRescale:!0,autoCenter:!0,labelDensity:1,labelGridCellSize:100,labelRenderedSizeThreshold:6,nodeReducer:null,edgeReducer:null,zIndex:!1,minCameraRatio:null,maxCameraRatio:null,enableCameraZooming:!0,enableCameraPanning:!0,enableCameraRotation:!0,cameraPanBoundaries:null,allowInvalidContainer:!1,nodeProgramClasses:{},nodeHoverProgramClasses:{},edgeProgramClasses:{}},Ge={circle:q},Pe={arrow:ue,line:pe};function Fe(e){if("number"!=typeof e.labelDensity||e.labelDensity<0)throw new Error("Settings: invalid `labelDensity`. Expecting a positive number.");var t=e.minCameraRatio,n=e.maxCameraRatio;if("number"==typeof t&&"number"==typeof n&&n<t)throw new Error("Settings: invalid camera ratio boundaries. Expecting `maxCameraRatio` to be greater than `minCameraRatio`.")}var ze=1.5,Oe=function(e){function n(){var e;return t(this,n),N(e=h(this,n),"x",.5),N(e,"y",.5),N(e,"angle",0),N(e,"ratio",1),N(e,"minRatio",null),N(e,"maxRatio",null),N(e,"enabledZooming",!0),N(e,"enabledPanning",!0),N(e,"enabledRotation",!0),N(e,"clean",null),N(e,"nextFrame",null),N(e,"previousState",null),N(e,"enabled",!0),e.previousState=e.getState(),e}return c(n,e),o(n,[{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:"hasState",value:function(e){return this.x===e.x&&this.y===e.y&&this.ratio===e.ratio&&this.angle===e.angle}},{key:"getPreviousState",value:function(){var e=this.previousState;return e?{x:e.x,y:e.y,angle:e.angle,ratio:e.ratio}:null}},{key:"getBoundedRatio",value:function(e){var t=e;return"number"==typeof this.minRatio&&(t=Math.max(t,this.minRatio)),"number"==typeof this.maxRatio&&(t=Math.min(t,this.maxRatio)),t}},{key:"validateState",value:function(e){var t={};return this.enabledPanning&&"number"==typeof e.x&&(t.x=e.x),this.enabledPanning&&"number"==typeof e.y&&(t.y=e.y),this.enabledZooming&&"number"==typeof e.ratio&&(t.ratio=this.getBoundedRatio(e.ratio)),this.enabledRotation&&"number"==typeof e.angle&&(t.angle=e.angle),this.clean?this.clean(T(T({},this.getState()),t)):t}},{key:"isAnimated",value:function(){return!!this.nextFrame}},{key:"setState",value:function(e){if(!this.enabled)return this;this.previousState=this.getState();var t=this.validateState(e);return"number"==typeof t.x&&(this.x=t.x),"number"==typeof t.y&&(this.y=t.y),"number"==typeof t.ratio&&(this.ratio=t.ratio),"number"==typeof t.angle&&(this.angle=t.angle),this.hasState(this.previousState)||this.emit("updated",this.getState()),this}},{key:"updateState",value:function(e){return this.setState(e(this.getState())),this}},{key:"animate",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;if(!i)return new Promise((function(i){return t.animate(e,n,i)}));if(this.enabled){var r=T(T({},be),n),o=this.validateState(e),a="function"==typeof r.easing?r.easing:ye[r.easing],s=Date.now(),h=this.getState(),u=function(){var e=(Date.now()-s)/r.duration;if(e>=1)return t.nextFrame=null,t.setState(o),void(t.animationCallback&&(t.animationCallback.call(null),t.animationCallback=void 0));var n=a(e),i={};"number"==typeof o.x&&(i.x=h.x+(o.x-h.x)*n),"number"==typeof o.y&&(i.y=h.y+(o.y-h.y)*n),t.enabledRotation&&"number"==typeof o.angle&&(i.angle=h.angle+(o.angle-h.angle)*n),"number"==typeof o.ratio&&(i.ratio=h.ratio+(o.ratio-h.ratio)*n),t.setState(i),t.nextFrame=requestAnimationFrame(u)};this.nextFrame?(cancelAnimationFrame(this.nextFrame),this.animationCallback&&this.animationCallback.call(null),this.nextFrame=requestAnimationFrame(u)):u(),this.animationCallback=i}}},{key:"animatedZoom",value:function(e){return e?"number"==typeof e?this.animate({ratio:this.ratio/e}):this.animate({ratio:this.ratio/(e.factor||ze)},e):this.animate({ratio:this.ratio/ze})}},{key:"animatedUnzoom",value:function(e){return e?"number"==typeof e?this.animate({ratio:this.ratio*e}):this.animate({ratio:this.ratio*(e.factor||ze)},e):this.animate({ratio:this.ratio*ze})}},{key:"animatedReset",value:function(e){return this.animate({x:.5,y:.5,ratio:1,angle:0},e)}},{key:"copy",value:function(){return n.from(this.getState())}}],[{key:"from",value:function(e){return(new n).setState(e)}}])}(ge);function Ie(e,t){var n=t.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}}function Be(e,t){var n=T(T({},Ie(e,t)),{},{sigmaDefaultPrevented:!1,preventSigmaDefault:function(){n.sigmaDefaultPrevented=!0},original:e});return n}function Ue(e){var t="x"in e?e:T(T({},e.touches[0]||e.previousTouches[0]),{},{original:e.original,sigmaDefaultPrevented:e.sigmaDefaultPrevented,preventSigmaDefault:function(){e.sigmaDefaultPrevented=!0,t.sigmaDefaultPrevented=!0}});return t}function je(e){for(var t=[],n=0,i=Math.min(e.length,2);n<i;n++)t.push(e[n]);return t}function Ve(e,t,n){var i={touches:je(e.touches).map((function(e){return Ie(e,n)})),previousTouches:t.map((function(e){return Ie(e,n)})),sigmaDefaultPrevented:!1,preventSigmaDefault:function(){i.sigmaDefaultPrevented=!0},original:e};return i}function He(e){if(void 0!==e.deltaY)return-3*e.deltaY/360;if(void 0!==e.detail)return e.detail/-9;throw new Error("Captor: could not extract delta from event.")}var We=function(e){function n(e,i){var r;return t(this,n),(r=h(this,n)).container=e,r.renderer=i,r}return c(n,e),o(n)}(ge),qe=["doubleClickTimeout","doubleClickZoomingDuration","doubleClickZoomingRatio","dragTimeout","draggedEventsTolerance","inertiaDuration","inertiaRatio","zoomDuration","zoomingRatio"].reduce((function(e,t){return T(T({},e),{},N({},t,Re[t]))}),{}),Ze=function(e){function n(e,i){var r;return t(this,n),N(r=h(this,n,[e,i]),"enabled",!0),N(r,"draggedEvents",0),N(r,"downStartTime",null),N(r,"lastMouseX",null),N(r,"lastMouseY",null),N(r,"isMouseDown",!1),N(r,"isMoving",!1),N(r,"movingTimeout",null),N(r,"startCameraState",null),N(r,"clicks",0),N(r,"doubleClickTimeout",null),N(r,"currentWheelDirection",0),N(r,"settings",qe),r.handleClick=r.handleClick.bind(r),r.handleRightClick=r.handleRightClick.bind(r),r.handleDown=r.handleDown.bind(r),r.handleUp=r.handleUp.bind(r),r.handleMove=r.handleMove.bind(r),r.handleWheel=r.handleWheel.bind(r),r.handleLeave=r.handleLeave.bind(r),r.handleEnter=r.handleEnter.bind(r),e.addEventListener("click",r.handleClick,{capture:!1}),e.addEventListener("contextmenu",r.handleRightClick,{capture:!1}),e.addEventListener("mousedown",r.handleDown,{capture:!1}),e.addEventListener("wheel",r.handleWheel,{capture:!1}),e.addEventListener("mouseleave",r.handleLeave,{capture:!1}),e.addEventListener("mouseenter",r.handleEnter,{capture:!1}),document.addEventListener("mousemove",r.handleMove,{capture:!1}),document.addEventListener("mouseup",r.handleUp,{capture:!1}),r}return c(n,e),o(n,[{key:"kill",value:function(){var e=this.container;e.removeEventListener("click",this.handleClick),e.removeEventListener("contextmenu",this.handleRightClick),e.removeEventListener("mousedown",this.handleDown),e.removeEventListener("wheel",this.handleWheel),e.removeEventListener("mouseleave",this.handleLeave),e.removeEventListener("mouseenter",this.handleEnter),document.removeEventListener("mousemove",this.handleMove),document.removeEventListener("mouseup",this.handleUp)}},{key:"handleClick",value:function(e){var t=this;if(this.enabled){if(this.clicks++,2===this.clicks)return this.clicks=0,"number"==typeof this.doubleClickTimeout&&(clearTimeout(this.doubleClickTimeout),this.doubleClickTimeout=null),this.handleDoubleClick(e);setTimeout((function(){t.clicks=0,t.doubleClickTimeout=null}),this.settings.doubleClickTimeout),this.draggedEvents<this.settings.draggedEventsTolerance&&this.emit("click",Be(e,this.container))}}},{key:"handleRightClick",value:function(e){this.enabled&&this.emit("rightClick",Be(e,this.container))}},{key:"handleDoubleClick",value:function(e){if(this.enabled){e.preventDefault(),e.stopPropagation();var t=Be(e,this.container);if(this.emit("doubleClick",t),!t.sigmaDefaultPrevented){var n=this.renderer.getCamera(),i=n.getBoundedRatio(n.getState().ratio/this.settings.doubleClickZoomingRatio);n.animate(this.renderer.getViewportZoomedState(Ie(e,this.container),i),{easing:"quadraticInOut",duration:this.settings.doubleClickZoomingDuration})}}}},{key:"handleDown",value:function(e){if(this.enabled){if(0===e.button){this.startCameraState=this.renderer.getCamera().getState();var t=Ie(e,this.container),n=t.x,i=t.y;this.lastMouseX=n,this.lastMouseY=i,this.draggedEvents=0,this.downStartTime=Date.now(),this.isMouseDown=!0}this.emit("mousedown",Be(e,this.container))}}},{key:"handleUp",value:function(e){var t=this;if(this.enabled&&this.isMouseDown){var n=this.renderer.getCamera();this.isMouseDown=!1,"number"==typeof this.movingTimeout&&(clearTimeout(this.movingTimeout),this.movingTimeout=null);var i=Ie(e,this.container),r=i.x,o=i.y,a=n.getState(),s=n.getPreviousState()||{x:0,y:0};this.isMoving?n.animate({x:a.x+this.settings.inertiaRatio*(a.x-s.x),y:a.y+this.settings.inertiaRatio*(a.y-s.y)},{duration:this.settings.inertiaDuration,easing:"quadraticOut"}):this.lastMouseX===r&&this.lastMouseY===o||n.setState({x:a.x,y:a.y}),this.isMoving=!1,setTimeout((function(){var e=t.draggedEvents>0;t.draggedEvents=0,e&&t.renderer.getSetting("hideEdgesOnMove")&&t.renderer.refresh()}),0),this.emit("mouseup",Be(e,this.container))}}},{key:"handleMove",value:function(e){var t=this;if(this.enabled){var n=Be(e,this.container);if(this.emit("mousemovebody",n),e.target!==this.container&&e.composedPath()[0]!==this.container||this.emit("mousemove",n),!n.sigmaDefaultPrevented&&this.isMouseDown){this.isMoving=!0,this.draggedEvents++,"number"==typeof this.movingTimeout&&clearTimeout(this.movingTimeout),this.movingTimeout=window.setTimeout((function(){t.movingTimeout=null,t.isMoving=!1}),this.settings.dragTimeout);var i=this.renderer.getCamera(),r=Ie(e,this.container),o=r.x,a=r.y,s=this.renderer.viewportToFramedGraph({x:this.lastMouseX,y:this.lastMouseY}),h=this.renderer.viewportToFramedGraph({x:o,y:a}),u=s.x-h.x,c=s.y-h.y,d=i.getState(),l=d.x+u,f=d.y+c;i.setState({x:l,y:f}),this.lastMouseX=o,this.lastMouseY=a,e.preventDefault(),e.stopPropagation()}}}},{key:"handleLeave",value:function(e){this.emit("mouseleave",Be(e,this.container))}},{key:"handleEnter",value:function(e){this.emit("mouseenter",Be(e,this.container))}},{key:"handleWheel",value:function(e){var t=this,n=this.renderer.getCamera();if(this.enabled&&n.enabledZooming){var i=He(e);if(i){var r=function(e,t){return T(T({},Be(e,t)),{},{delta:He(e)})}(e,this.container);if(this.emit("wheel",r),r.sigmaDefaultPrevented)return e.preventDefault(),void e.stopPropagation();var o=n.getState().ratio,a=i>0?1/this.settings.zoomingRatio:this.settings.zoomingRatio,s=n.getBoundedRatio(o*a),h=i>0?1:-1,u=Date.now();o!==s&&(e.preventDefault(),e.stopPropagation(),this.currentWheelDirection===h&&this.lastWheelTriggerTime&&u-this.lastWheelTriggerTime<this.settings.zoomDuration/5||(n.animate(this.renderer.getViewportZoomedState(Ie(e,this.container),s),{easing:"quadraticOut",duration:this.settings.zoomDuration},(function(){t.currentWheelDirection=0})),this.currentWheelDirection=h,this.lastWheelTriggerTime=u))}}}},{key:"setSettings",value:function(e){this.settings=e}}])}(We),Ye=["dragTimeout","inertiaDuration","inertiaRatio","doubleClickTimeout","doubleClickZoomingRatio","doubleClickZoomingDuration","tapMoveTolerance"].reduce((function(e,t){return T(T({},e),{},N({},t,Re[t]))}),{}),Xe=function(e){function n(e,i){var r;return t(this,n),N(r=h(this,n,[e,i]),"enabled",!0),N(r,"isMoving",!1),N(r,"hasMoved",!1),N(r,"touchMode",0),N(r,"startTouchesPositions",[]),N(r,"lastTouches",[]),N(r,"lastTap",null),N(r,"settings",Ye),r.handleStart=r.handleStart.bind(r),r.handleLeave=r.handleLeave.bind(r),r.handleMove=r.handleMove.bind(r),e.addEventListener("touchstart",r.handleStart,{capture:!1}),e.addEventListener("touchcancel",r.handleLeave,{capture:!1}),document.addEventListener("touchend",r.handleLeave,{capture:!1,passive:!1}),document.addEventListener("touchmove",r.handleMove,{capture:!1,passive:!1}),r}return c(n,e),o(n,[{key:"kill",value:function(){var e=this.container;e.removeEventListener("touchstart",this.handleStart),e.removeEventListener("touchcancel",this.handleLeave),document.removeEventListener("touchend",this.handleLeave),document.removeEventListener("touchmove",this.handleMove)}},{key:"getDimensions",value:function(){return{width:this.container.offsetWidth,height:this.container.offsetHeight}}},{key:"handleStart",value:function(e){var t=this;if(this.enabled){e.preventDefault();var n=je(e.touches);if(this.touchMode=n.length,this.startCameraState=this.renderer.getCamera().getState(),this.startTouchesPositions=n.map((function(e){return Ie(e,t.container)})),2===this.touchMode){var i=f(this.startTouchesPositions,2),r=i[0],o=r.x,a=r.y,s=i[1],h=s.x,u=s.y;this.startTouchesAngle=Math.atan2(u-a,h-o),this.startTouchesDistance=Math.sqrt(Math.pow(h-o,2)+Math.pow(u-a,2))}this.emit("touchdown",Ve(e,this.lastTouches,this.container)),this.lastTouches=n,this.lastTouchesPositions=this.startTouchesPositions}}},{key:"handleLeave",value:function(e){if(this.enabled&&this.startTouchesPositions.length){switch(e.cancelable&&e.preventDefault(),this.movingTimeout&&(this.isMoving=!1,clearTimeout(this.movingTimeout)),this.touchMode){case 2:if(1===e.touches.length){this.handleStart(e),e.preventDefault();break}case 1:if(this.isMoving){var t=this.renderer.getCamera(),n=t.getState(),i=t.getPreviousState()||{x:0,y:0};t.animate({x:n.x+this.settings.inertiaRatio*(n.x-i.x),y:n.y+this.settings.inertiaRatio*(n.y-i.y)},{duration:this.settings.inertiaDuration,easing:"quadraticOut"})}this.hasMoved=!1,this.isMoving=!1,this.touchMode=0}if(this.emit("touchup",Ve(e,this.lastTouches,this.container)),!e.touches.length){var r=Ie(this.lastTouches[0],this.container),o=this.startTouchesPositions[0],a=Math.pow(r.x-o.x,2)+Math.pow(r.y-o.y,2);if(!e.touches.length&&a<Math.pow(this.settings.tapMoveTolerance,2))if(this.lastTap&&Date.now()-this.lastTap.time<this.settings.doubleClickTimeout){var s=Ve(e,this.lastTouches,this.container);if(this.emit("doubletap",s),this.lastTap=null,!s.sigmaDefaultPrevented){var h=this.renderer.getCamera(),u=h.getBoundedRatio(h.getState().ratio/this.settings.doubleClickZoomingRatio);h.animate(this.renderer.getViewportZoomedState(r,u),{easing:"quadraticInOut",duration:this.settings.doubleClickZoomingDuration})}}else{var c=Ve(e,this.lastTouches,this.container);this.emit("tap",c),this.lastTap={time:Date.now(),position:c.touches[0]||c.previousTouches[0]}}}this.lastTouches=je(e.touches),this.startTouchesPositions=[]}}},{key:"handleMove",value:function(e){var t=this;if(this.enabled&&this.startTouchesPositions.length){e.preventDefault();var n=je(e.touches),i=n.map((function(e){return Ie(e,t.container)})),r=this.lastTouches;this.lastTouches=n,this.lastTouchesPositions=i;var o=Ve(e,r,this.container);if(this.emit("touchmove",o),!o.sigmaDefaultPrevented&&(this.hasMoved||(this.hasMoved=i.some((function(e,n){var i=t.startTouchesPositions[n];return i&&(e.x!==i.x||e.y!==i.y)}))),this.hasMoved)){this.isMoving=!0,this.movingTimeout&&clearTimeout(this.movingTimeout),this.movingTimeout=window.setTimeout((function(){t.isMoving=!1}),this.settings.dragTimeout);var a=this.renderer.getCamera(),s=this.startCameraState,h=this.renderer.getSetting("stagePadding");switch(this.touchMode){case 1:var u=this.renderer.viewportToFramedGraph((this.startTouchesPositions||[])[0]),c=u.x,d=u.y,l=this.renderer.viewportToFramedGraph(i[0]),f=l.x,p=l.y;a.setState({x:s.x+c-f,y:s.y+d-p});break;case 2:var g={x:.5,y:.5,angle:0,ratio:1},v=i[0],m=v.x,y=v.y,b=i[1],w=b.x,x=b.y,C=Math.atan2(x-y,w-m)-this.startTouchesAngle,_=Math.hypot(x-y,w-m)/this.startTouchesDistance,E=a.getBoundedRatio(s.ratio/_);g.ratio=E,g.angle=s.angle+C;var k=this.getDimensions(),S=this.renderer.viewportToFramedGraph((this.startTouchesPositions||[])[0],{cameraState:s}),L=Math.min(k.width,k.height)-2*h,N=E/L,A=m-L/2/(L/k.width),T=y-L/2/(L/k.height),M=[A*Math.cos(-g.angle)-T*Math.sin(-g.angle),T*Math.cos(-g.angle)+A*Math.sin(-g.angle)];A=M[0],T=M[1],g.x=S.x-A*N,g.y=S.y+T*N,a.setState(g)}}}}},{key:"setSettings",value:function(e){this.settings=e}}])}(We);function Ke(e){return function(e){if(Array.isArray(e))return d(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||l(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Je(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.includes(i))continue;n[i]=e[i]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)n=o[i],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var $e=o((function e(n,i){t(this,e),this.key=n,this.size=i}),null,[{key:"compare",value:function(e,t){return e.size>t.size?-1:e.size<t.size||e.key>t.key?1:-1}}]),Qe=o((function e(){t(this,e),N(this,"width",0),N(this,"height",0),N(this,"cellSize",0),N(this,"columns",0),N(this,"rows",0),N(this,"cells",{})}),[{key:"resizeAndClear",value:function(e,t){this.width=e.width,this.height=e.height,this.cellSize=t,this.columns=Math.ceil(e.width/t),this.rows=Math.ceil(e.height/t),this.cells={}}},{key:"getIndex",value:function(e){var t=Math.floor(e.x/this.cellSize);return Math.floor(e.y/this.cellSize)*this.columns+t}},{key:"add",value:function(e,t,n){var i=new $e(e,t),r=this.getIndex(n),o=this.cells[r];o||(o=[],this.cells[r]=o),o.push(i)}},{key:"organize",value:function(){for(var e in this.cells)this.cells[e].sort($e.compare)}},{key:"getLabelsToDisplay",value:function(e,t){var n=this.cellSize*this.cellSize,i=n/e/e*t/n,r=Math.ceil(i),o=[];for(var a in this.cells)for(var s=this.cells[a],h=0;h<Math.min(r,s.length);h++)o.push(s[h].key);return o}}]),et=Object.prototype.hasOwnProperty,tt=function(n){function i(e,n){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(t(this,i),N(r=h(this,i),"elements",{}),N(r,"canvasContexts",{}),N(r,"webGLContexts",{}),N(r,"pickingLayers",new Set),N(r,"textures",{}),N(r,"frameBuffers",{}),N(r,"activeListeners",{}),N(r,"labelGrid",new Qe),N(r,"nodeDataCache",{}),N(r,"edgeDataCache",{}),N(r,"nodeProgramIndex",{}),N(r,"edgeProgramIndex",{}),N(r,"nodesWithForcedLabels",new Set),N(r,"edgesWithForcedLabels",new Set),N(r,"nodeExtent",{x:[0,1],y:[0,1]}),N(r,"nodeZExtent",[1/0,-1/0]),N(r,"edgeZExtent",[1/0,-1/0]),N(r,"matrix",we()),N(r,"invMatrix",we()),N(r,"correctionRatio",1),N(r,"customBBox",null),N(r,"normalizationFunction",Ae({x:[0,1],y:[0,1]})),N(r,"graphToViewportRatio",1),N(r,"itemIDsIndex",{}),N(r,"nodeIndices",{}),N(r,"edgeIndices",{}),N(r,"width",0),N(r,"height",0),N(r,"pixelRatio",Le()),N(r,"pickingDownSizingRatio",2*r.pixelRatio),N(r,"displayedNodeLabels",new Set),N(r,"displayedEdgeLabels",new Set),N(r,"highlightedNodes",new Set),N(r,"hoveredNode",null),N(r,"hoveredEdge",null),N(r,"renderFrame",null),N(r,"renderHighlightedNodesFrame",null),N(r,"needToProcess",!1),N(r,"checkEdgesEventsFrame",null),N(r,"nodePrograms",{}),N(r,"nodeHoverPrograms",{}),N(r,"edgePrograms",{}),r.settings=function(e){var t=De({},Re,e);return t.nodeProgramClasses=De({},Ge,t.nodeProgramClasses),t.edgeProgramClasses=De({},Pe,t.edgeProgramClasses),t}(o),Fe(r.settings),function(e){if(!me()(e))throw new Error("Sigma: invalid graph instance.");e.forEachNode((function(e,t){if(!Number.isFinite(t.x)||!Number.isFinite(t.y))throw new Error("Sigma: Coordinates of node ".concat(e," are invalid. A node must have a numeric 'x' and 'y' attribute."))}))}(e),!(n instanceof HTMLElement))throw new Error("Sigma: container should be an html element.");for(var a in r.graph=e,r.container=n,r.createWebGLContext("edges",{picking:o.enableEdgeEvents}),r.createCanvasContext("edgeLabels"),r.createWebGLContext("nodes",{picking:!0}),r.createCanvasContext("labels"),r.createCanvasContext("hovers"),r.createWebGLContext("hoverNodes"),r.createCanvasContext("mouse",{style:{touchAction:"none",userSelect:"none"}}),r.resize(),r.settings.nodeProgramClasses)r.registerNodeProgram(a,r.settings.nodeProgramClasses[a],r.settings.nodeHoverProgramClasses[a]);for(var s in r.settings.edgeProgramClasses)r.registerEdgeProgram(s,r.settings.edgeProgramClasses[s]);return r.camera=new Oe,r.bindCameraHandlers(),r.mouseCaptor=new Ze(r.elements.mouse,r),r.mouseCaptor.setSettings(r.settings),r.touchCaptor=new Xe(r.elements.mouse,r),r.touchCaptor.setSettings(r.settings),r.bindEventHandlers(),r.bindGraphHandlers(),r.handleSettingsUpdate(),r.refresh(),r}return c(i,n),o(i,[{key:"registerNodeProgram",value:function(e,t,n){return this.nodePrograms[e]&&this.nodePrograms[e].kill(),this.nodeHoverPrograms[e]&&this.nodeHoverPrograms[e].kill(),this.nodePrograms[e]=new t(this.webGLContexts.nodes,this.frameBuffers.nodes,this),this.nodeHoverPrograms[e]=new(n||t)(this.webGLContexts.hoverNodes,null,this),this}},{key:"registerEdgeProgram",value:function(e,t){return this.edgePrograms[e]&&this.edgePrograms[e].kill(),this.edgePrograms[e]=new t(this.webGLContexts.edges,this.frameBuffers.edges,this),this}},{key:"unregisterNodeProgram",value:function(t){if(this.nodePrograms[t]){var n=this.nodePrograms,i=n[t],r=Je(n,[t].map(e));i.kill(),this.nodePrograms=r}if(this.nodeHoverPrograms[t]){var o=this.nodeHoverPrograms,a=o[t],s=Je(o,[t].map(e));a.kill(),this.nodePrograms=s}return this}},{key:"unregisterEdgeProgram",value:function(t){if(this.edgePrograms[t]){var n=this.edgePrograms,i=n[t],r=Je(n,[t].map(e));i.kill(),this.edgePrograms=r}return this}},{key:"resetWebGLTexture",value:function(e){var t=this.webGLContexts[e],n=this.frameBuffers[e],i=this.textures[e];i&&t.deleteTexture(i);var r=t.createTexture();return t.bindFramebuffer(t.FRAMEBUFFER,n),t.bindTexture(t.TEXTURE_2D,r),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width,this.height,0,t.RGBA,t.UNSIGNED_BYTE,null),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0),this.textures[e]=r,this}},{key:"bindCameraHandlers",value:function(){var e=this;return this.activeListeners.camera=function(){e.scheduleRender()},this.camera.on("updated",this.activeListeners.camera),this}},{key:"unbindCameraHandlers",value:function(){return this.camera.removeListener("updated",this.activeListeners.camera),this}},{key:"getNodeAtPosition",value:function(e){var t=e.x,n=e.y,i=L(this.webGLContexts.nodes,this.frameBuffers.nodes,t,n,this.pixelRatio,this.pickingDownSizingRatio),r=S.apply(void 0,Ke(i)),o=this.itemIDsIndex[r];return o&&"node"===o.type?o.id:null}},{key:"bindEventHandlers",value:function(){var e=this;this.activeListeners.handleResize=function(){e.scheduleRefresh()},window.addEventListener("resize",this.activeListeners.handleResize),this.activeListeners.handleMove=function(t){var n=Ue(t),i={event:n,preventSigmaDefault:function(){n.preventSigmaDefault()}},r=e.getNodeAtPosition(n);if(r&&e.hoveredNode!==r&&!e.nodeDataCache[r].hidden)return e.hoveredNode&&e.emit("leaveNode",T(T({},i),{},{node:e.hoveredNode})),e.hoveredNode=r,e.emit("enterNode",T(T({},i),{},{node:r})),void e.scheduleHighlightedNodesRender();if(e.hoveredNode&&e.getNodeAtPosition(n)!==e.hoveredNode){var o=e.hoveredNode;return e.hoveredNode=null,e.emit("leaveNode",T(T({},i),{},{node:o})),void e.scheduleHighlightedNodesRender()}if(e.settings.enableEdgeEvents){var a=e.hoveredNode?null:e.getEdgeAtPoint(i.event.x,i.event.y);a!==e.hoveredEdge&&(e.hoveredEdge&&e.emit("leaveEdge",T(T({},i),{},{edge:e.hoveredEdge})),a&&e.emit("enterEdge",T(T({},i),{},{edge:a})),e.hoveredEdge=a)}},this.activeListeners.handleMoveBody=function(t){var n=Ue(t);e.emit("moveBody",{event:n,preventSigmaDefault:function(){n.preventSigmaDefault()}})},this.activeListeners.handleLeave=function(t){var n=Ue(t),i={event:n,preventSigmaDefault:function(){n.preventSigmaDefault()}};e.hoveredNode&&(e.emit("leaveNode",T(T({},i),{},{node:e.hoveredNode})),e.scheduleHighlightedNodesRender()),e.settings.enableEdgeEvents&&e.hoveredEdge&&(e.emit("leaveEdge",T(T({},i),{},{edge:e.hoveredEdge})),e.scheduleHighlightedNodesRender()),e.emit("leaveStage",T({},i))},this.activeListeners.handleEnter=function(t){var n=Ue(t),i={event:n,preventSigmaDefault:function(){n.preventSigmaDefault()}};e.emit("enterStage",T({},i))};var t=function(t){return function(n){var i=Ue(n),r={event:i,preventSigmaDefault:function(){i.preventSigmaDefault()}},o=e.getNodeAtPosition(i);if(o)return e.emit("".concat(t,"Node"),T(T({},r),{},{node:o}));if(e.settings.enableEdgeEvents){var a=e.getEdgeAtPoint(i.x,i.y);if(a)return e.emit("".concat(t,"Edge"),T(T({},r),{},{edge:a}))}return e.emit("".concat(t,"Stage"),r)}};return this.activeListeners.handleClick=t("click"),this.activeListeners.handleRightClick=t("rightClick"),this.activeListeners.handleDoubleClick=t("doubleClick"),this.activeListeners.handleWheel=t("wheel"),this.activeListeners.handleDown=t("down"),this.activeListeners.handleUp=t("up"),this.mouseCaptor.on("mousemove",this.activeListeners.handleMove),this.mouseCaptor.on("mousemovebody",this.activeListeners.handleMoveBody),this.mouseCaptor.on("click",this.activeListeners.handleClick),this.mouseCaptor.on("rightClick",this.activeListeners.handleRightClick),this.mouseCaptor.on("doubleClick",this.activeListeners.handleDoubleClick),this.mouseCaptor.on("wheel",this.activeListeners.handleWheel),this.mouseCaptor.on("mousedown",this.activeListeners.handleDown),this.mouseCaptor.on("mouseup",this.activeListeners.handleUp),this.mouseCaptor.on("mouseleave",this.activeListeners.handleLeave),this.mouseCaptor.on("mouseenter",this.activeListeners.handleEnter),this.touchCaptor.on("touchdown",this.activeListeners.handleDown),this.touchCaptor.on("touchdown",this.activeListeners.handleMove),this.touchCaptor.on("touchup",this.activeListeners.handleUp),this.touchCaptor.on("touchmove",this.activeListeners.handleMove),this.touchCaptor.on("tap",this.activeListeners.handleClick),this.touchCaptor.on("doubletap",this.activeListeners.handleDoubleClick),this.touchCaptor.on("touchmove",this.activeListeners.handleMoveBody),this}},{key:"bindGraphHandlers",value:function(){var e=this,t=this.graph,n=new Set(["x","y","zIndex","type"]);return this.activeListeners.eachNodeAttributesUpdatedGraphUpdate=function(i){var r,o=null===(r=i.hints)||void 0===r?void 0:r.attributes;e.graph.forEachNode((function(t){return e.updateNode(t)}));var a=!o||o.some((function(e){return n.has(e)}));e.refresh({partialGraph:{nodes:t.nodes()},skipIndexation:!a,schedule:!0})},this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate=function(n){var i,r=null===(i=n.hints)||void 0===i?void 0:i.attributes;e.graph.forEachEdge((function(t){return e.updateEdge(t)}));var o=r&&["zIndex","type"].some((function(e){return null==r?void 0:r.includes(e)}));e.refresh({partialGraph:{edges:t.edges()},skipIndexation:!o,schedule:!0})},this.activeListeners.addNodeGraphUpdate=function(t){var n=t.key;e.addNode(n),e.refresh({partialGraph:{nodes:[n]},skipIndexation:!1,schedule:!0})},this.activeListeners.updateNodeGraphUpdate=function(t){var n=t.key;e.refresh({partialGraph:{nodes:[n]},skipIndexation:!1,schedule:!0})},this.activeListeners.dropNodeGraphUpdate=function(t){var n=t.key;e.removeNode(n),e.refresh({schedule:!0})},this.activeListeners.addEdgeGraphUpdate=function(t){var n=t.key;e.addEdge(n),e.refresh({partialGraph:{edges:[n]},schedule:!0})},this.activeListeners.updateEdgeGraphUpdate=function(t){var n=t.key;e.refresh({partialGraph:{edges:[n]},skipIndexation:!1,schedule:!0})},this.activeListeners.dropEdgeGraphUpdate=function(t){var n=t.key;e.removeEdge(n),e.refresh({schedule:!0})},this.activeListeners.clearEdgesGraphUpdate=function(){e.clearEdgeState(),e.clearEdgeIndices(),e.refresh({schedule:!0})},this.activeListeners.clearGraphUpdate=function(){e.clearEdgeState(),e.clearNodeState(),e.clearEdgeIndices(),e.clearNodeIndices(),e.refresh({schedule:!0})},t.on("nodeAdded",this.activeListeners.addNodeGraphUpdate),t.on("nodeDropped",this.activeListeners.dropNodeGraphUpdate),t.on("nodeAttributesUpdated",this.activeListeners.updateNodeGraphUpdate),t.on("eachNodeAttributesUpdated",this.activeListeners.eachNodeAttributesUpdatedGraphUpdate),t.on("edgeAdded",this.activeListeners.addEdgeGraphUpdate),t.on("edgeDropped",this.activeListeners.dropEdgeGraphUpdate),t.on("edgeAttributesUpdated",this.activeListeners.updateEdgeGraphUpdate),t.on("eachEdgeAttributesUpdated",this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate),t.on("edgesCleared",this.activeListeners.clearEdgesGraphUpdate),t.on("cleared",this.activeListeners.clearGraphUpdate),this}},{key:"unbindGraphHandlers",value:function(){var e=this.graph;e.removeListener("nodeAdded",this.activeListeners.addNodeGraphUpdate),e.removeListener("nodeDropped",this.activeListeners.dropNodeGraphUpdate),e.removeListener("nodeAttributesUpdated",this.activeListeners.updateNodeGraphUpdate),e.removeListener("eachNodeAttributesUpdated",this.activeListeners.eachNodeAttributesUpdatedGraphUpdate),e.removeListener("edgeAdded",this.activeListeners.addEdgeGraphUpdate),e.removeListener("edgeDropped",this.activeListeners.dropEdgeGraphUpdate),e.removeListener("edgeAttributesUpdated",this.activeListeners.updateEdgeGraphUpdate),e.removeListener("eachEdgeAttributesUpdated",this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate),e.removeListener("edgesCleared",this.activeListeners.clearEdgesGraphUpdate),e.removeListener("cleared",this.activeListeners.clearGraphUpdate)}},{key:"getEdgeAtPoint",value:function(e,t){var n=L(this.webGLContexts.edges,this.frameBuffers.edges,e,t,this.pixelRatio,this.pickingDownSizingRatio),i=S.apply(void 0,Ke(n)),r=this.itemIDsIndex[i];return r&&"edge"===r.type?r.id:null}},{key:"process",value:function(){var e=this;this.emit("beforeProcess");var t=this.graph,n=this.settings,i=this.getDimensions();if(this.nodeExtent=function(e){if(!e.order)return{x:[0,1],y:[0,1]};var t=1/0,n=-1/0,i=1/0,r=-1/0;return e.forEachNode((function(e,o){var a=o.x,s=o.y;a<t&&(t=a),a>n&&(n=a),s<i&&(i=s),s>r&&(r=s)})),{x:[t,n],y:[i,r]}}(this.graph),!this.settings.autoRescale){var r=i.width,o=i.height,a=this.nodeExtent,s=a.x,h=a.y;this.nodeExtent={x:[(s[0]+s[1])/2-r/2,(s[0]+s[1])/2+r/2],y:[(h[0]+h[1])/2-o/2,(h[0]+h[1])/2+o/2]}}this.normalizationFunction=Ae(this.customBBox||this.nodeExtent);var u=Se((new Oe).getState(),i,this.getGraphDimensions(),this.getStagePadding());this.labelGrid.resizeAndClear(i,n.labelGridCellSize);for(var c={},d={},l={},f={},p=1,g=t.nodes(),v=0,m=g.length;v<m;v++){var y=g[v],b=this.nodeDataCache[y],w=t.getNodeAttributes(y);b.x=w.x,b.y=w.y,this.normalizationFunction.applyTo(b),"string"!=typeof b.label||b.hidden||this.labelGrid.add(y,b.size,this.framedGraphToViewport(b,{matrix:u})),c[b.type]=(c[b.type]||0)+1}for(var x in this.labelGrid.organize(),this.nodePrograms){if(!et.call(this.nodePrograms,x))throw new Error('Sigma: could not find a suitable program for node type "'.concat(x,'"!'));this.nodePrograms[x].reallocate(c[x]||0),c[x]=0}this.settings.zIndex&&this.nodeZExtent[0]!==this.nodeZExtent[1]&&(g=Ne(this.nodeZExtent,(function(t){return e.nodeDataCache[t].zIndex}),g));for(var C=0,_=g.length;C<_;C++){var E=g[C];d[E]=p,f[d[E]]={type:"node",id:E},p++;var k=this.nodeDataCache[E];this.addNodeToProgram(E,d[E],c[k.type]++)}for(var S={},L=t.edges(),N=0,A=L.length;N<A;N++){var T=L[N],M=this.edgeDataCache[T];S[M.type]=(S[M.type]||0)+1}for(var D in this.settings.zIndex&&this.edgeZExtent[0]!==this.edgeZExtent[1]&&(L=Ne(this.edgeZExtent,(function(t){return e.edgeDataCache[t].zIndex}),L)),this.edgePrograms){if(!et.call(this.edgePrograms,D))throw new Error('Sigma: could not find a suitable program for edge type "'.concat(D,'"!'));this.edgePrograms[D].reallocate(S[D]||0),S[D]=0}for(var R=0,G=L.length;R<G;R++){var P=L[R];l[P]=p,f[l[P]]={type:"edge",id:P},p++;var F=this.edgeDataCache[P];this.addEdgeToProgram(P,l[P],S[F.type]++)}return this.itemIDsIndex=f,this.nodeIndices=d,this.edgeIndices=l,this.emit("afterProcess"),this}},{key:"handleSettingsUpdate",value:function(e){var t=this,n=this.settings;if(this.camera.minRatio=n.minCameraRatio,this.camera.maxRatio=n.maxCameraRatio,this.camera.enabledZooming=n.enableCameraZooming,this.camera.enabledPanning=n.enableCameraPanning,this.camera.enabledRotation=n.enableCameraRotation,n.cameraPanBoundaries?this.camera.clean=function(e){return t.cleanCameraState(e,n.cameraPanBoundaries&&"object"===Te(n.cameraPanBoundaries)?n.cameraPanBoundaries:{})}:this.camera.clean=null,this.camera.setState(this.camera.validateState(this.camera.getState())),e){if(e.edgeProgramClasses!==n.edgeProgramClasses){for(var i in n.edgeProgramClasses)n.edgeProgramClasses[i]!==e.edgeProgramClasses[i]&&this.registerEdgeProgram(i,n.edgeProgramClasses[i]);for(var r in e.edgeProgramClasses)n.edgeProgramClasses[r]||this.unregisterEdgeProgram(r)}if(e.nodeProgramClasses!==n.nodeProgramClasses||e.nodeHoverProgramClasses!==n.nodeHoverProgramClasses){for(var o in n.nodeProgramClasses)n.nodeProgramClasses[o]===e.nodeProgramClasses[o]&&n.nodeHoverProgramClasses[o]===e.nodeHoverProgramClasses[o]||this.registerNodeProgram(o,n.nodeProgramClasses[o],n.nodeHoverProgramClasses[o]);for(var a in e.nodeProgramClasses)n.nodeProgramClasses[a]||this.unregisterNodeProgram(a)}}return this.mouseCaptor.setSettings(this.settings),this.touchCaptor.setSettings(this.settings),this}},{key:"cleanCameraState",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.tolerance,i=void 0===n?0:n,r=t.boundaries,o=T({},e),a=r||this.nodeExtent,s=f(a.x,2),h=s[0],u=s[1],c=f(a.y,2),d=c[0],l=c[1],p=[this.graphToViewport({x:h,y:d},{cameraState:e}),this.graphToViewport({x:u,y:d},{cameraState:e}),this.graphToViewport({x:h,y:l},{cameraState:e}),this.graphToViewport({x:u,y:l},{cameraState:e})],g=1/0,v=-1/0,m=1/0,y=-1/0;p.forEach((function(e){var t=e.x,n=e.y;g=Math.min(g,t),v=Math.max(v,t),m=Math.min(m,n),y=Math.max(y,n)}));var b=v-g,w=y-m,x=this.getDimensions(),C=x.width,_=x.height,E=0,k=0;if(b>=C?v<C-i?E=v-(C-i):g>i&&(E=g-i):v>C+i?E=v-(C+i):g<-i&&(E=g+i),w>=_?y<_-i?k=y-(_-i):m>i&&(k=m-i):y>_+i?k=y-(_+i):m<-i&&(k=m+i),E||k){var S=this.viewportToFramedGraph({x:0,y:0},{cameraState:e}),L=this.viewportToFramedGraph({x:E,y:k},{cameraState:e});E=L.x-S.x,k=L.y-S.y,o.x+=E,o.y+=k}return o}},{key:"renderLabels",value:function(){if(!this.settings.renderLabels)return this;var e=this.camera.getState(),t=this.labelGrid.getLabelsToDisplay(e.ratio,this.settings.labelDensity);Me(t,this.nodesWithForcedLabels),this.displayedNodeLabels=new Set;for(var n=this.canvasContexts.labels,i=0,r=t.length;i<r;i++){var o=t[i],a=this.nodeDataCache[o];if(!this.displayedNodeLabels.has(o)&&!a.hidden){var s=this.framedGraphToViewport(a),h=s.x,u=s.y,c=this.scaleSize(a.size);if((a.forceLabel||!(c<this.settings.labelRenderedSizeThreshold))&&!(h<-150||h>this.width+150||u<-50||u>this.height+50)){this.displayedNodeLabels.add(o);var d=this.settings.defaultDrawNodeLabel,l=this.nodePrograms[a.type];((null==l?void 0:l.drawLabel)||d)(n,T(T({key:o},a),{},{size:c,x:h,y:u}),this.settings)}}}return this}},{key:"renderEdgeLabels",value:function(){if(!this.settings.renderEdgeLabels)return this;var e=this.canvasContexts.edgeLabels;e.clearRect(0,0,this.width,this.height);var t,n,i,r,o,a=(t={graph:this.graph,hoveredNode:this.hoveredNode,displayedNodeLabels:this.displayedNodeLabels,highlightedNodes:this.highlightedNodes},n=t.hoveredNode,i=t.highlightedNodes,r=t.displayedNodeLabels,o=[],t.graph.forEachEdge((function(e,t,a,s){(a===n||s===n||i.has(a)||i.has(s)||r.has(a)&&r.has(s))&&o.push(e)})),o);Me(a,this.edgesWithForcedLabels);for(var s=new Set,h=0,u=a.length;h<u;h++){var c=a[h],d=this.graph.extremities(c),l=this.nodeDataCache[d[0]],f=this.nodeDataCache[d[1]],p=this.edgeDataCache[c];if(!s.has(c)&&!(p.hidden||l.hidden||f.hidden)){var g=this.settings.defaultDrawEdgeLabel,v=this.edgePrograms[p.type];((null==v?void 0:v.drawLabel)||g)(e,T(T({key:c},p),{},{size:this.scaleSize(p.size)}),T(T(T({key:d[0]},l),this.framedGraphToViewport(l)),{},{size:this.scaleSize(l.size)}),T(T(T({key:d[1]},f),this.framedGraphToViewport(f)),{},{size:this.scaleSize(f.size)}),this.settings),s.add(c)}}return this.displayedEdgeLabels=s,this}},{key:"renderHighlightedNodes",value:function(){var e=this,t=this.canvasContexts.hovers;t.clearRect(0,0,this.width,this.height);var n=[];this.hoveredNode&&!this.nodeDataCache[this.hoveredNode].hidden&&n.push(this.hoveredNode),this.highlightedNodes.forEach((function(t){t!==e.hoveredNode&&n.push(t)})),n.forEach((function(n){return function(n){var i=e.nodeDataCache[n],r=e.framedGraphToViewport(i),o=r.x,a=r.y,s=e.scaleSize(i.size),h=e.settings.defaultDrawNodeHover,u=e.nodePrograms[i.type];((null==u?void 0:u.drawHover)||h)(t,T(T({key:n},i),{},{size:s,x:o,y:a}),e.settings)}(n)}));var i={};for(var r in n.forEach((function(t){var n=e.nodeDataCache[t].type;i[n]=(i[n]||0)+1})),this.nodeHoverPrograms)this.nodeHoverPrograms[r].reallocate(i[r]||0),i[r]=0;n.forEach((function(t){var n=e.nodeDataCache[t];e.nodeHoverPrograms[n.type].process(0,i[n.type]++,n)})),this.webGLContexts.hoverNodes.clear(this.webGLContexts.hoverNodes.COLOR_BUFFER_BIT);var o=this.getRenderParams();for(var a in this.nodeHoverPrograms)this.nodeHoverPrograms[a].render(o)}},{key:"scheduleHighlightedNodesRender",value:function(){var e=this;this.renderHighlightedNodesFrame||this.renderFrame||(this.renderHighlightedNodesFrame=requestAnimationFrame((function(){e.renderHighlightedNodesFrame=null,e.renderHighlightedNodes(),e.renderEdgeLabels()})))}},{key:"render",value:function(){var e=this;this.emit("beforeRender");var t=function(){return e.emit("afterRender"),e};if(this.renderFrame&&(cancelAnimationFrame(this.renderFrame),this.renderFrame=null),this.resize(),this.needToProcess&&this.process(),this.needToProcess=!1,this.clear(),this.pickingLayers.forEach((function(t){return e.resetWebGLTexture(t)})),!this.graph.order)return t();var n=this.mouseCaptor,i=this.camera.isAnimated()||n.isMoving||n.draggedEvents||n.currentWheelDirection,r=this.camera.getState(),o=this.getDimensions(),a=this.getGraphDimensions(),s=this.getStagePadding();this.matrix=Se(r,o,a,s),this.invMatrix=Se(r,o,a,s,!0),this.correctionRatio=function(e,t,n){var i=ke(e,{x:Math.cos(t.angle),y:Math.sin(t.angle)},0),r=i.x,o=i.y;return 1/Math.sqrt(Math.pow(r,2)+Math.pow(o,2))/n.width}(this.matrix,r,o),this.graphToViewportRatio=this.getGraphToViewportRatio();var h=this.getRenderParams();for(var u in this.nodePrograms)this.nodePrograms[u].render(h);if(!this.settings.hideEdgesOnMove||!i)for(var c in this.edgePrograms)this.edgePrograms[c].render(h);return this.settings.hideLabelsOnMove&&i||(this.renderLabels(),this.renderEdgeLabels(),this.renderHighlightedNodes()),t()}},{key:"addNode",value:function(e){var t=Object.assign({},this.graph.getNodeAttributes(e));this.settings.nodeReducer&&(t=this.settings.nodeReducer(e,t));var n=function(e,t,n){if(!et.call(n,"x")||!et.call(n,"y"))throw new Error('Sigma: could not find a valid position (x, y) for node "'.concat(t,'". All your nodes must have a number "x" and "y". Maybe your forgot to apply a layout or your "nodeReducer" is not returning the correct data?'));return n.color||(n.color=e.defaultNodeColor),n.label||""===n.label||(n.label=null),void 0!==n.label&&null!==n.label?n.label=""+n.label:n.label=null,n.size||(n.size=2),et.call(n,"hidden")||(n.hidden=!1),et.call(n,"highlighted")||(n.highlighted=!1),et.call(n,"forceLabel")||(n.forceLabel=!1),n.type&&""!==n.type||(n.type=e.defaultNodeType),n.zIndex||(n.zIndex=0),n}(this.settings,e,t);this.nodeDataCache[e]=n,this.nodesWithForcedLabels.delete(e),n.forceLabel&&!n.hidden&&this.nodesWithForcedLabels.add(e),this.highlightedNodes.delete(e),n.highlighted&&!n.hidden&&this.highlightedNodes.add(e),this.settings.zIndex&&(n.zIndex<this.nodeZExtent[0]&&(this.nodeZExtent[0]=n.zIndex),n.zIndex>this.nodeZExtent[1]&&(this.nodeZExtent[1]=n.zIndex))}},{key:"updateNode",value:function(e){this.addNode(e);var t=this.nodeDataCache[e];this.normalizationFunction.applyTo(t)}},{key:"removeNode",value:function(e){delete this.nodeDataCache[e],delete this.nodeProgramIndex[e],this.highlightedNodes.delete(e),this.hoveredNode===e&&(this.hoveredNode=null),this.nodesWithForcedLabels.delete(e)}},{key:"addEdge",value:function(e){var t=Object.assign({},this.graph.getEdgeAttributes(e));this.settings.edgeReducer&&(t=this.settings.edgeReducer(e,t));var n=function(e,t,n){return n.color||(n.color=e.defaultEdgeColor),n.label||(n.label=""),n.size||(n.size=.5),et.call(n,"hidden")||(n.hidden=!1),et.call(n,"forceLabel")||(n.forceLabel=!1),n.type&&""!==n.type||(n.type=e.defaultEdgeType),n.zIndex||(n.zIndex=0),n}(this.settings,0,t);this.edgeDataCache[e]=n,this.edgesWithForcedLabels.delete(e),n.forceLabel&&!n.hidden&&this.edgesWithForcedLabels.add(e),this.settings.zIndex&&(n.zIndex<this.edgeZExtent[0]&&(this.edgeZExtent[0]=n.zIndex),n.zIndex>this.edgeZExtent[1]&&(this.edgeZExtent[1]=n.zIndex))}},{key:"updateEdge",value:function(e){this.addEdge(e)}},{key:"removeEdge",value:function(e){delete this.edgeDataCache[e],delete this.edgeProgramIndex[e],this.hoveredEdge===e&&(this.hoveredEdge=null),this.edgesWithForcedLabels.delete(e)}},{key:"clearNodeIndices",value:function(){this.labelGrid=new Qe,this.nodeExtent={x:[0,1],y:[0,1]},this.nodeDataCache={},this.edgeProgramIndex={},this.nodesWithForcedLabels=new Set,this.nodeZExtent=[1/0,-1/0]}},{key:"clearEdgeIndices",value:function(){this.edgeDataCache={},this.edgeProgramIndex={},this.edgesWithForcedLabels=new Set,this.edgeZExtent=[1/0,-1/0]}},{key:"clearIndices",value:function(){this.clearEdgeIndices(),this.clearNodeIndices()}},{key:"clearNodeState",value:function(){this.displayedNodeLabels=new Set,this.highlightedNodes=new Set,this.hoveredNode=null}},{key:"clearEdgeState",value:function(){this.displayedEdgeLabels=new Set,this.highlightedNodes=new Set,this.hoveredEdge=null}},{key:"clearState",value:function(){this.clearEdgeState(),this.clearNodeState()}},{key:"addNodeToProgram",value:function(e,t,n){var i=this.nodeDataCache[e],r=this.nodePrograms[i.type];if(!r)throw new Error('Sigma: could not find a suitable program for node type "'.concat(i.type,'"!'));r.process(t,n,i),this.nodeProgramIndex[e]=n}},{key:"addEdgeToProgram",value:function(e,t,n){var i=this.edgeDataCache[e],r=this.edgePrograms[i.type];if(!r)throw new Error('Sigma: could not find a suitable program for edge type "'.concat(i.type,'"!'));var o=this.graph.extremities(e),a=this.nodeDataCache[o[0]],s=this.nodeDataCache[o[1]];r.process(t,n,a,s,i),this.edgeProgramIndex[e]=n}},{key:"getRenderParams",value:function(){return{matrix:this.matrix,invMatrix:this.invMatrix,width:this.width,height:this.height,pixelRatio:this.pixelRatio,zoomRatio:this.camera.ratio,cameraAngle:this.camera.angle,sizeRatio:1/this.scaleSize(),correctionRatio:this.correctionRatio,downSizingRatio:this.pickingDownSizingRatio,minEdgeThickness:this.settings.minEdgeThickness,antiAliasingFeather:this.settings.antiAliasingFeather}}},{key:"getStagePadding",value:function(){var e=this.settings,t=e.stagePadding;return e.autoRescale&&t||0}},{key:"createLayer",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(this.elements[e])throw new Error('Sigma: a layer named "'.concat(e,'" already exists'));var i=function(e,t,n){var i=document.createElement(e);if(t)for(var r in t)i.style[r]=t[r];if(n)for(var o in n)i.setAttribute(o,n[o]);return i}(t,{position:"absolute"},{class:"sigma-".concat(e)});return n.style&&Object.assign(i.style,n.style),this.elements[e]=i,"beforeLayer"in n&&n.beforeLayer?this.elements[n.beforeLayer].before(i):"afterLayer"in n&&n.afterLayer?this.elements[n.afterLayer].after(i):this.container.appendChild(i),i}},{key:"createCanvas",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.createLayer(e,"canvas",t)}},{key:"createCanvasContext",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.createCanvas(e,t);return this.canvasContexts[e]=n.getContext("2d",{preserveDrawingBuffer:!1,antialias:!1}),this}},{key:"createWebGLContext",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(null==t?void 0:t.canvas)||this.createCanvas(e,t);t.hidden&&n.remove();var i,r=T({preserveDrawingBuffer:!1,antialias:!1},t);(i=n.getContext("webgl2",r))||(i=n.getContext("webgl",r)),i||(i=n.getContext("experimental-webgl",r));var o=i;if(this.webGLContexts[e]=o,o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA),t.picking){this.pickingLayers.add(e);var a=o.createFramebuffer();if(!a)throw new Error("Sigma: cannot create a new frame buffer for layer ".concat(e));this.frameBuffers[e]=a}return o}},{key:"killLayer",value:function(e){var t,n=this.elements[e];if(!n)throw new Error("Sigma: cannot kill layer ".concat(e,", which does not exist"));return this.webGLContexts[e]?(null===(t=this.webGLContexts[e].getExtension("WEBGL_lose_context"))||void 0===t||t.loseContext(),delete this.webGLContexts[e]):this.canvasContexts[e]&&delete this.canvasContexts[e],n.remove(),delete this.elements[e],this}},{key:"getCamera",value:function(){return this.camera}},{key:"setCamera",value:function(e){this.unbindCameraHandlers(),this.camera=e,this.bindCameraHandlers()}},{key:"getContainer",value:function(){return this.container}},{key:"getGraph",value:function(){return this.graph}},{key:"setGraph",value:function(e){e!==this.graph&&(this.hoveredNode&&!e.hasNode(this.hoveredNode)&&(this.hoveredNode=null),this.hoveredEdge&&!e.hasEdge(this.hoveredEdge)&&(this.hoveredEdge=null),this.unbindGraphHandlers(),null!==this.checkEdgesEventsFrame&&(cancelAnimationFrame(this.checkEdgesEventsFrame),this.checkEdgesEventsFrame=null),this.graph=e,this.bindGraphHandlers(),this.refresh())}},{key:"getMouseCaptor",value:function(){return this.mouseCaptor}},{key:"getTouchCaptor",value:function(){return this.touchCaptor}},{key:"getDimensions",value:function(){return{width:this.width,height:this.height}}},{key:"getGraphDimensions",value:function(){var e=this.customBBox||this.nodeExtent;return{width:e.x[1]-e.x[0]||1,height:e.y[1]-e.y[0]||1}}},{key:"getNodeDisplayData",value:function(e){var t=this.nodeDataCache[e];return t?Object.assign({},t):void 0}},{key:"getEdgeDisplayData",value:function(e){var t=this.edgeDataCache[e];return t?Object.assign({},t):void 0}},{key:"getNodeDisplayedLabels",value:function(){return new Set(this.displayedNodeLabels)}},{key:"getEdgeDisplayedLabels",value:function(){return new Set(this.displayedEdgeLabels)}},{key:"getSettings",value:function(){return T({},this.settings)}},{key:"getSetting",value:function(e){return this.settings[e]}},{key:"setSetting",value:function(e,t){var n=T({},this.settings);return this.settings[e]=t,Fe(this.settings),this.handleSettingsUpdate(n),this.scheduleRefresh(),this}},{key:"updateSetting",value:function(e,t){return this.setSetting(e,t(this.settings[e])),this}},{key:"setSettings",value:function(e){var t=T({},this.settings);return this.settings=T(T({},this.settings),e),Fe(this.settings),this.handleSettingsUpdate(t),this.scheduleRefresh(),this}},{key:"resize",value:function(e){var t=this.width,n=this.height;if(this.width=this.container.offsetWidth,this.height=this.container.offsetHeight,this.pixelRatio=Le(),0===this.width){if(!this.settings.allowInvalidContainer)throw new Error("Sigma: Container has no width. You can set the allowInvalidContainer setting to true to stop seeing this error.");this.width=1}if(0===this.height){if(!this.settings.allowInvalidContainer)throw new Error("Sigma: Container has no height. You can set the allowInvalidContainer setting to true to stop seeing this error.");this.height=1}if(!e&&t===this.width&&n===this.height)return this;for(var i in this.elements){var r=this.elements[i];r.style.width=this.width+"px",r.style.height=this.height+"px"}for(var o in this.canvasContexts)this.elements[o].setAttribute("width",this.width*this.pixelRatio+"px"),this.elements[o].setAttribute("height",this.height*this.pixelRatio+"px"),1!==this.pixelRatio&&this.canvasContexts[o].scale(this.pixelRatio,this.pixelRatio);for(var a in this.webGLContexts){this.elements[a].setAttribute("width",this.width*this.pixelRatio+"px"),this.elements[a].setAttribute("height",this.height*this.pixelRatio+"px");var s=this.webGLContexts[a];if(s.viewport(0,0,this.width*this.pixelRatio,this.height*this.pixelRatio),this.pickingLayers.has(a)){var h=this.textures[a];h&&s.deleteTexture(h)}}return this.emit("resize"),this}},{key:"clear",value:function(){return this.emit("beforeClear"),this.webGLContexts.nodes.bindFramebuffer(WebGLRenderingContext.FRAMEBUFFER,null),this.webGLContexts.nodes.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.webGLContexts.edges.bindFramebuffer(WebGLRenderingContext.FRAMEBUFFER,null),this.webGLContexts.edges.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.webGLContexts.hoverNodes.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.canvasContexts.labels.clearRect(0,0,this.width,this.height),this.canvasContexts.hovers.clearRect(0,0,this.width,this.height),this.canvasContexts.edgeLabels.clearRect(0,0,this.width,this.height),this.emit("afterClear"),this}},{key:"refresh",value:function(e){var t=this,n=void 0!==(null==e?void 0:e.skipIndexation)&&(null==e?void 0:e.skipIndexation),i=void 0!==(null==e?void 0:e.schedule)&&e.schedule,r=!e||!e.partialGraph;if(r)this.clearEdgeIndices(),this.clearNodeIndices(),this.graph.forEachNode((function(e){return t.addNode(e)})),this.graph.forEachEdge((function(e){return t.addEdge(e)}));else{for(var o,a,s=(null===(o=e.partialGraph)||void 0===o?void 0:o.nodes)||[],h=0,u=(null==s?void 0:s.length)||0;h<u;h++){var c=s[h];if(this.updateNode(c),n){var d=this.nodeProgramIndex[c];if(void 0===d)throw new Error('Sigma: node "'.concat(c,"\" can't be repaint"));this.addNodeToProgram(c,this.nodeIndices[c],d)}}for(var l=(null==e||null===(a=e.partialGraph)||void 0===a?void 0:a.edges)||[],f=0,p=l.length;f<p;f++){var g=l[f];if(this.updateEdge(g),n){var v=this.edgeProgramIndex[g];if(void 0===v)throw new Error('Sigma: edge "'.concat(g,"\" can't be repaint"));this.addEdgeToProgram(g,this.edgeIndices[g],v)}}}return!r&&n||(this.needToProcess=!0),i?this.scheduleRender():this.render(),this}},{key:"scheduleRender",value:function(){var e=this;return this.renderFrame||(this.renderFrame=requestAnimationFrame((function(){e.render()}))),this}},{key:"scheduleRefresh",value:function(e){return this.refresh(T(T({},e),{},{schedule:!0}))}},{key:"getViewportZoomedState",value:function(e,t){var n=this.camera.getState(),i=n.ratio,r=n.angle,o=n.x,a=n.y,s=this.settings,h=s.minCameraRatio,u=s.maxCameraRatio;"number"==typeof u&&(t=Math.min(t,u)),"number"==typeof h&&(t=Math.max(t,h));var c=t/i,d={x:this.width/2,y:this.height/2},l=this.viewportToFramedGraph(e),f=this.viewportToFramedGraph(d);return{angle:r,x:(l.x-f.x)*(1-c)+o,y:(l.y-f.y)*(1-c)+a,ratio:t}}},{key:"viewRectangle",value:function(){var e=this.viewportToFramedGraph({x:0,y:0}),t=this.viewportToFramedGraph({x:this.width,y:0}),n=this.viewportToFramedGraph({x:0,y:this.height});return{x1:e.x,y1:e.y,x2:t.x,y2:t.y,height:t.y-n.y}}},{key:"framedGraphToViewport",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!!t.cameraState||!!t.viewportDimensions||!!t.graphDimensions,i=ke(t.matrix?t.matrix:n?Se(t.cameraState||this.camera.getState(),t.viewportDimensions||this.getDimensions(),t.graphDimensions||this.getGraphDimensions(),t.padding||this.getStagePadding()):this.matrix,e);return{x:(1+i.x)*this.width/2,y:(1-i.y)*this.height/2}}},{key:"viewportToFramedGraph",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!!t.cameraState||!!t.viewportDimensions||!t.graphDimensions,i=ke(t.matrix?t.matrix:n?Se(t.cameraState||this.camera.getState(),t.viewportDimensions||this.getDimensions(),t.graphDimensions||this.getGraphDimensions(),t.padding||this.getStagePadding(),!0):this.invMatrix,{x:e.x/this.width*2-1,y:1-e.y/this.height*2});return isNaN(i.x)&&(i.x=0),isNaN(i.y)&&(i.y=0),i}},{key:"viewportToGraph",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.normalizationFunction.inverse(this.viewportToFramedGraph(e,t))}},{key:"graphToViewport",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.framedGraphToViewport(this.normalizationFunction(e),t)}},{key:"getGraphToViewportRatio",value:function(){var e={x:0,y:0},t={x:1,y:1},n=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),i=this.graphToViewport(e),r=this.graphToViewport(t);return Math.sqrt(Math.pow(i.x-r.x,2)+Math.pow(i.y-r.y,2))/n}},{key:"getBBox",value:function(){return this.nodeExtent}},{key:"getCustomBBox",value:function(){return this.customBBox}},{key:"setCustomBBox",value:function(e){return this.customBBox=e,this.scheduleRender(),this}},{key:"kill",value:function(){this.emit("kill"),this.removeAllListeners(),this.unbindCameraHandlers(),window.removeEventListener("resize",this.activeListeners.handleResize),this.mouseCaptor.kill(),this.touchCaptor.kill(),this.unbindGraphHandlers(),this.clearIndices(),this.clearState(),this.nodeDataCache={},this.edgeDataCache={},this.highlightedNodes.clear(),this.renderFrame&&(cancelAnimationFrame(this.renderFrame),this.renderFrame=null),this.renderHighlightedNodesFrame&&(cancelAnimationFrame(this.renderHighlightedNodesFrame),this.renderHighlightedNodesFrame=null);for(var e=this.container;e.firstChild;)e.removeChild(e.firstChild);for(var t in this.canvasContexts={},this.webGLContexts={},this.elements={},this.nodePrograms)this.nodePrograms[t].kill();for(var n in this.nodeHoverPrograms)this.nodeHoverPrograms[n].kill();for(var i in this.edgePrograms)this.edgePrograms[i].kill();for(var r in this.nodePrograms={},this.nodeHoverPrograms={},this.edgePrograms={},this.elements)this.killLayer(r)}},{key:"scaleSize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.camera.ratio;return e/this.settings.zoomToSizeRatioFunction(t)*("positions"===this.getSetting("itemSizesReference")?t*this.graphToViewportRatio:1)}},{key:"getCanvases",value:function(){var e={};for(var t in this.elements)this.elements[t]instanceof HTMLCanvasElement&&(e[t]=this.elements[t]);return e}}])}(ge);function nt(e,t,n,i){var r=document.createElement("button");return r.setAttribute("data-tooltip",n),r.innerHTML=e,i&&(r.className=i),r.addEventListener("click",t),r}function it(e,t){var n=t.canvas.getBoundingClientRect().width,i=t.measureText(e.label||"").width,r=Math.round(i+6),o=e.x+e.size+2,a=!0;if(o+r>n){var s=n-(e.x+e.size+2);e.x-e.size-2>s&&(o=e.x-r-e.size-2+3,a=!1)}return{x:o,isRightSide:a}}function rt(e,t,n){if(t.label){var i=it(t,e).x,r=n.labelSize,o=n.labelFont,a=n.labelWeight,s=n.labelColor.attribute?t[n.labelColor.attribute]||n.labelColor.color||"#000":n.labelColor.color;e.shadowColor="transparent",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0,e.fillStyle=s,e.font="".concat(a," ").concat(r,"px ").concat(o);var h=t.y+r/3;e.fillText(t.label,i,h)}}function ot(e,t,n){var i=n.labelSize,r=n.labelFont,o=n.labelWeight;e.font="".concat(o," ").concat(i,"px ").concat(r),e.save(),function(e,t,n){if(e.fillStyle="#FFF",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=8,e.shadowColor="#000","string"==typeof t.label){var i=e.measureText(t.label).width,r=Math.round(i+6),o=Math.round(n.labelSize+4),a=Math.max(t.size,n.labelSize/2)+2,s=it(t,e).isRightSide,h=o/2,u=Math.sqrt(Math.max(0,a*a-h*h)),c=Math.asin(h/a);e.beginPath(),s?(e.moveTo(t.x+u,t.y+h),e.lineTo(t.x+(a+r),t.y+h),e.lineTo(t.x+(a+r),t.y-h),e.lineTo(t.x+u,t.y-h),e.arc(t.x,t.y,a,-c,+c,!0)):(e.moveTo(t.x-u,t.y+h),e.lineTo(t.x-(a+r+3),t.y+h),e.lineTo(t.x-(a+r+3),t.y-h),e.lineTo(t.x-u,t.y-h),e.arc(t.x,t.y,a,Math.PI-c,Math.PI+c,!0)),e.closePath(),e.fill()}else e.beginPath(),e.arc(t.x,t.y,t.size+2,0,2*Math.PI),e.closePath(),e.fill()}(e,t,n),rt(e,t,n),t.hovered&&n.defaultHoverTemplate&&(t.htmlHover||n.showHtmlHoverDefault&&!1!==t.htmlHover)&&function(e,t,n,i){if(n.defaultHoverTemplate){var r=function(e,t){return e.replace(/\${(\w+)}/g,(function(e,n){return void 0!==t[n]?String(t[n]):e}))}(n.defaultHoverTemplate,t),o=function(e){var t=document.getElementById("node-hover-overlay");return t||((t=document.createElement("div")).id="node-hover-overlay",t.style.position="absolute",t.style.pointerEvents="none",t.style.border="1px solid #ccc",t.style.borderRadius="4px",t.style.backgroundColor="#fff",t.style.padding="4px",t.style.zIndex="100",document.body.appendChild(t),e.canvas.addEventListener("mousemove",(function(e){t&&"block"===t.style.display&&(t.style.left=e.clientX+2+"px",t.style.top=e.clientY+2+"px")}))),t}(e);o.innerHTML=r,o.style.display="block";var a=e.canvas.getBoundingClientRect();o.style.left=a.left+i.x+2+"px",o.style.top=a.top+i.y+2+"px"}}(e,t,n,{x:it(t,e).x,y:t.y+i+4}),e.restore()}var at=n(803);function st(){var e=10,t=50,n=1e4,i=1e-4;function r(e,t,n,i){e[t+2]+=i,e[n+2]-=i}function o(e,t,n,i){e[t+3]+=i,e[n+3]-=i}function a(e,n,i,a,s,h){var u,c=e[n+0]-e[i+0],d=e[n+1]-e[i+1],l=c*c+d*d,f=e[n+8]+e[i+8],p=Math.sqrt(c*c+d*d)-f,g=Math.sqrt(l),v=a*e[n+6]*e[i+6];if(s){var m=null!=h?h:150*Math.sqrt(a);u=p>0?v/(g*p*(1+p/m)):t*v}else u=p>0?v/(g*p):t*v;r(e,n,i,c*u),o(e,n,i,d*u)}function s(e,t,n,i,a,s,h){void 0===h&&(h=2);var u=e[t+0]-e[n+0],c=e[t+1]-e[n+1],d=u*u+c*c;if(d>0){var l,f=Math.sqrt(d),p=i*e[t+6]*e[n+6];r(e,t,n,u*(l=a?p/((1+f/(null!=s?s:150*Math.sqrt(i)))*Math.pow(f,h)):p/Math.pow(f,h))),o(e,t,n,c*l)}}var h=function(e,t){var n=e?a:s;return function(e,i,r,o,a){return n(e,i,r,o,t,a)}};function u(e,t,n,i){var a=e[t+0]-e[n+0],s=e[t+1]-e[n+1],h=-i;r(e,t,n,a*h),o(e,t,n,s*h)}function c(e,t,n,i){var a=e[t+0]-e[n+0],s=e[t+1]-e[n+1],h=Math.sqrt(a*a+s*s),u=-i*(h-e[t+8]-e[n+8])/h;r(e,t,n,a*u),o(e,t,n,s*u)}function d(e,t,n,i){var a=e[t+0]-e[n+0],s=e[t+1]-e[n+1],h=Math.sqrt(a*a+s*s);if(h>0){var u=-i*Math.log(1+h)/h;r(e,t,n,a*u),o(e,t,n,s*u)}}function l(e,t,n,i){var a=e[t+0]-e[n+0],s=e[t+1]-e[n+1],h=Math.sqrt(a*a+s*s)-e[t+8]-e[n+8];if(h>0){var u=-i*Math.log(1+h)/h;r(e,t,n,a*u),o(e,t,n,s*u)}}function f(e,t){var n=e[t+4]-e[t+2],i=e[t+5]-e[t+3];return e[t+6]*Math.sqrt(Math.pow(n,2)+Math.pow(i,2))}function p(e,t){var n=e[t+4]+e[t+2],i=e[t+5]+e[t+3];return Math.sqrt(Math.pow(n,2)+Math.pow(i,2))/2}function g(n,i,r,o){for(var a=n.adjustSizes,s=n.maxForce?n.maxForce:t,g=0;g<i.length;g+=e)i[g+4]=i[g+2],i[g+5]=i[g+3],i[g+2]=0,i[g+3]=0;!function(t,n,i){var r,o=t.scalingRatio,a=t.adjustSizes,s=null!==(r=t.decayRepulsion)&&void 0!==r&&r,u=t.barnesHutThreshold,c=t.barnesHutTheta;i.forEach((function(t){if(t.length>=u)!function(t,n,i,r,o,a){void 0===a&&(a=!1),n.length;var s=function(t,n){var i,r,o,a=[],s=1/0,h=-1/0,u=1/0,c=-1/0;n.forEach((function(n){var i=n*e;s=Math.min(s,t[i+0]),h=Math.max(h,t[i+0]),u=Math.min(u,t[i+1]),c=Math.max(c,t[i+1])}));var d=h-s,l=c-u;d>l?c=(u-=(d-l)/2)+d:h=(s-=(l-d)/2)+l,a[0]=-1,a[1]=(s+h)/2,a[2]=(u+c)/2,a[3]=Math.max(h-s,c-u),a[4]=-1,a[5]=-1,a[6]=0,a[7]=0,a[8]=0;var f=1;return n.forEach((function(n){var s=n*e,h=0;for(o=3;;){if(!(a[h+5]>=0)){if(a[h+0]<0){a[h+0]=s;break}a[h+5]=9*f;var u=a[h+3]/2,c=a[h+5];if(a[c+0]=-1,a[c+1]=a[h+1]-u,a[c+2]=a[h+2]-u,a[c+3]=u,a[c+4]=c+9,a[c+5]=-1,a[c+6]=0,a[c+7]=0,a[c+8]=0,a[(c+=9)+0]=-1,a[c+1]=a[h+1]-u,a[c+2]=a[h+2]+u,a[c+3]=u,a[c+4]=c+9,a[c+5]=-1,a[c+6]=0,a[c+7]=0,a[c+8]=0,a[(c+=9)+0]=-1,a[c+1]=a[h+1]+u,a[c+2]=a[h+2]-u,a[c+3]=u,a[c+4]=c+9,a[c+5]=-1,a[c+6]=0,a[c+7]=0,a[c+8]=0,a[(c+=9)+0]=-1,a[c+1]=a[h+1]+u,a[c+2]=a[h+2]+u,a[c+3]=u,a[c+4]=a[h+4],a[c+5]=-1,a[c+6]=0,a[c+7]=0,a[c+8]=0,f+=4,i=t[a[h+0]+0]<a[h+1]?t[a[h+0]+1]<a[h+2]?a[h+5]:a[h+5]+9:t[a[h+0]+1]<a[h+2]?a[h+5]+18:a[h+5]+27,a[h+6]=t[a[h+0]+6],a[h+7]=t[a[h+0]+0],a[h+8]=t[a[h+0]+1],a[i+0]=a[h+0],a[h+0]=-1,r=t[s+0]<a[h+1]?t[s+1]<a[h+2]?a[h+5]:a[h+5]+9:t[s+1]<a[h+2]?a[h+5]+18:a[h+5]+27,i===r){if(o--){h=i;continue}o=3;break}a[r+0]=s;break}i=t[s+0]<a[h+1]?t[s+1]<a[h+2]?a[h+5]:a[h+5]+9:t[s+1]<a[h+2]?a[h+5]+18:a[h+5]+27,a[h+7]=(a[h+7]*a[h+6]+t[s+0]*t[s+6])/(a[h+6]+t[s+6]),a[h+8]=(a[h+8]*a[h+6]+t[s+1]*t[s+6])/(a[h+6]+t[s+6]),a[h+6]+=t[s+6],h=i}})),a}(t,n),h=y(t,n);n.forEach((function(n){for(var u=n*e,c=0;;)if(s[c+5]>=0){var d=Math.pow(t[u+0]-s[c+7],2)+Math.pow(t[u+1]-s[c+8],2),l=s[c+3];if(4*l*l/d<o){var f=t[u+0]-s[c+7],p=t[u+1]-s[c+8],g=void 0,v=i*t[u+6]*s[c+6],m=Math.sqrt(d);if(!0===r?(b=m-2*t[u+8])>0?(g=a?v/(m*b*(1+b/h)):v/(b*m),t[u+2]+=f*g,t[u+3]+=p*g):b<0&&(g=v/Math.sqrt(d),t[u+2]+=f*g,t[u+3]+=p*g):d>0&&(g=a?v/((1+m/h)*d):v/d,t[u+2]+=f*g,t[u+3]+=p*g),(c=s[c+4])<0)break;continue}c=s[c+5]}else{var y=s[c+0];if(y>=0&&y!==u)if(d=(f=t[u+0]-t[y+0])*f+(p=t[u+1]-t[y+1])*p,m=Math.sqrt(d),g=void 0,v=i*t[u+6]*t[y+6],!0===r){var b=m-t[u+8]-t[y+8];Math.pow(b,2),b>0?(g=a?v/(m*b*(1+b/h)):v/(m*b),t[u+2]+=f*g,t[u+3]+=p*g):b<=0&&(g=2*v,t[u+2]+=f*g,t[u+3]+=p*g)}else d>0&&(g=a?v/((1+m/h)*d):v/d,t[u+2]+=f*g,t[u+3]+=p*g);if((c=s[c+4])<0)break}}))}(n,t,o,a,Math.pow(c,2),s);else{var i=h(a,s);!function(t,n,i,r){for(var o=y(t,n),a=0;a<n.length;a+=1)for(var s=n[a]*e,h=0;h<a;h+=1)r(t,s,n[h]*e,i,o)}(n,t,o,i)}}))}(n,i,o);for(var v=r.length,m=0;m<v;m+=3){var b=r[m+0],w=r[m+1],x=r[m+2];!0===a?n.linLogMode?l(i,b,w,x):c(i,b,w,x):n.linLogMode?d(i,b,w,x):u(i,b,w,x)}if(!0===a){for(g=0;g<i.length;g+=e)if(1!==i[g+9]){var C=Math.sqrt(Math.pow(i[g+2],2)+Math.pow(i[g+3],2));C>s&&(i[g+2]=i[g+2]*t/C,i[g+3]=i[g+3]*t/C);var _=f(i,g),E=p(i,g),k=1+Math.sqrt(_),S=i[g+7]*Math.log(1+E)*.5/k;i[g+7]=Math.min(1,Math.sqrt(S*(Math.pow(i[g+2],2)+Math.pow(i[g+3],2))/k));var L=S/n.slowDown;i[g+0]+=i[g+2]*L,i[g+1]+=i[g+3]*L}}else for(g=0;g<i.length;g+=e)1!==i[g+9]&&(_=f(i,g),E=p(i,g),k=1+Math.sqrt(_),S=i[g+7]*Math.log(1+E)/k,i[g+7]=Math.min(1,Math.sqrt(S*(Math.pow(i[g+2],2)+Math.pow(i[g+3],2))/k)),L=S/n.slowDown,i[g+0]+=i[g+2]*L,i[g+1]+=i[g+3]*L);return{}}var v=function(e,t,n,i){for(var r=t.length/3,o=0,a=0,s=n<r,h=0;h<Math.min(n,r);h++){var u=s?Math.floor(Math.random()*r):h,c=t[3*u+0],d=t[3*u+1],l=e[c+8],f=e[d+8],p=e[c+0]-e[d+0],g=e[c+1]-e[d+1],v=(l+f)*i/Math.sqrt(Math.pow(p,2)+Math.pow(g,2));v>a&&(a=v),v>1&&o++}return{fracEdgesTooShort:o/Math.min(n,r),maxShortnessRatio:a}},m=function(t){for(var n=0,i=0,r=0,o=0,a=t.length,s=0;s<a;s+=e)t[s+0]<n&&(n=t[s+0]),t[s+0]>i&&(i=t[s+0]),t[s+1]<r&&(r=t[s+1]),t[s+1]>o&&(o=t[s+1]);return{xDim:i-n,yDim:o-r}},y=function(t,n){var i=function(t,n){var i=0,r=0,o=0,a=0;return n.forEach((function(n){var s=n*e;t[s+0]<i&&(i=t[s+0]),t[s+0]>r&&(r=t[s+0]),t[s+1]<o&&(o=t[s+1]),t[s+1]>a&&(a=t[s+1])})),{xDim:r-i,yDim:a-o}}(t,n),r=i.xDim,o=i.yDim;return Math.max(Math.max(r,o)/2,150)},b=function(t){for(var n=0,i=0,r=0,o=0,a=t.length/e,s=0;s<a;s+=e)t[s+0]<n&&(n=t[s+0]),t[s+0]>i&&(i=t[s+0]),t[s+1]<r&&(r=t[s+1]),t[s+1]>o&&(o=t[s+1]);for(var h=(n+i)/2,u=(r+o)/2,c=0;c<t.length;c+=e)t[c+0]-=h,t[c+1]-=u},w=function(t,n,i){n.forEach((function(n){n.forEach((function(n){var r=n;t[r*e+0]=t[r*e+0]*i,t[r*e+1]=t[r*e+1]*i}))}))},x=function(e,t,r,o,a){var s=m(e),h=s.xDim,u=s.yDim,c=Math.max(r/h,o/u);w(e,t,c),a.scalingRatio=Math.max(Math.min(a.scalingRatio*Math.pow(c,2),n),i)};self.onmessage=function(r){var o,a,s=r.data,h=new Float32Array(s.nodes),u=new Float32Array(s.edges),c=s.components;"layoutStep"==s.__messageId?g(s.settings,h,u,c):(console.time("layout"),function(r,o,a,s,h,u){var c=s.expectedDims?s.expectedDims:[650,400],d=c[0],l=c[1];if(s.maxForce=s.maxForce||t,s.warmupLayout){var f=s.adjustSizes;s.adjustSizes=!1;for(var p=0;p<h/5;p++)g(s,r,o,a);x(r,a,d,l,s);for(var y=0;y<r.length;y+=e)r[y+2]=0,r[y+3]=0;s.adjustSizes=f,s.warmupLayout=!1}for(var C=u,_=0;_<C-1;_++){for(p=0;p<h/C;p++)g(s,r,o,a);if(b(r),s.adjustSizes){var E=v(r,o,2e3,1.2),k=E.fracEdgesTooShort,S=E.maxShortnessRatio;if(k>.002){var L=Math.min(S,5),N=Math.pow(L,2);s.scalingRatio=Math.max(Math.min(s.scalingRatio*N,n),i),console.log("scalingRatio",s.scalingRatio),w(r,a,L)}else{var A=m(r),T=A.xDim,M=A.yDim,D=Math.min(d/T,l/M),R=Math.max(D,Math.min(S,1));s.scalingRatio=Math.max(Math.min(s.scalingRatio*Math.pow(R,2),n),i),console.log("scalingRatio",s.scalingRatio),w(r,a,R)}}else x(r,a,d,l,s),console.log("scalingRatio",s.scalingRatio);for(y=0;y<r.length;y+=e)r[y+2]=0,r[y+3]=0}for(p=0;p<h/C;p++)g(s,r,o,a);b(r)}(h,u,c,s.settings,s.iterations,null!==(o=s.nAnnealingSteps)&&void 0!==o?o:5),console.timeEnd("layout")),self.postMessage({nodes:h.buffer,edges:u.buffer,settings:s.settings,__messageId:s.__messageId,__seqId:null!==(a=s.__seqId)&&void 0!==a?a:null},[h.buffer,u.buffer])}}var ht={value:()=>{}};function ut(){for(var e,t=0,n=arguments.length,i={};t<n;++t){if(!(e=arguments[t]+"")||e in i||/[\s.]/.test(e))throw new Error("illegal type: "+e);i[e]=[]}return new ct(i)}function ct(e){this._=e}function dt(e,t){for(var n,i=0,r=e.length;i<r;++i)if((n=e[i]).name===t)return n.value}function lt(e,t,n){for(var i=0,r=e.length;i<r;++i)if(e[i].name===t){e[i]=ht,e=e.slice(0,i).concat(e.slice(i+1));break}return null!=n&&e.push({name:t,value:n}),e}ct.prototype=ut.prototype={constructor:ct,on:function(e,t){var n,i,r=this._,o=(i=r,(e+"").trim().split(/^|\s+/).map((function(e){var t="",n=e.indexOf(".");if(n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!i.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}}))),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++a<s;)if(n=(e=o[a]).type)r[n]=lt(r[n],e.name,t);else if(null==t)for(n in r)r[n]=lt(r[n],e.name,null);return this}for(;++a<s;)if((n=(e=o[a]).type)&&(n=dt(r[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new ct(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,i,r=new Array(n),o=0;o<n;++o)r[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=0,n=(i=this._[e]).length;o<n;++o)i[o].value.apply(t,r)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],r=0,o=i.length;r<o;++r)i[r].value.apply(t,n)}};const ft=ut;var pt,gt,vt=0,mt=0,yt=0,bt=0,wt=0,xt=0,Ct="object"==typeof performance&&performance.now?performance:Date,_t="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Et(){return wt||(_t(kt),wt=Ct.now()+xt)}function kt(){wt=0}function St(){this._call=this._time=this._next=null}function Lt(e,t,n){var i=new St;return i.restart(e,t,n),i}function Nt(){wt=(bt=Ct.now())+xt,vt=mt=0;try{!function(){Et(),++vt;for(var e,t=pt;t;)(e=wt-t._time)>=0&&t._call.call(void 0,e),t=t._next;--vt}()}finally{vt=0,function(){for(var e,t,n=pt,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:pt=t);gt=e,Tt(i)}(),wt=0}}function At(){var e=Ct.now(),t=e-bt;t>1e3&&(xt-=t,bt=e)}function Tt(e){vt||(mt&&(mt=clearTimeout(mt)),e-wt>24?(e<1/0&&(mt=setTimeout(Nt,e-Ct.now()-xt)),yt&&(yt=clearInterval(yt))):(yt||(bt=Ct.now(),yt=setInterval(At,1e3)),vt=1,_t(Nt)))}St.prototype=Lt.prototype={constructor:St,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?Et():+n)+(null==t?0:+t),this._next||gt===this||(gt?gt._next=this:pt=this,gt=this),this._call=e,this._time=n,Tt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Tt())}};const Mt=4294967296;function Dt(e){return e.x}function Rt(e){return e.y}var Gt=Math.PI*(3-Math.sqrt(5));function Pt(e){var t,n=1,i=.001,r=1-Math.pow(i,1/300),o=0,a=.6,s=new Map,h=Lt(d),u=ft("tick","end"),c=function(){let e=1;return()=>(e=(1664525*e+1013904223)%Mt)/Mt}();function d(){l(),u.call("tick",t),n<i&&(h.stop(),u.call("end",t))}function l(i){var h,u,c=e.length;void 0===i&&(i=1);for(var d=0;d<i;++d)for(n+=(o-n)*r,s.forEach((function(e){e(n)})),h=0;h<c;++h)null==(u=e[h]).fx?u.x+=u.vx*=a:(u.x=u.fx,u.vx=0),null==u.fy?u.y+=u.vy*=a:(u.y=u.fy,u.vy=0);return t}function f(){for(var t,n=0,i=e.length;n<i;++n){if((t=e[n]).index=n,null!=t.fx&&(t.x=t.fx),null!=t.fy&&(t.y=t.fy),isNaN(t.x)||isNaN(t.y)){var r=10*Math.sqrt(.5+n),o=n*Gt;t.x=r*Math.cos(o),t.y=r*Math.sin(o)}(isNaN(t.vx)||isNaN(t.vy))&&(t.vx=t.vy=0)}}function p(t){return t.initialize&&t.initialize(e,c),t}return null==e&&(e=[]),f(),t={tick:l,restart:function(){return h.restart(d),t},stop:function(){return h.stop(),t},nodes:function(n){return arguments.length?(e=n,f(),s.forEach(p),t):e},alpha:function(e){return arguments.length?(n=+e,t):n},alphaMin:function(e){return arguments.length?(i=+e,t):i},alphaDecay:function(e){return arguments.length?(r=+e,t):+r},alphaTarget:function(e){return arguments.length?(o=+e,t):o},velocityDecay:function(e){return arguments.length?(a=1-e,t):1-a},randomSource:function(e){return arguments.length?(c=e,s.forEach(p),t):c},force:function(e,n){return arguments.length>1?(null==n?s.delete(e):s.set(e,p(n)),t):s.get(e)},find:function(t,n,i){var r,o,a,s,h,u=0,c=e.length;for(null==i?i=1/0:i*=i,u=0;u<c;++u)(a=(r=t-(s=e[u]).x)*r+(o=n-s.y)*o)<i&&(h=s,i=a);return h},on:function(e,n){return arguments.length>1?(u.on(e,n),t):u.on(e)}}}function Ft(e,t,n,i){if(isNaN(t)||isNaN(n))return e;var r,o,a,s,h,u,c,d,l,f=e._root,p={data:i},g=e._x0,v=e._y0,m=e._x1,y=e._y1;if(!f)return e._root=p,e;for(;f.length;)if((u=t>=(o=(g+m)/2))?g=o:m=o,(c=n>=(a=(v+y)/2))?v=a:y=a,r=f,!(f=f[d=c<<1|u]))return r[d]=p,e;if(s=+e._x.call(null,f.data),h=+e._y.call(null,f.data),t===s&&n===h)return p.next=f,r?r[d]=p:e._root=p,e;do{r=r?r[d]=new Array(4):e._root=new Array(4),(u=t>=(o=(g+m)/2))?g=o:m=o,(c=n>=(a=(v+y)/2))?v=a:y=a}while((d=c<<1|u)==(l=(h>=a)<<1|s>=o));return r[l]=f,r[d]=p,e}function zt(e,t,n,i,r){this.node=e,this.x0=t,this.y0=n,this.x1=i,this.y1=r}function Ot(e){return e[0]}function It(e){return e[1]}function Bt(e,t,n){var i=new Ut(null==t?Ot:t,null==n?It:n,NaN,NaN,NaN,NaN);return null==e?i:i.addAll(e)}function Ut(e,t,n,i,r,o){this._x=e,this._y=t,this._x0=n,this._y0=i,this._x1=r,this._y1=o,this._root=void 0}function jt(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var Vt=Bt.prototype=Ut.prototype;function Ht(e){return function(){return e}}function Wt(e){return 1e-6*(e()-.5)}function qt(){var e,t,n,i,r,o=Ht(-30),a=1,s=1/0,h=.81;function u(n){var r,o=e.length,a=Bt(e,Dt,Rt).visitAfter(d);for(i=n,r=0;r<o;++r)t=e[r],a.visit(l)}function c(){if(e){var t,n,i=e.length;for(r=new Array(i),t=0;t<i;++t)n=e[t],r[n.index]=+o(n,t,e)}}function d(e){var t,n,i,o,a,s=0,h=0;if(e.length){for(i=o=a=0;a<4;++a)(t=e[a])&&(n=Math.abs(t.value))&&(s+=t.value,h+=n,i+=n*t.x,o+=n*t.y);e.x=i/h,e.y=o/h}else{(t=e).x=t.data.x,t.y=t.data.y;do{s+=r[t.data.index]}while(t=t.next)}e.value=s}function l(e,o,u,c){if(!e.value)return!0;var d=e.x-t.x,l=e.y-t.y,f=c-o,p=d*d+l*l;if(f*f/h<p)return p<s&&(0===d&&(p+=(d=Wt(n))*d),0===l&&(p+=(l=Wt(n))*l),p<a&&(p=Math.sqrt(a*p)),t.vx+=d*e.value*i/p,t.vy+=l*e.value*i/p),!0;if(!(e.length||p>=s)){(e.data!==t||e.next)&&(0===d&&(p+=(d=Wt(n))*d),0===l&&(p+=(l=Wt(n))*l),p<a&&(p=Math.sqrt(a*p)));do{e.data!==t&&(f=r[e.data.index]*i/p,t.vx+=d*f,t.vy+=l*f)}while(e=e.next)}}return u.initialize=function(t,i){e=t,n=i,c()},u.strength=function(e){return arguments.length?(o="function"==typeof e?e:Ht(+e),c(),u):o},u.distanceMin=function(e){return arguments.length?(a=e*e,u):Math.sqrt(a)},u.distanceMax=function(e){return arguments.length?(s=e*e,u):Math.sqrt(s)},u.theta=function(e){return arguments.length?(h=e*e,u):Math.sqrt(h)},u}function Zt(e){var t,n,i,r=Ht(.1);function o(e){for(var r,o=0,a=t.length;o<a;++o)(r=t[o]).vx+=(i[o]-r.x)*n[o]*e}function a(){if(t){var o,a=t.length;for(n=new Array(a),i=new Array(a),o=0;o<a;++o)n[o]=isNaN(i[o]=+e(t[o],o,t))?0:+r(t[o],o,t)}}return"function"!=typeof e&&(e=Ht(null==e?0:+e)),o.initialize=function(e){t=e,a()},o.strength=function(e){return arguments.length?(r="function"==typeof e?e:Ht(+e),a(),o):r},o.x=function(t){return arguments.length?(e="function"==typeof t?t:Ht(+t),a(),o):e},o}function Yt(e){var t,n,i,r=Ht(.1);function o(e){for(var r,o=0,a=t.length;o<a;++o)(r=t[o]).vy+=(i[o]-r.y)*n[o]*e}function a(){if(t){var o,a=t.length;for(n=new Array(a),i=new Array(a),o=0;o<a;++o)n[o]=isNaN(i[o]=+e(t[o],o,t))?0:+r(t[o],o,t)}}return"function"!=typeof e&&(e=Ht(null==e?0:+e)),o.initialize=function(e){t=e,a()},o.strength=function(e){return arguments.length?(r="function"==typeof e?e:Ht(+e),a(),o):r},o.y=function(t){return arguments.length?(e="function"==typeof t?t:Ht(+t),a(),o):e},o}function Xt(e){return e.x+e.vx}function Kt(e){return e.y+e.vy}function Jt(e){var t,n,i,r=1,o=1;function a(){for(var e,a,h,u,c,d,l,f=t.length,p=0;p<o;++p)for(a=Bt(t,Xt,Kt).visitAfter(s),e=0;e<f;++e)h=t[e],d=n[h.index],l=d*d,u=h.x+h.vx,c=h.y+h.vy,a.visit(g);function g(e,t,n,o,a){var s=e.data,f=e.r,p=d+f;if(!s)return t>u+p||o<u-p||n>c+p||a<c-p;if(s.index>h.index){var g=u-s.x-s.vx,v=c-s.y-s.vy,m=g*g+v*v;m<p*p&&(0===g&&(m+=(g=Wt(i))*g),0===v&&(m+=(v=Wt(i))*v),m=(p-(m=Math.sqrt(m)))/m*r,h.vx+=(g*=m)*(p=(f*=f)/(l+f)),h.vy+=(v*=m)*p,s.vx-=g*(p=1-p),s.vy-=v*p)}}}function s(e){if(e.data)return e.r=n[e.data.index];for(var t=e.r=0;t<4;++t)e[t]&&e[t].r>e.r&&(e.r=e[t].r)}function h(){if(t){var i,r,o=t.length;for(n=new Array(o),i=0;i<o;++i)r=t[i],n[r.index]=+e(r,i,t)}}return"function"!=typeof e&&(e=Ht(null==e?1:+e)),a.initialize=function(e,n){t=e,i=n,h()},a.iterations=function(e){return arguments.length?(o=+e,a):o},a.strength=function(e){return arguments.length?(r=+e,a):r},a.radius=function(t){return arguments.length?(e="function"==typeof t?t:Ht(+t),h(),a):e},a}function $t(e,t){var n,i=1;function r(){var r,o,a=n.length,s=0,h=0;for(r=0;r<a;++r)s+=(o=n[r]).x,h+=o.y;for(s=(s/a-e)*i,h=(h/a-t)*i,r=0;r<a;++r)(o=n[r]).x-=s,o.y-=h}return null==e&&(e=0),null==t&&(t=0),r.initialize=function(e){n=e},r.x=function(t){return arguments.length?(e=+t,r):e},r.y=function(e){return arguments.length?(t=+e,r):t},r.strength=function(e){return arguments.length?(i=+e,r):i},r}function Qt(e,t,n){return(t[0]-e[0])*(n[1]-e[1])-(t[1]-e[1])*(n[0]-e[0])}function en(e,t){return e[0]-t[0]||e[1]-t[1]}function tn(e){const t=e.length,n=[0,1];let i,r=2;for(i=2;i<t;++i){for(;r>1&&Qt(e[n[r-2]],e[n[r-1]],e[i])<=0;)--r;n[r++]=i}return n.slice(0,r)}Vt.copy=function(){var e,t,n=new Ut(this._x,this._y,this._x0,this._y0,this._x1,this._y1),i=this._root;if(!i)return n;if(!i.length)return n._root=jt(i),n;for(e=[{source:i,target:n._root=new Array(4)}];i=e.pop();)for(var r=0;r<4;++r)(t=i.source[r])&&(t.length?e.push({source:t,target:i.target[r]=new Array(4)}):i.target[r]=jt(t));return n},Vt.add=function(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return Ft(this.cover(t,n),t,n,e)},Vt.addAll=function(e){var t,n,i,r,o=e.length,a=new Array(o),s=new Array(o),h=1/0,u=1/0,c=-1/0,d=-1/0;for(n=0;n<o;++n)isNaN(i=+this._x.call(null,t=e[n]))||isNaN(r=+this._y.call(null,t))||(a[n]=i,s[n]=r,i<h&&(h=i),i>c&&(c=i),r<u&&(u=r),r>d&&(d=r));if(h>c||u>d)return this;for(this.cover(h,u).cover(c,d),n=0;n<o;++n)Ft(this,a[n],s[n],e[n]);return this},Vt.cover=function(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,i=this._y0,r=this._x1,o=this._y1;if(isNaN(n))r=(n=Math.floor(e))+1,o=(i=Math.floor(t))+1;else{for(var a,s,h=r-n||1,u=this._root;n>e||e>=r||i>t||t>=o;)switch(s=(t<i)<<1|e<n,(a=new Array(4))[s]=u,u=a,h*=2,s){case 0:r=n+h,o=i+h;break;case 1:n=r-h,o=i+h;break;case 2:r=n+h,i=o-h;break;case 3:n=r-h,i=o-h}this._root&&this._root.length&&(this._root=u)}return this._x0=n,this._y0=i,this._x1=r,this._y1=o,this},Vt.data=function(){var e=[];return this.visit((function(t){if(!t.length)do{e.push(t.data)}while(t=t.next)})),e},Vt.extent=function(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},Vt.find=function(e,t,n){var i,r,o,a,s,h,u,c=this._x0,d=this._y0,l=this._x1,f=this._y1,p=[],g=this._root;for(g&&p.push(new zt(g,c,d,l,f)),null==n?n=1/0:(c=e-n,d=t-n,l=e+n,f=t+n,n*=n);h=p.pop();)if(!(!(g=h.node)||(r=h.x0)>l||(o=h.y0)>f||(a=h.x1)<c||(s=h.y1)<d))if(g.length){var v=(r+a)/2,m=(o+s)/2;p.push(new zt(g[3],v,m,a,s),new zt(g[2],r,m,v,s),new zt(g[1],v,o,a,m),new zt(g[0],r,o,v,m)),(u=(t>=m)<<1|e>=v)&&(h=p[p.length-1],p[p.length-1]=p[p.length-1-u],p[p.length-1-u]=h)}else{var y=e-+this._x.call(null,g.data),b=t-+this._y.call(null,g.data),w=y*y+b*b;if(w<n){var x=Math.sqrt(n=w);c=e-x,d=t-x,l=e+x,f=t+x,i=g.data}}return i},Vt.remove=function(e){if(isNaN(o=+this._x.call(null,e))||isNaN(a=+this._y.call(null,e)))return this;var t,n,i,r,o,a,s,h,u,c,d,l,f=this._root,p=this._x0,g=this._y0,v=this._x1,m=this._y1;if(!f)return this;if(f.length)for(;;){if((u=o>=(s=(p+v)/2))?p=s:v=s,(c=a>=(h=(g+m)/2))?g=h:m=h,t=f,!(f=f[d=c<<1|u]))return this;if(!f.length)break;(t[d+1&3]||t[d+2&3]||t[d+3&3])&&(n=t,l=d)}for(;f.data!==e;)if(i=f,!(f=f.next))return this;return(r=f.next)&&delete f.next,i?(r?i.next=r:delete i.next,this):t?(r?t[d]=r:delete t[d],(f=t[0]||t[1]||t[2]||t[3])&&f===(t[3]||t[2]||t[1]||t[0])&&!f.length&&(n?n[l]=f:this._root=f),this):(this._root=r,this)},Vt.removeAll=function(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this},Vt.root=function(){return this._root},Vt.size=function(){var e=0;return this.visit((function(t){if(!t.length)do{++e}while(t=t.next)})),e},Vt.visit=function(e){var t,n,i,r,o,a,s=[],h=this._root;for(h&&s.push(new zt(h,this._x0,this._y0,this._x1,this._y1));t=s.pop();)if(!e(h=t.node,i=t.x0,r=t.y0,o=t.x1,a=t.y1)&&h.length){var u=(i+o)/2,c=(r+a)/2;(n=h[3])&&s.push(new zt(n,u,c,o,a)),(n=h[2])&&s.push(new zt(n,i,c,u,a)),(n=h[1])&&s.push(new zt(n,u,r,o,c)),(n=h[0])&&s.push(new zt(n,i,r,u,c))}return this},Vt.visitAfter=function(e){var t,n=[],i=[];for(this._root&&n.push(new zt(this._root,this._x0,this._y0,this._x1,this._y1));t=n.pop();){var r=t.node;if(r.length){var o,a=t.x0,s=t.y0,h=t.x1,u=t.y1,c=(a+h)/2,d=(s+u)/2;(o=r[0])&&n.push(new zt(o,a,s,c,d)),(o=r[1])&&n.push(new zt(o,c,s,h,d)),(o=r[2])&&n.push(new zt(o,a,d,c,u)),(o=r[3])&&n.push(new zt(o,c,d,h,u))}i.push(t)}for(;t=i.pop();)e(t.node,t.x0,t.y0,t.x1,t.y1);return this},Vt.x=function(e){return arguments.length?(this._x=e,this):this._x},Vt.y=function(e){return arguments.length?(this._y=e,this):this._y};var nn,rn=10,on=function(e){for(var t=Number.MAX_VALUE,n=-Number.MAX_VALUE,i=Number.MAX_VALUE,r=-Number.MAX_VALUE,o=0;o<e.length;o+=rn)e[o+0]<t&&(t=e[o+0]),e[o+0]>n&&(n=e[o+0]),e[o+1]<i&&(i=e[o+1]),e[o+1]>r&&(r=e[o+1]);var a=(t+n)/2,s=(i+r)/2;for(o=0;o<e.length;o+=rn)e[o+0]-=a,e[o+1]-=s},an=function(e,t,n,i,r){void 0===i&&(i=[650,410]),void 0===r&&(r=!1),console.time("component layout"),on(e);var o=i[0],a=i[1],s=r?t.filter((function(e){return e.length>1})):t,h=r?t.filter((function(e){return e.length<=1})):[],u=h.length,c=s.reduce((function(e,t){return e+t.length}),0),d=Math.max(.04,u/(u+5*c)),l=.9*a,f=d*o;console.time("pack singletons");var p=function(e,t,n,i,r){var o={};e.forEach((function(e,t){e.forEach((function(e){o[e]=t}))}));var a,s=0,h=e.map((function(e,n){if(0==e.length)return 5;var i=t[e[0]*rn+8];return s+=i,i})),u=Math.min(3*s,r),c=Math.min(3*s,i);if(r>i){var d=e.map((function(t,n){var i=Object.create(t);return i.radius=1.5*h[n],i.target=-u/2+n/e.length*u,i}));return(a=Pt(d).force("charge",qt().strength(-1)).force("center",$t(0,0)).force("gravityX",Zt().strength(u/c*.2)).force("yPos",Yt().y((function(e){return e.target})).strength(.5)).force("collision",Jt().radius((function(e){return e.radius})).strength(1).iterations(5))).stop(),a.tick(n),{vertices:e.map((function(e){return e.map((function(e){return e}))})).flat(),node_to_component_id:o,components_to_circle_pack:d}}return d=e.map((function(t,n){var i=Object.create(t);return i.radius=h[n],i.target=-c/2+n/e.length*c,i})),(a=Pt(d).force("charge",qt().strength(-1)).force("center",$t(0,0)).force("gravityY",Yt().strength(.2*c/u)).force("xPos",Zt().x((function(e){return e.target})).strength(.5)).force("collision",Jt().radius((function(e){return e.radius})).strength(1).iterations(5))).stop(),a.tick(n),{vertices:e.map((function(e){return e.map((function(e){return e}))})).flat(),node_to_component_id:o,components_to_circle_pack:d}}(h,e,n,f,l);console.timeEnd("pack singletons");var g=Number.MAX_VALUE,v=-Number.MAX_VALUE,m=Number.MAX_VALUE,y=-Number.MAX_VALUE;p.vertices.forEach((function(t){var n=p.node_to_component_id[t],i=p.components_to_circle_pack[n].x,r=p.components_to_circle_pack[n].y,o=e[t*rn+8];v=Math.max(i+o,v),g=Math.min(i-o,g),y=Math.max(r+o,y),m=Math.min(r-o,m)}));var b=u>0?v-g:0;console.log("singletonWidth",b),console.log("singletonSpaceFrac",d);var w=b;if(u>0&&b/o>d){var x=Math.min(1,d/(b/o));p.vertices.map((function(e){var t=p.node_to_component_id[e];p.components_to_circle_pack[t].x*=x,p.components_to_circle_pack[t].y*=x})),w*=x}console.log("adjustedSingletonWidth",w);var C=o-w,_=C/a,E=s.map((function(t){var n=function(e,t){var n=Number.MAX_VALUE,i=-Number.MAX_VALUE,r=Number.MAX_VALUE,o=-Number.MAX_VALUE;return e.forEach((function(e){var a=e,s=t[a*rn+0],h=t[a*rn+1],u=t[a*rn+8];i=Math.max(s+u,i),n=Math.min(s-u,n),o=Math.max(h+u,o),r=Math.min(h-u,r)})),{minX:n,maxX:i,minY:r,maxY:o}}(t,e),i=n.minX,r=n.maxX,o=n.minY;return(r-i)/(n.maxY-o)}));console.log("remainingAspectRatio",_),s.forEach((function(t,n){var i=E[n];(i>=1.1&&_<=.9||i<=.9&&_>=1.1)&&t.forEach((function(t){var n=t,i=e[n*rn+0],r=e[n*rn+1];e[n*rn+0]=-r,e[n*rn+1]=i}))})),console.time("pack components");var k=function(e,t,n,i,r){var o=e.map((function(e){return e.map((function(e){var n=e*rn;return[t[n+0],t[n+1]]}))})),a=o.map((function(e){return function(e){if((n=e.length)<3)return null;var t,n,i=new Array(n),r=new Array(n);for(t=0;t<n;++t)i[t]=[+e[t][0],+e[t][1],t];for(i.sort(en),t=0;t<n;++t)r[t]=[i[t][0],-i[t][1]];var o=tn(i),a=tn(r),s=a[0]===o[0],h=a[a.length-1]===o[o.length-1],u=[];for(t=o.length-1;t>=0;--t)u.push(e[i[o[t]][2]]);for(t=+s;t<a.length-h;++t)u.push(e[i[a[t]][2]]);return u}(e)})),s=a.map((function(e,t){if(null===e){var n=o[t];return 1===n.length?n[0]:[(n[0][0]+n[1][0])/2,(n[0][1]+n[1][1])/2]}return function(e){for(var t,n,i=-1,r=e.length,o=0,a=0,s=e[r-1],h=0;++i<r;)t=s,s=e[i],h+=n=t[0]*s[1]-s[0]*t[1],o+=(t[0]+s[0])*n,a+=(t[1]+s[1])*n;return[o/(h*=3),a/h]}(e)})),h=a.map((function(n,i){var r=s[i],a=0;if(null===n){var h=o[i];if(1===h.length){var u=e[i][0];a=Math.max(t[u*rn+8]+2,6)}else{var c=h[1][0]-h[0][0],d=h[1][1]-h[0][1],l=e[i][0],f=e[i][1],p=t[l*rn+8],g=t[f*rn+8];a=Math.sqrt(Math.pow(c,2)+Math.pow(d,2))/2+p+g}}else for(var v=0;v<n.length;v+=1){var m=n[v],y=(c=m[0]-r[0],d=m[1]-r[1],u=e[i][v],t[u*rn+8]),b=Math.sqrt(Math.pow(c,2)+Math.pow(d,2))+y;a=Math.max(b,a)}return Math.round(a)})),u=h.map((function(e,t){return[e,t]})).sort((function(e,t){return e[0]-t[0]})),c=function(e){return Math.max(3*e*Math.exp(e*Math.log(1/3)/500),.9*e,e-300)},d=0;u.map((function(t){var n=t[0],i=t[1],r=(e[i].length,c(n)),o=4*Math.pow(r,2);d+=o})),console.log("graphArea",d);var l=Math.sqrt(d/(i*r)),f=i*l,p=r*l;console.log("xExtent",f),console.log("yExtent",p);var g=0,v=u.map((function(t){var n=t[0],i=t[1],r=e[i],o=Object.create(r);o.componentID=i;var a=c(n),s=4*Math.pow(a,2);return g+=s/2,o.radius=a,o.target=f*g/d,o.x=o.target,o.y=(p/2-a)*(2/Math.PI)*Math.asin(Math.sin(2*Math.PI*(d/s)*o.x)),g+=.5*s,o})),m=Pt(v).force("charge",qt().strength((function(e){return-.005*d/Math.pow(e.radius,2)}))).force("xPos",Zt().x((function(e){return e.target})).strength(.9)).force("gravityY",Yt().strength(.3)).force("collision",Jt().radius((function(e){return e.radius})).strength(1).iterations(5));m.stop(),m.tick(n);var y=e.map((function(e){return e.map((function(e){return e}))})).flat(),b={};return u.forEach((function(t,n){t[0];var i=t[1];e[i].forEach((function(e){b[e]=n}))})),{vertices:y,node_to_component_id:b,components_to_circle_pack:v,polygon_centroids_initial:s}}(s,e,n,C,a);console.timeEnd("pack components");var S=Number.MAX_VALUE,L=-Number.MAX_VALUE,N=Number.MAX_VALUE,A=-Number.MAX_VALUE;if(k.components_to_circle_pack.forEach((function(t,n){var i=t.componentID;t.forEach((function(n){var r=k.polygon_centroids_initial[i],o=t.x+e[n*rn+0]-r[0],a=t.y+e[n*rn+1]-r[1];e[n*rn+0]=o,e[n*rn+1]=a;var s=e[n*rn+8];L=Math.max(L,o+s),S=Math.min(S,o-s),A=Math.max(A,a+s),N=Math.min(N,a-s)}))})),0===c)p.vertices.forEach((function(t){var n=p.node_to_component_id[t],i=p.components_to_circle_pack[n].x,r=p.components_to_circle_pack[n].y,o=f/(v-g),a=l/(y-m);e[t*rn+0]=i*o,e[t*rn+1]=r*a}));else{var T=(A+N)/2,M=(L-S)/C,D=M*f/(v-g),R=M*l/(y-m);console.log("singleton scale factors",D,R),v=-1/0,g=1/0,p.vertices.forEach((function(t){var n=p.node_to_component_id[t],i=p.components_to_circle_pack[n].x,r=p.components_to_circle_pack[n].y,o=S-i*D;e[t*rn+0]=o;var a=T+r*R;e[t*rn+1]=a;var s=e[t*rn+8];v=Math.max(o+s,v),g=Math.min(o-s,g)}));var G=v-S+.1*(v-g);p.vertices.forEach((function(t){e[t*rn+0]-=G}))}on(e),console.timeEnd("component layout")},sn=function(){return sn=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},sn.apply(this,arguments)},hn=n(739),un=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0);var i=new Float32Array(e.order*rn),r=new Float32Array(3*e.size),o={},a=0;return e.forEachNode((function(e,t){o[e]=a,i[a+0]=t.x,i[a+1]=t.y,i[a+2]=0,i[a+3]=0,i[a+4]=0,i[a+5]=0,i[a+6]=1,i[a+7]=1,i[a+8]=t.size,i[a+9]=t.fixed?1:0,a+=rn})),a=0,e.forEachEdge((function(e,s,h,u,c,d,l){var f=o[h],p=o[u],g=t&&s.weight||1;n&&(i[f+6]+=g,i[p+6]+=g),r[a+0]=f,r[a+1]=p,r[a+2]=g,a+=3})),{nodes:i,edges:r}},cn=function(e,t){var n=0;e.updateEachNodeAttributes((function(e,i){var r=i.fixed?i:sn(sn({},i),{x:t[n+0],y:t[n+1]});return n+=rn,r}))},dn=function(){function e(e,t,n){var i=this;this.graph=e,this.graphComponents=(0,at.kS)(e).map((function(e){return e.map(Number)})),this.params=t,this.frameID=null,this.nextWorkerSeqId=null,this.workerTimerId=null,this.running=!1,this.graphArrays=un(e),this.graphArrays&&this.updateNodePropsArrays(this.graphArrays),this.worker=hn.createWorker(st),this.worker.onmessage=function(e){return i.onWorkerMessage(e)},this.worker.onerror=function(e){return i.onWorkerError(e)},this.shouldUpdateLayoutArrays=!1,this.workerRunning=!1,this.positionsUpdated=!1,this.niters=0,this.maxiters=n.maxiters,this.miniters=n.miniters,this.convergenceThreshold=n.convergenceThreshold}return e.prototype.isRunning=function(){return this.running},e.prototype.resetNIters=function(){this.niters=0},e.prototype.updateNodePropsArrays=function(e){var t=0,n=e;return this.graph.forEachNode((function(e,i){i.fixed&&(n.nodes[t+0]=i.x,n.nodes[t+1]=i.y,n.nodes[t+2]=0,n.nodes[t+3]=0),n.nodes[t+9]=i.fixed?1:0,t+=rn})),n},e.prototype.forceNodePositionUpdate=function(){this.frameID||this.workerRunning?this.shouldUpdateLayoutArrays=!0:this.updateLayoutArrayNodePositions()},e.prototype.updateLayoutArrayNodePositions=function(){var e=this.graphArrays;if(e){var t=0;this.graph.forEachNode((function(n,i){e.nodes[t+0]=i.x,e.nodes[t+1]=i.y,e.nodes[t+2]=0,e.nodes[t+3]=0,e.nodes[t+4]=0,e.nodes[t+5]=0,t+=rn}))}},e.prototype.hasConverged=function(){var e=0;if(!this.graphArrays)return!1;for(e=0;e<this.graphArrays.nodes.length;e+=rn)if(this.graphArrays.nodes[e+7]>this.convergenceThreshold)return!1;return!0},e.prototype.onWorkerMessage=function(e){var t=e.data;this.graphArrays.nodes=new Float32Array(t.nodes),this.graphArrays.edges=new Float32Array(t.edges),this.graphArrays.nodes.length!=this.graph.order*rn&&(console.log("graphArrays not the correct size. rebuilding."),this.graphArrays=un(this.graph)),this.positionsUpdated=!0,this.shouldUpdateLayoutArrays&&(this.updateLayoutArrayNodePositions(),this.shouldUpdateLayoutArrays=!1),this.workerRunning=!1,this.workerTimerId&&(window.clearTimeout(this.workerTimerId),this.workerTimerId=null)},e.prototype.onWorkerError=function(e){var t=this;console.log(e),this.worker.terminate(),this.worker=hn.createWorker(st),this.worker.onmessage=function(e){return t.onWorkerMessage(e)},this.worker.onerror=function(e){return t.onWorkerError(e)},this.shouldUpdateLayoutArrays=!1,this.workerRunning=!1,this.positionsUpdated=!1,this.workerTimerId=null},e.prototype.runFrame=function(){var e=this;if(this.positionsUpdated&&!this.shouldUpdateLayoutArrays){cn(this.graph,this.graphArrays.nodes);var t=0;this.graph.updateEachNodeAttributes((function(n,i){var r=sn(sn({},i),{trueX:Math.round(100*e.graphArrays.nodes[t*rn+0])/100,trueY:Math.round(100*e.graphArrays.nodes[t*rn+1])/100});return t++,r})),this.positionsUpdated=!1,this.niters+=1,this.niters>this.maxiters?(console.log("stopping animation"),this.stop()):this.niters>this.miniters&&this.hasConverged()&&this.stop()}if(this.shouldUpdateLayoutArrays&&(this.updateLayoutArrayNodePositions(),this.shouldUpdateLayoutArrays=!1),!this.workerRunning&&this.running&&this.graphArrays.nodes.buffer.byteLength>0){this.updateNodePropsArrays(this.graphArrays);var n={iterations:1,settings:this.params.settings,nodes:this.graphArrays.nodes.buffer,edges:this.graphArrays.edges.buffer,components:this.graphComponents,__messageId:"layoutStep",__seqId:this.frameID};this.nextWorkerSeqId=n.__seqId,this.worker.postMessage(n,[this.graphArrays.nodes.buffer,this.graphArrays.edges.buffer]),this.workerRunning=!0,this.workerTimerId=window.setTimeout((function(){return e.onWorkerError("Worker timed out")}),500)}this.running&&(this.frameID=window.requestAnimationFrame((function(){return e.runFrame()})))},e.prototype.stop=function(){return this.running=!1,this.resetNIters(),null!==this.frameID&&(window.cancelAnimationFrame(this.frameID),this.frameID=null),this},e.prototype.start=function(){this.running||(this.running=!0,this.runFrame())},e.prototype.kill=function(){this.stop(),this.worker.terminate()},e}(),ln=n(847),fn=n(739),pn=function(e,t,n){return void 0===n&&(n=!0),r=function(){var i,r,o,a,s,h,u,c;return function(e,t){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(h){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,h])}}}(this,(function(d){switch(d.label){case 0:if(!me()(e))throw new Error("graphology-layout-forceatlas2: the given graph is not a valid graphology instance.");if(i=t.iterations,r=(0,at.kS)(e).map((function(e){return e.map(Number)})),"number"!=typeof i)throw new Error("graphology-layout-forceatlas2: invalid number of iterations.");if(i<=0)throw new Error("graphology-layout-forceatlas2: you should provide a positive number of iterations.");if(o=fn.assign({},ln,t.settings),a=fn.validateSettings(o))throw new Error("graphology-layout-forceatlas2: ".concat(a.message));return s=un(e),u=fn.createWorker(st),c={iterations:i,settings:o,nodes:s.nodes.buffer,edges:s.edges.buffer,components:r,__messageId:"initialGraphLayout"},u.postMessage(c,[s.nodes.buffer,s.edges.buffer]),[4,new Promise((function(e){u.onmessage=function(t){e({nodes:new Float32Array(t.data.nodes),settings:t.data.settings}),u.terminate()}}))];case 1:return h=d.sent(),n&&an(h.nodes,r,100,o.expectedDims,o.layoutSingletonsSeparately),cn(e,h.nodes),[2,h.settings]}}))},new((i=void 0)||(i=Promise))((function(e,t){function n(e){try{a(r.next(e))}catch(e){t(e)}}function o(e){try{a(r.throw(e))}catch(e){t(e)}}function a(t){var r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r)}))).then(n,o)}a((r=r.apply(void 0,[])).next())}));var i,r},gn="\n <svg\n width='32'\n height='32'\n viewBox='0 0 32 32'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n >\n <rect width='24' height='24' fill='none' transform='translate(4 4)' />\n <path\n d='M14.9999 15.9987C15.2448 15.9987 15.4812 16.0887 15.6643 16.2514C15.8473 16.4142 15.9642 16.6384 15.9929 16.8817L15.9999 16.9987V21.9987C15.9996 22.2536 15.902 22.4987 15.727 22.6841C15.5521 22.8694 15.3129 22.9809 15.0585 22.9959C14.804 23.0108 14.5535 22.928 14.3581 22.7644C14.1626 22.6008 14.037 22.3688 14.0069 22.1157L13.9999 21.9987V19.4127L8.70688 24.7057C8.52693 24.885 8.28545 24.9892 8.0315 24.9969C7.77755 25.0047 7.53017 24.9155 7.33961 24.7474C7.14904 24.5794 7.02958 24.3451 7.00549 24.0922C6.98139 23.8393 7.05447 23.5867 7.20988 23.3857L7.29288 23.2917L12.5859 17.9987H9.99988C9.745 17.9984 9.49985 17.9008 9.31452 17.7258C9.12918 17.5509 9.01765 17.3117 9.00271 17.0573C8.98778 16.8029 9.07056 16.5523 9.23415 16.3569C9.39774 16.1614 9.62979 16.0358 9.88288 16.0057L9.99988 15.9987H14.9999ZM23.2929 7.29169C23.4728 7.11235 23.7143 7.00822 23.9683 7.00047C24.2222 6.99271 24.4696 7.08191 24.6602 7.24994C24.8507 7.41798 24.9702 7.65225 24.9943 7.90517C25.0184 8.15809 24.9453 8.4107 24.7899 8.61169L24.7069 8.70569L19.4139 13.9987H21.9999C22.2548 13.999 22.4999 14.0966 22.6853 14.2715C22.8706 14.4465 22.9821 14.6856 22.9971 14.9401C23.012 15.1945 22.9292 15.4451 22.7656 15.6405C22.602 15.836 22.37 15.9616 22.1169 15.9917L21.9999 15.9987H16.9999C16.755 15.9987 16.5185 15.9087 16.3355 15.746C16.1525 15.5832 16.0355 15.3589 16.0069 15.1157L15.9999 14.9987V9.99869C16.0002 9.74381 16.0978 9.49866 16.2727 9.31333C16.4477 9.12799 16.6868 9.01646 16.9413 9.00152C17.1957 8.98659 17.4463 9.06937 17.6417 9.23296C17.8372 9.39655 17.9628 9.6286 17.9929 9.88169L17.9999 9.99869V12.5847L23.2929 7.29169Z'\n fill='black'\n />\n </svg>\n",vn="\n<svg\n width='32'\n height='32'\n viewBox='0 0 32 32'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n >\n <rect width='24' height='24' fill='none' transform='translate(4 4)' />\n <path\n d='M13.793 16.793C13.973 16.6137 14.2144 16.5095 14.4684 16.5018C14.7223 16.494 14.9697 16.5832 15.1603 16.7512C15.3508 16.9193 15.4703 17.1536 15.4944 17.4065C15.5185 17.6594 15.4454 17.912 15.29 18.113L15.207 18.207L10.414 23H13C13.2549 23.0003 13.5 23.0979 13.6854 23.2728C13.8707 23.4478 13.9822 23.687 13.9972 23.9414C14.0121 24.1958 13.9293 24.4464 13.7657 24.6418C13.6021 24.8373 13.3701 24.9629 13.117 24.993L13 25H8C7.75507 25 7.51866 24.91 7.33563 24.7473C7.15259 24.5845 7.03566 24.3603 7.007 24.117L7 24V19C7.00028 18.7451 7.09788 18.5 7.27285 18.3146C7.44782 18.1293 7.68695 18.0178 7.94139 18.0028C8.19584 17.9879 8.44638 18.0707 8.64183 18.2343C8.83729 18.3979 8.9629 18.6299 8.993 18.883L9 19V21.586L13.793 16.793ZM24 7C24.2449 7.00003 24.4813 7.08996 24.6644 7.25272C24.8474 7.41547 24.9643 7.63975 24.993 7.883L25 8V13C24.9997 13.2549 24.9021 13.5 24.7272 13.6854C24.5522 13.8707 24.313 13.9822 24.0586 13.9972C23.8042 14.0121 23.5536 13.9293 23.3582 13.7657C23.1627 13.6021 23.0371 13.3701 23.007 13.117L23 13V10.414L18.207 15.207C18.027 15.3863 17.7856 15.4905 17.5316 15.4982C17.2777 15.506 17.0303 15.4168 16.8397 15.2488C16.6492 15.0807 16.5297 14.8464 16.5056 14.5935C16.4815 14.3406 16.5546 14.088 16.71 13.887L16.793 13.793L21.586 9H19C18.7451 8.99972 18.5 8.90212 18.3146 8.72715C18.1293 8.55218 18.0178 8.31305 18.0028 8.05861C17.9879 7.80416 18.0707 7.55362 18.2343 7.35817C18.3979 7.16271 18.6299 7.0371 18.883 7.007L19 7H24Z'\n fill='black'\n />\n</svg>\n",mn='\n<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M12 8L24 16L12 24V8Z" fill="#122239" stroke="#122239" stroke-linejoin="round" stroke-width="2" stroke-linecap="round" />\n</svg>\n',yn='\n<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n <rect x="10" y="8" width="4" height="16" fill="#122239" stroke="#122239" stroke-width="2"/>\n <rect x="18" y="8" width="4" height="16" fill="#122239" stroke="#122239" stroke-width="2"/>\n</svg>\n',bn=[650,400],wn=function(e){return{linLogMode:!1,adjustSizes:!1,scalingRatio:e.size/e.order,slowDown:1+Math.log(e.order),barnesHutTheta:.7,barnesHutThreshold:1e3,nRepulsiveCycles:void 0,expectedDims:bn,layoutSingletonsSeparately:!1,decayRepulsion:!1}},xn=function(){return xn=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},xn.apply(this,arguments)},Cn=function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{h(i.next(e))}catch(e){o(e)}}function s(e){try{h(i.throw(e))}catch(e){o(e)}}function h(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}h((i=i.apply(e,t||[])).next())}))},_n=function(e,t){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(h){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,h])}}},En=function(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))};!function(e){e[e.inactive=0]="inactive",e[e.lasso=1]="lasso",e[e.box=2]="box"}(nn||(nn={}));var kn,Sn=function(){function e(e){var t,n=this;this.zoomFactor=1.5,this.zoomDuration=200,this.isDragging=!1,this.isDraggedNodeSelected=!1,this.isLassoActiveDueToModifierKey=!1,this.fullScreenButton=null,this.resetButton=null,this.lassoSelectButton=null,this.boxSelectButton=null,this.playPauseButton=null,this.overlay=null,this.previousPosition=null,this.originalSizeKey="originalSize",this.originalBorderKey="originalBorder",this.handleSelectionClear=function(){n.updateSelectedNodes([])},this.handleEnterNode=function(e){var t=n.graph.getNodeAttribute(e.node,"label"),i=n.graph.getNodeAttribute(e.node,"labelToDisplay");n.graph.getNodeAttribute(e.node,"originalLabel")||n.graph.setNodeAttribute(e.node,"originalLabel",t),n.graph.setNodeAttribute(e.node,"label",i),n.graph.setNodeAttribute(e.node,"hovered",!0),n.neighborHighlightingEnabled&&n.graph.forEachNeighbor(e.node,(function(t){var i=n.graph.getNodeAttribute(t,"border");n.graph.setNodeAttribute(t,"border",3),n.graph.setNodeAttribute(t,n.originalBorderKey,i);var r=n.getUndirectedEdge(e.node,t),o=n.graph.getEdgeAttribute(r,"size");n.graph.setEdgeAttribute(r,"size",3),n.graph.setEdgeAttribute(r,n.originalSizeKey,o)}))},this.handleLeaveNode=function(e){var t=n.graph.getNodeAttribute(e.node,"originalLabel");n.graph.setNodeAttribute(e.node,"label",t),n.graph.setNodeAttribute(e.node,"hovered",void 0),n.neighborHighlightingEnabled&&n.graph.forEachNeighbor(e.node,(function(t){var i=n.graph.getNodeAttribute(t,n.originalBorderKey);n.graph.setNodeAttribute(t,"border",i);var r=n.getUndirectedEdge(e.node,t);n.graph.setEdgeAttribute(r,"size",void 0)})),n.removeHoverOverlay()},this.handleDownNode=function(e){n.isDragging=!0,n.draggedNode=e.node;var t=Number(e.node);n.graph.setNodeAttribute(n.draggedNode,"highlighted",!0),n.isDraggedNodeSelected=n.selectedNodes.some((function(e){return e===t})),n.isDraggedNodeSelected?n.selectedNodes.map((function(e){return n.graph.updateNodeAttribute(e,"fixed",(function(){return!0}))})):n.graph.setNodeAttribute(n.draggedNode,"fixed",!0),n.previousPosition=n.sigma.viewportToGraph(e.event),!n.animator.isRunning()&&n._animate&&n.animator.start(),n.animator.resetNIters()},this.handleNodeDoubleClick=function(e){e.preventSigmaDefault();var t=Number(e.node);n.selectedNodes.some((function(e){return e===t}))?n.updateSelectedNodes(n.selectedNodes.filter((function(e){return e!==t}))):n.addSelectedNodes([t])},this.handleMouseMoveBody=function(e){if(n.isDragging&&n.draggedNode&&n.previousPosition){n.animator.resetNIters();var t=n.sigma.viewportToGraph(e),i=t.x-n.previousPosition.x,r=t.y-n.previousPosition.y;n.previousPosition=t,n.isDraggedNodeSelected?n.selectedNodes.map((function(e){return n.graph.updateNodeAttributes(e,(function(e){return xn(xn({},e),{x:e.x+i,y:e.y+r})}))})):n.graph.updateNodeAttributes(n.draggedNode,(function(e){return xn(xn({},e),{x:e.x+i,y:e.y+r})})),e.preventSigmaDefault(),e.original.preventDefault(),e.original.stopPropagation()}},this.handleMouseUp=function(){n.draggedNode&&(n.isDraggedNodeSelected?n.selectedNodes.map((function(e){return n.graph.removeNodeAttribute(e,"fixed")})):(n.graph.removeNodeAttribute(n.draggedNode,"fixed"),n.graph.removeNodeAttribute(n.draggedNode,"highlighted")),n.previousPosition=null),n.animator&&n.animator.forceNodePositionUpdate(),n.isDragging=!1,n.draggedNode=null,n.isDraggedNodeSelected=!1},this.handleMouseDown=function(){n.sigma.getCustomBBox()||n.sigma.setCustomBBox(n.sigma.getBBox())},this.handleDoubleClickStage=function(e){n.handleSelectionClear(),e.preventSigmaDefault()},this.handleWheel=function(e){var t=n.sigma.getCamera(),i=t.getState(),r=Math.max(-1.5,Math.min(1.5,e.delta)),o=t.getBoundedRatio(i.ratio*(1-r/8));e.original.deltaMode!==WheelEvent.DOM_DELTA_PIXEL&&console.warn("WheelEvent.deltaMode is not DOM_DELTA_PIXEL. Zoom behavior may not be as expected.");var a=n.sigma.getViewportZoomedState(e,o);t.setState(a),e.preventSigmaDefault(),e.sigmaDefaultPrevented=!0},this.handleLassoModifierDown=function(e){"Alt"===e.key&&n.mode===nn.inactive&&(n.setSelectMode(nn.lasso),n.isLassoActiveDueToModifierKey=!0)},this.handleLassoModifierUp=function(e){"Alt"===e.key&&n.isLassoActiveDueToModifierKey&&(n.setSelectMode(nn.inactive),n.isLassoActiveDueToModifierKey=!1)},this.graphContainer=((t=document.createElement("div")).className="graph-container",t.style.width="100%",t.style.height="calc(100% - 40px)",t.style.position="relative",t.style.top="40px",t),this.sigmaContainer=function(e){var t=document.createElement("div");return t.className="sigma-container",t.style.width="100%",t.style.height="100%",e.appendChild(t),t}(this.graphContainer),this.sigmaSettings=xn({defaultDrawNodeLabel:rt,defaultDrawNodeHover:ot},e.settings),this.sigma=new tt(e.graph,this.sigmaContainer,this.sigmaSettings),this.graph=e.graph,this.animator=e.animator,this._animate=!0,this.mode=e.mode,this._isFullScreen=e.isFullScreen,this.highlightedNodeColor=e.highlightedNodeColor||"#FF00FFDD",this.neighborHighlightingEnabled=e.neighborHighlightingEnabled,this.allowNodeMovement=void 0===e.allowNodeMovement||e.allowNodeMovement,this._selectedNodes=e.selectedNodes,this._highlightedNodes=e.highlightedNodes||[],this.fullScreenButton=null,this.lassoSelectButton=null,this.boxSelectButton=null,this.selectionCanvas=null,this.isDrawing=!1,this.lassoDrawnPoints=[],this.boxInitialPoint=null,this.onSelectedNodesChange=e.onSelectedNodesChange,this.onHighlightedNodesChange=e.onHighlightedNodesChange,this.onFullScreenChange=e.onFullScreenChange,this.initializeGraphManager(),this.bindEventHandlers(),this.initializeOverlay(),document.addEventListener("keydown",this.handleLassoModifierDown),document.addEventListener("keyup",this.handleLassoModifierUp)}return e.prototype.bindEventHandlers=function(){this.handleEnterNode=this.handleEnterNode.bind(this),this.handleLeaveNode=this.handleLeaveNode.bind(this),this.handleDownNode=this.handleDownNode.bind(this),this.handleNodeDoubleClick=this.handleNodeDoubleClick.bind(this),this.handleDoubleClickStage=this.handleDoubleClickStage.bind(this),this.handleMouseMoveBody=this.handleMouseMoveBody.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleWheel=this.handleWheel.bind(this),this.handleSelectionClear=this.handleSelectionClear.bind(this),this.onDrawingStart=this.onDrawingStart.bind(this),this.onDrawing=this.onDrawing.bind(this),this.onDrawingEnd=this.onDrawingEnd.bind(this),this.onSelectScroll=this.onSelectScroll.bind(this),this.handleLassoModifierDown=this.handleLassoModifierDown.bind(this),this.handleLassoModifierUp=this.handleLassoModifierUp.bind(this)},e.prototype.initializeGraphManager=function(){return Cn(this,void 0,void 0,(function(){return _n(this,(function(e){return this.initializeGraph(),this.createControls(),this.registerEvents(),[2]}))}))},e.prototype.initializeGraph=function(){var e,t=this;this.sigma.setGraph(this.graph);var n=null!==(e=this.animator.params.settings.expectedDims)&&void 0!==e?e:this.getGraphViewportBounds(),i=n[0],r=n[1];this.sigma.setCustomBBox({x:[-i/2,i/2],y:[-r/2,r/2]}),this.refresh(),window.requestAnimationFrame((function(){return t.resetView()}))},e.prototype.getGraphViewportBounds=function(){var e=this.sigma.getDimensions();return[e.width,e.height]},e.prototype.updateSelectedNodes=function(e){this.setSelectedNodes(e)},e.prototype.addSelectedNodes=function(e){var t=this;this.setSelectedNodes(En(En([],this.selectedNodes,!0),e.filter((function(e){return!t.selectedNodes.includes(e)})),!0))},e.prototype.getUndirectedEdge=function(e,t){if(this.graph.hasEdge(e,t))return this.graph.edge(e,t);if(this.graph.hasEdge(t,e))return this.graph.edge(t,e);throw new Error("neighbor node = ".concat(t," does not have an edge with ").concat(e))},e.prototype.registerEvents=function(){this.sigma.on("enterNode",this.handleEnterNode),this.sigma.on("leaveNode",this.handleLeaveNode),this.sigma.on("downNode",this.handleDownNode),this.sigma.on("doubleClickNode",this.handleNodeDoubleClick),this.sigma.on("doubleClickStage",this.handleDoubleClickStage),this.sigma.getMouseCaptor().on("wheel",this.handleWheel),this.allowNodeMovement&&(this.sigma.getMouseCaptor().on("mousemovebody",this.handleMouseMoveBody),this.sigma.getMouseCaptor().on("mouseup",this.handleMouseUp),this.sigma.getMouseCaptor().on("mousedown",this.handleMouseDown));var e=this.sigma.getCanvases().nodes;e&&(e.addEventListener("webglcontextlost",this.handleContextLost.bind(this)),e.addEventListener("webglcontextrestored",this.handleContextRestored.bind(this)))},e.prototype.setSelectMode=function(e){this.mode=e,this.lassoSelectButton&&this.lassoSelectButton.classList.toggle("active",e===nn.lasso),this.boxSelectButton&&this.boxSelectButton.classList.toggle("active",e===nn.box),this.mode===nn.inactive?(this.removeSelectionCanvas(),this.lassoSelectButton&&this.lassoSelectButton.classList.remove("active"),this.boxSelectButton&&this.boxSelectButton.classList.remove("active")):this.showSelectionCanvas()},e.prototype.handleContextLost=function(e){e.preventDefault(),console.log("WebGL context lost."),this.overlay&&(this.overlay.style.visibility="visible")},e.prototype.handleContextRestored=function(){this.dispose(),this.sigma=new tt(this.graph,this.sigmaContainer,this.sigma.getSettings()),this.registerEvents(),this.overlay&&(this.overlay.style.visibility="hidden"),console.log("WebGL context restored.")},e.prototype.showSelectionCanvas=function(){var e,t,n,i;this.selectionCanvas||(this.selectionCanvas=(t=(e={offsetWidth:this.sigma.getContainer().offsetWidth,offsetHeight:this.sigma.getContainer().offsetHeight}).offsetWidth,n=e.offsetHeight,(i=document.createElement("canvas")).width=t,i.height=n,i.style.position="absolute",i.style.top="0px",i.style.cursor="crosshair",i),this.selectionCanvas.addEventListener("mousedown",this.onDrawingStart.bind(this)),this.selectionCanvas.addEventListener("mousemove",this.onDrawing.bind(this)),this.selectionCanvas.addEventListener("mouseup",this.onDrawingEnd.bind(this)),this.selectionCanvas.addEventListener("wheel",this.onSelectScroll.bind(this)),this.graphContainer.appendChild(this.selectionCanvas))},e.prototype.removeSelectionCanvas=function(){this.selectionCanvas&&(this.graphContainer.removeChild(this.selectionCanvas),this.selectionCanvas=null)},e.prototype.setDrawingStyles=function(e){e.strokeStyle="black",e.lineWidth=2,e.fillStyle="rgba(200, 200, 200, 0.25)",e.lineJoin="round",e.lineCap="round"},e.prototype.getNormalizedPosition=function(e){var t=this.selectionCanvas.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}},e.prototype.drawSmoothFilledPath=function(e){var t=this.selectionCanvas.getContext("2d");this.setDrawingStyles(t);var n,i,r=e[0],o=e[1],a=e.length;t.beginPath(),t.moveTo(r.x,r.y);for(var s=1;s<a;s+=1){var h=(i=o,{x:(n=r).x+(i.x-n.x)/2,y:n.y+(i.y-n.y)/2});t.quadraticCurveTo(r.x,r.y,h.x,h.y),r=e[s],o=e[s+1]}t.lineTo(r.x,r.y),t.stroke(),t.fill()},e.prototype.getGraphNodesInCurrentPath=function(){var e=this,t=this.sigma.getGraph(),n=this.selectionCanvas.getContext("2d"),i=[],r=this.sigma.getDimensions(),o=r.width,a=r.height;return t.forEachNode((function(r){var s=t.getNodeAttributes(r),h=e.sigma.graphToViewport({x:s.x,y:s.y});h.x>=0&&h.x<=o&&h.y>=0&&h.y<=a&&n.isPointInPath(h.x,h.y)&&i.push(Number(r))})),i},e.prototype.onDrawingStart=function(e){if(e.preventDefault(),this.mode!==nn.inactive){this.isDrawing=!0;var t=this.getNormalizedPosition(e);this.mode===nn.lasso&&(this.lassoDrawnPoints=[],this.lassoDrawnPoints.push(t)),this.mode===nn.box&&(this.boxInitialPoint=t),e.stopPropagation()}},e.prototype.onDrawing=function(e){if(this.mode!==nn.inactive&&this.isDrawing){var t=this.getNormalizedPosition(e),n=this.selectionCanvas.getContext("2d");if(this.setDrawingStyles(n),n.clearRect(0,0,n.canvas.width,n.canvas.height),this.mode===nn.lasso&&(this.lassoDrawnPoints.push(t),this.drawSmoothFilledPath(this.lassoDrawnPoints)),this.mode===nn.box&&this.boxInitialPoint){n.beginPath();var i=t.x-this.boxInitialPoint.x,r=t.y-this.boxInitialPoint.y;n.rect(this.boxInitialPoint.x,this.boxInitialPoint.y,i,r),n.fill()}e.stopPropagation()}},e.prototype.onDrawingEnd=function(e){if(this.mode!==nn.inactive){var t=this.getGraphNodesInCurrentPath();this.isDrawing=!1,e.shiftKey?this.addSelectedNodes(t):this.updateSelectedNodes(t);var n=this.selectionCanvas.getContext("2d");n.clearRect(0,0,this.selectionCanvas.width,this.selectionCanvas.height),n.beginPath(),this.mode===nn.lasso&&(this.lassoDrawnPoints=[]),this.mode===nn.box&&(this.boxInitialPoint=null),e.stopPropagation()}},e.prototype.onSelectScroll=function(e){this.sigma.getMouseCaptor().handleWheel(e)},e.prototype.initializeOverlay=function(){var e=this;this.overlay=function(){var t=document.createElement("div");t.className="webgl-overlay",t.innerText='Graph is not shown because the WebGL context was lost.\nThis can happen when the browser has too many other objects to display. Usually, clicking "Restore Context" will be able to bring the graph back.';var n=document.createElement("button");return n.innerText="Restore Graph Display",n.style.marginTop="20px",n.style.padding="10px 20px",n.style.fontSize="1rem",n.style.cursor="pointer",n.addEventListener("click",(function(){return e.handleContextRestored()})),t.appendChild(n),t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.width="100%",t.style.height="100%",t.style.backgroundColor="rgba(0, 0, 0, 0.7)",t.style.color="white",t.style.display="flex",t.style.flexDirection="column",t.style.justifyContent="center",t.style.alignItems="center",t.style.zIndex="1000",t.style.visibility="hidden",t}(),this.graphContainer.appendChild(this.overlay)},e.prototype.createControls=function(){var e=this,t=function(){var e=document.createElement("div");return e.className="controls-container",e.style.position="absolute",e.style.display="flex",e.style.bottom="10px",e.style.right="10px",e.style.zIndex="10",e}(),n=nt("\n<svg\n width='32'\n height='32'\n viewBox='0 0 32 32'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n>\n <path d='M9 16H23' stroke='#122239' stroke-width='2' stroke-linecap='round' />\n <path d='M16 9L16 23' stroke='#122239' stroke-width='2' stroke-linecap='round' />\n</svg>\n",(function(){return Cn(e,void 0,void 0,(function(){return _n(this,(function(e){switch(e.label){case 0:return[4,this.zoomIn()];case 1:return[2,e.sent()]}}))}))}),"Zoom In");t.appendChild(n);var i=nt("\n<svg width='32' height='32' viewBox='0 0 32 32' fill='none' xmlns='http://www.w3.org/2000/svg'>\n <path\n d='M9 16H23'\n stroke='#122239'\n stroke-width='2'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n</svg>",(function(){return Cn(e,void 0,void 0,(function(){return _n(this,(function(e){switch(e.label){case 0:return[4,this.zoomOut()];case 1:return[2,e.sent()]}}))}))}),"Zoom Out");t.appendChild(i);var r=nt("\n<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' fill='none' viewBox='0 0 32 32'>\n <path d='M7 7v7M7 7h7M25 25v-7M25 25h-7' stroke='#122239' stroke-width='2.1' stroke-linecap='round' />\n</svg>\n",(function(){return Cn(e,void 0,void 0,(function(){return _n(this,(function(e){switch(e.label){case 0:return[4,this.resetView()];case 1:return[2,e.sent()]}}))}))}),"Reset Zoom");t.appendChild(r),this.resetButton=nt("\n<svg\n width='32'\n height='32'\n viewBox='0 0 32 32'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n>\n <path\n d='M25.295 18C25.388 17.9999 25.48 18.0181 25.5659 18.0538C25.6517 18.0894 25.7297 18.1417 25.7952 18.2076C25.8608 18.2735 25.9126 18.3518 25.9478 18.4378C25.9829 18.5239 26.0007 18.616 26 18.709V21.913C26.0007 22.0055 25.9831 22.0973 25.9482 22.183C25.9134 22.2688 25.862 22.3468 25.797 22.4126C25.732 22.4785 25.6546 22.5309 25.5694 22.5668C25.4841 22.6027 25.3925 22.6215 25.3 22.622C25.2075 22.6215 25.116 22.6027 25.0307 22.5668C24.9454 22.5309 24.868 22.4785 24.803 22.4126C24.738 22.3468 24.6866 22.2688 24.6518 22.183C24.6169 22.0973 24.5994 22.0055 24.6 21.913V20.788C22.779 23.844 19.399 26 15.757 26C11.347 26 7.65102 23.279 6.04802 19.085C5.98071 18.9103 5.98495 18.716 6.05982 18.5444C6.13469 18.3728 6.27416 18.2375 6.44802 18.168C6.80802 18.027 7.21402 18.208 7.35402 18.573C8.75402 22.235 11.942 24.583 15.757 24.583C19.128 24.583 22.277 22.401 23.744 19.429L22.273 19.439C22.1805 19.4391 22.0888 19.421 22.0033 19.3857C21.9178 19.3504 21.84 19.2985 21.7746 19.2332C21.7091 19.1678 21.6571 19.0901 21.6217 19.0046C21.5863 18.9192 21.568 18.8275 21.568 18.735C21.5656 18.5482 21.6375 18.3681 21.7678 18.2342C21.8981 18.1003 22.0762 18.0236 22.263 18.021L25.295 18ZM16.245 6C20.653 6 24.35 8.721 25.953 12.915C26.0203 13.0897 26.0161 13.284 25.9412 13.4556C25.8663 13.6272 25.7269 13.7625 25.553 13.832C25.467 13.8655 25.3752 13.8817 25.2829 13.8794C25.1906 13.8772 25.0996 13.8566 25.0153 13.8189C24.931 13.7813 24.8551 13.7272 24.7918 13.6599C24.7286 13.5926 24.6794 13.5135 24.647 13.427C23.247 9.765 20.059 7.417 16.244 7.417C12.873 7.417 9.72402 9.599 8.25702 12.571L9.72802 12.561C9.82055 12.5609 9.9122 12.579 9.99773 12.6143C10.0833 12.6496 10.161 12.7015 10.2265 12.7668C10.2919 12.8322 10.3439 12.9099 10.3793 12.9954C10.4148 13.0808 10.433 13.1725 10.433 13.265C10.4354 13.4518 10.3636 13.6319 10.2333 13.7658C10.1029 13.8997 9.92483 13.9764 9.73802 13.979L6.70502 14C6.61206 14.0001 6.52 13.9819 6.43414 13.9462C6.34828 13.9106 6.27033 13.8583 6.20479 13.7924C6.13925 13.7265 6.08741 13.6482 6.05226 13.5622C6.01711 13.4761 5.99936 13.384 6.00002 13.291V10.087C6.00002 9.695 6.31302 9.378 6.70002 9.378C7.08602 9.378 7.40002 9.695 7.40002 10.087V11.212C9.22102 8.156 12.601 6 16.243 6H16.245Z'\n fill='#122239'\n stroke='#122239'\n stroke-width='0.5'\n />\n <circle cx='16' cy='16' r='3' fill='#122239' />\n</svg>\n",(function(t){return Cn(e,void 0,void 0,(function(){var e,n,i,r,o;return _n(this,(function(a){switch(a.label){case 0:return e=this.animator.isRunning(),n=null,this.resetButton&&(this.resetButton.style.backgroundColor="#bddde8",(n=this.resetButton.getAttribute("data-tooltip"))&&this.resetButton.setAttribute("data-tooltip","Reset Layout (running)")),t.shiftKey?[3,3]:(i=xn(xn({},wn(this.graph)),this.animator.params.settings),t.metaKey&&(i.warmupLayout=!0),i.expectedDims=this.getGraphViewportBounds(),console.log("reset layout initialSettings",i),r={iterations:300,settings:i},this.animator.stop(),this.sigma.getCustomBBox()||this.sigma.setCustomBBox(this.sigma.getBBox()),[4,this.applyInitialLayout(r)]);case 1:return a.sent(),[4,pn(this.graph,r,!t.altKey)];case 2:return o=a.sent(),this.animator.params.settings=o,this.animator.forceNodePositionUpdate(),[3,4];case 3:t.altKey||(this.animator.stop(),s=this.graph,h=this.getGraphViewportBounds(),u=this.animator.params.settings.layoutSingletonsSeparately,c=(0,at.kS)(s).map((function(e){return e.map(Number)})),d=un(s),an(d.nodes,c,100,h,u),cn(s,d.nodes),this.animator.forceNodePositionUpdate()),a.label=4;case 4:return[4,this.resetView()];case 5:return a.sent(),e&&this.animator.start(),this.resetButton&&(this.resetButton.style.backgroundColor="#e2e4e7",n&&this.resetButton.setAttribute("data-tooltip","Reset Layout")),this.sigma.getBBox(),[2]}var s,h,u,c,d}))}))}),"Reset Layout"),t.appendChild(this.resetButton),this.fullScreenButton=nt(this._isFullScreen?gn:vn,(function(){return e.toggleFullScreen()}),this._isFullScreen?"Scale back":"Expand"),t.appendChild(this.fullScreenButton),this.lassoSelectButton=nt("\n<svg\n width='32'\n height='32'\n viewBox='0 0 32 32'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n >\n <path\n d='M11 26C10.379 25.5343 9.875 24.9303 9.52786 24.2361C9.18073 23.5418 9 22.7762 9 22M7.3 18C6.45485 16.8376 5.99974 15.4372 6 14C6 9.6 10.5 6 16 6C21.5 6 26 9.6 26 14C26 18.4 21.5 22 16 22C14.2809 22.0287 12.5758 21.6877 11 21'\n stroke='#122239'\n stroke-width='2'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n <path\n d='M9 22C9.53043 22 10.0391 21.7893 10.4142 21.4142C10.7893 21.0391 11 20.5304 11 20C11 19.4696 10.7893 18.9609 10.4142 18.5858C10.0391 18.2107 9.53043 18 9 18C8.46957 18 7.96086 18.2107 7.58579 18.5858C7.21071 18.9609 7 19.4696 7 20C7 20.5304 7.21071 21.0391 7.58579 21.4142C7.96086 21.7893 8.46957 22 9 22V22Z'\n stroke='#122239'\n stroke-width='1.5'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n </svg>\n",(function(){return e.toggleLassoSelect()}),"Lasso Select"),t.appendChild(this.lassoSelectButton),this.boxSelectButton=nt("\n<svg width='32' height='32' viewBox='0 0 32 32' fill='none' xmlns='http://www.w3.org/2000/svg'>\n <path\n d='M6 17.6667V14.3333C6 14.1123 6.0878 13.9004 6.24408 13.7441C6.40036 13.5878 6.61232 13.5 6.83333 13.5C7.05435 13.5 7.26631 13.5878 7.42259 13.7441C7.57887 13.9004 7.66667 14.1123 7.66667 14.3333V17.6667C7.66667 17.8877 7.57887 18.0996 7.42259 18.2559C7.26631 18.4122 7.05435 18.5 6.83333 18.5C6.61232 18.5 6.40036 18.4122 6.24408 18.2559C6.0878 18.0996 6 17.8877 6 17.6667ZM10.1667 6H7.66667C7.22464 6 6.80072 6.17559 6.48816 6.48816C6.17559 6.80072 6 7.22464 6 7.66667V10.1667C6 10.3877 6.0878 10.5996 6.24408 10.7559C6.40036 10.9122 6.61232 11 6.83333 11C7.05435 11 7.26631 10.9122 7.42259 10.7559C7.57887 10.5996 7.66667 10.3877 7.66667 10.1667V7.66667H10.1667C10.3877 7.66667 10.5996 7.57887 10.7559 7.42259C10.9122 7.26631 11 7.05435 11 6.83333C11 6.61232 10.9122 6.40036 10.7559 6.24408C10.5996 6.0878 10.3877 6 10.1667 6ZM10.1667 24.3333H7.66667V21.8333C7.66667 21.6123 7.57887 21.4004 7.42259 21.2441C7.26631 21.0878 7.05435 21 6.83333 21C6.61232 21 6.40036 21.0878 6.24408 21.2441C6.0878 21.4004 6 21.6123 6 21.8333V24.3333C6 24.7754 6.17559 25.1993 6.48816 25.5118C6.80072 25.8244 7.22464 26 7.66667 26H10.1667C10.3877 26 10.5996 25.9122 10.7559 25.7559C10.9122 25.5996 11 25.3877 11 25.1667C11 24.9457 10.9122 24.7337 10.7559 24.5774C10.5996 24.4211 10.3877 24.3333 10.1667 24.3333ZM17.6667 24.3333H14.3333C14.1123 24.3333 13.9004 24.4211 13.7441 24.5774C13.5878 24.7337 13.5 24.9457 13.5 25.1667C13.5 25.3877 13.5878 25.5996 13.7441 25.7559C13.9004 25.9122 14.1123 26 14.3333 26H17.6667C17.8877 26 18.0996 25.9122 18.2559 25.7559C18.4122 25.5996 18.5 25.3877 18.5 25.1667C18.5 24.9457 18.4122 24.7337 18.2559 24.5774C18.0996 24.4211 17.8877 24.3333 17.6667 24.3333ZM25.1667 13.5C24.9457 13.5 24.7337 13.5878 24.5774 13.7441C24.4211 13.9004 24.3333 14.1123 24.3333 14.3333V17.6667C24.3333 17.8877 24.4211 18.0996 24.5774 18.2559C24.7337 18.4122 24.9457 18.5 25.1667 18.5C25.3877 18.5 25.5996 18.4122 25.7559 18.2559C25.9122 18.0996 26 17.8877 26 17.6667V14.3333C26 14.1123 25.9122 13.9004 25.7559 13.7441C25.5996 13.5878 25.3877 13.5 25.1667 13.5ZM24.3333 6H21.8333C21.6123 6 21.4004 6.0878 21.2441 6.24408C21.0878 6.40036 21 6.61232 21 6.83333C21 7.05435 21.0878 7.26631 21.2441 7.42259C21.4004 7.57887 21.6123 7.66667 21.8333 7.66667H24.3333V10.1667C24.3333 10.3877 24.4211 10.5996 24.5774 10.7559C24.7337 10.9122 24.9457 11 25.1667 11C25.3877 11 25.5996 10.9122 25.7559 10.7559C25.9122 10.5996 26 10.3877 26 10.1667V7.66667C26 7.22464 25.8244 6.80072 25.5118 6.48816C25.1993 6.17559 24.7754 6 24.3333 6ZM17.6667 6H14.3333C14.1123 6 13.9004 6.0878 13.7441 6.24408C13.5878 6.40036 13.5 6.61232 13.5 6.83333C13.5 7.05435 13.5878 7.26631 13.7441 7.42259C13.9004 7.57887 14.1123 7.66667 14.3333 7.66667H17.6667C17.8877 7.66667 18.0996 7.57887 18.2559 7.42259C18.4122 7.26631 18.5 7.05435 18.5 6.83333C18.5 6.61232 18.4122 6.40036 18.2559 6.24408C18.0996 6.0878 17.8877 6 17.6667 6ZM25.1667 21C24.9457 21 24.7337 21.0878 24.5774 21.2441C24.4211 21.4004 24.3333 21.6123 24.3333 21.8333V24.3333H21.8333C21.6123 24.3333 21.4004 24.4211 21.2441 24.5774C21.0878 24.7337 21 24.9457 21 25.1667C21 25.3877 21.0878 25.5996 21.2441 25.7559C21.4004 25.9122 21.6123 26 21.8333 26H24.3333C24.7754 26 25.1993 25.8244 25.5118 25.5118C25.8244 25.1993 26 24.7754 26 24.3333V21.8333C26 21.6123 25.9122 21.4004 25.7559 21.2441C25.5996 21.0878 25.3877 21 25.1667 21Z'\n fill='#122239'\n stroke='#122239'\n stroke-width='0.5'\n />\n</svg>\n",(function(){return e.toggleBoxSelect()}),"Box Select"),t.appendChild(this.boxSelectButton);var o=nt("<svg\n width='32'\n height='32'\n viewBox='0 0 32 32'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n>\n <path\n d='M6 17.6667V14.3333C6 14.1123 6.0878 13.9004 6.24408 13.7441C6.40036 13.5878 6.61232 13.5 6.83333 13.5C7.05435 13.5 7.26631 13.5878 7.42259 13.7441C7.57887 13.9004 7.66667 14.1123 7.66667 14.3333V17.6667C7.66667 17.8877 7.57887 18.0996 7.42259 18.2559C7.26631 18.4122 7.05435 18.5 6.83333 18.5C6.61232 18.5 6.40036 18.4122 6.24408 18.2559C6.0878 18.0996 6 17.8877 6 17.6667ZM10.1667 6H7.66667C7.22464 6 6.80072 6.17559 6.48816 6.48816C6.17559 6.80072 6 7.22464 6 7.66667V10.1667C6 10.3877 6.0878 10.5996 6.24408 10.7559C6.40036 10.9122 6.61232 11 6.83333 11C7.05435 11 7.26631 10.9122 7.42259 10.7559C7.57887 10.5996 7.66667 10.3877 7.66667 10.1667V7.66667H10.1667C10.3877 7.66667 10.5996 7.57887 10.7559 7.42259C10.9122 7.26631 11 7.05435 11 6.83333C11 6.61232 10.9122 6.40036 10.7559 6.24408C10.5996 6.0878 10.3877 6 10.1667 6ZM10.1667 24.3333H7.66667V21.8333C7.66667 21.6123 7.57887 21.4004 7.42259 21.2441C7.26631 21.0878 7.05435 21 6.83333 21C6.61232 21 6.40036 21.0878 6.24408 21.2441C6.0878 21.4004 6 21.6123 6 21.8333V24.3333C6 24.7754 6.17559 25.1993 6.48816 25.5118C6.80072 25.8244 7.22464 26 7.66667 26H10.1667C10.3877 26 10.5996 25.9122 10.7559 25.7559C10.9122 25.5996 11 25.3877 11 25.1667C11 24.9457 10.9122 24.7337 10.7559 24.5774C10.5996 24.4211 10.3877 24.3333 10.1667 24.3333ZM17.6667 24.3333H14.3333C14.1123 24.3333 13.9004 24.4211 13.7441 24.5774C13.5878 24.7337 13.5 24.9457 13.5 25.1667C13.5 25.3877 13.5878 25.5996 13.7441 25.7559C13.9004 25.9122 14.1123 26 14.3333 26H17.6667C17.8877 26 18.0996 25.9122 18.2559 25.7559C18.4122 25.5996 18.5 25.3877 18.5 25.1667C18.5 24.9457 18.4122 24.7337 18.2559 24.5774C18.0996 24.4211 17.8877 24.3333 17.6667 24.3333ZM25.1667 13.5C24.9457 13.5 24.7337 13.5878 24.5774 13.7441C24.4211 13.9004 24.3333 14.1123 24.3333 14.3333V17.6667C24.3333 17.8877 24.4211 18.0996 24.5774 18.2559C24.7337 18.4122 24.9457 18.5 25.1667 18.5C25.3877 18.5 25.5996 18.4122 25.7559 18.2559C25.9122 18.0996 26 17.8877 26 17.6667V14.3333C26 14.1123 25.9122 13.9004 25.7559 13.7441C25.5996 13.5878 25.3877 13.5 25.1667 13.5ZM24.3333 6H21.8333C21.6123 6 21.4004 6.0878 21.2441 6.24408C21.0878 6.40036 21 6.61232 21 6.83333C21 7.05435 21.0878 7.26631 21.2441 7.42259C21.4004 7.57887 21.6123 7.66667 21.8333 7.66667H24.3333V10.1667C24.3333 10.3877 24.4211 10.5996 24.5774 10.7559C24.7337 10.9122 24.9457 11 25.1667 11C25.3877 11 25.5996 10.9122 25.7559 10.7559C25.9122 10.5996 26 10.3877 26 10.1667V7.66667C26 7.22464 25.8244 6.80072 25.5118 6.48816C25.1993 6.17559 24.7754 6 24.3333 6ZM17.6667 6H14.3333C14.1123 6 13.9004 6.0878 13.7441 6.24408C13.5878 6.40036 13.5 6.61232 13.5 6.83333C13.5 7.05435 13.5878 7.26631 13.7441 7.42259C13.9004 7.57887 14.1123 7.66667 14.3333 7.66667H17.6667C17.8877 7.66667 18.0996 7.57887 18.2559 7.42259C18.4122 7.26631 18.5 7.05435 18.5 6.83333C18.5 6.61232 18.4122 6.40036 18.2559 6.24408C18.0996 6.0878 17.8877 6 17.6667 6ZM25.1667 21C24.9457 21 24.7337 21.0878 24.5774 21.2441C24.4211 21.4004 24.3333 21.6123 24.3333 21.8333V24.3333H21.8333C21.6123 24.3333 21.4004 24.4211 21.2441 24.5774C21.0878 24.7337 21 24.9457 21 25.1667C21 25.3877 21.0878 25.5996 21.2441 25.7559C21.4004 25.9122 21.6123 26 21.8333 26H24.3333C24.7754 26 25.1993 25.8244 25.5118 25.5118C25.8244 25.1993 26 24.7754 26 24.3333V21.8333C26 21.6123 25.9122 21.4004 25.7559 21.2441C25.5996 21.0878 25.3877 21 25.1667 21Z'\n fill='#122239'\n stroke='#122239'\n stroke-width='0.5'\n />\n <path\n d='M19.8225 12.1835C19.5859 11.9469 19.2036 11.9469 18.967 12.1835L16 15.1445L13.033 12.1775C12.7964 11.9408 12.4141 11.9408 12.1775 12.1775C11.9408 12.4141 11.9408 12.7964 12.1775 13.033L15.1445 16L12.1775 18.967C11.9408 19.2036 11.9408 19.5859 12.1775 19.8225C12.4141 20.0592 12.7964 20.0592 13.033 19.8225L16 16.8555L18.967 19.8225C19.2036 20.0592 19.5859 20.0592 19.8225 19.8225C20.0592 19.5859 20.0592 19.2036 19.8225 18.967L16.8555 16L19.8225 13.033C20.0531 12.8024 20.0531 12.4141 19.8225 12.1835V12.1835Z'\n fill='#122239'\n stroke='#122239'\n stroke-width='0.5'\n />\n</svg>\n",(function(){return e.clearSelection()}),"Clear Selection");t.appendChild(o);var a=nt("<svg width='32'\n height='32'\n viewBox='0 0 32 32'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n>\n <path\n fill-rule='evenodd'\n clip-rule='evenodd'\n d='M16 6C10.4772 6 6 10.4772 6 16C6 21.5228 10.4772 26 16 26C21.5228 26 26 21.5228 26 16C26 10.4772 21.5228 6 16 6ZM7.53846 16C7.53846 11.3268 11.3268 7.53846 16 7.53846C16.0002 7.53846 15.9998 7.53846 16 7.53846L16.0006 12.4497C15.059 12.4497 14.156 12.8238 13.4902 13.4896C12.8244 14.1554 12.4503 15.0584 12.4503 16C12.4503 16.9416 12.8244 17.8446 13.4902 18.5104C14.156 19.1762 15.059 19.5503 16.0006 19.5503V24.4615C16.0004 24.4615 16.0008 24.4615 16.0006 24.4615C11.3274 24.4615 7.53846 20.6732 7.53846 16ZM16.0006 19.5503C16.9422 19.5503 17.8452 19.1762 18.5111 18.5104C19.1769 17.8446 19.5509 16.9416 19.5509 16C19.5509 15.0584 19.1769 14.1554 18.5111 13.4896C17.8452 12.8238 16.9422 12.4497 16.0006 12.4497V19.5503Z'\n fill='#122239'\n />\n <path\n d='M16 7.53846C11.3268 7.53846 7.53846 11.3268 7.53846 16C7.53846 20.6732 11.3274 24.4615 16.0006 24.4615M16 7.53846C15.9998 7.53846 16.0002 7.53846 16 7.53846ZM16 7.53846L16.0006 12.4497M16.0006 12.4497C15.059 12.4497 14.156 12.8238 13.4902 13.4896C12.8244 14.1554 12.4503 15.0584 12.4503 16C12.4503 16.9416 12.8244 17.8446 13.4902 18.5104C14.156 19.1762 15.059 19.5503 16.0006 19.5503M16.0006 12.4497C16.9422 12.4497 17.8452 12.8238 18.5111 13.4896C19.1769 14.1554 19.5509 15.0584 19.5509 16C19.5509 16.9416 19.1769 17.8446 18.5111 18.5104C17.8452 19.1762 16.9422 19.5503 16.0006 19.5503M16.0006 12.4497V19.5503M16.0006 19.5503V24.4615M16.0006 24.4615C16.0008 24.4615 16.0004 24.4615 16.0006 24.4615ZM6 16C6 10.4772 10.4772 6 16 6C21.5228 6 26 10.4772 26 16C26 21.5228 21.5228 26 16 26C10.4772 26 6 21.5228 6 16Z'\n stroke='#122239'\n stroke-width='0.5'\n />\n</svg>\n",(function(){return e.invertSelection()}),"Invert Selection");t.appendChild(a),this.playPauseButton=nt(this._animate?yn:mn,(function(){return e.togglePlayPause()}),this._animate?"Pause Animation":"Play Animation"),t.appendChild(this.playPauseButton),this.graphContainer.appendChild(t)},e.prototype.zoomIn=function(){return Cn(this,void 0,void 0,(function(){return _n(this,(function(e){switch(e.label){case 0:return[4,this.sigma.getCamera().animatedZoom({duration:this.zoomDuration,factor:this.zoomFactor})];case 1:return e.sent(),[2]}}))}))},e.prototype.zoomOut=function(){return Cn(this,void 0,void 0,(function(){return _n(this,(function(e){switch(e.label){case 0:return[4,this.sigma.getCamera().animatedUnzoom({duration:this.zoomDuration,factor:this.zoomFactor})];case 1:return e.sent(),[2]}}))}))},e.prototype.unzoom=function(e,t){return Cn(this,void 0,void 0,(function(){return _n(this,(function(n){switch(n.label){case 0:return[4,this.sigma.getCamera().animatedUnzoom({duration:t,factor:e})];case 1:return n.sent(),[2]}}))}))},e.prototype.resetView=function(){return Cn(this,void 0,void 0,(function(){var e,t,n,i,r,o,a;return _n(this,(function(s){switch(s.label){case 0:return this.sigma.refresh(),e=this.getFramedGraphBounds(),t=e[0],n=e[1],i={x:(n.x+t.x)/2,y:(n.y+t.y)/2},r=this.sigma.getCamera().getState().ratio,o=this.getGraphZoomRatioAdjustment(),a=r*o,[4,this.sigma.getCamera().animate(xn(xn({},i),{ratio:a,angle:0}),{duration:this.zoomDuration})];case 1:return s.sent(),[2]}}))}))},e.prototype.getGraphZoomRatioAdjustment=function(){var e=this.sigma.getBBox(),t=e.x,n=t[0],i=t[1],r=e.y,o=r[0],a=r[1],s=this.sigma.getDimensions(),h=s.width,u=s.height,c=this.sigma.viewportToGraph({x:0,y:40}),d=c.x,l=c.y,f=this.sigma.viewportToGraph({x:h,y:u-40}),p=f.x,g=f.y,v=Math.max(Math.abs(p-d),400),m=Math.max(Math.abs(g-l),300),y=Math.max(1.05*(i-n)/v,1.05*(a-o)/m);return console.log("zoom ratio",y),y},e.prototype.getFramedGraphBounds=function(){var e=this.sigma.getBBox(),t=e.x,n=t[0],i=t[1],r=e.y,o=r[0],a=r[1];return[this.sigma.viewportToFramedGraph(this.sigma.graphToViewport({x:n,y:o})),this.sigma.viewportToFramedGraph(this.sigma.graphToViewport({x:i,y:a}))]},e.prototype.getFramedGraphZoomRatio=function(e,t){var n=this.sigma.getDimensions(),i=n.width,r=n.height,o=Math.min(1,r/i),a=Math.min(1,i/r);return Math.max((t.x-e.x)/a,(t.y-e.y)/o)},e.prototype.toggleFullScreen=function(){this._isFullScreen=!this._isFullScreen,this.onFullScreenChange(this._isFullScreen),this.fullScreenButton&&(this.fullScreenButton.innerHTML=this._isFullScreen?gn:vn,this.fullScreenButton.setAttribute("data-tooltip",this._isFullScreen?"Scale back":"Expand"))},e.prototype.toggleLassoSelect=function(){this.mode!==nn.lasso?this.setSelectMode(nn.lasso):this.setSelectMode(nn.inactive)},e.prototype.toggleBoxSelect=function(){this.mode!==nn.box?this.setSelectMode(nn.box):this.setSelectMode(nn.inactive)},e.prototype.clearSelection=function(){this.handleSelectionClear()},e.prototype.invertSelection=function(){var e=this,t=[];this.graph.forEachNode((function(n){var i=Number(n);e.selectedNodes.some((function(e){return e===i}))||t.push(i)})),this.updateSelectedNodes(t)},e.prototype.updateAnimatorState=function(){this.animator&&(this._animate?this.animator.isRunning()||this.animator.start():this.animator.isRunning()&&this.animator.stop())},e.prototype.togglePlayPause=function(){this._animate=!this._animate,this.playPauseButton&&(this.playPauseButton.innerHTML=this._animate?yn:mn,this.playPauseButton.setAttribute("data-tooltip",this._animate?"Pause Animation":"Play Animation")),this.updateAnimatorState()},e.prototype.removeHoverOverlay=function(){var e=document.getElementById("node-hover-overlay");e&&(e.style.display="none",e.innerHTML="")},e.prototype.getGraphContainer=function(){return this.graphContainer},Object.defineProperty(e.prototype,"selectedNodes",{get:function(){return this._selectedNodes},enumerable:!1,configurable:!0}),e.prototype.setSelectedNodes=function(e,t){void 0===t&&(t=!0),this._selectedNodes=e,this.updateNodeSelection(),this.removeHoverOverlay(),t&&this.onSelectedNodesChange(e)},e.prototype.updateNodeSelection=function(){var e=new Set(this.selectedNodes);this.graph.updateEachNodeAttributes((function(t,n){var i=Number(t),r=e.has(i),o=n.hovered;if(n.labelBeforeSelection||o||(n.labelBeforeSelection=n.originalLabel||n.label),r)return xn(xn({},n),{label:void 0,originalLabel:void 0,highlighted:!0});var a=n.labelBeforeSelection;return xn(xn({},n),{label:a,originalLabel:a,highlighted:!1})}))},Object.defineProperty(e.prototype,"highlightedNodes",{get:function(){return this._highlightedNodes},set:function(e){this._highlightedNodes=e,this.updateNodeHighlighting(),this.onHighlightedNodesChange(e)},enumerable:!1,configurable:!0}),e.prototype.updateHighlightedNodes=function(e){this.highlightedNodes=e},e.prototype.updateNodeHighlighting=function(){var e=this,t=new Set(this.highlightedNodes);this.graph.updateEachNodeAttributes((function(n,i){var r=Number(n),o=t.has(r);if(o&&(void 0!==i.border||void 0!==i.originalBorder))return i.hasOwnProperty("originalBorder")||(i.originalBorder=i.border||null),xn(xn({},i),{border:e.highlightedNodeColor});if(!o&&i.hasOwnProperty("originalBorder")){var a=null===i.originalBorder?void 0:i.originalBorder;return delete i.originalBorder,xn(xn({},i),{border:a})}return i}))},Object.defineProperty(e.prototype,"isFullScreen",{get:function(){return this._isFullScreen},set:function(e){this._isFullScreen=e,this.onFullScreenChange(e)},enumerable:!1,configurable:!0}),e.prototype.updateGraph=function(e){var t=this.sigma.getBBox();this.graph=e,this.sigma.setGraph(e);var n=this.sigma.getBBox(),i=(n.x[1]-n.x[0])/(t.x[1]-t.x[0]),r=(n.y[1]-n.y[0])/(t.y[1]-t.y[0]),o=Math.max(i,r),a=this.sigma.getCamera().getState().ratio;this.sigma.getCamera().setState({ratio:a*o}),this.refresh()},e.prototype.updateAnimator=function(e){this.animator&&this.animator.kill(),this.animator=e},e.prototype.resetCamera=function(){return Cn(this,void 0,void 0,(function(){return _n(this,(function(e){switch(e.label){case 0:return[4,this.sigma.getCamera().animatedReset()];case 1:return e.sent(),[2]}}))}))},e.prototype.zoomInAndOut=function(){return Cn(this,void 0,void 0,(function(){return _n(this,(function(e){switch(e.label){case 0:return[4,this.sigma.getCamera().animatedUnzoom()];case 1:return e.sent(),[4,this.sigma.getCamera().animatedZoom()];case 2:return e.sent(),[2]}}))}))},e.prototype.updateSigmaSettings=function(e){var t=this;this.sigmaSettings=xn(xn({},this.sigmaSettings),e),Object.keys(e).forEach((function(n){Object.hasOwn(e,n)&&t.sigma.setSetting(n,e[n])}))},e.prototype.resetGraphBounds=function(){this.sigma.setCustomBBox({x:[-350,350],y:[-220,220]})},e.prototype.refresh=function(){this.sigma.refresh()},e.prototype.cleanup=function(){this.sigma.off("enterNode",this.handleEnterNode),this.sigma.off("leaveNode",this.handleLeaveNode),this.sigma.off("downNode",this.handleDownNode),this.sigma.off("doubleClickNode",this.handleNodeDoubleClick),this.sigma.off("doubleClickStage",this.handleDoubleClickStage),this.sigma.getMouseCaptor().off("wheel",this.handleWheel),this.allowNodeMovement&&(this.sigma.getMouseCaptor().off("mousemovebody",this.handleMouseMoveBody),this.sigma.getMouseCaptor().off("mouseup",this.handleMouseUp),this.sigma.getMouseCaptor().off("mousedown",this.handleMouseDown))},e.prototype.dispose=function(){this.sigma&&this.sigma.kill()},e.prototype.applyInitialLayout=function(e){return Cn(this,void 0,void 0,(function(){return _n(this,(function(e){return[2]}))}))},e}(),Ln=function(){return Ln=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Ln.apply(this,arguments)},Nn=function(){function e(e,t,n,i){var r=this;this.callback=null,this.graph=e,this.endPositions=t,this.animation_type=n,this.frameID=null,this.running=!1,this.startPositions=new Array(e.nodes().length),this.graph.forEachNode((function(e,t){var n=Number(e);r.startPositions[n]={x:t.x,y:t.y}})),this.duration=i}return e.prototype.isRunning=function(){return this.running},e.prototype.updateNodePositions=function(e){var t=this;this.graph.updateEachNodeAttributes((function(n,i){var r=Number(n),o=t.endPositions[r],a=t.startPositions[r],s=(o.x-a.x)*e,h=(o.y-a.y)*e;return Ln(Ln({},i),{x:a.x+s,y:a.y+h})}))},e.prototype.runFrame=function(){var e=this;this.startTime||(this.startTime=Date.now());var t=Math.min((Date.now()-this.startTime)/this.duration,1);this.updateNodePositions(t),1===t?this._kill():this.frameID=window.requestAnimationFrame((function(){return e.runFrame()}))},e.prototype._stop=function(){return null!==this.callback&&this.callback(),this.callback=null,this.running=!1,null!==this.frameID&&(window.cancelAnimationFrame(this.frameID),this.frameID=null),this},e.prototype.run=function(e){this.callback=e,this.running||(this.startTime=Date.now(),this.running=!0,this.runFrame())},e.prototype._kill=function(){this._stop()},e}(),An=function(){return An=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},An.apply(this,arguments)},Tn=function(){function e(e){var t=this;this.sliderValues={},this.sliderConfigs=[],this.views=[],this.listeners={},this.sliderConfigs=e,e.forEach((function(e){t.sliderValues[e.label]=e.initialValue,t.listeners[e.label]=[]}))}return e.prototype.callListeners=function(e){var t=this;this.listeners[e].forEach((function(n){n(t.sliderValues[e])}))},e.prototype.getView=function(e){var t=this,n=this.sliderConfigs.map((function(e,n){return An(An({},e),{initialValue:t.getSliderValue(e.label)||e.initialValue})})),i=new Mn(e,n);return Object.keys(this.sliderValues).forEach((function(e){i.addListener(e,(function(n){var i=Number(n.target.value);t.setSliderValue(e,i),t.callListeners(e)}))})),this.views.push(i),i},e.prototype.deleteView=function(e){this.views=this.views.filter((function(t){return t!==e}))},e.prototype.getSliderValue=function(e){return this.sliderValues[e]||null},e.prototype.setSliderValue=function(e,t){this.sliderValues[e]=t,this.views.forEach((function(n){n.setSliderValue(e,t)}))},e.prototype.addListener=function(e,t){this.listeners[e].push(t)},e}(),Mn=function(){function e(e,t){var n=this;this.sliders={},this.sliderValues={};var i=this.createSliderContainer();e.appendChild(i),t.forEach((function(e){var t=n.createSliderWrapper(e),r=t.wrapper,o=t.slider,a=t.labelElement;i.appendChild(r),n.sliders[e.label]=o,n.sliderValues[e.label]=a,o.addEventListener("input",(function(){a.textContent=o.value}))}))}return e.prototype.createSliderContainer=function(){var e=document.createElement("div");return e.className="slider-container",e},e.prototype.createSliderWrapper=function(e){var t=document.createElement("div");t.className="slider-wrapper";var n=document.createElement("label");n.className="slider-label",n.textContent="".concat(e.label,":");var i=document.createElement("input");i.type="range",i.className="slider",i.min=e.minValue.toString(),i.max=e.maxValue.toString(),i.step=e.step.toString(),i.value=e.initialValue.toString();var r=document.createElement("span");return r.className="slider-value",r.textContent=e.initialValue.toString(),t.appendChild(n),t.appendChild(i),t.appendChild(r),{wrapper:t,slider:i,labelElement:r}},e.prototype.setSliderValue=function(e,t){this.sliders[e].value=t.toString(),this.sliderValues[e].textContent=t.toString()},e.prototype.addListener=function(e,t){this.sliders[e].addEventListener("change",t)},e}(),Dn=function(){function e(e,t,n){this.container=e,this.graphManager=new Sn(n),this.initializeSliderView(t)}return e.prototype.initializeSliderView=function(e){this.sliderView=e.getView(this.container)},e.prototype.appendGraphToContainer=function(){this.container.appendChild(this.graphManager.getGraphContainer())},e}(),Rn=n(698),Gn=n.n(Rn);class Pn{static _xfnv1a(e){let t=2166136261;for(let n=0;n<e.length;n++)t=Math.imul(t^e.charCodeAt(n),16777619);return()=>(t+=t<<13,t^=t>>>7,t+=t<<3,t^=t>>>17,(t+=t<<5)>>>0)}}class Fn extends Pn{constructor(e){super(),Object.defineProperty(this,"a",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.a=Fn._xfnv1a(e)()}next(){let e=this.a+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}class zn extends Pn{constructor(e){super(),Object.defineProperty(this,"a",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"b",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"c",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"d",{enumerable:!0,configurable:!0,writable:!0,value:void 0});const t=zn._xfnv1a(e);this.a=t(),this.b=t(),this.c=t(),this.d=t()}next(){this.a>>>=0,this.b>>>=0,this.c>>>=0,this.d>>>=0;let e=this.a+this.b|0;return this.a=this.b^this.b>>>9,this.b=this.c+(this.c<<3)|0,this.c=this.c<<21|this.c>>>11,this.d=this.d+1|0,e=e+this.d|0,this.c=this.c+e|0,(e>>>0)/4294967296}}class On extends Pn{constructor(e){super(),Object.defineProperty(this,"a",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"b",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"c",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"d",{enumerable:!0,configurable:!0,writable:!0,value:void 0});const t=On._xfnv1a(e);this.a=t(),this.b=t(),this.c=t(),this.d=t()}next(){const e=this.b<<9;let t=5*this.b;return t=9*(t<<7|t>>>25),this.c^=this.a,this.d^=this.b,this.b^=this.c,this.a^=this.d,this.c^=e,this.d=this.d<<11|this.d>>>21,(t>>>0)/4294967296}}!function(e){e.sfc32="sfc32",e.mulberry32="mulberry32",e.xoshiro128ss="xoshiro128ss"}(kn||(kn={}));class In{constructor(e,t=kn.sfc32){Object.defineProperty(this,"str",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"prng",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"generator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.str=e,this.prng=t,this.generator=this._initializeGenerator()}next(){return this.generator.next()}_initializeGenerator(){if((e=>null===e)(e=this.str)||(e=>void 0===e)(e))return this.wrap();var e;switch(this.prng){case"sfc32":return new zn(this.str);case"mulberry32":return new Fn(this.str);case"xoshiro128ss":return new On(this.str);default:return this.wrap()}}wrap(){return{next:()=>Math.random()}}}var Bn=function(){return Bn=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Bn.apply(this,arguments)},Un=n(739),jn=function(e,t,n){return e.reduce((function(e,i){var r,o=null===(r=t[n])||void 0===r?void 0:r.nodes[i];return o&&e.push.apply(e,o.points),e}),[])},Vn=function(e,t,n){var i=new Set,r=n[e];return t.forEach((function(e){i.add(r[e])})),Array.from(i)},Hn=function(e){var t=1/0,n=1/0,i=-1/0,r=-1/0;return e.forEachNode((function(e,o){var a=o.x,s=o.y;a<t&&(t=a),s<n&&(n=s),a>i&&(i=a),s>r&&(r=s)})),{minX:t,minY:n,maxX:i,maxY:r}},Wn=function(e,t){var n=new(Gn()),i=new In("nodes-".concat(e.nodes.length,"-edges-").concat(e.edges.length));e.nodes.forEach((function(e,t){var r,o;n.addNode(t,Bn(Bn({},e),{x:null!==(r=e.x)&&void 0!==r?r:100*i.next(),y:null!==(o=e.y)&&void 0!==o?o:100*i.next()}))}));var r=e.nodes.length,o=Math.ceil(t*r/2);return e.edges.slice(0,o).forEach((function(e){n.addEdge(e.s,e.t)})),n},qn=function(e){return{label:e.label,minValue:e.minValue,maxValue:e.maxValue,initialValue:e.initialValue,step:e.step}},Zn=function(){return Zn=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Zn.apply(this,arguments)},Yn=function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{h(i.next(e))}catch(e){o(e)}}function s(e){try{h(i.throw(e))}catch(e){o(e)}}function h(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}h((i=i.apply(e,t||[])).next())}))},Xn=function(e,t){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(h){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,h])}}},Kn=function(){function e(e){var t=this;this.views=[],this.selectedNodes=[],this.selectedPoints=[],this.initialLayoutPromise=null;var n=e.graphData,i=e.sliderConfig,r=e.sigmaSettings,o=e.onSelectedNodesChange,a=e.onSelectedPointsChange,s=e.onFullScreenChange,h=e.onCoarsenessChange,u=e.onConnectivityChange,c=e.nodeColors,d=e.nodeLabels,l=e.nodeHoverLabels,f=e.nodeAttrs,p=e.defaultHoverTemplate,g=e.layoutConfig;this.graphData=n,this.sliderConfig=i,this.sigmaSettings=Zn({defaultHoverTemplate:p},r),this.nodeColors=c,this.nodeLabels=d,this.nodeHoverLabels=l,this.nodeAttrs=f,this.defaultHoverTemplate=p,this.layoutConfig=g||{},this.onSelectedNodesChange=o,this.onSelectedPointsChange=a,this.onFullScreenChange=s,this.onCoarsenessChange=h,this.onConnectivityChange=u,this.selectedLevel=this.sliderConfig.selectedLevel,this.sliderManager=new Tn([qn(i.coarseness),qn(i.connectivity)]),this.addSliderListeners(),this.nDataPoints=Math.max.apply(Math,this.graphData[this.selectedLevel].nodes.map((function(e){return Math.max.apply(Math,e.points)})))+1,this.dataPointMaps=function(e,t){var n={};return Object.keys(e).forEach((function(i){n[i]=function(e,t){var n=Array(t);return e.forEach((function(e,t){e.forEach((function(e){n[e]=t}))})),n}(e[i].nodes.map((function(e){return e.points})),t)})),n}(this.graphData,this.nDataPoints),this.currentGraph=Wn(this.graphData[this.selectedLevel],this.sliderConfig.connectivity.initialValue);var v=Zn(Zn({},wn(this.currentGraph)),this.layoutConfig);this.initialLayoutPromise=this.runInitialLayout({iterations:300,settings:Zn(Zn({},v),{warmupLayout:!0})}).then((function(){t.resetAllGraphViews(),t.initialLayoutPromise=null})),this.updateNodeAttributes()}return e.prototype.getView=function(e){return Yn(this,void 0,void 0,(function(){var t,n=this;return Xn(this,(function(i){switch(i.label){case 0:return!this.initialLayoutPromise&&this.animator?[3,2]:[4,this.initialLayoutPromise];case 1:i.sent(),i.label=2;case 2:if(!this.animator)throw Error("Animator does not exist. Cannot get GraphView.");return t=new Dn(e,this.sliderManager,{graph:this.currentGraph,animator:this.animator,mode:nn.inactive,settings:this.sigmaSettings,isFullScreen:!1,neighborHighlightingEnabled:!1,selectedNodes:[],onSelectedNodesChange:function(e){n.selectedNodes=e,n.selectedPoints=jn(n.selectedNodes,n.graphData,n.selectedLevel),n.onSelectedNodesChange(e),n.onSelectedPointsChange(n.selectedPoints)},onFullScreenChange:function(e){return n.onFullScreenChange(e)},onHighlightedNodesChange:function(){}}),this.views.push(t),t.appendGraphToContainer(),this.animator.start(),[4,t.graphManager.resetView()];case 3:return i.sent(),[2,t]}}))}))},e.prototype.deleteView=function(e){this.views=this.views.filter((function(t){return t!==e}))},e.prototype.setConnectivityLevel=function(e){var t=this,n=this.graphData[this.selectedLevel];this.currentGraph.clearEdges();var i=n.nodes.length,r=Math.ceil(e*i/2);n.edges.slice(0,r).forEach((function(e){t.currentGraph.addEdge(e.s,e.t)})),this.resetAnimator()},e.prototype.setCoarsenessLevel=function(e,t){return void 0===t&&(t=!1),Yn(this,void 0,void 0,(function(){var n,i,r;return Xn(this,(function(o){return e==this.selectedLevel||(n=this.selectedPoints,i=this.initializeNewGraph(e),r=Vn(e,n,this.dataPointMaps),this.updateGraphAndViewsWithNewGraph(i,r,t)),[2]}))}))},e.prototype.setNodeColors=function(e){this.nodeColors=e,this.updateNodeColors()},e.prototype.setNodeLabels=function(e){this.nodeLabels=e,this.updateNodeLabels()},e.prototype.setNodeHoverLabels=function(e){this.nodeHoverLabels=e,this.updateNodeHoverLabels()},e.prototype.setNodeAttrs=function(e){this.nodeAttrs=e,this.updateNodeAttributes()},e.prototype.setNodeHoverTemplate=function(e){this.defaultHoverTemplate=e,this.sigmaSettings.defaultHoverTemplate=e,this.updateAllGraphSigmaSettings()},e.prototype.setSelectedNodes=function(e){this.selectedNodes=e,this.selectedPoints=jn(this.selectedNodes,this.graphData,this.selectedLevel),this.updateViewsSelectedNodes(),this.onSelectedNodesChange(this.selectedNodes),this.onSelectedPointsChange(this.selectedPoints)},e.prototype.setSelectedPoints=function(e){this.selectedPoints=e,this.selectedNodes=Vn(this.selectedLevel,e,this.dataPointMaps),this.onSelectedPointsChange(e),this.updateViewsSelectedNodes(),this.onSelectedNodesChange(this.selectedNodes)},e.prototype.resetView=function(){var e=this;this.views.forEach((function(t){return Yn(e,void 0,void 0,(function(){return Xn(this,(function(e){switch(e.label){case 0:return[4,t.graphManager.resetView()];case 1:return e.sent(),[2]}}))}))}))},e.prototype.cleanup=function(){var e;this.views.forEach((function(e){e.graphManager.cleanup()})),null===(e=this.animator)||void 0===e||e.kill()},e.prototype.dispose=function(){var e;this.views.forEach((function(e){e.graphManager.dispose()})),null===(e=this.animator)||void 0===e||e.kill()},e.prototype.initializeNewGraph=function(e){var t=this.dataPointMaps[this.selectedLevel],n=this.currentGraph;this.selectedLevel=e;var i=Number(this.sliderManager.getSliderValue(this.sliderConfig.connectivity.label)),r=Wn(this.graphData[e],i),o=function(e,t){var n=new Array(t.nodes().length);return t.forEachNode((function(t,i){var r=Number(t),o=i.points,a=new Set;o.forEach((function(t){a.add(e[t])})),n[r]=Array.from(a)})),n}(t,r);return function(e,t,n){var i=Hn(e),r=i.minX,o=i.minY,a=i.maxX,s=i.maxY,h=t.order/e.order,u=Math.max(10,a-r)/100,c=Math.max(10,s-o)/100,d=Math.max(u,c);t.updateEachNodeAttributes((function(t,i){var r=Number(t),o=n[r],a=o.map((function(t){try{return e.getNodeAttribute(t,"x")}catch(e){return 0}})),s=o.map((function(t){try{return e.getNodeAttribute(t,"y")}catch(e){return 0}})),u=0,c=a.reduce((function(e,t){return isFinite(t)?(u+=1,e+t):e}),0),l=c/Math.max(u,1),f=0,p=s.reduce((function(e,t){return isFinite(t)?(f+=1,e+t):e}),0),g=p/Math.max(f,1);return Bn(Bn({},i),{x:h*(l+d*Math.random()),y:h*(g+d*Math.random())})}))}(n,r,o),r},e.prototype.updateGraphAndViewsWithNewGraph=function(e,t,n){var i,r=this;console.log("updateGraphAndViewsWithNewGraph"),this.selectedNodes=t,this.onSelectedNodesChange(t);var o=Zn(Zn(Zn({},wn(e)),this.layoutConfig),null===(i=this.animator)||void 0===i?void 0:i.params.settings),a=Hn(e),s=a.maxX-a.minX,h=a.maxY-a.minY,u=this.currentGraph.order,c=e.order;o.scalingRatio=o.scalingRatio*(c/u),function(e,t){return void 0===t&&(t={}),i=function(){var n,i,r,o,a,s,h,u,c,d,l;return function(e,t){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(h){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,h])}}}(this,(function(f){switch(f.label){case 0:return n=Bn(Bn(Bn({},wn(e)),t),{warmupLayout:!0}),i=(0,at.kS)(e).map((function(e){return e.map(Number)})),r=un(e),o=Un.createWorker(st),a={iterations:75,nAnnealingSteps:3,settings:n,nodes:r.nodes.buffer,edges:r.edges.buffer,components:i,__messageId:"initialGraphLayout"},console.log("getStableLayout settings",n),o.postMessage(a,[r.nodes.buffer,r.edges.buffer]),[4,new Promise((function(e){o.onmessage=function(t){e({nodes:new Float32Array(t.data.nodes),settings:t.data.settings}),o.terminate()}}))];case 1:for(s=f.sent(),h=e.nodes().length,u=[],c=0;c<h;c++)d=s.nodes[10*c],l=s.nodes[10*c+1],u.push({x:d,y:l});return[2,{endPositions:u,settings:s.settings}]}}))},new((n=void 0)||(n=Promise))((function(e,t){function r(e){try{a(i.next(e))}catch(e){t(e)}}function o(e){try{a(i.throw(e))}catch(e){t(e)}}function a(t){var i;t.done?e(t.value):(i=t.value,i instanceof n?i:new n((function(e){e(i)}))).then(r,o)}a((i=i.apply(void 0,[])).next())}));var n,i}(e,o).then((function(i){var o,a=i.endPositions,u=i.settings,c=a,d=function(e){var t=1/0,n=1/0,i=-1/0,r=-1/0;return e.forEach((function(e){var o=e.x,a=e.y;o<t&&(t=o),a<n&&(n=a),o>i&&(i=o),a>r&&(r=a)})),{minX:t,minY:n,maxX:i,maxY:r}}(a),l=d.minX,f=d.minY,p=d.maxX,g=d.maxY,v=(p-l)/s,m=(g-f)/h;console.log("settings returned by getStableLayout",u),r.layoutConfig=u,r.updateAllGraphViews(e,t),r.updateNodeAttributes(),r.views.forEach((function(e){e.graphManager.unzoom(Math.max(v,m),500)}));var y=new Nn(r.currentGraph,c,"linear",500);null===(o=r.animator)||void 0===o||o.kill(),y.run((function(){var e=r.getNewAnimator(u);r.animator=e,r.views.forEach((function(t){n&&t.graphManager.resetView(),t.graphManager.updateAnimator(e)})),r.animator.start()}))}))},e.prototype.updateNodeColors=function(){if(this.nodeColors){var e=this.nodeColors[this.selectedLevel];e&&this.currentGraph.updateEachNodeAttributes((function(t,n){var i=Number(t),r=e[i];return Zn(Zn({},n),{color:r||n.color})}))}},e.prototype.updateNodeLabels=function(){if(this.nodeLabels){var e=this.nodeLabels[this.selectedLevel];e&&this.currentGraph.updateEachNodeAttributes((function(t,n){var i=Number(t),r=e[i];return Zn(Zn({},n),{label:r||n.label})}))}},e.prototype.updateNodeHoverLabels=function(){if(this.nodeHoverLabels){var e=this.nodeHoverLabels[this.selectedLevel];e&&this.currentGraph.updateEachNodeAttributes((function(t,n){var i=Number(t),r=e[i];return Zn(Zn({},n),{labelToDisplay:r||n.labelToDisplay})}))}},e.prototype.updateViewsSelectedNodes=function(){var e=this;this.views.forEach((function(t){t.graphManager.setSelectedNodes(e.selectedNodes,!1)}))},e.prototype.updateNodeAttributes=function(){if(this.updateNodeColors(),this.updateNodeLabels(),this.updateNodeHoverLabels(),this.nodeAttrs){var e=this.nodeAttrs[this.selectedLevel];e&&this.currentGraph.updateEachNodeAttributes((function(t,n){var i=Number(t),r=e[i];return Zn(Zn({},n),r||{})}))}},e.prototype.runInitialLayout=function(e){return Yn(this,void 0,void 0,(function(){var t;return Xn(this,(function(n){switch(n.label){case 0:return[4,pn(this.currentGraph,e)];case 1:return t=n.sent(),console.log("runInitialLayout returned settings",t),this.animator&&this.animator.kill(),this.animator=this.getNewAnimator(),this.animator.params.settings=t,this.layoutConfig=t,this.animator.forceNodePositionUpdate(),this.startAnimator(),[2]}}))}))},e.prototype.resetAnimator=function(){var e;null===(e=this.animator)||void 0===e||e.kill(),this.animator=this.getNewAnimator(),this.startAnimator()},e.prototype.startAnimator=function(){if(this.animator){this.animator.start();var e=this.animator;this.views.forEach((function(t){t.graphManager.updateAnimator(e)}))}},e.prototype.getNewAnimator=function(e){var t;return new dn(this.currentGraph,{settings:Zn(Zn(Zn(Zn({},wn(this.currentGraph)),this.layoutConfig),null===(t=this.animator)||void 0===t?void 0:t.params.settings),e||{})},{maxiters:1500,miniters:200,convergenceThreshold:.1})},e.prototype.addSliderListeners=function(){var e=this;this.sliderManager.addListener(this.sliderConfig.coarseness.label,(function(t){return Yn(e,void 0,void 0,(function(){return Xn(this,(function(e){switch(e.label){case 0:return[4,this.handleCoarsenessChange(t)];case 1:return e.sent(),this.onCoarsenessChange(t),[2]}}))}))})),this.sliderManager.addListener(this.sliderConfig.connectivity.label,(function(t){e.handleConnectivityChange(t),e.onConnectivityChange(t)}))},e.prototype.handleCoarsenessChange=function(e){return Yn(this,void 0,void 0,(function(){return Xn(this,(function(t){switch(t.label){case 0:return[4,this.setCoarsenessLevel(e.toString())];case 1:return t.sent(),[2]}}))}))},e.prototype.handleConnectivityChange=function(e){this.setConnectivityLevel(e)},e.prototype.updateAllGraphViews=function(e,t){this.currentGraph=e,this.views.forEach((function(t){t.graphManager.updateGraph(e)})),this.selectedNodes=t,this.updateViewsSelectedNodes()},e.prototype.updateAllGraphSigmaSettings=function(){var e=this;this.views.forEach((function(t){t.graphManager.updateSigmaSettings(e.sigmaSettings)}))},e.prototype.resetAllGraphViews=function(){this.views.forEach((function(e){e.graphManager.resetView()}))},e}()})(),i})(),e.exports=t()},364:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n,i,r,o=e[1]||"",a=e[3];if(!a)return o;if(t&&"function"==typeof btoa){var s=(n=a,i=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),"/*# ".concat(r," */")),h=a.sources.map((function(e){return"/*# sourceURL=".concat(a.sourceRoot||"").concat(e," */")}));return[o].concat(h).concat([s]).join("\n")}return[o].join("\n")}(t,e);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,i){"string"==typeof e&&(e=[[null,e,""]]);var r={};if(i)for(var o=0;o<this.length;o++){var a=this[o][0];null!=a&&(r[a]=!0)}for(var s=0;s<e.length;s++){var h=[].concat(e[s]);i&&r[h[0]]||(n&&(h[2]?h[2]="".concat(n," and ").concat(h[2]):h[2]=n),t.push(h))}},t}},463:(e,t,n)=>{var i=n(72),r=n(930);"string"==typeof(r=r.__esModule?r.default:r)&&(r=[[e.id,r,""]]);i(r,{insert:"head",singleton:!1}),e.exports=r.locals||{}},356:(e,t,n)=>{var i=n(72),r=n(969);"string"==typeof(r=r.__esModule?r.default:r)&&(r=[[e.id,r,""]]);i(r,{insert:"head",singleton:!1}),e.exports=r.locals||{}},72:(e,t,n)=>{"use strict";var i,r=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),o=[];function a(e){for(var t=-1,n=0;n<o.length;n++)if(o[n].identifier===e){t=n;break}return t}function s(e,t){for(var n={},i=[],r=0;r<e.length;r++){var s=e[r],h=t.base?s[0]+t.base:s[0],u=n[h]||0,c="".concat(h," ").concat(u);n[h]=u+1;var d=a(c),l={css:s[1],media:s[2],sourceMap:s[3]};-1!==d?(o[d].references++,o[d].updater(l)):o.push({identifier:c,updater:g(l,t),references:1}),i.push(c)}return i}function h(e){var t=document.createElement("style"),i=e.attributes||{};if(void 0===i.nonce){var o=n.nc;o&&(i.nonce=o)}if(Object.keys(i).forEach((function(e){t.setAttribute(e,i[e])})),"function"==typeof e.insert)e.insert(t);else{var a=r(e.insert||"head");if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(t)}return t}var u,c=(u=[],function(e,t){return u[e]=t,u.filter(Boolean).join("\n")});function d(e,t,n,i){var r=n?"":i.media?"@media ".concat(i.media," {").concat(i.css,"}"):i.css;if(e.styleSheet)e.styleSheet.cssText=c(t,r);else{var o=document.createTextNode(r),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(o,a[t]):e.appendChild(o)}}function l(e,t,n){var i=n.css,r=n.media,o=n.sourceMap;if(r?e.setAttribute("media",r):e.removeAttribute("media"),o&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),e.styleSheet)e.styleSheet.cssText=i;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(i))}}var f=null,p=0;function g(e,t){var n,i,r;if(t.singleton){var o=p++;n=f||(f=h(t)),i=d.bind(null,n,o,!1),r=d.bind(null,n,o,!0)}else n=h(t),i=l.bind(null,n,t),r=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)};return i(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;i(e=t)}else r()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=(void 0===i&&(i=Boolean(window&&document&&document.all&&!window.atob)),i));var n=s(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var i=0;i<n.length;i++){var r=a(n[i]);o[r].references--}for(var h=s(e,t),u=0;u<n.length;u++){var c=a(n[u]);0===o[c].references&&(o[c].updater(),o.splice(c,1))}n=h}}}},55:t=>{"use strict";t.exports=e},330:e=>{"use strict";e.exports=JSON.parse('{"name":"landscape-widget","version":"0.4.0-rc.2","description":"Jupyter widget for interactive graph visualization","keywords":["jupyter","jupyterlab","jupyterlab-extension","widgets"],"files":["lib/**/*.js","dist/*.js","css/*.css"],"author":{"name":"BlueLightAI","email":"support@bluelightai.com"},"license":"SEE LICENSE IN LICENSE.txt","main":"lib/index.js","types":"./lib/index.d.ts","repository":{"type":"git","url":"https://github.com/BlueLightAI/jupyter-landscapes"},"scripts":{"build":"yarn run build:lib && yarn run build:nbextension && yarn run build:labextension:dev","build:prod":"yarn run build:lib && yarn run build:nbextension && yarn run build:labextension","build:labextension":"jupyter labextension build .","build:labextension:dev":"jupyter labextension build --development True .","build:lib":"tsc","build:nbextension":"webpack","build:license-report-json":"license-report --output=json --config=.license-reportrc > ./license-report.json","build:license-report-html":"license-report --output=html --config=.license-reportrc > ./license-report.html","build-all":"node build.js","clean":"yarn run clean:lib && yarn run clean:nbextension && yarn run clean:labextension","clean:lib":"rimraf lib","clean:labextension":"rimraf landscape_widget/labextension","clean:nbextension":"rimraf landscape_widget/nbextension/static/index.js","lint":"eslint . --ext .ts,.tsx --fix","lint:check":"eslint . --ext .ts,.tsx","prepack":"yarn run build:lib","test":"jest","watch":"npm-run-all -p watch:*","watch:lib":"tsc -w","watch:nbextension":"webpack --watch --mode=development","watch:labextension":"jupyter labextension watch ."},"dependencies":{"@jupyter-widgets/base":"^1.1.10 || ^2 || ^3 || ^4 || ^5 || ^6","blai-graph-widget":"link:./blai-graph-widget","lodash":"^4.17.21","rand-seed":"^1.0.2","ws":"^7.5.10 || ^8.17.1 || >=9"},"devDependencies":{"@babel/core":"^7.5.0","@babel/preset-env":"^7.5.0","@jupyter-widgets/base-manager":"^1.0.3","@jupyterlab/builder":"^4.3.3","@lumino/application":"^1.6.0","@lumino/widgets":"^1.6.0","@types/jest":"^26.0.0","@types/webpack-env":"^1.13.6","@typescript-eslint/eslint-plugin":"^3.6.0","@typescript-eslint/parser":"^3.6.0","acorn":"^7.2.0","css-loader":"^3.2.0","eslint":"^7.4.0","eslint-config-prettier":"^6.11.0","eslint-plugin-prettier":"^3.1.4","fs-extra":"^7.0.0","identity-obj-proxy":"^3.0.0","jest":"^29.0.0","license-report":"^6.5.0","mkdirp":"^0.5.1","npm-run-all":"^4.1.3","prettier":"^2.0.5","rimraf":"^2.6.2","sass":"^1.58.0","sass-loader":"^13.2.0","source-map-loader":"^1.1.3","style-loader":"^1.0.0","ts-jest":"^29.0.0","ts-loader":"^8.0.0","typescript":"^5.7.2","webpack":"^5.61.0","webpack-cli":"^4.0.0"},"resolutions":{"blai-graph-widget":"file:./blai-graph-widget"},"jupyterlab":{"extension":"lib/plugin","outputDir":"landscape_widget/labextension/","webpackConfig":"./lab.webpack.config.js","sharedPackages":{"@jupyter-widgets/base":{"bundled":false,"singleton":true}}}}')}},n={};function i(e){var r=n[e];if(void 0!==r)return r.exports;var o=n[e]={id:e,exports:{}};return t[e].call(o.exports,o,o.exports,i),o.exports}i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.nc=void 0;var r={};return(()=>{"use strict";i.r(r),i.d(r,{LandscapeModel:()=>b,LandscapeView:()=>w,MODULE_NAME:()=>n,MODULE_VERSION:()=>t});const e=i(330),t=e.version,n=e.name;var o=i(55);const a={0:{nodes:[{points:[0],size:4},{points:[1],size:4},{points:[2],size:4},{points:[3],size:4}],edges:[{s:0,t:1,w:1},{s:1,t:2,w:.75},{s:2,t:3,w:.5},{s:0,t:3,w:.25}]},1:{nodes:[{points:[0,1],size:4},{points:[2,3],size:4}],edges:[{s:0,t:1,w:1}]},2:{nodes:[{points:[0,1,2,3],size:4}],edges:[]}};i(463);var s=i(858),h=(i(356),function(e,t){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},h(e,t)});function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}h(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var c,d=function(){function e(){}return e._xfnv1a=function(e){for(var t=2166136261,n=0;n<e.length;n++)t=Math.imul(t^e.charCodeAt(n),16777619);return function(){return t+=t<<13,t^=t>>>7,t+=t<<3,t^=t>>>17,(t+=t<<5)>>>0}},e}(),l=function(e){function t(n){var i=e.call(this)||this;return i.a=t._xfnv1a(n)(),i}return u(t,e),t.prototype.next=function(){var e=this.a+=1831565813;return e=Math.imul(e^e>>>15,1|e),(((e^=e+Math.imul(e^e>>>7,61|e))^e>>>14)>>>0)/4294967296},t}(d),f=function(e){function t(n){var i=e.call(this)||this,r=t._xfnv1a(n);return i.a=r(),i.b=r(),i.c=r(),i.d=r(),i}return u(t,e),t.prototype.next=function(){this.a>>>=0,this.b>>>=0,this.c>>>=0,this.d>>>=0;var e=this.a+this.b|0;return this.a=this.b^this.b>>>9,this.b=this.c+(this.c<<3)|0,this.c=this.c<<21|this.c>>>11,this.d=this.d+1|0,e=e+this.d|0,this.c=this.c+e|0,(e>>>0)/4294967296},t}(d),p=function(e){function t(n){var i=e.call(this)||this,r=t._xfnv1a(n);return i.a=r(),i.b=r(),i.c=r(),i.d=r(),i}return u(t,e),t.prototype.next=function(){var e=this.b<<9,t=5*this.a;return t=t<<7|9*(t>>>25),this.c^=this.a,this.d^=this.b,this.b^=this.c,this.a^=this.d,this.c^=e,this.d=this.d<<11|this.d>>>21,(t>>>0)/4294967296},t}(d);!function(e){e.sfc32="sfc32",e.mulberry32="mulberry32",e.xoshiro128ss="xoshiro128ss"}(c||(c={}));var g=function(){function e(e,t){void 0===t&&(t=c.sfc32),this.str=e,this.prng=t,this.generator=this._initializeGenerator()}return e.prototype.next=function(){return this.generator.next()},e.prototype._initializeGenerator=function(){if(function(e){return null===e}(e=this.str)||function(e){return void 0===e}(e))return this.wrap();var e;switch(this.prng){case"sfc32":return new f(this.str);case"mulberry32":return new l(this.str);case"xoshiro128ss":return new p(this.str);default:return this.wrap()}},e.prototype.wrap=function(){return{next:function(){return Math.random()}}},e}(),v=function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{h(i.next(e))}catch(e){o(e)}}function s(e){try{h(i.throw(e))}catch(e){o(e)}}function h(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}h((i=i.apply(e,t||[])).next())}))};const m={allowInvalidContainer:!0,zoomToSizeRatioFunction:e=>e>1.5?Math.sqrt(1.5*e):e},y={adjustSizes:!0};class b extends o.DOMWidgetModel{initialize(e,t){super.initialize(e,t),this.on("change:colors",this.updateNodeColors,this),this.on("change:node_labels",this.updateNodeLabels,this),this.on("change:node_hover_labels",this.updateNodeHoverLabels,this),this.on("change:node_attrs",this.updateNodeAttrs,this),this.on("change:rich_node_hover_template",this.updateHoverTemplate,this),this.on("change:selected_level",this.updateSelectedLevel,this),this.on("change:avg_degree",this.updateAvgDegree,this),this.on("change:selected_points",this.updateSelectedPoints,this),this.on("msg:custom",this.handleCustomMessage,this),this.loadGraph()}loadGraph(){return v(this,void 0,void 0,(function*(){const e=this.get("graph"),t=this.get("node_labels"),n=this.get("node_hover_labels"),i=Object.keys(e).map(Number),r=Math.min(...i),o=Math.max(...i),a=this.get("selected_level")||Math.floor((r+o)/2),h={coarseness:{label:"Coarseness",minValue:r,maxValue:o,initialValue:a,step:1},connectivity:{label:"Connectivity",minValue:0,maxValue:20,initialValue:this.get("avg_degree")||6,step:.1},selectedLevel:a.toString()},u=this.get("layout").attributes||{},c={};if(u.width&&u.height){const e=String(u.width),t=String(u.height);if(e.endsWith("px")&&t.endsWith("px")){const n=Number(e.slice(0,e.length-2)),i=Number(t.slice(0,t.length-2));c.expectedDims=[n,i]}}this.multiResolutionGraph=new s.MultiResolutionGraph({graphData:e,sliderConfig:h,sigmaSettings:Object.assign(Object.assign({},m),this.get("sigma_settings")||{}),onSelectedNodesChange:()=>{},onSelectedPointsChange:this.setSelectedPoints.bind(this),onFullScreenChange:this.toggleExpandedLayout.bind(this),onCoarsenessChange:this.setCoarsenessLevel.bind(this),onConnectivityChange:this.setConnectivityLevel.bind(this),nodeLabels:t,nodeHoverLabels:n,layoutConfig:Object.assign(Object.assign({adjustSizes:!0},c),this.get("layout_config"))}),this.updateNodeProperties(),this.updateHoverTemplate()}))}updateNodeProperties(){this.updateNodeColors(),this.updateNodeLabels(),this.updateNodeHoverLabels(),this.updateNodeAttrs()}setSelectedPoints(e){this.set("selected_points",e),this.save_changes()}toggleExpandedLayout(e){this.set("is_expanded_layout",e),this.save_changes()}setCoarsenessLevel(e){this.set("selected_level",e),this.save_changes()}setConnectivityLevel(e){this.set("avg_degree",e),this.save_changes()}updateNodeColors(){if(!this.multiResolutionGraph)return;const e=this.get("colors");e&&this.multiResolutionGraph.setNodeColors(e)}updateNodeLabels(){if(!this.multiResolutionGraph)return;const e=this.get("node_labels");e&&this.multiResolutionGraph.setNodeLabels(e)}updateNodeHoverLabels(){if(!this.multiResolutionGraph)return;const e=this.get("node_hover_labels");e&&this.multiResolutionGraph.setNodeHoverLabels(e)}updateNodeAttrs(){if(!this.multiResolutionGraph)return;const e=this.get("node_attrs");e&&this.multiResolutionGraph.setNodeAttrs(e)}updateHoverTemplate(){if(!this.multiResolutionGraph)return;const e=this.get("rich_node_hover_template");e&&this.multiResolutionGraph.setNodeHoverTemplate(e)}updateSelectedLevel(){return v(this,void 0,void 0,(function*(){if(!this.multiResolutionGraph)return;const e=this.get("selected_level");e&&String(e)!==String(this.multiResolutionGraph.selectedLevel)&&(yield this.multiResolutionGraph.setCoarsenessLevel(e),this.multiResolutionGraph.sliderManager.setSliderValue("Coarseness",e))}))}updateAvgDegree(){if(!this.multiResolutionGraph)return;const e=this.get("avg_degree");(e||0===e)&&(this.multiResolutionGraph.setConnectivityLevel(e),this.multiResolutionGraph.sliderManager.setSliderValue("Connectivity",e))}updateSelectedPoints(){if(!this.multiResolutionGraph)return;const e=this.get("selected_points");e&&this.multiResolutionGraph.setSelectedPoints(e)}disposeGraph(){this.multiResolutionGraph.cleanup(),this.multiResolutionGraph.dispose()}resetView(){this.multiResolutionGraph.resetView()}handleCustomMessage(e){"dispose_graph"===e.event_type?this.disposeGraph():"reset_view"===e.event_type&&this.resetView()}defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:b.model_name,_model_module:b.model_module,_model_module_version:b.model_module_version,_view_name:b.view_name,_view_module:b.view_module,_view_module_version:b.view_module_version,graph:a,colors:null,node_labels:null,node_hover_labels:null,node_sizes:null,selected_nodes:[],sigma_settings:m,background_color:null,is_expanded_layout:!1,layout_settings:y})}}b.serializers=Object.assign({},o.DOMWidgetModel.serializers),b.model_name="LandscapeModel",b.model_module=n,b.model_module_version=t,b.view_name="LandscapeView",b.view_module=n,b.view_module_version=t;class w extends o.DOMWidgetView{constructor(e){super(e),this.view=null;const t=new g;this.containerId=`landscape-container-${t.next().toString(36).substring(2)}`}render(){this.createLandscapeContainer(),this.setupGraphManager(),this.model.on("change:background_color",this.setBackgroundColor,this)}createLandscapeContainer(){this._landscapeContainer=document.createElement("div"),this._landscapeContainer.id=this.containerId,this._landscapeContainer.style.position="relative",this._landscapeContainer.classList.add("landscape-container"),this.setBackgroundColor(),this.el.appendChild(this._landscapeContainer),this.el.classList.add("custom-widget")}setupGraphManager(){return v(this,void 0,void 0,(function*(){const e=document.getElementById(this.containerId);e&&this.model.multiResolutionGraph?(this.view=yield this.model.multiResolutionGraph.getView(e),yield this.view.graphManager.resetView()):setTimeout((()=>this.setupGraphManager()),100)}))}setBackgroundColor(){const e=this.model.get("background_color");e&&(this.el.style.backgroundColor=e,this._landscapeContainer.style.backgroundColor=e,this._landscapeContainer.style.setProperty("--sigma-background-color",e))}remove(){return console.log("LandscapeView.remove() called, id",this.containerId),this.view&&(this.view.graphManager.cleanup(),this.view.graphManager.dispose(),this.model.multiResolutionGraph&&(this.model.multiResolutionGraph.deleteView(this.view),this.model.multiResolutionGraph.sliderManager.deleteView(this.view.sliderView))),super.remove()}}})(),r})()));
|
|
1
|
+
define("landscape-widget",["@jupyter-widgets/base"],(e=>(()=>{var t={930:(e,t,n)=>{(t=n(364)(!1)).push([e.id,".custom-widget {\n padding: 5px;\n}\n\n.landscape-container {\n height: 100%;\n width: 100%;\n}\n",""]),e.exports=t},969:(e,t,n)=>{(t=n(364)(!1)).push([e.id,".graph-container .controls-container>button{display:flex;justify-content:center;align-items:center;border-radius:4px;border:none;margin:0 4px 0 0;padding:0;background-color:#e2e4e7}.graph-container .controls-container>button:hover{background-color:#cbcdd0}.graph-container .controls-container>button.active{background-color:#bddde8}.graph-container .controls-container>button[data-tooltip]:before{position:absolute;display:none;pointer-events:none;transition:opacity .3s;content:attr(data-tooltip);background-color:#33455f;color:#fff;font-size:1rem;line-height:1.4;border-radius:4px;padding:4px 8px;max-width:300px;margin-bottom:14px;white-space:nowrap;font-weight:500;bottom:100%}.graph-container .controls-container>button[data-tooltip]:hover:before{display:block}.graph-container .controls-container>button[data-tooltip]:last-of-type:before{left:100%;transform:translateX(-100%)}.graph-container .webgl-overlay{font-size:20px;text-align:center;opacity:.9}.graph-container .webgl-overlay>button{font-size:16px;background-color:#007bff;color:#fff;border:none;border-radius:4px}.slider-container{position:absolute;top:0;width:490px;display:flex;border:1px solid #d3d3d3;border-radius:4px;height:40px;box-sizing:border-box}.slider-container .slider-wrapper{display:flex;align-items:center;padding:0 5px}.slider-container .slider-wrapper .slider-label{margin:0;font-size:14px}.slider-container .slider-wrapper .slider{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:110px;height:4px;margin-right:10px;margin-left:5px;border-radius:4px;background:#2196f3;outline:none;cursor:pointer}.slider-container .slider-wrapper .slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:16px;height:16px;background:#2196f3;border-radius:50%}.slider-container .slider-wrapper .slider::-moz-range-thumb{width:16px;height:16px;background:#2196f3;border-radius:50%;border:none}.slider-container .slider-wrapper .slider:hover::-webkit-slider-thumb{background:#1976d2}.slider-container .slider-wrapper .slider:hover::-moz-range-thumb{background:#1976d2}.slider-container .slider-wrapper .slider:hover::-ms-thumb{background:#1976d2}.slider-container .slider-wrapper .slider:active::-webkit-slider-thumb{background:#0d47a1}.slider-container .slider-wrapper .slider:active::-moz-range-thumb{background:#0d47a1}.slider-container .slider-wrapper .slider:active::-ms-thumb{background:#0d47a1}.slider-container .slider-wrapper .slider-value{min-width:20px;text-align:center}\n",""]),e.exports=t},858:function(e){var t;t=()=>(()=>{var e={187:e=>{"use strict";var t,n="object"==typeof Reflect?Reflect:null,i=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var r=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(n,i){function r(n){e.removeListener(t,o),i(n)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",r),n([].slice.call(arguments))}g(e,t,o,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&g(e,"error",t,{once:!0})}(e,r)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var a=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function h(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function u(e,t,n,i){var r,o,a,u;if(s(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),a=o[t]),void 0===a)a=o[t]=n,++e._eventsCount;else if("function"==typeof a?a=o[t]=i?[n,a]:[a,n]:i?a.unshift(n):a.push(n),(r=h(e))>0&&a.length>r&&!a.warned){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=a.length,u=c,console&&console.warn&&console.warn(u)}return e}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=c.bind(i);return r.listener=n,i.wrapFn=r,r}function l(e,t,n){var i=e._events;if(void 0===i)return[];var r=i[t];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(r):p(r,r.length)}function f(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function p(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e[i];return n}function g(e,t,n,i){if("function"==typeof e.on)i.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function r(o){i.once&&e.removeEventListener(t,r),n(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");a=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return h(this)},o.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,o=this._events;if(void 0!==o)r=r&&void 0===o.error;else if(!r)return!1;if(r){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var h=o[e];if(void 0===h)return!1;if("function"==typeof h)i(h,this,t);else{var u=h.length,c=p(h,u);for(n=0;n<u;++n)i(c[n],this,t)}return!0},o.prototype.addListener=function(e,t){return u(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return u(this,e,t,!0)},o.prototype.once=function(e,t){return s(t),this.on(e,d(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,d(this,e,t)),this},o.prototype.removeListener=function(e,t){var n,i,r,o,a;if(s(t),void 0===(i=this._events))return this;if(void 0===(n=i[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(r=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){a=n[o].listener,r=o;break}if(r<0)return this;0===r?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,r),1===n.length&&(i[e]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",e,a||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,n,i;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var r,o=Object.keys(n);for(i=0;i<o.length;++i)"removeListener"!==(r=o[i])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},o.prototype.listeners=function(e){return l(this,e,!0)},o.prototype.rawListeners=function(e){return l(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},o.prototype.listenerCount=f,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},803:(e,t,n)=>{var i=n(186),r=(n(212).B,n(325).De,n(341));t.kS=function(e){var t=[];return function(e,t){if(!i(e))throw new Error("graphology-components: the given graph is not a valid graphology instance.");if(e.order){var n=new r(e),o=n.push.bind(n);n.forEachNodeYetUnseen((function(i){var r,a=[];for(n.push(i);0!==n.size;)r=n.pop(),a.push(r),e.forEachNeighbor(r,o);t(a)}))}}(e,(function(e){t.push(e)})),t}},341:e=>{function t(e){this.graph=e,this.stack=new Array(e.order),this.seen=new Set,this.size=0}t.prototype.hasAlreadySeenEverything=function(){return this.seen.size===this.graph.order},t.prototype.countUnseenNodes=function(){return this.graph.order-this.seen.size},t.prototype.forEachNodeYetUnseen=function(e){var t=this.seen,n=this.graph;n.someNode((function(i,r){return t.size===n.order||!t.has(i)&&!!e(i,r)}))},t.prototype.has=function(e){return this.seen.has(e)},t.prototype.push=function(e){var t=this.seen.size;return this.seen.add(e),t!==this.seen.size&&(this.stack[this.size++]=e,!0)},t.prototype.pushWith=function(e,t){var n=this.seen.size;return this.seen.add(e),n!==this.seen.size&&(this.stack[this.size++]=t,!0)},t.prototype.pop=function(){if(0!==this.size)return this.stack[--this.size]},e.exports=t},847:e=>{e.exports={linLogMode:!1,outboundAttractionDistribution:!1,adjustSizes:!1,edgeWeightInfluence:1,scalingRatio:1,strongGravityMode:!1,gravity:1,slowDown:1,barnesHutOptimize:!1,barnesHutTheta:.5}},739:(e,t)=>{t.assign=function(e){e=e||{};var t,n,i,r=Array.prototype.slice.call(arguments).slice(1);for(t=0,i=r.length;t<i;t++)if(r[t])for(n in r[t])e[n]=r[t][n];return e},t.validateSettings=function(e){return"linLogMode"in e&&"boolean"!=typeof e.linLogMode?{message:"the `linLogMode` setting should be a boolean."}:"outboundAttractionDistribution"in e&&"boolean"!=typeof e.outboundAttractionDistribution?{message:"the `outboundAttractionDistribution` setting should be a boolean."}:"adjustSizes"in e&&"boolean"!=typeof e.adjustSizes?{message:"the `adjustSizes` setting should be a boolean."}:"edgeWeightInfluence"in e&&"number"!=typeof e.edgeWeightInfluence?{message:"the `edgeWeightInfluence` setting should be a number."}:!("scalingRatio"in e)||"number"==typeof e.scalingRatio&&e.scalingRatio>=0?"strongGravityMode"in e&&"boolean"!=typeof e.strongGravityMode?{message:"the `strongGravityMode` setting should be a boolean."}:!("gravity"in e)||"number"==typeof e.gravity&&e.gravity>=0?"slowDown"in e&&!("number"==typeof e.slowDown||e.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in e&&"boolean"!=typeof e.barnesHutOptimize?{message:"the `barnesHutOptimize` setting should be a boolean."}:!("barnesHutTheta"in e)||"number"==typeof e.barnesHutTheta&&e.barnesHutTheta>=0?null:{message:"the `barnesHutTheta` setting should be a number >= 0."}:{message:"the `gravity` setting should be a number >= 0."}:{message:"the `scalingRatio` setting should be a number >= 0."}},t.graphToByteArrays=function(e,t){var n,i=e.order,r=e.size,o={},a=new Float32Array(10*i),s=new Float32Array(3*r);return n=0,e.forEachNode((function(e,t){o[e]=n,a[n]=t.x,a[n+1]=t.y,a[n+2]=0,a[n+3]=0,a[n+4]=0,a[n+5]=0,a[n+6]=1,a[n+7]=1,a[n+8]=t.size||1,a[n+9]=t.fixed?1:0,n+=10})),n=0,e.forEachEdge((function(e,i,r,h,u,c,d){var l=o[r],f=o[h],p=t(e,i,r,h,u,c,d);a[l+6]+=p,a[f+6]+=p,s[n]=l,s[n+1]=f,s[n+2]=p,n+=3})),{nodes:a,edges:s}},t.assignLayoutChanges=function(e,t,n){var i=0;e.updateEachNodeAttributes((function(e,r){return r.x=t[i],r.y=t[i+1],i+=10,n?n(e,r):r}))},t.readGraphPositions=function(e,t){var n=0;e.forEachNode((function(e,i){t[n]=i.x,t[n+1]=i.y,n+=10}))},t.collectLayoutChanges=function(e,t,n){for(var i=e.nodes(),r={},o=0,a=0,s=t.length;o<s;o+=10){if(n){var h=Object.assign({},e.getNodeAttributes(i[a]));h.x=t[o],h.y=t[o+1],h=n(i[a],h),r[i[a]]={x:h.x,y:h.y}}else r[i[a]]={x:t[o],y:t[o+1]};a++}return r},t.createWorker=function(e){var t=window.URL||window.webkitURL,n=e.toString(),i=t.createObjectURL(new Blob(["("+n+").call(this);"],{type:"text/javascript"})),r=new Worker(i);return t.revokeObjectURL(i),r}},325:(e,t)=>{t.De=function(e,t,n,i,r,o){return o=Object.assign({},o),t?null==n?e.addUndirectedEdge(i,r,o):e.addUndirectedEdgeWithKey(n,i,r,o):null==n?e.addDirectedEdge(i,r,o):e.addDirectedEdgeWithKey(n,i,r,o)}},212:(e,t)=>{t.B=function(e,t,n){return n=Object.assign({},n),e.addNode(t,n)}},186:e=>{e.exports=function(e){return null!==e&&"object"==typeof e&&"function"==typeof e.addUndirectedEdgeWithKey&&"function"==typeof e.dropNode&&"boolean"==typeof e.multi}},698:function(e){e.exports=function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,i(e,t)}function n(e){return n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},n(e)}function i(e,t){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},i(e,t)}function r(e,t,n){return r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&i(o,n.prototype),o},r.apply(null,arguments)}function o(e){var t="function"==typeof Map?new Map:void 0;return o=function(e){if(null===e||(o=e,-1===Function.toString.call(o).indexOf("[native code]")))return e;var o;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,a)}function a(){return r(e,arguments,n(this).constructor)}return a.prototype=Object.create(e.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),i(a,e)},o(e)}function a(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var s=function(){for(var e=arguments[0],t=1,n=arguments.length;t<n;t++)if(arguments[t])for(var i in arguments[t])e[i]=arguments[t][i];return e};function h(e,t,n,i){var r=e._nodes.get(t),o=null;return r?o="mixed"===i?r.out&&r.out[n]||r.undirected&&r.undirected[n]:"directed"===i?r.out&&r.out[n]:r.undirected&&r.undirected[n]:o}function u(t){return"object"===e(t)&&null!==t}function c(e){var t;for(t in e)return!1;return!0}function d(e,t,n){Object.defineProperty(e,t,{enumerable:!1,configurable:!1,writable:!0,value:n})}function l(e,t,n){var i={enumerable:!0,configurable:!0};"function"==typeof n?i.get=n:(i.value=n,i.writable=!1),Object.defineProperty(e,t,i)}function f(e){return!(!u(e)||e.attributes&&!Array.isArray(e.attributes))}"function"==typeof Object.assign&&(s=Object.assign);var p,g={exports:{}},v="object"==typeof Reflect?Reflect:null,m=v&&"function"==typeof v.apply?v.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};p=v&&"function"==typeof v.ownKeys?v.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var y=Number.isNaN||function(e){return e!=e};function b(){b.init.call(this)}g.exports=b,g.exports.once=function(e,t){return new Promise((function(n,i){function r(n){e.removeListener(t,o),i(n)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",r),n([].slice.call(arguments))}A(e,t,o,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&A(e,"error",t,{once:!0})}(e,r)}))},b.EventEmitter=b,b.prototype._events=void 0,b.prototype._eventsCount=0,b.prototype._maxListeners=void 0;var w=10;function x(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function C(e){return void 0===e._maxListeners?b.defaultMaxListeners:e._maxListeners}function _(e,t,n,i){var r,o,a,s;if(x(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),a=o[t]),void 0===a)a=o[t]=n,++e._eventsCount;else if("function"==typeof a?a=o[t]=i?[n,a]:[a,n]:i?a.unshift(n):a.push(n),(r=C(e))>0&&a.length>r&&!a.warned){a.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=e,h.type=t,h.count=a.length,s=h,console&&console.warn&&console.warn(s)}return e}function E(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function k(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=E.bind(i);return r.listener=n,i.wrapFn=r,r}function S(e,t,n){var i=e._events;if(void 0===i)return[];var r=i[t];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(r):N(r,r.length)}function L(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function N(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e[i];return n}function A(e,t,n,i){if("function"==typeof e.on)i.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function r(o){i.once&&e.removeEventListener(t,r),n(o)}))}}function T(e){if("function"!=typeof e)throw new Error("obliterator/iterator: expecting a function!");this.next=e}Object.defineProperty(b,"defaultMaxListeners",{enumerable:!0,get:function(){return w},set:function(e){if("number"!=typeof e||e<0||y(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");w=e}}),b.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},b.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||y(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},b.prototype.getMaxListeners=function(){return C(this)},b.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i="error"===e,r=this._events;if(void 0!==r)i=i&&void 0===r.error;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var s=r[e];if(void 0===s)return!1;if("function"==typeof s)m(s,this,t);else{var h=s.length,u=N(s,h);for(n=0;n<h;++n)m(u[n],this,t)}return!0},b.prototype.addListener=function(e,t){return _(this,e,t,!1)},b.prototype.on=b.prototype.addListener,b.prototype.prependListener=function(e,t){return _(this,e,t,!0)},b.prototype.once=function(e,t){return x(t),this.on(e,k(this,e,t)),this},b.prototype.prependOnceListener=function(e,t){return x(t),this.prependListener(e,k(this,e,t)),this},b.prototype.removeListener=function(e,t){var n,i,r,o,a;if(x(t),void 0===(i=this._events))return this;if(void 0===(n=i[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(r=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){a=n[o].listener,r=o;break}if(r<0)return this;0===r?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,r),1===n.length&&(i[e]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",e,a||t)}return this},b.prototype.off=b.prototype.removeListener,b.prototype.removeAllListeners=function(e){var t,n,i;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var r,o=Object.keys(n);for(i=0;i<o.length;++i)"removeListener"!==(r=o[i])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},b.prototype.listeners=function(e){return S(this,e,!0)},b.prototype.rawListeners=function(e){return S(this,e,!1)},b.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):L.call(e,t)},b.prototype.listenerCount=L,b.prototype.eventNames=function(){return this._eventsCount>0?p(this._events):[]},"undefined"!=typeof Symbol&&(T.prototype[Symbol.iterator]=function(){return this}),T.of=function(){var e=arguments,t=e.length,n=0;return new T((function(){return n>=t?{done:!0}:{done:!1,value:e[n++]}}))},T.empty=function(){return new T((function(){return{done:!0}}))},T.fromSequence=function(e){var t=0,n=e.length;return new T((function(){return t>=n?{done:!0}:{done:!1,value:e[t++]}}))},T.is=function(e){return e instanceof T||"object"==typeof e&&null!==e&&"function"==typeof e.next};var M=T,D={};D.ARRAY_BUFFER_SUPPORT="undefined"!=typeof ArrayBuffer,D.SYMBOL_SUPPORT="undefined"!=typeof Symbol;var R=M,G=D,P=G.ARRAY_BUFFER_SUPPORT,F=G.SYMBOL_SUPPORT,z=function(e){var t=function(e){return"string"==typeof e||Array.isArray(e)||P&&ArrayBuffer.isView(e)?R.fromSequence(e):"object"!=typeof e||null===e?null:F&&"function"==typeof e[Symbol.iterator]?e[Symbol.iterator]():"function"==typeof e.next?e:null}(e);if(!t)throw new Error("obliterator: target is not iterable nor a valid iterator.");return t},O=z,I=function(e,t){for(var n,i=arguments.length>1?t:1/0,r=i!==1/0?new Array(i):[],o=0,a=O(e);;){if(o===i)return r;if((n=a.next()).done)return o!==t&&(r.length=o),r;r[o++]=n.value}},B=function(e){function n(t){var n;return(n=e.call(this)||this).name="GraphError",n.message=t,n}return t(n,e),n}(o(Error)),U=function(e){function n(t){var i;return(i=e.call(this,t)||this).name="InvalidArgumentsGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(a(i),n.prototype.constructor),i}return t(n,e),n}(B),j=function(e){function n(t){var i;return(i=e.call(this,t)||this).name="NotFoundGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(a(i),n.prototype.constructor),i}return t(n,e),n}(B),V=function(e){function n(t){var i;return(i=e.call(this,t)||this).name="UsageGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(a(i),n.prototype.constructor),i}return t(n,e),n}(B);function H(e,t){this.key=e,this.attributes=t,this.clear()}function W(e,t){this.key=e,this.attributes=t,this.clear()}function q(e,t){this.key=e,this.attributes=t,this.clear()}function Z(e,t,n,i,r){this.key=t,this.attributes=r,this.undirected=e,this.source=n,this.target=i}function Y(e,t,n,i,r,o,a){var s,h,u,c;if(i=""+i,0===n){if(!(s=e._nodes.get(i)))throw new j("Graph.".concat(t,': could not find the "').concat(i,'" node in the graph.'));u=r,c=o}else if(3===n){if(r=""+r,!(h=e._edges.get(r)))throw new j("Graph.".concat(t,': could not find the "').concat(r,'" edge in the graph.'));var d=h.source.key,l=h.target.key;if(i===d)s=h.target;else{if(i!==l)throw new j("Graph.".concat(t,': the "').concat(i,'" node is not attached to the "').concat(r,'" edge (').concat(d,", ").concat(l,")."));s=h.source}u=o,c=a}else{if(!(h=e._edges.get(i)))throw new j("Graph.".concat(t,': could not find the "').concat(i,'" edge in the graph.'));s=1===n?h.source:h.target,u=r,c=o}return[s,u,c]}H.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}},W.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}},q.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}},Z.prototype.attach=function(){var e="out",t="in";this.undirected&&(e=t="undirected");var n=this.source.key,i=this.target.key;this.source[e][i]=this,this.undirected&&n===i||(this.target[t][n]=this)},Z.prototype.attachMulti=function(){var e="out",t="in",n=this.source.key,i=this.target.key;this.undirected&&(e=t="undirected");var r=this.source[e],o=r[i];if(void 0===o)return r[i]=this,void(this.undirected&&n===i||(this.target[t][n]=this));o.previous=this,this.next=o,r[i]=this,this.target[t][n]=this},Z.prototype.detach=function(){var e=this.source.key,t=this.target.key,n="out",i="in";this.undirected&&(n=i="undirected"),delete this.source[n][t],delete this.target[i][e]},Z.prototype.detachMulti=function(){var e=this.source.key,t=this.target.key,n="out",i="in";this.undirected&&(n=i="undirected"),void 0===this.previous?void 0===this.next?(delete this.source[n][t],delete this.target[i][e]):(this.next.previous=void 0,this.source[n][t]=this.next,this.target[i][e]=this.next):(this.previous.next=this.next,void 0!==this.next&&(this.next.previous=this.previous))};var X=[{name:function(e){return"get".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r){var o=Y(this,t,n,e,i,r),a=o[0],s=o[1];return a.attributes[s]}}},{name:function(e){return"get".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,i){return Y(this,t,n,e,i)[0].attributes}}},{name:function(e){return"has".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r){var o=Y(this,t,n,e,i,r),a=o[0],s=o[1];return a.attributes.hasOwnProperty(s)}}},{name:function(e){return"set".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r,o){var a=Y(this,t,n,e,i,r,o),s=a[0],h=a[1],u=a[2];return s.attributes[h]=u,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:h}),this}}},{name:function(e){return"update".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r,o){var a=Y(this,t,n,e,i,r,o),s=a[0],h=a[1],u=a[2];if("function"!=typeof u)throw new U("Graph.".concat(t,": updater should be a function."));var c=s.attributes,d=u(c[h]);return c[h]=d,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:h}),this}}},{name:function(e){return"remove".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r){var o=Y(this,t,n,e,i,r),a=o[0],s=o[1];return delete a.attributes[s],this.emit("nodeAttributesUpdated",{key:a.key,type:"remove",attributes:a.attributes,name:s}),this}}},{name:function(e){return"replace".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r){var o=Y(this,t,n,e,i,r),a=o[0],s=o[1];if(!u(s))throw new U("Graph.".concat(t,": provided attributes are not a plain object."));return a.attributes=s,this.emit("nodeAttributesUpdated",{key:a.key,type:"replace",attributes:a.attributes}),this}}},{name:function(e){return"merge".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r){var o=Y(this,t,n,e,i,r),a=o[0],h=o[1];if(!u(h))throw new U("Graph.".concat(t,": provided attributes are not a plain object."));return s(a.attributes,h),this.emit("nodeAttributesUpdated",{key:a.key,type:"merge",attributes:a.attributes,data:h}),this}}},{name:function(e){return"update".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r){var o=Y(this,t,n,e,i,r),a=o[0],s=o[1];if("function"!=typeof s)throw new U("Graph.".concat(t,": provided updater is not a function."));return a.attributes=s(a.attributes),this.emit("nodeAttributesUpdated",{key:a.key,type:"update",attributes:a.attributes}),this}}}],K=[{name:function(e){return"get".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new V("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new V("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+e,a=""+i;if(i=arguments[2],!(r=h(this,o,a,n)))throw new j("Graph.".concat(t,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new V("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(r=this._edges.get(e)))throw new j("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return r.attributes[i]}}},{name:function(e){return"get".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new V("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>1){if(this.multi)throw new V("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var r=""+e,o=""+arguments[1];if(!(i=h(this,r,o,n)))throw new j("Graph.".concat(t,': could not find an edge for the given path ("').concat(r,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new V("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(i=this._edges.get(e)))throw new j("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return i.attributes}}},{name:function(e){return"has".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new V("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new V("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+e,a=""+i;if(i=arguments[2],!(r=h(this,o,a,n)))throw new j("Graph.".concat(t,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new V("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(r=this._edges.get(e)))throw new j("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return r.attributes.hasOwnProperty(i)}}},{name:function(e){return"set".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r){var o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new V("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new V("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var a=""+e,s=""+i;if(i=arguments[2],r=arguments[3],!(o=h(this,a,s,n)))throw new j("Graph.".concat(t,': could not find an edge for the given path ("').concat(a,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new V("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(o=this._edges.get(e)))throw new j("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return o.attributes[i]=r,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:i}),this}}},{name:function(e){return"update".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r){var o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new V("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new V("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var a=""+e,s=""+i;if(i=arguments[2],r=arguments[3],!(o=h(this,a,s,n)))throw new j("Graph.".concat(t,': could not find an edge for the given path ("').concat(a,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new V("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(o=this._edges.get(e)))throw new j("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}if("function"!=typeof r)throw new U("Graph.".concat(t,": updater should be a function."));return o.attributes[i]=r(o.attributes[i]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:i}),this}}},{name:function(e){return"remove".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new V("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new V("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+e,a=""+i;if(i=arguments[2],!(r=h(this,o,a,n)))throw new j("Graph.".concat(t,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new V("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(r=this._edges.get(e)))throw new j("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return delete r.attributes[i],this.emit("edgeAttributesUpdated",{key:r.key,type:"remove",attributes:r.attributes,name:i}),this}}},{name:function(e){return"replace".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new V("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new V("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+e,a=""+i;if(i=arguments[2],!(r=h(this,o,a,n)))throw new j("Graph.".concat(t,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new V("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(r=this._edges.get(e)))throw new j("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}if(!u(i))throw new U("Graph.".concat(t,": provided attributes are not a plain object."));return r.attributes=i,this.emit("edgeAttributesUpdated",{key:r.key,type:"replace",attributes:r.attributes}),this}}},{name:function(e){return"merge".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new V("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new V("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+e,a=""+i;if(i=arguments[2],!(r=h(this,o,a,n)))throw new j("Graph.".concat(t,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new V("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(r=this._edges.get(e)))throw new j("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}if(!u(i))throw new U("Graph.".concat(t,": provided attributes are not a plain object."));return s(r.attributes,i),this.emit("edgeAttributesUpdated",{key:r.key,type:"merge",attributes:r.attributes,data:i}),this}}},{name:function(e){return"update".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new V("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new V("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+e,a=""+i;if(i=arguments[2],!(r=h(this,o,a,n)))throw new j("Graph.".concat(t,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new V("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(r=this._edges.get(e)))throw new j("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}if("function"!=typeof i)throw new U("Graph.".concat(t,": provided updater is not a function."));return r.attributes=i(r.attributes),this.emit("edgeAttributesUpdated",{key:r.key,type:"update",attributes:r.attributes}),this}}}],J=M,$=z,Q=function(){var e=arguments,t=null,n=-1;return new J((function(){for(var i=null;;){if(null===t){if(++n>=e.length)return{done:!0};t=$(e[n])}if(!0!==(i=t.next()).done)break;t=null}return i}))},ee=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function te(e,t,n,i){var r=!1;for(var o in t)if(o!==i){var a=t[o];if(r=n(a.key,a.attributes,a.source.key,a.target.key,a.source.attributes,a.target.attributes,a.undirected),e&&r)return a.key}}function ne(e,t,n,i){var r,o,a,s=!1;for(var h in t)if(h!==i){r=t[h];do{if(o=r.source,a=r.target,s=n(r.key,r.attributes,o.key,a.key,o.attributes,a.attributes,r.undirected),e&&s)return r.key;r=r.next}while(void 0!==r)}}function ie(e,t){var n,i=Object.keys(e),r=i.length,o=0;return new M((function(){do{if(n)n=n.next;else{if(o>=r)return{done:!0};var a=i[o++];if(a===t){n=void 0;continue}n=e[a]}}while(!n);return{done:!1,value:{edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected}}}))}function re(e,t,n,i){var r=t[n];if(r){var o=r.source,a=r.target;return i(r.key,r.attributes,o.key,a.key,o.attributes,a.attributes,r.undirected)&&e?r.key:void 0}}function oe(e,t,n,i){var r=t[n];if(r){var o=!1;do{if(o=i(r.key,r.attributes,r.source.key,r.target.key,r.source.attributes,r.target.attributes,r.undirected),e&&o)return r.key;r=r.next}while(void 0!==r)}}function ae(e,t){var n=e[t];return void 0!==n.next?new M((function(){if(!n)return{done:!0};var e={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:e}})):M.of({edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected})}function se(e,t,n,i){if(0!==t.size)for(var r,o,a="mixed"!==n&&n!==t.type,s="undirected"===n,h=!1,u=t._edges.values();!0!==(r=u.next()).done;)if(o=r.value,!a||o.undirected===s){var c=o,d=c.key,l=c.attributes,f=c.source,p=c.target;if(h=i(d,l,f.key,p.key,f.attributes,p.attributes,o.undirected),e&&h)return d}}function he(e,t,n,i,r,o){var a,s=t?ne:te;if("undirected"!==n){if("out"!==i&&(a=s(e,r.in,o),e&&a))return a;if("in"!==i&&(a=s(e,r.out,o,i?void 0:r.key),e&&a))return a}if("directed"!==n&&(a=s(e,r.undirected,o),e&&a))return a}function ue(e,t,n,i,r,o,a){var s,h=n?oe:re;if("undirected"!==t){if(void 0!==r.in&&"out"!==i&&(s=h(e,r.in,o,a),e&&s))return s;if(void 0!==r.out&&"in"!==i&&(i||r.key!==o)&&(s=h(e,r.out,o,a),e&&s))return s}if("directed"!==t&&void 0!==r.undirected&&(s=h(e,r.undirected,o,a),e&&s))return s}var ce=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function de(){this.A=null,this.B=null}function le(e,t,n,i,r){for(var o in i){var a=i[o],s=a.source,h=a.target,u=s===n?h:s;if(!t||!t.has(u.key)){var c=r(u.key,u.attributes);if(e&&c)return u.key}}}function fe(e,t,n,i,r){if("mixed"!==t){if("undirected"===t)return le(e,null,i,i.undirected,r);if("string"==typeof n)return le(e,null,i,i[n],r)}var o,a=new de;if("undirected"!==t){if("out"!==n){if(o=le(e,null,i,i.in,r),e&&o)return o;a.wrap(i.in)}if("in"!==n){if(o=le(e,a,i,i.out,r),e&&o)return o;a.wrap(i.out)}}if("directed"!==t&&(o=le(e,a,i,i.undirected,r),e&&o))return o}function pe(e,t,n){var i=Object.keys(n),r=i.length,o=0;return new M((function(){var a=null;do{if(o>=r)return e&&e.wrap(n),{done:!0};var s=n[i[o++]],h=s.source,u=s.target;a=h===t?u:h,e&&e.has(a.key)&&(a=null)}while(null===a);return{done:!1,value:{neighbor:a.key,attributes:a.attributes}}}))}function ge(e,t,n,i,r){for(var o,a,s,h,u,c,d,l=i._nodes.values(),f=i.type;!0!==(o=l.next()).done;){var p=!1;if(a=o.value,"undirected"!==f)for(s in h=a.out){u=h[s];do{if(c=u.target,p=!0,d=r(a.key,c.key,a.attributes,c.attributes,u.key,u.attributes,u.undirected),e&&d)return u;u=u.next}while(u)}if("directed"!==f)for(s in h=a.undirected)if(!(t&&a.key>s)){u=h[s];do{if((c=u.target).key!==s&&(c=u.source),p=!0,d=r(a.key,c.key,a.attributes,c.attributes,u.key,u.attributes,u.undirected),e&&d)return u;u=u.next}while(u)}if(n&&!p&&(d=r(a.key,null,a.attributes,null,null,null,null),e&&d))return null}}function ve(e){if(!u(e))throw new U('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in e))throw new U("Graph.import: serialized node is missing its key.");if("attributes"in e&&(!u(e.attributes)||null===e.attributes))throw new U("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function me(e){if(!u(e))throw new U('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in e))throw new U("Graph.import: serialized edge is missing its source.");if(!("target"in e))throw new U("Graph.import: serialized edge is missing its target.");if("attributes"in e&&(!u(e.attributes)||null===e.attributes))throw new U("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in e&&"boolean"!=typeof e.undirected)throw new U("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}de.prototype.wrap=function(e){null===this.A?this.A=e:null===this.B&&(this.B=e)},de.prototype.has=function(e){return null!==this.A&&e in this.A||null!==this.B&&e in this.B};var ye,be=(ye=255&Math.floor(256*Math.random()),function(){return ye++}),we=new Set(["directed","undirected","mixed"]),xe=new Set(["domain","_events","_eventsCount","_maxListeners"]),Ce={allowSelfLoops:!0,multi:!1,type:"mixed"};function _e(e,t,n){var i=new e.NodeDataClass(t,n);return e._nodes.set(t,i),e.emit("nodeAdded",{key:t,attributes:n}),i}function Ee(e,t,n,i,r,o,a,s){if(!i&&"undirected"===e.type)throw new V("Graph.".concat(t,": you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead."));if(i&&"directed"===e.type)throw new V("Graph.".concat(t,": you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead."));if(s&&!u(s))throw new U("Graph.".concat(t,': invalid attributes. Expecting an object but got "').concat(s,'"'));if(o=""+o,a=""+a,s=s||{},!e.allowSelfLoops&&o===a)throw new V("Graph.".concat(t,': source & target are the same ("').concat(o,"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false."));var h=e._nodes.get(o),c=e._nodes.get(a);if(!h)throw new j("Graph.".concat(t,': source node "').concat(o,'" not found.'));if(!c)throw new j("Graph.".concat(t,': target node "').concat(a,'" not found.'));var d={key:null,undirected:i,source:o,target:a,attributes:s};if(n)r=e._edgeKeyGenerator();else if(r=""+r,e._edges.has(r))throw new V("Graph.".concat(t,': the "').concat(r,'" edge already exists in the graph.'));if(!e.multi&&(i?void 0!==h.undirected[a]:void 0!==h.out[a]))throw new V("Graph.".concat(t,': an edge linking "').concat(o,'" to "').concat(a,"\" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option."));var l=new Z(i,r,h,c,s);e._edges.set(r,l);var f=o===a;return i?(h.undirectedDegree++,c.undirectedDegree++,f&&(h.undirectedLoops++,e._undirectedSelfLoopCount++)):(h.outDegree++,c.inDegree++,f&&(h.directedLoops++,e._directedSelfLoopCount++)),e.multi?l.attachMulti():l.attach(),i?e._undirectedSize++:e._directedSize++,d.key=r,e.emit("edgeAdded",d),r}function ke(e,t,n,i,r,o,a,h,c){if(!i&&"undirected"===e.type)throw new V("Graph.".concat(t,": you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead."));if(i&&"directed"===e.type)throw new V("Graph.".concat(t,": you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead."));if(h)if(c){if("function"!=typeof h)throw new U("Graph.".concat(t,': invalid updater function. Expecting a function but got "').concat(h,'"'))}else if(!u(h))throw new U("Graph.".concat(t,': invalid attributes. Expecting an object but got "').concat(h,'"'));var d;if(o=""+o,a=""+a,c&&(d=h,h=void 0),!e.allowSelfLoops&&o===a)throw new V("Graph.".concat(t,': source & target are the same ("').concat(o,"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false."));var l,f,p=e._nodes.get(o),g=e._nodes.get(a);if(!n&&(l=e._edges.get(r))){if(!(l.source.key===o&&l.target.key===a||i&&l.source.key===a&&l.target.key===o))throw new V("Graph.".concat(t,': inconsistency detected when attempting to merge the "').concat(r,'" edge with "').concat(o,'" source & "').concat(a,'" target vs. ("').concat(l.source.key,'", "').concat(l.target.key,'").'));f=l}if(f||e.multi||!p||(f=i?p.undirected[a]:p.out[a]),f){var v=[f.key,!1,!1,!1];if(c?!d:!h)return v;if(c){var m=f.attributes;f.attributes=d(m),e.emit("edgeAttributesUpdated",{type:"replace",key:f.key,attributes:f.attributes})}else s(f.attributes,h),e.emit("edgeAttributesUpdated",{type:"merge",key:f.key,attributes:f.attributes,data:h});return v}h=h||{},c&&d&&(h=d(h));var y={key:null,undirected:i,source:o,target:a,attributes:h};if(n)r=e._edgeKeyGenerator();else if(r=""+r,e._edges.has(r))throw new V("Graph.".concat(t,': the "').concat(r,'" edge already exists in the graph.'));var b=!1,w=!1;p||(p=_e(e,o,{}),b=!0,o===a&&(g=p,w=!0)),g||(g=_e(e,a,{}),w=!0),l=new Z(i,r,p,g,h),e._edges.set(r,l);var x=o===a;return i?(p.undirectedDegree++,g.undirectedDegree++,x&&(p.undirectedLoops++,e._undirectedSelfLoopCount++)):(p.outDegree++,g.inDegree++,x&&(p.directedLoops++,e._directedSelfLoopCount++)),e.multi?l.attachMulti():l.attach(),i?e._undirectedSize++:e._directedSize++,y.key=r,e.emit("edgeAdded",y),[r,!0,b,w]}function Se(e,t){e._edges.delete(t.key);var n=t.source,i=t.target,r=t.attributes,o=t.undirected,a=n===i;o?(n.undirectedDegree--,i.undirectedDegree--,a&&(n.undirectedLoops--,e._undirectedSelfLoopCount--)):(n.outDegree--,i.inDegree--,a&&(n.directedLoops--,e._directedSelfLoopCount--)),e.multi?t.detachMulti():t.detach(),o?e._undirectedSize--:e._directedSize--,e.emit("edgeDropped",{key:t.key,attributes:r,source:n.key,target:i.key,undirected:o})}var Le=function(n){function i(e){var t;if(t=n.call(this)||this,"boolean"!=typeof(e=s({},Ce,e)).multi)throw new U("Graph.constructor: invalid 'multi' option. Expecting a boolean but got \"".concat(e.multi,'".'));if(!we.has(e.type))throw new U('Graph.constructor: invalid \'type\' option. Should be one of "mixed", "directed" or "undirected" but got "'.concat(e.type,'".'));if("boolean"!=typeof e.allowSelfLoops)throw new U("Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got \"".concat(e.allowSelfLoops,'".'));var i="mixed"===e.type?H:"directed"===e.type?W:q;d(a(t),"NodeDataClass",i);var r="geid_"+be()+"_",o=0;return d(a(t),"_attributes",{}),d(a(t),"_nodes",new Map),d(a(t),"_edges",new Map),d(a(t),"_directedSize",0),d(a(t),"_undirectedSize",0),d(a(t),"_directedSelfLoopCount",0),d(a(t),"_undirectedSelfLoopCount",0),d(a(t),"_edgeKeyGenerator",(function(){var e;do{e=r+o++}while(t._edges.has(e));return e})),d(a(t),"_options",e),xe.forEach((function(e){return d(a(t),e,t[e])})),l(a(t),"order",(function(){return t._nodes.size})),l(a(t),"size",(function(){return t._edges.size})),l(a(t),"directedSize",(function(){return t._directedSize})),l(a(t),"undirectedSize",(function(){return t._undirectedSize})),l(a(t),"selfLoopCount",(function(){return t._directedSelfLoopCount+t._undirectedSelfLoopCount})),l(a(t),"directedSelfLoopCount",(function(){return t._directedSelfLoopCount})),l(a(t),"undirectedSelfLoopCount",(function(){return t._undirectedSelfLoopCount})),l(a(t),"multi",t._options.multi),l(a(t),"type",t._options.type),l(a(t),"allowSelfLoops",t._options.allowSelfLoops),l(a(t),"implementation",(function(){return"graphology"})),t}t(i,n);var r=i.prototype;return r._resetInstanceCounters=function(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0},r.hasNode=function(e){return this._nodes.has(""+e)},r.hasDirectedEdge=function(e,t){if("undirected"===this.type)return!1;if(1===arguments.length){var n=""+e,i=this._edges.get(n);return!!i&&!i.undirected}if(2===arguments.length){e=""+e,t=""+t;var r=this._nodes.get(e);return!!r&&r.out.hasOwnProperty(t)}throw new U("Graph.hasDirectedEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},r.hasUndirectedEdge=function(e,t){if("directed"===this.type)return!1;if(1===arguments.length){var n=""+e,i=this._edges.get(n);return!!i&&i.undirected}if(2===arguments.length){e=""+e,t=""+t;var r=this._nodes.get(e);return!!r&&r.undirected.hasOwnProperty(t)}throw new U("Graph.hasDirectedEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},r.hasEdge=function(e,t){if(1===arguments.length){var n=""+e;return this._edges.has(n)}if(2===arguments.length){e=""+e,t=""+t;var i=this._nodes.get(e);return!!i&&(void 0!==i.out&&i.out.hasOwnProperty(t)||void 0!==i.undirected&&i.undirected.hasOwnProperty(t))}throw new U("Graph.hasEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},r.directedEdge=function(e,t){if("undirected"!==this.type){if(e=""+e,t=""+t,this.multi)throw new V("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");var n=this._nodes.get(e);if(!n)throw new j('Graph.directedEdge: could not find the "'.concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new j('Graph.directedEdge: could not find the "'.concat(t,'" target node in the graph.'));var i=n.out&&n.out[t]||void 0;return i?i.key:void 0}},r.undirectedEdge=function(e,t){if("directed"!==this.type){if(e=""+e,t=""+t,this.multi)throw new V("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");var n=this._nodes.get(e);if(!n)throw new j('Graph.undirectedEdge: could not find the "'.concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new j('Graph.undirectedEdge: could not find the "'.concat(t,'" target node in the graph.'));var i=n.undirected&&n.undirected[t]||void 0;return i?i.key:void 0}},r.edge=function(e,t){if(this.multi)throw new V("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new j('Graph.edge: could not find the "'.concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new j('Graph.edge: could not find the "'.concat(t,'" target node in the graph.'));var i=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(i)return i.key},r.areDirectedNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new j('Graph.areDirectedNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&(t in n.in||t in n.out)},r.areOutNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new j('Graph.areOutNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&t in n.out},r.areInNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new j('Graph.areInNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&t in n.in},r.areUndirectedNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new j('Graph.areUndirectedNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"directed"!==this.type&&t in n.undirected},r.areNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new j('Graph.areNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&(t in n.in||t in n.out)||"directed"!==this.type&&t in n.undirected},r.areInboundNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new j('Graph.areInboundNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&t in n.in||"directed"!==this.type&&t in n.undirected},r.areOutboundNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new j('Graph.areOutboundNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&t in n.out||"directed"!==this.type&&t in n.undirected},r.inDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new j('Graph.inDegree: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.inDegree},r.outDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new j('Graph.outDegree: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.outDegree},r.directedDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new j('Graph.directedDegree: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.inDegree+t.outDegree},r.undirectedDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new j('Graph.undirectedDegree: could not find the "'.concat(e,'" node in the graph.'));return"directed"===this.type?0:t.undirectedDegree},r.inboundDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new j('Graph.inboundDegree: could not find the "'.concat(e,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=t.undirectedDegree),"undirected"!==this.type&&(n+=t.inDegree),n},r.outboundDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new j('Graph.outboundDegree: could not find the "'.concat(e,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=t.undirectedDegree),"undirected"!==this.type&&(n+=t.outDegree),n},r.degree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new j('Graph.degree: could not find the "'.concat(e,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=t.undirectedDegree),"undirected"!==this.type&&(n+=t.inDegree+t.outDegree),n},r.inDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new j('Graph.inDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.inDegree-t.directedLoops},r.outDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new j('Graph.outDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.outDegree-t.directedLoops},r.directedDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new j('Graph.directedDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.inDegree+t.outDegree-2*t.directedLoops},r.undirectedDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new j('Graph.undirectedDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));return"directed"===this.type?0:t.undirectedDegree-2*t.undirectedLoops},r.inboundDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new j('Graph.inboundDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));var n=0,i=0;return"directed"!==this.type&&(n+=t.undirectedDegree,i+=2*t.undirectedLoops),"undirected"!==this.type&&(n+=t.inDegree,i+=t.directedLoops),n-i},r.outboundDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new j('Graph.outboundDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));var n=0,i=0;return"directed"!==this.type&&(n+=t.undirectedDegree,i+=2*t.undirectedLoops),"undirected"!==this.type&&(n+=t.outDegree,i+=t.directedLoops),n-i},r.degreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new j('Graph.degreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));var n=0,i=0;return"directed"!==this.type&&(n+=t.undirectedDegree,i+=2*t.undirectedLoops),"undirected"!==this.type&&(n+=t.inDegree+t.outDegree,i+=2*t.directedLoops),n-i},r.source=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new j('Graph.source: could not find the "'.concat(e,'" edge in the graph.'));return t.source.key},r.target=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new j('Graph.target: could not find the "'.concat(e,'" edge in the graph.'));return t.target.key},r.extremities=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new j('Graph.extremities: could not find the "'.concat(e,'" edge in the graph.'));return[t.source.key,t.target.key]},r.opposite=function(e,t){e=""+e,t=""+t;var n=this._edges.get(t);if(!n)throw new j('Graph.opposite: could not find the "'.concat(t,'" edge in the graph.'));var i=n.source.key,r=n.target.key;if(e===i)return r;if(e===r)return i;throw new j('Graph.opposite: the "'.concat(e,'" node is not attached to the "').concat(t,'" edge (').concat(i,", ").concat(r,")."))},r.hasExtremity=function(e,t){e=""+e,t=""+t;var n=this._edges.get(e);if(!n)throw new j('Graph.hasExtremity: could not find the "'.concat(e,'" edge in the graph.'));return n.source.key===t||n.target.key===t},r.isUndirected=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new j('Graph.isUndirected: could not find the "'.concat(e,'" edge in the graph.'));return t.undirected},r.isDirected=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new j('Graph.isDirected: could not find the "'.concat(e,'" edge in the graph.'));return!t.undirected},r.isSelfLoop=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new j('Graph.isSelfLoop: could not find the "'.concat(e,'" edge in the graph.'));return t.source===t.target},r.addNode=function(e,t){var n=function(e,t,n){if(n&&!u(n))throw new U('Graph.addNode: invalid attributes. Expecting an object but got "'.concat(n,'"'));if(t=""+t,n=n||{},e._nodes.has(t))throw new V('Graph.addNode: the "'.concat(t,'" node already exist in the graph.'));var i=new e.NodeDataClass(t,n);return e._nodes.set(t,i),e.emit("nodeAdded",{key:t,attributes:n}),i}(this,e,t);return n.key},r.mergeNode=function(e,t){if(t&&!u(t))throw new U('Graph.mergeNode: invalid attributes. Expecting an object but got "'.concat(t,'"'));e=""+e,t=t||{};var n=this._nodes.get(e);return n?(t&&(s(n.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:e,attributes:n.attributes,data:t})),[e,!1]):(n=new this.NodeDataClass(e,t),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:t}),[e,!0])},r.updateNode=function(e,t){if(t&&"function"!=typeof t)throw new U('Graph.updateNode: invalid updater function. Expecting a function but got "'.concat(t,'"'));e=""+e;var n=this._nodes.get(e);if(n){if(t){var i=n.attributes;n.attributes=t(i),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:n.attributes})}return[e,!1]}var r=t?t({}):{};return n=new this.NodeDataClass(e,r),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:r}),[e,!0]},r.dropNode=function(e){e=""+e;var t,n=this._nodes.get(e);if(!n)throw new j('Graph.dropNode: could not find the "'.concat(e,'" node in the graph.'));if("undirected"!==this.type){for(var i in n.out){t=n.out[i];do{Se(this,t),t=t.next}while(t)}for(var r in n.in){t=n.in[r];do{Se(this,t),t=t.next}while(t)}}if("directed"!==this.type)for(var o in n.undirected){t=n.undirected[o];do{Se(this,t),t=t.next}while(t)}this._nodes.delete(e),this.emit("nodeDropped",{key:e,attributes:n.attributes})},r.dropEdge=function(e){var t;if(arguments.length>1){var n=""+arguments[0],i=""+arguments[1];if(!(t=h(this,n,i,this.type)))throw new j('Graph.dropEdge: could not find the "'.concat(n,'" -> "').concat(i,'" edge in the graph.'))}else if(e=""+e,!(t=this._edges.get(e)))throw new j('Graph.dropEdge: could not find the "'.concat(e,'" edge in the graph.'));return Se(this,t),this},r.dropDirectedEdge=function(e,t){if(arguments.length<2)throw new V("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new V("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");var n=h(this,e=""+e,t=""+t,"directed");if(!n)throw new j('Graph.dropDirectedEdge: could not find a "'.concat(e,'" -> "').concat(t,'" edge in the graph.'));return Se(this,n),this},r.dropUndirectedEdge=function(e,t){if(arguments.length<2)throw new V("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new V("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");var n=h(this,e,t,"undirected");if(!n)throw new j('Graph.dropUndirectedEdge: could not find a "'.concat(e,'" -> "').concat(t,'" edge in the graph.'));return Se(this,n),this},r.clear=function(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")},r.clearEdges=function(){for(var e,t=this._nodes.values();!0!==(e=t.next()).done;)e.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")},r.getAttribute=function(e){return this._attributes[e]},r.getAttributes=function(){return this._attributes},r.hasAttribute=function(e){return this._attributes.hasOwnProperty(e)},r.setAttribute=function(e,t){return this._attributes[e]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this},r.updateAttribute=function(e,t){if("function"!=typeof t)throw new U("Graph.updateAttribute: updater should be a function.");var n=this._attributes[e];return this._attributes[e]=t(n),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this},r.removeAttribute=function(e){return delete this._attributes[e],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:e}),this},r.replaceAttributes=function(e){if(!u(e))throw new U("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=e,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this},r.mergeAttributes=function(e){if(!u(e))throw new U("Graph.mergeAttributes: provided attributes are not a plain object.");return s(this._attributes,e),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:e}),this},r.updateAttributes=function(e){if("function"!=typeof e)throw new U("Graph.updateAttributes: provided updater is not a function.");return this._attributes=e(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this},r.updateEachNodeAttributes=function(e,t){if("function"!=typeof e)throw new U("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!f(t))throw new U("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var n,i,r=this._nodes.values();!0!==(n=r.next()).done;)(i=n.value).attributes=e(i.key,i.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})},r.updateEachEdgeAttributes=function(e,t){if("function"!=typeof e)throw new U("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!f(t))throw new U("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var n,i,r,o,a=this._edges.values();!0!==(n=a.next()).done;)r=(i=n.value).source,o=i.target,i.attributes=e(i.key,i.attributes,r.key,o.key,r.attributes,o.attributes,i.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})},r.forEachAdjacencyEntry=function(e){if("function"!=typeof e)throw new U("Graph.forEachAdjacencyEntry: expecting a callback.");ge(!1,!1,!1,this,e)},r.forEachAdjacencyEntryWithOrphans=function(e){if("function"!=typeof e)throw new U("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");ge(!1,!1,!0,this,e)},r.forEachAssymetricAdjacencyEntry=function(e){if("function"!=typeof e)throw new U("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");ge(!1,!0,!1,this,e)},r.forEachAssymetricAdjacencyEntryWithOrphans=function(e){if("function"!=typeof e)throw new U("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");ge(!1,!0,!0,this,e)},r.nodes=function(){return"function"==typeof Array.from?Array.from(this._nodes.keys()):I(this._nodes.keys(),this._nodes.size)},r.forEachNode=function(e){if("function"!=typeof e)throw new U("Graph.forEachNode: expecting a callback.");for(var t,n,i=this._nodes.values();!0!==(t=i.next()).done;)e((n=t.value).key,n.attributes)},r.findNode=function(e){if("function"!=typeof e)throw new U("Graph.findNode: expecting a callback.");for(var t,n,i=this._nodes.values();!0!==(t=i.next()).done;)if(e((n=t.value).key,n.attributes))return n.key},r.mapNodes=function(e){if("function"!=typeof e)throw new U("Graph.mapNode: expecting a callback.");for(var t,n,i=this._nodes.values(),r=new Array(this.order),o=0;!0!==(t=i.next()).done;)n=t.value,r[o++]=e(n.key,n.attributes);return r},r.someNode=function(e){if("function"!=typeof e)throw new U("Graph.someNode: expecting a callback.");for(var t,n,i=this._nodes.values();!0!==(t=i.next()).done;)if(e((n=t.value).key,n.attributes))return!0;return!1},r.everyNode=function(e){if("function"!=typeof e)throw new U("Graph.everyNode: expecting a callback.");for(var t,n,i=this._nodes.values();!0!==(t=i.next()).done;)if(!e((n=t.value).key,n.attributes))return!1;return!0},r.filterNodes=function(e){if("function"!=typeof e)throw new U("Graph.filterNodes: expecting a callback.");for(var t,n,i=this._nodes.values(),r=[];!0!==(t=i.next()).done;)e((n=t.value).key,n.attributes)&&r.push(n.key);return r},r.reduceNodes=function(e,t){if("function"!=typeof e)throw new U("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new U("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");for(var n,i,r=t,o=this._nodes.values();!0!==(n=o.next()).done;)r=e(r,(i=n.value).key,i.attributes);return r},r.nodeEntries=function(){var e=this._nodes.values();return new M((function(){var t=e.next();if(t.done)return t;var n=t.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}))},r.export=function(){var e=this,t=new Array(this._nodes.size),n=0;this._nodes.forEach((function(e,i){t[n++]=function(e,t){var n={key:e};return c(t.attributes)||(n.attributes=s({},t.attributes)),n}(i,e)}));var i=new Array(this._edges.size);return n=0,this._edges.forEach((function(t,r){i[n++]=function(e,t,n){var i={key:t,source:n.source.key,target:n.target.key};return c(n.attributes)||(i.attributes=s({},n.attributes)),"mixed"===e&&n.undirected&&(i.undirected=!0),i}(e.type,r,t)})),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:t,edges:i}},r.import=function(e){var t,n,r,o,a,s=this,h=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e instanceof i)return e.forEachNode((function(e,t){h?s.mergeNode(e,t):s.addNode(e,t)})),e.forEachEdge((function(e,t,n,i,r,o,a){h?a?s.mergeUndirectedEdgeWithKey(e,n,i,t):s.mergeDirectedEdgeWithKey(e,n,i,t):a?s.addUndirectedEdgeWithKey(e,n,i,t):s.addDirectedEdgeWithKey(e,n,i,t)})),this;if(!u(e))throw new U("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!u(e.attributes))throw new U("Graph.import: invalid attributes. Expecting a plain object.");h?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}if(e.nodes){if(r=e.nodes,!Array.isArray(r))throw new U("Graph.import: invalid nodes. Expecting an array.");for(t=0,n=r.length;t<n;t++){ve(o=r[t]);var c=o,d=c.key,l=c.attributes;h?this.mergeNode(d,l):this.addNode(d,l)}}if(e.edges){var f=!1;if("undirected"===this.type&&(f=!0),r=e.edges,!Array.isArray(r))throw new U("Graph.import: invalid edges. Expecting an array.");for(t=0,n=r.length;t<n;t++){me(a=r[t]);var p=a,g=p.source,v=p.target,m=p.attributes,y=p.undirected,b=void 0===y?f:y;"key"in a?(h?b?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:b?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey).call(this,a.key,g,v,m):(h?b?this.mergeUndirectedEdge:this.mergeDirectedEdge:b?this.addUndirectedEdge:this.addDirectedEdge).call(this,g,v,m)}}return this},r.nullCopy=function(e){var t=new i(s({},this._options,e));return t.replaceAttributes(s({},this.getAttributes())),t},r.emptyCopy=function(e){var t=this.nullCopy(e);return this._nodes.forEach((function(e,n){var i=s({},e.attributes);e=new t.NodeDataClass(n,i),t._nodes.set(n,e)})),t},r.copy=function(e){if("string"==typeof(e=e||{}).type&&e.type!==this.type&&"mixed"!==e.type)throw new V('Graph.copy: cannot create an incompatible copy from "'.concat(this.type,'" type to "').concat(e.type,'" because this would mean losing information about the current graph.'));if("boolean"==typeof e.multi&&e.multi!==this.multi&&!0!==e.multi)throw new V("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if("boolean"==typeof e.allowSelfLoops&&e.allowSelfLoops!==this.allowSelfLoops&&!0!==e.allowSelfLoops)throw new V("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");for(var t,n,i=this.emptyCopy(e),r=this._edges.values();!0!==(t=r.next()).done;)Ee(i,"copy",!1,(n=t.value).undirected,n.key,n.source.key,n.target.key,s({},n.attributes));return i},r.toJSON=function(){return this.export()},r.toString=function(){return"[object Graph]"},r.inspect=function(){var t=this,n={};this._nodes.forEach((function(e,t){n[t]=e.attributes}));var i={},r={};this._edges.forEach((function(e,n){var o,a=e.undirected?"--":"->",s="",h=e.source.key,u=e.target.key;e.undirected&&h>u&&(o=h,h=u,u=o);var c="(".concat(h,")").concat(a,"(").concat(u,")");n.startsWith("geid_")?t.multi&&(void 0===r[c]?r[c]=0:r[c]++,s+="".concat(r[c],". ")):s+="[".concat(n,"]: "),i[s+=c]=e.attributes}));var o={};for(var a in this)this.hasOwnProperty(a)&&!xe.has(a)&&"function"!=typeof this[a]&&"symbol"!==e(a)&&(o[a]=this[a]);return o.attributes=this._attributes,o.nodes=n,o.edges=i,d(o,"constructor",this.constructor),o},i}(g.exports.EventEmitter);"undefined"!=typeof Symbol&&(Le.prototype[Symbol.for("nodejs.util.inspect.custom")]=Le.prototype.inspect),[{name:function(e){return"".concat(e,"Edge")},generateKey:!0},{name:function(e){return"".concat(e,"DirectedEdge")},generateKey:!0,type:"directed"},{name:function(e){return"".concat(e,"UndirectedEdge")},generateKey:!0,type:"undirected"},{name:function(e){return"".concat(e,"EdgeWithKey")}},{name:function(e){return"".concat(e,"DirectedEdgeWithKey")},type:"directed"},{name:function(e){return"".concat(e,"UndirectedEdgeWithKey")},type:"undirected"}].forEach((function(e){["add","merge","update"].forEach((function(t){var n=e.name(t),i="add"===t?Ee:ke;e.generateKey?Le.prototype[n]=function(r,o,a){return i(this,n,!0,"undirected"===(e.type||this.type),null,r,o,a,"update"===t)}:Le.prototype[n]=function(r,o,a,s){return i(this,n,!1,"undirected"===(e.type||this.type),r,o,a,s,"update"===t)}}))})),function(e){X.forEach((function(t){var n=t.name,i=t.attacher;i(e,n("Node"),0),i(e,n("Source"),1),i(e,n("Target"),2),i(e,n("Opposite"),3)}))}(Le),function(e){K.forEach((function(t){var n=t.name,i=t.attacher;i(e,n("Edge"),"mixed"),i(e,n("DirectedEdge"),"directed"),i(e,n("UndirectedEdge"),"undirected")}))}(Le),function(e){ee.forEach((function(t){!function(e,t){var n=t.name,i=t.type,r=t.direction;e.prototype[n]=function(e,t){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return[];if(!arguments.length)return function(e,t){if(0===e.size)return[];if("mixed"===t||t===e.type)return"function"==typeof Array.from?Array.from(e._edges.keys()):I(e._edges.keys(),e._edges.size);for(var n,i,r="undirected"===t?e.undirectedSize:e.directedSize,o=new Array(r),a="undirected"===t,s=e._edges.values(),h=0;!0!==(n=s.next()).done;)(i=n.value).undirected===a&&(o[h++]=i.key);return o}(this,i);if(1===arguments.length){e=""+e;var o=this._nodes.get(e);if(void 0===o)throw new j("Graph.".concat(n,': could not find the "').concat(e,'" node in the graph.'));return function(e,t,n,i){var r=[];return he(!1,e,t,n,i,(function(e){r.push(e)})),r}(this.multi,"mixed"===i?this.type:i,r,o)}if(2===arguments.length){e=""+e,t=""+t;var a=this._nodes.get(e);if(!a)throw new j("Graph.".concat(n,': could not find the "').concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new j("Graph.".concat(n,': could not find the "').concat(t,'" target node in the graph.'));return function(e,t,n,i,r){var o=[];return ue(!1,e,t,n,i,r,(function(e){o.push(e)})),o}(i,this.multi,r,a,t)}throw new U("Graph.".concat(n,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(e,t),function(e,t){var n=t.name,i=t.type,r=t.direction,o="forEach"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[o]=function(e,t,n){if("mixed"===i||"mixed"===this.type||i===this.type){if(1===arguments.length)return se(!1,this,i,n=e);if(2===arguments.length){e=""+e,n=t;var a=this._nodes.get(e);if(void 0===a)throw new j("Graph.".concat(o,': could not find the "').concat(e,'" node in the graph.'));return he(!1,this.multi,"mixed"===i?this.type:i,r,a,n)}if(3===arguments.length){e=""+e,t=""+t;var s=this._nodes.get(e);if(!s)throw new j("Graph.".concat(o,': could not find the "').concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new j("Graph.".concat(o,': could not find the "').concat(t,'" target node in the graph.'));return ue(!1,i,this.multi,r,s,t,n)}throw new U("Graph.".concat(o,": too many arguments (expecting 1, 2 or 3 and got ").concat(arguments.length,")."))}};var a="map"+n[0].toUpperCase()+n.slice(1);e.prototype[a]=function(){var e,t=Array.prototype.slice.call(arguments),n=t.pop();if(0===t.length){var r=0;"directed"!==i&&(r+=this.undirectedSize),"undirected"!==i&&(r+=this.directedSize),e=new Array(r);var a=0;t.push((function(t,i,r,o,s,h,u){e[a++]=n(t,i,r,o,s,h,u)}))}else e=[],t.push((function(t,i,r,o,a,s,h){e.push(n(t,i,r,o,a,s,h))}));return this[o].apply(this,t),e};var s="filter"+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(){var e=Array.prototype.slice.call(arguments),t=e.pop(),n=[];return e.push((function(e,i,r,o,a,s,h){t(e,i,r,o,a,s,h)&&n.push(e)})),this[o].apply(this,e),n};var h="reduce"+n[0].toUpperCase()+n.slice(1);e.prototype[h]=function(){var e,t,n=Array.prototype.slice.call(arguments);if(n.length<2||n.length>4)throw new U("Graph.".concat(h,": invalid number of arguments (expecting 2, 3 or 4 and got ").concat(n.length,")."));if("function"==typeof n[n.length-1]&&"function"!=typeof n[n.length-2])throw new U("Graph.".concat(h,": missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array."));2===n.length?(e=n[0],t=n[1],n=[]):3===n.length?(e=n[1],t=n[2],n=[n[0]]):4===n.length&&(e=n[2],t=n[3],n=[n[0],n[1]]);var i=t;return n.push((function(t,n,r,o,a,s,h){i=e(i,t,n,r,o,a,s,h)})),this[o].apply(this,n),i}}(e,t),function(e,t){var n=t.name,i=t.type,r=t.direction,o="find"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[o]=function(e,t,n){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return!1;if(1===arguments.length)return se(!0,this,i,n=e);if(2===arguments.length){e=""+e,n=t;var a=this._nodes.get(e);if(void 0===a)throw new j("Graph.".concat(o,': could not find the "').concat(e,'" node in the graph.'));return he(!0,this.multi,"mixed"===i?this.type:i,r,a,n)}if(3===arguments.length){e=""+e,t=""+t;var s=this._nodes.get(e);if(!s)throw new j("Graph.".concat(o,': could not find the "').concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new j("Graph.".concat(o,': could not find the "').concat(t,'" target node in the graph.'));return ue(!0,i,this.multi,r,s,t,n)}throw new U("Graph.".concat(o,": too many arguments (expecting 1, 2 or 3 and got ").concat(arguments.length,")."))};var a="some"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(){var e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((function(e,n,i,r,o,a,s){return t(e,n,i,r,o,a,s)})),!!this[o].apply(this,e)};var s="every"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(){var e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((function(e,n,i,r,o,a,s){return!t(e,n,i,r,o,a,s)})),!this[o].apply(this,e)}}(e,t),function(e,t){var n=t.name,i=t.type,r=t.direction,o=n.slice(0,-1)+"Entries";e.prototype[o]=function(e,t){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return M.empty();if(!arguments.length)return function(e,t){if(0===e.size)return M.empty();var n="mixed"!==t&&t!==e.type,i="undirected"===t,r=e._edges.values();return new M((function(){for(var e,t;;){if((e=r.next()).done)return e;if(t=e.value,!n||t.undirected===i)break}return{value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected},done:!1}}))}(this,i);if(1===arguments.length){e=""+e;var n=this._nodes.get(e);if(!n)throw new j("Graph.".concat(o,': could not find the "').concat(e,'" node in the graph.'));return function(e,t,n){var i=M.empty();return"undirected"!==e&&("out"!==t&&void 0!==n.in&&(i=Q(i,ie(n.in))),"in"!==t&&void 0!==n.out&&(i=Q(i,ie(n.out,t?void 0:n.key)))),"directed"!==e&&void 0!==n.undirected&&(i=Q(i,ie(n.undirected))),i}(i,r,n)}if(2===arguments.length){e=""+e,t=""+t;var a=this._nodes.get(e);if(!a)throw new j("Graph.".concat(o,': could not find the "').concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new j("Graph.".concat(o,': could not find the "').concat(t,'" target node in the graph.'));return function(e,t,n,i){var r=M.empty();return"undirected"!==e&&(void 0!==n.in&&"out"!==t&&i in n.in&&(r=Q(r,ae(n.in,i))),void 0!==n.out&&"in"!==t&&i in n.out&&(t||n.key!==i)&&(r=Q(r,ae(n.out,i)))),"directed"!==e&&void 0!==n.undirected&&i in n.undirected&&(r=Q(r,ae(n.undirected,i))),r}(i,r,a,t)}throw new U("Graph.".concat(o,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(e,t)}))}(Le),function(e){ce.forEach((function(t){(function(e,t){var n=t.name,i=t.type,r=t.direction;e.prototype[n]=function(e){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return[];e=""+e;var t=this._nodes.get(e);if(void 0===t)throw new j("Graph.".concat(n,': could not find the "').concat(e,'" node in the graph.'));return function(e,t,n){if("mixed"!==e){if("undirected"===e)return Object.keys(n.undirected);if("string"==typeof t)return Object.keys(n[t])}var i=[];return fe(!1,e,t,n,(function(e){i.push(e)})),i}("mixed"===i?this.type:i,r,t)}})(e,t),function(e,t){var n=t.name,i=t.type,r=t.direction,o="forEach"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[o]=function(e,t){if("mixed"===i||"mixed"===this.type||i===this.type){e=""+e;var n=this._nodes.get(e);if(void 0===n)throw new j("Graph.".concat(o,': could not find the "').concat(e,'" node in the graph.'));fe(!1,"mixed"===i?this.type:i,r,n,t)}};var a="map"+n[0].toUpperCase()+n.slice(1);e.prototype[a]=function(e,t){var n=[];return this[o](e,(function(e,i){n.push(t(e,i))})),n};var s="filter"+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(e,t){var n=[];return this[o](e,(function(e,i){t(e,i)&&n.push(e)})),n};var h="reduce"+n[0].toUpperCase()+n.slice(1);e.prototype[h]=function(e,t,n){if(arguments.length<3)throw new U("Graph.".concat(h,": missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array."));var i=n;return this[o](e,(function(e,n){i=t(i,e,n)})),i}}(e,t),function(e,t){var n=t.name,i=t.type,r=t.direction,o=n[0].toUpperCase()+n.slice(1,-1),a="find"+o;e.prototype[a]=function(e,t){if("mixed"===i||"mixed"===this.type||i===this.type){e=""+e;var n=this._nodes.get(e);if(void 0===n)throw new j("Graph.".concat(a,': could not find the "').concat(e,'" node in the graph.'));return fe(!0,"mixed"===i?this.type:i,r,n,t)}};var s="some"+o;e.prototype[s]=function(e,t){return!!this[a](e,t)};var h="every"+o;e.prototype[h]=function(e,t){return!this[a](e,(function(e,n){return!t(e,n)}))}}(e,t),function(e,t){var n=t.name,i=t.type,r=t.direction,o=n.slice(0,-1)+"Entries";e.prototype[o]=function(e){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return M.empty();e=""+e;var t=this._nodes.get(e);if(void 0===t)throw new j("Graph.".concat(o,': could not find the "').concat(e,'" node in the graph.'));return function(e,t,n){if("mixed"!==e){if("undirected"===e)return pe(null,n,n.undirected);if("string"==typeof t)return pe(null,n,n[t])}var i=M.empty(),r=new de;return"undirected"!==e&&("out"!==t&&(i=Q(i,pe(r,n,n.in))),"in"!==t&&(i=Q(i,pe(r,n,n.out)))),"directed"!==e&&(i=Q(i,pe(r,n,n.undirected))),i}("mixed"===i?this.type:i,r,t)}}(e,t)}))}(Le);var Ne=function(e){function n(t){var n=s({type:"directed"},t);if("multi"in n&&!1!==n.multi)throw new U("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("directed"!==n.type)throw new U('DirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(Le),Ae=function(e){function n(t){var n=s({type:"undirected"},t);if("multi"in n&&!1!==n.multi)throw new U("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("undirected"!==n.type)throw new U('UndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(Le),Te=function(e){function n(t){var n=s({multi:!0},t);if("multi"in n&&!0!==n.multi)throw new U("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");return e.call(this,n)||this}return t(n,e),n}(Le),Me=function(e){function n(t){var n=s({type:"directed",multi:!0},t);if("multi"in n&&!0!==n.multi)throw new U("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("directed"!==n.type)throw new U('MultiDirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(Le),De=function(e){function n(t){var n=s({type:"undirected",multi:!0},t);if("multi"in n&&!0!==n.multi)throw new U("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("undirected"!==n.type)throw new U('MultiUndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(Le);function Re(e){e.from=function(t,n){var i=s({},t.options,n),r=new e(i);return r.import(t),r}}return Re(Le),Re(Ne),Re(Ae),Re(Te),Re(Me),Re(De),Le.Graph=Le,Le.DirectedGraph=Ne,Le.UndirectedGraph=Ae,Le.MultiGraph=Te,Le.MultiDirectedGraph=Me,Le.MultiUndirectedGraph=De,Le.InvalidArgumentsGraphError=U,Le.NotFoundGraphError=j,Le.UsageGraphError=V,Le}()}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{"use strict";function e(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(t,n){for(var i=0;i<n.length;i++){var r=n[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,e(r.key),r)}}function o(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(s=function(){return!!e})()}function h(e,t,n){return t=a(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,s()?Reflect.construct(t,n||[],a(e).constructor):t.apply(e,n))}function u(e,t){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},u(e,t)}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function l(e,t){if(e){if("string"==typeof e)return d(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,o,a,s=[],h=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;h=!1}else for(;!(h=(i=o.call(n)).done)&&(s.push(i.value),s.length!==t);h=!0);}catch(e){u=!0,r=e}finally{try{if(!h&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw r}}return s}}(e,t)||l(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}n.r(i),n.d(i,{ForceAtlasAnimator:()=>dn,GraphManager:()=>Sn,GraphView:()=>Dn,LinearAnimator:()=>Nn,MultiResolutionGraph:()=>Kn,getLayoutSettings:()=>wn,initialGraphLayout:()=>pn,relativeComponentLayout:()=>an});var p={black:"#000000",silver:"#C0C0C0",gray:"#808080",grey:"#808080",white:"#FFFFFF",maroon:"#800000",red:"#FF0000",purple:"#800080",fuchsia:"#FF00FF",green:"#008000",lime:"#00FF00",olive:"#808000",yellow:"#FFFF00",navy:"#000080",blue:"#0000FF",teal:"#008080",aqua:"#00FFFF",darkblue:"#00008B",mediumblue:"#0000CD",darkgreen:"#006400",darkcyan:"#008B8B",deepskyblue:"#00BFFF",darkturquoise:"#00CED1",mediumspringgreen:"#00FA9A",springgreen:"#00FF7F",cyan:"#00FFFF",midnightblue:"#191970",dodgerblue:"#1E90FF",lightseagreen:"#20B2AA",forestgreen:"#228B22",seagreen:"#2E8B57",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",limegreen:"#32CD32",mediumseagreen:"#3CB371",turquoise:"#40E0D0",royalblue:"#4169E1",steelblue:"#4682B4",darkslateblue:"#483D8B",mediumturquoise:"#48D1CC",indigo:"#4B0082",darkolivegreen:"#556B2F",cadetblue:"#5F9EA0",cornflowerblue:"#6495ED",rebeccapurple:"#663399",mediumaquamarine:"#66CDAA",dimgray:"#696969",dimgrey:"#696969",slateblue:"#6A5ACD",olivedrab:"#6B8E23",slategray:"#708090",slategrey:"#708090",lightslategray:"#778899",lightslategrey:"#778899",mediumslateblue:"#7B68EE",lawngreen:"#7CFC00",chartreuse:"#7FFF00",aquamarine:"#7FFFD4",skyblue:"#87CEEB",lightskyblue:"#87CEFA",blueviolet:"#8A2BE2",darkred:"#8B0000",darkmagenta:"#8B008B",saddlebrown:"#8B4513",darkseagreen:"#8FBC8F",lightgreen:"#90EE90",mediumpurple:"#9370DB",darkviolet:"#9400D3",palegreen:"#98FB98",darkorchid:"#9932CC",yellowgreen:"#9ACD32",sienna:"#A0522D",brown:"#A52A2A",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",lightblue:"#ADD8E6",greenyellow:"#ADFF2F",paleturquoise:"#AFEEEE",lightsteelblue:"#B0C4DE",powderblue:"#B0E0E6",firebrick:"#B22222",darkgoldenrod:"#B8860B",mediumorchid:"#BA55D3",rosybrown:"#BC8F8F",darkkhaki:"#BDB76B",mediumvioletred:"#C71585",indianred:"#CD5C5C",peru:"#CD853F",chocolate:"#D2691E",tan:"#D2B48C",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",thistle:"#D8BFD8",orchid:"#DA70D6",goldenrod:"#DAA520",palevioletred:"#DB7093",crimson:"#DC143C",gainsboro:"#DCDCDC",plum:"#DDA0DD",burlywood:"#DEB887",lightcyan:"#E0FFFF",lavender:"#E6E6FA",darksalmon:"#E9967A",violet:"#EE82EE",palegoldenrod:"#EEE8AA",lightcoral:"#F08080",khaki:"#F0E68C",aliceblue:"#F0F8FF",honeydew:"#F0FFF0",azure:"#F0FFFF",sandybrown:"#F4A460",wheat:"#F5DEB3",beige:"#F5F5DC",whitesmoke:"#F5F5F5",mintcream:"#F5FFFA",ghostwhite:"#F8F8FF",salmon:"#FA8072",antiquewhite:"#FAEBD7",linen:"#FAF0E6",lightgoldenrodyellow:"#FAFAD2",oldlace:"#FDF5E6",magenta:"#FF00FF",deeppink:"#FF1493",orangered:"#FF4500",tomato:"#FF6347",hotpink:"#FF69B4",coral:"#FF7F50",darkorange:"#FF8C00",lightsalmon:"#FFA07A",orange:"#FFA500",lightpink:"#FFB6C1",pink:"#FFC0CB",gold:"#FFD700",peachpuff:"#FFDAB9",navajowhite:"#FFDEAD",moccasin:"#FFE4B5",bisque:"#FFE4C4",mistyrose:"#FFE4E1",blanchedalmond:"#FFEBCD",papayawhip:"#FFEFD5",lavenderblush:"#FFF0F5",seashell:"#FFF5EE",cornsilk:"#FFF8DC",lemonchiffon:"#FFFACD",floralwhite:"#FFFAF0",snow:"#FFFAFA",lightyellow:"#FFFFE0",ivory:"#FFFFF0"},g=new Int8Array(4),v=new Int32Array(g.buffer,0,1),m=new Float32Array(g.buffer,0,1),y=/^\s*rgba?\s*\(/,b=/^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)(?:\s*,\s*(.*)?)?\)\s*$/,w={};for(var x in p)w[x]=_(p[x]),w[p[x]]=w[x];function C(e,t,n,i,r){return v[0]=i<<24|n<<16|t<<8|e,r&&(v[0]=4278190079&v[0]),m[0]}function _(e){if(e=e.toLowerCase(),void 0!==w[e])return w[e];var t=function(e){var t=0,n=0,i=0,r=1;if("#"===e[0])4===e.length?(t=parseInt(e.charAt(1)+e.charAt(1),16),n=parseInt(e.charAt(2)+e.charAt(2),16),i=parseInt(e.charAt(3)+e.charAt(3),16)):(t=parseInt(e.charAt(1)+e.charAt(2),16),n=parseInt(e.charAt(3)+e.charAt(4),16),i=parseInt(e.charAt(5)+e.charAt(6),16)),9===e.length&&(r=parseInt(e.charAt(7)+e.charAt(8),16)/255);else if(y.test(e)){var o=e.match(b);o&&(t=+o[1],n=+o[2],i=+o[3],o[4]&&(r=+o[4]))}return{r:t,g:n,b:i,a:r}}(e),n=t.r,i=t.g,r=t.b,o=t.a,a=C(n,i,r,o=255*o|0,!0);return w[e]=a,a}var E={};function k(e){if(void 0!==E[e])return E[e];var t=C((16711680&e)>>>16,(65280&e)>>>8,255&e,255,!0);return E[e]=t,t}function S(e,t,n,i){return n+(t<<8)+(e<<16)}function L(e,t,n,i,r,o){var a=Math.floor(n/o*r),s=Math.floor(e.drawingBufferHeight/o-i/o*r),h=new Uint8Array(4);e.bindFramebuffer(e.FRAMEBUFFER,t),e.readPixels(a,s,1,1,e.RGBA,e.UNSIGNED_BYTE,h);var u=f(h,4);return[u[0],u[1],u[2],u[3]]}function N(t,n,i){return(n=e(n))in t?Object.defineProperty(t,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[n]=i,t}function A(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function T(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?A(Object(n),!0).forEach((function(t){N(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):A(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function M(){return M="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var i=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=a(e)););return e}(e,t);if(i){var r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}},M.apply(null,arguments)}function D(e,t,n,i){var r=M(a(1&i?e.prototype:e),t,n);return 2&i&&"function"==typeof r?function(e){return r.apply(n,e)}:r}function R(e){var t=0;return e.forEach((function(e){return t+=function(e){return e.normalized?1:e.size}(e)})),t}function G(e,t,n){var i="VERTEX"===e?t.VERTEX_SHADER:t.FRAGMENT_SHADER,r=t.createShader(i);if(null===r)throw new Error("loadShader: error while creating the shader");if(t.shaderSource(r,n),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)){var o=t.getShaderInfoLog(r);throw t.deleteShader(r),new Error("loadShader: error while compiling the shader:\n".concat(o,"\n").concat(n))}return r}function P(e){var t=e.gl,n=e.buffer,i=e.program,r=e.vertexShader,o=e.fragmentShader;t.deleteShader(r),t.deleteShader(o),t.deleteProgram(i),t.deleteBuffer(n)}var F="#define PICKING_MODE\n",z=N(N(N(N(N(N(N(N({},WebGL2RenderingContext.BOOL,1),WebGL2RenderingContext.BYTE,1),WebGL2RenderingContext.UNSIGNED_BYTE,1),WebGL2RenderingContext.SHORT,2),WebGL2RenderingContext.UNSIGNED_SHORT,2),WebGL2RenderingContext.INT,4),WebGL2RenderingContext.UNSIGNED_INT,4),WebGL2RenderingContext.FLOAT,4),O=o((function e(n,i,r){t(this,e),N(this,"array",new Float32Array),N(this,"constantArray",new Float32Array),N(this,"capacity",0),N(this,"verticesCount",0);var o=this.getDefinition();if(this.VERTICES=o.VERTICES,this.VERTEX_SHADER_SOURCE=o.VERTEX_SHADER_SOURCE,this.FRAGMENT_SHADER_SOURCE=o.FRAGMENT_SHADER_SOURCE,this.UNIFORMS=o.UNIFORMS,this.ATTRIBUTES=o.ATTRIBUTES,this.METHOD=o.METHOD,this.CONSTANT_ATTRIBUTES="CONSTANT_ATTRIBUTES"in o?o.CONSTANT_ATTRIBUTES:[],this.CONSTANT_DATA="CONSTANT_DATA"in o?o.CONSTANT_DATA:[],this.isInstanced="CONSTANT_ATTRIBUTES"in o,this.ATTRIBUTES_ITEMS_COUNT=R(this.ATTRIBUTES),this.STRIDE=this.VERTICES*this.ATTRIBUTES_ITEMS_COUNT,this.renderer=r,this.normalProgram=this.getProgramInfo("normal",n,o.VERTEX_SHADER_SOURCE,o.FRAGMENT_SHADER_SOURCE,null),this.pickProgram=i?this.getProgramInfo("pick",n,F+o.VERTEX_SHADER_SOURCE,F+o.FRAGMENT_SHADER_SOURCE,i):null,this.isInstanced){var a=R(this.CONSTANT_ATTRIBUTES);if(this.CONSTANT_DATA.length!==this.VERTICES)throw new Error("Program: error while getting constant data (expected ".concat(this.VERTICES," items, received ").concat(this.CONSTANT_DATA.length," instead)"));this.constantArray=new Float32Array(this.CONSTANT_DATA.length*a);for(var s=0;s<this.CONSTANT_DATA.length;s++){var h=this.CONSTANT_DATA[s];if(h.length!==a)throw new Error("Program: error while getting constant data (one vector has ".concat(h.length," items instead of ").concat(a,")"));for(var u=0;u<h.length;u++)this.constantArray[s*a+u]=h[u]}this.STRIDE=this.ATTRIBUTES_ITEMS_COUNT}}),[{key:"kill",value:function(){P(this.normalProgram),this.pickProgram&&(P(this.pickProgram),this.pickProgram=null)}},{key:"getProgramInfo",value:function(e,t,n,i,r){var o=this.getDefinition(),a=t.createBuffer();if(null===a)throw new Error("Program: error while creating the WebGL buffer.");var s=function(e,t){return G("VERTEX",e,t)}(t,n),h=function(e,t){return G("FRAGMENT",e,t)}(t,i),u=function(e,t){var n,i,r=e.createProgram();if(null===r)throw new Error("loadProgram: error while creating the program.");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("loadProgram: error while linking the program.");return r}(t,[s,h]),c={};o.UNIFORMS.forEach((function(e){var n=t.getUniformLocation(u,e);n&&(c[e]=n)}));var d,l={};if(o.ATTRIBUTES.forEach((function(e){l[e.name]=t.getAttribLocation(u,e.name)})),"CONSTANT_ATTRIBUTES"in o&&(o.CONSTANT_ATTRIBUTES.forEach((function(e){l[e.name]=t.getAttribLocation(u,e.name)})),null===(d=t.createBuffer())))throw new Error("Program: error while creating the WebGL constant buffer.");return{name:e,program:u,gl:t,frameBuffer:r,buffer:a,constantBuffer:d||{},uniformLocations:c,attributeLocations:l,isPicking:"pick"===e,vertexShader:s,fragmentShader:h}}},{key:"bindProgram",value:function(e){var t=this,n=0,i=e.gl,r=e.buffer;this.isInstanced?(i.bindBuffer(i.ARRAY_BUFFER,e.constantBuffer),n=0,this.CONSTANT_ATTRIBUTES.forEach((function(i){return n+=t.bindAttribute(i,e,n,!1)})),i.bufferData(i.ARRAY_BUFFER,this.constantArray,i.STATIC_DRAW),i.bindBuffer(i.ARRAY_BUFFER,e.buffer),n=0,this.ATTRIBUTES.forEach((function(i){return n+=t.bindAttribute(i,e,n,!0)})),i.bufferData(i.ARRAY_BUFFER,this.array,i.DYNAMIC_DRAW)):(i.bindBuffer(i.ARRAY_BUFFER,r),n=0,this.ATTRIBUTES.forEach((function(i){return n+=t.bindAttribute(i,e,n)})),i.bufferData(i.ARRAY_BUFFER,this.array,i.DYNAMIC_DRAW)),i.bindBuffer(i.ARRAY_BUFFER,null)}},{key:"unbindProgram",value:function(e){var t=this;this.isInstanced?(this.CONSTANT_ATTRIBUTES.forEach((function(n){return t.unbindAttribute(n,e,!1)})),this.ATTRIBUTES.forEach((function(n){return t.unbindAttribute(n,e,!0)}))):this.ATTRIBUTES.forEach((function(n){return t.unbindAttribute(n,e)}))}},{key:"bindAttribute",value:function(e,t,n,i){var r=z[e.type];if("number"!=typeof r)throw new Error('Program.bind: yet unsupported attribute type "'.concat(e.type,'"'));var o=t.attributeLocations[e.name],a=t.gl;if(-1!==o){a.enableVertexAttribArray(o);var s=this.isInstanced?(i?this.ATTRIBUTES_ITEMS_COUNT:R(this.CONSTANT_ATTRIBUTES))*Float32Array.BYTES_PER_ELEMENT:this.ATTRIBUTES_ITEMS_COUNT*Float32Array.BYTES_PER_ELEMENT;if(a.vertexAttribPointer(o,e.size,e.type,e.normalized||!1,s,n),this.isInstanced&&i)if(a instanceof WebGL2RenderingContext)a.vertexAttribDivisor(o,1);else{var h=a.getExtension("ANGLE_instanced_arrays");h&&h.vertexAttribDivisorANGLE(o,1)}}return e.size*r}},{key:"unbindAttribute",value:function(e,t,n){var i=t.attributeLocations[e.name],r=t.gl;if(-1!==i&&(r.disableVertexAttribArray(i),this.isInstanced&&n))if(r instanceof WebGL2RenderingContext)r.vertexAttribDivisor(i,0);else{var o=r.getExtension("ANGLE_instanced_arrays");o&&o.vertexAttribDivisorANGLE(i,0)}}},{key:"reallocate",value:function(e){e!==this.capacity&&(this.capacity=e,this.verticesCount=this.VERTICES*e,this.array=new Float32Array(this.isInstanced?this.capacity*this.ATTRIBUTES_ITEMS_COUNT:this.verticesCount*this.ATTRIBUTES_ITEMS_COUNT))}},{key:"hasNothingToRender",value:function(){return 0===this.verticesCount}},{key:"renderProgram",value:function(e,t){var n=t.gl,i=t.program;n.enable(n.BLEND),n.useProgram(i),this.setUniforms(e,t),this.drawWebGL(this.METHOD,t)}},{key:"render",value:function(e){this.hasNothingToRender()||(this.pickProgram&&(this.pickProgram.gl.viewport(0,0,e.width*e.pixelRatio/e.downSizingRatio,e.height*e.pixelRatio/e.downSizingRatio),this.bindProgram(this.pickProgram),this.renderProgram(T(T({},e),{},{pixelRatio:e.pixelRatio/e.downSizingRatio}),this.pickProgram),this.unbindProgram(this.pickProgram)),this.normalProgram.gl.viewport(0,0,e.width*e.pixelRatio,e.height*e.pixelRatio),this.bindProgram(this.normalProgram),this.renderProgram(e,this.normalProgram),this.unbindProgram(this.normalProgram))}},{key:"drawWebGL",value:function(e,t){var n=t.gl,i=t.frameBuffer;if(n.bindFramebuffer(n.FRAMEBUFFER,i),this.isInstanced)if(n instanceof WebGL2RenderingContext)n.drawArraysInstanced(e,0,this.VERTICES,this.capacity);else{var r=n.getExtension("ANGLE_instanced_arrays");r&&r.drawArraysInstancedANGLE(e,0,this.VERTICES,this.capacity)}else n.drawArrays(e,0,this.verticesCount)}}]),I=function(e){function n(){return t(this,n),h(this,n,arguments)}return c(n,e),o(n,[{key:"kill",value:function(){D(n,"kill",this,3)([])}},{key:"process",value:function(e,t,n){var i=t*this.STRIDE;if(!n.hidden)return this.processVisibleItem(k(e),i,n);for(var r=i+this.STRIDE;i<r;i++)this.array[i]=0}}])}(O),B=function(e){function n(){var e;t(this,n);for(var i=arguments.length,r=new Array(i),o=0;o<i;o++)r[o]=arguments[o];return N(e=h(this,n,[].concat(r)),"drawLabel",void 0),e}return c(n,e),o(n,[{key:"kill",value:function(){D(n,"kill",this,3)([])}},{key:"process",value:function(e,t,n,i,r){var o=t*this.STRIDE;if(!(r.hidden||n.hidden||i.hidden))return this.processVisibleItem(k(e),o,n,i,r);for(var a=o+this.STRIDE;o<a;o++)this.array[o]=0}}])}(O);function U(e,t,n){if(t.label){var i=n.labelSize,r=n.labelFont,o=n.labelWeight,a=n.labelColor.attribute?t[n.labelColor.attribute]||n.labelColor.color||"#000":n.labelColor.color;e.fillStyle=a,e.font="".concat(o," ").concat(i,"px ").concat(r),e.fillText(t.label,t.x+t.size+3,t.y+i/3)}}var j=WebGLRenderingContext,V=j.UNSIGNED_BYTE,H=j.FLOAT,W=["u_sizeRatio","u_correctionRatio","u_matrix"],q=function(e){function n(){return t(this,n),h(this,n,arguments)}return c(n,e),o(n,[{key:"getDefinition",value:function(){return{VERTICES:3,VERTEX_SHADER_SOURCE:"\nattribute vec4 a_id;\nattribute vec4 a_color;\nattribute vec2 a_position;\nattribute float a_size;\nattribute float a_angle;\n\nuniform mat3 u_matrix;\nuniform float u_sizeRatio;\nuniform float u_correctionRatio;\n\nvarying vec4 v_color;\nvarying vec2 v_diffVector;\nvarying float v_radius;\nvarying float v_border;\n\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n float size = a_size * u_correctionRatio / u_sizeRatio * 4.0;\n vec2 diffVector = size * vec2(cos(a_angle), sin(a_angle));\n vec2 position = a_position + diffVector;\n gl_Position = vec4(\n (u_matrix * vec3(position, 1)).xy,\n 0,\n 1\n );\n\n v_diffVector = diffVector;\n v_radius = size / 2.0;\n\n #ifdef PICKING_MODE\n // For picking mode, we use the ID as the color:\n v_color = a_id;\n #else\n // For normal mode, we use the color:\n v_color = a_color;\n #endif\n\n v_color.a *= bias;\n}\n",FRAGMENT_SHADER_SOURCE:"\nprecision highp float;\n\nvarying vec4 v_color;\nvarying vec2 v_diffVector;\nvarying float v_radius;\n\nuniform float u_correctionRatio;\n\nconst vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);\n\nvoid main(void) {\n float border = u_correctionRatio * 2.0;\n float dist = length(v_diffVector) - v_radius + border;\n\n // No antialiasing for picking mode:\n #ifdef PICKING_MODE\n if (dist > border)\n gl_FragColor = transparent;\n else\n gl_FragColor = v_color;\n\n #else\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(v_color, transparent, t);\n #endif\n}\n",METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:W,ATTRIBUTES:[{name:"a_position",size:2,type:H},{name:"a_size",size:1,type:H},{name:"a_color",size:4,type:V,normalized:!0},{name:"a_id",size:4,type:V,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:"a_angle",size:1,type:H}],CONSTANT_DATA:[[n.ANGLE_1],[n.ANGLE_2],[n.ANGLE_3]]}}},{key:"processVisibleItem",value:function(e,t,n){var i=this.array,r=_(n.color);i[t++]=n.x,i[t++]=n.y,i[t++]=n.size,i[t++]=r,i[t++]=e}},{key:"setUniforms",value:function(e,t){var n=t.gl,i=t.uniformLocations,r=i.u_sizeRatio,o=i.u_correctionRatio,a=i.u_matrix;n.uniform1f(o,e.correctionRatio),n.uniform1f(r,e.sizeRatio),n.uniformMatrix3fv(a,!1,e.matrix)}}])}(I);N(q,"ANGLE_1",0),N(q,"ANGLE_2",2*Math.PI/3),N(q,"ANGLE_3",4*Math.PI/3);var Z=WebGLRenderingContext,Y=Z.UNSIGNED_BYTE,X=Z.FLOAT,K=["u_matrix","u_sizeRatio","u_correctionRatio","u_minEdgeThickness","u_lengthToThicknessRatio","u_widenessToThicknessRatio"],J={extremity:"target",lengthToThicknessRatio:2.5,widenessToThicknessRatio:2};function $(e){var n=T(T({},J),e||{});return function(e){function i(){return t(this,i),h(this,i,arguments)}return c(i,e),o(i,[{key:"getDefinition",value:function(){return{VERTICES:3,VERTEX_SHADER_SOURCE:"\nattribute vec2 a_position;\nattribute vec2 a_normal;\nattribute float a_radius;\nattribute vec3 a_barycentric;\n\n#ifdef PICKING_MODE\nattribute vec4 a_id;\n#else\nattribute vec4 a_color;\n#endif\n\nuniform mat3 u_matrix;\nuniform float u_sizeRatio;\nuniform float u_correctionRatio;\nuniform float u_minEdgeThickness;\nuniform float u_lengthToThicknessRatio;\nuniform float u_widenessToThicknessRatio;\n\nvarying vec4 v_color;\n\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n float minThickness = u_minEdgeThickness;\n\n float normalLength = length(a_normal);\n vec2 unitNormal = a_normal / normalLength;\n\n // These first computations are taken from edge.vert.glsl and\n // edge.clamped.vert.glsl. Please read it to get better comments on what's\n // happening:\n float pixelsThickness = max(normalLength / u_sizeRatio, minThickness);\n float webGLThickness = pixelsThickness * u_correctionRatio;\n float webGLNodeRadius = a_radius * 2.0 * u_correctionRatio / u_sizeRatio;\n float webGLArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0;\n float webGLArrowHeadThickness = webGLThickness * u_widenessToThicknessRatio;\n\n float da = a_barycentric.x;\n float db = a_barycentric.y;\n float dc = a_barycentric.z;\n\n vec2 delta = vec2(\n da * (webGLNodeRadius * unitNormal.y)\n + db * ((webGLNodeRadius + webGLArrowHeadLength) * unitNormal.y + webGLArrowHeadThickness * unitNormal.x)\n + dc * ((webGLNodeRadius + webGLArrowHeadLength) * unitNormal.y - webGLArrowHeadThickness * unitNormal.x),\n\n da * (-webGLNodeRadius * unitNormal.x)\n + db * (-(webGLNodeRadius + webGLArrowHeadLength) * unitNormal.x + webGLArrowHeadThickness * unitNormal.y)\n + dc * (-(webGLNodeRadius + webGLArrowHeadLength) * unitNormal.x - webGLArrowHeadThickness * unitNormal.y)\n );\n\n vec2 position = (u_matrix * vec3(a_position + delta, 1)).xy;\n\n gl_Position = vec4(position, 0, 1);\n\n #ifdef PICKING_MODE\n // For picking mode, we use the ID as the color:\n v_color = a_id;\n #else\n // For normal mode, we use the color:\n v_color = a_color;\n #endif\n\n v_color.a *= bias;\n}\n",FRAGMENT_SHADER_SOURCE:"\nprecision mediump float;\n\nvarying vec4 v_color;\n\nvoid main(void) {\n gl_FragColor = v_color;\n}\n",METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:K,ATTRIBUTES:[{name:"a_position",size:2,type:X},{name:"a_normal",size:2,type:X},{name:"a_radius",size:1,type:X},{name:"a_color",size:4,type:Y,normalized:!0},{name:"a_id",size:4,type:Y,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:"a_barycentric",size:3,type:X}],CONSTANT_DATA:[[1,0,0],[0,1,0],[0,0,1]]}}},{key:"processVisibleItem",value:function(e,t,i,r,o){if("source"===n.extremity){var a=[r,i];i=a[0],r=a[1]}var s=o.size||1,h=r.size||1,u=i.x,c=i.y,d=r.x,l=r.y,f=_(o.color),p=d-u,g=l-c,v=p*p+g*g,m=0,y=0;v&&(m=-g*(v=1/Math.sqrt(v))*s,y=p*v*s);var b=this.array;b[t++]=d,b[t++]=l,b[t++]=-m,b[t++]=-y,b[t++]=h,b[t++]=f,b[t++]=e}},{key:"setUniforms",value:function(e,t){var i=t.gl,r=t.uniformLocations,o=r.u_matrix,a=r.u_sizeRatio,s=r.u_correctionRatio,h=r.u_minEdgeThickness,u=r.u_lengthToThicknessRatio,c=r.u_widenessToThicknessRatio;i.uniformMatrix3fv(o,!1,e.matrix),i.uniform1f(a,e.sizeRatio),i.uniform1f(s,e.correctionRatio),i.uniform1f(h,e.minEdgeThickness),i.uniform1f(u,n.lengthToThicknessRatio),i.uniform1f(c,n.widenessToThicknessRatio)}}])}(B)}$();var Q="\nprecision mediump float;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_thickness;\nvarying float v_feather;\n\nconst vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);\n\nvoid main(void) {\n // We only handle antialiasing for normal mode:\n #ifdef PICKING_MODE\n gl_FragColor = v_color;\n #else\n float dist = length(v_normal) * v_thickness;\n\n float t = smoothstep(\n v_thickness - v_feather,\n v_thickness,\n dist\n );\n\n gl_FragColor = mix(v_color, transparent, t);\n #endif\n}\n",ee=WebGLRenderingContext,te=ee.UNSIGNED_BYTE,ne=ee.FLOAT,ie=["u_matrix","u_zoomRatio","u_sizeRatio","u_correctionRatio","u_pixelRatio","u_feather","u_minEdgeThickness","u_lengthToThicknessRatio"],re={lengthToThicknessRatio:J.lengthToThicknessRatio};function oe(e){var n=T(T({},re),e||{});return function(e){function i(){return t(this,i),h(this,i,arguments)}return c(i,e),o(i,[{key:"getDefinition",value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:"\nattribute vec4 a_id;\nattribute vec4 a_color;\nattribute vec2 a_normal;\nattribute float a_normalCoef;\nattribute vec2 a_positionStart;\nattribute vec2 a_positionEnd;\nattribute float a_positionCoef;\nattribute float a_radius;\nattribute float a_radiusCoef;\n\nuniform mat3 u_matrix;\nuniform float u_zoomRatio;\nuniform float u_sizeRatio;\nuniform float u_pixelRatio;\nuniform float u_correctionRatio;\nuniform float u_minEdgeThickness;\nuniform float u_lengthToThicknessRatio;\nuniform float u_feather;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_thickness;\nvarying float v_feather;\n\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n float minThickness = u_minEdgeThickness;\n\n float radius = a_radius * a_radiusCoef;\n vec2 normal = a_normal * a_normalCoef;\n vec2 position = a_positionStart * (1.0 - a_positionCoef) + a_positionEnd * a_positionCoef;\n\n float normalLength = length(normal);\n vec2 unitNormal = normal / normalLength;\n\n // These first computations are taken from edge.vert.glsl. Please read it to\n // get better comments on what's happening:\n float pixelsThickness = max(normalLength, minThickness * u_sizeRatio);\n float webGLThickness = pixelsThickness * u_correctionRatio / u_sizeRatio;\n\n // Here, we move the point to leave space for the arrow head:\n float direction = sign(radius);\n float webGLNodeRadius = direction * radius * 2.0 * u_correctionRatio / u_sizeRatio;\n float webGLArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0;\n\n vec2 compensationVector = vec2(-direction * unitNormal.y, direction * unitNormal.x) * (webGLNodeRadius + webGLArrowHeadLength);\n\n // Here is the proper position of the vertex\n gl_Position = vec4((u_matrix * vec3(position + unitNormal * webGLThickness + compensationVector, 1)).xy, 0, 1);\n\n v_thickness = webGLThickness / u_zoomRatio;\n\n v_normal = unitNormal;\n\n v_feather = u_feather * u_correctionRatio / u_zoomRatio / u_pixelRatio * 2.0;\n\n #ifdef PICKING_MODE\n // For picking mode, we use the ID as the color:\n v_color = a_id;\n #else\n // For normal mode, we use the color:\n v_color = a_color;\n #endif\n\n v_color.a *= bias;\n}\n",FRAGMENT_SHADER_SOURCE:Q,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:ie,ATTRIBUTES:[{name:"a_positionStart",size:2,type:ne},{name:"a_positionEnd",size:2,type:ne},{name:"a_normal",size:2,type:ne},{name:"a_color",size:4,type:te,normalized:!0},{name:"a_id",size:4,type:te,normalized:!0},{name:"a_radius",size:1,type:ne}],CONSTANT_ATTRIBUTES:[{name:"a_positionCoef",size:1,type:ne},{name:"a_normalCoef",size:1,type:ne},{name:"a_radiusCoef",size:1,type:ne}],CONSTANT_DATA:[[0,1,0],[0,-1,0],[1,1,1],[1,1,1],[0,-1,0],[1,-1,-1]]}}},{key:"processVisibleItem",value:function(e,t,n,i,r){var o=r.size||1,a=n.x,s=n.y,h=i.x,u=i.y,c=_(r.color),d=h-a,l=u-s,f=i.size||1,p=d*d+l*l,g=0,v=0;p&&(g=-l*(p=1/Math.sqrt(p))*o,v=d*p*o);var m=this.array;m[t++]=a,m[t++]=s,m[t++]=h,m[t++]=u,m[t++]=g,m[t++]=v,m[t++]=c,m[t++]=e,m[t++]=f}},{key:"setUniforms",value:function(e,t){var i=t.gl,r=t.uniformLocations,o=r.u_matrix,a=r.u_zoomRatio,s=r.u_feather,h=r.u_pixelRatio,u=r.u_correctionRatio,c=r.u_sizeRatio,d=r.u_minEdgeThickness,l=r.u_lengthToThicknessRatio;i.uniformMatrix3fv(o,!1,e.matrix),i.uniform1f(a,e.zoomRatio),i.uniform1f(c,e.sizeRatio),i.uniform1f(u,e.correctionRatio),i.uniform1f(h,e.pixelRatio),i.uniform1f(s,e.antiAliasingFeather),i.uniform1f(d,e.minEdgeThickness),i.uniform1f(l,n.lengthToThicknessRatio)}}])}(B)}oe();var ae,se,he=(se=[oe(ae),$(ae)],o((function e(n,i,r){t(this,e),N(this,"drawLabel",void 0),this.programs=se.map((function(e){return new e(n,i,r)}))}),[{key:"reallocate",value:function(e){this.programs.forEach((function(t){return t.reallocate(e)}))}},{key:"process",value:function(e,t,n,i,r){this.programs.forEach((function(o){return o.process(e,t,n,i,r)}))}},{key:"render",value:function(e){this.programs.forEach((function(t){return t.render(e)}))}},{key:"kill",value:function(){this.programs.forEach((function(e){return e.kill()}))}}])),ue=he,ce=WebGLRenderingContext,de=ce.UNSIGNED_BYTE,le=ce.FLOAT,fe=["u_matrix","u_zoomRatio","u_sizeRatio","u_correctionRatio","u_pixelRatio","u_feather","u_minEdgeThickness"],pe=function(e){function n(){return t(this,n),h(this,n,arguments)}return c(n,e),o(n,[{key:"getDefinition",value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:'\nattribute vec4 a_id;\nattribute vec4 a_color;\nattribute vec2 a_normal;\nattribute float a_normalCoef;\nattribute vec2 a_positionStart;\nattribute vec2 a_positionEnd;\nattribute float a_positionCoef;\n\nuniform mat3 u_matrix;\nuniform float u_sizeRatio;\nuniform float u_zoomRatio;\nuniform float u_pixelRatio;\nuniform float u_correctionRatio;\nuniform float u_minEdgeThickness;\nuniform float u_feather;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_thickness;\nvarying float v_feather;\n\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n float minThickness = u_minEdgeThickness;\n\n vec2 normal = a_normal * a_normalCoef;\n vec2 position = a_positionStart * (1.0 - a_positionCoef) + a_positionEnd * a_positionCoef;\n\n float normalLength = length(normal);\n vec2 unitNormal = normal / normalLength;\n\n // We require edges to be at least "minThickness" pixels thick *on screen*\n // (so we need to compensate the size ratio):\n float pixelsThickness = max(normalLength, minThickness * u_sizeRatio);\n\n // Then, we need to retrieve the normalized thickness of the edge in the WebGL\n // referential (in a ([0, 1], [0, 1]) space), using our "magic" correction\n // ratio:\n float webGLThickness = pixelsThickness * u_correctionRatio / u_sizeRatio;\n\n // Here is the proper position of the vertex\n gl_Position = vec4((u_matrix * vec3(position + unitNormal * webGLThickness, 1)).xy, 0, 1);\n\n // For the fragment shader though, we need a thickness that takes the "magic"\n // correction ratio into account (as in webGLThickness), but so that the\n // antialiasing effect does not depend on the zoom level. So here\'s yet\n // another thickness version:\n v_thickness = webGLThickness / u_zoomRatio;\n\n v_normal = unitNormal;\n\n v_feather = u_feather * u_correctionRatio / u_zoomRatio / u_pixelRatio * 2.0;\n\n #ifdef PICKING_MODE\n // For picking mode, we use the ID as the color:\n v_color = a_id;\n #else\n // For normal mode, we use the color:\n v_color = a_color;\n #endif\n\n v_color.a *= bias;\n}\n',FRAGMENT_SHADER_SOURCE:Q,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:fe,ATTRIBUTES:[{name:"a_positionStart",size:2,type:le},{name:"a_positionEnd",size:2,type:le},{name:"a_normal",size:2,type:le},{name:"a_color",size:4,type:de,normalized:!0},{name:"a_id",size:4,type:de,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:"a_positionCoef",size:1,type:le},{name:"a_normalCoef",size:1,type:le}],CONSTANT_DATA:[[0,1],[0,-1],[1,1],[1,1],[0,-1],[1,-1]]}}},{key:"processVisibleItem",value:function(e,t,n,i,r){var o=r.size||1,a=n.x,s=n.y,h=i.x,u=i.y,c=_(r.color),d=h-a,l=u-s,f=d*d+l*l,p=0,g=0;f&&(p=-l*(f=1/Math.sqrt(f))*o,g=d*f*o);var v=this.array;v[t++]=a,v[t++]=s,v[t++]=h,v[t++]=u,v[t++]=p,v[t++]=g,v[t++]=c,v[t++]=e}},{key:"setUniforms",value:function(e,t){var n=t.gl,i=t.uniformLocations,r=i.u_matrix,o=i.u_zoomRatio,a=i.u_feather,s=i.u_pixelRatio,h=i.u_correctionRatio,u=i.u_sizeRatio,c=i.u_minEdgeThickness;n.uniformMatrix3fv(r,!1,e.matrix),n.uniform1f(o,e.zoomRatio),n.uniform1f(u,e.sizeRatio),n.uniform1f(h,e.correctionRatio),n.uniform1f(s,e.pixelRatio),n.uniform1f(a,e.antiAliasingFeather),n.uniform1f(c,e.minEdgeThickness)}}])}(B),ge=function(e){function n(){var e;return t(this,n),(e=h(this,n)).rawEmitter=e,e}return c(n,e),o(n)}(n(187).EventEmitter),ve=n(186),me=n.n(ve),ye={linear:function(e){return e},quadraticIn:function(e){return e*e},quadraticOut:function(e){return e*(2-e)},quadraticInOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)},cubicIn:function(e){return e*e*e},cubicOut:function(e){return--e*e*e+1},cubicInOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},be={easing:"quadraticInOut",duration:150};function we(){return Float32Array.of(1,0,0,0,1,0,0,0,1)}function xe(e,t,n){return e[0]=t,e[4]="number"==typeof n?n:t,e}function Ce(e,t){var n=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=n,e[3]=-n,e[4]=i,e}function _e(e,t,n){return e[6]=t,e[7]=n,e}function Ee(e,t){var n=e[0],i=e[1],r=e[2],o=e[3],a=e[4],s=e[5],h=e[6],u=e[7],c=e[8],d=t[0],l=t[1],f=t[2],p=t[3],g=t[4],v=t[5],m=t[6],y=t[7],b=t[8];return e[0]=d*n+l*o+f*h,e[1]=d*i+l*a+f*u,e[2]=d*r+l*s+f*c,e[3]=p*n+g*o+v*h,e[4]=p*i+g*a+v*u,e[5]=p*r+g*s+v*c,e[6]=m*n+y*o+b*h,e[7]=m*i+y*a+b*u,e[8]=m*r+y*s+b*c,e}function ke(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=e[0],r=e[1],o=e[3],a=e[4],s=e[6],h=e[7],u=t.x,c=t.y;return{x:u*i+c*o+s*n,y:u*r+c*a+h*n}}function Se(e,t,n,i,r){var o=e.angle,a=e.ratio,s=e.x,h=e.y,u=t.width,c=t.height,d=we(),l=Math.min(u,c)-2*i,f=function(e,t){var n=e.height/e.width,i=t.height/t.width;return n<1&&i>1||n>1&&i<1?1:Math.min(Math.max(i,1/i),Math.max(1/n,n))}(t,n);return r?(Ee(d,_e(we(),s,h)),Ee(d,xe(we(),a)),Ee(d,Ce(we(),o)),Ee(d,xe(we(),u/l/2/f,c/l/2/f))):(Ee(d,xe(we(),l/u*2*f,l/c*2*f)),Ee(d,Ce(we(),-o)),Ee(d,xe(we(),1/a)),Ee(d,_e(we(),-s,-h))),d}function Le(){return void 0!==window.devicePixelRatio?window.devicePixelRatio:1}function Ne(e,t,n){return n.sort((function(e,n){var i=t(e)||0,r=t(n)||0;return i<r?-1:i>r?1:0}))}function Ae(e){var t=f(e.x,2),n=t[0],i=t[1],r=f(e.y,2),o=r[0],a=r[1],s=Math.max(i-n,a-o),h=(i+n)/2,u=(a+o)/2;(0===s||Math.abs(s)===1/0||isNaN(s))&&(s=1),isNaN(h)&&(h=0),isNaN(u)&&(u=0);var c=function(e){return{x:.5+(e.x-h)/s,y:.5+(e.y-u)/s}};return c.applyTo=function(e){e.x=.5+(e.x-h)/s,e.y=.5+(e.y-u)/s},c.inverse=function(e){return{x:h+s*(e.x-.5),y:u+s*(e.y-.5)}},c.ratio=s,c}function Te(e){return Te="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Te(e)}function Me(e,t){var n=t.size;if(0!==n){var i=e.length;e.length+=n;var r=0;t.forEach((function(t){e[i+r]=t,r++}))}}function De(e){e=e||{};for(var t=0,n=arguments.length<=1?0:arguments.length-1;t<n;t++){var i=t+1<1||arguments.length<=t+1?void 0:arguments[t+1];i&&Object.assign(e,i)}return e}var Re={hideEdgesOnMove:!1,hideLabelsOnMove:!1,renderLabels:!0,renderEdgeLabels:!1,enableEdgeEvents:!1,defaultNodeColor:"#999",defaultNodeType:"circle",defaultEdgeColor:"#ccc",defaultEdgeType:"line",labelFont:"Arial",labelSize:14,labelWeight:"normal",labelColor:{color:"#000"},edgeLabelFont:"Arial",edgeLabelSize:14,edgeLabelWeight:"normal",edgeLabelColor:{attribute:"color"},stagePadding:30,defaultDrawEdgeLabel:function(e,t,n,i,r){var o=r.edgeLabelSize,a=r.edgeLabelFont,s=r.edgeLabelWeight,h=r.edgeLabelColor.attribute?t[r.edgeLabelColor.attribute]||r.edgeLabelColor.color||"#000":r.edgeLabelColor.color,u=t.label;if(u){e.fillStyle=h,e.font="".concat(s," ").concat(o,"px ").concat(a);var c,d,l=n.size,f=i.size,p=n.x,g=n.y,v=i.x,m=i.y,y=v-p,b=m-g,w=Math.sqrt(y*y+b*b);if(!(w<l+f)){c=((p+=y*l/w)+(v-=y*f/w))/2,d=((g+=b*l/w)+(m-=b*f/w))/2,y=v-p,b=m-g,w=Math.sqrt(y*y+b*b);var x,C=e.measureText(u).width;if(C>w){for(u+="…",C=e.measureText(u).width;C>w&&u.length>1;)u=u.slice(0,-2)+"…",C=e.measureText(u).width;if(u.length<4)return}x=y>0?b>0?Math.acos(y/w):Math.asin(b/w):b>0?Math.acos(y/w)+Math.PI:Math.asin(y/w)+Math.PI/2,e.save(),e.translate(c,d),e.rotate(x),e.fillText(u,-C/2,t.size/2+o),e.restore()}}},defaultDrawNodeLabel:U,defaultDrawNodeHover:function(e,t,n){var i=n.labelSize,r=n.labelFont,o=n.labelWeight;if(e.font="".concat(o," ").concat(i,"px ").concat(r),e.fillStyle="#FFF",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=8,e.shadowColor="#000","string"==typeof t.label){var a=e.measureText(t.label).width,s=Math.round(a+5),h=Math.round(i+4),u=Math.max(t.size,i/2)+2,c=Math.asin(h/2/u),d=Math.sqrt(Math.abs(Math.pow(u,2)-Math.pow(h/2,2)));e.beginPath(),e.moveTo(t.x+d,t.y+h/2),e.lineTo(t.x+u+s,t.y+h/2),e.lineTo(t.x+u+s,t.y-h/2),e.lineTo(t.x+d,t.y-h/2),e.arc(t.x,t.y,u,c,-c),e.closePath(),e.fill()}else e.beginPath(),e.arc(t.x,t.y,t.size+2,0,2*Math.PI),e.closePath(),e.fill();e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=0,U(e,t,n)},minEdgeThickness:1.7,antiAliasingFeather:1,dragTimeout:100,draggedEventsTolerance:3,inertiaDuration:200,inertiaRatio:3,zoomDuration:250,zoomingRatio:1.7,doubleClickTimeout:300,doubleClickZoomingRatio:2.2,doubleClickZoomingDuration:200,tapMoveTolerance:10,zoomToSizeRatioFunction:Math.sqrt,itemSizesReference:"screen",autoRescale:!0,autoCenter:!0,labelDensity:1,labelGridCellSize:100,labelRenderedSizeThreshold:6,nodeReducer:null,edgeReducer:null,zIndex:!1,minCameraRatio:null,maxCameraRatio:null,enableCameraZooming:!0,enableCameraPanning:!0,enableCameraRotation:!0,cameraPanBoundaries:null,allowInvalidContainer:!1,nodeProgramClasses:{},nodeHoverProgramClasses:{},edgeProgramClasses:{}},Ge={circle:q},Pe={arrow:ue,line:pe};function Fe(e){if("number"!=typeof e.labelDensity||e.labelDensity<0)throw new Error("Settings: invalid `labelDensity`. Expecting a positive number.");var t=e.minCameraRatio,n=e.maxCameraRatio;if("number"==typeof t&&"number"==typeof n&&n<t)throw new Error("Settings: invalid camera ratio boundaries. Expecting `maxCameraRatio` to be greater than `minCameraRatio`.")}var ze=1.5,Oe=function(e){function n(){var e;return t(this,n),N(e=h(this,n),"x",.5),N(e,"y",.5),N(e,"angle",0),N(e,"ratio",1),N(e,"minRatio",null),N(e,"maxRatio",null),N(e,"enabledZooming",!0),N(e,"enabledPanning",!0),N(e,"enabledRotation",!0),N(e,"clean",null),N(e,"nextFrame",null),N(e,"previousState",null),N(e,"enabled",!0),e.previousState=e.getState(),e}return c(n,e),o(n,[{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:"hasState",value:function(e){return this.x===e.x&&this.y===e.y&&this.ratio===e.ratio&&this.angle===e.angle}},{key:"getPreviousState",value:function(){var e=this.previousState;return e?{x:e.x,y:e.y,angle:e.angle,ratio:e.ratio}:null}},{key:"getBoundedRatio",value:function(e){var t=e;return"number"==typeof this.minRatio&&(t=Math.max(t,this.minRatio)),"number"==typeof this.maxRatio&&(t=Math.min(t,this.maxRatio)),t}},{key:"validateState",value:function(e){var t={};return this.enabledPanning&&"number"==typeof e.x&&(t.x=e.x),this.enabledPanning&&"number"==typeof e.y&&(t.y=e.y),this.enabledZooming&&"number"==typeof e.ratio&&(t.ratio=this.getBoundedRatio(e.ratio)),this.enabledRotation&&"number"==typeof e.angle&&(t.angle=e.angle),this.clean?this.clean(T(T({},this.getState()),t)):t}},{key:"isAnimated",value:function(){return!!this.nextFrame}},{key:"setState",value:function(e){if(!this.enabled)return this;this.previousState=this.getState();var t=this.validateState(e);return"number"==typeof t.x&&(this.x=t.x),"number"==typeof t.y&&(this.y=t.y),"number"==typeof t.ratio&&(this.ratio=t.ratio),"number"==typeof t.angle&&(this.angle=t.angle),this.hasState(this.previousState)||this.emit("updated",this.getState()),this}},{key:"updateState",value:function(e){return this.setState(e(this.getState())),this}},{key:"animate",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;if(!i)return new Promise((function(i){return t.animate(e,n,i)}));if(this.enabled){var r=T(T({},be),n),o=this.validateState(e),a="function"==typeof r.easing?r.easing:ye[r.easing],s=Date.now(),h=this.getState(),u=function(){var e=(Date.now()-s)/r.duration;if(e>=1)return t.nextFrame=null,t.setState(o),void(t.animationCallback&&(t.animationCallback.call(null),t.animationCallback=void 0));var n=a(e),i={};"number"==typeof o.x&&(i.x=h.x+(o.x-h.x)*n),"number"==typeof o.y&&(i.y=h.y+(o.y-h.y)*n),t.enabledRotation&&"number"==typeof o.angle&&(i.angle=h.angle+(o.angle-h.angle)*n),"number"==typeof o.ratio&&(i.ratio=h.ratio+(o.ratio-h.ratio)*n),t.setState(i),t.nextFrame=requestAnimationFrame(u)};this.nextFrame?(cancelAnimationFrame(this.nextFrame),this.animationCallback&&this.animationCallback.call(null),this.nextFrame=requestAnimationFrame(u)):u(),this.animationCallback=i}}},{key:"animatedZoom",value:function(e){return e?"number"==typeof e?this.animate({ratio:this.ratio/e}):this.animate({ratio:this.ratio/(e.factor||ze)},e):this.animate({ratio:this.ratio/ze})}},{key:"animatedUnzoom",value:function(e){return e?"number"==typeof e?this.animate({ratio:this.ratio*e}):this.animate({ratio:this.ratio*(e.factor||ze)},e):this.animate({ratio:this.ratio*ze})}},{key:"animatedReset",value:function(e){return this.animate({x:.5,y:.5,ratio:1,angle:0},e)}},{key:"copy",value:function(){return n.from(this.getState())}}],[{key:"from",value:function(e){return(new n).setState(e)}}])}(ge);function Ie(e,t){var n=t.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}}function Be(e,t){var n=T(T({},Ie(e,t)),{},{sigmaDefaultPrevented:!1,preventSigmaDefault:function(){n.sigmaDefaultPrevented=!0},original:e});return n}function Ue(e){var t="x"in e?e:T(T({},e.touches[0]||e.previousTouches[0]),{},{original:e.original,sigmaDefaultPrevented:e.sigmaDefaultPrevented,preventSigmaDefault:function(){e.sigmaDefaultPrevented=!0,t.sigmaDefaultPrevented=!0}});return t}function je(e){for(var t=[],n=0,i=Math.min(e.length,2);n<i;n++)t.push(e[n]);return t}function Ve(e,t,n){var i={touches:je(e.touches).map((function(e){return Ie(e,n)})),previousTouches:t.map((function(e){return Ie(e,n)})),sigmaDefaultPrevented:!1,preventSigmaDefault:function(){i.sigmaDefaultPrevented=!0},original:e};return i}function He(e){if(void 0!==e.deltaY)return-3*e.deltaY/360;if(void 0!==e.detail)return e.detail/-9;throw new Error("Captor: could not extract delta from event.")}var We=function(e){function n(e,i){var r;return t(this,n),(r=h(this,n)).container=e,r.renderer=i,r}return c(n,e),o(n)}(ge),qe=["doubleClickTimeout","doubleClickZoomingDuration","doubleClickZoomingRatio","dragTimeout","draggedEventsTolerance","inertiaDuration","inertiaRatio","zoomDuration","zoomingRatio"].reduce((function(e,t){return T(T({},e),{},N({},t,Re[t]))}),{}),Ze=function(e){function n(e,i){var r;return t(this,n),N(r=h(this,n,[e,i]),"enabled",!0),N(r,"draggedEvents",0),N(r,"downStartTime",null),N(r,"lastMouseX",null),N(r,"lastMouseY",null),N(r,"isMouseDown",!1),N(r,"isMoving",!1),N(r,"movingTimeout",null),N(r,"startCameraState",null),N(r,"clicks",0),N(r,"doubleClickTimeout",null),N(r,"currentWheelDirection",0),N(r,"settings",qe),r.handleClick=r.handleClick.bind(r),r.handleRightClick=r.handleRightClick.bind(r),r.handleDown=r.handleDown.bind(r),r.handleUp=r.handleUp.bind(r),r.handleMove=r.handleMove.bind(r),r.handleWheel=r.handleWheel.bind(r),r.handleLeave=r.handleLeave.bind(r),r.handleEnter=r.handleEnter.bind(r),e.addEventListener("click",r.handleClick,{capture:!1}),e.addEventListener("contextmenu",r.handleRightClick,{capture:!1}),e.addEventListener("mousedown",r.handleDown,{capture:!1}),e.addEventListener("wheel",r.handleWheel,{capture:!1}),e.addEventListener("mouseleave",r.handleLeave,{capture:!1}),e.addEventListener("mouseenter",r.handleEnter,{capture:!1}),document.addEventListener("mousemove",r.handleMove,{capture:!1}),document.addEventListener("mouseup",r.handleUp,{capture:!1}),r}return c(n,e),o(n,[{key:"kill",value:function(){var e=this.container;e.removeEventListener("click",this.handleClick),e.removeEventListener("contextmenu",this.handleRightClick),e.removeEventListener("mousedown",this.handleDown),e.removeEventListener("wheel",this.handleWheel),e.removeEventListener("mouseleave",this.handleLeave),e.removeEventListener("mouseenter",this.handleEnter),document.removeEventListener("mousemove",this.handleMove),document.removeEventListener("mouseup",this.handleUp)}},{key:"handleClick",value:function(e){var t=this;if(this.enabled){if(this.clicks++,2===this.clicks)return this.clicks=0,"number"==typeof this.doubleClickTimeout&&(clearTimeout(this.doubleClickTimeout),this.doubleClickTimeout=null),this.handleDoubleClick(e);setTimeout((function(){t.clicks=0,t.doubleClickTimeout=null}),this.settings.doubleClickTimeout),this.draggedEvents<this.settings.draggedEventsTolerance&&this.emit("click",Be(e,this.container))}}},{key:"handleRightClick",value:function(e){this.enabled&&this.emit("rightClick",Be(e,this.container))}},{key:"handleDoubleClick",value:function(e){if(this.enabled){e.preventDefault(),e.stopPropagation();var t=Be(e,this.container);if(this.emit("doubleClick",t),!t.sigmaDefaultPrevented){var n=this.renderer.getCamera(),i=n.getBoundedRatio(n.getState().ratio/this.settings.doubleClickZoomingRatio);n.animate(this.renderer.getViewportZoomedState(Ie(e,this.container),i),{easing:"quadraticInOut",duration:this.settings.doubleClickZoomingDuration})}}}},{key:"handleDown",value:function(e){if(this.enabled){if(0===e.button){this.startCameraState=this.renderer.getCamera().getState();var t=Ie(e,this.container),n=t.x,i=t.y;this.lastMouseX=n,this.lastMouseY=i,this.draggedEvents=0,this.downStartTime=Date.now(),this.isMouseDown=!0}this.emit("mousedown",Be(e,this.container))}}},{key:"handleUp",value:function(e){var t=this;if(this.enabled&&this.isMouseDown){var n=this.renderer.getCamera();this.isMouseDown=!1,"number"==typeof this.movingTimeout&&(clearTimeout(this.movingTimeout),this.movingTimeout=null);var i=Ie(e,this.container),r=i.x,o=i.y,a=n.getState(),s=n.getPreviousState()||{x:0,y:0};this.isMoving?n.animate({x:a.x+this.settings.inertiaRatio*(a.x-s.x),y:a.y+this.settings.inertiaRatio*(a.y-s.y)},{duration:this.settings.inertiaDuration,easing:"quadraticOut"}):this.lastMouseX===r&&this.lastMouseY===o||n.setState({x:a.x,y:a.y}),this.isMoving=!1,setTimeout((function(){var e=t.draggedEvents>0;t.draggedEvents=0,e&&t.renderer.getSetting("hideEdgesOnMove")&&t.renderer.refresh()}),0),this.emit("mouseup",Be(e,this.container))}}},{key:"handleMove",value:function(e){var t=this;if(this.enabled){var n=Be(e,this.container);if(this.emit("mousemovebody",n),e.target!==this.container&&e.composedPath()[0]!==this.container||this.emit("mousemove",n),!n.sigmaDefaultPrevented&&this.isMouseDown){this.isMoving=!0,this.draggedEvents++,"number"==typeof this.movingTimeout&&clearTimeout(this.movingTimeout),this.movingTimeout=window.setTimeout((function(){t.movingTimeout=null,t.isMoving=!1}),this.settings.dragTimeout);var i=this.renderer.getCamera(),r=Ie(e,this.container),o=r.x,a=r.y,s=this.renderer.viewportToFramedGraph({x:this.lastMouseX,y:this.lastMouseY}),h=this.renderer.viewportToFramedGraph({x:o,y:a}),u=s.x-h.x,c=s.y-h.y,d=i.getState(),l=d.x+u,f=d.y+c;i.setState({x:l,y:f}),this.lastMouseX=o,this.lastMouseY=a,e.preventDefault(),e.stopPropagation()}}}},{key:"handleLeave",value:function(e){this.emit("mouseleave",Be(e,this.container))}},{key:"handleEnter",value:function(e){this.emit("mouseenter",Be(e,this.container))}},{key:"handleWheel",value:function(e){var t=this,n=this.renderer.getCamera();if(this.enabled&&n.enabledZooming){var i=He(e);if(i){var r=function(e,t){return T(T({},Be(e,t)),{},{delta:He(e)})}(e,this.container);if(this.emit("wheel",r),r.sigmaDefaultPrevented)return e.preventDefault(),void e.stopPropagation();var o=n.getState().ratio,a=i>0?1/this.settings.zoomingRatio:this.settings.zoomingRatio,s=n.getBoundedRatio(o*a),h=i>0?1:-1,u=Date.now();o!==s&&(e.preventDefault(),e.stopPropagation(),this.currentWheelDirection===h&&this.lastWheelTriggerTime&&u-this.lastWheelTriggerTime<this.settings.zoomDuration/5||(n.animate(this.renderer.getViewportZoomedState(Ie(e,this.container),s),{easing:"quadraticOut",duration:this.settings.zoomDuration},(function(){t.currentWheelDirection=0})),this.currentWheelDirection=h,this.lastWheelTriggerTime=u))}}}},{key:"setSettings",value:function(e){this.settings=e}}])}(We),Ye=["dragTimeout","inertiaDuration","inertiaRatio","doubleClickTimeout","doubleClickZoomingRatio","doubleClickZoomingDuration","tapMoveTolerance"].reduce((function(e,t){return T(T({},e),{},N({},t,Re[t]))}),{}),Xe=function(e){function n(e,i){var r;return t(this,n),N(r=h(this,n,[e,i]),"enabled",!0),N(r,"isMoving",!1),N(r,"hasMoved",!1),N(r,"touchMode",0),N(r,"startTouchesPositions",[]),N(r,"lastTouches",[]),N(r,"lastTap",null),N(r,"settings",Ye),r.handleStart=r.handleStart.bind(r),r.handleLeave=r.handleLeave.bind(r),r.handleMove=r.handleMove.bind(r),e.addEventListener("touchstart",r.handleStart,{capture:!1}),e.addEventListener("touchcancel",r.handleLeave,{capture:!1}),document.addEventListener("touchend",r.handleLeave,{capture:!1,passive:!1}),document.addEventListener("touchmove",r.handleMove,{capture:!1,passive:!1}),r}return c(n,e),o(n,[{key:"kill",value:function(){var e=this.container;e.removeEventListener("touchstart",this.handleStart),e.removeEventListener("touchcancel",this.handleLeave),document.removeEventListener("touchend",this.handleLeave),document.removeEventListener("touchmove",this.handleMove)}},{key:"getDimensions",value:function(){return{width:this.container.offsetWidth,height:this.container.offsetHeight}}},{key:"handleStart",value:function(e){var t=this;if(this.enabled){e.preventDefault();var n=je(e.touches);if(this.touchMode=n.length,this.startCameraState=this.renderer.getCamera().getState(),this.startTouchesPositions=n.map((function(e){return Ie(e,t.container)})),2===this.touchMode){var i=f(this.startTouchesPositions,2),r=i[0],o=r.x,a=r.y,s=i[1],h=s.x,u=s.y;this.startTouchesAngle=Math.atan2(u-a,h-o),this.startTouchesDistance=Math.sqrt(Math.pow(h-o,2)+Math.pow(u-a,2))}this.emit("touchdown",Ve(e,this.lastTouches,this.container)),this.lastTouches=n,this.lastTouchesPositions=this.startTouchesPositions}}},{key:"handleLeave",value:function(e){if(this.enabled&&this.startTouchesPositions.length){switch(e.cancelable&&e.preventDefault(),this.movingTimeout&&(this.isMoving=!1,clearTimeout(this.movingTimeout)),this.touchMode){case 2:if(1===e.touches.length){this.handleStart(e),e.preventDefault();break}case 1:if(this.isMoving){var t=this.renderer.getCamera(),n=t.getState(),i=t.getPreviousState()||{x:0,y:0};t.animate({x:n.x+this.settings.inertiaRatio*(n.x-i.x),y:n.y+this.settings.inertiaRatio*(n.y-i.y)},{duration:this.settings.inertiaDuration,easing:"quadraticOut"})}this.hasMoved=!1,this.isMoving=!1,this.touchMode=0}if(this.emit("touchup",Ve(e,this.lastTouches,this.container)),!e.touches.length){var r=Ie(this.lastTouches[0],this.container),o=this.startTouchesPositions[0],a=Math.pow(r.x-o.x,2)+Math.pow(r.y-o.y,2);if(!e.touches.length&&a<Math.pow(this.settings.tapMoveTolerance,2))if(this.lastTap&&Date.now()-this.lastTap.time<this.settings.doubleClickTimeout){var s=Ve(e,this.lastTouches,this.container);if(this.emit("doubletap",s),this.lastTap=null,!s.sigmaDefaultPrevented){var h=this.renderer.getCamera(),u=h.getBoundedRatio(h.getState().ratio/this.settings.doubleClickZoomingRatio);h.animate(this.renderer.getViewportZoomedState(r,u),{easing:"quadraticInOut",duration:this.settings.doubleClickZoomingDuration})}}else{var c=Ve(e,this.lastTouches,this.container);this.emit("tap",c),this.lastTap={time:Date.now(),position:c.touches[0]||c.previousTouches[0]}}}this.lastTouches=je(e.touches),this.startTouchesPositions=[]}}},{key:"handleMove",value:function(e){var t=this;if(this.enabled&&this.startTouchesPositions.length){e.preventDefault();var n=je(e.touches),i=n.map((function(e){return Ie(e,t.container)})),r=this.lastTouches;this.lastTouches=n,this.lastTouchesPositions=i;var o=Ve(e,r,this.container);if(this.emit("touchmove",o),!o.sigmaDefaultPrevented&&(this.hasMoved||(this.hasMoved=i.some((function(e,n){var i=t.startTouchesPositions[n];return i&&(e.x!==i.x||e.y!==i.y)}))),this.hasMoved)){this.isMoving=!0,this.movingTimeout&&clearTimeout(this.movingTimeout),this.movingTimeout=window.setTimeout((function(){t.isMoving=!1}),this.settings.dragTimeout);var a=this.renderer.getCamera(),s=this.startCameraState,h=this.renderer.getSetting("stagePadding");switch(this.touchMode){case 1:var u=this.renderer.viewportToFramedGraph((this.startTouchesPositions||[])[0]),c=u.x,d=u.y,l=this.renderer.viewportToFramedGraph(i[0]),f=l.x,p=l.y;a.setState({x:s.x+c-f,y:s.y+d-p});break;case 2:var g={x:.5,y:.5,angle:0,ratio:1},v=i[0],m=v.x,y=v.y,b=i[1],w=b.x,x=b.y,C=Math.atan2(x-y,w-m)-this.startTouchesAngle,_=Math.hypot(x-y,w-m)/this.startTouchesDistance,E=a.getBoundedRatio(s.ratio/_);g.ratio=E,g.angle=s.angle+C;var k=this.getDimensions(),S=this.renderer.viewportToFramedGraph((this.startTouchesPositions||[])[0],{cameraState:s}),L=Math.min(k.width,k.height)-2*h,N=E/L,A=m-L/2/(L/k.width),T=y-L/2/(L/k.height),M=[A*Math.cos(-g.angle)-T*Math.sin(-g.angle),T*Math.cos(-g.angle)+A*Math.sin(-g.angle)];A=M[0],T=M[1],g.x=S.x-A*N,g.y=S.y+T*N,a.setState(g)}}}}},{key:"setSettings",value:function(e){this.settings=e}}])}(We);function Ke(e){return function(e){if(Array.isArray(e))return d(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||l(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Je(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.includes(i))continue;n[i]=e[i]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)n=o[i],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var $e=o((function e(n,i){t(this,e),this.key=n,this.size=i}),null,[{key:"compare",value:function(e,t){return e.size>t.size?-1:e.size<t.size||e.key>t.key?1:-1}}]),Qe=o((function e(){t(this,e),N(this,"width",0),N(this,"height",0),N(this,"cellSize",0),N(this,"columns",0),N(this,"rows",0),N(this,"cells",{})}),[{key:"resizeAndClear",value:function(e,t){this.width=e.width,this.height=e.height,this.cellSize=t,this.columns=Math.ceil(e.width/t),this.rows=Math.ceil(e.height/t),this.cells={}}},{key:"getIndex",value:function(e){var t=Math.floor(e.x/this.cellSize);return Math.floor(e.y/this.cellSize)*this.columns+t}},{key:"add",value:function(e,t,n){var i=new $e(e,t),r=this.getIndex(n),o=this.cells[r];o||(o=[],this.cells[r]=o),o.push(i)}},{key:"organize",value:function(){for(var e in this.cells)this.cells[e].sort($e.compare)}},{key:"getLabelsToDisplay",value:function(e,t){var n=this.cellSize*this.cellSize,i=n/e/e*t/n,r=Math.ceil(i),o=[];for(var a in this.cells)for(var s=this.cells[a],h=0;h<Math.min(r,s.length);h++)o.push(s[h].key);return o}}]),et=Object.prototype.hasOwnProperty,tt=function(n){function i(e,n){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(t(this,i),N(r=h(this,i),"elements",{}),N(r,"canvasContexts",{}),N(r,"webGLContexts",{}),N(r,"pickingLayers",new Set),N(r,"textures",{}),N(r,"frameBuffers",{}),N(r,"activeListeners",{}),N(r,"labelGrid",new Qe),N(r,"nodeDataCache",{}),N(r,"edgeDataCache",{}),N(r,"nodeProgramIndex",{}),N(r,"edgeProgramIndex",{}),N(r,"nodesWithForcedLabels",new Set),N(r,"edgesWithForcedLabels",new Set),N(r,"nodeExtent",{x:[0,1],y:[0,1]}),N(r,"nodeZExtent",[1/0,-1/0]),N(r,"edgeZExtent",[1/0,-1/0]),N(r,"matrix",we()),N(r,"invMatrix",we()),N(r,"correctionRatio",1),N(r,"customBBox",null),N(r,"normalizationFunction",Ae({x:[0,1],y:[0,1]})),N(r,"graphToViewportRatio",1),N(r,"itemIDsIndex",{}),N(r,"nodeIndices",{}),N(r,"edgeIndices",{}),N(r,"width",0),N(r,"height",0),N(r,"pixelRatio",Le()),N(r,"pickingDownSizingRatio",2*r.pixelRatio),N(r,"displayedNodeLabels",new Set),N(r,"displayedEdgeLabels",new Set),N(r,"highlightedNodes",new Set),N(r,"hoveredNode",null),N(r,"hoveredEdge",null),N(r,"renderFrame",null),N(r,"renderHighlightedNodesFrame",null),N(r,"needToProcess",!1),N(r,"checkEdgesEventsFrame",null),N(r,"nodePrograms",{}),N(r,"nodeHoverPrograms",{}),N(r,"edgePrograms",{}),r.settings=function(e){var t=De({},Re,e);return t.nodeProgramClasses=De({},Ge,t.nodeProgramClasses),t.edgeProgramClasses=De({},Pe,t.edgeProgramClasses),t}(o),Fe(r.settings),function(e){if(!me()(e))throw new Error("Sigma: invalid graph instance.");e.forEachNode((function(e,t){if(!Number.isFinite(t.x)||!Number.isFinite(t.y))throw new Error("Sigma: Coordinates of node ".concat(e," are invalid. A node must have a numeric 'x' and 'y' attribute."))}))}(e),!(n instanceof HTMLElement))throw new Error("Sigma: container should be an html element.");for(var a in r.graph=e,r.container=n,r.createWebGLContext("edges",{picking:o.enableEdgeEvents}),r.createCanvasContext("edgeLabels"),r.createWebGLContext("nodes",{picking:!0}),r.createCanvasContext("labels"),r.createCanvasContext("hovers"),r.createWebGLContext("hoverNodes"),r.createCanvasContext("mouse",{style:{touchAction:"none",userSelect:"none"}}),r.resize(),r.settings.nodeProgramClasses)r.registerNodeProgram(a,r.settings.nodeProgramClasses[a],r.settings.nodeHoverProgramClasses[a]);for(var s in r.settings.edgeProgramClasses)r.registerEdgeProgram(s,r.settings.edgeProgramClasses[s]);return r.camera=new Oe,r.bindCameraHandlers(),r.mouseCaptor=new Ze(r.elements.mouse,r),r.mouseCaptor.setSettings(r.settings),r.touchCaptor=new Xe(r.elements.mouse,r),r.touchCaptor.setSettings(r.settings),r.bindEventHandlers(),r.bindGraphHandlers(),r.handleSettingsUpdate(),r.refresh(),r}return c(i,n),o(i,[{key:"registerNodeProgram",value:function(e,t,n){return this.nodePrograms[e]&&this.nodePrograms[e].kill(),this.nodeHoverPrograms[e]&&this.nodeHoverPrograms[e].kill(),this.nodePrograms[e]=new t(this.webGLContexts.nodes,this.frameBuffers.nodes,this),this.nodeHoverPrograms[e]=new(n||t)(this.webGLContexts.hoverNodes,null,this),this}},{key:"registerEdgeProgram",value:function(e,t){return this.edgePrograms[e]&&this.edgePrograms[e].kill(),this.edgePrograms[e]=new t(this.webGLContexts.edges,this.frameBuffers.edges,this),this}},{key:"unregisterNodeProgram",value:function(t){if(this.nodePrograms[t]){var n=this.nodePrograms,i=n[t],r=Je(n,[t].map(e));i.kill(),this.nodePrograms=r}if(this.nodeHoverPrograms[t]){var o=this.nodeHoverPrograms,a=o[t],s=Je(o,[t].map(e));a.kill(),this.nodePrograms=s}return this}},{key:"unregisterEdgeProgram",value:function(t){if(this.edgePrograms[t]){var n=this.edgePrograms,i=n[t],r=Je(n,[t].map(e));i.kill(),this.edgePrograms=r}return this}},{key:"resetWebGLTexture",value:function(e){var t=this.webGLContexts[e],n=this.frameBuffers[e],i=this.textures[e];i&&t.deleteTexture(i);var r=t.createTexture();return t.bindFramebuffer(t.FRAMEBUFFER,n),t.bindTexture(t.TEXTURE_2D,r),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width,this.height,0,t.RGBA,t.UNSIGNED_BYTE,null),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0),this.textures[e]=r,this}},{key:"bindCameraHandlers",value:function(){var e=this;return this.activeListeners.camera=function(){e.scheduleRender()},this.camera.on("updated",this.activeListeners.camera),this}},{key:"unbindCameraHandlers",value:function(){return this.camera.removeListener("updated",this.activeListeners.camera),this}},{key:"getNodeAtPosition",value:function(e){var t=e.x,n=e.y,i=L(this.webGLContexts.nodes,this.frameBuffers.nodes,t,n,this.pixelRatio,this.pickingDownSizingRatio),r=S.apply(void 0,Ke(i)),o=this.itemIDsIndex[r];return o&&"node"===o.type?o.id:null}},{key:"bindEventHandlers",value:function(){var e=this;this.activeListeners.handleResize=function(){e.scheduleRefresh()},window.addEventListener("resize",this.activeListeners.handleResize),this.activeListeners.handleMove=function(t){var n=Ue(t),i={event:n,preventSigmaDefault:function(){n.preventSigmaDefault()}},r=e.getNodeAtPosition(n);if(r&&e.hoveredNode!==r&&!e.nodeDataCache[r].hidden)return e.hoveredNode&&e.emit("leaveNode",T(T({},i),{},{node:e.hoveredNode})),e.hoveredNode=r,e.emit("enterNode",T(T({},i),{},{node:r})),void e.scheduleHighlightedNodesRender();if(e.hoveredNode&&e.getNodeAtPosition(n)!==e.hoveredNode){var o=e.hoveredNode;return e.hoveredNode=null,e.emit("leaveNode",T(T({},i),{},{node:o})),void e.scheduleHighlightedNodesRender()}if(e.settings.enableEdgeEvents){var a=e.hoveredNode?null:e.getEdgeAtPoint(i.event.x,i.event.y);a!==e.hoveredEdge&&(e.hoveredEdge&&e.emit("leaveEdge",T(T({},i),{},{edge:e.hoveredEdge})),a&&e.emit("enterEdge",T(T({},i),{},{edge:a})),e.hoveredEdge=a)}},this.activeListeners.handleMoveBody=function(t){var n=Ue(t);e.emit("moveBody",{event:n,preventSigmaDefault:function(){n.preventSigmaDefault()}})},this.activeListeners.handleLeave=function(t){var n=Ue(t),i={event:n,preventSigmaDefault:function(){n.preventSigmaDefault()}};e.hoveredNode&&(e.emit("leaveNode",T(T({},i),{},{node:e.hoveredNode})),e.scheduleHighlightedNodesRender()),e.settings.enableEdgeEvents&&e.hoveredEdge&&(e.emit("leaveEdge",T(T({},i),{},{edge:e.hoveredEdge})),e.scheduleHighlightedNodesRender()),e.emit("leaveStage",T({},i))},this.activeListeners.handleEnter=function(t){var n=Ue(t),i={event:n,preventSigmaDefault:function(){n.preventSigmaDefault()}};e.emit("enterStage",T({},i))};var t=function(t){return function(n){var i=Ue(n),r={event:i,preventSigmaDefault:function(){i.preventSigmaDefault()}},o=e.getNodeAtPosition(i);if(o)return e.emit("".concat(t,"Node"),T(T({},r),{},{node:o}));if(e.settings.enableEdgeEvents){var a=e.getEdgeAtPoint(i.x,i.y);if(a)return e.emit("".concat(t,"Edge"),T(T({},r),{},{edge:a}))}return e.emit("".concat(t,"Stage"),r)}};return this.activeListeners.handleClick=t("click"),this.activeListeners.handleRightClick=t("rightClick"),this.activeListeners.handleDoubleClick=t("doubleClick"),this.activeListeners.handleWheel=t("wheel"),this.activeListeners.handleDown=t("down"),this.activeListeners.handleUp=t("up"),this.mouseCaptor.on("mousemove",this.activeListeners.handleMove),this.mouseCaptor.on("mousemovebody",this.activeListeners.handleMoveBody),this.mouseCaptor.on("click",this.activeListeners.handleClick),this.mouseCaptor.on("rightClick",this.activeListeners.handleRightClick),this.mouseCaptor.on("doubleClick",this.activeListeners.handleDoubleClick),this.mouseCaptor.on("wheel",this.activeListeners.handleWheel),this.mouseCaptor.on("mousedown",this.activeListeners.handleDown),this.mouseCaptor.on("mouseup",this.activeListeners.handleUp),this.mouseCaptor.on("mouseleave",this.activeListeners.handleLeave),this.mouseCaptor.on("mouseenter",this.activeListeners.handleEnter),this.touchCaptor.on("touchdown",this.activeListeners.handleDown),this.touchCaptor.on("touchdown",this.activeListeners.handleMove),this.touchCaptor.on("touchup",this.activeListeners.handleUp),this.touchCaptor.on("touchmove",this.activeListeners.handleMove),this.touchCaptor.on("tap",this.activeListeners.handleClick),this.touchCaptor.on("doubletap",this.activeListeners.handleDoubleClick),this.touchCaptor.on("touchmove",this.activeListeners.handleMoveBody),this}},{key:"bindGraphHandlers",value:function(){var e=this,t=this.graph,n=new Set(["x","y","zIndex","type"]);return this.activeListeners.eachNodeAttributesUpdatedGraphUpdate=function(i){var r,o=null===(r=i.hints)||void 0===r?void 0:r.attributes;e.graph.forEachNode((function(t){return e.updateNode(t)}));var a=!o||o.some((function(e){return n.has(e)}));e.refresh({partialGraph:{nodes:t.nodes()},skipIndexation:!a,schedule:!0})},this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate=function(n){var i,r=null===(i=n.hints)||void 0===i?void 0:i.attributes;e.graph.forEachEdge((function(t){return e.updateEdge(t)}));var o=r&&["zIndex","type"].some((function(e){return null==r?void 0:r.includes(e)}));e.refresh({partialGraph:{edges:t.edges()},skipIndexation:!o,schedule:!0})},this.activeListeners.addNodeGraphUpdate=function(t){var n=t.key;e.addNode(n),e.refresh({partialGraph:{nodes:[n]},skipIndexation:!1,schedule:!0})},this.activeListeners.updateNodeGraphUpdate=function(t){var n=t.key;e.refresh({partialGraph:{nodes:[n]},skipIndexation:!1,schedule:!0})},this.activeListeners.dropNodeGraphUpdate=function(t){var n=t.key;e.removeNode(n),e.refresh({schedule:!0})},this.activeListeners.addEdgeGraphUpdate=function(t){var n=t.key;e.addEdge(n),e.refresh({partialGraph:{edges:[n]},schedule:!0})},this.activeListeners.updateEdgeGraphUpdate=function(t){var n=t.key;e.refresh({partialGraph:{edges:[n]},skipIndexation:!1,schedule:!0})},this.activeListeners.dropEdgeGraphUpdate=function(t){var n=t.key;e.removeEdge(n),e.refresh({schedule:!0})},this.activeListeners.clearEdgesGraphUpdate=function(){e.clearEdgeState(),e.clearEdgeIndices(),e.refresh({schedule:!0})},this.activeListeners.clearGraphUpdate=function(){e.clearEdgeState(),e.clearNodeState(),e.clearEdgeIndices(),e.clearNodeIndices(),e.refresh({schedule:!0})},t.on("nodeAdded",this.activeListeners.addNodeGraphUpdate),t.on("nodeDropped",this.activeListeners.dropNodeGraphUpdate),t.on("nodeAttributesUpdated",this.activeListeners.updateNodeGraphUpdate),t.on("eachNodeAttributesUpdated",this.activeListeners.eachNodeAttributesUpdatedGraphUpdate),t.on("edgeAdded",this.activeListeners.addEdgeGraphUpdate),t.on("edgeDropped",this.activeListeners.dropEdgeGraphUpdate),t.on("edgeAttributesUpdated",this.activeListeners.updateEdgeGraphUpdate),t.on("eachEdgeAttributesUpdated",this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate),t.on("edgesCleared",this.activeListeners.clearEdgesGraphUpdate),t.on("cleared",this.activeListeners.clearGraphUpdate),this}},{key:"unbindGraphHandlers",value:function(){var e=this.graph;e.removeListener("nodeAdded",this.activeListeners.addNodeGraphUpdate),e.removeListener("nodeDropped",this.activeListeners.dropNodeGraphUpdate),e.removeListener("nodeAttributesUpdated",this.activeListeners.updateNodeGraphUpdate),e.removeListener("eachNodeAttributesUpdated",this.activeListeners.eachNodeAttributesUpdatedGraphUpdate),e.removeListener("edgeAdded",this.activeListeners.addEdgeGraphUpdate),e.removeListener("edgeDropped",this.activeListeners.dropEdgeGraphUpdate),e.removeListener("edgeAttributesUpdated",this.activeListeners.updateEdgeGraphUpdate),e.removeListener("eachEdgeAttributesUpdated",this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate),e.removeListener("edgesCleared",this.activeListeners.clearEdgesGraphUpdate),e.removeListener("cleared",this.activeListeners.clearGraphUpdate)}},{key:"getEdgeAtPoint",value:function(e,t){var n=L(this.webGLContexts.edges,this.frameBuffers.edges,e,t,this.pixelRatio,this.pickingDownSizingRatio),i=S.apply(void 0,Ke(n)),r=this.itemIDsIndex[i];return r&&"edge"===r.type?r.id:null}},{key:"process",value:function(){var e=this;this.emit("beforeProcess");var t=this.graph,n=this.settings,i=this.getDimensions();if(this.nodeExtent=function(e){if(!e.order)return{x:[0,1],y:[0,1]};var t=1/0,n=-1/0,i=1/0,r=-1/0;return e.forEachNode((function(e,o){var a=o.x,s=o.y;a<t&&(t=a),a>n&&(n=a),s<i&&(i=s),s>r&&(r=s)})),{x:[t,n],y:[i,r]}}(this.graph),!this.settings.autoRescale){var r=i.width,o=i.height,a=this.nodeExtent,s=a.x,h=a.y;this.nodeExtent={x:[(s[0]+s[1])/2-r/2,(s[0]+s[1])/2+r/2],y:[(h[0]+h[1])/2-o/2,(h[0]+h[1])/2+o/2]}}this.normalizationFunction=Ae(this.customBBox||this.nodeExtent);var u=Se((new Oe).getState(),i,this.getGraphDimensions(),this.getStagePadding());this.labelGrid.resizeAndClear(i,n.labelGridCellSize);for(var c={},d={},l={},f={},p=1,g=t.nodes(),v=0,m=g.length;v<m;v++){var y=g[v],b=this.nodeDataCache[y],w=t.getNodeAttributes(y);b.x=w.x,b.y=w.y,this.normalizationFunction.applyTo(b),"string"!=typeof b.label||b.hidden||this.labelGrid.add(y,b.size,this.framedGraphToViewport(b,{matrix:u})),c[b.type]=(c[b.type]||0)+1}for(var x in this.labelGrid.organize(),this.nodePrograms){if(!et.call(this.nodePrograms,x))throw new Error('Sigma: could not find a suitable program for node type "'.concat(x,'"!'));this.nodePrograms[x].reallocate(c[x]||0),c[x]=0}this.settings.zIndex&&this.nodeZExtent[0]!==this.nodeZExtent[1]&&(g=Ne(this.nodeZExtent,(function(t){return e.nodeDataCache[t].zIndex}),g));for(var C=0,_=g.length;C<_;C++){var E=g[C];d[E]=p,f[d[E]]={type:"node",id:E},p++;var k=this.nodeDataCache[E];this.addNodeToProgram(E,d[E],c[k.type]++)}for(var S={},L=t.edges(),N=0,A=L.length;N<A;N++){var T=L[N],M=this.edgeDataCache[T];S[M.type]=(S[M.type]||0)+1}for(var D in this.settings.zIndex&&this.edgeZExtent[0]!==this.edgeZExtent[1]&&(L=Ne(this.edgeZExtent,(function(t){return e.edgeDataCache[t].zIndex}),L)),this.edgePrograms){if(!et.call(this.edgePrograms,D))throw new Error('Sigma: could not find a suitable program for edge type "'.concat(D,'"!'));this.edgePrograms[D].reallocate(S[D]||0),S[D]=0}for(var R=0,G=L.length;R<G;R++){var P=L[R];l[P]=p,f[l[P]]={type:"edge",id:P},p++;var F=this.edgeDataCache[P];this.addEdgeToProgram(P,l[P],S[F.type]++)}return this.itemIDsIndex=f,this.nodeIndices=d,this.edgeIndices=l,this.emit("afterProcess"),this}},{key:"handleSettingsUpdate",value:function(e){var t=this,n=this.settings;if(this.camera.minRatio=n.minCameraRatio,this.camera.maxRatio=n.maxCameraRatio,this.camera.enabledZooming=n.enableCameraZooming,this.camera.enabledPanning=n.enableCameraPanning,this.camera.enabledRotation=n.enableCameraRotation,n.cameraPanBoundaries?this.camera.clean=function(e){return t.cleanCameraState(e,n.cameraPanBoundaries&&"object"===Te(n.cameraPanBoundaries)?n.cameraPanBoundaries:{})}:this.camera.clean=null,this.camera.setState(this.camera.validateState(this.camera.getState())),e){if(e.edgeProgramClasses!==n.edgeProgramClasses){for(var i in n.edgeProgramClasses)n.edgeProgramClasses[i]!==e.edgeProgramClasses[i]&&this.registerEdgeProgram(i,n.edgeProgramClasses[i]);for(var r in e.edgeProgramClasses)n.edgeProgramClasses[r]||this.unregisterEdgeProgram(r)}if(e.nodeProgramClasses!==n.nodeProgramClasses||e.nodeHoverProgramClasses!==n.nodeHoverProgramClasses){for(var o in n.nodeProgramClasses)n.nodeProgramClasses[o]===e.nodeProgramClasses[o]&&n.nodeHoverProgramClasses[o]===e.nodeHoverProgramClasses[o]||this.registerNodeProgram(o,n.nodeProgramClasses[o],n.nodeHoverProgramClasses[o]);for(var a in e.nodeProgramClasses)n.nodeProgramClasses[a]||this.unregisterNodeProgram(a)}}return this.mouseCaptor.setSettings(this.settings),this.touchCaptor.setSettings(this.settings),this}},{key:"cleanCameraState",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.tolerance,i=void 0===n?0:n,r=t.boundaries,o=T({},e),a=r||this.nodeExtent,s=f(a.x,2),h=s[0],u=s[1],c=f(a.y,2),d=c[0],l=c[1],p=[this.graphToViewport({x:h,y:d},{cameraState:e}),this.graphToViewport({x:u,y:d},{cameraState:e}),this.graphToViewport({x:h,y:l},{cameraState:e}),this.graphToViewport({x:u,y:l},{cameraState:e})],g=1/0,v=-1/0,m=1/0,y=-1/0;p.forEach((function(e){var t=e.x,n=e.y;g=Math.min(g,t),v=Math.max(v,t),m=Math.min(m,n),y=Math.max(y,n)}));var b=v-g,w=y-m,x=this.getDimensions(),C=x.width,_=x.height,E=0,k=0;if(b>=C?v<C-i?E=v-(C-i):g>i&&(E=g-i):v>C+i?E=v-(C+i):g<-i&&(E=g+i),w>=_?y<_-i?k=y-(_-i):m>i&&(k=m-i):y>_+i?k=y-(_+i):m<-i&&(k=m+i),E||k){var S=this.viewportToFramedGraph({x:0,y:0},{cameraState:e}),L=this.viewportToFramedGraph({x:E,y:k},{cameraState:e});E=L.x-S.x,k=L.y-S.y,o.x+=E,o.y+=k}return o}},{key:"renderLabels",value:function(){if(!this.settings.renderLabels)return this;var e=this.camera.getState(),t=this.labelGrid.getLabelsToDisplay(e.ratio,this.settings.labelDensity);Me(t,this.nodesWithForcedLabels),this.displayedNodeLabels=new Set;for(var n=this.canvasContexts.labels,i=0,r=t.length;i<r;i++){var o=t[i],a=this.nodeDataCache[o];if(!this.displayedNodeLabels.has(o)&&!a.hidden){var s=this.framedGraphToViewport(a),h=s.x,u=s.y,c=this.scaleSize(a.size);if((a.forceLabel||!(c<this.settings.labelRenderedSizeThreshold))&&!(h<-150||h>this.width+150||u<-50||u>this.height+50)){this.displayedNodeLabels.add(o);var d=this.settings.defaultDrawNodeLabel,l=this.nodePrograms[a.type];((null==l?void 0:l.drawLabel)||d)(n,T(T({key:o},a),{},{size:c,x:h,y:u}),this.settings)}}}return this}},{key:"renderEdgeLabels",value:function(){if(!this.settings.renderEdgeLabels)return this;var e=this.canvasContexts.edgeLabels;e.clearRect(0,0,this.width,this.height);var t,n,i,r,o,a=(t={graph:this.graph,hoveredNode:this.hoveredNode,displayedNodeLabels:this.displayedNodeLabels,highlightedNodes:this.highlightedNodes},n=t.hoveredNode,i=t.highlightedNodes,r=t.displayedNodeLabels,o=[],t.graph.forEachEdge((function(e,t,a,s){(a===n||s===n||i.has(a)||i.has(s)||r.has(a)&&r.has(s))&&o.push(e)})),o);Me(a,this.edgesWithForcedLabels);for(var s=new Set,h=0,u=a.length;h<u;h++){var c=a[h],d=this.graph.extremities(c),l=this.nodeDataCache[d[0]],f=this.nodeDataCache[d[1]],p=this.edgeDataCache[c];if(!s.has(c)&&!(p.hidden||l.hidden||f.hidden)){var g=this.settings.defaultDrawEdgeLabel,v=this.edgePrograms[p.type];((null==v?void 0:v.drawLabel)||g)(e,T(T({key:c},p),{},{size:this.scaleSize(p.size)}),T(T(T({key:d[0]},l),this.framedGraphToViewport(l)),{},{size:this.scaleSize(l.size)}),T(T(T({key:d[1]},f),this.framedGraphToViewport(f)),{},{size:this.scaleSize(f.size)}),this.settings),s.add(c)}}return this.displayedEdgeLabels=s,this}},{key:"renderHighlightedNodes",value:function(){var e=this,t=this.canvasContexts.hovers;t.clearRect(0,0,this.width,this.height);var n=[];this.hoveredNode&&!this.nodeDataCache[this.hoveredNode].hidden&&n.push(this.hoveredNode),this.highlightedNodes.forEach((function(t){t!==e.hoveredNode&&n.push(t)})),n.forEach((function(n){return function(n){var i=e.nodeDataCache[n],r=e.framedGraphToViewport(i),o=r.x,a=r.y,s=e.scaleSize(i.size),h=e.settings.defaultDrawNodeHover,u=e.nodePrograms[i.type];((null==u?void 0:u.drawHover)||h)(t,T(T({key:n},i),{},{size:s,x:o,y:a}),e.settings)}(n)}));var i={};for(var r in n.forEach((function(t){var n=e.nodeDataCache[t].type;i[n]=(i[n]||0)+1})),this.nodeHoverPrograms)this.nodeHoverPrograms[r].reallocate(i[r]||0),i[r]=0;n.forEach((function(t){var n=e.nodeDataCache[t];e.nodeHoverPrograms[n.type].process(0,i[n.type]++,n)})),this.webGLContexts.hoverNodes.clear(this.webGLContexts.hoverNodes.COLOR_BUFFER_BIT);var o=this.getRenderParams();for(var a in this.nodeHoverPrograms)this.nodeHoverPrograms[a].render(o)}},{key:"scheduleHighlightedNodesRender",value:function(){var e=this;this.renderHighlightedNodesFrame||this.renderFrame||(this.renderHighlightedNodesFrame=requestAnimationFrame((function(){e.renderHighlightedNodesFrame=null,e.renderHighlightedNodes(),e.renderEdgeLabels()})))}},{key:"render",value:function(){var e=this;this.emit("beforeRender");var t=function(){return e.emit("afterRender"),e};if(this.renderFrame&&(cancelAnimationFrame(this.renderFrame),this.renderFrame=null),this.resize(),this.needToProcess&&this.process(),this.needToProcess=!1,this.clear(),this.pickingLayers.forEach((function(t){return e.resetWebGLTexture(t)})),!this.graph.order)return t();var n=this.mouseCaptor,i=this.camera.isAnimated()||n.isMoving||n.draggedEvents||n.currentWheelDirection,r=this.camera.getState(),o=this.getDimensions(),a=this.getGraphDimensions(),s=this.getStagePadding();this.matrix=Se(r,o,a,s),this.invMatrix=Se(r,o,a,s,!0),this.correctionRatio=function(e,t,n){var i=ke(e,{x:Math.cos(t.angle),y:Math.sin(t.angle)},0),r=i.x,o=i.y;return 1/Math.sqrt(Math.pow(r,2)+Math.pow(o,2))/n.width}(this.matrix,r,o),this.graphToViewportRatio=this.getGraphToViewportRatio();var h=this.getRenderParams();for(var u in this.nodePrograms)this.nodePrograms[u].render(h);if(!this.settings.hideEdgesOnMove||!i)for(var c in this.edgePrograms)this.edgePrograms[c].render(h);return this.settings.hideLabelsOnMove&&i||(this.renderLabels(),this.renderEdgeLabels(),this.renderHighlightedNodes()),t()}},{key:"addNode",value:function(e){var t=Object.assign({},this.graph.getNodeAttributes(e));this.settings.nodeReducer&&(t=this.settings.nodeReducer(e,t));var n=function(e,t,n){if(!et.call(n,"x")||!et.call(n,"y"))throw new Error('Sigma: could not find a valid position (x, y) for node "'.concat(t,'". All your nodes must have a number "x" and "y". Maybe your forgot to apply a layout or your "nodeReducer" is not returning the correct data?'));return n.color||(n.color=e.defaultNodeColor),n.label||""===n.label||(n.label=null),void 0!==n.label&&null!==n.label?n.label=""+n.label:n.label=null,n.size||(n.size=2),et.call(n,"hidden")||(n.hidden=!1),et.call(n,"highlighted")||(n.highlighted=!1),et.call(n,"forceLabel")||(n.forceLabel=!1),n.type&&""!==n.type||(n.type=e.defaultNodeType),n.zIndex||(n.zIndex=0),n}(this.settings,e,t);this.nodeDataCache[e]=n,this.nodesWithForcedLabels.delete(e),n.forceLabel&&!n.hidden&&this.nodesWithForcedLabels.add(e),this.highlightedNodes.delete(e),n.highlighted&&!n.hidden&&this.highlightedNodes.add(e),this.settings.zIndex&&(n.zIndex<this.nodeZExtent[0]&&(this.nodeZExtent[0]=n.zIndex),n.zIndex>this.nodeZExtent[1]&&(this.nodeZExtent[1]=n.zIndex))}},{key:"updateNode",value:function(e){this.addNode(e);var t=this.nodeDataCache[e];this.normalizationFunction.applyTo(t)}},{key:"removeNode",value:function(e){delete this.nodeDataCache[e],delete this.nodeProgramIndex[e],this.highlightedNodes.delete(e),this.hoveredNode===e&&(this.hoveredNode=null),this.nodesWithForcedLabels.delete(e)}},{key:"addEdge",value:function(e){var t=Object.assign({},this.graph.getEdgeAttributes(e));this.settings.edgeReducer&&(t=this.settings.edgeReducer(e,t));var n=function(e,t,n){return n.color||(n.color=e.defaultEdgeColor),n.label||(n.label=""),n.size||(n.size=.5),et.call(n,"hidden")||(n.hidden=!1),et.call(n,"forceLabel")||(n.forceLabel=!1),n.type&&""!==n.type||(n.type=e.defaultEdgeType),n.zIndex||(n.zIndex=0),n}(this.settings,0,t);this.edgeDataCache[e]=n,this.edgesWithForcedLabels.delete(e),n.forceLabel&&!n.hidden&&this.edgesWithForcedLabels.add(e),this.settings.zIndex&&(n.zIndex<this.edgeZExtent[0]&&(this.edgeZExtent[0]=n.zIndex),n.zIndex>this.edgeZExtent[1]&&(this.edgeZExtent[1]=n.zIndex))}},{key:"updateEdge",value:function(e){this.addEdge(e)}},{key:"removeEdge",value:function(e){delete this.edgeDataCache[e],delete this.edgeProgramIndex[e],this.hoveredEdge===e&&(this.hoveredEdge=null),this.edgesWithForcedLabels.delete(e)}},{key:"clearNodeIndices",value:function(){this.labelGrid=new Qe,this.nodeExtent={x:[0,1],y:[0,1]},this.nodeDataCache={},this.edgeProgramIndex={},this.nodesWithForcedLabels=new Set,this.nodeZExtent=[1/0,-1/0]}},{key:"clearEdgeIndices",value:function(){this.edgeDataCache={},this.edgeProgramIndex={},this.edgesWithForcedLabels=new Set,this.edgeZExtent=[1/0,-1/0]}},{key:"clearIndices",value:function(){this.clearEdgeIndices(),this.clearNodeIndices()}},{key:"clearNodeState",value:function(){this.displayedNodeLabels=new Set,this.highlightedNodes=new Set,this.hoveredNode=null}},{key:"clearEdgeState",value:function(){this.displayedEdgeLabels=new Set,this.highlightedNodes=new Set,this.hoveredEdge=null}},{key:"clearState",value:function(){this.clearEdgeState(),this.clearNodeState()}},{key:"addNodeToProgram",value:function(e,t,n){var i=this.nodeDataCache[e],r=this.nodePrograms[i.type];if(!r)throw new Error('Sigma: could not find a suitable program for node type "'.concat(i.type,'"!'));r.process(t,n,i),this.nodeProgramIndex[e]=n}},{key:"addEdgeToProgram",value:function(e,t,n){var i=this.edgeDataCache[e],r=this.edgePrograms[i.type];if(!r)throw new Error('Sigma: could not find a suitable program for edge type "'.concat(i.type,'"!'));var o=this.graph.extremities(e),a=this.nodeDataCache[o[0]],s=this.nodeDataCache[o[1]];r.process(t,n,a,s,i),this.edgeProgramIndex[e]=n}},{key:"getRenderParams",value:function(){return{matrix:this.matrix,invMatrix:this.invMatrix,width:this.width,height:this.height,pixelRatio:this.pixelRatio,zoomRatio:this.camera.ratio,cameraAngle:this.camera.angle,sizeRatio:1/this.scaleSize(),correctionRatio:this.correctionRatio,downSizingRatio:this.pickingDownSizingRatio,minEdgeThickness:this.settings.minEdgeThickness,antiAliasingFeather:this.settings.antiAliasingFeather}}},{key:"getStagePadding",value:function(){var e=this.settings,t=e.stagePadding;return e.autoRescale&&t||0}},{key:"createLayer",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(this.elements[e])throw new Error('Sigma: a layer named "'.concat(e,'" already exists'));var i=function(e,t,n){var i=document.createElement(e);if(t)for(var r in t)i.style[r]=t[r];if(n)for(var o in n)i.setAttribute(o,n[o]);return i}(t,{position:"absolute"},{class:"sigma-".concat(e)});return n.style&&Object.assign(i.style,n.style),this.elements[e]=i,"beforeLayer"in n&&n.beforeLayer?this.elements[n.beforeLayer].before(i):"afterLayer"in n&&n.afterLayer?this.elements[n.afterLayer].after(i):this.container.appendChild(i),i}},{key:"createCanvas",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.createLayer(e,"canvas",t)}},{key:"createCanvasContext",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.createCanvas(e,t);return this.canvasContexts[e]=n.getContext("2d",{preserveDrawingBuffer:!1,antialias:!1}),this}},{key:"createWebGLContext",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(null==t?void 0:t.canvas)||this.createCanvas(e,t);t.hidden&&n.remove();var i,r=T({preserveDrawingBuffer:!1,antialias:!1},t);(i=n.getContext("webgl2",r))||(i=n.getContext("webgl",r)),i||(i=n.getContext("experimental-webgl",r));var o=i;if(this.webGLContexts[e]=o,o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA),t.picking){this.pickingLayers.add(e);var a=o.createFramebuffer();if(!a)throw new Error("Sigma: cannot create a new frame buffer for layer ".concat(e));this.frameBuffers[e]=a}return o}},{key:"killLayer",value:function(e){var t,n=this.elements[e];if(!n)throw new Error("Sigma: cannot kill layer ".concat(e,", which does not exist"));return this.webGLContexts[e]?(null===(t=this.webGLContexts[e].getExtension("WEBGL_lose_context"))||void 0===t||t.loseContext(),delete this.webGLContexts[e]):this.canvasContexts[e]&&delete this.canvasContexts[e],n.remove(),delete this.elements[e],this}},{key:"getCamera",value:function(){return this.camera}},{key:"setCamera",value:function(e){this.unbindCameraHandlers(),this.camera=e,this.bindCameraHandlers()}},{key:"getContainer",value:function(){return this.container}},{key:"getGraph",value:function(){return this.graph}},{key:"setGraph",value:function(e){e!==this.graph&&(this.hoveredNode&&!e.hasNode(this.hoveredNode)&&(this.hoveredNode=null),this.hoveredEdge&&!e.hasEdge(this.hoveredEdge)&&(this.hoveredEdge=null),this.unbindGraphHandlers(),null!==this.checkEdgesEventsFrame&&(cancelAnimationFrame(this.checkEdgesEventsFrame),this.checkEdgesEventsFrame=null),this.graph=e,this.bindGraphHandlers(),this.refresh())}},{key:"getMouseCaptor",value:function(){return this.mouseCaptor}},{key:"getTouchCaptor",value:function(){return this.touchCaptor}},{key:"getDimensions",value:function(){return{width:this.width,height:this.height}}},{key:"getGraphDimensions",value:function(){var e=this.customBBox||this.nodeExtent;return{width:e.x[1]-e.x[0]||1,height:e.y[1]-e.y[0]||1}}},{key:"getNodeDisplayData",value:function(e){var t=this.nodeDataCache[e];return t?Object.assign({},t):void 0}},{key:"getEdgeDisplayData",value:function(e){var t=this.edgeDataCache[e];return t?Object.assign({},t):void 0}},{key:"getNodeDisplayedLabels",value:function(){return new Set(this.displayedNodeLabels)}},{key:"getEdgeDisplayedLabels",value:function(){return new Set(this.displayedEdgeLabels)}},{key:"getSettings",value:function(){return T({},this.settings)}},{key:"getSetting",value:function(e){return this.settings[e]}},{key:"setSetting",value:function(e,t){var n=T({},this.settings);return this.settings[e]=t,Fe(this.settings),this.handleSettingsUpdate(n),this.scheduleRefresh(),this}},{key:"updateSetting",value:function(e,t){return this.setSetting(e,t(this.settings[e])),this}},{key:"setSettings",value:function(e){var t=T({},this.settings);return this.settings=T(T({},this.settings),e),Fe(this.settings),this.handleSettingsUpdate(t),this.scheduleRefresh(),this}},{key:"resize",value:function(e){var t=this.width,n=this.height;if(this.width=this.container.offsetWidth,this.height=this.container.offsetHeight,this.pixelRatio=Le(),0===this.width){if(!this.settings.allowInvalidContainer)throw new Error("Sigma: Container has no width. You can set the allowInvalidContainer setting to true to stop seeing this error.");this.width=1}if(0===this.height){if(!this.settings.allowInvalidContainer)throw new Error("Sigma: Container has no height. You can set the allowInvalidContainer setting to true to stop seeing this error.");this.height=1}if(!e&&t===this.width&&n===this.height)return this;for(var i in this.elements){var r=this.elements[i];r.style.width=this.width+"px",r.style.height=this.height+"px"}for(var o in this.canvasContexts)this.elements[o].setAttribute("width",this.width*this.pixelRatio+"px"),this.elements[o].setAttribute("height",this.height*this.pixelRatio+"px"),1!==this.pixelRatio&&this.canvasContexts[o].scale(this.pixelRatio,this.pixelRatio);for(var a in this.webGLContexts){this.elements[a].setAttribute("width",this.width*this.pixelRatio+"px"),this.elements[a].setAttribute("height",this.height*this.pixelRatio+"px");var s=this.webGLContexts[a];if(s.viewport(0,0,this.width*this.pixelRatio,this.height*this.pixelRatio),this.pickingLayers.has(a)){var h=this.textures[a];h&&s.deleteTexture(h)}}return this.emit("resize"),this}},{key:"clear",value:function(){return this.emit("beforeClear"),this.webGLContexts.nodes.bindFramebuffer(WebGLRenderingContext.FRAMEBUFFER,null),this.webGLContexts.nodes.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.webGLContexts.edges.bindFramebuffer(WebGLRenderingContext.FRAMEBUFFER,null),this.webGLContexts.edges.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.webGLContexts.hoverNodes.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.canvasContexts.labels.clearRect(0,0,this.width,this.height),this.canvasContexts.hovers.clearRect(0,0,this.width,this.height),this.canvasContexts.edgeLabels.clearRect(0,0,this.width,this.height),this.emit("afterClear"),this}},{key:"refresh",value:function(e){var t=this,n=void 0!==(null==e?void 0:e.skipIndexation)&&(null==e?void 0:e.skipIndexation),i=void 0!==(null==e?void 0:e.schedule)&&e.schedule,r=!e||!e.partialGraph;if(r)this.clearEdgeIndices(),this.clearNodeIndices(),this.graph.forEachNode((function(e){return t.addNode(e)})),this.graph.forEachEdge((function(e){return t.addEdge(e)}));else{for(var o,a,s=(null===(o=e.partialGraph)||void 0===o?void 0:o.nodes)||[],h=0,u=(null==s?void 0:s.length)||0;h<u;h++){var c=s[h];if(this.updateNode(c),n){var d=this.nodeProgramIndex[c];if(void 0===d)throw new Error('Sigma: node "'.concat(c,"\" can't be repaint"));this.addNodeToProgram(c,this.nodeIndices[c],d)}}for(var l=(null==e||null===(a=e.partialGraph)||void 0===a?void 0:a.edges)||[],f=0,p=l.length;f<p;f++){var g=l[f];if(this.updateEdge(g),n){var v=this.edgeProgramIndex[g];if(void 0===v)throw new Error('Sigma: edge "'.concat(g,"\" can't be repaint"));this.addEdgeToProgram(g,this.edgeIndices[g],v)}}}return!r&&n||(this.needToProcess=!0),i?this.scheduleRender():this.render(),this}},{key:"scheduleRender",value:function(){var e=this;return this.renderFrame||(this.renderFrame=requestAnimationFrame((function(){e.render()}))),this}},{key:"scheduleRefresh",value:function(e){return this.refresh(T(T({},e),{},{schedule:!0}))}},{key:"getViewportZoomedState",value:function(e,t){var n=this.camera.getState(),i=n.ratio,r=n.angle,o=n.x,a=n.y,s=this.settings,h=s.minCameraRatio,u=s.maxCameraRatio;"number"==typeof u&&(t=Math.min(t,u)),"number"==typeof h&&(t=Math.max(t,h));var c=t/i,d={x:this.width/2,y:this.height/2},l=this.viewportToFramedGraph(e),f=this.viewportToFramedGraph(d);return{angle:r,x:(l.x-f.x)*(1-c)+o,y:(l.y-f.y)*(1-c)+a,ratio:t}}},{key:"viewRectangle",value:function(){var e=this.viewportToFramedGraph({x:0,y:0}),t=this.viewportToFramedGraph({x:this.width,y:0}),n=this.viewportToFramedGraph({x:0,y:this.height});return{x1:e.x,y1:e.y,x2:t.x,y2:t.y,height:t.y-n.y}}},{key:"framedGraphToViewport",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!!t.cameraState||!!t.viewportDimensions||!!t.graphDimensions,i=ke(t.matrix?t.matrix:n?Se(t.cameraState||this.camera.getState(),t.viewportDimensions||this.getDimensions(),t.graphDimensions||this.getGraphDimensions(),t.padding||this.getStagePadding()):this.matrix,e);return{x:(1+i.x)*this.width/2,y:(1-i.y)*this.height/2}}},{key:"viewportToFramedGraph",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!!t.cameraState||!!t.viewportDimensions||!t.graphDimensions,i=ke(t.matrix?t.matrix:n?Se(t.cameraState||this.camera.getState(),t.viewportDimensions||this.getDimensions(),t.graphDimensions||this.getGraphDimensions(),t.padding||this.getStagePadding(),!0):this.invMatrix,{x:e.x/this.width*2-1,y:1-e.y/this.height*2});return isNaN(i.x)&&(i.x=0),isNaN(i.y)&&(i.y=0),i}},{key:"viewportToGraph",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.normalizationFunction.inverse(this.viewportToFramedGraph(e,t))}},{key:"graphToViewport",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.framedGraphToViewport(this.normalizationFunction(e),t)}},{key:"getGraphToViewportRatio",value:function(){var e={x:0,y:0},t={x:1,y:1},n=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),i=this.graphToViewport(e),r=this.graphToViewport(t);return Math.sqrt(Math.pow(i.x-r.x,2)+Math.pow(i.y-r.y,2))/n}},{key:"getBBox",value:function(){return this.nodeExtent}},{key:"getCustomBBox",value:function(){return this.customBBox}},{key:"setCustomBBox",value:function(e){return this.customBBox=e,this.scheduleRender(),this}},{key:"kill",value:function(){this.emit("kill"),this.removeAllListeners(),this.unbindCameraHandlers(),window.removeEventListener("resize",this.activeListeners.handleResize),this.mouseCaptor.kill(),this.touchCaptor.kill(),this.unbindGraphHandlers(),this.clearIndices(),this.clearState(),this.nodeDataCache={},this.edgeDataCache={},this.highlightedNodes.clear(),this.renderFrame&&(cancelAnimationFrame(this.renderFrame),this.renderFrame=null),this.renderHighlightedNodesFrame&&(cancelAnimationFrame(this.renderHighlightedNodesFrame),this.renderHighlightedNodesFrame=null);for(var e=this.container;e.firstChild;)e.removeChild(e.firstChild);for(var t in this.canvasContexts={},this.webGLContexts={},this.elements={},this.nodePrograms)this.nodePrograms[t].kill();for(var n in this.nodeHoverPrograms)this.nodeHoverPrograms[n].kill();for(var i in this.edgePrograms)this.edgePrograms[i].kill();for(var r in this.nodePrograms={},this.nodeHoverPrograms={},this.edgePrograms={},this.elements)this.killLayer(r)}},{key:"scaleSize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.camera.ratio;return e/this.settings.zoomToSizeRatioFunction(t)*("positions"===this.getSetting("itemSizesReference")?t*this.graphToViewportRatio:1)}},{key:"getCanvases",value:function(){var e={};for(var t in this.elements)this.elements[t]instanceof HTMLCanvasElement&&(e[t]=this.elements[t]);return e}}])}(ge);function nt(e,t,n,i){var r=document.createElement("button");return r.setAttribute("data-tooltip",n),r.innerHTML=e,i&&(r.className=i),r.addEventListener("click",t),r}function it(e,t){var n=t.canvas.getBoundingClientRect().width,i=t.measureText(e.label||"").width,r=Math.round(i+6),o=e.x+e.size+2,a=!0;if(o+r>n){var s=n-(e.x+e.size+2);e.x-e.size-2>s&&(o=e.x-r-e.size-2+3,a=!1)}return{x:o,isRightSide:a}}function rt(e,t,n){if(t.label){var i=it(t,e).x,r=n.labelSize,o=n.labelFont,a=n.labelWeight,s=n.labelColor.attribute?t[n.labelColor.attribute]||n.labelColor.color||"#000":n.labelColor.color;e.shadowColor="transparent",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0,e.fillStyle=s,e.font="".concat(a," ").concat(r,"px ").concat(o);var h=t.y+r/3;e.fillText(t.label,i,h)}}function ot(e,t,n){var i=n.labelSize,r=n.labelFont,o=n.labelWeight;e.font="".concat(o," ").concat(i,"px ").concat(r),e.save(),function(e,t,n){if(e.fillStyle="#FFF",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=8,e.shadowColor="#000","string"==typeof t.label){var i=e.measureText(t.label).width,r=Math.round(i+6),o=Math.round(n.labelSize+4),a=Math.max(t.size,n.labelSize/2)+2,s=it(t,e).isRightSide,h=o/2,u=Math.sqrt(Math.max(0,a*a-h*h)),c=Math.asin(h/a);e.beginPath(),s?(e.moveTo(t.x+u,t.y+h),e.lineTo(t.x+(a+r),t.y+h),e.lineTo(t.x+(a+r),t.y-h),e.lineTo(t.x+u,t.y-h),e.arc(t.x,t.y,a,-c,+c,!0)):(e.moveTo(t.x-u,t.y+h),e.lineTo(t.x-(a+r+3),t.y+h),e.lineTo(t.x-(a+r+3),t.y-h),e.lineTo(t.x-u,t.y-h),e.arc(t.x,t.y,a,Math.PI-c,Math.PI+c,!0)),e.closePath(),e.fill()}else e.beginPath(),e.arc(t.x,t.y,t.size+2,0,2*Math.PI),e.closePath(),e.fill()}(e,t,n),rt(e,t,n),t.hovered&&n.defaultHoverTemplate&&(t.htmlHover||n.showHtmlHoverDefault&&!1!==t.htmlHover)&&function(e,t,n,i){if(n.defaultHoverTemplate){var r=function(e,t){return e.replace(/\${(\w+)}/g,(function(e,n){return void 0!==t[n]?String(t[n]):e}))}(n.defaultHoverTemplate,t),o=function(e){var t=document.getElementById("node-hover-overlay");return t||((t=document.createElement("div")).id="node-hover-overlay",t.style.position="absolute",t.style.pointerEvents="none",t.style.border="1px solid #ccc",t.style.borderRadius="4px",t.style.backgroundColor="#fff",t.style.padding="4px",t.style.zIndex="100",document.body.appendChild(t),e.canvas.addEventListener("mousemove",(function(e){t&&"block"===t.style.display&&(t.style.left=e.clientX+2+"px",t.style.top=e.clientY+2+"px")}))),t}(e);o.innerHTML=r,o.style.display="block";var a=e.canvas.getBoundingClientRect();o.style.left=a.left+i.x+2+"px",o.style.top=a.top+i.y+2+"px"}}(e,t,n,{x:it(t,e).x,y:t.y+i+4}),e.restore()}var at=n(803);function st(){var e=10,t=50,n=1e4,i=1e-4;function r(e,t,n,i){e[t+2]+=i,e[n+2]-=i}function o(e,t,n,i){e[t+3]+=i,e[n+3]-=i}function a(e,n,i,a,s,h){var u,c=e[n+0]-e[i+0],d=e[n+1]-e[i+1],l=c*c+d*d,f=e[n+8]+e[i+8],p=Math.sqrt(c*c+d*d)-f,g=Math.sqrt(l),v=a*e[n+6]*e[i+6];if(s){var m=null!=h?h:150*Math.sqrt(a);u=p>0?v/(g*p*(1+p/m)):t*v}else u=p>0?v/(g*p):t*v;r(e,n,i,c*u),o(e,n,i,d*u)}function s(e,t,n,i,a,s,h){void 0===h&&(h=2);var u=e[t+0]-e[n+0],c=e[t+1]-e[n+1],d=u*u+c*c;if(d>0){var l,f=Math.sqrt(d),p=i*e[t+6]*e[n+6];r(e,t,n,u*(l=a?p/((1+f/(null!=s?s:150*Math.sqrt(i)))*Math.pow(f,h)):p/Math.pow(f,h))),o(e,t,n,c*l)}}var h=function(e,t){var n=e?a:s;return function(e,i,r,o,a){return n(e,i,r,o,t,a)}};function u(e,t,n,i){var a=e[t+0]-e[n+0],s=e[t+1]-e[n+1],h=-i;r(e,t,n,a*h),o(e,t,n,s*h)}function c(e,t,n,i){var a=e[t+0]-e[n+0],s=e[t+1]-e[n+1],h=Math.sqrt(a*a+s*s),u=-i*(h-e[t+8]-e[n+8])/h;r(e,t,n,a*u),o(e,t,n,s*u)}function d(e,t,n,i){var a=e[t+0]-e[n+0],s=e[t+1]-e[n+1],h=Math.sqrt(a*a+s*s);if(h>0){var u=-i*Math.log(1+h)/h;r(e,t,n,a*u),o(e,t,n,s*u)}}function l(e,t,n,i){var a=e[t+0]-e[n+0],s=e[t+1]-e[n+1],h=Math.sqrt(a*a+s*s)-e[t+8]-e[n+8];if(h>0){var u=-i*Math.log(1+h)/h;r(e,t,n,a*u),o(e,t,n,s*u)}}function f(e,t){var n=e[t+4]-e[t+2],i=e[t+5]-e[t+3];return e[t+6]*Math.sqrt(Math.pow(n,2)+Math.pow(i,2))}function p(e,t){var n=e[t+4]+e[t+2],i=e[t+5]+e[t+3];return Math.sqrt(Math.pow(n,2)+Math.pow(i,2))/2}function g(n,i,r,o){for(var a=n.adjustSizes,s=n.maxForce?n.maxForce:t,g=0;g<i.length;g+=e)i[g+4]=i[g+2],i[g+5]=i[g+3],i[g+2]=0,i[g+3]=0;!function(t,n,i){var r,o=t.scalingRatio,a=t.adjustSizes,s=null!==(r=t.decayRepulsion)&&void 0!==r&&r,u=t.barnesHutThreshold,c=t.barnesHutTheta;i.forEach((function(t){if(t.length>=u)!function(t,n,i,r,o,a){void 0===a&&(a=!1),n.length;var s=function(t,n){var i,r,o,a=[],s=1/0,h=-1/0,u=1/0,c=-1/0;n.forEach((function(n){var i=n*e;s=Math.min(s,t[i+0]),h=Math.max(h,t[i+0]),u=Math.min(u,t[i+1]),c=Math.max(c,t[i+1])}));var d=h-s,l=c-u;d>l?c=(u-=(d-l)/2)+d:h=(s-=(l-d)/2)+l,a[0]=-1,a[1]=(s+h)/2,a[2]=(u+c)/2,a[3]=Math.max(h-s,c-u),a[4]=-1,a[5]=-1,a[6]=0,a[7]=0,a[8]=0;var f=1;return n.forEach((function(n){var s=n*e,h=0;for(o=3;;){if(!(a[h+5]>=0)){if(a[h+0]<0){a[h+0]=s;break}a[h+5]=9*f;var u=a[h+3]/2,c=a[h+5];if(a[c+0]=-1,a[c+1]=a[h+1]-u,a[c+2]=a[h+2]-u,a[c+3]=u,a[c+4]=c+9,a[c+5]=-1,a[c+6]=0,a[c+7]=0,a[c+8]=0,a[(c+=9)+0]=-1,a[c+1]=a[h+1]-u,a[c+2]=a[h+2]+u,a[c+3]=u,a[c+4]=c+9,a[c+5]=-1,a[c+6]=0,a[c+7]=0,a[c+8]=0,a[(c+=9)+0]=-1,a[c+1]=a[h+1]+u,a[c+2]=a[h+2]-u,a[c+3]=u,a[c+4]=c+9,a[c+5]=-1,a[c+6]=0,a[c+7]=0,a[c+8]=0,a[(c+=9)+0]=-1,a[c+1]=a[h+1]+u,a[c+2]=a[h+2]+u,a[c+3]=u,a[c+4]=a[h+4],a[c+5]=-1,a[c+6]=0,a[c+7]=0,a[c+8]=0,f+=4,i=t[a[h+0]+0]<a[h+1]?t[a[h+0]+1]<a[h+2]?a[h+5]:a[h+5]+9:t[a[h+0]+1]<a[h+2]?a[h+5]+18:a[h+5]+27,a[h+6]=t[a[h+0]+6],a[h+7]=t[a[h+0]+0],a[h+8]=t[a[h+0]+1],a[i+0]=a[h+0],a[h+0]=-1,r=t[s+0]<a[h+1]?t[s+1]<a[h+2]?a[h+5]:a[h+5]+9:t[s+1]<a[h+2]?a[h+5]+18:a[h+5]+27,i===r){if(o--){h=i;continue}o=3;break}a[r+0]=s;break}i=t[s+0]<a[h+1]?t[s+1]<a[h+2]?a[h+5]:a[h+5]+9:t[s+1]<a[h+2]?a[h+5]+18:a[h+5]+27,a[h+7]=(a[h+7]*a[h+6]+t[s+0]*t[s+6])/(a[h+6]+t[s+6]),a[h+8]=(a[h+8]*a[h+6]+t[s+1]*t[s+6])/(a[h+6]+t[s+6]),a[h+6]+=t[s+6],h=i}})),a}(t,n),h=y(t,n);n.forEach((function(n){for(var u=n*e,c=0;;)if(s[c+5]>=0){var d=Math.pow(t[u+0]-s[c+7],2)+Math.pow(t[u+1]-s[c+8],2),l=s[c+3];if(4*l*l/d<o){var f=t[u+0]-s[c+7],p=t[u+1]-s[c+8],g=void 0,v=i*t[u+6]*s[c+6],m=Math.sqrt(d);if(!0===r?(b=m-2*t[u+8])>0?(g=a?v/(m*b*(1+b/h)):v/(b*m),t[u+2]+=f*g,t[u+3]+=p*g):b<0&&(g=v/Math.sqrt(d),t[u+2]+=f*g,t[u+3]+=p*g):d>0&&(g=a?v/((1+m/h)*d):v/d,t[u+2]+=f*g,t[u+3]+=p*g),(c=s[c+4])<0)break;continue}c=s[c+5]}else{var y=s[c+0];if(y>=0&&y!==u)if(d=(f=t[u+0]-t[y+0])*f+(p=t[u+1]-t[y+1])*p,m=Math.sqrt(d),g=void 0,v=i*t[u+6]*t[y+6],!0===r){var b=m-t[u+8]-t[y+8];Math.pow(b,2),b>0?(g=a?v/(m*b*(1+b/h)):v/(m*b),t[u+2]+=f*g,t[u+3]+=p*g):b<=0&&(g=2*v,t[u+2]+=f*g,t[u+3]+=p*g)}else d>0&&(g=a?v/((1+m/h)*d):v/d,t[u+2]+=f*g,t[u+3]+=p*g);if((c=s[c+4])<0)break}}))}(n,t,o,a,Math.pow(c,2),s);else{var i=h(a,s);!function(t,n,i,r){for(var o=y(t,n),a=0;a<n.length;a+=1)for(var s=n[a]*e,h=0;h<a;h+=1)r(t,s,n[h]*e,i,o)}(n,t,o,i)}}))}(n,i,o);for(var v=r.length,m=0;m<v;m+=3){var b=r[m+0],w=r[m+1],x=r[m+2];!0===a?n.linLogMode?l(i,b,w,x):c(i,b,w,x):n.linLogMode?d(i,b,w,x):u(i,b,w,x)}if(!0===a){for(g=0;g<i.length;g+=e)if(1!==i[g+9]){var C=Math.sqrt(Math.pow(i[g+2],2)+Math.pow(i[g+3],2));C>s&&(i[g+2]=i[g+2]*t/C,i[g+3]=i[g+3]*t/C);var _=f(i,g),E=p(i,g),k=1+Math.sqrt(_),S=i[g+7]*Math.log(1+E)*.5/k;i[g+7]=Math.min(1,Math.sqrt(S*(Math.pow(i[g+2],2)+Math.pow(i[g+3],2))/k));var L=S/n.slowDown;i[g+0]+=i[g+2]*L,i[g+1]+=i[g+3]*L}}else for(g=0;g<i.length;g+=e)1!==i[g+9]&&(_=f(i,g),E=p(i,g),k=1+Math.sqrt(_),S=i[g+7]*Math.log(1+E)/k,i[g+7]=Math.min(1,Math.sqrt(S*(Math.pow(i[g+2],2)+Math.pow(i[g+3],2))/k)),L=S/n.slowDown,i[g+0]+=i[g+2]*L,i[g+1]+=i[g+3]*L);return{}}var v=function(e,t,n,i){for(var r=t.length/3,o=0,a=0,s=n<r,h=0;h<Math.min(n,r);h++){var u=s?Math.floor(Math.random()*r):h,c=t[3*u+0],d=t[3*u+1],l=e[c+8],f=e[d+8],p=e[c+0]-e[d+0],g=e[c+1]-e[d+1],v=(l+f)*i/Math.sqrt(Math.pow(p,2)+Math.pow(g,2));v>a&&(a=v),v>1&&o++}return{fracEdgesTooShort:o/Math.min(n,r),maxShortnessRatio:a}},m=function(t){for(var n=0,i=0,r=0,o=0,a=t.length,s=0;s<a;s+=e)t[s+0]<n&&(n=t[s+0]),t[s+0]>i&&(i=t[s+0]),t[s+1]<r&&(r=t[s+1]),t[s+1]>o&&(o=t[s+1]);return{xDim:i-n,yDim:o-r}},y=function(t,n){var i=function(t,n){var i=0,r=0,o=0,a=0;return n.forEach((function(n){var s=n*e;t[s+0]<i&&(i=t[s+0]),t[s+0]>r&&(r=t[s+0]),t[s+1]<o&&(o=t[s+1]),t[s+1]>a&&(a=t[s+1])})),{xDim:r-i,yDim:a-o}}(t,n),r=i.xDim,o=i.yDim;return Math.max(Math.max(r,o)/2,150)},b=function(t,n,i){n.forEach((function(n){n.forEach((function(n){var r=n;t[r*e+0]=t[r*e+0]*i,t[r*e+1]=t[r*e+1]*i}))}))},w=function(e,t,r,o,a){var s=m(e),h=s.xDim,u=s.yDim,c=Math.max(r/h,o/u);b(e,t,c),a.scalingRatio=Math.max(Math.min(a.scalingRatio*Math.pow(c,2),n),i)};self.onmessage=function(r){var o,a,s=r.data,h=new Float32Array(s.nodes),u=new Float32Array(s.edges),c=s.components;"layoutStep"===s.__messageId?g(s.settings,h,u,c):(console.time("layout"),function(r,o,a,s,h,u){var c=s.expectedDims?s.expectedDims:[650,400],d=c[0],l=c[1];if(s.maxForce=s.maxForce||t,s.warmupLayout){var f=s.adjustSizes;s.adjustSizes=!1;var p=s.decayRepulsion;s.decayRepulsion=!1;for(var y=0;y<h/5;y++)g(s,r,o,a);w(r,a,d,l,s);for(var x=0;x<r.length;x+=e)r[x+2]=0,r[x+3]=0;s.adjustSizes=f,s.decayRepulsion=p,s.warmupLayout=!1}for(var C=u,_=0;_<C-1;_++){for(y=0;y<h/C;y++)g(s,r,o,a);if(s.adjustSizes){var E=v(r,o,2e3,1.2),k=E.fracEdgesTooShort,S=E.maxShortnessRatio;if(k>.002){var L=Math.min(S,5),N=Math.pow(L,2);s.scalingRatio=Math.max(Math.min(s.scalingRatio*N,n),i),console.log("scalingRatio",s.scalingRatio),b(r,a,L)}else{var A=m(r),T=A.xDim,M=A.yDim,D=Math.min(d/T,l/M),R=Math.max(D,Math.min(S,1));s.scalingRatio=Math.max(Math.min(s.scalingRatio*Math.pow(R,2),n),i),console.log("scalingRatio",s.scalingRatio),b(r,a,R)}}else w(r,a,d,l,s),console.log("scalingRatio",s.scalingRatio);for(x=0;x<r.length;x+=e)r[x+2]=0,r[x+3]=0}for(y=0;y<h/C;y++)g(s,r,o,a)}(h,u,c,s.settings,s.iterations,null!==(o=s.nAnnealingSteps)&&void 0!==o?o:5),console.timeEnd("layout")),self.postMessage({nodes:h.buffer,edges:u.buffer,settings:s.settings,__messageId:s.__messageId,__seqId:null!==(a=s.__seqId)&&void 0!==a?a:null},[h.buffer,u.buffer])}}var ht={value:()=>{}};function ut(){for(var e,t=0,n=arguments.length,i={};t<n;++t){if(!(e=arguments[t]+"")||e in i||/[\s.]/.test(e))throw new Error("illegal type: "+e);i[e]=[]}return new ct(i)}function ct(e){this._=e}function dt(e,t){for(var n,i=0,r=e.length;i<r;++i)if((n=e[i]).name===t)return n.value}function lt(e,t,n){for(var i=0,r=e.length;i<r;++i)if(e[i].name===t){e[i]=ht,e=e.slice(0,i).concat(e.slice(i+1));break}return null!=n&&e.push({name:t,value:n}),e}ct.prototype=ut.prototype={constructor:ct,on:function(e,t){var n,i,r=this._,o=(i=r,(e+"").trim().split(/^|\s+/).map((function(e){var t="",n=e.indexOf(".");if(n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!i.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}}))),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++a<s;)if(n=(e=o[a]).type)r[n]=lt(r[n],e.name,t);else if(null==t)for(n in r)r[n]=lt(r[n],e.name,null);return this}for(;++a<s;)if((n=(e=o[a]).type)&&(n=dt(r[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new ct(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,i,r=new Array(n),o=0;o<n;++o)r[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=0,n=(i=this._[e]).length;o<n;++o)i[o].value.apply(t,r)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],r=0,o=i.length;r<o;++r)i[r].value.apply(t,n)}};const ft=ut;var pt,gt,vt=0,mt=0,yt=0,bt=0,wt=0,xt=0,Ct="object"==typeof performance&&performance.now?performance:Date,_t="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Et(){return wt||(_t(kt),wt=Ct.now()+xt)}function kt(){wt=0}function St(){this._call=this._time=this._next=null}function Lt(e,t,n){var i=new St;return i.restart(e,t,n),i}function Nt(){wt=(bt=Ct.now())+xt,vt=mt=0;try{!function(){Et(),++vt;for(var e,t=pt;t;)(e=wt-t._time)>=0&&t._call.call(void 0,e),t=t._next;--vt}()}finally{vt=0,function(){for(var e,t,n=pt,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:pt=t);gt=e,Tt(i)}(),wt=0}}function At(){var e=Ct.now(),t=e-bt;t>1e3&&(xt-=t,bt=e)}function Tt(e){vt||(mt&&(mt=clearTimeout(mt)),e-wt>24?(e<1/0&&(mt=setTimeout(Nt,e-Ct.now()-xt)),yt&&(yt=clearInterval(yt))):(yt||(bt=Ct.now(),yt=setInterval(At,1e3)),vt=1,_t(Nt)))}St.prototype=Lt.prototype={constructor:St,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?Et():+n)+(null==t?0:+t),this._next||gt===this||(gt?gt._next=this:pt=this,gt=this),this._call=e,this._time=n,Tt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Tt())}};const Mt=4294967296;function Dt(e){return e.x}function Rt(e){return e.y}var Gt=Math.PI*(3-Math.sqrt(5));function Pt(e){var t,n=1,i=.001,r=1-Math.pow(i,1/300),o=0,a=.6,s=new Map,h=Lt(d),u=ft("tick","end"),c=function(){let e=1;return()=>(e=(1664525*e+1013904223)%Mt)/Mt}();function d(){l(),u.call("tick",t),n<i&&(h.stop(),u.call("end",t))}function l(i){var h,u,c=e.length;void 0===i&&(i=1);for(var d=0;d<i;++d)for(n+=(o-n)*r,s.forEach((function(e){e(n)})),h=0;h<c;++h)null==(u=e[h]).fx?u.x+=u.vx*=a:(u.x=u.fx,u.vx=0),null==u.fy?u.y+=u.vy*=a:(u.y=u.fy,u.vy=0);return t}function f(){for(var t,n=0,i=e.length;n<i;++n){if((t=e[n]).index=n,null!=t.fx&&(t.x=t.fx),null!=t.fy&&(t.y=t.fy),isNaN(t.x)||isNaN(t.y)){var r=10*Math.sqrt(.5+n),o=n*Gt;t.x=r*Math.cos(o),t.y=r*Math.sin(o)}(isNaN(t.vx)||isNaN(t.vy))&&(t.vx=t.vy=0)}}function p(t){return t.initialize&&t.initialize(e,c),t}return null==e&&(e=[]),f(),t={tick:l,restart:function(){return h.restart(d),t},stop:function(){return h.stop(),t},nodes:function(n){return arguments.length?(e=n,f(),s.forEach(p),t):e},alpha:function(e){return arguments.length?(n=+e,t):n},alphaMin:function(e){return arguments.length?(i=+e,t):i},alphaDecay:function(e){return arguments.length?(r=+e,t):+r},alphaTarget:function(e){return arguments.length?(o=+e,t):o},velocityDecay:function(e){return arguments.length?(a=1-e,t):1-a},randomSource:function(e){return arguments.length?(c=e,s.forEach(p),t):c},force:function(e,n){return arguments.length>1?(null==n?s.delete(e):s.set(e,p(n)),t):s.get(e)},find:function(t,n,i){var r,o,a,s,h,u=0,c=e.length;for(null==i?i=1/0:i*=i,u=0;u<c;++u)(a=(r=t-(s=e[u]).x)*r+(o=n-s.y)*o)<i&&(h=s,i=a);return h},on:function(e,n){return arguments.length>1?(u.on(e,n),t):u.on(e)}}}function Ft(e,t,n,i){if(isNaN(t)||isNaN(n))return e;var r,o,a,s,h,u,c,d,l,f=e._root,p={data:i},g=e._x0,v=e._y0,m=e._x1,y=e._y1;if(!f)return e._root=p,e;for(;f.length;)if((u=t>=(o=(g+m)/2))?g=o:m=o,(c=n>=(a=(v+y)/2))?v=a:y=a,r=f,!(f=f[d=c<<1|u]))return r[d]=p,e;if(s=+e._x.call(null,f.data),h=+e._y.call(null,f.data),t===s&&n===h)return p.next=f,r?r[d]=p:e._root=p,e;do{r=r?r[d]=new Array(4):e._root=new Array(4),(u=t>=(o=(g+m)/2))?g=o:m=o,(c=n>=(a=(v+y)/2))?v=a:y=a}while((d=c<<1|u)==(l=(h>=a)<<1|s>=o));return r[l]=f,r[d]=p,e}function zt(e,t,n,i,r){this.node=e,this.x0=t,this.y0=n,this.x1=i,this.y1=r}function Ot(e){return e[0]}function It(e){return e[1]}function Bt(e,t,n){var i=new Ut(null==t?Ot:t,null==n?It:n,NaN,NaN,NaN,NaN);return null==e?i:i.addAll(e)}function Ut(e,t,n,i,r,o){this._x=e,this._y=t,this._x0=n,this._y0=i,this._x1=r,this._y1=o,this._root=void 0}function jt(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var Vt=Bt.prototype=Ut.prototype;function Ht(e){return function(){return e}}function Wt(e){return 1e-6*(e()-.5)}function qt(){var e,t,n,i,r,o=Ht(-30),a=1,s=1/0,h=.81;function u(n){var r,o=e.length,a=Bt(e,Dt,Rt).visitAfter(d);for(i=n,r=0;r<o;++r)t=e[r],a.visit(l)}function c(){if(e){var t,n,i=e.length;for(r=new Array(i),t=0;t<i;++t)n=e[t],r[n.index]=+o(n,t,e)}}function d(e){var t,n,i,o,a,s=0,h=0;if(e.length){for(i=o=a=0;a<4;++a)(t=e[a])&&(n=Math.abs(t.value))&&(s+=t.value,h+=n,i+=n*t.x,o+=n*t.y);e.x=i/h,e.y=o/h}else{(t=e).x=t.data.x,t.y=t.data.y;do{s+=r[t.data.index]}while(t=t.next)}e.value=s}function l(e,o,u,c){if(!e.value)return!0;var d=e.x-t.x,l=e.y-t.y,f=c-o,p=d*d+l*l;if(f*f/h<p)return p<s&&(0===d&&(p+=(d=Wt(n))*d),0===l&&(p+=(l=Wt(n))*l),p<a&&(p=Math.sqrt(a*p)),t.vx+=d*e.value*i/p,t.vy+=l*e.value*i/p),!0;if(!(e.length||p>=s)){(e.data!==t||e.next)&&(0===d&&(p+=(d=Wt(n))*d),0===l&&(p+=(l=Wt(n))*l),p<a&&(p=Math.sqrt(a*p)));do{e.data!==t&&(f=r[e.data.index]*i/p,t.vx+=d*f,t.vy+=l*f)}while(e=e.next)}}return u.initialize=function(t,i){e=t,n=i,c()},u.strength=function(e){return arguments.length?(o="function"==typeof e?e:Ht(+e),c(),u):o},u.distanceMin=function(e){return arguments.length?(a=e*e,u):Math.sqrt(a)},u.distanceMax=function(e){return arguments.length?(s=e*e,u):Math.sqrt(s)},u.theta=function(e){return arguments.length?(h=e*e,u):Math.sqrt(h)},u}function Zt(e){var t,n,i,r=Ht(.1);function o(e){for(var r,o=0,a=t.length;o<a;++o)(r=t[o]).vx+=(i[o]-r.x)*n[o]*e}function a(){if(t){var o,a=t.length;for(n=new Array(a),i=new Array(a),o=0;o<a;++o)n[o]=isNaN(i[o]=+e(t[o],o,t))?0:+r(t[o],o,t)}}return"function"!=typeof e&&(e=Ht(null==e?0:+e)),o.initialize=function(e){t=e,a()},o.strength=function(e){return arguments.length?(r="function"==typeof e?e:Ht(+e),a(),o):r},o.x=function(t){return arguments.length?(e="function"==typeof t?t:Ht(+t),a(),o):e},o}function Yt(e){var t,n,i,r=Ht(.1);function o(e){for(var r,o=0,a=t.length;o<a;++o)(r=t[o]).vy+=(i[o]-r.y)*n[o]*e}function a(){if(t){var o,a=t.length;for(n=new Array(a),i=new Array(a),o=0;o<a;++o)n[o]=isNaN(i[o]=+e(t[o],o,t))?0:+r(t[o],o,t)}}return"function"!=typeof e&&(e=Ht(null==e?0:+e)),o.initialize=function(e){t=e,a()},o.strength=function(e){return arguments.length?(r="function"==typeof e?e:Ht(+e),a(),o):r},o.y=function(t){return arguments.length?(e="function"==typeof t?t:Ht(+t),a(),o):e},o}function Xt(e){return e.x+e.vx}function Kt(e){return e.y+e.vy}function Jt(e){var t,n,i,r=1,o=1;function a(){for(var e,a,h,u,c,d,l,f=t.length,p=0;p<o;++p)for(a=Bt(t,Xt,Kt).visitAfter(s),e=0;e<f;++e)h=t[e],d=n[h.index],l=d*d,u=h.x+h.vx,c=h.y+h.vy,a.visit(g);function g(e,t,n,o,a){var s=e.data,f=e.r,p=d+f;if(!s)return t>u+p||o<u-p||n>c+p||a<c-p;if(s.index>h.index){var g=u-s.x-s.vx,v=c-s.y-s.vy,m=g*g+v*v;m<p*p&&(0===g&&(m+=(g=Wt(i))*g),0===v&&(m+=(v=Wt(i))*v),m=(p-(m=Math.sqrt(m)))/m*r,h.vx+=(g*=m)*(p=(f*=f)/(l+f)),h.vy+=(v*=m)*p,s.vx-=g*(p=1-p),s.vy-=v*p)}}}function s(e){if(e.data)return e.r=n[e.data.index];for(var t=e.r=0;t<4;++t)e[t]&&e[t].r>e.r&&(e.r=e[t].r)}function h(){if(t){var i,r,o=t.length;for(n=new Array(o),i=0;i<o;++i)r=t[i],n[r.index]=+e(r,i,t)}}return"function"!=typeof e&&(e=Ht(null==e?1:+e)),a.initialize=function(e,n){t=e,i=n,h()},a.iterations=function(e){return arguments.length?(o=+e,a):o},a.strength=function(e){return arguments.length?(r=+e,a):r},a.radius=function(t){return arguments.length?(e="function"==typeof t?t:Ht(+t),h(),a):e},a}function $t(e,t){var n,i=1;function r(){var r,o,a=n.length,s=0,h=0;for(r=0;r<a;++r)s+=(o=n[r]).x,h+=o.y;for(s=(s/a-e)*i,h=(h/a-t)*i,r=0;r<a;++r)(o=n[r]).x-=s,o.y-=h}return null==e&&(e=0),null==t&&(t=0),r.initialize=function(e){n=e},r.x=function(t){return arguments.length?(e=+t,r):e},r.y=function(e){return arguments.length?(t=+e,r):t},r.strength=function(e){return arguments.length?(i=+e,r):i},r}function Qt(e,t,n){return(t[0]-e[0])*(n[1]-e[1])-(t[1]-e[1])*(n[0]-e[0])}function en(e,t){return e[0]-t[0]||e[1]-t[1]}function tn(e){const t=e.length,n=[0,1];let i,r=2;for(i=2;i<t;++i){for(;r>1&&Qt(e[n[r-2]],e[n[r-1]],e[i])<=0;)--r;n[r++]=i}return n.slice(0,r)}Vt.copy=function(){var e,t,n=new Ut(this._x,this._y,this._x0,this._y0,this._x1,this._y1),i=this._root;if(!i)return n;if(!i.length)return n._root=jt(i),n;for(e=[{source:i,target:n._root=new Array(4)}];i=e.pop();)for(var r=0;r<4;++r)(t=i.source[r])&&(t.length?e.push({source:t,target:i.target[r]=new Array(4)}):i.target[r]=jt(t));return n},Vt.add=function(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return Ft(this.cover(t,n),t,n,e)},Vt.addAll=function(e){var t,n,i,r,o=e.length,a=new Array(o),s=new Array(o),h=1/0,u=1/0,c=-1/0,d=-1/0;for(n=0;n<o;++n)isNaN(i=+this._x.call(null,t=e[n]))||isNaN(r=+this._y.call(null,t))||(a[n]=i,s[n]=r,i<h&&(h=i),i>c&&(c=i),r<u&&(u=r),r>d&&(d=r));if(h>c||u>d)return this;for(this.cover(h,u).cover(c,d),n=0;n<o;++n)Ft(this,a[n],s[n],e[n]);return this},Vt.cover=function(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,i=this._y0,r=this._x1,o=this._y1;if(isNaN(n))r=(n=Math.floor(e))+1,o=(i=Math.floor(t))+1;else{for(var a,s,h=r-n||1,u=this._root;n>e||e>=r||i>t||t>=o;)switch(s=(t<i)<<1|e<n,(a=new Array(4))[s]=u,u=a,h*=2,s){case 0:r=n+h,o=i+h;break;case 1:n=r-h,o=i+h;break;case 2:r=n+h,i=o-h;break;case 3:n=r-h,i=o-h}this._root&&this._root.length&&(this._root=u)}return this._x0=n,this._y0=i,this._x1=r,this._y1=o,this},Vt.data=function(){var e=[];return this.visit((function(t){if(!t.length)do{e.push(t.data)}while(t=t.next)})),e},Vt.extent=function(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},Vt.find=function(e,t,n){var i,r,o,a,s,h,u,c=this._x0,d=this._y0,l=this._x1,f=this._y1,p=[],g=this._root;for(g&&p.push(new zt(g,c,d,l,f)),null==n?n=1/0:(c=e-n,d=t-n,l=e+n,f=t+n,n*=n);h=p.pop();)if(!(!(g=h.node)||(r=h.x0)>l||(o=h.y0)>f||(a=h.x1)<c||(s=h.y1)<d))if(g.length){var v=(r+a)/2,m=(o+s)/2;p.push(new zt(g[3],v,m,a,s),new zt(g[2],r,m,v,s),new zt(g[1],v,o,a,m),new zt(g[0],r,o,v,m)),(u=(t>=m)<<1|e>=v)&&(h=p[p.length-1],p[p.length-1]=p[p.length-1-u],p[p.length-1-u]=h)}else{var y=e-+this._x.call(null,g.data),b=t-+this._y.call(null,g.data),w=y*y+b*b;if(w<n){var x=Math.sqrt(n=w);c=e-x,d=t-x,l=e+x,f=t+x,i=g.data}}return i},Vt.remove=function(e){if(isNaN(o=+this._x.call(null,e))||isNaN(a=+this._y.call(null,e)))return this;var t,n,i,r,o,a,s,h,u,c,d,l,f=this._root,p=this._x0,g=this._y0,v=this._x1,m=this._y1;if(!f)return this;if(f.length)for(;;){if((u=o>=(s=(p+v)/2))?p=s:v=s,(c=a>=(h=(g+m)/2))?g=h:m=h,t=f,!(f=f[d=c<<1|u]))return this;if(!f.length)break;(t[d+1&3]||t[d+2&3]||t[d+3&3])&&(n=t,l=d)}for(;f.data!==e;)if(i=f,!(f=f.next))return this;return(r=f.next)&&delete f.next,i?(r?i.next=r:delete i.next,this):t?(r?t[d]=r:delete t[d],(f=t[0]||t[1]||t[2]||t[3])&&f===(t[3]||t[2]||t[1]||t[0])&&!f.length&&(n?n[l]=f:this._root=f),this):(this._root=r,this)},Vt.removeAll=function(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this},Vt.root=function(){return this._root},Vt.size=function(){var e=0;return this.visit((function(t){if(!t.length)do{++e}while(t=t.next)})),e},Vt.visit=function(e){var t,n,i,r,o,a,s=[],h=this._root;for(h&&s.push(new zt(h,this._x0,this._y0,this._x1,this._y1));t=s.pop();)if(!e(h=t.node,i=t.x0,r=t.y0,o=t.x1,a=t.y1)&&h.length){var u=(i+o)/2,c=(r+a)/2;(n=h[3])&&s.push(new zt(n,u,c,o,a)),(n=h[2])&&s.push(new zt(n,i,c,u,a)),(n=h[1])&&s.push(new zt(n,u,r,o,c)),(n=h[0])&&s.push(new zt(n,i,r,u,c))}return this},Vt.visitAfter=function(e){var t,n=[],i=[];for(this._root&&n.push(new zt(this._root,this._x0,this._y0,this._x1,this._y1));t=n.pop();){var r=t.node;if(r.length){var o,a=t.x0,s=t.y0,h=t.x1,u=t.y1,c=(a+h)/2,d=(s+u)/2;(o=r[0])&&n.push(new zt(o,a,s,c,d)),(o=r[1])&&n.push(new zt(o,c,s,h,d)),(o=r[2])&&n.push(new zt(o,a,d,c,u)),(o=r[3])&&n.push(new zt(o,c,d,h,u))}i.push(t)}for(;t=i.pop();)e(t.node,t.x0,t.y0,t.x1,t.y1);return this},Vt.x=function(e){return arguments.length?(this._x=e,this):this._x},Vt.y=function(e){return arguments.length?(this._y=e,this):this._y};var nn,rn=10,on=function(e){for(var t=Number.MAX_VALUE,n=-Number.MAX_VALUE,i=Number.MAX_VALUE,r=-Number.MAX_VALUE,o=0;o<e.length;o+=rn)e[o+0]<t&&(t=e[o+0]),e[o+0]>n&&(n=e[o+0]),e[o+1]<i&&(i=e[o+1]),e[o+1]>r&&(r=e[o+1]);var a=(t+n)/2,s=(i+r)/2;for(o=0;o<e.length;o+=rn)e[o+0]-=a,e[o+1]-=s},an=function(e,t,n,i,r){void 0===i&&(i=[650,410]),void 0===r&&(r=!1),console.time("component layout"),on(e);var o=i[0],a=i[1],s=r?t.filter((function(e){return e.length>1})):t,h=r?t.filter((function(e){return e.length<=1})):[],u=h.length,c=s.reduce((function(e,t){return e+t.length}),0),d=Math.max(.04,u/(u+5*c)),l=.9*a,f=d*o;console.time("pack singletons");var p=function(e,t,n,i,r){var o={};e.forEach((function(e,t){e.forEach((function(e){o[e]=t}))}));var a,s=0,h=e.map((function(e,n){if(0==e.length)return 5;var i=t[e[0]*rn+8];return s+=i,i})),u=Math.min(3*s,r),c=Math.min(3*s,i);if(r>i){var d=e.map((function(t,n){var i=Object.create(t);return i.radius=1.5*h[n],i.target=-u/2+n/e.length*u,i}));return(a=Pt(d).force("charge",qt().strength(-1)).force("center",$t(0,0)).force("gravityX",Zt().strength(u/c*.2)).force("yPos",Yt().y((function(e){return e.target})).strength(.5)).force("collision",Jt().radius((function(e){return e.radius})).strength(1).iterations(5))).stop(),a.tick(n),{vertices:e.map((function(e){return e.map((function(e){return e}))})).flat(),node_to_component_id:o,components_to_circle_pack:d}}return d=e.map((function(t,n){var i=Object.create(t);return i.radius=h[n],i.target=-c/2+n/e.length*c,i})),(a=Pt(d).force("charge",qt().strength(-1)).force("center",$t(0,0)).force("gravityY",Yt().strength(.2*c/u)).force("xPos",Zt().x((function(e){return e.target})).strength(.5)).force("collision",Jt().radius((function(e){return e.radius})).strength(1).iterations(5))).stop(),a.tick(n),{vertices:e.map((function(e){return e.map((function(e){return e}))})).flat(),node_to_component_id:o,components_to_circle_pack:d}}(h,e,n,f,l);console.timeEnd("pack singletons");var g=Number.MAX_VALUE,v=-Number.MAX_VALUE,m=Number.MAX_VALUE,y=-Number.MAX_VALUE;p.vertices.forEach((function(t){var n=p.node_to_component_id[t],i=p.components_to_circle_pack[n].x,r=p.components_to_circle_pack[n].y,o=e[t*rn+8];v=Math.max(i+o,v),g=Math.min(i-o,g),y=Math.max(r+o,y),m=Math.min(r-o,m)}));var b=u>0?v-g:0;console.log("singletonWidth",b),console.log("singletonSpaceFrac",d);var w=b;if(u>0&&b/o>d){var x=Math.min(1,d/(b/o));p.vertices.map((function(e){var t=p.node_to_component_id[e];p.components_to_circle_pack[t].x*=x,p.components_to_circle_pack[t].y*=x})),w*=x}console.log("adjustedSingletonWidth",w);var C=o-w,_=C/a,E=s.map((function(t){var n=function(e,t){var n=Number.MAX_VALUE,i=-Number.MAX_VALUE,r=Number.MAX_VALUE,o=-Number.MAX_VALUE;return e.forEach((function(e){var a=e,s=t[a*rn+0],h=t[a*rn+1],u=t[a*rn+8];i=Math.max(s+u,i),n=Math.min(s-u,n),o=Math.max(h+u,o),r=Math.min(h-u,r)})),{minX:n,maxX:i,minY:r,maxY:o}}(t,e),i=n.minX,r=n.maxX,o=n.minY;return(r-i)/(n.maxY-o)}));console.log("remainingAspectRatio",_),s.forEach((function(t,n){var i=E[n];(i>=1.1&&_<=.9||i<=.9&&_>=1.1)&&t.forEach((function(t){var n=t,i=e[n*rn+0],r=e[n*rn+1];e[n*rn+0]=-r,e[n*rn+1]=i}))})),console.time("pack components");var k=function(e,t,n,i,r){var o=e.map((function(e){return e.map((function(e){var n=e*rn;return[t[n+0],t[n+1]]}))})),a=o.map((function(e){return function(e){if((n=e.length)<3)return null;var t,n,i=new Array(n),r=new Array(n);for(t=0;t<n;++t)i[t]=[+e[t][0],+e[t][1],t];for(i.sort(en),t=0;t<n;++t)r[t]=[i[t][0],-i[t][1]];var o=tn(i),a=tn(r),s=a[0]===o[0],h=a[a.length-1]===o[o.length-1],u=[];for(t=o.length-1;t>=0;--t)u.push(e[i[o[t]][2]]);for(t=+s;t<a.length-h;++t)u.push(e[i[a[t]][2]]);return u}(e)})),s=a.map((function(e,t){if(null===e){var n=o[t];return 1===n.length?n[0]:[(n[0][0]+n[1][0])/2,(n[0][1]+n[1][1])/2]}return function(e){for(var t,n,i=-1,r=e.length,o=0,a=0,s=e[r-1],h=0;++i<r;)t=s,s=e[i],h+=n=t[0]*s[1]-s[0]*t[1],o+=(t[0]+s[0])*n,a+=(t[1]+s[1])*n;return[o/(h*=3),a/h]}(e)})),h=a.map((function(n,i){var r=s[i],a=0;if(null===n){var h=o[i];if(1===h.length){var u=e[i][0];a=Math.max(t[u*rn+8]+2,6)}else{var c=h[1][0]-h[0][0],d=h[1][1]-h[0][1],l=e[i][0],f=e[i][1],p=t[l*rn+8],g=t[f*rn+8];a=Math.sqrt(Math.pow(c,2)+Math.pow(d,2))/2+p+g}}else for(var v=0;v<n.length;v+=1){var m=n[v],y=(c=m[0]-r[0],d=m[1]-r[1],u=e[i][v],t[u*rn+8]),b=Math.sqrt(Math.pow(c,2)+Math.pow(d,2))+y;a=Math.max(b,a)}return Math.round(a)})),u=h.map((function(e,t){return[e,t]})).sort((function(e,t){return e[0]-t[0]})),c=function(e){return Math.max(3*e*Math.exp(e*Math.log(1/3)/500),.9*e,e-300)},d=0;u.map((function(t){var n=t[0],i=t[1],r=(e[i].length,c(n)),o=4*Math.pow(r,2);d+=o})),console.log("graphArea",d);var l=Math.sqrt(d/(i*r)),f=i*l,p=r*l;console.log("xExtent",f),console.log("yExtent",p);var g=0,v=u.map((function(t){var n=t[0],i=t[1],r=e[i],o=Object.create(r);o.componentID=i;var a=c(n),s=4*Math.pow(a,2);return g+=s/2,o.radius=a,o.target=f*g/d,o.x=o.target,o.y=(p/2-a)*(2/Math.PI)*Math.asin(Math.sin(2*Math.PI*(d/s)*o.x)),g+=.5*s,o})),m=Pt(v).force("charge",qt().strength((function(e){return-.005*d/Math.pow(e.radius,2)}))).force("xPos",Zt().x((function(e){return e.target})).strength(.9)).force("gravityY",Yt().strength(.3)).force("collision",Jt().radius((function(e){return e.radius})).strength(1).iterations(5));m.stop(),m.tick(n);var y=e.map((function(e){return e.map((function(e){return e}))})).flat(),b={};return u.forEach((function(t,n){t[0];var i=t[1];e[i].forEach((function(e){b[e]=n}))})),{vertices:y,node_to_component_id:b,components_to_circle_pack:v,polygon_centroids_initial:s}}(s,e,n,C,a);console.timeEnd("pack components");var S=Number.MAX_VALUE,L=-Number.MAX_VALUE,N=Number.MAX_VALUE,A=-Number.MAX_VALUE;if(k.components_to_circle_pack.forEach((function(t,n){var i=t.componentID;t.forEach((function(n){var r=k.polygon_centroids_initial[i],o=t.x+e[n*rn+0]-r[0],a=t.y+e[n*rn+1]-r[1];e[n*rn+0]=o,e[n*rn+1]=a;var s=e[n*rn+8];L=Math.max(L,o+s),S=Math.min(S,o-s),A=Math.max(A,a+s),N=Math.min(N,a-s)}))})),0===c)p.vertices.forEach((function(t){var n=p.node_to_component_id[t],i=p.components_to_circle_pack[n].x,r=p.components_to_circle_pack[n].y,o=f/(v-g),a=l/(y-m);e[t*rn+0]=i*o,e[t*rn+1]=r*a}));else{var T=(A+N)/2,M=(L-S)/C,D=M*f/(v-g),R=M*l/(y-m);console.log("singleton scale factors",D,R),v=-1/0,g=1/0,p.vertices.forEach((function(t){var n=p.node_to_component_id[t],i=p.components_to_circle_pack[n].x,r=p.components_to_circle_pack[n].y,o=S-i*D;e[t*rn+0]=o;var a=T+r*R;e[t*rn+1]=a;var s=e[t*rn+8];v=Math.max(o+s,v),g=Math.min(o-s,g)}));var G=v-S+.1*(v-g);p.vertices.forEach((function(t){e[t*rn+0]-=G}))}on(e),console.timeEnd("component layout")},sn=function(){return sn=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},sn.apply(this,arguments)},hn=n(739),un=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0);var i=new Float32Array(e.order*rn),r=new Float32Array(3*e.size),o={},a=0;return e.forEachNode((function(e,t){o[e]=a,i[a+0]=t.x,i[a+1]=t.y,i[a+2]=0,i[a+3]=0,i[a+4]=0,i[a+5]=0,i[a+6]=1,i[a+7]=1,i[a+8]=t.size,i[a+9]=t.fixed?1:0,a+=rn})),a=0,e.forEachEdge((function(e,s,h,u,c,d,l){var f=o[h],p=o[u],g=t&&s.weight||1;n&&(i[f+6]+=g,i[p+6]+=g),r[a+0]=f,r[a+1]=p,r[a+2]=g,a+=3})),{nodes:i,edges:r}},cn=function(e,t){var n=0;e.updateEachNodeAttributes((function(e,i){var r=i.fixed?i:sn(sn({},i),{x:t[n+0],y:t[n+1]});return n+=rn,r}))},dn=function(){function e(e,t,n){var i=this;this.graph=e,this.graphComponents=(0,at.kS)(e).map((function(e){return e.map(Number)})),this.params=t,this.frameID=null,this.nextWorkerSeqId=null,this.workerTimerId=null,this.running=!1,this.graphArrays=un(e),this.graphArrays&&this.updateNodePropsArrays(this.graphArrays),this.worker=hn.createWorker(st),this.worker.onmessage=function(e){return i.onWorkerMessage(e)},this.worker.onerror=function(e){return i.onWorkerError(e)},this.shouldUpdateLayoutArrays=!1,this.workerRunning=!1,this.positionsUpdated=!1,this.niters=0,this.maxiters=n.maxiters,this.miniters=n.miniters,this.convergenceThreshold=n.convergenceThreshold}return e.prototype.isRunning=function(){return this.running},e.prototype.resetNIters=function(){this.niters=0},e.prototype.updateNodePropsArrays=function(e){var t=0,n=e;return this.graph.forEachNode((function(e,i){i.fixed&&(n.nodes[t+0]=i.x,n.nodes[t+1]=i.y,n.nodes[t+2]=0,n.nodes[t+3]=0),n.nodes[t+9]=i.fixed?1:0,t+=rn})),n},e.prototype.forceNodePositionUpdate=function(){this.frameID||this.workerRunning?this.shouldUpdateLayoutArrays=!0:this.updateLayoutArrayNodePositions()},e.prototype.updateLayoutArrayNodePositions=function(){var e=this.graphArrays;if(e){var t=0;this.graph.forEachNode((function(n,i){e.nodes[t+0]=i.x,e.nodes[t+1]=i.y,e.nodes[t+2]=0,e.nodes[t+3]=0,e.nodes[t+4]=0,e.nodes[t+5]=0,t+=rn}))}},e.prototype.hasConverged=function(){var e=0;if(!this.graphArrays)return!1;for(e=0;e<this.graphArrays.nodes.length;e+=rn)if(this.graphArrays.nodes[e+7]>this.convergenceThreshold)return!1;return!0},e.prototype.onWorkerMessage=function(e){var t=e.data;this.graphArrays.nodes=new Float32Array(t.nodes),this.graphArrays.edges=new Float32Array(t.edges),this.graphArrays.nodes.length!=this.graph.order*rn&&(console.log("graphArrays not the correct size. rebuilding."),this.graphArrays=un(this.graph)),this.positionsUpdated=!0,this.shouldUpdateLayoutArrays&&(this.updateLayoutArrayNodePositions(),this.shouldUpdateLayoutArrays=!1),this.workerRunning=!1,this.workerTimerId&&(window.clearTimeout(this.workerTimerId),this.workerTimerId=null)},e.prototype.onWorkerError=function(e){var t=this;console.log(e),this.worker.terminate(),this.worker=hn.createWorker(st),this.worker.onmessage=function(e){return t.onWorkerMessage(e)},this.worker.onerror=function(e){return t.onWorkerError(e)},this.shouldUpdateLayoutArrays=!1,this.workerRunning=!1,this.positionsUpdated=!1,this.workerTimerId=null},e.prototype.runFrame=function(){var e=this;if(this.positionsUpdated&&!this.shouldUpdateLayoutArrays){cn(this.graph,this.graphArrays.nodes);var t=0;this.graph.updateEachNodeAttributes((function(n,i){var r=sn(sn({},i),{trueX:Math.round(100*e.graphArrays.nodes[t*rn+0])/100,trueY:Math.round(100*e.graphArrays.nodes[t*rn+1])/100});return t++,r})),this.positionsUpdated=!1,this.niters+=1,this.niters>this.maxiters?(console.log("stopping animation"),this.stop()):this.niters>this.miniters&&this.hasConverged()&&this.stop()}if(this.shouldUpdateLayoutArrays&&(this.updateLayoutArrayNodePositions(),this.shouldUpdateLayoutArrays=!1),!this.workerRunning&&this.running&&this.graphArrays.nodes.buffer.byteLength>0){this.updateNodePropsArrays(this.graphArrays);var n={iterations:1,settings:this.params.settings,nodes:this.graphArrays.nodes.buffer,edges:this.graphArrays.edges.buffer,components:this.graphComponents,__messageId:"layoutStep",__seqId:this.frameID};this.nextWorkerSeqId=n.__seqId,this.worker.postMessage(n,[this.graphArrays.nodes.buffer,this.graphArrays.edges.buffer]),this.workerRunning=!0,this.workerTimerId=window.setTimeout((function(){return e.onWorkerError("Worker timed out")}),500)}this.running&&(this.frameID=window.requestAnimationFrame((function(){return e.runFrame()})))},e.prototype.stop=function(){return this.running=!1,this.resetNIters(),null!==this.frameID&&(window.cancelAnimationFrame(this.frameID),this.frameID=null),this},e.prototype.start=function(){this.running||(this.running=!0,this.runFrame())},e.prototype.kill=function(){this.stop(),this.worker.terminate()},e}(),ln=n(847),fn=n(739),pn=function(e,t,n){return void 0===n&&(n=!0),r=function(){var i,r,o,a,s,h,u,c;return function(e,t){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(h){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,h])}}}(this,(function(d){switch(d.label){case 0:if(!me()(e))throw new Error("graphology-layout-forceatlas2: the given graph is not a valid graphology instance.");if(i=t.iterations,r=(0,at.kS)(e).map((function(e){return e.map(Number)})),"number"!=typeof i)throw new Error("graphology-layout-forceatlas2: invalid number of iterations.");if(i<=0)throw new Error("graphology-layout-forceatlas2: you should provide a positive number of iterations.");if(o=fn.assign({},ln,t.settings),a=fn.validateSettings(o))throw new Error("graphology-layout-forceatlas2: ".concat(a.message));return s=un(e),u=fn.createWorker(st),c={iterations:i,settings:o,nodes:s.nodes.buffer,edges:s.edges.buffer,components:r,__messageId:"initialGraphLayout"},u.postMessage(c,[s.nodes.buffer,s.edges.buffer]),[4,new Promise((function(e){u.onmessage=function(t){e({nodes:new Float32Array(t.data.nodes),settings:t.data.settings}),u.terminate()}}))];case 1:return h=d.sent(),n&&an(h.nodes,r,100,o.expectedDims,o.layoutSingletonsSeparately),cn(e,h.nodes),[2,h.settings]}}))},new((i=void 0)||(i=Promise))((function(e,t){function n(e){try{a(r.next(e))}catch(e){t(e)}}function o(e){try{a(r.throw(e))}catch(e){t(e)}}function a(t){var r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r)}))).then(n,o)}a((r=r.apply(void 0,[])).next())}));var i,r},gn="\n <svg\n width='32'\n height='32'\n viewBox='0 0 32 32'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n >\n <rect width='24' height='24' fill='none' transform='translate(4 4)' />\n <path\n d='M14.9999 15.9987C15.2448 15.9987 15.4812 16.0887 15.6643 16.2514C15.8473 16.4142 15.9642 16.6384 15.9929 16.8817L15.9999 16.9987V21.9987C15.9996 22.2536 15.902 22.4987 15.727 22.6841C15.5521 22.8694 15.3129 22.9809 15.0585 22.9959C14.804 23.0108 14.5535 22.928 14.3581 22.7644C14.1626 22.6008 14.037 22.3688 14.0069 22.1157L13.9999 21.9987V19.4127L8.70688 24.7057C8.52693 24.885 8.28545 24.9892 8.0315 24.9969C7.77755 25.0047 7.53017 24.9155 7.33961 24.7474C7.14904 24.5794 7.02958 24.3451 7.00549 24.0922C6.98139 23.8393 7.05447 23.5867 7.20988 23.3857L7.29288 23.2917L12.5859 17.9987H9.99988C9.745 17.9984 9.49985 17.9008 9.31452 17.7258C9.12918 17.5509 9.01765 17.3117 9.00271 17.0573C8.98778 16.8029 9.07056 16.5523 9.23415 16.3569C9.39774 16.1614 9.62979 16.0358 9.88288 16.0057L9.99988 15.9987H14.9999ZM23.2929 7.29169C23.4728 7.11235 23.7143 7.00822 23.9683 7.00047C24.2222 6.99271 24.4696 7.08191 24.6602 7.24994C24.8507 7.41798 24.9702 7.65225 24.9943 7.90517C25.0184 8.15809 24.9453 8.4107 24.7899 8.61169L24.7069 8.70569L19.4139 13.9987H21.9999C22.2548 13.999 22.4999 14.0966 22.6853 14.2715C22.8706 14.4465 22.9821 14.6856 22.9971 14.9401C23.012 15.1945 22.9292 15.4451 22.7656 15.6405C22.602 15.836 22.37 15.9616 22.1169 15.9917L21.9999 15.9987H16.9999C16.755 15.9987 16.5185 15.9087 16.3355 15.746C16.1525 15.5832 16.0355 15.3589 16.0069 15.1157L15.9999 14.9987V9.99869C16.0002 9.74381 16.0978 9.49866 16.2727 9.31333C16.4477 9.12799 16.6868 9.01646 16.9413 9.00152C17.1957 8.98659 17.4463 9.06937 17.6417 9.23296C17.8372 9.39655 17.9628 9.6286 17.9929 9.88169L17.9999 9.99869V12.5847L23.2929 7.29169Z'\n fill='black'\n />\n </svg>\n",vn="\n<svg\n width='32'\n height='32'\n viewBox='0 0 32 32'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n >\n <rect width='24' height='24' fill='none' transform='translate(4 4)' />\n <path\n d='M13.793 16.793C13.973 16.6137 14.2144 16.5095 14.4684 16.5018C14.7223 16.494 14.9697 16.5832 15.1603 16.7512C15.3508 16.9193 15.4703 17.1536 15.4944 17.4065C15.5185 17.6594 15.4454 17.912 15.29 18.113L15.207 18.207L10.414 23H13C13.2549 23.0003 13.5 23.0979 13.6854 23.2728C13.8707 23.4478 13.9822 23.687 13.9972 23.9414C14.0121 24.1958 13.9293 24.4464 13.7657 24.6418C13.6021 24.8373 13.3701 24.9629 13.117 24.993L13 25H8C7.75507 25 7.51866 24.91 7.33563 24.7473C7.15259 24.5845 7.03566 24.3603 7.007 24.117L7 24V19C7.00028 18.7451 7.09788 18.5 7.27285 18.3146C7.44782 18.1293 7.68695 18.0178 7.94139 18.0028C8.19584 17.9879 8.44638 18.0707 8.64183 18.2343C8.83729 18.3979 8.9629 18.6299 8.993 18.883L9 19V21.586L13.793 16.793ZM24 7C24.2449 7.00003 24.4813 7.08996 24.6644 7.25272C24.8474 7.41547 24.9643 7.63975 24.993 7.883L25 8V13C24.9997 13.2549 24.9021 13.5 24.7272 13.6854C24.5522 13.8707 24.313 13.9822 24.0586 13.9972C23.8042 14.0121 23.5536 13.9293 23.3582 13.7657C23.1627 13.6021 23.0371 13.3701 23.007 13.117L23 13V10.414L18.207 15.207C18.027 15.3863 17.7856 15.4905 17.5316 15.4982C17.2777 15.506 17.0303 15.4168 16.8397 15.2488C16.6492 15.0807 16.5297 14.8464 16.5056 14.5935C16.4815 14.3406 16.5546 14.088 16.71 13.887L16.793 13.793L21.586 9H19C18.7451 8.99972 18.5 8.90212 18.3146 8.72715C18.1293 8.55218 18.0178 8.31305 18.0028 8.05861C17.9879 7.80416 18.0707 7.55362 18.2343 7.35817C18.3979 7.16271 18.6299 7.0371 18.883 7.007L19 7H24Z'\n fill='black'\n />\n</svg>\n",mn='\n<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M12 8L24 16L12 24V8Z" fill="#122239" stroke="#122239" stroke-linejoin="round" stroke-width="2" stroke-linecap="round" />\n</svg>\n',yn='\n<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n <rect x="10" y="8" width="4" height="16" fill="#122239" stroke="#122239" stroke-width="2"/>\n <rect x="18" y="8" width="4" height="16" fill="#122239" stroke="#122239" stroke-width="2"/>\n</svg>\n',bn=[650,400],wn=function(e){return{linLogMode:!1,adjustSizes:!1,scalingRatio:e.size/e.order,slowDown:1+Math.log(e.order),barnesHutTheta:.7,barnesHutThreshold:1e3,nRepulsiveCycles:void 0,expectedDims:bn,layoutSingletonsSeparately:!1,decayRepulsion:!1}},xn=function(){return xn=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},xn.apply(this,arguments)},Cn=function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{h(i.next(e))}catch(e){o(e)}}function s(e){try{h(i.throw(e))}catch(e){o(e)}}function h(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}h((i=i.apply(e,t||[])).next())}))},_n=function(e,t){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(h){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,h])}}},En=function(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))};!function(e){e[e.inactive=0]="inactive",e[e.lasso=1]="lasso",e[e.box=2]="box"}(nn||(nn={}));var kn,Sn=function(){function e(e){var t,n=this;this.zoomFactor=1.5,this.zoomDuration=200,this.isDragging=!1,this.isDraggedNodeSelected=!1,this.isLassoActiveDueToModifierKey=!1,this.fullScreenButton=null,this.resetButton=null,this.lassoSelectButton=null,this.boxSelectButton=null,this.playPauseButton=null,this.overlay=null,this.previousPosition=null,this.originalSizeKey="originalSize",this.originalBorderKey="originalBorder",this.handleSelectionClear=function(){n.updateSelectedNodes([])},this.handleEnterNode=function(e){var t=n.graph.getNodeAttribute(e.node,"label"),i=n.graph.getNodeAttribute(e.node,"labelToDisplay");n.graph.getNodeAttribute(e.node,"originalLabel")||n.graph.setNodeAttribute(e.node,"originalLabel",t),n.graph.setNodeAttribute(e.node,"label",i),n.graph.setNodeAttribute(e.node,"hovered",!0),n.neighborHighlightingEnabled&&n.graph.forEachNeighbor(e.node,(function(t){var i=n.graph.getNodeAttribute(t,"border");n.graph.setNodeAttribute(t,"border",3),n.graph.setNodeAttribute(t,n.originalBorderKey,i);var r=n.getUndirectedEdge(e.node,t),o=n.graph.getEdgeAttribute(r,"size");n.graph.setEdgeAttribute(r,"size",3),n.graph.setEdgeAttribute(r,n.originalSizeKey,o)}))},this.handleLeaveNode=function(e){var t=n.graph.getNodeAttribute(e.node,"originalLabel");n.graph.setNodeAttribute(e.node,"label",t),n.graph.setNodeAttribute(e.node,"hovered",void 0),n.neighborHighlightingEnabled&&n.graph.forEachNeighbor(e.node,(function(t){var i=n.graph.getNodeAttribute(t,n.originalBorderKey);n.graph.setNodeAttribute(t,"border",i);var r=n.getUndirectedEdge(e.node,t);n.graph.setEdgeAttribute(r,"size",void 0)})),n.removeHoverOverlay()},this.handleDownNode=function(e){n.isDragging=!0,n.draggedNode=e.node;var t=Number(e.node);n.graph.setNodeAttribute(n.draggedNode,"highlighted",!0),n.isDraggedNodeSelected=n.selectedNodes.some((function(e){return e===t})),n.isDraggedNodeSelected?n.selectedNodes.map((function(e){return n.graph.updateNodeAttribute(e,"fixed",(function(){return!0}))})):n.graph.setNodeAttribute(n.draggedNode,"fixed",!0),n.previousPosition=n.sigma.viewportToGraph(e.event),!n.animator.isRunning()&&n._animate&&n.animator.start(),n.animator.resetNIters()},this.handleNodeDoubleClick=function(e){e.preventSigmaDefault();var t=Number(e.node);n.selectedNodes.some((function(e){return e===t}))?n.updateSelectedNodes(n.selectedNodes.filter((function(e){return e!==t}))):n.addSelectedNodes([t])},this.handleMouseMoveBody=function(e){if(n.isDragging&&n.draggedNode&&n.previousPosition){n.animator.resetNIters();var t=n.sigma.viewportToGraph(e),i=t.x-n.previousPosition.x,r=t.y-n.previousPosition.y;n.previousPosition=t,n.isDraggedNodeSelected?n.selectedNodes.map((function(e){return n.graph.updateNodeAttributes(e,(function(e){return xn(xn({},e),{x:e.x+i,y:e.y+r})}))})):n.graph.updateNodeAttributes(n.draggedNode,(function(e){return xn(xn({},e),{x:e.x+i,y:e.y+r})})),e.preventSigmaDefault(),e.original.preventDefault(),e.original.stopPropagation()}},this.handleMouseUp=function(){n.draggedNode&&(n.isDraggedNodeSelected?n.selectedNodes.map((function(e){return n.graph.removeNodeAttribute(e,"fixed")})):(n.graph.removeNodeAttribute(n.draggedNode,"fixed"),n.graph.removeNodeAttribute(n.draggedNode,"highlighted")),n.previousPosition=null),n.animator&&n.animator.forceNodePositionUpdate(),n.isDragging=!1,n.draggedNode=null,n.isDraggedNodeSelected=!1},this.handleMouseDown=function(){n.sigma.getCustomBBox()||n.sigma.setCustomBBox(n.sigma.getBBox())},this.handleDoubleClickStage=function(e){n.handleSelectionClear(),e.preventSigmaDefault()},this.handleWheel=function(e){var t=n.sigma.getCamera(),i=t.getState(),r=Math.max(-1.5,Math.min(1.5,e.delta)),o=t.getBoundedRatio(i.ratio*(1-r/8));e.original.deltaMode!==WheelEvent.DOM_DELTA_PIXEL&&console.warn("WheelEvent.deltaMode is not DOM_DELTA_PIXEL. Zoom behavior may not be as expected.");var a=n.sigma.getViewportZoomedState(e,o);t.setState(a),e.preventSigmaDefault(),e.sigmaDefaultPrevented=!0},this.handleLassoModifierDown=function(e){"Alt"===e.key&&n.mode===nn.inactive&&(n.setSelectMode(nn.lasso),n.isLassoActiveDueToModifierKey=!0)},this.handleLassoModifierUp=function(e){"Alt"===e.key&&n.isLassoActiveDueToModifierKey&&(n.setSelectMode(nn.inactive),n.isLassoActiveDueToModifierKey=!1)},this.graphContainer=((t=document.createElement("div")).className="graph-container",t.style.width="100%",t.style.height="calc(100% - 40px)",t.style.position="relative",t.style.top="40px",t),this.sigmaContainer=function(e){var t=document.createElement("div");return t.className="sigma-container",t.style.width="100%",t.style.height="100%",e.appendChild(t),t}(this.graphContainer),this.sigmaSettings=xn({defaultDrawNodeLabel:rt,defaultDrawNodeHover:ot},e.settings),this.sigma=new tt(e.graph,this.sigmaContainer,this.sigmaSettings),this.graph=e.graph,this.animator=e.animator,this._animate=!0,this.mode=e.mode,this._isFullScreen=e.isFullScreen,this.highlightedNodeColor=e.highlightedNodeColor||"#FF00FFDD",this.neighborHighlightingEnabled=e.neighborHighlightingEnabled,this.allowNodeMovement=void 0===e.allowNodeMovement||e.allowNodeMovement,this._selectedNodes=e.selectedNodes,this._highlightedNodes=e.highlightedNodes||[],this.fullScreenButton=null,this.lassoSelectButton=null,this.boxSelectButton=null,this.selectionCanvas=null,this.isDrawing=!1,this.lassoDrawnPoints=[],this.boxInitialPoint=null,this.onSelectedNodesChange=e.onSelectedNodesChange,this.onHighlightedNodesChange=e.onHighlightedNodesChange,this.onFullScreenChange=e.onFullScreenChange,this.initializeGraphManager(),this.bindEventHandlers(),this.initializeOverlay(),document.addEventListener("keydown",this.handleLassoModifierDown),document.addEventListener("keyup",this.handleLassoModifierUp)}return e.prototype.bindEventHandlers=function(){this.handleEnterNode=this.handleEnterNode.bind(this),this.handleLeaveNode=this.handleLeaveNode.bind(this),this.handleDownNode=this.handleDownNode.bind(this),this.handleNodeDoubleClick=this.handleNodeDoubleClick.bind(this),this.handleDoubleClickStage=this.handleDoubleClickStage.bind(this),this.handleMouseMoveBody=this.handleMouseMoveBody.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleWheel=this.handleWheel.bind(this),this.handleSelectionClear=this.handleSelectionClear.bind(this),this.onDrawingStart=this.onDrawingStart.bind(this),this.onDrawing=this.onDrawing.bind(this),this.onDrawingEnd=this.onDrawingEnd.bind(this),this.onSelectScroll=this.onSelectScroll.bind(this),this.handleLassoModifierDown=this.handleLassoModifierDown.bind(this),this.handleLassoModifierUp=this.handleLassoModifierUp.bind(this)},e.prototype.initializeGraphManager=function(){return Cn(this,void 0,void 0,(function(){return _n(this,(function(e){return this.initializeGraph(),this.createControls(),this.registerEvents(),[2]}))}))},e.prototype.initializeGraph=function(){var e,t=this;this.sigma.setGraph(this.graph);var n=null!==(e=this.animator.params.settings.expectedDims)&&void 0!==e?e:this.getGraphViewportBounds(),i=n[0],r=n[1];this.sigma.setCustomBBox({x:[-i/2,i/2],y:[-r/2,r/2]}),this.refresh(),window.requestAnimationFrame((function(){return t.resetView()}))},e.prototype.getGraphViewportBounds=function(){var e=this.sigma.getDimensions();return[e.width,e.height]},e.prototype.updateSelectedNodes=function(e){this.setSelectedNodes(e)},e.prototype.addSelectedNodes=function(e){var t=this;this.setSelectedNodes(En(En([],this.selectedNodes,!0),e.filter((function(e){return!t.selectedNodes.includes(e)})),!0))},e.prototype.getUndirectedEdge=function(e,t){if(this.graph.hasEdge(e,t))return this.graph.edge(e,t);if(this.graph.hasEdge(t,e))return this.graph.edge(t,e);throw new Error("neighbor node = ".concat(t," does not have an edge with ").concat(e))},e.prototype.registerEvents=function(){this.sigma.on("enterNode",this.handleEnterNode),this.sigma.on("leaveNode",this.handleLeaveNode),this.sigma.on("downNode",this.handleDownNode),this.sigma.on("doubleClickNode",this.handleNodeDoubleClick),this.sigma.on("doubleClickStage",this.handleDoubleClickStage),this.sigma.getMouseCaptor().on("wheel",this.handleWheel),this.allowNodeMovement&&(this.sigma.getMouseCaptor().on("mousemovebody",this.handleMouseMoveBody),this.sigma.getMouseCaptor().on("mouseup",this.handleMouseUp),this.sigma.getMouseCaptor().on("mousedown",this.handleMouseDown));var e=this.sigma.getCanvases().nodes;e&&(e.addEventListener("webglcontextlost",this.handleContextLost.bind(this)),e.addEventListener("webglcontextrestored",this.handleContextRestored.bind(this)))},e.prototype.setSelectMode=function(e){this.mode=e,this.lassoSelectButton&&this.lassoSelectButton.classList.toggle("active",e===nn.lasso),this.boxSelectButton&&this.boxSelectButton.classList.toggle("active",e===nn.box),this.mode===nn.inactive?(this.removeSelectionCanvas(),this.lassoSelectButton&&this.lassoSelectButton.classList.remove("active"),this.boxSelectButton&&this.boxSelectButton.classList.remove("active")):this.showSelectionCanvas()},e.prototype.handleContextLost=function(e){e.preventDefault(),console.log("WebGL context lost."),this.overlay&&(this.overlay.style.visibility="visible")},e.prototype.handleContextRestored=function(){this.dispose(),this.sigma=new tt(this.graph,this.sigmaContainer,this.sigma.getSettings()),this.registerEvents(),this.overlay&&(this.overlay.style.visibility="hidden"),console.log("WebGL context restored.")},e.prototype.showSelectionCanvas=function(){var e,t,n,i;this.selectionCanvas||(this.selectionCanvas=(t=(e={offsetWidth:this.sigma.getContainer().offsetWidth,offsetHeight:this.sigma.getContainer().offsetHeight}).offsetWidth,n=e.offsetHeight,(i=document.createElement("canvas")).width=t,i.height=n,i.style.position="absolute",i.style.top="0px",i.style.cursor="crosshair",i),this.selectionCanvas.addEventListener("mousedown",this.onDrawingStart.bind(this)),this.selectionCanvas.addEventListener("mousemove",this.onDrawing.bind(this)),this.selectionCanvas.addEventListener("mouseup",this.onDrawingEnd.bind(this)),this.selectionCanvas.addEventListener("wheel",this.onSelectScroll.bind(this)),this.graphContainer.appendChild(this.selectionCanvas))},e.prototype.removeSelectionCanvas=function(){this.selectionCanvas&&(this.graphContainer.removeChild(this.selectionCanvas),this.selectionCanvas=null)},e.prototype.setDrawingStyles=function(e){e.strokeStyle="black",e.lineWidth=2,e.fillStyle="rgba(200, 200, 200, 0.25)",e.lineJoin="round",e.lineCap="round"},e.prototype.getNormalizedPosition=function(e){var t=this.selectionCanvas.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}},e.prototype.drawSmoothFilledPath=function(e){var t=this.selectionCanvas.getContext("2d");this.setDrawingStyles(t);var n,i,r=e[0],o=e[1],a=e.length;t.beginPath(),t.moveTo(r.x,r.y);for(var s=1;s<a;s+=1){var h=(i=o,{x:(n=r).x+(i.x-n.x)/2,y:n.y+(i.y-n.y)/2});t.quadraticCurveTo(r.x,r.y,h.x,h.y),r=e[s],o=e[s+1]}t.lineTo(r.x,r.y),t.stroke(),t.fill()},e.prototype.getGraphNodesInCurrentPath=function(){var e=this,t=this.sigma.getGraph(),n=this.selectionCanvas.getContext("2d"),i=[],r=this.sigma.getDimensions(),o=r.width,a=r.height;return t.forEachNode((function(r){var s=t.getNodeAttributes(r),h=e.sigma.graphToViewport({x:s.x,y:s.y});h.x>=0&&h.x<=o&&h.y>=0&&h.y<=a&&n.isPointInPath(h.x,h.y)&&i.push(Number(r))})),i},e.prototype.onDrawingStart=function(e){if(e.preventDefault(),this.mode!==nn.inactive){this.isDrawing=!0;var t=this.getNormalizedPosition(e);this.mode===nn.lasso&&(this.lassoDrawnPoints=[],this.lassoDrawnPoints.push(t)),this.mode===nn.box&&(this.boxInitialPoint=t),e.stopPropagation()}},e.prototype.onDrawing=function(e){if(this.mode!==nn.inactive&&this.isDrawing){var t=this.getNormalizedPosition(e),n=this.selectionCanvas.getContext("2d");if(this.setDrawingStyles(n),n.clearRect(0,0,n.canvas.width,n.canvas.height),this.mode===nn.lasso&&(this.lassoDrawnPoints.push(t),this.drawSmoothFilledPath(this.lassoDrawnPoints)),this.mode===nn.box&&this.boxInitialPoint){n.beginPath();var i=t.x-this.boxInitialPoint.x,r=t.y-this.boxInitialPoint.y;n.rect(this.boxInitialPoint.x,this.boxInitialPoint.y,i,r),n.fill()}e.stopPropagation()}},e.prototype.onDrawingEnd=function(e){if(this.mode!==nn.inactive){var t=this.getGraphNodesInCurrentPath();this.isDrawing=!1,e.shiftKey?this.addSelectedNodes(t):this.updateSelectedNodes(t);var n=this.selectionCanvas.getContext("2d");n.clearRect(0,0,this.selectionCanvas.width,this.selectionCanvas.height),n.beginPath(),this.mode===nn.lasso&&(this.lassoDrawnPoints=[]),this.mode===nn.box&&(this.boxInitialPoint=null),e.stopPropagation()}},e.prototype.onSelectScroll=function(e){this.sigma.getMouseCaptor().handleWheel(e)},e.prototype.initializeOverlay=function(){var e=this;this.overlay=function(){var t=document.createElement("div");t.className="webgl-overlay",t.innerText='Graph is not shown because the WebGL context was lost.\nThis can happen when the browser has too many other objects to display. Usually, clicking "Restore Context" will be able to bring the graph back.';var n=document.createElement("button");return n.innerText="Restore Graph Display",n.style.marginTop="20px",n.style.padding="10px 20px",n.style.fontSize="1rem",n.style.cursor="pointer",n.addEventListener("click",(function(){return e.handleContextRestored()})),t.appendChild(n),t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.width="100%",t.style.height="100%",t.style.backgroundColor="rgba(0, 0, 0, 0.7)",t.style.color="white",t.style.display="flex",t.style.flexDirection="column",t.style.justifyContent="center",t.style.alignItems="center",t.style.zIndex="1000",t.style.visibility="hidden",t}(),this.graphContainer.appendChild(this.overlay)},e.prototype.createControls=function(){var e=this,t=function(){var e=document.createElement("div");return e.className="controls-container",e.style.position="absolute",e.style.display="flex",e.style.bottom="10px",e.style.right="10px",e.style.zIndex="10",e}(),n=nt("\n<svg\n width='32'\n height='32'\n viewBox='0 0 32 32'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n>\n <path d='M9 16H23' stroke='#122239' stroke-width='2' stroke-linecap='round' />\n <path d='M16 9L16 23' stroke='#122239' stroke-width='2' stroke-linecap='round' />\n</svg>\n",(function(){return Cn(e,void 0,void 0,(function(){return _n(this,(function(e){switch(e.label){case 0:return[4,this.zoomIn()];case 1:return[2,e.sent()]}}))}))}),"Zoom In");t.appendChild(n);var i=nt("\n<svg width='32' height='32' viewBox='0 0 32 32' fill='none' xmlns='http://www.w3.org/2000/svg'>\n <path\n d='M9 16H23'\n stroke='#122239'\n stroke-width='2'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n</svg>",(function(){return Cn(e,void 0,void 0,(function(){return _n(this,(function(e){switch(e.label){case 0:return[4,this.zoomOut()];case 1:return[2,e.sent()]}}))}))}),"Zoom Out");t.appendChild(i);var r=nt("\n<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' fill='none' viewBox='0 0 32 32'>\n <path d='M7 7v7M7 7h7M25 25v-7M25 25h-7' stroke='#122239' stroke-width='2.1' stroke-linecap='round' />\n</svg>\n",(function(){return Cn(e,void 0,void 0,(function(){return _n(this,(function(e){switch(e.label){case 0:return[4,this.resetView()];case 1:return[2,e.sent()]}}))}))}),"Reset Zoom");t.appendChild(r),this.resetButton=nt("\n<svg\n width='32'\n height='32'\n viewBox='0 0 32 32'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n>\n <path\n d='M25.295 18C25.388 17.9999 25.48 18.0181 25.5659 18.0538C25.6517 18.0894 25.7297 18.1417 25.7952 18.2076C25.8608 18.2735 25.9126 18.3518 25.9478 18.4378C25.9829 18.5239 26.0007 18.616 26 18.709V21.913C26.0007 22.0055 25.9831 22.0973 25.9482 22.183C25.9134 22.2688 25.862 22.3468 25.797 22.4126C25.732 22.4785 25.6546 22.5309 25.5694 22.5668C25.4841 22.6027 25.3925 22.6215 25.3 22.622C25.2075 22.6215 25.116 22.6027 25.0307 22.5668C24.9454 22.5309 24.868 22.4785 24.803 22.4126C24.738 22.3468 24.6866 22.2688 24.6518 22.183C24.6169 22.0973 24.5994 22.0055 24.6 21.913V20.788C22.779 23.844 19.399 26 15.757 26C11.347 26 7.65102 23.279 6.04802 19.085C5.98071 18.9103 5.98495 18.716 6.05982 18.5444C6.13469 18.3728 6.27416 18.2375 6.44802 18.168C6.80802 18.027 7.21402 18.208 7.35402 18.573C8.75402 22.235 11.942 24.583 15.757 24.583C19.128 24.583 22.277 22.401 23.744 19.429L22.273 19.439C22.1805 19.4391 22.0888 19.421 22.0033 19.3857C21.9178 19.3504 21.84 19.2985 21.7746 19.2332C21.7091 19.1678 21.6571 19.0901 21.6217 19.0046C21.5863 18.9192 21.568 18.8275 21.568 18.735C21.5656 18.5482 21.6375 18.3681 21.7678 18.2342C21.8981 18.1003 22.0762 18.0236 22.263 18.021L25.295 18ZM16.245 6C20.653 6 24.35 8.721 25.953 12.915C26.0203 13.0897 26.0161 13.284 25.9412 13.4556C25.8663 13.6272 25.7269 13.7625 25.553 13.832C25.467 13.8655 25.3752 13.8817 25.2829 13.8794C25.1906 13.8772 25.0996 13.8566 25.0153 13.8189C24.931 13.7813 24.8551 13.7272 24.7918 13.6599C24.7286 13.5926 24.6794 13.5135 24.647 13.427C23.247 9.765 20.059 7.417 16.244 7.417C12.873 7.417 9.72402 9.599 8.25702 12.571L9.72802 12.561C9.82055 12.5609 9.9122 12.579 9.99773 12.6143C10.0833 12.6496 10.161 12.7015 10.2265 12.7668C10.2919 12.8322 10.3439 12.9099 10.3793 12.9954C10.4148 13.0808 10.433 13.1725 10.433 13.265C10.4354 13.4518 10.3636 13.6319 10.2333 13.7658C10.1029 13.8997 9.92483 13.9764 9.73802 13.979L6.70502 14C6.61206 14.0001 6.52 13.9819 6.43414 13.9462C6.34828 13.9106 6.27033 13.8583 6.20479 13.7924C6.13925 13.7265 6.08741 13.6482 6.05226 13.5622C6.01711 13.4761 5.99936 13.384 6.00002 13.291V10.087C6.00002 9.695 6.31302 9.378 6.70002 9.378C7.08602 9.378 7.40002 9.695 7.40002 10.087V11.212C9.22102 8.156 12.601 6 16.243 6H16.245Z'\n fill='#122239'\n stroke='#122239'\n stroke-width='0.5'\n />\n <circle cx='16' cy='16' r='3' fill='#122239' />\n</svg>\n",(function(t){return Cn(e,void 0,void 0,(function(){var e,n,i,r,o;return _n(this,(function(a){switch(a.label){case 0:return e=this.animator.isRunning(),n=null,this.resetButton&&(this.resetButton.style.backgroundColor="#bddde8",(n=this.resetButton.getAttribute("data-tooltip"))&&this.resetButton.setAttribute("data-tooltip","Reset Layout (running)")),t.shiftKey?[3,3]:((i=xn(xn(xn({},wn(this.graph)),this.animator.params.settings),{warmupLayout:!0})).expectedDims=this.getGraphViewportBounds(),console.log("reset layout initialSettings",i),r={iterations:300,settings:i},this.animator.stop(),this.sigma.getCustomBBox()||this.sigma.setCustomBBox(this.sigma.getBBox()),[4,this.applyInitialLayout(r)]);case 1:return a.sent(),[4,pn(this.graph,r,!t.altKey)];case 2:return o=a.sent(),this.animator.params.settings=o,this.animator.forceNodePositionUpdate(),[3,4];case 3:t.altKey||(this.animator.stop(),s=this.graph,h=this.getGraphViewportBounds(),u=this.animator.params.settings.layoutSingletonsSeparately,c=(0,at.kS)(s).map((function(e){return e.map(Number)})),d=un(s),an(d.nodes,c,100,h,u),cn(s,d.nodes),this.animator.forceNodePositionUpdate()),a.label=4;case 4:return[4,this.resetView()];case 5:return a.sent(),e&&this.animator.start(),this.resetButton&&(this.resetButton.style.backgroundColor="#e2e4e7",n&&this.resetButton.setAttribute("data-tooltip","Reset Layout")),this.sigma.getBBox(),[2]}var s,h,u,c,d}))}))}),"Reset Layout"),t.appendChild(this.resetButton),this.fullScreenButton=nt(this._isFullScreen?gn:vn,(function(){return e.toggleFullScreen()}),this._isFullScreen?"Scale back":"Expand"),t.appendChild(this.fullScreenButton),this.lassoSelectButton=nt("\n<svg\n width='32'\n height='32'\n viewBox='0 0 32 32'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n >\n <path\n d='M11 26C10.379 25.5343 9.875 24.9303 9.52786 24.2361C9.18073 23.5418 9 22.7762 9 22M7.3 18C6.45485 16.8376 5.99974 15.4372 6 14C6 9.6 10.5 6 16 6C21.5 6 26 9.6 26 14C26 18.4 21.5 22 16 22C14.2809 22.0287 12.5758 21.6877 11 21'\n stroke='#122239'\n stroke-width='2'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n <path\n d='M9 22C9.53043 22 10.0391 21.7893 10.4142 21.4142C10.7893 21.0391 11 20.5304 11 20C11 19.4696 10.7893 18.9609 10.4142 18.5858C10.0391 18.2107 9.53043 18 9 18C8.46957 18 7.96086 18.2107 7.58579 18.5858C7.21071 18.9609 7 19.4696 7 20C7 20.5304 7.21071 21.0391 7.58579 21.4142C7.96086 21.7893 8.46957 22 9 22V22Z'\n stroke='#122239'\n stroke-width='1.5'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n </svg>\n",(function(){return e.toggleLassoSelect()}),"Lasso Select"),t.appendChild(this.lassoSelectButton),this.boxSelectButton=nt("\n<svg width='32' height='32' viewBox='0 0 32 32' fill='none' xmlns='http://www.w3.org/2000/svg'>\n <path\n d='M6 17.6667V14.3333C6 14.1123 6.0878 13.9004 6.24408 13.7441C6.40036 13.5878 6.61232 13.5 6.83333 13.5C7.05435 13.5 7.26631 13.5878 7.42259 13.7441C7.57887 13.9004 7.66667 14.1123 7.66667 14.3333V17.6667C7.66667 17.8877 7.57887 18.0996 7.42259 18.2559C7.26631 18.4122 7.05435 18.5 6.83333 18.5C6.61232 18.5 6.40036 18.4122 6.24408 18.2559C6.0878 18.0996 6 17.8877 6 17.6667ZM10.1667 6H7.66667C7.22464 6 6.80072 6.17559 6.48816 6.48816C6.17559 6.80072 6 7.22464 6 7.66667V10.1667C6 10.3877 6.0878 10.5996 6.24408 10.7559C6.40036 10.9122 6.61232 11 6.83333 11C7.05435 11 7.26631 10.9122 7.42259 10.7559C7.57887 10.5996 7.66667 10.3877 7.66667 10.1667V7.66667H10.1667C10.3877 7.66667 10.5996 7.57887 10.7559 7.42259C10.9122 7.26631 11 7.05435 11 6.83333C11 6.61232 10.9122 6.40036 10.7559 6.24408C10.5996 6.0878 10.3877 6 10.1667 6ZM10.1667 24.3333H7.66667V21.8333C7.66667 21.6123 7.57887 21.4004 7.42259 21.2441C7.26631 21.0878 7.05435 21 6.83333 21C6.61232 21 6.40036 21.0878 6.24408 21.2441C6.0878 21.4004 6 21.6123 6 21.8333V24.3333C6 24.7754 6.17559 25.1993 6.48816 25.5118C6.80072 25.8244 7.22464 26 7.66667 26H10.1667C10.3877 26 10.5996 25.9122 10.7559 25.7559C10.9122 25.5996 11 25.3877 11 25.1667C11 24.9457 10.9122 24.7337 10.7559 24.5774C10.5996 24.4211 10.3877 24.3333 10.1667 24.3333ZM17.6667 24.3333H14.3333C14.1123 24.3333 13.9004 24.4211 13.7441 24.5774C13.5878 24.7337 13.5 24.9457 13.5 25.1667C13.5 25.3877 13.5878 25.5996 13.7441 25.7559C13.9004 25.9122 14.1123 26 14.3333 26H17.6667C17.8877 26 18.0996 25.9122 18.2559 25.7559C18.4122 25.5996 18.5 25.3877 18.5 25.1667C18.5 24.9457 18.4122 24.7337 18.2559 24.5774C18.0996 24.4211 17.8877 24.3333 17.6667 24.3333ZM25.1667 13.5C24.9457 13.5 24.7337 13.5878 24.5774 13.7441C24.4211 13.9004 24.3333 14.1123 24.3333 14.3333V17.6667C24.3333 17.8877 24.4211 18.0996 24.5774 18.2559C24.7337 18.4122 24.9457 18.5 25.1667 18.5C25.3877 18.5 25.5996 18.4122 25.7559 18.2559C25.9122 18.0996 26 17.8877 26 17.6667V14.3333C26 14.1123 25.9122 13.9004 25.7559 13.7441C25.5996 13.5878 25.3877 13.5 25.1667 13.5ZM24.3333 6H21.8333C21.6123 6 21.4004 6.0878 21.2441 6.24408C21.0878 6.40036 21 6.61232 21 6.83333C21 7.05435 21.0878 7.26631 21.2441 7.42259C21.4004 7.57887 21.6123 7.66667 21.8333 7.66667H24.3333V10.1667C24.3333 10.3877 24.4211 10.5996 24.5774 10.7559C24.7337 10.9122 24.9457 11 25.1667 11C25.3877 11 25.5996 10.9122 25.7559 10.7559C25.9122 10.5996 26 10.3877 26 10.1667V7.66667C26 7.22464 25.8244 6.80072 25.5118 6.48816C25.1993 6.17559 24.7754 6 24.3333 6ZM17.6667 6H14.3333C14.1123 6 13.9004 6.0878 13.7441 6.24408C13.5878 6.40036 13.5 6.61232 13.5 6.83333C13.5 7.05435 13.5878 7.26631 13.7441 7.42259C13.9004 7.57887 14.1123 7.66667 14.3333 7.66667H17.6667C17.8877 7.66667 18.0996 7.57887 18.2559 7.42259C18.4122 7.26631 18.5 7.05435 18.5 6.83333C18.5 6.61232 18.4122 6.40036 18.2559 6.24408C18.0996 6.0878 17.8877 6 17.6667 6ZM25.1667 21C24.9457 21 24.7337 21.0878 24.5774 21.2441C24.4211 21.4004 24.3333 21.6123 24.3333 21.8333V24.3333H21.8333C21.6123 24.3333 21.4004 24.4211 21.2441 24.5774C21.0878 24.7337 21 24.9457 21 25.1667C21 25.3877 21.0878 25.5996 21.2441 25.7559C21.4004 25.9122 21.6123 26 21.8333 26H24.3333C24.7754 26 25.1993 25.8244 25.5118 25.5118C25.8244 25.1993 26 24.7754 26 24.3333V21.8333C26 21.6123 25.9122 21.4004 25.7559 21.2441C25.5996 21.0878 25.3877 21 25.1667 21Z'\n fill='#122239'\n stroke='#122239'\n stroke-width='0.5'\n />\n</svg>\n",(function(){return e.toggleBoxSelect()}),"Box Select"),t.appendChild(this.boxSelectButton);var o=nt("<svg\n width='32'\n height='32'\n viewBox='0 0 32 32'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n>\n <path\n d='M6 17.6667V14.3333C6 14.1123 6.0878 13.9004 6.24408 13.7441C6.40036 13.5878 6.61232 13.5 6.83333 13.5C7.05435 13.5 7.26631 13.5878 7.42259 13.7441C7.57887 13.9004 7.66667 14.1123 7.66667 14.3333V17.6667C7.66667 17.8877 7.57887 18.0996 7.42259 18.2559C7.26631 18.4122 7.05435 18.5 6.83333 18.5C6.61232 18.5 6.40036 18.4122 6.24408 18.2559C6.0878 18.0996 6 17.8877 6 17.6667ZM10.1667 6H7.66667C7.22464 6 6.80072 6.17559 6.48816 6.48816C6.17559 6.80072 6 7.22464 6 7.66667V10.1667C6 10.3877 6.0878 10.5996 6.24408 10.7559C6.40036 10.9122 6.61232 11 6.83333 11C7.05435 11 7.26631 10.9122 7.42259 10.7559C7.57887 10.5996 7.66667 10.3877 7.66667 10.1667V7.66667H10.1667C10.3877 7.66667 10.5996 7.57887 10.7559 7.42259C10.9122 7.26631 11 7.05435 11 6.83333C11 6.61232 10.9122 6.40036 10.7559 6.24408C10.5996 6.0878 10.3877 6 10.1667 6ZM10.1667 24.3333H7.66667V21.8333C7.66667 21.6123 7.57887 21.4004 7.42259 21.2441C7.26631 21.0878 7.05435 21 6.83333 21C6.61232 21 6.40036 21.0878 6.24408 21.2441C6.0878 21.4004 6 21.6123 6 21.8333V24.3333C6 24.7754 6.17559 25.1993 6.48816 25.5118C6.80072 25.8244 7.22464 26 7.66667 26H10.1667C10.3877 26 10.5996 25.9122 10.7559 25.7559C10.9122 25.5996 11 25.3877 11 25.1667C11 24.9457 10.9122 24.7337 10.7559 24.5774C10.5996 24.4211 10.3877 24.3333 10.1667 24.3333ZM17.6667 24.3333H14.3333C14.1123 24.3333 13.9004 24.4211 13.7441 24.5774C13.5878 24.7337 13.5 24.9457 13.5 25.1667C13.5 25.3877 13.5878 25.5996 13.7441 25.7559C13.9004 25.9122 14.1123 26 14.3333 26H17.6667C17.8877 26 18.0996 25.9122 18.2559 25.7559C18.4122 25.5996 18.5 25.3877 18.5 25.1667C18.5 24.9457 18.4122 24.7337 18.2559 24.5774C18.0996 24.4211 17.8877 24.3333 17.6667 24.3333ZM25.1667 13.5C24.9457 13.5 24.7337 13.5878 24.5774 13.7441C24.4211 13.9004 24.3333 14.1123 24.3333 14.3333V17.6667C24.3333 17.8877 24.4211 18.0996 24.5774 18.2559C24.7337 18.4122 24.9457 18.5 25.1667 18.5C25.3877 18.5 25.5996 18.4122 25.7559 18.2559C25.9122 18.0996 26 17.8877 26 17.6667V14.3333C26 14.1123 25.9122 13.9004 25.7559 13.7441C25.5996 13.5878 25.3877 13.5 25.1667 13.5ZM24.3333 6H21.8333C21.6123 6 21.4004 6.0878 21.2441 6.24408C21.0878 6.40036 21 6.61232 21 6.83333C21 7.05435 21.0878 7.26631 21.2441 7.42259C21.4004 7.57887 21.6123 7.66667 21.8333 7.66667H24.3333V10.1667C24.3333 10.3877 24.4211 10.5996 24.5774 10.7559C24.7337 10.9122 24.9457 11 25.1667 11C25.3877 11 25.5996 10.9122 25.7559 10.7559C25.9122 10.5996 26 10.3877 26 10.1667V7.66667C26 7.22464 25.8244 6.80072 25.5118 6.48816C25.1993 6.17559 24.7754 6 24.3333 6ZM17.6667 6H14.3333C14.1123 6 13.9004 6.0878 13.7441 6.24408C13.5878 6.40036 13.5 6.61232 13.5 6.83333C13.5 7.05435 13.5878 7.26631 13.7441 7.42259C13.9004 7.57887 14.1123 7.66667 14.3333 7.66667H17.6667C17.8877 7.66667 18.0996 7.57887 18.2559 7.42259C18.4122 7.26631 18.5 7.05435 18.5 6.83333C18.5 6.61232 18.4122 6.40036 18.2559 6.24408C18.0996 6.0878 17.8877 6 17.6667 6ZM25.1667 21C24.9457 21 24.7337 21.0878 24.5774 21.2441C24.4211 21.4004 24.3333 21.6123 24.3333 21.8333V24.3333H21.8333C21.6123 24.3333 21.4004 24.4211 21.2441 24.5774C21.0878 24.7337 21 24.9457 21 25.1667C21 25.3877 21.0878 25.5996 21.2441 25.7559C21.4004 25.9122 21.6123 26 21.8333 26H24.3333C24.7754 26 25.1993 25.8244 25.5118 25.5118C25.8244 25.1993 26 24.7754 26 24.3333V21.8333C26 21.6123 25.9122 21.4004 25.7559 21.2441C25.5996 21.0878 25.3877 21 25.1667 21Z'\n fill='#122239'\n stroke='#122239'\n stroke-width='0.5'\n />\n <path\n d='M19.8225 12.1835C19.5859 11.9469 19.2036 11.9469 18.967 12.1835L16 15.1445L13.033 12.1775C12.7964 11.9408 12.4141 11.9408 12.1775 12.1775C11.9408 12.4141 11.9408 12.7964 12.1775 13.033L15.1445 16L12.1775 18.967C11.9408 19.2036 11.9408 19.5859 12.1775 19.8225C12.4141 20.0592 12.7964 20.0592 13.033 19.8225L16 16.8555L18.967 19.8225C19.2036 20.0592 19.5859 20.0592 19.8225 19.8225C20.0592 19.5859 20.0592 19.2036 19.8225 18.967L16.8555 16L19.8225 13.033C20.0531 12.8024 20.0531 12.4141 19.8225 12.1835V12.1835Z'\n fill='#122239'\n stroke='#122239'\n stroke-width='0.5'\n />\n</svg>\n",(function(){return e.clearSelection()}),"Clear Selection");t.appendChild(o);var a=nt("<svg width='32'\n height='32'\n viewBox='0 0 32 32'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n>\n <path\n fill-rule='evenodd'\n clip-rule='evenodd'\n d='M16 6C10.4772 6 6 10.4772 6 16C6 21.5228 10.4772 26 16 26C21.5228 26 26 21.5228 26 16C26 10.4772 21.5228 6 16 6ZM7.53846 16C7.53846 11.3268 11.3268 7.53846 16 7.53846C16.0002 7.53846 15.9998 7.53846 16 7.53846L16.0006 12.4497C15.059 12.4497 14.156 12.8238 13.4902 13.4896C12.8244 14.1554 12.4503 15.0584 12.4503 16C12.4503 16.9416 12.8244 17.8446 13.4902 18.5104C14.156 19.1762 15.059 19.5503 16.0006 19.5503V24.4615C16.0004 24.4615 16.0008 24.4615 16.0006 24.4615C11.3274 24.4615 7.53846 20.6732 7.53846 16ZM16.0006 19.5503C16.9422 19.5503 17.8452 19.1762 18.5111 18.5104C19.1769 17.8446 19.5509 16.9416 19.5509 16C19.5509 15.0584 19.1769 14.1554 18.5111 13.4896C17.8452 12.8238 16.9422 12.4497 16.0006 12.4497V19.5503Z'\n fill='#122239'\n />\n <path\n d='M16 7.53846C11.3268 7.53846 7.53846 11.3268 7.53846 16C7.53846 20.6732 11.3274 24.4615 16.0006 24.4615M16 7.53846C15.9998 7.53846 16.0002 7.53846 16 7.53846ZM16 7.53846L16.0006 12.4497M16.0006 12.4497C15.059 12.4497 14.156 12.8238 13.4902 13.4896C12.8244 14.1554 12.4503 15.0584 12.4503 16C12.4503 16.9416 12.8244 17.8446 13.4902 18.5104C14.156 19.1762 15.059 19.5503 16.0006 19.5503M16.0006 12.4497C16.9422 12.4497 17.8452 12.8238 18.5111 13.4896C19.1769 14.1554 19.5509 15.0584 19.5509 16C19.5509 16.9416 19.1769 17.8446 18.5111 18.5104C17.8452 19.1762 16.9422 19.5503 16.0006 19.5503M16.0006 12.4497V19.5503M16.0006 19.5503V24.4615M16.0006 24.4615C16.0008 24.4615 16.0004 24.4615 16.0006 24.4615ZM6 16C6 10.4772 10.4772 6 16 6C21.5228 6 26 10.4772 26 16C26 21.5228 21.5228 26 16 26C10.4772 26 6 21.5228 6 16Z'\n stroke='#122239'\n stroke-width='0.5'\n />\n</svg>\n",(function(){return e.invertSelection()}),"Invert Selection");t.appendChild(a),this.playPauseButton=nt(this._animate?yn:mn,(function(){return e.togglePlayPause()}),this._animate?"Pause Animation":"Play Animation"),t.appendChild(this.playPauseButton),this.graphContainer.appendChild(t)},e.prototype.zoomIn=function(){return Cn(this,void 0,void 0,(function(){return _n(this,(function(e){switch(e.label){case 0:return[4,this.sigma.getCamera().animatedZoom({duration:this.zoomDuration,factor:this.zoomFactor})];case 1:return e.sent(),[2]}}))}))},e.prototype.zoomOut=function(){return Cn(this,void 0,void 0,(function(){return _n(this,(function(e){switch(e.label){case 0:return[4,this.sigma.getCamera().animatedUnzoom({duration:this.zoomDuration,factor:this.zoomFactor})];case 1:return e.sent(),[2]}}))}))},e.prototype.unzoom=function(e,t){return Cn(this,void 0,void 0,(function(){return _n(this,(function(n){switch(n.label){case 0:return[4,this.sigma.getCamera().animatedUnzoom({duration:t,factor:e})];case 1:return n.sent(),[2]}}))}))},e.prototype.unzoomAndShift=function(e,t,n,i){return Cn(this,void 0,void 0,(function(){var r,o,a,s,h;return _n(this,(function(u){switch(u.label){case 0:return r=this.sigma.getCamera().getState(),o=this.sigma.viewportToFramedGraph(this.sigma.graphToViewport(t)),a=this.sigma.viewportToFramedGraph(this.sigma.graphToViewport(n)),s={x:a.x-o.x,y:a.y-o.y},h=xn(xn({},r),{x:r.x+s.x,y:r.y+s.y,ratio:r.ratio*e}),[4,this.sigma.getCamera().animate(h,{duration:i})];case 1:return u.sent(),[2]}}))}))},e.prototype.resetView=function(e){return Cn(this,void 0,void 0,(function(){var t,n,i,r,o,a,s;return _n(this,(function(h){switch(h.label){case 0:return this.sigma.refresh(),t=this.getFramedGraphBounds(),n=t[0],i=t[1],r={x:(i.x+n.x)/2,y:(i.y+n.y)/2},o=this.sigma.getCamera().getState().ratio,a=this.getGraphZoomRatioAdjustment(),s=o*a,[4,this.sigma.getCamera().animate(xn(xn({},r),{ratio:s,angle:0}),{duration:e||this.zoomDuration})];case 1:return h.sent(),[2]}}))}))},e.prototype.getGraphZoomRatioAdjustment=function(){var e=this.sigma.getBBox(),t=e.x,n=t[0],i=t[1],r=e.y,o=r[0],a=r[1],s=this.sigma.getDimensions(),h=s.width,u=s.height,c=this.sigma.viewportToGraph({x:0,y:40}),d=c.x,l=c.y,f=this.sigma.viewportToGraph({x:h,y:u-40}),p=f.x,g=f.y,v=Math.abs(p-d),m=Math.abs(g-l),y=Math.max(1.05*(i-n)/v,1.05*(a-o)/m);return console.log("zoom ratio",y),isFinite(y)?y:1},e.prototype.getFramedGraphBounds=function(){var e=this.sigma.getBBox(),t=e.x,n=t[0],i=t[1],r=e.y,o=r[0],a=r[1];return[this.sigma.viewportToFramedGraph(this.sigma.graphToViewport({x:n,y:o})),this.sigma.viewportToFramedGraph(this.sigma.graphToViewport({x:i,y:a}))]},e.prototype.getFramedGraphZoomRatio=function(e,t){var n=this.sigma.getDimensions(),i=n.width,r=n.height,o=Math.min(1,r/i),a=Math.min(1,i/r);return Math.max((t.x-e.x)/a,(t.y-e.y)/o)},e.prototype.toggleFullScreen=function(){this._isFullScreen=!this._isFullScreen,this.onFullScreenChange(this._isFullScreen),this.fullScreenButton&&(this.fullScreenButton.innerHTML=this._isFullScreen?gn:vn,this.fullScreenButton.setAttribute("data-tooltip",this._isFullScreen?"Scale back":"Expand"))},e.prototype.toggleLassoSelect=function(){this.mode!==nn.lasso?this.setSelectMode(nn.lasso):this.setSelectMode(nn.inactive)},e.prototype.toggleBoxSelect=function(){this.mode!==nn.box?this.setSelectMode(nn.box):this.setSelectMode(nn.inactive)},e.prototype.clearSelection=function(){this.handleSelectionClear()},e.prototype.invertSelection=function(){var e=this,t=[];this.graph.forEachNode((function(n){var i=Number(n);e.selectedNodes.some((function(e){return e===i}))||t.push(i)})),this.updateSelectedNodes(t)},e.prototype.updateAnimatorState=function(){this.animator&&(this._animate?this.animator.isRunning()||this.animator.start():this.animator.isRunning()&&this.animator.stop())},e.prototype.togglePlayPause=function(){this._animate=!this._animate,this.playPauseButton&&(this.playPauseButton.innerHTML=this._animate?yn:mn,this.playPauseButton.setAttribute("data-tooltip",this._animate?"Pause Animation":"Play Animation")),this.updateAnimatorState()},e.prototype.removeHoverOverlay=function(){var e=document.getElementById("node-hover-overlay");e&&(e.style.display="none",e.innerHTML="")},e.prototype.getGraphContainer=function(){return this.graphContainer},Object.defineProperty(e.prototype,"selectedNodes",{get:function(){return this._selectedNodes},enumerable:!1,configurable:!0}),e.prototype.setSelectedNodes=function(e,t){void 0===t&&(t=!0),this._selectedNodes=e,this.updateNodeSelection(),this.removeHoverOverlay(),t&&this.onSelectedNodesChange(e)},e.prototype.updateNodeSelection=function(){var e=new Set(this.selectedNodes);this.graph.updateEachNodeAttributes((function(t,n){var i=Number(t),r=e.has(i),o=n.hovered;if(n.labelBeforeSelection||o||(n.labelBeforeSelection=n.originalLabel||n.label),r)return xn(xn({},n),{label:void 0,originalLabel:void 0,highlighted:!0});var a=n.labelBeforeSelection;return xn(xn({},n),{label:a,originalLabel:a,highlighted:!1})}))},Object.defineProperty(e.prototype,"highlightedNodes",{get:function(){return this._highlightedNodes},set:function(e){this._highlightedNodes=e,this.updateNodeHighlighting(),this.onHighlightedNodesChange(e)},enumerable:!1,configurable:!0}),e.prototype.updateHighlightedNodes=function(e){this.highlightedNodes=e},e.prototype.updateNodeHighlighting=function(){var e=this,t=new Set(this.highlightedNodes);this.graph.updateEachNodeAttributes((function(n,i){var r=Number(n),o=t.has(r);if(o&&(void 0!==i.border||void 0!==i.originalBorder))return i.hasOwnProperty("originalBorder")||(i.originalBorder=i.border||null),xn(xn({},i),{border:e.highlightedNodeColor});if(!o&&i.hasOwnProperty("originalBorder")){var a=null===i.originalBorder?void 0:i.originalBorder;return delete i.originalBorder,xn(xn({},i),{border:a})}return i}))},Object.defineProperty(e.prototype,"isFullScreen",{get:function(){return this._isFullScreen},set:function(e){this._isFullScreen=e,this.onFullScreenChange(e)},enumerable:!1,configurable:!0}),e.prototype.updateGraph=function(e){var t=this.sigma.getBBox();this.graph=e,this.sigma.setGraph(e);var n=this.sigma.getBBox(),i=(n.x[1]-n.x[0])/(t.x[1]-t.x[0]),r=(n.y[1]-n.y[0])/(t.y[1]-t.y[0]),o=Math.max(i,r),a=this.sigma.getCamera().getState().ratio;this.sigma.getCamera().setState({ratio:a*o}),this.refresh()},e.prototype.updateAnimator=function(e){this.animator&&this.animator.kill(),this.animator=e},e.prototype.resetCamera=function(){return Cn(this,void 0,void 0,(function(){return _n(this,(function(e){switch(e.label){case 0:return[4,this.sigma.getCamera().animatedReset()];case 1:return e.sent(),[2]}}))}))},e.prototype.zoomInAndOut=function(){return Cn(this,void 0,void 0,(function(){return _n(this,(function(e){switch(e.label){case 0:return[4,this.sigma.getCamera().animatedUnzoom()];case 1:return e.sent(),[4,this.sigma.getCamera().animatedZoom()];case 2:return e.sent(),[2]}}))}))},e.prototype.updateSigmaSettings=function(e){var t=this;this.sigmaSettings=xn(xn({},this.sigmaSettings),e),Object.keys(e).forEach((function(n){Object.hasOwn(e,n)&&t.sigma.setSetting(n,e[n])}))},e.prototype.resetGraphBounds=function(){this.sigma.setCustomBBox({x:[-350,350],y:[-220,220]})},e.prototype.refresh=function(){this.sigma.refresh()},e.prototype.cleanup=function(){this.sigma.off("enterNode",this.handleEnterNode),this.sigma.off("leaveNode",this.handleLeaveNode),this.sigma.off("downNode",this.handleDownNode),this.sigma.off("doubleClickNode",this.handleNodeDoubleClick),this.sigma.off("doubleClickStage",this.handleDoubleClickStage),this.sigma.getMouseCaptor().off("wheel",this.handleWheel),this.allowNodeMovement&&(this.sigma.getMouseCaptor().off("mousemovebody",this.handleMouseMoveBody),this.sigma.getMouseCaptor().off("mouseup",this.handleMouseUp),this.sigma.getMouseCaptor().off("mousedown",this.handleMouseDown))},e.prototype.dispose=function(){this.sigma&&this.sigma.kill()},e.prototype.applyInitialLayout=function(e){return Cn(this,void 0,void 0,(function(){return _n(this,(function(e){return[2]}))}))},e}(),Ln=function(){return Ln=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Ln.apply(this,arguments)},Nn=function(){function e(e,t,n,i){var r=this;this.callback=null,this.graph=e,this.endPositions=t,this.animation_type=n,this.frameID=null,this.running=!1,this.startPositions=new Array(e.nodes().length),this.graph.forEachNode((function(e,t){var n=Number(e);r.startPositions[n]={x:t.x,y:t.y}})),this.duration=i}return e.prototype.isRunning=function(){return this.running},e.prototype.updateNodePositions=function(e){var t=this;this.graph.updateEachNodeAttributes((function(n,i){var r=Number(n),o=t.endPositions[r],a=t.startPositions[r],s=(o.x-a.x)*e,h=(o.y-a.y)*e;return Ln(Ln({},i),{x:a.x+s,y:a.y+h})}))},e.prototype.runFrame=function(){var e=this;this.startTime||(this.startTime=Date.now());var t=Math.min((Date.now()-this.startTime)/this.duration,1);this.updateNodePositions(t),1===t?this._kill():this.frameID=window.requestAnimationFrame((function(){return e.runFrame()}))},e.prototype._stop=function(){return null!==this.callback&&this.callback(),this.callback=null,this.running=!1,null!==this.frameID&&(window.cancelAnimationFrame(this.frameID),this.frameID=null),this},e.prototype.run=function(e){this.callback=e,this.running||(this.startTime=Date.now(),this.running=!0,this.runFrame())},e.prototype._kill=function(){this._stop()},e}(),An=function(){return An=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},An.apply(this,arguments)},Tn=function(){function e(e){var t=this;this.sliderValues={},this.sliderConfigs=[],this.views=[],this.listeners={},this.sliderConfigs=e,e.forEach((function(e){t.sliderValues[e.label]=e.initialValue,t.listeners[e.label]=[]}))}return e.prototype.callListeners=function(e){var t=this;this.listeners[e].forEach((function(n){n(t.sliderValues[e])}))},e.prototype.getView=function(e){var t=this,n=this.sliderConfigs.map((function(e,n){return An(An({},e),{initialValue:t.getSliderValue(e.label)||e.initialValue})})),i=new Mn(e,n);return Object.keys(this.sliderValues).forEach((function(e){i.addListener(e,(function(n){var i=Number(n.target.value);t.setSliderValue(e,i),t.callListeners(e)}))})),this.views.push(i),i},e.prototype.deleteView=function(e){this.views=this.views.filter((function(t){return t!==e}))},e.prototype.getSliderValue=function(e){return this.sliderValues[e]||null},e.prototype.setSliderValue=function(e,t){this.sliderValues[e]=t,this.views.forEach((function(n){n.setSliderValue(e,t)}))},e.prototype.addListener=function(e,t){this.listeners[e].push(t)},e}(),Mn=function(){function e(e,t){var n=this;this.sliders={},this.sliderValues={};var i=this.createSliderContainer();e.appendChild(i),t.forEach((function(e){var t=n.createSliderWrapper(e),r=t.wrapper,o=t.slider,a=t.labelElement;i.appendChild(r),n.sliders[e.label]=o,n.sliderValues[e.label]=a,o.addEventListener("input",(function(){a.textContent=o.value}))}))}return e.prototype.createSliderContainer=function(){var e=document.createElement("div");return e.className="slider-container",e},e.prototype.createSliderWrapper=function(e){var t=document.createElement("div");t.className="slider-wrapper";var n=document.createElement("label");n.className="slider-label",n.textContent="".concat(e.label,":");var i=document.createElement("input");i.type="range",i.className="slider",i.min=e.minValue.toString(),i.max=e.maxValue.toString(),i.step=e.step.toString(),i.value=e.initialValue.toString();var r=document.createElement("span");return r.className="slider-value",r.textContent=e.initialValue.toString(),t.appendChild(n),t.appendChild(i),t.appendChild(r),{wrapper:t,slider:i,labelElement:r}},e.prototype.setSliderValue=function(e,t){this.sliders[e].value=t.toString(),this.sliderValues[e].textContent=t.toString()},e.prototype.addListener=function(e,t){this.sliders[e].addEventListener("change",t)},e}(),Dn=function(){function e(e,t,n){this.container=e,this.graphManager=new Sn(n),this.initializeSliderView(t)}return e.prototype.initializeSliderView=function(e){this.sliderView=e.getView(this.container)},e.prototype.appendGraphToContainer=function(){this.container.appendChild(this.graphManager.getGraphContainer())},e}(),Rn=n(698),Gn=n.n(Rn);class Pn{static _xfnv1a(e){let t=2166136261;for(let n=0;n<e.length;n++)t=Math.imul(t^e.charCodeAt(n),16777619);return()=>(t+=t<<13,t^=t>>>7,t+=t<<3,t^=t>>>17,(t+=t<<5)>>>0)}}class Fn extends Pn{constructor(e){super(),Object.defineProperty(this,"a",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.a=Fn._xfnv1a(e)()}next(){let e=this.a+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}class zn extends Pn{constructor(e){super(),Object.defineProperty(this,"a",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"b",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"c",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"d",{enumerable:!0,configurable:!0,writable:!0,value:void 0});const t=zn._xfnv1a(e);this.a=t(),this.b=t(),this.c=t(),this.d=t()}next(){this.a>>>=0,this.b>>>=0,this.c>>>=0,this.d>>>=0;let e=this.a+this.b|0;return this.a=this.b^this.b>>>9,this.b=this.c+(this.c<<3)|0,this.c=this.c<<21|this.c>>>11,this.d=this.d+1|0,e=e+this.d|0,this.c=this.c+e|0,(e>>>0)/4294967296}}class On extends Pn{constructor(e){super(),Object.defineProperty(this,"a",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"b",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"c",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"d",{enumerable:!0,configurable:!0,writable:!0,value:void 0});const t=On._xfnv1a(e);this.a=t(),this.b=t(),this.c=t(),this.d=t()}next(){const e=this.b<<9;let t=5*this.b;return t=9*(t<<7|t>>>25),this.c^=this.a,this.d^=this.b,this.b^=this.c,this.a^=this.d,this.c^=e,this.d=this.d<<11|this.d>>>21,(t>>>0)/4294967296}}!function(e){e.sfc32="sfc32",e.mulberry32="mulberry32",e.xoshiro128ss="xoshiro128ss"}(kn||(kn={}));class In{constructor(e,t=kn.sfc32){Object.defineProperty(this,"str",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"prng",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"generator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.str=e,this.prng=t,this.generator=this._initializeGenerator()}next(){return this.generator.next()}_initializeGenerator(){if((e=>null===e)(e=this.str)||(e=>void 0===e)(e))return this.wrap();var e;switch(this.prng){case"sfc32":return new zn(this.str);case"mulberry32":return new Fn(this.str);case"xoshiro128ss":return new On(this.str);default:return this.wrap()}}wrap(){return{next:()=>Math.random()}}}var Bn=function(){return Bn=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Bn.apply(this,arguments)},Un=n(739),jn=function(e,t,n){return e.reduce((function(e,i){var r,o=null===(r=t[n])||void 0===r?void 0:r.nodes[i];return o&&e.push.apply(e,o.points),e}),[])},Vn=function(e,t,n){var i=new Set,r=n[e];return t.forEach((function(e){i.add(r[e])})),Array.from(i)},Hn=function(e){var t=1/0,n=1/0,i=-1/0,r=-1/0;return e.forEachNode((function(e,o){var a=o.x,s=o.y;a<t&&(t=a),s<n&&(n=s),a>i&&(i=a),s>r&&(r=s)})),{minX:t,minY:n,maxX:i,maxY:r}},Wn=function(e,t){var n=new(Gn()),i=new In("nodes-".concat(e.nodes.length,"-edges-").concat(e.edges.length));e.nodes.forEach((function(e,t){var r,o;n.addNode(t,Bn(Bn({},e),{x:null!==(r=e.x)&&void 0!==r?r:100*i.next(),y:null!==(o=e.y)&&void 0!==o?o:100*i.next()}))}));var r=e.nodes.length,o=Math.ceil(t*r/2);return e.edges.slice(0,o).forEach((function(e){n.addEdge(e.s,e.t)})),n},qn=function(e){return{label:e.label,minValue:e.minValue,maxValue:e.maxValue,initialValue:e.initialValue,step:e.step}},Zn=function(){return Zn=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Zn.apply(this,arguments)},Yn=function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{h(i.next(e))}catch(e){o(e)}}function s(e){try{h(i.throw(e))}catch(e){o(e)}}function h(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}h((i=i.apply(e,t||[])).next())}))},Xn=function(e,t){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(h){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,h])}}},Kn=function(){function e(e){var t=this;this.views=[],this.selectedNodes=[],this.selectedPoints=[],this.initialLayoutPromise=null;var n=e.graphData,i=e.sliderConfig,r=e.sigmaSettings,o=e.onSelectedNodesChange,a=e.onSelectedPointsChange,s=e.onFullScreenChange,h=e.onCoarsenessChange,u=e.onConnectivityChange,c=e.nodeColors,d=e.nodeLabels,l=e.nodeHoverLabels,f=e.nodeAttrs,p=e.defaultHoverTemplate,g=e.layoutConfig;this.graphData=n,this.sliderConfig=i,this.sigmaSettings=Zn({defaultHoverTemplate:p},r),this.nodeColors=c,this.nodeLabels=d,this.nodeHoverLabels=l,this.nodeAttrs=f,this.defaultHoverTemplate=p,this.layoutConfig=g||{},this.onSelectedNodesChange=o,this.onSelectedPointsChange=a,this.onFullScreenChange=s,this.onCoarsenessChange=h,this.onConnectivityChange=u,this.selectedLevel=this.sliderConfig.selectedLevel,this.sliderManager=new Tn([qn(i.coarseness),qn(i.connectivity)]),this.addSliderListeners(),this.nDataPoints=Math.max.apply(Math,this.graphData[this.selectedLevel].nodes.map((function(e){return Math.max.apply(Math,e.points)})))+1,this.dataPointMaps=function(e,t){var n={};return Object.keys(e).forEach((function(i){n[i]=function(e,t){var n=Array(t);return e.forEach((function(e,t){e.forEach((function(e){n[e]=t}))})),n}(e[i].nodes.map((function(e){return e.points})),t)})),n}(this.graphData,this.nDataPoints),this.currentGraph=Wn(this.graphData[this.selectedLevel],this.sliderConfig.connectivity.initialValue);var v=Zn(Zn({},wn(this.currentGraph)),this.layoutConfig);this.initialLayoutPromise=this.runInitialLayout({iterations:300,settings:Zn(Zn({},v),{warmupLayout:!0})}).then((function(){t.resetAllGraphViews(),t.initialLayoutPromise=null})),this.updateNodeAttributes()}return e.prototype.getView=function(e){return Yn(this,void 0,void 0,(function(){var t,n=this;return Xn(this,(function(i){switch(i.label){case 0:return!this.initialLayoutPromise&&this.animator?[3,2]:[4,this.initialLayoutPromise];case 1:i.sent(),i.label=2;case 2:if(!this.animator)throw Error("Animator does not exist. Cannot get GraphView.");return t=new Dn(e,this.sliderManager,{graph:this.currentGraph,animator:this.animator,mode:nn.inactive,settings:this.sigmaSettings,isFullScreen:!1,neighborHighlightingEnabled:!1,selectedNodes:[],onSelectedNodesChange:function(e){n.selectedNodes=e,n.selectedPoints=jn(n.selectedNodes,n.graphData,n.selectedLevel),n.onSelectedNodesChange(e),n.onSelectedPointsChange(n.selectedPoints)},onFullScreenChange:function(e){return n.onFullScreenChange(e)},onHighlightedNodesChange:function(){}}),this.views.push(t),t.appendGraphToContainer(),this.animator.start(),[4,t.graphManager.resetView()];case 3:return i.sent(),[2,t]}}))}))},e.prototype.deleteView=function(e){this.views=this.views.filter((function(t){return t!==e}))},e.prototype.setConnectivityLevel=function(e){var t=this,n=this.graphData[this.selectedLevel];this.currentGraph.clearEdges();var i=n.nodes.length,r=Math.ceil(e*i/2);n.edges.slice(0,r).forEach((function(e){t.currentGraph.addEdge(e.s,e.t)})),this.resetAnimator()},e.prototype.setCoarsenessLevel=function(e,t){return void 0===t&&(t=!1),Yn(this,void 0,void 0,(function(){var n,i,r;return Xn(this,(function(o){return e==this.selectedLevel||(n=this.selectedPoints,i=this.initializeNewGraph(e),r=Vn(e,n,this.dataPointMaps),this.updateGraphAndViewsWithNewGraph(i,r,t)),[2]}))}))},e.prototype.setNodeColors=function(e){this.nodeColors=e,this.updateNodeColors()},e.prototype.setNodeLabels=function(e){this.nodeLabels=e,this.updateNodeLabels()},e.prototype.setNodeHoverLabels=function(e){this.nodeHoverLabels=e,this.updateNodeHoverLabels()},e.prototype.setNodeAttrs=function(e){this.nodeAttrs=e,this.updateNodeAttributes()},e.prototype.setNodeHoverTemplate=function(e){this.defaultHoverTemplate=e,this.sigmaSettings.defaultHoverTemplate=e,this.updateAllGraphSigmaSettings()},e.prototype.setSelectedNodes=function(e){this.selectedNodes=e,this.selectedPoints=jn(this.selectedNodes,this.graphData,this.selectedLevel),this.updateViewsSelectedNodes(),this.onSelectedNodesChange(this.selectedNodes),this.onSelectedPointsChange(this.selectedPoints)},e.prototype.setSelectedPoints=function(e){this.selectedPoints=e,this.selectedNodes=Vn(this.selectedLevel,e,this.dataPointMaps),this.onSelectedPointsChange(e),this.updateViewsSelectedNodes(),this.onSelectedNodesChange(this.selectedNodes)},e.prototype.resetView=function(){var e=this;this.views.forEach((function(t){return Yn(e,void 0,void 0,(function(){return Xn(this,(function(e){switch(e.label){case 0:return[4,t.graphManager.resetView()];case 1:return e.sent(),[2]}}))}))}))},e.prototype.cleanup=function(){var e;this.views.forEach((function(e){e.graphManager.cleanup()})),null===(e=this.animator)||void 0===e||e.kill()},e.prototype.dispose=function(){var e;this.views.forEach((function(e){e.graphManager.dispose()})),null===(e=this.animator)||void 0===e||e.kill()},e.prototype.initializeNewGraph=function(e){var t=this.dataPointMaps[this.selectedLevel],n=this.currentGraph;this.selectedLevel=e;var i=Number(this.sliderManager.getSliderValue(this.sliderConfig.connectivity.label)),r=Wn(this.graphData[e],i),o=function(e,t){var n=new Array(t.nodes().length);return t.forEachNode((function(t,i){var r=Number(t),o=i.points,a=new Set;o.forEach((function(t){a.add(e[t])})),n[r]=Array.from(a)})),n}(t,r);return function(e,t,n){var i=Hn(e),r=i.minX,o=i.minY,a=i.maxX,s=i.maxY,h=t.order/e.order,u=Math.max(10,a-r)/100,c=Math.max(10,s-o)/100,d=Math.max(u,c);t.updateEachNodeAttributes((function(t,i){var r=Number(t),o=n[r],a=o.map((function(t){try{return e.getNodeAttribute(t,"x")}catch(e){return 0}})),s=o.map((function(t){try{return e.getNodeAttribute(t,"y")}catch(e){return 0}})),u=0,c=a.reduce((function(e,t){return isFinite(t)?(u+=1,e+t):e}),0),l=c/Math.max(u,1),f=0,p=s.reduce((function(e,t){return isFinite(t)?(f+=1,e+t):e}),0),g=p/Math.max(f,1);return Bn(Bn({},i),{x:h*(l+d*Math.random()),y:h*(g+d*Math.random())})}))}(n,r,o),r},e.prototype.updateGraphAndViewsWithNewGraph=function(e,t,n){var i,r=this;console.log("updateGraphAndViewsWithNewGraph"),this.selectedNodes=t,this.onSelectedNodesChange(t);var o=Zn(Zn(Zn({},wn(e)),this.layoutConfig),null===(i=this.animator)||void 0===i?void 0:i.params.settings),a=Hn(this.currentGraph),s={x:(a.maxX+a.minX)/2,y:(a.maxY+a.minY)/2},h=Hn(e),u=h.maxX-h.minX,c=h.maxY-h.minY;h.maxX,h.minX,h.maxY,h.minY,function(e,t){return void 0===t&&(t={}),i=function(){var n,i,r,o,a,s,h,u,c,d,l;return function(e,t){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(h){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,h])}}}(this,(function(f){switch(f.label){case 0:return n=Bn(Bn(Bn({},wn(e)),t),{warmupLayout:!0}),i=(0,at.kS)(e).map((function(e){return e.map(Number)})),r=un(e),o=Un.createWorker(st),a={iterations:100,nAnnealingSteps:4,settings:n,nodes:r.nodes.buffer,edges:r.edges.buffer,components:i,__messageId:"initialGraphLayout"},console.log("getStableLayout settings",n),o.postMessage(a,[r.nodes.buffer,r.edges.buffer]),[4,new Promise((function(e){o.onmessage=function(t){e({nodes:new Float32Array(t.data.nodes),settings:t.data.settings}),o.terminate()}}))];case 1:for(s=f.sent(),h=e.nodes().length,u=[],c=0;c<h;c++)d=s.nodes[10*c],l=s.nodes[10*c+1],u.push({x:d,y:l});return[2,{endPositions:u,settings:s.settings}]}}))},new((n=void 0)||(n=Promise))((function(e,t){function r(e){try{a(i.next(e))}catch(e){t(e)}}function o(e){try{a(i.throw(e))}catch(e){t(e)}}function a(t){var i;t.done?e(t.value):(i=t.value,i instanceof n?i:new n((function(e){e(i)}))).then(r,o)}a((i=i.apply(void 0,[])).next())}));var n,i}(e,o).then((function(i){var o,a=i.endPositions,h=i.settings,d=a,l=function(e){var t=1/0,n=1/0,i=-1/0,r=-1/0;return e.forEach((function(e){var o=e.x,a=e.y;o<t&&(t=o),a<n&&(n=a),o>i&&(i=o),a>r&&(r=a)})),{minX:t,minY:n,maxX:i,maxY:r}}(a),f=l.minX,p=l.minY,g=l.maxX,v=l.maxY,m={x:(g+f)/2,y:(v+p)/2},y=(g-f)/u,b=(v-p)/c;console.log("settings returned by getStableLayout",h),r.layoutConfig=h,r.currentGraph.updateEachNodeAttributes((function(e,t){return Zn(Zn({},t),{highlighted:!1})})),r.updateAllGraphViews(e,t),r.updateNodeAttributes(),console.log("xRatio",y),console.log("yRatio",b),r.views.forEach((function(e){e.graphManager.unzoomAndShift(Math.max(y,b),s,m,500)}));var w=new Nn(r.currentGraph,d,"linear",500);null===(o=r.animator)||void 0===o||o.kill(),w.run((function(){var e=r.getNewAnimator(h);r.animator=e,r.views.forEach((function(t){n&&t.graphManager.resetView(),t.graphManager.updateAnimator(e)})),r.animator.start()}))}))},e.prototype.updateNodeColors=function(){if(this.nodeColors){var e=this.nodeColors[this.selectedLevel];e&&this.currentGraph.updateEachNodeAttributes((function(t,n){var i=Number(t),r=e[i];return Zn(Zn({},n),{color:r||n.color})}))}},e.prototype.updateNodeLabels=function(){if(this.nodeLabels){var e=this.nodeLabels[this.selectedLevel];e&&this.currentGraph.updateEachNodeAttributes((function(t,n){var i=Number(t),r=e[i];return Zn(Zn({},n),{label:r||n.label})}))}},e.prototype.updateNodeHoverLabels=function(){if(this.nodeHoverLabels){var e=this.nodeHoverLabels[this.selectedLevel];e&&this.currentGraph.updateEachNodeAttributes((function(t,n){var i=Number(t),r=e[i];return Zn(Zn({},n),{labelToDisplay:r||n.labelToDisplay})}))}},e.prototype.updateViewsSelectedNodes=function(){var e=this;this.views.forEach((function(t){t.graphManager.setSelectedNodes(e.selectedNodes,!1)}))},e.prototype.updateNodeAttributes=function(){if(this.updateNodeColors(),this.updateNodeLabels(),this.updateNodeHoverLabels(),this.nodeAttrs){var e=this.nodeAttrs[this.selectedLevel];e&&this.currentGraph.updateEachNodeAttributes((function(t,n){var i=Number(t),r=e[i];return Zn(Zn({},n),r||{})}))}},e.prototype.runInitialLayout=function(e){return Yn(this,void 0,void 0,(function(){var t;return Xn(this,(function(n){switch(n.label){case 0:return[4,pn(this.currentGraph,e)];case 1:return t=n.sent(),console.log("runInitialLayout returned settings",t),this.animator&&this.animator.kill(),this.animator=this.getNewAnimator(),this.animator.params.settings=t,this.layoutConfig=t,this.animator.forceNodePositionUpdate(),this.startAnimator(),[2]}}))}))},e.prototype.resetAnimator=function(){var e;null===(e=this.animator)||void 0===e||e.kill(),this.animator=this.getNewAnimator(),this.startAnimator()},e.prototype.startAnimator=function(){if(this.animator){this.animator.start();var e=this.animator;this.views.forEach((function(t){t.graphManager.updateAnimator(e)}))}},e.prototype.getNewAnimator=function(e){var t;return new dn(this.currentGraph,{settings:Zn(Zn(Zn(Zn({},wn(this.currentGraph)),this.layoutConfig),null===(t=this.animator)||void 0===t?void 0:t.params.settings),e||{})},{maxiters:1500,miniters:200,convergenceThreshold:.1})},e.prototype.addSliderListeners=function(){var e=this;this.sliderManager.addListener(this.sliderConfig.coarseness.label,(function(t){return Yn(e,void 0,void 0,(function(){return Xn(this,(function(e){switch(e.label){case 0:return[4,this.handleCoarsenessChange(t)];case 1:return e.sent(),this.onCoarsenessChange(t),[2]}}))}))})),this.sliderManager.addListener(this.sliderConfig.connectivity.label,(function(t){e.handleConnectivityChange(t),e.onConnectivityChange(t)}))},e.prototype.handleCoarsenessChange=function(e){return Yn(this,void 0,void 0,(function(){return Xn(this,(function(t){switch(t.label){case 0:return[4,this.setCoarsenessLevel(e.toString())];case 1:return t.sent(),[2]}}))}))},e.prototype.handleConnectivityChange=function(e){this.setConnectivityLevel(e)},e.prototype.updateAllGraphViews=function(e,t){this.currentGraph=e,this.views.forEach((function(t){t.graphManager.updateGraph(e)})),this.selectedNodes=t,this.updateViewsSelectedNodes()},e.prototype.updateAllGraphSigmaSettings=function(){var e=this;this.views.forEach((function(t){t.graphManager.updateSigmaSettings(e.sigmaSettings)}))},e.prototype.resetAllGraphViews=function(){this.views.forEach((function(e){e.graphManager.resetView()}))},e}()})(),i})(),e.exports=t()},364:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n,i,r,o=e[1]||"",a=e[3];if(!a)return o;if(t&&"function"==typeof btoa){var s=(n=a,i=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),"/*# ".concat(r," */")),h=a.sources.map((function(e){return"/*# sourceURL=".concat(a.sourceRoot||"").concat(e," */")}));return[o].concat(h).concat([s]).join("\n")}return[o].join("\n")}(t,e);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,i){"string"==typeof e&&(e=[[null,e,""]]);var r={};if(i)for(var o=0;o<this.length;o++){var a=this[o][0];null!=a&&(r[a]=!0)}for(var s=0;s<e.length;s++){var h=[].concat(e[s]);i&&r[h[0]]||(n&&(h[2]?h[2]="".concat(n," and ").concat(h[2]):h[2]=n),t.push(h))}},t}},463:(e,t,n)=>{var i=n(72),r=n(930);"string"==typeof(r=r.__esModule?r.default:r)&&(r=[[e.id,r,""]]);i(r,{insert:"head",singleton:!1}),e.exports=r.locals||{}},356:(e,t,n)=>{var i=n(72),r=n(969);"string"==typeof(r=r.__esModule?r.default:r)&&(r=[[e.id,r,""]]);i(r,{insert:"head",singleton:!1}),e.exports=r.locals||{}},72:(e,t,n)=>{"use strict";var i,r=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),o=[];function a(e){for(var t=-1,n=0;n<o.length;n++)if(o[n].identifier===e){t=n;break}return t}function s(e,t){for(var n={},i=[],r=0;r<e.length;r++){var s=e[r],h=t.base?s[0]+t.base:s[0],u=n[h]||0,c="".concat(h," ").concat(u);n[h]=u+1;var d=a(c),l={css:s[1],media:s[2],sourceMap:s[3]};-1!==d?(o[d].references++,o[d].updater(l)):o.push({identifier:c,updater:g(l,t),references:1}),i.push(c)}return i}function h(e){var t=document.createElement("style"),i=e.attributes||{};if(void 0===i.nonce){var o=n.nc;o&&(i.nonce=o)}if(Object.keys(i).forEach((function(e){t.setAttribute(e,i[e])})),"function"==typeof e.insert)e.insert(t);else{var a=r(e.insert||"head");if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(t)}return t}var u,c=(u=[],function(e,t){return u[e]=t,u.filter(Boolean).join("\n")});function d(e,t,n,i){var r=n?"":i.media?"@media ".concat(i.media," {").concat(i.css,"}"):i.css;if(e.styleSheet)e.styleSheet.cssText=c(t,r);else{var o=document.createTextNode(r),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(o,a[t]):e.appendChild(o)}}function l(e,t,n){var i=n.css,r=n.media,o=n.sourceMap;if(r?e.setAttribute("media",r):e.removeAttribute("media"),o&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),e.styleSheet)e.styleSheet.cssText=i;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(i))}}var f=null,p=0;function g(e,t){var n,i,r;if(t.singleton){var o=p++;n=f||(f=h(t)),i=d.bind(null,n,o,!1),r=d.bind(null,n,o,!0)}else n=h(t),i=l.bind(null,n,t),r=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)};return i(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;i(e=t)}else r()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=(void 0===i&&(i=Boolean(window&&document&&document.all&&!window.atob)),i));var n=s(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var i=0;i<n.length;i++){var r=a(n[i]);o[r].references--}for(var h=s(e,t),u=0;u<n.length;u++){var c=a(n[u]);0===o[c].references&&(o[c].updater(),o.splice(c,1))}n=h}}}},55:t=>{"use strict";t.exports=e},330:e=>{"use strict";e.exports=JSON.parse('{"name":"landscape-widget","version":"0.4.0-rc.4","description":"Jupyter widget for interactive graph visualization","keywords":["jupyter","jupyterlab","jupyterlab-extension","widgets"],"files":["lib/**/*.js","dist/*.js","css/*.css"],"author":{"name":"BlueLightAI","email":"support@bluelightai.com"},"license":"SEE LICENSE IN LICENSE.txt","main":"lib/index.js","types":"./lib/index.d.ts","repository":{"type":"git","url":"https://github.com/BlueLightAI/jupyter-landscapes"},"scripts":{"build":"yarn run build:lib && yarn run build:nbextension && yarn run build:labextension:dev","build:prod":"yarn run build:lib && yarn run build:nbextension && yarn run build:labextension","build:labextension":"jupyter labextension build .","build:labextension:dev":"jupyter labextension build --development True .","build:lib":"tsc","build:nbextension":"webpack","build:license-report-json":"license-report --output=json --config=.license-reportrc > ./license-report.json","build:license-report-html":"license-report --output=html --config=.license-reportrc > ./license-report.html","build-all":"node build.js","clean":"yarn run clean:lib && yarn run clean:nbextension && yarn run clean:labextension","clean:lib":"rimraf lib","clean:labextension":"rimraf landscape_widget/labextension","clean:nbextension":"rimraf landscape_widget/nbextension/static/index.js","lint":"eslint . --ext .ts,.tsx --fix","lint:check":"eslint . --ext .ts,.tsx","prepack":"yarn run build:lib","test":"jest","watch":"npm-run-all -p watch:*","watch:lib":"tsc -w","watch:nbextension":"webpack --watch --mode=development","watch:labextension":"jupyter labextension watch ."},"dependencies":{"@jupyter-widgets/base":"^1.1.10 || ^2 || ^3 || ^4 || ^5 || ^6","blai-graph-widget":"link:./blai-graph-widget","lodash":"^4.17.21","rand-seed":"^1.0.2","ws":"^7.5.10 || ^8.17.1 || >=9"},"devDependencies":{"@babel/core":"^7.5.0","@babel/preset-env":"^7.5.0","@jupyter-widgets/base-manager":"^1.0.3","@jupyterlab/builder":"^4.3.3","@lumino/application":"^1.6.0","@lumino/widgets":"^1.6.0","@types/jest":"^26.0.0","@types/webpack-env":"^1.13.6","@typescript-eslint/eslint-plugin":"^3.6.0","@typescript-eslint/parser":"^3.6.0","acorn":"^7.2.0","css-loader":"^3.2.0","eslint":"^7.4.0","eslint-config-prettier":"^6.11.0","eslint-plugin-prettier":"^3.1.4","fs-extra":"^7.0.0","identity-obj-proxy":"^3.0.0","jest":"^29.0.0","license-report":"^6.5.0","mkdirp":"^0.5.1","npm-run-all":"^4.1.3","prettier":"^2.0.5","rimraf":"^2.6.2","sass":"^1.58.0","sass-loader":"^13.2.0","source-map-loader":"^1.1.3","style-loader":"^1.0.0","ts-jest":"^29.0.0","ts-loader":"^8.0.0","typescript":"^5.7.2","webpack":"^5.61.0","webpack-cli":"^4.0.0"},"resolutions":{"blai-graph-widget":"file:./blai-graph-widget"},"jupyterlab":{"extension":"lib/plugin","outputDir":"landscape_widget/labextension/","webpackConfig":"./lab.webpack.config.js","sharedPackages":{"@jupyter-widgets/base":{"bundled":false,"singleton":true}}}}')}},n={};function i(e){var r=n[e];if(void 0!==r)return r.exports;var o=n[e]={id:e,exports:{}};return t[e].call(o.exports,o,o.exports,i),o.exports}i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.nc=void 0;var r={};return(()=>{"use strict";i.r(r),i.d(r,{LandscapeModel:()=>b,LandscapeView:()=>w,MODULE_NAME:()=>n,MODULE_VERSION:()=>t});const e=i(330),t=e.version,n=e.name;var o=i(55);const a={0:{nodes:[{points:[0],size:4},{points:[1],size:4},{points:[2],size:4},{points:[3],size:4}],edges:[{s:0,t:1,w:1},{s:1,t:2,w:.75},{s:2,t:3,w:.5},{s:0,t:3,w:.25}]},1:{nodes:[{points:[0,1],size:4},{points:[2,3],size:4}],edges:[{s:0,t:1,w:1}]},2:{nodes:[{points:[0,1,2,3],size:4}],edges:[]}};i(463);var s=i(858),h=(i(356),function(e,t){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},h(e,t)});function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}h(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var c,d=function(){function e(){}return e._xfnv1a=function(e){for(var t=2166136261,n=0;n<e.length;n++)t=Math.imul(t^e.charCodeAt(n),16777619);return function(){return t+=t<<13,t^=t>>>7,t+=t<<3,t^=t>>>17,(t+=t<<5)>>>0}},e}(),l=function(e){function t(n){var i=e.call(this)||this;return i.a=t._xfnv1a(n)(),i}return u(t,e),t.prototype.next=function(){var e=this.a+=1831565813;return e=Math.imul(e^e>>>15,1|e),(((e^=e+Math.imul(e^e>>>7,61|e))^e>>>14)>>>0)/4294967296},t}(d),f=function(e){function t(n){var i=e.call(this)||this,r=t._xfnv1a(n);return i.a=r(),i.b=r(),i.c=r(),i.d=r(),i}return u(t,e),t.prototype.next=function(){this.a>>>=0,this.b>>>=0,this.c>>>=0,this.d>>>=0;var e=this.a+this.b|0;return this.a=this.b^this.b>>>9,this.b=this.c+(this.c<<3)|0,this.c=this.c<<21|this.c>>>11,this.d=this.d+1|0,e=e+this.d|0,this.c=this.c+e|0,(e>>>0)/4294967296},t}(d),p=function(e){function t(n){var i=e.call(this)||this,r=t._xfnv1a(n);return i.a=r(),i.b=r(),i.c=r(),i.d=r(),i}return u(t,e),t.prototype.next=function(){var e=this.b<<9,t=5*this.a;return t=t<<7|9*(t>>>25),this.c^=this.a,this.d^=this.b,this.b^=this.c,this.a^=this.d,this.c^=e,this.d=this.d<<11|this.d>>>21,(t>>>0)/4294967296},t}(d);!function(e){e.sfc32="sfc32",e.mulberry32="mulberry32",e.xoshiro128ss="xoshiro128ss"}(c||(c={}));var g=function(){function e(e,t){void 0===t&&(t=c.sfc32),this.str=e,this.prng=t,this.generator=this._initializeGenerator()}return e.prototype.next=function(){return this.generator.next()},e.prototype._initializeGenerator=function(){if(function(e){return null===e}(e=this.str)||function(e){return void 0===e}(e))return this.wrap();var e;switch(this.prng){case"sfc32":return new f(this.str);case"mulberry32":return new l(this.str);case"xoshiro128ss":return new p(this.str);default:return this.wrap()}},e.prototype.wrap=function(){return{next:function(){return Math.random()}}},e}(),v=function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{h(i.next(e))}catch(e){o(e)}}function s(e){try{h(i.throw(e))}catch(e){o(e)}}function h(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}h((i=i.apply(e,t||[])).next())}))};const m={allowInvalidContainer:!0,zoomToSizeRatioFunction:e=>e>1.5?Math.sqrt(1.5*e):e},y={adjustSizes:!0};class b extends o.DOMWidgetModel{initialize(e,t){super.initialize(e,t),this.on("change:colors",this.updateNodeColors,this),this.on("change:node_labels",this.updateNodeLabels,this),this.on("change:node_hover_labels",this.updateNodeHoverLabels,this),this.on("change:node_attrs",this.updateNodeAttrs,this),this.on("change:rich_node_hover_template",this.updateHoverTemplate,this),this.on("change:selected_level",this.updateSelectedLevel,this),this.on("change:avg_degree",this.updateAvgDegree,this),this.on("change:selected_points",this.updateSelectedPoints,this),this.on("msg:custom",this.handleCustomMessage,this),this.loadGraph()}loadGraph(){return v(this,void 0,void 0,(function*(){const e=this.get("graph"),t=this.get("node_labels"),n=this.get("node_hover_labels"),i=Object.keys(e).map(Number),r=Math.min(...i),o=Math.max(...i),a=this.get("selected_level")||Math.floor((r+o)/2),h={coarseness:{label:"Coarseness",minValue:r,maxValue:o,initialValue:a,step:1},connectivity:{label:"Connectivity",minValue:0,maxValue:20,initialValue:this.get("avg_degree")||6,step:.1},selectedLevel:a.toString()},u=this.get("layout").attributes||{},c={};if(u.width&&u.height){const e=String(u.width),t=String(u.height);if(e.endsWith("px")&&t.endsWith("px")){const n=Number(e.slice(0,e.length-2)),i=Number(t.slice(0,t.length-2));c.expectedDims=[n,i]}}this.multiResolutionGraph=new s.MultiResolutionGraph({graphData:e,sliderConfig:h,sigmaSettings:Object.assign(Object.assign({},m),this.get("sigma_settings")||{}),onSelectedNodesChange:()=>{},onSelectedPointsChange:this.setSelectedPoints.bind(this),onFullScreenChange:this.toggleExpandedLayout.bind(this),onCoarsenessChange:this.setCoarsenessLevel.bind(this),onConnectivityChange:this.setConnectivityLevel.bind(this),nodeLabels:t,nodeHoverLabels:n,layoutConfig:Object.assign(Object.assign({adjustSizes:!0},c),this.get("layout_config"))}),this.updateNodeProperties(),this.updateHoverTemplate()}))}updateNodeProperties(){this.updateNodeColors(),this.updateNodeLabels(),this.updateNodeHoverLabels(),this.updateNodeAttrs()}setSelectedPoints(e){this.set("selected_points",e),this.save_changes()}toggleExpandedLayout(e){this.set("is_expanded_layout",e),this.save_changes()}setCoarsenessLevel(e){this.set("selected_level",e),this.save_changes()}setConnectivityLevel(e){this.set("avg_degree",e),this.save_changes()}updateNodeColors(){if(!this.multiResolutionGraph)return;const e=this.get("colors");e&&this.multiResolutionGraph.setNodeColors(e)}updateNodeLabels(){if(!this.multiResolutionGraph)return;const e=this.get("node_labels");e&&this.multiResolutionGraph.setNodeLabels(e)}updateNodeHoverLabels(){if(!this.multiResolutionGraph)return;const e=this.get("node_hover_labels");e&&this.multiResolutionGraph.setNodeHoverLabels(e)}updateNodeAttrs(){if(!this.multiResolutionGraph)return;const e=this.get("node_attrs");e&&this.multiResolutionGraph.setNodeAttrs(e)}updateHoverTemplate(){if(!this.multiResolutionGraph)return;const e=this.get("rich_node_hover_template");e&&this.multiResolutionGraph.setNodeHoverTemplate(e)}updateSelectedLevel(){return v(this,void 0,void 0,(function*(){if(!this.multiResolutionGraph)return;const e=this.get("selected_level");e&&String(e)!==String(this.multiResolutionGraph.selectedLevel)&&(yield this.multiResolutionGraph.setCoarsenessLevel(e),this.multiResolutionGraph.sliderManager.setSliderValue("Coarseness",e))}))}updateAvgDegree(){if(!this.multiResolutionGraph)return;const e=this.get("avg_degree");(e||0===e)&&(this.multiResolutionGraph.setConnectivityLevel(e),this.multiResolutionGraph.sliderManager.setSliderValue("Connectivity",e))}updateSelectedPoints(){if(!this.multiResolutionGraph)return;const e=this.get("selected_points");e&&this.multiResolutionGraph.setSelectedPoints(e)}disposeGraph(){this.multiResolutionGraph.cleanup(),this.multiResolutionGraph.dispose()}resetView(){this.multiResolutionGraph.resetView()}handleCustomMessage(e){"dispose_graph"===e.event_type?this.disposeGraph():"reset_view"===e.event_type&&this.resetView()}defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:b.model_name,_model_module:b.model_module,_model_module_version:b.model_module_version,_view_name:b.view_name,_view_module:b.view_module,_view_module_version:b.view_module_version,graph:a,colors:null,node_labels:null,node_hover_labels:null,node_sizes:null,selected_nodes:[],sigma_settings:m,background_color:null,is_expanded_layout:!1,layout_settings:y})}}b.serializers=Object.assign({},o.DOMWidgetModel.serializers),b.model_name="LandscapeModel",b.model_module=n,b.model_module_version=t,b.view_name="LandscapeView",b.view_module=n,b.view_module_version=t;class w extends o.DOMWidgetView{constructor(e){super(e),this.view=null;const t=new g;this.containerId=`landscape-container-${t.next().toString(36).substring(2)}`}render(){this.createLandscapeContainer(),this.setupGraphManager(),this.model.on("change:background_color",this.setBackgroundColor,this)}createLandscapeContainer(){this._landscapeContainer=document.createElement("div"),this._landscapeContainer.id=this.containerId,this._landscapeContainer.style.position="relative",this._landscapeContainer.classList.add("landscape-container"),this.setBackgroundColor(),this.el.appendChild(this._landscapeContainer),this.el.classList.add("custom-widget")}setupGraphManager(){return v(this,void 0,void 0,(function*(){const e=document.getElementById(this.containerId);e&&this.model.multiResolutionGraph?(this.view=yield this.model.multiResolutionGraph.getView(e),yield this.view.graphManager.resetView()):setTimeout((()=>this.setupGraphManager()),100)}))}setBackgroundColor(){const e=this.model.get("background_color");e&&(this.el.style.backgroundColor=e,this._landscapeContainer.style.backgroundColor=e,this._landscapeContainer.style.setProperty("--sigma-background-color",e))}remove(){return console.log("LandscapeView.remove() called, id",this.containerId),this.view&&(this.view.graphManager.cleanup(),this.view.graphManager.dispose(),this.model.multiResolutionGraph&&(this.model.multiResolutionGraph.deleteView(this.view),this.model.multiResolutionGraph.sliderManager.deleteView(this.view.sliderView))),super.remove()}}})(),r})()));
|
|
2
2
|
//# sourceMappingURL=index.js.map
|